From: Cris Di Sclafani Date: Wed, 28 Oct 2020 09:19:04 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22http:/google.github.io/material-design-icons?a=commitdiff_plain;h=64b4463f62674a97521769b4211eff508e93aa1c;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 998f2f3..469353b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "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-10-28T08:52:30.305Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.4", "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-10-28T09:11:10.605Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4b2f46f..076a435 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.4", "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-10-28T08:52:30.305Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.4", "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-10-28T09:11:10.605Z", "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 05dd32a..7fd6440 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 _0xa5db=['contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','VIRTUAL','getDataValue','action'];(function(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0xa5db,0x1be));var _0xba5d=function(_0x2c66ab,_0x640b40){_0x2c66ab=_0x2c66ab-0x0;var _0x482f79=_0xa5db[_0x2c66ab];return _0x482f79;};'use strict';var Sequelize=require(_0xba5d('0x0'));module['exports']={'name':{'type':Sequelize[_0xba5d('0x1')],'get':function(_0x1f3f96){return this[_0xba5d('0x2')](_0xba5d('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xba5d('0x4'),_0xba5d('0x5'),_0xba5d('0x6'),_0xba5d('0x7'),_0xba5d('0x8'),_0xba5d('0x9'),_0xba5d('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xba5d('0xb')},'data1':{'type':Sequelize[_0xba5d('0xc')](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[_0xba5d('0xc')](0x1000),'comment':_0xba5d('0xd')},'data3':{'type':Sequelize[_0xba5d('0xc')](0x1000),'comment':_0xba5d('0xe')},'data4':{'type':Sequelize[_0xba5d('0xc')](0x1000)},'data5':{'type':Sequelize[_0xba5d('0xc')](0x1000)},'data6':{'type':Sequelize[_0xba5d('0xc')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xce44=['contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','TEXT','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xce44,0x1c2));var _0x4ce4=function(_0x5699e3,_0x1eb96a){_0x5699e3=_0x5699e3-0x0;var _0x219137=_0xce44[_0x5699e3];return _0x219137;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ce4('0x0')],'get':function(_0x477d1c){return this['getDataValue'](_0x4ce4('0x1'));}},'action':{'type':Sequelize[_0x4ce4('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4ce4('0x3'),_0x4ce4('0x4'),_0x4ce4('0x5'),_0x4ce4('0x6'),_0x4ce4('0x7'),_0x4ce4('0x8'),_0x4ce4('0x9'),_0x4ce4('0xa')]],'msg':_0x4ce4('0xb')}},'comment':_0x4ce4('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4ce4('0xc')},'data2':{'type':Sequelize[_0x4ce4('0x2')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x4ce4('0x2')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x4ce4('0x2')](0x1000)},'data5':{'type':Sequelize[_0x4ce4('0x2')](0x1000)},'data6':{'type':Sequelize[_0x4ce4('0x2')]},'data7':{'type':Sequelize[_0x4ce4('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5639751..e825dee 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 _0x6b1b=['find','body','params','catch','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','update','Action'];(function(_0x557661,_0x384cdc){var _0x2a1968=function(_0x423221){while(--_0x423221){_0x557661['push'](_0x557661['shift']());}};_0x2a1968(++_0x384cdc);}(_0x6b1b,0x1c6));var _0xb6b1=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6b1b[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0xb6b1('0x0'));var emlformat=require(_0xb6b1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6b1('0x2'));var rp=require(_0xb6b1('0x3'));var moment=require(_0xb6b1('0x4'));var BPromise=require(_0xb6b1('0x5'));var Mustache=require(_0xb6b1('0x6'));var util=require(_0xb6b1('0x7'));var path=require(_0xb6b1('0x8'));var sox=require('sox');var csv=require(_0xb6b1('0x9'));var ejs=require(_0xb6b1('0xa'));var fs=require('fs');var _=require(_0xb6b1('0xb'));var squel=require(_0xb6b1('0xc'));var crypto=require(_0xb6b1('0xd'));var jsforce=require(_0xb6b1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb6b1('0x9'));var querystring=require(_0xb6b1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb6b1('0x10'));var qs=require(_0xb6b1('0x11'));var as=require(_0xb6b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6b1('0x13'))(_0xb6b1('0x14'));var utils=require('../../config/utils');var config=require(_0xb6b1('0x15'));var db=require(_0xb6b1('0x16'))['db'];function respondWithStatusCode(_0x526afc,_0x26c6fb){_0x26c6fb=_0x26c6fb||0xcc;return function(_0x5f1671){if(_0x5f1671){return _0x526afc[_0xb6b1('0x17')](_0x26c6fb);}return _0x526afc[_0xb6b1('0x18')](_0x26c6fb)[_0xb6b1('0x19')]();};}function respondWithResult(_0x1f03ce,_0x4c47f9){_0x4c47f9=_0x4c47f9||0xc8;return function(_0x4da0d8){if(_0x4da0d8){return _0x1f03ce['status'](_0x4c47f9)['json'](_0x4da0d8);}};}function respondWithFilteredResult(_0x258ba5,_0x468579){return function(_0x3a4cbc){if(_0x3a4cbc){var _0x14435a=_0x3a4cbc['count'],_0x4d86ba=_0x468579[_0xb6b1('0x1a')],_0x197bb8=_0x468579[_0xb6b1('0x1a')]+_0x468579[_0xb6b1('0x1b')],_0x1cadcc;if(_0x197bb8>=_0x14435a){_0x197bb8=_0x14435a;_0x1cadcc=0xc8;}else{_0x1cadcc=0xce;}_0x258ba5[_0xb6b1('0x18')](_0x1cadcc);return _0x258ba5[_0xb6b1('0x1c')](_0xb6b1('0x1d'),_0x4d86ba+'-'+_0x197bb8+'/'+_0x14435a)['json'](_0x3a4cbc);}return null;};}function patchUpdates(_0x44e6de){return function(_0x232576){try{jsonpatch[_0xb6b1('0x1e')](_0x232576,_0x44e6de,!![]);}catch(_0x10903c){return BPromise[_0xb6b1('0x1f')](_0x10903c);}return _0x232576[_0xb6b1('0x20')]();};}function saveUpdates(_0x56b64f,_0x16967c){return function(_0x14cba9){if(_0x14cba9){return _0x14cba9['update'](_0x56b64f)[_0xb6b1('0x21')](function(_0x389636){return _0x389636;});}return null;};}function removeEntity(_0x1d175d,_0x478566){return function(_0x33c58d){if(_0x33c58d){return _0x33c58d[_0xb6b1('0x22')]()[_0xb6b1('0x21')](function(){_0x1d175d[_0xb6b1('0x18')](0xcc)[_0xb6b1('0x19')]();});}};}function handleEntityNotFound(_0x2eaeaa,_0x2de10a){return function(_0x38a96c){if(!_0x38a96c){_0x2eaeaa[_0xb6b1('0x17')](0x194);}return _0x38a96c;};}function handleError(_0x122844,_0x540835){_0x540835=_0x540835||0x1f4;return function(_0x508969){logger[_0xb6b1('0x23')](_0x508969[_0xb6b1('0x24')]);if(_0x508969[_0xb6b1('0x25')]){delete _0x508969[_0xb6b1('0x25')];}_0x122844[_0xb6b1('0x18')](_0x540835)[_0xb6b1('0x26')](_0x508969);};}exports[_0xb6b1('0x27')]=function(_0x1b3c90,_0x4f8fc9){if(_0x1b3c90['body']['id']){delete _0x1b3c90['body']['id'];}return db[_0xb6b1('0x28')][_0xb6b1('0x29')]({'where':{'id':_0x1b3c90['params']['id']}})[_0xb6b1('0x21')](handleEntityNotFound(_0x4f8fc9,null))[_0xb6b1('0x21')](saveUpdates(_0x1b3c90[_0xb6b1('0x2a')],null))['then'](respondWithResult(_0x4f8fc9,null))['catch'](handleError(_0x4f8fc9,null));};exports[_0xb6b1('0x22')]=function(_0x144aa3,_0x2b0928){return db[_0xb6b1('0x28')]['find']({'where':{'id':_0x144aa3[_0xb6b1('0x2b')]['id']}})[_0xb6b1('0x21')](handleEntityNotFound(_0x2b0928,null))['then'](removeEntity(_0x2b0928,null))[_0xb6b1('0x2c')](handleError(_0x2b0928,null));}; \ No newline at end of file +var _0x0a1b=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','body','find','params','catch','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox'];(function(_0x4276b5,_0x4ce07e){var _0xaa936=function(_0x41d9fc){while(--_0x41d9fc){_0x4276b5['push'](_0x4276b5['shift']());}};_0xaa936(++_0x4ce07e);}(_0x0a1b,0xd0));var _0xb0a1=function(_0x4c43eb,_0x53f811){_0x4c43eb=_0x4c43eb-0x0;var _0x5e2955=_0x0a1b[_0x4c43eb];return _0x5e2955;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0a1('0x0'));var rimraf=require(_0xb0a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb0a1('0x3'));var Mustache=require(_0xb0a1('0x4'));var util=require('util');var path=require(_0xb0a1('0x5'));var sox=require(_0xb0a1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0a1('0x7'));var squel=require('squel');var crypto=require(_0xb0a1('0x8'));var jsforce=require(_0xb0a1('0x9'));var deskjs=require(_0xb0a1('0xa'));var toCsv=require(_0xb0a1('0xb'));var querystring=require(_0xb0a1('0xc'));var Papa=require(_0xb0a1('0xd'));var Redis=require(_0xb0a1('0xe'));var authService=require(_0xb0a1('0xf'));var qs=require(_0xb0a1('0x10'));var as=require(_0xb0a1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0a1('0x12'))(_0xb0a1('0x13'));var utils=require(_0xb0a1('0x14'));var config=require(_0xb0a1('0x15'));var db=require(_0xb0a1('0x16'))['db'];function respondWithStatusCode(_0x3ba94e,_0x47f992){_0x47f992=_0x47f992||0xcc;return function(_0x338558){if(_0x338558){return _0x3ba94e[_0xb0a1('0x17')](_0x47f992);}return _0x3ba94e[_0xb0a1('0x18')](_0x47f992)[_0xb0a1('0x19')]();};}function respondWithResult(_0x12dfff,_0x3f1aba){_0x3f1aba=_0x3f1aba||0xc8;return function(_0x3a9750){if(_0x3a9750){return _0x12dfff[_0xb0a1('0x18')](_0x3f1aba)[_0xb0a1('0x1a')](_0x3a9750);}};}function respondWithFilteredResult(_0x703ce7,_0x4fd248){return function(_0x5780a1){if(_0x5780a1){var _0x5c7cd6=_0x5780a1[_0xb0a1('0x1b')],_0x3ce210=_0x4fd248[_0xb0a1('0x1c')],_0x59057a=_0x4fd248['offset']+_0x4fd248[_0xb0a1('0x1d')],_0x2780d4;if(_0x59057a>=_0x5c7cd6){_0x59057a=_0x5c7cd6;_0x2780d4=0xc8;}else{_0x2780d4=0xce;}_0x703ce7[_0xb0a1('0x18')](_0x2780d4);return _0x703ce7[_0xb0a1('0x1e')](_0xb0a1('0x1f'),_0x3ce210+'-'+_0x59057a+'/'+_0x5c7cd6)[_0xb0a1('0x1a')](_0x5780a1);}return null;};}function patchUpdates(_0x573fc6){return function(_0x172e4a){try{jsonpatch[_0xb0a1('0x20')](_0x172e4a,_0x573fc6,!![]);}catch(_0x25d7ab){return BPromise['reject'](_0x25d7ab);}return _0x172e4a[_0xb0a1('0x21')]();};}function saveUpdates(_0x2c7e68,_0xdca70c){return function(_0x22d9d9){if(_0x22d9d9){return _0x22d9d9[_0xb0a1('0x22')](_0x2c7e68)[_0xb0a1('0x23')](function(_0x48a252){return _0x48a252;});}return null;};}function removeEntity(_0x1e3d0b,_0x5420ce){return function(_0x50120a){if(_0x50120a){return _0x50120a[_0xb0a1('0x24')]()[_0xb0a1('0x23')](function(){_0x1e3d0b[_0xb0a1('0x18')](0xcc)[_0xb0a1('0x19')]();});}};}function handleEntityNotFound(_0x5c7780,_0x2f3f35){return function(_0x8e7d47){if(!_0x8e7d47){_0x5c7780[_0xb0a1('0x17')](0x194);}return _0x8e7d47;};}function handleError(_0x263958,_0xe41439){_0xe41439=_0xe41439||0x1f4;return function(_0x422749){logger[_0xb0a1('0x25')](_0x422749['stack']);if(_0x422749[_0xb0a1('0x26')]){delete _0x422749['name'];}_0x263958[_0xb0a1('0x18')](_0xe41439)['send'](_0x422749);};}exports['update']=function(_0x1954f8,_0x8ae96e){if(_0x1954f8[_0xb0a1('0x27')]['id']){delete _0x1954f8['body']['id'];}return db['Action'][_0xb0a1('0x28')]({'where':{'id':_0x1954f8[_0xb0a1('0x29')]['id']}})['then'](handleEntityNotFound(_0x8ae96e,null))[_0xb0a1('0x23')](saveUpdates(_0x1954f8['body'],null))[_0xb0a1('0x23')](respondWithResult(_0x8ae96e,null))[_0xb0a1('0x2a')](handleError(_0x8ae96e,null));};exports[_0xb0a1('0x24')]=function(_0x220936,_0x36f30e){return db['Action'][_0xb0a1('0x28')]({'where':{'id':_0x220936[_0xb0a1('0x29')]['id']}})['then'](handleEntityNotFound(_0x36f30e,null))[_0xb0a1('0x23')](removeEntity(_0x36f30e,null))[_0xb0a1('0x2a')](handleError(_0x36f30e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 72f9eb8..a9ae3ea 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 _0x87ab=['util','bluebird','request-promise','path','rimraf','../../config/environment','Action','tools_actions'];(function(_0x2b4aa0,_0x134494){var _0x800811=function(_0x172332){while(--_0x172332){_0x2b4aa0['push'](_0x2b4aa0['shift']());}};_0x800811(++_0x134494);}(_0x87ab,0x80));var _0xb87a=function(_0x40521a,_0xf2efc1){_0x40521a=_0x40521a-0x0;var _0x16428a=_0x87ab[_0x40521a];return _0x16428a;};'use strict';var _=require('lodash');var util=require(_0xb87a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb87a('0x1'));var rp=require(_0xb87a('0x2'));var fs=require('fs');var path=require(_0xb87a('0x3'));var rimraf=require(_0xb87a('0x4'));var config=require(_0xb87a('0x5'));var attributes=require('./action.attributes');module['exports']=function(_0x324d1e,_0x425bb0){return _0x324d1e['define'](_0xb87a('0x6'),attributes,{'tableName':_0xb87a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00ed=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./action.attributes','exports','define','tools_actions','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x00ed,0x136));var _0xd00e=function(_0x2f1092,_0x5b9214){_0x2f1092=_0x2f1092-0x0;var _0x3a003f=_0x00ed[_0x2f1092];return _0x3a003f;};'use strict';var _=require(_0xd00e('0x0'));var util=require(_0xd00e('0x1'));var logger=require(_0xd00e('0x2'))(_0xd00e('0x3'));var moment=require(_0xd00e('0x4'));var BPromise=require(_0xd00e('0x5'));var rp=require(_0xd00e('0x6'));var fs=require('fs');var path=require(_0xd00e('0x7'));var rimraf=require(_0xd00e('0x8'));var config=require('../../config/environment');var attributes=require(_0xd00e('0x9'));module[_0xd00e('0xa')]=function(_0x51739c,_0x55557e){return _0x51739c[_0xd00e('0xb')]('Action',attributes,{'tableName':_0xd00e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index db5e6e3..9bba742 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x16e874,_0x154da0){var _0x5460d4=function(_0x464262){while(--_0x464262){_0x16e874['push'](_0x16e874['shift']());}};_0x5460d4(++_0x154da0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5f5a21,_0x44f80c){var _0x8ae01a=function(_0x2c8e4a){while(--_0x2c8e4a){_0x5f5a21['push'](_0x5f5a21['shift']());}};_0x8ae01a(++_0x44f80c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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/action/index.js b/server/api/action/index.js index 87d782e..0d33fa7 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 _0xe6c8=['./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4293bd,_0x5eace5){var _0x20fba1=function(_0x34457e){while(--_0x34457e){_0x4293bd['push'](_0x4293bd['shift']());}};_0x20fba1(++_0x5eace5);}(_0xe6c8,0x19a));var _0x8e6c=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xe6c8[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0x8e6c('0x0'));var util=require('util');var path=require(_0x8e6c('0x1'));var timeout=require(_0x8e6c('0x2'));var express=require(_0x8e6c('0x3'));var router=express[_0x8e6c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8e6c('0x5'));var config=require('../../config/environment');var controller=require(_0x8e6c('0x6'));router[_0x8e6c('0x7')](_0x8e6c('0x8'),auth[_0x8e6c('0x9')](),controller[_0x8e6c('0xa')]);router['delete']('/:id',auth[_0x8e6c('0x9')](),controller[_0x8e6c('0xb')]);module[_0x8e6c('0xc')]=router; \ No newline at end of file +var _0xf48b=['put','isAuthenticated','/:id','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./action.controller'];(function(_0x4789bc,_0x955524){var _0x66fd14=function(_0x5a2dac){while(--_0x5a2dac){_0x4789bc['push'](_0x4789bc['shift']());}};_0x66fd14(++_0x955524);}(_0xf48b,0xa8));var _0xbf48=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf48b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xbf48('0x0'));var util=require(_0xbf48('0x1'));var path=require(_0xbf48('0x2'));var timeout=require(_0xbf48('0x3'));var express=require(_0xbf48('0x4'));var router=express['Router']();var auth=require(_0xbf48('0x5'));var interaction=require(_0xbf48('0x6'));var config=require('../../config/environment');var controller=require(_0xbf48('0x7'));router[_0xbf48('0x8')]('/:id',auth[_0xbf48('0x9')](),controller['update']);router['delete'](_0xbf48('0xa'),auth[_0xbf48('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b1dfd52..aa45cb4 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 _0x83a1=['TEXT','STRING'];(function(_0xd8ede3,_0x4d7a95){var _0xe9a6a4=function(_0x2d119a){while(--_0x2d119a){_0xd8ede3['push'](_0xd8ede3['shift']());}};_0xe9a6a4(++_0x4d7a95);}(_0x83a1,0xf5));var _0x183a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x83a1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x183a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x183a('0x0')]},'parent':{'type':Sequelize[_0x183a('0x0')]},'table':{'type':Sequelize[_0x183a('0x0')]},'conditions':{'type':Sequelize[_0x183a('0x1')]},'joins':{'type':Sequelize[_0x183a('0x1')]}}; \ No newline at end of file +var _0xecd9=['exports','STRING','TEXT','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xecd9,0x113));var _0x9ecd=function(_0x1294f9,_0x3a473d){_0x1294f9=_0x1294f9-0x0;var _0x1fc9b0=_0xecd9[_0x1294f9];return _0x1fc9b0;};'use strict';var Sequelize=require(_0x9ecd('0x0'));module[_0x9ecd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9ecd('0x2')]},'parent':{'type':Sequelize[_0x9ecd('0x2')]},'table':{'type':Sequelize[_0x9ecd('0x2')]},'conditions':{'type':Sequelize[_0x9ecd('0x3')]},'joins':{'type':Sequelize[_0x9ecd('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index dda5b37..6aca259 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 _0x25b0=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','CustomReports','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','AnalyticCustomReport','findAll','rows','catch','params','includeAll','include','find','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','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)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','joins','parse','includes','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','MAX(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','condition','value','Sequelize','from','alias','parentKey','foreignKey','Limited\x20Query:','fullPath','%s-%s.%s','randomstring','output','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','cross_join','IS\x20NOT\x20NULL','select','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2564e6,_0x3bb3e2){var _0x1fc422=function(_0x2108c8){while(--_0x2108c8){_0x2564e6['push'](_0x2564e6['shift']());}};_0x1fc422(++_0x3bb3e2);}(_0x25b0,0x140));var _0x025b=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0x25b0[_0x216428];return _0x313dd4;};'use strict';var pdf=require(_0x025b('0x0'));var emlformat=require(_0x025b('0x1'));var rimraf=require(_0x025b('0x2'));var zipdir=require(_0x025b('0x3'));var jsonpatch=require(_0x025b('0x4'));var rp=require(_0x025b('0x5'));var moment=require(_0x025b('0x6'));var BPromise=require(_0x025b('0x7'));var Mustache=require(_0x025b('0x8'));var util=require(_0x025b('0x9'));var path=require('path');var sox=require(_0x025b('0xa'));var csv=require(_0x025b('0xb'));var ejs=require(_0x025b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x025b('0xd'));var crypto=require(_0x025b('0xe'));var jsforce=require(_0x025b('0xf'));var deskjs=require(_0x025b('0x10'));var toCsv=require(_0x025b('0xb'));var querystring=require(_0x025b('0x11'));var Papa=require(_0x025b('0x12'));var Redis=require('ioredis');var authService=require(_0x025b('0x13'));var qs=require(_0x025b('0x14'));var as=require(_0x025b('0x15'));var hardwareService=require(_0x025b('0x16'));var logger=require(_0x025b('0x17'))(_0x025b('0x18'));var utils=require(_0x025b('0x19'));var config=require(_0x025b('0x1a'));var db=require(_0x025b('0x1b'))['db'];var dbH=require('../../mysqldb')[_0x025b('0x1c')];function respondWithStatusCode(_0x4ff41a,_0x288d63){_0x288d63=_0x288d63||0xcc;return function(_0xe1f393){if(_0xe1f393){return _0x4ff41a[_0x025b('0x1d')](_0x288d63);}return _0x4ff41a['status'](_0x288d63)[_0x025b('0x1e')]();};}function respondWithResult(_0x4347ec,_0x2c831d){_0x2c831d=_0x2c831d||0xc8;return function(_0xe5fe8b){if(_0xe5fe8b){return _0x4347ec[_0x025b('0x1f')](_0x2c831d)[_0x025b('0x20')](_0xe5fe8b);}};}function respondWithFilteredResult(_0x41b189,_0x50d54b){return function(_0x242be4){if(_0x242be4){var _0x360856=_0x242be4[_0x025b('0x21')],_0x34b8b1=_0x50d54b[_0x025b('0x22')],_0x1d1f22=_0x50d54b['offset']+_0x50d54b[_0x025b('0x23')],_0x21b2b6;if(_0x1d1f22>=_0x360856){_0x1d1f22=_0x360856;_0x21b2b6=0xc8;}else{_0x21b2b6=0xce;}_0x41b189[_0x025b('0x1f')](_0x21b2b6);return _0x41b189[_0x025b('0x24')](_0x025b('0x25'),_0x34b8b1+'-'+_0x1d1f22+'/'+_0x360856)[_0x025b('0x20')](_0x242be4);}return null;};}function patchUpdates(_0x102b89){return function(_0x384dba){try{jsonpatch[_0x025b('0x26')](_0x384dba,_0x102b89,!![]);}catch(_0x3613b0){return BPromise[_0x025b('0x27')](_0x3613b0);}return _0x384dba['save']();};}function saveUpdates(_0x463388,_0x3e84d4){return function(_0x7430fd){if(_0x7430fd){return _0x7430fd[_0x025b('0x28')](_0x463388)['then'](function(_0x4c712a){return _0x4c712a;});}return null;};}function removeEntity(_0x1a519d,_0x415655){return function(_0x1744a5){if(_0x1744a5){return _0x1744a5[_0x025b('0x29')]()['then'](function(){var _0x1c65fc=_0x1744a5[_0x025b('0x2a')]({'plain':!![]});var _0x34acb1=_0x025b('0x2b');return db[_0x025b('0x2c')][_0x025b('0x29')]({'where':{'type':_0x34acb1,'resourceId':_0x1c65fc['id']}})[_0x025b('0x2d')](function(){return _0x1744a5;});})[_0x025b('0x2d')](function(){_0x1a519d[_0x025b('0x1f')](0xcc)[_0x025b('0x1e')]();});}};}function handleEntityNotFound(_0xca561c,_0x2b97ba){return function(_0x14086f){if(!_0x14086f){_0xca561c[_0x025b('0x1d')](0x194);}return _0x14086f;};}function handleError(_0x54497c,_0x227e6b){_0x227e6b=_0x227e6b||0x1f4;return function(_0x3a4e03){logger[_0x025b('0x2e')](_0x3a4e03[_0x025b('0x2f')]);if(_0x3a4e03['name']){delete _0x3a4e03[_0x025b('0x30')];}_0x54497c[_0x025b('0x1f')](_0x227e6b)[_0x025b('0x31')](_0x3a4e03);};}exports[_0x025b('0x32')]=function(_0x296de2,_0x229e6d){var _0x2d074f={},_0x2f02bc={},_0x20d97e={'count':0x0,'rows':[]};var _0x562be1=_[_0x025b('0x33')](db['AnalyticCustomReport'][_0x025b('0x34')],function(_0xa3a5ab){return{'name':_0xa3a5ab[_0x025b('0x35')],'type':_0xa3a5ab[_0x025b('0x36')]['key']};});_0x2f02bc[_0x025b('0x37')]=_[_0x025b('0x33')](_0x562be1,_0x025b('0x30'));_0x2f02bc[_0x025b('0x38')]=_[_0x025b('0x39')](_0x296de2[_0x025b('0x38')]);_0x2f02bc[_0x025b('0x3a')]=_[_0x025b('0x3b')](_0x2f02bc['model'],_0x2f02bc[_0x025b('0x38')]);_0x2d074f[_0x025b('0x3c')]=_['intersection'](_0x2f02bc[_0x025b('0x37')],qs[_0x025b('0x3d')](_0x296de2[_0x025b('0x38')][_0x025b('0x3d')]));_0x2d074f[_0x025b('0x3c')]=_0x2d074f['attributes']['length']?_0x2d074f[_0x025b('0x3c')]:_0x2f02bc[_0x025b('0x37')];if(!_0x296de2[_0x025b('0x38')][_0x025b('0x3e')](_0x025b('0x3f'))){_0x2d074f[_0x025b('0x23')]=qs[_0x025b('0x23')](_0x296de2['query']['limit']);_0x2d074f['offset']=qs['offset'](_0x296de2['query'][_0x025b('0x22')]);}_0x2d074f[_0x025b('0x40')]=qs[_0x025b('0x41')](_0x296de2['query'][_0x025b('0x41')]);_0x2d074f['where']=qs['filters'](_[_0x025b('0x42')](_0x296de2[_0x025b('0x38')],_0x2f02bc['filters']),_0x562be1);if(_0x296de2[_0x025b('0x38')][_0x025b('0x43')]){_0x2d074f[_0x025b('0x44')]=_['merge'](_0x2d074f[_0x025b('0x44')],{'$or':_['map'](_0x562be1,function(_0x30c3d5){if(_0x30c3d5[_0x025b('0x36')]!==_0x025b('0x45')){var _0x3f7e40={};_0x3f7e40[_0x30c3d5['name']]={'$like':'%'+_0x296de2[_0x025b('0x38')]['filter']+'%'};return _0x3f7e40;}})});}_0x2d074f=_[_0x025b('0x46')]({},_0x2d074f,_0x296de2['options']);var _0x40ab9a={'where':_0x2d074f[_0x025b('0x44')]};return db[_0x025b('0x47')][_0x025b('0x21')](_0x40ab9a)[_0x025b('0x2d')](function(_0x51db25){_0x20d97e[_0x025b('0x21')]=_0x51db25;if(_0x296de2[_0x025b('0x38')]['includeAll']){_0x2d074f['include']=[{'all':!![]}];}return db[_0x025b('0x47')][_0x025b('0x48')](_0x2d074f);})[_0x025b('0x2d')](function(_0x39336e){_0x20d97e[_0x025b('0x49')]=_0x39336e;return _0x20d97e;})['then'](respondWithFilteredResult(_0x229e6d,_0x2d074f))[_0x025b('0x4a')](handleError(_0x229e6d,null));};exports['show']=function(_0x24b530,_0xf4087){var _0x3e82c5={'raw':![],'where':{'id':_0x24b530[_0x025b('0x4b')]['id']}},_0x1a952f={};_0x1a952f['model']=_[_0x025b('0x39')](db[_0x025b('0x47')][_0x025b('0x34')]);_0x1a952f[_0x025b('0x38')]=_[_0x025b('0x39')](_0x24b530[_0x025b('0x38')]);_0x1a952f[_0x025b('0x3a')]=_[_0x025b('0x3b')](_0x1a952f[_0x025b('0x37')],_0x1a952f[_0x025b('0x38')]);_0x3e82c5[_0x025b('0x3c')]=_[_0x025b('0x3b')](_0x1a952f[_0x025b('0x37')],qs[_0x025b('0x3d')](_0x24b530[_0x025b('0x38')]['fields']));_0x3e82c5['attributes']=_0x3e82c5['attributes']['length']?_0x3e82c5[_0x025b('0x3c')]:_0x1a952f[_0x025b('0x37')];if(_0x24b530[_0x025b('0x38')][_0x025b('0x4c')]){_0x3e82c5[_0x025b('0x4d')]=[{'all':!![]}];}_0x3e82c5=_[_0x025b('0x46')]({},_0x3e82c5,_0x24b530['options']);return db[_0x025b('0x47')][_0x025b('0x4e')](_0x3e82c5)['then'](handleEntityNotFound(_0xf4087,null))[_0x025b('0x2d')](respondWithResult(_0xf4087,null))[_0x025b('0x4a')](handleError(_0xf4087,null));};exports['create']=function(_0xd181c1,_0x10a081){return db[_0x025b('0x47')][_0x025b('0x4f')](_0xd181c1[_0x025b('0x50')],{})['then'](function(_0x3b10c4){var _0x1d4886=_0xd181c1[_0x025b('0x51')][_0x025b('0x2a')]({'plain':!![]});if(!_0x1d4886)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d4886[_0x025b('0x52')]===_0x025b('0x51')){var _0x30a205=_0x3b10c4[_0x025b('0x2a')]({'plain':!![]});var _0x31ffd4=_0x025b('0x53');return db['UserProfileSection'][_0x025b('0x4e')]({'where':{'name':_0x31ffd4,'userProfileId':_0x1d4886[_0x025b('0x54')]},'raw':!![]})[_0x025b('0x2d')](function(_0x4ce216){if(_0x4ce216&&_0x4ce216[_0x025b('0x55')]===0x0){return db[_0x025b('0x2c')][_0x025b('0x4f')]({'name':_0x30a205['name'],'resourceId':_0x30a205['id'],'type':'CustomReports','sectionId':_0x4ce216['id']},{})[_0x025b('0x2d')](function(){return _0x3b10c4;});}else{return _0x3b10c4;}})['catch'](function(_0x29c44b){logger[_0x025b('0x2e')](_0x025b('0x56'),_0x29c44b);throw _0x29c44b;});}return _0x3b10c4;})['then'](respondWithResult(_0x10a081,0xc9))[_0x025b('0x4a')](handleError(_0x10a081,null));};exports[_0x025b('0x28')]=function(_0x3edd90,_0x193932){if(_0x3edd90['body']['id']){delete _0x3edd90['body']['id'];}return db[_0x025b('0x47')][_0x025b('0x4e')]({'where':{'id':_0x3edd90[_0x025b('0x4b')]['id']}})[_0x025b('0x2d')](handleEntityNotFound(_0x193932,null))[_0x025b('0x2d')](saveUpdates(_0x3edd90[_0x025b('0x50')],null))[_0x025b('0x2d')](respondWithResult(_0x193932,null))['catch'](handleError(_0x193932,null));};exports[_0x025b('0x29')]=function(_0x2875e5,_0x4d39fb){return db[_0x025b('0x47')][_0x025b('0x4e')]({'where':{'id':_0x2875e5[_0x025b('0x4b')]['id']}})[_0x025b('0x2d')](handleEntityNotFound(_0x4d39fb,null))[_0x025b('0x2d')](removeEntity(_0x4d39fb,null))[_0x025b('0x4a')](handleError(_0x4d39fb,null));};exports[_0x025b('0x57')]=function(_0x4edc17,_0x47fddc){var _0x5a05b7=0xa;var _0x42a1ad=[_0x025b('0x58'),_0x025b('0x59'),_0x025b('0x5a'),'cross_join'];var _0x5a3b73={'SUM':_0x025b('0x5b'),'COUNT':_0x025b('0x5c'),'COUNT DISTINCT':_0x025b('0x5d'),'MAX':'MAX(%s)','MIN':_0x025b('0x5e'),'AVG':_0x025b('0x5f'),'GROUP_CONCAT':_0x025b('0x60'),'GROUP_CONCAT ASC':_0x025b('0x61'),'GROUP_CONCAT DESC':_0x025b('0x62')};var _0x3b688f={'SEC_TO_TIME':_0x025b('0x63'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x025b('0x64')};var _0x391246=function(_0x556fb9){return!_['includes']([_0x025b('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x025b('0x66')],_0x556fb9);};var _0x3390d1=function(_0xd7fac){if(!_0xd7fac||!_0xd7fac['rules']['length']){return'';}for(var _0x10af4a='(',_0x1cc3d5=0x0;_0x1cc3d5<_0xd7fac[_0x025b('0x67')][_0x025b('0x68')];_0x1cc3d5+=0x1){_0x1cc3d5>0x0&&(_0x10af4a+='\x20'+_0xd7fac[_0x025b('0x69')]+'\x20');_0x10af4a+=_0xd7fac[_0x025b('0x67')][_0x1cc3d5][_0x025b('0x6a')]?_0x3390d1(_0xd7fac[_0x025b('0x67')][_0x1cc3d5][_0x025b('0x6a')]):_0xd7fac[_0x025b('0x67')][_0x1cc3d5][_0x025b('0x6b')]+'\x20'+_0xd7fac[_0x025b('0x67')][_0x1cc3d5]['condition']+(_0x391246(_0xd7fac[_0x025b('0x67')][_0x1cc3d5]['condition'])?'\x20'+_0xd7fac['rules'][_0x1cc3d5]['value']:'');}return _0x10af4a+')';};var _0x2eb97e={'where':{'id':_0x4edc17[_0x025b('0x4b')]['id']}},_0x331297,_0x367567,_0x33fcc1,_0x14d99c,_0x2a8ef0;_0x2eb97e=_['merge']({},_0x2eb97e,_0x4edc17[_0x025b('0x6c')]);return db[_0x025b('0x47')][_0x025b('0x4e')](_0x2eb97e)['then'](function(_0x16ecd8){if(_0x16ecd8){_0x331297=_0x16ecd8;return _0x16ecd8[_0x025b('0x6d')]();}return null;})[_0x025b('0x2d')](function(_0x17b774){if(_0x17b774){if(!_0x17b774['length']){throw new db['Sequelize'][(_0x025b('0x6e'))](_0x025b('0x6f'),0x193);}_0x367567=_0x17b774;return db[_0x025b('0x70')]['findAll']({'raw':!![]});}return null;})[_0x025b('0x2d')](function(_0x88d8d){if(_0x88d8d){_0x33fcc1=_[_0x025b('0x71')](_0x88d8d,'id');var _0x504022;var _0x3943e8=squel['select']();_0x3943e8['from'](_0x331297[_0x025b('0x72')]);for(var _0x2c89af=0x0;_0x2c89af<_0x367567[_0x025b('0x68')];_0x2c89af+=0x1){_0x504022=_0x367567[_0x2c89af][_0x025b('0x73')]?_0x33fcc1[_0x367567[_0x2c89af][_0x025b('0x73')]][_0x025b('0x74')]:_0x367567[_0x2c89af][_0x025b('0x6b')];_0x504022=_0x367567[_0x2c89af]['function']?_[_0x025b('0x75')](_0x5a3b73[_0x367567[_0x2c89af][_0x025b('0x76')]],'%s',_0x504022):_0x504022;_0x504022=_0x367567[_0x2c89af][_0x025b('0x77')]?_[_0x025b('0x75')](_0x3b688f[_0x367567[_0x2c89af]['format']],'%s',_0x504022):_0x504022;if(_0x367567[_0x2c89af][_0x025b('0x78')]){_0x3943e8[_0x025b('0x6a')](_0x504022);}_0x367567[_0x2c89af][_0x025b('0x79')]&&_0x3943e8[_0x025b('0x40')](_0x504022,_0x367567[_0x2c89af]['orderBy']===_0x025b('0x7a')?![]:!![]);_0x3943e8[_0x025b('0x6b')](_0x504022,_0x367567[_0x2c89af]['alias']||_0x504022);}if(_0x331297['joins']){_0x331297[_0x025b('0x7b')]=JSON[_0x025b('0x7c')](_0x331297['joins']);for(var _0x1d8b69=0x0;_0x1d8b69<_0x331297['joins']['length'];_0x1d8b69+=0x1){if(_0x331297[_0x025b('0x7b')][_0x1d8b69][_0x025b('0x36')]&&_[_0x025b('0x7d')](_0x42a1ad,_0x331297[_0x025b('0x7b')][_0x1d8b69][_0x025b('0x36')])&&_0x331297[_0x025b('0x7b')][_0x1d8b69]['parentKey']&&_0x331297[_0x025b('0x7b')][_0x1d8b69][_0x025b('0x7e')]&&_0x331297[_0x025b('0x7b')][_0x1d8b69]['foreignKey']){_0x3943e8[_0x331297[_0x025b('0x7b')][_0x1d8b69][_0x025b('0x36')]](_0x331297[_0x025b('0x7b')][_0x1d8b69][_0x025b('0x7e')],null,util[_0x025b('0x77')](_0x025b('0x7f'),_0x331297[_0x025b('0x72')],_0x331297['joins'][_0x1d8b69]['parentKey'],_0x331297[_0x025b('0x7b')][_0x1d8b69][_0x025b('0x7e')],_0x331297['joins'][_0x1d8b69]['foreignKey']));}}}if(_0x331297[_0x025b('0x80')]){_0x331297[_0x025b('0x80')]=JSON[_0x025b('0x7c')](_0x331297[_0x025b('0x80')]);_0x3943e8[_0x025b('0x44')](_0x3390d1(_0x331297[_0x025b('0x80')]['group']));}_0x2a8ef0=_0x3943e8[_0x025b('0x81')]();_0x3943e8[_0x025b('0x23')](_0x5a05b7);_0x3943e8[_0x025b('0x22')](0x0);logger[_0x025b('0x82')]('Limited\x20Query:',_0x3943e8[_0x025b('0x83')]());return db[_0x025b('0x84')][_0x025b('0x38')](_0x3943e8[_0x025b('0x83')](),{'type':db[_0x025b('0x84')][_0x025b('0x85')][_0x025b('0x86')]});}})['then'](respondWithResult(_0x47fddc,null))['catch'](handleError(_0x47fddc,null));};function runReport(_0x13dccf,_0x21c0bf,_0x3320c3){var _0x1c5887=_0x21c0bf[_0x025b('0x30')];var _0x41e2ca=0xa;var _0x63bec5=[_0x025b('0x58'),_0x025b('0x59'),_0x025b('0x5a'),'cross_join'];var _0x48853f={'SUM':_0x025b('0x5b'),'COUNT':_0x025b('0x5c'),'COUNT DISTINCT':_0x025b('0x5d'),'MAX':_0x025b('0x87'),'MIN':_0x025b('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x025b('0x61'),'GROUP_CONCAT DESC':_0x025b('0x62')};var _0x56754a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x025b('0x88'),'HOUR':_0x025b('0x89'),'ROUND':_0x025b('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c3638=function(_0x55d7b8){return!_['includes']([_0x025b('0x65'),'IS\x20NOT\x20NULL',_0x025b('0x8b'),_0x025b('0x66')],_0x55d7b8);};var _0x2b61c5=function(_0x5db38a){if(!_0x5db38a||!_0x5db38a[_0x025b('0x67')]['length']){return'';}for(var _0x2bb977='(',_0xdf5c88=0x0;_0xdf5c88<_0x5db38a['rules']['length'];_0xdf5c88+=0x1){_0xdf5c88>0x0&&(_0x2bb977+='\x20'+_0x5db38a[_0x025b('0x69')]+'\x20');_0x2bb977+=_0x5db38a[_0x025b('0x67')][_0xdf5c88][_0x025b('0x6a')]?_0x2b61c5(_0x5db38a[_0x025b('0x67')][_0xdf5c88]['group']):_0x5db38a[_0x025b('0x67')][_0xdf5c88][_0x025b('0x6b')]+'\x20'+_0x5db38a[_0x025b('0x67')][_0xdf5c88][_0x025b('0x8c')]+(_0x5c3638(_0x5db38a['rules'][_0xdf5c88][_0x025b('0x8c')])?'\x20'+_0x5db38a['rules'][_0xdf5c88][_0x025b('0x8d')]:'');}return _0x2bb977+')';};var _0x3c7545={'where':{'id':_0x13dccf['id']}},_0x4a65fc,_0x2c0e16,_0x404b15,_0x57e97b,_0x27fcff;_0x3c7545=_[_0x025b('0x46')]({},_0x3c7545,_0x3320c3);return db[_0x025b('0x47')][_0x025b('0x4e')](_0x3c7545)[_0x025b('0x2d')](function(_0x2138b6){if(_0x2138b6){_0x4a65fc=_0x2138b6;return _0x2138b6['getFields']();}return null;})[_0x025b('0x2d')](function(_0x3e04fd){if(_0x3e04fd){if(!_0x3e04fd[_0x025b('0x68')]){throw new db[(_0x025b('0x8e'))][(_0x025b('0x6e'))](_0x025b('0x6f'),0x193);}_0x2c0e16=_0x3e04fd;return db['AnalyticMetric'][_0x025b('0x48')]({'raw':!![]});}return null;})[_0x025b('0x2d')](function(_0x4b61ce){if(_0x4b61ce){_0x404b15=_[_0x025b('0x71')](_0x4b61ce,'id');var _0x55e90b;var _0xf8dd5c=squel['select']();_0xf8dd5c[_0x025b('0x8f')](_0x4a65fc[_0x025b('0x72')]);for(var _0x43a2af=0x0;_0x43a2af<_0x2c0e16['length'];_0x43a2af+=0x1){_0x55e90b=_0x2c0e16[_0x43a2af]['MetricId']?_0x404b15[_0x2c0e16[_0x43a2af]['MetricId']]['metric']:_0x2c0e16[_0x43a2af]['field'];_0x55e90b=_0x2c0e16[_0x43a2af][_0x025b('0x76')]?_[_0x025b('0x75')](_0x48853f[_0x2c0e16[_0x43a2af][_0x025b('0x76')]],'%s',_0x55e90b):_0x55e90b;_0x55e90b=_0x2c0e16[_0x43a2af][_0x025b('0x77')]?_[_0x025b('0x75')](_0x56754a[_0x2c0e16[_0x43a2af][_0x025b('0x77')]],'%s',_0x55e90b):_0x55e90b;if(_0x2c0e16[_0x43a2af][_0x025b('0x78')]){_0xf8dd5c[_0x025b('0x6a')](_0x55e90b);}_0x2c0e16[_0x43a2af][_0x025b('0x79')]&&_0xf8dd5c['order'](_0x55e90b,_0x2c0e16[_0x43a2af][_0x025b('0x79')]===_0x025b('0x7a')?![]:!![]);_0xf8dd5c[_0x025b('0x6b')](_0x55e90b,_0x2c0e16[_0x43a2af][_0x025b('0x90')]||_0x55e90b);}if(_0x4a65fc['joins']){_0x4a65fc[_0x025b('0x7b')]=JSON['parse'](_0x4a65fc[_0x025b('0x7b')]);for(var _0x2a52fe=0x0;_0x2a52fe<_0x4a65fc[_0x025b('0x7b')]['length'];_0x2a52fe+=0x1){if(_0x4a65fc['joins'][_0x2a52fe]['type']&&_[_0x025b('0x7d')](_0x63bec5,_0x4a65fc['joins'][_0x2a52fe][_0x025b('0x36')])&&_0x4a65fc[_0x025b('0x7b')][_0x2a52fe][_0x025b('0x91')]&&_0x4a65fc[_0x025b('0x7b')][_0x2a52fe]['foreignTable']&&_0x4a65fc[_0x025b('0x7b')][_0x2a52fe]['foreignKey']){_0xf8dd5c[_0x4a65fc[_0x025b('0x7b')][_0x2a52fe][_0x025b('0x36')]](_0x4a65fc[_0x025b('0x7b')][_0x2a52fe]['foreignTable'],null,util[_0x025b('0x77')](_0x025b('0x7f'),_0x4a65fc[_0x025b('0x72')],_0x4a65fc[_0x025b('0x7b')][_0x2a52fe]['parentKey'],_0x4a65fc[_0x025b('0x7b')][_0x2a52fe][_0x025b('0x7e')],_0x4a65fc['joins'][_0x2a52fe][_0x025b('0x92')]));}}}if(_0x4a65fc[_0x025b('0x80')]){_0x4a65fc[_0x025b('0x80')]=JSON[_0x025b('0x7c')](_0x4a65fc[_0x025b('0x80')]);_0xf8dd5c[_0x025b('0x44')](_0x2b61c5(_0x4a65fc[_0x025b('0x80')]['group']));}_0x27fcff=_0xf8dd5c[_0x025b('0x81')]();_0xf8dd5c[_0x025b('0x23')](_0x41e2ca);_0xf8dd5c[_0x025b('0x22')](0x0);logger[_0x025b('0x82')](_0x025b('0x93'),_0xf8dd5c[_0x025b('0x83')]());return db[_0x025b('0x84')][_0x025b('0x38')](_0xf8dd5c[_0x025b('0x83')](),{'type':db['sequelize'][_0x025b('0x85')]['SELECT']});}})[_0x025b('0x2d')](function(_0x4cd817){if(!_0x4cd817[_0x025b('0x68')]){throw new db['Sequelize']['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x21c0bf['output']==='web'){return null;}var _0x2f3411=_[_0x025b('0x46')](_0x21c0bf,{'name':_0x21c0bf[_0x025b('0x94')]||_0x21c0bf[_0x025b('0x30')]||_0x4a65fc['name'],'basename':_0x1c5887,'savename':util[_0x025b('0x77')](_0x025b('0x95'),_0x21c0bf[_0x025b('0x30')]||_0x4a65fc[_0x025b('0x30')],require(_0x025b('0x96'))['generate'](0x4),_0x21c0bf[_0x025b('0x97')]||'csv'),'reportId':_0x4a65fc['id'],'reportType':'custom'});return db[_0x025b('0x98')][_0x025b('0x4f')](_0x2f3411,{'raw':!![]});})[_0x025b('0x2d')](function(_0x355ed9){if(_0x4a65fc[_0x025b('0x72')]===_0x025b('0x99')){_0x27fcff[_0x025b('0x44')](_0x4a65fc[_0x025b('0x72')]+_0x025b('0x9a'),_0x21c0bf[_0x025b('0x9b')],_0x21c0bf[_0x025b('0x9c')]);}else{_0x27fcff[_0x025b('0x44')](_0x4a65fc[_0x025b('0x72')]+_0x025b('0x9d'),_0x21c0bf[_0x025b('0x9b')],_0x21c0bf['endDate']);}if(_0x355ed9){logger[_0x025b('0x9e')](_0x025b('0x9f'),_0x27fcff[_0x025b('0x83')]());require(_0x025b('0xa0'))['fork'](path[_0x025b('0x58')](__dirname,_0x025b('0xa1'),_0x355ed9[_0x025b('0x97')]),[_0x355ed9['id'],_0x27fcff[_0x025b('0x83')](),path['join'](__dirname,_0x025b('0xa2'),_0x355ed9[_0x025b('0xa3')]),_0x1c5887]);return _0x355ed9;}else{var _0x360b40=squel['select']();_0x360b40[_0x025b('0x8f')]('('+_0x27fcff[_0x025b('0x83')]()+')',_0x025b('0xa4'));_0x360b40[_0x025b('0x6b')](_0x025b('0xa5'),'count');_0x27fcff[_0x025b('0x23')](_0x21c0bf[_0x025b('0x23')]||_0x41e2ca);_0x27fcff[_0x025b('0x22')](_0x21c0bf[_0x025b('0x22')]||0x0);return dbH['sequelize'][_0x025b('0x38')](_0x360b40[_0x025b('0x83')](),{'type':dbH[_0x025b('0x84')][_0x025b('0x85')][_0x025b('0x86')]})['then'](function(_0x3814a3){if(!_0x3814a3[_0x025b('0x68')]){_0x57e97b=0x0;}else{_0x57e97b=_0x3814a3[0x0][_0x025b('0x21')]||0x0;}return dbH[_0x025b('0x84')][_0x025b('0x38')](_0x27fcff[_0x025b('0x83')](),{'type':dbH[_0x025b('0x84')][_0x025b('0x85')]['SELECT']});})[_0x025b('0x2d')](function(_0x5f2251){return{'rows':_0x5f2251||[],'count':_0x57e97b};});}});}exports['run']=function(_0x533eb3,_0x513ee7){return runReport(_0x533eb3[_0x025b('0x4b')],_0x533eb3['query'],_0x533eb3['options'])['then'](respondWithResult(_0x513ee7,null))['catch'](handleError(_0x513ee7,null));};exports['runReport']=runReport;exports[_0x025b('0x38')]=function(_0x19a73b,_0x3a6b1f){var _0x3bd5e7=0xa;var _0x351e12=[_0x025b('0x58'),_0x025b('0x59'),_0x025b('0x5a'),_0x025b('0xa6')];var _0x6f50d8={'SUM':_0x025b('0x5b'),'COUNT':_0x025b('0x5c'),'COUNT DISTINCT':_0x025b('0x5d'),'MAX':_0x025b('0x87'),'MIN':_0x025b('0x5e'),'AVG':_0x025b('0x5f'),'GROUP_CONCAT':_0x025b('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x025b('0x62')};var _0xe1241f={'SEC_TO_TIME':_0x025b('0x63'),'DATE':_0x025b('0x88'),'HOUR':_0x025b('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x025b('0x64')};var _0x488c96=function(_0x40f72f){return!_[_0x025b('0x7d')]([_0x025b('0x65'),_0x025b('0xa7'),_0x025b('0x8b'),_0x025b('0x66')],_0x40f72f);};var _0x57331b=function(_0x2ada4f){if(!_0x2ada4f||!_0x2ada4f[_0x025b('0x67')][_0x025b('0x68')]){return'';}for(var _0x4a6a5d='(',_0x223fc1=0x0;_0x223fc1<_0x2ada4f['rules'][_0x025b('0x68')];_0x223fc1+=0x1){_0x223fc1>0x0&&(_0x4a6a5d+='\x20'+_0x2ada4f[_0x025b('0x69')]+'\x20');_0x4a6a5d+=_0x2ada4f[_0x025b('0x67')][_0x223fc1][_0x025b('0x6a')]?_0x57331b(_0x2ada4f[_0x025b('0x67')][_0x223fc1][_0x025b('0x6a')]):_0x2ada4f[_0x025b('0x67')][_0x223fc1][_0x025b('0x6b')]+'\x20'+_0x2ada4f[_0x025b('0x67')][_0x223fc1][_0x025b('0x8c')]+(_0x488c96(_0x2ada4f[_0x025b('0x67')][_0x223fc1][_0x025b('0x8c')])?'\x20'+_0x2ada4f[_0x025b('0x67')][_0x223fc1][_0x025b('0x8d')]:'');}return _0x4a6a5d+')';};var _0x238719={'where':{'id':_0x19a73b[_0x025b('0x4b')]['id']}},_0x10917b,_0x44bf38,_0x515741,_0x1418b3,_0x4e97f5;_0x238719=_[_0x025b('0x46')]({},_0x238719,_0x19a73b[_0x025b('0x6c')]);return db[_0x025b('0x47')]['find'](_0x238719)[_0x025b('0x2d')](function(_0x51237d){if(_0x51237d){_0x10917b=_0x51237d;return _0x51237d['getFields']();}return null;})[_0x025b('0x2d')](function(_0x5baec4){if(_0x5baec4){if(!_0x5baec4[_0x025b('0x68')]){throw new db['Sequelize'][(_0x025b('0x6e'))](_0x025b('0x6f'),0x193);}_0x44bf38=_0x5baec4;return db[_0x025b('0x70')][_0x025b('0x48')]({'raw':!![]});}return null;})[_0x025b('0x2d')](function(_0x4e5c43){if(_0x4e5c43){_0x515741=_[_0x025b('0x71')](_0x4e5c43,'id');var _0x58e091;var _0x47fa31=squel[_0x025b('0xa8')]();_0x47fa31[_0x025b('0x8f')](_0x10917b['table']);for(var _0x2a3a8a=0x0;_0x2a3a8a<_0x44bf38[_0x025b('0x68')];_0x2a3a8a+=0x1){_0x58e091=_0x44bf38[_0x2a3a8a][_0x025b('0x73')]?_0x515741[_0x44bf38[_0x2a3a8a][_0x025b('0x73')]]['metric']:_0x44bf38[_0x2a3a8a][_0x025b('0x6b')];_0x58e091=_0x44bf38[_0x2a3a8a][_0x025b('0x76')]?_[_0x025b('0x75')](_0x6f50d8[_0x44bf38[_0x2a3a8a][_0x025b('0x76')]],'%s',_0x58e091):_0x58e091;_0x58e091=_0x44bf38[_0x2a3a8a]['format']?_[_0x025b('0x75')](_0xe1241f[_0x44bf38[_0x2a3a8a][_0x025b('0x77')]],'%s',_0x58e091):_0x58e091;if(_0x44bf38[_0x2a3a8a][_0x025b('0x78')]){_0x47fa31[_0x025b('0x6a')](_0x58e091);}_0x44bf38[_0x2a3a8a][_0x025b('0x79')]&&_0x47fa31[_0x025b('0x40')](_0x58e091,_0x44bf38[_0x2a3a8a][_0x025b('0x79')]===_0x025b('0x7a')?![]:!![]);_0x47fa31[_0x025b('0x6b')](_0x58e091,_0x44bf38[_0x2a3a8a][_0x025b('0x90')]||_0x58e091);}if(_0x10917b[_0x025b('0x7b')]){_0x10917b[_0x025b('0x7b')]=JSON[_0x025b('0x7c')](_0x10917b[_0x025b('0x7b')]);for(var _0x5d6726=0x0;_0x5d6726<_0x10917b[_0x025b('0x7b')]['length'];_0x5d6726+=0x1){if(_0x10917b[_0x025b('0x7b')][_0x5d6726]['type']&&_[_0x025b('0x7d')](_0x351e12,_0x10917b[_0x025b('0x7b')][_0x5d6726][_0x025b('0x36')])&&_0x10917b['joins'][_0x5d6726]['parentKey']&&_0x10917b[_0x025b('0x7b')][_0x5d6726]['foreignTable']&&_0x10917b[_0x025b('0x7b')][_0x5d6726][_0x025b('0x92')]){_0x47fa31[_0x10917b['joins'][_0x5d6726][_0x025b('0x36')]](_0x10917b[_0x025b('0x7b')][_0x5d6726]['foreignTable'],null,util[_0x025b('0x77')](_0x025b('0x7f'),_0x10917b[_0x025b('0x72')],_0x10917b['joins'][_0x5d6726][_0x025b('0x91')],_0x10917b[_0x025b('0x7b')][_0x5d6726][_0x025b('0x7e')],_0x10917b[_0x025b('0x7b')][_0x5d6726][_0x025b('0x92')]));}}}if(_0x10917b[_0x025b('0x80')]){_0x10917b['conditions']=JSON[_0x025b('0x7c')](_0x10917b[_0x025b('0x80')]);_0x47fa31[_0x025b('0x44')](_0x57331b(_0x10917b[_0x025b('0x80')]['group']));}_0x4e97f5=_0x47fa31['clone']();_0x47fa31['limit'](_0x3bd5e7);_0x47fa31[_0x025b('0x22')](0x0);logger[_0x025b('0x82')]('Limited\x20Query:',_0x47fa31[_0x025b('0x83')]());return db[_0x025b('0x84')]['query'](_0x47fa31[_0x025b('0x83')](),{'type':db['sequelize'][_0x025b('0x85')][_0x025b('0x86')]});}})['then'](function(){return{'sql':_0x4e97f5['toString']()};})[_0x025b('0x2d')](respondWithResult(_0x3a6b1f,null))['catch'](handleError(_0x3a6b1f,null));}; \ No newline at end of file +var _0x6a00=['debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','DATE(%s)','IS\x20EMPTY','ValidationErrorItem','DESC','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','limit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','AnalyticCustomReport','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','UserProfileResource','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parentKey','foreignKey','table','foreignTable','conditions','clone'];(function(_0x1e958e,_0x5c1ee7){var _0x114096=function(_0x3902b3){while(--_0x3902b3){_0x1e958e['push'](_0x1e958e['shift']());}};_0x114096(++_0x5c1ee7);}(_0x6a00,0xc9));var _0x06a0=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x6a00[_0x2763f2];return _0x3ef471;};'use strict';var pdf=require(_0x06a0('0x0'));var emlformat=require(_0x06a0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x06a0('0x2'));var jsonpatch=require(_0x06a0('0x3'));var rp=require(_0x06a0('0x4'));var moment=require(_0x06a0('0x5'));var BPromise=require(_0x06a0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x06a0('0x7'));var sox=require(_0x06a0('0x8'));var csv=require(_0x06a0('0x9'));var ejs=require(_0x06a0('0xa'));var fs=require('fs');var _=require(_0x06a0('0xb'));var squel=require(_0x06a0('0xc'));var crypto=require('crypto');var jsforce=require(_0x06a0('0xd'));var deskjs=require(_0x06a0('0xe'));var toCsv=require(_0x06a0('0x9'));var querystring=require(_0x06a0('0xf'));var Papa=require(_0x06a0('0x10'));var Redis=require(_0x06a0('0x11'));var authService=require(_0x06a0('0x12'));var qs=require(_0x06a0('0x13'));var as=require(_0x06a0('0x14'));var hardwareService=require(_0x06a0('0x15'));var logger=require(_0x06a0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x06a0('0x17'));var db=require(_0x06a0('0x18'))['db'];var dbH=require(_0x06a0('0x18'))[_0x06a0('0x19')];function respondWithStatusCode(_0x688bf0,_0x177234){_0x177234=_0x177234||0xcc;return function(_0x2f9712){if(_0x2f9712){return _0x688bf0[_0x06a0('0x1a')](_0x177234);}return _0x688bf0['status'](_0x177234)[_0x06a0('0x1b')]();};}function respondWithResult(_0x2d3f61,_0x26bba1){_0x26bba1=_0x26bba1||0xc8;return function(_0x591b06){if(_0x591b06){return _0x2d3f61[_0x06a0('0x1c')](_0x26bba1)[_0x06a0('0x1d')](_0x591b06);}};}function respondWithFilteredResult(_0x363210,_0x5560e3){return function(_0x4083e7){if(_0x4083e7){var _0x38fec6=_0x4083e7[_0x06a0('0x1e')],_0x58edad=_0x5560e3[_0x06a0('0x1f')],_0x578f39=_0x5560e3[_0x06a0('0x1f')]+_0x5560e3['limit'],_0x3a20d7;if(_0x578f39>=_0x38fec6){_0x578f39=_0x38fec6;_0x3a20d7=0xc8;}else{_0x3a20d7=0xce;}_0x363210[_0x06a0('0x1c')](_0x3a20d7);return _0x363210[_0x06a0('0x20')](_0x06a0('0x21'),_0x58edad+'-'+_0x578f39+'/'+_0x38fec6)[_0x06a0('0x1d')](_0x4083e7);}return null;};}function patchUpdates(_0x3bce23){return function(_0x22cc77){try{jsonpatch[_0x06a0('0x22')](_0x22cc77,_0x3bce23,!![]);}catch(_0x2d774d){return BPromise[_0x06a0('0x23')](_0x2d774d);}return _0x22cc77[_0x06a0('0x24')]();};}function saveUpdates(_0x52fc73,_0x1fe1e6){return function(_0x2b18b3){if(_0x2b18b3){return _0x2b18b3[_0x06a0('0x25')](_0x52fc73)[_0x06a0('0x26')](function(_0x422603){return _0x422603;});}return null;};}function removeEntity(_0x304f8d,_0x5b57d6){return function(_0x549cb5){if(_0x549cb5){return _0x549cb5[_0x06a0('0x27')]()[_0x06a0('0x26')](function(){var _0x4fc9a7=_0x549cb5[_0x06a0('0x28')]({'plain':!![]});var _0x1ae968=_0x06a0('0x29');return db['UserProfileResource'][_0x06a0('0x27')]({'where':{'type':_0x1ae968,'resourceId':_0x4fc9a7['id']}})[_0x06a0('0x26')](function(){return _0x549cb5;});})['then'](function(){_0x304f8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22798f,_0x46efc2){return function(_0x1ee00a){if(!_0x1ee00a){_0x22798f[_0x06a0('0x1a')](0x194);}return _0x1ee00a;};}function handleError(_0x1b41cb,_0x4676f2){_0x4676f2=_0x4676f2||0x1f4;return function(_0xcc78b9){logger[_0x06a0('0x2a')](_0xcc78b9[_0x06a0('0x2b')]);if(_0xcc78b9['name']){delete _0xcc78b9[_0x06a0('0x2c')];}_0x1b41cb['status'](_0x4676f2)[_0x06a0('0x2d')](_0xcc78b9);};}exports[_0x06a0('0x2e')]=function(_0x18b359,_0x315815){var _0xc0a5f0={},_0x773a08={},_0x305ee4={'count':0x0,'rows':[]};var _0x3984eb=_[_0x06a0('0x2f')](db['AnalyticCustomReport'][_0x06a0('0x30')],function(_0x4177df){return{'name':_0x4177df[_0x06a0('0x31')],'type':_0x4177df[_0x06a0('0x32')][_0x06a0('0x33')]};});_0x773a08['model']=_[_0x06a0('0x2f')](_0x3984eb,'name');_0x773a08[_0x06a0('0x34')]=_[_0x06a0('0x35')](_0x18b359['query']);_0x773a08['filters']=_[_0x06a0('0x36')](_0x773a08[_0x06a0('0x37')],_0x773a08[_0x06a0('0x34')]);_0xc0a5f0[_0x06a0('0x38')]=_['intersection'](_0x773a08[_0x06a0('0x37')],qs['fields'](_0x18b359[_0x06a0('0x34')][_0x06a0('0x39')]));_0xc0a5f0['attributes']=_0xc0a5f0[_0x06a0('0x38')][_0x06a0('0x3a')]?_0xc0a5f0['attributes']:_0x773a08[_0x06a0('0x37')];if(!_0x18b359[_0x06a0('0x34')]['hasOwnProperty']('nolimit')){_0xc0a5f0[_0x06a0('0x3b')]=qs[_0x06a0('0x3b')](_0x18b359['query'][_0x06a0('0x3b')]);_0xc0a5f0[_0x06a0('0x1f')]=qs['offset'](_0x18b359[_0x06a0('0x34')][_0x06a0('0x1f')]);}_0xc0a5f0[_0x06a0('0x3c')]=qs[_0x06a0('0x3d')](_0x18b359[_0x06a0('0x34')]['sort']);_0xc0a5f0[_0x06a0('0x3e')]=qs[_0x06a0('0x3f')](_['pick'](_0x18b359[_0x06a0('0x34')],_0x773a08['filters']),_0x3984eb);if(_0x18b359[_0x06a0('0x34')][_0x06a0('0x40')]){_0xc0a5f0[_0x06a0('0x3e')]=_[_0x06a0('0x41')](_0xc0a5f0[_0x06a0('0x3e')],{'$or':_['map'](_0x3984eb,function(_0x51d7e7){if(_0x51d7e7[_0x06a0('0x32')]!==_0x06a0('0x42')){var _0x16ad7f={};_0x16ad7f[_0x51d7e7[_0x06a0('0x2c')]]={'$like':'%'+_0x18b359[_0x06a0('0x34')][_0x06a0('0x40')]+'%'};return _0x16ad7f;}})});}_0xc0a5f0=_[_0x06a0('0x41')]({},_0xc0a5f0,_0x18b359['options']);var _0x599986={'where':_0xc0a5f0[_0x06a0('0x3e')]};return db['AnalyticCustomReport']['count'](_0x599986)['then'](function(_0x159fc1){_0x305ee4['count']=_0x159fc1;if(_0x18b359[_0x06a0('0x34')][_0x06a0('0x43')]){_0xc0a5f0[_0x06a0('0x44')]=[{'all':!![]}];}return db[_0x06a0('0x45')][_0x06a0('0x46')](_0xc0a5f0);})[_0x06a0('0x26')](function(_0x5ce0dd){_0x305ee4['rows']=_0x5ce0dd;return _0x305ee4;})[_0x06a0('0x26')](respondWithFilteredResult(_0x315815,_0xc0a5f0))[_0x06a0('0x47')](handleError(_0x315815,null));};exports[_0x06a0('0x48')]=function(_0x4d0343,_0x52390e){var _0x563c93={'raw':![],'where':{'id':_0x4d0343[_0x06a0('0x49')]['id']}},_0x4e709b={};_0x4e709b[_0x06a0('0x37')]=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0x4e709b[_0x06a0('0x34')]=_['keys'](_0x4d0343[_0x06a0('0x34')]);_0x4e709b['filters']=_[_0x06a0('0x36')](_0x4e709b[_0x06a0('0x37')],_0x4e709b['query']);_0x563c93[_0x06a0('0x38')]=_['intersection'](_0x4e709b[_0x06a0('0x37')],qs[_0x06a0('0x39')](_0x4d0343[_0x06a0('0x34')][_0x06a0('0x39')]));_0x563c93[_0x06a0('0x38')]=_0x563c93[_0x06a0('0x38')]['length']?_0x563c93[_0x06a0('0x38')]:_0x4e709b[_0x06a0('0x37')];if(_0x4d0343['query'][_0x06a0('0x43')]){_0x563c93[_0x06a0('0x44')]=[{'all':!![]}];}_0x563c93=_[_0x06a0('0x41')]({},_0x563c93,_0x4d0343['options']);return db['AnalyticCustomReport'][_0x06a0('0x4a')](_0x563c93)[_0x06a0('0x26')](handleEntityNotFound(_0x52390e,null))[_0x06a0('0x26')](respondWithResult(_0x52390e,null))[_0x06a0('0x47')](handleError(_0x52390e,null));};exports[_0x06a0('0x4b')]=function(_0x2cafbd,_0x59ee0c){return db[_0x06a0('0x45')][_0x06a0('0x4b')](_0x2cafbd[_0x06a0('0x4c')],{})[_0x06a0('0x26')](function(_0x1ad115){var _0x206ce8=_0x2cafbd[_0x06a0('0x4d')][_0x06a0('0x28')]({'plain':!![]});if(!_0x206ce8)throw new Error(_0x06a0('0x4e'));if(_0x206ce8['role']===_0x06a0('0x4d')){var _0x16fca0=_0x1ad115[_0x06a0('0x28')]({'plain':!![]});var _0x32a677=_0x06a0('0x4f');return db[_0x06a0('0x50')]['find']({'where':{'name':_0x32a677,'userProfileId':_0x206ce8['userProfileId']},'raw':!![]})[_0x06a0('0x26')](function(_0x2ef07e){if(_0x2ef07e&&_0x2ef07e[_0x06a0('0x51')]===0x0){return db[_0x06a0('0x52')][_0x06a0('0x4b')]({'name':_0x16fca0['name'],'resourceId':_0x16fca0['id'],'type':_0x06a0('0x29'),'sectionId':_0x2ef07e['id']},{})['then'](function(){return _0x1ad115;});}else{return _0x1ad115;}})[_0x06a0('0x47')](function(_0x702f4){logger[_0x06a0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x702f4);throw _0x702f4;});}return _0x1ad115;})[_0x06a0('0x26')](respondWithResult(_0x59ee0c,0xc9))[_0x06a0('0x47')](handleError(_0x59ee0c,null));};exports[_0x06a0('0x25')]=function(_0x100eaa,_0x11bc5b){if(_0x100eaa[_0x06a0('0x4c')]['id']){delete _0x100eaa['body']['id'];}return db[_0x06a0('0x45')]['find']({'where':{'id':_0x100eaa['params']['id']}})[_0x06a0('0x26')](handleEntityNotFound(_0x11bc5b,null))[_0x06a0('0x26')](saveUpdates(_0x100eaa['body'],null))[_0x06a0('0x26')](respondWithResult(_0x11bc5b,null))['catch'](handleError(_0x11bc5b,null));};exports[_0x06a0('0x27')]=function(_0x2342d8,_0x3ae8a9){return db[_0x06a0('0x45')][_0x06a0('0x4a')]({'where':{'id':_0x2342d8[_0x06a0('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ae8a9,null))[_0x06a0('0x26')](removeEntity(_0x3ae8a9,null))['catch'](handleError(_0x3ae8a9,null));};exports[_0x06a0('0x53')]=function(_0x517094,_0x2ec948){var _0x20237e=0xa;var _0xb668f8=['join',_0x06a0('0x54'),_0x06a0('0x55'),_0x06a0('0x56')];var _0xdfe608={'SUM':_0x06a0('0x57'),'COUNT':_0x06a0('0x58'),'COUNT DISTINCT':_0x06a0('0x59'),'MAX':_0x06a0('0x5a'),'MIN':_0x06a0('0x5b'),'AVG':_0x06a0('0x5c'),'GROUP_CONCAT':_0x06a0('0x5d'),'GROUP_CONCAT ASC':_0x06a0('0x5e'),'GROUP_CONCAT DESC':_0x06a0('0x5f')};var _0x231e89={'SEC_TO_TIME':_0x06a0('0x60'),'DATE':'DATE(%s)','HOUR':_0x06a0('0x61'),'ROUND':_0x06a0('0x62'),'UNIX_TIMESTAMP':_0x06a0('0x63')};var _0x1279cd=function(_0x4d18f5){return!_[_0x06a0('0x64')]([_0x06a0('0x65'),_0x06a0('0x66'),'IS\x20EMPTY',_0x06a0('0x67')],_0x4d18f5);};var _0xaae257=function(_0x4cf4f0){if(!_0x4cf4f0||!_0x4cf4f0[_0x06a0('0x68')]['length']){return'';}for(var _0x506279='(',_0x51ec94=0x0;_0x51ec94<_0x4cf4f0['rules'][_0x06a0('0x3a')];_0x51ec94+=0x1){_0x51ec94>0x0&&(_0x506279+='\x20'+_0x4cf4f0[_0x06a0('0x69')]+'\x20');_0x506279+=_0x4cf4f0[_0x06a0('0x68')][_0x51ec94][_0x06a0('0x6a')]?_0xaae257(_0x4cf4f0['rules'][_0x51ec94]['group']):_0x4cf4f0[_0x06a0('0x68')][_0x51ec94][_0x06a0('0x6b')]+'\x20'+_0x4cf4f0[_0x06a0('0x68')][_0x51ec94][_0x06a0('0x6c')]+(_0x1279cd(_0x4cf4f0[_0x06a0('0x68')][_0x51ec94][_0x06a0('0x6c')])?'\x20'+_0x4cf4f0[_0x06a0('0x68')][_0x51ec94][_0x06a0('0x6d')]:'');}return _0x506279+')';};var _0x269997={'where':{'id':_0x517094[_0x06a0('0x49')]['id']}},_0x1fe24e,_0x4ea6d7,_0x509cdc,_0x490c91,_0x5711c3;_0x269997=_[_0x06a0('0x41')]({},_0x269997,_0x517094[_0x06a0('0x6e')]);return db['AnalyticCustomReport']['find'](_0x269997)['then'](function(_0x143545){if(_0x143545){_0x1fe24e=_0x143545;return _0x143545[_0x06a0('0x6f')]();}return null;})[_0x06a0('0x26')](function(_0x5917e7){if(_0x5917e7){if(!_0x5917e7['length']){throw new db[(_0x06a0('0x70'))]['ValidationErrorItem'](_0x06a0('0x71'),0x193);}_0x4ea6d7=_0x5917e7;return db[_0x06a0('0x72')][_0x06a0('0x46')]({'raw':!![]});}return null;})['then'](function(_0xffadfe){if(_0xffadfe){_0x509cdc=_[_0x06a0('0x73')](_0xffadfe,'id');var _0x954e6c;var _0x1c5430=squel[_0x06a0('0x74')]();_0x1c5430[_0x06a0('0x75')](_0x1fe24e['table']);for(var _0x2ca996=0x0;_0x2ca996<_0x4ea6d7['length'];_0x2ca996+=0x1){_0x954e6c=_0x4ea6d7[_0x2ca996]['MetricId']?_0x509cdc[_0x4ea6d7[_0x2ca996][_0x06a0('0x76')]][_0x06a0('0x77')]:_0x4ea6d7[_0x2ca996][_0x06a0('0x6b')];_0x954e6c=_0x4ea6d7[_0x2ca996][_0x06a0('0x78')]?_[_0x06a0('0x79')](_0xdfe608[_0x4ea6d7[_0x2ca996][_0x06a0('0x78')]],'%s',_0x954e6c):_0x954e6c;_0x954e6c=_0x4ea6d7[_0x2ca996][_0x06a0('0x7a')]?_['replace'](_0x231e89[_0x4ea6d7[_0x2ca996][_0x06a0('0x7a')]],'%s',_0x954e6c):_0x954e6c;if(_0x4ea6d7[_0x2ca996][_0x06a0('0x7b')]){_0x1c5430[_0x06a0('0x6a')](_0x954e6c);}_0x4ea6d7[_0x2ca996][_0x06a0('0x7c')]&&_0x1c5430[_0x06a0('0x3c')](_0x954e6c,_0x4ea6d7[_0x2ca996][_0x06a0('0x7c')]==='DESC'?![]:!![]);_0x1c5430[_0x06a0('0x6b')](_0x954e6c,_0x4ea6d7[_0x2ca996][_0x06a0('0x7d')]||_0x954e6c);}if(_0x1fe24e['joins']){_0x1fe24e[_0x06a0('0x7e')]=JSON['parse'](_0x1fe24e['joins']);for(var _0x1a65ec=0x0;_0x1a65ec<_0x1fe24e['joins']['length'];_0x1a65ec+=0x1){if(_0x1fe24e[_0x06a0('0x7e')][_0x1a65ec]['type']&&_['includes'](_0xb668f8,_0x1fe24e['joins'][_0x1a65ec][_0x06a0('0x32')])&&_0x1fe24e[_0x06a0('0x7e')][_0x1a65ec][_0x06a0('0x7f')]&&_0x1fe24e['joins'][_0x1a65ec]['foreignTable']&&_0x1fe24e[_0x06a0('0x7e')][_0x1a65ec][_0x06a0('0x80')]){_0x1c5430[_0x1fe24e[_0x06a0('0x7e')][_0x1a65ec][_0x06a0('0x32')]](_0x1fe24e[_0x06a0('0x7e')][_0x1a65ec]['foreignTable'],null,util[_0x06a0('0x7a')]('%s.%s\x20=\x20%s.%s',_0x1fe24e[_0x06a0('0x81')],_0x1fe24e['joins'][_0x1a65ec][_0x06a0('0x7f')],_0x1fe24e['joins'][_0x1a65ec][_0x06a0('0x82')],_0x1fe24e[_0x06a0('0x7e')][_0x1a65ec][_0x06a0('0x80')]));}}}if(_0x1fe24e[_0x06a0('0x83')]){_0x1fe24e['conditions']=JSON['parse'](_0x1fe24e[_0x06a0('0x83')]);_0x1c5430[_0x06a0('0x3e')](_0xaae257(_0x1fe24e[_0x06a0('0x83')]['group']));}_0x5711c3=_0x1c5430[_0x06a0('0x84')]();_0x1c5430[_0x06a0('0x3b')](_0x20237e);_0x1c5430[_0x06a0('0x1f')](0x0);logger[_0x06a0('0x85')](_0x06a0('0x86'),_0x1c5430['toString']());return db[_0x06a0('0x87')][_0x06a0('0x34')](_0x1c5430[_0x06a0('0x88')](),{'type':db[_0x06a0('0x87')][_0x06a0('0x89')][_0x06a0('0x8a')]});}})[_0x06a0('0x26')](respondWithResult(_0x2ec948,null))['catch'](handleError(_0x2ec948,null));};function runReport(_0x1e022d,_0x43a8df,_0x20a7c8){var _0x3e4efd=_0x43a8df['name'];var _0x43fca8=0xa;var _0x43acbe=[_0x06a0('0x8b'),_0x06a0('0x54'),_0x06a0('0x55'),_0x06a0('0x56')];var _0x1bc795={'SUM':_0x06a0('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x06a0('0x59'),'MAX':_0x06a0('0x5a'),'MIN':'MIN(%s)','AVG':_0x06a0('0x5c'),'GROUP_CONCAT':_0x06a0('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x442e39={'SEC_TO_TIME':_0x06a0('0x60'),'DATE':_0x06a0('0x8c'),'HOUR':_0x06a0('0x61'),'ROUND':_0x06a0('0x62'),'UNIX_TIMESTAMP':_0x06a0('0x63')};var _0x3767be=function(_0x54c8d7){return!_[_0x06a0('0x64')]([_0x06a0('0x65'),_0x06a0('0x66'),_0x06a0('0x8d'),_0x06a0('0x67')],_0x54c8d7);};var _0x33211d=function(_0x45cab4){if(!_0x45cab4||!_0x45cab4['rules'][_0x06a0('0x3a')]){return'';}for(var _0x32e159='(',_0x39506b=0x0;_0x39506b<_0x45cab4[_0x06a0('0x68')][_0x06a0('0x3a')];_0x39506b+=0x1){_0x39506b>0x0&&(_0x32e159+='\x20'+_0x45cab4['operator']+'\x20');_0x32e159+=_0x45cab4[_0x06a0('0x68')][_0x39506b]['group']?_0x33211d(_0x45cab4[_0x06a0('0x68')][_0x39506b][_0x06a0('0x6a')]):_0x45cab4[_0x06a0('0x68')][_0x39506b]['field']+'\x20'+_0x45cab4[_0x06a0('0x68')][_0x39506b][_0x06a0('0x6c')]+(_0x3767be(_0x45cab4['rules'][_0x39506b][_0x06a0('0x6c')])?'\x20'+_0x45cab4[_0x06a0('0x68')][_0x39506b][_0x06a0('0x6d')]:'');}return _0x32e159+')';};var _0xf96bec={'where':{'id':_0x1e022d['id']}},_0x3272ed,_0x176391,_0x45ce7d,_0x4d9de4,_0x3f046c;_0xf96bec=_[_0x06a0('0x41')]({},_0xf96bec,_0x20a7c8);return db['AnalyticCustomReport']['find'](_0xf96bec)[_0x06a0('0x26')](function(_0x3cb8b6){if(_0x3cb8b6){_0x3272ed=_0x3cb8b6;return _0x3cb8b6[_0x06a0('0x6f')]();}return null;})[_0x06a0('0x26')](function(_0x4494bc){if(_0x4494bc){if(!_0x4494bc[_0x06a0('0x3a')]){throw new db['Sequelize'][(_0x06a0('0x8e'))](_0x06a0('0x71'),0x193);}_0x176391=_0x4494bc;return db[_0x06a0('0x72')][_0x06a0('0x46')]({'raw':!![]});}return null;})[_0x06a0('0x26')](function(_0x650959){if(_0x650959){_0x45ce7d=_['keyBy'](_0x650959,'id');var _0x17aaa8;var _0xcf2a43=squel[_0x06a0('0x74')]();_0xcf2a43[_0x06a0('0x75')](_0x3272ed[_0x06a0('0x81')]);for(var _0x411604=0x0;_0x411604<_0x176391[_0x06a0('0x3a')];_0x411604+=0x1){_0x17aaa8=_0x176391[_0x411604][_0x06a0('0x76')]?_0x45ce7d[_0x176391[_0x411604][_0x06a0('0x76')]]['metric']:_0x176391[_0x411604][_0x06a0('0x6b')];_0x17aaa8=_0x176391[_0x411604][_0x06a0('0x78')]?_[_0x06a0('0x79')](_0x1bc795[_0x176391[_0x411604][_0x06a0('0x78')]],'%s',_0x17aaa8):_0x17aaa8;_0x17aaa8=_0x176391[_0x411604][_0x06a0('0x7a')]?_[_0x06a0('0x79')](_0x442e39[_0x176391[_0x411604][_0x06a0('0x7a')]],'%s',_0x17aaa8):_0x17aaa8;if(_0x176391[_0x411604][_0x06a0('0x7b')]){_0xcf2a43[_0x06a0('0x6a')](_0x17aaa8);}_0x176391[_0x411604][_0x06a0('0x7c')]&&_0xcf2a43[_0x06a0('0x3c')](_0x17aaa8,_0x176391[_0x411604][_0x06a0('0x7c')]===_0x06a0('0x8f')?![]:!![]);_0xcf2a43[_0x06a0('0x6b')](_0x17aaa8,_0x176391[_0x411604][_0x06a0('0x7d')]||_0x17aaa8);}if(_0x3272ed['joins']){_0x3272ed[_0x06a0('0x7e')]=JSON[_0x06a0('0x90')](_0x3272ed['joins']);for(var _0x19c445=0x0;_0x19c445<_0x3272ed[_0x06a0('0x7e')][_0x06a0('0x3a')];_0x19c445+=0x1){if(_0x3272ed[_0x06a0('0x7e')][_0x19c445]['type']&&_[_0x06a0('0x64')](_0x43acbe,_0x3272ed[_0x06a0('0x7e')][_0x19c445][_0x06a0('0x32')])&&_0x3272ed['joins'][_0x19c445][_0x06a0('0x7f')]&&_0x3272ed['joins'][_0x19c445][_0x06a0('0x82')]&&_0x3272ed['joins'][_0x19c445]['foreignKey']){_0xcf2a43[_0x3272ed[_0x06a0('0x7e')][_0x19c445][_0x06a0('0x32')]](_0x3272ed['joins'][_0x19c445][_0x06a0('0x82')],null,util[_0x06a0('0x7a')](_0x06a0('0x91'),_0x3272ed[_0x06a0('0x81')],_0x3272ed[_0x06a0('0x7e')][_0x19c445][_0x06a0('0x7f')],_0x3272ed[_0x06a0('0x7e')][_0x19c445][_0x06a0('0x82')],_0x3272ed[_0x06a0('0x7e')][_0x19c445][_0x06a0('0x80')]));}}}if(_0x3272ed['conditions']){_0x3272ed[_0x06a0('0x83')]=JSON[_0x06a0('0x90')](_0x3272ed[_0x06a0('0x83')]);_0xcf2a43[_0x06a0('0x3e')](_0x33211d(_0x3272ed[_0x06a0('0x83')][_0x06a0('0x6a')]));}_0x3f046c=_0xcf2a43['clone']();_0xcf2a43[_0x06a0('0x3b')](_0x43fca8);_0xcf2a43['offset'](0x0);logger[_0x06a0('0x85')]('Limited\x20Query:',_0xcf2a43[_0x06a0('0x88')]());return db[_0x06a0('0x87')][_0x06a0('0x34')](_0xcf2a43[_0x06a0('0x88')](),{'type':db[_0x06a0('0x87')][_0x06a0('0x89')]['SELECT']});}})[_0x06a0('0x26')](function(_0x18d3ca){if(!_0x18d3ca[_0x06a0('0x3a')]){throw new db[(_0x06a0('0x70'))][(_0x06a0('0x8e'))]('No\x20available\x20data',0xcc);}if(_0x43a8df[_0x06a0('0x92')]===_0x06a0('0x93')){return null;}var _0x2242a7=_[_0x06a0('0x41')](_0x43a8df,{'name':_0x43a8df[_0x06a0('0x94')]||_0x43a8df[_0x06a0('0x2c')]||_0x3272ed[_0x06a0('0x2c')],'basename':_0x3e4efd,'savename':util[_0x06a0('0x7a')](_0x06a0('0x95'),_0x43a8df[_0x06a0('0x2c')]||_0x3272ed[_0x06a0('0x2c')],require(_0x06a0('0x96'))[_0x06a0('0x97')](0x4),_0x43a8df[_0x06a0('0x92')]||_0x06a0('0x98')),'reportId':_0x3272ed['id'],'reportType':_0x06a0('0x99')});return db['AnalyticExtractedReport'][_0x06a0('0x4b')](_0x2242a7,{'raw':!![]});})[_0x06a0('0x26')](function(_0x26ce3d){if(_0x3272ed['table']==='cdr'){_0x3f046c[_0x06a0('0x3e')](_0x3272ed[_0x06a0('0x81')]+_0x06a0('0x9a'),_0x43a8df[_0x06a0('0x9b')],_0x43a8df[_0x06a0('0x9c')]);}else{_0x3f046c[_0x06a0('0x3e')](_0x3272ed[_0x06a0('0x81')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x43a8df[_0x06a0('0x9b')],_0x43a8df[_0x06a0('0x9c')]);}if(_0x26ce3d){logger[_0x06a0('0x9d')](_0x06a0('0x9e'),_0x3f046c[_0x06a0('0x88')]());require(_0x06a0('0x9f'))[_0x06a0('0xa0')](path['join'](__dirname,_0x06a0('0xa1'),_0x26ce3d[_0x06a0('0x92')]),[_0x26ce3d['id'],_0x3f046c[_0x06a0('0x88')](),path[_0x06a0('0x8b')](__dirname,_0x06a0('0xa2'),_0x26ce3d[_0x06a0('0xa3')]),_0x3e4efd]);return _0x26ce3d;}else{var _0x44b4b1=squel[_0x06a0('0x74')]();_0x44b4b1['from']('('+_0x3f046c[_0x06a0('0x88')]()+')',_0x06a0('0xa4'));_0x44b4b1['field']('COUNT(*)','count');_0x3f046c[_0x06a0('0x3b')](_0x43a8df['limit']||_0x43fca8);_0x3f046c[_0x06a0('0x1f')](_0x43a8df[_0x06a0('0x1f')]||0x0);return dbH[_0x06a0('0x87')][_0x06a0('0x34')](_0x44b4b1[_0x06a0('0x88')](),{'type':dbH[_0x06a0('0x87')][_0x06a0('0x89')][_0x06a0('0x8a')]})['then'](function(_0x5f19b6){if(!_0x5f19b6['length']){_0x4d9de4=0x0;}else{_0x4d9de4=_0x5f19b6[0x0][_0x06a0('0x1e')]||0x0;}return dbH[_0x06a0('0x87')][_0x06a0('0x34')](_0x3f046c[_0x06a0('0x88')](),{'type':dbH[_0x06a0('0x87')][_0x06a0('0x89')][_0x06a0('0x8a')]});})[_0x06a0('0x26')](function(_0x2e709e){return{'rows':_0x2e709e||[],'count':_0x4d9de4};});}});}exports[_0x06a0('0xa5')]=function(_0x511cb5,_0x51721b){return runReport(_0x511cb5[_0x06a0('0x49')],_0x511cb5[_0x06a0('0x34')],_0x511cb5['options'])['then'](respondWithResult(_0x51721b,null))[_0x06a0('0x47')](handleError(_0x51721b,null));};exports[_0x06a0('0xa6')]=runReport;exports[_0x06a0('0x34')]=function(_0x1272a4,_0x3fb561){var _0x1efb27=0xa;var _0x3fc70d=[_0x06a0('0x8b'),_0x06a0('0x54'),_0x06a0('0x55'),_0x06a0('0x56')];var _0x458bbb={'SUM':_0x06a0('0x57'),'COUNT':_0x06a0('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x06a0('0x5b'),'AVG':_0x06a0('0x5c'),'GROUP_CONCAT':_0x06a0('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5d77f5={'SEC_TO_TIME':_0x06a0('0x60'),'DATE':_0x06a0('0x8c'),'HOUR':_0x06a0('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34dc55=function(_0x25c6aa){return!_[_0x06a0('0x64')]([_0x06a0('0x65'),_0x06a0('0x66'),_0x06a0('0x8d'),_0x06a0('0x67')],_0x25c6aa);};var _0x2b9497=function(_0x448322){if(!_0x448322||!_0x448322[_0x06a0('0x68')][_0x06a0('0x3a')]){return'';}for(var _0x467402='(',_0x412f8e=0x0;_0x412f8e<_0x448322[_0x06a0('0x68')][_0x06a0('0x3a')];_0x412f8e+=0x1){_0x412f8e>0x0&&(_0x467402+='\x20'+_0x448322[_0x06a0('0x69')]+'\x20');_0x467402+=_0x448322[_0x06a0('0x68')][_0x412f8e]['group']?_0x2b9497(_0x448322['rules'][_0x412f8e]['group']):_0x448322[_0x06a0('0x68')][_0x412f8e][_0x06a0('0x6b')]+'\x20'+_0x448322['rules'][_0x412f8e]['condition']+(_0x34dc55(_0x448322[_0x06a0('0x68')][_0x412f8e][_0x06a0('0x6c')])?'\x20'+_0x448322[_0x06a0('0x68')][_0x412f8e][_0x06a0('0x6d')]:'');}return _0x467402+')';};var _0xd3f8f5={'where':{'id':_0x1272a4[_0x06a0('0x49')]['id']}},_0x26a4bc,_0x3abcdf,_0x51b374,_0x58f0ca,_0x2b5437;_0xd3f8f5=_[_0x06a0('0x41')]({},_0xd3f8f5,_0x1272a4[_0x06a0('0x6e')]);return db['AnalyticCustomReport'][_0x06a0('0x4a')](_0xd3f8f5)['then'](function(_0x4b793b){if(_0x4b793b){_0x26a4bc=_0x4b793b;return _0x4b793b['getFields']();}return null;})['then'](function(_0x33b99f){if(_0x33b99f){if(!_0x33b99f['length']){throw new db[(_0x06a0('0x70'))][(_0x06a0('0x8e'))](_0x06a0('0x71'),0x193);}_0x3abcdf=_0x33b99f;return db[_0x06a0('0x72')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x15ae41){if(_0x15ae41){_0x51b374=_[_0x06a0('0x73')](_0x15ae41,'id');var _0x496b95;var _0xc07402=squel[_0x06a0('0x74')]();_0xc07402[_0x06a0('0x75')](_0x26a4bc[_0x06a0('0x81')]);for(var _0x5252e7=0x0;_0x5252e7<_0x3abcdf[_0x06a0('0x3a')];_0x5252e7+=0x1){_0x496b95=_0x3abcdf[_0x5252e7][_0x06a0('0x76')]?_0x51b374[_0x3abcdf[_0x5252e7][_0x06a0('0x76')]]['metric']:_0x3abcdf[_0x5252e7]['field'];_0x496b95=_0x3abcdf[_0x5252e7][_0x06a0('0x78')]?_['replace'](_0x458bbb[_0x3abcdf[_0x5252e7][_0x06a0('0x78')]],'%s',_0x496b95):_0x496b95;_0x496b95=_0x3abcdf[_0x5252e7][_0x06a0('0x7a')]?_[_0x06a0('0x79')](_0x5d77f5[_0x3abcdf[_0x5252e7][_0x06a0('0x7a')]],'%s',_0x496b95):_0x496b95;if(_0x3abcdf[_0x5252e7][_0x06a0('0x7b')]){_0xc07402[_0x06a0('0x6a')](_0x496b95);}_0x3abcdf[_0x5252e7]['orderBy']&&_0xc07402[_0x06a0('0x3c')](_0x496b95,_0x3abcdf[_0x5252e7][_0x06a0('0x7c')]===_0x06a0('0x8f')?![]:!![]);_0xc07402['field'](_0x496b95,_0x3abcdf[_0x5252e7][_0x06a0('0x7d')]||_0x496b95);}if(_0x26a4bc[_0x06a0('0x7e')]){_0x26a4bc['joins']=JSON[_0x06a0('0x90')](_0x26a4bc['joins']);for(var _0x2fd0ce=0x0;_0x2fd0ce<_0x26a4bc['joins']['length'];_0x2fd0ce+=0x1){if(_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce]['type']&&_[_0x06a0('0x64')](_0x3fc70d,_0x26a4bc['joins'][_0x2fd0ce]['type'])&&_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce][_0x06a0('0x7f')]&&_0x26a4bc['joins'][_0x2fd0ce][_0x06a0('0x82')]&&_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce]['foreignKey']){_0xc07402[_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce]['type']](_0x26a4bc['joins'][_0x2fd0ce]['foreignTable'],null,util['format'](_0x06a0('0x91'),_0x26a4bc[_0x06a0('0x81')],_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce][_0x06a0('0x7f')],_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce]['foreignTable'],_0x26a4bc[_0x06a0('0x7e')][_0x2fd0ce][_0x06a0('0x80')]));}}}if(_0x26a4bc[_0x06a0('0x83')]){_0x26a4bc[_0x06a0('0x83')]=JSON[_0x06a0('0x90')](_0x26a4bc[_0x06a0('0x83')]);_0xc07402[_0x06a0('0x3e')](_0x2b9497(_0x26a4bc[_0x06a0('0x83')][_0x06a0('0x6a')]));}_0x2b5437=_0xc07402[_0x06a0('0x84')]();_0xc07402['limit'](_0x1efb27);_0xc07402['offset'](0x0);logger[_0x06a0('0x85')](_0x06a0('0x86'),_0xc07402[_0x06a0('0x88')]());return db[_0x06a0('0x87')]['query'](_0xc07402['toString'](),{'type':db[_0x06a0('0x87')][_0x06a0('0x89')][_0x06a0('0x8a')]});}})[_0x06a0('0x26')](function(){return{'sql':_0x2b5437['toString']()};})[_0x06a0('0x26')](respondWithResult(_0x3fb561,null))['catch'](handleError(_0x3fb561,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8a8dd8e..d65f7c6 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 _0xe700=['../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45fe84,_0x32b364){var _0x11db1f=function(_0x42f25c){while(--_0x42f25c){_0x45fe84['push'](_0x45fe84['shift']());}};_0x11db1f(++_0x32b364);}(_0xe700,0x75));var _0x0e70=function(_0x3b5b4a,_0x2c52fa){_0x3b5b4a=_0x3b5b4a-0x0;var _0x374b72=_0xe700[_0x3b5b4a];return _0x374b72;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require(_0x0e70('0x5'));var rp=require(_0x0e70('0x6'));var fs=require('fs');var path=require(_0x0e70('0x7'));var rimraf=require(_0x0e70('0x8'));var config=require(_0x0e70('0x9'));var attributes=require('./analyticCustomReport.attributes');module[_0x0e70('0xa')]=function(_0x5e1b28,_0x44a1ee){return _0x5e1b28[_0x0e70('0xb')](_0x0e70('0xc'),attributes,{'tableName':_0x0e70('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3274=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports'];(function(_0x2f3bd0,_0x5db937){var _0xb899ce=function(_0x1a79c9){while(--_0x1a79c9){_0x2f3bd0['push'](_0x2f3bd0['shift']());}};_0xb899ce(++_0x5db937);}(_0x3274,0x134));var _0x4327=function(_0x384fc8,_0x4f4a6c){_0x384fc8=_0x384fc8-0x0;var _0x258053=_0x3274[_0x384fc8];return _0x258053;};'use strict';var _=require(_0x4327('0x0'));var util=require('util');var logger=require(_0x4327('0x1'))(_0x4327('0x2'));var moment=require('moment');var BPromise=require(_0x4327('0x3'));var rp=require(_0x4327('0x4'));var fs=require('fs');var path=require(_0x4327('0x5'));var rimraf=require(_0x4327('0x6'));var config=require(_0x4327('0x7'));var attributes=require(_0x4327('0x8'));module['exports']=function(_0xcd9b39,_0x45ee7f){return _0xcd9b39['define'](_0x4327('0x9'),attributes,{'tableName':_0x4327('0xa'),'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 a1f0518..ddb38af 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 _0xb739=['client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xb739,0x175));var _0x9b73=function(_0x225721,_0x3f26d2){_0x225721=_0x225721-0x0;var _0x160053=_0xb739[_0x225721];return _0x160053;};'use strict';var _=require(_0x9b73('0x0'));var util=require(_0x9b73('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b73('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b73('0x3'));var logger=require(_0x9b73('0x4'))('rpc');var config=require(_0x9b73('0x5'));var jayson=require(_0x9b73('0x6'));var client=jayson[_0x9b73('0x7')][_0x9b73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfd0961,_0x2deae8,_0x514e67){return new BPromise(function(_0x39309a,_0x4d4eab){return client[_0x9b73('0x9')](_0xfd0961,_0x514e67)['then'](function(_0x29920d){logger[_0x9b73('0xa')](_0x9b73('0xb'),_0x2deae8,_0x9b73('0xc'));logger[_0x9b73('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2deae8,_0x9b73('0xc'),JSON[_0x9b73('0xe')](_0x29920d));if(_0x29920d[_0x9b73('0xf')]){if(_0x29920d[_0x9b73('0xf')][_0x9b73('0x10')]===0x1f4){logger[_0x9b73('0xf')](_0x9b73('0xb'),_0x2deae8,_0x29920d[_0x9b73('0xf')][_0x9b73('0x11')]);return _0x4d4eab(_0x29920d[_0x9b73('0xf')]['message']);}logger['error'](_0x9b73('0xb'),_0x2deae8,_0x29920d[_0x9b73('0xf')]['message']);return _0x39309a(_0x29920d[_0x9b73('0xf')]['message']);}else{logger[_0x9b73('0xa')](_0x9b73('0xb'),_0x2deae8,_0x9b73('0xc'));_0x39309a(_0x29920d[_0x9b73('0x12')][_0x9b73('0x11')]);}})[_0x9b73('0x13')](function(_0x48d803){logger[_0x9b73('0xf')](_0x9b73('0xb'),_0x2deae8,_0x48d803);_0x4d4eab(_0x48d803);});});} \ No newline at end of file +var _0x0ec6=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x25e2dc,_0x2be577){var _0xd069d6=function(_0xf61b3f){while(--_0xf61b3f){_0x25e2dc['push'](_0x25e2dc['shift']());}};_0xd069d6(++_0x2be577);}(_0x0ec6,0x1d0));var _0x60ec=function(_0x38f19d,_0x54f52d){_0x38f19d=_0x38f19d-0x0;var _0x1cab18=_0x0ec6[_0x38f19d];return _0x1cab18;};'use strict';var _=require(_0x60ec('0x0'));var util=require(_0x60ec('0x1'));var moment=require(_0x60ec('0x2'));var BPromise=require(_0x60ec('0x3'));var rs=require(_0x60ec('0x4'));var fs=require('fs');var Redis=require(_0x60ec('0x5'));var db=require(_0x60ec('0x6'))['db'];var utils=require(_0x60ec('0x7'));var logger=require(_0x60ec('0x8'))('rpc');var config=require(_0x60ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x60ec('0xa')][_0x60ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d9026,_0x2940d4,_0x518310){return new BPromise(function(_0x56b311,_0x7910e4){return client[_0x60ec('0xc')](_0x1d9026,_0x518310)[_0x60ec('0xd')](function(_0x330fee){logger[_0x60ec('0xe')](_0x60ec('0xf'),_0x2940d4,_0x60ec('0x10'));logger[_0x60ec('0x11')](_0x60ec('0x12'),_0x2940d4,'request\x20sent',JSON[_0x60ec('0x13')](_0x330fee));if(_0x330fee['error']){if(_0x330fee['error'][_0x60ec('0x14')]===0x1f4){logger['error'](_0x60ec('0xf'),_0x2940d4,_0x330fee['error']['message']);return _0x7910e4(_0x330fee[_0x60ec('0x15')][_0x60ec('0x16')]);}logger[_0x60ec('0x15')](_0x60ec('0xf'),_0x2940d4,_0x330fee[_0x60ec('0x15')][_0x60ec('0x16')]);return _0x56b311(_0x330fee[_0x60ec('0x15')][_0x60ec('0x16')]);}else{logger[_0x60ec('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2940d4,_0x60ec('0x10'));_0x56b311(_0x330fee[_0x60ec('0x17')][_0x60ec('0x16')]);}})[_0x60ec('0x18')](function(_0x2ae9c5){logger[_0x60ec('0x15')](_0x60ec('0xf'),_0x2940d4,_0x2ae9c5);_0x7910e4(_0x2ae9c5);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f11dc7f..74e8da5 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 _0xee65=['query','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x5e058d,_0x41849f){var _0x5c088b=function(_0x34336c){while(--_0x34336c){_0x5e058d['push'](_0x5e058d['shift']());}};_0x5c088b(++_0x41849f);}(_0xee65,0x1b8));var _0x5ee6=function(_0x3fcb50,_0x214dad){_0x3fcb50=_0x3fcb50-0x0;var _0x2d3b4e=_0xee65[_0x3fcb50];return _0x2d3b4e;};'use strict';var multer=require(_0x5ee6('0x0'));var util=require(_0x5ee6('0x1'));var path=require('path');var timeout=require(_0x5ee6('0x2'));var express=require(_0x5ee6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5ee6('0x4'));var config=require(_0x5ee6('0x5'));var controller=require(_0x5ee6('0x6'));router[_0x5ee6('0x7')]('/',auth[_0x5ee6('0x8')](),controller[_0x5ee6('0x9')]);router[_0x5ee6('0x7')](_0x5ee6('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5ee6('0xb'),auth[_0x5ee6('0x8')](),controller[_0x5ee6('0xc')]);router[_0x5ee6('0x7')](_0x5ee6('0xd'),auth['isAuthenticated'](),controller[_0x5ee6('0xe')]);router['get'](_0x5ee6('0xf'),auth[_0x5ee6('0x8')](),controller[_0x5ee6('0x10')]);router['post']('/',auth[_0x5ee6('0x8')](),controller['create']);router['put'](_0x5ee6('0xa'),auth[_0x5ee6('0x8')](),controller['update']);router[_0x5ee6('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5ee6('0x12')]=router; \ No newline at end of file +var _0xe027=['post','create','put','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query'];(function(_0x4410ca,_0x3da006){var _0x3ed28c=function(_0x1b4797){while(--_0x1b4797){_0x4410ca['push'](_0x4410ca['shift']());}};_0x3ed28c(++_0x3da006);}(_0xe027,0xb8));var _0x7e02=function(_0x79847d,_0x16b7ba){_0x79847d=_0x79847d-0x0;var _0x5b7a2c=_0xe027[_0x79847d];return _0x5b7a2c;};'use strict';var multer=require('multer');var util=require(_0x7e02('0x0'));var path=require(_0x7e02('0x1'));var timeout=require(_0x7e02('0x2'));var express=require('express');var router=express[_0x7e02('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e02('0x4'));var config=require(_0x7e02('0x5'));var controller=require(_0x7e02('0x6'));router[_0x7e02('0x7')]('/',auth[_0x7e02('0x8')](),controller['index']);router[_0x7e02('0x7')](_0x7e02('0x9'),auth[_0x7e02('0x8')](),controller[_0x7e02('0xa')]);router[_0x7e02('0x7')](_0x7e02('0xb'),auth[_0x7e02('0x8')](),controller[_0x7e02('0xc')]);router[_0x7e02('0x7')](_0x7e02('0xd'),auth[_0x7e02('0x8')](),controller['run']);router[_0x7e02('0x7')](_0x7e02('0xe'),auth['isAuthenticated'](),controller[_0x7e02('0xf')]);router[_0x7e02('0x10')]('/',auth[_0x7e02('0x8')](),controller[_0x7e02('0x11')]);router[_0x7e02('0x12')](_0x7e02('0x9'),auth[_0x7e02('0x8')](),controller['update']);router['delete'](_0x7e02('0x9'),auth[_0x7e02('0x8')](),controller[_0x7e02('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 64d7935..d4a662c 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 _0x4a6a=['sequelize','exports','STRING','TEXT'];(function(_0x46ecf3,_0x2d1187){var _0x2e549f=function(_0x10f510){while(--_0x10f510){_0x46ecf3['push'](_0x46ecf3['shift']());}};_0x2e549f(++_0x2d1187);}(_0x4a6a,0x74));var _0xa4a6=function(_0x2aa288,_0x839e1d){_0x2aa288=_0x2aa288-0x0;var _0x13a858=_0x4a6a[_0x2aa288];return _0x13a858;};'use strict';var Sequelize=require(_0xa4a6('0x0'));module[_0xa4a6('0x1')]={'name':{'type':Sequelize[_0xa4a6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa4a6('0x2')]},'parent':{'type':Sequelize[_0xa4a6('0x2')]},'table':{'type':Sequelize[_0xa4a6('0x2')]},'conditions':{'type':Sequelize[_0xa4a6('0x3')]},'joins':{'type':Sequelize[_0xa4a6('0x3')]}}; \ No newline at end of file +var _0xd14b=['exports','STRING','TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd14b,0x1df));var _0xbd14=function(_0x558472,_0x27ffcf){_0x558472=_0x558472-0x0;var _0x37e917=_0xd14b[_0x558472];return _0x37e917;};'use strict';var Sequelize=require(_0xbd14('0x0'));module[_0xbd14('0x1')]={'name':{'type':Sequelize[_0xbd14('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd14('0x2')]},'parent':{'type':Sequelize[_0xbd14('0x2')]},'table':{'type':Sequelize[_0xbd14('0x2')]},'conditions':{'type':Sequelize[_0xbd14('0x3')]},'joins':{'type':Sequelize[_0xbd14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 51e6d59..cfbb711 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 _0xda3f=['SELECT','No\x20available\x20data','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','output','savename','countTable','COUNT(*)','count','run','runReport','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','error','update','body','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','orderBy','order','field','joins','parse','foreignKey','foreignTable','table','conditions','debug','Limited\x20Query:','toString','sequelize','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','condition','getFields','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','parentKey','%s.%s\x20=\x20%s.%s','clone','QueryTypes'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0xda3f,0x159));var _0xfda3=function(_0x27dfa0,_0x18b118){_0x27dfa0=_0x27dfa0-0x0;var _0x47701b=_0xda3f[_0x27dfa0];return _0x47701b;};'use strict';var pdf=require(_0xfda3('0x0'));var emlformat=require(_0xfda3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfda3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfda3('0x3'));var moment=require(_0xfda3('0x4'));var BPromise=require(_0xfda3('0x5'));var Mustache=require(_0xfda3('0x6'));var util=require('util');var path=require(_0xfda3('0x7'));var sox=require(_0xfda3('0x8'));var csv=require('to-csv');var ejs=require(_0xfda3('0x9'));var fs=require('fs');var _=require(_0xfda3('0xa'));var squel=require(_0xfda3('0xb'));var crypto=require('crypto');var jsforce=require(_0xfda3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfda3('0xd'));var Redis=require(_0xfda3('0xe'));var authService=require(_0xfda3('0xf'));var qs=require(_0xfda3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfda3('0x11'));var logger=require(_0xfda3('0x12'))(_0xfda3('0x13'));var utils=require(_0xfda3('0x14'));var config=require(_0xfda3('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0xfda3('0x16'))[_0xfda3('0x17')];function respondWithStatusCode(_0x42c4f0,_0x7b1eb1){_0x7b1eb1=_0x7b1eb1||0xcc;return function(_0xea9969){if(_0xea9969){return _0x42c4f0[_0xfda3('0x18')](_0x7b1eb1);}return _0x42c4f0['status'](_0x7b1eb1)[_0xfda3('0x19')]();};}function respondWithResult(_0xc70280,_0x13d98f){_0x13d98f=_0x13d98f||0xc8;return function(_0x53c893){if(_0x53c893){return _0xc70280[_0xfda3('0x1a')](_0x13d98f)[_0xfda3('0x1b')](_0x53c893);}};}function respondWithFilteredResult(_0x5ee1fd,_0x344292){return function(_0x4312c1){if(_0x4312c1){var _0x1496fd=_0x4312c1['count'],_0xf2fca=_0x344292['offset'],_0x1269e9=_0x344292[_0xfda3('0x1c')]+_0x344292[_0xfda3('0x1d')],_0x468ea7;if(_0x1269e9>=_0x1496fd){_0x1269e9=_0x1496fd;_0x468ea7=0xc8;}else{_0x468ea7=0xce;}_0x5ee1fd[_0xfda3('0x1a')](_0x468ea7);return _0x5ee1fd[_0xfda3('0x1e')](_0xfda3('0x1f'),_0xf2fca+'-'+_0x1269e9+'/'+_0x1496fd)[_0xfda3('0x1b')](_0x4312c1);}return null;};}function patchUpdates(_0x104556){return function(_0x223cf6){try{jsonpatch[_0xfda3('0x20')](_0x223cf6,_0x104556,!![]);}catch(_0x5c4d1e){return BPromise['reject'](_0x5c4d1e);}return _0x223cf6[_0xfda3('0x21')]();};}function saveUpdates(_0x3e91e5,_0x5a184f){return function(_0x433485){if(_0x433485){return _0x433485['update'](_0x3e91e5)[_0xfda3('0x22')](function(_0x25946a){return _0x25946a;});}return null;};}function removeEntity(_0x3e81c8,_0x2a264d){return function(_0x13b4ea){if(_0x13b4ea){return _0x13b4ea[_0xfda3('0x23')]()[_0xfda3('0x22')](function(){var _0x13f0c7=_0x13b4ea[_0xfda3('0x24')]({'plain':!![]});var _0x540e14=_0xfda3('0x25');return db[_0xfda3('0x26')][_0xfda3('0x23')]({'where':{'type':_0x540e14,'resourceId':_0x13f0c7['id']}})[_0xfda3('0x22')](function(){return _0x13b4ea;});})[_0xfda3('0x22')](function(){_0x3e81c8[_0xfda3('0x1a')](0xcc)[_0xfda3('0x19')]();});}};}function handleEntityNotFound(_0x2dfca,_0x45415b){return function(_0x300306){if(!_0x300306){_0x2dfca[_0xfda3('0x18')](0x194);}return _0x300306;};}function handleError(_0x1ea340,_0x1b434d){_0x1b434d=_0x1b434d||0x1f4;return function(_0x53f2c8){logger['error'](_0x53f2c8[_0xfda3('0x27')]);if(_0x53f2c8['name']){delete _0x53f2c8[_0xfda3('0x28')];}_0x1ea340[_0xfda3('0x1a')](_0x1b434d)[_0xfda3('0x29')](_0x53f2c8);};}exports['index']=function(_0x29bb55,_0x18d2ff){var _0x2d43e={},_0x4d816d={},_0x46979b={'count':0x0,'rows':[]};var _0x420290=_[_0xfda3('0x2a')](db[_0xfda3('0x2b')][_0xfda3('0x2c')],function(_0x23550c){return{'name':_0x23550c[_0xfda3('0x2d')],'type':_0x23550c['type']['key']};});_0x4d816d[_0xfda3('0x2e')]=_[_0xfda3('0x2a')](_0x420290,_0xfda3('0x28'));_0x4d816d['query']=_[_0xfda3('0x2f')](_0x29bb55['query']);_0x4d816d[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x4d816d[_0xfda3('0x2e')],_0x4d816d[_0xfda3('0x32')]);_0x2d43e[_0xfda3('0x33')]=_[_0xfda3('0x31')](_0x4d816d[_0xfda3('0x2e')],qs[_0xfda3('0x34')](_0x29bb55[_0xfda3('0x32')][_0xfda3('0x34')]));_0x2d43e['attributes']=_0x2d43e['attributes']['length']?_0x2d43e['attributes']:_0x4d816d[_0xfda3('0x2e')];if(!_0x29bb55[_0xfda3('0x32')]['hasOwnProperty']('nolimit')){_0x2d43e[_0xfda3('0x1d')]=qs[_0xfda3('0x1d')](_0x29bb55[_0xfda3('0x32')]['limit']);_0x2d43e['offset']=qs[_0xfda3('0x1c')](_0x29bb55[_0xfda3('0x32')][_0xfda3('0x1c')]);}_0x2d43e['order']=qs[_0xfda3('0x35')](_0x29bb55[_0xfda3('0x32')][_0xfda3('0x35')]);_0x2d43e[_0xfda3('0x36')]=qs['filters'](_[_0xfda3('0x37')](_0x29bb55[_0xfda3('0x32')],_0x4d816d[_0xfda3('0x30')]),_0x420290);if(_0x29bb55[_0xfda3('0x32')][_0xfda3('0x38')]){_0x2d43e[_0xfda3('0x36')]=_[_0xfda3('0x39')](_0x2d43e[_0xfda3('0x36')],{'$or':_[_0xfda3('0x2a')](_0x420290,function(_0x32987e){if(_0x32987e[_0xfda3('0x3a')]!==_0xfda3('0x3b')){var _0xe5a90f={};_0xe5a90f[_0x32987e[_0xfda3('0x28')]]={'$like':'%'+_0x29bb55[_0xfda3('0x32')][_0xfda3('0x38')]+'%'};return _0xe5a90f;}})});}_0x2d43e=_['merge']({},_0x2d43e,_0x29bb55['options']);var _0x15a5ad={'where':_0x2d43e[_0xfda3('0x36')]};return db[_0xfda3('0x2b')]['count'](_0x15a5ad)[_0xfda3('0x22')](function(_0x533108){_0x46979b['count']=_0x533108;if(_0x29bb55[_0xfda3('0x32')][_0xfda3('0x3c')]){_0x2d43e[_0xfda3('0x3d')]=[{'all':!![]}];}return db[_0xfda3('0x2b')][_0xfda3('0x3e')](_0x2d43e);})[_0xfda3('0x22')](function(_0xb60722){_0x46979b[_0xfda3('0x3f')]=_0xb60722;return _0x46979b;})[_0xfda3('0x22')](respondWithFilteredResult(_0x18d2ff,_0x2d43e))[_0xfda3('0x40')](handleError(_0x18d2ff,null));};exports[_0xfda3('0x41')]=function(_0x5e7ebc,_0x4032e1){var _0x1cf601={'raw':!![],'where':{'id':_0x5e7ebc[_0xfda3('0x42')]['id']}},_0x14b158={};_0x14b158[_0xfda3('0x2e')]=_['keys'](db['AnalyticDefaultReport'][_0xfda3('0x2c')]);_0x14b158[_0xfda3('0x32')]=_[_0xfda3('0x2f')](_0x5e7ebc['query']);_0x14b158[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x14b158[_0xfda3('0x2e')],_0x14b158[_0xfda3('0x32')]);_0x1cf601['attributes']=_[_0xfda3('0x31')](_0x14b158[_0xfda3('0x2e')],qs[_0xfda3('0x34')](_0x5e7ebc[_0xfda3('0x32')]['fields']));_0x1cf601['attributes']=_0x1cf601[_0xfda3('0x33')][_0xfda3('0x43')]?_0x1cf601[_0xfda3('0x33')]:_0x14b158[_0xfda3('0x2e')];if(_0x5e7ebc[_0xfda3('0x32')][_0xfda3('0x3c')]){_0x1cf601[_0xfda3('0x3d')]=[{'all':!![]}];}_0x1cf601=_[_0xfda3('0x39')]({},_0x1cf601,_0x5e7ebc[_0xfda3('0x44')]);return db[_0xfda3('0x2b')][_0xfda3('0x45')](_0x1cf601)[_0xfda3('0x22')](handleEntityNotFound(_0x4032e1,null))[_0xfda3('0x22')](respondWithResult(_0x4032e1,null))['catch'](handleError(_0x4032e1,null));};exports[_0xfda3('0x46')]=function(_0x337798,_0x1f63f3){return db[_0xfda3('0x2b')][_0xfda3('0x46')](_0x337798['body'],{})['then'](function(_0x96778f){var _0x449356=_0x337798['user'][_0xfda3('0x24')]({'plain':!![]});if(!_0x449356)throw new Error(_0xfda3('0x47'));if(_0x449356['role']==='user'){var _0x5d41a5=_0x96778f[_0xfda3('0x24')]({'plain':!![]});var _0xe0ef8b=_0xfda3('0x48');return db[_0xfda3('0x49')][_0xfda3('0x45')]({'where':{'name':_0xe0ef8b,'userProfileId':_0x449356['userProfileId']},'raw':!![]})['then'](function(_0x23f98f){if(_0x23f98f&&_0x23f98f['autoAssociation']===0x0){return db[_0xfda3('0x26')][_0xfda3('0x46')]({'name':_0x5d41a5[_0xfda3('0x28')],'resourceId':_0x5d41a5['id'],'type':_0xfda3('0x25'),'sectionId':_0x23f98f['id']},{})[_0xfda3('0x22')](function(){return _0x96778f;});}else{return _0x96778f;}})[_0xfda3('0x40')](function(_0xe1d898){logger[_0xfda3('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe1d898);throw _0xe1d898;});}return _0x96778f;})['then'](respondWithResult(_0x1f63f3,0xc9))[_0xfda3('0x40')](handleError(_0x1f63f3,null));};exports[_0xfda3('0x4b')]=function(_0x3ce790,_0x32fc65){if(_0x3ce790[_0xfda3('0x4c')]['id']){delete _0x3ce790[_0xfda3('0x4c')]['id'];}return db[_0xfda3('0x2b')][_0xfda3('0x45')]({'where':{'id':_0x3ce790[_0xfda3('0x42')]['id']}})['then'](handleEntityNotFound(_0x32fc65,null))[_0xfda3('0x22')](saveUpdates(_0x3ce790['body'],null))[_0xfda3('0x22')](respondWithResult(_0x32fc65,null))[_0xfda3('0x40')](handleError(_0x32fc65,null));};exports[_0xfda3('0x23')]=function(_0x5ee2ed,_0x495f7a){return db[_0xfda3('0x2b')][_0xfda3('0x45')]({'where':{'id':_0x5ee2ed[_0xfda3('0x42')]['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x495f7a,null))['then'](removeEntity(_0x495f7a,null))[_0xfda3('0x40')](handleError(_0x495f7a,null));};exports[_0xfda3('0x4d')]=function(_0x2eeb82,_0x3eeb0d){var _0x287554=0xa;var _0x1fb551=[_0xfda3('0x4e'),_0xfda3('0x4f'),_0xfda3('0x50'),_0xfda3('0x51')];var _0x366cde={'SUM':'SUM(%s)','COUNT':_0xfda3('0x52'),'COUNT DISTINCT':_0xfda3('0x53'),'MAX':_0xfda3('0x54'),'MIN':_0xfda3('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfda3('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1781fe={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfda3('0x57'),'HOUR':_0xfda3('0x58'),'ROUND':_0xfda3('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x951663=function(_0x26e11a){return!_[_0xfda3('0x5a')]([_0xfda3('0x5b'),_0xfda3('0x5c'),_0xfda3('0x5d'),_0xfda3('0x5e')],_0x26e11a);};var _0x470c13=function(_0x22473a){if(!_0x22473a||!_0x22473a[_0xfda3('0x5f')][_0xfda3('0x43')]){return'';}for(var _0x1f0692='(',_0x49074e=0x0;_0x49074e<_0x22473a[_0xfda3('0x5f')][_0xfda3('0x43')];_0x49074e+=0x1){_0x49074e>0x0&&(_0x1f0692+='\x20'+_0x22473a[_0xfda3('0x60')]+'\x20');_0x1f0692+=_0x22473a['rules'][_0x49074e][_0xfda3('0x61')]?_0x470c13(_0x22473a[_0xfda3('0x5f')][_0x49074e][_0xfda3('0x61')]):_0x22473a['rules'][_0x49074e]['field']+'\x20'+_0x22473a[_0xfda3('0x5f')][_0x49074e]['condition']+(_0x951663(_0x22473a[_0xfda3('0x5f')][_0x49074e]['condition'])?'\x20'+_0x22473a['rules'][_0x49074e][_0xfda3('0x62')]:'');}return _0x1f0692+')';};var _0x4978fc={'where':{'id':_0x2eeb82['params']['id']}},_0x82b843,_0xae622,_0x3f9663,_0x383a29,_0xe0a2db;_0x4978fc=_[_0xfda3('0x39')]({},_0x4978fc,_0x2eeb82[_0xfda3('0x44')]);return db['AnalyticDefaultReport']['find'](_0x4978fc)['then'](function(_0xcf486a){if(_0xcf486a){_0x82b843=_0xcf486a;return _0xcf486a['getFields']();}return null;})[_0xfda3('0x22')](function(_0x2aeb8c){if(_0x2aeb8c){if(!_0x2aeb8c[_0xfda3('0x43')]){throw new db[(_0xfda3('0x63'))][(_0xfda3('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xae622=_0x2aeb8c;return db[_0xfda3('0x65')]['findAll']({'raw':!![]});}return null;})[_0xfda3('0x22')](function(_0x450280){if(_0x450280){_0x3f9663=_[_0xfda3('0x66')](_0x450280,'id');var _0x5926a3;var _0x17059f=squel[_0xfda3('0x67')]();_0x17059f[_0xfda3('0x68')](_0x82b843['table']);for(var _0x45310b=0x0;_0x45310b<_0xae622[_0xfda3('0x43')];_0x45310b+=0x1){_0x5926a3=_0xae622[_0x45310b][_0xfda3('0x69')]?_0x3f9663[_0xae622[_0x45310b][_0xfda3('0x69')]][_0xfda3('0x6a')]:_0xae622[_0x45310b]['field'];_0x5926a3=_0xae622[_0x45310b][_0xfda3('0x6b')]?_[_0xfda3('0x6c')](_0x366cde[_0xae622[_0x45310b]['function']],'%s',_0x5926a3):_0x5926a3;_0x5926a3=_0xae622[_0x45310b][_0xfda3('0x6d')]?_['replace'](_0x1781fe[_0xae622[_0x45310b][_0xfda3('0x6d')]],'%s',_0x5926a3):_0x5926a3;if(_0xae622[_0x45310b]['groupBy']){_0x17059f[_0xfda3('0x61')](_0x5926a3);}_0xae622[_0x45310b][_0xfda3('0x6e')]&&_0x17059f[_0xfda3('0x6f')](_0x5926a3,_0xae622[_0x45310b][_0xfda3('0x6e')]==='DESC'?![]:!![]);_0x17059f[_0xfda3('0x70')](_0x5926a3,_0xae622[_0x45310b]['alias']||_0x5926a3);}if(_0x82b843[_0xfda3('0x71')]){_0x82b843['joins']=JSON[_0xfda3('0x72')](_0x82b843[_0xfda3('0x71')]);for(var _0x389c6b=0x0;_0x389c6b<_0x82b843[_0xfda3('0x71')][_0xfda3('0x43')];_0x389c6b+=0x1){if(_0x82b843[_0xfda3('0x71')][_0x389c6b][_0xfda3('0x3a')]&&_[_0xfda3('0x5a')](_0x1fb551,_0x82b843[_0xfda3('0x71')][_0x389c6b]['type'])&&_0x82b843[_0xfda3('0x71')][_0x389c6b]['parentKey']&&_0x82b843['joins'][_0x389c6b]['foreignTable']&&_0x82b843[_0xfda3('0x71')][_0x389c6b][_0xfda3('0x73')]){_0x17059f[_0x82b843['joins'][_0x389c6b]['type']](_0x82b843[_0xfda3('0x71')][_0x389c6b][_0xfda3('0x74')],null,util[_0xfda3('0x6d')]('%s.%s\x20=\x20%s.%s',_0x82b843[_0xfda3('0x75')],_0x82b843[_0xfda3('0x71')][_0x389c6b]['parentKey'],_0x82b843[_0xfda3('0x71')][_0x389c6b][_0xfda3('0x74')],_0x82b843['joins'][_0x389c6b][_0xfda3('0x73')]));}}}if(_0x82b843[_0xfda3('0x76')]){_0x82b843[_0xfda3('0x76')]=JSON['parse'](_0x82b843[_0xfda3('0x76')]);_0x17059f[_0xfda3('0x36')](_0x470c13(_0x82b843[_0xfda3('0x76')][_0xfda3('0x61')]));}_0xe0a2db=_0x17059f['clone']();_0x17059f[_0xfda3('0x1d')](_0x287554);_0x17059f[_0xfda3('0x1c')](0x0);logger[_0xfda3('0x77')](_0xfda3('0x78'),_0x17059f[_0xfda3('0x79')]());return db[_0xfda3('0x7a')]['query'](_0x17059f[_0xfda3('0x79')](),{'type':db[_0xfda3('0x7a')]['QueryTypes']['SELECT']});}})[_0xfda3('0x22')](respondWithResult(_0x3eeb0d,null))[_0xfda3('0x40')](handleError(_0x3eeb0d,null));};function runReport(_0x289518,_0x51183d,_0xb8fb33){var _0x5115c4=_0x51183d['name'];var _0x339470=0xa;var _0x134921=['join','left_join','right_join',_0xfda3('0x51')];var _0xf02286={'SUM':'SUM(%s)','COUNT':_0xfda3('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfda3('0x54'),'MIN':_0xfda3('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfda3('0x56'),'GROUP_CONCAT ASC':_0xfda3('0x7b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x16fb21={'SEC_TO_TIME':_0xfda3('0x7c'),'DATE':_0xfda3('0x57'),'HOUR':_0xfda3('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfda3('0x7d')};var _0x3bf17f=function(_0x4bb275){return!_['includes'](['IS\x20NULL',_0xfda3('0x5c'),_0xfda3('0x5d'),_0xfda3('0x5e')],_0x4bb275);};var _0xe69bce=function(_0x15536a){if(!_0x15536a||!_0x15536a['rules'][_0xfda3('0x43')]){return'';}for(var _0x12233d='(',_0x26f933=0x0;_0x26f933<_0x15536a['rules']['length'];_0x26f933+=0x1){_0x26f933>0x0&&(_0x12233d+='\x20'+_0x15536a[_0xfda3('0x60')]+'\x20');_0x12233d+=_0x15536a[_0xfda3('0x5f')][_0x26f933][_0xfda3('0x61')]?_0xe69bce(_0x15536a[_0xfda3('0x5f')][_0x26f933][_0xfda3('0x61')]):_0x15536a[_0xfda3('0x5f')][_0x26f933][_0xfda3('0x70')]+'\x20'+_0x15536a['rules'][_0x26f933][_0xfda3('0x7e')]+(_0x3bf17f(_0x15536a[_0xfda3('0x5f')][_0x26f933][_0xfda3('0x7e')])?'\x20'+_0x15536a[_0xfda3('0x5f')][_0x26f933]['value']:'');}return _0x12233d+')';};var _0xf0bd63={'where':{'id':_0x289518['id']}},_0x5d3098,_0x4e3b26,_0x525826,_0x19009a,_0x45cf4e;_0xf0bd63=_['merge']({},_0xf0bd63,_0xb8fb33);return db[_0xfda3('0x2b')][_0xfda3('0x45')](_0xf0bd63)[_0xfda3('0x22')](function(_0x27693a){if(_0x27693a){_0x5d3098=_0x27693a;return _0x27693a[_0xfda3('0x7f')]();}return null;})[_0xfda3('0x22')](function(_0x155ec6){if(_0x155ec6){if(!_0x155ec6[_0xfda3('0x43')]){throw new db[(_0xfda3('0x63'))][(_0xfda3('0x64'))](_0xfda3('0x80'),0x193);}_0x4e3b26=_0x155ec6;return db[_0xfda3('0x65')][_0xfda3('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x2e1e41){if(_0x2e1e41){_0x525826=_[_0xfda3('0x66')](_0x2e1e41,'id');var _0x5a7ede;var _0x1c1e3d=squel['select']();_0x1c1e3d[_0xfda3('0x68')](_0x5d3098[_0xfda3('0x75')]);for(var _0x4d204f=0x0;_0x4d204f<_0x4e3b26['length'];_0x4d204f+=0x1){_0x5a7ede=_0x4e3b26[_0x4d204f][_0xfda3('0x69')]?_0x525826[_0x4e3b26[_0x4d204f][_0xfda3('0x69')]]['metric']:_0x4e3b26[_0x4d204f][_0xfda3('0x70')];_0x5a7ede=_0x4e3b26[_0x4d204f]['function']?_['replace'](_0xf02286[_0x4e3b26[_0x4d204f][_0xfda3('0x6b')]],'%s',_0x5a7ede):_0x5a7ede;_0x5a7ede=_0x4e3b26[_0x4d204f]['format']?_[_0xfda3('0x6c')](_0x16fb21[_0x4e3b26[_0x4d204f]['format']],'%s',_0x5a7ede):_0x5a7ede;if(_0x4e3b26[_0x4d204f][_0xfda3('0x81')]){_0x1c1e3d[_0xfda3('0x61')](_0x5a7ede);}_0x4e3b26[_0x4d204f]['orderBy']&&_0x1c1e3d[_0xfda3('0x6f')](_0x5a7ede,_0x4e3b26[_0x4d204f][_0xfda3('0x6e')]==='DESC'?![]:!![]);_0x1c1e3d[_0xfda3('0x70')](_0x5a7ede,_0x4e3b26[_0x4d204f][_0xfda3('0x82')]||_0x5a7ede);}if(_0x5d3098['joins']){_0x5d3098['joins']=JSON['parse'](_0x5d3098['joins']);for(var _0x26b1f7=0x0;_0x26b1f7<_0x5d3098[_0xfda3('0x71')][_0xfda3('0x43')];_0x26b1f7+=0x1){if(_0x5d3098[_0xfda3('0x71')][_0x26b1f7]['type']&&_[_0xfda3('0x5a')](_0x134921,_0x5d3098['joins'][_0x26b1f7][_0xfda3('0x3a')])&&_0x5d3098['joins'][_0x26b1f7][_0xfda3('0x83')]&&_0x5d3098['joins'][_0x26b1f7][_0xfda3('0x74')]&&_0x5d3098[_0xfda3('0x71')][_0x26b1f7][_0xfda3('0x73')]){_0x1c1e3d[_0x5d3098['joins'][_0x26b1f7][_0xfda3('0x3a')]](_0x5d3098['joins'][_0x26b1f7][_0xfda3('0x74')],null,util['format'](_0xfda3('0x84'),_0x5d3098[_0xfda3('0x75')],_0x5d3098['joins'][_0x26b1f7][_0xfda3('0x83')],_0x5d3098[_0xfda3('0x71')][_0x26b1f7][_0xfda3('0x74')],_0x5d3098[_0xfda3('0x71')][_0x26b1f7][_0xfda3('0x73')]));}}}if(_0x5d3098[_0xfda3('0x76')]){_0x5d3098[_0xfda3('0x76')]=JSON[_0xfda3('0x72')](_0x5d3098[_0xfda3('0x76')]);_0x1c1e3d[_0xfda3('0x36')](_0xe69bce(_0x5d3098['conditions'][_0xfda3('0x61')]));}_0x45cf4e=_0x1c1e3d[_0xfda3('0x85')]();_0x1c1e3d[_0xfda3('0x1d')](_0x339470);_0x1c1e3d[_0xfda3('0x1c')](0x0);logger['debug'](_0xfda3('0x78'),_0x1c1e3d['toString']());return db[_0xfda3('0x7a')][_0xfda3('0x32')](_0x1c1e3d['toString'](),{'type':db[_0xfda3('0x7a')][_0xfda3('0x86')][_0xfda3('0x87')]});}})[_0xfda3('0x22')](function(_0x31b8bb){if(!_0x31b8bb[_0xfda3('0x43')]){throw new db[(_0xfda3('0x63'))][(_0xfda3('0x64'))](_0xfda3('0x88'),0xcc);}if(_0x51183d['output']===_0xfda3('0x89')){return null;}var _0x42a9e4=_[_0xfda3('0x39')](_0x51183d,{'name':_0x51183d[_0xfda3('0x8a')]||_0x51183d[_0xfda3('0x28')]||_0x5d3098[_0xfda3('0x28')],'basename':_0x5115c4,'savename':util[_0xfda3('0x6d')]('%s-%s.%s',_0x51183d[_0xfda3('0x28')]||_0x5d3098['name'],require(_0xfda3('0x8b'))[_0xfda3('0x8c')](0x4),_0x51183d['output']||_0xfda3('0x8d')),'reportId':_0x5d3098['id'],'reportType':_0xfda3('0x8e')});return db[_0xfda3('0x8f')][_0xfda3('0x46')](_0x42a9e4,{'raw':!![]});})['then'](function(_0x9c1fdc){if(_0x5d3098[_0xfda3('0x75')]===_0xfda3('0x90')){_0x45cf4e[_0xfda3('0x36')](_0x5d3098[_0xfda3('0x75')]+_0xfda3('0x91'),_0x51183d[_0xfda3('0x92')],_0x51183d[_0xfda3('0x93')]);}else{_0x45cf4e[_0xfda3('0x36')](_0x5d3098['table']+_0xfda3('0x94'),_0x51183d['startDate'],_0x51183d[_0xfda3('0x93')]);}if(_0x9c1fdc){logger['info'](_0xfda3('0x95'),_0x45cf4e['toString']());require('child_process')[_0xfda3('0x96')](path[_0xfda3('0x4e')](__dirname,'../../components/export/',_0x9c1fdc[_0xfda3('0x97')]),[_0x9c1fdc['id'],_0x45cf4e[_0xfda3('0x79')](),path[_0xfda3('0x4e')](__dirname,'../../files/reports',_0x9c1fdc[_0xfda3('0x98')]),_0x5115c4]);return _0x9c1fdc;}else{var _0x45c418=squel[_0xfda3('0x67')]();_0x45c418[_0xfda3('0x68')]('('+_0x45cf4e['toString']()+')',_0xfda3('0x99'));_0x45c418[_0xfda3('0x70')](_0xfda3('0x9a'),_0xfda3('0x9b'));_0x45cf4e[_0xfda3('0x1d')](_0x51183d[_0xfda3('0x1d')]||_0x339470);_0x45cf4e[_0xfda3('0x1c')](_0x51183d[_0xfda3('0x1c')]||0x0);return dbH[_0xfda3('0x7a')]['query'](_0x45c418[_0xfda3('0x79')](),{'type':dbH[_0xfda3('0x7a')][_0xfda3('0x86')]['SELECT']})['then'](function(_0x20c354){if(!_0x20c354[_0xfda3('0x43')]){_0x19009a=0x0;}else{_0x19009a=_0x20c354[0x0][_0xfda3('0x9b')]||0x0;}return dbH[_0xfda3('0x7a')][_0xfda3('0x32')](_0x45cf4e[_0xfda3('0x79')](),{'type':dbH[_0xfda3('0x7a')][_0xfda3('0x86')][_0xfda3('0x87')]});})['then'](function(_0x43c3b1){return{'rows':_0x43c3b1||[],'count':_0x19009a};});}});}exports[_0xfda3('0x9c')]=function(_0x160bfd,_0x5942bc){return runReport(_0x160bfd[_0xfda3('0x42')],_0x160bfd[_0xfda3('0x32')],_0x160bfd[_0xfda3('0x44')])[_0xfda3('0x22')](respondWithResult(_0x5942bc,null))[_0xfda3('0x40')](handleError(_0x5942bc,null));};exports[_0xfda3('0x9d')]=runReport;exports[_0xfda3('0x32')]=function(_0xac76e6,_0x370fe9){var _0x4eb28c=0xa;var _0x5b39df=[_0xfda3('0x4e'),'left_join',_0xfda3('0x50'),_0xfda3('0x51')];var _0x4e2174={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfda3('0x53'),'MAX':_0xfda3('0x54'),'MIN':'MIN(%s)','AVG':_0xfda3('0x9e'),'GROUP_CONCAT':_0xfda3('0x56'),'GROUP_CONCAT ASC':_0xfda3('0x7b'),'GROUP_CONCAT DESC':_0xfda3('0x9f')};var _0x225337={'SEC_TO_TIME':_0xfda3('0x7c'),'DATE':'DATE(%s)','HOUR':_0xfda3('0x58'),'ROUND':_0xfda3('0x59'),'UNIX_TIMESTAMP':_0xfda3('0x7d')};var _0x108bd5=function(_0x436b51){return!_['includes']([_0xfda3('0x5b'),_0xfda3('0x5c'),_0xfda3('0x5d'),_0xfda3('0x5e')],_0x436b51);};var _0x1a2d7c=function(_0x5a75d0){if(!_0x5a75d0||!_0x5a75d0[_0xfda3('0x5f')][_0xfda3('0x43')]){return'';}for(var _0x4b5825='(',_0x500d5f=0x0;_0x500d5f<_0x5a75d0[_0xfda3('0x5f')][_0xfda3('0x43')];_0x500d5f+=0x1){_0x500d5f>0x0&&(_0x4b5825+='\x20'+_0x5a75d0[_0xfda3('0x60')]+'\x20');_0x4b5825+=_0x5a75d0[_0xfda3('0x5f')][_0x500d5f][_0xfda3('0x61')]?_0x1a2d7c(_0x5a75d0[_0xfda3('0x5f')][_0x500d5f][_0xfda3('0x61')]):_0x5a75d0[_0xfda3('0x5f')][_0x500d5f][_0xfda3('0x70')]+'\x20'+_0x5a75d0[_0xfda3('0x5f')][_0x500d5f]['condition']+(_0x108bd5(_0x5a75d0['rules'][_0x500d5f]['condition'])?'\x20'+_0x5a75d0['rules'][_0x500d5f]['value']:'');}return _0x4b5825+')';};var _0x9f6049={'where':{'id':_0xac76e6[_0xfda3('0x42')]['id']}},_0x28d9dc,_0x3480e5,_0x519ae,_0x3c0a6c,_0x16ca54;_0x9f6049=_['merge']({},_0x9f6049,_0xac76e6['options']);return db[_0xfda3('0x2b')][_0xfda3('0x45')](_0x9f6049)['then'](function(_0x5e0b5a){if(_0x5e0b5a){_0x28d9dc=_0x5e0b5a;return _0x5e0b5a['getFields']();}return null;})[_0xfda3('0x22')](function(_0x6595c7){if(_0x6595c7){if(!_0x6595c7[_0xfda3('0x43')]){throw new db['Sequelize'][(_0xfda3('0x64'))](_0xfda3('0x80'),0x193);}_0x3480e5=_0x6595c7;return db[_0xfda3('0x65')][_0xfda3('0x3e')]({'raw':!![]});}return null;})[_0xfda3('0x22')](function(_0x1daa9c){if(_0x1daa9c){_0x519ae=_['keyBy'](_0x1daa9c,'id');var _0x566755;var _0xd24c0e=squel[_0xfda3('0x67')]();_0xd24c0e['from'](_0x28d9dc['table']);for(var _0x4394cf=0x0;_0x4394cf<_0x3480e5[_0xfda3('0x43')];_0x4394cf+=0x1){_0x566755=_0x3480e5[_0x4394cf][_0xfda3('0x69')]?_0x519ae[_0x3480e5[_0x4394cf][_0xfda3('0x69')]][_0xfda3('0x6a')]:_0x3480e5[_0x4394cf][_0xfda3('0x70')];_0x566755=_0x3480e5[_0x4394cf][_0xfda3('0x6b')]?_['replace'](_0x4e2174[_0x3480e5[_0x4394cf]['function']],'%s',_0x566755):_0x566755;_0x566755=_0x3480e5[_0x4394cf][_0xfda3('0x6d')]?_[_0xfda3('0x6c')](_0x225337[_0x3480e5[_0x4394cf]['format']],'%s',_0x566755):_0x566755;if(_0x3480e5[_0x4394cf]['groupBy']){_0xd24c0e[_0xfda3('0x61')](_0x566755);}_0x3480e5[_0x4394cf]['orderBy']&&_0xd24c0e[_0xfda3('0x6f')](_0x566755,_0x3480e5[_0x4394cf][_0xfda3('0x6e')]==='DESC'?![]:!![]);_0xd24c0e[_0xfda3('0x70')](_0x566755,_0x3480e5[_0x4394cf]['alias']||_0x566755);}if(_0x28d9dc[_0xfda3('0x71')]){_0x28d9dc[_0xfda3('0x71')]=JSON[_0xfda3('0x72')](_0x28d9dc[_0xfda3('0x71')]);for(var _0x18d3c4=0x0;_0x18d3c4<_0x28d9dc[_0xfda3('0x71')]['length'];_0x18d3c4+=0x1){if(_0x28d9dc[_0xfda3('0x71')][_0x18d3c4]['type']&&_[_0xfda3('0x5a')](_0x5b39df,_0x28d9dc[_0xfda3('0x71')][_0x18d3c4]['type'])&&_0x28d9dc[_0xfda3('0x71')][_0x18d3c4][_0xfda3('0x83')]&&_0x28d9dc[_0xfda3('0x71')][_0x18d3c4][_0xfda3('0x74')]&&_0x28d9dc['joins'][_0x18d3c4][_0xfda3('0x73')]){_0xd24c0e[_0x28d9dc['joins'][_0x18d3c4][_0xfda3('0x3a')]](_0x28d9dc[_0xfda3('0x71')][_0x18d3c4][_0xfda3('0x74')],null,util[_0xfda3('0x6d')](_0xfda3('0x84'),_0x28d9dc[_0xfda3('0x75')],_0x28d9dc['joins'][_0x18d3c4][_0xfda3('0x83')],_0x28d9dc[_0xfda3('0x71')][_0x18d3c4][_0xfda3('0x74')],_0x28d9dc[_0xfda3('0x71')][_0x18d3c4][_0xfda3('0x73')]));}}}if(_0x28d9dc[_0xfda3('0x76')]){_0x28d9dc[_0xfda3('0x76')]=JSON[_0xfda3('0x72')](_0x28d9dc[_0xfda3('0x76')]);_0xd24c0e[_0xfda3('0x36')](_0x1a2d7c(_0x28d9dc['conditions'][_0xfda3('0x61')]));}_0x16ca54=_0xd24c0e[_0xfda3('0x85')]();_0xd24c0e['limit'](_0x4eb28c);_0xd24c0e[_0xfda3('0x1c')](0x0);logger[_0xfda3('0x77')](_0xfda3('0x78'),_0xd24c0e[_0xfda3('0x79')]());return db[_0xfda3('0x7a')][_0xfda3('0x32')](_0xd24c0e[_0xfda3('0x79')](),{'type':db['sequelize'][_0xfda3('0x86')][_0xfda3('0x87')]});}})[_0xfda3('0x22')](function(){return{'sql':_0x16ca54['toString']()};})['then'](respondWithResult(_0x370fe9,null))[_0xfda3('0x40')](handleError(_0x370fe9,null));}; \ No newline at end of file +var _0x80a7=['request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','includes','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','MAX(%s)','alias','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','info','fork','../../components/export/','savename','IS\x20EMPTY','metric','rimraf'];(function(_0x1e888f,_0x45b38c){var _0x289447=function(_0x57993f){while(--_0x57993f){_0x1e888f['push'](_0x1e888f['shift']());}};_0x289447(++_0x45b38c);}(_0x80a7,0x13f));var _0x780a=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x80a7[_0x1f8053];return _0x174fd8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x780a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x780a('0x1'));var moment=require(_0x780a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x780a('0x3'));var util=require(_0x780a('0x4'));var path=require(_0x780a('0x5'));var sox=require(_0x780a('0x6'));var csv=require('to-csv');var ejs=require(_0x780a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x780a('0x8'));var crypto=require(_0x780a('0x9'));var jsforce=require(_0x780a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x780a('0xb'));var querystring=require(_0x780a('0xc'));var Papa=require(_0x780a('0xd'));var Redis=require(_0x780a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x780a('0xf'));var as=require(_0x780a('0x10'));var hardwareService=require(_0x780a('0x11'));var logger=require(_0x780a('0x12'))(_0x780a('0x13'));var utils=require(_0x780a('0x14'));var config=require(_0x780a('0x15'));var db=require(_0x780a('0x16'))['db'];var dbH=require(_0x780a('0x16'))['dbH'];function respondWithStatusCode(_0x315f6c,_0x3a4867){_0x3a4867=_0x3a4867||0xcc;return function(_0x2ad587){if(_0x2ad587){return _0x315f6c['sendStatus'](_0x3a4867);}return _0x315f6c[_0x780a('0x17')](_0x3a4867)[_0x780a('0x18')]();};}function respondWithResult(_0x24d136,_0x48dc4a){_0x48dc4a=_0x48dc4a||0xc8;return function(_0x4a7691){if(_0x4a7691){return _0x24d136[_0x780a('0x17')](_0x48dc4a)['json'](_0x4a7691);}};}function respondWithFilteredResult(_0x3bea86,_0x3275e1){return function(_0x1f4930){if(_0x1f4930){var _0x3c5db8=_0x1f4930[_0x780a('0x19')],_0x4bf222=_0x3275e1[_0x780a('0x1a')],_0x45dd4b=_0x3275e1[_0x780a('0x1a')]+_0x3275e1[_0x780a('0x1b')],_0x13dea6;if(_0x45dd4b>=_0x3c5db8){_0x45dd4b=_0x3c5db8;_0x13dea6=0xc8;}else{_0x13dea6=0xce;}_0x3bea86[_0x780a('0x17')](_0x13dea6);return _0x3bea86[_0x780a('0x1c')](_0x780a('0x1d'),_0x4bf222+'-'+_0x45dd4b+'/'+_0x3c5db8)[_0x780a('0x1e')](_0x1f4930);}return null;};}function patchUpdates(_0x127683){return function(_0x216644){try{jsonpatch[_0x780a('0x1f')](_0x216644,_0x127683,!![]);}catch(_0x17a60f){return BPromise['reject'](_0x17a60f);}return _0x216644[_0x780a('0x20')]();};}function saveUpdates(_0x50cbec,_0x3f724f){return function(_0x2a1b42){if(_0x2a1b42){return _0x2a1b42[_0x780a('0x21')](_0x50cbec)[_0x780a('0x22')](function(_0x541f02){return _0x541f02;});}return null;};}function removeEntity(_0x6ed595,_0x3f8257){return function(_0x59c8a2){if(_0x59c8a2){return _0x59c8a2[_0x780a('0x23')]()['then'](function(){var _0x9b58c7=_0x59c8a2[_0x780a('0x24')]({'plain':!![]});var _0x1db958=_0x780a('0x25');return db[_0x780a('0x26')]['destroy']({'where':{'type':_0x1db958,'resourceId':_0x9b58c7['id']}})[_0x780a('0x22')](function(){return _0x59c8a2;});})[_0x780a('0x22')](function(){_0x6ed595[_0x780a('0x17')](0xcc)[_0x780a('0x18')]();});}};}function handleEntityNotFound(_0x272947,_0x42ca53){return function(_0xa178aa){if(!_0xa178aa){_0x272947['sendStatus'](0x194);}return _0xa178aa;};}function handleError(_0x2c6a48,_0x199e06){_0x199e06=_0x199e06||0x1f4;return function(_0x4fb118){logger[_0x780a('0x27')](_0x4fb118[_0x780a('0x28')]);if(_0x4fb118[_0x780a('0x29')]){delete _0x4fb118[_0x780a('0x29')];}_0x2c6a48[_0x780a('0x17')](_0x199e06)['send'](_0x4fb118);};}exports[_0x780a('0x2a')]=function(_0x322832,_0x1d4d9c){var _0x6251e0={},_0x1c21d1={},_0x23af03={'count':0x0,'rows':[]};var _0x2e690d=_[_0x780a('0x2b')](db[_0x780a('0x2c')][_0x780a('0x2d')],function(_0x507094){return{'name':_0x507094[_0x780a('0x2e')],'type':_0x507094[_0x780a('0x2f')][_0x780a('0x30')]};});_0x1c21d1[_0x780a('0x31')]=_[_0x780a('0x2b')](_0x2e690d,_0x780a('0x29'));_0x1c21d1[_0x780a('0x32')]=_['keys'](_0x322832[_0x780a('0x32')]);_0x1c21d1[_0x780a('0x33')]=_['intersection'](_0x1c21d1[_0x780a('0x31')],_0x1c21d1[_0x780a('0x32')]);_0x6251e0['attributes']=_[_0x780a('0x34')](_0x1c21d1['model'],qs['fields'](_0x322832[_0x780a('0x32')]['fields']));_0x6251e0[_0x780a('0x35')]=_0x6251e0[_0x780a('0x35')][_0x780a('0x36')]?_0x6251e0[_0x780a('0x35')]:_0x1c21d1[_0x780a('0x31')];if(!_0x322832[_0x780a('0x32')][_0x780a('0x37')]('nolimit')){_0x6251e0[_0x780a('0x1b')]=qs['limit'](_0x322832['query']['limit']);_0x6251e0[_0x780a('0x1a')]=qs[_0x780a('0x1a')](_0x322832[_0x780a('0x32')][_0x780a('0x1a')]);}_0x6251e0[_0x780a('0x38')]=qs[_0x780a('0x39')](_0x322832['query']['sort']);_0x6251e0[_0x780a('0x3a')]=qs[_0x780a('0x33')](_[_0x780a('0x3b')](_0x322832[_0x780a('0x32')],_0x1c21d1[_0x780a('0x33')]),_0x2e690d);if(_0x322832[_0x780a('0x32')][_0x780a('0x3c')]){_0x6251e0[_0x780a('0x3a')]=_[_0x780a('0x3d')](_0x6251e0['where'],{'$or':_[_0x780a('0x2b')](_0x2e690d,function(_0x3c7622){if(_0x3c7622[_0x780a('0x2f')]!==_0x780a('0x3e')){var _0x2c74b5={};_0x2c74b5[_0x3c7622[_0x780a('0x29')]]={'$like':'%'+_0x322832[_0x780a('0x32')][_0x780a('0x3c')]+'%'};return _0x2c74b5;}})});}_0x6251e0=_[_0x780a('0x3d')]({},_0x6251e0,_0x322832['options']);var _0x429eb2={'where':_0x6251e0[_0x780a('0x3a')]};return db[_0x780a('0x2c')][_0x780a('0x19')](_0x429eb2)[_0x780a('0x22')](function(_0x4e53af){_0x23af03['count']=_0x4e53af;if(_0x322832['query'][_0x780a('0x3f')]){_0x6251e0[_0x780a('0x40')]=[{'all':!![]}];}return db[_0x780a('0x2c')][_0x780a('0x41')](_0x6251e0);})[_0x780a('0x22')](function(_0x2fdb0e){_0x23af03[_0x780a('0x42')]=_0x2fdb0e;return _0x23af03;})[_0x780a('0x22')](respondWithFilteredResult(_0x1d4d9c,_0x6251e0))[_0x780a('0x43')](handleError(_0x1d4d9c,null));};exports[_0x780a('0x44')]=function(_0x5ac5b8,_0x12b4cd){var _0x5d023d={'raw':!![],'where':{'id':_0x5ac5b8[_0x780a('0x45')]['id']}},_0x4dfbe3={};_0x4dfbe3[_0x780a('0x31')]=_[_0x780a('0x46')](db[_0x780a('0x2c')][_0x780a('0x2d')]);_0x4dfbe3[_0x780a('0x32')]=_[_0x780a('0x46')](_0x5ac5b8[_0x780a('0x32')]);_0x4dfbe3[_0x780a('0x33')]=_[_0x780a('0x34')](_0x4dfbe3[_0x780a('0x31')],_0x4dfbe3[_0x780a('0x32')]);_0x5d023d[_0x780a('0x35')]=_[_0x780a('0x34')](_0x4dfbe3[_0x780a('0x31')],qs[_0x780a('0x47')](_0x5ac5b8['query'][_0x780a('0x47')]));_0x5d023d[_0x780a('0x35')]=_0x5d023d[_0x780a('0x35')][_0x780a('0x36')]?_0x5d023d['attributes']:_0x4dfbe3[_0x780a('0x31')];if(_0x5ac5b8[_0x780a('0x32')]['includeAll']){_0x5d023d[_0x780a('0x40')]=[{'all':!![]}];}_0x5d023d=_[_0x780a('0x3d')]({},_0x5d023d,_0x5ac5b8[_0x780a('0x48')]);return db[_0x780a('0x2c')][_0x780a('0x49')](_0x5d023d)[_0x780a('0x22')](handleEntityNotFound(_0x12b4cd,null))[_0x780a('0x22')](respondWithResult(_0x12b4cd,null))[_0x780a('0x43')](handleError(_0x12b4cd,null));};exports[_0x780a('0x4a')]=function(_0x59d8bd,_0x48fcb6){return db['AnalyticDefaultReport'][_0x780a('0x4a')](_0x59d8bd['body'],{})[_0x780a('0x22')](function(_0x43ada1){var _0x3ca694=_0x59d8bd[_0x780a('0x4b')][_0x780a('0x24')]({'plain':!![]});if(!_0x3ca694)throw new Error(_0x780a('0x4c'));if(_0x3ca694[_0x780a('0x4d')]===_0x780a('0x4b')){var _0x15e714=_0x43ada1[_0x780a('0x24')]({'plain':!![]});var _0x376089=_0x780a('0x4e');return db[_0x780a('0x4f')][_0x780a('0x49')]({'where':{'name':_0x376089,'userProfileId':_0x3ca694[_0x780a('0x50')]},'raw':!![]})[_0x780a('0x22')](function(_0x33650c){if(_0x33650c&&_0x33650c[_0x780a('0x51')]===0x0){return db['UserProfileResource'][_0x780a('0x4a')]({'name':_0x15e714[_0x780a('0x29')],'resourceId':_0x15e714['id'],'type':_0x780a('0x25'),'sectionId':_0x33650c['id']},{})[_0x780a('0x22')](function(){return _0x43ada1;});}else{return _0x43ada1;}})[_0x780a('0x43')](function(_0x32c359){logger[_0x780a('0x27')](_0x780a('0x52'),_0x32c359);throw _0x32c359;});}return _0x43ada1;})[_0x780a('0x22')](respondWithResult(_0x48fcb6,0xc9))['catch'](handleError(_0x48fcb6,null));};exports[_0x780a('0x21')]=function(_0x4129f0,_0x33d7ec){if(_0x4129f0[_0x780a('0x53')]['id']){delete _0x4129f0[_0x780a('0x53')]['id'];}return db['AnalyticDefaultReport'][_0x780a('0x49')]({'where':{'id':_0x4129f0[_0x780a('0x45')]['id']}})['then'](handleEntityNotFound(_0x33d7ec,null))[_0x780a('0x22')](saveUpdates(_0x4129f0['body'],null))[_0x780a('0x22')](respondWithResult(_0x33d7ec,null))['catch'](handleError(_0x33d7ec,null));};exports[_0x780a('0x23')]=function(_0x585684,_0x448623){return db[_0x780a('0x2c')][_0x780a('0x49')]({'where':{'id':_0x585684[_0x780a('0x45')]['id']}})[_0x780a('0x22')](handleEntityNotFound(_0x448623,null))[_0x780a('0x22')](removeEntity(_0x448623,null))['catch'](handleError(_0x448623,null));};exports[_0x780a('0x54')]=function(_0x221d79,_0x29d58c){var _0x47ec7a=0xa;var _0x263d53=[_0x780a('0x55'),'left_join',_0x780a('0x56'),_0x780a('0x57')];var _0x5be96a={'SUM':'SUM(%s)','COUNT':_0x780a('0x58'),'COUNT DISTINCT':_0x780a('0x59'),'MAX':'MAX(%s)','MIN':_0x780a('0x5a'),'AVG':_0x780a('0x5b'),'GROUP_CONCAT':_0x780a('0x5c'),'GROUP_CONCAT ASC':_0x780a('0x5d'),'GROUP_CONCAT DESC':_0x780a('0x5e')};var _0x2257af={'SEC_TO_TIME':_0x780a('0x5f'),'DATE':_0x780a('0x60'),'HOUR':_0x780a('0x61'),'ROUND':_0x780a('0x62'),'UNIX_TIMESTAMP':_0x780a('0x63')};var _0x51ec51=function(_0x4d6220){return!_['includes']([_0x780a('0x64'),_0x780a('0x65'),'IS\x20EMPTY',_0x780a('0x66')],_0x4d6220);};var _0x16f549=function(_0x4f2472){if(!_0x4f2472||!_0x4f2472[_0x780a('0x67')][_0x780a('0x36')]){return'';}for(var _0x108f63='(',_0x2a2d3e=0x0;_0x2a2d3e<_0x4f2472[_0x780a('0x67')][_0x780a('0x36')];_0x2a2d3e+=0x1){_0x2a2d3e>0x0&&(_0x108f63+='\x20'+_0x4f2472[_0x780a('0x68')]+'\x20');_0x108f63+=_0x4f2472[_0x780a('0x67')][_0x2a2d3e][_0x780a('0x69')]?_0x16f549(_0x4f2472[_0x780a('0x67')][_0x2a2d3e][_0x780a('0x69')]):_0x4f2472[_0x780a('0x67')][_0x2a2d3e][_0x780a('0x6a')]+'\x20'+_0x4f2472[_0x780a('0x67')][_0x2a2d3e]['condition']+(_0x51ec51(_0x4f2472['rules'][_0x2a2d3e][_0x780a('0x6b')])?'\x20'+_0x4f2472[_0x780a('0x67')][_0x2a2d3e][_0x780a('0x6c')]:'');}return _0x108f63+')';};var _0x2aedf4={'where':{'id':_0x221d79[_0x780a('0x45')]['id']}},_0x40ad99,_0x47f6dd,_0xb9f53d,_0x45b35d,_0x4ccffc;_0x2aedf4=_[_0x780a('0x3d')]({},_0x2aedf4,_0x221d79['options']);return db['AnalyticDefaultReport'][_0x780a('0x49')](_0x2aedf4)[_0x780a('0x22')](function(_0x10971b){if(_0x10971b){_0x40ad99=_0x10971b;return _0x10971b[_0x780a('0x6d')]();}return null;})[_0x780a('0x22')](function(_0x906aa8){if(_0x906aa8){if(!_0x906aa8['length']){throw new db[(_0x780a('0x6e'))][(_0x780a('0x6f'))](_0x780a('0x70'),0x193);}_0x47f6dd=_0x906aa8;return db[_0x780a('0x71')][_0x780a('0x41')]({'raw':!![]});}return null;})[_0x780a('0x22')](function(_0x13168b){if(_0x13168b){_0xb9f53d=_[_0x780a('0x72')](_0x13168b,'id');var _0x353be8;var _0x47b269=squel[_0x780a('0x73')]();_0x47b269[_0x780a('0x74')](_0x40ad99[_0x780a('0x75')]);for(var _0x205ff6=0x0;_0x205ff6<_0x47f6dd[_0x780a('0x36')];_0x205ff6+=0x1){_0x353be8=_0x47f6dd[_0x205ff6][_0x780a('0x76')]?_0xb9f53d[_0x47f6dd[_0x205ff6][_0x780a('0x76')]]['metric']:_0x47f6dd[_0x205ff6]['field'];_0x353be8=_0x47f6dd[_0x205ff6][_0x780a('0x77')]?_[_0x780a('0x78')](_0x5be96a[_0x47f6dd[_0x205ff6][_0x780a('0x77')]],'%s',_0x353be8):_0x353be8;_0x353be8=_0x47f6dd[_0x205ff6][_0x780a('0x79')]?_[_0x780a('0x78')](_0x2257af[_0x47f6dd[_0x205ff6][_0x780a('0x79')]],'%s',_0x353be8):_0x353be8;if(_0x47f6dd[_0x205ff6][_0x780a('0x7a')]){_0x47b269['group'](_0x353be8);}_0x47f6dd[_0x205ff6][_0x780a('0x7b')]&&_0x47b269[_0x780a('0x38')](_0x353be8,_0x47f6dd[_0x205ff6][_0x780a('0x7b')]===_0x780a('0x7c')?![]:!![]);_0x47b269[_0x780a('0x6a')](_0x353be8,_0x47f6dd[_0x205ff6]['alias']||_0x353be8);}if(_0x40ad99[_0x780a('0x7d')]){_0x40ad99[_0x780a('0x7d')]=JSON[_0x780a('0x7e')](_0x40ad99['joins']);for(var _0x5baad8=0x0;_0x5baad8<_0x40ad99[_0x780a('0x7d')][_0x780a('0x36')];_0x5baad8+=0x1){if(_0x40ad99[_0x780a('0x7d')][_0x5baad8][_0x780a('0x2f')]&&_[_0x780a('0x7f')](_0x263d53,_0x40ad99['joins'][_0x5baad8][_0x780a('0x2f')])&&_0x40ad99['joins'][_0x5baad8]['parentKey']&&_0x40ad99[_0x780a('0x7d')][_0x5baad8]['foreignTable']&&_0x40ad99[_0x780a('0x7d')][_0x5baad8]['foreignKey']){_0x47b269[_0x40ad99[_0x780a('0x7d')][_0x5baad8][_0x780a('0x2f')]](_0x40ad99[_0x780a('0x7d')][_0x5baad8][_0x780a('0x80')],null,util[_0x780a('0x79')](_0x780a('0x81'),_0x40ad99[_0x780a('0x75')],_0x40ad99[_0x780a('0x7d')][_0x5baad8][_0x780a('0x82')],_0x40ad99[_0x780a('0x7d')][_0x5baad8]['foreignTable'],_0x40ad99['joins'][_0x5baad8][_0x780a('0x83')]));}}}if(_0x40ad99[_0x780a('0x84')]){_0x40ad99['conditions']=JSON[_0x780a('0x7e')](_0x40ad99[_0x780a('0x84')]);_0x47b269[_0x780a('0x3a')](_0x16f549(_0x40ad99['conditions'][_0x780a('0x69')]));}_0x4ccffc=_0x47b269[_0x780a('0x85')]();_0x47b269['limit'](_0x47ec7a);_0x47b269[_0x780a('0x1a')](0x0);logger[_0x780a('0x86')](_0x780a('0x87'),_0x47b269[_0x780a('0x88')]());return db[_0x780a('0x89')][_0x780a('0x32')](_0x47b269[_0x780a('0x88')](),{'type':db['sequelize'][_0x780a('0x8a')][_0x780a('0x8b')]});}})[_0x780a('0x22')](respondWithResult(_0x29d58c,null))[_0x780a('0x43')](handleError(_0x29d58c,null));};function runReport(_0x4a400c,_0xf82e9,_0x5dcaf4){var _0x368cfc=_0xf82e9['name'];var _0x21c7a9=0xa;var _0x360ebe=[_0x780a('0x55'),_0x780a('0x8c'),_0x780a('0x56'),_0x780a('0x57')];var _0x465c8a={'SUM':_0x780a('0x8d'),'COUNT':_0x780a('0x58'),'COUNT DISTINCT':_0x780a('0x59'),'MAX':_0x780a('0x8e'),'MIN':'MIN(%s)','AVG':_0x780a('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x780a('0x5d'),'GROUP_CONCAT DESC':_0x780a('0x5e')};var _0x52d58f={'SEC_TO_TIME':_0x780a('0x5f'),'DATE':'DATE(%s)','HOUR':_0x780a('0x61'),'ROUND':_0x780a('0x62'),'UNIX_TIMESTAMP':_0x780a('0x63')};var _0x20e5cc=function(_0x6d8b36){return!_[_0x780a('0x7f')]([_0x780a('0x64'),_0x780a('0x65'),'IS\x20EMPTY',_0x780a('0x66')],_0x6d8b36);};var _0x59dcdc=function(_0x1429cf){if(!_0x1429cf||!_0x1429cf['rules'][_0x780a('0x36')]){return'';}for(var _0x4355f3='(',_0x3ea0bc=0x0;_0x3ea0bc<_0x1429cf[_0x780a('0x67')][_0x780a('0x36')];_0x3ea0bc+=0x1){_0x3ea0bc>0x0&&(_0x4355f3+='\x20'+_0x1429cf['operator']+'\x20');_0x4355f3+=_0x1429cf[_0x780a('0x67')][_0x3ea0bc][_0x780a('0x69')]?_0x59dcdc(_0x1429cf[_0x780a('0x67')][_0x3ea0bc][_0x780a('0x69')]):_0x1429cf[_0x780a('0x67')][_0x3ea0bc][_0x780a('0x6a')]+'\x20'+_0x1429cf[_0x780a('0x67')][_0x3ea0bc][_0x780a('0x6b')]+(_0x20e5cc(_0x1429cf[_0x780a('0x67')][_0x3ea0bc][_0x780a('0x6b')])?'\x20'+_0x1429cf['rules'][_0x3ea0bc][_0x780a('0x6c')]:'');}return _0x4355f3+')';};var _0x23d84a={'where':{'id':_0x4a400c['id']}},_0x125ba9,_0x5959f9,_0x1ad90b,_0x5a1b0a,_0x39b93f;_0x23d84a=_[_0x780a('0x3d')]({},_0x23d84a,_0x5dcaf4);return db[_0x780a('0x2c')]['find'](_0x23d84a)[_0x780a('0x22')](function(_0x16c9a2){if(_0x16c9a2){_0x125ba9=_0x16c9a2;return _0x16c9a2['getFields']();}return null;})['then'](function(_0x22c770){if(_0x22c770){if(!_0x22c770[_0x780a('0x36')]){throw new db['Sequelize'][(_0x780a('0x6f'))](_0x780a('0x70'),0x193);}_0x5959f9=_0x22c770;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x53837b){if(_0x53837b){_0x1ad90b=_['keyBy'](_0x53837b,'id');var _0x1d6059;var _0x13ff52=squel[_0x780a('0x73')]();_0x13ff52['from'](_0x125ba9[_0x780a('0x75')]);for(var _0x563e8b=0x0;_0x563e8b<_0x5959f9[_0x780a('0x36')];_0x563e8b+=0x1){_0x1d6059=_0x5959f9[_0x563e8b][_0x780a('0x76')]?_0x1ad90b[_0x5959f9[_0x563e8b][_0x780a('0x76')]]['metric']:_0x5959f9[_0x563e8b][_0x780a('0x6a')];_0x1d6059=_0x5959f9[_0x563e8b][_0x780a('0x77')]?_[_0x780a('0x78')](_0x465c8a[_0x5959f9[_0x563e8b]['function']],'%s',_0x1d6059):_0x1d6059;_0x1d6059=_0x5959f9[_0x563e8b][_0x780a('0x79')]?_['replace'](_0x52d58f[_0x5959f9[_0x563e8b][_0x780a('0x79')]],'%s',_0x1d6059):_0x1d6059;if(_0x5959f9[_0x563e8b]['groupBy']){_0x13ff52[_0x780a('0x69')](_0x1d6059);}_0x5959f9[_0x563e8b][_0x780a('0x7b')]&&_0x13ff52[_0x780a('0x38')](_0x1d6059,_0x5959f9[_0x563e8b][_0x780a('0x7b')]===_0x780a('0x7c')?![]:!![]);_0x13ff52[_0x780a('0x6a')](_0x1d6059,_0x5959f9[_0x563e8b][_0x780a('0x8f')]||_0x1d6059);}if(_0x125ba9['joins']){_0x125ba9[_0x780a('0x7d')]=JSON[_0x780a('0x7e')](_0x125ba9[_0x780a('0x7d')]);for(var _0x3ba451=0x0;_0x3ba451<_0x125ba9[_0x780a('0x7d')]['length'];_0x3ba451+=0x1){if(_0x125ba9[_0x780a('0x7d')][_0x3ba451][_0x780a('0x2f')]&&_[_0x780a('0x7f')](_0x360ebe,_0x125ba9[_0x780a('0x7d')][_0x3ba451]['type'])&&_0x125ba9['joins'][_0x3ba451][_0x780a('0x82')]&&_0x125ba9[_0x780a('0x7d')][_0x3ba451]['foreignTable']&&_0x125ba9[_0x780a('0x7d')][_0x3ba451][_0x780a('0x83')]){_0x13ff52[_0x125ba9['joins'][_0x3ba451][_0x780a('0x2f')]](_0x125ba9[_0x780a('0x7d')][_0x3ba451][_0x780a('0x80')],null,util[_0x780a('0x79')](_0x780a('0x81'),_0x125ba9[_0x780a('0x75')],_0x125ba9['joins'][_0x3ba451][_0x780a('0x82')],_0x125ba9[_0x780a('0x7d')][_0x3ba451][_0x780a('0x80')],_0x125ba9[_0x780a('0x7d')][_0x3ba451][_0x780a('0x83')]));}}}if(_0x125ba9[_0x780a('0x84')]){_0x125ba9[_0x780a('0x84')]=JSON['parse'](_0x125ba9['conditions']);_0x13ff52[_0x780a('0x3a')](_0x59dcdc(_0x125ba9[_0x780a('0x84')][_0x780a('0x69')]));}_0x39b93f=_0x13ff52['clone']();_0x13ff52[_0x780a('0x1b')](_0x21c7a9);_0x13ff52[_0x780a('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x13ff52[_0x780a('0x88')]());return db[_0x780a('0x89')]['query'](_0x13ff52['toString'](),{'type':db[_0x780a('0x89')]['QueryTypes'][_0x780a('0x8b')]});}})[_0x780a('0x22')](function(_0x4ad444){if(!_0x4ad444[_0x780a('0x36')]){throw new db[(_0x780a('0x6e'))][(_0x780a('0x6f'))](_0x780a('0x90'),0xcc);}if(_0xf82e9[_0x780a('0x91')]===_0x780a('0x92')){return null;}var _0x1de42a=_[_0x780a('0x3d')](_0xf82e9,{'name':_0xf82e9[_0x780a('0x93')]||_0xf82e9[_0x780a('0x29')]||_0x125ba9[_0x780a('0x29')],'basename':_0x368cfc,'savename':util[_0x780a('0x79')](_0x780a('0x94'),_0xf82e9[_0x780a('0x29')]||_0x125ba9[_0x780a('0x29')],require('randomstring')[_0x780a('0x95')](0x4),_0xf82e9['output']||_0x780a('0x96')),'reportId':_0x125ba9['id'],'reportType':'default'});return db[_0x780a('0x97')]['create'](_0x1de42a,{'raw':!![]});})['then'](function(_0xccc75f){if(_0x125ba9['table']==='cdr'){_0x39b93f[_0x780a('0x3a')](_0x125ba9[_0x780a('0x75')]+_0x780a('0x98'),_0xf82e9['startDate'],_0xf82e9['endDate']);}else{_0x39b93f['where'](_0x125ba9['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xf82e9['startDate'],_0xf82e9[_0x780a('0x99')]);}if(_0xccc75f){logger[_0x780a('0x9a')]('Run\x20Query:',_0x39b93f[_0x780a('0x88')]());require('child_process')[_0x780a('0x9b')](path[_0x780a('0x55')](__dirname,_0x780a('0x9c'),_0xccc75f[_0x780a('0x91')]),[_0xccc75f['id'],_0x39b93f['toString'](),path['join'](__dirname,'../../files/reports',_0xccc75f[_0x780a('0x9d')]),_0x368cfc]);return _0xccc75f;}else{var _0x50bd22=squel['select']();_0x50bd22['from']('('+_0x39b93f[_0x780a('0x88')]()+')','countTable');_0x50bd22[_0x780a('0x6a')]('COUNT(*)',_0x780a('0x19'));_0x39b93f['limit'](_0xf82e9[_0x780a('0x1b')]||_0x21c7a9);_0x39b93f[_0x780a('0x1a')](_0xf82e9[_0x780a('0x1a')]||0x0);return dbH[_0x780a('0x89')][_0x780a('0x32')](_0x50bd22[_0x780a('0x88')](),{'type':dbH[_0x780a('0x89')][_0x780a('0x8a')][_0x780a('0x8b')]})[_0x780a('0x22')](function(_0x469f91){if(!_0x469f91['length']){_0x5a1b0a=0x0;}else{_0x5a1b0a=_0x469f91[0x0][_0x780a('0x19')]||0x0;}return dbH[_0x780a('0x89')][_0x780a('0x32')](_0x39b93f[_0x780a('0x88')](),{'type':dbH[_0x780a('0x89')][_0x780a('0x8a')][_0x780a('0x8b')]});})[_0x780a('0x22')](function(_0xa209ab){return{'rows':_0xa209ab||[],'count':_0x5a1b0a};});}});}exports['run']=function(_0x28fb08,_0x41d6c2){return runReport(_0x28fb08[_0x780a('0x45')],_0x28fb08['query'],_0x28fb08[_0x780a('0x48')])['then'](respondWithResult(_0x41d6c2,null))[_0x780a('0x43')](handleError(_0x41d6c2,null));};exports['runReport']=runReport;exports[_0x780a('0x32')]=function(_0x50ad5d,_0x1b8b4c){var _0x5c66c0=0xa;var _0x3c101a=[_0x780a('0x55'),_0x780a('0x8c'),_0x780a('0x56'),_0x780a('0x57')];var _0x360838={'SUM':_0x780a('0x8d'),'COUNT':_0x780a('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x780a('0x8e'),'MIN':_0x780a('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x780a('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x780a('0x5e')};var _0x1fe4c0={'SEC_TO_TIME':_0x780a('0x5f'),'DATE':'DATE(%s)','HOUR':_0x780a('0x61'),'ROUND':_0x780a('0x62'),'UNIX_TIMESTAMP':_0x780a('0x63')};var _0x3d218b=function(_0x1427e3){return!_[_0x780a('0x7f')]([_0x780a('0x64'),_0x780a('0x65'),_0x780a('0x9e'),'IS\x20NOT\x20EMPTY'],_0x1427e3);};var _0x531960=function(_0x5e8b02){if(!_0x5e8b02||!_0x5e8b02[_0x780a('0x67')][_0x780a('0x36')]){return'';}for(var _0xe05973='(',_0x3907a6=0x0;_0x3907a6<_0x5e8b02['rules']['length'];_0x3907a6+=0x1){_0x3907a6>0x0&&(_0xe05973+='\x20'+_0x5e8b02[_0x780a('0x68')]+'\x20');_0xe05973+=_0x5e8b02[_0x780a('0x67')][_0x3907a6]['group']?_0x531960(_0x5e8b02['rules'][_0x3907a6]['group']):_0x5e8b02[_0x780a('0x67')][_0x3907a6][_0x780a('0x6a')]+'\x20'+_0x5e8b02[_0x780a('0x67')][_0x3907a6][_0x780a('0x6b')]+(_0x3d218b(_0x5e8b02[_0x780a('0x67')][_0x3907a6]['condition'])?'\x20'+_0x5e8b02['rules'][_0x3907a6]['value']:'');}return _0xe05973+')';};var _0x10bb28={'where':{'id':_0x50ad5d[_0x780a('0x45')]['id']}},_0x3ed4b1,_0x1de716,_0x39888a,_0x3a39fb,_0x1f6333;_0x10bb28=_[_0x780a('0x3d')]({},_0x10bb28,_0x50ad5d[_0x780a('0x48')]);return db['AnalyticDefaultReport'][_0x780a('0x49')](_0x10bb28)[_0x780a('0x22')](function(_0x5e2f3d){if(_0x5e2f3d){_0x3ed4b1=_0x5e2f3d;return _0x5e2f3d['getFields']();}return null;})['then'](function(_0x1a7fd1){if(_0x1a7fd1){if(!_0x1a7fd1[_0x780a('0x36')]){throw new db[(_0x780a('0x6e'))][(_0x780a('0x6f'))](_0x780a('0x70'),0x193);}_0x1de716=_0x1a7fd1;return db[_0x780a('0x71')][_0x780a('0x41')]({'raw':!![]});}return null;})[_0x780a('0x22')](function(_0x23cddb){if(_0x23cddb){_0x39888a=_[_0x780a('0x72')](_0x23cddb,'id');var _0x1267da;var _0x5da351=squel[_0x780a('0x73')]();_0x5da351[_0x780a('0x74')](_0x3ed4b1['table']);for(var _0x3e39b1=0x0;_0x3e39b1<_0x1de716['length'];_0x3e39b1+=0x1){_0x1267da=_0x1de716[_0x3e39b1][_0x780a('0x76')]?_0x39888a[_0x1de716[_0x3e39b1][_0x780a('0x76')]][_0x780a('0x9f')]:_0x1de716[_0x3e39b1][_0x780a('0x6a')];_0x1267da=_0x1de716[_0x3e39b1]['function']?_[_0x780a('0x78')](_0x360838[_0x1de716[_0x3e39b1][_0x780a('0x77')]],'%s',_0x1267da):_0x1267da;_0x1267da=_0x1de716[_0x3e39b1][_0x780a('0x79')]?_[_0x780a('0x78')](_0x1fe4c0[_0x1de716[_0x3e39b1]['format']],'%s',_0x1267da):_0x1267da;if(_0x1de716[_0x3e39b1][_0x780a('0x7a')]){_0x5da351['group'](_0x1267da);}_0x1de716[_0x3e39b1]['orderBy']&&_0x5da351[_0x780a('0x38')](_0x1267da,_0x1de716[_0x3e39b1][_0x780a('0x7b')]===_0x780a('0x7c')?![]:!![]);_0x5da351[_0x780a('0x6a')](_0x1267da,_0x1de716[_0x3e39b1]['alias']||_0x1267da);}if(_0x3ed4b1[_0x780a('0x7d')]){_0x3ed4b1['joins']=JSON[_0x780a('0x7e')](_0x3ed4b1[_0x780a('0x7d')]);for(var _0x24ebe7=0x0;_0x24ebe7<_0x3ed4b1[_0x780a('0x7d')][_0x780a('0x36')];_0x24ebe7+=0x1){if(_0x3ed4b1['joins'][_0x24ebe7][_0x780a('0x2f')]&&_[_0x780a('0x7f')](_0x3c101a,_0x3ed4b1[_0x780a('0x7d')][_0x24ebe7][_0x780a('0x2f')])&&_0x3ed4b1['joins'][_0x24ebe7]['parentKey']&&_0x3ed4b1[_0x780a('0x7d')][_0x24ebe7][_0x780a('0x80')]&&_0x3ed4b1['joins'][_0x24ebe7][_0x780a('0x83')]){_0x5da351[_0x3ed4b1[_0x780a('0x7d')][_0x24ebe7][_0x780a('0x2f')]](_0x3ed4b1[_0x780a('0x7d')][_0x24ebe7][_0x780a('0x80')],null,util[_0x780a('0x79')]('%s.%s\x20=\x20%s.%s',_0x3ed4b1[_0x780a('0x75')],_0x3ed4b1[_0x780a('0x7d')][_0x24ebe7]['parentKey'],_0x3ed4b1['joins'][_0x24ebe7][_0x780a('0x80')],_0x3ed4b1[_0x780a('0x7d')][_0x24ebe7][_0x780a('0x83')]));}}}if(_0x3ed4b1[_0x780a('0x84')]){_0x3ed4b1[_0x780a('0x84')]=JSON[_0x780a('0x7e')](_0x3ed4b1[_0x780a('0x84')]);_0x5da351[_0x780a('0x3a')](_0x531960(_0x3ed4b1[_0x780a('0x84')]['group']));}_0x1f6333=_0x5da351[_0x780a('0x85')]();_0x5da351['limit'](_0x5c66c0);_0x5da351[_0x780a('0x1a')](0x0);logger[_0x780a('0x86')]('Limited\x20Query:',_0x5da351[_0x780a('0x88')]());return db[_0x780a('0x89')][_0x780a('0x32')](_0x5da351['toString'](),{'type':db[_0x780a('0x89')]['QueryTypes'][_0x780a('0x8b')]});}})[_0x780a('0x22')](function(){return{'sql':_0x1f6333[_0x780a('0x88')]()};})[_0x780a('0x22')](respondWithResult(_0x1b8b4c,null))['catch'](handleError(_0x1b8b4c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 48c5d6e..2e852b8 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 _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x20d009,_0x33a9ee){var _0x282064=function(_0x4908d0){while(--_0x4908d0){_0x20d009['push'](_0x20d009['shift']());}};_0x282064(++_0x33a9ee);}(_0x0295,0x1f0));var _0x5029=function(_0x4b5815,_0x44fb95){_0x4b5815=_0x4b5815-0x0;var _0x58634a=_0x0295[_0x4b5815];return _0x58634a;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d43ce,_0x433f16){var _0x5069e8=function(_0xc0b970){while(--_0xc0b970){_0x3d43ce['push'](_0x3d43ce['shift']());}};_0x5069e8(++_0x433f16);}(_0x1967,0x173));var _0x7196=function(_0xb7755,_0x124740){_0xb7755=_0xb7755-0x0;var _0x2e7275=_0x1967[_0xb7755];return _0x2e7275;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'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 1a3d007..9ba5579 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 _0x3495=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1941d5,_0x549ea9){var _0x1ebd10=function(_0x270791){while(--_0x270791){_0x1941d5['push'](_0x1941d5['shift']());}};_0x1ebd10(++_0x549ea9);}(_0x3495,0x1de));var _0x5349=function(_0xeb4558,_0x3ca004){_0xeb4558=_0xeb4558-0x0;var _0x37a8a7=_0x3495[_0xeb4558];return _0x37a8a7;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x538385,_0x6fb5dc,_0x529323){return new BPromise(function(_0x393873,_0x583cee){return client[_0x5349('0xc')](_0x538385,_0x529323)[_0x5349('0xd')](function(_0x22a3d3){logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,_0x5349('0x10'));logger[_0x5349('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x6fb5dc,_0x5349('0x10'),JSON['stringify'](_0x22a3d3));if(_0x22a3d3[_0x5349('0x12')]){if(_0x22a3d3[_0x5349('0x12')][_0x5349('0x13')]===0x1f4){logger[_0x5349('0x12')](_0x5349('0xf'),_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x583cee(_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);}logger[_0x5349('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x393873(_0x22a3d3['error'][_0x5349('0x14')]);}else{logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,'request\x20sent');_0x393873(_0x22a3d3['result']['message']);}})[_0x5349('0x15')](function(_0x5c873d){logger[_0x5349('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x6fb5dc,_0x5c873d);_0x583cee(_0x5c873d);});});} \ No newline at end of file +var _0x26f9=['jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x26f9,0x16f));var _0x926f=function(_0x667081,_0x1d02b8){_0x667081=_0x667081-0x0;var _0x1c1e88=_0x26f9[_0x667081];return _0x1c1e88;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var moment=require('moment');var BPromise=require(_0x926f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926f('0x3'))['db'];var utils=require(_0x926f('0x4'));var logger=require('../../config/logger')(_0x926f('0x5'));var config=require(_0x926f('0x6'));var jayson=require(_0x926f('0x7'));var client=jayson[_0x926f('0x8')][_0x926f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d2ded,_0xf56fcb,_0x1e455d){return new BPromise(function(_0x41a7ed,_0x2af11e){return client['request'](_0x3d2ded,_0x1e455d)[_0x926f('0xa')](function(_0x593c13){logger[_0x926f('0xb')](_0x926f('0xc'),_0xf56fcb,'request\x20sent');logger[_0x926f('0xd')](_0x926f('0xe'),_0xf56fcb,_0x926f('0xf'),JSON[_0x926f('0x10')](_0x593c13));if(_0x593c13[_0x926f('0x11')]){if(_0x593c13['error'][_0x926f('0x12')]===0x1f4){logger[_0x926f('0x11')](_0x926f('0xc'),_0xf56fcb,_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);return _0x2af11e(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xf56fcb,_0x593c13['error'][_0x926f('0x13')]);return _0x41a7ed(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}else{logger[_0x926f('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf56fcb,_0x926f('0xf'));_0x41a7ed(_0x593c13[_0x926f('0x14')]['message']);}})[_0x926f('0x15')](function(_0x52865b){logger[_0x926f('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf56fcb,_0x52865b);_0x2af11e(_0x52865b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1e3eb1f..b5e63f0 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 _0xd40a=['multer','util','express','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview','/:id/run','/:id/query','post','put','/:id','update','delete','destroy','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd40a,0x12c));var _0xad40=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd40a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xad40('0x0'));var util=require(_0xad40('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad40('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xad40('0x3'));var config=require(_0xad40('0x4'));var controller=require(_0xad40('0x5'));router['get']('/',auth[_0xad40('0x6')](),controller[_0xad40('0x7')]);router[_0xad40('0x8')]('/:id',auth[_0xad40('0x6')](),controller[_0xad40('0x9')]);router[_0xad40('0x8')](_0xad40('0xa'),auth[_0xad40('0x6')](),controller['preview']);router[_0xad40('0x8')](_0xad40('0xb'),auth['isAuthenticated'](),controller['run']);router[_0xad40('0x8')](_0xad40('0xc'),auth['isAuthenticated'](),controller['query']);router[_0xad40('0xd')]('/',auth[_0xad40('0x6')](),controller['create']);router[_0xad40('0xe')](_0xad40('0xf'),auth[_0xad40('0x6')](),controller[_0xad40('0x10')]);router[_0xad40('0x11')](_0xad40('0xf'),auth['isAuthenticated'](),controller[_0xad40('0x12')]);module[_0xad40('0x13')]=router; \ No newline at end of file +var _0xcfc3=['multer','util','express','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','run','/:id/query','post','put','update','delete','destroy','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcfc3,0xc6));var _0x3cfc=function(_0x28e034,_0x19c5db){_0x28e034=_0x28e034-0x0;var _0x5a144b=_0xcfc3[_0x28e034];return _0x5a144b;};'use strict';var multer=require(_0x3cfc('0x0'));var util=require(_0x3cfc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3cfc('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3cfc('0x3'));var controller=require(_0x3cfc('0x4'));router[_0x3cfc('0x5')]('/',auth[_0x3cfc('0x6')](),controller['index']);router[_0x3cfc('0x5')](_0x3cfc('0x7'),auth[_0x3cfc('0x6')](),controller[_0x3cfc('0x8')]);router[_0x3cfc('0x5')](_0x3cfc('0x9'),auth[_0x3cfc('0x6')](),controller['preview']);router[_0x3cfc('0x5')]('/:id/run',auth[_0x3cfc('0x6')](),controller[_0x3cfc('0xa')]);router[_0x3cfc('0x5')](_0x3cfc('0xb'),auth[_0x3cfc('0x6')](),controller['query']);router[_0x3cfc('0xc')]('/',auth[_0x3cfc('0x6')](),controller['create']);router[_0x3cfc('0xd')](_0x3cfc('0x7'),auth['isAuthenticated'](),controller[_0x3cfc('0xe')]);router[_0x3cfc('0xf')](_0x3cfc('0x7'),auth['isAuthenticated'](),controller[_0x3cfc('0x10')]);module[_0x3cfc('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d58cbe8..9f77831 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 _0xc7a7=['manual','scheduled','INTEGER','moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xc7a7,0x66));var _0x7c7a=function(_0xa8bef2,_0xb612b4){_0xa8bef2=_0xa8bef2-0x0;var _0x5e61cc=_0xc7a7[_0xa8bef2];return _0x5e61cc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7c7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c7a('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x7c7a('0x2')](_0x7c7a('0x3'),_0x7c7a('0x4'),_0x7c7a('0x5')),'allowNull':![],'defaultValue':_0x7c7a('0x3')},'savename':{'type':Sequelize[_0x7c7a('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7c7a('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x7c7a('0x1')],'defaultValue':_0x7c7a('0x7')},'type':{'type':Sequelize[_0x7c7a('0x2')](_0x7c7a('0x8'),_0x7c7a('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7c7a('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7c7a('0x1')]}}; \ No newline at end of file +var _0x798e=['STRING','csv','xlsx','DATE','Loading','ENUM','manual','sequelize','exports'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x798e,0x11e));var _0xe798=function(_0x520b0f,_0x3f276c){_0x520b0f=_0x520b0f-0x0;var _0x43660f=_0x798e[_0x520b0f];return _0x43660f;};'use strict';var Sequelize=require(_0xe798('0x0'));var moment=require('moment');module[_0xe798('0x1')]={'name':{'type':Sequelize[_0xe798('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe798('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xe798('0x3'),'pdf',_0xe798('0x4')),'allowNull':![],'defaultValue':_0xe798('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xe798('0x5')]},'endDate':{'type':Sequelize[_0xe798('0x5')]},'status':{'type':Sequelize[_0xe798('0x2')],'defaultValue':_0xe798('0x6')},'type':{'type':Sequelize[_0xe798('0x7')](_0xe798('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0xe798('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 89a6fc8..6078887 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 _0x6a76=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticExtractedReport','include','findAll','rows','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','params','download','basename','savename','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','output','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring'];(function(_0xf54109,_0x35cb62){var _0x4d4cb2=function(_0x27e13e){while(--_0x27e13e){_0xf54109['push'](_0xf54109['shift']());}};_0x4d4cb2(++_0x35cb62);}(_0x6a76,0xaa));var _0x66a7=function(_0xea25aa,_0x4c3a90){_0xea25aa=_0xea25aa-0x0;var _0x45c7ac=_0x6a76[_0xea25aa];return _0x45c7ac;};'use strict';var pdf=require(_0x66a7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66a7('0x1'));var jsonpatch=require(_0x66a7('0x2'));var rp=require(_0x66a7('0x3'));var moment=require(_0x66a7('0x4'));var BPromise=require(_0x66a7('0x5'));var Mustache=require(_0x66a7('0x6'));var util=require('util');var path=require(_0x66a7('0x7'));var sox=require('sox');var csv=require(_0x66a7('0x8'));var ejs=require(_0x66a7('0x9'));var fs=require('fs');var _=require(_0x66a7('0xa'));var squel=require(_0x66a7('0xb'));var crypto=require('crypto');var jsforce=require(_0x66a7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x66a7('0x8'));var querystring=require(_0x66a7('0xd'));var Papa=require(_0x66a7('0xe'));var Redis=require(_0x66a7('0xf'));var authService=require(_0x66a7('0x10'));var qs=require(_0x66a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x66a7('0x12'))(_0x66a7('0x13'));var utils=require(_0x66a7('0x14'));var config=require(_0x66a7('0x15'));var db=require(_0x66a7('0x16'))['db'];function respondWithStatusCode(_0x158c1c,_0x5583fa){_0x5583fa=_0x5583fa||0xcc;return function(_0x255f61){if(_0x255f61){return _0x158c1c['sendStatus'](_0x5583fa);}return _0x158c1c['status'](_0x5583fa)[_0x66a7('0x17')]();};}function respondWithResult(_0x7e006c,_0x226d0b){_0x226d0b=_0x226d0b||0xc8;return function(_0x46df8c){if(_0x46df8c){return _0x7e006c[_0x66a7('0x18')](_0x226d0b)['json'](_0x46df8c);}};}function respondWithFilteredResult(_0x4cbb5f,_0x292280){return function(_0x25869b){if(_0x25869b){var _0x27b0fc=_0x25869b[_0x66a7('0x19')],_0x3a4598=_0x292280[_0x66a7('0x1a')],_0x3d8e75=_0x292280['offset']+_0x292280[_0x66a7('0x1b')],_0x4f420d;if(_0x3d8e75>=_0x27b0fc){_0x3d8e75=_0x27b0fc;_0x4f420d=0xc8;}else{_0x4f420d=0xce;}_0x4cbb5f[_0x66a7('0x18')](_0x4f420d);return _0x4cbb5f[_0x66a7('0x1c')](_0x66a7('0x1d'),_0x3a4598+'-'+_0x3d8e75+'/'+_0x27b0fc)[_0x66a7('0x1e')](_0x25869b);}return null;};}function patchUpdates(_0x394c12){return function(_0x23dd9b){try{jsonpatch['apply'](_0x23dd9b,_0x394c12,!![]);}catch(_0x5e0cb8){return BPromise[_0x66a7('0x1f')](_0x5e0cb8);}return _0x23dd9b[_0x66a7('0x20')]();};}function saveUpdates(_0x419de1,_0x5d8dc0){return function(_0x10530d){if(_0x10530d){return _0x10530d[_0x66a7('0x21')](_0x419de1)[_0x66a7('0x22')](function(_0x853e13){return _0x853e13;});}return null;};}function removeEntity(_0x48defc,_0x5c7c4f){return function(_0x5d0ec9){if(_0x5d0ec9){return _0x5d0ec9['destroy']()[_0x66a7('0x22')](function(){var _0x3744b2=_0x5d0ec9[_0x66a7('0x23')]({'plain':!![]});var _0x3d8f63=_0x66a7('0x24');return db['UserProfileResource'][_0x66a7('0x25')]({'where':{'type':_0x3d8f63,'resourceId':_0x3744b2['id']}})[_0x66a7('0x22')](function(){return _0x5d0ec9;});})[_0x66a7('0x22')](function(){_0x48defc[_0x66a7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x206b08,_0x407ee6){return function(_0x5c76f9){if(!_0x5c76f9){_0x206b08['sendStatus'](0x194);}return _0x5c76f9;};}function handleError(_0x23efdb,_0x33d9e7){_0x33d9e7=_0x33d9e7||0x1f4;return function(_0x39eebd){logger[_0x66a7('0x26')](_0x39eebd[_0x66a7('0x27')]);if(_0x39eebd[_0x66a7('0x28')]){delete _0x39eebd['name'];}_0x23efdb[_0x66a7('0x18')](_0x33d9e7)[_0x66a7('0x29')](_0x39eebd);};}exports['index']=function(_0x4adb71,_0x2e18ed){var _0x183e49={},_0x4734b1={},_0x2adddf={'count':0x0,'rows':[]};var _0x55b7c4=_[_0x66a7('0x2a')](db['AnalyticExtractedReport'][_0x66a7('0x2b')],function(_0xb717ab){return{'name':_0xb717ab[_0x66a7('0x2c')],'type':_0xb717ab[_0x66a7('0x2d')]['key']};});_0x4734b1['model']=_[_0x66a7('0x2a')](_0x55b7c4,'name');_0x4734b1[_0x66a7('0x2e')]=_['keys'](_0x4adb71[_0x66a7('0x2e')]);_0x4734b1[_0x66a7('0x2f')]=_[_0x66a7('0x30')](_0x4734b1['model'],_0x4734b1[_0x66a7('0x2e')]);_0x183e49[_0x66a7('0x31')]=_[_0x66a7('0x30')](_0x4734b1['model'],qs[_0x66a7('0x32')](_0x4adb71[_0x66a7('0x2e')]['fields']));_0x183e49['attributes']=_0x183e49['attributes'][_0x66a7('0x33')]?_0x183e49[_0x66a7('0x31')]:_0x4734b1[_0x66a7('0x34')];if(!_0x4adb71[_0x66a7('0x2e')][_0x66a7('0x35')](_0x66a7('0x36'))){_0x183e49[_0x66a7('0x1b')]=qs[_0x66a7('0x1b')](_0x4adb71[_0x66a7('0x2e')][_0x66a7('0x1b')]);_0x183e49[_0x66a7('0x1a')]=qs['offset'](_0x4adb71[_0x66a7('0x2e')][_0x66a7('0x1a')]);}_0x183e49['order']=qs[_0x66a7('0x37')](_0x4adb71[_0x66a7('0x2e')]['sort']);_0x183e49[_0x66a7('0x38')]=qs[_0x66a7('0x2f')](_[_0x66a7('0x39')](_0x4adb71['query'],_0x4734b1[_0x66a7('0x2f')]),_0x55b7c4);if(_0x4adb71[_0x66a7('0x2e')]['filter']){_0x183e49[_0x66a7('0x38')]=_[_0x66a7('0x3a')](_0x183e49[_0x66a7('0x38')],{'$or':_[_0x66a7('0x2a')](_0x55b7c4,function(_0x2394c6){if(_0x2394c6['type']!==_0x66a7('0x3b')){var _0x179a6c={};_0x179a6c[_0x2394c6['name']]={'$like':'%'+_0x4adb71[_0x66a7('0x2e')][_0x66a7('0x3c')]+'%'};return _0x179a6c;}})});}_0x183e49=_[_0x66a7('0x3a')]({},_0x183e49,_0x4adb71[_0x66a7('0x3d')]);var _0x366821={'where':_0x183e49[_0x66a7('0x38')]};return db[_0x66a7('0x3e')][_0x66a7('0x19')](_0x366821)[_0x66a7('0x22')](function(_0x421ed2){_0x2adddf['count']=_0x421ed2;if(_0x4adb71[_0x66a7('0x2e')]['includeAll']){_0x183e49[_0x66a7('0x3f')]=[{'all':!![]}];}return db[_0x66a7('0x3e')][_0x66a7('0x40')](_0x183e49);})[_0x66a7('0x22')](function(_0x4f409a){_0x2adddf[_0x66a7('0x41')]=_0x4f409a;return _0x2adddf;})[_0x66a7('0x22')](respondWithFilteredResult(_0x2e18ed,_0x183e49))['catch'](handleError(_0x2e18ed,null));};exports['show']=function(_0x4bef79,_0x7cbc4a){var _0x5e9c95={'raw':!![],'where':{'id':_0x4bef79['params']['id']}},_0xb98568={};_0xb98568[_0x66a7('0x34')]=_[_0x66a7('0x42')](db[_0x66a7('0x3e')][_0x66a7('0x2b')]);_0xb98568[_0x66a7('0x2e')]=_[_0x66a7('0x42')](_0x4bef79[_0x66a7('0x2e')]);_0xb98568[_0x66a7('0x2f')]=_[_0x66a7('0x30')](_0xb98568[_0x66a7('0x34')],_0xb98568[_0x66a7('0x2e')]);_0x5e9c95['attributes']=_[_0x66a7('0x30')](_0xb98568[_0x66a7('0x34')],qs[_0x66a7('0x32')](_0x4bef79[_0x66a7('0x2e')][_0x66a7('0x32')]));_0x5e9c95[_0x66a7('0x31')]=_0x5e9c95[_0x66a7('0x31')][_0x66a7('0x33')]?_0x5e9c95['attributes']:_0xb98568['model'];if(_0x4bef79[_0x66a7('0x2e')][_0x66a7('0x43')]){_0x5e9c95[_0x66a7('0x3f')]=[{'all':!![]}];}_0x5e9c95=_[_0x66a7('0x3a')]({},_0x5e9c95,_0x4bef79[_0x66a7('0x3d')]);return db[_0x66a7('0x3e')]['find'](_0x5e9c95)[_0x66a7('0x22')](handleEntityNotFound(_0x7cbc4a,null))[_0x66a7('0x22')](respondWithResult(_0x7cbc4a,null))[_0x66a7('0x44')](handleError(_0x7cbc4a,null));};exports[_0x66a7('0x45')]=function(_0x4ea9da,_0x790552){return db[_0x66a7('0x3e')][_0x66a7('0x45')](_0x4ea9da[_0x66a7('0x46')],{})[_0x66a7('0x22')](function(_0x393c3a){var _0xcdff0e=_0x4ea9da[_0x66a7('0x47')][_0x66a7('0x23')]({'plain':!![]});if(!_0xcdff0e)throw new Error(_0x66a7('0x48'));if(_0xcdff0e['role']===_0x66a7('0x47')){var _0x270a1f=_0x393c3a[_0x66a7('0x23')]({'plain':!![]});var _0x397f29='ExtractedReports';return db[_0x66a7('0x49')][_0x66a7('0x4a')]({'where':{'name':_0x397f29,'userProfileId':_0xcdff0e[_0x66a7('0x4b')]},'raw':!![]})[_0x66a7('0x22')](function(_0x2b89e1){if(_0x2b89e1&&_0x2b89e1['autoAssociation']===0x0){return db[_0x66a7('0x4c')]['create']({'name':_0x270a1f['name'],'resourceId':_0x270a1f['id'],'type':_0x2b89e1[_0x66a7('0x28')],'sectionId':_0x2b89e1['id']},{})[_0x66a7('0x22')](function(){return _0x393c3a;});}else{return _0x393c3a;}})[_0x66a7('0x44')](function(_0x18f729){logger[_0x66a7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18f729);throw _0x18f729;});}return _0x393c3a;})[_0x66a7('0x22')](respondWithResult(_0x790552,0xc9))['catch'](handleError(_0x790552,null));};exports[_0x66a7('0x21')]=function(_0x14633e,_0x8aa5d0){if(_0x14633e[_0x66a7('0x46')]['id']){delete _0x14633e[_0x66a7('0x46')]['id'];}return db[_0x66a7('0x3e')][_0x66a7('0x4a')]({'where':{'id':_0x14633e['params']['id']}})[_0x66a7('0x22')](handleEntityNotFound(_0x8aa5d0,null))[_0x66a7('0x22')](saveUpdates(_0x14633e[_0x66a7('0x46')],null))[_0x66a7('0x22')](respondWithResult(_0x8aa5d0,null))[_0x66a7('0x44')](handleError(_0x8aa5d0,null));};exports['destroy']=function(_0x2a3623,_0x1218ae){return db[_0x66a7('0x3e')]['find']({'where':{'id':_0x2a3623[_0x66a7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1218ae,null))['then'](removeEntity(_0x1218ae,null))[_0x66a7('0x44')](handleError(_0x1218ae,null));};exports[_0x66a7('0x4e')]=function(_0x290c2b,_0x38b264,_0x4516b5){return db[_0x66a7('0x3e')][_0x66a7('0x4a')]({'where':{'id':_0x290c2b[_0x66a7('0x4d')]['id']},'attributes':[_0x66a7('0x28'),_0x66a7('0x4f'),_0x66a7('0x50'),'output'],'raw':!![]})[_0x66a7('0x22')](handleEntityNotFound(_0x38b264,null))[_0x66a7('0x22')](function(_0x19bca3){if(_0x19bca3){if(!fs[_0x66a7('0x51')](path[_0x66a7('0x52')](config['root'],_0x66a7('0x53'),_0x19bca3[_0x66a7('0x50')]))){throw new db[(_0x66a7('0x54'))][(_0x66a7('0x55'))](_0x66a7('0x56'));}if(_0x290c2b[_0x66a7('0x2e')][_0x66a7('0x57')]){return _0x38b264['sendStatus'](0xc8);}return _0x38b264[_0x66a7('0x4e')](path[_0x66a7('0x52')](config[_0x66a7('0x58')],_0x66a7('0x53'),_0x19bca3[_0x66a7('0x50')]),util[_0x66a7('0x59')](_0x66a7('0x5a'),_0x19bca3[_0x66a7('0x4f')]||_0x19bca3[_0x66a7('0x28')],_0x19bca3[_0x66a7('0x5b')]['toLowerCase']()));}})[_0x66a7('0x44')](handleError(_0x38b264,null));}; \ No newline at end of file +var _0x6e78=['count','offset','limit','set','save','update','destroy','get','ExtractedReports','UserProfileResource','then','end','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x6e78,0x1b0));var _0x86e7=function(_0x33ec75,_0x56dbb7){_0x33ec75=_0x33ec75-0x0;var _0x377c09=_0x6e78[_0x33ec75];return _0x377c09;};'use strict';var pdf=require(_0x86e7('0x0'));var emlformat=require(_0x86e7('0x1'));var rimraf=require(_0x86e7('0x2'));var zipdir=require(_0x86e7('0x3'));var jsonpatch=require(_0x86e7('0x4'));var rp=require(_0x86e7('0x5'));var moment=require('moment');var BPromise=require(_0x86e7('0x6'));var Mustache=require(_0x86e7('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x86e7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x86e7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86e7('0xa'));var deskjs=require(_0x86e7('0xb'));var toCsv=require(_0x86e7('0x8'));var querystring=require(_0x86e7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86e7('0xd'));var qs=require(_0x86e7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86e7('0xf'));var logger=require(_0x86e7('0x10'))('api');var utils=require(_0x86e7('0x11'));var config=require(_0x86e7('0x12'));var db=require(_0x86e7('0x13'))['db'];function respondWithStatusCode(_0x2c9ee8,_0xff2459){_0xff2459=_0xff2459||0xcc;return function(_0x1ee8fe){if(_0x1ee8fe){return _0x2c9ee8[_0x86e7('0x14')](_0xff2459);}return _0x2c9ee8[_0x86e7('0x15')](_0xff2459)['end']();};}function respondWithResult(_0x17d48c,_0x518ce2){_0x518ce2=_0x518ce2||0xc8;return function(_0x1a0cb6){if(_0x1a0cb6){return _0x17d48c[_0x86e7('0x15')](_0x518ce2)[_0x86e7('0x16')](_0x1a0cb6);}};}function respondWithFilteredResult(_0x4a5fcd,_0x1d2d80){return function(_0x770713){if(_0x770713){var _0x4fd9c7=_0x770713[_0x86e7('0x17')],_0x4a2173=_0x1d2d80['offset'],_0x593ff7=_0x1d2d80[_0x86e7('0x18')]+_0x1d2d80[_0x86e7('0x19')],_0x43984b;if(_0x593ff7>=_0x4fd9c7){_0x593ff7=_0x4fd9c7;_0x43984b=0xc8;}else{_0x43984b=0xce;}_0x4a5fcd['status'](_0x43984b);return _0x4a5fcd[_0x86e7('0x1a')]('Content-Range',_0x4a2173+'-'+_0x593ff7+'/'+_0x4fd9c7)[_0x86e7('0x16')](_0x770713);}return null;};}function patchUpdates(_0x52a118){return function(_0x7faa60){try{jsonpatch['apply'](_0x7faa60,_0x52a118,!![]);}catch(_0x4baccf){return BPromise['reject'](_0x4baccf);}return _0x7faa60[_0x86e7('0x1b')]();};}function saveUpdates(_0x464a8d,_0x194a68){return function(_0x4522f9){if(_0x4522f9){return _0x4522f9[_0x86e7('0x1c')](_0x464a8d)['then'](function(_0x5bab15){return _0x5bab15;});}return null;};}function removeEntity(_0x10fff4,_0x575362){return function(_0x20d530){if(_0x20d530){return _0x20d530[_0x86e7('0x1d')]()['then'](function(){var _0x3ce353=_0x20d530[_0x86e7('0x1e')]({'plain':!![]});var _0x5f2468=_0x86e7('0x1f');return db[_0x86e7('0x20')][_0x86e7('0x1d')]({'where':{'type':_0x5f2468,'resourceId':_0x3ce353['id']}})[_0x86e7('0x21')](function(){return _0x20d530;});})[_0x86e7('0x21')](function(){_0x10fff4[_0x86e7('0x15')](0xcc)[_0x86e7('0x22')]();});}};}function handleEntityNotFound(_0x1e3301,_0x293527){return function(_0x15e779){if(!_0x15e779){_0x1e3301['sendStatus'](0x194);}return _0x15e779;};}function handleError(_0x10f6de,_0x41f289){_0x41f289=_0x41f289||0x1f4;return function(_0x4224ec){logger[_0x86e7('0x23')](_0x4224ec[_0x86e7('0x24')]);if(_0x4224ec['name']){delete _0x4224ec[_0x86e7('0x25')];}_0x10f6de[_0x86e7('0x15')](_0x41f289)['send'](_0x4224ec);};}exports[_0x86e7('0x26')]=function(_0x505e35,_0x1b4381){var _0x1f162a={},_0x5cfbb={},_0x516d38={'count':0x0,'rows':[]};var _0x3321ef=_[_0x86e7('0x27')](db[_0x86e7('0x28')][_0x86e7('0x29')],function(_0x2b9c30){return{'name':_0x2b9c30[_0x86e7('0x2a')],'type':_0x2b9c30[_0x86e7('0x2b')][_0x86e7('0x2c')]};});_0x5cfbb[_0x86e7('0x2d')]=_[_0x86e7('0x27')](_0x3321ef,_0x86e7('0x25'));_0x5cfbb[_0x86e7('0x2e')]=_['keys'](_0x505e35[_0x86e7('0x2e')]);_0x5cfbb[_0x86e7('0x2f')]=_['intersection'](_0x5cfbb[_0x86e7('0x2d')],_0x5cfbb['query']);_0x1f162a[_0x86e7('0x30')]=_[_0x86e7('0x31')](_0x5cfbb[_0x86e7('0x2d')],qs[_0x86e7('0x32')](_0x505e35[_0x86e7('0x2e')]['fields']));_0x1f162a[_0x86e7('0x30')]=_0x1f162a[_0x86e7('0x30')]['length']?_0x1f162a[_0x86e7('0x30')]:_0x5cfbb[_0x86e7('0x2d')];if(!_0x505e35[_0x86e7('0x2e')][_0x86e7('0x33')](_0x86e7('0x34'))){_0x1f162a[_0x86e7('0x19')]=qs[_0x86e7('0x19')](_0x505e35['query'][_0x86e7('0x19')]);_0x1f162a[_0x86e7('0x18')]=qs['offset'](_0x505e35[_0x86e7('0x2e')][_0x86e7('0x18')]);}_0x1f162a['order']=qs['sort'](_0x505e35[_0x86e7('0x2e')][_0x86e7('0x35')]);_0x1f162a[_0x86e7('0x36')]=qs[_0x86e7('0x2f')](_[_0x86e7('0x37')](_0x505e35[_0x86e7('0x2e')],_0x5cfbb[_0x86e7('0x2f')]),_0x3321ef);if(_0x505e35[_0x86e7('0x2e')][_0x86e7('0x38')]){_0x1f162a['where']=_[_0x86e7('0x39')](_0x1f162a['where'],{'$or':_[_0x86e7('0x27')](_0x3321ef,function(_0x21241f){if(_0x21241f[_0x86e7('0x2b')]!==_0x86e7('0x3a')){var _0x43cbda={};_0x43cbda[_0x21241f['name']]={'$like':'%'+_0x505e35['query'][_0x86e7('0x38')]+'%'};return _0x43cbda;}})});}_0x1f162a=_[_0x86e7('0x39')]({},_0x1f162a,_0x505e35[_0x86e7('0x3b')]);var _0x3e78e1={'where':_0x1f162a[_0x86e7('0x36')]};return db[_0x86e7('0x28')][_0x86e7('0x17')](_0x3e78e1)[_0x86e7('0x21')](function(_0x1f62f8){_0x516d38['count']=_0x1f62f8;if(_0x505e35['query'][_0x86e7('0x3c')]){_0x1f162a[_0x86e7('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x86e7('0x3e')](_0x1f162a);})[_0x86e7('0x21')](function(_0x580b53){_0x516d38[_0x86e7('0x3f')]=_0x580b53;return _0x516d38;})['then'](respondWithFilteredResult(_0x1b4381,_0x1f162a))[_0x86e7('0x40')](handleError(_0x1b4381,null));};exports[_0x86e7('0x41')]=function(_0xa93ab9,_0x14c8c5){var _0x3cf7bd={'raw':!![],'where':{'id':_0xa93ab9['params']['id']}},_0x375a1b={};_0x375a1b['model']=_['keys'](db[_0x86e7('0x28')]['rawAttributes']);_0x375a1b[_0x86e7('0x2e')]=_[_0x86e7('0x42')](_0xa93ab9['query']);_0x375a1b[_0x86e7('0x2f')]=_[_0x86e7('0x31')](_0x375a1b[_0x86e7('0x2d')],_0x375a1b[_0x86e7('0x2e')]);_0x3cf7bd[_0x86e7('0x30')]=_['intersection'](_0x375a1b['model'],qs['fields'](_0xa93ab9['query'][_0x86e7('0x32')]));_0x3cf7bd['attributes']=_0x3cf7bd[_0x86e7('0x30')][_0x86e7('0x43')]?_0x3cf7bd[_0x86e7('0x30')]:_0x375a1b[_0x86e7('0x2d')];if(_0xa93ab9['query'][_0x86e7('0x3c')]){_0x3cf7bd[_0x86e7('0x3d')]=[{'all':!![]}];}_0x3cf7bd=_['merge']({},_0x3cf7bd,_0xa93ab9[_0x86e7('0x3b')]);return db['AnalyticExtractedReport'][_0x86e7('0x44')](_0x3cf7bd)[_0x86e7('0x21')](handleEntityNotFound(_0x14c8c5,null))[_0x86e7('0x21')](respondWithResult(_0x14c8c5,null))[_0x86e7('0x40')](handleError(_0x14c8c5,null));};exports['create']=function(_0x9a2711,_0x573759){return db[_0x86e7('0x28')][_0x86e7('0x45')](_0x9a2711['body'],{})[_0x86e7('0x21')](function(_0x1db3e5){var _0x35b5c4=_0x9a2711[_0x86e7('0x46')]['get']({'plain':!![]});if(!_0x35b5c4)throw new Error(_0x86e7('0x47'));if(_0x35b5c4[_0x86e7('0x48')]==='user'){var _0x4665f6=_0x1db3e5['get']({'plain':!![]});var _0x28e3c4=_0x86e7('0x1f');return db['UserProfileSection'][_0x86e7('0x44')]({'where':{'name':_0x28e3c4,'userProfileId':_0x35b5c4['userProfileId']},'raw':!![]})[_0x86e7('0x21')](function(_0x47b356){if(_0x47b356&&_0x47b356[_0x86e7('0x49')]===0x0){return db[_0x86e7('0x20')][_0x86e7('0x45')]({'name':_0x4665f6[_0x86e7('0x25')],'resourceId':_0x4665f6['id'],'type':_0x47b356[_0x86e7('0x25')],'sectionId':_0x47b356['id']},{})[_0x86e7('0x21')](function(){return _0x1db3e5;});}else{return _0x1db3e5;}})['catch'](function(_0x1ff2fc){logger[_0x86e7('0x23')](_0x86e7('0x4a'),_0x1ff2fc);throw _0x1ff2fc;});}return _0x1db3e5;})['then'](respondWithResult(_0x573759,0xc9))[_0x86e7('0x40')](handleError(_0x573759,null));};exports[_0x86e7('0x1c')]=function(_0x8512ca,_0x51c2a3){if(_0x8512ca[_0x86e7('0x4b')]['id']){delete _0x8512ca[_0x86e7('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x86e7('0x44')]({'where':{'id':_0x8512ca['params']['id']}})[_0x86e7('0x21')](handleEntityNotFound(_0x51c2a3,null))[_0x86e7('0x21')](saveUpdates(_0x8512ca[_0x86e7('0x4b')],null))[_0x86e7('0x21')](respondWithResult(_0x51c2a3,null))['catch'](handleError(_0x51c2a3,null));};exports[_0x86e7('0x1d')]=function(_0x487d5b,_0xf6ee04){return db[_0x86e7('0x28')][_0x86e7('0x44')]({'where':{'id':_0x487d5b[_0x86e7('0x4c')]['id']}})[_0x86e7('0x21')](handleEntityNotFound(_0xf6ee04,null))['then'](removeEntity(_0xf6ee04,null))[_0x86e7('0x40')](handleError(_0xf6ee04,null));};exports[_0x86e7('0x4d')]=function(_0xd5f61b,_0x5d57d4,_0x13a91d){return db[_0x86e7('0x28')][_0x86e7('0x44')]({'where':{'id':_0xd5f61b['params']['id']},'attributes':[_0x86e7('0x25'),'basename',_0x86e7('0x4e'),_0x86e7('0x4f')],'raw':!![]})[_0x86e7('0x21')](handleEntityNotFound(_0x5d57d4,null))[_0x86e7('0x21')](function(_0x330a67){if(_0x330a67){if(!fs[_0x86e7('0x50')](path[_0x86e7('0x51')](config[_0x86e7('0x52')],_0x86e7('0x53'),_0x330a67[_0x86e7('0x4e')]))){throw new db[(_0x86e7('0x54'))][(_0x86e7('0x55'))](_0x86e7('0x56'));}if(_0xd5f61b[_0x86e7('0x2e')][_0x86e7('0x57')]){return _0x5d57d4[_0x86e7('0x14')](0xc8);}return _0x5d57d4['download'](path[_0x86e7('0x51')](config['root'],'server/files/reports',_0x330a67['savename']),util['format'](_0x86e7('0x58'),_0x330a67[_0x86e7('0x59')]||_0x330a67[_0x86e7('0x25')],_0x330a67[_0x86e7('0x4f')][_0x86e7('0x5a')]()));}})['catch'](handleError(_0x5d57d4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index fc4fb4f..638063e 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 _0x6439=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x40c0ba,_0x5ad7c6){var _0x1cd9e5=function(_0x41b0d0){while(--_0x41b0d0){_0x40c0ba['push'](_0x40c0ba['shift']());}};_0x1cd9e5(++_0x5ad7c6);}(_0x6439,0xf7));var _0x9643=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x6439[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x9643('0x0'));var util=require(_0x9643('0x1'));var logger=require(_0x9643('0x2'))(_0x9643('0x3'));var moment=require('moment');var BPromise=require(_0x9643('0x4'));var rp=require(_0x9643('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9643('0x6'));var config=require(_0x9643('0x7'));var attributes=require(_0x9643('0x8'));module[_0x9643('0x9')]=function(_0x5bc6b5,_0x42f309){return _0x5bc6b5['define'](_0x9643('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c91=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x891c55,_0x233fe8){var _0x260823=function(_0x1e3f67){while(--_0x1e3f67){_0x891c55['push'](_0x891c55['shift']());}};_0x260823(++_0x233fe8);}(_0x6c91,0x85));var _0x16c9=function(_0x3bc4fa,_0x5a857a){_0x3bc4fa=_0x3bc4fa-0x0;var _0x52563e=_0x6c91[_0x3bc4fa];return _0x52563e;};'use strict';var _=require(_0x16c9('0x0'));var util=require(_0x16c9('0x1'));var logger=require(_0x16c9('0x2'))(_0x16c9('0x3'));var moment=require(_0x16c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x16c9('0x5'));var fs=require('fs');var path=require(_0x16c9('0x6'));var rimraf=require(_0x16c9('0x7'));var config=require(_0x16c9('0x8'));var attributes=require(_0x16c9('0x9'));module['exports']=function(_0x53391b,_0x47bdb6){return _0x53391b[_0x16c9('0xa')](_0x16c9('0xb'),attributes,{'tableName':_0x16c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 220b662..893a20d 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 _0x9ca1=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x130a81,_0x358b64){var _0x2fab8b=function(_0x115ecc){while(--_0x115ecc){_0x130a81['push'](_0x130a81['shift']());}};_0x2fab8b(++_0x358b64);}(_0x9ca1,0x126));var _0x19ca=function(_0x411143,_0x49ca22){_0x411143=_0x411143-0x0;var _0x2569ee=_0x9ca1[_0x411143];return _0x2569ee;};'use strict';var _=require('lodash');var util=require(_0x19ca('0x0'));var moment=require('moment');var BPromise=require(_0x19ca('0x1'));var rs=require(_0x19ca('0x2'));var fs=require('fs');var Redis=require(_0x19ca('0x3'));var db=require(_0x19ca('0x4'))['db'];var utils=require(_0x19ca('0x5'));var logger=require(_0x19ca('0x6'))(_0x19ca('0x7'));var config=require(_0x19ca('0x8'));var jayson=require(_0x19ca('0x9'));var client=jayson['client'][_0x19ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4120c2,_0x23bcd7,_0x21724d){return new BPromise(function(_0x140f3b,_0x11661c){return client[_0x19ca('0xb')](_0x4120c2,_0x21724d)[_0x19ca('0xc')](function(_0x53f005){logger[_0x19ca('0xd')](_0x19ca('0xe'),_0x23bcd7,'request\x20sent');logger['debug'](_0x19ca('0xf'),_0x23bcd7,_0x19ca('0x10'),JSON[_0x19ca('0x11')](_0x53f005));if(_0x53f005[_0x19ca('0x12')]){if(_0x53f005[_0x19ca('0x12')]['code']===0x1f4){logger[_0x19ca('0x12')](_0x19ca('0xe'),_0x23bcd7,_0x53f005[_0x19ca('0x12')][_0x19ca('0x13')]);return _0x11661c(_0x53f005['error'][_0x19ca('0x13')]);}logger[_0x19ca('0x12')](_0x19ca('0xe'),_0x23bcd7,_0x53f005['error'][_0x19ca('0x13')]);return _0x140f3b(_0x53f005['error'][_0x19ca('0x13')]);}else{logger[_0x19ca('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x23bcd7,_0x19ca('0x10'));_0x140f3b(_0x53f005[_0x19ca('0x14')][_0x19ca('0x13')]);}})['catch'](function(_0x336053){logger['error'](_0x19ca('0xe'),_0x23bcd7,_0x336053);_0x11661c(_0x336053);});});} \ No newline at end of file +var _0x1084=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1abfac,_0x45ae54){var _0x2f97e6=function(_0xa0fce4){while(--_0xa0fce4){_0x1abfac['push'](_0x1abfac['shift']());}};_0x2f97e6(++_0x45ae54);}(_0x1084,0x123));var _0x4108=function(_0xebe732,_0x3b8733){_0xebe732=_0xebe732-0x0;var _0x3466e5=_0x1084[_0xebe732];return _0x3466e5;};'use strict';var _=require(_0x4108('0x0'));var util=require(_0x4108('0x1'));var moment=require(_0x4108('0x2'));var BPromise=require(_0x4108('0x3'));var rs=require(_0x4108('0x4'));var fs=require('fs');var Redis=require(_0x4108('0x5'));var db=require(_0x4108('0x6'))['db'];var utils=require(_0x4108('0x7'));var logger=require(_0x4108('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4108('0x9'));var client=jayson[_0x4108('0xa')][_0x4108('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x354dc4,_0xa218a5,_0x20d99c){return new BPromise(function(_0x13d84d,_0xd925fc){return client[_0x4108('0xc')](_0x354dc4,_0x20d99c)[_0x4108('0xd')](function(_0xc58af7){logger[_0x4108('0xe')](_0x4108('0xf'),_0xa218a5,'request\x20sent');logger[_0x4108('0x10')](_0x4108('0x11'),_0xa218a5,_0x4108('0x12'),JSON[_0x4108('0x13')](_0xc58af7));if(_0xc58af7[_0x4108('0x14')]){if(_0xc58af7[_0x4108('0x14')][_0x4108('0x15')]===0x1f4){logger[_0x4108('0x14')](_0x4108('0xf'),_0xa218a5,_0xc58af7[_0x4108('0x14')]['message']);return _0xd925fc(_0xc58af7[_0x4108('0x14')][_0x4108('0x16')]);}logger['error'](_0x4108('0xf'),_0xa218a5,_0xc58af7[_0x4108('0x14')][_0x4108('0x16')]);return _0x13d84d(_0xc58af7['error'][_0x4108('0x16')]);}else{logger[_0x4108('0xe')](_0x4108('0xf'),_0xa218a5,'request\x20sent');_0x13d84d(_0xc58af7['result'][_0x4108('0x16')]);}})[_0x4108('0x17')](function(_0x354776){logger[_0x4108('0x14')](_0x4108('0xf'),_0xa218a5,_0x354776);_0xd925fc(_0x354776);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a565e2e..c205447 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 _0xca79=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','update','delete','destroy'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0xca79,0x1a9));var _0x9ca7=function(_0x277335,_0x43a43e){_0x277335=_0x277335-0x0;var _0x347176=_0xca79[_0x277335];return _0x347176;};'use strict';var multer=require('multer');var util=require(_0x9ca7('0x0'));var path=require(_0x9ca7('0x1'));var timeout=require(_0x9ca7('0x2'));var express=require(_0x9ca7('0x3'));var router=express['Router']();var auth=require(_0x9ca7('0x4'));var interaction=require(_0x9ca7('0x5'));var config=require('../../config/environment');var controller=require(_0x9ca7('0x6'));router[_0x9ca7('0x7')]('/',auth[_0x9ca7('0x8')](),controller[_0x9ca7('0x9')]);router[_0x9ca7('0x7')](_0x9ca7('0xa'),auth[_0x9ca7('0x8')](),controller['show']);router['get'](_0x9ca7('0xb'),auth[_0x9ca7('0x8')](),controller[_0x9ca7('0xc')]);router[_0x9ca7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9ca7('0xa'),auth['isAuthenticated'](),controller[_0x9ca7('0xe')]);router[_0x9ca7('0xf')]('/:id',auth[_0x9ca7('0x8')](),controller[_0x9ca7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4559=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/download','download','post','put','delete','exports','util'];(function(_0x2f623a,_0x3dfe15){var _0x46bd3b=function(_0x276963){while(--_0x276963){_0x2f623a['push'](_0x2f623a['shift']());}};_0x46bd3b(++_0x3dfe15);}(_0x4559,0x18f));var _0x9455=function(_0x5ad0d0,_0x3e145f){_0x5ad0d0=_0x5ad0d0-0x0;var _0x38fc1d=_0x4559[_0x5ad0d0];return _0x38fc1d;};'use strict';var multer=require('multer');var util=require(_0x9455('0x0'));var path=require('path');var timeout=require(_0x9455('0x1'));var express=require(_0x9455('0x2'));var router=express[_0x9455('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9455('0x4'));var config=require(_0x9455('0x5'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x9455('0x6')](),controller[_0x9455('0x7')]);router[_0x9455('0x8')](_0x9455('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9455('0x8')](_0x9455('0xa'),auth[_0x9455('0x6')](),controller[_0x9455('0xb')]);router[_0x9455('0xc')]('/',auth[_0x9455('0x6')](),controller['create']);router[_0x9455('0xd')](_0x9455('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9455('0xe')](_0x9455('0x9'),auth[_0x9455('0x6')](),controller['destroy']);module[_0x9455('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 72789a2..501b77b 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x385154,_0x70ebfc){var _0x26a8f8=function(_0x2633fd){while(--_0x2633fd){_0x385154['push'](_0x385154['shift']());}};_0x26a8f8(++_0x70ebfc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3e8e7b,_0x2f18f1){var _0x53133c=function(_0xc5025c){while(--_0xc5025c){_0x3e8e7b['push'](_0x3e8e7b['shift']());}};_0x53133c(++_0x2f18f1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x5fc3[_0x5447aa];return _0xb21e53;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6b22dc7..9777411 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 _0x075b=['ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../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','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x075b,0x142));var _0xb075=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x075b[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb075('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb075('0x1'));var jsonpatch=require(_0xb075('0x2'));var rp=require(_0xb075('0x3'));var moment=require(_0xb075('0x4'));var BPromise=require(_0xb075('0x5'));var Mustache=require(_0xb075('0x6'));var util=require('util');var path=require(_0xb075('0x7'));var sox=require(_0xb075('0x8'));var csv=require(_0xb075('0x9'));var ejs=require(_0xb075('0xa'));var fs=require('fs');var _=require(_0xb075('0xb'));var squel=require(_0xb075('0xc'));var crypto=require(_0xb075('0xd'));var jsforce=require(_0xb075('0xe'));var deskjs=require(_0xb075('0xf'));var toCsv=require(_0xb075('0x9'));var querystring=require('querystring');var Papa=require(_0xb075('0x10'));var Redis=require('ioredis');var authService=require(_0xb075('0x11'));var qs=require(_0xb075('0x12'));var as=require(_0xb075('0x13'));var hardwareService=require(_0xb075('0x14'));var logger=require('../../config/logger')(_0xb075('0x15'));var utils=require(_0xb075('0x16'));var config=require('../../config/environment');var db=require(_0xb075('0x17'))['db'];function respondWithStatusCode(_0x5b8e3e,_0x4124fa){_0x4124fa=_0x4124fa||0xcc;return function(_0x457b14){if(_0x457b14){return _0x5b8e3e[_0xb075('0x18')](_0x4124fa);}return _0x5b8e3e[_0xb075('0x19')](_0x4124fa)[_0xb075('0x1a')]();};}function respondWithResult(_0x6bd1a1,_0x312bab){_0x312bab=_0x312bab||0xc8;return function(_0x89e09e){if(_0x89e09e){return _0x6bd1a1[_0xb075('0x19')](_0x312bab)[_0xb075('0x1b')](_0x89e09e);}};}function respondWithFilteredResult(_0x283ef9,_0x4e9d3b){return function(_0x4e8170){if(_0x4e8170){var _0x46a895=_0x4e8170[_0xb075('0x1c')],_0x1a6f00=_0x4e9d3b[_0xb075('0x1d')],_0x5f78c3=_0x4e9d3b['offset']+_0x4e9d3b[_0xb075('0x1e')],_0x67b92f;if(_0x5f78c3>=_0x46a895){_0x5f78c3=_0x46a895;_0x67b92f=0xc8;}else{_0x67b92f=0xce;}_0x283ef9['status'](_0x67b92f);return _0x283ef9[_0xb075('0x1f')](_0xb075('0x20'),_0x1a6f00+'-'+_0x5f78c3+'/'+_0x46a895)[_0xb075('0x1b')](_0x4e8170);}return null;};}function patchUpdates(_0x280d3b){return function(_0x161b52){try{jsonpatch[_0xb075('0x21')](_0x161b52,_0x280d3b,!![]);}catch(_0x27b88a){return BPromise['reject'](_0x27b88a);}return _0x161b52[_0xb075('0x22')]();};}function saveUpdates(_0x2267ab,_0x2c3dd4){return function(_0x3a2a4b){if(_0x3a2a4b){return _0x3a2a4b['update'](_0x2267ab)[_0xb075('0x23')](function(_0x38fc2a){return _0x38fc2a;});}return null;};}function removeEntity(_0x119d7a,_0x5c2ed8){return function(_0x11fa11){if(_0x11fa11){return _0x11fa11[_0xb075('0x24')]()[_0xb075('0x23')](function(){_0x119d7a[_0xb075('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a4d4,_0x4aebc3){return function(_0x591262){if(!_0x591262){_0x35a4d4[_0xb075('0x18')](0x194);}return _0x591262;};}function handleError(_0x2f530d,_0x3b8760){_0x3b8760=_0x3b8760||0x1f4;return function(_0x3113f3){logger[_0xb075('0x25')](_0x3113f3[_0xb075('0x26')]);if(_0x3113f3[_0xb075('0x27')]){delete _0x3113f3['name'];}_0x2f530d[_0xb075('0x19')](_0x3b8760)[_0xb075('0x28')](_0x3113f3);};}exports[_0xb075('0x29')]=function(_0x329260,_0x258d4d){var _0x25ba01={},_0x18ede2={},_0x3bc4d5={'count':0x0,'rows':[]};var _0x1d3503=_[_0xb075('0x2a')](db['AnalyticFieldReport'][_0xb075('0x2b')],function(_0x5d5e58){return{'name':_0x5d5e58[_0xb075('0x2c')],'type':_0x5d5e58[_0xb075('0x2d')][_0xb075('0x2e')]};});_0x18ede2[_0xb075('0x2f')]=_[_0xb075('0x2a')](_0x1d3503,_0xb075('0x27'));_0x18ede2[_0xb075('0x30')]=_[_0xb075('0x31')](_0x329260[_0xb075('0x30')]);_0x18ede2[_0xb075('0x32')]=_['intersection'](_0x18ede2[_0xb075('0x2f')],_0x18ede2['query']);_0x25ba01[_0xb075('0x33')]=_[_0xb075('0x34')](_0x18ede2[_0xb075('0x2f')],qs[_0xb075('0x35')](_0x329260[_0xb075('0x30')][_0xb075('0x35')]));_0x25ba01[_0xb075('0x33')]=_0x25ba01[_0xb075('0x33')][_0xb075('0x36')]?_0x25ba01[_0xb075('0x33')]:_0x18ede2[_0xb075('0x2f')];if(!_0x329260[_0xb075('0x30')][_0xb075('0x37')](_0xb075('0x38'))){_0x25ba01[_0xb075('0x1e')]=qs[_0xb075('0x1e')](_0x329260[_0xb075('0x30')]['limit']);_0x25ba01[_0xb075('0x1d')]=qs[_0xb075('0x1d')](_0x329260[_0xb075('0x30')]['offset']);}_0x25ba01[_0xb075('0x39')]=qs[_0xb075('0x3a')](_0x329260[_0xb075('0x30')][_0xb075('0x3a')]);_0x25ba01[_0xb075('0x3b')]=qs[_0xb075('0x32')](_[_0xb075('0x3c')](_0x329260[_0xb075('0x30')],_0x18ede2[_0xb075('0x32')]),_0x1d3503);if(_0x329260[_0xb075('0x30')]['filter']){_0x25ba01[_0xb075('0x3b')]=_[_0xb075('0x3d')](_0x25ba01[_0xb075('0x3b')],{'$or':_[_0xb075('0x2a')](_0x1d3503,function(_0x4f2d53){if(_0x4f2d53[_0xb075('0x2d')]!=='VIRTUAL'){var _0x59db1a={};_0x59db1a[_0x4f2d53[_0xb075('0x27')]]={'$like':'%'+_0x329260[_0xb075('0x30')]['filter']+'%'};return _0x59db1a;}})});}_0x25ba01=_[_0xb075('0x3d')]({},_0x25ba01,_0x329260[_0xb075('0x3e')]);var _0x1654d9={'where':_0x25ba01[_0xb075('0x3b')]};return db[_0xb075('0x3f')][_0xb075('0x1c')](_0x1654d9)['then'](function(_0x5f0092){_0x3bc4d5[_0xb075('0x1c')]=_0x5f0092;if(_0x329260['query'][_0xb075('0x40')]){_0x25ba01[_0xb075('0x41')]=[{'all':!![]}];}return db[_0xb075('0x3f')][_0xb075('0x42')](_0x25ba01);})['then'](function(_0x39106c){_0x3bc4d5[_0xb075('0x43')]=_0x39106c;return _0x3bc4d5;})[_0xb075('0x23')](respondWithFilteredResult(_0x258d4d,_0x25ba01))[_0xb075('0x44')](handleError(_0x258d4d,null));};exports[_0xb075('0x45')]=function(_0x3c9b49,_0xfd8321){var _0xa28088={'raw':![],'where':{'id':_0x3c9b49['params']['id']}},_0x586fda={};_0x586fda['model']=_[_0xb075('0x31')](db[_0xb075('0x3f')]['rawAttributes']);_0x586fda[_0xb075('0x30')]=_[_0xb075('0x31')](_0x3c9b49[_0xb075('0x30')]);_0x586fda['filters']=_['intersection'](_0x586fda[_0xb075('0x2f')],_0x586fda[_0xb075('0x30')]);_0xa28088[_0xb075('0x33')]=_['intersection'](_0x586fda['model'],qs[_0xb075('0x35')](_0x3c9b49['query'][_0xb075('0x35')]));_0xa28088[_0xb075('0x33')]=_0xa28088[_0xb075('0x33')][_0xb075('0x36')]?_0xa28088['attributes']:_0x586fda[_0xb075('0x2f')];if(_0x3c9b49[_0xb075('0x30')][_0xb075('0x40')]){_0xa28088[_0xb075('0x41')]=[{'all':!![]}];}_0xa28088=_[_0xb075('0x3d')]({},_0xa28088,_0x3c9b49['options']);return db[_0xb075('0x3f')][_0xb075('0x46')](_0xa28088)[_0xb075('0x23')](handleEntityNotFound(_0xfd8321,null))[_0xb075('0x23')](respondWithResult(_0xfd8321,null))[_0xb075('0x44')](handleError(_0xfd8321,null));};exports[_0xb075('0x47')]=function(_0x584aec,_0x30edaa){return db[_0xb075('0x3f')][_0xb075('0x47')](_0x584aec[_0xb075('0x48')],{})[_0xb075('0x23')](respondWithResult(_0x30edaa,0xc9))[_0xb075('0x44')](handleError(_0x30edaa,null));};exports[_0xb075('0x49')]=function(_0x20f18d,_0xa03b74){return db[_0xb075('0x3f')][_0xb075('0x49')](_0x20f18d['body'],{'raw':![],'individualHooks':!![]})[_0xb075('0x23')](respondWithResult(_0xa03b74,0xc9))['catch'](handleError(_0xa03b74,null));};exports['update']=function(_0x25b84c,_0x3a12d5){if(_0x25b84c[_0xb075('0x48')]['id']){delete _0x25b84c[_0xb075('0x48')]['id'];}return db[_0xb075('0x3f')][_0xb075('0x46')]({'where':{'id':_0x25b84c['params']['id']}})[_0xb075('0x23')](handleEntityNotFound(_0x3a12d5,null))['then'](saveUpdates(_0x25b84c['body'],null))[_0xb075('0x23')](respondWithResult(_0x3a12d5,null))[_0xb075('0x44')](handleError(_0x3a12d5,null));};exports[_0xb075('0x24')]=function(_0x203553,_0x5309e7){return db['AnalyticFieldReport'][_0xb075('0x46')]({'where':{'id':_0x203553[_0xb075('0x4a')]['id']}})[_0xb075('0x23')](handleEntityNotFound(_0x5309e7,null))[_0xb075('0x23')](removeEntity(_0x5309e7,null))[_0xb075('0x44')](handleError(_0x5309e7,null));};exports[_0xb075('0x4b')]=function(_0x302aeb,_0x28d2b0){return db[_0xb075('0x3f')][_0xb075('0x24')]({'where':{'id':_0x302aeb[_0xb075('0x30')][_0xb075('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xb075('0x23')](respondWithResult(_0x28d2b0,0xcc))['catch'](handleError(_0x28d2b0,null));};exports[_0xb075('0x4d')]=function(_0x123c95,_0x27dd6c,_0x12908f){return db[_0xb075('0x4e')][_0xb075('0x4f')]({'where':{'id':_0x123c95[_0xb075('0x4a')]['id']}})[_0xb075('0x23')](handleEntityNotFound(_0x27dd6c,null))[_0xb075('0x23')](function(_0x375700){if(_0x375700){return db[_0xb075('0x50')][_0xb075('0x51')](function(_0x4e013e){return db[_0xb075('0x3f')]['destroy']({'where':{'CustomReportId':_0x123c95[_0xb075('0x4a')]['id']},'transaction':_0x4e013e})[_0xb075('0x23')](function(_0x2d7fa8){var _0x4ee847=_[_0xb075('0x2a')](_0x123c95[_0xb075('0x48')],function(_0x4a5846){delete _0x4a5846['id'];_0x4a5846[_0xb075('0x52')]=_0x123c95['params']['id'];return _0x4a5846;});return db[_0xb075('0x3f')]['bulkCreate'](_0x4ee847,{'transaction':_0x4e013e});});})['then'](function(){return db[_0xb075('0x3f')][_0xb075('0x42')]({'where':{'CustomReportId':_0x123c95[_0xb075('0x4a')]['id']}});});}})['then'](respondWithResult(_0x27dd6c,null))[_0xb075('0x44')](handleError(_0x27dd6c,null));}; \ No newline at end of file +var _0x2236=['body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../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','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','includeAll','findAll','rows','catch','show','params','merge','find','create','bulkCreate'];(function(_0x4e4496,_0x237618){var _0x5d0360=function(_0x3268dc){while(--_0x3268dc){_0x4e4496['push'](_0x4e4496['shift']());}};_0x5d0360(++_0x237618);}(_0x2236,0x1d6));var _0x6223=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x2236[_0x2e8418];return _0x548fe6;};'use strict';var pdf=require(_0x6223('0x0'));var emlformat=require(_0x6223('0x1'));var rimraf=require(_0x6223('0x2'));var zipdir=require(_0x6223('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6223('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6223('0x5'));var path=require(_0x6223('0x6'));var sox=require('sox');var csv=require(_0x6223('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6223('0x8'));var squel=require(_0x6223('0x9'));var crypto=require(_0x6223('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6223('0xb'));var toCsv=require(_0x6223('0x7'));var querystring=require(_0x6223('0xc'));var Papa=require(_0x6223('0xd'));var Redis=require('ioredis');var authService=require(_0x6223('0xe'));var qs=require(_0x6223('0xf'));var as=require(_0x6223('0x10'));var hardwareService=require(_0x6223('0x11'));var logger=require(_0x6223('0x12'))('api');var utils=require(_0x6223('0x13'));var config=require(_0x6223('0x14'));var db=require(_0x6223('0x15'))['db'];function respondWithStatusCode(_0x3542dc,_0xd4591c){_0xd4591c=_0xd4591c||0xcc;return function(_0x48ac76){if(_0x48ac76){return _0x3542dc['sendStatus'](_0xd4591c);}return _0x3542dc[_0x6223('0x16')](_0xd4591c)[_0x6223('0x17')]();};}function respondWithResult(_0x31945,_0x570339){_0x570339=_0x570339||0xc8;return function(_0x4e6e3f){if(_0x4e6e3f){return _0x31945[_0x6223('0x16')](_0x570339)[_0x6223('0x18')](_0x4e6e3f);}};}function respondWithFilteredResult(_0x3bd4d0,_0xf79399){return function(_0x1555a0){if(_0x1555a0){var _0x1663d3=_0x1555a0[_0x6223('0x19')],_0x2849b9=_0xf79399[_0x6223('0x1a')],_0xf0893f=_0xf79399[_0x6223('0x1a')]+_0xf79399[_0x6223('0x1b')],_0x17cdb3;if(_0xf0893f>=_0x1663d3){_0xf0893f=_0x1663d3;_0x17cdb3=0xc8;}else{_0x17cdb3=0xce;}_0x3bd4d0[_0x6223('0x16')](_0x17cdb3);return _0x3bd4d0[_0x6223('0x1c')](_0x6223('0x1d'),_0x2849b9+'-'+_0xf0893f+'/'+_0x1663d3)[_0x6223('0x18')](_0x1555a0);}return null;};}function patchUpdates(_0x52a066){return function(_0x311b5c){try{jsonpatch[_0x6223('0x1e')](_0x311b5c,_0x52a066,!![]);}catch(_0x4efadc){return BPromise[_0x6223('0x1f')](_0x4efadc);}return _0x311b5c[_0x6223('0x20')]();};}function saveUpdates(_0x2e5f1a,_0x304870){return function(_0x5e9f51){if(_0x5e9f51){return _0x5e9f51[_0x6223('0x21')](_0x2e5f1a)[_0x6223('0x22')](function(_0x32fa35){return _0x32fa35;});}return null;};}function removeEntity(_0xfa049,_0x373aa2){return function(_0x1ff7fb){if(_0x1ff7fb){return _0x1ff7fb['destroy']()[_0x6223('0x22')](function(){_0xfa049[_0x6223('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b8011,_0x3856a1){return function(_0x33bc87){if(!_0x33bc87){_0x5b8011['sendStatus'](0x194);}return _0x33bc87;};}function handleError(_0x2a445b,_0x4f56c8){_0x4f56c8=_0x4f56c8||0x1f4;return function(_0x308ae2){logger['error'](_0x308ae2['stack']);if(_0x308ae2['name']){delete _0x308ae2['name'];}_0x2a445b[_0x6223('0x16')](_0x4f56c8)[_0x6223('0x23')](_0x308ae2);};}exports[_0x6223('0x24')]=function(_0x1f1601,_0x3b669a){var _0x404ccd={},_0x4a64a7={},_0x1a3127={'count':0x0,'rows':[]};var _0x1701b=_[_0x6223('0x25')](db[_0x6223('0x26')][_0x6223('0x27')],function(_0x43e9df){return{'name':_0x43e9df[_0x6223('0x28')],'type':_0x43e9df[_0x6223('0x29')][_0x6223('0x2a')]};});_0x4a64a7[_0x6223('0x2b')]=_['map'](_0x1701b,_0x6223('0x2c'));_0x4a64a7[_0x6223('0x2d')]=_[_0x6223('0x2e')](_0x1f1601[_0x6223('0x2d')]);_0x4a64a7[_0x6223('0x2f')]=_[_0x6223('0x30')](_0x4a64a7[_0x6223('0x2b')],_0x4a64a7['query']);_0x404ccd[_0x6223('0x31')]=_[_0x6223('0x30')](_0x4a64a7[_0x6223('0x2b')],qs['fields'](_0x1f1601[_0x6223('0x2d')][_0x6223('0x32')]));_0x404ccd['attributes']=_0x404ccd[_0x6223('0x31')][_0x6223('0x33')]?_0x404ccd['attributes']:_0x4a64a7[_0x6223('0x2b')];if(!_0x1f1601['query']['hasOwnProperty'](_0x6223('0x34'))){_0x404ccd[_0x6223('0x1b')]=qs['limit'](_0x1f1601[_0x6223('0x2d')]['limit']);_0x404ccd[_0x6223('0x1a')]=qs[_0x6223('0x1a')](_0x1f1601[_0x6223('0x2d')][_0x6223('0x1a')]);}_0x404ccd[_0x6223('0x35')]=qs['sort'](_0x1f1601[_0x6223('0x2d')][_0x6223('0x36')]);_0x404ccd[_0x6223('0x37')]=qs[_0x6223('0x2f')](_[_0x6223('0x38')](_0x1f1601[_0x6223('0x2d')],_0x4a64a7[_0x6223('0x2f')]),_0x1701b);if(_0x1f1601['query'][_0x6223('0x39')]){_0x404ccd[_0x6223('0x37')]=_['merge'](_0x404ccd[_0x6223('0x37')],{'$or':_[_0x6223('0x25')](_0x1701b,function(_0x449fcb){if(_0x449fcb[_0x6223('0x29')]!=='VIRTUAL'){var _0x2fc696={};_0x2fc696[_0x449fcb[_0x6223('0x2c')]]={'$like':'%'+_0x1f1601[_0x6223('0x2d')][_0x6223('0x39')]+'%'};return _0x2fc696;}})});}_0x404ccd=_['merge']({},_0x404ccd,_0x1f1601[_0x6223('0x3a')]);var _0x25ab0b={'where':_0x404ccd[_0x6223('0x37')]};return db[_0x6223('0x26')][_0x6223('0x19')](_0x25ab0b)[_0x6223('0x22')](function(_0x3e16c8){_0x1a3127[_0x6223('0x19')]=_0x3e16c8;if(_0x1f1601[_0x6223('0x2d')][_0x6223('0x3b')]){_0x404ccd['include']=[{'all':!![]}];}return db[_0x6223('0x26')][_0x6223('0x3c')](_0x404ccd);})['then'](function(_0x33e6bb){_0x1a3127[_0x6223('0x3d')]=_0x33e6bb;return _0x1a3127;})[_0x6223('0x22')](respondWithFilteredResult(_0x3b669a,_0x404ccd))[_0x6223('0x3e')](handleError(_0x3b669a,null));};exports[_0x6223('0x3f')]=function(_0x529918,_0xd47e28){var _0x2ea68f={'raw':![],'where':{'id':_0x529918[_0x6223('0x40')]['id']}},_0x25775a={};_0x25775a[_0x6223('0x2b')]=_[_0x6223('0x2e')](db[_0x6223('0x26')][_0x6223('0x27')]);_0x25775a[_0x6223('0x2d')]=_['keys'](_0x529918[_0x6223('0x2d')]);_0x25775a[_0x6223('0x2f')]=_[_0x6223('0x30')](_0x25775a[_0x6223('0x2b')],_0x25775a['query']);_0x2ea68f[_0x6223('0x31')]=_[_0x6223('0x30')](_0x25775a[_0x6223('0x2b')],qs[_0x6223('0x32')](_0x529918['query'][_0x6223('0x32')]));_0x2ea68f[_0x6223('0x31')]=_0x2ea68f['attributes'][_0x6223('0x33')]?_0x2ea68f[_0x6223('0x31')]:_0x25775a[_0x6223('0x2b')];if(_0x529918[_0x6223('0x2d')][_0x6223('0x3b')]){_0x2ea68f['include']=[{'all':!![]}];}_0x2ea68f=_[_0x6223('0x41')]({},_0x2ea68f,_0x529918[_0x6223('0x3a')]);return db[_0x6223('0x26')][_0x6223('0x42')](_0x2ea68f)[_0x6223('0x22')](handleEntityNotFound(_0xd47e28,null))[_0x6223('0x22')](respondWithResult(_0xd47e28,null))[_0x6223('0x3e')](handleError(_0xd47e28,null));};exports[_0x6223('0x43')]=function(_0x4d8e25,_0x1b190d){return db['AnalyticFieldReport'][_0x6223('0x43')](_0x4d8e25['body'],{})[_0x6223('0x22')](respondWithResult(_0x1b190d,0xc9))['catch'](handleError(_0x1b190d,null));};exports[_0x6223('0x44')]=function(_0x1abb56,_0x4bab04){return db['AnalyticFieldReport']['bulkCreate'](_0x1abb56[_0x6223('0x45')],{'raw':![],'individualHooks':!![]})[_0x6223('0x22')](respondWithResult(_0x4bab04,0xc9))[_0x6223('0x3e')](handleError(_0x4bab04,null));};exports['update']=function(_0x438b1c,_0x49d584){if(_0x438b1c['body']['id']){delete _0x438b1c[_0x6223('0x45')]['id'];}return db[_0x6223('0x26')]['find']({'where':{'id':_0x438b1c[_0x6223('0x40')]['id']}})[_0x6223('0x22')](handleEntityNotFound(_0x49d584,null))['then'](saveUpdates(_0x438b1c[_0x6223('0x45')],null))[_0x6223('0x22')](respondWithResult(_0x49d584,null))[_0x6223('0x3e')](handleError(_0x49d584,null));};exports[_0x6223('0x46')]=function(_0x2c24aa,_0x21f2ae){return db[_0x6223('0x26')][_0x6223('0x42')]({'where':{'id':_0x2c24aa[_0x6223('0x40')]['id']}})['then'](handleEntityNotFound(_0x21f2ae,null))[_0x6223('0x22')](removeEntity(_0x21f2ae,null))[_0x6223('0x3e')](handleError(_0x21f2ae,null));};exports[_0x6223('0x47')]=function(_0x43e5ba,_0x16525a){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x43e5ba[_0x6223('0x2d')][_0x6223('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x6223('0x22')](respondWithResult(_0x16525a,0xcc))[_0x6223('0x3e')](handleError(_0x16525a,null));};exports[_0x6223('0x49')]=function(_0x4cce54,_0x20a14a,_0x3c6db2){return db[_0x6223('0x4a')]['findOne']({'where':{'id':_0x4cce54[_0x6223('0x40')]['id']}})[_0x6223('0x22')](handleEntityNotFound(_0x20a14a,null))[_0x6223('0x22')](function(_0x3f5945){if(_0x3f5945){return db[_0x6223('0x4b')][_0x6223('0x4c')](function(_0x898f62){return db[_0x6223('0x26')]['destroy']({'where':{'CustomReportId':_0x4cce54[_0x6223('0x40')]['id']},'transaction':_0x898f62})[_0x6223('0x22')](function(_0x4d1267){var _0x58a5bc=_[_0x6223('0x25')](_0x4cce54['body'],function(_0x55215d){delete _0x55215d['id'];_0x55215d['CustomReportId']=_0x4cce54['params']['id'];return _0x55215d;});return db['AnalyticFieldReport']['bulkCreate'](_0x58a5bc,{'transaction':_0x898f62});});})['then'](function(){return db[_0x6223('0x26')][_0x6223('0x3c')]({'where':{'CustomReportId':_0x4cce54[_0x6223('0x40')]['id']}});});}})['then'](respondWithResult(_0x20a14a,null))[_0x6223('0x3e')](handleError(_0x20a14a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 98d133e..4d73ced 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 _0xd279=['../../config/logger','api','moment','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0xd279,0xbf));var _0x9d27=function(_0x1ba83b,_0x56e84a){_0x1ba83b=_0x1ba83b-0x0;var _0x281468=_0xd279[_0x1ba83b];return _0x281468;};'use strict';var _=require(_0x9d27('0x0'));var util=require('util');var logger=require(_0x9d27('0x1'))(_0x9d27('0x2'));var moment=require(_0x9d27('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d27('0x4'));var fs=require('fs');var path=require(_0x9d27('0x5'));var rimraf=require(_0x9d27('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d27('0x7'));module[_0x9d27('0x8')]=function(_0x387757,_0x29e10b){return _0x387757[_0x9d27('0x9')](_0x9d27('0xa'),attributes,{'tableName':_0x9d27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67a5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger'];(function(_0x5c2b50,_0x2584c5){var _0x12a3a0=function(_0x179d38){while(--_0x179d38){_0x5c2b50['push'](_0x5c2b50['shift']());}};_0x12a3a0(++_0x2584c5);}(_0x67a5,0x193));var _0x567a=function(_0x2c7292,_0x15277e){_0x2c7292=_0x2c7292-0x0;var _0x2372cc=_0x67a5[_0x2c7292];return _0x2372cc;};'use strict';var _=require(_0x567a('0x0'));var util=require(_0x567a('0x1'));var logger=require(_0x567a('0x2'))(_0x567a('0x3'));var moment=require(_0x567a('0x4'));var BPromise=require(_0x567a('0x5'));var rp=require(_0x567a('0x6'));var fs=require('fs');var path=require(_0x567a('0x7'));var rimraf=require(_0x567a('0x8'));var config=require(_0x567a('0x9'));var attributes=require(_0x567a('0xa'));module[_0x567a('0xb')]=function(_0x4695c1,_0x268701){return _0x4695c1[_0x567a('0xc')](_0x567a('0xd'),attributes,{'tableName':'analytics_report_fields','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 33f12ea..2db76fc 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 _0xf332=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xf332,0x167));var _0x2f33=function(_0xf9fe9c,_0x16407c){_0xf9fe9c=_0xf9fe9c-0x0;var _0x555cc7=_0xf332[_0xf9fe9c];return _0x555cc7;};'use strict';var _=require(_0x2f33('0x0'));var util=require(_0x2f33('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f33('0x2'));var fs=require('fs');var Redis=require(_0x2f33('0x3'));var db=require(_0x2f33('0x4'))['db'];var utils=require(_0x2f33('0x5'));var logger=require(_0x2f33('0x6'))('rpc');var config=require(_0x2f33('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f33('0x8')][_0x2f33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x418e01,_0x4f1256,_0x27b491){return new BPromise(function(_0x4f6680,_0x5a7ef0){return client[_0x2f33('0xa')](_0x418e01,_0x27b491)['then'](function(_0x1cef76){logger[_0x2f33('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4f1256,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4f1256,'request\x20sent',JSON[_0x2f33('0xc')](_0x1cef76));if(_0x1cef76[_0x2f33('0xd')]){if(_0x1cef76[_0x2f33('0xd')][_0x2f33('0xe')]===0x1f4){logger[_0x2f33('0xd')](_0x2f33('0xf'),_0x4f1256,_0x1cef76[_0x2f33('0xd')][_0x2f33('0x10')]);return _0x5a7ef0(_0x1cef76['error'][_0x2f33('0x10')]);}logger[_0x2f33('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4f1256,_0x1cef76[_0x2f33('0xd')][_0x2f33('0x10')]);return _0x4f6680(_0x1cef76[_0x2f33('0xd')]['message']);}else{logger[_0x2f33('0xb')](_0x2f33('0xf'),_0x4f1256,_0x2f33('0x11'));_0x4f6680(_0x1cef76[_0x2f33('0x12')][_0x2f33('0x10')]);}})[_0x2f33('0x13')](function(_0x16e9d5){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x4f1256,_0x16e9d5);_0x5a7ef0(_0x16e9d5);});});} \ No newline at end of file +var _0x0b62=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x19c0b1,_0x5ef736){var _0x5c9c0f=function(_0x56fe31){while(--_0x56fe31){_0x19c0b1['push'](_0x19c0b1['shift']());}};_0x5c9c0f(++_0x5ef736);}(_0x0b62,0x17f));var _0x20b6=function(_0x502cb6,_0x2eed8e){_0x502cb6=_0x502cb6-0x0;var _0x22e0d9=_0x0b62[_0x502cb6];return _0x22e0d9;};'use strict';var _=require(_0x20b6('0x0'));var util=require('util');var moment=require(_0x20b6('0x1'));var BPromise=require(_0x20b6('0x2'));var rs=require(_0x20b6('0x3'));var fs=require('fs');var Redis=require(_0x20b6('0x4'));var db=require(_0x20b6('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[_0x20b6('0x6')][_0x20b6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x271743,_0x41fe06,_0x5edd13){return new BPromise(function(_0x416777,_0x3ae691){return client[_0x20b6('0x8')](_0x271743,_0x5edd13)[_0x20b6('0x9')](function(_0xea824e){logger[_0x20b6('0xa')](_0x20b6('0xb'),_0x41fe06,_0x20b6('0xc'));logger[_0x20b6('0xd')](_0x20b6('0xe'),_0x41fe06,'request\x20sent',JSON['stringify'](_0xea824e));if(_0xea824e['error']){if(_0xea824e['error']['code']===0x1f4){logger[_0x20b6('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41fe06,_0xea824e['error'][_0x20b6('0x10')]);return _0x3ae691(_0xea824e[_0x20b6('0xf')][_0x20b6('0x10')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x41fe06,_0xea824e[_0x20b6('0xf')][_0x20b6('0x10')]);return _0x416777(_0xea824e[_0x20b6('0xf')]['message']);}else{logger['info'](_0x20b6('0xb'),_0x41fe06,'request\x20sent');_0x416777(_0xea824e[_0x20b6('0x11')]['message']);}})[_0x20b6('0x12')](function(_0x1c927e){logger['error'](_0x20b6('0xb'),_0x41fe06,_0x1c927e);_0x3ae691(_0x1c927e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 95405fa..0d22194 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x24d195,_0x4eab78){var _0x5a847e=function(_0x118238){while(--_0x118238){_0x24d195['push'](_0x24d195['shift']());}};_0x5a847e(++_0x4eab78);}(_0x814b,0x1a2));var _0xb814=function(_0x3559c4,_0x47580b){_0x3559c4=_0x3559c4-0x0;var _0x124053=_0x814b[_0x3559c4];return _0x124053;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 607e2d3..cac0294 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 _0x1a37=['sequelize','exports','STRING','name','TEXT'];(function(_0x4d5ca8,_0x50c558){var _0x43be26=function(_0x2b38e7){while(--_0x2b38e7){_0x4d5ca8['push'](_0x4d5ca8['shift']());}};_0x43be26(++_0x50c558);}(_0x1a37,0x127));var _0x71a3=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x1a37[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![],'unique':_0x71a3('0x3')},'table':{'type':Sequelize[_0x71a3('0x2')]},'metric':{'type':Sequelize[_0x71a3('0x4')]},'description':{'type':Sequelize[_0x71a3('0x2')]}}; \ No newline at end of file +var _0xe126=['sequelize','exports','name','STRING','TEXT'];(function(_0x162b09,_0x432c4e){var _0x5449b0=function(_0x21b609){while(--_0x21b609){_0x162b09['push'](_0x162b09['shift']());}};_0x5449b0(++_0x432c4e);}(_0xe126,0xeb));var _0x6e12=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xe126[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x6e12('0x0'));module[_0x6e12('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6e12('0x2')},'table':{'type':Sequelize[_0x6e12('0x3')]},'metric':{'type':Sequelize[_0x6e12('0x4')]},'description':{'type':Sequelize[_0x6e12('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0746c3a..7485e1e 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 _0x8d05=['bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Metrics','UserProfileResource','then','error','name','send','index','map','AnalyticMetric','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x57edc1,_0x2ae4ff){var _0x354829=function(_0x50f4fc){while(--_0x50f4fc){_0x57edc1['push'](_0x57edc1['shift']());}};_0x354829(++_0x2ae4ff);}(_0x8d05,0xe8));var _0x58d0=function(_0x3816d0,_0xe301c2){_0x3816d0=_0x3816d0-0x0;var _0x433e73=_0x8d05[_0x3816d0];return _0x433e73;};'use strict';var pdf=require(_0x58d0('0x0'));var emlformat=require(_0x58d0('0x1'));var rimraf=require(_0x58d0('0x2'));var zipdir=require(_0x58d0('0x3'));var jsonpatch=require(_0x58d0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58d0('0x5'));var Mustache=require(_0x58d0('0x6'));var util=require(_0x58d0('0x7'));var path=require(_0x58d0('0x8'));var sox=require('sox');var csv=require(_0x58d0('0x9'));var ejs=require(_0x58d0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x58d0('0xb'));var crypto=require('crypto');var jsforce=require(_0x58d0('0xc'));var deskjs=require(_0x58d0('0xd'));var toCsv=require(_0x58d0('0x9'));var querystring=require(_0x58d0('0xe'));var Papa=require(_0x58d0('0xf'));var Redis=require('ioredis');var authService=require(_0x58d0('0x10'));var qs=require(_0x58d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58d0('0x12'));var logger=require(_0x58d0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x58d0('0x14'));var db=require(_0x58d0('0x15'))['db'];function respondWithStatusCode(_0x85352e,_0x1efa0d){_0x1efa0d=_0x1efa0d||0xcc;return function(_0xf90244){if(_0xf90244){return _0x85352e[_0x58d0('0x16')](_0x1efa0d);}return _0x85352e[_0x58d0('0x17')](_0x1efa0d)[_0x58d0('0x18')]();};}function respondWithResult(_0x28adc0,_0x5d10d4){_0x5d10d4=_0x5d10d4||0xc8;return function(_0x15528b){if(_0x15528b){return _0x28adc0[_0x58d0('0x17')](_0x5d10d4)[_0x58d0('0x19')](_0x15528b);}};}function respondWithFilteredResult(_0x20b61b,_0x9f133a){return function(_0x1e92b7){if(_0x1e92b7){var _0x3d560f=_0x1e92b7[_0x58d0('0x1a')],_0x246f48=_0x9f133a[_0x58d0('0x1b')],_0x437721=_0x9f133a[_0x58d0('0x1b')]+_0x9f133a[_0x58d0('0x1c')],_0x49f232;if(_0x437721>=_0x3d560f){_0x437721=_0x3d560f;_0x49f232=0xc8;}else{_0x49f232=0xce;}_0x20b61b[_0x58d0('0x17')](_0x49f232);return _0x20b61b[_0x58d0('0x1d')](_0x58d0('0x1e'),_0x246f48+'-'+_0x437721+'/'+_0x3d560f)[_0x58d0('0x19')](_0x1e92b7);}return null;};}function patchUpdates(_0x1e4ca2){return function(_0x924f94){try{jsonpatch[_0x58d0('0x1f')](_0x924f94,_0x1e4ca2,!![]);}catch(_0x27796a){return BPromise[_0x58d0('0x20')](_0x27796a);}return _0x924f94[_0x58d0('0x21')]();};}function saveUpdates(_0x562a87,_0x3072f9){return function(_0x9ad72a){if(_0x9ad72a){return _0x9ad72a[_0x58d0('0x22')](_0x562a87)['then'](function(_0x1d3cb4){return _0x1d3cb4;});}return null;};}function removeEntity(_0x22a3c1,_0x412583){return function(_0x575b34){if(_0x575b34){return _0x575b34[_0x58d0('0x23')]()['then'](function(){var _0x47bd16=_0x575b34[_0x58d0('0x24')]({'plain':!![]});var _0x161bf5=_0x58d0('0x25');return db[_0x58d0('0x26')]['destroy']({'where':{'type':_0x161bf5,'resourceId':_0x47bd16['id']}})[_0x58d0('0x27')](function(){return _0x575b34;});})[_0x58d0('0x27')](function(){_0x22a3c1[_0x58d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199629,_0x56b487){return function(_0x5e6e63){if(!_0x5e6e63){_0x199629[_0x58d0('0x16')](0x194);}return _0x5e6e63;};}function handleError(_0xa55350,_0x3ce5a2){_0x3ce5a2=_0x3ce5a2||0x1f4;return function(_0x41f180){logger[_0x58d0('0x28')](_0x41f180['stack']);if(_0x41f180['name']){delete _0x41f180[_0x58d0('0x29')];}_0xa55350[_0x58d0('0x17')](_0x3ce5a2)[_0x58d0('0x2a')](_0x41f180);};}exports[_0x58d0('0x2b')]=function(_0x34a676,_0x4bff4f){var _0x3893d3={},_0x4d4cf1={},_0x184423={'count':0x0,'rows':[]};var _0x3691dc=_[_0x58d0('0x2c')](db[_0x58d0('0x2d')]['rawAttributes'],function(_0x1551da){return{'name':_0x1551da[_0x58d0('0x2e')],'type':_0x1551da[_0x58d0('0x2f')]['key']};});_0x4d4cf1[_0x58d0('0x30')]=_[_0x58d0('0x2c')](_0x3691dc,_0x58d0('0x29'));_0x4d4cf1[_0x58d0('0x31')]=_['keys'](_0x34a676[_0x58d0('0x31')]);_0x4d4cf1[_0x58d0('0x32')]=_[_0x58d0('0x33')](_0x4d4cf1[_0x58d0('0x30')],_0x4d4cf1[_0x58d0('0x31')]);_0x3893d3['attributes']=_[_0x58d0('0x33')](_0x4d4cf1[_0x58d0('0x30')],qs[_0x58d0('0x34')](_0x34a676[_0x58d0('0x31')][_0x58d0('0x34')]));_0x3893d3[_0x58d0('0x35')]=_0x3893d3[_0x58d0('0x35')][_0x58d0('0x36')]?_0x3893d3[_0x58d0('0x35')]:_0x4d4cf1[_0x58d0('0x30')];if(!_0x34a676['query'][_0x58d0('0x37')](_0x58d0('0x38'))){_0x3893d3[_0x58d0('0x1c')]=qs[_0x58d0('0x1c')](_0x34a676[_0x58d0('0x31')][_0x58d0('0x1c')]);_0x3893d3[_0x58d0('0x1b')]=qs['offset'](_0x34a676['query'][_0x58d0('0x1b')]);}_0x3893d3[_0x58d0('0x39')]=qs['sort'](_0x34a676[_0x58d0('0x31')][_0x58d0('0x3a')]);_0x3893d3[_0x58d0('0x3b')]=qs[_0x58d0('0x32')](_[_0x58d0('0x3c')](_0x34a676['query'],_0x4d4cf1['filters']),_0x3691dc);if(_0x34a676[_0x58d0('0x31')]['filter']){_0x3893d3['where']=_['merge'](_0x3893d3[_0x58d0('0x3b')],{'$or':_['map'](_0x3691dc,function(_0xfba40){if(_0xfba40['type']!==_0x58d0('0x3d')){var _0x5eb3d2={};_0x5eb3d2[_0xfba40['name']]={'$like':'%'+_0x34a676['query'][_0x58d0('0x3e')]+'%'};return _0x5eb3d2;}})});}_0x3893d3=_[_0x58d0('0x3f')]({},_0x3893d3,_0x34a676['options']);var _0x2c7a8d={'where':_0x3893d3['where']};return db[_0x58d0('0x2d')][_0x58d0('0x1a')](_0x2c7a8d)['then'](function(_0x2c3a40){_0x184423['count']=_0x2c3a40;if(_0x34a676[_0x58d0('0x31')][_0x58d0('0x40')]){_0x3893d3[_0x58d0('0x41')]=[{'all':!![]}];}return db[_0x58d0('0x2d')][_0x58d0('0x42')](_0x3893d3);})['then'](function(_0x490e03){_0x184423['rows']=_0x490e03;return _0x184423;})[_0x58d0('0x27')](respondWithFilteredResult(_0x4bff4f,_0x3893d3))[_0x58d0('0x43')](handleError(_0x4bff4f,null));};exports['show']=function(_0x219eea,_0x5a5b04){var _0x56c743={'raw':!![],'where':{'id':_0x219eea[_0x58d0('0x44')]['id']}},_0x42a91c={};_0x42a91c[_0x58d0('0x30')]=_[_0x58d0('0x45')](db[_0x58d0('0x2d')]['rawAttributes']);_0x42a91c['query']=_['keys'](_0x219eea[_0x58d0('0x31')]);_0x42a91c[_0x58d0('0x32')]=_[_0x58d0('0x33')](_0x42a91c[_0x58d0('0x30')],_0x42a91c[_0x58d0('0x31')]);_0x56c743[_0x58d0('0x35')]=_[_0x58d0('0x33')](_0x42a91c['model'],qs[_0x58d0('0x34')](_0x219eea[_0x58d0('0x31')]['fields']));_0x56c743['attributes']=_0x56c743[_0x58d0('0x35')][_0x58d0('0x36')]?_0x56c743[_0x58d0('0x35')]:_0x42a91c[_0x58d0('0x30')];if(_0x219eea[_0x58d0('0x31')][_0x58d0('0x40')]){_0x56c743[_0x58d0('0x41')]=[{'all':!![]}];}_0x56c743=_[_0x58d0('0x3f')]({},_0x56c743,_0x219eea[_0x58d0('0x46')]);return db['AnalyticMetric'][_0x58d0('0x47')](_0x56c743)[_0x58d0('0x27')](handleEntityNotFound(_0x5a5b04,null))['then'](respondWithResult(_0x5a5b04,null))['catch'](handleError(_0x5a5b04,null));};exports[_0x58d0('0x48')]=function(_0x48badd,_0x2f0942){return db['AnalyticMetric']['create'](_0x48badd[_0x58d0('0x49')],{})[_0x58d0('0x27')](function(_0x23d48b){var _0x1326dd=_0x48badd[_0x58d0('0x4a')]['get']({'plain':!![]});if(!_0x1326dd)throw new Error(_0x58d0('0x4b'));if(_0x1326dd[_0x58d0('0x4c')]===_0x58d0('0x4a')){var _0x3b1b54=_0x23d48b[_0x58d0('0x24')]({'plain':!![]});var _0x5ddbb9='Metrics';return db[_0x58d0('0x4d')][_0x58d0('0x47')]({'where':{'name':_0x5ddbb9,'userProfileId':_0x1326dd[_0x58d0('0x4e')]},'raw':!![]})['then'](function(_0x444bc4){if(_0x444bc4&&_0x444bc4['autoAssociation']===0x0){return db[_0x58d0('0x26')][_0x58d0('0x48')]({'name':_0x3b1b54[_0x58d0('0x29')],'resourceId':_0x3b1b54['id'],'type':_0x444bc4['name'],'sectionId':_0x444bc4['id']},{})['then'](function(){return _0x23d48b;});}else{return _0x23d48b;}})[_0x58d0('0x43')](function(_0x1c9afb){logger[_0x58d0('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c9afb);throw _0x1c9afb;});}return _0x23d48b;})[_0x58d0('0x27')](respondWithResult(_0x2f0942,0xc9))[_0x58d0('0x43')](handleError(_0x2f0942,null));};exports['update']=function(_0x57c76f,_0x452351){if(_0x57c76f[_0x58d0('0x49')]['id']){delete _0x57c76f[_0x58d0('0x49')]['id'];}return db[_0x58d0('0x2d')][_0x58d0('0x47')]({'where':{'id':_0x57c76f[_0x58d0('0x44')]['id']}})[_0x58d0('0x27')](handleEntityNotFound(_0x452351,null))['then'](saveUpdates(_0x57c76f[_0x58d0('0x49')],null))[_0x58d0('0x27')](respondWithResult(_0x452351,null))[_0x58d0('0x43')](handleError(_0x452351,null));};exports[_0x58d0('0x23')]=function(_0x526b1c,_0x1dbbd0){return db['AnalyticMetric'][_0x58d0('0x47')]({'where':{'id':_0x526b1c[_0x58d0('0x44')]['id']}})['then'](handleEntityNotFound(_0x1dbbd0,null))[_0x58d0('0x27')](removeEntity(_0x1dbbd0,null))[_0x58d0('0x43')](handleError(_0x1dbbd0,null));}; \ No newline at end of file +var _0x1399=['key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','reject','save','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','index','map','AnalyticMetric','fieldName','type'];(function(_0x2c6e52,_0x4e846b){var _0x1a05ee=function(_0x4ea9ef){while(--_0x4ea9ef){_0x2c6e52['push'](_0x2c6e52['shift']());}};_0x1a05ee(++_0x4e846b);}(_0x1399,0x16c));var _0x9139=function(_0x374e13,_0x34582f){_0x374e13=_0x374e13-0x0;var _0x45991e=_0x1399[_0x374e13];return _0x45991e;};'use strict';var pdf=require(_0x9139('0x0'));var emlformat=require(_0x9139('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9139('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9139('0x3'));var moment=require(_0x9139('0x4'));var BPromise=require(_0x9139('0x5'));var Mustache=require(_0x9139('0x6'));var util=require(_0x9139('0x7'));var path=require(_0x9139('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9139('0x9'));var fs=require('fs');var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var db=require(_0x9139('0x15'))['db'];function respondWithStatusCode(_0x5579d3,_0x52b32d){_0x52b32d=_0x52b32d||0xcc;return function(_0x511ec9){if(_0x511ec9){return _0x5579d3[_0x9139('0x16')](_0x52b32d);}return _0x5579d3['status'](_0x52b32d)[_0x9139('0x17')]();};}function respondWithResult(_0x22bf08,_0x375ada){_0x375ada=_0x375ada||0xc8;return function(_0x262009){if(_0x262009){return _0x22bf08['status'](_0x375ada)[_0x9139('0x18')](_0x262009);}};}function respondWithFilteredResult(_0x4d1a85,_0x58307f){return function(_0x52c57b){if(_0x52c57b){var _0x159e50=_0x52c57b[_0x9139('0x19')],_0x3e2bad=_0x58307f[_0x9139('0x1a')],_0x1cd24e=_0x58307f['offset']+_0x58307f['limit'],_0x3fadf7;if(_0x1cd24e>=_0x159e50){_0x1cd24e=_0x159e50;_0x3fadf7=0xc8;}else{_0x3fadf7=0xce;}_0x4d1a85[_0x9139('0x1b')](_0x3fadf7);return _0x4d1a85[_0x9139('0x1c')]('Content-Range',_0x3e2bad+'-'+_0x1cd24e+'/'+_0x159e50)['json'](_0x52c57b);}return null;};}function patchUpdates(_0x30a363){return function(_0x2c97b6){try{jsonpatch['apply'](_0x2c97b6,_0x30a363,!![]);}catch(_0x144893){return BPromise[_0x9139('0x1d')](_0x144893);}return _0x2c97b6[_0x9139('0x1e')]();};}function saveUpdates(_0x3c8296,_0xd2eb33){return function(_0x6f901b){if(_0x6f901b){return _0x6f901b[_0x9139('0x1f')](_0x3c8296)[_0x9139('0x20')](function(_0x3e95f8){return _0x3e95f8;});}return null;};}function removeEntity(_0x355c71,_0x1bac18){return function(_0x269f8a){if(_0x269f8a){return _0x269f8a[_0x9139('0x21')]()[_0x9139('0x20')](function(){var _0x27f3e4=_0x269f8a[_0x9139('0x22')]({'plain':!![]});var _0x1aee3b=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x1aee3b,'resourceId':_0x27f3e4['id']}})[_0x9139('0x20')](function(){return _0x269f8a;});})[_0x9139('0x20')](function(){_0x355c71['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x2ee4bb,_0x10bfa0){return function(_0x4a3ed2){if(!_0x4a3ed2){_0x2ee4bb[_0x9139('0x16')](0x194);}return _0x4a3ed2;};}function handleError(_0xffd487,_0x49d01e){_0x49d01e=_0x49d01e||0x1f4;return function(_0x1c9938){logger[_0x9139('0x25')](_0x1c9938[_0x9139('0x26')]);if(_0x1c9938['name']){delete _0x1c9938[_0x9139('0x27')];}_0xffd487[_0x9139('0x1b')](_0x49d01e)[_0x9139('0x28')](_0x1c9938);};}exports[_0x9139('0x29')]=function(_0x215194,_0x16dfb4){var _0xfe6854={},_0x573a05={},_0x55cc6a={'count':0x0,'rows':[]};var _0x1b3fd9=_[_0x9139('0x2a')](db[_0x9139('0x2b')]['rawAttributes'],function(_0x50d545){return{'name':_0x50d545[_0x9139('0x2c')],'type':_0x50d545[_0x9139('0x2d')][_0x9139('0x2e')]};});_0x573a05[_0x9139('0x2f')]=_[_0x9139('0x2a')](_0x1b3fd9,'name');_0x573a05['query']=_[_0x9139('0x30')](_0x215194['query']);_0x573a05['filters']=_[_0x9139('0x31')](_0x573a05[_0x9139('0x2f')],_0x573a05['query']);_0xfe6854[_0x9139('0x32')]=_[_0x9139('0x31')](_0x573a05['model'],qs[_0x9139('0x33')](_0x215194[_0x9139('0x34')][_0x9139('0x33')]));_0xfe6854[_0x9139('0x32')]=_0xfe6854[_0x9139('0x32')][_0x9139('0x35')]?_0xfe6854[_0x9139('0x32')]:_0x573a05[_0x9139('0x2f')];if(!_0x215194[_0x9139('0x34')][_0x9139('0x36')](_0x9139('0x37'))){_0xfe6854['limit']=qs[_0x9139('0x38')](_0x215194[_0x9139('0x34')]['limit']);_0xfe6854[_0x9139('0x1a')]=qs[_0x9139('0x1a')](_0x215194[_0x9139('0x34')]['offset']);}_0xfe6854[_0x9139('0x39')]=qs[_0x9139('0x3a')](_0x215194[_0x9139('0x34')][_0x9139('0x3a')]);_0xfe6854[_0x9139('0x3b')]=qs[_0x9139('0x3c')](_[_0x9139('0x3d')](_0x215194[_0x9139('0x34')],_0x573a05[_0x9139('0x3c')]),_0x1b3fd9);if(_0x215194[_0x9139('0x34')]['filter']){_0xfe6854[_0x9139('0x3b')]=_[_0x9139('0x3e')](_0xfe6854[_0x9139('0x3b')],{'$or':_[_0x9139('0x2a')](_0x1b3fd9,function(_0x395bc6){if(_0x395bc6[_0x9139('0x2d')]!==_0x9139('0x3f')){var _0x49a962={};_0x49a962[_0x395bc6[_0x9139('0x27')]]={'$like':'%'+_0x215194['query'][_0x9139('0x40')]+'%'};return _0x49a962;}})});}_0xfe6854=_[_0x9139('0x3e')]({},_0xfe6854,_0x215194[_0x9139('0x41')]);var _0x5055c8={'where':_0xfe6854[_0x9139('0x3b')]};return db[_0x9139('0x2b')][_0x9139('0x19')](_0x5055c8)[_0x9139('0x20')](function(_0x115a15){_0x55cc6a[_0x9139('0x19')]=_0x115a15;if(_0x215194[_0x9139('0x34')][_0x9139('0x42')]){_0xfe6854[_0x9139('0x43')]=[{'all':!![]}];}return db[_0x9139('0x2b')]['findAll'](_0xfe6854);})[_0x9139('0x20')](function(_0x1de153){_0x55cc6a[_0x9139('0x44')]=_0x1de153;return _0x55cc6a;})['then'](respondWithFilteredResult(_0x16dfb4,_0xfe6854))['catch'](handleError(_0x16dfb4,null));};exports['show']=function(_0x465f49,_0x12ba4b){var _0x3611b4={'raw':!![],'where':{'id':_0x465f49[_0x9139('0x45')]['id']}},_0x3cbd6c={};_0x3cbd6c['model']=_[_0x9139('0x30')](db[_0x9139('0x2b')][_0x9139('0x46')]);_0x3cbd6c[_0x9139('0x34')]=_[_0x9139('0x30')](_0x465f49['query']);_0x3cbd6c[_0x9139('0x3c')]=_[_0x9139('0x31')](_0x3cbd6c[_0x9139('0x2f')],_0x3cbd6c[_0x9139('0x34')]);_0x3611b4['attributes']=_['intersection'](_0x3cbd6c[_0x9139('0x2f')],qs[_0x9139('0x33')](_0x465f49['query']['fields']));_0x3611b4[_0x9139('0x32')]=_0x3611b4[_0x9139('0x32')]['length']?_0x3611b4[_0x9139('0x32')]:_0x3cbd6c[_0x9139('0x2f')];if(_0x465f49['query'][_0x9139('0x42')]){_0x3611b4['include']=[{'all':!![]}];}_0x3611b4=_['merge']({},_0x3611b4,_0x465f49[_0x9139('0x41')]);return db[_0x9139('0x2b')][_0x9139('0x47')](_0x3611b4)[_0x9139('0x20')](handleEntityNotFound(_0x12ba4b,null))[_0x9139('0x20')](respondWithResult(_0x12ba4b,null))['catch'](handleError(_0x12ba4b,null));};exports[_0x9139('0x48')]=function(_0xc55b16,_0x33ffc8){return db['AnalyticMetric'][_0x9139('0x48')](_0xc55b16[_0x9139('0x49')],{})[_0x9139('0x20')](function(_0xb8ec50){var _0x215793=_0xc55b16[_0x9139('0x4a')][_0x9139('0x22')]({'plain':!![]});if(!_0x215793)throw new Error(_0x9139('0x4b'));if(_0x215793[_0x9139('0x4c')]===_0x9139('0x4a')){var _0x2da28c=_0xb8ec50['get']({'plain':!![]});var _0x10eb03=_0x9139('0x23');return db[_0x9139('0x4d')]['find']({'where':{'name':_0x10eb03,'userProfileId':_0x215793[_0x9139('0x4e')]},'raw':!![]})[_0x9139('0x20')](function(_0x557c93){if(_0x557c93&&_0x557c93[_0x9139('0x4f')]===0x0){return db[_0x9139('0x24')][_0x9139('0x48')]({'name':_0x2da28c['name'],'resourceId':_0x2da28c['id'],'type':_0x557c93[_0x9139('0x27')],'sectionId':_0x557c93['id']},{})[_0x9139('0x20')](function(){return _0xb8ec50;});}else{return _0xb8ec50;}})[_0x9139('0x50')](function(_0x23669b){logger['error'](_0x9139('0x51'),_0x23669b);throw _0x23669b;});}return _0xb8ec50;})[_0x9139('0x20')](respondWithResult(_0x33ffc8,0xc9))[_0x9139('0x50')](handleError(_0x33ffc8,null));};exports['update']=function(_0x3f8b69,_0x146201){if(_0x3f8b69[_0x9139('0x49')]['id']){delete _0x3f8b69[_0x9139('0x49')]['id'];}return db[_0x9139('0x2b')][_0x9139('0x47')]({'where':{'id':_0x3f8b69[_0x9139('0x45')]['id']}})['then'](handleEntityNotFound(_0x146201,null))[_0x9139('0x20')](saveUpdates(_0x3f8b69[_0x9139('0x49')],null))['then'](respondWithResult(_0x146201,null))[_0x9139('0x50')](handleError(_0x146201,null));};exports[_0x9139('0x21')]=function(_0x3d6627,_0x1a0841){return db[_0x9139('0x2b')]['find']({'where':{'id':_0x3d6627[_0x9139('0x45')]['id']}})[_0x9139('0x20')](handleEntityNotFound(_0x1a0841,null))['then'](removeEntity(_0x1a0841,null))['catch'](handleError(_0x1a0841,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b249b7c..2982a36 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 _0xf94a=['analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','AnalyticMetric'];(function(_0x1003da,_0x258432){var _0x469aca=function(_0x882d95){while(--_0x882d95){_0x1003da['push'](_0x1003da['shift']());}};_0x469aca(++_0x258432);}(_0xf94a,0x115));var _0xaf94=function(_0x40a5b7,_0x46da87){_0x40a5b7=_0x40a5b7-0x0;var _0x147d43=_0xf94a[_0x40a5b7];return _0x147d43;};'use strict';var _=require('lodash');var util=require(_0xaf94('0x0'));var logger=require(_0xaf94('0x1'))(_0xaf94('0x2'));var moment=require(_0xaf94('0x3'));var BPromise=require(_0xaf94('0x4'));var rp=require(_0xaf94('0x5'));var fs=require('fs');var path=require(_0xaf94('0x6'));var rimraf=require('rimraf');var config=require(_0xaf94('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xaf94('0x8')]=function(_0x4ee554,_0x45da11){return _0x4ee554[_0xaf94('0x9')](_0xaf94('0xa'),attributes,{'tableName':_0xaf94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb419=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xb419,0x1c0));var _0x9b41=function(_0x3c2d20,_0x593214){_0x3c2d20=_0x3c2d20-0x0;var _0x3b3284=_0xb419[_0x3c2d20];return _0x3b3284;};'use strict';var _=require(_0x9b41('0x0'));var util=require(_0x9b41('0x1'));var logger=require(_0x9b41('0x2'))(_0x9b41('0x3'));var moment=require(_0x9b41('0x4'));var BPromise=require(_0x9b41('0x5'));var rp=require(_0x9b41('0x6'));var fs=require('fs');var path=require(_0x9b41('0x7'));var rimraf=require(_0x9b41('0x8'));var config=require(_0x9b41('0x9'));var attributes=require('./analyticMetric.attributes');module[_0x9b41('0xa')]=function(_0x2e7baa,_0x511359){return _0x2e7baa[_0x9b41('0xb')](_0x9b41('0xc'),attributes,{'tableName':_0x9b41('0xd'),'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 e748c29..57c1ed6 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 _0xb22f=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb22f,0x12b));var _0xfb22=function(_0xa160c2,_0xd05a6a){_0xa160c2=_0xa160c2-0x0;var _0x5bf90f=_0xb22f[_0xa160c2];return _0x5bf90f;};'use strict';var _=require(_0xfb22('0x0'));var util=require(_0xfb22('0x1'));var moment=require(_0xfb22('0x2'));var BPromise=require(_0xfb22('0x3'));var rs=require(_0xfb22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb22('0x5'));var logger=require(_0xfb22('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfb22('0x7'));var client=jayson['client'][_0xfb22('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x220e33,_0x479043,_0x4250e5){return new BPromise(function(_0x5bcba7,_0xf88d6d){return client[_0xfb22('0x9')](_0x220e33,_0x4250e5)[_0xfb22('0xa')](function(_0x19251d){logger[_0xfb22('0xb')](_0xfb22('0xc'),_0x479043,'request\x20sent');logger[_0xfb22('0xd')](_0xfb22('0xe'),_0x479043,_0xfb22('0xf'),JSON[_0xfb22('0x10')](_0x19251d));if(_0x19251d[_0xfb22('0x11')]){if(_0x19251d[_0xfb22('0x11')][_0xfb22('0x12')]===0x1f4){logger[_0xfb22('0x11')](_0xfb22('0xc'),_0x479043,_0x19251d[_0xfb22('0x11')][_0xfb22('0x13')]);return _0xf88d6d(_0x19251d[_0xfb22('0x11')]['message']);}logger[_0xfb22('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x479043,_0x19251d[_0xfb22('0x11')][_0xfb22('0x13')]);return _0x5bcba7(_0x19251d[_0xfb22('0x11')][_0xfb22('0x13')]);}else{logger[_0xfb22('0xb')](_0xfb22('0xc'),_0x479043,_0xfb22('0xf'));_0x5bcba7(_0x19251d['result'][_0xfb22('0x13')]);}})[_0xfb22('0x14')](function(_0x53daf3){logger[_0xfb22('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x479043,_0x53daf3);_0xf88d6d(_0x53daf3);});});} \ No newline at end of file +var _0xc908=['error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x210b82,_0xb32f51){var _0x547507=function(_0x5a9899){while(--_0x5a9899){_0x210b82['push'](_0x210b82['shift']());}};_0x547507(++_0xb32f51);}(_0xc908,0x1d4));var _0x8c90=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xc908[_0x261522];return _0x98a25a;};'use strict';var _=require('lodash');var util=require(_0x8c90('0x0'));var moment=require(_0x8c90('0x1'));var BPromise=require(_0x8c90('0x2'));var rs=require(_0x8c90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c90('0x4'))['db'];var utils=require(_0x8c90('0x5'));var logger=require(_0x8c90('0x6'))(_0x8c90('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c90('0x8'));var client=jayson[_0x8c90('0x9')][_0x8c90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b726c,_0x47891c,_0x33f35b){return new BPromise(function(_0x4fb9b8,_0x563105){return client['request'](_0x1b726c,_0x33f35b)[_0x8c90('0xb')](function(_0x496ae0){logger['info'](_0x8c90('0xc'),_0x47891c,'request\x20sent');logger[_0x8c90('0xd')](_0x8c90('0xe'),_0x47891c,_0x8c90('0xf'),JSON['stringify'](_0x496ae0));if(_0x496ae0['error']){if(_0x496ae0[_0x8c90('0x10')][_0x8c90('0x11')]===0x1f4){logger[_0x8c90('0x10')](_0x8c90('0xc'),_0x47891c,_0x496ae0[_0x8c90('0x10')][_0x8c90('0x12')]);return _0x563105(_0x496ae0[_0x8c90('0x10')][_0x8c90('0x12')]);}logger['error'](_0x8c90('0xc'),_0x47891c,_0x496ae0[_0x8c90('0x10')][_0x8c90('0x12')]);return _0x4fb9b8(_0x496ae0[_0x8c90('0x10')][_0x8c90('0x12')]);}else{logger[_0x8c90('0x13')](_0x8c90('0xc'),_0x47891c,_0x8c90('0xf'));_0x4fb9b8(_0x496ae0[_0x8c90('0x14')][_0x8c90('0x12')]);}})[_0x8c90('0x15')](function(_0xcf72d7){logger[_0x8c90('0x10')](_0x8c90('0xc'),_0x47891c,_0xcf72d7);_0x563105(_0xcf72d7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index df5fba0..eb54b43 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x45dd60,_0x27f9a5){_0x45dd60=_0x45dd60-0x0;var _0x21e20a=_0xc6ac[_0x45dd60];return _0x21e20a;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3f8336,_0x5b4225){_0x3f8336=_0x3f8336-0x0;var _0x54f8eb=_0xc6ac[_0x3f8336];return _0x54f8eb;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5290940..643da6d 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 _0x0193=['sequelize','exports','TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0193,0x17a));var _0x3019=function(_0x2bf4c5,_0x500b4e){_0x2bf4c5=_0x2bf4c5-0x0;var _0x2fcc74=_0x0193[_0x2bf4c5];return _0x2fcc74;};'use strict';var Sequelize=require(_0x3019('0x0'));module[_0x3019('0x1')]={'tree':{'type':Sequelize[_0x3019('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5a98=['sequelize','exports'];(function(_0x3f5d3c,_0x10c852){var _0x4166b3=function(_0x3b84f1){while(--_0x3b84f1){_0x3f5d3c['push'](_0x3f5d3c['shift']());}};_0x4166b3(++_0x10c852);}(_0x5a98,0x1d8));var _0x85a9=function(_0x40fb11,_0x1c1d5c){_0x40fb11=_0x40fb11-0x0;var _0x26f87b=_0x5a98[_0x40fb11];return _0x26f87b;};'use strict';var Sequelize=require(_0x85a9('0x0'));module[_0x85a9('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index de5cbc0..640a439 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 _0x0a5f=['length','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x0a5f,0xef));var _0xf0a5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a5f[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf0a5('0x0'));var rimraf=require(_0xf0a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0a5('0x2'));var rp=require(_0xf0a5('0x3'));var moment=require(_0xf0a5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0a5('0x5'));var path=require(_0xf0a5('0x6'));var sox=require(_0xf0a5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf0a5('0x8'));var squel=require(_0xf0a5('0x9'));var crypto=require(_0xf0a5('0xa'));var jsforce=require(_0xf0a5('0xb'));var deskjs=require(_0xf0a5('0xc'));var toCsv=require(_0xf0a5('0xd'));var querystring=require(_0xf0a5('0xe'));var Papa=require(_0xf0a5('0xf'));var Redis=require(_0xf0a5('0x10'));var authService=require(_0xf0a5('0x11'));var qs=require(_0xf0a5('0x12'));var as=require(_0xf0a5('0x13'));var hardwareService=require(_0xf0a5('0x14'));var logger=require(_0xf0a5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf0a5('0x16'));var db=require(_0xf0a5('0x17'))['db'];function respondWithStatusCode(_0x3f3689,_0xcc3951){_0xcc3951=_0xcc3951||0xcc;return function(_0x42ab64){if(_0x42ab64){return _0x3f3689[_0xf0a5('0x18')](_0xcc3951);}return _0x3f3689[_0xf0a5('0x19')](_0xcc3951)[_0xf0a5('0x1a')]();};}function respondWithResult(_0x24cd5b,_0x13c194){_0x13c194=_0x13c194||0xc8;return function(_0x318c1d){if(_0x318c1d){return _0x24cd5b['status'](_0x13c194)[_0xf0a5('0x1b')](_0x318c1d);}};}function respondWithFilteredResult(_0x24fd1f,_0x43940a){return function(_0xd496b4){if(_0xd496b4){var _0x4bae3a=_0xd496b4['count'],_0x57f061=_0x43940a[_0xf0a5('0x1c')],_0x1dfd16=_0x43940a[_0xf0a5('0x1c')]+_0x43940a[_0xf0a5('0x1d')],_0x470d94;if(_0x1dfd16>=_0x4bae3a){_0x1dfd16=_0x4bae3a;_0x470d94=0xc8;}else{_0x470d94=0xce;}_0x24fd1f[_0xf0a5('0x19')](_0x470d94);return _0x24fd1f['set']('Content-Range',_0x57f061+'-'+_0x1dfd16+'/'+_0x4bae3a)['json'](_0xd496b4);}return null;};}function patchUpdates(_0xbcb29b){return function(_0x349ca5){try{jsonpatch[_0xf0a5('0x1e')](_0x349ca5,_0xbcb29b,!![]);}catch(_0x35f464){return BPromise[_0xf0a5('0x1f')](_0x35f464);}return _0x349ca5['save']();};}function saveUpdates(_0x2149f8,_0x17110b){return function(_0x92358c){if(_0x92358c){return _0x92358c[_0xf0a5('0x20')](_0x2149f8)[_0xf0a5('0x21')](function(_0x157601){return _0x157601;});}return null;};}function removeEntity(_0x48bd7b,_0x14ed2f){return function(_0x13871f){if(_0x13871f){return _0x13871f[_0xf0a5('0x22')]()['then'](function(){_0x48bd7b[_0xf0a5('0x19')](0xcc)[_0xf0a5('0x1a')]();});}};}function handleEntityNotFound(_0x94aaa,_0x4ea116){return function(_0x1cd5c3){if(!_0x1cd5c3){_0x94aaa[_0xf0a5('0x18')](0x194);}return _0x1cd5c3;};}function handleError(_0x5388ad,_0xd341c7){_0xd341c7=_0xd341c7||0x1f4;return function(_0x37b6ae){logger[_0xf0a5('0x23')](_0x37b6ae[_0xf0a5('0x24')]);if(_0x37b6ae[_0xf0a5('0x25')]){delete _0x37b6ae[_0xf0a5('0x25')];}_0x5388ad[_0xf0a5('0x19')](_0xd341c7)[_0xf0a5('0x26')](_0x37b6ae);};}exports[_0xf0a5('0x27')]=function(_0x533a97,_0xd2fb00){var _0x344b94={},_0x21b40f={},_0x2946e7={'count':0x0,'rows':[]};var _0x13640e=_[_0xf0a5('0x28')](db[_0xf0a5('0x29')][_0xf0a5('0x2a')],function(_0x5ac558){return{'name':_0x5ac558[_0xf0a5('0x2b')],'type':_0x5ac558[_0xf0a5('0x2c')][_0xf0a5('0x2d')]};});_0x21b40f[_0xf0a5('0x2e')]=_[_0xf0a5('0x28')](_0x13640e,_0xf0a5('0x25'));_0x21b40f[_0xf0a5('0x2f')]=_[_0xf0a5('0x30')](_0x533a97[_0xf0a5('0x2f')]);_0x21b40f[_0xf0a5('0x31')]=_[_0xf0a5('0x32')](_0x21b40f[_0xf0a5('0x2e')],_0x21b40f['query']);_0x344b94['attributes']=_['intersection'](_0x21b40f['model'],qs[_0xf0a5('0x33')](_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x33')]));_0x344b94[_0xf0a5('0x34')]=_0x344b94[_0xf0a5('0x34')][_0xf0a5('0x35')]?_0x344b94[_0xf0a5('0x34')]:_0x21b40f[_0xf0a5('0x2e')];if(!_0x533a97[_0xf0a5('0x2f')]['hasOwnProperty']('nolimit')){_0x344b94[_0xf0a5('0x1d')]=qs[_0xf0a5('0x1d')](_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x1d')]);_0x344b94[_0xf0a5('0x1c')]=qs[_0xf0a5('0x1c')](_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x1c')]);}_0x344b94[_0xf0a5('0x36')]=qs[_0xf0a5('0x37')](_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x37')]);_0x344b94[_0xf0a5('0x38')]=qs[_0xf0a5('0x31')](_[_0xf0a5('0x39')](_0x533a97['query'],_0x21b40f[_0xf0a5('0x31')]),_0x13640e);if(_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x3a')]){_0x344b94[_0xf0a5('0x38')]=_[_0xf0a5('0x3b')](_0x344b94[_0xf0a5('0x38')],{'$or':_[_0xf0a5('0x28')](_0x13640e,function(_0x217fa4){if(_0x217fa4[_0xf0a5('0x2c')]!==_0xf0a5('0x3c')){var _0x5c8870={};_0x5c8870[_0x217fa4['name']]={'$like':'%'+_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x3a')]+'%'};return _0x5c8870;}})});}_0x344b94=_[_0xf0a5('0x3b')]({},_0x344b94,_0x533a97[_0xf0a5('0x3d')]);var _0x2cdefa={'where':_0x344b94[_0xf0a5('0x38')]};return db[_0xf0a5('0x29')]['count'](_0x2cdefa)[_0xf0a5('0x21')](function(_0x104989){_0x2946e7[_0xf0a5('0x3e')]=_0x104989;if(_0x533a97[_0xf0a5('0x2f')][_0xf0a5('0x3f')]){_0x344b94[_0xf0a5('0x40')]=[{'all':!![]}];}return db[_0xf0a5('0x29')][_0xf0a5('0x41')](_0x344b94);})[_0xf0a5('0x21')](function(_0x2fd4f1){_0x2946e7[_0xf0a5('0x42')]=_0x2fd4f1;return _0x2946e7;})[_0xf0a5('0x21')](respondWithFilteredResult(_0xd2fb00,_0x344b94))[_0xf0a5('0x43')](handleError(_0xd2fb00,null));};exports[_0xf0a5('0x44')]=function(_0x25daf6,_0xcdb22f){var _0x1094da={'raw':!![],'where':{'id':_0x25daf6['params']['id']}},_0xf029ed={};_0xf029ed['model']=_[_0xf0a5('0x30')](db[_0xf0a5('0x29')][_0xf0a5('0x2a')]);_0xf029ed[_0xf0a5('0x2f')]=_[_0xf0a5('0x30')](_0x25daf6['query']);_0xf029ed[_0xf0a5('0x31')]=_[_0xf0a5('0x32')](_0xf029ed[_0xf0a5('0x2e')],_0xf029ed[_0xf0a5('0x2f')]);_0x1094da['attributes']=_[_0xf0a5('0x32')](_0xf029ed['model'],qs[_0xf0a5('0x33')](_0x25daf6[_0xf0a5('0x2f')][_0xf0a5('0x33')]));_0x1094da[_0xf0a5('0x34')]=_0x1094da[_0xf0a5('0x34')][_0xf0a5('0x35')]?_0x1094da['attributes']:_0xf029ed[_0xf0a5('0x2e')];if(_0x25daf6['query'][_0xf0a5('0x3f')]){_0x1094da[_0xf0a5('0x40')]=[{'all':!![]}];}_0x1094da=_['merge']({},_0x1094da,_0x25daf6[_0xf0a5('0x3d')]);return db['AnalyticTreeReport']['find'](_0x1094da)[_0xf0a5('0x21')](handleEntityNotFound(_0xcdb22f,null))['then'](respondWithResult(_0xcdb22f,null))[_0xf0a5('0x43')](handleError(_0xcdb22f,null));};exports[_0xf0a5('0x45')]=function(_0x2b1d60,_0x2656ce){return db[_0xf0a5('0x29')]['create'](_0x2b1d60[_0xf0a5('0x46')],{})[_0xf0a5('0x21')](respondWithResult(_0x2656ce,0xc9))[_0xf0a5('0x43')](handleError(_0x2656ce,null));};exports[_0xf0a5('0x20')]=function(_0x3ff383,_0x308210){if(_0x3ff383[_0xf0a5('0x46')]['id']){delete _0x3ff383[_0xf0a5('0x46')]['id'];}return db['AnalyticTreeReport'][_0xf0a5('0x47')]({'where':{'id':_0x3ff383[_0xf0a5('0x48')]['id']}})[_0xf0a5('0x21')](handleEntityNotFound(_0x308210,null))['then'](saveUpdates(_0x3ff383[_0xf0a5('0x46')],null))[_0xf0a5('0x21')](respondWithResult(_0x308210,null))['catch'](handleError(_0x308210,null));};exports[_0xf0a5('0x22')]=function(_0x4ca4a7,_0x23c906){return db[_0xf0a5('0x29')][_0xf0a5('0x47')]({'where':{'id':_0x4ca4a7[_0xf0a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x23c906,null))[_0xf0a5('0x21')](removeEntity(_0x23c906,null))['catch'](handleError(_0x23c906,null));}; \ No newline at end of file +var _0x388d=['count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','rawAttributes','length','catch','create','update','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x42c713,_0x580604){var _0x5e075d=function(_0x399f89){while(--_0x399f89){_0x42c713['push'](_0x42c713['shift']());}};_0x5e075d(++_0x580604);}(_0x388d,0x186));var _0xd388=function(_0x2e2188,_0x183f54){_0x2e2188=_0x2e2188-0x0;var _0x43f68c=_0x388d[_0x2e2188];return _0x43f68c;};'use strict';var pdf=require(_0xd388('0x0'));var emlformat=require(_0xd388('0x1'));var rimraf=require(_0xd388('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd388('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd388('0x4'));var Mustache=require(_0xd388('0x5'));var util=require(_0xd388('0x6'));var path=require(_0xd388('0x7'));var sox=require(_0xd388('0x8'));var csv=require('to-csv');var ejs=require(_0xd388('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd388('0xa'));var deskjs=require(_0xd388('0xb'));var toCsv=require(_0xd388('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd388('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd388('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd388('0xf'));var logger=require(_0xd388('0x10'))(_0xd388('0x11'));var utils=require('../../config/utils');var config=require(_0xd388('0x12'));var db=require(_0xd388('0x13'))['db'];function respondWithStatusCode(_0x388e4,_0x14a874){_0x14a874=_0x14a874||0xcc;return function(_0x1c1ef7){if(_0x1c1ef7){return _0x388e4[_0xd388('0x14')](_0x14a874);}return _0x388e4[_0xd388('0x15')](_0x14a874)[_0xd388('0x16')]();};}function respondWithResult(_0x2c2048,_0x422542){_0x422542=_0x422542||0xc8;return function(_0x52ee34){if(_0x52ee34){return _0x2c2048[_0xd388('0x15')](_0x422542)[_0xd388('0x17')](_0x52ee34);}};}function respondWithFilteredResult(_0x2527cb,_0x1146f1){return function(_0x302018){if(_0x302018){var _0x22a34a=_0x302018[_0xd388('0x18')],_0x364083=_0x1146f1[_0xd388('0x19')],_0x2ecf33=_0x1146f1[_0xd388('0x19')]+_0x1146f1[_0xd388('0x1a')],_0x560d8d;if(_0x2ecf33>=_0x22a34a){_0x2ecf33=_0x22a34a;_0x560d8d=0xc8;}else{_0x560d8d=0xce;}_0x2527cb[_0xd388('0x15')](_0x560d8d);return _0x2527cb[_0xd388('0x1b')](_0xd388('0x1c'),_0x364083+'-'+_0x2ecf33+'/'+_0x22a34a)[_0xd388('0x17')](_0x302018);}return null;};}function patchUpdates(_0x501528){return function(_0x622bab){try{jsonpatch['apply'](_0x622bab,_0x501528,!![]);}catch(_0x34bb23){return BPromise[_0xd388('0x1d')](_0x34bb23);}return _0x622bab['save']();};}function saveUpdates(_0x5b3e23,_0x525eaa){return function(_0x4e972e){if(_0x4e972e){return _0x4e972e['update'](_0x5b3e23)[_0xd388('0x1e')](function(_0x447e3a){return _0x447e3a;});}return null;};}function removeEntity(_0x2165b8,_0x2ee4e2){return function(_0x5d57a4){if(_0x5d57a4){return _0x5d57a4['destroy']()[_0xd388('0x1e')](function(){_0x2165b8['status'](0xcc)[_0xd388('0x16')]();});}};}function handleEntityNotFound(_0x4d17df,_0x56bb8b){return function(_0x37ce29){if(!_0x37ce29){_0x4d17df[_0xd388('0x14')](0x194);}return _0x37ce29;};}function handleError(_0x1d4ac8,_0x230f45){_0x230f45=_0x230f45||0x1f4;return function(_0x6b9086){logger[_0xd388('0x1f')](_0x6b9086[_0xd388('0x20')]);if(_0x6b9086[_0xd388('0x21')]){delete _0x6b9086[_0xd388('0x21')];}_0x1d4ac8['status'](_0x230f45)[_0xd388('0x22')](_0x6b9086);};}exports[_0xd388('0x23')]=function(_0xb75ffe,_0x35aca8){var _0x47ac65={},_0x598cbe={},_0x3a09b8={'count':0x0,'rows':[]};var _0x3c97e7=_[_0xd388('0x24')](db[_0xd388('0x25')]['rawAttributes'],function(_0x42dfc3){return{'name':_0x42dfc3[_0xd388('0x26')],'type':_0x42dfc3[_0xd388('0x27')]['key']};});_0x598cbe[_0xd388('0x28')]=_[_0xd388('0x24')](_0x3c97e7,_0xd388('0x21'));_0x598cbe['query']=_['keys'](_0xb75ffe[_0xd388('0x29')]);_0x598cbe[_0xd388('0x2a')]=_[_0xd388('0x2b')](_0x598cbe['model'],_0x598cbe['query']);_0x47ac65[_0xd388('0x2c')]=_[_0xd388('0x2b')](_0x598cbe[_0xd388('0x28')],qs[_0xd388('0x2d')](_0xb75ffe[_0xd388('0x29')][_0xd388('0x2d')]));_0x47ac65['attributes']=_0x47ac65[_0xd388('0x2c')]['length']?_0x47ac65[_0xd388('0x2c')]:_0x598cbe['model'];if(!_0xb75ffe[_0xd388('0x29')]['hasOwnProperty'](_0xd388('0x2e'))){_0x47ac65[_0xd388('0x1a')]=qs[_0xd388('0x1a')](_0xb75ffe[_0xd388('0x29')][_0xd388('0x1a')]);_0x47ac65[_0xd388('0x19')]=qs['offset'](_0xb75ffe[_0xd388('0x29')][_0xd388('0x19')]);}_0x47ac65[_0xd388('0x2f')]=qs[_0xd388('0x30')](_0xb75ffe['query']['sort']);_0x47ac65[_0xd388('0x31')]=qs[_0xd388('0x2a')](_[_0xd388('0x32')](_0xb75ffe['query'],_0x598cbe[_0xd388('0x2a')]),_0x3c97e7);if(_0xb75ffe[_0xd388('0x29')]['filter']){_0x47ac65[_0xd388('0x31')]=_[_0xd388('0x33')](_0x47ac65[_0xd388('0x31')],{'$or':_[_0xd388('0x24')](_0x3c97e7,function(_0x1dd80d){if(_0x1dd80d[_0xd388('0x27')]!==_0xd388('0x34')){var _0x5107bf={};_0x5107bf[_0x1dd80d[_0xd388('0x21')]]={'$like':'%'+_0xb75ffe[_0xd388('0x29')][_0xd388('0x35')]+'%'};return _0x5107bf;}})});}_0x47ac65=_[_0xd388('0x33')]({},_0x47ac65,_0xb75ffe[_0xd388('0x36')]);var _0x1b40c7={'where':_0x47ac65[_0xd388('0x31')]};return db['AnalyticTreeReport']['count'](_0x1b40c7)[_0xd388('0x1e')](function(_0x47efe3){_0x3a09b8[_0xd388('0x18')]=_0x47efe3;if(_0xb75ffe['query'][_0xd388('0x37')]){_0x47ac65[_0xd388('0x38')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xd388('0x39')](_0x47ac65);})[_0xd388('0x1e')](function(_0x51085a){_0x3a09b8[_0xd388('0x3a')]=_0x51085a;return _0x3a09b8;})['then'](respondWithFilteredResult(_0x35aca8,_0x47ac65))['catch'](handleError(_0x35aca8,null));};exports['show']=function(_0x310906,_0x5b318e){var _0x5e2e00={'raw':!![],'where':{'id':_0x310906[_0xd388('0x3b')]['id']}},_0x423408={};_0x423408[_0xd388('0x28')]=_[_0xd388('0x3c')](db[_0xd388('0x25')][_0xd388('0x3d')]);_0x423408[_0xd388('0x29')]=_[_0xd388('0x3c')](_0x310906[_0xd388('0x29')]);_0x423408['filters']=_[_0xd388('0x2b')](_0x423408[_0xd388('0x28')],_0x423408[_0xd388('0x29')]);_0x5e2e00[_0xd388('0x2c')]=_[_0xd388('0x2b')](_0x423408[_0xd388('0x28')],qs[_0xd388('0x2d')](_0x310906[_0xd388('0x29')]['fields']));_0x5e2e00['attributes']=_0x5e2e00[_0xd388('0x2c')][_0xd388('0x3e')]?_0x5e2e00['attributes']:_0x423408[_0xd388('0x28')];if(_0x310906[_0xd388('0x29')][_0xd388('0x37')]){_0x5e2e00['include']=[{'all':!![]}];}_0x5e2e00=_[_0xd388('0x33')]({},_0x5e2e00,_0x310906[_0xd388('0x36')]);return db[_0xd388('0x25')]['find'](_0x5e2e00)[_0xd388('0x1e')](handleEntityNotFound(_0x5b318e,null))[_0xd388('0x1e')](respondWithResult(_0x5b318e,null))[_0xd388('0x3f')](handleError(_0x5b318e,null));};exports[_0xd388('0x40')]=function(_0x29ff80,_0x5050ac){return db['AnalyticTreeReport'][_0xd388('0x40')](_0x29ff80['body'],{})[_0xd388('0x1e')](respondWithResult(_0x5050ac,0xc9))[_0xd388('0x3f')](handleError(_0x5050ac,null));};exports[_0xd388('0x41')]=function(_0x5e6d0c,_0x2db027){if(_0x5e6d0c[_0xd388('0x42')]['id']){delete _0x5e6d0c[_0xd388('0x42')]['id'];}return db[_0xd388('0x25')][_0xd388('0x43')]({'where':{'id':_0x5e6d0c['params']['id']}})[_0xd388('0x1e')](handleEntityNotFound(_0x2db027,null))[_0xd388('0x1e')](saveUpdates(_0x5e6d0c['body'],null))[_0xd388('0x1e')](respondWithResult(_0x2db027,null))[_0xd388('0x3f')](handleError(_0x2db027,null));};exports[_0xd388('0x44')]=function(_0x570079,_0x55e030){return db[_0xd388('0x25')][_0xd388('0x43')]({'where':{'id':_0x570079[_0xd388('0x3b')]['id']}})[_0xd388('0x1e')](handleEntityNotFound(_0x55e030,null))[_0xd388('0x1e')](removeEntity(_0x55e030,null))[_0xd388('0x3f')](handleError(_0x55e030,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e88aa53..cf08d07 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 _0x1b69=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x8a9138,_0x3d5d9d){var _0x2f95b0=function(_0x1cd7b2){while(--_0x1cd7b2){_0x8a9138['push'](_0x8a9138['shift']());}};_0x2f95b0(++_0x3d5d9d);}(_0x1b69,0x112));var _0x91b6=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x1b69[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var util=require(_0x91b6('0x0'));var logger=require(_0x91b6('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x91b6('0x2'));var fs=require('fs');var path=require(_0x91b6('0x3'));var rimraf=require(_0x91b6('0x4'));var config=require(_0x91b6('0x5'));var attributes=require(_0x91b6('0x6'));module[_0x91b6('0x7')]=function(_0x2d8689,_0x121fc8){return _0x2d8689[_0x91b6('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x91b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x254d=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x104caa,_0x20c2c4){var _0x1c7a4f=function(_0x5573e4){while(--_0x5573e4){_0x104caa['push'](_0x104caa['shift']());}};_0x1c7a4f(++_0x20c2c4);}(_0x254d,0x160));var _0xd254=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x254d[_0x46451c];return _0x12dce4;};'use strict';var _=require(_0xd254('0x0'));var util=require(_0xd254('0x1'));var logger=require(_0xd254('0x2'))(_0xd254('0x3'));var moment=require(_0xd254('0x4'));var BPromise=require('bluebird');var rp=require(_0xd254('0x5'));var fs=require('fs');var path=require(_0xd254('0x6'));var rimraf=require(_0xd254('0x7'));var config=require(_0xd254('0x8'));var attributes=require(_0xd254('0x9'));module[_0xd254('0xa')]=function(_0x408f3e,_0x14efff){return _0x408f3e[_0xd254('0xb')](_0xd254('0xc'),attributes,{'tableName':_0xd254('0xd'),'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 d900e9c..c781baa 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 _0xd114=['stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x4e93dc,_0x55e697){var _0x17e0d4=function(_0x1cf183){while(--_0x1cf183){_0x4e93dc['push'](_0x4e93dc['shift']());}};_0x17e0d4(++_0x55e697);}(_0xd114,0x7f));var _0x4d11=function(_0x2507c2,_0x31baea){_0x2507c2=_0x2507c2-0x0;var _0x30635b=_0xd114[_0x2507c2];return _0x30635b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d11('0x0'));var BPromise=require(_0x4d11('0x1'));var rs=require(_0x4d11('0x2'));var fs=require('fs');var Redis=require(_0x4d11('0x3'));var db=require(_0x4d11('0x4'))['db'];var utils=require(_0x4d11('0x5'));var logger=require(_0x4d11('0x6'))(_0x4d11('0x7'));var config=require(_0x4d11('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1141fe,_0x4ac4f5,_0x55e226){return new BPromise(function(_0x116289,_0x34b54e){return client['request'](_0x1141fe,_0x55e226)[_0x4d11('0x9')](function(_0x5ab769){logger[_0x4d11('0xa')](_0x4d11('0xb'),_0x4ac4f5,'request\x20sent');logger['debug'](_0x4d11('0xc'),_0x4ac4f5,'request\x20sent',JSON[_0x4d11('0xd')](_0x5ab769));if(_0x5ab769[_0x4d11('0xe')]){if(_0x5ab769['error'][_0x4d11('0xf')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4ac4f5,_0x5ab769[_0x4d11('0xe')][_0x4d11('0x10')]);return _0x34b54e(_0x5ab769[_0x4d11('0xe')]['message']);}logger[_0x4d11('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4ac4f5,_0x5ab769['error'][_0x4d11('0x10')]);return _0x116289(_0x5ab769['error'][_0x4d11('0x10')]);}else{logger[_0x4d11('0xa')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4ac4f5,_0x4d11('0x11'));_0x116289(_0x5ab769[_0x4d11('0x12')]['message']);}})[_0x4d11('0x13')](function(_0x5c7850){logger['error'](_0x4d11('0xb'),_0x4ac4f5,_0x5c7850);_0x34b54e(_0x5c7850);});});} \ No newline at end of file +var _0x7451=['AnalyticTreeReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1e7ca9,_0x3c96ec){var _0x2b87b3=function(_0x1c04e3){while(--_0x1c04e3){_0x1e7ca9['push'](_0x1e7ca9['shift']());}};_0x2b87b3(++_0x3c96ec);}(_0x7451,0x1bd));var _0x1745=function(_0x3a3352,_0x571b05){_0x3a3352=_0x3a3352-0x0;var _0x5be6bb=_0x7451[_0x3a3352];return _0x5be6bb;};'use strict';var _=require('lodash');var util=require(_0x1745('0x0'));var moment=require(_0x1745('0x1'));var BPromise=require(_0x1745('0x2'));var rs=require(_0x1745('0x3'));var fs=require('fs');var Redis=require(_0x1745('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1745('0x5'))(_0x1745('0x6'));var config=require('../../config/environment');var jayson=require(_0x1745('0x7'));var client=jayson[_0x1745('0x8')][_0x1745('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4276af,_0x3192a6,_0x52a509){return new BPromise(function(_0xc93c52,_0x3a5d77){return client['request'](_0x4276af,_0x52a509)[_0x1745('0xa')](function(_0x1e0e7c){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x3192a6,'request\x20sent');logger[_0x1745('0xb')](_0x1745('0xc'),_0x3192a6,_0x1745('0xd'),JSON['stringify'](_0x1e0e7c));if(_0x1e0e7c[_0x1745('0xe')]){if(_0x1e0e7c[_0x1745('0xe')]['code']===0x1f4){logger[_0x1745('0xe')](_0x1745('0xf'),_0x3192a6,_0x1e0e7c['error'][_0x1745('0x10')]);return _0x3a5d77(_0x1e0e7c[_0x1745('0xe')][_0x1745('0x10')]);}logger[_0x1745('0xe')](_0x1745('0xf'),_0x3192a6,_0x1e0e7c[_0x1745('0xe')]['message']);return _0xc93c52(_0x1e0e7c[_0x1745('0xe')][_0x1745('0x10')]);}else{logger[_0x1745('0x11')](_0x1745('0xf'),_0x3192a6,_0x1745('0xd'));_0xc93c52(_0x1e0e7c[_0x1745('0x12')][_0x1745('0x10')]);}})[_0x1745('0x13')](function(_0x26a700){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x3192a6,_0x26a700);_0x3a5d77(_0x26a700);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 766ffb2..d818950 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 _0xc3a4=['express','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','path'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xc3a4,0xa7));var _0x4c3a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc3a4[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c3a('0x0'));var timeout=require('connect-timeout');var express=require(_0x4c3a('0x1'));var router=express[_0x4c3a('0x2')]();var auth=require(_0x4c3a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4c3a('0x4'));var controller=require('./analyticTreeReport.controller');router[_0x4c3a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4c3a('0x5')](_0x4c3a('0x6'),auth[_0x4c3a('0x7')](),controller[_0x4c3a('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4c3a('0x9')]);router[_0x4c3a('0xa')](_0x4c3a('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x4c3a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4c3a('0xc')]);module[_0x4c3a('0xd')]=router; \ No newline at end of file +var _0x0309=['/:id','show','post','put','delete','destroy','path','connect-timeout','Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x18998e,_0x454935){var _0x3c0614=function(_0x5ce302){while(--_0x5ce302){_0x18998e['push'](_0x18998e['shift']());}};_0x3c0614(++_0x454935);}(_0x0309,0x1b8));var _0x9030=function(_0x568e2f,_0x46a44e){_0x568e2f=_0x568e2f-0x0;var _0x56b551=_0x0309[_0x568e2f];return _0x56b551;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9030('0x0'));var timeout=require(_0x9030('0x1'));var express=require('express');var router=express[_0x9030('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9030('0x3'));var controller=require(_0x9030('0x4'));router[_0x9030('0x5')]('/',auth[_0x9030('0x6')](),controller[_0x9030('0x7')]);router[_0x9030('0x5')](_0x9030('0x8'),auth['isAuthenticated'](),controller[_0x9030('0x9')]);router[_0x9030('0xa')]('/',auth[_0x9030('0x6')](),controller['create']);router[_0x9030('0xb')](_0x9030('0x8'),auth[_0x9030('0x6')](),controller['update']);router[_0x9030('0xc')](_0x9030('0x8'),auth[_0x9030('0x6')](),controller[_0x9030('0xd')]);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 29e5f6e..37ae8ae 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 _0x3713=['exports','STRING','sequelize'];(function(_0xba71d0,_0x465589){var _0x1396f7=function(_0x4a16fd){while(--_0x4a16fd){_0xba71d0['push'](_0xba71d0['shift']());}};_0x1396f7(++_0x465589);}(_0x3713,0x179));var _0x3371=function(_0x528a1c,_0x81edd2){_0x528a1c=_0x528a1c-0x0;var _0x582a7c=_0x3713[_0x528a1c];return _0x582a7c;};'use strict';var Sequelize=require(_0x3371('0x0'));module[_0x3371('0x1')]={'name':{'type':Sequelize[_0x3371('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3371('0x2')]}}; \ No newline at end of file +var _0x34c9=['exports','sequelize'];(function(_0x3032e6,_0x28c99d){var _0x5e3ba2=function(_0xaa336){while(--_0xaa336){_0x3032e6['push'](_0x3032e6['shift']());}};_0x5e3ba2(++_0x28c99d);}(_0x34c9,0x6d));var _0x934c=function(_0x484ac0,_0x4179b5){_0x484ac0=_0x484ac0-0x0;var _0x2a9328=_0x34c9[_0x484ac0];return _0x2a9328;};'use strict';var Sequelize=require(_0x934c('0x0'));module[_0x934c('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0157a30..34746d7 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 _0x89ac=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','clone','find','get','omit','createdAt','updatedAt','body','update','destroy','create','originalname','basename','filename','mimetype','download','join','root','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','then','error','stack','index','map','Attachment','type','key','model','name','query','filters'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x89ac,0x1cf));var _0xc89a=function(_0xd1afb3,_0x3e4e69){_0xd1afb3=_0xd1afb3-0x0;var _0x7ecaf1=_0x89ac[_0xd1afb3];return _0x7ecaf1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc89a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc89a('0x1'));var rp=require(_0xc89a('0x2'));var moment=require(_0xc89a('0x3'));var BPromise=require(_0xc89a('0x4'));var Mustache=require(_0xc89a('0x5'));var util=require(_0xc89a('0x6'));var path=require(_0xc89a('0x7'));var sox=require(_0xc89a('0x8'));var csv=require(_0xc89a('0x9'));var ejs=require(_0xc89a('0xa'));var fs=require('fs');var _=require(_0xc89a('0xb'));var squel=require(_0xc89a('0xc'));var crypto=require(_0xc89a('0xd'));var jsforce=require(_0xc89a('0xe'));var deskjs=require(_0xc89a('0xf'));var toCsv=require(_0xc89a('0x9'));var querystring=require(_0xc89a('0x10'));var Papa=require(_0xc89a('0x11'));var Redis=require(_0xc89a('0x12'));var authService=require(_0xc89a('0x13'));var qs=require(_0xc89a('0x14'));var as=require(_0xc89a('0x15'));var hardwareService=require(_0xc89a('0x16'));var logger=require(_0xc89a('0x17'))('api');var utils=require(_0xc89a('0x18'));var config=require('../../config/environment');var db=require(_0xc89a('0x19'))['db'];function respondWithStatusCode(_0x1e919b,_0x34348c){_0x34348c=_0x34348c||0xcc;return function(_0x8eb0ff){if(_0x8eb0ff){return _0x1e919b[_0xc89a('0x1a')](_0x34348c);}return _0x1e919b[_0xc89a('0x1b')](_0x34348c)[_0xc89a('0x1c')]();};}function respondWithResult(_0x5f4587,_0xd87584){_0xd87584=_0xd87584||0xc8;return function(_0x12e3d3){if(_0x12e3d3){return _0x5f4587[_0xc89a('0x1b')](_0xd87584)[_0xc89a('0x1d')](_0x12e3d3);}};}function respondWithFilteredResult(_0x2773f2,_0x50e9f5){return function(_0x50da51){if(_0x50da51){var _0x1242be=_0x50da51[_0xc89a('0x1e')],_0x55d98d=_0x50e9f5[_0xc89a('0x1f')],_0x3ba14c=_0x50e9f5[_0xc89a('0x1f')]+_0x50e9f5[_0xc89a('0x20')],_0x1b021c;if(_0x3ba14c>=_0x1242be){_0x3ba14c=_0x1242be;_0x1b021c=0xc8;}else{_0x1b021c=0xce;}_0x2773f2['status'](_0x1b021c);return _0x2773f2['set']('Content-Range',_0x55d98d+'-'+_0x3ba14c+'/'+_0x1242be)[_0xc89a('0x1d')](_0x50da51);}return null;};}function patchUpdates(_0x3f3389){return function(_0x42a2eb){try{jsonpatch['apply'](_0x42a2eb,_0x3f3389,!![]);}catch(_0x751ada){return BPromise[_0xc89a('0x21')](_0x751ada);}return _0x42a2eb[_0xc89a('0x22')]();};}function saveUpdates(_0x11450b,_0x508301){return function(_0x546ea5){if(_0x546ea5){return _0x546ea5['update'](_0x11450b)['then'](function(_0x2cb308){return _0x2cb308;});}return null;};}function removeEntity(_0x4c0317,_0x184589){return function(_0x3b57ec){if(_0x3b57ec){return _0x3b57ec['destroy']()[_0xc89a('0x23')](function(){_0x4c0317[_0xc89a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252f79,_0x31bf92){return function(_0x31d11){if(!_0x31d11){_0x252f79[_0xc89a('0x1a')](0x194);}return _0x31d11;};}function handleError(_0x1ec170,_0x2622f1){_0x2622f1=_0x2622f1||0x1f4;return function(_0x25c2d7){logger[_0xc89a('0x24')](_0x25c2d7[_0xc89a('0x25')]);if(_0x25c2d7['name']){delete _0x25c2d7['name'];}_0x1ec170[_0xc89a('0x1b')](_0x2622f1)['send'](_0x25c2d7);};}exports[_0xc89a('0x26')]=function(_0x312093,_0x3d761b){var _0x266b96={},_0x56cd17={},_0x33608c={'count':0x0,'rows':[]};var _0x2e8849=_[_0xc89a('0x27')](db[_0xc89a('0x28')]['rawAttributes'],function(_0x5e5b2e){return{'name':_0x5e5b2e['fieldName'],'type':_0x5e5b2e[_0xc89a('0x29')][_0xc89a('0x2a')]};});_0x56cd17[_0xc89a('0x2b')]=_['map'](_0x2e8849,_0xc89a('0x2c'));_0x56cd17[_0xc89a('0x2d')]=_['keys'](_0x312093[_0xc89a('0x2d')]);_0x56cd17[_0xc89a('0x2e')]=_['intersection'](_0x56cd17[_0xc89a('0x2b')],_0x56cd17[_0xc89a('0x2d')]);_0x266b96[_0xc89a('0x2f')]=_[_0xc89a('0x30')](_0x56cd17[_0xc89a('0x2b')],qs['fields'](_0x312093['query'][_0xc89a('0x31')]));_0x266b96[_0xc89a('0x2f')]=_0x266b96[_0xc89a('0x2f')][_0xc89a('0x32')]?_0x266b96[_0xc89a('0x2f')]:_0x56cd17[_0xc89a('0x2b')];if(!_0x312093[_0xc89a('0x2d')][_0xc89a('0x33')](_0xc89a('0x34'))){_0x266b96[_0xc89a('0x20')]=qs['limit'](_0x312093[_0xc89a('0x2d')][_0xc89a('0x20')]);_0x266b96['offset']=qs[_0xc89a('0x1f')](_0x312093[_0xc89a('0x2d')][_0xc89a('0x1f')]);}_0x266b96['order']=qs['sort'](_0x312093['query'][_0xc89a('0x35')]);_0x266b96[_0xc89a('0x36')]=qs['filters'](_[_0xc89a('0x37')](_0x312093[_0xc89a('0x2d')],_0x56cd17[_0xc89a('0x2e')]),_0x2e8849);if(_0x312093[_0xc89a('0x2d')]['filter']){_0x266b96[_0xc89a('0x36')]=_[_0xc89a('0x38')](_0x266b96[_0xc89a('0x36')],{'$or':_[_0xc89a('0x27')](_0x2e8849,function(_0x215959){if(_0x215959[_0xc89a('0x29')]!=='VIRTUAL'){var _0x43fc08={};_0x43fc08[_0x215959[_0xc89a('0x2c')]]={'$like':'%'+_0x312093[_0xc89a('0x2d')][_0xc89a('0x39')]+'%'};return _0x43fc08;}})});}_0x266b96=_[_0xc89a('0x38')]({},_0x266b96,_0x312093[_0xc89a('0x3a')]);var _0x395259={'where':_0x266b96[_0xc89a('0x36')]};return db[_0xc89a('0x28')][_0xc89a('0x1e')](_0x395259)[_0xc89a('0x23')](function(_0x5c266b){_0x33608c[_0xc89a('0x1e')]=_0x5c266b;if(_0x312093[_0xc89a('0x2d')][_0xc89a('0x3b')]){_0x266b96[_0xc89a('0x3c')]=[{'all':!![]}];}return db[_0xc89a('0x28')][_0xc89a('0x3d')](_0x266b96);})[_0xc89a('0x23')](function(_0x367aa0){_0x33608c[_0xc89a('0x3e')]=_0x367aa0;return _0x33608c;})['then'](respondWithFilteredResult(_0x3d761b,_0x266b96))[_0xc89a('0x3f')](handleError(_0x3d761b,null));};exports[_0xc89a('0x40')]=function(_0x318f54,_0x3d16bd){var _0x5eca20={'raw':!![],'where':{'id':_0x318f54[_0xc89a('0x41')]['id']}},_0x5672bd={};_0x5672bd['model']=_['keys'](db[_0xc89a('0x28')][_0xc89a('0x42')]);_0x5672bd['query']=_[_0xc89a('0x43')](_0x318f54['query']);_0x5672bd['filters']=_[_0xc89a('0x30')](_0x5672bd['model'],_0x5672bd[_0xc89a('0x2d')]);_0x5eca20[_0xc89a('0x2f')]=_['intersection'](_0x5672bd[_0xc89a('0x2b')],qs[_0xc89a('0x31')](_0x318f54[_0xc89a('0x2d')][_0xc89a('0x31')]));_0x5eca20['attributes']=_0x5eca20['attributes'][_0xc89a('0x32')]?_0x5eca20[_0xc89a('0x2f')]:_0x5672bd[_0xc89a('0x2b')];if(_0x318f54['query'][_0xc89a('0x3b')]){_0x5eca20['include']=[{'all':!![]}];}_0x5eca20=_[_0xc89a('0x38')]({},_0x5eca20,_0x318f54['options']);return db[_0xc89a('0x28')]['find'](_0x5eca20)[_0xc89a('0x23')](handleEntityNotFound(_0x3d16bd,null))['then'](respondWithResult(_0x3d16bd,null))[_0xc89a('0x3f')](handleError(_0x3d16bd,null));};exports[_0xc89a('0x44')]=function(_0x27ada9,_0x27143c){var _0x445df2={'where':{'id':_0x27ada9[_0xc89a('0x41')]['id']}},_0x3a3555={};_0x3a3555[_0xc89a('0x2b')]=_[_0xc89a('0x43')](db[_0xc89a('0x28')]['rawAttributes']);_0x445df2[_0xc89a('0x2f')]=_['intersection'](_0x3a3555[_0xc89a('0x2b')],qs['fields'](_0x27ada9[_0xc89a('0x2d')][_0xc89a('0x31')]));_0x445df2[_0xc89a('0x2f')]=_0x445df2['attributes'][_0xc89a('0x32')]?_0x445df2[_0xc89a('0x2f')]:_0x3a3555['model'];if(_0x27ada9[_0xc89a('0x2d')][_0xc89a('0x3b')]){_0x445df2[_0xc89a('0x3c')]=[{'all':!![]}];}_0x445df2=_[_0xc89a('0x38')]({},_0x445df2,_0x27ada9[_0xc89a('0x3a')]);return db['Attachment'][_0xc89a('0x45')](_0x445df2)[_0xc89a('0x23')](handleEntityNotFound(_0x27143c,null))[_0xc89a('0x23')](function(_0x2b6cc3){if(_0x2b6cc3){var _0x4f9280=_0x2b6cc3[_0xc89a('0x46')]({'plain':!![]});_0x4f9280=qs[_0xc89a('0x47')](_0x4f9280,['id',_0xc89a('0x48'),_0xc89a('0x49')]);_0x27ada9[_0xc89a('0x4a')]=_[_0xc89a('0x47')](_0x27ada9[_0xc89a('0x4a')],['id','createdAt',_0xc89a('0x49')]);return db[_0xc89a('0x28')]['create'](_[_0xc89a('0x38')](_0x4f9280,_0x27ada9[_0xc89a('0x4a')]),{'include':_0x27ada9[_0xc89a('0x2d')][_0xc89a('0x3b')]?[{'all':!![]}]:undefined});}})[_0xc89a('0x23')](respondWithResult(_0x27143c,0xc9))[_0xc89a('0x3f')](handleError(_0x27143c,null));};exports[_0xc89a('0x4b')]=function(_0x8a2bef,_0x1528ef){if(_0x8a2bef['body']['id']){delete _0x8a2bef[_0xc89a('0x4a')]['id'];}return db[_0xc89a('0x28')][_0xc89a('0x45')]({'where':{'id':_0x8a2bef[_0xc89a('0x41')]['id']}})[_0xc89a('0x23')](handleEntityNotFound(_0x1528ef,null))[_0xc89a('0x23')](saveUpdates(_0x8a2bef[_0xc89a('0x4a')],null))[_0xc89a('0x23')](respondWithResult(_0x1528ef,null))['catch'](handleError(_0x1528ef,null));};exports[_0xc89a('0x4c')]=function(_0x392bf5,_0x1c0ec0){return db[_0xc89a('0x28')][_0xc89a('0x45')]({'where':{'id':_0x392bf5[_0xc89a('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c0ec0,null))['then'](removeEntity(_0x1c0ec0,null))['catch'](handleError(_0x1c0ec0,null));};exports[_0xc89a('0x4d')]=function(_0x24eadf,_0x311c85,_0x346a4b){_0x24eadf['body'][_0xc89a('0x2c')]=_0x24eadf['file'][_0xc89a('0x4e')];_0x24eadf[_0xc89a('0x4a')][_0xc89a('0x4f')]=_0x24eadf['file'][_0xc89a('0x50')];_0x24eadf['body'][_0xc89a('0x29')]=_0x24eadf['file'][_0xc89a('0x51')];return db[_0xc89a('0x28')]['create'](_0x24eadf[_0xc89a('0x4a')])[_0xc89a('0x23')](respondWithResult(_0x311c85,0xc9))[_0xc89a('0x3f')](handleError(_0x311c85,null));};exports[_0xc89a('0x52')]=function(_0x37154e,_0x52086b,_0x1af5f0){return db[_0xc89a('0x28')]['findOne']({'where':{'id':_0x37154e[_0xc89a('0x41')]['id']},'raw':!![]})[_0xc89a('0x23')](handleEntityNotFound(_0x52086b,null))[_0xc89a('0x23')](function(_0x4fcb1e){if(_0x4fcb1e){return _0x52086b[_0xc89a('0x52')](path[_0xc89a('0x53')](config[_0xc89a('0x54')],'server/files/attachments/',_0x4fcb1e[_0xc89a('0x4f')]));}})[_0xc89a('0x3f')](handleError(_0x52086b,null));}; \ No newline at end of file +var _0xa8b9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','clone','get','omit','updatedAt','body','createdAt','create','destroy','file','basename','filename','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','jsforce'];(function(_0x229a9d,_0x4d3229){var _0x5bd600=function(_0x5f5af9){while(--_0x5f5af9){_0x229a9d['push'](_0x229a9d['shift']());}};_0x5bd600(++_0x4d3229);}(_0xa8b9,0x15a));var _0x9a8b=function(_0x4b2554,_0x7e8b66){_0x4b2554=_0x4b2554-0x0;var _0x41d7b4=_0xa8b9[_0x4b2554];return _0x41d7b4;};'use strict';var pdf=require(_0x9a8b('0x0'));var emlformat=require(_0x9a8b('0x1'));var rimraf=require(_0x9a8b('0x2'));var zipdir=require(_0x9a8b('0x3'));var jsonpatch=require(_0x9a8b('0x4'));var rp=require(_0x9a8b('0x5'));var moment=require('moment');var BPromise=require(_0x9a8b('0x6'));var Mustache=require(_0x9a8b('0x7'));var util=require(_0x9a8b('0x8'));var path=require(_0x9a8b('0x9'));var sox=require(_0x9a8b('0xa'));var csv=require('to-csv');var ejs=require(_0x9a8b('0xb'));var fs=require('fs');var _=require(_0x9a8b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9a8b('0xd'));var deskjs=require(_0x9a8b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9a8b('0xf'));var Papa=require(_0x9a8b('0x10'));var Redis=require(_0x9a8b('0x11'));var authService=require(_0x9a8b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a8b('0x13'));var hardwareService=require(_0x9a8b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9a8b('0x15'));var config=require(_0x9a8b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473cf1,_0x230465){_0x230465=_0x230465||0xcc;return function(_0x374eda){if(_0x374eda){return _0x473cf1[_0x9a8b('0x17')](_0x230465);}return _0x473cf1[_0x9a8b('0x18')](_0x230465)[_0x9a8b('0x19')]();};}function respondWithResult(_0x549caa,_0x3a00f3){_0x3a00f3=_0x3a00f3||0xc8;return function(_0x5c697f){if(_0x5c697f){return _0x549caa[_0x9a8b('0x18')](_0x3a00f3)[_0x9a8b('0x1a')](_0x5c697f);}};}function respondWithFilteredResult(_0x23bd00,_0x1ef478){return function(_0x4481de){if(_0x4481de){var _0x274d41=_0x4481de[_0x9a8b('0x1b')],_0x3a2abe=_0x1ef478[_0x9a8b('0x1c')],_0x100a7d=_0x1ef478[_0x9a8b('0x1c')]+_0x1ef478['limit'],_0x598282;if(_0x100a7d>=_0x274d41){_0x100a7d=_0x274d41;_0x598282=0xc8;}else{_0x598282=0xce;}_0x23bd00[_0x9a8b('0x18')](_0x598282);return _0x23bd00[_0x9a8b('0x1d')](_0x9a8b('0x1e'),_0x3a2abe+'-'+_0x100a7d+'/'+_0x274d41)[_0x9a8b('0x1a')](_0x4481de);}return null;};}function patchUpdates(_0x593aee){return function(_0x45a9bc){try{jsonpatch[_0x9a8b('0x1f')](_0x45a9bc,_0x593aee,!![]);}catch(_0x1d1bb1){return BPromise[_0x9a8b('0x20')](_0x1d1bb1);}return _0x45a9bc[_0x9a8b('0x21')]();};}function saveUpdates(_0x4082db,_0x12836a){return function(_0x561d10){if(_0x561d10){return _0x561d10[_0x9a8b('0x22')](_0x4082db)[_0x9a8b('0x23')](function(_0x343562){return _0x343562;});}return null;};}function removeEntity(_0x39e93b,_0x142619){return function(_0x447846){if(_0x447846){return _0x447846['destroy']()[_0x9a8b('0x23')](function(){_0x39e93b[_0x9a8b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d5427,_0x1940c9){return function(_0x4e2994){if(!_0x4e2994){_0x5d5427['sendStatus'](0x194);}return _0x4e2994;};}function handleError(_0x791cf4,_0x4c1121){_0x4c1121=_0x4c1121||0x1f4;return function(_0x47766a){logger[_0x9a8b('0x24')](_0x47766a[_0x9a8b('0x25')]);if(_0x47766a[_0x9a8b('0x26')]){delete _0x47766a[_0x9a8b('0x26')];}_0x791cf4[_0x9a8b('0x18')](_0x4c1121)[_0x9a8b('0x27')](_0x47766a);};}exports[_0x9a8b('0x28')]=function(_0x1e9bf4,_0x318d42){var _0x28a7c9={},_0x445d9e={},_0x42b7d1={'count':0x0,'rows':[]};var _0x909ca1=_[_0x9a8b('0x29')](db[_0x9a8b('0x2a')][_0x9a8b('0x2b')],function(_0x3a3bb4){return{'name':_0x3a3bb4[_0x9a8b('0x2c')],'type':_0x3a3bb4[_0x9a8b('0x2d')][_0x9a8b('0x2e')]};});_0x445d9e['model']=_[_0x9a8b('0x29')](_0x909ca1,_0x9a8b('0x26'));_0x445d9e[_0x9a8b('0x2f')]=_['keys'](_0x1e9bf4[_0x9a8b('0x2f')]);_0x445d9e[_0x9a8b('0x30')]=_[_0x9a8b('0x31')](_0x445d9e[_0x9a8b('0x32')],_0x445d9e[_0x9a8b('0x2f')]);_0x28a7c9[_0x9a8b('0x33')]=_[_0x9a8b('0x31')](_0x445d9e[_0x9a8b('0x32')],qs['fields'](_0x1e9bf4[_0x9a8b('0x2f')][_0x9a8b('0x34')]));_0x28a7c9[_0x9a8b('0x33')]=_0x28a7c9[_0x9a8b('0x33')][_0x9a8b('0x35')]?_0x28a7c9[_0x9a8b('0x33')]:_0x445d9e[_0x9a8b('0x32')];if(!_0x1e9bf4[_0x9a8b('0x2f')][_0x9a8b('0x36')](_0x9a8b('0x37'))){_0x28a7c9[_0x9a8b('0x38')]=qs[_0x9a8b('0x38')](_0x1e9bf4[_0x9a8b('0x2f')]['limit']);_0x28a7c9[_0x9a8b('0x1c')]=qs[_0x9a8b('0x1c')](_0x1e9bf4[_0x9a8b('0x2f')]['offset']);}_0x28a7c9[_0x9a8b('0x39')]=qs['sort'](_0x1e9bf4[_0x9a8b('0x2f')][_0x9a8b('0x3a')]);_0x28a7c9[_0x9a8b('0x3b')]=qs[_0x9a8b('0x30')](_[_0x9a8b('0x3c')](_0x1e9bf4[_0x9a8b('0x2f')],_0x445d9e[_0x9a8b('0x30')]),_0x909ca1);if(_0x1e9bf4[_0x9a8b('0x2f')][_0x9a8b('0x3d')]){_0x28a7c9[_0x9a8b('0x3b')]=_['merge'](_0x28a7c9[_0x9a8b('0x3b')],{'$or':_[_0x9a8b('0x29')](_0x909ca1,function(_0x414bc5){if(_0x414bc5[_0x9a8b('0x2d')]!==_0x9a8b('0x3e')){var _0x4c141b={};_0x4c141b[_0x414bc5[_0x9a8b('0x26')]]={'$like':'%'+_0x1e9bf4[_0x9a8b('0x2f')]['filter']+'%'};return _0x4c141b;}})});}_0x28a7c9=_[_0x9a8b('0x3f')]({},_0x28a7c9,_0x1e9bf4['options']);var _0xd80203={'where':_0x28a7c9[_0x9a8b('0x3b')]};return db[_0x9a8b('0x2a')]['count'](_0xd80203)[_0x9a8b('0x23')](function(_0xdbd68d){_0x42b7d1[_0x9a8b('0x1b')]=_0xdbd68d;if(_0x1e9bf4[_0x9a8b('0x2f')]['includeAll']){_0x28a7c9[_0x9a8b('0x40')]=[{'all':!![]}];}return db[_0x9a8b('0x2a')][_0x9a8b('0x41')](_0x28a7c9);})[_0x9a8b('0x23')](function(_0x1fa9bd){_0x42b7d1[_0x9a8b('0x42')]=_0x1fa9bd;return _0x42b7d1;})[_0x9a8b('0x23')](respondWithFilteredResult(_0x318d42,_0x28a7c9))[_0x9a8b('0x43')](handleError(_0x318d42,null));};exports[_0x9a8b('0x44')]=function(_0x4ed958,_0x2a8bfc){var _0x14da90={'raw':!![],'where':{'id':_0x4ed958[_0x9a8b('0x45')]['id']}},_0x310e71={};_0x310e71[_0x9a8b('0x32')]=_['keys'](db[_0x9a8b('0x2a')]['rawAttributes']);_0x310e71[_0x9a8b('0x2f')]=_[_0x9a8b('0x46')](_0x4ed958['query']);_0x310e71[_0x9a8b('0x30')]=_[_0x9a8b('0x31')](_0x310e71[_0x9a8b('0x32')],_0x310e71[_0x9a8b('0x2f')]);_0x14da90[_0x9a8b('0x33')]=_['intersection'](_0x310e71[_0x9a8b('0x32')],qs[_0x9a8b('0x34')](_0x4ed958[_0x9a8b('0x2f')][_0x9a8b('0x34')]));_0x14da90['attributes']=_0x14da90[_0x9a8b('0x33')]['length']?_0x14da90[_0x9a8b('0x33')]:_0x310e71['model'];if(_0x4ed958['query'][_0x9a8b('0x47')]){_0x14da90['include']=[{'all':!![]}];}_0x14da90=_[_0x9a8b('0x3f')]({},_0x14da90,_0x4ed958[_0x9a8b('0x48')]);return db[_0x9a8b('0x2a')][_0x9a8b('0x49')](_0x14da90)[_0x9a8b('0x23')](handleEntityNotFound(_0x2a8bfc,null))[_0x9a8b('0x23')](respondWithResult(_0x2a8bfc,null))[_0x9a8b('0x43')](handleError(_0x2a8bfc,null));};exports[_0x9a8b('0x4a')]=function(_0xd3a716,_0x3d7bce){var _0xd98a49={'where':{'id':_0xd3a716[_0x9a8b('0x45')]['id']}},_0x4fb795={};_0x4fb795[_0x9a8b('0x32')]=_[_0x9a8b('0x46')](db[_0x9a8b('0x2a')][_0x9a8b('0x2b')]);_0xd98a49['attributes']=_[_0x9a8b('0x31')](_0x4fb795[_0x9a8b('0x32')],qs[_0x9a8b('0x34')](_0xd3a716[_0x9a8b('0x2f')][_0x9a8b('0x34')]));_0xd98a49['attributes']=_0xd98a49['attributes'][_0x9a8b('0x35')]?_0xd98a49[_0x9a8b('0x33')]:_0x4fb795[_0x9a8b('0x32')];if(_0xd3a716['query'][_0x9a8b('0x47')]){_0xd98a49[_0x9a8b('0x40')]=[{'all':!![]}];}_0xd98a49=_[_0x9a8b('0x3f')]({},_0xd98a49,_0xd3a716[_0x9a8b('0x48')]);return db[_0x9a8b('0x2a')][_0x9a8b('0x49')](_0xd98a49)[_0x9a8b('0x23')](handleEntityNotFound(_0x3d7bce,null))[_0x9a8b('0x23')](function(_0x4ddc81){if(_0x4ddc81){var _0x5aea5f=_0x4ddc81[_0x9a8b('0x4b')]({'plain':!![]});_0x5aea5f=qs[_0x9a8b('0x4c')](_0x5aea5f,['id','createdAt',_0x9a8b('0x4d')]);_0xd3a716[_0x9a8b('0x4e')]=_[_0x9a8b('0x4c')](_0xd3a716[_0x9a8b('0x4e')],['id',_0x9a8b('0x4f'),_0x9a8b('0x4d')]);return db[_0x9a8b('0x2a')][_0x9a8b('0x50')](_['merge'](_0x5aea5f,_0xd3a716[_0x9a8b('0x4e')]),{'include':_0xd3a716['query'][_0x9a8b('0x47')]?[{'all':!![]}]:undefined});}})[_0x9a8b('0x23')](respondWithResult(_0x3d7bce,0xc9))[_0x9a8b('0x43')](handleError(_0x3d7bce,null));};exports[_0x9a8b('0x22')]=function(_0x1ec544,_0x1fb462){if(_0x1ec544[_0x9a8b('0x4e')]['id']){delete _0x1ec544[_0x9a8b('0x4e')]['id'];}return db[_0x9a8b('0x2a')][_0x9a8b('0x49')]({'where':{'id':_0x1ec544['params']['id']}})[_0x9a8b('0x23')](handleEntityNotFound(_0x1fb462,null))[_0x9a8b('0x23')](saveUpdates(_0x1ec544[_0x9a8b('0x4e')],null))[_0x9a8b('0x23')](respondWithResult(_0x1fb462,null))[_0x9a8b('0x43')](handleError(_0x1fb462,null));};exports[_0x9a8b('0x51')]=function(_0x4e4325,_0x22c99e){return db['Attachment'][_0x9a8b('0x49')]({'where':{'id':_0x4e4325[_0x9a8b('0x45')]['id']}})[_0x9a8b('0x23')](handleEntityNotFound(_0x22c99e,null))[_0x9a8b('0x23')](removeEntity(_0x22c99e,null))[_0x9a8b('0x43')](handleError(_0x22c99e,null));};exports[_0x9a8b('0x50')]=function(_0x28b42d,_0x1d869e,_0x3eac0e){_0x28b42d[_0x9a8b('0x4e')]['name']=_0x28b42d[_0x9a8b('0x52')]['originalname'];_0x28b42d[_0x9a8b('0x4e')][_0x9a8b('0x53')]=_0x28b42d[_0x9a8b('0x52')][_0x9a8b('0x54')];_0x28b42d['body'][_0x9a8b('0x2d')]=_0x28b42d['file']['mimetype'];return db['Attachment'][_0x9a8b('0x50')](_0x28b42d['body'])[_0x9a8b('0x23')](respondWithResult(_0x1d869e,0xc9))[_0x9a8b('0x43')](handleError(_0x1d869e,null));};exports[_0x9a8b('0x55')]=function(_0x202b5a,_0xe67410,_0x51afd5){return db[_0x9a8b('0x2a')][_0x9a8b('0x56')]({'where':{'id':_0x202b5a[_0x9a8b('0x45')]['id']},'raw':!![]})[_0x9a8b('0x23')](handleEntityNotFound(_0xe67410,null))['then'](function(_0x5542d7){if(_0x5542d7){return _0xe67410[_0x9a8b('0x55')](path[_0x9a8b('0x57')](config[_0x9a8b('0x58')],_0x9a8b('0x59'),_0x5542d7[_0x9a8b('0x53')]));}})[_0x9a8b('0x43')](handleError(_0xe67410,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6736bd0..76cc185 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 _0x4c6d=['moment','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger','api'];(function(_0x31ec29,_0x58915c){var _0x3275fc=function(_0x435075){while(--_0x435075){_0x31ec29['push'](_0x31ec29['shift']());}};_0x3275fc(++_0x58915c);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x134e47,_0x3c10a4){_0x134e47=_0x134e47-0x0;var _0x81af74=_0x4c6d[_0x134e47];return _0x81af74;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var logger=require(_0xd4c6('0x2'))(_0xd4c6('0x3'));var moment=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4c6('0x5'));var fs=require('fs');var path=require(_0xd4c6('0x6'));var rimraf=require(_0xd4c6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4c6('0x8'));module[_0xd4c6('0x9')]=function(_0x56279c,_0x182671){return _0x56279c[_0xd4c6('0xa')](_0xd4c6('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd28=['rimraf','./attachment.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x502980,_0x4a8565){var _0x42824c=function(_0x166b95){while(--_0x166b95){_0x502980['push'](_0x502980['shift']());}};_0x42824c(++_0x4a8565);}(_0xfd28,0x148));var _0x8fd2=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xfd28[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('Attachment',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 252e562..ec65307 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 _0x74b5=['rpc','../../config/environment','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment','create','body','options','info','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x33f910,_0x5390f){var _0x4e9d50=function(_0x17f787){while(--_0x17f787){_0x33f910['push'](_0x33f910['shift']());}};_0x4e9d50(++_0x5390f);}(_0x74b5,0xd2));var _0x574b=function(_0x17550f,_0x83c06e){_0x17550f=_0x17550f-0x0;var _0x1c3e5a=_0x74b5[_0x17550f];return _0x1c3e5a;};'use strict';var _=require(_0x574b('0x0'));var util=require(_0x574b('0x1'));var moment=require('moment');var BPromise=require(_0x574b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x574b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x574b('0x4'));var logger=require(_0x574b('0x5'))(_0x574b('0x6'));var config=require(_0x574b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x574b('0x8')][_0x574b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45ff03,_0x1ce4ec,_0x578135){return new BPromise(function(_0x1ec349,_0x297764){return client[_0x574b('0xa')](_0x45ff03,_0x578135)[_0x574b('0xb')](function(_0x3742d2){logger['info'](_0x574b('0xc'),_0x1ce4ec,_0x574b('0xd'));logger[_0x574b('0xe')](_0x574b('0xf'),_0x1ce4ec,_0x574b('0xd'),JSON[_0x574b('0x10')](_0x3742d2));if(_0x3742d2[_0x574b('0x11')]){if(_0x3742d2[_0x574b('0x11')]['code']===0x1f4){logger[_0x574b('0x11')]('Attachment,\x20%s,\x20%s',_0x1ce4ec,_0x3742d2[_0x574b('0x11')][_0x574b('0x12')]);return _0x297764(_0x3742d2[_0x574b('0x11')][_0x574b('0x12')]);}logger[_0x574b('0x11')](_0x574b('0xc'),_0x1ce4ec,_0x3742d2[_0x574b('0x11')][_0x574b('0x12')]);return _0x1ec349(_0x3742d2[_0x574b('0x11')][_0x574b('0x12')]);}else{logger['info'](_0x574b('0xc'),_0x1ce4ec,'request\x20sent');_0x1ec349(_0x3742d2[_0x574b('0x13')][_0x574b('0x12')]);}})[_0x574b('0x14')](function(_0x4b5bc2){logger[_0x574b('0x11')](_0x574b('0xc'),_0x1ce4ec,_0x4b5bc2);_0x297764(_0x4b5bc2);});});}exports[_0x574b('0x15')]=function(_0x267e03){var _0x2cea90=this;return new Promise(function(_0x12d592,_0x5ec2c9){return db[_0x574b('0x16')][_0x574b('0x17')](_0x267e03[_0x574b('0x18')],{'raw':_0x267e03[_0x574b('0x19')]?_0x267e03[_0x574b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x574b('0xb')](function(_0x3ef595){logger[_0x574b('0x1a')](_0x574b('0x15'),_0x267e03);logger[_0x574b('0xe')](_0x574b('0x15'),_0x267e03,JSON[_0x574b('0x10')](_0x3ef595));_0x12d592(_0x3ef595);})[_0x574b('0x14')](function(_0x5d779a){logger[_0x574b('0x11')](_0x574b('0x15'),_0x5d779a[_0x574b('0x12')],_0x267e03);_0x5ec2c9(_0x2cea90['error'](0x1f4,_0x5d779a['message']));});});}; \ No newline at end of file +var _0x4210=['request\x20sent','debug','stringify','error','message','result','CreateAttachment','Attachment','create','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x4210,0x6f));var _0x0421=function(_0x641a3e,_0x98de19){_0x641a3e=_0x641a3e-0x0;var _0x1968fc=_0x4210[_0x641a3e];return _0x1968fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0421('0x0'));var BPromise=require(_0x0421('0x1'));var rs=require(_0x0421('0x2'));var fs=require('fs');var Redis=require(_0x0421('0x3'));var db=require(_0x0421('0x4'))['db'];var utils=require(_0x0421('0x5'));var logger=require(_0x0421('0x6'))('rpc');var config=require(_0x0421('0x7'));var jayson=require(_0x0421('0x8'));var client=jayson[_0x0421('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2377,_0x8eb6b0,_0x3dcf38){return new BPromise(function(_0x36506f,_0x810aea){return client[_0x0421('0xa')](_0x3d2377,_0x3dcf38)[_0x0421('0xb')](function(_0x135e27){logger[_0x0421('0xc')](_0x0421('0xd'),_0x8eb6b0,_0x0421('0xe'));logger[_0x0421('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x8eb6b0,_0x0421('0xe'),JSON[_0x0421('0x10')](_0x135e27));if(_0x135e27['error']){if(_0x135e27[_0x0421('0x11')]['code']===0x1f4){logger[_0x0421('0x11')](_0x0421('0xd'),_0x8eb6b0,_0x135e27['error'][_0x0421('0x12')]);return _0x810aea(_0x135e27[_0x0421('0x11')][_0x0421('0x12')]);}logger[_0x0421('0x11')](_0x0421('0xd'),_0x8eb6b0,_0x135e27[_0x0421('0x11')][_0x0421('0x12')]);return _0x36506f(_0x135e27[_0x0421('0x11')][_0x0421('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x8eb6b0,_0x0421('0xe'));_0x36506f(_0x135e27[_0x0421('0x13')][_0x0421('0x12')]);}})['catch'](function(_0x41996b){logger[_0x0421('0x11')](_0x0421('0xd'),_0x8eb6b0,_0x41996b);_0x810aea(_0x41996b);});});}exports[_0x0421('0x14')]=function(_0x5698e3){var _0x188661=this;return new Promise(function(_0x34ddf5,_0x57b3e7){return db[_0x0421('0x15')][_0x0421('0x16')](_0x5698e3['body'],{'raw':_0x5698e3[_0x0421('0x17')]?_0x5698e3[_0x0421('0x17')][_0x0421('0x18')]===undefined?!![]:![]:!![]})[_0x0421('0xb')](function(_0x5cd11f){logger[_0x0421('0xc')](_0x0421('0x14'),_0x5698e3);logger[_0x0421('0xf')](_0x0421('0x14'),_0x5698e3,JSON[_0x0421('0x10')](_0x5cd11f));_0x34ddf5(_0x5cd11f);})['catch'](function(_0x3bda01){logger['error'](_0x0421('0x14'),_0x3bda01['message'],_0x5698e3);_0x57b3e7(_0x188661['error'](0x1f4,_0x3bda01[_0x0421('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 12dcd78..5db37db 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 _0x0c07=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','show','/:id/download','post','diskStorage','%s-%s','originalname','replace','single','file','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0x0c07,0x8b));var _0x70c0=function(_0x27906a,_0x3d58c8){_0x27906a=_0x27906a-0x0;var _0x3c956b=_0x0c07[_0x27906a];return _0x3c956b;};'use strict';var multer=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var path=require(_0x70c0('0x2'));var timeout=require(_0x70c0('0x3'));var express=require(_0x70c0('0x4'));var router=express[_0x70c0('0x5')]();var auth=require(_0x70c0('0x6'));var interaction=require(_0x70c0('0x7'));var config=require(_0x70c0('0x8'));var controller=require(_0x70c0('0x9'));router[_0x70c0('0xa')]('/',auth[_0x70c0('0xb')](),controller['index']);router[_0x70c0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x70c0('0xc')]);router[_0x70c0('0xa')](_0x70c0('0xd'),auth[_0x70c0('0xb')](),controller['download']);router[_0x70c0('0xe')]('/:id/clone',auth[_0x70c0('0xb')](),controller['clone']);var upload=multer({'storage':multer[_0x70c0('0xf')]({'destination':function(_0x4eb652,_0x1dfa50,_0x50ac83){_0x50ac83(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x36bb29,_0x3bc340,_0x361035){_0x361035(null,util['format'](_0x70c0('0x10'),Date['now'](),_0x3bc340[_0x70c0('0x11')][_0x70c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x70c0('0xe')]('/',upload[_0x70c0('0x13')](_0x70c0('0x14')),controller[_0x70c0('0x15')]);router[_0x70c0('0x16')](_0x70c0('0x17'),auth[_0x70c0('0xb')](),controller[_0x70c0('0x18')]);router[_0x70c0('0x19')]('/:id',auth[_0x70c0('0xb')](),controller[_0x70c0('0x1a')]);module[_0x70c0('0x1b')]=router; \ No newline at end of file +var _0xf34f=['originalname','replace','single','file','create','put','isAuthenticated','update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','download','post','/:id/clone','clone','diskStorage','join','server/files/attachments/','format','%s-%s','now'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf34f,0x64));var _0xff34=function(_0x30e30b,_0x92487d){_0x30e30b=_0x30e30b-0x0;var _0x7574d3=_0xf34f[_0x30e30b];return _0x7574d3;};'use strict';var multer=require(_0xff34('0x0'));var util=require('util');var path=require(_0xff34('0x1'));var timeout=require('connect-timeout');var express=require(_0xff34('0x2'));var router=express['Router']();var auth=require(_0xff34('0x3'));var interaction=require(_0xff34('0x4'));var config=require(_0xff34('0x5'));var controller=require('./attachment.controller');router[_0xff34('0x6')]('/',auth['isAuthenticated'](),controller[_0xff34('0x7')]);router['get'](_0xff34('0x8'),auth['isAuthenticated'](),controller[_0xff34('0x9')]);router[_0xff34('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0xff34('0xa')]);router[_0xff34('0xb')](_0xff34('0xc'),auth['isAuthenticated'](),controller[_0xff34('0xd')]);var upload=multer({'storage':multer[_0xff34('0xe')]({'destination':function(_0x58d065,_0x31427c,_0x23bc11){_0x23bc11(null,path[_0xff34('0xf')](config['root'],_0xff34('0x10')));},'filename':function(_0x305801,_0x2e3d0a,_0x3fa22f){_0x3fa22f(null,util[_0xff34('0x11')](_0xff34('0x12'),Date[_0xff34('0x13')](),_0x2e3d0a[_0xff34('0x14')][_0xff34('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xff34('0xb')]('/',upload[_0xff34('0x16')](_0xff34('0x17')),controller[_0xff34('0x18')]);router[_0xff34('0x19')](_0xff34('0x8'),auth[_0xff34('0x1a')](),controller[_0xff34('0x1b')]);router[_0xff34('0x1c')](_0xff34('0x8'),auth[_0xff34('0x1a')](),controller['destroy']);module[_0xff34('0x1d')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a5a0cbb..a53d22f 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 _0x328c=['then','User','find','value','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','email','callback','authenticate','/login','use','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0x328c,0xa2));var _0xc328=function(_0xed7be,_0x2d6fb0){_0xed7be=_0xed7be-0x0;var _0x4f85b0=_0x328c[_0xed7be];return _0x4f85b0;};'use strict';var _=require(_0xc328('0x0'));var passport=require(_0xc328('0x1'));var GoogleStrategy=require(_0xc328('0x2'))[_0xc328('0x3')];var moment=require('moment');var db=require(_0xc328('0x4'))['db'];var config=require(_0xc328('0x5'));var signToken=require(_0xc328('0x6'))[_0xc328('0x7')];var utils=require(_0xc328('0x8'));exports[_0xc328('0x9')]=passport['authenticate'](_0xc328('0xa'),{'failureRedirect':'/login','scope':['profile',_0xc328('0xb')],'session':![]});exports[_0xc328('0xc')]=passport[_0xc328('0xd')]('google',{'failureRedirect':_0xc328('0xe'),'session':![]});passport[_0xc328('0xf')](new GoogleStrategy({'clientID':config[_0xc328('0xa')]?config[_0xc328('0xa')][_0xc328('0x10')]:'id','clientSecret':config[_0xc328('0xa')]?config[_0xc328('0xa')][_0xc328('0x11')]:_0xc328('0x12'),'callbackURL':config[_0xc328('0xa')]?config[_0xc328('0xa')][_0xc328('0x13')]:''},function(_0x5314cf,_0x2ed8da,_0x125378,_0x1d4d48){var _0x2bc073,_0x3b717e;return db['Setting'][_0xc328('0x14')]({'where':{'id':0x1},'attributes':[_0xc328('0x15'),_0xc328('0x16')],'raw':!![]})[_0xc328('0x17')](function(_0x498d6f){_0x2bc073=_0x498d6f;return db[_0xc328('0x18')][_0xc328('0x19')]({'where':{'email':_['map'](_0x125378['emails'],_0xc328('0x1a')),'role':{'$or':[_0xc328('0x1b'),'user',_0xc328('0x1c')]}}});})[_0xc328('0x17')](function(_0x25cf17){_0x3b717e=_0x25cf17;if(_0x3b717e){if(_0x3b717e['disabled']){return _0x1d4d48(_0xc328('0x1d'));}else if(_0x2bc073[_0xc328('0x16')]>0x0){if(_0x3b717e[_0xc328('0x1e')]){if(moment(_0x3b717e[_0xc328('0x1f')])[_0xc328('0x20')](_0x2bc073[_0xc328('0x16')],_0xc328('0x21'))>moment()){return _0x1d4d48('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xc328('0x22')](_0x3b717e,0x0,![],null)[_0xc328('0x17')](function(){return utils[_0xc328('0x23')](_0x3b717e);})[_0xc328('0x17')](function(){return _0x1d4d48(null,_0x3b717e);});}}else{return utils[_0xc328('0x23')](_0x3b717e)[_0xc328('0x17')](function(){return _0x1d4d48(null,_0x3b717e);});}}else{return utils[_0xc328('0x23')](_0x3b717e)[_0xc328('0x17')](function(){return _0x1d4d48(null,_0x3b717e);});}}return _0x1d4d48(_0xc328('0x1d'));})[_0xc328('0x24')](function(_0x5ae2fe){_0x1d4d48(_0x5ae2fe);});})); \ No newline at end of file +var _0x32d1=['authenticate','google','/login','profile','email','use','clientID','clientSecret','secret','findOne','allowedLoginAttempts','then','map','emails','value','admin','user','agent','blocked','add','blockDuration','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','lodash','passport','Strategy','../../components/auth/service','signToken','../../config/utils','login'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x32d1,0xb3));var _0x132d=function(_0x22a924,_0x3b893c){_0x22a924=_0x22a924-0x0;var _0xf76f64=_0x32d1[_0x22a924];return _0xf76f64;};'use strict';var _=require(_0x132d('0x0'));var passport=require(_0x132d('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x132d('0x2')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require(_0x132d('0x3'))[_0x132d('0x4')];var utils=require(_0x132d('0x5'));exports[_0x132d('0x6')]=passport[_0x132d('0x7')](_0x132d('0x8'),{'failureRedirect':_0x132d('0x9'),'scope':[_0x132d('0xa'),_0x132d('0xb')],'session':![]});exports['callback']=passport[_0x132d('0x7')](_0x132d('0x8'),{'failureRedirect':_0x132d('0x9'),'session':![]});passport[_0x132d('0xc')](new GoogleStrategy({'clientID':config[_0x132d('0x8')]?config[_0x132d('0x8')][_0x132d('0xd')]:'id','clientSecret':config[_0x132d('0x8')]?config[_0x132d('0x8')][_0x132d('0xe')]:_0x132d('0xf'),'callbackURL':config['google']?config[_0x132d('0x8')]['callbackURL']:''},function(_0x5491db,_0x2febb5,_0x580cc2,_0x26f4f6){var _0x257b50,_0x176fbb;return db['Setting'][_0x132d('0x10')]({'where':{'id':0x1},'attributes':[_0x132d('0x11'),'blockDuration'],'raw':!![]})[_0x132d('0x12')](function(_0x42b223){_0x257b50=_0x42b223;return db['User']['find']({'where':{'email':_[_0x132d('0x13')](_0x580cc2[_0x132d('0x14')],_0x132d('0x15')),'role':{'$or':[_0x132d('0x16'),_0x132d('0x17'),_0x132d('0x18')]}}});})['then'](function(_0x2e983d){_0x176fbb=_0x2e983d;if(_0x176fbb){if(_0x176fbb['disabled']){return _0x26f4f6('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x257b50['blockDuration']>0x0){if(_0x176fbb[_0x132d('0x19')]){if(moment(_0x176fbb['blockedAt'])[_0x132d('0x1a')](_0x257b50[_0x132d('0x1b')],_0x132d('0x1c'))>moment()){return _0x26f4f6(_0x132d('0x1d'));}else{return utils['clearBlockUser'](_0x176fbb,0x0,![],null)[_0x132d('0x12')](function(){return utils[_0x132d('0x1e')](_0x176fbb);})['then'](function(){return _0x26f4f6(null,_0x176fbb);});}}else{return utils[_0x132d('0x1e')](_0x176fbb)[_0x132d('0x12')](function(){return _0x26f4f6(null,_0x176fbb);});}}else{return utils[_0x132d('0x1e')](_0x176fbb)[_0x132d('0x12')](function(){return _0x26f4f6(null,_0x176fbb);});}}return _0x26f4f6(_0x132d('0x1d'));})['catch'](function(_0x54c956){_0x26f4f6(_0x54c956);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index c2e4adc..d8f405a 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 _0xa37e=['../user/user.controller.js','../../components/auth/service','login','/callback','callback','isMiddleware','exports','Router','./authGoogle.controller'];(function(_0x2dca3e,_0x4be18a){var _0x281b63=function(_0x21c969){while(--_0x21c969){_0x2dca3e['push'](_0x2dca3e['shift']());}};_0x281b63(++_0x4be18a);}(_0xa37e,0x97));var _0xea37=function(_0x5b3361,_0x4dc64e){_0x5b3361=_0x5b3361-0x0;var _0x126dbb=_0xa37e[_0x5b3361];return _0x126dbb;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0xea37('0x0')]();var controller=require(_0xea37('0x1'));var userController=require(_0xea37('0x2'));var authService=require(_0xea37('0x3'));router['get']('/',controller[_0xea37('0x4')]);router['get'](_0xea37('0x5'),controller[_0xea37('0x6')],authService[_0xea37('0x7')],userController['login'],authService['setTokenCookie']);module[_0xea37('0x8')]=router; \ No newline at end of file +var _0x13c0=['express','passport','Router','./authGoogle.controller','login','get','/callback','callback','isMiddleware','setTokenCookie','exports'];(function(_0x1680aa,_0x58d67a){var _0xaabf05=function(_0x645e3a){while(--_0x645e3a){_0x1680aa['push'](_0x1680aa['shift']());}};_0xaabf05(++_0x58d67a);}(_0x13c0,0x79));var _0x013c=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0x13c0[_0x352b44];return _0x3e8baa;};'use strict';var express=require(_0x013c('0x0'));var passport=require(_0x013c('0x1'));var router=express[_0x013c('0x2')]();var controller=require(_0x013c('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x013c('0x4')]);router[_0x013c('0x5')](_0x013c('0x6'),controller[_0x013c('0x7')],authService[_0x013c('0x8')],userController[_0x013c('0x4')],authService[_0x013c('0x9')]);module[_0x013c('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e605de5..a0ba179 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 _0xe6a5=['loginAttempts','admin','agent','then','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','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','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','token','now','securePassword','resetPasswordToken','Password\x20reset!','use','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','password','salt','role','disabled','blocked','blockedAt'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe6a5,0x13b));var _0x5e6a=function(_0x1e69fa,_0x397755){_0x1e69fa=_0x1e69fa-0x0;var _0x4fcf7=_0xe6a5[_0x1e69fa];return _0x4fcf7;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')[_0x5e6a('0x0')];var jayson=require(_0x5e6a('0x1'));var _=require(_0x5e6a('0x2'));var rs=require(_0x5e6a('0x3'));var moment=require('moment');var db=require(_0x5e6a('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5e6a('0x5'));var client=jayson[_0x5e6a('0x6')][_0x5e6a('0x7')]({'port':0x232b});function localAuthenticate(_0x346e04,_0x1aa798,_0x11ab77,_0x2f34a0){var _0x26ea18,_0x26e98e;return db[_0x5e6a('0x8')][_0x5e6a('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5e6a('0xa')],'raw':!![]})['then'](function(_0x37bf3c){_0x26ea18=_0x37bf3c;return _0x346e04[_0x5e6a('0x9')]({'attributes':['id','name',_0x5e6a('0xb'),_0x5e6a('0xc'),_0x5e6a('0xd'),_0x5e6a('0xe'),_0x5e6a('0xf'),_0x5e6a('0x10'),_0x5e6a('0x11')],'where':{'name':_0x1aa798,'role':{'$or':[_0x5e6a('0x12'),'user',_0x5e6a('0x13')]}}});})[_0x5e6a('0x14')](function(_0x38f184){if(!_0x38f184||_0x38f184&&_0x38f184[_0x5e6a('0x15')]!==_0x1aa798){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x26e98e=_0x38f184;return _0x26e98e;}})[_0x5e6a('0x14')](function(){_0x26e98e[_0x5e6a('0x16')](_0x11ab77,function(_0x5e2870,_0x559867){var _0x312c15=_0x26e98e[_0x5e6a('0x11')]+0x1;if(_0x5e2870){return _0x2f34a0(_0x5e2870);}else if(!_0x559867){if(_0x26e98e[_0x5e6a('0xe')]){return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});}else if(_0x26ea18[_0x5e6a('0x18')]>0x0){if(_0x26e98e['blocked']){if(_0x26ea18[_0x5e6a('0xa')]>0x0){if(moment(_0x26e98e[_0x5e6a('0x10')])['add'](_0x26ea18[_0x5e6a('0xa')],_0x5e6a('0x19'))>moment()){return _0x2f34a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5e6a('0x1a')](_0x26e98e,_0x312c15,![],null)['then'](function(){return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});});}}else{return _0x2f34a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x312c15>=_0x26ea18[_0x5e6a('0x18')]){return utils[_0x5e6a('0x1a')](_0x26e98e,0x0,!![],moment())[_0x5e6a('0x14')](function(){return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});});}else{return utils[_0x5e6a('0x1a')](_0x26e98e,_0x312c15,![],null)[_0x5e6a('0x14')](function(){return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});});}}}else{return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});}}else{if(_0x26e98e[_0x5e6a('0xe')]){return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});}else if(_0x26ea18[_0x5e6a('0x18')]>0x0){if(_0x26e98e['blocked']){if(_0x26ea18[_0x5e6a('0xa')]>0x0){if(moment(_0x26e98e[_0x5e6a('0x10')])['add'](_0x26ea18[_0x5e6a('0xa')],_0x5e6a('0x19'))>moment()){return _0x2f34a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x26e98e,0x0,![],null)[_0x5e6a('0x14')](function(){return utils['getLicense'](_0x26e98e);})[_0x5e6a('0x14')](function(){return _0x2f34a0(null,_0x26e98e);});}}else{return _0x2f34a0(null,![],{'message':_0x5e6a('0x17')});}}else{return utils['clearBlockUser'](_0x26e98e,0x0,![],null)['then'](function(){return utils[_0x5e6a('0x1b')](_0x26e98e);})[_0x5e6a('0x14')](function(){return _0x2f34a0(null,_0x26e98e);})['catch'](function(_0x4ad0f1){return _0x2f34a0(null,![],_0x4ad0f1);});}}else{if(_0x26e98e[_0x5e6a('0xf')]){return _0x2f34a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5e6a('0x1b')](_0x26e98e)['then'](function(){return _0x2f34a0(null,_0x26e98e);});}}}});})[_0x5e6a('0x1c')](function(_0x2a1670){return _0x2f34a0(null,![],_0x2a1670);});}function sendServiceMail(_0x5bd9dc){return db[_0x5e6a('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0x5e6a('0x15'),_0x5e6a('0x1e')],'include':[{'model':db[_0x5e6a('0x1f')],'as':_0x5e6a('0x20')}]})[_0x5e6a('0x14')](function(_0x9f776f){if(!_0x9f776f){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x20eff8={'tls':{'rejectUnauthorized':![]}};if(_0x9f776f[_0x5e6a('0x20')][_0x5e6a('0x21')]){_0x20eff8['service']=_0x9f776f['Smtp'][_0x5e6a('0x21')];}else{_0x20eff8[_0x5e6a('0x22')]=_0x9f776f['Smtp']['host'];_0x20eff8[_0x5e6a('0x23')]=_0x9f776f[_0x5e6a('0x20')]['port'];_0x20eff8[_0x5e6a('0x24')]=_0x9f776f[_0x5e6a('0x20')]['secure'];}if(_0x9f776f[_0x5e6a('0x20')][_0x5e6a('0x25')]){_0x20eff8[_0x5e6a('0x26')]={'user':_0x9f776f[_0x5e6a('0x20')]['user'],'pass':_0x9f776f[_0x5e6a('0x20')][_0x5e6a('0x27')]};}var _0x584373={'account':_0x20eff8,'message':_[_0x5e6a('0x28')]({'from':util[_0x5e6a('0x29')]('\x22%s\x22\x20<%s>',_0x9f776f[_0x5e6a('0x15')],_0x9f776f['email']||_0x9f776f[_0x5e6a('0x20')][_0x5e6a('0x2a')])},_0x5bd9dc)};return client['request'](_0x5e6a('0x2b'),_0x584373);})[_0x5e6a('0x14')](function(_0x518ad3){if(_0x518ad3[_0x5e6a('0x2c')]){throw new Error(util['format'](_0x5e6a('0x2d'),_0x518ad3[_0x5e6a('0x2c')][_0x5e6a('0x2e')]||JSON[_0x5e6a('0x2f')](_0x518ad3[_0x5e6a('0x2c')])));}return!![];});}function handleError(_0x289f0a,_0x50afb3,_0x229401){return _0x289f0a['status'](_0x50afb3||0x1f4)[_0x5e6a('0x30')]({'message':_0x229401?_0x229401[_0x5e6a('0x2e')]||_0x229401:''});}function checkPasswordPattern(_0x131844,_0x51c97a,_0x440149){if(_0x440149){var _0x489fb4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x489fb4[_0x5e6a('0x31')](_0x51c97a)){return _0x131844;}else{throw new Error(_0x5e6a('0x32'));}}else{return _0x131844;}}exports[_0x5e6a('0x33')]=function(_0x281f3e,_0x3c6548,_0x32de06){passport['authenticate'](_0x5e6a('0x34'),function(_0x18a87d,_0x11a0c1,_0x33ed82){var _0x47742b=_0x18a87d||_0x33ed82;if(_0x47742b){return handleError(_0x3c6548,0x191,_0x47742b);}if(!_0x11a0c1){return handleError(_0x3c6548,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4c6362={'payload':{'id':_0x11a0c1['id'],'role':_0x11a0c1[_0x5e6a('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0x5e6a('0x35')](_0x4c6362)[_0x5e6a('0x14')](function(_0x113bab){_0x3c6548[_0x5e6a('0x36')]({'id':_0x11a0c1['id'],'token':_0x113bab,'statusCall':'','isAlreadyLogged':_0x11a0c1[_0x5e6a('0x37')]});});}})(_0x281f3e,_0x3c6548,_0x32de06);};exports['forgot']=function(_0x4ec6fa,_0x586c83,_0x4e37bd){if(!_0x4ec6fa['body'][_0x5e6a('0x1e')]){return handleError(_0x586c83,0x1f4,{'message':_0x5e6a('0x38')});}var _0x1c38a8=rs[_0x5e6a('0x39')]();_0x4ec6fa[_0x5e6a('0x3a')][_0x5e6a('0x1e')]=_0x4ec6fa['body'][_0x5e6a('0x1e')][_0x5e6a('0x3b')]()[_0x5e6a('0x3c')]();var _0x529251;return db['Setting'][_0x5e6a('0x9')]({'where':{'id':0x1},'attributes':[_0x5e6a('0x18'),_0x5e6a('0xa')],'raw':!![]})[_0x5e6a('0x14')](function(_0x5016f2){_0x529251=_0x5016f2;return db[_0x5e6a('0x3d')][_0x5e6a('0x3e')]({'where':{'email':_0x4ec6fa[_0x5e6a('0x3a')][_0x5e6a('0x1e')]}});})[_0x5e6a('0x14')](function(_0x252ee5){if(!_0x252ee5){throw new Error(_0x5e6a('0x3f'));}if(_0x252ee5[_0x5e6a('0xe')]){throw new Error(_0x5e6a('0x40'));}if(_0x252ee5[_0x5e6a('0xf')]){if(moment(_0x252ee5[_0x5e6a('0x10')])[_0x5e6a('0x41')](_0x529251[_0x5e6a('0xa')],'minutes')>moment()){throw new Error(_0x5e6a('0x42'));}else{_0x252ee5[_0x5e6a('0xf')]=![];_0x252ee5['blockedAt']=null;}}_0x252ee5['resetPasswordToken']=_0x1c38a8;_0x252ee5[_0x5e6a('0x43')]=Date['now']()+0x36ee80;return _0x252ee5[_0x5e6a('0x44')]();})[_0x5e6a('0x14')](function(){return sendServiceMail({'to':_0x4ec6fa[_0x5e6a('0x3a')][_0x5e6a('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x5e6a('0x45')+_0x5e6a('0x46')+_0x4ec6fa[_0x5e6a('0x47')]['host']+_0x5e6a('0x48')+_0x1c38a8+'\x0a\x0a'+_0x5e6a('0x49')});})[_0x5e6a('0x14')](function(){_0x586c83[_0x5e6a('0x4a')](0xc8)[_0x5e6a('0x30')]({'message':_0x5e6a('0x4b')});})[_0x5e6a('0x1c')](function(_0x5ee4bf){return handleError(_0x586c83,0x1f4,_0x5ee4bf);});};exports[_0x5e6a('0x4c')]=function(_0x4b31a1,_0x2ddcf7,_0x458951){var _0xde0d61;return db['User'][_0x5e6a('0x3e')]({'where':{'resetPasswordToken':_0x4b31a1['params'][_0x5e6a('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x5e6a('0x4e')]()}}})['then'](function(_0x51a67c){_0xde0d61=_0x51a67c;if(!_0xde0d61){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x5e6a('0x8')][_0x5e6a('0x9')]({'attributes':['id',_0x5e6a('0x4f')]});})[_0x5e6a('0x14')](function(_0x18e365){return checkPasswordPattern(_0x18e365,_0x4b31a1[_0x5e6a('0x3a')][_0x5e6a('0xb')],_0x18e365[_0x5e6a('0x4f')]);})[_0x5e6a('0x14')](function(){_0xde0d61['password']=_0x4b31a1[_0x5e6a('0x3a')][_0x5e6a('0xb')];_0xde0d61[_0x5e6a('0x50')]=null;_0xde0d61[_0x5e6a('0x43')]=null;return _0xde0d61['save']();})['then'](function(){_0x2ddcf7[_0x5e6a('0x4a')](0xc8)[_0x5e6a('0x30')]({'message':_0x5e6a('0x51')});})[_0x5e6a('0x1c')](function(_0x2a3cb4){return handleError(_0x2ddcf7,0x1f4,_0x2a3cb4);});};passport[_0x5e6a('0x52')](new LocalStrategy({'usernameField':_0x5e6a('0x15'),'passwordField':'password'},function(_0x544d09,_0x57fd36,_0x5afc26){return localAuthenticate(db['User'],_0x544d09,_0x57fd36,_0x5afc26);})); \ No newline at end of file +var _0x7bae=['Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','passport','passport-local','Strategy','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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\x20Email\x20sent!','reset','params','token'];(function(_0x344ac3,_0x4ccdef){var _0x40add2=function(_0x46493d){while(--_0x46493d){_0x344ac3['push'](_0x344ac3['shift']());}};_0x40add2(++_0x4ccdef);}(_0x7bae,0xaa));var _0xe7ba=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x7bae[_0x10004e];return _0x5af990;};'use strict';var util=require('util');var passport=require(_0xe7ba('0x0'));var LocalStrategy=require(_0xe7ba('0x1'))[_0xe7ba('0x2')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xe7ba('0x3'));var moment=require(_0xe7ba('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xe7ba('0x5'));var utils=require(_0xe7ba('0x6'));var client=jayson[_0xe7ba('0x7')][_0xe7ba('0x8')]({'port':0x232b});function localAuthenticate(_0x3d4d89,_0x13551f,_0x59f646,_0x615c05){var _0x24d4fb,_0x479c0e;return db[_0xe7ba('0x9')][_0xe7ba('0xa')]({'where':{'id':0x1},'attributes':[_0xe7ba('0xb'),'blockDuration'],'raw':!![]})[_0xe7ba('0xc')](function(_0x42ebc2){_0x24d4fb=_0x42ebc2;return _0x3d4d89[_0xe7ba('0xa')]({'attributes':['id',_0xe7ba('0xd'),_0xe7ba('0xe'),'salt',_0xe7ba('0xf'),_0xe7ba('0x10'),_0xe7ba('0x11'),'blockedAt',_0xe7ba('0x12')],'where':{'name':_0x13551f,'role':{'$or':['admin',_0xe7ba('0x13'),_0xe7ba('0x14')]}}});})[_0xe7ba('0xc')](function(_0x5b87ca){if(!_0x5b87ca||_0x5b87ca&&_0x5b87ca[_0xe7ba('0xd')]!==_0x13551f){throw new Error(_0xe7ba('0x15'));}else{_0x479c0e=_0x5b87ca;return _0x479c0e;}})[_0xe7ba('0xc')](function(){_0x479c0e[_0xe7ba('0x16')](_0x59f646,function(_0x1d5389,_0x7ac0c7){var _0xe55a5b=_0x479c0e[_0xe7ba('0x12')]+0x1;if(_0x1d5389){return _0x615c05(_0x1d5389);}else if(!_0x7ac0c7){if(_0x479c0e['disabled']){return _0x615c05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x24d4fb['allowedLoginAttempts']>0x0){if(_0x479c0e[_0xe7ba('0x11')]){if(_0x24d4fb[_0xe7ba('0x17')]>0x0){if(moment(_0x479c0e[_0xe7ba('0x18')])[_0xe7ba('0x19')](_0x24d4fb[_0xe7ba('0x17')],_0xe7ba('0x1a'))>moment()){return _0x615c05(null,![],{'message':_0xe7ba('0x15')});}else{return utils[_0xe7ba('0x1b')](_0x479c0e,_0xe55a5b,![],null)[_0xe7ba('0xc')](function(){return _0x615c05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x615c05(null,![],{'message':_0xe7ba('0x15')});}}else{if(_0xe55a5b>=_0x24d4fb[_0xe7ba('0xb')]){return utils[_0xe7ba('0x1b')](_0x479c0e,0x0,!![],moment())[_0xe7ba('0xc')](function(){return _0x615c05(null,![],{'message':_0xe7ba('0x15')});});}else{return utils['clearBlockUser'](_0x479c0e,_0xe55a5b,![],null)[_0xe7ba('0xc')](function(){return _0x615c05(null,![],{'message':_0xe7ba('0x15')});});}}}else{return _0x615c05(null,![],{'message':_0xe7ba('0x15')});}}else{if(_0x479c0e[_0xe7ba('0x10')]){return _0x615c05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x24d4fb[_0xe7ba('0xb')]>0x0){if(_0x479c0e[_0xe7ba('0x11')]){if(_0x24d4fb[_0xe7ba('0x17')]>0x0){if(moment(_0x479c0e[_0xe7ba('0x18')])[_0xe7ba('0x19')](_0x24d4fb[_0xe7ba('0x17')],'minutes')>moment()){return _0x615c05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe7ba('0x1b')](_0x479c0e,0x0,![],null)[_0xe7ba('0xc')](function(){return utils[_0xe7ba('0x1c')](_0x479c0e);})[_0xe7ba('0xc')](function(){return _0x615c05(null,_0x479c0e);});}}else{return _0x615c05(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x479c0e,0x0,![],null)[_0xe7ba('0xc')](function(){return utils[_0xe7ba('0x1c')](_0x479c0e);})[_0xe7ba('0xc')](function(){return _0x615c05(null,_0x479c0e);})[_0xe7ba('0x1d')](function(_0x42939a){return _0x615c05(null,![],_0x42939a);});}}else{if(_0x479c0e[_0xe7ba('0x11')]){return _0x615c05(null,![],{'message':_0xe7ba('0x15')});}else{return utils['getLicense'](_0x479c0e)[_0xe7ba('0xc')](function(){return _0x615c05(null,_0x479c0e);});}}}});})[_0xe7ba('0x1d')](function(_0x3ded57){return _0x615c05(null,![],_0x3ded57);});}function sendServiceMail(_0x4bd57f){return db[_0xe7ba('0x1e')][_0xe7ba('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xe7ba('0xd'),_0xe7ba('0x20')],'include':[{'model':db[_0xe7ba('0x21')],'as':'Smtp'}]})['then'](function(_0x5dcc74){if(!_0x5dcc74){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3d58c0={'tls':{'rejectUnauthorized':![]}};if(_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x23')]){_0x3d58c0['service']=_0x5dcc74['Smtp'][_0xe7ba('0x23')];}else{_0x3d58c0[_0xe7ba('0x24')]=_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x24')];_0x3d58c0[_0xe7ba('0x25')]=_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x25')];_0x3d58c0['secure']=_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x26')];}if(_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x27')]){_0x3d58c0[_0xe7ba('0x28')]={'user':_0x5dcc74['Smtp'][_0xe7ba('0x13')],'pass':_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x29')]};}var _0xd9477c={'account':_0x3d58c0,'message':_[_0xe7ba('0x2a')]({'from':util[_0xe7ba('0x2b')](_0xe7ba('0x2c'),_0x5dcc74[_0xe7ba('0xd')],_0x5dcc74[_0xe7ba('0x20')]||_0x5dcc74[_0xe7ba('0x22')][_0xe7ba('0x13')])},_0x4bd57f)};return client[_0xe7ba('0x2d')](_0xe7ba('0x2e'),_0xd9477c);})[_0xe7ba('0xc')](function(_0x35c351){if(_0x35c351[_0xe7ba('0x2f')]){throw new Error(util[_0xe7ba('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x35c351['error'][_0xe7ba('0x30')]||JSON[_0xe7ba('0x31')](_0x35c351[_0xe7ba('0x2f')])));}return!![];});}function handleError(_0x307692,_0x52fbe7,_0x24b343){return _0x307692[_0xe7ba('0x32')](_0x52fbe7||0x1f4)[_0xe7ba('0x33')]({'message':_0x24b343?_0x24b343['message']||_0x24b343:''});}function checkPasswordPattern(_0x2314b9,_0x34c4ee,_0x6b355){if(_0x6b355){var _0x36a4d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36a4d5[_0xe7ba('0x34')](_0x34c4ee)){return _0x2314b9;}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 _0x2314b9;}}exports[_0xe7ba('0x35')]=function(_0x2ab7b9,_0x36fc32,_0x43e17c){passport['authenticate'](_0xe7ba('0x36'),function(_0x2b3bda,_0x4a50f4,_0x72d64e){var _0x3a5ff0=_0x2b3bda||_0x72d64e;if(_0x3a5ff0){return handleError(_0x36fc32,0x191,_0x3a5ff0);}if(!_0x4a50f4){return handleError(_0x36fc32,0x194,{'message':_0xe7ba('0x37')});}else{var _0x32be26={'payload':{'id':_0x4a50f4['id'],'role':_0x4a50f4[_0xe7ba('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xe7ba('0x38')](_0x32be26)['then'](function(_0x3529b7){_0x36fc32[_0xe7ba('0x39')]({'id':_0x4a50f4['id'],'token':_0x3529b7,'statusCall':'','isAlreadyLogged':_0x4a50f4[_0xe7ba('0x3a')]});});}})(_0x2ab7b9,_0x36fc32,_0x43e17c);};exports['forgot']=function(_0x275529,_0x24729f,_0x195916){if(!_0x275529[_0xe7ba('0x3b')][_0xe7ba('0x20')]){return handleError(_0x24729f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x118365=rs[_0xe7ba('0x3c')]();_0x275529[_0xe7ba('0x3b')][_0xe7ba('0x20')]=_0x275529[_0xe7ba('0x3b')]['email'][_0xe7ba('0x3d')]()[_0xe7ba('0x3e')]();var _0x3239c1;return db['Setting'][_0xe7ba('0xa')]({'where':{'id':0x1},'attributes':[_0xe7ba('0xb'),_0xe7ba('0x17')],'raw':!![]})[_0xe7ba('0xc')](function(_0x2c8536){_0x3239c1=_0x2c8536;return db[_0xe7ba('0x3f')][_0xe7ba('0x1f')]({'where':{'email':_0x275529[_0xe7ba('0x3b')][_0xe7ba('0x20')]}});})['then'](function(_0xcc2cd2){if(!_0xcc2cd2){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xcc2cd2[_0xe7ba('0x10')]){throw new Error(_0xe7ba('0x40'));}if(_0xcc2cd2[_0xe7ba('0x11')]){if(moment(_0xcc2cd2['blockedAt'])['add'](_0x3239c1[_0xe7ba('0x17')],_0xe7ba('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xcc2cd2['blocked']=![];_0xcc2cd2[_0xe7ba('0x18')]=null;}}_0xcc2cd2[_0xe7ba('0x41')]=_0x118365;_0xcc2cd2[_0xe7ba('0x42')]=Date[_0xe7ba('0x43')]()+0x36ee80;return _0xcc2cd2[_0xe7ba('0x44')]();})[_0xe7ba('0xc')](function(){return sendServiceMail({'to':_0x275529['body']['email'],'subject':_0xe7ba('0x45'),'text':_0xe7ba('0x46')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xe7ba('0x47')+_0x275529[_0xe7ba('0x48')]['host']+_0xe7ba('0x49')+_0x118365+'\x0a\x0a'+_0xe7ba('0x4a')});})[_0xe7ba('0xc')](function(){_0x24729f[_0xe7ba('0x32')](0xc8)['send']({'message':_0xe7ba('0x4b')});})[_0xe7ba('0x1d')](function(_0x4c697b){return handleError(_0x24729f,0x1f4,_0x4c697b);});};exports[_0xe7ba('0x4c')]=function(_0xf8fe0d,_0x2f0324,_0x1513a8){var _0x1a1f2c;return db[_0xe7ba('0x3f')][_0xe7ba('0x1f')]({'where':{'resetPasswordToken':_0xf8fe0d[_0xe7ba('0x4d')][_0xe7ba('0x4e')],'resetPasswordExpires':{'$gt':Date[_0xe7ba('0x43')]()}}})['then'](function(_0x6f92df){_0x1a1f2c=_0x6f92df;if(!_0x1a1f2c){throw new Error(_0xe7ba('0x4f'));}return db[_0xe7ba('0x9')][_0xe7ba('0xa')]({'attributes':['id','securePassword']});})[_0xe7ba('0xc')](function(_0x5fca9){return checkPasswordPattern(_0x5fca9,_0xf8fe0d[_0xe7ba('0x3b')][_0xe7ba('0xe')],_0x5fca9[_0xe7ba('0x50')]);})[_0xe7ba('0xc')](function(){_0x1a1f2c[_0xe7ba('0xe')]=_0xf8fe0d[_0xe7ba('0x3b')][_0xe7ba('0xe')];_0x1a1f2c['resetPasswordToken']=null;_0x1a1f2c[_0xe7ba('0x42')]=null;return _0x1a1f2c[_0xe7ba('0x44')]();})[_0xe7ba('0xc')](function(){_0x2f0324[_0xe7ba('0x32')](0xc8)[_0xe7ba('0x33')]({'message':_0xe7ba('0x51')});})[_0xe7ba('0x1d')](function(_0x408451){return handleError(_0x2f0324,0x1f4,_0x408451);});};passport[_0xe7ba('0x52')](new LocalStrategy({'usernameField':_0xe7ba('0xd'),'passwordField':_0xe7ba('0xe')},function(_0x375d15,_0x1f5e80,_0x65f934){return localAuthenticate(db['User'],_0x375d15,_0x1f5e80,_0x65f934);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2f4a750..65e14ed 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 _0xe6a3=['forgot','/reset/:token','reset','exports','express','./authLocal.controller','login','post'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe6a3,0x104));var _0x3e6a=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xe6a3[_0x2c0dc0];return _0x4c0990;};'use strict';var express=require(_0x3e6a('0x0'));var router=express['Router']();var controller=require(_0x3e6a('0x1'));router['post']('/',controller[_0x3e6a('0x2')]);router[_0x3e6a('0x3')]('/forgot',controller[_0x3e6a('0x4')]);router['post'](_0x3e6a('0x5'),controller[_0x3e6a('0x6')]);module[_0x3e6a('0x7')]=router; \ No newline at end of file +var _0xd766=['Router','./authLocal.controller','post','reset','exports'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0xd766,0x1b8));var _0x6d76=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xd766[_0x68ee8b];return _0x5148f7;};'use strict';var express=require('express');var router=express[_0x6d76('0x0')]();var controller=require(_0x6d76('0x1'));router[_0x6d76('0x2')]('/',controller['login']);router[_0x6d76('0x2')]('/forgot',controller['forgot']);router['post']('/reset/:token',controller[_0x6d76('0x3')]);module[_0x6d76('0x4')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3bf2e52..8e34cd5 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 _0x3857=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x4bba7b,_0x481fcf){var _0x51df19=function(_0x817e46){while(--_0x817e46){_0x4bba7b['push'](_0x4bba7b['shift']());}};_0x51df19(++_0x481fcf);}(_0x3857,0x1b2));var _0x7385=function(_0x3ccba9,_0xc84964){_0x3ccba9=_0x3ccba9-0x0;var _0x1f930b=_0x3857[_0x3ccba9];return _0x1f930b;};'use strict';var Sequelize=require(_0x7385('0x0'));module[_0x7385('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7385('0x2')]},'status':{'type':Sequelize[_0x7385('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7385('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x786c=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x1fc7cf,_0x18f4a7){var _0x5097f7=function(_0x5c20c9){while(--_0x5c20c9){_0x1fc7cf['push'](_0x1fc7cf['shift']());}};_0x5097f7(++_0x18f4a7);}(_0x786c,0x189));var _0xc786=function(_0x12893f,_0x535810){_0x12893f=_0x12893f-0x0;var _0x508976=_0x786c[_0x12893f];return _0x508976;};'use strict';var Sequelize=require(_0xc786('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xc786('0x1')]},'description':{'type':Sequelize[_0xc786('0x1')]},'status':{'type':Sequelize[_0xc786('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc786('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 2f26aa5..1c5059c 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 _0x6b98=['sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','addConditions','omit','getConditions','Condition','order','pick','Action','ids','findOne','getActions','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x18d6bf,_0x5fb49b){var _0x28dac7=function(_0x2a1e25){while(--_0x2a1e25){_0x18d6bf['push'](_0x18d6bf['shift']());}};_0x28dac7(++_0x5fb49b);}(_0x6b98,0x1af));var _0x86b9=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x6b98[_0x421cf8];return _0x145c48;};'use strict';var pdf=require(_0x86b9('0x0'));var emlformat=require(_0x86b9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x86b9('0x2'));var rp=require('request-promise');var moment=require(_0x86b9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86b9('0x4'));var util=require(_0x86b9('0x5'));var path=require(_0x86b9('0x6'));var sox=require(_0x86b9('0x7'));var csv=require(_0x86b9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x86b9('0x9'));var crypto=require(_0x86b9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x86b9('0xb'));var toCsv=require(_0x86b9('0x8'));var querystring=require(_0x86b9('0xc'));var Papa=require(_0x86b9('0xd'));var Redis=require(_0x86b9('0xe'));var authService=require(_0x86b9('0xf'));var qs=require(_0x86b9('0x10'));var as=require(_0x86b9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86b9('0x12'))(_0x86b9('0x13'));var utils=require(_0x86b9('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x429cca,_0x138701){_0x138701=_0x138701||0xcc;return function(_0x17ce03){if(_0x17ce03){return _0x429cca['sendStatus'](_0x138701);}return _0x429cca['status'](_0x138701)[_0x86b9('0x15')]();};}function respondWithResult(_0x108018,_0x54c088){_0x54c088=_0x54c088||0xc8;return function(_0x39906c){if(_0x39906c){return _0x108018[_0x86b9('0x16')](_0x54c088)[_0x86b9('0x17')](_0x39906c);}};}function respondWithFilteredResult(_0x42ceb7,_0x13b644){return function(_0x11d450){if(_0x11d450){var _0x156eee=_0x11d450[_0x86b9('0x18')],_0x42e0ab=_0x13b644[_0x86b9('0x19')],_0x494602=_0x13b644['offset']+_0x13b644[_0x86b9('0x1a')],_0x1230f3;if(_0x494602>=_0x156eee){_0x494602=_0x156eee;_0x1230f3=0xc8;}else{_0x1230f3=0xce;}_0x42ceb7[_0x86b9('0x16')](_0x1230f3);return _0x42ceb7[_0x86b9('0x1b')](_0x86b9('0x1c'),_0x42e0ab+'-'+_0x494602+'/'+_0x156eee)[_0x86b9('0x17')](_0x11d450);}return null;};}function patchUpdates(_0xb9b06f){return function(_0x15747a){try{jsonpatch['apply'](_0x15747a,_0xb9b06f,!![]);}catch(_0x23a4f3){return BPromise[_0x86b9('0x1d')](_0x23a4f3);}return _0x15747a[_0x86b9('0x1e')]();};}function saveUpdates(_0x394d40,_0x21b51a){return function(_0x3ecb37){if(_0x3ecb37){return _0x3ecb37[_0x86b9('0x1f')](_0x394d40)[_0x86b9('0x20')](function(_0x26d318){return _0x26d318;});}return null;};}function removeEntity(_0x1d83d7,_0x40480d){return function(_0xde91b){if(_0xde91b){return _0xde91b[_0x86b9('0x21')]()[_0x86b9('0x20')](function(){_0x1d83d7[_0x86b9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3810e2,_0x17cb2c){return function(_0xd658af){if(!_0xd658af){_0x3810e2[_0x86b9('0x22')](0x194);}return _0xd658af;};}function handleError(_0x57d46f,_0x228dcc){_0x228dcc=_0x228dcc||0x1f4;return function(_0x467452){logger[_0x86b9('0x23')](_0x467452[_0x86b9('0x24')]);if(_0x467452['name']){delete _0x467452[_0x86b9('0x25')];}_0x57d46f[_0x86b9('0x16')](_0x228dcc)[_0x86b9('0x26')](_0x467452);};}exports[_0x86b9('0x27')]=function(_0x36a2c0,_0x4a89ab){var _0x560f1d={},_0x1c7330={},_0xa63e23={'count':0x0,'rows':[]};var _0x5e1394=_[_0x86b9('0x28')](db[_0x86b9('0x29')]['rawAttributes'],function(_0x43eb87){return{'name':_0x43eb87[_0x86b9('0x2a')],'type':_0x43eb87[_0x86b9('0x2b')][_0x86b9('0x2c')]};});_0x1c7330[_0x86b9('0x2d')]=_['map'](_0x5e1394,_0x86b9('0x25'));_0x1c7330[_0x86b9('0x2e')]=_[_0x86b9('0x2f')](_0x36a2c0[_0x86b9('0x2e')]);_0x1c7330[_0x86b9('0x30')]=_[_0x86b9('0x31')](_0x1c7330[_0x86b9('0x2d')],_0x1c7330[_0x86b9('0x2e')]);_0x560f1d[_0x86b9('0x32')]=_['intersection'](_0x1c7330[_0x86b9('0x2d')],qs[_0x86b9('0x33')](_0x36a2c0[_0x86b9('0x2e')][_0x86b9('0x33')]));_0x560f1d[_0x86b9('0x32')]=_0x560f1d[_0x86b9('0x32')][_0x86b9('0x34')]?_0x560f1d[_0x86b9('0x32')]:_0x1c7330[_0x86b9('0x2d')];if(!_0x36a2c0[_0x86b9('0x2e')][_0x86b9('0x35')](_0x86b9('0x36'))){_0x560f1d[_0x86b9('0x1a')]=qs['limit'](_0x36a2c0['query'][_0x86b9('0x1a')]);_0x560f1d[_0x86b9('0x19')]=qs[_0x86b9('0x19')](_0x36a2c0[_0x86b9('0x2e')][_0x86b9('0x19')]);}_0x560f1d['order']=qs[_0x86b9('0x37')](_0x36a2c0[_0x86b9('0x2e')][_0x86b9('0x37')]);_0x560f1d[_0x86b9('0x38')]=qs['filters'](_['pick'](_0x36a2c0['query'],_0x1c7330[_0x86b9('0x30')]),_0x5e1394);if(_0x36a2c0[_0x86b9('0x2e')][_0x86b9('0x39')]){_0x560f1d['where']=_['merge'](_0x560f1d[_0x86b9('0x38')],{'$or':_[_0x86b9('0x28')](_0x5e1394,function(_0x23d421){if(_0x23d421[_0x86b9('0x2b')]!==_0x86b9('0x3a')){var _0x512f39={};_0x512f39[_0x23d421[_0x86b9('0x25')]]={'$like':'%'+_0x36a2c0[_0x86b9('0x2e')][_0x86b9('0x39')]+'%'};return _0x512f39;}})});}_0x560f1d=_[_0x86b9('0x3b')]({},_0x560f1d,_0x36a2c0[_0x86b9('0x3c')]);var _0x5bc25a={'where':_0x560f1d[_0x86b9('0x38')]};return db[_0x86b9('0x29')][_0x86b9('0x18')](_0x5bc25a)[_0x86b9('0x20')](function(_0x14af01){_0xa63e23[_0x86b9('0x18')]=_0x14af01;if(_0x36a2c0['query'][_0x86b9('0x3d')]){_0x560f1d[_0x86b9('0x3e')]=[{'all':!![]}];}return db[_0x86b9('0x29')][_0x86b9('0x3f')](_0x560f1d);})[_0x86b9('0x20')](function(_0x50e25e){_0xa63e23['rows']=_0x50e25e;return _0xa63e23;})[_0x86b9('0x20')](respondWithFilteredResult(_0x4a89ab,_0x560f1d))[_0x86b9('0x40')](handleError(_0x4a89ab,null));};exports[_0x86b9('0x41')]=function(_0x5b4182,_0x4d4f85){var _0x3cf3bb={'raw':![],'where':{'id':_0x5b4182['params']['id']}},_0x5cf8b8={};_0x5cf8b8[_0x86b9('0x2d')]=_['keys'](db['Automation'][_0x86b9('0x42')]);_0x5cf8b8[_0x86b9('0x2e')]=_[_0x86b9('0x2f')](_0x5b4182[_0x86b9('0x2e')]);_0x5cf8b8[_0x86b9('0x30')]=_[_0x86b9('0x31')](_0x5cf8b8[_0x86b9('0x2d')],_0x5cf8b8['query']);_0x3cf3bb[_0x86b9('0x32')]=_['intersection'](_0x5cf8b8[_0x86b9('0x2d')],qs[_0x86b9('0x33')](_0x5b4182['query'][_0x86b9('0x33')]));_0x3cf3bb[_0x86b9('0x32')]=_0x3cf3bb[_0x86b9('0x32')][_0x86b9('0x34')]?_0x3cf3bb[_0x86b9('0x32')]:_0x5cf8b8[_0x86b9('0x2d')];if(_0x5b4182[_0x86b9('0x2e')]['includeAll']){_0x3cf3bb[_0x86b9('0x3e')]=[{'all':!![]}];}_0x3cf3bb=_[_0x86b9('0x3b')]({},_0x3cf3bb,_0x5b4182[_0x86b9('0x3c')]);return db[_0x86b9('0x29')][_0x86b9('0x43')](_0x3cf3bb)[_0x86b9('0x20')](handleEntityNotFound(_0x4d4f85,null))[_0x86b9('0x20')](respondWithResult(_0x4d4f85,null))['catch'](handleError(_0x4d4f85,null));};exports[_0x86b9('0x44')]=function(_0x320e55,_0xe9471c){return db[_0x86b9('0x29')]['create'](_0x320e55[_0x86b9('0x45')],{})[_0x86b9('0x20')](respondWithResult(_0xe9471c,0xc9))[_0x86b9('0x40')](handleError(_0xe9471c,null));};exports[_0x86b9('0x1f')]=function(_0x3bbdcf,_0x3377d6){if(_0x3bbdcf[_0x86b9('0x45')]['id']){delete _0x3bbdcf[_0x86b9('0x45')]['id'];}return db[_0x86b9('0x29')]['find']({'where':{'id':_0x3bbdcf[_0x86b9('0x46')]['id']}})[_0x86b9('0x20')](handleEntityNotFound(_0x3377d6,null))[_0x86b9('0x20')](saveUpdates(_0x3bbdcf[_0x86b9('0x45')],null))['then'](respondWithResult(_0x3377d6,null))[_0x86b9('0x40')](handleError(_0x3377d6,null));};exports[_0x86b9('0x21')]=function(_0x49b384,_0x1ecc86){return db['Automation']['find']({'where':{'id':_0x49b384['params']['id']}})[_0x86b9('0x20')](handleEntityNotFound(_0x1ecc86,null))['then'](removeEntity(_0x1ecc86,null))[_0x86b9('0x40')](handleError(_0x1ecc86,null));};exports[_0x86b9('0x47')]=function(_0x4a76ba,_0x1926c4,_0x3b501c){return db['Condition'][_0x86b9('0x43')]({'where':{'id':_0x4a76ba[_0x86b9('0x46')]['id']}})[_0x86b9('0x20')](handleEntityNotFound(_0x1926c4,null))[_0x86b9('0x20')](function(_0x35cab4){if(_0x35cab4){return _0x35cab4[_0x86b9('0x47')](_0x4a76ba[_0x86b9('0x45')]['ids'],_[_0x86b9('0x48')](_0x4a76ba[_0x86b9('0x45')],['ids','id'])||{});}})[_0x86b9('0x20')](respondWithResult(_0x1926c4,null))[_0x86b9('0x40')](handleError(_0x1926c4,null));};exports[_0x86b9('0x49')]=function(_0x2f651c,_0x2ce35f,_0xe0214c){var _0x5a3616={};var _0x5a47b5={};var _0x205ad3;var _0x3f204a;return db[_0x86b9('0x29')]['findOne']({'where':{'id':_0x2f651c[_0x86b9('0x46')]['id']}})[_0x86b9('0x20')](handleEntityNotFound(_0x2ce35f,null))[_0x86b9('0x20')](function(_0x407215){if(_0x407215){_0x205ad3=_0x407215;_0x5a47b5[_0x86b9('0x2d')]=_[_0x86b9('0x2f')](db[_0x86b9('0x4a')][_0x86b9('0x42')]);_0x5a47b5['query']=_[_0x86b9('0x2f')](_0x2f651c['query']);_0x5a47b5[_0x86b9('0x30')]=_[_0x86b9('0x31')](_0x5a47b5[_0x86b9('0x2d')],_0x5a47b5[_0x86b9('0x2e')]);_0x5a3616[_0x86b9('0x32')]=_[_0x86b9('0x31')](_0x5a47b5[_0x86b9('0x2d')],qs[_0x86b9('0x33')](_0x2f651c['query'][_0x86b9('0x33')]));_0x5a3616[_0x86b9('0x32')]=_0x5a3616[_0x86b9('0x32')][_0x86b9('0x34')]?_0x5a3616[_0x86b9('0x32')]:_0x5a47b5[_0x86b9('0x2d')];_0x5a3616[_0x86b9('0x4b')]=qs[_0x86b9('0x37')](_0x2f651c[_0x86b9('0x2e')]['sort']);_0x5a3616[_0x86b9('0x38')]=qs[_0x86b9('0x30')](_[_0x86b9('0x4c')](_0x2f651c['query'],_0x5a47b5[_0x86b9('0x30')]));if(_0x2f651c[_0x86b9('0x2e')][_0x86b9('0x39')]){_0x5a3616[_0x86b9('0x38')]=_[_0x86b9('0x3b')](_0x5a3616[_0x86b9('0x38')],{'$or':_[_0x86b9('0x28')](_0x5a3616[_0x86b9('0x32')],function(_0x7bff69){var _0x414f8b={};_0x414f8b[_0x7bff69]={'$like':'%'+_0x2f651c[_0x86b9('0x2e')][_0x86b9('0x39')]+'%'};return _0x414f8b;})});}_0x5a3616=_[_0x86b9('0x3b')]({},_0x5a3616,_0x2f651c['options']);return _0x205ad3[_0x86b9('0x49')](_0x5a3616);}})['then'](function(_0xa885eb){if(_0xa885eb){_0x3f204a=_0xa885eb[_0x86b9('0x34')];if(!_0x2f651c[_0x86b9('0x2e')]['hasOwnProperty'](_0x86b9('0x36'))){_0x5a3616[_0x86b9('0x1a')]=qs[_0x86b9('0x1a')](_0x2f651c['query'][_0x86b9('0x1a')]);_0x5a3616[_0x86b9('0x19')]=qs[_0x86b9('0x19')](_0x2f651c['query']['offset']);}return _0x205ad3[_0x86b9('0x49')](_0x5a3616);}})[_0x86b9('0x20')](function(_0x365d0c){if(_0x365d0c){return _0x365d0c?{'count':_0x3f204a,'rows':_0x365d0c}:null;}})['then'](respondWithResult(_0x2ce35f,null))['catch'](handleError(_0x2ce35f,null));};exports['addActions']=function(_0x52103e,_0x319f5a,_0x41874d){return db[_0x86b9('0x4d')][_0x86b9('0x43')]({'where':{'id':_0x52103e[_0x86b9('0x46')]['id']}})[_0x86b9('0x20')](handleEntityNotFound(_0x319f5a,null))[_0x86b9('0x20')](function(_0x406cda){if(_0x406cda){return _0x406cda['addActions'](_0x52103e[_0x86b9('0x45')]['ids'],_[_0x86b9('0x48')](_0x52103e[_0x86b9('0x45')],[_0x86b9('0x4e'),'id'])||{});}})[_0x86b9('0x20')](respondWithResult(_0x319f5a,null))[_0x86b9('0x40')](handleError(_0x319f5a,null));};exports['getActions']=function(_0x36343b,_0x18e823,_0xa38910){var _0x5c0939={};var _0x1641c9={};var _0x8bf7d4;var _0x3f18bb;return db['Automation'][_0x86b9('0x4f')]({'where':{'id':_0x36343b[_0x86b9('0x46')]['id']}})['then'](handleEntityNotFound(_0x18e823,null))[_0x86b9('0x20')](function(_0xbbd733){if(_0xbbd733){_0x8bf7d4=_0xbbd733;_0x1641c9[_0x86b9('0x2d')]=_[_0x86b9('0x2f')](db[_0x86b9('0x4d')][_0x86b9('0x42')]);_0x1641c9['query']=_[_0x86b9('0x2f')](_0x36343b['query']);_0x1641c9['filters']=_[_0x86b9('0x31')](_0x1641c9['model'],_0x1641c9['query']);_0x5c0939['attributes']=_[_0x86b9('0x31')](_0x1641c9['model'],qs[_0x86b9('0x33')](_0x36343b['query']['fields']));_0x5c0939[_0x86b9('0x32')]=_0x5c0939[_0x86b9('0x32')]['length']?_0x5c0939[_0x86b9('0x32')]:_0x1641c9['model'];_0x5c0939['order']=qs[_0x86b9('0x37')](_0x36343b[_0x86b9('0x2e')][_0x86b9('0x37')]);_0x5c0939[_0x86b9('0x38')]=qs[_0x86b9('0x30')](_[_0x86b9('0x4c')](_0x36343b[_0x86b9('0x2e')],_0x1641c9['filters']));if(_0x36343b[_0x86b9('0x2e')][_0x86b9('0x39')]){_0x5c0939[_0x86b9('0x38')]=_[_0x86b9('0x3b')](_0x5c0939['where'],{'$or':_[_0x86b9('0x28')](_0x5c0939[_0x86b9('0x32')],function(_0x591e6c){var _0x307414={};_0x307414[_0x591e6c]={'$like':'%'+_0x36343b[_0x86b9('0x2e')][_0x86b9('0x39')]+'%'};return _0x307414;})});}_0x5c0939=_[_0x86b9('0x3b')]({},_0x5c0939,_0x36343b['options']);return _0x8bf7d4['getActions'](_0x5c0939);}})[_0x86b9('0x20')](function(_0x52feec){if(_0x52feec){_0x3f18bb=_0x52feec[_0x86b9('0x34')];if(!_0x36343b['query'][_0x86b9('0x35')]('nolimit')){_0x5c0939[_0x86b9('0x1a')]=qs[_0x86b9('0x1a')](_0x36343b[_0x86b9('0x2e')][_0x86b9('0x1a')]);_0x5c0939[_0x86b9('0x19')]=qs['offset'](_0x36343b['query'][_0x86b9('0x19')]);}return _0x8bf7d4[_0x86b9('0x50')](_0x5c0939);}})[_0x86b9('0x20')](function(_0x3090d2){if(_0x3090d2){return _0x3090d2?{'count':_0x3f18bb,'rows':_0x3090d2}:null;}})[_0x86b9('0x20')](respondWithResult(_0x18e823,null))['catch'](handleError(_0x18e823,null));}; \ No newline at end of file +var _0xc62d=['catch','show','params','keys','length','includeAll','create','body','destroy','find','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','merge','where','type','filter','options','Automation','include','findAll','rows'];(function(_0x1b68db,_0x353239){var _0x4072a9=function(_0x582b25){while(--_0x582b25){_0x1b68db['push'](_0x1b68db['shift']());}};_0x4072a9(++_0x353239);}(_0xc62d,0x6a));var _0xdc62=function(_0x413171,_0x3f67d1){_0x413171=_0x413171-0x0;var _0x694b18=_0xc62d[_0x413171];return _0x694b18;};'use strict';var pdf=require(_0xdc62('0x0'));var emlformat=require(_0xdc62('0x1'));var rimraf=require(_0xdc62('0x2'));var zipdir=require(_0xdc62('0x3'));var jsonpatch=require(_0xdc62('0x4'));var rp=require(_0xdc62('0x5'));var moment=require(_0xdc62('0x6'));var BPromise=require(_0xdc62('0x7'));var Mustache=require(_0xdc62('0x8'));var util=require(_0xdc62('0x9'));var path=require(_0xdc62('0xa'));var sox=require(_0xdc62('0xb'));var csv=require(_0xdc62('0xc'));var ejs=require(_0xdc62('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdc62('0xe'));var crypto=require(_0xdc62('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdc62('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc62('0x11'));var Redis=require(_0xdc62('0x12'));var authService=require(_0xdc62('0x13'));var qs=require(_0xdc62('0x14'));var as=require(_0xdc62('0x15'));var hardwareService=require(_0xdc62('0x16'));var logger=require(_0xdc62('0x17'))(_0xdc62('0x18'));var utils=require(_0xdc62('0x19'));var config=require(_0xdc62('0x1a'));var db=require(_0xdc62('0x1b'))['db'];function respondWithStatusCode(_0x5afd4c,_0x10830a){_0x10830a=_0x10830a||0xcc;return function(_0x4af232){if(_0x4af232){return _0x5afd4c['sendStatus'](_0x10830a);}return _0x5afd4c['status'](_0x10830a)[_0xdc62('0x1c')]();};}function respondWithResult(_0x517f4d,_0x18559b){_0x18559b=_0x18559b||0xc8;return function(_0x3d0630){if(_0x3d0630){return _0x517f4d[_0xdc62('0x1d')](_0x18559b)[_0xdc62('0x1e')](_0x3d0630);}};}function respondWithFilteredResult(_0x315524,_0x32b58e){return function(_0x59d650){if(_0x59d650){var _0x16b6b6=_0x59d650[_0xdc62('0x1f')],_0x979188=_0x32b58e['offset'],_0x38beed=_0x32b58e['offset']+_0x32b58e[_0xdc62('0x20')],_0x52fc8c;if(_0x38beed>=_0x16b6b6){_0x38beed=_0x16b6b6;_0x52fc8c=0xc8;}else{_0x52fc8c=0xce;}_0x315524['status'](_0x52fc8c);return _0x315524[_0xdc62('0x21')](_0xdc62('0x22'),_0x979188+'-'+_0x38beed+'/'+_0x16b6b6)[_0xdc62('0x1e')](_0x59d650);}return null;};}function patchUpdates(_0x2ae5eb){return function(_0x318971){try{jsonpatch[_0xdc62('0x23')](_0x318971,_0x2ae5eb,!![]);}catch(_0x2f447a){return BPromise['reject'](_0x2f447a);}return _0x318971[_0xdc62('0x24')]();};}function saveUpdates(_0x262117,_0x7eb708){return function(_0x2087c4){if(_0x2087c4){return _0x2087c4[_0xdc62('0x25')](_0x262117)['then'](function(_0x1c8830){return _0x1c8830;});}return null;};}function removeEntity(_0x4e9af8,_0x28c4dc){return function(_0x4484b9){if(_0x4484b9){return _0x4484b9['destroy']()[_0xdc62('0x26')](function(){_0x4e9af8[_0xdc62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x518dac,_0x32ad01){return function(_0x5e43dc){if(!_0x5e43dc){_0x518dac[_0xdc62('0x27')](0x194);}return _0x5e43dc;};}function handleError(_0x5c3f2a,_0x443dce){_0x443dce=_0x443dce||0x1f4;return function(_0x1e406c){logger[_0xdc62('0x28')](_0x1e406c[_0xdc62('0x29')]);if(_0x1e406c[_0xdc62('0x2a')]){delete _0x1e406c[_0xdc62('0x2a')];}_0x5c3f2a[_0xdc62('0x1d')](_0x443dce)['send'](_0x1e406c);};}exports[_0xdc62('0x2b')]=function(_0x7ed6f7,_0x4b8466){var _0x404c2b={},_0x1e0195={},_0x1ac042={'count':0x0,'rows':[]};var _0x598846=_[_0xdc62('0x2c')](db['Automation'][_0xdc62('0x2d')],function(_0x4b9274){return{'name':_0x4b9274['fieldName'],'type':_0x4b9274['type'][_0xdc62('0x2e')]};});_0x1e0195[_0xdc62('0x2f')]=_['map'](_0x598846,'name');_0x1e0195[_0xdc62('0x30')]=_['keys'](_0x7ed6f7[_0xdc62('0x30')]);_0x1e0195[_0xdc62('0x31')]=_[_0xdc62('0x32')](_0x1e0195[_0xdc62('0x2f')],_0x1e0195[_0xdc62('0x30')]);_0x404c2b['attributes']=_[_0xdc62('0x32')](_0x1e0195[_0xdc62('0x2f')],qs['fields'](_0x7ed6f7['query'][_0xdc62('0x33')]));_0x404c2b[_0xdc62('0x34')]=_0x404c2b[_0xdc62('0x34')]['length']?_0x404c2b[_0xdc62('0x34')]:_0x1e0195[_0xdc62('0x2f')];if(!_0x7ed6f7[_0xdc62('0x30')][_0xdc62('0x35')](_0xdc62('0x36'))){_0x404c2b[_0xdc62('0x20')]=qs[_0xdc62('0x20')](_0x7ed6f7[_0xdc62('0x30')]['limit']);_0x404c2b[_0xdc62('0x37')]=qs[_0xdc62('0x37')](_0x7ed6f7['query'][_0xdc62('0x37')]);}_0x404c2b[_0xdc62('0x38')]=qs[_0xdc62('0x39')](_0x7ed6f7[_0xdc62('0x30')][_0xdc62('0x39')]);_0x404c2b['where']=qs[_0xdc62('0x31')](_[_0xdc62('0x3a')](_0x7ed6f7['query'],_0x1e0195[_0xdc62('0x31')]),_0x598846);if(_0x7ed6f7[_0xdc62('0x30')]['filter']){_0x404c2b['where']=_[_0xdc62('0x3b')](_0x404c2b[_0xdc62('0x3c')],{'$or':_[_0xdc62('0x2c')](_0x598846,function(_0x208248){if(_0x208248[_0xdc62('0x3d')]!=='VIRTUAL'){var _0x299174={};_0x299174[_0x208248[_0xdc62('0x2a')]]={'$like':'%'+_0x7ed6f7[_0xdc62('0x30')][_0xdc62('0x3e')]+'%'};return _0x299174;}})});}_0x404c2b=_[_0xdc62('0x3b')]({},_0x404c2b,_0x7ed6f7[_0xdc62('0x3f')]);var _0xb88d95={'where':_0x404c2b[_0xdc62('0x3c')]};return db[_0xdc62('0x40')][_0xdc62('0x1f')](_0xb88d95)[_0xdc62('0x26')](function(_0x8ca45e){_0x1ac042[_0xdc62('0x1f')]=_0x8ca45e;if(_0x7ed6f7[_0xdc62('0x30')]['includeAll']){_0x404c2b[_0xdc62('0x41')]=[{'all':!![]}];}return db[_0xdc62('0x40')][_0xdc62('0x42')](_0x404c2b);})[_0xdc62('0x26')](function(_0x3c161c){_0x1ac042[_0xdc62('0x43')]=_0x3c161c;return _0x1ac042;})[_0xdc62('0x26')](respondWithFilteredResult(_0x4b8466,_0x404c2b))[_0xdc62('0x44')](handleError(_0x4b8466,null));};exports[_0xdc62('0x45')]=function(_0x406a27,_0x184e20){var _0x55439b={'raw':![],'where':{'id':_0x406a27[_0xdc62('0x46')]['id']}},_0x2ffb54={};_0x2ffb54[_0xdc62('0x2f')]=_[_0xdc62('0x47')](db[_0xdc62('0x40')][_0xdc62('0x2d')]);_0x2ffb54['query']=_[_0xdc62('0x47')](_0x406a27[_0xdc62('0x30')]);_0x2ffb54['filters']=_['intersection'](_0x2ffb54[_0xdc62('0x2f')],_0x2ffb54[_0xdc62('0x30')]);_0x55439b[_0xdc62('0x34')]=_[_0xdc62('0x32')](_0x2ffb54[_0xdc62('0x2f')],qs['fields'](_0x406a27[_0xdc62('0x30')][_0xdc62('0x33')]));_0x55439b[_0xdc62('0x34')]=_0x55439b[_0xdc62('0x34')][_0xdc62('0x48')]?_0x55439b[_0xdc62('0x34')]:_0x2ffb54[_0xdc62('0x2f')];if(_0x406a27[_0xdc62('0x30')][_0xdc62('0x49')]){_0x55439b[_0xdc62('0x41')]=[{'all':!![]}];}_0x55439b=_['merge']({},_0x55439b,_0x406a27[_0xdc62('0x3f')]);return db['Automation']['find'](_0x55439b)[_0xdc62('0x26')](handleEntityNotFound(_0x184e20,null))['then'](respondWithResult(_0x184e20,null))['catch'](handleError(_0x184e20,null));};exports[_0xdc62('0x4a')]=function(_0xa8cd17,_0x44e2e2){return db[_0xdc62('0x40')][_0xdc62('0x4a')](_0xa8cd17['body'],{})[_0xdc62('0x26')](respondWithResult(_0x44e2e2,0xc9))[_0xdc62('0x44')](handleError(_0x44e2e2,null));};exports['update']=function(_0x18a5ce,_0x30d1f8){if(_0x18a5ce[_0xdc62('0x4b')]['id']){delete _0x18a5ce[_0xdc62('0x4b')]['id'];}return db[_0xdc62('0x40')]['find']({'where':{'id':_0x18a5ce[_0xdc62('0x46')]['id']}})[_0xdc62('0x26')](handleEntityNotFound(_0x30d1f8,null))[_0xdc62('0x26')](saveUpdates(_0x18a5ce[_0xdc62('0x4b')],null))['then'](respondWithResult(_0x30d1f8,null))[_0xdc62('0x44')](handleError(_0x30d1f8,null));};exports[_0xdc62('0x4c')]=function(_0xdc16be,_0x3a2377){return db[_0xdc62('0x40')][_0xdc62('0x4d')]({'where':{'id':_0xdc16be[_0xdc62('0x46')]['id']}})[_0xdc62('0x26')](handleEntityNotFound(_0x3a2377,null))[_0xdc62('0x26')](removeEntity(_0x3a2377,null))[_0xdc62('0x44')](handleError(_0x3a2377,null));};exports[_0xdc62('0x4e')]=function(_0x583275,_0x4b4cf8,_0x3d1762){return db[_0xdc62('0x4f')][_0xdc62('0x4d')]({'where':{'id':_0x583275['params']['id']}})[_0xdc62('0x26')](handleEntityNotFound(_0x4b4cf8,null))[_0xdc62('0x26')](function(_0x544398){if(_0x544398){return _0x544398[_0xdc62('0x4e')](_0x583275['body']['ids'],_[_0xdc62('0x50')](_0x583275[_0xdc62('0x4b')],[_0xdc62('0x51'),'id'])||{});}})[_0xdc62('0x26')](respondWithResult(_0x4b4cf8,null))[_0xdc62('0x44')](handleError(_0x4b4cf8,null));};exports[_0xdc62('0x52')]=function(_0x218269,_0x3cc367,_0x254a8d){var _0xc316cf={};var _0x10c023={};var _0x3eebb2;var _0x45f42c;return db[_0xdc62('0x40')][_0xdc62('0x53')]({'where':{'id':_0x218269[_0xdc62('0x46')]['id']}})['then'](handleEntityNotFound(_0x3cc367,null))[_0xdc62('0x26')](function(_0x1bd32d){if(_0x1bd32d){_0x3eebb2=_0x1bd32d;_0x10c023[_0xdc62('0x2f')]=_[_0xdc62('0x47')](db['Condition']['rawAttributes']);_0x10c023['query']=_[_0xdc62('0x47')](_0x218269[_0xdc62('0x30')]);_0x10c023['filters']=_['intersection'](_0x10c023[_0xdc62('0x2f')],_0x10c023[_0xdc62('0x30')]);_0xc316cf[_0xdc62('0x34')]=_['intersection'](_0x10c023[_0xdc62('0x2f')],qs[_0xdc62('0x33')](_0x218269[_0xdc62('0x30')][_0xdc62('0x33')]));_0xc316cf[_0xdc62('0x34')]=_0xc316cf[_0xdc62('0x34')][_0xdc62('0x48')]?_0xc316cf[_0xdc62('0x34')]:_0x10c023[_0xdc62('0x2f')];_0xc316cf[_0xdc62('0x38')]=qs[_0xdc62('0x39')](_0x218269[_0xdc62('0x30')][_0xdc62('0x39')]);_0xc316cf['where']=qs[_0xdc62('0x31')](_[_0xdc62('0x3a')](_0x218269[_0xdc62('0x30')],_0x10c023[_0xdc62('0x31')]));if(_0x218269[_0xdc62('0x30')]['filter']){_0xc316cf[_0xdc62('0x3c')]=_[_0xdc62('0x3b')](_0xc316cf[_0xdc62('0x3c')],{'$or':_[_0xdc62('0x2c')](_0xc316cf['attributes'],function(_0x29e2a6){var _0x383cc3={};_0x383cc3[_0x29e2a6]={'$like':'%'+_0x218269[_0xdc62('0x30')][_0xdc62('0x3e')]+'%'};return _0x383cc3;})});}_0xc316cf=_[_0xdc62('0x3b')]({},_0xc316cf,_0x218269[_0xdc62('0x3f')]);return _0x3eebb2[_0xdc62('0x52')](_0xc316cf);}})[_0xdc62('0x26')](function(_0x2121e2){if(_0x2121e2){_0x45f42c=_0x2121e2[_0xdc62('0x48')];if(!_0x218269[_0xdc62('0x30')][_0xdc62('0x35')](_0xdc62('0x36'))){_0xc316cf[_0xdc62('0x20')]=qs[_0xdc62('0x20')](_0x218269[_0xdc62('0x30')][_0xdc62('0x20')]);_0xc316cf[_0xdc62('0x37')]=qs[_0xdc62('0x37')](_0x218269[_0xdc62('0x30')][_0xdc62('0x37')]);}return _0x3eebb2[_0xdc62('0x52')](_0xc316cf);}})[_0xdc62('0x26')](function(_0x418fb5){if(_0x418fb5){return _0x418fb5?{'count':_0x45f42c,'rows':_0x418fb5}:null;}})[_0xdc62('0x26')](respondWithResult(_0x3cc367,null))[_0xdc62('0x44')](handleError(_0x3cc367,null));};exports[_0xdc62('0x54')]=function(_0x3dcdd6,_0x128c7b,_0x44c245){return db['Action']['find']({'where':{'id':_0x3dcdd6[_0xdc62('0x46')]['id']}})[_0xdc62('0x26')](handleEntityNotFound(_0x128c7b,null))[_0xdc62('0x26')](function(_0x2b1f17){if(_0x2b1f17){return _0x2b1f17[_0xdc62('0x54')](_0x3dcdd6['body'][_0xdc62('0x51')],_[_0xdc62('0x50')](_0x3dcdd6[_0xdc62('0x4b')],[_0xdc62('0x51'),'id'])||{});}})[_0xdc62('0x26')](respondWithResult(_0x128c7b,null))[_0xdc62('0x44')](handleError(_0x128c7b,null));};exports['getActions']=function(_0x190f27,_0x397da3,_0x41f7e7){var _0x8cd18b={};var _0x57cb0d={};var _0x2b70d2;var _0x476259;return db[_0xdc62('0x40')][_0xdc62('0x53')]({'where':{'id':_0x190f27['params']['id']}})['then'](handleEntityNotFound(_0x397da3,null))[_0xdc62('0x26')](function(_0x126195){if(_0x126195){_0x2b70d2=_0x126195;_0x57cb0d['model']=_[_0xdc62('0x47')](db[_0xdc62('0x55')][_0xdc62('0x2d')]);_0x57cb0d['query']=_[_0xdc62('0x47')](_0x190f27[_0xdc62('0x30')]);_0x57cb0d['filters']=_[_0xdc62('0x32')](_0x57cb0d['model'],_0x57cb0d[_0xdc62('0x30')]);_0x8cd18b[_0xdc62('0x34')]=_[_0xdc62('0x32')](_0x57cb0d[_0xdc62('0x2f')],qs[_0xdc62('0x33')](_0x190f27[_0xdc62('0x30')][_0xdc62('0x33')]));_0x8cd18b['attributes']=_0x8cd18b[_0xdc62('0x34')][_0xdc62('0x48')]?_0x8cd18b[_0xdc62('0x34')]:_0x57cb0d[_0xdc62('0x2f')];_0x8cd18b[_0xdc62('0x38')]=qs[_0xdc62('0x39')](_0x190f27[_0xdc62('0x30')][_0xdc62('0x39')]);_0x8cd18b['where']=qs[_0xdc62('0x31')](_[_0xdc62('0x3a')](_0x190f27[_0xdc62('0x30')],_0x57cb0d[_0xdc62('0x31')]));if(_0x190f27[_0xdc62('0x30')][_0xdc62('0x3e')]){_0x8cd18b[_0xdc62('0x3c')]=_[_0xdc62('0x3b')](_0x8cd18b[_0xdc62('0x3c')],{'$or':_[_0xdc62('0x2c')](_0x8cd18b[_0xdc62('0x34')],function(_0x532db3){var _0x424f8f={};_0x424f8f[_0x532db3]={'$like':'%'+_0x190f27[_0xdc62('0x30')][_0xdc62('0x3e')]+'%'};return _0x424f8f;})});}_0x8cd18b=_[_0xdc62('0x3b')]({},_0x8cd18b,_0x190f27['options']);return _0x2b70d2[_0xdc62('0x56')](_0x8cd18b);}})[_0xdc62('0x26')](function(_0x464ab4){if(_0x464ab4){_0x476259=_0x464ab4['length'];if(!_0x190f27[_0xdc62('0x30')]['hasOwnProperty'](_0xdc62('0x36'))){_0x8cd18b[_0xdc62('0x20')]=qs[_0xdc62('0x20')](_0x190f27['query']['limit']);_0x8cd18b[_0xdc62('0x37')]=qs[_0xdc62('0x37')](_0x190f27[_0xdc62('0x30')][_0xdc62('0x37')]);}return _0x2b70d2[_0xdc62('0x56')](_0x8cd18b);}})['then'](function(_0x524704){if(_0x524704){return _0x524704?{'count':_0x476259,'rows':_0x524704}:null;}})[_0xdc62('0x26')](respondWithResult(_0x397da3,null))[_0xdc62('0x44')](handleError(_0x397da3,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 90230cf..05956cc 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 _0xee14=['Automation','tools_automations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define'];(function(_0x8813f7,_0x332f04){var _0x593940=function(_0x48da82){while(--_0x48da82){_0x8813f7['push'](_0x8813f7['shift']());}};_0x593940(++_0x332f04);}(_0xee14,0x13a));var _0x4ee1=function(_0x36f1d3,_0x3c84f1){_0x36f1d3=_0x36f1d3-0x0;var _0x4f4316=_0xee14[_0x36f1d3];return _0x4f4316;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x428cff,_0x377454){var _0x2f4f7c=function(_0x2091a3){while(--_0x2091a3){_0x428cff['push'](_0x428cff['shift']());}};_0x2f4f7c(++_0x377454);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2bbe58,_0x3a942d){_0x2bbe58=_0x2bbe58-0x0;var _0xfe496=_0x9c5a[_0x2bbe58];return _0xfe496;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./automation.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('Automation',attributes,{'tableName':'tools_automations','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 484f237..db28e3c 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 _0x82a7=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x40ddcd,_0x18afb1){var _0x36ca16=function(_0x49f70b){while(--_0x49f70b){_0x40ddcd['push'](_0x40ddcd['shift']());}};_0x36ca16(++_0x18afb1);}(_0x82a7,0x86));var _0x782a=function(_0x20cf4f,_0x3e9fce){_0x20cf4f=_0x20cf4f-0x0;var _0x30f5e4=_0x82a7[_0x20cf4f];return _0x30f5e4;};'use strict';var _=require('lodash');var util=require(_0x782a('0x0'));var moment=require(_0x782a('0x1'));var BPromise=require(_0x782a('0x2'));var rs=require(_0x782a('0x3'));var fs=require('fs');var Redis=require(_0x782a('0x4'));var db=require(_0x782a('0x5'))['db'];var utils=require(_0x782a('0x6'));var logger=require(_0x782a('0x7'))(_0x782a('0x8'));var config=require(_0x782a('0x9'));var jayson=require(_0x782a('0xa'));var client=jayson[_0x782a('0xb')][_0x782a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18bda2,_0x5290e3,_0x1814e2){return new BPromise(function(_0x13aafc,_0x17d303){return client[_0x782a('0xd')](_0x18bda2,_0x1814e2)['then'](function(_0x2d9e97){logger['info'](_0x782a('0xe'),_0x5290e3,_0x782a('0xf'));logger[_0x782a('0x10')](_0x782a('0x11'),_0x5290e3,_0x782a('0xf'),JSON[_0x782a('0x12')](_0x2d9e97));if(_0x2d9e97[_0x782a('0x13')]){if(_0x2d9e97[_0x782a('0x13')][_0x782a('0x14')]===0x1f4){logger[_0x782a('0x13')](_0x782a('0xe'),_0x5290e3,_0x2d9e97[_0x782a('0x13')][_0x782a('0x15')]);return _0x17d303(_0x2d9e97['error'][_0x782a('0x15')]);}logger[_0x782a('0x13')](_0x782a('0xe'),_0x5290e3,_0x2d9e97[_0x782a('0x13')][_0x782a('0x15')]);return _0x13aafc(_0x2d9e97['error'][_0x782a('0x15')]);}else{logger[_0x782a('0x16')](_0x782a('0xe'),_0x5290e3,_0x782a('0xf'));_0x13aafc(_0x2d9e97[_0x782a('0x17')][_0x782a('0x15')]);}})[_0x782a('0x18')](function(_0x178c81){logger[_0x782a('0x13')]('Automation,\x20%s,\x20%s',_0x5290e3,_0x178c81);_0x17d303(_0x178c81);});});} \ No newline at end of file +var _0xdb55=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','message','Automation,\x20%s,\x20%s','catch','util','moment','randomstring'];(function(_0x35d483,_0x164aa6){var _0x12543d=function(_0x2572b1){while(--_0x2572b1){_0x35d483['push'](_0x35d483['shift']());}};_0x12543d(++_0x164aa6);}(_0xdb55,0x89));var _0x5db5=function(_0x48fe65,_0x1cf6aa){_0x48fe65=_0x48fe65-0x0;var _0x2236a5=_0xdb55[_0x48fe65];return _0x2236a5;};'use strict';var _=require('lodash');var util=require(_0x5db5('0x0'));var moment=require(_0x5db5('0x1'));var BPromise=require('bluebird');var rs=require(_0x5db5('0x2'));var fs=require('fs');var Redis=require(_0x5db5('0x3'));var db=require(_0x5db5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5db5('0x5'))(_0x5db5('0x6'));var config=require(_0x5db5('0x7'));var jayson=require(_0x5db5('0x8'));var client=jayson[_0x5db5('0x9')][_0x5db5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27459b,_0x6bca5b,_0x1ee63b){return new BPromise(function(_0x167861,_0x30ddb9){return client['request'](_0x27459b,_0x1ee63b)[_0x5db5('0xb')](function(_0x3db962){logger[_0x5db5('0xc')]('Automation,\x20%s,\x20%s',_0x6bca5b,_0x5db5('0xd'));logger[_0x5db5('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x6bca5b,_0x5db5('0xd'),JSON[_0x5db5('0xf')](_0x3db962));if(_0x3db962[_0x5db5('0x10')]){if(_0x3db962[_0x5db5('0x10')]['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x6bca5b,_0x3db962[_0x5db5('0x10')][_0x5db5('0x11')]);return _0x30ddb9(_0x3db962[_0x5db5('0x10')][_0x5db5('0x11')]);}logger[_0x5db5('0x10')](_0x5db5('0x12'),_0x6bca5b,_0x3db962['error'][_0x5db5('0x11')]);return _0x167861(_0x3db962[_0x5db5('0x10')]['message']);}else{logger['info'](_0x5db5('0x12'),_0x6bca5b,_0x5db5('0xd'));_0x167861(_0x3db962['result'][_0x5db5('0x11')]);}})[_0x5db5('0x13')](function(_0x2656c4){logger['error']('Automation,\x20%s,\x20%s',_0x6bca5b,_0x2656c4);_0x30ddb9(_0x2656c4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5e2d73f..aa89724 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 _0x87e1=['../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','post','create','/:id/conditions','addActions','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xf1e69e,_0x5f2062){var _0xc59730=function(_0x439b55){while(--_0x439b55){_0xf1e69e['push'](_0xf1e69e['shift']());}};_0xc59730(++_0x5f2062);}(_0x87e1,0xb1));var _0x187e=function(_0xff5684,_0xfe6e00){_0xff5684=_0xff5684-0x0;var _0x41e374=_0x87e1[_0xff5684];return _0x41e374;};'use strict';var multer=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var path=require(_0x187e('0x2'));var timeout=require(_0x187e('0x3'));var express=require('express');var router=express[_0x187e('0x4')]();var auth=require(_0x187e('0x5'));var interaction=require(_0x187e('0x6'));var config=require(_0x187e('0x7'));var controller=require(_0x187e('0x8'));router[_0x187e('0x9')]('/',auth[_0x187e('0xa')](),controller[_0x187e('0xb')]);router['get'](_0x187e('0xc'),auth[_0x187e('0xa')](),controller[_0x187e('0xd')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller[_0x187e('0xe')]);router[_0x187e('0x9')](_0x187e('0xf'),auth[_0x187e('0xa')](),controller['getActions']);router[_0x187e('0x10')]('/',auth['isAuthenticated'](),controller[_0x187e('0x11')]);router[_0x187e('0x10')](_0x187e('0x12'),auth[_0x187e('0xa')](),controller['addConditions']);router[_0x187e('0x10')]('/:id/actions',auth[_0x187e('0xa')](),controller[_0x187e('0x13')]);router[_0x187e('0x14')](_0x187e('0xc'),auth[_0x187e('0xa')](),controller['update']);router[_0x187e('0x15')]('/:id',auth[_0x187e('0xa')](),controller[_0x187e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0f9d=['get','/:id','isAuthenticated','show','/:id/conditions','/:id/actions','create','post','addConditions','addActions','put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index'];(function(_0x3ecf65,_0x3bac13){var _0x1907df=function(_0x247dd9){while(--_0x247dd9){_0x3ecf65['push'](_0x3ecf65['shift']());}};_0x1907df(++_0x3bac13);}(_0x0f9d,0x81));var _0xd0f9=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x0f9d[_0xfd5f37];return _0x11bd01;};'use strict';var multer=require(_0xd0f9('0x0'));var util=require('util');var path=require(_0xd0f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0f9('0x2'));var router=express[_0xd0f9('0x3')]();var auth=require(_0xd0f9('0x4'));var interaction=require(_0xd0f9('0x5'));var config=require(_0xd0f9('0x6'));var controller=require(_0xd0f9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd0f9('0x8')]);router[_0xd0f9('0x9')](_0xd0f9('0xa'),auth[_0xd0f9('0xb')](),controller[_0xd0f9('0xc')]);router['get'](_0xd0f9('0xd'),auth[_0xd0f9('0xb')](),controller['getConditions']);router[_0xd0f9('0x9')](_0xd0f9('0xe'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0xd0f9('0xb')](),controller[_0xd0f9('0xf')]);router[_0xd0f9('0x10')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xd0f9('0x11')]);router[_0xd0f9('0x10')](_0xd0f9('0xe'),auth[_0xd0f9('0xb')](),controller[_0xd0f9('0x12')]);router[_0xd0f9('0x13')](_0xd0f9('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd0f9('0x14')](_0xd0f9('0xa'),auth[_0xd0f9('0xb')](),controller[_0xd0f9('0x15')]);module[_0xd0f9('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index cd1f020..dad0a36 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 _0xfb9a=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x2a4c8e,_0x36a238){var _0x524ff1=function(_0x5a5b21){while(--_0x5a5b21){_0x2a4c8e['push'](_0x2a4c8e['shift']());}};_0x524ff1(++_0x36a238);}(_0xfb9a,0x105));var _0xafb9=function(_0x134c7b,_0x490def){_0x134c7b=_0x134c7b-0x0;var _0x39e216=_0xfb9a[_0x134c7b];return _0x39e216;};'use strict';var Sequelize=require(_0xafb9('0x0'));module[_0xafb9('0x1')]={'name':{'type':Sequelize[_0xafb9('0x2')],'unique':_0xafb9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xafb9('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xafb9('0x5')},'description':{'type':Sequelize[_0xafb9('0x2')]},'active':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':0x0,'comment':_0xafb9('0x7')},'limitCalls':{'type':Sequelize[_0xafb9('0x8')](0x4)[_0xafb9('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xafb9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xafb9('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xafb9('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafb9('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafb9('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xafb9('0x8')](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)[_0xafb9('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xafb9('0x8')](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafb9('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xafb9('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xafb9('0xe'),_0xafb9('0xf'),_0xafb9('0x10')),'defaultValue':_0xafb9('0xe')},'dialAMDActive':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xafb9('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xafb9('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xafb9('0x8')](0x9)[_0xafb9('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xafb9('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xafb9('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xafb9('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xafb9('0x8')](0x9)[_0xafb9('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xafb9('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xafb9('0x8')](0x9)[_0xafb9('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xafb9('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xafb9('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xafb9('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xafb9('0x8')](0x9)[_0xafb9('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xafb9('0x8')](0x5)[_0xafb9('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xafb9('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xafb9('0x8')](0x9)[_0xafb9('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xafb9('0x4')](_0xafb9('0x18'),_0xafb9('0x19')),'defaultValue':_0xafb9('0x18')},'dialPrefix':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xafb9('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xafb9('0x1a')},'dialCutDigit':{'type':Sequelize[_0xafb9('0x8')](0x3)[_0xafb9('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xafb9('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafb9('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xafb9('0x8')](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafb9('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)[_0xafb9('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafb9('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xafb9('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafb9('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)[_0xafb9('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafb9('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafb9('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xafb9('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xafb9('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xafb9('0x8')](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xafb9('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xafb9('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xafb9('0x8')](0x5)[_0xafb9('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xa893=['#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#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','never','onlyIfOpen'];(function(_0x501bfd,_0x36d196){var _0x3cb897=function(_0x140a93){while(--_0x140a93){_0x501bfd['push'](_0x501bfd['shift']());}};_0x3cb897(++_0x36d196);}(_0xa893,0x78));var _0x3a89=function(_0x4e149e,_0x34bbda){_0x4e149e=_0x4e149e-0x0;var _0x5c7113=_0xa893[_0x4e149e];return _0x5c7113;};'use strict';var Sequelize=require(_0x3a89('0x0'));module[_0x3a89('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3a89('0x2')](_0x3a89('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x3a89('0x4')]},'active':{'type':Sequelize[_0x3a89('0x5')],'defaultValue':0x0,'comment':_0x3a89('0x6')},'limitCalls':{'type':Sequelize[_0x3a89('0x7')](0x4)[_0x3a89('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3a89('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3a89('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3a89('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3a89('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a89('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a89('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3a89('0x7')](0x5)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3a89('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a89('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3a89('0x7')](0x5)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)[_0x3a89('0x8')],'defaultValue':0x3,'comment':_0x3a89('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3a89('0x7')](0x5)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a89('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3a89('0xf')},'dialTimezone':{'type':Sequelize[_0x3a89('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x3a89('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3a89('0x11'),_0x3a89('0x12'),_0x3a89('0x13')),'defaultValue':_0x3a89('0x11')},'dialAMDActive':{'type':Sequelize[_0x3a89('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3a89('0x7')](0x9)[_0x3a89('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3a89('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3a89('0x7')](0x9)[_0x3a89('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3a89('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3a89('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3a89('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3a89('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3a89('0x7')](0x9)[_0x3a89('0x8')],'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':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3a89('0x7')](0x9)[_0x3a89('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3a89('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3a89('0x2')](_0x3a89('0x18'),_0x3a89('0x19')),'defaultValue':_0x3a89('0x18')},'dialPrefix':{'type':Sequelize[_0x3a89('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3a89('0x7')](0x3)[_0x3a89('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3a89('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a89('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)[_0x3a89('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a89('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a89('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)[_0x3a89('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a89('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x3a89('0x7')](0x5)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a89('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)[_0x3a89('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a89('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a89('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a89('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3a89('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a89('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3a89('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a89('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1fa7fe5..8273a1b 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 _0x7941=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','then','destroy','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','fields','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','into','fromQuery','phone','ContactId','field','NOW()','scheduledAt','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','onlyIfOpen','insert','push','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7941,0x7d));var _0x1794=function(_0x171a96,_0x42e38e){_0x171a96=_0x171a96-0x0;var _0x3b7e5c=_0x7941[_0x171a96];return _0x3b7e5c;};'use strict';var pdf=require(_0x1794('0x0'));var emlformat=require(_0x1794('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1794('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1794('0x3'));var Mustache=require(_0x1794('0x4'));var util=require(_0x1794('0x5'));var path=require(_0x1794('0x6'));var sox=require(_0x1794('0x7'));var csv=require(_0x1794('0x8'));var ejs=require(_0x1794('0x9'));var fs=require('fs');var _=require(_0x1794('0xa'));var squel=require(_0x1794('0xb'));var crypto=require(_0x1794('0xc'));var jsforce=require(_0x1794('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1794('0x8'));var querystring=require(_0x1794('0xe'));var Papa=require(_0x1794('0xf'));var Redis=require(_0x1794('0x10'));var authService=require(_0x1794('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1794('0x12'));var hardwareService=require(_0x1794('0x13'));var logger=require(_0x1794('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1794('0x15'));var db=require(_0x1794('0x16'))['db'];function respondWithStatusCode(_0x1cb577,_0x3275b0){_0x3275b0=_0x3275b0||0xcc;return function(_0x240221){if(_0x240221){return _0x1cb577[_0x1794('0x17')](_0x3275b0);}return _0x1cb577[_0x1794('0x18')](_0x3275b0)[_0x1794('0x19')]();};}function respondWithResult(_0x472bf2,_0x5d3dfa){_0x5d3dfa=_0x5d3dfa||0xc8;return function(_0x3672bb){if(_0x3672bb){return _0x472bf2[_0x1794('0x18')](_0x5d3dfa)[_0x1794('0x1a')](_0x3672bb);}};}function respondWithFilteredResult(_0x9331a2,_0x5e2e86){return function(_0x18279c){if(_0x18279c){var _0x5ec8dc=_0x18279c[_0x1794('0x1b')],_0x412254=_0x5e2e86[_0x1794('0x1c')],_0x4716d8=_0x5e2e86[_0x1794('0x1c')]+_0x5e2e86['limit'],_0x2c4b8e;if(_0x4716d8>=_0x5ec8dc){_0x4716d8=_0x5ec8dc;_0x2c4b8e=0xc8;}else{_0x2c4b8e=0xce;}_0x9331a2[_0x1794('0x18')](_0x2c4b8e);return _0x9331a2[_0x1794('0x1d')]('Content-Range',_0x412254+'-'+_0x4716d8+'/'+_0x5ec8dc)[_0x1794('0x1a')](_0x18279c);}return null;};}function patchUpdates(_0x5a0d73){return function(_0x3c03d5){try{jsonpatch[_0x1794('0x1e')](_0x3c03d5,_0x5a0d73,!![]);}catch(_0x175df7){return BPromise['reject'](_0x175df7);}return _0x3c03d5[_0x1794('0x1f')]();};}function saveUpdates(_0x4149ec,_0x4e65ac){return function(_0x22d964){if(_0x22d964){return _0x22d964['update'](_0x4149ec)[_0x1794('0x20')](function(_0x189164){return _0x189164;});}return null;};}function removeEntity(_0x53ec74,_0x41a4fd){return function(_0x32476c){if(_0x32476c){return _0x32476c[_0x1794('0x21')]()[_0x1794('0x20')](function(){var _0x30772c=_0x32476c['get']({'plain':!![]});var _0x3820a1='IvrCampaigns';return db[_0x1794('0x22')][_0x1794('0x21')]({'where':{'type':_0x3820a1,'resourceId':_0x30772c['id']}})[_0x1794('0x20')](function(){return _0x32476c;});})[_0x1794('0x20')](function(){_0x53ec74[_0x1794('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b88d5,_0x1422fb){return function(_0x9a2583){if(!_0x9a2583){_0x2b88d5[_0x1794('0x17')](0x194);}return _0x9a2583;};}function handleError(_0x376dc4,_0x17dc05){_0x17dc05=_0x17dc05||0x1f4;return function(_0x36d294){logger['error'](_0x36d294[_0x1794('0x23')]);if(_0x36d294[_0x1794('0x24')]){delete _0x36d294[_0x1794('0x24')];}_0x376dc4[_0x1794('0x18')](_0x17dc05)[_0x1794('0x25')](_0x36d294);};}exports[_0x1794('0x26')]=function(_0x3c17b1,_0xa6ba9c){var _0x554a4a={},_0xbe50a1={},_0x249a69={'count':0x0,'rows':[]};var _0x5aab40=_[_0x1794('0x27')](db[_0x1794('0x28')][_0x1794('0x29')],function(_0x58026e){return{'name':_0x58026e[_0x1794('0x2a')],'type':_0x58026e[_0x1794('0x2b')]['key']};});_0xbe50a1[_0x1794('0x2c')]=_[_0x1794('0x27')](_0x5aab40,_0x1794('0x24'));_0xbe50a1[_0x1794('0x2d')]=_[_0x1794('0x2e')](_0x3c17b1['query']);_0xbe50a1[_0x1794('0x2f')]=_[_0x1794('0x30')](_0xbe50a1[_0x1794('0x2c')],_0xbe50a1[_0x1794('0x2d')]);_0x554a4a['attributes']=_[_0x1794('0x30')](_0xbe50a1[_0x1794('0x2c')],qs['fields'](_0x3c17b1[_0x1794('0x2d')]['fields']));_0x554a4a[_0x1794('0x31')]=_0x554a4a[_0x1794('0x31')]['length']?_0x554a4a[_0x1794('0x31')]:_0xbe50a1[_0x1794('0x2c')];if(!_0x3c17b1[_0x1794('0x2d')][_0x1794('0x32')](_0x1794('0x33'))){_0x554a4a['limit']=qs[_0x1794('0x34')](_0x3c17b1['query']['limit']);_0x554a4a['offset']=qs['offset'](_0x3c17b1[_0x1794('0x2d')][_0x1794('0x1c')]);}_0x554a4a[_0x1794('0x35')]=qs[_0x1794('0x36')](_0x3c17b1[_0x1794('0x2d')][_0x1794('0x36')]);_0x554a4a[_0x1794('0x37')]=qs[_0x1794('0x2f')](_[_0x1794('0x38')](_0x3c17b1[_0x1794('0x2d')],_0xbe50a1[_0x1794('0x2f')]),_0x5aab40);if(_0x3c17b1['query']['filter']){_0x554a4a['where']=_[_0x1794('0x39')](_0x554a4a[_0x1794('0x37')],{'$or':_[_0x1794('0x27')](_0x5aab40,function(_0x2169ec){if(_0x2169ec[_0x1794('0x2b')]!==_0x1794('0x3a')){var _0x193fd6={};_0x193fd6[_0x2169ec[_0x1794('0x24')]]={'$like':'%'+_0x3c17b1[_0x1794('0x2d')][_0x1794('0x3b')]+'%'};return _0x193fd6;}})});}_0x554a4a=_['merge']({},_0x554a4a,_0x3c17b1[_0x1794('0x3c')]);var _0x24807c={'where':_0x554a4a['where']};return db['Campaign']['count'](_0x24807c)['then'](function(_0x1a05f3){_0x249a69['count']=_0x1a05f3;if(_0x3c17b1[_0x1794('0x2d')][_0x1794('0x3d')]){_0x554a4a['include']=[{'all':!![]}];}return db[_0x1794('0x28')][_0x1794('0x3e')](_0x554a4a);})[_0x1794('0x20')](function(_0x28ae5e){_0x249a69[_0x1794('0x3f')]=_0x28ae5e;return _0x249a69;})[_0x1794('0x20')](respondWithFilteredResult(_0xa6ba9c,_0x554a4a))[_0x1794('0x40')](handleError(_0xa6ba9c,null));};exports[_0x1794('0x41')]=function(_0x5ac794,_0xce1654){var _0x2d1a16={'raw':![],'where':{'id':_0x5ac794[_0x1794('0x42')]['id']}},_0xdebba0={};_0xdebba0[_0x1794('0x2c')]=_['keys'](db[_0x1794('0x28')][_0x1794('0x29')]);_0xdebba0[_0x1794('0x2d')]=_['keys'](_0x5ac794[_0x1794('0x2d')]);_0xdebba0['filters']=_[_0x1794('0x30')](_0xdebba0[_0x1794('0x2c')],_0xdebba0[_0x1794('0x2d')]);_0x2d1a16['attributes']=_[_0x1794('0x30')](_0xdebba0[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x5ac794[_0x1794('0x2d')]['fields']));_0x2d1a16[_0x1794('0x31')]=_0x2d1a16[_0x1794('0x31')][_0x1794('0x44')]?_0x2d1a16[_0x1794('0x31')]:_0xdebba0[_0x1794('0x2c')];if(_0x5ac794[_0x1794('0x2d')][_0x1794('0x3d')]){_0x2d1a16[_0x1794('0x45')]=[{'all':!![]}];}_0x2d1a16=_[_0x1794('0x39')]({},_0x2d1a16,_0x5ac794[_0x1794('0x3c')]);return db[_0x1794('0x28')][_0x1794('0x46')](_0x2d1a16)[_0x1794('0x20')](handleEntityNotFound(_0xce1654,null))[_0x1794('0x20')](respondWithResult(_0xce1654,null))[_0x1794('0x40')](handleError(_0xce1654,null));};exports[_0x1794('0x47')]=function(_0x5e60d2,_0x372c3e){return db['Campaign'][_0x1794('0x47')](_0x5e60d2[_0x1794('0x48')],{})[_0x1794('0x20')](function(_0x42a702){var _0x2567b3=_0x5e60d2[_0x1794('0x49')][_0x1794('0x4a')]({'plain':!![]});if(!_0x2567b3)throw new Error(_0x1794('0x4b'));if(_0x2567b3[_0x1794('0x4c')]===_0x1794('0x49')){var _0x9539b2=_0x42a702[_0x1794('0x4a')]({'plain':!![]});var _0x3c601d=_0x1794('0x4d');return db[_0x1794('0x4e')]['find']({'where':{'name':_0x3c601d,'userProfileId':_0x2567b3[_0x1794('0x4f')]},'raw':!![]})[_0x1794('0x20')](function(_0x40a185){if(_0x40a185&&_0x40a185[_0x1794('0x50')]===0x0){return db['UserProfileResource'][_0x1794('0x47')]({'name':_0x9539b2[_0x1794('0x24')],'resourceId':_0x9539b2['id'],'type':_0x40a185[_0x1794('0x24')],'sectionId':_0x40a185['id']},{})[_0x1794('0x20')](function(){return _0x42a702;});}else{return _0x42a702;}})[_0x1794('0x40')](function(_0x32ee9f){logger[_0x1794('0x51')](_0x1794('0x52'),_0x32ee9f);throw _0x32ee9f;});}return _0x42a702;})['then'](respondWithResult(_0x372c3e,0xc9))['catch'](handleError(_0x372c3e,null));};exports[_0x1794('0x53')]=function(_0x3a9118,_0x57b63a){var _0x5d17b0={'where':{'id':_0x3a9118[_0x1794('0x42')]['id']}},_0x4ba5e6={};_0x4ba5e6[_0x1794('0x2c')]=_[_0x1794('0x2e')](db['Campaign'][_0x1794('0x29')]);_0x5d17b0[_0x1794('0x31')]=_[_0x1794('0x30')](_0x4ba5e6[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x3a9118[_0x1794('0x2d')][_0x1794('0x43')]));_0x5d17b0[_0x1794('0x31')]=_0x5d17b0['attributes'][_0x1794('0x44')]?_0x5d17b0[_0x1794('0x31')]:_0x4ba5e6['model'];if(_0x3a9118['query'][_0x1794('0x3d')]){_0x5d17b0[_0x1794('0x45')]=[{'all':!![]}];}_0x5d17b0=_['merge']({},_0x5d17b0,_0x3a9118[_0x1794('0x3c')]);return db[_0x1794('0x28')]['find'](_0x5d17b0)[_0x1794('0x20')](handleEntityNotFound(_0x57b63a,null))['then'](function(_0x28f0a3){if(_0x28f0a3){var _0x37cba3=_0x28f0a3[_0x1794('0x4a')]({'plain':!![]});_0x37cba3=qs[_0x1794('0x54')](_0x37cba3,['id',_0x1794('0x55'),_0x1794('0x56')]);_0x3a9118[_0x1794('0x48')]=_[_0x1794('0x54')](_0x3a9118[_0x1794('0x48')],['id',_0x1794('0x55'),_0x1794('0x56')]);return db['Campaign'][_0x1794('0x47')](_[_0x1794('0x39')](_0x37cba3,_0x3a9118[_0x1794('0x48')]),{'include':_0x3a9118[_0x1794('0x2d')][_0x1794('0x3d')]?[{'all':!![]}]:undefined})[_0x1794('0x20')](function(_0x259281){var _0x81e89a=_0x3a9118[_0x1794('0x49')][_0x1794('0x4a')]({'plain':!![]});if(!_0x81e89a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81e89a[_0x1794('0x4c')]===_0x1794('0x49')){var _0x172071=_0x259281[_0x1794('0x4a')]({'plain':!![]});var _0x18bb2d=_0x1794('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x18bb2d,'userProfileId':_0x81e89a[_0x1794('0x4f')]},'raw':!![]})[_0x1794('0x20')](function(_0xb86e28){if(_0xb86e28&&_0xb86e28['autoAssociation']===0x0){return db[_0x1794('0x22')][_0x1794('0x47')]({'name':_0x172071[_0x1794('0x24')],'resourceId':_0x172071['id'],'type':_0xb86e28[_0x1794('0x24')],'sectionId':_0xb86e28['id']},{})['then'](function(){return _0x259281;});}else{return _0x259281;}})[_0x1794('0x40')](function(_0x327be3){logger[_0x1794('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x327be3);throw _0x327be3;});}return _0x259281;});}})[_0x1794('0x20')](respondWithResult(_0x57b63a,0xc9))[_0x1794('0x40')](handleError(_0x57b63a,null));};exports[_0x1794('0x57')]=function(_0xac6ab1,_0xb59666){if(_0xac6ab1['body']['id']){delete _0xac6ab1['body']['id'];}return db[_0x1794('0x28')]['find']({'where':{'id':_0xac6ab1['params']['id']}})[_0x1794('0x20')](handleEntityNotFound(_0xb59666,null))[_0x1794('0x20')](saveUpdates(_0xac6ab1[_0x1794('0x48')],null))[_0x1794('0x20')](respondWithResult(_0xb59666,null))['catch'](handleError(_0xb59666,null));};exports[_0x1794('0x21')]=function(_0x497807,_0x4093e3){return db[_0x1794('0x28')][_0x1794('0x46')]({'where':{'id':_0x497807[_0x1794('0x42')]['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x4093e3,null))[_0x1794('0x20')](removeEntity(_0x4093e3,null))['catch'](handleError(_0x4093e3,null));};exports[_0x1794('0x58')]=function(_0x117bcb,_0x100058,_0xc05531){var _0x590026={'raw':!![],'where':{}};var _0x31808f={};var _0x5afd17={'count':0x0,'rows':[]};return db[_0x1794('0x28')][_0x1794('0x59')]({'where':{'id':_0x117bcb['params']['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x100058,null))[_0x1794('0x20')](function(_0x111d37){if(_0x111d37){_0x31808f['model']=_['keys'](db['CmHopper'][_0x1794('0x29')]);_0x31808f[_0x1794('0x2d')]=_[_0x1794('0x2e')](_0x117bcb[_0x1794('0x2d')]);_0x31808f[_0x1794('0x2f')]=_[_0x1794('0x30')](_0x31808f[_0x1794('0x2c')],_0x31808f['query']);_0x590026[_0x1794('0x31')]=_['intersection'](_0x31808f[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x117bcb[_0x1794('0x2d')][_0x1794('0x43')]));_0x590026[_0x1794('0x31')]=_0x590026[_0x1794('0x31')][_0x1794('0x44')]?_0x590026['attributes']:_0x31808f[_0x1794('0x2c')];if(!_0x117bcb[_0x1794('0x2d')][_0x1794('0x32')](_0x1794('0x33'))){_0x590026[_0x1794('0x34')]=qs[_0x1794('0x34')](_0x117bcb['query'][_0x1794('0x34')]);_0x590026[_0x1794('0x1c')]=qs[_0x1794('0x1c')](_0x117bcb[_0x1794('0x2d')]['offset']);}_0x590026[_0x1794('0x35')]=qs[_0x1794('0x36')](_0x117bcb['query'][_0x1794('0x36')]);_0x590026[_0x1794('0x37')]=qs[_0x1794('0x2f')](_[_0x1794('0x38')](_0x117bcb[_0x1794('0x2d')],_0x31808f[_0x1794('0x2f')]));_0x590026[_0x1794('0x37')][_0x1794('0x5a')]=_0x111d37['id'];if(_0x117bcb[_0x1794('0x2d')][_0x1794('0x3b')]){_0x590026[_0x1794('0x37')]=_['merge'](_0x590026['where'],{'$or':_[_0x1794('0x27')](_0x590026[_0x1794('0x31')],function(_0x1f154d){var _0x4c1724={};_0x4c1724[_0x1f154d]={'$like':'%'+_0x117bcb['query'][_0x1794('0x3b')]+'%'};return _0x4c1724;})});}_0x590026=_[_0x1794('0x39')]({},_0x590026,_0x117bcb[_0x1794('0x3c')]);return db[_0x1794('0x5b')][_0x1794('0x1b')]({'where':_0x590026['where']})[_0x1794('0x20')](function(_0x518e99){_0x5afd17['count']=_0x518e99;if(_0x117bcb[_0x1794('0x2d')][_0x1794('0x3d')]){_0x590026[_0x1794('0x45')]=[{'all':!![]}];}return db[_0x1794('0x5b')]['findAll'](_0x590026);})[_0x1794('0x20')](function(_0x1e12b1){_0x5afd17[_0x1794('0x3f')]=_0x1e12b1;return _0x5afd17;});}})['then'](respondWithFilteredResult(_0x100058,_0x590026))[_0x1794('0x40')](handleError(_0x100058,null));};exports[_0x1794('0x5c')]=function(_0x42ed3a,_0x1efc5f,_0x587c61){var _0x48af1e={'raw':!![],'where':{}};var _0x25a9a2={};var _0x48a3a2={'count':0x0,'rows':[]};return db[_0x1794('0x28')]['findOne']({'where':{'id':_0x42ed3a['params']['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x1efc5f,null))[_0x1794('0x20')](function(_0x4a9019){if(_0x4a9019){_0x25a9a2[_0x1794('0x2c')]=_[_0x1794('0x2e')](db[_0x1794('0x5d')][_0x1794('0x29')]);_0x25a9a2[_0x1794('0x2d')]=_['keys'](_0x42ed3a[_0x1794('0x2d')]);_0x25a9a2[_0x1794('0x2f')]=_[_0x1794('0x30')](_0x25a9a2[_0x1794('0x2c')],_0x25a9a2[_0x1794('0x2d')]);_0x48af1e[_0x1794('0x31')]=_['intersection'](_0x25a9a2[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x42ed3a[_0x1794('0x2d')][_0x1794('0x43')]));_0x48af1e[_0x1794('0x31')]=_0x48af1e[_0x1794('0x31')][_0x1794('0x44')]?_0x48af1e[_0x1794('0x31')]:_0x25a9a2[_0x1794('0x2c')];if(!_0x42ed3a[_0x1794('0x2d')]['hasOwnProperty'](_0x1794('0x33'))){_0x48af1e['limit']=qs[_0x1794('0x34')](_0x42ed3a[_0x1794('0x2d')]['limit']);_0x48af1e[_0x1794('0x1c')]=qs[_0x1794('0x1c')](_0x42ed3a[_0x1794('0x2d')][_0x1794('0x1c')]);}_0x48af1e['order']=qs[_0x1794('0x36')](_0x42ed3a['query'][_0x1794('0x36')]);_0x48af1e[_0x1794('0x37')]=qs[_0x1794('0x2f')](_[_0x1794('0x38')](_0x42ed3a[_0x1794('0x2d')],_0x25a9a2[_0x1794('0x2f')]));_0x48af1e[_0x1794('0x37')][_0x1794('0x5a')]=_0x4a9019['id'];if(_0x42ed3a['query']['filter']){_0x48af1e[_0x1794('0x37')]=_[_0x1794('0x39')](_0x48af1e[_0x1794('0x37')],{'$or':_[_0x1794('0x27')](_0x48af1e[_0x1794('0x31')],function(_0xa4465c){var _0x39fafb={};_0x39fafb[_0xa4465c]={'$like':'%'+_0x42ed3a[_0x1794('0x2d')][_0x1794('0x3b')]+'%'};return _0x39fafb;})});}_0x48af1e=_[_0x1794('0x39')]({},_0x48af1e,_0x42ed3a[_0x1794('0x3c')]);return db[_0x1794('0x5d')]['count']({'where':_0x48af1e[_0x1794('0x37')]})[_0x1794('0x20')](function(_0x3d7a9a){_0x48a3a2['count']=_0x3d7a9a;if(_0x42ed3a[_0x1794('0x2d')]['includeAll']){_0x48af1e[_0x1794('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1794('0x3e')](_0x48af1e);})[_0x1794('0x20')](function(_0x48d4f0){_0x48a3a2[_0x1794('0x3f')]=_0x48d4f0;return _0x48a3a2;});}})[_0x1794('0x20')](respondWithFilteredResult(_0x1efc5f,_0x48af1e))[_0x1794('0x40')](handleError(_0x1efc5f,null));};exports[_0x1794('0x5e')]=function(_0x9d0d60,_0x7d3b76,_0x1cc67c){var _0x34c9a9={'raw':!![],'where':{}};var _0x4e9873={};var _0x4c60a9={'count':0x0,'rows':[]};return db[_0x1794('0x28')][_0x1794('0x59')]({'where':{'id':_0x9d0d60['params']['id']}})['then'](handleEntityNotFound(_0x7d3b76,null))['then'](function(_0x353619){if(_0x353619){_0x4e9873[_0x1794('0x2c')]=_['keys'](db[_0x1794('0x5f')][_0x1794('0x29')]);_0x4e9873[_0x1794('0x2d')]=_[_0x1794('0x2e')](_0x9d0d60[_0x1794('0x2d')]);_0x4e9873[_0x1794('0x2f')]=_[_0x1794('0x30')](_0x4e9873[_0x1794('0x2c')],_0x4e9873[_0x1794('0x2d')]);_0x34c9a9[_0x1794('0x31')]=_[_0x1794('0x30')](_0x4e9873[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x9d0d60[_0x1794('0x2d')][_0x1794('0x43')]));_0x34c9a9['attributes']=_0x34c9a9[_0x1794('0x31')][_0x1794('0x44')]?_0x34c9a9[_0x1794('0x31')]:_0x4e9873[_0x1794('0x2c')];if(!_0x9d0d60[_0x1794('0x2d')][_0x1794('0x32')](_0x1794('0x33'))){_0x34c9a9[_0x1794('0x34')]=qs[_0x1794('0x34')](_0x9d0d60['query']['limit']);_0x34c9a9[_0x1794('0x1c')]=qs[_0x1794('0x1c')](_0x9d0d60[_0x1794('0x2d')][_0x1794('0x1c')]);}_0x34c9a9[_0x1794('0x35')]=qs[_0x1794('0x36')](_0x9d0d60[_0x1794('0x2d')][_0x1794('0x36')]);_0x34c9a9[_0x1794('0x37')]=qs[_0x1794('0x2f')](_['pick'](_0x9d0d60[_0x1794('0x2d')],_0x4e9873[_0x1794('0x2f')]));_0x34c9a9[_0x1794('0x37')][_0x1794('0x5a')]=_0x353619['id'];if(_0x9d0d60['query'][_0x1794('0x3b')]){_0x34c9a9[_0x1794('0x37')]=_[_0x1794('0x39')](_0x34c9a9[_0x1794('0x37')],{'$or':_[_0x1794('0x27')](_0x34c9a9['attributes'],function(_0xc005e4){var _0x143e2c={};_0x143e2c[_0xc005e4]={'$like':'%'+_0x9d0d60[_0x1794('0x2d')][_0x1794('0x3b')]+'%'};return _0x143e2c;})});}_0x34c9a9=_[_0x1794('0x39')]({},_0x34c9a9,_0x9d0d60['options']);return db['CmHopperFinal']['count']({'where':_0x34c9a9[_0x1794('0x37')]})['then'](function(_0x267272){_0x4c60a9[_0x1794('0x1b')]=_0x267272;if(_0x9d0d60[_0x1794('0x2d')][_0x1794('0x3d')]){_0x34c9a9[_0x1794('0x45')]=[{'all':!![]}];}return db[_0x1794('0x5f')][_0x1794('0x3e')](_0x34c9a9);})[_0x1794('0x20')](function(_0xe05024){_0x4c60a9[_0x1794('0x3f')]=_0xe05024;return _0x4c60a9;});}})[_0x1794('0x20')](respondWithFilteredResult(_0x7d3b76,_0x34c9a9))[_0x1794('0x40')](handleError(_0x7d3b76,null));};exports['getHopperBlacks']=function(_0x52abcf,_0x3d656b,_0x1c8841){var _0x3226f4={'raw':!![],'where':{}};var _0x5ea820={};var _0x129485={'count':0x0,'rows':[]};return db[_0x1794('0x28')][_0x1794('0x59')]({'where':{'id':_0x52abcf[_0x1794('0x42')]['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x3d656b,null))[_0x1794('0x20')](function(_0xf87f71){if(_0xf87f71){_0x5ea820[_0x1794('0x2c')]=_[_0x1794('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x5ea820[_0x1794('0x2d')]=_['keys'](_0x52abcf[_0x1794('0x2d')]);_0x5ea820[_0x1794('0x2f')]=_[_0x1794('0x30')](_0x5ea820[_0x1794('0x2c')],_0x5ea820[_0x1794('0x2d')]);_0x3226f4[_0x1794('0x31')]=_[_0x1794('0x30')](_0x5ea820[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x52abcf[_0x1794('0x2d')][_0x1794('0x43')]));_0x3226f4[_0x1794('0x31')]=_0x3226f4['attributes'][_0x1794('0x44')]?_0x3226f4['attributes']:_0x5ea820[_0x1794('0x2c')];if(!_0x52abcf[_0x1794('0x2d')][_0x1794('0x32')](_0x1794('0x33'))){_0x3226f4['limit']=qs[_0x1794('0x34')](_0x52abcf[_0x1794('0x2d')][_0x1794('0x34')]);_0x3226f4[_0x1794('0x1c')]=qs[_0x1794('0x1c')](_0x52abcf[_0x1794('0x2d')][_0x1794('0x1c')]);}_0x3226f4['order']=qs[_0x1794('0x36')](_0x52abcf[_0x1794('0x2d')][_0x1794('0x36')]);_0x3226f4[_0x1794('0x37')]=qs['filters'](_[_0x1794('0x38')](_0x52abcf['query'],_0x5ea820[_0x1794('0x2f')]));_0x3226f4[_0x1794('0x37')][_0x1794('0x5a')]=_0xf87f71['id'];if(_0x52abcf['query']['filter']){_0x3226f4[_0x1794('0x37')]=_[_0x1794('0x39')](_0x3226f4['where'],{'$or':_[_0x1794('0x27')](_0x3226f4[_0x1794('0x31')],function(_0x2f2f41){var _0x787c33={};_0x787c33[_0x2f2f41]={'$like':'%'+_0x52abcf[_0x1794('0x2d')][_0x1794('0x3b')]+'%'};return _0x787c33;})});}_0x3226f4=_[_0x1794('0x39')]({},_0x3226f4,_0x52abcf[_0x1794('0x3c')]);return db[_0x1794('0x60')][_0x1794('0x1b')]({'where':_0x3226f4[_0x1794('0x37')]})[_0x1794('0x20')](function(_0x366cca){_0x129485[_0x1794('0x1b')]=_0x366cca;if(_0x52abcf[_0x1794('0x2d')][_0x1794('0x3d')]){_0x3226f4['include']=[{'all':!![]}];}return db[_0x1794('0x60')][_0x1794('0x3e')](_0x3226f4);})[_0x1794('0x20')](function(_0x3e771b){_0x129485[_0x1794('0x3f')]=_0x3e771b;return _0x129485;});}})['then'](respondWithFilteredResult(_0x3d656b,_0x3226f4))[_0x1794('0x40')](handleError(_0x3d656b,null));};exports['getLists']=function(_0x1443ae,_0x275841,_0x221072){var _0x32fcd8={};var _0x5b6d16={};var _0x27a24e;var _0x23869e;return db['Campaign']['findOne']({'where':{'id':_0x1443ae[_0x1794('0x42')]['id']}})['then'](handleEntityNotFound(_0x275841,null))['then'](function(_0x425015){if(_0x425015){_0x27a24e=_0x425015;_0x5b6d16[_0x1794('0x2c')]=_[_0x1794('0x2e')](db['CmList']['rawAttributes']);_0x5b6d16[_0x1794('0x2d')]=_[_0x1794('0x2e')](_0x1443ae[_0x1794('0x2d')]);_0x5b6d16[_0x1794('0x2f')]=_[_0x1794('0x30')](_0x5b6d16['model'],_0x5b6d16[_0x1794('0x2d')]);_0x32fcd8[_0x1794('0x31')]=_[_0x1794('0x30')](_0x5b6d16['model'],qs[_0x1794('0x43')](_0x1443ae[_0x1794('0x2d')][_0x1794('0x43')]));_0x32fcd8[_0x1794('0x31')]=_0x32fcd8[_0x1794('0x31')][_0x1794('0x44')]?_0x32fcd8[_0x1794('0x31')]:_0x5b6d16['model'];_0x32fcd8[_0x1794('0x35')]=qs['sort'](_0x1443ae[_0x1794('0x2d')][_0x1794('0x36')]);_0x32fcd8[_0x1794('0x37')]=qs[_0x1794('0x2f')](_[_0x1794('0x38')](_0x1443ae[_0x1794('0x2d')],_0x5b6d16[_0x1794('0x2f')]));if(_0x1443ae[_0x1794('0x2d')][_0x1794('0x3b')]){_0x32fcd8[_0x1794('0x37')]=_[_0x1794('0x39')](_0x32fcd8[_0x1794('0x37')],{'$or':_[_0x1794('0x27')](_0x32fcd8[_0x1794('0x31')],function(_0x300ad0){var _0x39b637={};_0x39b637[_0x300ad0]={'$like':'%'+_0x1443ae[_0x1794('0x2d')]['filter']+'%'};return _0x39b637;})});}_0x32fcd8=_[_0x1794('0x39')]({},_0x32fcd8,_0x1443ae['options']);return _0x27a24e[_0x1794('0x61')](_0x32fcd8);}})[_0x1794('0x20')](function(_0x212f1c){if(_0x212f1c){_0x23869e=_0x212f1c[_0x1794('0x44')];if(!_0x1443ae[_0x1794('0x2d')][_0x1794('0x32')]('nolimit')){_0x32fcd8[_0x1794('0x34')]=qs[_0x1794('0x34')](_0x1443ae[_0x1794('0x2d')][_0x1794('0x34')]);_0x32fcd8[_0x1794('0x1c')]=qs[_0x1794('0x1c')](_0x1443ae[_0x1794('0x2d')][_0x1794('0x1c')]);}return _0x27a24e[_0x1794('0x61')](_0x32fcd8);}})[_0x1794('0x20')](function(_0x131009){if(_0x131009){return _0x131009?{'count':_0x23869e,'rows':_0x131009}:null;}})[_0x1794('0x20')](respondWithResult(_0x275841,null))[_0x1794('0x40')](handleError(_0x275841,null));};exports['addLists']=function(_0x8a7e0e,_0x2b1f7a,_0x267baf){var _0xa662,_0xb74ac2;return db[_0x1794('0x28')][_0x1794('0x46')]({'where':{'id':_0x8a7e0e['params']['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x2b1f7a,null))['then'](function(_0x326a53){if(_0x326a53){_0xb74ac2=_0x326a53;return _0x326a53[_0x1794('0x62')](_0x8a7e0e[_0x1794('0x48')][_0x1794('0x63')],_[_0x1794('0x54')](_0x8a7e0e['body'],['ids','id'])||{});}return null;})[_0x1794('0x64')](function(_0x38581a){var _0x22d4a6;_0xa662=_0x38581a||[];var _0x3c5679=[];if(_0x38581a){for(var _0x4f1974=0x0;_0x4f1974<_0x38581a[_0x1794('0x44')];_0x4f1974+=0x1){var _0x350bdf=_0x38581a[_0x4f1974][_0x1794('0x4a')]({'plain':!![]});_0xb74ac2[_0x1794('0x65')]=_0x8a7e0e['body'][_0x1794('0x65')]?_0x8a7e0e['body']['dialCheckDuplicateType']:_0xb74ac2[_0x1794('0x65')];switch(_0xb74ac2[_0x1794('0x65')]){case'always':_0x22d4a6=squel['insert']()[_0x1794('0x66')]('cm_hopper')[_0x1794('0x67')]([_0x1794('0x68'),'scheduledAt',_0x1794('0x69'),'ListId',_0x1794('0x5a'),_0x1794('0x55'),_0x1794('0x56')],squel['select']()['field'](_0x1794('0x68'),_0x1794('0x68'))[_0x1794('0x6a')](_0x1794('0x6b'),_0x1794('0x6c'))['field']('id',_0x1794('0x69'))['field'](_0x350bdf[_0x1794('0x6d')][_0x1794('0x6e')](),_0x1794('0x6f'))[_0x1794('0x6a')](_0x8a7e0e[_0x1794('0x42')]['id'][_0x1794('0x6e')](),'CampaignId')[_0x1794('0x6a')](_0x1794('0x6b'),_0x1794('0x55'))['field'](_0x1794('0x6b'),_0x1794('0x56'))[_0x1794('0x70')](_0x1794('0x71'))['where'](_0x1794('0x72'))[_0x1794('0x37')](_0x1794('0x73'),_0x350bdf[_0x1794('0x6d')][_0x1794('0x6e')]())['where'](_0x1794('0x74'))[_0x1794('0x37')](_0x1794('0x75'),squel[_0x1794('0x76')]()[_0x1794('0x6a')]('COALESCE(calleridnum,\x27\x27)')[_0x1794('0x70')](_0x1794('0x77'))['where'](_0x1794('0x78'),_0x8a7e0e[_0x1794('0x42')]['id'][_0x1794('0x6e')]()))[_0x1794('0x37')](_0x1794('0x75'),squel[_0x1794('0x76')]()[_0x1794('0x6a')]('COALESCE(phone,\x27\x27)')[_0x1794('0x70')](_0x1794('0x79'))['where']('CampaignId\x20=\x20?',_0x8a7e0e[_0x1794('0x42')]['id']['toString']())))[_0x1794('0x6e')]();break;case _0x1794('0x7a'):_0x22d4a6=squel[_0x1794('0x7b')]()[_0x1794('0x66')](_0x1794('0x79'))[_0x1794('0x67')](['phone',_0x1794('0x6c'),_0x1794('0x69'),_0x1794('0x6f'),_0x1794('0x5a'),_0x1794('0x55'),_0x1794('0x56')],squel[_0x1794('0x76')]()[_0x1794('0x6a')](_0x1794('0x68'),_0x1794('0x68'))[_0x1794('0x6a')](_0x1794('0x6b'),_0x1794('0x6c'))[_0x1794('0x6a')]('id','ContactId')[_0x1794('0x6a')](_0x350bdf[_0x1794('0x6d')][_0x1794('0x6e')](),_0x1794('0x6f'))[_0x1794('0x6a')](_0x8a7e0e['params']['id'][_0x1794('0x6e')](),_0x1794('0x5a'))['field'](_0x1794('0x6b'),'createdAt')[_0x1794('0x6a')](_0x1794('0x6b'),'updatedAt')[_0x1794('0x70')]('cm_contacts')['where'](_0x1794('0x72'))[_0x1794('0x37')](_0x1794('0x73'),_0x350bdf[_0x1794('0x6d')]['toString']())[_0x1794('0x37')](_0x1794('0x74'))[_0x1794('0x37')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x1794('0x6a')]('COALESCE(phone,\x27\x27)')[_0x1794('0x70')](_0x1794('0x79'))['where'](_0x1794('0x78'),_0x8a7e0e[_0x1794('0x42')]['id'][_0x1794('0x6e')]())))['toString']();break;default:_0x22d4a6=squel[_0x1794('0x7b')]()[_0x1794('0x66')]('cm_hopper')['fromQuery']([_0x1794('0x68'),_0x1794('0x6c'),'ContactId','ListId',_0x1794('0x5a'),_0x1794('0x55'),_0x1794('0x56')],squel[_0x1794('0x76')]()[_0x1794('0x6a')](_0x1794('0x68'),_0x1794('0x68'))['field']('NOW()',_0x1794('0x6c'))[_0x1794('0x6a')]('id',_0x1794('0x69'))[_0x1794('0x6a')](_0x350bdf[_0x1794('0x6d')]['toString'](),'ListId')[_0x1794('0x6a')](_0x8a7e0e[_0x1794('0x42')]['id'][_0x1794('0x6e')](),_0x1794('0x5a'))[_0x1794('0x6a')](_0x1794('0x6b'),_0x1794('0x55'))['field'](_0x1794('0x6b'),_0x1794('0x56'))['from'](_0x1794('0x71'))[_0x1794('0x37')](_0x1794('0x72'))['where']('ListId\x20=\x20?',_0x350bdf[_0x1794('0x6d')][_0x1794('0x6e')]())['where'](_0x1794('0x74')))[_0x1794('0x6e')]();}_0x3c5679[_0x1794('0x7c')](db['sequelize'][_0x1794('0x2d')](_0x22d4a6));}return BPromise[_0x1794('0x7d')](_0x3c5679);}})['then'](function(){return _0xa662;})['then'](respondWithResult(_0x2b1f7a,null))[_0x1794('0x40')](handleError(_0x2b1f7a,null));};exports[_0x1794('0x7e')]=function(_0x5d6048,_0x1471fd,_0x2c715a){return db[_0x1794('0x28')][_0x1794('0x46')]({'where':{'id':_0x5d6048[_0x1794('0x42')]['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x1471fd,null))[_0x1794('0x20')](function(_0x1fec27){if(_0x1fec27){return _0x1fec27[_0x1794('0x7e')](_0x5d6048['query']['ids']);}})[_0x1794('0x20')](function(_0x311be3){if(_0x311be3){return db[_0x1794('0x5b')]['destroy']({'where':{'ListId':_0x5d6048[_0x1794('0x2d')][_0x1794('0x63')],'CampaignId':_0x5d6048[_0x1794('0x42')]['id']}})[_0x1794('0x20')](function(){return _0x311be3;});}})[_0x1794('0x20')](respondWithStatusCode(_0x1471fd,null))[_0x1794('0x40')](handleError(_0x1471fd,null));};exports[_0x1794('0x7f')]=function(_0x3de4e5,_0x207272,_0x4a0937){var _0xd69e77={'raw':!![],'where':{}};var _0x5826a1={};var _0x5aac7c={'count':0x0,'rows':[]};return db[_0x1794('0x28')][_0x1794('0x59')]({'where':{'id':_0x3de4e5['params']['id']}})['then'](handleEntityNotFound(_0x207272,null))[_0x1794('0x20')](function(_0x1b7cfd){if(_0x1b7cfd){_0x5826a1['model']=_[_0x1794('0x2e')](db[_0x1794('0x80')]['rawAttributes']);_0x5826a1[_0x1794('0x2d')]=_[_0x1794('0x2e')](_0x3de4e5[_0x1794('0x2d')]);_0x5826a1[_0x1794('0x2f')]=_[_0x1794('0x30')](_0x5826a1['model'],_0x5826a1[_0x1794('0x2d')]);_0xd69e77[_0x1794('0x31')]=_[_0x1794('0x30')](_0x5826a1[_0x1794('0x2c')],qs[_0x1794('0x43')](_0x3de4e5[_0x1794('0x2d')][_0x1794('0x43')]));_0xd69e77[_0x1794('0x31')]=_0xd69e77['attributes']['length']?_0xd69e77[_0x1794('0x31')]:_0x5826a1[_0x1794('0x2c')];if(!_0x3de4e5['query'][_0x1794('0x32')](_0x1794('0x33'))){_0xd69e77[_0x1794('0x34')]=qs['limit'](_0x3de4e5[_0x1794('0x2d')][_0x1794('0x34')]);_0xd69e77[_0x1794('0x1c')]=qs[_0x1794('0x1c')](_0x3de4e5[_0x1794('0x2d')][_0x1794('0x1c')]);}_0xd69e77[_0x1794('0x35')]=qs[_0x1794('0x36')](_0x3de4e5['query']['sort']);_0xd69e77[_0x1794('0x37')]=qs[_0x1794('0x2f')](_[_0x1794('0x38')](_0x3de4e5[_0x1794('0x2d')],_0x5826a1[_0x1794('0x2f')]));_0xd69e77['where']['CampaignId']=_0x1b7cfd['id'];if(_0x3de4e5[_0x1794('0x2d')][_0x1794('0x3b')]){_0xd69e77[_0x1794('0x37')]=_[_0x1794('0x39')](_0xd69e77[_0x1794('0x37')],{'$or':_[_0x1794('0x27')](_0xd69e77[_0x1794('0x31')],function(_0xca4062){var _0x5956cc={};_0x5956cc[_0xca4062]={'$like':'%'+_0x3de4e5[_0x1794('0x2d')][_0x1794('0x3b')]+'%'};return _0x5956cc;})});}_0xd69e77=_['merge']({},_0xd69e77,_0x3de4e5[_0x1794('0x3c')]);return db[_0x1794('0x80')][_0x1794('0x1b')]({'where':_0xd69e77[_0x1794('0x37')]})['then'](function(_0x17de48){_0x5aac7c['count']=_0x17de48;if(_0x3de4e5[_0x1794('0x2d')][_0x1794('0x3d')]){_0xd69e77[_0x1794('0x45')]=[{'all':!![]}];}return db[_0x1794('0x80')][_0x1794('0x3e')](_0xd69e77);})[_0x1794('0x20')](function(_0x265841){_0x5aac7c[_0x1794('0x3f')]=_0x265841;return _0x5aac7c;});}})['then'](respondWithFilteredResult(_0x207272,_0xd69e77))[_0x1794('0x40')](handleError(_0x207272,null));};exports[_0x1794('0x81')]=function(_0x2aab68,_0x519a1c,_0xc6327e){var _0x56858b,_0x478594;return db[_0x1794('0x28')][_0x1794('0x46')]({'where':{'id':_0x2aab68[_0x1794('0x42')]['id']}})[_0x1794('0x20')](handleEntityNotFound(_0x519a1c,null))[_0x1794('0x20')](function(_0x18a8de){if(_0x18a8de){_0x478594=_0x18a8de;return _0x18a8de[_0x1794('0x81')](_0x2aab68[_0x1794('0x48')][_0x1794('0x63')],_[_0x1794('0x54')](_0x2aab68[_0x1794('0x48')],[_0x1794('0x63'),'id'])||{});}return null;})['spread'](function(_0x3f6db0){var _0x54415a;_0x56858b=_0x3f6db0||[];var _0x221a03=[];if(_0x3f6db0){for(var _0x310cd0=0x0;_0x310cd0<_0x3f6db0[_0x1794('0x44')];_0x310cd0+=0x1){var _0xddb9b=_0x3f6db0[_0x310cd0]['get']({'plain':!![]});_0x54415a=squel['insert']()[_0x1794('0x66')](_0x1794('0x82'))['fromQuery']([_0x1794('0x68'),_0x1794('0x69'),_0x1794('0x6f'),'CampaignId',_0x1794('0x55'),_0x1794('0x56')],squel[_0x1794('0x76')]()[_0x1794('0x6a')]('phone',_0x1794('0x68'))['field']('id',_0x1794('0x69'))[_0x1794('0x6a')](_0xddb9b['CmListId'][_0x1794('0x6e')](),_0x1794('0x6f'))[_0x1794('0x6a')](_0x2aab68[_0x1794('0x42')]['id'][_0x1794('0x6e')](),_0x1794('0x5a'))['field'](_0x1794('0x6b'),_0x1794('0x55'))[_0x1794('0x6a')](_0x1794('0x6b'),_0x1794('0x56'))[_0x1794('0x70')](_0x1794('0x71'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0xddb9b[_0x1794('0x6d')]['toString']())[_0x1794('0x37')](_0x1794('0x74')))['toString']();_0x221a03[_0x1794('0x7c')](db[_0x1794('0x83')][_0x1794('0x2d')](_0x54415a));}return BPromise[_0x1794('0x7d')](_0x221a03);}})[_0x1794('0x20')](function(){return _0x56858b;})[_0x1794('0x20')](respondWithResult(_0x519a1c,null))['catch'](handleError(_0x519a1c,null));};exports[_0x1794('0x84')]=function(_0x5dd37d,_0x3ce06,_0x9b1f41){return db[_0x1794('0x28')]['find']({'where':{'id':_0x5dd37d[_0x1794('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ce06,null))['then'](function(_0x335b58){if(_0x335b58){return _0x335b58[_0x1794('0x84')](_0x5dd37d[_0x1794('0x2d')][_0x1794('0x63')]);}})[_0x1794('0x20')](function(_0x252b22){if(_0x252b22){return db[_0x1794('0x60')][_0x1794('0x21')]({'where':{'ListId':_0x5dd37d[_0x1794('0x2d')][_0x1794('0x63')],'CampaignId':_0x5dd37d[_0x1794('0x42')]['id']}})[_0x1794('0x20')](function(){return _0x252b22;});}})[_0x1794('0x20')](respondWithStatusCode(_0x3ce06,null))[_0x1794('0x40')](handleError(_0x3ce06,null));}; \ No newline at end of file +var _0xb489=['all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','get','destroy','error','name','send','index','map','Campaign','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','role','IvrCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getHoppers','findOne','CampaignId','CmHopper','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','sequelize','removeLists','ids','getBlackLists','addBlackLists','push'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb489,0x187));var _0x9b48=function(_0x54655c,_0x2ecea5){_0x54655c=_0x54655c-0x0;var _0x5e503f=_0xb489[_0x54655c];return _0x5e503f;};'use strict';var pdf=require(_0x9b48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9b48('0x1'));var zipdir=require(_0x9b48('0x2'));var jsonpatch=require(_0x9b48('0x3'));var rp=require(_0x9b48('0x4'));var moment=require('moment');var BPromise=require(_0x9b48('0x5'));var Mustache=require(_0x9b48('0x6'));var util=require('util');var path=require(_0x9b48('0x7'));var sox=require('sox');var csv=require(_0x9b48('0x8'));var ejs=require(_0x9b48('0x9'));var fs=require('fs');var _=require(_0x9b48('0xa'));var squel=require(_0x9b48('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9b48('0xc'));var toCsv=require(_0x9b48('0x8'));var querystring=require(_0x9b48('0xd'));var Papa=require(_0x9b48('0xe'));var Redis=require(_0x9b48('0xf'));var authService=require(_0x9b48('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9b48('0x11'));var hardwareService=require(_0x9b48('0x12'));var logger=require(_0x9b48('0x13'))(_0x9b48('0x14'));var utils=require('../../config/utils');var config=require(_0x9b48('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47563e,_0xbbce66){_0xbbce66=_0xbbce66||0xcc;return function(_0x34e235){if(_0x34e235){return _0x47563e[_0x9b48('0x16')](_0xbbce66);}return _0x47563e['status'](_0xbbce66)[_0x9b48('0x17')]();};}function respondWithResult(_0x20811e,_0x2f4236){_0x2f4236=_0x2f4236||0xc8;return function(_0x5841fb){if(_0x5841fb){return _0x20811e[_0x9b48('0x18')](_0x2f4236)[_0x9b48('0x19')](_0x5841fb);}};}function respondWithFilteredResult(_0x4ebf43,_0x35f684){return function(_0x52e547){if(_0x52e547){var _0x3553f6=_0x52e547[_0x9b48('0x1a')],_0x1ce937=_0x35f684[_0x9b48('0x1b')],_0xb4f2b=_0x35f684[_0x9b48('0x1b')]+_0x35f684[_0x9b48('0x1c')],_0x5017f2;if(_0xb4f2b>=_0x3553f6){_0xb4f2b=_0x3553f6;_0x5017f2=0xc8;}else{_0x5017f2=0xce;}_0x4ebf43[_0x9b48('0x18')](_0x5017f2);return _0x4ebf43['set'](_0x9b48('0x1d'),_0x1ce937+'-'+_0xb4f2b+'/'+_0x3553f6)[_0x9b48('0x19')](_0x52e547);}return null;};}function patchUpdates(_0x1a695a){return function(_0x52850b){try{jsonpatch[_0x9b48('0x1e')](_0x52850b,_0x1a695a,!![]);}catch(_0x30d9ea){return BPromise[_0x9b48('0x1f')](_0x30d9ea);}return _0x52850b[_0x9b48('0x20')]();};}function saveUpdates(_0x5e0aab,_0x4c5559){return function(_0x4d18b7){if(_0x4d18b7){return _0x4d18b7['update'](_0x5e0aab)[_0x9b48('0x21')](function(_0x31030d){return _0x31030d;});}return null;};}function removeEntity(_0x32414a,_0x6c3a17){return function(_0x888e37){if(_0x888e37){return _0x888e37['destroy']()[_0x9b48('0x21')](function(){var _0x1c0abb=_0x888e37[_0x9b48('0x22')]({'plain':!![]});var _0x4ecb0a='IvrCampaigns';return db['UserProfileResource'][_0x9b48('0x23')]({'where':{'type':_0x4ecb0a,'resourceId':_0x1c0abb['id']}})[_0x9b48('0x21')](function(){return _0x888e37;});})[_0x9b48('0x21')](function(){_0x32414a[_0x9b48('0x18')](0xcc)[_0x9b48('0x17')]();});}};}function handleEntityNotFound(_0x308840,_0xba6e29){return function(_0x39930e){if(!_0x39930e){_0x308840[_0x9b48('0x16')](0x194);}return _0x39930e;};}function handleError(_0x5c6df2,_0x525526){_0x525526=_0x525526||0x1f4;return function(_0x3c1daf){logger[_0x9b48('0x24')](_0x3c1daf['stack']);if(_0x3c1daf[_0x9b48('0x25')]){delete _0x3c1daf[_0x9b48('0x25')];}_0x5c6df2[_0x9b48('0x18')](_0x525526)[_0x9b48('0x26')](_0x3c1daf);};}exports[_0x9b48('0x27')]=function(_0x4a7cdd,_0x4f7e5f){var _0xa4ba67={},_0x51a09b={},_0x57edc7={'count':0x0,'rows':[]};var _0x132673=_[_0x9b48('0x28')](db[_0x9b48('0x29')][_0x9b48('0x2a')],function(_0x13c609){return{'name':_0x13c609['fieldName'],'type':_0x13c609[_0x9b48('0x2b')][_0x9b48('0x2c')]};});_0x51a09b[_0x9b48('0x2d')]=_['map'](_0x132673,_0x9b48('0x25'));_0x51a09b['query']=_[_0x9b48('0x2e')](_0x4a7cdd[_0x9b48('0x2f')]);_0x51a09b[_0x9b48('0x30')]=_[_0x9b48('0x31')](_0x51a09b['model'],_0x51a09b[_0x9b48('0x2f')]);_0xa4ba67[_0x9b48('0x32')]=_[_0x9b48('0x31')](_0x51a09b[_0x9b48('0x2d')],qs[_0x9b48('0x33')](_0x4a7cdd['query']['fields']));_0xa4ba67[_0x9b48('0x32')]=_0xa4ba67[_0x9b48('0x32')]['length']?_0xa4ba67[_0x9b48('0x32')]:_0x51a09b[_0x9b48('0x2d')];if(!_0x4a7cdd[_0x9b48('0x2f')][_0x9b48('0x34')](_0x9b48('0x35'))){_0xa4ba67['limit']=qs['limit'](_0x4a7cdd[_0x9b48('0x2f')][_0x9b48('0x1c')]);_0xa4ba67[_0x9b48('0x1b')]=qs['offset'](_0x4a7cdd[_0x9b48('0x2f')][_0x9b48('0x1b')]);}_0xa4ba67[_0x9b48('0x36')]=qs[_0x9b48('0x37')](_0x4a7cdd[_0x9b48('0x2f')]['sort']);_0xa4ba67['where']=qs[_0x9b48('0x30')](_[_0x9b48('0x38')](_0x4a7cdd[_0x9b48('0x2f')],_0x51a09b[_0x9b48('0x30')]),_0x132673);if(_0x4a7cdd['query'][_0x9b48('0x39')]){_0xa4ba67[_0x9b48('0x3a')]=_[_0x9b48('0x3b')](_0xa4ba67[_0x9b48('0x3a')],{'$or':_[_0x9b48('0x28')](_0x132673,function(_0x371121){if(_0x371121[_0x9b48('0x2b')]!=='VIRTUAL'){var _0x143f8a={};_0x143f8a[_0x371121[_0x9b48('0x25')]]={'$like':'%'+_0x4a7cdd['query'][_0x9b48('0x39')]+'%'};return _0x143f8a;}})});}_0xa4ba67=_[_0x9b48('0x3b')]({},_0xa4ba67,_0x4a7cdd['options']);var _0x4323c7={'where':_0xa4ba67[_0x9b48('0x3a')]};return db['Campaign']['count'](_0x4323c7)[_0x9b48('0x21')](function(_0x148908){_0x57edc7[_0x9b48('0x1a')]=_0x148908;if(_0x4a7cdd[_0x9b48('0x2f')][_0x9b48('0x3c')]){_0xa4ba67[_0x9b48('0x3d')]=[{'all':!![]}];}return db[_0x9b48('0x29')][_0x9b48('0x3e')](_0xa4ba67);})['then'](function(_0xd6eb68){_0x57edc7[_0x9b48('0x3f')]=_0xd6eb68;return _0x57edc7;})[_0x9b48('0x21')](respondWithFilteredResult(_0x4f7e5f,_0xa4ba67))['catch'](handleError(_0x4f7e5f,null));};exports[_0x9b48('0x40')]=function(_0x362ec7,_0x517b4c){var _0x1d2163={'raw':![],'where':{'id':_0x362ec7[_0x9b48('0x41')]['id']}},_0x3cb113={};_0x3cb113['model']=_[_0x9b48('0x2e')](db[_0x9b48('0x29')][_0x9b48('0x2a')]);_0x3cb113[_0x9b48('0x2f')]=_[_0x9b48('0x2e')](_0x362ec7['query']);_0x3cb113[_0x9b48('0x30')]=_[_0x9b48('0x31')](_0x3cb113[_0x9b48('0x2d')],_0x3cb113[_0x9b48('0x2f')]);_0x1d2163['attributes']=_[_0x9b48('0x31')](_0x3cb113['model'],qs[_0x9b48('0x33')](_0x362ec7[_0x9b48('0x2f')][_0x9b48('0x33')]));_0x1d2163['attributes']=_0x1d2163['attributes'][_0x9b48('0x42')]?_0x1d2163[_0x9b48('0x32')]:_0x3cb113[_0x9b48('0x2d')];if(_0x362ec7[_0x9b48('0x2f')][_0x9b48('0x3c')]){_0x1d2163['include']=[{'all':!![]}];}_0x1d2163=_[_0x9b48('0x3b')]({},_0x1d2163,_0x362ec7['options']);return db[_0x9b48('0x29')][_0x9b48('0x43')](_0x1d2163)[_0x9b48('0x21')](handleEntityNotFound(_0x517b4c,null))[_0x9b48('0x21')](respondWithResult(_0x517b4c,null))[_0x9b48('0x44')](handleError(_0x517b4c,null));};exports[_0x9b48('0x45')]=function(_0x5e1d6a,_0x1ad53a){return db[_0x9b48('0x29')][_0x9b48('0x45')](_0x5e1d6a[_0x9b48('0x46')],{})[_0x9b48('0x21')](function(_0x23baa0){var _0x1016b1=_0x5e1d6a[_0x9b48('0x47')][_0x9b48('0x22')]({'plain':!![]});if(!_0x1016b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1016b1[_0x9b48('0x48')]==='user'){var _0x9d6ff6=_0x23baa0['get']({'plain':!![]});var _0xd5fa74=_0x9b48('0x49');return db[_0x9b48('0x4a')][_0x9b48('0x43')]({'where':{'name':_0xd5fa74,'userProfileId':_0x1016b1[_0x9b48('0x4b')]},'raw':!![]})[_0x9b48('0x21')](function(_0x52069e){if(_0x52069e&&_0x52069e['autoAssociation']===0x0){return db[_0x9b48('0x4c')][_0x9b48('0x45')]({'name':_0x9d6ff6[_0x9b48('0x25')],'resourceId':_0x9d6ff6['id'],'type':_0x52069e[_0x9b48('0x25')],'sectionId':_0x52069e['id']},{})[_0x9b48('0x21')](function(){return _0x23baa0;});}else{return _0x23baa0;}})[_0x9b48('0x44')](function(_0x2a46de){logger[_0x9b48('0x24')](_0x9b48('0x4d'),_0x2a46de);throw _0x2a46de;});}return _0x23baa0;})[_0x9b48('0x21')](respondWithResult(_0x1ad53a,0xc9))[_0x9b48('0x44')](handleError(_0x1ad53a,null));};exports[_0x9b48('0x4e')]=function(_0x36c38e,_0x17dfe6){var _0x5c5b56={'where':{'id':_0x36c38e['params']['id']}},_0x44d1cd={};_0x44d1cd[_0x9b48('0x2d')]=_['keys'](db['Campaign'][_0x9b48('0x2a')]);_0x5c5b56[_0x9b48('0x32')]=_[_0x9b48('0x31')](_0x44d1cd[_0x9b48('0x2d')],qs[_0x9b48('0x33')](_0x36c38e[_0x9b48('0x2f')][_0x9b48('0x33')]));_0x5c5b56[_0x9b48('0x32')]=_0x5c5b56[_0x9b48('0x32')][_0x9b48('0x42')]?_0x5c5b56[_0x9b48('0x32')]:_0x44d1cd['model'];if(_0x36c38e[_0x9b48('0x2f')][_0x9b48('0x3c')]){_0x5c5b56[_0x9b48('0x3d')]=[{'all':!![]}];}_0x5c5b56=_[_0x9b48('0x3b')]({},_0x5c5b56,_0x36c38e[_0x9b48('0x4f')]);return db[_0x9b48('0x29')][_0x9b48('0x43')](_0x5c5b56)[_0x9b48('0x21')](handleEntityNotFound(_0x17dfe6,null))[_0x9b48('0x21')](function(_0x16cbe6){if(_0x16cbe6){var _0x11cf5a=_0x16cbe6[_0x9b48('0x22')]({'plain':!![]});_0x11cf5a=qs[_0x9b48('0x50')](_0x11cf5a,['id',_0x9b48('0x51'),'updatedAt']);_0x36c38e[_0x9b48('0x46')]=_[_0x9b48('0x50')](_0x36c38e[_0x9b48('0x46')],['id',_0x9b48('0x51'),_0x9b48('0x52')]);return db[_0x9b48('0x29')][_0x9b48('0x45')](_[_0x9b48('0x3b')](_0x11cf5a,_0x36c38e['body']),{'include':_0x36c38e['query'][_0x9b48('0x3c')]?[{'all':!![]}]:undefined})['then'](function(_0x23a283){var _0x2684a4=_0x36c38e[_0x9b48('0x47')][_0x9b48('0x22')]({'plain':!![]});if(!_0x2684a4)throw new Error(_0x9b48('0x53'));if(_0x2684a4[_0x9b48('0x48')]===_0x9b48('0x47')){var _0x1a640f=_0x23a283[_0x9b48('0x22')]({'plain':!![]});var _0xa9e58e=_0x9b48('0x49');return db[_0x9b48('0x4a')][_0x9b48('0x43')]({'where':{'name':_0xa9e58e,'userProfileId':_0x2684a4[_0x9b48('0x4b')]},'raw':!![]})[_0x9b48('0x21')](function(_0x3bdce9){if(_0x3bdce9&&_0x3bdce9['autoAssociation']===0x0){return db[_0x9b48('0x4c')][_0x9b48('0x45')]({'name':_0x1a640f[_0x9b48('0x25')],'resourceId':_0x1a640f['id'],'type':_0x3bdce9['name'],'sectionId':_0x3bdce9['id']},{})[_0x9b48('0x21')](function(){return _0x23a283;});}else{return _0x23a283;}})[_0x9b48('0x44')](function(_0x1b092e){logger['error'](_0x9b48('0x4d'),_0x1b092e);throw _0x1b092e;});}return _0x23a283;});}})[_0x9b48('0x21')](respondWithResult(_0x17dfe6,0xc9))[_0x9b48('0x44')](handleError(_0x17dfe6,null));};exports[_0x9b48('0x54')]=function(_0x144a70,_0x32b51b){if(_0x144a70[_0x9b48('0x46')]['id']){delete _0x144a70[_0x9b48('0x46')]['id'];}return db[_0x9b48('0x29')][_0x9b48('0x43')]({'where':{'id':_0x144a70[_0x9b48('0x41')]['id']}})['then'](handleEntityNotFound(_0x32b51b,null))[_0x9b48('0x21')](saveUpdates(_0x144a70[_0x9b48('0x46')],null))[_0x9b48('0x21')](respondWithResult(_0x32b51b,null))[_0x9b48('0x44')](handleError(_0x32b51b,null));};exports[_0x9b48('0x23')]=function(_0x2ab53c,_0x3ea081){return db[_0x9b48('0x29')][_0x9b48('0x43')]({'where':{'id':_0x2ab53c[_0x9b48('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ea081,null))['then'](removeEntity(_0x3ea081,null))[_0x9b48('0x44')](handleError(_0x3ea081,null));};exports[_0x9b48('0x55')]=function(_0x538d49,_0x527c77,_0x3faa24){var _0x2558af={'raw':!![],'where':{}};var _0x207beb={};var _0x30282a={'count':0x0,'rows':[]};return db[_0x9b48('0x29')][_0x9b48('0x56')]({'where':{'id':_0x538d49[_0x9b48('0x41')]['id']}})['then'](handleEntityNotFound(_0x527c77,null))[_0x9b48('0x21')](function(_0xcbc52c){if(_0xcbc52c){_0x207beb['model']=_[_0x9b48('0x2e')](db['CmHopper'][_0x9b48('0x2a')]);_0x207beb[_0x9b48('0x2f')]=_['keys'](_0x538d49[_0x9b48('0x2f')]);_0x207beb[_0x9b48('0x30')]=_[_0x9b48('0x31')](_0x207beb[_0x9b48('0x2d')],_0x207beb['query']);_0x2558af['attributes']=_['intersection'](_0x207beb[_0x9b48('0x2d')],qs['fields'](_0x538d49[_0x9b48('0x2f')]['fields']));_0x2558af[_0x9b48('0x32')]=_0x2558af[_0x9b48('0x32')][_0x9b48('0x42')]?_0x2558af['attributes']:_0x207beb[_0x9b48('0x2d')];if(!_0x538d49[_0x9b48('0x2f')][_0x9b48('0x34')](_0x9b48('0x35'))){_0x2558af[_0x9b48('0x1c')]=qs[_0x9b48('0x1c')](_0x538d49['query'][_0x9b48('0x1c')]);_0x2558af[_0x9b48('0x1b')]=qs['offset'](_0x538d49[_0x9b48('0x2f')][_0x9b48('0x1b')]);}_0x2558af[_0x9b48('0x36')]=qs['sort'](_0x538d49[_0x9b48('0x2f')][_0x9b48('0x37')]);_0x2558af['where']=qs[_0x9b48('0x30')](_[_0x9b48('0x38')](_0x538d49[_0x9b48('0x2f')],_0x207beb[_0x9b48('0x30')]));_0x2558af[_0x9b48('0x3a')][_0x9b48('0x57')]=_0xcbc52c['id'];if(_0x538d49['query'][_0x9b48('0x39')]){_0x2558af[_0x9b48('0x3a')]=_[_0x9b48('0x3b')](_0x2558af['where'],{'$or':_[_0x9b48('0x28')](_0x2558af['attributes'],function(_0x12c725){var _0x3ce253={};_0x3ce253[_0x12c725]={'$like':'%'+_0x538d49[_0x9b48('0x2f')][_0x9b48('0x39')]+'%'};return _0x3ce253;})});}_0x2558af=_[_0x9b48('0x3b')]({},_0x2558af,_0x538d49[_0x9b48('0x4f')]);return db['CmHopper'][_0x9b48('0x1a')]({'where':_0x2558af[_0x9b48('0x3a')]})[_0x9b48('0x21')](function(_0x26e904){_0x30282a[_0x9b48('0x1a')]=_0x26e904;if(_0x538d49[_0x9b48('0x2f')][_0x9b48('0x3c')]){_0x2558af[_0x9b48('0x3d')]=[{'all':!![]}];}return db[_0x9b48('0x58')]['findAll'](_0x2558af);})[_0x9b48('0x21')](function(_0x7af6bc){_0x30282a[_0x9b48('0x3f')]=_0x7af6bc;return _0x30282a;});}})['then'](respondWithFilteredResult(_0x527c77,_0x2558af))[_0x9b48('0x44')](handleError(_0x527c77,null));};exports['getHopperHistories']=function(_0xdf459,_0xf28781,_0x1b81e1){var _0x21c2b9={'raw':!![],'where':{}};var _0x255bf5={};var _0x24d6a4={'count':0x0,'rows':[]};return db[_0x9b48('0x29')][_0x9b48('0x56')]({'where':{'id':_0xdf459['params']['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0xf28781,null))[_0x9b48('0x21')](function(_0x2fa420){if(_0x2fa420){_0x255bf5['model']=_[_0x9b48('0x2e')](db[_0x9b48('0x59')]['rawAttributes']);_0x255bf5[_0x9b48('0x2f')]=_['keys'](_0xdf459['query']);_0x255bf5[_0x9b48('0x30')]=_[_0x9b48('0x31')](_0x255bf5[_0x9b48('0x2d')],_0x255bf5['query']);_0x21c2b9[_0x9b48('0x32')]=_['intersection'](_0x255bf5['model'],qs[_0x9b48('0x33')](_0xdf459['query'][_0x9b48('0x33')]));_0x21c2b9['attributes']=_0x21c2b9[_0x9b48('0x32')]['length']?_0x21c2b9[_0x9b48('0x32')]:_0x255bf5[_0x9b48('0x2d')];if(!_0xdf459[_0x9b48('0x2f')]['hasOwnProperty'](_0x9b48('0x35'))){_0x21c2b9[_0x9b48('0x1c')]=qs[_0x9b48('0x1c')](_0xdf459[_0x9b48('0x2f')][_0x9b48('0x1c')]);_0x21c2b9[_0x9b48('0x1b')]=qs[_0x9b48('0x1b')](_0xdf459[_0x9b48('0x2f')][_0x9b48('0x1b')]);}_0x21c2b9[_0x9b48('0x36')]=qs[_0x9b48('0x37')](_0xdf459[_0x9b48('0x2f')]['sort']);_0x21c2b9['where']=qs[_0x9b48('0x30')](_[_0x9b48('0x38')](_0xdf459[_0x9b48('0x2f')],_0x255bf5['filters']));_0x21c2b9[_0x9b48('0x3a')]['CampaignId']=_0x2fa420['id'];if(_0xdf459[_0x9b48('0x2f')][_0x9b48('0x39')]){_0x21c2b9['where']=_[_0x9b48('0x3b')](_0x21c2b9[_0x9b48('0x3a')],{'$or':_[_0x9b48('0x28')](_0x21c2b9[_0x9b48('0x32')],function(_0x4fe61){var _0x21dc62={};_0x21dc62[_0x4fe61]={'$like':'%'+_0xdf459[_0x9b48('0x2f')][_0x9b48('0x39')]+'%'};return _0x21dc62;})});}_0x21c2b9=_[_0x9b48('0x3b')]({},_0x21c2b9,_0xdf459['options']);return db[_0x9b48('0x59')]['count']({'where':_0x21c2b9[_0x9b48('0x3a')]})['then'](function(_0x492834){_0x24d6a4[_0x9b48('0x1a')]=_0x492834;if(_0xdf459['query']['includeAll']){_0x21c2b9['include']=[{'all':!![]}];}return db[_0x9b48('0x59')]['findAll'](_0x21c2b9);})['then'](function(_0x19908b){_0x24d6a4[_0x9b48('0x3f')]=_0x19908b;return _0x24d6a4;});}})[_0x9b48('0x21')](respondWithFilteredResult(_0xf28781,_0x21c2b9))['catch'](handleError(_0xf28781,null));};exports['getHopperFinals']=function(_0x2d9c68,_0x34699,_0xeb514a){var _0x347e6d={'raw':!![],'where':{}};var _0x1e283d={};var _0x55986a={'count':0x0,'rows':[]};return db[_0x9b48('0x29')][_0x9b48('0x56')]({'where':{'id':_0x2d9c68[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0x34699,null))['then'](function(_0x250ce1){if(_0x250ce1){_0x1e283d[_0x9b48('0x2d')]=_[_0x9b48('0x2e')](db['CmHopperFinal']['rawAttributes']);_0x1e283d['query']=_[_0x9b48('0x2e')](_0x2d9c68[_0x9b48('0x2f')]);_0x1e283d['filters']=_[_0x9b48('0x31')](_0x1e283d['model'],_0x1e283d[_0x9b48('0x2f')]);_0x347e6d[_0x9b48('0x32')]=_[_0x9b48('0x31')](_0x1e283d['model'],qs[_0x9b48('0x33')](_0x2d9c68['query'][_0x9b48('0x33')]));_0x347e6d['attributes']=_0x347e6d['attributes'][_0x9b48('0x42')]?_0x347e6d[_0x9b48('0x32')]:_0x1e283d[_0x9b48('0x2d')];if(!_0x2d9c68[_0x9b48('0x2f')]['hasOwnProperty']('nolimit')){_0x347e6d['limit']=qs[_0x9b48('0x1c')](_0x2d9c68[_0x9b48('0x2f')]['limit']);_0x347e6d['offset']=qs['offset'](_0x2d9c68['query'][_0x9b48('0x1b')]);}_0x347e6d[_0x9b48('0x36')]=qs[_0x9b48('0x37')](_0x2d9c68[_0x9b48('0x2f')][_0x9b48('0x37')]);_0x347e6d[_0x9b48('0x3a')]=qs['filters'](_[_0x9b48('0x38')](_0x2d9c68[_0x9b48('0x2f')],_0x1e283d[_0x9b48('0x30')]));_0x347e6d[_0x9b48('0x3a')]['CampaignId']=_0x250ce1['id'];if(_0x2d9c68['query'][_0x9b48('0x39')]){_0x347e6d[_0x9b48('0x3a')]=_[_0x9b48('0x3b')](_0x347e6d[_0x9b48('0x3a')],{'$or':_[_0x9b48('0x28')](_0x347e6d[_0x9b48('0x32')],function(_0x55277a){var _0x45fef4={};_0x45fef4[_0x55277a]={'$like':'%'+_0x2d9c68[_0x9b48('0x2f')][_0x9b48('0x39')]+'%'};return _0x45fef4;})});}_0x347e6d=_['merge']({},_0x347e6d,_0x2d9c68['options']);return db[_0x9b48('0x5a')][_0x9b48('0x1a')]({'where':_0x347e6d[_0x9b48('0x3a')]})[_0x9b48('0x21')](function(_0x132b38){_0x55986a[_0x9b48('0x1a')]=_0x132b38;if(_0x2d9c68[_0x9b48('0x2f')][_0x9b48('0x3c')]){_0x347e6d[_0x9b48('0x3d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9b48('0x3e')](_0x347e6d);})['then'](function(_0xf3a71c){_0x55986a[_0x9b48('0x3f')]=_0xf3a71c;return _0x55986a;});}})[_0x9b48('0x21')](respondWithFilteredResult(_0x34699,_0x347e6d))[_0x9b48('0x44')](handleError(_0x34699,null));};exports[_0x9b48('0x5b')]=function(_0x482025,_0x3438ac,_0x3701cd){var _0x28c9f3={'raw':!![],'where':{}};var _0x3f3aae={};var _0x54d1d9={'count':0x0,'rows':[]};return db[_0x9b48('0x29')][_0x9b48('0x56')]({'where':{'id':_0x482025[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0x3438ac,null))[_0x9b48('0x21')](function(_0x232102){if(_0x232102){_0x3f3aae['model']=_[_0x9b48('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x3f3aae[_0x9b48('0x2f')]=_[_0x9b48('0x2e')](_0x482025[_0x9b48('0x2f')]);_0x3f3aae['filters']=_[_0x9b48('0x31')](_0x3f3aae['model'],_0x3f3aae[_0x9b48('0x2f')]);_0x28c9f3[_0x9b48('0x32')]=_[_0x9b48('0x31')](_0x3f3aae[_0x9b48('0x2d')],qs['fields'](_0x482025[_0x9b48('0x2f')][_0x9b48('0x33')]));_0x28c9f3[_0x9b48('0x32')]=_0x28c9f3[_0x9b48('0x32')][_0x9b48('0x42')]?_0x28c9f3[_0x9b48('0x32')]:_0x3f3aae[_0x9b48('0x2d')];if(!_0x482025[_0x9b48('0x2f')][_0x9b48('0x34')](_0x9b48('0x35'))){_0x28c9f3[_0x9b48('0x1c')]=qs['limit'](_0x482025['query'][_0x9b48('0x1c')]);_0x28c9f3[_0x9b48('0x1b')]=qs[_0x9b48('0x1b')](_0x482025[_0x9b48('0x2f')][_0x9b48('0x1b')]);}_0x28c9f3[_0x9b48('0x36')]=qs[_0x9b48('0x37')](_0x482025[_0x9b48('0x2f')][_0x9b48('0x37')]);_0x28c9f3[_0x9b48('0x3a')]=qs[_0x9b48('0x30')](_[_0x9b48('0x38')](_0x482025[_0x9b48('0x2f')],_0x3f3aae[_0x9b48('0x30')]));_0x28c9f3[_0x9b48('0x3a')][_0x9b48('0x57')]=_0x232102['id'];if(_0x482025[_0x9b48('0x2f')][_0x9b48('0x39')]){_0x28c9f3[_0x9b48('0x3a')]=_[_0x9b48('0x3b')](_0x28c9f3[_0x9b48('0x3a')],{'$or':_['map'](_0x28c9f3[_0x9b48('0x32')],function(_0xc73fa7){var _0x29984e={};_0x29984e[_0xc73fa7]={'$like':'%'+_0x482025['query'][_0x9b48('0x39')]+'%'};return _0x29984e;})});}_0x28c9f3=_['merge']({},_0x28c9f3,_0x482025[_0x9b48('0x4f')]);return db['CmHopperBlack']['count']({'where':_0x28c9f3[_0x9b48('0x3a')]})['then'](function(_0x244e5d){_0x54d1d9[_0x9b48('0x1a')]=_0x244e5d;if(_0x482025[_0x9b48('0x2f')]['includeAll']){_0x28c9f3['include']=[{'all':!![]}];}return db[_0x9b48('0x5c')][_0x9b48('0x3e')](_0x28c9f3);})['then'](function(_0xcc5d03){_0x54d1d9[_0x9b48('0x3f')]=_0xcc5d03;return _0x54d1d9;});}})[_0x9b48('0x21')](respondWithFilteredResult(_0x3438ac,_0x28c9f3))['catch'](handleError(_0x3438ac,null));};exports[_0x9b48('0x5d')]=function(_0x54dadc,_0x4c5342,_0x52ddd2){var _0x1356a6={};var _0x37ea15={};var _0x5cf6aa;var _0x1aa275;return db[_0x9b48('0x29')][_0x9b48('0x56')]({'where':{'id':_0x54dadc[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0x4c5342,null))[_0x9b48('0x21')](function(_0x4bb8bb){if(_0x4bb8bb){_0x5cf6aa=_0x4bb8bb;_0x37ea15[_0x9b48('0x2d')]=_[_0x9b48('0x2e')](db[_0x9b48('0x5e')][_0x9b48('0x2a')]);_0x37ea15['query']=_['keys'](_0x54dadc['query']);_0x37ea15[_0x9b48('0x30')]=_['intersection'](_0x37ea15[_0x9b48('0x2d')],_0x37ea15[_0x9b48('0x2f')]);_0x1356a6[_0x9b48('0x32')]=_[_0x9b48('0x31')](_0x37ea15[_0x9b48('0x2d')],qs[_0x9b48('0x33')](_0x54dadc[_0x9b48('0x2f')][_0x9b48('0x33')]));_0x1356a6[_0x9b48('0x32')]=_0x1356a6[_0x9b48('0x32')][_0x9b48('0x42')]?_0x1356a6[_0x9b48('0x32')]:_0x37ea15[_0x9b48('0x2d')];_0x1356a6[_0x9b48('0x36')]=qs[_0x9b48('0x37')](_0x54dadc[_0x9b48('0x2f')]['sort']);_0x1356a6['where']=qs[_0x9b48('0x30')](_[_0x9b48('0x38')](_0x54dadc[_0x9b48('0x2f')],_0x37ea15[_0x9b48('0x30')]));if(_0x54dadc[_0x9b48('0x2f')][_0x9b48('0x39')]){_0x1356a6['where']=_[_0x9b48('0x3b')](_0x1356a6[_0x9b48('0x3a')],{'$or':_[_0x9b48('0x28')](_0x1356a6[_0x9b48('0x32')],function(_0x28858d){var _0x1cf078={};_0x1cf078[_0x28858d]={'$like':'%'+_0x54dadc[_0x9b48('0x2f')][_0x9b48('0x39')]+'%'};return _0x1cf078;})});}_0x1356a6=_[_0x9b48('0x3b')]({},_0x1356a6,_0x54dadc[_0x9b48('0x4f')]);return _0x5cf6aa[_0x9b48('0x5d')](_0x1356a6);}})[_0x9b48('0x21')](function(_0x5805a3){if(_0x5805a3){_0x1aa275=_0x5805a3[_0x9b48('0x42')];if(!_0x54dadc['query'][_0x9b48('0x34')](_0x9b48('0x35'))){_0x1356a6[_0x9b48('0x1c')]=qs[_0x9b48('0x1c')](_0x54dadc[_0x9b48('0x2f')]['limit']);_0x1356a6[_0x9b48('0x1b')]=qs['offset'](_0x54dadc[_0x9b48('0x2f')][_0x9b48('0x1b')]);}return _0x5cf6aa[_0x9b48('0x5d')](_0x1356a6);}})[_0x9b48('0x21')](function(_0x3b9ba5){if(_0x3b9ba5){return _0x3b9ba5?{'count':_0x1aa275,'rows':_0x3b9ba5}:null;}})[_0x9b48('0x21')](respondWithResult(_0x4c5342,null))[_0x9b48('0x44')](handleError(_0x4c5342,null));};exports[_0x9b48('0x5f')]=function(_0x58a1cf,_0x539770,_0x3b67b7){var _0x51f29f,_0x1cf0ad;return db[_0x9b48('0x29')]['find']({'where':{'id':_0x58a1cf[_0x9b48('0x41')]['id']}})['then'](handleEntityNotFound(_0x539770,null))['then'](function(_0x3d23af){if(_0x3d23af){_0x1cf0ad=_0x3d23af;return _0x3d23af[_0x9b48('0x5f')](_0x58a1cf[_0x9b48('0x46')]['ids'],_[_0x9b48('0x50')](_0x58a1cf[_0x9b48('0x46')],['ids','id'])||{});}return null;})[_0x9b48('0x60')](function(_0x18b0ee){var _0x2c4b78;_0x51f29f=_0x18b0ee||[];var _0xf95443=[];if(_0x18b0ee){for(var _0x5279ab=0x0;_0x5279ab<_0x18b0ee[_0x9b48('0x42')];_0x5279ab+=0x1){var _0x4971de=_0x18b0ee[_0x5279ab]['get']({'plain':!![]});_0x1cf0ad[_0x9b48('0x61')]=_0x58a1cf[_0x9b48('0x46')][_0x9b48('0x61')]?_0x58a1cf['body'][_0x9b48('0x61')]:_0x1cf0ad[_0x9b48('0x61')];switch(_0x1cf0ad[_0x9b48('0x61')]){case _0x9b48('0x62'):_0x2c4b78=squel[_0x9b48('0x63')]()[_0x9b48('0x64')]('cm_hopper')[_0x9b48('0x65')]([_0x9b48('0x66'),_0x9b48('0x67'),_0x9b48('0x68'),'ListId','CampaignId',_0x9b48('0x51'),_0x9b48('0x52')],squel['select']()['field']('phone',_0x9b48('0x66'))[_0x9b48('0x69')](_0x9b48('0x6a'),'scheduledAt')['field']('id','ContactId')[_0x9b48('0x69')](_0x4971de[_0x9b48('0x6b')][_0x9b48('0x6c')](),_0x9b48('0x6d'))[_0x9b48('0x69')](_0x58a1cf[_0x9b48('0x41')]['id'][_0x9b48('0x6c')](),_0x9b48('0x57'))[_0x9b48('0x69')](_0x9b48('0x6a'),_0x9b48('0x51'))['field'](_0x9b48('0x6a'),_0x9b48('0x52'))['from'](_0x9b48('0x6e'))[_0x9b48('0x3a')](_0x9b48('0x6f'))[_0x9b48('0x3a')]('ListId\x20=\x20?',_0x4971de['CmListId'][_0x9b48('0x6c')]())[_0x9b48('0x3a')](_0x9b48('0x70'))[_0x9b48('0x3a')](_0x9b48('0x71'),squel[_0x9b48('0x72')]()[_0x9b48('0x69')](_0x9b48('0x73'))[_0x9b48('0x74')](_0x9b48('0x75'))[_0x9b48('0x3a')](_0x9b48('0x76'),_0x58a1cf[_0x9b48('0x41')]['id'][_0x9b48('0x6c')]()))[_0x9b48('0x3a')](_0x9b48('0x71'),squel[_0x9b48('0x72')]()[_0x9b48('0x69')]('COALESCE(phone,\x27\x27)')[_0x9b48('0x74')]('cm_hopper')[_0x9b48('0x3a')](_0x9b48('0x76'),_0x58a1cf[_0x9b48('0x41')]['id'][_0x9b48('0x6c')]())))['toString']();break;case _0x9b48('0x77'):_0x2c4b78=squel[_0x9b48('0x63')]()[_0x9b48('0x64')](_0x9b48('0x78'))[_0x9b48('0x65')](['phone',_0x9b48('0x67'),_0x9b48('0x68'),_0x9b48('0x6d'),_0x9b48('0x57'),_0x9b48('0x51'),_0x9b48('0x52')],squel[_0x9b48('0x72')]()[_0x9b48('0x69')]('phone',_0x9b48('0x66'))[_0x9b48('0x69')](_0x9b48('0x6a'),'scheduledAt')[_0x9b48('0x69')]('id',_0x9b48('0x68'))['field'](_0x4971de['CmListId'][_0x9b48('0x6c')](),_0x9b48('0x6d'))['field'](_0x58a1cf[_0x9b48('0x41')]['id'][_0x9b48('0x6c')](),_0x9b48('0x57'))[_0x9b48('0x69')](_0x9b48('0x6a'),'createdAt')[_0x9b48('0x69')]('NOW()',_0x9b48('0x52'))[_0x9b48('0x74')](_0x9b48('0x6e'))[_0x9b48('0x3a')](_0x9b48('0x6f'))[_0x9b48('0x3a')](_0x9b48('0x79'),_0x4971de[_0x9b48('0x6b')][_0x9b48('0x6c')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x9b48('0x3a')](_0x9b48('0x71'),squel['select']()[_0x9b48('0x69')](_0x9b48('0x7a'))[_0x9b48('0x74')](_0x9b48('0x78'))[_0x9b48('0x3a')](_0x9b48('0x76'),_0x58a1cf[_0x9b48('0x41')]['id'][_0x9b48('0x6c')]())))['toString']();break;default:_0x2c4b78=squel[_0x9b48('0x63')]()['into']('cm_hopper')['fromQuery']([_0x9b48('0x66'),_0x9b48('0x67'),'ContactId',_0x9b48('0x6d'),_0x9b48('0x57'),'createdAt',_0x9b48('0x52')],squel[_0x9b48('0x72')]()[_0x9b48('0x69')](_0x9b48('0x66'),'phone')[_0x9b48('0x69')](_0x9b48('0x6a'),_0x9b48('0x67'))[_0x9b48('0x69')]('id',_0x9b48('0x68'))[_0x9b48('0x69')](_0x4971de[_0x9b48('0x6b')][_0x9b48('0x6c')](),_0x9b48('0x6d'))[_0x9b48('0x69')](_0x58a1cf['params']['id'][_0x9b48('0x6c')](),_0x9b48('0x57'))[_0x9b48('0x69')]('NOW()',_0x9b48('0x51'))[_0x9b48('0x69')](_0x9b48('0x6a'),_0x9b48('0x52'))[_0x9b48('0x74')](_0x9b48('0x6e'))[_0x9b48('0x3a')](_0x9b48('0x6f'))[_0x9b48('0x3a')](_0x9b48('0x79'),_0x4971de[_0x9b48('0x6b')][_0x9b48('0x6c')]())[_0x9b48('0x3a')](_0x9b48('0x70')))['toString']();}_0xf95443['push'](db[_0x9b48('0x7b')][_0x9b48('0x2f')](_0x2c4b78));}return BPromise['all'](_0xf95443);}})[_0x9b48('0x21')](function(){return _0x51f29f;})[_0x9b48('0x21')](respondWithResult(_0x539770,null))[_0x9b48('0x44')](handleError(_0x539770,null));};exports[_0x9b48('0x7c')]=function(_0x230ad3,_0x14065a,_0xdad13d){return db[_0x9b48('0x29')]['find']({'where':{'id':_0x230ad3['params']['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0x14065a,null))['then'](function(_0x3bd64b){if(_0x3bd64b){return _0x3bd64b[_0x9b48('0x7c')](_0x230ad3[_0x9b48('0x2f')][_0x9b48('0x7d')]);}})['then'](function(_0x4ee120){if(_0x4ee120){return db[_0x9b48('0x58')][_0x9b48('0x23')]({'where':{'ListId':_0x230ad3[_0x9b48('0x2f')][_0x9b48('0x7d')],'CampaignId':_0x230ad3[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](function(){return _0x4ee120;});}})[_0x9b48('0x21')](respondWithStatusCode(_0x14065a,null))['catch'](handleError(_0x14065a,null));};exports[_0x9b48('0x7e')]=function(_0x50d37b,_0x2302c2,_0x499efe){var _0x51f583={'raw':!![],'where':{}};var _0x43519e={};var _0x3c9814={'count':0x0,'rows':[]};return db[_0x9b48('0x29')][_0x9b48('0x56')]({'where':{'id':_0x50d37b[_0x9b48('0x41')]['id']}})['then'](handleEntityNotFound(_0x2302c2,null))[_0x9b48('0x21')](function(_0x5eb358){if(_0x5eb358){_0x43519e[_0x9b48('0x2d')]=_[_0x9b48('0x2e')](db[_0x9b48('0x5e')][_0x9b48('0x2a')]);_0x43519e['query']=_[_0x9b48('0x2e')](_0x50d37b[_0x9b48('0x2f')]);_0x43519e['filters']=_[_0x9b48('0x31')](_0x43519e['model'],_0x43519e[_0x9b48('0x2f')]);_0x51f583[_0x9b48('0x32')]=_[_0x9b48('0x31')](_0x43519e[_0x9b48('0x2d')],qs[_0x9b48('0x33')](_0x50d37b['query'][_0x9b48('0x33')]));_0x51f583[_0x9b48('0x32')]=_0x51f583[_0x9b48('0x32')][_0x9b48('0x42')]?_0x51f583['attributes']:_0x43519e[_0x9b48('0x2d')];if(!_0x50d37b['query'][_0x9b48('0x34')](_0x9b48('0x35'))){_0x51f583['limit']=qs[_0x9b48('0x1c')](_0x50d37b[_0x9b48('0x2f')][_0x9b48('0x1c')]);_0x51f583[_0x9b48('0x1b')]=qs[_0x9b48('0x1b')](_0x50d37b[_0x9b48('0x2f')][_0x9b48('0x1b')]);}_0x51f583[_0x9b48('0x36')]=qs[_0x9b48('0x37')](_0x50d37b[_0x9b48('0x2f')][_0x9b48('0x37')]);_0x51f583[_0x9b48('0x3a')]=qs[_0x9b48('0x30')](_[_0x9b48('0x38')](_0x50d37b[_0x9b48('0x2f')],_0x43519e[_0x9b48('0x30')]));_0x51f583[_0x9b48('0x3a')]['CampaignId']=_0x5eb358['id'];if(_0x50d37b[_0x9b48('0x2f')][_0x9b48('0x39')]){_0x51f583[_0x9b48('0x3a')]=_['merge'](_0x51f583['where'],{'$or':_[_0x9b48('0x28')](_0x51f583[_0x9b48('0x32')],function(_0x1295ae){var _0x4b0b31={};_0x4b0b31[_0x1295ae]={'$like':'%'+_0x50d37b[_0x9b48('0x2f')][_0x9b48('0x39')]+'%'};return _0x4b0b31;})});}_0x51f583=_[_0x9b48('0x3b')]({},_0x51f583,_0x50d37b[_0x9b48('0x4f')]);return db[_0x9b48('0x5e')][_0x9b48('0x1a')]({'where':_0x51f583[_0x9b48('0x3a')]})[_0x9b48('0x21')](function(_0x3cedbe){_0x3c9814[_0x9b48('0x1a')]=_0x3cedbe;if(_0x50d37b[_0x9b48('0x2f')]['includeAll']){_0x51f583['include']=[{'all':!![]}];}return db[_0x9b48('0x5e')][_0x9b48('0x3e')](_0x51f583);})['then'](function(_0xd34b97){_0x3c9814['rows']=_0xd34b97;return _0x3c9814;});}})[_0x9b48('0x21')](respondWithFilteredResult(_0x2302c2,_0x51f583))[_0x9b48('0x44')](handleError(_0x2302c2,null));};exports['addBlackLists']=function(_0x1d6fd4,_0x1dcd46,_0x2059e8){var _0x3be999,_0x5cadf9;return db[_0x9b48('0x29')][_0x9b48('0x43')]({'where':{'id':_0x1d6fd4[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0x1dcd46,null))['then'](function(_0xd42d39){if(_0xd42d39){_0x5cadf9=_0xd42d39;return _0xd42d39[_0x9b48('0x7f')](_0x1d6fd4['body']['ids'],_[_0x9b48('0x50')](_0x1d6fd4['body'],[_0x9b48('0x7d'),'id'])||{});}return null;})[_0x9b48('0x60')](function(_0x275c58){var _0x26b3b7;_0x3be999=_0x275c58||[];var _0x106207=[];if(_0x275c58){for(var _0x4dc60f=0x0;_0x4dc60f<_0x275c58[_0x9b48('0x42')];_0x4dc60f+=0x1){var _0x10f580=_0x275c58[_0x4dc60f][_0x9b48('0x22')]({'plain':!![]});_0x26b3b7=squel[_0x9b48('0x63')]()[_0x9b48('0x64')]('cm_hopper_black')[_0x9b48('0x65')](['phone','ContactId','ListId',_0x9b48('0x57'),'createdAt',_0x9b48('0x52')],squel[_0x9b48('0x72')]()[_0x9b48('0x69')](_0x9b48('0x66'),_0x9b48('0x66'))[_0x9b48('0x69')]('id',_0x9b48('0x68'))[_0x9b48('0x69')](_0x10f580[_0x9b48('0x6b')][_0x9b48('0x6c')](),_0x9b48('0x6d'))['field'](_0x1d6fd4['params']['id']['toString'](),_0x9b48('0x57'))['field'](_0x9b48('0x6a'),_0x9b48('0x51'))[_0x9b48('0x69')]('NOW()',_0x9b48('0x52'))['from'](_0x9b48('0x6e'))['where']('deletedAt\x20IS\x20NULL')[_0x9b48('0x3a')](_0x9b48('0x79'),_0x10f580[_0x9b48('0x6b')][_0x9b48('0x6c')]())[_0x9b48('0x3a')](_0x9b48('0x70')))[_0x9b48('0x6c')]();_0x106207[_0x9b48('0x80')](db[_0x9b48('0x7b')][_0x9b48('0x2f')](_0x26b3b7));}return BPromise[_0x9b48('0x81')](_0x106207);}})[_0x9b48('0x21')](function(){return _0x3be999;})[_0x9b48('0x21')](respondWithResult(_0x1dcd46,null))[_0x9b48('0x44')](handleError(_0x1dcd46,null));};exports['removeBlackLists']=function(_0x199d9b,_0x851e1d,_0x789583){return db[_0x9b48('0x29')][_0x9b48('0x43')]({'where':{'id':_0x199d9b[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](handleEntityNotFound(_0x851e1d,null))[_0x9b48('0x21')](function(_0x4683c0){if(_0x4683c0){return _0x4683c0['removeBlackLists'](_0x199d9b[_0x9b48('0x2f')]['ids']);}})[_0x9b48('0x21')](function(_0x5da6cb){if(_0x5da6cb){return db[_0x9b48('0x5c')]['destroy']({'where':{'ListId':_0x199d9b[_0x9b48('0x2f')][_0x9b48('0x7d')],'CampaignId':_0x199d9b[_0x9b48('0x41')]['id']}})[_0x9b48('0x21')](function(){return _0x5da6cb;});}})[_0x9b48('0x21')](respondWithStatusCode(_0x851e1d,null))[_0x9b48('0x44')](handleError(_0x851e1d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b57921e..83afd84 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 _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3d67db,_0xc9aaaf){var _0x8a4544=function(_0xf1e898){while(--_0xf1e898){_0x3d67db['push'](_0x3d67db['shift']());}};_0x8a4544(++_0xc9aaaf);}(_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 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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e13a4,_0x18da4a){var _0x2c5e94=function(_0x43a8b9){while(--_0x43a8b9){_0x5e13a4['push'](_0x5e13a4['shift']());}};_0x2c5e94(++_0x18da4a);}(_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 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':'campaigns','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 f659fc1..9d5068e 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x22c78f,_0x1d879b){var _0xe1c8e5=function(_0xdd466f){while(--_0xdd466f){_0x22c78f['push'](_0x22c78f['shift']());}};_0xe1c8e5(++_0x1d879b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0xacfc56,_0xca24f1){var _0x101c36=function(_0x2281a0){while(--_0x2281a0){_0xacfc56['push'](_0xacfc56['shift']());}};_0x101c36(++_0xca24f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2ee8882..fb95d40 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 _0xa09a=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x2f8125,_0x260435){var _0x332dfb=function(_0x12a258){while(--_0x12a258){_0x2f8125['push'](_0x2f8125['shift']());}};_0x332dfb(++_0x260435);}(_0xa09a,0x1e7));var _0xaa09=function(_0x14f8e9,_0x2a4db6){_0x14f8e9=_0x14f8e9-0x0;var _0x53ac0e=_0xa09a[_0x14f8e9];return _0x53ac0e;};'use strict';var multer=require(_0xaa09('0x0'));var util=require(_0xaa09('0x1'));var path=require(_0xaa09('0x2'));var timeout=require(_0xaa09('0x3'));var express=require(_0xaa09('0x4'));var router=express[_0xaa09('0x5')]();var auth=require(_0xaa09('0x6'));var interaction=require(_0xaa09('0x7'));var config=require('../../config/environment');var controller=require(_0xaa09('0x8'));router['get']('/',auth[_0xaa09('0x9')](),controller[_0xaa09('0xa')]);router['get'](_0xaa09('0xb'),auth[_0xaa09('0x9')](),controller[_0xaa09('0xc')]);router[_0xaa09('0xd')](_0xaa09('0xe'),auth[_0xaa09('0x9')](),controller['getHoppers']);router['get'](_0xaa09('0xf'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x10')]);router['get'](_0xaa09('0x11'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x12')]);router['get'](_0xaa09('0x13'),auth[_0xaa09('0x9')](),controller['getHopperBlacks']);router[_0xaa09('0xd')](_0xaa09('0x14'),auth['isAuthenticated'](),controller[_0xaa09('0x15')]);router[_0xaa09('0xd')]('/:id/blacklists',auth[_0xaa09('0x9')](),controller[_0xaa09('0x16')]);router[_0xaa09('0x17')]('/',auth[_0xaa09('0x9')](),controller[_0xaa09('0x18')]);router['post'](_0xaa09('0x19'),auth['isAuthenticated'](),controller[_0xaa09('0x1a')]);router[_0xaa09('0x17')](_0xaa09('0x14'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x1b')]);router['post'](_0xaa09('0x1c'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x1d')]);router[_0xaa09('0x1e')](_0xaa09('0xb'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x1f')]);router[_0xaa09('0x20')](_0xaa09('0xb'),auth['isAuthenticated'](),controller[_0xaa09('0x21')]);router[_0xaa09('0x20')](_0xaa09('0x14'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x22')]);router[_0xaa09('0x20')](_0xaa09('0x1c'),auth[_0xaa09('0x9')](),controller[_0xaa09('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8911=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put','/:id','update','delete','destroy','removeLists','util','path'];(function(_0x5a2258,_0x341efa){var _0x39a32d=function(_0xf5878c){while(--_0xf5878c){_0x5a2258['push'](_0x5a2258['shift']());}};_0x39a32d(++_0x341efa);}(_0x8911,0x1de));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x1891('0x0'));var path=require(_0x1891('0x1'));var timeout=require(_0x1891('0x2'));var express=require(_0x1891('0x3'));var router=express[_0x1891('0x4')]();var auth=require(_0x1891('0x5'));var interaction=require(_0x1891('0x6'));var config=require(_0x1891('0x7'));var controller=require(_0x1891('0x8'));router[_0x1891('0x9')]('/',auth[_0x1891('0xa')](),controller[_0x1891('0xb')]);router[_0x1891('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1891('0xc')]);router['get'](_0x1891('0xd'),auth[_0x1891('0xa')](),controller[_0x1891('0xe')]);router[_0x1891('0x9')]('/:id/hopper_histories',auth[_0x1891('0xa')](),controller[_0x1891('0xf')]);router[_0x1891('0x9')]('/:id/hopper_finals',auth[_0x1891('0xa')](),controller[_0x1891('0x10')]);router[_0x1891('0x9')](_0x1891('0x11'),auth[_0x1891('0xa')](),controller['getHopperBlacks']);router['get'](_0x1891('0x12'),auth[_0x1891('0xa')](),controller[_0x1891('0x13')]);router['get'](_0x1891('0x14'),auth[_0x1891('0xa')](),controller['getBlackLists']);router[_0x1891('0x15')]('/',auth[_0x1891('0xa')](),controller[_0x1891('0x16')]);router['post'](_0x1891('0x17'),auth['isAuthenticated'](),controller[_0x1891('0x18')]);router[_0x1891('0x15')](_0x1891('0x12'),auth[_0x1891('0xa')](),controller['addLists']);router[_0x1891('0x15')]('/:id/blacklists',auth[_0x1891('0xa')](),controller[_0x1891('0x19')]);router[_0x1891('0x1a')](_0x1891('0x1b'),auth[_0x1891('0xa')](),controller[_0x1891('0x1c')]);router[_0x1891('0x1d')](_0x1891('0x1b'),auth[_0x1891('0xa')](),controller[_0x1891('0x1e')]);router[_0x1891('0x1d')](_0x1891('0x12'),auth[_0x1891('0xa')](),controller[_0x1891('0x1f')]);router[_0x1891('0x1d')]('/:id/blacklists',auth[_0x1891('0xa')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e1a55ff..c94c7bb 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 _0x16b8=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x16b8,0x11c));var _0x816b=function(_0x15ad6e,_0x1d118c){_0x15ad6e=_0x15ad6e-0x0;var _0x7eccad=_0x16b8[_0x15ad6e];return _0x7eccad;};'use strict';var Sequelize=require(_0x816b('0x0'));module[_0x816b('0x1')]={'key':{'type':Sequelize[_0x816b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x816b('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x816b('0x2')]},'name':{'type':Sequelize[_0x816b('0x4')],'get':function(){return this[_0x816b('0x5')](_0x816b('0x6'));}}}; \ No newline at end of file +var _0x1a3c=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x3d0113,_0x1c3a5f){var _0x40d13b=function(_0x26cf73){while(--_0x26cf73){_0x3d0113['push'](_0x3d0113['shift']());}};_0x40d13b(++_0x1c3a5f);}(_0x1a3c,0x1be));var _0xc1a3=function(_0x715908,_0x289747){_0x715908=_0x715908-0x0;var _0x705dad=_0x1a3c[_0x715908];return _0x705dad;};'use strict';var Sequelize=require(_0xc1a3('0x0'));module[_0xc1a3('0x1')]={'key':{'type':Sequelize[_0xc1a3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xc1a3('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xc1a3('0x2')]},'name':{'type':Sequelize[_0xc1a3('0x4')],'get':function(){return this[_0xc1a3('0x5')](_0xc1a3('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1b047a8..37b8937 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 _0x16a2=['catch','show','params','rawAttributes','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','error','index','map','CannedAnswer','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x16a2,0x1bc));var _0x216a=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x16a2[_0x57cb4f];return _0x29bb45;};'use strict';var pdf=require(_0x216a('0x0'));var emlformat=require(_0x216a('0x1'));var rimraf=require(_0x216a('0x2'));var zipdir=require(_0x216a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x216a('0x4'));var moment=require(_0x216a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x216a('0x6'));var util=require(_0x216a('0x7'));var path=require('path');var sox=require(_0x216a('0x8'));var csv=require(_0x216a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x216a('0xa'));var crypto=require(_0x216a('0xb'));var jsforce=require(_0x216a('0xc'));var deskjs=require(_0x216a('0xd'));var toCsv=require(_0x216a('0x9'));var querystring=require(_0x216a('0xe'));var Papa=require('papaparse');var Redis=require(_0x216a('0xf'));var authService=require(_0x216a('0x10'));var qs=require(_0x216a('0x11'));var as=require(_0x216a('0x12'));var hardwareService=require(_0x216a('0x13'));var logger=require(_0x216a('0x14'))('api');var utils=require(_0x216a('0x15'));var config=require(_0x216a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27a601,_0x385ba5){_0x385ba5=_0x385ba5||0xcc;return function(_0x5442a2){if(_0x5442a2){return _0x27a601[_0x216a('0x17')](_0x385ba5);}return _0x27a601[_0x216a('0x18')](_0x385ba5)[_0x216a('0x19')]();};}function respondWithResult(_0x3711f7,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x43f44a){if(_0x43f44a){return _0x3711f7['status'](_0x4eaf81)[_0x216a('0x1a')](_0x43f44a);}};}function respondWithFilteredResult(_0x4c5538,_0x11d554){return function(_0x23e987){if(_0x23e987){var _0x91baa9=_0x23e987[_0x216a('0x1b')],_0x3b1ed9=_0x11d554[_0x216a('0x1c')],_0x2e7ddf=_0x11d554[_0x216a('0x1c')]+_0x11d554[_0x216a('0x1d')],_0x2e43f6;if(_0x2e7ddf>=_0x91baa9){_0x2e7ddf=_0x91baa9;_0x2e43f6=0xc8;}else{_0x2e43f6=0xce;}_0x4c5538[_0x216a('0x18')](_0x2e43f6);return _0x4c5538[_0x216a('0x1e')](_0x216a('0x1f'),_0x3b1ed9+'-'+_0x2e7ddf+'/'+_0x91baa9)[_0x216a('0x1a')](_0x23e987);}return null;};}function patchUpdates(_0xce017c){return function(_0x52262a){try{jsonpatch[_0x216a('0x20')](_0x52262a,_0xce017c,!![]);}catch(_0xd6f770){return BPromise[_0x216a('0x21')](_0xd6f770);}return _0x52262a['save']();};}function saveUpdates(_0x2d67e3,_0x10f9a2){return function(_0x520047){if(_0x520047){return _0x520047['update'](_0x2d67e3)[_0x216a('0x22')](function(_0x578695){return _0x578695;});}return null;};}function removeEntity(_0xa1d2bc,_0x38aaac){return function(_0x14454e){if(_0x14454e){return _0x14454e[_0x216a('0x23')]()[_0x216a('0x22')](function(){var _0x5ee4e4=_0x14454e[_0x216a('0x24')]({'plain':!![]});var _0x3cf8c5=_0x216a('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cf8c5,'resourceId':_0x5ee4e4['id']}})[_0x216a('0x22')](function(){return _0x14454e;});})['then'](function(){_0xa1d2bc['status'](0xcc)[_0x216a('0x19')]();});}};}function handleEntityNotFound(_0x1cc72f,_0x11a4f0){return function(_0x13a7fe){if(!_0x13a7fe){_0x1cc72f[_0x216a('0x17')](0x194);}return _0x13a7fe;};}function handleError(_0x4c6cbc,_0x218a96){_0x218a96=_0x218a96||0x1f4;return function(_0x3fd09b){logger[_0x216a('0x26')](_0x3fd09b['stack']);if(_0x3fd09b['name']){delete _0x3fd09b['name'];}_0x4c6cbc[_0x216a('0x18')](_0x218a96)['send'](_0x3fd09b);};}exports[_0x216a('0x27')]=function(_0x30f0f3,_0x355bb7){var _0x16c447={},_0x599c1d={},_0x4def34={'count':0x0,'rows':[]};var _0x53c0c2=_[_0x216a('0x28')](db[_0x216a('0x29')]['rawAttributes'],function(_0x13a0a3){return{'name':_0x13a0a3['fieldName'],'type':_0x13a0a3[_0x216a('0x2a')][_0x216a('0x2b')]};});_0x599c1d['model']=_['map'](_0x53c0c2,_0x216a('0x2c'));_0x599c1d[_0x216a('0x2d')]=_[_0x216a('0x2e')](_0x30f0f3[_0x216a('0x2d')]);_0x599c1d[_0x216a('0x2f')]=_['intersection'](_0x599c1d[_0x216a('0x30')],_0x599c1d[_0x216a('0x2d')]);_0x16c447[_0x216a('0x31')]=_[_0x216a('0x32')](_0x599c1d['model'],qs[_0x216a('0x33')](_0x30f0f3['query'][_0x216a('0x33')]));_0x16c447['attributes']=_0x16c447[_0x216a('0x31')][_0x216a('0x34')]?_0x16c447[_0x216a('0x31')]:_0x599c1d[_0x216a('0x30')];if(!_0x30f0f3[_0x216a('0x2d')][_0x216a('0x35')](_0x216a('0x36'))){_0x16c447[_0x216a('0x1d')]=qs[_0x216a('0x1d')](_0x30f0f3[_0x216a('0x2d')]['limit']);_0x16c447['offset']=qs[_0x216a('0x1c')](_0x30f0f3['query'][_0x216a('0x1c')]);}_0x16c447[_0x216a('0x37')]=qs[_0x216a('0x38')](_0x30f0f3[_0x216a('0x2d')][_0x216a('0x38')]);_0x16c447[_0x216a('0x39')]=qs['filters'](_[_0x216a('0x3a')](_0x30f0f3[_0x216a('0x2d')],_0x599c1d[_0x216a('0x2f')]),_0x53c0c2);if(_0x30f0f3[_0x216a('0x2d')][_0x216a('0x3b')]){_0x16c447['where']=_[_0x216a('0x3c')](_0x16c447[_0x216a('0x39')],{'$or':_[_0x216a('0x28')](_0x53c0c2,function(_0x767d){if(_0x767d['type']!==_0x216a('0x3d')){var _0x2ef3f2={};_0x2ef3f2[_0x767d[_0x216a('0x2c')]]={'$like':'%'+_0x30f0f3['query'][_0x216a('0x3b')]+'%'};return _0x2ef3f2;}})});}_0x16c447=_[_0x216a('0x3c')]({},_0x16c447,_0x30f0f3[_0x216a('0x3e')]);var _0x177119={'where':_0x16c447[_0x216a('0x39')]};return db[_0x216a('0x29')][_0x216a('0x1b')](_0x177119)[_0x216a('0x22')](function(_0x21a766){_0x4def34[_0x216a('0x1b')]=_0x21a766;if(_0x30f0f3[_0x216a('0x2d')][_0x216a('0x3f')]){_0x16c447['include']=[{'all':!![]}];}return db[_0x216a('0x29')][_0x216a('0x40')](_0x16c447);})['then'](function(_0x384a03){_0x4def34[_0x216a('0x41')]=_0x384a03;return _0x4def34;})[_0x216a('0x22')](respondWithFilteredResult(_0x355bb7,_0x16c447))[_0x216a('0x42')](handleError(_0x355bb7,null));};exports[_0x216a('0x43')]=function(_0x3adf4b,_0x4a8d83){var _0x2c901a={'raw':!![],'where':{'id':_0x3adf4b[_0x216a('0x44')]['id']}},_0xe28939={};_0xe28939['model']=_[_0x216a('0x2e')](db[_0x216a('0x29')][_0x216a('0x45')]);_0xe28939[_0x216a('0x2d')]=_[_0x216a('0x2e')](_0x3adf4b[_0x216a('0x2d')]);_0xe28939[_0x216a('0x2f')]=_[_0x216a('0x32')](_0xe28939[_0x216a('0x30')],_0xe28939[_0x216a('0x2d')]);_0x2c901a['attributes']=_['intersection'](_0xe28939[_0x216a('0x30')],qs[_0x216a('0x33')](_0x3adf4b[_0x216a('0x2d')][_0x216a('0x33')]));_0x2c901a['attributes']=_0x2c901a[_0x216a('0x31')][_0x216a('0x34')]?_0x2c901a[_0x216a('0x31')]:_0xe28939[_0x216a('0x30')];if(_0x3adf4b['query']['includeAll']){_0x2c901a['include']=[{'all':!![]}];}_0x2c901a=_['merge']({},_0x2c901a,_0x3adf4b[_0x216a('0x3e')]);return db[_0x216a('0x29')][_0x216a('0x46')](_0x2c901a)[_0x216a('0x22')](handleEntityNotFound(_0x4a8d83,null))[_0x216a('0x22')](respondWithResult(_0x4a8d83,null))[_0x216a('0x42')](handleError(_0x4a8d83,null));};exports[_0x216a('0x47')]=function(_0x11990f,_0x212c53){if(_0x11990f[_0x216a('0x48')]['id']){delete _0x11990f[_0x216a('0x48')]['id'];}return db['CannedAnswer'][_0x216a('0x46')]({'where':{'id':_0x11990f[_0x216a('0x44')]['id']}})[_0x216a('0x22')](handleEntityNotFound(_0x212c53,null))['then'](saveUpdates(_0x11990f[_0x216a('0x48')],null))[_0x216a('0x22')](respondWithResult(_0x212c53,null))[_0x216a('0x42')](handleError(_0x212c53,null));};exports[_0x216a('0x23')]=function(_0x3e1326,_0x549a25){return db[_0x216a('0x29')][_0x216a('0x46')]({'where':{'id':_0x3e1326[_0x216a('0x44')]['id']}})[_0x216a('0x22')](handleEntityNotFound(_0x549a25,null))['then'](removeEntity(_0x549a25,null))[_0x216a('0x42')](handleError(_0x549a25,null));};exports[_0x216a('0x49')]=function(_0x4c1204,_0x204fd4){var _0x2e6223={'key':_0x4c1204[_0x216a('0x48')]['key']};if(_0x4c1204[_0x216a('0x48')]['MailAccountId']){_0x2e6223[_0x216a('0x4a')]=_0x4c1204['body'][_0x216a('0x4a')];}else if(_0x4c1204[_0x216a('0x48')]['SmsAccountId']){_0x2e6223[_0x216a('0x4b')]=_0x4c1204[_0x216a('0x48')]['SmsAccountId'];}else if(_0x4c1204[_0x216a('0x48')][_0x216a('0x4c')]){_0x2e6223[_0x216a('0x4c')]=_0x4c1204['body'][_0x216a('0x4c')];}else if(_0x4c1204[_0x216a('0x48')][_0x216a('0x4d')]){_0x2e6223['ChatWebsiteId']=_0x4c1204[_0x216a('0x48')][_0x216a('0x4d')];}return db[_0x216a('0x29')][_0x216a('0x46')]({'where':_0x2e6223})[_0x216a('0x22')](function(_0x3965a9){if(_0x3965a9){throw new db[(_0x216a('0x4e'))][(_0x216a('0x4f'))](_0x216a('0x50'));}return db['CannedAnswer'][_0x216a('0x49')](_0x4c1204[_0x216a('0x48')]);})[_0x216a('0x22')](function(_0x327bdd){var _0x13aa15=_0x4c1204['user'][_0x216a('0x24')]({'plain':!![]});if(!_0x13aa15)throw new Error(_0x216a('0x51'));if(_0x13aa15[_0x216a('0x52')]==='user'){var _0x2e4f12=_0x327bdd['get']({'plain':!![]});return db['UserProfileSection'][_0x216a('0x46')]({'where':{'name':_0x216a('0x25'),'userProfileId':_0x13aa15[_0x216a('0x53')]},'raw':!![]})[_0x216a('0x22')](function(_0x29e603){if(_0x29e603&&_0x29e603['autoAssociation']===0x0){return db['UserProfileResource'][_0x216a('0x49')]({'name':_0x2e4f12[_0x216a('0x2c')],'resourceId':_0x2e4f12['id'],'type':_0x29e603[_0x216a('0x2c')],'sectionId':_0x29e603['id']},{})['then'](function(){return _0x327bdd;});}else{return _0x327bdd;}})['catch'](function(_0x41716e){logger[_0x216a('0x26')](_0x216a('0x54'),_0x41716e);throw _0x41716e;});}return _0x327bdd;})[_0x216a('0x22')](respondWithResult(_0x204fd4,0xc9))[_0x216a('0x42')](handleError(_0x204fd4,null));}; \ No newline at end of file +var _0x770b=['fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','CannedAnswer','includeAll','include','findAll','catch','show','params','keys','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','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','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','intersection'];(function(_0x369ca1,_0x3f954b){var _0x2393d0=function(_0x3b9fa5){while(--_0x3b9fa5){_0x369ca1['push'](_0x369ca1['shift']());}};_0x2393d0(++_0x3f954b);}(_0x770b,0xd5));var _0xb770=function(_0x4c9be7,_0x538b4d){_0x4c9be7=_0x4c9be7-0x0;var _0x5250a7=_0x770b[_0x4c9be7];return _0x5250a7;};'use strict';var pdf=require(_0xb770('0x0'));var emlformat=require(_0xb770('0x1'));var rimraf=require(_0xb770('0x2'));var zipdir=require(_0xb770('0x3'));var jsonpatch=require(_0xb770('0x4'));var rp=require(_0xb770('0x5'));var moment=require(_0xb770('0x6'));var BPromise=require(_0xb770('0x7'));var Mustache=require(_0xb770('0x8'));var util=require('util');var path=require(_0xb770('0x9'));var sox=require(_0xb770('0xa'));var csv=require(_0xb770('0xb'));var ejs=require(_0xb770('0xc'));var fs=require('fs');var _=require(_0xb770('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb770('0xe'));var deskjs=require(_0xb770('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb770('0x10'));var Papa=require('papaparse');var Redis=require(_0xb770('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb770('0x12'));var hardwareService=require(_0xb770('0x13'));var logger=require(_0xb770('0x14'))('api');var utils=require(_0xb770('0x15'));var config=require(_0xb770('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32fb4e,_0xc4fd1a){_0xc4fd1a=_0xc4fd1a||0xcc;return function(_0x401cfc){if(_0x401cfc){return _0x32fb4e['sendStatus'](_0xc4fd1a);}return _0x32fb4e[_0xb770('0x17')](_0xc4fd1a)[_0xb770('0x18')]();};}function respondWithResult(_0x68c25a,_0x4afade){_0x4afade=_0x4afade||0xc8;return function(_0x4b8e98){if(_0x4b8e98){return _0x68c25a[_0xb770('0x17')](_0x4afade)[_0xb770('0x19')](_0x4b8e98);}};}function respondWithFilteredResult(_0x4766bf,_0x574703){return function(_0x4e0a9e){if(_0x4e0a9e){var _0x550d8d=_0x4e0a9e[_0xb770('0x1a')],_0x5922e1=_0x574703[_0xb770('0x1b')],_0x297415=_0x574703[_0xb770('0x1b')]+_0x574703[_0xb770('0x1c')],_0x11324b;if(_0x297415>=_0x550d8d){_0x297415=_0x550d8d;_0x11324b=0xc8;}else{_0x11324b=0xce;}_0x4766bf[_0xb770('0x17')](_0x11324b);return _0x4766bf[_0xb770('0x1d')](_0xb770('0x1e'),_0x5922e1+'-'+_0x297415+'/'+_0x550d8d)[_0xb770('0x19')](_0x4e0a9e);}return null;};}function patchUpdates(_0x233918){return function(_0x41d69a){try{jsonpatch[_0xb770('0x1f')](_0x41d69a,_0x233918,!![]);}catch(_0x180749){return BPromise[_0xb770('0x20')](_0x180749);}return _0x41d69a[_0xb770('0x21')]();};}function saveUpdates(_0x5f4b22,_0x243f46){return function(_0x4f22f4){if(_0x4f22f4){return _0x4f22f4['update'](_0x5f4b22)[_0xb770('0x22')](function(_0x4fd2a0){return _0x4fd2a0;});}return null;};}function removeEntity(_0x4c47da,_0x1dd16e){return function(_0x37d2e6){if(_0x37d2e6){return _0x37d2e6[_0xb770('0x23')]()[_0xb770('0x22')](function(){var _0x4562b1=_0x37d2e6[_0xb770('0x24')]({'plain':!![]});var _0x3640ab=_0xb770('0x25');return db[_0xb770('0x26')][_0xb770('0x23')]({'where':{'type':_0x3640ab,'resourceId':_0x4562b1['id']}})['then'](function(){return _0x37d2e6;});})[_0xb770('0x22')](function(){_0x4c47da['status'](0xcc)[_0xb770('0x18')]();});}};}function handleEntityNotFound(_0x34d44a,_0x20d64e){return function(_0x5e982d){if(!_0x5e982d){_0x34d44a[_0xb770('0x27')](0x194);}return _0x5e982d;};}function handleError(_0x36b0a7,_0x4d79f7){_0x4d79f7=_0x4d79f7||0x1f4;return function(_0x43af80){logger[_0xb770('0x28')](_0x43af80[_0xb770('0x29')]);if(_0x43af80['name']){delete _0x43af80[_0xb770('0x2a')];}_0x36b0a7[_0xb770('0x17')](_0x4d79f7)['send'](_0x43af80);};}exports['index']=function(_0x45fa46,_0x5555c8){var _0x4c58ef={},_0x1f9cdb={},_0x1742dd={'count':0x0,'rows':[]};var _0x143e49=_[_0xb770('0x2b')](db['CannedAnswer'][_0xb770('0x2c')],function(_0x4c3d2a){return{'name':_0x4c3d2a[_0xb770('0x2d')],'type':_0x4c3d2a[_0xb770('0x2e')][_0xb770('0x2f')]};});_0x1f9cdb[_0xb770('0x30')]=_['map'](_0x143e49,_0xb770('0x2a'));_0x1f9cdb[_0xb770('0x31')]=_['keys'](_0x45fa46[_0xb770('0x31')]);_0x1f9cdb['filters']=_['intersection'](_0x1f9cdb['model'],_0x1f9cdb[_0xb770('0x31')]);_0x4c58ef['attributes']=_[_0xb770('0x32')](_0x1f9cdb['model'],qs['fields'](_0x45fa46[_0xb770('0x31')][_0xb770('0x33')]));_0x4c58ef['attributes']=_0x4c58ef[_0xb770('0x34')]['length']?_0x4c58ef['attributes']:_0x1f9cdb[_0xb770('0x30')];if(!_0x45fa46['query'][_0xb770('0x35')]('nolimit')){_0x4c58ef[_0xb770('0x1c')]=qs[_0xb770('0x1c')](_0x45fa46[_0xb770('0x31')][_0xb770('0x1c')]);_0x4c58ef[_0xb770('0x1b')]=qs[_0xb770('0x1b')](_0x45fa46[_0xb770('0x31')][_0xb770('0x1b')]);}_0x4c58ef[_0xb770('0x36')]=qs['sort'](_0x45fa46[_0xb770('0x31')][_0xb770('0x37')]);_0x4c58ef[_0xb770('0x38')]=qs[_0xb770('0x39')](_[_0xb770('0x3a')](_0x45fa46[_0xb770('0x31')],_0x1f9cdb[_0xb770('0x39')]),_0x143e49);if(_0x45fa46[_0xb770('0x31')]['filter']){_0x4c58ef[_0xb770('0x38')]=_[_0xb770('0x3b')](_0x4c58ef[_0xb770('0x38')],{'$or':_[_0xb770('0x2b')](_0x143e49,function(_0x4cc054){if(_0x4cc054['type']!==_0xb770('0x3c')){var _0x4383e6={};_0x4383e6[_0x4cc054['name']]={'$like':'%'+_0x45fa46[_0xb770('0x31')][_0xb770('0x3d')]+'%'};return _0x4383e6;}})});}_0x4c58ef=_['merge']({},_0x4c58ef,_0x45fa46[_0xb770('0x3e')]);var _0xaa1759={'where':_0x4c58ef['where']};return db[_0xb770('0x3f')][_0xb770('0x1a')](_0xaa1759)[_0xb770('0x22')](function(_0x3b96c5){_0x1742dd['count']=_0x3b96c5;if(_0x45fa46[_0xb770('0x31')][_0xb770('0x40')]){_0x4c58ef[_0xb770('0x41')]=[{'all':!![]}];}return db[_0xb770('0x3f')][_0xb770('0x42')](_0x4c58ef);})[_0xb770('0x22')](function(_0x3a094e){_0x1742dd['rows']=_0x3a094e;return _0x1742dd;})[_0xb770('0x22')](respondWithFilteredResult(_0x5555c8,_0x4c58ef))[_0xb770('0x43')](handleError(_0x5555c8,null));};exports[_0xb770('0x44')]=function(_0x1e89bc,_0x5620fd){var _0x45a674={'raw':!![],'where':{'id':_0x1e89bc[_0xb770('0x45')]['id']}},_0x2a0339={};_0x2a0339[_0xb770('0x30')]=_[_0xb770('0x46')](db[_0xb770('0x3f')][_0xb770('0x2c')]);_0x2a0339['query']=_['keys'](_0x1e89bc['query']);_0x2a0339['filters']=_[_0xb770('0x32')](_0x2a0339['model'],_0x2a0339['query']);_0x45a674[_0xb770('0x34')]=_[_0xb770('0x32')](_0x2a0339['model'],qs[_0xb770('0x33')](_0x1e89bc[_0xb770('0x31')][_0xb770('0x33')]));_0x45a674[_0xb770('0x34')]=_0x45a674[_0xb770('0x34')]['length']?_0x45a674[_0xb770('0x34')]:_0x2a0339['model'];if(_0x1e89bc[_0xb770('0x31')][_0xb770('0x40')]){_0x45a674[_0xb770('0x41')]=[{'all':!![]}];}_0x45a674=_[_0xb770('0x3b')]({},_0x45a674,_0x1e89bc[_0xb770('0x3e')]);return db[_0xb770('0x3f')]['find'](_0x45a674)['then'](handleEntityNotFound(_0x5620fd,null))[_0xb770('0x22')](respondWithResult(_0x5620fd,null))[_0xb770('0x43')](handleError(_0x5620fd,null));};exports[_0xb770('0x47')]=function(_0x3760c6,_0x346fb7){if(_0x3760c6['body']['id']){delete _0x3760c6[_0xb770('0x48')]['id'];}return db[_0xb770('0x3f')][_0xb770('0x49')]({'where':{'id':_0x3760c6['params']['id']}})['then'](handleEntityNotFound(_0x346fb7,null))[_0xb770('0x22')](saveUpdates(_0x3760c6[_0xb770('0x48')],null))[_0xb770('0x22')](respondWithResult(_0x346fb7,null))[_0xb770('0x43')](handleError(_0x346fb7,null));};exports[_0xb770('0x23')]=function(_0x1fd107,_0x2f2d53){return db['CannedAnswer']['find']({'where':{'id':_0x1fd107[_0xb770('0x45')]['id']}})[_0xb770('0x22')](handleEntityNotFound(_0x2f2d53,null))[_0xb770('0x22')](removeEntity(_0x2f2d53,null))['catch'](handleError(_0x2f2d53,null));};exports[_0xb770('0x4a')]=function(_0x3a9785,_0x6f23a0){var _0x100a6f={'key':_0x3a9785[_0xb770('0x48')][_0xb770('0x2f')]};if(_0x3a9785[_0xb770('0x48')][_0xb770('0x4b')]){_0x100a6f[_0xb770('0x4b')]=_0x3a9785[_0xb770('0x48')][_0xb770('0x4b')];}else if(_0x3a9785[_0xb770('0x48')][_0xb770('0x4c')]){_0x100a6f['SmsAccountId']=_0x3a9785[_0xb770('0x48')][_0xb770('0x4c')];}else if(_0x3a9785['body'][_0xb770('0x4d')]){_0x100a6f['OpenchannelAccountId']=_0x3a9785[_0xb770('0x48')][_0xb770('0x4d')];}else if(_0x3a9785[_0xb770('0x48')]['ChatWebsiteId']){_0x100a6f[_0xb770('0x4e')]=_0x3a9785[_0xb770('0x48')][_0xb770('0x4e')];}return db['CannedAnswer'][_0xb770('0x49')]({'where':_0x100a6f})[_0xb770('0x22')](function(_0x5cc5ac){if(_0x5cc5ac){throw new db[(_0xb770('0x4f'))][(_0xb770('0x50'))](_0xb770('0x51'));}return db[_0xb770('0x3f')][_0xb770('0x4a')](_0x3a9785[_0xb770('0x48')]);})[_0xb770('0x22')](function(_0x113b59){var _0x140821=_0x3a9785[_0xb770('0x52')]['get']({'plain':!![]});if(!_0x140821)throw new Error(_0xb770('0x53'));if(_0x140821[_0xb770('0x54')]===_0xb770('0x52')){var _0x1c71c4=_0x113b59[_0xb770('0x24')]({'plain':!![]});return db[_0xb770('0x55')][_0xb770('0x49')]({'where':{'name':_0xb770('0x25'),'userProfileId':_0x140821[_0xb770('0x56')]},'raw':!![]})[_0xb770('0x22')](function(_0x490677){if(_0x490677&&_0x490677[_0xb770('0x57')]===0x0){return db[_0xb770('0x26')][_0xb770('0x4a')]({'name':_0x1c71c4['name'],'resourceId':_0x1c71c4['id'],'type':_0x490677[_0xb770('0x2a')],'sectionId':_0x490677['id']},{})[_0xb770('0x22')](function(){return _0x113b59;});}else{return _0x113b59;}})['catch'](function(_0x195b19){logger[_0xb770('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x195b19);throw _0x195b19;});}return _0x113b59;})[_0xb770('0x22')](respondWithResult(_0x6f23a0,0xc9))[_0xb770('0x43')](handleError(_0x6f23a0,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 45138c7..68acf30 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 _0x90b5=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x368741,_0x2592c9){var _0x26b98a=function(_0x5f0e84){while(--_0x5f0e84){_0x368741['push'](_0x368741['shift']());}};_0x26b98a(++_0x2592c9);}(_0x90b5,0x139));var _0x590b=function(_0x2608f6,_0x3e467){_0x2608f6=_0x2608f6-0x0;var _0x581a04=_0x90b5[_0x2608f6];return _0x581a04;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x590b('0xa'),'collate':_0x590b('0xb')});}; \ No newline at end of file +var _0x5af0=['api','moment','bluebird','request-promise','path','../../config/environment','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x446f3f,_0x48e0d0){var _0x96f46=function(_0x3145f1){while(--_0x3145f1){_0x446f3f['push'](_0x446f3f['shift']());}};_0x96f46(++_0x48e0d0);}(_0x5af0,0x1eb));var _0x05af=function(_0x3d4793,_0x37a97f){_0x3d4793=_0x3d4793-0x0;var _0x4a88cb=_0x5af0[_0x3d4793];return _0x4a88cb;};'use strict';var _=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var logger=require(_0x05af('0x2'))(_0x05af('0x3'));var moment=require(_0x05af('0x4'));var BPromise=require(_0x05af('0x5'));var rp=require(_0x05af('0x6'));var fs=require('fs');var path=require(_0x05af('0x7'));var rimraf=require('rimraf');var config=require(_0x05af('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x05af('0x9')]=function(_0x27a3e2,_0x2a8ef6){return _0x27a3e2['define'](_0x05af('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x05af('0xb'),'collate':_0x05af('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e9fd840..5bf8d6b 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 _0x757d=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x1f3e64,_0x254556){var _0x107d9c=function(_0x406eb9){while(--_0x406eb9){_0x1f3e64['push'](_0x1f3e64['shift']());}};_0x107d9c(++_0x254556);}(_0x757d,0xb2));var _0xd757=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x757d[_0x32729c];return _0x482cfd;};'use strict';var _=require(_0xd757('0x0'));var util=require(_0xd757('0x1'));var moment=require(_0xd757('0x2'));var BPromise=require('bluebird');var rs=require(_0xd757('0x3'));var fs=require('fs');var Redis=require(_0xd757('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd757('0x5'));var logger=require('../../config/logger')(_0xd757('0x6'));var config=require(_0xd757('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43d793,_0xd75d09,_0x174433){return new BPromise(function(_0x3a6aaa,_0x3b3b9){return client['request'](_0x43d793,_0x174433)[_0xd757('0x9')](function(_0x22f569){logger[_0xd757('0xa')](_0xd757('0xb'),_0xd75d09,_0xd757('0xc'));logger['debug'](_0xd757('0xd'),_0xd75d09,_0xd757('0xc'),JSON['stringify'](_0x22f569));if(_0x22f569[_0xd757('0xe')]){if(_0x22f569['error'][_0xd757('0xf')]===0x1f4){logger[_0xd757('0xe')](_0xd757('0xb'),_0xd75d09,_0x22f569[_0xd757('0xe')][_0xd757('0x10')]);return _0x3b3b9(_0x22f569[_0xd757('0xe')]['message']);}logger[_0xd757('0xe')]('CannedAnswer,\x20%s,\x20%s',_0xd75d09,_0x22f569[_0xd757('0xe')][_0xd757('0x10')]);return _0x3a6aaa(_0x22f569[_0xd757('0xe')][_0xd757('0x10')]);}else{logger[_0xd757('0xa')](_0xd757('0xb'),_0xd75d09,_0xd757('0xc'));_0x3a6aaa(_0x22f569['result'][_0xd757('0x10')]);}})[_0xd757('0x11')](function(_0x30880c){logger[_0xd757('0xe')](_0xd757('0xb'),_0xd75d09,_0x30880c);_0x3b3b9(_0x30880c);});});} \ No newline at end of file +var _0x0175=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x3c0f13,_0x5e17ba){var _0x5d43dc=function(_0x740836){while(--_0x740836){_0x3c0f13['push'](_0x3c0f13['shift']());}};_0x5d43dc(++_0x5e17ba);}(_0x0175,0x18f));var _0x5017=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0x0175[_0x43de22];return _0x4b15ee;};'use strict';var _=require('lodash');var util=require(_0x5017('0x0'));var moment=require(_0x5017('0x1'));var BPromise=require(_0x5017('0x2'));var rs=require(_0x5017('0x3'));var fs=require('fs');var Redis=require(_0x5017('0x4'));var db=require(_0x5017('0x5'))['db'];var utils=require(_0x5017('0x6'));var logger=require(_0x5017('0x7'))(_0x5017('0x8'));var config=require(_0x5017('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5017('0xa')][_0x5017('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270b64,_0x23875f,_0x330d0d){return new BPromise(function(_0x71a37,_0x4af2d9){return client['request'](_0x270b64,_0x330d0d)[_0x5017('0xc')](function(_0x507973){logger[_0x5017('0xd')](_0x5017('0xe'),_0x23875f,'request\x20sent');logger[_0x5017('0xf')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x23875f,_0x5017('0x10'),JSON[_0x5017('0x11')](_0x507973));if(_0x507973[_0x5017('0x12')]){if(_0x507973[_0x5017('0x12')][_0x5017('0x13')]===0x1f4){logger['error'](_0x5017('0xe'),_0x23875f,_0x507973[_0x5017('0x12')][_0x5017('0x14')]);return _0x4af2d9(_0x507973[_0x5017('0x12')][_0x5017('0x14')]);}logger[_0x5017('0x12')](_0x5017('0xe'),_0x23875f,_0x507973['error'][_0x5017('0x14')]);return _0x71a37(_0x507973[_0x5017('0x12')]['message']);}else{logger[_0x5017('0xd')](_0x5017('0xe'),_0x23875f,_0x5017('0x10'));_0x71a37(_0x507973[_0x5017('0x15')]['message']);}})[_0x5017('0x16')](function(_0xbef018){logger[_0x5017('0x12')](_0x5017('0xe'),_0x23875f,_0xbef018);_0x4af2d9(_0xbef018);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 442970d..fdfae2b 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 _0x9a40=['isAuthenticated','/:id','post','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x233694,_0x1adcbe){var _0x1a511f=function(_0xdf785){while(--_0xdf785){_0x233694['push'](_0x233694['shift']());}};_0x1a511f(++_0x1adcbe);}(_0x9a40,0xb1));var _0x09a4=function(_0x14ddff,_0x515a39){_0x14ddff=_0x14ddff-0x0;var _0x5d5534=_0x9a40[_0x14ddff];return _0x5d5534;};'use strict';var multer=require(_0x09a4('0x0'));var util=require(_0x09a4('0x1'));var path=require(_0x09a4('0x2'));var timeout=require('connect-timeout');var express=require(_0x09a4('0x3'));var router=express[_0x09a4('0x4')]();var auth=require(_0x09a4('0x5'));var interaction=require(_0x09a4('0x6'));var config=require(_0x09a4('0x7'));var controller=require(_0x09a4('0x8'));router[_0x09a4('0x9')]('/',auth[_0x09a4('0xa')](),controller['index']);router[_0x09a4('0x9')](_0x09a4('0xb'),auth[_0x09a4('0xa')](),controller['show']);router[_0x09a4('0xc')]('/',auth[_0x09a4('0xa')](),controller['create']);router[_0x09a4('0xd')](_0x09a4('0xb'),auth[_0x09a4('0xa')](),controller['update']);router[_0x09a4('0xe')](_0x09a4('0xb'),auth[_0x09a4('0xa')](),controller[_0x09a4('0xf')]);module[_0x09a4('0x10')]=router; \ No newline at end of file +var _0x11ac=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x11ac,0x19e));var _0xc11a=function(_0xe63374,_0x53602c){_0xe63374=_0xe63374-0x0;var _0x1d2eec=_0x11ac[_0xe63374];return _0x1d2eec;};'use strict';var multer=require(_0xc11a('0x0'));var util=require(_0xc11a('0x1'));var path=require(_0xc11a('0x2'));var timeout=require(_0xc11a('0x3'));var express=require(_0xc11a('0x4'));var router=express['Router']();var auth=require(_0xc11a('0x5'));var interaction=require(_0xc11a('0x6'));var config=require(_0xc11a('0x7'));var controller=require(_0xc11a('0x8'));router[_0xc11a('0x9')]('/',auth[_0xc11a('0xa')](),controller[_0xc11a('0xb')]);router['get'](_0xc11a('0xc'),auth[_0xc11a('0xa')](),controller[_0xc11a('0xd')]);router[_0xc11a('0xe')]('/',auth[_0xc11a('0xa')](),controller[_0xc11a('0xf')]);router['put'](_0xc11a('0xc'),auth[_0xc11a('0xa')](),controller['update']);router[_0xc11a('0x10')](_0xc11a('0xc'),auth[_0xc11a('0xa')](),controller[_0xc11a('0x11')]);module[_0xc11a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ac107d3..81d0b9c 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 _0x70be=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x8eb81d,_0x38bdce){var _0x365480=function(_0x30242d){while(--_0x30242d){_0x8eb81d['push'](_0x8eb81d['shift']());}};_0x365480(++_0x38bdce);}(_0x70be,0x6f));var _0xe70b=function(_0x49c640,_0x1f597c){_0x49c640=_0x49c640-0x0;var _0x535815=_0x70be[_0x49c640];return _0x535815;};'use strict';var Sequelize=require(_0xe70b('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xe70b('0x1')],'allowNull':![],'defaultValue':_0xe70b('0x2')},'clid':{'type':Sequelize[_0xe70b('0x3')]},'src':{'type':Sequelize[_0xe70b('0x3')]},'dst':{'type':Sequelize[_0xe70b('0x3')]},'dcontext':{'type':Sequelize[_0xe70b('0x3')]},'channel':{'type':Sequelize[_0xe70b('0x3')]},'dstchannel':{'type':Sequelize[_0xe70b('0x3')]},'lastapp':{'type':Sequelize[_0xe70b('0x3')]},'lastdata':{'type':Sequelize[_0xe70b('0x3')]},'duration':{'type':Sequelize[_0xe70b('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe70b('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe70b('0x3')]},'amaflags':{'type':Sequelize[_0xe70b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe70b('0x3')]},'userfield':{'type':Sequelize[_0xe70b('0x3')]},'uniqueid':{'type':Sequelize[_0xe70b('0x3')]},'linkedid':{'type':Sequelize[_0xe70b('0x3')]},'sequence':{'type':Sequelize[_0xe70b('0x3')]},'peeraccount':{'type':Sequelize[_0xe70b('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe70b('0x3')]}}; \ No newline at end of file +var _0x5047=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5047,0x152));var _0x7504=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x5047[_0x51b661];return _0x5d1971;};'use strict';var Sequelize=require(_0x7504('0x0'));module[_0x7504('0x1')]={'calldate':{'type':Sequelize[_0x7504('0x2')],'allowNull':![],'defaultValue':_0x7504('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x7504('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x7504('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x7504('0x4')]},'lastapp':{'type':Sequelize[_0x7504('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x7504('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7504('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7504('0x4')]},'amaflags':{'type':Sequelize[_0x7504('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7504('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7504('0x4')]},'linkedid':{'type':Sequelize[_0x7504('0x4')]},'sequence':{'type':Sequelize[_0x7504('0x4')]},'peeraccount':{'type':Sequelize[_0x7504('0x4')]},'type':{'type':Sequelize[_0x7504('0x4')]},'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 d6f06f6..42d7325 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 _0xce8c=['mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Cdr','findAll','rows','catch','params','include','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3f1fc3,_0x25395a){var _0x3e5331=function(_0x549733){while(--_0x549733){_0x3f1fc3['push'](_0x3f1fc3['shift']());}};_0x3e5331(++_0x25395a);}(_0xce8c,0x125));var _0xcce8=function(_0x508240,_0x284df8){_0x508240=_0x508240-0x0;var _0x30b176=_0xce8c[_0x508240];return _0x30b176;};'use strict';var pdf=require(_0xcce8('0x0'));var emlformat=require(_0xcce8('0x1'));var rimraf=require(_0xcce8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcce8('0x3'));var rp=require(_0xcce8('0x4'));var moment=require(_0xcce8('0x5'));var BPromise=require(_0xcce8('0x6'));var Mustache=require(_0xcce8('0x7'));var util=require('util');var path=require(_0xcce8('0x8'));var sox=require(_0xcce8('0x9'));var csv=require(_0xcce8('0xa'));var ejs=require(_0xcce8('0xb'));var fs=require('fs');var _=require(_0xcce8('0xc'));var squel=require('squel');var crypto=require(_0xcce8('0xd'));var jsforce=require(_0xcce8('0xe'));var deskjs=require(_0xcce8('0xf'));var toCsv=require(_0xcce8('0xa'));var querystring=require('querystring');var Papa=require(_0xcce8('0x10'));var Redis=require(_0xcce8('0x11'));var authService=require(_0xcce8('0x12'));var qs=require(_0xcce8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcce8('0x14'));var logger=require(_0xcce8('0x15'))(_0xcce8('0x16'));var utils=require(_0xcce8('0x17'));var config=require(_0xcce8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f132,_0x426e13){_0x426e13=_0x426e13||0xcc;return function(_0x2f904e){if(_0x2f904e){return _0x43f132[_0xcce8('0x19')](_0x426e13);}return _0x43f132['status'](_0x426e13)[_0xcce8('0x1a')]();};}function respondWithResult(_0x5e9d17,_0x24f909){_0x24f909=_0x24f909||0xc8;return function(_0x40d639){if(_0x40d639){return _0x5e9d17['status'](_0x24f909)['json'](_0x40d639);}};}function respondWithFilteredResult(_0xab1cc1,_0xe77801){return function(_0x54c968){if(_0x54c968){var _0x832f38=_0x54c968[_0xcce8('0x1b')],_0x559bfa=_0xe77801[_0xcce8('0x1c')],_0x374d63=_0xe77801[_0xcce8('0x1c')]+_0xe77801[_0xcce8('0x1d')],_0x1228e5;if(_0x374d63>=_0x832f38){_0x374d63=_0x832f38;_0x1228e5=0xc8;}else{_0x1228e5=0xce;}_0xab1cc1[_0xcce8('0x1e')](_0x1228e5);return _0xab1cc1['set'](_0xcce8('0x1f'),_0x559bfa+'-'+_0x374d63+'/'+_0x832f38)[_0xcce8('0x20')](_0x54c968);}return null;};}function patchUpdates(_0x49cee9){return function(_0x1cafba){try{jsonpatch[_0xcce8('0x21')](_0x1cafba,_0x49cee9,!![]);}catch(_0x48f020){return BPromise[_0xcce8('0x22')](_0x48f020);}return _0x1cafba[_0xcce8('0x23')]();};}function saveUpdates(_0x15808a,_0x10fd0e){return function(_0x3be05c){if(_0x3be05c){return _0x3be05c[_0xcce8('0x24')](_0x15808a)[_0xcce8('0x25')](function(_0x20ac66){return _0x20ac66;});}return null;};}function removeEntity(_0x7bbd41,_0x58f5f7){return function(_0x1b9a34){if(_0x1b9a34){return _0x1b9a34['destroy']()['then'](function(){_0x7bbd41[_0xcce8('0x1e')](0xcc)[_0xcce8('0x1a')]();});}};}function handleEntityNotFound(_0x2af5df,_0x36c3cc){return function(_0x3a5706){if(!_0x3a5706){_0x2af5df[_0xcce8('0x19')](0x194);}return _0x3a5706;};}function handleError(_0x1004d3,_0x5508c8){_0x5508c8=_0x5508c8||0x1f4;return function(_0x5ecb6b){logger[_0xcce8('0x26')](_0x5ecb6b['stack']);if(_0x5ecb6b[_0xcce8('0x27')]){delete _0x5ecb6b['name'];}_0x1004d3[_0xcce8('0x1e')](_0x5508c8)[_0xcce8('0x28')](_0x5ecb6b);};}exports[_0xcce8('0x29')]=function(_0x1dacf0,_0x4ac022){var _0x39d9ad={},_0x231ed6={},_0x5c10da={'count':0x0,'rows':[]};var _0x509f58=_[_0xcce8('0x2a')](db['Cdr'][_0xcce8('0x2b')],function(_0x26e56d){return{'name':_0x26e56d['fieldName'],'type':_0x26e56d[_0xcce8('0x2c')][_0xcce8('0x2d')]};});_0x231ed6[_0xcce8('0x2e')]=_['map'](_0x509f58,_0xcce8('0x27'));_0x231ed6[_0xcce8('0x2f')]=_[_0xcce8('0x30')](_0x1dacf0[_0xcce8('0x2f')]);_0x231ed6[_0xcce8('0x31')]=_[_0xcce8('0x32')](_0x231ed6[_0xcce8('0x2e')],_0x231ed6[_0xcce8('0x2f')]);_0x39d9ad[_0xcce8('0x33')]=_[_0xcce8('0x32')](_0x231ed6[_0xcce8('0x2e')],qs[_0xcce8('0x34')](_0x1dacf0['query'][_0xcce8('0x34')]));_0x39d9ad[_0xcce8('0x33')]=_0x39d9ad[_0xcce8('0x33')][_0xcce8('0x35')]?_0x39d9ad[_0xcce8('0x33')]:_0x231ed6['model'];if(!_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x36')](_0xcce8('0x37'))){_0x39d9ad[_0xcce8('0x1d')]=qs[_0xcce8('0x1d')](_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x1d')]);_0x39d9ad[_0xcce8('0x1c')]=qs[_0xcce8('0x1c')](_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x1c')]);}_0x39d9ad[_0xcce8('0x38')]=qs['sort'](_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x39')]);_0x39d9ad[_0xcce8('0x3a')]=qs[_0xcce8('0x31')](_[_0xcce8('0x3b')](_0x1dacf0[_0xcce8('0x2f')],_0x231ed6['filters']),_0x509f58);if(_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x3c')]){_0x39d9ad[_0xcce8('0x3a')]=_[_0xcce8('0x3d')](_0x39d9ad[_0xcce8('0x3a')],{'$or':_[_0xcce8('0x2a')](_0x509f58,function(_0x325d47){if(_0x325d47[_0xcce8('0x2c')]!==_0xcce8('0x3e')){var _0x43c7c7={};_0x43c7c7[_0x325d47['name']]={'$like':'%'+_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x3c')]+'%'};return _0x43c7c7;}})});}_0x39d9ad=_[_0xcce8('0x3d')]({},_0x39d9ad,_0x1dacf0[_0xcce8('0x3f')]);var _0x177201={'where':_0x39d9ad[_0xcce8('0x3a')]};return db['Cdr'][_0xcce8('0x1b')](_0x177201)[_0xcce8('0x25')](function(_0x4b8d47){_0x5c10da[_0xcce8('0x1b')]=_0x4b8d47;if(_0x1dacf0[_0xcce8('0x2f')][_0xcce8('0x40')]){_0x39d9ad['include']=[{'all':!![]}];}return db[_0xcce8('0x41')][_0xcce8('0x42')](_0x39d9ad);})[_0xcce8('0x25')](function(_0x353d4c){_0x5c10da[_0xcce8('0x43')]=_0x353d4c;return _0x5c10da;})[_0xcce8('0x25')](respondWithFilteredResult(_0x4ac022,_0x39d9ad))[_0xcce8('0x44')](handleError(_0x4ac022,null));};exports['show']=function(_0xf014a2,_0x4de8d4){var _0x118383={'raw':!![],'where':{'id':_0xf014a2[_0xcce8('0x45')]['id']}},_0x403a2e={};_0x403a2e[_0xcce8('0x2e')]=_['keys'](db['Cdr'][_0xcce8('0x2b')]);_0x403a2e['query']=_['keys'](_0xf014a2[_0xcce8('0x2f')]);_0x403a2e[_0xcce8('0x31')]=_['intersection'](_0x403a2e[_0xcce8('0x2e')],_0x403a2e[_0xcce8('0x2f')]);_0x118383[_0xcce8('0x33')]=_['intersection'](_0x403a2e[_0xcce8('0x2e')],qs[_0xcce8('0x34')](_0xf014a2['query']['fields']));_0x118383[_0xcce8('0x33')]=_0x118383['attributes'][_0xcce8('0x35')]?_0x118383[_0xcce8('0x33')]:_0x403a2e[_0xcce8('0x2e')];if(_0xf014a2['query'][_0xcce8('0x40')]){_0x118383[_0xcce8('0x46')]=[{'all':!![]}];}_0x118383=_[_0xcce8('0x3d')]({},_0x118383,_0xf014a2[_0xcce8('0x3f')]);return db[_0xcce8('0x41')]['find'](_0x118383)[_0xcce8('0x25')](handleEntityNotFound(_0x4de8d4,null))[_0xcce8('0x25')](respondWithResult(_0x4de8d4,null))[_0xcce8('0x44')](handleError(_0x4de8d4,null));};exports[_0xcce8('0x47')]=function(_0x10c131,_0x10677d){return db[_0xcce8('0x41')]['create'](_0x10c131[_0xcce8('0x48')],{})[_0xcce8('0x25')](respondWithResult(_0x10677d,0xc9))[_0xcce8('0x44')](handleError(_0x10677d,null));};exports['update']=function(_0x498111,_0xf3784e){if(_0x498111[_0xcce8('0x48')]['id']){delete _0x498111['body']['id'];}return db[_0xcce8('0x41')][_0xcce8('0x49')]({'where':{'id':_0x498111['params']['id']}})['then'](handleEntityNotFound(_0xf3784e,null))[_0xcce8('0x25')](saveUpdates(_0x498111[_0xcce8('0x48')],null))[_0xcce8('0x25')](respondWithResult(_0xf3784e,null))[_0xcce8('0x44')](handleError(_0xf3784e,null));};exports['destroy']=function(_0x203bf3,_0x9bcf08){return db[_0xcce8('0x41')][_0xcce8('0x49')]({'where':{'id':_0x203bf3[_0xcce8('0x45')]['id']}})[_0xcce8('0x25')](handleEntityNotFound(_0x9bcf08,null))[_0xcce8('0x25')](removeEntity(_0x9bcf08,null))['catch'](handleError(_0x9bcf08,null));};exports[_0xcce8('0x4a')]=function(_0x13ff9f,_0x237c80){return db[_0xcce8('0x41')][_0xcce8('0x4a')]()[_0xcce8('0x25')](respondWithResult(_0x237c80,null))[_0xcce8('0x44')](handleError(_0x237c80,null));}; \ No newline at end of file +var _0x285f=['rows','show','keys','find','catch','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Cdr','includeAll','include','findAll'];(function(_0x1318b2,_0x5e12be){var _0x51d93e=function(_0x45abbe){while(--_0x45abbe){_0x1318b2['push'](_0x1318b2['shift']());}};_0x51d93e(++_0x5e12be);}(_0x285f,0x142));var _0xf285=function(_0x4f4a34,_0x15cdf0){_0x4f4a34=_0x4f4a34-0x0;var _0x297e28=_0x285f[_0x4f4a34];return _0x297e28;};'use strict';var pdf=require(_0xf285('0x0'));var emlformat=require(_0xf285('0x1'));var rimraf=require(_0xf285('0x2'));var zipdir=require(_0xf285('0x3'));var jsonpatch=require(_0xf285('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf285('0x5'));var Mustache=require(_0xf285('0x6'));var util=require(_0xf285('0x7'));var path=require('path');var sox=require(_0xf285('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf285('0x9'));var squel=require(_0xf285('0xa'));var crypto=require('crypto');var jsforce=require(_0xf285('0xb'));var deskjs=require(_0xf285('0xc'));var toCsv=require(_0xf285('0xd'));var querystring=require(_0xf285('0xe'));var Papa=require(_0xf285('0xf'));var Redis=require(_0xf285('0x10'));var authService=require(_0xf285('0x11'));var qs=require(_0xf285('0x12'));var as=require(_0xf285('0x13'));var hardwareService=require(_0xf285('0x14'));var logger=require('../../config/logger')(_0xf285('0x15'));var utils=require(_0xf285('0x16'));var config=require('../../config/environment');var db=require(_0xf285('0x17'))['db'];function respondWithStatusCode(_0x48ee38,_0x1c990d){_0x1c990d=_0x1c990d||0xcc;return function(_0x330083){if(_0x330083){return _0x48ee38[_0xf285('0x18')](_0x1c990d);}return _0x48ee38[_0xf285('0x19')](_0x1c990d)[_0xf285('0x1a')]();};}function respondWithResult(_0x403c2d,_0x532fd7){_0x532fd7=_0x532fd7||0xc8;return function(_0x3fc3dc){if(_0x3fc3dc){return _0x403c2d['status'](_0x532fd7)[_0xf285('0x1b')](_0x3fc3dc);}};}function respondWithFilteredResult(_0xe507fc,_0x4b6d7e){return function(_0x14997d){if(_0x14997d){var _0x3a913e=_0x14997d[_0xf285('0x1c')],_0x47dbfa=_0x4b6d7e[_0xf285('0x1d')],_0x174b76=_0x4b6d7e[_0xf285('0x1d')]+_0x4b6d7e[_0xf285('0x1e')],_0x1abe25;if(_0x174b76>=_0x3a913e){_0x174b76=_0x3a913e;_0x1abe25=0xc8;}else{_0x1abe25=0xce;}_0xe507fc['status'](_0x1abe25);return _0xe507fc[_0xf285('0x1f')](_0xf285('0x20'),_0x47dbfa+'-'+_0x174b76+'/'+_0x3a913e)['json'](_0x14997d);}return null;};}function patchUpdates(_0x2e08bb){return function(_0x486758){try{jsonpatch[_0xf285('0x21')](_0x486758,_0x2e08bb,!![]);}catch(_0x31ea8d){return BPromise[_0xf285('0x22')](_0x31ea8d);}return _0x486758['save']();};}function saveUpdates(_0x1c3a90,_0x39a693){return function(_0x5a169c){if(_0x5a169c){return _0x5a169c['update'](_0x1c3a90)[_0xf285('0x23')](function(_0x9e1ddc){return _0x9e1ddc;});}return null;};}function removeEntity(_0x802833,_0x3e4a14){return function(_0x4ca76c){if(_0x4ca76c){return _0x4ca76c[_0xf285('0x24')]()[_0xf285('0x23')](function(){_0x802833[_0xf285('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e964,_0x44c6eb){return function(_0x46aeb5){if(!_0x46aeb5){_0x59e964['sendStatus'](0x194);}return _0x46aeb5;};}function handleError(_0x1b3e76,_0xc97436){_0xc97436=_0xc97436||0x1f4;return function(_0x58b6e2){logger[_0xf285('0x25')](_0x58b6e2[_0xf285('0x26')]);if(_0x58b6e2['name']){delete _0x58b6e2['name'];}_0x1b3e76[_0xf285('0x19')](_0xc97436)[_0xf285('0x27')](_0x58b6e2);};}exports[_0xf285('0x28')]=function(_0x3e77d0,_0x2b345b){var _0xbd24c8={},_0x322b06={},_0x4e7e31={'count':0x0,'rows':[]};var _0x31b8aa=_[_0xf285('0x29')](db['Cdr'][_0xf285('0x2a')],function(_0x3340ed){return{'name':_0x3340ed[_0xf285('0x2b')],'type':_0x3340ed[_0xf285('0x2c')][_0xf285('0x2d')]};});_0x322b06[_0xf285('0x2e')]=_[_0xf285('0x29')](_0x31b8aa,_0xf285('0x2f'));_0x322b06['query']=_['keys'](_0x3e77d0[_0xf285('0x30')]);_0x322b06['filters']=_[_0xf285('0x31')](_0x322b06[_0xf285('0x2e')],_0x322b06[_0xf285('0x30')]);_0xbd24c8['attributes']=_[_0xf285('0x31')](_0x322b06[_0xf285('0x2e')],qs['fields'](_0x3e77d0[_0xf285('0x30')][_0xf285('0x32')]));_0xbd24c8[_0xf285('0x33')]=_0xbd24c8[_0xf285('0x33')][_0xf285('0x34')]?_0xbd24c8[_0xf285('0x33')]:_0x322b06['model'];if(!_0x3e77d0['query'][_0xf285('0x35')](_0xf285('0x36'))){_0xbd24c8[_0xf285('0x1e')]=qs[_0xf285('0x1e')](_0x3e77d0[_0xf285('0x30')][_0xf285('0x1e')]);_0xbd24c8[_0xf285('0x1d')]=qs[_0xf285('0x1d')](_0x3e77d0[_0xf285('0x30')][_0xf285('0x1d')]);}_0xbd24c8[_0xf285('0x37')]=qs['sort'](_0x3e77d0[_0xf285('0x30')][_0xf285('0x38')]);_0xbd24c8['where']=qs[_0xf285('0x39')](_[_0xf285('0x3a')](_0x3e77d0[_0xf285('0x30')],_0x322b06[_0xf285('0x39')]),_0x31b8aa);if(_0x3e77d0[_0xf285('0x30')][_0xf285('0x3b')]){_0xbd24c8[_0xf285('0x3c')]=_[_0xf285('0x3d')](_0xbd24c8[_0xf285('0x3c')],{'$or':_[_0xf285('0x29')](_0x31b8aa,function(_0xe082ec){if(_0xe082ec[_0xf285('0x2c')]!==_0xf285('0x3e')){var _0x5250df={};_0x5250df[_0xe082ec[_0xf285('0x2f')]]={'$like':'%'+_0x3e77d0['query'][_0xf285('0x3b')]+'%'};return _0x5250df;}})});}_0xbd24c8=_[_0xf285('0x3d')]({},_0xbd24c8,_0x3e77d0[_0xf285('0x3f')]);var _0xc14c6={'where':_0xbd24c8[_0xf285('0x3c')]};return db[_0xf285('0x40')][_0xf285('0x1c')](_0xc14c6)[_0xf285('0x23')](function(_0x97029c){_0x4e7e31[_0xf285('0x1c')]=_0x97029c;if(_0x3e77d0[_0xf285('0x30')][_0xf285('0x41')]){_0xbd24c8[_0xf285('0x42')]=[{'all':!![]}];}return db[_0xf285('0x40')][_0xf285('0x43')](_0xbd24c8);})[_0xf285('0x23')](function(_0x2bb3b5){_0x4e7e31[_0xf285('0x44')]=_0x2bb3b5;return _0x4e7e31;})[_0xf285('0x23')](respondWithFilteredResult(_0x2b345b,_0xbd24c8))['catch'](handleError(_0x2b345b,null));};exports[_0xf285('0x45')]=function(_0x2a1bed,_0x562899){var _0x9091f4={'raw':!![],'where':{'id':_0x2a1bed['params']['id']}},_0x33b583={};_0x33b583['model']=_[_0xf285('0x46')](db[_0xf285('0x40')][_0xf285('0x2a')]);_0x33b583['query']=_[_0xf285('0x46')](_0x2a1bed[_0xf285('0x30')]);_0x33b583[_0xf285('0x39')]=_[_0xf285('0x31')](_0x33b583[_0xf285('0x2e')],_0x33b583[_0xf285('0x30')]);_0x9091f4[_0xf285('0x33')]=_[_0xf285('0x31')](_0x33b583[_0xf285('0x2e')],qs[_0xf285('0x32')](_0x2a1bed[_0xf285('0x30')][_0xf285('0x32')]));_0x9091f4['attributes']=_0x9091f4[_0xf285('0x33')][_0xf285('0x34')]?_0x9091f4[_0xf285('0x33')]:_0x33b583[_0xf285('0x2e')];if(_0x2a1bed[_0xf285('0x30')][_0xf285('0x41')]){_0x9091f4[_0xf285('0x42')]=[{'all':!![]}];}_0x9091f4=_[_0xf285('0x3d')]({},_0x9091f4,_0x2a1bed[_0xf285('0x3f')]);return db[_0xf285('0x40')][_0xf285('0x47')](_0x9091f4)[_0xf285('0x23')](handleEntityNotFound(_0x562899,null))[_0xf285('0x23')](respondWithResult(_0x562899,null))[_0xf285('0x48')](handleError(_0x562899,null));};exports[_0xf285('0x49')]=function(_0x91d3e2,_0x206d25){return db[_0xf285('0x40')]['create'](_0x91d3e2[_0xf285('0x4a')],{})[_0xf285('0x23')](respondWithResult(_0x206d25,0xc9))[_0xf285('0x48')](handleError(_0x206d25,null));};exports[_0xf285('0x4b')]=function(_0x886db4,_0x2c9cc0){if(_0x886db4[_0xf285('0x4a')]['id']){delete _0x886db4[_0xf285('0x4a')]['id'];}return db['Cdr'][_0xf285('0x47')]({'where':{'id':_0x886db4['params']['id']}})[_0xf285('0x23')](handleEntityNotFound(_0x2c9cc0,null))[_0xf285('0x23')](saveUpdates(_0x886db4[_0xf285('0x4a')],null))['then'](respondWithResult(_0x2c9cc0,null))[_0xf285('0x48')](handleError(_0x2c9cc0,null));};exports[_0xf285('0x24')]=function(_0x55db58,_0x419c52){return db[_0xf285('0x40')][_0xf285('0x47')]({'where':{'id':_0x55db58[_0xf285('0x4c')]['id']}})[_0xf285('0x23')](handleEntityNotFound(_0x419c52,null))[_0xf285('0x23')](removeEntity(_0x419c52,null))[_0xf285('0x48')](handleError(_0x419c52,null));};exports[_0xf285('0x4d')]=function(_0x217853,_0x4c4a97){return db['Cdr'][_0xf285('0x4d')]()[_0xf285('0x23')](respondWithResult(_0x4c4a97,null))[_0xf285('0x48')](handleError(_0x4c4a97,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c5fe9b6..a94c7dc 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 _0xedd8=['define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./cdr.attributes','exports'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0xedd8,0x15f));var _0x8edd=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0xedd8[_0xacb1e2];return _0x463815;};'use strict';var _=require(_0x8edd('0x0'));var util=require(_0x8edd('0x1'));var logger=require(_0x8edd('0x2'))(_0x8edd('0x3'));var moment=require(_0x8edd('0x4'));var BPromise=require('bluebird');var rp=require(_0x8edd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8edd('0x6'));var attributes=require(_0x8edd('0x7'));module[_0x8edd('0x8')]=function(_0x4c9b51,_0x28dff0){return _0x4c9b51[_0x8edd('0x9')](_0x8edd('0xa'),attributes,{'tableName':_0x8edd('0xb'),'paranoid':![],'indexes':[{'name':_0x8edd('0xc'),'fields':[_0x8edd('0xc')]},{'name':_0x8edd('0xd'),'fields':[_0x8edd('0xd')]},{'name':_0x8edd('0xe'),'fields':[_0x8edd('0xe')]},{'name':'dst','fields':[_0x8edd('0xf')]},{'name':_0x8edd('0x10'),'fields':[_0x8edd('0x10')]},{'name':_0x8edd('0x11'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0xf5f8=['src','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xf5f8,0x167));var _0x8f5f=function(_0xcd14ea,_0x4e91c2){_0xcd14ea=_0xcd14ea-0x0;var _0x14dd1d=_0xf5f8[_0xcd14ea];return _0x14dd1d;};'use strict';var _=require(_0x8f5f('0x0'));var util=require(_0x8f5f('0x1'));var logger=require(_0x8f5f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8f5f('0x3'));var rp=require(_0x8f5f('0x4'));var fs=require('fs');var path=require(_0x8f5f('0x5'));var rimraf=require(_0x8f5f('0x6'));var config=require(_0x8f5f('0x7'));var attributes=require(_0x8f5f('0x8'));module['exports']=function(_0x4a66b6,_0x1dee34){return _0x4a66b6[_0x8f5f('0x9')]('Cdr',attributes,{'tableName':_0x8f5f('0xa'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x8f5f('0xb')]},{'name':_0x8f5f('0xc'),'fields':[_0x8f5f('0xc')]},{'name':_0x8f5f('0xd'),'fields':['disposition']},{'name':_0x8f5f('0xe'),'fields':[_0x8f5f('0xe')]},{'name':_0x8f5f('0xf'),'fields':['src']},{'name':_0x8f5f('0x10'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a52e50b..420c0b1 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 _0x8f8f=['code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x857c02,_0x3cc0b3){var _0x5bbbab=function(_0x4c7733){while(--_0x4c7733){_0x857c02['push'](_0x857c02['shift']());}};_0x5bbbab(++_0x3cc0b3);}(_0x8f8f,0x1d3));var _0xf8f8=function(_0x35fdbc,_0x1166c0){_0x35fdbc=_0x35fdbc-0x0;var _0x135cd4=_0x8f8f[_0x35fdbc];return _0x135cd4;};'use strict';var _=require(_0xf8f8('0x0'));var util=require(_0xf8f8('0x1'));var moment=require(_0xf8f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8f8('0x3'));var db=require(_0xf8f8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8f8('0x5'))(_0xf8f8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf8f8('0x7')][_0xf8f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47ffa2,_0x265bd1,_0x5941d6){return new BPromise(function(_0x3f5f89,_0xa1471b){return client[_0xf8f8('0x9')](_0x47ffa2,_0x5941d6)[_0xf8f8('0xa')](function(_0xa7de3d){logger[_0xf8f8('0xb')]('Cdr,\x20%s,\x20%s',_0x265bd1,_0xf8f8('0xc'));logger[_0xf8f8('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x265bd1,'request\x20sent',JSON[_0xf8f8('0xe')](_0xa7de3d));if(_0xa7de3d[_0xf8f8('0xf')]){if(_0xa7de3d[_0xf8f8('0xf')][_0xf8f8('0x10')]===0x1f4){logger['error'](_0xf8f8('0x11'),_0x265bd1,_0xa7de3d['error'][_0xf8f8('0x12')]);return _0xa1471b(_0xa7de3d[_0xf8f8('0xf')][_0xf8f8('0x12')]);}logger[_0xf8f8('0xf')](_0xf8f8('0x11'),_0x265bd1,_0xa7de3d['error'][_0xf8f8('0x12')]);return _0x3f5f89(_0xa7de3d[_0xf8f8('0xf')][_0xf8f8('0x12')]);}else{logger[_0xf8f8('0xb')](_0xf8f8('0x11'),_0x265bd1,_0xf8f8('0xc'));_0x3f5f89(_0xa7de3d[_0xf8f8('0x13')]['message']);}})[_0xf8f8('0x14')](function(_0x10ebc9){logger['error'](_0xf8f8('0x11'),_0x265bd1,_0x10ebc9);_0xa1471b(_0x10ebc9);});});} \ No newline at end of file +var _0xe4f3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe4f3,0x132));var _0x3e4f=function(_0x284c3f,_0x546b67){_0x284c3f=_0x284c3f-0x0;var _0x3ca296=_0xe4f3[_0x284c3f];return _0x3ca296;};'use strict';var _=require(_0x3e4f('0x0'));var util=require('util');var moment=require(_0x3e4f('0x1'));var BPromise=require(_0x3e4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e4f('0x3'));var db=require(_0x3e4f('0x4'))['db'];var utils=require(_0x3e4f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e4f('0x6'));var jayson=require(_0x3e4f('0x7'));var client=jayson[_0x3e4f('0x8')][_0x3e4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3101d9,_0x5e6352,_0x73ab1b){return new BPromise(function(_0x308680,_0x51b4dc){return client[_0x3e4f('0xa')](_0x3101d9,_0x73ab1b)['then'](function(_0xb466a0){logger[_0x3e4f('0xb')](_0x3e4f('0xc'),_0x5e6352,_0x3e4f('0xd'));logger[_0x3e4f('0xe')](_0x3e4f('0xf'),_0x5e6352,'request\x20sent',JSON[_0x3e4f('0x10')](_0xb466a0));if(_0xb466a0['error']){if(_0xb466a0[_0x3e4f('0x11')][_0x3e4f('0x12')]===0x1f4){logger[_0x3e4f('0x11')](_0x3e4f('0xc'),_0x5e6352,_0xb466a0[_0x3e4f('0x11')][_0x3e4f('0x13')]);return _0x51b4dc(_0xb466a0['error'][_0x3e4f('0x13')]);}logger[_0x3e4f('0x11')]('Cdr,\x20%s,\x20%s',_0x5e6352,_0xb466a0[_0x3e4f('0x11')][_0x3e4f('0x13')]);return _0x308680(_0xb466a0[_0x3e4f('0x11')][_0x3e4f('0x13')]);}else{logger['info'](_0x3e4f('0xc'),_0x5e6352,_0x3e4f('0xd'));_0x308680(_0xb466a0[_0x3e4f('0x14')][_0x3e4f('0x13')]);}})[_0x3e4f('0x15')](function(_0x4421d4){logger['error'](_0x3e4f('0xc'),_0x5e6352,_0x4421d4);_0x51b4dc(_0x4421d4);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e3f94b7..fb1d317 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 _0x6934=['Router','../../components/auth/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3e50c7,_0x47a089){var _0x5859ae=function(_0x30b362){while(--_0x30b362){_0x3e50c7['push'](_0x3e50c7['shift']());}};_0x5859ae(++_0x47a089);}(_0x6934,0xa8));var _0x4693=function(_0xa13dd5,_0x5369f2){_0xa13dd5=_0xa13dd5-0x0;var _0x182007=_0x6934[_0xa13dd5];return _0x182007;};'use strict';var multer=require(_0x4693('0x0'));var util=require(_0x4693('0x1'));var path=require('path');var timeout=require(_0x4693('0x2'));var express=require('express');var router=express[_0x4693('0x3')]();var auth=require(_0x4693('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4693('0x5'));router[_0x4693('0x6')]('/',auth[_0x4693('0x7')](),controller[_0x4693('0x8')]);router['get'](_0x4693('0x9'),auth[_0x4693('0x7')](),controller[_0x4693('0xa')]);router[_0x4693('0x6')](_0x4693('0xb'),auth[_0x4693('0x7')](),controller[_0x4693('0xc')]);router[_0x4693('0xd')]('/',auth[_0x4693('0x7')](),controller[_0x4693('0xe')]);router['put']('/:id',auth[_0x4693('0x7')](),controller[_0x4693('0xf')]);router[_0x4693('0x10')](_0x4693('0xb'),auth[_0x4693('0x7')](),controller[_0x4693('0x11')]);module[_0x4693('0x12')]=router; \ No newline at end of file +var _0xff57=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','describe','show','create','/:id','update','delete','destroy','multer','util'];(function(_0x56cc3e,_0x48ed5c){var _0x2d9271=function(_0x5ecc0a){while(--_0x5ecc0a){_0x56cc3e['push'](_0x56cc3e['shift']());}};_0x2d9271(++_0x48ed5c);}(_0xff57,0x141));var _0x7ff5=function(_0x3201cd,_0x384776){_0x3201cd=_0x3201cd-0x0;var _0x317977=_0xff57[_0x3201cd];return _0x317977;};'use strict';var multer=require(_0x7ff5('0x0'));var util=require(_0x7ff5('0x1'));var path=require(_0x7ff5('0x2'));var timeout=require(_0x7ff5('0x3'));var express=require('express');var router=express[_0x7ff5('0x4')]();var auth=require(_0x7ff5('0x5'));var interaction=require(_0x7ff5('0x6'));var config=require(_0x7ff5('0x7'));var controller=require(_0x7ff5('0x8'));router[_0x7ff5('0x9')]('/',auth[_0x7ff5('0xa')](),controller[_0x7ff5('0xb')]);router[_0x7ff5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7ff5('0xc')]);router[_0x7ff5('0x9')]('/:id',auth[_0x7ff5('0xa')](),controller[_0x7ff5('0xd')]);router['post']('/',auth[_0x7ff5('0xa')](),controller[_0x7ff5('0xe')]);router['put'](_0x7ff5('0xf'),auth[_0x7ff5('0xa')](),controller[_0x7ff5('0x10')]);router[_0x7ff5('0x11')](_0x7ff5('0xf'),auth[_0x7ff5('0xa')](),controller[_0x7ff5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index fa58917..07342d7 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 _0xf519=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x19a9b5,_0x198382){var _0x632733=function(_0x2b4f07){while(--_0x2b4f07){_0x19a9b5['push'](_0x19a9b5['shift']());}};_0x632733(++_0x198382);}(_0xf519,0xc8));var _0x9f51=function(_0x435fa1,_0x58550a){_0x435fa1=_0x435fa1-0x0;var _0x845f9f=_0xf519[_0x435fa1];return _0x845f9f;};'use strict';var Sequelize=require(_0x9f51('0x0'));module[_0x9f51('0x1')]={'priority':{'type':Sequelize[_0x9f51('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9f51('0x3')],'allowNull':![],'defaultValue':_0x9f51('0x4')},'appdata':{'type':Sequelize[_0x9f51('0x5')]()},'description':{'type':Sequelize[_0x9f51('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9f51('0x6')}}; \ No newline at end of file +var _0x81b7=['*,*,*,*','TEXT','STRING'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x81b7,0x8b));var _0x781b=function(_0x59c6dc,_0x2f43d2){_0x59c6dc=_0x59c6dc-0x0;var _0x3ae1b6=_0x81b7[_0x59c6dc];return _0x3ae1b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x781b('0x0')]()},'description':{'type':Sequelize[_0x781b('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x781b('0x2')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fb1d698..6978225 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 _0x9c56=['send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','find','catch','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','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','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x9c56,0x1e2));var _0x69c5=function(_0x2942f3,_0x5dc71d){_0x2942f3=_0x2942f3-0x0;var _0x5b917e=_0x9c56[_0x2942f3];return _0x5b917e;};'use strict';var pdf=require(_0x69c5('0x0'));var emlformat=require(_0x69c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x69c5('0x2'));var jsonpatch=require(_0x69c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x69c5('0x4'));var Mustache=require('mustache');var util=require(_0x69c5('0x5'));var path=require(_0x69c5('0x6'));var sox=require(_0x69c5('0x7'));var csv=require(_0x69c5('0x8'));var ejs=require(_0x69c5('0x9'));var fs=require('fs');var _=require(_0x69c5('0xa'));var squel=require('squel');var crypto=require(_0x69c5('0xb'));var jsforce=require(_0x69c5('0xc'));var deskjs=require(_0x69c5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69c5('0xe'));var Redis=require(_0x69c5('0xf'));var authService=require(_0x69c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x69c5('0x11'));var hardwareService=require(_0x69c5('0x12'));var logger=require(_0x69c5('0x13'))(_0x69c5('0x14'));var utils=require(_0x69c5('0x15'));var config=require(_0x69c5('0x16'));var db=require(_0x69c5('0x17'))['db'];function respondWithStatusCode(_0x129928,_0x4cdb45){_0x4cdb45=_0x4cdb45||0xcc;return function(_0x41c247){if(_0x41c247){return _0x129928[_0x69c5('0x18')](_0x4cdb45);}return _0x129928[_0x69c5('0x19')](_0x4cdb45)['end']();};}function respondWithResult(_0x19e9ae,_0xf4d42b){_0xf4d42b=_0xf4d42b||0xc8;return function(_0x3e752b){if(_0x3e752b){return _0x19e9ae[_0x69c5('0x19')](_0xf4d42b)[_0x69c5('0x1a')](_0x3e752b);}};}function respondWithFilteredResult(_0x4a2eaa,_0x1f20c8){return function(_0x2453be){if(_0x2453be){var _0x177643=_0x2453be['count'],_0x2c87d6=_0x1f20c8[_0x69c5('0x1b')],_0x486398=_0x1f20c8[_0x69c5('0x1b')]+_0x1f20c8[_0x69c5('0x1c')],_0x453a7d;if(_0x486398>=_0x177643){_0x486398=_0x177643;_0x453a7d=0xc8;}else{_0x453a7d=0xce;}_0x4a2eaa['status'](_0x453a7d);return _0x4a2eaa[_0x69c5('0x1d')](_0x69c5('0x1e'),_0x2c87d6+'-'+_0x486398+'/'+_0x177643)[_0x69c5('0x1a')](_0x2453be);}return null;};}function patchUpdates(_0x15768a){return function(_0x4f8ba4){try{jsonpatch[_0x69c5('0x1f')](_0x4f8ba4,_0x15768a,!![]);}catch(_0x20ef79){return BPromise[_0x69c5('0x20')](_0x20ef79);}return _0x4f8ba4[_0x69c5('0x21')]();};}function saveUpdates(_0x5047dd,_0x5de172){return function(_0x5e6e53){if(_0x5e6e53){return _0x5e6e53[_0x69c5('0x22')](_0x5047dd)[_0x69c5('0x23')](function(_0x4617cf){return _0x4617cf;});}return null;};}function removeEntity(_0x468a4d,_0x277877){return function(_0xf3e19e){if(_0xf3e19e){return _0xf3e19e[_0x69c5('0x24')]()['then'](function(){_0x468a4d[_0x69c5('0x19')](0xcc)[_0x69c5('0x25')]();});}};}function handleEntityNotFound(_0x4aec18,_0x17bbb5){return function(_0x42a407){if(!_0x42a407){_0x4aec18['sendStatus'](0x194);}return _0x42a407;};}function handleError(_0x5ee8bd,_0x495593){_0x495593=_0x495593||0x1f4;return function(_0x458fe1){logger[_0x69c5('0x26')](_0x458fe1['stack']);if(_0x458fe1[_0x69c5('0x27')]){delete _0x458fe1[_0x69c5('0x27')];}_0x5ee8bd[_0x69c5('0x19')](_0x495593)[_0x69c5('0x28')](_0x458fe1);};}exports[_0x69c5('0x29')]=function(_0xbb14d1,_0x2af1df){var _0x5a388a={'raw':!![],'where':{'id':_0xbb14d1['params']['id']}},_0x1d7876={};_0x1d7876[_0x69c5('0x2a')]=_[_0x69c5('0x2b')](db[_0x69c5('0x2c')][_0x69c5('0x2d')]);_0x1d7876[_0x69c5('0x2e')]=_[_0x69c5('0x2b')](_0xbb14d1[_0x69c5('0x2e')]);_0x1d7876[_0x69c5('0x2f')]=_['intersection'](_0x1d7876[_0x69c5('0x2a')],_0x1d7876['query']);_0x5a388a['attributes']=_[_0x69c5('0x30')](_0x1d7876['model'],qs['fields'](_0xbb14d1['query'][_0x69c5('0x31')]));_0x5a388a['attributes']=_0x5a388a[_0x69c5('0x32')][_0x69c5('0x33')]?_0x5a388a[_0x69c5('0x32')]:_0x1d7876[_0x69c5('0x2a')];if(_0xbb14d1[_0x69c5('0x2e')][_0x69c5('0x34')]){_0x5a388a[_0x69c5('0x35')]=[{'all':!![]}];}_0x5a388a=_['merge']({},_0x5a388a,_0xbb14d1['options']);return db['ChatApplication'][_0x69c5('0x36')](_0x5a388a)[_0x69c5('0x23')](handleEntityNotFound(_0x2af1df,null))['then'](respondWithResult(_0x2af1df,null))[_0x69c5('0x37')](handleError(_0x2af1df,null));};exports[_0x69c5('0x22')]=function(_0x5cf408,_0x150966){if(_0x5cf408[_0x69c5('0x38')]['id']){delete _0x5cf408[_0x69c5('0x38')]['id'];}return db[_0x69c5('0x2c')][_0x69c5('0x36')]({'where':{'id':_0x5cf408['params']['id']}})[_0x69c5('0x23')](handleEntityNotFound(_0x150966,null))[_0x69c5('0x23')](saveUpdates(_0x5cf408[_0x69c5('0x38')],null))[_0x69c5('0x23')](respondWithResult(_0x150966,null))[_0x69c5('0x37')](handleError(_0x150966,null));};exports[_0x69c5('0x24')]=function(_0x1070c7,_0x3f07d0){return db['ChatApplication'][_0x69c5('0x36')]({'where':{'id':_0x1070c7[_0x69c5('0x39')]['id']}})[_0x69c5('0x23')](handleEntityNotFound(_0x3f07d0,null))[_0x69c5('0x23')](removeEntity(_0x3f07d0,null))[_0x69c5('0x37')](handleError(_0x3f07d0,null));}; \ No newline at end of file +var _0x22eb=['error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','then','destroy'];(function(_0x3a165c,_0x3937c8){var _0x3b02f7=function(_0x1513f6){while(--_0x1513f6){_0x3a165c['push'](_0x3a165c['shift']());}};_0x3b02f7(++_0x3937c8);}(_0x22eb,0x1ea));var _0xb22e=function(_0x5c4bc7,_0x5a1bb7){_0x5c4bc7=_0x5c4bc7-0x0;var _0x41f338=_0x22eb[_0x5c4bc7];return _0x41f338;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb22e('0x0'));var rimraf=require(_0xb22e('0x1'));var zipdir=require(_0xb22e('0x2'));var jsonpatch=require(_0xb22e('0x3'));var rp=require(_0xb22e('0x4'));var moment=require('moment');var BPromise=require(_0xb22e('0x5'));var Mustache=require(_0xb22e('0x6'));var util=require(_0xb22e('0x7'));var path=require('path');var sox=require(_0xb22e('0x8'));var csv=require(_0xb22e('0x9'));var ejs=require(_0xb22e('0xa'));var fs=require('fs');var _=require(_0xb22e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb22e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb22e('0x9'));var querystring=require(_0xb22e('0xd'));var Papa=require(_0xb22e('0xe'));var Redis=require(_0xb22e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb22e('0x10'));var as=require(_0xb22e('0x11'));var hardwareService=require(_0xb22e('0x12'));var logger=require(_0xb22e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb22e('0x14'))['db'];function respondWithStatusCode(_0x1858f4,_0x44457a){_0x44457a=_0x44457a||0xcc;return function(_0x168f81){if(_0x168f81){return _0x1858f4[_0xb22e('0x15')](_0x44457a);}return _0x1858f4[_0xb22e('0x16')](_0x44457a)[_0xb22e('0x17')]();};}function respondWithResult(_0x3f36ea,_0x44b684){_0x44b684=_0x44b684||0xc8;return function(_0x3a3623){if(_0x3a3623){return _0x3f36ea['status'](_0x44b684)[_0xb22e('0x18')](_0x3a3623);}};}function respondWithFilteredResult(_0x4a00ab,_0x5f5cae){return function(_0xe69a5e){if(_0xe69a5e){var _0x336dee=_0xe69a5e['count'],_0x18aa9c=_0x5f5cae[_0xb22e('0x19')],_0x4ef6fb=_0x5f5cae[_0xb22e('0x19')]+_0x5f5cae['limit'],_0x53ad37;if(_0x4ef6fb>=_0x336dee){_0x4ef6fb=_0x336dee;_0x53ad37=0xc8;}else{_0x53ad37=0xce;}_0x4a00ab[_0xb22e('0x16')](_0x53ad37);return _0x4a00ab['set'](_0xb22e('0x1a'),_0x18aa9c+'-'+_0x4ef6fb+'/'+_0x336dee)[_0xb22e('0x18')](_0xe69a5e);}return null;};}function patchUpdates(_0x5c728c){return function(_0x54e433){try{jsonpatch[_0xb22e('0x1b')](_0x54e433,_0x5c728c,!![]);}catch(_0x18abb5){return BPromise['reject'](_0x18abb5);}return _0x54e433['save']();};}function saveUpdates(_0x4235f4,_0x2fc2e3){return function(_0x527868){if(_0x527868){return _0x527868['update'](_0x4235f4)[_0xb22e('0x1c')](function(_0x11e8b8){return _0x11e8b8;});}return null;};}function removeEntity(_0xd008dd,_0x2622f4){return function(_0x3d2cde){if(_0x3d2cde){return _0x3d2cde[_0xb22e('0x1d')]()['then'](function(){_0xd008dd[_0xb22e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ce41,_0x6a0756){return function(_0x338749){if(!_0x338749){_0x26ce41[_0xb22e('0x15')](0x194);}return _0x338749;};}function handleError(_0x15a30c,_0x16aa8f){_0x16aa8f=_0x16aa8f||0x1f4;return function(_0x43eef4){logger[_0xb22e('0x1e')](_0x43eef4[_0xb22e('0x1f')]);if(_0x43eef4[_0xb22e('0x20')]){delete _0x43eef4[_0xb22e('0x20')];}_0x15a30c[_0xb22e('0x16')](_0x16aa8f)[_0xb22e('0x21')](_0x43eef4);};}exports[_0xb22e('0x22')]=function(_0x16cffe,_0x2657a3){var _0x12dec7={'raw':!![],'where':{'id':_0x16cffe[_0xb22e('0x23')]['id']}},_0x504d0f={};_0x504d0f[_0xb22e('0x24')]=_[_0xb22e('0x25')](db[_0xb22e('0x26')][_0xb22e('0x27')]);_0x504d0f[_0xb22e('0x28')]=_[_0xb22e('0x25')](_0x16cffe[_0xb22e('0x28')]);_0x504d0f['filters']=_[_0xb22e('0x29')](_0x504d0f[_0xb22e('0x24')],_0x504d0f['query']);_0x12dec7[_0xb22e('0x2a')]=_[_0xb22e('0x29')](_0x504d0f[_0xb22e('0x24')],qs[_0xb22e('0x2b')](_0x16cffe['query']['fields']));_0x12dec7[_0xb22e('0x2a')]=_0x12dec7['attributes'][_0xb22e('0x2c')]?_0x12dec7[_0xb22e('0x2a')]:_0x504d0f['model'];if(_0x16cffe[_0xb22e('0x28')][_0xb22e('0x2d')]){_0x12dec7[_0xb22e('0x2e')]=[{'all':!![]}];}_0x12dec7=_[_0xb22e('0x2f')]({},_0x12dec7,_0x16cffe['options']);return db['ChatApplication'][_0xb22e('0x30')](_0x12dec7)[_0xb22e('0x1c')](handleEntityNotFound(_0x2657a3,null))[_0xb22e('0x1c')](respondWithResult(_0x2657a3,null))[_0xb22e('0x31')](handleError(_0x2657a3,null));};exports[_0xb22e('0x32')]=function(_0x20b217,_0x1d6163){if(_0x20b217[_0xb22e('0x33')]['id']){delete _0x20b217[_0xb22e('0x33')]['id'];}return db[_0xb22e('0x26')]['find']({'where':{'id':_0x20b217[_0xb22e('0x23')]['id']}})[_0xb22e('0x1c')](handleEntityNotFound(_0x1d6163,null))[_0xb22e('0x1c')](saveUpdates(_0x20b217['body'],null))[_0xb22e('0x1c')](respondWithResult(_0x1d6163,null))['catch'](handleError(_0x1d6163,null));};exports[_0xb22e('0x1d')]=function(_0x39dbfa,_0x4cee73){return db[_0xb22e('0x26')][_0xb22e('0x30')]({'where':{'id':_0x39dbfa['params']['id']}})[_0xb22e('0x1c')](handleEntityNotFound(_0x4cee73,null))[_0xb22e('0x1c')](removeEntity(_0x4cee73,null))[_0xb22e('0x31')](handleError(_0x4cee73,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2e9d408..a34514c 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 _0xb008=['utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','./chatApplication.attributes','exports','ChatApplication','utf8mb4'];(function(_0x7c6a0b,_0xc7cba){var _0x4e4381=function(_0x24f13b){while(--_0x24f13b){_0x7c6a0b['push'](_0x7c6a0b['shift']());}};_0x4e4381(++_0xc7cba);}(_0xb008,0xe8));var _0x8b00=function(_0x267a37,_0x1b0a75){_0x267a37=_0x267a37-0x0;var _0x103e48=_0xb008[_0x267a37];return _0x103e48;};'use strict';var _=require(_0x8b00('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8b00('0x1'));var moment=require(_0x8b00('0x2'));var BPromise=require('bluebird');var rp=require(_0x8b00('0x3'));var fs=require('fs');var path=require(_0x8b00('0x4'));var rimraf=require(_0x8b00('0x5'));var config=require('../../config/environment');var attributes=require(_0x8b00('0x6'));module[_0x8b00('0x7')]=function(_0x3282d5,_0xa15fa6){return _0x3282d5['define'](_0x8b00('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b00('0x9'),'collate':_0x8b00('0xa')});}; \ No newline at end of file +var _0x6882=['ChatApplication','utf8mb4','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x6882,0x84));var _0x2688=function(_0x11cb08,_0x5cf001){_0x11cb08=_0x11cb08-0x0;var _0x3499cf=_0x6882[_0x11cb08];return _0x3499cf;};'use strict';var _=require(_0x2688('0x0'));var util=require(_0x2688('0x1'));var logger=require(_0x2688('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2688('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2688('0x4'));var rimraf=require(_0x2688('0x5'));var config=require(_0x2688('0x6'));var attributes=require(_0x2688('0x7'));module['exports']=function(_0x4f8881,_0x5cb8a8){return _0x4f8881['define'](_0x2688('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2688('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4c0d352..dd6468b 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 _0x162b=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0x162b,0xf4));var _0xb162=function(_0xd723,_0x164010){_0xd723=_0xd723-0x0;var _0x5179d2=_0x162b[_0xd723];return _0x5179d2;};'use strict';var _=require(_0xb162('0x0'));var util=require('util');var moment=require(_0xb162('0x1'));var BPromise=require(_0xb162('0x2'));var rs=require(_0xb162('0x3'));var fs=require('fs');var Redis=require(_0xb162('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb162('0x5'));var logger=require(_0xb162('0x6'))('rpc');var config=require(_0xb162('0x7'));var jayson=require(_0xb162('0x8'));var client=jayson[_0xb162('0x9')][_0xb162('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dfcd6,_0x98ddab,_0x1ff80b){return new BPromise(function(_0x59111d,_0x1e0975){return client['request'](_0x3dfcd6,_0x1ff80b)[_0xb162('0xb')](function(_0x49a4f5){logger[_0xb162('0xc')](_0xb162('0xd'),_0x98ddab,_0xb162('0xe'));logger[_0xb162('0xf')](_0xb162('0x10'),_0x98ddab,'request\x20sent',JSON[_0xb162('0x11')](_0x49a4f5));if(_0x49a4f5[_0xb162('0x12')]){if(_0x49a4f5[_0xb162('0x12')]['code']===0x1f4){logger[_0xb162('0x12')]('ChatApplication,\x20%s,\x20%s',_0x98ddab,_0x49a4f5[_0xb162('0x12')]['message']);return _0x1e0975(_0x49a4f5[_0xb162('0x12')][_0xb162('0x13')]);}logger[_0xb162('0x12')]('ChatApplication,\x20%s,\x20%s',_0x98ddab,_0x49a4f5[_0xb162('0x12')][_0xb162('0x13')]);return _0x59111d(_0x49a4f5[_0xb162('0x12')][_0xb162('0x13')]);}else{logger[_0xb162('0xc')]('ChatApplication,\x20%s,\x20%s',_0x98ddab,_0xb162('0xe'));_0x59111d(_0x49a4f5[_0xb162('0x14')][_0xb162('0x13')]);}})[_0xb162('0x15')](function(_0x2325a4){logger[_0xb162('0x12')](_0xb162('0xd'),_0x98ddab,_0x2325a4);_0x1e0975(_0x2325a4);});});} \ No newline at end of file +var _0x875c=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','result','message'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x875c,0x1e4));var _0xc875=function(_0xc477bc,_0x5ae871){_0xc477bc=_0xc477bc-0x0;var _0x28f64e=_0x875c[_0xc477bc];return _0x28f64e;};'use strict';var _=require('lodash');var util=require(_0xc875('0x0'));var moment=require(_0xc875('0x1'));var BPromise=require(_0xc875('0x2'));var rs=require(_0xc875('0x3'));var fs=require('fs');var Redis=require(_0xc875('0x4'));var db=require(_0xc875('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc875('0x6'))('rpc');var config=require(_0xc875('0x7'));var jayson=require(_0xc875('0x8'));var client=jayson[_0xc875('0x9')][_0xc875('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19f11a,_0x178d16,_0x4191fc){return new BPromise(function(_0x43590a,_0x272344){return client[_0xc875('0xb')](_0x19f11a,_0x4191fc)[_0xc875('0xc')](function(_0x21323c){logger[_0xc875('0xd')](_0xc875('0xe'),_0x178d16,_0xc875('0xf'));logger[_0xc875('0x10')](_0xc875('0x11'),_0x178d16,_0xc875('0xf'),JSON['stringify'](_0x21323c));if(_0x21323c[_0xc875('0x12')]){if(_0x21323c[_0xc875('0x12')][_0xc875('0x13')]===0x1f4){logger[_0xc875('0x12')](_0xc875('0xe'),_0x178d16,_0x21323c['error']['message']);return _0x272344(_0x21323c[_0xc875('0x12')]['message']);}logger[_0xc875('0x12')]('ChatApplication,\x20%s,\x20%s',_0x178d16,_0x21323c[_0xc875('0x12')]['message']);return _0x43590a(_0x21323c[_0xc875('0x12')]['message']);}else{logger[_0xc875('0xd')]('ChatApplication,\x20%s,\x20%s',_0x178d16,_0xc875('0xf'));_0x43590a(_0x21323c[_0xc875('0x14')][_0xc875('0x15')]);}})[_0xc875('0x16')](function(_0x3e5fa){logger[_0xc875('0x12')](_0xc875('0xe'),_0x178d16,_0x3e5fa);_0x272344(_0x3e5fa);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a82e5c0..8383707 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 _0x4178=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x76c5c7,_0x3feb64){var _0x323ba9=function(_0x52a05f){while(--_0x52a05f){_0x76c5c7['push'](_0x76c5c7['shift']());}};_0x323ba9(++_0x3feb64);}(_0x4178,0x1bb));var _0x8417=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4178[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require(_0x8417('0x0'));var path=require(_0x8417('0x1'));var timeout=require(_0x8417('0x2'));var express=require('express');var router=express[_0x8417('0x3')]();var auth=require(_0x8417('0x4'));var interaction=require(_0x8417('0x5'));var config=require(_0x8417('0x6'));var controller=require(_0x8417('0x7'));router[_0x8417('0x8')](_0x8417('0x9'),auth[_0x8417('0xa')](),controller['show']);router[_0x8417('0xb')](_0x8417('0x9'),auth['isAuthenticated'](),controller[_0x8417('0xc')]);router[_0x8417('0xd')](_0x8417('0x9'),auth['isAuthenticated'](),controller[_0x8417('0xe')]);module[_0x8417('0xf')]=router; \ No newline at end of file +var _0x4798=['isAuthenticated','put','update','delete','/:id','multer','path','connect-timeout','Router','../../components/auth/service','./chatApplication.controller','get'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x4798,0xb9));var _0x8479=function(_0x3ad497,_0x1285d3){_0x3ad497=_0x3ad497-0x0;var _0x39a541=_0x4798[_0x3ad497];return _0x39a541;};'use strict';var multer=require(_0x8479('0x0'));var util=require('util');var path=require(_0x8479('0x1'));var timeout=require(_0x8479('0x2'));var express=require('express');var router=express[_0x8479('0x3')]();var auth=require(_0x8479('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8479('0x5'));router[_0x8479('0x6')]('/:id',auth[_0x8479('0x7')](),controller['show']);router[_0x8479('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8479('0x9')]);router[_0x8479('0xa')](_0x8479('0xb'),auth[_0x8479('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index de82dff..5d1c976 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 _0xcb2a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x262f44,_0x3847ba){var _0x33b27c=function(_0x5db154){while(--_0x5db154){_0x262f44['push'](_0x262f44['shift']());}};_0x33b27c(++_0x3847ba);}(_0xcb2a,0xd5));var _0xacb2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcb2a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xacb2('0x0'));module[_0xacb2('0x1')]={'name':{'type':Sequelize[_0xacb2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xacb2('0x2')]},'write':{'type':Sequelize[_0xacb2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6a74=['STRING','BOOLEAN','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6a74,0x164));var _0x46a7=function(_0xff10b2,_0x31dc20){_0xff10b2=_0xff10b2-0x0;var _0x47eca5=_0x6a74[_0xff10b2];return _0x47eca5;};'use strict';var Sequelize=require(_0x46a7('0x0'));module['exports']={'name':{'type':Sequelize[_0x46a7('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x46a7('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 68d8f27..1c2b04a 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 _0x3bc0=['addMembers','ids','omit','getMembers','findOne','rawAttributes','hasOwnProperty','removeMembers','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','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./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','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','filters','query','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','keys','intersection','fields','length','includeAll','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0x3bc0,0xfa));var _0x03bc=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x3bc0[_0xe73080];return _0x12cbc4;};'use strict';var pdf=require(_0x03bc('0x0'));var emlformat=require(_0x03bc('0x1'));var rimraf=require(_0x03bc('0x2'));var zipdir=require(_0x03bc('0x3'));var jsonpatch=require(_0x03bc('0x4'));var rp=require(_0x03bc('0x5'));var moment=require(_0x03bc('0x6'));var BPromise=require(_0x03bc('0x7'));var Mustache=require(_0x03bc('0x8'));var util=require('util');var path=require(_0x03bc('0x9'));var sox=require(_0x03bc('0xa'));var csv=require(_0x03bc('0xb'));var ejs=require(_0x03bc('0xc'));var fs=require('fs');var _=require(_0x03bc('0xd'));var squel=require(_0x03bc('0xe'));var crypto=require(_0x03bc('0xf'));var jsforce=require(_0x03bc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x03bc('0xb'));var querystring=require(_0x03bc('0x11'));var Papa=require(_0x03bc('0x12'));var Redis=require(_0x03bc('0x13'));var authService=require(_0x03bc('0x14'));var qs=require(_0x03bc('0x15'));var as=require(_0x03bc('0x16'));var hardwareService=require(_0x03bc('0x17'));var logger=require('../../config/logger')(_0x03bc('0x18'));var utils=require(_0x03bc('0x19'));var config=require(_0x03bc('0x1a'));var db=require('../../mysqldb')['db'];config[_0x03bc('0x1b')]=_[_0x03bc('0x1c')](config['redis'],{'host':_0x03bc('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03bc('0x1b')]));require(_0x03bc('0x1e'))[_0x03bc('0x1f')](socket);var jayson=require(_0x03bc('0x20'));var client=jayson[_0x03bc('0x21')][_0x03bc('0x22')]({'port':0x232a});function checkPasswordPattern(_0x53fc30,_0x2b0cc7,_0x258d15){if(_0x258d15){var _0x3246d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3246d5[_0x03bc('0x23')](_0x2b0cc7)){return _0x53fc30;}else{throw new db[(_0x03bc('0x24'))][(_0x03bc('0x25'))](_0x03bc('0x26'));}}else{return _0x53fc30;}}function respondWithRpcPromise(_0x2b7630,_0x313426,_0x477ad9,_0x2b13d8){return new BPromise(function(_0x180e9e,_0xb318df){var _0x45bd33=_0x2b13d8||client;return _0x45bd33[_0x03bc('0x27')](_0x2b7630,_0x477ad9)[_0x03bc('0x28')](function(_0x3b2986){logger[_0x03bc('0x29')](_0x03bc('0x2a'),_0x313426,'request\x20sent');logger[_0x03bc('0x2b')](_0x03bc('0x2c'),_0x313426,'request\x20sent',JSON['stringify'](_0x3b2986));if(_0x3b2986[_0x03bc('0x2d')]){if(_0x3b2986[_0x03bc('0x2d')][_0x03bc('0x2e')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x313426,_0x3b2986[_0x03bc('0x2d')]['message']);return _0xb318df(_0x3b2986[_0x03bc('0x2d')][_0x03bc('0x2f')]);}logger[_0x03bc('0x2d')](_0x03bc('0x2a'),_0x313426,_0x3b2986[_0x03bc('0x2d')][_0x03bc('0x2f')]);return _0x180e9e(_0x3b2986[_0x03bc('0x2d')]['message']);}else{logger[_0x03bc('0x29')](_0x03bc('0x2a'),_0x313426,_0x03bc('0x30'));_0x180e9e(_0x3b2986[_0x03bc('0x31')][_0x03bc('0x2f')]);}})[_0x03bc('0x32')](function(_0x209418){logger[_0x03bc('0x2d')](_0x03bc('0x2a'),_0x313426,_0x209418);_0xb318df(_0x209418);});});}function respondWithStatusCode(_0x43d323,_0x58abae){_0x58abae=_0x58abae||0xcc;return function(_0x3227ad){if(_0x3227ad){return _0x43d323[_0x03bc('0x33')](_0x58abae);}return _0x43d323[_0x03bc('0x34')](_0x58abae)[_0x03bc('0x35')]();};}function respondWithResult(_0x52d78d,_0x3e3db8){_0x3e3db8=_0x3e3db8||0xc8;return function(_0x4eadc3){if(_0x4eadc3){return _0x52d78d[_0x03bc('0x34')](_0x3e3db8)[_0x03bc('0x36')](_0x4eadc3);}};}function respondWithFilteredResult(_0x4dd7dd,_0x42b7b8){return function(_0x174d02){if(_0x174d02){var _0x27b579=_0x174d02[_0x03bc('0x37')],_0x583930=_0x42b7b8[_0x03bc('0x38')],_0x165fb9=_0x42b7b8[_0x03bc('0x38')]+_0x42b7b8[_0x03bc('0x39')],_0x353598;if(_0x165fb9>=_0x27b579){_0x165fb9=_0x27b579;_0x353598=0xc8;}else{_0x353598=0xce;}_0x4dd7dd[_0x03bc('0x34')](_0x353598);return _0x4dd7dd[_0x03bc('0x3a')](_0x03bc('0x3b'),_0x583930+'-'+_0x165fb9+'/'+_0x27b579)[_0x03bc('0x36')](_0x174d02);}return null;};}function patchUpdates(_0x4beac4){return function(_0x47725d){try{jsonpatch[_0x03bc('0x3c')](_0x47725d,_0x4beac4,!![]);}catch(_0x49a2f1){return BPromise[_0x03bc('0x3d')](_0x49a2f1);}return _0x47725d[_0x03bc('0x3e')]();};}function saveUpdates(_0x22bf4b,_0x30c76f){return function(_0x33eed0){if(_0x33eed0){return _0x33eed0[_0x03bc('0x3f')](_0x22bf4b)[_0x03bc('0x28')](function(_0x47e019){return _0x47e019;});}return null;};}function removeEntity(_0x4208ed,_0x529d03){return function(_0x4df32c){if(_0x4df32c){return _0x4df32c[_0x03bc('0x40')]()[_0x03bc('0x28')](function(){_0x4208ed[_0x03bc('0x34')](0xcc)[_0x03bc('0x35')]();});}};}function handleEntityNotFound(_0x3183e7,_0x59866f){return function(_0x5a4463){if(!_0x5a4463){_0x3183e7[_0x03bc('0x33')](0x194);}return _0x5a4463;};}function handleError(_0x1c01a5,_0x14e9c3){_0x14e9c3=_0x14e9c3||0x1f4;return function(_0x30f6ab){logger[_0x03bc('0x2d')](_0x30f6ab[_0x03bc('0x41')]);if(_0x30f6ab['name']){delete _0x30f6ab[_0x03bc('0x42')];}_0x1c01a5[_0x03bc('0x34')](_0x14e9c3)[_0x03bc('0x43')](_0x30f6ab);};}exports[_0x03bc('0x44')]=function(_0x126791,_0x33bc1e){var _0x2f3beb={},_0x53aa34={},_0x7272b4={'count':0x0,'rows':[]};var _0x91e6eb=_[_0x03bc('0x45')](db[_0x03bc('0x46')]['rawAttributes'],function(_0x190dbe){return{'name':_0x190dbe[_0x03bc('0x47')],'type':_0x190dbe[_0x03bc('0x48')][_0x03bc('0x49')]};});_0x53aa34[_0x03bc('0x4a')]=_['map'](_0x91e6eb,_0x03bc('0x42'));_0x53aa34['query']=_['keys'](_0x126791['query']);_0x53aa34[_0x03bc('0x4b')]=_['intersection'](_0x53aa34['model'],_0x53aa34[_0x03bc('0x4c')]);_0x2f3beb[_0x03bc('0x4d')]=_['intersection'](_0x53aa34[_0x03bc('0x4a')],qs['fields'](_0x126791['query']['fields']));_0x2f3beb[_0x03bc('0x4d')]=_0x2f3beb[_0x03bc('0x4d')]['length']?_0x2f3beb[_0x03bc('0x4d')]:_0x53aa34[_0x03bc('0x4a')];if(!_0x126791[_0x03bc('0x4c')]['hasOwnProperty'](_0x03bc('0x4e'))){_0x2f3beb[_0x03bc('0x39')]=qs[_0x03bc('0x39')](_0x126791[_0x03bc('0x4c')][_0x03bc('0x39')]);_0x2f3beb[_0x03bc('0x38')]=qs[_0x03bc('0x38')](_0x126791[_0x03bc('0x4c')][_0x03bc('0x38')]);}_0x2f3beb[_0x03bc('0x4f')]=qs['sort'](_0x126791['query'][_0x03bc('0x50')]);_0x2f3beb[_0x03bc('0x51')]=qs[_0x03bc('0x4b')](_[_0x03bc('0x52')](_0x126791[_0x03bc('0x4c')],_0x53aa34['filters']),_0x91e6eb);if(_0x126791[_0x03bc('0x4c')][_0x03bc('0x53')]){_0x2f3beb[_0x03bc('0x51')]=_['merge'](_0x2f3beb[_0x03bc('0x51')],{'$or':_['map'](_0x91e6eb,function(_0x5c55ee){if(_0x5c55ee[_0x03bc('0x48')]!==_0x03bc('0x54')){var _0xce9849={};_0xce9849[_0x5c55ee[_0x03bc('0x42')]]={'$like':'%'+_0x126791[_0x03bc('0x4c')][_0x03bc('0x53')]+'%'};return _0xce9849;}})});}_0x2f3beb=_[_0x03bc('0x55')]({},_0x2f3beb,_0x126791[_0x03bc('0x56')]);var _0x561e59={'where':_0x2f3beb['where']};return db[_0x03bc('0x46')]['count'](_0x561e59)[_0x03bc('0x28')](function(_0x3c1686){_0x7272b4['count']=_0x3c1686;if(_0x126791[_0x03bc('0x4c')]['includeAll']){_0x2f3beb[_0x03bc('0x57')]=[{'all':!![]}];}return db[_0x03bc('0x46')]['findAll'](_0x2f3beb);})[_0x03bc('0x28')](function(_0x425152){_0x7272b4[_0x03bc('0x58')]=_0x425152;return _0x7272b4;})[_0x03bc('0x28')](respondWithFilteredResult(_0x33bc1e,_0x2f3beb))[_0x03bc('0x32')](handleError(_0x33bc1e,null));};exports[_0x03bc('0x59')]=function(_0x48bbe9,_0x2581d7){var _0xb7b5db={'raw':!![],'where':{'id':_0x48bbe9[_0x03bc('0x5a')]['id']}},_0x27e5f9={};_0x27e5f9['model']=_[_0x03bc('0x5b')](db[_0x03bc('0x46')]['rawAttributes']);_0x27e5f9[_0x03bc('0x4c')]=_[_0x03bc('0x5b')](_0x48bbe9[_0x03bc('0x4c')]);_0x27e5f9[_0x03bc('0x4b')]=_[_0x03bc('0x5c')](_0x27e5f9[_0x03bc('0x4a')],_0x27e5f9['query']);_0xb7b5db[_0x03bc('0x4d')]=_['intersection'](_0x27e5f9[_0x03bc('0x4a')],qs[_0x03bc('0x5d')](_0x48bbe9[_0x03bc('0x4c')]['fields']));_0xb7b5db[_0x03bc('0x4d')]=_0xb7b5db[_0x03bc('0x4d')][_0x03bc('0x5e')]?_0xb7b5db[_0x03bc('0x4d')]:_0x27e5f9[_0x03bc('0x4a')];if(_0x48bbe9[_0x03bc('0x4c')][_0x03bc('0x5f')]){_0xb7b5db[_0x03bc('0x57')]=[{'all':!![]}];}_0xb7b5db=_[_0x03bc('0x55')]({},_0xb7b5db,_0x48bbe9[_0x03bc('0x56')]);return db[_0x03bc('0x46')]['find'](_0xb7b5db)['then'](handleEntityNotFound(_0x2581d7,null))[_0x03bc('0x28')](respondWithResult(_0x2581d7,null))[_0x03bc('0x32')](handleError(_0x2581d7,null));};exports[_0x03bc('0x60')]=function(_0x207115,_0x46ee49){return db['ChatGroup'][_0x03bc('0x60')](_0x207115['body'],{})[_0x03bc('0x28')](respondWithResult(_0x46ee49,0xc9))[_0x03bc('0x32')](handleError(_0x46ee49,null));};exports[_0x03bc('0x3f')]=function(_0x2cfc3c,_0x42d539){if(_0x2cfc3c['body']['id']){delete _0x2cfc3c[_0x03bc('0x61')]['id'];}return db[_0x03bc('0x46')]['find']({'where':{'id':_0x2cfc3c['params']['id']}})[_0x03bc('0x28')](handleEntityNotFound(_0x42d539,null))[_0x03bc('0x28')](saveUpdates(_0x2cfc3c[_0x03bc('0x61')],null))[_0x03bc('0x28')](respondWithResult(_0x42d539,null))[_0x03bc('0x32')](handleError(_0x42d539,null));};exports['destroy']=function(_0x4c2d2a,_0x4bf257){return db[_0x03bc('0x46')][_0x03bc('0x62')]({'where':{'id':_0x4c2d2a['params']['id']}})[_0x03bc('0x28')](handleEntityNotFound(_0x4bf257,null))[_0x03bc('0x28')](removeEntity(_0x4bf257,null))['catch'](handleError(_0x4bf257,null));};exports[_0x03bc('0x63')]=function(_0x559dcc,_0x1610c5){return db['ChatGroup'][_0x03bc('0x63')]()['then'](respondWithResult(_0x1610c5,null))[_0x03bc('0x32')](handleError(_0x1610c5,null));};exports[_0x03bc('0x64')]=function(_0x23e341,_0x6cb0c,_0x4e1159){return db[_0x03bc('0x65')][_0x03bc('0x37')]({'where':{'ChatGroupId':_0x23e341['params']['id'],'ToId':_0x23e341[_0x03bc('0x66')]['id'],'read':![]}})[_0x03bc('0x28')](function(_0x1ab6f4){return{'id':_[_0x03bc('0x67')](_0x23e341['params']['id']),'count':_0x1ab6f4};})['then'](respondWithResult(_0x6cb0c,null))[_0x03bc('0x32')](handleError(_0x6cb0c,null));};exports[_0x03bc('0x68')]=function(_0x4220ab,_0x25165d,_0x3ce7eb){return db[_0x03bc('0x46')][_0x03bc('0x62')]({'where':{'id':_0x4220ab[_0x03bc('0x5a')]['id']}})[_0x03bc('0x28')](handleEntityNotFound(_0x25165d,null))['then'](function(_0x2fa6ff){if(_0x2fa6ff){return _0x2fa6ff[_0x03bc('0x68')](_0x4220ab[_0x03bc('0x61')][_0x03bc('0x69')],_[_0x03bc('0x6a')](_0x4220ab[_0x03bc('0x61')],[_0x03bc('0x69'),'id'])||{});}})[_0x03bc('0x28')](respondWithResult(_0x25165d,null))[_0x03bc('0x32')](handleError(_0x25165d,null));};exports[_0x03bc('0x6b')]=function(_0x13b8d5,_0x38215d,_0x3a5593){var _0x5629e5={};var _0x4eb342={};var _0x4d1619;var _0x57dc95;return db[_0x03bc('0x46')][_0x03bc('0x6c')]({'where':{'id':_0x13b8d5[_0x03bc('0x5a')]['id']}})[_0x03bc('0x28')](handleEntityNotFound(_0x38215d,null))[_0x03bc('0x28')](function(_0x21e505){if(_0x21e505){_0x4d1619=_0x21e505;_0x4eb342[_0x03bc('0x4a')]=_[_0x03bc('0x5b')](db['User'][_0x03bc('0x6d')]);_0x4eb342[_0x03bc('0x4c')]=_[_0x03bc('0x5b')](_0x13b8d5[_0x03bc('0x4c')]);_0x4eb342[_0x03bc('0x4b')]=_[_0x03bc('0x5c')](_0x4eb342[_0x03bc('0x4a')],_0x4eb342[_0x03bc('0x4c')]);_0x5629e5[_0x03bc('0x4d')]=_[_0x03bc('0x5c')](_0x4eb342[_0x03bc('0x4a')],qs[_0x03bc('0x5d')](_0x13b8d5[_0x03bc('0x4c')][_0x03bc('0x5d')]));_0x5629e5[_0x03bc('0x4d')]=_0x5629e5[_0x03bc('0x4d')][_0x03bc('0x5e')]?_0x5629e5['attributes']:_0x4eb342[_0x03bc('0x4a')];_0x5629e5['order']=qs[_0x03bc('0x50')](_0x13b8d5['query']['sort']);_0x5629e5['where']=qs[_0x03bc('0x4b')](_[_0x03bc('0x52')](_0x13b8d5[_0x03bc('0x4c')],_0x4eb342[_0x03bc('0x4b')]));if(_0x13b8d5[_0x03bc('0x4c')][_0x03bc('0x53')]){_0x5629e5[_0x03bc('0x51')]=_[_0x03bc('0x55')](_0x5629e5['where'],{'$or':_[_0x03bc('0x45')](_0x5629e5['attributes'],function(_0x1c1b03){var _0x7af100={};_0x7af100[_0x1c1b03]={'$like':'%'+_0x13b8d5[_0x03bc('0x4c')][_0x03bc('0x53')]+'%'};return _0x7af100;})});}_0x5629e5=_[_0x03bc('0x55')]({},_0x5629e5,_0x13b8d5[_0x03bc('0x56')]);return _0x4d1619[_0x03bc('0x6b')](_0x5629e5);}})[_0x03bc('0x28')](function(_0x4b997d){if(_0x4b997d){_0x57dc95=_0x4b997d[_0x03bc('0x5e')];if(!_0x13b8d5[_0x03bc('0x4c')][_0x03bc('0x6e')]('nolimit')){_0x5629e5[_0x03bc('0x39')]=qs[_0x03bc('0x39')](_0x13b8d5['query'][_0x03bc('0x39')]);_0x5629e5[_0x03bc('0x38')]=qs['offset'](_0x13b8d5['query'][_0x03bc('0x38')]);}return _0x4d1619[_0x03bc('0x6b')](_0x5629e5);}})[_0x03bc('0x28')](function(_0x4c1cea){if(_0x4c1cea){return _0x4c1cea?{'count':_0x57dc95,'rows':_0x4c1cea}:null;}})['then'](respondWithResult(_0x38215d,null))[_0x03bc('0x32')](handleError(_0x38215d,null));};exports[_0x03bc('0x6f')]=function(_0x62d3b0,_0x2c8753,_0x26b4bb){return db[_0x03bc('0x46')]['find']({'where':{'id':_0x62d3b0[_0x03bc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2c8753,null))['then'](function(_0x28eed7){if(_0x28eed7){return _0x28eed7[_0x03bc('0x6f')](_0x62d3b0[_0x03bc('0x4c')][_0x03bc('0x69')]);}})[_0x03bc('0x28')](respondWithStatusCode(_0x2c8753,null))['catch'](handleError(_0x2c8753,null));};exports['addMessage']=function(_0x2a6c68,_0x29f6c8,_0xeacfbd){if(_0x2a6c68[_0x03bc('0x61')]['id']){delete _0x2a6c68[_0x03bc('0x61')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2a6c68['params']['id']}})[_0x03bc('0x28')](handleEntityNotFound(_0x29f6c8,null))[_0x03bc('0x28')](function(_0xec0634){if(_0xec0634){_0x2a6c68[_0x03bc('0x61')][_0x03bc('0x70')]=_0xec0634['id'];return db[_0x03bc('0x65')][_0x03bc('0x60')](_0x2a6c68['body']);}})['then'](respondWithResult(_0x29f6c8,null))['catch'](handleError(_0x29f6c8,null));};exports[_0x03bc('0x71')]=function(_0x5026ab,_0x19a237,_0x51d9ec){var _0x49f32b={};var _0x1fd9e6={};var _0x501d69;var _0x1be57e;return db['ChatGroup'][_0x03bc('0x6c')]({'where':{'id':_0x5026ab[_0x03bc('0x5a')]['id']}})[_0x03bc('0x28')](handleEntityNotFound(_0x19a237,null))[_0x03bc('0x28')](function(_0x50cffa){if(_0x50cffa){_0x501d69=_0x50cffa;_0x1fd9e6[_0x03bc('0x4a')]=_[_0x03bc('0x5b')](db[_0x03bc('0x65')]['rawAttributes']);_0x1fd9e6[_0x03bc('0x4c')]=_[_0x03bc('0x5b')](_0x5026ab['query']);_0x1fd9e6[_0x03bc('0x4b')]=_[_0x03bc('0x5c')](_0x1fd9e6['model'],_0x1fd9e6[_0x03bc('0x4c')]);_0x49f32b[_0x03bc('0x4d')]=_[_0x03bc('0x5c')](_0x1fd9e6[_0x03bc('0x4a')],qs[_0x03bc('0x5d')](_0x5026ab[_0x03bc('0x4c')]['fields']));_0x49f32b[_0x03bc('0x4d')]=_0x49f32b[_0x03bc('0x4d')][_0x03bc('0x5e')]?_0x49f32b[_0x03bc('0x4d')]:_0x1fd9e6[_0x03bc('0x4a')];_0x49f32b['order']=qs['sort'](_0x5026ab['query'][_0x03bc('0x50')]);_0x49f32b[_0x03bc('0x51')]=qs[_0x03bc('0x4b')](_[_0x03bc('0x52')](_0x5026ab[_0x03bc('0x4c')],_0x1fd9e6[_0x03bc('0x4b')]));if(_0x5026ab[_0x03bc('0x4c')]['filter']){_0x49f32b[_0x03bc('0x51')]=_[_0x03bc('0x55')](_0x49f32b[_0x03bc('0x51')],{'$or':_['map'](_0x49f32b[_0x03bc('0x4d')],function(_0x166c0f){var _0x510f9e={};_0x510f9e[_0x166c0f]={'$like':'%'+_0x5026ab[_0x03bc('0x4c')]['filter']+'%'};return _0x510f9e;})});}if(_0x5026ab['query'][_0x03bc('0x72')]){var _0x2adfd5=_0x5026ab[_0x03bc('0x4c')][_0x03bc('0x72')][_0x03bc('0x73')](',');var _0x283c28={};_0x283c28[_0x2adfd5[0x0]]={'$gte':moment(_0x2adfd5[0x1])[_0x03bc('0x74')](_0x03bc('0x75'))};_0x49f32b[_0x03bc('0x51')]=_[_0x03bc('0x55')](_0x49f32b[_0x03bc('0x51')],_0x283c28);}_0x49f32b=_[_0x03bc('0x55')]({},_0x49f32b,_0x5026ab['options']);return _0x501d69[_0x03bc('0x71')](_0x49f32b);}})[_0x03bc('0x28')](function(_0x194c37){if(_0x194c37){_0x1be57e=_0x194c37[_0x03bc('0x5e')];if(!_0x5026ab[_0x03bc('0x4c')][_0x03bc('0x6e')](_0x03bc('0x4e'))){_0x49f32b[_0x03bc('0x39')]=qs[_0x03bc('0x39')](_0x5026ab['query'][_0x03bc('0x39')]);_0x49f32b[_0x03bc('0x38')]=qs[_0x03bc('0x38')](_0x5026ab[_0x03bc('0x4c')][_0x03bc('0x38')]);}return _0x501d69[_0x03bc('0x71')](_0x49f32b);}})[_0x03bc('0x28')](function(_0x3a6668){if(_0x3a6668){return _0x3a6668?{'count':_0x1be57e,'rows':_0x3a6668}:null;}})[_0x03bc('0x28')](respondWithResult(_0x19a237,null))[_0x03bc('0x32')](handleError(_0x19a237,null));}; \ No newline at end of file +var _0xdedd=['request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','status','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','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~!@#$%^&-_=+[{]}.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdedd,0x197));var _0xdded=function(_0x5b02fa,_0x5216a1){_0x5b02fa=_0x5b02fa-0x0;var _0x45a5b0=_0xdedd[_0x5b02fa];return _0x45a5b0;};'use strict';var pdf=require(_0xdded('0x0'));var emlformat=require(_0xdded('0x1'));var rimraf=require(_0xdded('0x2'));var zipdir=require(_0xdded('0x3'));var jsonpatch=require(_0xdded('0x4'));var rp=require('request-promise');var moment=require(_0xdded('0x5'));var BPromise=require(_0xdded('0x6'));var Mustache=require(_0xdded('0x7'));var util=require(_0xdded('0x8'));var path=require(_0xdded('0x9'));var sox=require(_0xdded('0xa'));var csv=require(_0xdded('0xb'));var ejs=require(_0xdded('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdded('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdded('0xe'));var Papa=require(_0xdded('0xf'));var Redis=require(_0xdded('0x10'));var authService=require(_0xdded('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdded('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdded('0x13'))(_0xdded('0x14'));var utils=require(_0xdded('0x15'));var config=require(_0xdded('0x16'));var db=require(_0xdded('0x17'))['db'];config[_0xdded('0x18')]=_[_0xdded('0x19')](config[_0xdded('0x18')],{'host':_0xdded('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdded('0x18')]));require(_0xdded('0x1b'))['register'](socket);var jayson=require(_0xdded('0x1c'));var client=jayson['client'][_0xdded('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x57548f,_0x5e69e9,_0x140bc3){if(_0x140bc3){var _0x22ca73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22ca73['test'](_0x5e69e9)){return _0x57548f;}else{throw new db[(_0xdded('0x1e'))][(_0xdded('0x1f'))](_0xdded('0x20'));}}else{return _0x57548f;}}function respondWithRpcPromise(_0x292813,_0x1454e4,_0x45cd32,_0x323c30){return new BPromise(function(_0x436ee9,_0x4f249e){var _0x3380b7=_0x323c30||client;return _0x3380b7[_0xdded('0x21')](_0x292813,_0x45cd32)[_0xdded('0x22')](function(_0x153686){logger[_0xdded('0x23')](_0xdded('0x24'),_0x1454e4,_0xdded('0x25'));logger[_0xdded('0x26')](_0xdded('0x27'),_0x1454e4,_0xdded('0x25'),JSON[_0xdded('0x28')](_0x153686));if(_0x153686[_0xdded('0x29')]){if(_0x153686[_0xdded('0x29')]['code']===0x1f4){logger[_0xdded('0x29')](_0xdded('0x24'),_0x1454e4,_0x153686[_0xdded('0x29')][_0xdded('0x2a')]);return _0x4f249e(_0x153686['error'][_0xdded('0x2a')]);}logger['error'](_0xdded('0x24'),_0x1454e4,_0x153686[_0xdded('0x29')][_0xdded('0x2a')]);return _0x436ee9(_0x153686[_0xdded('0x29')][_0xdded('0x2a')]);}else{logger['info'](_0xdded('0x24'),_0x1454e4,_0xdded('0x25'));_0x436ee9(_0x153686[_0xdded('0x2b')][_0xdded('0x2a')]);}})[_0xdded('0x2c')](function(_0x4bd5c9){logger['error'](_0xdded('0x24'),_0x1454e4,_0x4bd5c9);_0x4f249e(_0x4bd5c9);});});}function respondWithStatusCode(_0x88b9f1,_0xfb0379){_0xfb0379=_0xfb0379||0xcc;return function(_0x4358f6){if(_0x4358f6){return _0x88b9f1[_0xdded('0x2d')](_0xfb0379);}return _0x88b9f1['status'](_0xfb0379)[_0xdded('0x2e')]();};}function respondWithResult(_0x10c128,_0x154a55){_0x154a55=_0x154a55||0xc8;return function(_0x11e13a){if(_0x11e13a){return _0x10c128['status'](_0x154a55)[_0xdded('0x2f')](_0x11e13a);}};}function respondWithFilteredResult(_0x5f3637,_0x7855ab){return function(_0x7b622b){if(_0x7b622b){var _0x37f0f5=_0x7b622b[_0xdded('0x30')],_0x36880e=_0x7855ab['offset'],_0xf193a8=_0x7855ab[_0xdded('0x31')]+_0x7855ab[_0xdded('0x32')],_0x3459c7;if(_0xf193a8>=_0x37f0f5){_0xf193a8=_0x37f0f5;_0x3459c7=0xc8;}else{_0x3459c7=0xce;}_0x5f3637['status'](_0x3459c7);return _0x5f3637[_0xdded('0x33')](_0xdded('0x34'),_0x36880e+'-'+_0xf193a8+'/'+_0x37f0f5)['json'](_0x7b622b);}return null;};}function patchUpdates(_0x5dc76e){return function(_0x48ebde){try{jsonpatch['apply'](_0x48ebde,_0x5dc76e,!![]);}catch(_0x3ab6b2){return BPromise[_0xdded('0x35')](_0x3ab6b2);}return _0x48ebde[_0xdded('0x36')]();};}function saveUpdates(_0x74704,_0x431907){return function(_0x3e9982){if(_0x3e9982){return _0x3e9982[_0xdded('0x37')](_0x74704)['then'](function(_0x39c0e5){return _0x39c0e5;});}return null;};}function removeEntity(_0x166ab9,_0x1f9d25){return function(_0x161eb9){if(_0x161eb9){return _0x161eb9[_0xdded('0x38')]()[_0xdded('0x22')](function(){_0x166ab9['status'](0xcc)[_0xdded('0x2e')]();});}};}function handleEntityNotFound(_0x1d720e,_0x32492c){return function(_0x5847b0){if(!_0x5847b0){_0x1d720e[_0xdded('0x2d')](0x194);}return _0x5847b0;};}function handleError(_0x31f602,_0x4c1842){_0x4c1842=_0x4c1842||0x1f4;return function(_0x44d53c){logger[_0xdded('0x29')](_0x44d53c[_0xdded('0x39')]);if(_0x44d53c[_0xdded('0x3a')]){delete _0x44d53c[_0xdded('0x3a')];}_0x31f602[_0xdded('0x3b')](_0x4c1842)[_0xdded('0x3c')](_0x44d53c);};}exports[_0xdded('0x3d')]=function(_0xc5eec0,_0x4242b5){var _0x975447={},_0x1bb3a8={},_0x5111af={'count':0x0,'rows':[]};var _0x5afb23=_[_0xdded('0x3e')](db[_0xdded('0x3f')][_0xdded('0x40')],function(_0x24ba4a){return{'name':_0x24ba4a[_0xdded('0x41')],'type':_0x24ba4a[_0xdded('0x42')][_0xdded('0x43')]};});_0x1bb3a8[_0xdded('0x44')]=_[_0xdded('0x3e')](_0x5afb23,_0xdded('0x3a'));_0x1bb3a8[_0xdded('0x45')]=_[_0xdded('0x46')](_0xc5eec0['query']);_0x1bb3a8[_0xdded('0x47')]=_['intersection'](_0x1bb3a8[_0xdded('0x44')],_0x1bb3a8['query']);_0x975447[_0xdded('0x48')]=_[_0xdded('0x49')](_0x1bb3a8['model'],qs[_0xdded('0x4a')](_0xc5eec0['query'][_0xdded('0x4a')]));_0x975447[_0xdded('0x48')]=_0x975447[_0xdded('0x48')][_0xdded('0x4b')]?_0x975447[_0xdded('0x48')]:_0x1bb3a8[_0xdded('0x44')];if(!_0xc5eec0[_0xdded('0x45')][_0xdded('0x4c')]('nolimit')){_0x975447[_0xdded('0x32')]=qs['limit'](_0xc5eec0['query'][_0xdded('0x32')]);_0x975447[_0xdded('0x31')]=qs['offset'](_0xc5eec0[_0xdded('0x45')][_0xdded('0x31')]);}_0x975447[_0xdded('0x4d')]=qs[_0xdded('0x4e')](_0xc5eec0[_0xdded('0x45')][_0xdded('0x4e')]);_0x975447[_0xdded('0x4f')]=qs[_0xdded('0x47')](_[_0xdded('0x50')](_0xc5eec0[_0xdded('0x45')],_0x1bb3a8[_0xdded('0x47')]),_0x5afb23);if(_0xc5eec0['query'][_0xdded('0x51')]){_0x975447['where']=_[_0xdded('0x52')](_0x975447[_0xdded('0x4f')],{'$or':_[_0xdded('0x3e')](_0x5afb23,function(_0x2554c2){if(_0x2554c2[_0xdded('0x42')]!==_0xdded('0x53')){var _0x326308={};_0x326308[_0x2554c2[_0xdded('0x3a')]]={'$like':'%'+_0xc5eec0['query']['filter']+'%'};return _0x326308;}})});}_0x975447=_[_0xdded('0x52')]({},_0x975447,_0xc5eec0[_0xdded('0x54')]);var _0x2321ef={'where':_0x975447[_0xdded('0x4f')]};return db['ChatGroup'][_0xdded('0x30')](_0x2321ef)['then'](function(_0x46685a){_0x5111af[_0xdded('0x30')]=_0x46685a;if(_0xc5eec0[_0xdded('0x45')]['includeAll']){_0x975447['include']=[{'all':!![]}];}return db[_0xdded('0x3f')][_0xdded('0x55')](_0x975447);})[_0xdded('0x22')](function(_0x4bee4c){_0x5111af[_0xdded('0x56')]=_0x4bee4c;return _0x5111af;})['then'](respondWithFilteredResult(_0x4242b5,_0x975447))[_0xdded('0x2c')](handleError(_0x4242b5,null));};exports[_0xdded('0x57')]=function(_0x59c59c,_0xa4aba0){var _0x24af7e={'raw':!![],'where':{'id':_0x59c59c[_0xdded('0x58')]['id']}},_0xa30a51={};_0xa30a51['model']=_[_0xdded('0x46')](db[_0xdded('0x3f')][_0xdded('0x40')]);_0xa30a51[_0xdded('0x45')]=_[_0xdded('0x46')](_0x59c59c[_0xdded('0x45')]);_0xa30a51['filters']=_[_0xdded('0x49')](_0xa30a51['model'],_0xa30a51[_0xdded('0x45')]);_0x24af7e['attributes']=_[_0xdded('0x49')](_0xa30a51[_0xdded('0x44')],qs[_0xdded('0x4a')](_0x59c59c['query'][_0xdded('0x4a')]));_0x24af7e['attributes']=_0x24af7e[_0xdded('0x48')][_0xdded('0x4b')]?_0x24af7e[_0xdded('0x48')]:_0xa30a51['model'];if(_0x59c59c['query'][_0xdded('0x59')]){_0x24af7e[_0xdded('0x5a')]=[{'all':!![]}];}_0x24af7e=_['merge']({},_0x24af7e,_0x59c59c['options']);return db[_0xdded('0x3f')][_0xdded('0x5b')](_0x24af7e)[_0xdded('0x22')](handleEntityNotFound(_0xa4aba0,null))[_0xdded('0x22')](respondWithResult(_0xa4aba0,null))[_0xdded('0x2c')](handleError(_0xa4aba0,null));};exports[_0xdded('0x5c')]=function(_0xbe605d,_0x41e285){return db['ChatGroup'][_0xdded('0x5c')](_0xbe605d[_0xdded('0x5d')],{})[_0xdded('0x22')](respondWithResult(_0x41e285,0xc9))[_0xdded('0x2c')](handleError(_0x41e285,null));};exports[_0xdded('0x37')]=function(_0x4596ea,_0x62a824){if(_0x4596ea[_0xdded('0x5d')]['id']){delete _0x4596ea[_0xdded('0x5d')]['id'];}return db['ChatGroup'][_0xdded('0x5b')]({'where':{'id':_0x4596ea[_0xdded('0x58')]['id']}})[_0xdded('0x22')](handleEntityNotFound(_0x62a824,null))[_0xdded('0x22')](saveUpdates(_0x4596ea[_0xdded('0x5d')],null))[_0xdded('0x22')](respondWithResult(_0x62a824,null))['catch'](handleError(_0x62a824,null));};exports[_0xdded('0x38')]=function(_0x21c826,_0x50240f){return db['ChatGroup'][_0xdded('0x5b')]({'where':{'id':_0x21c826[_0xdded('0x58')]['id']}})[_0xdded('0x22')](handleEntityNotFound(_0x50240f,null))[_0xdded('0x22')](removeEntity(_0x50240f,null))[_0xdded('0x2c')](handleError(_0x50240f,null));};exports[_0xdded('0x5e')]=function(_0x1a9717,_0x556bd0){return db['ChatGroup'][_0xdded('0x5e')]()[_0xdded('0x22')](respondWithResult(_0x556bd0,null))[_0xdded('0x2c')](handleError(_0x556bd0,null));};exports[_0xdded('0x5f')]=function(_0x24e3fc,_0x3e7399,_0x353165){return db[_0xdded('0x60')][_0xdded('0x30')]({'where':{'ChatGroupId':_0x24e3fc['params']['id'],'ToId':_0x24e3fc[_0xdded('0x61')]['id'],'read':![]}})[_0xdded('0x22')](function(_0x97fe84){return{'id':_['toInteger'](_0x24e3fc[_0xdded('0x58')]['id']),'count':_0x97fe84};})[_0xdded('0x22')](respondWithResult(_0x3e7399,null))[_0xdded('0x2c')](handleError(_0x3e7399,null));};exports[_0xdded('0x62')]=function(_0x50521d,_0x5accab,_0x4f3c05){return db['ChatGroup'][_0xdded('0x5b')]({'where':{'id':_0x50521d['params']['id']}})[_0xdded('0x22')](handleEntityNotFound(_0x5accab,null))[_0xdded('0x22')](function(_0x341067){if(_0x341067){return _0x341067[_0xdded('0x62')](_0x50521d[_0xdded('0x5d')][_0xdded('0x63')],_[_0xdded('0x64')](_0x50521d['body'],[_0xdded('0x63'),'id'])||{});}})[_0xdded('0x22')](respondWithResult(_0x5accab,null))[_0xdded('0x2c')](handleError(_0x5accab,null));};exports[_0xdded('0x65')]=function(_0x2cf63e,_0x29bd5d,_0x464f62){var _0x449450={};var _0x2c80e5={};var _0x4729eb;var _0x4e3651;return db[_0xdded('0x3f')]['findOne']({'where':{'id':_0x2cf63e[_0xdded('0x58')]['id']}})[_0xdded('0x22')](handleEntityNotFound(_0x29bd5d,null))['then'](function(_0x55aa2b){if(_0x55aa2b){_0x4729eb=_0x55aa2b;_0x2c80e5['model']=_[_0xdded('0x46')](db[_0xdded('0x66')][_0xdded('0x40')]);_0x2c80e5['query']=_[_0xdded('0x46')](_0x2cf63e[_0xdded('0x45')]);_0x2c80e5[_0xdded('0x47')]=_[_0xdded('0x49')](_0x2c80e5[_0xdded('0x44')],_0x2c80e5[_0xdded('0x45')]);_0x449450[_0xdded('0x48')]=_[_0xdded('0x49')](_0x2c80e5[_0xdded('0x44')],qs['fields'](_0x2cf63e[_0xdded('0x45')][_0xdded('0x4a')]));_0x449450[_0xdded('0x48')]=_0x449450[_0xdded('0x48')]['length']?_0x449450[_0xdded('0x48')]:_0x2c80e5['model'];_0x449450[_0xdded('0x4d')]=qs[_0xdded('0x4e')](_0x2cf63e[_0xdded('0x45')]['sort']);_0x449450['where']=qs['filters'](_['pick'](_0x2cf63e['query'],_0x2c80e5['filters']));if(_0x2cf63e[_0xdded('0x45')][_0xdded('0x51')]){_0x449450[_0xdded('0x4f')]=_[_0xdded('0x52')](_0x449450[_0xdded('0x4f')],{'$or':_[_0xdded('0x3e')](_0x449450['attributes'],function(_0x4b729b){var _0x2ace80={};_0x2ace80[_0x4b729b]={'$like':'%'+_0x2cf63e[_0xdded('0x45')][_0xdded('0x51')]+'%'};return _0x2ace80;})});}_0x449450=_[_0xdded('0x52')]({},_0x449450,_0x2cf63e[_0xdded('0x54')]);return _0x4729eb[_0xdded('0x65')](_0x449450);}})[_0xdded('0x22')](function(_0x3c29c7){if(_0x3c29c7){_0x4e3651=_0x3c29c7['length'];if(!_0x2cf63e[_0xdded('0x45')]['hasOwnProperty']('nolimit')){_0x449450[_0xdded('0x32')]=qs[_0xdded('0x32')](_0x2cf63e['query'][_0xdded('0x32')]);_0x449450['offset']=qs[_0xdded('0x31')](_0x2cf63e[_0xdded('0x45')][_0xdded('0x31')]);}return _0x4729eb[_0xdded('0x65')](_0x449450);}})[_0xdded('0x22')](function(_0x405b85){if(_0x405b85){return _0x405b85?{'count':_0x4e3651,'rows':_0x405b85}:null;}})[_0xdded('0x22')](respondWithResult(_0x29bd5d,null))[_0xdded('0x2c')](handleError(_0x29bd5d,null));};exports[_0xdded('0x67')]=function(_0x27c815,_0x29c74b,_0x2eda09){return db['ChatGroup']['find']({'where':{'id':_0x27c815[_0xdded('0x58')]['id']}})['then'](handleEntityNotFound(_0x29c74b,null))[_0xdded('0x22')](function(_0x363c6a){if(_0x363c6a){return _0x363c6a[_0xdded('0x67')](_0x27c815[_0xdded('0x45')]['ids']);}})[_0xdded('0x22')](respondWithStatusCode(_0x29c74b,null))[_0xdded('0x2c')](handleError(_0x29c74b,null));};exports[_0xdded('0x68')]=function(_0x1da784,_0x1fc775,_0x3a7189){if(_0x1da784[_0xdded('0x5d')]['id']){delete _0x1da784['body']['id'];}return db['ChatGroup'][_0xdded('0x5b')]({'where':{'id':_0x1da784[_0xdded('0x58')]['id']}})[_0xdded('0x22')](handleEntityNotFound(_0x1fc775,null))[_0xdded('0x22')](function(_0x7caddf){if(_0x7caddf){_0x1da784[_0xdded('0x5d')][_0xdded('0x69')]=_0x7caddf['id'];return db[_0xdded('0x60')][_0xdded('0x5c')](_0x1da784[_0xdded('0x5d')]);}})[_0xdded('0x22')](respondWithResult(_0x1fc775,null))[_0xdded('0x2c')](handleError(_0x1fc775,null));};exports[_0xdded('0x6a')]=function(_0x40000d,_0x29caa6,_0x2c1c69){var _0x17fb2d={};var _0x456d02={};var _0xd0f739;var _0x18a4df;return db[_0xdded('0x3f')]['findOne']({'where':{'id':_0x40000d[_0xdded('0x58')]['id']}})[_0xdded('0x22')](handleEntityNotFound(_0x29caa6,null))['then'](function(_0x3d8ee2){if(_0x3d8ee2){_0xd0f739=_0x3d8ee2;_0x456d02[_0xdded('0x44')]=_[_0xdded('0x46')](db[_0xdded('0x60')][_0xdded('0x40')]);_0x456d02[_0xdded('0x45')]=_[_0xdded('0x46')](_0x40000d[_0xdded('0x45')]);_0x456d02[_0xdded('0x47')]=_[_0xdded('0x49')](_0x456d02[_0xdded('0x44')],_0x456d02[_0xdded('0x45')]);_0x17fb2d[_0xdded('0x48')]=_[_0xdded('0x49')](_0x456d02['model'],qs[_0xdded('0x4a')](_0x40000d[_0xdded('0x45')][_0xdded('0x4a')]));_0x17fb2d[_0xdded('0x48')]=_0x17fb2d[_0xdded('0x48')]['length']?_0x17fb2d[_0xdded('0x48')]:_0x456d02[_0xdded('0x44')];_0x17fb2d[_0xdded('0x4d')]=qs[_0xdded('0x4e')](_0x40000d[_0xdded('0x45')]['sort']);_0x17fb2d[_0xdded('0x4f')]=qs[_0xdded('0x47')](_[_0xdded('0x50')](_0x40000d[_0xdded('0x45')],_0x456d02[_0xdded('0x47')]));if(_0x40000d[_0xdded('0x45')][_0xdded('0x51')]){_0x17fb2d[_0xdded('0x4f')]=_['merge'](_0x17fb2d[_0xdded('0x4f')],{'$or':_[_0xdded('0x3e')](_0x17fb2d[_0xdded('0x48')],function(_0x132e50){var _0x5e9c30={};_0x5e9c30[_0x132e50]={'$like':'%'+_0x40000d[_0xdded('0x45')]['filter']+'%'};return _0x5e9c30;})});}if(_0x40000d['query']['$gte']){var _0x558b92=_0x40000d[_0xdded('0x45')][_0xdded('0x6b')][_0xdded('0x6c')](',');var _0x2ea59e={};_0x2ea59e[_0x558b92[0x0]]={'$gte':moment(_0x558b92[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x17fb2d[_0xdded('0x4f')]=_[_0xdded('0x52')](_0x17fb2d['where'],_0x2ea59e);}_0x17fb2d=_[_0xdded('0x52')]({},_0x17fb2d,_0x40000d[_0xdded('0x54')]);return _0xd0f739['getMessages'](_0x17fb2d);}})[_0xdded('0x22')](function(_0x50e1bb){if(_0x50e1bb){_0x18a4df=_0x50e1bb[_0xdded('0x4b')];if(!_0x40000d[_0xdded('0x45')][_0xdded('0x4c')](_0xdded('0x6d'))){_0x17fb2d[_0xdded('0x32')]=qs[_0xdded('0x32')](_0x40000d['query'][_0xdded('0x32')]);_0x17fb2d[_0xdded('0x31')]=qs['offset'](_0x40000d[_0xdded('0x45')][_0xdded('0x31')]);}return _0xd0f739['getMessages'](_0x17fb2d);}})[_0xdded('0x22')](function(_0x41cac1){if(_0x41cac1){return _0x41cac1?{'count':_0x18a4df,'rows':_0x41cac1}:null;}})['then'](respondWithResult(_0x29caa6,null))[_0xdded('0x2c')](handleError(_0x29caa6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5f4b162..0581760 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(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xadb5,0xad));var _0x5adb=function(_0x49653d,_0x59a146){_0x49653d=_0x49653d-0x0;var _0x4b6080=_0xadb5[_0x49653d];return _0x4b6080;};'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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x27950d,_0x5c2299){var _0x4d8fc8=function(_0x2de1a0){while(--_0x2de1a0){_0x27950d['push'](_0x27950d['shift']());}};_0x4d8fc8(++_0x5c2299);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1333c7,_0x313346){_0x1333c7=_0x1333c7-0x0;var _0x3b1232=_0x5f2f[_0x1333c7];return _0x3b1232;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7ec2feb..2d5189b 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 _0x6657=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash'];(function(_0x596684,_0x3e7a0a){var _0x21d272=function(_0x1223f2){while(--_0x1223f2){_0x596684['push'](_0x596684['shift']());}};_0x21d272(++_0x3e7a0a);}(_0x6657,0x17f));var _0x7665=function(_0x41d81a,_0x32ffc9){_0x41d81a=_0x41d81a-0x0;var _0x372a1b=_0x6657[_0x41d81a];return _0x372a1b;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var logger=require(_0x7665('0x1'))(_0x7665('0x2'));var moment=require(_0x7665('0x3'));var BPromise=require(_0x7665('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7665('0x5'));var rimraf=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var attributes=require(_0x7665('0x8'));module[_0x7665('0x9')]=function(_0x28b410,_0x1a6f2f){return _0x28b410[_0x7665('0xa')]('ChatGroup',attributes,{'tableName':_0x7665('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xafc4,0x69));var _0x4afc=function(_0x55959f,_0x2f0c3f){_0x55959f=_0x55959f-0x0;var _0x4ea50c=_0xafc4[_0x55959f];return _0x4ea50c;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'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 5c313e8..d27f3e9 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 _0xa9f2=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result'];(function(_0x40e45d,_0x3d05e1){var _0x97c0fc=function(_0x331471){while(--_0x331471){_0x40e45d['push'](_0x40e45d['shift']());}};_0x97c0fc(++_0x3d05e1);}(_0xa9f2,0x12a));var _0x2a9f=function(_0x3a0f95,_0x26cb76){_0x3a0f95=_0x3a0f95-0x0;var _0x433ee4=_0xa9f2[_0x3a0f95];return _0x433ee4;};'use strict';var _=require(_0x2a9f('0x0'));var util=require('util');var moment=require(_0x2a9f('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a9f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a9f('0x3'))['db'];var utils=require(_0x2a9f('0x4'));var logger=require(_0x2a9f('0x5'))(_0x2a9f('0x6'));var config=require(_0x2a9f('0x7'));var jayson=require(_0x2a9f('0x8'));var client=jayson[_0x2a9f('0x9')][_0x2a9f('0xa')]({'port':0x232a});config[_0x2a9f('0xb')]=_[_0x2a9f('0xc')](config[_0x2a9f('0xb')],{'host':_0x2a9f('0xd'),'port':0x18eb});var socket=require(_0x2a9f('0xe'))(new Redis(config['redis']));require(_0x2a9f('0xf'))[_0x2a9f('0x10')](socket);function respondWithRpcPromise(_0x51724e,_0x3e4808,_0x1ca91b){return new BPromise(function(_0x56fcb7,_0x49936e){return client[_0x2a9f('0x11')](_0x51724e,_0x1ca91b)['then'](function(_0x1b3059){logger[_0x2a9f('0x12')](_0x2a9f('0x13'),_0x3e4808,'request\x20sent');logger[_0x2a9f('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3e4808,_0x2a9f('0x15'),JSON[_0x2a9f('0x16')](_0x1b3059));if(_0x1b3059[_0x2a9f('0x17')]){if(_0x1b3059[_0x2a9f('0x17')]['code']===0x1f4){logger[_0x2a9f('0x17')]('ChatGroup,\x20%s,\x20%s',_0x3e4808,_0x1b3059[_0x2a9f('0x17')][_0x2a9f('0x18')]);return _0x49936e(_0x1b3059['error']['message']);}logger['error'](_0x2a9f('0x13'),_0x3e4808,_0x1b3059[_0x2a9f('0x17')][_0x2a9f('0x18')]);return _0x56fcb7(_0x1b3059[_0x2a9f('0x17')][_0x2a9f('0x18')]);}else{logger[_0x2a9f('0x12')](_0x2a9f('0x13'),_0x3e4808,_0x2a9f('0x15'));_0x56fcb7(_0x1b3059[_0x2a9f('0x19')][_0x2a9f('0x18')]);}})[_0x2a9f('0x1a')](function(_0x3078be){logger['error'](_0x2a9f('0x13'),_0x3e4808,_0x3078be);_0x49936e(_0x3078be);});});} \ No newline at end of file +var _0x5edf=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','client','http','defaults','redis','localhost','register','request','then','info'];(function(_0xb5f3fa,_0x44f13a){var _0x2bc070=function(_0x88840f){while(--_0x88840f){_0xb5f3fa['push'](_0xb5f3fa['shift']());}};_0x2bc070(++_0x44f13a);}(_0x5edf,0x1cb));var _0xf5ed=function(_0x39372d,_0x4fc371){_0x39372d=_0x39372d-0x0;var _0x309568=_0x5edf[_0x39372d];return _0x309568;};'use strict';var _=require(_0xf5ed('0x0'));var util=require(_0xf5ed('0x1'));var moment=require(_0xf5ed('0x2'));var BPromise=require(_0xf5ed('0x3'));var rs=require(_0xf5ed('0x4'));var fs=require('fs');var Redis=require(_0xf5ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf5ed('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5ed('0x7')][_0xf5ed('0x8')]({'port':0x232a});config['redis']=_[_0xf5ed('0x9')](config[_0xf5ed('0xa')],{'host':_0xf5ed('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0xf5ed('0xc')](socket);function respondWithRpcPromise(_0xf331b7,_0x6102e6,_0x50be7f){return new BPromise(function(_0x49bd26,_0x5cb02e){return client[_0xf5ed('0xd')](_0xf331b7,_0x50be7f)[_0xf5ed('0xe')](function(_0x4c1c97){logger[_0xf5ed('0xf')](_0xf5ed('0x10'),_0x6102e6,_0xf5ed('0x11'));logger[_0xf5ed('0x12')](_0xf5ed('0x13'),_0x6102e6,_0xf5ed('0x11'),JSON[_0xf5ed('0x14')](_0x4c1c97));if(_0x4c1c97['error']){if(_0x4c1c97[_0xf5ed('0x15')][_0xf5ed('0x16')]===0x1f4){logger[_0xf5ed('0x15')](_0xf5ed('0x10'),_0x6102e6,_0x4c1c97['error']['message']);return _0x5cb02e(_0x4c1c97[_0xf5ed('0x15')][_0xf5ed('0x17')]);}logger[_0xf5ed('0x15')](_0xf5ed('0x10'),_0x6102e6,_0x4c1c97[_0xf5ed('0x15')][_0xf5ed('0x17')]);return _0x49bd26(_0x4c1c97[_0xf5ed('0x15')][_0xf5ed('0x17')]);}else{logger[_0xf5ed('0xf')](_0xf5ed('0x10'),_0x6102e6,_0xf5ed('0x11'));_0x49bd26(_0x4c1c97[_0xf5ed('0x18')][_0xf5ed('0x17')]);}})['catch'](function(_0xcbe97c){logger[_0xf5ed('0x15')](_0xf5ed('0x10'),_0x6102e6,_0xcbe97c);_0x5cb02e(_0xcbe97c);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 22231b4..fa78074 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 _0xf734=['length','chatGroup:','./chatGroup.events','save','update'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0xf734,0x1d8));var _0x4f73=function(_0xe120fa,_0x36ae59){_0xe120fa=_0xe120fa-0x0;var _0x47b21a=_0xf734[_0xe120fa];return _0x47b21a;};'use strict';var ChatGroupEvents=require(_0x4f73('0x0'));var events=[_0x4f73('0x1'),'remove',_0x4f73('0x2')];function createListener(_0x9f594b,_0x2c0cc5){return function(_0x4d4973){_0x2c0cc5['emit'](_0x9f594b,_0x4d4973);};}function removeListener(_0x1c2fe4,_0x100e4a){return function(){ChatGroupEvents['removeListener'](_0x1c2fe4,_0x100e4a);};}exports['register']=function(_0xa5507d){for(var _0x3890e5=0x0,_0x1879e2=events[_0x4f73('0x3')];_0x3890e5<_0x1879e2;_0x3890e5++){var _0x42383b=events[_0x3890e5];var _0x305e25=createListener(_0x4f73('0x4')+_0x42383b,_0xa5507d);ChatGroupEvents['on'](_0x42383b,_0x305e25);}}; \ No newline at end of file +var _0x42cf=['register','length','chatGroup:','./chatGroup.events','remove','emit','removeListener'];(function(_0x5c6b9a,_0x38c3fa){var _0x5d11a5=function(_0x14a76f){while(--_0x14a76f){_0x5c6b9a['push'](_0x5c6b9a['shift']());}};_0x5d11a5(++_0x38c3fa);}(_0x42cf,0xa4));var _0xf42c=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x42cf[_0x5f309e];return _0x487b5e;};'use strict';var ChatGroupEvents=require(_0xf42c('0x0'));var events=['save',_0xf42c('0x1'),'update'];function createListener(_0x3ae36d,_0x15e914){return function(_0x162931){_0x15e914[_0xf42c('0x2')](_0x3ae36d,_0x162931);};}function removeListener(_0x4d15dc,_0x592f3d){return function(){ChatGroupEvents[_0xf42c('0x3')](_0x4d15dc,_0x592f3d);};}exports[_0xf42c('0x4')]=function(_0x3ff5d7){for(var _0x1d7e20=0x0,_0x58eac0=events[_0xf42c('0x5')];_0x1d7e20<_0x58eac0;_0x1d7e20++){var _0x5e6432=events[_0x1d7e20];var _0x3203b5=createListener(_0xf42c('0x6')+_0x5e6432,_0x3ff5d7);ChatGroupEvents['on'](_0x5e6432,_0x3203b5);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 26a4345..8e1839b 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 _0xc6b3=['update','delete','destroy','/:id/members','removeMembers','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','show','/:id/unread','getUnread','getMembers','post','create','addMembers','/:id/messages','/:id'];(function(_0x5b4d75,_0x4fc35f){var _0x5b7472=function(_0x53f4e2){while(--_0x53f4e2){_0x5b4d75['push'](_0x5b4d75['shift']());}};_0x5b7472(++_0x4fc35f);}(_0xc6b3,0x12f));var _0x3c6b=function(_0x9adcd6,_0x36278b){_0x9adcd6=_0x9adcd6-0x0;var _0xdf8ff2=_0xc6b3[_0x9adcd6];return _0xdf8ff2;};'use strict';var multer=require(_0x3c6b('0x0'));var util=require(_0x3c6b('0x1'));var path=require(_0x3c6b('0x2'));var timeout=require(_0x3c6b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3c6b('0x4'));var interaction=require(_0x3c6b('0x5'));var config=require(_0x3c6b('0x6'));var controller=require(_0x3c6b('0x7'));router[_0x3c6b('0x8')]('/',auth[_0x3c6b('0x9')](),controller[_0x3c6b('0xa')]);router[_0x3c6b('0x8')](_0x3c6b('0xb'),auth[_0x3c6b('0x9')](),controller['describe']);router[_0x3c6b('0x8')]('/:id',auth[_0x3c6b('0x9')](),controller[_0x3c6b('0xc')]);router[_0x3c6b('0x8')](_0x3c6b('0xd'),auth['isAuthenticated'](),controller[_0x3c6b('0xe')]);router[_0x3c6b('0x8')]('/:id/members',auth[_0x3c6b('0x9')](),controller[_0x3c6b('0xf')]);router[_0x3c6b('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x3c6b('0x10')]('/',auth['isAuthenticated'](),controller[_0x3c6b('0x11')]);router[_0x3c6b('0x10')]('/:id/members',auth[_0x3c6b('0x9')](),controller[_0x3c6b('0x12')]);router[_0x3c6b('0x10')](_0x3c6b('0x13'),auth[_0x3c6b('0x9')](),controller['addMessage']);router['put'](_0x3c6b('0x14'),auth[_0x3c6b('0x9')](),controller[_0x3c6b('0x15')]);router[_0x3c6b('0x16')](_0x3c6b('0x14'),auth[_0x3c6b('0x9')](),controller[_0x3c6b('0x17')]);router['delete'](_0x3c6b('0x18'),auth[_0x3c6b('0x9')](),controller[_0x3c6b('0x19')]);module[_0x3c6b('0x1a')]=router; \ No newline at end of file +var _0x8994=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','/:id/messages','put','/:id','destroy','delete','removeMembers','exports','multer','util','path'];(function(_0x2a80f4,_0x5b22a6){var _0x1cac4b=function(_0x2de0fb){while(--_0x2de0fb){_0x2a80f4['push'](_0x2a80f4['shift']());}};_0x1cac4b(++_0x5b22a6);}(_0x8994,0x1d8));var _0x4899=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x8994[_0xd09668];return _0x68726;};'use strict';var multer=require(_0x4899('0x0'));var util=require(_0x4899('0x1'));var path=require(_0x4899('0x2'));var timeout=require(_0x4899('0x3'));var express=require(_0x4899('0x4'));var router=express[_0x4899('0x5')]();var auth=require(_0x4899('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4899('0x7'));var controller=require('./chatGroup.controller');router[_0x4899('0x8')]('/',auth[_0x4899('0x9')](),controller[_0x4899('0xa')]);router[_0x4899('0x8')]('/describe',auth[_0x4899('0x9')](),controller['describe']);router['get']('/:id',auth[_0x4899('0x9')](),controller[_0x4899('0xb')]);router[_0x4899('0x8')](_0x4899('0xc'),auth['isAuthenticated'](),controller[_0x4899('0xd')]);router[_0x4899('0x8')](_0x4899('0xe'),auth[_0x4899('0x9')](),controller['getMembers']);router[_0x4899('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4899('0xf')]);router[_0x4899('0x10')]('/',auth['isAuthenticated'](),controller[_0x4899('0x11')]);router[_0x4899('0x10')](_0x4899('0xe'),auth[_0x4899('0x9')](),controller['addMembers']);router[_0x4899('0x10')](_0x4899('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x4899('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x4899('0x14'),auth['isAuthenticated'](),controller[_0x4899('0x15')]);router[_0x4899('0x16')](_0x4899('0xe'),auth[_0x4899('0x9')](),controller[_0x4899('0x17')]);module[_0x4899('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1f51da6..0b4b030 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 _0xb3df=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x28ef95,_0x2d04a7){var _0x33fa50=function(_0x7be2c7){while(--_0x7be2c7){_0x28ef95['push'](_0x28ef95['shift']());}};_0x33fa50(++_0x2d04a7);}(_0xb3df,0xc8));var _0xfb3d=function(_0x2fadb8,_0x23031e){_0x2fadb8=_0x2fadb8-0x0;var _0x2ed71d=_0xb3df[_0x2fadb8];return _0x2ed71d;};'use strict';var Sequelize=require('sequelize');module[_0xfb3d('0x0')]={'closed':{'type':Sequelize[_0xfb3d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfb3d('0x2')]},'ratingType':{'type':Sequelize[_0xfb3d('0x3')](_0xfb3d('0x4'),_0xfb3d('0x5')),'defaultValue':_0xfb3d('0x4')},'ratingMessage':{'type':Sequelize[_0xfb3d('0x6')]},'pathTranscript':{'type':Sequelize[_0xfb3d('0x6')]},'mailTranscript':{'type':Sequelize[_0xfb3d('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfb3d('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xfb3d('0x7')]},'browserVersion':{'type':Sequelize[_0xfb3d('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xfb3d('0x7')]},'deviceModel':{'type':Sequelize[_0xfb3d('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xfb3d('0x6')]},'customerIp':{'type':Sequelize[_0xfb3d('0x7')]},'formData':{'type':Sequelize[_0xfb3d('0x6')](_0xfb3d('0x9'))},'read1stAt':{'type':Sequelize[_0xfb3d('0x8')]},'lastMsgAt':{'type':Sequelize[_0xfb3d('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfb3d('0x7')]},'customerPort':{'type':Sequelize[_0xfb3d('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xfb3d('0x6')]}}; \ No newline at end of file +var _0x6925=['ENUM','out','sequelize','exports','BOOLEAN','thumb','star','TEXT','DATE','STRING','long'];(function(_0x43b444,_0x5448f9){var _0x3621cf=function(_0x407c84){while(--_0x407c84){_0x43b444['push'](_0x43b444['shift']());}};_0x3621cf(++_0x5448f9);}(_0x6925,0xff));var _0x5692=function(_0x57536e,_0xf1b786){_0x57536e=_0x57536e-0x0;var _0x1b3a56=_0x6925[_0x57536e];return _0x1b3a56;};'use strict';var Sequelize=require(_0x5692('0x0'));module[_0x5692('0x1')]={'closed':{'type':Sequelize[_0x5692('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star',_0x5692('0x3')),'defaultValue':_0x5692('0x4')},'ratingMessage':{'type':Sequelize[_0x5692('0x5')]},'pathTranscript':{'type':Sequelize[_0x5692('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5692('0x6')]},'disposition':{'type':Sequelize[_0x5692('0x7')]},'note':{'type':Sequelize[_0x5692('0x7')]},'browserName':{'type':Sequelize[_0x5692('0x7')]},'browserVersion':{'type':Sequelize[_0x5692('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x5692('0x7')]},'deviceModel':{'type':Sequelize[_0x5692('0x7')]},'deviceVendor':{'type':Sequelize[_0x5692('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x5692('0x8'))},'read1stAt':{'type':Sequelize[_0x5692('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5692('0x9')]('in',_0x5692('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5692('0x7')]},'customerPort':{'type':Sequelize[_0x5692('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f76ac76..3cab18e 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 _0x687b=['Account','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Owner','N.A.','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','direction','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','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','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','ChatWebsiteId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','unreadMessages','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','sequelize','keyBy','merge','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','includeAll','options','create','update','params','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','CmContact','%s%d','agentAlias','System','customer','ContactId','agentIdentifier','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','secret','includeAgent','spread','Tag','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName'];(function(_0x416265,_0x28953c){var _0x940c48=function(_0x57725d){while(--_0x57725d){_0x416265['push'](_0x416265['shift']());}};_0x940c48(++_0x28953c);}(_0x687b,0x14a));var _0xb687=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x687b[_0x1d5400];return _0x21d9fe;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var db=require(_0xb687('0x1a'))['db'];config[_0xb687('0x1b')]=_[_0xb687('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb687('0x1d'))(new Redis(config[_0xb687('0x1b')]));require('./chatInteraction.socket')[_0xb687('0x1e')](socket);var jayson=require(_0xb687('0x1f'));var client=jayson[_0xb687('0x20')][_0xb687('0x21')]({'port':0x232b});var client9004=jayson[_0xb687('0x20')][_0xb687('0x21')]({'port':0x232c});function checkPasswordPattern(_0x30622f,_0x141375,_0x263085){if(_0x263085){var _0x2c7a18=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c7a18[_0xb687('0x22')](_0x141375)){return _0x30622f;}else{throw new db[(_0xb687('0x23'))]['ValidationError'](_0xb687('0x24'));}}else{return _0x30622f;}}function respondWithRpcPromise(_0x328301,_0x30d370,_0x5eb9b9,_0x48958d){return new BPromise(function(_0x12eff1,_0x3a10ef){var _0x19ee14=_0x48958d||client;return _0x19ee14['request'](_0x328301,_0x5eb9b9)[_0xb687('0x25')](function(_0x481f1d){logger[_0xb687('0x26')](_0xb687('0x27'),_0x30d370,_0xb687('0x28'));logger[_0xb687('0x29')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x30d370,_0xb687('0x28'),JSON['stringify'](_0x481f1d));if(_0x481f1d[_0xb687('0x2a')]){if(_0x481f1d[_0xb687('0x2a')][_0xb687('0x2b')]===0x1f4){logger['error'](_0xb687('0x27'),_0x30d370,_0x481f1d[_0xb687('0x2a')][_0xb687('0x2c')]);return _0x3a10ef(_0x481f1d[_0xb687('0x2a')][_0xb687('0x2c')]);}logger[_0xb687('0x2a')](_0xb687('0x27'),_0x30d370,_0x481f1d[_0xb687('0x2a')]['message']);return _0x12eff1(_0x481f1d[_0xb687('0x2a')][_0xb687('0x2c')]);}else{logger[_0xb687('0x26')](_0xb687('0x27'),_0x30d370,_0xb687('0x28'));_0x12eff1(_0x481f1d[_0xb687('0x2d')][_0xb687('0x2c')]);}})[_0xb687('0x2e')](function(_0x3ff9e1){logger[_0xb687('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x30d370,_0x3ff9e1);_0x3a10ef(_0x3ff9e1);});});}function respondWithStatusCode(_0x3712cf,_0x192966){_0x192966=_0x192966||0xcc;return function(_0x392721){if(_0x392721){return _0x3712cf[_0xb687('0x2f')](_0x192966);}return _0x3712cf[_0xb687('0x30')](_0x192966)[_0xb687('0x31')]();};}function respondWithResult(_0x4e9a06,_0x28b69a){_0x28b69a=_0x28b69a||0xc8;return function(_0x5143af){if(_0x5143af){return _0x4e9a06[_0xb687('0x30')](_0x28b69a)[_0xb687('0x32')](_0x5143af);}};}function respondWithFilteredResult(_0x6df7a2,_0x245db1){return function(_0x1ad3ef){if(_0x1ad3ef){var _0x43d20d=_0x1ad3ef[_0xb687('0x33')],_0xf1f0dd=_0x245db1[_0xb687('0x34')],_0x556815=_0x245db1[_0xb687('0x34')]+_0x245db1[_0xb687('0x35')],_0x3da2be;if(_0x556815>=_0x43d20d){_0x556815=_0x43d20d;_0x3da2be=0xc8;}else{_0x3da2be=0xce;}_0x6df7a2[_0xb687('0x30')](_0x3da2be);return _0x6df7a2[_0xb687('0x36')](_0xb687('0x37'),_0xf1f0dd+'-'+_0x556815+'/'+_0x43d20d)[_0xb687('0x32')](_0x1ad3ef);}return null;};}function patchUpdates(_0x576cc1){return function(_0x17185e){try{jsonpatch['apply'](_0x17185e,_0x576cc1,!![]);}catch(_0x4cb06d){return BPromise[_0xb687('0x38')](_0x4cb06d);}return _0x17185e[_0xb687('0x39')]();};}function saveUpdates(_0x24c418,_0x32abc4){return function(_0x4fc44a){if(_0x4fc44a){return _0x4fc44a['update'](_0x24c418)[_0xb687('0x25')](function(_0x2f4773){return _0x2f4773;});}return null;};}function removeEntity(_0x491a8d,_0x23dc96){return function(_0x449074){if(_0x449074){return _0x449074['destroy']()[_0xb687('0x25')](function(){_0x491a8d['status'](0xcc)[_0xb687('0x31')]();});}};}function handleEntityNotFound(_0x24f34e,_0x2da038){return function(_0x3e146a){if(!_0x3e146a){_0x24f34e[_0xb687('0x2f')](0x194);}return _0x3e146a;};}function handleError(_0x28087e,_0x5f59d0){_0x5f59d0=_0x5f59d0||0x1f4;return function(_0x529b1a){logger[_0xb687('0x2a')](_0x529b1a[_0xb687('0x3a')]);if(_0x529b1a[_0xb687('0x3b')]){delete _0x529b1a['name'];}_0x28087e[_0xb687('0x30')](_0x5f59d0)[_0xb687('0x3c')](_0x529b1a);};}function getInteractionUsers(_0x1f1c88,_0xce9624){return new BPromise(function(_0xa3f0f9,_0x58c214){try{if(_0xce9624[_0x1f1c88['id']]){_0x1f1c88[_0xb687('0x3d')]=_[_0xb687('0x3e')](_0xce9624[_0x1f1c88['id']],function(_0x24c013){return{'id':_0x24c013['id'],'fullname':_0x24c013[_0xb687('0x3f')]};});}}catch(_0x24b785){_0x58c214(_0x24b785);}_0xa3f0f9(_0x1f1c88);});}function getInteractionTags(_0x29cf09,_0x572b5a){return new BPromise(function(_0x5ad577,_0x43f29c){try{if(_0x29cf09['TagIds']){_0x29cf09[_0xb687('0x40')]=[];_0x29cf09[_0xb687('0x41')]['split'](',')[_0xb687('0x42')](function(_0x2ce07a){_0x29cf09['Tags'][_0xb687('0x43')](_0x572b5a[_0x2ce07a]);});}delete _0x29cf09[_0xb687('0x41')];}catch(_0x127b25){_0x43f29c(_0x127b25);}_0x5ad577(_0x29cf09);});}function updateChatInteraction(_0x5253df,_0x66fabe,_0x9cffb2){return new BPromise(function(_0x38abe5,_0x75102a){return getInteractionUsers(_0x5253df,_0x9cffb2)[_0xb687('0x25')](function(_0x1375f7){return getInteractionTags(_0x1375f7,_0x66fabe);})[_0xb687('0x25')](function(_0x4bb665){_0x38abe5(_0x4bb665);})[_0xb687('0x2e')](function(_0x4cf6ad){_0x75102a(_0x4cf6ad);});});}exports['index']=function(_0xa3a9e0,_0x430364){var _0x515985={},_0x19a21c={},_0x5f1b59={'count':0x0,'rows':[]};var _0x3e886d=_[_0xb687('0x3e')](db['ChatInteraction'][_0xb687('0x44')],function(_0x3a8509){return{'name':_0x3a8509['fieldName'],'type':_0x3a8509[_0xb687('0x45')][_0xb687('0x46')]};});_0x19a21c[_0xb687('0x47')]=_[_0xb687('0x3e')](_0x3e886d,_0xb687('0x3b'));_0x19a21c[_0xb687('0x48')]=_[_0xb687('0x49')](_0xa3a9e0[_0xb687('0x48')]);_0x19a21c[_0xb687('0x4a')]=_[_0xb687('0x4b')](_0x19a21c[_0xb687('0x47')],_0x19a21c[_0xb687('0x48')]);_0x515985['attributes']=_[_0xb687('0x4b')](_0x19a21c['model'],qs[_0xb687('0x4c')](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x4c')]));_0x515985[_0xb687('0x4d')]=_0x515985[_0xb687('0x4d')][_0xb687('0x4e')]?_0x515985['attributes']:_0x19a21c['model'];if(!_0xa3a9e0[_0xb687('0x48')][_0xb687('0x4f')](_0xb687('0x50'))){_0x515985[_0xb687('0x35')]=qs['limit'](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x35')]);_0x515985[_0xb687('0x34')]=qs[_0xb687('0x34')](_0xa3a9e0['query'][_0xb687('0x34')]);}_0x515985[_0xb687('0x51')]=qs[_0xb687('0x52')](_0xa3a9e0[_0xb687('0x48')]['sort']);_0x515985['where']=qs[_0xb687('0x4a')](_[_0xb687('0x53')](_0xa3a9e0[_0xb687('0x48')],_0x19a21c['filters']),_0x3e886d);var _0x5d92e7=[];var _0x214ee3=squel[_0xb687('0x54')]()[_0xb687('0x55')]('id')[_0xb687('0x55')](_0xb687('0x3b'))[_0xb687('0x55')](_0xb687('0x56'))[_0xb687('0x57')]('tools_tags');var _0xe39007=squel[_0xb687('0x54')]()[_0xb687('0x55')]('u.id')['field']('u.fullname')['field'](_0xb687('0x58'))[_0xb687('0x57')](_0xb687('0x59'),'ui')[_0xb687('0x5a')](_0xb687('0x5b'),'u',_0xb687('0x5c'));var _0x21d795=squel[_0xb687('0x54')]()[_0xb687('0x57')](_0xb687('0x5d'),'i')[_0xb687('0x5a')](_0xb687('0x5e'),'c',_0xb687('0x5f'))[_0xb687('0x5a')](_0xb687('0x5b'),'o',_0xb687('0x60'))[_0xb687('0x5a')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0xb687('0x5a')](_0xb687('0x61'),'me',_0xb687('0x62'))[_0xb687('0x5a')]('chat_interaction_has_tags','it',_0xb687('0x63'))[_0xb687('0x5a')]('tools_tags','t',_0xb687('0x64'));var _0x5b87cd=squel[_0xb687('0x65')]();var _0x1cd045=[];var _0x50fb31=squel['expr']();var _0x13ad6a;if(_0xa3a9e0[_0xb687('0x48')]['search']){_0x13ad6a=as[_0xb687('0x66')](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x67')]);var _0x50c7e0=_0x13ad6a[_0xb687('0x68')];for(var _0x5b3c93=0x0;_0x5b3c93<_0x13ad6a[_0xb687('0x69')][_0xb687('0x4e')];_0x5b3c93++){var _0x3223f8=_0x13ad6a[_0xb687('0x69')][_0x5b3c93];var _0x819b63='i';var _0x49b403=_['find'](_0x3e886d,[_0xb687('0x3b'),_0x3223f8['field']]);if(!_0x49b403){switch(_0x3223f8['field']){case'unreadMessages':if(_0x3223f8['value']==0x1){_0x21d795[_0xb687('0x6a')]('`'+_0x3223f8[_0xb687('0x55')]+_0xb687('0x6b'));}else{_0x21d795[_0xb687('0x6a')]('`'+_0x3223f8[_0xb687('0x55')]+_0xb687('0x6c'));}break;case _0xb687('0x6d'):if(_0x3223f8[_0xb687('0x6e')]===_0xb687('0x6f')){if(_0x3223f8[_0xb687('0x70')][_0xb687('0x71')]('\x20')['length']>0x1){_0x5b87cd[_0x50c7e0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb687('0x72')](_0x3223f8['value']),null);}else{var _0x667e39='%'+_0x3223f8[_0xb687('0x70')]+'%';_0x5b87cd[_0x50c7e0](_0xb687('0x73'),_0x667e39,_0x667e39,_0x667e39);}}else{_0x49b403=_[_0xb687('0x74')](_0x3e886d,[_0xb687('0x3b'),'ContactId']);_0x3223f8[_0xb687('0x55')]='ContactId';_0x8dc972=as[_0xb687('0x75')](_0x819b63,_0x49b403[_0xb687('0x45')],_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972[_0xb687('0x70')][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')][_0xb687('0x31')]);}break;case'Tag':var _0x28a6aa=_0x3223f8[_0xb687('0x70')][_0xb687('0x71')](',')[_0xb687('0x3e')](function(_0x258caf){return Number(_0x258caf);});_0x28a6aa['forEach'](function(_0x2bd850){_0x50fb31['or'](_0xb687('0x78'),'%,'+_0x2bd850+',%');});_0x1cd045=_[_0xb687('0x79')](_0x1cd045,_0x28a6aa);break;case _0xb687('0x7a'):if(_0x3223f8[_0xb687('0x6e')]===_0xb687('0x6f')){_0x5b87cd[_0x50c7e0](_0xb687('0x7b'),'%'+_0x3223f8[_0xb687('0x70')]+'%',null);}else{_0x49b403=_[_0xb687('0x74')](_0x3e886d,[_0xb687('0x3b'),_0xb687('0x7c')]);_0x3223f8['field']=_0xb687('0x7c');_0x8dc972=as[_0xb687('0x75')](_0x819b63,_0x49b403[_0xb687('0x45')],_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972['value'][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')]['end']);}break;case _0xb687('0x7d'):_0x8dc972=as[_0xb687('0x75')]('me',null,_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972['value'][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')]['end']);break;}}else{var _0x8dc972=as[_0xb687('0x75')](_0x819b63,_0x49b403[_0xb687('0x45')],_0x3223f8);_0x5b87cd[_0x50c7e0](_0x8dc972[_0xb687('0x76')],_0x8dc972['value'][_0xb687('0x77')],_0x8dc972[_0xb687('0x70')]['end']);}}}else{var _0x1c2c65=_(_0xa3a9e0[_0xb687('0x48')])['keys']()['map'](function(_0x2d8fc1){return _['some'](_0x3e886d,[_0xb687('0x3b'),_0x2d8fc1])?_0x2d8fc1:undefined;})[_0xb687('0x7e')]()[_0xb687('0x70')]();if(!_[_0xb687('0x7f')](_0x1c2c65)){_0x1c2c65[_0xb687('0x42')](function(_0x30031b){if(_0x30031b===_0xb687('0x80')){_0x21d795[_0xb687('0x81')]('i.ChatWebsiteId\x20IN\x20?',[][_0xb687('0x82')](_0xa3a9e0[_0xb687('0x48')][_0x30031b]));}else if(_0x30031b===_0xb687('0x83')){var _0x3c49dc=JSON[_0xb687('0x84')](_0xa3a9e0[_0xb687('0x48')][_0x30031b])['$gte'];var _0x451ce9=JSON[_0xb687('0x84')](_0xa3a9e0['query'][_0x30031b])[_0xb687('0x85')];_0x21d795[_0xb687('0x81')](_0xb687('0x86'),_0x3c49dc,_0x451ce9);}else{if(_0xa3a9e0[_0xb687('0x48')][_0x30031b]==='null'){_0x21d795[_0xb687('0x81')]('i.'+_0x30031b+'\x20IS\x20NULL');}else{_0x21d795['where']('i.'+_0x30031b+_0xb687('0x87'),_0xa3a9e0['query'][_0x30031b]);}}});}if(_0xa3a9e0['query'][_0xb687('0x88')]){if(_0xa3a9e0['query'][_0xb687('0x88')]==0x1){_0x21d795[_0xb687('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x21d795[_0xb687('0x6a')](_0xb687('0x89'));}}if(_0xa3a9e0['query'][_0xb687('0x8a')]){_0x1cd045=_[_0xb687('0x8b')](_0xa3a9e0[_0xb687('0x48')][_0xb687('0x8a')])?_0xa3a9e0[_0xb687('0x48')][_0xb687('0x8a')]:new Array(_0xa3a9e0[_0xb687('0x48')][_0xb687('0x8a')]);_0x1cd045[_0xb687('0x42')](function(_0x4092a0){_0x50fb31['or'](_0xb687('0x78'),'%,'+_0x4092a0+',%');});}if(_0xa3a9e0['query'][_0xb687('0x8c')]){var _0x4f190f=_0xa3a9e0['query'][_0xb687('0x8c')][_0xb687('0x8d')]('\x5c','\x5c\x5c')[_0xb687('0x8d')]('\x27\x27',_0xb687('0x8e'));if(qs[_0xb687('0x8f')](_0x4f190f)){_0x5b87cd['or']('i.id\x20LIKE\x20?',_0x4f190f+'%');}else{_0x5b87cd['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb687('0x72')](_0x4f190f))['or'](_0xb687('0x90'),_0x4f190f+'%');}}}_0x21d795[_0xb687('0x81')](_0x5b87cd);_0x21d795[_0xb687('0x91')]('i.id');var _0x448d59={'type':db[_0xb687('0x23')][_0xb687('0x92')][_0xb687('0x93')],'raw':!![]};var _0x16872d=_0x21d795[_0xb687('0x94')]();_0x16872d[_0xb687('0x55')](_0xb687('0x95'));_0x16872d[_0xb687('0x55')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb687('0x96'));if(_0x515985[_0xb687('0x51')]){_0x515985[_0xb687('0x51')][_0xb687('0x42')](function(_0x3cbc92){_0x21d795['order']('i.'+_0x3cbc92[0x0],_0x3cbc92[0x1]===_0xb687('0x97')?![]:!![]);});}if(!_[_0xb687('0x7f')](_0x1cd045)){_0x21d795['having'](_0x50fb31);_0x16872d[_0xb687('0x81')]('t.id\x20IN\x20?',_0x1cd045);}BPromise[_0xb687('0x98')]()[_0xb687('0x25')](function(){if(!_0x13ad6a){if(_0xa3a9e0['query'][_0xb687('0x80')]||_0xa3a9e0[_0xb687('0x48')]['journey'])return;_0x16872d[_0xb687('0x81')](_0xb687('0x99'));_0x21d795[_0xb687('0x81')](_0xb687('0x99'));return;}return _0xa3a9e0[_0xb687('0x9a')][_0xb687('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x105ad2){if(_[_0xb687('0x7f')](_0x105ad2)){_0x16872d[_0xb687('0x81')](_0xb687('0x9c'));_0x21d795[_0xb687('0x81')](_0xb687('0x9c'));}else{_0x16872d[_0xb687('0x81')](_0xb687('0x9d'),_[_0xb687('0x3e')](_0x105ad2,'id'));_0x21d795[_0xb687('0x81')](_0xb687('0x9d'),_['map'](_0x105ad2,'id'));}});})[_0xb687('0x25')](function(){db['sequelize'][_0xb687('0x48')](_0x16872d[_0xb687('0x9e')](),_0x448d59)['then'](function(_0x4c484f){_0x5f1b59[_0xb687('0x33')]=_0x4c484f[_0xb687('0x4e')];if(_0x5f1b59[_0xb687('0x33')]===0x0)return[];return db[_0xb687('0x9f')][_0xb687('0x48')](_0x214ee3[_0xb687('0x9e')](),_0x448d59)[_0xb687('0x25')](function(_0xbf6e66){_0x5d92e7=_[_0xb687('0xa0')](_0xbf6e66,'id');_0x448d59=_[_0xb687('0xa1')](_0x448d59,{'model':db[_0xb687('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa3a9e0[_0xb687('0x48')][_0xb687('0x4c')]){_0x515985[_0xb687('0x4d')][_0xb687('0x42')](function(_0x3f45b7){_0x21d795['field']('i.'+_0x3f45b7);});}else{_0x21d795['field'](_0xb687('0xa3'),'unreadMessages');_0x21d795['field'](_0xb687('0xa4'),_0xb687('0xa5'));_0x21d795['field'](_0xb687('0xa6'),_0xb687('0xa7'));_0x21d795['field'](_0xb687('0xa8'));_0x21d795[_0xb687('0x55')](_0xb687('0xa9'),_0xb687('0xaa'));_0x21d795[_0xb687('0x55')](_0xb687('0xab'),_0xb687('0xac'));_0x21d795[_0xb687('0x55')](_0xb687('0xad'),'Contact.email');_0x21d795[_0xb687('0x55')](_0xb687('0xae'),'Contact.phone');_0x21d795[_0xb687('0x55')]('c.mobile',_0xb687('0xaf'));_0x21d795[_0xb687('0x55')]('c.fax',_0xb687('0xb0'));_0x21d795[_0xb687('0x55')](_0xb687('0xb1'),_0xb687('0xb2'));_0x21d795[_0xb687('0x55')](_0xb687('0xb3'),_0xb687('0xb4'));_0x21d795['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb687('0x41'));}if(_0x515985['limit'])_0x21d795[_0xb687('0x35')](_0x515985[_0xb687('0x35')]);if(_0x515985[_0xb687('0x34')])_0x21d795[_0xb687('0x34')](_0x515985['offset']);return db[_0xb687('0x9f')][_0xb687('0x48')](_0x21d795['toString'](),_0x448d59);})[_0xb687('0x25')](function(_0x4546c5){_0xe39007[_0xb687('0x81')](_0xb687('0xb5'),_[_0xb687('0x3e')](_0x4546c5,'id'));return db[_0xb687('0x9f')]['query'](_0xe39007[_0xb687('0x9e')](),_0x448d59)[_0xb687('0x25')](function(_0x9ba6c0){var _0x1a8913=_[_0xb687('0xb6')](_0x9ba6c0,_0xb687('0xb7'));var _0x1290c0=[];_0x4546c5[_0xb687('0x42')](function(_0x1411bf){_0x1290c0[_0xb687('0x43')](updateChatInteraction(_0x1411bf,_0x5d92e7,_0x1a8913));});return BPromise['all'](_0x1290c0);});});})['then'](function(_0x40a3ce){_0x5f1b59[_0xb687('0xb8')]=_0x40a3ce;return _0x5f1b59;})[_0xb687('0x25')](respondWithFilteredResult(_0x430364,_0x515985));})[_0xb687('0x2e')](handleError(_0x430364,null));};exports[_0xb687('0xb9')]=function(_0x2fed73,_0x286f5b){var _0x11f925={'raw':![],'where':{'id':_0x2fed73['params']['id']}},_0x24d2c8={};_0x24d2c8['model']=_['keys'](db[_0xb687('0xa2')][_0xb687('0x44')]);_0x24d2c8[_0xb687('0x48')]=_[_0xb687('0x49')](_0x2fed73[_0xb687('0x48')]);_0x24d2c8[_0xb687('0x4a')]=_[_0xb687('0x4b')](_0x24d2c8[_0xb687('0x47')],_0x24d2c8['query']);_0x11f925[_0xb687('0x4d')]=_[_0xb687('0x4b')](_0x24d2c8[_0xb687('0x47')],qs[_0xb687('0x4c')](_0x2fed73[_0xb687('0x48')][_0xb687('0x4c')]));_0x11f925[_0xb687('0x4d')]=_0x11f925[_0xb687('0x4d')]['length']?_0x11f925[_0xb687('0x4d')]:_0x24d2c8['model'];if(_0x2fed73[_0xb687('0x48')][_0xb687('0xba')]){_0x11f925['include']=[{'all':!![]}];}_0x11f925=_[_0xb687('0xa1')]({},_0x11f925,_0x2fed73[_0xb687('0xbb')]);return db[_0xb687('0xa2')]['find'](_0x11f925)[_0xb687('0x25')](handleEntityNotFound(_0x286f5b,null))[_0xb687('0x25')](respondWithResult(_0x286f5b,null))[_0xb687('0x2e')](handleError(_0x286f5b,null));};exports[_0xb687('0xbc')]=function(_0x3d4596,_0x1e37ce){return db[_0xb687('0xa2')]['create'](_0x3d4596[_0xb687('0x7d')],{})[_0xb687('0x25')](respondWithResult(_0x1e37ce,0xc9))[_0xb687('0x2e')](handleError(_0x1e37ce,null));};exports[_0xb687('0xbd')]=function(_0x401b7e,_0x4e0712){if(_0x401b7e[_0xb687('0x7d')]['id']){delete _0x401b7e[_0xb687('0x7d')]['id'];}return db[_0xb687('0xa2')]['find']({'where':{'id':_0x401b7e[_0xb687('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4e0712,null))[_0xb687('0x25')](saveUpdates(_0x401b7e[_0xb687('0x7d')],null))['then'](respondWithResult(_0x4e0712,null))[_0xb687('0x2e')](handleError(_0x4e0712,null));};exports[_0xb687('0xbf')]=function(_0x1ef403,_0x5532e4){return db[_0xb687('0xa2')][_0xb687('0x74')]({'where':{'id':_0x1ef403[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x5532e4,null))[_0xb687('0x25')](removeEntity(_0x5532e4,null))[_0xb687('0x2e')](handleError(_0x5532e4,null));};exports[_0xb687('0xc0')]=function(_0x32e116,_0x8f6ba0){return db['ChatInteraction'][_0xb687('0xc0')]()[_0xb687('0x25')](respondWithResult(_0x8f6ba0,null))[_0xb687('0x2e')](handleError(_0x8f6ba0,null));};exports['createVidaooSession']=function(_0x4c7f4c,_0x2ac9ef){var _0x4d6600=_0x4c7f4c[_0xb687('0xbe')]['id'];var _0x1d21ef;var _0x386d12;var _0x4dd8f4;return db['ChatInteraction'][_0xb687('0xc1')]({'where':{'id':_0x4d6600}})[_0xb687('0x25')](function(_0x2b432d){_0x1d21ef=_0x2b432d;return db[_0xb687('0xc2')][_0xb687('0xc1')]({'where':{'id':_0x2b432d['ChatWebsiteId']},'attributes':['id',_0xb687('0xc3'),_0xb687('0xc4')],'raw':!![]});})['then'](function(_0x1ad9fc){if(_0x1ad9fc&&_0x1ad9fc[_0xb687('0xc3')]&&_0x1ad9fc['vidaooEscalation']){_0x386d12=_0x1ad9fc;var _0x2daf62={'rejectUnauthorized':![],'method':_0xb687('0xc5'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x1ad9fc[_0xb687('0xc3')]},'body':{'name':_0xb687('0xc6')+_0x4d6600},'redirect':_0xb687('0xc7'),'json':!![]};return rp(_0x2daf62);}else{throw new db[(_0xb687('0x23'))][(_0xb687('0xc8'))](_0xb687('0xc9'));}})[_0xb687('0x25')](function(_0x532201){_0x4dd8f4=_0x532201;if(_0x4dd8f4['id']){var _0x394a94={'body':_0x4dd8f4['join_url'],'ChatWebsiteId':_0x386d12['id'],'ChatInteractionId':_0x1d21ef['id'],'direction':_0xb687('0xca'),'UserId':_0x4c7f4c[_0xb687('0x9a')]['id']};return db[_0xb687('0xcb')][_0xb687('0xbc')](_0x394a94,{});}else{throw new db['Sequelize'][(_0xb687('0xc8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1d21ef[_0xb687('0xcc')]({'vidaooSessionId':_0x4dd8f4['id']});})[_0xb687('0x25')](respondWithResult(_0x2ac9ef,null))[_0xb687('0x2e')](handleError(_0x2ac9ef,null));};exports['customUpdate']=function(_0x258497,_0x219b35){if(_0x258497['body']['id']){delete _0x258497[_0xb687('0x7d')]['id'];}return db['ChatInteraction'][_0xb687('0x74')]({'where':{'id':_0x258497[_0xb687('0xbe')]['id']}})['then'](handleEntityNotFound(_0x219b35,null))[_0xb687('0x25')](saveUpdates(_0x258497['body'],null))[_0xb687('0x25')](respondWithResult(_0x219b35,null))['catch'](handleError(_0x219b35,null));};exports['abandon']=function(_0x303738,_0x3904a3,_0x581338){if(_0x303738[_0xb687('0x7d')]['id']){delete _0x303738['body']['id'];}return db[_0xb687('0xa2')][_0xb687('0x74')]({'where':{'id':_0x303738[_0xb687('0xbe')]['id']}})['then'](function(_0xc29834){if(!_0xc29834){logger[_0xb687('0x2a')](_0xb687('0xcd'),_0xb687('0xce'),0x194,_0xb687('0xcf'));_0x3904a3[_0xb687('0x2f')](0x194);}else{if(_0xc29834['UserId']){throw new db[(_0xb687('0x23'))][(_0xb687('0xc8'))](_0xb687('0xd0'));}}return _0xc29834;})[_0xb687('0x25')](function(_0x3591e2){if(_0x3591e2){return _0x3591e2['update']({'closed':_0x303738['body'][_0xb687('0xd1')],'disposition':_0x303738[_0xb687('0x7d')][_0xb687('0xd2')]})[_0xb687('0x25')](function(_0x33f4de){return _0x33f4de;});}})[_0xb687('0x25')](function(_0x87c14c){return respondWithRpcPromise('AbandonInteraction',_0xb687('0xce'),_0x303738[_0xb687('0x7d')],client9004);})[_0xb687('0x25')](respondWithResult(_0x3904a3,null))['catch'](handleError(_0x3904a3,null));};exports[_0xb687('0xd3')]=function(_0x300448,_0x15e9d2,_0x4b65c4){_0x300448[_0xb687('0x7d')][_0xb687('0x3b')]=_0x300448['file'][_0xb687('0xd4')];_0x300448[_0xb687('0x7d')][_0xb687('0xd5')]=_0x300448[_0xb687('0xd6')]['filename'];_0x300448[_0xb687('0x7d')][_0xb687('0x45')]=_0x300448[_0xb687('0xd6')][_0xb687('0xd7')];return db[_0xb687('0xd8')]['create'](_0x300448[_0xb687('0x7d')])[_0xb687('0x25')](respondWithResult(_0x15e9d2,0xc9))['catch'](handleError(_0x15e9d2,null));};exports[_0xb687('0xd9')]=function(_0x343e6b,_0x4c40b1,_0x45525a){return db[_0xb687('0xa2')][_0xb687('0xc1')]({'where':{'id':_0x343e6b['params']['id']},'raw':!![]})[_0xb687('0x25')](handleEntityNotFound(_0x4c40b1,null))[_0xb687('0x25')](function(_0x5e2200){if(_0x5e2200){if(_0x5e2200['closed']){return _0x4c40b1['status'](0x193)[_0xb687('0x32')]({'status':0x193,'message':'Unauthorized'});}return db[_0xb687('0xd8')][_0xb687('0xc1')]({'where':{'id':_0x343e6b[_0xb687('0x48')][_0xb687('0xda')]},'raw':!![]})[_0xb687('0x25')](handleEntityNotFound(_0x4c40b1,null));}})['then'](function(_0x4a6d20){if(_0x4a6d20){return _0x4c40b1[_0xb687('0xdb')](path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0xde'),_0x4a6d20[_0xb687('0xd5')]));}})[_0xb687('0x2e')](handleError(_0x4c40b1,null));};exports[_0xb687('0xdf')]=function(_0x4d39fc,_0x4a5102){var _0x4a7895=null;var _0x2c9199=null;var _0x29d687=null;var _0x19e253=null;if(_0x4d39fc['body']['id']){delete _0x4d39fc['body']['id'];}if(_0x4d39fc['body'][_0xb687('0xe0')]){_0x19e253=path['join'](config[_0xb687('0xdd')],_0xb687('0xe1'),util[_0xb687('0xe2')](_0xb687('0xe3'),Date[_0xb687('0xe4')]()));_0x4d39fc[_0xb687('0x7d')]['pathTranscript']=_0x19e253;}return db['ChatInteraction']['find']({'where':{'id':_0x4d39fc[_0xb687('0xbe')]['id']},'include':[{'model':db[_0xb687('0xcb')],'as':_0xb687('0xe5'),'include':[{'model':db[_0xb687('0x7a')],'as':_0xb687('0x7a')}]}]})[_0xb687('0x25')](handleEntityNotFound(_0x4a5102,null))[_0xb687('0x25')](saveUpdates(_0x4d39fc['body'],null))[_0xb687('0x25')](function(_0x292739){if(_0x292739){_0x4a7895=_0x292739;return db[_0xb687('0xc2')][_0xb687('0x74')]({'where':{'id':_0x4a7895[_0xb687('0x80')]}});}})['then'](function(_0x1764ee){if(_0x1764ee){_0x29d687=_0x1764ee;return db[_0xb687('0xe6')][_0xb687('0x74')]({'where':{'id':_0x4a7895['ContactId']}});}})[_0xb687('0x25')](function(_0x2ed4bf){if(_0x2ed4bf){_0x2c9199=_0x2ed4bf;if(_0x19e253){var _0x2bb569=null;for(var _0x1a1d48=0x1;_0x1a1d48<_0x4a7895[_0xb687('0xe5')][_0xb687('0x4e')];++_0x1a1d48){_0x2bb569=_0x4a7895[_0xb687('0xe5')][_0x1a1d48];var _0x3492aa=_0x2bb569[_0xb687('0x7c')]?util[_0xb687('0xe2')](_0xb687('0xe7'),_0x29d687[_0xb687('0xe8')],_0x2bb569[_0xb687('0x7c')]):_0xb687('0xe9');var _0x35952a=_0x4d39fc['body'][_0xb687('0xea')]||util[_0xb687('0xe2')](_0xb687('0xe7'),'Visitor',_0x2bb569[_0xb687('0xeb')]);switch(_0x29d687[_0xb687('0xec')]){case'website_alias':_0x3492aa=_0x2bb569[_0xb687('0x7c')]?util['format'](_0xb687('0xe7'),_0x29d687[_0xb687('0xe8')],_0x2bb569[_0xb687('0x7c')]):'System';break;case _0xb687('0xed'):_0x3492aa=_0x2bb569[_0xb687('0x7c')]?_0x2bb569[_0xb687('0x7a')][_0xb687('0xee')]||_0x2bb569['User']['fullname']:_0xb687('0xe9');break;case _0xb687('0xef'):_0x3492aa=_0x2bb569[_0xb687('0x7c')]?_0x2bb569[_0xb687('0x7a')][_0xb687('0x3f')]:_0xb687('0xe9');break;default:_0x3492aa=_0x2bb569['UserId']?util[_0xb687('0xe2')](_0xb687('0xe7'),_0x29d687[_0xb687('0xe8')],_0x2bb569['UserId']):_0xb687('0xe9');}var _0x8717e5=util[_0xb687('0xe2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2bb569['createdAt'])['format'](_0xb687('0xf0')),_0x2bb569['direction']==='in'?_0x35952a:_0x3492aa,_0x2bb569['body']);if(!_0x2bb569['secret']){fs[_0xb687('0xf1')](_0x19e253,_0x8717e5);}}return db[_0xb687('0xf2')][_0xb687('0xc1')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb687('0xf3'),'raw':!![]}]});}}})[_0xb687('0x25')](function(_0x1cb9e1){if(_0x1cb9e1&&_0x1cb9e1[_0xb687('0xf3')]&&_0x4d39fc[_0xb687('0x7d')]){var _0x532c69={'tls':{'rejectUnauthorized':![]}};if(_0x1cb9e1[_0xb687('0xf3')][_0xb687('0xf4')]){_0x532c69[_0xb687('0xf4')]=_0x1cb9e1[_0xb687('0xf3')][_0xb687('0xf4')];}else{_0x532c69[_0xb687('0xf5')]=_0x1cb9e1[_0xb687('0xf3')][_0xb687('0xf5')];_0x532c69[_0xb687('0xf6')]=_0x1cb9e1['Smtp'][_0xb687('0xf6')];_0x532c69[_0xb687('0xf7')]=_0x1cb9e1['Smtp'][_0xb687('0xf7')];}if(_0x1cb9e1['Smtp'][_0xb687('0xf8')]){_0x532c69[_0xb687('0xf9')]={'user':_0x1cb9e1[_0xb687('0xf3')][_0xb687('0x9a')],'pass':_0x1cb9e1[_0xb687('0xf3')]['pass']};}return respondWithRpcPromise(_0xb687('0xfa'),'sendMail',{'account':_0x532c69,'message':{'from':util['format'](_0xb687('0xfb'),_0x1cb9e1[_0xb687('0x3b')],_0x1cb9e1['email']||_0x1cb9e1[_0xb687('0xf3')][_0xb687('0x9a')]),'to':_0x4d39fc[_0xb687('0x7d')][_0xb687('0xe0')],'subject':_0xb687('0xfc'),'text':util[_0xb687('0xe2')](_0xb687('0xfd'),_0x4d39fc[_0xb687('0x7d')][_0xb687('0xe0')]),'attachments':[{'path':_0x19e253}]}})[_0xb687('0x25')](function(){return _0x4a7895;})['catch'](function(_0x5a39a2){console['error'](_0x5a39a2);});}else{return _0x4a7895;}})[_0xb687('0x25')](respondWithStatusCode(_0x4a5102,0xc8))[_0xb687('0x2e')](handleError(_0x4a5102,null));};exports[_0xb687('0xfe')]=function(_0x5d49ea,_0x5e585,_0x36ea67){return db[_0xb687('0xcb')]['find']({'where':{'id':_0x5d49ea[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x5e585,null))[_0xb687('0x25')](function(_0x5915a8){if(_0x5915a8){return _0x5915a8['addMessage'](_0x5d49ea[_0xb687('0x7d')][_0xb687('0xff')],_[_0xb687('0x100')](_0x5d49ea[_0xb687('0x7d')],[_0xb687('0xff'),'id'])||{});}})[_0xb687('0x25')](respondWithResult(_0x5e585,null))['catch'](handleError(_0x5e585,null));};exports[_0xb687('0x101')]=function(_0x22191b,_0x5cad1b,_0x3ce6dd){var _0x1e4fc9={'raw':![],'where':{}};var _0xeb37b0={};var _0x13f9b7={'count':0x0,'rows':[]};return db[_0xb687('0xa2')][_0xb687('0xc1')]({'where':{'id':_0x22191b[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x5cad1b,null))['then'](function(_0xd68690){if(_0xd68690){_0xeb37b0[_0xb687('0x47')]=_['keys'](db[_0xb687('0xcb')][_0xb687('0x44')]);_0xeb37b0['query']=_[_0xb687('0x49')](_0x22191b[_0xb687('0x48')]);_0xeb37b0['filters']=_['intersection'](_0xeb37b0[_0xb687('0x47')],_0xeb37b0[_0xb687('0x48')]);_0x1e4fc9[_0xb687('0x4d')]=_[_0xb687('0x4b')](_0xeb37b0[_0xb687('0x47')],qs[_0xb687('0x4c')](_0x22191b['query'][_0xb687('0x4c')]));_0x1e4fc9['attributes']=_0x1e4fc9[_0xb687('0x4d')][_0xb687('0x4e')]?_0x1e4fc9[_0xb687('0x4d')]:_0xeb37b0[_0xb687('0x47')];if(!_0x22191b[_0xb687('0x48')][_0xb687('0x4f')](_0xb687('0x50'))){_0x1e4fc9[_0xb687('0x35')]=qs['limit'](_0x22191b[_0xb687('0x48')][_0xb687('0x35')]);_0x1e4fc9['offset']=qs[_0xb687('0x34')](_0x22191b[_0xb687('0x48')]['offset']);}_0x1e4fc9[_0xb687('0x51')]=qs[_0xb687('0x52')](_0x22191b[_0xb687('0x48')][_0xb687('0x52')]);_0x1e4fc9[_0xb687('0x81')]=qs[_0xb687('0x4a')](_['pick'](_0x22191b[_0xb687('0x48')],_0xeb37b0[_0xb687('0x4a')]));_0x1e4fc9[_0xb687('0x81')]['ChatInteractionId']=_0xd68690['id'];if(_0x22191b[_0xb687('0x48')]['filter']){_0x1e4fc9[_0xb687('0x81')]=_[_0xb687('0xa1')](_0x1e4fc9[_0xb687('0x81')],{'$or':_[_0xb687('0x3e')](_0x1e4fc9[_0xb687('0x4d')],function(_0x25718a){var _0x28a3f0={};_0x28a3f0[_0x25718a]={'$like':'%'+_0x22191b[_0xb687('0x48')][_0xb687('0x8c')]+'%'};return _0x28a3f0;})});}if(_0x22191b[_0xb687('0x48')][_0xb687('0x102')]){var _0x4123b4=_0x22191b[_0xb687('0x48')]['$gte'][_0xb687('0x71')](',');var _0x3d7e26={};_0x3d7e26[_0x4123b4[0x0]]={'$gte':moment(_0x4123b4[0x1])['format'](_0xb687('0x103'))};_0x1e4fc9[_0xb687('0x81')]=_[_0xb687('0xa1')](_0x1e4fc9[_0xb687('0x81')],_0x3d7e26);}_0x1e4fc9=_[_0xb687('0xa1')]({},_0x1e4fc9,_0x22191b['options']);return db[_0xb687('0xcb')][_0xb687('0x33')]({'where':_0x1e4fc9['where']})[_0xb687('0x25')](function(_0x34400c){_0x13f9b7[_0xb687('0x33')]=_0x34400c;if(_0x22191b[_0xb687('0x48')][_0xb687('0xba')]){_0x1e4fc9[_0xb687('0x104')]=[{'all':!![]}];}return db[_0xb687('0xcb')][_0xb687('0x105')](_0x1e4fc9);})[_0xb687('0x25')](function(_0x5941d5){_0x13f9b7['rows']=_0x5941d5;return _0x13f9b7;});}})[_0xb687('0x25')](respondWithFilteredResult(_0x5cad1b,_0x1e4fc9))[_0xb687('0x2e')](handleError(_0x5cad1b,null));};exports['getMyMessages']=function(_0x2bb3b9,_0xf0720d,_0x4de920){var _0x2fdf5d={'where':{}},_0x8ccc33={},_0x36158a={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x2bb3b9['params']['id']}})[_0xb687('0x25')](handleEntityNotFound(_0xf0720d,null))[_0xb687('0x25')](function(_0x4b6a00){if(_0x4b6a00){_0x8ccc33[_0xb687('0x47')]=_[_0xb687('0x49')](db['ChatMessage'][_0xb687('0x44')]);_0x8ccc33[_0xb687('0x48')]=_['keys'](_0x2bb3b9[_0xb687('0x48')]);_0x8ccc33['filters']=_[_0xb687('0x4b')](_0x8ccc33[_0xb687('0x47')],_0x8ccc33['query']);_0x2fdf5d[_0xb687('0x4d')]=_[_0xb687('0x4b')](_0x8ccc33[_0xb687('0x47')],qs[_0xb687('0x4c')](_0x2bb3b9['query']['fields']));_0x2fdf5d[_0xb687('0x4d')]=_0x2fdf5d[_0xb687('0x4d')][_0xb687('0x4e')]?_0x2fdf5d[_0xb687('0x4d')]:_0x8ccc33[_0xb687('0x47')];if(!_0x2bb3b9[_0xb687('0x48')][_0xb687('0x4f')]('nolimit')){_0x2fdf5d[_0xb687('0x35')]=qs['limit'](_0x2bb3b9[_0xb687('0x48')]['limit']);_0x2fdf5d[_0xb687('0x34')]=qs[_0xb687('0x34')](_0x2bb3b9[_0xb687('0x48')][_0xb687('0x34')]);}_0x2fdf5d['order']=qs['sort'](_0x2bb3b9[_0xb687('0x48')][_0xb687('0x52')]);_0x2fdf5d[_0xb687('0x81')]=qs[_0xb687('0x4a')](_[_0xb687('0x53')](_0x2bb3b9[_0xb687('0x48')],_0x8ccc33[_0xb687('0x4a')]));_0x2fdf5d['where'][_0xb687('0xb7')]=_0x4b6a00['id'];if(_0x2bb3b9[_0xb687('0x48')]['filter']){_0x2fdf5d[_0xb687('0x81')]=_[_0xb687('0xa1')](_0x2fdf5d[_0xb687('0x81')],{'$or':_[_0xb687('0x3e')](_0x2fdf5d[_0xb687('0x4d')],function(_0x57afac){var _0x14c7a6={};_0x14c7a6[_0x57afac]={'$like':'%'+_0x2bb3b9[_0xb687('0x48')]['filter']+'%'};return _0x14c7a6;})});}_0x2fdf5d[_0xb687('0x81')][_0xb687('0x106')]=![];if(_0x2bb3b9[_0xb687('0x48')]['id']){_0x2fdf5d['where']['id']={'$gt':_0x2bb3b9['query']['id']};}_0x2fdf5d=_[_0xb687('0xa1')]({},_0x2fdf5d,_0x2bb3b9['options']);return db[_0xb687('0xcb')][_0xb687('0x33')]({'where':_0x2fdf5d[_0xb687('0x81')]})[_0xb687('0x25')](function(_0x482b4c){_0x36158a[_0xb687('0x33')]=_0x482b4c;_0x2fdf5d[_0xb687('0x104')]=[];if(_0x2bb3b9[_0xb687('0x48')][_0xb687('0x107')]){_0x2fdf5d['include'][_0xb687('0x43')]({'model':db['User'],'as':_0xb687('0x7a'),'attributes':['id','fullname',_0xb687('0xee')]});}if(_0x2bb3b9['query']['includeAll']){_0x2fdf5d['include']=[{'all':!![]}];}return db[_0xb687('0xcb')][_0xb687('0x105')](_0x2fdf5d);})[_0xb687('0x25')](function(_0x118df7){_0x36158a[_0xb687('0xb8')]=_0x118df7;return _0x36158a;});}})[_0xb687('0x25')](respondWithFilteredResult(_0xf0720d,_0x2fdf5d))['catch'](handleError(_0xf0720d,null));};exports['addTags']=function(_0x3f3ba2,_0x370043,_0x2d3f85){return db['ChatInteraction'][_0xb687('0x74')]({'where':{'id':_0x3f3ba2[_0xb687('0xbe')]['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x370043,null))[_0xb687('0x25')](function(_0x2a9fc0){if(_0x2a9fc0){return _0x2a9fc0['setTags'](_0x3f3ba2[_0xb687('0x7d')][_0xb687('0xff')],_[_0xb687('0x100')](_0x3f3ba2['body'],[_0xb687('0xff'),'id'])||{})[_0xb687('0x108')](function(){return db[_0xb687('0x109')][_0xb687('0x105')]({'attributes':['id',_0xb687('0x3b'),_0xb687('0x56')],'where':{'id':_0x3f3ba2[_0xb687('0x7d')][_0xb687('0xff')]}});})['then'](function(_0x476024){socket[_0xb687('0x10a')](_0xb687('0x10b'),{'id':Number(_0x3f3ba2[_0xb687('0xbe')]['id']),'tags':_0x476024||[]});return{'id':Number(_0x3f3ba2['params']['id']),'tags':_0x476024||[]};});}})[_0xb687('0x25')](respondWithResult(_0x370043,null))['catch'](handleError(_0x370043,null));};exports[_0xb687('0x10c')]=function(_0x4418e3,_0x261136,_0x5a107b){return db['ChatInteraction']['find']({'where':{'id':_0x4418e3['params']['id']}})[_0xb687('0x25')](handleEntityNotFound(_0x261136,null))[_0xb687('0x25')](function(_0x3ab472){if(_0x3ab472){return _0x3ab472[_0xb687('0x10c')](_0x4418e3['query'][_0xb687('0xff')]);}})[_0xb687('0x25')](respondWithStatusCode(_0x261136,null))[_0xb687('0x2e')](handleError(_0x261136,null));};exports['download']=function(_0x1c8ba9,_0x3309a4){var _0x378e6c=moment()['unix']()['toString']();var _0x29cd81=path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0x10d'),_0xb687('0x10e'),_0xb687('0x10f'));var _0xad8e24=path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0x10d'),'files',_0xb687('0x110'));var _0x4f0591=path[_0xb687('0xdc')](_0x29cd81,_0x378e6c);var _0x409f5f=util['format'](_0xb687('0x111'),_0x1c8ba9[_0xb687('0xbe')]['id'],_0x378e6c);var _0x3085d4=path[_0xb687('0xdc')](_0x29cd81,_0x409f5f);var _0x6b3c83=[];_0x6b3c83[_0xb687('0x43')]({'model':db[_0xb687('0x7a')],'as':_0xb687('0x7a'),'attributes':['id',_0xb687('0x3f')],'raw':!![]});_0x6b3c83[_0xb687('0x43')]({'model':db[_0xb687('0xe6')],'as':'Contact','attributes':['id',_0xb687('0x112'),_0xb687('0x113')],'raw':!![]});if(_0x1c8ba9[_0xb687('0x48')]['attachments']){_0x6b3c83[_0xb687('0x43')]({'model':db[_0xb687('0xd8')],'as':_0xb687('0xd8'),'raw':!![]});}var _0x9002c7=[{'model':db[_0xb687('0xcb')],'as':_0xb687('0xe5'),'attributes':['id',_0xb687('0x7d'),_0xb687('0x83'),'direction',_0xb687('0x106'),'read'],'include':_0x6b3c83}];_0x9002c7[_0xb687('0x43')]({'model':db[_0xb687('0xc2')],'as':_0xb687('0x114'),'attributes':['id',_0xb687('0x3b')]});_0x9002c7[_0xb687('0x43')]({'model':db[_0xb687('0x7a')],'as':'Owner','attributes':['id',_0xb687('0x3f')]});return db[_0xb687('0xa2')][_0xb687('0x74')]({'where':{'id':_0x1c8ba9[_0xb687('0xbe')]['id']},'include':_0x9002c7})['then'](handleEntityNotFound(_0x3309a4,null))[_0xb687('0x25')](function(_0x45ce7d){if(_0x45ce7d){var _0x3ff2d8=_0x45ce7d[_0xb687('0x115')]({'plain':!![]});fs[_0xb687('0x116')](_0x4f0591);var _0x32386f={'format':'A4','border':_0xb687('0x117'),'header':{'height':_0xb687('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':_0xb687('0x119'),'contents':{'default':util['format'](_0xb687('0x11a'),util[_0xb687('0xe2')](_0xb687('0x11b'),'Chat',_0x3ff2d8['id']),moment()[_0xb687('0xe2')]('YYYY-MM-DD')[_0xb687('0x9e')]())}}};var _0x129116={'channel':'Chat','account':_0x3ff2d8[_0xb687('0x114')][_0xb687('0x3b')],'agent':_0x3ff2d8[_0xb687('0x11c')]?_0x3ff2d8[_0xb687('0x11c')][_0xb687('0x3f')]:_0xb687('0x11d'),'createdAt':moment(_0x3ff2d8['createdAt'])['format'](_0xb687('0x103'))['toString'](),'closedAt':_0x3ff2d8[_0xb687('0xd1')]?moment(_0x3ff2d8[_0xb687('0x11e')])['format'](_0xb687('0x103'))['toString']():'','disposition':_0x3ff2d8[_0xb687('0xd2')],'chatInfo':{'browser':_0x3ff2d8[_0xb687('0x11f')],'os':_0x3ff2d8[_0xb687('0x120')],'referer':_0x3ff2d8['referer'],'customerIp':_0x3ff2d8['customerIp'],'customerPort':_0x3ff2d8[_0xb687('0x121')]?_0x3ff2d8[_0xb687('0x121')]:'N.A.'},'messages':_(_0x3ff2d8['Messages'])[_0xb687('0x122')]()['filter']({'secret':![]})['map'](function(_0x9009ea){if(_0x9009ea[_0xb687('0xd8')]){var _0x1bec8d=path[_0xb687('0xdc')](_0xad8e24,_0x9009ea[_0xb687('0xd8')][_0xb687('0xd5')]);if(fs[_0xb687('0x123')](_0x1bec8d)){fs[_0xb687('0x124')](_0x1bec8d)[_0xb687('0x125')](fs[_0xb687('0x126')](path[_0xb687('0xdc')](_0x4f0591,_0x9009ea[_0xb687('0xd8')][_0xb687('0xd5')])));}}return{'date':moment(_0x9009ea[_0xb687('0x83')])[_0xb687('0xe2')](_0xb687('0x103'))[_0xb687('0x9e')](),'sender':_0x9009ea[_0xb687('0x127')]==='out'?_0x9009ea[_0xb687('0x7a')]?_0x9009ea[_0xb687('0x7a')]['fullname']:_0xb687('0xe9'):_0x9009ea[_0xb687('0x6d')][_0xb687('0x112')]+(_0x9009ea[_0xb687('0x6d')][_0xb687('0x113')]?'\x20'+_0x9009ea['Contact'][_0xb687('0x113')]:''),'body':_0x9009ea[_0xb687('0xd8')]?_0x9009ea[_0xb687('0xd8')][_0xb687('0xd5')]:_0x9009ea[_0xb687('0x7d')],'direction':_0x9009ea['direction']===_0xb687('0xca')?'A':'C','secret':_0x9009ea[_0xb687('0x106')],'read':_0x9009ea[_0xb687('0x88')],'attachment':_0x9009ea['Attachment']};})[_0xb687('0x70')]()};return ejs['renderFile'](path[_0xb687('0xdc')](config[_0xb687('0xdd')],_0xb687('0x10d'),_0xb687('0x128'),_0xb687('0x129')),{'interaction':_0x129116})[_0xb687('0x25')](function(_0x51cb45){return new BPromise(function(_0x33f4a6,_0xb8cae6){pdf[_0xb687('0xbc')](_0x51cb45,_0x32386f)[_0xb687('0x12a')](path[_0xb687('0xdc')](_0x4f0591,_0xb687('0x12b')+_0x3ff2d8['id']+'-'+_0x378e6c+'.pdf'),function(_0x9d4dba,_0x5b1df3){if(_0x9d4dba)return _0xb8cae6(_0x9d4dba);_0x33f4a6(_0x5b1df3);});});})['then'](function(){return new BPromise(function(_0x570eb4,_0x4004a7){zipdir(_0x4f0591,{'saveTo':_0x3085d4},function(_0x4db889,_0x1e938f){if(_0x4db889)return _0x4004a7(_0x4db889);return _0x570eb4(_0x1e938f);});})['then'](function(){return new BPromise(function(_0x7754d7,_0x7b400a){rimraf(_0x4f0591,function(_0x252a54){if(_0x252a54)_0x7b400a(_0x252a54);return _0x7754d7();});});})[_0xb687('0x25')](function(){return _0x3309a4[_0xb687('0xdb')](_0x3085d4,_0x409f5f,function(_0x203830){if(_0x203830){console[_0xb687('0x12c')](_0xb687('0x12d'),_0x203830);}else{fs[_0xb687('0x12e')](_0x3085d4);}});});});}else{return _0x3309a4[_0xb687('0x2f')](0xc8);}})[_0xb687('0x2e')](handleError(_0x3309a4,null));}; \ No newline at end of file +var _0x8ace=['GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','catch','show','params','includeAll','include','options','update','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','basename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','download','join','root','server/files/attachments/','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','CmContact','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','omit','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','addTags','setTags','spread','emit','removeTags','unix','server','files','tmp','attachments','firstName','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.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','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','end','status','json','offset','limit','set','Content-Range','apply','sendStatus','stack','name','Users','map','fullname','Tags','TagIds','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','length','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','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?','QueryTypes','SELECT','i.id','order','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','count','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x37fa4f,_0x379eb2){_0x37fa4f=_0x37fa4f-0x0;var _0x17133f=_0x8ace[_0x37fa4f];return _0x17133f;};'use strict';var pdf=require(_0xe8ac('0x0'));var emlformat=require(_0xe8ac('0x1'));var rimraf=require(_0xe8ac('0x2'));var zipdir=require(_0xe8ac('0x3'));var jsonpatch=require(_0xe8ac('0x4'));var rp=require(_0xe8ac('0x5'));var moment=require(_0xe8ac('0x6'));var BPromise=require(_0xe8ac('0x7'));var Mustache=require(_0xe8ac('0x8'));var util=require(_0xe8ac('0x9'));var path=require(_0xe8ac('0xa'));var sox=require(_0xe8ac('0xb'));var csv=require(_0xe8ac('0xc'));var ejs=require(_0xe8ac('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe8ac('0xe'));var crypto=require(_0xe8ac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8ac('0xc'));var querystring=require('querystring');var Papa=require(_0xe8ac('0x10'));var Redis=require(_0xe8ac('0x11'));var authService=require(_0xe8ac('0x12'));var qs=require(_0xe8ac('0x13'));var as=require(_0xe8ac('0x14'));var hardwareService=require(_0xe8ac('0x15'));var logger=require('../../config/logger')(_0xe8ac('0x16'));var utils=require(_0xe8ac('0x17'));var config=require(_0xe8ac('0x18'));var db=require('../../mysqldb')['db'];config[_0xe8ac('0x19')]=_[_0xe8ac('0x1a')](config['redis'],{'host':_0xe8ac('0x1b'),'port':0x18eb});var socket=require(_0xe8ac('0x1c'))(new Redis(config[_0xe8ac('0x19')]));require(_0xe8ac('0x1d'))[_0xe8ac('0x1e')](socket);var jayson=require(_0xe8ac('0x1f'));var client=jayson[_0xe8ac('0x20')][_0xe8ac('0x21')]({'port':0x232b});var client9004=jayson[_0xe8ac('0x20')][_0xe8ac('0x21')]({'port':0x232c});function checkPasswordPattern(_0x5e4495,_0x224bda,_0x18ddb3){if(_0x18ddb3){var _0x4c3c76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c3c76[_0xe8ac('0x22')](_0x224bda)){return _0x5e4495;}else{throw new db[(_0xe8ac('0x23'))][(_0xe8ac('0x24'))](_0xe8ac('0x25'));}}else{return _0x5e4495;}}function respondWithRpcPromise(_0x25d219,_0x36759c,_0x4892d0,_0x59df3d){return new BPromise(function(_0x5f3433,_0x18cf29){var _0x24a346=_0x59df3d||client;return _0x24a346['request'](_0x25d219,_0x4892d0)[_0xe8ac('0x26')](function(_0x5bc15e){logger[_0xe8ac('0x27')](_0xe8ac('0x28'),_0x36759c,'request\x20sent');logger[_0xe8ac('0x29')](_0xe8ac('0x2a'),_0x36759c,_0xe8ac('0x2b'),JSON[_0xe8ac('0x2c')](_0x5bc15e));if(_0x5bc15e['error']){if(_0x5bc15e[_0xe8ac('0x2d')]['code']===0x1f4){logger[_0xe8ac('0x2d')](_0xe8ac('0x28'),_0x36759c,_0x5bc15e[_0xe8ac('0x2d')][_0xe8ac('0x2e')]);return _0x18cf29(_0x5bc15e[_0xe8ac('0x2d')][_0xe8ac('0x2e')]);}logger[_0xe8ac('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x36759c,_0x5bc15e[_0xe8ac('0x2d')][_0xe8ac('0x2e')]);return _0x5f3433(_0x5bc15e[_0xe8ac('0x2d')][_0xe8ac('0x2e')]);}else{logger[_0xe8ac('0x27')](_0xe8ac('0x28'),_0x36759c,_0xe8ac('0x2b'));_0x5f3433(_0x5bc15e[_0xe8ac('0x2f')][_0xe8ac('0x2e')]);}})['catch'](function(_0x5a1b69){logger[_0xe8ac('0x2d')](_0xe8ac('0x28'),_0x36759c,_0x5a1b69);_0x18cf29(_0x5a1b69);});});}function respondWithStatusCode(_0x59512c,_0x2a78c6){_0x2a78c6=_0x2a78c6||0xcc;return function(_0x5948aa){if(_0x5948aa){return _0x59512c['sendStatus'](_0x2a78c6);}return _0x59512c['status'](_0x2a78c6)[_0xe8ac('0x30')]();};}function respondWithResult(_0x41294e,_0x3798c5){_0x3798c5=_0x3798c5||0xc8;return function(_0x5d7562){if(_0x5d7562){return _0x41294e[_0xe8ac('0x31')](_0x3798c5)[_0xe8ac('0x32')](_0x5d7562);}};}function respondWithFilteredResult(_0x1a2ef7,_0x53caf0){return function(_0xc1947d){if(_0xc1947d){var _0x5459e5=_0xc1947d['count'],_0x2aef04=_0x53caf0['offset'],_0x5c4089=_0x53caf0[_0xe8ac('0x33')]+_0x53caf0[_0xe8ac('0x34')],_0x498427;if(_0x5c4089>=_0x5459e5){_0x5c4089=_0x5459e5;_0x498427=0xc8;}else{_0x498427=0xce;}_0x1a2ef7[_0xe8ac('0x31')](_0x498427);return _0x1a2ef7[_0xe8ac('0x35')](_0xe8ac('0x36'),_0x2aef04+'-'+_0x5c4089+'/'+_0x5459e5)[_0xe8ac('0x32')](_0xc1947d);}return null;};}function patchUpdates(_0x312743){return function(_0x553753){try{jsonpatch[_0xe8ac('0x37')](_0x553753,_0x312743,!![]);}catch(_0x539fad){return BPromise['reject'](_0x539fad);}return _0x553753['save']();};}function saveUpdates(_0x8a4478,_0x224bd4){return function(_0xc68a5f){if(_0xc68a5f){return _0xc68a5f['update'](_0x8a4478)['then'](function(_0x2d13ed){return _0x2d13ed;});}return null;};}function removeEntity(_0x2e95c4,_0x307f67){return function(_0x2850a7){if(_0x2850a7){return _0x2850a7['destroy']()[_0xe8ac('0x26')](function(){_0x2e95c4[_0xe8ac('0x31')](0xcc)[_0xe8ac('0x30')]();});}};}function handleEntityNotFound(_0x8736ff,_0x216c13){return function(_0x9e5777){if(!_0x9e5777){_0x8736ff[_0xe8ac('0x38')](0x194);}return _0x9e5777;};}function handleError(_0x55a3a4,_0x2e5f42){_0x2e5f42=_0x2e5f42||0x1f4;return function(_0x131b0b){logger['error'](_0x131b0b[_0xe8ac('0x39')]);if(_0x131b0b[_0xe8ac('0x3a')]){delete _0x131b0b[_0xe8ac('0x3a')];}_0x55a3a4[_0xe8ac('0x31')](_0x2e5f42)['send'](_0x131b0b);};}function getInteractionUsers(_0x97e206,_0x5e63b3){return new BPromise(function(_0x5cfcb6,_0x28f061){try{if(_0x5e63b3[_0x97e206['id']]){_0x97e206[_0xe8ac('0x3b')]=_[_0xe8ac('0x3c')](_0x5e63b3[_0x97e206['id']],function(_0x7f3445){return{'id':_0x7f3445['id'],'fullname':_0x7f3445[_0xe8ac('0x3d')]};});}}catch(_0x22d90b){_0x28f061(_0x22d90b);}_0x5cfcb6(_0x97e206);});}function getInteractionTags(_0x78f1ea,_0x1e2283){return new BPromise(function(_0xc00aa0,_0x59d087){try{if(_0x78f1ea['TagIds']){_0x78f1ea[_0xe8ac('0x3e')]=[];_0x78f1ea[_0xe8ac('0x3f')]['split'](',')['forEach'](function(_0x5cd321){_0x78f1ea[_0xe8ac('0x3e')][_0xe8ac('0x40')](_0x1e2283[_0x5cd321]);});}delete _0x78f1ea[_0xe8ac('0x3f')];}catch(_0x259657){_0x59d087(_0x259657);}_0xc00aa0(_0x78f1ea);});}function updateChatInteraction(_0x5eab2a,_0x1aab53,_0x33a4cc){return new BPromise(function(_0x5b7f23,_0x3de8f1){return getInteractionUsers(_0x5eab2a,_0x33a4cc)[_0xe8ac('0x26')](function(_0x289a8f){return getInteractionTags(_0x289a8f,_0x1aab53);})[_0xe8ac('0x26')](function(_0x5ca58e){_0x5b7f23(_0x5ca58e);})['catch'](function(_0x4e0f3d){_0x3de8f1(_0x4e0f3d);});});}exports[_0xe8ac('0x41')]=function(_0x2c2f18,_0x28a913){var _0x2670f1={},_0x547a72={},_0x58a44e={'count':0x0,'rows':[]};var _0x31080e=_[_0xe8ac('0x3c')](db[_0xe8ac('0x42')][_0xe8ac('0x43')],function(_0x440f2f){return{'name':_0x440f2f[_0xe8ac('0x44')],'type':_0x440f2f[_0xe8ac('0x45')][_0xe8ac('0x46')]};});_0x547a72[_0xe8ac('0x47')]=_[_0xe8ac('0x3c')](_0x31080e,_0xe8ac('0x3a'));_0x547a72[_0xe8ac('0x48')]=_[_0xe8ac('0x49')](_0x2c2f18[_0xe8ac('0x48')]);_0x547a72['filters']=_[_0xe8ac('0x4a')](_0x547a72['model'],_0x547a72['query']);_0x2670f1['attributes']=_['intersection'](_0x547a72[_0xe8ac('0x47')],qs['fields'](_0x2c2f18[_0xe8ac('0x48')]['fields']));_0x2670f1[_0xe8ac('0x4b')]=_0x2670f1[_0xe8ac('0x4b')]['length']?_0x2670f1[_0xe8ac('0x4b')]:_0x547a72['model'];if(!_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x4c')](_0xe8ac('0x4d'))){_0x2670f1['limit']=qs[_0xe8ac('0x34')](_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x34')]);_0x2670f1['offset']=qs[_0xe8ac('0x33')](_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x33')]);}_0x2670f1['order']=qs[_0xe8ac('0x4e')](_0x2c2f18['query'][_0xe8ac('0x4e')]);_0x2670f1[_0xe8ac('0x4f')]=qs[_0xe8ac('0x50')](_['pick'](_0x2c2f18[_0xe8ac('0x48')],_0x547a72[_0xe8ac('0x50')]),_0x31080e);var _0x1d1101=[];var _0x39e173=squel[_0xe8ac('0x51')]()[_0xe8ac('0x52')]('id')[_0xe8ac('0x52')](_0xe8ac('0x3a'))[_0xe8ac('0x52')](_0xe8ac('0x53'))['from'](_0xe8ac('0x54'));var _0xf34f72=squel[_0xe8ac('0x51')]()['field'](_0xe8ac('0x55'))[_0xe8ac('0x52')](_0xe8ac('0x56'))[_0xe8ac('0x52')](_0xe8ac('0x57'))[_0xe8ac('0x58')](_0xe8ac('0x59'),'ui')[_0xe8ac('0x5a')](_0xe8ac('0x5b'),'u',_0xe8ac('0x5c'));var _0xf6ff7f=squel['select']()[_0xe8ac('0x58')](_0xe8ac('0x5d'),'i')[_0xe8ac('0x5a')](_0xe8ac('0x5e'),'c',_0xe8ac('0x5f'))[_0xe8ac('0x5a')](_0xe8ac('0x5b'),'o',_0xe8ac('0x60'))[_0xe8ac('0x5a')](_0xe8ac('0x61'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xe8ac('0x5a')](_0xe8ac('0x62'),'me',_0xe8ac('0x63'))['left_join'](_0xe8ac('0x64'),'it',_0xe8ac('0x65'))[_0xe8ac('0x5a')](_0xe8ac('0x54'),'t',_0xe8ac('0x66'));var _0x347cc7=squel[_0xe8ac('0x67')]();var _0x4c5894=[];var _0xc94ad9=squel[_0xe8ac('0x67')]();var _0x3a76d4;if(_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x68')]){_0x3a76d4=as['parseSearch'](_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x68')]);var _0x3ffd17=_0x3a76d4['sqlOperator'];for(var _0x133ac1=0x0;_0x133ac1<_0x3a76d4['conditions'][_0xe8ac('0x69')];_0x133ac1++){var _0x36b94d=_0x3a76d4[_0xe8ac('0x6a')][_0x133ac1];var _0x45847f='i';var _0x236ff6=_['find'](_0x31080e,['name',_0x36b94d[_0xe8ac('0x52')]]);if(!_0x236ff6){switch(_0x36b94d[_0xe8ac('0x52')]){case _0xe8ac('0x6b'):if(_0x36b94d['value']==0x1){_0xf6ff7f[_0xe8ac('0x6c')]('`'+_0x36b94d[_0xe8ac('0x52')]+_0xe8ac('0x6d'));}else{_0xf6ff7f[_0xe8ac('0x6c')]('`'+_0x36b94d[_0xe8ac('0x52')]+_0xe8ac('0x6e'));}break;case _0xe8ac('0x6f'):if(_0x36b94d['operator']===_0xe8ac('0x70')){if(_0x36b94d[_0xe8ac('0x71')][_0xe8ac('0x72')]('\x20')[_0xe8ac('0x69')]>0x1){_0x347cc7[_0x3ffd17](_0xe8ac('0x73'),qs[_0xe8ac('0x74')](_0x36b94d[_0xe8ac('0x71')]),null);}else{var _0xa94389='%'+_0x36b94d['value']+'%';_0x347cc7[_0x3ffd17]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xa94389,_0xa94389,_0xa94389);}}else{_0x236ff6=_[_0xe8ac('0x75')](_0x31080e,['name','ContactId']);_0x36b94d[_0xe8ac('0x52')]=_0xe8ac('0x76');_0x1479a9=as[_0xe8ac('0x77')](_0x45847f,_0x236ff6['type'],_0x36b94d);_0x347cc7[_0x3ffd17](_0x1479a9['text'],_0x1479a9['value'][_0xe8ac('0x78')],_0x1479a9['value'][_0xe8ac('0x30')]);}break;case'Tag':var _0x305650=_0x36b94d[_0xe8ac('0x71')][_0xe8ac('0x72')](',')[_0xe8ac('0x3c')](function(_0x194173){return Number(_0x194173);});_0x305650[_0xe8ac('0x79')](function(_0xbc4cd0){_0xc94ad9['or'](_0xe8ac('0x7a'),'%,'+_0xbc4cd0+',%');});_0x4c5894=_[_0xe8ac('0x7b')](_0x4c5894,_0x305650);break;case'User':if(_0x36b94d[_0xe8ac('0x7c')]===_0xe8ac('0x70')){_0x347cc7[_0x3ffd17](_0xe8ac('0x7d'),'%'+_0x36b94d[_0xe8ac('0x71')]+'%',null);}else{_0x236ff6=_[_0xe8ac('0x75')](_0x31080e,[_0xe8ac('0x3a'),'UserId']);_0x36b94d['field']=_0xe8ac('0x7e');_0x1479a9=as['buildExpression'](_0x45847f,_0x236ff6['type'],_0x36b94d);_0x347cc7[_0x3ffd17](_0x1479a9[_0xe8ac('0x7f')],_0x1479a9[_0xe8ac('0x71')]['start'],_0x1479a9[_0xe8ac('0x71')][_0xe8ac('0x30')]);}break;case _0xe8ac('0x80'):_0x1479a9=as[_0xe8ac('0x77')]('me',null,_0x36b94d);_0x347cc7[_0x3ffd17](_0x1479a9['text'],_0x1479a9[_0xe8ac('0x71')][_0xe8ac('0x78')],_0x1479a9[_0xe8ac('0x71')][_0xe8ac('0x30')]);break;}}else{var _0x1479a9=as[_0xe8ac('0x77')](_0x45847f,_0x236ff6[_0xe8ac('0x45')],_0x36b94d);_0x347cc7[_0x3ffd17](_0x1479a9[_0xe8ac('0x7f')],_0x1479a9[_0xe8ac('0x71')]['start'],_0x1479a9[_0xe8ac('0x71')][_0xe8ac('0x30')]);}}}else{var _0x244c97=_(_0x2c2f18[_0xe8ac('0x48')])[_0xe8ac('0x49')]()['map'](function(_0x1a218f){return _[_0xe8ac('0x81')](_0x31080e,['name',_0x1a218f])?_0x1a218f:undefined;})[_0xe8ac('0x82')]()[_0xe8ac('0x71')]();if(!_['isEmpty'](_0x244c97)){_0x244c97['forEach'](function(_0x99dbad){if(_0x99dbad===_0xe8ac('0x83')){_0xf6ff7f[_0xe8ac('0x4f')](_0xe8ac('0x84'),[][_0xe8ac('0x85')](_0x2c2f18['query'][_0x99dbad]));}else if(_0x99dbad==='createdAt'){var _0x52f58d=JSON[_0xe8ac('0x86')](_0x2c2f18[_0xe8ac('0x48')][_0x99dbad])[_0xe8ac('0x87')];var _0x3906db=JSON[_0xe8ac('0x86')](_0x2c2f18['query'][_0x99dbad])[_0xe8ac('0x88')];_0xf6ff7f[_0xe8ac('0x4f')](_0xe8ac('0x89'),_0x52f58d,_0x3906db);}else{if(_0x2c2f18[_0xe8ac('0x48')][_0x99dbad]===_0xe8ac('0x8a')){_0xf6ff7f[_0xe8ac('0x4f')]('i.'+_0x99dbad+_0xe8ac('0x8b'));}else{_0xf6ff7f[_0xe8ac('0x4f')]('i.'+_0x99dbad+_0xe8ac('0x8c'),_0x2c2f18[_0xe8ac('0x48')][_0x99dbad]);}}});}if(_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x8d')]){if(_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x8d')]==0x1){_0xf6ff7f[_0xe8ac('0x6c')](_0xe8ac('0x8e'));}else{_0xf6ff7f[_0xe8ac('0x6c')]('`unreadMessages`\x20>\x200');}}if(_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x8f')]){_0x4c5894=_[_0xe8ac('0x90')](_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x8f')])?_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x8f')]:new Array(_0x2c2f18[_0xe8ac('0x48')]['tag']);_0x4c5894['forEach'](function(_0x5ce973){_0xc94ad9['or'](_0xe8ac('0x7a'),'%,'+_0x5ce973+',%');});}if(_0x2c2f18[_0xe8ac('0x48')][_0xe8ac('0x91')]){var _0x29f0b4=_0x2c2f18[_0xe8ac('0x48')]['filter'][_0xe8ac('0x92')]('\x5c','\x5c\x5c')[_0xe8ac('0x92')]('\x27\x27',_0xe8ac('0x93'));if(qs[_0xe8ac('0x94')](_0x29f0b4)){_0x347cc7['or'](_0xe8ac('0x95'),_0x29f0b4+'%');}else{_0x347cc7['or'](_0xe8ac('0x96'),qs['getFullTextValue'](_0x29f0b4))['or'](_0xe8ac('0x97'),_0x29f0b4+'%');}}}_0xf6ff7f['where'](_0x347cc7);_0xf6ff7f['group']('i.id');var _0x513af0={'type':db[_0xe8ac('0x23')][_0xe8ac('0x98')][_0xe8ac('0x99')],'raw':!![]};var _0x56b6f8=_0xf6ff7f['clone']();_0x56b6f8[_0xe8ac('0x52')](_0xe8ac('0x9a'));_0x56b6f8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe8ac('0x6b'));if(_0x2670f1[_0xe8ac('0x9b')]){_0x2670f1[_0xe8ac('0x9b')][_0xe8ac('0x79')](function(_0x5275de){_0xf6ff7f[_0xe8ac('0x9b')]('i.'+_0x5275de[0x0],_0x5275de[0x1]===_0xe8ac('0x9c')?![]:!![]);});}if(!_['isEmpty'](_0x4c5894)){_0xf6ff7f['having'](_0xc94ad9);_0x56b6f8['where'](_0xe8ac('0x9d'),_0x4c5894);}BPromise[_0xe8ac('0x9e')]()['then'](function(){if(!_0x3a76d4){if(_0x2c2f18[_0xe8ac('0x48')]['ChatWebsiteId']||_0x2c2f18[_0xe8ac('0x48')]['journey'])return;_0x56b6f8[_0xe8ac('0x4f')](_0xe8ac('0x9f'));_0xf6ff7f[_0xe8ac('0x4f')](_0xe8ac('0x9f'));return;}return _0x2c2f18[_0xe8ac('0xa0')][_0xe8ac('0xa1')]({'attributes':['id'],'raw':!![]})[_0xe8ac('0x26')](function(_0x37f8d3){if(_['isEmpty'](_0x37f8d3)){_0x56b6f8[_0xe8ac('0x4f')]('i.ChatWebsiteId\x20IS\x20NULL');_0xf6ff7f[_0xe8ac('0x4f')](_0xe8ac('0xa2'));}else{_0x56b6f8[_0xe8ac('0x4f')](_0xe8ac('0x84'),_['map'](_0x37f8d3,'id'));_0xf6ff7f[_0xe8ac('0x4f')](_0xe8ac('0x84'),_[_0xe8ac('0x3c')](_0x37f8d3,'id'));}});})['then'](function(){db[_0xe8ac('0xa3')][_0xe8ac('0x48')](_0x56b6f8[_0xe8ac('0xa4')](),_0x513af0)['then'](function(_0x59a42d){_0x58a44e[_0xe8ac('0xa5')]=_0x59a42d[_0xe8ac('0x69')];if(_0x58a44e[_0xe8ac('0xa5')]===0x0)return[];return db['sequelize'][_0xe8ac('0x48')](_0x39e173[_0xe8ac('0xa4')](),_0x513af0)[_0xe8ac('0x26')](function(_0x57be43){_0x1d1101=_['keyBy'](_0x57be43,'id');_0x513af0=_[_0xe8ac('0xa6')](_0x513af0,{'model':db[_0xe8ac('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c2f18['query'][_0xe8ac('0xa7')]){_0x2670f1[_0xe8ac('0x4b')][_0xe8ac('0x79')](function(_0x461d99){_0xf6ff7f[_0xe8ac('0x52')]('i.'+_0x461d99);});}else{_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xa8'),_0xe8ac('0x6b'));_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xa9'),_0xe8ac('0xaa'));_0xf6ff7f['field'](_0xe8ac('0xab'),_0xe8ac('0xac'));_0xf6ff7f[_0xe8ac('0x52')]('i.*');_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xad'),_0xe8ac('0xae'));_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xaf'),'Contact.lastName');_0xf6ff7f[_0xe8ac('0x52')]('c.email',_0xe8ac('0xb0'));_0xf6ff7f[_0xe8ac('0x52')]('c.phone','Contact.phone');_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xb1'),_0xe8ac('0xb2'));_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xb3'),_0xe8ac('0xb4'));_0xf6ff7f[_0xe8ac('0x52')]('o.fullname',_0xe8ac('0xb5'));_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xb6'),_0xe8ac('0xb7'));_0xf6ff7f[_0xe8ac('0x52')](_0xe8ac('0xb8'),_0xe8ac('0x3f'));}if(_0x2670f1[_0xe8ac('0x34')])_0xf6ff7f[_0xe8ac('0x34')](_0x2670f1[_0xe8ac('0x34')]);if(_0x2670f1['offset'])_0xf6ff7f[_0xe8ac('0x33')](_0x2670f1[_0xe8ac('0x33')]);return db[_0xe8ac('0xa3')][_0xe8ac('0x48')](_0xf6ff7f['toString'](),_0x513af0);})[_0xe8ac('0x26')](function(_0x558394){_0xf34f72['where'](_0xe8ac('0xb9'),_[_0xe8ac('0x3c')](_0x558394,'id'));return db['sequelize']['query'](_0xf34f72[_0xe8ac('0xa4')](),_0x513af0)[_0xe8ac('0x26')](function(_0x5d0892){var _0x19f735=_['groupBy'](_0x5d0892,_0xe8ac('0xba'));var _0x23cd33=[];_0x558394[_0xe8ac('0x79')](function(_0x5abda8){_0x23cd33[_0xe8ac('0x40')](updateChatInteraction(_0x5abda8,_0x1d1101,_0x19f735));});return BPromise['all'](_0x23cd33);});});})[_0xe8ac('0x26')](function(_0x4fa4d2){_0x58a44e[_0xe8ac('0xbb')]=_0x4fa4d2;return _0x58a44e;})[_0xe8ac('0x26')](respondWithFilteredResult(_0x28a913,_0x2670f1));})[_0xe8ac('0xbc')](handleError(_0x28a913,null));};exports[_0xe8ac('0xbd')]=function(_0x2e84dd,_0x336874){var _0x2e876a={'raw':![],'where':{'id':_0x2e84dd[_0xe8ac('0xbe')]['id']}},_0x5f11b0={};_0x5f11b0[_0xe8ac('0x47')]=_[_0xe8ac('0x49')](db[_0xe8ac('0x42')][_0xe8ac('0x43')]);_0x5f11b0[_0xe8ac('0x48')]=_['keys'](_0x2e84dd[_0xe8ac('0x48')]);_0x5f11b0['filters']=_[_0xe8ac('0x4a')](_0x5f11b0[_0xe8ac('0x47')],_0x5f11b0[_0xe8ac('0x48')]);_0x2e876a['attributes']=_['intersection'](_0x5f11b0[_0xe8ac('0x47')],qs[_0xe8ac('0xa7')](_0x2e84dd[_0xe8ac('0x48')][_0xe8ac('0xa7')]));_0x2e876a['attributes']=_0x2e876a[_0xe8ac('0x4b')]['length']?_0x2e876a[_0xe8ac('0x4b')]:_0x5f11b0[_0xe8ac('0x47')];if(_0x2e84dd['query'][_0xe8ac('0xbf')]){_0x2e876a[_0xe8ac('0xc0')]=[{'all':!![]}];}_0x2e876a=_[_0xe8ac('0xa6')]({},_0x2e876a,_0x2e84dd[_0xe8ac('0xc1')]);return db[_0xe8ac('0x42')][_0xe8ac('0x75')](_0x2e876a)[_0xe8ac('0x26')](handleEntityNotFound(_0x336874,null))[_0xe8ac('0x26')](respondWithResult(_0x336874,null))[_0xe8ac('0xbc')](handleError(_0x336874,null));};exports['create']=function(_0x145e93,_0x1b4bbc){return db['ChatInteraction']['create'](_0x145e93[_0xe8ac('0x80')],{})[_0xe8ac('0x26')](respondWithResult(_0x1b4bbc,0xc9))[_0xe8ac('0xbc')](handleError(_0x1b4bbc,null));};exports[_0xe8ac('0xc2')]=function(_0x54ba27,_0x48970c){if(_0x54ba27[_0xe8ac('0x80')]['id']){delete _0x54ba27['body']['id'];}return db[_0xe8ac('0x42')][_0xe8ac('0x75')]({'where':{'id':_0x54ba27[_0xe8ac('0xbe')]['id']}})[_0xe8ac('0x26')](handleEntityNotFound(_0x48970c,null))[_0xe8ac('0x26')](saveUpdates(_0x54ba27[_0xe8ac('0x80')],null))['then'](respondWithResult(_0x48970c,null))[_0xe8ac('0xbc')](handleError(_0x48970c,null));};exports[_0xe8ac('0xc3')]=function(_0x5ddd1b,_0x344edf){return db['ChatInteraction'][_0xe8ac('0x75')]({'where':{'id':_0x5ddd1b[_0xe8ac('0xbe')]['id']}})[_0xe8ac('0x26')](handleEntityNotFound(_0x344edf,null))[_0xe8ac('0x26')](removeEntity(_0x344edf,null))[_0xe8ac('0xbc')](handleError(_0x344edf,null));};exports[_0xe8ac('0xc4')]=function(_0x53d069,_0x9f6769){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x9f6769,null))['catch'](handleError(_0x9f6769,null));};exports['createVidaooSession']=function(_0x11b3f4,_0x32c2a0){var _0x51649d=_0x11b3f4[_0xe8ac('0xbe')]['id'];var _0x3e08bc;var _0x4ef881;var _0x150a30;return db[_0xe8ac('0x42')][_0xe8ac('0xc5')]({'where':{'id':_0x51649d}})[_0xe8ac('0x26')](function(_0x2852f4){_0x3e08bc=_0x2852f4;return db[_0xe8ac('0xc6')][_0xe8ac('0xc5')]({'where':{'id':_0x2852f4[_0xe8ac('0x83')]},'attributes':['id',_0xe8ac('0xc7'),_0xe8ac('0xc8')],'raw':!![]});})[_0xe8ac('0x26')](function(_0x27b59){if(_0x27b59&&_0x27b59[_0xe8ac('0xc7')]&&_0x27b59['vidaooEscalation']){_0x4ef881=_0x27b59;var _0xcd934c={'rejectUnauthorized':![],'method':'POST','uri':_0xe8ac('0xc9'),'headers':{'X-APIKEY':_0x27b59[_0xe8ac('0xc7')]},'body':{'name':_0xe8ac('0xca')+_0x51649d},'redirect':_0xe8ac('0xcb'),'json':!![]};return rp(_0xcd934c);}else{throw new db[(_0xe8ac('0x23'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x479e32){_0x150a30=_0x479e32;if(_0x150a30['id']){var _0x885763={'body':_0x150a30['join_url'],'ChatWebsiteId':_0x4ef881['id'],'ChatInteractionId':_0x3e08bc['id'],'direction':_0xe8ac('0xcc'),'UserId':_0x11b3f4['user']['id']};return db[_0xe8ac('0xcd')][_0xe8ac('0xce')](_0x885763,{});}else{throw new db[(_0xe8ac('0x23'))][(_0xe8ac('0x24'))](_0xe8ac('0xcf'));}})[_0xe8ac('0x26')](function(){return _0x3e08bc[_0xe8ac('0xd0')]({'vidaooSessionId':_0x150a30['id']});})['then'](respondWithResult(_0x32c2a0,null))[_0xe8ac('0xbc')](handleError(_0x32c2a0,null));};exports['customUpdate']=function(_0x2954a4,_0x367c17){if(_0x2954a4[_0xe8ac('0x80')]['id']){delete _0x2954a4['body']['id'];}return db['ChatInteraction'][_0xe8ac('0x75')]({'where':{'id':_0x2954a4['params']['id']}})['then'](handleEntityNotFound(_0x367c17,null))[_0xe8ac('0x26')](saveUpdates(_0x2954a4[_0xe8ac('0x80')],null))[_0xe8ac('0x26')](respondWithResult(_0x367c17,null))[_0xe8ac('0xbc')](handleError(_0x367c17,null));};exports[_0xe8ac('0xd1')]=function(_0x5ce820,_0x2320ba,_0x44ac32){if(_0x5ce820['body']['id']){delete _0x5ce820[_0xe8ac('0x80')]['id'];}return db[_0xe8ac('0x42')][_0xe8ac('0x75')]({'where':{'id':_0x5ce820[_0xe8ac('0xbe')]['id']}})[_0xe8ac('0x26')](function(_0x58e183){if(!_0x58e183){logger[_0xe8ac('0x2d')](_0xe8ac('0xd2'),_0xe8ac('0xd1'),0x194,_0xe8ac('0xd3'));_0x2320ba[_0xe8ac('0x38')](0x194);}else{if(_0x58e183[_0xe8ac('0x7e')]){throw new db[(_0xe8ac('0x23'))][(_0xe8ac('0x24'))]('Interaction\x20already\x20assigned');}}return _0x58e183;})[_0xe8ac('0x26')](function(_0x34174d){if(_0x34174d){return _0x34174d[_0xe8ac('0xc2')]({'closed':_0x5ce820['body']['closed'],'disposition':_0x5ce820['body'][_0xe8ac('0xd4')]})[_0xe8ac('0x26')](function(_0xf51d10){return _0xf51d10;});}})['then'](function(_0x20ff9f){return respondWithRpcPromise(_0xe8ac('0xd5'),_0xe8ac('0xd1'),_0x5ce820[_0xe8ac('0x80')],client9004);})[_0xe8ac('0x26')](respondWithResult(_0x2320ba,null))[_0xe8ac('0xbc')](handleError(_0x2320ba,null));};exports[_0xe8ac('0xd6')]=function(_0x3fea3c,_0x2343f4,_0x301a2a){_0x3fea3c[_0xe8ac('0x80')]['name']=_0x3fea3c[_0xe8ac('0xd7')]['originalname'];_0x3fea3c[_0xe8ac('0x80')][_0xe8ac('0xd8')]=_0x3fea3c[_0xe8ac('0xd7')]['filename'];_0x3fea3c[_0xe8ac('0x80')]['type']=_0x3fea3c[_0xe8ac('0xd7')][_0xe8ac('0xd9')];return db[_0xe8ac('0xda')][_0xe8ac('0xce')](_0x3fea3c[_0xe8ac('0x80')])[_0xe8ac('0x26')](respondWithResult(_0x2343f4,0xc9))[_0xe8ac('0xbc')](handleError(_0x2343f4,null));};exports[_0xe8ac('0xdb')]=function(_0x4f856e,_0x419202,_0xf64577){return db['ChatInteraction'][_0xe8ac('0xc5')]({'where':{'id':_0x4f856e[_0xe8ac('0xbe')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x419202,null))['then'](function(_0x24d36e){if(_0x24d36e){if(_0x24d36e[_0xe8ac('0xdc')]){return _0x419202[_0xe8ac('0x31')](0x193)[_0xe8ac('0x32')]({'status':0x193,'message':_0xe8ac('0xdd')});}return db['Attachment']['findOne']({'where':{'id':_0x4f856e[_0xe8ac('0x48')][_0xe8ac('0xde')]},'raw':!![]})[_0xe8ac('0x26')](handleEntityNotFound(_0x419202,null));}})[_0xe8ac('0x26')](function(_0x26187b){if(_0x26187b){return _0x419202[_0xe8ac('0xdf')](path[_0xe8ac('0xe0')](config[_0xe8ac('0xe1')],_0xe8ac('0xe2'),_0x26187b['basename']));}})['catch'](handleError(_0x419202,null));};exports[_0xe8ac('0xe3')]=function(_0x185e9a,_0x2dc5bf){var _0x5aae3d=null;var _0x35dde6=null;var _0x26d89d=null;var _0x3ee8e7=null;if(_0x185e9a[_0xe8ac('0x80')]['id']){delete _0x185e9a[_0xe8ac('0x80')]['id'];}if(_0x185e9a[_0xe8ac('0x80')]['mailTranscript']){_0x3ee8e7=path['join'](config[_0xe8ac('0xe1')],_0xe8ac('0xe4'),util[_0xe8ac('0xe5')]('transcript-%s.txt',Date[_0xe8ac('0xe6')]()));_0x185e9a[_0xe8ac('0x80')][_0xe8ac('0xe7')]=_0x3ee8e7;}return db['ChatInteraction'][_0xe8ac('0x75')]({'where':{'id':_0x185e9a[_0xe8ac('0xbe')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xe8ac('0xe8'),'include':[{'model':db[_0xe8ac('0xe9')],'as':_0xe8ac('0xe9')}]}]})['then'](handleEntityNotFound(_0x2dc5bf,null))['then'](saveUpdates(_0x185e9a[_0xe8ac('0x80')],null))[_0xe8ac('0x26')](function(_0x3f0bff){if(_0x3f0bff){_0x5aae3d=_0x3f0bff;return db[_0xe8ac('0xc6')][_0xe8ac('0x75')]({'where':{'id':_0x5aae3d[_0xe8ac('0x83')]}});}})[_0xe8ac('0x26')](function(_0x4085b6){if(_0x4085b6){_0x26d89d=_0x4085b6;return db[_0xe8ac('0xea')][_0xe8ac('0x75')]({'where':{'id':_0x5aae3d[_0xe8ac('0x76')]}});}})[_0xe8ac('0x26')](function(_0x6a93f4){if(_0x6a93f4){_0x35dde6=_0x6a93f4;if(_0x3ee8e7){var _0x49c969=null;for(var _0x257e86=0x1;_0x257e86<_0x5aae3d[_0xe8ac('0xe8')]['length'];++_0x257e86){_0x49c969=_0x5aae3d[_0xe8ac('0xe8')][_0x257e86];var _0x3223c6=_0x49c969['UserId']?util[_0xe8ac('0xe5')](_0xe8ac('0xeb'),_0x26d89d['agentAlias'],_0x49c969[_0xe8ac('0x7e')]):_0xe8ac('0xec');var _0x5b19b7=_0x185e9a['body'][_0xe8ac('0xed')]||util[_0xe8ac('0xe5')](_0xe8ac('0xeb'),_0xe8ac('0xee'),_0x49c969[_0xe8ac('0x76')]);switch(_0x26d89d[_0xe8ac('0xef')]){case _0xe8ac('0xf0'):_0x3223c6=_0x49c969['UserId']?util[_0xe8ac('0xe5')](_0xe8ac('0xeb'),_0x26d89d[_0xe8ac('0xf1')],_0x49c969['UserId']):_0xe8ac('0xec');break;case _0xe8ac('0xf2'):_0x3223c6=_0x49c969[_0xe8ac('0x7e')]?_0x49c969[_0xe8ac('0xe9')][_0xe8ac('0xf3')]||_0x49c969['User']['fullname']:_0xe8ac('0xec');break;case _0xe8ac('0xf4'):_0x3223c6=_0x49c969[_0xe8ac('0x7e')]?_0x49c969[_0xe8ac('0xe9')][_0xe8ac('0x3d')]:_0xe8ac('0xec');break;default:_0x3223c6=_0x49c969[_0xe8ac('0x7e')]?util[_0xe8ac('0xe5')](_0xe8ac('0xeb'),_0x26d89d[_0xe8ac('0xf1')],_0x49c969[_0xe8ac('0x7e')]):_0xe8ac('0xec');}var _0x231540=util[_0xe8ac('0xe5')](_0xe8ac('0xf5'),moment(_0x49c969[_0xe8ac('0xf6')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x49c969[_0xe8ac('0xf7')]==='in'?_0x5b19b7:_0x3223c6,_0x49c969['body']);if(!_0x49c969[_0xe8ac('0xf8')]){fs[_0xe8ac('0xf9')](_0x3ee8e7,_0x231540);}}return db[_0xe8ac('0xfa')][_0xe8ac('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0xe8ac('0xfb')],'as':_0xe8ac('0xfc'),'raw':!![]}]});}}})[_0xe8ac('0x26')](function(_0x45a53b){if(_0x45a53b&&_0x45a53b['Smtp']&&_0x185e9a[_0xe8ac('0x80')]){var _0x3e7d30={'tls':{'rejectUnauthorized':![]}};if(_0x45a53b[_0xe8ac('0xfc')]['service']){_0x3e7d30[_0xe8ac('0xfd')]=_0x45a53b[_0xe8ac('0xfc')][_0xe8ac('0xfd')];}else{_0x3e7d30[_0xe8ac('0xfe')]=_0x45a53b[_0xe8ac('0xfc')]['host'];_0x3e7d30[_0xe8ac('0xff')]=_0x45a53b[_0xe8ac('0xfc')][_0xe8ac('0xff')];_0x3e7d30[_0xe8ac('0x100')]=_0x45a53b[_0xe8ac('0xfc')][_0xe8ac('0x100')];}if(_0x45a53b[_0xe8ac('0xfc')]['authentication']){_0x3e7d30[_0xe8ac('0x101')]={'user':_0x45a53b[_0xe8ac('0xfc')]['user'],'pass':_0x45a53b[_0xe8ac('0xfc')]['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x3e7d30,'message':{'from':util['format'](_0xe8ac('0x102'),_0x45a53b['name'],_0x45a53b[_0xe8ac('0x103')]||_0x45a53b[_0xe8ac('0xfc')][_0xe8ac('0xa0')]),'to':_0x185e9a[_0xe8ac('0x80')]['mailTranscript'],'subject':_0xe8ac('0x104'),'text':util[_0xe8ac('0xe5')](_0xe8ac('0x105'),_0x185e9a[_0xe8ac('0x80')][_0xe8ac('0x106')]),'attachments':[{'path':_0x3ee8e7}]}})[_0xe8ac('0x26')](function(){return _0x5aae3d;})['catch'](function(_0x1c46f3){console[_0xe8ac('0x2d')](_0x1c46f3);});}else{return _0x5aae3d;}})[_0xe8ac('0x26')](respondWithStatusCode(_0x2dc5bf,0xc8))[_0xe8ac('0xbc')](handleError(_0x2dc5bf,null));};exports[_0xe8ac('0x107')]=function(_0x3aeede,_0x263635,_0x85e952){return db[_0xe8ac('0xcd')][_0xe8ac('0x75')]({'where':{'id':_0x3aeede[_0xe8ac('0xbe')]['id']}})[_0xe8ac('0x26')](handleEntityNotFound(_0x263635,null))[_0xe8ac('0x26')](function(_0x61799b){if(_0x61799b){return _0x61799b[_0xe8ac('0x107')](_0x3aeede[_0xe8ac('0x80')][_0xe8ac('0x108')],_[_0xe8ac('0x109')](_0x3aeede[_0xe8ac('0x80')],[_0xe8ac('0x108'),'id'])||{});}})[_0xe8ac('0x26')](respondWithResult(_0x263635,null))[_0xe8ac('0xbc')](handleError(_0x263635,null));};exports[_0xe8ac('0x10a')]=function(_0x5f4a6b,_0x2487a4,_0x46bbd7){var _0x42cf9b={'raw':![],'where':{}};var _0x575565={};var _0x3754c5={'count':0x0,'rows':[]};return db[_0xe8ac('0x42')][_0xe8ac('0xc5')]({'where':{'id':_0x5f4a6b[_0xe8ac('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2487a4,null))['then'](function(_0xc7f518){if(_0xc7f518){_0x575565['model']=_[_0xe8ac('0x49')](db[_0xe8ac('0xcd')]['rawAttributes']);_0x575565[_0xe8ac('0x48')]=_[_0xe8ac('0x49')](_0x5f4a6b['query']);_0x575565[_0xe8ac('0x50')]=_[_0xe8ac('0x4a')](_0x575565[_0xe8ac('0x47')],_0x575565[_0xe8ac('0x48')]);_0x42cf9b['attributes']=_[_0xe8ac('0x4a')](_0x575565[_0xe8ac('0x47')],qs[_0xe8ac('0xa7')](_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0xa7')]));_0x42cf9b[_0xe8ac('0x4b')]=_0x42cf9b[_0xe8ac('0x4b')][_0xe8ac('0x69')]?_0x42cf9b['attributes']:_0x575565[_0xe8ac('0x47')];if(!_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x4c')](_0xe8ac('0x4d'))){_0x42cf9b[_0xe8ac('0x34')]=qs[_0xe8ac('0x34')](_0x5f4a6b[_0xe8ac('0x48')]['limit']);_0x42cf9b[_0xe8ac('0x33')]=qs['offset'](_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x33')]);}_0x42cf9b[_0xe8ac('0x9b')]=qs['sort'](_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x4e')]);_0x42cf9b['where']=qs['filters'](_[_0xe8ac('0x10b')](_0x5f4a6b[_0xe8ac('0x48')],_0x575565[_0xe8ac('0x50')]));_0x42cf9b[_0xe8ac('0x4f')][_0xe8ac('0xba')]=_0xc7f518['id'];if(_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x91')]){_0x42cf9b[_0xe8ac('0x4f')]=_[_0xe8ac('0xa6')](_0x42cf9b[_0xe8ac('0x4f')],{'$or':_[_0xe8ac('0x3c')](_0x42cf9b[_0xe8ac('0x4b')],function(_0x1fe2e6){var _0x459c8c={};_0x459c8c[_0x1fe2e6]={'$like':'%'+_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x91')]+'%'};return _0x459c8c;})});}if(_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x87')]){var _0x3dc3fb=_0x5f4a6b[_0xe8ac('0x48')][_0xe8ac('0x87')][_0xe8ac('0x72')](',');var _0x10262b={};_0x10262b[_0x3dc3fb[0x0]]={'$gte':moment(_0x3dc3fb[0x1])['format'](_0xe8ac('0x10c'))};_0x42cf9b[_0xe8ac('0x4f')]=_[_0xe8ac('0xa6')](_0x42cf9b[_0xe8ac('0x4f')],_0x10262b);}_0x42cf9b=_[_0xe8ac('0xa6')]({},_0x42cf9b,_0x5f4a6b['options']);return db[_0xe8ac('0xcd')]['count']({'where':_0x42cf9b[_0xe8ac('0x4f')]})[_0xe8ac('0x26')](function(_0x566575){_0x3754c5[_0xe8ac('0xa5')]=_0x566575;if(_0x5f4a6b[_0xe8ac('0x48')]['includeAll']){_0x42cf9b[_0xe8ac('0xc0')]=[{'all':!![]}];}return db[_0xe8ac('0xcd')][_0xe8ac('0x10d')](_0x42cf9b);})[_0xe8ac('0x26')](function(_0x2afdec){_0x3754c5[_0xe8ac('0xbb')]=_0x2afdec;return _0x3754c5;});}})[_0xe8ac('0x26')](respondWithFilteredResult(_0x2487a4,_0x42cf9b))[_0xe8ac('0xbc')](handleError(_0x2487a4,null));};exports[_0xe8ac('0x10e')]=function(_0x19b1c9,_0x1068bc,_0x2e7d79){var _0x4114bf={'where':{}},_0x23e35e={},_0x32ad5e={'count':0x0,'rows':[]};return db[_0xe8ac('0x42')][_0xe8ac('0xc5')]({'where':{'id':_0x19b1c9[_0xe8ac('0xbe')]['id']}})[_0xe8ac('0x26')](handleEntityNotFound(_0x1068bc,null))[_0xe8ac('0x26')](function(_0x2b8af2){if(_0x2b8af2){_0x23e35e[_0xe8ac('0x47')]=_[_0xe8ac('0x49')](db[_0xe8ac('0xcd')][_0xe8ac('0x43')]);_0x23e35e['query']=_[_0xe8ac('0x49')](_0x19b1c9[_0xe8ac('0x48')]);_0x23e35e[_0xe8ac('0x50')]=_[_0xe8ac('0x4a')](_0x23e35e[_0xe8ac('0x47')],_0x23e35e[_0xe8ac('0x48')]);_0x4114bf[_0xe8ac('0x4b')]=_[_0xe8ac('0x4a')](_0x23e35e[_0xe8ac('0x47')],qs[_0xe8ac('0xa7')](_0x19b1c9[_0xe8ac('0x48')][_0xe8ac('0xa7')]));_0x4114bf[_0xe8ac('0x4b')]=_0x4114bf[_0xe8ac('0x4b')][_0xe8ac('0x69')]?_0x4114bf[_0xe8ac('0x4b')]:_0x23e35e[_0xe8ac('0x47')];if(!_0x19b1c9[_0xe8ac('0x48')]['hasOwnProperty']('nolimit')){_0x4114bf[_0xe8ac('0x34')]=qs[_0xe8ac('0x34')](_0x19b1c9[_0xe8ac('0x48')]['limit']);_0x4114bf['offset']=qs['offset'](_0x19b1c9[_0xe8ac('0x48')][_0xe8ac('0x33')]);}_0x4114bf[_0xe8ac('0x9b')]=qs['sort'](_0x19b1c9[_0xe8ac('0x48')][_0xe8ac('0x4e')]);_0x4114bf[_0xe8ac('0x4f')]=qs['filters'](_['pick'](_0x19b1c9[_0xe8ac('0x48')],_0x23e35e[_0xe8ac('0x50')]));_0x4114bf[_0xe8ac('0x4f')][_0xe8ac('0xba')]=_0x2b8af2['id'];if(_0x19b1c9['query'][_0xe8ac('0x91')]){_0x4114bf[_0xe8ac('0x4f')]=_[_0xe8ac('0xa6')](_0x4114bf['where'],{'$or':_['map'](_0x4114bf[_0xe8ac('0x4b')],function(_0x57d1fb){var _0x17eab6={};_0x17eab6[_0x57d1fb]={'$like':'%'+_0x19b1c9[_0xe8ac('0x48')]['filter']+'%'};return _0x17eab6;})});}_0x4114bf[_0xe8ac('0x4f')]['secret']=![];if(_0x19b1c9[_0xe8ac('0x48')]['id']){_0x4114bf['where']['id']={'$gt':_0x19b1c9[_0xe8ac('0x48')]['id']};}_0x4114bf=_[_0xe8ac('0xa6')]({},_0x4114bf,_0x19b1c9['options']);return db[_0xe8ac('0xcd')][_0xe8ac('0xa5')]({'where':_0x4114bf[_0xe8ac('0x4f')]})[_0xe8ac('0x26')](function(_0x43e7ef){_0x32ad5e['count']=_0x43e7ef;_0x4114bf[_0xe8ac('0xc0')]=[];if(_0x19b1c9['query']['includeAgent']){_0x4114bf[_0xe8ac('0xc0')][_0xe8ac('0x40')]({'model':db['User'],'as':_0xe8ac('0xe9'),'attributes':['id',_0xe8ac('0x3d'),_0xe8ac('0xf3')]});}if(_0x19b1c9[_0xe8ac('0x48')][_0xe8ac('0xbf')]){_0x4114bf[_0xe8ac('0xc0')]=[{'all':!![]}];}return db[_0xe8ac('0xcd')][_0xe8ac('0x10d')](_0x4114bf);})[_0xe8ac('0x26')](function(_0x1f755d){_0x32ad5e[_0xe8ac('0xbb')]=_0x1f755d;return _0x32ad5e;});}})[_0xe8ac('0x26')](respondWithFilteredResult(_0x1068bc,_0x4114bf))[_0xe8ac('0xbc')](handleError(_0x1068bc,null));};exports[_0xe8ac('0x10f')]=function(_0x1cbc2d,_0x76766c,_0x2d351d){return db['ChatInteraction'][_0xe8ac('0x75')]({'where':{'id':_0x1cbc2d['params']['id']}})['then'](handleEntityNotFound(_0x76766c,null))[_0xe8ac('0x26')](function(_0x46e359){if(_0x46e359){return _0x46e359[_0xe8ac('0x110')](_0x1cbc2d[_0xe8ac('0x80')][_0xe8ac('0x108')],_['omit'](_0x1cbc2d[_0xe8ac('0x80')],[_0xe8ac('0x108'),'id'])||{})[_0xe8ac('0x111')](function(){return db['Tag'][_0xe8ac('0x10d')]({'attributes':['id','name',_0xe8ac('0x53')],'where':{'id':_0x1cbc2d[_0xe8ac('0x80')]['ids']}});})[_0xe8ac('0x26')](function(_0x1680ce){socket[_0xe8ac('0x112')]('chatInteractionTags:save',{'id':Number(_0x1cbc2d[_0xe8ac('0xbe')]['id']),'tags':_0x1680ce||[]});return{'id':Number(_0x1cbc2d[_0xe8ac('0xbe')]['id']),'tags':_0x1680ce||[]};});}})[_0xe8ac('0x26')](respondWithResult(_0x76766c,null))[_0xe8ac('0xbc')](handleError(_0x76766c,null));};exports['removeTags']=function(_0x128bb9,_0x543d18,_0xf782c7){return db[_0xe8ac('0x42')][_0xe8ac('0x75')]({'where':{'id':_0x128bb9[_0xe8ac('0xbe')]['id']}})[_0xe8ac('0x26')](handleEntityNotFound(_0x543d18,null))['then'](function(_0x411402){if(_0x411402){return _0x411402[_0xe8ac('0x113')](_0x128bb9[_0xe8ac('0x48')][_0xe8ac('0x108')]);}})[_0xe8ac('0x26')](respondWithStatusCode(_0x543d18,null))[_0xe8ac('0xbc')](handleError(_0x543d18,null));};exports['download']=function(_0x55c429,_0x30ce53){var _0x2b85a7=moment()[_0xe8ac('0x114')]()[_0xe8ac('0xa4')]();var _0x36545a=path[_0xe8ac('0xe0')](config[_0xe8ac('0xe1')],_0xe8ac('0x115'),_0xe8ac('0x116'),_0xe8ac('0x117'));var _0x1cc2f5=path[_0xe8ac('0xe0')](config[_0xe8ac('0xe1')],_0xe8ac('0x115'),_0xe8ac('0x116'),_0xe8ac('0x118'));var _0x84466f=path['join'](_0x36545a,_0x2b85a7);var _0x503e00=util[_0xe8ac('0xe5')]('transcript-%d-%s.zip',_0x55c429[_0xe8ac('0xbe')]['id'],_0x2b85a7);var _0x1e73d2=path[_0xe8ac('0xe0')](_0x36545a,_0x503e00);var _0xf412df=[];_0xf412df[_0xe8ac('0x40')]({'model':db[_0xe8ac('0xe9')],'as':_0xe8ac('0xe9'),'attributes':['id',_0xe8ac('0x3d')],'raw':!![]});_0xf412df['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xe8ac('0x119'),'lastName'],'raw':!![]});if(_0x55c429['query']['attachments']){_0xf412df['push']({'model':db[_0xe8ac('0xda')],'as':_0xe8ac('0xda'),'raw':!![]});}var _0x1c44aa=[{'model':db['ChatMessage'],'as':_0xe8ac('0xe8'),'attributes':['id',_0xe8ac('0x80'),_0xe8ac('0xf6'),_0xe8ac('0xf7'),'secret','read'],'include':_0xf412df}];_0x1c44aa['push']({'model':db['ChatWebsite'],'as':_0xe8ac('0x11a'),'attributes':['id',_0xe8ac('0x3a')]});_0x1c44aa[_0xe8ac('0x40')]({'model':db[_0xe8ac('0xe9')],'as':_0xe8ac('0x11b'),'attributes':['id','fullname']});return db[_0xe8ac('0x42')][_0xe8ac('0x75')]({'where':{'id':_0x55c429[_0xe8ac('0xbe')]['id']},'include':_0x1c44aa})[_0xe8ac('0x26')](handleEntityNotFound(_0x30ce53,null))[_0xe8ac('0x26')](function(_0x5b1058){if(_0x5b1058){var _0x3c9f51=_0x5b1058[_0xe8ac('0x11c')]({'plain':!![]});fs[_0xe8ac('0x11d')](_0x84466f);var _0x3c470b={'format':'A4','border':_0xe8ac('0x11e'),'header':{'height':_0xe8ac('0x11f'),'contents':{'first':_0xe8ac('0x120')}},'footer':{'height':_0xe8ac('0x121'),'contents':{'default':util[_0xe8ac('0xe5')](_0xe8ac('0x122'),util[_0xe8ac('0xe5')](_0xe8ac('0x123'),_0xe8ac('0x124'),_0x3c9f51['id']),moment()[_0xe8ac('0xe5')](_0xe8ac('0x125'))['toString']())}}};var _0x13b349={'channel':_0xe8ac('0x124'),'account':_0x3c9f51[_0xe8ac('0x11a')][_0xe8ac('0x3a')],'agent':_0x3c9f51[_0xe8ac('0x11b')]?_0x3c9f51['Owner'][_0xe8ac('0x3d')]:_0xe8ac('0x126'),'createdAt':moment(_0x3c9f51['createdAt'])[_0xe8ac('0xe5')](_0xe8ac('0x10c'))[_0xe8ac('0xa4')](),'closedAt':_0x3c9f51[_0xe8ac('0xdc')]?moment(_0x3c9f51[_0xe8ac('0x127')])[_0xe8ac('0xe5')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3c9f51['disposition'],'chatInfo':{'browser':_0x3c9f51[_0xe8ac('0x128')],'os':_0x3c9f51[_0xe8ac('0x129')],'referer':_0x3c9f51[_0xe8ac('0x12a')],'customerIp':_0x3c9f51[_0xe8ac('0x12b')],'customerPort':_0x3c9f51[_0xe8ac('0x12c')]?_0x3c9f51[_0xe8ac('0x12c')]:_0xe8ac('0x126')},'messages':_(_0x3c9f51[_0xe8ac('0xe8')])[_0xe8ac('0x12d')]()[_0xe8ac('0x91')]({'secret':![]})['map'](function(_0x369918){if(_0x369918[_0xe8ac('0xda')]){var _0x16d1ea=path[_0xe8ac('0xe0')](_0x1cc2f5,_0x369918[_0xe8ac('0xda')][_0xe8ac('0xd8')]);if(fs[_0xe8ac('0x12e')](_0x16d1ea)){fs[_0xe8ac('0x12f')](_0x16d1ea)['pipe'](fs[_0xe8ac('0x130')](path[_0xe8ac('0xe0')](_0x84466f,_0x369918[_0xe8ac('0xda')][_0xe8ac('0xd8')])));}}return{'date':moment(_0x369918[_0xe8ac('0xf6')])[_0xe8ac('0xe5')](_0xe8ac('0x10c'))[_0xe8ac('0xa4')](),'sender':_0x369918[_0xe8ac('0xf7')]===_0xe8ac('0xcc')?_0x369918[_0xe8ac('0xe9')]?_0x369918[_0xe8ac('0xe9')][_0xe8ac('0x3d')]:_0xe8ac('0xec'):_0x369918['Contact'][_0xe8ac('0x119')]+(_0x369918[_0xe8ac('0x6f')][_0xe8ac('0x131')]?'\x20'+_0x369918[_0xe8ac('0x6f')]['lastName']:''),'body':_0x369918[_0xe8ac('0xda')]?_0x369918[_0xe8ac('0xda')][_0xe8ac('0xd8')]:_0x369918[_0xe8ac('0x80')],'direction':_0x369918['direction']===_0xe8ac('0xcc')?'A':'C','secret':_0x369918[_0xe8ac('0xf8')],'read':_0x369918[_0xe8ac('0x8d')],'attachment':_0x369918['Attachment']};})['value']()};return ejs[_0xe8ac('0x132')](path[_0xe8ac('0xe0')](config[_0xe8ac('0xe1')],_0xe8ac('0x115'),_0xe8ac('0x133'),_0xe8ac('0x134')),{'interaction':_0x13b349})[_0xe8ac('0x26')](function(_0xf00a12){return new BPromise(function(_0x1b2196,_0x717221){pdf[_0xe8ac('0xce')](_0xf00a12,_0x3c470b)[_0xe8ac('0x135')](path['join'](_0x84466f,_0xe8ac('0x136')+_0x3c9f51['id']+'-'+_0x2b85a7+_0xe8ac('0x137')),function(_0x3474dd,_0x27465b){if(_0x3474dd)return _0x717221(_0x3474dd);_0x1b2196(_0x27465b);});});})['then'](function(){return new BPromise(function(_0x7be3a,_0xaf5b17){zipdir(_0x84466f,{'saveTo':_0x1e73d2},function(_0x32b17a,_0x4e2819){if(_0x32b17a)return _0xaf5b17(_0x32b17a);return _0x7be3a(_0x4e2819);});})[_0xe8ac('0x26')](function(){return new BPromise(function(_0x4a122d,_0x2713d2){rimraf(_0x84466f,function(_0x130da3){if(_0x130da3)_0x2713d2(_0x130da3);return _0x4a122d();});});})[_0xe8ac('0x26')](function(){return _0x30ce53[_0xe8ac('0xdf')](_0x1e73d2,_0x503e00,function(_0x135414){if(_0x135414){console[_0xe8ac('0x138')](_0xe8ac('0x139'),_0x135414);}else{fs['unlinkSync'](_0x1e73d2);}});});});}else{return _0x30ce53[_0xe8ac('0x38')](0xc8);}})[_0xe8ac('0xbc')](handleError(_0x30ce53,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0f5ac2e..75ab4b1 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 _0x2090=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','catch','exports','events','../../mysqldb','ChatInteraction'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x2090,0x195));var _0x0209=function(_0x5d9ad4,_0x37613e){_0x5d9ad4=_0x5d9ad4-0x0;var _0x30fdc2=_0x2090[_0x5d9ad4];return _0x30fdc2;};'use strict';var EventEmitter=require(_0x0209('0x0'));var ChatInteraction=require(_0x0209('0x1'))['db'][_0x0209('0x2')];var ChatMessage=require(_0x0209('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0209('0x3')](0x0);var events={'afterCreate':_0x0209('0x4'),'afterUpdate':_0x0209('0x5'),'afterDestroy':_0x0209('0x6')};function emitEvent(_0x58b75d){return function(_0xc5562e,_0x19bb67,_0x578043){_0xc5562e[_0x0209('0x7')]({'attributes':['id'],'raw':!![]})[_0x0209('0x8')](function(_0x2a0688){_0xc5562e[_0x0209('0x9')](_0x0209('0xa'),_0x2a0688[_0x0209('0xb')](function(_0x17719d){return{'id':_0x17719d['id']};}));return ChatMessage[_0x0209('0xc')]({'where':{'ChatInteractionId':_0xc5562e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0209('0x8')](function(_0x2db415){_0xc5562e[_0x0209('0x9')](_0x0209('0xd'),_0x2db415[_0x0209('0xe')]);ChatInteractionEvents['emit'](_0x58b75d+':'+_0xc5562e['id'],_0xc5562e);ChatInteractionEvents['emit'](_0x58b75d,_0xc5562e);_0x578043(null);})[_0x0209('0xf')](_0x578043(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x0209('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x4d15=['setDataValue','Users','map','emit','catch','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','update','then'];(function(_0x2e1009,_0x49076f){var _0x317d0b=function(_0x21c48f){while(--_0x21c48f){_0x2e1009['push'](_0x2e1009['shift']());}};_0x317d0b(++_0x49076f);}(_0x4d15,0x156));var _0x54d1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4d15[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0x54d1('0x0'));var ChatInteraction=require(_0x54d1('0x1'))['db'][_0x54d1('0x2')];var ChatMessage=require(_0x54d1('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x54d1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x54d1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b61b3){return function(_0x166638,_0x3738f9,_0x53155c){_0x166638['getUsers']({'attributes':['id'],'raw':!![]})[_0x54d1('0x5')](function(_0x121108){_0x166638[_0x54d1('0x6')](_0x54d1('0x7'),_0x121108[_0x54d1('0x8')](function(_0x3c3e8f){return{'id':_0x3c3e8f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x166638['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xec64f4){_0x166638[_0x54d1('0x6')]('unreadMessages',_0xec64f4['length']);ChatInteractionEvents[_0x54d1('0x9')](_0x3b61b3+':'+_0x166638['id'],_0x166638);ChatInteractionEvents['emit'](_0x3b61b3,_0x166638);_0x53155c(null);})[_0x54d1('0xa')](_0x53155c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x54d1('0xb')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index dbc9ae6..fb95422 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 _0xd93f=['moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','utf8mb4','api'];(function(_0x194f8c,_0x3faf0d){var _0x32e3c9=function(_0x35d876){while(--_0x35d876){_0x194f8c['push'](_0x194f8c['shift']());}};_0x32e3c9(++_0x3faf0d);}(_0xd93f,0x185));var _0xfd93=function(_0x333f9f,_0x4bf7f1){_0x333f9f=_0x333f9f-0x0;var _0x126182=_0xd93f[_0x333f9f];return _0x126182;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfd93('0x0'));var moment=require(_0xfd93('0x1'));var BPromise=require(_0xfd93('0x2'));var rp=require(_0xfd93('0x3'));var fs=require('fs');var path=require(_0xfd93('0x4'));var rimraf=require('rimraf');var config=require(_0xfd93('0x5'));var attributes=require(_0xfd93('0x6'));module['exports']=function(_0x20558b,_0x1e2281){return _0x20558b[_0xfd93('0x7')](_0xfd93('0x8'),attributes,{'tableName':_0xfd93('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5560ee,_0x5126c6,_0x57071d){if(_0x5560ee[_0xfd93('0xa')](_0xfd93('0xb'))){_0x5560ee['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x57071d(null,_0x5560ee);}},'charset':_0xfd93('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa7a0=['lodash','../../config/logger','api','request-promise','rimraf','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0xa7a0,0xdd));var _0x0a7a=function(_0x115154,_0x5537e4){_0x115154=_0x115154-0x0;var _0x256b49=_0xa7a0[_0x115154];return _0x256b49;};'use strict';var _=require(_0x0a7a('0x0'));var util=require('util');var logger=require(_0x0a7a('0x1'))(_0x0a7a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a7a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a7a('0x4'));var config=require('../../config/environment');var attributes=require(_0x0a7a('0x5'));module['exports']=function(_0x28d850,_0x1b96d9){return _0x28d850['define'](_0x0a7a('0x6'),attributes,{'tableName':_0x0a7a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a42f6,_0xc5d1dc,_0x575e7c){if(_0x4a42f6[_0x0a7a('0x8')](_0x0a7a('0x9'))){_0x4a42f6[_0x0a7a('0xa')]=moment()[_0x0a7a('0xb')](_0x0a7a('0xc'));}_0x575e7c(null,_0x4a42f6);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6a8836d..b8bc11d 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 _0x4140=['defaults','localhost','./chatInteraction.socket','request','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','then','AddTagsToChatInteraction','find','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4140,0x1cc));var _0x0414=function(_0x3dc135,_0x546abc){_0x3dc135=_0x3dc135-0x0;var _0x517300=_0x4140[_0x3dc135];return _0x517300;};'use strict';var _=require(_0x0414('0x0'));var util=require(_0x0414('0x1'));var moment=require(_0x0414('0x2'));var BPromise=require(_0x0414('0x3'));var rs=require(_0x0414('0x4'));var fs=require('fs');var Redis=require(_0x0414('0x5'));var db=require(_0x0414('0x6'))['db'];var utils=require(_0x0414('0x7'));var logger=require(_0x0414('0x8'))(_0x0414('0x9'));var config=require(_0x0414('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0414('0xb')]['http']({'port':0x232a});config[_0x0414('0xc')]=_[_0x0414('0xd')](config[_0x0414('0xc')],{'host':_0x0414('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0414('0xc')]));require(_0x0414('0xf'))['register'](socket);function respondWithRpcPromise(_0x1dccf3,_0x2a987c,_0x2e8d3e){return new BPromise(function(_0x5a3cf9,_0x2de25c){return client[_0x0414('0x10')](_0x1dccf3,_0x2e8d3e)['then'](function(_0x50e3bf){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2a987c,_0x0414('0x11'));logger[_0x0414('0x12')](_0x0414('0x13'),_0x2a987c,'request\x20sent',JSON[_0x0414('0x14')](_0x50e3bf));if(_0x50e3bf[_0x0414('0x15')]){if(_0x50e3bf[_0x0414('0x15')][_0x0414('0x16')]===0x1f4){logger[_0x0414('0x15')](_0x0414('0x17'),_0x2a987c,_0x50e3bf[_0x0414('0x15')][_0x0414('0x18')]);return _0x2de25c(_0x50e3bf[_0x0414('0x15')][_0x0414('0x18')]);}logger[_0x0414('0x15')](_0x0414('0x17'),_0x2a987c,_0x50e3bf[_0x0414('0x15')][_0x0414('0x18')]);return _0x5a3cf9(_0x50e3bf[_0x0414('0x15')]['message']);}else{logger[_0x0414('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x2a987c,_0x0414('0x11'));_0x5a3cf9(_0x50e3bf[_0x0414('0x1a')][_0x0414('0x18')]);}})[_0x0414('0x1b')](function(_0x40718b){logger[_0x0414('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x2a987c,_0x40718b);_0x2de25c(_0x40718b);});});}exports[_0x0414('0x1c')]=function(_0x374ea4){var _0x6808b8=this;return new Promise(function(_0x728406,_0xd794c7){return db[_0x0414('0x1d')][_0x0414('0x1e')](_0x374ea4['body'],{'raw':_0x374ea4[_0x0414('0x1f')]?_0x374ea4['options'][_0x0414('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374ea4[_0x0414('0x1f')]?_0x374ea4[_0x0414('0x1f')][_0x0414('0x21')]||null:null,'attributes':_0x374ea4['options']?_0x374ea4['options'][_0x0414('0x22')]||null:null,'limit':_0x374ea4[_0x0414('0x1f')]?_0x374ea4[_0x0414('0x1f')]['limit']||null:null})[_0x0414('0x23')](function(_0x562981){logger[_0x0414('0x19')](_0x0414('0x1c'),_0x374ea4);logger['debug'](_0x0414('0x1c'),_0x374ea4,JSON[_0x0414('0x14')](_0x562981));_0x728406(_0x562981);})[_0x0414('0x1b')](function(_0x396f3f){logger[_0x0414('0x15')](_0x0414('0x1c'),_0x396f3f['message'],_0x374ea4);_0xd794c7(_0x6808b8['error'](0x1f4,_0x396f3f[_0x0414('0x18')]));});});};exports[_0x0414('0x24')]=function(_0x1adbd0){return new Promise(function(_0x1be1a2,_0x7beeb4){return db[_0x0414('0x1d')][_0x0414('0x25')]({'where':_0x1adbd0['options']?_0x1adbd0['options'][_0x0414('0x21')]||null:null})['then'](function(_0x5eed47){if(_0x5eed47){return _0x5eed47['addTags'](_0x1adbd0[_0x0414('0x26')]['ids'],_[_0x0414('0x27')](_0x1adbd0['body'],[_0x0414('0x28'),'id'])||{});}})[_0x0414('0x29')](function(_0x2f48c5){logger[_0x0414('0x19')](_0x0414('0x2a'),_0x1adbd0);logger[_0x0414('0x12')](_0x0414('0x2a'),_0x1adbd0,JSON[_0x0414('0x14')](_0x2f48c5));_0x1be1a2(_0x2f48c5);})[_0x0414('0x1b')](function(_0x2a4cea){logger[_0x0414('0x15')]('AddTags',_0x2a4cea[_0x0414('0x18')],_0x1adbd0);_0x7beeb4(_this[_0x0414('0x15')](0x1f4,_0x2a4cea[_0x0414('0x18')]));});});}; \ No newline at end of file +var _0x02a0=['result','UpdateChatInteraction','ChatInteraction','update','raw','options','attributes','catch','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x02a0,0x1b4));var _0x002a=function(_0x58e5ea,_0x31239e){_0x58e5ea=_0x58e5ea-0x0;var _0x2cfabd=_0x02a0[_0x58e5ea];return _0x2cfabd;};'use strict';var _=require('lodash');var util=require(_0x002a('0x0'));var moment=require(_0x002a('0x1'));var BPromise=require(_0x002a('0x2'));var rs=require(_0x002a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x002a('0x4'))['db'];var utils=require(_0x002a('0x5'));var logger=require('../../config/logger')(_0x002a('0x6'));var config=require(_0x002a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x002a('0x8')][_0x002a('0x9')]({'port':0x232a});config[_0x002a('0xa')]=_['defaults'](config[_0x002a('0xa')],{'host':_0x002a('0xb'),'port':0x18eb});var socket=require(_0x002a('0xc'))(new Redis(config[_0x002a('0xa')]));require(_0x002a('0xd'))[_0x002a('0xe')](socket);function respondWithRpcPromise(_0x474b7d,_0x4f3e2d,_0x3feb7b){return new BPromise(function(_0x479bb9,_0x1218d0){return client[_0x002a('0xf')](_0x474b7d,_0x3feb7b)[_0x002a('0x10')](function(_0x5d135f){logger[_0x002a('0x11')](_0x002a('0x12'),_0x4f3e2d,_0x002a('0x13'));logger[_0x002a('0x14')](_0x002a('0x15'),_0x4f3e2d,_0x002a('0x13'),JSON[_0x002a('0x16')](_0x5d135f));if(_0x5d135f[_0x002a('0x17')]){if(_0x5d135f[_0x002a('0x17')][_0x002a('0x18')]===0x1f4){logger[_0x002a('0x17')](_0x002a('0x12'),_0x4f3e2d,_0x5d135f['error'][_0x002a('0x19')]);return _0x1218d0(_0x5d135f[_0x002a('0x17')]['message']);}logger[_0x002a('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4f3e2d,_0x5d135f['error'][_0x002a('0x19')]);return _0x479bb9(_0x5d135f['error'][_0x002a('0x19')]);}else{logger[_0x002a('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x4f3e2d,_0x002a('0x13'));_0x479bb9(_0x5d135f[_0x002a('0x1a')][_0x002a('0x19')]);}})['catch'](function(_0x35a611){logger[_0x002a('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4f3e2d,_0x35a611);_0x1218d0(_0x35a611);});});}exports[_0x002a('0x1b')]=function(_0x42ca2f){var _0x432fd3=this;return new Promise(function(_0x508350,_0x5eaf14){return db[_0x002a('0x1c')][_0x002a('0x1d')](_0x42ca2f['body'],{'raw':_0x42ca2f['options']?_0x42ca2f['options'][_0x002a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42ca2f[_0x002a('0x1f')]?_0x42ca2f[_0x002a('0x1f')]['where']||null:null,'attributes':_0x42ca2f[_0x002a('0x1f')]?_0x42ca2f[_0x002a('0x1f')][_0x002a('0x20')]||null:null,'limit':_0x42ca2f['options']?_0x42ca2f[_0x002a('0x1f')]['limit']||null:null})['then'](function(_0x428aa6){logger['info'](_0x002a('0x1b'),_0x42ca2f);logger[_0x002a('0x14')](_0x002a('0x1b'),_0x42ca2f,JSON[_0x002a('0x16')](_0x428aa6));_0x508350(_0x428aa6);})[_0x002a('0x21')](function(_0x39e5a3){logger[_0x002a('0x17')]('UpdateChatInteraction',_0x39e5a3[_0x002a('0x19')],_0x42ca2f);_0x5eaf14(_0x432fd3[_0x002a('0x17')](0x1f4,_0x39e5a3[_0x002a('0x19')]));});});};exports[_0x002a('0x22')]=function(_0x3f6802){return new Promise(function(_0x390382,_0x2b551d){return db[_0x002a('0x1c')][_0x002a('0x23')]({'where':_0x3f6802[_0x002a('0x1f')]?_0x3f6802[_0x002a('0x1f')][_0x002a('0x24')]||null:null})[_0x002a('0x10')](function(_0x445978){if(_0x445978){return _0x445978[_0x002a('0x25')](_0x3f6802['body'][_0x002a('0x26')],_[_0x002a('0x27')](_0x3f6802['body'],[_0x002a('0x26'),'id'])||{});}})[_0x002a('0x28')](function(_0x3e26a7){logger['info'](_0x002a('0x29'),_0x3f6802);logger[_0x002a('0x14')](_0x002a('0x29'),_0x3f6802,JSON['stringify'](_0x3e26a7));_0x390382(_0x3e26a7);})[_0x002a('0x21')](function(_0x48c090){logger['error'](_0x002a('0x29'),_0x48c090[_0x002a('0x19')],_0x3f6802);_0x2b551d(_this[_0x002a('0x17')](0x1f4,_0x48c090[_0x002a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e8c6015..8188d75 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 _0xe4cf=['update','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0xf20b6,_0x49ddbb){var _0x4ff567=function(_0x3ccc7f){while(--_0x3ccc7f){_0xf20b6['push'](_0xf20b6['shift']());}};_0x4ff567(++_0x49ddbb);}(_0xe4cf,0x1a8));var _0xfe4c=function(_0x347ecc,_0x11d621){_0x347ecc=_0x347ecc-0x0;var _0x4a728d=_0xe4cf[_0x347ecc];return _0x4a728d;};'use strict';var ChatInteractionEvents=require(_0xfe4c('0x0'));var events=[_0xfe4c('0x1'),_0xfe4c('0x2'),_0xfe4c('0x3')];function createListener(_0x3cd463,_0x2a5823){return function(_0x34df26){_0x2a5823['emit'](_0x3cd463,_0x34df26);};}function removeListener(_0x4f35b2,_0x5cc1fd){return function(){ChatInteractionEvents[_0xfe4c('0x4')](_0x4f35b2,_0x5cc1fd);};}exports[_0xfe4c('0x5')]=function(_0x5cae74){for(var _0x4bbf31=0x0,_0x58c2d1=events['length'];_0x4bbf31<_0x58c2d1;_0x4bbf31++){var _0x4e9726=events[_0x4bbf31];var _0x457940=createListener(_0xfe4c('0x6')+_0x4e9726,_0x5cae74);ChatInteractionEvents['on'](_0x4e9726,_0x457940);}}; \ No newline at end of file +var _0xc1ea=['register','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener'];(function(_0x56fb7d,_0x539ea1){var _0x3be1c3=function(_0x521d3f){while(--_0x521d3f){_0x56fb7d['push'](_0x56fb7d['shift']());}};_0x3be1c3(++_0x539ea1);}(_0xc1ea,0xcd));var _0xac1e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc1ea[_0x4a9fb1];return _0x348672;};'use strict';var ChatInteractionEvents=require(_0xac1e('0x0'));var events=[_0xac1e('0x1'),_0xac1e('0x2'),'update'];function createListener(_0x4b4994,_0x3c547b){return function(_0x48979a){_0x3c547b[_0xac1e('0x3')](_0x4b4994,_0x48979a);};}function removeListener(_0x125b5b,_0xcee94e){return function(){ChatInteractionEvents[_0xac1e('0x4')](_0x125b5b,_0xcee94e);};}exports[_0xac1e('0x5')]=function(_0x3950ee){for(var _0x7bd928=0x0,_0x3a9a39=events['length'];_0x7bd928<_0x3a9a39;_0x7bd928++){var _0x391e95=events[_0x7bd928];var _0x199827=createListener(_0xac1e('0x6')+_0x391e95,_0x3950ee);ChatInteractionEvents['on'](_0x391e95,_0x199827);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2903c9c..aef4ec1 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 _0x13f6=['express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/:id','isChatInteractionAuthorized','show','attachmentDownload','isAuthenticated','getMessages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','chatinteraction:update','update','customUpdate','abandon','destroy','delete','exports','multer','util'];(function(_0x1f5834,_0x421950){var _0x418e31=function(_0x5f5cc4){while(--_0x5f5cc4){_0x1f5834['push'](_0x1f5834['shift']());}};_0x418e31(++_0x421950);}(_0x13f6,0x124));var _0x613f=function(_0x38773,_0x44d470){_0x38773=_0x38773-0x0;var _0x2a5319=_0x13f6[_0x38773];return _0x2a5319;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',auth['isAuthenticated'](),controller[_0x613f('0x8')]);router[_0x613f('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x613f('0x9'),auth[_0x613f('0xa')](),controller[_0x613f('0xb')]);router[_0x613f('0x7')]('/:id/attachment_download',auth[_0x613f('0xa')](),controller[_0x613f('0xc')]);router[_0x613f('0x7')]('/:id/messages',auth[_0x613f('0xd')](),controller[_0x613f('0xe')]);router[_0x613f('0x7')]('/:id/my_messages',auth[_0x613f('0xa')](),controller[_0x613f('0xf')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x613f('0x10')]);router[_0x613f('0x11')]('/',auth[_0x613f('0xd')](),controller[_0x613f('0x12')]);router[_0x613f('0x11')](_0x613f('0x13'),auth[_0x613f('0xd')](),controller[_0x613f('0x14')]);var upload=multer({'storage':multer[_0x613f('0x15')]({'destination':function(_0x1d68fd,_0x548218,_0x3c9edf){_0x3c9edf(null,path['join'](config['root'],_0x613f('0x16')));},'filename':function(_0x2f244d,_0x544eca,_0x39e417){_0x39e417(null,util['format'](_0x613f('0x17'),Date[_0x613f('0x18')](),_0x544eca[_0x613f('0x19')][_0x613f('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x613f('0x11')](_0x613f('0x1b'),upload['single']('file'),controller[_0x613f('0x1c')]);router['post']('/:id/messages',auth[_0x613f('0xa')](),controller[_0x613f('0x1d')]);router['post'](_0x613f('0x1e'),auth[_0x613f('0xd')](),interaction[_0x613f('0x1f')]('chat','chatinteraction:addtags'),controller[_0x613f('0x20')]);router[_0x613f('0x21')](_0x613f('0x9'),auth['isAuthenticated'](),interaction[_0x613f('0x1f')](_0x613f('0x22'),_0x613f('0x23')),controller[_0x613f('0x24')]);router[_0x613f('0x21')]('/:id/custom_update',controller[_0x613f('0x25')]);router[_0x613f('0x21')]('/:id/abandon',auth[_0x613f('0xa')](),controller[_0x613f('0x26')]);router[_0x613f('0x21')]('/:id/close',controller['close']);router['delete'](_0x613f('0x9'),auth['isAuthenticated'](),interaction[_0x613f('0x1f')](_0x613f('0x22'),'chatinteraction:destroy'),controller[_0x613f('0x27')]);router[_0x613f('0x28')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x613f('0x29')]=router; \ No newline at end of file +var _0x594d=['get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','create','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','originalname','post','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller'];(function(_0x553a87,_0x1d621f){var _0x12d1e6=function(_0x41ae48){while(--_0x41ae48){_0x553a87['push'](_0x553a87['shift']());}};_0x12d1e6(++_0x1d621f);}(_0x594d,0x92));var _0xd594=function(_0x5a0015,_0x2f2371){_0x5a0015=_0x5a0015-0x0;var _0x13a97e=_0x594d[_0x5a0015];return _0x13a97e;};'use strict';var multer=require(_0xd594('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd594('0x1'));var express=require(_0xd594('0x2'));var router=express[_0xd594('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd594('0x4'));var config=require(_0xd594('0x5'));var controller=require(_0xd594('0x6'));router[_0xd594('0x7')]('/',auth['isAuthenticated'](),controller[_0xd594('0x8')]);router['get'](_0xd594('0x9'),auth[_0xd594('0xa')](),controller[_0xd594('0xb')]);router[_0xd594('0x7')](_0xd594('0xc'),auth[_0xd594('0xd')](),controller[_0xd594('0xe')]);router[_0xd594('0x7')](_0xd594('0xf'),auth[_0xd594('0xd')](),controller['attachmentDownload']);router[_0xd594('0x7')](_0xd594('0x10'),auth[_0xd594('0xa')](),controller['getMessages']);router[_0xd594('0x7')](_0xd594('0x11'),auth[_0xd594('0xd')](),controller[_0xd594('0x12')]);router[_0xd594('0x7')](_0xd594('0x13'),auth[_0xd594('0xa')](),controller['download']);router['post']('/',auth[_0xd594('0xa')](),controller[_0xd594('0x14')]);router['post'](_0xd594('0x15'),auth['isAuthenticated'](),controller[_0xd594('0x16')]);var upload=multer({'storage':multer[_0xd594('0x17')]({'destination':function(_0x14ea68,_0x4cb9ec,_0x120fcf){_0x120fcf(null,path['join'](config['root'],_0xd594('0x18')));},'filename':function(_0x10ec5b,_0x57a0d4,_0x55adb0){_0x55adb0(null,util[_0xd594('0x19')](_0xd594('0x1a'),Date['now'](),_0x57a0d4[_0xd594('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd594('0x1c')]('/:id/attachment_upload',upload[_0xd594('0x1d')]('file'),controller[_0xd594('0x1e')]);router['post'](_0xd594('0x10'),auth[_0xd594('0xd')](),controller[_0xd594('0x1f')]);router[_0xd594('0x1c')](_0xd594('0x20'),auth[_0xd594('0xa')](),interaction[_0xd594('0x21')](_0xd594('0x22'),_0xd594('0x23')),controller[_0xd594('0x24')]);router[_0xd594('0x25')](_0xd594('0xc'),auth[_0xd594('0xa')](),interaction[_0xd594('0x21')](_0xd594('0x22'),_0xd594('0x26')),controller[_0xd594('0x27')]);router['put'](_0xd594('0x28'),controller[_0xd594('0x29')]);router[_0xd594('0x25')](_0xd594('0x2a'),auth[_0xd594('0xd')](),controller[_0xd594('0x2b')]);router[_0xd594('0x25')](_0xd594('0x2c'),controller[_0xd594('0x2d')]);router['delete'](_0xd594('0xc'),auth[_0xd594('0xa')](),interaction[_0xd594('0x21')](_0xd594('0x22'),_0xd594('0x2e')),controller[_0xd594('0x2f')]);router[_0xd594('0x30')](_0xd594('0x20'),auth[_0xd594('0xa')](),controller[_0xd594('0x31')]);module[_0xd594('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 7842818..b421903 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 _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x28e605,_0x2622d6){var _0x20b759=function(_0x50fd5e){while(--_0x50fd5e){_0x28e605['push'](_0x28e605['shift']());}};_0x20b759(++_0x2622d6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47d0c3,_0x9bac25){_0x47d0c3=_0x47d0c3-0x0;var _0x28c00b=_0x5f2f[_0x47d0c3];return _0x28c00b;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x7a54,0x106));var _0x47a5=function(_0x314ee7,_0x4d9351){_0x314ee7=_0x314ee7-0x0;var _0x143891=_0x7a54[_0x314ee7];return _0x143891;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index caa180a..1cf6273 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 _0xccf7=['push','FromId','ToId','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','offset','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','ChatInternalMessage','count','findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','User','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','resourceId'];(function(_0x4da749,_0x33272a){var _0x59afaf=function(_0xd43a97){while(--_0xd43a97){_0x4da749['push'](_0x4da749['shift']());}};_0x59afaf(++_0x33272a);}(_0xccf7,0x71));var _0x7ccf=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xccf7[_0x50c492];return _0x3505a8;};'use strict';var pdf=require(_0x7ccf('0x0'));var emlformat=require(_0x7ccf('0x1'));var rimraf=require(_0x7ccf('0x2'));var zipdir=require(_0x7ccf('0x3'));var jsonpatch=require(_0x7ccf('0x4'));var rp=require(_0x7ccf('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ccf('0x6'));var util=require(_0x7ccf('0x7'));var path=require(_0x7ccf('0x8'));var sox=require(_0x7ccf('0x9'));var csv=require(_0x7ccf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ccf('0xb'));var squel=require(_0x7ccf('0xc'));var crypto=require(_0x7ccf('0xd'));var jsforce=require(_0x7ccf('0xe'));var deskjs=require(_0x7ccf('0xf'));var toCsv=require(_0x7ccf('0xa'));var querystring=require(_0x7ccf('0x10'));var Papa=require(_0x7ccf('0x11'));var Redis=require('ioredis');var authService=require(_0x7ccf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7ccf('0x13'));var hardwareService=require(_0x7ccf('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7ccf('0x15'));var config=require(_0x7ccf('0x16'));var db=require(_0x7ccf('0x17'))['db'];config[_0x7ccf('0x18')]=_[_0x7ccf('0x19')](config[_0x7ccf('0x18')],{'host':_0x7ccf('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ccf('0x18')]));require(_0x7ccf('0x1b'))[_0x7ccf('0x1c')](socket);function respondWithStatusCode(_0x51f70d,_0xabade3){_0xabade3=_0xabade3||0xcc;return function(_0x2da5c3){if(_0x2da5c3){return _0x51f70d[_0x7ccf('0x1d')](_0xabade3);}return _0x51f70d['status'](_0xabade3)[_0x7ccf('0x1e')]();};}function respondWithResult(_0x623964,_0x318c97){_0x318c97=_0x318c97||0xc8;return function(_0x1d4141){if(_0x1d4141){return _0x623964[_0x7ccf('0x1f')](_0x318c97)['json'](_0x1d4141);}};}function respondWithFilteredResult(_0x35f00b,_0x440133){return function(_0x1e392d){if(_0x1e392d){var _0x81b5bf=_0x1e392d['count'],_0x803230=_0x440133[_0x7ccf('0x20')],_0x501eca=_0x440133[_0x7ccf('0x20')]+_0x440133['limit'],_0x18c0da;if(_0x501eca>=_0x81b5bf){_0x501eca=_0x81b5bf;_0x18c0da=0xc8;}else{_0x18c0da=0xce;}_0x35f00b[_0x7ccf('0x1f')](_0x18c0da);return _0x35f00b['set'](_0x7ccf('0x21'),_0x803230+'-'+_0x501eca+'/'+_0x81b5bf)[_0x7ccf('0x22')](_0x1e392d);}return null;};}function patchUpdates(_0x12ad02){return function(_0x1b94e7){try{jsonpatch[_0x7ccf('0x23')](_0x1b94e7,_0x12ad02,!![]);}catch(_0x121a4c){return BPromise[_0x7ccf('0x24')](_0x121a4c);}return _0x1b94e7[_0x7ccf('0x25')]();};}function saveUpdates(_0x4c4b49,_0x119a94){return function(_0xb49ad4){if(_0xb49ad4){return _0xb49ad4[_0x7ccf('0x26')](_0x4c4b49)['then'](function(_0xcb55ee){return _0xcb55ee;});}return null;};}function removeEntity(_0x19aa65,_0x4f113a){return function(_0x426d81){if(_0x426d81){return _0x426d81['destroy']()[_0x7ccf('0x27')](function(){_0x19aa65[_0x7ccf('0x1f')](0xcc)[_0x7ccf('0x1e')]();});}};}function handleEntityNotFound(_0x122c98,_0x53fae1){return function(_0x177449){if(!_0x177449){_0x122c98[_0x7ccf('0x1d')](0x194);}return _0x177449;};}function handleError(_0x55b157,_0x19e1d0){_0x19e1d0=_0x19e1d0||0x1f4;return function(_0x165b65){logger[_0x7ccf('0x28')](_0x165b65[_0x7ccf('0x29')]);if(_0x165b65[_0x7ccf('0x2a')]){delete _0x165b65['name'];}_0x55b157['status'](_0x19e1d0)[_0x7ccf('0x2b')](_0x165b65);};}exports[_0x7ccf('0x2c')]=function(_0xa4284b,_0x50044f){var _0x11034e={},_0x21dcea={},_0x253f4b={'count':0x0,'rows':[]};var _0xdd4851=_[_0x7ccf('0x2d')](db['ChatInternalMessage'][_0x7ccf('0x2e')],function(_0x4246b5){return{'name':_0x4246b5[_0x7ccf('0x2f')],'type':_0x4246b5[_0x7ccf('0x30')]['key']};});_0x21dcea[_0x7ccf('0x31')]=_[_0x7ccf('0x2d')](_0xdd4851,'name');_0x21dcea[_0x7ccf('0x32')]=_[_0x7ccf('0x33')](_0xa4284b['query']);_0x21dcea[_0x7ccf('0x34')]=_[_0x7ccf('0x35')](_0x21dcea[_0x7ccf('0x31')],_0x21dcea[_0x7ccf('0x32')]);_0x11034e['attributes']=_[_0x7ccf('0x35')](_0x21dcea['model'],qs[_0x7ccf('0x36')](_0xa4284b[_0x7ccf('0x32')][_0x7ccf('0x36')]));_0x11034e[_0x7ccf('0x37')]=_0x11034e[_0x7ccf('0x37')][_0x7ccf('0x38')]?_0x11034e['attributes']:_0x21dcea[_0x7ccf('0x31')];if(!_0xa4284b[_0x7ccf('0x32')]['hasOwnProperty'](_0x7ccf('0x39'))){_0x11034e[_0x7ccf('0x3a')]=qs[_0x7ccf('0x3a')](_0xa4284b['query'][_0x7ccf('0x3a')]);_0x11034e[_0x7ccf('0x20')]=qs[_0x7ccf('0x20')](_0xa4284b[_0x7ccf('0x32')][_0x7ccf('0x20')]);}_0x11034e[_0x7ccf('0x3b')]=qs[_0x7ccf('0x3c')](_0xa4284b['query'][_0x7ccf('0x3c')]);_0x11034e[_0x7ccf('0x3d')]=qs['filters'](_[_0x7ccf('0x3e')](_0xa4284b[_0x7ccf('0x32')],_0x21dcea['filters']),_0xdd4851);if(_0xa4284b['query'][_0x7ccf('0x3f')]){_0x11034e[_0x7ccf('0x3d')]=_[_0x7ccf('0x40')](_0x11034e[_0x7ccf('0x3d')],{'$or':_[_0x7ccf('0x2d')](_0xdd4851,function(_0x5ad055){if(_0x5ad055['type']!==_0x7ccf('0x41')){var _0xd70c1b={};_0xd70c1b[_0x5ad055[_0x7ccf('0x2a')]]={'$like':'%'+_0xa4284b[_0x7ccf('0x32')][_0x7ccf('0x3f')]+'%'};return _0xd70c1b;}})});}_0x11034e=_[_0x7ccf('0x40')]({},_0x11034e,_0xa4284b['options']);var _0x3a85b6={'where':_0x11034e['where']};return db[_0x7ccf('0x42')][_0x7ccf('0x43')](_0x3a85b6)['then'](function(_0x3616eb){_0x253f4b[_0x7ccf('0x43')]=_0x3616eb;if(_0xa4284b['query']['includeAll']){_0x11034e['include']=[{'all':!![]}];}return db[_0x7ccf('0x42')][_0x7ccf('0x44')](_0x11034e);})[_0x7ccf('0x27')](function(_0x54c0fb){_0x253f4b[_0x7ccf('0x45')]=_0x54c0fb;return _0x253f4b;})[_0x7ccf('0x27')](respondWithFilteredResult(_0x50044f,_0x11034e))[_0x7ccf('0x46')](handleError(_0x50044f,null));};exports[_0x7ccf('0x47')]=function(_0x16b5c3,_0x13aea3){var _0x566d2c={'raw':!![],'where':{'id':_0x16b5c3[_0x7ccf('0x48')]['id']}},_0x5b7acf={};_0x5b7acf[_0x7ccf('0x31')]=_[_0x7ccf('0x33')](db[_0x7ccf('0x42')]['rawAttributes']);_0x5b7acf[_0x7ccf('0x32')]=_[_0x7ccf('0x33')](_0x16b5c3[_0x7ccf('0x32')]);_0x5b7acf[_0x7ccf('0x34')]=_[_0x7ccf('0x35')](_0x5b7acf[_0x7ccf('0x31')],_0x5b7acf['query']);_0x566d2c[_0x7ccf('0x37')]=_['intersection'](_0x5b7acf[_0x7ccf('0x31')],qs[_0x7ccf('0x36')](_0x16b5c3[_0x7ccf('0x32')][_0x7ccf('0x36')]));_0x566d2c[_0x7ccf('0x37')]=_0x566d2c[_0x7ccf('0x37')][_0x7ccf('0x38')]?_0x566d2c[_0x7ccf('0x37')]:_0x5b7acf[_0x7ccf('0x31')];if(_0x16b5c3['query'][_0x7ccf('0x49')]){_0x566d2c[_0x7ccf('0x4a')]=[{'all':!![]}];}_0x566d2c=_[_0x7ccf('0x40')]({},_0x566d2c,_0x16b5c3['options']);return db[_0x7ccf('0x42')][_0x7ccf('0x4b')](_0x566d2c)[_0x7ccf('0x27')](handleEntityNotFound(_0x13aea3,null))[_0x7ccf('0x27')](respondWithResult(_0x13aea3,null))[_0x7ccf('0x46')](handleError(_0x13aea3,null));};exports['create']=function(_0x98c89,_0xaaa3e8){return db[_0x7ccf('0x42')][_0x7ccf('0x4c')](_0x98c89['body'],{})['then'](respondWithResult(_0xaaa3e8,0xc9))[_0x7ccf('0x46')](handleError(_0xaaa3e8,null));};exports[_0x7ccf('0x26')]=function(_0x2dcfc3,_0x60ef20){if(_0x2dcfc3[_0x7ccf('0x4d')]['id']){delete _0x2dcfc3['body']['id'];}return db[_0x7ccf('0x42')][_0x7ccf('0x4b')]({'where':{'id':_0x2dcfc3[_0x7ccf('0x48')]['id']}})['then'](handleEntityNotFound(_0x60ef20,null))[_0x7ccf('0x27')](saveUpdates(_0x2dcfc3[_0x7ccf('0x4d')],null))[_0x7ccf('0x27')](respondWithResult(_0x60ef20,null))[_0x7ccf('0x46')](handleError(_0x60ef20,null));};exports[_0x7ccf('0x4e')]=function(_0x116fd7,_0x2ed7fa){return db[_0x7ccf('0x42')]['find']({'where':{'id':_0x116fd7['params']['id']}})['then'](handleEntityNotFound(_0x2ed7fa,null))[_0x7ccf('0x27')](removeEntity(_0x2ed7fa,null))['catch'](handleError(_0x2ed7fa,null));};exports[_0x7ccf('0x4f')]=function(_0x11af79,_0x49f652){return db[_0x7ccf('0x42')]['describe']()[_0x7ccf('0x27')](respondWithResult(_0x49f652,null))['catch'](handleError(_0x49f652,null));};function wrapUser(_0x137a1c){return function(_0x372ea5){var _0x2c9f83=_0x137a1c[_0x7ccf('0x50')]({'plain':!![]});_0x2c9f83[_0x7ccf('0x51')]=[];if(_0x372ea5){_0x2c9f83[_0x7ccf('0x52')]=_0x372ea5[_0x7ccf('0x53')];_0x2c9f83[_0x7ccf('0x54')]=_0x372ea5;}else{_0x2c9f83[_0x7ccf('0x52')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c9f83[_0x7ccf('0x54')]={};}return _0x2c9f83;};}exports['getUsers']=function(_0x3877bc,_0x17dce7,_0x14e652){var _0x2cd747=[];return db[_0x7ccf('0x55')]['findAll']({'where':{'role':[_0x7ccf('0x56'),'admin',_0x7ccf('0x57')]},'attributes':['id',_0x7ccf('0x58'),_0x7ccf('0x2a'),_0x7ccf('0x59'),_0x7ccf('0x5a'),_0x7ccf('0x5b'),_0x7ccf('0x5c'),_0x7ccf('0x5d'),_0x7ccf('0x5e'),'showWebBar'],'order':qs[_0x7ccf('0x3c')](_0x7ccf('0x5f')),'include':[{'model':db[_0x7ccf('0x60')],'as':'VoiceQueues','attributes':['id',_0x7ccf('0x2a'),_0x7ccf('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x5e464a){if(_0x5e464a){var _0x1fe559=_0x3877bc[_0x7ccf('0x57')][_0x7ccf('0x50')]({'plain':!![]});if(!_0x1fe559)throw new Error(_0x7ccf('0x61'));if(_0x1fe559['role']==='user'){return db[_0x7ccf('0x62')][_0x7ccf('0x4b')]({'where':{'name':_0x7ccf('0x63'),'userProfileId':_0x1fe559[_0x7ccf('0x64')]},'raw':!![]})[_0x7ccf('0x27')](function(_0x4c506d){if(_0x4c506d){if(_0x4c506d[_0x7ccf('0x65')]===0x0){return db['UserProfileResource'][_0x7ccf('0x44')]({'where':{'sectionId':_0x4c506d['id']},'raw':!![]})[_0x7ccf('0x27')](function(_0x66cdeb){var _0x199417=[];if(_['isEmpty'](_0x66cdeb)){_0x199417=_[_0x7ccf('0x3f')](_0x5e464a,function(_0x196a5d){if(_0x196a5d[_0x7ccf('0x59')]!==_0x7ccf('0x56')){return _0x196a5d;}});return _0x199417;}else{for(var _0x3f2db7=0x0;_0x3f2db7<_0x5e464a['length'];_0x3f2db7++){var _0x2e8045=_0x5e464a[_0x3f2db7];if(_0x2e8045[_0x7ccf('0x59')]===_0x7ccf('0x56')){var _0x273e76=_[_0x7ccf('0x4b')](_0x66cdeb,function(_0x292584){return _0x292584[_0x7ccf('0x66')]===_0x2e8045['id'];});if(_0x273e76)_0x199417['push'](_0x2e8045);}else{_0x199417[_0x7ccf('0x67')](_0x2e8045);}}return _0x199417;}});}else{return _0x5e464a;}}else{var _0x53e5b1=_[_0x7ccf('0x3f')](_0x5e464a,function(_0x26d591){if(_0x26d591[_0x7ccf('0x59')]!=='agent'){return _0x26d591;}});return _0x53e5b1;}});}else{return _0x5e464a;}}})[_0x7ccf('0x27')](function(_0x599339){var _0x4cfca4=[];if(_0x599339){_0x2cd747=_0x599339;for(var _0x43e3a9=0x0;_0x43e3a9<_0x599339[_0x7ccf('0x38')];_0x43e3a9+=0x1){_0x2cd747[_0x43e3a9]['messages']=[];_0x4cfca4[_0x7ccf('0x67')](db[_0x7ccf('0x42')]['find']({'where':{'FromId':[_0x3877bc['user']['id'],_0x599339[_0x43e3a9]['id']],'ToId':[_0x3877bc[_0x7ccf('0x57')]['id'],_0x599339[_0x43e3a9]['id']],'ChatGroupId':null},'attributes':['id',_0x7ccf('0x53'),_0x7ccf('0x68'),_0x7ccf('0x69'),'read',_0x7ccf('0x4d')],'order':qs[_0x7ccf('0x3c')](_0x7ccf('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7ccf('0x27')](wrapUser(_0x599339[_0x43e3a9])));}return BPromise[_0x7ccf('0x6b')](_0x4cfca4);}return[];})[_0x7ccf('0x27')](function(_0x489c59){return{'rows':_0x489c59,'count':_0x489c59[_0x7ccf('0x38')]};})['then'](respondWithResult(_0x17dce7,null))[_0x7ccf('0x46')](handleError(_0x17dce7,null));}; \ No newline at end of file +var _0xe9e6=['sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','destroy','describe','get','lastMessageAt','getUsers','agent','admin','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','resourceId','push','messages','createdAt','FromId','ToId','read','-createdAt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order'];(function(_0x14463e,_0x5f4c24){var _0x5caba6=function(_0x53a80b){while(--_0x53a80b){_0x14463e['push'](_0x14463e['shift']());}};_0x5caba6(++_0x5f4c24);}(_0xe9e6,0x9a));var _0x6e9e=function(_0x1ac5e1,_0x43a483){_0x1ac5e1=_0x1ac5e1-0x0;var _0x3ae80e=_0xe9e6[_0x1ac5e1];return _0x3ae80e;};'use strict';var pdf=require(_0x6e9e('0x0'));var emlformat=require(_0x6e9e('0x1'));var rimraf=require(_0x6e9e('0x2'));var zipdir=require(_0x6e9e('0x3'));var jsonpatch=require(_0x6e9e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6e9e('0x5'));var Mustache=require(_0x6e9e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6e9e('0x7'));var csv=require(_0x6e9e('0x8'));var ejs=require(_0x6e9e('0x9'));var fs=require('fs');var _=require(_0x6e9e('0xa'));var squel=require(_0x6e9e('0xb'));var crypto=require(_0x6e9e('0xc'));var jsforce=require(_0x6e9e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e9e('0x8'));var querystring=require(_0x6e9e('0xe'));var Papa=require(_0x6e9e('0xf'));var Redis=require(_0x6e9e('0x10'));var authService=require(_0x6e9e('0x11'));var qs=require(_0x6e9e('0x12'));var as=require(_0x6e9e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e9e('0x14'))(_0x6e9e('0x15'));var utils=require(_0x6e9e('0x16'));var config=require(_0x6e9e('0x17'));var db=require(_0x6e9e('0x18'))['db'];config['redis']=_['defaults'](config[_0x6e9e('0x19')],{'host':_0x6e9e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e9e('0x19')]));require(_0x6e9e('0x1b'))['register'](socket);function respondWithStatusCode(_0x3f5c6c,_0x11ecf7){_0x11ecf7=_0x11ecf7||0xcc;return function(_0x1ee2ac){if(_0x1ee2ac){return _0x3f5c6c[_0x6e9e('0x1c')](_0x11ecf7);}return _0x3f5c6c[_0x6e9e('0x1d')](_0x11ecf7)[_0x6e9e('0x1e')]();};}function respondWithResult(_0xa3d226,_0x3fc390){_0x3fc390=_0x3fc390||0xc8;return function(_0x1648f6){if(_0x1648f6){return _0xa3d226['status'](_0x3fc390)[_0x6e9e('0x1f')](_0x1648f6);}};}function respondWithFilteredResult(_0x57d61d,_0x552a97){return function(_0x31aa95){if(_0x31aa95){var _0x5d60f4=_0x31aa95[_0x6e9e('0x20')],_0x4bdf55=_0x552a97[_0x6e9e('0x21')],_0x2a630d=_0x552a97[_0x6e9e('0x21')]+_0x552a97[_0x6e9e('0x22')],_0x250338;if(_0x2a630d>=_0x5d60f4){_0x2a630d=_0x5d60f4;_0x250338=0xc8;}else{_0x250338=0xce;}_0x57d61d[_0x6e9e('0x1d')](_0x250338);return _0x57d61d[_0x6e9e('0x23')](_0x6e9e('0x24'),_0x4bdf55+'-'+_0x2a630d+'/'+_0x5d60f4)[_0x6e9e('0x1f')](_0x31aa95);}return null;};}function patchUpdates(_0x4d1c51){return function(_0x3312d0){try{jsonpatch[_0x6e9e('0x25')](_0x3312d0,_0x4d1c51,!![]);}catch(_0x42a487){return BPromise['reject'](_0x42a487);}return _0x3312d0[_0x6e9e('0x26')]();};}function saveUpdates(_0x3fc617,_0x287861){return function(_0x585810){if(_0x585810){return _0x585810[_0x6e9e('0x27')](_0x3fc617)[_0x6e9e('0x28')](function(_0x29da6d){return _0x29da6d;});}return null;};}function removeEntity(_0x269dab,_0x5c72bb){return function(_0x5a84db){if(_0x5a84db){return _0x5a84db['destroy']()[_0x6e9e('0x28')](function(){_0x269dab[_0x6e9e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42bda2,_0x21161a){return function(_0x4e4003){if(!_0x4e4003){_0x42bda2['sendStatus'](0x194);}return _0x4e4003;};}function handleError(_0x347109,_0x3ec82a){_0x3ec82a=_0x3ec82a||0x1f4;return function(_0x19ad83){logger[_0x6e9e('0x29')](_0x19ad83[_0x6e9e('0x2a')]);if(_0x19ad83[_0x6e9e('0x2b')]){delete _0x19ad83[_0x6e9e('0x2b')];}_0x347109['status'](_0x3ec82a)['send'](_0x19ad83);};}exports[_0x6e9e('0x2c')]=function(_0x579408,_0x53e9a3){var _0x3f6381={},_0x1b5616={},_0x41fa35={'count':0x0,'rows':[]};var _0x5818b5=_[_0x6e9e('0x2d')](db[_0x6e9e('0x2e')][_0x6e9e('0x2f')],function(_0x4d502c){return{'name':_0x4d502c[_0x6e9e('0x30')],'type':_0x4d502c[_0x6e9e('0x31')][_0x6e9e('0x32')]};});_0x1b5616[_0x6e9e('0x33')]=_['map'](_0x5818b5,_0x6e9e('0x2b'));_0x1b5616[_0x6e9e('0x34')]=_[_0x6e9e('0x35')](_0x579408['query']);_0x1b5616['filters']=_[_0x6e9e('0x36')](_0x1b5616[_0x6e9e('0x33')],_0x1b5616[_0x6e9e('0x34')]);_0x3f6381[_0x6e9e('0x37')]=_[_0x6e9e('0x36')](_0x1b5616[_0x6e9e('0x33')],qs[_0x6e9e('0x38')](_0x579408[_0x6e9e('0x34')][_0x6e9e('0x38')]));_0x3f6381['attributes']=_0x3f6381[_0x6e9e('0x37')][_0x6e9e('0x39')]?_0x3f6381['attributes']:_0x1b5616['model'];if(!_0x579408['query']['hasOwnProperty'](_0x6e9e('0x3a'))){_0x3f6381['limit']=qs['limit'](_0x579408[_0x6e9e('0x34')][_0x6e9e('0x22')]);_0x3f6381[_0x6e9e('0x21')]=qs[_0x6e9e('0x21')](_0x579408['query'][_0x6e9e('0x21')]);}_0x3f6381[_0x6e9e('0x3b')]=qs[_0x6e9e('0x3c')](_0x579408[_0x6e9e('0x34')]['sort']);_0x3f6381[_0x6e9e('0x3d')]=qs[_0x6e9e('0x3e')](_[_0x6e9e('0x3f')](_0x579408['query'],_0x1b5616['filters']),_0x5818b5);if(_0x579408[_0x6e9e('0x34')][_0x6e9e('0x40')]){_0x3f6381[_0x6e9e('0x3d')]=_['merge'](_0x3f6381[_0x6e9e('0x3d')],{'$or':_[_0x6e9e('0x2d')](_0x5818b5,function(_0x2e00dd){if(_0x2e00dd[_0x6e9e('0x31')]!==_0x6e9e('0x41')){var _0x3bd4e6={};_0x3bd4e6[_0x2e00dd[_0x6e9e('0x2b')]]={'$like':'%'+_0x579408[_0x6e9e('0x34')][_0x6e9e('0x40')]+'%'};return _0x3bd4e6;}})});}_0x3f6381=_[_0x6e9e('0x42')]({},_0x3f6381,_0x579408['options']);var _0x205ee4={'where':_0x3f6381[_0x6e9e('0x3d')]};return db[_0x6e9e('0x2e')][_0x6e9e('0x20')](_0x205ee4)[_0x6e9e('0x28')](function(_0x9edc75){_0x41fa35[_0x6e9e('0x20')]=_0x9edc75;if(_0x579408[_0x6e9e('0x34')][_0x6e9e('0x43')]){_0x3f6381[_0x6e9e('0x44')]=[{'all':!![]}];}return db[_0x6e9e('0x2e')][_0x6e9e('0x45')](_0x3f6381);})[_0x6e9e('0x28')](function(_0x2a84f4){_0x41fa35[_0x6e9e('0x46')]=_0x2a84f4;return _0x41fa35;})['then'](respondWithFilteredResult(_0x53e9a3,_0x3f6381))['catch'](handleError(_0x53e9a3,null));};exports[_0x6e9e('0x47')]=function(_0x4c1780,_0x2d1194){var _0x5bf9c5={'raw':!![],'where':{'id':_0x4c1780[_0x6e9e('0x48')]['id']}},_0x129cb4={};_0x129cb4[_0x6e9e('0x33')]=_[_0x6e9e('0x35')](db[_0x6e9e('0x2e')]['rawAttributes']);_0x129cb4['query']=_[_0x6e9e('0x35')](_0x4c1780['query']);_0x129cb4[_0x6e9e('0x3e')]=_['intersection'](_0x129cb4[_0x6e9e('0x33')],_0x129cb4[_0x6e9e('0x34')]);_0x5bf9c5[_0x6e9e('0x37')]=_[_0x6e9e('0x36')](_0x129cb4[_0x6e9e('0x33')],qs['fields'](_0x4c1780[_0x6e9e('0x34')][_0x6e9e('0x38')]));_0x5bf9c5[_0x6e9e('0x37')]=_0x5bf9c5[_0x6e9e('0x37')][_0x6e9e('0x39')]?_0x5bf9c5[_0x6e9e('0x37')]:_0x129cb4['model'];if(_0x4c1780[_0x6e9e('0x34')][_0x6e9e('0x43')]){_0x5bf9c5['include']=[{'all':!![]}];}_0x5bf9c5=_[_0x6e9e('0x42')]({},_0x5bf9c5,_0x4c1780[_0x6e9e('0x49')]);return db[_0x6e9e('0x2e')][_0x6e9e('0x4a')](_0x5bf9c5)['then'](handleEntityNotFound(_0x2d1194,null))[_0x6e9e('0x28')](respondWithResult(_0x2d1194,null))[_0x6e9e('0x4b')](handleError(_0x2d1194,null));};exports[_0x6e9e('0x4c')]=function(_0x51c496,_0x18da53){return db[_0x6e9e('0x2e')]['create'](_0x51c496[_0x6e9e('0x4d')],{})[_0x6e9e('0x28')](respondWithResult(_0x18da53,0xc9))[_0x6e9e('0x4b')](handleError(_0x18da53,null));};exports[_0x6e9e('0x27')]=function(_0x133449,_0x183a4f){if(_0x133449[_0x6e9e('0x4d')]['id']){delete _0x133449[_0x6e9e('0x4d')]['id'];}return db[_0x6e9e('0x2e')]['find']({'where':{'id':_0x133449[_0x6e9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x183a4f,null))[_0x6e9e('0x28')](saveUpdates(_0x133449[_0x6e9e('0x4d')],null))[_0x6e9e('0x28')](respondWithResult(_0x183a4f,null))[_0x6e9e('0x4b')](handleError(_0x183a4f,null));};exports[_0x6e9e('0x4e')]=function(_0x1b3878,_0x26b189){return db['ChatInternalMessage'][_0x6e9e('0x4a')]({'where':{'id':_0x1b3878[_0x6e9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x26b189,null))[_0x6e9e('0x28')](removeEntity(_0x26b189,null))[_0x6e9e('0x4b')](handleError(_0x26b189,null));};exports[_0x6e9e('0x4f')]=function(_0x129a2f,_0xe6bda){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0xe6bda,null))['catch'](handleError(_0xe6bda,null));};function wrapUser(_0xd943ad){return function(_0x156506){var _0x16c1bb=_0xd943ad[_0x6e9e('0x50')]({'plain':!![]});_0x16c1bb['messages']=[];if(_0x156506){_0x16c1bb[_0x6e9e('0x51')]=_0x156506['createdAt'];_0x16c1bb['lastMessage']=_0x156506;}else{_0x16c1bb[_0x6e9e('0x51')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x16c1bb['lastMessage']={};}return _0x16c1bb;};}exports[_0x6e9e('0x52')]=function(_0x1b7149,_0x5e3ef1,_0x8c1400){var _0x1c95d5=[];return db['User'][_0x6e9e('0x45')]({'where':{'role':[_0x6e9e('0x53'),_0x6e9e('0x54'),_0x6e9e('0x55')]},'attributes':['id',_0x6e9e('0x56'),_0x6e9e('0x2b'),_0x6e9e('0x57'),'userpic',_0x6e9e('0x58'),_0x6e9e('0x59'),_0x6e9e('0x5a'),_0x6e9e('0x5b'),_0x6e9e('0x5c')],'order':qs[_0x6e9e('0x3c')]('-online'),'include':[{'model':db[_0x6e9e('0x5d')],'as':_0x6e9e('0x5e'),'attributes':['id',_0x6e9e('0x2b'),_0x6e9e('0x31')],'through':{'attributes':[]}}]})[_0x6e9e('0x28')](function(_0x1be8d3){if(_0x1be8d3){var _0x4e5370=_0x1b7149[_0x6e9e('0x55')][_0x6e9e('0x50')]({'plain':!![]});if(!_0x4e5370)throw new Error(_0x6e9e('0x5f'));if(_0x4e5370[_0x6e9e('0x57')]===_0x6e9e('0x55')){return db['UserProfileSection']['find']({'where':{'name':_0x6e9e('0x60'),'userProfileId':_0x4e5370[_0x6e9e('0x61')]},'raw':!![]})[_0x6e9e('0x28')](function(_0xf0d272){if(_0xf0d272){if(_0xf0d272[_0x6e9e('0x62')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xf0d272['id']},'raw':!![]})['then'](function(_0xe9edd1){var _0x161488=[];if(_['isEmpty'](_0xe9edd1)){_0x161488=_[_0x6e9e('0x40')](_0x1be8d3,function(_0x58cc6a){if(_0x58cc6a[_0x6e9e('0x57')]!==_0x6e9e('0x53')){return _0x58cc6a;}});return _0x161488;}else{for(var _0x2fce24=0x0;_0x2fce24<_0x1be8d3[_0x6e9e('0x39')];_0x2fce24++){var _0x58c23e=_0x1be8d3[_0x2fce24];if(_0x58c23e[_0x6e9e('0x57')]===_0x6e9e('0x53')){var _0x48ce18=_[_0x6e9e('0x4a')](_0xe9edd1,function(_0x1b5d4a){return _0x1b5d4a[_0x6e9e('0x63')]===_0x58c23e['id'];});if(_0x48ce18)_0x161488[_0x6e9e('0x64')](_0x58c23e);}else{_0x161488[_0x6e9e('0x64')](_0x58c23e);}}return _0x161488;}});}else{return _0x1be8d3;}}else{var _0x302ca1=_['filter'](_0x1be8d3,function(_0xc2bc1c){if(_0xc2bc1c['role']!==_0x6e9e('0x53')){return _0xc2bc1c;}});return _0x302ca1;}});}else{return _0x1be8d3;}}})[_0x6e9e('0x28')](function(_0x2bc350){var _0x4cf1cd=[];if(_0x2bc350){_0x1c95d5=_0x2bc350;for(var _0xbf5dd3=0x0;_0xbf5dd3<_0x2bc350['length'];_0xbf5dd3+=0x1){_0x1c95d5[_0xbf5dd3][_0x6e9e('0x65')]=[];_0x4cf1cd[_0x6e9e('0x64')](db[_0x6e9e('0x2e')][_0x6e9e('0x4a')]({'where':{'FromId':[_0x1b7149[_0x6e9e('0x55')]['id'],_0x2bc350[_0xbf5dd3]['id']],'ToId':[_0x1b7149[_0x6e9e('0x55')]['id'],_0x2bc350[_0xbf5dd3]['id']],'ChatGroupId':null},'attributes':['id',_0x6e9e('0x66'),_0x6e9e('0x67'),_0x6e9e('0x68'),_0x6e9e('0x69'),_0x6e9e('0x4d')],'order':qs[_0x6e9e('0x3c')](_0x6e9e('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2bc350[_0xbf5dd3])));}return BPromise['all'](_0x4cf1cd);}return[];})[_0x6e9e('0x28')](function(_0x5d6fd0){return{'rows':_0x5d6fd0,'count':_0x5d6fd0[_0x6e9e('0x39')]};})[_0x6e9e('0x28')](respondWithResult(_0x5e3ef1,null))['catch'](handleError(_0x5e3ef1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ba90077..d4de0da 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 _0xc8f3=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0xc8f3,0x1d3));var _0x3c8f=function(_0x9728b8,_0x5a1a6d){_0x9728b8=_0x9728b8-0x0;var _0x4b80ab=_0xc8f3[_0x9728b8];return _0x4b80ab;};'use strict';var EventEmitter=require(_0x3c8f('0x0'));var ChatInternalMessage=require(_0x3c8f('0x1'))['db'][_0x3c8f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3c8f('0x3')](0x0);var events={'afterCreate':_0x3c8f('0x4'),'afterUpdate':_0x3c8f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x18e6ed){return function(_0x58ead0,_0x4b2dfe,_0x1cf11a){ChatInternalMessageEvents[_0x3c8f('0x6')](_0x18e6ed+':'+_0x58ead0['id'],_0x58ead0);ChatInternalMessageEvents[_0x3c8f('0x6')](_0x18e6ed,_0x58ead0);_0x1cf11a(null);};}for(var e in events){if(events[_0x3c8f('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3c8f('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xc0aa=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x1e95ca,_0xf61e16){var _0x5441ec=function(_0x41547d){while(--_0x41547d){_0x1e95ca['push'](_0x1e95ca['shift']());}};_0x5441ec(++_0xf61e16);}(_0xc0aa,0x64));var _0xac0a=function(_0x24b916,_0x5a2822){_0x24b916=_0x24b916-0x0;var _0x5b3a4c=_0xc0aa[_0x24b916];return _0x5b3a4c;};'use strict';var EventEmitter=require(_0xac0a('0x0'));var ChatInternalMessage=require(_0xac0a('0x1'))['db'][_0xac0a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xac0a('0x3')](0x0);var events={'afterCreate':_0xac0a('0x4'),'afterUpdate':_0xac0a('0x5'),'afterDestroy':_0xac0a('0x6')};function emitEvent(_0x4bd446){return function(_0x4de31a,_0x36dc47,_0x45913b){ChatInternalMessageEvents[_0xac0a('0x7')](_0x4bd446+':'+_0x4de31a['id'],_0x4de31a);ChatInternalMessageEvents[_0xac0a('0x7')](_0x4bd446,_0x4de31a);_0x45913b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xac0a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8ef18db..d2a8bce 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 _0x51cb=['../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x51cb,0xbb));var _0xb51c=function(_0x43e41d,_0x56732b){_0x43e41d=_0x43e41d-0x0;var _0x591739=_0x51cb[_0x43e41d];return _0x591739;};'use strict';var _=require(_0xb51c('0x0'));var util=require(_0xb51c('0x1'));var logger=require('../../config/logger')(_0xb51c('0x2'));var moment=require(_0xb51c('0x3'));var BPromise=require(_0xb51c('0x4'));var rp=require(_0xb51c('0x5'));var fs=require('fs');var path=require(_0xb51c('0x6'));var rimraf=require(_0xb51c('0x7'));var config=require(_0xb51c('0x8'));var attributes=require(_0xb51c('0x9'));module[_0xb51c('0xa')]=function(_0x24c8b1,_0x3fcd1c){return _0x24c8b1[_0xb51c('0xb')]('ChatInternalMessage',attributes,{'tableName':_0xb51c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x54c1=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xcc1f6c,_0x3548a6){var _0x4a7fcc=function(_0x48b9e8){while(--_0x48b9e8){_0xcc1f6c['push'](_0xcc1f6c['shift']());}};_0x4a7fcc(++_0x3548a6);}(_0x54c1,0x77));var _0x154c=function(_0x2289e1,_0x40f5b6){_0x2289e1=_0x2289e1-0x0;var _0x3f842a=_0x54c1[_0x2289e1];return _0x3f842a;};'use strict';var _=require('lodash');var util=require(_0x154c('0x0'));var logger=require(_0x154c('0x1'))(_0x154c('0x2'));var moment=require(_0x154c('0x3'));var BPromise=require(_0x154c('0x4'));var rp=require(_0x154c('0x5'));var fs=require('fs');var path=require(_0x154c('0x6'));var rimraf=require(_0x154c('0x7'));var config=require(_0x154c('0x8'));var attributes=require(_0x154c('0x9'));module[_0x154c('0xa')]=function(_0x353043,_0x16e514){return _0x353043['define'](_0x154c('0xb'),attributes,{'tableName':_0x154c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x154c('0xd'),'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 47c4709..48c8a85 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 _0xd131=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x567b96,_0x1e9957){var _0x53e9be=function(_0x102853){while(--_0x102853){_0x567b96['push'](_0x567b96['shift']());}};_0x53e9be(++_0x1e9957);}(_0xd131,0x113));var _0x1d13=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0xd131[_0x426076];return _0x1e9565;};'use strict';var _=require(_0x1d13('0x0'));var util=require(_0x1d13('0x1'));var moment=require(_0x1d13('0x2'));var BPromise=require(_0x1d13('0x3'));var rs=require(_0x1d13('0x4'));var fs=require('fs');var Redis=require(_0x1d13('0x5'));var db=require(_0x1d13('0x6'))['db'];var utils=require(_0x1d13('0x7'));var logger=require(_0x1d13('0x8'))('rpc');var config=require(_0x1d13('0x9'));var jayson=require(_0x1d13('0xa'));var client=jayson['client'][_0x1d13('0xb')]({'port':0x232a});config[_0x1d13('0xc')]=_[_0x1d13('0xd')](config[_0x1d13('0xc')],{'host':_0x1d13('0xe'),'port':0x18eb});var socket=require(_0x1d13('0xf'))(new Redis(config[_0x1d13('0xc')]));require(_0x1d13('0x10'))[_0x1d13('0x11')](socket);function respondWithRpcPromise(_0x1c4f04,_0x4678bc,_0x1a363b){return new BPromise(function(_0xcf9968,_0x435b6b){return client[_0x1d13('0x12')](_0x1c4f04,_0x1a363b)['then'](function(_0x2bd022){logger[_0x1d13('0x13')](_0x1d13('0x14'),_0x4678bc,_0x1d13('0x15'));logger[_0x1d13('0x16')](_0x1d13('0x17'),_0x4678bc,_0x1d13('0x15'),JSON['stringify'](_0x2bd022));if(_0x2bd022[_0x1d13('0x18')]){if(_0x2bd022[_0x1d13('0x18')][_0x1d13('0x19')]===0x1f4){logger['error'](_0x1d13('0x14'),_0x4678bc,_0x2bd022[_0x1d13('0x18')]['message']);return _0x435b6b(_0x2bd022[_0x1d13('0x18')][_0x1d13('0x1a')]);}logger[_0x1d13('0x18')](_0x1d13('0x14'),_0x4678bc,_0x2bd022[_0x1d13('0x18')][_0x1d13('0x1a')]);return _0xcf9968(_0x2bd022[_0x1d13('0x18')][_0x1d13('0x1a')]);}else{logger[_0x1d13('0x13')](_0x1d13('0x14'),_0x4678bc,_0x1d13('0x15'));_0xcf9968(_0x2bd022[_0x1d13('0x1b')][_0x1d13('0x1a')]);}})['catch'](function(_0x2488d5){logger[_0x1d13('0x18')](_0x1d13('0x14'),_0x4678bc,_0x2488d5);_0x435b6b(_0x2488d5);});});} \ No newline at end of file +var _0x9334=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','redis','defaults'];(function(_0x35bf6c,_0x90d097){var _0x475451=function(_0x581cbf){while(--_0x581cbf){_0x35bf6c['push'](_0x35bf6c['shift']());}};_0x475451(++_0x90d097);}(_0x9334,0x16d));var _0x4933=function(_0x5741fa,_0x269ced){_0x5741fa=_0x5741fa-0x0;var _0x326cc6=_0x9334[_0x5741fa];return _0x326cc6;};'use strict';var _=require(_0x4933('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4933('0x1'));var rs=require(_0x4933('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4933('0x3'))['db'];var utils=require(_0x4933('0x4'));var logger=require('../../config/logger')(_0x4933('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4933('0x6')]['http']({'port':0x232a});config[_0x4933('0x7')]=_[_0x4933('0x8')](config[_0x4933('0x7')],{'host':_0x4933('0x9'),'port':0x18eb});var socket=require(_0x4933('0xa'))(new Redis(config[_0x4933('0x7')]));require(_0x4933('0xb'))[_0x4933('0xc')](socket);function respondWithRpcPromise(_0x257053,_0x2a440b,_0xc4641e){return new BPromise(function(_0x272036,_0x5dc87a){return client[_0x4933('0xd')](_0x257053,_0xc4641e)['then'](function(_0x574cdf){logger[_0x4933('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x2a440b,_0x4933('0xf'));logger[_0x4933('0x10')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2a440b,_0x4933('0xf'),JSON[_0x4933('0x11')](_0x574cdf));if(_0x574cdf[_0x4933('0x12')]){if(_0x574cdf[_0x4933('0x12')][_0x4933('0x13')]===0x1f4){logger[_0x4933('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x2a440b,_0x574cdf[_0x4933('0x12')][_0x4933('0x14')]);return _0x5dc87a(_0x574cdf[_0x4933('0x12')][_0x4933('0x14')]);}logger[_0x4933('0x12')](_0x4933('0x15'),_0x2a440b,_0x574cdf[_0x4933('0x12')][_0x4933('0x14')]);return _0x272036(_0x574cdf[_0x4933('0x12')][_0x4933('0x14')]);}else{logger[_0x4933('0xe')](_0x4933('0x15'),_0x2a440b,'request\x20sent');_0x272036(_0x574cdf['result'][_0x4933('0x14')]);}})['catch'](function(_0x42a6a6){logger[_0x4933('0x12')](_0x4933('0x15'),_0x2a440b,_0x42a6a6);_0x5dc87a(_0x42a6a6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 17198aa..a278259 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 _0x5ab4=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x61fc44,_0x38fc44){var _0x4a19e8=function(_0x596c1b){while(--_0x596c1b){_0x61fc44['push'](_0x61fc44['shift']());}};_0x4a19e8(++_0x38fc44);}(_0x5ab4,0x9f));var _0x45ab=function(_0x2510fa,_0x4613b8){_0x2510fa=_0x2510fa-0x0;var _0x477069=_0x5ab4[_0x2510fa];return _0x477069;};'use strict';var ChatInternalMessageEvents=require(_0x45ab('0x0'));var events=[_0x45ab('0x1'),_0x45ab('0x2'),_0x45ab('0x3')];function createListener(_0x40cdb2,_0x4e22bc){return function(_0xc77fdd){_0x4e22bc[_0x45ab('0x4')](_0x40cdb2,_0xc77fdd);};}function removeListener(_0x3d5dbd,_0x44ad44){return function(){ChatInternalMessageEvents[_0x45ab('0x5')](_0x3d5dbd,_0x44ad44);};}exports[_0x45ab('0x6')]=function(_0x5483f1){for(var _0x3b4d24=0x0,_0x22a033=events[_0x45ab('0x7')];_0x3b4d24<_0x22a033;_0x3b4d24++){var _0x4250ec=events[_0x3b4d24];var _0x2beb3a=createListener(_0x45ab('0x8')+_0x4250ec,_0x5483f1);ChatInternalMessageEvents['on'](_0x4250ec,_0x2beb3a);}}; \ No newline at end of file +var _0x834d=['update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x238284,_0x587392){var _0x250076=function(_0x3193a1){while(--_0x3193a1){_0x238284['push'](_0x238284['shift']());}};_0x250076(++_0x587392);}(_0x834d,0x140));var _0xd834=function(_0x452cff,_0xfa40a4){_0x452cff=_0x452cff-0x0;var _0x55108a=_0x834d[_0x452cff];return _0x55108a;};'use strict';var ChatInternalMessageEvents=require(_0xd834('0x0'));var events=[_0xd834('0x1'),'remove',_0xd834('0x2')];function createListener(_0x555e39,_0x48410e){return function(_0x19a31d){_0x48410e[_0xd834('0x3')](_0x555e39,_0x19a31d);};}function removeListener(_0x2d838f,_0xfee6e0){return function(){ChatInternalMessageEvents['removeListener'](_0x2d838f,_0xfee6e0);};}exports[_0xd834('0x4')]=function(_0x3f0759){for(var _0x5e696=0x0,_0x42623d=events[_0xd834('0x5')];_0x5e696<_0x42623d;_0x5e696++){var _0x256853=events[_0x5e696];var _0x51c989=createListener(_0xd834('0x6')+_0x256853,_0x3f0759);ChatInternalMessageEvents['on'](_0x256853,_0x51c989);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0b581a0..48a8c0c 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x2756b5,_0x2e215d){var _0x3819c3=function(_0x56f099){while(--_0x56f099){_0x2756b5['push'](_0x2756b5['shift']());}};_0x3819c3(++_0x2e215d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x2dfe88,_0x3bdf2f){var _0x585144=function(_0xaf986e){while(--_0xaf986e){_0x2dfe88['push'](_0x2dfe88['shift']());}};_0x585144(++_0x3bdf2f);}(_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['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 20c5de6..71188e7 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 _0x8d22=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0x8d22,0x1cf));var _0x28d2=function(_0x419727,_0x5dfcfc){_0x419727=_0x419727-0x0;var _0x3645c9=_0x8d22[_0x419727];return _0x3645c9;};'use strict';var Sequelize=require(_0x28d2('0x0'));module[_0x28d2('0x1')]={'body':{'type':Sequelize[_0x28d2('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x28d2('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x28d2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x28d2('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x28d2('0x5')]}}; \ No newline at end of file +var _0xa93b=['out','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa93b,0x10c));var _0xba93=function(_0x3322af,_0x188964){_0x3322af=_0x3322af-0x0;var _0xafd2aa=_0xa93b[_0x3322af];return _0xafd2aa;};'use strict';var Sequelize=require(_0xba93('0x0'));module[_0xba93('0x1')]={'body':{'type':Sequelize['TEXT'](_0xba93('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xba93('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xba93('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xba93('0x4')]('in',_0xba93('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xba93('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4aee290..b6033fe 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 _0x5cfb=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','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','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','reject','save','then','stack','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','order','sort','where','merge','type','filter','options','includeAll','params','create','body','find','describe','../../config/logger','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','manual','interface','channel','event','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x583f72,_0x22e8d3){var _0x1ef581=function(_0x1e58f6){while(--_0x1e58f6){_0x583f72['push'](_0x583f72['shift']());}};_0x1ef581(++_0x22e8d3);}(_0x5cfb,0x1b8));var _0xb5cf=function(_0x2d7832,_0x2ada44){_0x2d7832=_0x2d7832-0x0;var _0x2e852b=_0x5cfb[_0x2d7832];return _0x2e852b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb5cf('0x0'));var rimraf=require(_0xb5cf('0x1'));var zipdir=require(_0xb5cf('0x2'));var jsonpatch=require(_0xb5cf('0x3'));var rp=require(_0xb5cf('0x4'));var moment=require(_0xb5cf('0x5'));var BPromise=require(_0xb5cf('0x6'));var Mustache=require('mustache');var util=require(_0xb5cf('0x7'));var path=require(_0xb5cf('0x8'));var sox=require(_0xb5cf('0x9'));var csv=require(_0xb5cf('0xa'));var ejs=require(_0xb5cf('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb5cf('0xc'));var crypto=require('crypto');var jsforce=require(_0xb5cf('0xd'));var deskjs=require(_0xb5cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb5cf('0xf'));var Papa=require(_0xb5cf('0x10'));var Redis=require(_0xb5cf('0x11'));var authService=require(_0xb5cf('0x12'));var qs=require(_0xb5cf('0x13'));var as=require(_0xb5cf('0x14'));var hardwareService=require(_0xb5cf('0x15'));var logger=require('../../config/logger')(_0xb5cf('0x16'));var utils=require('../../config/utils');var config=require(_0xb5cf('0x17'));var db=require(_0xb5cf('0x18'))['db'];config[_0xb5cf('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb5cf('0x1a'))(new Redis(config['redis']));require(_0xb5cf('0x1b'))['register'](socket);var jayson=require(_0xb5cf('0x1c'));var client=jayson[_0xb5cf('0x1d')][_0xb5cf('0x1e')]({'port':0x232c});var client9002=jayson[_0xb5cf('0x1d')][_0xb5cf('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1df26f,_0x17dddb,_0x5b575a){if(_0x5b575a){var _0x20652e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20652e[_0xb5cf('0x1f')](_0x17dddb)){return _0x1df26f;}else{throw new db['Sequelize']['ValidationError'](_0xb5cf('0x20'));}}else{return _0x1df26f;}}function respondWithRpcPromise(_0x30fc8d,_0x49e068,_0x1edb6d,_0x7f2c10){return new BPromise(function(_0x405f12,_0x1cd574){var _0x476987=_0x7f2c10||client;return _0x476987[_0xb5cf('0x21')](_0x30fc8d,_0x1edb6d)['then'](function(_0x30548d){logger[_0xb5cf('0x22')](_0xb5cf('0x23'),_0x49e068,_0xb5cf('0x24'));logger['debug'](_0xb5cf('0x25'),_0x49e068,_0xb5cf('0x24'),JSON[_0xb5cf('0x26')](_0x30548d));if(_0x30548d[_0xb5cf('0x27')]){if(_0x30548d[_0xb5cf('0x27')]['code']===0x1f4){logger['error'](_0xb5cf('0x23'),_0x49e068,_0x30548d[_0xb5cf('0x27')][_0xb5cf('0x28')]);return _0x1cd574(_0x30548d[_0xb5cf('0x27')][_0xb5cf('0x28')]);}logger[_0xb5cf('0x27')](_0xb5cf('0x23'),_0x49e068,_0x30548d[_0xb5cf('0x27')][_0xb5cf('0x28')]);return _0x405f12(_0x30548d['error'][_0xb5cf('0x28')]);}else{logger[_0xb5cf('0x22')](_0xb5cf('0x23'),_0x49e068,_0xb5cf('0x24'));_0x405f12(_0x30548d[_0xb5cf('0x29')][_0xb5cf('0x28')]);}})[_0xb5cf('0x2a')](function(_0x222790){logger[_0xb5cf('0x27')]('ChatMessage,\x20%s,\x20%s',_0x49e068,_0x222790);_0x1cd574(_0x222790);});});}function respondWithStatusCode(_0xd3c468,_0x29ca20){_0x29ca20=_0x29ca20||0xcc;return function(_0x27f00a){if(_0x27f00a){return _0xd3c468[_0xb5cf('0x2b')](_0x29ca20);}return _0xd3c468[_0xb5cf('0x2c')](_0x29ca20)[_0xb5cf('0x2d')]();};}function respondWithResult(_0x2e67ed,_0x1eecac){_0x1eecac=_0x1eecac||0xc8;return function(_0x39ad1f){if(_0x39ad1f){return _0x2e67ed['status'](_0x1eecac)[_0xb5cf('0x2e')](_0x39ad1f);}};}function respondWithFilteredResult(_0x5b7aab,_0x151397){return function(_0x337f61){if(_0x337f61){var _0x3dc096=_0x337f61[_0xb5cf('0x2f')],_0x5b9c0a=_0x151397[_0xb5cf('0x30')],_0x33b4b5=_0x151397['offset']+_0x151397[_0xb5cf('0x31')],_0x5e2b54;if(_0x33b4b5>=_0x3dc096){_0x33b4b5=_0x3dc096;_0x5e2b54=0xc8;}else{_0x5e2b54=0xce;}_0x5b7aab[_0xb5cf('0x2c')](_0x5e2b54);return _0x5b7aab['set']('Content-Range',_0x5b9c0a+'-'+_0x33b4b5+'/'+_0x3dc096)[_0xb5cf('0x2e')](_0x337f61);}return null;};}function patchUpdates(_0x2d7629){return function(_0x4aa25e){try{jsonpatch['apply'](_0x4aa25e,_0x2d7629,!![]);}catch(_0x5d291b){return BPromise[_0xb5cf('0x32')](_0x5d291b);}return _0x4aa25e[_0xb5cf('0x33')]();};}function saveUpdates(_0x1c50b7,_0x3fde54){return function(_0x2e8de0){if(_0x2e8de0){return _0x2e8de0['update'](_0x1c50b7)[_0xb5cf('0x34')](function(_0x55a866){return _0x55a866;});}return null;};}function removeEntity(_0x12409b,_0x55cabc){return function(_0x1c2cab){if(_0x1c2cab){return _0x1c2cab['destroy']()[_0xb5cf('0x34')](function(){_0x12409b[_0xb5cf('0x2c')](0xcc)[_0xb5cf('0x2d')]();});}};}function handleEntityNotFound(_0x26ed3c,_0x4d5823){return function(_0x14e65f){if(!_0x14e65f){_0x26ed3c[_0xb5cf('0x2b')](0x194);}return _0x14e65f;};}function handleError(_0x1b5aa0,_0x5cd506){_0x5cd506=_0x5cd506||0x1f4;return function(_0x57613b){logger[_0xb5cf('0x27')](_0x57613b[_0xb5cf('0x35')]);if(_0x57613b['name']){delete _0x57613b['name'];}_0x1b5aa0[_0xb5cf('0x2c')](_0x5cd506)[_0xb5cf('0x36')](_0x57613b);};}exports[_0xb5cf('0x37')]=function(_0x2569d6,_0x48e916){var _0x1825e9={},_0x2e6b58={},_0x527110={'count':0x0,'rows':[]};var _0x5378a6=_[_0xb5cf('0x38')](db[_0xb5cf('0x39')][_0xb5cf('0x3a')],function(_0x4d53bb){return{'name':_0x4d53bb[_0xb5cf('0x3b')],'type':_0x4d53bb['type'][_0xb5cf('0x3c')]};});_0x2e6b58[_0xb5cf('0x3d')]=_[_0xb5cf('0x38')](_0x5378a6,_0xb5cf('0x3e'));_0x2e6b58[_0xb5cf('0x3f')]=_[_0xb5cf('0x40')](_0x2569d6[_0xb5cf('0x3f')]);_0x2e6b58[_0xb5cf('0x41')]=_['intersection'](_0x2e6b58[_0xb5cf('0x3d')],_0x2e6b58[_0xb5cf('0x3f')]);_0x1825e9[_0xb5cf('0x42')]=_[_0xb5cf('0x43')](_0x2e6b58[_0xb5cf('0x3d')],qs['fields'](_0x2569d6[_0xb5cf('0x3f')][_0xb5cf('0x44')]));_0x1825e9[_0xb5cf('0x42')]=_0x1825e9[_0xb5cf('0x42')][_0xb5cf('0x45')]?_0x1825e9['attributes']:_0x2e6b58[_0xb5cf('0x3d')];if(!_0x2569d6[_0xb5cf('0x3f')]['hasOwnProperty']('nolimit')){_0x1825e9[_0xb5cf('0x31')]=qs[_0xb5cf('0x31')](_0x2569d6[_0xb5cf('0x3f')][_0xb5cf('0x31')]);_0x1825e9['offset']=qs[_0xb5cf('0x30')](_0x2569d6['query']['offset']);}_0x1825e9[_0xb5cf('0x46')]=qs[_0xb5cf('0x47')](_0x2569d6[_0xb5cf('0x3f')][_0xb5cf('0x47')]);_0x1825e9[_0xb5cf('0x48')]=qs[_0xb5cf('0x41')](_['pick'](_0x2569d6[_0xb5cf('0x3f')],_0x2e6b58[_0xb5cf('0x41')]),_0x5378a6);if(_0x2569d6['query']['filter']){_0x1825e9[_0xb5cf('0x48')]=_[_0xb5cf('0x49')](_0x1825e9['where'],{'$or':_[_0xb5cf('0x38')](_0x5378a6,function(_0xc051b7){if(_0xc051b7[_0xb5cf('0x4a')]!=='VIRTUAL'){var _0x4cd7cf={};_0x4cd7cf[_0xc051b7[_0xb5cf('0x3e')]]={'$like':'%'+_0x2569d6[_0xb5cf('0x3f')][_0xb5cf('0x4b')]+'%'};return _0x4cd7cf;}})});}_0x1825e9=_['merge']({},_0x1825e9,_0x2569d6[_0xb5cf('0x4c')]);var _0x2d4531={'where':_0x1825e9['where']};return db[_0xb5cf('0x39')][_0xb5cf('0x2f')](_0x2d4531)[_0xb5cf('0x34')](function(_0x5db8cd){_0x527110['count']=_0x5db8cd;if(_0x2569d6[_0xb5cf('0x3f')][_0xb5cf('0x4d')]){_0x1825e9['include']=[{'all':!![]}];}return db[_0xb5cf('0x39')]['findAll'](_0x1825e9);})[_0xb5cf('0x34')](function(_0x37d0e1){_0x527110['rows']=_0x37d0e1;return _0x527110;})[_0xb5cf('0x34')](respondWithFilteredResult(_0x48e916,_0x1825e9))[_0xb5cf('0x2a')](handleError(_0x48e916,null));};exports['show']=function(_0x3dc946,_0x4e41fe){var _0x5ba44c={'raw':!![],'where':{'id':_0x3dc946[_0xb5cf('0x4e')]['id']}},_0x2be3d7={};_0x2be3d7[_0xb5cf('0x3d')]=_[_0xb5cf('0x40')](db[_0xb5cf('0x39')][_0xb5cf('0x3a')]);_0x2be3d7[_0xb5cf('0x3f')]=_[_0xb5cf('0x40')](_0x3dc946[_0xb5cf('0x3f')]);_0x2be3d7[_0xb5cf('0x41')]=_[_0xb5cf('0x43')](_0x2be3d7[_0xb5cf('0x3d')],_0x2be3d7[_0xb5cf('0x3f')]);_0x5ba44c[_0xb5cf('0x42')]=_[_0xb5cf('0x43')](_0x2be3d7['model'],qs[_0xb5cf('0x44')](_0x3dc946[_0xb5cf('0x3f')][_0xb5cf('0x44')]));_0x5ba44c[_0xb5cf('0x42')]=_0x5ba44c[_0xb5cf('0x42')]['length']?_0x5ba44c[_0xb5cf('0x42')]:_0x2be3d7[_0xb5cf('0x3d')];if(_0x3dc946[_0xb5cf('0x3f')]['includeAll']){_0x5ba44c['include']=[{'all':!![]}];}_0x5ba44c=_[_0xb5cf('0x49')]({},_0x5ba44c,_0x3dc946['options']);return db[_0xb5cf('0x39')]['find'](_0x5ba44c)[_0xb5cf('0x34')](handleEntityNotFound(_0x4e41fe,null))[_0xb5cf('0x34')](respondWithResult(_0x4e41fe,null))[_0xb5cf('0x2a')](handleError(_0x4e41fe,null));};exports[_0xb5cf('0x4f')]=function(_0x1077b3,_0x338fa3){return db['ChatMessage'][_0xb5cf('0x4f')](_0x1077b3[_0xb5cf('0x50')],{})['then'](respondWithResult(_0x338fa3,0xc9))['catch'](handleError(_0x338fa3,null));};exports['update']=function(_0x36691c,_0x4d949c){if(_0x36691c[_0xb5cf('0x50')]['id']){delete _0x36691c[_0xb5cf('0x50')]['id'];}return db['ChatMessage'][_0xb5cf('0x51')]({'where':{'id':_0x36691c[_0xb5cf('0x4e')]['id']}})[_0xb5cf('0x34')](handleEntityNotFound(_0x4d949c,null))[_0xb5cf('0x34')](saveUpdates(_0x36691c[_0xb5cf('0x50')],null))[_0xb5cf('0x34')](respondWithResult(_0x4d949c,null))[_0xb5cf('0x2a')](handleError(_0x4d949c,null));};exports['destroy']=function(_0xdf5d74,_0x268bd8){return db[_0xb5cf('0x39')][_0xb5cf('0x51')]({'where':{'id':_0xdf5d74[_0xb5cf('0x4e')]['id']}})[_0xb5cf('0x34')](handleEntityNotFound(_0x268bd8,null))[_0xb5cf('0x34')](removeEntity(_0x268bd8,null))['catch'](handleError(_0x268bd8,null));};exports['describe']=function(_0x114cf2,_0x4979d6){return db[_0xb5cf('0x39')][_0xb5cf('0x52')]()[_0xb5cf('0x34')](respondWithResult(_0x4979d6,null))[_0xb5cf('0x2a')](handleError(_0x4979d6,null));};var interaction_log=require(_0xb5cf('0x53'))('chat-interactions');exports[_0xb5cf('0x54')]=function(_0x16d187,_0x4e5357,_0x25884e){var _0x43058d={'channel':_0xb5cf('0x55')};if(_0x16d187[_0xb5cf('0x50')]['id']){delete _0x16d187[_0xb5cf('0x50')]['id'];}_0x16d187[_0xb5cf('0x50')][_0xb5cf('0x56')]=!![];_0x16d187[_0xb5cf('0x50')]['readAt']=moment()[_0xb5cf('0x57')](_0xb5cf('0x58'));_0x16d187['body'][_0xb5cf('0x59')]=_0x16d187[_0xb5cf('0x50')][_0xb5cf('0x59')]||_0x16d187[_0xb5cf('0x5a')]['id'];return db[_0xb5cf('0x39')][_0xb5cf('0x51')]({'where':{'id':_0x16d187['params']['id'],'UserId':null},'include':[{'model':db[_0xb5cf('0x5b')],'as':'Contact'}]})[_0xb5cf('0x34')](handleEntityNotFound(_0x4e5357,null))[_0xb5cf('0x34')](saveUpdates(_0x16d187[_0xb5cf('0x50')],null))['then'](function(_0x2a69db){if(_0x2a69db){_0x43058d[_0xb5cf('0x28')]=_0x2a69db[_0xb5cf('0x5c')]({'plain':!![]});return db[_0xb5cf('0x5d')]['find']({'where':{'id':_0x2a69db[_0xb5cf('0x5e')]}});}return null;})[_0xb5cf('0x34')](handleEntityNotFound(_0x4e5357,null))['then'](function(_0x111cf3){if(_0x111cf3){return _0x111cf3['update']({'UserId':_0x16d187[_0xb5cf('0x50')][_0xb5cf('0x59')],'read1stAt':_['isNil'](_0x111cf3['read1stAt'])?moment()[_0xb5cf('0x57')](_0xb5cf('0x58')):undefined});}return null;})[_0xb5cf('0x34')](function(_0x264fd2){if(_0x264fd2){_0x43058d[_0xb5cf('0x5f')]=_0x264fd2[_0xb5cf('0x5c')]({'plain':!![]});interaction_log[_0xb5cf('0x22')](_0xb5cf('0x60'),_0x16d187[_0xb5cf('0x5a')]['id'],_0x16d187[_0xb5cf('0x5a')][_0xb5cf('0x3e')],_0x16d187[_0xb5cf('0x5a')][_0xb5cf('0x61')],_0x43058d[_0xb5cf('0x5f')]['id'],_0x16d187[_0xb5cf('0x50')]?JSON[_0xb5cf('0x26')](_0x16d187[_0xb5cf('0x50')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x43058d);}return null;})[_0xb5cf('0x34')](function(_0x160204){if(_0x160204){if(_0x16d187['body'][_0xb5cf('0x62')]){_0x43058d[_0xb5cf('0x28')][_0xb5cf('0x63')]=util[_0xb5cf('0x57')]('SIP/%s',_0x16d187[_0xb5cf('0x5a')][_0xb5cf('0x3e')]);_0x43058d[_0xb5cf('0x28')][_0xb5cf('0x64')]=_0x43058d[_0xb5cf('0x64')];_0x43058d[_0xb5cf('0x28')][_0xb5cf('0x65')]='accept';return respondWithRpcPromise(_0xb5cf('0x66'),'EventManager',{'event':_0xb5cf('0x67'),'message':_[_0xb5cf('0x49')](_0x43058d[_0xb5cf('0x28')],JSON[_0xb5cf('0x68')](_0x43058d['interaction'][_0xb5cf('0x69')]))},client9002)[_0xb5cf('0x34')](function(){return _0x43058d;});}return _0x43058d;}return null;})[_0xb5cf('0x34')](respondWithResult(_0x4e5357,null))['catch'](handleError(_0x4e5357,null));};var interaction_log=require(_0xb5cf('0x53'))('chat-interactions');exports[_0xb5cf('0x32')]=function(_0x1af255,_0x15d458,_0x3f37f6){var _0x4707d7={'agent':{},'channel':_0xb5cf('0x55')};if(_0x1af255['body']['id']){delete _0x1af255[_0xb5cf('0x50')]['id'];}_0x1af255['body'][_0xb5cf('0x59')]=_0x1af255[_0xb5cf('0x50')][_0xb5cf('0x59')]||_0x1af255['user']['id'];_0x4707d7[_0xb5cf('0x6a')]['id']=_0x1af255[_0xb5cf('0x50')][_0xb5cf('0x59')];return db['ChatMessage'][_0xb5cf('0x51')]({'where':{'id':_0x1af255[_0xb5cf('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x15d458,null))['then'](function(_0x42d87b){if(_0x42d87b){_0x4707d7[_0xb5cf('0x28')]=_0x42d87b[_0xb5cf('0x5c')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x42d87b['ChatInteractionId']}});}return null;})[_0xb5cf('0x34')](handleEntityNotFound(_0x15d458,null))[_0xb5cf('0x34')](function(_0x295c54){if(_0x295c54){_0x4707d7['interaction']=_0x295c54['get']({'plain':!![]});interaction_log[_0xb5cf('0x22')](_0xb5cf('0x6b'),_0x1af255[_0xb5cf('0x5a')]['id'],_0x1af255[_0xb5cf('0x5a')][_0xb5cf('0x3e')],_0x1af255[_0xb5cf('0x5a')]['role'],_0x4707d7['interaction']['id'],_0x1af255[_0xb5cf('0x50')]?JSON[_0xb5cf('0x26')](_0x1af255[_0xb5cf('0x50')]):_0xb5cf('0x6c'));return respondWithRpcPromise(_0xb5cf('0x6d'),_0xb5cf('0x6e'),_0x4707d7);}return null;})[_0xb5cf('0x34')](function(_0x3f84a0){if(_0x3f84a0){_0x3f84a0[_0xb5cf('0x28')]['interface']=util[_0xb5cf('0x57')](_0xb5cf('0x6f'),_0x1af255[_0xb5cf('0x5a')][_0xb5cf('0x3e')]);_0x3f84a0[_0xb5cf('0x28')][_0xb5cf('0x64')]=_0x4707d7[_0xb5cf('0x64')];_0x3f84a0[_0xb5cf('0x28')][_0xb5cf('0x65')]=_0xb5cf('0x32');respondWithRpcPromise(_0xb5cf('0x66'),'EventManager',{'event':_0xb5cf('0x70'),'message':_0x3f84a0[_0xb5cf('0x28')]},client9002);return _0x4707d7;}return null;})[_0xb5cf('0x34')](respondWithResult(_0x15d458,null))[_0xb5cf('0x2a')](handleError(_0x15d458,null));}; \ No newline at end of file +var _0x7742=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','rows','show','options','create','body','update','find','params','destroy','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','manual','channel','event','EventManager','acceptmessage','parse','formData','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','interface','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','./chatMessage.socket','register','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','then','info','ChatMessage,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7742,0x1d7));var _0x2774=function(_0x416c40,_0x4d13fb){_0x416c40=_0x416c40-0x0;var _0xed628=_0x7742[_0x416c40];return _0xed628;};'use strict';var pdf=require(_0x2774('0x0'));var emlformat=require(_0x2774('0x1'));var rimraf=require(_0x2774('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2774('0x3'));var rp=require(_0x2774('0x4'));var moment=require(_0x2774('0x5'));var BPromise=require(_0x2774('0x6'));var Mustache=require(_0x2774('0x7'));var util=require(_0x2774('0x8'));var path=require(_0x2774('0x9'));var sox=require(_0x2774('0xa'));var csv=require(_0x2774('0xb'));var ejs=require(_0x2774('0xc'));var fs=require('fs');var _=require(_0x2774('0xd'));var squel=require(_0x2774('0xe'));var crypto=require(_0x2774('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2774('0xb'));var querystring=require(_0x2774('0x10'));var Papa=require(_0x2774('0x11'));var Redis=require('ioredis');var authService=require(_0x2774('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2774('0x13'));var hardwareService=require(_0x2774('0x14'));var logger=require(_0x2774('0x15'))(_0x2774('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2774('0x17')]=_[_0x2774('0x18')](config[_0x2774('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2774('0x19'))[_0x2774('0x1a')](socket);var jayson=require(_0x2774('0x1b'));var client=jayson[_0x2774('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2774('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5a7377,_0x1be531,_0x41c509){if(_0x41c509){var _0x2ec42b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ec42b['test'](_0x1be531)){return _0x5a7377;}else{throw new db[(_0x2774('0x1e'))][(_0x2774('0x1f'))](_0x2774('0x20'));}}else{return _0x5a7377;}}function respondWithRpcPromise(_0x16425f,_0x3d2cad,_0x50b4fa,_0xa45133){return new BPromise(function(_0x4b8764,_0x4805a4){var _0x512141=_0xa45133||client;return _0x512141[_0x2774('0x21')](_0x16425f,_0x50b4fa)[_0x2774('0x22')](function(_0x4010b0){logger[_0x2774('0x23')](_0x2774('0x24'),_0x3d2cad,_0x2774('0x25'));logger[_0x2774('0x26')](_0x2774('0x27'),_0x3d2cad,_0x2774('0x25'),JSON['stringify'](_0x4010b0));if(_0x4010b0[_0x2774('0x28')]){if(_0x4010b0[_0x2774('0x28')][_0x2774('0x29')]===0x1f4){logger[_0x2774('0x28')]('ChatMessage,\x20%s,\x20%s',_0x3d2cad,_0x4010b0[_0x2774('0x28')][_0x2774('0x2a')]);return _0x4805a4(_0x4010b0[_0x2774('0x28')][_0x2774('0x2a')]);}logger[_0x2774('0x28')](_0x2774('0x24'),_0x3d2cad,_0x4010b0[_0x2774('0x28')][_0x2774('0x2a')]);return _0x4b8764(_0x4010b0['error'][_0x2774('0x2a')]);}else{logger[_0x2774('0x23')](_0x2774('0x24'),_0x3d2cad,_0x2774('0x25'));_0x4b8764(_0x4010b0[_0x2774('0x2b')]['message']);}})[_0x2774('0x2c')](function(_0x61a516){logger[_0x2774('0x28')](_0x2774('0x24'),_0x3d2cad,_0x61a516);_0x4805a4(_0x61a516);});});}function respondWithStatusCode(_0x2fd1c5,_0x157dd3){_0x157dd3=_0x157dd3||0xcc;return function(_0x38772b){if(_0x38772b){return _0x2fd1c5[_0x2774('0x2d')](_0x157dd3);}return _0x2fd1c5['status'](_0x157dd3)[_0x2774('0x2e')]();};}function respondWithResult(_0x43b293,_0x4e527a){_0x4e527a=_0x4e527a||0xc8;return function(_0x37cb66){if(_0x37cb66){return _0x43b293[_0x2774('0x2f')](_0x4e527a)[_0x2774('0x30')](_0x37cb66);}};}function respondWithFilteredResult(_0x188939,_0x4091f5){return function(_0x417913){if(_0x417913){var _0x26917b=_0x417913['count'],_0x1650b0=_0x4091f5['offset'],_0x277d8d=_0x4091f5[_0x2774('0x31')]+_0x4091f5['limit'],_0x22ebf6;if(_0x277d8d>=_0x26917b){_0x277d8d=_0x26917b;_0x22ebf6=0xc8;}else{_0x22ebf6=0xce;}_0x188939[_0x2774('0x2f')](_0x22ebf6);return _0x188939[_0x2774('0x32')](_0x2774('0x33'),_0x1650b0+'-'+_0x277d8d+'/'+_0x26917b)[_0x2774('0x30')](_0x417913);}return null;};}function patchUpdates(_0x35246a){return function(_0x39f02e){try{jsonpatch[_0x2774('0x34')](_0x39f02e,_0x35246a,!![]);}catch(_0x27f3f2){return BPromise[_0x2774('0x35')](_0x27f3f2);}return _0x39f02e['save']();};}function saveUpdates(_0x4bb3d6,_0x90b2e6){return function(_0x59294d){if(_0x59294d){return _0x59294d['update'](_0x4bb3d6)[_0x2774('0x22')](function(_0x417c6f){return _0x417c6f;});}return null;};}function removeEntity(_0xcb8e51,_0x51ea51){return function(_0x454612){if(_0x454612){return _0x454612['destroy']()['then'](function(){_0xcb8e51['status'](0xcc)[_0x2774('0x2e')]();});}};}function handleEntityNotFound(_0x335419,_0x186d9d){return function(_0x48c036){if(!_0x48c036){_0x335419[_0x2774('0x2d')](0x194);}return _0x48c036;};}function handleError(_0x489982,_0x25339b){_0x25339b=_0x25339b||0x1f4;return function(_0x119b1a){logger[_0x2774('0x28')](_0x119b1a[_0x2774('0x36')]);if(_0x119b1a['name']){delete _0x119b1a[_0x2774('0x37')];}_0x489982[_0x2774('0x2f')](_0x25339b)[_0x2774('0x38')](_0x119b1a);};}exports[_0x2774('0x39')]=function(_0xff6be6,_0xb59bf9){var _0x14cc6d={},_0x238cc0={},_0xcf2917={'count':0x0,'rows':[]};var _0x3bbd08=_[_0x2774('0x3a')](db[_0x2774('0x3b')][_0x2774('0x3c')],function(_0x404f4f){return{'name':_0x404f4f[_0x2774('0x3d')],'type':_0x404f4f[_0x2774('0x3e')][_0x2774('0x3f')]};});_0x238cc0[_0x2774('0x40')]=_[_0x2774('0x3a')](_0x3bbd08,_0x2774('0x37'));_0x238cc0['query']=_[_0x2774('0x41')](_0xff6be6[_0x2774('0x42')]);_0x238cc0['filters']=_[_0x2774('0x43')](_0x238cc0[_0x2774('0x40')],_0x238cc0[_0x2774('0x42')]);_0x14cc6d['attributes']=_[_0x2774('0x43')](_0x238cc0[_0x2774('0x40')],qs[_0x2774('0x44')](_0xff6be6['query'][_0x2774('0x44')]));_0x14cc6d['attributes']=_0x14cc6d[_0x2774('0x45')][_0x2774('0x46')]?_0x14cc6d['attributes']:_0x238cc0[_0x2774('0x40')];if(!_0xff6be6[_0x2774('0x42')][_0x2774('0x47')](_0x2774('0x48'))){_0x14cc6d[_0x2774('0x49')]=qs[_0x2774('0x49')](_0xff6be6[_0x2774('0x42')][_0x2774('0x49')]);_0x14cc6d[_0x2774('0x31')]=qs[_0x2774('0x31')](_0xff6be6[_0x2774('0x42')]['offset']);}_0x14cc6d[_0x2774('0x4a')]=qs[_0x2774('0x4b')](_0xff6be6['query'][_0x2774('0x4b')]);_0x14cc6d[_0x2774('0x4c')]=qs[_0x2774('0x4d')](_[_0x2774('0x4e')](_0xff6be6[_0x2774('0x42')],_0x238cc0[_0x2774('0x4d')]),_0x3bbd08);if(_0xff6be6['query'][_0x2774('0x4f')]){_0x14cc6d[_0x2774('0x4c')]=_[_0x2774('0x50')](_0x14cc6d[_0x2774('0x4c')],{'$or':_['map'](_0x3bbd08,function(_0x2cbc5d){if(_0x2cbc5d['type']!==_0x2774('0x51')){var _0x5af94b={};_0x5af94b[_0x2cbc5d[_0x2774('0x37')]]={'$like':'%'+_0xff6be6[_0x2774('0x42')]['filter']+'%'};return _0x5af94b;}})});}_0x14cc6d=_[_0x2774('0x50')]({},_0x14cc6d,_0xff6be6['options']);var _0x31470b={'where':_0x14cc6d[_0x2774('0x4c')]};return db[_0x2774('0x3b')][_0x2774('0x52')](_0x31470b)[_0x2774('0x22')](function(_0x595d9f){_0xcf2917[_0x2774('0x52')]=_0x595d9f;if(_0xff6be6[_0x2774('0x42')][_0x2774('0x53')]){_0x14cc6d['include']=[{'all':!![]}];}return db[_0x2774('0x3b')]['findAll'](_0x14cc6d);})['then'](function(_0x9d6cea){_0xcf2917[_0x2774('0x54')]=_0x9d6cea;return _0xcf2917;})[_0x2774('0x22')](respondWithFilteredResult(_0xb59bf9,_0x14cc6d))[_0x2774('0x2c')](handleError(_0xb59bf9,null));};exports[_0x2774('0x55')]=function(_0x513f50,_0x5baadf){var _0x426401={'raw':!![],'where':{'id':_0x513f50['params']['id']}},_0x3f0328={};_0x3f0328[_0x2774('0x40')]=_[_0x2774('0x41')](db[_0x2774('0x3b')][_0x2774('0x3c')]);_0x3f0328['query']=_[_0x2774('0x41')](_0x513f50[_0x2774('0x42')]);_0x3f0328['filters']=_[_0x2774('0x43')](_0x3f0328['model'],_0x3f0328[_0x2774('0x42')]);_0x426401[_0x2774('0x45')]=_[_0x2774('0x43')](_0x3f0328['model'],qs[_0x2774('0x44')](_0x513f50[_0x2774('0x42')][_0x2774('0x44')]));_0x426401[_0x2774('0x45')]=_0x426401['attributes'][_0x2774('0x46')]?_0x426401[_0x2774('0x45')]:_0x3f0328['model'];if(_0x513f50[_0x2774('0x42')][_0x2774('0x53')]){_0x426401['include']=[{'all':!![]}];}_0x426401=_['merge']({},_0x426401,_0x513f50[_0x2774('0x56')]);return db[_0x2774('0x3b')]['find'](_0x426401)['then'](handleEntityNotFound(_0x5baadf,null))[_0x2774('0x22')](respondWithResult(_0x5baadf,null))[_0x2774('0x2c')](handleError(_0x5baadf,null));};exports['create']=function(_0x3ab71f,_0x1c7398){return db[_0x2774('0x3b')][_0x2774('0x57')](_0x3ab71f[_0x2774('0x58')],{})[_0x2774('0x22')](respondWithResult(_0x1c7398,0xc9))[_0x2774('0x2c')](handleError(_0x1c7398,null));};exports[_0x2774('0x59')]=function(_0x17fbde,_0x2d52db){if(_0x17fbde['body']['id']){delete _0x17fbde[_0x2774('0x58')]['id'];}return db[_0x2774('0x3b')][_0x2774('0x5a')]({'where':{'id':_0x17fbde[_0x2774('0x5b')]['id']}})[_0x2774('0x22')](handleEntityNotFound(_0x2d52db,null))[_0x2774('0x22')](saveUpdates(_0x17fbde[_0x2774('0x58')],null))[_0x2774('0x22')](respondWithResult(_0x2d52db,null))['catch'](handleError(_0x2d52db,null));};exports[_0x2774('0x5c')]=function(_0x3aba96,_0x34c858){return db[_0x2774('0x3b')]['find']({'where':{'id':_0x3aba96[_0x2774('0x5b')]['id']}})[_0x2774('0x22')](handleEntityNotFound(_0x34c858,null))[_0x2774('0x22')](removeEntity(_0x34c858,null))[_0x2774('0x2c')](handleError(_0x34c858,null));};exports[_0x2774('0x5d')]=function(_0x1740b7,_0x422626){return db[_0x2774('0x3b')][_0x2774('0x5d')]()[_0x2774('0x22')](respondWithResult(_0x422626,null))[_0x2774('0x2c')](handleError(_0x422626,null));};var interaction_log=require('../../config/logger')(_0x2774('0x5e'));exports[_0x2774('0x5f')]=function(_0x1e7a42,_0x173051,_0x3cafb9){var _0x227dec={'channel':_0x2774('0x60')};if(_0x1e7a42[_0x2774('0x58')]['id']){delete _0x1e7a42['body']['id'];}_0x1e7a42[_0x2774('0x58')]['read']=!![];_0x1e7a42[_0x2774('0x58')][_0x2774('0x61')]=moment()[_0x2774('0x62')](_0x2774('0x63'));_0x1e7a42['body'][_0x2774('0x64')]=_0x1e7a42['body']['UserId']||_0x1e7a42[_0x2774('0x65')]['id'];return db[_0x2774('0x3b')][_0x2774('0x5a')]({'where':{'id':_0x1e7a42[_0x2774('0x5b')]['id'],'UserId':null},'include':[{'model':db[_0x2774('0x66')],'as':_0x2774('0x67')}]})[_0x2774('0x22')](handleEntityNotFound(_0x173051,null))['then'](saveUpdates(_0x1e7a42['body'],null))['then'](function(_0x222a66){if(_0x222a66){_0x227dec[_0x2774('0x2a')]=_0x222a66[_0x2774('0x68')]({'plain':!![]});return db[_0x2774('0x69')]['find']({'where':{'id':_0x222a66['ChatInteractionId']}});}return null;})[_0x2774('0x22')](handleEntityNotFound(_0x173051,null))[_0x2774('0x22')](function(_0x4a7d49){if(_0x4a7d49){return _0x4a7d49['update']({'UserId':_0x1e7a42['body']['UserId'],'read1stAt':_[_0x2774('0x6a')](_0x4a7d49[_0x2774('0x6b')])?moment()[_0x2774('0x62')](_0x2774('0x63')):undefined});}return null;})['then'](function(_0x2caf7a){if(_0x2caf7a){_0x227dec[_0x2774('0x6c')]=_0x2caf7a[_0x2774('0x68')]({'plain':!![]});interaction_log[_0x2774('0x23')](_0x2774('0x6d'),_0x1e7a42[_0x2774('0x65')]['id'],_0x1e7a42[_0x2774('0x65')][_0x2774('0x37')],_0x1e7a42[_0x2774('0x65')][_0x2774('0x6e')],_0x227dec['interaction']['id'],_0x1e7a42[_0x2774('0x58')]?JSON[_0x2774('0x6f')](_0x1e7a42[_0x2774('0x58')]):'null');return respondWithRpcPromise(_0x2774('0x70'),_0x2774('0x71'),_0x227dec);}return null;})[_0x2774('0x22')](function(_0x3b17a0){if(_0x3b17a0){if(_0x1e7a42[_0x2774('0x58')][_0x2774('0x72')]){_0x227dec[_0x2774('0x2a')]['interface']=util[_0x2774('0x62')]('SIP/%s',_0x1e7a42[_0x2774('0x65')]['name']);_0x227dec[_0x2774('0x2a')]['channel']=_0x227dec[_0x2774('0x73')];_0x227dec[_0x2774('0x2a')][_0x2774('0x74')]=_0x2774('0x5f');return respondWithRpcPromise(_0x2774('0x75'),_0x2774('0x75'),{'event':_0x2774('0x76'),'message':_[_0x2774('0x50')](_0x227dec[_0x2774('0x2a')],JSON[_0x2774('0x77')](_0x227dec[_0x2774('0x6c')][_0x2774('0x78')]))},client9002)[_0x2774('0x22')](function(){return _0x227dec;});}return _0x227dec;}return null;})[_0x2774('0x22')](respondWithResult(_0x173051,null))[_0x2774('0x2c')](handleError(_0x173051,null));};var interaction_log=require(_0x2774('0x15'))(_0x2774('0x5e'));exports[_0x2774('0x35')]=function(_0x42cae2,_0x1c2841,_0x24dbe6){var _0x3353c1={'agent':{},'channel':_0x2774('0x60')};if(_0x42cae2[_0x2774('0x58')]['id']){delete _0x42cae2[_0x2774('0x58')]['id'];}_0x42cae2[_0x2774('0x58')][_0x2774('0x64')]=_0x42cae2[_0x2774('0x58')][_0x2774('0x64')]||_0x42cae2['user']['id'];_0x3353c1[_0x2774('0x79')]['id']=_0x42cae2[_0x2774('0x58')][_0x2774('0x64')];return db[_0x2774('0x3b')][_0x2774('0x5a')]({'where':{'id':_0x42cae2[_0x2774('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c2841,null))[_0x2774('0x22')](function(_0x4e6049){if(_0x4e6049){_0x3353c1[_0x2774('0x2a')]=_0x4e6049[_0x2774('0x68')]({'plain':!![]});return db[_0x2774('0x69')][_0x2774('0x5a')]({'where':{'id':_0x4e6049[_0x2774('0x7a')]}});}return null;})[_0x2774('0x22')](handleEntityNotFound(_0x1c2841,null))[_0x2774('0x22')](function(_0x176490){if(_0x176490){_0x3353c1[_0x2774('0x6c')]=_0x176490[_0x2774('0x68')]({'plain':!![]});interaction_log['info'](_0x2774('0x7b'),_0x42cae2[_0x2774('0x65')]['id'],_0x42cae2[_0x2774('0x65')][_0x2774('0x37')],_0x42cae2[_0x2774('0x65')][_0x2774('0x6e')],_0x3353c1['interaction']['id'],_0x42cae2[_0x2774('0x58')]?JSON['stringify'](_0x42cae2[_0x2774('0x58')]):_0x2774('0x7c'));return respondWithRpcPromise(_0x2774('0x7d'),'rejectMessage',_0x3353c1);}return null;})[_0x2774('0x22')](function(_0x59f395){if(_0x59f395){_0x59f395[_0x2774('0x2a')][_0x2774('0x7e')]=util[_0x2774('0x62')]('SIP/%s',_0x42cae2['user']['name']);_0x59f395[_0x2774('0x2a')][_0x2774('0x73')]=_0x3353c1['channel'];_0x59f395['message']['event']=_0x2774('0x35');respondWithRpcPromise(_0x2774('0x75'),_0x2774('0x75'),{'event':'rejectmessage','message':_0x59f395['message']},client9002);return _0x3353c1;}return null;})[_0x2774('0x22')](respondWithResult(_0x1c2841,null))[_0x2774('0x2c')](handleError(_0x1c2841,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2c171ec..7ef5156 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 _0xb96c=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x3da144,_0x578cbd){var _0x13fdc7=function(_0x2d2919){while(--_0x2d2919){_0x3da144['push'](_0x3da144['shift']());}};_0x13fdc7(++_0x578cbd);}(_0xb96c,0xff));var _0xcb96=function(_0x58321f,_0x5730b9){_0x58321f=_0x58321f-0x0;var _0x3728ea=_0xb96c[_0x58321f];return _0x3728ea;};'use strict';var EventEmitter=require(_0xcb96('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcb96('0x1')](0x0);var events={'afterCreate':_0xcb96('0x2'),'afterUpdate':_0xcb96('0x3'),'afterDestroy':_0xcb96('0x4')};function emitEvent(_0x3044c7){return function(_0x5c35af,_0x5a0ca8,_0x1acb4d){ChatMessageEvents[_0xcb96('0x5')](_0x3044c7+':'+_0x5c35af['id'],_0x5c35af);ChatMessageEvents[_0xcb96('0x5')](_0x3044c7,_0x5c35af);_0x1acb4d(null);};}for(var e in events){if(events[_0xcb96('0x6')](e)){var event=events[e];ChatMessage[_0xcb96('0x7')](e,emitEvent(event));}}module[_0xcb96('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xcb39=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x314fa4,_0x31ae76){var _0x32047b=function(_0x20f69f){while(--_0x20f69f){_0x314fa4['push'](_0x314fa4['shift']());}};_0x32047b(++_0x31ae76);}(_0xcb39,0x155));var _0x9cb3=function(_0x3c7c5c,_0x33c775){_0x3c7c5c=_0x3c7c5c-0x0;var _0x40d9b5=_0xcb39[_0x3c7c5c];return _0x40d9b5;};'use strict';var EventEmitter=require(_0x9cb3('0x0'));var ChatMessage=require(_0x9cb3('0x1'))['db'][_0x9cb3('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9cb3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9cb3('0x4'),'afterDestroy':_0x9cb3('0x5')};function emitEvent(_0x5790f8){return function(_0x233715,_0x39936b,_0x44d375){ChatMessageEvents['emit'](_0x5790f8+':'+_0x233715['id'],_0x233715);ChatMessageEvents[_0x9cb3('0x6')](_0x5790f8,_0x233715);_0x44d375(null);};}for(var e in events){if(events[_0x9cb3('0x7')](e)){var event=events[e];ChatMessage[_0x9cb3('0x8')](e,emitEvent(event));}}module[_0x9cb3('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d339f0c..d0a8373 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 _0xcfd3=['utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x52d7df,_0x5d5742){var _0x6163fc=function(_0x79d617){while(--_0x79d617){_0x52d7df['push'](_0x52d7df['shift']());}};_0x6163fc(++_0x5d5742);}(_0xcfd3,0x18a));var _0x3cfd=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xcfd3[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var util=require(_0x3cfd('0x0'));var logger=require('../../config/logger')(_0x3cfd('0x1'));var moment=require('moment');var BPromise=require(_0x3cfd('0x2'));var rp=require(_0x3cfd('0x3'));var fs=require('fs');var path=require(_0x3cfd('0x4'));var rimraf=require(_0x3cfd('0x5'));var config=require(_0x3cfd('0x6'));var attributes=require(_0x3cfd('0x7'));module['exports']=function(_0x41c3d9,_0x296a5b){return _0x41c3d9['define']('ChatMessage',attributes,{'tableName':_0x3cfd('0x8'),'paranoid':![],'indexes':[{'name':_0x3cfd('0x9'),'fields':[_0x3cfd('0xa')],'type':_0x3cfd('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd9f201,_0x4172f4,_0x2d9a29){var _0x44e1e8=_0x41c3d9[_0x3cfd('0xc')];var _0x2be9e7=_0xd9f201[_0x3cfd('0xd')]({'plain':!![]});if(_0x2be9e7[_0x3cfd('0xe')][_0x3cfd('0xf')]()==='in'||_0x2be9e7['direction'][_0x3cfd('0xf')]()===_0x3cfd('0x10')&&!_0x2be9e7[_0x3cfd('0x11')]&&!_[_0x3cfd('0x12')](_0x2be9e7[_0x3cfd('0x13')])){_0x44e1e8[_0x3cfd('0x14')][_0x3cfd('0x15')]({'where':{'id':_0x2be9e7['ChatInteractionId']}})[_0x3cfd('0x16')](function(_0x5c4d57){if(_0x5c4d57){_0x5c4d57[_0x3cfd('0x17')]({'lastMsgAt':_0x2be9e7[_0x3cfd('0x18')],'lastMsgDirection':_0x2be9e7[_0x3cfd('0xe')][_0x3cfd('0xf')]()});}})[_0x3cfd('0x19')](function(_0x58d494){console['error'](_0x58d494);});}_0x2d9a29();}},'charset':_0x3cfd('0x1a'),'collate':_0x3cfd('0x1b')});}; \ No newline at end of file +var _0xb986=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','out','secret','UserId','findOne','ChatInteractionId','then','update'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0xb986,0x1a4));var _0x6b98=function(_0x6e395e,_0x110b97){_0x6e395e=_0x6e395e-0x0;var _0x459e0a=_0xb986[_0x6e395e];return _0x459e0a;};'use strict';var _=require(_0x6b98('0x0'));var util=require('util');var logger=require(_0x6b98('0x1'))(_0x6b98('0x2'));var moment=require(_0x6b98('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b98('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b98('0x5'));var attributes=require('./chatMessage.attributes');module[_0x6b98('0x6')]=function(_0x50468f,_0x29b67c){return _0x50468f[_0x6b98('0x7')](_0x6b98('0x8'),attributes,{'tableName':_0x6b98('0x9'),'paranoid':![],'indexes':[{'name':_0x6b98('0xa'),'fields':[_0x6b98('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52c215,_0x12af1a,_0x24a647){var _0x3cca6c=_0x50468f['models'];var _0x2dce85=_0x52c215[_0x6b98('0xc')]({'plain':!![]});if(_0x2dce85[_0x6b98('0xd')]['toLowerCase']()==='in'||_0x2dce85['direction'][_0x6b98('0xe')]()===_0x6b98('0xf')&&!_0x2dce85[_0x6b98('0x10')]&&!_['isNil'](_0x2dce85[_0x6b98('0x11')])){_0x3cca6c['ChatInteraction'][_0x6b98('0x12')]({'where':{'id':_0x2dce85[_0x6b98('0x13')]}})[_0x6b98('0x14')](function(_0x532ae3){if(_0x532ae3){_0x532ae3[_0x6b98('0x15')]({'lastMsgAt':_0x2dce85['createdAt'],'lastMsgDirection':_0x2dce85[_0x6b98('0xd')][_0x6b98('0xe')]()});}})[_0x6b98('0x16')](function(_0x39dc2e){console[_0x6b98('0x17')](_0x39dc2e);});}_0x24a647();}},'charset':_0x6b98('0x18'),'collate':_0x6b98('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c80fcf6..ca27860 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 _0x218b=['jayson/promise','client','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5cad5c,_0x2cd742){var _0x5ba578=function(_0x12a5a2){while(--_0x12a5a2){_0x5cad5c['push'](_0x5cad5c['shift']());}};_0x5ba578(++_0x2cd742);}(_0x218b,0xde));var _0xb218=function(_0x3dc701,_0x3cc664){_0x3dc701=_0x3dc701-0x0;var _0x23b942=_0x218b[_0x3dc701];return _0x23b942;};'use strict';var _=require(_0xb218('0x0'));var util=require(_0xb218('0x1'));var moment=require('moment');var BPromise=require(_0xb218('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb218('0x3'));var db=require(_0xb218('0x4'))['db'];var utils=require(_0xb218('0x5'));var logger=require(_0xb218('0x6'))(_0xb218('0x7'));var config=require(_0xb218('0x8'));var jayson=require(_0xb218('0x9'));var client=jayson[_0xb218('0xa')]['http']({'port':0x232a});config[_0xb218('0xb')]=_[_0xb218('0xc')](config[_0xb218('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb218('0xd'))(new Redis(config[_0xb218('0xb')]));require(_0xb218('0xe'))[_0xb218('0xf')](socket);function respondWithRpcPromise(_0x56d744,_0x22ffe0,_0x831ad8){return new BPromise(function(_0x29533c,_0x5ded80){return client[_0xb218('0x10')](_0x56d744,_0x831ad8)['then'](function(_0xed7fbc){logger['info'](_0xb218('0x11'),_0x22ffe0,_0xb218('0x12'));logger[_0xb218('0x13')](_0xb218('0x14'),_0x22ffe0,_0xb218('0x12'),JSON[_0xb218('0x15')](_0xed7fbc));if(_0xed7fbc[_0xb218('0x16')]){if(_0xed7fbc[_0xb218('0x16')][_0xb218('0x17')]===0x1f4){logger[_0xb218('0x16')](_0xb218('0x11'),_0x22ffe0,_0xed7fbc[_0xb218('0x16')]['message']);return _0x5ded80(_0xed7fbc[_0xb218('0x16')][_0xb218('0x18')]);}logger[_0xb218('0x16')](_0xb218('0x11'),_0x22ffe0,_0xed7fbc['error'][_0xb218('0x18')]);return _0x29533c(_0xed7fbc[_0xb218('0x16')][_0xb218('0x18')]);}else{logger[_0xb218('0x19')]('ChatMessage,\x20%s,\x20%s',_0x22ffe0,_0xb218('0x12'));_0x29533c(_0xed7fbc[_0xb218('0x1a')]['message']);}})[_0xb218('0x1b')](function(_0x493fb3){logger[_0xb218('0x16')](_0xb218('0x11'),_0x22ffe0,_0x493fb3);_0x5ded80(_0x493fb3);});});}exports[_0xb218('0x1c')]=function(_0x8b87b1){var _0x47200a=this;return new Promise(function(_0x59fc36,_0x1ef554){return db[_0xb218('0x1d')][_0xb218('0x1e')](_0x8b87b1['body'],{'raw':_0x8b87b1[_0xb218('0x1f')]?_0x8b87b1[_0xb218('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xb218('0x20')](function(_0x3949b7){logger[_0xb218('0x19')](_0xb218('0x1c'),_0x8b87b1);logger[_0xb218('0x13')](_0xb218('0x1c'),_0x8b87b1,JSON[_0xb218('0x15')](_0x3949b7));_0x59fc36(_0x3949b7);})[_0xb218('0x1b')](function(_0x38367c){logger[_0xb218('0x16')]('CreateChatMessage',_0x38367c[_0xb218('0x18')],_0x8b87b1);_0x1ef554(_0x47200a[_0xb218('0x16')](0x1f4,_0x38367c['message']));});});}; \ No newline at end of file +var _0x6c37=['CreateChatMessage','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','request\x20sent','debug','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','info','result','catch'];(function(_0x3fc9eb,_0x2d0d83){var _0x5efaef=function(_0x31f45f){while(--_0x31f45f){_0x3fc9eb['push'](_0x3fc9eb['shift']());}};_0x5efaef(++_0x2d0d83);}(_0x6c37,0x198));var _0x76c3=function(_0x3794b5,_0xd6d4c3){_0x3794b5=_0x3794b5-0x0;var _0x3b37fb=_0x6c37[_0x3794b5];return _0x3b37fb;};'use strict';var _=require(_0x76c3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x76c3('0x1'));var rs=require(_0x76c3('0x2'));var fs=require('fs');var Redis=require(_0x76c3('0x3'));var db=require(_0x76c3('0x4'))['db'];var utils=require(_0x76c3('0x5'));var logger=require(_0x76c3('0x6'))(_0x76c3('0x7'));var config=require(_0x76c3('0x8'));var jayson=require(_0x76c3('0x9'));var client=jayson[_0x76c3('0xa')][_0x76c3('0xb')]({'port':0x232a});config[_0x76c3('0xc')]=_['defaults'](config['redis'],{'host':_0x76c3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76c3('0xc')]));require(_0x76c3('0xe'))[_0x76c3('0xf')](socket);function respondWithRpcPromise(_0xebafc0,_0x5db0ad,_0x4925cf){return new BPromise(function(_0x9614a2,_0x1dff03){return client['request'](_0xebafc0,_0x4925cf)['then'](function(_0x378792){logger['info']('ChatMessage,\x20%s,\x20%s',_0x5db0ad,_0x76c3('0x10'));logger[_0x76c3('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5db0ad,_0x76c3('0x10'),JSON[_0x76c3('0x12')](_0x378792));if(_0x378792[_0x76c3('0x13')]){if(_0x378792[_0x76c3('0x13')][_0x76c3('0x14')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5db0ad,_0x378792['error'][_0x76c3('0x15')]);return _0x1dff03(_0x378792[_0x76c3('0x13')][_0x76c3('0x15')]);}logger['error'](_0x76c3('0x16'),_0x5db0ad,_0x378792[_0x76c3('0x13')][_0x76c3('0x15')]);return _0x9614a2(_0x378792['error'][_0x76c3('0x15')]);}else{logger[_0x76c3('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5db0ad,_0x76c3('0x10'));_0x9614a2(_0x378792[_0x76c3('0x18')]['message']);}})[_0x76c3('0x19')](function(_0xdabf91){logger['error'](_0x76c3('0x16'),_0x5db0ad,_0xdabf91);_0x1dff03(_0xdabf91);});});}exports[_0x76c3('0x1a')]=function(_0x41f217){var _0x151606=this;return new Promise(function(_0xb6ab61,_0x1ebb20){return db['ChatMessage'][_0x76c3('0x1b')](_0x41f217[_0x76c3('0x1c')],{'raw':_0x41f217[_0x76c3('0x1d')]?_0x41f217[_0x76c3('0x1d')][_0x76c3('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2d1e43){logger['info'](_0x76c3('0x1a'),_0x41f217);logger[_0x76c3('0x11')](_0x76c3('0x1a'),_0x41f217,JSON[_0x76c3('0x12')](_0x2d1e43));_0xb6ab61(_0x2d1e43);})['catch'](function(_0x89ea0e){logger['error'](_0x76c3('0x1a'),_0x89ea0e[_0x76c3('0x15')],_0x41f217);_0x1ebb20(_0x151606[_0x76c3('0x13')](0x1f4,_0x89ea0e[_0x76c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5d4303f..3a279e4 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 _0x2a07=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x24f3d3,_0xb13780){var _0x2b9655=function(_0xc08d16){while(--_0xc08d16){_0x24f3d3['push'](_0x24f3d3['shift']());}};_0x2b9655(++_0xb13780);}(_0x2a07,0x74));var _0x72a0=function(_0x2f0162,_0x561c38){_0x2f0162=_0x2f0162-0x0;var _0x4becec=_0x2a07[_0x2f0162];return _0x4becec;};'use strict';var ChatMessageEvents=require(_0x72a0('0x0'));var events=[_0x72a0('0x1'),_0x72a0('0x2'),_0x72a0('0x3')];function createListener(_0x1cad29,_0x548164){return function(_0x335b7c){_0x548164[_0x72a0('0x4')](_0x1cad29,_0x335b7c);};}function removeListener(_0x135982,_0x45b155){return function(){ChatMessageEvents[_0x72a0('0x5')](_0x135982,_0x45b155);};}exports[_0x72a0('0x6')]=function(_0x3ccf6d){for(var _0x20dab9=0x0,_0x193e3b=events[_0x72a0('0x7')];_0x20dab9<_0x193e3b;_0x20dab9++){var _0x21c819=events[_0x20dab9];var _0x2c04eb=createListener(_0x72a0('0x8')+_0x21c819,_0x3ccf6d);ChatMessageEvents['on'](_0x21c819,_0x2c04eb);}}; \ No newline at end of file +var _0xfdbd=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x541163,_0x3335c6){var _0x4f83d0=function(_0x5c2abd){while(--_0x5c2abd){_0x541163['push'](_0x541163['shift']());}};_0x4f83d0(++_0x3335c6);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xfdbd[_0x40b493];return _0x548365;};'use strict';var ChatMessageEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){ChatMessageEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);ChatMessageEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a525cf1..8bcdf75 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 _0x547b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','chat','put','update','accept','/:id/reject','reject','delete','destroy'];(function(_0x228a4a,_0x23d65e){var _0x3d3937=function(_0x3e9511){while(--_0x3e9511){_0x228a4a['push'](_0x228a4a['shift']());}};_0x3d3937(++_0x23d65e);}(_0x547b,0xc9));var _0xb547=function(_0x333639,_0x29f502){_0x333639=_0x333639-0x0;var _0x15593e=_0x547b[_0x333639];return _0x15593e;};'use strict';var multer=require(_0xb547('0x0'));var util=require(_0xb547('0x1'));var path=require(_0xb547('0x2'));var timeout=require(_0xb547('0x3'));var express=require(_0xb547('0x4'));var router=express[_0xb547('0x5')]();var auth=require(_0xb547('0x6'));var interaction=require(_0xb547('0x7'));var config=require(_0xb547('0x8'));var controller=require(_0xb547('0x9'));router['get']('/',auth[_0xb547('0xa')](),controller[_0xb547('0xb')]);router[_0xb547('0xc')](_0xb547('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xb547('0xc')](_0xb547('0xe'),auth[_0xb547('0xa')](),controller[_0xb547('0xf')]);router['post']('/',auth[_0xb547('0xa')](),interaction['tracked'](_0xb547('0x10'),'chatmessage:create'),controller['create']);router[_0xb547('0x11')]('/:id',controller[_0xb547('0x12')]);router[_0xb547('0x11')]('/:id/accept',auth[_0xb547('0xa')](),controller[_0xb547('0x13')]);router[_0xb547('0x11')](_0xb547('0x14'),auth[_0xb547('0xa')](),controller[_0xb547('0x15')]);router[_0xb547('0x16')]('/:id',auth[_0xb547('0xa')](),controller[_0xb547('0x17')]);module[_0xb547('0x18')]=router; \ No newline at end of file +var _0x4a7a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','chat','put','update','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x2edff0,_0x4fac7f){var _0x1ace33=function(_0x35d178){while(--_0x35d178){_0x2edff0['push'](_0x2edff0['shift']());}};_0x1ace33(++_0x4fac7f);}(_0x4a7a,0xf5));var _0xa4a7=function(_0x49434f,_0x316922){_0x49434f=_0x49434f-0x0;var _0x281a4e=_0x4a7a[_0x49434f];return _0x281a4e;};'use strict';var multer=require(_0xa4a7('0x0'));var util=require(_0xa4a7('0x1'));var path=require(_0xa4a7('0x2'));var timeout=require(_0xa4a7('0x3'));var express=require(_0xa4a7('0x4'));var router=express[_0xa4a7('0x5')]();var auth=require(_0xa4a7('0x6'));var interaction=require(_0xa4a7('0x7'));var config=require(_0xa4a7('0x8'));var controller=require(_0xa4a7('0x9'));router[_0xa4a7('0xa')]('/',auth[_0xa4a7('0xb')](),controller[_0xa4a7('0xc')]);router[_0xa4a7('0xa')](_0xa4a7('0xd'),auth['isAuthenticated'](),controller[_0xa4a7('0xe')]);router[_0xa4a7('0xa')](_0xa4a7('0xf'),auth[_0xa4a7('0xb')](),controller['show']);router[_0xa4a7('0x10')]('/',auth[_0xa4a7('0xb')](),interaction['tracked'](_0xa4a7('0x11'),'chatmessage:create'),controller['create']);router[_0xa4a7('0x12')](_0xa4a7('0xf'),controller[_0xa4a7('0x13')]);router[_0xa4a7('0x12')]('/:id/accept',auth[_0xa4a7('0xb')](),controller[_0xa4a7('0x14')]);router[_0xa4a7('0x12')](_0xa4a7('0x15'),auth[_0xa4a7('0xb')](),controller[_0xa4a7('0x16')]);router[_0xa4a7('0x17')](_0xa4a7('0xf'),auth[_0xa4a7('0xb')](),controller[_0xa4a7('0x18')]);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 61bd8ea..4ad8070 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 _0xe918=['medium','exports','TEXT'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xe918,0xc7));var _0x8e91=function(_0x2d5e13,_0x2f25ef){_0x2d5e13=_0x2d5e13-0x0;var _0x2fab3d=_0xe918[_0x2d5e13];return _0x2fab3d;};'use strict';var Sequelize=require('sequelize');module[_0x8e91('0x0')]={'body':{'type':Sequelize[_0x8e91('0x1')](_0x8e91('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x86a3=['sequelize','exports','medium'];(function(_0x3b8a24,_0x54b12f){var _0x2bbac1=function(_0x5f0714){while(--_0x5f0714){_0x3b8a24['push'](_0x3b8a24['shift']());}};_0x2bbac1(++_0x54b12f);}(_0x86a3,0x1bf));var _0x386a=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x86a3[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x386a('0x0'));module[_0x386a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x386a('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 cd4f331..4940902 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 _0xcd59=['show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x28e2d2,_0x36616e){var _0x435269=function(_0x29f7ed){while(--_0x29f7ed){_0x28e2d2['push'](_0x28e2d2['shift']());}};_0x435269(++_0x36616e);}(_0xcd59,0x14b));var _0x9cd5=function(_0xe397b4,_0x37f1c0){_0xe397b4=_0xe397b4-0x0;var _0x384f1e=_0xcd59[_0xe397b4];return _0x384f1e;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require(_0x9cd5('0xb'));var ejs=require(_0x9cd5('0xc'));var fs=require('fs');var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xb'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d6de,_0x2c9cf1){_0x2c9cf1=_0x2c9cf1||0xcc;return function(_0x172e29){if(_0x172e29){return _0x58d6de[_0x9cd5('0x1b')](_0x2c9cf1);}return _0x58d6de[_0x9cd5('0x1c')](_0x2c9cf1)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x2a1606,_0x52698b){_0x52698b=_0x52698b||0xc8;return function(_0x15b639){if(_0x15b639){return _0x2a1606[_0x9cd5('0x1c')](_0x52698b)[_0x9cd5('0x1e')](_0x15b639);}};}function respondWithFilteredResult(_0x4b9ac8,_0x541cb8){return function(_0x5c4f3d){if(_0x5c4f3d){var _0x258305=_0x5c4f3d[_0x9cd5('0x1f')],_0x1ea3f7=_0x541cb8[_0x9cd5('0x20')],_0x565db7=_0x541cb8['offset']+_0x541cb8[_0x9cd5('0x21')],_0x24c233;if(_0x565db7>=_0x258305){_0x565db7=_0x258305;_0x24c233=0xc8;}else{_0x24c233=0xce;}_0x4b9ac8[_0x9cd5('0x1c')](_0x24c233);return _0x4b9ac8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x1ea3f7+'-'+_0x565db7+'/'+_0x258305)[_0x9cd5('0x1e')](_0x5c4f3d);}return null;};}function patchUpdates(_0x1ff788){return function(_0x5c1622){try{jsonpatch[_0x9cd5('0x24')](_0x5c1622,_0x1ff788,!![]);}catch(_0x18346f){return BPromise[_0x9cd5('0x25')](_0x18346f);}return _0x5c1622[_0x9cd5('0x26')]();};}function saveUpdates(_0x2e2b47,_0x4ed8b9){return function(_0x16c4e9){if(_0x16c4e9){return _0x16c4e9[_0x9cd5('0x27')](_0x2e2b47)[_0x9cd5('0x28')](function(_0x12e402){return _0x12e402;});}return null;};}function removeEntity(_0x2ce1ae,_0x1185d7){return function(_0x1cf603){if(_0x1cf603){return _0x1cf603[_0x9cd5('0x29')]()[_0x9cd5('0x28')](function(){_0x2ce1ae['status'](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(!_0x43f47d){_0xba8ee9['sendStatus'](0x194);}return _0x43f47d;};}function handleError(_0x24ae67,_0x990c25){_0x990c25=_0x990c25||0x1f4;return function(_0x211576){logger[_0x9cd5('0x2a')](_0x211576[_0x9cd5('0x2b')]);if(_0x211576[_0x9cd5('0x2c')]){delete _0x211576[_0x9cd5('0x2c')];}_0x24ae67['status'](_0x990c25)[_0x9cd5('0x2d')](_0x211576);};}exports[_0x9cd5('0x2e')]=function(_0x2f1e4b,_0x4af6c8){var _0x5c33e9={},_0x2e45a3={},_0x502257={'count':0x0,'rows':[]};var _0x52ef5d=_[_0x9cd5('0x2f')](db[_0x9cd5('0x30')][_0x9cd5('0x31')],function(_0x5184b9){return{'name':_0x5184b9[_0x9cd5('0x32')],'type':_0x5184b9[_0x9cd5('0x33')][_0x9cd5('0x34')]};});_0x2e45a3[_0x9cd5('0x35')]=_[_0x9cd5('0x2f')](_0x52ef5d,_0x9cd5('0x2c'));_0x2e45a3[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x2f1e4b[_0x9cd5('0x36')]);_0x2e45a3[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x2e45a3[_0x9cd5('0x35')],_0x2e45a3[_0x9cd5('0x36')]);_0x5c33e9[_0x9cd5('0x3a')]=_['intersection'](_0x2e45a3[_0x9cd5('0x35')],qs[_0x9cd5('0x3b')](_0x2f1e4b['query']['fields']));_0x5c33e9[_0x9cd5('0x3a')]=_0x5c33e9[_0x9cd5('0x3a')]['length']?_0x5c33e9[_0x9cd5('0x3a')]:_0x2e45a3['model'];if(!_0x2f1e4b['query'][_0x9cd5('0x3c')](_0x9cd5('0x3d'))){_0x5c33e9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2f1e4b['query'][_0x9cd5('0x21')]);_0x5c33e9[_0x9cd5('0x20')]=qs[_0x9cd5('0x20')](_0x2f1e4b['query'][_0x9cd5('0x20')]);}_0x5c33e9[_0x9cd5('0x3e')]=qs[_0x9cd5('0x3f')](_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x3f')]);_0x5c33e9[_0x9cd5('0x40')]=qs[_0x9cd5('0x38')](_[_0x9cd5('0x41')](_0x2f1e4b[_0x9cd5('0x36')],_0x2e45a3[_0x9cd5('0x38')]),_0x52ef5d);if(_0x2f1e4b[_0x9cd5('0x36')]['filter']){_0x5c33e9[_0x9cd5('0x40')]=_['merge'](_0x5c33e9['where'],{'$or':_[_0x9cd5('0x2f')](_0x52ef5d,function(_0x3cf5e9){if(_0x3cf5e9[_0x9cd5('0x33')]!==_0x9cd5('0x42')){var _0x54bc49={};_0x54bc49[_0x3cf5e9[_0x9cd5('0x2c')]]={'$like':'%'+_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x43')]+'%'};return _0x54bc49;}})});}_0x5c33e9=_[_0x9cd5('0x44')]({},_0x5c33e9,_0x2f1e4b['options']);var _0x36e22c={'where':_0x5c33e9[_0x9cd5('0x40')]};return db[_0x9cd5('0x30')][_0x9cd5('0x1f')](_0x36e22c)[_0x9cd5('0x28')](function(_0x16e6b3){_0x502257['count']=_0x16e6b3;if(_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0x5c33e9[_0x9cd5('0x46')]=[{'all':!![]}];}return db[_0x9cd5('0x30')][_0x9cd5('0x47')](_0x5c33e9);})[_0x9cd5('0x28')](function(_0x12d604){_0x502257[_0x9cd5('0x48')]=_0x12d604;return _0x502257;})[_0x9cd5('0x28')](respondWithFilteredResult(_0x4af6c8,_0x5c33e9))[_0x9cd5('0x49')](handleError(_0x4af6c8,null));};exports[_0x9cd5('0x4a')]=function(_0x3ed405,_0x7ad8ec){var _0xa12319={'raw':!![],'where':{'id':_0x3ed405[_0x9cd5('0x4b')]['id']}},_0x3b316b={};_0x3b316b[_0x9cd5('0x35')]=_[_0x9cd5('0x37')](db['ChatOfflineMessage'][_0x9cd5('0x31')]);_0x3b316b['query']=_[_0x9cd5('0x37')](_0x3ed405[_0x9cd5('0x36')]);_0x3b316b[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],_0x3b316b['query']);_0xa12319[_0x9cd5('0x3a')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],qs['fields'](_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x3b')]));_0xa12319[_0x9cd5('0x3a')]=_0xa12319[_0x9cd5('0x3a')]['length']?_0xa12319[_0x9cd5('0x3a')]:_0x3b316b[_0x9cd5('0x35')];if(_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0xa12319[_0x9cd5('0x46')]=[{'all':!![]}];}_0xa12319=_[_0x9cd5('0x44')]({},_0xa12319,_0x3ed405[_0x9cd5('0x4c')]);return db[_0x9cd5('0x30')][_0x9cd5('0x4d')](_0xa12319)[_0x9cd5('0x28')](handleEntityNotFound(_0x7ad8ec,null))[_0x9cd5('0x28')](respondWithResult(_0x7ad8ec,null))[_0x9cd5('0x49')](handleError(_0x7ad8ec,null));};exports[_0x9cd5('0x4e')]=function(_0x1e1ba0,_0x245f9e){return db[_0x9cd5('0x30')][_0x9cd5('0x4e')](_0x1e1ba0[_0x9cd5('0x4f')],{})['then'](respondWithResult(_0x245f9e,0xc9))[_0x9cd5('0x49')](handleError(_0x245f9e,null));};exports[_0x9cd5('0x27')]=function(_0x3fead7,_0x2058a6){if(_0x3fead7['body']['id']){delete _0x3fead7[_0x9cd5('0x4f')]['id'];}return db[_0x9cd5('0x30')]['find']({'where':{'id':_0x3fead7[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x2058a6,null))[_0x9cd5('0x28')](saveUpdates(_0x3fead7[_0x9cd5('0x4f')],null))[_0x9cd5('0x28')](respondWithResult(_0x2058a6,null))[_0x9cd5('0x49')](handleError(_0x2058a6,null));};exports[_0x9cd5('0x29')]=function(_0x14c585,_0x5b6c7d){return db['ChatOfflineMessage'][_0x9cd5('0x4d')]({'where':{'id':_0x14c585[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x5b6c7d,null))[_0x9cd5('0x28')](removeEntity(_0x5b6c7d,null))['catch'](handleError(_0x5b6c7d,null));};exports[_0x9cd5('0x50')]=function(_0x55ac13,_0x5d4463){return db[_0x9cd5('0x30')][_0x9cd5('0x50')]()[_0x9cd5('0x28')](respondWithResult(_0x5d4463,null))['catch'](handleError(_0x5d4463,null));}; \ No newline at end of file +var _0x5fab=['includeAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','filter','options','count'];(function(_0x2ac8f0,_0x21d3df){var _0x4e9e93=function(_0x292289){while(--_0x292289){_0x2ac8f0['push'](_0x2ac8f0['shift']());}};_0x4e9e93(++_0x21d3df);}(_0x5fab,0x177));var _0xb5fa=function(_0x1d8305,_0x1e63c6){_0x1d8305=_0x1d8305-0x0;var _0x183f62=_0x5fab[_0x1d8305];return _0x183f62;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];function respondWithStatusCode(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0xcc;return function(_0x2ad830){if(_0x2ad830){return _0x309740[_0xb5fa('0x19')](_0x4d3576);}return _0x309740['status'](_0x4d3576)[_0xb5fa('0x1a')]();};}function respondWithResult(_0x577af0,_0x265992){_0x265992=_0x265992||0xc8;return function(_0x3fc372){if(_0x3fc372){return _0x577af0[_0xb5fa('0x1b')](_0x265992)[_0xb5fa('0x1c')](_0x3fc372);}};}function respondWithFilteredResult(_0x8e9d1c,_0x5371cf){return function(_0x567f31){if(_0x567f31){var _0x38e964=_0x567f31['count'],_0x587043=_0x5371cf['offset'],_0x31f252=_0x5371cf[_0xb5fa('0x1d')]+_0x5371cf[_0xb5fa('0x1e')],_0x27c8f7;if(_0x31f252>=_0x38e964){_0x31f252=_0x38e964;_0x27c8f7=0xc8;}else{_0x27c8f7=0xce;}_0x8e9d1c[_0xb5fa('0x1b')](_0x27c8f7);return _0x8e9d1c[_0xb5fa('0x1f')](_0xb5fa('0x20'),_0x587043+'-'+_0x31f252+'/'+_0x38e964)[_0xb5fa('0x1c')](_0x567f31);}return null;};}function patchUpdates(_0x3b0f69){return function(_0x21f4f4){try{jsonpatch[_0xb5fa('0x21')](_0x21f4f4,_0x3b0f69,!![]);}catch(_0x368cb1){return BPromise[_0xb5fa('0x22')](_0x368cb1);}return _0x21f4f4[_0xb5fa('0x23')]();};}function saveUpdates(_0x5cd822,_0x432bfa){return function(_0x519e20){if(_0x519e20){return _0x519e20[_0xb5fa('0x24')](_0x5cd822)['then'](function(_0xd0fe2b){return _0xd0fe2b;});}return null;};}function removeEntity(_0x43c09f,_0x4e05c0){return function(_0x40dfdf){if(_0x40dfdf){return _0x40dfdf[_0xb5fa('0x25')]()[_0xb5fa('0x26')](function(){_0x43c09f['status'](0xcc)[_0xb5fa('0x1a')]();});}};}function handleEntityNotFound(_0xec108f,_0x444237){return function(_0x542348){if(!_0x542348){_0xec108f[_0xb5fa('0x19')](0x194);}return _0x542348;};}function handleError(_0x5d55f7,_0x106c4b){_0x106c4b=_0x106c4b||0x1f4;return function(_0x264591){logger[_0xb5fa('0x27')](_0x264591[_0xb5fa('0x28')]);if(_0x264591[_0xb5fa('0x29')]){delete _0x264591[_0xb5fa('0x29')];}_0x5d55f7[_0xb5fa('0x1b')](_0x106c4b)[_0xb5fa('0x2a')](_0x264591);};}exports['index']=function(_0x4ec294,_0x5bdf11){var _0x5a1c39={},_0x28a350={},_0x460b54={'count':0x0,'rows':[]};var _0x12c0d4=_[_0xb5fa('0x2b')](db[_0xb5fa('0x2c')][_0xb5fa('0x2d')],function(_0x358549){return{'name':_0x358549[_0xb5fa('0x2e')],'type':_0x358549[_0xb5fa('0x2f')][_0xb5fa('0x30')]};});_0x28a350[_0xb5fa('0x31')]=_[_0xb5fa('0x2b')](_0x12c0d4,_0xb5fa('0x29'));_0x28a350[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x4ec294[_0xb5fa('0x32')]);_0x28a350[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],_0x28a350[_0xb5fa('0x32')]);_0x5a1c39[_0xb5fa('0x36')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],qs[_0xb5fa('0x37')](_0x4ec294['query'][_0xb5fa('0x37')]));_0x5a1c39['attributes']=_0x5a1c39['attributes']['length']?_0x5a1c39[_0xb5fa('0x36')]:_0x28a350['model'];if(!_0x4ec294[_0xb5fa('0x32')]['hasOwnProperty']('nolimit')){_0x5a1c39[_0xb5fa('0x1e')]=qs[_0xb5fa('0x1e')](_0x4ec294['query']['limit']);_0x5a1c39[_0xb5fa('0x1d')]=qs[_0xb5fa('0x1d')](_0x4ec294[_0xb5fa('0x32')]['offset']);}_0x5a1c39[_0xb5fa('0x38')]=qs[_0xb5fa('0x39')](_0x4ec294['query'][_0xb5fa('0x39')]);_0x5a1c39[_0xb5fa('0x3a')]=qs[_0xb5fa('0x34')](_['pick'](_0x4ec294[_0xb5fa('0x32')],_0x28a350[_0xb5fa('0x34')]),_0x12c0d4);if(_0x4ec294[_0xb5fa('0x32')]['filter']){_0x5a1c39[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x5a1c39[_0xb5fa('0x3a')],{'$or':_[_0xb5fa('0x2b')](_0x12c0d4,function(_0x5e7770){if(_0x5e7770['type']!=='VIRTUAL'){var _0x49e786={};_0x49e786[_0x5e7770['name']]={'$like':'%'+_0x4ec294['query'][_0xb5fa('0x3c')]+'%'};return _0x49e786;}})});}_0x5a1c39=_['merge']({},_0x5a1c39,_0x4ec294[_0xb5fa('0x3d')]);var _0x3ae696={'where':_0x5a1c39[_0xb5fa('0x3a')]};return db[_0xb5fa('0x2c')][_0xb5fa('0x3e')](_0x3ae696)[_0xb5fa('0x26')](function(_0x4b4c4c){_0x460b54['count']=_0x4b4c4c;if(_0x4ec294['query'][_0xb5fa('0x3f')]){_0x5a1c39['include']=[{'all':!![]}];}return db[_0xb5fa('0x2c')]['findAll'](_0x5a1c39);})['then'](function(_0x3cdf63){_0x460b54[_0xb5fa('0x40')]=_0x3cdf63;return _0x460b54;})[_0xb5fa('0x26')](respondWithFilteredResult(_0x5bdf11,_0x5a1c39))[_0xb5fa('0x41')](handleError(_0x5bdf11,null));};exports[_0xb5fa('0x42')]=function(_0x26ef1b,_0x337c53){var _0x83df0b={'raw':!![],'where':{'id':_0x26ef1b[_0xb5fa('0x43')]['id']}},_0x19e370={};_0x19e370['model']=_[_0xb5fa('0x33')](db['ChatOfflineMessage'][_0xb5fa('0x2d')]);_0x19e370[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x26ef1b[_0xb5fa('0x32')]);_0x19e370[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],_0x19e370[_0xb5fa('0x32')]);_0x83df0b['attributes']=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],qs['fields'](_0x26ef1b[_0xb5fa('0x32')]['fields']));_0x83df0b[_0xb5fa('0x36')]=_0x83df0b[_0xb5fa('0x36')]['length']?_0x83df0b['attributes']:_0x19e370[_0xb5fa('0x31')];if(_0x26ef1b[_0xb5fa('0x32')][_0xb5fa('0x3f')]){_0x83df0b[_0xb5fa('0x44')]=[{'all':!![]}];}_0x83df0b=_[_0xb5fa('0x3b')]({},_0x83df0b,_0x26ef1b[_0xb5fa('0x3d')]);return db[_0xb5fa('0x2c')][_0xb5fa('0x45')](_0x83df0b)['then'](handleEntityNotFound(_0x337c53,null))[_0xb5fa('0x26')](respondWithResult(_0x337c53,null))[_0xb5fa('0x41')](handleError(_0x337c53,null));};exports['create']=function(_0xee6baa,_0x2c378a){return db[_0xb5fa('0x2c')][_0xb5fa('0x46')](_0xee6baa[_0xb5fa('0x47')],{})[_0xb5fa('0x26')](respondWithResult(_0x2c378a,0xc9))[_0xb5fa('0x41')](handleError(_0x2c378a,null));};exports[_0xb5fa('0x24')]=function(_0x20f5f5,_0x464e36){if(_0x20f5f5[_0xb5fa('0x47')]['id']){delete _0x20f5f5[_0xb5fa('0x47')]['id'];}return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x20f5f5[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x464e36,null))['then'](saveUpdates(_0x20f5f5['body'],null))[_0xb5fa('0x26')](respondWithResult(_0x464e36,null))['catch'](handleError(_0x464e36,null));};exports[_0xb5fa('0x25')]=function(_0x1049d9,_0x5404f6){return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x1049d9[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x5404f6,null))[_0xb5fa('0x26')](removeEntity(_0x5404f6,null))[_0xb5fa('0x41')](handleError(_0x5404f6,null));};exports['describe']=function(_0x27a651,_0x4fd5bf){return db[_0xb5fa('0x2c')][_0xb5fa('0x48')]()[_0xb5fa('0x26')](respondWithResult(_0x4fd5bf,null))['catch'](handleError(_0x4fd5bf,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f516331..7191d5d 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 _0x56bc=['utf8mb4_unicode_ci','api','request-promise','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x438356,_0x1f6468){var _0x4cd3de=function(_0x586cb5){while(--_0x586cb5){_0x438356['push'](_0x438356['shift']());}};_0x4cd3de(++_0x1f6468);}(_0x56bc,0x17b));var _0xc56b=function(_0x320841,_0x47bf07){_0x320841=_0x320841-0x0;var _0x222109=_0x56bc[_0x320841];return _0x222109;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc56b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc56b('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc56b('0x2'));var config=require('../../config/environment');var attributes=require(_0xc56b('0x3'));module[_0xc56b('0x4')]=function(_0xf18923,_0x235752){return _0xf18923[_0xc56b('0x5')](_0xc56b('0x6'),attributes,{'tableName':_0xc56b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc56b('0x8')});}; \ No newline at end of file +var _0x07ae=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0x07ae,0x19d));var _0xe07a=function(_0x858919,_0x3a1fdd){_0x858919=_0x858919-0x0;var _0x24a771=_0x07ae[_0x858919];return _0x24a771;};'use strict';var _=require(_0xe07a('0x0'));var util=require(_0xe07a('0x1'));var logger=require(_0xe07a('0x2'))('api');var moment=require(_0xe07a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe07a('0x4'));var config=require(_0xe07a('0x5'));var attributes=require(_0xe07a('0x6'));module['exports']=function(_0x194e01,_0x27c3ff){return _0x194e01['define'](_0xe07a('0x7'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe07a('0x8'),'collate':_0xe07a('0x9')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 12fb485..3a4d9cc 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 _0xaa34=['code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0xb17b4d,_0x22e73d){var _0xc91c76=function(_0x17f79f){while(--_0x17f79f){_0xb17b4d['push'](_0xb17b4d['shift']());}};_0xc91c76(++_0x22e73d);}(_0xaa34,0x76));var _0x4aa3=function(_0x54dc70,_0x3dc344){_0x54dc70=_0x54dc70-0x0;var _0x1962c0=_0xaa34[_0x54dc70];return _0x1962c0;};'use strict';var _=require(_0x4aa3('0x0'));var util=require('util');var moment=require(_0x4aa3('0x1'));var BPromise=require(_0x4aa3('0x2'));var rs=require(_0x4aa3('0x3'));var fs=require('fs');var Redis=require(_0x4aa3('0x4'));var db=require(_0x4aa3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4aa3('0x6'))(_0x4aa3('0x7'));var config=require(_0x4aa3('0x8'));var jayson=require(_0x4aa3('0x9'));var client=jayson[_0x4aa3('0xa')][_0x4aa3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b1c5,_0x2bfaef,_0x46a510){return new BPromise(function(_0x2d0f5b,_0x5620e8){return client[_0x4aa3('0xc')](_0x10b1c5,_0x46a510)[_0x4aa3('0xd')](function(_0x323363){logger[_0x4aa3('0xe')](_0x4aa3('0xf'),_0x2bfaef,'request\x20sent');logger[_0x4aa3('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2bfaef,_0x4aa3('0x11'),JSON[_0x4aa3('0x12')](_0x323363));if(_0x323363[_0x4aa3('0x13')]){if(_0x323363['error'][_0x4aa3('0x14')]===0x1f4){logger[_0x4aa3('0x13')](_0x4aa3('0xf'),_0x2bfaef,_0x323363[_0x4aa3('0x13')][_0x4aa3('0x15')]);return _0x5620e8(_0x323363[_0x4aa3('0x13')][_0x4aa3('0x15')]);}logger[_0x4aa3('0x13')](_0x4aa3('0xf'),_0x2bfaef,_0x323363[_0x4aa3('0x13')][_0x4aa3('0x15')]);return _0x2d0f5b(_0x323363[_0x4aa3('0x13')]['message']);}else{logger[_0x4aa3('0xe')](_0x4aa3('0xf'),_0x2bfaef,'request\x20sent');_0x2d0f5b(_0x323363[_0x4aa3('0x16')][_0x4aa3('0x15')]);}})['catch'](function(_0x28b154){logger[_0x4aa3('0x13')](_0x4aa3('0xf'),_0x2bfaef,_0x28b154);_0x5620e8(_0x28b154);});});} \ No newline at end of file +var _0x5639=['lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x26bb8a,_0xff97e6){var _0x3b0334=function(_0x22a5e5){while(--_0x22a5e5){_0x26bb8a['push'](_0x26bb8a['shift']());}};_0x3b0334(++_0xff97e6);}(_0x5639,0xdc));var _0x9563=function(_0x333d37,_0x50ae5b){_0x333d37=_0x333d37-0x0;var _0x316ba3=_0x5639[_0x333d37];return _0x316ba3;};'use strict';var _=require(_0x9563('0x0'));var util=require('util');var moment=require(_0x9563('0x1'));var BPromise=require(_0x9563('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9563('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9563('0x4'))(_0x9563('0x5'));var config=require(_0x9563('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9563('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44fa36,_0x3ac6da,_0x5388c3){return new BPromise(function(_0x116e6d,_0x43c495){return client[_0x9563('0x8')](_0x44fa36,_0x5388c3)['then'](function(_0x64066f){logger['info'](_0x9563('0x9'),_0x3ac6da,_0x9563('0xa'));logger[_0x9563('0xb')](_0x9563('0xc'),_0x3ac6da,_0x9563('0xa'),JSON[_0x9563('0xd')](_0x64066f));if(_0x64066f['error']){if(_0x64066f[_0x9563('0xe')][_0x9563('0xf')]===0x1f4){logger[_0x9563('0xe')](_0x9563('0x9'),_0x3ac6da,_0x64066f[_0x9563('0xe')]['message']);return _0x43c495(_0x64066f[_0x9563('0xe')]['message']);}logger[_0x9563('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3ac6da,_0x64066f['error'][_0x9563('0x10')]);return _0x116e6d(_0x64066f[_0x9563('0xe')][_0x9563('0x10')]);}else{logger[_0x9563('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3ac6da,_0x9563('0xa'));_0x116e6d(_0x64066f[_0x9563('0x12')][_0x9563('0x10')]);}})[_0x9563('0x13')](function(_0x1632de){logger[_0x9563('0xe')](_0x9563('0x9'),_0x3ac6da,_0x1632de);_0x43c495(_0x1632de);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ea94b7a..554210d 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 _0x6d1c=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x3ebf8e,_0x1468f2){var _0x406546=function(_0x5d4609){while(--_0x5d4609){_0x3ebf8e['push'](_0x3ebf8e['shift']());}};_0x406546(++_0x1468f2);}(_0x6d1c,0x10b));var _0xc6d1=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x6d1c[_0x32f26d];return _0x5d9ddc;};'use strict';var multer=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var path=require(_0xc6d1('0x2'));var timeout=require(_0xc6d1('0x3'));var express=require(_0xc6d1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6d1('0x5'));var config=require(_0xc6d1('0x6'));var controller=require(_0xc6d1('0x7'));router[_0xc6d1('0x8')]('/',auth['isAuthenticated'](),controller[_0xc6d1('0x9')]);router['get'](_0xc6d1('0xa'),auth[_0xc6d1('0xb')](),controller['describe']);router['get'](_0xc6d1('0xc'),auth[_0xc6d1('0xb')](),controller[_0xc6d1('0xd')]);router[_0xc6d1('0xe')]('/',auth[_0xc6d1('0xb')](),controller['create']);router[_0xc6d1('0xf')](_0xc6d1('0xc'),auth[_0xc6d1('0xb')](),controller[_0xc6d1('0x10')]);router[_0xc6d1('0x11')](_0xc6d1('0xc'),auth['isAuthenticated'](),controller[_0xc6d1('0x12')]);module[_0xc6d1('0x13')]=router; \ No newline at end of file +var _0xaeaf=['show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5de431,_0x514c34){var _0x55a774=function(_0x2c974d){while(--_0x2c974d){_0x5de431['push'](_0x5de431['shift']());}};_0x55a774(++_0x514c34);}(_0xaeaf,0xd8));var _0xfaea=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xaeaf[_0x126fb9];return _0xc8a3b1;};'use strict';var multer=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var path=require('path');var timeout=require(_0xfaea('0x2'));var express=require(_0xfaea('0x3'));var router=express[_0xfaea('0x4')]();var auth=require(_0xfaea('0x5'));var interaction=require(_0xfaea('0x6'));var config=require(_0xfaea('0x7'));var controller=require(_0xfaea('0x8'));router[_0xfaea('0x9')]('/',auth[_0xfaea('0xa')](),controller[_0xfaea('0xb')]);router[_0xfaea('0x9')](_0xfaea('0xc'),auth[_0xfaea('0xa')](),controller[_0xfaea('0xd')]);router[_0xfaea('0x9')](_0xfaea('0xe'),auth[_0xfaea('0xa')](),controller[_0xfaea('0xf')]);router[_0xfaea('0x10')]('/',auth[_0xfaea('0xa')](),controller[_0xfaea('0x11')]);router[_0xfaea('0x12')](_0xfaea('0xe'),auth[_0xfaea('0xa')](),controller[_0xfaea('0x13')]);router['delete'](_0xfaea('0xe'),auth[_0xfaea('0xa')](),controller['destroy']);module[_0xfaea('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a05d0bc..6a10408 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 _0xda15=['mouseOver','timeout','INTEGER','exports','STRING','ENUM'];(function(_0x408fbc,_0x47f317){var _0x533127=function(_0x22c39d){while(--_0x22c39d){_0x408fbc['push'](_0x408fbc['shift']());}};_0x533127(++_0x47f317);}(_0xda15,0x111));var _0x5da1=function(_0x25b63b,_0x568ad8){_0x25b63b=_0x25b63b-0x0;var _0x216842=_0xda15[_0x25b63b];return _0x216842;};'use strict';var Sequelize=require('sequelize');module[_0x5da1('0x0')]={'name':{'type':Sequelize[_0x5da1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5da1('0x2')](_0x5da1('0x3'),_0x5da1('0x4')),'defaultValue':_0x5da1('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5da1('0x5')]}}; \ No newline at end of file +var _0x53ea=['mouseOver','INTEGER','sequelize','STRING','ENUM','timeout'];(function(_0x181989,_0x3e401e){var _0x41f686=function(_0x443e86){while(--_0x443e86){_0x181989['push'](_0x181989['shift']());}};_0x41f686(++_0x3e401e);}(_0x53ea,0x1a0));var _0xa53e=function(_0x2d2d19,_0x3ba714){_0x2d2d19=_0x2d2d19-0x0;var _0x36e384=_0x53ea[_0x2d2d19];return _0x36e384;};'use strict';var Sequelize=require(_0xa53e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa53e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa53e('0x2')]('mouseOver',_0xa53e('0x3')),'defaultValue':_0xa53e('0x4')},'selector':{'type':Sequelize[_0xa53e('0x1')]},'timeout':{'type':Sequelize[_0xa53e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 4ef4b39..7df9983 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 _0xedd9=['offset','limit','Content-Range','reject','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','catch','create','ChatProactiveAction','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xedd9,0xfc));var _0x9edd=function(_0x20dd7f,_0x16801b){_0x20dd7f=_0x20dd7f-0x0;var _0x2c55ef=_0xedd9[_0x20dd7f];return _0x2c55ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={'raw':!![],'where':{'id':_0x25e135[_0x9edd('0x27')]['id']}},_0x57a2cc={};_0x57a2cc[_0x9edd('0x28')]=_[_0x9edd('0x29')](db['ChatProactiveAction'][_0x9edd('0x2a')]);_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x29')](_0x25e135[_0x9edd('0x2b')]);_0x57a2cc['filters']=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],_0x57a2cc[_0x9edd('0x2b')]);_0x4fe471[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],qs[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2b')][_0x9edd('0x2e')]));_0x4fe471[_0x9edd('0x2d')]=_0x4fe471[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x4fe471[_0x9edd('0x2d')]:_0x57a2cc[_0x9edd('0x28')];if(_0x25e135[_0x9edd('0x2b')]['includeAll']){_0x4fe471[_0x9edd('0x30')]=[{'all':!![]}];}_0x4fe471=_[_0x9edd('0x31')]({},_0x4fe471,_0x25e135[_0x9edd('0x32')]);return db['ChatProactiveAction'][_0x9edd('0x33')](_0x4fe471)[_0x9edd('0x21')](handleEntityNotFound(_0x3c2227,null))[_0x9edd('0x21')](respondWithResult(_0x3c2227,null))[_0x9edd('0x34')](handleError(_0x3c2227,null));};exports[_0x9edd('0x35')]=function(_0x2bc4ed,_0x473068){return db[_0x9edd('0x36')][_0x9edd('0x35')](_0x2bc4ed[_0x9edd('0x37')],{})[_0x9edd('0x21')](respondWithResult(_0x473068,0xc9))[_0x9edd('0x34')](handleError(_0x473068,null));};exports[_0x9edd('0x20')]=function(_0x14f780,_0x5757fc){if(_0x14f780[_0x9edd('0x37')]['id']){delete _0x14f780['body']['id'];}return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x14f780[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x5757fc,null))[_0x9edd('0x21')](saveUpdates(_0x14f780['body'],null))[_0x9edd('0x21')](respondWithResult(_0x5757fc,null))[_0x9edd('0x34')](handleError(_0x5757fc,null));};exports[_0x9edd('0x22')]=function(_0x38e9be,_0x1be77f){return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x38e9be[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x1be77f,null))[_0x9edd('0x21')](removeEntity(_0x1be77f,null))['catch'](handleError(_0x1be77f,null));}; \ No newline at end of file +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x4a038b,_0x212f45){var _0x423ad0=function(_0x2fa2b8){while(--_0x2fa2b8){_0x4a038b['push'](_0x4a038b['shift']());}};_0x423ad0(++_0x212f45);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c9b60c9..f84158f 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 _0x531e=['ChatProactiveAction','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x531e,0x14b));var _0xe531=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x531e[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0xe531('0x0'));var util=require(_0xe531('0x1'));var logger=require(_0xe531('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe531('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe531('0x4'));var rimraf=require(_0xe531('0x5'));var config=require(_0xe531('0x6'));var attributes=require(_0xe531('0x7'));module[_0xe531('0x8')]=function(_0x1c37a1,_0x3e8024){return _0x1c37a1[_0xe531('0x9')](_0xe531('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f5=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3f2a44,_0xf70f4b){var _0x50d3cb=function(_0x4f896d){while(--_0x4f896d){_0x3f2a44['push'](_0x3f2a44['shift']());}};_0x50d3cb(++_0xf70f4b);}(_0x31f5,0x19a));var _0x531f=function(_0x133fc0,_0x1edda8){_0x133fc0=_0x133fc0-0x0;var _0x4ce619=_0x31f5[_0x133fc0];return _0x4ce619;};'use strict';var _=require(_0x531f('0x0'));var util=require(_0x531f('0x1'));var logger=require(_0x531f('0x2'))(_0x531f('0x3'));var moment=require(_0x531f('0x4'));var BPromise=require(_0x531f('0x5'));var rp=require(_0x531f('0x6'));var fs=require('fs');var path=require(_0x531f('0x7'));var rimraf=require(_0x531f('0x8'));var config=require(_0x531f('0x9'));var attributes=require(_0x531f('0xa'));module[_0x531f('0xb')]=function(_0x2a0932,_0x5b26dc){return _0x2a0932[_0x531f('0xc')](_0x531f('0xd'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d0e6b72..80e4e5a 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 _0x1262=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x2362ec,_0x1c9ee1){var _0x41599f=function(_0x45b391){while(--_0x45b391){_0x2362ec['push'](_0x2362ec['shift']());}};_0x41599f(++_0x1c9ee1);}(_0x1262,0x72));var _0x2126=function(_0x4d2bed,_0x305c78){_0x4d2bed=_0x4d2bed-0x0;var _0xbbcbea=_0x1262[_0x4d2bed];return _0xbbcbea;};'use strict';var _=require(_0x2126('0x0'));var util=require(_0x2126('0x1'));var moment=require(_0x2126('0x2'));var BPromise=require(_0x2126('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2126('0x4'))['db'];var utils=require(_0x2126('0x5'));var logger=require('../../config/logger')(_0x2126('0x6'));var config=require(_0x2126('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2126('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x216506,_0xe9b96,_0x3ff147){return new BPromise(function(_0x196526,_0x2876a5){return client[_0x2126('0x9')](_0x216506,_0x3ff147)[_0x2126('0xa')](function(_0x3a5f18){logger[_0x2126('0xb')](_0x2126('0xc'),_0xe9b96,_0x2126('0xd'));logger[_0x2126('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xe9b96,'request\x20sent',JSON[_0x2126('0xf')](_0x3a5f18));if(_0x3a5f18[_0x2126('0x10')]){if(_0x3a5f18[_0x2126('0x10')][_0x2126('0x11')]===0x1f4){logger[_0x2126('0x10')](_0x2126('0xc'),_0xe9b96,_0x3a5f18[_0x2126('0x10')]['message']);return _0x2876a5(_0x3a5f18[_0x2126('0x10')]['message']);}logger[_0x2126('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0xe9b96,_0x3a5f18[_0x2126('0x10')][_0x2126('0x12')]);return _0x196526(_0x3a5f18[_0x2126('0x10')][_0x2126('0x12')]);}else{logger[_0x2126('0xb')](_0x2126('0xc'),_0xe9b96,_0x2126('0xd'));_0x196526(_0x3a5f18[_0x2126('0x13')][_0x2126('0x12')]);}})[_0x2126('0x14')](function(_0x427781){logger[_0x2126('0x10')](_0x2126('0xc'),_0xe9b96,_0x427781);_0x2876a5(_0x427781);});});} \ No newline at end of file +var _0xa14b=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x32d230,_0x17dfe7){var _0x22d9ad=function(_0xf5c340){while(--_0xf5c340){_0x32d230['push'](_0x32d230['shift']());}};_0x22d9ad(++_0x17dfe7);}(_0xa14b,0xb2));var _0xba14=function(_0x26224b,_0x5530e3){_0x26224b=_0x26224b-0x0;var _0x4df646=_0xa14b[_0x26224b];return _0x4df646;};'use strict';var _=require(_0xba14('0x0'));var util=require(_0xba14('0x1'));var moment=require(_0xba14('0x2'));var BPromise=require(_0xba14('0x3'));var rs=require(_0xba14('0x4'));var fs=require('fs');var Redis=require(_0xba14('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba14('0x6'));var logger=require(_0xba14('0x7'))(_0xba14('0x8'));var config=require(_0xba14('0x9'));var jayson=require(_0xba14('0xa'));var client=jayson[_0xba14('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52b044,_0xa63cbe,_0x542fd6){return new BPromise(function(_0x35c22e,_0x120ecd){return client[_0xba14('0xc')](_0x52b044,_0x542fd6)[_0xba14('0xd')](function(_0x5edb92){logger[_0xba14('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0xa63cbe,_0xba14('0xf'));logger[_0xba14('0x10')](_0xba14('0x11'),_0xa63cbe,'request\x20sent',JSON[_0xba14('0x12')](_0x5edb92));if(_0x5edb92[_0xba14('0x13')]){if(_0x5edb92[_0xba14('0x13')][_0xba14('0x14')]===0x1f4){logger[_0xba14('0x13')](_0xba14('0x15'),_0xa63cbe,_0x5edb92['error'][_0xba14('0x16')]);return _0x120ecd(_0x5edb92[_0xba14('0x13')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xa63cbe,_0x5edb92[_0xba14('0x13')]['message']);return _0x35c22e(_0x5edb92['error'][_0xba14('0x16')]);}else{logger['info'](_0xba14('0x15'),_0xa63cbe,'request\x20sent');_0x35c22e(_0x5edb92[_0xba14('0x17')][_0xba14('0x16')]);}})[_0xba14('0x18')](function(_0x1d8278){logger[_0xba14('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0xa63cbe,_0x1d8278);_0x120ecd(_0x1d8278);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d2e54dc..7952118 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 _0x80aa=['../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express'];(function(_0x130ed8,_0x46fbf1){var _0x53e6c4=function(_0x47dbe1){while(--_0x47dbe1){_0x130ed8['push'](_0x130ed8['shift']());}};_0x53e6c4(++_0x46fbf1);}(_0x80aa,0x1ec));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xa80a('0x0'));var path=require(_0xa80a('0x1'));var timeout=require(_0xa80a('0x2'));var express=require(_0xa80a('0x3'));var router=express['Router']();var auth=require(_0xa80a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa80a('0x5'));var controller=require(_0xa80a('0x6'));router[_0xa80a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa80a('0x8')]);router[_0xa80a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa80a('0xa')]);router[_0xa80a('0xb')](_0xa80a('0xc'),auth['isAuthenticated'](),controller[_0xa80a('0xd')]);router[_0xa80a('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa80a('0xf')]=router; \ No newline at end of file +var _0x0d8d=['get','isAuthenticated','show','post','create','put','delete','/:id','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x18b4c6,_0x2dc1fd){var _0x360dc6=function(_0xaa546e){while(--_0xaa546e){_0x18b4c6['push'](_0x18b4c6['shift']());}};_0x360dc6(++_0x2dc1fd);}(_0x0d8d,0x1ac));var _0xd0d8=function(_0x1192c7,_0x403d79){_0x1192c7=_0x1192c7-0x0;var _0x50ae76=_0x0d8d[_0x1192c7];return _0x50ae76;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd0d8('0x0'));var timeout=require(_0xd0d8('0x1'));var express=require(_0xd0d8('0x2'));var router=express[_0xd0d8('0x3')]();var auth=require(_0xd0d8('0x4'));var interaction=require(_0xd0d8('0x5'));var config=require('../../config/environment');var controller=require(_0xd0d8('0x6'));router[_0xd0d8('0x7')]('/:id',auth[_0xd0d8('0x8')](),controller[_0xd0d8('0x9')]);router[_0xd0d8('0xa')]('/',auth[_0xd0d8('0x8')](),controller[_0xd0d8('0xb')]);router[_0xd0d8('0xc')]('/:id',auth[_0xd0d8('0x8')](),controller['update']);router[_0xd0d8('0xd')](_0xd0d8('0xe'),auth['isAuthenticated'](),controller['destroy']);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 34df19b..2c06755 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 _0xbc3d=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','name'];(function(_0x1a48a0,_0x3c95f5){var _0x269714=function(_0x33d9e3){while(--_0x33d9e3){_0x1a48a0['push'](_0x1a48a0['shift']());}};_0x269714(++_0x3c95f5);}(_0xbc3d,0xa0));var _0xdbc3=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xbc3d[_0x45fc6a];return _0x14bcfd;};'use strict';var Sequelize=require(_0xdbc3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdbc3('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdbc3('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdbc3('0x3')](_0xdbc3('0x4'),'beepall',_0xdbc3('0x5'))}}; \ No newline at end of file +var _0x9228=['exports','STRING','name','INTEGER','ENUM'];(function(_0x2a1ab8,_0x1a924f){var _0x12e279=function(_0xe329bb){while(--_0xe329bb){_0x2a1ab8['push'](_0x2a1ab8['shift']());}};_0x12e279(++_0x1a924f);}(_0x9228,0x159));var _0x8922=function(_0x1c1e7c,_0x580733){_0x1c1e7c=_0x1c1e7c-0x0;var _0x9795d3=_0x9228[_0x1c1e7c];return _0x9795d3;};'use strict';var Sequelize=require('sequelize');module[_0x8922('0x0')]={'name':{'type':Sequelize[_0x8922('0x1')],'unique':_0x8922('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8922('0x1')]},'timeout':{'type':Sequelize[_0x8922('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8922('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 892d8db..db85244 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 _0x869b=['select','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','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/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.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','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','limit','set','apply','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','keys','length','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','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','hasOwnProperty','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','emit','userChatQueue:save','removeTeams'];(function(_0xa67cfe,_0x30a6ca){var _0x2fde72=function(_0x2fcf5d){while(--_0x2fcf5d){_0xa67cfe['push'](_0xa67cfe['shift']());}};_0x2fde72(++_0x30a6ca);}(_0x869b,0x15e));var _0xb869=function(_0x4efd4c,_0x472138){_0x4efd4c=_0x4efd4c-0x0;var _0x3707f5=_0x869b[_0x4efd4c];return _0x3707f5;};'use strict';var pdf=require(_0xb869('0x0'));var emlformat=require(_0xb869('0x1'));var rimraf=require(_0xb869('0x2'));var zipdir=require(_0xb869('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb869('0x4'));var Mustache=require(_0xb869('0x5'));var util=require('util');var path=require(_0xb869('0x6'));var sox=require(_0xb869('0x7'));var csv=require(_0xb869('0x8'));var ejs=require(_0xb869('0x9'));var fs=require('fs');var _=require(_0xb869('0xa'));var squel=require(_0xb869('0xb'));var crypto=require(_0xb869('0xc'));var jsforce=require(_0xb869('0xd'));var deskjs=require(_0xb869('0xe'));var toCsv=require(_0xb869('0x8'));var querystring=require(_0xb869('0xf'));var Papa=require(_0xb869('0x10'));var Redis=require(_0xb869('0x11'));var authService=require(_0xb869('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb869('0x13'));var hardwareService=require(_0xb869('0x14'));var logger=require(_0xb869('0x15'))(_0xb869('0x16'));var utils=require('../../config/utils');var config=require(_0xb869('0x17'));var db=require(_0xb869('0x18'))['db'];config[_0xb869('0x19')]=_['defaults'](config[_0xb869('0x19')],{'host':_0xb869('0x1a'),'port':0x18eb});var socket=require(_0xb869('0x1b'))(new Redis(config[_0xb869('0x19')]));require(_0xb869('0x1c'))[_0xb869('0x1d')](socket);var jayson=require(_0xb869('0x1e'));var client=jayson[_0xb869('0x1f')][_0xb869('0x20')]({'port':0x232a});function checkPasswordPattern(_0x2225f1,_0x224e4a,_0x165d65){if(_0x165d65){var _0x33979a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33979a[_0xb869('0x21')](_0x224e4a)){return _0x2225f1;}else{throw new db[(_0xb869('0x22'))][(_0xb869('0x23'))](_0xb869('0x24'));}}else{return _0x2225f1;}}function respondWithRpcPromise(_0x2e9f9f,_0x4d9e72,_0x3e1a65,_0x52c8c3){return new BPromise(function(_0xce1e8c,_0x213cfc){var _0x178d8e=_0x52c8c3||client;return _0x178d8e[_0xb869('0x25')](_0x2e9f9f,_0x3e1a65)['then'](function(_0x3c1fad){logger[_0xb869('0x26')](_0xb869('0x27'),_0x4d9e72,'request\x20sent');logger[_0xb869('0x28')](_0xb869('0x29'),_0x4d9e72,_0xb869('0x2a'),JSON[_0xb869('0x2b')](_0x3c1fad));if(_0x3c1fad[_0xb869('0x2c')]){if(_0x3c1fad['error'][_0xb869('0x2d')]===0x1f4){logger[_0xb869('0x2c')](_0xb869('0x27'),_0x4d9e72,_0x3c1fad[_0xb869('0x2c')][_0xb869('0x2e')]);return _0x213cfc(_0x3c1fad[_0xb869('0x2c')][_0xb869('0x2e')]);}logger[_0xb869('0x2c')](_0xb869('0x27'),_0x4d9e72,_0x3c1fad[_0xb869('0x2c')][_0xb869('0x2e')]);return _0xce1e8c(_0x3c1fad['error'][_0xb869('0x2e')]);}else{logger['info'](_0xb869('0x27'),_0x4d9e72,'request\x20sent');_0xce1e8c(_0x3c1fad['result'][_0xb869('0x2e')]);}})[_0xb869('0x2f')](function(_0x56f4b6){logger['error'](_0xb869('0x27'),_0x4d9e72,_0x56f4b6);_0x213cfc(_0x56f4b6);});});}function respondWithStatusCode(_0x14f9f3,_0x311a9a){_0x311a9a=_0x311a9a||0xcc;return function(_0x331807){if(_0x331807){return _0x14f9f3[_0xb869('0x30')](_0x311a9a);}return _0x14f9f3[_0xb869('0x31')](_0x311a9a)[_0xb869('0x32')]();};}function respondWithResult(_0x218043,_0x16d5c9){_0x16d5c9=_0x16d5c9||0xc8;return function(_0x2191c9){if(_0x2191c9){return _0x218043['status'](_0x16d5c9)[_0xb869('0x33')](_0x2191c9);}};}function respondWithFilteredResult(_0x2a32ad,_0x4196de){return function(_0x124864){if(_0x124864){var _0x32b99f=_0x124864['count'],_0xed414e=_0x4196de['offset'],_0x431bef=_0x4196de['offset']+_0x4196de[_0xb869('0x34')],_0x5241eb;if(_0x431bef>=_0x32b99f){_0x431bef=_0x32b99f;_0x5241eb=0xc8;}else{_0x5241eb=0xce;}_0x2a32ad[_0xb869('0x31')](_0x5241eb);return _0x2a32ad[_0xb869('0x35')]('Content-Range',_0xed414e+'-'+_0x431bef+'/'+_0x32b99f)[_0xb869('0x33')](_0x124864);}return null;};}function patchUpdates(_0x22dd29){return function(_0x472f71){try{jsonpatch[_0xb869('0x36')](_0x472f71,_0x22dd29,!![]);}catch(_0xba70a6){return BPromise['reject'](_0xba70a6);}return _0x472f71[_0xb869('0x37')]();};}function saveUpdates(_0xa87955,_0x62c65a){return function(_0x5aa3d1){if(_0x5aa3d1){return _0x5aa3d1[_0xb869('0x38')](_0xa87955)[_0xb869('0x39')](function(_0x30976d){return _0x30976d;});}return null;};}function removeEntity(_0x932b65,_0x1b32f4){return function(_0x453342){if(_0x453342){return _0x453342[_0xb869('0x3a')]()[_0xb869('0x39')](function(){var _0x32e359=_0x453342[_0xb869('0x3b')]({'plain':!![]});var _0x3d784e=_0xb869('0x3c');return db[_0xb869('0x3d')][_0xb869('0x3a')]({'where':{'type':_0x3d784e,'resourceId':_0x32e359['id']}})[_0xb869('0x39')](function(){return _0x453342;});})['then'](function(){_0x932b65[_0xb869('0x31')](0xcc)[_0xb869('0x32')]();});}};}function handleEntityNotFound(_0xafc14f,_0x1766e3){return function(_0x4310f3){if(!_0x4310f3){_0xafc14f[_0xb869('0x30')](0x194);}return _0x4310f3;};}function handleError(_0x10042d,_0x1439b2){_0x1439b2=_0x1439b2||0x1f4;return function(_0x30a514){logger[_0xb869('0x2c')](_0x30a514[_0xb869('0x3e')]);if(_0x30a514['name']){delete _0x30a514[_0xb869('0x3f')];}_0x10042d[_0xb869('0x31')](_0x1439b2)[_0xb869('0x40')](_0x30a514);};}exports[_0xb869('0x41')]=function(_0x55ace5,_0x372bdf){var _0x269e37={},_0x4d7765={},_0x462ad7={'count':0x0,'rows':[]};var _0x1a0ea8=_[_0xb869('0x42')](db[_0xb869('0x43')][_0xb869('0x44')],function(_0xe5d6ca){return{'name':_0xe5d6ca[_0xb869('0x45')],'type':_0xe5d6ca[_0xb869('0x46')]['key']};});_0x4d7765['model']=_[_0xb869('0x42')](_0x1a0ea8,'name');_0x4d7765[_0xb869('0x47')]=_['keys'](_0x55ace5[_0xb869('0x47')]);_0x4d7765[_0xb869('0x48')]=_[_0xb869('0x49')](_0x4d7765[_0xb869('0x4a')],_0x4d7765['query']);_0x269e37['attributes']=_[_0xb869('0x49')](_0x4d7765[_0xb869('0x4a')],qs[_0xb869('0x4b')](_0x55ace5[_0xb869('0x47')][_0xb869('0x4b')]));_0x269e37[_0xb869('0x4c')]=_0x269e37['attributes']['length']?_0x269e37[_0xb869('0x4c')]:_0x4d7765[_0xb869('0x4a')];if(!_0x55ace5[_0xb869('0x47')]['hasOwnProperty'](_0xb869('0x4d'))){_0x269e37[_0xb869('0x34')]=qs['limit'](_0x55ace5[_0xb869('0x47')][_0xb869('0x34')]);_0x269e37[_0xb869('0x4e')]=qs[_0xb869('0x4e')](_0x55ace5['query'][_0xb869('0x4e')]);}_0x269e37[_0xb869('0x4f')]=qs[_0xb869('0x50')](_0x55ace5[_0xb869('0x47')][_0xb869('0x50')]);_0x269e37[_0xb869('0x51')]=qs[_0xb869('0x48')](_[_0xb869('0x52')](_0x55ace5[_0xb869('0x47')],_0x4d7765[_0xb869('0x48')]),_0x1a0ea8);if(_0x55ace5['query'][_0xb869('0x53')]){_0x269e37[_0xb869('0x51')]=_[_0xb869('0x54')](_0x269e37[_0xb869('0x51')],{'$or':_[_0xb869('0x42')](_0x1a0ea8,function(_0x3bc4b5){if(_0x3bc4b5[_0xb869('0x46')]!==_0xb869('0x55')){var _0x32f13c={};_0x32f13c[_0x3bc4b5[_0xb869('0x3f')]]={'$like':'%'+_0x55ace5[_0xb869('0x47')][_0xb869('0x53')]+'%'};return _0x32f13c;}})});}_0x269e37=_[_0xb869('0x54')]({},_0x269e37,_0x55ace5['options']);var _0xf71eb6={'where':_0x269e37[_0xb869('0x51')]};return db['ChatQueue']['count'](_0xf71eb6)['then'](function(_0x49e1fc){_0x462ad7[_0xb869('0x56')]=_0x49e1fc;if(_0x55ace5[_0xb869('0x47')][_0xb869('0x57')]){_0x269e37['include']=[{'all':!![]}];}return db['ChatQueue'][_0xb869('0x58')](_0x269e37);})[_0xb869('0x39')](function(_0x233268){_0x462ad7[_0xb869('0x59')]=_0x233268;return _0x462ad7;})[_0xb869('0x39')](respondWithFilteredResult(_0x372bdf,_0x269e37))['catch'](handleError(_0x372bdf,null));};exports[_0xb869('0x5a')]=function(_0x213e76,_0x545003){var _0x22a25b={'raw':!![],'where':{'id':_0x213e76['params']['id']}},_0x1a0c0b={};_0x1a0c0b[_0xb869('0x4a')]=_[_0xb869('0x5b')](db[_0xb869('0x43')][_0xb869('0x44')]);_0x1a0c0b['query']=_[_0xb869('0x5b')](_0x213e76['query']);_0x1a0c0b['filters']=_[_0xb869('0x49')](_0x1a0c0b[_0xb869('0x4a')],_0x1a0c0b[_0xb869('0x47')]);_0x22a25b['attributes']=_[_0xb869('0x49')](_0x1a0c0b[_0xb869('0x4a')],qs['fields'](_0x213e76['query'][_0xb869('0x4b')]));_0x22a25b[_0xb869('0x4c')]=_0x22a25b[_0xb869('0x4c')][_0xb869('0x5c')]?_0x22a25b['attributes']:_0x1a0c0b[_0xb869('0x4a')];if(_0x213e76['query'][_0xb869('0x57')]){_0x22a25b[_0xb869('0x5d')]=[{'all':!![]}];}_0x22a25b=_[_0xb869('0x54')]({},_0x22a25b,_0x213e76[_0xb869('0x5e')]);return db[_0xb869('0x43')][_0xb869('0x5f')](_0x22a25b)[_0xb869('0x39')](handleEntityNotFound(_0x545003,null))[_0xb869('0x39')](respondWithResult(_0x545003,null))[_0xb869('0x2f')](handleError(_0x545003,null));};exports[_0xb869('0x60')]=function(_0x7e078c,_0x51eab4){return db[_0xb869('0x43')]['create'](_0x7e078c[_0xb869('0x61')],{})[_0xb869('0x39')](function(_0x765952){var _0xd9cfc2=_0x7e078c[_0xb869('0x62')][_0xb869('0x3b')]({'plain':!![]});if(!_0xd9cfc2)throw new Error(_0xb869('0x63'));if(_0xd9cfc2[_0xb869('0x64')]===_0xb869('0x62')){var _0x557597=_0x765952[_0xb869('0x3b')]({'plain':!![]});var _0x52d994=_0xb869('0x3c');return db[_0xb869('0x65')][_0xb869('0x5f')]({'where':{'name':_0x52d994,'userProfileId':_0xd9cfc2[_0xb869('0x66')]},'raw':!![]})[_0xb869('0x39')](function(_0x5caa80){if(_0x5caa80&&_0x5caa80[_0xb869('0x67')]===0x0){return db[_0xb869('0x3d')][_0xb869('0x60')]({'name':_0x557597[_0xb869('0x3f')],'resourceId':_0x557597['id'],'type':_0x5caa80[_0xb869('0x3f')],'sectionId':_0x5caa80['id']},{})[_0xb869('0x39')](function(){return _0x765952;});}else{return _0x765952;}})[_0xb869('0x2f')](function(_0x45eb5c){logger['error'](_0xb869('0x68'),_0x45eb5c);throw _0x45eb5c;});}return _0x765952;})[_0xb869('0x39')](respondWithResult(_0x51eab4,0xc9))['catch'](handleError(_0x51eab4,null));};exports[_0xb869('0x38')]=function(_0x54dc24,_0x594e07){if(_0x54dc24[_0xb869('0x61')]['id']){delete _0x54dc24['body']['id'];}return db[_0xb869('0x43')][_0xb869('0x5f')]({'where':{'id':_0x54dc24[_0xb869('0x69')]['id']}})[_0xb869('0x39')](handleEntityNotFound(_0x594e07,null))[_0xb869('0x39')](saveUpdates(_0x54dc24[_0xb869('0x61')],null))['then'](respondWithResult(_0x594e07,null))['catch'](handleError(_0x594e07,null));};exports[_0xb869('0x3a')]=function(_0xcb8f25,_0xd3ca16){return db[_0xb869('0x43')][_0xb869('0x5f')]({'where':{'id':_0xcb8f25[_0xb869('0x69')]['id']}})[_0xb869('0x39')](handleEntityNotFound(_0xd3ca16,null))[_0xb869('0x39')](removeEntity(_0xd3ca16,null))[_0xb869('0x2f')](handleError(_0xd3ca16,null));};exports[_0xb869('0x6a')]=function(_0x51dea5,_0x1f21ea){return db[_0xb869('0x43')][_0xb869('0x6a')]()['then'](respondWithResult(_0x1f21ea,null))[_0xb869('0x2f')](handleError(_0x1f21ea,null));};exports[_0xb869('0x6b')]=function(_0x1cce1e,_0x11870c,_0x56f932){var _0x3c4490={'raw':!![],'where':{}},_0x249868={},_0x5c16bd;return db['ChatQueue'][_0xb869('0x6c')]({'where':{'id':_0x1cce1e[_0xb869('0x69')]['id']}})[_0xb869('0x39')](handleEntityNotFound(_0x11870c,null))['then'](function(_0x36cd8b){if(_0x36cd8b){_0x5c16bd=_0x36cd8b[_0xb869('0x3b')]({'plain':!![]});_0x249868[_0xb869('0x4a')]=_[_0xb869('0x5b')](db[_0xb869('0x6d')][_0xb869('0x44')]);_0x249868[_0xb869('0x47')]=_[_0xb869('0x5b')](_0x1cce1e[_0xb869('0x47')]);_0x249868[_0xb869('0x48')]=_[_0xb869('0x49')](_0x249868[_0xb869('0x4a')],_0x249868[_0xb869('0x47')]);_0x3c4490[_0xb869('0x4c')]=_[_0xb869('0x49')](_0x249868[_0xb869('0x4a')],qs['fields'](_0x1cce1e[_0xb869('0x47')][_0xb869('0x4b')]));_0x3c4490[_0xb869('0x4c')]=_0x3c4490['attributes'][_0xb869('0x5c')]?_0x3c4490[_0xb869('0x4c')]:_0x249868[_0xb869('0x4a')];if(!_0x1cce1e['query']['hasOwnProperty']('nolimit')){_0x3c4490['limit']=qs[_0xb869('0x34')](_0x1cce1e[_0xb869('0x47')][_0xb869('0x34')]);_0x3c4490['offset']=qs[_0xb869('0x4e')](_0x1cce1e['query'][_0xb869('0x4e')]);}_0x3c4490['order']=qs[_0xb869('0x50')](_0x1cce1e[_0xb869('0x47')][_0xb869('0x50')]);_0x3c4490[_0xb869('0x51')]=qs[_0xb869('0x48')](_[_0xb869('0x52')](_0x1cce1e[_0xb869('0x47')],_0x249868['filters']));_0x3c4490[_0xb869('0x51')][_0xb869('0x6e')]=_0x36cd8b['id'];if(_0x1cce1e[_0xb869('0x47')][_0xb869('0x53')]){_0x3c4490['where']=_['merge'](_0x3c4490[_0xb869('0x51')],{'$or':_[_0xb869('0x42')](_0x3c4490[_0xb869('0x4c')],function(_0x435460){var _0xa59ffc={};_0xa59ffc[_0x435460]={'$like':'%'+_0x1cce1e[_0xb869('0x47')][_0xb869('0x53')]+'%'};return _0xa59ffc;})});}_0x3c4490=_[_0xb869('0x54')]({},_0x3c4490,_0x1cce1e['options']);return db[_0xb869('0x6d')]['findAll'](_0x3c4490);}})[_0xb869('0x39')](function(_0x2d9431){if(_0x2d9431){return db[_0xb869('0x6f')][_0xb869('0x70')]({'where':{'id':_[_0xb869('0x42')](_0x2d9431,'UserId'),'role':_0xb869('0x71')},'attributes':['id',_0xb869('0x3f'),_0xb869('0x72'),_0xb869('0x73'),_0xb869('0x74')]});}})[_0xb869('0x39')](function(_0x33d91f){if(_0x33d91f){return{'count':_0x33d91f[_0xb869('0x56')],'rows':_[_0xb869('0x42')](_0x33d91f[_0xb869('0x59')],function(_0x421501){return{'membername':_0x421501[_0xb869('0x3f')],'UserId':_0x421501['id'],'queue_name':_0x5c16bd[_0xb869('0x3f')],'ChatQueueId':_0x5c16bd['id'],'interface':util['format'](_0xb869('0x75'),_0xb869('0x76'),_0x421501[_0xb869('0x3f')]),'penalty':0x0,'paused':_0x421501[_0xb869('0x72')],'createdAt':_0x421501[_0xb869('0x74')],'updatedAt':_0x421501['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb869('0x39')](respondWithFilteredResult(_0x11870c,_0x3c4490))[_0xb869('0x2f')](handleError(_0x11870c,null));};exports[_0xb869('0x77')]=function(_0x1adb7b,_0x374d95,_0x3f8344){var _0x3d1eee={};var _0x1e9786={};var _0x18b508;var _0x45885a;return db[_0xb869('0x43')]['findOne']({'where':{'id':_0x1adb7b[_0xb869('0x69')]['id']}})[_0xb869('0x39')](handleEntityNotFound(_0x374d95,null))['then'](function(_0x501e3c){if(_0x501e3c){_0x18b508=_0x501e3c;_0x1e9786['model']=_[_0xb869('0x5b')](db[_0xb869('0x78')][_0xb869('0x44')]);_0x1e9786[_0xb869('0x47')]=_[_0xb869('0x5b')](_0x1adb7b[_0xb869('0x47')]);_0x1e9786[_0xb869('0x48')]=_[_0xb869('0x49')](_0x1e9786[_0xb869('0x4a')],_0x1e9786[_0xb869('0x47')]);_0x3d1eee[_0xb869('0x4c')]=_['intersection'](_0x1e9786[_0xb869('0x4a')],qs[_0xb869('0x4b')](_0x1adb7b['query'][_0xb869('0x4b')]));_0x3d1eee[_0xb869('0x4c')]=_0x3d1eee[_0xb869('0x4c')][_0xb869('0x5c')]?_0x3d1eee[_0xb869('0x4c')]:_0x1e9786[_0xb869('0x4a')];_0x3d1eee[_0xb869('0x4f')]=qs[_0xb869('0x50')](_0x1adb7b[_0xb869('0x47')]['sort']);_0x3d1eee['where']=qs[_0xb869('0x48')](_[_0xb869('0x52')](_0x1adb7b[_0xb869('0x47')],_0x1e9786[_0xb869('0x48')]));if(_0x1adb7b[_0xb869('0x47')][_0xb869('0x53')]){_0x3d1eee['where']=_[_0xb869('0x54')](_0x3d1eee['where'],{'$or':_['map'](_0x3d1eee[_0xb869('0x4c')],function(_0x529d2d){var _0x39c41b={};_0x39c41b[_0x529d2d]={'$like':'%'+_0x1adb7b[_0xb869('0x47')][_0xb869('0x53')]+'%'};return _0x39c41b;})});}_0x3d1eee=_['merge']({},_0x3d1eee,_0x1adb7b[_0xb869('0x5e')]);return _0x18b508[_0xb869('0x77')](_0x3d1eee);}})[_0xb869('0x39')](function(_0x457b2d){if(_0x457b2d){_0x45885a=_0x457b2d[_0xb869('0x5c')];if(!_0x1adb7b[_0xb869('0x47')][_0xb869('0x79')](_0xb869('0x4d'))){_0x3d1eee[_0xb869('0x34')]=qs[_0xb869('0x34')](_0x1adb7b[_0xb869('0x47')][_0xb869('0x34')]);_0x3d1eee['offset']=qs[_0xb869('0x4e')](_0x1adb7b[_0xb869('0x47')][_0xb869('0x4e')]);}return _0x18b508[_0xb869('0x77')](_0x3d1eee);}})['then'](function(_0x5b782d){if(_0x5b782d){return _0x5b782d?{'count':_0x45885a,'rows':_0x5b782d}:null;}})['then'](respondWithResult(_0x374d95,null))[_0xb869('0x2f')](handleError(_0x374d95,null));};exports['addTeams']=function(_0x372236,_0x3b8b0f,_0x5c8553){var _0x5bd2d9=_0x372236[_0xb869('0x61')][_0xb869('0x7a')];return db[_0xb869('0x78')][_0xb869('0x58')]({'where':{'id':_0x5bd2d9},'attributes':['id'],'include':[{'model':db[_0xb869('0x6f')],'as':'Agents','attributes':['id',_0xb869('0x3f'),_0xb869('0x7b'),_0xb869('0x7c'),_0xb869('0x7d')],'raw':!![]}]})[_0xb869('0x39')](function(_0xe0ffab){if(_0xe0ffab){var _0x2cfbd8=_[_0xb869('0x7e')](_0xe0ffab,function(_0x2f7363){var _0x119684=_0x2f7363[_0xb869('0x3b')]({'plain':!![]});return _0x119684[_0xb869('0x7f')];});return db[_0xb869('0x43')][_0xb869('0x5f')]({'where':{'id':_0x372236[_0xb869('0x69')]['id']}})[_0xb869('0x39')](function(_0x3dd352){return db[_0xb869('0x80')][_0xb869('0x81')](function(_0x1c3894){return _0x3dd352[_0xb869('0x82')](_0x5bd2d9,{'transaction':_0x1c3894})[_0xb869('0x39')](function(){return BPromise[_0xb869('0x83')](_0x2cfbd8,function(_0x1ae850){return db[_0xb869('0x6d')][_0xb869('0x84')]({'where':{'UserId':_0x1ae850['id'],'ChatQueueId':_0x372236[_0xb869('0x69')]['id']},'transaction':_0x1c3894});});})[_0xb869('0x39')](function(){_0x2cfbd8['forEach'](function(_0x4981b5){socket[_0xb869('0x85')](_0xb869('0x86'),{'UserId':_0x4981b5['id'],'ChatQueueId':_0x3dd352['id']});});});});});}})[_0xb869('0x39')](respondWithStatusCode(_0x3b8b0f,null))['catch'](handleError(_0x3b8b0f,null));};exports[_0xb869('0x87')]=function(_0x3ad063,_0x3270af,_0x3def8f){return db[_0xb869('0x78')][_0xb869('0x58')]({'where':{'id':_0x3ad063[_0xb869('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb869('0x6f')],'as':_0xb869('0x7f'),'attributes':['id'],'raw':!![]}]})[_0xb869('0x39')](handleEntityNotFound(_0x3270af,null))[_0xb869('0x39')](function(_0x26aab1){var _0xffbf68=_['map'](_0x26aab1,'id');var _0x4713d7=[];var _0x55dde6=[];var _0x1f459e=squel[_0xb869('0x88')]();_0x1f459e['field']('tq.TeamId')[_0xb869('0x89')](_0xb869('0x8a'),'tq')[_0xb869('0x8b')](_0xb869('0x8c'),'ut',_0xb869('0x8d'))['where']('ChatQueueId\x20=\x20?',_0x3ad063[_0xb869('0x69')]['id']);for(var _0x32fb3e=0x0;_0x32fb3e<_0x26aab1[_0xb869('0x5c')];_0x32fb3e+=0x1){let _0x2c42c6=_0x26aab1[_0x32fb3e];for(var _0x2e8b35=0x0;_0x2e8b35<_0x2c42c6[_0xb869('0x7f')][_0xb869('0x5c')];_0x2e8b35+=0x1){let _0x25420d=_0x2c42c6[_0xb869('0x7f')][_0x2e8b35];var _0x327983=_0x1f459e[_0xb869('0x8e')]();_0x327983['where']('ut.UserId\x20=\x20?',_0x25420d['id']);_0x55dde6[_0xb869('0x8f')](db[_0xb869('0x80')][_0xb869('0x47')](_0x327983[_0xb869('0x90')](),{'type':db[_0xb869('0x80')][_0xb869('0x91')][_0xb869('0x92')]})['then'](function(_0x2c1641){if(_0x2c1641[_0xb869('0x5c')]===0x1){return _0x25420d['id'];}else{var _0x3cbee6=_[_0xb869('0x93')](_[_0xb869('0x42')](_0x2c1641,_0xb869('0x94')),function(_0x36c25e){return _[_0xb869('0x95')](_0xffbf68,_0x36c25e);});if(_0x3cbee6){return _0x25420d['id'];}}}));}}return BPromise[_0xb869('0x96')](_0x55dde6)[_0xb869('0x39')](function(_0x1a39bd){_0x4713d7=_(_0x4713d7)['union'](_0x1a39bd)[_0xb869('0x97')]()[_0xb869('0x98')]();return db[_0xb869('0x43')][_0xb869('0x5f')]({'where':{'id':_0x3ad063['params']['id']}})[_0xb869('0x39')](function(_0x433a97){return db['sequelize'][_0xb869('0x81')](function(_0x1ef878){return _0x433a97[_0xb869('0x87')](_0x3ad063[_0xb869('0x47')][_0xb869('0x7a')],{'transaction':_0x1ef878})[_0xb869('0x39')](function(){if(!_[_0xb869('0x99')](_0x4713d7)){return _0x433a97[_0xb869('0x9a')](_0x4713d7,{'transaction':_0x1ef878});}})[_0xb869('0x39')](function(){_0x4713d7[_0xb869('0x9b')](function(_0x2c88a3){socket['emit'](_0xb869('0x9c'),{'UserId':_0x2c88a3,'ChatQueueId':_0x433a97['id']});});});});});});})[_0xb869('0x39')](respondWithStatusCode(_0x3270af,null))[_0xb869('0x2f')](handleError(_0x3270af,null));};exports[_0xb869('0x9d')]=function(_0xf0f908,_0x2dcfdb,_0x384260){return db['ChatQueue'][_0xb869('0x5f')]({'where':{'id':_0xf0f908['params']['id']}})[_0xb869('0x39')](handleEntityNotFound(_0x2dcfdb,null))[_0xb869('0x39')](function(_0xdc1388){if(_0xdc1388){return _0xdc1388[_0xb869('0x9d')](_0xf0f908[_0xb869('0x61')][_0xb869('0x7a')],_[_0xb869('0x9e')](_0xf0f908[_0xb869('0x61')],[_0xb869('0x7a'),'id'])||{})[_0xb869('0x9f')](function(_0x2e44b7){for(var _0x4da14f=0x0;_0x4da14f<_0xf0f908[_0xb869('0x61')][_0xb869('0x7a')][_0xb869('0x5c')];_0x4da14f+=0x1){socket[_0xb869('0x85')]('userChatQueue:save',{'UserId':_0xf0f908['body'][_0xb869('0x7a')][_0x4da14f],'ChatQueueId':_0xf0f908['params']['id']});}return _0x2e44b7;});}})[_0xb869('0x39')](respondWithResult(_0x2dcfdb,null))['catch'](handleError(_0x2dcfdb,null));};exports[_0xb869('0x9a')]=function(_0x2e0642,_0xa6aba2,_0x2d4b01){return db[_0xb869('0x43')][_0xb869('0x5f')]({'where':{'id':_0x2e0642[_0xb869('0x69')]['id']}})['then'](handleEntityNotFound(_0xa6aba2,null))[_0xb869('0x39')](function(_0x28e52b){if(_0x28e52b){return _0x28e52b[_0xb869('0x9a')](_0x2e0642[_0xb869('0x47')][_0xb869('0x7a')])[_0xb869('0x39')](function(){if(_[_0xb869('0xa0')](_0x2e0642[_0xb869('0x47')][_0xb869('0x7a')])){for(var _0x398300=0x0;_0x398300<_0x2e0642['query']['ids'][_0xb869('0x5c')];_0x398300+=0x1){socket[_0xb869('0x85')](_0xb869('0x9c'),{'UserId':Number(_0x2e0642[_0xb869('0x47')][_0xb869('0x7a')][_0x398300]),'ChatQueueId':Number(_0x2e0642['params']['id'])});}}else{socket[_0xb869('0x85')]('userChatQueue:remove',{'UserId':Number(_0x2e0642[_0xb869('0x47')]['ids']),'ChatQueueId':Number(_0x2e0642[_0xb869('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0xa6aba2,null))[_0xb869('0x2f')](handleError(_0xa6aba2,null));};exports['getAgents']=function(_0x5bc689,_0x5e91e0,_0x457a26){var _0x50a5e2={};var _0x457685={};var _0x4723d7;var _0x2ab1c8;return db[_0xb869('0x43')][_0xb869('0x6c')]({'where':{'id':_0x5bc689[_0xb869('0x69')]['id']}})['then'](handleEntityNotFound(_0x5e91e0,null))[_0xb869('0x39')](function(_0x304ca3){if(_0x304ca3){_0x4723d7=_0x304ca3;_0x457685[_0xb869('0x4a')]=_[_0xb869('0x5b')](db['User']['rawAttributes']);_0x457685[_0xb869('0x47')]=_[_0xb869('0x5b')](_0x5bc689['query']);_0x457685[_0xb869('0x48')]=_[_0xb869('0x49')](_0x457685[_0xb869('0x4a')],_0x457685[_0xb869('0x47')]);_0x50a5e2[_0xb869('0x4c')]=_[_0xb869('0x49')](_0x457685[_0xb869('0x4a')],qs[_0xb869('0x4b')](_0x5bc689['query']['fields']));_0x50a5e2[_0xb869('0x4c')]=_0x50a5e2['attributes']['length']?_0x50a5e2[_0xb869('0x4c')]:_0x457685['model'];_0x50a5e2[_0xb869('0x4f')]=qs['sort'](_0x5bc689[_0xb869('0x47')][_0xb869('0x50')]);_0x50a5e2[_0xb869('0x51')]=qs[_0xb869('0x48')](_['pick'](_0x5bc689[_0xb869('0x47')],_0x457685['filters']));if(_0x5bc689[_0xb869('0x47')][_0xb869('0x53')]){_0x50a5e2[_0xb869('0x51')]=_['merge'](_0x50a5e2['where'],{'$or':_[_0xb869('0x42')](_0x50a5e2['attributes'],function(_0x1e3c7){var _0x5932e2={};_0x5932e2[_0x1e3c7]={'$like':'%'+_0x5bc689[_0xb869('0x47')][_0xb869('0x53')]+'%'};return _0x5932e2;})});}_0x50a5e2=_[_0xb869('0x54')]({},_0x50a5e2,_0x5bc689[_0xb869('0x5e')]);return _0x4723d7['getAgents'](_0x50a5e2);}})['then'](function(_0x57b1f0){if(_0x57b1f0){_0x2ab1c8=_0x57b1f0[_0xb869('0x5c')];if(!_0x5bc689['query'][_0xb869('0x79')]('nolimit')){_0x50a5e2[_0xb869('0x34')]=qs['limit'](_0x5bc689['query'][_0xb869('0x34')]);_0x50a5e2['offset']=qs[_0xb869('0x4e')](_0x5bc689[_0xb869('0x47')][_0xb869('0x4e')]);}return _0x4723d7[_0xb869('0xa1')](_0x50a5e2);}})[_0xb869('0x39')](function(_0x256c36){if(_0x256c36){return _0x256c36?{'count':_0x2ab1c8,'rows':_0x256c36}:null;}})[_0xb869('0x39')](respondWithResult(_0x5e91e0,null))[_0xb869('0x2f')](handleError(_0x5e91e0,null));}; \ No newline at end of file +var _0xfd0c=['limit','set','Content-Range','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','end','sendStatus','name','index','map','ChatQueue','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','count','includeAll','include','rows','show','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','Team','pick','getTeams','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','findAll','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','every','TeamId','all','union','value','ids','isEmpty','removeAgents','emit','addAgents','omit','spread','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.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','then','info','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','status','json','offset'];(function(_0x14c590,_0x235c7f){var _0x576a95=function(_0x293fa5){while(--_0x293fa5){_0x14c590['push'](_0x14c590['shift']());}};_0x576a95(++_0x235c7f);}(_0xfd0c,0x191));var _0xcfd0=function(_0x155413,_0x1c89b4){_0x155413=_0x155413-0x0;var _0x434c71=_0xfd0c[_0x155413];return _0x434c71;};'use strict';var pdf=require(_0xcfd0('0x0'));var emlformat=require(_0xcfd0('0x1'));var rimraf=require(_0xcfd0('0x2'));var zipdir=require(_0xcfd0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfd0('0x4'));var moment=require(_0xcfd0('0x5'));var BPromise=require(_0xcfd0('0x6'));var Mustache=require('mustache');var util=require(_0xcfd0('0x7'));var path=require(_0xcfd0('0x8'));var sox=require(_0xcfd0('0x9'));var csv=require(_0xcfd0('0xa'));var ejs=require(_0xcfd0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfd0('0xc'));var jsforce=require(_0xcfd0('0xd'));var deskjs=require(_0xcfd0('0xe'));var toCsv=require(_0xcfd0('0xa'));var querystring=require('querystring');var Papa=require(_0xcfd0('0xf'));var Redis=require('ioredis');var authService=require(_0xcfd0('0x10'));var qs=require(_0xcfd0('0x11'));var as=require(_0xcfd0('0x12'));var hardwareService=require(_0xcfd0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcfd0('0x14'));var config=require(_0xcfd0('0x15'));var db=require(_0xcfd0('0x16'))['db'];config[_0xcfd0('0x17')]=_[_0xcfd0('0x18')](config[_0xcfd0('0x17')],{'host':_0xcfd0('0x19'),'port':0x18eb});var socket=require(_0xcfd0('0x1a'))(new Redis(config[_0xcfd0('0x17')]));require(_0xcfd0('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xcfd0('0x1c')][_0xcfd0('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xac7ef3,_0x58c425,_0x1fae8f){if(_0x1fae8f){var _0x22fda5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22fda5['test'](_0x58c425)){return _0xac7ef3;}else{throw new db[(_0xcfd0('0x1e'))][(_0xcfd0('0x1f'))](_0xcfd0('0x20'));}}else{return _0xac7ef3;}}function respondWithRpcPromise(_0x171961,_0x537148,_0x395c2b,_0x7d5ab1){return new BPromise(function(_0x5d6a96,_0x402cff){var _0x4343e5=_0x7d5ab1||client;return _0x4343e5[_0xcfd0('0x21')](_0x171961,_0x395c2b)[_0xcfd0('0x22')](function(_0x11093b){logger[_0xcfd0('0x23')]('ChatQueue,\x20%s,\x20%s',_0x537148,_0xcfd0('0x24'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x537148,_0xcfd0('0x24'),JSON[_0xcfd0('0x25')](_0x11093b));if(_0x11093b[_0xcfd0('0x26')]){if(_0x11093b['error']['code']===0x1f4){logger[_0xcfd0('0x26')](_0xcfd0('0x27'),_0x537148,_0x11093b[_0xcfd0('0x26')][_0xcfd0('0x28')]);return _0x402cff(_0x11093b[_0xcfd0('0x26')][_0xcfd0('0x28')]);}logger[_0xcfd0('0x26')](_0xcfd0('0x27'),_0x537148,_0x11093b['error'][_0xcfd0('0x28')]);return _0x5d6a96(_0x11093b[_0xcfd0('0x26')][_0xcfd0('0x28')]);}else{logger[_0xcfd0('0x23')](_0xcfd0('0x27'),_0x537148,_0xcfd0('0x24'));_0x5d6a96(_0x11093b[_0xcfd0('0x29')][_0xcfd0('0x28')]);}})[_0xcfd0('0x2a')](function(_0x4b3d10){logger[_0xcfd0('0x26')](_0xcfd0('0x27'),_0x537148,_0x4b3d10);_0x402cff(_0x4b3d10);});});}function respondWithStatusCode(_0x550636,_0x2ae5fe){_0x2ae5fe=_0x2ae5fe||0xcc;return function(_0x3a3399){if(_0x3a3399){return _0x550636['sendStatus'](_0x2ae5fe);}return _0x550636['status'](_0x2ae5fe)['end']();};}function respondWithResult(_0x49e7ca,_0x2d94e8){_0x2d94e8=_0x2d94e8||0xc8;return function(_0x286234){if(_0x286234){return _0x49e7ca[_0xcfd0('0x2b')](_0x2d94e8)[_0xcfd0('0x2c')](_0x286234);}};}function respondWithFilteredResult(_0x4cc349,_0x2e4556){return function(_0x24e68f){if(_0x24e68f){var _0x257102=_0x24e68f['count'],_0x3ca0ca=_0x2e4556[_0xcfd0('0x2d')],_0x3f22a3=_0x2e4556[_0xcfd0('0x2d')]+_0x2e4556[_0xcfd0('0x2e')],_0x1fa350;if(_0x3f22a3>=_0x257102){_0x3f22a3=_0x257102;_0x1fa350=0xc8;}else{_0x1fa350=0xce;}_0x4cc349[_0xcfd0('0x2b')](_0x1fa350);return _0x4cc349[_0xcfd0('0x2f')](_0xcfd0('0x30'),_0x3ca0ca+'-'+_0x3f22a3+'/'+_0x257102)[_0xcfd0('0x2c')](_0x24e68f);}return null;};}function patchUpdates(_0x37a503){return function(_0x178d19){try{jsonpatch[_0xcfd0('0x31')](_0x178d19,_0x37a503,!![]);}catch(_0x445ff4){return BPromise[_0xcfd0('0x32')](_0x445ff4);}return _0x178d19[_0xcfd0('0x33')]();};}function saveUpdates(_0x1fead1,_0x32f72e){return function(_0x4b1e44){if(_0x4b1e44){return _0x4b1e44[_0xcfd0('0x34')](_0x1fead1)[_0xcfd0('0x22')](function(_0x2e7633){return _0x2e7633;});}return null;};}function removeEntity(_0x24c3b7,_0x5b9392){return function(_0x289900){if(_0x289900){return _0x289900['destroy']()['then'](function(){var _0x36ebd=_0x289900[_0xcfd0('0x35')]({'plain':!![]});var _0x49553a=_0xcfd0('0x36');return db[_0xcfd0('0x37')][_0xcfd0('0x38')]({'where':{'type':_0x49553a,'resourceId':_0x36ebd['id']}})['then'](function(){return _0x289900;});})[_0xcfd0('0x22')](function(){_0x24c3b7[_0xcfd0('0x2b')](0xcc)[_0xcfd0('0x39')]();});}};}function handleEntityNotFound(_0x5e1804,_0xf0a8c0){return function(_0xdf2edc){if(!_0xdf2edc){_0x5e1804[_0xcfd0('0x3a')](0x194);}return _0xdf2edc;};}function handleError(_0xb4bc5b,_0x1ad0ee){_0x1ad0ee=_0x1ad0ee||0x1f4;return function(_0x1f52aa){logger['error'](_0x1f52aa['stack']);if(_0x1f52aa[_0xcfd0('0x3b')]){delete _0x1f52aa[_0xcfd0('0x3b')];}_0xb4bc5b[_0xcfd0('0x2b')](_0x1ad0ee)['send'](_0x1f52aa);};}exports[_0xcfd0('0x3c')]=function(_0x5d39fe,_0x4213c5){var _0x2ed77a={},_0x42591c={},_0x3470ca={'count':0x0,'rows':[]};var _0x285baf=_[_0xcfd0('0x3d')](db[_0xcfd0('0x3e')]['rawAttributes'],function(_0x327b49){return{'name':_0x327b49[_0xcfd0('0x3f')],'type':_0x327b49[_0xcfd0('0x40')]['key']};});_0x42591c[_0xcfd0('0x41')]=_['map'](_0x285baf,_0xcfd0('0x3b'));_0x42591c['query']=_[_0xcfd0('0x42')](_0x5d39fe[_0xcfd0('0x43')]);_0x42591c[_0xcfd0('0x44')]=_[_0xcfd0('0x45')](_0x42591c[_0xcfd0('0x41')],_0x42591c[_0xcfd0('0x43')]);_0x2ed77a[_0xcfd0('0x46')]=_[_0xcfd0('0x45')](_0x42591c[_0xcfd0('0x41')],qs[_0xcfd0('0x47')](_0x5d39fe['query'][_0xcfd0('0x47')]));_0x2ed77a[_0xcfd0('0x46')]=_0x2ed77a[_0xcfd0('0x46')][_0xcfd0('0x48')]?_0x2ed77a[_0xcfd0('0x46')]:_0x42591c[_0xcfd0('0x41')];if(!_0x5d39fe['query'][_0xcfd0('0x49')]('nolimit')){_0x2ed77a[_0xcfd0('0x2e')]=qs[_0xcfd0('0x2e')](_0x5d39fe[_0xcfd0('0x43')][_0xcfd0('0x2e')]);_0x2ed77a['offset']=qs[_0xcfd0('0x2d')](_0x5d39fe[_0xcfd0('0x43')][_0xcfd0('0x2d')]);}_0x2ed77a[_0xcfd0('0x4a')]=qs[_0xcfd0('0x4b')](_0x5d39fe[_0xcfd0('0x43')]['sort']);_0x2ed77a[_0xcfd0('0x4c')]=qs[_0xcfd0('0x44')](_['pick'](_0x5d39fe[_0xcfd0('0x43')],_0x42591c['filters']),_0x285baf);if(_0x5d39fe[_0xcfd0('0x43')][_0xcfd0('0x4d')]){_0x2ed77a[_0xcfd0('0x4c')]=_[_0xcfd0('0x4e')](_0x2ed77a[_0xcfd0('0x4c')],{'$or':_['map'](_0x285baf,function(_0x2cf300){if(_0x2cf300[_0xcfd0('0x40')]!=='VIRTUAL'){var _0x57f28f={};_0x57f28f[_0x2cf300['name']]={'$like':'%'+_0x5d39fe[_0xcfd0('0x43')]['filter']+'%'};return _0x57f28f;}})});}_0x2ed77a=_['merge']({},_0x2ed77a,_0x5d39fe[_0xcfd0('0x4f')]);var _0x4bd49b={'where':_0x2ed77a[_0xcfd0('0x4c')]};return db[_0xcfd0('0x3e')][_0xcfd0('0x50')](_0x4bd49b)[_0xcfd0('0x22')](function(_0x36f050){_0x3470ca[_0xcfd0('0x50')]=_0x36f050;if(_0x5d39fe[_0xcfd0('0x43')][_0xcfd0('0x51')]){_0x2ed77a[_0xcfd0('0x52')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x2ed77a);})[_0xcfd0('0x22')](function(_0x330f3e){_0x3470ca[_0xcfd0('0x53')]=_0x330f3e;return _0x3470ca;})[_0xcfd0('0x22')](respondWithFilteredResult(_0x4213c5,_0x2ed77a))[_0xcfd0('0x2a')](handleError(_0x4213c5,null));};exports[_0xcfd0('0x54')]=function(_0x3b5ee7,_0x304283){var _0x42d18a={'raw':!![],'where':{'id':_0x3b5ee7['params']['id']}},_0x2680cf={};_0x2680cf[_0xcfd0('0x41')]=_[_0xcfd0('0x42')](db[_0xcfd0('0x3e')][_0xcfd0('0x55')]);_0x2680cf[_0xcfd0('0x43')]=_[_0xcfd0('0x42')](_0x3b5ee7[_0xcfd0('0x43')]);_0x2680cf[_0xcfd0('0x44')]=_['intersection'](_0x2680cf[_0xcfd0('0x41')],_0x2680cf[_0xcfd0('0x43')]);_0x42d18a[_0xcfd0('0x46')]=_['intersection'](_0x2680cf[_0xcfd0('0x41')],qs['fields'](_0x3b5ee7[_0xcfd0('0x43')]['fields']));_0x42d18a[_0xcfd0('0x46')]=_0x42d18a['attributes'][_0xcfd0('0x48')]?_0x42d18a[_0xcfd0('0x46')]:_0x2680cf[_0xcfd0('0x41')];if(_0x3b5ee7[_0xcfd0('0x43')][_0xcfd0('0x51')]){_0x42d18a[_0xcfd0('0x52')]=[{'all':!![]}];}_0x42d18a=_[_0xcfd0('0x4e')]({},_0x42d18a,_0x3b5ee7['options']);return db['ChatQueue'][_0xcfd0('0x56')](_0x42d18a)[_0xcfd0('0x22')](handleEntityNotFound(_0x304283,null))['then'](respondWithResult(_0x304283,null))['catch'](handleError(_0x304283,null));};exports['create']=function(_0x2a561d,_0x350372){return db[_0xcfd0('0x3e')][_0xcfd0('0x57')](_0x2a561d['body'],{})[_0xcfd0('0x22')](function(_0x15459d){var _0x14fdbb=_0x2a561d['user'][_0xcfd0('0x35')]({'plain':!![]});if(!_0x14fdbb)throw new Error(_0xcfd0('0x58'));if(_0x14fdbb['role']===_0xcfd0('0x59')){var _0x20e728=_0x15459d[_0xcfd0('0x35')]({'plain':!![]});var _0x3c1445=_0xcfd0('0x36');return db[_0xcfd0('0x5a')]['find']({'where':{'name':_0x3c1445,'userProfileId':_0x14fdbb[_0xcfd0('0x5b')]},'raw':!![]})[_0xcfd0('0x22')](function(_0x2bc9ae){if(_0x2bc9ae&&_0x2bc9ae['autoAssociation']===0x0){return db[_0xcfd0('0x37')][_0xcfd0('0x57')]({'name':_0x20e728['name'],'resourceId':_0x20e728['id'],'type':_0x2bc9ae[_0xcfd0('0x3b')],'sectionId':_0x2bc9ae['id']},{})['then'](function(){return _0x15459d;});}else{return _0x15459d;}})[_0xcfd0('0x2a')](function(_0x5c3b1d){logger[_0xcfd0('0x26')](_0xcfd0('0x5c'),_0x5c3b1d);throw _0x5c3b1d;});}return _0x15459d;})[_0xcfd0('0x22')](respondWithResult(_0x350372,0xc9))[_0xcfd0('0x2a')](handleError(_0x350372,null));};exports[_0xcfd0('0x34')]=function(_0x47e221,_0x12388d){if(_0x47e221[_0xcfd0('0x5d')]['id']){delete _0x47e221[_0xcfd0('0x5d')]['id'];}return db[_0xcfd0('0x3e')][_0xcfd0('0x56')]({'where':{'id':_0x47e221[_0xcfd0('0x5e')]['id']}})[_0xcfd0('0x22')](handleEntityNotFound(_0x12388d,null))[_0xcfd0('0x22')](saveUpdates(_0x47e221[_0xcfd0('0x5d')],null))['then'](respondWithResult(_0x12388d,null))[_0xcfd0('0x2a')](handleError(_0x12388d,null));};exports[_0xcfd0('0x38')]=function(_0x2e6814,_0x5e00c6){return db['ChatQueue'][_0xcfd0('0x56')]({'where':{'id':_0x2e6814[_0xcfd0('0x5e')]['id']}})[_0xcfd0('0x22')](handleEntityNotFound(_0x5e00c6,null))['then'](removeEntity(_0x5e00c6,null))['catch'](handleError(_0x5e00c6,null));};exports[_0xcfd0('0x5f')]=function(_0x5232f6,_0x512b66){return db[_0xcfd0('0x3e')]['describe']()['then'](respondWithResult(_0x512b66,null))['catch'](handleError(_0x512b66,null));};exports[_0xcfd0('0x60')]=function(_0x5e0299,_0x49f155,_0x4e53d4){var _0x569c98={'raw':!![],'where':{}},_0x2e06d1={},_0x17d54b;return db[_0xcfd0('0x3e')][_0xcfd0('0x61')]({'where':{'id':_0x5e0299['params']['id']}})['then'](handleEntityNotFound(_0x49f155,null))[_0xcfd0('0x22')](function(_0x1d338a){if(_0x1d338a){_0x17d54b=_0x1d338a[_0xcfd0('0x35')]({'plain':!![]});_0x2e06d1[_0xcfd0('0x41')]=_[_0xcfd0('0x42')](db['UserChatQueue'][_0xcfd0('0x55')]);_0x2e06d1['query']=_[_0xcfd0('0x42')](_0x5e0299['query']);_0x2e06d1[_0xcfd0('0x44')]=_[_0xcfd0('0x45')](_0x2e06d1['model'],_0x2e06d1['query']);_0x569c98[_0xcfd0('0x46')]=_[_0xcfd0('0x45')](_0x2e06d1[_0xcfd0('0x41')],qs[_0xcfd0('0x47')](_0x5e0299['query'][_0xcfd0('0x47')]));_0x569c98['attributes']=_0x569c98[_0xcfd0('0x46')]['length']?_0x569c98[_0xcfd0('0x46')]:_0x2e06d1[_0xcfd0('0x41')];if(!_0x5e0299['query']['hasOwnProperty']('nolimit')){_0x569c98[_0xcfd0('0x2e')]=qs[_0xcfd0('0x2e')](_0x5e0299[_0xcfd0('0x43')][_0xcfd0('0x2e')]);_0x569c98['offset']=qs[_0xcfd0('0x2d')](_0x5e0299[_0xcfd0('0x43')][_0xcfd0('0x2d')]);}_0x569c98['order']=qs[_0xcfd0('0x4b')](_0x5e0299[_0xcfd0('0x43')][_0xcfd0('0x4b')]);_0x569c98['where']=qs[_0xcfd0('0x44')](_['pick'](_0x5e0299['query'],_0x2e06d1[_0xcfd0('0x44')]));_0x569c98[_0xcfd0('0x4c')][_0xcfd0('0x62')]=_0x1d338a['id'];if(_0x5e0299[_0xcfd0('0x43')][_0xcfd0('0x4d')]){_0x569c98[_0xcfd0('0x4c')]=_['merge'](_0x569c98[_0xcfd0('0x4c')],{'$or':_[_0xcfd0('0x3d')](_0x569c98['attributes'],function(_0x3a2379){var _0x57bb74={};_0x57bb74[_0x3a2379]={'$like':'%'+_0x5e0299[_0xcfd0('0x43')][_0xcfd0('0x4d')]+'%'};return _0x57bb74;})});}_0x569c98=_[_0xcfd0('0x4e')]({},_0x569c98,_0x5e0299['options']);return db[_0xcfd0('0x63')]['findAll'](_0x569c98);}})[_0xcfd0('0x22')](function(_0x5c96f1){if(_0x5c96f1){return db[_0xcfd0('0x64')]['findAndCountAll']({'where':{'id':_[_0xcfd0('0x3d')](_0x5c96f1,_0xcfd0('0x65')),'role':_0xcfd0('0x66')},'attributes':['id',_0xcfd0('0x3b'),_0xcfd0('0x67'),_0xcfd0('0x68'),_0xcfd0('0x69')]});}})['then'](function(_0x40ad5e){if(_0x40ad5e){return{'count':_0x40ad5e[_0xcfd0('0x50')],'rows':_['map'](_0x40ad5e[_0xcfd0('0x53')],function(_0x5a5646){return{'membername':_0x5a5646['name'],'UserId':_0x5a5646['id'],'queue_name':_0x17d54b['name'],'ChatQueueId':_0x17d54b['id'],'interface':util['format'](_0xcfd0('0x6a'),_0xcfd0('0x6b'),_0x5a5646[_0xcfd0('0x3b')]),'penalty':0x0,'paused':_0x5a5646[_0xcfd0('0x67')],'createdAt':_0x5a5646['createdAt'],'updatedAt':_0x5a5646['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcfd0('0x22')](respondWithFilteredResult(_0x49f155,_0x569c98))['catch'](handleError(_0x49f155,null));};exports['getTeams']=function(_0xa30692,_0x52a426,_0x4f1085){var _0x5518f9={};var _0x3cc886={};var _0x3bb201;var _0x25f6ef;return db[_0xcfd0('0x3e')]['findOne']({'where':{'id':_0xa30692[_0xcfd0('0x5e')]['id']}})[_0xcfd0('0x22')](handleEntityNotFound(_0x52a426,null))[_0xcfd0('0x22')](function(_0xac5c81){if(_0xac5c81){_0x3bb201=_0xac5c81;_0x3cc886[_0xcfd0('0x41')]=_[_0xcfd0('0x42')](db[_0xcfd0('0x6c')]['rawAttributes']);_0x3cc886[_0xcfd0('0x43')]=_['keys'](_0xa30692[_0xcfd0('0x43')]);_0x3cc886[_0xcfd0('0x44')]=_['intersection'](_0x3cc886[_0xcfd0('0x41')],_0x3cc886['query']);_0x5518f9[_0xcfd0('0x46')]=_['intersection'](_0x3cc886[_0xcfd0('0x41')],qs[_0xcfd0('0x47')](_0xa30692[_0xcfd0('0x43')][_0xcfd0('0x47')]));_0x5518f9[_0xcfd0('0x46')]=_0x5518f9['attributes'][_0xcfd0('0x48')]?_0x5518f9[_0xcfd0('0x46')]:_0x3cc886[_0xcfd0('0x41')];_0x5518f9[_0xcfd0('0x4a')]=qs['sort'](_0xa30692[_0xcfd0('0x43')][_0xcfd0('0x4b')]);_0x5518f9[_0xcfd0('0x4c')]=qs['filters'](_[_0xcfd0('0x6d')](_0xa30692[_0xcfd0('0x43')],_0x3cc886[_0xcfd0('0x44')]));if(_0xa30692[_0xcfd0('0x43')]['filter']){_0x5518f9[_0xcfd0('0x4c')]=_['merge'](_0x5518f9['where'],{'$or':_['map'](_0x5518f9[_0xcfd0('0x46')],function(_0x47da7f){var _0x55d8aa={};_0x55d8aa[_0x47da7f]={'$like':'%'+_0xa30692[_0xcfd0('0x43')][_0xcfd0('0x4d')]+'%'};return _0x55d8aa;})});}_0x5518f9=_['merge']({},_0x5518f9,_0xa30692[_0xcfd0('0x4f')]);return _0x3bb201[_0xcfd0('0x6e')](_0x5518f9);}})[_0xcfd0('0x22')](function(_0x939e2d){if(_0x939e2d){_0x25f6ef=_0x939e2d[_0xcfd0('0x48')];if(!_0xa30692[_0xcfd0('0x43')][_0xcfd0('0x49')](_0xcfd0('0x6f'))){_0x5518f9['limit']=qs[_0xcfd0('0x2e')](_0xa30692[_0xcfd0('0x43')]['limit']);_0x5518f9[_0xcfd0('0x2d')]=qs['offset'](_0xa30692[_0xcfd0('0x43')][_0xcfd0('0x2d')]);}return _0x3bb201['getTeams'](_0x5518f9);}})[_0xcfd0('0x22')](function(_0x2637ca){if(_0x2637ca){return _0x2637ca?{'count':_0x25f6ef,'rows':_0x2637ca}:null;}})[_0xcfd0('0x22')](respondWithResult(_0x52a426,null))['catch'](handleError(_0x52a426,null));};exports[_0xcfd0('0x70')]=function(_0x1d829a,_0xcf6e70,_0x5bcdc6){var _0x3ead18=_0x1d829a[_0xcfd0('0x5d')]['ids'];return db[_0xcfd0('0x6c')]['findAll']({'where':{'id':_0x3ead18},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcfd0('0x71'),'attributes':['id',_0xcfd0('0x3b'),_0xcfd0('0x72'),_0xcfd0('0x73'),_0xcfd0('0x74')],'raw':!![]}]})['then'](function(_0x2936d4){if(_0x2936d4){var _0x524628=_[_0xcfd0('0x75')](_0x2936d4,function(_0x8b9308){var _0x329538=_0x8b9308['get']({'plain':!![]});return _0x329538['Agents'];});return db[_0xcfd0('0x3e')][_0xcfd0('0x56')]({'where':{'id':_0x1d829a[_0xcfd0('0x5e')]['id']}})[_0xcfd0('0x22')](function(_0x25368c){return db[_0xcfd0('0x76')][_0xcfd0('0x77')](function(_0x27b1ec){return _0x25368c[_0xcfd0('0x70')](_0x3ead18,{'transaction':_0x27b1ec})[_0xcfd0('0x22')](function(){return BPromise[_0xcfd0('0x78')](_0x524628,function(_0x4e731d){return db[_0xcfd0('0x63')][_0xcfd0('0x79')]({'where':{'UserId':_0x4e731d['id'],'ChatQueueId':_0x1d829a[_0xcfd0('0x5e')]['id']},'transaction':_0x27b1ec});});})[_0xcfd0('0x22')](function(){_0x524628[_0xcfd0('0x7a')](function(_0x485a00){socket['emit'](_0xcfd0('0x7b'),{'UserId':_0x485a00['id'],'ChatQueueId':_0x25368c['id']});});});});});}})[_0xcfd0('0x22')](respondWithStatusCode(_0xcf6e70,null))['catch'](handleError(_0xcf6e70,null));};exports[_0xcfd0('0x7c')]=function(_0xf6e386,_0x2def35,_0x23cba8){return db['Team'][_0xcfd0('0x7d')]({'where':{'id':_0xf6e386[_0xcfd0('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xcfd0('0x64')],'as':_0xcfd0('0x71'),'attributes':['id'],'raw':!![]}]})[_0xcfd0('0x22')](handleEntityNotFound(_0x2def35,null))[_0xcfd0('0x22')](function(_0x10f3d6){var _0x4d5a46=_[_0xcfd0('0x3d')](_0x10f3d6,'id');var _0x1f34d8=[];var _0x35e583=[];var _0x5f851=squel[_0xcfd0('0x7e')]();_0x5f851[_0xcfd0('0x7f')]('tq.TeamId')[_0xcfd0('0x80')](_0xcfd0('0x81'),'tq')[_0xcfd0('0x82')](_0xcfd0('0x83'),'ut',_0xcfd0('0x84'))[_0xcfd0('0x4c')](_0xcfd0('0x85'),_0xf6e386[_0xcfd0('0x5e')]['id']);for(var _0x1f2093=0x0;_0x1f2093<_0x10f3d6[_0xcfd0('0x48')];_0x1f2093+=0x1){let _0x30e777=_0x10f3d6[_0x1f2093];for(var _0x574abf=0x0;_0x574abf<_0x30e777[_0xcfd0('0x71')][_0xcfd0('0x48')];_0x574abf+=0x1){let _0xcf2b4e=_0x30e777[_0xcfd0('0x71')][_0x574abf];var _0x5296f3=_0x5f851[_0xcfd0('0x86')]();_0x5296f3[_0xcfd0('0x4c')]('ut.UserId\x20=\x20?',_0xcf2b4e['id']);_0x35e583['push'](db[_0xcfd0('0x76')][_0xcfd0('0x43')](_0x5296f3['toString'](),{'type':db[_0xcfd0('0x76')]['QueryTypes']['SELECT']})['then'](function(_0x43ad73){if(_0x43ad73['length']===0x1){return _0xcf2b4e['id'];}else{var _0x2cefd7=_[_0xcfd0('0x87')](_[_0xcfd0('0x3d')](_0x43ad73,_0xcfd0('0x88')),function(_0x6f158f){return _['includes'](_0x4d5a46,_0x6f158f);});if(_0x2cefd7){return _0xcf2b4e['id'];}}}));}}return BPromise[_0xcfd0('0x89')](_0x35e583)[_0xcfd0('0x22')](function(_0xacf3b1){_0x1f34d8=_(_0x1f34d8)[_0xcfd0('0x8a')](_0xacf3b1)['compact']()[_0xcfd0('0x8b')]();return db[_0xcfd0('0x3e')][_0xcfd0('0x56')]({'where':{'id':_0xf6e386[_0xcfd0('0x5e')]['id']}})['then'](function(_0x5d429b){return db['sequelize'][_0xcfd0('0x77')](function(_0x514a6a){return _0x5d429b['removeTeams'](_0xf6e386['query'][_0xcfd0('0x8c')],{'transaction':_0x514a6a})[_0xcfd0('0x22')](function(){if(!_[_0xcfd0('0x8d')](_0x1f34d8)){return _0x5d429b[_0xcfd0('0x8e')](_0x1f34d8,{'transaction':_0x514a6a});}})[_0xcfd0('0x22')](function(){_0x1f34d8[_0xcfd0('0x7a')](function(_0x2760c6){socket[_0xcfd0('0x8f')]('userChatQueue:remove',{'UserId':_0x2760c6,'ChatQueueId':_0x5d429b['id']});});});});});});})['then'](respondWithStatusCode(_0x2def35,null))['catch'](handleError(_0x2def35,null));};exports[_0xcfd0('0x90')]=function(_0x4355bf,_0x1dfefd,_0x169082){return db[_0xcfd0('0x3e')][_0xcfd0('0x56')]({'where':{'id':_0x4355bf['params']['id']}})[_0xcfd0('0x22')](handleEntityNotFound(_0x1dfefd,null))['then'](function(_0x144d70){if(_0x144d70){return _0x144d70[_0xcfd0('0x90')](_0x4355bf['body'][_0xcfd0('0x8c')],_[_0xcfd0('0x91')](_0x4355bf[_0xcfd0('0x5d')],[_0xcfd0('0x8c'),'id'])||{})[_0xcfd0('0x92')](function(_0x43b70d){for(var _0x388f8a=0x0;_0x388f8a<_0x4355bf[_0xcfd0('0x5d')][_0xcfd0('0x8c')][_0xcfd0('0x48')];_0x388f8a+=0x1){socket[_0xcfd0('0x8f')]('userChatQueue:save',{'UserId':_0x4355bf[_0xcfd0('0x5d')][_0xcfd0('0x8c')][_0x388f8a],'ChatQueueId':_0x4355bf[_0xcfd0('0x5e')]['id']});}return _0x43b70d;});}})['then'](respondWithResult(_0x1dfefd,null))[_0xcfd0('0x2a')](handleError(_0x1dfefd,null));};exports[_0xcfd0('0x8e')]=function(_0x15bf8b,_0x25feed,_0x4094f8){return db['ChatQueue']['find']({'where':{'id':_0x15bf8b[_0xcfd0('0x5e')]['id']}})[_0xcfd0('0x22')](handleEntityNotFound(_0x25feed,null))['then'](function(_0x12e62d){if(_0x12e62d){return _0x12e62d[_0xcfd0('0x8e')](_0x15bf8b['query'][_0xcfd0('0x8c')])[_0xcfd0('0x22')](function(){if(_['isArray'](_0x15bf8b[_0xcfd0('0x43')][_0xcfd0('0x8c')])){for(var _0x178e2c=0x0;_0x178e2c<_0x15bf8b[_0xcfd0('0x43')]['ids'][_0xcfd0('0x48')];_0x178e2c+=0x1){socket[_0xcfd0('0x8f')](_0xcfd0('0x93'),{'UserId':Number(_0x15bf8b[_0xcfd0('0x43')][_0xcfd0('0x8c')][_0x178e2c]),'ChatQueueId':Number(_0x15bf8b[_0xcfd0('0x5e')]['id'])});}}else{socket['emit'](_0xcfd0('0x93'),{'UserId':Number(_0x15bf8b['query'][_0xcfd0('0x8c')]),'ChatQueueId':Number(_0x15bf8b[_0xcfd0('0x5e')]['id'])});}});}})[_0xcfd0('0x22')](respondWithStatusCode(_0x25feed,null))[_0xcfd0('0x2a')](handleError(_0x25feed,null));};exports['getAgents']=function(_0x5ae846,_0x4e9b5f,_0x3f9571){var _0x453fa0={};var _0x4368ae={};var _0x28f9d4;var _0x345ce9;return db[_0xcfd0('0x3e')][_0xcfd0('0x61')]({'where':{'id':_0x5ae846[_0xcfd0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4e9b5f,null))[_0xcfd0('0x22')](function(_0x326043){if(_0x326043){_0x28f9d4=_0x326043;_0x4368ae[_0xcfd0('0x41')]=_[_0xcfd0('0x42')](db[_0xcfd0('0x64')]['rawAttributes']);_0x4368ae[_0xcfd0('0x43')]=_['keys'](_0x5ae846['query']);_0x4368ae['filters']=_[_0xcfd0('0x45')](_0x4368ae['model'],_0x4368ae[_0xcfd0('0x43')]);_0x453fa0[_0xcfd0('0x46')]=_[_0xcfd0('0x45')](_0x4368ae['model'],qs['fields'](_0x5ae846[_0xcfd0('0x43')][_0xcfd0('0x47')]));_0x453fa0['attributes']=_0x453fa0[_0xcfd0('0x46')][_0xcfd0('0x48')]?_0x453fa0[_0xcfd0('0x46')]:_0x4368ae[_0xcfd0('0x41')];_0x453fa0[_0xcfd0('0x4a')]=qs[_0xcfd0('0x4b')](_0x5ae846[_0xcfd0('0x43')][_0xcfd0('0x4b')]);_0x453fa0[_0xcfd0('0x4c')]=qs[_0xcfd0('0x44')](_['pick'](_0x5ae846[_0xcfd0('0x43')],_0x4368ae[_0xcfd0('0x44')]));if(_0x5ae846[_0xcfd0('0x43')][_0xcfd0('0x4d')]){_0x453fa0['where']=_[_0xcfd0('0x4e')](_0x453fa0['where'],{'$or':_[_0xcfd0('0x3d')](_0x453fa0[_0xcfd0('0x46')],function(_0x1c3545){var _0x5e7e02={};_0x5e7e02[_0x1c3545]={'$like':'%'+_0x5ae846[_0xcfd0('0x43')][_0xcfd0('0x4d')]+'%'};return _0x5e7e02;})});}_0x453fa0=_[_0xcfd0('0x4e')]({},_0x453fa0,_0x5ae846[_0xcfd0('0x4f')]);return _0x28f9d4['getAgents'](_0x453fa0);}})[_0xcfd0('0x22')](function(_0x388b74){if(_0x388b74){_0x345ce9=_0x388b74['length'];if(!_0x5ae846[_0xcfd0('0x43')][_0xcfd0('0x49')](_0xcfd0('0x6f'))){_0x453fa0[_0xcfd0('0x2e')]=qs[_0xcfd0('0x2e')](_0x5ae846['query'][_0xcfd0('0x2e')]);_0x453fa0['offset']=qs[_0xcfd0('0x2d')](_0x5ae846[_0xcfd0('0x43')][_0xcfd0('0x2d')]);}return _0x28f9d4[_0xcfd0('0x94')](_0x453fa0);}})[_0xcfd0('0x22')](function(_0x33dffa){if(_0x33dffa){return _0x33dffa?{'count':_0x345ce9,'rows':_0x33dffa}:null;}})[_0xcfd0('0x22')](respondWithResult(_0x4e9b5f,null))[_0xcfd0('0x2a')](handleError(_0x4e9b5f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8979493..df4ecb3 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(_0x412cc2,_0xe44da){var _0x918416=function(_0x544993){while(--_0x544993){_0x412cc2['push'](_0x412cc2['shift']());}};_0x918416(++_0xe44da);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0x0b0e[_0x3c4e4c];return _0x144a87;};'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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x2a5b26,_0x543526){var _0x6e7571=function(_0x5909fe){while(--_0x5909fe){_0x2a5b26['push'](_0x2a5b26['shift']());}};_0x6e7571(++_0x543526);}(_0xb10b,0x12a));var _0xbb10=function(_0x358fb5,_0x4407b8){_0x358fb5=_0x358fb5-0x0;var _0x4abfeb=_0xb10b[_0x358fb5];return _0x4abfeb;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 87d395c..9a8aaa3 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 _0x8be5=['bluebird','request-promise','./chatQueue.attributes','exports','chat_queues','lodash','util','../../config/logger','api'];(function(_0x2d1da0,_0x41f2e2){var _0x31f28f=function(_0x5862a6){while(--_0x5862a6){_0x2d1da0['push'](_0x2d1da0['shift']());}};_0x31f28f(++_0x41f2e2);}(_0x8be5,0xb0));var _0x58be=function(_0x1205da,_0x54284c){_0x1205da=_0x1205da-0x0;var _0x4118c5=_0x8be5[_0x1205da];return _0x4118c5;};'use strict';var _=require(_0x58be('0x0'));var util=require(_0x58be('0x1'));var logger=require(_0x58be('0x2'))(_0x58be('0x3'));var moment=require('moment');var BPromise=require(_0x58be('0x4'));var rp=require(_0x58be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x58be('0x6'));module[_0x58be('0x7')]=function(_0x16601a,_0x2e61f3){return _0x16601a['define']('ChatQueue',attributes,{'tableName':_0x58be('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c02=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1ec928,_0x58d34c){var _0x59b852=function(_0x43eeb8){while(--_0x43eeb8){_0x1ec928['push'](_0x1ec928['shift']());}};_0x59b852(++_0x58d34c);}(_0x6c02,0xc7));var _0x26c0=function(_0x5966a4,_0xf66daf){_0x5966a4=_0x5966a4-0x0;var _0x3e8c78=_0x6c02[_0x5966a4];return _0x3e8c78;};'use strict';var _=require(_0x26c0('0x0'));var util=require(_0x26c0('0x1'));var logger=require(_0x26c0('0x2'))(_0x26c0('0x3'));var moment=require(_0x26c0('0x4'));var BPromise=require(_0x26c0('0x5'));var rp=require(_0x26c0('0x6'));var fs=require('fs');var path=require(_0x26c0('0x7'));var rimraf=require('rimraf');var config=require(_0x26c0('0x8'));var attributes=require('./chatQueue.attributes');module[_0x26c0('0x9')]=function(_0x4b2c87,_0x3283b0){return _0x4b2c87[_0x26c0('0xa')](_0x26c0('0xb'),attributes,{'tableName':_0x26c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index fbd25fe..06c8020 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 _0x1f3c=['util','moment','bluebird','randomstring','jayson/promise','http','redis','localhost','./chatQueue.socket','register','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowChatQueue','find','lodash'];(function(_0x5f3248,_0x2c77d8){var _0x97be57=function(_0x171243){while(--_0x171243){_0x5f3248['push'](_0x5f3248['shift']());}};_0x97be57(++_0x2c77d8);}(_0x1f3c,0xd7));var _0xc1f3=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1f3c[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xc1f3('0x0'));var util=require(_0xc1f3('0x1'));var moment=require(_0xc1f3('0x2'));var BPromise=require(_0xc1f3('0x3'));var rs=require(_0xc1f3('0x4'));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('../../config/environment');var jayson=require(_0xc1f3('0x5'));var client=jayson['client'][_0xc1f3('0x6')]({'port':0x232a});config[_0xc1f3('0x7')]=_['defaults'](config[_0xc1f3('0x7')],{'host':_0xc1f3('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc1f3('0x7')]));require(_0xc1f3('0x9'))[_0xc1f3('0xa')](socket);function respondWithRpcPromise(_0xe3b20c,_0x1e74ca,_0x1b6a99){return new BPromise(function(_0x44045e,_0x3ddd2b){return client[_0xc1f3('0xb')](_0xe3b20c,_0x1b6a99)[_0xc1f3('0xc')](function(_0x25d6ff){logger[_0xc1f3('0xd')]('ChatQueue,\x20%s,\x20%s',_0x1e74ca,_0xc1f3('0xe'));logger['debug'](_0xc1f3('0xf'),_0x1e74ca,'request\x20sent',JSON[_0xc1f3('0x10')](_0x25d6ff));if(_0x25d6ff[_0xc1f3('0x11')]){if(_0x25d6ff[_0xc1f3('0x11')][_0xc1f3('0x12')]===0x1f4){logger[_0xc1f3('0x11')](_0xc1f3('0x13'),_0x1e74ca,_0x25d6ff[_0xc1f3('0x11')][_0xc1f3('0x14')]);return _0x3ddd2b(_0x25d6ff[_0xc1f3('0x11')][_0xc1f3('0x14')]);}logger[_0xc1f3('0x11')](_0xc1f3('0x13'),_0x1e74ca,_0x25d6ff[_0xc1f3('0x11')][_0xc1f3('0x14')]);return _0x44045e(_0x25d6ff[_0xc1f3('0x11')][_0xc1f3('0x14')]);}else{logger[_0xc1f3('0xd')](_0xc1f3('0x13'),_0x1e74ca,_0xc1f3('0xe'));_0x44045e(_0x25d6ff[_0xc1f3('0x15')][_0xc1f3('0x14')]);}})[_0xc1f3('0x16')](function(_0x1ab849){logger[_0xc1f3('0x11')](_0xc1f3('0x13'),_0x1e74ca,_0x1ab849);_0x3ddd2b(_0x1ab849);});});}exports[_0xc1f3('0x17')]=function(_0x47684e){var _0x2bdcdb=this;return new Promise(function(_0x2e1053,_0x769a5b){return db[_0xc1f3('0x18')][_0xc1f3('0x19')]({'raw':_0x47684e[_0xc1f3('0x1a')]?_0x47684e[_0xc1f3('0x1a')][_0xc1f3('0x1b')]===undefined?!![]:![]:!![],'where':_0x47684e['options']?_0x47684e[_0xc1f3('0x1a')][_0xc1f3('0x1c')]||null:null,'attributes':_0x47684e[_0xc1f3('0x1a')]?_0x47684e[_0xc1f3('0x1a')]['attributes']||null:null,'limit':_0x47684e['options']?_0x47684e['options'][_0xc1f3('0x1d')]||null:null,'include':_0x47684e[_0xc1f3('0x1a')]?_0x47684e['options']['include']?_[_0xc1f3('0x1e')](_0x47684e[_0xc1f3('0x1a')][_0xc1f3('0x1f')],function(_0x2cb794){return{'model':db[_0x2cb794[_0xc1f3('0x20')]],'as':_0x2cb794['as'],'attributes':_0x2cb794[_0xc1f3('0x21')],'include':_0x2cb794['include']?_[_0xc1f3('0x1e')](_0x2cb794['include'],function(_0x2cdb1d){return{'model':db[_0x2cdb1d['model']],'as':_0x2cdb1d['as'],'attributes':_0x2cdb1d[_0xc1f3('0x21')],'include':_0x2cdb1d[_0xc1f3('0x1f')]?_['map'](_0x2cdb1d[_0xc1f3('0x1f')],function(_0xa634b2){return{'model':db[_0xa634b2['model']],'as':_0xa634b2['as'],'attributes':_0xa634b2[_0xc1f3('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1f3('0xc')](function(_0x211f52){logger['info'](_0xc1f3('0x17'),_0x47684e);logger['debug']('GetChatQueue',_0x47684e,JSON[_0xc1f3('0x10')](_0x211f52));_0x2e1053(_0x211f52);})[_0xc1f3('0x16')](function(_0x498867){logger[_0xc1f3('0x11')](_0xc1f3('0x17'),_0x498867[_0xc1f3('0x14')],_0x47684e);_0x769a5b(_0x2bdcdb[_0xc1f3('0x11')](0x1f4,_0x498867[_0xc1f3('0x14')]));});});};exports[_0xc1f3('0x22')]=function(_0x5af5ff){var _0x1acb9=this;return new Promise(function(_0xe31b14,_0x3a682e){return db[_0xc1f3('0x18')][_0xc1f3('0x23')]({'raw':_0x5af5ff[_0xc1f3('0x1a')]?_0x5af5ff['options'][_0xc1f3('0x1b')]===undefined?!![]:![]:!![],'where':_0x5af5ff['options']?_0x5af5ff['options'][_0xc1f3('0x1c')]||null:null,'attributes':_0x5af5ff[_0xc1f3('0x1a')]?_0x5af5ff[_0xc1f3('0x1a')][_0xc1f3('0x21')]||null:null,'include':_0x5af5ff['options']?_0x5af5ff[_0xc1f3('0x1a')][_0xc1f3('0x1f')]?_[_0xc1f3('0x1e')](_0x5af5ff['options'][_0xc1f3('0x1f')],function(_0x4b2156){return{'model':db[_0x4b2156['model']],'as':_0x4b2156['as'],'attributes':_0x4b2156[_0xc1f3('0x21')],'include':_0x4b2156[_0xc1f3('0x1f')]?_[_0xc1f3('0x1e')](_0x4b2156[_0xc1f3('0x1f')],function(_0x5b8762){return{'model':db[_0x5b8762[_0xc1f3('0x20')]],'as':_0x5b8762['as'],'attributes':_0x5b8762[_0xc1f3('0x21')],'include':_0x5b8762['include']?_['map'](_0x5b8762[_0xc1f3('0x1f')],function(_0x28b29c){return{'model':db[_0x28b29c[_0xc1f3('0x20')]],'as':_0x28b29c['as'],'attributes':_0x28b29c[_0xc1f3('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1f3('0xc')](function(_0x365654){logger[_0xc1f3('0xd')](_0xc1f3('0x22'),_0x5af5ff);logger['debug'](_0xc1f3('0x22'),_0x5af5ff,JSON[_0xc1f3('0x10')](_0x365654));_0xe31b14(_0x365654);})[_0xc1f3('0x16')](function(_0x36d110){logger[_0xc1f3('0x11')]('ShowChatQueue',_0x36d110['message'],_0x5af5ff);_0x3a682e(_0x1acb9[_0xc1f3('0x11')](0x1f4,_0x36d110[_0xc1f3('0x14')]));});});}; \ No newline at end of file +var _0x0854=['code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','model','include','map','then','debug','ShowChatQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2766c5,_0x5631a4){var _0x274ead=function(_0x33d932){while(--_0x33d932){_0x2766c5['push'](_0x2766c5['shift']());}};_0x274ead(++_0x5631a4);}(_0x0854,0xd9));var _0x4085=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0854[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4085('0x0'));var util=require('util');var moment=require(_0x4085('0x1'));var BPromise=require(_0x4085('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4085('0x3'));var db=require(_0x4085('0x4'))['db'];var utils=require(_0x4085('0x5'));var logger=require(_0x4085('0x6'))('rpc');var config=require(_0x4085('0x7'));var jayson=require(_0x4085('0x8'));var client=jayson[_0x4085('0x9')][_0x4085('0xa')]({'port':0x232a});config[_0x4085('0xb')]=_[_0x4085('0xc')](config['redis'],{'host':_0x4085('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4085('0xe'))[_0x4085('0xf')](socket);function respondWithRpcPromise(_0x278993,_0x172119,_0x26b852){return new BPromise(function(_0x1d9ea8,_0x404fb4){return client[_0x4085('0x10')](_0x278993,_0x26b852)['then'](function(_0x253c38){logger[_0x4085('0x11')](_0x4085('0x12'),_0x172119,_0x4085('0x13'));logger['debug'](_0x4085('0x14'),_0x172119,_0x4085('0x13'),JSON[_0x4085('0x15')](_0x253c38));if(_0x253c38[_0x4085('0x16')]){if(_0x253c38['error'][_0x4085('0x17')]===0x1f4){logger[_0x4085('0x16')](_0x4085('0x12'),_0x172119,_0x253c38[_0x4085('0x16')]['message']);return _0x404fb4(_0x253c38[_0x4085('0x16')][_0x4085('0x18')]);}logger[_0x4085('0x16')]('ChatQueue,\x20%s,\x20%s',_0x172119,_0x253c38[_0x4085('0x16')][_0x4085('0x18')]);return _0x1d9ea8(_0x253c38[_0x4085('0x16')][_0x4085('0x18')]);}else{logger[_0x4085('0x11')](_0x4085('0x12'),_0x172119,_0x4085('0x13'));_0x1d9ea8(_0x253c38[_0x4085('0x19')][_0x4085('0x18')]);}})['catch'](function(_0x3b4602){logger[_0x4085('0x16')](_0x4085('0x12'),_0x172119,_0x3b4602);_0x404fb4(_0x3b4602);});});}exports[_0x4085('0x1a')]=function(_0x489afb){var _0x269edf=this;return new Promise(function(_0x451d1e,_0x246b75){return db[_0x4085('0x1b')][_0x4085('0x1c')]({'raw':_0x489afb[_0x4085('0x1d')]?_0x489afb['options'][_0x4085('0x1e')]===undefined?!![]:![]:!![],'where':_0x489afb['options']?_0x489afb['options'][_0x4085('0x1f')]||null:null,'attributes':_0x489afb['options']?_0x489afb[_0x4085('0x1d')][_0x4085('0x20')]||null:null,'limit':_0x489afb[_0x4085('0x1d')]?_0x489afb[_0x4085('0x1d')]['limit']||null:null,'include':_0x489afb['options']?_0x489afb[_0x4085('0x1d')]['include']?_['map'](_0x489afb[_0x4085('0x1d')]['include'],function(_0x40347f){return{'model':db[_0x40347f[_0x4085('0x21')]],'as':_0x40347f['as'],'attributes':_0x40347f[_0x4085('0x20')],'include':_0x40347f[_0x4085('0x22')]?_[_0x4085('0x23')](_0x40347f['include'],function(_0x786560){return{'model':db[_0x786560[_0x4085('0x21')]],'as':_0x786560['as'],'attributes':_0x786560[_0x4085('0x20')],'include':_0x786560[_0x4085('0x22')]?_['map'](_0x786560[_0x4085('0x22')],function(_0x58dfd8){return{'model':db[_0x58dfd8[_0x4085('0x21')]],'as':_0x58dfd8['as'],'attributes':_0x58dfd8[_0x4085('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4085('0x24')](function(_0x2e285b){logger[_0x4085('0x11')](_0x4085('0x1a'),_0x489afb);logger[_0x4085('0x25')](_0x4085('0x1a'),_0x489afb,JSON['stringify'](_0x2e285b));_0x451d1e(_0x2e285b);})['catch'](function(_0x34331e){logger['error'](_0x4085('0x1a'),_0x34331e[_0x4085('0x18')],_0x489afb);_0x246b75(_0x269edf[_0x4085('0x16')](0x1f4,_0x34331e[_0x4085('0x18')]));});});};exports[_0x4085('0x26')]=function(_0x5304b8){var _0x221235=this;return new Promise(function(_0x2388dc,_0x4d89f7){return db[_0x4085('0x1b')][_0x4085('0x27')]({'raw':_0x5304b8[_0x4085('0x1d')]?_0x5304b8[_0x4085('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5304b8[_0x4085('0x1d')]?_0x5304b8[_0x4085('0x1d')][_0x4085('0x1f')]||null:null,'attributes':_0x5304b8['options']?_0x5304b8[_0x4085('0x1d')][_0x4085('0x20')]||null:null,'include':_0x5304b8[_0x4085('0x1d')]?_0x5304b8[_0x4085('0x1d')]['include']?_['map'](_0x5304b8[_0x4085('0x1d')][_0x4085('0x22')],function(_0x9b2112){return{'model':db[_0x9b2112[_0x4085('0x21')]],'as':_0x9b2112['as'],'attributes':_0x9b2112[_0x4085('0x20')],'include':_0x9b2112[_0x4085('0x22')]?_[_0x4085('0x23')](_0x9b2112[_0x4085('0x22')],function(_0x1ff295){return{'model':db[_0x1ff295['model']],'as':_0x1ff295['as'],'attributes':_0x1ff295[_0x4085('0x20')],'include':_0x1ff295[_0x4085('0x22')]?_[_0x4085('0x23')](_0x1ff295[_0x4085('0x22')],function(_0x8a6952){return{'model':db[_0x8a6952['model']],'as':_0x8a6952['as'],'attributes':_0x8a6952['attributes']};}):[]};}):[]};}):[]:[]})[_0x4085('0x24')](function(_0x3e68b4){logger[_0x4085('0x11')](_0x4085('0x26'),_0x5304b8);logger[_0x4085('0x25')](_0x4085('0x26'),_0x5304b8,JSON[_0x4085('0x15')](_0x3e68b4));_0x2388dc(_0x3e68b4);})['catch'](function(_0x18f542){logger[_0x4085('0x16')](_0x4085('0x26'),_0x18f542[_0x4085('0x18')],_0x5304b8);_0x4d89f7(_0x221235['error'](0x1f4,_0x18f542[_0x4085('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 58df65c..ce72b11 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(_0xec9262,_0x3e62bd){var _0x19aeff=function(_0x39c18a){while(--_0x39c18a){_0xec9262['push'](_0xec9262['shift']());}};_0x19aeff(++_0x3e62bd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x574ea5,_0x29fa13){_0x574ea5=_0x574ea5-0x0;var _0x150de8=_0x5f2f[_0x574ea5];return _0x150de8;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x137a70,_0x2fe7ae){var _0x5a5d38=function(_0x396eed){while(--_0x396eed){_0x137a70['push'](_0x137a70['shift']());}};_0x5a5d38(++_0x2fe7ae);}(_0x0b0e,0x187));var _0xe0b0=function(_0x102243,_0x2b4dde){_0x102243=_0x102243-0x0;var _0x1d302c=_0x0b0e[_0x102243];return _0x1d302c;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1b429d5..5ff0aac 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 _0x672f=['../../components/auth/service','../../components/interaction/service','./chatQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express'];(function(_0x46a60f,_0x1bec56){var _0x216028=function(_0x336f76){while(--_0x336f76){_0x46a60f['push'](_0x46a60f['shift']());}};_0x216028(++_0x1bec56);}(_0x672f,0xef));var _0xf672=function(_0x5e4375,_0x756e2b){_0x5e4375=_0x5e4375-0x0;var _0x4bd4cd=_0x672f[_0x5e4375];return _0x4bd4cd;};'use strict';var multer=require(_0xf672('0x0'));var util=require(_0xf672('0x1'));var path=require(_0xf672('0x2'));var timeout=require('connect-timeout');var express=require(_0xf672('0x3'));var router=express['Router']();var auth=require(_0xf672('0x4'));var interaction=require(_0xf672('0x5'));var config=require('../../config/environment');var controller=require(_0xf672('0x6'));router['get']('/',auth[_0xf672('0x7')](),controller['index']);router[_0xf672('0x8')](_0xf672('0x9'),auth[_0xf672('0x7')](),controller[_0xf672('0xa')]);router[_0xf672('0x8')](_0xf672('0xb'),auth[_0xf672('0x7')](),controller[_0xf672('0xc')]);router['get'](_0xf672('0xd'),auth[_0xf672('0x7')](),controller[_0xf672('0xe')]);router[_0xf672('0x8')](_0xf672('0xf'),auth[_0xf672('0x7')](),controller['getTeams']);router['get'](_0xf672('0x10'),auth[_0xf672('0x7')](),controller[_0xf672('0x11')]);router['post']('/',auth[_0xf672('0x7')](),controller['create']);router[_0xf672('0x12')](_0xf672('0xf'),auth[_0xf672('0x7')](),controller[_0xf672('0x13')]);router[_0xf672('0x12')]('/:id/users',auth[_0xf672('0x7')](),controller[_0xf672('0x14')]);router['put'](_0xf672('0xb'),auth[_0xf672('0x7')](),controller[_0xf672('0x15')]);router[_0xf672('0x16')](_0xf672('0xb'),auth['isAuthenticated'](),controller[_0xf672('0x17')]);router[_0xf672('0x16')](_0xf672('0xf'),auth['isAuthenticated'](),controller[_0xf672('0x18')]);router[_0xf672('0x16')]('/:id/users',auth[_0xf672('0x7')](),controller[_0xf672('0x19')]);module[_0xf672('0x1a')]=router; \ No newline at end of file +var _0x7ce5=['isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','removeAgents','util','connect-timeout','Router','../../components/auth/service','./chatQueue.controller','get'];(function(_0x3d4da8,_0x4cd148){var _0x4760e2=function(_0x4695e7){while(--_0x4695e7){_0x3d4da8['push'](_0x3d4da8['shift']());}};_0x4760e2(++_0x4cd148);}(_0x7ce5,0xd2));var _0x57ce=function(_0x5b287d,_0x5f5bbf){_0x5b287d=_0x5b287d-0x0;var _0x3bce9e=_0x7ce5[_0x5b287d];return _0x3bce9e;};'use strict';var multer=require('multer');var util=require(_0x57ce('0x0'));var path=require('path');var timeout=require(_0x57ce('0x1'));var express=require('express');var router=express[_0x57ce('0x2')]();var auth=require(_0x57ce('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x57ce('0x4'));router[_0x57ce('0x5')]('/',auth[_0x57ce('0x6')](),controller[_0x57ce('0x7')]);router[_0x57ce('0x5')](_0x57ce('0x8'),auth[_0x57ce('0x6')](),controller['describe']);router[_0x57ce('0x5')](_0x57ce('0x9'),auth['isAuthenticated'](),controller[_0x57ce('0xa')]);router[_0x57ce('0x5')](_0x57ce('0xb'),auth[_0x57ce('0x6')](),controller[_0x57ce('0xc')]);router[_0x57ce('0x5')]('/:id/teams',auth[_0x57ce('0x6')](),controller[_0x57ce('0xd')]);router[_0x57ce('0x5')](_0x57ce('0xe'),auth[_0x57ce('0x6')](),controller[_0x57ce('0xf')]);router[_0x57ce('0x10')]('/',auth[_0x57ce('0x6')](),controller[_0x57ce('0x11')]);router[_0x57ce('0x10')](_0x57ce('0x12'),auth[_0x57ce('0x6')](),controller[_0x57ce('0x13')]);router[_0x57ce('0x10')](_0x57ce('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0x57ce('0x14')](_0x57ce('0x9'),auth[_0x57ce('0x6')](),controller[_0x57ce('0x15')]);router[_0x57ce('0x16')](_0x57ce('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x57ce('0x16')](_0x57ce('0x12'),auth[_0x57ce('0x6')](),controller['removeTeams']);router[_0x57ce('0x16')](_0x57ce('0xe'),auth[_0x57ce('0x6')](),controller[_0x57ce('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cd01fd5..68ed457 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 _0x0131=['sequelize','exports','STRING','DATE','moment'];(function(_0x2c3483,_0x22f134){var _0x4e945f=function(_0x5a1575){while(--_0x5a1575){_0x2c3483['push'](_0x2c3483['shift']());}};_0x4e945f(++_0x22f134);}(_0x0131,0x1d5));var _0x1013=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0x0131[_0x4b4277];return _0x1ff405;};'use strict';var moment=require(_0x1013('0x0'));var Sequelize=require(_0x1013('0x1'));module[_0x1013('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1013('0x3')]},'joinAt':{'type':Sequelize[_0x1013('0x4')]},'leaveAt':{'type':Sequelize[_0x1013('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1013('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2d9a=['STRING','DATE','moment','sequelize','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2d9a,0x101));var _0xa2d9=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x2d9a[_0x2f8530];return _0x5e814e;};'use strict';var moment=require(_0xa2d9('0x0'));var Sequelize=require(_0xa2d9('0x1'));module[_0xa2d9('0x2')]={'uniqueid':{'type':Sequelize[_0xa2d9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa2d9('0x4')]},'leaveAt':{'type':Sequelize[_0xa2d9('0x4')]},'acceptAt':{'type':Sequelize[_0xa2d9('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa2d9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c5f3f5a..9a85fe3 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 _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2404d1,_0x24100a){var _0x16054b=function(_0x204125){while(--_0x204125){_0x2404d1['push'](_0x2404d1['shift']());}};_0x16054b(++_0x24100a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['ChatQueueReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['ChatQueueReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file +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','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x286538,_0xa98594){var _0x4b71d7=function(_0x4eac58){while(--_0x4eac58){_0x286538['push'](_0x286538['shift']());}};_0x4b71d7(++_0xa98594);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xcb91[_0x2f3794];return _0x1c9fbe;};'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['ChatQueueReport'][_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['ChatQueueReport'][_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['ChatQueueReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2a5367b..38aafac 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 _0xb326=['./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x159bdc,_0x2205d8){var _0x26f3f5=function(_0x14807d){while(--_0x14807d){_0x159bdc['push'](_0x159bdc['shift']());}};_0x26f3f5(++_0x2205d8);}(_0xb326,0x179));var _0x6b32=function(_0x15628d,_0x2bfe10){_0x15628d=_0x15628d-0x0;var _0x53c03b=_0xb326[_0x15628d];return _0x53c03b;};'use strict';var _=require('lodash');var util=require(_0x6b32('0x0'));var logger=require(_0x6b32('0x1'))(_0x6b32('0x2'));var moment=require('moment');var BPromise=require(_0x6b32('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b32('0x4'));var rimraf=require(_0x6b32('0x5'));var config=require(_0x6b32('0x6'));var attributes=require(_0x6b32('0x7'));module[_0x6b32('0x8')]=function(_0x45b969,_0x53e0a3){return _0x45b969[_0x6b32('0x9')]('ChatQueueReport',attributes,{'tableName':_0x6b32('0xa'),'paranoid':![],'indexes':[{'name':_0x6b32('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5898=['rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0x5898,0x1ba));var _0x8589=function(_0x4402b6,_0x2c8543){_0x4402b6=_0x4402b6-0x0;var _0x1c9a9b=_0x5898[_0x4402b6];return _0x1c9a9b;};'use strict';var _=require(_0x8589('0x0'));var util=require(_0x8589('0x1'));var logger=require(_0x8589('0x2'))(_0x8589('0x3'));var moment=require(_0x8589('0x4'));var BPromise=require(_0x8589('0x5'));var rp=require(_0x8589('0x6'));var fs=require('fs');var path=require(_0x8589('0x7'));var rimraf=require(_0x8589('0x8'));var config=require(_0x8589('0x9'));var attributes=require(_0x8589('0xa'));module[_0x8589('0xb')]=function(_0x1504f8,_0x15d89b){return _0x1504f8[_0x8589('0xc')](_0x8589('0xd'),attributes,{'tableName':_0x8589('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','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 7896650..4e8b199 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 _0x43c8=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateChatQueueReport','body','options','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','moment','bluebird','randomstring'];(function(_0x247a35,_0x5f2679){var _0x3a49c7=function(_0x1354cc){while(--_0x1354cc){_0x247a35['push'](_0x247a35['shift']());}};_0x3a49c7(++_0x5f2679);}(_0x43c8,0x147));var _0x843c=function(_0x39b8e8,_0x279bbf){_0x39b8e8=_0x39b8e8-0x0;var _0x517917=_0x43c8[_0x39b8e8];return _0x517917;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x843c('0x0'));var BPromise=require(_0x843c('0x1'));var rs=require(_0x843c('0x2'));var fs=require('fs');var Redis=require(_0x843c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x843c('0x4'))(_0x843c('0x5'));var config=require(_0x843c('0x6'));var jayson=require(_0x843c('0x7'));var client=jayson[_0x843c('0x8')][_0x843c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x213e6c,_0x3ce5da,_0x24cdea){return new BPromise(function(_0x2ae7cb,_0x438f7e){return client[_0x843c('0xa')](_0x213e6c,_0x24cdea)[_0x843c('0xb')](function(_0x2c0333){logger[_0x843c('0xc')](_0x843c('0xd'),_0x3ce5da,_0x843c('0xe'));logger[_0x843c('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3ce5da,_0x843c('0xe'),JSON[_0x843c('0x10')](_0x2c0333));if(_0x2c0333[_0x843c('0x11')]){if(_0x2c0333['error'][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xd'),_0x3ce5da,_0x2c0333[_0x843c('0x11')][_0x843c('0x13')]);return _0x438f7e(_0x2c0333[_0x843c('0x11')][_0x843c('0x13')]);}logger['error'](_0x843c('0xd'),_0x3ce5da,_0x2c0333[_0x843c('0x11')]['message']);return _0x2ae7cb(_0x2c0333[_0x843c('0x11')]['message']);}else{logger[_0x843c('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x3ce5da,'request\x20sent');_0x2ae7cb(_0x2c0333['result'][_0x843c('0x13')]);}})[_0x843c('0x14')](function(_0x561e32){logger[_0x843c('0x11')](_0x843c('0xd'),_0x3ce5da,_0x561e32);_0x438f7e(_0x561e32);});});}exports[_0x843c('0x15')]=function(_0x1a014a){var _0xf0be4c=this;return new Promise(function(_0x2b711b,_0x15fb01){return db['ChatQueueReport']['create'](_0x1a014a[_0x843c('0x16')],{'raw':_0x1a014a[_0x843c('0x17')]?_0x1a014a[_0x843c('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x843c('0xb')](function(_0x15cf22){logger[_0x843c('0xc')]('CreateChatQueueReport',_0x1a014a);logger[_0x843c('0xf')](_0x843c('0x15'),_0x1a014a,JSON[_0x843c('0x10')](_0x15cf22));_0x2b711b(_0x15cf22);})['catch'](function(_0x161ed9){logger[_0x843c('0x11')](_0x843c('0x15'),_0x161ed9['message'],_0x1a014a);_0x15fb01(_0xf0be4c['error'](0x1f4,_0x161ed9[_0x843c('0x13')]));});});};exports[_0x843c('0x18')]=function(_0x49283e){var _0x459f15=this;return new Promise(function(_0x3b1387,_0x4912b7){return db[_0x843c('0x19')][_0x843c('0x1a')](_0x49283e[_0x843c('0x16')],{'raw':_0x49283e[_0x843c('0x17')]?_0x49283e[_0x843c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49283e[_0x843c('0x17')]?_0x49283e[_0x843c('0x17')][_0x843c('0x1b')]||null:null,'attributes':_0x49283e[_0x843c('0x17')]?_0x49283e[_0x843c('0x17')][_0x843c('0x1c')]||null:null,'limit':_0x49283e[_0x843c('0x17')]?_0x49283e[_0x843c('0x17')][_0x843c('0x1d')]||null:null})[_0x843c('0xb')](function(_0x3b2f92){logger['info'](_0x843c('0x18'),_0x49283e);logger['debug'](_0x843c('0x18'),_0x49283e,JSON[_0x843c('0x10')](_0x3b2f92));_0x3b1387(_0x3b2f92);})[_0x843c('0x14')](function(_0x51f555){logger['error'](_0x843c('0x18'),_0x51f555['message'],_0x49283e);_0x4912b7(_0x459f15[_0x843c('0x11')](0x1f4,_0x51f555[_0x843c('0x13')]));});});}; \ No newline at end of file +var _0xf568=['then','debug','stringify','catch','UpdateChatQueueReport','body','where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','CreateChatQueueReport','ChatQueueReport','create','options','raw'];(function(_0x48f8ad,_0x1c9185){var _0x40747e=function(_0x4dbbbf){while(--_0x4dbbbf){_0x48f8ad['push'](_0x48f8ad['shift']());}};_0x40747e(++_0x1c9185);}(_0xf568,0x12a));var _0x8f56=function(_0x1611c5,_0x407403){_0x1611c5=_0x1611c5-0x0;var _0x43172c=_0xf568[_0x1611c5];return _0x43172c;};'use strict';var _=require(_0x8f56('0x0'));var util=require('util');var moment=require(_0x8f56('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f56('0x2'));var fs=require('fs');var Redis=require(_0x8f56('0x3'));var db=require(_0x8f56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f56('0x5'))('rpc');var config=require(_0x8f56('0x6'));var jayson=require(_0x8f56('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x199b07,_0x1a0520,_0x3ff5b4){return new BPromise(function(_0x100dc2,_0x158e6b){return client['request'](_0x199b07,_0x3ff5b4)['then'](function(_0xd1b0ea){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1a0520,'request\x20sent');logger['debug'](_0x8f56('0x8'),_0x1a0520,_0x8f56('0x9'),JSON['stringify'](_0xd1b0ea));if(_0xd1b0ea[_0x8f56('0xa')]){if(_0xd1b0ea['error'][_0x8f56('0xb')]===0x1f4){logger[_0x8f56('0xa')](_0x8f56('0xc'),_0x1a0520,_0xd1b0ea[_0x8f56('0xa')]['message']);return _0x158e6b(_0xd1b0ea[_0x8f56('0xa')][_0x8f56('0xd')]);}logger[_0x8f56('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x1a0520,_0xd1b0ea[_0x8f56('0xa')][_0x8f56('0xd')]);return _0x100dc2(_0xd1b0ea[_0x8f56('0xa')]['message']);}else{logger[_0x8f56('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x1a0520,_0x8f56('0x9'));_0x100dc2(_0xd1b0ea[_0x8f56('0xf')][_0x8f56('0xd')]);}})['catch'](function(_0x15f8ba){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1a0520,_0x15f8ba);_0x158e6b(_0x15f8ba);});});}exports[_0x8f56('0x10')]=function(_0x1a6457){var _0x4b3f50=this;return new Promise(function(_0x26d4d0,_0x359d07){return db[_0x8f56('0x11')][_0x8f56('0x12')](_0x1a6457['body'],{'raw':_0x1a6457[_0x8f56('0x13')]?_0x1a6457[_0x8f56('0x13')][_0x8f56('0x14')]===undefined?!![]:![]:!![]})[_0x8f56('0x15')](function(_0x31803e){logger['info']('CreateChatQueueReport',_0x1a6457);logger[_0x8f56('0x16')]('CreateChatQueueReport',_0x1a6457,JSON[_0x8f56('0x17')](_0x31803e));_0x26d4d0(_0x31803e);})[_0x8f56('0x18')](function(_0x50a6c1){logger[_0x8f56('0xa')](_0x8f56('0x10'),_0x50a6c1[_0x8f56('0xd')],_0x1a6457);_0x359d07(_0x4b3f50[_0x8f56('0xa')](0x1f4,_0x50a6c1[_0x8f56('0xd')]));});});};exports[_0x8f56('0x19')]=function(_0x118125){var _0x5639bb=this;return new Promise(function(_0x4b9d86,_0x1adc8a){return db[_0x8f56('0x11')]['update'](_0x118125[_0x8f56('0x1a')],{'raw':_0x118125[_0x8f56('0x13')]?_0x118125[_0x8f56('0x13')][_0x8f56('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x118125[_0x8f56('0x13')]?_0x118125[_0x8f56('0x13')][_0x8f56('0x1b')]||null:null,'attributes':_0x118125[_0x8f56('0x13')]?_0x118125[_0x8f56('0x13')][_0x8f56('0x1c')]||null:null,'limit':_0x118125[_0x8f56('0x13')]?_0x118125['options']['limit']||null:null})[_0x8f56('0x15')](function(_0xd824a8){logger['info'](_0x8f56('0x19'),_0x118125);logger[_0x8f56('0x16')](_0x8f56('0x19'),_0x118125,JSON[_0x8f56('0x17')](_0xd824a8));_0x4b9d86(_0xd824a8);})[_0x8f56('0x18')](function(_0x2e987f){logger[_0x8f56('0xa')]('UpdateChatQueueReport',_0x2e987f['message'],_0x118125);_0x1adc8a(_0x5639bb['error'](0x1f4,_0x2e987f[_0x8f56('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a12aec7..05c31f8 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 _0x19dc=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x19dc,0x12e));var _0xc19d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc19d('0x0'));var util=require(_0xc19d('0x1'));var path=require(_0xc19d('0x2'));var timeout=require(_0xc19d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc19d('0x4'));var interaction=require(_0xc19d('0x5'));var config=require(_0xc19d('0x6'));var controller=require(_0xc19d('0x7'));router['get']('/',auth[_0xc19d('0x8')](),controller['index']);router[_0xc19d('0x9')](_0xc19d('0xa'),auth['isAuthenticated'](),controller[_0xc19d('0xb')]);router[_0xc19d('0x9')](_0xc19d('0xc'),auth[_0xc19d('0x8')](),controller[_0xc19d('0xd')]);router[_0xc19d('0xe')]('/',auth[_0xc19d('0x8')](),controller[_0xc19d('0xf')]);router[_0xc19d('0x10')](_0xc19d('0xc'),auth[_0xc19d('0x8')](),controller[_0xc19d('0x11')]);router[_0xc19d('0x12')]('/:id',auth[_0xc19d('0x8')](),controller[_0xc19d('0x13')]);module[_0xc19d('0x14')]=router; \ No newline at end of file +var _0x580e=['describe','/:id','show','create','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x34f4c3,_0x367385){var _0x177da7=function(_0xd1540b){while(--_0xd1540b){_0x34f4c3['push'](_0x34f4c3['shift']());}};_0x177da7(++_0x367385);}(_0x580e,0x7e));var _0xe580=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x580e[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xe580('0x0'));var util=require('util');var path=require(_0xe580('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe580('0x2')]();var auth=require(_0xe580('0x3'));var interaction=require(_0xe580('0x4'));var config=require('../../config/environment');var controller=require(_0xe580('0x5'));router[_0xe580('0x6')]('/',auth[_0xe580('0x7')](),controller[_0xe580('0x8')]);router[_0xe580('0x6')](_0xe580('0x9'),auth[_0xe580('0x7')](),controller[_0xe580('0xa')]);router['get'](_0xe580('0xb'),auth[_0xe580('0x7')](),controller[_0xe580('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe580('0xd')]);router['put']('/:id',auth[_0xe580('0x7')](),controller[_0xe580('0xe')]);router[_0xe580('0xf')](_0xe580('0xb'),auth[_0xe580('0x7')](),controller['destroy']);module[_0xe580('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 60fa7b8..931e3eb 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 _0x7bcb=['STRING','account','agent','DATE','moment','exports'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x7bcb,0x1b4));var _0xb7bc=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0x7bcb[_0x260b48];return _0x3f730b;};'use strict';var moment=require(_0xb7bc('0x0'));var Sequelize=require('sequelize');module[_0xb7bc('0x1')]={'uniqueid':{'type':Sequelize[_0xb7bc('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb7bc('0x3'),_0xb7bc('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb7bc('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf488=['ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4b9b37,_0x18ac1d){var _0x56089d=function(_0x2baca2){while(--_0x2baca2){_0x4b9b37['push'](_0x4b9b37['shift']());}};_0x56089d(++_0x18ac1d);}(_0xf488,0x1e6));var _0x8f48=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xf488[_0x243217];return _0x478029;};'use strict';var moment=require(_0x8f48('0x0'));var Sequelize=require(_0x8f48('0x1'));module[_0x8f48('0x2')]={'uniqueid':{'type':Sequelize[_0x8f48('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8f48('0x4')](_0x8f48('0x5'),_0x8f48('0x6'),_0x8f48('0x7')),'allowNull':![],'defaultValue':_0x8f48('0x7')},'transferredAt':{'type':Sequelize[_0x8f48('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x8f48('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 29f8070..eb81b76 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 _0x4361=['sox','to-csv','ejs','lodash','squel','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','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','type','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x554758,_0x288416){var _0x411a30=function(_0x45dc0d){while(--_0x45dc0d){_0x554758['push'](_0x554758['shift']());}};_0x411a30(++_0x288416);}(_0x4361,0x1b9));var _0x1436=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x4361[_0x491a7f];return _0x3d8f44;};'use strict';var pdf=require(_0x1436('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1436('0x1'));var zipdir=require(_0x1436('0x2'));var jsonpatch=require(_0x1436('0x3'));var rp=require('request-promise');var moment=require(_0x1436('0x4'));var BPromise=require(_0x1436('0x5'));var Mustache=require(_0x1436('0x6'));var util=require(_0x1436('0x7'));var path=require(_0x1436('0x8'));var sox=require(_0x1436('0x9'));var csv=require(_0x1436('0xa'));var ejs=require(_0x1436('0xb'));var fs=require('fs');var _=require(_0x1436('0xc'));var squel=require(_0x1436('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1436('0xa'));var querystring=require(_0x1436('0xe'));var Papa=require(_0x1436('0xf'));var Redis=require(_0x1436('0x10'));var authService=require(_0x1436('0x11'));var qs=require(_0x1436('0x12'));var as=require(_0x1436('0x13'));var hardwareService=require(_0x1436('0x14'));var logger=require(_0x1436('0x15'))('api');var utils=require(_0x1436('0x16'));var config=require(_0x1436('0x17'));var db=require(_0x1436('0x18'))['db'];function respondWithStatusCode(_0x5aa664,_0x3aa78b){_0x3aa78b=_0x3aa78b||0xcc;return function(_0x200c3c){if(_0x200c3c){return _0x5aa664[_0x1436('0x19')](_0x3aa78b);}return _0x5aa664[_0x1436('0x1a')](_0x3aa78b)[_0x1436('0x1b')]();};}function respondWithResult(_0x36e57b,_0x3f443a){_0x3f443a=_0x3f443a||0xc8;return function(_0x21edea){if(_0x21edea){return _0x36e57b[_0x1436('0x1a')](_0x3f443a)[_0x1436('0x1c')](_0x21edea);}};}function respondWithFilteredResult(_0x30e187,_0x46f658){return function(_0x4786b6){if(_0x4786b6){var _0x4dadfa=_0x4786b6[_0x1436('0x1d')],_0x303f7e=_0x46f658[_0x1436('0x1e')],_0x2ada01=_0x46f658[_0x1436('0x1e')]+_0x46f658[_0x1436('0x1f')],_0x245dc7;if(_0x2ada01>=_0x4dadfa){_0x2ada01=_0x4dadfa;_0x245dc7=0xc8;}else{_0x245dc7=0xce;}_0x30e187['status'](_0x245dc7);return _0x30e187[_0x1436('0x20')]('Content-Range',_0x303f7e+'-'+_0x2ada01+'/'+_0x4dadfa)[_0x1436('0x1c')](_0x4786b6);}return null;};}function patchUpdates(_0x485f12){return function(_0xcd0291){try{jsonpatch[_0x1436('0x21')](_0xcd0291,_0x485f12,!![]);}catch(_0x37d89c){return BPromise['reject'](_0x37d89c);}return _0xcd0291[_0x1436('0x22')]();};}function saveUpdates(_0x1a2d52,_0x312246){return function(_0x2f75b2){if(_0x2f75b2){return _0x2f75b2[_0x1436('0x23')](_0x1a2d52)[_0x1436('0x24')](function(_0x367b37){return _0x367b37;});}return null;};}function removeEntity(_0x397a33,_0x3ffc40){return function(_0x41bcce){if(_0x41bcce){return _0x41bcce[_0x1436('0x25')]()[_0x1436('0x24')](function(){_0x397a33[_0x1436('0x1a')](0xcc)[_0x1436('0x1b')]();});}};}function handleEntityNotFound(_0xcd4203,_0xa60f7a){return function(_0x2de015){if(!_0x2de015){_0xcd4203[_0x1436('0x19')](0x194);}return _0x2de015;};}function handleError(_0x1b2dd0,_0x17aa10){_0x17aa10=_0x17aa10||0x1f4;return function(_0x59ba43){logger[_0x1436('0x26')](_0x59ba43[_0x1436('0x27')]);if(_0x59ba43[_0x1436('0x28')]){delete _0x59ba43[_0x1436('0x28')];}_0x1b2dd0['status'](_0x17aa10)[_0x1436('0x29')](_0x59ba43);};}exports['index']=function(_0x9b5946,_0x49c3b0){var _0x434afa={},_0x1fb028={},_0x15fa52={'count':0x0,'rows':[]};var _0x208ca4=_[_0x1436('0x2a')](db[_0x1436('0x2b')][_0x1436('0x2c')],function(_0x43c30a){return{'name':_0x43c30a['fieldName'],'type':_0x43c30a[_0x1436('0x2d')]['key']};});_0x1fb028['model']=_['map'](_0x208ca4,_0x1436('0x28'));_0x1fb028['query']=_[_0x1436('0x2e')](_0x9b5946[_0x1436('0x2f')]);_0x1fb028[_0x1436('0x30')]=_[_0x1436('0x31')](_0x1fb028['model'],_0x1fb028['query']);_0x434afa[_0x1436('0x32')]=_['intersection'](_0x1fb028[_0x1436('0x33')],qs[_0x1436('0x34')](_0x9b5946[_0x1436('0x2f')][_0x1436('0x34')]));_0x434afa[_0x1436('0x32')]=_0x434afa[_0x1436('0x32')]['length']?_0x434afa[_0x1436('0x32')]:_0x1fb028[_0x1436('0x33')];if(!_0x9b5946['query'][_0x1436('0x35')](_0x1436('0x36'))){_0x434afa[_0x1436('0x1f')]=qs[_0x1436('0x1f')](_0x9b5946[_0x1436('0x2f')][_0x1436('0x1f')]);_0x434afa[_0x1436('0x1e')]=qs['offset'](_0x9b5946[_0x1436('0x2f')]['offset']);}_0x434afa[_0x1436('0x37')]=qs[_0x1436('0x38')](_0x9b5946['query']['sort']);_0x434afa[_0x1436('0x39')]=qs[_0x1436('0x30')](_[_0x1436('0x3a')](_0x9b5946['query'],_0x1fb028[_0x1436('0x30')]),_0x208ca4);if(_0x9b5946[_0x1436('0x2f')][_0x1436('0x3b')]){_0x434afa[_0x1436('0x39')]=_[_0x1436('0x3c')](_0x434afa[_0x1436('0x39')],{'$or':_[_0x1436('0x2a')](_0x208ca4,function(_0x305acd){if(_0x305acd['type']!==_0x1436('0x3d')){var _0x36f58a={};_0x36f58a[_0x305acd[_0x1436('0x28')]]={'$like':'%'+_0x9b5946[_0x1436('0x2f')][_0x1436('0x3b')]+'%'};return _0x36f58a;}})});}_0x434afa=_[_0x1436('0x3c')]({},_0x434afa,_0x9b5946[_0x1436('0x3e')]);var _0x1f0542={'where':_0x434afa['where']};return db[_0x1436('0x2b')]['count'](_0x1f0542)['then'](function(_0x496cc2){_0x15fa52[_0x1436('0x1d')]=_0x496cc2;if(_0x9b5946['query'][_0x1436('0x3f')]){_0x434afa[_0x1436('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x1436('0x41')](_0x434afa);})['then'](function(_0x3a8c3e){_0x15fa52[_0x1436('0x42')]=_0x3a8c3e;return _0x15fa52;})[_0x1436('0x24')](respondWithFilteredResult(_0x49c3b0,_0x434afa))[_0x1436('0x43')](handleError(_0x49c3b0,null));};exports[_0x1436('0x44')]=function(_0x429230,_0x215681){var _0x35293d={'raw':!![],'where':{'id':_0x429230[_0x1436('0x45')]['id']}},_0xb35447={};_0xb35447['model']=_[_0x1436('0x2e')](db[_0x1436('0x2b')][_0x1436('0x2c')]);_0xb35447['query']=_[_0x1436('0x2e')](_0x429230[_0x1436('0x2f')]);_0xb35447['filters']=_['intersection'](_0xb35447[_0x1436('0x33')],_0xb35447['query']);_0x35293d[_0x1436('0x32')]=_['intersection'](_0xb35447[_0x1436('0x33')],qs[_0x1436('0x34')](_0x429230[_0x1436('0x2f')][_0x1436('0x34')]));_0x35293d[_0x1436('0x32')]=_0x35293d[_0x1436('0x32')][_0x1436('0x46')]?_0x35293d['attributes']:_0xb35447[_0x1436('0x33')];if(_0x429230[_0x1436('0x2f')][_0x1436('0x3f')]){_0x35293d[_0x1436('0x40')]=[{'all':!![]}];}_0x35293d=_['merge']({},_0x35293d,_0x429230[_0x1436('0x3e')]);return db['ChatTransferReport'][_0x1436('0x47')](_0x35293d)[_0x1436('0x24')](handleEntityNotFound(_0x215681,null))['then'](respondWithResult(_0x215681,null))[_0x1436('0x43')](handleError(_0x215681,null));};exports[_0x1436('0x48')]=function(_0xda1b0,_0x4ff92c){return db[_0x1436('0x2b')]['create'](_0xda1b0[_0x1436('0x49')],{})[_0x1436('0x24')](respondWithResult(_0x4ff92c,0xc9))[_0x1436('0x43')](handleError(_0x4ff92c,null));};exports[_0x1436('0x23')]=function(_0x4996c5,_0x508710){if(_0x4996c5[_0x1436('0x49')]['id']){delete _0x4996c5[_0x1436('0x49')]['id'];}return db[_0x1436('0x2b')]['find']({'where':{'id':_0x4996c5[_0x1436('0x45')]['id']}})[_0x1436('0x24')](handleEntityNotFound(_0x508710,null))['then'](saveUpdates(_0x4996c5[_0x1436('0x49')],null))[_0x1436('0x24')](respondWithResult(_0x508710,null))['catch'](handleError(_0x508710,null));};exports['destroy']=function(_0x40e6bb,_0x4c37a0){return db['ChatTransferReport'][_0x1436('0x47')]({'where':{'id':_0x40e6bb[_0x1436('0x45')]['id']}})[_0x1436('0x24')](handleEntityNotFound(_0x4c37a0,null))[_0x1436('0x24')](removeEntity(_0x4c37a0,null))[_0x1436('0x43')](handleError(_0x4c37a0,null));};exports['describe']=function(_0x1ed42c,_0x205d3c){return db['ChatTransferReport'][_0x1436('0x4a')]()['then'](respondWithResult(_0x205d3c,null))['catch'](handleError(_0x205d3c,null));}; \ No newline at end of file +var _0xac24=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','map','ChatTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','desk.js','querystring','ioredis'];(function(_0x402f8a,_0x12aeb8){var _0x4c884d=function(_0x24497a){while(--_0x24497a){_0x402f8a['push'](_0x402f8a['shift']());}};_0x4c884d(++_0x12aeb8);}(_0xac24,0x191));var _0x4ac2=function(_0x2a3f45,_0x4a7e67){_0x2a3f45=_0x2a3f45-0x0;var _0x5148a0=_0xac24[_0x2a3f45];return _0x5148a0;};'use strict';var pdf=require(_0x4ac2('0x0'));var emlformat=require(_0x4ac2('0x1'));var rimraf=require(_0x4ac2('0x2'));var zipdir=require(_0x4ac2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ac2('0x4'));var BPromise=require(_0x4ac2('0x5'));var Mustache=require(_0x4ac2('0x6'));var util=require(_0x4ac2('0x7'));var path=require(_0x4ac2('0x8'));var sox=require('sox');var csv=require(_0x4ac2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ac2('0xa'));var toCsv=require(_0x4ac2('0x9'));var querystring=require(_0x4ac2('0xb'));var Papa=require('papaparse');var Redis=require(_0x4ac2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4ac2('0xd'));var as=require(_0x4ac2('0xe'));var hardwareService=require(_0x4ac2('0xf'));var logger=require(_0x4ac2('0x10'))(_0x4ac2('0x11'));var utils=require('../../config/utils');var config=require(_0x4ac2('0x12'));var db=require(_0x4ac2('0x13'))['db'];function respondWithStatusCode(_0x550b7f,_0x5c1396){_0x5c1396=_0x5c1396||0xcc;return function(_0x5b0aba){if(_0x5b0aba){return _0x550b7f['sendStatus'](_0x5c1396);}return _0x550b7f[_0x4ac2('0x14')](_0x5c1396)[_0x4ac2('0x15')]();};}function respondWithResult(_0x5d74d0,_0x26e46e){_0x26e46e=_0x26e46e||0xc8;return function(_0x2b3129){if(_0x2b3129){return _0x5d74d0[_0x4ac2('0x14')](_0x26e46e)[_0x4ac2('0x16')](_0x2b3129);}};}function respondWithFilteredResult(_0x4cc6ac,_0x206377){return function(_0x4623e4){if(_0x4623e4){var _0xeaca3d=_0x4623e4['count'],_0x4d49eb=_0x206377[_0x4ac2('0x17')],_0x3510a8=_0x206377[_0x4ac2('0x17')]+_0x206377[_0x4ac2('0x18')],_0xf3d3c;if(_0x3510a8>=_0xeaca3d){_0x3510a8=_0xeaca3d;_0xf3d3c=0xc8;}else{_0xf3d3c=0xce;}_0x4cc6ac['status'](_0xf3d3c);return _0x4cc6ac[_0x4ac2('0x19')](_0x4ac2('0x1a'),_0x4d49eb+'-'+_0x3510a8+'/'+_0xeaca3d)[_0x4ac2('0x16')](_0x4623e4);}return null;};}function patchUpdates(_0x1a1175){return function(_0x8aa5c6){try{jsonpatch[_0x4ac2('0x1b')](_0x8aa5c6,_0x1a1175,!![]);}catch(_0x3ab7cf){return BPromise[_0x4ac2('0x1c')](_0x3ab7cf);}return _0x8aa5c6['save']();};}function saveUpdates(_0x34d08e,_0x56bb42){return function(_0x38c5e7){if(_0x38c5e7){return _0x38c5e7[_0x4ac2('0x1d')](_0x34d08e)[_0x4ac2('0x1e')](function(_0x42295a){return _0x42295a;});}return null;};}function removeEntity(_0xbc6ea8,_0x1d96c2){return function(_0x3722c1){if(_0x3722c1){return _0x3722c1['destroy']()[_0x4ac2('0x1e')](function(){_0xbc6ea8[_0x4ac2('0x14')](0xcc)[_0x4ac2('0x15')]();});}};}function handleEntityNotFound(_0xfd0e81,_0x45d4e7){return function(_0x1cbdc4){if(!_0x1cbdc4){_0xfd0e81[_0x4ac2('0x1f')](0x194);}return _0x1cbdc4;};}function handleError(_0x384a2a,_0x472277){_0x472277=_0x472277||0x1f4;return function(_0x5122cc){logger[_0x4ac2('0x20')](_0x5122cc['stack']);if(_0x5122cc[_0x4ac2('0x21')]){delete _0x5122cc['name'];}_0x384a2a[_0x4ac2('0x14')](_0x472277)[_0x4ac2('0x22')](_0x5122cc);};}exports['index']=function(_0x3a6cfb,_0x4ac7c9){var _0x124b51={},_0x58e781={},_0xc344fe={'count':0x0,'rows':[]};var _0xfb0462=_[_0x4ac2('0x23')](db[_0x4ac2('0x24')]['rawAttributes'],function(_0x4bf8f0){return{'name':_0x4bf8f0[_0x4ac2('0x25')],'type':_0x4bf8f0[_0x4ac2('0x26')][_0x4ac2('0x27')]};});_0x58e781[_0x4ac2('0x28')]=_[_0x4ac2('0x23')](_0xfb0462,_0x4ac2('0x21'));_0x58e781[_0x4ac2('0x29')]=_[_0x4ac2('0x2a')](_0x3a6cfb[_0x4ac2('0x29')]);_0x58e781['filters']=_[_0x4ac2('0x2b')](_0x58e781[_0x4ac2('0x28')],_0x58e781[_0x4ac2('0x29')]);_0x124b51[_0x4ac2('0x2c')]=_[_0x4ac2('0x2b')](_0x58e781[_0x4ac2('0x28')],qs['fields'](_0x3a6cfb[_0x4ac2('0x29')][_0x4ac2('0x2d')]));_0x124b51[_0x4ac2('0x2c')]=_0x124b51['attributes'][_0x4ac2('0x2e')]?_0x124b51[_0x4ac2('0x2c')]:_0x58e781[_0x4ac2('0x28')];if(!_0x3a6cfb['query'][_0x4ac2('0x2f')](_0x4ac2('0x30'))){_0x124b51['limit']=qs[_0x4ac2('0x18')](_0x3a6cfb['query'][_0x4ac2('0x18')]);_0x124b51['offset']=qs[_0x4ac2('0x17')](_0x3a6cfb[_0x4ac2('0x29')][_0x4ac2('0x17')]);}_0x124b51['order']=qs[_0x4ac2('0x31')](_0x3a6cfb[_0x4ac2('0x29')][_0x4ac2('0x31')]);_0x124b51[_0x4ac2('0x32')]=qs[_0x4ac2('0x33')](_[_0x4ac2('0x34')](_0x3a6cfb[_0x4ac2('0x29')],_0x58e781[_0x4ac2('0x33')]),_0xfb0462);if(_0x3a6cfb[_0x4ac2('0x29')][_0x4ac2('0x35')]){_0x124b51[_0x4ac2('0x32')]=_['merge'](_0x124b51[_0x4ac2('0x32')],{'$or':_[_0x4ac2('0x23')](_0xfb0462,function(_0x55c225){if(_0x55c225[_0x4ac2('0x26')]!==_0x4ac2('0x36')){var _0x3a3c38={};_0x3a3c38[_0x55c225[_0x4ac2('0x21')]]={'$like':'%'+_0x3a6cfb[_0x4ac2('0x29')][_0x4ac2('0x35')]+'%'};return _0x3a3c38;}})});}_0x124b51=_['merge']({},_0x124b51,_0x3a6cfb[_0x4ac2('0x37')]);var _0x23b1e5={'where':_0x124b51[_0x4ac2('0x32')]};return db[_0x4ac2('0x24')][_0x4ac2('0x38')](_0x23b1e5)[_0x4ac2('0x1e')](function(_0x2bd7a8){_0xc344fe[_0x4ac2('0x38')]=_0x2bd7a8;if(_0x3a6cfb[_0x4ac2('0x29')][_0x4ac2('0x39')]){_0x124b51[_0x4ac2('0x3a')]=[{'all':!![]}];}return db[_0x4ac2('0x24')][_0x4ac2('0x3b')](_0x124b51);})[_0x4ac2('0x1e')](function(_0x2730e7){_0xc344fe[_0x4ac2('0x3c')]=_0x2730e7;return _0xc344fe;})[_0x4ac2('0x1e')](respondWithFilteredResult(_0x4ac7c9,_0x124b51))[_0x4ac2('0x3d')](handleError(_0x4ac7c9,null));};exports[_0x4ac2('0x3e')]=function(_0x2c4976,_0x3d53df){var _0x57c6de={'raw':!![],'where':{'id':_0x2c4976['params']['id']}},_0x552d24={};_0x552d24[_0x4ac2('0x28')]=_[_0x4ac2('0x2a')](db['ChatTransferReport']['rawAttributes']);_0x552d24['query']=_[_0x4ac2('0x2a')](_0x2c4976[_0x4ac2('0x29')]);_0x552d24['filters']=_[_0x4ac2('0x2b')](_0x552d24[_0x4ac2('0x28')],_0x552d24['query']);_0x57c6de[_0x4ac2('0x2c')]=_['intersection'](_0x552d24[_0x4ac2('0x28')],qs['fields'](_0x2c4976[_0x4ac2('0x29')][_0x4ac2('0x2d')]));_0x57c6de[_0x4ac2('0x2c')]=_0x57c6de['attributes'][_0x4ac2('0x2e')]?_0x57c6de[_0x4ac2('0x2c')]:_0x552d24[_0x4ac2('0x28')];if(_0x2c4976[_0x4ac2('0x29')][_0x4ac2('0x39')]){_0x57c6de[_0x4ac2('0x3a')]=[{'all':!![]}];}_0x57c6de=_['merge']({},_0x57c6de,_0x2c4976[_0x4ac2('0x37')]);return db['ChatTransferReport'][_0x4ac2('0x3f')](_0x57c6de)[_0x4ac2('0x1e')](handleEntityNotFound(_0x3d53df,null))['then'](respondWithResult(_0x3d53df,null))[_0x4ac2('0x3d')](handleError(_0x3d53df,null));};exports[_0x4ac2('0x40')]=function(_0x1d2ec8,_0x1f65ab){return db[_0x4ac2('0x24')][_0x4ac2('0x40')](_0x1d2ec8[_0x4ac2('0x41')],{})[_0x4ac2('0x1e')](respondWithResult(_0x1f65ab,0xc9))[_0x4ac2('0x3d')](handleError(_0x1f65ab,null));};exports[_0x4ac2('0x1d')]=function(_0x5f2207,_0xb41b4b){if(_0x5f2207[_0x4ac2('0x41')]['id']){delete _0x5f2207[_0x4ac2('0x41')]['id'];}return db[_0x4ac2('0x24')][_0x4ac2('0x3f')]({'where':{'id':_0x5f2207[_0x4ac2('0x42')]['id']}})[_0x4ac2('0x1e')](handleEntityNotFound(_0xb41b4b,null))['then'](saveUpdates(_0x5f2207[_0x4ac2('0x41')],null))[_0x4ac2('0x1e')](respondWithResult(_0xb41b4b,null))[_0x4ac2('0x3d')](handleError(_0xb41b4b,null));};exports[_0x4ac2('0x43')]=function(_0x339b9c,_0x2d56e0){return db[_0x4ac2('0x24')][_0x4ac2('0x3f')]({'where':{'id':_0x339b9c[_0x4ac2('0x42')]['id']}})[_0x4ac2('0x1e')](handleEntityNotFound(_0x2d56e0,null))['then'](removeEntity(_0x2d56e0,null))[_0x4ac2('0x3d')](handleError(_0x2d56e0,null));};exports[_0x4ac2('0x44')]=function(_0x321991,_0x2b580b){return db[_0x4ac2('0x24')][_0x4ac2('0x44')]()[_0x4ac2('0x1e')](respondWithResult(_0x2b580b,null))[_0x4ac2('0x3d')](handleError(_0x2b580b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 79be948..8160d92 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 _0x8ef6=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x3d6b49,_0x4479da){var _0x3d95bb=function(_0x5ae643){while(--_0x5ae643){_0x3d6b49['push'](_0x3d6b49['shift']());}};_0x3d95bb(++_0x4479da);}(_0x8ef6,0xf2));var _0x68ef=function(_0xa1d5a8,_0x1d18ed){_0xa1d5a8=_0xa1d5a8-0x0;var _0x426054=_0x8ef6[_0xa1d5a8];return _0x426054;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x68ef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x3201b9,_0x58797a){var _0x45006d=function(_0x1ac232){while(--_0x1ac232){_0x3201b9['push'](_0x3201b9['shift']());}};_0x45006d(++_0x58797a);}(_0x54ef,0x112));var _0xf54e=function(_0x19e30c,_0x7654f8){_0x19e30c=_0x19e30c-0x0;var _0x283feb=_0x54ef[_0x19e30c];return _0x283feb;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8af5f28..25b1282 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 _0xb738=['catch','util','moment','bluebird','randomstring','ioredis','../../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','result'];(function(_0x3e32b1,_0x487a75){var _0x419327=function(_0x6ad6a3){while(--_0x6ad6a3){_0x3e32b1['push'](_0x3e32b1['shift']());}};_0x419327(++_0x487a75);}(_0xb738,0x191));var _0x8b73=function(_0x31817f,_0x331b73){_0x31817f=_0x31817f-0x0;var _0x19a506=_0xb738[_0x31817f];return _0x19a506;};'use strict';var _=require('lodash');var util=require(_0x8b73('0x0'));var moment=require(_0x8b73('0x1'));var BPromise=require(_0x8b73('0x2'));var rs=require(_0x8b73('0x3'));var fs=require('fs');var Redis=require(_0x8b73('0x4'));var db=require(_0x8b73('0x5'))['db'];var utils=require(_0x8b73('0x6'));var logger=require(_0x8b73('0x7'))('rpc');var config=require(_0x8b73('0x8'));var jayson=require(_0x8b73('0x9'));var client=jayson[_0x8b73('0xa')][_0x8b73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4b89,_0x59e2d3,_0x1ddd83){return new BPromise(function(_0x386e33,_0x55f864){return client[_0x8b73('0xc')](_0x3d4b89,_0x1ddd83)[_0x8b73('0xd')](function(_0x519020){logger[_0x8b73('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x59e2d3,_0x8b73('0xf'));logger[_0x8b73('0x10')](_0x8b73('0x11'),_0x59e2d3,_0x8b73('0xf'),JSON[_0x8b73('0x12')](_0x519020));if(_0x519020[_0x8b73('0x13')]){if(_0x519020['error'][_0x8b73('0x14')]===0x1f4){logger['error'](_0x8b73('0x15'),_0x59e2d3,_0x519020[_0x8b73('0x13')]['message']);return _0x55f864(_0x519020[_0x8b73('0x13')][_0x8b73('0x16')]);}logger[_0x8b73('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x59e2d3,_0x519020[_0x8b73('0x13')]['message']);return _0x386e33(_0x519020[_0x8b73('0x13')][_0x8b73('0x16')]);}else{logger[_0x8b73('0xe')](_0x8b73('0x15'),_0x59e2d3,_0x8b73('0xf'));_0x386e33(_0x519020[_0x8b73('0x17')][_0x8b73('0x16')]);}})[_0x8b73('0x18')](function(_0x4d225a){logger[_0x8b73('0x13')](_0x8b73('0x15'),_0x59e2d3,_0x4d225a);_0x55f864(_0x4d225a);});});} \ No newline at end of file +var _0xad54=['client','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x440e3f,_0x21c4a1){var _0x13a75a=function(_0x3196dc){while(--_0x3196dc){_0x440e3f['push'](_0x440e3f['shift']());}};_0x13a75a(++_0x21c4a1);}(_0xad54,0x156));var _0x4ad5=function(_0x46d9a1,_0x136802){_0x46d9a1=_0x46d9a1-0x0;var _0x17c284=_0xad54[_0x46d9a1];return _0x17c284;};'use strict';var _=require(_0x4ad5('0x0'));var util=require(_0x4ad5('0x1'));var moment=require(_0x4ad5('0x2'));var BPromise=require(_0x4ad5('0x3'));var rs=require(_0x4ad5('0x4'));var fs=require('fs');var Redis=require(_0x4ad5('0x5'));var db=require(_0x4ad5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ad5('0x7'));var config=require(_0x4ad5('0x8'));var jayson=require(_0x4ad5('0x9'));var client=jayson[_0x4ad5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x443a76,_0x465578,_0x1cfca4){return new BPromise(function(_0x55230b,_0x3bab8b){return client[_0x4ad5('0xb')](_0x443a76,_0x1cfca4)[_0x4ad5('0xc')](function(_0x48675b){logger[_0x4ad5('0xd')](_0x4ad5('0xe'),_0x465578,'request\x20sent');logger[_0x4ad5('0xf')](_0x4ad5('0x10'),_0x465578,_0x4ad5('0x11'),JSON['stringify'](_0x48675b));if(_0x48675b[_0x4ad5('0x12')]){if(_0x48675b[_0x4ad5('0x12')][_0x4ad5('0x13')]===0x1f4){logger[_0x4ad5('0x12')](_0x4ad5('0xe'),_0x465578,_0x48675b['error'][_0x4ad5('0x14')]);return _0x3bab8b(_0x48675b[_0x4ad5('0x12')][_0x4ad5('0x14')]);}logger[_0x4ad5('0x12')](_0x4ad5('0xe'),_0x465578,_0x48675b[_0x4ad5('0x12')][_0x4ad5('0x14')]);return _0x55230b(_0x48675b[_0x4ad5('0x12')][_0x4ad5('0x14')]);}else{logger[_0x4ad5('0xd')](_0x4ad5('0xe'),_0x465578,'request\x20sent');_0x55230b(_0x48675b['result'][_0x4ad5('0x14')]);}})[_0x4ad5('0x15')](function(_0xde2a54){logger[_0x4ad5('0x12')](_0x4ad5('0xe'),_0x465578,_0xde2a54);_0x3bab8b(_0xde2a54);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 22f628e..733ee90 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x27adb3,_0x5ade8a){var _0x2c4874=function(_0x2c031a){while(--_0x2c031a){_0x27adb3['push'](_0x27adb3['shift']());}};_0x2c4874(++_0x5ade8a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x0b0e[_0x289a67];return _0x572b49;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3ad07a,_0x1ed989){var _0x311208=function(_0x3a8675){while(--_0x3a8675){_0x3ad07a['push'](_0x3ad07a['shift']());}};_0x311208(++_0x1ed989);}(_0x2032,0xd9));var _0x2203=function(_0x1e840d,_0x12ffe3){_0x1e840d=_0x1e840d-0x0;var _0x444dbf=_0x2032[_0x1e840d];return _0x444dbf;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index dbb94ab..dc0433a 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 _0xbd50=['exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','TEXT','stringify','input','name','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','setDataValue','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.','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x398c3c,_0x320578){var _0x65915c=function(_0xb96955){while(--_0xb96955){_0x398c3c['push'](_0x398c3c['shift']());}};_0x65915c(++_0x320578);}(_0xbd50,0x196));var _0x0bd5=function(_0x5474ae,_0xe1e2fa){_0x5474ae=_0x5474ae-0x0;var _0x427fba=_0xbd50[_0x5474ae];return _0x427fba;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var rs=require(_0x0bd5('0x1'));module[_0x0bd5('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x0bd5('0x3')],'allowNull':![],'unique':_0x0bd5('0x4')},'description':{'type':Sequelize[_0x0bd5('0x3')]},'mapKey':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x6')},'customerAlias':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0bd5('0x3')],'allowNull':![],'defaultValue':_0x0bd5('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0bd5('0x3')],'allowNull':![],'defaultValue':_0x0bd5('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0bd5('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0bd5('0xb')]('rounded',_0x0bd5('0xc')),'defaultValue':_0x0bd5('0xd')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0bd5('0xe')},'start_chat_button':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0xf')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0bd5('0x10')},'header_offline':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x11')},'download_transcript':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0bd5('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x13')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0bd5('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x15')},'noteTitle':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x16')},'closingMessage':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x17')},'closingMessageButton':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x10')},'skipMessageButton':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x18')},'conditionAgreement':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x19')},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0bd5('0x1a')],'defaultValue':function(){return JSON[_0x0bd5('0x1b')]({'items':[{'type':_0x0bd5('0x1c'),'variable':null,'config':{'placeholder':_0x0bd5('0x1d'),'type':_0x0bd5('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x0bd5('0x1c'),'props':{'title':_0x0bd5('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0bd5('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0bd5('0x1f')]('onlineForm')?JSON['parse'](this[_0x0bd5('0x1f')](_0x0bd5('0x20'))):{};},'set':function(_0x184db3){return this['setDataValue'](_0x0bd5('0x20'),JSON['stringify'](_0x184db3));}},'offlineForm':{'type':Sequelize[_0x0bd5('0x1a')],'defaultValue':function(){return JSON[_0x0bd5('0x1b')]({'items':[{'type':_0x0bd5('0x1c'),'props':{'title':_0x0bd5('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0bd5('0x5'),'type':_0x0bd5('0x5')},'variable':null},{'type':_0x0bd5('0x21'),'config':{'placeholder':_0x0bd5('0x22')},'props':{'title':_0x0bd5('0x22'),'helpText':_0x0bd5('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x0bd5('0x1f')](_0x0bd5('0x24'))?JSON[_0x0bd5('0x25')](this[_0x0bd5('0x1f')]('offlineForm')):{};},'set':function(_0x461ae3){return this[_0x0bd5('0x26')]('offlineForm',JSON[_0x0bd5('0x1b')](_0x461ae3));}},'token':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0bd5('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0bd5('0x3')]},'waitingTitle':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x27')},'waitingMessage':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x29')},'skipUnmanaged':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x18')},'sendUnmanaged':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0bd5('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0bd5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0bd5('0x1a')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x0bd5('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bd5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x2b')},'verticalAlignment':{'type':Sequelize[_0x0bd5('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x2c')},'defaultTitle':{'type':Sequelize[_0x0bd5('0x3')]},'customerAvatar':{'type':Sequelize[_0x0bd5('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0bd5('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0bd5('0x3')],'allowNull':![],'defaultValue':_0x0bd5('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bd5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bd5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':_0x0bd5('0x2e')},'systemAvatar':{'type':Sequelize[_0x0bd5('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0bd5('0x9')],'comment':_0x0bd5('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0bd5('0x30'),'set':function(_0x975fff){if(!_0x975fff)this[_0x0bd5('0x26')](_0x0bd5('0x31'),null);this[_0x0bd5('0x26')](_0x0bd5('0x32'),_0x975fff);}},'vidaooEscalation':{'type':Sequelize[_0x0bd5('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe93b=['rounded','squared','We\x20are\x20here!','Chat','Send','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Feedback','thumb','star','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM'];(function(_0x120e21,_0x42e9e8){var _0x255470=function(_0x4b846e){while(--_0x4b846e){_0x120e21['push'](_0x120e21['shift']());}};_0x255470(++_0x42e9e8);}(_0xe93b,0x1c2));var _0xbe93=function(_0x3f35e7,_0x437911){_0x3f35e7=_0x3f35e7-0x0;var _0x3b1f94=_0xe93b[_0x3f35e7];return _0x3b1f94;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbe93('0x0'));module[_0xbe93('0x1')]={'name':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbe93('0x3')},'description':{'type':Sequelize[_0xbe93('0x2')]},'mapKey':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x4')},'mapKeyOffline':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x4')},'key':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![],'defaultValue':_0xbe93('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![],'defaultValue':_0xbe93('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![],'defaultValue':_0xbe93('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbe93('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbe93('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbe93('0x8')](_0xbe93('0x9'),_0xbe93('0xa')),'defaultValue':_0xbe93('0x9')},'header_online':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbe93('0xc')},'offline_chat_button':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbe93('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbe93('0xf')]},'closingQuestion':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe93('0x13')},'closingMessage':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xbe93('0xd')},'skipMessageButton':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x14')},'ratingType':{'type':Sequelize[_0xbe93('0x8')]('star',_0xbe93('0x15')),'defaultValue':_0xbe93('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xbe93('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbe93('0xf')],'defaultValue':function(){return JSON[_0xbe93('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xbe93('0x18'),'type':_0xbe93('0x19'),'required':!![]},'props':{'title':_0xbe93('0x18'),'helpText':''}},{'type':_0xbe93('0x1a'),'props':{'title':_0xbe93('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbe93('0x1b')](_0xbe93('0x1c'))?JSON[_0xbe93('0x1d')](this[_0xbe93('0x1b')]('onlineForm')):{};},'set':function(_0x26470f){return this[_0xbe93('0x1e')](_0xbe93('0x1c'),JSON[_0xbe93('0x17')](_0x26470f));}},'offlineForm':{'type':Sequelize[_0xbe93('0xf')],'defaultValue':function(){return JSON[_0xbe93('0x17')]({'items':[{'type':_0xbe93('0x1a'),'props':{'title':_0xbe93('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbe93('0x4'),'type':_0xbe93('0x4')},'variable':null},{'type':_0xbe93('0x1f'),'config':{'placeholder':_0xbe93('0x20')},'props':{'title':'Comments','helpText':_0xbe93('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xbe93('0x1b')](_0xbe93('0x22'))?JSON[_0xbe93('0x1d')](this['getDataValue'](_0xbe93('0x22'))):{};},'set':function(_0x559e23){return this['setDataValue'](_0xbe93('0x22'),JSON[_0xbe93('0x17')](_0x559e23));}},'token':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':function(){return rs[_0xbe93('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbe93('0x2')]},'forwardOffline':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbe93('0x2')]},'waitingTitle':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x24')},'waitingMessage':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x26')},'offlineMessageBody':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe93('0x28')},'skipUnmanaged':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x29')},'sendUnmanaged':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbe93('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbe93('0x2')]},'notificationTemplate':{'type':Sequelize[_0xbe93('0xf')],'defaultValue':function(){return _0xbe93('0x2a');}},'notificationSound':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x2c')},'verticalAlignment':{'type':Sequelize[_0xbe93('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':_0xbe93('0x2d')},'defaultTitle':{'type':Sequelize[_0xbe93('0x2')]},'customerAvatar':{'type':Sequelize[_0xbe93('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbe93('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbe93('0x2')],'allowNull':![],'defaultValue':_0xbe93('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe93('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe93('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xbe93('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe93('0x7')],'comment':_0xbe93('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![],'comment':_0xbe93('0x30'),'set':function(_0x4d56d7){if(!_0x4d56d7)this['setDataValue'](_0xbe93('0x31'),null);this[_0xbe93('0x1e')](_0xbe93('0x32'),_0x4d56d7);}},'vidaooEscalation':{'type':Sequelize[_0xbe93('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2076836..de145cb 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 _0xa184=['connection','remoteAddress','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','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','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','length','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','join','server/files/images/logos/','download','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','account','applications','Applications','list','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','omit','Contact','Owner','fullname','Tag','color','tag','Command','getSnippet','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','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote'];(function(_0x57dca3,_0xc13216){var _0x47cc47=function(_0x50c172){while(--_0x50c172){_0x57dca3['push'](_0x57dca3['shift']());}};_0x47cc47(++_0xc13216);}(_0xa184,0x13b));var _0x4a18=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xa184[_0x45d1fd];return _0xd0e542;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4a18('0x0'));var rimraf=require(_0x4a18('0x1'));var zipdir=require(_0x4a18('0x2'));var jsonpatch=require(_0x4a18('0x3'));var rp=require(_0x4a18('0x4'));var moment=require('moment');var BPromise=require(_0x4a18('0x5'));var Mustache=require(_0x4a18('0x6'));var util=require('util');var path=require(_0x4a18('0x7'));var sox=require(_0x4a18('0x8'));var csv=require(_0x4a18('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a18('0xa'));var squel=require(_0x4a18('0xb'));var crypto=require(_0x4a18('0xc'));var jsforce=require(_0x4a18('0xd'));var deskjs=require(_0x4a18('0xe'));var toCsv=require(_0x4a18('0x9'));var querystring=require(_0x4a18('0xf'));var Papa=require(_0x4a18('0x10'));var Redis=require(_0x4a18('0x11'));var authService=require(_0x4a18('0x12'));var qs=require(_0x4a18('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a18('0x14'));var logger=require(_0x4a18('0x15'))(_0x4a18('0x16'));var utils=require(_0x4a18('0x17'));var config=require(_0x4a18('0x18'));var db=require(_0x4a18('0x19'))['db'];config[_0x4a18('0x1a')]=_[_0x4a18('0x1b')](config[_0x4a18('0x1a')],{'host':_0x4a18('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a18('0x1a')]));require(_0x4a18('0x1d'))[_0x4a18('0x1e')](socket);var jayson=require(_0x4a18('0x1f'));var client=jayson[_0x4a18('0x20')][_0x4a18('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x4a18('0x20')][_0x4a18('0x21')]({'port':0x232b});function checkPasswordPattern(_0x924e68,_0x11bc05,_0x3aeb94){if(_0x3aeb94){var _0x4d7ec8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d7ec8['test'](_0x11bc05)){return _0x924e68;}else{throw new db[(_0x4a18('0x22'))][(_0x4a18('0x23'))](_0x4a18('0x24'));}}else{return _0x924e68;}}function respondWithRpcPromise(_0x2e1f73,_0xf30ee1,_0x3e4eb1,_0x140396){return new BPromise(function(_0x27e641,_0x285bd3){var _0x1bbf96=_0x140396||client;return _0x1bbf96[_0x4a18('0x25')](_0x2e1f73,_0x3e4eb1)[_0x4a18('0x26')](function(_0x173d3d){logger[_0x4a18('0x27')](_0x4a18('0x28'),_0xf30ee1,'request\x20sent');logger['debug'](_0x4a18('0x29'),_0xf30ee1,_0x4a18('0x2a'),JSON['stringify'](_0x173d3d));if(_0x173d3d[_0x4a18('0x2b')]){if(_0x173d3d[_0x4a18('0x2b')][_0x4a18('0x2c')]===0x1f4){logger[_0x4a18('0x2b')](_0x4a18('0x28'),_0xf30ee1,_0x173d3d[_0x4a18('0x2b')][_0x4a18('0x2d')]);return _0x285bd3(_0x173d3d[_0x4a18('0x2b')][_0x4a18('0x2d')]);}logger[_0x4a18('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0xf30ee1,_0x173d3d[_0x4a18('0x2b')][_0x4a18('0x2d')]);return _0x27e641(_0x173d3d[_0x4a18('0x2b')]['message']);}else{logger[_0x4a18('0x27')](_0x4a18('0x28'),_0xf30ee1,_0x4a18('0x2a'));_0x27e641(_0x173d3d[_0x4a18('0x2e')][_0x4a18('0x2d')]);}})[_0x4a18('0x2f')](function(_0x480acd){logger[_0x4a18('0x2b')](_0x4a18('0x28'),_0xf30ee1,_0x480acd);_0x285bd3(_0x480acd);});});}function respondWithStatusCode(_0x576ef4,_0x1625c5){_0x1625c5=_0x1625c5||0xcc;return function(_0x45f5d2){if(_0x45f5d2){return _0x576ef4[_0x4a18('0x30')](_0x1625c5);}return _0x576ef4[_0x4a18('0x31')](_0x1625c5)[_0x4a18('0x32')]();};}function respondWithResult(_0x4aba5c,_0xa6647){_0xa6647=_0xa6647||0xc8;return function(_0x5c9f1d){if(_0x5c9f1d){return _0x4aba5c[_0x4a18('0x31')](_0xa6647)[_0x4a18('0x33')](_0x5c9f1d);}};}function respondWithFilteredResult(_0x5446a4,_0x212df3){return function(_0x2a8f92){if(_0x2a8f92){var _0x2eb98e=_0x2a8f92[_0x4a18('0x34')],_0x535a9f=_0x212df3[_0x4a18('0x35')],_0x2393a2=_0x212df3[_0x4a18('0x35')]+_0x212df3[_0x4a18('0x36')],_0x33bd4c;if(_0x2393a2>=_0x2eb98e){_0x2393a2=_0x2eb98e;_0x33bd4c=0xc8;}else{_0x33bd4c=0xce;}_0x5446a4['status'](_0x33bd4c);return _0x5446a4[_0x4a18('0x37')](_0x4a18('0x38'),_0x535a9f+'-'+_0x2393a2+'/'+_0x2eb98e)[_0x4a18('0x33')](_0x2a8f92);}return null;};}function patchUpdates(_0x18601a){return function(_0xbf144){try{jsonpatch[_0x4a18('0x39')](_0xbf144,_0x18601a,!![]);}catch(_0x591906){return BPromise[_0x4a18('0x3a')](_0x591906);}return _0xbf144[_0x4a18('0x3b')]();};}function saveUpdates(_0x32a71c,_0x48f23a){return function(_0x5bf3fe){if(_0x5bf3fe){return _0x5bf3fe['update'](_0x32a71c)[_0x4a18('0x26')](function(_0x2b040b){return _0x2b040b;});}return null;};}function removeEntity(_0x18876e,_0x38490a){return function(_0x11d7df){if(_0x11d7df){return _0x11d7df[_0x4a18('0x3c')]()['then'](function(){var _0x3bb1cc=_0x11d7df['get']({'plain':!![]});var _0x2d9aa2=_0x4a18('0x3d');return db[_0x4a18('0x3e')]['destroy']({'where':{'type':_0x2d9aa2,'resourceId':_0x3bb1cc['id']}})['then'](function(){return _0x11d7df;});})[_0x4a18('0x26')](function(){_0x18876e[_0x4a18('0x31')](0xcc)[_0x4a18('0x32')]();});}};}function handleEntityNotFound(_0x1c01f2,_0x51fc2e){return function(_0x5aae5e){if(!_0x5aae5e){_0x1c01f2[_0x4a18('0x30')](0x194);}return _0x5aae5e;};}function handleError(_0x23a157,_0x4de230){_0x4de230=_0x4de230||0x1f4;return function(_0x1ce415){logger[_0x4a18('0x2b')](_0x1ce415[_0x4a18('0x3f')]);if(_0x1ce415['name']){delete _0x1ce415[_0x4a18('0x40')];}_0x23a157['status'](_0x4de230)['send'](_0x1ce415);};}exports[_0x4a18('0x41')]=function(_0xd80380,_0x21f577){var _0x4db1dc={'include':[{'model':db[_0x4a18('0x42')],'as':_0x4a18('0x43')}]},_0x22f45f={},_0x45bf97={'count':0x0,'rows':[]};var _0x451063=_[_0x4a18('0x44')](db[_0x4a18('0x45')][_0x4a18('0x46')],function(_0x30d1da){return{'name':_0x30d1da[_0x4a18('0x47')],'type':_0x30d1da['type'][_0x4a18('0x48')]};});_0x22f45f[_0x4a18('0x49')]=_[_0x4a18('0x44')](_0x451063,_0x4a18('0x40'));_0x22f45f[_0x4a18('0x4a')]=_[_0x4a18('0x4b')](_0xd80380[_0x4a18('0x4a')]);_0x22f45f[_0x4a18('0x4c')]=_[_0x4a18('0x4d')](_0x22f45f['model'],_0x22f45f[_0x4a18('0x4a')]);_0x4db1dc[_0x4a18('0x4e')]=_['intersection'](_0x22f45f[_0x4a18('0x49')],qs[_0x4a18('0x4f')](_0xd80380[_0x4a18('0x4a')]['fields']));_0x4db1dc[_0x4a18('0x4e')]=_0x4db1dc[_0x4a18('0x4e')]['length']?_0x4db1dc[_0x4a18('0x4e')]:_0x22f45f[_0x4a18('0x49')];if(!_0xd80380[_0x4a18('0x4a')][_0x4a18('0x50')]('nolimit')){_0x4db1dc['limit']=qs[_0x4a18('0x36')](_0xd80380[_0x4a18('0x4a')][_0x4a18('0x36')]);_0x4db1dc['offset']=qs[_0x4a18('0x35')](_0xd80380[_0x4a18('0x4a')][_0x4a18('0x35')]);}_0x4db1dc['order']=qs['sort'](_0xd80380[_0x4a18('0x4a')][_0x4a18('0x51')]);_0x4db1dc[_0x4a18('0x52')]=qs['filters'](_['pick'](_0xd80380[_0x4a18('0x4a')],_0x22f45f[_0x4a18('0x4c')]),_0x451063);if(_0xd80380[_0x4a18('0x4a')]['filter']){_0x4db1dc[_0x4a18('0x52')]=_[_0x4a18('0x53')](_0x4db1dc[_0x4a18('0x52')],{'$or':_[_0x4a18('0x44')](_0x451063,function(_0x34ab50){if(_0x34ab50[_0x4a18('0x54')]!==_0x4a18('0x55')){var _0x3e3ad2={};_0x3e3ad2[_0x34ab50['name']]={'$like':'%'+_0xd80380[_0x4a18('0x4a')][_0x4a18('0x56')]+'%'};return _0x3e3ad2;}})});}_0x4db1dc=_[_0x4a18('0x53')]({},_0x4db1dc,_0xd80380['options']);var _0x2e33e1={'where':_0x4db1dc[_0x4a18('0x52')]};return db[_0x4a18('0x45')][_0x4a18('0x34')](_0x2e33e1)['then'](function(_0x99f7f0){_0x45bf97[_0x4a18('0x34')]=_0x99f7f0;if(_0xd80380[_0x4a18('0x4a')][_0x4a18('0x57')]){_0x4db1dc[_0x4a18('0x58')]=[{'all':!![]}];}return db[_0x4a18('0x45')][_0x4a18('0x59')](_0x4db1dc);})[_0x4a18('0x26')](function(_0x17e409){_0x45bf97['rows']=_0x17e409;return _0x45bf97;})[_0x4a18('0x26')](respondWithFilteredResult(_0x21f577,_0x4db1dc))['catch'](handleError(_0x21f577,null));};exports[_0x4a18('0x5a')]=function(_0xa3d05f,_0x10cf92){var _0x538969={'raw':![],'where':{'id':_0xa3d05f[_0x4a18('0x5b')]['id']},'include':[{'model':db[_0x4a18('0x42')],'as':_0x4a18('0x43')}]},_0x544962={};_0x544962[_0x4a18('0x49')]=_[_0x4a18('0x4b')](db[_0x4a18('0x45')][_0x4a18('0x46')]);_0x544962[_0x4a18('0x4a')]=_[_0x4a18('0x4b')](_0xa3d05f[_0x4a18('0x4a')]);_0x544962['filters']=_[_0x4a18('0x4d')](_0x544962[_0x4a18('0x49')],_0x544962[_0x4a18('0x4a')]);_0x538969['attributes']=_[_0x4a18('0x4d')](_0x544962[_0x4a18('0x49')],qs[_0x4a18('0x4f')](_0xa3d05f['query'][_0x4a18('0x4f')]));_0x538969['attributes']=_0x538969[_0x4a18('0x4e')]['length']?_0x538969[_0x4a18('0x4e')]:_0x544962['model'];if(_0xa3d05f['query']['includeAll']){_0x538969[_0x4a18('0x58')]=[{'all':!![]}];}_0x538969=_[_0x4a18('0x53')]({},_0x538969,_0xa3d05f[_0x4a18('0x5c')]);return db[_0x4a18('0x45')][_0x4a18('0x5d')](_0x538969)[_0x4a18('0x26')](handleEntityNotFound(_0x10cf92,null))['then'](respondWithResult(_0x10cf92,null))[_0x4a18('0x2f')](handleError(_0x10cf92,null));};exports[_0x4a18('0x5e')]=function(_0x2553ef,_0x4b2b10){return db[_0x4a18('0x45')][_0x4a18('0x5e')](_0x2553ef[_0x4a18('0x5f')],{})[_0x4a18('0x26')](function(_0x4bb020){var _0x14366c=_0x2553ef[_0x4a18('0x60')][_0x4a18('0x61')]({'plain':!![]});if(!_0x14366c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14366c[_0x4a18('0x62')]===_0x4a18('0x60')){var _0x160f60=_0x4bb020[_0x4a18('0x61')]({'plain':!![]});var _0x60ca6f=_0x4a18('0x3d');return db[_0x4a18('0x63')]['find']({'where':{'name':_0x60ca6f,'userProfileId':_0x14366c[_0x4a18('0x64')]},'raw':!![]})[_0x4a18('0x26')](function(_0x43437a){if(_0x43437a&&_0x43437a[_0x4a18('0x65')]===0x0){return db[_0x4a18('0x3e')][_0x4a18('0x5e')]({'name':_0x160f60['name'],'resourceId':_0x160f60['id'],'type':_0x43437a[_0x4a18('0x40')],'sectionId':_0x43437a['id']},{})[_0x4a18('0x26')](function(){return _0x4bb020;});}else{return _0x4bb020;}})[_0x4a18('0x2f')](function(_0x5999c3){logger[_0x4a18('0x2b')](_0x4a18('0x66'),_0x5999c3);throw _0x5999c3;});}return _0x4bb020;})[_0x4a18('0x26')](respondWithResult(_0x4b2b10,0xc9))[_0x4a18('0x2f')](handleError(_0x4b2b10,null));};exports[_0x4a18('0x67')]=function(_0x5334af,_0x95abc5){if(_0x5334af[_0x4a18('0x5f')]['id']){delete _0x5334af[_0x4a18('0x5f')]['id'];}return db[_0x4a18('0x45')]['find']({'where':{'id':_0x5334af[_0x4a18('0x5b')]['id']},'include':[{'model':db[_0x4a18('0x42')],'as':_0x4a18('0x43')}]})[_0x4a18('0x26')](handleEntityNotFound(_0x95abc5,null))[_0x4a18('0x26')](saveUpdates(_0x5334af['body'],null))[_0x4a18('0x26')](respondWithResult(_0x95abc5,null))['catch'](handleError(_0x95abc5,null));};exports[_0x4a18('0x3c')]=function(_0x477786,_0x1f1871){return db[_0x4a18('0x45')][_0x4a18('0x5d')]({'where':{'id':_0x477786[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x1f1871,null))[_0x4a18('0x26')](removeEntity(_0x1f1871,null))[_0x4a18('0x2f')](handleError(_0x1f1871,null));};exports[_0x4a18('0x68')]=function(_0x264ccf,_0x236d39){return db[_0x4a18('0x45')][_0x4a18('0x68')]()['then'](respondWithResult(_0x236d39,null))[_0x4a18('0x2f')](handleError(_0x236d39,null));};exports[_0x4a18('0x69')]=function(_0x351736,_0x1b217f,_0x5e24cb){if(_0x351736[_0x4a18('0x5f')]['id']){delete _0x351736['body']['id'];}return db[_0x4a18('0x45')]['find']({'where':{'id':_0x351736[_0x4a18('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b217f,null))[_0x4a18('0x26')](function(_0x234990){if(_0x234990){_0x351736['body'][_0x4a18('0x6a')]=_0x234990['id'];return db[_0x4a18('0x6b')][_0x4a18('0x5e')](_0x351736[_0x4a18('0x5f')]);}})['then'](respondWithResult(_0x1b217f,null))[_0x4a18('0x2f')](handleError(_0x1b217f,null));};exports[_0x4a18('0x6c')]=function(_0x29ab8a,_0x41e4a0,_0x5f2a82){var _0x5360b1={'raw':![],'where':{}};var _0x1e9103={};var _0x1e9eb7={'count':0x0,'rows':[]};return db[_0x4a18('0x45')][_0x4a18('0x6d')]({'where':{'id':_0x29ab8a[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x41e4a0,null))[_0x4a18('0x26')](function(_0x411868){if(_0x411868){_0x1e9103[_0x4a18('0x49')]=_[_0x4a18('0x4b')](db[_0x4a18('0x6b')][_0x4a18('0x46')]);_0x1e9103['query']=_[_0x4a18('0x4b')](_0x29ab8a[_0x4a18('0x4a')]);_0x1e9103[_0x4a18('0x4c')]=_[_0x4a18('0x4d')](_0x1e9103[_0x4a18('0x49')],_0x1e9103['query']);_0x5360b1[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x1e9103['model'],qs[_0x4a18('0x4f')](_0x29ab8a[_0x4a18('0x4a')][_0x4a18('0x4f')]));_0x5360b1[_0x4a18('0x4e')]=_0x5360b1['attributes']['length']?_0x5360b1[_0x4a18('0x4e')]:_0x1e9103[_0x4a18('0x49')];if(!_0x29ab8a['query'][_0x4a18('0x50')](_0x4a18('0x6e'))){_0x5360b1['limit']=qs[_0x4a18('0x36')](_0x29ab8a[_0x4a18('0x4a')][_0x4a18('0x36')]);_0x5360b1[_0x4a18('0x35')]=qs[_0x4a18('0x35')](_0x29ab8a[_0x4a18('0x4a')]['offset']);}_0x5360b1[_0x4a18('0x6f')]=qs[_0x4a18('0x51')](_0x29ab8a[_0x4a18('0x4a')]['sort']);_0x5360b1[_0x4a18('0x52')]=qs['filters'](_[_0x4a18('0x70')](_0x29ab8a['query'],_0x1e9103[_0x4a18('0x4c')]));_0x5360b1['where'][_0x4a18('0x6a')]=_0x411868['id'];if(_0x29ab8a[_0x4a18('0x4a')]['filter']){_0x5360b1[_0x4a18('0x52')]=_[_0x4a18('0x53')](_0x5360b1['where'],{'$or':_['map'](_0x5360b1[_0x4a18('0x4e')],function(_0x4586c4){var _0x49894d={};_0x49894d[_0x4586c4]={'$like':'%'+_0x29ab8a['query'][_0x4a18('0x56')]+'%'};return _0x49894d;})});}_0x5360b1=_['merge']({},_0x5360b1,_0x29ab8a[_0x4a18('0x5c')]);return db[_0x4a18('0x6b')][_0x4a18('0x34')]({'where':_0x5360b1[_0x4a18('0x52')]})['then'](function(_0x46edb4){_0x1e9eb7[_0x4a18('0x34')]=_0x46edb4;if(_0x29ab8a[_0x4a18('0x4a')][_0x4a18('0x57')]){_0x5360b1['include']=[{'all':!![]}];}return db[_0x4a18('0x6b')]['findAll'](_0x5360b1);})[_0x4a18('0x26')](function(_0x1e9d55){_0x1e9eb7[_0x4a18('0x71')]=_0x1e9d55;return _0x1e9eb7;});}})[_0x4a18('0x26')](respondWithFilteredResult(_0x41e4a0,_0x5360b1))[_0x4a18('0x2f')](handleError(_0x41e4a0,null));};exports[_0x4a18('0x72')]=function(_0x1b869d,_0x5a1099,_0x5ac717){return db[_0x4a18('0x45')][_0x4a18('0x5d')]({'where':{'id':_0x1b869d[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x5a1099,null))[_0x4a18('0x26')](function(_0x501101){if(_0x501101){return _0x501101[_0x4a18('0x72')](_0x1b869d[_0x4a18('0x4a')][_0x4a18('0x73')]);}})[_0x4a18('0x26')](respondWithStatusCode(_0x5a1099,null))[_0x4a18('0x2f')](handleError(_0x5a1099,null));};exports[_0x4a18('0x74')]=function(_0x51aa26,_0x176967,_0x27f606){if(_0x51aa26[_0x4a18('0x5f')]['id']){delete _0x51aa26['body']['id'];}return db[_0x4a18('0x45')]['find']({'where':{'id':_0x51aa26['params']['id']}})['then'](handleEntityNotFound(_0x176967,null))['then'](function(_0x5b1fd6){if(_0x5b1fd6){_0x51aa26[_0x4a18('0x5f')][_0x4a18('0x6a')]=_0x5b1fd6['id'];return db[_0x4a18('0x75')]['create'](_0x51aa26[_0x4a18('0x5f')]);}})[_0x4a18('0x26')](respondWithResult(_0x176967,null))['catch'](handleError(_0x176967,null));};exports['getAnswers']=function(_0x58bcad,_0x306461,_0xebfbc5){var _0x1e2da6={'raw':![],'where':{}};var _0x10ca3a={};var _0x2187f3={'count':0x0,'rows':[]};return db[_0x4a18('0x45')]['findOne']({'where':{'id':_0x58bcad[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x306461,null))[_0x4a18('0x26')](function(_0xac910f){if(_0xac910f){_0x10ca3a[_0x4a18('0x49')]=_[_0x4a18('0x4b')](db['CannedAnswer']['rawAttributes']);_0x10ca3a[_0x4a18('0x4a')]=_['keys'](_0x58bcad['query']);_0x10ca3a['filters']=_[_0x4a18('0x4d')](_0x10ca3a[_0x4a18('0x49')],_0x10ca3a[_0x4a18('0x4a')]);_0x1e2da6[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x10ca3a['model'],qs['fields'](_0x58bcad[_0x4a18('0x4a')][_0x4a18('0x4f')]));_0x1e2da6[_0x4a18('0x4e')]=_0x1e2da6[_0x4a18('0x4e')][_0x4a18('0x76')]?_0x1e2da6[_0x4a18('0x4e')]:_0x10ca3a['model'];if(!_0x58bcad[_0x4a18('0x4a')]['hasOwnProperty'](_0x4a18('0x6e'))){_0x1e2da6[_0x4a18('0x36')]=qs[_0x4a18('0x36')](_0x58bcad['query'][_0x4a18('0x36')]);_0x1e2da6[_0x4a18('0x35')]=qs[_0x4a18('0x35')](_0x58bcad[_0x4a18('0x4a')][_0x4a18('0x35')]);}_0x1e2da6[_0x4a18('0x6f')]=qs['sort'](_0x58bcad[_0x4a18('0x4a')][_0x4a18('0x51')]);_0x1e2da6['where']=qs[_0x4a18('0x4c')](_[_0x4a18('0x70')](_0x58bcad[_0x4a18('0x4a')],_0x10ca3a[_0x4a18('0x4c')]));_0x1e2da6[_0x4a18('0x52')]['ChatWebsiteId']=_0xac910f['id'];if(_0x58bcad[_0x4a18('0x4a')][_0x4a18('0x56')]){_0x1e2da6[_0x4a18('0x52')]=_[_0x4a18('0x53')](_0x1e2da6['where'],{'$or':_['map'](_0x1e2da6['attributes'],function(_0x4d00d7){var _0x378c90={};_0x378c90[_0x4d00d7]={'$like':'%'+_0x58bcad[_0x4a18('0x4a')][_0x4a18('0x56')]+'%'};return _0x378c90;})});}_0x1e2da6=_['merge']({},_0x1e2da6,_0x58bcad[_0x4a18('0x5c')]);return db[_0x4a18('0x75')][_0x4a18('0x34')]({'where':_0x1e2da6['where']})[_0x4a18('0x26')](function(_0x5590c8){_0x2187f3['count']=_0x5590c8;if(_0x58bcad[_0x4a18('0x4a')][_0x4a18('0x57')]){_0x1e2da6['include']=[{'all':!![]}];}return db[_0x4a18('0x75')][_0x4a18('0x59')](_0x1e2da6);})[_0x4a18('0x26')](function(_0x1fe83f){_0x2187f3['rows']=_0x1fe83f;return _0x2187f3;});}})[_0x4a18('0x26')](respondWithFilteredResult(_0x306461,_0x1e2da6))[_0x4a18('0x2f')](handleError(_0x306461,null));};exports[_0x4a18('0x77')]=function(_0x10e74a,_0x5698b2,_0x2a084f){return db[_0x4a18('0x45')]['find']({'where':{'id':_0x10e74a['params']['id']}})['then'](handleEntityNotFound(_0x5698b2,null))[_0x4a18('0x26')](function(_0x439d5a){if(_0x439d5a){return _0x439d5a['removeAnswers'](_0x10e74a['query']['ids']);}})[_0x4a18('0x26')](respondWithStatusCode(_0x5698b2,null))[_0x4a18('0x2f')](handleError(_0x5698b2,null));};exports[_0x4a18('0x78')]=function(_0x541ec2,_0x26a35a,_0x4e1ed9){_0x541ec2[_0x4a18('0x5f')][_0x4a18('0x79')]=_0x541ec2[_0x4a18('0x7a')][_0x4a18('0x7b')];return db[_0x4a18('0x45')]['find']({'where':{'id':_0x541ec2['params']['id']}})['then'](handleEntityNotFound(_0x26a35a,null))['then'](saveUpdates(_0x541ec2['body'],null))[_0x4a18('0x26')](respondWithResult(_0x26a35a,null))['catch'](handleError(_0x26a35a,null));};exports[_0x4a18('0x7c')]=function(_0x5bfc54,_0x2464fd,_0x240f64){_0x5bfc54[_0x4a18('0x5f')][_0x4a18('0x7d')]=_0x5bfc54['file'][_0x4a18('0x7b')];return db[_0x4a18('0x45')]['find']({'where':{'id':_0x5bfc54['params']['id']}})['then'](handleEntityNotFound(_0x2464fd,null))['then'](saveUpdates(_0x5bfc54[_0x4a18('0x5f')],null))[_0x4a18('0x26')](respondWithResult(_0x2464fd,null))[_0x4a18('0x2f')](handleError(_0x2464fd,null));};exports[_0x4a18('0x7e')]=function(_0x186019,_0x237647,_0x12983f){_0x186019['body'][_0x4a18('0x7f')]=_0x186019[_0x4a18('0x7a')][_0x4a18('0x7b')];return db['ChatWebsite'][_0x4a18('0x5d')]({'where':{'id':_0x186019['params']['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x237647,null))[_0x4a18('0x26')](saveUpdates(_0x186019['body'],null))[_0x4a18('0x26')](respondWithResult(_0x237647,null))[_0x4a18('0x2f')](handleError(_0x237647,null));};exports['addSystemAvatar']=function(_0x38aead,_0x4277e1,_0x20ac1b){_0x38aead['body'][_0x4a18('0x80')]=_0x38aead[_0x4a18('0x7a')][_0x4a18('0x7b')];return db[_0x4a18('0x45')]['find']({'where':{'id':_0x38aead[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x4277e1,null))[_0x4a18('0x26')](saveUpdates(_0x38aead[_0x4a18('0x5f')],null))[_0x4a18('0x26')](respondWithResult(_0x4277e1,null))[_0x4a18('0x2f')](handleError(_0x4277e1,null));};exports['getLogo']=function(_0x4eb6f4,_0x2c8807,_0x2935d5){var _0x526f2f=path['join'](config[_0x4a18('0x81')],_0x4a18('0x82'));var _0x42eb73={'where':{'id':_0x4eb6f4[_0x4a18('0x5b')]['id']},'attributes':['id',_0x4a18('0x79')],'raw':!![]};var _0x36635f=![];return require(_0x4a18('0x83'))[_0x4a18('0x84')]()['then'](function(_0x2ab3de){if(_0x2ab3de){_0x36635f=_0x2ab3de[_0x4a18('0x85')];}})['then'](function(){return db[_0x4a18('0x45')][_0x4a18('0x5d')](_0x42eb73);})[_0x4a18('0x26')](handleEntityNotFound(_0x2c8807,null))[_0x4a18('0x26')](function(_0x33ee54){if(_0x33ee54){if(!_[_0x4a18('0x86')](_0x33ee54[_0x4a18('0x79')])){if(fs['existsSync'](path[_0x4a18('0x87')](config[_0x4a18('0x81')],_0x4a18('0x88'),_0x33ee54['sitepic']))&&_0x36635f){_0x526f2f=path[_0x4a18('0x87')](config[_0x4a18('0x81')],_0x4a18('0x88'),_0x33ee54[_0x4a18('0x79')]);}}return _0x2c8807[_0x4a18('0x89')](_0x526f2f);}})[_0x4a18('0x2f')](handleError(_0x2c8807,null));};exports['getAvatar']=function(_0x3f6a54,_0x3a5db5,_0x55cdae){var _0x43c47b=path[_0x4a18('0x87')](config[_0x4a18('0x81')],'server/files/images/avatars/default_avatar.png');var _0x590b0a={'where':{'id':_0x3f6a54[_0x4a18('0x5b')]['id']},'attributes':['id',_0x4a18('0x7d')],'raw':!![]};return db[_0x4a18('0x45')][_0x4a18('0x5d')](_0x590b0a)[_0x4a18('0x26')](handleEntityNotFound(_0x3a5db5,null))[_0x4a18('0x26')](function(_0x16f9fc){if(_0x16f9fc){if(!_['isNil'](_0x16f9fc[_0x4a18('0x7d')])){if(fs[_0x4a18('0x8a')](path[_0x4a18('0x87')](config[_0x4a18('0x81')],_0x4a18('0x8b'),_0x16f9fc[_0x4a18('0x7d')]))){_0x43c47b=path[_0x4a18('0x87')](config[_0x4a18('0x81')],'server/files/images/avatars/',_0x16f9fc[_0x4a18('0x7d')]);}}return _0x3a5db5[_0x4a18('0x89')](_0x43c47b);}})[_0x4a18('0x2f')](handleError(_0x3a5db5,null));};exports['getCustomerAvatar']=function(_0x4e08b1,_0x42bc5a,_0x540060){var _0x8976c4=path[_0x4a18('0x87')](config['root'],_0x4a18('0x8c'));var _0x1626b8={'where':{'id':_0x4e08b1['params']['id']},'attributes':['id',_0x4a18('0x7f'),_0x4a18('0x8d')],'raw':!![]};return db[_0x4a18('0x45')]['find'](_0x1626b8)[_0x4a18('0x26')](handleEntityNotFound(_0x42bc5a,null))[_0x4a18('0x26')](function(_0x2b24c1){if(_0x2b24c1){if(!_[_0x4a18('0x86')](_0x2b24c1[_0x4a18('0x7f')])){if(fs[_0x4a18('0x8a')](path[_0x4a18('0x87')](config['root'],_0x4a18('0x8b'),_0x2b24c1[_0x4a18('0x7f')]))&&_0x2b24c1[_0x4a18('0x8d')]){_0x8976c4=path[_0x4a18('0x87')](config['root'],'server/files/images/avatars/',_0x2b24c1['customerAvatar']);}}return _0x42bc5a[_0x4a18('0x89')](_0x8976c4);}})[_0x4a18('0x2f')](handleError(_0x42bc5a,null));};exports[_0x4a18('0x8e')]=function(_0x276877,_0x1f0e9a,_0x347eeb){var _0x3f4c6b=path['join'](config['root'],_0x4a18('0x8f'));var _0x33593b={'where':{'id':_0x276877['params']['id']},'attributes':['id',_0x4a18('0x80')],'raw':!![]};return db[_0x4a18('0x45')][_0x4a18('0x5d')](_0x33593b)[_0x4a18('0x26')](handleEntityNotFound(_0x1f0e9a,null))[_0x4a18('0x26')](function(_0x2370c){if(_0x2370c){if(!_[_0x4a18('0x86')](_0x2370c[_0x4a18('0x80')])){if(fs[_0x4a18('0x8a')](path[_0x4a18('0x87')](config[_0x4a18('0x81')],_0x4a18('0x8b'),_0x2370c[_0x4a18('0x80')]))){_0x3f4c6b=path[_0x4a18('0x87')](config[_0x4a18('0x81')],'server/files/images/avatars/',_0x2370c['systemAvatar']);}}return _0x1f0e9a[_0x4a18('0x89')](_0x3f4c6b);}})[_0x4a18('0x2f')](handleError(_0x1f0e9a,null));};exports['notify']=function(_0x2285a3,_0x2ae951,_0x374031){var _0x2d7317=require(_0x4a18('0x90'));var _0x1999bc=new _0x2d7317();var _0x3544de=_0x1999bc[_0x4a18('0x91')](_0x2285a3[_0x4a18('0x92')][_0x4a18('0x93')])['getResult']();var _0x3fe893={'body':_0x2285a3[_0x4a18('0x5f')],'channel':'chat'};var _0x48e2d4=[];var _0x224761=[];var _0x163367={};var _0x2b7d00=![];return db[_0x4a18('0x94')][_0x4a18('0x68')]()[_0x4a18('0x26')](function(_0x197171){if(!_0x197171){throw new db['Sequelize'][(_0x4a18('0x23'))](_0x4a18('0x95'));}_0x48e2d4=_[_0x4a18('0x96')](_[_0x4a18('0x4b')](_0x197171),[_0x4a18('0x97'),_0x4a18('0x98')]);_0x224761=_[_0x4a18('0x96')](_[_0x4a18('0x4b')](_0x197171),['createdAt','updatedAt',_0x4a18('0x99'),_0x4a18('0x9a')]);if(_0x2285a3[_0x4a18('0x5f')]['id']){delete _0x2285a3['body']['id'];}if(_[_0x4a18('0x86')](_0x2285a3['body'][_0x4a18('0x9b')])){throw new db[(_0x4a18('0x22'))][(_0x4a18('0x23'))](_0x4a18('0x9c'));}if(_[_0x4a18('0x86')](_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x5f')])||_0x2285a3[_0x4a18('0x5f')]['body']===''){throw new db[(_0x4a18('0x22'))][(_0x4a18('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4a18('0x86')](_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x9d')])){throw new db[(_0x4a18('0x22'))][(_0x4a18('0x23'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x224761);}if(!_['includes'](_0x224761,_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x9d')])){throw new db['Sequelize'][(_0x4a18('0x23'))](_0x4a18('0x9e')+_0x224761);}_0x163367[_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x9d')]]=_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x9b')];})[_0x4a18('0x26')](function(){return db['ChatWebsite'][_0x4a18('0x5d')]({'where':{'id':_0x2285a3['params']['id']},'include':[{'model':db[_0x4a18('0x9f')],'as':_0x4a18('0xa0'),'include':[{'model':db['CmContact'],'as':_0x4a18('0xa1'),'where':_0x163367,'limit':0x1,'order':[[_0x4a18('0x98'),'DESC']]}]},{'model':db[_0x4a18('0xa2')],'as':'Applications'}]});})[_0x4a18('0x26')](handleEntityNotFound(_0x2ae951,null))[_0x4a18('0x26')](function(_0x1b5862){if(_0x1b5862&&_0x1b5862[_0x4a18('0xa0')]){_0x3fe893[_0x4a18('0xa3')]=_0x1b5862;_0x3fe893[_0x4a18('0xa4')]=_0x1b5862[_0x4a18('0xa5')];_0x3fe893[_0x4a18('0xa6')]=_0x1b5862[_0x4a18('0xa0')];_0x3fe893['applications']=_['orderBy'](_0x3fe893[_0x4a18('0xa4')],['priority'],['asc']);if(_0x3fe893[_0x4a18('0xa3')]['Applications']){delete _0x3fe893[_0x4a18('0xa3')]['Applications'];}if(_0x3fe893[_0x4a18('0xa3')][_0x4a18('0xa0')]&&_0x3fe893[_0x4a18('0xa3')][_0x4a18('0xa0')][_0x4a18('0xa1')][_0x4a18('0x76')]){return _0x3fe893[_0x4a18('0xa3')][_0x4a18('0xa0')][_0x4a18('0xa1')][0x0];}var _0x37402a=_['defaults'](_0x2285a3['body'],{'firstName':_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x9b')],'ListId':_0x1b5862[_0x4a18('0x9a')]});_0x37402a[_0x2285a3['body'][_0x4a18('0x9d')]]=_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x9b')];return db[_0x4a18('0x94')][_0x4a18('0x5e')](_0x37402a,{'fields':_0x48e2d4,'raw':!![]});}})['then'](handleEntityNotFound(_0x2ae951,null))[_0x4a18('0x26')](function(_0x4fe4f6){_0x3fe893[_0x4a18('0xa7')]=_0x4fe4f6;var _0x5a8e1d=_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xa8')];if(_0x2285a3[_0x4a18('0x92')][_0x4a18('0xa9')]){_0x5a8e1d=_0x2285a3[_0x4a18('0x92')][_0x4a18('0xa9')];}else if(_0x2285a3[_0x4a18('0x92')]['x-forwarded-for']){_0x5a8e1d=_[_0x4a18('0xaa')](_0x2285a3['headers'][_0x4a18('0xab')]['split'](','));}if(_0x4fe4f6){var _0x2dd244={'ContactId':_0x4fe4f6['id'],'ChatWebsiteId':_0x2285a3[_0x4a18('0x5b')]['id'],'from':(_0x4fe4f6[_0x4a18('0xac')]||'')+'\x20'+(_0x4fe4f6['lastName']||''),'customerIp':_0x5a8e1d,'customerPort':_0x2285a3[_0x4a18('0x92')][_0x4a18('0xad')]?_0x2285a3[_0x4a18('0x92')][_0x4a18('0xad')]:null,'referer':_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xae')],'browserName':_0x3544de[_0x4a18('0xaf')][_0x4a18('0x40')]&&_0x3544de[_0x4a18('0xaf')][_0x4a18('0xb0')]?util[_0x4a18('0xb1')]('%s\x20%s',_0x3544de[_0x4a18('0xaf')][_0x4a18('0x40')],_0x3544de[_0x4a18('0xaf')][_0x4a18('0xb0')]):_0x4a18('0xb2'),'browserVersion':_0x3544de[_0x4a18('0xaf')][_0x4a18('0xb0')]||'unknown','osName':util[_0x4a18('0xb1')](_0x4a18('0xb3'),_0x3544de['os'][_0x4a18('0x40')],_0x3544de['os'][_0x4a18('0xb0')]),'osVersion':_0x3544de['os'][_0x4a18('0xb0')],'deviceModel':_0x3544de['device'][_0x4a18('0x49')]&&_0x3544de[_0x4a18('0xb4')][_0x4a18('0xb5')]?util[_0x4a18('0xb1')](_0x4a18('0xb6'),_0x3544de[_0x4a18('0xb4')]['model'],_0x3544de['device'][_0x4a18('0xb5')],_0x3544de[_0x4a18('0xb4')][_0x4a18('0x54')]):null,'deviceVendor':_0x3544de['device'][_0x4a18('0xb5')],'deviceType':_0x3544de[_0x4a18('0xb4')][_0x4a18('0x54')],'formData':JSON[_0x4a18('0xb7')](_0x2285a3[_0x4a18('0x5f')])};var _0x36dfd0={'ChatWebsiteId':_0x2285a3[_0x4a18('0x5b')]['id'],'closed':![]};if(_0x2285a3['body'][_0x4a18('0xb8')]){_0x36dfd0[_0x4a18('0xb8')]=_0x2285a3['body'][_0x4a18('0xb8')];return db[_0x4a18('0xb9')][_0x4a18('0x5d')]({'where':_0x36dfd0})['then'](function(_0x3d380){if(_0x3d380){return[_0x3d380,![]];}_0x2dd244[_0x4a18('0xb8')]=_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xb8')];_0x2dd244[_0x4a18('0xba')]=_0x2285a3['body'][_0x4a18('0xba')];return db[_0x4a18('0xb9')]['create'](_0x2dd244)['then'](function(_0x3f698f){return[_0x3f698f,!![]];});});}_0x36dfd0[_0x4a18('0xbb')]=_0x4fe4f6['id'];if(_0x2285a3[_0x4a18('0x5f')]['interaction']&&_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xbc')]['id']){_0x36dfd0['id']=_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xbc')]['id'];return db['ChatInteraction'][_0x4a18('0x5d')]({'where':_0x36dfd0})[_0x4a18('0x26')](function(_0x2b6a1f){if(_0x2b6a1f){return[_0x2b6a1f,![]];}return db[_0x4a18('0xb9')]['create'](_0x2dd244)[_0x4a18('0x26')](function(_0x5edcb2){return[_0x5edcb2,!![]];});});}return db[_0x4a18('0xb9')]['create'](_0x2dd244)[_0x4a18('0x26')](function(_0x5c9f0a){return[_0x5c9f0a,!![]];});}})['spread'](function(_0x550ce6,_0x688d6){if(_0x550ce6){_0x2b7d00=_0x688d6;if(!_0x688d6){var _0x344286={'from':(_0x3fe893[_0x4a18('0xa7')]['firstName']||'')+'\x20'+(_0x3fe893['contact'][_0x4a18('0xbd')]||'')};if(_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xb8')]&&_0x2285a3[_0x4a18('0x5f')]['messageId']&&_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xb8')]!=_0x2285a3[_0x4a18('0x5f')]['messageId']){_0x344286[_0x4a18('0xb8')]=_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xbe')];}return _0x550ce6[_0x4a18('0x67')](_0x344286);}else{return _0x550ce6;}}})[_0x4a18('0x26')](function(_0xb54b2d){_0x3fe893['interaction']=_0xb54b2d['get']({'plain':!![]});_0x3fe893[_0x4a18('0xbc')]['created']=_0x2b7d00;if(_0x3fe893['interaction'][_0x4a18('0xbf')]){if(_0x3fe893[_0x4a18('0xa3')]['autoclose']){_0x3fe893[_0x4a18('0xa4')][_0x4a18('0xc0')]({'id':0x0,'priority':_0x3fe893[_0x4a18('0xa4')][_0x4a18('0x76')]+0x1,'app':_0x4a18('0xc1'),'appdata':'unmanaged','interval':_0x4a18('0xc2')});}}return db[_0x4a18('0xc3')][_0x4a18('0x5e')]({'body':_0x2285a3[_0x4a18('0x5f')][_0x4a18('0x5f')],'ChatWebsiteId':_0x2285a3[_0x4a18('0x5b')]['id'],'ChatInteractionId':_0xb54b2d['id'],'direction':'in','ContactId':_0x3fe893[_0x4a18('0xa7')]['id'],'AttachmentId':_0x2285a3[_0x4a18('0x5f')][_0x4a18('0xc4')]});})[_0x4a18('0x26')](function(_0x2b0f28){_0x3fe893[_0x4a18('0x2d')]=_0x2b0f28;if(_0x3fe893['interaction'][_0x4a18('0xc5')]){return db['User'][_0x4a18('0x5d')]({'attributes':['id',_0x4a18('0x40')],'where':{'id':_0x3fe893[_0x4a18('0xbc')]['UserId']}})[_0x4a18('0x26')](function(_0x41b97e){if(_0x41b97e){_0x3fe893['applications'][_0x4a18('0xc6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x41b97e[_0x4a18('0x40')]+','+(_0x3fe893[_0x4a18('0xa3')][_0x4a18('0xc7')]||0xa),'interval':_0x4a18('0xc2')});_0x3fe893['forcedOwnership']=!![];}return respondWithRpcPromise('Start','startRouting',_0x3fe893);});}return respondWithRpcPromise(_0x4a18('0xc8'),'startRouting',_0x3fe893);})[_0x4a18('0x26')](function(_0x5589c4){respondWithRpcPromise(_0x4a18('0xc9'),_0x4a18('0xc9'),{'event':'notify','message':_0x5589c4},client9002);return _0x5589c4;})[_0x4a18('0x26')](respondWithResult(_0x2ae951,null))[_0x4a18('0x2f')](handleError(_0x2ae951,null));};exports[_0x4a18('0xca')]=function(_0x43211a,_0x230f54,_0x1c6287){var _0x2e57fa,_0x274753,_0x57b046;var _0x1ae535=[];var _0xee125b=[];var _0x50246f={};return db['CmContact'][_0x4a18('0x68')]()[_0x4a18('0x26')](function(_0x8ada09){if(!_0x8ada09){throw new db[(_0x4a18('0x22'))][(_0x4a18('0x23'))](_0x4a18('0x95'));}_0xee125b=_['difference'](_[_0x4a18('0x4b')](_0x8ada09),['createdAt','updatedAt']);_0x1ae535=_[_0x4a18('0x96')](_[_0x4a18('0x4b')](_0x8ada09),[_0x4a18('0x97'),_0x4a18('0x98'),_0x4a18('0x99'),_0x4a18('0x9a')]);if(_0x43211a[_0x4a18('0x5f')]['id']){delete _0x43211a['body']['id'];}if(_[_0x4a18('0x86')](_0x43211a[_0x4a18('0x5f')][_0x4a18('0x9b')])){throw _0x230f54['status'](0x1f4)[_0x4a18('0xcb')](new db[(_0x4a18('0x22'))][(_0x4a18('0x23'))](_0x4a18('0x9c')));}if(_[_0x4a18('0x86')](_0x43211a[_0x4a18('0x5f')][_0x4a18('0x5f')])||_0x43211a[_0x4a18('0x5f')][_0x4a18('0x5f')]===''){throw _0x230f54[_0x4a18('0x31')](0x1f4)[_0x4a18('0xcb')](new db['Sequelize'][(_0x4a18('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x43211a['body'][_0x4a18('0xcc')])){throw _0x230f54[_0x4a18('0x31')](0x1f4)[_0x4a18('0xcb')](new db[(_0x4a18('0x22'))]['ValidationError'](_0x4a18('0xcd')+_0x1ae535));}if(!_[_0x4a18('0xce')](_0x1ae535,_0x43211a[_0x4a18('0x5f')][_0x4a18('0xcc')])){throw _0x230f54[_0x4a18('0x31')](0x1f4)[_0x4a18('0xcb')](new db[(_0x4a18('0x22'))]['ValidationError'](_0x4a18('0xcf')+_0x1ae535));}_0x50246f[_0x43211a[_0x4a18('0x5f')][_0x4a18('0xcc')]]=_0x43211a[_0x4a18('0x5f')][_0x4a18('0x9b')];})[_0x4a18('0x26')](function(){return db['ChatWebsite'][_0x4a18('0x5d')]({'where':{'id':_0x43211a[_0x4a18('0x5b')]['id']},'include':[{'model':db[_0x4a18('0x9f')],'as':_0x4a18('0xa0')}]});})['then'](handleEntityNotFound(_0x230f54,null))[_0x4a18('0x26')](function(_0x32bc80){if(_0x32bc80&&_0x32bc80[_0x4a18('0xa0')]){_0x274753=_0x32bc80;var _0x333ec4=_['defaults'](_0x43211a[_0x4a18('0x5f')],{'firstName':_0x43211a[_0x4a18('0x5f')]['from'],'phone':_0x43211a[_0x4a18('0x5f')][_0x4a18('0x9b')],'ListId':_0x32bc80[_0x4a18('0x9a')]});_0x333ec4[_0x43211a[_0x4a18('0x5f')][_0x4a18('0xcc')]]=_0x43211a[_0x4a18('0x5f')][_0x4a18('0x9b')];return db[_0x4a18('0x94')][_0x4a18('0xd0')]({'where':_0x50246f,'defaults':_0x333ec4});}})[_0x4a18('0xd1')](function(_0x4573dc){if(_0x4573dc){_0x57b046=_0x4573dc;var _0x1fec4e=fs['readFileSync'](path[_0x4a18('0x87')](config[_0x4a18('0x81')],'server/files/templates/chatOfflineMessage.ejs'),_0x4a18('0xd2'));var _0x26a05a=ejs['render'](_0x1fec4e,{'body':_[_0x4a18('0xd3')](_0x43211a['body'][_0x4a18('0x5f')]),'bodyTitle':_0x274753[_0x4a18('0xd4')]});return db[_0x4a18('0xd5')]['create']({'body':_0x26a05a,'ContactId':_0x4573dc['id'],'ChatWebsiteId':_0x274753['id']});}})[_0x4a18('0x26')](function(_0x38bf47){if(_0x38bf47){_0x2e57fa=_0x38bf47;return db[_0x4a18('0xd6')][_0x4a18('0x6d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4a18('0xd7'),'raw':!![]}]});}})[_0x4a18('0x26')](function(_0x205494){if(_0x205494&&_0x205494[_0x4a18('0xd7')]&&_0x274753['forwardOfflineAddress']){var _0x210eab={'tls':{'rejectUnauthorized':![]}};if(_0x205494[_0x4a18('0xd7')][_0x4a18('0xd8')]){_0x210eab[_0x4a18('0xd8')]=_0x205494['Smtp'][_0x4a18('0xd8')];}else{_0x210eab[_0x4a18('0xd9')]=_0x205494[_0x4a18('0xd7')][_0x4a18('0xd9')];_0x210eab[_0x4a18('0xda')]=_0x205494[_0x4a18('0xd7')][_0x4a18('0xda')];_0x210eab['secure']=_0x205494[_0x4a18('0xd7')][_0x4a18('0xdb')];}if(_0x205494[_0x4a18('0xd7')][_0x4a18('0xdc')]){_0x210eab[_0x4a18('0xdd')]={'user':_0x205494[_0x4a18('0xd7')][_0x4a18('0x60')],'pass':_0x205494[_0x4a18('0xd7')][_0x4a18('0xde')]};}return respondWithRpcPromise(_0x4a18('0xdf'),_0x4a18('0xe0'),{'account':_0x210eab,'message':{'from':util['format'](_0x4a18('0xe1'),_0x205494[_0x4a18('0x40')],_0x205494[_0x4a18('0xe2')]||_0x205494[_0x4a18('0xd7')][_0x4a18('0x60')]),'to':_0x274753['forwardOfflineAddress'],'subject':_0x274753[_0x4a18('0xe3')],'text':_0x2e57fa[_0x4a18('0x5f')]}},client9003)[_0x4a18('0x26')](function(){return _0x2e57fa;})['catch'](function(_0x439523){console['error'](_0x439523);});}})[_0x4a18('0x26')](function(){if(_0x2e57fa){return _0x2e57fa;}})[_0x4a18('0x26')](respondWithResult(_0x230f54,null))[_0x4a18('0x2f')](handleError(_0x230f54,null));};exports['addInteraction']=function(_0x5e6920,_0x25cc4a,_0x47a0ff){return db[_0x4a18('0xb9')][_0x4a18('0x5d')]({'where':{'id':_0x5e6920[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x25cc4a,null))[_0x4a18('0x26')](function(_0x395c3e){if(_0x395c3e){return _0x395c3e['addInteraction'](_0x5e6920[_0x4a18('0x5f')][_0x4a18('0x73')],_[_0x4a18('0xe4')](_0x5e6920[_0x4a18('0x5f')],[_0x4a18('0x73'),'id'])||{});}})['then'](respondWithResult(_0x25cc4a,null))[_0x4a18('0x2f')](handleError(_0x25cc4a,null));};exports['getInteractions']=function(_0x5234a5,_0x3c2ff1,_0x3378f6){var _0x4e244d={'raw':![],'where':{}};var _0x1a16d8={};var _0x37e76d={'count':0x0,'rows':[]};return db[_0x4a18('0x45')]['findOne']({'where':{'id':_0x5234a5[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x3c2ff1,null))[_0x4a18('0x26')](function(_0x17194e){if(_0x17194e){_0x1a16d8[_0x4a18('0x49')]=_['keys'](db[_0x4a18('0xb9')][_0x4a18('0x46')]);_0x1a16d8[_0x4a18('0x4a')]=_[_0x4a18('0x4b')](_0x5234a5[_0x4a18('0x4a')]);_0x1a16d8[_0x4a18('0x4c')]=_['intersection'](_0x1a16d8[_0x4a18('0x49')],_0x1a16d8[_0x4a18('0x4a')]);_0x4e244d[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x1a16d8[_0x4a18('0x49')],qs[_0x4a18('0x4f')](_0x5234a5[_0x4a18('0x4a')][_0x4a18('0x4f')]));_0x4e244d['attributes']=_0x4e244d[_0x4a18('0x4e')][_0x4a18('0x76')]?_0x4e244d['attributes']:_0x1a16d8[_0x4a18('0x49')];if(!_0x5234a5[_0x4a18('0x4a')][_0x4a18('0x50')]('nolimit')){_0x4e244d[_0x4a18('0x36')]=qs[_0x4a18('0x36')](_0x5234a5['query'][_0x4a18('0x36')]);_0x4e244d[_0x4a18('0x35')]=qs['offset'](_0x5234a5[_0x4a18('0x4a')]['offset']);}_0x4e244d[_0x4a18('0x6f')]=qs[_0x4a18('0x51')](_0x5234a5[_0x4a18('0x4a')][_0x4a18('0x51')]);_0x4e244d[_0x4a18('0x52')]=qs['filters'](_['pick'](_0x5234a5[_0x4a18('0x4a')],_0x1a16d8[_0x4a18('0x4c')]));_0x4e244d[_0x4a18('0x52')][_0x4a18('0x6a')]=_0x17194e['id'];if(_0x5234a5['query'][_0x4a18('0x56')]){_0x4e244d[_0x4a18('0x52')]=_[_0x4a18('0x53')](_0x4e244d['where'],{'$or':_[_0x4a18('0x44')](_0x4e244d['attributes'],function(_0x403d11){var _0x1199bf={};_0x1199bf[_0x403d11]={'$like':'%'+_0x5234a5[_0x4a18('0x4a')]['filter']+'%'};return _0x1199bf;})});}_0x4e244d=_['merge']({},_0x4e244d,_0x5234a5[_0x4a18('0x5c')]);return db[_0x4a18('0xb9')][_0x4a18('0x34')]({'where':_0x4e244d[_0x4a18('0x52')]})['then'](function(_0xadffda){_0x37e76d['count']=_0xadffda;if(_0x5234a5[_0x4a18('0x4a')]['includeAll']){_0x4e244d[_0x4a18('0x58')]=[{'model':db['CmContact'],'as':_0x4a18('0xe5'),'required':![]},{'model':db['User'],'as':_0x4a18('0xe6'),'attributes':[_0x4a18('0x40'),_0x4a18('0xe7'),'internal'],'required':![]},{'model':db[_0x4a18('0xe8')],'as':'Tags','attributes':['id',_0x4a18('0x40'),_0x4a18('0xe9')],'where':_0x5234a5[_0x4a18('0x4a')][_0x4a18('0xea')]?{'id':_0x5234a5[_0x4a18('0x4a')][_0x4a18('0xea')]}:undefined,'required':_0x5234a5['query'][_0x4a18('0xea')]?!![]:![]}];}return db[_0x4a18('0xb9')][_0x4a18('0x59')](_0x4e244d);})[_0x4a18('0x26')](function(_0x17fbb2){_0x37e76d[_0x4a18('0x71')]=_0x17fbb2;return _0x37e76d;});}})[_0x4a18('0x26')](respondWithFilteredResult(_0x3c2ff1,_0x4e244d))[_0x4a18('0x2f')](handleError(_0x3c2ff1,null));};function iftimePromise(_0x2c673c,_0x573883){return respondWithRpcPromise(_0x4a18('0xeb'),_0x4a18('0xec'),{'command':_0x573883[_0x4a18('0xed')]?util['format'](_0x4a18('0xee'),_0x2c673c['interval'],_0x573883['timezone']):util[_0x4a18('0xb1')](_0x4a18('0xef'),_0x2c673c[_0x4a18('0xf0')])},client9002)['then'](function(_0x5378c0){var _0xd09cb=_0x5378c0&&_0x5378c0[_0x4a18('0xf1')](_0x4a18('0xf2'))>=0x0?!![]:![];logger['info'](_0x4a18('0xf3'),_0x573883['id'],_0x2c673c['id'],_0x2c673c[_0x4a18('0xf0')],_0xd09cb?_0x4a18('0xf4'):_0x4a18('0xf5'),_0x573883[_0x4a18('0xed')]?_0x573883['timezone']:_0x4a18('0xf6'));return _0xd09cb;})['catch'](function(_0x564dff){logger[_0x4a18('0x2b')](_0x4a18('0xf3'),_0x573883['id'],_0x2c673c['id'],_0x2c673c[_0x4a18('0xf0')],util[_0x4a18('0xf7')](_0x564dff,{'showHidden':![],'depth':null}),_0x573883[_0x4a18('0xed')]?_0x573883[_0x4a18('0xed')]:_0x4a18('0xf6'));return![];});}exports[_0x4a18('0xec')]=function(_0x5dc8ce,_0x31942a,_0x394c5c){var _0x237a0e=0x0;var _0x344ed7=0x0;var _0x4a2a39=![];var _0x4ae27d;var _0x55e24f;return db[_0x4a18('0x45')][_0x4a18('0x5d')]({'where':{'id':_0x5dc8ce[_0x4a18('0x5b')]['id']},'include':[{'model':db[_0x4a18('0xf8')],'as':_0x4a18('0xf8'),'include':[{'model':db['Interval'],'as':_0x4a18('0xf9'),'attributes':['id',_0x4a18('0xf0')],'raw':!![]}]}]})[_0x4a18('0x26')](handleEntityNotFound(_0x31942a,null))[_0x4a18('0x26')](function(_0x4a8075){if(_0x4a8075){_0x4ae27d=_0x4a8075;return _0x4a8075[_0x4a18('0xfa')]({'raw':!![]});}})['then'](function(_0x5aa50e){if(_0x4ae27d){if(_0x5aa50e){_0x55e24f=_0x5aa50e;}}return require(_0x4a18('0x83'))[_0x4a18('0x84')]();})[_0x4a18('0x26')](function(_0x3d52d9){if(_0x3d52d9){_0x344ed7=_0x3d52d9[_0x4a18('0xfb')];_0x4a2a39=_0x3d52d9[_0x4a18('0x85')];}})[_0x4a18('0x26')](function(){return db[_0x4a18('0xb9')][_0x4a18('0x34')]({'where':{'closed':![]}});})[_0x4a18('0x26')](function(_0x74627a){_0x237a0e=_0x74627a;if(_0x344ed7&&_0x74627a>_0x344ed7){return db[_0x4a18('0xfc')][_0x4a18('0x6d')]({'where':{'id':0x1}})['then'](function(_0x4c6c3b){if(_0x4c6c3b){_0x4c6c3b[_0x4a18('0xfd')](_0x4a18('0xfe'));}});}})[_0x4a18('0x26')](function(){if(_0x4ae27d[_0x4a18('0xf8')]&&_0x4ae27d['Interval']['Intervals']){var _0x54b204=[];for(var _0x18fc52=0x0;_0x18fc52<_0x4ae27d[_0x4a18('0xf8')][_0x4a18('0xf9')][_0x4a18('0x76')];_0x18fc52++){var _0x573ee5=_0x4ae27d[_0x4a18('0xf8')][_0x4a18('0xf9')][_0x18fc52][_0x4a18('0x61')]({'plain':!![]});_0x54b204[_0x4a18('0xc0')](iftimePromise(_0x573ee5,_0x4ae27d));}return BPromise[_0x4a18('0xff')](_0x54b204)[_0x4a18('0x26')](function(_0x44dc71){return _[_0x4a18('0x100')](_0x44dc71);});}else{return!![];}})[_0x4a18('0x26')](function(_0x3add95){var _0x134aa2=fs['readFileSync'](path['join'](config[_0x4a18('0x81')],_0x4a18('0x101')),'utf8');var _0x329fe4={'remote':_0x4ae27d[_0x4a18('0x102')],'query':querystring[_0x4a18('0xb7')](_['merge'](_0x4ae27d[_0x4a18('0x61')]({'plain':!![]}),{'customerIp':_0x5dc8ce[_0x4a18('0x92')][_0x4a18('0xab')]||_0x5dc8ce[_0x4a18('0x92')]['x-real-ip']||_0x5dc8ce[_0x4a18('0x103')][_0x4a18('0x104')]||_0x5dc8ce['ip'],'referer':_0x5dc8ce[_0x4a18('0x92')][_0x4a18('0xae')],'openedInteractions':_0x237a0e,'maxInteractions':_0x344ed7,'virtual':_0x4a2a39['virtual'],'online':_0x3add95,'custom':_0x4a2a39}))['replace'](/'/g,'\x5c\x27')};_0x31942a[_0x4a18('0xcb')](ejs[_0x4a18('0x105')](Mustache[_0x4a18('0x105')](_0x134aa2,_0x329fe4),{'proactiveActions':_0x55e24f,'alignment':_0x4ae27d[_0x4a18('0x106')],'verticalAlignment':_0x4ae27d[_0x4a18('0x107')],'div_color':_0x4ae27d['color'],'text_color':_0x4ae27d[_0x4a18('0x108')]}));})[_0x4a18('0x2f')](handleError(_0x31942a,null));};exports[_0x4a18('0x109')]=function(_0x38d9ba,_0x9dcbcb,_0x47466e){return db['ChatWebsite']['findOne']({'where':{'id':_0x38d9ba[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x9dcbcb,null))[_0x4a18('0x26')](function(_0x564f0c){if(_0x564f0c){return db[_0x4a18('0x10a')][_0x4a18('0x10b')](function(_0x23e649){return db[_0x4a18('0xa2')]['destroy']({'where':{'ChatWebsiteId':_0x38d9ba['params']['id']},'transaction':_0x23e649})[_0x4a18('0x26')](function(_0x55a457){var _0x565991=_[_0x4a18('0x44')](_0x38d9ba[_0x4a18('0x5f')],function(_0x3418f6){_0x3418f6[_0x4a18('0x6a')]=_0x38d9ba[_0x4a18('0x5b')]['id'];return _0x3418f6;});return db[_0x4a18('0xa2')][_0x4a18('0x10c')](_0x565991,{'transaction':_0x23e649});});})[_0x4a18('0x26')](function(){return db[_0x4a18('0xa2')][_0x4a18('0x10d')]({'where':{'ChatWebsiteId':_0x38d9ba[_0x4a18('0x5b')]['id']},'order':_0x4a18('0x10e')});});}})[_0x4a18('0x26')](respondWithResult(_0x9dcbcb,null))[_0x4a18('0x2f')](handleError(_0x9dcbcb,null));};exports[_0x4a18('0x10f')]=function(_0xb2d8a9,_0x122d7b,_0x13d653){var _0x12bec7={};var _0x491f8c={};var _0x5c4aef;var _0x378341;return db[_0x4a18('0x45')][_0x4a18('0x6d')]({'where':{'id':_0xb2d8a9[_0x4a18('0x5b')]['id']}})['then'](handleEntityNotFound(_0x122d7b,null))[_0x4a18('0x26')](function(_0x22153c){if(_0x22153c){_0x5c4aef=_0x22153c;_0x491f8c['model']=_['keys'](db[_0x4a18('0xa2')][_0x4a18('0x46')]);_0x491f8c['query']=_[_0x4a18('0x4b')](_0xb2d8a9[_0x4a18('0x4a')]);_0x491f8c['filters']=_['intersection'](_0x491f8c[_0x4a18('0x49')],_0x491f8c[_0x4a18('0x4a')]);_0x12bec7[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x491f8c[_0x4a18('0x49')],qs[_0x4a18('0x4f')](_0xb2d8a9[_0x4a18('0x4a')][_0x4a18('0x4f')]));_0x12bec7[_0x4a18('0x4e')]=_0x12bec7[_0x4a18('0x4e')][_0x4a18('0x76')]?_0x12bec7[_0x4a18('0x4e')]:_0x491f8c[_0x4a18('0x49')];_0x12bec7[_0x4a18('0x6f')]=qs[_0x4a18('0x51')](_0xb2d8a9[_0x4a18('0x4a')][_0x4a18('0x51')]);_0x12bec7[_0x4a18('0x52')]=qs[_0x4a18('0x4c')](_[_0x4a18('0x70')](_0xb2d8a9[_0x4a18('0x4a')],_0x491f8c[_0x4a18('0x4c')]));if(_0xb2d8a9[_0x4a18('0x4a')][_0x4a18('0x56')]){_0x12bec7['where']=_['merge'](_0x12bec7[_0x4a18('0x52')],{'$or':_[_0x4a18('0x44')](_0x12bec7[_0x4a18('0x4e')],function(_0x40e3b3){var _0x439e4d={};_0x439e4d[_0x40e3b3]={'$like':'%'+_0xb2d8a9[_0x4a18('0x4a')][_0x4a18('0x56')]+'%'};return _0x439e4d;})});}_0x12bec7=_[_0x4a18('0x53')]({},_0x12bec7,_0xb2d8a9[_0x4a18('0x5c')]);return _0x5c4aef[_0x4a18('0x10f')](_0x12bec7);}})[_0x4a18('0x26')](function(_0x4982c8){if(_0x4982c8){_0x378341=_0x4982c8['length'];if(!_0xb2d8a9[_0x4a18('0x4a')][_0x4a18('0x50')]('nolimit')){_0x12bec7[_0x4a18('0x36')]=qs['limit'](_0xb2d8a9['query'][_0x4a18('0x36')]);_0x12bec7['offset']=qs['offset'](_0xb2d8a9[_0x4a18('0x4a')][_0x4a18('0x35')]);}return _0x5c4aef[_0x4a18('0x10f')](_0x12bec7);}})[_0x4a18('0x26')](function(_0x1f9942){if(_0x1f9942){return _0x1f9942?{'count':_0x378341,'rows':_0x1f9942}:null;}})[_0x4a18('0x26')](respondWithResult(_0x122d7b,null))[_0x4a18('0x2f')](handleError(_0x122d7b,null));};exports['addProactiveActions']=function(_0x556dc9,_0x3bc53e,_0x2b8b6b){return db['chatProactiveAction']['find']({'where':{'id':_0x556dc9['params']['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x3bc53e,null))[_0x4a18('0x26')](function(_0x2af267){if(_0x2af267){return _0x2af267[_0x4a18('0x110')](_0x556dc9[_0x4a18('0x5f')]['ids'],_[_0x4a18('0xe4')](_0x556dc9[_0x4a18('0x5f')],[_0x4a18('0x73'),'id'])||{});}})[_0x4a18('0x26')](respondWithResult(_0x3bc53e,null))[_0x4a18('0x2f')](handleError(_0x3bc53e,null));};exports[_0x4a18('0xfa')]=function(_0x5d984c,_0x11f41e,_0x1685a3){var _0x3b2315={};var _0x6f95b9={};var _0x1f695c;var _0x2ca1f6;return db[_0x4a18('0x45')][_0x4a18('0x6d')]({'where':{'id':_0x5d984c[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x11f41e,null))[_0x4a18('0x26')](function(_0x33c41e){if(_0x33c41e){_0x1f695c=_0x33c41e;_0x6f95b9[_0x4a18('0x49')]=_[_0x4a18('0x4b')](db[_0x4a18('0x111')]['rawAttributes']);_0x6f95b9[_0x4a18('0x4a')]=_[_0x4a18('0x4b')](_0x5d984c[_0x4a18('0x4a')]);_0x6f95b9[_0x4a18('0x4c')]=_[_0x4a18('0x4d')](_0x6f95b9[_0x4a18('0x49')],_0x6f95b9[_0x4a18('0x4a')]);_0x3b2315[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x6f95b9['model'],qs[_0x4a18('0x4f')](_0x5d984c[_0x4a18('0x4a')]['fields']));_0x3b2315[_0x4a18('0x4e')]=_0x3b2315[_0x4a18('0x4e')][_0x4a18('0x76')]?_0x3b2315['attributes']:_0x6f95b9['model'];_0x3b2315[_0x4a18('0x6f')]=qs[_0x4a18('0x51')](_0x5d984c[_0x4a18('0x4a')][_0x4a18('0x51')]);_0x3b2315['where']=qs[_0x4a18('0x4c')](_[_0x4a18('0x70')](_0x5d984c[_0x4a18('0x4a')],_0x6f95b9[_0x4a18('0x4c')]));if(_0x5d984c['query']['filter']){_0x3b2315['where']=_[_0x4a18('0x53')](_0x3b2315[_0x4a18('0x52')],{'$or':_[_0x4a18('0x44')](_0x3b2315[_0x4a18('0x4e')],function(_0x3cec07){var _0x89dec8={};_0x89dec8[_0x3cec07]={'$like':'%'+_0x5d984c[_0x4a18('0x4a')][_0x4a18('0x56')]+'%'};return _0x89dec8;})});}_0x3b2315=_[_0x4a18('0x53')]({},_0x3b2315,_0x5d984c[_0x4a18('0x5c')]);return _0x1f695c[_0x4a18('0xfa')](_0x3b2315);}})[_0x4a18('0x26')](function(_0x483abf){if(_0x483abf){_0x2ca1f6=_0x483abf[_0x4a18('0x76')];if(!_0x5d984c['query'][_0x4a18('0x50')](_0x4a18('0x6e'))){_0x3b2315[_0x4a18('0x36')]=qs[_0x4a18('0x36')](_0x5d984c[_0x4a18('0x4a')]['limit']);_0x3b2315[_0x4a18('0x35')]=qs[_0x4a18('0x35')](_0x5d984c['query']['offset']);}return _0x1f695c[_0x4a18('0xfa')](_0x3b2315);}})['then'](function(_0x47b0e5){if(_0x47b0e5){return _0x47b0e5?{'count':_0x2ca1f6,'rows':_0x47b0e5}:null;}})[_0x4a18('0x26')](respondWithResult(_0x11f41e,null))['catch'](handleError(_0x11f41e,null));};exports[_0x4a18('0x112')]=function(_0x566918,_0x2986cb,_0x55fc5c){var _0xf15e2=_0x566918[_0x4a18('0x4a')]['online']===_0x4a18('0x113')?_0x4a18('0x114'):_0x4a18('0x115');return db['ChatWebsite'][_0x4a18('0x5d')]({'attributes':['id',_0xf15e2],'where':{'id':_0x566918['params']['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x2986cb,null))[_0x4a18('0x26')](function(_0x5a0a8c){if(_0x5a0a8c){var _0x3c8d12=_0x5a0a8c[_0xf15e2];var _0x3e6cf8=_0x3c8d12&&_0x3c8d12[_0x4a18('0x116')]?_0x3c8d12[_0x4a18('0x116')]:[];_0x2986cb[_0x4a18('0xcb')]({'fromKey':_['isNil'](_0x3c8d12[_0x4a18('0x117')])?undefined:_0x3c8d12[_0x4a18('0x117')],'count':_0x3e6cf8[_0x4a18('0x76')],'rows':_0x3e6cf8});}})['catch'](handleError(_0x2986cb,null));};exports[_0x4a18('0x118')]=function(_0x474494,_0x565ea6,_0x1aa486){var _0x59fd68={'raw':![],'where':{}};var _0x21e346={};var _0x374829={'count':0x0,'rows':[]};return db[_0x4a18('0x45')][_0x4a18('0x6d')]({'where':{'id':_0x474494[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x565ea6,null))[_0x4a18('0x26')](function(_0x1cba81){if(_0x1cba81){_0x21e346[_0x4a18('0x49')]=_['keys'](db['ChatOfflineMessage'][_0x4a18('0x46')]);_0x21e346[_0x4a18('0x4a')]=_['keys'](_0x474494[_0x4a18('0x4a')]);_0x21e346[_0x4a18('0x4c')]=_[_0x4a18('0x4d')](_0x21e346[_0x4a18('0x49')],_0x21e346[_0x4a18('0x4a')]);_0x59fd68[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x21e346[_0x4a18('0x49')],qs[_0x4a18('0x4f')](_0x474494['query'][_0x4a18('0x4f')]));_0x59fd68[_0x4a18('0x4e')]=_0x59fd68[_0x4a18('0x4e')][_0x4a18('0x76')]?_0x59fd68['attributes']:_0x21e346[_0x4a18('0x49')];if(!_0x474494[_0x4a18('0x4a')]['hasOwnProperty'](_0x4a18('0x6e'))){_0x59fd68[_0x4a18('0x36')]=qs[_0x4a18('0x36')](_0x474494[_0x4a18('0x4a')]['limit']);_0x59fd68['offset']=qs['offset'](_0x474494['query'][_0x4a18('0x35')]);}_0x59fd68[_0x4a18('0x6f')]=qs[_0x4a18('0x51')](_0x474494['query'][_0x4a18('0x51')]);_0x59fd68[_0x4a18('0x52')]=qs[_0x4a18('0x4c')](_[_0x4a18('0x70')](_0x474494[_0x4a18('0x4a')],_0x21e346[_0x4a18('0x4c')]));_0x59fd68[_0x4a18('0x52')][_0x4a18('0x6a')]=_0x1cba81['id'];if(_0x474494[_0x4a18('0x4a')][_0x4a18('0x56')]){_0x59fd68[_0x4a18('0x52')]=_[_0x4a18('0x53')](_0x59fd68[_0x4a18('0x52')],{'$or':_[_0x4a18('0x44')](_0x59fd68[_0x4a18('0x4e')],function(_0x3da033){var _0x5275d0={};_0x5275d0[_0x3da033]={'$like':'%'+_0x474494[_0x4a18('0x4a')][_0x4a18('0x56')]+'%'};return _0x5275d0;})});}_0x59fd68=_['merge']({},_0x59fd68,_0x474494[_0x4a18('0x5c')]);return db[_0x4a18('0xd5')][_0x4a18('0x34')]({'where':_0x59fd68[_0x4a18('0x52')]})[_0x4a18('0x26')](function(_0x3ce0b6){_0x374829['count']=_0x3ce0b6;if(_0x474494[_0x4a18('0x4a')][_0x4a18('0x57')]){_0x59fd68[_0x4a18('0x58')]=[{'all':!![]}];}else{_0x59fd68[_0x4a18('0x58')]=[{'model':db[_0x4a18('0x94')],'as':_0x4a18('0xe5'),'required':![]}];}return db[_0x4a18('0xd5')][_0x4a18('0x59')](_0x59fd68);})['then'](function(_0xa51a47){_0x374829[_0x4a18('0x71')]=_0xa51a47;return _0x374829;});}})[_0x4a18('0x26')](respondWithFilteredResult(_0x565ea6,_0x59fd68))[_0x4a18('0x2f')](handleError(_0x565ea6,null));};exports[_0x4a18('0x119')]=function(_0x22bd00,_0x49e1f6,_0x6750ff){return db[_0x4a18('0x45')]['find']({'where':{'id':_0x22bd00['params']['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x49e1f6,null))['then'](function(_0x513991){if(_0x513991){return _0x513991[_0x4a18('0x119')](_0x22bd00[_0x4a18('0x5f')]['ids'],_[_0x4a18('0xe4')](_0x22bd00['body'],[_0x4a18('0x73'),'id'])||{})['spread'](function(_0x1a3994){for(var _0x3560c0=0x0;_0x3560c0<_0x22bd00[_0x4a18('0x5f')][_0x4a18('0x73')]['length'];_0x3560c0+=0x1){socket[_0x4a18('0x11a')]('userChatWebsite:save',{'UserId':_0x22bd00[_0x4a18('0x5f')][_0x4a18('0x73')][_0x3560c0],'ChatWebsiteId':_0x22bd00[_0x4a18('0x5b')]['id']});}return _0x1a3994;});}})[_0x4a18('0x26')](respondWithResult(_0x49e1f6,null))[_0x4a18('0x2f')](handleError(_0x49e1f6,null));};exports[_0x4a18('0x11b')]=function(_0x34ab63,_0x42d46d,_0x11a8b5){return db[_0x4a18('0x45')]['find']({'where':{'id':_0x34ab63[_0x4a18('0x5b')]['id']}})[_0x4a18('0x26')](handleEntityNotFound(_0x42d46d,null))[_0x4a18('0x26')](function(_0x16b345){if(_0x16b345){return _0x16b345[_0x4a18('0x11b')](_0x34ab63[_0x4a18('0x4a')]['ids'])[_0x4a18('0x26')](function(){if(_['isArray'](_0x34ab63[_0x4a18('0x4a')]['ids'])){for(var _0x527c71=0x0;_0x527c71<_0x34ab63[_0x4a18('0x4a')]['ids'][_0x4a18('0x76')];_0x527c71+=0x1){socket[_0x4a18('0x11a')](_0x4a18('0x11c'),{'UserId':Number(_0x34ab63['query'][_0x4a18('0x73')][_0x527c71]),'ChatWebsiteId':Number(_0x34ab63[_0x4a18('0x5b')]['id'])});}}else{socket['emit'](_0x4a18('0x11c'),{'UserId':Number(_0x34ab63[_0x4a18('0x4a')][_0x4a18('0x73')]),'ChatWebsiteId':Number(_0x34ab63[_0x4a18('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x42d46d,null))[_0x4a18('0x2f')](handleError(_0x42d46d,null));};exports[_0x4a18('0x11d')]=function(_0x42bad8,_0x3705b9,_0x2ba6a2){var _0x19894b={};var _0x2b2b25={};var _0x40102d;var _0x16000a;return db['ChatWebsite'][_0x4a18('0x6d')]({'where':{'id':_0x42bad8[_0x4a18('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3705b9,null))[_0x4a18('0x26')](function(_0x2c95b7){if(_0x2c95b7){_0x40102d=_0x2c95b7;_0x2b2b25[_0x4a18('0x49')]=_['keys'](db[_0x4a18('0x11e')][_0x4a18('0x46')]);_0x2b2b25[_0x4a18('0x4a')]=_[_0x4a18('0x4b')](_0x42bad8[_0x4a18('0x4a')]);_0x2b2b25[_0x4a18('0x4c')]=_[_0x4a18('0x4d')](_0x2b2b25[_0x4a18('0x49')],_0x2b2b25[_0x4a18('0x4a')]);_0x19894b[_0x4a18('0x4e')]=_[_0x4a18('0x4d')](_0x2b2b25[_0x4a18('0x49')],qs[_0x4a18('0x4f')](_0x42bad8[_0x4a18('0x4a')][_0x4a18('0x4f')]));_0x19894b['attributes']=_0x19894b[_0x4a18('0x4e')][_0x4a18('0x76')]?_0x19894b[_0x4a18('0x4e')]:_0x2b2b25[_0x4a18('0x49')];_0x19894b['order']=qs[_0x4a18('0x51')](_0x42bad8['query']['sort']);_0x19894b[_0x4a18('0x52')]=qs[_0x4a18('0x4c')](_[_0x4a18('0x70')](_0x42bad8[_0x4a18('0x4a')],_0x2b2b25[_0x4a18('0x4c')]));if(_0x42bad8[_0x4a18('0x4a')][_0x4a18('0x56')]){_0x19894b[_0x4a18('0x52')]=_[_0x4a18('0x53')](_0x19894b['where'],{'$or':_[_0x4a18('0x44')](_0x19894b['attributes'],function(_0x195c80){var _0x5d3c0e={};_0x5d3c0e[_0x195c80]={'$like':'%'+_0x42bad8[_0x4a18('0x4a')][_0x4a18('0x56')]+'%'};return _0x5d3c0e;})});}_0x19894b=_[_0x4a18('0x53')]({},_0x19894b,_0x42bad8[_0x4a18('0x5c')]);return _0x40102d[_0x4a18('0x11d')](_0x19894b);}})[_0x4a18('0x26')](function(_0x15bd20){if(_0x15bd20){_0x16000a=_0x15bd20[_0x4a18('0x76')];if(!_0x42bad8[_0x4a18('0x4a')][_0x4a18('0x50')](_0x4a18('0x6e'))){_0x19894b[_0x4a18('0x36')]=qs[_0x4a18('0x36')](_0x42bad8[_0x4a18('0x4a')]['limit']);_0x19894b['offset']=qs[_0x4a18('0x35')](_0x42bad8[_0x4a18('0x4a')][_0x4a18('0x35')]);}return _0x40102d[_0x4a18('0x11d')](_0x19894b);}})['then'](function(_0x4c6bcf){if(_0x4c6bcf){return _0x4c6bcf?{'count':_0x16000a,'rows':_0x4c6bcf}:null;}})[_0x4a18('0x26')](respondWithResult(_0x3705b9,null))[_0x4a18('0x2f')](handleError(_0x3705b9,null));}; \ No newline at end of file +var _0x894a=['stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','pick','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','agentAvatar','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','user-agent','CmContact','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','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','List','DESC','ChatApplication','Applications','applications','list','orderBy','asc','account','Contacts','contact','headers','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','startRouting','Start','EventManager','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','CmList','findOrCreate','readFileSync','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','findOne','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','server/files/chat/iframe.js','utf8','remote','stringify','x-real-ip','connection','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','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~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus'];(function(_0x513a76,_0x25e595){var _0x4c6ad0=function(_0x114f82){while(--_0x114f82){_0x513a76['push'](_0x513a76['shift']());}};_0x4c6ad0(++_0x25e595);}(_0x894a,0xe2));var _0xa894=function(_0x5cfbd4,_0x52633d){_0x5cfbd4=_0x5cfbd4-0x0;var _0x2f3a06=_0x894a[_0x5cfbd4];return _0x2f3a06;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa894('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa894('0x1'));var jsonpatch=require(_0xa894('0x2'));var rp=require(_0xa894('0x3'));var moment=require(_0xa894('0x4'));var BPromise=require(_0xa894('0x5'));var Mustache=require('mustache');var util=require(_0xa894('0x6'));var path=require(_0xa894('0x7'));var sox=require(_0xa894('0x8'));var csv=require(_0xa894('0x9'));var ejs=require(_0xa894('0xa'));var fs=require('fs');var _=require(_0xa894('0xb'));var squel=require('squel');var crypto=require(_0xa894('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa894('0xd'));var toCsv=require(_0xa894('0x9'));var querystring=require(_0xa894('0xe'));var Papa=require('papaparse');var Redis=require(_0xa894('0xf'));var authService=require(_0xa894('0x10'));var qs=require(_0xa894('0x11'));var as=require(_0xa894('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa894('0x13'))(_0xa894('0x14'));var utils=require(_0xa894('0x15'));var config=require('../../config/environment');var db=require(_0xa894('0x16'))['db'];config['redis']=_[_0xa894('0x17')](config[_0xa894('0x18')],{'host':_0xa894('0x19'),'port':0x18eb});var socket=require(_0xa894('0x1a'))(new Redis(config['redis']));require(_0xa894('0x1b'))[_0xa894('0x1c')](socket);var jayson=require(_0xa894('0x1d'));var client=jayson[_0xa894('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xa894('0x1e')][_0xa894('0x1f')]({'port':0x232a});var client9003=jayson[_0xa894('0x1e')][_0xa894('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x26e736,_0x464ea,_0x22e0ac){if(_0x22e0ac){var _0x4906f5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4906f5[_0xa894('0x20')](_0x464ea)){return _0x26e736;}else{throw new db['Sequelize'][(_0xa894('0x21'))](_0xa894('0x22'));}}else{return _0x26e736;}}function respondWithRpcPromise(_0x5ae496,_0x533b11,_0x48e964,_0x7168a0){return new BPromise(function(_0x5d5047,_0xc3f03a){var _0x2c46a8=_0x7168a0||client;return _0x2c46a8[_0xa894('0x23')](_0x5ae496,_0x48e964)[_0xa894('0x24')](function(_0x3273fd){logger[_0xa894('0x25')](_0xa894('0x26'),_0x533b11,_0xa894('0x27'));logger[_0xa894('0x28')](_0xa894('0x29'),_0x533b11,_0xa894('0x27'),JSON['stringify'](_0x3273fd));if(_0x3273fd[_0xa894('0x2a')]){if(_0x3273fd[_0xa894('0x2a')][_0xa894('0x2b')]===0x1f4){logger[_0xa894('0x2a')](_0xa894('0x26'),_0x533b11,_0x3273fd[_0xa894('0x2a')]['message']);return _0xc3f03a(_0x3273fd[_0xa894('0x2a')][_0xa894('0x2c')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x533b11,_0x3273fd[_0xa894('0x2a')][_0xa894('0x2c')]);return _0x5d5047(_0x3273fd['error']['message']);}else{logger[_0xa894('0x25')](_0xa894('0x26'),_0x533b11,_0xa894('0x27'));_0x5d5047(_0x3273fd[_0xa894('0x2d')][_0xa894('0x2c')]);}})[_0xa894('0x2e')](function(_0x1ec856){logger[_0xa894('0x2a')](_0xa894('0x26'),_0x533b11,_0x1ec856);_0xc3f03a(_0x1ec856);});});}function respondWithStatusCode(_0x36ae0a,_0x3248b6){_0x3248b6=_0x3248b6||0xcc;return function(_0x37341c){if(_0x37341c){return _0x36ae0a['sendStatus'](_0x3248b6);}return _0x36ae0a[_0xa894('0x2f')](_0x3248b6)[_0xa894('0x30')]();};}function respondWithResult(_0x3dbe4e,_0x4c77a6){_0x4c77a6=_0x4c77a6||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0x3dbe4e[_0xa894('0x2f')](_0x4c77a6)[_0xa894('0x31')](_0x31ac52);}};}function respondWithFilteredResult(_0x43db0d,_0x14e253){return function(_0x40db4a){if(_0x40db4a){var _0x42e51b=_0x40db4a[_0xa894('0x32')],_0x2e056d=_0x14e253[_0xa894('0x33')],_0xaa98c1=_0x14e253[_0xa894('0x33')]+_0x14e253[_0xa894('0x34')],_0x2e0885;if(_0xaa98c1>=_0x42e51b){_0xaa98c1=_0x42e51b;_0x2e0885=0xc8;}else{_0x2e0885=0xce;}_0x43db0d['status'](_0x2e0885);return _0x43db0d[_0xa894('0x35')](_0xa894('0x36'),_0x2e056d+'-'+_0xaa98c1+'/'+_0x42e51b)[_0xa894('0x31')](_0x40db4a);}return null;};}function patchUpdates(_0x2b3412){return function(_0x4f2c73){try{jsonpatch['apply'](_0x4f2c73,_0x2b3412,!![]);}catch(_0x1fd902){return BPromise[_0xa894('0x37')](_0x1fd902);}return _0x4f2c73[_0xa894('0x38')]();};}function saveUpdates(_0x4479d9,_0x523534){return function(_0xdf2c9){if(_0xdf2c9){return _0xdf2c9[_0xa894('0x39')](_0x4479d9)['then'](function(_0xd255c0){return _0xd255c0;});}return null;};}function removeEntity(_0x57acbf,_0x19b01f){return function(_0x45d8cf){if(_0x45d8cf){return _0x45d8cf['destroy']()[_0xa894('0x24')](function(){var _0x2bc47b=_0x45d8cf[_0xa894('0x3a')]({'plain':!![]});var _0x5a2aca=_0xa894('0x3b');return db[_0xa894('0x3c')][_0xa894('0x3d')]({'where':{'type':_0x5a2aca,'resourceId':_0x2bc47b['id']}})[_0xa894('0x24')](function(){return _0x45d8cf;});})[_0xa894('0x24')](function(){_0x57acbf['status'](0xcc)[_0xa894('0x30')]();});}};}function handleEntityNotFound(_0x2a96a2,_0x12ceac){return function(_0x38c3f0){if(!_0x38c3f0){_0x2a96a2[_0xa894('0x3e')](0x194);}return _0x38c3f0;};}function handleError(_0x306293,_0x18e6a3){_0x18e6a3=_0x18e6a3||0x1f4;return function(_0x4ee770){logger[_0xa894('0x2a')](_0x4ee770[_0xa894('0x3f')]);if(_0x4ee770[_0xa894('0x40')]){delete _0x4ee770[_0xa894('0x40')];}_0x306293[_0xa894('0x2f')](_0x18e6a3)[_0xa894('0x41')](_0x4ee770);};}exports[_0xa894('0x42')]=function(_0x27b7c7,_0x2499d0){var _0x58f190={'include':[{'model':db['Pause'],'as':_0xa894('0x43')}]},_0xe05014={},_0x5b4749={'count':0x0,'rows':[]};var _0x1c2cf3=_[_0xa894('0x44')](db[_0xa894('0x45')][_0xa894('0x46')],function(_0xbfa071){return{'name':_0xbfa071[_0xa894('0x47')],'type':_0xbfa071['type'][_0xa894('0x48')]};});_0xe05014[_0xa894('0x49')]=_['map'](_0x1c2cf3,_0xa894('0x40'));_0xe05014['query']=_[_0xa894('0x4a')](_0x27b7c7[_0xa894('0x4b')]);_0xe05014[_0xa894('0x4c')]=_[_0xa894('0x4d')](_0xe05014[_0xa894('0x49')],_0xe05014['query']);_0x58f190[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0xe05014[_0xa894('0x49')],qs[_0xa894('0x4f')](_0x27b7c7['query'][_0xa894('0x4f')]));_0x58f190['attributes']=_0x58f190[_0xa894('0x4e')][_0xa894('0x50')]?_0x58f190[_0xa894('0x4e')]:_0xe05014[_0xa894('0x49')];if(!_0x27b7c7[_0xa894('0x4b')][_0xa894('0x51')](_0xa894('0x52'))){_0x58f190[_0xa894('0x34')]=qs[_0xa894('0x34')](_0x27b7c7[_0xa894('0x4b')][_0xa894('0x34')]);_0x58f190[_0xa894('0x33')]=qs[_0xa894('0x33')](_0x27b7c7[_0xa894('0x4b')]['offset']);}_0x58f190[_0xa894('0x53')]=qs['sort'](_0x27b7c7[_0xa894('0x4b')][_0xa894('0x54')]);_0x58f190[_0xa894('0x55')]=qs[_0xa894('0x4c')](_['pick'](_0x27b7c7[_0xa894('0x4b')],_0xe05014[_0xa894('0x4c')]),_0x1c2cf3);if(_0x27b7c7['query'][_0xa894('0x56')]){_0x58f190['where']=_[_0xa894('0x57')](_0x58f190[_0xa894('0x55')],{'$or':_[_0xa894('0x44')](_0x1c2cf3,function(_0x3a4668){if(_0x3a4668[_0xa894('0x58')]!==_0xa894('0x59')){var _0x142bc0={};_0x142bc0[_0x3a4668[_0xa894('0x40')]]={'$like':'%'+_0x27b7c7[_0xa894('0x4b')][_0xa894('0x56')]+'%'};return _0x142bc0;}})});}_0x58f190=_[_0xa894('0x57')]({},_0x58f190,_0x27b7c7['options']);var _0x5d846e={'where':_0x58f190[_0xa894('0x55')]};return db[_0xa894('0x45')][_0xa894('0x32')](_0x5d846e)[_0xa894('0x24')](function(_0x4bf73b){_0x5b4749['count']=_0x4bf73b;if(_0x27b7c7[_0xa894('0x4b')][_0xa894('0x5a')]){_0x58f190[_0xa894('0x5b')]=[{'all':!![]}];}return db[_0xa894('0x45')][_0xa894('0x5c')](_0x58f190);})[_0xa894('0x24')](function(_0x12d92f){_0x5b4749[_0xa894('0x5d')]=_0x12d92f;return _0x5b4749;})['then'](respondWithFilteredResult(_0x2499d0,_0x58f190))[_0xa894('0x2e')](handleError(_0x2499d0,null));};exports[_0xa894('0x5e')]=function(_0x10ea9c,_0x52e488){var _0x45fc0f={'raw':![],'where':{'id':_0x10ea9c[_0xa894('0x5f')]['id']},'include':[{'model':db[_0xa894('0x60')],'as':'mandatoryDispositionPause'}]},_0x4ae4aa={};_0x4ae4aa[_0xa894('0x49')]=_[_0xa894('0x4a')](db['ChatWebsite'][_0xa894('0x46')]);_0x4ae4aa[_0xa894('0x4b')]=_[_0xa894('0x4a')](_0x10ea9c[_0xa894('0x4b')]);_0x4ae4aa['filters']=_[_0xa894('0x4d')](_0x4ae4aa[_0xa894('0x49')],_0x4ae4aa[_0xa894('0x4b')]);_0x45fc0f[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0x4ae4aa[_0xa894('0x49')],qs[_0xa894('0x4f')](_0x10ea9c[_0xa894('0x4b')][_0xa894('0x4f')]));_0x45fc0f[_0xa894('0x4e')]=_0x45fc0f['attributes'][_0xa894('0x50')]?_0x45fc0f['attributes']:_0x4ae4aa[_0xa894('0x49')];if(_0x10ea9c['query'][_0xa894('0x5a')]){_0x45fc0f[_0xa894('0x5b')]=[{'all':!![]}];}_0x45fc0f=_[_0xa894('0x57')]({},_0x45fc0f,_0x10ea9c[_0xa894('0x61')]);return db[_0xa894('0x45')][_0xa894('0x62')](_0x45fc0f)['then'](handleEntityNotFound(_0x52e488,null))['then'](respondWithResult(_0x52e488,null))['catch'](handleError(_0x52e488,null));};exports['create']=function(_0x15af49,_0x17bbe4){return db[_0xa894('0x45')]['create'](_0x15af49[_0xa894('0x63')],{})[_0xa894('0x24')](function(_0x1c88a1){var _0x333af7=_0x15af49[_0xa894('0x64')][_0xa894('0x3a')]({'plain':!![]});if(!_0x333af7)throw new Error(_0xa894('0x65'));if(_0x333af7[_0xa894('0x66')]==='user'){var _0x53b0f0=_0x1c88a1[_0xa894('0x3a')]({'plain':!![]});var _0x4c521d='ChatWebsites';return db[_0xa894('0x67')][_0xa894('0x62')]({'where':{'name':_0x4c521d,'userProfileId':_0x333af7[_0xa894('0x68')]},'raw':!![]})[_0xa894('0x24')](function(_0x21d5b2){if(_0x21d5b2&&_0x21d5b2[_0xa894('0x69')]===0x0){return db[_0xa894('0x3c')][_0xa894('0x6a')]({'name':_0x53b0f0['name'],'resourceId':_0x53b0f0['id'],'type':_0x21d5b2[_0xa894('0x40')],'sectionId':_0x21d5b2['id']},{})[_0xa894('0x24')](function(){return _0x1c88a1;});}else{return _0x1c88a1;}})[_0xa894('0x2e')](function(_0x5082df){logger[_0xa894('0x2a')](_0xa894('0x6b'),_0x5082df);throw _0x5082df;});}return _0x1c88a1;})['then'](respondWithResult(_0x17bbe4,0xc9))[_0xa894('0x2e')](handleError(_0x17bbe4,null));};exports['update']=function(_0x27aae2,_0xb37113){if(_0x27aae2['body']['id']){delete _0x27aae2[_0xa894('0x63')]['id'];}return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x27aae2[_0xa894('0x5f')]['id']},'include':[{'model':db[_0xa894('0x60')],'as':_0xa894('0x43')}]})['then'](handleEntityNotFound(_0xb37113,null))[_0xa894('0x24')](saveUpdates(_0x27aae2[_0xa894('0x63')],null))[_0xa894('0x24')](respondWithResult(_0xb37113,null))['catch'](handleError(_0xb37113,null));};exports[_0xa894('0x3d')]=function(_0x45b2ce,_0x143c01){return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x45b2ce[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x143c01,null))['then'](removeEntity(_0x143c01,null))['catch'](handleError(_0x143c01,null));};exports['describe']=function(_0x3ad647,_0x3dacfb){return db['ChatWebsite'][_0xa894('0x6c')]()[_0xa894('0x24')](respondWithResult(_0x3dacfb,null))['catch'](handleError(_0x3dacfb,null));};exports[_0xa894('0x6d')]=function(_0x58e7d1,_0x547857,_0x4b27b9){if(_0x58e7d1[_0xa894('0x63')]['id']){delete _0x58e7d1[_0xa894('0x63')]['id'];}return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x58e7d1[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x547857,null))[_0xa894('0x24')](function(_0xad5d94){if(_0xad5d94){_0x58e7d1['body']['ChatWebsiteId']=_0xad5d94['id'];return db['Disposition']['create'](_0x58e7d1[_0xa894('0x63')]);}})[_0xa894('0x24')](respondWithResult(_0x547857,null))[_0xa894('0x2e')](handleError(_0x547857,null));};exports['getDispositions']=function(_0x574500,_0x5566d8,_0x335fbe){var _0x220717={'raw':![],'where':{}};var _0x291f08={};var _0x3c0e7f={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x574500[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x5566d8,null))[_0xa894('0x24')](function(_0x589d18){if(_0x589d18){_0x291f08[_0xa894('0x49')]=_['keys'](db['Disposition'][_0xa894('0x46')]);_0x291f08[_0xa894('0x4b')]=_['keys'](_0x574500['query']);_0x291f08['filters']=_[_0xa894('0x4d')](_0x291f08[_0xa894('0x49')],_0x291f08[_0xa894('0x4b')]);_0x220717[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0x291f08[_0xa894('0x49')],qs[_0xa894('0x4f')](_0x574500[_0xa894('0x4b')]['fields']));_0x220717[_0xa894('0x4e')]=_0x220717[_0xa894('0x4e')][_0xa894('0x50')]?_0x220717['attributes']:_0x291f08[_0xa894('0x49')];if(!_0x574500[_0xa894('0x4b')]['hasOwnProperty'](_0xa894('0x52'))){_0x220717['limit']=qs[_0xa894('0x34')](_0x574500['query'][_0xa894('0x34')]);_0x220717[_0xa894('0x33')]=qs['offset'](_0x574500['query']['offset']);}_0x220717[_0xa894('0x53')]=qs['sort'](_0x574500[_0xa894('0x4b')]['sort']);_0x220717[_0xa894('0x55')]=qs[_0xa894('0x4c')](_['pick'](_0x574500['query'],_0x291f08[_0xa894('0x4c')]));_0x220717[_0xa894('0x55')]['ChatWebsiteId']=_0x589d18['id'];if(_0x574500['query']['filter']){_0x220717[_0xa894('0x55')]=_['merge'](_0x220717['where'],{'$or':_[_0xa894('0x44')](_0x220717[_0xa894('0x4e')],function(_0x1d7f09){var _0x266e69={};_0x266e69[_0x1d7f09]={'$like':'%'+_0x574500['query']['filter']+'%'};return _0x266e69;})});}_0x220717=_['merge']({},_0x220717,_0x574500[_0xa894('0x61')]);return db[_0xa894('0x6e')][_0xa894('0x32')]({'where':_0x220717[_0xa894('0x55')]})[_0xa894('0x24')](function(_0xd5051d){_0x3c0e7f[_0xa894('0x32')]=_0xd5051d;if(_0x574500[_0xa894('0x4b')][_0xa894('0x5a')]){_0x220717[_0xa894('0x5b')]=[{'all':!![]}];}return db[_0xa894('0x6e')][_0xa894('0x5c')](_0x220717);})[_0xa894('0x24')](function(_0x27dfff){_0x3c0e7f[_0xa894('0x5d')]=_0x27dfff;return _0x3c0e7f;});}})[_0xa894('0x24')](respondWithFilteredResult(_0x5566d8,_0x220717))['catch'](handleError(_0x5566d8,null));};exports[_0xa894('0x6f')]=function(_0x57e4cb,_0x3e2db2,_0x299a0c){return db[_0xa894('0x45')]['find']({'where':{'id':_0x57e4cb[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x3e2db2,null))['then'](function(_0x23e0d2){if(_0x23e0d2){return _0x23e0d2[_0xa894('0x6f')](_0x57e4cb[_0xa894('0x4b')][_0xa894('0x70')]);}})[_0xa894('0x24')](respondWithStatusCode(_0x3e2db2,null))['catch'](handleError(_0x3e2db2,null));};exports[_0xa894('0x71')]=function(_0x71b5aa,_0x21b682,_0x17fda3){if(_0x71b5aa['body']['id']){delete _0x71b5aa[_0xa894('0x63')]['id'];}return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x71b5aa[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x21b682,null))['then'](function(_0x3131f3){if(_0x3131f3){_0x71b5aa[_0xa894('0x63')][_0xa894('0x72')]=_0x3131f3['id'];return db[_0xa894('0x73')][_0xa894('0x6a')](_0x71b5aa[_0xa894('0x63')]);}})[_0xa894('0x24')](respondWithResult(_0x21b682,null))[_0xa894('0x2e')](handleError(_0x21b682,null));};exports[_0xa894('0x74')]=function(_0x305caf,_0x4c204b,_0x550ea3){var _0xf81b75={'raw':![],'where':{}};var _0x481eb0={};var _0x52c86c={'count':0x0,'rows':[]};return db[_0xa894('0x45')]['findOne']({'where':{'id':_0x305caf[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x4c204b,null))['then'](function(_0x2a36cd){if(_0x2a36cd){_0x481eb0[_0xa894('0x49')]=_[_0xa894('0x4a')](db['CannedAnswer'][_0xa894('0x46')]);_0x481eb0[_0xa894('0x4b')]=_[_0xa894('0x4a')](_0x305caf[_0xa894('0x4b')]);_0x481eb0['filters']=_[_0xa894('0x4d')](_0x481eb0[_0xa894('0x49')],_0x481eb0[_0xa894('0x4b')]);_0xf81b75[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0x481eb0[_0xa894('0x49')],qs['fields'](_0x305caf[_0xa894('0x4b')][_0xa894('0x4f')]));_0xf81b75[_0xa894('0x4e')]=_0xf81b75[_0xa894('0x4e')][_0xa894('0x50')]?_0xf81b75[_0xa894('0x4e')]:_0x481eb0['model'];if(!_0x305caf[_0xa894('0x4b')][_0xa894('0x51')](_0xa894('0x52'))){_0xf81b75[_0xa894('0x34')]=qs[_0xa894('0x34')](_0x305caf[_0xa894('0x4b')][_0xa894('0x34')]);_0xf81b75[_0xa894('0x33')]=qs[_0xa894('0x33')](_0x305caf[_0xa894('0x4b')][_0xa894('0x33')]);}_0xf81b75[_0xa894('0x53')]=qs['sort'](_0x305caf[_0xa894('0x4b')]['sort']);_0xf81b75['where']=qs[_0xa894('0x4c')](_[_0xa894('0x75')](_0x305caf[_0xa894('0x4b')],_0x481eb0[_0xa894('0x4c')]));_0xf81b75['where'][_0xa894('0x72')]=_0x2a36cd['id'];if(_0x305caf[_0xa894('0x4b')][_0xa894('0x56')]){_0xf81b75[_0xa894('0x55')]=_['merge'](_0xf81b75[_0xa894('0x55')],{'$or':_[_0xa894('0x44')](_0xf81b75[_0xa894('0x4e')],function(_0x2bb45a){var _0x696c30={};_0x696c30[_0x2bb45a]={'$like':'%'+_0x305caf[_0xa894('0x4b')]['filter']+'%'};return _0x696c30;})});}_0xf81b75=_['merge']({},_0xf81b75,_0x305caf[_0xa894('0x61')]);return db['CannedAnswer'][_0xa894('0x32')]({'where':_0xf81b75['where']})[_0xa894('0x24')](function(_0x4680e6){_0x52c86c[_0xa894('0x32')]=_0x4680e6;if(_0x305caf[_0xa894('0x4b')][_0xa894('0x5a')]){_0xf81b75[_0xa894('0x5b')]=[{'all':!![]}];}return db[_0xa894('0x73')][_0xa894('0x5c')](_0xf81b75);})[_0xa894('0x24')](function(_0x2ed43a){_0x52c86c[_0xa894('0x5d')]=_0x2ed43a;return _0x52c86c;});}})[_0xa894('0x24')](respondWithFilteredResult(_0x4c204b,_0xf81b75))[_0xa894('0x2e')](handleError(_0x4c204b,null));};exports['removeAnswers']=function(_0x57c76b,_0x27f1c3,_0x441ea4){return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x57c76b[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x27f1c3,null))[_0xa894('0x24')](function(_0x3f9c1a){if(_0x3f9c1a){return _0x3f9c1a[_0xa894('0x76')](_0x57c76b[_0xa894('0x4b')][_0xa894('0x70')]);}})['then'](respondWithStatusCode(_0x27f1c3,null))['catch'](handleError(_0x27f1c3,null));};exports[_0xa894('0x77')]=function(_0x57ac97,_0xe9893f,_0xc62b2c){_0x57ac97[_0xa894('0x63')][_0xa894('0x78')]=_0x57ac97[_0xa894('0x79')][_0xa894('0x7a')];return db['ChatWebsite'][_0xa894('0x62')]({'where':{'id':_0x57ac97[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0xe9893f,null))[_0xa894('0x24')](saveUpdates(_0x57ac97[_0xa894('0x63')],null))[_0xa894('0x24')](respondWithResult(_0xe9893f,null))[_0xa894('0x2e')](handleError(_0xe9893f,null));};exports['addAvatar']=function(_0x4dde84,_0x1e51ce,_0x20fee5){_0x4dde84[_0xa894('0x63')]['agentAvatar']=_0x4dde84[_0xa894('0x79')][_0xa894('0x7a')];return db['ChatWebsite'][_0xa894('0x62')]({'where':{'id':_0x4dde84[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x1e51ce,null))[_0xa894('0x24')](saveUpdates(_0x4dde84[_0xa894('0x63')],null))['then'](respondWithResult(_0x1e51ce,null))[_0xa894('0x2e')](handleError(_0x1e51ce,null));};exports[_0xa894('0x7b')]=function(_0x474954,_0x33ae0f,_0x4d4bbd){_0x474954['body'][_0xa894('0x7c')]=_0x474954[_0xa894('0x79')]['filename'];return db[_0xa894('0x45')]['find']({'where':{'id':_0x474954[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x33ae0f,null))[_0xa894('0x24')](saveUpdates(_0x474954['body'],null))[_0xa894('0x24')](respondWithResult(_0x33ae0f,null))[_0xa894('0x2e')](handleError(_0x33ae0f,null));};exports[_0xa894('0x7d')]=function(_0x25041a,_0x531f3e,_0x52436f){_0x25041a[_0xa894('0x63')][_0xa894('0x7e')]=_0x25041a['file']['filename'];return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x25041a[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x531f3e,null))['then'](saveUpdates(_0x25041a['body'],null))['then'](respondWithResult(_0x531f3e,null))[_0xa894('0x2e')](handleError(_0x531f3e,null));};exports['getLogo']=function(_0x210543,_0x1d34f2,_0x4a9c87){var _0x541f57=path['join'](config[_0xa894('0x7f')],_0xa894('0x80'));var _0x391e80={'where':{'id':_0x210543['params']['id']},'attributes':['id',_0xa894('0x78')],'raw':!![]};var _0x23db33=![];return require(_0xa894('0x81'))[_0xa894('0x82')]()[_0xa894('0x24')](function(_0x2465c7){if(_0x2465c7){_0x23db33=_0x2465c7[_0xa894('0x83')];}})['then'](function(){return db[_0xa894('0x45')]['find'](_0x391e80);})['then'](handleEntityNotFound(_0x1d34f2,null))['then'](function(_0x466a51){if(_0x466a51){if(!_[_0xa894('0x84')](_0x466a51[_0xa894('0x78')])){if(fs[_0xa894('0x85')](path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x87'),_0x466a51[_0xa894('0x78')]))&&_0x23db33){_0x541f57=path[_0xa894('0x86')](config['root'],_0xa894('0x87'),_0x466a51[_0xa894('0x78')]);}}return _0x1d34f2['download'](_0x541f57);}})[_0xa894('0x2e')](handleError(_0x1d34f2,null));};exports['getAvatar']=function(_0x2883bd,_0x1de528,_0x4b72cc){var _0xfc1355=path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x88'));var _0x4bfb1a={'where':{'id':_0x2883bd[_0xa894('0x5f')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa894('0x45')][_0xa894('0x62')](_0x4bfb1a)[_0xa894('0x24')](handleEntityNotFound(_0x1de528,null))['then'](function(_0x220427){if(_0x220427){if(!_[_0xa894('0x84')](_0x220427['agentAvatar'])){if(fs[_0xa894('0x85')](path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x89'),_0x220427[_0xa894('0x8a')]))){_0xfc1355=path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x89'),_0x220427['agentAvatar']);}}return _0x1de528[_0xa894('0x8b')](_0xfc1355);}})[_0xa894('0x2e')](handleError(_0x1de528,null));};exports[_0xa894('0x8c')]=function(_0x23b8eb,_0x5b056b,_0x206c7a){var _0x1ddd2c=path['join'](config[_0xa894('0x7f')],_0xa894('0x8d'));var _0x421333={'where':{'id':_0x23b8eb[_0xa894('0x5f')]['id']},'attributes':['id',_0xa894('0x7c'),_0xa894('0x8e')],'raw':!![]};return db['ChatWebsite'][_0xa894('0x62')](_0x421333)[_0xa894('0x24')](handleEntityNotFound(_0x5b056b,null))[_0xa894('0x24')](function(_0x50cbed){if(_0x50cbed){if(!_[_0xa894('0x84')](_0x50cbed[_0xa894('0x7c')])){if(fs[_0xa894('0x85')](path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x89'),_0x50cbed[_0xa894('0x7c')]))&&_0x50cbed[_0xa894('0x8e')]){_0x1ddd2c=path[_0xa894('0x86')](config['root'],_0xa894('0x89'),_0x50cbed[_0xa894('0x7c')]);}}return _0x5b056b['download'](_0x1ddd2c);}})[_0xa894('0x2e')](handleError(_0x5b056b,null));};exports[_0xa894('0x8f')]=function(_0xc2a908,_0x4a2290,_0x5629c9){var _0x435e3c=path[_0xa894('0x86')](config[_0xa894('0x7f')],'server/files/images/avatars/system_avatar.png');var _0xff29ba={'where':{'id':_0xc2a908['params']['id']},'attributes':['id',_0xa894('0x7e')],'raw':!![]};return db[_0xa894('0x45')][_0xa894('0x62')](_0xff29ba)[_0xa894('0x24')](handleEntityNotFound(_0x4a2290,null))[_0xa894('0x24')](function(_0x308959){if(_0x308959){if(!_['isNil'](_0x308959[_0xa894('0x7e')])){if(fs[_0xa894('0x85')](path['join'](config[_0xa894('0x7f')],_0xa894('0x89'),_0x308959['systemAvatar']))){_0x435e3c=path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x89'),_0x308959[_0xa894('0x7e')]);}}return _0x4a2290[_0xa894('0x8b')](_0x435e3c);}})[_0xa894('0x2e')](handleError(_0x4a2290,null));};exports[_0xa894('0x90')]=function(_0x13de2a,_0xbb5ea2,_0x19a189){var _0x44ebbc=require(_0xa894('0x91'));var _0x1d5614=new _0x44ebbc();var _0x9f2ae2=_0x1d5614['setUA'](_0x13de2a['headers'][_0xa894('0x92')])['getResult']();var _0x5428f6={'body':_0x13de2a[_0xa894('0x63')],'channel':'chat'};var _0x275c54=[];var _0x105de5=[];var _0x472074={};var _0x32aa4b=![];return db[_0xa894('0x93')][_0xa894('0x6c')]()['then'](function(_0x3eb9c3){if(!_0x3eb9c3){throw new db[(_0xa894('0x94'))][(_0xa894('0x21'))]('no\x20available\x20attributes');}_0x275c54=_['difference'](_[_0xa894('0x4a')](_0x3eb9c3),[_0xa894('0x95'),_0xa894('0x96')]);_0x105de5=_[_0xa894('0x97')](_['keys'](_0x3eb9c3),[_0xa894('0x95'),'updatedAt',_0xa894('0x98'),_0xa894('0x99')]);if(_0x13de2a[_0xa894('0x63')]['id']){delete _0x13de2a['body']['id'];}if(_[_0xa894('0x84')](_0x13de2a[_0xa894('0x63')][_0xa894('0x9a')])){throw new db[(_0xa894('0x94'))]['ValidationError'](_0xa894('0x9b'));}if(_[_0xa894('0x84')](_0x13de2a[_0xa894('0x63')]['body'])||_0x13de2a[_0xa894('0x63')][_0xa894('0x63')]===''){throw new db['Sequelize'][(_0xa894('0x21'))](_0xa894('0x9c'));}if(_[_0xa894('0x84')](_0x13de2a[_0xa894('0x63')]['mapKey'])){throw new db[(_0xa894('0x94'))][(_0xa894('0x21'))](_0xa894('0x9d')+_0x105de5);}if(!_['includes'](_0x105de5,_0x13de2a['body'][_0xa894('0x9e')])){throw new db[(_0xa894('0x94'))][(_0xa894('0x21'))](_0xa894('0x9f')+_0x105de5);}_0x472074[_0x13de2a[_0xa894('0x63')][_0xa894('0x9e')]]=_0x13de2a['body'][_0xa894('0x9a')];})[_0xa894('0x24')](function(){return db[_0xa894('0x45')]['find']({'where':{'id':_0x13de2a['params']['id']},'include':[{'model':db['CmList'],'as':_0xa894('0xa0'),'include':[{'model':db[_0xa894('0x93')],'as':'Contacts','where':_0x472074,'limit':0x1,'order':[[_0xa894('0x96'),_0xa894('0xa1')]]}]},{'model':db[_0xa894('0xa2')],'as':_0xa894('0xa3')}]});})['then'](handleEntityNotFound(_0xbb5ea2,null))[_0xa894('0x24')](function(_0x1ea9d7){if(_0x1ea9d7&&_0x1ea9d7[_0xa894('0xa0')]){_0x5428f6['account']=_0x1ea9d7;_0x5428f6[_0xa894('0xa4')]=_0x1ea9d7[_0xa894('0xa3')];_0x5428f6[_0xa894('0xa5')]=_0x1ea9d7[_0xa894('0xa0')];_0x5428f6['applications']=_[_0xa894('0xa6')](_0x5428f6['applications'],['priority'],[_0xa894('0xa7')]);if(_0x5428f6[_0xa894('0xa8')][_0xa894('0xa3')]){delete _0x5428f6['account'][_0xa894('0xa3')];}if(_0x5428f6[_0xa894('0xa8')][_0xa894('0xa0')]&&_0x5428f6['account'][_0xa894('0xa0')][_0xa894('0xa9')][_0xa894('0x50')]){return _0x5428f6[_0xa894('0xa8')][_0xa894('0xa0')][_0xa894('0xa9')][0x0];}var _0x43fd87=_[_0xa894('0x17')](_0x13de2a[_0xa894('0x63')],{'firstName':_0x13de2a[_0xa894('0x63')]['from'],'ListId':_0x1ea9d7[_0xa894('0x99')]});_0x43fd87[_0x13de2a[_0xa894('0x63')][_0xa894('0x9e')]]=_0x13de2a[_0xa894('0x63')][_0xa894('0x9a')];return db['CmContact'][_0xa894('0x6a')](_0x43fd87,{'fields':_0x275c54,'raw':!![]});}})[_0xa894('0x24')](handleEntityNotFound(_0xbb5ea2,null))[_0xa894('0x24')](function(_0x39f349){_0x5428f6[_0xa894('0xaa')]=_0x39f349;var _0x5d262c=_0x13de2a[_0xa894('0x63')]['customerIp'];if(_0x13de2a['headers']['cf-connecting-ip']){_0x5d262c=_0x13de2a[_0xa894('0xab')][_0xa894('0xac')];}else if(_0x13de2a[_0xa894('0xab')][_0xa894('0xad')]){_0x5d262c=_[_0xa894('0xae')](_0x13de2a[_0xa894('0xab')][_0xa894('0xad')][_0xa894('0xaf')](','));}if(_0x39f349){var _0x4c4257={'ContactId':_0x39f349['id'],'ChatWebsiteId':_0x13de2a[_0xa894('0x5f')]['id'],'from':(_0x39f349['firstName']||'')+'\x20'+(_0x39f349[_0xa894('0xb0')]||''),'customerIp':_0x5d262c,'customerPort':_0x13de2a[_0xa894('0xab')][_0xa894('0xb1')]?_0x13de2a[_0xa894('0xab')]['x-real-port']:null,'referer':_0x13de2a[_0xa894('0x63')][_0xa894('0xb2')],'browserName':_0x9f2ae2['browser']['name']&&_0x9f2ae2[_0xa894('0xb3')][_0xa894('0xb4')]?util['format'](_0xa894('0xb5'),_0x9f2ae2[_0xa894('0xb3')]['name'],_0x9f2ae2[_0xa894('0xb3')][_0xa894('0xb4')]):_0xa894('0xb6'),'browserVersion':_0x9f2ae2[_0xa894('0xb3')][_0xa894('0xb4')]||'unknown','osName':util[_0xa894('0xb7')](_0xa894('0xb5'),_0x9f2ae2['os']['name'],_0x9f2ae2['os'][_0xa894('0xb4')]),'osVersion':_0x9f2ae2['os'][_0xa894('0xb4')],'deviceModel':_0x9f2ae2[_0xa894('0xb8')][_0xa894('0x49')]&&_0x9f2ae2[_0xa894('0xb8')]['vendor']?util[_0xa894('0xb7')](_0xa894('0xb9'),_0x9f2ae2['device'][_0xa894('0x49')],_0x9f2ae2['device'][_0xa894('0xba')],_0x9f2ae2[_0xa894('0xb8')]['type']):null,'deviceVendor':_0x9f2ae2[_0xa894('0xb8')][_0xa894('0xba')],'deviceType':_0x9f2ae2[_0xa894('0xb8')][_0xa894('0x58')],'formData':JSON['stringify'](_0x13de2a[_0xa894('0x63')])};var _0x3403ec={'ChatWebsiteId':_0x13de2a[_0xa894('0x5f')]['id'],'closed':![]};if(_0x13de2a[_0xa894('0x63')][_0xa894('0xbb')]){_0x3403ec['threadId']=_0x13de2a[_0xa894('0x63')]['threadId'];return db['ChatInteraction'][_0xa894('0x62')]({'where':_0x3403ec})['then'](function(_0x3513dd){if(_0x3513dd){return[_0x3513dd,![]];}_0x4c4257[_0xa894('0xbb')]=_0x13de2a[_0xa894('0x63')][_0xa894('0xbb')];_0x4c4257[_0xa894('0xbc')]=_0x13de2a[_0xa894('0x63')][_0xa894('0xbc')];return db[_0xa894('0xbd')][_0xa894('0x6a')](_0x4c4257)['then'](function(_0x57d508){return[_0x57d508,!![]];});});}_0x3403ec[_0xa894('0xbe')]=_0x39f349['id'];if(_0x13de2a[_0xa894('0x63')]['interaction']&&_0x13de2a[_0xa894('0x63')][_0xa894('0xbf')]['id']){_0x3403ec['id']=_0x13de2a[_0xa894('0x63')][_0xa894('0xbf')]['id'];return db[_0xa894('0xbd')][_0xa894('0x62')]({'where':_0x3403ec})[_0xa894('0x24')](function(_0x131d6f){if(_0x131d6f){return[_0x131d6f,![]];}return db[_0xa894('0xbd')][_0xa894('0x6a')](_0x4c4257)['then'](function(_0x39835b){return[_0x39835b,!![]];});});}return db[_0xa894('0xbd')]['create'](_0x4c4257)[_0xa894('0x24')](function(_0x36c0e2){return[_0x36c0e2,!![]];});}})['spread'](function(_0x5f404,_0x29e0be){if(_0x5f404){_0x32aa4b=_0x29e0be;if(!_0x29e0be){var _0x5bc5b7={'from':(_0x5428f6[_0xa894('0xaa')][_0xa894('0xc0')]||'')+'\x20'+(_0x5428f6[_0xa894('0xaa')][_0xa894('0xb0')]||'')};if(_0x13de2a[_0xa894('0x63')]['threadId']&&_0x13de2a['body'][_0xa894('0xc1')]&&_0x13de2a[_0xa894('0x63')]['threadId']!=_0x13de2a[_0xa894('0x63')][_0xa894('0xc1')]){_0x5bc5b7['threadId']=_0x13de2a[_0xa894('0x63')][_0xa894('0xc1')];}return _0x5f404['update'](_0x5bc5b7);}else{return _0x5f404;}}})[_0xa894('0x24')](function(_0x22c9e2){_0x5428f6[_0xa894('0xbf')]=_0x22c9e2[_0xa894('0x3a')]({'plain':!![]});_0x5428f6['interaction']['created']=_0x32aa4b;if(_0x5428f6['interaction'][_0xa894('0xc2')]){if(_0x5428f6[_0xa894('0xa8')][_0xa894('0xc3')]){_0x5428f6[_0xa894('0xa4')][_0xa894('0xc4')]({'id':0x0,'priority':_0x5428f6[_0xa894('0xa4')][_0xa894('0x50')]+0x1,'app':_0xa894('0xc5'),'appdata':_0xa894('0xc6'),'interval':_0xa894('0xc7')});}}return db['ChatMessage'][_0xa894('0x6a')]({'body':_0x13de2a[_0xa894('0x63')][_0xa894('0x63')],'ChatWebsiteId':_0x13de2a[_0xa894('0x5f')]['id'],'ChatInteractionId':_0x22c9e2['id'],'direction':'in','ContactId':_0x5428f6[_0xa894('0xaa')]['id'],'AttachmentId':_0x13de2a[_0xa894('0x63')][_0xa894('0xc8')]});})[_0xa894('0x24')](function(_0x494836){_0x5428f6[_0xa894('0x2c')]=_0x494836;if(_0x5428f6[_0xa894('0xbf')][_0xa894('0xc9')]){return db[_0xa894('0xca')][_0xa894('0x62')]({'attributes':['id',_0xa894('0x40')],'where':{'id':_0x5428f6[_0xa894('0xbf')][_0xa894('0xc9')]}})['then'](function(_0x2a4f78){if(_0x2a4f78){_0x5428f6['applications'][_0xa894('0xcb')]({'id':0x0,'priority':0x0,'app':_0xa894('0xcc'),'appdata':_0x2a4f78['name']+','+(_0x5428f6[_0xa894('0xa8')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5428f6['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xa894('0xcd'),_0x5428f6);});}return respondWithRpcPromise(_0xa894('0xce'),'startRouting',_0x5428f6);})[_0xa894('0x24')](function(_0x113883){respondWithRpcPromise(_0xa894('0xcf'),_0xa894('0xcf'),{'event':_0xa894('0x90'),'message':_0x113883},client9002);return _0x113883;})[_0xa894('0x24')](respondWithResult(_0xbb5ea2,null))[_0xa894('0x2e')](handleError(_0xbb5ea2,null));};exports[_0xa894('0xd0')]=function(_0x283bcf,_0x285b36,_0x496416){var _0x270899,_0x452a73,_0x338cbb;var _0x45cee2=[];var _0x2b6aa4=[];var _0x75fd50={};return db[_0xa894('0x93')]['describe']()[_0xa894('0x24')](function(_0x2d38a2){if(!_0x2d38a2){throw new db['Sequelize'][(_0xa894('0x21'))]('no\x20available\x20attributes');}_0x2b6aa4=_[_0xa894('0x97')](_['keys'](_0x2d38a2),[_0xa894('0x95'),_0xa894('0x96')]);_0x45cee2=_[_0xa894('0x97')](_[_0xa894('0x4a')](_0x2d38a2),['createdAt',_0xa894('0x96'),_0xa894('0x98'),_0xa894('0x99')]);if(_0x283bcf[_0xa894('0x63')]['id']){delete _0x283bcf[_0xa894('0x63')]['id'];}if(_[_0xa894('0x84')](_0x283bcf[_0xa894('0x63')][_0xa894('0x9a')])){throw _0x285b36[_0xa894('0x2f')](0x1f4)[_0xa894('0x41')](new db[(_0xa894('0x94'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x283bcf[_0xa894('0x63')]['body'])||_0x283bcf['body'][_0xa894('0x63')]===''){throw _0x285b36[_0xa894('0x2f')](0x1f4)[_0xa894('0x41')](new db[(_0xa894('0x94'))][(_0xa894('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa894('0x84')](_0x283bcf[_0xa894('0x63')]['mapKeyOffline'])){throw _0x285b36[_0xa894('0x2f')](0x1f4)[_0xa894('0x41')](new db[(_0xa894('0x94'))]['ValidationError'](_0xa894('0xd1')+_0x45cee2));}if(!_[_0xa894('0xd2')](_0x45cee2,_0x283bcf[_0xa894('0x63')][_0xa894('0xd3')])){throw _0x285b36['status'](0x1f4)['send'](new db[(_0xa894('0x94'))][(_0xa894('0x21'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x45cee2));}_0x75fd50[_0x283bcf[_0xa894('0x63')][_0xa894('0xd3')]]=_0x283bcf[_0xa894('0x63')][_0xa894('0x9a')];})['then'](function(){return db[_0xa894('0x45')]['find']({'where':{'id':_0x283bcf[_0xa894('0x5f')]['id']},'include':[{'model':db[_0xa894('0xd4')],'as':_0xa894('0xa0')}]});})['then'](handleEntityNotFound(_0x285b36,null))['then'](function(_0x5bd8a0){if(_0x5bd8a0&&_0x5bd8a0[_0xa894('0xa0')]){_0x452a73=_0x5bd8a0;var _0x4cc71a=_[_0xa894('0x17')](_0x283bcf['body'],{'firstName':_0x283bcf[_0xa894('0x63')][_0xa894('0x9a')],'phone':_0x283bcf[_0xa894('0x63')][_0xa894('0x9a')],'ListId':_0x5bd8a0[_0xa894('0x99')]});_0x4cc71a[_0x283bcf['body'][_0xa894('0xd3')]]=_0x283bcf[_0xa894('0x63')][_0xa894('0x9a')];return db['CmContact'][_0xa894('0xd5')]({'where':_0x75fd50,'defaults':_0x4cc71a});}})['spread'](function(_0xb99a31){if(_0xb99a31){_0x338cbb=_0xb99a31;var _0x4fdd9d=fs[_0xa894('0xd6')](path[_0xa894('0x86')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x26e388=ejs[_0xa894('0xd7')](_0x4fdd9d,{'body':_[_0xa894('0xd8')](_0x283bcf[_0xa894('0x63')][_0xa894('0x63')]),'bodyTitle':_0x452a73[_0xa894('0xd9')]});return db[_0xa894('0xda')][_0xa894('0x6a')]({'body':_0x26e388,'ContactId':_0xb99a31['id'],'ChatWebsiteId':_0x452a73['id']});}})[_0xa894('0x24')](function(_0x1badd8){if(_0x1badd8){_0x270899=_0x1badd8;return db[_0xa894('0xdb')][_0xa894('0xdc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0xa894('0x24')](function(_0x50b02d){if(_0x50b02d&&_0x50b02d[_0xa894('0xdd')]&&_0x452a73[_0xa894('0xde')]){var _0x339167={'tls':{'rejectUnauthorized':![]}};if(_0x50b02d[_0xa894('0xdd')][_0xa894('0xdf')]){_0x339167['service']=_0x50b02d[_0xa894('0xdd')]['service'];}else{_0x339167[_0xa894('0xe0')]=_0x50b02d[_0xa894('0xdd')][_0xa894('0xe0')];_0x339167[_0xa894('0xe1')]=_0x50b02d[_0xa894('0xdd')][_0xa894('0xe1')];_0x339167[_0xa894('0xe2')]=_0x50b02d[_0xa894('0xdd')][_0xa894('0xe2')];}if(_0x50b02d['Smtp'][_0xa894('0xe3')]){_0x339167['auth']={'user':_0x50b02d[_0xa894('0xdd')][_0xa894('0x64')],'pass':_0x50b02d[_0xa894('0xdd')][_0xa894('0xe4')]};}return respondWithRpcPromise(_0xa894('0xe5'),'sendMail',{'account':_0x339167,'message':{'from':util['format'](_0xa894('0xe6'),_0x50b02d[_0xa894('0x40')],_0x50b02d['email']||_0x50b02d[_0xa894('0xdd')][_0xa894('0x64')]),'to':_0x452a73[_0xa894('0xde')],'subject':_0x452a73[_0xa894('0xe7')],'text':_0x270899['body']}},client9003)[_0xa894('0x24')](function(){return _0x270899;})[_0xa894('0x2e')](function(_0x55b18e){console[_0xa894('0x2a')](_0x55b18e);});}})[_0xa894('0x24')](function(){if(_0x270899){return _0x270899;}})[_0xa894('0x24')](respondWithResult(_0x285b36,null))[_0xa894('0x2e')](handleError(_0x285b36,null));};exports[_0xa894('0xe8')]=function(_0x3713e5,_0x4e0c98,_0x2f4828){return db[_0xa894('0xbd')][_0xa894('0x62')]({'where':{'id':_0x3713e5[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x4e0c98,null))[_0xa894('0x24')](function(_0x1a019){if(_0x1a019){return _0x1a019[_0xa894('0xe8')](_0x3713e5[_0xa894('0x63')][_0xa894('0x70')],_[_0xa894('0xe9')](_0x3713e5[_0xa894('0x63')],[_0xa894('0x70'),'id'])||{});}})[_0xa894('0x24')](respondWithResult(_0x4e0c98,null))[_0xa894('0x2e')](handleError(_0x4e0c98,null));};exports[_0xa894('0xea')]=function(_0x2e1b42,_0x2ecd7d,_0x5a3d44){var _0x3b6627={'raw':![],'where':{}};var _0x3a3a14={};var _0x4fbb92={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2e1b42[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2ecd7d,null))['then'](function(_0x1f72ec){if(_0x1f72ec){_0x3a3a14[_0xa894('0x49')]=_[_0xa894('0x4a')](db[_0xa894('0xbd')][_0xa894('0x46')]);_0x3a3a14[_0xa894('0x4b')]=_[_0xa894('0x4a')](_0x2e1b42['query']);_0x3a3a14[_0xa894('0x4c')]=_['intersection'](_0x3a3a14[_0xa894('0x49')],_0x3a3a14[_0xa894('0x4b')]);_0x3b6627[_0xa894('0x4e')]=_['intersection'](_0x3a3a14['model'],qs[_0xa894('0x4f')](_0x2e1b42[_0xa894('0x4b')][_0xa894('0x4f')]));_0x3b6627[_0xa894('0x4e')]=_0x3b6627['attributes'][_0xa894('0x50')]?_0x3b6627['attributes']:_0x3a3a14[_0xa894('0x49')];if(!_0x2e1b42['query']['hasOwnProperty'](_0xa894('0x52'))){_0x3b6627[_0xa894('0x34')]=qs[_0xa894('0x34')](_0x2e1b42[_0xa894('0x4b')]['limit']);_0x3b6627['offset']=qs[_0xa894('0x33')](_0x2e1b42[_0xa894('0x4b')][_0xa894('0x33')]);}_0x3b6627[_0xa894('0x53')]=qs[_0xa894('0x54')](_0x2e1b42[_0xa894('0x4b')][_0xa894('0x54')]);_0x3b6627['where']=qs[_0xa894('0x4c')](_['pick'](_0x2e1b42[_0xa894('0x4b')],_0x3a3a14[_0xa894('0x4c')]));_0x3b6627[_0xa894('0x55')][_0xa894('0x72')]=_0x1f72ec['id'];if(_0x2e1b42[_0xa894('0x4b')][_0xa894('0x56')]){_0x3b6627[_0xa894('0x55')]=_[_0xa894('0x57')](_0x3b6627['where'],{'$or':_[_0xa894('0x44')](_0x3b6627[_0xa894('0x4e')],function(_0x289914){var _0x19ca57={};_0x19ca57[_0x289914]={'$like':'%'+_0x2e1b42[_0xa894('0x4b')][_0xa894('0x56')]+'%'};return _0x19ca57;})});}_0x3b6627=_[_0xa894('0x57')]({},_0x3b6627,_0x2e1b42[_0xa894('0x61')]);return db['ChatInteraction'][_0xa894('0x32')]({'where':_0x3b6627[_0xa894('0x55')]})[_0xa894('0x24')](function(_0x2ab9fd){_0x4fbb92[_0xa894('0x32')]=_0x2ab9fd;if(_0x2e1b42['query'][_0xa894('0x5a')]){_0x3b6627[_0xa894('0x5b')]=[{'model':db[_0xa894('0x93')],'as':_0xa894('0xeb'),'required':![]},{'model':db[_0xa894('0xca')],'as':'Owner','attributes':['name','fullname',_0xa894('0xec')],'required':![]},{'model':db['Tag'],'as':_0xa894('0xed'),'attributes':['id',_0xa894('0x40'),_0xa894('0xee')],'where':_0x2e1b42[_0xa894('0x4b')]['tag']?{'id':_0x2e1b42['query'][_0xa894('0xef')]}:undefined,'required':_0x2e1b42[_0xa894('0x4b')]['tag']?!![]:![]}];}return db[_0xa894('0xbd')]['findAll'](_0x3b6627);})[_0xa894('0x24')](function(_0x1fca83){_0x4fbb92['rows']=_0x1fca83;return _0x4fbb92;});}})[_0xa894('0x24')](respondWithFilteredResult(_0x2ecd7d,_0x3b6627))[_0xa894('0x2e')](handleError(_0x2ecd7d,null));};function iftimePromise(_0x5d955a,_0x30256c){return respondWithRpcPromise('Command',_0xa894('0xf0'),{'command':_0x30256c[_0xa894('0xf1')]?util[_0xa894('0xb7')](_0xa894('0xf2'),_0x5d955a[_0xa894('0xf3')],_0x30256c['timezone']):util['format']('iftime\x20%s',_0x5d955a[_0xa894('0xf3')])},client9002)[_0xa894('0x24')](function(_0x2673a4){var _0x582d79=_0x2673a4&&_0x2673a4[_0xa894('0xf4')](_0xa894('0xf5'))>=0x0?!![]:![];logger[_0xa894('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30256c['id'],_0x5d955a['id'],_0x5d955a['interval'],_0x582d79?_0xa894('0xf6'):_0xa894('0xf7'),_0x30256c[_0xa894('0xf1')]?_0x30256c['timezone']:_0xa894('0xf8'));return _0x582d79;})['catch'](function(_0xfd9d54){logger['error'](_0xa894('0xf9'),_0x30256c['id'],_0x5d955a['id'],_0x5d955a[_0xa894('0xf3')],util['inspect'](_0xfd9d54,{'showHidden':![],'depth':null}),_0x30256c[_0xa894('0xf1')]?_0x30256c[_0xa894('0xf1')]:_0xa894('0xf8'));return![];});}exports[_0xa894('0xf0')]=function(_0x114191,_0x4c5269,_0x5514fc){var _0x538dbd=0x0;var _0x4d867e=0x0;var _0x3d770f=![];var _0x15477e;var _0x431b84;return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x114191[_0xa894('0x5f')]['id']},'include':[{'model':db['Interval'],'as':_0xa894('0xfa'),'include':[{'model':db[_0xa894('0xfa')],'as':_0xa894('0xfb'),'attributes':['id',_0xa894('0xf3')],'raw':!![]}]}]})[_0xa894('0x24')](handleEntityNotFound(_0x4c5269,null))['then'](function(_0x2ce417){if(_0x2ce417){_0x15477e=_0x2ce417;return _0x2ce417[_0xa894('0xfc')]({'raw':!![]});}})[_0xa894('0x24')](function(_0x300658){if(_0x15477e){if(_0x300658){_0x431b84=_0x300658;}}return require(_0xa894('0x81'))[_0xa894('0x82')]();})[_0xa894('0x24')](function(_0x51ad3c){if(_0x51ad3c){_0x4d867e=_0x51ad3c[_0xa894('0xfd')];_0x3d770f=_0x51ad3c[_0xa894('0x83')];}})['then'](function(){return db[_0xa894('0xbd')]['count']({'where':{'closed':![]}});})[_0xa894('0x24')](function(_0x4ee39b){_0x538dbd=_0x4ee39b;if(_0x4d867e&&_0x4ee39b>_0x4d867e){return db[_0xa894('0xfe')][_0xa894('0xdc')]({'where':{'id':0x1}})[_0xa894('0x24')](function(_0x36959c){if(_0x36959c){_0x36959c[_0xa894('0xff')]('chatLicenseExceeded');}});}})[_0xa894('0x24')](function(){if(_0x15477e[_0xa894('0xfa')]&&_0x15477e[_0xa894('0xfa')]['Intervals']){var _0x632e3a=[];for(var _0x5002e6=0x0;_0x5002e6<_0x15477e[_0xa894('0xfa')]['Intervals'][_0xa894('0x50')];_0x5002e6++){var _0x1c2fe1=_0x15477e[_0xa894('0xfa')][_0xa894('0xfb')][_0x5002e6]['get']({'plain':!![]});_0x632e3a[_0xa894('0xc4')](iftimePromise(_0x1c2fe1,_0x15477e));}return BPromise[_0xa894('0x100')](_0x632e3a)[_0xa894('0x24')](function(_0x203b18){return _[_0xa894('0x101')](_0x203b18);});}else{return!![];}})['then'](function(_0x193cbc){var _0x49dbcf=fs['readFileSync'](path[_0xa894('0x86')](config[_0xa894('0x7f')],_0xa894('0x102')),_0xa894('0x103'));var _0x27f742={'remote':_0x15477e[_0xa894('0x104')],'query':querystring[_0xa894('0x105')](_[_0xa894('0x57')](_0x15477e[_0xa894('0x3a')]({'plain':!![]}),{'customerIp':_0x114191[_0xa894('0xab')]['x-forwarded-for']||_0x114191['headers'][_0xa894('0x106')]||_0x114191[_0xa894('0x107')]['remoteAddress']||_0x114191['ip'],'referer':_0x114191[_0xa894('0xab')][_0xa894('0xb2')],'openedInteractions':_0x538dbd,'maxInteractions':_0x4d867e,'virtual':_0x3d770f[_0xa894('0xfd')],'online':_0x193cbc,'custom':_0x3d770f}))['replace'](/'/g,'\x5c\x27')};_0x4c5269['send'](ejs['render'](Mustache[_0xa894('0xd7')](_0x49dbcf,_0x27f742),{'proactiveActions':_0x431b84,'alignment':_0x15477e[_0xa894('0x108')],'verticalAlignment':_0x15477e[_0xa894('0x109')],'div_color':_0x15477e[_0xa894('0xee')],'text_color':_0x15477e[_0xa894('0x10a')]}));})['catch'](handleError(_0x4c5269,null));};exports[_0xa894('0x10b')]=function(_0x545803,_0x4799b6,_0x265cee){return db[_0xa894('0x45')]['findOne']({'where':{'id':_0x545803[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x4799b6,null))[_0xa894('0x24')](function(_0x58081a){if(_0x58081a){return db[_0xa894('0x10c')][_0xa894('0x10d')](function(_0x1e2867){return db[_0xa894('0xa2')][_0xa894('0x3d')]({'where':{'ChatWebsiteId':_0x545803['params']['id']},'transaction':_0x1e2867})[_0xa894('0x24')](function(_0x1b5739){var _0x35dcf7=_[_0xa894('0x44')](_0x545803[_0xa894('0x63')],function(_0x56ec53){_0x56ec53[_0xa894('0x72')]=_0x545803[_0xa894('0x5f')]['id'];return _0x56ec53;});return db['ChatApplication'][_0xa894('0x10e')](_0x35dcf7,{'transaction':_0x1e2867});});})['then'](function(){return db['ChatApplication'][_0xa894('0x10f')]({'where':{'ChatWebsiteId':_0x545803['params']['id']},'order':_0xa894('0x110')});});}})[_0xa894('0x24')](respondWithResult(_0x4799b6,null))[_0xa894('0x2e')](handleError(_0x4799b6,null));};exports[_0xa894('0x111')]=function(_0xb5bee8,_0xb63e08,_0x383a7c){var _0xa9b17b={};var _0x84ed28={};var _0x1b21aa;var _0x26bbde;return db[_0xa894('0x45')]['findOne']({'where':{'id':_0xb5bee8['params']['id']}})[_0xa894('0x24')](handleEntityNotFound(_0xb63e08,null))['then'](function(_0x12094e){if(_0x12094e){_0x1b21aa=_0x12094e;_0x84ed28['model']=_[_0xa894('0x4a')](db[_0xa894('0xa2')][_0xa894('0x46')]);_0x84ed28['query']=_['keys'](_0xb5bee8['query']);_0x84ed28['filters']=_[_0xa894('0x4d')](_0x84ed28[_0xa894('0x49')],_0x84ed28[_0xa894('0x4b')]);_0xa9b17b[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0x84ed28['model'],qs['fields'](_0xb5bee8['query'][_0xa894('0x4f')]));_0xa9b17b[_0xa894('0x4e')]=_0xa9b17b[_0xa894('0x4e')][_0xa894('0x50')]?_0xa9b17b[_0xa894('0x4e')]:_0x84ed28[_0xa894('0x49')];_0xa9b17b[_0xa894('0x53')]=qs[_0xa894('0x54')](_0xb5bee8[_0xa894('0x4b')][_0xa894('0x54')]);_0xa9b17b[_0xa894('0x55')]=qs[_0xa894('0x4c')](_['pick'](_0xb5bee8[_0xa894('0x4b')],_0x84ed28['filters']));if(_0xb5bee8['query']['filter']){_0xa9b17b['where']=_[_0xa894('0x57')](_0xa9b17b[_0xa894('0x55')],{'$or':_['map'](_0xa9b17b['attributes'],function(_0x2aa6e9){var _0x213740={};_0x213740[_0x2aa6e9]={'$like':'%'+_0xb5bee8[_0xa894('0x4b')][_0xa894('0x56')]+'%'};return _0x213740;})});}_0xa9b17b=_[_0xa894('0x57')]({},_0xa9b17b,_0xb5bee8[_0xa894('0x61')]);return _0x1b21aa[_0xa894('0x111')](_0xa9b17b);}})[_0xa894('0x24')](function(_0x4356d9){if(_0x4356d9){_0x26bbde=_0x4356d9[_0xa894('0x50')];if(!_0xb5bee8[_0xa894('0x4b')]['hasOwnProperty']('nolimit')){_0xa9b17b['limit']=qs[_0xa894('0x34')](_0xb5bee8[_0xa894('0x4b')][_0xa894('0x34')]);_0xa9b17b[_0xa894('0x33')]=qs['offset'](_0xb5bee8[_0xa894('0x4b')][_0xa894('0x33')]);}return _0x1b21aa['getApplications'](_0xa9b17b);}})[_0xa894('0x24')](function(_0x4f85bd){if(_0x4f85bd){return _0x4f85bd?{'count':_0x26bbde,'rows':_0x4f85bd}:null;}})[_0xa894('0x24')](respondWithResult(_0xb63e08,null))['catch'](handleError(_0xb63e08,null));};exports[_0xa894('0x112')]=function(_0x5744e8,_0x3158cf,_0x1f09b7){return db['chatProactiveAction'][_0xa894('0x62')]({'where':{'id':_0x5744e8[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x3158cf,null))[_0xa894('0x24')](function(_0x514d77){if(_0x514d77){return _0x514d77[_0xa894('0x112')](_0x5744e8[_0xa894('0x63')]['ids'],_[_0xa894('0xe9')](_0x5744e8[_0xa894('0x63')],[_0xa894('0x70'),'id'])||{});}})[_0xa894('0x24')](respondWithResult(_0x3158cf,null))[_0xa894('0x2e')](handleError(_0x3158cf,null));};exports[_0xa894('0xfc')]=function(_0x5e11ba,_0x4be03e,_0x25cdeb){var _0x3a7fe7={};var _0x4b6627={};var _0x3a482a;var _0x5861d8;return db[_0xa894('0x45')]['findOne']({'where':{'id':_0x5e11ba[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4be03e,null))['then'](function(_0x55dd4c){if(_0x55dd4c){_0x3a482a=_0x55dd4c;_0x4b6627['model']=_['keys'](db[_0xa894('0x113')]['rawAttributes']);_0x4b6627[_0xa894('0x4b')]=_[_0xa894('0x4a')](_0x5e11ba[_0xa894('0x4b')]);_0x4b6627[_0xa894('0x4c')]=_['intersection'](_0x4b6627[_0xa894('0x49')],_0x4b6627[_0xa894('0x4b')]);_0x3a7fe7[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0x4b6627[_0xa894('0x49')],qs[_0xa894('0x4f')](_0x5e11ba['query'][_0xa894('0x4f')]));_0x3a7fe7[_0xa894('0x4e')]=_0x3a7fe7[_0xa894('0x4e')][_0xa894('0x50')]?_0x3a7fe7[_0xa894('0x4e')]:_0x4b6627['model'];_0x3a7fe7['order']=qs[_0xa894('0x54')](_0x5e11ba[_0xa894('0x4b')]['sort']);_0x3a7fe7[_0xa894('0x55')]=qs[_0xa894('0x4c')](_[_0xa894('0x75')](_0x5e11ba[_0xa894('0x4b')],_0x4b6627[_0xa894('0x4c')]));if(_0x5e11ba['query']['filter']){_0x3a7fe7[_0xa894('0x55')]=_[_0xa894('0x57')](_0x3a7fe7[_0xa894('0x55')],{'$or':_[_0xa894('0x44')](_0x3a7fe7['attributes'],function(_0x1f66b2){var _0x1b8163={};_0x1b8163[_0x1f66b2]={'$like':'%'+_0x5e11ba[_0xa894('0x4b')][_0xa894('0x56')]+'%'};return _0x1b8163;})});}_0x3a7fe7=_[_0xa894('0x57')]({},_0x3a7fe7,_0x5e11ba[_0xa894('0x61')]);return _0x3a482a[_0xa894('0xfc')](_0x3a7fe7);}})[_0xa894('0x24')](function(_0x1c4a82){if(_0x1c4a82){_0x5861d8=_0x1c4a82[_0xa894('0x50')];if(!_0x5e11ba[_0xa894('0x4b')][_0xa894('0x51')](_0xa894('0x52'))){_0x3a7fe7[_0xa894('0x34')]=qs['limit'](_0x5e11ba[_0xa894('0x4b')][_0xa894('0x34')]);_0x3a7fe7[_0xa894('0x33')]=qs[_0xa894('0x33')](_0x5e11ba[_0xa894('0x4b')]['offset']);}return _0x3a482a[_0xa894('0xfc')](_0x3a7fe7);}})[_0xa894('0x24')](function(_0x3faceb){if(_0x3faceb){return _0x3faceb?{'count':_0x5861d8,'rows':_0x3faceb}:null;}})[_0xa894('0x24')](respondWithResult(_0x4be03e,null))[_0xa894('0x2e')](handleError(_0x4be03e,null));};exports[_0xa894('0x114')]=function(_0x3b1968,_0x340c91,_0x98a9ad){var _0x30d8e2=_0x3b1968[_0xa894('0x4b')]['online']===_0xa894('0x115')?_0xa894('0x116'):_0xa894('0x117');return db[_0xa894('0x45')][_0xa894('0x62')]({'attributes':['id',_0x30d8e2],'where':{'id':_0x3b1968['params']['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x340c91,null))[_0xa894('0x24')](function(_0x4120c8){if(_0x4120c8){var _0x4f2afc=_0x4120c8[_0x30d8e2];var _0x5b4a9e=_0x4f2afc&&_0x4f2afc[_0xa894('0x118')]?_0x4f2afc[_0xa894('0x118')]:[];_0x340c91['send']({'fromKey':_[_0xa894('0x84')](_0x4f2afc[_0xa894('0x119')])?undefined:_0x4f2afc[_0xa894('0x119')],'count':_0x5b4a9e[_0xa894('0x50')],'rows':_0x5b4a9e});}})['catch'](handleError(_0x340c91,null));};exports[_0xa894('0x11a')]=function(_0x537d3a,_0x1d0fff,_0x5d3bdf){var _0x456c02={'raw':![],'where':{}};var _0x55fef6={};var _0x42a83b={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x537d3a[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1d0fff,null))[_0xa894('0x24')](function(_0x58ed49){if(_0x58ed49){_0x55fef6[_0xa894('0x49')]=_[_0xa894('0x4a')](db['ChatOfflineMessage']['rawAttributes']);_0x55fef6['query']=_[_0xa894('0x4a')](_0x537d3a[_0xa894('0x4b')]);_0x55fef6[_0xa894('0x4c')]=_[_0xa894('0x4d')](_0x55fef6[_0xa894('0x49')],_0x55fef6['query']);_0x456c02[_0xa894('0x4e')]=_[_0xa894('0x4d')](_0x55fef6[_0xa894('0x49')],qs[_0xa894('0x4f')](_0x537d3a[_0xa894('0x4b')][_0xa894('0x4f')]));_0x456c02[_0xa894('0x4e')]=_0x456c02[_0xa894('0x4e')][_0xa894('0x50')]?_0x456c02['attributes']:_0x55fef6[_0xa894('0x49')];if(!_0x537d3a[_0xa894('0x4b')][_0xa894('0x51')](_0xa894('0x52'))){_0x456c02[_0xa894('0x34')]=qs[_0xa894('0x34')](_0x537d3a[_0xa894('0x4b')][_0xa894('0x34')]);_0x456c02['offset']=qs[_0xa894('0x33')](_0x537d3a[_0xa894('0x4b')][_0xa894('0x33')]);}_0x456c02[_0xa894('0x53')]=qs[_0xa894('0x54')](_0x537d3a[_0xa894('0x4b')][_0xa894('0x54')]);_0x456c02['where']=qs[_0xa894('0x4c')](_[_0xa894('0x75')](_0x537d3a[_0xa894('0x4b')],_0x55fef6[_0xa894('0x4c')]));_0x456c02['where'][_0xa894('0x72')]=_0x58ed49['id'];if(_0x537d3a[_0xa894('0x4b')]['filter']){_0x456c02[_0xa894('0x55')]=_[_0xa894('0x57')](_0x456c02['where'],{'$or':_[_0xa894('0x44')](_0x456c02['attributes'],function(_0x1918e4){var _0x32ad4b={};_0x32ad4b[_0x1918e4]={'$like':'%'+_0x537d3a[_0xa894('0x4b')][_0xa894('0x56')]+'%'};return _0x32ad4b;})});}_0x456c02=_[_0xa894('0x57')]({},_0x456c02,_0x537d3a[_0xa894('0x61')]);return db[_0xa894('0xda')][_0xa894('0x32')]({'where':_0x456c02[_0xa894('0x55')]})[_0xa894('0x24')](function(_0x4ccf16){_0x42a83b[_0xa894('0x32')]=_0x4ccf16;if(_0x537d3a['query'][_0xa894('0x5a')]){_0x456c02[_0xa894('0x5b')]=[{'all':!![]}];}else{_0x456c02[_0xa894('0x5b')]=[{'model':db[_0xa894('0x93')],'as':_0xa894('0xeb'),'required':![]}];}return db[_0xa894('0xda')]['findAll'](_0x456c02);})[_0xa894('0x24')](function(_0x10ee9f){_0x42a83b['rows']=_0x10ee9f;return _0x42a83b;});}})['then'](respondWithFilteredResult(_0x1d0fff,_0x456c02))[_0xa894('0x2e')](handleError(_0x1d0fff,null));};exports['addAgents']=function(_0x3cf050,_0x323e80,_0x18a20f){return db[_0xa894('0x45')][_0xa894('0x62')]({'where':{'id':_0x3cf050[_0xa894('0x5f')]['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x323e80,null))['then'](function(_0x643a88){if(_0x643a88){return _0x643a88[_0xa894('0x11b')](_0x3cf050[_0xa894('0x63')][_0xa894('0x70')],_[_0xa894('0xe9')](_0x3cf050[_0xa894('0x63')],[_0xa894('0x70'),'id'])||{})['spread'](function(_0x2877c0){for(var _0x4cf762=0x0;_0x4cf762<_0x3cf050[_0xa894('0x63')][_0xa894('0x70')][_0xa894('0x50')];_0x4cf762+=0x1){socket[_0xa894('0x11c')]('userChatWebsite:save',{'UserId':_0x3cf050[_0xa894('0x63')]['ids'][_0x4cf762],'ChatWebsiteId':_0x3cf050[_0xa894('0x5f')]['id']});}return _0x2877c0;});}})[_0xa894('0x24')](respondWithResult(_0x323e80,null))[_0xa894('0x2e')](handleError(_0x323e80,null));};exports[_0xa894('0x11d')]=function(_0x3b1e06,_0x4f0ef0,_0x3808d1){return db[_0xa894('0x45')]['find']({'where':{'id':_0x3b1e06['params']['id']}})[_0xa894('0x24')](handleEntityNotFound(_0x4f0ef0,null))[_0xa894('0x24')](function(_0x3cedab){if(_0x3cedab){return _0x3cedab[_0xa894('0x11d')](_0x3b1e06['query'][_0xa894('0x70')])[_0xa894('0x24')](function(){if(_[_0xa894('0x11e')](_0x3b1e06['query'][_0xa894('0x70')])){for(var _0x36fac6=0x0;_0x36fac6<_0x3b1e06['query'][_0xa894('0x70')]['length'];_0x36fac6+=0x1){socket[_0xa894('0x11c')](_0xa894('0x11f'),{'UserId':Number(_0x3b1e06[_0xa894('0x4b')][_0xa894('0x70')][_0x36fac6]),'ChatWebsiteId':Number(_0x3b1e06[_0xa894('0x5f')]['id'])});}}else{socket[_0xa894('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x3b1e06['query'][_0xa894('0x70')]),'ChatWebsiteId':Number(_0x3b1e06[_0xa894('0x5f')]['id'])});}});}})[_0xa894('0x24')](respondWithStatusCode(_0x4f0ef0,null))[_0xa894('0x2e')](handleError(_0x4f0ef0,null));};exports[_0xa894('0x120')]=function(_0x66e37b,_0x549238,_0x479570){var _0x52ea16={};var _0x38934a={};var _0x4ec244;var _0x1c0663;return db['ChatWebsite']['findOne']({'where':{'id':_0x66e37b[_0xa894('0x5f')]['id']}})['then'](handleEntityNotFound(_0x549238,null))['then'](function(_0x49f4fa){if(_0x49f4fa){_0x4ec244=_0x49f4fa;_0x38934a[_0xa894('0x49')]=_[_0xa894('0x4a')](db['User'][_0xa894('0x46')]);_0x38934a['query']=_[_0xa894('0x4a')](_0x66e37b[_0xa894('0x4b')]);_0x38934a['filters']=_['intersection'](_0x38934a[_0xa894('0x49')],_0x38934a[_0xa894('0x4b')]);_0x52ea16['attributes']=_[_0xa894('0x4d')](_0x38934a[_0xa894('0x49')],qs['fields'](_0x66e37b['query'][_0xa894('0x4f')]));_0x52ea16[_0xa894('0x4e')]=_0x52ea16['attributes'][_0xa894('0x50')]?_0x52ea16[_0xa894('0x4e')]:_0x38934a[_0xa894('0x49')];_0x52ea16[_0xa894('0x53')]=qs[_0xa894('0x54')](_0x66e37b[_0xa894('0x4b')]['sort']);_0x52ea16['where']=qs[_0xa894('0x4c')](_[_0xa894('0x75')](_0x66e37b[_0xa894('0x4b')],_0x38934a[_0xa894('0x4c')]));if(_0x66e37b[_0xa894('0x4b')][_0xa894('0x56')]){_0x52ea16['where']=_[_0xa894('0x57')](_0x52ea16[_0xa894('0x55')],{'$or':_[_0xa894('0x44')](_0x52ea16[_0xa894('0x4e')],function(_0x300f27){var _0x1a024f={};_0x1a024f[_0x300f27]={'$like':'%'+_0x66e37b[_0xa894('0x4b')][_0xa894('0x56')]+'%'};return _0x1a024f;})});}_0x52ea16=_[_0xa894('0x57')]({},_0x52ea16,_0x66e37b[_0xa894('0x61')]);return _0x4ec244[_0xa894('0x120')](_0x52ea16);}})['then'](function(_0x2b405f){if(_0x2b405f){_0x1c0663=_0x2b405f[_0xa894('0x50')];if(!_0x66e37b[_0xa894('0x4b')][_0xa894('0x51')](_0xa894('0x52'))){_0x52ea16[_0xa894('0x34')]=qs['limit'](_0x66e37b[_0xa894('0x4b')][_0xa894('0x34')]);_0x52ea16[_0xa894('0x33')]=qs[_0xa894('0x33')](_0x66e37b[_0xa894('0x4b')][_0xa894('0x33')]);}return _0x4ec244[_0xa894('0x120')](_0x52ea16);}})[_0xa894('0x24')](function(_0x8c542a){if(_0x8c542a){return _0x8c542a?{'count':_0x1c0663,'rows':_0x8c542a}:null;}})[_0xa894('0x24')](respondWithResult(_0x549238,null))['catch'](handleError(_0x549238,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 86c3365..5e0690c 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 _0xa566=['hook','events','../../mysqldb','ChatWebsite','save','update','remove'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0xa566,0x1c1));var _0x6a56=function(_0x4e122b,_0x1ee5f5){_0x4e122b=_0x4e122b-0x0;var _0x142788=_0xa566[_0x4e122b];return _0x142788;};'use strict';var EventEmitter=require(_0x6a56('0x0'));var ChatWebsite=require(_0x6a56('0x1'))['db'][_0x6a56('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a56('0x3'),'afterUpdate':_0x6a56('0x4'),'afterDestroy':_0x6a56('0x5')};function emitEvent(_0x2e5a2c){return function(_0x48439b,_0x37b6b4,_0x4b166a){ChatWebsiteEvents['emit'](_0x2e5a2c+':'+_0x48439b['id'],_0x48439b);ChatWebsiteEvents['emit'](_0x2e5a2c,_0x48439b);_0x4b166a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6a56('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xc090=['update','remove','emit','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0xf2bb83,_0x3d21d2){var _0x22cc7b=function(_0x37bf8f){while(--_0x37bf8f){_0xf2bb83['push'](_0xf2bb83['shift']());}};_0x22cc7b(++_0x3d21d2);}(_0xc090,0x112));var _0x0c09=function(_0x3c603d,_0x4ffdc2){_0x3c603d=_0x3c603d-0x0;var _0x5db10c=_0xc090[_0x3c603d];return _0x5db10c;};'use strict';var EventEmitter=require(_0x0c09('0x0'));var ChatWebsite=require(_0x0c09('0x1'))['db'][_0x0c09('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0c09('0x3')](0x0);var events={'afterCreate':_0x0c09('0x4'),'afterUpdate':_0x0c09('0x5'),'afterDestroy':_0x0c09('0x6')};function emitEvent(_0x260c36){return function(_0x11984f,_0x487f03,_0x2e968b){ChatWebsiteEvents[_0x0c09('0x7')](_0x260c36+':'+_0x11984f['id'],_0x11984f);ChatWebsiteEvents['emit'](_0x260c36,_0x11984f);_0x2e968b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0c09('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 72791f4..0646845 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 _0xff96=['path','rimraf','../../config/environment','./chatWebsite.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d378f,_0xc205d3){var _0x20e6aa=function(_0x2db9e3){while(--_0x2db9e3){_0x1d378f['push'](_0x1d378f['shift']());}};_0x20e6aa(++_0xc205d3);}(_0xff96,0x179));var _0x6ff9=function(_0x47856a,_0x1ad7a0){_0x47856a=_0x47856a-0x0;var _0x1edd96=_0xff96[_0x47856a];return _0x1edd96;};'use strict';var _=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var logger=require(_0x6ff9('0x2'))(_0x6ff9('0x3'));var moment=require(_0x6ff9('0x4'));var BPromise=require(_0x6ff9('0x5'));var rp=require(_0x6ff9('0x6'));var fs=require('fs');var path=require(_0x6ff9('0x7'));var rimraf=require(_0x6ff9('0x8'));var config=require(_0x6ff9('0x9'));var attributes=require(_0x6ff9('0xa'));module[_0x6ff9('0xb')]=function(_0x4adb77,_0x3efaff){return _0x4adb77['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc678=['path','rimraf','../../config/environment','exports','define','chat_websites','../../config/logger','api','moment','request-promise'];(function(_0x33b62d,_0x507d01){var _0x215d79=function(_0x3b7c4f){while(--_0x3b7c4f){_0x33b62d['push'](_0x33b62d['shift']());}};_0x215d79(++_0x507d01);}(_0xc678,0x1b4));var _0x8c67=function(_0x1446cc,_0x4fcb85){_0x1446cc=_0x1446cc-0x0;var _0x60b2b=_0xc678[_0x1446cc];return _0x60b2b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c67('0x0'))(_0x8c67('0x1'));var moment=require(_0x8c67('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c67('0x3'));var fs=require('fs');var path=require(_0x8c67('0x4'));var rimraf=require(_0x8c67('0x5'));var config=require(_0x8c67('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x8c67('0x7')]=function(_0x5cdb40,_0x351c21){return _0x5cdb40[_0x8c67('0x8')]('ChatWebsite',attributes,{'tableName':_0x8c67('0x9'),'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 2ce576e..d7eeaac 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 _0x896e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x174c83,_0x44a121){var _0x53252f=function(_0x1863f6){while(--_0x1863f6){_0x174c83['push'](_0x174c83['shift']());}};_0x53252f(++_0x44a121);}(_0x896e,0x1e9));var _0xe896=function(_0x2fb99a,_0x21abbd){_0x2fb99a=_0x2fb99a-0x0;var _0xc58608=_0x896e[_0x2fb99a];return _0xc58608;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});} \ No newline at end of file +var _0xc1c6=['./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x4134c6,_0x2d22e4){var _0x162730=function(_0x20df8b){while(--_0x20df8b){_0x4134c6['push'](_0x4134c6['shift']());}};_0x162730(++_0x2d22e4);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x481156,_0x398bcf){_0x481156=_0x481156-0x0;var _0x56ef10=_0xc1c6[_0x481156];return _0x56ef10;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 11bc5ab..da8c548 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(_0x29c934,_0x3c30e2){var _0x4302de=function(_0x179a5a){while(--_0x179a5a){_0x29c934['push'](_0x29c934['shift']());}};_0x4302de(++_0x3c30e2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c7de2,_0x4ac9f6){_0x4c7de2=_0x4c7de2-0x0;var _0x5d1ed3=_0x5f2f[_0x4c7de2];return _0x5d1ed3;};'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(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41d7dd,_0x15f9c0){_0x41d7dd=_0x41d7dd-0x0;var _0x33e456=_0x5f2f[_0x41d7dd];return _0x33e456;};'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 86ad24d..18633af 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 _0x2983=['/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','addLogo','join','now','originalname','single','file','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','removeDispositions','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar'];(function(_0xf171d9,_0x47cc38){var _0xa3ac8=function(_0x4685b4){while(--_0x4685b4){_0xf171d9['push'](_0xf171d9['shift']());}};_0xa3ac8(++_0x47cc38);}(_0x2983,0xa8));var _0x3298=function(_0x3a031b,_0x5aa87f){_0x3a031b=_0x3a031b-0x0;var _0x54eb95=_0x2983[_0x3a031b];return _0x54eb95;};'use strict';var multer=require(_0x3298('0x0'));var util=require(_0x3298('0x1'));var path=require(_0x3298('0x2'));var timeout=require('connect-timeout');var express=require(_0x3298('0x3'));var router=express[_0x3298('0x4')]();var auth=require(_0x3298('0x5'));var interaction=require(_0x3298('0x6'));var config=require(_0x3298('0x7'));var controller=require(_0x3298('0x8'));router[_0x3298('0x9')]('/',auth[_0x3298('0xa')](),controller[_0x3298('0xb')]);router[_0x3298('0x9')](_0x3298('0xc'),auth[_0x3298('0xa')](),controller['describe']);router[_0x3298('0x9')](_0x3298('0xd'),auth[_0x3298('0xa')](),controller[_0x3298('0xe')]);router[_0x3298('0x9')](_0x3298('0xf'),auth[_0x3298('0xa')](),controller['getDispositions']);router[_0x3298('0x9')](_0x3298('0x10'),auth[_0x3298('0xa')](),controller['getAnswers']);router[_0x3298('0x9')](_0x3298('0x11'),controller[_0x3298('0x12')]);router[_0x3298('0x9')](_0x3298('0x13'),controller[_0x3298('0x14')]);router[_0x3298('0x9')](_0x3298('0x15'),controller['getCustomerAvatar']);router[_0x3298('0x9')](_0x3298('0x16'),controller[_0x3298('0x17')]);router[_0x3298('0x9')](_0x3298('0x18'),auth['isAuthenticated'](),controller[_0x3298('0x19')]);router[_0x3298('0x9')](_0x3298('0x1a'),controller[_0x3298('0x1b')]);router[_0x3298('0x9')](_0x3298('0x1c'),auth['isAuthenticated'](),controller['getApplications']);router[_0x3298('0x9')]('/:id/proactive_actions',auth[_0x3298('0xa')](),controller[_0x3298('0x1d')]);router[_0x3298('0x9')]('/:id/fields',controller[_0x3298('0x1e')]);router[_0x3298('0x9')](_0x3298('0x1f'),auth[_0x3298('0xa')](),controller[_0x3298('0x20')]);router[_0x3298('0x9')](_0x3298('0x21'),auth[_0x3298('0xa')](),controller[_0x3298('0x22')]);router[_0x3298('0x23')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3298('0xf'),auth['isAuthenticated'](),controller[_0x3298('0x24')]);router[_0x3298('0x23')](_0x3298('0x10'),auth[_0x3298('0xa')](),controller[_0x3298('0x25')]);var upload=multer({'storage':multer[_0x3298('0x26')]({'destination':function(_0x1041c4,_0x62912d,_0x267792){_0x267792(null,path['join'](config[_0x3298('0x27')],_0x3298('0x28')));},'filename':function(_0x51573e,_0x477963,_0x191de0){_0x191de0(null,util[_0x3298('0x29')](_0x3298('0x2a'),Date['now'](),_0x477963['originalname']));}})});router['post'](_0x3298('0x11'),upload['single']('file'),controller[_0x3298('0x2b')]);var upload=multer({'storage':multer[_0x3298('0x26')]({'destination':function(_0x1b3ae3,_0x191ac4,_0x941415){_0x941415(null,path[_0x3298('0x2c')](config[_0x3298('0x27')],'server/files/images/avatars/'));},'filename':function(_0x5646bd,_0x1cfc14,_0x2f8919){_0x2f8919(null,util['format']('%s-%s',Date[_0x3298('0x2d')](),_0x1cfc14[_0x3298('0x2e')]));}})});router['post']('/:id/avatar',upload[_0x3298('0x2f')](_0x3298('0x30')),controller['addAvatar']);var upload=multer({'storage':multer[_0x3298('0x26')]({'destination':function(_0x4990f4,_0x205091,_0x45945e){_0x45945e(null,path[_0x3298('0x2c')](config[_0x3298('0x27')],_0x3298('0x31')));},'filename':function(_0x4d7286,_0xf60730,_0x46c164){_0x46c164(null,util[_0x3298('0x29')](_0x3298('0x2a'),Date['now'](),_0xf60730[_0x3298('0x2e')]));}})});router[_0x3298('0x23')](_0x3298('0x15'),upload['single'](_0x3298('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x3298('0x26')]({'destination':function(_0x211169,_0xdf7f0c,_0x1dc221){_0x1dc221(null,path[_0x3298('0x2c')](config[_0x3298('0x27')],'server/files/images/avatars/'));},'filename':function(_0x26d018,_0x483c5c,_0x52729d){_0x52729d(null,util['format'](_0x3298('0x2a'),Date[_0x3298('0x2d')](),_0x483c5c[_0x3298('0x2e')]));}})});router[_0x3298('0x23')](_0x3298('0x16'),upload[_0x3298('0x2f')](_0x3298('0x30')),controller[_0x3298('0x32')]);router[_0x3298('0x23')](_0x3298('0x33'),controller[_0x3298('0x34')]);router[_0x3298('0x23')](_0x3298('0x35'),controller[_0x3298('0x36')]);router[_0x3298('0x23')](_0x3298('0x18'),auth[_0x3298('0xa')](),controller[_0x3298('0x37')]);router[_0x3298('0x23')](_0x3298('0x1c'),auth[_0x3298('0xa')](),controller[_0x3298('0x38')]);router[_0x3298('0x23')](_0x3298('0x39'),auth[_0x3298('0xa')](),controller[_0x3298('0x3a')]);router[_0x3298('0x23')](_0x3298('0x21'),auth[_0x3298('0xa')](),controller[_0x3298('0x3b')]);router[_0x3298('0x3c')](_0x3298('0xd'),auth[_0x3298('0xa')](),controller[_0x3298('0x3d')]);router['delete'](_0x3298('0xd'),auth[_0x3298('0xa')](),controller['destroy']);router[_0x3298('0x3e')](_0x3298('0xf'),auth['isAuthenticated'](),controller[_0x3298('0x3f')]);router['delete'](_0x3298('0x10'),auth[_0x3298('0xa')](),controller['removeAnswers']);router[_0x3298('0x3e')]('/:id/users',auth[_0x3298('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe592=['format','%s-%s','now','originalname','file','addLogo','root','server/files/images/avatars/','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0xe592,0x160));var _0x2e59=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0xe592[_0x5b13c3];return _0x3d6780;};'use strict';var multer=require(_0x2e59('0x0'));var util=require('util');var path=require(_0x2e59('0x1'));var timeout=require(_0x2e59('0x2'));var express=require(_0x2e59('0x3'));var router=express['Router']();var auth=require(_0x2e59('0x4'));var interaction=require(_0x2e59('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2e59('0x6')]('/describe',auth[_0x2e59('0x7')](),controller[_0x2e59('0x8')]);router[_0x2e59('0x6')]('/:id',auth[_0x2e59('0x7')](),controller[_0x2e59('0x9')]);router['get'](_0x2e59('0xa'),auth['isAuthenticated'](),controller[_0x2e59('0xb')]);router[_0x2e59('0x6')](_0x2e59('0xc'),auth['isAuthenticated'](),controller[_0x2e59('0xd')]);router[_0x2e59('0x6')](_0x2e59('0xe'),controller[_0x2e59('0xf')]);router[_0x2e59('0x6')](_0x2e59('0x10'),controller[_0x2e59('0x11')]);router['get'](_0x2e59('0x12'),controller[_0x2e59('0x13')]);router[_0x2e59('0x6')](_0x2e59('0x14'),controller[_0x2e59('0x15')]);router[_0x2e59('0x6')](_0x2e59('0x16'),auth['isAuthenticated'](),controller[_0x2e59('0x17')]);router[_0x2e59('0x6')](_0x2e59('0x18'),controller['getSnippet']);router[_0x2e59('0x6')](_0x2e59('0x19'),auth[_0x2e59('0x7')](),controller['getApplications']);router['get'](_0x2e59('0x1a'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x1b')]);router[_0x2e59('0x6')](_0x2e59('0x1c'),controller['getFields']);router[_0x2e59('0x6')](_0x2e59('0x1d'),auth['isAuthenticated'](),controller[_0x2e59('0x1e')]);router[_0x2e59('0x6')]('/:id/users',auth[_0x2e59('0x7')](),controller[_0x2e59('0x1f')]);router[_0x2e59('0x20')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2e59('0xa'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x21')]);router[_0x2e59('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2e59('0x22')]);var upload=multer({'storage':multer[_0x2e59('0x23')]({'destination':function(_0x58df36,_0x5aa058,_0x2945c1){_0x2945c1(null,path[_0x2e59('0x24')](config['root'],_0x2e59('0x25')));},'filename':function(_0x49f551,_0x33d798,_0x566974){_0x566974(null,util[_0x2e59('0x26')](_0x2e59('0x27'),Date[_0x2e59('0x28')](),_0x33d798[_0x2e59('0x29')]));}})});router[_0x2e59('0x20')]('/:id/logo',upload['single'](_0x2e59('0x2a')),controller[_0x2e59('0x2b')]);var upload=multer({'storage':multer[_0x2e59('0x23')]({'destination':function(_0x55fda5,_0x244d89,_0x4ba9a8){_0x4ba9a8(null,path[_0x2e59('0x24')](config[_0x2e59('0x2c')],_0x2e59('0x2d')));},'filename':function(_0x238b7a,_0x3a8f1b,_0x298127){_0x298127(null,util[_0x2e59('0x26')](_0x2e59('0x27'),Date['now'](),_0x3a8f1b[_0x2e59('0x29')]));}})});router['post'](_0x2e59('0x10'),upload['single'](_0x2e59('0x2a')),controller[_0x2e59('0x2e')]);var upload=multer({'storage':multer[_0x2e59('0x23')]({'destination':function(_0x269e28,_0x245ea7,_0x3be4b1){_0x3be4b1(null,path[_0x2e59('0x24')](config['root'],_0x2e59('0x2d')));},'filename':function(_0x4bdad7,_0x37c6fe,_0x56c792){_0x56c792(null,util['format'](_0x2e59('0x27'),Date[_0x2e59('0x28')](),_0x37c6fe[_0x2e59('0x29')]));}})});router['post'](_0x2e59('0x12'),upload[_0x2e59('0x2f')](_0x2e59('0x2a')),controller[_0x2e59('0x30')]);var upload=multer({'storage':multer[_0x2e59('0x23')]({'destination':function(_0x4ad00c,_0x2f39aa,_0x303c56){_0x303c56(null,path[_0x2e59('0x24')](config[_0x2e59('0x2c')],_0x2e59('0x2d')));},'filename':function(_0x3522d8,_0xf4919f,_0x2dd30b){_0x2dd30b(null,util['format'](_0x2e59('0x27'),Date[_0x2e59('0x28')](),_0xf4919f['originalname']));}})});router[_0x2e59('0x20')](_0x2e59('0x14'),upload[_0x2e59('0x2f')]('file'),controller[_0x2e59('0x31')]);router[_0x2e59('0x20')](_0x2e59('0x32'),controller[_0x2e59('0x33')]);router[_0x2e59('0x20')]('/:id/offline',controller[_0x2e59('0x34')]);router['post'](_0x2e59('0x16'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x35')]);router[_0x2e59('0x20')]('/:id/applications',auth[_0x2e59('0x7')](),controller[_0x2e59('0x36')]);router[_0x2e59('0x20')](_0x2e59('0x1a'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x37')]);router[_0x2e59('0x20')](_0x2e59('0x38'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x39')]);router[_0x2e59('0x3a')]('/:id',auth['isAuthenticated'](),controller[_0x2e59('0x3b')]);router[_0x2e59('0x3c')]('/:id',auth[_0x2e59('0x7')](),controller['destroy']);router[_0x2e59('0x3c')](_0x2e59('0xa'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x3d')]);router[_0x2e59('0x3c')](_0x2e59('0xc'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x3e')]);router[_0x2e59('0x3c')](_0x2e59('0x38'),auth[_0x2e59('0x7')](),controller[_0x2e59('0x3f')]);module[_0x2e59('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index da99194..dffd209 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 _0x3d49=['AmazonAWS','exports','STRING','ENUM'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3d49,0x151));var _0x93d4=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0x3d49[_0x177346];return _0x155669;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'name':{'type':Sequelize[_0x93d4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x93d4('0x2')](_0x93d4('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x93d4('0x1')]},'data2':{'type':Sequelize[_0x93d4('0x1')]}}; \ No newline at end of file +var _0x3641=['AmazonAWS','Google','STRING','exports'];(function(_0x4172c0,_0x209671){var _0x2dd46e=function(_0x25a3ee){while(--_0x25a3ee){_0x4172c0['push'](_0x4172c0['shift']());}};_0x2dd46e(++_0x209671);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1364('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x1364('0x1'),_0x1364('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x1364('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f81d06b..1a90139 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 _0xbe4b=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','index','map','CloudProvider','rawAttributes','type','key','model','name','query','keys','filters','intersection'];(function(_0x33adaa,_0xba6620){var _0x2a5466=function(_0x107094){while(--_0x107094){_0x33adaa['push'](_0x33adaa['shift']());}};_0x2a5466(++_0xba6620);}(_0xbe4b,0xeb));var _0xbbe4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbe4b[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0xbbe4('0x0'));var emlformat=require(_0xbbe4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbbe4('0x2'));var rp=require(_0xbbe4('0x3'));var moment=require('moment');var BPromise=require(_0xbbe4('0x4'));var Mustache=require(_0xbbe4('0x5'));var util=require(_0xbbe4('0x6'));var path=require('path');var sox=require(_0xbbe4('0x7'));var csv=require('to-csv');var ejs=require(_0xbbe4('0x8'));var fs=require('fs');var _=require(_0xbbe4('0x9'));var squel=require('squel');var crypto=require(_0xbbe4('0xa'));var jsforce=require(_0xbbe4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbbe4('0xc'));var querystring=require(_0xbbe4('0xd'));var Papa=require(_0xbbe4('0xe'));var Redis=require(_0xbbe4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbbe4('0x10'));var as=require(_0xbbe4('0x11'));var hardwareService=require(_0xbbe4('0x12'));var logger=require('../../config/logger')(_0xbbe4('0x13'));var utils=require(_0xbbe4('0x14'));var config=require(_0xbbe4('0x15'));var db=require(_0xbbe4('0x16'))['db'];function respondWithStatusCode(_0x345b4d,_0x4055c0){_0x4055c0=_0x4055c0||0xcc;return function(_0x333eb5){if(_0x333eb5){return _0x345b4d[_0xbbe4('0x17')](_0x4055c0);}return _0x345b4d[_0xbbe4('0x18')](_0x4055c0)[_0xbbe4('0x19')]();};}function respondWithResult(_0x127b0e,_0x504472){_0x504472=_0x504472||0xc8;return function(_0x2e67a0){if(_0x2e67a0){return _0x127b0e[_0xbbe4('0x18')](_0x504472)['json'](_0x2e67a0);}};}function respondWithFilteredResult(_0x36325c,_0x454c08){return function(_0x96c235){if(_0x96c235){var _0x442024=_0x96c235[_0xbbe4('0x1a')],_0x9e288b=_0x454c08[_0xbbe4('0x1b')],_0x33ee37=_0x454c08[_0xbbe4('0x1b')]+_0x454c08[_0xbbe4('0x1c')],_0xcea5b6;if(_0x33ee37>=_0x442024){_0x33ee37=_0x442024;_0xcea5b6=0xc8;}else{_0xcea5b6=0xce;}_0x36325c[_0xbbe4('0x18')](_0xcea5b6);return _0x36325c['set'](_0xbbe4('0x1d'),_0x9e288b+'-'+_0x33ee37+'/'+_0x442024)[_0xbbe4('0x1e')](_0x96c235);}return null;};}function patchUpdates(_0x4051fd){return function(_0x14a63b){try{jsonpatch[_0xbbe4('0x1f')](_0x14a63b,_0x4051fd,!![]);}catch(_0xa449c){return BPromise[_0xbbe4('0x20')](_0xa449c);}return _0x14a63b[_0xbbe4('0x21')]();};}function saveUpdates(_0x10ced2,_0xa95139){return function(_0x391564){if(_0x391564){return _0x391564[_0xbbe4('0x22')](_0x10ced2)[_0xbbe4('0x23')](function(_0xe44dbf){return _0xe44dbf;});}return null;};}function removeEntity(_0x10ed03,_0x59279d){return function(_0x5337c1){if(_0x5337c1){return _0x5337c1['destroy']()[_0xbbe4('0x23')](function(){_0x10ed03[_0xbbe4('0x18')](0xcc)[_0xbbe4('0x19')]();});}};}function handleEntityNotFound(_0x84ce43,_0x1668af){return function(_0x4bc29b){if(!_0x4bc29b){_0x84ce43[_0xbbe4('0x17')](0x194);}return _0x4bc29b;};}function handleError(_0x53f7c4,_0x31c18f){_0x31c18f=_0x31c18f||0x1f4;return function(_0x12f020){logger[_0xbbe4('0x24')](_0x12f020['stack']);if(_0x12f020['name']){delete _0x12f020['name'];}_0x53f7c4[_0xbbe4('0x18')](_0x31c18f)['send'](_0x12f020);};}exports[_0xbbe4('0x25')]=function(_0x11b2a2,_0x5d1196){var _0x12b855={},_0x26d0cc={},_0x1f95fd={'count':0x0,'rows':[]};var _0x1a0a24=_[_0xbbe4('0x26')](db[_0xbbe4('0x27')][_0xbbe4('0x28')],function(_0x125582){return{'name':_0x125582['fieldName'],'type':_0x125582[_0xbbe4('0x29')][_0xbbe4('0x2a')]};});_0x26d0cc[_0xbbe4('0x2b')]=_[_0xbbe4('0x26')](_0x1a0a24,_0xbbe4('0x2c'));_0x26d0cc[_0xbbe4('0x2d')]=_[_0xbbe4('0x2e')](_0x11b2a2[_0xbbe4('0x2d')]);_0x26d0cc[_0xbbe4('0x2f')]=_[_0xbbe4('0x30')](_0x26d0cc[_0xbbe4('0x2b')],_0x26d0cc[_0xbbe4('0x2d')]);_0x12b855['attributes']=_[_0xbbe4('0x30')](_0x26d0cc[_0xbbe4('0x2b')],qs[_0xbbe4('0x31')](_0x11b2a2[_0xbbe4('0x2d')]['fields']));_0x12b855[_0xbbe4('0x32')]=_0x12b855[_0xbbe4('0x32')]['length']?_0x12b855[_0xbbe4('0x32')]:_0x26d0cc['model'];if(!_0x11b2a2[_0xbbe4('0x2d')][_0xbbe4('0x33')](_0xbbe4('0x34'))){_0x12b855['limit']=qs[_0xbbe4('0x1c')](_0x11b2a2[_0xbbe4('0x2d')][_0xbbe4('0x1c')]);_0x12b855['offset']=qs[_0xbbe4('0x1b')](_0x11b2a2[_0xbbe4('0x2d')][_0xbbe4('0x1b')]);}_0x12b855[_0xbbe4('0x35')]=qs['sort'](_0x11b2a2[_0xbbe4('0x2d')][_0xbbe4('0x36')]);_0x12b855[_0xbbe4('0x37')]=qs[_0xbbe4('0x2f')](_[_0xbbe4('0x38')](_0x11b2a2[_0xbbe4('0x2d')],_0x26d0cc[_0xbbe4('0x2f')]),_0x1a0a24);if(_0x11b2a2[_0xbbe4('0x2d')][_0xbbe4('0x39')]){_0x12b855['where']=_[_0xbbe4('0x3a')](_0x12b855[_0xbbe4('0x37')],{'$or':_[_0xbbe4('0x26')](_0x1a0a24,function(_0x165942){if(_0x165942[_0xbbe4('0x29')]!==_0xbbe4('0x3b')){var _0x35a081={};_0x35a081[_0x165942[_0xbbe4('0x2c')]]={'$like':'%'+_0x11b2a2[_0xbbe4('0x2d')]['filter']+'%'};return _0x35a081;}})});}_0x12b855=_[_0xbbe4('0x3a')]({},_0x12b855,_0x11b2a2[_0xbbe4('0x3c')]);var _0x503e85={'where':_0x12b855['where']};return db[_0xbbe4('0x27')]['count'](_0x503e85)[_0xbbe4('0x23')](function(_0x1983f8){_0x1f95fd[_0xbbe4('0x1a')]=_0x1983f8;if(_0x11b2a2[_0xbbe4('0x2d')][_0xbbe4('0x3d')]){_0x12b855[_0xbbe4('0x3e')]=[{'all':!![]}];}return db[_0xbbe4('0x27')][_0xbbe4('0x3f')](_0x12b855);})[_0xbbe4('0x23')](function(_0x748e8a){_0x1f95fd['rows']=_0x748e8a;return _0x1f95fd;})['then'](respondWithFilteredResult(_0x5d1196,_0x12b855))[_0xbbe4('0x40')](handleError(_0x5d1196,null));};exports[_0xbbe4('0x41')]=function(_0x22b7a8,_0x1cdf46){var _0x575faf={'raw':!![],'where':{'id':_0x22b7a8[_0xbbe4('0x42')]['id']}},_0x2cd3ab={};_0x2cd3ab[_0xbbe4('0x2b')]=_[_0xbbe4('0x2e')](db[_0xbbe4('0x27')][_0xbbe4('0x28')]);_0x2cd3ab['query']=_[_0xbbe4('0x2e')](_0x22b7a8['query']);_0x2cd3ab[_0xbbe4('0x2f')]=_[_0xbbe4('0x30')](_0x2cd3ab[_0xbbe4('0x2b')],_0x2cd3ab[_0xbbe4('0x2d')]);_0x575faf[_0xbbe4('0x32')]=_[_0xbbe4('0x30')](_0x2cd3ab[_0xbbe4('0x2b')],qs[_0xbbe4('0x31')](_0x22b7a8[_0xbbe4('0x2d')][_0xbbe4('0x31')]));_0x575faf[_0xbbe4('0x32')]=_0x575faf[_0xbbe4('0x32')]['length']?_0x575faf[_0xbbe4('0x32')]:_0x2cd3ab['model'];if(_0x22b7a8['query'][_0xbbe4('0x3d')]){_0x575faf['include']=[{'all':!![]}];}_0x575faf=_[_0xbbe4('0x3a')]({},_0x575faf,_0x22b7a8[_0xbbe4('0x3c')]);return db[_0xbbe4('0x27')][_0xbbe4('0x43')](_0x575faf)['then'](handleEntityNotFound(_0x1cdf46,null))['then'](respondWithResult(_0x1cdf46,null))[_0xbbe4('0x40')](handleError(_0x1cdf46,null));};exports[_0xbbe4('0x44')]=function(_0x5ec89d,_0x45fc9a){return db[_0xbbe4('0x27')][_0xbbe4('0x44')](_0x5ec89d[_0xbbe4('0x45')],{})[_0xbbe4('0x23')](respondWithResult(_0x45fc9a,0xc9))['catch'](handleError(_0x45fc9a,null));};exports[_0xbbe4('0x22')]=function(_0x3bf39f,_0xff982e){if(_0x3bf39f['body']['id']){delete _0x3bf39f[_0xbbe4('0x45')]['id'];}return db[_0xbbe4('0x27')][_0xbbe4('0x43')]({'where':{'id':_0x3bf39f[_0xbbe4('0x42')]['id']}})[_0xbbe4('0x23')](handleEntityNotFound(_0xff982e,null))[_0xbbe4('0x23')](saveUpdates(_0x3bf39f['body'],null))[_0xbbe4('0x23')](respondWithResult(_0xff982e,null))[_0xbbe4('0x40')](handleError(_0xff982e,null));};exports[_0xbbe4('0x46')]=function(_0x2b4bc7,_0x1af3e3){return db[_0xbbe4('0x27')][_0xbbe4('0x43')]({'where':{'id':_0x2b4bc7[_0xbbe4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1af3e3,null))['then'](removeEntity(_0x1af3e3,null))['catch'](handleError(_0x1af3e3,null));}; \ No newline at end of file +var _0x4c3e=['reject','save','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','update','html-pdf','rimraf','zip-dir','bluebird','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x4ab7c1,_0xac9be){var _0x1e701b=function(_0x163100){while(--_0x163100){_0x4ab7c1['push'](_0x4ab7c1['shift']());}};_0x1e701b(++_0xac9be);}(_0x4c3e,0x1b9));var _0xe4c3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4c3e[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0xe4c3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4c3('0x1'));var zipdir=require(_0xe4c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe4c3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe4c3('0x4'));var sox=require(_0xe4c3('0x5'));var csv=require(_0xe4c3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe4c3('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4c3('0x8'));var deskjs=require(_0xe4c3('0x9'));var toCsv=require(_0xe4c3('0x6'));var querystring=require(_0xe4c3('0xa'));var Papa=require(_0xe4c3('0xb'));var Redis=require(_0xe4c3('0xc'));var authService=require(_0xe4c3('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe4c3('0xe'));var hardwareService=require(_0xe4c3('0xf'));var logger=require(_0xe4c3('0x10'))('api');var utils=require(_0xe4c3('0x11'));var config=require(_0xe4c3('0x12'));var db=require(_0xe4c3('0x13'))['db'];function respondWithStatusCode(_0x146b34,_0x47baa9){_0x47baa9=_0x47baa9||0xcc;return function(_0xf77616){if(_0xf77616){return _0x146b34[_0xe4c3('0x14')](_0x47baa9);}return _0x146b34[_0xe4c3('0x15')](_0x47baa9)[_0xe4c3('0x16')]();};}function respondWithResult(_0x32b072,_0x568c8b){_0x568c8b=_0x568c8b||0xc8;return function(_0x551a0e){if(_0x551a0e){return _0x32b072[_0xe4c3('0x15')](_0x568c8b)[_0xe4c3('0x17')](_0x551a0e);}};}function respondWithFilteredResult(_0x37dc6a,_0x218961){return function(_0x5116a7){if(_0x5116a7){var _0x5485f4=_0x5116a7[_0xe4c3('0x18')],_0x1a9e15=_0x218961['offset'],_0xe11bf8=_0x218961[_0xe4c3('0x19')]+_0x218961[_0xe4c3('0x1a')],_0xa2fc79;if(_0xe11bf8>=_0x5485f4){_0xe11bf8=_0x5485f4;_0xa2fc79=0xc8;}else{_0xa2fc79=0xce;}_0x37dc6a[_0xe4c3('0x15')](_0xa2fc79);return _0x37dc6a['set'](_0xe4c3('0x1b'),_0x1a9e15+'-'+_0xe11bf8+'/'+_0x5485f4)[_0xe4c3('0x17')](_0x5116a7);}return null;};}function patchUpdates(_0x50e7c6){return function(_0x5877e3){try{jsonpatch['apply'](_0x5877e3,_0x50e7c6,!![]);}catch(_0xd6d9e1){return BPromise[_0xe4c3('0x1c')](_0xd6d9e1);}return _0x5877e3[_0xe4c3('0x1d')]();};}function saveUpdates(_0x300bf9,_0x149da8){return function(_0x957486){if(_0x957486){return _0x957486['update'](_0x300bf9)[_0xe4c3('0x1e')](function(_0x8c36ba){return _0x8c36ba;});}return null;};}function removeEntity(_0x43438a,_0x3f3905){return function(_0x27a757){if(_0x27a757){return _0x27a757['destroy']()[_0xe4c3('0x1e')](function(){_0x43438a[_0xe4c3('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560586,_0x24b6a1){return function(_0x32491e){if(!_0x32491e){_0x560586['sendStatus'](0x194);}return _0x32491e;};}function handleError(_0x5a4a2f,_0x192f8c){_0x192f8c=_0x192f8c||0x1f4;return function(_0xa1bc55){logger[_0xe4c3('0x1f')](_0xa1bc55['stack']);if(_0xa1bc55[_0xe4c3('0x20')]){delete _0xa1bc55[_0xe4c3('0x20')];}_0x5a4a2f[_0xe4c3('0x15')](_0x192f8c)[_0xe4c3('0x21')](_0xa1bc55);};}exports[_0xe4c3('0x22')]=function(_0x204015,_0x49b555){var _0x30b091={},_0x3760a1={},_0x281928={'count':0x0,'rows':[]};var _0x54ee6f=_[_0xe4c3('0x23')](db[_0xe4c3('0x24')][_0xe4c3('0x25')],function(_0x320f01){return{'name':_0x320f01[_0xe4c3('0x26')],'type':_0x320f01[_0xe4c3('0x27')][_0xe4c3('0x28')]};});_0x3760a1[_0xe4c3('0x29')]=_[_0xe4c3('0x23')](_0x54ee6f,_0xe4c3('0x20'));_0x3760a1[_0xe4c3('0x2a')]=_['keys'](_0x204015[_0xe4c3('0x2a')]);_0x3760a1[_0xe4c3('0x2b')]=_[_0xe4c3('0x2c')](_0x3760a1[_0xe4c3('0x29')],_0x3760a1['query']);_0x30b091['attributes']=_[_0xe4c3('0x2c')](_0x3760a1[_0xe4c3('0x29')],qs[_0xe4c3('0x2d')](_0x204015[_0xe4c3('0x2a')][_0xe4c3('0x2d')]));_0x30b091['attributes']=_0x30b091['attributes']['length']?_0x30b091[_0xe4c3('0x2e')]:_0x3760a1[_0xe4c3('0x29')];if(!_0x204015['query'][_0xe4c3('0x2f')]('nolimit')){_0x30b091['limit']=qs[_0xe4c3('0x1a')](_0x204015[_0xe4c3('0x2a')]['limit']);_0x30b091[_0xe4c3('0x19')]=qs[_0xe4c3('0x19')](_0x204015[_0xe4c3('0x2a')][_0xe4c3('0x19')]);}_0x30b091['order']=qs['sort'](_0x204015[_0xe4c3('0x2a')][_0xe4c3('0x30')]);_0x30b091[_0xe4c3('0x31')]=qs[_0xe4c3('0x2b')](_[_0xe4c3('0x32')](_0x204015[_0xe4c3('0x2a')],_0x3760a1['filters']),_0x54ee6f);if(_0x204015['query'][_0xe4c3('0x33')]){_0x30b091['where']=_['merge'](_0x30b091[_0xe4c3('0x31')],{'$or':_[_0xe4c3('0x23')](_0x54ee6f,function(_0x46dee1){if(_0x46dee1['type']!==_0xe4c3('0x34')){var _0x3f38ce={};_0x3f38ce[_0x46dee1[_0xe4c3('0x20')]]={'$like':'%'+_0x204015['query'][_0xe4c3('0x33')]+'%'};return _0x3f38ce;}})});}_0x30b091=_[_0xe4c3('0x35')]({},_0x30b091,_0x204015[_0xe4c3('0x36')]);var _0xbcbd6c={'where':_0x30b091[_0xe4c3('0x31')]};return db[_0xe4c3('0x24')][_0xe4c3('0x18')](_0xbcbd6c)['then'](function(_0x201686){_0x281928['count']=_0x201686;if(_0x204015[_0xe4c3('0x2a')][_0xe4c3('0x37')]){_0x30b091['include']=[{'all':!![]}];}return db[_0xe4c3('0x24')][_0xe4c3('0x38')](_0x30b091);})[_0xe4c3('0x1e')](function(_0x20feaa){_0x281928[_0xe4c3('0x39')]=_0x20feaa;return _0x281928;})[_0xe4c3('0x1e')](respondWithFilteredResult(_0x49b555,_0x30b091))[_0xe4c3('0x3a')](handleError(_0x49b555,null));};exports[_0xe4c3('0x3b')]=function(_0x529cd6,_0x57be75){var _0x36b6b3={'raw':!![],'where':{'id':_0x529cd6[_0xe4c3('0x3c')]['id']}},_0x501162={};_0x501162[_0xe4c3('0x29')]=_[_0xe4c3('0x3d')](db[_0xe4c3('0x24')][_0xe4c3('0x25')]);_0x501162[_0xe4c3('0x2a')]=_['keys'](_0x529cd6[_0xe4c3('0x2a')]);_0x501162['filters']=_[_0xe4c3('0x2c')](_0x501162[_0xe4c3('0x29')],_0x501162[_0xe4c3('0x2a')]);_0x36b6b3[_0xe4c3('0x2e')]=_[_0xe4c3('0x2c')](_0x501162['model'],qs[_0xe4c3('0x2d')](_0x529cd6[_0xe4c3('0x2a')][_0xe4c3('0x2d')]));_0x36b6b3[_0xe4c3('0x2e')]=_0x36b6b3[_0xe4c3('0x2e')][_0xe4c3('0x3e')]?_0x36b6b3[_0xe4c3('0x2e')]:_0x501162[_0xe4c3('0x29')];if(_0x529cd6['query'][_0xe4c3('0x37')]){_0x36b6b3['include']=[{'all':!![]}];}_0x36b6b3=_[_0xe4c3('0x35')]({},_0x36b6b3,_0x529cd6[_0xe4c3('0x36')]);return db['CloudProvider'][_0xe4c3('0x3f')](_0x36b6b3)[_0xe4c3('0x1e')](handleEntityNotFound(_0x57be75,null))[_0xe4c3('0x1e')](respondWithResult(_0x57be75,null))[_0xe4c3('0x3a')](handleError(_0x57be75,null));};exports['create']=function(_0x187973,_0x517f41){return db['CloudProvider'][_0xe4c3('0x40')](_0x187973[_0xe4c3('0x41')],{})[_0xe4c3('0x1e')](respondWithResult(_0x517f41,0xc9))['catch'](handleError(_0x517f41,null));};exports[_0xe4c3('0x42')]=function(_0x14b0ca,_0x415f54){if(_0x14b0ca['body']['id']){delete _0x14b0ca['body']['id'];}return db[_0xe4c3('0x24')][_0xe4c3('0x3f')]({'where':{'id':_0x14b0ca[_0xe4c3('0x3c')]['id']}})[_0xe4c3('0x1e')](handleEntityNotFound(_0x415f54,null))['then'](saveUpdates(_0x14b0ca[_0xe4c3('0x41')],null))[_0xe4c3('0x1e')](respondWithResult(_0x415f54,null))[_0xe4c3('0x3a')](handleError(_0x415f54,null));};exports['destroy']=function(_0xff9dcd,_0x546c0f){return db[_0xe4c3('0x24')]['find']({'where':{'id':_0xff9dcd[_0xe4c3('0x3c')]['id']}})[_0xe4c3('0x1e')](handleEntityNotFound(_0x546c0f,null))[_0xe4c3('0x1e')](removeEntity(_0x546c0f,null))[_0xe4c3('0x3a')](handleError(_0x546c0f,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 349fac3..c859497 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 _0x6af2=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','CloudProvider','cloud_providers','lodash'];(function(_0x30cb3f,_0x859105){var _0x527cc1=function(_0x406d06){while(--_0x406d06){_0x30cb3f['push'](_0x30cb3f['shift']());}};_0x527cc1(++_0x859105);}(_0x6af2,0x1e3));var _0x26af=function(_0x4c7c8a,_0x2f0e86){_0x4c7c8a=_0x4c7c8a-0x0;var _0x2d7e02=_0x6af2[_0x4c7c8a];return _0x2d7e02;};'use strict';var _=require(_0x26af('0x0'));var util=require(_0x26af('0x1'));var logger=require(_0x26af('0x2'))('api');var moment=require(_0x26af('0x3'));var BPromise=require(_0x26af('0x4'));var rp=require(_0x26af('0x5'));var fs=require('fs');var path=require(_0x26af('0x6'));var rimraf=require(_0x26af('0x7'));var config=require('../../config/environment');var attributes=require(_0x26af('0x8'));module['exports']=function(_0x5790a5,_0x1d5e2a){return _0x5790a5['define'](_0x26af('0x9'),attributes,{'tableName':_0x26af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e31=['rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0xa8a57e,_0x27295c){var _0x53244c=function(_0x1b333d){while(--_0x1b333d){_0xa8a57e['push'](_0xa8a57e['shift']());}};_0x53244c(++_0x27295c);}(_0x7e31,0x16e));var _0x17e3=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x7e31[_0x4c4037];return _0x357862;};'use strict';var _=require(_0x17e3('0x0'));var util=require('util');var logger=require(_0x17e3('0x1'))(_0x17e3('0x2'));var moment=require(_0x17e3('0x3'));var BPromise=require(_0x17e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17e3('0x5'));var rimraf=require(_0x17e3('0x6'));var config=require(_0x17e3('0x7'));var attributes=require(_0x17e3('0x8'));module['exports']=function(_0xb295ed,_0xfcc792){return _0xb295ed[_0x17e3('0x9')](_0x17e3('0xa'),attributes,{'tableName':_0x17e3('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 b610363..7d30e11 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 _0x3c63=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x1ecc07,_0x1f854d){var _0x15c782=function(_0x4ff780){while(--_0x4ff780){_0x1ecc07['push'](_0x1ecc07['shift']());}};_0x15c782(++_0x1f854d);}(_0x3c63,0x9c));var _0x33c6=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0x3c63[_0x291ec3];return _0x423b99;};'use strict';var _=require(_0x33c6('0x0'));var util=require(_0x33c6('0x1'));var moment=require(_0x33c6('0x2'));var BPromise=require(_0x33c6('0x3'));var rs=require(_0x33c6('0x4'));var fs=require('fs');var Redis=require(_0x33c6('0x5'));var db=require(_0x33c6('0x6'))['db'];var utils=require(_0x33c6('0x7'));var logger=require('../../config/logger')(_0x33c6('0x8'));var config=require(_0x33c6('0x9'));var jayson=require(_0x33c6('0xa'));var client=jayson[_0x33c6('0xb')][_0x33c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c0a17,_0x1e17ec,_0xa2153c){return new BPromise(function(_0x590b40,_0xe50d0){return client[_0x33c6('0xd')](_0x4c0a17,_0xa2153c)['then'](function(_0x4a4082){logger[_0x33c6('0xe')](_0x33c6('0xf'),_0x1e17ec,_0x33c6('0x10'));logger[_0x33c6('0x11')](_0x33c6('0x12'),_0x1e17ec,_0x33c6('0x10'),JSON[_0x33c6('0x13')](_0x4a4082));if(_0x4a4082[_0x33c6('0x14')]){if(_0x4a4082[_0x33c6('0x14')][_0x33c6('0x15')]===0x1f4){logger[_0x33c6('0x14')](_0x33c6('0xf'),_0x1e17ec,_0x4a4082[_0x33c6('0x14')][_0x33c6('0x16')]);return _0xe50d0(_0x4a4082[_0x33c6('0x14')][_0x33c6('0x16')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x1e17ec,_0x4a4082[_0x33c6('0x14')][_0x33c6('0x16')]);return _0x590b40(_0x4a4082[_0x33c6('0x14')]['message']);}else{logger[_0x33c6('0xe')](_0x33c6('0xf'),_0x1e17ec,_0x33c6('0x10'));_0x590b40(_0x4a4082[_0x33c6('0x17')]['message']);}})[_0x33c6('0x18')](function(_0x590848){logger['error'](_0x33c6('0xf'),_0x1e17ec,_0x590848);_0xe50d0(_0x590848);});});} \ No newline at end of file +var _0xcbdf=['then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xcbdf,0xd2));var _0xfcbd=function(_0x42e7af,_0xfca406){_0x42e7af=_0x42e7af-0x0;var _0x57abbe=_0xcbdf[_0x42e7af];return _0x57abbe;};'use strict';var _=require(_0xfcbd('0x0'));var util=require(_0xfcbd('0x1'));var moment=require(_0xfcbd('0x2'));var BPromise=require(_0xfcbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcbd('0x5'));var logger=require(_0xfcbd('0x6'))(_0xfcbd('0x7'));var config=require(_0xfcbd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfcbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37f982,_0x410ab8,_0xaece8c){return new BPromise(function(_0x55757e,_0xc80c5){return client['request'](_0x37f982,_0xaece8c)[_0xfcbd('0xa')](function(_0xc22dea){logger[_0xfcbd('0xb')]('CloudProvider,\x20%s,\x20%s',_0x410ab8,_0xfcbd('0xc'));logger[_0xfcbd('0xd')](_0xfcbd('0xe'),_0x410ab8,_0xfcbd('0xc'),JSON['stringify'](_0xc22dea));if(_0xc22dea[_0xfcbd('0xf')]){if(_0xc22dea[_0xfcbd('0xf')]['code']===0x1f4){logger['error'](_0xfcbd('0x10'),_0x410ab8,_0xc22dea['error']['message']);return _0xc80c5(_0xc22dea[_0xfcbd('0xf')]['message']);}logger['error'](_0xfcbd('0x10'),_0x410ab8,_0xc22dea[_0xfcbd('0xf')][_0xfcbd('0x11')]);return _0x55757e(_0xc22dea[_0xfcbd('0xf')][_0xfcbd('0x11')]);}else{logger['info'](_0xfcbd('0x10'),_0x410ab8,_0xfcbd('0xc'));_0x55757e(_0xc22dea[_0xfcbd('0x12')][_0xfcbd('0x11')]);}})[_0xfcbd('0x13')](function(_0x493454){logger[_0xfcbd('0xf')](_0xfcbd('0x10'),_0x410ab8,_0x493454);_0xc80c5(_0x493454);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2f40b8f..cc4f3ed 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 _0x33bb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0xe797b6,_0x396c78){var _0x437632=function(_0x47c4c0){while(--_0x47c4c0){_0xe797b6['push'](_0xe797b6['shift']());}};_0x437632(++_0x396c78);}(_0x33bb,0xc5));var _0xb33b=function(_0x11bd5b,_0x1318b1){_0x11bd5b=_0x11bd5b-0x0;var _0x16aea2=_0x33bb[_0x11bd5b];return _0x16aea2;};'use strict';var multer=require(_0xb33b('0x0'));var util=require(_0xb33b('0x1'));var path=require(_0xb33b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb33b('0x3'));var router=express[_0xb33b('0x4')]();var auth=require(_0xb33b('0x5'));var interaction=require(_0xb33b('0x6'));var config=require(_0xb33b('0x7'));var controller=require(_0xb33b('0x8'));router[_0xb33b('0x9')]('/',auth[_0xb33b('0xa')](),controller[_0xb33b('0xb')]);router[_0xb33b('0x9')](_0xb33b('0xc'),auth[_0xb33b('0xa')](),controller[_0xb33b('0xd')]);router[_0xb33b('0xe')]('/',auth[_0xb33b('0xa')](),controller[_0xb33b('0xf')]);router[_0xb33b('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb33b('0x11')](_0xb33b('0xc'),auth[_0xb33b('0xa')](),controller[_0xb33b('0x12')]);module[_0xb33b('0x13')]=router; \ No newline at end of file +var _0x3de9=['../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3de9,0x79));var _0x93de=function(_0x3dcf6a,_0x3d0984){_0x3dcf6a=_0x3dcf6a-0x0;var _0x1be2f8=_0x3de9[_0x3dcf6a];return _0x1be2f8;};'use strict';var multer=require(_0x93de('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x93de('0x1'));var express=require(_0x93de('0x2'));var router=express['Router']();var auth=require(_0x93de('0x3'));var interaction=require(_0x93de('0x4'));var config=require(_0x93de('0x5'));var controller=require(_0x93de('0x6'));router[_0x93de('0x7')]('/',auth[_0x93de('0x8')](),controller[_0x93de('0x9')]);router[_0x93de('0x7')](_0x93de('0xa'),auth['isAuthenticated'](),controller[_0x93de('0xb')]);router[_0x93de('0xc')]('/',auth[_0x93de('0x8')](),controller[_0x93de('0xd')]);router['put'](_0x93de('0xa'),auth[_0x93de('0x8')](),controller[_0x93de('0xe')]);router[_0x93de('0xf')]('/:id',auth[_0x93de('0x8')](),controller[_0x93de('0x10')]);module[_0x93de('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ef9ed8f..f82c5ba 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 _0x2f5b=['exports','STRING','name'];(function(_0x7d62f5,_0x35c11a){var _0x397099=function(_0x5688fd){while(--_0x5688fd){_0x7d62f5['push'](_0x7d62f5['shift']());}};_0x397099(++_0x35c11a);}(_0x2f5b,0x1aa));var _0xb2f5=function(_0x43a0e9,_0x22e412){_0x43a0e9=_0x43a0e9-0x0;var _0x1a5afc=_0x2f5b[_0x43a0e9];return _0x1a5afc;};'use strict';var Sequelize=require('sequelize');module[_0xb2f5('0x0')]={'name':{'type':Sequelize[_0xb2f5('0x1')],'unique':_0xb2f5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb2f5('0x1')]},'companyId':{'type':Sequelize[_0xb2f5('0x1')]},'website':{'type':Sequelize[_0xb2f5('0x1')]},'phone':{'type':Sequelize[_0xb2f5('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xb2f5('0x1')]},'postalCode':{'type':Sequelize[_0xb2f5('0x1')]},'city':{'type':Sequelize[_0xb2f5('0x1')]},'country':{'type':Sequelize[_0xb2f5('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb2f5('0x1')]},'sStreet':{'type':Sequelize[_0xb2f5('0x1')]},'sPostalCode':{'type':Sequelize[_0xb2f5('0x1')]},'sCity':{'type':Sequelize[_0xb2f5('0x1')]},'sCountry':{'type':Sequelize[_0xb2f5('0x1')]},'description':{'type':Sequelize[_0xb2f5('0x1')]}}; \ No newline at end of file +var _0x374b=['exports','name','STRING','sequelize'];(function(_0x31c7a6,_0x472921){var _0x546ad0=function(_0x1ba8e2){while(--_0x1ba8e2){_0x31c7a6['push'](_0x31c7a6['shift']());}};_0x546ad0(++_0x472921);}(_0x374b,0x127));var _0xb374=function(_0x158a69,_0x454af1){_0x158a69=_0x158a69-0x0;var _0x1190a1=_0x374b[_0x158a69];return _0x1190a1;};'use strict';var Sequelize=require(_0xb374('0x0'));module[_0xb374('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb374('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb374('0x3')]},'companyId':{'type':Sequelize[_0xb374('0x3')]},'website':{'type':Sequelize[_0xb374('0x3')]},'phone':{'type':Sequelize[_0xb374('0x3')]},'fax':{'type':Sequelize[_0xb374('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb374('0x3')]},'city':{'type':Sequelize[_0xb374('0x3')]},'country':{'type':Sequelize[_0xb374('0x3')]},'email':{'type':Sequelize[_0xb374('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb374('0x3')]},'sStreet':{'type':Sequelize[_0xb374('0x3')]},'sPostalCode':{'type':Sequelize[_0xb374('0x3')]},'sCity':{'type':Sequelize[_0xb374('0x3')]},'sCountry':{'type':Sequelize[_0xb374('0x3')]},'description':{'type':Sequelize[_0xb374('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 206da7b..da1acbb 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 _0xbf37=['fast-json-patch','request-promise','bluebird','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','role','userProfileId','update','addContacts','ids','omit','getContacts','CmContact','nolimit','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x139147,_0x13f3c4){var _0x3146c7=function(_0x210c95){while(--_0x210c95){_0x139147['push'](_0x139147['shift']());}};_0x3146c7(++_0x13f3c4);}(_0xbf37,0x1d0));var _0x7bf3=function(_0x5a3d13,_0x1362c){_0x5a3d13=_0x5a3d13-0x0;var _0x4ed983=_0xbf37[_0x5a3d13];return _0x4ed983;};'use strict';var pdf=require(_0x7bf3('0x0'));var emlformat=require(_0x7bf3('0x1'));var rimraf=require(_0x7bf3('0x2'));var zipdir=require(_0x7bf3('0x3'));var jsonpatch=require(_0x7bf3('0x4'));var rp=require(_0x7bf3('0x5'));var moment=require('moment');var BPromise=require(_0x7bf3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7bf3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7bf3('0x8'));var crypto=require(_0x7bf3('0x9'));var jsforce=require(_0x7bf3('0xa'));var deskjs=require(_0x7bf3('0xb'));var toCsv=require(_0x7bf3('0x7'));var querystring=require('querystring');var Papa=require(_0x7bf3('0xc'));var Redis=require(_0x7bf3('0xd'));var authService=require(_0x7bf3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7bf3('0xf'));var hardwareService=require(_0x7bf3('0x10'));var logger=require(_0x7bf3('0x11'))('api');var utils=require(_0x7bf3('0x12'));var config=require(_0x7bf3('0x13'));var db=require(_0x7bf3('0x14'))['db'];function respondWithStatusCode(_0x1a59f0,_0x551aae){_0x551aae=_0x551aae||0xcc;return function(_0x5a44ef){if(_0x5a44ef){return _0x1a59f0[_0x7bf3('0x15')](_0x551aae);}return _0x1a59f0[_0x7bf3('0x16')](_0x551aae)['end']();};}function respondWithResult(_0x198f6a,_0x63062f){_0x63062f=_0x63062f||0xc8;return function(_0x77d7ae){if(_0x77d7ae){return _0x198f6a[_0x7bf3('0x16')](_0x63062f)[_0x7bf3('0x17')](_0x77d7ae);}};}function respondWithFilteredResult(_0x573cb6,_0x3c22d2){return function(_0x1d7c6f){if(_0x1d7c6f){var _0x741de6=_0x1d7c6f[_0x7bf3('0x18')],_0x26b7e0=_0x3c22d2[_0x7bf3('0x19')],_0x120941=_0x3c22d2[_0x7bf3('0x19')]+_0x3c22d2[_0x7bf3('0x1a')],_0x46e624;if(_0x120941>=_0x741de6){_0x120941=_0x741de6;_0x46e624=0xc8;}else{_0x46e624=0xce;}_0x573cb6[_0x7bf3('0x16')](_0x46e624);return _0x573cb6['set'](_0x7bf3('0x1b'),_0x26b7e0+'-'+_0x120941+'/'+_0x741de6)[_0x7bf3('0x17')](_0x1d7c6f);}return null;};}function patchUpdates(_0x20aed0){return function(_0x18c0c7){try{jsonpatch['apply'](_0x18c0c7,_0x20aed0,!![]);}catch(_0x2bd048){return BPromise[_0x7bf3('0x1c')](_0x2bd048);}return _0x18c0c7[_0x7bf3('0x1d')]();};}function saveUpdates(_0x475bca,_0x833e0f){return function(_0x1323b9){if(_0x1323b9){return _0x1323b9['update'](_0x475bca)['then'](function(_0x2e2929){return _0x2e2929;});}return null;};}function removeEntity(_0x51a971,_0x21ed7e){return function(_0x276d2b){if(_0x276d2b){return _0x276d2b[_0x7bf3('0x1e')]()[_0x7bf3('0x1f')](function(){var _0x5e6d7e=_0x276d2b[_0x7bf3('0x20')]({'plain':!![]});var _0x26875e=_0x7bf3('0x21');return db[_0x7bf3('0x22')]['destroy']({'where':{'type':_0x26875e,'resourceId':_0x5e6d7e['id']}})[_0x7bf3('0x1f')](function(){return _0x276d2b;});})[_0x7bf3('0x1f')](function(){_0x51a971[_0x7bf3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c6e0,_0x2bf7d5){return function(_0x4a15e9){if(!_0x4a15e9){_0x55c6e0[_0x7bf3('0x15')](0x194);}return _0x4a15e9;};}function handleError(_0x53ff7f,_0x6cdb9c){_0x6cdb9c=_0x6cdb9c||0x1f4;return function(_0x50ec49){logger[_0x7bf3('0x23')](_0x50ec49[_0x7bf3('0x24')]);if(_0x50ec49[_0x7bf3('0x25')]){delete _0x50ec49[_0x7bf3('0x25')];}_0x53ff7f['status'](_0x6cdb9c)[_0x7bf3('0x26')](_0x50ec49);};}exports['index']=function(_0x511b04,_0x2e155c){var _0x1a8d14={},_0x2aceb7={},_0x31e5c4={'count':0x0,'rows':[]};return db[_0x7bf3('0x27')][_0x7bf3('0x28')]()[_0x7bf3('0x1f')](function(_0x5a17ad){_0x2aceb7[_0x7bf3('0x29')]=_[_0x7bf3('0x2a')](_0x5a17ad);_0x2aceb7[_0x7bf3('0x2b')]=_['keys'](_0x511b04['query']);_0x2aceb7['filters']=_[_0x7bf3('0x2c')](_0x2aceb7[_0x7bf3('0x29')],_0x2aceb7[_0x7bf3('0x2b')]);_0x1a8d14[_0x7bf3('0x2d')]=_[_0x7bf3('0x2c')](_0x2aceb7[_0x7bf3('0x29')],qs['fields'](_0x511b04[_0x7bf3('0x2b')][_0x7bf3('0x2e')]));_0x1a8d14[_0x7bf3('0x2d')]=_0x1a8d14['attributes'][_0x7bf3('0x2f')]?_0x1a8d14['attributes']:_0x2aceb7[_0x7bf3('0x29')];if(!_0x511b04[_0x7bf3('0x2b')][_0x7bf3('0x30')]('nolimit')){_0x1a8d14[_0x7bf3('0x1a')]=qs[_0x7bf3('0x1a')](_0x511b04['query'][_0x7bf3('0x1a')]);_0x1a8d14[_0x7bf3('0x19')]=qs[_0x7bf3('0x19')](_0x511b04[_0x7bf3('0x2b')]['offset']);}_0x1a8d14[_0x7bf3('0x31')]=qs[_0x7bf3('0x32')](_0x511b04[_0x7bf3('0x2b')][_0x7bf3('0x32')]);_0x1a8d14[_0x7bf3('0x33')]=qs[_0x7bf3('0x34')](_[_0x7bf3('0x35')](_0x511b04[_0x7bf3('0x2b')],_0x2aceb7['filters']),_0x5a17ad);if(_0x511b04[_0x7bf3('0x2b')][_0x7bf3('0x36')]){_0x1a8d14['where']=_[_0x7bf3('0x37')](_0x1a8d14[_0x7bf3('0x33')],{'$or':_[_0x7bf3('0x38')](_0x1a8d14['attributes'],function(_0x156545){var _0x2d02ec={};_0x2d02ec[_0x156545]={'$like':'%'+_0x511b04[_0x7bf3('0x2b')][_0x7bf3('0x36')]+'%'};return _0x2d02ec;})});}_0x1a8d14=_['merge']({},_0x1a8d14,_0x511b04[_0x7bf3('0x39')]);var _0x2d5e36={'where':_0x1a8d14[_0x7bf3('0x33')]};return db[_0x7bf3('0x27')][_0x7bf3('0x18')](_0x2d5e36)[_0x7bf3('0x1f')](function(_0x448b45){_0x31e5c4['count']=_0x448b45;if(_0x511b04[_0x7bf3('0x2b')][_0x7bf3('0x3a')]){_0x1a8d14['include']=[{'all':!![]}];}return db[_0x7bf3('0x27')][_0x7bf3('0x3b')](_0x1a8d14);})[_0x7bf3('0x1f')](function(_0x3ee7ee){_0x31e5c4[_0x7bf3('0x3c')]=_0x3ee7ee;return _0x31e5c4;})[_0x7bf3('0x1f')](respondWithFilteredResult(_0x2e155c,_0x1a8d14))[_0x7bf3('0x3d')](handleError(_0x2e155c,null));})['catch'](handleError(_0x2e155c,null));};exports['show']=function(_0x39cd57,_0x3e9143){var _0x5e8251={'raw':![],'where':{'id':_0x39cd57[_0x7bf3('0x3e')]['id']}},_0x539919={};_0x539919[_0x7bf3('0x29')]=_['keys'](db[_0x7bf3('0x27')][_0x7bf3('0x3f')]);_0x539919[_0x7bf3('0x2b')]=_[_0x7bf3('0x2a')](_0x39cd57['query']);_0x539919[_0x7bf3('0x34')]=_[_0x7bf3('0x2c')](_0x539919[_0x7bf3('0x29')],_0x539919['query']);_0x5e8251[_0x7bf3('0x2d')]=_['intersection'](_0x539919[_0x7bf3('0x29')],qs[_0x7bf3('0x2e')](_0x39cd57['query'][_0x7bf3('0x2e')]));_0x5e8251[_0x7bf3('0x2d')]=_0x5e8251[_0x7bf3('0x2d')][_0x7bf3('0x2f')]?_0x5e8251[_0x7bf3('0x2d')]:_0x539919[_0x7bf3('0x29')];if(_0x39cd57['query'][_0x7bf3('0x3a')]){_0x5e8251[_0x7bf3('0x40')]=[{'all':!![]}];}_0x5e8251=_['merge']({},_0x5e8251,_0x39cd57['options']);return db['CmCompany'][_0x7bf3('0x41')](_0x5e8251)['then'](handleEntityNotFound(_0x3e9143,null))[_0x7bf3('0x1f')](respondWithResult(_0x3e9143,null))[_0x7bf3('0x3d')](handleError(_0x3e9143,null));};exports[_0x7bf3('0x42')]=function(_0x139fac,_0x33c440){return db[_0x7bf3('0x27')][_0x7bf3('0x42')](_0x139fac[_0x7bf3('0x43')],{})[_0x7bf3('0x1f')](function(_0xde819d){var _0x41fe16=_0x139fac[_0x7bf3('0x44')][_0x7bf3('0x20')]({'plain':!![]});if(!_0x41fe16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41fe16[_0x7bf3('0x45')]===_0x7bf3('0x44')){var _0x2ecfd0=_0xde819d[_0x7bf3('0x20')]({'plain':!![]});var _0x382b4b=_0x7bf3('0x21');return db['UserProfileSection'][_0x7bf3('0x41')]({'where':{'name':_0x382b4b,'userProfileId':_0x41fe16[_0x7bf3('0x46')]},'raw':!![]})['then'](function(_0x3461a5){if(_0x3461a5&&_0x3461a5['autoAssociation']===0x0){return db[_0x7bf3('0x22')][_0x7bf3('0x42')]({'name':_0x2ecfd0['name'],'resourceId':_0x2ecfd0['id'],'type':_0x3461a5[_0x7bf3('0x25')],'sectionId':_0x3461a5['id']},{})[_0x7bf3('0x1f')](function(){return _0xde819d;});}else{return _0xde819d;}})['catch'](function(_0x5af814){logger[_0x7bf3('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5af814);throw _0x5af814;});}return _0xde819d;})[_0x7bf3('0x1f')](respondWithResult(_0x33c440,0xc9))[_0x7bf3('0x3d')](handleError(_0x33c440,null));};exports[_0x7bf3('0x47')]=function(_0x587e1f,_0x4f0bc0){if(_0x587e1f['body']['id']){delete _0x587e1f[_0x7bf3('0x43')]['id'];}return db[_0x7bf3('0x27')]['find']({'where':{'id':_0x587e1f[_0x7bf3('0x3e')]['id']}})[_0x7bf3('0x1f')](handleEntityNotFound(_0x4f0bc0,null))['then'](saveUpdates(_0x587e1f[_0x7bf3('0x43')],null))['then'](respondWithResult(_0x4f0bc0,null))[_0x7bf3('0x3d')](handleError(_0x4f0bc0,null));};exports[_0x7bf3('0x1e')]=function(_0x18e237,_0x33724d){return db[_0x7bf3('0x27')][_0x7bf3('0x41')]({'where':{'id':_0x18e237[_0x7bf3('0x3e')]['id']}})['then'](handleEntityNotFound(_0x33724d,null))[_0x7bf3('0x1f')](removeEntity(_0x33724d,null))['catch'](handleError(_0x33724d,null));};exports[_0x7bf3('0x28')]=function(_0xec42d0,_0x4e063c){return db['CmCompany'][_0x7bf3('0x28')]()[_0x7bf3('0x1f')](respondWithResult(_0x4e063c,null))[_0x7bf3('0x3d')](handleError(_0x4e063c,null));};exports['addContacts']=function(_0x53ad8c,_0x58bb90,_0x58600f){return db['CmContact']['find']({'where':{'id':_0x53ad8c[_0x7bf3('0x3e')]['id']}})[_0x7bf3('0x1f')](handleEntityNotFound(_0x58bb90,null))['then'](function(_0x169dd5){if(_0x169dd5){return _0x169dd5[_0x7bf3('0x48')](_0x53ad8c[_0x7bf3('0x43')][_0x7bf3('0x49')],_[_0x7bf3('0x4a')](_0x53ad8c[_0x7bf3('0x43')],[_0x7bf3('0x49'),'id'])||{});}})[_0x7bf3('0x1f')](respondWithResult(_0x58bb90,null))[_0x7bf3('0x3d')](handleError(_0x58bb90,null));};exports[_0x7bf3('0x4b')]=function(_0x4c5110,_0x3b5f2c,_0x553364){var _0x5995e0={};var _0x4c8a47={};var _0x1a2833;var _0x5d80a5;return db[_0x7bf3('0x27')]['findOne']({'where':{'id':_0x4c5110[_0x7bf3('0x3e')]['id']}})[_0x7bf3('0x1f')](handleEntityNotFound(_0x3b5f2c,null))[_0x7bf3('0x1f')](function(_0x20828d){if(_0x20828d){_0x1a2833=_0x20828d;_0x4c8a47['model']=_[_0x7bf3('0x2a')](db[_0x7bf3('0x4c')][_0x7bf3('0x3f')]);_0x4c8a47[_0x7bf3('0x2b')]=_[_0x7bf3('0x2a')](_0x4c5110[_0x7bf3('0x2b')]);_0x4c8a47[_0x7bf3('0x34')]=_[_0x7bf3('0x2c')](_0x4c8a47[_0x7bf3('0x29')],_0x4c8a47[_0x7bf3('0x2b')]);_0x5995e0['attributes']=_[_0x7bf3('0x2c')](_0x4c8a47[_0x7bf3('0x29')],qs[_0x7bf3('0x2e')](_0x4c5110['query'][_0x7bf3('0x2e')]));_0x5995e0[_0x7bf3('0x2d')]=_0x5995e0[_0x7bf3('0x2d')][_0x7bf3('0x2f')]?_0x5995e0[_0x7bf3('0x2d')]:_0x4c8a47[_0x7bf3('0x29')];_0x5995e0['order']=qs[_0x7bf3('0x32')](_0x4c5110[_0x7bf3('0x2b')][_0x7bf3('0x32')]);_0x5995e0[_0x7bf3('0x33')]=qs[_0x7bf3('0x34')](_[_0x7bf3('0x35')](_0x4c5110[_0x7bf3('0x2b')],_0x4c8a47[_0x7bf3('0x34')]));if(_0x4c5110['query'][_0x7bf3('0x36')]){_0x5995e0['where']=_['merge'](_0x5995e0[_0x7bf3('0x33')],{'$or':_['map'](_0x5995e0['attributes'],function(_0x10acf2){var _0x5206cb={};_0x5206cb[_0x10acf2]={'$like':'%'+_0x4c5110[_0x7bf3('0x2b')][_0x7bf3('0x36')]+'%'};return _0x5206cb;})});}_0x5995e0=_['merge']({},_0x5995e0,_0x4c5110[_0x7bf3('0x39')]);return _0x1a2833['getContacts'](_0x5995e0);}})[_0x7bf3('0x1f')](function(_0x2d1548){if(_0x2d1548){_0x5d80a5=_0x2d1548[_0x7bf3('0x2f')];if(!_0x4c5110[_0x7bf3('0x2b')][_0x7bf3('0x30')](_0x7bf3('0x4d'))){_0x5995e0[_0x7bf3('0x1a')]=qs[_0x7bf3('0x1a')](_0x4c5110[_0x7bf3('0x2b')]['limit']);_0x5995e0[_0x7bf3('0x19')]=qs[_0x7bf3('0x19')](_0x4c5110[_0x7bf3('0x2b')][_0x7bf3('0x19')]);}return _0x1a2833[_0x7bf3('0x4b')](_0x5995e0);}})[_0x7bf3('0x1f')](function(_0x3c0fcb){if(_0x3c0fcb){return _0x3c0fcb?{'count':_0x5d80a5,'rows':_0x3c0fcb}:null;}})[_0x7bf3('0x1f')](respondWithResult(_0x3b5f2c,null))[_0x7bf3('0x3d')](handleError(_0x3b5f2c,null));}; \ No newline at end of file +var _0xe0d3=['reject','save','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','index','CmCompany','describe','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','omit','ids','getContacts','findOne','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply'];(function(_0x39828f,_0x89ff4d){var _0x1b4029=function(_0x1b7d38){while(--_0x1b7d38){_0x39828f['push'](_0x39828f['shift']());}};_0x1b4029(++_0x89ff4d);}(_0xe0d3,0x13a));var _0x3e0d=function(_0x491ca4,_0x2b9fe6){_0x491ca4=_0x491ca4-0x0;var _0x9b4c90=_0xe0d3[_0x491ca4];return _0x9b4c90;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3e0d('0x0'));var zipdir=require(_0x3e0d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e0d('0x2'));var moment=require(_0x3e0d('0x3'));var BPromise=require(_0x3e0d('0x4'));var Mustache=require(_0x3e0d('0x5'));var util=require(_0x3e0d('0x6'));var path=require(_0x3e0d('0x7'));var sox=require(_0x3e0d('0x8'));var csv=require(_0x3e0d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e0d('0xa'));var squel=require(_0x3e0d('0xb'));var crypto=require(_0x3e0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3e0d('0x9'));var querystring=require(_0x3e0d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e0d('0xe'));var qs=require(_0x3e0d('0xf'));var as=require(_0x3e0d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3e0d('0x11'));var utils=require(_0x3e0d('0x12'));var config=require(_0x3e0d('0x13'));var db=require(_0x3e0d('0x14'))['db'];function respondWithStatusCode(_0x303bca,_0x7b347a){_0x7b347a=_0x7b347a||0xcc;return function(_0x20cb8e){if(_0x20cb8e){return _0x303bca[_0x3e0d('0x15')](_0x7b347a);}return _0x303bca[_0x3e0d('0x16')](_0x7b347a)['end']();};}function respondWithResult(_0x4f7df4,_0x463ec5){_0x463ec5=_0x463ec5||0xc8;return function(_0x3975ff){if(_0x3975ff){return _0x4f7df4[_0x3e0d('0x16')](_0x463ec5)['json'](_0x3975ff);}};}function respondWithFilteredResult(_0x4dcf61,_0x254c6e){return function(_0x3c304c){if(_0x3c304c){var _0x4a45ac=_0x3c304c[_0x3e0d('0x17')],_0x554fff=_0x254c6e['offset'],_0x13db47=_0x254c6e[_0x3e0d('0x18')]+_0x254c6e[_0x3e0d('0x19')],_0x13a0bc;if(_0x13db47>=_0x4a45ac){_0x13db47=_0x4a45ac;_0x13a0bc=0xc8;}else{_0x13a0bc=0xce;}_0x4dcf61[_0x3e0d('0x16')](_0x13a0bc);return _0x4dcf61[_0x3e0d('0x1a')](_0x3e0d('0x1b'),_0x554fff+'-'+_0x13db47+'/'+_0x4a45ac)[_0x3e0d('0x1c')](_0x3c304c);}return null;};}function patchUpdates(_0x3b222a){return function(_0xce9744){try{jsonpatch[_0x3e0d('0x1d')](_0xce9744,_0x3b222a,!![]);}catch(_0x41f64a){return BPromise[_0x3e0d('0x1e')](_0x41f64a);}return _0xce9744[_0x3e0d('0x1f')]();};}function saveUpdates(_0x16e8d4,_0x457697){return function(_0x40609f){if(_0x40609f){return _0x40609f['update'](_0x16e8d4)[_0x3e0d('0x20')](function(_0x162c0a){return _0x162c0a;});}return null;};}function removeEntity(_0xa9a1c6,_0x3ded1c){return function(_0x4bfb22){if(_0x4bfb22){return _0x4bfb22[_0x3e0d('0x21')]()[_0x3e0d('0x20')](function(){var _0x13537e=_0x4bfb22[_0x3e0d('0x22')]({'plain':!![]});var _0x53fb95=_0x3e0d('0x23');return db[_0x3e0d('0x24')][_0x3e0d('0x21')]({'where':{'type':_0x53fb95,'resourceId':_0x13537e['id']}})[_0x3e0d('0x20')](function(){return _0x4bfb22;});})[_0x3e0d('0x20')](function(){_0xa9a1c6['status'](0xcc)[_0x3e0d('0x25')]();});}};}function handleEntityNotFound(_0x3d1aff,_0xefae06){return function(_0x460946){if(!_0x460946){_0x3d1aff['sendStatus'](0x194);}return _0x460946;};}function handleError(_0x4e83d5,_0x530976){_0x530976=_0x530976||0x1f4;return function(_0x1a155d){logger[_0x3e0d('0x26')](_0x1a155d[_0x3e0d('0x27')]);if(_0x1a155d['name']){delete _0x1a155d[_0x3e0d('0x28')];}_0x4e83d5['status'](_0x530976)['send'](_0x1a155d);};}exports[_0x3e0d('0x29')]=function(_0xd4939,_0x1b22ec){var _0xf65b53={},_0x28c8b6={},_0x20620e={'count':0x0,'rows':[]};return db[_0x3e0d('0x2a')][_0x3e0d('0x2b')]()[_0x3e0d('0x20')](function(_0x21805c){_0x28c8b6['model']=_[_0x3e0d('0x2c')](_0x21805c);_0x28c8b6[_0x3e0d('0x2d')]=_[_0x3e0d('0x2c')](_0xd4939['query']);_0x28c8b6[_0x3e0d('0x2e')]=_['intersection'](_0x28c8b6[_0x3e0d('0x2f')],_0x28c8b6['query']);_0xf65b53[_0x3e0d('0x30')]=_['intersection'](_0x28c8b6[_0x3e0d('0x2f')],qs[_0x3e0d('0x31')](_0xd4939['query'][_0x3e0d('0x31')]));_0xf65b53[_0x3e0d('0x30')]=_0xf65b53['attributes']['length']?_0xf65b53['attributes']:_0x28c8b6['model'];if(!_0xd4939[_0x3e0d('0x2d')][_0x3e0d('0x32')](_0x3e0d('0x33'))){_0xf65b53[_0x3e0d('0x19')]=qs[_0x3e0d('0x19')](_0xd4939['query'][_0x3e0d('0x19')]);_0xf65b53['offset']=qs['offset'](_0xd4939[_0x3e0d('0x2d')]['offset']);}_0xf65b53[_0x3e0d('0x34')]=qs[_0x3e0d('0x35')](_0xd4939[_0x3e0d('0x2d')][_0x3e0d('0x35')]);_0xf65b53['where']=qs['filters'](_['pick'](_0xd4939[_0x3e0d('0x2d')],_0x28c8b6[_0x3e0d('0x2e')]),_0x21805c);if(_0xd4939['query']['filter']){_0xf65b53[_0x3e0d('0x36')]=_[_0x3e0d('0x37')](_0xf65b53[_0x3e0d('0x36')],{'$or':_[_0x3e0d('0x38')](_0xf65b53[_0x3e0d('0x30')],function(_0x1c2b57){var _0x41d8c9={};_0x41d8c9[_0x1c2b57]={'$like':'%'+_0xd4939[_0x3e0d('0x2d')][_0x3e0d('0x39')]+'%'};return _0x41d8c9;})});}_0xf65b53=_['merge']({},_0xf65b53,_0xd4939[_0x3e0d('0x3a')]);var _0x18e999={'where':_0xf65b53[_0x3e0d('0x36')]};return db['CmCompany'][_0x3e0d('0x17')](_0x18e999)['then'](function(_0x1c9089){_0x20620e[_0x3e0d('0x17')]=_0x1c9089;if(_0xd4939['query'][_0x3e0d('0x3b')]){_0xf65b53[_0x3e0d('0x3c')]=[{'all':!![]}];}return db['CmCompany'][_0x3e0d('0x3d')](_0xf65b53);})['then'](function(_0x3c442f){_0x20620e['rows']=_0x3c442f;return _0x20620e;})[_0x3e0d('0x20')](respondWithFilteredResult(_0x1b22ec,_0xf65b53))['catch'](handleError(_0x1b22ec,null));})[_0x3e0d('0x3e')](handleError(_0x1b22ec,null));};exports[_0x3e0d('0x3f')]=function(_0x27f14d,_0x3aae60){var _0x257efa={'raw':![],'where':{'id':_0x27f14d[_0x3e0d('0x40')]['id']}},_0x1c1927={};_0x1c1927[_0x3e0d('0x2f')]=_['keys'](db[_0x3e0d('0x2a')][_0x3e0d('0x41')]);_0x1c1927[_0x3e0d('0x2d')]=_[_0x3e0d('0x2c')](_0x27f14d[_0x3e0d('0x2d')]);_0x1c1927[_0x3e0d('0x2e')]=_['intersection'](_0x1c1927[_0x3e0d('0x2f')],_0x1c1927[_0x3e0d('0x2d')]);_0x257efa[_0x3e0d('0x30')]=_[_0x3e0d('0x42')](_0x1c1927[_0x3e0d('0x2f')],qs[_0x3e0d('0x31')](_0x27f14d[_0x3e0d('0x2d')]['fields']));_0x257efa[_0x3e0d('0x30')]=_0x257efa[_0x3e0d('0x30')][_0x3e0d('0x43')]?_0x257efa[_0x3e0d('0x30')]:_0x1c1927[_0x3e0d('0x2f')];if(_0x27f14d[_0x3e0d('0x2d')][_0x3e0d('0x3b')]){_0x257efa[_0x3e0d('0x3c')]=[{'all':!![]}];}_0x257efa=_['merge']({},_0x257efa,_0x27f14d[_0x3e0d('0x3a')]);return db['CmCompany'][_0x3e0d('0x44')](_0x257efa)['then'](handleEntityNotFound(_0x3aae60,null))[_0x3e0d('0x20')](respondWithResult(_0x3aae60,null))[_0x3e0d('0x3e')](handleError(_0x3aae60,null));};exports[_0x3e0d('0x45')]=function(_0x3ad677,_0x40dd37){return db[_0x3e0d('0x2a')][_0x3e0d('0x45')](_0x3ad677[_0x3e0d('0x46')],{})[_0x3e0d('0x20')](function(_0x84331){var _0x1543b4=_0x3ad677[_0x3e0d('0x47')]['get']({'plain':!![]});if(!_0x1543b4)throw new Error(_0x3e0d('0x48'));if(_0x1543b4[_0x3e0d('0x49')]==='user'){var _0x3918a2=_0x84331[_0x3e0d('0x22')]({'plain':!![]});var _0x5857dd=_0x3e0d('0x23');return db[_0x3e0d('0x4a')]['find']({'where':{'name':_0x5857dd,'userProfileId':_0x1543b4[_0x3e0d('0x4b')]},'raw':!![]})[_0x3e0d('0x20')](function(_0x22654c){if(_0x22654c&&_0x22654c[_0x3e0d('0x4c')]===0x0){return db[_0x3e0d('0x24')][_0x3e0d('0x45')]({'name':_0x3918a2[_0x3e0d('0x28')],'resourceId':_0x3918a2['id'],'type':_0x22654c[_0x3e0d('0x28')],'sectionId':_0x22654c['id']},{})[_0x3e0d('0x20')](function(){return _0x84331;});}else{return _0x84331;}})[_0x3e0d('0x3e')](function(_0x2d791a){logger[_0x3e0d('0x26')](_0x3e0d('0x4d'),_0x2d791a);throw _0x2d791a;});}return _0x84331;})[_0x3e0d('0x20')](respondWithResult(_0x40dd37,0xc9))['catch'](handleError(_0x40dd37,null));};exports[_0x3e0d('0x4e')]=function(_0x31e254,_0x406767){if(_0x31e254[_0x3e0d('0x46')]['id']){delete _0x31e254[_0x3e0d('0x46')]['id'];}return db[_0x3e0d('0x2a')][_0x3e0d('0x44')]({'where':{'id':_0x31e254['params']['id']}})[_0x3e0d('0x20')](handleEntityNotFound(_0x406767,null))[_0x3e0d('0x20')](saveUpdates(_0x31e254['body'],null))[_0x3e0d('0x20')](respondWithResult(_0x406767,null))[_0x3e0d('0x3e')](handleError(_0x406767,null));};exports[_0x3e0d('0x21')]=function(_0x328f89,_0x1f2d17){return db['CmCompany'][_0x3e0d('0x44')]({'where':{'id':_0x328f89[_0x3e0d('0x40')]['id']}})[_0x3e0d('0x20')](handleEntityNotFound(_0x1f2d17,null))['then'](removeEntity(_0x1f2d17,null))[_0x3e0d('0x3e')](handleError(_0x1f2d17,null));};exports[_0x3e0d('0x2b')]=function(_0x209fda,_0x4d500a){return db[_0x3e0d('0x2a')][_0x3e0d('0x2b')]()['then'](respondWithResult(_0x4d500a,null))[_0x3e0d('0x3e')](handleError(_0x4d500a,null));};exports[_0x3e0d('0x4f')]=function(_0x260a89,_0x1fcd0e,_0x5e0404){return db[_0x3e0d('0x50')]['find']({'where':{'id':_0x260a89[_0x3e0d('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fcd0e,null))[_0x3e0d('0x20')](function(_0x51bc9c){if(_0x51bc9c){return _0x51bc9c['addContacts'](_0x260a89['body']['ids'],_[_0x3e0d('0x51')](_0x260a89['body'],[_0x3e0d('0x52'),'id'])||{});}})[_0x3e0d('0x20')](respondWithResult(_0x1fcd0e,null))[_0x3e0d('0x3e')](handleError(_0x1fcd0e,null));};exports[_0x3e0d('0x53')]=function(_0x51fe47,_0x873faa,_0x41ff02){var _0x1f358b={};var _0x52e6ec={};var _0x402bbe;var _0x151273;return db[_0x3e0d('0x2a')][_0x3e0d('0x54')]({'where':{'id':_0x51fe47[_0x3e0d('0x40')]['id']}})[_0x3e0d('0x20')](handleEntityNotFound(_0x873faa,null))[_0x3e0d('0x20')](function(_0x173efa){if(_0x173efa){_0x402bbe=_0x173efa;_0x52e6ec[_0x3e0d('0x2f')]=_[_0x3e0d('0x2c')](db['CmContact'][_0x3e0d('0x41')]);_0x52e6ec[_0x3e0d('0x2d')]=_[_0x3e0d('0x2c')](_0x51fe47[_0x3e0d('0x2d')]);_0x52e6ec[_0x3e0d('0x2e')]=_[_0x3e0d('0x42')](_0x52e6ec['model'],_0x52e6ec['query']);_0x1f358b[_0x3e0d('0x30')]=_[_0x3e0d('0x42')](_0x52e6ec[_0x3e0d('0x2f')],qs[_0x3e0d('0x31')](_0x51fe47[_0x3e0d('0x2d')][_0x3e0d('0x31')]));_0x1f358b[_0x3e0d('0x30')]=_0x1f358b[_0x3e0d('0x30')][_0x3e0d('0x43')]?_0x1f358b[_0x3e0d('0x30')]:_0x52e6ec[_0x3e0d('0x2f')];_0x1f358b[_0x3e0d('0x34')]=qs[_0x3e0d('0x35')](_0x51fe47[_0x3e0d('0x2d')][_0x3e0d('0x35')]);_0x1f358b[_0x3e0d('0x36')]=qs[_0x3e0d('0x2e')](_[_0x3e0d('0x55')](_0x51fe47[_0x3e0d('0x2d')],_0x52e6ec['filters']));if(_0x51fe47[_0x3e0d('0x2d')][_0x3e0d('0x39')]){_0x1f358b[_0x3e0d('0x36')]=_[_0x3e0d('0x37')](_0x1f358b['where'],{'$or':_[_0x3e0d('0x38')](_0x1f358b[_0x3e0d('0x30')],function(_0xad3352){var _0x51e152={};_0x51e152[_0xad3352]={'$like':'%'+_0x51fe47[_0x3e0d('0x2d')][_0x3e0d('0x39')]+'%'};return _0x51e152;})});}_0x1f358b=_[_0x3e0d('0x37')]({},_0x1f358b,_0x51fe47[_0x3e0d('0x3a')]);return _0x402bbe[_0x3e0d('0x53')](_0x1f358b);}})[_0x3e0d('0x20')](function(_0xfa5741){if(_0xfa5741){_0x151273=_0xfa5741['length'];if(!_0x51fe47[_0x3e0d('0x2d')][_0x3e0d('0x32')](_0x3e0d('0x33'))){_0x1f358b[_0x3e0d('0x19')]=qs['limit'](_0x51fe47[_0x3e0d('0x2d')][_0x3e0d('0x19')]);_0x1f358b[_0x3e0d('0x18')]=qs[_0x3e0d('0x18')](_0x51fe47['query'][_0x3e0d('0x18')]);}return _0x402bbe[_0x3e0d('0x53')](_0x1f358b);}})[_0x3e0d('0x20')](function(_0x35dee2){if(_0x35dee2){return _0x35dee2?{'count':_0x151273,'rows':_0x35dee2}:null;}})[_0x3e0d('0x20')](respondWithResult(_0x873faa,null))[_0x3e0d('0x3e')](handleError(_0x873faa,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7f44bc0..1ee246d 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 _0xad74=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','util'];(function(_0xcea816,_0x2e3766){var _0x5699a0=function(_0x840a56){while(--_0x840a56){_0xcea816['push'](_0xcea816['shift']());}};_0x5699a0(++_0x2e3766);}(_0xad74,0xba));var _0x4ad7=function(_0x50a1f6,_0x238fd8){_0x50a1f6=_0x50a1f6-0x0;var _0x84f8d4=_0xad74[_0x50a1f6];return _0x84f8d4;};'use strict';var _=require('lodash');var util=require(_0x4ad7('0x0'));var logger=require(_0x4ad7('0x1'))('api');var moment=require(_0x4ad7('0x2'));var BPromise=require('bluebird');var rp=require(_0x4ad7('0x3'));var fs=require('fs');var path=require(_0x4ad7('0x4'));var rimraf=require(_0x4ad7('0x5'));var config=require(_0x4ad7('0x6'));var attributes=require(_0x4ad7('0x7'));module[_0x4ad7('0x8')]=function(_0x425ee1,_0x48d14b){return _0x425ee1[_0x4ad7('0x9')](_0x4ad7('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84f4=['define','CmCompany','cm_companies','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports'];(function(_0x183f36,_0x30fd0e){var _0x501c3d=function(_0x554f00){while(--_0x554f00){_0x183f36['push'](_0x183f36['shift']());}};_0x501c3d(++_0x30fd0e);}(_0x84f4,0x1d1));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x484f('0x0'))(_0x484f('0x1'));var moment=require(_0x484f('0x2'));var BPromise=require('bluebird');var rp=require(_0x484f('0x3'));var fs=require('fs');var path=require(_0x484f('0x4'));var rimraf=require('rimraf');var config=require(_0x484f('0x5'));var attributes=require(_0x484f('0x6'));module[_0x484f('0x7')]=function(_0x1c4f57,_0x2fa923){return _0x1c4f57[_0x484f('0x8')](_0x484f('0x9'),attributes,{'tableName':_0x484f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 38884eb..c29a7cf 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 _0x9037=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','randomstring','../../mysqldb','rpc'];(function(_0x89a774,_0x2c228c){var _0x210ad8=function(_0x23d725){while(--_0x23d725){_0x89a774['push'](_0x89a774['shift']());}};_0x210ad8(++_0x2c228c);}(_0x9037,0x1dd));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7903('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7903('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7903('0x2'));var config=require(_0x7903('0x3'));var jayson=require(_0x7903('0x4'));var client=jayson['client'][_0x7903('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x435a91,_0x515667,_0x952ca1){return new BPromise(function(_0x4494f0,_0xbee83){return client[_0x7903('0x6')](_0x435a91,_0x952ca1)[_0x7903('0x7')](function(_0x504985){logger[_0x7903('0x8')]('CmCompany,\x20%s,\x20%s',_0x515667,_0x7903('0x9'));logger[_0x7903('0xa')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x515667,'request\x20sent',JSON[_0x7903('0xb')](_0x504985));if(_0x504985[_0x7903('0xc')]){if(_0x504985[_0x7903('0xc')]['code']===0x1f4){logger['error'](_0x7903('0xd'),_0x515667,_0x504985[_0x7903('0xc')][_0x7903('0xe')]);return _0xbee83(_0x504985[_0x7903('0xc')]['message']);}logger[_0x7903('0xc')](_0x7903('0xd'),_0x515667,_0x504985[_0x7903('0xc')][_0x7903('0xe')]);return _0x4494f0(_0x504985[_0x7903('0xc')][_0x7903('0xe')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x515667,_0x7903('0x9'));_0x4494f0(_0x504985['result'][_0x7903('0xe')]);}})[_0x7903('0xf')](function(_0x8ea40d){logger['error'](_0x7903('0xd'),_0x515667,_0x8ea40d);_0xbee83(_0x8ea40d);});});} \ No newline at end of file +var _0xe9fa=['request\x20sent','debug','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x276167,_0x21086e){var _0x27a866=function(_0xa47f17){while(--_0xa47f17){_0x276167['push'](_0x276167['shift']());}};_0x27a866(++_0x21086e);}(_0xe9fa,0x13b));var _0xae9f=function(_0x5ac4c0,_0x15b9c8){_0x5ac4c0=_0x5ac4c0-0x0;var _0x24bc4b=_0xe9fa[_0x5ac4c0];return _0x24bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xae9f('0x0'));var BPromise=require(_0xae9f('0x1'));var rs=require(_0xae9f('0x2'));var fs=require('fs');var Redis=require(_0xae9f('0x3'));var db=require(_0xae9f('0x4'))['db'];var utils=require(_0xae9f('0x5'));var logger=require(_0xae9f('0x6'))(_0xae9f('0x7'));var config=require(_0xae9f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae9f('0x9')][_0xae9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc2aeb,_0x41571c,_0x5e8c77){return new BPromise(function(_0x36b403,_0x2099bb){return client[_0xae9f('0xb')](_0xc2aeb,_0x5e8c77)[_0xae9f('0xc')](function(_0x4daa18){logger[_0xae9f('0xd')](_0xae9f('0xe'),_0x41571c,_0xae9f('0xf'));logger[_0xae9f('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x41571c,_0xae9f('0xf'),JSON[_0xae9f('0x11')](_0x4daa18));if(_0x4daa18[_0xae9f('0x12')]){if(_0x4daa18[_0xae9f('0x12')][_0xae9f('0x13')]===0x1f4){logger[_0xae9f('0x12')](_0xae9f('0xe'),_0x41571c,_0x4daa18['error'][_0xae9f('0x14')]);return _0x2099bb(_0x4daa18[_0xae9f('0x12')][_0xae9f('0x14')]);}logger[_0xae9f('0x12')](_0xae9f('0xe'),_0x41571c,_0x4daa18[_0xae9f('0x12')]['message']);return _0x36b403(_0x4daa18[_0xae9f('0x12')]['message']);}else{logger['info'](_0xae9f('0xe'),_0x41571c,_0xae9f('0xf'));_0x36b403(_0x4daa18[_0xae9f('0x15')][_0xae9f('0x14')]);}})['catch'](function(_0x2e7f94){logger['error'](_0xae9f('0xe'),_0x41571c,_0x2e7f94);_0x2099bb(_0x2e7f94);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e24d3b7..705261f 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 _0x3e74=['isAuthenticated','index','describe','/:id','getContacts','post','create','/:id/contacts','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x1f2033,_0x4484b8){var _0x44f104=function(_0x29a6d9){while(--_0x29a6d9){_0x1f2033['push'](_0x1f2033['shift']());}};_0x44f104(++_0x4484b8);}(_0x3e74,0x175));var _0x43e7=function(_0x2bd77f,_0x4e2450){_0x2bd77f=_0x2bd77f-0x0;var _0x2f8e05=_0x3e74[_0x2bd77f];return _0x2f8e05;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post'](_0x43e7('0xe'),auth[_0x43e7('0x7')](),controller['addContacts']);router[_0x43e7('0xf')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','addContacts','put','update','destroy','exports','path','connect-timeout'];(function(_0x6e4f95,_0x4de571){var _0xccdf44=function(_0xedd46e){while(--_0xedd46e){_0x6e4f95['push'](_0x6e4f95['shift']());}};_0xccdf44(++_0x4de571);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index b7f0542..6c58ccc 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 _0x3a5d=['TEXT','INTEGER','DATE','NOW','lodash','exports','STRING'];(function(_0x58128a,_0x8ab991){var _0x56f353=function(_0x925531){while(--_0x925531){_0x58128a['push'](_0x58128a['shift']());}};_0x56f353(++_0x8ab991);}(_0x3a5d,0x193));var _0xd3a5=function(_0x21c1c7,_0x2ded8a){_0x21c1c7=_0x21c1c7-0x0;var _0x2d95bd=_0x3a5d[_0x21c1c7];return _0x2d95bd;};'use strict';var _=require(_0xd3a5('0x0'));var Sequelize=require('sequelize');module[_0xd3a5('0x1')]={'firstName':{'type':Sequelize[_0xd3a5('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd3a5('0x2')]},'street':{'type':Sequelize[_0xd3a5('0x2')]},'postalCode':{'type':Sequelize[_0xd3a5('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xd3a5('0x2')]},'description':{'type':Sequelize[_0xd3a5('0x3')]},'phone':{'type':Sequelize[_0xd3a5('0x2')]},'mobile':{'type':Sequelize[_0xd3a5('0x2')]},'fax':{'type':Sequelize[_0xd3a5('0x2')]},'email':{'type':Sequelize[_0xd3a5('0x2')]},'url':{'type':Sequelize[_0xd3a5('0x2')]},'facebook':{'type':Sequelize[_0xd3a5('0x2')]},'fb_data':{'type':Sequelize[_0xd3a5('0x2')]},'twitter':{'type':Sequelize[_0xd3a5('0x2')]},'skype':{'type':Sequelize[_0xd3a5('0x2')]},'teams':{'type':Sequelize[_0xd3a5('0x2')]},'viber':{'type':Sequelize[_0xd3a5('0x2')]},'line':{'type':Sequelize[_0xd3a5('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xd3a5('0x2')]},'UserId':{'type':Sequelize[_0xd3a5('0x4')]},'priority':{'type':Sequelize[_0xd3a5('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd3a5('0x5')],'defaultValue':Sequelize[_0xd3a5('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xd3a5('0x4')]}}; \ No newline at end of file +var _0xb389=['STRING','TEXT','INTEGER','NOW','lodash','exports'];(function(_0x3febc2,_0x377c7e){var _0x14046c=function(_0x49ddbc){while(--_0x49ddbc){_0x3febc2['push'](_0x3febc2['shift']());}};_0x14046c(++_0x377c7e);}(_0xb389,0x1b4));var _0x9b38=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xb389[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0x9b38('0x0'));var Sequelize=require('sequelize');module[_0x9b38('0x1')]={'firstName':{'type':Sequelize[_0x9b38('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9b38('0x2')]},'street':{'type':Sequelize[_0x9b38('0x2')]},'postalCode':{'type':Sequelize[_0x9b38('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9b38('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9b38('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x9b38('0x2')]},'fax':{'type':Sequelize[_0x9b38('0x2')]},'email':{'type':Sequelize[_0x9b38('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9b38('0x2')]},'fb_data':{'type':Sequelize[_0x9b38('0x2')]},'twitter':{'type':Sequelize[_0x9b38('0x2')]},'skype':{'type':Sequelize[_0x9b38('0x2')]},'teams':{'type':Sequelize[_0x9b38('0x2')]},'viber':{'type':Sequelize[_0x9b38('0x2')]},'line':{'type':Sequelize[_0x9b38('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x9b38('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x9b38('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x9b38('0x5')]},'dialTimezone':{'type':Sequelize[_0x9b38('0x2')]},'utcOffset':{'type':Sequelize[_0x9b38('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 25944bb..e539cec 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 _0x8954=['squel','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','socket.io-emitter','./cmContact.socket','register','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','update','then','end','error','stack','name','send','index','describe','length','keys','push','CmCustomField','all','fieldType','query','filters','intersection','model','fields','attributes','hasOwnProperty','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','c.deletedAt\x20IS\x20NULL','expr','search','conditions','find','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','datetime','castTo','buildExpression','type','text','map','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','Sequelize','SELECT','c.id','DESC','having','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','toString','merge','CmContact','c.firstName','c.phone','c.mobile','c.ListId','c.deletedAt','TagIds','sequelize','rows','destroy','catch','tags','startsWith','cf_','columnName','displayName','findAll','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','duplicates','$or','findOrCreate','spread','Tag','Tags','color','$and','omit','format','cf_%d','params','pickBy','table','setFields','id\x20=\x20?','toParam','phone','CmHopper','findOne','getTags','setTags','getHoppers','rawAttributes','ContactId','includeAll','getHopperHistories','options','include','getJscriptySessions','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','fork','CompanyId','upload','createReadStream','file','import','binding','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x1ef388,_0xedabc3){var _0x583289=function(_0x3d537a){while(--_0x3d537a){_0x1ef388['push'](_0x1ef388['shift']());}};_0x583289(++_0xedabc3);}(_0x8954,0x1bb));var _0x4895=function(_0x526374,_0x13fff8){_0x526374=_0x526374-0x0;var _0x2d5739=_0x8954[_0x526374];return _0x2d5739;};'use strict';var pdf=require(_0x4895('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4895('0x1'));var zipdir=require(_0x4895('0x2'));var jsonpatch=require(_0x4895('0x3'));var rp=require('request-promise');var moment=require(_0x4895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4895('0x5'));var util=require('util');var path=require(_0x4895('0x6'));var sox=require(_0x4895('0x7'));var csv=require(_0x4895('0x8'));var ejs=require(_0x4895('0x9'));var fs=require('fs');var _=require(_0x4895('0xa'));var squel=require(_0x4895('0xb'));var crypto=require(_0x4895('0xc'));var jsforce=require(_0x4895('0xd'));var deskjs=require(_0x4895('0xe'));var toCsv=require(_0x4895('0x8'));var querystring=require(_0x4895('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4895('0x10'));var qs=require(_0x4895('0x11'));var as=require(_0x4895('0x12'));var hardwareService=require(_0x4895('0x13'));var logger=require(_0x4895('0x14'))(_0x4895('0x15'));var utils=require(_0x4895('0x16'));var config=require(_0x4895('0x17'));var db=require('../../mysqldb')['db'];config[_0x4895('0x18')]=_[_0x4895('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4895('0x1a'))(new Redis(config[_0x4895('0x18')]));require(_0x4895('0x1b'))[_0x4895('0x1c')](socket);function respondWithStatusCode(_0x327f4e,_0x25889a){_0x25889a=_0x25889a||0xcc;return function(_0x3cb364){if(_0x3cb364){return _0x327f4e[_0x4895('0x1d')](_0x25889a);}return _0x327f4e[_0x4895('0x1e')](_0x25889a)['end']();};}function respondWithResult(_0x42be15,_0x4d18f9){_0x4d18f9=_0x4d18f9||0xc8;return function(_0x8c5354){if(_0x8c5354){return _0x42be15['status'](_0x4d18f9)['json'](_0x8c5354);}};}function respondWithFilteredResult(_0x229721,_0x45ce45){return function(_0x51f3c1){if(_0x51f3c1){var _0x28bc5a=_0x51f3c1[_0x4895('0x1f')],_0x5df592=_0x45ce45[_0x4895('0x20')],_0x3a60f9=_0x45ce45['offset']+_0x45ce45[_0x4895('0x21')],_0x4c9fa9;if(_0x3a60f9>=_0x28bc5a){_0x3a60f9=_0x28bc5a;_0x4c9fa9=0xc8;}else{_0x4c9fa9=0xce;}_0x229721['status'](_0x4c9fa9);return _0x229721['set'](_0x4895('0x22'),_0x5df592+'-'+_0x3a60f9+'/'+_0x28bc5a)[_0x4895('0x23')](_0x51f3c1);}return null;};}function patchUpdates(_0x13a6ea){return function(_0x5406df){try{jsonpatch[_0x4895('0x24')](_0x5406df,_0x13a6ea,!![]);}catch(_0x339937){return BPromise[_0x4895('0x25')](_0x339937);}return _0x5406df['save']();};}function saveUpdates(_0x504339,_0xca1fb3){return function(_0x478cd5){if(_0x478cd5){return _0x478cd5[_0x4895('0x26')](_0x504339)[_0x4895('0x27')](function(_0x54988d){return _0x54988d;});}return null;};}function removeEntity(_0x3e9b01,_0x30d601){return function(_0x363c8f){if(_0x363c8f){return _0x363c8f['destroy']()[_0x4895('0x27')](function(){_0x3e9b01[_0x4895('0x1e')](0xcc)[_0x4895('0x28')]();});}};}function handleEntityNotFound(_0x1276aa,_0x16072b){return function(_0x30b333){if(!_0x30b333){_0x1276aa[_0x4895('0x1d')](0x194);}return _0x30b333;};}function handleError(_0x4b482d,_0x3a7638){_0x3a7638=_0x3a7638||0x1f4;return function(_0x37577e){logger[_0x4895('0x29')](_0x37577e[_0x4895('0x2a')]);if(_0x37577e[_0x4895('0x2b')]){delete _0x37577e[_0x4895('0x2b')];}_0x4b482d['status'](_0x3a7638)[_0x4895('0x2c')](_0x37577e);};}exports[_0x4895('0x2d')]=function(_0x27563d,_0x2585da){var _0x3f740f={},_0x230c9c={},_0xc897ca={'count':0x0,'rows':[]};return db['CmContact'][_0x4895('0x2e')]()['then'](function(_0x17aa78){var _0x1be6e4=[];for(var _0x195496=0x0;_0x1954960x1){_0x425f39['or'](_0x4895('0x67'),qs[_0x4895('0x68')](_0x5bb0ad),null);}else{if(qs['isNumeric'](_0x5bb0ad)){_0x425f39['or'](_0x4895('0x69'),_0x5bb0ad+'%');_0x425f39['or']('c.phone\x20LIKE\x20?',_0x5bb0ad+'%');_0x425f39['or'](_0x4895('0x6a'),_0x5bb0ad+'%');_0x425f39['or'](_0x4895('0x6b'),_0x5bb0ad+'%');}else if(qs['isEmail'](_0x5bb0ad)){_0x425f39['or'](_0x4895('0x6c'),_0x5bb0ad+'%');}else{_0x425f39['or']('c.firstName\x20LIKE\x20?','%'+_0x5bb0ad+'%');_0x425f39['or'](_0x4895('0x6d'),'%'+_0x5bb0ad+'%');_0x425f39['or'](_0x4895('0x6c'),'%'+_0x5bb0ad+'%');}}}}_0x3ae3f7[_0x4895('0x3f')](_0x425f39);_0x3ae3f7['group']('c.id');var _0x5bd24f={'type':db[_0x4895('0x6e')]['QueryTypes'][_0x4895('0x6f')],'raw':!![]};var _0x4d07d6=_0x3ae3f7['clone']()['field'](_0x4895('0x70'));if(_0x3f740f['order']){_0x3f740f['order'][_0x4895('0x52')](function(_0x3fbc2c){_0x3ae3f7['order']('c.'+_0x3fbc2c[0x0],_0x3fbc2c[0x1]===_0x4895('0x71')?![]:!![]);});}if(!_[_0x4895('0x60')](_0x1014e9)){_0x3ae3f7[_0x4895('0x72')](_0x2d10de);_0x4d07d6['where']('t.id\x20IN\x20?',_0x1014e9);}BPromise[_0x4895('0x73')]()[_0x4895('0x27')](function(){if(_0x1f0377&&!_[_0x4895('0x74')](_0x1f0377[_0x4895('0x4e')],[_0x4895('0x42'),_0x4895('0x55')])){return _0x27563d[_0x4895('0x75')][_0x4895('0x76')]({'attributes':['id'],'raw':!![]})[_0x4895('0x27')](function(_0x454d2a){if(_[_0x4895('0x60')](_0x454d2a)){_0x4d07d6[_0x4895('0x3f')](_0x4895('0x77'));_0x3ae3f7['where'](_0x4895('0x77'));}else{_0x4d07d6[_0x4895('0x3f')]('c.ListId\x20IN\x20?',_[_0x4895('0x5c')](_0x454d2a,'id'));_0x3ae3f7[_0x4895('0x3f')](_0x4895('0x62'),_[_0x4895('0x5c')](_0x454d2a,'id'));}});}else{return;}})['then'](function(){db['sequelize'][_0x4895('0x35')](_0x4d07d6[_0x4895('0x78')](),_0x5bd24f)[_0x4895('0x27')](function(_0xd4c1f7){_0xc897ca[_0x4895('0x1f')]=_0xd4c1f7[_0x4895('0x2f')];if(_0xc897ca[_0x4895('0x1f')]===0x0)return[];return db['sequelize'][_0x4895('0x35')](_0x4c9aa6[_0x4895('0x78')](),_0x5bd24f);})[_0x4895('0x27')](function(_0x86fb55){_0x543aab=_['keyBy'](_0x86fb55,'id');_0x5bd24f=_[_0x4895('0x79')](_0x5bd24f,{'model':db[_0x4895('0x7a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27563d[_0x4895('0x35')][_0x4895('0x39')]){_0x3f740f[_0x4895('0x3a')][_0x4895('0x52')](function(_0x3c7775){_0x3ae3f7[_0x4895('0x42')]('c.'+_0x3c7775);});}else{_0x3ae3f7[_0x4895('0x42')]('c.id');_0x3ae3f7[_0x4895('0x42')](_0x4895('0x7b'));_0x3ae3f7[_0x4895('0x42')]('c.lastName');_0x3ae3f7[_0x4895('0x42')](_0x4895('0x7c'));_0x3ae3f7[_0x4895('0x42')](_0x4895('0x7d'));_0x3ae3f7[_0x4895('0x42')]('c.fax');_0x3ae3f7[_0x4895('0x42')]('c.email');_0x3ae3f7[_0x4895('0x42')](_0x4895('0x7e'));_0x3ae3f7[_0x4895('0x42')](_0x4895('0x7f'));_0x3ae3f7[_0x4895('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4895('0x80'));}if(_0x3f740f[_0x4895('0x21')])_0x3ae3f7['limit'](_0x3f740f[_0x4895('0x21')]);if(_0x3f740f['offset'])_0x3ae3f7[_0x4895('0x20')](_0x3f740f['offset']);return db[_0x4895('0x81')][_0x4895('0x35')](_0x3ae3f7[_0x4895('0x78')](),_0x5bd24f);})[_0x4895('0x27')](function(_0x1f9012){_0x1f9012[_0x4895('0x52')](function(_0x1fcfc0){if(_0x1fcfc0[_0x4895('0x80')]){_0x1fcfc0['Tags']=[];_0x1fcfc0[_0x4895('0x80')][_0x4895('0x51')](',')[_0x4895('0x52')](function(_0x4484bf){_0x1fcfc0['Tags'][_0x4895('0x31')](_0x543aab[_0x4484bf]);});}delete _0x1fcfc0['TagIds'];});_0xc897ca[_0x4895('0x82')]=_0x1f9012;return _0xc897ca;})[_0x4895('0x27')](respondWithFilteredResult(_0x2585da,_0x3f740f));});})['catch'](handleError(_0x2585da,null));};exports[_0x4895('0x83')]=function(_0x3a7107,_0x15ee5d){return db['CmContact']['find']({'where':{'id':_0x3a7107['params']['id']}})[_0x4895('0x27')](handleEntityNotFound(_0x15ee5d,null))['then'](removeEntity(_0x15ee5d,null))[_0x4895('0x84')](handleError(_0x15ee5d,null));};exports[_0x4895('0x2e')]=function(_0x26b7f4,_0x391061){return db['CmContact'][_0x4895('0x2e')]()['then'](function(_0x4ac83e){delete _0x4ac83e[_0x4895('0x85')];for(var _0x510c9f=0x0;_0x510c9f=_0x539621){_0x2a8351=_0x539621;_0x2d670d=0xc8;}else{_0x2d670d=0xce;}_0x31dc0e[_0x0056('0x1a')](_0x2d670d);return _0x31dc0e['set'](_0x0056('0x1f'),_0x8dabdb+'-'+_0x2a8351+'/'+_0x539621)[_0x0056('0x1c')](_0x16ae03);}return null;};}function patchUpdates(_0x15fe8f){return function(_0x416385){try{jsonpatch[_0x0056('0x20')](_0x416385,_0x15fe8f,!![]);}catch(_0x1ad404){return BPromise[_0x0056('0x21')](_0x1ad404);}return _0x416385[_0x0056('0x22')]();};}function saveUpdates(_0x53a1d,_0x2f607a){return function(_0x3b4f97){if(_0x3b4f97){return _0x3b4f97[_0x0056('0x23')](_0x53a1d)[_0x0056('0x24')](function(_0xa34788){return _0xa34788;});}return null;};}function removeEntity(_0x38d8cb,_0x475009){return function(_0x45fe8a){if(_0x45fe8a){return _0x45fe8a[_0x0056('0x25')]()[_0x0056('0x24')](function(){_0x38d8cb[_0x0056('0x1a')](0xcc)[_0x0056('0x1b')]();});}};}function handleEntityNotFound(_0x2ff21b,_0x25c43d){return function(_0x28909a){if(!_0x28909a){_0x2ff21b[_0x0056('0x26')](0x194);}return _0x28909a;};}function handleError(_0x21c667,_0x17462f){_0x17462f=_0x17462f||0x1f4;return function(_0x5b4489){logger['error'](_0x5b4489[_0x0056('0x27')]);if(_0x5b4489[_0x0056('0x28')]){delete _0x5b4489['name'];}_0x21c667[_0x0056('0x1a')](_0x17462f)[_0x0056('0x29')](_0x5b4489);};}exports['index']=function(_0x4cbb0f,_0x5a9c9d){var _0x37affd={},_0x2c1e1a={},_0x5e9faa={'count':0x0,'rows':[]};return db[_0x0056('0x2a')][_0x0056('0x2b')]()[_0x0056('0x24')](function(_0x55633f){var _0xd43be8=[];for(var _0x336899=0x0;_0x3368990x1){_0x4529a9['or'](_0x0056('0x6a'),qs[_0x0056('0x6b')](_0x32d458),null);}else{if(qs[_0x0056('0x6c')](_0x32d458)){_0x4529a9['or']('c.id\x20LIKE\x20?',_0x32d458+'%');_0x4529a9['or'](_0x0056('0x6d'),_0x32d458+'%');_0x4529a9['or'](_0x0056('0x6e'),_0x32d458+'%');_0x4529a9['or'](_0x0056('0x6f'),_0x32d458+'%');}else if(qs[_0x0056('0x70')](_0x32d458)){_0x4529a9['or']('c.email\x20LIKE\x20?',_0x32d458+'%');}else{_0x4529a9['or']('c.firstName\x20LIKE\x20?','%'+_0x32d458+'%');_0x4529a9['or'](_0x0056('0x71'),'%'+_0x32d458+'%');_0x4529a9['or'](_0x0056('0x72'),'%'+_0x32d458+'%');}}}}_0x28adfc['where'](_0x4529a9);_0x28adfc[_0x0056('0x73')](_0x0056('0x74'));var _0x162534={'type':db[_0x0056('0x75')][_0x0056('0x76')][_0x0056('0x77')],'raw':!![]};var _0x2a2d45=_0x28adfc[_0x0056('0x78')]()[_0x0056('0x42')](_0x0056('0x74'));if(_0x37affd['order']){_0x37affd['order']['forEach'](function(_0x3150a3){_0x28adfc['order']('c.'+_0x3150a3[0x0],_0x3150a3[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0056('0x63')](_0x1b05e0)){_0x28adfc[_0x0056('0x79')](_0x40dc56);_0x2a2d45[_0x0056('0x40')](_0x0056('0x7a'),_0x1b05e0);}BPromise['resolve']()['then'](function(){if(_0xd3c582&&!_[_0x0056('0x7b')](_0xd3c582['conditions'],[_0x0056('0x42'),_0x0056('0x58')])){return _0x4cbb0f['user']['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x545200){if(_[_0x0056('0x63')](_0x545200)){_0x2a2d45[_0x0056('0x40')](_0x0056('0x7c'));_0x28adfc[_0x0056('0x40')](_0x0056('0x7c'));}else{_0x2a2d45[_0x0056('0x40')]('c.ListId\x20IN\x20?',_['map'](_0x545200,'id'));_0x28adfc[_0x0056('0x40')](_0x0056('0x65'),_[_0x0056('0x54')](_0x545200,'id'));}});}else{return;}})['then'](function(){db[_0x0056('0x7d')][_0x0056('0x38')](_0x2a2d45['toString'](),_0x162534)[_0x0056('0x24')](function(_0x3f367f){_0x5e9faa[_0x0056('0x7e')]=_0x3f367f[_0x0056('0x2d')];if(_0x5e9faa[_0x0056('0x7e')]===0x0)return[];return db['sequelize'][_0x0056('0x38')](_0x2af9d5[_0x0056('0x7f')](),_0x162534);})[_0x0056('0x24')](function(_0x4366c0){_0x1c7878=_['keyBy'](_0x4366c0,'id');_0x162534=_[_0x0056('0x80')](_0x162534,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4cbb0f['query']['fields']){_0x37affd[_0x0056('0x3a')][_0x0056('0x55')](function(_0x4d90da){_0x28adfc[_0x0056('0x42')]('c.'+_0x4d90da);});}else{_0x28adfc[_0x0056('0x42')](_0x0056('0x74'));_0x28adfc[_0x0056('0x42')](_0x0056('0x81'));_0x28adfc[_0x0056('0x42')](_0x0056('0x82'));_0x28adfc[_0x0056('0x42')]('c.phone');_0x28adfc[_0x0056('0x42')](_0x0056('0x83'));_0x28adfc['field']('c.fax');_0x28adfc[_0x0056('0x42')](_0x0056('0x84'));_0x28adfc[_0x0056('0x42')](_0x0056('0x85'));_0x28adfc[_0x0056('0x42')](_0x0056('0x86'));_0x28adfc['field'](_0x0056('0x87'),'TagIds');}if(_0x37affd[_0x0056('0x1e')])_0x28adfc[_0x0056('0x1e')](_0x37affd[_0x0056('0x1e')]);if(_0x37affd[_0x0056('0x1d')])_0x28adfc['offset'](_0x37affd[_0x0056('0x1d')]);return db[_0x0056('0x7d')][_0x0056('0x38')](_0x28adfc[_0x0056('0x7f')](),_0x162534);})['then'](function(_0x3985e4){_0x3985e4[_0x0056('0x55')](function(_0x1ae6db){if(_0x1ae6db[_0x0056('0x88')]){_0x1ae6db[_0x0056('0x89')]=[];_0x1ae6db[_0x0056('0x88')][_0x0056('0x53')](',')[_0x0056('0x55')](function(_0x286829){_0x1ae6db['Tags']['push'](_0x1c7878[_0x286829]);});}delete _0x1ae6db[_0x0056('0x88')];});_0x5e9faa[_0x0056('0x8a')]=_0x3985e4;return _0x5e9faa;})[_0x0056('0x24')](respondWithFilteredResult(_0x5a9c9d,_0x37affd));});})[_0x0056('0x8b')](handleError(_0x5a9c9d,null));};exports[_0x0056('0x25')]=function(_0x588c58,_0x4d0cc5){return db[_0x0056('0x2a')][_0x0056('0x52')]({'where':{'id':_0x588c58[_0x0056('0x8c')]['id']}})[_0x0056('0x24')](handleEntityNotFound(_0x4d0cc5,null))[_0x0056('0x24')](removeEntity(_0x4d0cc5,null))[_0x0056('0x8b')](handleError(_0x4d0cc5,null));};exports[_0x0056('0x2b')]=function(_0x5b9bab,_0xec15ef){return db[_0x0056('0x2a')][_0x0056('0x2b')]()['then'](function(_0x5543a9){delete _0x5543a9[_0x0056('0x8d')];for(var _0x582006=0x0;_0x582006{}\s\\|]/g,'-');_0x2f46f1(null,util['format']('%s-%s%s',path[_0x15fd('0x1e')](_0x3761db[_0x15fd('0x1c')],path[_0x15fd('0x1f')](_0x3761db[_0x15fd('0x1c')])),Date[_0x15fd('0x20')](),path[_0x15fd('0x1f')](_0x3761db[_0x15fd('0x1c')])));}})});router['post'](_0x15fd('0x21'),upload[_0x15fd('0x22')](_0x15fd('0x23')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x15fd('0x18')]({'destination':function(_0x49062f,_0x3d1835,_0x1fc24f){_0x1fc24f(null,path[_0x15fd('0x19')](config['root'],_0x15fd('0x1b')));},'filename':function(_0x1cbf2c,_0x24c541,_0x5d4789){_0x24c541[_0x15fd('0x1c')]=_0x24c541['originalname'][_0x15fd('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5d4789(null,util[_0x15fd('0x24')](_0x15fd('0x25'),path[_0x15fd('0x1e')](_0x24c541[_0x15fd('0x1c')],path[_0x15fd('0x1f')](_0x24c541[_0x15fd('0x1c')])),Date[_0x15fd('0x20')](),path[_0x15fd('0x1f')](_0x24c541[_0x15fd('0x1c')])));}})});router[_0x15fd('0x13')]('/upload',upload[_0x15fd('0x22')](_0x15fd('0x23')),controller['upload']);router[_0x15fd('0x13')](_0x15fd('0x26'),auth['isAuthenticated'](),controller[_0x15fd('0x27')]);router[_0x15fd('0x28')]('/:id',auth[_0x15fd('0x7')](),controller[_0x15fd('0x29')]);router[_0x15fd('0x2a')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['originalname','replace','format','basename','extname','now','file','server/files/tmp','%s-%s%s','single','upload','/upload/:id','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','diskStorage','join','root'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x55ca,0x126));var _0xa55c=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x55ca[_0x324496];return _0x899545;};'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',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/tags',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0x6')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0x6')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router['get']('/:id/hopper_finals',auth[_0xa55c('0x7')](),controller['getHopperFinals']);router['get']('/:id/jscripty_sessions',auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x14')]);router['post']('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x12')](_0xa55c('0x16'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x17')]);router[_0xa55c('0x12')](_0xa55c('0x18'),auth[_0xa55c('0x7')](),controller['setTags']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x104a99,_0x461284,_0x358b61){_0x358b61(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],'server/files/tmp'));},'filename':function(_0x5f5158,_0xd643cc,_0x3776ac){_0xd643cc[_0xa55c('0x1c')]=_0xd643cc['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3776ac(null,util[_0xa55c('0x1e')]('%s-%s%s',path[_0xa55c('0x1f')](_0xd643cc[_0xa55c('0x1c')],path[_0xa55c('0x20')](_0xd643cc[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path['extname'](_0xd643cc[_0xa55c('0x1c')])));}})});router['post']('/csv',upload['single'](_0xa55c('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x190757,_0x3f64de,_0xf0e574){_0xf0e574(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],_0xa55c('0x23')));},'filename':function(_0x11e7f7,_0x192df2,_0x3cd152){_0x192df2[_0xa55c('0x1c')]=_0x192df2['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cd152(null,util[_0xa55c('0x1e')](_0xa55c('0x24'),path[_0xa55c('0x1f')](_0x192df2['originalname'],path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])));}})});router[_0xa55c('0x12')]('/upload',upload[_0xa55c('0x25')]('file'),controller[_0xa55c('0x26')]);router[_0xa55c('0x12')](_0xa55c('0x27'),auth[_0xa55c('0x7')](),controller['import']);router[_0xa55c('0x28')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2a')]);router[_0xa55c('0x2b')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2c')]);module[_0xa55c('0x2d')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 67117fd..db2d453 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16a6=['STRING','INTEGER','PHONE','sequelize','exports'];(function(_0x297ece,_0x8f98b0){var _0x4d30b4=function(_0x1afd10){while(--_0x1afd10){_0x297ece['push'](_0x297ece['shift']());}};_0x4d30b4(++_0x8f98b0);}(_0x16a6,0x15c));var _0x616a=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x16a6[_0x49beea];return _0x27693a;};'use strict';var Sequelize=require(_0x616a('0x0'));module[_0x616a('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x616a('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x616a('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x616a('0x2')],'defaultValue':_0x616a('0x4')},'OrderBy':{'type':Sequelize[_0x616a('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xae1c=['INTEGER','STRING','PHONE'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xae1c,0xff));var _0xcae1=function(_0x39e068,_0x5462c1){_0x39e068=_0x39e068-0x0;var _0x59abb5=_0xae1c[_0x39e068];return _0x59abb5;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xcae1('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xcae1('0x1')],'defaultValue':_0xcae1('0x2')},'OrderBy':{'type':Sequelize[_0xcae1('0x0')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index ed3d7d9..cf3aad7 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d70=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto'];(function(_0x132638,_0x5bad62){var _0x4b2619=function(_0x3c9d91){while(--_0x3c9d91){_0x132638['push'](_0x132638['shift']());}};_0x4b2619(++_0x5bad62);}(_0x0d70,0x187));var _0x00d7=function(_0x10b33e,_0x31e699){_0x10b33e=_0x10b33e-0x0;var _0x2d6ee0=_0x0d70[_0x10b33e];return _0x2d6ee0;};'use strict';var pdf=require(_0x00d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00d7('0x1'));var zipdir=require(_0x00d7('0x2'));var jsonpatch=require(_0x00d7('0x3'));var rp=require(_0x00d7('0x4'));var moment=require(_0x00d7('0x5'));var BPromise=require(_0x00d7('0x6'));var Mustache=require(_0x00d7('0x7'));var util=require(_0x00d7('0x8'));var path=require('path');var sox=require(_0x00d7('0x9'));var csv=require('to-csv');var ejs=require(_0x00d7('0xa'));var fs=require('fs');var _=require(_0x00d7('0xb'));var squel=require(_0x00d7('0xc'));var crypto=require(_0x00d7('0xd'));var jsforce=require(_0x00d7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x00d7('0xf'));var Papa=require(_0x00d7('0x10'));var Redis=require(_0x00d7('0x11'));var authService=require(_0x00d7('0x12'));var qs=require(_0x00d7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00d7('0x14'));var logger=require(_0x00d7('0x15'))(_0x00d7('0x16'));var utils=require(_0x00d7('0x17'));var config=require(_0x00d7('0x18'));var db=require(_0x00d7('0x19'))['db'];function respondWithStatusCode(_0x5e9c1d,_0x1663cb){_0x1663cb=_0x1663cb||0xcc;return function(_0x1a7e25){if(_0x1a7e25){return _0x5e9c1d[_0x00d7('0x1a')](_0x1663cb);}return _0x5e9c1d[_0x00d7('0x1b')](_0x1663cb)[_0x00d7('0x1c')]();};}function respondWithResult(_0x2980c0,_0x179bce){_0x179bce=_0x179bce||0xc8;return function(_0x2810a0){if(_0x2810a0){return _0x2980c0[_0x00d7('0x1b')](_0x179bce)[_0x00d7('0x1d')](_0x2810a0);}};}function respondWithFilteredResult(_0x1e6eb9,_0x362fb5){return function(_0x481783){if(_0x481783){var _0x35542d=_0x481783[_0x00d7('0x1e')],_0x22fd47=_0x362fb5[_0x00d7('0x1f')],_0x46bba6=_0x362fb5[_0x00d7('0x1f')]+_0x362fb5[_0x00d7('0x20')],_0x167525;if(_0x46bba6>=_0x35542d){_0x46bba6=_0x35542d;_0x167525=0xc8;}else{_0x167525=0xce;}_0x1e6eb9[_0x00d7('0x1b')](_0x167525);return _0x1e6eb9[_0x00d7('0x21')](_0x00d7('0x22'),_0x22fd47+'-'+_0x46bba6+'/'+_0x35542d)[_0x00d7('0x1d')](_0x481783);}return null;};}function patchUpdates(_0x1f2dda){return function(_0x1e44e7){try{jsonpatch[_0x00d7('0x23')](_0x1e44e7,_0x1f2dda,!![]);}catch(_0x46f8e1){return BPromise['reject'](_0x46f8e1);}return _0x1e44e7[_0x00d7('0x24')]();};}function saveUpdates(_0x4dd728,_0x4a742b){return function(_0x3c80f4){if(_0x3c80f4){return _0x3c80f4[_0x00d7('0x25')](_0x4dd728)[_0x00d7('0x26')](function(_0x52bc44){return _0x52bc44;});}return null;};}function removeEntity(_0x23976f,_0x4e662){return function(_0x48f3f9){if(_0x48f3f9){return _0x48f3f9[_0x00d7('0x27')]()[_0x00d7('0x26')](function(){var _0x5c441e=_0x48f3f9['get']({'plain':!![]});var _0x4bfbce=_0x00d7('0x28');return db[_0x00d7('0x29')]['destroy']({'where':{'type':_0x4bfbce,'resourceId':_0x5c441e['id']}})[_0x00d7('0x26')](function(){return _0x48f3f9;});})[_0x00d7('0x26')](function(){_0x23976f['status'](0xcc)[_0x00d7('0x1c')]();});}};}function handleEntityNotFound(_0x507b66,_0x6eb9d4){return function(_0x538630){if(!_0x538630){_0x507b66[_0x00d7('0x1a')](0x194);}return _0x538630;};}function handleError(_0x177b97,_0x51f6bd){_0x51f6bd=_0x51f6bd||0x1f4;return function(_0x5e4d85){logger[_0x00d7('0x2a')](_0x5e4d85[_0x00d7('0x2b')]);if(_0x5e4d85[_0x00d7('0x2c')]){delete _0x5e4d85[_0x00d7('0x2c')];}_0x177b97['status'](_0x51f6bd)['send'](_0x5e4d85);};}exports[_0x00d7('0x2d')]=function(_0x372e89,_0x1467e0){var _0x5277cb={},_0x4001b7={},_0x276335={'count':0x0,'rows':[]};var _0x34c1c9=_[_0x00d7('0x2e')](db[_0x00d7('0x2f')]['rawAttributes'],function(_0x4850bc){return{'name':_0x4850bc[_0x00d7('0x30')],'type':_0x4850bc[_0x00d7('0x31')]['key']};});_0x4001b7[_0x00d7('0x32')]=_[_0x00d7('0x2e')](_0x34c1c9,_0x00d7('0x2c'));_0x4001b7['query']=_[_0x00d7('0x33')](_0x372e89['query']);_0x4001b7[_0x00d7('0x34')]=_[_0x00d7('0x35')](_0x4001b7[_0x00d7('0x32')],_0x4001b7[_0x00d7('0x36')]);_0x5277cb['attributes']=_[_0x00d7('0x35')](_0x4001b7[_0x00d7('0x32')],qs[_0x00d7('0x37')](_0x372e89[_0x00d7('0x36')][_0x00d7('0x37')]));_0x5277cb['attributes']=_0x5277cb[_0x00d7('0x38')][_0x00d7('0x39')]?_0x5277cb[_0x00d7('0x38')]:_0x4001b7[_0x00d7('0x32')];if(!_0x372e89[_0x00d7('0x36')]['hasOwnProperty']('nolimit')){_0x5277cb[_0x00d7('0x20')]=qs[_0x00d7('0x20')](_0x372e89['query'][_0x00d7('0x20')]);_0x5277cb[_0x00d7('0x1f')]=qs[_0x00d7('0x1f')](_0x372e89[_0x00d7('0x36')][_0x00d7('0x1f')]);}_0x5277cb[_0x00d7('0x3a')]=qs[_0x00d7('0x3b')](_0x372e89['query'][_0x00d7('0x3b')]);_0x5277cb[_0x00d7('0x3c')]=qs[_0x00d7('0x34')](_[_0x00d7('0x3d')](_0x372e89[_0x00d7('0x36')],_0x4001b7[_0x00d7('0x34')]),_0x34c1c9);if(_0x372e89[_0x00d7('0x36')][_0x00d7('0x3e')]){_0x5277cb[_0x00d7('0x3c')]=_[_0x00d7('0x3f')](_0x5277cb[_0x00d7('0x3c')],{'$or':_[_0x00d7('0x2e')](_0x34c1c9,function(_0x2465c8){if(_0x2465c8['type']!==_0x00d7('0x40')){var _0x2f3940={};_0x2f3940[_0x2465c8[_0x00d7('0x2c')]]={'$like':'%'+_0x372e89[_0x00d7('0x36')][_0x00d7('0x3e')]+'%'};return _0x2f3940;}})});}_0x5277cb=_[_0x00d7('0x3f')]({},_0x5277cb,_0x372e89[_0x00d7('0x41')]);var _0x196a6b={'where':_0x5277cb[_0x00d7('0x3c')]};return db[_0x00d7('0x2f')][_0x00d7('0x1e')](_0x196a6b)[_0x00d7('0x26')](function(_0x930134){_0x276335['count']=_0x930134;if(_0x372e89[_0x00d7('0x36')][_0x00d7('0x42')]){_0x5277cb[_0x00d7('0x43')]=[{'all':!![]}];}return db[_0x00d7('0x2f')][_0x00d7('0x44')](_0x5277cb);})[_0x00d7('0x26')](function(_0x2e9c90){_0x276335['rows']=_0x2e9c90;return _0x276335;})[_0x00d7('0x26')](respondWithFilteredResult(_0x1467e0,_0x5277cb))[_0x00d7('0x45')](handleError(_0x1467e0,null));};exports[_0x00d7('0x46')]=function(_0x388201,_0x1cd0a8){var _0xf8c146={'raw':!![],'where':{'id':_0x388201['params']['id']}},_0x13dc01={};_0x13dc01[_0x00d7('0x32')]=_[_0x00d7('0x33')](db[_0x00d7('0x2f')]['rawAttributes']);_0x13dc01['query']=_[_0x00d7('0x33')](_0x388201[_0x00d7('0x36')]);_0x13dc01[_0x00d7('0x34')]=_['intersection'](_0x13dc01[_0x00d7('0x32')],_0x13dc01[_0x00d7('0x36')]);_0xf8c146[_0x00d7('0x38')]=_[_0x00d7('0x35')](_0x13dc01[_0x00d7('0x32')],qs['fields'](_0x388201['query']['fields']));_0xf8c146['attributes']=_0xf8c146[_0x00d7('0x38')][_0x00d7('0x39')]?_0xf8c146[_0x00d7('0x38')]:_0x13dc01[_0x00d7('0x32')];if(_0x388201[_0x00d7('0x36')][_0x00d7('0x42')]){_0xf8c146['include']=[{'all':!![]}];}_0xf8c146=_[_0x00d7('0x3f')]({},_0xf8c146,_0x388201[_0x00d7('0x41')]);return db['CmContactHasItem'][_0x00d7('0x47')](_0xf8c146)[_0x00d7('0x26')](handleEntityNotFound(_0x1cd0a8,null))[_0x00d7('0x26')](respondWithResult(_0x1cd0a8,null))[_0x00d7('0x45')](handleError(_0x1cd0a8,null));};exports[_0x00d7('0x48')]=function(_0x3ec7df,_0x292199){return db['CmContactHasItem']['create'](_0x3ec7df[_0x00d7('0x49')],{})['then'](function(_0xe9daf9){var _0x102150=_0x3ec7df[_0x00d7('0x4a')][_0x00d7('0x4b')]({'plain':!![]});if(!_0x102150)throw new Error(_0x00d7('0x4c'));if(_0x102150[_0x00d7('0x4d')]===_0x00d7('0x4a')){var _0x3ea8ee=_0xe9daf9[_0x00d7('0x4b')]({'plain':!![]});var _0xa14313='CmContactHasItems';return db[_0x00d7('0x4e')][_0x00d7('0x47')]({'where':{'name':_0xa14313,'userProfileId':_0x102150[_0x00d7('0x4f')]},'raw':!![]})[_0x00d7('0x26')](function(_0x81b771){if(_0x81b771&&_0x81b771['autoAssociation']===0x0){return db[_0x00d7('0x29')][_0x00d7('0x48')]({'name':_0x3ea8ee[_0x00d7('0x2c')],'resourceId':_0x3ea8ee['id'],'type':_0x81b771['name'],'sectionId':_0x81b771['id']},{})['then'](function(){return _0xe9daf9;});}else{return _0xe9daf9;}})[_0x00d7('0x45')](function(_0x15b516){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15b516);throw _0x15b516;});}return _0xe9daf9;})[_0x00d7('0x26')](respondWithResult(_0x292199,0xc9))[_0x00d7('0x45')](handleError(_0x292199,null));};exports[_0x00d7('0x25')]=function(_0x5405e3,_0x54bda5){if(_0x5405e3[_0x00d7('0x49')]['id']){delete _0x5405e3['body']['id'];}return db[_0x00d7('0x2f')]['find']({'where':{'id':_0x5405e3['params']['id']}})[_0x00d7('0x26')](handleEntityNotFound(_0x54bda5,null))[_0x00d7('0x26')](saveUpdates(_0x5405e3[_0x00d7('0x49')],null))[_0x00d7('0x26')](respondWithResult(_0x54bda5,null))[_0x00d7('0x45')](handleError(_0x54bda5,null));};exports[_0x00d7('0x27')]=function(_0x3e5965,_0x482f2b){return db['CmContactHasItem']['find']({'where':{'id':_0x3e5965[_0x00d7('0x50')]['id']}})[_0x00d7('0x26')](handleEntityNotFound(_0x482f2b,null))[_0x00d7('0x26')](removeEntity(_0x482f2b,null))[_0x00d7('0x45')](handleError(_0x482f2b,null));}; \ No newline at end of file +var _0x00a2=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','save','update','then','CmContactHasItems','UserProfileResource','destroy','error','stack','name','index','map','CmContactHasItem','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x00a2,0xe1));var _0x200a=function(_0x9d1254,_0x5c3199){_0x9d1254=_0x9d1254-0x0;var _0x1e4b20=_0x00a2[_0x9d1254];return _0x1e4b20;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x200a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x200a('0x1'));var jsonpatch=require(_0x200a('0x2'));var rp=require(_0x200a('0x3'));var moment=require('moment');var BPromise=require(_0x200a('0x4'));var Mustache=require(_0x200a('0x5'));var util=require('util');var path=require(_0x200a('0x6'));var sox=require(_0x200a('0x7'));var csv=require('to-csv');var ejs=require(_0x200a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x200a('0x9'));var crypto=require(_0x200a('0xa'));var jsforce=require(_0x200a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x200a('0xc'));var Redis=require('ioredis');var authService=require(_0x200a('0xd'));var qs=require(_0x200a('0xe'));var as=require(_0x200a('0xf'));var hardwareService=require(_0x200a('0x10'));var logger=require(_0x200a('0x11'))(_0x200a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x98af2d,_0x577004){_0x577004=_0x577004||0xcc;return function(_0x41b47a){if(_0x41b47a){return _0x98af2d[_0x200a('0x13')](_0x577004);}return _0x98af2d[_0x200a('0x14')](_0x577004)[_0x200a('0x15')]();};}function respondWithResult(_0x1d2a94,_0x1206b1){_0x1206b1=_0x1206b1||0xc8;return function(_0x9f42d){if(_0x9f42d){return _0x1d2a94[_0x200a('0x14')](_0x1206b1)[_0x200a('0x16')](_0x9f42d);}};}function respondWithFilteredResult(_0xfe99e0,_0x247439){return function(_0x57a9db){if(_0x57a9db){var _0x16a22e=_0x57a9db[_0x200a('0x17')],_0x1d03c4=_0x247439['offset'],_0x4481a5=_0x247439[_0x200a('0x18')]+_0x247439[_0x200a('0x19')],_0x1c3cfe;if(_0x4481a5>=_0x16a22e){_0x4481a5=_0x16a22e;_0x1c3cfe=0xc8;}else{_0x1c3cfe=0xce;}_0xfe99e0[_0x200a('0x14')](_0x1c3cfe);return _0xfe99e0[_0x200a('0x1a')]('Content-Range',_0x1d03c4+'-'+_0x4481a5+'/'+_0x16a22e)[_0x200a('0x16')](_0x57a9db);}return null;};}function patchUpdates(_0x4dad8b){return function(_0x341c29){try{jsonpatch['apply'](_0x341c29,_0x4dad8b,!![]);}catch(_0x121866){return BPromise['reject'](_0x121866);}return _0x341c29[_0x200a('0x1b')]();};}function saveUpdates(_0x2452fa,_0x38686d){return function(_0x85e2e6){if(_0x85e2e6){return _0x85e2e6[_0x200a('0x1c')](_0x2452fa)[_0x200a('0x1d')](function(_0x5304af){return _0x5304af;});}return null;};}function removeEntity(_0x189f50,_0x1129cd){return function(_0x5497d1){if(_0x5497d1){return _0x5497d1['destroy']()[_0x200a('0x1d')](function(){var _0x259b92=_0x5497d1['get']({'plain':!![]});var _0x4801bf=_0x200a('0x1e');return db[_0x200a('0x1f')][_0x200a('0x20')]({'where':{'type':_0x4801bf,'resourceId':_0x259b92['id']}})[_0x200a('0x1d')](function(){return _0x5497d1;});})[_0x200a('0x1d')](function(){_0x189f50[_0x200a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5137ec,_0x2e2a4b){return function(_0x5a70b9){if(!_0x5a70b9){_0x5137ec[_0x200a('0x13')](0x194);}return _0x5a70b9;};}function handleError(_0x43957f,_0x5061da){_0x5061da=_0x5061da||0x1f4;return function(_0x50e612){logger[_0x200a('0x21')](_0x50e612[_0x200a('0x22')]);if(_0x50e612['name']){delete _0x50e612[_0x200a('0x23')];}_0x43957f[_0x200a('0x14')](_0x5061da)['send'](_0x50e612);};}exports[_0x200a('0x24')]=function(_0x4a3bf4,_0xda7370){var _0x5702cb={},_0x4fbd62={},_0x15c90a={'count':0x0,'rows':[]};var _0xea7ddd=_[_0x200a('0x25')](db[_0x200a('0x26')]['rawAttributes'],function(_0x313d78){return{'name':_0x313d78['fieldName'],'type':_0x313d78[_0x200a('0x27')][_0x200a('0x28')]};});_0x4fbd62[_0x200a('0x29')]=_[_0x200a('0x25')](_0xea7ddd,_0x200a('0x23'));_0x4fbd62['query']=_[_0x200a('0x2a')](_0x4a3bf4['query']);_0x4fbd62[_0x200a('0x2b')]=_[_0x200a('0x2c')](_0x4fbd62['model'],_0x4fbd62[_0x200a('0x2d')]);_0x5702cb[_0x200a('0x2e')]=_[_0x200a('0x2c')](_0x4fbd62['model'],qs['fields'](_0x4a3bf4[_0x200a('0x2d')]['fields']));_0x5702cb[_0x200a('0x2e')]=_0x5702cb['attributes'][_0x200a('0x2f')]?_0x5702cb[_0x200a('0x2e')]:_0x4fbd62[_0x200a('0x29')];if(!_0x4a3bf4[_0x200a('0x2d')][_0x200a('0x30')]('nolimit')){_0x5702cb[_0x200a('0x19')]=qs['limit'](_0x4a3bf4[_0x200a('0x2d')][_0x200a('0x19')]);_0x5702cb[_0x200a('0x18')]=qs[_0x200a('0x18')](_0x4a3bf4[_0x200a('0x2d')][_0x200a('0x18')]);}_0x5702cb[_0x200a('0x31')]=qs[_0x200a('0x32')](_0x4a3bf4[_0x200a('0x2d')][_0x200a('0x32')]);_0x5702cb[_0x200a('0x33')]=qs[_0x200a('0x2b')](_['pick'](_0x4a3bf4['query'],_0x4fbd62[_0x200a('0x2b')]),_0xea7ddd);if(_0x4a3bf4['query'][_0x200a('0x34')]){_0x5702cb['where']=_[_0x200a('0x35')](_0x5702cb['where'],{'$or':_['map'](_0xea7ddd,function(_0x3a0985){if(_0x3a0985[_0x200a('0x27')]!==_0x200a('0x36')){var _0x3a8801={};_0x3a8801[_0x3a0985[_0x200a('0x23')]]={'$like':'%'+_0x4a3bf4[_0x200a('0x2d')][_0x200a('0x34')]+'%'};return _0x3a8801;}})});}_0x5702cb=_['merge']({},_0x5702cb,_0x4a3bf4[_0x200a('0x37')]);var _0x7001c7={'where':_0x5702cb[_0x200a('0x33')]};return db[_0x200a('0x26')][_0x200a('0x17')](_0x7001c7)[_0x200a('0x1d')](function(_0x27b0b9){_0x15c90a['count']=_0x27b0b9;if(_0x4a3bf4['query'][_0x200a('0x38')]){_0x5702cb[_0x200a('0x39')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x200a('0x3a')](_0x5702cb);})['then'](function(_0x1503f7){_0x15c90a[_0x200a('0x3b')]=_0x1503f7;return _0x15c90a;})[_0x200a('0x1d')](respondWithFilteredResult(_0xda7370,_0x5702cb))[_0x200a('0x3c')](handleError(_0xda7370,null));};exports[_0x200a('0x3d')]=function(_0x2bea85,_0x17bf5b){var _0x64caba={'raw':!![],'where':{'id':_0x2bea85['params']['id']}},_0x2c54de={};_0x2c54de[_0x200a('0x29')]=_[_0x200a('0x2a')](db[_0x200a('0x26')][_0x200a('0x3e')]);_0x2c54de[_0x200a('0x2d')]=_[_0x200a('0x2a')](_0x2bea85[_0x200a('0x2d')]);_0x2c54de[_0x200a('0x2b')]=_[_0x200a('0x2c')](_0x2c54de['model'],_0x2c54de[_0x200a('0x2d')]);_0x64caba[_0x200a('0x2e')]=_[_0x200a('0x2c')](_0x2c54de[_0x200a('0x29')],qs[_0x200a('0x3f')](_0x2bea85[_0x200a('0x2d')][_0x200a('0x3f')]));_0x64caba[_0x200a('0x2e')]=_0x64caba['attributes'][_0x200a('0x2f')]?_0x64caba[_0x200a('0x2e')]:_0x2c54de[_0x200a('0x29')];if(_0x2bea85[_0x200a('0x2d')][_0x200a('0x38')]){_0x64caba[_0x200a('0x39')]=[{'all':!![]}];}_0x64caba=_[_0x200a('0x35')]({},_0x64caba,_0x2bea85[_0x200a('0x37')]);return db[_0x200a('0x26')][_0x200a('0x40')](_0x64caba)[_0x200a('0x1d')](handleEntityNotFound(_0x17bf5b,null))['then'](respondWithResult(_0x17bf5b,null))[_0x200a('0x3c')](handleError(_0x17bf5b,null));};exports['create']=function(_0x35b14e,_0x33037c){return db[_0x200a('0x26')][_0x200a('0x41')](_0x35b14e[_0x200a('0x42')],{})[_0x200a('0x1d')](function(_0x4c1fec){var _0x5eb238=_0x35b14e[_0x200a('0x43')]['get']({'plain':!![]});if(!_0x5eb238)throw new Error(_0x200a('0x44'));if(_0x5eb238[_0x200a('0x45')]===_0x200a('0x43')){var _0x49d78b=_0x4c1fec['get']({'plain':!![]});var _0x5e5f9a=_0x200a('0x1e');return db[_0x200a('0x46')][_0x200a('0x40')]({'where':{'name':_0x5e5f9a,'userProfileId':_0x5eb238[_0x200a('0x47')]},'raw':!![]})[_0x200a('0x1d')](function(_0x3113ec){if(_0x3113ec&&_0x3113ec['autoAssociation']===0x0){return db[_0x200a('0x1f')][_0x200a('0x41')]({'name':_0x49d78b[_0x200a('0x23')],'resourceId':_0x49d78b['id'],'type':_0x3113ec[_0x200a('0x23')],'sectionId':_0x3113ec['id']},{})[_0x200a('0x1d')](function(){return _0x4c1fec;});}else{return _0x4c1fec;}})['catch'](function(_0x5649e5){logger['error'](_0x200a('0x48'),_0x5649e5);throw _0x5649e5;});}return _0x4c1fec;})[_0x200a('0x1d')](respondWithResult(_0x33037c,0xc9))[_0x200a('0x3c')](handleError(_0x33037c,null));};exports[_0x200a('0x1c')]=function(_0x4bc731,_0x490f3a){if(_0x4bc731[_0x200a('0x42')]['id']){delete _0x4bc731[_0x200a('0x42')]['id'];}return db[_0x200a('0x26')][_0x200a('0x40')]({'where':{'id':_0x4bc731[_0x200a('0x49')]['id']}})[_0x200a('0x1d')](handleEntityNotFound(_0x490f3a,null))[_0x200a('0x1d')](saveUpdates(_0x4bc731[_0x200a('0x42')],null))[_0x200a('0x1d')](respondWithResult(_0x490f3a,null))[_0x200a('0x3c')](handleError(_0x490f3a,null));};exports['destroy']=function(_0x260987,_0x589391){return db[_0x200a('0x26')][_0x200a('0x40')]({'where':{'id':_0x260987[_0x200a('0x49')]['id']}})[_0x200a('0x1d')](handleEntityNotFound(_0x589391,null))['then'](removeEntity(_0x589391,null))[_0x200a('0x3c')](handleError(_0x589391,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6d92335..9aecf9c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fd4=['rimraf','exports','define','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x434323,_0x584fd5){_0x434323=_0x434323-0x0;var _0x2da586=_0x9fd4[_0x434323];return _0x2da586;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('CmContactHasItem',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['define','CmContactHasItem','cm_contact_has_items','util','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x2841f6,_0x45c4d9){var _0x1fddbf=function(_0x3656cb){while(--_0x3656cb){_0x2841f6['push'](_0x2841f6['shift']());}};_0x1fddbf(++_0x45c4d9);}(_0x8958,0x93));var _0x8895=function(_0x4809dd,_0x2719e4){_0x4809dd=_0x4809dd-0x0;var _0x4896d5=_0x8958[_0x4809dd];return _0x4896d5;};'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 diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 87c1f2c..b2593cd 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88c8=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','util'];(function(_0x4fe089,_0x47df90){var _0x569773=function(_0x4a2e32){while(--_0x4a2e32){_0x4fe089['push'](_0x4fe089['shift']());}};_0x569773(++_0x47df90);}(_0x88c8,0x117));var _0x888c=function(_0x357e36,_0x20fe03){_0x357e36=_0x357e36-0x0;var _0x3719c7=_0x88c8[_0x357e36];return _0x3719c7;};'use strict';var _=require('lodash');var util=require(_0x888c('0x0'));var moment=require(_0x888c('0x1'));var BPromise=require(_0x888c('0x2'));var rs=require(_0x888c('0x3'));var fs=require('fs');var Redis=require(_0x888c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x888c('0x5'));var logger=require(_0x888c('0x6'))(_0x888c('0x7'));var config=require(_0x888c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x888c('0x9')][_0x888c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x189cf5,_0x5699e7,_0x4da573){return new BPromise(function(_0x3ac570,_0x29c993){return client[_0x888c('0xb')](_0x189cf5,_0x4da573)[_0x888c('0xc')](function(_0x55d706){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x5699e7,'request\x20sent');logger[_0x888c('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5699e7,_0x888c('0xe'),JSON[_0x888c('0xf')](_0x55d706));if(_0x55d706['error']){if(_0x55d706[_0x888c('0x10')][_0x888c('0x11')]===0x1f4){logger['error'](_0x888c('0x12'),_0x5699e7,_0x55d706[_0x888c('0x10')]['message']);return _0x29c993(_0x55d706[_0x888c('0x10')][_0x888c('0x13')]);}logger[_0x888c('0x10')](_0x888c('0x12'),_0x5699e7,_0x55d706[_0x888c('0x10')][_0x888c('0x13')]);return _0x3ac570(_0x55d706[_0x888c('0x10')][_0x888c('0x13')]);}else{logger['info'](_0x888c('0x12'),_0x5699e7,_0x888c('0xe'));_0x3ac570(_0x55d706['result'][_0x888c('0x13')]);}})['catch'](function(_0x412629){logger['error'](_0x888c('0x12'),_0x5699e7,_0x412629);_0x29c993(_0x412629);});});} \ No newline at end of file +var _0x4b26=['client','http','request','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','CmContactHasItem,\x20%s,\x20%s','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xe01bbb,_0x397c42){var _0x110842=function(_0x14c226){while(--_0x14c226){_0xe01bbb['push'](_0xe01bbb['shift']());}};_0x110842(++_0x397c42);}(_0x4b26,0xa6));var _0x64b2=function(_0x2ede95,_0x1182f6){_0x2ede95=_0x2ede95-0x0;var _0x5dbea9=_0x4b26[_0x2ede95];return _0x5dbea9;};'use strict';var _=require(_0x64b2('0x0'));var util=require(_0x64b2('0x1'));var moment=require('moment');var BPromise=require(_0x64b2('0x2'));var rs=require(_0x64b2('0x3'));var fs=require('fs');var Redis=require(_0x64b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64b2('0x5'));var logger=require(_0x64b2('0x6'))(_0x64b2('0x7'));var config=require(_0x64b2('0x8'));var jayson=require(_0x64b2('0x9'));var client=jayson[_0x64b2('0xa')][_0x64b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x386e56,_0x278e8c,_0x295d2b){return new BPromise(function(_0x48f146,_0x5c8aa1){return client[_0x64b2('0xc')](_0x386e56,_0x295d2b)['then'](function(_0x9abc0e){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x278e8c,_0x64b2('0xd'));logger[_0x64b2('0xe')](_0x64b2('0xf'),_0x278e8c,_0x64b2('0xd'),JSON[_0x64b2('0x10')](_0x9abc0e));if(_0x9abc0e[_0x64b2('0x11')]){if(_0x9abc0e[_0x64b2('0x11')]['code']===0x1f4){logger[_0x64b2('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x278e8c,_0x9abc0e[_0x64b2('0x11')][_0x64b2('0x12')]);return _0x5c8aa1(_0x9abc0e[_0x64b2('0x11')][_0x64b2('0x12')]);}logger[_0x64b2('0x11')](_0x64b2('0x13'),_0x278e8c,_0x9abc0e[_0x64b2('0x11')][_0x64b2('0x12')]);return _0x48f146(_0x9abc0e['error'][_0x64b2('0x12')]);}else{logger[_0x64b2('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x278e8c,_0x64b2('0xd'));_0x48f146(_0x9abc0e['result'][_0x64b2('0x12')]);}})[_0x64b2('0x15')](function(_0x57bad8){logger['error'](_0x64b2('0x13'),_0x278e8c,_0x57bad8);_0x5c8aa1(_0x57bad8);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 906d540..b9c434f 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85c5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x233344,_0x1a283a){var _0x2a0542=function(_0x312fac){while(--_0x312fac){_0x233344['push'](_0x233344['shift']());}};_0x2a0542(++_0x1a283a);}(_0x85c5,0x179));var _0x585c=function(_0x338915,_0x245d4d){_0x338915=_0x338915-0x0;var _0x67c9e7=_0x85c5[_0x338915];return _0x67c9e7;};'use strict';var multer=require(_0x585c('0x0'));var util=require(_0x585c('0x1'));var path=require(_0x585c('0x2'));var timeout=require(_0x585c('0x3'));var express=require(_0x585c('0x4'));var router=express[_0x585c('0x5')]();var auth=require(_0x585c('0x6'));var interaction=require(_0x585c('0x7'));var config=require(_0x585c('0x8'));var controller=require(_0x585c('0x9'));router[_0x585c('0xa')]('/',auth['isAuthenticated'](),controller[_0x585c('0xb')]);router[_0x585c('0xa')](_0x585c('0xc'),auth[_0x585c('0xd')](),controller['show']);router[_0x585c('0xe')]('/',auth[_0x585c('0xd')](),controller[_0x585c('0xf')]);router['put'](_0x585c('0xc'),auth[_0x585c('0xd')](),controller[_0x585c('0x10')]);router[_0x585c('0x11')](_0x585c('0xc'),auth['isAuthenticated'](),controller[_0x585c('0x12')]);module[_0x585c('0x13')]=router; \ No newline at end of file +var _0xdc2c=['/:id','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0xdf82b5,_0x5e4ef8){var _0x371da2=function(_0x55d76b){while(--_0x55d76b){_0xdf82b5['push'](_0xdf82b5['shift']());}};_0x371da2(++_0x5e4ef8);}(_0xdc2c,0x1f2));var _0xcdc2=function(_0x344e99,_0x530098){_0x344e99=_0x344e99-0x0;var _0x172d28=_0xdc2c[_0x344e99];return _0x172d28;};'use strict';var multer=require(_0xcdc2('0x0'));var util=require(_0xcdc2('0x1'));var path=require(_0xcdc2('0x2'));var timeout=require(_0xcdc2('0x3'));var express=require(_0xcdc2('0x4'));var router=express[_0xcdc2('0x5')]();var auth=require(_0xcdc2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcdc2('0x7'));var controller=require(_0xcdc2('0x8'));router[_0xcdc2('0x9')]('/',auth[_0xcdc2('0xa')](),controller[_0xcdc2('0xb')]);router[_0xcdc2('0x9')](_0xcdc2('0xc'),auth[_0xcdc2('0xa')](),controller['show']);router[_0xcdc2('0xd')]('/',auth[_0xcdc2('0xa')](),controller[_0xcdc2('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xcdc2('0xc'),auth[_0xcdc2('0xa')](),controller[_0xcdc2('0xf')]);module[_0xcdc2('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 00c8af2..5543e82 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfee3=['STRING','sequelize','exports','INTEGER'];(function(_0x2a5d13,_0x1ebd4f){var _0x5b859e=function(_0x21c77b){while(--_0x21c77b){_0x2a5d13['push'](_0x2a5d13['shift']());}};_0x5b859e(++_0x1ebd4f);}(_0xfee3,0x111));var _0x3fee=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xfee3[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x3fee('0x0'));module[_0x3fee('0x1')]={'CmContactId':{'type':Sequelize[_0x3fee('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x3fee('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xb0e3=['exports','INTEGER','STRING','sequelize'];(function(_0x271925,_0x1b02ce){var _0x522199=function(_0x5a722f){while(--_0x5a722f){_0x271925['push'](_0x271925['shift']());}};_0x522199(++_0x1b02ce);}(_0xb0e3,0x113));var _0x3b0e=function(_0x23a22e,_0x14249e){_0x23a22e=_0x23a22e-0x0;var _0x170087=_0xb0e3[_0x23a22e];return _0x170087;};'use strict';var Sequelize=require(_0x3b0e('0x0'));module[_0x3b0e('0x1')]={'CmContactId':{'type':Sequelize[_0x3b0e('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x3b0e('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 304dd4f..0a2442a 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16ff=['pick','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasPhones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','get','UserProfileResource','destroy','error','name','index','CmContactHasPhone','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where'];(function(_0x28e502,_0x3e36c5){var _0x2fd662=function(_0x35cb6a){while(--_0x35cb6a){_0x28e502['push'](_0x28e502['shift']());}};_0x2fd662(++_0x3e36c5);}(_0x16ff,0x186));var _0xf16f=function(_0x1df467,_0x3839b3){_0x1df467=_0x1df467-0x0;var _0x30cfff=_0x16ff[_0x1df467];return _0x30cfff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf16f('0x0'));var rimraf=require(_0xf16f('0x1'));var zipdir=require(_0xf16f('0x2'));var jsonpatch=require(_0xf16f('0x3'));var rp=require('request-promise');var moment=require(_0xf16f('0x4'));var BPromise=require(_0xf16f('0x5'));var Mustache=require(_0xf16f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf16f('0x7'));var ejs=require(_0xf16f('0x8'));var fs=require('fs');var _=require(_0xf16f('0x9'));var squel=require(_0xf16f('0xa'));var crypto=require(_0xf16f('0xb'));var jsforce=require(_0xf16f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf16f('0xd'));var Papa=require(_0xf16f('0xe'));var Redis=require(_0xf16f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf16f('0x10'));var hardwareService=require(_0xf16f('0x11'));var logger=require(_0xf16f('0x12'))('api');var utils=require(_0xf16f('0x13'));var config=require('../../config/environment');var db=require(_0xf16f('0x14'))['db'];function respondWithStatusCode(_0x5a4464,_0xba5fee){_0xba5fee=_0xba5fee||0xcc;return function(_0x542433){if(_0x542433){return _0x5a4464[_0xf16f('0x15')](_0xba5fee);}return _0x5a4464[_0xf16f('0x16')](_0xba5fee)['end']();};}function respondWithResult(_0xadfd1c,_0x5c334c){_0x5c334c=_0x5c334c||0xc8;return function(_0x31e9ef){if(_0x31e9ef){return _0xadfd1c['status'](_0x5c334c)[_0xf16f('0x17')](_0x31e9ef);}};}function respondWithFilteredResult(_0x1359a2,_0x63171){return function(_0x5cdf8b){if(_0x5cdf8b){var _0x249800=_0x5cdf8b[_0xf16f('0x18')],_0x942dd=_0x63171[_0xf16f('0x19')],_0x217e34=_0x63171[_0xf16f('0x19')]+_0x63171[_0xf16f('0x1a')],_0x1decae;if(_0x217e34>=_0x249800){_0x217e34=_0x249800;_0x1decae=0xc8;}else{_0x1decae=0xce;}_0x1359a2[_0xf16f('0x16')](_0x1decae);return _0x1359a2[_0xf16f('0x1b')]('Content-Range',_0x942dd+'-'+_0x217e34+'/'+_0x249800)[_0xf16f('0x17')](_0x5cdf8b);}return null;};}function patchUpdates(_0x27275d){return function(_0x57d0fd){try{jsonpatch[_0xf16f('0x1c')](_0x57d0fd,_0x27275d,!![]);}catch(_0x372736){return BPromise[_0xf16f('0x1d')](_0x372736);}return _0x57d0fd['save']();};}function saveUpdates(_0x5a328b,_0x57a464){return function(_0x546c54){if(_0x546c54){return _0x546c54[_0xf16f('0x1e')](_0x5a328b)[_0xf16f('0x1f')](function(_0x30153a){return _0x30153a;});}return null;};}function removeEntity(_0x17a75e,_0x32b696){return function(_0x45a43d){if(_0x45a43d){return _0x45a43d['destroy']()[_0xf16f('0x1f')](function(){var _0x5cbd10=_0x45a43d[_0xf16f('0x20')]({'plain':!![]});var _0xc8e3e7='CmContactHasPhones';return db[_0xf16f('0x21')][_0xf16f('0x22')]({'where':{'type':_0xc8e3e7,'resourceId':_0x5cbd10['id']}})[_0xf16f('0x1f')](function(){return _0x45a43d;});})[_0xf16f('0x1f')](function(){_0x17a75e[_0xf16f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3715c0,_0x2ef691){return function(_0x142723){if(!_0x142723){_0x3715c0['sendStatus'](0x194);}return _0x142723;};}function handleError(_0x576d73,_0x1edfe8){_0x1edfe8=_0x1edfe8||0x1f4;return function(_0x369355){logger[_0xf16f('0x23')](_0x369355['stack']);if(_0x369355[_0xf16f('0x24')]){delete _0x369355[_0xf16f('0x24')];}_0x576d73[_0xf16f('0x16')](_0x1edfe8)['send'](_0x369355);};}exports[_0xf16f('0x25')]=function(_0x3682a5,_0x2439d4){var _0x3ca6d8={},_0x41dc9b={},_0x441913={'count':0x0,'rows':[]};var _0x18abf1=_['map'](db[_0xf16f('0x26')][_0xf16f('0x27')],function(_0x45f20b){return{'name':_0x45f20b[_0xf16f('0x28')],'type':_0x45f20b['type'][_0xf16f('0x29')]};});_0x41dc9b[_0xf16f('0x2a')]=_[_0xf16f('0x2b')](_0x18abf1,_0xf16f('0x24'));_0x41dc9b[_0xf16f('0x2c')]=_[_0xf16f('0x2d')](_0x3682a5[_0xf16f('0x2c')]);_0x41dc9b[_0xf16f('0x2e')]=_[_0xf16f('0x2f')](_0x41dc9b['model'],_0x41dc9b['query']);_0x3ca6d8[_0xf16f('0x30')]=_['intersection'](_0x41dc9b['model'],qs[_0xf16f('0x31')](_0x3682a5['query'][_0xf16f('0x31')]));_0x3ca6d8[_0xf16f('0x30')]=_0x3ca6d8[_0xf16f('0x30')][_0xf16f('0x32')]?_0x3ca6d8[_0xf16f('0x30')]:_0x41dc9b[_0xf16f('0x2a')];if(!_0x3682a5[_0xf16f('0x2c')]['hasOwnProperty'](_0xf16f('0x33'))){_0x3ca6d8['limit']=qs['limit'](_0x3682a5['query'][_0xf16f('0x1a')]);_0x3ca6d8[_0xf16f('0x19')]=qs[_0xf16f('0x19')](_0x3682a5[_0xf16f('0x2c')]['offset']);}_0x3ca6d8['order']=qs[_0xf16f('0x34')](_0x3682a5[_0xf16f('0x2c')]['sort']);_0x3ca6d8[_0xf16f('0x35')]=qs[_0xf16f('0x2e')](_[_0xf16f('0x36')](_0x3682a5[_0xf16f('0x2c')],_0x41dc9b[_0xf16f('0x2e')]),_0x18abf1);if(_0x3682a5[_0xf16f('0x2c')]['filter']){_0x3ca6d8['where']=_[_0xf16f('0x37')](_0x3ca6d8[_0xf16f('0x35')],{'$or':_[_0xf16f('0x2b')](_0x18abf1,function(_0x13954a){if(_0x13954a['type']!==_0xf16f('0x38')){var _0x11ea47={};_0x11ea47[_0x13954a[_0xf16f('0x24')]]={'$like':'%'+_0x3682a5['query']['filter']+'%'};return _0x11ea47;}})});}_0x3ca6d8=_[_0xf16f('0x37')]({},_0x3ca6d8,_0x3682a5['options']);var _0x1c3c9f={'where':_0x3ca6d8[_0xf16f('0x35')]};return db[_0xf16f('0x26')][_0xf16f('0x18')](_0x1c3c9f)['then'](function(_0x29ab6e){_0x441913[_0xf16f('0x18')]=_0x29ab6e;if(_0x3682a5[_0xf16f('0x2c')]['includeAll']){_0x3ca6d8[_0xf16f('0x39')]=[{'all':!![]}];}return db[_0xf16f('0x26')][_0xf16f('0x3a')](_0x3ca6d8);})[_0xf16f('0x1f')](function(_0x153118){_0x441913[_0xf16f('0x3b')]=_0x153118;return _0x441913;})['then'](respondWithFilteredResult(_0x2439d4,_0x3ca6d8))[_0xf16f('0x3c')](handleError(_0x2439d4,null));};exports['show']=function(_0x59b40f,_0x31528d){var _0x35bf26={'raw':!![],'where':{'id':_0x59b40f[_0xf16f('0x3d')]['id']}},_0x10fe5f={};_0x10fe5f[_0xf16f('0x2a')]=_[_0xf16f('0x2d')](db[_0xf16f('0x26')][_0xf16f('0x27')]);_0x10fe5f['query']=_[_0xf16f('0x2d')](_0x59b40f['query']);_0x10fe5f[_0xf16f('0x2e')]=_[_0xf16f('0x2f')](_0x10fe5f['model'],_0x10fe5f['query']);_0x35bf26[_0xf16f('0x30')]=_[_0xf16f('0x2f')](_0x10fe5f[_0xf16f('0x2a')],qs[_0xf16f('0x31')](_0x59b40f[_0xf16f('0x2c')][_0xf16f('0x31')]));_0x35bf26[_0xf16f('0x30')]=_0x35bf26['attributes'][_0xf16f('0x32')]?_0x35bf26['attributes']:_0x10fe5f[_0xf16f('0x2a')];if(_0x59b40f[_0xf16f('0x2c')][_0xf16f('0x3e')]){_0x35bf26[_0xf16f('0x39')]=[{'all':!![]}];}_0x35bf26=_[_0xf16f('0x37')]({},_0x35bf26,_0x59b40f[_0xf16f('0x3f')]);return db[_0xf16f('0x26')][_0xf16f('0x40')](_0x35bf26)['then'](handleEntityNotFound(_0x31528d,null))[_0xf16f('0x1f')](respondWithResult(_0x31528d,null))[_0xf16f('0x3c')](handleError(_0x31528d,null));};exports[_0xf16f('0x41')]=function(_0x59d74e,_0x117d69){return db[_0xf16f('0x26')][_0xf16f('0x41')](_0x59d74e[_0xf16f('0x42')],{})[_0xf16f('0x1f')](function(_0x4860d4){var _0x4d0d1b=_0x59d74e[_0xf16f('0x43')][_0xf16f('0x20')]({'plain':!![]});if(!_0x4d0d1b)throw new Error(_0xf16f('0x44'));if(_0x4d0d1b[_0xf16f('0x45')]===_0xf16f('0x43')){var _0x3d6184=_0x4860d4[_0xf16f('0x20')]({'plain':!![]});var _0x51c0b1=_0xf16f('0x46');return db[_0xf16f('0x47')][_0xf16f('0x40')]({'where':{'name':_0x51c0b1,'userProfileId':_0x4d0d1b[_0xf16f('0x48')]},'raw':!![]})[_0xf16f('0x1f')](function(_0x51f62d){if(_0x51f62d&&_0x51f62d['autoAssociation']===0x0){return db[_0xf16f('0x21')][_0xf16f('0x41')]({'name':_0x3d6184['name'],'resourceId':_0x3d6184['id'],'type':_0x51f62d[_0xf16f('0x24')],'sectionId':_0x51f62d['id']},{})[_0xf16f('0x1f')](function(){return _0x4860d4;});}else{return _0x4860d4;}})[_0xf16f('0x3c')](function(_0x5a3fa7){logger[_0xf16f('0x23')](_0xf16f('0x49'),_0x5a3fa7);throw _0x5a3fa7;});}return _0x4860d4;})[_0xf16f('0x1f')](respondWithResult(_0x117d69,0xc9))[_0xf16f('0x3c')](handleError(_0x117d69,null));};exports[_0xf16f('0x1e')]=function(_0x3d4d89,_0x31ddad){if(_0x3d4d89[_0xf16f('0x42')]['id']){delete _0x3d4d89['body']['id'];}return db[_0xf16f('0x26')][_0xf16f('0x40')]({'where':{'id':_0x3d4d89['params']['id']}})[_0xf16f('0x1f')](handleEntityNotFound(_0x31ddad,null))[_0xf16f('0x1f')](saveUpdates(_0x3d4d89['body'],null))['then'](respondWithResult(_0x31ddad,null))['catch'](handleError(_0x31ddad,null));};exports['destroy']=function(_0x2a78e5,_0x17b0f4){return db['CmContactHasPhone']['find']({'where':{'id':_0x2a78e5[_0xf16f('0x3d')]['id']}})[_0xf16f('0x1f')](handleEntityNotFound(_0x17b0f4,null))['then'](removeEntity(_0x17b0f4,null))[_0xf16f('0x3c')](handleError(_0x17b0f4,null));}; \ No newline at end of file +var _0xb888=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb888,0x12c));var _0x8b88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb888[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x8b88('0x0'));var emlformat=require(_0x8b88('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b88('0x2'));var moment=require('moment');var BPromise=require(_0x8b88('0x3'));var Mustache=require(_0x8b88('0x4'));var util=require(_0x8b88('0x5'));var path=require(_0x8b88('0x6'));var sox=require(_0x8b88('0x7'));var csv=require(_0x8b88('0x8'));var ejs=require(_0x8b88('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b88('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8b88('0xb'));var Papa=require('papaparse');var Redis=require(_0x8b88('0xc'));var authService=require(_0x8b88('0xd'));var qs=require(_0x8b88('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b88('0xf'));var logger=require(_0x8b88('0x10'))(_0x8b88('0x11'));var utils=require(_0x8b88('0x12'));var config=require(_0x8b88('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11778c,_0xa699cf){_0xa699cf=_0xa699cf||0xcc;return function(_0x1dc7fa){if(_0x1dc7fa){return _0x11778c[_0x8b88('0x14')](_0xa699cf);}return _0x11778c[_0x8b88('0x15')](_0xa699cf)[_0x8b88('0x16')]();};}function respondWithResult(_0x5b9b8e,_0x235f1a){_0x235f1a=_0x235f1a||0xc8;return function(_0x33169a){if(_0x33169a){return _0x5b9b8e[_0x8b88('0x15')](_0x235f1a)[_0x8b88('0x17')](_0x33169a);}};}function respondWithFilteredResult(_0x4430db,_0x57c56d){return function(_0x25b9ae){if(_0x25b9ae){var _0xc60597=_0x25b9ae['count'],_0x212e54=_0x57c56d[_0x8b88('0x18')],_0x551b19=_0x57c56d['offset']+_0x57c56d[_0x8b88('0x19')],_0x225660;if(_0x551b19>=_0xc60597){_0x551b19=_0xc60597;_0x225660=0xc8;}else{_0x225660=0xce;}_0x4430db[_0x8b88('0x15')](_0x225660);return _0x4430db[_0x8b88('0x1a')](_0x8b88('0x1b'),_0x212e54+'-'+_0x551b19+'/'+_0xc60597)[_0x8b88('0x17')](_0x25b9ae);}return null;};}function patchUpdates(_0x2eefe5){return function(_0x353e95){try{jsonpatch['apply'](_0x353e95,_0x2eefe5,!![]);}catch(_0x2b076f){return BPromise[_0x8b88('0x1c')](_0x2b076f);}return _0x353e95[_0x8b88('0x1d')]();};}function saveUpdates(_0x38f4eb,_0x35ef12){return function(_0x50d3df){if(_0x50d3df){return _0x50d3df[_0x8b88('0x1e')](_0x38f4eb)[_0x8b88('0x1f')](function(_0x5f1cc1){return _0x5f1cc1;});}return null;};}function removeEntity(_0x170b9a,_0x1c3fe6){return function(_0x554ac9){if(_0x554ac9){return _0x554ac9['destroy']()[_0x8b88('0x1f')](function(){var _0x2567ac=_0x554ac9[_0x8b88('0x20')]({'plain':!![]});var _0x46b902='CmContactHasPhones';return db[_0x8b88('0x21')][_0x8b88('0x22')]({'where':{'type':_0x46b902,'resourceId':_0x2567ac['id']}})[_0x8b88('0x1f')](function(){return _0x554ac9;});})['then'](function(){_0x170b9a['status'](0xcc)[_0x8b88('0x16')]();});}};}function handleEntityNotFound(_0x32ff81,_0xea1fb9){return function(_0x43bb1b){if(!_0x43bb1b){_0x32ff81[_0x8b88('0x14')](0x194);}return _0x43bb1b;};}function handleError(_0x2ce0ff,_0x5940e9){_0x5940e9=_0x5940e9||0x1f4;return function(_0xc938df){logger[_0x8b88('0x23')](_0xc938df[_0x8b88('0x24')]);if(_0xc938df[_0x8b88('0x25')]){delete _0xc938df[_0x8b88('0x25')];}_0x2ce0ff[_0x8b88('0x15')](_0x5940e9)[_0x8b88('0x26')](_0xc938df);};}exports[_0x8b88('0x27')]=function(_0x4f28fc,_0x374826){var _0x40b38c={},_0x3605d8={},_0x3e5d1d={'count':0x0,'rows':[]};var _0xfe7559=_[_0x8b88('0x28')](db[_0x8b88('0x29')][_0x8b88('0x2a')],function(_0x2162d){return{'name':_0x2162d['fieldName'],'type':_0x2162d[_0x8b88('0x2b')]['key']};});_0x3605d8[_0x8b88('0x2c')]=_[_0x8b88('0x28')](_0xfe7559,_0x8b88('0x25'));_0x3605d8[_0x8b88('0x2d')]=_['keys'](_0x4f28fc[_0x8b88('0x2d')]);_0x3605d8[_0x8b88('0x2e')]=_['intersection'](_0x3605d8['model'],_0x3605d8[_0x8b88('0x2d')]);_0x40b38c['attributes']=_[_0x8b88('0x2f')](_0x3605d8[_0x8b88('0x2c')],qs[_0x8b88('0x30')](_0x4f28fc['query'][_0x8b88('0x30')]));_0x40b38c['attributes']=_0x40b38c[_0x8b88('0x31')][_0x8b88('0x32')]?_0x40b38c[_0x8b88('0x31')]:_0x3605d8['model'];if(!_0x4f28fc['query'][_0x8b88('0x33')](_0x8b88('0x34'))){_0x40b38c[_0x8b88('0x19')]=qs[_0x8b88('0x19')](_0x4f28fc['query'][_0x8b88('0x19')]);_0x40b38c[_0x8b88('0x18')]=qs['offset'](_0x4f28fc[_0x8b88('0x2d')][_0x8b88('0x18')]);}_0x40b38c[_0x8b88('0x35')]=qs[_0x8b88('0x36')](_0x4f28fc[_0x8b88('0x2d')]['sort']);_0x40b38c[_0x8b88('0x37')]=qs[_0x8b88('0x2e')](_['pick'](_0x4f28fc['query'],_0x3605d8['filters']),_0xfe7559);if(_0x4f28fc[_0x8b88('0x2d')][_0x8b88('0x38')]){_0x40b38c[_0x8b88('0x37')]=_[_0x8b88('0x39')](_0x40b38c['where'],{'$or':_[_0x8b88('0x28')](_0xfe7559,function(_0x1010d5){if(_0x1010d5[_0x8b88('0x2b')]!==_0x8b88('0x3a')){var _0x2e3227={};_0x2e3227[_0x1010d5[_0x8b88('0x25')]]={'$like':'%'+_0x4f28fc[_0x8b88('0x2d')][_0x8b88('0x38')]+'%'};return _0x2e3227;}})});}_0x40b38c=_['merge']({},_0x40b38c,_0x4f28fc[_0x8b88('0x3b')]);var _0x6e6aad={'where':_0x40b38c[_0x8b88('0x37')]};return db[_0x8b88('0x29')][_0x8b88('0x3c')](_0x6e6aad)[_0x8b88('0x1f')](function(_0x188ff9){_0x3e5d1d[_0x8b88('0x3c')]=_0x188ff9;if(_0x4f28fc['query'][_0x8b88('0x3d')]){_0x40b38c['include']=[{'all':!![]}];}return db[_0x8b88('0x29')][_0x8b88('0x3e')](_0x40b38c);})[_0x8b88('0x1f')](function(_0x430b84){_0x3e5d1d[_0x8b88('0x3f')]=_0x430b84;return _0x3e5d1d;})[_0x8b88('0x1f')](respondWithFilteredResult(_0x374826,_0x40b38c))[_0x8b88('0x40')](handleError(_0x374826,null));};exports[_0x8b88('0x41')]=function(_0x7e74ca,_0x55c4d9){var _0x2ccb43={'raw':!![],'where':{'id':_0x7e74ca[_0x8b88('0x42')]['id']}},_0x463acc={};_0x463acc[_0x8b88('0x2c')]=_[_0x8b88('0x43')](db['CmContactHasPhone'][_0x8b88('0x2a')]);_0x463acc['query']=_['keys'](_0x7e74ca[_0x8b88('0x2d')]);_0x463acc[_0x8b88('0x2e')]=_[_0x8b88('0x2f')](_0x463acc[_0x8b88('0x2c')],_0x463acc[_0x8b88('0x2d')]);_0x2ccb43[_0x8b88('0x31')]=_[_0x8b88('0x2f')](_0x463acc[_0x8b88('0x2c')],qs[_0x8b88('0x30')](_0x7e74ca['query'][_0x8b88('0x30')]));_0x2ccb43[_0x8b88('0x31')]=_0x2ccb43[_0x8b88('0x31')][_0x8b88('0x32')]?_0x2ccb43[_0x8b88('0x31')]:_0x463acc[_0x8b88('0x2c')];if(_0x7e74ca[_0x8b88('0x2d')]['includeAll']){_0x2ccb43[_0x8b88('0x44')]=[{'all':!![]}];}_0x2ccb43=_[_0x8b88('0x39')]({},_0x2ccb43,_0x7e74ca[_0x8b88('0x3b')]);return db[_0x8b88('0x29')][_0x8b88('0x45')](_0x2ccb43)[_0x8b88('0x1f')](handleEntityNotFound(_0x55c4d9,null))[_0x8b88('0x1f')](respondWithResult(_0x55c4d9,null))[_0x8b88('0x40')](handleError(_0x55c4d9,null));};exports[_0x8b88('0x46')]=function(_0x35bb02,_0x4239e2){return db[_0x8b88('0x29')][_0x8b88('0x46')](_0x35bb02[_0x8b88('0x47')],{})['then'](function(_0x580814){var _0x53cb19=_0x35bb02[_0x8b88('0x48')][_0x8b88('0x20')]({'plain':!![]});if(!_0x53cb19)throw new Error(_0x8b88('0x49'));if(_0x53cb19['role']===_0x8b88('0x48')){var _0x5b0e1c=_0x580814[_0x8b88('0x20')]({'plain':!![]});var _0x1369f5=_0x8b88('0x4a');return db[_0x8b88('0x4b')][_0x8b88('0x45')]({'where':{'name':_0x1369f5,'userProfileId':_0x53cb19[_0x8b88('0x4c')]},'raw':!![]})[_0x8b88('0x1f')](function(_0xafbf18){if(_0xafbf18&&_0xafbf18[_0x8b88('0x4d')]===0x0){return db[_0x8b88('0x21')][_0x8b88('0x46')]({'name':_0x5b0e1c[_0x8b88('0x25')],'resourceId':_0x5b0e1c['id'],'type':_0xafbf18[_0x8b88('0x25')],'sectionId':_0xafbf18['id']},{})[_0x8b88('0x1f')](function(){return _0x580814;});}else{return _0x580814;}})[_0x8b88('0x40')](function(_0xb03dae){logger[_0x8b88('0x23')](_0x8b88('0x4e'),_0xb03dae);throw _0xb03dae;});}return _0x580814;})[_0x8b88('0x1f')](respondWithResult(_0x4239e2,0xc9))[_0x8b88('0x40')](handleError(_0x4239e2,null));};exports[_0x8b88('0x1e')]=function(_0x4a8a1f,_0x577795){if(_0x4a8a1f[_0x8b88('0x47')]['id']){delete _0x4a8a1f[_0x8b88('0x47')]['id'];}return db[_0x8b88('0x29')][_0x8b88('0x45')]({'where':{'id':_0x4a8a1f[_0x8b88('0x42')]['id']}})[_0x8b88('0x1f')](handleEntityNotFound(_0x577795,null))['then'](saveUpdates(_0x4a8a1f[_0x8b88('0x47')],null))[_0x8b88('0x1f')](respondWithResult(_0x577795,null))[_0x8b88('0x40')](handleError(_0x577795,null));};exports[_0x8b88('0x22')]=function(_0xd84143,_0x50c7e5){return db[_0x8b88('0x29')][_0x8b88('0x45')]({'where':{'id':_0xd84143[_0x8b88('0x42')]['id']}})['then'](handleEntityNotFound(_0x50c7e5,null))[_0x8b88('0x1f')](removeEntity(_0x50c7e5,null))['catch'](handleError(_0x50c7e5,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 863ff5c..9b58f10 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce98=['../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x196de3,_0x27e174){var _0x41b4ce=function(_0x5c8289){while(--_0x5c8289){_0x196de3['push'](_0x196de3['shift']());}};_0x41b4ce(++_0x27e174);}(_0xce98,0xe2));var _0x8ce9=function(_0x4adf4c,_0x702f9){_0x4adf4c=_0x4adf4c-0x0;var _0x11d9df=_0xce98[_0x4adf4c];return _0x11d9df;};'use strict';var _=require(_0x8ce9('0x0'));var util=require(_0x8ce9('0x1'));var logger=require('../../config/logger')(_0x8ce9('0x2'));var moment=require(_0x8ce9('0x3'));var BPromise=require(_0x8ce9('0x4'));var rp=require(_0x8ce9('0x5'));var fs=require('fs');var path=require(_0x8ce9('0x6'));var rimraf=require(_0x8ce9('0x7'));var config=require(_0x8ce9('0x8'));var attributes=require(_0x8ce9('0x9'));module[_0x8ce9('0xa')]=function(_0x2bf617,_0xa7cdac){return _0x2bf617[_0x8ce9('0xb')](_0x8ce9('0xc'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1246=['bluebird','request-promise','path','rimraf','./cmContactHasPhone.attributes','define','cm_contact_has_phones','lodash','util','moment'];(function(_0x4ea98d,_0x5c3a56){var _0x151023=function(_0x328f24){while(--_0x328f24){_0x4ea98d['push'](_0x4ea98d['shift']());}};_0x151023(++_0x5c3a56);}(_0x1246,0x10b));var _0x6124=function(_0x15d07a,_0x3430b1){_0x15d07a=_0x15d07a-0x0;var _0x823943=_0x1246[_0x15d07a];return _0x823943;};'use strict';var _=require(_0x6124('0x0'));var util=require(_0x6124('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6124('0x2'));var BPromise=require(_0x6124('0x3'));var rp=require(_0x6124('0x4'));var fs=require('fs');var path=require(_0x6124('0x5'));var rimraf=require(_0x6124('0x6'));var config=require('../../config/environment');var attributes=require(_0x6124('0x7'));module['exports']=function(_0x469ac3,_0x51474f){return _0x469ac3[_0x6124('0x8')]('CmContactHasPhone',attributes,{'tableName':_0x6124('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 4ed6e74..b6f94be 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41e7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd5160a,_0x572c4b){var _0x576cf9=function(_0xa95da6){while(--_0xa95da6){_0xd5160a['push'](_0xd5160a['shift']());}};_0x576cf9(++_0x572c4b);}(_0x41e7,0x131));var _0x741e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x41e7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x741e('0x0'));var util=require('util');var moment=require(_0x741e('0x1'));var BPromise=require(_0x741e('0x2'));var rs=require(_0x741e('0x3'));var fs=require('fs');var Redis=require(_0x741e('0x4'));var db=require(_0x741e('0x5'))['db'];var utils=require(_0x741e('0x6'));var logger=require(_0x741e('0x7'))(_0x741e('0x8'));var config=require(_0x741e('0x9'));var jayson=require(_0x741e('0xa'));var client=jayson[_0x741e('0xb')][_0x741e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1acab5,_0x118c50,_0x37248e){return new BPromise(function(_0x301ff4,_0x2037c0){return client[_0x741e('0xd')](_0x1acab5,_0x37248e)[_0x741e('0xe')](function(_0x65473c){logger[_0x741e('0xf')](_0x741e('0x10'),_0x118c50,_0x741e('0x11'));logger[_0x741e('0x12')](_0x741e('0x13'),_0x118c50,_0x741e('0x11'),JSON[_0x741e('0x14')](_0x65473c));if(_0x65473c[_0x741e('0x15')]){if(_0x65473c[_0x741e('0x15')][_0x741e('0x16')]===0x1f4){logger[_0x741e('0x15')](_0x741e('0x10'),_0x118c50,_0x65473c[_0x741e('0x15')][_0x741e('0x17')]);return _0x2037c0(_0x65473c['error'][_0x741e('0x17')]);}logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x118c50,_0x65473c['error'][_0x741e('0x17')]);return _0x301ff4(_0x65473c[_0x741e('0x15')]['message']);}else{logger[_0x741e('0xf')](_0x741e('0x10'),_0x118c50,_0x741e('0x11'));_0x301ff4(_0x65473c[_0x741e('0x18')]['message']);}})[_0x741e('0x19')](function(_0x4ed6d2){logger[_0x741e('0x15')]('CmContactHasPhone,\x20%s,\x20%s',_0x118c50,_0x4ed6d2);_0x2037c0(_0x4ed6d2);});});} \ No newline at end of file +var _0x05ad=['CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x128d8b,_0x541828){var _0x10733b=function(_0xaf465b){while(--_0xaf465b){_0x128d8b['push'](_0x128d8b['shift']());}};_0x10733b(++_0x541828);}(_0x05ad,0x12d));var _0xd05a=function(_0x19242b,_0x48b6ee){_0x19242b=_0x19242b-0x0;var _0x4d21f8=_0x05ad[_0x19242b];return _0x4d21f8;};'use strict';var _=require('lodash');var util=require(_0xd05a('0x0'));var moment=require(_0xd05a('0x1'));var BPromise=require(_0xd05a('0x2'));var rs=require(_0xd05a('0x3'));var fs=require('fs');var Redis=require(_0xd05a('0x4'));var db=require(_0xd05a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd05a('0x6'))(_0xd05a('0x7'));var config=require(_0xd05a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd05a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2de8b6,_0xa80224,_0x50b3ee){return new BPromise(function(_0x4f8def,_0x303f50){return client[_0xd05a('0xa')](_0x2de8b6,_0x50b3ee)['then'](function(_0x14adae){logger['info'](_0xd05a('0xb'),_0xa80224,_0xd05a('0xc'));logger[_0xd05a('0xd')](_0xd05a('0xe'),_0xa80224,_0xd05a('0xc'),JSON[_0xd05a('0xf')](_0x14adae));if(_0x14adae[_0xd05a('0x10')]){if(_0x14adae['error'][_0xd05a('0x11')]===0x1f4){logger[_0xd05a('0x10')](_0xd05a('0xb'),_0xa80224,_0x14adae[_0xd05a('0x10')]['message']);return _0x303f50(_0x14adae[_0xd05a('0x10')][_0xd05a('0x12')]);}logger[_0xd05a('0x10')](_0xd05a('0xb'),_0xa80224,_0x14adae[_0xd05a('0x10')][_0xd05a('0x12')]);return _0x4f8def(_0x14adae[_0xd05a('0x10')][_0xd05a('0x12')]);}else{logger['info'](_0xd05a('0xb'),_0xa80224,_0xd05a('0xc'));_0x4f8def(_0x14adae[_0xd05a('0x13')][_0xd05a('0x12')]);}})[_0xd05a('0x14')](function(_0xa4c9a3){logger['error'](_0xd05a('0xb'),_0xa80224,_0xa4c9a3);_0x303f50(_0xa4c9a3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 9cd871f..527cc64 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x712b=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x10ebdb,_0xc9235d){var _0x476e78=function(_0x43d6f6){while(--_0x43d6f6){_0x10ebdb['push'](_0x10ebdb['shift']());}};_0x476e78(++_0xc9235d);}(_0x712b,0x1cb));var _0xb712=function(_0x4a964b,_0x472ab4){_0x4a964b=_0x4a964b-0x0;var _0x5eca5b=_0x712b[_0x4a964b];return _0x5eca5b;};'use strict';var multer=require('multer');var util=require(_0xb712('0x0'));var path=require(_0xb712('0x1'));var timeout=require(_0xb712('0x2'));var express=require('express');var router=express[_0xb712('0x3')]();var auth=require(_0xb712('0x4'));var interaction=require(_0xb712('0x5'));var config=require(_0xb712('0x6'));var controller=require('./cmContactHasPhone.controller');router['get']('/',auth[_0xb712('0x7')](),controller[_0xb712('0x8')]);router['get'](_0xb712('0x9'),auth[_0xb712('0x7')](),controller[_0xb712('0xa')]);router[_0xb712('0xb')]('/',auth[_0xb712('0x7')](),controller[_0xb712('0xc')]);router[_0xb712('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb712('0xe')]('/:id',auth[_0xb712('0x7')](),controller[_0xb712('0xf')]);module[_0xb712('0x10')]=router; \ No newline at end of file +var _0xbeb7=['post','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x326f09,_0x225584){var _0x4baae2=function(_0x2055c6){while(--_0x2055c6){_0x326f09['push'](_0x326f09['shift']());}};_0x4baae2(++_0x225584);}(_0xbeb7,0x106));var _0x7beb=function(_0x3df905,_0x3dc203){_0x3df905=_0x3df905-0x0;var _0x3b7684=_0xbeb7[_0x3df905];return _0x3b7684;};'use strict';var multer=require('multer');var util=require(_0x7beb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7beb('0x1'));var router=express[_0x7beb('0x2')]();var auth=require(_0x7beb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7beb('0x4'));var controller=require(_0x7beb('0x5'));router[_0x7beb('0x6')]('/',auth[_0x7beb('0x7')](),controller[_0x7beb('0x8')]);router['get'](_0x7beb('0x9'),auth[_0x7beb('0x7')](),controller['show']);router[_0x7beb('0xa')]('/',auth[_0x7beb('0x7')](),controller[_0x7beb('0xb')]);router[_0x7beb('0xc')]('/:id',auth[_0x7beb('0x7')](),controller[_0x7beb('0xd')]);router[_0x7beb('0xe')](_0x7beb('0x9'),auth[_0x7beb('0x7')](),controller[_0x7beb('0xf')]);module[_0x7beb('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a5164d5..d889003 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 _0xebae=['STRING','setDataValue','alias','name','TEXT','long','select','values','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x5b25d0,_0x50ee52){var _0x29dfe6=function(_0x34a53d){while(--_0x34a53d){_0x5b25d0['push'](_0x5b25d0['shift']());}};_0x29dfe6(++_0x50ee52);}(_0xebae,0x163));var _0xeeba=function(_0x1c1f3e,_0x665593){_0x1c1f3e=_0x1c1f3e-0x0;var _0x325903=_0xebae[_0x1c1f3e];return _0x325903;};'use strict';var Sequelize=require(_0xeeba('0x0'));var _=require(_0xeeba('0x1'));module[_0xeeba('0x2')]={'name':{'type':Sequelize[_0xeeba('0x3')],'get':function(_0x3879a2){return this[_0xeeba('0x4')]('alias');}},'alias':{'type':Sequelize[_0xeeba('0x5')],'allowNull':![],'set':function(_0x54803a){this[_0xeeba('0x6')](_0xeeba('0x7'),_0x54803a?_0x54803a:this[_0xeeba('0x4')](_0xeeba('0x8')));}},'type':{'type':Sequelize[_0xeeba('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xeeba('0x9')](_0xeeba('0xa')),'get':function(){if(this['getDataValue']('type')===_0xeeba('0xb')){return JSON['parse'](this[_0xeeba('0x4')](_0xeeba('0xc')));}else{return this[_0xeeba('0x4')](_0xeeba('0xc'));}},'set':function(_0x151f1b){if(Array['isArray'](_0x151f1b)){this[_0xeeba('0x6')](_0xeeba('0xc'),JSON[_0xeeba('0xd')](_0x151f1b));}else{this[_0xeeba('0x6')]('values',_0x151f1b);}}},'required':{'type':Sequelize[_0xeeba('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x89a3=['name','type','parse','values','stringify','setDataValue','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x51a56e,_0x5d6ee9){var _0x5a8685=function(_0x161c4c){while(--_0x161c4c){_0x51a56e['push'](_0x51a56e['shift']());}};_0x5a8685(++_0x5d6ee9);}(_0x89a3,0x1a6));var _0x389a=function(_0x3d6a35,_0x3cdbde){_0x3d6a35=_0x3d6a35-0x0;var _0x5082fd=_0x89a3[_0x3d6a35];return _0x5082fd;};'use strict';var Sequelize=require(_0x389a('0x0'));var _=require(_0x389a('0x1'));module[_0x389a('0x2')]={'name':{'type':Sequelize[_0x389a('0x3')],'get':function(_0x3d037b){return this[_0x389a('0x4')](_0x389a('0x5'));}},'alias':{'type':Sequelize[_0x389a('0x6')],'allowNull':![],'set':function(_0xb99f22){this['setDataValue'](_0x389a('0x5'),_0xb99f22?_0xb99f22:this[_0x389a('0x4')](_0x389a('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x389a('0x4')](_0x389a('0x8'))==='select'){return JSON[_0x389a('0x9')](this[_0x389a('0x4')]('values'));}else{return this['getDataValue'](_0x389a('0xa'));}},'set':function(_0x1707df){if(Array['isArray'](_0x1707df)){this['setDataValue'](_0x389a('0xa'),JSON[_0x389a('0xb')](_0x1707df));}else{this[_0x389a('0xc')](_0x389a('0xa'),_0x1707df);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7655526..c48df6a 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 _0x95ba=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','create','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%d','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','save','update','then','destroy','end','sendStatus','stack','name','send','index','CmCustomField','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0x25b4d8,_0x3f00b3){var _0x4aeb9a=function(_0x48cfea){while(--_0x48cfea){_0x25b4d8['push'](_0x25b4d8['shift']());}};_0x4aeb9a(++_0x3f00b3);}(_0x95ba,0x113));var _0xa95b=function(_0x141965,_0x59bcf6){_0x141965=_0x141965-0x0;var _0x185609=_0x95ba[_0x141965];return _0x185609;};'use strict';var pdf=require(_0xa95b('0x0'));var emlformat=require(_0xa95b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa95b('0x2'));var rp=require(_0xa95b('0x3'));var moment=require(_0xa95b('0x4'));var BPromise=require(_0xa95b('0x5'));var Mustache=require(_0xa95b('0x6'));var util=require(_0xa95b('0x7'));var path=require(_0xa95b('0x8'));var sox=require(_0xa95b('0x9'));var csv=require(_0xa95b('0xa'));var ejs=require(_0xa95b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa95b('0xc'));var crypto=require(_0xa95b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa95b('0xa'));var querystring=require('querystring');var Papa=require(_0xa95b('0xe'));var Redis=require(_0xa95b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa95b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa95b('0x11'))('api');var utils=require(_0xa95b('0x12'));var config=require(_0xa95b('0x13'));var db=require(_0xa95b('0x14'))['db'];function respondWithStatusCode(_0x2e634e,_0x433477){_0x433477=_0x433477||0xcc;return function(_0x2d12bc){if(_0x2d12bc){return _0x2e634e['sendStatus'](_0x433477);}return _0x2e634e[_0xa95b('0x15')](_0x433477)['end']();};}function respondWithResult(_0xf76586,_0x2e6605){_0x2e6605=_0x2e6605||0xc8;return function(_0x278b2b){if(_0x278b2b){return _0xf76586['status'](_0x2e6605)[_0xa95b('0x16')](_0x278b2b);}};}function respondWithFilteredResult(_0xdaa04,_0x2268a9){return function(_0x26d6ed){if(_0x26d6ed){var _0x230749=_0x26d6ed[_0xa95b('0x17')],_0x2ed6fd=_0x2268a9[_0xa95b('0x18')],_0x2321b8=_0x2268a9[_0xa95b('0x18')]+_0x2268a9['limit'],_0x177294;if(_0x2321b8>=_0x230749){_0x2321b8=_0x230749;_0x177294=0xc8;}else{_0x177294=0xce;}_0xdaa04[_0xa95b('0x15')](_0x177294);return _0xdaa04[_0xa95b('0x19')]('Content-Range',_0x2ed6fd+'-'+_0x2321b8+'/'+_0x230749)[_0xa95b('0x16')](_0x26d6ed);}return null;};}function patchUpdates(_0x44ff0a){return function(_0x119a0e){try{jsonpatch['apply'](_0x119a0e,_0x44ff0a,!![]);}catch(_0x196e7d){return BPromise['reject'](_0x196e7d);}return _0x119a0e[_0xa95b('0x1a')]();};}function saveUpdates(_0x643adb,_0x591b98){return function(_0x296116){if(_0x296116){return _0x296116[_0xa95b('0x1b')](_0x643adb)[_0xa95b('0x1c')](function(_0x5bcbad){return _0x5bcbad;});}return null;};}function removeEntity(_0x4dc5f9,_0x4ce200){return function(_0x2cff47){if(_0x2cff47){return _0x2cff47[_0xa95b('0x1d')]()[_0xa95b('0x1c')](function(){_0x4dc5f9['status'](0xcc)[_0xa95b('0x1e')]();});}};}function handleEntityNotFound(_0x3239c7,_0x4cfc99){return function(_0x1d51bf){if(!_0x1d51bf){_0x3239c7[_0xa95b('0x1f')](0x194);}return _0x1d51bf;};}function handleError(_0xe080ed,_0x5cf5ed){_0x5cf5ed=_0x5cf5ed||0x1f4;return function(_0x3fc42b){logger['error'](_0x3fc42b[_0xa95b('0x20')]);if(_0x3fc42b['name']){delete _0x3fc42b[_0xa95b('0x21')];}_0xe080ed[_0xa95b('0x15')](_0x5cf5ed)[_0xa95b('0x22')](_0x3fc42b);};}exports[_0xa95b('0x23')]=function(_0x5f1c65,_0x488405){var _0xfd4a94={},_0x35abe2={},_0x3fc7a1={'count':0x0,'rows':[]};var _0x4b2bf4=_['map'](db[_0xa95b('0x24')][_0xa95b('0x25')],function(_0x2a65fb){return{'name':_0x2a65fb['fieldName'],'type':_0x2a65fb[_0xa95b('0x26')][_0xa95b('0x27')]};});_0x35abe2[_0xa95b('0x28')]=_['differenceBy'](_[_0xa95b('0x29')](_0x4b2bf4,_0xa95b('0x21')),[_0xa95b('0x21')]);_0x35abe2[_0xa95b('0x2a')]=_[_0xa95b('0x2b')](_0x5f1c65[_0xa95b('0x2a')]);_0x35abe2[_0xa95b('0x2c')]=_['intersection'](_0x35abe2[_0xa95b('0x28')],_0x35abe2[_0xa95b('0x2a')]);_0xfd4a94[_0xa95b('0x2d')]=_['intersection'](_0x35abe2[_0xa95b('0x28')],qs['fields'](_0x5f1c65[_0xa95b('0x2a')][_0xa95b('0x2e')]));_0xfd4a94['attributes']=_0xfd4a94[_0xa95b('0x2d')][_0xa95b('0x2f')]?_0xfd4a94['attributes']:_0x35abe2[_0xa95b('0x28')];if(!_0x5f1c65[_0xa95b('0x2a')][_0xa95b('0x30')](_0xa95b('0x31'))){_0xfd4a94[_0xa95b('0x32')]=qs[_0xa95b('0x32')](_0x5f1c65[_0xa95b('0x2a')]['limit']);_0xfd4a94[_0xa95b('0x18')]=qs[_0xa95b('0x18')](_0x5f1c65[_0xa95b('0x2a')]['offset']);}_0xfd4a94[_0xa95b('0x33')]=qs[_0xa95b('0x34')](_0x5f1c65['query']['sort']);_0xfd4a94[_0xa95b('0x35')]=qs[_0xa95b('0x2c')](_[_0xa95b('0x36')](_0x5f1c65[_0xa95b('0x2a')],_0x35abe2[_0xa95b('0x2c')]),_0x4b2bf4);if(_0x5f1c65[_0xa95b('0x2a')]['filter']){_0xfd4a94[_0xa95b('0x35')]=_[_0xa95b('0x37')](_0xfd4a94['where'],{'$or':_['map'](_0x4b2bf4,function(_0x1701c8){if(_0x1701c8[_0xa95b('0x26')]!==_0xa95b('0x38')){var _0xa0be59={};_0xa0be59[_0x1701c8[_0xa95b('0x21')]]={'$like':'%'+_0x5f1c65[_0xa95b('0x2a')][_0xa95b('0x39')]+'%'};return _0xa0be59;}})});}_0xfd4a94=_[_0xa95b('0x37')]({},_0xfd4a94,_0x5f1c65[_0xa95b('0x3a')]);var _0x344183={'where':_0xfd4a94[_0xa95b('0x35')]};return db[_0xa95b('0x24')][_0xa95b('0x17')](_0x344183)['then'](function(_0x559bb1){_0x3fc7a1[_0xa95b('0x17')]=_0x559bb1;if(_0x5f1c65['query'][_0xa95b('0x3b')]){_0xfd4a94[_0xa95b('0x3c')]=[{'all':!![]}];}return db[_0xa95b('0x24')][_0xa95b('0x3d')](_0xfd4a94);})[_0xa95b('0x1c')](function(_0x542b5b){_0x3fc7a1[_0xa95b('0x3e')]=_0x542b5b;return _0x3fc7a1;})[_0xa95b('0x1c')](respondWithFilteredResult(_0x488405,_0xfd4a94))[_0xa95b('0x3f')](handleError(_0x488405,null));};exports[_0xa95b('0x40')]=function(_0x3d9794,_0x1bd218){var _0x2150c0={'raw':!![],'where':{'id':_0x3d9794['params']['id']}},_0x4cf495={};_0x4cf495[_0xa95b('0x28')]=_[_0xa95b('0x2b')](db[_0xa95b('0x24')][_0xa95b('0x25')]);_0x4cf495[_0xa95b('0x2a')]=_[_0xa95b('0x2b')](_0x3d9794[_0xa95b('0x2a')]);_0x4cf495[_0xa95b('0x2c')]=_['intersection'](_0x4cf495[_0xa95b('0x28')],_0x4cf495[_0xa95b('0x2a')]);_0x2150c0['attributes']=_['intersection'](_0x4cf495[_0xa95b('0x28')],qs['fields'](_0x3d9794[_0xa95b('0x2a')][_0xa95b('0x2e')]));_0x2150c0[_0xa95b('0x2d')]=_0x2150c0[_0xa95b('0x2d')][_0xa95b('0x2f')]?_0x2150c0[_0xa95b('0x2d')]:_0x4cf495[_0xa95b('0x28')];if(_0x3d9794[_0xa95b('0x2a')][_0xa95b('0x3b')]){_0x2150c0[_0xa95b('0x3c')]=[{'all':!![]}];}_0x2150c0=_[_0xa95b('0x37')]({},_0x2150c0,_0x3d9794[_0xa95b('0x3a')]);return db['CmCustomField'][_0xa95b('0x41')](_0x2150c0)[_0xa95b('0x1c')](handleEntityNotFound(_0x1bd218,null))[_0xa95b('0x1c')](respondWithResult(_0x1bd218,null))[_0xa95b('0x3f')](handleError(_0x1bd218,null));};exports[_0xa95b('0x1b')]=function(_0x3835af,_0x490fe2){if(_0x3835af[_0xa95b('0x42')]['id']){delete _0x3835af['body']['id'];}return db[_0xa95b('0x24')][_0xa95b('0x41')]({'where':{'id':_0x3835af[_0xa95b('0x43')]['id']}})[_0xa95b('0x1c')](handleEntityNotFound(_0x490fe2,null))[_0xa95b('0x1c')](saveUpdates(_0x3835af[_0xa95b('0x42')],null))[_0xa95b('0x1c')](respondWithResult(_0x490fe2,null))[_0xa95b('0x3f')](handleError(_0x490fe2,null));};exports['destroy']=function(_0x5893d5,_0x3a92e6){return db[_0xa95b('0x24')][_0xa95b('0x41')]({'where':{'id':_0x5893d5[_0xa95b('0x43')]['id']}})[_0xa95b('0x1c')](handleEntityNotFound(_0x3a92e6,null))[_0xa95b('0x1c')](removeEntity(_0x3a92e6,null))['catch'](handleError(_0x3a92e6,null));};exports[_0xa95b('0x44')]=function(_0x19555c,_0x4cd8f0){var _0x1c7d9c;return db['sequelize']['transaction'](function(_0x422790){return db[_0xa95b('0x24')][_0xa95b('0x44')](_0x19555c[_0xa95b('0x42')],{'transaction':_0x422790})[_0xa95b('0x1c')](function(_0xd2b8af){_0x1c7d9c=_0xd2b8af;var _0x43e3be={'type':db[_0xa95b('0x45')][_0xa95b('0x46')],'transaction':_0x422790};switch(_0x19555c[_0xa95b('0x42')][_0xa95b('0x26')]){case _0xa95b('0x47'):_0x43e3be['type']=db[_0xa95b('0x45')]['TEXT'];break;case _0xa95b('0x48'):_0x43e3be[_0xa95b('0x26')]=db['Sequelize'][_0xa95b('0x49')];break;case'switch':_0x43e3be[_0xa95b('0x26')]=db['Sequelize'][_0xa95b('0x4a')];_0x43e3be[_0xa95b('0x4b')]=![];break;default:}return db[_0xa95b('0x4c')][_0xa95b('0x4d')][_0xa95b('0x4e')]('cm_contacts',util['format'](_0xa95b('0x4f'),_0x1c7d9c['id']),_0x43e3be);})[_0xa95b('0x1c')](function(){return _0x1c7d9c;});})[_0xa95b('0x1c')](respondWithResult(_0x4cd8f0,0xc9))[_0xa95b('0x3f')](handleError(_0x4cd8f0,null));}; \ No newline at end of file +var _0xbc00=['set','apply','save','destroy','then','end','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','update','body','transaction','create','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','sequelize','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x39ef35,_0x4910cb){var _0x5aef6e=function(_0x56e6fc){while(--_0x56e6fc){_0x39ef35['push'](_0x39ef35['shift']());}};_0x5aef6e(++_0x4910cb);}(_0xbc00,0x8a));var _0x0bc0=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xbc00[_0x231e16];return _0x570a7c;};'use strict';var pdf=require(_0x0bc0('0x0'));var emlformat=require(_0x0bc0('0x1'));var rimraf=require(_0x0bc0('0x2'));var zipdir=require(_0x0bc0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0bc0('0x4'));var BPromise=require(_0x0bc0('0x5'));var Mustache=require(_0x0bc0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bc0('0x7'));var ejs=require(_0x0bc0('0x8'));var fs=require('fs');var _=require(_0x0bc0('0x9'));var squel=require(_0x0bc0('0xa'));var crypto=require(_0x0bc0('0xb'));var jsforce=require(_0x0bc0('0xc'));var deskjs=require(_0x0bc0('0xd'));var toCsv=require(_0x0bc0('0x7'));var querystring=require(_0x0bc0('0xe'));var Papa=require(_0x0bc0('0xf'));var Redis=require('ioredis');var authService=require(_0x0bc0('0x10'));var qs=require(_0x0bc0('0x11'));var as=require(_0x0bc0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bc0('0x13'))(_0x0bc0('0x14'));var utils=require(_0x0bc0('0x15'));var config=require(_0x0bc0('0x16'));var db=require(_0x0bc0('0x17'))['db'];function respondWithStatusCode(_0x5aa2b2,_0x5ed449){_0x5ed449=_0x5ed449||0xcc;return function(_0x3b63a1){if(_0x3b63a1){return _0x5aa2b2[_0x0bc0('0x18')](_0x5ed449);}return _0x5aa2b2[_0x0bc0('0x19')](_0x5ed449)['end']();};}function respondWithResult(_0x58055e,_0x2a28dd){_0x2a28dd=_0x2a28dd||0xc8;return function(_0x35a761){if(_0x35a761){return _0x58055e['status'](_0x2a28dd)[_0x0bc0('0x1a')](_0x35a761);}};}function respondWithFilteredResult(_0xc4e609,_0x15d06e){return function(_0x3a430c){if(_0x3a430c){var _0xc5bd57=_0x3a430c[_0x0bc0('0x1b')],_0x1f2dc2=_0x15d06e[_0x0bc0('0x1c')],_0x56487a=_0x15d06e['offset']+_0x15d06e[_0x0bc0('0x1d')],_0x50440f;if(_0x56487a>=_0xc5bd57){_0x56487a=_0xc5bd57;_0x50440f=0xc8;}else{_0x50440f=0xce;}_0xc4e609[_0x0bc0('0x19')](_0x50440f);return _0xc4e609[_0x0bc0('0x1e')]('Content-Range',_0x1f2dc2+'-'+_0x56487a+'/'+_0xc5bd57)[_0x0bc0('0x1a')](_0x3a430c);}return null;};}function patchUpdates(_0xe2251f){return function(_0x31fc04){try{jsonpatch[_0x0bc0('0x1f')](_0x31fc04,_0xe2251f,!![]);}catch(_0xcea025){return BPromise['reject'](_0xcea025);}return _0x31fc04[_0x0bc0('0x20')]();};}function saveUpdates(_0x4c65f1,_0x5c784b){return function(_0x3b99a5){if(_0x3b99a5){return _0x3b99a5['update'](_0x4c65f1)['then'](function(_0x20a3ec){return _0x20a3ec;});}return null;};}function removeEntity(_0x52f87d,_0x30003c){return function(_0x38dcb1){if(_0x38dcb1){return _0x38dcb1[_0x0bc0('0x21')]()[_0x0bc0('0x22')](function(){_0x52f87d['status'](0xcc)[_0x0bc0('0x23')]();});}};}function handleEntityNotFound(_0x3b7965,_0x5553a6){return function(_0x1ed8de){if(!_0x1ed8de){_0x3b7965[_0x0bc0('0x18')](0x194);}return _0x1ed8de;};}function handleError(_0x482faa,_0x4fc31f){_0x4fc31f=_0x4fc31f||0x1f4;return function(_0x308399){logger[_0x0bc0('0x24')](_0x308399[_0x0bc0('0x25')]);if(_0x308399['name']){delete _0x308399[_0x0bc0('0x26')];}_0x482faa[_0x0bc0('0x19')](_0x4fc31f)[_0x0bc0('0x27')](_0x308399);};}exports['index']=function(_0x49615c,_0x261831){var _0x7a2061={},_0x23a324={},_0x1074e1={'count':0x0,'rows':[]};var _0x27954b=_[_0x0bc0('0x28')](db[_0x0bc0('0x29')][_0x0bc0('0x2a')],function(_0x4a41e3){return{'name':_0x4a41e3[_0x0bc0('0x2b')],'type':_0x4a41e3[_0x0bc0('0x2c')]['key']};});_0x23a324[_0x0bc0('0x2d')]=_[_0x0bc0('0x2e')](_[_0x0bc0('0x28')](_0x27954b,_0x0bc0('0x26')),[_0x0bc0('0x26')]);_0x23a324[_0x0bc0('0x2f')]=_[_0x0bc0('0x30')](_0x49615c[_0x0bc0('0x2f')]);_0x23a324['filters']=_[_0x0bc0('0x31')](_0x23a324[_0x0bc0('0x2d')],_0x23a324[_0x0bc0('0x2f')]);_0x7a2061[_0x0bc0('0x32')]=_[_0x0bc0('0x31')](_0x23a324['model'],qs[_0x0bc0('0x33')](_0x49615c[_0x0bc0('0x2f')]['fields']));_0x7a2061[_0x0bc0('0x32')]=_0x7a2061[_0x0bc0('0x32')][_0x0bc0('0x34')]?_0x7a2061[_0x0bc0('0x32')]:_0x23a324[_0x0bc0('0x2d')];if(!_0x49615c[_0x0bc0('0x2f')]['hasOwnProperty']('nolimit')){_0x7a2061[_0x0bc0('0x1d')]=qs['limit'](_0x49615c[_0x0bc0('0x2f')]['limit']);_0x7a2061[_0x0bc0('0x1c')]=qs[_0x0bc0('0x1c')](_0x49615c[_0x0bc0('0x2f')][_0x0bc0('0x1c')]);}_0x7a2061[_0x0bc0('0x35')]=qs[_0x0bc0('0x36')](_0x49615c[_0x0bc0('0x2f')]['sort']);_0x7a2061[_0x0bc0('0x37')]=qs[_0x0bc0('0x38')](_[_0x0bc0('0x39')](_0x49615c[_0x0bc0('0x2f')],_0x23a324[_0x0bc0('0x38')]),_0x27954b);if(_0x49615c['query'][_0x0bc0('0x3a')]){_0x7a2061[_0x0bc0('0x37')]=_[_0x0bc0('0x3b')](_0x7a2061[_0x0bc0('0x37')],{'$or':_[_0x0bc0('0x28')](_0x27954b,function(_0x4dcf6b){if(_0x4dcf6b[_0x0bc0('0x2c')]!=='VIRTUAL'){var _0x26194f={};_0x26194f[_0x4dcf6b['name']]={'$like':'%'+_0x49615c[_0x0bc0('0x2f')][_0x0bc0('0x3a')]+'%'};return _0x26194f;}})});}_0x7a2061=_[_0x0bc0('0x3b')]({},_0x7a2061,_0x49615c['options']);var _0x1c24c4={'where':_0x7a2061[_0x0bc0('0x37')]};return db[_0x0bc0('0x29')]['count'](_0x1c24c4)[_0x0bc0('0x22')](function(_0x2dea4d){_0x1074e1[_0x0bc0('0x1b')]=_0x2dea4d;if(_0x49615c[_0x0bc0('0x2f')][_0x0bc0('0x3c')]){_0x7a2061[_0x0bc0('0x3d')]=[{'all':!![]}];}return db['CmCustomField'][_0x0bc0('0x3e')](_0x7a2061);})[_0x0bc0('0x22')](function(_0x2503e5){_0x1074e1[_0x0bc0('0x3f')]=_0x2503e5;return _0x1074e1;})[_0x0bc0('0x22')](respondWithFilteredResult(_0x261831,_0x7a2061))['catch'](handleError(_0x261831,null));};exports[_0x0bc0('0x40')]=function(_0xd5b78f,_0x4a4512){var _0x163a0c={'raw':!![],'where':{'id':_0xd5b78f[_0x0bc0('0x41')]['id']}},_0x520e82={};_0x520e82[_0x0bc0('0x2d')]=_[_0x0bc0('0x30')](db[_0x0bc0('0x29')]['rawAttributes']);_0x520e82[_0x0bc0('0x2f')]=_[_0x0bc0('0x30')](_0xd5b78f[_0x0bc0('0x2f')]);_0x520e82[_0x0bc0('0x38')]=_[_0x0bc0('0x31')](_0x520e82[_0x0bc0('0x2d')],_0x520e82['query']);_0x163a0c['attributes']=_[_0x0bc0('0x31')](_0x520e82[_0x0bc0('0x2d')],qs[_0x0bc0('0x33')](_0xd5b78f[_0x0bc0('0x2f')]['fields']));_0x163a0c['attributes']=_0x163a0c[_0x0bc0('0x32')][_0x0bc0('0x34')]?_0x163a0c[_0x0bc0('0x32')]:_0x520e82['model'];if(_0xd5b78f[_0x0bc0('0x2f')]['includeAll']){_0x163a0c[_0x0bc0('0x3d')]=[{'all':!![]}];}_0x163a0c=_[_0x0bc0('0x3b')]({},_0x163a0c,_0xd5b78f[_0x0bc0('0x42')]);return db['CmCustomField'][_0x0bc0('0x43')](_0x163a0c)['then'](handleEntityNotFound(_0x4a4512,null))[_0x0bc0('0x22')](respondWithResult(_0x4a4512,null))[_0x0bc0('0x44')](handleError(_0x4a4512,null));};exports[_0x0bc0('0x45')]=function(_0x541408,_0x578d2d){if(_0x541408[_0x0bc0('0x46')]['id']){delete _0x541408[_0x0bc0('0x46')]['id'];}return db[_0x0bc0('0x29')]['find']({'where':{'id':_0x541408['params']['id']}})[_0x0bc0('0x22')](handleEntityNotFound(_0x578d2d,null))[_0x0bc0('0x22')](saveUpdates(_0x541408[_0x0bc0('0x46')],null))[_0x0bc0('0x22')](respondWithResult(_0x578d2d,null))[_0x0bc0('0x44')](handleError(_0x578d2d,null));};exports[_0x0bc0('0x21')]=function(_0x46626f,_0x913405){return db[_0x0bc0('0x29')][_0x0bc0('0x43')]({'where':{'id':_0x46626f['params']['id']}})[_0x0bc0('0x22')](handleEntityNotFound(_0x913405,null))[_0x0bc0('0x22')](removeEntity(_0x913405,null))['catch'](handleError(_0x913405,null));};exports['create']=function(_0x13c6a7,_0x503b83){var _0x48291c;return db['sequelize'][_0x0bc0('0x47')](function(_0x26ff82){return db[_0x0bc0('0x29')][_0x0bc0('0x48')](_0x13c6a7[_0x0bc0('0x46')],{'transaction':_0x26ff82})[_0x0bc0('0x22')](function(_0x1d09e6){_0x48291c=_0x1d09e6;var _0x5652bb={'type':db[_0x0bc0('0x49')]['TEXT'],'transaction':_0x26ff82};switch(_0x13c6a7[_0x0bc0('0x46')][_0x0bc0('0x2c')]){case _0x0bc0('0x4a'):_0x5652bb[_0x0bc0('0x2c')]=db[_0x0bc0('0x49')][_0x0bc0('0x4b')];break;case'number':_0x5652bb['type']=db[_0x0bc0('0x49')][_0x0bc0('0x4c')];break;case _0x0bc0('0x4d'):_0x5652bb[_0x0bc0('0x2c')]=db['Sequelize'][_0x0bc0('0x4e')];_0x5652bb['defaultValue']=![];break;default:}return db[_0x0bc0('0x4f')]['queryInterface'][_0x0bc0('0x50')](_0x0bc0('0x51'),util[_0x0bc0('0x52')](_0x0bc0('0x53'),_0x48291c['id']),_0x5652bb);})['then'](function(){return _0x48291c;});})[_0x0bc0('0x22')](respondWithResult(_0x503b83,0xc9))[_0x0bc0('0x44')](handleError(_0x503b83,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f0098b7..7dcfb09 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 _0x3ee7=['CmCustomField','cm_custom_fields','util','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x5e50a6,_0xdbac2e){var _0x5df0da=function(_0x44d6b2){while(--_0x44d6b2){_0x5e50a6['push'](_0x5e50a6['shift']());}};_0x5df0da(++_0xdbac2e);}(_0x3ee7,0x98));var _0x73ee=function(_0x1918a8,_0x56f70a){_0x1918a8=_0x1918a8-0x0;var _0x194237=_0x3ee7[_0x1918a8];return _0x194237;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x73ee('0x1'));var BPromise=require('bluebird');var rp=require(_0x73ee('0x2'));var fs=require('fs');var path=require(_0x73ee('0x3'));var rimraf=require(_0x73ee('0x4'));var config=require(_0x73ee('0x5'));var attributes=require(_0x73ee('0x6'));module[_0x73ee('0x7')]=function(_0x2bc2c1,_0x447c6f){return _0x2bc2c1['define'](_0x73ee('0x8'),attributes,{'tableName':_0x73ee('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa1b=['exports','define','cm_custom_fields','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x4722e8,_0x599a14){var _0xfe78a4=function(_0x2b2c2b){while(--_0x2b2c2b){_0x4722e8['push'](_0x4722e8['shift']());}};_0xfe78a4(++_0x599a14);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))('api');var moment=require(_0xbaa1('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa1('0x4'));var fs=require('fs');var path=require(_0xbaa1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xbaa1('0x6')]=function(_0x27b99c,_0x4a5735){return _0x27b99c[_0xbaa1('0x7')]('CmCustomField',attributes,{'tableName':_0xbaa1('0x8'),'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 07160dd..542b312 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 _0x984b=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x856f2,_0x2ad0c6){var _0x265c7b=function(_0x305349){while(--_0x305349){_0x856f2['push'](_0x856f2['shift']());}};_0x265c7b(++_0x2ad0c6);}(_0x984b,0xee));var _0xb984=function(_0x504562,_0x44e7a9){_0x504562=_0x504562-0x0;var _0x34f928=_0x984b[_0x504562];return _0x34f928;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file +var _0xc6d8=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x14fdce,_0x458896){var _0x705d21=function(_0x2cad34){while(--_0x2cad34){_0x14fdce['push'](_0x14fdce['shift']());}};_0x705d21(++_0x458896);}(_0xc6d8,0xd7));var _0x8c6d=function(_0xdb2727,_0xce46aa){_0xdb2727=_0xdb2727-0x0;var _0x36d766=_0xc6d8[_0xdb2727];return _0x36d766;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('CmCustomField,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2f66d30..fe98de4 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 _0xf2b6=['path','connect-timeout','express','../../components/auth/service','./cmCustomField.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x3a832f,_0x1de647){var _0x13f6c2=function(_0x3014c3){while(--_0x3014c3){_0x3a832f['push'](_0x3a832f['shift']());}};_0x13f6c2(++_0x1de647);}(_0xf2b6,0x178));var _0x6f2b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf2b6[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x6f2b('0x0'));var util=require(_0x6f2b('0x1'));var path=require(_0x6f2b('0x2'));var timeout=require(_0x6f2b('0x3'));var express=require(_0x6f2b('0x4'));var router=express['Router']();var auth=require(_0x6f2b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f2b('0x6'));router['get']('/',auth[_0x6f2b('0x7')](),controller[_0x6f2b('0x8')]);router[_0x6f2b('0x9')]('/:id',auth[_0x6f2b('0x7')](),controller[_0x6f2b('0xa')]);router[_0x6f2b('0xb')]('/',auth[_0x6f2b('0x7')](),controller[_0x6f2b('0xc')]);router[_0x6f2b('0xd')](_0x6f2b('0xe'),auth[_0x6f2b('0x7')](),controller['update']);router[_0x6f2b('0xf')]('/:id',auth[_0x6f2b('0x7')](),controller[_0x6f2b('0x10')]);module[_0x6f2b('0x11')]=router; \ No newline at end of file +var _0x6912=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x55483d,_0x51831b){var _0x3ba5f2=function(_0x30abf1){while(--_0x30abf1){_0x55483d['push'](_0x55483d['shift']());}};_0x3ba5f2(++_0x51831b);}(_0x6912,0x1c3));var _0x2691=function(_0x3d253b,_0x4ae669){_0x3d253b=_0x3d253b-0x0;var _0x57ff25=_0x6912[_0x3d253b];return _0x57ff25;};'use strict';var multer=require(_0x2691('0x0'));var util=require(_0x2691('0x1'));var path=require(_0x2691('0x2'));var timeout=require(_0x2691('0x3'));var express=require(_0x2691('0x4'));var router=express[_0x2691('0x5')]();var auth=require(_0x2691('0x6'));var interaction=require(_0x2691('0x7'));var config=require(_0x2691('0x8'));var controller=require(_0x2691('0x9'));router[_0x2691('0xa')]('/',auth['isAuthenticated'](),controller[_0x2691('0xb')]);router[_0x2691('0xa')](_0x2691('0xc'),auth['isAuthenticated'](),controller[_0x2691('0xd')]);router[_0x2691('0xe')]('/',auth[_0x2691('0xf')](),controller[_0x2691('0x10')]);router['put'](_0x2691('0xc'),auth[_0x2691('0xf')](),controller[_0x2691('0x11')]);router['delete']('/:id',auth[_0x2691('0xf')](),controller[_0x2691('0x12')]);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 3b3576c..c005371 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 _0x7a54=['contactListQueue','STRING','moment','sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x4d53bc,_0x3f21e3){var _0x238bd7=function(_0x2563c1){while(--_0x2563c1){_0x4d53bc['push'](_0x4d53bc['shift']());}};_0x238bd7(++_0x3f21e3);}(_0x7a54,0x106));var _0x47a5=function(_0x113f87,_0x1ec432){_0x113f87=_0x113f87-0x0;var _0x5a24cc=_0x7a54[_0x113f87];return _0x5a24cc;};'use strict';var moment=require(_0x47a5('0x0'));var Sequelize=require(_0x47a5('0x1'));module[_0x47a5('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':moment()['format'](_0x47a5('0x5'))},'countbusyretry':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x47a5('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x47a5('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x47a5('0x6')],'unique':_0x47a5('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x47a5('0x9')]}}; \ No newline at end of file +var _0x5fab=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x9921d1,_0x5a83c1){var _0x4831b5=function(_0x3c03c7){while(--_0x3c03c7){_0x9921d1['push'](_0x9921d1['shift']());}};_0x4831b5(++_0x5a83c1);}(_0x5fab,0x177));var _0xb5fa=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x5fab[_0x73b1cd];return _0x243426;};'use strict';var moment=require(_0xb5fa('0x0'));var Sequelize=require(_0xb5fa('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb5fa('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5fa('0x4')],'defaultValue':moment()[_0xb5fa('0x5')](_0xb5fa('0x6'))},'countbusyretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5fa('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5fa('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5fa('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb5fa('0x7')],'unique':_0xb5fa('0x9')},'UserId':{'type':Sequelize[_0xb5fa('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb5fa('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index d1cbad2..6db1e12 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 _0xb86c=['campaign','membername','user','UserId','deletedat','format','calleridnum','queue','ivr','ContactId','firstName','isNil','lastName','calleridname','CmHopperFinal','CmContact','outbound','preview','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','getVoiceQueues','isNumber','getOpenContacts','entity\x20not\x20found','getTimezones','push','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/environment','../../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','update','then','error','stack','name','index','map','CmHopper','type','key','query','keys','filters','intersection','model','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$notIn','$notLike','$like','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','show','params','rawAttributes','includeAll','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','state','statedesc','deleted'];(function(_0x35578d,_0x3b97fd){var _0x4a1ce5=function(_0xb6d43d){while(--_0xb6d43d){_0x35578d['push'](_0x35578d['shift']());}};_0x4a1ce5(++_0x3b97fd);}(_0xb86c,0x1e0));var _0xcb86=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xb86c[_0xa8883];return _0x479426;};'use strict';var pdf=require(_0xcb86('0x0'));var emlformat=require(_0xcb86('0x1'));var rimraf=require(_0xcb86('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb86('0x3'));var rp=require(_0xcb86('0x4'));var moment=require(_0xcb86('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb86('0x6'));var util=require(_0xcb86('0x7'));var path=require(_0xcb86('0x8'));var sox=require(_0xcb86('0x9'));var csv=require(_0xcb86('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcb86('0xb'));var squel=require(_0xcb86('0xc'));var crypto=require(_0xcb86('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcb86('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcb86('0xf'));var Redis=require(_0xcb86('0x10'));var shared=require(_0xcb86('0x11'));var authService=require(_0xcb86('0x12'));var qs=require(_0xcb86('0x13'));var as=require(_0xcb86('0x14'));var hardwareService=require(_0xcb86('0x15'));var logger=require('../../config/logger')(_0xcb86('0x16'));var utils=require(_0xcb86('0x17'));var config=require(_0xcb86('0x11'));var db=require(_0xcb86('0x18'))['db'];function respondWithStatusCode(_0x231d95,_0x399f9f){_0x399f9f=_0x399f9f||0xcc;return function(_0x977b4d){if(_0x977b4d){return _0x231d95[_0xcb86('0x19')](_0x399f9f);}return _0x231d95[_0xcb86('0x1a')](_0x399f9f)[_0xcb86('0x1b')]();};}function respondWithResult(_0x2a8c0a,_0x43bf8d){_0x43bf8d=_0x43bf8d||0xc8;return function(_0x3ffe0a){if(_0x3ffe0a){return _0x2a8c0a['status'](_0x43bf8d)[_0xcb86('0x1c')](_0x3ffe0a);}};}function respondWithFilteredResult(_0x23a3c1,_0x22a5db){return function(_0x3a8e1f){if(_0x3a8e1f){var _0x1830ea=_0x3a8e1f[_0xcb86('0x1d')],_0x4d2531=_0x22a5db[_0xcb86('0x1e')],_0x53b39f=_0x22a5db[_0xcb86('0x1e')]+_0x22a5db[_0xcb86('0x1f')],_0x3287db;if(_0x53b39f>=_0x1830ea){_0x53b39f=_0x1830ea;_0x3287db=0xc8;}else{_0x3287db=0xce;}_0x23a3c1['status'](_0x3287db);return _0x23a3c1[_0xcb86('0x20')](_0xcb86('0x21'),_0x4d2531+'-'+_0x53b39f+'/'+_0x1830ea)[_0xcb86('0x1c')](_0x3a8e1f);}return null;};}function patchUpdates(_0x10cc45){return function(_0x39bdb0){try{jsonpatch[_0xcb86('0x22')](_0x39bdb0,_0x10cc45,!![]);}catch(_0x37f02b){return BPromise[_0xcb86('0x23')](_0x37f02b);}return _0x39bdb0['save']();};}function saveUpdates(_0x1ad8ab,_0x5b2f31){return function(_0x1ec12d){if(_0x1ec12d){return _0x1ec12d[_0xcb86('0x24')](_0x1ad8ab)[_0xcb86('0x25')](function(_0x3854c5){return _0x3854c5;});}return null;};}function removeEntity(_0x42be02,_0x70cbdd){return function(_0x10906d){if(_0x10906d){return _0x10906d['destroy']()[_0xcb86('0x25')](function(){_0x42be02[_0xcb86('0x1a')](0xcc)[_0xcb86('0x1b')]();});}};}function handleEntityNotFound(_0x31f7e2,_0x3a1685){return function(_0x29a988){if(!_0x29a988){_0x31f7e2[_0xcb86('0x19')](0x194);}return _0x29a988;};}function handleError(_0x3ce30e,_0x2e8e65){_0x2e8e65=_0x2e8e65||0x1f4;return function(_0x608bcb){logger[_0xcb86('0x26')](_0x608bcb[_0xcb86('0x27')]);if(_0x608bcb[_0xcb86('0x28')]){delete _0x608bcb[_0xcb86('0x28')];}_0x3ce30e[_0xcb86('0x1a')](_0x2e8e65)['send'](_0x608bcb);};}exports[_0xcb86('0x29')]=function(_0x4a27ae,_0x9e4375){var _0x5237f2={},_0x3ad160={},_0xccad5b={'count':0x0,'rows':[]};var _0x3d4d77=_[_0xcb86('0x2a')](db[_0xcb86('0x2b')]['rawAttributes'],function(_0x20079e){return{'name':_0x20079e['fieldName'],'type':_0x20079e[_0xcb86('0x2c')][_0xcb86('0x2d')]};});_0x3ad160['model']=_[_0xcb86('0x2a')](_0x3d4d77,'name');_0x3ad160[_0xcb86('0x2e')]=_[_0xcb86('0x2f')](_0x4a27ae['query']);_0x3ad160[_0xcb86('0x30')]=_[_0xcb86('0x31')](_0x3ad160[_0xcb86('0x32')],_0x3ad160[_0xcb86('0x2e')]);_0x3ad160[_0xcb86('0x30')]=_[_0xcb86('0x33')](_0x3ad160[_0xcb86('0x30')],[_0xcb86('0x34'),'$or',_0xcb86('0x35'),_0xcb86('0x36'),_0xcb86('0x37'),_0xcb86('0x38'),_0xcb86('0x39'),_0xcb86('0x3a'),'$not','$between','$notBetween','$in',_0xcb86('0x3b'),'$like',_0xcb86('0x3c'),'$iLike','$notILike',_0xcb86('0x3d'),_0xcb86('0x3e'),_0xcb86('0x3f'),'$contained',_0xcb86('0x40')]);_0x5237f2[_0xcb86('0x41')]=_['intersection'](_0x3ad160[_0xcb86('0x32')],qs[_0xcb86('0x42')](_0x4a27ae[_0xcb86('0x2e')][_0xcb86('0x42')]));_0x5237f2[_0xcb86('0x41')]=_0x5237f2['attributes'][_0xcb86('0x43')]?_0x5237f2[_0xcb86('0x41')]:_0x3ad160[_0xcb86('0x32')];if(!_0x4a27ae[_0xcb86('0x2e')][_0xcb86('0x44')](_0xcb86('0x45'))){_0x5237f2['limit']=qs['limit'](_0x4a27ae[_0xcb86('0x2e')]['limit']);_0x5237f2[_0xcb86('0x1e')]=qs[_0xcb86('0x1e')](_0x4a27ae[_0xcb86('0x2e')]['offset']);}_0x5237f2[_0xcb86('0x46')]=qs[_0xcb86('0x47')](_0x4a27ae[_0xcb86('0x2e')][_0xcb86('0x47')]);_0x5237f2[_0xcb86('0x48')]=qs[_0xcb86('0x30')](_[_0xcb86('0x49')](_0x4a27ae[_0xcb86('0x2e')],_0x3ad160[_0xcb86('0x30')]),_0x3d4d77);if(_0x4a27ae[_0xcb86('0x2e')][_0xcb86('0x4a')]){_0x5237f2['where']=_['merge'](_0x5237f2[_0xcb86('0x48')],{'$or':_[_0xcb86('0x2a')](_0x3d4d77,function(_0x41fa0d){if(_0x41fa0d[_0xcb86('0x2c')]!=='VIRTUAL'){var _0x208395={};_0x208395[_0x41fa0d['name']]={'$like':'%'+_0x4a27ae[_0xcb86('0x2e')][_0xcb86('0x4a')]+'%'};return _0x208395;}})});}_0x5237f2=_[_0xcb86('0x4b')]({},_0x5237f2,_0x4a27ae[_0xcb86('0x4c')]);var _0x53aed7={'where':_0x5237f2[_0xcb86('0x48')]};return db[_0xcb86('0x2b')][_0xcb86('0x1d')](_0x53aed7)[_0xcb86('0x25')](function(_0x27cd22){_0xccad5b[_0xcb86('0x1d')]=_0x27cd22;if(_0x4a27ae[_0xcb86('0x2e')]['includeAll']){_0x5237f2[_0xcb86('0x4d')]=[{'all':!![]}];}return db[_0xcb86('0x2b')]['findAll'](_0x5237f2);})[_0xcb86('0x25')](function(_0x4177ab){_0xccad5b['rows']=_0x4177ab;return _0xccad5b;})['then'](respondWithFilteredResult(_0x9e4375,_0x5237f2))['catch'](handleError(_0x9e4375,null));};exports[_0xcb86('0x4e')]=function(_0x19f5d0,_0x5d18e4){var _0x369d85={'raw':!![],'where':{'id':_0x19f5d0[_0xcb86('0x4f')]['id']}},_0x3df27c={};_0x3df27c[_0xcb86('0x32')]=_[_0xcb86('0x2f')](db[_0xcb86('0x2b')][_0xcb86('0x50')]);_0x3df27c[_0xcb86('0x2e')]=_['keys'](_0x19f5d0[_0xcb86('0x2e')]);_0x3df27c[_0xcb86('0x30')]=_[_0xcb86('0x31')](_0x3df27c['model'],_0x3df27c[_0xcb86('0x2e')]);_0x369d85[_0xcb86('0x41')]=_[_0xcb86('0x31')](_0x3df27c['model'],qs['fields'](_0x19f5d0['query'][_0xcb86('0x42')]));_0x369d85['attributes']=_0x369d85[_0xcb86('0x41')][_0xcb86('0x43')]?_0x369d85[_0xcb86('0x41')]:_0x3df27c[_0xcb86('0x32')];if(_0x19f5d0['query'][_0xcb86('0x51')]){_0x369d85['include']=[{'all':!![]}];}_0x369d85=_[_0xcb86('0x4b')]({},_0x369d85,_0x19f5d0[_0xcb86('0x4c')]);return db[_0xcb86('0x2b')][_0xcb86('0x52')](_0x369d85)[_0xcb86('0x25')](handleEntityNotFound(_0x5d18e4,null))[_0xcb86('0x25')](respondWithResult(_0x5d18e4,null))[_0xcb86('0x53')](handleError(_0x5d18e4,null));};exports[_0xcb86('0x54')]=function(_0x4a423d,_0x438de6){return db[_0xcb86('0x2b')][_0xcb86('0x54')](_0x4a423d[_0xcb86('0x55')],{})[_0xcb86('0x25')](respondWithResult(_0x438de6,0xc9))[_0xcb86('0x53')](handleError(_0x438de6,null));};exports[_0xcb86('0x24')]=function(_0x374701,_0x46e6eb){if(_0x374701['body']['id']){delete _0x374701[_0xcb86('0x55')]['id'];}return db['CmHopper'][_0xcb86('0x52')]({'where':{'id':_0x374701[_0xcb86('0x4f')]['id']}})[_0xcb86('0x25')](handleEntityNotFound(_0x46e6eb,null))[_0xcb86('0x25')](saveUpdates(_0x374701[_0xcb86('0x55')],null))[_0xcb86('0x25')](respondWithResult(_0x46e6eb,null))[_0xcb86('0x53')](handleError(_0x46e6eb,null));};exports[_0xcb86('0x56')]=function(_0x1abfed,_0x50f93d){return db[_0xcb86('0x2b')]['describe']()[_0xcb86('0x25')](respondWithResult(_0x50f93d,null))['catch'](handleError(_0x50f93d,null));};exports[_0xcb86('0x57')]=function(_0x4ce963,_0x52b0ab){var _0x3851dc;return db['CmHopper']['find']({'where':{'id':_0x4ce963[_0xcb86('0x4f')]['id']}})[_0xcb86('0x25')](handleEntityNotFound(_0x52b0ab,null))[_0xcb86('0x25')](function(_0x465d99){if(_0x465d99){return _0x465d99[_0xcb86('0x57')]()[_0xcb86('0x25')](function(_0x34b871){return _0x34b871;});}})[_0xcb86('0x25')](function(_0x378a0c){_0x3851dc=_0x378a0c;if(_0x378a0c){if(_0x378a0c[_0xcb86('0x58')]||_0x378a0c[_0xcb86('0x59')]){return db[_0x378a0c[_0xcb86('0x58')]?_0xcb86('0x5a'):'Campaign'][_0xcb86('0x52')]({'where':{'id':_0x378a0c[_0xcb86('0x58')]?_0x378a0c[_0xcb86('0x58')]:_0x378a0c[_0xcb86('0x59')]},'attributes':['id',_0xcb86('0x28')],'raw':!![]});}}})[_0xcb86('0x25')](function(_0x408164){var _0xf9403={};if(_0x408164){_[_0xcb86('0x4b')](_0xf9403,_[_0xcb86('0x5b')](_0x3851dc[_0xcb86('0x5c')],['createdAt','updatedAt','id']));_0xf9403[_0xcb86('0x5d')]=0x15;_0xf9403[_0xcb86('0x5e')]=_0xcb86('0x5f');_0xf9403[_0xcb86('0x60')]=_0x408164[_0xcb86('0x28')];_0xf9403[_0xcb86('0x61')]=_0x4ce963[_0xcb86('0x62')]['name'];_0xf9403[_0xcb86('0x63')]=_0x4ce963[_0xcb86('0x62')]['id'];_0xf9403[_0xcb86('0x5f')]=!![];_0xf9403[_0xcb86('0x64')]=moment()[_0xcb86('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0xf9403[_0xcb86('0x66')]=_0x3851dc['phone'];_0xf9403['campaigntype']=_0x3851dc[_0xcb86('0x58')]?_0xcb86('0x67'):_0xcb86('0x68');return db['CmContact']['find']({'where':{'id':_0xf9403[_0xcb86('0x69')]},'attributes':[_0xcb86('0x6a'),'lastName']})[_0xcb86('0x25')](function(_0xa18f5c){if(!_[_0xcb86('0x6b')](_0x52b0ab)&&!_[_0xcb86('0x6b')](_0xa18f5c[_0xcb86('0x6a')])){_0xf9403['calleridname']=_0xa18f5c[_0xcb86('0x6a')];if(!_[_0xcb86('0x6b')](_0xa18f5c[_0xcb86('0x6c')])){_0xf9403[_0xcb86('0x6d')]+='\x20'+_0xa18f5c[_0xcb86('0x6c')];}}})['finally'](function(){return db[_0xcb86('0x6e')][_0xcb86('0x54')](_0xf9403);});}})[_0xcb86('0x25')](function(){return _0x52b0ab[_0xcb86('0x1a')](0xcc)[_0xcb86('0x1b')]();})['catch'](handleError(_0x52b0ab,null));};exports['getPreview']=function(_0x596917,_0x5280d0,_0x4bcf4c){var _0x3ac3d7=[];return db[_0xcb86('0x6f')][_0xcb86('0x56')]()['then'](function(_0x43fb30){_0x3ac3d7=_[_0xcb86('0x2f')](_0x43fb30);return _0x596917[_0xcb86('0x62')]['getVoiceQueues']({'where':{'type':_0xcb86('0x70'),'dialActive':!![],'dialMethod':_0xcb86('0x71')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xcb86('0x25')](function(_0xabb869){if(_0xabb869&&_0xabb869[_0xcb86('0x43')]){return db[_0xcb86('0x72')][_0xcb86('0x73')](function(_0x468ae5){var _0x5f42ca={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcb86('0x65')](_0xcb86('0x74'))},'VoiceQueueId':{'$in':_[_0xcb86('0x2a')](_0xabb869,'id')},'$or':[{'UserId':null},{'UserId':_0x596917[_0xcb86('0x62')]['id']}]};var _0x38ecea=[];if(_0x596917[_0xcb86('0x55')][_0xcb86('0x75')]&&_0x596917['body'][_0xcb86('0x75')]===_0xcb86('0x76')){if(!_[_0xcb86('0x77')](_0x596917[_0xcb86('0x55')][_0xcb86('0x78')])){_0x5f42ca['id']={'$in':_0x596917['body'][_0xcb86('0x78')]};}_0x38ecea=[[_0xcb86('0x79'),_0xcb86('0x7a')],[_0xcb86('0x7b'),_0xabb869[0x0][_0xcb86('0x7c')]===_0xcb86('0x7a')?'DESC':'ASC'],db[_0xcb86('0x72')][_0xcb86('0x7d')](_0xcb86('0x7e')),['id',_0xcb86('0x7f')]];}else{if(!_[_0xcb86('0x77')](_0x596917[_0xcb86('0x55')][_0xcb86('0x78')])){_0x5f42ca['id']={'$notIn':_0x596917[_0xcb86('0x55')][_0xcb86('0x78')]};}_0x38ecea=[[_0xcb86('0x79'),_0xcb86('0x7f')],['scheduledAt',_0xabb869[0x0][_0xcb86('0x7c')]],db[_0xcb86('0x72')][_0xcb86('0x7d')](_0xcb86('0x80')),['id',_0xcb86('0x7a')]];}return db['CmHopper'][_0xcb86('0x81')]({'attributes':['id',_0xcb86('0x82')],'where':_0x5f42ca,'order':_0x38ecea,'transaction':_0x468ae5,'lock':_0x468ae5[_0xcb86('0x83')][_0xcb86('0x84')],'include':[{'model':db['CmContact'],'as':_0xcb86('0x85'),'attributes':_0x3ac3d7,'include':[{'model':db[_0xcb86('0x86')],'as':'Company','attributes':['id',_0xcb86('0x28')]}]},{'model':db[_0xcb86('0x87')],'as':_0xcb86('0x88'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xcb86('0x89'),'attributes':['id',_0xcb86('0x28'),'dialActive']}]})['then'](function(_0x4d8bbb){if(_0x4d8bbb){return _0x4d8bbb[_0xcb86('0x24')]({'UserId':_0x596917[_0xcb86('0x62')]['id']},{'transaction':_0x468ae5});}});});}})['then'](handleEntityNotFound(_0x5280d0,null))[_0xcb86('0x25')](respondWithResult(_0x5280d0,null))[_0xcb86('0x53')](handleError(_0x5280d0,null));};exports['getOpenContacts']=function(_0x29ccec,_0x4ec707,_0x8323d1){return _0x29ccec['user'][_0xcb86('0x8a')]({'where':{'type':_0xcb86('0x70'),'dialActive':!![],'dialMethod':_0xcb86('0x71')},'attributes':['id'],'raw':!![]})['then'](function(_0x584881){if(_0x584881&&_0x584881[_0xcb86('0x43')]){return db[_0xcb86('0x2b')][_0xcb86('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcb86('0x65')](_0xcb86('0x74'))},'VoiceQueueId':{'$in':_[_0xcb86('0x2a')](_0x584881,'id')},'$or':[{'UserId':null},{'UserId':_0x29ccec[_0xcb86('0x62')]['id']}]}});}return 0x0;})[_0xcb86('0x25')](function(_0x59fdc3){if(!_[_0xcb86('0x6b')](_0x59fdc3)&&_[_0xcb86('0x8b')](_0x59fdc3)){return _0x4ec707[_0xcb86('0x1a')](0xc8)[_0xcb86('0x1c')]({'contacts':_0x59fdc3});}else{logger[_0xcb86('0x26')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xcb86('0x8c'),0x194,_0xcb86('0x8d'));_0x4ec707['sendStatus'](0x194);}})['catch'](handleError(_0x4ec707,null));};exports[_0xcb86('0x8e')]=function(_0x568dc5,_0x32349f,_0x225777){var _0x5d33ff=shared['timezones'];var _0x154e97=[];_[_0xcb86('0x2a')](_0x5d33ff,function(_0x172177){_0x154e97[_0xcb86('0x8f')]({'id':_0x172177['name'],'name':_0x172177[_0xcb86('0x28')],'utcOffset':_0x172177['utcOffset']});});return _0x32349f['status'](0xc8)[_0xcb86('0x1c')]({'tz':_0x154e97});};exports['getTimezone']=function(_0x4c2cac,_0x32dd3d,_0x2d64a7){var _0x596efc=shared['timezones'];var _0x3e519d={};if(!_[_0xcb86('0x6b')](_0x596efc[_0x4c2cac[_0xcb86('0x55')]['id']]))_0x3e519d=_0x596efc[_0x4c2cac['body']['id']];return _0x32dd3d[_0xcb86('0x1a')](0xc8)[_0xcb86('0x1c')](_0x3e519d);}; \ No newline at end of file +var _0xa2d3=['limit','Content-Range','apply','reject','then','destroy','end','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$like','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','rows','params','includeAll','find','catch','create','body','update','describe','VoiceQueueId','VoiceQueue','CampaignId','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','getPreview','user','outbound','preview','transaction','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','UPDATE','Contact','CmCompany','Company','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','error','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/environment','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset'];(function(_0x305ab4,_0x1e71ef){var _0x128ef2=function(_0x1c685e){while(--_0x1c685e){_0x305ab4['push'](_0x305ab4['shift']());}};_0x128ef2(++_0x1e71ef);}(_0xa2d3,0x18e));var _0x3a2d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa2d3[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x3a2d('0x0'));var emlformat=require(_0x3a2d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3a2d('0x2'));var jsonpatch=require(_0x3a2d('0x3'));var rp=require(_0x3a2d('0x4'));var moment=require(_0x3a2d('0x5'));var BPromise=require(_0x3a2d('0x6'));var Mustache=require(_0x3a2d('0x7'));var util=require(_0x3a2d('0x8'));var path=require(_0x3a2d('0x9'));var sox=require('sox');var csv=require(_0x3a2d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a2d('0xb'));var squel=require('squel');var crypto=require(_0x3a2d('0xc'));var jsforce=require(_0x3a2d('0xd'));var deskjs=require(_0x3a2d('0xe'));var toCsv=require(_0x3a2d('0xa'));var querystring=require(_0x3a2d('0xf'));var Papa=require('papaparse');var Redis=require(_0x3a2d('0x10'));var shared=require(_0x3a2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3a2d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a2d('0x13'));var logger=require(_0x3a2d('0x14'))(_0x3a2d('0x15'));var utils=require(_0x3a2d('0x16'));var config=require(_0x3a2d('0x11'));var db=require(_0x3a2d('0x17'))['db'];function respondWithStatusCode(_0x2b8495,_0x3a02fb){_0x3a02fb=_0x3a02fb||0xcc;return function(_0x643e8c){if(_0x643e8c){return _0x2b8495[_0x3a2d('0x18')](_0x3a02fb);}return _0x2b8495[_0x3a2d('0x19')](_0x3a02fb)['end']();};}function respondWithResult(_0x49c577,_0x5c2fd7){_0x5c2fd7=_0x5c2fd7||0xc8;return function(_0x4410cc){if(_0x4410cc){return _0x49c577[_0x3a2d('0x19')](_0x5c2fd7)[_0x3a2d('0x1a')](_0x4410cc);}};}function respondWithFilteredResult(_0xfedf0f,_0x32fd25){return function(_0x11d18b){if(_0x11d18b){var _0x43f5da=_0x11d18b['count'],_0x4466cf=_0x32fd25[_0x3a2d('0x1b')],_0x3a0db4=_0x32fd25['offset']+_0x32fd25[_0x3a2d('0x1c')],_0x256819;if(_0x3a0db4>=_0x43f5da){_0x3a0db4=_0x43f5da;_0x256819=0xc8;}else{_0x256819=0xce;}_0xfedf0f[_0x3a2d('0x19')](_0x256819);return _0xfedf0f['set'](_0x3a2d('0x1d'),_0x4466cf+'-'+_0x3a0db4+'/'+_0x43f5da)[_0x3a2d('0x1a')](_0x11d18b);}return null;};}function patchUpdates(_0x47e82e){return function(_0x539c5f){try{jsonpatch[_0x3a2d('0x1e')](_0x539c5f,_0x47e82e,!![]);}catch(_0x25475f){return BPromise[_0x3a2d('0x1f')](_0x25475f);}return _0x539c5f['save']();};}function saveUpdates(_0x959c72,_0x5c7cd1){return function(_0x37dbe4){if(_0x37dbe4){return _0x37dbe4['update'](_0x959c72)[_0x3a2d('0x20')](function(_0x4db048){return _0x4db048;});}return null;};}function removeEntity(_0x17d220,_0x557d24){return function(_0x2535b7){if(_0x2535b7){return _0x2535b7[_0x3a2d('0x21')]()[_0x3a2d('0x20')](function(){_0x17d220['status'](0xcc)[_0x3a2d('0x22')]();});}};}function handleEntityNotFound(_0x3e95fa,_0x1ee824){return function(_0x4543a5){if(!_0x4543a5){_0x3e95fa['sendStatus'](0x194);}return _0x4543a5;};}function handleError(_0x1ca1a3,_0x3ce479){_0x3ce479=_0x3ce479||0x1f4;return function(_0x15bd69){logger['error'](_0x15bd69[_0x3a2d('0x23')]);if(_0x15bd69[_0x3a2d('0x24')]){delete _0x15bd69['name'];}_0x1ca1a3[_0x3a2d('0x19')](_0x3ce479)['send'](_0x15bd69);};}exports[_0x3a2d('0x25')]=function(_0x4c9e6d,_0x4e241){var _0x1e1214={},_0x15745e={},_0x3a7ab6={'count':0x0,'rows':[]};var _0x5ab59a=_[_0x3a2d('0x26')](db[_0x3a2d('0x27')][_0x3a2d('0x28')],function(_0xcd3c17){return{'name':_0xcd3c17[_0x3a2d('0x29')],'type':_0xcd3c17[_0x3a2d('0x2a')][_0x3a2d('0x2b')]};});_0x15745e[_0x3a2d('0x2c')]=_[_0x3a2d('0x26')](_0x5ab59a,'name');_0x15745e[_0x3a2d('0x2d')]=_[_0x3a2d('0x2e')](_0x4c9e6d[_0x3a2d('0x2d')]);_0x15745e[_0x3a2d('0x2f')]=_['intersection'](_0x15745e['model'],_0x15745e['query']);_0x15745e[_0x3a2d('0x2f')]=_[_0x3a2d('0x30')](_0x15745e[_0x3a2d('0x2f')],[_0x3a2d('0x31'),_0x3a2d('0x32'),_0x3a2d('0x33'),'$gte',_0x3a2d('0x34'),_0x3a2d('0x35'),_0x3a2d('0x36'),_0x3a2d('0x37'),_0x3a2d('0x38'),'$between',_0x3a2d('0x39'),'$in','$notIn',_0x3a2d('0x3a'),'$notLike','$iLike','$notILike',_0x3a2d('0x3a'),_0x3a2d('0x3b'),'$contains',_0x3a2d('0x3c'),_0x3a2d('0x3d')]);_0x1e1214[_0x3a2d('0x3e')]=_[_0x3a2d('0x3f')](_0x15745e[_0x3a2d('0x2c')],qs[_0x3a2d('0x40')](_0x4c9e6d[_0x3a2d('0x2d')][_0x3a2d('0x40')]));_0x1e1214[_0x3a2d('0x3e')]=_0x1e1214[_0x3a2d('0x3e')][_0x3a2d('0x41')]?_0x1e1214[_0x3a2d('0x3e')]:_0x15745e[_0x3a2d('0x2c')];if(!_0x4c9e6d[_0x3a2d('0x2d')][_0x3a2d('0x42')](_0x3a2d('0x43'))){_0x1e1214[_0x3a2d('0x1c')]=qs[_0x3a2d('0x1c')](_0x4c9e6d[_0x3a2d('0x2d')][_0x3a2d('0x1c')]);_0x1e1214[_0x3a2d('0x1b')]=qs[_0x3a2d('0x1b')](_0x4c9e6d[_0x3a2d('0x2d')]['offset']);}_0x1e1214[_0x3a2d('0x44')]=qs[_0x3a2d('0x45')](_0x4c9e6d['query'][_0x3a2d('0x45')]);_0x1e1214[_0x3a2d('0x46')]=qs[_0x3a2d('0x2f')](_[_0x3a2d('0x47')](_0x4c9e6d[_0x3a2d('0x2d')],_0x15745e['filters']),_0x5ab59a);if(_0x4c9e6d['query'][_0x3a2d('0x48')]){_0x1e1214[_0x3a2d('0x46')]=_[_0x3a2d('0x49')](_0x1e1214['where'],{'$or':_[_0x3a2d('0x26')](_0x5ab59a,function(_0x15f2b8){if(_0x15f2b8['type']!=='VIRTUAL'){var _0x3734da={};_0x3734da[_0x15f2b8['name']]={'$like':'%'+_0x4c9e6d['query']['filter']+'%'};return _0x3734da;}})});}_0x1e1214=_[_0x3a2d('0x49')]({},_0x1e1214,_0x4c9e6d[_0x3a2d('0x4a')]);var _0x3ad26c={'where':_0x1e1214[_0x3a2d('0x46')]};return db[_0x3a2d('0x27')][_0x3a2d('0x4b')](_0x3ad26c)[_0x3a2d('0x20')](function(_0x137434){_0x3a7ab6['count']=_0x137434;if(_0x4c9e6d[_0x3a2d('0x2d')]['includeAll']){_0x1e1214['include']=[{'all':!![]}];}return db[_0x3a2d('0x27')]['findAll'](_0x1e1214);})[_0x3a2d('0x20')](function(_0xa77cfb){_0x3a7ab6[_0x3a2d('0x4c')]=_0xa77cfb;return _0x3a7ab6;})[_0x3a2d('0x20')](respondWithFilteredResult(_0x4e241,_0x1e1214))['catch'](handleError(_0x4e241,null));};exports['show']=function(_0x50f924,_0x11ccd5){var _0x1a8080={'raw':!![],'where':{'id':_0x50f924[_0x3a2d('0x4d')]['id']}},_0xb9c56={};_0xb9c56[_0x3a2d('0x2c')]=_['keys'](db['CmHopper'][_0x3a2d('0x28')]);_0xb9c56[_0x3a2d('0x2d')]=_['keys'](_0x50f924[_0x3a2d('0x2d')]);_0xb9c56[_0x3a2d('0x2f')]=_[_0x3a2d('0x3f')](_0xb9c56[_0x3a2d('0x2c')],_0xb9c56['query']);_0x1a8080[_0x3a2d('0x3e')]=_[_0x3a2d('0x3f')](_0xb9c56[_0x3a2d('0x2c')],qs[_0x3a2d('0x40')](_0x50f924['query']['fields']));_0x1a8080[_0x3a2d('0x3e')]=_0x1a8080[_0x3a2d('0x3e')][_0x3a2d('0x41')]?_0x1a8080[_0x3a2d('0x3e')]:_0xb9c56[_0x3a2d('0x2c')];if(_0x50f924[_0x3a2d('0x2d')][_0x3a2d('0x4e')]){_0x1a8080['include']=[{'all':!![]}];}_0x1a8080=_[_0x3a2d('0x49')]({},_0x1a8080,_0x50f924[_0x3a2d('0x4a')]);return db[_0x3a2d('0x27')][_0x3a2d('0x4f')](_0x1a8080)['then'](handleEntityNotFound(_0x11ccd5,null))['then'](respondWithResult(_0x11ccd5,null))[_0x3a2d('0x50')](handleError(_0x11ccd5,null));};exports[_0x3a2d('0x51')]=function(_0x108089,_0x426e83){return db[_0x3a2d('0x27')][_0x3a2d('0x51')](_0x108089[_0x3a2d('0x52')],{})[_0x3a2d('0x20')](respondWithResult(_0x426e83,0xc9))[_0x3a2d('0x50')](handleError(_0x426e83,null));};exports[_0x3a2d('0x53')]=function(_0x407830,_0x37a46a){if(_0x407830[_0x3a2d('0x52')]['id']){delete _0x407830['body']['id'];}return db[_0x3a2d('0x27')][_0x3a2d('0x4f')]({'where':{'id':_0x407830[_0x3a2d('0x4d')]['id']}})[_0x3a2d('0x20')](handleEntityNotFound(_0x37a46a,null))[_0x3a2d('0x20')](saveUpdates(_0x407830[_0x3a2d('0x52')],null))['then'](respondWithResult(_0x37a46a,null))[_0x3a2d('0x50')](handleError(_0x37a46a,null));};exports[_0x3a2d('0x54')]=function(_0x4410c9,_0x59bac5){return db[_0x3a2d('0x27')][_0x3a2d('0x54')]()[_0x3a2d('0x20')](respondWithResult(_0x59bac5,null))['catch'](handleError(_0x59bac5,null));};exports[_0x3a2d('0x21')]=function(_0x357401,_0x5e8db7){var _0x22f0a0;return db[_0x3a2d('0x27')][_0x3a2d('0x4f')]({'where':{'id':_0x357401[_0x3a2d('0x4d')]['id']}})[_0x3a2d('0x20')](handleEntityNotFound(_0x5e8db7,null))['then'](function(_0x44f26f){if(_0x44f26f){return _0x44f26f['destroy']()[_0x3a2d('0x20')](function(_0x4773bf){return _0x4773bf;});}})['then'](function(_0x360133){_0x22f0a0=_0x360133;if(_0x360133){if(_0x360133[_0x3a2d('0x55')]||_0x360133['CampaignId']){return db[_0x360133['VoiceQueueId']?_0x3a2d('0x56'):'Campaign']['find']({'where':{'id':_0x360133[_0x3a2d('0x55')]?_0x360133[_0x3a2d('0x55')]:_0x360133[_0x3a2d('0x57')]},'attributes':['id',_0x3a2d('0x24')],'raw':!![]});}}})[_0x3a2d('0x20')](function(_0x473bdc){var _0x14b2a8={};if(_0x473bdc){_[_0x3a2d('0x49')](_0x14b2a8,_['omit'](_0x22f0a0[_0x3a2d('0x58')],[_0x3a2d('0x59'),_0x3a2d('0x5a'),'id']));_0x14b2a8['state']=0x15;_0x14b2a8[_0x3a2d('0x5b')]=_0x3a2d('0x5c');_0x14b2a8[_0x3a2d('0x5d')]=_0x473bdc[_0x3a2d('0x24')];_0x14b2a8[_0x3a2d('0x5e')]=_0x357401['user'][_0x3a2d('0x24')];_0x14b2a8[_0x3a2d('0x5f')]=_0x357401['user']['id'];_0x14b2a8[_0x3a2d('0x5c')]=!![];_0x14b2a8[_0x3a2d('0x60')]=moment()[_0x3a2d('0x61')](_0x3a2d('0x62'));_0x14b2a8[_0x3a2d('0x63')]=_0x22f0a0['phone'];_0x14b2a8[_0x3a2d('0x64')]=_0x22f0a0[_0x3a2d('0x55')]?_0x3a2d('0x65'):'ivr';return db[_0x3a2d('0x66')]['find']({'where':{'id':_0x14b2a8[_0x3a2d('0x67')]},'attributes':['firstName',_0x3a2d('0x68')]})['then'](function(_0x400323){if(!_[_0x3a2d('0x69')](_0x5e8db7)&&!_[_0x3a2d('0x69')](_0x400323[_0x3a2d('0x6a')])){_0x14b2a8[_0x3a2d('0x6b')]=_0x400323['firstName'];if(!_['isNil'](_0x400323['lastName'])){_0x14b2a8['calleridname']+='\x20'+_0x400323[_0x3a2d('0x68')];}}})['finally'](function(){return db[_0x3a2d('0x6c')][_0x3a2d('0x51')](_0x14b2a8);});}})[_0x3a2d('0x20')](function(){return _0x5e8db7[_0x3a2d('0x19')](0xcc)[_0x3a2d('0x22')]();})[_0x3a2d('0x50')](handleError(_0x5e8db7,null));};exports[_0x3a2d('0x6d')]=function(_0x1053d7,_0x307000,_0x121a0b){var _0x117ad9=[];return db[_0x3a2d('0x66')]['describe']()[_0x3a2d('0x20')](function(_0x329ff3){_0x117ad9=_[_0x3a2d('0x2e')](_0x329ff3);return _0x1053d7[_0x3a2d('0x6e')]['getVoiceQueues']({'where':{'type':_0x3a2d('0x6f'),'dialActive':!![],'dialMethod':_0x3a2d('0x70')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0xcec196){if(_0xcec196&&_0xcec196[_0x3a2d('0x41')]){return db['sequelize'][_0x3a2d('0x71')](function(_0x9cc9e6){var _0x1b7448={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3a2d('0x61')](_0x3a2d('0x62'))},'VoiceQueueId':{'$in':_[_0x3a2d('0x26')](_0xcec196,'id')},'$or':[{'UserId':null},{'UserId':_0x1053d7['user']['id']}]};var _0x1c02c0=[];if(_0x1053d7[_0x3a2d('0x52')]['direction']&&_0x1053d7[_0x3a2d('0x52')][_0x3a2d('0x72')]===_0x3a2d('0x73')){if(!_[_0x3a2d('0x74')](_0x1053d7['body'][_0x3a2d('0x75')])){_0x1b7448['id']={'$in':_0x1053d7[_0x3a2d('0x52')][_0x3a2d('0x75')]};}_0x1c02c0=[['priority',_0x3a2d('0x76')],[_0x3a2d('0x77'),_0xcec196[0x0][_0x3a2d('0x78')]===_0x3a2d('0x76')?_0x3a2d('0x79'):_0x3a2d('0x76')],db['sequelize'][_0x3a2d('0x7a')](_0x3a2d('0x7b')),['id',_0x3a2d('0x79')]];}else{if(!_['isEmpty'](_0x1053d7['body'][_0x3a2d('0x75')])){_0x1b7448['id']={'$notIn':_0x1053d7[_0x3a2d('0x52')][_0x3a2d('0x75')]};}_0x1c02c0=[[_0x3a2d('0x7c'),_0x3a2d('0x79')],['scheduledAt',_0xcec196[0x0][_0x3a2d('0x78')]],db['sequelize']['literal'](_0x3a2d('0x7d')),['id',_0x3a2d('0x76')]];}return db[_0x3a2d('0x27')]['findOne']({'attributes':['id','scheduledat'],'where':_0x1b7448,'order':_0x1c02c0,'transaction':_0x9cc9e6,'lock':_0x9cc9e6['LOCK'][_0x3a2d('0x7e')],'include':[{'model':db['CmContact'],'as':_0x3a2d('0x7f'),'attributes':_0x117ad9,'include':[{'model':db[_0x3a2d('0x80')],'as':_0x3a2d('0x81'),'attributes':['id',_0x3a2d('0x24')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x3a2d('0x24')]},{'model':db[_0x3a2d('0x56')],'as':_0x3a2d('0x82'),'attributes':['id',_0x3a2d('0x24'),_0x3a2d('0x83')]}]})[_0x3a2d('0x20')](function(_0x311d31){if(_0x311d31){return _0x311d31[_0x3a2d('0x53')]({'UserId':_0x1053d7['user']['id']},{'transaction':_0x9cc9e6});}});});}})['then'](handleEntityNotFound(_0x307000,null))[_0x3a2d('0x20')](respondWithResult(_0x307000,null))[_0x3a2d('0x50')](handleError(_0x307000,null));};exports[_0x3a2d('0x84')]=function(_0x4483fe,_0x4ea2c4,_0x3faaa7){return _0x4483fe['user'][_0x3a2d('0x85')]({'where':{'type':_0x3a2d('0x6f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x3a2d('0x20')](function(_0x360e38){if(_0x360e38&&_0x360e38['length']){return db[_0x3a2d('0x27')][_0x3a2d('0x4b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3a2d('0x61')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x3a2d('0x26')](_0x360e38,'id')},'$or':[{'UserId':null},{'UserId':_0x4483fe[_0x3a2d('0x6e')]['id']}]}});}return 0x0;})[_0x3a2d('0x20')](function(_0x17797e){if(!_[_0x3a2d('0x69')](_0x17797e)&&_[_0x3a2d('0x86')](_0x17797e)){return _0x4ea2c4[_0x3a2d('0x19')](0xc8)[_0x3a2d('0x1a')]({'contacts':_0x17797e});}else{logger[_0x3a2d('0x87')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3a2d('0x84'),0x194,_0x3a2d('0x88'));_0x4ea2c4[_0x3a2d('0x18')](0x194);}})['catch'](handleError(_0x4ea2c4,null));};exports[_0x3a2d('0x89')]=function(_0x11155c,_0x1cbe9b,_0x3fbd44){var _0x2512c3=shared['timezones'];var _0x2d16ac=[];_[_0x3a2d('0x26')](_0x2512c3,function(_0x4189c0){_0x2d16ac[_0x3a2d('0x8a')]({'id':_0x4189c0['name'],'name':_0x4189c0[_0x3a2d('0x24')],'utcOffset':_0x4189c0[_0x3a2d('0x8b')]});});return _0x1cbe9b[_0x3a2d('0x19')](0xc8)[_0x3a2d('0x1a')]({'tz':_0x2d16ac});};exports[_0x3a2d('0x8c')]=function(_0x59369e,_0x55d664,_0x67fffd){var _0xd0b091=shared[_0x3a2d('0x8d')];var _0x1c681f={};if(!_[_0x3a2d('0x69')](_0xd0b091[_0x59369e[_0x3a2d('0x52')]['id']]))_0x1c681f=_0xd0b091[_0x59369e['body']['id']];return _0x55d664[_0x3a2d('0x19')](0xc8)['json'](_0x1c681f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8aca3c7..612ff16 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 _0xf2ee=['../../config/environment','./cmHopper.attributes','exports','CmHopper','scheduledat','phone','priority','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5dd00f,_0x5985a6){var _0x18b4e0=function(_0x48635e){while(--_0x48635e){_0x5dd00f['push'](_0x5dd00f['shift']());}};_0x18b4e0(++_0x5985a6);}(_0xf2ee,0xf5));var _0xef2e=function(_0x1b466c,_0x38b3d4){_0x1b466c=_0x1b466c-0x0;var _0x37e696=_0xf2ee[_0x1b466c];return _0x37e696;};'use strict';var _=require(_0xef2e('0x0'));var util=require(_0xef2e('0x1'));var logger=require('../../config/logger')(_0xef2e('0x2'));var moment=require('moment');var BPromise=require(_0xef2e('0x3'));var rp=require(_0xef2e('0x4'));var fs=require('fs');var path=require(_0xef2e('0x5'));var rimraf=require(_0xef2e('0x6'));var config=require(_0xef2e('0x7'));var attributes=require(_0xef2e('0x8'));module[_0xef2e('0x9')]=function(_0xe9cc2,_0x486d2a){return _0xe9cc2['define'](_0xef2e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xef2e('0xb'),'fields':['scheduledat']},{'name':_0xef2e('0xc'),'fields':[_0xef2e('0xc')]},{'name':_0xef2e('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x07bc=['exports','define','cm_hopper','scheduledat','phone','lodash','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07bc,0xb0));var _0xc07b=function(_0x2106ce,_0x155c44){_0x2106ce=_0x2106ce-0x0;var _0x1cf99d=_0x07bc[_0x2106ce];return _0x1cf99d;};'use strict';var _=require(_0xc07b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc07b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc07b('0x2'));var rimraf=require(_0xc07b('0x3'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0xc07b('0x4')]=function(_0x238b50,_0x5519eb){return _0x238b50[_0xc07b('0x5')]('CmHopper',attributes,{'tableName':_0xc07b('0x6'),'paranoid':![],'indexes':[{'name':_0xc07b('0x7'),'fields':[_0xc07b('0x7')]},{'name':_0xc07b('0x8'),'fields':[_0xc07b('0x8')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 55ed540..48517fb 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 _0xa739=['error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','model','map','debug','catch','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','limit','order','LOCK','UPDATE','CmContact','Contact','keys','User','name','voicePause','length','includes','UserId','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','all','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4a1227,_0x352964){var _0x180001=function(_0x8300b4){while(--_0x8300b4){_0x4a1227['push'](_0x4a1227['shift']());}};_0x180001(++_0x352964);}(_0xa739,0x1e5));var _0x9a73=function(_0x47bd3d,_0xbd635b){_0x47bd3d=_0x47bd3d-0x0;var _0x33da3d=_0xa739[_0x47bd3d];return _0x33da3d;};'use strict';var _=require(_0x9a73('0x0'));var util=require(_0x9a73('0x1'));var moment=require('moment');var BPromise=require(_0x9a73('0x2'));var rs=require(_0x9a73('0x3'));var fs=require('fs');var Redis=require(_0x9a73('0x4'));var db=require(_0x9a73('0x5'))['db'];var utils=require(_0x9a73('0x6'));var logger=require(_0x9a73('0x7'))(_0x9a73('0x8'));var config=require(_0x9a73('0x9'));var jayson=require(_0x9a73('0xa'));var client=jayson[_0x9a73('0xb')][_0x9a73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fd254,_0x494aa3,_0x1064d7){return new BPromise(function(_0x5d06d9,_0x528d70){return client[_0x9a73('0xd')](_0x3fd254,_0x1064d7)[_0x9a73('0xe')](function(_0x4aaad2){logger[_0x9a73('0xf')](_0x9a73('0x10'),_0x494aa3,_0x9a73('0x11'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x494aa3,_0x9a73('0x11'),JSON[_0x9a73('0x12')](_0x4aaad2));if(_0x4aaad2[_0x9a73('0x13')]){if(_0x4aaad2['error'][_0x9a73('0x14')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x494aa3,_0x4aaad2[_0x9a73('0x13')][_0x9a73('0x15')]);return _0x528d70(_0x4aaad2['error'][_0x9a73('0x15')]);}logger[_0x9a73('0x13')](_0x9a73('0x10'),_0x494aa3,_0x4aaad2['error'][_0x9a73('0x15')]);return _0x5d06d9(_0x4aaad2[_0x9a73('0x13')][_0x9a73('0x15')]);}else{logger[_0x9a73('0xf')](_0x9a73('0x10'),_0x494aa3,_0x9a73('0x11'));_0x5d06d9(_0x4aaad2[_0x9a73('0x16')][_0x9a73('0x15')]);}})['catch'](function(_0x5a5fa5){logger[_0x9a73('0x13')](_0x9a73('0x10'),_0x494aa3,_0x5a5fa5);_0x528d70(_0x5a5fa5);});});}exports[_0x9a73('0x17')]=function(_0x24de38){var _0x252743=this;return new Promise(function(_0x17f004,_0x197031){return db[_0x9a73('0x18')][_0x9a73('0x19')]({'raw':_0x24de38[_0x9a73('0x1a')]?_0x24de38[_0x9a73('0x1a')][_0x9a73('0x1b')]===undefined?!![]:![]:!![],'where':_0x24de38['options']?_0x24de38[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'attributes':_0x24de38[_0x9a73('0x1a')]?_0x24de38['options'][_0x9a73('0x1d')]||null:null,'limit':_0x24de38[_0x9a73('0x1a')]?_0x24de38[_0x9a73('0x1a')]['limit']||null:null,'include':_0x24de38['options']?_0x24de38[_0x9a73('0x1a')][_0x9a73('0x1e')]?_['map'](_0x24de38['options'][_0x9a73('0x1e')],function(_0x4583d4){return{'model':db[_0x4583d4[_0x9a73('0x1f')]],'as':_0x4583d4['as'],'attributes':_0x4583d4[_0x9a73('0x1d')],'include':_0x4583d4[_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x4583d4[_0x9a73('0x1e')],function(_0x40ad11){return{'model':db[_0x40ad11['model']],'as':_0x40ad11['as'],'attributes':_0x40ad11[_0x9a73('0x1d')],'include':_0x40ad11[_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x40ad11[_0x9a73('0x1e')],function(_0x11c48b){return{'model':db[_0x11c48b['model']],'as':_0x11c48b['as'],'attributes':_0x11c48b[_0x9a73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a73('0xe')](function(_0x386476){logger[_0x9a73('0xf')](_0x9a73('0x17'),_0x24de38);logger[_0x9a73('0x21')](_0x9a73('0x17'),_0x24de38,JSON['stringify'](_0x386476));_0x17f004(_0x386476);})[_0x9a73('0x22')](function(_0x59757d){logger[_0x9a73('0x13')](_0x9a73('0x17'),_0x59757d[_0x9a73('0x15')],_0x24de38);_0x197031(_0x252743[_0x9a73('0x13')](0x1f4,_0x59757d['message']));});});};exports[_0x9a73('0x23')]=function(_0xcb0445){var _0x1b895f=this;return new Promise(function(_0x42fbb6,_0x5287b9){return db['CmHopper'][_0x9a73('0x24')]({'raw':_0xcb0445[_0x9a73('0x1a')]?_0xcb0445[_0x9a73('0x1a')][_0x9a73('0x1b')]===undefined?!![]:![]:!![],'where':_0xcb0445[_0x9a73('0x1a')]?_0xcb0445[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'attributes':_0xcb0445[_0x9a73('0x1a')]?_0xcb0445[_0x9a73('0x1a')][_0x9a73('0x1d')]||null:null,'include':_0xcb0445[_0x9a73('0x1a')]?_0xcb0445[_0x9a73('0x1a')][_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0xcb0445[_0x9a73('0x1a')][_0x9a73('0x1e')],function(_0x307ffb){return{'model':db[_0x307ffb['model']],'as':_0x307ffb['as'],'attributes':_0x307ffb[_0x9a73('0x1d')],'include':_0x307ffb[_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x307ffb['include'],function(_0x30b9e3){return{'model':db[_0x30b9e3[_0x9a73('0x1f')]],'as':_0x30b9e3['as'],'attributes':_0x30b9e3[_0x9a73('0x1d')],'include':_0x30b9e3['include']?_[_0x9a73('0x20')](_0x30b9e3['include'],function(_0x186dee){return{'model':db[_0x186dee[_0x9a73('0x1f')]],'as':_0x186dee['as'],'attributes':_0x186dee[_0x9a73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a73('0xe')](function(_0x5b50d8){logger['info'](_0x9a73('0x23'),_0xcb0445);logger['debug'](_0x9a73('0x23'),_0xcb0445,JSON[_0x9a73('0x12')](_0x5b50d8));_0x42fbb6(_0x5b50d8);})[_0x9a73('0x22')](function(_0x15e1c6){logger[_0x9a73('0x13')](_0x9a73('0x23'),_0x15e1c6[_0x9a73('0x15')],_0xcb0445);_0x5287b9(_0x1b895f['error'](0x1f4,_0x15e1c6[_0x9a73('0x15')]));});});};exports[_0x9a73('0x25')]=function(_0x49cdd2){var _0x357d06=this;return new Promise(function(_0x4c49ae,_0x1f2209){return db[_0x9a73('0x18')][_0x9a73('0x26')](_0x49cdd2['body'],{'raw':_0x49cdd2[_0x9a73('0x1a')]?_0x49cdd2['options']['raw']===undefined?!![]:![]:!![]})[_0x9a73('0xe')](function(_0x197476){logger[_0x9a73('0xf')](_0x9a73('0x25'),_0x49cdd2);logger[_0x9a73('0x21')](_0x9a73('0x25'),_0x49cdd2,JSON[_0x9a73('0x12')](_0x197476));_0x4c49ae(_0x197476);})[_0x9a73('0x22')](function(_0x52e7c2){logger['error'](_0x9a73('0x25'),_0x52e7c2[_0x9a73('0x15')],_0x49cdd2);_0x1f2209(_0x357d06[_0x9a73('0x13')](0x1f4,_0x52e7c2['message']));});});};exports[_0x9a73('0x27')]=function(_0x4869d7){var _0x4f8905=this;return new Promise(function(_0x345f6d,_0x4220ca){return db['CmHopper'][_0x9a73('0x28')](_0x4869d7[_0x9a73('0x29')],{'raw':_0x4869d7[_0x9a73('0x1a')]?_0x4869d7[_0x9a73('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4869d7[_0x9a73('0x1a')]?_0x4869d7['options'][_0x9a73('0x1c')]||null:null,'attributes':_0x4869d7[_0x9a73('0x1a')]?_0x4869d7[_0x9a73('0x1a')][_0x9a73('0x1d')]||null:null,'limit':_0x4869d7[_0x9a73('0x1a')]?_0x4869d7[_0x9a73('0x1a')]['limit']||null:null})[_0x9a73('0xe')](function(_0xb237f4){logger[_0x9a73('0xf')](_0x9a73('0x27'),_0x4869d7);logger[_0x9a73('0x21')](_0x9a73('0x27'),_0x4869d7,JSON[_0x9a73('0x12')](_0xb237f4));_0x345f6d(_0xb237f4);})['catch'](function(_0xbba6b2){logger[_0x9a73('0x13')](_0x9a73('0x27'),_0xbba6b2[_0x9a73('0x15')],_0x4869d7);_0x4220ca(_0x4f8905[_0x9a73('0x13')](0x1f4,_0xbba6b2[_0x9a73('0x15')]));});});};exports[_0x9a73('0x2a')]=function(_0x47c2e7){var _0x5c83fb=this;return new Promise(function(_0x5cee4f,_0x5524f4){return db[_0x9a73('0x18')][_0x9a73('0x2b')]({'where':_0x47c2e7['options']?_0x47c2e7[_0x9a73('0x1a')]['where']||null:null})[_0x9a73('0xe')](function(_0x17d9ef){logger['info']('DestroyCmHopper',_0x47c2e7);logger[_0x9a73('0x21')](_0x9a73('0x2a'),_0x47c2e7,JSON['stringify'](_0x17d9ef));_0x5cee4f(_0x17d9ef);})[_0x9a73('0x22')](function(_0x3be99b){logger['error']('DestroyCmHopper',_0x3be99b['message'],_0x47c2e7);_0x5524f4(_0x5c83fb['error'](0x1f4,_0x3be99b[_0x9a73('0x15')]));});});};exports[_0x9a73('0x2c')]=function(_0x39fd5c){var _0xd4a59e=this;return new Promise(function(_0x1bb4c8,_0x6587cd){return db['CmContact'][_0x9a73('0x2d')]()[_0x9a73('0xe')](function(_0x54a269){return db[_0x9a73('0x2e')][_0x9a73('0x2f')](function(_0x2843da){return db['CmHopper'][_0x9a73('0x19')]({'where':_0x39fd5c[_0x9a73('0x1a')]?_0x39fd5c[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'attributes':_0x39fd5c['options']?_0x39fd5c['options'][_0x9a73('0x1d')]||null:null,'limit':_0x39fd5c[_0x9a73('0x1a')]?_0x39fd5c[_0x9a73('0x1a')][_0x9a73('0x30')]||null:null,'order':_0x39fd5c[_0x9a73('0x1a')]?_0x39fd5c[_0x9a73('0x1a')][_0x9a73('0x31')]||null:null,'transaction':_0x2843da,'lock':_0x2843da[_0x9a73('0x32')][_0x9a73('0x33')],'include':[{'model':db[_0x9a73('0x34')],'as':_0x9a73('0x35'),'attributes':_[_0x9a73('0x36')](_0x54a269)},{'model':db[_0x9a73('0x37')],'as':'Agent','attributes':['id',_0x9a73('0x38'),_0x9a73('0x39')]}]})[_0x9a73('0xe')](function(_0x33eb0e){var _0x1cd755=[];var _0x5386b6=[];for(var _0x186a16=0x0;_0x186a16<_0x33eb0e[_0x9a73('0x3a')];_0x186a16+=0x1){if(!_0x5386b6[_0x9a73('0x3b')](_0x33eb0e[_0x186a16][_0x9a73('0x3c')])){_0x5386b6[_0x9a73('0x3d')](_0x33eb0e[_0x186a16][_0x9a73('0x3c')]);_0x1cd755[_0x9a73('0x3d')](_0x33eb0e[_0x186a16]['update'](_0x39fd5c[_0x9a73('0x29')],{'transaction':_0x2843da}));}}return BPromise['all'](_0x1cd755);});})[_0x9a73('0xe')](function(_0x7c60f6){logger[_0x9a73('0xf')](_0x9a73('0x2c'),_0x39fd5c);logger[_0x9a73('0x21')](_0x9a73('0x2c'),_0x39fd5c,JSON[_0x9a73('0x12')](_0x7c60f6));_0x1bb4c8(_0x7c60f6);})[_0x9a73('0x22')](function(_0x57df76){logger['error'](_0x9a73('0x2c'),_0x57df76['message'],_0x39fd5c);_0x6587cd(_0xd4a59e[_0x9a73('0x13')](0x1f4,_0x57df76[_0x9a73('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x567cac){var _0x1cdbda=this;return new Promise(function(_0x390e1e,_0x21a410){return db[_0x9a73('0x2e')][_0x9a73('0x2f')](function(_0x4c8837){return db[_0x9a73('0x3e')][_0x9a73('0x26')](_0x567cac[_0x9a73('0x29')],{'raw':_0x567cac[_0x9a73('0x1a')]?_0x567cac[_0x9a73('0x1a')][_0x9a73('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x4c8837})[_0x9a73('0xe')](function(){return db[_0x9a73('0x18')][_0x9a73('0x2b')]({'where':_0x567cac[_0x9a73('0x1a')]?_0x567cac[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'transaction':_0x4c8837});});})[_0x9a73('0xe')](function(_0x3dc575){logger[_0x9a73('0xf')](_0x9a73('0x3f'),_0x567cac);logger['debug'](_0x9a73('0x3f'),_0x567cac,JSON['stringify'](_0x3dc575));_0x390e1e(_0x3dc575);})['catch'](function(_0x25728f){logger[_0x9a73('0x13')]('MoveContactManagedDialer',_0x25728f[_0x9a73('0x15')],_0x567cac);_0x21a410(_0x1cdbda[_0x9a73('0x13')](0x1f4,_0x25728f['message']));});});};exports[_0x9a73('0x40')]=function(_0x538c58){var _0x22ee90=this;return new Promise(function(_0x190287,_0x1bf455){return db[_0x9a73('0x18')][_0x9a73('0x19')]({'raw':_0x538c58[_0x9a73('0x1a')]?_0x538c58[_0x9a73('0x1a')][_0x9a73('0x1b')]===undefined?!![]:![]:!![],'where':_0x538c58[_0x9a73('0x1a')]?_0x538c58[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x9a73('0x2e')]['fn']('IF',db[_0x9a73('0x2e')][_0x9a73('0x41')](_0x9a73('0x42')+util[_0x9a73('0x43')]('\x22%s\x22',moment()[_0x9a73('0x43')](_0x9a73('0x44')))+_0x9a73('0x45')))),'contactsRescheduled']]})[_0x9a73('0xe')](function(_0x13c271){logger[_0x9a73('0xf')](_0x9a73('0x40'),_0x538c58);logger[_0x9a73('0x21')](_0x9a73('0x40'),_0x538c58,JSON['stringify'](_0x13c271));_0x190287(_0x13c271);})[_0x9a73('0x22')](function(_0x54a264){logger[_0x9a73('0x13')](_0x9a73('0x40'),_0x54a264[_0x9a73('0x15')],_0x538c58);_0x1bf455(_0x22ee90[_0x9a73('0x13')](0x1f4,_0x54a264['message']));});});};exports[_0x9a73('0x46')]=function(_0x151c66){var _0x3cb676=this;return new Promise(function(_0x490032,_0x53f729){return db['CmContact'][_0x9a73('0x2d')]()['then'](function(_0x15bf7b){return db[_0x9a73('0x2e')][_0x9a73('0x2f')](function(_0x3f2fee){return db[_0x9a73('0x18')]['findAll']({'where':_0x151c66[_0x9a73('0x1a')]?_0x151c66[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'attributes':_0x151c66[_0x9a73('0x1a')]?_0x151c66[_0x9a73('0x1a')]['attributes']||null:null,'limit':0x1,'order':_0x151c66['options']?_0x151c66[_0x9a73('0x1a')][_0x9a73('0x31')]||null:null,'group':db[_0x9a73('0x18')][_0x9a73('0x3c')],'transaction':_0x3f2fee,'lock':_0x3f2fee[_0x9a73('0x32')][_0x9a73('0x33')],'include':_0x151c66[_0x9a73('0x1a')]?_0x151c66[_0x9a73('0x1a')][_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x151c66[_0x9a73('0x1a')][_0x9a73('0x1e')],function(_0x32f1){return{'model':db[_0x32f1['model']],'as':_0x32f1['as'],'attributes':_0x32f1[_0x9a73('0x1d')],'include':_0x32f1[_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x32f1[_0x9a73('0x1e')],function(_0x3b401a){return{'model':db[_0x3b401a[_0x9a73('0x1f')]],'as':_0x3b401a['as'],'attributes':_0x3b401a[_0x9a73('0x1d')],'include':_0x3b401a[_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x3b401a[_0x9a73('0x1e')],function(_0x47ee50){return{'model':db[_0x47ee50[_0x9a73('0x1f')]],'as':_0x47ee50['as'],'attributes':_0x47ee50['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x648019){var _0x1ecf3b=[];for(var _0x48ef56=0x0;_0x48ef56<_0x648019[_0x9a73('0x3a')];_0x48ef56+=0x1){_0x1ecf3b['push'](_0x648019[_0x48ef56][_0x9a73('0x28')](_0x151c66[_0x9a73('0x29')],{'transaction':_0x3f2fee}));}return BPromise[_0x9a73('0x47')](_0x1ecf3b);});})[_0x9a73('0xe')](function(_0x12fc92){logger[_0x9a73('0xf')](_0x9a73('0x46'),_0x151c66);logger[_0x9a73('0x21')](_0x9a73('0x46'),_0x151c66,JSON[_0x9a73('0x12')](_0x12fc92));_0x490032(_0x12fc92);})[_0x9a73('0x22')](function(_0x16ad14){logger[_0x9a73('0x13')](_0x9a73('0x46'),_0x16ad14[_0x9a73('0x15')],_0x151c66);_0x53f729(_0x3cb676['error'](0x1f4,_0x16ad14[_0x9a73('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x32da42){var _0x59abca=this;return new Promise(function(_0x3480f5,_0x257896){db[_0x9a73('0x34')][_0x9a73('0x2d')]()[_0x9a73('0xe')](function(_0x28c9b2){return db[_0x9a73('0x18')][_0x9a73('0x19')]({'raw':_0x32da42[_0x9a73('0x1a')]?_0x32da42[_0x9a73('0x1a')][_0x9a73('0x1b')]===undefined?!![]:![]:!![],'where':_0x32da42[_0x9a73('0x1a')]?_0x32da42[_0x9a73('0x1a')][_0x9a73('0x1c')]||null:null,'attributes':_0x32da42['options']?_0x32da42['options']['attributes']||null:null,'limit':_0x32da42[_0x9a73('0x1a')]?_0x32da42[_0x9a73('0x1a')][_0x9a73('0x30')]||null:null,'include':_0x32da42[_0x9a73('0x1a')]?_0x32da42[_0x9a73('0x1a')][_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x32da42[_0x9a73('0x1a')][_0x9a73('0x1e')],function(_0x40c44c){return{'model':db[_0x40c44c[_0x9a73('0x1f')]],'as':_0x40c44c['as'],'attributes':_0x40c44c['as']===_0x9a73('0x35')?_[_0x9a73('0x36')](_0x28c9b2):_0x40c44c[_0x9a73('0x1d')],'include':_0x40c44c[_0x9a73('0x1e')]?_[_0x9a73('0x20')](_0x40c44c['include'],function(_0x5d0ae8){return{'model':db[_0x5d0ae8[_0x9a73('0x1f')]],'as':_0x5d0ae8['as'],'attributes':_0x5d0ae8[_0x9a73('0x1d')],'include':_0x5d0ae8['include']?_[_0x9a73('0x20')](_0x5d0ae8[_0x9a73('0x1e')],function(_0x48c7fc){return{'model':db[_0x48c7fc[_0x9a73('0x1f')]],'as':_0x48c7fc['as'],'attributes':_0x48c7fc[_0x9a73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a73('0xe')](function(_0x225569){logger['info']('GetCmHopper',_0x32da42);logger[_0x9a73('0x21')]('GetCmHopper',_0x32da42,JSON['stringify'](_0x225569));_0x3480f5(_0x225569);})['catch'](function(_0x464a1b){logger[_0x9a73('0x13')]('GetCmHopper',_0x464a1b['message'],_0x32da42);_0x257896(_0x59abca[_0x9a73('0x13')](0x1f4,_0x464a1b['message']));});});});}; \ No newline at end of file +var _0x1c8a=['result','catch','CmHopper','findAll','options','where','attributes','limit','include','map','model','info','GetCmHopper','ShowCmHopper','raw','CreateCmHopper','body','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','includes','UserId','push','update','all','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','length','GetCmHopperPreview','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4da6c6,_0x4c8aa5){var _0x2e39ac=function(_0x1845ca){while(--_0x1845ca){_0x4da6c6['push'](_0x4da6c6['shift']());}};_0x2e39ac(++_0x4c8aa5);}(_0x1c8a,0xbc));var _0xa1c8=function(_0x54fbcb,_0x21a10f){_0x54fbcb=_0x54fbcb-0x0;var _0x58e047=_0x1c8a[_0x54fbcb];return _0x58e047;};'use strict';var _=require('lodash');var util=require(_0xa1c8('0x0'));var moment=require('moment');var BPromise=require(_0xa1c8('0x1'));var rs=require(_0xa1c8('0x2'));var fs=require('fs');var Redis=require(_0xa1c8('0x3'));var db=require(_0xa1c8('0x4'))['db'];var utils=require(_0xa1c8('0x5'));var logger=require(_0xa1c8('0x6'))(_0xa1c8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa1c8('0x8')][_0xa1c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16ecfa,_0x413ffe,_0xcdbcfd){return new BPromise(function(_0x2bef9d,_0x161d93){return client[_0xa1c8('0xa')](_0x16ecfa,_0xcdbcfd)[_0xa1c8('0xb')](function(_0x1c62ad){logger['info'](_0xa1c8('0xc'),_0x413ffe,_0xa1c8('0xd'));logger[_0xa1c8('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x413ffe,_0xa1c8('0xd'),JSON[_0xa1c8('0xf')](_0x1c62ad));if(_0x1c62ad['error']){if(_0x1c62ad[_0xa1c8('0x10')][_0xa1c8('0x11')]===0x1f4){logger[_0xa1c8('0x10')](_0xa1c8('0xc'),_0x413ffe,_0x1c62ad[_0xa1c8('0x10')][_0xa1c8('0x12')]);return _0x161d93(_0x1c62ad['error'][_0xa1c8('0x12')]);}logger[_0xa1c8('0x10')](_0xa1c8('0xc'),_0x413ffe,_0x1c62ad['error'][_0xa1c8('0x12')]);return _0x2bef9d(_0x1c62ad[_0xa1c8('0x10')]['message']);}else{logger['info'](_0xa1c8('0xc'),_0x413ffe,_0xa1c8('0xd'));_0x2bef9d(_0x1c62ad[_0xa1c8('0x13')]['message']);}})[_0xa1c8('0x14')](function(_0x5e9895){logger[_0xa1c8('0x10')]('CmHopper,\x20%s,\x20%s',_0x413ffe,_0x5e9895);_0x161d93(_0x5e9895);});});}exports['GetCmHopper']=function(_0x5ed08f){var _0x17c6d0=this;return new Promise(function(_0x3d370b,_0x4c2f5f){return db[_0xa1c8('0x15')][_0xa1c8('0x16')]({'raw':_0x5ed08f[_0xa1c8('0x17')]?_0x5ed08f[_0xa1c8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5ed08f[_0xa1c8('0x17')]?_0x5ed08f[_0xa1c8('0x17')][_0xa1c8('0x18')]||null:null,'attributes':_0x5ed08f[_0xa1c8('0x17')]?_0x5ed08f[_0xa1c8('0x17')][_0xa1c8('0x19')]||null:null,'limit':_0x5ed08f['options']?_0x5ed08f['options'][_0xa1c8('0x1a')]||null:null,'include':_0x5ed08f['options']?_0x5ed08f[_0xa1c8('0x17')][_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x5ed08f[_0xa1c8('0x17')][_0xa1c8('0x1b')],function(_0x1b6d2b){return{'model':db[_0x1b6d2b['model']],'as':_0x1b6d2b['as'],'attributes':_0x1b6d2b[_0xa1c8('0x19')],'include':_0x1b6d2b[_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x1b6d2b[_0xa1c8('0x1b')],function(_0x3908c2){return{'model':db[_0x3908c2[_0xa1c8('0x1d')]],'as':_0x3908c2['as'],'attributes':_0x3908c2[_0xa1c8('0x19')],'include':_0x3908c2[_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x3908c2['include'],function(_0xb5fefc){return{'model':db[_0xb5fefc['model']],'as':_0xb5fefc['as'],'attributes':_0xb5fefc[_0xa1c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa1c8('0xb')](function(_0x84956d){logger[_0xa1c8('0x1e')](_0xa1c8('0x1f'),_0x5ed08f);logger[_0xa1c8('0xe')](_0xa1c8('0x1f'),_0x5ed08f,JSON[_0xa1c8('0xf')](_0x84956d));_0x3d370b(_0x84956d);})[_0xa1c8('0x14')](function(_0x326e5d){logger['error'](_0xa1c8('0x1f'),_0x326e5d['message'],_0x5ed08f);_0x4c2f5f(_0x17c6d0[_0xa1c8('0x10')](0x1f4,_0x326e5d[_0xa1c8('0x12')]));});});};exports[_0xa1c8('0x20')]=function(_0x2b1d20){var _0x58e689=this;return new Promise(function(_0x5b3c3b,_0x5d1e21){return db[_0xa1c8('0x15')]['find']({'raw':_0x2b1d20[_0xa1c8('0x17')]?_0x2b1d20[_0xa1c8('0x17')][_0xa1c8('0x21')]===undefined?!![]:![]:!![],'where':_0x2b1d20[_0xa1c8('0x17')]?_0x2b1d20['options'][_0xa1c8('0x18')]||null:null,'attributes':_0x2b1d20[_0xa1c8('0x17')]?_0x2b1d20[_0xa1c8('0x17')]['attributes']||null:null,'include':_0x2b1d20[_0xa1c8('0x17')]?_0x2b1d20[_0xa1c8('0x17')][_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x2b1d20[_0xa1c8('0x17')]['include'],function(_0x3d59e6){return{'model':db[_0x3d59e6['model']],'as':_0x3d59e6['as'],'attributes':_0x3d59e6[_0xa1c8('0x19')],'include':_0x3d59e6['include']?_[_0xa1c8('0x1c')](_0x3d59e6[_0xa1c8('0x1b')],function(_0x3d1ec5){return{'model':db[_0x3d1ec5['model']],'as':_0x3d1ec5['as'],'attributes':_0x3d1ec5[_0xa1c8('0x19')],'include':_0x3d1ec5['include']?_['map'](_0x3d1ec5[_0xa1c8('0x1b')],function(_0x104d91){return{'model':db[_0x104d91[_0xa1c8('0x1d')]],'as':_0x104d91['as'],'attributes':_0x104d91[_0xa1c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa1c8('0xb')](function(_0x46027e){logger[_0xa1c8('0x1e')]('ShowCmHopper',_0x2b1d20);logger[_0xa1c8('0xe')](_0xa1c8('0x20'),_0x2b1d20,JSON[_0xa1c8('0xf')](_0x46027e));_0x5b3c3b(_0x46027e);})[_0xa1c8('0x14')](function(_0x3b0040){logger[_0xa1c8('0x10')](_0xa1c8('0x20'),_0x3b0040['message'],_0x2b1d20);_0x5d1e21(_0x58e689['error'](0x1f4,_0x3b0040[_0xa1c8('0x12')]));});});};exports[_0xa1c8('0x22')]=function(_0x76394e){var _0x5d5dd6=this;return new Promise(function(_0x24f4b4,_0x57366f){return db[_0xa1c8('0x15')]['create'](_0x76394e[_0xa1c8('0x23')],{'raw':_0x76394e[_0xa1c8('0x17')]?_0x76394e[_0xa1c8('0x17')][_0xa1c8('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x2173bc){logger[_0xa1c8('0x1e')](_0xa1c8('0x22'),_0x76394e);logger[_0xa1c8('0xe')](_0xa1c8('0x22'),_0x76394e,JSON[_0xa1c8('0xf')](_0x2173bc));_0x24f4b4(_0x2173bc);})[_0xa1c8('0x14')](function(_0x31dca3){logger[_0xa1c8('0x10')](_0xa1c8('0x22'),_0x31dca3[_0xa1c8('0x12')],_0x76394e);_0x57366f(_0x5d5dd6[_0xa1c8('0x10')](0x1f4,_0x31dca3[_0xa1c8('0x12')]));});});};exports['UpdateCmHopper']=function(_0x389771){var _0x5cfe96=this;return new Promise(function(_0x3ebf2a,_0x2fa657){return db[_0xa1c8('0x15')]['update'](_0x389771[_0xa1c8('0x23')],{'raw':_0x389771[_0xa1c8('0x17')]?_0x389771[_0xa1c8('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389771[_0xa1c8('0x17')]?_0x389771['options'][_0xa1c8('0x18')]||null:null,'attributes':_0x389771[_0xa1c8('0x17')]?_0x389771[_0xa1c8('0x17')]['attributes']||null:null,'limit':_0x389771['options']?_0x389771['options'][_0xa1c8('0x1a')]||null:null})['then'](function(_0x5c56a1){logger['info'](_0xa1c8('0x24'),_0x389771);logger[_0xa1c8('0xe')](_0xa1c8('0x24'),_0x389771,JSON['stringify'](_0x5c56a1));_0x3ebf2a(_0x5c56a1);})[_0xa1c8('0x14')](function(_0x555dfc){logger[_0xa1c8('0x10')](_0xa1c8('0x24'),_0x555dfc['message'],_0x389771);_0x2fa657(_0x5cfe96[_0xa1c8('0x10')](0x1f4,_0x555dfc[_0xa1c8('0x12')]));});});};exports['DestroyCmHopper']=function(_0x1ae6df){var _0x415ac7=this;return new Promise(function(_0x1ce238,_0x4c7f84){return db['CmHopper'][_0xa1c8('0x25')]({'where':_0x1ae6df[_0xa1c8('0x17')]?_0x1ae6df[_0xa1c8('0x17')][_0xa1c8('0x18')]||null:null})[_0xa1c8('0xb')](function(_0x5a7c26){logger[_0xa1c8('0x1e')]('DestroyCmHopper',_0x1ae6df);logger[_0xa1c8('0xe')](_0xa1c8('0x26'),_0x1ae6df,JSON[_0xa1c8('0xf')](_0x5a7c26));_0x1ce238(_0x5a7c26);})[_0xa1c8('0x14')](function(_0x50c75d){logger[_0xa1c8('0x10')]('DestroyCmHopper',_0x50c75d[_0xa1c8('0x12')],_0x1ae6df);_0x4c7f84(_0x415ac7['error'](0x1f4,_0x50c75d[_0xa1c8('0x12')]));});});};exports[_0xa1c8('0x27')]=function(_0x56ad17){var _0x3d01af=this;return new Promise(function(_0x4dafde,_0x5df916){return db[_0xa1c8('0x28')][_0xa1c8('0x29')]()['then'](function(_0xb62cbe){return db[_0xa1c8('0x2a')][_0xa1c8('0x2b')](function(_0x4119b2){return db['CmHopper'][_0xa1c8('0x16')]({'where':_0x56ad17['options']?_0x56ad17[_0xa1c8('0x17')][_0xa1c8('0x18')]||null:null,'attributes':_0x56ad17['options']?_0x56ad17[_0xa1c8('0x17')][_0xa1c8('0x19')]||null:null,'limit':_0x56ad17['options']?_0x56ad17[_0xa1c8('0x17')]['limit']||null:null,'order':_0x56ad17['options']?_0x56ad17['options'][_0xa1c8('0x2c')]||null:null,'transaction':_0x4119b2,'lock':_0x4119b2[_0xa1c8('0x2d')][_0xa1c8('0x2e')],'include':[{'model':db['CmContact'],'as':_0xa1c8('0x2f'),'attributes':_['keys'](_0xb62cbe)},{'model':db[_0xa1c8('0x30')],'as':'Agent','attributes':['id','name','voicePause']}]})[_0xa1c8('0xb')](function(_0x9661b9){var _0x315c97=[];var _0xc3619e=[];for(var _0x19eeb6=0x0;_0x19eeb6<_0x9661b9['length'];_0x19eeb6+=0x1){if(!_0xc3619e[_0xa1c8('0x31')](_0x9661b9[_0x19eeb6][_0xa1c8('0x32')])){_0xc3619e[_0xa1c8('0x33')](_0x9661b9[_0x19eeb6][_0xa1c8('0x32')]);_0x315c97[_0xa1c8('0x33')](_0x9661b9[_0x19eeb6][_0xa1c8('0x34')](_0x56ad17[_0xa1c8('0x23')],{'transaction':_0x4119b2}));}}return BPromise[_0xa1c8('0x35')](_0x315c97);});})[_0xa1c8('0xb')](function(_0x5b852f){logger[_0xa1c8('0x1e')](_0xa1c8('0x27'),_0x56ad17);logger[_0xa1c8('0xe')](_0xa1c8('0x27'),_0x56ad17,JSON[_0xa1c8('0xf')](_0x5b852f));_0x4dafde(_0x5b852f);})['catch'](function(_0x2de6be){logger[_0xa1c8('0x10')]('GetContactDialer',_0x2de6be[_0xa1c8('0x12')],_0x56ad17);_0x5df916(_0x3d01af[_0xa1c8('0x10')](0x1f4,_0x2de6be[_0xa1c8('0x12')]));});});});};exports[_0xa1c8('0x36')]=function(_0x20ef5b){var _0x3ea996=this;return new Promise(function(_0x204154,_0x1ca187){return db[_0xa1c8('0x2a')]['transaction'](function(_0x2ec96e){return db[_0xa1c8('0x37')][_0xa1c8('0x38')](_0x20ef5b[_0xa1c8('0x23')],{'raw':_0x20ef5b[_0xa1c8('0x17')]?_0x20ef5b['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x2ec96e})[_0xa1c8('0xb')](function(){return db['CmHopper'][_0xa1c8('0x25')]({'where':_0x20ef5b['options']?_0x20ef5b['options'][_0xa1c8('0x18')]||null:null,'transaction':_0x2ec96e});});})[_0xa1c8('0xb')](function(_0xe968a5){logger[_0xa1c8('0x1e')](_0xa1c8('0x36'),_0x20ef5b);logger['debug'](_0xa1c8('0x36'),_0x20ef5b,JSON[_0xa1c8('0xf')](_0xe968a5));_0x204154(_0xe968a5);})[_0xa1c8('0x14')](function(_0x4855ea){logger[_0xa1c8('0x10')](_0xa1c8('0x36'),_0x4855ea['message'],_0x20ef5b);_0x1ca187(_0x3ea996[_0xa1c8('0x10')](0x1f4,_0x4855ea[_0xa1c8('0x12')]));});});};exports[_0xa1c8('0x39')]=function(_0x2c2155){var _0x3babd5=this;return new Promise(function(_0x555a9c,_0x2a9e16){return db[_0xa1c8('0x15')]['findAll']({'raw':_0x2c2155[_0xa1c8('0x17')]?_0x2c2155[_0xa1c8('0x17')][_0xa1c8('0x21')]===undefined?!![]:![]:!![],'where':_0x2c2155[_0xa1c8('0x17')]?_0x2c2155['options']['where']||null:null,'attributes':[[db[_0xa1c8('0x2a')]['fn'](_0xa1c8('0x3a'),db['sequelize']['fn']('IF',db[_0xa1c8('0x2a')][_0xa1c8('0x3b')](_0xa1c8('0x3c')+util[_0xa1c8('0x3d')](_0xa1c8('0x3e'),moment()[_0xa1c8('0x3d')](_0xa1c8('0x3f')))+_0xa1c8('0x40')))),_0xa1c8('0x41')]]})[_0xa1c8('0xb')](function(_0x4461d4){logger[_0xa1c8('0x1e')](_0xa1c8('0x39'),_0x2c2155);logger[_0xa1c8('0xe')](_0xa1c8('0x39'),_0x2c2155,JSON[_0xa1c8('0xf')](_0x4461d4));_0x555a9c(_0x4461d4);})[_0xa1c8('0x14')](function(_0x3f6946){logger[_0xa1c8('0x10')](_0xa1c8('0x39'),_0x3f6946[_0xa1c8('0x12')],_0x2c2155);_0x2a9e16(_0x3babd5['error'](0x1f4,_0x3f6946[_0xa1c8('0x12')]));});});};exports[_0xa1c8('0x42')]=function(_0x18638a){var _0x1da53e=this;return new Promise(function(_0x2c41f5,_0x539da7){return db[_0xa1c8('0x28')]['describe']()[_0xa1c8('0xb')](function(_0x9c50d4){return db[_0xa1c8('0x2a')][_0xa1c8('0x2b')](function(_0x4979f0){return db[_0xa1c8('0x15')]['findAll']({'where':_0x18638a[_0xa1c8('0x17')]?_0x18638a[_0xa1c8('0x17')][_0xa1c8('0x18')]||null:null,'attributes':_0x18638a[_0xa1c8('0x17')]?_0x18638a[_0xa1c8('0x17')][_0xa1c8('0x19')]||null:null,'limit':0x1,'order':_0x18638a[_0xa1c8('0x17')]?_0x18638a[_0xa1c8('0x17')][_0xa1c8('0x2c')]||null:null,'group':db[_0xa1c8('0x15')][_0xa1c8('0x32')],'transaction':_0x4979f0,'lock':_0x4979f0[_0xa1c8('0x2d')][_0xa1c8('0x2e')],'include':_0x18638a[_0xa1c8('0x17')]?_0x18638a[_0xa1c8('0x17')][_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x18638a[_0xa1c8('0x17')][_0xa1c8('0x1b')],function(_0x6f7e32){return{'model':db[_0x6f7e32[_0xa1c8('0x1d')]],'as':_0x6f7e32['as'],'attributes':_0x6f7e32['attributes'],'include':_0x6f7e32[_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x6f7e32[_0xa1c8('0x1b')],function(_0xb55c71){return{'model':db[_0xb55c71[_0xa1c8('0x1d')]],'as':_0xb55c71['as'],'attributes':_0xb55c71[_0xa1c8('0x19')],'include':_0xb55c71[_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0xb55c71['include'],function(_0x1a63c2){return{'model':db[_0x1a63c2[_0xa1c8('0x1d')]],'as':_0x1a63c2['as'],'attributes':_0x1a63c2[_0xa1c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa1c8('0xb')](function(_0x8e62f3){var _0x1599bf=[];for(var _0x297685=0x0;_0x297685<_0x8e62f3[_0xa1c8('0x43')];_0x297685+=0x1){_0x1599bf[_0xa1c8('0x33')](_0x8e62f3[_0x297685][_0xa1c8('0x34')](_0x18638a[_0xa1c8('0x23')],{'transaction':_0x4979f0}));}return BPromise[_0xa1c8('0x35')](_0x1599bf);});})[_0xa1c8('0xb')](function(_0x9ee728){logger[_0xa1c8('0x1e')](_0xa1c8('0x42'),_0x18638a);logger[_0xa1c8('0xe')]('GetContactRecallMe',_0x18638a,JSON[_0xa1c8('0xf')](_0x9ee728));_0x2c41f5(_0x9ee728);})[_0xa1c8('0x14')](function(_0x2544b6){logger['error'](_0xa1c8('0x42'),_0x2544b6[_0xa1c8('0x12')],_0x18638a);_0x539da7(_0x1da53e[_0xa1c8('0x10')](0x1f4,_0x2544b6[_0xa1c8('0x12')]));});});});};exports[_0xa1c8('0x44')]=function(_0x388b3f){var _0x10b29d=this;return new Promise(function(_0x232fc1,_0x513e20){db['CmContact']['describe']()['then'](function(_0x25fd36){return db[_0xa1c8('0x15')]['findAll']({'raw':_0x388b3f['options']?_0x388b3f[_0xa1c8('0x17')][_0xa1c8('0x21')]===undefined?!![]:![]:!![],'where':_0x388b3f[_0xa1c8('0x17')]?_0x388b3f[_0xa1c8('0x17')][_0xa1c8('0x18')]||null:null,'attributes':_0x388b3f[_0xa1c8('0x17')]?_0x388b3f['options'][_0xa1c8('0x19')]||null:null,'limit':_0x388b3f[_0xa1c8('0x17')]?_0x388b3f[_0xa1c8('0x17')][_0xa1c8('0x1a')]||null:null,'include':_0x388b3f[_0xa1c8('0x17')]?_0x388b3f[_0xa1c8('0x17')][_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x388b3f[_0xa1c8('0x17')][_0xa1c8('0x1b')],function(_0x2176af){return{'model':db[_0x2176af[_0xa1c8('0x1d')]],'as':_0x2176af['as'],'attributes':_0x2176af['as']===_0xa1c8('0x2f')?_['keys'](_0x25fd36):_0x2176af[_0xa1c8('0x19')],'include':_0x2176af[_0xa1c8('0x1b')]?_[_0xa1c8('0x1c')](_0x2176af['include'],function(_0x161871){return{'model':db[_0x161871[_0xa1c8('0x1d')]],'as':_0x161871['as'],'attributes':_0x161871[_0xa1c8('0x19')],'include':_0x161871['include']?_[_0xa1c8('0x1c')](_0x161871[_0xa1c8('0x1b')],function(_0x3ab9d1){return{'model':db[_0x3ab9d1['model']],'as':_0x3ab9d1['as'],'attributes':_0x3ab9d1[_0xa1c8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x586d3d){logger[_0xa1c8('0x1e')]('GetCmHopper',_0x388b3f);logger[_0xa1c8('0xe')](_0xa1c8('0x1f'),_0x388b3f,JSON[_0xa1c8('0xf')](_0x586d3d));_0x232fc1(_0x586d3d);})['catch'](function(_0x45d7e8){logger[_0xa1c8('0x10')](_0xa1c8('0x1f'),_0x45d7e8['message'],_0x388b3f);_0x513e20(_0x10b29d['error'](0x1f4,_0x45d7e8[_0xa1c8('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 51d3896..825341b 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 _0x7fbe=['/timezone','getTimezone','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','create','/preview','getPreview'];(function(_0x56d1b7,_0x1d88f5){var _0x184d91=function(_0x123bdb){while(--_0x123bdb){_0x56d1b7['push'](_0x56d1b7['shift']());}};_0x184d91(++_0x1d88f5);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x533676,_0x2be01c){_0x533676=_0x533676-0x0;var _0x32f7bd=_0x7fbe[_0x533676];return _0x32f7bd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/timezones',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0x8')](_0xe7fb('0xf'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x11')](_0xe7fb('0x13'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x11')](_0xe7fb('0x15'),auth['isAuthenticated'](),controller[_0xe7fb('0x16')]);router[_0xe7fb('0x17')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x18')]);router['delete'](_0xe7fb('0xf'),auth['isAuthenticated'](),controller[_0xe7fb('0x19')]);module[_0xe7fb('0x1a')]=router; \ No newline at end of file +var _0x4b84=['multer','util','express','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','getOpenContacts','/timezones','getTimezones','/:id','show','post','/preview','getPreview','/timezone','put','update','delete'];(function(_0x3624b2,_0x922660){var _0x577bd1=function(_0x3ea848){while(--_0x3ea848){_0x3624b2['push'](_0x3624b2['shift']());}};_0x577bd1(++_0x922660);}(_0x4b84,0x1cc));var _0x44b8=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4b84[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/opencontacts',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x6')](_0x44b8('0x9'),auth['isAuthenticated'](),controller[_0x44b8('0xa')]);router[_0x44b8('0x6')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')]('/',auth[_0x44b8('0x7')](),controller['create']);router[_0x44b8('0xd')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0xf')]);router['post'](_0x44b8('0x10'),auth[_0x44b8('0x7')](),controller['getTimezone']);router[_0x44b8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x12')]);router[_0x44b8('0x13')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index fd3745d..6e82834 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeba7=['moment','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x16a547,_0x27ab64){var _0x2055ed=function(_0x5c89ce){while(--_0x5c89ce){_0x16a547['push'](_0x16a547['shift']());}};_0x2055ed(++_0x27ab64);}(_0xeba7,0x8c));var _0x7eba=function(_0x50839b,_0x506df0){_0x50839b=_0x50839b-0x0;var _0x11507a=_0xeba7[_0x50839b];return _0x11507a;};'use strict';var moment=require(_0x7eba('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x7eba('0x1')]},'phone':{'type':Sequelize[_0x7eba('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7eba('0x3')](_0x7eba('0x4'))},'countbusyretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7eba('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf1b=['format','YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER','STRING'];(function(_0x54c516,_0x420575){var _0x2583c0=function(_0x4171e4){while(--_0x4171e4){_0x54c516['push'](_0x54c516['shift']());}};_0x2583c0(++_0x420575);}(_0xdf1b,0x142));var _0xbdf1=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0xdf1b[_0x8560d3];return _0x33b1b5;};'use strict';var moment=require(_0xbdf1('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xbdf1('0x1')]},'phone':{'type':Sequelize[_0xbdf1('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xbdf1('0x3')](_0xbdf1('0x4'))},'countbusyretry':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbdf1('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 10d1d9c..6afaa46 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2d3=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','reject','save','update','destroy','CmHopperAdditionalPhones','UserProfileResource','then','end','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x1f9d0f,_0x343128){var _0x2f37f4=function(_0x1aa9ab){while(--_0x1aa9ab){_0x1f9d0f['push'](_0x1f9d0f['shift']());}};_0x2f37f4(++_0x343128);}(_0xe2d3,0xa9));var _0x3e2d=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xe2d3[_0x574617];return _0x29de90;};'use strict';var pdf=require(_0x3e2d('0x0'));var emlformat=require(_0x3e2d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e2d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e2d('0x3'));var moment=require(_0x3e2d('0x4'));var BPromise=require(_0x3e2d('0x5'));var Mustache=require(_0x3e2d('0x6'));var util=require(_0x3e2d('0x7'));var path=require(_0x3e2d('0x8'));var sox=require(_0x3e2d('0x9'));var csv=require(_0x3e2d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e2d('0xb'));var squel=require(_0x3e2d('0xc'));var crypto=require(_0x3e2d('0xd'));var jsforce=require(_0x3e2d('0xe'));var deskjs=require(_0x3e2d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3e2d('0x10'));var Papa=require(_0x3e2d('0x11'));var Redis=require(_0x3e2d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3e2d('0x13'));var as=require(_0x3e2d('0x14'));var hardwareService=require(_0x3e2d('0x15'));var logger=require(_0x3e2d('0x16'))(_0x3e2d('0x17'));var utils=require(_0x3e2d('0x18'));var config=require('../../config/environment');var db=require(_0x3e2d('0x19'))['db'];function respondWithStatusCode(_0x55b8ef,_0x17a371){_0x17a371=_0x17a371||0xcc;return function(_0x6b6c39){if(_0x6b6c39){return _0x55b8ef[_0x3e2d('0x1a')](_0x17a371);}return _0x55b8ef[_0x3e2d('0x1b')](_0x17a371)['end']();};}function respondWithResult(_0xd1c8c1,_0x44ac11){_0x44ac11=_0x44ac11||0xc8;return function(_0x18c68b){if(_0x18c68b){return _0xd1c8c1[_0x3e2d('0x1b')](_0x44ac11)[_0x3e2d('0x1c')](_0x18c68b);}};}function respondWithFilteredResult(_0x4f8d26,_0x4dbfde){return function(_0x579cdb){if(_0x579cdb){var _0x2d9eac=_0x579cdb['count'],_0x4fc377=_0x4dbfde[_0x3e2d('0x1d')],_0x21192b=_0x4dbfde[_0x3e2d('0x1d')]+_0x4dbfde['limit'],_0x4fa388;if(_0x21192b>=_0x2d9eac){_0x21192b=_0x2d9eac;_0x4fa388=0xc8;}else{_0x4fa388=0xce;}_0x4f8d26[_0x3e2d('0x1b')](_0x4fa388);return _0x4f8d26[_0x3e2d('0x1e')]('Content-Range',_0x4fc377+'-'+_0x21192b+'/'+_0x2d9eac)['json'](_0x579cdb);}return null;};}function patchUpdates(_0x396d9c){return function(_0x3d6398){try{jsonpatch['apply'](_0x3d6398,_0x396d9c,!![]);}catch(_0xa35daf){return BPromise[_0x3e2d('0x1f')](_0xa35daf);}return _0x3d6398[_0x3e2d('0x20')]();};}function saveUpdates(_0x4ad602,_0x3e449b){return function(_0x36a518){if(_0x36a518){return _0x36a518[_0x3e2d('0x21')](_0x4ad602)['then'](function(_0x3c9e51){return _0x3c9e51;});}return null;};}function removeEntity(_0x2f0734,_0x34c3df){return function(_0x35fb9f){if(_0x35fb9f){return _0x35fb9f[_0x3e2d('0x22')]()['then'](function(){var _0x2c4475=_0x35fb9f['get']({'plain':!![]});var _0x4b46cc=_0x3e2d('0x23');return db[_0x3e2d('0x24')][_0x3e2d('0x22')]({'where':{'type':_0x4b46cc,'resourceId':_0x2c4475['id']}})[_0x3e2d('0x25')](function(){return _0x35fb9f;});})[_0x3e2d('0x25')](function(){_0x2f0734[_0x3e2d('0x1b')](0xcc)[_0x3e2d('0x26')]();});}};}function handleEntityNotFound(_0x46fbbd,_0x367b7a){return function(_0x3cf4a7){if(!_0x3cf4a7){_0x46fbbd['sendStatus'](0x194);}return _0x3cf4a7;};}function handleError(_0x4150a9,_0x565f91){_0x565f91=_0x565f91||0x1f4;return function(_0x229581){logger[_0x3e2d('0x27')](_0x229581[_0x3e2d('0x28')]);if(_0x229581[_0x3e2d('0x29')]){delete _0x229581['name'];}_0x4150a9[_0x3e2d('0x1b')](_0x565f91)[_0x3e2d('0x2a')](_0x229581);};}exports['index']=function(_0x536afd,_0x44795b){var _0x5dd5f6={},_0x58e2d2={},_0x4c98fe={'count':0x0,'rows':[]};var _0x340d30=_[_0x3e2d('0x2b')](db[_0x3e2d('0x2c')][_0x3e2d('0x2d')],function(_0x1a23e8){return{'name':_0x1a23e8['fieldName'],'type':_0x1a23e8[_0x3e2d('0x2e')][_0x3e2d('0x2f')]};});_0x58e2d2[_0x3e2d('0x30')]=_['map'](_0x340d30,_0x3e2d('0x29'));_0x58e2d2[_0x3e2d('0x31')]=_['keys'](_0x536afd['query']);_0x58e2d2[_0x3e2d('0x32')]=_['intersection'](_0x58e2d2[_0x3e2d('0x30')],_0x58e2d2[_0x3e2d('0x31')]);_0x5dd5f6['attributes']=_[_0x3e2d('0x33')](_0x58e2d2[_0x3e2d('0x30')],qs[_0x3e2d('0x34')](_0x536afd['query'][_0x3e2d('0x34')]));_0x5dd5f6['attributes']=_0x5dd5f6[_0x3e2d('0x35')][_0x3e2d('0x36')]?_0x5dd5f6[_0x3e2d('0x35')]:_0x58e2d2[_0x3e2d('0x30')];if(!_0x536afd[_0x3e2d('0x31')]['hasOwnProperty'](_0x3e2d('0x37'))){_0x5dd5f6[_0x3e2d('0x38')]=qs[_0x3e2d('0x38')](_0x536afd[_0x3e2d('0x31')][_0x3e2d('0x38')]);_0x5dd5f6['offset']=qs[_0x3e2d('0x1d')](_0x536afd[_0x3e2d('0x31')][_0x3e2d('0x1d')]);}_0x5dd5f6[_0x3e2d('0x39')]=qs['sort'](_0x536afd[_0x3e2d('0x31')][_0x3e2d('0x3a')]);_0x5dd5f6[_0x3e2d('0x3b')]=qs[_0x3e2d('0x32')](_[_0x3e2d('0x3c')](_0x536afd[_0x3e2d('0x31')],_0x58e2d2[_0x3e2d('0x32')]),_0x340d30);if(_0x536afd[_0x3e2d('0x31')][_0x3e2d('0x3d')]){_0x5dd5f6[_0x3e2d('0x3b')]=_[_0x3e2d('0x3e')](_0x5dd5f6[_0x3e2d('0x3b')],{'$or':_['map'](_0x340d30,function(_0x2bb674){if(_0x2bb674[_0x3e2d('0x2e')]!==_0x3e2d('0x3f')){var _0x644873={};_0x644873[_0x2bb674[_0x3e2d('0x29')]]={'$like':'%'+_0x536afd[_0x3e2d('0x31')]['filter']+'%'};return _0x644873;}})});}_0x5dd5f6=_[_0x3e2d('0x3e')]({},_0x5dd5f6,_0x536afd[_0x3e2d('0x40')]);var _0x967edd={'where':_0x5dd5f6[_0x3e2d('0x3b')]};return db[_0x3e2d('0x2c')]['count'](_0x967edd)[_0x3e2d('0x25')](function(_0x58e2d9){_0x4c98fe[_0x3e2d('0x41')]=_0x58e2d9;if(_0x536afd[_0x3e2d('0x31')][_0x3e2d('0x42')]){_0x5dd5f6[_0x3e2d('0x43')]=[{'all':!![]}];}return db[_0x3e2d('0x2c')]['findAll'](_0x5dd5f6);})[_0x3e2d('0x25')](function(_0x5b5cdf){_0x4c98fe[_0x3e2d('0x44')]=_0x5b5cdf;return _0x4c98fe;})[_0x3e2d('0x25')](respondWithFilteredResult(_0x44795b,_0x5dd5f6))['catch'](handleError(_0x44795b,null));};exports[_0x3e2d('0x45')]=function(_0x12c2ee,_0x2fcf29){var _0x2071a7={'raw':!![],'where':{'id':_0x12c2ee[_0x3e2d('0x46')]['id']}},_0x213276={};_0x213276[_0x3e2d('0x30')]=_[_0x3e2d('0x47')](db[_0x3e2d('0x2c')][_0x3e2d('0x2d')]);_0x213276[_0x3e2d('0x31')]=_[_0x3e2d('0x47')](_0x12c2ee['query']);_0x213276[_0x3e2d('0x32')]=_[_0x3e2d('0x33')](_0x213276[_0x3e2d('0x30')],_0x213276[_0x3e2d('0x31')]);_0x2071a7[_0x3e2d('0x35')]=_[_0x3e2d('0x33')](_0x213276[_0x3e2d('0x30')],qs['fields'](_0x12c2ee[_0x3e2d('0x31')]['fields']));_0x2071a7[_0x3e2d('0x35')]=_0x2071a7[_0x3e2d('0x35')][_0x3e2d('0x36')]?_0x2071a7[_0x3e2d('0x35')]:_0x213276['model'];if(_0x12c2ee['query'][_0x3e2d('0x42')]){_0x2071a7['include']=[{'all':!![]}];}_0x2071a7=_[_0x3e2d('0x3e')]({},_0x2071a7,_0x12c2ee['options']);return db[_0x3e2d('0x2c')][_0x3e2d('0x48')](_0x2071a7)['then'](handleEntityNotFound(_0x2fcf29,null))[_0x3e2d('0x25')](respondWithResult(_0x2fcf29,null))['catch'](handleError(_0x2fcf29,null));};exports[_0x3e2d('0x49')]=function(_0x215265,_0x30eb9f){return db['CmHopperAdditionalPhone'][_0x3e2d('0x49')](_0x215265[_0x3e2d('0x4a')],{})[_0x3e2d('0x25')](function(_0xf4a447){var _0xeab25d=_0x215265[_0x3e2d('0x4b')][_0x3e2d('0x4c')]({'plain':!![]});if(!_0xeab25d)throw new Error(_0x3e2d('0x4d'));if(_0xeab25d[_0x3e2d('0x4e')]==='user'){var _0x3835cc=_0xf4a447[_0x3e2d('0x4c')]({'plain':!![]});var _0x47497c=_0x3e2d('0x23');return db[_0x3e2d('0x4f')]['find']({'where':{'name':_0x47497c,'userProfileId':_0xeab25d['userProfileId']},'raw':!![]})[_0x3e2d('0x25')](function(_0x26fcee){if(_0x26fcee&&_0x26fcee[_0x3e2d('0x50')]===0x0){return db[_0x3e2d('0x24')][_0x3e2d('0x49')]({'name':_0x3835cc[_0x3e2d('0x29')],'resourceId':_0x3835cc['id'],'type':_0x26fcee[_0x3e2d('0x29')],'sectionId':_0x26fcee['id']},{})[_0x3e2d('0x25')](function(){return _0xf4a447;});}else{return _0xf4a447;}})['catch'](function(_0x3f3f68){logger[_0x3e2d('0x27')](_0x3e2d('0x51'),_0x3f3f68);throw _0x3f3f68;});}return _0xf4a447;})[_0x3e2d('0x25')](respondWithResult(_0x30eb9f,0xc9))[_0x3e2d('0x52')](handleError(_0x30eb9f,null));};exports['update']=function(_0x2b66db,_0x374eb6){if(_0x2b66db[_0x3e2d('0x4a')]['id']){delete _0x2b66db[_0x3e2d('0x4a')]['id'];}return db[_0x3e2d('0x2c')][_0x3e2d('0x48')]({'where':{'id':_0x2b66db[_0x3e2d('0x46')]['id']}})[_0x3e2d('0x25')](handleEntityNotFound(_0x374eb6,null))[_0x3e2d('0x25')](saveUpdates(_0x2b66db[_0x3e2d('0x4a')],null))[_0x3e2d('0x25')](respondWithResult(_0x374eb6,null))['catch'](handleError(_0x374eb6,null));};exports[_0x3e2d('0x22')]=function(_0x567107,_0x1653b0){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x567107[_0x3e2d('0x46')]['id']}})[_0x3e2d('0x25')](handleEntityNotFound(_0x1653b0,null))[_0x3e2d('0x25')](removeEntity(_0x1653b0,null))[_0x3e2d('0x52')](handleError(_0x1653b0,null));}; \ No newline at end of file +var _0x9070=['count','offset','limit','apply','reject','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','include','rows','catch','show','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0x9070,0x83));var _0x0907=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x9070[_0x3358ba];return _0x296e73;};'use strict';var pdf=require(_0x0907('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0907('0x1'));var jsonpatch=require(_0x0907('0x2'));var rp=require(_0x0907('0x3'));var moment=require(_0x0907('0x4'));var BPromise=require(_0x0907('0x5'));var Mustache=require(_0x0907('0x6'));var util=require(_0x0907('0x7'));var path=require(_0x0907('0x8'));var sox=require(_0x0907('0x9'));var csv=require(_0x0907('0xa'));var ejs=require(_0x0907('0xb'));var fs=require('fs');var _=require(_0x0907('0xc'));var squel=require(_0x0907('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0907('0xe'));var toCsv=require(_0x0907('0xa'));var querystring=require(_0x0907('0xf'));var Papa=require(_0x0907('0x10'));var Redis=require('ioredis');var authService=require(_0x0907('0x11'));var qs=require(_0x0907('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0907('0x13'));var logger=require(_0x0907('0x14'))(_0x0907('0x15'));var utils=require(_0x0907('0x16'));var config=require('../../config/environment');var db=require(_0x0907('0x17'))['db'];function respondWithStatusCode(_0x3a5ea9,_0x5713cc){_0x5713cc=_0x5713cc||0xcc;return function(_0x29c7c6){if(_0x29c7c6){return _0x3a5ea9[_0x0907('0x18')](_0x5713cc);}return _0x3a5ea9[_0x0907('0x19')](_0x5713cc)['end']();};}function respondWithResult(_0xd7f419,_0x5a7bfb){_0x5a7bfb=_0x5a7bfb||0xc8;return function(_0x137657){if(_0x137657){return _0xd7f419[_0x0907('0x19')](_0x5a7bfb)[_0x0907('0x1a')](_0x137657);}};}function respondWithFilteredResult(_0x4dd401,_0x164d80){return function(_0x2ccefb){if(_0x2ccefb){var _0x25d4df=_0x2ccefb[_0x0907('0x1b')],_0x27f35a=_0x164d80[_0x0907('0x1c')],_0x5174d9=_0x164d80[_0x0907('0x1c')]+_0x164d80[_0x0907('0x1d')],_0x55746d;if(_0x5174d9>=_0x25d4df){_0x5174d9=_0x25d4df;_0x55746d=0xc8;}else{_0x55746d=0xce;}_0x4dd401[_0x0907('0x19')](_0x55746d);return _0x4dd401['set']('Content-Range',_0x27f35a+'-'+_0x5174d9+'/'+_0x25d4df)[_0x0907('0x1a')](_0x2ccefb);}return null;};}function patchUpdates(_0x5bd9c5){return function(_0x7aec18){try{jsonpatch[_0x0907('0x1e')](_0x7aec18,_0x5bd9c5,!![]);}catch(_0x16e083){return BPromise[_0x0907('0x1f')](_0x16e083);}return _0x7aec18['save']();};}function saveUpdates(_0x4ef0dd,_0xfca200){return function(_0x4e01f9){if(_0x4e01f9){return _0x4e01f9[_0x0907('0x20')](_0x4ef0dd)[_0x0907('0x21')](function(_0x281db8){return _0x281db8;});}return null;};}function removeEntity(_0x1bc251,_0x422b14){return function(_0x5cdd68){if(_0x5cdd68){return _0x5cdd68[_0x0907('0x22')]()[_0x0907('0x21')](function(){var _0x228049=_0x5cdd68[_0x0907('0x23')]({'plain':!![]});var _0x570764='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x570764,'resourceId':_0x228049['id']}})[_0x0907('0x21')](function(){return _0x5cdd68;});})['then'](function(){_0x1bc251['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5937c2,_0x39d002){return function(_0x4ea831){if(!_0x4ea831){_0x5937c2[_0x0907('0x18')](0x194);}return _0x4ea831;};}function handleError(_0x358861,_0x5810d0){_0x5810d0=_0x5810d0||0x1f4;return function(_0x462942){logger[_0x0907('0x24')](_0x462942[_0x0907('0x25')]);if(_0x462942[_0x0907('0x26')]){delete _0x462942[_0x0907('0x26')];}_0x358861[_0x0907('0x19')](_0x5810d0)[_0x0907('0x27')](_0x462942);};}exports[_0x0907('0x28')]=function(_0x2ac64a,_0x17cc17){var _0x13cfc5={},_0xe6798b={},_0x86b560={'count':0x0,'rows':[]};var _0x4a52fa=_[_0x0907('0x29')](db['CmHopperAdditionalPhone'][_0x0907('0x2a')],function(_0x3f8d83){return{'name':_0x3f8d83[_0x0907('0x2b')],'type':_0x3f8d83[_0x0907('0x2c')]['key']};});_0xe6798b[_0x0907('0x2d')]=_[_0x0907('0x29')](_0x4a52fa,_0x0907('0x26'));_0xe6798b[_0x0907('0x2e')]=_[_0x0907('0x2f')](_0x2ac64a[_0x0907('0x2e')]);_0xe6798b[_0x0907('0x30')]=_[_0x0907('0x31')](_0xe6798b[_0x0907('0x2d')],_0xe6798b['query']);_0x13cfc5['attributes']=_[_0x0907('0x31')](_0xe6798b[_0x0907('0x2d')],qs[_0x0907('0x32')](_0x2ac64a['query'][_0x0907('0x32')]));_0x13cfc5[_0x0907('0x33')]=_0x13cfc5[_0x0907('0x33')]['length']?_0x13cfc5[_0x0907('0x33')]:_0xe6798b[_0x0907('0x2d')];if(!_0x2ac64a[_0x0907('0x2e')][_0x0907('0x34')](_0x0907('0x35'))){_0x13cfc5[_0x0907('0x1d')]=qs['limit'](_0x2ac64a['query'][_0x0907('0x1d')]);_0x13cfc5[_0x0907('0x1c')]=qs[_0x0907('0x1c')](_0x2ac64a['query'][_0x0907('0x1c')]);}_0x13cfc5[_0x0907('0x36')]=qs[_0x0907('0x37')](_0x2ac64a[_0x0907('0x2e')]['sort']);_0x13cfc5[_0x0907('0x38')]=qs[_0x0907('0x30')](_[_0x0907('0x39')](_0x2ac64a[_0x0907('0x2e')],_0xe6798b[_0x0907('0x30')]),_0x4a52fa);if(_0x2ac64a['query'][_0x0907('0x3a')]){_0x13cfc5[_0x0907('0x38')]=_[_0x0907('0x3b')](_0x13cfc5[_0x0907('0x38')],{'$or':_['map'](_0x4a52fa,function(_0x436d93){if(_0x436d93[_0x0907('0x2c')]!==_0x0907('0x3c')){var _0x2e0065={};_0x2e0065[_0x436d93[_0x0907('0x26')]]={'$like':'%'+_0x2ac64a[_0x0907('0x2e')]['filter']+'%'};return _0x2e0065;}})});}_0x13cfc5=_[_0x0907('0x3b')]({},_0x13cfc5,_0x2ac64a[_0x0907('0x3d')]);var _0x3f219a={'where':_0x13cfc5[_0x0907('0x38')]};return db[_0x0907('0x3e')]['count'](_0x3f219a)[_0x0907('0x21')](function(_0x8a8980){_0x86b560[_0x0907('0x1b')]=_0x8a8980;if(_0x2ac64a[_0x0907('0x2e')]['includeAll']){_0x13cfc5[_0x0907('0x3f')]=[{'all':!![]}];}return db[_0x0907('0x3e')]['findAll'](_0x13cfc5);})[_0x0907('0x21')](function(_0x525a3c){_0x86b560[_0x0907('0x40')]=_0x525a3c;return _0x86b560;})[_0x0907('0x21')](respondWithFilteredResult(_0x17cc17,_0x13cfc5))[_0x0907('0x41')](handleError(_0x17cc17,null));};exports[_0x0907('0x42')]=function(_0x3b7539,_0x33c711){var _0x2a6424={'raw':!![],'where':{'id':_0x3b7539['params']['id']}},_0x1fd317={};_0x1fd317['model']=_[_0x0907('0x2f')](db[_0x0907('0x3e')][_0x0907('0x2a')]);_0x1fd317[_0x0907('0x2e')]=_[_0x0907('0x2f')](_0x3b7539[_0x0907('0x2e')]);_0x1fd317['filters']=_[_0x0907('0x31')](_0x1fd317[_0x0907('0x2d')],_0x1fd317[_0x0907('0x2e')]);_0x2a6424[_0x0907('0x33')]=_[_0x0907('0x31')](_0x1fd317['model'],qs[_0x0907('0x32')](_0x3b7539[_0x0907('0x2e')]['fields']));_0x2a6424[_0x0907('0x33')]=_0x2a6424[_0x0907('0x33')][_0x0907('0x43')]?_0x2a6424['attributes']:_0x1fd317[_0x0907('0x2d')];if(_0x3b7539[_0x0907('0x2e')][_0x0907('0x44')]){_0x2a6424['include']=[{'all':!![]}];}_0x2a6424=_[_0x0907('0x3b')]({},_0x2a6424,_0x3b7539['options']);return db[_0x0907('0x3e')]['find'](_0x2a6424)[_0x0907('0x21')](handleEntityNotFound(_0x33c711,null))[_0x0907('0x21')](respondWithResult(_0x33c711,null))[_0x0907('0x41')](handleError(_0x33c711,null));};exports[_0x0907('0x45')]=function(_0x79e30e,_0x472ca9){return db[_0x0907('0x3e')][_0x0907('0x45')](_0x79e30e[_0x0907('0x46')],{})[_0x0907('0x21')](function(_0x179c3f){var _0x407bb2=_0x79e30e[_0x0907('0x47')]['get']({'plain':!![]});if(!_0x407bb2)throw new Error(_0x0907('0x48'));if(_0x407bb2['role']===_0x0907('0x47')){var _0x267e85=_0x179c3f[_0x0907('0x23')]({'plain':!![]});var _0x341f68='CmHopperAdditionalPhones';return db[_0x0907('0x49')][_0x0907('0x4a')]({'where':{'name':_0x341f68,'userProfileId':_0x407bb2[_0x0907('0x4b')]},'raw':!![]})[_0x0907('0x21')](function(_0x372777){if(_0x372777&&_0x372777['autoAssociation']===0x0){return db[_0x0907('0x4c')][_0x0907('0x45')]({'name':_0x267e85[_0x0907('0x26')],'resourceId':_0x267e85['id'],'type':_0x372777[_0x0907('0x26')],'sectionId':_0x372777['id']},{})['then'](function(){return _0x179c3f;});}else{return _0x179c3f;}})['catch'](function(_0x3167f6){logger[_0x0907('0x24')](_0x0907('0x4d'),_0x3167f6);throw _0x3167f6;});}return _0x179c3f;})[_0x0907('0x21')](respondWithResult(_0x472ca9,0xc9))[_0x0907('0x41')](handleError(_0x472ca9,null));};exports['update']=function(_0xd83586,_0x17f3b9){if(_0xd83586[_0x0907('0x46')]['id']){delete _0xd83586['body']['id'];}return db[_0x0907('0x3e')]['find']({'where':{'id':_0xd83586[_0x0907('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17f3b9,null))[_0x0907('0x21')](saveUpdates(_0xd83586[_0x0907('0x46')],null))['then'](respondWithResult(_0x17f3b9,null))[_0x0907('0x41')](handleError(_0x17f3b9,null));};exports['destroy']=function(_0x1b4dfa,_0xef2f2a){return db[_0x0907('0x3e')][_0x0907('0x4a')]({'where':{'id':_0x1b4dfa[_0x0907('0x4e')]['id']}})['then'](handleEntityNotFound(_0xef2f2a,null))[_0x0907('0x21')](removeEntity(_0xef2f2a,null))[_0x0907('0x41')](handleError(_0xef2f2a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 680b377..f0dc7fa 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1258=['cm_hopper_additional_phones','util','moment','bluebird','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone'];(function(_0x5e454a,_0x2c949c){var _0x2bafa1=function(_0x147f8d){while(--_0x147f8d){_0x5e454a['push'](_0x5e454a['shift']());}};_0x2bafa1(++_0x2c949c);}(_0x1258,0x1a9));var _0x8125=function(_0x324dad,_0x44fcb7){_0x324dad=_0x324dad-0x0;var _0x287fdf=_0x1258[_0x324dad];return _0x287fdf;};'use strict';var _=require('lodash');var util=require(_0x8125('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8125('0x1'));var BPromise=require(_0x8125('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8125('0x3'));var attributes=require(_0x8125('0x4'));module[_0x8125('0x5')]=function(_0x13e7a7,_0x579073){return _0x13e7a7['define'](_0x8125('0x6'),attributes,{'tableName':_0x8125('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65d5=['request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','api','moment','bluebird'];(function(_0x2972c5,_0xbe65c0){var _0x471da3=function(_0x1ba5fa){while(--_0x1ba5fa){_0x2972c5['push'](_0x2972c5['shift']());}};_0x471da3(++_0xbe65c0);}(_0x65d5,0x8a));var _0x565d=function(_0x13eb5d,_0x2ae6ee){_0x13eb5d=_0x13eb5d-0x0;var _0x3a6a80=_0x65d5[_0x13eb5d];return _0x3a6a80;};'use strict';var _=require(_0x565d('0x0'));var util=require(_0x565d('0x1'));var logger=require('../../config/logger')(_0x565d('0x2'));var moment=require(_0x565d('0x3'));var BPromise=require(_0x565d('0x4'));var rp=require(_0x565d('0x5'));var fs=require('fs');var path=require(_0x565d('0x6'));var rimraf=require(_0x565d('0x7'));var config=require(_0x565d('0x8'));var attributes=require(_0x565d('0x9'));module[_0x565d('0xa')]=function(_0x1af494,_0xc1794c){return _0x1af494[_0x565d('0xb')](_0x565d('0xc'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 706e120..4d2829c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcb2=['transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','createdAt','updatedAt','isNil','countdropretry','hopperToAdd','additionalToHop'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xbcb2,0xf8));var _0x2bcb=function(_0x2494d1,_0x19d788){_0x2494d1=_0x2494d1-0x0;var _0x3fe4b6=_0xbcb2[_0x2494d1];return _0x3fe4b6;};'use strict';var _=require(_0x2bcb('0x0'));var util=require(_0x2bcb('0x1'));var moment=require(_0x2bcb('0x2'));var BPromise=require(_0x2bcb('0x3'));var rs=require(_0x2bcb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bcb('0x5'))['db'];var utils=require(_0x2bcb('0x6'));var logger=require(_0x2bcb('0x7'))(_0x2bcb('0x8'));var config=require(_0x2bcb('0x9'));var jayson=require(_0x2bcb('0xa'));var client=jayson['client'][_0x2bcb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3495bd,_0x220042,_0x229406){return new BPromise(function(_0x5cee84,_0x9f96e3){return client[_0x2bcb('0xc')](_0x3495bd,_0x229406)[_0x2bcb('0xd')](function(_0x3074ab){logger[_0x2bcb('0xe')](_0x2bcb('0xf'),_0x220042,_0x2bcb('0x10'));logger[_0x2bcb('0x11')](_0x2bcb('0x12'),_0x220042,_0x2bcb('0x10'),JSON[_0x2bcb('0x13')](_0x3074ab));if(_0x3074ab[_0x2bcb('0x14')]){if(_0x3074ab[_0x2bcb('0x14')]['code']===0x1f4){logger['error'](_0x2bcb('0xf'),_0x220042,_0x3074ab[_0x2bcb('0x14')][_0x2bcb('0x15')]);return _0x9f96e3(_0x3074ab[_0x2bcb('0x14')][_0x2bcb('0x15')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x220042,_0x3074ab[_0x2bcb('0x14')]['message']);return _0x5cee84(_0x3074ab[_0x2bcb('0x14')][_0x2bcb('0x15')]);}else{logger[_0x2bcb('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x220042,'request\x20sent');_0x5cee84(_0x3074ab[_0x2bcb('0x16')][_0x2bcb('0x15')]);}})[_0x2bcb('0x17')](function(_0x336873){logger[_0x2bcb('0x14')](_0x2bcb('0xf'),_0x220042,_0x336873);_0x9f96e3(_0x336873);});});}exports[_0x2bcb('0x18')]=function(_0x1cab85){var _0x1dfe16=this;return new Promise(function(_0x3008a3,_0x15b6f4){return db[_0x2bcb('0x19')][_0x2bcb('0x1a')]({'raw':!![],'where':{'ContactId':_0x1cab85[_0x2bcb('0x1b')][_0x2bcb('0x1c')],'ListId':_0x1cab85[_0x2bcb('0x1b')][_0x2bcb('0x1d')],'VoiceQueueId':_0x1cab85[_0x2bcb('0x1b')][_0x2bcb('0x1e')]===undefined?null:_0x1cab85[_0x2bcb('0x1b')][_0x2bcb('0x1e')],'CampaignId':_0x1cab85[_0x2bcb('0x1b')][_0x2bcb('0x1f')]===undefined?null:_0x1cab85['body'][_0x2bcb('0x1f')]}})[_0x2bcb('0xd')](function(_0x5d71bc){if(_0x5d71bc!=null){return db[_0x2bcb('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5d71bc['id'],'OrderBy':{'$gt':_0x5d71bc[_0x2bcb('0x21')]}},'order':[['OrderBy',_0x2bcb('0x22')]]})[_0x2bcb('0xd')](function(_0x1b53b2){var _0x5720db=0x0;if(_0x1b53b2){if(_0x1b53b2[_0x2bcb('0x23')]+_0x1b53b2[_0x2bcb('0x24')]+_0x1b53b2[_0x2bcb('0x25')]+_0x1b53b2[_0x2bcb('0x26')]+_0x1b53b2['countdropretry']+_0x1b53b2[_0x2bcb('0x27')]+_0x1b53b2[_0x2bcb('0x28')]+_0x1b53b2[_0x2bcb('0x29')]<_0x1cab85[_0x2bcb('0x2a')][_0x2bcb('0x2b')])_0x5720db=0x1;_0x3008a3({'additional':_0x5720db});}else{return db[_0x2bcb('0x20')][_0x2bcb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x5d71bc['id']},'order':[['OrderBy',_0x2bcb('0x22')]]})['then'](function(_0x30dee4){var _0x1ba22a=0x0;if(_0x30dee4){if(_0x30dee4[_0x2bcb('0x23')]+_0x30dee4[_0x2bcb('0x24')]+_0x30dee4[_0x2bcb('0x25')]+_0x30dee4[_0x2bcb('0x26')]+_0x30dee4['countdropretry']+_0x30dee4[_0x2bcb('0x27')]+_0x30dee4['countmachineretry']+_0x30dee4[_0x2bcb('0x29')]<_0x1cab85[_0x2bcb('0x2a')]['dialGlobalMaxRetry'])_0x1ba22a=0x1;_0x3008a3({'additional':_0x1ba22a});}else{_0x3008a3({'additional':0x0});}})['catch'](function(_0x36aa04){logger[_0x2bcb('0x14')]('VerifyAdditionalPhones',_0x36aa04[_0x2bcb('0x15')],_0x1cab85);_0x15b6f4(_0x1dfe16[_0x2bcb('0x14')](0x1f4,_0x36aa04['message']));});}})[_0x2bcb('0x17')](function(_0x1943c7){logger[_0x2bcb('0x14')](_0x2bcb('0x18'),_0x1943c7['message'],_0x1cab85);_0x15b6f4(_0x1dfe16[_0x2bcb('0x14')](0x1f4,_0x1943c7[_0x2bcb('0x15')]));});}else _0x3008a3({'additional':0x0});});});};exports[_0x2bcb('0x2c')]=function(_0x59cade){var _0x564054=this;return new Promise(function(_0x5ebfcb,_0x3fdc9c){return db[_0x2bcb('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x59cade[_0x2bcb('0x1b')][_0x2bcb('0x1c')],'ListId':_0x59cade['body'][_0x2bcb('0x1d')],'VoiceQueueId':_0x59cade[_0x2bcb('0x1b')]['VoiceQueueId']===undefined?null:_0x59cade[_0x2bcb('0x1b')][_0x2bcb('0x1e')],'CampaignId':_0x59cade[_0x2bcb('0x1b')][_0x2bcb('0x1f')]===undefined?null:_0x59cade['body'][_0x2bcb('0x1f')]}})[_0x2bcb('0xd')](function(_0x4dce3b){if(_0x4dce3b!=null){return db[_0x2bcb('0x20')][_0x2bcb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4dce3b['id'],'OrderBy':{'$gt':_0x4dce3b[_0x2bcb('0x21')]}},'order':[[_0x2bcb('0x21'),_0x2bcb('0x22')]]})[_0x2bcb('0xd')](function(_0xe673d){if(_0xe673d)return activateAdditionalPhone(_0x4dce3b,_0x59cade[_0x2bcb('0x1b')],_0xe673d,_0x59cade[_0x2bcb('0x2d')],_0x59cade['waitTime'])[_0x2bcb('0xd')](function(_0x3d7e7e){_0x5ebfcb(_0x3d7e7e);});else{return db[_0x2bcb('0x20')][_0x2bcb('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4dce3b['id']},'order':[['OrderBy','ASC']]})[_0x2bcb('0xd')](function(_0x51cf9a){if(_0x51cf9a)return activateAdditionalPhone(_0x4dce3b,_0x59cade[_0x2bcb('0x1b')],_0x51cf9a,_0x59cade[_0x2bcb('0x2d')],_0x59cade[_0x2bcb('0x2e')])[_0x2bcb('0xd')](function(_0xfbdd31){_0x5ebfcb(_0xfbdd31);});else{_0x5ebfcb({'id':_0x4dce3b['id'],'phone':''});}})[_0x2bcb('0x17')](function(_0x523941){logger['error']('VerifyAdditionalPhones',_0x523941[_0x2bcb('0x15')],_0x59cade);_0x3fdc9c(_0x564054[_0x2bcb('0x14')](0x1f4,_0x523941[_0x2bcb('0x15')]));});}})[_0x2bcb('0x17')](function(_0x20312e){logger[_0x2bcb('0x14')](_0x2bcb('0x18'),_0x20312e['message'],_0x59cade);_0x3fdc9c(_0x564054[_0x2bcb('0x14')](0x1f4,_0x20312e[_0x2bcb('0x15')]));});}else _0x5ebfcb(0x1);});});};function activateAdditionalPhone(_0x259eb5,_0xd75fa,_0x22a6cc,_0x4d771b,_0x3ac733){return new Promise(function(_0x295d70,_0x571bad){logger['info'](_0x2bcb('0x18'),_0x22a6cc);var _0x444430;if(moment()>moment(_0x22a6cc[_0x2bcb('0x2f')])){_0x444430=moment()[_0x2bcb('0x30')](_0x3ac733||0x3,'minutes');}else{if(_0x22a6cc[_0x2bcb('0x21')]==0x0){_0x444430=moment(_0x22a6cc[_0x2bcb('0x2f')]);}else{_0x444430=moment()[_0x2bcb('0x30')](_0x3ac733||0x3,_0x2bcb('0x31'));}}var _0x33e455={'phone':_0x259eb5[_0x2bcb('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x259eb5[_0x2bcb('0x21')])?0x0:_0x259eb5[_0x2bcb('0x21')],'scheduledat':moment()[_0x2bcb('0x30')](_0x4d771b||0x1,_0x2bcb('0x31')),'countbusyretry':_0xd75fa[_0x2bcb('0x23')],'countcongestionretry':_0xd75fa[_0x2bcb('0x24')],'countnoanswerretry':_0xd75fa['countnoanswerretry'],'countnosuchnumberretry':_0xd75fa[_0x2bcb('0x26')],'countdropretry':_0xd75fa['countdropretry'],'countabandonedretry':_0xd75fa['countabandonedretry'],'countmachineretry':_0xd75fa[_0x2bcb('0x28')],'countagentrejectretry':_0xd75fa[_0x2bcb('0x29')],'createdAt':_0xd75fa[_0x2bcb('0x33')],'updatedAt':_0xd75fa[_0x2bcb('0x34')]};var _0xaf8fbd={'CmHopperId':_0x259eb5['id'],'phone':_0x22a6cc[_0x2bcb('0x32')],'active':0x0,'OrderBy':_[_0x2bcb('0x35')](_0x22a6cc[_0x2bcb('0x21')])?0x0:_0x22a6cc[_0x2bcb('0x21')],'scheduledat':_0x444430,'countbusyretry':_0x22a6cc[_0x2bcb('0x23')],'countcongestionretry':_0x22a6cc[_0x2bcb('0x24')],'countnoanswerretry':_0x22a6cc['countnoanswerretry'],'countnosuchnumberretry':_0xd75fa[_0x2bcb('0x26')],'countdropretry':_0xd75fa[_0x2bcb('0x36')],'countabandonedretry':_0xd75fa[_0x2bcb('0x27')],'countmachineretry':_0xd75fa[_0x2bcb('0x28')],'countagentrejectretry':_0xd75fa[_0x2bcb('0x29')],'createdAt':_0x22a6cc[_0x2bcb('0x33')],'updatedAt':_0x22a6cc[_0x2bcb('0x34')]};logger[_0x2bcb('0xe')](_0x2bcb('0x37'),_0x33e455);logger['info'](_0x2bcb('0x38'),_0xaf8fbd);return db['sequelize'][_0x2bcb('0x39')](function(_0x29e3ce){return db[_0x2bcb('0x20')][_0x2bcb('0x3a')](_0x33e455,{'where':{'id':_0x22a6cc['id']}},{'transaction':_0x29e3ce})[_0x2bcb('0xd')](function(){return db[_0x2bcb('0x19')]['update'](_0xaf8fbd,{'where':{'id':_0x259eb5['id']}},{'transaction':_0x29e3ce});});})[_0x2bcb('0xd')](function(_0x243d19){_0x295d70({'id':_0x259eb5['id'],'phone':_0x22a6cc[_0x2bcb('0x32')]});})[_0x2bcb('0x17')](function(_0x435b11){logger[_0x2bcb('0x14')](_0x2bcb('0x18'),_0x435b11[_0x2bcb('0x15')],req);_0x571bad(_this[_0x2bcb('0x14')](0x1f4,_0x435b11[_0x2bcb('0x15')]));});});}exports[_0x2bcb('0x3b')]=function(_0x362e6a){var _0x4eba0b=this;return new Promise(function(_0x5c3d77,_0x14ab7f){return db[_0x2bcb('0x19')][_0x2bcb('0x3a')](_0x362e6a[_0x2bcb('0x1b')][_0x2bcb('0x3c')],{'where':{'id':_0x362e6a[_0x2bcb('0x1b')]['id']}})['then'](function(_0x5b000a){_0x5c3d77(_0x5b000a);})[_0x2bcb('0x17')](function(_0x38a8ad){logger['error'](_0x2bcb('0x3b'),_0x38a8ad[_0x2bcb('0x15')],_0x362e6a);_0x14ab7f(_0x4eba0b[_0x2bcb('0x14')](0x1f4,_0x38a8ad[_0x2bcb('0x15')]));});});}; \ No newline at end of file +var _0x3232=['error','code','message','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','SwapAdditionalPhones','ContactId','duration','waitTime','scheduledat','add','minutes','isNil','phone','updatedAt','hopperToAdd','additionalToHop','sequelize','update','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5f5df5,_0x2f41c8){var _0x511d12=function(_0x33bbd6){while(--_0x33bbd6){_0x5f5df5['push'](_0x5f5df5['shift']());}};_0x511d12(++_0x2f41c8);}(_0x3232,0x178));var _0x2323=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x3232[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x2323('0x0'));var util=require('util');var moment=require(_0x2323('0x1'));var BPromise=require(_0x2323('0x2'));var rs=require(_0x2323('0x3'));var fs=require('fs');var Redis=require(_0x2323('0x4'));var db=require(_0x2323('0x5'))['db'];var utils=require(_0x2323('0x6'));var logger=require(_0x2323('0x7'))(_0x2323('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2323('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x480298,_0x5b1a22,_0x164728){return new BPromise(function(_0x279aa8,_0x53eb28){return client[_0x2323('0xa')](_0x480298,_0x164728)[_0x2323('0xb')](function(_0x2371f6){logger[_0x2323('0xc')](_0x2323('0xd'),_0x5b1a22,_0x2323('0xe'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x5b1a22,_0x2323('0xe'),JSON[_0x2323('0xf')](_0x2371f6));if(_0x2371f6[_0x2323('0x10')]){if(_0x2371f6['error'][_0x2323('0x11')]===0x1f4){logger['error'](_0x2323('0xd'),_0x5b1a22,_0x2371f6[_0x2323('0x10')][_0x2323('0x12')]);return _0x53eb28(_0x2371f6[_0x2323('0x10')][_0x2323('0x12')]);}logger['error'](_0x2323('0xd'),_0x5b1a22,_0x2371f6['error'][_0x2323('0x12')]);return _0x279aa8(_0x2371f6[_0x2323('0x10')][_0x2323('0x12')]);}else{logger[_0x2323('0xc')](_0x2323('0xd'),_0x5b1a22,'request\x20sent');_0x279aa8(_0x2371f6['result'][_0x2323('0x12')]);}})['catch'](function(_0x2c89ba){logger['error'](_0x2323('0xd'),_0x5b1a22,_0x2c89ba);_0x53eb28(_0x2c89ba);});});}exports[_0x2323('0x13')]=function(_0x1519d9){var _0x23320c=this;return new Promise(function(_0x237b80,_0x5a6b81){return db[_0x2323('0x14')][_0x2323('0x15')]({'raw':!![],'where':{'ContactId':_0x1519d9[_0x2323('0x16')]['ContactId'],'ListId':_0x1519d9[_0x2323('0x16')][_0x2323('0x17')],'VoiceQueueId':_0x1519d9['body'][_0x2323('0x18')]===undefined?null:_0x1519d9[_0x2323('0x16')][_0x2323('0x18')],'CampaignId':_0x1519d9[_0x2323('0x16')][_0x2323('0x19')]===undefined?null:_0x1519d9['body'][_0x2323('0x19')]}})['then'](function(_0x38cc05){if(_0x38cc05!=null){return db[_0x2323('0x1a')][_0x2323('0x15')]({'raw':!![],'where':{'CmHopperId':_0x38cc05['id'],'OrderBy':{'$gt':_0x38cc05[_0x2323('0x1b')]}},'order':[[_0x2323('0x1b'),_0x2323('0x1c')]]})[_0x2323('0xb')](function(_0x43ecf1){var _0x5beabc=0x0;if(_0x43ecf1){if(_0x43ecf1[_0x2323('0x1d')]+_0x43ecf1[_0x2323('0x1e')]+_0x43ecf1[_0x2323('0x1f')]+_0x43ecf1[_0x2323('0x20')]+_0x43ecf1[_0x2323('0x21')]+_0x43ecf1[_0x2323('0x22')]+_0x43ecf1[_0x2323('0x23')]+_0x43ecf1[_0x2323('0x24')]<_0x1519d9[_0x2323('0x25')][_0x2323('0x26')])_0x5beabc=0x1;_0x237b80({'additional':_0x5beabc});}else{return db[_0x2323('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x38cc05['id']},'order':[['OrderBy',_0x2323('0x1c')]]})[_0x2323('0xb')](function(_0x2d94aa){var _0x498015=0x0;if(_0x2d94aa){if(_0x2d94aa[_0x2323('0x1d')]+_0x2d94aa['countcongestionretry']+_0x2d94aa['countnoanswerretry']+_0x2d94aa[_0x2323('0x20')]+_0x2d94aa[_0x2323('0x21')]+_0x2d94aa['countabandonedretry']+_0x2d94aa[_0x2323('0x23')]+_0x2d94aa[_0x2323('0x24')]<_0x1519d9[_0x2323('0x25')][_0x2323('0x26')])_0x498015=0x1;_0x237b80({'additional':_0x498015});}else{_0x237b80({'additional':0x0});}})[_0x2323('0x27')](function(_0x433f22){logger[_0x2323('0x10')](_0x2323('0x13'),_0x433f22[_0x2323('0x12')],_0x1519d9);_0x5a6b81(_0x23320c[_0x2323('0x10')](0x1f4,_0x433f22[_0x2323('0x12')]));});}})[_0x2323('0x27')](function(_0x2e26b8){logger[_0x2323('0x10')]('VerifyAdditionalPhones',_0x2e26b8[_0x2323('0x12')],_0x1519d9);_0x5a6b81(_0x23320c[_0x2323('0x10')](0x1f4,_0x2e26b8[_0x2323('0x12')]));});}else _0x237b80({'additional':0x0});});});};exports[_0x2323('0x28')]=function(_0x469eec){var _0x43a469=this;return new Promise(function(_0x249636,_0x550ae5){return db[_0x2323('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x469eec[_0x2323('0x16')][_0x2323('0x29')],'ListId':_0x469eec[_0x2323('0x16')][_0x2323('0x17')],'VoiceQueueId':_0x469eec[_0x2323('0x16')]['VoiceQueueId']===undefined?null:_0x469eec[_0x2323('0x16')][_0x2323('0x18')],'CampaignId':_0x469eec[_0x2323('0x16')][_0x2323('0x19')]===undefined?null:_0x469eec['body'][_0x2323('0x19')]}})[_0x2323('0xb')](function(_0x4dfb27){if(_0x4dfb27!=null){return db[_0x2323('0x1a')][_0x2323('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4dfb27['id'],'OrderBy':{'$gt':_0x4dfb27[_0x2323('0x1b')]}},'order':[[_0x2323('0x1b'),'ASC']]})[_0x2323('0xb')](function(_0x22d04a){if(_0x22d04a)return activateAdditionalPhone(_0x4dfb27,_0x469eec[_0x2323('0x16')],_0x22d04a,_0x469eec[_0x2323('0x2a')],_0x469eec[_0x2323('0x2b')])[_0x2323('0xb')](function(_0x47c880){_0x249636(_0x47c880);});else{return db[_0x2323('0x1a')][_0x2323('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4dfb27['id']},'order':[[_0x2323('0x1b'),'ASC']]})[_0x2323('0xb')](function(_0x23f17c){if(_0x23f17c)return activateAdditionalPhone(_0x4dfb27,_0x469eec[_0x2323('0x16')],_0x23f17c,_0x469eec[_0x2323('0x2a')],_0x469eec[_0x2323('0x2b')])['then'](function(_0x105019){_0x249636(_0x105019);});else{_0x249636({'id':_0x4dfb27['id'],'phone':''});}})[_0x2323('0x27')](function(_0x38827d){logger['error'](_0x2323('0x13'),_0x38827d[_0x2323('0x12')],_0x469eec);_0x550ae5(_0x43a469[_0x2323('0x10')](0x1f4,_0x38827d[_0x2323('0x12')]));});}})[_0x2323('0x27')](function(_0x3928fb){logger[_0x2323('0x10')](_0x2323('0x13'),_0x3928fb[_0x2323('0x12')],_0x469eec);_0x550ae5(_0x43a469[_0x2323('0x10')](0x1f4,_0x3928fb[_0x2323('0x12')]));});}else _0x249636(0x1);});});};function activateAdditionalPhone(_0x577c71,_0x3ce153,_0x4c1c30,_0x52a9b7,_0x584a80){return new Promise(function(_0x294bd4,_0x5742cc){logger[_0x2323('0xc')]('VerifyAdditionalPhones',_0x4c1c30);var _0x21bada;if(moment()>moment(_0x4c1c30[_0x2323('0x2c')])){_0x21bada=moment()[_0x2323('0x2d')](_0x584a80||0x3,'minutes');}else{if(_0x4c1c30[_0x2323('0x1b')]==0x0){_0x21bada=moment(_0x4c1c30['scheduledat']);}else{_0x21bada=moment()[_0x2323('0x2d')](_0x584a80||0x3,_0x2323('0x2e'));}}var _0x1cac78={'phone':_0x577c71['phone'],'active':0x0,'OrderBy':_[_0x2323('0x2f')](_0x577c71[_0x2323('0x1b')])?0x0:_0x577c71[_0x2323('0x1b')],'scheduledat':moment()[_0x2323('0x2d')](_0x52a9b7||0x1,_0x2323('0x2e')),'countbusyretry':_0x3ce153[_0x2323('0x1d')],'countcongestionretry':_0x3ce153[_0x2323('0x1e')],'countnoanswerretry':_0x3ce153[_0x2323('0x1f')],'countnosuchnumberretry':_0x3ce153[_0x2323('0x20')],'countdropretry':_0x3ce153[_0x2323('0x21')],'countabandonedretry':_0x3ce153[_0x2323('0x22')],'countmachineretry':_0x3ce153[_0x2323('0x23')],'countagentrejectretry':_0x3ce153[_0x2323('0x24')],'createdAt':_0x3ce153['createdAt'],'updatedAt':_0x3ce153['updatedAt']};var _0x4466f3={'CmHopperId':_0x577c71['id'],'phone':_0x4c1c30[_0x2323('0x30')],'active':0x0,'OrderBy':_[_0x2323('0x2f')](_0x4c1c30[_0x2323('0x1b')])?0x0:_0x4c1c30[_0x2323('0x1b')],'scheduledat':_0x21bada,'countbusyretry':_0x4c1c30[_0x2323('0x1d')],'countcongestionretry':_0x4c1c30[_0x2323('0x1e')],'countnoanswerretry':_0x4c1c30[_0x2323('0x1f')],'countnosuchnumberretry':_0x3ce153[_0x2323('0x20')],'countdropretry':_0x3ce153[_0x2323('0x21')],'countabandonedretry':_0x3ce153[_0x2323('0x22')],'countmachineretry':_0x3ce153['countmachineretry'],'countagentrejectretry':_0x3ce153[_0x2323('0x24')],'createdAt':_0x4c1c30['createdAt'],'updatedAt':_0x4c1c30[_0x2323('0x31')]};logger[_0x2323('0xc')](_0x2323('0x32'),_0x1cac78);logger[_0x2323('0xc')](_0x2323('0x33'),_0x4466f3);return db[_0x2323('0x34')]['transaction'](function(_0x4e9d3d){return db['CmHopperAdditionalPhone'][_0x2323('0x35')](_0x1cac78,{'where':{'id':_0x4c1c30['id']}},{'transaction':_0x4e9d3d})['then'](function(){return db['CmHopper'][_0x2323('0x35')](_0x4466f3,{'where':{'id':_0x577c71['id']}},{'transaction':_0x4e9d3d});});})[_0x2323('0xb')](function(_0x490455){_0x294bd4({'id':_0x577c71['id'],'phone':_0x4c1c30[_0x2323('0x30')]});})[_0x2323('0x27')](function(_0x4985cd){logger[_0x2323('0x10')](_0x2323('0x13'),_0x4985cd['message'],req);_0x5742cc(_this[_0x2323('0x10')](0x1f4,_0x4985cd[_0x2323('0x12')]));});});}exports[_0x2323('0x36')]=function(_0x2cc062){var _0x58b070=this;return new Promise(function(_0x303c28,_0x5dd5bc){return db[_0x2323('0x14')]['update'](_0x2cc062['body'][_0x2323('0x37')],{'where':{'id':_0x2cc062['body']['id']}})[_0x2323('0xb')](function(_0x1f26a3){_0x303c28(_0x1f26a3);})[_0x2323('0x27')](function(_0x1ab135){logger[_0x2323('0x10')](_0x2323('0x36'),_0x1ab135[_0x2323('0x12')],_0x2cc062);_0x5dd5bc(_0x58b070[_0x2323('0x10')](0x1f4,_0x1ab135[_0x2323('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 80750ed..4f7ea9d 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x626f=['Router','../../components/auth/service','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2c1c5d,_0x5c6341){var _0x1842ee=function(_0x1886d8){while(--_0x1886d8){_0x2c1c5d['push'](_0x2c1c5d['shift']());}};_0x1842ee(++_0x5c6341);}(_0x626f,0x13c));var _0xf626=function(_0x2e9a90,_0x50648e){_0x2e9a90=_0x2e9a90-0x0;var _0x37678e=_0x626f[_0x2e9a90];return _0x37678e;};'use strict';var multer=require(_0xf626('0x0'));var util=require(_0xf626('0x1'));var path=require(_0xf626('0x2'));var timeout=require(_0xf626('0x3'));var express=require('express');var router=express[_0xf626('0x4')]();var auth=require(_0xf626('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xf626('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf626('0x6')]('/:id',auth[_0xf626('0x7')](),controller[_0xf626('0x8')]);router[_0xf626('0x9')]('/',auth[_0xf626('0x7')](),controller[_0xf626('0xa')]);router['put'](_0xf626('0xb'),auth['isAuthenticated'](),controller[_0xf626('0xc')]);router[_0xf626('0xd')](_0xf626('0xb'),auth[_0xf626('0x7')](),controller[_0xf626('0xe')]);module[_0xf626('0xf')]=router; \ No newline at end of file +var _0x0233=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x47f32a,_0x16c861){var _0x47ec60=function(_0x179804){while(--_0x179804){_0x47f32a['push'](_0x47f32a['shift']());}};_0x47ec60(++_0x16c861);}(_0x0233,0x1c0));var _0x3023=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0233[_0x411017];return _0x2adeea;};'use strict';var multer=require('multer');var util=require(_0x3023('0x0'));var path=require(_0x3023('0x1'));var timeout=require(_0x3023('0x2'));var express=require(_0x3023('0x3'));var router=express['Router']();var auth=require(_0x3023('0x4'));var interaction=require(_0x3023('0x5'));var config=require(_0x3023('0x6'));var controller=require(_0x3023('0x7'));router[_0x3023('0x8')]('/',auth[_0x3023('0x9')](),controller[_0x3023('0xa')]);router[_0x3023('0x8')](_0x3023('0xb'),auth['isAuthenticated'](),controller[_0x3023('0xc')]);router[_0x3023('0xd')]('/',auth['isAuthenticated'](),controller[_0x3023('0xe')]);router[_0x3023('0xf')](_0x3023('0xb'),auth[_0x3023('0x9')](),controller['update']);router[_0x3023('0x10')](_0x3023('0xb'),auth[_0x3023('0x9')](),controller[_0x3023('0x11')]);module[_0x3023('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index e337fdd..2d02ab5 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 _0x4756=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x34c3ac,_0x40a7f4){var _0x6661a1=function(_0x14f2ec){while(--_0x14f2ec){_0x34c3ac['push'](_0x34c3ac['shift']());}};_0x6661a1(++_0x40a7f4);}(_0x4756,0x165));var _0x6475=function(_0x3b405a,_0x1a2799){_0x3b405a=_0x3b405a-0x0;var _0x35c5b9=_0x4756[_0x3b405a];return _0x35c5b9;};'use strict';var moment=require(_0x6475('0x0'));var Sequelize=require(_0x6475('0x1'));module['exports']={'phone':{'type':Sequelize[_0x6475('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6475('0x3')],'unique':_0x6475('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x6475('0x3')],'unique':_0x6475('0x4')}}; \ No newline at end of file +var _0xa912=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x49202a,_0x59d007){var _0x23f7ef=function(_0x13a833){while(--_0x13a833){_0x49202a['push'](_0x49202a['shift']());}};_0x23f7ef(++_0x59d007);}(_0xa912,0x1c6));var _0x2a91=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xa912[_0x82129b];return _0x2ae5dc;};'use strict';var moment=require(_0x2a91('0x0'));var Sequelize=require(_0x2a91('0x1'));module[_0x2a91('0x2')]={'phone':{'type':Sequelize[_0x2a91('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2a91('0x4')],'unique':_0x2a91('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x2a91('0x5')},'VoiceQueueId':{'type':Sequelize[_0x2a91('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index de56897..02ee871 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(_0x2e4c36,_0x2ea850){var _0x3ec241=function(_0x2b5443){while(--_0x2b5443){_0x2e4c36['push'](_0x2e4c36['shift']());}};_0x3ec241(++_0x2ea850);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x188695,_0x45ccce){var _0x587177=function(_0x213e24){while(--_0x213e24){_0x188695['push'](_0x188695['shift']());}};_0x587177(++_0x45ccce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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 1e87c94..f0d4613 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 _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x8662c0,_0x39f5ab){var _0x420adf=function(_0x3c8e63){while(--_0x3c8e63){_0x8662c0['push'](_0x8662c0['shift']());}};_0x420adf(++_0x39f5ab);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','../../config/logger','api','moment','bluebird','path'];(function(_0x2f01b4,_0x39603a){var _0x37f8e9=function(_0x2e89b1){while(--_0x2e89b1){_0x2f01b4['push'](_0x2f01b4['shift']());}};_0x37f8e9(++_0x39603a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xcb91[_0x58db4e];return _0x40139a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmHopperBlack',attributes,{'tableName':_0x1cb9('0x9'),'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 fd87d3b..2fb35ce 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 _0x4363=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','map','include','model','attributes','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x4363,0x148));var _0x3436=function(_0x44d9cc,_0x3d912c){_0x44d9cc=_0x44d9cc-0x0;var _0x15b090=_0x4363[_0x44d9cc];return _0x15b090;};'use strict';var _=require(_0x3436('0x0'));var util=require(_0x3436('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3436('0x2'));var fs=require('fs');var Redis=require(_0x3436('0x3'));var db=require(_0x3436('0x4'))['db'];var utils=require(_0x3436('0x5'));var logger=require(_0x3436('0x6'))('rpc');var config=require(_0x3436('0x7'));var jayson=require(_0x3436('0x8'));var client=jayson['client'][_0x3436('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25f2bf,_0x6c3143,_0x50c8d1){return new BPromise(function(_0x1b74f4,_0x395961){return client[_0x3436('0xa')](_0x25f2bf,_0x50c8d1)[_0x3436('0xb')](function(_0x542897){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x6c3143,_0x3436('0xc'));logger[_0x3436('0xd')](_0x3436('0xe'),_0x6c3143,_0x3436('0xc'),JSON[_0x3436('0xf')](_0x542897));if(_0x542897['error']){if(_0x542897[_0x3436('0x10')][_0x3436('0x11')]===0x1f4){logger[_0x3436('0x10')](_0x3436('0x12'),_0x6c3143,_0x542897[_0x3436('0x10')][_0x3436('0x13')]);return _0x395961(_0x542897['error'][_0x3436('0x13')]);}logger[_0x3436('0x10')](_0x3436('0x12'),_0x6c3143,_0x542897[_0x3436('0x10')][_0x3436('0x13')]);return _0x1b74f4(_0x542897[_0x3436('0x10')]['message']);}else{logger['info'](_0x3436('0x12'),_0x6c3143,_0x3436('0xc'));_0x1b74f4(_0x542897[_0x3436('0x14')][_0x3436('0x13')]);}})[_0x3436('0x15')](function(_0x4b55c7){logger[_0x3436('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x6c3143,_0x4b55c7);_0x395961(_0x4b55c7);});});}exports[_0x3436('0x16')]=function(_0x436ef3){var _0x306a5d=this;return new Promise(function(_0x1b67a6,_0x286a41){return db[_0x3436('0x17')][_0x3436('0x18')]({'raw':_0x436ef3['options']?_0x436ef3[_0x3436('0x19')][_0x3436('0x1a')]===undefined?!![]:![]:!![],'where':_0x436ef3[_0x3436('0x19')]?_0x436ef3[_0x3436('0x19')][_0x3436('0x1b')]||null:null,'attributes':_0x436ef3[_0x3436('0x19')]?_0x436ef3['options']['attributes']||null:null,'limit':_0x436ef3[_0x3436('0x19')]?_0x436ef3[_0x3436('0x19')][_0x3436('0x1c')]||null:null,'include':_0x436ef3[_0x3436('0x19')]?_0x436ef3[_0x3436('0x19')]['include']?_[_0x3436('0x1d')](_0x436ef3[_0x3436('0x19')][_0x3436('0x1e')],function(_0x210c1d){return{'model':db[_0x210c1d[_0x3436('0x1f')]],'as':_0x210c1d['as'],'attributes':_0x210c1d[_0x3436('0x20')],'include':_0x210c1d[_0x3436('0x1e')]?_[_0x3436('0x1d')](_0x210c1d['include'],function(_0xaf483c){return{'model':db[_0xaf483c[_0x3436('0x1f')]],'as':_0xaf483c['as'],'attributes':_0xaf483c[_0x3436('0x20')],'include':_0xaf483c[_0x3436('0x1e')]?_['map'](_0xaf483c[_0x3436('0x1e')],function(_0xd3f799){return{'model':db[_0xd3f799[_0x3436('0x1f')]],'as':_0xd3f799['as'],'attributes':_0xd3f799['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1307fd){logger['info'](_0x3436('0x16'),_0x436ef3);logger[_0x3436('0xd')]('GetCmHopperBlack',_0x436ef3,JSON['stringify'](_0x1307fd));_0x1b67a6(_0x1307fd);})[_0x3436('0x15')](function(_0x2a0bb0){logger[_0x3436('0x10')](_0x3436('0x16'),_0x2a0bb0['message'],_0x436ef3);_0x286a41(_0x306a5d[_0x3436('0x10')](0x1f4,_0x2a0bb0[_0x3436('0x13')]));});});};exports[_0x3436('0x21')]=function(_0x35fe69){var _0x206c32=this;return new Promise(function(_0x5a82d4,_0x2c6c0d){return db[_0x3436('0x17')]['update'](_0x35fe69[_0x3436('0x22')],{'raw':_0x35fe69['options']?_0x35fe69[_0x3436('0x19')][_0x3436('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35fe69['options']?_0x35fe69[_0x3436('0x19')][_0x3436('0x1b')]||null:null,'attributes':_0x35fe69[_0x3436('0x19')]?_0x35fe69[_0x3436('0x19')]['attributes']||null:null,'limit':_0x35fe69[_0x3436('0x19')]?_0x35fe69[_0x3436('0x19')][_0x3436('0x1c')]||null:null})['then'](function(_0x4f62d7){logger['info'](_0x3436('0x21'),_0x35fe69);logger[_0x3436('0xd')]('UpdateCmHopperBlack',_0x35fe69,JSON[_0x3436('0xf')](_0x4f62d7));_0x5a82d4(_0x4f62d7);})[_0x3436('0x15')](function(_0x3653de){logger[_0x3436('0x10')](_0x3436('0x21'),_0x3653de[_0x3436('0x13')],_0x35fe69);_0x2c6c0d(_0x206c32[_0x3436('0x10')](0x1f4,_0x3653de['message']));});});};exports[_0x3436('0x23')]=function(_0x2d6dcc){var _0x229c88=this;return new Promise(function(_0x57244a,_0x421046){return db[_0x3436('0x17')][_0x3436('0x24')]({'where':_0x2d6dcc[_0x3436('0x19')]?_0x2d6dcc[_0x3436('0x19')][_0x3436('0x1b')]||null:null})[_0x3436('0xb')](function(_0x293e44){logger['info'](_0x3436('0x23'),_0x2d6dcc);logger['debug'](_0x3436('0x23'),_0x2d6dcc,JSON[_0x3436('0xf')](_0x293e44));_0x57244a(_0x293e44);})[_0x3436('0x15')](function(_0x42063a){logger[_0x3436('0x10')](_0x3436('0x23'),_0x42063a[_0x3436('0x13')],_0x2d6dcc);_0x421046(_0x229c88[_0x3436('0x10')](0x1f4,_0x42063a[_0x3436('0x13')]));});});}; \ No newline at end of file +var _0xe243=['raw','where','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','model','include','map','then','debug','stringify','catch','UpdateCmHopperBlack','update','body'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xe243,0x1d8));var _0x3e24=function(_0x52c3c3,_0x5af662){_0x52c3c3=_0x52c3c3-0x0;var _0x34389a=_0xe243[_0x52c3c3];return _0x34389a;};'use strict';var _=require(_0x3e24('0x0'));var util=require(_0x3e24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e24('0x2'));var fs=require('fs');var Redis=require(_0x3e24('0x3'));var db=require(_0x3e24('0x4'))['db'];var utils=require(_0x3e24('0x5'));var logger=require('../../config/logger')(_0x3e24('0x6'));var config=require(_0x3e24('0x7'));var jayson=require(_0x3e24('0x8'));var client=jayson[_0x3e24('0x9')][_0x3e24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1428f6,_0x256448,_0x433cbe){return new BPromise(function(_0x424de6,_0x57f1d5){return client[_0x3e24('0xb')](_0x1428f6,_0x433cbe)['then'](function(_0x223daf){logger[_0x3e24('0xc')](_0x3e24('0xd'),_0x256448,_0x3e24('0xe'));logger['debug'](_0x3e24('0xf'),_0x256448,_0x3e24('0xe'),JSON['stringify'](_0x223daf));if(_0x223daf[_0x3e24('0x10')]){if(_0x223daf[_0x3e24('0x10')][_0x3e24('0x11')]===0x1f4){logger[_0x3e24('0x10')](_0x3e24('0xd'),_0x256448,_0x223daf[_0x3e24('0x10')][_0x3e24('0x12')]);return _0x57f1d5(_0x223daf[_0x3e24('0x10')]['message']);}logger[_0x3e24('0x10')](_0x3e24('0xd'),_0x256448,_0x223daf[_0x3e24('0x10')][_0x3e24('0x12')]);return _0x424de6(_0x223daf['error']['message']);}else{logger[_0x3e24('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x256448,_0x3e24('0xe'));_0x424de6(_0x223daf['result']['message']);}})['catch'](function(_0x147071){logger[_0x3e24('0x10')](_0x3e24('0xd'),_0x256448,_0x147071);_0x57f1d5(_0x147071);});});}exports[_0x3e24('0x13')]=function(_0x2320f3){var _0x5de392=this;return new Promise(function(_0xce0bd,_0x2347ce){return db[_0x3e24('0x14')][_0x3e24('0x15')]({'raw':_0x2320f3['options']?_0x2320f3[_0x3e24('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2320f3[_0x3e24('0x16')]?_0x2320f3[_0x3e24('0x16')]['where']||null:null,'attributes':_0x2320f3[_0x3e24('0x16')]?_0x2320f3[_0x3e24('0x16')][_0x3e24('0x17')]||null:null,'limit':_0x2320f3[_0x3e24('0x16')]?_0x2320f3[_0x3e24('0x16')][_0x3e24('0x18')]||null:null,'include':_0x2320f3[_0x3e24('0x16')]?_0x2320f3['options']['include']?_['map'](_0x2320f3[_0x3e24('0x16')]['include'],function(_0x3be720){return{'model':db[_0x3be720[_0x3e24('0x19')]],'as':_0x3be720['as'],'attributes':_0x3be720[_0x3e24('0x17')],'include':_0x3be720[_0x3e24('0x1a')]?_[_0x3e24('0x1b')](_0x3be720[_0x3e24('0x1a')],function(_0x135c84){return{'model':db[_0x135c84['model']],'as':_0x135c84['as'],'attributes':_0x135c84[_0x3e24('0x17')],'include':_0x135c84['include']?_['map'](_0x135c84['include'],function(_0x2a8060){return{'model':db[_0x2a8060[_0x3e24('0x19')]],'as':_0x2a8060['as'],'attributes':_0x2a8060[_0x3e24('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3e24('0x1c')](function(_0x17cf97){logger['info'](_0x3e24('0x13'),_0x2320f3);logger[_0x3e24('0x1d')](_0x3e24('0x13'),_0x2320f3,JSON[_0x3e24('0x1e')](_0x17cf97));_0xce0bd(_0x17cf97);})[_0x3e24('0x1f')](function(_0x1941d7){logger[_0x3e24('0x10')](_0x3e24('0x13'),_0x1941d7[_0x3e24('0x12')],_0x2320f3);_0x2347ce(_0x5de392[_0x3e24('0x10')](0x1f4,_0x1941d7['message']));});});};exports[_0x3e24('0x20')]=function(_0x56b8c9){var _0x2472ed=this;return new Promise(function(_0x3245f5,_0x49e026){return db[_0x3e24('0x14')][_0x3e24('0x21')](_0x56b8c9[_0x3e24('0x22')],{'raw':_0x56b8c9['options']?_0x56b8c9['options'][_0x3e24('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56b8c9['options']?_0x56b8c9[_0x3e24('0x16')][_0x3e24('0x24')]||null:null,'attributes':_0x56b8c9[_0x3e24('0x16')]?_0x56b8c9[_0x3e24('0x16')][_0x3e24('0x17')]||null:null,'limit':_0x56b8c9['options']?_0x56b8c9['options']['limit']||null:null})[_0x3e24('0x1c')](function(_0x588226){logger[_0x3e24('0xc')](_0x3e24('0x20'),_0x56b8c9);logger[_0x3e24('0x1d')](_0x3e24('0x20'),_0x56b8c9,JSON[_0x3e24('0x1e')](_0x588226));_0x3245f5(_0x588226);})[_0x3e24('0x1f')](function(_0x518a9b){logger['error'](_0x3e24('0x20'),_0x518a9b[_0x3e24('0x12')],_0x56b8c9);_0x49e026(_0x2472ed[_0x3e24('0x10')](0x1f4,_0x518a9b['message']));});});};exports[_0x3e24('0x25')]=function(_0x4901ff){var _0x5678f9=this;return new Promise(function(_0x52292b,_0x16a4c1){return db[_0x3e24('0x14')][_0x3e24('0x26')]({'where':_0x4901ff[_0x3e24('0x16')]?_0x4901ff[_0x3e24('0x16')][_0x3e24('0x24')]||null:null})[_0x3e24('0x1c')](function(_0x2e8276){logger[_0x3e24('0xc')](_0x3e24('0x25'),_0x4901ff);logger['debug'](_0x3e24('0x25'),_0x4901ff,JSON['stringify'](_0x2e8276));_0x52292b(_0x2e8276);})['catch'](function(_0x512c60){logger[_0x3e24('0x10')](_0x3e24('0x25'),_0x512c60[_0x3e24('0x12')],_0x4901ff);_0x16a4c1(_0x5678f9['error'](0x1f4,_0x512c60[_0x3e24('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2ada3ef..c8c1ca6 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(_0x1a6d04,_0xf996f7){var _0x3e5ff6=function(_0x497e18){while(--_0x497e18){_0x1a6d04['push'](_0x1a6d04['shift']());}};_0x3e5ff6(++_0xf996f7);}(_0xb821,0xa7));var _0x1b82=function(_0x2e2f8d,_0x53a6fa){_0x2e2f8d=_0x2e2f8d-0x0;var _0x2c4ab5=_0xb821[_0x2e2f8d];return _0x2c4ab5;};'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 _0x84ab=['update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','/:id','show'];(function(_0x1751e4,_0x43a6e4){var _0xeecbaa=function(_0x1a018b){while(--_0x1a018b){_0x1751e4['push'](_0x1751e4['shift']());}};_0xeecbaa(++_0x43a6e4);}(_0x84ab,0x12f));var _0xb84a=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x84ab[_0x414655];return _0x237884;};'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['put'](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xd')]);module[_0xb84a('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 706395c..6a9bb24 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 _0x5ad3=['seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','diff'];(function(_0x367c51,_0x4981d){var _0xbae154=function(_0xefd3aa){while(--_0xefd3aa){_0x367c51['push'](_0x367c51['shift']());}};_0xbae154(++_0x4981d);}(_0x5ad3,0xba));var _0x35ad=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5ad3[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x35ad('0x0'));var moment=require(_0x35ad('0x1'));module[_0x35ad('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x35ad('0x3')]},'scheduledat':{'type':Sequelize[_0x35ad('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x35ad('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x35ad('0x3')]},'originatecalleridname':{'type':Sequelize[_0x35ad('0x3')]},'calleridnum':{'type':Sequelize[_0x35ad('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x35ad('0x4')]},'responsetime':{'type':Sequelize[_0x35ad('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x35ad('0x4')]},'endtime':{'type':Sequelize[_0x35ad('0x4')]},'ringtime':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x35ad('0x3')]},'campaigntype':{'type':Sequelize[_0x35ad('0x3')]},'membername':{'type':Sequelize[_0x35ad('0x3')]},'reason':{'type':Sequelize[_0x35ad('0x3')]},'disposition':{'type':Sequelize[_0x35ad('0x3')]},'dispositionat':{'type':Sequelize[_0x35ad('0x4')],'set':function(_0x59acc2){var _0x2c9b91=this[_0x35ad('0x6')](_0x35ad('0x7'));if(_0x2c9b91&&_0x59acc2){this['setDataValue']('followuptime',moment(_0x59acc2)[_0x35ad('0x8')](moment(_0x2c9b91),_0x35ad('0x9')));}return this[_0x35ad('0xa')](_0x35ad('0xb'),_0x59acc2);}},'amd':{'type':Sequelize[_0x35ad('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x35ad('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x35ad('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x35ad('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x35ad('0x4')]},'callback':{'type':Sequelize[_0x35ad('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x35ad('0x4')]},'deleted':{'type':Sequelize[_0x35ad('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x35ad('0x4')]},'recallme':{'type':Sequelize[_0x35ad('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x35ad('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x35ad('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf427=['dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x56ed09,_0x47abc8){var _0x1d5fae=function(_0x4657d5){while(--_0x4657d5){_0x56ed09['push'](_0x56ed09['shift']());}};_0x1d5fae(++_0x47abc8);}(_0xf427,0x72));var _0x7f42=function(_0x2d9cab,_0x3ce7b1){_0x2d9cab=_0x2d9cab-0x0;var _0x1b8455=_0xf427[_0x2d9cab];return _0x1b8455;};'use strict';var Sequelize=require(_0x7f42('0x0'));var moment=require(_0x7f42('0x1'));module[_0x7f42('0x2')]={'state':{'type':Sequelize[_0x7f42('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x7f42('0x4')]},'scheduledat':{'type':Sequelize[_0x7f42('0x5')]},'countbusyretry':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7f42('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x7f42('0x4')]},'calleridnum':{'type':Sequelize[_0x7f42('0x4')]},'calleridname':{'type':Sequelize[_0x7f42('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7f42('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7f42('0x5')]},'endtime':{'type':Sequelize[_0x7f42('0x5')]},'ringtime':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7f42('0x4')]},'campaign':{'type':Sequelize[_0x7f42('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7f42('0x4')]},'disposition':{'type':Sequelize[_0x7f42('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0xc720b7){var _0x2ef3e3=this[_0x7f42('0x6')](_0x7f42('0x7'));if(_0x2ef3e3&&_0xc720b7){this[_0x7f42('0x8')](_0x7f42('0x9'),moment(_0xc720b7)[_0x7f42('0xa')](moment(_0x2ef3e3),_0x7f42('0xb')));}return this[_0x7f42('0x8')](_0x7f42('0xc'),_0xc720b7);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7f42('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7f42('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7f42('0x5')]},'callback':{'type':Sequelize[_0x7f42('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7f42('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7f42('0x5')]},'deleted':{'type':Sequelize[_0x7f42('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7f42('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x7f42('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e2f4efc..5edf433 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 _0xd6f9=['pick','filter','merge','VIRTUAL','CmHopperFinal','include','rows','catch','show','params','includeAll','options','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','cm_hopper_final','state\x20=\x204','group','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x12e2ff,_0xcca570){var _0x35aafb=function(_0x32e3a7){while(--_0x32e3a7){_0x12e2ff['push'](_0x12e2ff['shift']());}};_0x35aafb(++_0xcca570);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xd6f9[_0x3a6efd];return _0x487b9a;};'use strict';var pdf=require(_0x9d6f('0x0'));var emlformat=require(_0x9d6f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d6f('0x2'));var rp=require(_0x9d6f('0x3'));var moment=require(_0x9d6f('0x4'));var BPromise=require(_0x9d6f('0x5'));var Mustache=require('mustache');var util=require(_0x9d6f('0x6'));var path=require(_0x9d6f('0x7'));var sox=require(_0x9d6f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d6f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d6f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d6f('0xb'));var toCsv=require(_0x9d6f('0xc'));var querystring=require(_0x9d6f('0xd'));var Papa=require(_0x9d6f('0xe'));var Redis=require(_0x9d6f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d6f('0x10'));var logger=require(_0x9d6f('0x11'))(_0x9d6f('0x12'));var utils=require(_0x9d6f('0x13'));var config=require(_0x9d6f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23902f,_0x736008){_0x736008=_0x736008||0xcc;return function(_0x29ce37){if(_0x29ce37){return _0x23902f[_0x9d6f('0x15')](_0x736008);}return _0x23902f[_0x9d6f('0x16')](_0x736008)['end']();};}function respondWithResult(_0x30e407,_0x2da36f){_0x2da36f=_0x2da36f||0xc8;return function(_0x34e8dd){if(_0x34e8dd){return _0x30e407[_0x9d6f('0x16')](_0x2da36f)[_0x9d6f('0x17')](_0x34e8dd);}};}function respondWithFilteredResult(_0x5c7489,_0x149557){return function(_0x2f927a){if(_0x2f927a){var _0x41546b=_0x2f927a[_0x9d6f('0x18')],_0x509713=_0x149557[_0x9d6f('0x19')],_0x522501=_0x149557[_0x9d6f('0x19')]+_0x149557['limit'],_0xc09663;if(_0x522501>=_0x41546b){_0x522501=_0x41546b;_0xc09663=0xc8;}else{_0xc09663=0xce;}_0x5c7489[_0x9d6f('0x16')](_0xc09663);return _0x5c7489[_0x9d6f('0x1a')]('Content-Range',_0x509713+'-'+_0x522501+'/'+_0x41546b)[_0x9d6f('0x17')](_0x2f927a);}return null;};}function patchUpdates(_0xa107fa){return function(_0x3954ea){try{jsonpatch['apply'](_0x3954ea,_0xa107fa,!![]);}catch(_0x44c894){return BPromise[_0x9d6f('0x1b')](_0x44c894);}return _0x3954ea[_0x9d6f('0x1c')]();};}function saveUpdates(_0x568f26,_0x3ce2ca){return function(_0x339b40){if(_0x339b40){return _0x339b40[_0x9d6f('0x1d')](_0x568f26)[_0x9d6f('0x1e')](function(_0x263038){return _0x263038;});}return null;};}function removeEntity(_0x4fbb06,_0x770eab){return function(_0x312de5){if(_0x312de5){return _0x312de5[_0x9d6f('0x1f')]()[_0x9d6f('0x1e')](function(){_0x4fbb06['status'](0xcc)[_0x9d6f('0x20')]();});}};}function handleEntityNotFound(_0x21f538,_0x367d48){return function(_0x2a13dc){if(!_0x2a13dc){_0x21f538[_0x9d6f('0x15')](0x194);}return _0x2a13dc;};}function handleError(_0x4b0a9d,_0x304fd9){_0x304fd9=_0x304fd9||0x1f4;return function(_0x404ae7){logger[_0x9d6f('0x21')](_0x404ae7[_0x9d6f('0x22')]);if(_0x404ae7[_0x9d6f('0x23')]){delete _0x404ae7['name'];}_0x4b0a9d[_0x9d6f('0x16')](_0x304fd9)[_0x9d6f('0x24')](_0x404ae7);};}exports[_0x9d6f('0x25')]=function(_0x537bb3,_0x2d01b5){var _0x5cded2={},_0x320145={},_0x18e323={'count':0x0,'rows':[]};var _0x3f825d=_[_0x9d6f('0x26')](db['CmHopperFinal']['rawAttributes'],function(_0x51ade6){return{'name':_0x51ade6['fieldName'],'type':_0x51ade6[_0x9d6f('0x27')][_0x9d6f('0x28')]};});_0x320145[_0x9d6f('0x29')]=_[_0x9d6f('0x26')](_0x3f825d,_0x9d6f('0x23'));_0x320145[_0x9d6f('0x2a')]=_[_0x9d6f('0x2b')](_0x537bb3[_0x9d6f('0x2a')]);_0x320145[_0x9d6f('0x2c')]=_[_0x9d6f('0x2d')](_0x320145[_0x9d6f('0x29')],_0x320145[_0x9d6f('0x2a')]);_0x5cded2[_0x9d6f('0x2e')]=_[_0x9d6f('0x2d')](_0x320145[_0x9d6f('0x29')],qs[_0x9d6f('0x2f')](_0x537bb3[_0x9d6f('0x2a')][_0x9d6f('0x2f')]));_0x5cded2[_0x9d6f('0x2e')]=_0x5cded2[_0x9d6f('0x2e')]['length']?_0x5cded2[_0x9d6f('0x2e')]:_0x320145['model'];if(!_0x537bb3['query'][_0x9d6f('0x30')](_0x9d6f('0x31'))){_0x5cded2[_0x9d6f('0x32')]=qs[_0x9d6f('0x32')](_0x537bb3[_0x9d6f('0x2a')][_0x9d6f('0x32')]);_0x5cded2[_0x9d6f('0x19')]=qs[_0x9d6f('0x19')](_0x537bb3[_0x9d6f('0x2a')][_0x9d6f('0x19')]);}_0x5cded2[_0x9d6f('0x33')]=qs[_0x9d6f('0x34')](_0x537bb3['query'][_0x9d6f('0x34')]);_0x5cded2[_0x9d6f('0x35')]=qs[_0x9d6f('0x2c')](_[_0x9d6f('0x36')](_0x537bb3[_0x9d6f('0x2a')],_0x320145[_0x9d6f('0x2c')]),_0x3f825d);if(_0x537bb3[_0x9d6f('0x2a')][_0x9d6f('0x37')]){_0x5cded2['where']=_[_0x9d6f('0x38')](_0x5cded2[_0x9d6f('0x35')],{'$or':_['map'](_0x3f825d,function(_0xa8d8ad){if(_0xa8d8ad['type']!==_0x9d6f('0x39')){var _0x7efde6={};_0x7efde6[_0xa8d8ad['name']]={'$like':'%'+_0x537bb3[_0x9d6f('0x2a')][_0x9d6f('0x37')]+'%'};return _0x7efde6;}})});}_0x5cded2=_[_0x9d6f('0x38')]({},_0x5cded2,_0x537bb3['options']);var _0x114bc1={'where':_0x5cded2['where']};return db[_0x9d6f('0x3a')][_0x9d6f('0x18')](_0x114bc1)[_0x9d6f('0x1e')](function(_0x393f39){_0x18e323[_0x9d6f('0x18')]=_0x393f39;if(_0x537bb3[_0x9d6f('0x2a')]['includeAll']){_0x5cded2[_0x9d6f('0x3b')]=[{'all':!![]}];}return db[_0x9d6f('0x3a')]['findAll'](_0x5cded2);})[_0x9d6f('0x1e')](function(_0x2c3a53){_0x18e323[_0x9d6f('0x3c')]=_0x2c3a53;return _0x18e323;})[_0x9d6f('0x1e')](respondWithFilteredResult(_0x2d01b5,_0x5cded2))[_0x9d6f('0x3d')](handleError(_0x2d01b5,null));};exports[_0x9d6f('0x3e')]=function(_0x46125a,_0x4314d0){var _0x3a19f8={'raw':!![],'where':{'id':_0x46125a[_0x9d6f('0x3f')]['id']}},_0x232a90={};_0x232a90['model']=_['keys'](db[_0x9d6f('0x3a')]['rawAttributes']);_0x232a90[_0x9d6f('0x2a')]=_['keys'](_0x46125a[_0x9d6f('0x2a')]);_0x232a90['filters']=_[_0x9d6f('0x2d')](_0x232a90['model'],_0x232a90[_0x9d6f('0x2a')]);_0x3a19f8['attributes']=_['intersection'](_0x232a90['model'],qs[_0x9d6f('0x2f')](_0x46125a[_0x9d6f('0x2a')]['fields']));_0x3a19f8[_0x9d6f('0x2e')]=_0x3a19f8[_0x9d6f('0x2e')]['length']?_0x3a19f8[_0x9d6f('0x2e')]:_0x232a90[_0x9d6f('0x29')];if(_0x46125a[_0x9d6f('0x2a')][_0x9d6f('0x40')]){_0x3a19f8[_0x9d6f('0x3b')]=[{'all':!![]}];}_0x3a19f8=_['merge']({},_0x3a19f8,_0x46125a[_0x9d6f('0x41')]);return db[_0x9d6f('0x3a')][_0x9d6f('0x42')](_0x3a19f8)[_0x9d6f('0x1e')](handleEntityNotFound(_0x4314d0,null))[_0x9d6f('0x1e')](respondWithResult(_0x4314d0,null))[_0x9d6f('0x3d')](handleError(_0x4314d0,null));};exports[_0x9d6f('0x43')]=function(_0x34bba3,_0x3779eb){return db['CmHopperFinal'][_0x9d6f('0x43')]()[_0x9d6f('0x1e')](respondWithResult(_0x3779eb,null))[_0x9d6f('0x3d')](handleError(_0x3779eb,null));};exports[_0x9d6f('0x1d')]=function(_0x17ca02,_0x12611c){if(_0x17ca02['body'][_0x9d6f('0x44')]){delete _0x17ca02[_0x9d6f('0x45')][_0x9d6f('0x44')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x17ca02[_0x9d6f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12611c,null))[_0x9d6f('0x1e')](saveUpdates(_0x17ca02[_0x9d6f('0x45')],null))[_0x9d6f('0x1e')](respondWithResult(_0x12611c,null))[_0x9d6f('0x3d')](handleError(_0x12611c,null));};exports[_0x9d6f('0x46')]=function(_0x3614c0,_0x15368d,_0x973656){return db[_0x9d6f('0x3a')][_0x9d6f('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x3614c0[_0x9d6f('0x3f')]['id']},'attributes':[[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x4b')))),_0x9d6f('0x4c')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x9d6f('0x4d')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x4e')))),_0x9d6f('0x4f')],[db['sequelize']['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db['sequelize']['literal'](_0x9d6f('0x50')))),_0x9d6f('0x51')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x52')))),_0x9d6f('0x53')],[db['sequelize']['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')]['literal'](_0x9d6f('0x54')))),_0x9d6f('0x55')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db['sequelize'][_0x9d6f('0x4a')](_0x9d6f('0x56')))),_0x9d6f('0x57')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x58')))),_0x9d6f('0x59')]]})[_0x9d6f('0x1e')](handleEntityNotFound(_0x15368d,null))[_0x9d6f('0x1e')](respondWithResult(_0x15368d,null))[_0x9d6f('0x3d')](handleError(_0x15368d,null));};exports[_0x9d6f('0x5a')]=function(_0x51c668,_0x26cf25,_0x7673fd){return db['CmHopperFinal'][_0x9d6f('0x47')]({'raw':![],'where':{'CampaignId':_0x51c668[_0x9d6f('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')]['literal'](_0x9d6f('0x5b')))),'noAnswerContacts'],[db[_0x9d6f('0x48')]['fn']('COUNT',db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db['sequelize']['literal'](_0x9d6f('0x50')))),_0x9d6f('0x51')],[db['sequelize']['fn']('COUNT',db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x52')))),_0x9d6f('0x53')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db['sequelize']['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x54')))),_0x9d6f('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9d6f('0x48')]['fn']('IF',db['sequelize'][_0x9d6f('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9d6f('0x57')],[db[_0x9d6f('0x48')]['fn'](_0x9d6f('0x49'),db[_0x9d6f('0x48')]['fn']('IF',db[_0x9d6f('0x48')][_0x9d6f('0x4a')](_0x9d6f('0x58')))),_0x9d6f('0x59')]]})[_0x9d6f('0x1e')](handleEntityNotFound(_0x26cf25,null))[_0x9d6f('0x1e')](respondWithResult(_0x26cf25,null))[_0x9d6f('0x3d')](handleError(_0x26cf25,null));};exports[_0x9d6f('0x5c')]=function(_0x4f26dd,_0x102153,_0x41f7ac){return db[_0x9d6f('0x5d')][_0x9d6f('0x42')]({'where':{'id':_0x4f26dd[_0x9d6f('0x3f')]['id']}})[_0x9d6f('0x1e')](handleEntityNotFound(_0x102153,null))[_0x9d6f('0x1e')](function(_0x39409b){var _0x3b6639;if(_0x39409b){_0x3b6639=squel[_0x9d6f('0x5e')]()[_0x9d6f('0x5f')](_0x9d6f('0x60'))[_0x9d6f('0x61')]([_0x9d6f('0x62'),_0x9d6f('0x63'),_0x9d6f('0x64'),_0x9d6f('0x65'),_0x9d6f('0x66'),_0x9d6f('0x67'),'updatedAt'],squel[_0x9d6f('0x68')]()[_0x9d6f('0x69')](_0x9d6f('0x6a'),'phone')['field'](_0x9d6f('0x6b'),_0x9d6f('0x63'))[_0x9d6f('0x69')](_0x9d6f('0x6c'),_0x9d6f('0x64'))[_0x9d6f('0x69')]('ANY_VALUE(ListId)','ListId')['field'](_0x9d6f('0x6d'),_0x9d6f('0x66'))[_0x9d6f('0x69')]('NOW()',_0x9d6f('0x67'))[_0x9d6f('0x69')](_0x9d6f('0x6b'),_0x9d6f('0x6e'))[_0x9d6f('0x6f')]('cm_hopper_final')[_0x9d6f('0x35')]('VoiceQueueId\x20=\x20?',_0x4f26dd['params']['id'][_0x9d6f('0x70')]())[_0x9d6f('0x35')](_0x9d6f('0x71'),_0x4f26dd['body'][_0x9d6f('0x72')][_0x9d6f('0x70')]())[_0x9d6f('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x9d6f('0x35')](_0x9d6f('0x73'),squel[_0x9d6f('0x68')]()['field'](_0x9d6f('0x62'))[_0x9d6f('0x6f')](_0x9d6f('0x60'))[_0x9d6f('0x35')](_0x9d6f('0x74'),_0x4f26dd['params']['id']['toString']()))[_0x9d6f('0x35')](_0x9d6f('0x73'),squel['select']()[_0x9d6f('0x69')]('calleridnum')[_0x9d6f('0x6f')](_0x9d6f('0x75'))[_0x9d6f('0x35')](_0x9d6f('0x74'),_0x4f26dd[_0x9d6f('0x3f')]['id'][_0x9d6f('0x70')]())['where'](_0x9d6f('0x76')))[_0x9d6f('0x77')](_0x9d6f('0x64')))[_0x9d6f('0x70')]();return db[_0x9d6f('0x48')][_0x9d6f('0x2a')](_0x3b6639);}return[];})[_0x9d6f('0x1e')](respondWithResult(_0x102153,null))['catch'](handleError(_0x102153,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f6eb3,_0x5635b9,_0xe6eaeb){return db['Campaign'][_0x9d6f('0x42')]({'where':{'id':_0x3f6eb3[_0x9d6f('0x3f')]['id']}})[_0x9d6f('0x1e')](handleEntityNotFound(_0x5635b9,null))['then'](function(_0xf9dd29){var _0x436b3c;if(_0xf9dd29){_0x436b3c=squel[_0x9d6f('0x5e')]()[_0x9d6f('0x5f')](_0x9d6f('0x60'))[_0x9d6f('0x61')](['phone',_0x9d6f('0x63'),'ContactId',_0x9d6f('0x65'),_0x9d6f('0x78'),_0x9d6f('0x67'),_0x9d6f('0x6e')],squel[_0x9d6f('0x68')]()[_0x9d6f('0x69')](_0x9d6f('0x6a'),_0x9d6f('0x62'))['field'](_0x9d6f('0x6b'),_0x9d6f('0x63'))[_0x9d6f('0x69')]('ANY_VALUE(ContactId)',_0x9d6f('0x64'))['field'](_0x9d6f('0x79'),_0x9d6f('0x65'))['field'](_0x9d6f('0x7a'),_0x9d6f('0x78'))[_0x9d6f('0x69')]('NOW()',_0x9d6f('0x67'))[_0x9d6f('0x69')]('NOW()',_0x9d6f('0x6e'))[_0x9d6f('0x6f')](_0x9d6f('0x75'))[_0x9d6f('0x35')](_0x9d6f('0x7b'),_0x3f6eb3[_0x9d6f('0x3f')]['id'][_0x9d6f('0x70')]())[_0x9d6f('0x35')](_0x9d6f('0x71'),_0x3f6eb3[_0x9d6f('0x45')]['state'][_0x9d6f('0x70')]())[_0x9d6f('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x9d6f('0x35')](_0x9d6f('0x73'),squel['select']()['field'](_0x9d6f('0x62'))[_0x9d6f('0x6f')](_0x9d6f('0x60'))['where'](_0x9d6f('0x7b'),_0x3f6eb3[_0x9d6f('0x3f')]['id'][_0x9d6f('0x70')]()))[_0x9d6f('0x35')](_0x9d6f('0x73'),squel[_0x9d6f('0x68')]()['field'](_0x9d6f('0x7c'))['from'](_0x9d6f('0x75'))[_0x9d6f('0x35')](_0x9d6f('0x7b'),_0x3f6eb3['params']['id'][_0x9d6f('0x70')]())[_0x9d6f('0x35')]('state\x20=\x204'))[_0x9d6f('0x77')](_0x9d6f('0x64')))['toString']();return db[_0x9d6f('0x48')]['query'](_0x436b3c);}return[];})['then'](respondWithResult(_0x5635b9,null))[_0x9d6f('0x3d')](handleError(_0x5635b9,null));};exports[_0x9d6f('0x7d')]=function(_0x382f2f,_0x55ab85,_0x1a6d5d){return db[_0x9d6f('0x7e')][_0x9d6f('0x7f')]({'where':{'VoiceQueueId':_0x382f2f[_0x9d6f('0x45')]['VoiceQueueId'],'CampaignId':_0x382f2f['body'][_0x9d6f('0x78')],'ContactId':_0x382f2f[_0x9d6f('0x45')]['ContactId']}})[_0x9d6f('0x1e')](handleEntityNotFound(_0x55ab85,null))[_0x9d6f('0x1e')](function(_0x5a289d){if(_0x5a289d){return _0x5a289d;}return null;})[_0x9d6f('0x1e')](respondWithResult(_0x55ab85,null))[_0x9d6f('0x3d')](handleError(_0x55ab85,null));}; \ No newline at end of file +var _0x9fe7=['api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','index','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','merge','map','VIRTUAL','filter','where','CmHopperFinal','include','findAll','catch','show','params','keys','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','group','Campaign','CampaignId','from','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fe7,0x1df));var _0x79fe=function(_0x19fe6d,_0x3c8f49){_0x19fe6d=_0x19fe6d-0x0;var _0x389ed8=_0x9fe7[_0x19fe6d];return _0x389ed8;};'use strict';var pdf=require(_0x79fe('0x0'));var emlformat=require(_0x79fe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x79fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79fe('0x3'));var moment=require(_0x79fe('0x4'));var BPromise=require(_0x79fe('0x5'));var Mustache=require('mustache');var util=require(_0x79fe('0x6'));var path=require(_0x79fe('0x7'));var sox=require(_0x79fe('0x8'));var csv=require('to-csv');var ejs=require(_0x79fe('0x9'));var fs=require('fs');var _=require(_0x79fe('0xa'));var squel=require(_0x79fe('0xb'));var crypto=require('crypto');var jsforce=require(_0x79fe('0xc'));var deskjs=require(_0x79fe('0xd'));var toCsv=require(_0x79fe('0xe'));var querystring=require(_0x79fe('0xf'));var Papa=require(_0x79fe('0x10'));var Redis=require('ioredis');var authService=require(_0x79fe('0x11'));var qs=require(_0x79fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79fe('0x13'));var logger=require(_0x79fe('0x14'))(_0x79fe('0x15'));var utils=require(_0x79fe('0x16'));var config=require('../../config/environment');var db=require(_0x79fe('0x17'))['db'];function respondWithStatusCode(_0x30c992,_0x3e0ad8){_0x3e0ad8=_0x3e0ad8||0xcc;return function(_0x93c1a7){if(_0x93c1a7){return _0x30c992[_0x79fe('0x18')](_0x3e0ad8);}return _0x30c992[_0x79fe('0x19')](_0x3e0ad8)[_0x79fe('0x1a')]();};}function respondWithResult(_0x1abd7f,_0x4be1c4){_0x4be1c4=_0x4be1c4||0xc8;return function(_0x3bd14a){if(_0x3bd14a){return _0x1abd7f[_0x79fe('0x19')](_0x4be1c4)[_0x79fe('0x1b')](_0x3bd14a);}};}function respondWithFilteredResult(_0x536944,_0x35fb79){return function(_0x25e91b){if(_0x25e91b){var _0x58124b=_0x25e91b[_0x79fe('0x1c')],_0x127ec4=_0x35fb79['offset'],_0xb1955f=_0x35fb79[_0x79fe('0x1d')]+_0x35fb79[_0x79fe('0x1e')],_0xcae4ff;if(_0xb1955f>=_0x58124b){_0xb1955f=_0x58124b;_0xcae4ff=0xc8;}else{_0xcae4ff=0xce;}_0x536944[_0x79fe('0x19')](_0xcae4ff);return _0x536944[_0x79fe('0x1f')]('Content-Range',_0x127ec4+'-'+_0xb1955f+'/'+_0x58124b)['json'](_0x25e91b);}return null;};}function patchUpdates(_0x132964){return function(_0x1a1224){try{jsonpatch[_0x79fe('0x20')](_0x1a1224,_0x132964,!![]);}catch(_0x4bca4d){return BPromise[_0x79fe('0x21')](_0x4bca4d);}return _0x1a1224[_0x79fe('0x22')]();};}function saveUpdates(_0x15882d,_0x4c7062){return function(_0x203405){if(_0x203405){return _0x203405['update'](_0x15882d)[_0x79fe('0x23')](function(_0xde2451){return _0xde2451;});}return null;};}function removeEntity(_0x3f1b15,_0x191bd8){return function(_0x1ac8d7){if(_0x1ac8d7){return _0x1ac8d7[_0x79fe('0x24')]()['then'](function(){_0x3f1b15['status'](0xcc)[_0x79fe('0x1a')]();});}};}function handleEntityNotFound(_0x4e9888,_0x16aa35){return function(_0x3721bc){if(!_0x3721bc){_0x4e9888['sendStatus'](0x194);}return _0x3721bc;};}function handleError(_0x530bc0,_0x454e93){_0x454e93=_0x454e93||0x1f4;return function(_0x321778){logger['error'](_0x321778[_0x79fe('0x25')]);if(_0x321778[_0x79fe('0x26')]){delete _0x321778['name'];}_0x530bc0['status'](_0x454e93)['send'](_0x321778);};}exports[_0x79fe('0x27')]=function(_0x2d890e,_0x36ead5){var _0x4ac913={},_0x47786f={},_0x43782e={'count':0x0,'rows':[]};var _0x3bc5bc=_['map'](db['CmHopperFinal'][_0x79fe('0x28')],function(_0x51200f){return{'name':_0x51200f[_0x79fe('0x29')],'type':_0x51200f['type']['key']};});_0x47786f['model']=_['map'](_0x3bc5bc,_0x79fe('0x26'));_0x47786f[_0x79fe('0x2a')]=_['keys'](_0x2d890e[_0x79fe('0x2a')]);_0x47786f['filters']=_[_0x79fe('0x2b')](_0x47786f[_0x79fe('0x2c')],_0x47786f[_0x79fe('0x2a')]);_0x4ac913[_0x79fe('0x2d')]=_[_0x79fe('0x2b')](_0x47786f['model'],qs[_0x79fe('0x2e')](_0x2d890e[_0x79fe('0x2a')][_0x79fe('0x2e')]));_0x4ac913[_0x79fe('0x2d')]=_0x4ac913[_0x79fe('0x2d')][_0x79fe('0x2f')]?_0x4ac913['attributes']:_0x47786f[_0x79fe('0x2c')];if(!_0x2d890e[_0x79fe('0x2a')][_0x79fe('0x30')](_0x79fe('0x31'))){_0x4ac913[_0x79fe('0x1e')]=qs[_0x79fe('0x1e')](_0x2d890e['query'][_0x79fe('0x1e')]);_0x4ac913['offset']=qs[_0x79fe('0x1d')](_0x2d890e['query'][_0x79fe('0x1d')]);}_0x4ac913['order']=qs[_0x79fe('0x32')](_0x2d890e[_0x79fe('0x2a')][_0x79fe('0x32')]);_0x4ac913['where']=qs[_0x79fe('0x33')](_[_0x79fe('0x34')](_0x2d890e[_0x79fe('0x2a')],_0x47786f[_0x79fe('0x33')]),_0x3bc5bc);if(_0x2d890e[_0x79fe('0x2a')]['filter']){_0x4ac913['where']=_[_0x79fe('0x35')](_0x4ac913['where'],{'$or':_[_0x79fe('0x36')](_0x3bc5bc,function(_0x44d97e){if(_0x44d97e['type']!==_0x79fe('0x37')){var _0x46da71={};_0x46da71[_0x44d97e[_0x79fe('0x26')]]={'$like':'%'+_0x2d890e[_0x79fe('0x2a')][_0x79fe('0x38')]+'%'};return _0x46da71;}})});}_0x4ac913=_[_0x79fe('0x35')]({},_0x4ac913,_0x2d890e['options']);var _0x3f099f={'where':_0x4ac913[_0x79fe('0x39')]};return db[_0x79fe('0x3a')][_0x79fe('0x1c')](_0x3f099f)['then'](function(_0x237ee7){_0x43782e['count']=_0x237ee7;if(_0x2d890e[_0x79fe('0x2a')]['includeAll']){_0x4ac913[_0x79fe('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x79fe('0x3c')](_0x4ac913);})[_0x79fe('0x23')](function(_0x577341){_0x43782e['rows']=_0x577341;return _0x43782e;})[_0x79fe('0x23')](respondWithFilteredResult(_0x36ead5,_0x4ac913))[_0x79fe('0x3d')](handleError(_0x36ead5,null));};exports[_0x79fe('0x3e')]=function(_0xeb03e4,_0x522241){var _0x5698a2={'raw':!![],'where':{'id':_0xeb03e4[_0x79fe('0x3f')]['id']}},_0x37c37b={};_0x37c37b[_0x79fe('0x2c')]=_[_0x79fe('0x40')](db[_0x79fe('0x3a')][_0x79fe('0x28')]);_0x37c37b[_0x79fe('0x2a')]=_[_0x79fe('0x40')](_0xeb03e4['query']);_0x37c37b[_0x79fe('0x33')]=_[_0x79fe('0x2b')](_0x37c37b[_0x79fe('0x2c')],_0x37c37b[_0x79fe('0x2a')]);_0x5698a2[_0x79fe('0x2d')]=_[_0x79fe('0x2b')](_0x37c37b['model'],qs[_0x79fe('0x2e')](_0xeb03e4[_0x79fe('0x2a')][_0x79fe('0x2e')]));_0x5698a2[_0x79fe('0x2d')]=_0x5698a2[_0x79fe('0x2d')][_0x79fe('0x2f')]?_0x5698a2['attributes']:_0x37c37b[_0x79fe('0x2c')];if(_0xeb03e4[_0x79fe('0x2a')][_0x79fe('0x41')]){_0x5698a2['include']=[{'all':!![]}];}_0x5698a2=_[_0x79fe('0x35')]({},_0x5698a2,_0xeb03e4['options']);return db['CmHopperFinal'][_0x79fe('0x42')](_0x5698a2)[_0x79fe('0x23')](handleEntityNotFound(_0x522241,null))[_0x79fe('0x23')](respondWithResult(_0x522241,null))['catch'](handleError(_0x522241,null));};exports[_0x79fe('0x43')]=function(_0x29cb34,_0x42c5af){return db['CmHopperFinal']['describe']()[_0x79fe('0x23')](respondWithResult(_0x42c5af,null))[_0x79fe('0x3d')](handleError(_0x42c5af,null));};exports[_0x79fe('0x44')]=function(_0xd5de03,_0x34c141){if(_0xd5de03[_0x79fe('0x45')][_0x79fe('0x46')]){delete _0xd5de03[_0x79fe('0x45')][_0x79fe('0x46')];}return db['CmHopperFinal'][_0x79fe('0x42')]({'where':{'uniqueid':_0xd5de03[_0x79fe('0x3f')]['id']}})['then'](handleEntityNotFound(_0x34c141,null))[_0x79fe('0x23')](saveUpdates(_0xd5de03['body'],null))[_0x79fe('0x23')](respondWithResult(_0x34c141,null))[_0x79fe('0x3d')](handleError(_0x34c141,null));};exports[_0x79fe('0x47')]=function(_0x1761d7,_0x4b82eb,_0x2c7dd8){return db[_0x79fe('0x3a')][_0x79fe('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x1761d7['params']['id']},'attributes':[[db['sequelize']['fn'](_0x79fe('0x48'),db[_0x79fe('0x49')]['fn']('IF',db['sequelize'][_0x79fe('0x4a')](_0x79fe('0x4b')))),_0x79fe('0x4c')],[db[_0x79fe('0x49')]['fn']('COUNT',db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0x79fe('0x4d')],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x79fe('0x4e')))),'congestionContacts'],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')](_0x79fe('0x4f')))),_0x79fe('0x50')],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')]['literal'](_0x79fe('0x51')))),_0x79fe('0x52')],[db['sequelize']['fn'](_0x79fe('0x48'),db['sequelize']['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0x79fe('0x53')],[db['sequelize']['fn'](_0x79fe('0x48'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x79fe('0x54')))),_0x79fe('0x55')]]})[_0x79fe('0x23')](handleEntityNotFound(_0x4b82eb,null))[_0x79fe('0x23')](respondWithResult(_0x4b82eb,null))[_0x79fe('0x3d')](handleError(_0x4b82eb,null));};exports[_0x79fe('0x56')]=function(_0x127891,_0x206c20,_0x45cd7){return db['CmHopperFinal'][_0x79fe('0x3c')]({'raw':![],'where':{'CampaignId':_0x127891[_0x79fe('0x3f')]['id']},'attributes':[[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db['sequelize']['fn']('IF',db[_0x79fe('0x49')]['literal'](_0x79fe('0x4b')))),'noSuchContacts'],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')]['literal'](_0x79fe('0x57')))),_0x79fe('0x58')],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db['sequelize']['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0x79fe('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x79fe('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')](_0x79fe('0x4f')))),_0x79fe('0x50')],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x79fe('0x52')],[db[_0x79fe('0x49')]['fn']('COUNT',db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')](_0x79fe('0x59')))),_0x79fe('0x53')],[db[_0x79fe('0x49')]['fn'](_0x79fe('0x48'),db[_0x79fe('0x49')]['fn']('IF',db[_0x79fe('0x49')][_0x79fe('0x4a')](_0x79fe('0x54')))),'answeringMachine']]})[_0x79fe('0x23')](handleEntityNotFound(_0x206c20,null))[_0x79fe('0x23')](respondWithResult(_0x206c20,null))[_0x79fe('0x3d')](handleError(_0x206c20,null));};exports[_0x79fe('0x5a')]=function(_0xbb92d5,_0x1b0be4,_0x177777){return db['VoiceQueue'][_0x79fe('0x42')]({'where':{'id':_0xbb92d5[_0x79fe('0x3f')]['id']}})[_0x79fe('0x23')](handleEntityNotFound(_0x1b0be4,null))['then'](function(_0x4e7bdc){var _0x5e7a6e;if(_0x4e7bdc){_0x5e7a6e=squel['insert']()[_0x79fe('0x5b')]('cm_hopper')[_0x79fe('0x5c')]([_0x79fe('0x5d'),_0x79fe('0x5e'),_0x79fe('0x5f'),_0x79fe('0x60'),'VoiceQueueId',_0x79fe('0x61'),'updatedAt'],squel[_0x79fe('0x62')]()[_0x79fe('0x63')](_0x79fe('0x64'),_0x79fe('0x5d'))[_0x79fe('0x63')](_0x79fe('0x65'),_0x79fe('0x5e'))['field'](_0x79fe('0x66'),'ContactId')[_0x79fe('0x63')](_0x79fe('0x67'),_0x79fe('0x60'))['field'](_0x79fe('0x68'),_0x79fe('0x69'))[_0x79fe('0x63')](_0x79fe('0x65'),'createdAt')[_0x79fe('0x63')](_0x79fe('0x65'),_0x79fe('0x6a'))['from'](_0x79fe('0x6b'))[_0x79fe('0x39')](_0x79fe('0x6c'),_0xbb92d5[_0x79fe('0x3f')]['id'][_0x79fe('0x6d')]())[_0x79fe('0x39')](_0x79fe('0x6e'),_0xbb92d5[_0x79fe('0x45')][_0x79fe('0x6f')]['toString']())[_0x79fe('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x79fe('0x39')](_0x79fe('0x70'),squel[_0x79fe('0x62')]()[_0x79fe('0x63')](_0x79fe('0x5d'))['from'](_0x79fe('0x71'))['where'](_0x79fe('0x6c'),_0xbb92d5[_0x79fe('0x3f')]['id']['toString']()))[_0x79fe('0x39')](_0x79fe('0x70'),squel[_0x79fe('0x62')]()[_0x79fe('0x63')](_0x79fe('0x72'))['from'](_0x79fe('0x6b'))[_0x79fe('0x39')](_0x79fe('0x6c'),_0xbb92d5[_0x79fe('0x3f')]['id'][_0x79fe('0x6d')]())[_0x79fe('0x39')](_0x79fe('0x73')))[_0x79fe('0x74')](_0x79fe('0x5f')))[_0x79fe('0x6d')]();return db['sequelize'][_0x79fe('0x2a')](_0x5e7a6e);}return[];})['then'](respondWithResult(_0x1b0be4,null))[_0x79fe('0x3d')](handleError(_0x1b0be4,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x38cb89,_0x1ea27c,_0x28f22c){return db[_0x79fe('0x75')][_0x79fe('0x42')]({'where':{'id':_0x38cb89['params']['id']}})[_0x79fe('0x23')](handleEntityNotFound(_0x1ea27c,null))[_0x79fe('0x23')](function(_0x43820f){var _0x3233c7;if(_0x43820f){_0x3233c7=squel['insert']()[_0x79fe('0x5b')]('cm_hopper')[_0x79fe('0x5c')]([_0x79fe('0x5d'),_0x79fe('0x5e'),_0x79fe('0x5f'),_0x79fe('0x60'),'CampaignId',_0x79fe('0x61'),'updatedAt'],squel[_0x79fe('0x62')]()[_0x79fe('0x63')]('ANY_VALUE(calleridnum)',_0x79fe('0x5d'))[_0x79fe('0x63')](_0x79fe('0x65'),_0x79fe('0x5e'))[_0x79fe('0x63')](_0x79fe('0x66'),'ContactId')['field'](_0x79fe('0x67'),_0x79fe('0x60'))[_0x79fe('0x63')]('ANY_VALUE(CampaignId)',_0x79fe('0x76'))[_0x79fe('0x63')](_0x79fe('0x65'),_0x79fe('0x61'))[_0x79fe('0x63')]('NOW()',_0x79fe('0x6a'))[_0x79fe('0x77')](_0x79fe('0x6b'))['where'](_0x79fe('0x78'),_0x38cb89[_0x79fe('0x3f')]['id'][_0x79fe('0x6d')]())[_0x79fe('0x39')]('state\x20=\x20?',_0x38cb89[_0x79fe('0x45')][_0x79fe('0x6f')]['toString']())[_0x79fe('0x39')](_0x79fe('0x79'))[_0x79fe('0x39')](_0x79fe('0x70'),squel[_0x79fe('0x62')]()['field'](_0x79fe('0x5d'))[_0x79fe('0x77')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x38cb89[_0x79fe('0x3f')]['id'][_0x79fe('0x6d')]()))[_0x79fe('0x39')](_0x79fe('0x70'),squel[_0x79fe('0x62')]()['field'](_0x79fe('0x72'))[_0x79fe('0x77')]('cm_hopper_final')[_0x79fe('0x39')]('CampaignId\x20=\x20?',_0x38cb89['params']['id'][_0x79fe('0x6d')]())[_0x79fe('0x39')](_0x79fe('0x73')))[_0x79fe('0x74')](_0x79fe('0x5f')))[_0x79fe('0x6d')]();return db[_0x79fe('0x49')][_0x79fe('0x2a')](_0x3233c7);}return[];})[_0x79fe('0x23')](respondWithResult(_0x1ea27c,null))[_0x79fe('0x3d')](handleError(_0x1ea27c,null));};exports[_0x79fe('0x7a')]=function(_0x57a104,_0x56eff3,_0x245b77){return db[_0x79fe('0x7b')][_0x79fe('0x7c')]({'where':{'VoiceQueueId':_0x57a104[_0x79fe('0x45')][_0x79fe('0x69')],'CampaignId':_0x57a104[_0x79fe('0x45')][_0x79fe('0x76')],'ContactId':_0x57a104[_0x79fe('0x45')]['ContactId']}})[_0x79fe('0x23')](handleEntityNotFound(_0x56eff3,null))[_0x79fe('0x23')](function(_0x25ce8d){if(_0x25ce8d){return _0x25ce8d;}return null;})[_0x79fe('0x23')](respondWithResult(_0x56eff3,null))['catch'](handleError(_0x56eff3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index a07f805..f318f2b 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 _0xaa88=['cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal'];(function(_0x4c99d0,_0x1febe1){var _0x5e541f=function(_0x6a83e5){while(--_0x6a83e5){_0x4c99d0['push'](_0x4c99d0['shift']());}};_0x5e541f(++_0x1febe1);}(_0xaa88,0x137));var _0x8aa8=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xaa88[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[{'name':_0x8aa8('0xc'),'fields':[_0x8aa8('0xc')]},{'name':'uniqueid','fields':[_0x8aa8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68fc=['./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','path'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x68fc,0xa5));var _0xc68f=function(_0x10d786,_0x74bf2a){_0x10d786=_0x10d786-0x0;var _0x24b1d7=_0x68fc[_0x10d786];return _0x24b1d7;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('CmHopperFinal',attributes,{'tableName':_0xc68f('0x7'),'paranoid':![],'indexes':[{'name':_0xc68f('0x8'),'fields':[_0xc68f('0x8')]},{'name':_0xc68f('0x9'),'fields':[_0xc68f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5716618..a3a1805 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 _0xf4c0=['catch','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','options','raw','debug'];(function(_0x39534b,_0x2c5b88){var _0x5e2bc4=function(_0x11aa3d){while(--_0x11aa3d){_0x39534b['push'](_0x39534b['shift']());}};_0x5e2bc4(++_0x2c5b88);}(_0xf4c0,0x1aa));var _0x0f4c=function(_0x2a95d1,_0x5a486c){_0x2a95d1=_0x2a95d1-0x0;var _0x55d7e9=_0xf4c0[_0x2a95d1];return _0x55d7e9;};'use strict';var _=require(_0x0f4c('0x0'));var util=require(_0x0f4c('0x1'));var moment=require(_0x0f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f4c('0x4'))(_0x0f4c('0x5'));var config=require('../../config/environment');var jayson=require(_0x0f4c('0x6'));var client=jayson[_0x0f4c('0x7')][_0x0f4c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23a1c2,_0x3615cf,_0x11b72d){return new BPromise(function(_0x25a8b5,_0x4eb48d){return client[_0x0f4c('0x9')](_0x23a1c2,_0x11b72d)[_0x0f4c('0xa')](function(_0x4daf48){logger[_0x0f4c('0xb')](_0x0f4c('0xc'),_0x3615cf,_0x0f4c('0xd'));logger['debug'](_0x0f4c('0xe'),_0x3615cf,_0x0f4c('0xd'),JSON['stringify'](_0x4daf48));if(_0x4daf48[_0x0f4c('0xf')]){if(_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x10')]===0x1f4){logger[_0x0f4c('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x3615cf,_0x4daf48['error'][_0x0f4c('0x11')]);return _0x4eb48d(_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x11')]);}logger[_0x0f4c('0xf')](_0x0f4c('0xc'),_0x3615cf,_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x11')]);return _0x25a8b5(_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x11')]);}else{logger[_0x0f4c('0xb')](_0x0f4c('0xc'),_0x3615cf,_0x0f4c('0xd'));_0x25a8b5(_0x4daf48[_0x0f4c('0x12')][_0x0f4c('0x11')]);}})['catch'](function(_0x22a8af){logger[_0x0f4c('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x3615cf,_0x22a8af);_0x4eb48d(_0x22a8af);});});}exports[_0x0f4c('0x13')]=function(_0x438a88){var _0x53e9cb=this;return new Promise(function(_0x17f0f9,_0x76f855){return db[_0x0f4c('0x14')]['create'](_0x438a88['body'],{'raw':_0x438a88['options']?_0x438a88[_0x0f4c('0x15')][_0x0f4c('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x7a66f5){logger[_0x0f4c('0xb')](_0x0f4c('0x13'),_0x438a88);logger[_0x0f4c('0x17')]('CreateCmHopperFinal',_0x438a88,JSON['stringify'](_0x7a66f5));_0x17f0f9(_0x7a66f5);})[_0x0f4c('0x18')](function(_0x4c1c67){logger[_0x0f4c('0xf')](_0x0f4c('0x13'),_0x4c1c67[_0x0f4c('0x11')],_0x438a88);_0x76f855(_0x53e9cb[_0x0f4c('0xf')](0x1f4,_0x4c1c67['message']));});});}; \ No newline at end of file +var _0x6e1f=['http','request','then','info','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x6e1f,0x110));var _0xf6e1=function(_0x23cb49,_0x43044e){_0x23cb49=_0x23cb49-0x0;var _0x4588fc=_0x6e1f[_0x23cb49];return _0x4588fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf6e1('0x0'));var BPromise=require('bluebird');var rs=require(_0xf6e1('0x1'));var fs=require('fs');var Redis=require(_0xf6e1('0x2'));var db=require(_0xf6e1('0x3'))['db'];var utils=require(_0xf6e1('0x4'));var logger=require(_0xf6e1('0x5'))(_0xf6e1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6e1('0x7')][_0xf6e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bc75e,_0x4d3e5d,_0x2ea280){return new BPromise(function(_0x3213b1,_0x2ba250){return client[_0xf6e1('0x9')](_0x4bc75e,_0x2ea280)[_0xf6e1('0xa')](function(_0x10b782){logger[_0xf6e1('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0x4d3e5d,'request\x20sent');logger[_0xf6e1('0xc')](_0xf6e1('0xd'),_0x4d3e5d,_0xf6e1('0xe'),JSON['stringify'](_0x10b782));if(_0x10b782['error']){if(_0x10b782[_0xf6e1('0xf')][_0xf6e1('0x10')]===0x1f4){logger[_0xf6e1('0xf')](_0xf6e1('0x11'),_0x4d3e5d,_0x10b782[_0xf6e1('0xf')][_0xf6e1('0x12')]);return _0x2ba250(_0x10b782[_0xf6e1('0xf')]['message']);}logger[_0xf6e1('0xf')](_0xf6e1('0x11'),_0x4d3e5d,_0x10b782[_0xf6e1('0xf')][_0xf6e1('0x12')]);return _0x3213b1(_0x10b782[_0xf6e1('0xf')]['message']);}else{logger[_0xf6e1('0xb')](_0xf6e1('0x11'),_0x4d3e5d,_0xf6e1('0xe'));_0x3213b1(_0x10b782[_0xf6e1('0x13')][_0xf6e1('0x12')]);}})[_0xf6e1('0x14')](function(_0x1501a1){logger[_0xf6e1('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x4d3e5d,_0x1501a1);_0x2ba250(_0x1501a1);});});}exports[_0xf6e1('0x15')]=function(_0x6d35a2){var _0x8653b5=this;return new Promise(function(_0x26dccd,_0x1eaf2a){return db[_0xf6e1('0x16')][_0xf6e1('0x17')](_0x6d35a2[_0xf6e1('0x18')],{'raw':_0x6d35a2[_0xf6e1('0x19')]?_0x6d35a2['options'][_0xf6e1('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x22318e){logger[_0xf6e1('0xb')](_0xf6e1('0x15'),_0x6d35a2);logger[_0xf6e1('0xc')]('CreateCmHopperFinal',_0x6d35a2,JSON[_0xf6e1('0x1b')](_0x22318e));_0x26dccd(_0x22318e);})[_0xf6e1('0x14')](function(_0x5b965a){logger[_0xf6e1('0xf')](_0xf6e1('0x15'),_0x5b965a['message'],_0x6d35a2);_0x1eaf2a(_0x8653b5['error'](0x1f4,_0x5b965a[_0xf6e1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 136f679..a3784e1 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 _0x40ed=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','/:id','get','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports'];(function(_0x4353cd,_0x45e37e){var _0xa3479e=function(_0x546ae3){while(--_0x546ae3){_0x4353cd['push'](_0x4353cd['shift']());}};_0xa3479e(++_0x45e37e);}(_0x40ed,0x186));var _0xd40e=function(_0x1509f3,_0x5c8b21){_0x1509f3=_0x1509f3-0x0;var _0x2edf78=_0x40ed[_0x1509f3];return _0x2edf78;};'use strict';var multer=require(_0xd40e('0x0'));var util=require('util');var path=require(_0xd40e('0x1'));var timeout=require(_0xd40e('0x2'));var express=require(_0xd40e('0x3'));var router=express[_0xd40e('0x4')]();var auth=require(_0xd40e('0x5'));var interaction=require(_0xd40e('0x6'));var config=require(_0xd40e('0x7'));var controller=require(_0xd40e('0x8'));router['get']('/',auth[_0xd40e('0x9')](),controller[_0xd40e('0xa')]);router['get'](_0xd40e('0xb'),auth[_0xd40e('0x9')](),controller[_0xd40e('0xc')]);router['get'](_0xd40e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xd40e('0xe')](_0xd40e('0xf'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd40e('0xe')](_0xd40e('0x10'),auth[_0xd40e('0x9')](),controller[_0xd40e('0x11')]);router[_0xd40e('0x12')](_0xd40e('0x13'),auth['isAuthenticated'](),controller[_0xd40e('0x14')]);router[_0xd40e('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xd40e('0x9')](),controller[_0xd40e('0x15')]);router[_0xd40e('0x12')](_0xd40e('0x16'),auth['isAuthenticated'](),controller[_0xd40e('0x17')]);router['put'](_0xd40e('0xd'),auth[_0xd40e('0x9')](),controller[_0xd40e('0x18')]);module[_0xd40e('0x19')]=router; \ No newline at end of file +var _0x1b86=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4f840d,_0x5d6218){var _0x315f81=function(_0x1a6e6a){while(--_0x1a6e6a){_0x4f840d['push'](_0x4f840d['shift']());}};_0x315f81(++_0x5d6218);}(_0x1b86,0x1f1));var _0x61b8=function(_0x190ce2,_0x20ca00){_0x190ce2=_0x190ce2-0x0;var _0x20e2c5=_0x1b86[_0x190ce2];return _0x20e2c5;};'use strict';var multer=require(_0x61b8('0x0'));var util=require('util');var path=require(_0x61b8('0x1'));var timeout=require(_0x61b8('0x2'));var express=require(_0x61b8('0x3'));var router=express[_0x61b8('0x4')]();var auth=require(_0x61b8('0x5'));var interaction=require(_0x61b8('0x6'));var config=require(_0x61b8('0x7'));var controller=require(_0x61b8('0x8'));router[_0x61b8('0x9')]('/',auth[_0x61b8('0xa')](),controller[_0x61b8('0xb')]);router[_0x61b8('0x9')](_0x61b8('0xc'),auth[_0x61b8('0xa')](),controller[_0x61b8('0xd')]);router[_0x61b8('0x9')](_0x61b8('0xe'),auth[_0x61b8('0xa')](),controller[_0x61b8('0xf')]);router[_0x61b8('0x9')]('/voice/queue/countAttributes/:id',auth[_0x61b8('0xa')](),controller[_0x61b8('0x10')]);router['get'](_0x61b8('0x11'),auth[_0x61b8('0xa')](),controller[_0x61b8('0x12')]);router[_0x61b8('0x13')](_0x61b8('0x14'),auth[_0x61b8('0xa')](),controller[_0x61b8('0x15')]);router[_0x61b8('0x13')](_0x61b8('0x16'),auth['isAuthenticated'](),controller[_0x61b8('0x17')]);router['post'](_0x61b8('0x18'),auth[_0x61b8('0xa')](),controller['checkContactHopper']);router['put'](_0x61b8('0xe'),auth[_0x61b8('0xa')](),controller[_0x61b8('0x19')]);module[_0x61b8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index fd2eb42..c3e43f8 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 _0xcc0b=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xcc0b,0x154));var _0xbcc0=function(_0x1a8506,_0x4f55a8){_0x1a8506=_0x1a8506-0x0;var _0x2648b5=_0xcc0b[_0x1a8506];return _0x2648b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xbcc0('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xbcc0('0x1')]},'scheduledat':{'type':Sequelize[_0xbcc0('0x2')]},'countbusyretry':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbcc0('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xbcc0('0x1')]},'originatecalleridname':{'type':Sequelize[_0xbcc0('0x1')]},'calleridnum':{'type':Sequelize[_0xbcc0('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xbcc0('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbcc0('0x2')]},'droptime':{'type':Sequelize[_0xbcc0('0x2')]},'endtime':{'type':Sequelize[_0xbcc0('0x2')]},'ringtime':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcc0('0x1')]},'campaign':{'type':Sequelize[_0xbcc0('0x1')]},'campaigntype':{'type':Sequelize[_0xbcc0('0x1')]},'membername':{'type':Sequelize[_0xbcc0('0x1')]},'reason':{'type':Sequelize[_0xbcc0('0x1')]},'amd':{'type':Sequelize[_0xbcc0('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbcc0('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbcc0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbcc0('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbcc0('0x2')]},'recallme':{'type':Sequelize[_0xbcc0('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbcc0('0x2')]},'edited':{'type':Sequelize[_0xbcc0('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbcc0('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e92=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x42c544,_0x639f4){var _0x61af80=function(_0x152dbd){while(--_0x152dbd){_0x42c544['push'](_0x42c544['shift']());}};_0x61af80(++_0x639f4);}(_0x4e92,0x86));var _0x24e9=function(_0x1b58b8,_0x3e1c2a){_0x1b58b8=_0x1b58b8-0x0;var _0x479502=_0x4e92[_0x1b58b8];return _0x479502;};'use strict';var Sequelize=require('sequelize');module[_0x24e9('0x0')]={'state':{'type':Sequelize[_0x24e9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x24e9('0x2')]},'scheduledat':{'type':Sequelize[_0x24e9('0x3')]},'countbusyretry':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x24e9('0x2')]},'calleridnum':{'type':Sequelize[_0x24e9('0x2')]},'calleridname':{'type':Sequelize[_0x24e9('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x24e9('0x3')]},'answertime':{'type':Sequelize[_0x24e9('0x3')]},'droptime':{'type':Sequelize[_0x24e9('0x3')]},'endtime':{'type':Sequelize[_0x24e9('0x3')]},'ringtime':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x24e9('0x2')]},'campaign':{'type':Sequelize[_0x24e9('0x2')]},'campaigntype':{'type':Sequelize[_0x24e9('0x2')]},'membername':{'type':Sequelize[_0x24e9('0x2')]},'reason':{'type':Sequelize[_0x24e9('0x2')]},'amd':{'type':Sequelize[_0x24e9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x24e9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x24e9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x24e9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x24e9('0x3')]},'recallme':{'type':Sequelize[_0x24e9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x24e9('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x24e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ef39c7d..c4257ba 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 _0x2ba2=['offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','CmHopperHistory','findAll','rows','catch','show','params','find','body','describe','update','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x1c4e07,_0x56e8a4){var _0x344614=function(_0xfe9ecd){while(--_0xfe9ecd){_0x1c4e07['push'](_0x1c4e07['shift']());}};_0x344614(++_0x56e8a4);}(_0x2ba2,0xc3));var _0x22ba=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x2ba2[_0x4f08dd];return _0x3017ee;};'use strict';var pdf=require(_0x22ba('0x0'));var emlformat=require(_0x22ba('0x1'));var rimraf=require(_0x22ba('0x2'));var zipdir=require(_0x22ba('0x3'));var jsonpatch=require(_0x22ba('0x4'));var rp=require('request-promise');var moment=require(_0x22ba('0x5'));var BPromise=require(_0x22ba('0x6'));var Mustache=require('mustache');var util=require(_0x22ba('0x7'));var path=require(_0x22ba('0x8'));var sox=require('sox');var csv=require(_0x22ba('0x9'));var ejs=require(_0x22ba('0xa'));var fs=require('fs');var _=require(_0x22ba('0xb'));var squel=require(_0x22ba('0xc'));var crypto=require(_0x22ba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x22ba('0xe'));var toCsv=require(_0x22ba('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x22ba('0xf'));var authService=require(_0x22ba('0x10'));var qs=require(_0x22ba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x22ba('0x12'));var logger=require(_0x22ba('0x13'))(_0x22ba('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x22ba('0x15'))['db'];function respondWithStatusCode(_0x4bd75d,_0x1df9c1){_0x1df9c1=_0x1df9c1||0xcc;return function(_0x19dd17){if(_0x19dd17){return _0x4bd75d[_0x22ba('0x16')](_0x1df9c1);}return _0x4bd75d[_0x22ba('0x17')](_0x1df9c1)[_0x22ba('0x18')]();};}function respondWithResult(_0x17f79e,_0x52c48d){_0x52c48d=_0x52c48d||0xc8;return function(_0x3eb8e2){if(_0x3eb8e2){return _0x17f79e[_0x22ba('0x17')](_0x52c48d)[_0x22ba('0x19')](_0x3eb8e2);}};}function respondWithFilteredResult(_0x527039,_0x45bf24){return function(_0x617161){if(_0x617161){var _0x4be9ac=_0x617161[_0x22ba('0x1a')],_0x36f06f=_0x45bf24[_0x22ba('0x1b')],_0x29371b=_0x45bf24['offset']+_0x45bf24[_0x22ba('0x1c')],_0x25a165;if(_0x29371b>=_0x4be9ac){_0x29371b=_0x4be9ac;_0x25a165=0xc8;}else{_0x25a165=0xce;}_0x527039[_0x22ba('0x17')](_0x25a165);return _0x527039[_0x22ba('0x1d')](_0x22ba('0x1e'),_0x36f06f+'-'+_0x29371b+'/'+_0x4be9ac)[_0x22ba('0x19')](_0x617161);}return null;};}function patchUpdates(_0x363256){return function(_0x4068fe){try{jsonpatch[_0x22ba('0x1f')](_0x4068fe,_0x363256,!![]);}catch(_0x229dde){return BPromise[_0x22ba('0x20')](_0x229dde);}return _0x4068fe[_0x22ba('0x21')]();};}function saveUpdates(_0x15a6bb,_0x55f42f){return function(_0x584053){if(_0x584053){return _0x584053['update'](_0x15a6bb)[_0x22ba('0x22')](function(_0x49b481){return _0x49b481;});}return null;};}function removeEntity(_0x1c2858,_0x3626fd){return function(_0x536887){if(_0x536887){return _0x536887['destroy']()[_0x22ba('0x22')](function(){_0x1c2858[_0x22ba('0x17')](0xcc)[_0x22ba('0x18')]();});}};}function handleEntityNotFound(_0x55c87a,_0x46167e){return function(_0x499725){if(!_0x499725){_0x55c87a[_0x22ba('0x16')](0x194);}return _0x499725;};}function handleError(_0x594891,_0x4fc3b8){_0x4fc3b8=_0x4fc3b8||0x1f4;return function(_0x4ecc38){logger[_0x22ba('0x23')](_0x4ecc38[_0x22ba('0x24')]);if(_0x4ecc38['name']){delete _0x4ecc38[_0x22ba('0x25')];}_0x594891['status'](_0x4fc3b8)[_0x22ba('0x26')](_0x4ecc38);};}exports[_0x22ba('0x27')]=function(_0x303c53,_0x3b5436){var _0x1afa23={},_0x55a619={},_0x117927={'count':0x0,'rows':[]};var _0x4fe1f9=_[_0x22ba('0x28')](db['CmHopperHistory'][_0x22ba('0x29')],function(_0x3fb5ea){return{'name':_0x3fb5ea[_0x22ba('0x2a')],'type':_0x3fb5ea[_0x22ba('0x2b')][_0x22ba('0x2c')]};});_0x55a619[_0x22ba('0x2d')]=_[_0x22ba('0x28')](_0x4fe1f9,_0x22ba('0x25'));_0x55a619['query']=_[_0x22ba('0x2e')](_0x303c53[_0x22ba('0x2f')]);_0x55a619['filters']=_['intersection'](_0x55a619[_0x22ba('0x2d')],_0x55a619[_0x22ba('0x2f')]);_0x1afa23[_0x22ba('0x30')]=_[_0x22ba('0x31')](_0x55a619[_0x22ba('0x2d')],qs[_0x22ba('0x32')](_0x303c53['query'][_0x22ba('0x32')]));_0x1afa23[_0x22ba('0x30')]=_0x1afa23[_0x22ba('0x30')][_0x22ba('0x33')]?_0x1afa23['attributes']:_0x55a619['model'];if(!_0x303c53[_0x22ba('0x2f')]['hasOwnProperty'](_0x22ba('0x34'))){_0x1afa23[_0x22ba('0x1c')]=qs[_0x22ba('0x1c')](_0x303c53[_0x22ba('0x2f')][_0x22ba('0x1c')]);_0x1afa23['offset']=qs[_0x22ba('0x1b')](_0x303c53[_0x22ba('0x2f')]['offset']);}_0x1afa23[_0x22ba('0x35')]=qs[_0x22ba('0x36')](_0x303c53[_0x22ba('0x2f')][_0x22ba('0x36')]);_0x1afa23[_0x22ba('0x37')]=qs[_0x22ba('0x38')](_[_0x22ba('0x39')](_0x303c53[_0x22ba('0x2f')],_0x55a619[_0x22ba('0x38')]),_0x4fe1f9);if(_0x303c53[_0x22ba('0x2f')][_0x22ba('0x3a')]){_0x1afa23[_0x22ba('0x37')]=_[_0x22ba('0x3b')](_0x1afa23['where'],{'$or':_['map'](_0x4fe1f9,function(_0x55ce61){if(_0x55ce61['type']!=='VIRTUAL'){var _0x15d2e3={};_0x15d2e3[_0x55ce61[_0x22ba('0x25')]]={'$like':'%'+_0x303c53[_0x22ba('0x2f')][_0x22ba('0x3a')]+'%'};return _0x15d2e3;}})});}_0x1afa23=_[_0x22ba('0x3b')]({},_0x1afa23,_0x303c53[_0x22ba('0x3c')]);var _0x2c15f1={'where':_0x1afa23['where']};return db['CmHopperHistory'][_0x22ba('0x1a')](_0x2c15f1)[_0x22ba('0x22')](function(_0x3a6616){_0x117927[_0x22ba('0x1a')]=_0x3a6616;if(_0x303c53[_0x22ba('0x2f')][_0x22ba('0x3d')]){_0x1afa23[_0x22ba('0x3e')]=[{'all':!![]}];}return db[_0x22ba('0x3f')][_0x22ba('0x40')](_0x1afa23);})[_0x22ba('0x22')](function(_0x43117c){_0x117927[_0x22ba('0x41')]=_0x43117c;return _0x117927;})['then'](respondWithFilteredResult(_0x3b5436,_0x1afa23))[_0x22ba('0x42')](handleError(_0x3b5436,null));};exports[_0x22ba('0x43')]=function(_0x56bb69,_0x5d9e91){var _0x250177={'raw':!![],'where':{'id':_0x56bb69[_0x22ba('0x44')]['id']}},_0x242408={};_0x242408[_0x22ba('0x2d')]=_[_0x22ba('0x2e')](db[_0x22ba('0x3f')]['rawAttributes']);_0x242408[_0x22ba('0x2f')]=_['keys'](_0x56bb69[_0x22ba('0x2f')]);_0x242408['filters']=_['intersection'](_0x242408[_0x22ba('0x2d')],_0x242408[_0x22ba('0x2f')]);_0x250177[_0x22ba('0x30')]=_[_0x22ba('0x31')](_0x242408[_0x22ba('0x2d')],qs[_0x22ba('0x32')](_0x56bb69[_0x22ba('0x2f')][_0x22ba('0x32')]));_0x250177[_0x22ba('0x30')]=_0x250177[_0x22ba('0x30')][_0x22ba('0x33')]?_0x250177['attributes']:_0x242408[_0x22ba('0x2d')];if(_0x56bb69['query']['includeAll']){_0x250177[_0x22ba('0x3e')]=[{'all':!![]}];}_0x250177=_['merge']({},_0x250177,_0x56bb69[_0x22ba('0x3c')]);return db[_0x22ba('0x3f')][_0x22ba('0x45')](_0x250177)[_0x22ba('0x22')](handleEntityNotFound(_0x5d9e91,null))['then'](respondWithResult(_0x5d9e91,null))[_0x22ba('0x42')](handleError(_0x5d9e91,null));};exports['create']=function(_0x32227d,_0x5a4345){return db['CmHopperHistory']['create'](_0x32227d[_0x22ba('0x46')],{})[_0x22ba('0x22')](respondWithResult(_0x5a4345,0xc9))['catch'](handleError(_0x5a4345,null));};exports['describe']=function(_0x29b655,_0x3639bd){return db[_0x22ba('0x3f')][_0x22ba('0x47')]()[_0x22ba('0x22')](respondWithResult(_0x3639bd,null))[_0x22ba('0x42')](handleError(_0x3639bd,null));};exports[_0x22ba('0x48')]=function(_0x2d2303,_0x9b909c){if(_0x2d2303[_0x22ba('0x46')]['uniqueid']){delete _0x2d2303[_0x22ba('0x46')][_0x22ba('0x49')];}return db['CmHopperHistory'][_0x22ba('0x45')]({'where':{'uniqueid':_0x2d2303['params']['id']}})['then'](handleEntityNotFound(_0x9b909c,null))['then'](saveUpdates(_0x2d2303[_0x22ba('0x46')],null))['then'](respondWithResult(_0x9b909c,null))[_0x22ba('0x42')](handleError(_0x9b909c,null));}; \ No newline at end of file +var _0xdd78=['stack','send','index','map','CmHopperHistory','rawAttributes','type','key','name','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','then'];(function(_0x4be43e,_0x22febf){var _0xb3b959=function(_0x11251d){while(--_0x11251d){_0x4be43e['push'](_0x4be43e['shift']());}};_0xb3b959(++_0x22febf);}(_0xdd78,0x1ef));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8dd7('0x0'));var emlformat=require(_0x8dd7('0x1'));var rimraf=require(_0x8dd7('0x2'));var zipdir=require(_0x8dd7('0x3'));var jsonpatch=require(_0x8dd7('0x4'));var rp=require('request-promise');var moment=require(_0x8dd7('0x5'));var BPromise=require(_0x8dd7('0x6'));var Mustache=require('mustache');var util=require(_0x8dd7('0x7'));var path=require('path');var sox=require(_0x8dd7('0x8'));var csv=require('to-csv');var ejs=require(_0x8dd7('0x9'));var fs=require('fs');var _=require(_0x8dd7('0xa'));var squel=require('squel');var crypto=require(_0x8dd7('0xb'));var jsforce=require(_0x8dd7('0xc'));var deskjs=require(_0x8dd7('0xd'));var toCsv=require(_0x8dd7('0xe'));var querystring=require('querystring');var Papa=require(_0x8dd7('0xf'));var Redis=require(_0x8dd7('0x10'));var authService=require(_0x8dd7('0x11'));var qs=require(_0x8dd7('0x12'));var as=require(_0x8dd7('0x13'));var hardwareService=require(_0x8dd7('0x14'));var logger=require(_0x8dd7('0x15'))(_0x8dd7('0x16'));var utils=require('../../config/utils');var config=require(_0x8dd7('0x17'));var db=require(_0x8dd7('0x18'))['db'];function respondWithStatusCode(_0x1a21bf,_0xd2039a){_0xd2039a=_0xd2039a||0xcc;return function(_0x34f616){if(_0x34f616){return _0x1a21bf[_0x8dd7('0x19')](_0xd2039a);}return _0x1a21bf[_0x8dd7('0x1a')](_0xd2039a)[_0x8dd7('0x1b')]();};}function respondWithResult(_0x505be5,_0x5ca991){_0x5ca991=_0x5ca991||0xc8;return function(_0x33e023){if(_0x33e023){return _0x505be5[_0x8dd7('0x1a')](_0x5ca991)[_0x8dd7('0x1c')](_0x33e023);}};}function respondWithFilteredResult(_0x41c0d3,_0x401661){return function(_0x1cc793){if(_0x1cc793){var _0x4663c3=_0x1cc793[_0x8dd7('0x1d')],_0x4fff7c=_0x401661[_0x8dd7('0x1e')],_0x2cbf4a=_0x401661[_0x8dd7('0x1e')]+_0x401661['limit'],_0x35d3ac;if(_0x2cbf4a>=_0x4663c3){_0x2cbf4a=_0x4663c3;_0x35d3ac=0xc8;}else{_0x35d3ac=0xce;}_0x41c0d3['status'](_0x35d3ac);return _0x41c0d3['set'](_0x8dd7('0x1f'),_0x4fff7c+'-'+_0x2cbf4a+'/'+_0x4663c3)[_0x8dd7('0x1c')](_0x1cc793);}return null;};}function patchUpdates(_0x447a83){return function(_0x477154){try{jsonpatch[_0x8dd7('0x20')](_0x477154,_0x447a83,!![]);}catch(_0x29e943){return BPromise['reject'](_0x29e943);}return _0x477154[_0x8dd7('0x21')]();};}function saveUpdates(_0x3ec593,_0x402509){return function(_0xe138b7){if(_0xe138b7){return _0xe138b7[_0x8dd7('0x22')](_0x3ec593)['then'](function(_0x125639){return _0x125639;});}return null;};}function removeEntity(_0x1a4d05,_0x1baae5){return function(_0x193a36){if(_0x193a36){return _0x193a36[_0x8dd7('0x23')]()[_0x8dd7('0x24')](function(){_0x1a4d05[_0x8dd7('0x1a')](0xcc)[_0x8dd7('0x1b')]();});}};}function handleEntityNotFound(_0x85aaef,_0xbcb85){return function(_0x2fa1de){if(!_0x2fa1de){_0x85aaef['sendStatus'](0x194);}return _0x2fa1de;};}function handleError(_0x1ecb89,_0xde82d1){_0xde82d1=_0xde82d1||0x1f4;return function(_0x3708f1){logger['error'](_0x3708f1[_0x8dd7('0x25')]);if(_0x3708f1['name']){delete _0x3708f1['name'];}_0x1ecb89[_0x8dd7('0x1a')](_0xde82d1)[_0x8dd7('0x26')](_0x3708f1);};}exports[_0x8dd7('0x27')]=function(_0x4ca8ff,_0x138a30){var _0x714531={},_0x2b5a65={},_0x1d782e={'count':0x0,'rows':[]};var _0x196d74=_[_0x8dd7('0x28')](db[_0x8dd7('0x29')][_0x8dd7('0x2a')],function(_0x247a58){return{'name':_0x247a58['fieldName'],'type':_0x247a58[_0x8dd7('0x2b')][_0x8dd7('0x2c')]};});_0x2b5a65['model']=_['map'](_0x196d74,_0x8dd7('0x2d'));_0x2b5a65[_0x8dd7('0x2e')]=_[_0x8dd7('0x2f')](_0x4ca8ff['query']);_0x2b5a65[_0x8dd7('0x30')]=_['intersection'](_0x2b5a65[_0x8dd7('0x31')],_0x2b5a65[_0x8dd7('0x2e')]);_0x714531['attributes']=_['intersection'](_0x2b5a65[_0x8dd7('0x31')],qs[_0x8dd7('0x32')](_0x4ca8ff['query'][_0x8dd7('0x32')]));_0x714531[_0x8dd7('0x33')]=_0x714531[_0x8dd7('0x33')]['length']?_0x714531['attributes']:_0x2b5a65[_0x8dd7('0x31')];if(!_0x4ca8ff['query'][_0x8dd7('0x34')](_0x8dd7('0x35'))){_0x714531[_0x8dd7('0x36')]=qs[_0x8dd7('0x36')](_0x4ca8ff[_0x8dd7('0x2e')][_0x8dd7('0x36')]);_0x714531[_0x8dd7('0x1e')]=qs[_0x8dd7('0x1e')](_0x4ca8ff[_0x8dd7('0x2e')][_0x8dd7('0x1e')]);}_0x714531[_0x8dd7('0x37')]=qs[_0x8dd7('0x38')](_0x4ca8ff[_0x8dd7('0x2e')][_0x8dd7('0x38')]);_0x714531[_0x8dd7('0x39')]=qs['filters'](_['pick'](_0x4ca8ff[_0x8dd7('0x2e')],_0x2b5a65[_0x8dd7('0x30')]),_0x196d74);if(_0x4ca8ff[_0x8dd7('0x2e')][_0x8dd7('0x3a')]){_0x714531[_0x8dd7('0x39')]=_[_0x8dd7('0x3b')](_0x714531[_0x8dd7('0x39')],{'$or':_[_0x8dd7('0x28')](_0x196d74,function(_0x5da8eb){if(_0x5da8eb['type']!==_0x8dd7('0x3c')){var _0xcba0a3={};_0xcba0a3[_0x5da8eb[_0x8dd7('0x2d')]]={'$like':'%'+_0x4ca8ff[_0x8dd7('0x2e')][_0x8dd7('0x3a')]+'%'};return _0xcba0a3;}})});}_0x714531=_['merge']({},_0x714531,_0x4ca8ff[_0x8dd7('0x3d')]);var _0x28361b={'where':_0x714531[_0x8dd7('0x39')]};return db[_0x8dd7('0x29')][_0x8dd7('0x1d')](_0x28361b)[_0x8dd7('0x24')](function(_0x87d806){_0x1d782e[_0x8dd7('0x1d')]=_0x87d806;if(_0x4ca8ff[_0x8dd7('0x2e')][_0x8dd7('0x3e')]){_0x714531[_0x8dd7('0x3f')]=[{'all':!![]}];}return db[_0x8dd7('0x29')][_0x8dd7('0x40')](_0x714531);})['then'](function(_0x336c9a){_0x1d782e[_0x8dd7('0x41')]=_0x336c9a;return _0x1d782e;})['then'](respondWithFilteredResult(_0x138a30,_0x714531))[_0x8dd7('0x42')](handleError(_0x138a30,null));};exports[_0x8dd7('0x43')]=function(_0x5cef1f,_0x5a6d91){var _0x5028dc={'raw':!![],'where':{'id':_0x5cef1f[_0x8dd7('0x44')]['id']}},_0x19e7ed={};_0x19e7ed[_0x8dd7('0x31')]=_[_0x8dd7('0x2f')](db[_0x8dd7('0x29')]['rawAttributes']);_0x19e7ed['query']=_[_0x8dd7('0x2f')](_0x5cef1f[_0x8dd7('0x2e')]);_0x19e7ed[_0x8dd7('0x30')]=_[_0x8dd7('0x45')](_0x19e7ed['model'],_0x19e7ed['query']);_0x5028dc[_0x8dd7('0x33')]=_[_0x8dd7('0x45')](_0x19e7ed[_0x8dd7('0x31')],qs[_0x8dd7('0x32')](_0x5cef1f[_0x8dd7('0x2e')][_0x8dd7('0x32')]));_0x5028dc[_0x8dd7('0x33')]=_0x5028dc[_0x8dd7('0x33')][_0x8dd7('0x46')]?_0x5028dc[_0x8dd7('0x33')]:_0x19e7ed[_0x8dd7('0x31')];if(_0x5cef1f['query'][_0x8dd7('0x3e')]){_0x5028dc[_0x8dd7('0x3f')]=[{'all':!![]}];}_0x5028dc=_[_0x8dd7('0x3b')]({},_0x5028dc,_0x5cef1f[_0x8dd7('0x3d')]);return db[_0x8dd7('0x29')][_0x8dd7('0x47')](_0x5028dc)['then'](handleEntityNotFound(_0x5a6d91,null))['then'](respondWithResult(_0x5a6d91,null))[_0x8dd7('0x42')](handleError(_0x5a6d91,null));};exports[_0x8dd7('0x48')]=function(_0x112697,_0x378744){return db['CmHopperHistory']['create'](_0x112697['body'],{})[_0x8dd7('0x24')](respondWithResult(_0x378744,0xc9))[_0x8dd7('0x42')](handleError(_0x378744,null));};exports[_0x8dd7('0x49')]=function(_0x393d58,_0x58a797){return db[_0x8dd7('0x29')][_0x8dd7('0x49')]()[_0x8dd7('0x24')](respondWithResult(_0x58a797,null))[_0x8dd7('0x42')](handleError(_0x58a797,null));};exports[_0x8dd7('0x22')]=function(_0x4b3436,_0x394cbe){if(_0x4b3436[_0x8dd7('0x4a')]['uniqueid']){delete _0x4b3436[_0x8dd7('0x4a')][_0x8dd7('0x4b')];}return db[_0x8dd7('0x29')][_0x8dd7('0x47')]({'where':{'uniqueid':_0x4b3436[_0x8dd7('0x44')]['id']}})[_0x8dd7('0x24')](handleEntityNotFound(_0x394cbe,null))[_0x8dd7('0x24')](saveUpdates(_0x4b3436[_0x8dd7('0x4a')],null))[_0x8dd7('0x24')](respondWithResult(_0x394cbe,null))[_0x8dd7('0x42')](handleError(_0x394cbe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d335f65..731d38e 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 _0x0318=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x447d88,_0x24759b){var _0x3ae554=function(_0x262499){while(--_0x262499){_0x447d88['push'](_0x447d88['shift']());}};_0x3ae554(++_0x24759b);}(_0x0318,0x16e));var _0x8031=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0318[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8031('0x0'));var logger=require(_0x8031('0x1'))(_0x8031('0x2'));var moment=require(_0x8031('0x3'));var BPromise=require(_0x8031('0x4'));var rp=require(_0x8031('0x5'));var fs=require('fs');var path=require(_0x8031('0x6'));var rimraf=require(_0x8031('0x7'));var config=require(_0x8031('0x8'));var attributes=require(_0x8031('0x9'));module[_0x8031('0xa')]=function(_0x58aae8,_0x2cb7f4){return _0x58aae8[_0x8031('0xb')](_0x8031('0xc'),attributes,{'tableName':_0x8031('0xd'),'paranoid':![],'indexes':[{'name':_0x8031('0xe'),'fields':[_0x8031('0xe')]},{'name':'uniqueid','fields':[_0x8031('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x692d=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x692d,0x100));var _0xd692=function(_0x8c6f44,_0x617373){_0x8c6f44=_0x8c6f44-0x0;var _0x5f3412=_0x692d[_0x8c6f44];return _0x5f3412;};'use strict';var _=require(_0xd692('0x0'));var util=require(_0xd692('0x1'));var logger=require(_0xd692('0x2'))('api');var moment=require(_0xd692('0x3'));var BPromise=require(_0xd692('0x4'));var rp=require(_0xd692('0x5'));var fs=require('fs');var path=require(_0xd692('0x6'));var rimraf=require(_0xd692('0x7'));var config=require(_0xd692('0x8'));var attributes=require(_0xd692('0x9'));module[_0xd692('0xa')]=function(_0x15ff55,_0x4d1ce9){return _0x15ff55[_0xd692('0xb')](_0xd692('0xc'),attributes,{'tableName':_0xd692('0xd'),'paranoid':![],'indexes':[{'name':_0xd692('0xe'),'fields':[_0xd692('0xe')]},{'name':_0xd692('0xf'),'fields':[_0xd692('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 715c7ca..d85f21b 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 _0xb58b=['CmHopperHistory','create','body','options','raw','debug','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../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','CreateCmHopperHistory'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3efedb,_0x103ce5){_0x3efedb=_0x3efedb-0x0;var _0x5d2622=_0xb58b[_0x3efedb];return _0x5d2622;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')](_0x3134ea[_0xbb58('0x17')],{'raw':_0x3134ea[_0xbb58('0x18')]?_0x3134ea[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![]})[_0xbb58('0xa')](function(_0x497fd0){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1a')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x497fd0));_0xbee66(_0x497fd0);})[_0xbb58('0x1b')](function(_0x49453a){logger[_0xbb58('0x10')](_0xbb58('0x14'),_0x49453a['message'],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x49453a['message']));});});};exports[_0xbb58('0x1c')]=function(_0x287822){var _0x152f22=this;return new Promise(function(_0x3e215c,_0x2d111c){return db[_0xbb58('0x15')][_0xbb58('0x1d')]({'raw':_0x287822[_0xbb58('0x18')]?_0x287822['options'][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x287822[_0xbb58('0x18')]?_0x287822[_0xbb58('0x18')][_0xbb58('0x1e')]||null:null,'attributes':[[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')][_0xbb58('0x21')]('id')),_0xbb58('0x22')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x25')))),_0xbb58('0x26')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x27')))),_0xbb58('0x28')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x29'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x2a')))),_0xbb58('0x2b')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x29'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xbb58('0x2c')))),_0xbb58('0x2d')]]})[_0xbb58('0xa')](function(_0x3c7627){logger[_0xbb58('0xb')](_0xbb58('0x1c'),_0x287822);logger[_0xbb58('0x1a')](_0xbb58('0x1c'),_0x287822,JSON['stringify'](_0x3c7627));_0x3e215c(_0x3c7627);})[_0xbb58('0x1b')](function(_0x230859){logger['error'](_0xbb58('0x1c'),_0x230859['message'],_0x287822);_0x2d111c(_0x152f22[_0xbb58('0x10')](0x1f4,_0x230859['message']));});});};exports[_0xbb58('0x2e')]=function(_0x36c7b4){var _0x52f4af=this;return new Promise(function(_0x3d3aee,_0x300c7b){return db[_0xbb58('0x15')][_0xbb58('0x1d')]({'raw':_0x36c7b4[_0xbb58('0x18')]?_0x36c7b4[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x36c7b4[_0xbb58('0x18')]?_0x36c7b4['options'][_0xbb58('0x1e')]||null:null,'attributes':[[_0xbb58('0x2f'),_0xbb58('0x30')],[db['sequelize']['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')](_0xbb58('0x31')))),_0xbb58('0x32')],[db['sequelize']['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x33')))),_0xbb58('0x34')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x24')))),_0xbb58('0x35')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')](_0xbb58('0x36')))),_0xbb58('0x37')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x38')))),'outboundCongestionCallsDay'],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x39')))),_0xbb58('0x3a')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x3b')))),_0xbb58('0x3c')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xbb58('0x3d')))),_0xbb58('0x3e')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x3f')))),_0xbb58('0x40')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0xbb58('0x41')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xbb58('0x42')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0xbb58('0x43')],[db['sequelize']['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x44')))),_0xbb58('0x42')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')]['literal'](_0xbb58('0x45')))),_0xbb58('0x46')]],'group':['campaign']})[_0xbb58('0xa')](function(_0x44636b){logger[_0xbb58('0xb')]('GetVoiceQueueHopperHistory',_0x36c7b4);logger[_0xbb58('0x1a')](_0xbb58('0x2e'),_0x36c7b4,JSON[_0xbb58('0xf')](_0x44636b));_0x3d3aee(_0x44636b);})['catch'](function(_0x537ed5){logger['error'](_0xbb58('0x2e'),_0x537ed5[_0xbb58('0x12')],_0x36c7b4);_0x300c7b(_0x52f4af[_0xbb58('0x10')](0x1f4,_0x537ed5['message']));});});};exports['GetCampaignHopperHistory']=function(_0x1573d1){var _0x40c55d=this;return new Promise(function(_0x37bb99,_0x23ed08){return db[_0xbb58('0x15')]['findAll']({'raw':_0x1573d1[_0xbb58('0x18')]?_0x1573d1[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x1573d1['options']?_0x1573d1[_0xbb58('0x18')][_0xbb58('0x1e')]||null:null,'attributes':[[_0xbb58('0x2f'),_0xbb58('0x30')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')][_0xbb58('0x21')]('id')),_0xbb58('0x47')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xbb58('0x48')]],'group':['campaign']})[_0xbb58('0xa')](function(_0x29c28b){logger[_0xbb58('0xb')](_0xbb58('0x49'),_0x1573d1);logger[_0xbb58('0x1a')](_0xbb58('0x49'),_0x1573d1,JSON[_0xbb58('0xf')](_0x29c28b));_0x37bb99(_0x29c28b);})[_0xbb58('0x1b')](function(_0x19ef37){logger[_0xbb58('0x10')](_0xbb58('0x49'),_0x19ef37['message'],_0x1573d1);_0x23ed08(_0x40c55d[_0xbb58('0x10')](0x1f4,_0x19ef37[_0xbb58('0x12')]));});});}; \ No newline at end of file +var _0xb62e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateCmHopperHistory',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateCmHopperHistory',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});};exports[_0xeb62('0x1e')]=function(_0x395b70){var _0x55a169=this;return new Promise(function(_0x4e92f5,_0x3ef988){return db['CmHopperHistory'][_0xeb62('0x1f')]({'raw':_0x395b70['options']?_0x395b70[_0xeb62('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')][_0xeb62('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')][_0xeb62('0x23')]('id')),_0xeb62('0x24')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xeb62('0x26')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xeb62('0x27')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xeb62('0x22')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xeb62('0x29')],[db['sequelize']['fn'](_0xeb62('0x2a'),db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')](_0xeb62('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xeb62('0x1d')](function(_0x2a8087){logger[_0xeb62('0xd')](_0xeb62('0x1e'),_0x395b70);logger['debug'](_0xeb62('0x1e'),_0x395b70,JSON[_0xeb62('0x12')](_0x2a8087));_0x4e92f5(_0x2a8087);})['catch'](function(_0x4acc96){logger[_0xeb62('0x13')](_0xeb62('0x1e'),_0x4acc96['message'],_0x395b70);_0x3ef988(_0x55a169[_0xeb62('0x13')](0x1f4,_0x4acc96[_0xeb62('0x15')]));});});};exports[_0xeb62('0x2c')]=function(_0x1f839a){var _0x21f604=this;return new Promise(function(_0x15387a,_0x40106b){return db['CmHopperHistory']['findAll']({'raw':_0x1f839a[_0xeb62('0x1b')]?_0x1f839a[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f839a[_0xeb62('0x1b')]?_0x1f839a['options'][_0xeb62('0x20')]||null:null,'attributes':[['campaign',_0xeb62('0x2d')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x2e')))),_0xeb62('0x2f')],[db['sequelize']['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xeb62('0x30')],[db['sequelize']['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')]['literal'](_0xeb62('0x31')))),_0xeb62('0x32')],[db[_0xeb62('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x33')))),_0xeb62('0x34')],[db[_0xeb62('0x22')]['fn']('COUNT',db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xeb62('0x35')],[db['sequelize']['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x36')))),_0xeb62('0x37')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')]['literal'](_0xeb62('0x38')))),_0xeb62('0x39')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0xeb62('0x3a')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x3b')))),_0xeb62('0x3c')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')]['literal'](_0xeb62('0x3d')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')](_0xeb62('0x3e')))),'outboundRejectCallsDay'],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x3f')))),_0xeb62('0x40')]],'group':[_0xeb62('0x41')]})['then'](function(_0x3e2be9){logger['info'](_0xeb62('0x2c'),_0x1f839a);logger[_0xeb62('0x10')](_0xeb62('0x2c'),_0x1f839a,JSON[_0xeb62('0x12')](_0x3e2be9));_0x15387a(_0x3e2be9);})[_0xeb62('0x17')](function(_0x13ea55){logger[_0xeb62('0x13')](_0xeb62('0x2c'),_0x13ea55['message'],_0x1f839a);_0x40106b(_0x21f604['error'](0x1f4,_0x13ea55['message']));});});};exports['GetCampaignHopperHistory']=function(_0x2ddc02){var _0x59320b=this;return new Promise(function(_0x3876ca,_0x5c0e7f){return db[_0xeb62('0x19')][_0xeb62('0x1f')]({'raw':_0x2ddc02[_0xeb62('0x1b')]?_0x2ddc02['options'][_0xeb62('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ddc02[_0xeb62('0x1b')]?_0x2ddc02['options'][_0xeb62('0x20')]||null:null,'attributes':[[_0xeb62('0x41'),_0xeb62('0x2d')],[db[_0xeb62('0x22')]['fn']('COUNT',db[_0xeb62('0x22')][_0xeb62('0x23')]('id')),'ivrTotalCallsDays'],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x42')))),_0xeb62('0x43')]],'group':[_0xeb62('0x41')]})[_0xeb62('0x1d')](function(_0x1db841){logger[_0xeb62('0xd')](_0xeb62('0x44'),_0x2ddc02);logger[_0xeb62('0x10')](_0xeb62('0x44'),_0x2ddc02,JSON[_0xeb62('0x12')](_0x1db841));_0x3876ca(_0x1db841);})[_0xeb62('0x17')](function(_0x5873c1){logger['error']('GetCampaignHopperHistory',_0x5873c1['message'],_0x2ddc02);_0x5c0e7f(_0x59320b[_0xeb62('0x13')](0x1f4,_0x5873c1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 65ba3b6..aac778d 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 _0x8e01=['Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','multer','util','path','connect-timeout'];(function(_0x536bcd,_0x30b634){var _0x4038f2=function(_0x374173){while(--_0x374173){_0x536bcd['push'](_0x536bcd['shift']());}};_0x4038f2(++_0x30b634);}(_0x8e01,0x1d8));var _0x18e0=function(_0x42525d,_0xbaee63){_0x42525d=_0x42525d-0x0;var _0x117823=_0x8e01[_0x42525d];return _0x117823;};'use strict';var multer=require(_0x18e0('0x0'));var util=require(_0x18e0('0x1'));var path=require(_0x18e0('0x2'));var timeout=require(_0x18e0('0x3'));var express=require('express');var router=express[_0x18e0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x18e0('0x5'));var config=require(_0x18e0('0x6'));var controller=require(_0x18e0('0x7'));router[_0x18e0('0x8')]('/',auth[_0x18e0('0x9')](),controller[_0x18e0('0xa')]);router[_0x18e0('0x8')](_0x18e0('0xb'),auth[_0x18e0('0x9')](),controller['describe']);router['get'](_0x18e0('0xc'),auth['isAuthenticated'](),controller[_0x18e0('0xd')]);router[_0x18e0('0xe')]('/',auth['isAuthenticated'](),controller[_0x18e0('0xf')]);router['put'](_0x18e0('0xc'),auth[_0x18e0('0x9')](),controller[_0x18e0('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5025=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id'];(function(_0x521e04,_0x343f13){var _0x381b0c=function(_0x5a90fd){while(--_0x5a90fd){_0x521e04['push'](_0x521e04['shift']());}};_0x381b0c(++_0x343f13);}(_0x5025,0x177));var _0x5502=function(_0x237bf7,_0xb851fc){_0x237bf7=_0x237bf7-0x0;var _0x5928ba=_0x5025[_0x237bf7];return _0x5928ba;};'use strict';var multer=require(_0x5502('0x0'));var util=require(_0x5502('0x1'));var path=require('path');var timeout=require(_0x5502('0x2'));var express=require(_0x5502('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5502('0x4'));var config=require(_0x5502('0x5'));var controller=require(_0x5502('0x6'));router[_0x5502('0x7')]('/',auth[_0x5502('0x8')](),controller[_0x5502('0x9')]);router[_0x5502('0x7')](_0x5502('0xa'),auth[_0x5502('0x8')](),controller[_0x5502('0xb')]);router['get']('/:id',auth[_0x5502('0x8')](),controller[_0x5502('0xc')]);router[_0x5502('0xd')]('/',auth[_0x5502('0x8')](),controller['create']);router[_0x5502('0xe')](_0x5502('0xf'),auth[_0x5502('0x8')](),controller['update']);module[_0x5502('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e161c5a..658f675 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 _0xdbf8=['sequelize','exports','STRING'];(function(_0x412942,_0x3b9cbb){var _0x32ce0d=function(_0x30ce33){while(--_0x30ce33){_0x412942['push'](_0x412942['shift']());}};_0x32ce0d(++_0x3b9cbb);}(_0xdbf8,0xc9));var _0x8dbf=function(_0x43f888,_0x36b771){_0x43f888=_0x43f888-0x0;var _0x3e0170=_0xdbf8[_0x43f888];return _0x3e0170;};'use strict';var Sequelize=require(_0x8dbf('0x0'));module[_0x8dbf('0x1')]={'name':{'type':Sequelize[_0x8dbf('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8dbf('0x2')]},'dialPrefix':{'type':Sequelize[_0x8dbf('0x2')]}}; \ No newline at end of file +var _0x6ea1=['name','exports','STRING'];(function(_0x9adcd6,_0x36278b){var _0xdf8ff2=function(_0x4f7087){while(--_0x4f7087){_0x9adcd6['push'](_0x9adcd6['shift']());}};_0xdf8ff2(++_0x36278b);}(_0x6ea1,0x109));var _0x16ea=function(_0x3e75f1,_0x231535){_0x3e75f1=_0x3e75f1-0x0;var _0x5258f6=_0x6ea1[_0x3e75f1];return _0x5258f6;};'use strict';var Sequelize=require('sequelize');module[_0x16ea('0x0')]={'name':{'type':Sequelize[_0x16ea('0x1')],'unique':_0x16ea('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x16ea('0x1')]},'dialPrefix':{'type':Sequelize[_0x16ea('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 55320c3..dcb6a5f 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 _0x84aa=['api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','then','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','raw','format','cf_%d','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xe0dbe8,_0x4e1b73){var _0x527c7b=function(_0x5d45c7){while(--_0x5d45c7){_0xe0dbe8['push'](_0xe0dbe8['shift']());}};_0x527c7b(++_0x4e1b73);}(_0x84aa,0x19e));var _0xa84a=function(_0x5bae7a,_0x5c7bd9){_0x5bae7a=_0x5bae7a-0x0;var _0x118915=_0x84aa[_0x5bae7a];return _0x118915;};'use strict';var pdf=require(_0xa84a('0x0'));var emlformat=require(_0xa84a('0x1'));var rimraf=require(_0xa84a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa84a('0x3'));var BPromise=require(_0xa84a('0x4'));var Mustache=require(_0xa84a('0x5'));var util=require(_0xa84a('0x6'));var path=require(_0xa84a('0x7'));var sox=require('sox');var csv=require(_0xa84a('0x8'));var ejs=require(_0xa84a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xa84a('0xb'));var deskjs=require(_0xa84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa84a('0xd'));var Papa=require(_0xa84a('0xe'));var Redis=require(_0xa84a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa84a('0x10'));var hardwareService=require(_0xa84a('0x11'));var logger=require('../../config/logger')(_0xa84a('0x12'));var utils=require(_0xa84a('0x13'));var config=require(_0xa84a('0x14'));var db=require(_0xa84a('0x15'))['db'];config['redis']=_[_0xa84a('0x16')](config[_0xa84a('0x17')],{'host':_0xa84a('0x18'),'port':0x18eb});var socket=require(_0xa84a('0x19'))(new Redis(config[_0xa84a('0x17')]));require(_0xa84a('0x1a'))[_0xa84a('0x1b')](socket);function respondWithStatusCode(_0x177360,_0x2bd452){_0x2bd452=_0x2bd452||0xcc;return function(_0x16db90){if(_0x16db90){return _0x177360[_0xa84a('0x1c')](_0x2bd452);}return _0x177360[_0xa84a('0x1d')](_0x2bd452)[_0xa84a('0x1e')]();};}function respondWithResult(_0xe060ae,_0x221c12){_0x221c12=_0x221c12||0xc8;return function(_0x1beeab){if(_0x1beeab){return _0xe060ae[_0xa84a('0x1d')](_0x221c12)[_0xa84a('0x1f')](_0x1beeab);}};}function respondWithFilteredResult(_0xe01b5c,_0x2a150f){return function(_0x5bdc93){if(_0x5bdc93){var _0xd63e81=_0x5bdc93[_0xa84a('0x20')],_0x426759=_0x2a150f['offset'],_0x397f17=_0x2a150f[_0xa84a('0x21')]+_0x2a150f[_0xa84a('0x22')],_0x5ae22e;if(_0x397f17>=_0xd63e81){_0x397f17=_0xd63e81;_0x5ae22e=0xc8;}else{_0x5ae22e=0xce;}_0xe01b5c[_0xa84a('0x1d')](_0x5ae22e);return _0xe01b5c['set'](_0xa84a('0x23'),_0x426759+'-'+_0x397f17+'/'+_0xd63e81)[_0xa84a('0x1f')](_0x5bdc93);}return null;};}function patchUpdates(_0x4a1117){return function(_0x5cfa67){try{jsonpatch[_0xa84a('0x24')](_0x5cfa67,_0x4a1117,!![]);}catch(_0xa5cbb9){return BPromise[_0xa84a('0x25')](_0xa5cbb9);}return _0x5cfa67[_0xa84a('0x26')]();};}function saveUpdates(_0x34b277,_0x1e2c43){return function(_0x3ee25c){if(_0x3ee25c){return _0x3ee25c[_0xa84a('0x27')](_0x34b277)['then'](function(_0x425818){return _0x425818;});}return null;};}function removeEntity(_0x417fcd,_0xade670){return function(_0x4428bf){if(_0x4428bf){return _0x4428bf[_0xa84a('0x28')]()['then'](function(){var _0x285ad4=_0x4428bf[_0xa84a('0x29')]({'plain':!![]});var _0x1d3d0e='Lists';return db['UserProfileResource'][_0xa84a('0x28')]({'where':{'type':_0x1d3d0e,'resourceId':_0x285ad4['id']}})[_0xa84a('0x2a')](function(){return _0x4428bf;});})[_0xa84a('0x2a')](function(){_0x417fcd['status'](0xcc)[_0xa84a('0x1e')]();});}};}function handleEntityNotFound(_0xc195d0,_0x56f69){return function(_0x599158){if(!_0x599158){_0xc195d0['sendStatus'](0x194);}return _0x599158;};}function handleError(_0x56ab6a,_0x245c15){_0x245c15=_0x245c15||0x1f4;return function(_0x1dda0d){logger[_0xa84a('0x2b')](_0x1dda0d[_0xa84a('0x2c')]);if(_0x1dda0d[_0xa84a('0x2d')]){delete _0x1dda0d[_0xa84a('0x2d')];}_0x56ab6a[_0xa84a('0x1d')](_0x245c15)[_0xa84a('0x2e')](_0x1dda0d);};}exports[_0xa84a('0x2f')]=function(_0x12b4c4,_0x1029a1){var _0x55d429={},_0x548e32={},_0x9c511={'count':0x0,'rows':[]};var _0x2fe24c=_['map'](db[_0xa84a('0x30')][_0xa84a('0x31')],function(_0x3a2583){return{'name':_0x3a2583[_0xa84a('0x32')],'type':_0x3a2583[_0xa84a('0x33')][_0xa84a('0x34')]};});_0x548e32[_0xa84a('0x35')]=_[_0xa84a('0x36')](_0x2fe24c,_0xa84a('0x2d'));_0x548e32['query']=_[_0xa84a('0x37')](_0x12b4c4['query']);_0x548e32[_0xa84a('0x38')]=_[_0xa84a('0x39')](_0x548e32['model'],_0x548e32[_0xa84a('0x3a')]);_0x55d429[_0xa84a('0x3b')]=_[_0xa84a('0x39')](_0x548e32['model'],qs[_0xa84a('0x3c')](_0x12b4c4['query']['fields']));_0x55d429[_0xa84a('0x3b')]=_0x55d429[_0xa84a('0x3b')][_0xa84a('0x3d')]?_0x55d429[_0xa84a('0x3b')]:_0x548e32[_0xa84a('0x35')];if(!_0x12b4c4[_0xa84a('0x3a')][_0xa84a('0x3e')]('nolimit')){_0x55d429[_0xa84a('0x22')]=qs[_0xa84a('0x22')](_0x12b4c4[_0xa84a('0x3a')][_0xa84a('0x22')]);_0x55d429['offset']=qs[_0xa84a('0x21')](_0x12b4c4[_0xa84a('0x3a')][_0xa84a('0x21')]);}_0x55d429[_0xa84a('0x3f')]=qs[_0xa84a('0x40')](_0x12b4c4['query'][_0xa84a('0x40')]);_0x55d429[_0xa84a('0x41')]=qs[_0xa84a('0x38')](_['pick'](_0x12b4c4['query'],_0x548e32[_0xa84a('0x38')]),_0x2fe24c);if(_0x12b4c4[_0xa84a('0x3a')][_0xa84a('0x42')]){_0x55d429['where']=_[_0xa84a('0x43')](_0x55d429[_0xa84a('0x41')],{'$or':_[_0xa84a('0x36')](_0x2fe24c,function(_0x49070c){if(_0x49070c[_0xa84a('0x33')]!=='VIRTUAL'){var _0x19607e={};_0x19607e[_0x49070c[_0xa84a('0x2d')]]={'$like':'%'+_0x12b4c4[_0xa84a('0x3a')][_0xa84a('0x42')]+'%'};return _0x19607e;}})});}_0x55d429=_[_0xa84a('0x43')]({},_0x55d429,_0x12b4c4[_0xa84a('0x44')]);var _0x3104c1={'where':_0x55d429[_0xa84a('0x41')]};return db[_0xa84a('0x30')][_0xa84a('0x20')](_0x3104c1)[_0xa84a('0x2a')](function(_0x2cc313){_0x9c511[_0xa84a('0x20')]=_0x2cc313;if(_0x12b4c4[_0xa84a('0x3a')][_0xa84a('0x45')]){_0x55d429[_0xa84a('0x46')]=[{'all':!![]}];}return db[_0xa84a('0x30')][_0xa84a('0x47')](_0x55d429);})['then'](function(_0x3371b9){_0x9c511[_0xa84a('0x48')]=_0x3371b9;return _0x9c511;})[_0xa84a('0x2a')](respondWithFilteredResult(_0x1029a1,_0x55d429))[_0xa84a('0x49')](handleError(_0x1029a1,null));};exports[_0xa84a('0x4a')]=function(_0x38beec,_0x42788b){var _0x24684b={'raw':![],'where':{'id':_0x38beec['params']['id']}},_0x10387a={};_0x10387a[_0xa84a('0x35')]=_[_0xa84a('0x37')](db['CmList'][_0xa84a('0x31')]);_0x10387a[_0xa84a('0x3a')]=_[_0xa84a('0x37')](_0x38beec[_0xa84a('0x3a')]);_0x10387a[_0xa84a('0x38')]=_[_0xa84a('0x39')](_0x10387a[_0xa84a('0x35')],_0x10387a[_0xa84a('0x3a')]);_0x24684b['attributes']=_[_0xa84a('0x39')](_0x10387a[_0xa84a('0x35')],qs[_0xa84a('0x3c')](_0x38beec[_0xa84a('0x3a')][_0xa84a('0x3c')]));_0x24684b['attributes']=_0x24684b[_0xa84a('0x3b')]['length']?_0x24684b[_0xa84a('0x3b')]:_0x10387a[_0xa84a('0x35')];if(_0x38beec[_0xa84a('0x3a')][_0xa84a('0x45')]){_0x24684b[_0xa84a('0x46')]=[{'all':!![]}];}_0x24684b=_['merge']({},_0x24684b,_0x38beec[_0xa84a('0x44')]);return db[_0xa84a('0x30')][_0xa84a('0x4b')](_0x24684b)[_0xa84a('0x2a')](handleEntityNotFound(_0x42788b,null))[_0xa84a('0x2a')](respondWithResult(_0x42788b,null))[_0xa84a('0x49')](handleError(_0x42788b,null));};exports[_0xa84a('0x4c')]=function(_0x52ab06,_0x10defc){return db['CmList'][_0xa84a('0x4c')](_0x52ab06['body'],{})['then'](function(_0x3f2ba4){var _0xd4580f=_0x52ab06['user'][_0xa84a('0x29')]({'plain':!![]});if(!_0xd4580f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd4580f[_0xa84a('0x4d')]===_0xa84a('0x4e')){var _0x2c0c52=_0x3f2ba4[_0xa84a('0x29')]({'plain':!![]});var _0x43fdb5='Lists';return db['UserProfileSection'][_0xa84a('0x4b')]({'where':{'name':_0x43fdb5,'userProfileId':_0xd4580f[_0xa84a('0x4f')]},'raw':!![]})['then'](function(_0x347128){if(_0x347128&&_0x347128[_0xa84a('0x50')]===0x0){return db['UserProfileResource'][_0xa84a('0x4c')]({'name':_0x2c0c52['name'],'resourceId':_0x2c0c52['id'],'type':_0x347128['name'],'sectionId':_0x347128['id']},{})[_0xa84a('0x2a')](function(){return _0x3f2ba4;});}else{return _0x3f2ba4;}})[_0xa84a('0x49')](function(_0x201d01){logger[_0xa84a('0x2b')](_0xa84a('0x51'),_0x201d01);throw _0x201d01;});}return _0x3f2ba4;})['then'](respondWithResult(_0x10defc,0xc9))[_0xa84a('0x49')](handleError(_0x10defc,null));};exports[_0xa84a('0x27')]=function(_0x359ba1,_0x1fe394){if(_0x359ba1[_0xa84a('0x52')]['id']){delete _0x359ba1[_0xa84a('0x52')]['id'];}return db[_0xa84a('0x30')][_0xa84a('0x4b')]({'where':{'id':_0x359ba1['params']['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x1fe394,null))['then'](saveUpdates(_0x359ba1[_0xa84a('0x52')],null))['then'](respondWithResult(_0x1fe394,null))[_0xa84a('0x49')](handleError(_0x1fe394,null));};exports[_0xa84a('0x28')]=function(_0x2eb191,_0x130410){return db[_0xa84a('0x30')][_0xa84a('0x4b')]({'where':{'id':_0x2eb191[_0xa84a('0x53')]['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x130410,null))[_0xa84a('0x2a')](removeEntity(_0x130410,null))[_0xa84a('0x49')](handleError(_0x130410,null));};exports[_0xa84a('0x54')]=function(_0x453523,_0x2d5e76){return db[_0xa84a('0x30')][_0xa84a('0x54')]()['then'](respondWithResult(_0x2d5e76,null))[_0xa84a('0x49')](handleError(_0x2d5e76,null));};exports[_0xa84a('0x55')]=function(_0x55c1db,_0x1d3be0,_0x93abde){if(_0x55c1db[_0xa84a('0x52')]['id']){delete _0x55c1db['body']['id'];}return db['CmList'][_0xa84a('0x4b')]({'where':{'id':_0x55c1db[_0xa84a('0x53')]['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x1d3be0,null))[_0xa84a('0x2a')](function(_0x3150ac){if(_0x3150ac){_0x55c1db[_0xa84a('0x52')][_0xa84a('0x56')]=_0x3150ac['id'];return db[_0xa84a('0x57')][_0xa84a('0x4c')](_0x55c1db['body']);}})[_0xa84a('0x2a')](respondWithResult(_0x1d3be0,null))['catch'](handleError(_0x1d3be0,null));};exports[_0xa84a('0x58')]=function(_0x5ae1ab,_0x352d32,_0x5fba3c){var _0x52befe={'raw':![],'where':{}};var _0x517b33={};var _0x1388b9={'count':0x0,'rows':[]};return db[_0xa84a('0x30')][_0xa84a('0x59')]({'where':{'id':_0x5ae1ab[_0xa84a('0x53')]['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x352d32,null))[_0xa84a('0x2a')](function(_0x1a78a9){if(_0x1a78a9){_0x517b33[_0xa84a('0x35')]=_['keys'](db[_0xa84a('0x57')]['rawAttributes']);_0x517b33[_0xa84a('0x3a')]=_[_0xa84a('0x37')](_0x5ae1ab['query']);_0x517b33[_0xa84a('0x38')]=_['intersection'](_0x517b33[_0xa84a('0x35')],_0x517b33[_0xa84a('0x3a')]);_0x52befe['attributes']=_[_0xa84a('0x39')](_0x517b33[_0xa84a('0x35')],qs[_0xa84a('0x3c')](_0x5ae1ab[_0xa84a('0x3a')][_0xa84a('0x3c')]));_0x52befe['attributes']=_0x52befe[_0xa84a('0x3b')]['length']?_0x52befe[_0xa84a('0x3b')]:_0x517b33[_0xa84a('0x35')];if(!_0x5ae1ab['query'][_0xa84a('0x3e')](_0xa84a('0x5a'))){_0x52befe[_0xa84a('0x22')]=qs['limit'](_0x5ae1ab['query']['limit']);_0x52befe[_0xa84a('0x21')]=qs[_0xa84a('0x21')](_0x5ae1ab[_0xa84a('0x3a')][_0xa84a('0x21')]);}_0x52befe[_0xa84a('0x3f')]=qs['sort'](_0x5ae1ab[_0xa84a('0x3a')][_0xa84a('0x40')]);_0x52befe[_0xa84a('0x41')]=qs['filters'](_[_0xa84a('0x5b')](_0x5ae1ab[_0xa84a('0x3a')],_0x517b33[_0xa84a('0x38')]));_0x52befe['where'][_0xa84a('0x56')]=_0x1a78a9['id'];if(_0x5ae1ab[_0xa84a('0x3a')]['filter']){_0x52befe['where']=_['merge'](_0x52befe['where'],{'$or':_[_0xa84a('0x36')](_0x52befe['attributes'],function(_0x232dfb){var _0x2991b3={};_0x2991b3[_0x232dfb]={'$like':'%'+_0x5ae1ab[_0xa84a('0x3a')][_0xa84a('0x42')]+'%'};return _0x2991b3;})});}_0x52befe=_['merge']({},_0x52befe,_0x5ae1ab[_0xa84a('0x44')]);return db['Disposition'][_0xa84a('0x20')]({'where':_0x52befe[_0xa84a('0x41')]})[_0xa84a('0x2a')](function(_0x521d70){_0x1388b9[_0xa84a('0x20')]=_0x521d70;if(_0x5ae1ab[_0xa84a('0x3a')][_0xa84a('0x45')]){_0x52befe[_0xa84a('0x46')]=[{'all':!![]}];}return db[_0xa84a('0x57')]['findAll'](_0x52befe);})['then'](function(_0x5a9286){_0x1388b9[_0xa84a('0x48')]=_0x5a9286;return _0x1388b9;});}})[_0xa84a('0x2a')](respondWithFilteredResult(_0x352d32,_0x52befe))[_0xa84a('0x49')](handleError(_0x352d32,null));};exports[_0xa84a('0x5c')]=function(_0x46c61c,_0x1002e1,_0x498899){return db[_0xa84a('0x30')]['find']({'where':{'id':_0x46c61c[_0xa84a('0x53')]['id']}})['then'](handleEntityNotFound(_0x1002e1,null))['then'](function(_0x105f86){if(_0x105f86){return _0x105f86[_0xa84a('0x5c')](_0x46c61c[_0xa84a('0x3a')][_0xa84a('0x5d')]);}})['then'](respondWithStatusCode(_0x1002e1,null))[_0xa84a('0x49')](handleError(_0x1002e1,null));};exports[_0xa84a('0x5e')]=function(_0x53c8ff,_0x5b6079,_0x18b67a){return db[_0xa84a('0x30')][_0xa84a('0x4b')]({'where':{'id':_0x53c8ff[_0xa84a('0x53')]['id']}})['then'](handleEntityNotFound(_0x5b6079,null))[_0xa84a('0x2a')](function(_0x55048c){if(_0x55048c){var _0x1099c4=[];var _0x304154={'success':[],'errors':[]};return db[_0xa84a('0x5f')]['describe']()[_0xa84a('0x2a')](function(_0x4b8a1c){if(_0x53c8ff[_0xa84a('0x52')]['tags']&&_[_0xa84a('0x60')](_0x53c8ff[_0xa84a('0x52')][_0xa84a('0x61')])){if(_0x53c8ff[_0xa84a('0x52')][_0xa84a('0x61')]['length']){_0x53c8ff[_0xa84a('0x52')][_0xa84a('0x61')]=_0x53c8ff[_0xa84a('0x52')][_0xa84a('0x61')][_0xa84a('0x62')](';')+';';}else{_0x53c8ff[_0xa84a('0x52')][_0xa84a('0x61')]=null;}}else{_0x53c8ff[_0xa84a('0x52')]['tags']=null;}if(_0x53c8ff[_0xa84a('0x52')]&&_[_0xa84a('0x60')](_0x53c8ff['body'])){for(var _0x48645f=0x0;_0x48645f<_0x53c8ff[_0xa84a('0x52')][_0xa84a('0x3d')];_0x48645f+=0x1){_0x53c8ff[_0xa84a('0x52')][_0x48645f][_0xa84a('0x56')]=_0x53c8ff['params']['id'];_0x1099c4[_0xa84a('0x63')](_0x53c8ff[_0xa84a('0x52')][_0x48645f]);}return BPromise[_0xa84a('0x64')](_0x1099c4,function(_0x225870){return db['CmContact'][_0xa84a('0x4c')](_[_0xa84a('0x65')](_0x225870,[_0xa84a('0x5d'),'id'])||{},{'fields':_[_0xa84a('0x37')](_0x4b8a1c),'raw':!![]})[_0xa84a('0x2a')](function(_0x49d1fa){_0x304154[_0xa84a('0x66')][_0xa84a('0x63')](_0x49d1fa[_0xa84a('0x67')]);})[_0xa84a('0x49')](function(_0x2b25ee){_0x304154[_0xa84a('0x68')]['push']({'data':_0x225870,'error':_0x2b25ee[_0xa84a('0x69')]});});})[_0xa84a('0x2a')](function(_0x1d3c29){return _0x304154;})[_0xa84a('0x49')](function(_0x27dafc){return _0x27dafc;});}else{_0x5b6079[_0xa84a('0x1d')](0x190)[_0xa84a('0x1f')]({'message':_0xa84a('0x6a')});}});}})['then'](respondWithResult(_0x5b6079,null))[_0xa84a('0x49')](handleError(_0x5b6079,null));};exports[_0xa84a('0x6b')]=function(_0x575230,_0x38287d,_0x464cfb){var _0x72c728;return db['CmList'][_0xa84a('0x4b')]({'where':{'id':_0x575230[_0xa84a('0x53')]['id']},'include':[{'model':db[_0xa84a('0x6c')],'as':_0xa84a('0x6d')}]})[_0xa84a('0x2a')](handleEntityNotFound(_0x38287d,null))[_0xa84a('0x2a')](function(_0x3d9834){if(_0x3d9834){_0x72c728=_0x3d9834;return db['CmContact'][_0xa84a('0x31')];}})['then'](function(_0x3e056d){if(_0x3e056d){var _0x204d27={};var _0x53e1c0={};_0x53e1c0['model']=_[_0xa84a('0x6e')](_[_0xa84a('0x37')](_0x3e056d),_['map'](_0x72c728[_0xa84a('0x6d')],function(_0x3a94f7){return util['format']('cf_%d',_0x3a94f7['id']);}));_0x53e1c0[_0xa84a('0x3a')]=_[_0xa84a('0x37')](_0x575230[_0xa84a('0x3a')]);_0x53e1c0[_0xa84a('0x38')]=_[_0xa84a('0x39')](_0x53e1c0[_0xa84a('0x35')],_0x53e1c0[_0xa84a('0x3a')]);_0x204d27[_0xa84a('0x3b')]=_[_0xa84a('0x39')](_0x53e1c0['model'],qs[_0xa84a('0x3c')](_0x575230[_0xa84a('0x3a')][_0xa84a('0x3c')]));_0x204d27[_0xa84a('0x3b')]=_0x204d27[_0xa84a('0x3b')]['length']?_0x204d27[_0xa84a('0x3b')]:_0x53e1c0[_0xa84a('0x35')];if(!_0x575230[_0xa84a('0x3a')][_0xa84a('0x3e')](_0xa84a('0x5a'))){_0x204d27[_0xa84a('0x22')]=qs[_0xa84a('0x22')](_0x575230['query'][_0xa84a('0x22')]);_0x204d27[_0xa84a('0x21')]=qs[_0xa84a('0x21')](_0x575230[_0xa84a('0x3a')][_0xa84a('0x21')]);}_0x204d27[_0xa84a('0x3f')]=qs[_0xa84a('0x40')](_0x575230[_0xa84a('0x3a')][_0xa84a('0x40')]);_0x204d27['where']=qs[_0xa84a('0x38')](_[_0xa84a('0x5b')](_0x575230[_0xa84a('0x3a')],_0x53e1c0[_0xa84a('0x38')]));_0x204d27[_0xa84a('0x6f')]=!![];if(_0x575230[_0xa84a('0x3a')][_0xa84a('0x42')]){_0x204d27[_0xa84a('0x41')]=_['merge'](_0x204d27[_0xa84a('0x41')],{'$or':_[_0xa84a('0x36')](_0x204d27[_0xa84a('0x3b')],function(_0x5f509e){var _0x196d5c={};_0x196d5c[_0x5f509e]={'$like':'%'+_0x575230[_0xa84a('0x3a')][_0xa84a('0x42')]+'%'};return _0x196d5c;})});}_0x204d27=_['merge']({},_0x204d27,_0x575230[_0xa84a('0x44')]);return _0x72c728[_0xa84a('0x6b')](_0x204d27);}})[_0xa84a('0x2a')](respondWithResult(_0x38287d,null))[_0xa84a('0x49')](handleError(_0x38287d,null));};exports['getContactsCsv']=function(_0x461656,_0x49a7d9,_0x509b17){var _0xe3a80;return db['CmList'][_0xa84a('0x4b')]({'where':{'id':_0x461656['params']['id']},'include':[{'model':db[_0xa84a('0x6c')],'as':_0xa84a('0x6d')}]})[_0xa84a('0x2a')](handleEntityNotFound(_0x49a7d9,null))['then'](function(_0x35f7ec){if(_0x35f7ec){_0xe3a80=_0x35f7ec;return db[_0xa84a('0x5f')][_0xa84a('0x31')];}})[_0xa84a('0x2a')](function(_0x143df3){if(_0x143df3){var _0x54943e={};var _0x351537={};_0x351537[_0xa84a('0x35')]=_[_0xa84a('0x6e')](_['keys'](_0x143df3),_[_0xa84a('0x36')](_0xe3a80[_0xa84a('0x6d')],function(_0x3348b6){return util[_0xa84a('0x70')](_0xa84a('0x71'),_0x3348b6['id']);}));_0x351537[_0xa84a('0x3a')]=_[_0xa84a('0x37')](_0x461656[_0xa84a('0x3a')]);_0x351537['filters']=_[_0xa84a('0x39')](_0x351537[_0xa84a('0x35')],_0x351537['query']);_0x54943e[_0xa84a('0x3b')]=_['intersection'](_0x351537[_0xa84a('0x35')],qs[_0xa84a('0x3c')](_0x461656['query'][_0xa84a('0x3c')]));_0x54943e['attributes']=_0x54943e[_0xa84a('0x3b')][_0xa84a('0x3d')]?_0x54943e['attributes']:_0x351537['model'];if(!_0x461656[_0xa84a('0x3a')][_0xa84a('0x3e')](_0xa84a('0x5a'))){_0x54943e[_0xa84a('0x22')]=qs[_0xa84a('0x22')](_0x461656[_0xa84a('0x3a')][_0xa84a('0x22')]);_0x54943e[_0xa84a('0x21')]=qs[_0xa84a('0x21')](_0x461656[_0xa84a('0x3a')][_0xa84a('0x21')]);}_0x54943e['order']=qs[_0xa84a('0x40')](_0x461656[_0xa84a('0x3a')][_0xa84a('0x40')]);_0x54943e[_0xa84a('0x41')]=qs[_0xa84a('0x38')](_[_0xa84a('0x5b')](_0x461656[_0xa84a('0x3a')],_0x351537[_0xa84a('0x38')]));_0x54943e['raw']=!![];if(_0x461656[_0xa84a('0x3a')]['filter']){_0x54943e[_0xa84a('0x41')]=_[_0xa84a('0x43')](_0x54943e[_0xa84a('0x41')],{'$or':_[_0xa84a('0x36')](_0x54943e[_0xa84a('0x3b')],function(_0x3e8d50){var _0x39af7e={};_0x39af7e[_0x3e8d50]={'$like':'%'+_0x461656[_0xa84a('0x3a')][_0xa84a('0x42')]+'%'};return _0x39af7e;})});}_0x54943e=_[_0xa84a('0x43')]({},_0x54943e,_0x461656[_0xa84a('0x44')]);return _0xe3a80[_0xa84a('0x6b')](_0x54943e);}})[_0xa84a('0x2a')](function(_0x56bee2){if(!_[_0xa84a('0x72')](_0x56bee2)){var _0x22499b=toCsv(_0x56bee2);var _0x361635=Date['now']();fs[_0xa84a('0x73')](util[_0xa84a('0x70')](_0xa84a('0x74'),_0xe3a80['id'],_0x361635),_0x22499b);_0x49a7d9['setHeader'](_0xa84a('0x75'),_0xa84a('0x76')+util[_0xa84a('0x70')](_0xa84a('0x77'),_0xe3a80['id'],_0x361635));_0x49a7d9['setHeader'](_0xa84a('0x78'),'text/csv');return _0x49a7d9['download'](util['format'](_0xa84a('0x74'),_0xe3a80['id'],_0x361635));}else{return _0x49a7d9[_0xa84a('0x1c')](0xcc);}})[_0xa84a('0x49')](handleError(_0x49a7d9,null));};exports[_0xa84a('0x79')]=function(_0x3e8184,_0x3510c0,_0x374ba3){var _0x4e06b9;delete _0x3e8184[_0xa84a('0x52')]['id'];return db[_0xa84a('0x30')]['findOne']({'where':{'id':_0x3e8184[_0xa84a('0x53')]['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x3510c0,null))[_0xa84a('0x2a')](function(_0x52a961){if(_0x52a961){return db[_0xa84a('0x7a')][_0xa84a('0x7b')](function(_0x247a00){return db[_0xa84a('0x6c')][_0xa84a('0x4c')](_0x3e8184[_0xa84a('0x52')],{'transaction':_0x247a00})[_0xa84a('0x2a')](function(_0x47e097){_0x4e06b9=_0x47e097;return _0x52a961['addCustomFields'](_0x47e097,{'transaction':_0x247a00});})['then'](function(){var _0x3d210e={'type':db[_0xa84a('0x7c')][_0xa84a('0x7d')],'transaction':_0x247a00};switch(_0x3e8184[_0xa84a('0x52')][_0xa84a('0x33')]){case _0xa84a('0x7e'):_0x3d210e[_0xa84a('0x33')]=db[_0xa84a('0x7c')][_0xa84a('0x7d')];break;case _0xa84a('0x7f'):_0x3d210e[_0xa84a('0x33')]=db[_0xa84a('0x7c')][_0xa84a('0x80')];break;case _0xa84a('0x81'):_0x3d210e['type']=db['Sequelize'][_0xa84a('0x82')];_0x3d210e['defaultValue']=![];break;default:}return db[_0xa84a('0x7a')][_0xa84a('0x83')]['addColumn'](_0xa84a('0x84'),util['format'](_0xa84a('0x85'),_0x4e06b9['id']),_0x3d210e);})[_0xa84a('0x2a')](function(){return _0x4e06b9;});});}})[_0xa84a('0x2a')](respondWithResult(_0x3510c0,null))[_0xa84a('0x49')](handleError(_0x3510c0,null));};exports[_0xa84a('0x86')]=function(_0x8334b8,_0x2a962d,_0x2f0560){var _0x525951={};var _0x11ba72={};var _0x385e64;var _0x3c5caf;return db[_0xa84a('0x30')][_0xa84a('0x59')]({'where':{'id':_0x8334b8['params']['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x2a962d,null))[_0xa84a('0x2a')](function(_0xd27a83){if(_0xd27a83){_0x385e64=_0xd27a83;_0x11ba72[_0xa84a('0x35')]=_[_0xa84a('0x37')](db[_0xa84a('0x6c')][_0xa84a('0x31')]);_0x11ba72[_0xa84a('0x3a')]=_[_0xa84a('0x37')](_0x8334b8[_0xa84a('0x3a')]);_0x11ba72['filters']=_[_0xa84a('0x39')](_0x11ba72[_0xa84a('0x35')],_0x11ba72['query']);_0x525951[_0xa84a('0x3b')]=_[_0xa84a('0x39')](_0x11ba72[_0xa84a('0x35')],qs[_0xa84a('0x3c')](_0x8334b8[_0xa84a('0x3a')][_0xa84a('0x3c')]));_0x525951['attributes']=_0x525951[_0xa84a('0x3b')]['length']?_0x525951[_0xa84a('0x3b')]:_0x11ba72[_0xa84a('0x35')];_0x525951[_0xa84a('0x3f')]=qs['sort'](_0x8334b8[_0xa84a('0x3a')][_0xa84a('0x40')]);_0x525951['where']=qs['filters'](_[_0xa84a('0x5b')](_0x8334b8[_0xa84a('0x3a')],_0x11ba72['filters']));_0x525951[_0xa84a('0x41')]=_['merge'](_0x525951[_0xa84a('0x41')],{'$or':[{'ListId':_0xd27a83['id']},{'ListId':null}]});if(_0x8334b8['query'][_0xa84a('0x42')]){_0x525951[_0xa84a('0x41')]=_['merge'](_0x525951[_0xa84a('0x41')],{'$or':_[_0xa84a('0x36')](_0x525951[_0xa84a('0x3b')],function(_0x3dd15b){var _0x4158b4={};_0x4158b4[_0x3dd15b]={'$like':'%'+_0x8334b8[_0xa84a('0x3a')][_0xa84a('0x42')]+'%'};return _0x4158b4;})});}_0x525951=_[_0xa84a('0x43')]({},_0x525951,_0x8334b8[_0xa84a('0x44')]);return db['CmCustomField'][_0xa84a('0x87')](_0x525951);}})[_0xa84a('0x2a')](respondWithResult(_0x2a962d,null))[_0xa84a('0x49')](handleError(_0x2a962d,null));};exports[_0xa84a('0x88')]=function(_0x3ba37b,_0x2ba079,_0x4edbfc){return db[_0xa84a('0x30')][_0xa84a('0x4b')]({'where':{'id':_0x3ba37b[_0xa84a('0x53')]['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x2ba079,null))[_0xa84a('0x2a')](function(_0x2a7bb3){if(_0x2a7bb3){return _0x2a7bb3[_0xa84a('0x88')](_0x3ba37b[_0xa84a('0x52')]['ids'],_['omit'](_0x3ba37b[_0xa84a('0x52')],[_0xa84a('0x5d'),'id'])||{})[_0xa84a('0x89')](function(_0x2794ab){for(var _0x397db8=0x0;_0x397db8<_0x3ba37b[_0xa84a('0x52')][_0xa84a('0x5d')][_0xa84a('0x3d')];_0x397db8+=0x1){socket[_0xa84a('0x8a')](_0xa84a('0x8b'),{'UserId':_0x3ba37b['body'][_0xa84a('0x5d')][_0x397db8],'CmListId':_0x3ba37b['params']['id']});}return _0x2794ab;});}})[_0xa84a('0x2a')](respondWithResult(_0x2ba079,null))['catch'](handleError(_0x2ba079,null));};exports[_0xa84a('0x8c')]=function(_0x37f876,_0x36f23f,_0x53c5eb){return db['CmList']['find']({'where':{'id':_0x37f876[_0xa84a('0x53')]['id']}})['then'](handleEntityNotFound(_0x36f23f,null))[_0xa84a('0x2a')](function(_0x18c30a){if(_0x18c30a){return _0x18c30a[_0xa84a('0x8c')](_0x37f876[_0xa84a('0x3a')]['ids'])['then'](function(){if(_[_0xa84a('0x60')](_0x37f876[_0xa84a('0x3a')][_0xa84a('0x5d')])){for(var _0x22c79d=0x0;_0x22c79d<_0x37f876[_0xa84a('0x3a')][_0xa84a('0x5d')][_0xa84a('0x3d')];_0x22c79d+=0x1){socket[_0xa84a('0x8a')](_0xa84a('0x8d'),{'UserId':Number(_0x37f876[_0xa84a('0x3a')][_0xa84a('0x5d')][_0x22c79d]),'CmListId':Number(_0x37f876['params']['id'])});}}else{socket[_0xa84a('0x8a')]('userCmList:remove',{'UserId':Number(_0x37f876[_0xa84a('0x3a')]['ids']),'CmListId':Number(_0x37f876['params']['id'])});}});}})[_0xa84a('0x2a')](respondWithStatusCode(_0x36f23f,null))[_0xa84a('0x49')](handleError(_0x36f23f,null));};exports[_0xa84a('0x8e')]=function(_0x17bae1,_0x1a40c8,_0x1e5bfa){var _0x1fdeca={};var _0x199956={};var _0x57b127;var _0x538ce2;return db[_0xa84a('0x30')]['findOne']({'where':{'id':_0x17bae1[_0xa84a('0x53')]['id']}})[_0xa84a('0x2a')](handleEntityNotFound(_0x1a40c8,null))['then'](function(_0x471ef3){if(_0x471ef3){_0x57b127=_0x471ef3;_0x199956['model']=_['keys'](db[_0xa84a('0x8f')][_0xa84a('0x31')]);_0x199956[_0xa84a('0x3a')]=_['keys'](_0x17bae1[_0xa84a('0x3a')]);_0x199956[_0xa84a('0x38')]=_['intersection'](_0x199956[_0xa84a('0x35')],_0x199956[_0xa84a('0x3a')]);_0x1fdeca[_0xa84a('0x3b')]=_[_0xa84a('0x39')](_0x199956[_0xa84a('0x35')],qs[_0xa84a('0x3c')](_0x17bae1[_0xa84a('0x3a')][_0xa84a('0x3c')]));_0x1fdeca['attributes']=_0x1fdeca[_0xa84a('0x3b')][_0xa84a('0x3d')]?_0x1fdeca[_0xa84a('0x3b')]:_0x199956[_0xa84a('0x35')];_0x1fdeca['order']=qs[_0xa84a('0x40')](_0x17bae1['query'][_0xa84a('0x40')]);_0x1fdeca[_0xa84a('0x41')]=qs[_0xa84a('0x38')](_[_0xa84a('0x5b')](_0x17bae1['query'],_0x199956['filters']));if(_0x17bae1[_0xa84a('0x3a')][_0xa84a('0x42')]){_0x1fdeca[_0xa84a('0x41')]=_[_0xa84a('0x43')](_0x1fdeca[_0xa84a('0x41')],{'$or':_[_0xa84a('0x36')](_0x1fdeca[_0xa84a('0x3b')],function(_0x34fe20){var _0x2d1529={};_0x2d1529[_0x34fe20]={'$like':'%'+_0x17bae1[_0xa84a('0x3a')][_0xa84a('0x42')]+'%'};return _0x2d1529;})});}_0x1fdeca=_[_0xa84a('0x43')]({},_0x1fdeca,_0x17bae1[_0xa84a('0x44')]);return _0x57b127[_0xa84a('0x8e')](_0x1fdeca);}})[_0xa84a('0x2a')](function(_0x54e7b9){if(_0x54e7b9){_0x538ce2=_0x54e7b9[_0xa84a('0x3d')];if(!_0x17bae1[_0xa84a('0x3a')][_0xa84a('0x3e')](_0xa84a('0x5a'))){_0x1fdeca[_0xa84a('0x22')]=qs[_0xa84a('0x22')](_0x17bae1['query'][_0xa84a('0x22')]);_0x1fdeca[_0xa84a('0x21')]=qs[_0xa84a('0x21')](_0x17bae1[_0xa84a('0x3a')][_0xa84a('0x21')]);}return _0x57b127[_0xa84a('0x8e')](_0x1fdeca);}})[_0xa84a('0x2a')](function(_0x2fd266){if(_0x2fd266){return _0x2fd266?{'count':_0x538ce2,'rows':_0x2fd266}:null;}})['then'](respondWithResult(_0x1a40c8,null))[_0xa84a('0x49')](handleError(_0x1a40c8,null));}; \ No newline at end of file +var _0x7629=['findAll','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','Disposition','getDispositions','hasOwnProperty','order','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','getContactsCsv','CmCustomField','concat','format','cf_%d','raw','isEmpty','now','/tmp/list_%d_%s.csv','Content-disposition','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','findOne','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','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/environment','../../mysqldb','defaults','redis','localhost','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x15c068,_0x441624){var _0x369daf=function(_0x3868f0){while(--_0x3868f0){_0x15c068['push'](_0x15c068['shift']());}};_0x369daf(++_0x441624);}(_0x7629,0x171));var _0x9762=function(_0x2b2d13,_0x3a6f7b){_0x2b2d13=_0x2b2d13-0x0;var _0x1ad5b5=_0x7629[_0x2b2d13];return _0x1ad5b5;};'use strict';var pdf=require(_0x9762('0x0'));var emlformat=require(_0x9762('0x1'));var rimraf=require(_0x9762('0x2'));var zipdir=require(_0x9762('0x3'));var jsonpatch=require(_0x9762('0x4'));var rp=require(_0x9762('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9762('0x6'));var util=require(_0x9762('0x7'));var path=require('path');var sox=require(_0x9762('0x8'));var csv=require(_0x9762('0x9'));var ejs=require(_0x9762('0xa'));var fs=require('fs');var _=require(_0x9762('0xb'));var squel=require(_0x9762('0xc'));var crypto=require(_0x9762('0xd'));var jsforce=require(_0x9762('0xe'));var deskjs=require(_0x9762('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9762('0x10'));var authService=require(_0x9762('0x11'));var qs=require(_0x9762('0x12'));var as=require(_0x9762('0x13'));var hardwareService=require(_0x9762('0x14'));var logger=require(_0x9762('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9762('0x16'));var db=require(_0x9762('0x17'))['db'];config['redis']=_[_0x9762('0x18')](config[_0x9762('0x19')],{'host':_0x9762('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9762('0x19')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0xe7b051,_0x170643){_0x170643=_0x170643||0xcc;return function(_0xcc5669){if(_0xcc5669){return _0xe7b051[_0x9762('0x1b')](_0x170643);}return _0xe7b051[_0x9762('0x1c')](_0x170643)['end']();};}function respondWithResult(_0x4653ed,_0x39b0d1){_0x39b0d1=_0x39b0d1||0xc8;return function(_0x4a442a){if(_0x4a442a){return _0x4653ed[_0x9762('0x1c')](_0x39b0d1)[_0x9762('0x1d')](_0x4a442a);}};}function respondWithFilteredResult(_0x81b3c4,_0x3f02a0){return function(_0x2c1555){if(_0x2c1555){var _0x5b7cb2=_0x2c1555[_0x9762('0x1e')],_0x4ab597=_0x3f02a0[_0x9762('0x1f')],_0x1354eb=_0x3f02a0[_0x9762('0x1f')]+_0x3f02a0['limit'],_0x18cf24;if(_0x1354eb>=_0x5b7cb2){_0x1354eb=_0x5b7cb2;_0x18cf24=0xc8;}else{_0x18cf24=0xce;}_0x81b3c4[_0x9762('0x1c')](_0x18cf24);return _0x81b3c4[_0x9762('0x20')](_0x9762('0x21'),_0x4ab597+'-'+_0x1354eb+'/'+_0x5b7cb2)[_0x9762('0x1d')](_0x2c1555);}return null;};}function patchUpdates(_0x4d2f91){return function(_0x455460){try{jsonpatch[_0x9762('0x22')](_0x455460,_0x4d2f91,!![]);}catch(_0xb6ffcc){return BPromise[_0x9762('0x23')](_0xb6ffcc);}return _0x455460[_0x9762('0x24')]();};}function saveUpdates(_0x3b58da,_0x1ec274){return function(_0x377b39){if(_0x377b39){return _0x377b39[_0x9762('0x25')](_0x3b58da)[_0x9762('0x26')](function(_0x3d9e70){return _0x3d9e70;});}return null;};}function removeEntity(_0x897a58,_0x2c4c54){return function(_0xd1eda6){if(_0xd1eda6){return _0xd1eda6[_0x9762('0x27')]()['then'](function(){var _0x3c77ea=_0xd1eda6[_0x9762('0x28')]({'plain':!![]});var _0xee591e=_0x9762('0x29');return db[_0x9762('0x2a')]['destroy']({'where':{'type':_0xee591e,'resourceId':_0x3c77ea['id']}})[_0x9762('0x26')](function(){return _0xd1eda6;});})[_0x9762('0x26')](function(){_0x897a58[_0x9762('0x1c')](0xcc)[_0x9762('0x2b')]();});}};}function handleEntityNotFound(_0x32f83b,_0x258566){return function(_0x28c998){if(!_0x28c998){_0x32f83b[_0x9762('0x1b')](0x194);}return _0x28c998;};}function handleError(_0x38d776,_0x218bd0){_0x218bd0=_0x218bd0||0x1f4;return function(_0x5cbe1f){logger[_0x9762('0x2c')](_0x5cbe1f[_0x9762('0x2d')]);if(_0x5cbe1f[_0x9762('0x2e')]){delete _0x5cbe1f[_0x9762('0x2e')];}_0x38d776[_0x9762('0x1c')](_0x218bd0)[_0x9762('0x2f')](_0x5cbe1f);};}exports[_0x9762('0x30')]=function(_0x76dfd4,_0x4a3994){var _0x30b2bb={},_0x392299={},_0x79f1b8={'count':0x0,'rows':[]};var _0x3b6abc=_[_0x9762('0x31')](db[_0x9762('0x32')][_0x9762('0x33')],function(_0xf481ad){return{'name':_0xf481ad['fieldName'],'type':_0xf481ad[_0x9762('0x34')]['key']};});_0x392299[_0x9762('0x35')]=_['map'](_0x3b6abc,_0x9762('0x2e'));_0x392299['query']=_[_0x9762('0x36')](_0x76dfd4[_0x9762('0x37')]);_0x392299[_0x9762('0x38')]=_[_0x9762('0x39')](_0x392299[_0x9762('0x35')],_0x392299[_0x9762('0x37')]);_0x30b2bb[_0x9762('0x3a')]=_[_0x9762('0x39')](_0x392299[_0x9762('0x35')],qs[_0x9762('0x3b')](_0x76dfd4[_0x9762('0x37')][_0x9762('0x3b')]));_0x30b2bb[_0x9762('0x3a')]=_0x30b2bb[_0x9762('0x3a')][_0x9762('0x3c')]?_0x30b2bb[_0x9762('0x3a')]:_0x392299[_0x9762('0x35')];if(!_0x76dfd4['query']['hasOwnProperty'](_0x9762('0x3d'))){_0x30b2bb['limit']=qs['limit'](_0x76dfd4[_0x9762('0x37')][_0x9762('0x3e')]);_0x30b2bb[_0x9762('0x1f')]=qs[_0x9762('0x1f')](_0x76dfd4[_0x9762('0x37')]['offset']);}_0x30b2bb['order']=qs[_0x9762('0x3f')](_0x76dfd4[_0x9762('0x37')][_0x9762('0x3f')]);_0x30b2bb['where']=qs[_0x9762('0x38')](_[_0x9762('0x40')](_0x76dfd4[_0x9762('0x37')],_0x392299['filters']),_0x3b6abc);if(_0x76dfd4['query'][_0x9762('0x41')]){_0x30b2bb['where']=_['merge'](_0x30b2bb[_0x9762('0x42')],{'$or':_['map'](_0x3b6abc,function(_0x1636b5){if(_0x1636b5['type']!==_0x9762('0x43')){var _0x1e60d8={};_0x1e60d8[_0x1636b5['name']]={'$like':'%'+_0x76dfd4[_0x9762('0x37')][_0x9762('0x41')]+'%'};return _0x1e60d8;}})});}_0x30b2bb=_[_0x9762('0x44')]({},_0x30b2bb,_0x76dfd4[_0x9762('0x45')]);var _0x2ae2b4={'where':_0x30b2bb[_0x9762('0x42')]};return db[_0x9762('0x32')][_0x9762('0x1e')](_0x2ae2b4)[_0x9762('0x26')](function(_0x329b2b){_0x79f1b8['count']=_0x329b2b;if(_0x76dfd4[_0x9762('0x37')][_0x9762('0x46')]){_0x30b2bb[_0x9762('0x47')]=[{'all':!![]}];}return db[_0x9762('0x32')][_0x9762('0x48')](_0x30b2bb);})[_0x9762('0x26')](function(_0x111e41){_0x79f1b8['rows']=_0x111e41;return _0x79f1b8;})[_0x9762('0x26')](respondWithFilteredResult(_0x4a3994,_0x30b2bb))[_0x9762('0x49')](handleError(_0x4a3994,null));};exports[_0x9762('0x4a')]=function(_0x51c51f,_0x1a572d){var _0x49fbbf={'raw':![],'where':{'id':_0x51c51f['params']['id']}},_0x20f277={};_0x20f277[_0x9762('0x35')]=_[_0x9762('0x36')](db[_0x9762('0x32')][_0x9762('0x33')]);_0x20f277[_0x9762('0x37')]=_[_0x9762('0x36')](_0x51c51f[_0x9762('0x37')]);_0x20f277['filters']=_[_0x9762('0x39')](_0x20f277[_0x9762('0x35')],_0x20f277[_0x9762('0x37')]);_0x49fbbf['attributes']=_[_0x9762('0x39')](_0x20f277['model'],qs[_0x9762('0x3b')](_0x51c51f['query'][_0x9762('0x3b')]));_0x49fbbf['attributes']=_0x49fbbf[_0x9762('0x3a')]['length']?_0x49fbbf[_0x9762('0x3a')]:_0x20f277['model'];if(_0x51c51f[_0x9762('0x37')][_0x9762('0x46')]){_0x49fbbf[_0x9762('0x47')]=[{'all':!![]}];}_0x49fbbf=_[_0x9762('0x44')]({},_0x49fbbf,_0x51c51f['options']);return db[_0x9762('0x32')]['find'](_0x49fbbf)[_0x9762('0x26')](handleEntityNotFound(_0x1a572d,null))[_0x9762('0x26')](respondWithResult(_0x1a572d,null))[_0x9762('0x49')](handleError(_0x1a572d,null));};exports[_0x9762('0x4b')]=function(_0x4eaecb,_0x1c83cc){return db[_0x9762('0x32')][_0x9762('0x4b')](_0x4eaecb[_0x9762('0x4c')],{})['then'](function(_0x2ca60d){var _0x2fd1d1=_0x4eaecb[_0x9762('0x4d')][_0x9762('0x28')]({'plain':!![]});if(!_0x2fd1d1)throw new Error(_0x9762('0x4e'));if(_0x2fd1d1[_0x9762('0x4f')]===_0x9762('0x4d')){var _0x375c63=_0x2ca60d['get']({'plain':!![]});var _0x352ce9=_0x9762('0x29');return db[_0x9762('0x50')][_0x9762('0x51')]({'where':{'name':_0x352ce9,'userProfileId':_0x2fd1d1[_0x9762('0x52')]},'raw':!![]})['then'](function(_0x479af6){if(_0x479af6&&_0x479af6['autoAssociation']===0x0){return db[_0x9762('0x2a')][_0x9762('0x4b')]({'name':_0x375c63[_0x9762('0x2e')],'resourceId':_0x375c63['id'],'type':_0x479af6['name'],'sectionId':_0x479af6['id']},{})['then'](function(){return _0x2ca60d;});}else{return _0x2ca60d;}})[_0x9762('0x49')](function(_0x2e22ac){logger[_0x9762('0x2c')](_0x9762('0x53'),_0x2e22ac);throw _0x2e22ac;});}return _0x2ca60d;})[_0x9762('0x26')](respondWithResult(_0x1c83cc,0xc9))[_0x9762('0x49')](handleError(_0x1c83cc,null));};exports[_0x9762('0x25')]=function(_0x2e37af,_0xccfdd6){if(_0x2e37af[_0x9762('0x4c')]['id']){delete _0x2e37af[_0x9762('0x4c')]['id'];}return db[_0x9762('0x32')][_0x9762('0x51')]({'where':{'id':_0x2e37af[_0x9762('0x54')]['id']}})['then'](handleEntityNotFound(_0xccfdd6,null))[_0x9762('0x26')](saveUpdates(_0x2e37af[_0x9762('0x4c')],null))['then'](respondWithResult(_0xccfdd6,null))[_0x9762('0x49')](handleError(_0xccfdd6,null));};exports[_0x9762('0x27')]=function(_0x3bac5b,_0x202bea){return db[_0x9762('0x32')][_0x9762('0x51')]({'where':{'id':_0x3bac5b[_0x9762('0x54')]['id']}})['then'](handleEntityNotFound(_0x202bea,null))['then'](removeEntity(_0x202bea,null))[_0x9762('0x49')](handleError(_0x202bea,null));};exports[_0x9762('0x55')]=function(_0x4d0f58,_0x259e78){return db['CmList']['describe']()[_0x9762('0x26')](respondWithResult(_0x259e78,null))[_0x9762('0x49')](handleError(_0x259e78,null));};exports['addDisposition']=function(_0x5dbc3a,_0x515290,_0x41f7f9){if(_0x5dbc3a[_0x9762('0x4c')]['id']){delete _0x5dbc3a[_0x9762('0x4c')]['id'];}return db[_0x9762('0x32')][_0x9762('0x51')]({'where':{'id':_0x5dbc3a[_0x9762('0x54')]['id']}})['then'](handleEntityNotFound(_0x515290,null))['then'](function(_0x2f3f28){if(_0x2f3f28){_0x5dbc3a['body'][_0x9762('0x56')]=_0x2f3f28['id'];return db[_0x9762('0x57')][_0x9762('0x4b')](_0x5dbc3a['body']);}})['then'](respondWithResult(_0x515290,null))[_0x9762('0x49')](handleError(_0x515290,null));};exports[_0x9762('0x58')]=function(_0x55eeb1,_0xb9cb99,_0x3ca500){var _0x5c3779={'raw':![],'where':{}};var _0x3c5016={};var _0x75559a={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x55eeb1[_0x9762('0x54')]['id']}})[_0x9762('0x26')](handleEntityNotFound(_0xb9cb99,null))[_0x9762('0x26')](function(_0x521f18){if(_0x521f18){_0x3c5016[_0x9762('0x35')]=_['keys'](db['Disposition'][_0x9762('0x33')]);_0x3c5016['query']=_['keys'](_0x55eeb1['query']);_0x3c5016[_0x9762('0x38')]=_['intersection'](_0x3c5016[_0x9762('0x35')],_0x3c5016[_0x9762('0x37')]);_0x5c3779[_0x9762('0x3a')]=_[_0x9762('0x39')](_0x3c5016[_0x9762('0x35')],qs['fields'](_0x55eeb1[_0x9762('0x37')]['fields']));_0x5c3779['attributes']=_0x5c3779[_0x9762('0x3a')][_0x9762('0x3c')]?_0x5c3779[_0x9762('0x3a')]:_0x3c5016[_0x9762('0x35')];if(!_0x55eeb1[_0x9762('0x37')][_0x9762('0x59')](_0x9762('0x3d'))){_0x5c3779[_0x9762('0x3e')]=qs[_0x9762('0x3e')](_0x55eeb1['query'][_0x9762('0x3e')]);_0x5c3779[_0x9762('0x1f')]=qs['offset'](_0x55eeb1[_0x9762('0x37')][_0x9762('0x1f')]);}_0x5c3779[_0x9762('0x5a')]=qs[_0x9762('0x3f')](_0x55eeb1[_0x9762('0x37')]['sort']);_0x5c3779[_0x9762('0x42')]=qs[_0x9762('0x38')](_['pick'](_0x55eeb1[_0x9762('0x37')],_0x3c5016['filters']));_0x5c3779[_0x9762('0x42')]['ListId']=_0x521f18['id'];if(_0x55eeb1[_0x9762('0x37')][_0x9762('0x41')]){_0x5c3779[_0x9762('0x42')]=_[_0x9762('0x44')](_0x5c3779[_0x9762('0x42')],{'$or':_['map'](_0x5c3779[_0x9762('0x3a')],function(_0x240efc){var _0xff7a9b={};_0xff7a9b[_0x240efc]={'$like':'%'+_0x55eeb1[_0x9762('0x37')][_0x9762('0x41')]+'%'};return _0xff7a9b;})});}_0x5c3779=_['merge']({},_0x5c3779,_0x55eeb1['options']);return db[_0x9762('0x57')]['count']({'where':_0x5c3779[_0x9762('0x42')]})[_0x9762('0x26')](function(_0x4542ff){_0x75559a[_0x9762('0x1e')]=_0x4542ff;if(_0x55eeb1[_0x9762('0x37')][_0x9762('0x46')]){_0x5c3779[_0x9762('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x9762('0x48')](_0x5c3779);})['then'](function(_0x49c4b1){_0x75559a[_0x9762('0x5b')]=_0x49c4b1;return _0x75559a;});}})[_0x9762('0x26')](respondWithFilteredResult(_0xb9cb99,_0x5c3779))['catch'](handleError(_0xb9cb99,null));};exports[_0x9762('0x5c')]=function(_0x19a1fe,_0x510155,_0x477f3a){return db[_0x9762('0x32')]['find']({'where':{'id':_0x19a1fe['params']['id']}})[_0x9762('0x26')](handleEntityNotFound(_0x510155,null))[_0x9762('0x26')](function(_0x308c72){if(_0x308c72){return _0x308c72[_0x9762('0x5c')](_0x19a1fe[_0x9762('0x37')][_0x9762('0x5d')]);}})[_0x9762('0x26')](respondWithStatusCode(_0x510155,null))[_0x9762('0x49')](handleError(_0x510155,null));};exports[_0x9762('0x5e')]=function(_0x3ebe86,_0x1728a9,_0x412547){return db[_0x9762('0x32')]['find']({'where':{'id':_0x3ebe86[_0x9762('0x54')]['id']}})[_0x9762('0x26')](handleEntityNotFound(_0x1728a9,null))[_0x9762('0x26')](function(_0x3f9006){if(_0x3f9006){var _0x245572=[];var _0x9fedd={'success':[],'errors':[]};return db[_0x9762('0x5f')][_0x9762('0x55')]()[_0x9762('0x26')](function(_0x18897c){if(_0x3ebe86[_0x9762('0x4c')][_0x9762('0x60')]&&_[_0x9762('0x61')](_0x3ebe86['body']['tags'])){if(_0x3ebe86[_0x9762('0x4c')][_0x9762('0x60')]['length']){_0x3ebe86[_0x9762('0x4c')]['tags']=_0x3ebe86['body'][_0x9762('0x60')][_0x9762('0x62')](';')+';';}else{_0x3ebe86['body']['tags']=null;}}else{_0x3ebe86[_0x9762('0x4c')][_0x9762('0x60')]=null;}if(_0x3ebe86[_0x9762('0x4c')]&&_[_0x9762('0x61')](_0x3ebe86['body'])){for(var _0x151d17=0x0;_0x151d17<_0x3ebe86[_0x9762('0x4c')][_0x9762('0x3c')];_0x151d17+=0x1){_0x3ebe86[_0x9762('0x4c')][_0x151d17]['ListId']=_0x3ebe86[_0x9762('0x54')]['id'];_0x245572[_0x9762('0x63')](_0x3ebe86['body'][_0x151d17]);}return BPromise[_0x9762('0x64')](_0x245572,function(_0x3a39d5){return db[_0x9762('0x5f')]['create'](_[_0x9762('0x65')](_0x3a39d5,['ids','id'])||{},{'fields':_[_0x9762('0x36')](_0x18897c),'raw':!![]})[_0x9762('0x26')](function(_0x5bb6ee){_0x9fedd[_0x9762('0x66')][_0x9762('0x63')](_0x5bb6ee[_0x9762('0x67')]);})['catch'](function(_0xc82530){_0x9fedd[_0x9762('0x68')][_0x9762('0x63')]({'data':_0x3a39d5,'error':_0xc82530[_0x9762('0x69')]});});})[_0x9762('0x26')](function(_0x2356d9){return _0x9fedd;})[_0x9762('0x49')](function(_0x418b42){return _0x418b42;});}else{_0x1728a9[_0x9762('0x1c')](0x190)[_0x9762('0x1d')]({'message':_0x9762('0x6a')});}});}})[_0x9762('0x26')](respondWithResult(_0x1728a9,null))[_0x9762('0x49')](handleError(_0x1728a9,null));};exports[_0x9762('0x6b')]=function(_0x151fae,_0x303e44,_0x2f9a42){var _0x3d4ff8;return db[_0x9762('0x32')][_0x9762('0x51')]({'where':{'id':_0x151fae[_0x9762('0x54')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x9762('0x6c')}]})[_0x9762('0x26')](handleEntityNotFound(_0x303e44,null))['then'](function(_0x33ad6f){if(_0x33ad6f){_0x3d4ff8=_0x33ad6f;return db[_0x9762('0x5f')]['rawAttributes'];}})[_0x9762('0x26')](function(_0x3424c7){if(_0x3424c7){var _0x3a2a2c={};var _0x37afc1={};_0x37afc1[_0x9762('0x35')]=_['concat'](_[_0x9762('0x36')](_0x3424c7),_[_0x9762('0x31')](_0x3d4ff8[_0x9762('0x6c')],function(_0x1d7dc2){return util['format']('cf_%d',_0x1d7dc2['id']);}));_0x37afc1['query']=_[_0x9762('0x36')](_0x151fae[_0x9762('0x37')]);_0x37afc1[_0x9762('0x38')]=_[_0x9762('0x39')](_0x37afc1['model'],_0x37afc1[_0x9762('0x37')]);_0x3a2a2c[_0x9762('0x3a')]=_[_0x9762('0x39')](_0x37afc1['model'],qs['fields'](_0x151fae[_0x9762('0x37')]['fields']));_0x3a2a2c[_0x9762('0x3a')]=_0x3a2a2c[_0x9762('0x3a')][_0x9762('0x3c')]?_0x3a2a2c['attributes']:_0x37afc1[_0x9762('0x35')];if(!_0x151fae[_0x9762('0x37')][_0x9762('0x59')](_0x9762('0x3d'))){_0x3a2a2c[_0x9762('0x3e')]=qs[_0x9762('0x3e')](_0x151fae[_0x9762('0x37')][_0x9762('0x3e')]);_0x3a2a2c[_0x9762('0x1f')]=qs['offset'](_0x151fae['query']['offset']);}_0x3a2a2c[_0x9762('0x5a')]=qs[_0x9762('0x3f')](_0x151fae[_0x9762('0x37')][_0x9762('0x3f')]);_0x3a2a2c['where']=qs[_0x9762('0x38')](_[_0x9762('0x40')](_0x151fae[_0x9762('0x37')],_0x37afc1['filters']));_0x3a2a2c['raw']=!![];if(_0x151fae[_0x9762('0x37')][_0x9762('0x41')]){_0x3a2a2c[_0x9762('0x42')]=_[_0x9762('0x44')](_0x3a2a2c['where'],{'$or':_[_0x9762('0x31')](_0x3a2a2c['attributes'],function(_0x47f05e){var _0x2a4b8b={};_0x2a4b8b[_0x47f05e]={'$like':'%'+_0x151fae[_0x9762('0x37')][_0x9762('0x41')]+'%'};return _0x2a4b8b;})});}_0x3a2a2c=_[_0x9762('0x44')]({},_0x3a2a2c,_0x151fae[_0x9762('0x45')]);return _0x3d4ff8[_0x9762('0x6b')](_0x3a2a2c);}})['then'](respondWithResult(_0x303e44,null))[_0x9762('0x49')](handleError(_0x303e44,null));};exports[_0x9762('0x6d')]=function(_0x245bb1,_0x6f99fb,_0x452680){var _0x29e598;return db[_0x9762('0x32')][_0x9762('0x51')]({'where':{'id':_0x245bb1['params']['id']},'include':[{'model':db[_0x9762('0x6e')],'as':'CustomFields'}]})[_0x9762('0x26')](handleEntityNotFound(_0x6f99fb,null))['then'](function(_0x91fb59){if(_0x91fb59){_0x29e598=_0x91fb59;return db['CmContact'][_0x9762('0x33')];}})[_0x9762('0x26')](function(_0x3b1db5){if(_0x3b1db5){var _0x3cd944={};var _0x5181a0={};_0x5181a0[_0x9762('0x35')]=_[_0x9762('0x6f')](_[_0x9762('0x36')](_0x3b1db5),_['map'](_0x29e598['CustomFields'],function(_0x115886){return util[_0x9762('0x70')](_0x9762('0x71'),_0x115886['id']);}));_0x5181a0['query']=_[_0x9762('0x36')](_0x245bb1[_0x9762('0x37')]);_0x5181a0[_0x9762('0x38')]=_[_0x9762('0x39')](_0x5181a0['model'],_0x5181a0[_0x9762('0x37')]);_0x3cd944[_0x9762('0x3a')]=_['intersection'](_0x5181a0[_0x9762('0x35')],qs[_0x9762('0x3b')](_0x245bb1[_0x9762('0x37')]['fields']));_0x3cd944[_0x9762('0x3a')]=_0x3cd944[_0x9762('0x3a')][_0x9762('0x3c')]?_0x3cd944['attributes']:_0x5181a0[_0x9762('0x35')];if(!_0x245bb1[_0x9762('0x37')]['hasOwnProperty']('nolimit')){_0x3cd944['limit']=qs[_0x9762('0x3e')](_0x245bb1['query'][_0x9762('0x3e')]);_0x3cd944[_0x9762('0x1f')]=qs[_0x9762('0x1f')](_0x245bb1['query']['offset']);}_0x3cd944[_0x9762('0x5a')]=qs[_0x9762('0x3f')](_0x245bb1[_0x9762('0x37')][_0x9762('0x3f')]);_0x3cd944[_0x9762('0x42')]=qs[_0x9762('0x38')](_['pick'](_0x245bb1['query'],_0x5181a0['filters']));_0x3cd944[_0x9762('0x72')]=!![];if(_0x245bb1['query'][_0x9762('0x41')]){_0x3cd944['where']=_[_0x9762('0x44')](_0x3cd944[_0x9762('0x42')],{'$or':_['map'](_0x3cd944[_0x9762('0x3a')],function(_0x4ef91d){var _0x4fe3cb={};_0x4fe3cb[_0x4ef91d]={'$like':'%'+_0x245bb1[_0x9762('0x37')][_0x9762('0x41')]+'%'};return _0x4fe3cb;})});}_0x3cd944=_[_0x9762('0x44')]({},_0x3cd944,_0x245bb1[_0x9762('0x45')]);return _0x29e598[_0x9762('0x6b')](_0x3cd944);}})['then'](function(_0x106838){if(!_[_0x9762('0x73')](_0x106838)){var _0x5cb392=toCsv(_0x106838);var _0x444230=Date[_0x9762('0x74')]();fs['writeFileSync'](util['format'](_0x9762('0x75'),_0x29e598['id'],_0x444230),_0x5cb392);_0x6f99fb['setHeader'](_0x9762('0x76'),'attachment;\x20filename='+util[_0x9762('0x70')]('list_%d_%s.csv',_0x29e598['id'],_0x444230));_0x6f99fb[_0x9762('0x77')](_0x9762('0x78'),_0x9762('0x79'));return _0x6f99fb[_0x9762('0x7a')](util[_0x9762('0x70')](_0x9762('0x75'),_0x29e598['id'],_0x444230));}else{return _0x6f99fb[_0x9762('0x1b')](0xcc);}})[_0x9762('0x49')](handleError(_0x6f99fb,null));};exports[_0x9762('0x7b')]=function(_0x17c4a2,_0x3e2a85,_0x5d04f7){var _0x409e66;delete _0x17c4a2[_0x9762('0x4c')]['id'];return db[_0x9762('0x32')]['findOne']({'where':{'id':_0x17c4a2['params']['id']}})[_0x9762('0x26')](handleEntityNotFound(_0x3e2a85,null))[_0x9762('0x26')](function(_0x29e679){if(_0x29e679){return db[_0x9762('0x7c')][_0x9762('0x7d')](function(_0x48a1ca){return db[_0x9762('0x6e')][_0x9762('0x4b')](_0x17c4a2['body'],{'transaction':_0x48a1ca})[_0x9762('0x26')](function(_0x5203ca){_0x409e66=_0x5203ca;return _0x29e679[_0x9762('0x7e')](_0x5203ca,{'transaction':_0x48a1ca});})[_0x9762('0x26')](function(){var _0x5eb315={'type':db[_0x9762('0x7f')][_0x9762('0x80')],'transaction':_0x48a1ca};switch(_0x17c4a2[_0x9762('0x4c')][_0x9762('0x34')]){case _0x9762('0x81'):_0x5eb315['type']=db[_0x9762('0x7f')][_0x9762('0x80')];break;case'number':_0x5eb315[_0x9762('0x34')]=db[_0x9762('0x7f')][_0x9762('0x82')];break;case _0x9762('0x83'):_0x5eb315[_0x9762('0x34')]=db[_0x9762('0x7f')][_0x9762('0x84')];_0x5eb315['defaultValue']=![];break;default:}return db['sequelize'][_0x9762('0x85')][_0x9762('0x86')](_0x9762('0x87'),util[_0x9762('0x70')](_0x9762('0x88'),_0x409e66['id']),_0x5eb315);})[_0x9762('0x26')](function(){return _0x409e66;});});}})[_0x9762('0x26')](respondWithResult(_0x3e2a85,null))[_0x9762('0x49')](handleError(_0x3e2a85,null));};exports[_0x9762('0x89')]=function(_0x373935,_0x43a468,_0x3a292d){var _0x49a3d3={};var _0x4efcba={};var _0x6e0bcc;var _0x4acf44;return db[_0x9762('0x32')]['findOne']({'where':{'id':_0x373935[_0x9762('0x54')]['id']}})['then'](handleEntityNotFound(_0x43a468,null))[_0x9762('0x26')](function(_0x14ac86){if(_0x14ac86){_0x6e0bcc=_0x14ac86;_0x4efcba['model']=_[_0x9762('0x36')](db[_0x9762('0x6e')][_0x9762('0x33')]);_0x4efcba[_0x9762('0x37')]=_[_0x9762('0x36')](_0x373935[_0x9762('0x37')]);_0x4efcba[_0x9762('0x38')]=_['intersection'](_0x4efcba['model'],_0x4efcba[_0x9762('0x37')]);_0x49a3d3[_0x9762('0x3a')]=_[_0x9762('0x39')](_0x4efcba[_0x9762('0x35')],qs[_0x9762('0x3b')](_0x373935['query'][_0x9762('0x3b')]));_0x49a3d3[_0x9762('0x3a')]=_0x49a3d3[_0x9762('0x3a')]['length']?_0x49a3d3['attributes']:_0x4efcba[_0x9762('0x35')];_0x49a3d3['order']=qs[_0x9762('0x3f')](_0x373935[_0x9762('0x37')][_0x9762('0x3f')]);_0x49a3d3[_0x9762('0x42')]=qs['filters'](_[_0x9762('0x40')](_0x373935[_0x9762('0x37')],_0x4efcba['filters']));_0x49a3d3['where']=_[_0x9762('0x44')](_0x49a3d3[_0x9762('0x42')],{'$or':[{'ListId':_0x14ac86['id']},{'ListId':null}]});if(_0x373935[_0x9762('0x37')][_0x9762('0x41')]){_0x49a3d3[_0x9762('0x42')]=_[_0x9762('0x44')](_0x49a3d3[_0x9762('0x42')],{'$or':_[_0x9762('0x31')](_0x49a3d3['attributes'],function(_0x1381d9){var _0x272775={};_0x272775[_0x1381d9]={'$like':'%'+_0x373935['query']['filter']+'%'};return _0x272775;})});}_0x49a3d3=_[_0x9762('0x44')]({},_0x49a3d3,_0x373935['options']);return db[_0x9762('0x6e')][_0x9762('0x8a')](_0x49a3d3);}})[_0x9762('0x26')](respondWithResult(_0x43a468,null))[_0x9762('0x49')](handleError(_0x43a468,null));};exports[_0x9762('0x8b')]=function(_0x7190c2,_0x45e4e0,_0x2f79fa){return db[_0x9762('0x32')]['find']({'where':{'id':_0x7190c2[_0x9762('0x54')]['id']}})[_0x9762('0x26')](handleEntityNotFound(_0x45e4e0,null))[_0x9762('0x26')](function(_0x2794e3){if(_0x2794e3){return _0x2794e3[_0x9762('0x8b')](_0x7190c2[_0x9762('0x4c')]['ids'],_[_0x9762('0x65')](_0x7190c2[_0x9762('0x4c')],['ids','id'])||{})[_0x9762('0x8c')](function(_0x2a7f94){for(var _0x4158d5=0x0;_0x4158d5<_0x7190c2[_0x9762('0x4c')][_0x9762('0x5d')][_0x9762('0x3c')];_0x4158d5+=0x1){socket[_0x9762('0x8d')]('userCmList:save',{'UserId':_0x7190c2[_0x9762('0x4c')][_0x9762('0x5d')][_0x4158d5],'CmListId':_0x7190c2[_0x9762('0x54')]['id']});}return _0x2a7f94;});}})[_0x9762('0x26')](respondWithResult(_0x45e4e0,null))[_0x9762('0x49')](handleError(_0x45e4e0,null));};exports[_0x9762('0x8e')]=function(_0x24dd27,_0x311994,_0x9e2820){return db[_0x9762('0x32')][_0x9762('0x51')]({'where':{'id':_0x24dd27['params']['id']}})[_0x9762('0x26')](handleEntityNotFound(_0x311994,null))['then'](function(_0x20e3cf){if(_0x20e3cf){return _0x20e3cf[_0x9762('0x8e')](_0x24dd27['query'][_0x9762('0x5d')])[_0x9762('0x26')](function(){if(_[_0x9762('0x61')](_0x24dd27[_0x9762('0x37')]['ids'])){for(var _0x390314=0x0;_0x390314<_0x24dd27['query'][_0x9762('0x5d')]['length'];_0x390314+=0x1){socket[_0x9762('0x8d')](_0x9762('0x8f'),{'UserId':Number(_0x24dd27[_0x9762('0x37')][_0x9762('0x5d')][_0x390314]),'CmListId':Number(_0x24dd27[_0x9762('0x54')]['id'])});}}else{socket[_0x9762('0x8d')](_0x9762('0x8f'),{'UserId':Number(_0x24dd27[_0x9762('0x37')][_0x9762('0x5d')]),'CmListId':Number(_0x24dd27['params']['id'])});}});}})['then'](respondWithStatusCode(_0x311994,null))['catch'](handleError(_0x311994,null));};exports[_0x9762('0x90')]=function(_0x1fcc8f,_0x440bf7,_0x52512b){var _0x2ecb3d={};var _0x9007f4={};var _0x595617;var _0x6c9bbe;return db['CmList'][_0x9762('0x91')]({'where':{'id':_0x1fcc8f[_0x9762('0x54')]['id']}})[_0x9762('0x26')](handleEntityNotFound(_0x440bf7,null))['then'](function(_0x1e601a){if(_0x1e601a){_0x595617=_0x1e601a;_0x9007f4[_0x9762('0x35')]=_[_0x9762('0x36')](db[_0x9762('0x92')]['rawAttributes']);_0x9007f4[_0x9762('0x37')]=_[_0x9762('0x36')](_0x1fcc8f[_0x9762('0x37')]);_0x9007f4[_0x9762('0x38')]=_[_0x9762('0x39')](_0x9007f4[_0x9762('0x35')],_0x9007f4[_0x9762('0x37')]);_0x2ecb3d['attributes']=_[_0x9762('0x39')](_0x9007f4['model'],qs[_0x9762('0x3b')](_0x1fcc8f['query']['fields']));_0x2ecb3d[_0x9762('0x3a')]=_0x2ecb3d[_0x9762('0x3a')][_0x9762('0x3c')]?_0x2ecb3d[_0x9762('0x3a')]:_0x9007f4[_0x9762('0x35')];_0x2ecb3d[_0x9762('0x5a')]=qs[_0x9762('0x3f')](_0x1fcc8f['query']['sort']);_0x2ecb3d[_0x9762('0x42')]=qs[_0x9762('0x38')](_[_0x9762('0x40')](_0x1fcc8f['query'],_0x9007f4[_0x9762('0x38')]));if(_0x1fcc8f[_0x9762('0x37')][_0x9762('0x41')]){_0x2ecb3d[_0x9762('0x42')]=_['merge'](_0x2ecb3d[_0x9762('0x42')],{'$or':_[_0x9762('0x31')](_0x2ecb3d['attributes'],function(_0x2960ce){var _0x597079={};_0x597079[_0x2960ce]={'$like':'%'+_0x1fcc8f[_0x9762('0x37')][_0x9762('0x41')]+'%'};return _0x597079;})});}_0x2ecb3d=_[_0x9762('0x44')]({},_0x2ecb3d,_0x1fcc8f[_0x9762('0x45')]);return _0x595617[_0x9762('0x90')](_0x2ecb3d);}})[_0x9762('0x26')](function(_0x41f7cc){if(_0x41f7cc){_0x6c9bbe=_0x41f7cc[_0x9762('0x3c')];if(!_0x1fcc8f['query'][_0x9762('0x59')]('nolimit')){_0x2ecb3d[_0x9762('0x3e')]=qs[_0x9762('0x3e')](_0x1fcc8f['query'][_0x9762('0x3e')]);_0x2ecb3d[_0x9762('0x1f')]=qs['offset'](_0x1fcc8f[_0x9762('0x37')][_0x9762('0x1f')]);}return _0x595617[_0x9762('0x90')](_0x2ecb3d);}})['then'](function(_0x14e037){if(_0x14e037){return _0x14e037?{'count':_0x6c9bbe,'rows':_0x14e037}:null;}})['then'](respondWithResult(_0x440bf7,null))[_0x9762('0x49')](handleError(_0x440bf7,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4b8f939..28a9f80 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 _0xb770=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1ce349,_0x500268){var _0x594c8d=function(_0x87218b){while(--_0x87218b){_0x1ce349['push'](_0x1ce349['shift']());}};_0x594c8d(++_0x500268);}(_0xb770,0x7d));var _0x0b77=function(_0xcddd5c,_0x58d80d){_0xcddd5c=_0xcddd5c-0x0;var _0x3834ec=_0xb770[_0xcddd5c];return _0x3834ec;};'use strict';var EventEmitter=require(_0x0b77('0x0'));var CmList=require(_0x0b77('0x1'))['db'][_0x0b77('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b77('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c7d4c){return function(_0x168027,_0x15c164,_0x2b86d5){CmListEvents[_0x0b77('0x4')](_0x5c7d4c+':'+_0x168027['id'],_0x168027);CmListEvents['emit'](_0x5c7d4c,_0x168027);_0x2b86d5(null);};}for(var e in events){if(events[_0x0b77('0x5')](e)){var event=events[e];CmList[_0x0b77('0x6')](e,emitEvent(event));}}module[_0x0b77('0x7')]=CmListEvents; \ No newline at end of file +var _0x3775=['CmList','setMaxListeners','save','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x207482,_0x19d63e){var _0x2e5bcc=function(_0xc23c21){while(--_0xc23c21){_0x207482['push'](_0x207482['shift']());}};_0x2e5bcc(++_0x19d63e);}(_0x3775,0x7c));var _0x5377=function(_0xc49092,_0x51d14c){_0xc49092=_0xc49092-0x0;var _0xa47eb1=_0x3775[_0xc49092];return _0xa47eb1;};'use strict';var EventEmitter=require(_0x5377('0x0'));var CmList=require(_0x5377('0x1'))['db'][_0x5377('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x5377('0x3')](0x0);var events={'afterCreate':_0x5377('0x4'),'afterUpdate':_0x5377('0x5'),'afterDestroy':_0x5377('0x6')};function emitEvent(_0x3c194){return function(_0x3ed632,_0x16160b,_0x14debc){CmListEvents['emit'](_0x3c194+':'+_0x3ed632['id'],_0x3ed632);CmListEvents['emit'](_0x3c194,_0x3ed632);_0x14debc(null);};}for(var e in events){if(events[_0x5377('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x5377('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 8481427..62ce684 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 _0xcb9f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','CmList','cm_lists','lodash','util','../../config/logger','api'];(function(_0x3cbcc4,_0x4ee066){var _0x485726=function(_0x4c24e8){while(--_0x4c24e8){_0x3cbcc4['push'](_0x3cbcc4['shift']());}};_0x485726(++_0x4ee066);}(_0xcb9f,0xea));var _0xfcb9=function(_0x2b14af,_0x4d4768){_0x2b14af=_0x2b14af-0x0;var _0x369a81=_0xcb9f[_0x2b14af];return _0x369a81;};'use strict';var _=require(_0xfcb9('0x0'));var util=require(_0xfcb9('0x1'));var logger=require(_0xfcb9('0x2'))(_0xfcb9('0x3'));var moment=require(_0xfcb9('0x4'));var BPromise=require(_0xfcb9('0x5'));var rp=require(_0xfcb9('0x6'));var fs=require('fs');var path=require(_0xfcb9('0x7'));var rimraf=require(_0xfcb9('0x8'));var config=require(_0xfcb9('0x9'));var attributes=require(_0xfcb9('0xa'));module[_0xfcb9('0xb')]=function(_0x42d3af,_0x497a97){return _0x42d3af['define'](_0xfcb9('0xc'),attributes,{'tableName':_0xfcb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36eb=['./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4d65c9,_0x1c9ee5){var _0x4d5311=function(_0x539574){while(--_0x539574){_0x4d65c9['push'](_0x4d65c9['shift']());}};_0x4d5311(++_0x1c9ee5);}(_0x36eb,0x1b1));var _0xb36e=function(_0x509624,_0x975831){_0x509624=_0x509624-0x0;var _0x14195f=_0x36eb[_0x509624];return _0x14195f;};'use strict';var _=require(_0xb36e('0x0'));var util=require(_0xb36e('0x1'));var logger=require(_0xb36e('0x2'))(_0xb36e('0x3'));var moment=require(_0xb36e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb36e('0x5'));var fs=require('fs');var path=require(_0xb36e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb36e('0x7'));module[_0xb36e('0x8')]=function(_0x187840,_0x4cfd15){return _0x187840[_0xb36e('0x9')](_0xb36e('0xa'),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 2696630..315eb96 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 _0xdd71=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x38f331,_0x59703e){var _0x3c8992=function(_0x2fd812){while(--_0x2fd812){_0x38f331['push'](_0x38f331['shift']());}};_0x3c8992(++_0x59703e);}(_0xdd71,0xcb));var _0x1dd7=function(_0x12e8f1,_0x17dc7b){_0x12e8f1=_0x12e8f1-0x0;var _0x53ac26=_0xdd71[_0x12e8f1];return _0x53ac26;};'use strict';var _=require(_0x1dd7('0x0'));var util=require(_0x1dd7('0x1'));var moment=require(_0x1dd7('0x2'));var BPromise=require(_0x1dd7('0x3'));var rs=require(_0x1dd7('0x4'));var fs=require('fs');var Redis=require(_0x1dd7('0x5'));var db=require(_0x1dd7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1dd7('0x7'));var config=require(_0x1dd7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x1dd7('0x9')]=_[_0x1dd7('0xa')](config[_0x1dd7('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1dd7('0x9')]));require(_0x1dd7('0xb'))[_0x1dd7('0xc')](socket);function respondWithRpcPromise(_0x592c11,_0x219f85,_0x3a15f4){return new BPromise(function(_0x443c3b,_0x246504){return client[_0x1dd7('0xd')](_0x592c11,_0x3a15f4)[_0x1dd7('0xe')](function(_0x1b94ed){logger[_0x1dd7('0xf')](_0x1dd7('0x10'),_0x219f85,_0x1dd7('0x11'));logger[_0x1dd7('0x12')](_0x1dd7('0x13'),_0x219f85,_0x1dd7('0x11'),JSON[_0x1dd7('0x14')](_0x1b94ed));if(_0x1b94ed['error']){if(_0x1b94ed[_0x1dd7('0x15')][_0x1dd7('0x16')]===0x1f4){logger['error'](_0x1dd7('0x10'),_0x219f85,_0x1b94ed[_0x1dd7('0x15')]['message']);return _0x246504(_0x1b94ed[_0x1dd7('0x15')][_0x1dd7('0x17')]);}logger[_0x1dd7('0x15')](_0x1dd7('0x10'),_0x219f85,_0x1b94ed[_0x1dd7('0x15')][_0x1dd7('0x17')]);return _0x443c3b(_0x1b94ed[_0x1dd7('0x15')][_0x1dd7('0x17')]);}else{logger[_0x1dd7('0xf')](_0x1dd7('0x10'),_0x219f85,_0x1dd7('0x11'));_0x443c3b(_0x1b94ed[_0x1dd7('0x18')][_0x1dd7('0x17')]);}})['catch'](function(_0x4c3c0b){logger[_0x1dd7('0x15')](_0x1dd7('0x10'),_0x219f85,_0x4c3c0b);_0x246504(_0x4c3c0b);});});} \ No newline at end of file +var _0xc653=['request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0xc653,0x1c8));var _0x3c65=function(_0x1df871,_0x5ae902){_0x1df871=_0x1df871-0x0;var _0x5fadb9=_0xc653[_0x1df871];return _0x5fadb9;};'use strict';var _=require(_0x3c65('0x0'));var util=require(_0x3c65('0x1'));var moment=require(_0x3c65('0x2'));var BPromise=require(_0x3c65('0x3'));var rs=require(_0x3c65('0x4'));var fs=require('fs');var Redis=require(_0x3c65('0x5'));var db=require(_0x3c65('0x6'))['db'];var utils=require(_0x3c65('0x7'));var logger=require(_0x3c65('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c65('0x9'));var client=jayson[_0x3c65('0xa')]['http']({'port':0x232a});config[_0x3c65('0xb')]=_[_0x3c65('0xc')](config[_0x3c65('0xb')],{'host':_0x3c65('0xd'),'port':0x18eb});var socket=require(_0x3c65('0xe'))(new Redis(config[_0x3c65('0xb')]));require('./cmList.socket')[_0x3c65('0xf')](socket);function respondWithRpcPromise(_0xaae8ce,_0x411bdf,_0x2fb840){return new BPromise(function(_0xd0f510,_0xdc3509){return client[_0x3c65('0x10')](_0xaae8ce,_0x2fb840)[_0x3c65('0x11')](function(_0x5ba2ab){logger[_0x3c65('0x12')](_0x3c65('0x13'),_0x411bdf,_0x3c65('0x14'));logger['debug'](_0x3c65('0x15'),_0x411bdf,_0x3c65('0x14'),JSON[_0x3c65('0x16')](_0x5ba2ab));if(_0x5ba2ab[_0x3c65('0x17')]){if(_0x5ba2ab[_0x3c65('0x17')][_0x3c65('0x18')]===0x1f4){logger[_0x3c65('0x17')]('CmList,\x20%s,\x20%s',_0x411bdf,_0x5ba2ab[_0x3c65('0x17')][_0x3c65('0x19')]);return _0xdc3509(_0x5ba2ab['error'][_0x3c65('0x19')]);}logger[_0x3c65('0x17')](_0x3c65('0x13'),_0x411bdf,_0x5ba2ab[_0x3c65('0x17')][_0x3c65('0x19')]);return _0xd0f510(_0x5ba2ab[_0x3c65('0x17')][_0x3c65('0x19')]);}else{logger['info'](_0x3c65('0x13'),_0x411bdf,_0x3c65('0x14'));_0xd0f510(_0x5ba2ab[_0x3c65('0x1a')]['message']);}})[_0x3c65('0x1b')](function(_0x513e2b){logger[_0x3c65('0x17')]('CmList,\x20%s,\x20%s',_0x411bdf,_0x513e2b);_0xdc3509(_0x513e2b);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e4dcc18..9bb85ce 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 _0x06f4=['register','cmList:','./cmList.events','save','update','emit','removeListener'];(function(_0x26ad97,_0x395cdd){var _0x5f38fa=function(_0x3c9786){while(--_0x3c9786){_0x26ad97['push'](_0x26ad97['shift']());}};_0x5f38fa(++_0x395cdd);}(_0x06f4,0x136));var _0x406f=function(_0x298fbc,_0x2a3939){_0x298fbc=_0x298fbc-0x0;var _0x27fb27=_0x06f4[_0x298fbc];return _0x27fb27;};'use strict';var CmListEvents=require(_0x406f('0x0'));var events=[_0x406f('0x1'),'remove',_0x406f('0x2')];function createListener(_0x276a15,_0x58cd7d){return function(_0x5cab5e){_0x58cd7d[_0x406f('0x3')](_0x276a15,_0x5cab5e);};}function removeListener(_0x5ed32f,_0x32abfd){return function(){CmListEvents[_0x406f('0x4')](_0x5ed32f,_0x32abfd);};}exports[_0x406f('0x5')]=function(_0x32b2bd){for(var _0x59821c=0x0,_0x1d2886=events['length'];_0x59821c<_0x1d2886;_0x59821c++){var _0x1afec4=events[_0x59821c];var _0x1c39ce=createListener(_0x406f('0x6')+_0x1afec4,_0x32b2bd);CmListEvents['on'](_0x1afec4,_0x1c39ce);}}; \ No newline at end of file +var _0xa381=['cmList:','./cmList.events','save','removeListener','register'];(function(_0x333592,_0x1715bb){var _0x58f133=function(_0x935ca5){while(--_0x935ca5){_0x333592['push'](_0x333592['shift']());}};_0x58f133(++_0x1715bb);}(_0xa381,0x79));var _0x1a38=function(_0x563512,_0x2f0c90){_0x563512=_0x563512-0x0;var _0xf9375c=_0xa381[_0x563512];return _0xf9375c;};'use strict';var CmListEvents=require(_0x1a38('0x0'));var events=[_0x1a38('0x1'),'remove','update'];function createListener(_0x41cdc2,_0xe2d8b3){return function(_0x2a069e){_0xe2d8b3['emit'](_0x41cdc2,_0x2a069e);};}function removeListener(_0x2a4353,_0x6cbf3){return function(){CmListEvents[_0x1a38('0x2')](_0x2a4353,_0x6cbf3);};}exports[_0x1a38('0x3')]=function(_0x4bb44f){for(var _0x411f6a=0x0,_0x569e9f=events['length'];_0x411f6a<_0x569e9f;_0x411f6a++){var _0x3d12f8=events[_0x411f6a];var _0x4df1db=createListener(_0x1a38('0x4')+_0x3d12f8,_0x4bb44f);CmListEvents['on'](_0x3d12f8,_0x4df1db);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9f47152..40019ad 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 _0xdcd0=['getCustomFields','/:id/users','getAgents','post','create','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getDispositions','getContacts','getContactsCsv','/:id/fields'];(function(_0x2a8d42,_0x204f88){var _0x5dce8d=function(_0x4bd731){while(--_0x4bd731){_0x2a8d42['push'](_0x2a8d42['shift']());}};_0x5dce8d(++_0x204f88);}(_0xdcd0,0x18e));var _0x0dcd=function(_0x49d7f3,_0x40da1b){_0x49d7f3=_0x49d7f3-0x0;var _0x318a77=_0xdcd0[_0x49d7f3];return _0x318a77;};'use strict';var multer=require(_0x0dcd('0x0'));var util=require(_0x0dcd('0x1'));var path=require(_0x0dcd('0x2'));var timeout=require('connect-timeout');var express=require(_0x0dcd('0x3'));var router=express[_0x0dcd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0dcd('0x5'));var config=require(_0x0dcd('0x6'));var controller=require(_0x0dcd('0x7'));router['get']('/',auth[_0x0dcd('0x8')](),controller['index']);router[_0x0dcd('0x9')](_0x0dcd('0xa'),auth[_0x0dcd('0x8')](),controller['describe']);router['get'](_0x0dcd('0xb'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0xc')]);router[_0x0dcd('0x9')](_0x0dcd('0xd'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0xe')]);router[_0x0dcd('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x0dcd('0xf')]);router[_0x0dcd('0x9')]('/:id/contacts/csv',auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x10')]);router[_0x0dcd('0x9')](_0x0dcd('0x11'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x12')]);router[_0x0dcd('0x9')](_0x0dcd('0x13'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x14')]);router[_0x0dcd('0x15')]('/',auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x16')]);router['post'](_0x0dcd('0xd'),auth[_0x0dcd('0x8')](),controller['addDisposition']);router[_0x0dcd('0x15')]('/:id/contacts',auth[_0x0dcd('0x8')](),controller['addContacts']);router['post']('/:id/fields',auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x17')]);router['post'](_0x0dcd('0x13'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x18')]);router[_0x0dcd('0x19')](_0x0dcd('0xb'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x1a')]);router['delete'](_0x0dcd('0xb'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x1b')]);router[_0x0dcd('0x1c')](_0x0dcd('0xd'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x1d')]);router[_0x0dcd('0x1c')](_0x0dcd('0x13'),auth['isAuthenticated'](),controller[_0x0dcd('0x1e')]);module[_0x0dcd('0x1f')]=router; \ No newline at end of file +var _0x80c3=['../../components/interaction/service','isAuthenticated','/describe','describe','/:id','get','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','post','addDisposition','addCustomField','put','update','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','connect-timeout','Router','../../components/auth/service'];(function(_0x1e654a,_0x1fe0e8){var _0x3dcf87=function(_0x30a09a){while(--_0x30a09a){_0x1e654a['push'](_0x1e654a['shift']());}};_0x3dcf87(++_0x1fe0e8);}(_0x80c3,0x18f));var _0x380c=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x80c3[_0x146a97];return _0x259d5c;};'use strict';var multer=require(_0x380c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x380c('0x1'));var express=require('express');var router=express[_0x380c('0x2')]();var auth=require(_0x380c('0x3'));var interaction=require(_0x380c('0x4'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x380c('0x5')](),controller['index']);router['get'](_0x380c('0x6'),auth[_0x380c('0x5')](),controller[_0x380c('0x7')]);router['get'](_0x380c('0x8'),auth[_0x380c('0x5')](),controller['show']);router[_0x380c('0x9')](_0x380c('0xa'),auth['isAuthenticated'](),controller[_0x380c('0xb')]);router[_0x380c('0x9')](_0x380c('0xc'),auth['isAuthenticated'](),controller[_0x380c('0xd')]);router[_0x380c('0x9')](_0x380c('0xe'),auth[_0x380c('0x5')](),controller[_0x380c('0xf')]);router[_0x380c('0x9')](_0x380c('0x10'),auth[_0x380c('0x5')](),controller[_0x380c('0x11')]);router[_0x380c('0x9')]('/:id/users',auth[_0x380c('0x5')](),controller[_0x380c('0x12')]);router['post']('/',auth[_0x380c('0x5')](),controller[_0x380c('0x13')]);router[_0x380c('0x14')](_0x380c('0xa'),auth[_0x380c('0x5')](),controller[_0x380c('0x15')]);router[_0x380c('0x14')](_0x380c('0xc'),auth[_0x380c('0x5')](),controller['addContacts']);router[_0x380c('0x14')]('/:id/fields',auth['isAuthenticated'](),controller[_0x380c('0x16')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x380c('0x17')](_0x380c('0x8'),auth[_0x380c('0x5')](),controller[_0x380c('0x18')]);router[_0x380c('0x19')](_0x380c('0x8'),auth[_0x380c('0x5')](),controller[_0x380c('0x1a')]);router[_0x380c('0x19')](_0x380c('0xa'),auth[_0x380c('0x5')](),controller[_0x380c('0x1b')]);router[_0x380c('0x19')](_0x380c('0x1c'),auth[_0x380c('0x5')](),controller[_0x380c('0x1d')]);module[_0x380c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4ec3589..98bdb3e 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(_0x593e2f,_0x17c8a6){var _0x20f714=function(_0x4a9ea2){while(--_0x4a9ea2){_0x593e2f['push'](_0x593e2f['shift']());}};_0x20f714(++_0x17c8a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xca3cf4,_0x578044){var _0x120666=function(_0x446f1a){while(--_0x446f1a){_0xca3cf4['push'](_0xca3cf4['shift']());}};_0x120666(++_0x578044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index c105a95..3998a9b 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 _0xcf4a=['../../config/utils','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','body','Condition','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x137581,_0x43955c){var _0x25281e=function(_0x48d2e2){while(--_0x48d2e2){_0x137581['push'](_0x137581['shift']());}};_0x25281e(++_0x43955c);}(_0xcf4a,0x14c));var _0xacf4=function(_0x4743cb,_0x1ea053){_0x4743cb=_0x4743cb-0x0;var _0x2f6585=_0xcf4a[_0x4743cb];return _0x2f6585;};'use strict';var pdf=require(_0xacf4('0x0'));var emlformat=require(_0xacf4('0x1'));var rimraf=require(_0xacf4('0x2'));var zipdir=require(_0xacf4('0x3'));var jsonpatch=require(_0xacf4('0x4'));var rp=require(_0xacf4('0x5'));var moment=require(_0xacf4('0x6'));var BPromise=require(_0xacf4('0x7'));var Mustache=require('mustache');var util=require(_0xacf4('0x8'));var path=require(_0xacf4('0x9'));var sox=require('sox');var csv=require(_0xacf4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xacf4('0xb'));var squel=require(_0xacf4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xacf4('0xd'));var toCsv=require(_0xacf4('0xa'));var querystring=require('querystring');var Papa=require(_0xacf4('0xe'));var Redis=require(_0xacf4('0xf'));var authService=require(_0xacf4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xacf4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacf4('0x12'))(_0xacf4('0x13'));var utils=require(_0xacf4('0x14'));var config=require('../../config/environment');var db=require(_0xacf4('0x15'))['db'];function respondWithStatusCode(_0x148090,_0x5b6e47){_0x5b6e47=_0x5b6e47||0xcc;return function(_0x17e957){if(_0x17e957){return _0x148090['sendStatus'](_0x5b6e47);}return _0x148090[_0xacf4('0x16')](_0x5b6e47)[_0xacf4('0x17')]();};}function respondWithResult(_0x57def1,_0x2e3baa){_0x2e3baa=_0x2e3baa||0xc8;return function(_0x16b4b8){if(_0x16b4b8){return _0x57def1[_0xacf4('0x16')](_0x2e3baa)[_0xacf4('0x18')](_0x16b4b8);}};}function respondWithFilteredResult(_0x8e466c,_0x53f115){return function(_0x5b9cd6){if(_0x5b9cd6){var _0x15d39a=_0x5b9cd6[_0xacf4('0x19')],_0x44610f=_0x53f115['offset'],_0x109701=_0x53f115['offset']+_0x53f115[_0xacf4('0x1a')],_0x2f533f;if(_0x109701>=_0x15d39a){_0x109701=_0x15d39a;_0x2f533f=0xc8;}else{_0x2f533f=0xce;}_0x8e466c[_0xacf4('0x16')](_0x2f533f);return _0x8e466c[_0xacf4('0x1b')](_0xacf4('0x1c'),_0x44610f+'-'+_0x109701+'/'+_0x15d39a)[_0xacf4('0x18')](_0x5b9cd6);}return null;};}function patchUpdates(_0x277263){return function(_0x4e7cf9){try{jsonpatch[_0xacf4('0x1d')](_0x4e7cf9,_0x277263,!![]);}catch(_0x13b797){return BPromise['reject'](_0x13b797);}return _0x4e7cf9[_0xacf4('0x1e')]();};}function saveUpdates(_0x9955bd,_0x2c3b25){return function(_0x59c0c3){if(_0x59c0c3){return _0x59c0c3[_0xacf4('0x1f')](_0x9955bd)[_0xacf4('0x20')](function(_0x3aa45c){return _0x3aa45c;});}return null;};}function removeEntity(_0x5b451b,_0x4a0d37){return function(_0x47d284){if(_0x47d284){return _0x47d284[_0xacf4('0x21')]()[_0xacf4('0x20')](function(){_0x5b451b[_0xacf4('0x16')](0xcc)[_0xacf4('0x17')]();});}};}function handleEntityNotFound(_0x2e84c0,_0x5f2f43){return function(_0x844924){if(!_0x844924){_0x2e84c0[_0xacf4('0x22')](0x194);}return _0x844924;};}function handleError(_0x300765,_0x51438d){_0x51438d=_0x51438d||0x1f4;return function(_0x2baf52){logger[_0xacf4('0x23')](_0x2baf52[_0xacf4('0x24')]);if(_0x2baf52[_0xacf4('0x25')]){delete _0x2baf52[_0xacf4('0x25')];}_0x300765['status'](_0x51438d)[_0xacf4('0x26')](_0x2baf52);};}exports[_0xacf4('0x1f')]=function(_0x34ac10,_0x54ff2e){if(_0x34ac10[_0xacf4('0x27')]['id']){delete _0x34ac10[_0xacf4('0x27')]['id'];}return db[_0xacf4('0x28')][_0xacf4('0x29')]({'where':{'id':_0x34ac10['params']['id']}})[_0xacf4('0x20')](handleEntityNotFound(_0x54ff2e,null))[_0xacf4('0x20')](saveUpdates(_0x34ac10['body'],null))[_0xacf4('0x20')](respondWithResult(_0x54ff2e,null))[_0xacf4('0x2a')](handleError(_0x54ff2e,null));};exports[_0xacf4('0x21')]=function(_0x4f3db5,_0x298943){return db[_0xacf4('0x28')]['find']({'where':{'id':_0x4f3db5[_0xacf4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x298943,null))[_0xacf4('0x20')](removeEntity(_0x298943,null))[_0xacf4('0x2a')](handleError(_0x298943,null));}; \ No newline at end of file +var _0xa2b7=['desk.js','to-csv','papaparse','../../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','reject','save','update','destroy','then','error','name','send','body','params','catch','Condition','find','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xa2b7,0xd9));var _0x7a2b=function(_0x3ab596,_0x219a15){_0x3ab596=_0x3ab596-0x0;var _0x345992=_0xa2b7[_0x3ab596];return _0x345992;};'use strict';var pdf=require(_0x7a2b('0x0'));var emlformat=require(_0x7a2b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7a2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a2b('0x3'));var moment=require(_0x7a2b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a2b('0x5'));var util=require(_0x7a2b('0x6'));var path=require(_0x7a2b('0x7'));var sox=require(_0x7a2b('0x8'));var csv=require('to-csv');var ejs=require(_0x7a2b('0x9'));var fs=require('fs');var _=require(_0x7a2b('0xa'));var squel=require('squel');var crypto=require(_0x7a2b('0xb'));var jsforce=require(_0x7a2b('0xc'));var deskjs=require(_0x7a2b('0xd'));var toCsv=require(_0x7a2b('0xe'));var querystring=require('querystring');var Papa=require(_0x7a2b('0xf'));var Redis=require('ioredis');var authService=require(_0x7a2b('0x10'));var qs=require(_0x7a2b('0x11'));var as=require(_0x7a2b('0x12'));var hardwareService=require(_0x7a2b('0x13'));var logger=require(_0x7a2b('0x14'))(_0x7a2b('0x15'));var utils=require(_0x7a2b('0x16'));var config=require('../../config/environment');var db=require(_0x7a2b('0x17'))['db'];function respondWithStatusCode(_0x1acceb,_0x2b878a){_0x2b878a=_0x2b878a||0xcc;return function(_0x54cde1){if(_0x54cde1){return _0x1acceb[_0x7a2b('0x18')](_0x2b878a);}return _0x1acceb['status'](_0x2b878a)[_0x7a2b('0x19')]();};}function respondWithResult(_0x1e4d71,_0x532a8f){_0x532a8f=_0x532a8f||0xc8;return function(_0x3c03be){if(_0x3c03be){return _0x1e4d71[_0x7a2b('0x1a')](_0x532a8f)[_0x7a2b('0x1b')](_0x3c03be);}};}function respondWithFilteredResult(_0x53b5fc,_0x40d8eb){return function(_0x2c227d){if(_0x2c227d){var _0x107a4a=_0x2c227d[_0x7a2b('0x1c')],_0x158a1a=_0x40d8eb['offset'],_0x23faa4=_0x40d8eb[_0x7a2b('0x1d')]+_0x40d8eb[_0x7a2b('0x1e')],_0x1038ea;if(_0x23faa4>=_0x107a4a){_0x23faa4=_0x107a4a;_0x1038ea=0xc8;}else{_0x1038ea=0xce;}_0x53b5fc['status'](_0x1038ea);return _0x53b5fc[_0x7a2b('0x1f')](_0x7a2b('0x20'),_0x158a1a+'-'+_0x23faa4+'/'+_0x107a4a)[_0x7a2b('0x1b')](_0x2c227d);}return null;};}function patchUpdates(_0x2201c5){return function(_0x39e882){try{jsonpatch['apply'](_0x39e882,_0x2201c5,!![]);}catch(_0x19f22a){return BPromise[_0x7a2b('0x21')](_0x19f22a);}return _0x39e882[_0x7a2b('0x22')]();};}function saveUpdates(_0x37af13,_0x38b359){return function(_0x33df39){if(_0x33df39){return _0x33df39[_0x7a2b('0x23')](_0x37af13)['then'](function(_0x270419){return _0x270419;});}return null;};}function removeEntity(_0x4b4ca1,_0x558416){return function(_0x2bcc18){if(_0x2bcc18){return _0x2bcc18[_0x7a2b('0x24')]()[_0x7a2b('0x25')](function(){_0x4b4ca1['status'](0xcc)[_0x7a2b('0x19')]();});}};}function handleEntityNotFound(_0x407841,_0x3f93b4){return function(_0x447074){if(!_0x447074){_0x407841[_0x7a2b('0x18')](0x194);}return _0x447074;};}function handleError(_0x2dda29,_0x1be6e9){_0x1be6e9=_0x1be6e9||0x1f4;return function(_0x2cc955){logger[_0x7a2b('0x26')](_0x2cc955['stack']);if(_0x2cc955[_0x7a2b('0x27')]){delete _0x2cc955[_0x7a2b('0x27')];}_0x2dda29[_0x7a2b('0x1a')](_0x1be6e9)[_0x7a2b('0x28')](_0x2cc955);};}exports[_0x7a2b('0x23')]=function(_0x64ddaa,_0x4c0111){if(_0x64ddaa[_0x7a2b('0x29')]['id']){delete _0x64ddaa[_0x7a2b('0x29')]['id'];}return db['Condition']['find']({'where':{'id':_0x64ddaa[_0x7a2b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4c0111,null))['then'](saveUpdates(_0x64ddaa[_0x7a2b('0x29')],null))[_0x7a2b('0x25')](respondWithResult(_0x4c0111,null))[_0x7a2b('0x2b')](handleError(_0x4c0111,null));};exports[_0x7a2b('0x24')]=function(_0x3d6e42,_0x2318cf){return db[_0x7a2b('0x2c')][_0x7a2b('0x2d')]({'where':{'id':_0x3d6e42[_0x7a2b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2318cf,null))[_0x7a2b('0x25')](removeEntity(_0x2318cf,null))[_0x7a2b('0x2b')](handleError(_0x2318cf,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2ec27f3..273a127 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 _0x1acf=['request-promise','rimraf','exports','define','Condition','tools_conditions','lodash','api','moment','bluebird'];(function(_0xb7200a,_0x5c961a){var _0x56365f=function(_0x28855e){while(--_0x28855e){_0xb7200a['push'](_0xb7200a['shift']());}};_0x56365f(++_0x5c961a);}(_0x1acf,0x196));var _0xf1ac=function(_0x84827d,_0x4f5722){_0x84827d=_0x84827d-0x0;var _0x289cf9=_0x1acf[_0x84827d];return _0x289cf9;};'use strict';var _=require(_0xf1ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf1ac('0x1'));var moment=require(_0xf1ac('0x2'));var BPromise=require(_0xf1ac('0x3'));var rp=require(_0xf1ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1ac('0x5'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xf1ac('0x6')]=function(_0x130c29,_0x2199c4){return _0x130c29[_0xf1ac('0x7')](_0xf1ac('0x8'),attributes,{'tableName':_0xf1ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x975d=['rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions','util','bluebird','request-promise','path'];(function(_0x2897c4,_0x26be85){var _0x3adc0a=function(_0x6ddd79){while(--_0x6ddd79){_0x2897c4['push'](_0x2897c4['shift']());}};_0x3adc0a(++_0x26be85);}(_0x975d,0x176));var _0xd975=function(_0xa11ee1,_0xd2c2b0){_0xa11ee1=_0xa11ee1-0x0;var _0xa0b8c2=_0x975d[_0xa11ee1];return _0xa0b8c2;};'use strict';var _=require('lodash');var util=require(_0xd975('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd975('0x1'));var rp=require(_0xd975('0x2'));var fs=require('fs');var path=require(_0xd975('0x3'));var rimraf=require(_0xd975('0x4'));var config=require(_0xd975('0x5'));var attributes=require(_0xd975('0x6'));module['exports']=function(_0x5e6008,_0x1ba55d){return _0x5e6008['define'](_0xd975('0x7'),attributes,{'tableName':_0xd975('0x8'),'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 44196ef..f88433a 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 _0x36a7=['request','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x47d3a4,_0x5b1e1c){var _0x2650c5=function(_0x413d57){while(--_0x413d57){_0x47d3a4['push'](_0x47d3a4['shift']());}};_0x2650c5(++_0x5b1e1c);}(_0x36a7,0x8f));var _0x736a=function(_0x4371d1,_0x2ebab8){_0x4371d1=_0x4371d1-0x0;var _0x5d4993=_0x36a7[_0x4371d1];return _0x5d4993;};'use strict';var _=require(_0x736a('0x0'));var util=require(_0x736a('0x1'));var moment=require(_0x736a('0x2'));var BPromise=require(_0x736a('0x3'));var rs=require(_0x736a('0x4'));var fs=require('fs');var Redis=require(_0x736a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x736a('0x6'))(_0x736a('0x7'));var config=require('../../config/environment');var jayson=require(_0x736a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c6de1,_0x1ad234,_0x35560f){return new BPromise(function(_0xaea2fe,_0x4f8cbc){return client[_0x736a('0x9')](_0x4c6de1,_0x35560f)['then'](function(_0x2b9bd9){logger[_0x736a('0xa')](_0x736a('0xb'),_0x1ad234,'request\x20sent');logger['debug'](_0x736a('0xc'),_0x1ad234,_0x736a('0xd'),JSON[_0x736a('0xe')](_0x2b9bd9));if(_0x2b9bd9[_0x736a('0xf')]){if(_0x2b9bd9['error']['code']===0x1f4){logger[_0x736a('0xf')](_0x736a('0xb'),_0x1ad234,_0x2b9bd9['error'][_0x736a('0x10')]);return _0x4f8cbc(_0x2b9bd9[_0x736a('0xf')]['message']);}logger[_0x736a('0xf')]('Condition,\x20%s,\x20%s',_0x1ad234,_0x2b9bd9[_0x736a('0xf')][_0x736a('0x10')]);return _0xaea2fe(_0x2b9bd9[_0x736a('0xf')][_0x736a('0x10')]);}else{logger[_0x736a('0xa')](_0x736a('0xb'),_0x1ad234,_0x736a('0xd'));_0xaea2fe(_0x2b9bd9[_0x736a('0x11')]['message']);}})[_0x736a('0x12')](function(_0x1206cd){logger[_0x736a('0xf')](_0x736a('0xb'),_0x1ad234,_0x1206cd);_0x4f8cbc(_0x1206cd);});});} \ No newline at end of file +var _0xa0a5=['error','Condition,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','code'];(function(_0x1a8b06,_0x102854){var _0x4fbc6e=function(_0x4babf6){while(--_0x4babf6){_0x1a8b06['push'](_0x1a8b06['shift']());}};_0x4fbc6e(++_0x102854);}(_0xa0a5,0xb9));var _0x5a0a=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xa0a5[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x5a0a('0x0'));var util=require('util');var moment=require(_0x5a0a('0x1'));var BPromise=require(_0x5a0a('0x2'));var rs=require(_0x5a0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a0a('0x4'))['db'];var utils=require(_0x5a0a('0x5'));var logger=require(_0x5a0a('0x6'))('rpc');var config=require(_0x5a0a('0x7'));var jayson=require(_0x5a0a('0x8'));var client=jayson[_0x5a0a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x583240,_0x360132,_0x3d6442){return new BPromise(function(_0x587dd7,_0x503f5a){return client['request'](_0x583240,_0x3d6442)[_0x5a0a('0xa')](function(_0x2c06e5){logger[_0x5a0a('0xb')]('Condition,\x20%s,\x20%s',_0x360132,_0x5a0a('0xc'));logger['debug'](_0x5a0a('0xd'),_0x360132,_0x5a0a('0xc'),JSON['stringify'](_0x2c06e5));if(_0x2c06e5['error']){if(_0x2c06e5['error'][_0x5a0a('0xe')]===0x1f4){logger[_0x5a0a('0xf')]('Condition,\x20%s,\x20%s',_0x360132,_0x2c06e5[_0x5a0a('0xf')]['message']);return _0x503f5a(_0x2c06e5['error']['message']);}logger[_0x5a0a('0xf')](_0x5a0a('0x10'),_0x360132,_0x2c06e5[_0x5a0a('0xf')][_0x5a0a('0x11')]);return _0x587dd7(_0x2c06e5[_0x5a0a('0xf')][_0x5a0a('0x11')]);}else{logger[_0x5a0a('0xb')]('Condition,\x20%s,\x20%s',_0x360132,_0x5a0a('0xc'));_0x587dd7(_0x2c06e5[_0x5a0a('0x12')][_0x5a0a('0x11')]);}})[_0x5a0a('0x13')](function(_0xfff083){logger[_0x5a0a('0xf')]('Condition,\x20%s,\x20%s',_0x360132,_0xfff083);_0x503f5a(_0xfff083);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 55a8a34..0a166e1 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 _0xb555=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','exports','multer','connect-timeout','express'];(function(_0x520188,_0x174658){var _0x399ee2=function(_0x5c1dae){while(--_0x5c1dae){_0x520188['push'](_0x520188['shift']());}};_0x399ee2(++_0x174658);}(_0xb555,0x195));var _0x5b55=function(_0x1c77b2,_0x17b412){_0x1c77b2=_0x1c77b2-0x0;var _0x14df26=_0xb555[_0x1c77b2];return _0x14df26;};'use strict';var multer=require(_0x5b55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b55('0x1'));var express=require(_0x5b55('0x2'));var router=express[_0x5b55('0x3')]();var auth=require(_0x5b55('0x4'));var interaction=require(_0x5b55('0x5'));var config=require(_0x5b55('0x6'));var controller=require(_0x5b55('0x7'));router['put'](_0x5b55('0x8'),auth[_0x5b55('0x9')](),controller[_0x5b55('0xa')]);router['delete'](_0x5b55('0x8'),auth[_0x5b55('0x9')](),controller['destroy']);module[_0x5b55('0xb')]=router; \ No newline at end of file +var _0x11e8=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated'];(function(_0x4888e0,_0x35f563){var _0x346fee=function(_0x4bc27b){while(--_0x4bc27b){_0x4888e0['push'](_0x4888e0['shift']());}};_0x346fee(++_0x35f563);}(_0x11e8,0x65));var _0x811e=function(_0x24d273,_0x58ba6e){_0x24d273=_0x24d273-0x0;var _0x38b33f=_0x11e8[_0x24d273];return _0x38b33f;};'use strict';var multer=require(_0x811e('0x0'));var util=require(_0x811e('0x1'));var path=require(_0x811e('0x2'));var timeout=require(_0x811e('0x3'));var express=require(_0x811e('0x4'));var router=express[_0x811e('0x5')]();var auth=require(_0x811e('0x6'));var interaction=require(_0x811e('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x811e('0x8')](_0x811e('0x9'),auth[_0x811e('0xa')](),controller[_0x811e('0xb')]);router[_0x811e('0xc')](_0x811e('0x9'),auth[_0x811e('0xa')](),controller[_0x811e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 511f102..5a992b2 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cd3=['INTEGER','sequelize','STRING','name'];(function(_0x109dbd,_0x290d2b){var _0x395644=function(_0x5a8c2d){while(--_0x5a8c2d){_0x109dbd['push'](_0x109dbd['shift']());}};_0x395644(++_0x290d2b);}(_0x2cd3,0xf1));var _0x32cd=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x2cd3[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x32cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x32cd('0x1')],'allowNull':![],'unique':_0x32cd('0x2')},'OrderBy':{'type':Sequelize[_0x32cd('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x32cd('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x9b6d=['INTEGER','exports','STRING','name'];(function(_0x1ca531,_0x5e6dfe){var _0x25f0f4=function(_0x58a0e3){while(--_0x58a0e3){_0x1ca531['push'](_0x1ca531['shift']());}};_0x25f0f4(++_0x5e6dfe);}(_0x9b6d,0x105));var _0xd9b6=function(_0x3471f0,_0x1084d2){_0x3471f0=_0x3471f0-0x0;var _0x1475a7=_0x9b6d[_0x3471f0];return _0x1475a7;};'use strict';var Sequelize=require('sequelize');module[_0xd9b6('0x0')]={'name':{'type':Sequelize[_0xd9b6('0x1')],'allowNull':![],'unique':_0xd9b6('0x2')},'OrderBy':{'type':Sequelize[_0xd9b6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xd9b6('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 581d120..8c2f692 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['merge','VIRTUAL','filter','options','findAll','rows','show','params','keys','fields','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','sort','where','pick'];(function(_0x45e398,_0x8b9b0c){var _0x3f006c=function(_0x374fd4){while(--_0x374fd4){_0x45e398['push'](_0x45e398['shift']());}};_0x3f006c(++_0x8b9b0c);}(_0x54ef,0x112));var _0xf54e=function(_0x729191,_0x5133b2){_0x729191=_0x729191-0x0;var _0x3b3e6e=_0x54ef[_0x729191];return _0x3b3e6e;};'use strict';var pdf=require(_0xf54e('0x0'));var emlformat=require(_0xf54e('0x1'));var rimraf=require(_0xf54e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf54e('0x3'));var rp=require(_0xf54e('0x4'));var moment=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var Mustache=require(_0xf54e('0x7'));var util=require(_0xf54e('0x8'));var path=require(_0xf54e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf54e('0xa'));var fs=require('fs');var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358c88,_0x4b0ee1){_0x4b0ee1=_0x4b0ee1||0xcc;return function(_0x4bd828){if(_0x4bd828){return _0x358c88[_0xf54e('0x18')](_0x4b0ee1);}return _0x358c88[_0xf54e('0x19')](_0x4b0ee1)[_0xf54e('0x1a')]();};}function respondWithResult(_0x380f26,_0x5644aa){_0x5644aa=_0x5644aa||0xc8;return function(_0x331732){if(_0x331732){return _0x380f26[_0xf54e('0x19')](_0x5644aa)[_0xf54e('0x1b')](_0x331732);}};}function respondWithFilteredResult(_0x15f639,_0x56828e){return function(_0x2366ee){if(_0x2366ee){var _0x389abc=_0x2366ee[_0xf54e('0x1c')],_0x3eb415=_0x56828e[_0xf54e('0x1d')],_0x5c5d00=_0x56828e[_0xf54e('0x1d')]+_0x56828e[_0xf54e('0x1e')],_0x4af633;if(_0x5c5d00>=_0x389abc){_0x5c5d00=_0x389abc;_0x4af633=0xc8;}else{_0x4af633=0xce;}_0x15f639[_0xf54e('0x19')](_0x4af633);return _0x15f639[_0xf54e('0x1f')](_0xf54e('0x20'),_0x3eb415+'-'+_0x5c5d00+'/'+_0x389abc)[_0xf54e('0x1b')](_0x2366ee);}return null;};}function patchUpdates(_0x1dcc04){return function(_0x4689fe){try{jsonpatch[_0xf54e('0x21')](_0x4689fe,_0x1dcc04,!![]);}catch(_0x50fc66){return BPromise['reject'](_0x50fc66);}return _0x4689fe[_0xf54e('0x22')]();};}function saveUpdates(_0x59f338,_0x3e1556){return function(_0x1bfe99){if(_0x1bfe99){return _0x1bfe99[_0xf54e('0x23')](_0x59f338)[_0xf54e('0x24')](function(_0xf64f12){return _0xf64f12;});}return null;};}function removeEntity(_0x3887b0,_0x388aa0){return function(_0x11985e){if(_0x11985e){return _0x11985e[_0xf54e('0x25')]()[_0xf54e('0x24')](function(){var _0x1c58bd=_0x11985e['get']({'plain':!![]});var _0x6f6d29='ContactItemTypes';return db[_0xf54e('0x26')][_0xf54e('0x25')]({'where':{'type':_0x6f6d29,'resourceId':_0x1c58bd['id']}})[_0xf54e('0x24')](function(){return _0x11985e;});})[_0xf54e('0x24')](function(){_0x3887b0[_0xf54e('0x19')](0xcc)[_0xf54e('0x1a')]();});}};}function handleEntityNotFound(_0x1e08d1,_0x43488d){return function(_0x2342a9){if(!_0x2342a9){_0x1e08d1[_0xf54e('0x18')](0x194);}return _0x2342a9;};}function handleError(_0xf6cdd7,_0x39c0ae){_0x39c0ae=_0x39c0ae||0x1f4;return function(_0x2ea001){logger['error'](_0x2ea001[_0xf54e('0x27')]);if(_0x2ea001['name']){delete _0x2ea001[_0xf54e('0x28')];}_0xf6cdd7['status'](_0x39c0ae)[_0xf54e('0x29')](_0x2ea001);};}exports[_0xf54e('0x2a')]=function(_0x21ba00,_0xa13cd0){var _0x25b643={},_0x3993e4={},_0x36f985={'count':0x0,'rows':[]};var _0x54bd8f=_['map'](db[_0xf54e('0x2b')][_0xf54e('0x2c')],function(_0x2ec92e){return{'name':_0x2ec92e[_0xf54e('0x2d')],'type':_0x2ec92e[_0xf54e('0x2e')][_0xf54e('0x2f')]};});_0x3993e4[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x54bd8f,_0xf54e('0x28'));_0x3993e4[_0xf54e('0x32')]=_['keys'](_0x21ba00['query']);_0x3993e4[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x3993e4['model'],_0x3993e4[_0xf54e('0x32')]);_0x25b643[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x3993e4[_0xf54e('0x30')],qs['fields'](_0x21ba00['query']['fields']));_0x25b643[_0xf54e('0x35')]=_0x25b643[_0xf54e('0x35')][_0xf54e('0x36')]?_0x25b643[_0xf54e('0x35')]:_0x3993e4[_0xf54e('0x30')];if(!_0x21ba00[_0xf54e('0x32')]['hasOwnProperty']('nolimit')){_0x25b643['limit']=qs[_0xf54e('0x1e')](_0x21ba00[_0xf54e('0x32')]['limit']);_0x25b643['offset']=qs[_0xf54e('0x1d')](_0x21ba00[_0xf54e('0x32')][_0xf54e('0x1d')]);}_0x25b643['order']=qs[_0xf54e('0x37')](_0x21ba00[_0xf54e('0x32')]['sort']);_0x25b643[_0xf54e('0x38')]=qs[_0xf54e('0x33')](_[_0xf54e('0x39')](_0x21ba00[_0xf54e('0x32')],_0x3993e4[_0xf54e('0x33')]),_0x54bd8f);if(_0x21ba00[_0xf54e('0x32')]['filter']){_0x25b643['where']=_[_0xf54e('0x3a')](_0x25b643[_0xf54e('0x38')],{'$or':_[_0xf54e('0x31')](_0x54bd8f,function(_0x4b1f84){if(_0x4b1f84[_0xf54e('0x2e')]!==_0xf54e('0x3b')){var _0x448054={};_0x448054[_0x4b1f84[_0xf54e('0x28')]]={'$like':'%'+_0x21ba00[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x448054;}})});}_0x25b643=_[_0xf54e('0x3a')]({},_0x25b643,_0x21ba00[_0xf54e('0x3d')]);var _0x8b4c={'where':_0x25b643[_0xf54e('0x38')]};return db[_0xf54e('0x2b')][_0xf54e('0x1c')](_0x8b4c)[_0xf54e('0x24')](function(_0x2625fd){_0x36f985[_0xf54e('0x1c')]=_0x2625fd;if(_0x21ba00['query']['includeAll']){_0x25b643['include']=[{'all':!![]}];}return db[_0xf54e('0x2b')][_0xf54e('0x3e')](_0x25b643);})['then'](function(_0x3dae9b){_0x36f985[_0xf54e('0x3f')]=_0x3dae9b;return _0x36f985;})[_0xf54e('0x24')](respondWithFilteredResult(_0xa13cd0,_0x25b643))['catch'](handleError(_0xa13cd0,null));};exports[_0xf54e('0x40')]=function(_0x13d145,_0x1e016e){var _0x794be7={'raw':!![],'where':{'id':_0x13d145[_0xf54e('0x41')]['id']}},_0x4b1931={};_0x4b1931[_0xf54e('0x30')]=_[_0xf54e('0x42')](db[_0xf54e('0x2b')]['rawAttributes']);_0x4b1931[_0xf54e('0x32')]=_[_0xf54e('0x42')](_0x13d145[_0xf54e('0x32')]);_0x4b1931[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x4b1931[_0xf54e('0x30')],_0x4b1931['query']);_0x794be7[_0xf54e('0x35')]=_['intersection'](_0x4b1931[_0xf54e('0x30')],qs['fields'](_0x13d145[_0xf54e('0x32')][_0xf54e('0x43')]));_0x794be7[_0xf54e('0x35')]=_0x794be7['attributes'][_0xf54e('0x36')]?_0x794be7[_0xf54e('0x35')]:_0x4b1931[_0xf54e('0x30')];if(_0x13d145[_0xf54e('0x32')][_0xf54e('0x44')]){_0x794be7['include']=[{'all':!![]}];}_0x794be7=_[_0xf54e('0x3a')]({},_0x794be7,_0x13d145[_0xf54e('0x3d')]);return db[_0xf54e('0x2b')][_0xf54e('0x45')](_0x794be7)['then'](handleEntityNotFound(_0x1e016e,null))[_0xf54e('0x24')](respondWithResult(_0x1e016e,null))[_0xf54e('0x46')](handleError(_0x1e016e,null));};exports['create']=function(_0x22c842,_0xd4d956){return db[_0xf54e('0x2b')][_0xf54e('0x47')](_0x22c842['body'],{})[_0xf54e('0x24')](function(_0x2b645e){var _0x2527f6=_0x22c842[_0xf54e('0x48')][_0xf54e('0x49')]({'plain':!![]});if(!_0x2527f6)throw new Error(_0xf54e('0x4a'));if(_0x2527f6[_0xf54e('0x4b')]===_0xf54e('0x48')){var _0x15bfef=_0x2b645e[_0xf54e('0x49')]({'plain':!![]});var _0xaf9bf0=_0xf54e('0x4c');return db[_0xf54e('0x4d')][_0xf54e('0x45')]({'where':{'name':_0xaf9bf0,'userProfileId':_0x2527f6[_0xf54e('0x4e')]},'raw':!![]})[_0xf54e('0x24')](function(_0x40d8ab){if(_0x40d8ab&&_0x40d8ab[_0xf54e('0x4f')]===0x0){return db[_0xf54e('0x26')][_0xf54e('0x47')]({'name':_0x15bfef['name'],'resourceId':_0x15bfef['id'],'type':_0x40d8ab['name'],'sectionId':_0x40d8ab['id']},{})[_0xf54e('0x24')](function(){return _0x2b645e;});}else{return _0x2b645e;}})[_0xf54e('0x46')](function(_0x45861b){logger[_0xf54e('0x50')](_0xf54e('0x51'),_0x45861b);throw _0x45861b;});}return _0x2b645e;})[_0xf54e('0x24')](respondWithResult(_0xd4d956,0xc9))[_0xf54e('0x46')](handleError(_0xd4d956,null));};exports[_0xf54e('0x23')]=function(_0x89b811,_0xdf63c4){if(_0x89b811[_0xf54e('0x52')]['id']){delete _0x89b811['body']['id'];}return db[_0xf54e('0x2b')][_0xf54e('0x45')]({'where':{'id':_0x89b811[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0xdf63c4,null))[_0xf54e('0x24')](saveUpdates(_0x89b811[_0xf54e('0x52')],null))[_0xf54e('0x24')](respondWithResult(_0xdf63c4,null))['catch'](handleError(_0xdf63c4,null));};exports[_0xf54e('0x25')]=function(_0x5fabd2,_0x294fa1){return db['ContactItemType'][_0xf54e('0x45')]({'where':{'id':_0x5fabd2['params']['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x294fa1,null))[_0xf54e('0x24')](removeEntity(_0x294fa1,null))[_0xf54e('0x46')](handleError(_0x294fa1,null));}; \ No newline at end of file +var _0xf3cd=['findAll','rows','catch','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../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','then','destroy','ContactItemTypes','UserProfileResource','end','name','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','ContactItemType','includeAll'];(function(_0x2d4191,_0x2a43f3){var _0x18863f=function(_0x3c5906){while(--_0x3c5906){_0x2d4191['push'](_0x2d4191['shift']());}};_0x18863f(++_0x2a43f3);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0xf3cd[_0x59ab65];return _0x57db9b;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var db=require(_0xdf3c('0x19'))['db'];function respondWithStatusCode(_0x5e8925,_0x1d483c){_0x1d483c=_0x1d483c||0xcc;return function(_0x166ae5){if(_0x166ae5){return _0x5e8925[_0xdf3c('0x1a')](_0x1d483c);}return _0x5e8925[_0xdf3c('0x1b')](_0x1d483c)['end']();};}function respondWithResult(_0x2ae4ad,_0x461079){_0x461079=_0x461079||0xc8;return function(_0x13ea5f){if(_0x13ea5f){return _0x2ae4ad['status'](_0x461079)[_0xdf3c('0x1c')](_0x13ea5f);}};}function respondWithFilteredResult(_0x38b01d,_0x173041){return function(_0x4274fd){if(_0x4274fd){var _0x21e587=_0x4274fd[_0xdf3c('0x1d')],_0x1a7a5a=_0x173041[_0xdf3c('0x1e')],_0x305ea5=_0x173041['offset']+_0x173041[_0xdf3c('0x1f')],_0x92008b;if(_0x305ea5>=_0x21e587){_0x305ea5=_0x21e587;_0x92008b=0xc8;}else{_0x92008b=0xce;}_0x38b01d[_0xdf3c('0x1b')](_0x92008b);return _0x38b01d[_0xdf3c('0x20')](_0xdf3c('0x21'),_0x1a7a5a+'-'+_0x305ea5+'/'+_0x21e587)[_0xdf3c('0x1c')](_0x4274fd);}return null;};}function patchUpdates(_0x113b56){return function(_0x16b02b){try{jsonpatch[_0xdf3c('0x22')](_0x16b02b,_0x113b56,!![]);}catch(_0x426f3a){return BPromise[_0xdf3c('0x23')](_0x426f3a);}return _0x16b02b[_0xdf3c('0x24')]();};}function saveUpdates(_0x3d14cc,_0x25487c){return function(_0x5d2390){if(_0x5d2390){return _0x5d2390['update'](_0x3d14cc)[_0xdf3c('0x25')](function(_0x583ce4){return _0x583ce4;});}return null;};}function removeEntity(_0x15776c,_0x40e7ec){return function(_0x36552e){if(_0x36552e){return _0x36552e[_0xdf3c('0x26')]()[_0xdf3c('0x25')](function(){var _0x36ba1c=_0x36552e['get']({'plain':!![]});var _0x22a164=_0xdf3c('0x27');return db[_0xdf3c('0x28')][_0xdf3c('0x26')]({'where':{'type':_0x22a164,'resourceId':_0x36ba1c['id']}})[_0xdf3c('0x25')](function(){return _0x36552e;});})[_0xdf3c('0x25')](function(){_0x15776c[_0xdf3c('0x1b')](0xcc)[_0xdf3c('0x29')]();});}};}function handleEntityNotFound(_0x18cb46,_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x18cb46[_0xdf3c('0x1a')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x2a')];}_0x153daa[_0xdf3c('0x1b')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={},_0x1ccdd4={},_0x5c98a2={'count':0x0,'rows':[]};var _0x43ce06=_[_0xdf3c('0x2b')](db['ContactItemType']['rawAttributes'],function(_0x1f1d8a){return{'name':_0x1f1d8a[_0xdf3c('0x2c')],'type':_0x1f1d8a[_0xdf3c('0x2d')]['key']};});_0x1ccdd4[_0xdf3c('0x2e')]=_[_0xdf3c('0x2b')](_0x43ce06,_0xdf3c('0x2a'));_0x1ccdd4[_0xdf3c('0x2f')]=_['keys'](_0x37ecfd[_0xdf3c('0x2f')]);_0x1ccdd4[_0xdf3c('0x30')]=_['intersection'](_0x1ccdd4[_0xdf3c('0x2e')],_0x1ccdd4[_0xdf3c('0x2f')]);_0xd3cfcb[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x1ccdd4['model'],qs[_0xdf3c('0x33')](_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0xd3cfcb[_0xdf3c('0x31')]=_0xd3cfcb['attributes'][_0xdf3c('0x34')]?_0xd3cfcb[_0xdf3c('0x31')]:_0x1ccdd4['model'];if(!_0x37ecfd['query'][_0xdf3c('0x35')]('nolimit')){_0xd3cfcb[_0xdf3c('0x1f')]=qs['limit'](_0x37ecfd['query']['limit']);_0xd3cfcb[_0xdf3c('0x1e')]=qs[_0xdf3c('0x1e')](_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x1e')]);}_0xd3cfcb['order']=qs['sort'](_0x37ecfd[_0xdf3c('0x2f')]['sort']);_0xd3cfcb[_0xdf3c('0x36')]=qs[_0xdf3c('0x30')](_[_0xdf3c('0x37')](_0x37ecfd[_0xdf3c('0x2f')],_0x1ccdd4[_0xdf3c('0x30')]),_0x43ce06);if(_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x38')]){_0xd3cfcb[_0xdf3c('0x36')]=_[_0xdf3c('0x39')](_0xd3cfcb['where'],{'$or':_[_0xdf3c('0x2b')](_0x43ce06,function(_0x54e689){if(_0x54e689['type']!==_0xdf3c('0x3a')){var _0x47f760={};_0x47f760[_0x54e689[_0xdf3c('0x2a')]]={'$like':'%'+_0x37ecfd['query'][_0xdf3c('0x38')]+'%'};return _0x47f760;}})});}_0xd3cfcb=_[_0xdf3c('0x39')]({},_0xd3cfcb,_0x37ecfd[_0xdf3c('0x3b')]);var _0x1349a4={'where':_0xd3cfcb[_0xdf3c('0x36')]};return db[_0xdf3c('0x3c')][_0xdf3c('0x1d')](_0x1349a4)[_0xdf3c('0x25')](function(_0x3cf131){_0x5c98a2[_0xdf3c('0x1d')]=_0x3cf131;if(_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x3d')]){_0xd3cfcb['include']=[{'all':!![]}];}return db['ContactItemType'][_0xdf3c('0x3e')](_0xd3cfcb);})['then'](function(_0x3a6527){_0x5c98a2[_0xdf3c('0x3f')]=_0x3a6527;return _0x5c98a2;})[_0xdf3c('0x25')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x40')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x563d31,_0x335c1b){var _0x33edab={'raw':!![],'where':{'id':_0x563d31['params']['id']}},_0x106975={};_0x106975[_0xdf3c('0x2e')]=_[_0xdf3c('0x41')](db[_0xdf3c('0x3c')][_0xdf3c('0x42')]);_0x106975['query']=_[_0xdf3c('0x41')](_0x563d31[_0xdf3c('0x2f')]);_0x106975[_0xdf3c('0x30')]=_[_0xdf3c('0x32')](_0x106975[_0xdf3c('0x2e')],_0x106975['query']);_0x33edab[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x106975[_0xdf3c('0x2e')],qs[_0xdf3c('0x33')](_0x563d31[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0x33edab['attributes']=_0x33edab['attributes'][_0xdf3c('0x34')]?_0x33edab[_0xdf3c('0x31')]:_0x106975['model'];if(_0x563d31['query'][_0xdf3c('0x3d')]){_0x33edab[_0xdf3c('0x43')]=[{'all':!![]}];}_0x33edab=_[_0xdf3c('0x39')]({},_0x33edab,_0x563d31[_0xdf3c('0x3b')]);return db[_0xdf3c('0x3c')][_0xdf3c('0x44')](_0x33edab)[_0xdf3c('0x25')](handleEntityNotFound(_0x335c1b,null))[_0xdf3c('0x25')](respondWithResult(_0x335c1b,null))[_0xdf3c('0x40')](handleError(_0x335c1b,null));};exports['create']=function(_0x129c2a,_0x2cfdb2){return db[_0xdf3c('0x3c')][_0xdf3c('0x45')](_0x129c2a[_0xdf3c('0x46')],{})[_0xdf3c('0x25')](function(_0x28a468){var _0x553f70=_0x129c2a[_0xdf3c('0x47')]['get']({'plain':!![]});if(!_0x553f70)throw new Error(_0xdf3c('0x48'));if(_0x553f70['role']===_0xdf3c('0x47')){var _0x28144f=_0x28a468[_0xdf3c('0x49')]({'plain':!![]});var _0x94c5b9='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x94c5b9,'userProfileId':_0x553f70[_0xdf3c('0x4a')]},'raw':!![]})['then'](function(_0x31c600){if(_0x31c600&&_0x31c600[_0xdf3c('0x4b')]===0x0){return db[_0xdf3c('0x28')][_0xdf3c('0x45')]({'name':_0x28144f[_0xdf3c('0x2a')],'resourceId':_0x28144f['id'],'type':_0x31c600['name'],'sectionId':_0x31c600['id']},{})['then'](function(){return _0x28a468;});}else{return _0x28a468;}})[_0xdf3c('0x40')](function(_0x27a541){logger['error'](_0xdf3c('0x4c'),_0x27a541);throw _0x27a541;});}return _0x28a468;})[_0xdf3c('0x25')](respondWithResult(_0x2cfdb2,0xc9))[_0xdf3c('0x40')](handleError(_0x2cfdb2,null));};exports[_0xdf3c('0x4d')]=function(_0x38de63,_0x46dfb1){if(_0x38de63[_0xdf3c('0x46')]['id']){delete _0x38de63['body']['id'];}return db['ContactItemType'][_0xdf3c('0x44')]({'where':{'id':_0x38de63[_0xdf3c('0x4e')]['id']}})[_0xdf3c('0x25')](handleEntityNotFound(_0x46dfb1,null))[_0xdf3c('0x25')](saveUpdates(_0x38de63[_0xdf3c('0x46')],null))[_0xdf3c('0x25')](respondWithResult(_0x46dfb1,null))[_0xdf3c('0x40')](handleError(_0x46dfb1,null));};exports[_0xdf3c('0x26')]=function(_0x143d01,_0x31624a){return db[_0xdf3c('0x3c')]['find']({'where':{'id':_0x143d01[_0xdf3c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31624a,null))['then'](removeEntity(_0x31624a,null))['catch'](handleError(_0x31624a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ef0a787..6f44ce9 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d7e=['./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x343e70,_0xe5f373){var _0x2742fd=function(_0x27e56e){while(--_0x27e56e){_0x343e70['push'](_0x343e70['shift']());}};_0x2742fd(++_0xe5f373);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1d7e[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0xe1d7('0x0'));var logger=require(_0xe1d7('0x1'))(_0xe1d7('0x2'));var moment=require('moment');var BPromise=require(_0xe1d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1d7('0x4'));var rimraf=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var attributes=require(_0xe1d7('0x7'));module[_0xe1d7('0x8')]=function(_0x4058fe,_0x252026){return _0x4058fe[_0xe1d7('0x9')](_0xe1d7('0xa'),attributes,{'tableName':_0xe1d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e76=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0e76,0xc4));var _0x60e7=function(_0x5c4d15,_0x32fe23){_0x5c4d15=_0x5c4d15-0x0;var _0x1f974a=_0x0e76[_0x5c4d15];return _0x1f974a;};'use strict';var _=require(_0x60e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60e7('0x1'));var moment=require('moment');var BPromise=require(_0x60e7('0x2'));var rp=require(_0x60e7('0x3'));var fs=require('fs');var path=require(_0x60e7('0x4'));var rimraf=require(_0x60e7('0x5'));var config=require(_0x60e7('0x6'));var attributes=require('./contactItemType.attributes');module[_0x60e7('0x7')]=function(_0x35b628,_0x1fb45c){return _0x35b628[_0x60e7('0x8')](_0x60e7('0x9'),attributes,{'tableName':_0x60e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 4bdfc71..84e7481 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9221=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x4969d0,_0x4a5788){var _0x754944=function(_0x20f719){while(--_0x20f719){_0x4969d0['push'](_0x4969d0['shift']());}};_0x754944(++_0x4a5788);}(_0x9221,0x64));var _0x1922=function(_0x48fcee,_0x431a8b){_0x48fcee=_0x48fcee-0x0;var _0x28d65a=_0x9221[_0x48fcee];return _0x28d65a;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));var moment=require(_0x1922('0x1'));var BPromise=require('bluebird');var rs=require(_0x1922('0x2'));var fs=require('fs');var Redis=require(_0x1922('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1922('0x4'));var logger=require(_0x1922('0x5'))(_0x1922('0x6'));var config=require(_0x1922('0x7'));var jayson=require(_0x1922('0x8'));var client=jayson[_0x1922('0x9')][_0x1922('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aa05c,_0x116227,_0x3cfd98){return new BPromise(function(_0x195fa4,_0x47c225){return client[_0x1922('0xb')](_0x5aa05c,_0x3cfd98)['then'](function(_0x2b6c51){logger[_0x1922('0xc')](_0x1922('0xd'),_0x116227,'request\x20sent');logger[_0x1922('0xe')](_0x1922('0xf'),_0x116227,'request\x20sent',JSON[_0x1922('0x10')](_0x2b6c51));if(_0x2b6c51['error']){if(_0x2b6c51[_0x1922('0x11')]['code']===0x1f4){logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x2b6c51[_0x1922('0x11')]['message']);return _0x47c225(_0x2b6c51['error'][_0x1922('0x12')]);}logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x2b6c51[_0x1922('0x11')][_0x1922('0x12')]);return _0x195fa4(_0x2b6c51['error'][_0x1922('0x12')]);}else{logger['info'](_0x1922('0xd'),_0x116227,_0x1922('0x13'));_0x195fa4(_0x2b6c51[_0x1922('0x14')][_0x1922('0x12')]);}})['catch'](function(_0x459511){logger[_0x1922('0x11')](_0x1922('0xd'),_0x116227,_0x459511);_0x47c225(_0x459511);});});} \ No newline at end of file +var _0x207d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0xc038de,_0x5ee166){var _0x4df3c9=function(_0x8c5142){while(--_0x8c5142){_0xc038de['push'](_0xc038de['shift']());}};_0x4df3c9(++_0x5ee166);}(_0x207d,0x10d));var _0xd207=function(_0x21c760,_0x33b653){_0x21c760=_0x21c760-0x0;var _0xb81e2a=_0x207d[_0x21c760];return _0xb81e2a;};'use strict';var _=require(_0xd207('0x0'));var util=require(_0xd207('0x1'));var moment=require(_0xd207('0x2'));var BPromise=require(_0xd207('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd207('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd207('0x5'));var logger=require(_0xd207('0x6'))('rpc');var config=require(_0xd207('0x7'));var jayson=require(_0xd207('0x8'));var client=jayson[_0xd207('0x9')][_0xd207('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0cfe,_0x1bfc5a,_0x3e09c7){return new BPromise(function(_0x7def24,_0x304b70){return client[_0xd207('0xb')](_0x2e0cfe,_0x3e09c7)[_0xd207('0xc')](function(_0x545ab1){logger[_0xd207('0xd')](_0xd207('0xe'),_0x1bfc5a,_0xd207('0xf'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1bfc5a,_0xd207('0xf'),JSON[_0xd207('0x10')](_0x545ab1));if(_0x545ab1[_0xd207('0x11')]){if(_0x545ab1['error'][_0xd207('0x12')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x1bfc5a,_0x545ab1['error'][_0xd207('0x13')]);return _0x304b70(_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);}logger[_0xd207('0x11')](_0xd207('0xe'),_0x1bfc5a,_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);return _0x7def24(_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);}else{logger[_0xd207('0xd')](_0xd207('0xe'),_0x1bfc5a,'request\x20sent');_0x7def24(_0x545ab1['result'][_0xd207('0x13')]);}})[_0xd207('0x14')](function(_0x38e8e8){logger['error']('ContactItemType,\x20%s,\x20%s',_0x1bfc5a,_0x38e8e8);_0x304b70(_0x38e8e8);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index d8c8232..13dec00 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2684=['isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x1a6329,_0x251b9e){var _0x270b0b=function(_0x2377a3){while(--_0x2377a3){_0x1a6329['push'](_0x1a6329['shift']());}};_0x270b0b(++_0x251b9e);}(_0x2684,0x96));var _0x4268=function(_0x33edf4,_0x59a7cd){_0x33edf4=_0x33edf4-0x0;var _0x11f77f=_0x2684[_0x33edf4];return _0x11f77f;};'use strict';var multer=require(_0x4268('0x0'));var util=require(_0x4268('0x1'));var path=require(_0x4268('0x2'));var timeout=require(_0x4268('0x3'));var express=require(_0x4268('0x4'));var router=express[_0x4268('0x5')]();var auth=require(_0x4268('0x6'));var interaction=require(_0x4268('0x7'));var config=require(_0x4268('0x8'));var controller=require(_0x4268('0x9'));router['get']('/',auth[_0x4268('0xa')](),controller['index']);router[_0x4268('0xb')](_0x4268('0xc'),auth[_0x4268('0xa')](),controller[_0x4268('0xd')]);router['post']('/',auth[_0x4268('0xa')](),controller[_0x4268('0xe')]);router[_0x4268('0xf')](_0x4268('0xc'),auth[_0x4268('0xa')](),controller[_0x4268('0x10')]);router[_0x4268('0x11')](_0x4268('0xc'),auth[_0x4268('0xa')](),controller[_0x4268('0x12')]);module[_0x4268('0x13')]=router; \ No newline at end of file +var _0xf03b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xf03b,0xa7));var _0xbf03=function(_0x34359e,_0x35c961){_0x34359e=_0x34359e-0x0;var _0xfebd02=_0xf03b[_0x34359e];return _0xfebd02;};'use strict';var multer=require(_0xbf03('0x0'));var util=require(_0xbf03('0x1'));var path=require(_0xbf03('0x2'));var timeout=require(_0xbf03('0x3'));var express=require(_0xbf03('0x4'));var router=express[_0xbf03('0x5')]();var auth=require(_0xbf03('0x6'));var interaction=require(_0xbf03('0x7'));var config=require(_0xbf03('0x8'));var controller=require(_0xbf03('0x9'));router[_0xbf03('0xa')]('/',auth['isAuthenticated'](),controller[_0xbf03('0xb')]);router[_0xbf03('0xa')]('/:id',auth[_0xbf03('0xc')](),controller[_0xbf03('0xd')]);router[_0xbf03('0xe')]('/',auth[_0xbf03('0xc')](),controller[_0xbf03('0xf')]);router['put'](_0xbf03('0x10'),auth[_0xbf03('0xc')](),controller[_0xbf03('0x11')]);router[_0xbf03('0x12')](_0xbf03('0x10'),auth[_0xbf03('0xc')](),controller[_0xbf03('0x13')]);module[_0xbf03('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b5e6178..255f4cb 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 _0x8585=['STRING','sequelize','exports'];(function(_0x590a3a,_0xd9db9){var _0x49017f=function(_0x1d92e9){while(--_0x1d92e9){_0x590a3a['push'](_0x590a3a['shift']());}};_0x49017f(++_0xd9db9);}(_0x8585,0x64));var _0x5858=function(_0x4ea807,_0x447f72){_0x4ea807=_0x4ea807-0x0;var _0x2c2d35=_0x8585[_0x4ea807];return _0x2c2d35;};'use strict';var Sequelize=require(_0x5858('0x0'));module[_0x5858('0x1')]={'name':{'type':Sequelize[_0x5858('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x5858('0x2')]}}; \ No newline at end of file +var _0x9206=['STRING','name','sequelize','exports'];(function(_0x364040,_0x2661d5){var _0x4328dc=function(_0x29a477){while(--_0x29a477){_0x364040['push'](_0x364040['shift']());}};_0x4328dc(++_0x2661d5);}(_0x9206,0x176));var _0x6920=function(_0x4059b6,_0xc68ef8){_0x4059b6=_0x4059b6-0x0;var _0x538999=_0x9206[_0x4059b6];return _0x538999;};'use strict';var Sequelize=require(_0x6920('0x0'));module[_0x6920('0x1')]={'name':{'type':Sequelize[_0x6920('0x2')],'allowNull':![],'unique':_0x6920('0x3')},'description':{'type':Sequelize[_0x6920('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index baad4a7..e3f82c6 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 _0x4e22=['Content-Range','save','update','then','get','destroy','sendStatus','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','clone','options','omit','body','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','end','json','count','offset','limit','status','set'];(function(_0x3756a2,_0x17d055){var _0x1ea9fe=function(_0x1d9e4a){while(--_0x1d9e4a){_0x3756a2['push'](_0x3756a2['shift']());}};_0x1ea9fe(++_0x17d055);}(_0x4e22,0xc7));var _0x24e2=function(_0x496e98,_0x2007c3){_0x496e98=_0x496e98-0x0;var _0xd166e1=_0x4e22[_0x496e98];return _0xd166e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x24e2('0x0'));var rimraf=require(_0x24e2('0x1'));var zipdir=require(_0x24e2('0x2'));var jsonpatch=require(_0x24e2('0x3'));var rp=require(_0x24e2('0x4'));var moment=require('moment');var BPromise=require(_0x24e2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x24e2('0x6'));var csv=require(_0x24e2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x24e2('0x8'));var squel=require('squel');var crypto=require(_0x24e2('0x9'));var jsforce=require(_0x24e2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x24e2('0x7'));var querystring=require(_0x24e2('0xb'));var Papa=require(_0x24e2('0xc'));var Redis=require('ioredis');var authService=require(_0x24e2('0xd'));var qs=require(_0x24e2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24e2('0xf'));var logger=require(_0x24e2('0x10'))(_0x24e2('0x11'));var utils=require(_0x24e2('0x12'));var config=require(_0x24e2('0x13'));var db=require('../../mysqldb')['db'];config[_0x24e2('0x14')]=_[_0x24e2('0x15')](config[_0x24e2('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x24e2('0x16'))(new Redis(config[_0x24e2('0x14')]));require('./dashboard.socket')[_0x24e2('0x17')](socket);function respondWithStatusCode(_0x3cd333,_0x5d069a){_0x5d069a=_0x5d069a||0xcc;return function(_0x142cfa){if(_0x142cfa){return _0x3cd333['sendStatus'](_0x5d069a);}return _0x3cd333['status'](_0x5d069a)[_0x24e2('0x18')]();};}function respondWithResult(_0x5d8e0a,_0x12f427){_0x12f427=_0x12f427||0xc8;return function(_0x222411){if(_0x222411){return _0x5d8e0a['status'](_0x12f427)[_0x24e2('0x19')](_0x222411);}};}function respondWithFilteredResult(_0x4b90c1,_0x4d476b){return function(_0x107ae5){if(_0x107ae5){var _0x40d71f=_0x107ae5[_0x24e2('0x1a')],_0x228248=_0x4d476b[_0x24e2('0x1b')],_0x36560f=_0x4d476b[_0x24e2('0x1b')]+_0x4d476b[_0x24e2('0x1c')],_0x5243c0;if(_0x36560f>=_0x40d71f){_0x36560f=_0x40d71f;_0x5243c0=0xc8;}else{_0x5243c0=0xce;}_0x4b90c1[_0x24e2('0x1d')](_0x5243c0);return _0x4b90c1[_0x24e2('0x1e')](_0x24e2('0x1f'),_0x228248+'-'+_0x36560f+'/'+_0x40d71f)['json'](_0x107ae5);}return null;};}function patchUpdates(_0x4d1103){return function(_0x31b2fc){try{jsonpatch['apply'](_0x31b2fc,_0x4d1103,!![]);}catch(_0x47ac64){return BPromise['reject'](_0x47ac64);}return _0x31b2fc[_0x24e2('0x20')]();};}function saveUpdates(_0x488733,_0x29531c){return function(_0x1e8912){if(_0x1e8912){return _0x1e8912[_0x24e2('0x21')](_0x488733)[_0x24e2('0x22')](function(_0x325222){return _0x325222;});}return null;};}function removeEntity(_0x126b63,_0x16bdbf){return function(_0x186f2c){if(_0x186f2c){return _0x186f2c['destroy']()[_0x24e2('0x22')](function(){var _0x124b05=_0x186f2c[_0x24e2('0x23')]({'plain':!![]});var _0x417b3d='CustomDashboards';return db['UserProfileResource'][_0x24e2('0x24')]({'where':{'type':_0x417b3d,'resourceId':_0x124b05['id']}})['then'](function(){return _0x186f2c;});})[_0x24e2('0x22')](function(){_0x126b63[_0x24e2('0x1d')](0xcc)[_0x24e2('0x18')]();});}};}function handleEntityNotFound(_0x4a22f4,_0x4b6d0d){return function(_0x1db2d0){if(!_0x1db2d0){_0x4a22f4[_0x24e2('0x25')](0x194);}return _0x1db2d0;};}function handleError(_0x58f28e,_0xf2511a){_0xf2511a=_0xf2511a||0x1f4;return function(_0x3a66dc){logger[_0x24e2('0x26')](_0x3a66dc[_0x24e2('0x27')]);if(_0x3a66dc[_0x24e2('0x28')]){delete _0x3a66dc['name'];}_0x58f28e['status'](_0xf2511a)[_0x24e2('0x29')](_0x3a66dc);};}exports['index']=function(_0x488b06,_0x2a5b81){var _0x405c1a={},_0x2a7a1f={},_0x432d0e={'count':0x0,'rows':[]};var _0x5473ff=_[_0x24e2('0x2a')](db[_0x24e2('0x2b')][_0x24e2('0x2c')],function(_0x5878ff){return{'name':_0x5878ff[_0x24e2('0x2d')],'type':_0x5878ff[_0x24e2('0x2e')][_0x24e2('0x2f')]};});_0x2a7a1f[_0x24e2('0x30')]=_[_0x24e2('0x2a')](_0x5473ff,'name');_0x2a7a1f[_0x24e2('0x31')]=_[_0x24e2('0x32')](_0x488b06[_0x24e2('0x31')]);_0x2a7a1f[_0x24e2('0x33')]=_[_0x24e2('0x34')](_0x2a7a1f[_0x24e2('0x30')],_0x2a7a1f[_0x24e2('0x31')]);_0x405c1a[_0x24e2('0x35')]=_[_0x24e2('0x34')](_0x2a7a1f['model'],qs['fields'](_0x488b06['query'][_0x24e2('0x36')]));_0x405c1a[_0x24e2('0x35')]=_0x405c1a[_0x24e2('0x35')][_0x24e2('0x37')]?_0x405c1a[_0x24e2('0x35')]:_0x2a7a1f['model'];if(!_0x488b06[_0x24e2('0x31')][_0x24e2('0x38')](_0x24e2('0x39'))){_0x405c1a[_0x24e2('0x1c')]=qs[_0x24e2('0x1c')](_0x488b06[_0x24e2('0x31')]['limit']);_0x405c1a[_0x24e2('0x1b')]=qs[_0x24e2('0x1b')](_0x488b06[_0x24e2('0x31')][_0x24e2('0x1b')]);}_0x405c1a[_0x24e2('0x3a')]=qs[_0x24e2('0x3b')](_0x488b06['query'][_0x24e2('0x3b')]);_0x405c1a[_0x24e2('0x3c')]=qs[_0x24e2('0x33')](_[_0x24e2('0x3d')](_0x488b06['query'],_0x2a7a1f[_0x24e2('0x33')]),_0x5473ff);if(_0x488b06[_0x24e2('0x31')]['filter']){_0x405c1a[_0x24e2('0x3c')]=_['merge'](_0x405c1a[_0x24e2('0x3c')],{'$or':_[_0x24e2('0x2a')](_0x5473ff,function(_0x2b571b){if(_0x2b571b['type']!=='VIRTUAL'){var _0xd1d53d={};_0xd1d53d[_0x2b571b[_0x24e2('0x28')]]={'$like':'%'+_0x488b06['query']['filter']+'%'};return _0xd1d53d;}})});}_0x405c1a=_[_0x24e2('0x3e')]({},_0x405c1a,_0x488b06['options']);var _0x1f89f3={'where':_0x405c1a[_0x24e2('0x3c')]};return db['Dashboard']['count'](_0x1f89f3)[_0x24e2('0x22')](function(_0x103f50){_0x432d0e[_0x24e2('0x1a')]=_0x103f50;if(_0x488b06[_0x24e2('0x31')][_0x24e2('0x3f')]){_0x405c1a[_0x24e2('0x40')]=[{'all':!![]}];}return db[_0x24e2('0x2b')][_0x24e2('0x41')](_0x405c1a);})[_0x24e2('0x22')](function(_0x16abb8){_0x432d0e[_0x24e2('0x42')]=_0x16abb8;return _0x432d0e;})[_0x24e2('0x22')](respondWithFilteredResult(_0x2a5b81,_0x405c1a))['catch'](handleError(_0x2a5b81,null));};exports[_0x24e2('0x43')]=function(_0x3f843e,_0x596e28){var _0x24609a={'raw':![],'where':{'id':_0x3f843e[_0x24e2('0x44')]['id']}},_0x1a6b25={};_0x1a6b25[_0x24e2('0x30')]=_['keys'](db[_0x24e2('0x2b')][_0x24e2('0x2c')]);_0x1a6b25[_0x24e2('0x31')]=_[_0x24e2('0x32')](_0x3f843e[_0x24e2('0x31')]);_0x1a6b25[_0x24e2('0x33')]=_[_0x24e2('0x34')](_0x1a6b25[_0x24e2('0x30')],_0x1a6b25[_0x24e2('0x31')]);_0x24609a['attributes']=_['intersection'](_0x1a6b25['model'],qs['fields'](_0x3f843e[_0x24e2('0x31')][_0x24e2('0x36')]));_0x24609a[_0x24e2('0x35')]=_0x24609a['attributes'][_0x24e2('0x37')]?_0x24609a['attributes']:_0x1a6b25[_0x24e2('0x30')];if(_0x3f843e[_0x24e2('0x31')]['includeAll']){_0x24609a[_0x24e2('0x40')]=[{'all':!![]}];}_0x24609a=_[_0x24e2('0x3e')]({},_0x24609a,_0x3f843e['options']);return db[_0x24e2('0x2b')][_0x24e2('0x45')](_0x24609a)[_0x24e2('0x22')](handleEntityNotFound(_0x596e28,null))[_0x24e2('0x22')](respondWithResult(_0x596e28,null))['catch'](handleError(_0x596e28,null));};exports[_0x24e2('0x46')]=function(_0x40b522,_0x3f8e77){return db['Dashboard'][_0x24e2('0x46')](_0x40b522['body'],{})[_0x24e2('0x22')](function(_0x3a8017){var _0x5cade3=_0x40b522[_0x24e2('0x47')][_0x24e2('0x23')]({'plain':!![]});if(!_0x5cade3)throw new Error(_0x24e2('0x48'));if(_0x5cade3[_0x24e2('0x49')]===_0x24e2('0x47')){var _0x4be184=_0x3a8017[_0x24e2('0x23')]({'plain':!![]});var _0x180ee2=_0x24e2('0x4a');return db[_0x24e2('0x4b')][_0x24e2('0x45')]({'where':{'name':_0x180ee2,'userProfileId':_0x5cade3[_0x24e2('0x4c')]},'raw':!![]})[_0x24e2('0x22')](function(_0xba7489){if(_0xba7489&&_0xba7489[_0x24e2('0x4d')]===0x0){return db[_0x24e2('0x4e')][_0x24e2('0x46')]({'name':_0x4be184[_0x24e2('0x28')],'resourceId':_0x4be184['id'],'type':_0xba7489[_0x24e2('0x28')],'sectionId':_0xba7489['id']},{})[_0x24e2('0x22')](function(){return _0x3a8017;});}else{return _0x3a8017;}})[_0x24e2('0x4f')](function(_0x48837c){logger[_0x24e2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48837c);throw _0x48837c;});}return _0x3a8017;})[_0x24e2('0x22')](respondWithResult(_0x3f8e77,0xc9))[_0x24e2('0x4f')](handleError(_0x3f8e77,null));};exports[_0x24e2('0x50')]=function(_0x5373bb,_0x592be3){var _0x413b1e={'where':{'id':_0x5373bb[_0x24e2('0x44')]['id']}},_0x519b4e={};_0x519b4e[_0x24e2('0x30')]=_[_0x24e2('0x32')](db[_0x24e2('0x2b')][_0x24e2('0x2c')]);_0x413b1e[_0x24e2('0x35')]=_['intersection'](_0x519b4e['model'],qs[_0x24e2('0x36')](_0x5373bb[_0x24e2('0x31')][_0x24e2('0x36')]));_0x413b1e['attributes']=_0x413b1e['attributes'][_0x24e2('0x37')]?_0x413b1e[_0x24e2('0x35')]:_0x519b4e['model'];if(_0x5373bb[_0x24e2('0x31')]['includeAll']){_0x413b1e['include']=[{'all':!![]}];}_0x413b1e=_[_0x24e2('0x3e')]({},_0x413b1e,_0x5373bb[_0x24e2('0x51')]);return db[_0x24e2('0x2b')]['find'](_0x413b1e)['then'](handleEntityNotFound(_0x592be3,null))[_0x24e2('0x22')](function(_0x5da4b5){if(_0x5da4b5){var _0x215628=_0x5da4b5[_0x24e2('0x23')]({'plain':!![]});_0x215628=qs[_0x24e2('0x52')](_0x215628,['id','createdAt','updatedAt']);_0x5373bb[_0x24e2('0x53')]=_[_0x24e2('0x52')](_0x5373bb[_0x24e2('0x53')],['id',_0x24e2('0x54'),_0x24e2('0x55')]);return db[_0x24e2('0x2b')][_0x24e2('0x46')](_[_0x24e2('0x3e')](_0x215628,_0x5373bb['body']),{'include':_0x5373bb[_0x24e2('0x31')][_0x24e2('0x3f')]?[{'all':!![]}]:undefined})[_0x24e2('0x22')](function(_0x52b401){var _0x474b67=_0x5373bb['user']['get']({'plain':!![]});if(!_0x474b67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x474b67[_0x24e2('0x49')]==='user'){var _0x10d2f2=_0x52b401[_0x24e2('0x23')]({'plain':!![]});var _0x41ce5c=_0x24e2('0x4a');return db[_0x24e2('0x4b')][_0x24e2('0x45')]({'where':{'name':_0x41ce5c,'userProfileId':_0x474b67['userProfileId']},'raw':!![]})[_0x24e2('0x22')](function(_0x1d5cc5){if(_0x1d5cc5&&_0x1d5cc5[_0x24e2('0x4d')]===0x0){return db[_0x24e2('0x4e')][_0x24e2('0x46')]({'name':_0x10d2f2[_0x24e2('0x28')],'resourceId':_0x10d2f2['id'],'type':_0x1d5cc5[_0x24e2('0x28')],'sectionId':_0x1d5cc5['id']},{})['then'](function(){return _0x52b401;});}else{return _0x52b401;}})[_0x24e2('0x4f')](function(_0x12b20d){logger[_0x24e2('0x26')](_0x24e2('0x56'),_0x12b20d);throw _0x12b20d;});}return _0x52b401;});}})[_0x24e2('0x22')](respondWithResult(_0x592be3,0xc9))[_0x24e2('0x4f')](handleError(_0x592be3,null));};exports[_0x24e2('0x21')]=function(_0x139ed0,_0x167292){if(_0x139ed0['body']['id']){delete _0x139ed0[_0x24e2('0x53')]['id'];}return db['Dashboard'][_0x24e2('0x45')]({'where':{'id':_0x139ed0[_0x24e2('0x44')]['id']}})[_0x24e2('0x22')](handleEntityNotFound(_0x167292,null))['then'](saveUpdates(_0x139ed0[_0x24e2('0x53')],null))[_0x24e2('0x22')](respondWithResult(_0x167292,null))[_0x24e2('0x4f')](handleError(_0x167292,null));};exports[_0x24e2('0x24')]=function(_0xd8976b,_0x1db554){return db[_0x24e2('0x2b')][_0x24e2('0x45')]({'where':{'id':_0xd8976b[_0x24e2('0x44')]['id']}})['then'](handleEntityNotFound(_0x1db554,null))[_0x24e2('0x22')](removeEntity(_0x1db554,null))['catch'](handleError(_0x1db554,null));};function widgetAttributes(_0x2b5132){try{switch(_0x2b5132[_0x24e2('0x2e')]){case _0x24e2('0x57'):return[{'name':_0x24e2('0x58'),'value':_0x2b5132[_0x24e2('0x58')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x0]?_0x2b5132[_0x24e2('0x59')][0x0][_0x24e2('0x5a')]:undefined)||_0x24e2('0x5b')}];case'custom':return[{'name':_0x24e2('0x5c'),'value':_0x2b5132[_0x24e2('0x5c')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132['attrs'][0x0]?_0x2b5132[_0x24e2('0x59')][0x0][_0x24e2('0x5a')]:undefined)||''}];case _0x24e2('0x5d'):return[{'name':'attrHourFormat','value':_0x2b5132[_0x24e2('0x5e')]||(_0x2b5132['attrs']&&_0x2b5132[_0x24e2('0x59')][0x0]?_0x2b5132[_0x24e2('0x59')][0x0][_0x24e2('0x5a')]:undefined)||'HH:mm:ss'},{'name':_0x24e2('0x5f'),'value':_0x2b5132[_0x24e2('0x5f')]||(_0x2b5132['attrs']&&_0x2b5132[_0x24e2('0x59')][0x1]?_0x2b5132[_0x24e2('0x59')][0x1][_0x24e2('0x5a')]:undefined)||'0.00'},{'name':_0x24e2('0x60'),'value':_0x2b5132[_0x24e2('0x60')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x2]?_0x2b5132[_0x24e2('0x59')][0x2][_0x24e2('0x5a')]:undefined)||0xc}];case _0x24e2('0x61'):return[{'name':_0x24e2('0x62'),'value':_0x2b5132[_0x24e2('0x62')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x0]?_0x2b5132['attrs'][0x0][_0x24e2('0x5a')]:undefined)||_0x24e2('0x63')},{'name':_0x24e2('0x64'),'value':_0x2b5132[_0x24e2('0x64')]||(_0x2b5132['attrs']&&_0x2b5132[_0x24e2('0x59')][0x1]?_0x2b5132['attrs'][0x1][_0x24e2('0x5a')]:undefined)||[]},{'name':_0x24e2('0x60'),'value':_0x2b5132[_0x24e2('0x60')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x2]?_0x2b5132[_0x24e2('0x59')][0x2][_0x24e2('0x5a')]:undefined)||0x14}];case'multibar-chart':case _0x24e2('0x65'):return[{'name':'attrSerie1','value':_0x2b5132['attrSerie1']||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x0]?_0x2b5132[_0x24e2('0x59')][0x0][_0x24e2('0x5a')]:undefined)||_0x24e2('0x63')},{'name':_0x24e2('0x66'),'value':_0x2b5132[_0x24e2('0x66')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x1]?_0x2b5132[_0x24e2('0x59')][0x1][_0x24e2('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x2b5132[_0x24e2('0x67')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x2]?_0x2b5132['attrs'][0x2]['value']:undefined)||null},{'name':_0x24e2('0x64'),'value':_0x2b5132[_0x24e2('0x64')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x3]?_0x2b5132[_0x24e2('0x59')][0x3]['value']:undefined)||[]}];case _0x24e2('0x68'):return[{'name':_0x24e2('0x69'),'type':_0x2b5132[_0x24e2('0x6a')]||(_0x2b5132['attrs']&&_0x2b5132['attrs'][0x0]?_0x2b5132[_0x24e2('0x59')][0x0][_0x24e2('0x2e')]:undefined)||null,'value':_0x2b5132[_0x24e2('0x69')]||(_0x2b5132[_0x24e2('0x59')]&&_0x2b5132[_0x24e2('0x59')][0x0]?_0x2b5132[_0x24e2('0x59')][0x0][_0x24e2('0x5a')]:undefined)||null},{'name':_0x24e2('0x6b'),'value':_0x2b5132[_0x24e2('0x6b')]||(_0x2b5132['attrs']&&_0x2b5132[_0x24e2('0x59')][0x1]?_0x2b5132[_0x24e2('0x59')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3f1d6f){logger[_0x24e2('0x26')](_0x24e2('0x6c'),JSON[_0x24e2('0x6d')](_0x3f1d6f));return[];}}exports['addItem']=function(_0x2d0815,_0xe04a8a,_0x287ff3){if(_0x2d0815[_0x24e2('0x53')]['id']){delete _0x2d0815[_0x24e2('0x53')]['id'];}return db[_0x24e2('0x2b')][_0x24e2('0x45')]({'where':{'id':_0x2d0815['params']['id']}})[_0x24e2('0x22')](handleEntityNotFound(_0xe04a8a,null))[_0x24e2('0x22')](function(_0x1a974b){if(_0x1a974b){_0x2d0815[_0x24e2('0x53')][_0x24e2('0x6e')]=_0x1a974b['id'];_0x2d0815[_0x24e2('0x53')][_0x24e2('0x59')]=widgetAttributes(_0x2d0815[_0x24e2('0x53')]);return db[_0x24e2('0x6f')][_0x24e2('0x46')](_0x2d0815[_0x24e2('0x53')]);}})[_0x24e2('0x22')](respondWithResult(_0xe04a8a,null))[_0x24e2('0x4f')](handleError(_0xe04a8a,null));};exports[_0x24e2('0x70')]=function(_0x5d7085,_0x137a36,_0x1be565){var _0x2446ed={};var _0x2d84be={};var _0x4d14cc;var _0x285cff;return db['Dashboard'][_0x24e2('0x71')]({'where':{'id':_0x5d7085[_0x24e2('0x44')]['id']}})['then'](handleEntityNotFound(_0x137a36,null))[_0x24e2('0x22')](function(_0x33e965){if(_0x33e965){_0x4d14cc=_0x33e965;_0x2d84be[_0x24e2('0x30')]=_['keys'](db[_0x24e2('0x6f')][_0x24e2('0x2c')]);_0x2d84be[_0x24e2('0x31')]=_[_0x24e2('0x32')](_0x5d7085[_0x24e2('0x31')]);_0x2d84be['filters']=_['intersection'](_0x2d84be['model'],_0x2d84be[_0x24e2('0x31')]);_0x2446ed['attributes']=_[_0x24e2('0x34')](_0x2d84be[_0x24e2('0x30')],qs[_0x24e2('0x36')](_0x5d7085[_0x24e2('0x31')][_0x24e2('0x36')]));_0x2446ed['attributes']=_0x2446ed['attributes'][_0x24e2('0x37')]?_0x2446ed['attributes']:_0x2d84be['model'];_0x2446ed[_0x24e2('0x3a')]=qs[_0x24e2('0x3b')](_0x5d7085[_0x24e2('0x31')][_0x24e2('0x3b')]);_0x2446ed[_0x24e2('0x3c')]=qs[_0x24e2('0x33')](_[_0x24e2('0x3d')](_0x5d7085[_0x24e2('0x31')],_0x2d84be[_0x24e2('0x33')]));if(_0x5d7085[_0x24e2('0x31')][_0x24e2('0x72')]){_0x2446ed['where']=_[_0x24e2('0x3e')](_0x2446ed[_0x24e2('0x3c')],{'$or':_[_0x24e2('0x2a')](_0x2446ed[_0x24e2('0x35')],function(_0x166875){var _0x57896a={};_0x57896a[_0x166875]={'$like':'%'+_0x5d7085['query'][_0x24e2('0x72')]+'%'};return _0x57896a;})});}_0x2446ed=_[_0x24e2('0x3e')]({},_0x2446ed,_0x5d7085['options']);return _0x4d14cc[_0x24e2('0x70')](_0x2446ed);}})[_0x24e2('0x22')](function(_0x3c2778){if(_0x3c2778){_0x285cff=_0x3c2778[_0x24e2('0x37')];if(!_0x5d7085['query'][_0x24e2('0x38')](_0x24e2('0x39'))){_0x2446ed[_0x24e2('0x1c')]=qs['limit'](_0x5d7085['query'][_0x24e2('0x1c')]);_0x2446ed['offset']=qs[_0x24e2('0x1b')](_0x5d7085[_0x24e2('0x31')][_0x24e2('0x1b')]);}return _0x4d14cc['getItems'](_0x2446ed);}})[_0x24e2('0x22')](function(_0x5eb28b){if(_0x5eb28b){return _0x5eb28b?{'count':_0x285cff,'rows':_0x5eb28b}:null;}})[_0x24e2('0x22')](respondWithResult(_0x137a36,null))[_0x24e2('0x4f')](handleError(_0x137a36,null));}; \ No newline at end of file +var _0x1124=['get','CustomDashboards','error','name','send','index','Dashboard','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','updatedAt','createdAt','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','total','attrVoiceQueues','attrFontSize','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','stringify','DashboardId','DashboardItem','findOne','getItems','nolimit','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy'];(function(_0x20c503,_0x31cb6){var _0x46141a=function(_0x4821e6){while(--_0x4821e6){_0x20c503['push'](_0x20c503['shift']());}};_0x46141a(++_0x31cb6);}(_0x1124,0x1aa));var _0x4112=function(_0x562c4e,_0x2a2030){_0x562c4e=_0x562c4e-0x0;var _0x52fcec=_0x1124[_0x562c4e];return _0x52fcec;};'use strict';var pdf=require(_0x4112('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4112('0x1'));var zipdir=require(_0x4112('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4112('0x3'));var BPromise=require(_0x4112('0x4'));var Mustache=require(_0x4112('0x5'));var util=require('util');var path=require(_0x4112('0x6'));var sox=require(_0x4112('0x7'));var csv=require('to-csv');var ejs=require(_0x4112('0x8'));var fs=require('fs');var _=require(_0x4112('0x9'));var squel=require(_0x4112('0xa'));var crypto=require(_0x4112('0xb'));var jsforce=require(_0x4112('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4112('0xd'));var Redis=require(_0x4112('0xe'));var authService=require(_0x4112('0xf'));var qs=require(_0x4112('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4112('0x11'))(_0x4112('0x12'));var utils=require(_0x4112('0x13'));var config=require(_0x4112('0x14'));var db=require(_0x4112('0x15'))['db'];config[_0x4112('0x16')]=_['defaults'](config[_0x4112('0x16')],{'host':_0x4112('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4112('0x16')]));require(_0x4112('0x18'))[_0x4112('0x19')](socket);function respondWithStatusCode(_0x302cfe,_0x2b61c9){_0x2b61c9=_0x2b61c9||0xcc;return function(_0x695489){if(_0x695489){return _0x302cfe[_0x4112('0x1a')](_0x2b61c9);}return _0x302cfe[_0x4112('0x1b')](_0x2b61c9)[_0x4112('0x1c')]();};}function respondWithResult(_0x5c0ff4,_0x8588ef){_0x8588ef=_0x8588ef||0xc8;return function(_0x44232d){if(_0x44232d){return _0x5c0ff4[_0x4112('0x1b')](_0x8588ef)[_0x4112('0x1d')](_0x44232d);}};}function respondWithFilteredResult(_0x4ef017,_0x4b4b62){return function(_0x5037da){if(_0x5037da){var _0x1c0d90=_0x5037da['count'],_0x4b8b69=_0x4b4b62[_0x4112('0x1e')],_0x4cb043=_0x4b4b62[_0x4112('0x1e')]+_0x4b4b62[_0x4112('0x1f')],_0xd972c6;if(_0x4cb043>=_0x1c0d90){_0x4cb043=_0x1c0d90;_0xd972c6=0xc8;}else{_0xd972c6=0xce;}_0x4ef017[_0x4112('0x1b')](_0xd972c6);return _0x4ef017['set'](_0x4112('0x20'),_0x4b8b69+'-'+_0x4cb043+'/'+_0x1c0d90)[_0x4112('0x1d')](_0x5037da);}return null;};}function patchUpdates(_0x25d18e){return function(_0x23b3a1){try{jsonpatch['apply'](_0x23b3a1,_0x25d18e,!![]);}catch(_0x3b8b56){return BPromise[_0x4112('0x21')](_0x3b8b56);}return _0x23b3a1[_0x4112('0x22')]();};}function saveUpdates(_0x23ba2f,_0x1fe57b){return function(_0x201a3d){if(_0x201a3d){return _0x201a3d[_0x4112('0x23')](_0x23ba2f)[_0x4112('0x24')](function(_0x41a596){return _0x41a596;});}return null;};}function removeEntity(_0x30244a,_0x3cb27b){return function(_0x5422bc){if(_0x5422bc){return _0x5422bc[_0x4112('0x25')]()[_0x4112('0x24')](function(){var _0x35e29a=_0x5422bc[_0x4112('0x26')]({'plain':!![]});var _0x1b5c30=_0x4112('0x27');return db['UserProfileResource'][_0x4112('0x25')]({'where':{'type':_0x1b5c30,'resourceId':_0x35e29a['id']}})[_0x4112('0x24')](function(){return _0x5422bc;});})[_0x4112('0x24')](function(){_0x30244a[_0x4112('0x1b')](0xcc)[_0x4112('0x1c')]();});}};}function handleEntityNotFound(_0x4e804f,_0x40b93e){return function(_0x4957ba){if(!_0x4957ba){_0x4e804f[_0x4112('0x1a')](0x194);}return _0x4957ba;};}function handleError(_0x268351,_0x50da0f){_0x50da0f=_0x50da0f||0x1f4;return function(_0x643ee7){logger[_0x4112('0x28')](_0x643ee7['stack']);if(_0x643ee7[_0x4112('0x29')]){delete _0x643ee7[_0x4112('0x29')];}_0x268351[_0x4112('0x1b')](_0x50da0f)[_0x4112('0x2a')](_0x643ee7);};}exports[_0x4112('0x2b')]=function(_0x498137,_0x24617e){var _0x220638={},_0x2cfc71={},_0x711e51={'count':0x0,'rows':[]};var _0x1fb57d=_['map'](db[_0x4112('0x2c')][_0x4112('0x2d')],function(_0x265b23){return{'name':_0x265b23[_0x4112('0x2e')],'type':_0x265b23[_0x4112('0x2f')][_0x4112('0x30')]};});_0x2cfc71['model']=_[_0x4112('0x31')](_0x1fb57d,_0x4112('0x29'));_0x2cfc71[_0x4112('0x32')]=_['keys'](_0x498137['query']);_0x2cfc71[_0x4112('0x33')]=_['intersection'](_0x2cfc71['model'],_0x2cfc71[_0x4112('0x32')]);_0x220638[_0x4112('0x34')]=_[_0x4112('0x35')](_0x2cfc71[_0x4112('0x36')],qs['fields'](_0x498137['query'][_0x4112('0x37')]));_0x220638['attributes']=_0x220638[_0x4112('0x34')][_0x4112('0x38')]?_0x220638[_0x4112('0x34')]:_0x2cfc71['model'];if(!_0x498137[_0x4112('0x32')][_0x4112('0x39')]('nolimit')){_0x220638[_0x4112('0x1f')]=qs['limit'](_0x498137[_0x4112('0x32')][_0x4112('0x1f')]);_0x220638[_0x4112('0x1e')]=qs[_0x4112('0x1e')](_0x498137[_0x4112('0x32')]['offset']);}_0x220638[_0x4112('0x3a')]=qs['sort'](_0x498137['query'][_0x4112('0x3b')]);_0x220638[_0x4112('0x3c')]=qs[_0x4112('0x33')](_[_0x4112('0x3d')](_0x498137[_0x4112('0x32')],_0x2cfc71[_0x4112('0x33')]),_0x1fb57d);if(_0x498137[_0x4112('0x32')][_0x4112('0x3e')]){_0x220638[_0x4112('0x3c')]=_[_0x4112('0x3f')](_0x220638[_0x4112('0x3c')],{'$or':_[_0x4112('0x31')](_0x1fb57d,function(_0x57ef6f){if(_0x57ef6f[_0x4112('0x2f')]!==_0x4112('0x40')){var _0xafd389={};_0xafd389[_0x57ef6f[_0x4112('0x29')]]={'$like':'%'+_0x498137['query'][_0x4112('0x3e')]+'%'};return _0xafd389;}})});}_0x220638=_[_0x4112('0x3f')]({},_0x220638,_0x498137['options']);var _0x44b637={'where':_0x220638[_0x4112('0x3c')]};return db['Dashboard'][_0x4112('0x41')](_0x44b637)[_0x4112('0x24')](function(_0x19e062){_0x711e51[_0x4112('0x41')]=_0x19e062;if(_0x498137[_0x4112('0x32')][_0x4112('0x42')]){_0x220638['include']=[{'all':!![]}];}return db[_0x4112('0x2c')][_0x4112('0x43')](_0x220638);})['then'](function(_0x51c45b){_0x711e51[_0x4112('0x44')]=_0x51c45b;return _0x711e51;})[_0x4112('0x24')](respondWithFilteredResult(_0x24617e,_0x220638))[_0x4112('0x45')](handleError(_0x24617e,null));};exports[_0x4112('0x46')]=function(_0x1df12a,_0x4ddec3){var _0x4d2f80={'raw':![],'where':{'id':_0x1df12a[_0x4112('0x47')]['id']}},_0x8fc62f={};_0x8fc62f[_0x4112('0x36')]=_['keys'](db[_0x4112('0x2c')][_0x4112('0x2d')]);_0x8fc62f[_0x4112('0x32')]=_['keys'](_0x1df12a[_0x4112('0x32')]);_0x8fc62f[_0x4112('0x33')]=_[_0x4112('0x35')](_0x8fc62f[_0x4112('0x36')],_0x8fc62f[_0x4112('0x32')]);_0x4d2f80['attributes']=_[_0x4112('0x35')](_0x8fc62f['model'],qs[_0x4112('0x37')](_0x1df12a[_0x4112('0x32')][_0x4112('0x37')]));_0x4d2f80['attributes']=_0x4d2f80[_0x4112('0x34')][_0x4112('0x38')]?_0x4d2f80[_0x4112('0x34')]:_0x8fc62f[_0x4112('0x36')];if(_0x1df12a[_0x4112('0x32')][_0x4112('0x42')]){_0x4d2f80[_0x4112('0x48')]=[{'all':!![]}];}_0x4d2f80=_['merge']({},_0x4d2f80,_0x1df12a[_0x4112('0x49')]);return db['Dashboard'][_0x4112('0x4a')](_0x4d2f80)['then'](handleEntityNotFound(_0x4ddec3,null))['then'](respondWithResult(_0x4ddec3,null))['catch'](handleError(_0x4ddec3,null));};exports[_0x4112('0x4b')]=function(_0x2019b3,_0x36f6ee){return db[_0x4112('0x2c')][_0x4112('0x4b')](_0x2019b3[_0x4112('0x4c')],{})[_0x4112('0x24')](function(_0x104966){var _0x3c176e=_0x2019b3['user'][_0x4112('0x26')]({'plain':!![]});if(!_0x3c176e)throw new Error(_0x4112('0x4d'));if(_0x3c176e[_0x4112('0x4e')]===_0x4112('0x4f')){var _0x3c6794=_0x104966[_0x4112('0x26')]({'plain':!![]});var _0x55d0fe=_0x4112('0x27');return db[_0x4112('0x50')][_0x4112('0x4a')]({'where':{'name':_0x55d0fe,'userProfileId':_0x3c176e[_0x4112('0x51')]},'raw':!![]})['then'](function(_0x476420){if(_0x476420&&_0x476420[_0x4112('0x52')]===0x0){return db[_0x4112('0x53')][_0x4112('0x4b')]({'name':_0x3c6794[_0x4112('0x29')],'resourceId':_0x3c6794['id'],'type':_0x476420[_0x4112('0x29')],'sectionId':_0x476420['id']},{})[_0x4112('0x24')](function(){return _0x104966;});}else{return _0x104966;}})[_0x4112('0x45')](function(_0x3165c4){logger[_0x4112('0x28')](_0x4112('0x54'),_0x3165c4);throw _0x3165c4;});}return _0x104966;})[_0x4112('0x24')](respondWithResult(_0x36f6ee,0xc9))[_0x4112('0x45')](handleError(_0x36f6ee,null));};exports[_0x4112('0x55')]=function(_0x635faf,_0x134e9d){var _0x40f1fb={'where':{'id':_0x635faf[_0x4112('0x47')]['id']}},_0x4135ae={};_0x4135ae[_0x4112('0x36')]=_[_0x4112('0x56')](db[_0x4112('0x2c')]['rawAttributes']);_0x40f1fb[_0x4112('0x34')]=_[_0x4112('0x35')](_0x4135ae[_0x4112('0x36')],qs['fields'](_0x635faf[_0x4112('0x32')][_0x4112('0x37')]));_0x40f1fb[_0x4112('0x34')]=_0x40f1fb[_0x4112('0x34')][_0x4112('0x38')]?_0x40f1fb['attributes']:_0x4135ae['model'];if(_0x635faf[_0x4112('0x32')][_0x4112('0x42')]){_0x40f1fb[_0x4112('0x48')]=[{'all':!![]}];}_0x40f1fb=_['merge']({},_0x40f1fb,_0x635faf[_0x4112('0x49')]);return db[_0x4112('0x2c')]['find'](_0x40f1fb)[_0x4112('0x24')](handleEntityNotFound(_0x134e9d,null))[_0x4112('0x24')](function(_0x519d54){if(_0x519d54){var _0x460d6a=_0x519d54['get']({'plain':!![]});_0x460d6a=qs[_0x4112('0x57')](_0x460d6a,['id','createdAt',_0x4112('0x58')]);_0x635faf[_0x4112('0x4c')]=_['omit'](_0x635faf[_0x4112('0x4c')],['id',_0x4112('0x59'),_0x4112('0x58')]);return db['Dashboard'][_0x4112('0x4b')](_['merge'](_0x460d6a,_0x635faf[_0x4112('0x4c')]),{'include':_0x635faf['query'][_0x4112('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0xef6871){var _0x129665=_0x635faf[_0x4112('0x4f')]['get']({'plain':!![]});if(!_0x129665)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x129665[_0x4112('0x4e')]===_0x4112('0x4f')){var _0x3c9116=_0xef6871['get']({'plain':!![]});var _0x3ca846='CustomDashboards';return db[_0x4112('0x50')][_0x4112('0x4a')]({'where':{'name':_0x3ca846,'userProfileId':_0x129665[_0x4112('0x51')]},'raw':!![]})[_0x4112('0x24')](function(_0x33ef9f){if(_0x33ef9f&&_0x33ef9f[_0x4112('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c9116['name'],'resourceId':_0x3c9116['id'],'type':_0x33ef9f[_0x4112('0x29')],'sectionId':_0x33ef9f['id']},{})['then'](function(){return _0xef6871;});}else{return _0xef6871;}})[_0x4112('0x45')](function(_0x505a9c){logger[_0x4112('0x28')](_0x4112('0x54'),_0x505a9c);throw _0x505a9c;});}return _0xef6871;});}})[_0x4112('0x24')](respondWithResult(_0x134e9d,0xc9))[_0x4112('0x45')](handleError(_0x134e9d,null));};exports['update']=function(_0x139451,_0x42fd0a){if(_0x139451[_0x4112('0x4c')]['id']){delete _0x139451[_0x4112('0x4c')]['id'];}return db[_0x4112('0x2c')]['find']({'where':{'id':_0x139451[_0x4112('0x47')]['id']}})[_0x4112('0x24')](handleEntityNotFound(_0x42fd0a,null))['then'](saveUpdates(_0x139451[_0x4112('0x4c')],null))[_0x4112('0x24')](respondWithResult(_0x42fd0a,null))[_0x4112('0x45')](handleError(_0x42fd0a,null));};exports[_0x4112('0x25')]=function(_0x3f6a11,_0x17ed47){return db['Dashboard'][_0x4112('0x4a')]({'where':{'id':_0x3f6a11[_0x4112('0x47')]['id']}})[_0x4112('0x24')](handleEntityNotFound(_0x17ed47,null))[_0x4112('0x24')](removeEntity(_0x17ed47,null))['catch'](handleError(_0x17ed47,null));};function widgetAttributes(_0x25e83d){try{switch(_0x25e83d[_0x4112('0x2f')]){case'iframe':return[{'name':_0x4112('0x5a'),'value':_0x25e83d[_0x4112('0x5a')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d[_0x4112('0x5b')][0x0]['value']:undefined)||_0x4112('0x5c')}];case _0x4112('0x5d'):return[{'name':_0x4112('0x5e'),'value':_0x25e83d[_0x4112('0x5e')]||(_0x25e83d['attrs']&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d[_0x4112('0x5b')][0x0][_0x4112('0x5f')]:undefined)||''}];case _0x4112('0x60'):return[{'name':_0x4112('0x61'),'value':_0x25e83d[_0x4112('0x61')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d['attrs'][0x0][_0x4112('0x5f')]:undefined)||_0x4112('0x62')},{'name':'attrTimezone','value':_0x25e83d['attrTimezone']||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x1]?_0x25e83d[_0x4112('0x5b')][0x1][_0x4112('0x5f')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x25e83d['attrFontSize']||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x2]?_0x25e83d[_0x4112('0x5b')][0x2][_0x4112('0x5f')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x25e83d['attrMetric']||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d['attrs'][0x0][_0x4112('0x5f')]:undefined)||_0x4112('0x63')},{'name':_0x4112('0x64'),'value':_0x25e83d['attrVoiceQueues']||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x1]?_0x25e83d[_0x4112('0x5b')][0x1][_0x4112('0x5f')]:undefined)||[]},{'name':_0x4112('0x65'),'value':_0x25e83d[_0x4112('0x65')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x2]?_0x25e83d['attrs'][0x2][_0x4112('0x5f')]:undefined)||0x14}];case _0x4112('0x66'):case _0x4112('0x67'):return[{'name':'attrSerie1','value':_0x25e83d[_0x4112('0x68')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d['attrs'][0x0]['value']:undefined)||_0x4112('0x63')},{'name':'attrSerie2','value':_0x25e83d[_0x4112('0x69')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x1]?_0x25e83d[_0x4112('0x5b')][0x1]['value']:undefined)||null},{'name':_0x4112('0x6a'),'value':_0x25e83d[_0x4112('0x6a')]||(_0x25e83d['attrs']&&_0x25e83d['attrs'][0x2]?_0x25e83d[_0x4112('0x5b')][0x2]['value']:undefined)||null},{'name':_0x4112('0x64'),'value':_0x25e83d[_0x4112('0x64')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x3]?_0x25e83d[_0x4112('0x5b')][0x3][_0x4112('0x5f')]:undefined)||[]}];case _0x4112('0x6b'):return[{'name':'attrReport','type':_0x25e83d[_0x4112('0x6c')]||(_0x25e83d['attrs']&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d[_0x4112('0x5b')][0x0]['type']:undefined)||null,'value':_0x25e83d['attrReport']||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x0]?_0x25e83d['attrs'][0x0][_0x4112('0x5f')]:undefined)||null},{'name':_0x4112('0x6d'),'value':_0x25e83d[_0x4112('0x6d')]||(_0x25e83d[_0x4112('0x5b')]&&_0x25e83d[_0x4112('0x5b')][0x1]?_0x25e83d[_0x4112('0x5b')][0x1][_0x4112('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x22a2e2){logger[_0x4112('0x28')]('widgetAttributes:\x20%s',JSON[_0x4112('0x6e')](_0x22a2e2));return[];}}exports['addItem']=function(_0x29efbc,_0x598c9e,_0x245093){if(_0x29efbc['body']['id']){delete _0x29efbc['body']['id'];}return db[_0x4112('0x2c')][_0x4112('0x4a')]({'where':{'id':_0x29efbc[_0x4112('0x47')]['id']}})['then'](handleEntityNotFound(_0x598c9e,null))[_0x4112('0x24')](function(_0x293b05){if(_0x293b05){_0x29efbc[_0x4112('0x4c')][_0x4112('0x6f')]=_0x293b05['id'];_0x29efbc[_0x4112('0x4c')]['attrs']=widgetAttributes(_0x29efbc[_0x4112('0x4c')]);return db[_0x4112('0x70')]['create'](_0x29efbc[_0x4112('0x4c')]);}})['then'](respondWithResult(_0x598c9e,null))['catch'](handleError(_0x598c9e,null));};exports['getItems']=function(_0xdfbce3,_0x228bfe,_0x273612){var _0x4c070f={};var _0x5782ea={};var _0x327bc1;var _0x48adb5;return db[_0x4112('0x2c')][_0x4112('0x71')]({'where':{'id':_0xdfbce3[_0x4112('0x47')]['id']}})[_0x4112('0x24')](handleEntityNotFound(_0x228bfe,null))[_0x4112('0x24')](function(_0x39732e){if(_0x39732e){_0x327bc1=_0x39732e;_0x5782ea['model']=_[_0x4112('0x56')](db[_0x4112('0x70')]['rawAttributes']);_0x5782ea[_0x4112('0x32')]=_['keys'](_0xdfbce3[_0x4112('0x32')]);_0x5782ea['filters']=_[_0x4112('0x35')](_0x5782ea[_0x4112('0x36')],_0x5782ea['query']);_0x4c070f[_0x4112('0x34')]=_['intersection'](_0x5782ea[_0x4112('0x36')],qs[_0x4112('0x37')](_0xdfbce3['query']['fields']));_0x4c070f[_0x4112('0x34')]=_0x4c070f[_0x4112('0x34')]['length']?_0x4c070f[_0x4112('0x34')]:_0x5782ea['model'];_0x4c070f[_0x4112('0x3a')]=qs['sort'](_0xdfbce3[_0x4112('0x32')][_0x4112('0x3b')]);_0x4c070f['where']=qs[_0x4112('0x33')](_[_0x4112('0x3d')](_0xdfbce3[_0x4112('0x32')],_0x5782ea[_0x4112('0x33')]));if(_0xdfbce3['query'][_0x4112('0x3e')]){_0x4c070f[_0x4112('0x3c')]=_['merge'](_0x4c070f[_0x4112('0x3c')],{'$or':_['map'](_0x4c070f[_0x4112('0x34')],function(_0x3df299){var _0x100898={};_0x100898[_0x3df299]={'$like':'%'+_0xdfbce3['query'][_0x4112('0x3e')]+'%'};return _0x100898;})});}_0x4c070f=_['merge']({},_0x4c070f,_0xdfbce3[_0x4112('0x49')]);return _0x327bc1[_0x4112('0x72')](_0x4c070f);}})[_0x4112('0x24')](function(_0xe08ce0){if(_0xe08ce0){_0x48adb5=_0xe08ce0['length'];if(!_0xdfbce3[_0x4112('0x32')][_0x4112('0x39')](_0x4112('0x73'))){_0x4c070f['limit']=qs[_0x4112('0x1f')](_0xdfbce3[_0x4112('0x32')][_0x4112('0x1f')]);_0x4c070f[_0x4112('0x1e')]=qs[_0x4112('0x1e')](_0xdfbce3[_0x4112('0x32')]['offset']);}return _0x327bc1[_0x4112('0x72')](_0x4c070f);}})[_0x4112('0x24')](function(_0x5f5b0b){if(_0x5f5b0b){return _0x5f5b0b?{'count':_0x48adb5,'rows':_0x5f5b0b}:null;}})[_0x4112('0x24')](respondWithResult(_0x228bfe,null))[_0x4112('0x45')](handleError(_0x228bfe,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 917e38b..31f8d9e 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 _0x7365=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x1e3c58,_0x4baead){var _0x2cd780=function(_0x2e4fe1){while(--_0x2e4fe1){_0x1e3c58['push'](_0x1e3c58['shift']());}};_0x2cd780(++_0x4baead);}(_0x7365,0x69));var _0x5736=function(_0x4cbb8e,_0x1047c8){_0x4cbb8e=_0x4cbb8e-0x0;var _0x17846f=_0x7365[_0x4cbb8e];return _0x17846f;};'use strict';var EventEmitter=require(_0x5736('0x0'));var Dashboard=require(_0x5736('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5736('0x2'),'afterUpdate':_0x5736('0x3'),'afterDestroy':_0x5736('0x4')};function emitEvent(_0x558ee5){return function(_0x2fe061,_0xb7e206,_0x41901a){DashboardEvents[_0x5736('0x5')](_0x558ee5+':'+_0x2fe061['id'],_0x2fe061);DashboardEvents[_0x5736('0x5')](_0x558ee5,_0x2fe061);_0x41901a(null);};}for(var e in events){if(events[_0x5736('0x6')](e)){var event=events[e];Dashboard[_0x5736('0x7')](e,emitEvent(event));}}module[_0x5736('0x8')]=DashboardEvents; \ No newline at end of file +var _0x819e=['hasOwnProperty','hook','exports','events','Dashboard','update','remove','emit'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x819e,0x12b));var _0xe819=function(_0xdc0397,_0x20d1f1){_0xdc0397=_0xdc0397-0x0;var _0x553d02=_0x819e[_0xdc0397];return _0x553d02;};'use strict';var EventEmitter=require(_0xe819('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xe819('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe819('0x2'),'afterDestroy':_0xe819('0x3')};function emitEvent(_0x381788){return function(_0x48fc14,_0x1f36bf,_0x4365f7){DashboardEvents['emit'](_0x381788+':'+_0x48fc14['id'],_0x48fc14);DashboardEvents[_0xe819('0x4')](_0x381788,_0x48fc14);_0x4365f7(null);};}for(var e in events){if(events[_0xe819('0x5')](e)){var event=events[e];Dashboard[_0xe819('0x6')](e,emitEvent(event));}}module[_0xe819('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2387efa..4b08c19 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 _0x515e=['dashboards','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports','define','Dashboard'];(function(_0x1fb653,_0x38b7a0){var _0x3693f7=function(_0x14a7b1){while(--_0x14a7b1){_0x1fb653['push'](_0x1fb653['shift']());}};_0x3693f7(++_0x38b7a0);}(_0x515e,0xdd));var _0xe515=function(_0x595e7b,_0x32000d){_0x595e7b=_0x595e7b-0x0;var _0x330302=_0x515e[_0x595e7b];return _0x330302;};'use strict';var _=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe515('0x2'));var BPromise=require(_0xe515('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe515('0x4'));var rimraf=require(_0xe515('0x5'));var config=require(_0xe515('0x6'));var attributes=require('./dashboard.attributes');module[_0xe515('0x7')]=function(_0x45a315,_0x369240){return _0x45a315[_0xe515('0x8')](_0xe515('0x9'),attributes,{'tableName':_0xe515('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeb7=['path','../../config/environment','exports','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f880a,_0x4551fb){var _0x5bef2a=function(_0x30f395){while(--_0x30f395){_0x2f880a['push'](_0x2f880a['shift']());}};_0x5bef2a(++_0x4551fb);}(_0xfeb7,0x1b5));var _0x7feb=function(_0x1354d3,_0x9b4339){_0x1354d3=_0x1354d3-0x0;var _0x445c79=_0xfeb7[_0x1354d3];return _0x445c79;};'use strict';var _=require(_0x7feb('0x0'));var util=require(_0x7feb('0x1'));var logger=require(_0x7feb('0x2'))(_0x7feb('0x3'));var moment=require(_0x7feb('0x4'));var BPromise=require(_0x7feb('0x5'));var rp=require(_0x7feb('0x6'));var fs=require('fs');var path=require(_0x7feb('0x7'));var rimraf=require('rimraf');var config=require(_0x7feb('0x8'));var attributes=require('./dashboard.attributes');module[_0x7feb('0x9')]=function(_0x474f39,_0x1b46a3){return _0x474f39[_0x7feb('0xa')](_0x7feb('0xb'),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 c99b958..8a486e5 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 _0x6d05=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x548918,_0xec9412){var _0x5b5a92=function(_0x214bbf){while(--_0x214bbf){_0x548918['push'](_0x548918['shift']());}};_0x5b5a92(++_0xec9412);}(_0x6d05,0x115));var _0x56d0=function(_0x518674,_0xc32a83){_0x518674=_0x518674-0x0;var _0xc5b91b=_0x6d05[_0x518674];return _0xc5b91b;};'use strict';var _=require('lodash');var util=require(_0x56d0('0x0'));var moment=require(_0x56d0('0x1'));var BPromise=require(_0x56d0('0x2'));var rs=require(_0x56d0('0x3'));var fs=require('fs');var Redis=require(_0x56d0('0x4'));var db=require(_0x56d0('0x5'))['db'];var utils=require(_0x56d0('0x6'));var logger=require(_0x56d0('0x7'))(_0x56d0('0x8'));var config=require(_0x56d0('0x9'));var jayson=require(_0x56d0('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x56d0('0xb')]=_[_0x56d0('0xc')](config[_0x56d0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x56d0('0xd'))(new Redis(config[_0x56d0('0xb')]));require(_0x56d0('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a4f23,_0x3ebc4d,_0x1f9ed9){return new BPromise(function(_0x2de1fd,_0x481d24){return client[_0x56d0('0xf')](_0x4a4f23,_0x1f9ed9)[_0x56d0('0x10')](function(_0x24430b){logger[_0x56d0('0x11')](_0x56d0('0x12'),_0x3ebc4d,_0x56d0('0x13'));logger[_0x56d0('0x14')](_0x56d0('0x15'),_0x3ebc4d,_0x56d0('0x13'),JSON[_0x56d0('0x16')](_0x24430b));if(_0x24430b[_0x56d0('0x17')]){if(_0x24430b['error'][_0x56d0('0x18')]===0x1f4){logger[_0x56d0('0x17')](_0x56d0('0x12'),_0x3ebc4d,_0x24430b[_0x56d0('0x17')][_0x56d0('0x19')]);return _0x481d24(_0x24430b[_0x56d0('0x17')][_0x56d0('0x19')]);}logger[_0x56d0('0x17')](_0x56d0('0x12'),_0x3ebc4d,_0x24430b[_0x56d0('0x17')][_0x56d0('0x19')]);return _0x2de1fd(_0x24430b[_0x56d0('0x17')][_0x56d0('0x19')]);}else{logger[_0x56d0('0x11')](_0x56d0('0x12'),_0x3ebc4d,_0x56d0('0x13'));_0x2de1fd(_0x24430b['result'][_0x56d0('0x19')]);}})[_0x56d0('0x1a')](function(_0x53bcca){logger[_0x56d0('0x17')](_0x56d0('0x12'),_0x3ebc4d,_0x53bcca);_0x481d24(_0x53bcca);});});} \ No newline at end of file +var _0x4562=['defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3fcbd4,_0x404e65){var _0x26d9ce=function(_0x2a8340){while(--_0x2a8340){_0x3fcbd4['push'](_0x3fcbd4['shift']());}};_0x26d9ce(++_0x404e65);}(_0x4562,0xb2));var _0x2456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4562[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2456('0x0'));var util=require(_0x2456('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2456('0x2'))['db'];var utils=require(_0x2456('0x3'));var logger=require(_0x2456('0x4'))(_0x2456('0x5'));var config=require(_0x2456('0x6'));var jayson=require(_0x2456('0x7'));var client=jayson[_0x2456('0x8')][_0x2456('0x9')]({'port':0x232a});config[_0x2456('0xa')]=_[_0x2456('0xb')](config[_0x2456('0xa')],{'host':_0x2456('0xc'),'port':0x18eb});var socket=require(_0x2456('0xd'))(new Redis(config[_0x2456('0xa')]));require(_0x2456('0xe'))['register'](socket);function respondWithRpcPromise(_0xe6c5bf,_0x444694,_0x11498b){return new BPromise(function(_0xb2592b,_0x1451cd){return client[_0x2456('0xf')](_0xe6c5bf,_0x11498b)[_0x2456('0x10')](function(_0x47bf40){logger['info'](_0x2456('0x11'),_0x444694,_0x2456('0x12'));logger[_0x2456('0x13')](_0x2456('0x14'),_0x444694,'request\x20sent',JSON['stringify'](_0x47bf40));if(_0x47bf40[_0x2456('0x15')]){if(_0x47bf40[_0x2456('0x15')][_0x2456('0x16')]===0x1f4){logger[_0x2456('0x15')]('Dashboard,\x20%s,\x20%s',_0x444694,_0x47bf40[_0x2456('0x15')][_0x2456('0x17')]);return _0x1451cd(_0x47bf40[_0x2456('0x15')][_0x2456('0x17')]);}logger[_0x2456('0x15')](_0x2456('0x11'),_0x444694,_0x47bf40[_0x2456('0x15')]['message']);return _0xb2592b(_0x47bf40[_0x2456('0x15')]['message']);}else{logger[_0x2456('0x18')](_0x2456('0x11'),_0x444694,'request\x20sent');_0xb2592b(_0x47bf40[_0x2456('0x19')][_0x2456('0x17')]);}})[_0x2456('0x1a')](function(_0x2c068a){logger['error'](_0x2456('0x11'),_0x444694,_0x2c068a);_0x1451cd(_0x2c068a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4f26302..54422f5 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 _0x9ae3=['register','dashboard:','./dashboard.events','save','update','emit'];(function(_0x3b660f,_0x45c3db){var _0x187a29=function(_0x11cedf){while(--_0x11cedf){_0x3b660f['push'](_0x3b660f['shift']());}};_0x187a29(++_0x45c3db);}(_0x9ae3,0x134));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var DashboardEvents=require(_0x39ae('0x0'));var events=[_0x39ae('0x1'),'remove',_0x39ae('0x2')];function createListener(_0x398afa,_0x2c2092){return function(_0x27412c){_0x2c2092[_0x39ae('0x3')](_0x398afa,_0x27412c);};}function removeListener(_0x411b78,_0xf791ee){return function(){DashboardEvents['removeListener'](_0x411b78,_0xf791ee);};}exports[_0x39ae('0x4')]=function(_0x4890c0){for(var _0xd0308=0x0,_0x36e4e7=events['length'];_0xd0308<_0x36e4e7;_0xd0308++){var _0x29512c=events[_0xd0308];var _0x2a422=createListener(_0x39ae('0x5')+_0x29512c,_0x4890c0);DashboardEvents['on'](_0x29512c,_0x2a422);}}; \ No newline at end of file +var _0x12f9=['length','save','remove','update','register'];(function(_0x201afc,_0x42d34c){var _0x3cba94=function(_0x621ab9){while(--_0x621ab9){_0x201afc['push'](_0x201afc['shift']());}};_0x3cba94(++_0x42d34c);}(_0x12f9,0x132));var _0x912f=function(_0x7bb376,_0xc5fc3d){_0x7bb376=_0x7bb376-0x0;var _0x4a5569=_0x12f9[_0x7bb376];return _0x4a5569;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x912f('0x0'),_0x912f('0x1'),_0x912f('0x2')];function createListener(_0xa1623,_0x1c7265){return function(_0x31dd24){_0x1c7265['emit'](_0xa1623,_0x31dd24);};}function removeListener(_0x37e722,_0x211f9e){return function(){DashboardEvents['removeListener'](_0x37e722,_0x211f9e);};}exports[_0x912f('0x3')]=function(_0x4a7590){for(var _0xdbd22b=0x0,_0x415928=events[_0x912f('0x4')];_0xdbd22b<_0x415928;_0xdbd22b++){var _0x5aa93e=events[_0xdbd22b];var _0x1f9514=createListener('dashboard:'+_0x5aa93e,_0x4a7590);DashboardEvents['on'](_0x5aa93e,_0x1f9514);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5e45068..5e8822e 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(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0xc69a0e,_0x42ed31){var _0x1d6157=function(_0x44e937){while(--_0x44e937){_0xc69a0e['push'](_0xc69a0e['shift']());}};_0x1d6157(++_0x42ed31);}(_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('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 77e156b..1482a88 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 _0x3195=['#2196f3','sequelize','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x40d6b0,_0x1e65bf){var _0x5159c2=function(_0x251e70){while(--_0x251e70){_0x40d6b0['push'](_0x40d6b0['shift']());}};_0x5159c2(++_0x1e65bf);}(_0x3195,0xd3));var _0x5319=function(_0x4ab3c3,_0x50fcd8){_0x4ab3c3=_0x4ab3c3-0x0;var _0x5346db=_0x3195[_0x4ab3c3];return _0x5346db;};'use strict';var Sequelize=require(_0x5319('0x0'));var squel=require(_0x5319('0x1'));var _=require('lodash');module[_0x5319('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5319('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5319('0x4')](_0x5319('0x5')),'get':function(){try{return JSON[_0x5319('0x6')](this[_0x5319('0x7')](_0x5319('0x8')));}catch(_0xa7ca56){return[];}},'set':function(_0x1246bf){try{this[_0x5319('0x9')](_0x5319('0x8'),JSON[_0x5319('0xa')](_0x1246bf));}catch(_0xdb3435){this[_0x5319('0x9')](_0x5319('0x8'),JSON[_0x5319('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x5319('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5319('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5319('0x3')],'allowNull':![],'defaultValue':_0x5319('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5319('0x3')],'allowNull':![],'defaultValue':_0x5319('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x912d=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x912d,0xca));var _0xd912=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x912d[_0x1044e5];return _0x5ad0dd;};'use strict';var Sequelize=require(_0xd912('0x0'));var squel=require(_0xd912('0x1'));var _=require(_0xd912('0x2'));module[_0xd912('0x3')]={'title':{'type':Sequelize[_0xd912('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xd912('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd912('0x5')]('long'),'get':function(){try{return JSON[_0xd912('0x6')](this[_0xd912('0x7')](_0xd912('0x8')));}catch(_0x44bde5){return[];}},'set':function(_0x1c675f){try{this['setDataValue']('attrs',JSON['stringify'](_0x1c675f));}catch(_0x1fff79){this[_0xd912('0x9')](_0xd912('0x8'),JSON[_0xd912('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd912('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd912('0xb')]},'col':{'type':Sequelize[_0xd912('0xb')]},'background':{'type':Sequelize[_0xd912('0x4')],'allowNull':![],'defaultValue':_0xd912('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd912('0x4')],'allowNull':![],'defaultValue':_0xd912('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd912('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index bb4f2ba..bfa7f35 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 _0xe38f=['intersection','model','attributes','fields','merge','options','find','catch','DashboardItem','params','type','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','count','offset','limit','Content-Range','json','reject','save','destroy','then','sendStatus','error','stack','name','send','show','keys','rawAttributes','query'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xe38f,0xd7));var _0xfe38=function(_0x59504c,_0x227955){_0x59504c=_0x59504c-0x0;var _0x85648=_0xe38f[_0x59504c];return _0x85648;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfe38('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe38('0x1'));var rp=require(_0xfe38('0x2'));var moment=require(_0xfe38('0x3'));var BPromise=require(_0xfe38('0x4'));var Mustache=require(_0xfe38('0x5'));var util=require(_0xfe38('0x6'));var path=require(_0xfe38('0x7'));var sox=require(_0xfe38('0x8'));var csv=require('to-csv');var ejs=require(_0xfe38('0x9'));var fs=require('fs');var _=require(_0xfe38('0xa'));var squel=require(_0xfe38('0xb'));var crypto=require(_0xfe38('0xc'));var jsforce=require(_0xfe38('0xd'));var deskjs=require(_0xfe38('0xe'));var toCsv=require(_0xfe38('0xf'));var querystring=require('querystring');var Papa=require(_0xfe38('0x10'));var Redis=require(_0xfe38('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfe38('0x12'));var as=require(_0xfe38('0x13'));var hardwareService=require(_0xfe38('0x14'));var logger=require(_0xfe38('0x15'))(_0xfe38('0x16'));var utils=require(_0xfe38('0x17'));var config=require('../../config/environment');var db=require(_0xfe38('0x18'))['db'];config[_0xfe38('0x19')]=_[_0xfe38('0x1a')](config[_0xfe38('0x19')],{'host':_0xfe38('0x1b'),'port':0x18eb});var socket=require(_0xfe38('0x1c'))(new Redis(config[_0xfe38('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x2ce67f,_0x9c66ea){_0x9c66ea=_0x9c66ea||0xcc;return function(_0x12c5fb){if(_0x12c5fb){return _0x2ce67f['sendStatus'](_0x9c66ea);}return _0x2ce67f[_0xfe38('0x1d')](_0x9c66ea)[_0xfe38('0x1e')]();};}function respondWithResult(_0x4864c1,_0x3955b9){_0x3955b9=_0x3955b9||0xc8;return function(_0x187041){if(_0x187041){return _0x4864c1[_0xfe38('0x1d')](_0x3955b9)['json'](_0x187041);}};}function respondWithFilteredResult(_0xa11f74,_0x27ca48){return function(_0xb69d1d){if(_0xb69d1d){var _0x358446=_0xb69d1d[_0xfe38('0x1f')],_0x339947=_0x27ca48[_0xfe38('0x20')],_0x52a4ad=_0x27ca48['offset']+_0x27ca48[_0xfe38('0x21')],_0x4beb00;if(_0x52a4ad>=_0x358446){_0x52a4ad=_0x358446;_0x4beb00=0xc8;}else{_0x4beb00=0xce;}_0xa11f74['status'](_0x4beb00);return _0xa11f74['set'](_0xfe38('0x22'),_0x339947+'-'+_0x52a4ad+'/'+_0x358446)[_0xfe38('0x23')](_0xb69d1d);}return null;};}function patchUpdates(_0x527c4a){return function(_0x44a60a){try{jsonpatch['apply'](_0x44a60a,_0x527c4a,!![]);}catch(_0x2c45ac){return BPromise[_0xfe38('0x24')](_0x2c45ac);}return _0x44a60a[_0xfe38('0x25')]();};}function saveUpdates(_0x40f09e,_0xab979e){return function(_0x456a67){if(_0x456a67){return _0x456a67['update'](_0x40f09e)['then'](function(_0x3e1095){return _0x3e1095;});}return null;};}function removeEntity(_0x56befc,_0x4925e0){return function(_0x462fe3){if(_0x462fe3){return _0x462fe3[_0xfe38('0x26')]()[_0xfe38('0x27')](function(){_0x56befc[_0xfe38('0x1d')](0xcc)[_0xfe38('0x1e')]();});}};}function handleEntityNotFound(_0x2cfc5c,_0x4f8fd3){return function(_0xf0000){if(!_0xf0000){_0x2cfc5c[_0xfe38('0x28')](0x194);}return _0xf0000;};}function handleError(_0x2ad2ce,_0x5cf9b7){_0x5cf9b7=_0x5cf9b7||0x1f4;return function(_0x41d4cf){logger[_0xfe38('0x29')](_0x41d4cf[_0xfe38('0x2a')]);if(_0x41d4cf[_0xfe38('0x2b')]){delete _0x41d4cf[_0xfe38('0x2b')];}_0x2ad2ce['status'](_0x5cf9b7)[_0xfe38('0x2c')](_0x41d4cf);};}exports[_0xfe38('0x2d')]=function(_0x19063f,_0xdab287){var _0x2ae4f0={'raw':![],'where':{'id':_0x19063f['params']['id']}},_0xf62723={};_0xf62723['model']=_[_0xfe38('0x2e')](db['DashboardItem'][_0xfe38('0x2f')]);_0xf62723[_0xfe38('0x30')]=_['keys'](_0x19063f['query']);_0xf62723['filters']=_[_0xfe38('0x31')](_0xf62723[_0xfe38('0x32')],_0xf62723[_0xfe38('0x30')]);_0x2ae4f0[_0xfe38('0x33')]=_['intersection'](_0xf62723['model'],qs[_0xfe38('0x34')](_0x19063f[_0xfe38('0x30')]['fields']));_0x2ae4f0['attributes']=_0x2ae4f0['attributes']['length']?_0x2ae4f0[_0xfe38('0x33')]:_0xf62723['model'];if(_0x19063f[_0xfe38('0x30')]['includeAll']){_0x2ae4f0['include']=[{'all':!![]}];}_0x2ae4f0=_[_0xfe38('0x35')]({},_0x2ae4f0,_0x19063f[_0xfe38('0x36')]);return db['DashboardItem'][_0xfe38('0x37')](_0x2ae4f0)[_0xfe38('0x27')](handleEntityNotFound(_0xdab287,null))[_0xfe38('0x27')](respondWithResult(_0xdab287,null))[_0xfe38('0x38')](handleError(_0xdab287,null));};exports[_0xfe38('0x26')]=function(_0x155ac9,_0x5d40d5){return db[_0xfe38('0x39')][_0xfe38('0x37')]({'where':{'id':_0x155ac9[_0xfe38('0x3a')]['id']}})[_0xfe38('0x27')](handleEntityNotFound(_0x5d40d5,null))[_0xfe38('0x27')](removeEntity(_0x5d40d5,null))[_0xfe38('0x38')](handleError(_0x5d40d5,null));};function widgetAttributes(_0x2d09ea){try{switch(_0x2d09ea[_0xfe38('0x3b')]){case _0xfe38('0x3c'):return[{'name':_0xfe38('0x3d'),'value':_0x2d09ea[_0xfe38('0x3d')]||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea['attrs'][0x0]?_0x2d09ea['attrs'][0x0][_0xfe38('0x3f')]:undefined)||_0xfe38('0x40')}];case _0xfe38('0x41'):return[{'name':'attrPath','value':_0x2d09ea['attrPath']||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea['attrs'][0x0]?_0x2d09ea[_0xfe38('0x3e')][0x0][_0xfe38('0x3f')]:undefined)||''}];case _0xfe38('0x42'):return[{'name':'attrHourFormat','value':_0x2d09ea[_0xfe38('0x43')]||(_0x2d09ea['attrs']&&_0x2d09ea[_0xfe38('0x3e')][0x0]?_0x2d09ea[_0xfe38('0x3e')][0x0][_0xfe38('0x3f')]:undefined)||'HH:mm:ss'},{'name':_0xfe38('0x44'),'value':_0x2d09ea[_0xfe38('0x44')]||(_0x2d09ea['attrs']&&_0x2d09ea['attrs'][0x1]?_0x2d09ea[_0xfe38('0x3e')][0x1][_0xfe38('0x3f')]:undefined)||_0xfe38('0x45')},{'name':_0xfe38('0x46'),'value':_0x2d09ea[_0xfe38('0x46')]||(_0x2d09ea['attrs']&&_0x2d09ea[_0xfe38('0x3e')][0x2]?_0x2d09ea[_0xfe38('0x3e')][0x2][_0xfe38('0x3f')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x2d09ea[_0xfe38('0x47')]||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea[_0xfe38('0x3e')][0x0]?_0x2d09ea[_0xfe38('0x3e')][0x0][_0xfe38('0x3f')]:undefined)||_0xfe38('0x48')},{'name':_0xfe38('0x49'),'value':_0x2d09ea['attrVoiceQueues']||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea['attrs'][0x1]?_0x2d09ea[_0xfe38('0x3e')][0x1]['value']:undefined)||[]},{'name':_0xfe38('0x46'),'value':_0x2d09ea[_0xfe38('0x46')]||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea[_0xfe38('0x3e')][0x2]?_0x2d09ea[_0xfe38('0x3e')][0x2][_0xfe38('0x3f')]:undefined)||0x14}];case _0xfe38('0x4a'):case _0xfe38('0x4b'):return[{'name':_0xfe38('0x4c'),'value':_0x2d09ea[_0xfe38('0x4c')]||(_0x2d09ea['attrs']&&_0x2d09ea[_0xfe38('0x3e')][0x0]?_0x2d09ea[_0xfe38('0x3e')][0x0]['value']:undefined)||_0xfe38('0x48')},{'name':_0xfe38('0x4d'),'value':_0x2d09ea['attrSerie2']||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea[_0xfe38('0x3e')][0x1]?_0x2d09ea[_0xfe38('0x3e')][0x1][_0xfe38('0x3f')]:undefined)||null},{'name':_0xfe38('0x4e'),'value':_0x2d09ea['attrSerie3']||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea['attrs'][0x2]?_0x2d09ea[_0xfe38('0x3e')][0x2][_0xfe38('0x3f')]:undefined)||null},{'name':_0xfe38('0x49'),'value':_0x2d09ea[_0xfe38('0x49')]||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea[_0xfe38('0x3e')][0x3]?_0x2d09ea['attrs'][0x3][_0xfe38('0x3f')]:undefined)||[]}];case _0xfe38('0x4f'):return[{'name':_0xfe38('0x50'),'type':_0x2d09ea[_0xfe38('0x51')]||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea[_0xfe38('0x3e')][0x0]?_0x2d09ea['attrs'][0x0][_0xfe38('0x3b')]:undefined)||null,'value':_0x2d09ea['attrReport']||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea['attrs'][0x0]?_0x2d09ea['attrs'][0x0][_0xfe38('0x3f')]:undefined)||null},{'name':_0xfe38('0x52'),'value':_0x2d09ea[_0xfe38('0x52')]||(_0x2d09ea[_0xfe38('0x3e')]&&_0x2d09ea['attrs'][0x1]?_0x2d09ea[_0xfe38('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2d6061){logger['error'](_0xfe38('0x53'),JSON[_0xfe38('0x54')](_0x2d6061));return[];}}exports['create']=function(_0x2b340f,_0x54eee3){if(_0x2b340f[_0xfe38('0x55')]){_0x2b340f[_0xfe38('0x55')][_0xfe38('0x3e')]=widgetAttributes(_0x2b340f[_0xfe38('0x55')]);}return db['DashboardItem'][_0xfe38('0x56')](_0x2b340f[_0xfe38('0x55')],{})['then'](respondWithResult(_0x54eee3,0xc9))[_0xfe38('0x38')](handleError(_0x54eee3,null));};exports[_0xfe38('0x57')]=function(_0xde2b0e,_0x5d603d){if(_0xde2b0e[_0xfe38('0x55')]['id']){delete _0xde2b0e['body']['id'];}_0xde2b0e[_0xfe38('0x55')][_0xfe38('0x3e')]=widgetAttributes(_0xde2b0e['body']);return db[_0xfe38('0x39')][_0xfe38('0x37')]({'where':{'id':_0xde2b0e['params']['id']}})['then'](handleEntityNotFound(_0x5d603d,null))[_0xfe38('0x27')](saveUpdates(_0xde2b0e[_0xfe38('0x55')],null))['then'](respondWithResult(_0x5d603d,null))[_0xfe38('0x38')](handleError(_0x5d603d,null));}; \ No newline at end of file +var _0xe444=['options','catch','find','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include'];(function(_0x18e193,_0x21f09a){var _0xb2ed27=function(_0x5a1c0f){while(--_0x5a1c0f){_0x18e193['push'](_0x18e193['shift']());}};_0xb2ed27(++_0x21f09a);}(_0xe444,0x12c));var _0x4e44=function(_0x19bcbd,_0x3a7e3b){_0x19bcbd=_0x19bcbd-0x0;var _0x2a2dff=_0xe444[_0x19bcbd];return _0x2a2dff;};'use strict';var pdf=require(_0x4e44('0x0'));var emlformat=require(_0x4e44('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e44('0x2'));var rp=require(_0x4e44('0x3'));var moment=require(_0x4e44('0x4'));var BPromise=require(_0x4e44('0x5'));var Mustache=require('mustache');var util=require(_0x4e44('0x6'));var path=require(_0x4e44('0x7'));var sox=require(_0x4e44('0x8'));var csv=require(_0x4e44('0x9'));var ejs=require(_0x4e44('0xa'));var fs=require('fs');var _=require(_0x4e44('0xb'));var squel=require(_0x4e44('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e44('0xd'));var toCsv=require(_0x4e44('0x9'));var querystring=require(_0x4e44('0xe'));var Papa=require(_0x4e44('0xf'));var Redis=require('ioredis');var authService=require(_0x4e44('0x10'));var qs=require(_0x4e44('0x11'));var as=require(_0x4e44('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e44('0x13'))(_0x4e44('0x14'));var utils=require(_0x4e44('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4e44('0x16')]=_[_0x4e44('0x17')](config[_0x4e44('0x16')],{'host':_0x4e44('0x18'),'port':0x18eb});var socket=require(_0x4e44('0x19'))(new Redis(config['redis']));require(_0x4e44('0x1a'))['register'](socket);function respondWithStatusCode(_0x4a07c5,_0x201fd1){_0x201fd1=_0x201fd1||0xcc;return function(_0x2b875d){if(_0x2b875d){return _0x4a07c5['sendStatus'](_0x201fd1);}return _0x4a07c5[_0x4e44('0x1b')](_0x201fd1)[_0x4e44('0x1c')]();};}function respondWithResult(_0x4ab2aa,_0x568199){_0x568199=_0x568199||0xc8;return function(_0x2585e3){if(_0x2585e3){return _0x4ab2aa[_0x4e44('0x1b')](_0x568199)[_0x4e44('0x1d')](_0x2585e3);}};}function respondWithFilteredResult(_0x3474f9,_0x85fc0b){return function(_0x3e8687){if(_0x3e8687){var _0x4c27ac=_0x3e8687[_0x4e44('0x1e')],_0x2530a0=_0x85fc0b[_0x4e44('0x1f')],_0x26758c=_0x85fc0b[_0x4e44('0x1f')]+_0x85fc0b[_0x4e44('0x20')],_0xdba5d3;if(_0x26758c>=_0x4c27ac){_0x26758c=_0x4c27ac;_0xdba5d3=0xc8;}else{_0xdba5d3=0xce;}_0x3474f9['status'](_0xdba5d3);return _0x3474f9[_0x4e44('0x21')](_0x4e44('0x22'),_0x2530a0+'-'+_0x26758c+'/'+_0x4c27ac)[_0x4e44('0x1d')](_0x3e8687);}return null;};}function patchUpdates(_0x10b941){return function(_0x4e8474){try{jsonpatch[_0x4e44('0x23')](_0x4e8474,_0x10b941,!![]);}catch(_0x4c9b36){return BPromise['reject'](_0x4c9b36);}return _0x4e8474[_0x4e44('0x24')]();};}function saveUpdates(_0x5dbd32,_0x452cc2){return function(_0x5d9342){if(_0x5d9342){return _0x5d9342[_0x4e44('0x25')](_0x5dbd32)['then'](function(_0x122527){return _0x122527;});}return null;};}function removeEntity(_0x5c458f,_0x5ca592){return function(_0x195811){if(_0x195811){return _0x195811[_0x4e44('0x26')]()[_0x4e44('0x27')](function(){_0x5c458f[_0x4e44('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5112,_0xa1b36a){return function(_0xa053ee){if(!_0xa053ee){_0x1c5112[_0x4e44('0x28')](0x194);}return _0xa053ee;};}function handleError(_0x480909,_0x3706bd){_0x3706bd=_0x3706bd||0x1f4;return function(_0x3392e0){logger[_0x4e44('0x29')](_0x3392e0['stack']);if(_0x3392e0[_0x4e44('0x2a')]){delete _0x3392e0[_0x4e44('0x2a')];}_0x480909[_0x4e44('0x1b')](_0x3706bd)[_0x4e44('0x2b')](_0x3392e0);};}exports[_0x4e44('0x2c')]=function(_0x1d951f,_0x3f0284){var _0x73f273={'raw':![],'where':{'id':_0x1d951f['params']['id']}},_0x127177={};_0x127177[_0x4e44('0x2d')]=_[_0x4e44('0x2e')](db[_0x4e44('0x2f')][_0x4e44('0x30')]);_0x127177['query']=_[_0x4e44('0x2e')](_0x1d951f[_0x4e44('0x31')]);_0x127177[_0x4e44('0x32')]=_[_0x4e44('0x33')](_0x127177[_0x4e44('0x2d')],_0x127177['query']);_0x73f273[_0x4e44('0x34')]=_[_0x4e44('0x33')](_0x127177[_0x4e44('0x2d')],qs[_0x4e44('0x35')](_0x1d951f['query'][_0x4e44('0x35')]));_0x73f273['attributes']=_0x73f273[_0x4e44('0x34')]['length']?_0x73f273[_0x4e44('0x34')]:_0x127177['model'];if(_0x1d951f[_0x4e44('0x31')][_0x4e44('0x36')]){_0x73f273[_0x4e44('0x37')]=[{'all':!![]}];}_0x73f273=_['merge']({},_0x73f273,_0x1d951f[_0x4e44('0x38')]);return db[_0x4e44('0x2f')]['find'](_0x73f273)[_0x4e44('0x27')](handleEntityNotFound(_0x3f0284,null))['then'](respondWithResult(_0x3f0284,null))[_0x4e44('0x39')](handleError(_0x3f0284,null));};exports[_0x4e44('0x26')]=function(_0x3e2fbf,_0x39e73c){return db[_0x4e44('0x2f')][_0x4e44('0x3a')]({'where':{'id':_0x3e2fbf['params']['id']}})['then'](handleEntityNotFound(_0x39e73c,null))[_0x4e44('0x27')](removeEntity(_0x39e73c,null))[_0x4e44('0x39')](handleError(_0x39e73c,null));};function widgetAttributes(_0x24599a){try{switch(_0x24599a[_0x4e44('0x3b')]){case _0x4e44('0x3c'):return[{'name':_0x4e44('0x3d'),'value':_0x24599a[_0x4e44('0x3d')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x0]?_0x24599a[_0x4e44('0x3e')][0x0][_0x4e44('0x3f')]:undefined)||'https://'}];case _0x4e44('0x40'):return[{'name':_0x4e44('0x41'),'value':_0x24599a[_0x4e44('0x41')]||(_0x24599a['attrs']&&_0x24599a[_0x4e44('0x3e')][0x0]?_0x24599a[_0x4e44('0x3e')][0x0][_0x4e44('0x3f')]:undefined)||''}];case _0x4e44('0x42'):return[{'name':_0x4e44('0x43'),'value':_0x24599a[_0x4e44('0x43')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x0]?_0x24599a['attrs'][0x0][_0x4e44('0x3f')]:undefined)||_0x4e44('0x44')},{'name':_0x4e44('0x45'),'value':_0x24599a[_0x4e44('0x45')]||(_0x24599a['attrs']&&_0x24599a['attrs'][0x1]?_0x24599a[_0x4e44('0x3e')][0x1][_0x4e44('0x3f')]:undefined)||_0x4e44('0x46')},{'name':'attrFontSize','value':_0x24599a[_0x4e44('0x47')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x2]?_0x24599a[_0x4e44('0x3e')][0x2][_0x4e44('0x3f')]:undefined)||0xc}];case _0x4e44('0x48'):return[{'name':_0x4e44('0x49'),'value':_0x24599a[_0x4e44('0x49')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a['attrs'][0x0]?_0x24599a[_0x4e44('0x3e')][0x0][_0x4e44('0x3f')]:undefined)||_0x4e44('0x4a')},{'name':_0x4e44('0x4b'),'value':_0x24599a[_0x4e44('0x4b')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x1]?_0x24599a[_0x4e44('0x3e')][0x1][_0x4e44('0x3f')]:undefined)||[]},{'name':'attrFontSize','value':_0x24599a[_0x4e44('0x47')]||(_0x24599a['attrs']&&_0x24599a['attrs'][0x2]?_0x24599a[_0x4e44('0x3e')][0x2]['value']:undefined)||0x14}];case _0x4e44('0x4c'):case _0x4e44('0x4d'):return[{'name':_0x4e44('0x4e'),'value':_0x24599a[_0x4e44('0x4e')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a['attrs'][0x0]?_0x24599a['attrs'][0x0][_0x4e44('0x3f')]:undefined)||_0x4e44('0x4a')},{'name':_0x4e44('0x4f'),'value':_0x24599a[_0x4e44('0x4f')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x1]?_0x24599a['attrs'][0x1][_0x4e44('0x3f')]:undefined)||null},{'name':_0x4e44('0x50'),'value':_0x24599a[_0x4e44('0x50')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a['attrs'][0x2]?_0x24599a[_0x4e44('0x3e')][0x2][_0x4e44('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x24599a['attrVoiceQueues']||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a['attrs'][0x3]?_0x24599a[_0x4e44('0x3e')][0x3][_0x4e44('0x3f')]:undefined)||[]}];case _0x4e44('0x51'):return[{'name':_0x4e44('0x52'),'type':_0x24599a['reportType']||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x0]?_0x24599a['attrs'][0x0][_0x4e44('0x3b')]:undefined)||null,'value':_0x24599a[_0x4e44('0x52')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a[_0x4e44('0x3e')][0x0]?_0x24599a[_0x4e44('0x3e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x24599a[_0x4e44('0x53')]||(_0x24599a[_0x4e44('0x3e')]&&_0x24599a['attrs'][0x1]?_0x24599a[_0x4e44('0x3e')][0x1][_0x4e44('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x54d27f){logger[_0x4e44('0x29')](_0x4e44('0x54'),JSON[_0x4e44('0x55')](_0x54d27f));return[];}}exports[_0x4e44('0x56')]=function(_0x23b83a,_0x4f52d9){if(_0x23b83a[_0x4e44('0x57')]){_0x23b83a[_0x4e44('0x57')]['attrs']=widgetAttributes(_0x23b83a['body']);}return db[_0x4e44('0x2f')][_0x4e44('0x56')](_0x23b83a['body'],{})[_0x4e44('0x27')](respondWithResult(_0x4f52d9,0xc9))[_0x4e44('0x39')](handleError(_0x4f52d9,null));};exports[_0x4e44('0x25')]=function(_0x35bfb3,_0x27ac05){if(_0x35bfb3[_0x4e44('0x57')]['id']){delete _0x35bfb3[_0x4e44('0x57')]['id'];}_0x35bfb3['body'][_0x4e44('0x3e')]=widgetAttributes(_0x35bfb3[_0x4e44('0x57')]);return db[_0x4e44('0x2f')]['find']({'where':{'id':_0x35bfb3[_0x4e44('0x58')]['id']}})['then'](handleEntityNotFound(_0x27ac05,null))['then'](saveUpdates(_0x35bfb3['body'],null))[_0x4e44('0x27')](respondWithResult(_0x27ac05,null))[_0x4e44('0x39')](handleError(_0x27ac05,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ee0d217..322027a 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 _0x3f0d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x3f0d,0x1d5));var _0xd3f0=function(_0x4a8092,_0x18b12b){_0x4a8092=_0x4a8092-0x0;var _0x1e25c4=_0x3f0d[_0x4a8092];return _0x1e25c4;};'use strict';var EventEmitter=require(_0xd3f0('0x0'));var DashboardItem=require(_0xd3f0('0x1'))['db'][_0xd3f0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd3f0('0x3')](0x0);var events={'afterCreate':_0xd3f0('0x4'),'afterUpdate':_0xd3f0('0x5'),'afterDestroy':_0xd3f0('0x6')};function emitEvent(_0x2a8c8f){return function(_0x1b2a92,_0x48aafd,_0x157895){DashboardItemEvents[_0xd3f0('0x7')](_0x2a8c8f+':'+_0x1b2a92['id'],_0x1b2a92);DashboardItemEvents[_0xd3f0('0x7')](_0x2a8c8f,_0x1b2a92);_0x157895(null);};}for(var e in events){if(events[_0xd3f0('0x8')](e)){var event=events[e];DashboardItem[_0xd3f0('0x9')](e,emitEvent(event));}}module[_0xd3f0('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x448b=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x3b0741,_0x5682f5){var _0x5e912c=function(_0x30fab0){while(--_0x30fab0){_0x3b0741['push'](_0x3b0741['shift']());}};_0x5e912c(++_0x5682f5);}(_0x448b,0x125));var _0xb448=function(_0x4e26a8,_0x1bab52){_0x4e26a8=_0x4e26a8-0x0;var _0x176da9=_0x448b[_0x4e26a8];return _0x176da9;};'use strict';var EventEmitter=require(_0xb448('0x0'));var DashboardItem=require(_0xb448('0x1'))['db'][_0xb448('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb448('0x3')](0x0);var events={'afterCreate':_0xb448('0x4'),'afterUpdate':_0xb448('0x5'),'afterDestroy':'remove'};function emitEvent(_0x189ccb){return function(_0x32bcae,_0x172a89,_0x220082){DashboardItemEvents[_0xb448('0x6')](_0x189ccb+':'+_0x32bcae['id'],_0x32bcae);DashboardItemEvents[_0xb448('0x6')](_0x189ccb,_0x32bcae);_0x220082(null);};}for(var e in events){if(events[_0xb448('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xb448('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 499a48b..3c5531b 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 _0x08c6=['bluebird','path','./dashboardItem.attributes','exports','define','DashboardItem','lodash','../../config/logger','api','moment'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x08c6,0x1aa));var _0x608c=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x08c6[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x608c('0x0'));var util=require('util');var logger=require(_0x608c('0x1'))(_0x608c('0x2'));var moment=require(_0x608c('0x3'));var BPromise=require(_0x608c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x608c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x608c('0x6'));module[_0x608c('0x7')]=function(_0x1db106,_0x1e7904){return _0x1db106[_0x608c('0x8')](_0x608c('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafde=['./dashboardItem.attributes','DashboardItem','dashboard_items','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x302ac1,_0x33cd07){var _0x25bcbe=function(_0x175dbb){while(--_0x175dbb){_0x302ac1['push'](_0x302ac1['shift']());}};_0x25bcbe(++_0x33cd07);}(_0xafde,0x13e));var _0xeafd=function(_0x5085e3,_0x15d0c1){_0x5085e3=_0x5085e3-0x0;var _0x38feb4=_0xafde[_0x5085e3];return _0x38feb4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeafd('0x0'))(_0xeafd('0x1'));var moment=require(_0xeafd('0x2'));var BPromise=require(_0xeafd('0x3'));var rp=require(_0xeafd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeafd('0x5'));var attributes=require(_0xeafd('0x6'));module['exports']=function(_0x2ab967,_0x49ed4c){return _0x2ab967['define'](_0xeafd('0x7'),attributes,{'tableName':_0xeafd('0x8'),'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 9cbadd5..3ff4e9a 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 _0xb0eb=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x35bf9c,_0x59eebf){var _0x3e457d=function(_0x17f012){while(--_0x17f012){_0x35bf9c['push'](_0x35bf9c['shift']());}};_0x3e457d(++_0x59eebf);}(_0xb0eb,0x119));var _0xbb0e=function(_0x385931,_0x54551c){_0x385931=_0x385931-0x0;var _0x4c53c4=_0xb0eb[_0x385931];return _0x4c53c4;};'use strict';var _=require(_0xbb0e('0x0'));var util=require(_0xbb0e('0x1'));var moment=require(_0xbb0e('0x2'));var BPromise=require(_0xbb0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb0e('0x4'));var db=require(_0xbb0e('0x5'))['db'];var utils=require(_0xbb0e('0x6'));var logger=require(_0xbb0e('0x7'))(_0xbb0e('0x8'));var config=require(_0xbb0e('0x9'));var jayson=require(_0xbb0e('0xa'));var client=jayson[_0xbb0e('0xb')][_0xbb0e('0xc')]({'port':0x232a});config[_0xbb0e('0xd')]=_[_0xbb0e('0xe')](config[_0xbb0e('0xd')],{'host':_0xbb0e('0xf'),'port':0x18eb});var socket=require(_0xbb0e('0x10'))(new Redis(config[_0xbb0e('0xd')]));require(_0xbb0e('0x11'))['register'](socket);function respondWithRpcPromise(_0x496505,_0x2d5d01,_0x275773){return new BPromise(function(_0x3f91c3,_0x1f8873){return client['request'](_0x496505,_0x275773)['then'](function(_0xa65e8d){logger[_0xbb0e('0x12')](_0xbb0e('0x13'),_0x2d5d01,_0xbb0e('0x14'));logger[_0xbb0e('0x15')](_0xbb0e('0x16'),_0x2d5d01,_0xbb0e('0x14'),JSON['stringify'](_0xa65e8d));if(_0xa65e8d[_0xbb0e('0x17')]){if(_0xa65e8d['error'][_0xbb0e('0x18')]===0x1f4){logger[_0xbb0e('0x17')](_0xbb0e('0x13'),_0x2d5d01,_0xa65e8d[_0xbb0e('0x17')][_0xbb0e('0x19')]);return _0x1f8873(_0xa65e8d[_0xbb0e('0x17')][_0xbb0e('0x19')]);}logger[_0xbb0e('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2d5d01,_0xa65e8d[_0xbb0e('0x17')][_0xbb0e('0x19')]);return _0x3f91c3(_0xa65e8d[_0xbb0e('0x17')][_0xbb0e('0x19')]);}else{logger[_0xbb0e('0x12')](_0xbb0e('0x13'),_0x2d5d01,_0xbb0e('0x14'));_0x3f91c3(_0xa65e8d[_0xbb0e('0x1a')][_0xbb0e('0x19')]);}})[_0xbb0e('0x1b')](function(_0x5503ff){logger[_0xbb0e('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2d5d01,_0x5503ff);_0x1f8873(_0x5503ff);});});} \ No newline at end of file +var _0xec9c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0xec9c,0x103));var _0xcec9=function(_0x46cf22,_0x2e21d9){_0x46cf22=_0x46cf22-0x0;var _0x403bb8=_0xec9c[_0x46cf22];return _0x403bb8;};'use strict';var _=require(_0xcec9('0x0'));var util=require(_0xcec9('0x1'));var moment=require(_0xcec9('0x2'));var BPromise=require(_0xcec9('0x3'));var rs=require(_0xcec9('0x4'));var fs=require('fs');var Redis=require(_0xcec9('0x5'));var db=require(_0xcec9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcec9('0x7'))(_0xcec9('0x8'));var config=require(_0xcec9('0x9'));var jayson=require(_0xcec9('0xa'));var client=jayson[_0xcec9('0xb')][_0xcec9('0xc')]({'port':0x232a});config[_0xcec9('0xd')]=_[_0xcec9('0xe')](config[_0xcec9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcec9('0xf'))(new Redis(config[_0xcec9('0xd')]));require(_0xcec9('0x10'))[_0xcec9('0x11')](socket);function respondWithRpcPromise(_0x3273a8,_0x2603da,_0x434404){return new BPromise(function(_0xdad333,_0x52bb01){return client[_0xcec9('0x12')](_0x3273a8,_0x434404)[_0xcec9('0x13')](function(_0x3b1312){logger[_0xcec9('0x14')](_0xcec9('0x15'),_0x2603da,_0xcec9('0x16'));logger[_0xcec9('0x17')](_0xcec9('0x18'),_0x2603da,'request\x20sent',JSON['stringify'](_0x3b1312));if(_0x3b1312['error']){if(_0x3b1312[_0xcec9('0x19')]['code']===0x1f4){logger[_0xcec9('0x19')](_0xcec9('0x15'),_0x2603da,_0x3b1312[_0xcec9('0x19')][_0xcec9('0x1a')]);return _0x52bb01(_0x3b1312['error'][_0xcec9('0x1a')]);}logger[_0xcec9('0x19')]('DashboardItem,\x20%s,\x20%s',_0x2603da,_0x3b1312['error'][_0xcec9('0x1a')]);return _0xdad333(_0x3b1312[_0xcec9('0x19')][_0xcec9('0x1a')]);}else{logger[_0xcec9('0x14')](_0xcec9('0x15'),_0x2603da,'request\x20sent');_0xdad333(_0x3b1312[_0xcec9('0x1b')]['message']);}})[_0xcec9('0x1c')](function(_0x55dcf3){logger[_0xcec9('0x19')](_0xcec9('0x15'),_0x2603da,_0x55dcf3);_0x52bb01(_0x55dcf3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 577dac8..710243f 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 _0xc730=['length','dashboardItem:','update','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc730,0xec));var _0x0c73=function(_0x2c0365,_0x5f4667){_0x2c0365=_0x2c0365-0x0;var _0x42ae34=_0xc730[_0x2c0365];return _0x42ae34;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0x0c73('0x0')];function createListener(_0x24d32b,_0x490b5d){return function(_0x2ce68c){_0x490b5d[_0x0c73('0x1')](_0x24d32b,_0x2ce68c);};}function removeListener(_0x3c6ee1,_0x26493a){return function(){DashboardItemEvents[_0x0c73('0x2')](_0x3c6ee1,_0x26493a);};}exports[_0x0c73('0x3')]=function(_0x5b44c5){for(var _0x9f7970=0x0,_0x1568c3=events[_0x0c73('0x4')];_0x9f7970<_0x1568c3;_0x9f7970++){var _0x4a052f=events[_0x9f7970];var _0x539e70=createListener(_0x0c73('0x5')+_0x4a052f,_0x5b44c5);DashboardItemEvents['on'](_0x4a052f,_0x539e70);}}; \ No newline at end of file +var _0xdaa3=['removeListener','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x1bfa47,_0xaaef04){var _0x4ed7a7=function(_0xceba3b){while(--_0xceba3b){_0x1bfa47['push'](_0x1bfa47['shift']());}};_0x4ed7a7(++_0xaaef04);}(_0xdaa3,0xa3));var _0x3daa=function(_0x343965,_0x385ffc){_0x343965=_0x343965-0x0;var _0xd0ef91=_0xdaa3[_0x343965];return _0xd0ef91;};'use strict';var DashboardItemEvents=require(_0x3daa('0x0'));var events=[_0x3daa('0x1'),_0x3daa('0x2'),_0x3daa('0x3')];function createListener(_0x3486f8,_0x4d7c94){return function(_0x245bf1){_0x4d7c94[_0x3daa('0x4')](_0x3486f8,_0x245bf1);};}function removeListener(_0x5a8654,_0xcc3511){return function(){DashboardItemEvents[_0x3daa('0x5')](_0x5a8654,_0xcc3511);};}exports['register']=function(_0x1f3740){for(var _0x950db5=0x0,_0x5348e9=events[_0x3daa('0x6')];_0x950db5<_0x5348e9;_0x950db5++){var _0x58d273=events[_0x950db5];var _0x39037f=createListener(_0x3daa('0x7')+_0x58d273,_0x1f3740);DashboardItemEvents['on'](_0x58d273,_0x39037f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index dfeaeba..89d9fa3 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 _0x7217=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0xb')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0x8'),auth[_0x7721('0x9')](),controller['destroy']);module[_0x7721('0x10')]=router; \ No newline at end of file +var _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x94e30a,_0x4a6cde){_0x94e30a=_0x94e30a-0x0;var _0xef4d47=_0x3f8a[_0x94e30a];return _0xef4d47;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6efa868..71cdc70 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 _0x81e0=['sequelize','exports'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x81e0,0x7a));var _0x081e=function(_0x399084,_0x4680aa){_0x399084=_0x399084-0x0;var _0x353684=_0x81e0[_0x399084];return _0x353684;};'use strict';var Sequelize=require(_0x081e('0x0'));module[_0x081e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x79ef=['STRING','sequelize','exports'];(function(_0x3a73ab,_0x1bcf37){var _0x536d2c=function(_0x411599){while(--_0x411599){_0x3a73ab['push'](_0x3a73ab['shift']());}};_0x536d2c(++_0x1bcf37);}(_0x79ef,0xd6));var _0xf79e=function(_0x13048a,_0xa3d206){_0x13048a=_0x13048a-0x0;var _0x53297c=_0x79ef[_0x13048a];return _0x53297c;};'use strict';var Sequelize=require(_0xf79e('0x0'));module[_0xf79e('0x1')]={'name':{'type':Sequelize[_0xf79e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 2244d5e..538188e 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 _0x8c3d=['sort','filters','filter','merge','where','options','includeAll','include','findAll','rows','catch','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','count','offset','limit','status','set','Content-Range','json','save','destroy','then','Dispositions','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit'];(function(_0x5377a1,_0x22e1e4){var _0x45ff6f=function(_0x2510d7){while(--_0x2510d7){_0x5377a1['push'](_0x5377a1['shift']());}};_0x45ff6f(++_0x22e1e4);}(_0x8c3d,0x1df));var _0xd8c3=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0x8c3d[_0x4d3d50];return _0x175e6d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd8c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8c3('0x1'));var jsonpatch=require(_0xd8c3('0x2'));var rp=require(_0xd8c3('0x3'));var moment=require(_0xd8c3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd8c3('0x5'));var util=require(_0xd8c3('0x6'));var path=require(_0xd8c3('0x7'));var sox=require(_0xd8c3('0x8'));var csv=require(_0xd8c3('0x9'));var ejs=require(_0xd8c3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd8c3('0xb'));var crypto=require(_0xd8c3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd8c3('0xd'));var toCsv=require(_0xd8c3('0x9'));var querystring=require(_0xd8c3('0xe'));var Papa=require(_0xd8c3('0xf'));var Redis=require(_0xd8c3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd8c3('0x11'));var as=require(_0xd8c3('0x12'));var hardwareService=require(_0xd8c3('0x13'));var logger=require(_0xd8c3('0x14'))('api');var utils=require(_0xd8c3('0x15'));var config=require(_0xd8c3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1d7d,_0x5d4fb5){_0x5d4fb5=_0x5d4fb5||0xcc;return function(_0x4fa7ca){if(_0x4fa7ca){return _0x3e1d7d['sendStatus'](_0x5d4fb5);}return _0x3e1d7d['status'](_0x5d4fb5)[_0xd8c3('0x17')]();};}function respondWithResult(_0x1be793,_0xaaa55d){_0xaaa55d=_0xaaa55d||0xc8;return function(_0x17a879){if(_0x17a879){return _0x1be793['status'](_0xaaa55d)['json'](_0x17a879);}};}function respondWithFilteredResult(_0xc386d7,_0x5381fb){return function(_0xec78d2){if(_0xec78d2){var _0xbf8615=_0xec78d2[_0xd8c3('0x18')],_0x5f0490=_0x5381fb[_0xd8c3('0x19')],_0x24009e=_0x5381fb[_0xd8c3('0x19')]+_0x5381fb[_0xd8c3('0x1a')],_0x39fcc8;if(_0x24009e>=_0xbf8615){_0x24009e=_0xbf8615;_0x39fcc8=0xc8;}else{_0x39fcc8=0xce;}_0xc386d7[_0xd8c3('0x1b')](_0x39fcc8);return _0xc386d7[_0xd8c3('0x1c')](_0xd8c3('0x1d'),_0x5f0490+'-'+_0x24009e+'/'+_0xbf8615)[_0xd8c3('0x1e')](_0xec78d2);}return null;};}function patchUpdates(_0x594b60){return function(_0x51fae0){try{jsonpatch['apply'](_0x51fae0,_0x594b60,!![]);}catch(_0x253638){return BPromise['reject'](_0x253638);}return _0x51fae0[_0xd8c3('0x1f')]();};}function saveUpdates(_0x5c6e7b,_0xa907fe){return function(_0x68edd3){if(_0x68edd3){return _0x68edd3['update'](_0x5c6e7b)['then'](function(_0xa46ea9){return _0xa46ea9;});}return null;};}function removeEntity(_0x3222b5,_0x14bf74){return function(_0x339c3f){if(_0x339c3f){return _0x339c3f[_0xd8c3('0x20')]()[_0xd8c3('0x21')](function(){var _0x5078cc=_0x339c3f['get']({'plain':!![]});var _0x513e8f=_0xd8c3('0x22');return db['UserProfileResource'][_0xd8c3('0x20')]({'where':{'type':_0x513e8f,'resourceId':_0x5078cc['id']}})[_0xd8c3('0x21')](function(){return _0x339c3f;});})[_0xd8c3('0x21')](function(){_0x3222b5[_0xd8c3('0x1b')](0xcc)[_0xd8c3('0x17')]();});}};}function handleEntityNotFound(_0x4b5294,_0x5904f3){return function(_0xdd3f97){if(!_0xdd3f97){_0x4b5294['sendStatus'](0x194);}return _0xdd3f97;};}function handleError(_0x2997e6,_0x25e297){_0x25e297=_0x25e297||0x1f4;return function(_0x5e0354){logger[_0xd8c3('0x23')](_0x5e0354[_0xd8c3('0x24')]);if(_0x5e0354[_0xd8c3('0x25')]){delete _0x5e0354[_0xd8c3('0x25')];}_0x2997e6[_0xd8c3('0x1b')](_0x25e297)['send'](_0x5e0354);};}exports[_0xd8c3('0x26')]=function(_0x346215,_0x5cfb0f){var _0xa4210b={},_0x50dfc3={},_0x403819={'count':0x0,'rows':[]};var _0x39f817=_[_0xd8c3('0x27')](db[_0xd8c3('0x28')][_0xd8c3('0x29')],function(_0x160277){return{'name':_0x160277[_0xd8c3('0x2a')],'type':_0x160277[_0xd8c3('0x2b')][_0xd8c3('0x2c')]};});_0x50dfc3[_0xd8c3('0x2d')]=_[_0xd8c3('0x27')](_0x39f817,_0xd8c3('0x25'));_0x50dfc3[_0xd8c3('0x2e')]=_[_0xd8c3('0x2f')](_0x346215[_0xd8c3('0x2e')]);_0x50dfc3['filters']=_[_0xd8c3('0x30')](_0x50dfc3[_0xd8c3('0x2d')],_0x50dfc3[_0xd8c3('0x2e')]);_0xa4210b['attributes']=_[_0xd8c3('0x30')](_0x50dfc3[_0xd8c3('0x2d')],qs[_0xd8c3('0x31')](_0x346215[_0xd8c3('0x2e')][_0xd8c3('0x31')]));_0xa4210b[_0xd8c3('0x32')]=_0xa4210b[_0xd8c3('0x32')][_0xd8c3('0x33')]?_0xa4210b[_0xd8c3('0x32')]:_0x50dfc3[_0xd8c3('0x2d')];if(!_0x346215[_0xd8c3('0x2e')]['hasOwnProperty'](_0xd8c3('0x34'))){_0xa4210b[_0xd8c3('0x1a')]=qs[_0xd8c3('0x1a')](_0x346215[_0xd8c3('0x2e')][_0xd8c3('0x1a')]);_0xa4210b[_0xd8c3('0x19')]=qs[_0xd8c3('0x19')](_0x346215['query']['offset']);}_0xa4210b['order']=qs[_0xd8c3('0x35')](_0x346215['query'][_0xd8c3('0x35')]);_0xa4210b['where']=qs[_0xd8c3('0x36')](_['pick'](_0x346215[_0xd8c3('0x2e')],_0x50dfc3[_0xd8c3('0x36')]),_0x39f817);if(_0x346215['query'][_0xd8c3('0x37')]){_0xa4210b['where']=_[_0xd8c3('0x38')](_0xa4210b[_0xd8c3('0x39')],{'$or':_['map'](_0x39f817,function(_0x429748){if(_0x429748[_0xd8c3('0x2b')]!=='VIRTUAL'){var _0x2026a5={};_0x2026a5[_0x429748[_0xd8c3('0x25')]]={'$like':'%'+_0x346215[_0xd8c3('0x2e')]['filter']+'%'};return _0x2026a5;}})});}_0xa4210b=_[_0xd8c3('0x38')]({},_0xa4210b,_0x346215[_0xd8c3('0x3a')]);var _0x4005b1={'where':_0xa4210b[_0xd8c3('0x39')]};return db[_0xd8c3('0x28')][_0xd8c3('0x18')](_0x4005b1)[_0xd8c3('0x21')](function(_0x4cb681){_0x403819[_0xd8c3('0x18')]=_0x4cb681;if(_0x346215[_0xd8c3('0x2e')][_0xd8c3('0x3b')]){_0xa4210b[_0xd8c3('0x3c')]=[{'all':!![]}];}return db[_0xd8c3('0x28')][_0xd8c3('0x3d')](_0xa4210b);})[_0xd8c3('0x21')](function(_0xe511b){_0x403819[_0xd8c3('0x3e')]=_0xe511b;return _0x403819;})[_0xd8c3('0x21')](respondWithFilteredResult(_0x5cfb0f,_0xa4210b))[_0xd8c3('0x3f')](handleError(_0x5cfb0f,null));};exports['show']=function(_0x39c61a,_0x830a53){var _0x44894d={'raw':!![],'where':{'id':_0x39c61a[_0xd8c3('0x40')]['id']}},_0x48d051={};_0x48d051[_0xd8c3('0x2d')]=_[_0xd8c3('0x2f')](db[_0xd8c3('0x28')][_0xd8c3('0x29')]);_0x48d051[_0xd8c3('0x2e')]=_['keys'](_0x39c61a[_0xd8c3('0x2e')]);_0x48d051[_0xd8c3('0x36')]=_['intersection'](_0x48d051['model'],_0x48d051[_0xd8c3('0x2e')]);_0x44894d[_0xd8c3('0x32')]=_['intersection'](_0x48d051[_0xd8c3('0x2d')],qs['fields'](_0x39c61a['query'][_0xd8c3('0x31')]));_0x44894d[_0xd8c3('0x32')]=_0x44894d['attributes']['length']?_0x44894d[_0xd8c3('0x32')]:_0x48d051[_0xd8c3('0x2d')];if(_0x39c61a[_0xd8c3('0x2e')][_0xd8c3('0x3b')]){_0x44894d['include']=[{'all':!![]}];}_0x44894d=_[_0xd8c3('0x38')]({},_0x44894d,_0x39c61a[_0xd8c3('0x3a')]);return db[_0xd8c3('0x28')]['find'](_0x44894d)[_0xd8c3('0x21')](handleEntityNotFound(_0x830a53,null))[_0xd8c3('0x21')](respondWithResult(_0x830a53,null))[_0xd8c3('0x3f')](handleError(_0x830a53,null));};exports['create']=function(_0x552c36,_0x59947b){return db['Disposition']['create'](_0x552c36[_0xd8c3('0x41')],{})[_0xd8c3('0x21')](function(_0x225a97){var _0x4a474e=_0x552c36[_0xd8c3('0x42')][_0xd8c3('0x43')]({'plain':!![]});if(!_0x4a474e)throw new Error(_0xd8c3('0x44'));if(_0x4a474e[_0xd8c3('0x45')]===_0xd8c3('0x42')){var _0x40463c=_0x225a97['get']({'plain':!![]});var _0x4e1438=_0xd8c3('0x22');return db['UserProfileSection'][_0xd8c3('0x46')]({'where':{'name':_0x4e1438,'userProfileId':_0x4a474e[_0xd8c3('0x47')]},'raw':!![]})[_0xd8c3('0x21')](function(_0x770e47){if(_0x770e47&&_0x770e47[_0xd8c3('0x48')]===0x0){return db['UserProfileResource'][_0xd8c3('0x49')]({'name':_0x40463c[_0xd8c3('0x25')],'resourceId':_0x40463c['id'],'type':_0x770e47[_0xd8c3('0x25')],'sectionId':_0x770e47['id']},{})['then'](function(){return _0x225a97;});}else{return _0x225a97;}})[_0xd8c3('0x3f')](function(_0x323db6){logger[_0xd8c3('0x23')](_0xd8c3('0x4a'),_0x323db6);throw _0x323db6;});}return _0x225a97;})[_0xd8c3('0x21')](respondWithResult(_0x59947b,0xc9))['catch'](handleError(_0x59947b,null));};exports[_0xd8c3('0x4b')]=function(_0x49125a,_0x23dd96){if(_0x49125a['body']['id']){delete _0x49125a['body']['id'];}return db['Disposition'][_0xd8c3('0x46')]({'where':{'id':_0x49125a[_0xd8c3('0x40')]['id']}})[_0xd8c3('0x21')](handleEntityNotFound(_0x23dd96,null))[_0xd8c3('0x21')](saveUpdates(_0x49125a[_0xd8c3('0x41')],null))['then'](respondWithResult(_0x23dd96,null))[_0xd8c3('0x3f')](handleError(_0x23dd96,null));};exports[_0xd8c3('0x20')]=function(_0x2746b9,_0x3eba51){return db[_0xd8c3('0x28')]['find']({'where':{'id':_0x2746b9[_0xd8c3('0x40')]['id']}})['then'](handleEntityNotFound(_0x3eba51,null))[_0xd8c3('0x21')](removeEntity(_0x3eba51,null))[_0xd8c3('0x3f')](handleError(_0x3eba51,null));}; \ No newline at end of file +var _0x5c29=['show','params','keys','length','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Dispositions','name','send','index','map','Disposition','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','count','findAll','rows','catch'];(function(_0x30dbb0,_0x59a6b7){var _0x7512b8=function(_0x4b8916){while(--_0x4b8916){_0x30dbb0['push'](_0x30dbb0['shift']());}};_0x7512b8(++_0x59a6b7);}(_0x5c29,0xbb));var _0x95c2=function(_0x983ef5,_0x46a0de){_0x983ef5=_0x983ef5-0x0;var _0x218fbc=_0x5c29[_0x983ef5];return _0x218fbc;};'use strict';var pdf=require(_0x95c2('0x0'));var emlformat=require(_0x95c2('0x1'));var rimraf=require(_0x95c2('0x2'));var zipdir=require(_0x95c2('0x3'));var jsonpatch=require(_0x95c2('0x4'));var rp=require(_0x95c2('0x5'));var moment=require('moment');var BPromise=require(_0x95c2('0x6'));var Mustache=require(_0x95c2('0x7'));var util=require('util');var path=require(_0x95c2('0x8'));var sox=require(_0x95c2('0x9'));var csv=require(_0x95c2('0xa'));var ejs=require(_0x95c2('0xb'));var fs=require('fs');var _=require(_0x95c2('0xc'));var squel=require(_0x95c2('0xd'));var crypto=require(_0x95c2('0xe'));var jsforce=require(_0x95c2('0xf'));var deskjs=require(_0x95c2('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x95c2('0x11'));var Redis=require(_0x95c2('0x12'));var authService=require(_0x95c2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x95c2('0x14'));var hardwareService=require(_0x95c2('0x15'));var logger=require(_0x95c2('0x16'))(_0x95c2('0x17'));var utils=require(_0x95c2('0x18'));var config=require(_0x95c2('0x19'));var db=require(_0x95c2('0x1a'))['db'];function respondWithStatusCode(_0x1ac932,_0x88971e){_0x88971e=_0x88971e||0xcc;return function(_0x44589f){if(_0x44589f){return _0x1ac932[_0x95c2('0x1b')](_0x88971e);}return _0x1ac932['status'](_0x88971e)[_0x95c2('0x1c')]();};}function respondWithResult(_0x1268a4,_0x11fe02){_0x11fe02=_0x11fe02||0xc8;return function(_0x5117b5){if(_0x5117b5){return _0x1268a4[_0x95c2('0x1d')](_0x11fe02)['json'](_0x5117b5);}};}function respondWithFilteredResult(_0x592eb3,_0x193353){return function(_0x2b427e){if(_0x2b427e){var _0x65c898=_0x2b427e['count'],_0xf02c7=_0x193353[_0x95c2('0x1e')],_0x3e7c02=_0x193353[_0x95c2('0x1e')]+_0x193353[_0x95c2('0x1f')],_0x51cbc5;if(_0x3e7c02>=_0x65c898){_0x3e7c02=_0x65c898;_0x51cbc5=0xc8;}else{_0x51cbc5=0xce;}_0x592eb3['status'](_0x51cbc5);return _0x592eb3[_0x95c2('0x20')](_0x95c2('0x21'),_0xf02c7+'-'+_0x3e7c02+'/'+_0x65c898)[_0x95c2('0x22')](_0x2b427e);}return null;};}function patchUpdates(_0x499fe5){return function(_0x6114cf){try{jsonpatch['apply'](_0x6114cf,_0x499fe5,!![]);}catch(_0x5bb93a){return BPromise[_0x95c2('0x23')](_0x5bb93a);}return _0x6114cf[_0x95c2('0x24')]();};}function saveUpdates(_0x5eb978,_0x52f61c){return function(_0x320b94){if(_0x320b94){return _0x320b94[_0x95c2('0x25')](_0x5eb978)[_0x95c2('0x26')](function(_0x47b691){return _0x47b691;});}return null;};}function removeEntity(_0x1206e4,_0xe01d40){return function(_0x2875af){if(_0x2875af){return _0x2875af[_0x95c2('0x27')]()[_0x95c2('0x26')](function(){var _0x57f1a4=_0x2875af[_0x95c2('0x28')]({'plain':!![]});var _0x120d92=_0x95c2('0x29');return db['UserProfileResource'][_0x95c2('0x27')]({'where':{'type':_0x120d92,'resourceId':_0x57f1a4['id']}})['then'](function(){return _0x2875af;});})[_0x95c2('0x26')](function(){_0x1206e4[_0x95c2('0x1d')](0xcc)[_0x95c2('0x1c')]();});}};}function handleEntityNotFound(_0x1bfec9,_0x259f22){return function(_0x67376f){if(!_0x67376f){_0x1bfec9['sendStatus'](0x194);}return _0x67376f;};}function handleError(_0x3b3e5e,_0x4cb002){_0x4cb002=_0x4cb002||0x1f4;return function(_0x53f51e){logger['error'](_0x53f51e['stack']);if(_0x53f51e[_0x95c2('0x2a')]){delete _0x53f51e[_0x95c2('0x2a')];}_0x3b3e5e['status'](_0x4cb002)[_0x95c2('0x2b')](_0x53f51e);};}exports[_0x95c2('0x2c')]=function(_0x5e03f8,_0x15d489){var _0x5ee0d0={},_0x53dc69={},_0x35d313={'count':0x0,'rows':[]};var _0x4080eb=_[_0x95c2('0x2d')](db[_0x95c2('0x2e')][_0x95c2('0x2f')],function(_0x433bac){return{'name':_0x433bac[_0x95c2('0x30')],'type':_0x433bac[_0x95c2('0x31')]['key']};});_0x53dc69[_0x95c2('0x32')]=_[_0x95c2('0x2d')](_0x4080eb,_0x95c2('0x2a'));_0x53dc69[_0x95c2('0x33')]=_['keys'](_0x5e03f8[_0x95c2('0x33')]);_0x53dc69[_0x95c2('0x34')]=_[_0x95c2('0x35')](_0x53dc69[_0x95c2('0x32')],_0x53dc69[_0x95c2('0x33')]);_0x5ee0d0[_0x95c2('0x36')]=_[_0x95c2('0x35')](_0x53dc69['model'],qs[_0x95c2('0x37')](_0x5e03f8[_0x95c2('0x33')]['fields']));_0x5ee0d0[_0x95c2('0x36')]=_0x5ee0d0[_0x95c2('0x36')]['length']?_0x5ee0d0[_0x95c2('0x36')]:_0x53dc69['model'];if(!_0x5e03f8[_0x95c2('0x33')][_0x95c2('0x38')](_0x95c2('0x39'))){_0x5ee0d0['limit']=qs[_0x95c2('0x1f')](_0x5e03f8[_0x95c2('0x33')][_0x95c2('0x1f')]);_0x5ee0d0[_0x95c2('0x1e')]=qs[_0x95c2('0x1e')](_0x5e03f8[_0x95c2('0x33')][_0x95c2('0x1e')]);}_0x5ee0d0[_0x95c2('0x3a')]=qs[_0x95c2('0x3b')](_0x5e03f8['query'][_0x95c2('0x3b')]);_0x5ee0d0[_0x95c2('0x3c')]=qs[_0x95c2('0x34')](_[_0x95c2('0x3d')](_0x5e03f8['query'],_0x53dc69[_0x95c2('0x34')]),_0x4080eb);if(_0x5e03f8[_0x95c2('0x33')]['filter']){_0x5ee0d0[_0x95c2('0x3c')]=_['merge'](_0x5ee0d0[_0x95c2('0x3c')],{'$or':_[_0x95c2('0x2d')](_0x4080eb,function(_0x30279){if(_0x30279[_0x95c2('0x31')]!==_0x95c2('0x3e')){var _0x49de23={};_0x49de23[_0x30279[_0x95c2('0x2a')]]={'$like':'%'+_0x5e03f8['query']['filter']+'%'};return _0x49de23;}})});}_0x5ee0d0=_[_0x95c2('0x3f')]({},_0x5ee0d0,_0x5e03f8['options']);var _0x324944={'where':_0x5ee0d0[_0x95c2('0x3c')]};return db[_0x95c2('0x2e')][_0x95c2('0x40')](_0x324944)[_0x95c2('0x26')](function(_0x3a8a37){_0x35d313[_0x95c2('0x40')]=_0x3a8a37;if(_0x5e03f8[_0x95c2('0x33')]['includeAll']){_0x5ee0d0['include']=[{'all':!![]}];}return db['Disposition'][_0x95c2('0x41')](_0x5ee0d0);})[_0x95c2('0x26')](function(_0x3f35ad){_0x35d313[_0x95c2('0x42')]=_0x3f35ad;return _0x35d313;})[_0x95c2('0x26')](respondWithFilteredResult(_0x15d489,_0x5ee0d0))[_0x95c2('0x43')](handleError(_0x15d489,null));};exports[_0x95c2('0x44')]=function(_0x5749e7,_0x54806d){var _0x51d0f0={'raw':!![],'where':{'id':_0x5749e7[_0x95c2('0x45')]['id']}},_0x2ce6a6={};_0x2ce6a6[_0x95c2('0x32')]=_[_0x95c2('0x46')](db[_0x95c2('0x2e')][_0x95c2('0x2f')]);_0x2ce6a6[_0x95c2('0x33')]=_[_0x95c2('0x46')](_0x5749e7[_0x95c2('0x33')]);_0x2ce6a6[_0x95c2('0x34')]=_[_0x95c2('0x35')](_0x2ce6a6[_0x95c2('0x32')],_0x2ce6a6['query']);_0x51d0f0['attributes']=_[_0x95c2('0x35')](_0x2ce6a6[_0x95c2('0x32')],qs['fields'](_0x5749e7[_0x95c2('0x33')][_0x95c2('0x37')]));_0x51d0f0[_0x95c2('0x36')]=_0x51d0f0[_0x95c2('0x36')][_0x95c2('0x47')]?_0x51d0f0[_0x95c2('0x36')]:_0x2ce6a6[_0x95c2('0x32')];if(_0x5749e7[_0x95c2('0x33')][_0x95c2('0x48')]){_0x51d0f0[_0x95c2('0x49')]=[{'all':!![]}];}_0x51d0f0=_['merge']({},_0x51d0f0,_0x5749e7[_0x95c2('0x4a')]);return db[_0x95c2('0x2e')][_0x95c2('0x4b')](_0x51d0f0)[_0x95c2('0x26')](handleEntityNotFound(_0x54806d,null))[_0x95c2('0x26')](respondWithResult(_0x54806d,null))[_0x95c2('0x43')](handleError(_0x54806d,null));};exports[_0x95c2('0x4c')]=function(_0x4f93f9,_0x4422e2){return db['Disposition'][_0x95c2('0x4c')](_0x4f93f9[_0x95c2('0x4d')],{})['then'](function(_0xec2ccf){var _0xe32978=_0x4f93f9[_0x95c2('0x4e')][_0x95c2('0x28')]({'plain':!![]});if(!_0xe32978)throw new Error(_0x95c2('0x4f'));if(_0xe32978[_0x95c2('0x50')]===_0x95c2('0x4e')){var _0x4fc881=_0xec2ccf[_0x95c2('0x28')]({'plain':!![]});var _0x3aaf4b=_0x95c2('0x29');return db[_0x95c2('0x51')][_0x95c2('0x4b')]({'where':{'name':_0x3aaf4b,'userProfileId':_0xe32978['userProfileId']},'raw':!![]})[_0x95c2('0x26')](function(_0x3bfc4d){if(_0x3bfc4d&&_0x3bfc4d[_0x95c2('0x52')]===0x0){return db[_0x95c2('0x53')][_0x95c2('0x4c')]({'name':_0x4fc881['name'],'resourceId':_0x4fc881['id'],'type':_0x3bfc4d[_0x95c2('0x2a')],'sectionId':_0x3bfc4d['id']},{})[_0x95c2('0x26')](function(){return _0xec2ccf;});}else{return _0xec2ccf;}})[_0x95c2('0x43')](function(_0x149d99){logger['error'](_0x95c2('0x54'),_0x149d99);throw _0x149d99;});}return _0xec2ccf;})[_0x95c2('0x26')](respondWithResult(_0x4422e2,0xc9))[_0x95c2('0x43')](handleError(_0x4422e2,null));};exports['update']=function(_0x209603,_0x1aeda0){if(_0x209603[_0x95c2('0x4d')]['id']){delete _0x209603[_0x95c2('0x4d')]['id'];}return db[_0x95c2('0x2e')]['find']({'where':{'id':_0x209603[_0x95c2('0x45')]['id']}})[_0x95c2('0x26')](handleEntityNotFound(_0x1aeda0,null))[_0x95c2('0x26')](saveUpdates(_0x209603[_0x95c2('0x4d')],null))[_0x95c2('0x26')](respondWithResult(_0x1aeda0,null))['catch'](handleError(_0x1aeda0,null));};exports[_0x95c2('0x27')]=function(_0x35203b,_0x38468b){return db['Disposition'][_0x95c2('0x4b')]({'where':{'id':_0x35203b[_0x95c2('0x45')]['id']}})[_0x95c2('0x26')](handleEntityNotFound(_0x38468b,null))[_0x95c2('0x26')](removeEntity(_0x38468b,null))[_0x95c2('0x43')](handleError(_0x38468b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 985b48a..5c973f3 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 _0x3208=['FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','name_mail','SmsAccountId','name_fax'];(function(_0x1ebc74,_0x484053){var _0x38c66c=function(_0x795a93){while(--_0x795a93){_0x1ebc74['push'](_0x1ebc74['shift']());}};_0x38c66c(++_0x484053);}(_0x3208,0xf5));var _0x8320=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3208[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x8320('0x0'));var logger=require(_0x8320('0x1'))('api');var moment=require(_0x8320('0x2'));var BPromise=require(_0x8320('0x3'));var rp=require(_0x8320('0x4'));var fs=require('fs');var path=require(_0x8320('0x5'));var rimraf=require('rimraf');var config=require(_0x8320('0x6'));var attributes=require(_0x8320('0x7'));module[_0x8320('0x8')]=function(_0x4c38a6,_0x4212a3){return _0x4c38a6[_0x8320('0x9')](_0x8320('0xa'),attributes,{'tableName':_0x8320('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8320('0xc'),'fields':['name',_0x8320('0xd')]},{'unique':!![],'name':_0x8320('0xe'),'fields':[_0x8320('0xf'),'ChatWebsiteId']},{'unique':!![],'name':_0x8320('0x10'),'fields':[_0x8320('0xf'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x8320('0xf'),_0x8320('0x11')]},{'unique':!![],'name':_0x8320('0x12'),'fields':['name',_0x8320('0x13')]},{'unique':!![],'name':_0x8320('0x14'),'fields':[_0x8320('0xf'),_0x8320('0x15')]},{'unique':!![],'name':_0x8320('0x16'),'fields':[_0x8320('0xf'),_0x8320('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4927=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId'];(function(_0x4fc911,_0x23af13){var _0x47a50d=function(_0x5fde3c){while(--_0x5fde3c){_0x4fc911['push'](_0x4fc911['shift']());}};_0x47a50d(++_0x23af13);}(_0x4927,0xf8));var _0x7492=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4927[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var logger=require(_0x7492('0x2'))(_0x7492('0x3'));var moment=require(_0x7492('0x4'));var BPromise=require(_0x7492('0x5'));var rp=require(_0x7492('0x6'));var fs=require('fs');var path=require(_0x7492('0x7'));var rimraf=require(_0x7492('0x8'));var config=require(_0x7492('0x9'));var attributes=require(_0x7492('0xa'));module[_0x7492('0xb')]=function(_0x519baf,_0x15340f){return _0x519baf[_0x7492('0xc')](_0x7492('0xd'),attributes,{'tableName':_0x7492('0xe'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7492('0xf'),'fields':[_0x7492('0x10'),_0x7492('0x11')]},{'unique':!![],'name':_0x7492('0x12'),'fields':['name',_0x7492('0x13')]},{'unique':!![],'name':'name_mail','fields':[_0x7492('0x10'),'MailAccountId']},{'unique':!![],'name':_0x7492('0x14'),'fields':[_0x7492('0x10'),_0x7492('0x15')]},{'unique':!![],'name':_0x7492('0x16'),'fields':['name',_0x7492('0x17')]},{'unique':!![],'name':_0x7492('0x18'),'fields':[_0x7492('0x10'),_0x7492('0x19')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x7492('0x10'),_0x7492('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 308c98b..dcd0fe3 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 _0x75a5=['code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Disposition,\x20%s,\x20%s','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4c3c52,_0x2e1af3){var _0x55ec9c=function(_0x8ebd90){while(--_0x8ebd90){_0x4c3c52['push'](_0x4c3c52['shift']());}};_0x55ec9c(++_0x2e1af3);}(_0x75a5,0x1a3));var _0x575a=function(_0x10d768,_0x2033f1){_0x10d768=_0x10d768-0x0;var _0x429e60=_0x75a5[_0x10d768];return _0x429e60;};'use strict';var _=require(_0x575a('0x0'));var util=require(_0x575a('0x1'));var moment=require(_0x575a('0x2'));var BPromise=require('bluebird');var rs=require(_0x575a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x575a('0x4'))['db'];var utils=require(_0x575a('0x5'));var logger=require(_0x575a('0x6'))('rpc');var config=require(_0x575a('0x7'));var jayson=require(_0x575a('0x8'));var client=jayson[_0x575a('0x9')][_0x575a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x397cb4,_0x55fab6,_0x3a4a1d){return new BPromise(function(_0x4aa3f1,_0x5b3888){return client[_0x575a('0xb')](_0x397cb4,_0x3a4a1d)[_0x575a('0xc')](function(_0x53512a){logger['info'](_0x575a('0xd'),_0x55fab6,'request\x20sent');logger['debug'](_0x575a('0xe'),_0x55fab6,_0x575a('0xf'),JSON[_0x575a('0x10')](_0x53512a));if(_0x53512a[_0x575a('0x11')]){if(_0x53512a['error'][_0x575a('0x12')]===0x1f4){logger[_0x575a('0x11')](_0x575a('0xd'),_0x55fab6,_0x53512a[_0x575a('0x11')][_0x575a('0x13')]);return _0x5b3888(_0x53512a['error'][_0x575a('0x13')]);}logger[_0x575a('0x11')]('Disposition,\x20%s,\x20%s',_0x55fab6,_0x53512a[_0x575a('0x11')]['message']);return _0x4aa3f1(_0x53512a[_0x575a('0x11')]['message']);}else{logger[_0x575a('0x14')](_0x575a('0xd'),_0x55fab6,_0x575a('0xf'));_0x4aa3f1(_0x53512a[_0x575a('0x15')][_0x575a('0x13')]);}})[_0x575a('0x16')](function(_0x52c51a){logger[_0x575a('0x11')](_0x575a('0xd'),_0x55fab6,_0x52c51a);_0x5b3888(_0x52c51a);});});} \ No newline at end of file +var _0xc476=['Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Disposition,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x369f97,_0x909789){var _0x516152=function(_0x525f23){while(--_0x525f23){_0x369f97['push'](_0x369f97['shift']());}};_0x516152(++_0x909789);}(_0xc476,0x9e));var _0x6c47=function(_0x34fb34,_0x455d52){_0x34fb34=_0x34fb34-0x0;var _0x4fd927=_0xc476[_0x34fb34];return _0x4fd927;};'use strict';var _=require(_0x6c47('0x0'));var util=require(_0x6c47('0x1'));var moment=require('moment');var BPromise=require(_0x6c47('0x2'));var rs=require(_0x6c47('0x3'));var fs=require('fs');var Redis=require(_0x6c47('0x4'));var db=require(_0x6c47('0x5'))['db'];var utils=require(_0x6c47('0x6'));var logger=require(_0x6c47('0x7'))(_0x6c47('0x8'));var config=require(_0x6c47('0x9'));var jayson=require(_0x6c47('0xa'));var client=jayson[_0x6c47('0xb')][_0x6c47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x993437,_0x143560,_0x1e9813){return new BPromise(function(_0x5edffa,_0x50a15b){return client[_0x6c47('0xd')](_0x993437,_0x1e9813)[_0x6c47('0xe')](function(_0x193e2b){logger[_0x6c47('0xf')]('Disposition,\x20%s,\x20%s',_0x143560,_0x6c47('0x10'));logger['debug'](_0x6c47('0x11'),_0x143560,_0x6c47('0x10'),JSON[_0x6c47('0x12')](_0x193e2b));if(_0x193e2b[_0x6c47('0x13')]){if(_0x193e2b[_0x6c47('0x13')][_0x6c47('0x14')]===0x1f4){logger[_0x6c47('0x13')]('Disposition,\x20%s,\x20%s',_0x143560,_0x193e2b[_0x6c47('0x13')]['message']);return _0x50a15b(_0x193e2b['error'][_0x6c47('0x15')]);}logger[_0x6c47('0x13')](_0x6c47('0x16'),_0x143560,_0x193e2b[_0x6c47('0x13')][_0x6c47('0x15')]);return _0x5edffa(_0x193e2b[_0x6c47('0x13')][_0x6c47('0x15')]);}else{logger[_0x6c47('0xf')](_0x6c47('0x16'),_0x143560,_0x6c47('0x10'));_0x5edffa(_0x193e2b[_0x6c47('0x17')][_0x6c47('0x15')]);}})[_0x6c47('0x18')](function(_0x180753){logger[_0x6c47('0x13')](_0x6c47('0x16'),_0x143560,_0x180753);_0x50a15b(_0x180753);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 0a4206d..9d2b42d 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 _0xdc15=['create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','post'];(function(_0x3ee740,_0x1edea8){var _0xab04d3=function(_0x645cba){while(--_0x645cba){_0x3ee740['push'](_0x3ee740['shift']());}};_0xab04d3(++_0x1edea8);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xdc15[_0x11e05d];return _0x335588;};'use strict';var multer=require(_0x5dc1('0x0'));var util=require('util');var path=require(_0x5dc1('0x1'));var timeout=require(_0x5dc1('0x2'));var express=require(_0x5dc1('0x3'));var router=express[_0x5dc1('0x4')]();var auth=require(_0x5dc1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x5dc1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5dc1('0x6')](_0x5dc1('0x7'),auth[_0x5dc1('0x8')](),controller[_0x5dc1('0x9')]);router[_0x5dc1('0xa')]('/',auth[_0x5dc1('0x8')](),controller[_0x5dc1('0xb')]);router[_0x5dc1('0xc')](_0x5dc1('0x7'),auth[_0x5dc1('0x8')](),controller[_0x5dc1('0xd')]);router['delete']('/:id',auth[_0x5dc1('0x8')](),controller[_0x5dc1('0xe')]);module['exports']=router; \ No newline at end of file +var _0xceef=['create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x5f0f2c,_0x9817bf){var _0x104e69=function(_0x6915cc){while(--_0x6915cc){_0x5f0f2c['push'](_0x5f0f2c['shift']());}};_0x104e69(++_0x9817bf);}(_0xceef,0xf6));var _0xfcee=function(_0xed4e3c,_0x39e976){_0xed4e3c=_0xed4e3c-0x0;var _0x4297cc=_0xceef[_0xed4e3c];return _0x4297cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfcee('0x0'));var timeout=require(_0xfcee('0x1'));var express=require('express');var router=express[_0xfcee('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfcee('0x3'));var config=require(_0xfcee('0x4'));var controller=require('./disposition.controller');router[_0xfcee('0x5')]('/',auth[_0xfcee('0x6')](),controller['index']);router['get'](_0xfcee('0x7'),auth[_0xfcee('0x6')](),controller[_0xfcee('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfcee('0x9')]);router[_0xfcee('0xa')](_0xfcee('0x7'),auth[_0xfcee('0x6')](),controller[_0xfcee('0xb')]);router[_0xfcee('0xc')](_0xfcee('0x7'),auth['isAuthenticated'](),controller[_0xfcee('0xd')]);module[_0xfcee('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2fb4139..6f730ed 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 _0x570f=['v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','9600','12000'];(function(_0x418c4e,_0x6095cd){var _0x5126ac=function(_0xd6db55){while(--_0xd6db55){_0x418c4e['push'](_0x418c4e['shift']());}};_0x5126ac(++_0x6095cd);}(_0x570f,0xc9));var _0xf570=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x570f[_0x11a55c];return _0x26c390;};'use strict';var Sequelize=require('sequelize');module[_0xf570('0x0')]={'name':{'type':Sequelize[_0xf570('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf570('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xf570('0x2'),'no'),'defaultValue':_0xf570('0x2')},'headerinfo':{'type':Sequelize[_0xf570('0x1')],'defaultValue':_0xf570('0x3')},'localstationid':{'type':Sequelize[_0xf570('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xf570('0x4')](_0xf570('0x5'),_0xf570('0x6'),'7200',_0xf570('0x7'),_0xf570('0x8'),'14400'),'defaultValue':_0xf570('0x6')},'maxrate':{'type':Sequelize[_0xf570('0x4')](_0xf570('0x5'),_0xf570('0x6'),'7200',_0xf570('0x7'),_0xf570('0x8'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf570('0x1')],'defaultValue':_0xf570('0x9')},'gateway':{'type':Sequelize[_0xf570('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf570('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf570('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf570('0x4')](_0xf570('0xb'),_0xf570('0xc'),_0xf570('0xd'),_0xf570('0xe')),'defaultValue':_0xf570('0xb')},'key':{'type':Sequelize[_0xf570('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf570('0xf')],'defaultValue':function(){return _0xf570('0x10');}},'notificationSound':{'type':Sequelize[_0xf570('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf570('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf570('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf570('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf570('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf570('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf570('0xa')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf570('0x11')],'defaultValue':![],'comment':_0xf570('0x12'),'set':function(_0x20c858){if(!_0x20c858)this[_0xf570('0x13')]('mandatoryDispositionPauseId',null);this[_0xf570('0x13')](_0xf570('0x14'),_0x20c858);}}}; \ No newline at end of file +var _0xb49c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','7200','12000','2400','14400','v17,v27,v29','INTEGER','DADHI','KHOMP','SIP','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN'];(function(_0x37ba85,_0x1cf422){var _0x5b34ae=function(_0x38ab53){while(--_0x38ab53){_0x37ba85['push'](_0x37ba85['shift']());}};_0x5b34ae(++_0x1cf422);}(_0xb49c,0x88));var _0xcb49=function(_0x41d862,_0x6c9e78){_0x41d862=_0x41d862-0x0;var _0x51bef4=_0xb49c[_0x41d862];return _0x51bef4;};'use strict';var Sequelize=require(_0xcb49('0x0'));module[_0xcb49('0x1')]={'name':{'type':Sequelize[_0xcb49('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcb49('0x2')]},'ecm':{'type':Sequelize[_0xcb49('0x3')](_0xcb49('0x4'),'no'),'defaultValue':_0xcb49('0x4')},'headerinfo':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':_0xcb49('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xcb49('0x3')]('2400',_0xcb49('0x6'),_0xcb49('0x7'),'9600',_0xcb49('0x8'),'14400'),'defaultValue':_0xcb49('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0xcb49('0x9'),_0xcb49('0x6'),_0xcb49('0x7'),'9600',_0xcb49('0x8'),_0xcb49('0xa')),'defaultValue':_0xcb49('0xa')},'modem':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':_0xcb49('0xb')},'gateway':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xcb49('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0xcb49('0xd'),_0xcb49('0xe')),'defaultValue':_0xcb49('0xf')},'key':{'type':Sequelize[_0xcb49('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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb49('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb49('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb49('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb49('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xcb49('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xcb49('0x11')],'defaultValue':![],'comment':_0xcb49('0x12'),'set':function(_0x5dab8b){if(!_0x5dab8b)this['setDataValue'](_0xcb49('0x13'),null);this[_0xcb49('0x14')](_0xcb49('0x15'),_0x5dab8b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ed43943..0697d3a 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 _0x1cde=['options','count','includeAll','include','rows','show','params','length','find','catch','create','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','findOne','FaxAccountId','filter','findAll','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','maxrate','minrate','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','defaults','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./faxAccount.socket','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~!@#$%^&-_=+[{]}.','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','offset','limit','set','json','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL'];(function(_0x87ed74,_0x56784c){var _0x9c99a5=function(_0x2dbfe1){while(--_0x2dbfe1){_0x87ed74['push'](_0x87ed74['shift']());}};_0x9c99a5(++_0x56784c);}(_0x1cde,0x1e7));var _0xe1cd=function(_0x2bdabf,_0x202655){_0x2bdabf=_0x2bdabf-0x0;var _0x2bdcb0=_0x1cde[_0x2bdabf];return _0x2bdcb0;};'use strict';var pdf=require(_0xe1cd('0x0'));var emlformat=require(_0xe1cd('0x1'));var rimraf=require(_0xe1cd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1cd('0x3'));var rp=require(_0xe1cd('0x4'));var moment=require(_0xe1cd('0x5'));var BPromise=require(_0xe1cd('0x6'));var Mustache=require(_0xe1cd('0x7'));var util=require(_0xe1cd('0x8'));var path=require(_0xe1cd('0x9'));var sox=require(_0xe1cd('0xa'));var csv=require(_0xe1cd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe1cd('0xc'));var crypto=require(_0xe1cd('0xd'));var jsforce=require(_0xe1cd('0xe'));var deskjs=require(_0xe1cd('0xf'));var toCsv=require(_0xe1cd('0xb'));var querystring=require(_0xe1cd('0x10'));var Papa=require(_0xe1cd('0x11'));var Redis=require(_0xe1cd('0x12'));var authService=require(_0xe1cd('0x13'));var qs=require(_0xe1cd('0x14'));var as=require(_0xe1cd('0x15'));var hardwareService=require(_0xe1cd('0x16'));var logger=require(_0xe1cd('0x17'))(_0xe1cd('0x18'));var utils=require(_0xe1cd('0x19'));var config=require(_0xe1cd('0x1a'));var db=require(_0xe1cd('0x1b'))['db'];config['redis']=_['defaults'](config[_0xe1cd('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1cd('0x1c')]));require(_0xe1cd('0x1d'))['register'](socket);var jayson=require(_0xe1cd('0x1e'));var client=jayson[_0xe1cd('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xe1cd('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x32ebdc,_0x2e7a6a,_0x1a109b){if(_0x1a109b){var _0x4ca219=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ca219[_0xe1cd('0x20')](_0x2e7a6a)){return _0x32ebdc;}else{throw new db[(_0xe1cd('0x21'))]['ValidationError'](_0xe1cd('0x22'));}}else{return _0x32ebdc;}}function respondWithRpcPromise(_0xada4ee,_0x53dc0d,_0x3177c9,_0x109ccf){return new BPromise(function(_0x17aeca,_0x521a7a){var _0x3f3cfd=_0x109ccf||client;return _0x3f3cfd[_0xe1cd('0x23')](_0xada4ee,_0x3177c9)[_0xe1cd('0x24')](function(_0x38085c){logger['info'](_0xe1cd('0x25'),_0x53dc0d,_0xe1cd('0x26'));logger['debug'](_0xe1cd('0x27'),_0x53dc0d,_0xe1cd('0x26'),JSON[_0xe1cd('0x28')](_0x38085c));if(_0x38085c[_0xe1cd('0x29')]){if(_0x38085c[_0xe1cd('0x29')]['code']===0x1f4){logger[_0xe1cd('0x29')](_0xe1cd('0x25'),_0x53dc0d,_0x38085c['error'][_0xe1cd('0x2a')]);return _0x521a7a(_0x38085c[_0xe1cd('0x29')][_0xe1cd('0x2a')]);}logger['error'](_0xe1cd('0x25'),_0x53dc0d,_0x38085c['error']['message']);return _0x17aeca(_0x38085c[_0xe1cd('0x29')][_0xe1cd('0x2a')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x53dc0d,_0xe1cd('0x26'));_0x17aeca(_0x38085c[_0xe1cd('0x2b')][_0xe1cd('0x2a')]);}})['catch'](function(_0x4a54d8){logger[_0xe1cd('0x29')]('FaxAccount,\x20%s,\x20%s',_0x53dc0d,_0x4a54d8);_0x521a7a(_0x4a54d8);});});}function respondWithStatusCode(_0x17a074,_0x3fc5df){_0x3fc5df=_0x3fc5df||0xcc;return function(_0x289f42){if(_0x289f42){return _0x17a074['sendStatus'](_0x3fc5df);}return _0x17a074[_0xe1cd('0x2c')](_0x3fc5df)[_0xe1cd('0x2d')]();};}function respondWithResult(_0x436720,_0x440a17){_0x440a17=_0x440a17||0xc8;return function(_0x5a802a){if(_0x5a802a){return _0x436720[_0xe1cd('0x2c')](_0x440a17)['json'](_0x5a802a);}};}function respondWithFilteredResult(_0x3c4884,_0x4b0150){return function(_0x16d1b6){if(_0x16d1b6){var _0xd0c76a=_0x16d1b6['count'],_0xe7d106=_0x4b0150[_0xe1cd('0x2e')],_0x4366e1=_0x4b0150[_0xe1cd('0x2e')]+_0x4b0150[_0xe1cd('0x2f')],_0x45e359;if(_0x4366e1>=_0xd0c76a){_0x4366e1=_0xd0c76a;_0x45e359=0xc8;}else{_0x45e359=0xce;}_0x3c4884[_0xe1cd('0x2c')](_0x45e359);return _0x3c4884[_0xe1cd('0x30')]('Content-Range',_0xe7d106+'-'+_0x4366e1+'/'+_0xd0c76a)[_0xe1cd('0x31')](_0x16d1b6);}return null;};}function patchUpdates(_0x52d63b){return function(_0x9545e8){try{jsonpatch[_0xe1cd('0x32')](_0x9545e8,_0x52d63b,!![]);}catch(_0x8ffa7d){return BPromise['reject'](_0x8ffa7d);}return _0x9545e8[_0xe1cd('0x33')]();};}function saveUpdates(_0x398635,_0x35b5dd){return function(_0x43f2f2){if(_0x43f2f2){return _0x43f2f2[_0xe1cd('0x34')](_0x398635)['then'](function(_0x3a7b14){return _0x3a7b14;});}return null;};}function removeEntity(_0x19a4b4,_0x4790e9){return function(_0x99e514){if(_0x99e514){return _0x99e514[_0xe1cd('0x35')]()['then'](function(){var _0x303d91=_0x99e514[_0xe1cd('0x36')]({'plain':!![]});var _0x45a345=_0xe1cd('0x37');return db[_0xe1cd('0x38')]['destroy']({'where':{'type':_0x45a345,'resourceId':_0x303d91['id']}})[_0xe1cd('0x24')](function(){return _0x99e514;});})['then'](function(){_0x19a4b4[_0xe1cd('0x2c')](0xcc)[_0xe1cd('0x2d')]();});}};}function handleEntityNotFound(_0xa4585d,_0x41f1e1){return function(_0x4cbad9){if(!_0x4cbad9){_0xa4585d[_0xe1cd('0x39')](0x194);}return _0x4cbad9;};}function handleError(_0x392a4f,_0x372449){_0x372449=_0x372449||0x1f4;return function(_0xa42c6e){logger[_0xe1cd('0x29')](_0xa42c6e['stack']);if(_0xa42c6e[_0xe1cd('0x3a')]){delete _0xa42c6e['name'];}_0x392a4f['status'](_0x372449)['send'](_0xa42c6e);};}exports[_0xe1cd('0x3b')]=function(_0x27ad46,_0x4bc25b){var _0x47532b={'include':[{'model':db[_0xe1cd('0x3c')],'as':_0xe1cd('0x3d')}]},_0x3a3ca0={},_0x3c8f3b={'count':0x0,'rows':[]};var _0x599bb4=_[_0xe1cd('0x3e')](db[_0xe1cd('0x3f')][_0xe1cd('0x40')],function(_0x268462){return{'name':_0x268462[_0xe1cd('0x41')],'type':_0x268462['type'][_0xe1cd('0x42')]};});_0x3a3ca0['model']=_['map'](_0x599bb4,_0xe1cd('0x3a'));_0x3a3ca0[_0xe1cd('0x43')]=_[_0xe1cd('0x44')](_0x27ad46['query']);_0x3a3ca0[_0xe1cd('0x45')]=_['intersection'](_0x3a3ca0['model'],_0x3a3ca0[_0xe1cd('0x43')]);_0x47532b[_0xe1cd('0x46')]=_[_0xe1cd('0x47')](_0x3a3ca0['model'],qs[_0xe1cd('0x48')](_0x27ad46['query']['fields']));_0x47532b['attributes']=_0x47532b['attributes']['length']?_0x47532b['attributes']:_0x3a3ca0[_0xe1cd('0x49')];if(!_0x27ad46[_0xe1cd('0x43')][_0xe1cd('0x4a')](_0xe1cd('0x4b'))){_0x47532b[_0xe1cd('0x2f')]=qs['limit'](_0x27ad46[_0xe1cd('0x43')][_0xe1cd('0x2f')]);_0x47532b['offset']=qs[_0xe1cd('0x2e')](_0x27ad46[_0xe1cd('0x43')][_0xe1cd('0x2e')]);}_0x47532b[_0xe1cd('0x4c')]=qs['sort'](_0x27ad46[_0xe1cd('0x43')][_0xe1cd('0x4d')]);_0x47532b['where']=qs[_0xe1cd('0x45')](_[_0xe1cd('0x4e')](_0x27ad46['query'],_0x3a3ca0[_0xe1cd('0x45')]),_0x599bb4);if(_0x27ad46['query']['filter']){_0x47532b[_0xe1cd('0x4f')]=_[_0xe1cd('0x50')](_0x47532b[_0xe1cd('0x4f')],{'$or':_[_0xe1cd('0x3e')](_0x599bb4,function(_0x4e0fa3){if(_0x4e0fa3[_0xe1cd('0x51')]!==_0xe1cd('0x52')){var _0x55bd4e={};_0x55bd4e[_0x4e0fa3[_0xe1cd('0x3a')]]={'$like':'%'+_0x27ad46[_0xe1cd('0x43')]['filter']+'%'};return _0x55bd4e;}})});}_0x47532b=_[_0xe1cd('0x50')]({},_0x47532b,_0x27ad46[_0xe1cd('0x53')]);var _0xdb6037={'where':_0x47532b['where']};return db[_0xe1cd('0x3f')][_0xe1cd('0x54')](_0xdb6037)['then'](function(_0xed4159){_0x3c8f3b[_0xe1cd('0x54')]=_0xed4159;if(_0x27ad46[_0xe1cd('0x43')][_0xe1cd('0x55')]){_0x47532b[_0xe1cd('0x56')]=[{'all':!![]}];}return db[_0xe1cd('0x3f')]['findAll'](_0x47532b);})[_0xe1cd('0x24')](function(_0x50ac5b){_0x3c8f3b[_0xe1cd('0x57')]=_0x50ac5b;return _0x3c8f3b;})['then'](respondWithFilteredResult(_0x4bc25b,_0x47532b))['catch'](handleError(_0x4bc25b,null));};exports[_0xe1cd('0x58')]=function(_0x20658c,_0x258c79){var _0x3758ce={'raw':![],'where':{'id':_0x20658c[_0xe1cd('0x59')]['id']},'include':[{'model':db[_0xe1cd('0x3c')],'as':_0xe1cd('0x3d')}]},_0x110b98={};_0x110b98[_0xe1cd('0x49')]=_[_0xe1cd('0x44')](db[_0xe1cd('0x3f')][_0xe1cd('0x40')]);_0x110b98[_0xe1cd('0x43')]=_[_0xe1cd('0x44')](_0x20658c[_0xe1cd('0x43')]);_0x110b98['filters']=_[_0xe1cd('0x47')](_0x110b98[_0xe1cd('0x49')],_0x110b98[_0xe1cd('0x43')]);_0x3758ce[_0xe1cd('0x46')]=_[_0xe1cd('0x47')](_0x110b98[_0xe1cd('0x49')],qs[_0xe1cd('0x48')](_0x20658c[_0xe1cd('0x43')]['fields']));_0x3758ce[_0xe1cd('0x46')]=_0x3758ce[_0xe1cd('0x46')][_0xe1cd('0x5a')]?_0x3758ce[_0xe1cd('0x46')]:_0x110b98[_0xe1cd('0x49')];if(_0x20658c[_0xe1cd('0x43')][_0xe1cd('0x55')]){_0x3758ce[_0xe1cd('0x56')]=[{'all':!![]}];}_0x3758ce=_['merge']({},_0x3758ce,_0x20658c['options']);return db[_0xe1cd('0x3f')][_0xe1cd('0x5b')](_0x3758ce)['then'](handleEntityNotFound(_0x258c79,null))[_0xe1cd('0x24')](respondWithResult(_0x258c79,null))[_0xe1cd('0x5c')](handleError(_0x258c79,null));};exports['create']=function(_0x444f65,_0x2611e0){return db[_0xe1cd('0x3f')][_0xe1cd('0x5d')](_0x444f65['body'],{})['then'](function(_0x5eed30){var _0x20b6db=_0x444f65[_0xe1cd('0x5e')][_0xe1cd('0x36')]({'plain':!![]});if(!_0x20b6db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20b6db[_0xe1cd('0x5f')]==='user'){var _0x23e9f6=_0x5eed30[_0xe1cd('0x36')]({'plain':!![]});var _0x5cc632='FaxAccounts';return db[_0xe1cd('0x60')][_0xe1cd('0x5b')]({'where':{'name':_0x5cc632,'userProfileId':_0x20b6db['userProfileId']},'raw':!![]})[_0xe1cd('0x24')](function(_0x4367ba){if(_0x4367ba&&_0x4367ba['autoAssociation']===0x0){return db[_0xe1cd('0x38')][_0xe1cd('0x5d')]({'name':_0x23e9f6[_0xe1cd('0x3a')],'resourceId':_0x23e9f6['id'],'type':_0x4367ba[_0xe1cd('0x3a')],'sectionId':_0x4367ba['id']},{})[_0xe1cd('0x24')](function(){return _0x5eed30;});}else{return _0x5eed30;}})['catch'](function(_0xea9892){logger[_0xe1cd('0x29')](_0xe1cd('0x61'),_0xea9892);throw _0xea9892;});}return _0x5eed30;})['then'](respondWithResult(_0x2611e0,0xc9))[_0xe1cd('0x5c')](handleError(_0x2611e0,null));};exports[_0xe1cd('0x34')]=function(_0xe46568,_0x205013){if(_0xe46568[_0xe1cd('0x62')]['id']){delete _0xe46568[_0xe1cd('0x62')]['id'];}return db[_0xe1cd('0x3f')][_0xe1cd('0x5b')]({'where':{'id':_0xe46568[_0xe1cd('0x59')]['id']},'include':[{'model':db[_0xe1cd('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xe1cd('0x24')](handleEntityNotFound(_0x205013,null))[_0xe1cd('0x24')](saveUpdates(_0xe46568['body'],null))['then'](respondWithResult(_0x205013,null))['catch'](handleError(_0x205013,null));};exports[_0xe1cd('0x35')]=function(_0x337f5a,_0x5009f4){return db[_0xe1cd('0x3f')][_0xe1cd('0x5b')]({'where':{'id':_0x337f5a[_0xe1cd('0x59')]['id']}})['then'](handleEntityNotFound(_0x5009f4,null))['then'](removeEntity(_0x5009f4,null))[_0xe1cd('0x5c')](handleError(_0x5009f4,null));};exports[_0xe1cd('0x63')]=function(_0x504f53,_0x476fc3){return db[_0xe1cd('0x3f')][_0xe1cd('0x63')]()[_0xe1cd('0x24')](respondWithResult(_0x476fc3,null))[_0xe1cd('0x5c')](handleError(_0x476fc3,null));};exports[_0xe1cd('0x64')]=function(_0x2c108a,_0x389854,_0x53cde6){if(_0x2c108a['body']['id']){delete _0x2c108a['body']['id'];}return db[_0xe1cd('0x3f')][_0xe1cd('0x5b')]({'where':{'id':_0x2c108a[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x389854,null))[_0xe1cd('0x24')](function(_0x480c88){if(_0x480c88){_0x2c108a['body']['FaxAccountId']=_0x480c88['id'];return db[_0xe1cd('0x65')]['create'](_0x2c108a[_0xe1cd('0x62')]);}})[_0xe1cd('0x24')](respondWithResult(_0x389854,null))[_0xe1cd('0x5c')](handleError(_0x389854,null));};exports['getDispositions']=function(_0x961bc4,_0x33d7d3,_0x510762){var _0x392269={'raw':![],'where':{}};var _0x2ceb22={};var _0x3b0a92={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe1cd('0x66')]({'where':{'id':_0x961bc4[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x33d7d3,null))['then'](function(_0x468a91){if(_0x468a91){_0x2ceb22[_0xe1cd('0x49')]=_[_0xe1cd('0x44')](db[_0xe1cd('0x65')][_0xe1cd('0x40')]);_0x2ceb22[_0xe1cd('0x43')]=_[_0xe1cd('0x44')](_0x961bc4[_0xe1cd('0x43')]);_0x2ceb22[_0xe1cd('0x45')]=_['intersection'](_0x2ceb22['model'],_0x2ceb22[_0xe1cd('0x43')]);_0x392269[_0xe1cd('0x46')]=_[_0xe1cd('0x47')](_0x2ceb22[_0xe1cd('0x49')],qs['fields'](_0x961bc4[_0xe1cd('0x43')]['fields']));_0x392269['attributes']=_0x392269['attributes']['length']?_0x392269['attributes']:_0x2ceb22[_0xe1cd('0x49')];if(!_0x961bc4['query']['hasOwnProperty'](_0xe1cd('0x4b'))){_0x392269['limit']=qs[_0xe1cd('0x2f')](_0x961bc4[_0xe1cd('0x43')][_0xe1cd('0x2f')]);_0x392269['offset']=qs[_0xe1cd('0x2e')](_0x961bc4[_0xe1cd('0x43')][_0xe1cd('0x2e')]);}_0x392269[_0xe1cd('0x4c')]=qs['sort'](_0x961bc4[_0xe1cd('0x43')][_0xe1cd('0x4d')]);_0x392269[_0xe1cd('0x4f')]=qs[_0xe1cd('0x45')](_[_0xe1cd('0x4e')](_0x961bc4[_0xe1cd('0x43')],_0x2ceb22[_0xe1cd('0x45')]));_0x392269[_0xe1cd('0x4f')][_0xe1cd('0x67')]=_0x468a91['id'];if(_0x961bc4[_0xe1cd('0x43')][_0xe1cd('0x68')]){_0x392269['where']=_[_0xe1cd('0x50')](_0x392269['where'],{'$or':_[_0xe1cd('0x3e')](_0x392269[_0xe1cd('0x46')],function(_0x573044){var _0x376236={};_0x376236[_0x573044]={'$like':'%'+_0x961bc4[_0xe1cd('0x43')][_0xe1cd('0x68')]+'%'};return _0x376236;})});}_0x392269=_['merge']({},_0x392269,_0x961bc4[_0xe1cd('0x53')]);return db[_0xe1cd('0x65')][_0xe1cd('0x54')]({'where':_0x392269[_0xe1cd('0x4f')]})[_0xe1cd('0x24')](function(_0x248000){_0x3b0a92[_0xe1cd('0x54')]=_0x248000;if(_0x961bc4[_0xe1cd('0x43')][_0xe1cd('0x55')]){_0x392269[_0xe1cd('0x56')]=[{'all':!![]}];}return db[_0xe1cd('0x65')][_0xe1cd('0x69')](_0x392269);})[_0xe1cd('0x24')](function(_0x21ff24){_0x3b0a92[_0xe1cd('0x57')]=_0x21ff24;return _0x3b0a92;});}})['then'](respondWithFilteredResult(_0x33d7d3,_0x392269))['catch'](handleError(_0x33d7d3,null));};exports['removeDispositions']=function(_0x48bacf,_0x41a971,_0x384f54){return db[_0xe1cd('0x3f')]['find']({'where':{'id':_0x48bacf[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x41a971,null))[_0xe1cd('0x24')](function(_0x9fc035){if(_0x9fc035){return _0x9fc035['removeDispositions'](_0x48bacf[_0xe1cd('0x43')][_0xe1cd('0x6a')]);}})['then'](respondWithStatusCode(_0x41a971,null))[_0xe1cd('0x5c')](handleError(_0x41a971,null));};exports[_0xe1cd('0x6b')]=function(_0x4b4574,_0x1eb5cf,_0x3eaa84){if(_0x4b4574[_0xe1cd('0x62')]['id']){delete _0x4b4574[_0xe1cd('0x62')]['id'];}return db[_0xe1cd('0x3f')][_0xe1cd('0x5b')]({'where':{'id':_0x4b4574['params']['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x1eb5cf,null))[_0xe1cd('0x24')](function(_0x30dfee){if(_0x30dfee){_0x4b4574['body'][_0xe1cd('0x67')]=_0x30dfee['id'];return db['CannedAnswer']['create'](_0x4b4574[_0xe1cd('0x62')]);}})[_0xe1cd('0x24')](respondWithResult(_0x1eb5cf,null))[_0xe1cd('0x5c')](handleError(_0x1eb5cf,null));};exports[_0xe1cd('0x6c')]=function(_0x3d02b6,_0x1c5c3c,_0x267bbb){var _0xec03e={'raw':![],'where':{}};var _0x2fde44={};var _0x3e99fd={'count':0x0,'rows':[]};return db[_0xe1cd('0x3f')][_0xe1cd('0x66')]({'where':{'id':_0x3d02b6[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x1c5c3c,null))[_0xe1cd('0x24')](function(_0x2c0815){if(_0x2c0815){_0x2fde44['model']=_[_0xe1cd('0x44')](db[_0xe1cd('0x6d')][_0xe1cd('0x40')]);_0x2fde44['query']=_[_0xe1cd('0x44')](_0x3d02b6[_0xe1cd('0x43')]);_0x2fde44[_0xe1cd('0x45')]=_[_0xe1cd('0x47')](_0x2fde44[_0xe1cd('0x49')],_0x2fde44[_0xe1cd('0x43')]);_0xec03e[_0xe1cd('0x46')]=_['intersection'](_0x2fde44[_0xe1cd('0x49')],qs[_0xe1cd('0x48')](_0x3d02b6[_0xe1cd('0x43')][_0xe1cd('0x48')]));_0xec03e[_0xe1cd('0x46')]=_0xec03e['attributes'][_0xe1cd('0x5a')]?_0xec03e[_0xe1cd('0x46')]:_0x2fde44[_0xe1cd('0x49')];if(!_0x3d02b6['query'][_0xe1cd('0x4a')]('nolimit')){_0xec03e[_0xe1cd('0x2f')]=qs['limit'](_0x3d02b6[_0xe1cd('0x43')]['limit']);_0xec03e[_0xe1cd('0x2e')]=qs['offset'](_0x3d02b6[_0xe1cd('0x43')][_0xe1cd('0x2e')]);}_0xec03e['order']=qs['sort'](_0x3d02b6[_0xe1cd('0x43')][_0xe1cd('0x4d')]);_0xec03e[_0xe1cd('0x4f')]=qs[_0xe1cd('0x45')](_[_0xe1cd('0x4e')](_0x3d02b6[_0xe1cd('0x43')],_0x2fde44[_0xe1cd('0x45')]));_0xec03e[_0xe1cd('0x4f')][_0xe1cd('0x67')]=_0x2c0815['id'];if(_0x3d02b6[_0xe1cd('0x43')]['filter']){_0xec03e[_0xe1cd('0x4f')]=_[_0xe1cd('0x50')](_0xec03e[_0xe1cd('0x4f')],{'$or':_[_0xe1cd('0x3e')](_0xec03e[_0xe1cd('0x46')],function(_0x271a90){var _0x21c12f={};_0x21c12f[_0x271a90]={'$like':'%'+_0x3d02b6[_0xe1cd('0x43')][_0xe1cd('0x68')]+'%'};return _0x21c12f;})});}_0xec03e=_[_0xe1cd('0x50')]({},_0xec03e,_0x3d02b6[_0xe1cd('0x53')]);return db[_0xe1cd('0x6d')][_0xe1cd('0x54')]({'where':_0xec03e[_0xe1cd('0x4f')]})[_0xe1cd('0x24')](function(_0xc28c3c){_0x3e99fd[_0xe1cd('0x54')]=_0xc28c3c;if(_0x3d02b6[_0xe1cd('0x43')][_0xe1cd('0x55')]){_0xec03e['include']=[{'all':!![]}];}return db[_0xe1cd('0x6d')][_0xe1cd('0x69')](_0xec03e);})[_0xe1cd('0x24')](function(_0x48505e){_0x3e99fd['rows']=_0x48505e;return _0x3e99fd;});}})[_0xe1cd('0x24')](respondWithFilteredResult(_0x1c5c3c,_0xec03e))[_0xe1cd('0x5c')](handleError(_0x1c5c3c,null));};exports[_0xe1cd('0x6e')]=function(_0x42a00d,_0x3be200,_0x2433c2){return db['FaxAccount'][_0xe1cd('0x5b')]({'where':{'id':_0x42a00d[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x3be200,null))[_0xe1cd('0x24')](function(_0x294460){if(_0x294460){return _0x294460['removeAnswers'](_0x42a00d['query']['ids']);}})['then'](respondWithStatusCode(_0x3be200,null))[_0xe1cd('0x5c')](handleError(_0x3be200,null));};exports['addInteraction']=function(_0x124796,_0x4e074a,_0x42a558){return db['FaxInteraction'][_0xe1cd('0x5b')]({'where':{'id':_0x124796[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x4e074a,null))[_0xe1cd('0x24')](function(_0x5af1eb){if(_0x5af1eb){return _0x5af1eb['addInteraction'](_0x124796[_0xe1cd('0x62')][_0xe1cd('0x6a')],_[_0xe1cd('0x6f')](_0x124796[_0xe1cd('0x62')],[_0xe1cd('0x6a'),'id'])||{});}})[_0xe1cd('0x24')](respondWithResult(_0x4e074a,null))[_0xe1cd('0x5c')](handleError(_0x4e074a,null));};exports[_0xe1cd('0x70')]=function(_0xb24e0d,_0x525403,_0x66a3d5){var _0x462202={'raw':![],'where':{}};var _0x4b2dd4={};var _0x1fcc07={'count':0x0,'rows':[]};return db[_0xe1cd('0x3f')]['findOne']({'where':{'id':_0xb24e0d[_0xe1cd('0x59')]['id']}})['then'](handleEntityNotFound(_0x525403,null))[_0xe1cd('0x24')](function(_0x353a8f){if(_0x353a8f){_0x4b2dd4[_0xe1cd('0x49')]=_[_0xe1cd('0x44')](db[_0xe1cd('0x71')][_0xe1cd('0x40')]);_0x4b2dd4[_0xe1cd('0x43')]=_[_0xe1cd('0x44')](_0xb24e0d[_0xe1cd('0x43')]);_0x4b2dd4[_0xe1cd('0x45')]=_[_0xe1cd('0x47')](_0x4b2dd4['model'],_0x4b2dd4[_0xe1cd('0x43')]);_0x462202[_0xe1cd('0x46')]=_[_0xe1cd('0x47')](_0x4b2dd4[_0xe1cd('0x49')],qs[_0xe1cd('0x48')](_0xb24e0d[_0xe1cd('0x43')][_0xe1cd('0x48')]));_0x462202[_0xe1cd('0x46')]=_0x462202['attributes'][_0xe1cd('0x5a')]?_0x462202[_0xe1cd('0x46')]:_0x4b2dd4[_0xe1cd('0x49')];if(!_0xb24e0d[_0xe1cd('0x43')]['hasOwnProperty'](_0xe1cd('0x4b'))){_0x462202[_0xe1cd('0x2f')]=qs[_0xe1cd('0x2f')](_0xb24e0d[_0xe1cd('0x43')][_0xe1cd('0x2f')]);_0x462202['offset']=qs[_0xe1cd('0x2e')](_0xb24e0d[_0xe1cd('0x43')][_0xe1cd('0x2e')]);}_0x462202[_0xe1cd('0x4c')]=qs[_0xe1cd('0x4d')](_0xb24e0d[_0xe1cd('0x43')][_0xe1cd('0x4d')]);_0x462202['where']=qs[_0xe1cd('0x45')](_[_0xe1cd('0x4e')](_0xb24e0d[_0xe1cd('0x43')],_0x4b2dd4[_0xe1cd('0x45')]));_0x462202[_0xe1cd('0x4f')]['FaxAccountId']=_0x353a8f['id'];if(_0xb24e0d[_0xe1cd('0x43')]['filter']){_0x462202[_0xe1cd('0x4f')]=_['merge'](_0x462202[_0xe1cd('0x4f')],{'$or':_[_0xe1cd('0x3e')](_0x462202[_0xe1cd('0x46')],function(_0x5215cc){var _0x209b21={};_0x209b21[_0x5215cc]={'$like':'%'+_0xb24e0d['query'][_0xe1cd('0x68')]+'%'};return _0x209b21;})});}_0x462202=_['merge']({},_0x462202,_0xb24e0d['options']);return db[_0xe1cd('0x71')]['count']({'where':_0x462202['where']})[_0xe1cd('0x24')](function(_0x5948b4){_0x1fcc07[_0xe1cd('0x54')]=_0x5948b4;if(_0xb24e0d[_0xe1cd('0x43')][_0xe1cd('0x55')]){_0x462202[_0xe1cd('0x56')]=[{'model':db[_0xe1cd('0x72')],'as':_0xe1cd('0x73'),'required':![]},{'model':db['User'],'as':_0xe1cd('0x74'),'attributes':['name',_0xe1cd('0x75'),_0xe1cd('0x76')],'required':![]},{'model':db[_0xe1cd('0x77')],'as':_0xe1cd('0x78'),'attributes':['id',_0xe1cd('0x3a'),'color'],'where':_0xb24e0d[_0xe1cd('0x43')]['tag']?{'id':_0xb24e0d[_0xe1cd('0x43')][_0xe1cd('0x79')]}:undefined,'required':_0xb24e0d[_0xe1cd('0x43')]['tag']?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x462202);})[_0xe1cd('0x24')](function(_0x513651){_0x1fcc07[_0xe1cd('0x57')]=_0x513651;return _0x1fcc07;});}})[_0xe1cd('0x24')](respondWithFilteredResult(_0x525403,_0x462202))[_0xe1cd('0x5c')](handleError(_0x525403,null));};exports[_0xe1cd('0x7a')]=function(_0x3c6514,_0x2de647,_0x25572f){return db[_0xe1cd('0x3f')][_0xe1cd('0x66')]({'where':{'id':_0x3c6514[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x2de647,null))[_0xe1cd('0x24')](function(_0x2d7e31){if(_0x2d7e31){return db[_0xe1cd('0x7b')][_0xe1cd('0x7c')](function(_0x5699ab){return db['FaxApplication'][_0xe1cd('0x35')]({'where':{'FaxAccountId':_0x3c6514[_0xe1cd('0x59')]['id']},'transaction':_0x5699ab})[_0xe1cd('0x24')](function(_0x5d58c2){var _0x4bd878=_['map'](_0x3c6514[_0xe1cd('0x62')],function(_0x175c37){_0x175c37['FaxAccountId']=_0x3c6514[_0xe1cd('0x59')]['id'];return _0x175c37;});return db[_0xe1cd('0x7d')][_0xe1cd('0x7e')](_0x4bd878,{'transaction':_0x5699ab});});})[_0xe1cd('0x24')](function(){return db[_0xe1cd('0x7d')][_0xe1cd('0x7f')]({'where':{'FaxAccountId':_0x3c6514[_0xe1cd('0x59')]['id']},'order':_0xe1cd('0x80')});});}})[_0xe1cd('0x24')](respondWithResult(_0x2de647,null))[_0xe1cd('0x5c')](handleError(_0x2de647,null));};exports[_0xe1cd('0x81')]=function(_0x1a7885,_0x850b90,_0x4ec748){var _0x101662={};var _0x29d486={};var _0xc57dc5;var _0x20c6fa;return db[_0xe1cd('0x3f')][_0xe1cd('0x66')]({'where':{'id':_0x1a7885[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x850b90,null))[_0xe1cd('0x24')](function(_0x5e909c){if(_0x5e909c){_0xc57dc5=_0x5e909c;_0x29d486[_0xe1cd('0x49')]=_['keys'](db['FaxApplication'][_0xe1cd('0x40')]);_0x29d486[_0xe1cd('0x43')]=_[_0xe1cd('0x44')](_0x1a7885[_0xe1cd('0x43')]);_0x29d486['filters']=_[_0xe1cd('0x47')](_0x29d486['model'],_0x29d486[_0xe1cd('0x43')]);_0x101662[_0xe1cd('0x46')]=_[_0xe1cd('0x47')](_0x29d486['model'],qs[_0xe1cd('0x48')](_0x1a7885[_0xe1cd('0x43')][_0xe1cd('0x48')]));_0x101662['attributes']=_0x101662[_0xe1cd('0x46')][_0xe1cd('0x5a')]?_0x101662['attributes']:_0x29d486['model'];_0x101662[_0xe1cd('0x4c')]=qs['sort'](_0x1a7885[_0xe1cd('0x43')][_0xe1cd('0x4d')]);_0x101662[_0xe1cd('0x4f')]=qs['filters'](_[_0xe1cd('0x4e')](_0x1a7885['query'],_0x29d486['filters']));if(_0x1a7885[_0xe1cd('0x43')][_0xe1cd('0x68')]){_0x101662[_0xe1cd('0x4f')]=_[_0xe1cd('0x50')](_0x101662[_0xe1cd('0x4f')],{'$or':_[_0xe1cd('0x3e')](_0x101662[_0xe1cd('0x46')],function(_0x1d7a57){var _0x2049bc={};_0x2049bc[_0x1d7a57]={'$like':'%'+_0x1a7885[_0xe1cd('0x43')][_0xe1cd('0x68')]+'%'};return _0x2049bc;})});}_0x101662=_[_0xe1cd('0x50')]({},_0x101662,_0x1a7885[_0xe1cd('0x53')]);return _0xc57dc5[_0xe1cd('0x81')](_0x101662);}})[_0xe1cd('0x24')](function(_0x1f0e9f){if(_0x1f0e9f){_0x20c6fa=_0x1f0e9f[_0xe1cd('0x5a')];if(!_0x1a7885['query'][_0xe1cd('0x4a')](_0xe1cd('0x4b'))){_0x101662[_0xe1cd('0x2f')]=qs[_0xe1cd('0x2f')](_0x1a7885[_0xe1cd('0x43')]['limit']);_0x101662[_0xe1cd('0x2e')]=qs[_0xe1cd('0x2e')](_0x1a7885[_0xe1cd('0x43')][_0xe1cd('0x2e')]);}return _0xc57dc5['getApplications'](_0x101662);}})['then'](function(_0x2fc427){if(_0x2fc427){return _0x2fc427?{'count':_0x20c6fa,'rows':_0x2fc427}:null;}})[_0xe1cd('0x24')](respondWithResult(_0x850b90,null))['catch'](handleError(_0x850b90,null));};function Extension(_0x27cffd,_0x4a58a4,_0x397d57,_0x4df138){this[_0xe1cd('0x82')]=_0xe1cd('0x83');this[_0xe1cd('0x84')]=_0x27cffd[_0xe1cd('0x85')];this[_0xe1cd('0x86')]=_0x4df138;this[_0xe1cd('0x51')]=_0xe1cd('0x87');this[_0xe1cd('0x88')]=_0xe1cd('0x89');this[_0xe1cd('0x67')]=_0x27cffd['id'];this[_0xe1cd('0x80')]=_0x4a58a4;this[_0xe1cd('0x8a')]=_0x397d57;}function createExtensionsReciveFax(_0x1996d0){var _0x42991d=0x1;var _0x24d79e=[];_0x24d79e[_0xe1cd('0x8b')](new Extension(_0x1996d0,_0x42991d,'','Answer'));_0x42991d+=0x1;_0x24d79e['push'](new Extension(_0x1996d0,_0x42991d,_0xe1cd('0x8c'),_0xe1cd('0x8d')));_0x42991d+=0x1;for(var _0x41ebe8 in _0x1996d0){if(_0x1996d0['hasOwnProperty'](_0x41ebe8)&&(_0x41ebe8===_0xe1cd('0x8e')||_0x41ebe8===_0xe1cd('0x85')||_0x41ebe8===_0xe1cd('0x8f')||_0x41ebe8==='faxdetect'||_0x41ebe8==='headerinfo'||_0x41ebe8===_0xe1cd('0x90')||_0x41ebe8===_0xe1cd('0x91')||_0x41ebe8==='modem'||_0x41ebe8===_0xe1cd('0x92'))){_0x24d79e[_0xe1cd('0x8b')](new Extension(_0x1996d0,_0x42991d,'FAXOPT('+_0x41ebe8+')='+_0x1996d0[_0x41ebe8],_0xe1cd('0x8d')));_0x42991d+=0x1;}}_0x24d79e[_0xe1cd('0x8b')](new Extension(_0x1996d0,_0x42991d,'6',_0xe1cd('0x93')));_0x42991d+=0x1;_0x24d79e[_0xe1cd('0x8b')](new Extension(_0x1996d0,_0x42991d,_0xe1cd('0x94'),_0xe1cd('0x95')));_0x42991d=0x0;return _0x24d79e;}exports[_0xe1cd('0x96')]=function(_0x656460,_0x59d03d,_0x4fe113){var _0x17b59b;return db[_0xe1cd('0x7b')]['transaction'](function(_0x537c5a){return db['FaxAccount'][_0xe1cd('0x5d')](_0x656460[_0xe1cd('0x62')],{'transaction':_0x537c5a})[_0xe1cd('0x24')](function(_0x2bab67){_0x17b59b=_0x2bab67[_0xe1cd('0x36')]({'plain':!![]});return db[_0xe1cd('0x97')][_0xe1cd('0x7e')](createExtensionsReciveFax(_0x17b59b),{'transaction':_0x537c5a});});})[_0xe1cd('0x24')](function(){return _0x17b59b;})[_0xe1cd('0x24')](respondWithResult(_0x59d03d,null))[_0xe1cd('0x5c')](handleError(_0x59d03d,null));};exports['updateAccountApplications']=function(_0x351123,_0x47ae60,_0x47161a){var _0x49b4d7;return db[_0xe1cd('0x7b')][_0xe1cd('0x7c')](function(_0xb8228){return db[_0xe1cd('0x3f')][_0xe1cd('0x34')](_0x351123['body'],{'where':{'id':_0x351123[_0xe1cd('0x62')]['id']},'transaction':_0xb8228})[_0xe1cd('0x24')](function(_0x1af415){return db['VoiceExtension'][_0xe1cd('0x35')]({'where':{'FaxAccountId':_0x351123[_0xe1cd('0x62')]['id']},'transaction':_0xb8228})['then'](function(_0x2a7e02){return db['VoiceExtension'][_0xe1cd('0x7e')](createExtensionsReciveFax(_[_0xe1cd('0x6f')](_0x351123[_0xe1cd('0x62')],[_0xe1cd('0x98'),_0xe1cd('0x42'),'createdAt',_0xe1cd('0x99'),'TrunkId',_0xe1cd('0x9a')])),{'transaction':_0xb8228});});});})[_0xe1cd('0x24')](function(){return db[_0xe1cd('0x3f')][_0xe1cd('0x9b')](_0x351123[_0xe1cd('0x62')]['id']);})[_0xe1cd('0x24')](respondWithResult(_0x47ae60,null))[_0xe1cd('0x5c')](handleError(_0x47ae60,null));};exports[_0xe1cd('0x9c')]=function(_0x53ebb3,_0x8ec4b0,_0x525ab3){var _0x2369d4={'raw':!![],'where':{}};var _0x5871f5={};var _0x31bce5={'count':0x0,'rows':[]};return db[_0xe1cd('0x3f')]['findOne']({'where':{'id':_0x53ebb3['params']['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x8ec4b0,null))[_0xe1cd('0x24')](function(_0x596a68){if(_0x596a68){_0x5871f5[_0xe1cd('0x49')]=_['keys'](db[_0xe1cd('0x9d')][_0xe1cd('0x40')]);_0x5871f5[_0xe1cd('0x43')]=_[_0xe1cd('0x44')](_0x53ebb3[_0xe1cd('0x43')]);_0x5871f5[_0xe1cd('0x45')]=_['intersection'](_0x5871f5['model'],_0x5871f5[_0xe1cd('0x43')]);_0x2369d4[_0xe1cd('0x46')]=_[_0xe1cd('0x47')](_0x5871f5[_0xe1cd('0x49')],qs[_0xe1cd('0x48')](_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x48')]));_0x2369d4[_0xe1cd('0x46')]=_0x2369d4[_0xe1cd('0x46')]['length']?_0x2369d4['attributes']:_0x5871f5[_0xe1cd('0x49')];if(!_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x4a')](_0xe1cd('0x4b'))){_0x2369d4[_0xe1cd('0x2f')]=qs[_0xe1cd('0x2f')](_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x2f')]);_0x2369d4['offset']=qs[_0xe1cd('0x2e')](_0x53ebb3[_0xe1cd('0x43')]['offset']);}_0x2369d4[_0xe1cd('0x4c')]=qs[_0xe1cd('0x4d')](_0x53ebb3['query']['sort']);_0x2369d4['where']=qs['filters'](_[_0xe1cd('0x4e')](_0x53ebb3[_0xe1cd('0x43')],_0x5871f5[_0xe1cd('0x45')]));_0x2369d4[_0xe1cd('0x4f')][_0xe1cd('0x67')]=_0x596a68['id'];if(_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x68')]){_0x2369d4[_0xe1cd('0x4f')]=_[_0xe1cd('0x50')](_0x2369d4['where'],{'$or':_[_0xe1cd('0x3e')](_0x2369d4[_0xe1cd('0x46')],function(_0x2f9037){var _0x36b786={};_0x36b786[_0x2f9037]={'$like':'%'+_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x68')]+'%'};return _0x36b786;})});}if(_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x9e')]){var _0x79cbc4=_0x53ebb3[_0xe1cd('0x43')][_0xe1cd('0x9e')]['split'](',');var _0x341418={};_0x341418[_0x79cbc4[0x0]]={'$gte':moment(_0x79cbc4[0x1])[_0xe1cd('0x9f')](_0xe1cd('0xa0'))};_0x2369d4[_0xe1cd('0x4f')]=_[_0xe1cd('0x50')](_0x2369d4[_0xe1cd('0x4f')],_0x341418);}_0x2369d4=_[_0xe1cd('0x50')]({},_0x2369d4,_0x53ebb3['options']);return db['FaxMessage'][_0xe1cd('0x54')]({'where':_0x2369d4[_0xe1cd('0x4f')]})['then'](function(_0x4b8229){_0x31bce5['count']=_0x4b8229;if(_0x53ebb3[_0xe1cd('0x43')]['includeAll']){_0x2369d4[_0xe1cd('0x56')]=[{'all':!![]}];}return db[_0xe1cd('0x9d')][_0xe1cd('0x69')](_0x2369d4);})[_0xe1cd('0x24')](function(_0x4bc503){_0x31bce5['rows']=_0x4bc503;return _0x31bce5;});}})[_0xe1cd('0x24')](respondWithFilteredResult(_0x8ec4b0,_0x2369d4))[_0xe1cd('0x5c')](handleError(_0x8ec4b0,null));};exports['send']=function(_0x537b0f,_0x212531,_0x3c0372){var _0xe6a1c3,_0x5e93f9={},_0x19b64c;if(_0x537b0f[_0xe1cd('0x62')]['to']){_0x19b64c=_0x537b0f[_0xe1cd('0x62')]['to'][0x0];}return db[_0xe1cd('0x3f')]['find']({'where':{'id':_0x537b0f[_0xe1cd('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe1cd('0x72')],'as':_0xe1cd('0xa1'),'where':{'fax':_0x19b64c},'limit':0x1,'order':[['updatedAt',_0xe1cd('0xa2')]]}]}]})[_0xe1cd('0x24')](handleEntityNotFound(_0x212531,null))['then'](function(_0x5e627f){_0xe6a1c3=_0x5e627f;if(_0x537b0f[_0xe1cd('0x62')][_0xe1cd('0xa3')]&&_0x537b0f[_0xe1cd('0x62')]['attachments'][_0xe1cd('0x5a')]){for(var _0x4286ce=0x0;_0x4286ce<_0x537b0f[_0xe1cd('0x62')][_0xe1cd('0xa3')][_0xe1cd('0x5a')];_0x4286ce+=0x1){_0x537b0f[_0xe1cd('0x62')][_0xe1cd('0xa3')][_0x4286ce]={'filename':_0x537b0f['body'][_0xe1cd('0xa3')][_0x4286ce]['name'],'id':_0x537b0f[_0xe1cd('0x62')]['attachments'][_0x4286ce]['id'],'path':path[_0xe1cd('0xa4')](config['root'],_0xe1cd('0xa5'),_0x537b0f[_0xe1cd('0x62')]['attachments'][_0x4286ce][_0xe1cd('0xa6')])};}}return respondWithRpcPromise('CheckAfterSend',_0xe1cd('0xa7'),{'FaxAccountId':_[_0xe1cd('0xa8')](_0x537b0f[_0xe1cd('0x59')]['id'])?undefined:_0x537b0f[_0xe1cd('0x59')]['id'],'path':_[_0xe1cd('0xa8')](_0x537b0f[_0xe1cd('0x62')]['attachments'][0x0][_0xe1cd('0x9')])?undefined:_0x537b0f['body']['attachments'][0x0]['path'],'fax':_[_0xe1cd('0xa8')](_0x537b0f[_0xe1cd('0x62')]['to'][0x0])?undefined:_0x537b0f['body']['to'][0x0]},client9002);})[_0xe1cd('0x24')](function(){if(_0xe6a1c3){if(_[_0xe1cd('0xa8')](_0x537b0f[_0xe1cd('0x62')][_0xe1cd('0xa9')])){_0x537b0f[_0xe1cd('0x62')]['from']=util['format'](_0xe1cd('0xaa'),_0xe6a1c3[_0xe1cd('0x3a')],_0xe6a1c3['fax']);}if(_0xe6a1c3[_0xe1cd('0xab')]){if(_0xe6a1c3[_0xe1cd('0xab')][_0xe1cd('0xa1')]['length']){return _0xe6a1c3[_0xe1cd('0xab')][_0xe1cd('0xa1')][0x0];}else{return db['CmContact'][_0xe1cd('0x5d')](_[_0xe1cd('0xac')](_0x537b0f[_0xe1cd('0x62')],{'firstName':_0x537b0f[_0xe1cd('0x62')]['to'][0x0],'phone':_0x537b0f[_0xe1cd('0x62')]['to'][0x0],'fax':_0x537b0f[_0xe1cd('0x62')]['to'][0x0],'ListId':_0xe6a1c3[_0xe1cd('0x9a')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xe1cd('0xad'));}})[_0xe1cd('0x24')](function(_0x443c30){if(_0x443c30){return db[_0xe1cd('0x71')][_0xe1cd('0x5b')]({'where':{'ContactId':_0x443c30['id'],'closed':![],'FaxAccountId':_0xe6a1c3['id']}})[_0xe1cd('0x24')](function(_0x179924){if(_0x179924){return[_0x179924,![]];}return db['FaxInteraction'][_0xe1cd('0x5d')]({'UserId':_0x537b0f['user']['id'],'ContactId':_0x443c30['id'],'FaxAccountId':_0xe6a1c3['id'],'fax':_0x537b0f['body']['to'][0x0],'firstMsgDirection':_0xe1cd('0xae'),'Messages':[_[_0xe1cd('0x50')](_0x537b0f[_0xe1cd('0x62')],{'read':![],'body':_0x537b0f['body'][_0xe1cd('0xa3')][0x0]['filename'],'FaxAccountId':_0xe6a1c3['id'],'UserId':_0x537b0f[_0xe1cd('0x5e')]['id'],'ContactId':_0x443c30['id'],'AttachmentId':_0x537b0f['body'][_0xe1cd('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xe1cd('0x9d')],'as':_0xe1cd('0xaf')}]})[_0xe1cd('0x24')](function(_0x23dfc2){return[_0x23dfc2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xe1cd('0xb0')](function(_0x947bce,_0x416a3f){if(_0x416a3f){return _0x947bce;}return db['FaxMessage'][_0xe1cd('0x5d')]({'direction':'out','read':![],'body':_0x537b0f[_0xe1cd('0x62')][_0xe1cd('0xa3')][0x0][_0xe1cd('0xb1')],'FaxAccountId':_0xe6a1c3['id'],'FaxInteractionId':_0x947bce['id'],'UserId':_0x537b0f[_0xe1cd('0x5e')]['id'],'ContactId':_0x947bce[_0xe1cd('0xb2')],'AttachmentId':_0x537b0f['body'][_0xe1cd('0xa3')][0x0]['id']})['then'](function(_0xef276){_0x947bce[_0xe1cd('0xb3')][_0xe1cd('0xaf')]=[];_0x947bce['dataValues'][_0xe1cd('0xaf')][_0xe1cd('0x8b')](_0xef276['dataValues']);return _0x947bce;});})[_0xe1cd('0x24')](function(_0x18679b){respondWithRpcPromise(_0xe1cd('0xb4'),_0xe1cd('0xb4'),{'FaxAccountId':_[_0xe1cd('0xa8')](_0x537b0f[_0xe1cd('0x59')]['id'])?undefined:_0x537b0f[_0xe1cd('0x59')]['id'],'path':_[_0xe1cd('0xa8')](_0x537b0f[_0xe1cd('0x62')]['attachments'][0x0][_0xe1cd('0x9')])?undefined:_0x537b0f['body'][_0xe1cd('0xa3')][0x0][_0xe1cd('0x9')],'fax':_[_0xe1cd('0xa8')](_0x537b0f['body']['to'][0x0])?undefined:_0x537b0f['body']['to'][0x0],'AttachmentId':_0x537b0f[_0xe1cd('0x62')][_0xe1cd('0xa3')][0x0]['id']},client9002)[_0xe1cd('0x24')](function(_0x5b71e9){logger['info'](_0xe1cd('0xb5'),_0x5b71e9);})[_0xe1cd('0x5c')](function(_0x22fcaa){logger['info'](_0xe1cd('0xb5'),_0x22fcaa);});return _0x18679b;})[_0xe1cd('0x24')](respondWithResult(_0x212531,null))[_0xe1cd('0x5c')](handleError(_0x212531,null));};exports[_0xe1cd('0xb6')]=function(_0x312b9e,_0x50131c,_0x34322a){return db[_0xe1cd('0x3f')]['find']({'where':{'id':_0x312b9e[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x50131c,null))['then'](function(_0x499ce7){if(_0x499ce7){return _0x499ce7[_0xe1cd('0xb6')](_0x312b9e[_0xe1cd('0x62')]['ids'],_['omit'](_0x312b9e[_0xe1cd('0x62')],[_0xe1cd('0x6a'),'id'])||{})[_0xe1cd('0xb0')](function(_0x3df49a){for(var _0xde79ea=0x0;_0xde79ea<_0x312b9e[_0xe1cd('0x62')][_0xe1cd('0x6a')][_0xe1cd('0x5a')];_0xde79ea+=0x1){socket[_0xe1cd('0xb7')](_0xe1cd('0xb8'),{'UserId':_0x312b9e[_0xe1cd('0x62')]['ids'][_0xde79ea],'FaxAccountId':_0x312b9e['params']['id']});}return _0x3df49a;});}})['then'](respondWithResult(_0x50131c,null))[_0xe1cd('0x5c')](handleError(_0x50131c,null));};exports['removeAgents']=function(_0x351def,_0x1cdc2a,_0x896a29){return db[_0xe1cd('0x3f')][_0xe1cd('0x5b')]({'where':{'id':_0x351def['params']['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x1cdc2a,null))[_0xe1cd('0x24')](function(_0x1bc313){if(_0x1bc313){return _0x1bc313[_0xe1cd('0xb9')](_0x351def[_0xe1cd('0x43')]['ids'])[_0xe1cd('0x24')](function(){if(_[_0xe1cd('0xba')](_0x351def[_0xe1cd('0x43')][_0xe1cd('0x6a')])){for(var _0x2efdd4=0x0;_0x2efdd4<_0x351def['query'][_0xe1cd('0x6a')]['length'];_0x2efdd4+=0x1){socket[_0xe1cd('0xb7')](_0xe1cd('0xbb'),{'UserId':Number(_0x351def[_0xe1cd('0x43')][_0xe1cd('0x6a')][_0x2efdd4]),'FaxAccountId':Number(_0x351def[_0xe1cd('0x59')]['id'])});}}else{socket[_0xe1cd('0xb7')](_0xe1cd('0xbb'),{'UserId':Number(_0x351def['query'][_0xe1cd('0x6a')]),'FaxAccountId':Number(_0x351def[_0xe1cd('0x59')]['id'])});}});}})[_0xe1cd('0x24')](respondWithStatusCode(_0x1cdc2a,null))[_0xe1cd('0x5c')](handleError(_0x1cdc2a,null));};exports[_0xe1cd('0xbc')]=function(_0x36fa39,_0x5a399d,_0x12a948){var _0x2e50b1={};var _0x229eff={};var _0x3e6c93;var _0x41c74f;return db[_0xe1cd('0x3f')][_0xe1cd('0x66')]({'where':{'id':_0x36fa39[_0xe1cd('0x59')]['id']}})[_0xe1cd('0x24')](handleEntityNotFound(_0x5a399d,null))[_0xe1cd('0x24')](function(_0x5e158a){if(_0x5e158a){_0x3e6c93=_0x5e158a;_0x229eff[_0xe1cd('0x49')]=_[_0xe1cd('0x44')](db[_0xe1cd('0xbd')][_0xe1cd('0x40')]);_0x229eff['query']=_[_0xe1cd('0x44')](_0x36fa39[_0xe1cd('0x43')]);_0x229eff[_0xe1cd('0x45')]=_['intersection'](_0x229eff[_0xe1cd('0x49')],_0x229eff['query']);_0x2e50b1[_0xe1cd('0x46')]=_['intersection'](_0x229eff['model'],qs['fields'](_0x36fa39[_0xe1cd('0x43')][_0xe1cd('0x48')]));_0x2e50b1[_0xe1cd('0x46')]=_0x2e50b1[_0xe1cd('0x46')][_0xe1cd('0x5a')]?_0x2e50b1['attributes']:_0x229eff['model'];_0x2e50b1[_0xe1cd('0x4c')]=qs[_0xe1cd('0x4d')](_0x36fa39['query'][_0xe1cd('0x4d')]);_0x2e50b1[_0xe1cd('0x4f')]=qs[_0xe1cd('0x45')](_[_0xe1cd('0x4e')](_0x36fa39['query'],_0x229eff[_0xe1cd('0x45')]));if(_0x36fa39[_0xe1cd('0x43')][_0xe1cd('0x68')]){_0x2e50b1[_0xe1cd('0x4f')]=_['merge'](_0x2e50b1[_0xe1cd('0x4f')],{'$or':_[_0xe1cd('0x3e')](_0x2e50b1[_0xe1cd('0x46')],function(_0x242422){var _0x505227={};_0x505227[_0x242422]={'$like':'%'+_0x36fa39[_0xe1cd('0x43')][_0xe1cd('0x68')]+'%'};return _0x505227;})});}_0x2e50b1=_[_0xe1cd('0x50')]({},_0x2e50b1,_0x36fa39[_0xe1cd('0x53')]);return _0x3e6c93[_0xe1cd('0xbc')](_0x2e50b1);}})[_0xe1cd('0x24')](function(_0x13ba26){if(_0x13ba26){_0x41c74f=_0x13ba26[_0xe1cd('0x5a')];if(!_0x36fa39[_0xe1cd('0x43')]['hasOwnProperty'](_0xe1cd('0x4b'))){_0x2e50b1[_0xe1cd('0x2f')]=qs['limit'](_0x36fa39[_0xe1cd('0x43')][_0xe1cd('0x2f')]);_0x2e50b1['offset']=qs[_0xe1cd('0x2e')](_0x36fa39['query']['offset']);}return _0x3e6c93[_0xe1cd('0xbc')](_0x2e50b1);}})['then'](function(_0x363934){if(_0x363934){return _0x363934?{'count':_0x41c74f,'rows':_0x363934}:null;}})[_0xe1cd('0x24')](respondWithResult(_0x5a399d,null))[_0xe1cd('0x5c')](handleError(_0x5a399d,null));}; \ No newline at end of file +var _0x66d1=['describe','addDisposition','Disposition','findOne','hasOwnProperty','pick','FaxAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','order','context','from-voip-provider','exten','localstationid','app','description','appdata','push','Answer','Set','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','VoiceExtension','omit','tech','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','FaxMessage','send','CmList','List','Contacts','attachments','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','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','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','query','keys','model','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','Pause','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params'];(function(_0x14473f,_0x34afcc){var _0x5e05e5=function(_0xc40b36){while(--_0xc40b36){_0x14473f['push'](_0x14473f['shift']());}};_0x5e05e5(++_0x34afcc);}(_0x66d1,0x1ea));var _0x166d=function(_0xbbeaac,_0x2da9a0){_0xbbeaac=_0xbbeaac-0x0;var _0x11ca51=_0x66d1[_0xbbeaac];return _0x11ca51;};'use strict';var pdf=require(_0x166d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x166d('0x1'));var zipdir=require(_0x166d('0x2'));var jsonpatch=require(_0x166d('0x3'));var rp=require(_0x166d('0x4'));var moment=require(_0x166d('0x5'));var BPromise=require(_0x166d('0x6'));var Mustache=require(_0x166d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x166d('0x8'));var csv=require(_0x166d('0x9'));var ejs=require(_0x166d('0xa'));var fs=require('fs');var _=require(_0x166d('0xb'));var squel=require(_0x166d('0xc'));var crypto=require(_0x166d('0xd'));var jsforce=require(_0x166d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x166d('0x9'));var querystring=require(_0x166d('0xf'));var Papa=require(_0x166d('0x10'));var Redis=require(_0x166d('0x11'));var authService=require(_0x166d('0x12'));var qs=require(_0x166d('0x13'));var as=require(_0x166d('0x14'));var hardwareService=require(_0x166d('0x15'));var logger=require(_0x166d('0x16'))('api');var utils=require(_0x166d('0x17'));var config=require('../../config/environment');var db=require(_0x166d('0x18'))['db'];config[_0x166d('0x19')]=_[_0x166d('0x1a')](config[_0x166d('0x19')],{'host':_0x166d('0x1b'),'port':0x18eb});var socket=require(_0x166d('0x1c'))(new Redis(config[_0x166d('0x19')]));require(_0x166d('0x1d'))[_0x166d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x166d('0x1f')][_0x166d('0x20')]({'port':0x232c});var client9002=jayson[_0x166d('0x1f')][_0x166d('0x20')]({'port':0x232a});function checkPasswordPattern(_0x12fde5,_0x318a2d,_0x5a6119){if(_0x5a6119){var _0x517f41=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x517f41[_0x166d('0x21')](_0x318a2d)){return _0x12fde5;}else{throw new db[(_0x166d('0x22'))][(_0x166d('0x23'))](_0x166d('0x24'));}}else{return _0x12fde5;}}function respondWithRpcPromise(_0x32e1f9,_0x30935d,_0xe986e4,_0x2b0dd3){return new BPromise(function(_0x12c608,_0x705387){var _0x28e19c=_0x2b0dd3||client;return _0x28e19c[_0x166d('0x25')](_0x32e1f9,_0xe986e4)[_0x166d('0x26')](function(_0x47f158){logger[_0x166d('0x27')](_0x166d('0x28'),_0x30935d,'request\x20sent');logger['debug'](_0x166d('0x29'),_0x30935d,_0x166d('0x2a'),JSON['stringify'](_0x47f158));if(_0x47f158[_0x166d('0x2b')]){if(_0x47f158['error']['code']===0x1f4){logger[_0x166d('0x2b')](_0x166d('0x28'),_0x30935d,_0x47f158['error'][_0x166d('0x2c')]);return _0x705387(_0x47f158[_0x166d('0x2b')]['message']);}logger[_0x166d('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x30935d,_0x47f158[_0x166d('0x2b')][_0x166d('0x2c')]);return _0x12c608(_0x47f158['error'][_0x166d('0x2c')]);}else{logger['info'](_0x166d('0x28'),_0x30935d,'request\x20sent');_0x12c608(_0x47f158[_0x166d('0x2d')]['message']);}})[_0x166d('0x2e')](function(_0x4a474e){logger[_0x166d('0x2b')](_0x166d('0x28'),_0x30935d,_0x4a474e);_0x705387(_0x4a474e);});});}function respondWithStatusCode(_0x49be18,_0x5bf707){_0x5bf707=_0x5bf707||0xcc;return function(_0x533441){if(_0x533441){return _0x49be18['sendStatus'](_0x5bf707);}return _0x49be18[_0x166d('0x2f')](_0x5bf707)[_0x166d('0x30')]();};}function respondWithResult(_0x1eeabc,_0x185621){_0x185621=_0x185621||0xc8;return function(_0x3c377a){if(_0x3c377a){return _0x1eeabc['status'](_0x185621)[_0x166d('0x31')](_0x3c377a);}};}function respondWithFilteredResult(_0x53b458,_0x1288cd){return function(_0x2ef132){if(_0x2ef132){var _0x2d8729=_0x2ef132[_0x166d('0x32')],_0x38e66f=_0x1288cd[_0x166d('0x33')],_0x54b859=_0x1288cd[_0x166d('0x33')]+_0x1288cd[_0x166d('0x34')],_0x7d2fb7;if(_0x54b859>=_0x2d8729){_0x54b859=_0x2d8729;_0x7d2fb7=0xc8;}else{_0x7d2fb7=0xce;}_0x53b458[_0x166d('0x2f')](_0x7d2fb7);return _0x53b458[_0x166d('0x35')](_0x166d('0x36'),_0x38e66f+'-'+_0x54b859+'/'+_0x2d8729)[_0x166d('0x31')](_0x2ef132);}return null;};}function patchUpdates(_0x207904){return function(_0x42a15d){try{jsonpatch[_0x166d('0x37')](_0x42a15d,_0x207904,!![]);}catch(_0x221627){return BPromise[_0x166d('0x38')](_0x221627);}return _0x42a15d[_0x166d('0x39')]();};}function saveUpdates(_0x397062,_0x3c2812){return function(_0x363850){if(_0x363850){return _0x363850[_0x166d('0x3a')](_0x397062)[_0x166d('0x26')](function(_0x4b9045){return _0x4b9045;});}return null;};}function removeEntity(_0x4dc054,_0x4cd177){return function(_0x3d4507){if(_0x3d4507){return _0x3d4507[_0x166d('0x3b')]()[_0x166d('0x26')](function(){var _0x541657=_0x3d4507[_0x166d('0x3c')]({'plain':!![]});var _0x29eff6='FaxAccounts';return db[_0x166d('0x3d')][_0x166d('0x3b')]({'where':{'type':_0x29eff6,'resourceId':_0x541657['id']}})[_0x166d('0x26')](function(){return _0x3d4507;});})[_0x166d('0x26')](function(){_0x4dc054[_0x166d('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20f190,_0x42c86f){return function(_0x27036e){if(!_0x27036e){_0x20f190['sendStatus'](0x194);}return _0x27036e;};}function handleError(_0x263f96,_0x44ce33){_0x44ce33=_0x44ce33||0x1f4;return function(_0x2e8a55){logger['error'](_0x2e8a55[_0x166d('0x3e')]);if(_0x2e8a55['name']){delete _0x2e8a55[_0x166d('0x3f')];}_0x263f96['status'](_0x44ce33)['send'](_0x2e8a55);};}exports[_0x166d('0x40')]=function(_0x380087,_0x51f496){var _0x1b55ce={'include':[{'model':db['Pause'],'as':_0x166d('0x41')}]},_0x300aa0={},_0x103041={'count':0x0,'rows':[]};var _0x220605=_[_0x166d('0x42')](db[_0x166d('0x43')][_0x166d('0x44')],function(_0x3586ea){return{'name':_0x3586ea[_0x166d('0x45')],'type':_0x3586ea[_0x166d('0x46')]['key']};});_0x300aa0['model']=_[_0x166d('0x42')](_0x220605,'name');_0x300aa0[_0x166d('0x47')]=_[_0x166d('0x48')](_0x380087[_0x166d('0x47')]);_0x300aa0['filters']=_['intersection'](_0x300aa0[_0x166d('0x49')],_0x300aa0[_0x166d('0x47')]);_0x1b55ce[_0x166d('0x4a')]=_['intersection'](_0x300aa0[_0x166d('0x49')],qs[_0x166d('0x4b')](_0x380087[_0x166d('0x47')][_0x166d('0x4b')]));_0x1b55ce['attributes']=_0x1b55ce[_0x166d('0x4a')][_0x166d('0x4c')]?_0x1b55ce['attributes']:_0x300aa0['model'];if(!_0x380087['query']['hasOwnProperty'](_0x166d('0x4d'))){_0x1b55ce[_0x166d('0x34')]=qs['limit'](_0x380087[_0x166d('0x47')][_0x166d('0x34')]);_0x1b55ce[_0x166d('0x33')]=qs[_0x166d('0x33')](_0x380087['query'][_0x166d('0x33')]);}_0x1b55ce['order']=qs[_0x166d('0x4e')](_0x380087[_0x166d('0x47')][_0x166d('0x4e')]);_0x1b55ce['where']=qs[_0x166d('0x4f')](_['pick'](_0x380087[_0x166d('0x47')],_0x300aa0[_0x166d('0x4f')]),_0x220605);if(_0x380087[_0x166d('0x47')][_0x166d('0x50')]){_0x1b55ce[_0x166d('0x51')]=_[_0x166d('0x52')](_0x1b55ce['where'],{'$or':_[_0x166d('0x42')](_0x220605,function(_0x199bc2){if(_0x199bc2[_0x166d('0x46')]!==_0x166d('0x53')){var _0x537ab6={};_0x537ab6[_0x199bc2['name']]={'$like':'%'+_0x380087['query'][_0x166d('0x50')]+'%'};return _0x537ab6;}})});}_0x1b55ce=_[_0x166d('0x52')]({},_0x1b55ce,_0x380087[_0x166d('0x54')]);var _0x24752c={'where':_0x1b55ce[_0x166d('0x51')]};return db['FaxAccount'][_0x166d('0x32')](_0x24752c)[_0x166d('0x26')](function(_0x3ef22c){_0x103041['count']=_0x3ef22c;if(_0x380087[_0x166d('0x47')]['includeAll']){_0x1b55ce[_0x166d('0x55')]=[{'all':!![]}];}return db[_0x166d('0x43')][_0x166d('0x56')](_0x1b55ce);})[_0x166d('0x26')](function(_0x33ac4b){_0x103041[_0x166d('0x57')]=_0x33ac4b;return _0x103041;})[_0x166d('0x26')](respondWithFilteredResult(_0x51f496,_0x1b55ce))[_0x166d('0x2e')](handleError(_0x51f496,null));};exports[_0x166d('0x58')]=function(_0x4e1731,_0x3f7244){var _0x56ec23={'raw':![],'where':{'id':_0x4e1731['params']['id']},'include':[{'model':db[_0x166d('0x59')],'as':'mandatoryDispositionPause'}]},_0x57772={};_0x57772[_0x166d('0x49')]=_[_0x166d('0x48')](db['FaxAccount'][_0x166d('0x44')]);_0x57772[_0x166d('0x47')]=_[_0x166d('0x48')](_0x4e1731['query']);_0x57772[_0x166d('0x4f')]=_[_0x166d('0x5a')](_0x57772['model'],_0x57772[_0x166d('0x47')]);_0x56ec23[_0x166d('0x4a')]=_[_0x166d('0x5a')](_0x57772[_0x166d('0x49')],qs[_0x166d('0x4b')](_0x4e1731['query']['fields']));_0x56ec23[_0x166d('0x4a')]=_0x56ec23['attributes'][_0x166d('0x4c')]?_0x56ec23[_0x166d('0x4a')]:_0x57772[_0x166d('0x49')];if(_0x4e1731[_0x166d('0x47')][_0x166d('0x5b')]){_0x56ec23[_0x166d('0x55')]=[{'all':!![]}];}_0x56ec23=_[_0x166d('0x52')]({},_0x56ec23,_0x4e1731[_0x166d('0x54')]);return db[_0x166d('0x43')][_0x166d('0x5c')](_0x56ec23)[_0x166d('0x26')](handleEntityNotFound(_0x3f7244,null))[_0x166d('0x26')](respondWithResult(_0x3f7244,null))['catch'](handleError(_0x3f7244,null));};exports[_0x166d('0x5d')]=function(_0x3b03bd,_0x1f3a8b){return db[_0x166d('0x43')]['create'](_0x3b03bd['body'],{})['then'](function(_0x2c9cb6){var _0x52a916=_0x3b03bd['user'][_0x166d('0x3c')]({'plain':!![]});if(!_0x52a916)throw new Error(_0x166d('0x5e'));if(_0x52a916[_0x166d('0x5f')]===_0x166d('0x60')){var _0x3f5d00=_0x2c9cb6[_0x166d('0x3c')]({'plain':!![]});var _0x121396=_0x166d('0x61');return db[_0x166d('0x62')][_0x166d('0x5c')]({'where':{'name':_0x121396,'userProfileId':_0x52a916[_0x166d('0x63')]},'raw':!![]})[_0x166d('0x26')](function(_0x2722b3){if(_0x2722b3&&_0x2722b3[_0x166d('0x64')]===0x0){return db[_0x166d('0x3d')][_0x166d('0x5d')]({'name':_0x3f5d00[_0x166d('0x3f')],'resourceId':_0x3f5d00['id'],'type':_0x2722b3[_0x166d('0x3f')],'sectionId':_0x2722b3['id']},{})[_0x166d('0x26')](function(){return _0x2c9cb6;});}else{return _0x2c9cb6;}})[_0x166d('0x2e')](function(_0x416800){logger[_0x166d('0x2b')](_0x166d('0x65'),_0x416800);throw _0x416800;});}return _0x2c9cb6;})[_0x166d('0x26')](respondWithResult(_0x1f3a8b,0xc9))[_0x166d('0x2e')](handleError(_0x1f3a8b,null));};exports[_0x166d('0x3a')]=function(_0x43a117,_0x19511a){if(_0x43a117['body']['id']){delete _0x43a117[_0x166d('0x66')]['id'];}return db[_0x166d('0x43')]['find']({'where':{'id':_0x43a117[_0x166d('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0x166d('0x41')}]})['then'](handleEntityNotFound(_0x19511a,null))[_0x166d('0x26')](saveUpdates(_0x43a117[_0x166d('0x66')],null))[_0x166d('0x26')](respondWithResult(_0x19511a,null))[_0x166d('0x2e')](handleError(_0x19511a,null));};exports[_0x166d('0x3b')]=function(_0x129e5f,_0x59e22c){return db[_0x166d('0x43')]['find']({'where':{'id':_0x129e5f[_0x166d('0x67')]['id']}})['then'](handleEntityNotFound(_0x59e22c,null))[_0x166d('0x26')](removeEntity(_0x59e22c,null))[_0x166d('0x2e')](handleError(_0x59e22c,null));};exports[_0x166d('0x68')]=function(_0x1ea75e,_0xbf4593){return db[_0x166d('0x43')][_0x166d('0x68')]()['then'](respondWithResult(_0xbf4593,null))[_0x166d('0x2e')](handleError(_0xbf4593,null));};exports[_0x166d('0x69')]=function(_0x136a15,_0x382774,_0x281945){if(_0x136a15[_0x166d('0x66')]['id']){delete _0x136a15[_0x166d('0x66')]['id'];}return db['FaxAccount'][_0x166d('0x5c')]({'where':{'id':_0x136a15[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x382774,null))['then'](function(_0x221a16){if(_0x221a16){_0x136a15[_0x166d('0x66')]['FaxAccountId']=_0x221a16['id'];return db[_0x166d('0x6a')][_0x166d('0x5d')](_0x136a15[_0x166d('0x66')]);}})['then'](respondWithResult(_0x382774,null))['catch'](handleError(_0x382774,null));};exports['getDispositions']=function(_0xd2cd04,_0x4c1149,_0x5975b0){var _0x56e653={'raw':![],'where':{}};var _0xf091b4={};var _0x4409e9={'count':0x0,'rows':[]};return db[_0x166d('0x43')][_0x166d('0x6b')]({'where':{'id':_0xd2cd04[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x4c1149,null))[_0x166d('0x26')](function(_0x1b7eb8){if(_0x1b7eb8){_0xf091b4['model']=_[_0x166d('0x48')](db[_0x166d('0x6a')]['rawAttributes']);_0xf091b4['query']=_[_0x166d('0x48')](_0xd2cd04[_0x166d('0x47')]);_0xf091b4[_0x166d('0x4f')]=_[_0x166d('0x5a')](_0xf091b4['model'],_0xf091b4[_0x166d('0x47')]);_0x56e653['attributes']=_[_0x166d('0x5a')](_0xf091b4[_0x166d('0x49')],qs[_0x166d('0x4b')](_0xd2cd04[_0x166d('0x47')][_0x166d('0x4b')]));_0x56e653[_0x166d('0x4a')]=_0x56e653['attributes'][_0x166d('0x4c')]?_0x56e653[_0x166d('0x4a')]:_0xf091b4[_0x166d('0x49')];if(!_0xd2cd04[_0x166d('0x47')][_0x166d('0x6c')]('nolimit')){_0x56e653[_0x166d('0x34')]=qs[_0x166d('0x34')](_0xd2cd04[_0x166d('0x47')][_0x166d('0x34')]);_0x56e653['offset']=qs[_0x166d('0x33')](_0xd2cd04[_0x166d('0x47')]['offset']);}_0x56e653['order']=qs[_0x166d('0x4e')](_0xd2cd04[_0x166d('0x47')][_0x166d('0x4e')]);_0x56e653[_0x166d('0x51')]=qs[_0x166d('0x4f')](_[_0x166d('0x6d')](_0xd2cd04[_0x166d('0x47')],_0xf091b4['filters']));_0x56e653[_0x166d('0x51')][_0x166d('0x6e')]=_0x1b7eb8['id'];if(_0xd2cd04[_0x166d('0x47')]['filter']){_0x56e653[_0x166d('0x51')]=_[_0x166d('0x52')](_0x56e653[_0x166d('0x51')],{'$or':_[_0x166d('0x42')](_0x56e653['attributes'],function(_0x57016b){var _0x4bccbd={};_0x4bccbd[_0x57016b]={'$like':'%'+_0xd2cd04[_0x166d('0x47')][_0x166d('0x50')]+'%'};return _0x4bccbd;})});}_0x56e653=_[_0x166d('0x52')]({},_0x56e653,_0xd2cd04['options']);return db[_0x166d('0x6a')][_0x166d('0x32')]({'where':_0x56e653['where']})['then'](function(_0xe8e628){_0x4409e9[_0x166d('0x32')]=_0xe8e628;if(_0xd2cd04[_0x166d('0x47')][_0x166d('0x5b')]){_0x56e653[_0x166d('0x55')]=[{'all':!![]}];}return db[_0x166d('0x6a')][_0x166d('0x56')](_0x56e653);})[_0x166d('0x26')](function(_0xb78530){_0x4409e9['rows']=_0xb78530;return _0x4409e9;});}})[_0x166d('0x26')](respondWithFilteredResult(_0x4c1149,_0x56e653))['catch'](handleError(_0x4c1149,null));};exports['removeDispositions']=function(_0x1b4068,_0x2b3a44,_0x245689){return db[_0x166d('0x43')]['find']({'where':{'id':_0x1b4068[_0x166d('0x67')]['id']}})['then'](handleEntityNotFound(_0x2b3a44,null))[_0x166d('0x26')](function(_0x4c2e6f){if(_0x4c2e6f){return _0x4c2e6f[_0x166d('0x6f')](_0x1b4068['query']['ids']);}})[_0x166d('0x26')](respondWithStatusCode(_0x2b3a44,null))[_0x166d('0x2e')](handleError(_0x2b3a44,null));};exports['addAnswer']=function(_0x3e0b3f,_0x47dcf8,_0xcf6221){if(_0x3e0b3f[_0x166d('0x66')]['id']){delete _0x3e0b3f[_0x166d('0x66')]['id'];}return db['FaxAccount'][_0x166d('0x5c')]({'where':{'id':_0x3e0b3f[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x47dcf8,null))[_0x166d('0x26')](function(_0x2ae7e5){if(_0x2ae7e5){_0x3e0b3f[_0x166d('0x66')][_0x166d('0x6e')]=_0x2ae7e5['id'];return db[_0x166d('0x70')][_0x166d('0x5d')](_0x3e0b3f[_0x166d('0x66')]);}})[_0x166d('0x26')](respondWithResult(_0x47dcf8,null))[_0x166d('0x2e')](handleError(_0x47dcf8,null));};exports[_0x166d('0x71')]=function(_0xd5a857,_0x517687,_0x4409b3){var _0x193137={'raw':![],'where':{}};var _0x326f66={};var _0x10e773={'count':0x0,'rows':[]};return db[_0x166d('0x43')]['findOne']({'where':{'id':_0xd5a857[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x517687,null))[_0x166d('0x26')](function(_0x29d72d){if(_0x29d72d){_0x326f66[_0x166d('0x49')]=_[_0x166d('0x48')](db['CannedAnswer'][_0x166d('0x44')]);_0x326f66['query']=_[_0x166d('0x48')](_0xd5a857[_0x166d('0x47')]);_0x326f66[_0x166d('0x4f')]=_[_0x166d('0x5a')](_0x326f66[_0x166d('0x49')],_0x326f66[_0x166d('0x47')]);_0x193137[_0x166d('0x4a')]=_[_0x166d('0x5a')](_0x326f66['model'],qs[_0x166d('0x4b')](_0xd5a857[_0x166d('0x47')]['fields']));_0x193137['attributes']=_0x193137[_0x166d('0x4a')][_0x166d('0x4c')]?_0x193137[_0x166d('0x4a')]:_0x326f66[_0x166d('0x49')];if(!_0xd5a857[_0x166d('0x47')][_0x166d('0x6c')](_0x166d('0x4d'))){_0x193137[_0x166d('0x34')]=qs[_0x166d('0x34')](_0xd5a857[_0x166d('0x47')][_0x166d('0x34')]);_0x193137[_0x166d('0x33')]=qs['offset'](_0xd5a857[_0x166d('0x47')][_0x166d('0x33')]);}_0x193137['order']=qs[_0x166d('0x4e')](_0xd5a857[_0x166d('0x47')][_0x166d('0x4e')]);_0x193137['where']=qs[_0x166d('0x4f')](_[_0x166d('0x6d')](_0xd5a857['query'],_0x326f66[_0x166d('0x4f')]));_0x193137[_0x166d('0x51')][_0x166d('0x6e')]=_0x29d72d['id'];if(_0xd5a857[_0x166d('0x47')][_0x166d('0x50')]){_0x193137[_0x166d('0x51')]=_[_0x166d('0x52')](_0x193137[_0x166d('0x51')],{'$or':_[_0x166d('0x42')](_0x193137[_0x166d('0x4a')],function(_0x1560a7){var _0x1d8be0={};_0x1d8be0[_0x1560a7]={'$like':'%'+_0xd5a857[_0x166d('0x47')][_0x166d('0x50')]+'%'};return _0x1d8be0;})});}_0x193137=_['merge']({},_0x193137,_0xd5a857[_0x166d('0x54')]);return db[_0x166d('0x70')][_0x166d('0x32')]({'where':_0x193137[_0x166d('0x51')]})[_0x166d('0x26')](function(_0x85cba3){_0x10e773['count']=_0x85cba3;if(_0xd5a857[_0x166d('0x47')]['includeAll']){_0x193137[_0x166d('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x166d('0x56')](_0x193137);})[_0x166d('0x26')](function(_0x3877a5){_0x10e773['rows']=_0x3877a5;return _0x10e773;});}})['then'](respondWithFilteredResult(_0x517687,_0x193137))[_0x166d('0x2e')](handleError(_0x517687,null));};exports[_0x166d('0x72')]=function(_0x568199,_0x4b0f28,_0x4a0f51){return db['FaxAccount'][_0x166d('0x5c')]({'where':{'id':_0x568199[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x4b0f28,null))[_0x166d('0x26')](function(_0x1a044e){if(_0x1a044e){return _0x1a044e['removeAnswers'](_0x568199['query'][_0x166d('0x73')]);}})[_0x166d('0x26')](respondWithStatusCode(_0x4b0f28,null))[_0x166d('0x2e')](handleError(_0x4b0f28,null));};exports[_0x166d('0x74')]=function(_0xe0ff42,_0x1fd411,_0x4dafa4){return db[_0x166d('0x75')][_0x166d('0x5c')]({'where':{'id':_0xe0ff42[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x1fd411,null))['then'](function(_0x9e5395){if(_0x9e5395){return _0x9e5395[_0x166d('0x74')](_0xe0ff42[_0x166d('0x66')]['ids'],_['omit'](_0xe0ff42[_0x166d('0x66')],['ids','id'])||{});}})[_0x166d('0x26')](respondWithResult(_0x1fd411,null))[_0x166d('0x2e')](handleError(_0x1fd411,null));};exports[_0x166d('0x76')]=function(_0x236357,_0x2d55cf,_0x2b9673){var _0x194561={'raw':![],'where':{}};var _0x585ad1={};var _0x92f4d5={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x236357['params']['id']}})['then'](handleEntityNotFound(_0x2d55cf,null))[_0x166d('0x26')](function(_0x8b0932){if(_0x8b0932){_0x585ad1['model']=_[_0x166d('0x48')](db['FaxInteraction']['rawAttributes']);_0x585ad1['query']=_[_0x166d('0x48')](_0x236357[_0x166d('0x47')]);_0x585ad1['filters']=_[_0x166d('0x5a')](_0x585ad1['model'],_0x585ad1['query']);_0x194561['attributes']=_[_0x166d('0x5a')](_0x585ad1[_0x166d('0x49')],qs['fields'](_0x236357['query'][_0x166d('0x4b')]));_0x194561[_0x166d('0x4a')]=_0x194561[_0x166d('0x4a')]['length']?_0x194561[_0x166d('0x4a')]:_0x585ad1['model'];if(!_0x236357[_0x166d('0x47')][_0x166d('0x6c')]('nolimit')){_0x194561['limit']=qs[_0x166d('0x34')](_0x236357[_0x166d('0x47')][_0x166d('0x34')]);_0x194561['offset']=qs[_0x166d('0x33')](_0x236357['query'][_0x166d('0x33')]);}_0x194561['order']=qs[_0x166d('0x4e')](_0x236357[_0x166d('0x47')][_0x166d('0x4e')]);_0x194561[_0x166d('0x51')]=qs['filters'](_[_0x166d('0x6d')](_0x236357[_0x166d('0x47')],_0x585ad1[_0x166d('0x4f')]));_0x194561['where'][_0x166d('0x6e')]=_0x8b0932['id'];if(_0x236357[_0x166d('0x47')][_0x166d('0x50')]){_0x194561['where']=_['merge'](_0x194561[_0x166d('0x51')],{'$or':_[_0x166d('0x42')](_0x194561[_0x166d('0x4a')],function(_0x48cea1){var _0x1865c7={};_0x1865c7[_0x48cea1]={'$like':'%'+_0x236357[_0x166d('0x47')][_0x166d('0x50')]+'%'};return _0x1865c7;})});}_0x194561=_[_0x166d('0x52')]({},_0x194561,_0x236357['options']);return db[_0x166d('0x75')]['count']({'where':_0x194561[_0x166d('0x51')]})['then'](function(_0x4d9540){_0x92f4d5[_0x166d('0x32')]=_0x4d9540;if(_0x236357['query'][_0x166d('0x5b')]){_0x194561[_0x166d('0x55')]=[{'model':db[_0x166d('0x77')],'as':_0x166d('0x78'),'required':![]},{'model':db[_0x166d('0x79')],'as':_0x166d('0x7a'),'attributes':[_0x166d('0x3f'),'fullname',_0x166d('0x7b')],'required':![]},{'model':db[_0x166d('0x7c')],'as':_0x166d('0x7d'),'attributes':['id','name',_0x166d('0x7e')],'where':_0x236357[_0x166d('0x47')]['tag']?{'id':_0x236357[_0x166d('0x47')][_0x166d('0x7f')]}:undefined,'required':_0x236357[_0x166d('0x47')]['tag']?!![]:![]}];}return db[_0x166d('0x75')][_0x166d('0x56')](_0x194561);})[_0x166d('0x26')](function(_0x558222){_0x92f4d5[_0x166d('0x57')]=_0x558222;return _0x92f4d5;});}})['then'](respondWithFilteredResult(_0x2d55cf,_0x194561))[_0x166d('0x2e')](handleError(_0x2d55cf,null));};exports[_0x166d('0x80')]=function(_0x53e2d7,_0x2b3234,_0x4d3e11){return db[_0x166d('0x43')][_0x166d('0x6b')]({'where':{'id':_0x53e2d7[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x2b3234,null))[_0x166d('0x26')](function(_0x51aa27){if(_0x51aa27){return db[_0x166d('0x81')][_0x166d('0x82')](function(_0x1bb9b8){return db['FaxApplication'][_0x166d('0x3b')]({'where':{'FaxAccountId':_0x53e2d7[_0x166d('0x67')]['id']},'transaction':_0x1bb9b8})[_0x166d('0x26')](function(_0x50d38c){var _0x259b9d=_[_0x166d('0x42')](_0x53e2d7[_0x166d('0x66')],function(_0x46e01d){_0x46e01d['FaxAccountId']=_0x53e2d7['params']['id'];return _0x46e01d;});return db[_0x166d('0x83')][_0x166d('0x84')](_0x259b9d,{'transaction':_0x1bb9b8});});})[_0x166d('0x26')](function(){return db[_0x166d('0x83')][_0x166d('0x85')]({'where':{'FaxAccountId':_0x53e2d7[_0x166d('0x67')]['id']},'order':_0x166d('0x86')});});}})[_0x166d('0x26')](respondWithResult(_0x2b3234,null))['catch'](handleError(_0x2b3234,null));};exports[_0x166d('0x87')]=function(_0xeddbf2,_0x12eb36,_0x52c43c){var _0x5cd2d7={};var _0x4a5318={};var _0x50f8d7;var _0x21ad29;return db[_0x166d('0x43')][_0x166d('0x6b')]({'where':{'id':_0xeddbf2[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x12eb36,null))[_0x166d('0x26')](function(_0x15ac9b){if(_0x15ac9b){_0x50f8d7=_0x15ac9b;_0x4a5318['model']=_[_0x166d('0x48')](db['FaxApplication'][_0x166d('0x44')]);_0x4a5318[_0x166d('0x47')]=_[_0x166d('0x48')](_0xeddbf2['query']);_0x4a5318[_0x166d('0x4f')]=_[_0x166d('0x5a')](_0x4a5318[_0x166d('0x49')],_0x4a5318[_0x166d('0x47')]);_0x5cd2d7['attributes']=_[_0x166d('0x5a')](_0x4a5318[_0x166d('0x49')],qs[_0x166d('0x4b')](_0xeddbf2['query'][_0x166d('0x4b')]));_0x5cd2d7[_0x166d('0x4a')]=_0x5cd2d7['attributes'][_0x166d('0x4c')]?_0x5cd2d7[_0x166d('0x4a')]:_0x4a5318[_0x166d('0x49')];_0x5cd2d7[_0x166d('0x88')]=qs[_0x166d('0x4e')](_0xeddbf2[_0x166d('0x47')][_0x166d('0x4e')]);_0x5cd2d7[_0x166d('0x51')]=qs[_0x166d('0x4f')](_[_0x166d('0x6d')](_0xeddbf2['query'],_0x4a5318[_0x166d('0x4f')]));if(_0xeddbf2[_0x166d('0x47')][_0x166d('0x50')]){_0x5cd2d7[_0x166d('0x51')]=_[_0x166d('0x52')](_0x5cd2d7['where'],{'$or':_[_0x166d('0x42')](_0x5cd2d7[_0x166d('0x4a')],function(_0x3b0d3a){var _0x5108ce={};_0x5108ce[_0x3b0d3a]={'$like':'%'+_0xeddbf2['query'][_0x166d('0x50')]+'%'};return _0x5108ce;})});}_0x5cd2d7=_['merge']({},_0x5cd2d7,_0xeddbf2[_0x166d('0x54')]);return _0x50f8d7[_0x166d('0x87')](_0x5cd2d7);}})[_0x166d('0x26')](function(_0x559205){if(_0x559205){_0x21ad29=_0x559205[_0x166d('0x4c')];if(!_0xeddbf2[_0x166d('0x47')][_0x166d('0x6c')](_0x166d('0x4d'))){_0x5cd2d7[_0x166d('0x34')]=qs[_0x166d('0x34')](_0xeddbf2[_0x166d('0x47')]['limit']);_0x5cd2d7[_0x166d('0x33')]=qs['offset'](_0xeddbf2[_0x166d('0x47')][_0x166d('0x33')]);}return _0x50f8d7['getApplications'](_0x5cd2d7);}})[_0x166d('0x26')](function(_0x4c40f2){if(_0x4c40f2){return _0x4c40f2?{'count':_0x21ad29,'rows':_0x4c40f2}:null;}})[_0x166d('0x26')](respondWithResult(_0x12eb36,null))['catch'](handleError(_0x12eb36,null));};function Extension(_0x409c7d,_0x71991d,_0x42ad6f,_0x19e2bd){this[_0x166d('0x89')]=_0x166d('0x8a');this[_0x166d('0x8b')]=_0x409c7d[_0x166d('0x8c')];this[_0x166d('0x8d')]=_0x19e2bd;this[_0x166d('0x46')]='system';this[_0x166d('0x8e')]='Fax\x20Extension';this[_0x166d('0x6e')]=_0x409c7d['id'];this[_0x166d('0x86')]=_0x71991d;this[_0x166d('0x8f')]=_0x42ad6f;}function createExtensionsReciveFax(_0x203294){var _0x1fb095=0x1;var _0x21d86f=[];_0x21d86f[_0x166d('0x90')](new Extension(_0x203294,_0x1fb095,'',_0x166d('0x91')));_0x1fb095+=0x1;_0x21d86f['push'](new Extension(_0x203294,_0x1fb095,'CDR(type)=inbound-fax',_0x166d('0x92')));_0x1fb095+=0x1;for(var _0x771751 in _0x203294){if(_0x203294[_0x166d('0x6c')](_0x771751)&&(_0x771751==='ecm'||_0x771751===_0x166d('0x8c')||_0x771751===_0x166d('0x93')||_0x771751===_0x166d('0x94')||_0x771751===_0x166d('0x95')||_0x771751==='maxrate'||_0x771751===_0x166d('0x96')||_0x771751===_0x166d('0x97')||_0x771751===_0x166d('0x98'))){_0x21d86f['push'](new Extension(_0x203294,_0x1fb095,_0x166d('0x99')+_0x771751+')='+_0x203294[_0x771751],_0x166d('0x92')));_0x1fb095+=0x1;}}_0x21d86f[_0x166d('0x90')](new Extension(_0x203294,_0x1fb095,'6',_0x166d('0x9a')));_0x1fb095+=0x1;_0x21d86f[_0x166d('0x90')](new Extension(_0x203294,_0x1fb095,'/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',_0x166d('0x9b')));_0x1fb095=0x0;return _0x21d86f;}exports['addAccountApplications']=function(_0x4527e7,_0x301467,_0x17b072){var _0x47488c;return db[_0x166d('0x81')][_0x166d('0x82')](function(_0x1f98e5){return db['FaxAccount'][_0x166d('0x5d')](_0x4527e7['body'],{'transaction':_0x1f98e5})['then'](function(_0x5a9c83){_0x47488c=_0x5a9c83['get']({'plain':!![]});return db['VoiceExtension'][_0x166d('0x84')](createExtensionsReciveFax(_0x47488c),{'transaction':_0x1f98e5});});})[_0x166d('0x26')](function(){return _0x47488c;})[_0x166d('0x26')](respondWithResult(_0x301467,null))[_0x166d('0x2e')](handleError(_0x301467,null));};exports['updateAccountApplications']=function(_0x1aec8a,_0x198c12,_0x405590){var _0x517cf5;return db[_0x166d('0x81')][_0x166d('0x82')](function(_0x4b1be6){return db[_0x166d('0x43')]['update'](_0x1aec8a['body'],{'where':{'id':_0x1aec8a[_0x166d('0x66')]['id']},'transaction':_0x4b1be6})[_0x166d('0x26')](function(_0x2c8209){return db[_0x166d('0x9c')]['destroy']({'where':{'FaxAccountId':_0x1aec8a['body']['id']},'transaction':_0x4b1be6})[_0x166d('0x26')](function(_0x49526c){return db[_0x166d('0x9c')][_0x166d('0x84')](createExtensionsReciveFax(_[_0x166d('0x9d')](_0x1aec8a['body'],[_0x166d('0x9e'),'key',_0x166d('0x9f'),_0x166d('0xa0'),'TrunkId',_0x166d('0xa1')])),{'transaction':_0x4b1be6});});});})[_0x166d('0x26')](function(){return db[_0x166d('0x43')][_0x166d('0xa2')](_0x1aec8a[_0x166d('0x66')]['id']);})[_0x166d('0x26')](respondWithResult(_0x198c12,null))['catch'](handleError(_0x198c12,null));};exports[_0x166d('0xa3')]=function(_0x3fd0dd,_0x5680a0,_0xad2d25){var _0xce06ad={'raw':!![],'where':{}};var _0x2c0e00={};var _0x1695cf={'count':0x0,'rows':[]};return db[_0x166d('0x43')][_0x166d('0x6b')]({'where':{'id':_0x3fd0dd['params']['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x5680a0,null))[_0x166d('0x26')](function(_0x45e716){if(_0x45e716){_0x2c0e00[_0x166d('0x49')]=_[_0x166d('0x48')](db['FaxMessage'][_0x166d('0x44')]);_0x2c0e00[_0x166d('0x47')]=_[_0x166d('0x48')](_0x3fd0dd[_0x166d('0x47')]);_0x2c0e00[_0x166d('0x4f')]=_[_0x166d('0x5a')](_0x2c0e00[_0x166d('0x49')],_0x2c0e00['query']);_0xce06ad[_0x166d('0x4a')]=_[_0x166d('0x5a')](_0x2c0e00['model'],qs[_0x166d('0x4b')](_0x3fd0dd['query'][_0x166d('0x4b')]));_0xce06ad['attributes']=_0xce06ad[_0x166d('0x4a')][_0x166d('0x4c')]?_0xce06ad[_0x166d('0x4a')]:_0x2c0e00[_0x166d('0x49')];if(!_0x3fd0dd[_0x166d('0x47')][_0x166d('0x6c')]('nolimit')){_0xce06ad[_0x166d('0x34')]=qs[_0x166d('0x34')](_0x3fd0dd['query']['limit']);_0xce06ad['offset']=qs[_0x166d('0x33')](_0x3fd0dd[_0x166d('0x47')][_0x166d('0x33')]);}_0xce06ad['order']=qs[_0x166d('0x4e')](_0x3fd0dd['query'][_0x166d('0x4e')]);_0xce06ad['where']=qs['filters'](_[_0x166d('0x6d')](_0x3fd0dd['query'],_0x2c0e00[_0x166d('0x4f')]));_0xce06ad[_0x166d('0x51')][_0x166d('0x6e')]=_0x45e716['id'];if(_0x3fd0dd[_0x166d('0x47')][_0x166d('0x50')]){_0xce06ad[_0x166d('0x51')]=_[_0x166d('0x52')](_0xce06ad[_0x166d('0x51')],{'$or':_[_0x166d('0x42')](_0xce06ad['attributes'],function(_0x165d72){var _0x563897={};_0x563897[_0x165d72]={'$like':'%'+_0x3fd0dd['query'][_0x166d('0x50')]+'%'};return _0x563897;})});}if(_0x3fd0dd[_0x166d('0x47')]['$gte']){var _0x12fa44=_0x3fd0dd[_0x166d('0x47')][_0x166d('0xa4')][_0x166d('0xa5')](',');var _0x29868d={};_0x29868d[_0x12fa44[0x0]]={'$gte':moment(_0x12fa44[0x1])[_0x166d('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')};_0xce06ad[_0x166d('0x51')]=_[_0x166d('0x52')](_0xce06ad['where'],_0x29868d);}_0xce06ad=_[_0x166d('0x52')]({},_0xce06ad,_0x3fd0dd[_0x166d('0x54')]);return db[_0x166d('0xa7')]['count']({'where':_0xce06ad['where']})[_0x166d('0x26')](function(_0x4c65ab){_0x1695cf[_0x166d('0x32')]=_0x4c65ab;if(_0x3fd0dd[_0x166d('0x47')]['includeAll']){_0xce06ad[_0x166d('0x55')]=[{'all':!![]}];}return db[_0x166d('0xa7')][_0x166d('0x56')](_0xce06ad);})[_0x166d('0x26')](function(_0x571fe4){_0x1695cf[_0x166d('0x57')]=_0x571fe4;return _0x1695cf;});}})['then'](respondWithFilteredResult(_0x5680a0,_0xce06ad))[_0x166d('0x2e')](handleError(_0x5680a0,null));};exports[_0x166d('0xa8')]=function(_0x35a9a4,_0xf878a8,_0x22e20c){var _0x46e248,_0x44089b={},_0x31b06e;if(_0x35a9a4[_0x166d('0x66')]['to']){_0x31b06e=_0x35a9a4[_0x166d('0x66')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x35a9a4[_0x166d('0x67')]['id']},'include':[{'model':db[_0x166d('0xa9')],'as':_0x166d('0xaa'),'include':[{'model':db[_0x166d('0x77')],'as':_0x166d('0xab'),'where':{'fax':_0x31b06e},'limit':0x1,'order':[[_0x166d('0xa0'),'DESC']]}]}]})[_0x166d('0x26')](handleEntityNotFound(_0xf878a8,null))['then'](function(_0x136021){_0x46e248=_0x136021;if(_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')]&&_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')]['length']){for(var _0x401846=0x0;_0x401846<_0x35a9a4[_0x166d('0x66')]['attachments'][_0x166d('0x4c')];_0x401846+=0x1){_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][_0x401846]={'filename':_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][_0x401846][_0x166d('0x3f')],'id':_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][_0x401846]['id'],'path':path['join'](config['root'],_0x166d('0xad'),_0x35a9a4[_0x166d('0x66')]['attachments'][_0x401846]['basename'])};}}return respondWithRpcPromise(_0x166d('0xae'),_0x166d('0xae'),{'FaxAccountId':_['isNil'](_0x35a9a4['params']['id'])?undefined:_0x35a9a4['params']['id'],'path':_[_0x166d('0xaf')](_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][0x0][_0x166d('0xb0')])?undefined:_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][0x0]['path'],'fax':_[_0x166d('0xaf')](_0x35a9a4[_0x166d('0x66')]['to'][0x0])?undefined:_0x35a9a4['body']['to'][0x0]},client9002);})['then'](function(){if(_0x46e248){if(_[_0x166d('0xaf')](_0x35a9a4['body'][_0x166d('0xb1')])){_0x35a9a4['body'][_0x166d('0xb1')]=util['format'](_0x166d('0xb2'),_0x46e248[_0x166d('0x3f')],_0x46e248[_0x166d('0xb3')]);}if(_0x46e248[_0x166d('0xaa')]){if(_0x46e248[_0x166d('0xaa')][_0x166d('0xab')][_0x166d('0x4c')]){return _0x46e248[_0x166d('0xaa')][_0x166d('0xab')][0x0];}else{return db['CmContact']['create'](_[_0x166d('0x1a')](_0x35a9a4[_0x166d('0x66')],{'firstName':_0x35a9a4[_0x166d('0x66')]['to'][0x0],'phone':_0x35a9a4[_0x166d('0x66')]['to'][0x0],'fax':_0x35a9a4['body']['to'][0x0],'ListId':_0x46e248[_0x166d('0xa1')]}));}}else{throw new Error(_0x166d('0xb4'));}}else{throw new Error(_0x166d('0xb5'));}})[_0x166d('0x26')](function(_0x42b355){if(_0x42b355){return db[_0x166d('0x75')][_0x166d('0x5c')]({'where':{'ContactId':_0x42b355['id'],'closed':![],'FaxAccountId':_0x46e248['id']}})[_0x166d('0x26')](function(_0x3523e0){if(_0x3523e0){return[_0x3523e0,![]];}return db[_0x166d('0x75')][_0x166d('0x5d')]({'UserId':_0x35a9a4[_0x166d('0x60')]['id'],'ContactId':_0x42b355['id'],'FaxAccountId':_0x46e248['id'],'fax':_0x35a9a4['body']['to'][0x0],'firstMsgDirection':_0x166d('0xb6'),'Messages':[_[_0x166d('0x52')](_0x35a9a4[_0x166d('0x66')],{'read':![],'body':_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][0x0][_0x166d('0xb7')],'FaxAccountId':_0x46e248['id'],'UserId':_0x35a9a4[_0x166d('0x60')]['id'],'ContactId':_0x42b355['id'],'AttachmentId':_0x35a9a4['body'][_0x166d('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x166d('0xa7')],'as':'Messages'}]})[_0x166d('0x26')](function(_0x344709){return[_0x344709,!![]];});});}else{throw new Error(_0x166d('0xb8'));}})['spread'](function(_0x2e09d2,_0x56a6c8){if(_0x56a6c8){return _0x2e09d2;}return db[_0x166d('0xa7')][_0x166d('0x5d')]({'direction':_0x166d('0xb6'),'read':![],'body':_0x35a9a4['body'][_0x166d('0xac')][0x0][_0x166d('0xb7')],'FaxAccountId':_0x46e248['id'],'FaxInteractionId':_0x2e09d2['id'],'UserId':_0x35a9a4['user']['id'],'ContactId':_0x2e09d2[_0x166d('0xb9')],'AttachmentId':_0x35a9a4['body'][_0x166d('0xac')][0x0]['id']})[_0x166d('0x26')](function(_0xf0d1d4){_0x2e09d2['dataValues'][_0x166d('0xba')]=[];_0x2e09d2[_0x166d('0xbb')][_0x166d('0xba')]['push'](_0xf0d1d4[_0x166d('0xbb')]);return _0x2e09d2;});})[_0x166d('0x26')](function(_0xa652ce){respondWithRpcPromise(_0x166d('0xbc'),_0x166d('0xbc'),{'FaxAccountId':_[_0x166d('0xaf')](_0x35a9a4[_0x166d('0x67')]['id'])?undefined:_0x35a9a4[_0x166d('0x67')]['id'],'path':_[_0x166d('0xaf')](_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][0x0][_0x166d('0xb0')])?undefined:_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][0x0][_0x166d('0xb0')],'fax':_['isNil'](_0x35a9a4[_0x166d('0x66')]['to'][0x0])?undefined:_0x35a9a4[_0x166d('0x66')]['to'][0x0],'AttachmentId':_0x35a9a4[_0x166d('0x66')][_0x166d('0xac')][0x0]['id']},client9002)[_0x166d('0x26')](function(_0x1a9bf8){logger[_0x166d('0x27')]('SendFaxRpc,\x20%s',_0x1a9bf8);})[_0x166d('0x2e')](function(_0x53529b){logger[_0x166d('0x27')](_0x166d('0xbd'),_0x53529b);});return _0xa652ce;})[_0x166d('0x26')](respondWithResult(_0xf878a8,null))['catch'](handleError(_0xf878a8,null));};exports[_0x166d('0xbe')]=function(_0x57e1e7,_0xb64253,_0x3a94bc){return db['FaxAccount']['find']({'where':{'id':_0x57e1e7[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0xb64253,null))[_0x166d('0x26')](function(_0x2c3b8c){if(_0x2c3b8c){return _0x2c3b8c['addAgents'](_0x57e1e7[_0x166d('0x66')]['ids'],_['omit'](_0x57e1e7[_0x166d('0x66')],[_0x166d('0x73'),'id'])||{})[_0x166d('0xbf')](function(_0x3915f4){for(var _0x2b7a09=0x0;_0x2b7a09<_0x57e1e7[_0x166d('0x66')][_0x166d('0x73')][_0x166d('0x4c')];_0x2b7a09+=0x1){socket[_0x166d('0xc0')](_0x166d('0xc1'),{'UserId':_0x57e1e7[_0x166d('0x66')][_0x166d('0x73')][_0x2b7a09],'FaxAccountId':_0x57e1e7['params']['id']});}return _0x3915f4;});}})[_0x166d('0x26')](respondWithResult(_0xb64253,null))[_0x166d('0x2e')](handleError(_0xb64253,null));};exports['removeAgents']=function(_0x2e02a2,_0x229bc5,_0xa4a8e4){return db[_0x166d('0x43')][_0x166d('0x5c')]({'where':{'id':_0x2e02a2[_0x166d('0x67')]['id']}})[_0x166d('0x26')](handleEntityNotFound(_0x229bc5,null))['then'](function(_0x6bcc88){if(_0x6bcc88){return _0x6bcc88[_0x166d('0xc2')](_0x2e02a2[_0x166d('0x47')][_0x166d('0x73')])['then'](function(){if(_[_0x166d('0xc3')](_0x2e02a2['query'][_0x166d('0x73')])){for(var _0x385ecf=0x0;_0x385ecf<_0x2e02a2[_0x166d('0x47')][_0x166d('0x73')][_0x166d('0x4c')];_0x385ecf+=0x1){socket[_0x166d('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x2e02a2[_0x166d('0x47')][_0x166d('0x73')][_0x385ecf]),'FaxAccountId':Number(_0x2e02a2['params']['id'])});}}else{socket[_0x166d('0xc0')](_0x166d('0xc4'),{'UserId':Number(_0x2e02a2[_0x166d('0x47')][_0x166d('0x73')]),'FaxAccountId':Number(_0x2e02a2[_0x166d('0x67')]['id'])});}});}})[_0x166d('0x26')](respondWithStatusCode(_0x229bc5,null))[_0x166d('0x2e')](handleError(_0x229bc5,null));};exports[_0x166d('0xc5')]=function(_0x36e500,_0x1d7289,_0x48c755){var _0x5cbd06={};var _0x5d82d6={};var _0x439241;var _0x13a932;return db[_0x166d('0x43')][_0x166d('0x6b')]({'where':{'id':_0x36e500[_0x166d('0x67')]['id']}})['then'](handleEntityNotFound(_0x1d7289,null))[_0x166d('0x26')](function(_0x3a3b01){if(_0x3a3b01){_0x439241=_0x3a3b01;_0x5d82d6[_0x166d('0x49')]=_[_0x166d('0x48')](db[_0x166d('0x79')][_0x166d('0x44')]);_0x5d82d6[_0x166d('0x47')]=_[_0x166d('0x48')](_0x36e500[_0x166d('0x47')]);_0x5d82d6[_0x166d('0x4f')]=_[_0x166d('0x5a')](_0x5d82d6[_0x166d('0x49')],_0x5d82d6[_0x166d('0x47')]);_0x5cbd06['attributes']=_[_0x166d('0x5a')](_0x5d82d6[_0x166d('0x49')],qs[_0x166d('0x4b')](_0x36e500[_0x166d('0x47')][_0x166d('0x4b')]));_0x5cbd06[_0x166d('0x4a')]=_0x5cbd06[_0x166d('0x4a')][_0x166d('0x4c')]?_0x5cbd06[_0x166d('0x4a')]:_0x5d82d6['model'];_0x5cbd06[_0x166d('0x88')]=qs['sort'](_0x36e500[_0x166d('0x47')][_0x166d('0x4e')]);_0x5cbd06['where']=qs['filters'](_[_0x166d('0x6d')](_0x36e500[_0x166d('0x47')],_0x5d82d6[_0x166d('0x4f')]));if(_0x36e500[_0x166d('0x47')]['filter']){_0x5cbd06[_0x166d('0x51')]=_[_0x166d('0x52')](_0x5cbd06[_0x166d('0x51')],{'$or':_[_0x166d('0x42')](_0x5cbd06[_0x166d('0x4a')],function(_0x3951d6){var _0x42eb0f={};_0x42eb0f[_0x3951d6]={'$like':'%'+_0x36e500[_0x166d('0x47')][_0x166d('0x50')]+'%'};return _0x42eb0f;})});}_0x5cbd06=_[_0x166d('0x52')]({},_0x5cbd06,_0x36e500[_0x166d('0x54')]);return _0x439241['getAgents'](_0x5cbd06);}})[_0x166d('0x26')](function(_0x2b058a){if(_0x2b058a){_0x13a932=_0x2b058a[_0x166d('0x4c')];if(!_0x36e500[_0x166d('0x47')]['hasOwnProperty'](_0x166d('0x4d'))){_0x5cbd06[_0x166d('0x34')]=qs[_0x166d('0x34')](_0x36e500[_0x166d('0x47')][_0x166d('0x34')]);_0x5cbd06[_0x166d('0x33')]=qs[_0x166d('0x33')](_0x36e500['query'][_0x166d('0x33')]);}return _0x439241[_0x166d('0xc5')](_0x5cbd06);}})[_0x166d('0x26')](function(_0x5b1988){if(_0x5b1988){return _0x5b1988?{'count':_0x13a932,'rows':_0x5b1988}:null;}})[_0x166d('0x26')](respondWithResult(_0x1d7289,null))[_0x166d('0x2e')](handleError(_0x1d7289,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9a79e00..d098cb9 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 _0x1d03=['exports','events','../../mysqldb','FaxAccount','update','emit','hasOwnProperty'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x1d03,0x1ba));var _0x31d0=function(_0x11e8c0,_0x3c737c){_0x11e8c0=_0x11e8c0-0x0;var _0x5e5cae=_0x1d03[_0x11e8c0];return _0x5e5cae;};'use strict';var EventEmitter=require(_0x31d0('0x0'));var FaxAccount=require(_0x31d0('0x1'))['db'][_0x31d0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x31d0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x473ec3){return function(_0x4b79c8,_0x55b204,_0x40a76d){FaxAccountEvents[_0x31d0('0x4')](_0x473ec3+':'+_0x4b79c8['id'],_0x4b79c8);FaxAccountEvents[_0x31d0('0x4')](_0x473ec3,_0x4b79c8);_0x40a76d(null);};}for(var e in events){if(events[_0x31d0('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x31d0('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xd5f3=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0xd5f3,0xc2));var _0x3d5f=function(_0x40f884,_0x580d46){_0x40f884=_0x40f884-0x0;var _0x5db40c=_0xd5f3[_0x40f884];return _0x5db40c;};'use strict';var EventEmitter=require(_0x3d5f('0x0'));var FaxAccount=require(_0x3d5f('0x1'))['db'][_0x3d5f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3d5f('0x3')](0x0);var events={'afterCreate':_0x3d5f('0x4'),'afterUpdate':_0x3d5f('0x5'),'afterDestroy':_0x3d5f('0x6')};function emitEvent(_0x457bb3){return function(_0x263f9b,_0x49169f,_0x65b0bb){FaxAccountEvents[_0x3d5f('0x7')](_0x457bb3+':'+_0x263f9b['id'],_0x263f9b);FaxAccountEvents['emit'](_0x457bb3,_0x263f9b);_0x65b0bb(null);};}for(var e in events){if(events[_0x3d5f('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a7558c2..d8999ac 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 _0xfb66=['path','rimraf','exports','fax_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0xeec885,_0x1fa91c){var _0x3cb3ed=function(_0x1b9e4c){while(--_0x1b9e4c){_0xeec885['push'](_0xeec885['shift']());}};_0x3cb3ed(++_0x1fa91c);}(_0xfb66,0x94));var _0x6fb6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xfb66[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x6fb6('0x0'));var util=require('util');var logger=require(_0x6fb6('0x1'))(_0x6fb6('0x2'));var moment=require(_0x6fb6('0x3'));var BPromise=require('bluebird');var rp=require(_0x6fb6('0x4'));var fs=require('fs');var path=require(_0x6fb6('0x5'));var rimraf=require(_0x6fb6('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x6fb6('0x7')]=function(_0x3b803e,_0x33af05){return _0x3b803e['define']('FaxAccount',attributes,{'tableName':_0x6fb6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x159e=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x163461,_0x5d4217){var _0x290942=function(_0x30f747){while(--_0x30f747){_0x163461['push'](_0x163461['shift']());}};_0x290942(++_0x5d4217);}(_0x159e,0xda));var _0xe159=function(_0x433f8e,_0x497b51){_0x433f8e=_0x433f8e-0x0;var _0x3fb1e6=_0x159e[_0x433f8e];return _0x3fb1e6;};'use strict';var _=require(_0xe159('0x0'));var util=require(_0xe159('0x1'));var logger=require(_0xe159('0x2'))('api');var moment=require(_0xe159('0x3'));var BPromise=require(_0xe159('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe159('0x5'));var rimraf=require(_0xe159('0x6'));var config=require(_0xe159('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x3f864d,_0xbd8341){return _0x3f864d[_0xe159('0x8')](_0xe159('0x9'),attributes,{'tableName':_0xe159('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4693572..cf79847 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 _0x9ffb=['no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','from','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','FaxAccount','account','CmList','Contacts','DESC','FaxApplication','Applications','get','applications','list','List','orderBy','priority','asc','length','find','FaxInteraction','spread','autoclose','push','close','unmanaged','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','name','unshift','agent','*,*,*,*','Start','startRouting','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','request','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','raw','where','attributes','include','model','map','then','GetFaxAccount','debug','body','fax','CmContact','Sequelize','ValidationError'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x9ffb,0xde));var _0xb9ff=function(_0x59e8ff,_0x1485f0){_0x59e8ff=_0x59e8ff-0x0;var _0x511529=_0x9ffb[_0x59e8ff];return _0x511529;};'use strict';var _=require('lodash');var util=require(_0xb9ff('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9ff('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb9ff('0x2'));var logger=require(_0xb9ff('0x3'))(_0xb9ff('0x4'));var config=require(_0xb9ff('0x5'));var jayson=require(_0xb9ff('0x6'));var client=jayson[_0xb9ff('0x7')][_0xb9ff('0x8')]({'port':0x232c});config[_0xb9ff('0x9')]=_[_0xb9ff('0xa')](config[_0xb9ff('0x9')],{'host':_0xb9ff('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9ff('0x9')]));require(_0xb9ff('0xc'))['register'](socket);function respondWithRpcPromise(_0x288aa4,_0x45e26c,_0x5b6c16){return new BPromise(function(_0x1aa256,_0x33ab5a){return client[_0xb9ff('0xd')](_0x288aa4,_0x5b6c16)['then'](function(_0x3ecbec){logger['info'](_0xb9ff('0xe'),_0x45e26c,_0xb9ff('0xf'));logger['debug'](_0xb9ff('0x10'),_0x45e26c,'request\x20sent',JSON[_0xb9ff('0x11')](_0x3ecbec));if(_0x3ecbec[_0xb9ff('0x12')]){if(_0x3ecbec[_0xb9ff('0x12')][_0xb9ff('0x13')]===0x1f4){logger['error'](_0xb9ff('0xe'),_0x45e26c,_0x3ecbec[_0xb9ff('0x12')][_0xb9ff('0x14')]);return _0x33ab5a(_0x3ecbec[_0xb9ff('0x12')][_0xb9ff('0x14')]);}logger['error'](_0xb9ff('0xe'),_0x45e26c,_0x3ecbec[_0xb9ff('0x12')][_0xb9ff('0x14')]);return _0x1aa256(_0x3ecbec[_0xb9ff('0x12')][_0xb9ff('0x14')]);}else{logger[_0xb9ff('0x15')](_0xb9ff('0xe'),_0x45e26c,_0xb9ff('0xf'));_0x1aa256(_0x3ecbec[_0xb9ff('0x16')][_0xb9ff('0x14')]);}})[_0xb9ff('0x17')](function(_0x47382e){logger[_0xb9ff('0x12')](_0xb9ff('0xe'),_0x45e26c,_0x47382e);_0x33ab5a(_0x47382e);});});}exports['GetFaxAccount']=function(_0x531e28){var _0x33ef7d=this;return new Promise(function(_0x146387,_0x2d168b){return db['FaxAccount']['findAll']({'raw':_0x531e28[_0xb9ff('0x18')]?_0x531e28[_0xb9ff('0x18')][_0xb9ff('0x19')]===undefined?!![]:![]:!![],'where':_0x531e28[_0xb9ff('0x18')]?_0x531e28[_0xb9ff('0x18')][_0xb9ff('0x1a')]||null:null,'attributes':_0x531e28[_0xb9ff('0x18')]?_0x531e28['options'][_0xb9ff('0x1b')]||null:null,'limit':_0x531e28[_0xb9ff('0x18')]?_0x531e28[_0xb9ff('0x18')]['limit']||null:null,'include':_0x531e28['options']?_0x531e28[_0xb9ff('0x18')]['include']?_['map'](_0x531e28[_0xb9ff('0x18')][_0xb9ff('0x1c')],function(_0x36c66a){return{'model':db[_0x36c66a[_0xb9ff('0x1d')]],'as':_0x36c66a['as'],'attributes':_0x36c66a[_0xb9ff('0x1b')],'include':_0x36c66a['include']?_[_0xb9ff('0x1e')](_0x36c66a[_0xb9ff('0x1c')],function(_0x39c831){return{'model':db[_0x39c831[_0xb9ff('0x1d')]],'as':_0x39c831['as'],'attributes':_0x39c831[_0xb9ff('0x1b')],'include':_0x39c831[_0xb9ff('0x1c')]?_[_0xb9ff('0x1e')](_0x39c831[_0xb9ff('0x1c')],function(_0x31bd40){return{'model':db[_0x31bd40[_0xb9ff('0x1d')]],'as':_0x31bd40['as'],'attributes':_0x31bd40[_0xb9ff('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb9ff('0x1f')](function(_0x3ddfe4){logger['info'](_0xb9ff('0x20'),_0x531e28);logger[_0xb9ff('0x21')](_0xb9ff('0x20'),_0x531e28,JSON[_0xb9ff('0x11')](_0x3ddfe4));_0x146387(_0x3ddfe4);})[_0xb9ff('0x17')](function(_0x6d9aaa){logger[_0xb9ff('0x12')](_0xb9ff('0x20'),_0x6d9aaa[_0xb9ff('0x14')],_0x531e28);_0x2d168b(_0x33ef7d[_0xb9ff('0x12')](0x1f4,_0x6d9aaa[_0xb9ff('0x14')]));});});};exports['NotifyFaxAccount']=function(_0x3dcbfd,_0x1cb323,_0x5045a9){var _0x1e63e0=this;return new Promise(function(_0x359dde,_0x1420cb){var _0x111c10={'body':_0x3dcbfd[_0xb9ff('0x22')],'channel':_0xb9ff('0x23')};var _0x25e33e=[];var _0x3a5c7e=[];var _0xf43535={};return db[_0xb9ff('0x24')]['describe']()['then'](function(_0x33d44c){if(!_0x33d44c){throw new db[(_0xb9ff('0x25'))][(_0xb9ff('0x26'))](_0xb9ff('0x27'));}_0x25e33e=_[_0xb9ff('0x28')](_[_0xb9ff('0x29')](_0x33d44c),[_0xb9ff('0x2a'),_0xb9ff('0x2b')]);_0x3a5c7e=_['difference'](_[_0xb9ff('0x29')](_0x33d44c),[_0xb9ff('0x2a'),_0xb9ff('0x2b'),'CompanyId',_0xb9ff('0x2c')]);if(_0x3dcbfd[_0xb9ff('0x22')]['id']){delete _0x3dcbfd[_0xb9ff('0x22')]['id'];}if(_['isNil'](_0x3dcbfd[_0xb9ff('0x22')][_0xb9ff('0x2d')])){throw new db[(_0xb9ff('0x25'))][(_0xb9ff('0x26'))](_0xb9ff('0x2e'));}if(_[_0xb9ff('0x2f')](_0x3dcbfd[_0xb9ff('0x22')][_0xb9ff('0x22')])||_0x3dcbfd['body']['body']===''){throw new db[(_0xb9ff('0x25'))][(_0xb9ff('0x26'))](_0xb9ff('0x30'));}if(_[_0xb9ff('0x2f')](_0x3dcbfd[_0xb9ff('0x22')][_0xb9ff('0x31')])){throw new db['Sequelize'][(_0xb9ff('0x26'))](_0xb9ff('0x32')+_0x3a5c7e);}if(!_[_0xb9ff('0x33')](_0x3a5c7e,_0x3dcbfd['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xb9ff('0x34')+_0x3a5c7e);}_0xf43535[_0x3dcbfd[_0xb9ff('0x22')][_0xb9ff('0x31')]]=_0x3dcbfd[_0xb9ff('0x22')]['from'];})[_0xb9ff('0x1f')](function(){return db[_0xb9ff('0x35')]['find']({'where':{'id':_0x3dcbfd[_0xb9ff('0x36')]['id']},'include':[{'model':db[_0xb9ff('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb9ff('0x38'),'where':_0xf43535,'limit':0x1,'order':[[_0xb9ff('0x2b'),_0xb9ff('0x39')]]}]},{'model':db[_0xb9ff('0x3a')],'as':_0xb9ff('0x3b')}]});})['then'](function(_0xf801a6){if(_0xf801a6&&_0xf801a6['List']){var _0x309406=_0xf801a6[_0xb9ff('0x3c')]({'plain':!![]});_0x111c10[_0xb9ff('0x36')]=_0x309406;_0x111c10[_0xb9ff('0x3d')]=_0x309406[_0xb9ff('0x3b')];_0x111c10[_0xb9ff('0x3e')]=_0x309406[_0xb9ff('0x3f')];_0x111c10[_0xb9ff('0x3d')]=_[_0xb9ff('0x40')](_0x111c10[_0xb9ff('0x3d')],[_0xb9ff('0x41')],[_0xb9ff('0x42')]);if(_0x111c10[_0xb9ff('0x36')][_0xb9ff('0x3b')]){delete _0x111c10[_0xb9ff('0x36')][_0xb9ff('0x3b')];}if(_0x111c10[_0xb9ff('0x36')][_0xb9ff('0x3f')]&&_0x111c10['account']['List']['Contacts'][_0xb9ff('0x43')]){return _0x111c10['account'][_0xb9ff('0x3f')]['Contacts'][0x0];}var _0x14169e=_[_0xb9ff('0xa')](_0x3dcbfd['body'],{'firstName':_0x3dcbfd['body']['from'],'ListId':_0x309406[_0xb9ff('0x2c')]});_0x14169e[_0x3dcbfd[_0xb9ff('0x22')][_0xb9ff('0x31')]]=_0x3dcbfd[_0xb9ff('0x22')]['from'];return db['CmContact']['create'](_0x14169e,{'fields':_0x25e33e,'raw':!![]});}})[_0xb9ff('0x1f')](function(_0x3634a5){_0x111c10['contact']=_0x3634a5;if(_0x3634a5){var _0x43c8b4={'ContactId':_0x3634a5['id'],'FaxAccountId':_0x3dcbfd[_0xb9ff('0x36')]['id'],'fax':_0x3634a5[_0xb9ff('0x23')]};return db['FaxInteraction'][_0xb9ff('0x44')]({'where':{'ContactId':_0x3634a5['id'],'closed':![],'FaxAccountId':_0x3dcbfd[_0xb9ff('0x36')]['id']}})[_0xb9ff('0x1f')](function(_0x455e4c){if(_0x455e4c){return[_0x455e4c,![]];}return db[_0xb9ff('0x45')]['create'](_0x43c8b4)[_0xb9ff('0x1f')](function(_0x192393){return[_0x192393,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb9ff('0x46')](function(_0x12bc3e,_0xf9b972){var _0x2e1bfe=_0x12bc3e[_0xb9ff('0x3c')]({'plain':!![]});if(_0xf9b972){if(_0x111c10['account'][_0xb9ff('0x47')]){_0x111c10[_0xb9ff('0x3d')][_0xb9ff('0x48')]({'id':0x0,'priority':_0x111c10[_0xb9ff('0x3d')][_0xb9ff('0x43')]+0x1,'app':_0xb9ff('0x49'),'appdata':_0xb9ff('0x4a'),'interval':'*,*,*,*'});}_0x2e1bfe[_0xb9ff('0x4b')]=!![];}else{_0x2e1bfe[_0xb9ff('0x4b')]=![];}_0x111c10['interaction']=_0x2e1bfe;return db[_0xb9ff('0x4c')]['create']({'body':_0x3dcbfd['body'][_0xb9ff('0x22')],'FaxAccountId':_0x3dcbfd[_0xb9ff('0x36')]['id'],'FaxInteractionId':_0x12bc3e['id'],'direction':'in','ContactId':_0x12bc3e[_0xb9ff('0x4d')],'AttachmentId':_0x3dcbfd[_0xb9ff('0x22')][_0xb9ff('0x4e')]});})[_0xb9ff('0x1f')](function(_0x3c200b){_0x111c10[_0xb9ff('0x14')]=_0x3c200b;if(_0x111c10[_0xb9ff('0x4f')][_0xb9ff('0x50')]){return db['User'][_0xb9ff('0x44')]({'attributes':['id',_0xb9ff('0x51')],'where':{'id':_0x111c10[_0xb9ff('0x4f')][_0xb9ff('0x50')]}})[_0xb9ff('0x1f')](function(_0x23a86a){if(_0x23a86a){_0x111c10[_0xb9ff('0x3d')][_0xb9ff('0x52')]({'id':0x0,'priority':0x0,'app':_0xb9ff('0x53'),'appdata':_0x23a86a[_0xb9ff('0x51')]+','+(_0x111c10[_0xb9ff('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0xb9ff('0x54')});}return respondWithRpcPromise(_0xb9ff('0x55'),_0xb9ff('0x56'),_0x111c10);});}return respondWithRpcPromise(_0xb9ff('0x55'),_0xb9ff('0x56'),_0x111c10);})[_0xb9ff('0x1f')](function(_0x246a0d){_0x359dde(_0x246a0d);})[_0xb9ff('0x17')](function(_0x555cb1){_0x1420cb(_0x1e63e0[_0xb9ff('0x12')](0x1f4,_0x555cb1[_0xb9ff('0x14')]));});});}; \ No newline at end of file +var _0xf492=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','fax','CmContact','describe','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','FaxAccount','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','applications','list','orderBy','priority','ListId','contact','FaxInteraction','create','spread','get','autoclose','push','length','close','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18e799,_0x20c911){var _0x1597bc=function(_0x541c07){while(--_0x541c07){_0x18e799['push'](_0x18e799['shift']());}};_0x1597bc(++_0x20c911);}(_0xf492,0x10f));var _0x2f49=function(_0x2e8f13,_0x36b729){_0x2e8f13=_0x2e8f13-0x0;var _0xc511e4=_0xf492[_0x2e8f13];return _0xc511e4;};'use strict';var _=require(_0x2f49('0x0'));var util=require(_0x2f49('0x1'));var moment=require(_0x2f49('0x2'));var BPromise=require(_0x2f49('0x3'));var rs=require(_0x2f49('0x4'));var fs=require('fs');var Redis=require(_0x2f49('0x5'));var db=require(_0x2f49('0x6'))['db'];var utils=require(_0x2f49('0x7'));var logger=require(_0x2f49('0x8'))('rpc');var config=require(_0x2f49('0x9'));var jayson=require(_0x2f49('0xa'));var client=jayson[_0x2f49('0xb')][_0x2f49('0xc')]({'port':0x232c});config[_0x2f49('0xd')]=_[_0x2f49('0xe')](config[_0x2f49('0xd')],{'host':_0x2f49('0xf'),'port':0x18eb});var socket=require(_0x2f49('0x10'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x2f49('0x11')](socket);function respondWithRpcPromise(_0xcd3526,_0x3438cc,_0x3385b5){return new BPromise(function(_0x3d7f86,_0x18c83b){return client[_0x2f49('0x12')](_0xcd3526,_0x3385b5)[_0x2f49('0x13')](function(_0x481f09){logger[_0x2f49('0x14')](_0x2f49('0x15'),_0x3438cc,'request\x20sent');logger[_0x2f49('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3438cc,_0x2f49('0x17'),JSON[_0x2f49('0x18')](_0x481f09));if(_0x481f09[_0x2f49('0x19')]){if(_0x481f09[_0x2f49('0x19')][_0x2f49('0x1a')]===0x1f4){logger[_0x2f49('0x19')](_0x2f49('0x15'),_0x3438cc,_0x481f09[_0x2f49('0x19')]['message']);return _0x18c83b(_0x481f09[_0x2f49('0x19')][_0x2f49('0x1b')]);}logger[_0x2f49('0x19')](_0x2f49('0x15'),_0x3438cc,_0x481f09['error'][_0x2f49('0x1b')]);return _0x3d7f86(_0x481f09[_0x2f49('0x19')][_0x2f49('0x1b')]);}else{logger[_0x2f49('0x14')]('FaxAccount,\x20%s,\x20%s',_0x3438cc,_0x2f49('0x17'));_0x3d7f86(_0x481f09[_0x2f49('0x1c')][_0x2f49('0x1b')]);}})[_0x2f49('0x1d')](function(_0x3637ef){logger[_0x2f49('0x19')]('FaxAccount,\x20%s,\x20%s',_0x3438cc,_0x3637ef);_0x18c83b(_0x3637ef);});});}exports['GetFaxAccount']=function(_0x5794d0){var _0x4db693=this;return new Promise(function(_0x25e6b6,_0x1b5016){return db['FaxAccount'][_0x2f49('0x1e')]({'raw':_0x5794d0[_0x2f49('0x1f')]?_0x5794d0['options'][_0x2f49('0x20')]===undefined?!![]:![]:!![],'where':_0x5794d0['options']?_0x5794d0[_0x2f49('0x1f')][_0x2f49('0x21')]||null:null,'attributes':_0x5794d0[_0x2f49('0x1f')]?_0x5794d0[_0x2f49('0x1f')][_0x2f49('0x22')]||null:null,'limit':_0x5794d0[_0x2f49('0x1f')]?_0x5794d0[_0x2f49('0x1f')][_0x2f49('0x23')]||null:null,'include':_0x5794d0['options']?_0x5794d0['options'][_0x2f49('0x24')]?_[_0x2f49('0x25')](_0x5794d0[_0x2f49('0x1f')][_0x2f49('0x24')],function(_0x539b7b){return{'model':db[_0x539b7b['model']],'as':_0x539b7b['as'],'attributes':_0x539b7b[_0x2f49('0x22')],'include':_0x539b7b[_0x2f49('0x24')]?_[_0x2f49('0x25')](_0x539b7b[_0x2f49('0x24')],function(_0x1616f0){return{'model':db[_0x1616f0[_0x2f49('0x26')]],'as':_0x1616f0['as'],'attributes':_0x1616f0[_0x2f49('0x22')],'include':_0x1616f0[_0x2f49('0x24')]?_[_0x2f49('0x25')](_0x1616f0[_0x2f49('0x24')],function(_0x4753fe){return{'model':db[_0x4753fe['model']],'as':_0x4753fe['as'],'attributes':_0x4753fe[_0x2f49('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2f49('0x13')](function(_0x51dc5f){logger['info'](_0x2f49('0x27'),_0x5794d0);logger[_0x2f49('0x16')](_0x2f49('0x27'),_0x5794d0,JSON['stringify'](_0x51dc5f));_0x25e6b6(_0x51dc5f);})['catch'](function(_0x59e408){logger[_0x2f49('0x19')](_0x2f49('0x27'),_0x59e408[_0x2f49('0x1b')],_0x5794d0);_0x1b5016(_0x4db693[_0x2f49('0x19')](0x1f4,_0x59e408[_0x2f49('0x1b')]));});});};exports[_0x2f49('0x28')]=function(_0x2abf4e,_0x2cf492,_0x1d4f73){var _0x551c91=this;return new Promise(function(_0x58723c,_0x186fe1){var _0x52dbc3={'body':_0x2abf4e['body'],'channel':_0x2f49('0x29')};var _0x1447f5=[];var _0x1ef119=[];var _0x2b777b={};return db[_0x2f49('0x2a')][_0x2f49('0x2b')]()['then'](function(_0x150baf){if(!_0x150baf){throw new db['Sequelize'][(_0x2f49('0x2c'))]('no\x20available\x20attributes');}_0x1447f5=_[_0x2f49('0x2d')](_[_0x2f49('0x2e')](_0x150baf),[_0x2f49('0x2f'),_0x2f49('0x30')]);_0x1ef119=_[_0x2f49('0x2d')](_['keys'](_0x150baf),[_0x2f49('0x2f'),_0x2f49('0x30'),_0x2f49('0x31'),'ListId']);if(_0x2abf4e[_0x2f49('0x32')]['id']){delete _0x2abf4e[_0x2f49('0x32')]['id'];}if(_[_0x2f49('0x33')](_0x2abf4e[_0x2f49('0x32')]['from'])){throw new db[(_0x2f49('0x34'))][(_0x2f49('0x2c'))](_0x2f49('0x35'));}if(_[_0x2f49('0x33')](_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x32')])||_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x32')]===''){throw new db[(_0x2f49('0x34'))][(_0x2f49('0x2c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2f49('0x33')](_0x2abf4e['body'][_0x2f49('0x36')])){throw new db[(_0x2f49('0x34'))][(_0x2f49('0x2c'))](_0x2f49('0x37')+_0x1ef119);}if(!_[_0x2f49('0x38')](_0x1ef119,_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x36')])){throw new db[(_0x2f49('0x34'))][(_0x2f49('0x2c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ef119);}_0x2b777b[_0x2abf4e['body']['mapKey']]=_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x39')];})[_0x2f49('0x13')](function(){return db[_0x2f49('0x3a')][_0x2f49('0x3b')]({'where':{'id':_0x2abf4e[_0x2f49('0x3c')]['id']},'include':[{'model':db[_0x2f49('0x3d')],'as':'List','include':[{'model':db[_0x2f49('0x2a')],'as':_0x2f49('0x3e'),'where':_0x2b777b,'limit':0x1,'order':[[_0x2f49('0x30'),_0x2f49('0x3f')]]}]},{'model':db[_0x2f49('0x40')],'as':_0x2f49('0x41')}]});})[_0x2f49('0x13')](function(_0xd16579){if(_0xd16579&&_0xd16579[_0x2f49('0x42')]){var _0x1e397f=_0xd16579['get']({'plain':!![]});_0x52dbc3[_0x2f49('0x3c')]=_0x1e397f;_0x52dbc3[_0x2f49('0x43')]=_0x1e397f[_0x2f49('0x41')];_0x52dbc3[_0x2f49('0x44')]=_0x1e397f['List'];_0x52dbc3[_0x2f49('0x43')]=_[_0x2f49('0x45')](_0x52dbc3['applications'],[_0x2f49('0x46')],['asc']);if(_0x52dbc3['account']['Applications']){delete _0x52dbc3[_0x2f49('0x3c')][_0x2f49('0x41')];}if(_0x52dbc3[_0x2f49('0x3c')][_0x2f49('0x42')]&&_0x52dbc3['account'][_0x2f49('0x42')][_0x2f49('0x3e')]['length']){return _0x52dbc3['account'][_0x2f49('0x42')][_0x2f49('0x3e')][0x0];}var _0x355b5c=_[_0x2f49('0xe')](_0x2abf4e[_0x2f49('0x32')],{'firstName':_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x39')],'ListId':_0x1e397f[_0x2f49('0x47')]});_0x355b5c[_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x36')]]=_0x2abf4e['body'][_0x2f49('0x39')];return db[_0x2f49('0x2a')]['create'](_0x355b5c,{'fields':_0x1447f5,'raw':!![]});}})[_0x2f49('0x13')](function(_0x1773f7){_0x52dbc3[_0x2f49('0x48')]=_0x1773f7;if(_0x1773f7){var _0x4915ea={'ContactId':_0x1773f7['id'],'FaxAccountId':_0x2abf4e['account']['id'],'fax':_0x1773f7[_0x2f49('0x29')]};return db[_0x2f49('0x49')][_0x2f49('0x3b')]({'where':{'ContactId':_0x1773f7['id'],'closed':![],'FaxAccountId':_0x2abf4e[_0x2f49('0x3c')]['id']}})[_0x2f49('0x13')](function(_0x15b852){if(_0x15b852){return[_0x15b852,![]];}return db[_0x2f49('0x49')][_0x2f49('0x4a')](_0x4915ea)[_0x2f49('0x13')](function(_0x56298d){return[_0x56298d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2f49('0x4b')](function(_0x5a27d6,_0x4fadd0){var _0x1c59f4=_0x5a27d6[_0x2f49('0x4c')]({'plain':!![]});if(_0x4fadd0){if(_0x52dbc3[_0x2f49('0x3c')][_0x2f49('0x4d')]){_0x52dbc3[_0x2f49('0x43')][_0x2f49('0x4e')]({'id':0x0,'priority':_0x52dbc3[_0x2f49('0x43')][_0x2f49('0x4f')]+0x1,'app':_0x2f49('0x50'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1c59f4[_0x2f49('0x51')]=!![];}else{_0x1c59f4[_0x2f49('0x51')]=![];}_0x52dbc3['interaction']=_0x1c59f4;return db[_0x2f49('0x52')]['create']({'body':_0x2abf4e[_0x2f49('0x32')]['body'],'FaxAccountId':_0x2abf4e[_0x2f49('0x3c')]['id'],'FaxInteractionId':_0x5a27d6['id'],'direction':'in','ContactId':_0x5a27d6[_0x2f49('0x53')],'AttachmentId':_0x2abf4e[_0x2f49('0x32')][_0x2f49('0x54')]});})[_0x2f49('0x13')](function(_0x294093){_0x52dbc3[_0x2f49('0x1b')]=_0x294093;if(_0x52dbc3[_0x2f49('0x55')][_0x2f49('0x56')]){return db[_0x2f49('0x57')][_0x2f49('0x3b')]({'attributes':['id',_0x2f49('0x58')],'where':{'id':_0x52dbc3[_0x2f49('0x55')][_0x2f49('0x56')]}})[_0x2f49('0x13')](function(_0x31767a){if(_0x31767a){_0x52dbc3[_0x2f49('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2f49('0x59'),'appdata':_0x31767a[_0x2f49('0x58')]+','+(_0x52dbc3['account'][_0x2f49('0x5a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x2f49('0x5b'),_0x52dbc3);});}return respondWithRpcPromise(_0x2f49('0x5c'),_0x2f49('0x5b'),_0x52dbc3);})['then'](function(_0x196a4f){_0x58723c(_0x196a4f);})[_0x2f49('0x1d')](function(_0xeca1fd){_0x186fe1(_0x551c91[_0x2f49('0x19')](0x1f4,_0xeca1fd[_0x2f49('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 4ece786..3427f2b 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 _0x583c=['remove','update','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0x26d782,_0x17ff8e){var _0x350927=function(_0x37c68d){while(--_0x37c68d){_0x26d782['push'](_0x26d782['shift']());}};_0x350927(++_0x17ff8e);}(_0x583c,0x12b));var _0xc583=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x583c[_0xd22d95];return _0x15d7a3;};'use strict';var FaxAccountEvents=require(_0xc583('0x0'));var events=[_0xc583('0x1'),_0xc583('0x2'),_0xc583('0x3')];function createListener(_0x4e742d,_0x38c7b5){return function(_0x23e62a){_0x38c7b5['emit'](_0x4e742d,_0x23e62a);};}function removeListener(_0x4ca8e3,_0x13b8a7){return function(){FaxAccountEvents[_0xc583('0x4')](_0x4ca8e3,_0x13b8a7);};}exports['register']=function(_0xd3a750){for(var _0x365ed6=0x0,_0x2719df=events[_0xc583('0x5')];_0x365ed6<_0x2719df;_0x365ed6++){var _0x48a8d4=events[_0x365ed6];var _0x21ed88=createListener(_0xc583('0x6')+_0x48a8d4,_0xd3a750);FaxAccountEvents['on'](_0x48a8d4,_0x21ed88);}}; \ No newline at end of file +var _0xdb28=['remove','update','emit','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x1261ac,_0x357a74){var _0x363168=function(_0x45c05c){while(--_0x45c05c){_0x1261ac['push'](_0x1261ac['shift']());}};_0x363168(++_0x357a74);}(_0xdb28,0x106));var _0x8db2=function(_0x2b04d5,_0x303259){_0x2b04d5=_0x2b04d5-0x0;var _0x4f99be=_0xdb28[_0x2b04d5];return _0x4f99be;};'use strict';var FaxAccountEvents=require(_0x8db2('0x0'));var events=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3')];function createListener(_0x585da1,_0x1f4c45){return function(_0x11c26d){_0x1f4c45[_0x8db2('0x4')](_0x585da1,_0x11c26d);};}function removeListener(_0x4426fe,_0x11109e){return function(){FaxAccountEvents['removeListener'](_0x4426fe,_0x11109e);};}exports[_0x8db2('0x5')]=function(_0x1d2dd3){for(var _0x5f42ee=0x0,_0x494b40=events[_0x8db2('0x6')];_0x5f42ee<_0x494b40;_0x5f42ee++){var _0x46932f=events[_0x5f42ee];var _0x131537=createListener(_0x8db2('0x7')+_0x46932f,_0x1d2dd3);FaxAccountEvents['on'](_0x46932f,_0x131537);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f4a895f..cca166b 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 _0xcbaf=['getInteractions','/:id/applications','getApplications','/:id/users','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions'];(function(_0x11f794,_0x3ecae7){var _0x5a0927=function(_0x4dcd60){while(--_0x4dcd60){_0x11f794['push'](_0x11f794['shift']());}};_0x5a0927(++_0x3ecae7);}(_0xcbaf,0x1c2));var _0xfcba=function(_0x3e98bb,_0x46ee85){_0x3e98bb=_0x3e98bb-0x0;var _0x5cb218=_0xcbaf[_0x3e98bb];return _0x5cb218;};'use strict';var multer=require('multer');var util=require(_0xfcba('0x0'));var path=require(_0xfcba('0x1'));var timeout=require(_0xfcba('0x2'));var express=require(_0xfcba('0x3'));var router=express[_0xfcba('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfcba('0x5'));var config=require(_0xfcba('0x6'));var controller=require(_0xfcba('0x7'));router[_0xfcba('0x8')]('/',auth[_0xfcba('0x9')](),controller['index']);router[_0xfcba('0x8')](_0xfcba('0xa'),auth['isAuthenticated'](),controller[_0xfcba('0xb')]);router[_0xfcba('0x8')](_0xfcba('0xc'),auth[_0xfcba('0x9')](),controller[_0xfcba('0xd')]);router[_0xfcba('0x8')](_0xfcba('0xe'),auth[_0xfcba('0x9')](),controller[_0xfcba('0xf')]);router[_0xfcba('0x8')]('/:id/canned_answers',auth[_0xfcba('0x9')](),controller[_0xfcba('0x10')]);router[_0xfcba('0x8')](_0xfcba('0x11'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x12')]);router['get'](_0xfcba('0x13'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x14')]);router[_0xfcba('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xfcba('0x8')](_0xfcba('0x15'),auth[_0xfcba('0x9')](),controller['getAgents']);router[_0xfcba('0x16')]('/',auth['isAuthenticated'](),controller[_0xfcba('0x17')]);router['post']('/:id/dispositions',auth[_0xfcba('0x9')](),controller[_0xfcba('0x18')]);router[_0xfcba('0x16')]('/:id/canned_answers',auth[_0xfcba('0x9')](),controller[_0xfcba('0x19')]);router['post']('/:id/interactions',auth[_0xfcba('0x9')](),controller['addInteraction']);router[_0xfcba('0x16')](_0xfcba('0x13'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x1a')]);router[_0xfcba('0x16')](_0xfcba('0x1b'),auth['isAuthenticated'](),controller[_0xfcba('0x1c')]);router['post']('/updateaccountapplications',auth[_0xfcba('0x9')](),controller[_0xfcba('0x1d')]);router[_0xfcba('0x16')](_0xfcba('0x1e'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x1f')]);router[_0xfcba('0x16')](_0xfcba('0x15'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x20')]);router[_0xfcba('0x21')]('/:id',auth[_0xfcba('0x9')](),controller['update']);router[_0xfcba('0x22')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xfcba('0xe'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x23')]);router[_0xfcba('0x22')]('/:id/canned_answers',auth[_0xfcba('0x9')](),controller[_0xfcba('0x24')]);router['delete'](_0xfcba('0x15'),auth[_0xfcba('0x9')](),controller[_0xfcba('0x25')]);module[_0xfcba('0x26')]=router; \ No newline at end of file +var _0x4814=['express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','create','post','addDisposition','addAnswer','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x4814,0x1aa));var _0x4481=function(_0x41f06d,_0x5e8b80){_0x41f06d=_0x41f06d-0x0;var _0x245005=_0x4814[_0x41f06d];return _0x245005;};'use strict';var multer=require('multer');var util=require(_0x4481('0x0'));var path=require(_0x4481('0x1'));var timeout=require(_0x4481('0x2'));var express=require(_0x4481('0x3'));var router=express[_0x4481('0x4')]();var auth=require(_0x4481('0x5'));var interaction=require(_0x4481('0x6'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router['get']('/',auth[_0x4481('0x7')](),controller[_0x4481('0x8')]);router[_0x4481('0x9')]('/describe',auth[_0x4481('0x7')](),controller['describe']);router['get'](_0x4481('0xa'),auth[_0x4481('0x7')](),controller[_0x4481('0xb')]);router[_0x4481('0x9')](_0x4481('0xc'),auth[_0x4481('0x7')](),controller[_0x4481('0xd')]);router[_0x4481('0x9')](_0x4481('0xe'),auth[_0x4481('0x7')](),controller[_0x4481('0xf')]);router[_0x4481('0x9')](_0x4481('0x10'),auth[_0x4481('0x7')](),controller[_0x4481('0x11')]);router[_0x4481('0x9')](_0x4481('0x12'),auth[_0x4481('0x7')](),controller[_0x4481('0x13')]);router[_0x4481('0x9')](_0x4481('0x14'),auth[_0x4481('0x7')](),controller[_0x4481('0x15')]);router['get'](_0x4481('0x16'),auth[_0x4481('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x4481('0x17')]);router[_0x4481('0x18')](_0x4481('0xc'),auth[_0x4481('0x7')](),controller[_0x4481('0x19')]);router[_0x4481('0x18')](_0x4481('0xe'),auth[_0x4481('0x7')](),controller[_0x4481('0x1a')]);router[_0x4481('0x18')](_0x4481('0x10'),auth[_0x4481('0x7')](),controller['addInteraction']);router[_0x4481('0x18')](_0x4481('0x12'),auth[_0x4481('0x7')](),controller[_0x4481('0x1b')]);router['post']('/addaccountapplications',auth[_0x4481('0x7')](),controller[_0x4481('0x1c')]);router[_0x4481('0x18')](_0x4481('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x4481('0x18')](_0x4481('0x1e'),auth['isAuthenticated'](),controller[_0x4481('0x1f')]);router['post'](_0x4481('0x16'),auth[_0x4481('0x7')](),controller['addAgents']);router[_0x4481('0x20')](_0x4481('0xa'),auth[_0x4481('0x7')](),controller[_0x4481('0x21')]);router[_0x4481('0x22')](_0x4481('0xa'),auth[_0x4481('0x7')](),controller[_0x4481('0x23')]);router['delete'](_0x4481('0xc'),auth[_0x4481('0x7')](),controller[_0x4481('0x24')]);router[_0x4481('0x22')](_0x4481('0xe'),auth[_0x4481('0x7')](),controller['removeAnswers']);router[_0x4481('0x22')](_0x4481('0x16'),auth['isAuthenticated'](),controller[_0x4481('0x25')]);module[_0x4481('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5eecbdc..65216ab 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 _0x5943=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x5943,0x1f2));var _0x3594=function(_0x7127e3,_0x236dba){_0x7127e3=_0x7127e3-0x0;var _0x29d180=_0x5943[_0x7127e3];return _0x29d180;};'use strict';var Sequelize=require(_0x3594('0x0'));module[_0x3594('0x1')]={'priority':{'type':Sequelize[_0x3594('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3594('0x3')],'allowNull':![],'defaultValue':_0x3594('0x4')},'appdata':{'type':Sequelize[_0x3594('0x5')]()},'description':{'type':Sequelize[_0x3594('0x3')]},'interval':{'type':Sequelize[_0x3594('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2fc9=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x85b0e,_0x28bea1){var _0x36ccc8=function(_0x369750){while(--_0x369750){_0x85b0e['push'](_0x85b0e['shift']());}};_0x36ccc8(++_0x28bea1);}(_0x2fc9,0xc2));var _0x92fc=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x2fc9[_0x45518f];return _0x198175;};'use strict';var Sequelize=require('sequelize');module[_0x92fc('0x0')]={'priority':{'type':Sequelize[_0x92fc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x92fc('0x2')],'allowNull':![],'defaultValue':_0x92fc('0x3')},'appdata':{'type':Sequelize[_0x92fc('0x4')]()},'description':{'type':Sequelize[_0x92fc('0x2')]},'interval':{'type':Sequelize[_0x92fc('0x2')],'defaultValue':_0x92fc('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3bfcfdd..7bac95d 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 _0x814b=['destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','FaxApplication','options','find','create','body','params','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x38158b,_0x2072cc){var _0x36bcf1=function(_0x847486){while(--_0x847486){_0x38158b['push'](_0x38158b['shift']());}};_0x36bcf1(++_0x2072cc);}(_0x814b,0x1a2));var _0xb814=function(_0x185d2a,_0x308609){_0x185d2a=_0x185d2a-0x0;var _0x4dea27=_0x814b[_0x185d2a];return _0x4dea27;};'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'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['FaxApplication'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['FaxApplication'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));}; \ No newline at end of file +var _0x326f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','type','filter','options','FaxApplication','include','rows','catch','show','params','includeAll','create','body','update','find','html-pdf'];(function(_0x55ffb5,_0x19968a){var _0x36a827=function(_0x42e09b){while(--_0x42e09b){_0x55ffb5['push'](_0x55ffb5['shift']());}};_0x36a827(++_0x19968a);}(_0x326f,0xd1));var _0xf326=function(_0x308ff7,_0xac76e8){_0x308ff7=_0x308ff7-0x0;var _0x141b43=_0x326f[_0x308ff7];return _0x141b43;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];function respondWithStatusCode(_0x518ab5,_0x3162f9){_0x3162f9=_0x3162f9||0xcc;return function(_0x9ed463){if(_0x9ed463){return _0x518ab5['sendStatus'](_0x3162f9);}return _0x518ab5[_0xf326('0x17')](_0x3162f9)[_0xf326('0x18')]();};}function respondWithResult(_0x3504eb,_0x17a098){_0x17a098=_0x17a098||0xc8;return function(_0x5c8483){if(_0x5c8483){return _0x3504eb[_0xf326('0x17')](_0x17a098)['json'](_0x5c8483);}};}function respondWithFilteredResult(_0x54bd1a,_0xdf21d9){return function(_0x11f6d2){if(_0x11f6d2){var _0x1f2e5a=_0x11f6d2[_0xf326('0x19')],_0xa63d1a=_0xdf21d9[_0xf326('0x1a')],_0x292f4b=_0xdf21d9['offset']+_0xdf21d9[_0xf326('0x1b')],_0x287a2a;if(_0x292f4b>=_0x1f2e5a){_0x292f4b=_0x1f2e5a;_0x287a2a=0xc8;}else{_0x287a2a=0xce;}_0x54bd1a[_0xf326('0x17')](_0x287a2a);return _0x54bd1a[_0xf326('0x1c')](_0xf326('0x1d'),_0xa63d1a+'-'+_0x292f4b+'/'+_0x1f2e5a)[_0xf326('0x1e')](_0x11f6d2);}return null;};}function patchUpdates(_0x311af0){return function(_0x4d3d41){try{jsonpatch['apply'](_0x4d3d41,_0x311af0,!![]);}catch(_0x56ad41){return BPromise[_0xf326('0x1f')](_0x56ad41);}return _0x4d3d41[_0xf326('0x20')]();};}function saveUpdates(_0x484cbe,_0x4cabce){return function(_0x128c68){if(_0x128c68){return _0x128c68['update'](_0x484cbe)['then'](function(_0x448b92){return _0x448b92;});}return null;};}function removeEntity(_0x18ead3,_0x549b46){return function(_0x5aa184){if(_0x5aa184){return _0x5aa184[_0xf326('0x21')]()[_0xf326('0x22')](function(){_0x18ead3['status'](0xcc)[_0xf326('0x18')]();});}};}function handleEntityNotFound(_0x1b9039,_0x43c53e){return function(_0x295752){if(!_0x295752){_0x1b9039[_0xf326('0x23')](0x194);}return _0x295752;};}function handleError(_0x2049ec,_0x5ce532){_0x5ce532=_0x5ce532||0x1f4;return function(_0x55b9f4){logger['error'](_0x55b9f4[_0xf326('0x24')]);if(_0x55b9f4[_0xf326('0x25')]){delete _0x55b9f4[_0xf326('0x25')];}_0x2049ec[_0xf326('0x17')](_0x5ce532)[_0xf326('0x26')](_0x55b9f4);};}exports[_0xf326('0x27')]=function(_0x5217d4,_0x201d28){var _0xa3c0b={},_0x212d5d={},_0x581531={'count':0x0,'rows':[]};var _0x1617d2=_['map'](db['FaxApplication'][_0xf326('0x28')],function(_0x1ae23a){return{'name':_0x1ae23a[_0xf326('0x29')],'type':_0x1ae23a['type'][_0xf326('0x2a')]};});_0x212d5d[_0xf326('0x2b')]=_['map'](_0x1617d2,_0xf326('0x25'));_0x212d5d[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5217d4[_0xf326('0x2c')]);_0x212d5d[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x212d5d[_0xf326('0x2b')],_0x212d5d[_0xf326('0x2c')]);_0xa3c0b[_0xf326('0x30')]=_[_0xf326('0x2f')](_0x212d5d['model'],qs[_0xf326('0x31')](_0x5217d4[_0xf326('0x2c')][_0xf326('0x31')]));_0xa3c0b['attributes']=_0xa3c0b[_0xf326('0x30')][_0xf326('0x32')]?_0xa3c0b[_0xf326('0x30')]:_0x212d5d['model'];if(!_0x5217d4['query'][_0xf326('0x33')](_0xf326('0x34'))){_0xa3c0b[_0xf326('0x1b')]=qs[_0xf326('0x1b')](_0x5217d4[_0xf326('0x2c')][_0xf326('0x1b')]);_0xa3c0b[_0xf326('0x1a')]=qs[_0xf326('0x1a')](_0x5217d4['query'][_0xf326('0x1a')]);}_0xa3c0b[_0xf326('0x35')]=qs['sort'](_0x5217d4[_0xf326('0x2c')]['sort']);_0xa3c0b[_0xf326('0x36')]=qs['filters'](_['pick'](_0x5217d4[_0xf326('0x2c')],_0x212d5d['filters']),_0x1617d2);if(_0x5217d4[_0xf326('0x2c')]['filter']){_0xa3c0b[_0xf326('0x36')]=_[_0xf326('0x37')](_0xa3c0b[_0xf326('0x36')],{'$or':_['map'](_0x1617d2,function(_0x3dcc7e){if(_0x3dcc7e[_0xf326('0x38')]!=='VIRTUAL'){var _0x13932b={};_0x13932b[_0x3dcc7e[_0xf326('0x25')]]={'$like':'%'+_0x5217d4[_0xf326('0x2c')][_0xf326('0x39')]+'%'};return _0x13932b;}})});}_0xa3c0b=_['merge']({},_0xa3c0b,_0x5217d4[_0xf326('0x3a')]);var _0xb1ef35={'where':_0xa3c0b[_0xf326('0x36')]};return db[_0xf326('0x3b')][_0xf326('0x19')](_0xb1ef35)['then'](function(_0x3e830d){_0x581531[_0xf326('0x19')]=_0x3e830d;if(_0x5217d4['query']['includeAll']){_0xa3c0b[_0xf326('0x3c')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0xa3c0b);})[_0xf326('0x22')](function(_0x5d6ae2){_0x581531[_0xf326('0x3d')]=_0x5d6ae2;return _0x581531;})[_0xf326('0x22')](respondWithFilteredResult(_0x201d28,_0xa3c0b))[_0xf326('0x3e')](handleError(_0x201d28,null));};exports[_0xf326('0x3f')]=function(_0x49112d,_0x9dda89){var _0x45d344={'raw':!![],'where':{'id':_0x49112d[_0xf326('0x40')]['id']}},_0x347e7b={};_0x347e7b[_0xf326('0x2b')]=_[_0xf326('0x2d')](db[_0xf326('0x3b')][_0xf326('0x28')]);_0x347e7b[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x49112d[_0xf326('0x2c')]);_0x347e7b[_0xf326('0x2e')]=_['intersection'](_0x347e7b[_0xf326('0x2b')],_0x347e7b[_0xf326('0x2c')]);_0x45d344[_0xf326('0x30')]=_[_0xf326('0x2f')](_0x347e7b[_0xf326('0x2b')],qs[_0xf326('0x31')](_0x49112d['query'][_0xf326('0x31')]));_0x45d344[_0xf326('0x30')]=_0x45d344['attributes'][_0xf326('0x32')]?_0x45d344[_0xf326('0x30')]:_0x347e7b[_0xf326('0x2b')];if(_0x49112d[_0xf326('0x2c')][_0xf326('0x41')]){_0x45d344['include']=[{'all':!![]}];}_0x45d344=_['merge']({},_0x45d344,_0x49112d[_0xf326('0x3a')]);return db[_0xf326('0x3b')]['find'](_0x45d344)['then'](handleEntityNotFound(_0x9dda89,null))[_0xf326('0x22')](respondWithResult(_0x9dda89,null))[_0xf326('0x3e')](handleError(_0x9dda89,null));};exports[_0xf326('0x42')]=function(_0x5b3705,_0x301e65){return db[_0xf326('0x3b')][_0xf326('0x42')](_0x5b3705[_0xf326('0x43')],{})[_0xf326('0x22')](respondWithResult(_0x301e65,0xc9))[_0xf326('0x3e')](handleError(_0x301e65,null));};exports[_0xf326('0x44')]=function(_0x3b90dc,_0x3df9a8){if(_0x3b90dc[_0xf326('0x43')]['id']){delete _0x3b90dc[_0xf326('0x43')]['id'];}return db[_0xf326('0x3b')][_0xf326('0x45')]({'where':{'id':_0x3b90dc[_0xf326('0x40')]['id']}})[_0xf326('0x22')](handleEntityNotFound(_0x3df9a8,null))['then'](saveUpdates(_0x3b90dc[_0xf326('0x43')],null))[_0xf326('0x22')](respondWithResult(_0x3df9a8,null))[_0xf326('0x3e')](handleError(_0x3df9a8,null));};exports[_0xf326('0x21')]=function(_0x5f1829,_0x10f437){return db[_0xf326('0x3b')][_0xf326('0x45')]({'where':{'id':_0x5f1829[_0xf326('0x40')]['id']}})['then'](handleEntityNotFound(_0x10f437,null))[_0xf326('0x22')](removeEntity(_0x10f437,null))[_0xf326('0x3e')](handleError(_0x10f437,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 905fd90..f84a0ac 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 _0xde97=['bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x5f0b01,_0x38c683){var _0x1f62a9=function(_0x5db9e0){while(--_0x5db9e0){_0x5f0b01['push'](_0x5f0b01['shift']());}};_0x1f62a9(++_0x38c683);}(_0xde97,0xfb));var _0x7de9=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xde97[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x7de9('0x0'));var util=require(_0x7de9('0x1'));var logger=require(_0x7de9('0x2'))(_0x7de9('0x3'));var moment=require(_0x7de9('0x4'));var BPromise=require(_0x7de9('0x5'));var rp=require(_0x7de9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7de9('0x7'));var config=require(_0x7de9('0x8'));var attributes=require(_0x7de9('0x9'));module[_0x7de9('0xa')]=function(_0x1ee6d6,_0x538b2b){return _0x1ee6d6[_0x7de9('0xb')](_0x7de9('0xc'),attributes,{'tableName':_0x7de9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7de9('0xe'),'collate':_0x7de9('0xf')});}; \ No newline at end of file +var _0x9b48=['api','moment','bluebird','request-promise','path','./faxApplication.attributes','define','utf8mb4','lodash','util','../../config/logger'];(function(_0x45a023,_0x2ad252){var _0x10c3ca=function(_0x398ad7){while(--_0x398ad7){_0x45a023['push'](_0x45a023['shift']());}};_0x10c3ca(++_0x2ad252);}(_0x9b48,0x126));var _0x89b4=function(_0xb683f4,_0x33e20b){_0xb683f4=_0xb683f4-0x0;var _0x4f7948=_0x9b48[_0xb683f4];return _0x4f7948;};'use strict';var _=require(_0x89b4('0x0'));var util=require(_0x89b4('0x1'));var logger=require(_0x89b4('0x2'))(_0x89b4('0x3'));var moment=require(_0x89b4('0x4'));var BPromise=require(_0x89b4('0x5'));var rp=require(_0x89b4('0x6'));var fs=require('fs');var path=require(_0x89b4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x89b4('0x8'));module['exports']=function(_0x1c8bfe,_0x221f75){return _0x1c8bfe[_0x89b4('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x89b4('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4239996..39fbf62 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 _0xb3f6=['error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0xb3f6,0x1ee));var _0x6b3f=function(_0x448163,_0x2eacd7){_0x448163=_0x448163-0x0;var _0x328255=_0xb3f6[_0x448163];return _0x328255;};'use strict';var _=require(_0x6b3f('0x0'));var util=require(_0x6b3f('0x1'));var moment=require(_0x6b3f('0x2'));var BPromise=require(_0x6b3f('0x3'));var rs=require(_0x6b3f('0x4'));var fs=require('fs');var Redis=require(_0x6b3f('0x5'));var db=require(_0x6b3f('0x6'))['db'];var utils=require(_0x6b3f('0x7'));var logger=require(_0x6b3f('0x8'))(_0x6b3f('0x9'));var config=require(_0x6b3f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6b3f('0xb')][_0x6b3f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xda2ba1,_0x3ee6ac,_0x4dd992){return new BPromise(function(_0x443d3f,_0x45ec5f){return client['request'](_0xda2ba1,_0x4dd992)[_0x6b3f('0xd')](function(_0x31551a){logger['info'](_0x6b3f('0xe'),_0x3ee6ac,'request\x20sent');logger['debug'](_0x6b3f('0xf'),_0x3ee6ac,_0x6b3f('0x10'),JSON[_0x6b3f('0x11')](_0x31551a));if(_0x31551a['error']){if(_0x31551a[_0x6b3f('0x12')][_0x6b3f('0x13')]===0x1f4){logger[_0x6b3f('0x12')](_0x6b3f('0xe'),_0x3ee6ac,_0x31551a[_0x6b3f('0x12')][_0x6b3f('0x14')]);return _0x45ec5f(_0x31551a['error']['message']);}logger[_0x6b3f('0x12')](_0x6b3f('0xe'),_0x3ee6ac,_0x31551a[_0x6b3f('0x12')][_0x6b3f('0x14')]);return _0x443d3f(_0x31551a[_0x6b3f('0x12')]['message']);}else{logger[_0x6b3f('0x15')](_0x6b3f('0xe'),_0x3ee6ac,_0x6b3f('0x10'));_0x443d3f(_0x31551a[_0x6b3f('0x16')]['message']);}})[_0x6b3f('0x17')](function(_0x398981){logger[_0x6b3f('0x12')]('FaxApplication,\x20%s,\x20%s',_0x3ee6ac,_0x398981);_0x45ec5f(_0x398981);});});}exports[_0x6b3f('0x18')]=function(_0x11ff87){var _0x43b52c=this;return new Promise(function(_0x59cf27,_0x450c3a){return db[_0x6b3f('0x19')][_0x6b3f('0x1a')](_0x11ff87['body'],{'raw':_0x11ff87[_0x6b3f('0x1b')]?_0x11ff87[_0x6b3f('0x1b')][_0x6b3f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11ff87['options']?_0x11ff87[_0x6b3f('0x1b')]['where']||null:null,'attributes':_0x11ff87[_0x6b3f('0x1b')]?_0x11ff87[_0x6b3f('0x1b')][_0x6b3f('0x1d')]||null:null,'limit':_0x11ff87['options']?_0x11ff87[_0x6b3f('0x1b')][_0x6b3f('0x1e')]||null:null})[_0x6b3f('0xd')](function(_0x2eed30){logger[_0x6b3f('0x15')](_0x6b3f('0x18'),_0x11ff87);logger[_0x6b3f('0x1f')]('UpdateFaxApplication',_0x11ff87,JSON[_0x6b3f('0x11')](_0x2eed30));_0x59cf27(_0x2eed30);})['catch'](function(_0x1ece59){logger[_0x6b3f('0x12')]('UpdateFaxApplication',_0x1ece59[_0x6b3f('0x14')],_0x11ff87);_0x450c3a(_0x43b52c[_0x6b3f('0x12')](0x1f4,_0x1ece59[_0x6b3f('0x14')]));});});}; \ No newline at end of file +var _0x6e62=['rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','debug','stringify','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x320243,_0x55038d){var _0x1c9c6a=function(_0x209e5e){while(--_0x209e5e){_0x320243['push'](_0x320243['shift']());}};_0x1c9c6a(++_0x55038d);}(_0x6e62,0x1ab));var _0x26e6=function(_0x355eb4,_0x54ac5a){_0x355eb4=_0x355eb4-0x0;var _0x2ff0a8=_0x6e62[_0x355eb4];return _0x2ff0a8;};'use strict';var _=require(_0x26e6('0x0'));var util=require(_0x26e6('0x1'));var moment=require(_0x26e6('0x2'));var BPromise=require(_0x26e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26e6('0x5'));var logger=require(_0x26e6('0x6'))(_0x26e6('0x7'));var config=require(_0x26e6('0x8'));var jayson=require(_0x26e6('0x9'));var client=jayson[_0x26e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369475,_0x26cd06,_0x42af41){return new BPromise(function(_0x2ba161,_0x5b083c){return client[_0x26e6('0xb')](_0x369475,_0x42af41)[_0x26e6('0xc')](function(_0x5f1b66){logger[_0x26e6('0xd')](_0x26e6('0xe'),_0x26cd06,_0x26e6('0xf'));logger['debug'](_0x26e6('0x10'),_0x26cd06,_0x26e6('0xf'),JSON['stringify'](_0x5f1b66));if(_0x5f1b66[_0x26e6('0x11')]){if(_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x12')]===0x1f4){logger[_0x26e6('0x11')](_0x26e6('0xe'),_0x26cd06,_0x5f1b66[_0x26e6('0x11')]['message']);return _0x5b083c(_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x13')]);}logger[_0x26e6('0x11')](_0x26e6('0xe'),_0x26cd06,_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x13')]);return _0x2ba161(_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x13')]);}else{logger[_0x26e6('0xd')](_0x26e6('0xe'),_0x26cd06,_0x26e6('0xf'));_0x2ba161(_0x5f1b66[_0x26e6('0x14')][_0x26e6('0x13')]);}})['catch'](function(_0x4cd96f){logger[_0x26e6('0x11')]('FaxApplication,\x20%s,\x20%s',_0x26cd06,_0x4cd96f);_0x5b083c(_0x4cd96f);});});}exports[_0x26e6('0x15')]=function(_0x5927c2){var _0x1a4b17=this;return new Promise(function(_0x2f720d,_0x14e411){return db[_0x26e6('0x16')]['update'](_0x5927c2[_0x26e6('0x17')],{'raw':_0x5927c2[_0x26e6('0x18')]?_0x5927c2[_0x26e6('0x18')][_0x26e6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5927c2['options']?_0x5927c2[_0x26e6('0x18')]['where']||null:null,'attributes':_0x5927c2[_0x26e6('0x18')]?_0x5927c2[_0x26e6('0x18')][_0x26e6('0x1a')]||null:null,'limit':_0x5927c2['options']?_0x5927c2[_0x26e6('0x18')][_0x26e6('0x1b')]||null:null})[_0x26e6('0xc')](function(_0x3a3023){logger[_0x26e6('0xd')](_0x26e6('0x15'),_0x5927c2);logger[_0x26e6('0x1c')]('UpdateFaxApplication',_0x5927c2,JSON[_0x26e6('0x1d')](_0x3a3023));_0x2f720d(_0x3a3023);})[_0x26e6('0x1e')](function(_0x51af67){logger['error'](_0x26e6('0x15'),_0x51af67['message'],_0x5927c2);_0x14e411(_0x1a4b17[_0x26e6('0x11')](0x1f4,_0x51af67[_0x26e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8ef876f..b563ba4 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 _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7217,0x19e));var _0x7721=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7217[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);module[_0x7721('0x11')]=router; \ No newline at end of file +var _0xb4c7=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','show','post'];(function(_0x533f22,_0xca52e){var _0x2393ea=function(_0x30a1f4){while(--_0x30a1f4){_0x533f22['push'](_0x533f22['shift']());}};_0x2393ea(++_0xca52e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x50da90,_0xeebd58){_0x50da90=_0x50da90-0x0;var _0x3ecb10=_0xb4c7[_0x50da90];return _0x3ecb10;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0xd')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x13')]);module[_0x7b4c('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 922263a..09e2506 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 _0xdfcb=['out','sequelize','BOOLEAN','STRING','DATE','ENUM'];(function(_0x36d0b3,_0x481074){var _0x197b99=function(_0x1f247d){while(--_0x1f247d){_0x36d0b3['push'](_0x36d0b3['shift']());}};_0x197b99(++_0x481074);}(_0xdfcb,0x1ab));var _0xbdfc=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xdfcb[_0x374ada];return _0x449ed8;};'use strict';var Sequelize=require(_0xbdfc('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbdfc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbdfc('0x2')]},'note':{'type':Sequelize[_0xbdfc('0x2')]},'read1stAt':{'type':Sequelize[_0xbdfc('0x3')]},'fax':{'type':Sequelize[_0xbdfc('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xbdfc('0x4')]('in',_0xbdfc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbdfc('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbdfc('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3b51=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x555dc8,_0x17d6aa){var _0xa34172=function(_0x29bf4f){while(--_0x29bf4f){_0x555dc8['push'](_0x555dc8['shift']());}};_0xa34172(++_0x17d6aa);}(_0x3b51,0x177));var _0x13b5=function(_0x189eab,_0x2d1178){_0x189eab=_0x189eab-0x0;var _0x4513dc=_0x3b51[_0x189eab];return _0x4513dc;};'use strict';var Sequelize=require(_0x13b5('0x0'));module['exports']={'closed':{'type':Sequelize[_0x13b5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x13b5('0x2')]},'disposition':{'type':Sequelize[_0x13b5('0x3')]},'note':{'type':Sequelize[_0x13b5('0x3')]},'read1stAt':{'type':Sequelize[_0x13b5('0x2')]},'fax':{'type':Sequelize[_0x13b5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x13b5('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x13b5('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x13b5('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 2051dae..3667338 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 _0x8c11=['merge','options','create','destroy','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','createWriteStream','resolve','err','unlinkSync','html-pdf','eml-format','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/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxInteraction.socket','register','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','send','map','fullname','TagIds','Tags','split','forEach','push','catch','FaxInteraction','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','pick','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','rawAttributes','includeAll','include'];(function(_0x120a35,_0x55a52a){var _0x37cc11=function(_0x84edf7){while(--_0x84edf7){_0x120a35['push'](_0x120a35['shift']());}};_0x37cc11(++_0x55a52a);}(_0x8c11,0xf5));var _0x18c1=function(_0x160b06,_0x14fead){_0x160b06=_0x160b06-0x0;var _0x246a48=_0x8c11[_0x160b06];return _0x246a48;};'use strict';var pdf=require(_0x18c1('0x0'));var emlformat=require(_0x18c1('0x1'));var rimraf=require(_0x18c1('0x2'));var zipdir=require(_0x18c1('0x3'));var jsonpatch=require(_0x18c1('0x4'));var rp=require(_0x18c1('0x5'));var moment=require(_0x18c1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x18c1('0x7'));var util=require(_0x18c1('0x8'));var path=require(_0x18c1('0x9'));var sox=require(_0x18c1('0xa'));var csv=require(_0x18c1('0xb'));var ejs=require(_0x18c1('0xc'));var fs=require('fs');var _=require(_0x18c1('0xd'));var squel=require(_0x18c1('0xe'));var crypto=require('crypto');var jsforce=require(_0x18c1('0xf'));var deskjs=require(_0x18c1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x18c1('0x11'));var Papa=require(_0x18c1('0x12'));var Redis=require(_0x18c1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x18c1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x18c1('0x15'))(_0x18c1('0x16'));var utils=require(_0x18c1('0x17'));var config=require(_0x18c1('0x18'));var db=require(_0x18c1('0x19'))['db'];config['redis']=_['defaults'](config[_0x18c1('0x1a')],{'host':_0x18c1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x18c1('0x1c'))[_0x18c1('0x1d')](socket);function respondWithStatusCode(_0x1b156c,_0x4f27a2){_0x4f27a2=_0x4f27a2||0xcc;return function(_0x5df1e9){if(_0x5df1e9){return _0x1b156c['sendStatus'](_0x4f27a2);}return _0x1b156c[_0x18c1('0x1e')](_0x4f27a2)[_0x18c1('0x1f')]();};}function respondWithResult(_0xf5817c,_0x142974){_0x142974=_0x142974||0xc8;return function(_0x50c969){if(_0x50c969){return _0xf5817c[_0x18c1('0x1e')](_0x142974)[_0x18c1('0x20')](_0x50c969);}};}function respondWithFilteredResult(_0x2a3910,_0x4f46d0){return function(_0x253964){if(_0x253964){var _0x20112e=_0x253964['count'],_0x3b15de=_0x4f46d0[_0x18c1('0x21')],_0x45cf20=_0x4f46d0['offset']+_0x4f46d0[_0x18c1('0x22')],_0x230148;if(_0x45cf20>=_0x20112e){_0x45cf20=_0x20112e;_0x230148=0xc8;}else{_0x230148=0xce;}_0x2a3910['status'](_0x230148);return _0x2a3910['set'](_0x18c1('0x23'),_0x3b15de+'-'+_0x45cf20+'/'+_0x20112e)[_0x18c1('0x20')](_0x253964);}return null;};}function patchUpdates(_0x45af4f){return function(_0x39752c){try{jsonpatch[_0x18c1('0x24')](_0x39752c,_0x45af4f,!![]);}catch(_0x4fcf32){return BPromise[_0x18c1('0x25')](_0x4fcf32);}return _0x39752c[_0x18c1('0x26')]();};}function saveUpdates(_0x48a34c,_0x486d60){return function(_0x18fba7){if(_0x18fba7){return _0x18fba7[_0x18c1('0x27')](_0x48a34c)[_0x18c1('0x28')](function(_0x314203){return _0x314203;});}return null;};}function removeEntity(_0x842756,_0x390133){return function(_0x1df263){if(_0x1df263){return _0x1df263['destroy']()[_0x18c1('0x28')](function(){_0x842756[_0x18c1('0x1e')](0xcc)[_0x18c1('0x1f')]();});}};}function handleEntityNotFound(_0x40e1e1,_0x1498e9){return function(_0x211a1f){if(!_0x211a1f){_0x40e1e1[_0x18c1('0x29')](0x194);}return _0x211a1f;};}function handleError(_0x13e431,_0x5496fe){_0x5496fe=_0x5496fe||0x1f4;return function(_0x1f198c){logger['error'](_0x1f198c['stack']);if(_0x1f198c['name']){delete _0x1f198c['name'];}_0x13e431[_0x18c1('0x1e')](_0x5496fe)[_0x18c1('0x2a')](_0x1f198c);};}function getInteractionUsers(_0x2e2988,_0x1d3ffc){return new BPromise(function(_0x304ab5,_0x2bd479){try{if(_0x1d3ffc[_0x2e2988['id']]){_0x2e2988['Users']=_[_0x18c1('0x2b')](_0x1d3ffc[_0x2e2988['id']],function(_0x19b10a){return{'id':_0x19b10a['id'],'fullname':_0x19b10a[_0x18c1('0x2c')]};});}}catch(_0x228850){_0x2bd479(_0x228850);}_0x304ab5(_0x2e2988);});}function getInteractionTags(_0xcc2907,_0xdfcb2){return new BPromise(function(_0x1f7081,_0x4f7598){try{if(_0xcc2907[_0x18c1('0x2d')]){_0xcc2907[_0x18c1('0x2e')]=[];_0xcc2907[_0x18c1('0x2d')][_0x18c1('0x2f')](',')[_0x18c1('0x30')](function(_0x46b133){_0xcc2907[_0x18c1('0x2e')][_0x18c1('0x31')](_0xdfcb2[_0x46b133]);});}delete _0xcc2907['TagIds'];}catch(_0xb0a211){_0x4f7598(_0xb0a211);}_0x1f7081(_0xcc2907);});}function updateFaxInteraction(_0x131ebe,_0x163726,_0x3683bb){return new BPromise(function(_0x78736f,_0x26fa93){return getInteractionUsers(_0x131ebe,_0x3683bb)[_0x18c1('0x28')](function(_0x1e406c){return getInteractionTags(_0x1e406c,_0x163726);})[_0x18c1('0x28')](function(_0x2c8874){_0x78736f(_0x2c8874);})[_0x18c1('0x32')](function(_0x19d2ea){_0x26fa93(_0x19d2ea);});});}exports['index']=function(_0xb7c854,_0x31405e){var _0x2dbc51={},_0x4f87b0={},_0x6d823c={'count':0x0,'rows':[]};var _0x34f205=_[_0x18c1('0x2b')](db[_0x18c1('0x33')]['rawAttributes'],function(_0x3e75f6){return{'name':_0x3e75f6[_0x18c1('0x34')],'type':_0x3e75f6[_0x18c1('0x35')][_0x18c1('0x36')]};});_0x4f87b0[_0x18c1('0x37')]=_['map'](_0x34f205,_0x18c1('0x38'));_0x4f87b0['query']=_[_0x18c1('0x39')](_0xb7c854['query']);_0x4f87b0[_0x18c1('0x3a')]=_[_0x18c1('0x3b')](_0x4f87b0['model'],_0x4f87b0[_0x18c1('0x3c')]);_0x2dbc51[_0x18c1('0x3d')]=_['intersection'](_0x4f87b0['model'],qs[_0x18c1('0x3e')](_0xb7c854['query']['fields']));_0x2dbc51[_0x18c1('0x3d')]=_0x2dbc51[_0x18c1('0x3d')][_0x18c1('0x3f')]?_0x2dbc51[_0x18c1('0x3d')]:_0x4f87b0[_0x18c1('0x37')];if(!_0xb7c854['query']['hasOwnProperty'](_0x18c1('0x40'))){_0x2dbc51[_0x18c1('0x22')]=qs['limit'](_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x22')]);_0x2dbc51[_0x18c1('0x21')]=qs[_0x18c1('0x21')](_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x21')]);}_0x2dbc51['order']=qs[_0x18c1('0x41')](_0xb7c854['query'][_0x18c1('0x41')]);_0x2dbc51['where']=qs[_0x18c1('0x3a')](_[_0x18c1('0x42')](_0xb7c854['query'],_0x4f87b0[_0x18c1('0x3a')]),_0x34f205);var _0x30bb66=[];var _0x3bf94a=squel[_0x18c1('0x43')]()[_0x18c1('0x44')]('id')[_0x18c1('0x44')]('name')[_0x18c1('0x44')]('color')['from'](_0x18c1('0x45'));var _0xb9caa3=squel[_0x18c1('0x43')]()['field'](_0x18c1('0x46'))[_0x18c1('0x44')](_0x18c1('0x47'))[_0x18c1('0x44')](_0x18c1('0x48'))[_0x18c1('0x49')](_0x18c1('0x4a'),'ui')[_0x18c1('0x4b')](_0x18c1('0x4c'),'u',_0x18c1('0x4d'));var _0xd1804d=squel['select']()[_0x18c1('0x49')](_0x18c1('0x4e'),'i')[_0x18c1('0x4b')]('cm_contacts','c',_0x18c1('0x4f'))['left_join'](_0x18c1('0x4c'),'o',_0x18c1('0x50'))[_0x18c1('0x4b')](_0x18c1('0x51'),'a',_0x18c1('0x52'))[_0x18c1('0x4b')](_0x18c1('0x53'),'me',_0x18c1('0x54'))['left_join']('fax_interaction_has_tags','it',_0x18c1('0x55'))[_0x18c1('0x4b')](_0x18c1('0x45'),'t',_0x18c1('0x56'));var _0x46b906=squel[_0x18c1('0x57')]();var _0x3dfee4=[];var _0x29dfbd=squel[_0x18c1('0x57')]();var _0x2f9ad6;if(_0xb7c854['query']['search']){_0x2f9ad6=as[_0x18c1('0x58')](_0xb7c854[_0x18c1('0x3c')]['search']);var _0x128445=_0x2f9ad6[_0x18c1('0x59')];for(var _0x451fa2=0x0;_0x451fa2<_0x2f9ad6[_0x18c1('0x5a')][_0x18c1('0x3f')];_0x451fa2++){var _0x179e35=_0x2f9ad6[_0x18c1('0x5a')][_0x451fa2];var _0x37b26f='i';var _0x1e7cd0=_[_0x18c1('0x5b')](_0x34f205,['name',_0x179e35[_0x18c1('0x44')]]);if(!_0x1e7cd0){switch(_0x179e35['field']){case _0x18c1('0x5c'):if(_0x179e35['value']==0x1){_0xd1804d[_0x18c1('0x5d')]('`'+_0x179e35[_0x18c1('0x44')]+'`\x20=\x200');}else{_0xd1804d[_0x18c1('0x5d')]('`'+_0x179e35[_0x18c1('0x44')]+_0x18c1('0x5e'));}break;case _0x18c1('0x5f'):if(_0x179e35[_0x18c1('0x60')]===_0x18c1('0x61')){if(_0x179e35[_0x18c1('0x62')][_0x18c1('0x2f')]('\x20')[_0x18c1('0x3f')]>0x1){_0x46b906[_0x128445](_0x18c1('0x63'),qs[_0x18c1('0x64')](_0x179e35['value']),null);}else{var _0x270584='%'+_0x179e35[_0x18c1('0x62')]+'%';_0x46b906[_0x128445](_0x18c1('0x65'),_0x270584,_0x270584,_0x270584);}}else{_0x1e7cd0=_[_0x18c1('0x5b')](_0x34f205,['name',_0x18c1('0x66')]);_0x179e35[_0x18c1('0x44')]=_0x18c1('0x66');_0xba9ac1=as[_0x18c1('0x67')](_0x37b26f,_0x1e7cd0[_0x18c1('0x35')],_0x179e35);_0x46b906[_0x128445](_0xba9ac1[_0x18c1('0x68')],_0xba9ac1[_0x18c1('0x62')][_0x18c1('0x69')],_0xba9ac1[_0x18c1('0x62')][_0x18c1('0x1f')]);}break;case _0x18c1('0x6a'):var _0x1018b2=_0x179e35[_0x18c1('0x62')][_0x18c1('0x2f')](',')[_0x18c1('0x2b')](function(_0x582cb2){return Number(_0x582cb2);});_0x1018b2[_0x18c1('0x30')](function(_0x3b7a83){_0x29dfbd['or'](_0x18c1('0x6b'),'%,'+_0x3b7a83+',%');});_0x3dfee4=_['union'](_0x3dfee4,_0x1018b2);break;case _0x18c1('0x6c'):if(_0x179e35[_0x18c1('0x60')]==='$substring'){_0x46b906[_0x128445]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x179e35[_0x18c1('0x62')]+'%',null);}else{_0x1e7cd0=_[_0x18c1('0x5b')](_0x34f205,[_0x18c1('0x38'),_0x18c1('0x6d')]);_0x179e35[_0x18c1('0x44')]=_0x18c1('0x6d');_0xba9ac1=as['buildExpression'](_0x37b26f,_0x1e7cd0[_0x18c1('0x35')],_0x179e35);_0x46b906[_0x128445](_0xba9ac1['text'],_0xba9ac1[_0x18c1('0x62')][_0x18c1('0x69')],_0xba9ac1['value']['end']);}break;case _0x18c1('0x6e'):_0xba9ac1=as[_0x18c1('0x67')]('me',null,_0x179e35);_0x46b906[_0x128445](_0xba9ac1['text'],_0xba9ac1['value'][_0x18c1('0x69')],_0xba9ac1['value']['end']);break;}}else{var _0xba9ac1=as[_0x18c1('0x67')](_0x37b26f,_0x1e7cd0[_0x18c1('0x35')],_0x179e35);_0x46b906[_0x128445](_0xba9ac1[_0x18c1('0x68')],_0xba9ac1[_0x18c1('0x62')][_0x18c1('0x69')],_0xba9ac1['value']['end']);}}}else{var _0x347c1a=_(_0xb7c854[_0x18c1('0x3c')])[_0x18c1('0x39')]()[_0x18c1('0x2b')](function(_0x32a893){return _[_0x18c1('0x6f')](_0x34f205,[_0x18c1('0x38'),_0x32a893])?_0x32a893:undefined;})[_0x18c1('0x70')]()['value']();if(!_[_0x18c1('0x71')](_0x347c1a)){_0x347c1a[_0x18c1('0x30')](function(_0x3ca0e7){if(_0x3ca0e7===_0x18c1('0x72')){_0xd1804d[_0x18c1('0x73')](_0x18c1('0x74'),[][_0x18c1('0x75')](_0xb7c854[_0x18c1('0x3c')][_0x3ca0e7]));}else if(_0x3ca0e7==='createdAt'){var _0x4ffef4=JSON[_0x18c1('0x76')](_0xb7c854['query'][_0x3ca0e7])[_0x18c1('0x77')];var _0x50f956=JSON[_0x18c1('0x76')](_0xb7c854[_0x18c1('0x3c')][_0x3ca0e7])['$lte'];_0xd1804d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4ffef4,_0x50f956);}else{if(_0xb7c854['query'][_0x3ca0e7]===_0x18c1('0x78')){_0xd1804d[_0x18c1('0x73')]('i.'+_0x3ca0e7+_0x18c1('0x79'));}else{_0xd1804d[_0x18c1('0x73')]('i.'+_0x3ca0e7+'\x20=\x20?',_0xb7c854['query'][_0x3ca0e7]);}}});}if(_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x7a')]){if(_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x7a')]==0x1){_0xd1804d[_0x18c1('0x5d')](_0x18c1('0x7b'));}else{_0xd1804d['having'](_0x18c1('0x7c'));}}if(_0xb7c854['query'][_0x18c1('0x7d')]){_0x3dfee4=_['isArray'](_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x7d')])?_0xb7c854[_0x18c1('0x3c')]['tag']:new Array(_0xb7c854[_0x18c1('0x3c')]['tag']);_0x3dfee4['forEach'](function(_0x1b7379){_0x29dfbd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1b7379+',%');});}if(_0xb7c854['query']['filter']){var _0x297695=_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x7e')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x18c1('0x7f')](_0x297695)){_0x46b906['or']('i.id\x20LIKE\x20?',_0x297695+'%')['or'](_0x18c1('0x80'),_0x297695+'%');}_0x46b906['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x297695+'%');}}_0xd1804d[_0x18c1('0x73')](_0x46b906);_0xd1804d[_0x18c1('0x81')](_0x18c1('0x82'));var _0x511894={'type':db[_0x18c1('0x83')][_0x18c1('0x84')]['SELECT'],'raw':!![]};var _0x2419f6=_0xd1804d['clone']();_0x2419f6['field'](_0x18c1('0x82'));_0x2419f6['field'](_0x18c1('0x85'),'unreadMessages');if(_0x2dbc51[_0x18c1('0x86')]){_0x2dbc51[_0x18c1('0x86')]['forEach'](function(_0x4fcd0e){_0xd1804d[_0x18c1('0x86')]('i.'+_0x4fcd0e[0x0],_0x4fcd0e[0x1]===_0x18c1('0x87')?![]:!![]);});}if(!_[_0x18c1('0x71')](_0x3dfee4)){_0xd1804d[_0x18c1('0x5d')](_0x29dfbd);_0x2419f6[_0x18c1('0x73')](_0x18c1('0x88'),_0x3dfee4);}BPromise['resolve']()['then'](function(){if(!_0x2f9ad6){if(_0xb7c854['query'][_0x18c1('0x72')]||_0xb7c854[_0x18c1('0x3c')][_0x18c1('0x89')])return;_0x2419f6[_0x18c1('0x73')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xd1804d[_0x18c1('0x73')](_0x18c1('0x8a'));return;}return _0xb7c854['user'][_0x18c1('0x8b')]({'attributes':['id'],'raw':!![]})[_0x18c1('0x28')](function(_0x27e2b6){if(_[_0x18c1('0x71')](_0x27e2b6)){_0x2419f6[_0x18c1('0x73')](_0x18c1('0x8c'));_0xd1804d['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x2419f6['where'](_0x18c1('0x74'),_['map'](_0x27e2b6,'id'));_0xd1804d[_0x18c1('0x73')](_0x18c1('0x74'),_['map'](_0x27e2b6,'id'));}});})[_0x18c1('0x28')](function(){db[_0x18c1('0x8d')]['query'](_0x2419f6[_0x18c1('0x8e')](),_0x511894)[_0x18c1('0x28')](function(_0x294e33){_0x6d823c[_0x18c1('0x8f')]=_0x294e33[_0x18c1('0x3f')];if(_0x6d823c['count']===0x0)return[];return db[_0x18c1('0x8d')][_0x18c1('0x3c')](_0x3bf94a['toString'](),_0x511894)[_0x18c1('0x28')](function(_0x27ddb0){_0x30bb66=_[_0x18c1('0x90')](_0x27ddb0,'id');_0x511894=_['merge'](_0x511894,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb7c854[_0x18c1('0x3c')]['fields']){_0x2dbc51['attributes']['forEach'](function(_0x31c252){_0xd1804d[_0x18c1('0x44')]('i.'+_0x31c252);});}else{_0xd1804d[_0x18c1('0x44')](_0x18c1('0x85'),_0x18c1('0x5c'));_0xd1804d[_0x18c1('0x44')]('a.key',_0x18c1('0x91'));_0xd1804d['field'](_0x18c1('0x92'),_0x18c1('0x93'));_0xd1804d[_0x18c1('0x44')](_0x18c1('0x94'));_0xd1804d[_0x18c1('0x44')]('c.firstName',_0x18c1('0x95'));_0xd1804d[_0x18c1('0x44')]('c.lastName',_0x18c1('0x96'));_0xd1804d['field']('c.email',_0x18c1('0x97'));_0xd1804d[_0x18c1('0x44')](_0x18c1('0x98'),_0x18c1('0x99'));_0xd1804d['field'](_0x18c1('0x9a'),_0x18c1('0x9b'));_0xd1804d['field']('c.fax',_0x18c1('0x9c'));_0xd1804d['field'](_0x18c1('0x9d'),_0x18c1('0x9e'));_0xd1804d['field'](_0x18c1('0x9f'),_0x18c1('0xa0'));_0xd1804d['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x18c1('0x2d'));}if(_0x2dbc51[_0x18c1('0x22')])_0xd1804d['limit'](_0x2dbc51[_0x18c1('0x22')]);if(_0x2dbc51[_0x18c1('0x21')])_0xd1804d[_0x18c1('0x21')](_0x2dbc51[_0x18c1('0x21')]);return db[_0x18c1('0x8d')][_0x18c1('0x3c')](_0xd1804d[_0x18c1('0x8e')](),_0x511894);})[_0x18c1('0x28')](function(_0x696991){_0xb9caa3[_0x18c1('0x73')](_0x18c1('0xa1'),_[_0x18c1('0x2b')](_0x696991,'id'));return db[_0x18c1('0x8d')][_0x18c1('0x3c')](_0xb9caa3[_0x18c1('0x8e')](),_0x511894)['then'](function(_0x503ea4){var _0x8215d1=_[_0x18c1('0xa2')](_0x503ea4,_0x18c1('0xa3'));var _0x516ea6=[];_0x696991[_0x18c1('0x30')](function(_0x125753){_0x516ea6[_0x18c1('0x31')](updateFaxInteraction(_0x125753,_0x30bb66,_0x8215d1));});return BPromise[_0x18c1('0xa4')](_0x516ea6);});});})[_0x18c1('0x28')](function(_0xde8f0a){_0x6d823c[_0x18c1('0xa5')]=_0xde8f0a;return _0x6d823c;})[_0x18c1('0x28')](respondWithFilteredResult(_0x31405e,_0x2dbc51));})[_0x18c1('0x32')](handleError(_0x31405e,null));};exports[_0x18c1('0xa6')]=function(_0x5c1bb4,_0x26b069){var _0x303868={'raw':![],'where':{'id':_0x5c1bb4[_0x18c1('0xa7')]['id']}},_0x4766ee={};_0x4766ee['model']=_[_0x18c1('0x39')](db[_0x18c1('0x33')][_0x18c1('0xa8')]);_0x4766ee[_0x18c1('0x3c')]=_['keys'](_0x5c1bb4[_0x18c1('0x3c')]);_0x4766ee[_0x18c1('0x3a')]=_['intersection'](_0x4766ee[_0x18c1('0x37')],_0x4766ee['query']);_0x303868[_0x18c1('0x3d')]=_[_0x18c1('0x3b')](_0x4766ee[_0x18c1('0x37')],qs[_0x18c1('0x3e')](_0x5c1bb4[_0x18c1('0x3c')]['fields']));_0x303868['attributes']=_0x303868[_0x18c1('0x3d')]['length']?_0x303868[_0x18c1('0x3d')]:_0x4766ee[_0x18c1('0x37')];if(_0x5c1bb4[_0x18c1('0x3c')][_0x18c1('0xa9')]){_0x303868[_0x18c1('0xaa')]=[{'all':!![]}];}_0x303868=_[_0x18c1('0xab')]({},_0x303868,_0x5c1bb4[_0x18c1('0xac')]);return db[_0x18c1('0x33')][_0x18c1('0x5b')](_0x303868)['then'](handleEntityNotFound(_0x26b069,null))[_0x18c1('0x28')](respondWithResult(_0x26b069,null))[_0x18c1('0x32')](handleError(_0x26b069,null));};exports[_0x18c1('0xad')]=function(_0xb602af,_0xc9f2c2){return db[_0x18c1('0x33')][_0x18c1('0xad')](_0xb602af[_0x18c1('0x6e')],{})[_0x18c1('0x28')](respondWithResult(_0xc9f2c2,0xc9))[_0x18c1('0x32')](handleError(_0xc9f2c2,null));};exports[_0x18c1('0x27')]=function(_0x571039,_0x1bf689){if(_0x571039[_0x18c1('0x6e')]['id']){delete _0x571039['body']['id'];}return db[_0x18c1('0x33')][_0x18c1('0x5b')]({'where':{'id':_0x571039['params']['id']}})[_0x18c1('0x28')](handleEntityNotFound(_0x1bf689,null))[_0x18c1('0x28')](saveUpdates(_0x571039[_0x18c1('0x6e')],null))['then'](respondWithResult(_0x1bf689,null))[_0x18c1('0x32')](handleError(_0x1bf689,null));};exports[_0x18c1('0xae')]=function(_0x29f9fa,_0x55ff74){return db[_0x18c1('0x33')][_0x18c1('0x5b')]({'where':{'id':_0x29f9fa[_0x18c1('0xa7')]['id']}})[_0x18c1('0x28')](handleEntityNotFound(_0x55ff74,null))['then'](removeEntity(_0x55ff74,null))[_0x18c1('0x32')](handleError(_0x55ff74,null));};exports[_0x18c1('0xaf')]=function(_0x5260d1,_0x5c94f9){return db['FaxInteraction'][_0x18c1('0xaf')]()['then'](respondWithResult(_0x5c94f9,null))[_0x18c1('0x32')](handleError(_0x5c94f9,null));};exports['addMessage']=function(_0x3413db,_0x4e964a,_0x2e6f49){return db[_0x18c1('0xb0')]['find']({'where':{'id':_0x3413db[_0x18c1('0xa7')]['id']}})[_0x18c1('0x28')](handleEntityNotFound(_0x4e964a,null))[_0x18c1('0x28')](function(_0x57dd54){if(_0x57dd54){return _0x57dd54[_0x18c1('0xb1')](_0x3413db[_0x18c1('0x6e')][_0x18c1('0xb2')],_[_0x18c1('0xb3')](_0x3413db[_0x18c1('0x6e')],[_0x18c1('0xb2'),'id'])||{});}})[_0x18c1('0x28')](respondWithResult(_0x4e964a,null))[_0x18c1('0x32')](handleError(_0x4e964a,null));};exports[_0x18c1('0xb4')]=function(_0x3859e3,_0x2a1a91,_0x37da8b){var _0x1f7202={'raw':![],'where':{}};var _0xfa917c={};var _0x187a2c={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x18c1('0xb5')]({'where':{'id':_0x3859e3[_0x18c1('0xa7')]['id']}})[_0x18c1('0x28')](handleEntityNotFound(_0x2a1a91,null))[_0x18c1('0x28')](function(_0x2b70e3){if(_0x2b70e3){_0xfa917c[_0x18c1('0x37')]=_['keys'](db[_0x18c1('0xb0')][_0x18c1('0xa8')]);_0xfa917c[_0x18c1('0x3c')]=_[_0x18c1('0x39')](_0x3859e3[_0x18c1('0x3c')]);_0xfa917c[_0x18c1('0x3a')]=_[_0x18c1('0x3b')](_0xfa917c[_0x18c1('0x37')],_0xfa917c[_0x18c1('0x3c')]);_0x1f7202[_0x18c1('0x3d')]=_['intersection'](_0xfa917c[_0x18c1('0x37')],qs[_0x18c1('0x3e')](_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x3e')]));_0x1f7202[_0x18c1('0x3d')]=_0x1f7202[_0x18c1('0x3d')]['length']?_0x1f7202[_0x18c1('0x3d')]:_0xfa917c['model'];if(!_0x3859e3[_0x18c1('0x3c')][_0x18c1('0xb6')](_0x18c1('0x40'))){_0x1f7202[_0x18c1('0x22')]=qs[_0x18c1('0x22')](_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x22')]);_0x1f7202['offset']=qs[_0x18c1('0x21')](_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x21')]);}_0x1f7202['order']=qs[_0x18c1('0x41')](_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x41')]);_0x1f7202[_0x18c1('0x73')]=qs[_0x18c1('0x3a')](_[_0x18c1('0x42')](_0x3859e3['query'],_0xfa917c[_0x18c1('0x3a')]));_0x1f7202['where'][_0x18c1('0xa3')]=_0x2b70e3['id'];if(_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x7e')]){_0x1f7202[_0x18c1('0x73')]=_[_0x18c1('0xab')](_0x1f7202[_0x18c1('0x73')],{'$or':_[_0x18c1('0x2b')](_0x1f7202[_0x18c1('0x3d')],function(_0xdead18){var _0x2bd104={};_0x2bd104[_0xdead18]={'$like':'%'+_0x3859e3[_0x18c1('0x3c')]['filter']+'%'};return _0x2bd104;})});}if(_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x77')]){var _0x375a84=_0x3859e3[_0x18c1('0x3c')][_0x18c1('0x77')][_0x18c1('0x2f')](',');var _0x4ad894={};_0x4ad894[_0x375a84[0x0]]={'$gte':moment(_0x375a84[0x1])['format'](_0x18c1('0xb7'))};_0x1f7202[_0x18c1('0x73')]=_[_0x18c1('0xab')](_0x1f7202[_0x18c1('0x73')],_0x4ad894);}_0x1f7202=_[_0x18c1('0xab')]({},_0x1f7202,_0x3859e3[_0x18c1('0xac')]);return db['FaxMessage']['count']({'where':_0x1f7202[_0x18c1('0x73')]})[_0x18c1('0x28')](function(_0x15269a){_0x187a2c[_0x18c1('0x8f')]=_0x15269a;if(_0x3859e3[_0x18c1('0x3c')]['includeAll']){_0x1f7202[_0x18c1('0xaa')]=[{'all':!![]}];}return db[_0x18c1('0xb0')][_0x18c1('0xb8')](_0x1f7202);})[_0x18c1('0x28')](function(_0x5e9883){_0x187a2c[_0x18c1('0xa5')]=_0x5e9883;return _0x187a2c;});}})['then'](respondWithFilteredResult(_0x2a1a91,_0x1f7202))['catch'](handleError(_0x2a1a91,null));};exports[_0x18c1('0xb9')]=function(_0x2caec6,_0xc57d61,_0x22183b){return db[_0x18c1('0x33')][_0x18c1('0x5b')]({'where':{'id':_0x2caec6[_0x18c1('0xa7')]['id']}})[_0x18c1('0x28')](handleEntityNotFound(_0xc57d61,null))[_0x18c1('0x28')](function(_0x4c8ef6){if(_0x4c8ef6){return _0x4c8ef6[_0x18c1('0xba')](_0x2caec6['body'][_0x18c1('0xb2')],_[_0x18c1('0xb3')](_0x2caec6[_0x18c1('0x6e')],['ids','id'])||{})[_0x18c1('0xbb')](function(){return db[_0x18c1('0x6a')][_0x18c1('0xb8')]({'attributes':['id',_0x18c1('0x38'),'color'],'where':{'id':_0x2caec6[_0x18c1('0x6e')]['ids']}});})[_0x18c1('0x28')](function(_0x4754a6){socket[_0x18c1('0xbc')]('faxInteractionTags:save',{'id':Number(_0x2caec6[_0x18c1('0xa7')]['id']),'tags':_0x4754a6||[]});return{'id':Number(_0x2caec6[_0x18c1('0xa7')]['id']),'tags':_0x4754a6||[]};});}})[_0x18c1('0x28')](respondWithResult(_0xc57d61,null))['catch'](handleError(_0xc57d61,null));};exports[_0x18c1('0xbd')]=function(_0x506a4d,_0x4b43f2,_0x1219a3){return db[_0x18c1('0x33')][_0x18c1('0x5b')]({'where':{'id':_0x506a4d[_0x18c1('0xa7')]['id']}})[_0x18c1('0x28')](handleEntityNotFound(_0x4b43f2,null))[_0x18c1('0x28')](function(_0x2c109e){if(_0x2c109e){return _0x2c109e['removeTags'](_0x506a4d[_0x18c1('0x3c')][_0x18c1('0xb2')]);}})[_0x18c1('0x28')](respondWithStatusCode(_0x4b43f2,null))[_0x18c1('0x32')](handleError(_0x4b43f2,null));};exports[_0x18c1('0xbe')]=function(_0x3b0d7c,_0x1b4329){var _0x750275=moment()[_0x18c1('0xbf')]()[_0x18c1('0x8e')]();var _0x96eeb6=path[_0x18c1('0xc0')](config['root'],_0x18c1('0xc1'),_0x18c1('0xc2'),_0x18c1('0xc3'));var _0x150014=path['join'](config['root'],'server',_0x18c1('0xc2'),'attachments');var _0x3d8f51=path[_0x18c1('0xc0')](_0x96eeb6,_0x750275);var _0x4599c5=util['format'](_0x18c1('0xc4'),_0x3b0d7c[_0x18c1('0xa7')]['id'],_0x750275);var _0x2e0a63=path['join'](_0x96eeb6,_0x4599c5);var _0x20bbc0=[];_0x20bbc0[_0x18c1('0x31')]({'model':db[_0x18c1('0xc5')],'as':_0x18c1('0xc5'),'raw':!![]});var _0x445309=[{'model':db[_0x18c1('0xb0')],'as':_0x18c1('0xc6'),'attributes':['id',_0x18c1('0x6e'),_0x18c1('0xc7')],'include':_0x20bbc0}];return db[_0x18c1('0x33')][_0x18c1('0x5b')]({'where':{'id':_0x3b0d7c[_0x18c1('0xa7')]['id']},'include':_0x445309})[_0x18c1('0x28')](handleEntityNotFound(_0x1b4329,null))[_0x18c1('0x28')](function(_0x47c6e1){if(_0x47c6e1&&_0x47c6e1[_0x18c1('0xc6')]){var _0x28c947=_0x47c6e1[_0x18c1('0xc8')]({'plain':!![]});fs[_0x18c1('0xc9')](_0x3d8f51);for(var _0x3ad190=0x0;_0x3ad190<_0x28c947[_0x18c1('0xc6')][_0x18c1('0x3f')];_0x3ad190++){var _0x21fbed=_0x28c947[_0x18c1('0xc6')][_0x3ad190][_0x18c1('0xc5')];if(_0x21fbed){var _0x3fc566=path['join'](_0x150014,_0x21fbed['basename']);if(fs[_0x18c1('0xca')](_0x3fc566)){fs[_0x18c1('0xcb')](_0x3fc566)['pipe'](fs[_0x18c1('0xcc')](path['join'](_0x3d8f51,_0x21fbed['basename'])));}}}return BPromise[_0x18c1('0xcd')]()[_0x18c1('0x28')](function(){return new BPromise(function(_0xc876eb,_0x419197){zipdir(_0x3d8f51,{'saveTo':_0x2e0a63},function(_0x5f4e9c,_0xfd1f4){if(_0x5f4e9c)return _0x419197(_0x5f4e9c);return _0xc876eb(_0xfd1f4);});})['then'](function(){return new BPromise(function(_0x366a32,_0x1e299d){rimraf(_0x3d8f51,function(_0x4c4a78){if(_0x4c4a78)_0x1e299d(_0x4c4a78);return _0x366a32();});});})[_0x18c1('0x28')](function(){return _0x1b4329[_0x18c1('0xbe')](_0x2e0a63,_0x4599c5,function(_0x12c706){if(_0x12c706){console['log'](_0x18c1('0xce'),_0x12c706);}else{fs[_0x18c1('0xcf')](_0x2e0a63);}});});});}else{return _0x1b4329[_0x18c1('0x29')](0xc8);}})[_0x18c1('0x32')](handleError(_0x1b4329,null));}; \ No newline at end of file +var _0x48ac=['root','attachments','Attachment','Messages','get','mkdirSync','basename','existsSync','createWriteStream','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','redis','defaults','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','Tags','TagIds','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','keys','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','where','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','ui.FaxInteractionId\x20IN\x20?','groupBy','all','show','params','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','pick','FaxInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','join','files','tmp'];(function(_0xd693d8,_0x2aecdd){var _0x4a9c52=function(_0x3f8d13){while(--_0x3f8d13){_0xd693d8['push'](_0xd693d8['shift']());}};_0x4a9c52(++_0x2aecdd);}(_0x48ac,0xe0));var _0xc48a=function(_0x35e659,_0x514435){_0x35e659=_0x35e659-0x0;var _0x2a7a08=_0x48ac[_0x35e659];return _0x2a7a08;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc48a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc48a('0x1'));var jsonpatch=require(_0xc48a('0x2'));var rp=require(_0xc48a('0x3'));var moment=require('moment');var BPromise=require(_0xc48a('0x4'));var Mustache=require(_0xc48a('0x5'));var util=require(_0xc48a('0x6'));var path=require(_0xc48a('0x7'));var sox=require(_0xc48a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc48a('0x9'));var jsforce=require(_0xc48a('0xa'));var deskjs=require(_0xc48a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc48a('0xc'));var Papa=require(_0xc48a('0xd'));var Redis=require(_0xc48a('0xe'));var authService=require(_0xc48a('0xf'));var qs=require(_0xc48a('0x10'));var as=require(_0xc48a('0x11'));var hardwareService=require(_0xc48a('0x12'));var logger=require(_0xc48a('0x13'))(_0xc48a('0x14'));var utils=require(_0xc48a('0x15'));var config=require(_0xc48a('0x16'));var db=require('../../mysqldb')['db'];config[_0xc48a('0x17')]=_[_0xc48a('0x18')](config[_0xc48a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc48a('0x19'))(new Redis(config[_0xc48a('0x17')]));require('./faxInteraction.socket')[_0xc48a('0x1a')](socket);function respondWithStatusCode(_0x250d63,_0x286f42){_0x286f42=_0x286f42||0xcc;return function(_0x4e0d3c){if(_0x4e0d3c){return _0x250d63[_0xc48a('0x1b')](_0x286f42);}return _0x250d63[_0xc48a('0x1c')](_0x286f42)[_0xc48a('0x1d')]();};}function respondWithResult(_0x50f232,_0x38abb3){_0x38abb3=_0x38abb3||0xc8;return function(_0x2172f5){if(_0x2172f5){return _0x50f232['status'](_0x38abb3)['json'](_0x2172f5);}};}function respondWithFilteredResult(_0x4d1dfa,_0x5c5291){return function(_0x632d0c){if(_0x632d0c){var _0x29a1ad=_0x632d0c[_0xc48a('0x1e')],_0x188549=_0x5c5291[_0xc48a('0x1f')],_0x462102=_0x5c5291['offset']+_0x5c5291[_0xc48a('0x20')],_0x25e389;if(_0x462102>=_0x29a1ad){_0x462102=_0x29a1ad;_0x25e389=0xc8;}else{_0x25e389=0xce;}_0x4d1dfa[_0xc48a('0x1c')](_0x25e389);return _0x4d1dfa['set'](_0xc48a('0x21'),_0x188549+'-'+_0x462102+'/'+_0x29a1ad)['json'](_0x632d0c);}return null;};}function patchUpdates(_0x2b7dfa){return function(_0x5a47d2){try{jsonpatch[_0xc48a('0x22')](_0x5a47d2,_0x2b7dfa,!![]);}catch(_0x382f69){return BPromise[_0xc48a('0x23')](_0x382f69);}return _0x5a47d2[_0xc48a('0x24')]();};}function saveUpdates(_0x2a3380,_0x3e24f5){return function(_0x248fdd){if(_0x248fdd){return _0x248fdd[_0xc48a('0x25')](_0x2a3380)[_0xc48a('0x26')](function(_0x3201bc){return _0x3201bc;});}return null;};}function removeEntity(_0x112874,_0x4bc55b){return function(_0x53fab0){if(_0x53fab0){return _0x53fab0[_0xc48a('0x27')]()[_0xc48a('0x26')](function(){_0x112874[_0xc48a('0x1c')](0xcc)[_0xc48a('0x1d')]();});}};}function handleEntityNotFound(_0x5b63aa,_0x5c5d61){return function(_0x34cad3){if(!_0x34cad3){_0x5b63aa[_0xc48a('0x1b')](0x194);}return _0x34cad3;};}function handleError(_0x20709c,_0x4ecdaf){_0x4ecdaf=_0x4ecdaf||0x1f4;return function(_0x11c94a){logger[_0xc48a('0x28')](_0x11c94a[_0xc48a('0x29')]);if(_0x11c94a[_0xc48a('0x2a')]){delete _0x11c94a[_0xc48a('0x2a')];}_0x20709c[_0xc48a('0x1c')](_0x4ecdaf)[_0xc48a('0x2b')](_0x11c94a);};}function getInteractionUsers(_0x335532,_0x3b75db){return new BPromise(function(_0x45747f,_0x5da24d){try{if(_0x3b75db[_0x335532['id']]){_0x335532['Users']=_[_0xc48a('0x2c')](_0x3b75db[_0x335532['id']],function(_0x4bc1f3){return{'id':_0x4bc1f3['id'],'fullname':_0x4bc1f3[_0xc48a('0x2d')]};});}}catch(_0x10e450){_0x5da24d(_0x10e450);}_0x45747f(_0x335532);});}function getInteractionTags(_0x5ae94f,_0x2f69c7){return new BPromise(function(_0x2ab3e1,_0x22e62a){try{if(_0x5ae94f['TagIds']){_0x5ae94f[_0xc48a('0x2e')]=[];_0x5ae94f[_0xc48a('0x2f')]['split'](',')[_0xc48a('0x30')](function(_0x3f1bef){_0x5ae94f[_0xc48a('0x2e')][_0xc48a('0x31')](_0x2f69c7[_0x3f1bef]);});}delete _0x5ae94f[_0xc48a('0x2f')];}catch(_0x4cc11b){_0x22e62a(_0x4cc11b);}_0x2ab3e1(_0x5ae94f);});}function updateFaxInteraction(_0x23877e,_0x2c93f9,_0x2c6cbd){return new BPromise(function(_0x2ad597,_0x3557e6){return getInteractionUsers(_0x23877e,_0x2c6cbd)[_0xc48a('0x26')](function(_0x37959e){return getInteractionTags(_0x37959e,_0x2c93f9);})[_0xc48a('0x26')](function(_0x57d803){_0x2ad597(_0x57d803);})[_0xc48a('0x32')](function(_0x341b51){_0x3557e6(_0x341b51);});});}exports[_0xc48a('0x33')]=function(_0x47c6e8,_0x3e2568){var _0x35c259={},_0x4447c4={},_0x52b449={'count':0x0,'rows':[]};var _0x248e92=_[_0xc48a('0x2c')](db[_0xc48a('0x34')][_0xc48a('0x35')],function(_0x5473c1){return{'name':_0x5473c1[_0xc48a('0x36')],'type':_0x5473c1[_0xc48a('0x37')]['key']};});_0x4447c4[_0xc48a('0x38')]=_['map'](_0x248e92,_0xc48a('0x2a'));_0x4447c4['query']=_['keys'](_0x47c6e8[_0xc48a('0x39')]);_0x4447c4[_0xc48a('0x3a')]=_['intersection'](_0x4447c4[_0xc48a('0x38')],_0x4447c4[_0xc48a('0x39')]);_0x35c259[_0xc48a('0x3b')]=_[_0xc48a('0x3c')](_0x4447c4['model'],qs[_0xc48a('0x3d')](_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x3d')]));_0x35c259[_0xc48a('0x3b')]=_0x35c259['attributes'][_0xc48a('0x3e')]?_0x35c259['attributes']:_0x4447c4[_0xc48a('0x38')];if(!_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x3f')](_0xc48a('0x40'))){_0x35c259[_0xc48a('0x20')]=qs[_0xc48a('0x20')](_0x47c6e8['query'][_0xc48a('0x20')]);_0x35c259[_0xc48a('0x1f')]=qs[_0xc48a('0x1f')](_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x1f')]);}_0x35c259['order']=qs[_0xc48a('0x41')](_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x41')]);_0x35c259['where']=qs[_0xc48a('0x3a')](_['pick'](_0x47c6e8['query'],_0x4447c4[_0xc48a('0x3a')]),_0x248e92);var _0x4631f3=[];var _0x32d7e3=squel[_0xc48a('0x42')]()[_0xc48a('0x43')]('id')[_0xc48a('0x43')](_0xc48a('0x2a'))['field']('color')['from'](_0xc48a('0x44'));var _0x39bae2=squel[_0xc48a('0x42')]()[_0xc48a('0x43')](_0xc48a('0x45'))[_0xc48a('0x43')](_0xc48a('0x46'))[_0xc48a('0x43')](_0xc48a('0x47'))[_0xc48a('0x48')](_0xc48a('0x49'),'ui')['left_join'](_0xc48a('0x4a'),'u',_0xc48a('0x4b'));var _0x2a6838=squel[_0xc48a('0x42')]()[_0xc48a('0x48')](_0xc48a('0x4c'),'i')[_0xc48a('0x4d')](_0xc48a('0x4e'),'c',_0xc48a('0x4f'))['left_join'](_0xc48a('0x4a'),'o',_0xc48a('0x50'))[_0xc48a('0x4d')](_0xc48a('0x51'),'a','a.id\x20=\x20i.FaxAccountId')[_0xc48a('0x4d')](_0xc48a('0x52'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xc48a('0x4d')](_0xc48a('0x53'),'it',_0xc48a('0x54'))[_0xc48a('0x4d')]('tools_tags','t',_0xc48a('0x55'));var _0xd0dc5=squel[_0xc48a('0x56')]();var _0x114f12=[];var _0x50eeef=squel['expr']();var _0x4f16e9;if(_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x57')]){_0x4f16e9=as['parseSearch'](_0x47c6e8[_0xc48a('0x39')]['search']);var _0x34e30d=_0x4f16e9[_0xc48a('0x58')];for(var _0x36b072=0x0;_0x36b072<_0x4f16e9[_0xc48a('0x59')][_0xc48a('0x3e')];_0x36b072++){var _0x1fdb76=_0x4f16e9[_0xc48a('0x59')][_0x36b072];var _0x15d839='i';var _0x337a4e=_['find'](_0x248e92,[_0xc48a('0x2a'),_0x1fdb76['field']]);if(!_0x337a4e){switch(_0x1fdb76[_0xc48a('0x43')]){case _0xc48a('0x5a'):if(_0x1fdb76[_0xc48a('0x5b')]==0x1){_0x2a6838[_0xc48a('0x5c')]('`'+_0x1fdb76[_0xc48a('0x43')]+'`\x20=\x200');}else{_0x2a6838[_0xc48a('0x5c')]('`'+_0x1fdb76['field']+_0xc48a('0x5d'));}break;case _0xc48a('0x5e'):if(_0x1fdb76[_0xc48a('0x5f')]===_0xc48a('0x60')){if(_0x1fdb76[_0xc48a('0x5b')][_0xc48a('0x61')]('\x20')['length']>0x1){_0xd0dc5[_0x34e30d](_0xc48a('0x62'),qs[_0xc48a('0x63')](_0x1fdb76[_0xc48a('0x5b')]),null);}else{var _0x5bfe3e='%'+_0x1fdb76[_0xc48a('0x5b')]+'%';_0xd0dc5[_0x34e30d](_0xc48a('0x64'),_0x5bfe3e,_0x5bfe3e,_0x5bfe3e);}}else{_0x337a4e=_[_0xc48a('0x65')](_0x248e92,['name',_0xc48a('0x66')]);_0x1fdb76['field']=_0xc48a('0x66');_0x440207=as['buildExpression'](_0x15d839,_0x337a4e[_0xc48a('0x37')],_0x1fdb76);_0xd0dc5[_0x34e30d](_0x440207[_0xc48a('0x67')],_0x440207[_0xc48a('0x5b')][_0xc48a('0x68')],_0x440207[_0xc48a('0x5b')][_0xc48a('0x1d')]);}break;case _0xc48a('0x69'):var _0x22414c=_0x1fdb76[_0xc48a('0x5b')]['split'](',')['map'](function(_0xe5ff65){return Number(_0xe5ff65);});_0x22414c['forEach'](function(_0x46d7bf){_0x50eeef['or'](_0xc48a('0x6a'),'%,'+_0x46d7bf+',%');});_0x114f12=_[_0xc48a('0x6b')](_0x114f12,_0x22414c);break;case _0xc48a('0x6c'):if(_0x1fdb76['operator']==='$substring'){_0xd0dc5[_0x34e30d](_0xc48a('0x6d'),'%'+_0x1fdb76[_0xc48a('0x5b')]+'%',null);}else{_0x337a4e=_[_0xc48a('0x65')](_0x248e92,[_0xc48a('0x2a'),'UserId']);_0x1fdb76[_0xc48a('0x43')]=_0xc48a('0x6e');_0x440207=as['buildExpression'](_0x15d839,_0x337a4e[_0xc48a('0x37')],_0x1fdb76);_0xd0dc5[_0x34e30d](_0x440207[_0xc48a('0x67')],_0x440207[_0xc48a('0x5b')][_0xc48a('0x68')],_0x440207[_0xc48a('0x5b')][_0xc48a('0x1d')]);}break;case _0xc48a('0x6f'):_0x440207=as[_0xc48a('0x70')]('me',null,_0x1fdb76);_0xd0dc5[_0x34e30d](_0x440207[_0xc48a('0x67')],_0x440207['value']['start'],_0x440207[_0xc48a('0x5b')][_0xc48a('0x1d')]);break;}}else{var _0x440207=as[_0xc48a('0x70')](_0x15d839,_0x337a4e[_0xc48a('0x37')],_0x1fdb76);_0xd0dc5[_0x34e30d](_0x440207[_0xc48a('0x67')],_0x440207[_0xc48a('0x5b')]['start'],_0x440207[_0xc48a('0x5b')][_0xc48a('0x1d')]);}}}else{var _0x2256f5=_(_0x47c6e8[_0xc48a('0x39')])[_0xc48a('0x71')]()[_0xc48a('0x2c')](function(_0x79ba65){return _['some'](_0x248e92,[_0xc48a('0x2a'),_0x79ba65])?_0x79ba65:undefined;})[_0xc48a('0x72')]()['value']();if(!_[_0xc48a('0x73')](_0x2256f5)){_0x2256f5[_0xc48a('0x30')](function(_0x1968c7){if(_0x1968c7===_0xc48a('0x74')){_0x2a6838['where'](_0xc48a('0x75'),[][_0xc48a('0x76')](_0x47c6e8[_0xc48a('0x39')][_0x1968c7]));}else if(_0x1968c7===_0xc48a('0x77')){var _0x35a792=JSON[_0xc48a('0x78')](_0x47c6e8[_0xc48a('0x39')][_0x1968c7])['$gte'];var _0x133863=JSON[_0xc48a('0x78')](_0x47c6e8[_0xc48a('0x39')][_0x1968c7])[_0xc48a('0x79')];_0x2a6838[_0xc48a('0x7a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x35a792,_0x133863);}else{if(_0x47c6e8[_0xc48a('0x39')][_0x1968c7]===_0xc48a('0x7b')){_0x2a6838['where']('i.'+_0x1968c7+_0xc48a('0x7c'));}else{_0x2a6838['where']('i.'+_0x1968c7+_0xc48a('0x7d'),_0x47c6e8[_0xc48a('0x39')][_0x1968c7]);}}});}if(_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x7e')]){if(_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x7e')]==0x1){_0x2a6838['having']('`unreadMessages`\x20=\x200');}else{_0x2a6838[_0xc48a('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x7f')]){_0x114f12=_[_0xc48a('0x80')](_0x47c6e8[_0xc48a('0x39')]['tag'])?_0x47c6e8['query']['tag']:new Array(_0x47c6e8['query']['tag']);_0x114f12[_0xc48a('0x30')](function(_0x5a2232){_0x50eeef['or'](_0xc48a('0x6a'),'%,'+_0x5a2232+',%');});}if(_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x81')]){var _0x25f3f3=_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x81')][_0xc48a('0x82')]('\x5c','\x5c\x5c')[_0xc48a('0x82')]('\x27\x27',_0xc48a('0x83'));if(qs[_0xc48a('0x84')](_0x25f3f3)){_0xd0dc5['or'](_0xc48a('0x85'),_0x25f3f3+'%')['or'](_0xc48a('0x86'),_0x25f3f3+'%');}_0xd0dc5['or'](_0xc48a('0x87'),_0x25f3f3+'%');}}_0x2a6838[_0xc48a('0x7a')](_0xd0dc5);_0x2a6838[_0xc48a('0x88')](_0xc48a('0x89'));var _0x22bd82={'type':db[_0xc48a('0x8a')][_0xc48a('0x8b')][_0xc48a('0x8c')],'raw':!![]};var _0x462c8f=_0x2a6838[_0xc48a('0x8d')]();_0x462c8f[_0xc48a('0x43')](_0xc48a('0x89'));_0x462c8f[_0xc48a('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x35c259[_0xc48a('0x8e')]){_0x35c259[_0xc48a('0x8e')]['forEach'](function(_0x172cf4){_0x2a6838['order']('i.'+_0x172cf4[0x0],_0x172cf4[0x1]===_0xc48a('0x8f')?![]:!![]);});}if(!_[_0xc48a('0x73')](_0x114f12)){_0x2a6838[_0xc48a('0x5c')](_0x50eeef);_0x462c8f[_0xc48a('0x7a')](_0xc48a('0x90'),_0x114f12);}BPromise[_0xc48a('0x91')]()[_0xc48a('0x26')](function(){if(!_0x4f16e9){if(_0x47c6e8[_0xc48a('0x39')]['FaxAccountId']||_0x47c6e8[_0xc48a('0x39')]['journey'])return;_0x462c8f['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2a6838['where'](_0xc48a('0x92'));return;}return _0x47c6e8[_0xc48a('0x93')][_0xc48a('0x94')]({'attributes':['id'],'raw':!![]})[_0xc48a('0x26')](function(_0x2653c0){if(_[_0xc48a('0x73')](_0x2653c0)){_0x462c8f['where']('i.FaxAccountId\x20IS\x20NULL');_0x2a6838[_0xc48a('0x7a')](_0xc48a('0x95'));}else{_0x462c8f[_0xc48a('0x7a')](_0xc48a('0x75'),_[_0xc48a('0x2c')](_0x2653c0,'id'));_0x2a6838['where'](_0xc48a('0x75'),_[_0xc48a('0x2c')](_0x2653c0,'id'));}});})[_0xc48a('0x26')](function(){db['sequelize'][_0xc48a('0x39')](_0x462c8f[_0xc48a('0x96')](),_0x22bd82)[_0xc48a('0x26')](function(_0x1acb61){_0x52b449['count']=_0x1acb61[_0xc48a('0x3e')];if(_0x52b449[_0xc48a('0x1e')]===0x0)return[];return db[_0xc48a('0x97')][_0xc48a('0x39')](_0x32d7e3[_0xc48a('0x96')](),_0x22bd82)[_0xc48a('0x26')](function(_0x3cc2a9){_0x4631f3=_[_0xc48a('0x98')](_0x3cc2a9,'id');_0x22bd82=_[_0xc48a('0x99')](_0x22bd82,{'model':db[_0xc48a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47c6e8[_0xc48a('0x39')][_0xc48a('0x3d')]){_0x35c259['attributes'][_0xc48a('0x30')](function(_0x53d9f3){_0x2a6838[_0xc48a('0x43')]('i.'+_0x53d9f3);});}else{_0x2a6838[_0xc48a('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2a6838[_0xc48a('0x43')](_0xc48a('0x9a'),'Account.key');_0x2a6838[_0xc48a('0x43')](_0xc48a('0x9b'),_0xc48a('0x9c'));_0x2a6838[_0xc48a('0x43')](_0xc48a('0x9d'));_0x2a6838['field'](_0xc48a('0x9e'),_0xc48a('0x9f'));_0x2a6838['field'](_0xc48a('0xa0'),_0xc48a('0xa1'));_0x2a6838[_0xc48a('0x43')](_0xc48a('0xa2'),_0xc48a('0xa3'));_0x2a6838[_0xc48a('0x43')](_0xc48a('0xa4'),'Contact.phone');_0x2a6838['field'](_0xc48a('0xa5'),_0xc48a('0xa6'));_0x2a6838[_0xc48a('0x43')](_0xc48a('0xa7'),_0xc48a('0xa8'));_0x2a6838['field']('o.fullname',_0xc48a('0xa9'));_0x2a6838['field']('o.internal','Owner.internal');_0x2a6838['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc48a('0x2f'));}if(_0x35c259['limit'])_0x2a6838[_0xc48a('0x20')](_0x35c259[_0xc48a('0x20')]);if(_0x35c259[_0xc48a('0x1f')])_0x2a6838[_0xc48a('0x1f')](_0x35c259['offset']);return db[_0xc48a('0x97')]['query'](_0x2a6838['toString'](),_0x22bd82);})[_0xc48a('0x26')](function(_0xf4651b){_0x39bae2[_0xc48a('0x7a')](_0xc48a('0xaa'),_[_0xc48a('0x2c')](_0xf4651b,'id'));return db[_0xc48a('0x97')]['query'](_0x39bae2[_0xc48a('0x96')](),_0x22bd82)[_0xc48a('0x26')](function(_0x5d13c4){var _0x184fe0=_[_0xc48a('0xab')](_0x5d13c4,'FaxInteractionId');var _0x4c1590=[];_0xf4651b[_0xc48a('0x30')](function(_0x4e3f63){_0x4c1590[_0xc48a('0x31')](updateFaxInteraction(_0x4e3f63,_0x4631f3,_0x184fe0));});return BPromise[_0xc48a('0xac')](_0x4c1590);});});})[_0xc48a('0x26')](function(_0x55968c){_0x52b449['rows']=_0x55968c;return _0x52b449;})[_0xc48a('0x26')](respondWithFilteredResult(_0x3e2568,_0x35c259));})[_0xc48a('0x32')](handleError(_0x3e2568,null));};exports[_0xc48a('0xad')]=function(_0x4534ae,_0x3d362c){var _0x4c8cac={'raw':![],'where':{'id':_0x4534ae[_0xc48a('0xae')]['id']}},_0x237038={};_0x237038[_0xc48a('0x38')]=_[_0xc48a('0x71')](db['FaxInteraction'][_0xc48a('0x35')]);_0x237038[_0xc48a('0x39')]=_[_0xc48a('0x71')](_0x4534ae['query']);_0x237038[_0xc48a('0x3a')]=_[_0xc48a('0x3c')](_0x237038['model'],_0x237038[_0xc48a('0x39')]);_0x4c8cac[_0xc48a('0x3b')]=_[_0xc48a('0x3c')](_0x237038[_0xc48a('0x38')],qs[_0xc48a('0x3d')](_0x4534ae[_0xc48a('0x39')]['fields']));_0x4c8cac[_0xc48a('0x3b')]=_0x4c8cac[_0xc48a('0x3b')]['length']?_0x4c8cac[_0xc48a('0x3b')]:_0x237038['model'];if(_0x4534ae[_0xc48a('0x39')]['includeAll']){_0x4c8cac[_0xc48a('0xaf')]=[{'all':!![]}];}_0x4c8cac=_[_0xc48a('0x99')]({},_0x4c8cac,_0x4534ae[_0xc48a('0xb0')]);return db['FaxInteraction'][_0xc48a('0x65')](_0x4c8cac)[_0xc48a('0x26')](handleEntityNotFound(_0x3d362c,null))['then'](respondWithResult(_0x3d362c,null))[_0xc48a('0x32')](handleError(_0x3d362c,null));};exports[_0xc48a('0xb1')]=function(_0x4394ea,_0x5c6731){return db[_0xc48a('0x34')]['create'](_0x4394ea[_0xc48a('0x6f')],{})[_0xc48a('0x26')](respondWithResult(_0x5c6731,0xc9))[_0xc48a('0x32')](handleError(_0x5c6731,null));};exports[_0xc48a('0x25')]=function(_0x55b884,_0x34e14b){if(_0x55b884[_0xc48a('0x6f')]['id']){delete _0x55b884[_0xc48a('0x6f')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x55b884[_0xc48a('0xae')]['id']}})[_0xc48a('0x26')](handleEntityNotFound(_0x34e14b,null))[_0xc48a('0x26')](saveUpdates(_0x55b884['body'],null))[_0xc48a('0x26')](respondWithResult(_0x34e14b,null))[_0xc48a('0x32')](handleError(_0x34e14b,null));};exports[_0xc48a('0x27')]=function(_0x387034,_0x3c8b22){return db['FaxInteraction'][_0xc48a('0x65')]({'where':{'id':_0x387034[_0xc48a('0xae')]['id']}})['then'](handleEntityNotFound(_0x3c8b22,null))[_0xc48a('0x26')](removeEntity(_0x3c8b22,null))[_0xc48a('0x32')](handleError(_0x3c8b22,null));};exports[_0xc48a('0xb2')]=function(_0x1e5a74,_0x59014e){return db['FaxInteraction'][_0xc48a('0xb2')]()['then'](respondWithResult(_0x59014e,null))[_0xc48a('0x32')](handleError(_0x59014e,null));};exports[_0xc48a('0xb3')]=function(_0x221a0d,_0x21825c,_0x4a6c7f){return db[_0xc48a('0xb4')][_0xc48a('0x65')]({'where':{'id':_0x221a0d[_0xc48a('0xae')]['id']}})['then'](handleEntityNotFound(_0x21825c,null))[_0xc48a('0x26')](function(_0x365d6f){if(_0x365d6f){return _0x365d6f['addMessage'](_0x221a0d[_0xc48a('0x6f')][_0xc48a('0xb5')],_[_0xc48a('0xb6')](_0x221a0d[_0xc48a('0x6f')],['ids','id'])||{});}})[_0xc48a('0x26')](respondWithResult(_0x21825c,null))['catch'](handleError(_0x21825c,null));};exports[_0xc48a('0xb7')]=function(_0x5e4052,_0xef56e1,_0x57641d){var _0x30ce1c={'raw':![],'where':{}};var _0x5a0577={};var _0x47bed9={'count':0x0,'rows':[]};return db[_0xc48a('0x34')][_0xc48a('0xb8')]({'where':{'id':_0x5e4052[_0xc48a('0xae')]['id']}})[_0xc48a('0x26')](handleEntityNotFound(_0xef56e1,null))[_0xc48a('0x26')](function(_0x5cbac9){if(_0x5cbac9){_0x5a0577[_0xc48a('0x38')]=_['keys'](db[_0xc48a('0xb4')][_0xc48a('0x35')]);_0x5a0577['query']=_[_0xc48a('0x71')](_0x5e4052[_0xc48a('0x39')]);_0x5a0577[_0xc48a('0x3a')]=_[_0xc48a('0x3c')](_0x5a0577['model'],_0x5a0577['query']);_0x30ce1c[_0xc48a('0x3b')]=_['intersection'](_0x5a0577['model'],qs[_0xc48a('0x3d')](_0x5e4052[_0xc48a('0x39')][_0xc48a('0x3d')]));_0x30ce1c['attributes']=_0x30ce1c[_0xc48a('0x3b')]['length']?_0x30ce1c[_0xc48a('0x3b')]:_0x5a0577[_0xc48a('0x38')];if(!_0x5e4052[_0xc48a('0x39')][_0xc48a('0x3f')](_0xc48a('0x40'))){_0x30ce1c[_0xc48a('0x20')]=qs[_0xc48a('0x20')](_0x5e4052['query'][_0xc48a('0x20')]);_0x30ce1c['offset']=qs[_0xc48a('0x1f')](_0x5e4052[_0xc48a('0x39')]['offset']);}_0x30ce1c['order']=qs[_0xc48a('0x41')](_0x5e4052['query'][_0xc48a('0x41')]);_0x30ce1c[_0xc48a('0x7a')]=qs[_0xc48a('0x3a')](_[_0xc48a('0xb9')](_0x5e4052['query'],_0x5a0577['filters']));_0x30ce1c[_0xc48a('0x7a')][_0xc48a('0xba')]=_0x5cbac9['id'];if(_0x5e4052['query'][_0xc48a('0x81')]){_0x30ce1c[_0xc48a('0x7a')]=_['merge'](_0x30ce1c[_0xc48a('0x7a')],{'$or':_['map'](_0x30ce1c['attributes'],function(_0x36fc0b){var _0x3cf566={};_0x3cf566[_0x36fc0b]={'$like':'%'+_0x5e4052[_0xc48a('0x39')]['filter']+'%'};return _0x3cf566;})});}if(_0x5e4052[_0xc48a('0x39')][_0xc48a('0xbb')]){var _0x5de0b1=_0x5e4052[_0xc48a('0x39')]['$gte'][_0xc48a('0x61')](',');var _0x2606e1={};_0x2606e1[_0x5de0b1[0x0]]={'$gte':moment(_0x5de0b1[0x1])['format'](_0xc48a('0xbc'))};_0x30ce1c[_0xc48a('0x7a')]=_[_0xc48a('0x99')](_0x30ce1c[_0xc48a('0x7a')],_0x2606e1);}_0x30ce1c=_[_0xc48a('0x99')]({},_0x30ce1c,_0x5e4052[_0xc48a('0xb0')]);return db['FaxMessage'][_0xc48a('0x1e')]({'where':_0x30ce1c['where']})['then'](function(_0x2fabb0){_0x47bed9['count']=_0x2fabb0;if(_0x5e4052['query'][_0xc48a('0xbd')]){_0x30ce1c['include']=[{'all':!![]}];}return db[_0xc48a('0xb4')][_0xc48a('0xbe')](_0x30ce1c);})['then'](function(_0x37b854){_0x47bed9[_0xc48a('0xbf')]=_0x37b854;return _0x47bed9;});}})[_0xc48a('0x26')](respondWithFilteredResult(_0xef56e1,_0x30ce1c))[_0xc48a('0x32')](handleError(_0xef56e1,null));};exports[_0xc48a('0xc0')]=function(_0x20cc4a,_0x5e7333,_0x5e9fe4){return db[_0xc48a('0x34')]['find']({'where':{'id':_0x20cc4a[_0xc48a('0xae')]['id']}})[_0xc48a('0x26')](handleEntityNotFound(_0x5e7333,null))[_0xc48a('0x26')](function(_0x2d3dbc){if(_0x2d3dbc){return _0x2d3dbc[_0xc48a('0xc1')](_0x20cc4a[_0xc48a('0x6f')]['ids'],_[_0xc48a('0xb6')](_0x20cc4a[_0xc48a('0x6f')],[_0xc48a('0xb5'),'id'])||{})[_0xc48a('0xc2')](function(){return db[_0xc48a('0x69')][_0xc48a('0xbe')]({'attributes':['id','name',_0xc48a('0xc3')],'where':{'id':_0x20cc4a[_0xc48a('0x6f')][_0xc48a('0xb5')]}});})['then'](function(_0x5eb646){socket[_0xc48a('0xc4')](_0xc48a('0xc5'),{'id':Number(_0x20cc4a['params']['id']),'tags':_0x5eb646||[]});return{'id':Number(_0x20cc4a[_0xc48a('0xae')]['id']),'tags':_0x5eb646||[]};});}})['then'](respondWithResult(_0x5e7333,null))[_0xc48a('0x32')](handleError(_0x5e7333,null));};exports[_0xc48a('0xc6')]=function(_0xe77416,_0x42b6d8,_0x129fb2){return db[_0xc48a('0x34')][_0xc48a('0x65')]({'where':{'id':_0xe77416[_0xc48a('0xae')]['id']}})[_0xc48a('0x26')](handleEntityNotFound(_0x42b6d8,null))[_0xc48a('0x26')](function(_0x71de06){if(_0x71de06){return _0x71de06[_0xc48a('0xc6')](_0xe77416[_0xc48a('0x39')][_0xc48a('0xb5')]);}})['then'](respondWithStatusCode(_0x42b6d8,null))[_0xc48a('0x32')](handleError(_0x42b6d8,null));};exports['download']=function(_0x368f3d,_0x227fa6){var _0x19d15d=moment()['unix']()[_0xc48a('0x96')]();var _0x1f66bc=path[_0xc48a('0xc7')](config['root'],'server',_0xc48a('0xc8'),_0xc48a('0xc9'));var _0x26d968=path['join'](config[_0xc48a('0xca')],'server',_0xc48a('0xc8'),_0xc48a('0xcb'));var _0x1f4ebe=path['join'](_0x1f66bc,_0x19d15d);var _0x1f2b88=util['format']('transcript-%d-%s.zip',_0x368f3d[_0xc48a('0xae')]['id'],_0x19d15d);var _0x4c3d33=path[_0xc48a('0xc7')](_0x1f66bc,_0x1f2b88);var _0x5bd4a6=[];_0x5bd4a6['push']({'model':db[_0xc48a('0xcc')],'as':'Attachment','raw':!![]});var _0x25b47a=[{'model':db[_0xc48a('0xb4')],'as':_0xc48a('0xcd'),'attributes':['id',_0xc48a('0x6f'),_0xc48a('0x77')],'include':_0x5bd4a6}];return db['FaxInteraction'][_0xc48a('0x65')]({'where':{'id':_0x368f3d['params']['id']},'include':_0x25b47a})[_0xc48a('0x26')](handleEntityNotFound(_0x227fa6,null))[_0xc48a('0x26')](function(_0x2d14fa){if(_0x2d14fa&&_0x2d14fa['Messages']){var _0x3a0a07=_0x2d14fa[_0xc48a('0xce')]({'plain':!![]});fs[_0xc48a('0xcf')](_0x1f4ebe);for(var _0x4d91bd=0x0;_0x4d91bd<_0x3a0a07[_0xc48a('0xcd')]['length'];_0x4d91bd++){var _0x3e9b23=_0x3a0a07[_0xc48a('0xcd')][_0x4d91bd][_0xc48a('0xcc')];if(_0x3e9b23){var _0x45f853=path['join'](_0x26d968,_0x3e9b23[_0xc48a('0xd0')]);if(fs[_0xc48a('0xd1')](_0x45f853)){fs['createReadStream'](_0x45f853)['pipe'](fs[_0xc48a('0xd2')](path[_0xc48a('0xc7')](_0x1f4ebe,_0x3e9b23[_0xc48a('0xd0')])));}}}return BPromise[_0xc48a('0x91')]()['then'](function(){return new BPromise(function(_0x4171e1,_0x29b681){zipdir(_0x1f4ebe,{'saveTo':_0x4c3d33},function(_0x19c73a,_0x40d5c5){if(_0x19c73a)return _0x29b681(_0x19c73a);return _0x4171e1(_0x40d5c5);});})[_0xc48a('0x26')](function(){return new BPromise(function(_0x31ba81,_0x3b0827){rimraf(_0x1f4ebe,function(_0x1707e8){if(_0x1707e8)_0x3b0827(_0x1707e8);return _0x31ba81();});});})[_0xc48a('0x26')](function(){return _0x227fa6['download'](_0x4c3d33,_0x1f2b88,function(_0x52073f){if(_0x52073f){console[_0xc48a('0xd3')]('err',_0x52073f);}else{fs[_0xc48a('0xd4')](_0x4c3d33);}});});});}else{return _0x227fa6[_0xc48a('0x1b')](0xc8);}})[_0xc48a('0x32')](handleError(_0x227fa6,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0e46740..ad435d5 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x3dd5ca,_0x45cc3d){var _0x5d21ab=function(_0x4fd470){while(--_0x4fd470){_0x3dd5ca['push'](_0x3dd5ca['shift']());}};_0x5d21ab(++_0x45cc3d);}(_0x326f,0xd1));var _0xf326=function(_0x42877e,_0x6b7c35){_0x42877e=_0x42877e-0x0;var _0x272f88=_0x326f[_0x42877e];return _0x272f88;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x475de2,_0x371dc3){var _0x156382=function(_0x4b38dd){while(--_0x4b38dd){_0x475de2['push'](_0x475de2['shift']());}};_0x156382(++_0x371dc3);}(_0x1261,0x144));var _0x1126=function(_0x3246a6,_0x2a685a){_0x3246a6=_0x3246a6-0x0;var _0x1df64d=_0x1261[_0x3246a6];return _0x1df64d;};'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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 3efb3b3..a2f0d5d 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 _0x41bb=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','fax_interactions','changed','closed','closedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41bb,0xc5));var _0xb41b=function(_0xfd51ea,_0x148306){_0xfd51ea=_0xfd51ea-0x0;var _0x3a0ff3=_0x41bb[_0xfd51ea];return _0x3a0ff3;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('FaxInteraction',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29c30d,_0x53722a,_0x13d44e){if(_0x29c30d[_0xb41b('0xa')](_0xb41b('0xb'))){_0x29c30d[_0xb41b('0xc')]=moment()[_0xb41b('0xd')](_0xb41b('0xe'));}_0x13d44e(null,_0x29c30d);}}});}; \ No newline at end of file +var _0xee5b=['exports','define','changed','closed','closedAt','format','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3e5113,_0x1d0439){var _0x5dab11=function(_0x2e78ea){while(--_0x2e78ea){_0x3e5113['push'](_0x3e5113['shift']());}};_0x5dab11(++_0x1d0439);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3fa5b4,_0x56e336){_0x3fa5b4=_0x3fa5b4-0x0;var _0x574e2d=_0xee5b[_0x3fa5b4];return _0x574e2d;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53d5b9,_0x5baf5c,_0x5536bd){if(_0x53d5b9[_0xbee5('0x9')](_0xbee5('0xa'))){_0x53d5b9[_0xbee5('0xb')]=moment()[_0xbee5('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5536bd(null,_0x53d5b9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3e1490b..d7939ea 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 _0x6952=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxInteraction','update','body','options','raw','attributes','limit','UpdateFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','moment'];(function(_0x3e42b9,_0x35971e){var _0x3fa173=function(_0x36f004){while(--_0x36f004){_0x3e42b9['push'](_0x3e42b9['shift']());}};_0x3fa173(++_0x35971e);}(_0x6952,0x1b6));var _0x2695=function(_0x3576b5,_0x1dd549){_0x3576b5=_0x3576b5-0x0;var _0x4425b1=_0x6952[_0x3576b5];return _0x4425b1;};'use strict';var _=require(_0x2695('0x0'));var util=require('util');var moment=require(_0x2695('0x1'));var BPromise=require('bluebird');var rs=require(_0x2695('0x2'));var fs=require('fs');var Redis=require(_0x2695('0x3'));var db=require(_0x2695('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2695('0x5'))(_0x2695('0x6'));var config=require(_0x2695('0x7'));var jayson=require(_0x2695('0x8'));var client=jayson[_0x2695('0x9')][_0x2695('0xa')]({'port':0x232a});config[_0x2695('0xb')]=_[_0x2695('0xc')](config[_0x2695('0xb')],{'host':_0x2695('0xd'),'port':0x18eb});var socket=require(_0x2695('0xe'))(new Redis(config[_0x2695('0xb')]));require(_0x2695('0xf'))[_0x2695('0x10')](socket);function respondWithRpcPromise(_0x37dfb3,_0xb9500f,_0x2e2a59){return new BPromise(function(_0x1cfd00,_0x1f58c6){return client[_0x2695('0x11')](_0x37dfb3,_0x2e2a59)[_0x2695('0x12')](function(_0x421f73){logger[_0x2695('0x13')](_0x2695('0x14'),_0xb9500f,_0x2695('0x15'));logger[_0x2695('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xb9500f,_0x2695('0x15'),JSON[_0x2695('0x17')](_0x421f73));if(_0x421f73['error']){if(_0x421f73[_0x2695('0x18')][_0x2695('0x19')]===0x1f4){logger[_0x2695('0x18')](_0x2695('0x14'),_0xb9500f,_0x421f73[_0x2695('0x18')][_0x2695('0x1a')]);return _0x1f58c6(_0x421f73[_0x2695('0x18')]['message']);}logger['error'](_0x2695('0x14'),_0xb9500f,_0x421f73[_0x2695('0x18')][_0x2695('0x1a')]);return _0x1cfd00(_0x421f73['error'][_0x2695('0x1a')]);}else{logger[_0x2695('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb9500f,_0x2695('0x15'));_0x1cfd00(_0x421f73[_0x2695('0x1b')][_0x2695('0x1a')]);}})[_0x2695('0x1c')](function(_0x10d6b6){logger[_0x2695('0x18')](_0x2695('0x14'),_0xb9500f,_0x10d6b6);_0x1f58c6(_0x10d6b6);});});}exports['UpdateFaxInteraction']=function(_0x9c989){var _0x3f14c0=this;return new Promise(function(_0x3a58ec,_0x335a45){return db[_0x2695('0x1d')][_0x2695('0x1e')](_0x9c989[_0x2695('0x1f')],{'raw':_0x9c989['options']?_0x9c989[_0x2695('0x20')][_0x2695('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9c989[_0x2695('0x20')]?_0x9c989[_0x2695('0x20')]['where']||null:null,'attributes':_0x9c989[_0x2695('0x20')]?_0x9c989[_0x2695('0x20')][_0x2695('0x22')]||null:null,'limit':_0x9c989[_0x2695('0x20')]?_0x9c989['options'][_0x2695('0x23')]||null:null})['then'](function(_0xb64f73){logger['info']('UpdateFaxInteraction',_0x9c989);logger[_0x2695('0x16')](_0x2695('0x24'),_0x9c989,JSON[_0x2695('0x17')](_0xb64f73));_0x3a58ec(_0xb64f73);})[_0x2695('0x1c')](function(_0x2966d0){logger['error']('UpdateFaxInteraction',_0x2966d0[_0x2695('0x1a')],_0x9c989);_0x335a45(_0x3f14c0[_0x2695('0x18')](0x1f4,_0x2966d0[_0x2695('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x411e2f){return new Promise(function(_0x1273ed,_0xc31195){return db[_0x2695('0x1d')][_0x2695('0x25')]({'where':_0x411e2f[_0x2695('0x20')]?_0x411e2f[_0x2695('0x20')][_0x2695('0x26')]||null:null})[_0x2695('0x12')](function(_0x585380){if(_0x585380){return _0x585380[_0x2695('0x27')](_0x411e2f[_0x2695('0x1f')][_0x2695('0x28')],_[_0x2695('0x29')](_0x411e2f[_0x2695('0x1f')],[_0x2695('0x28'),'id'])||{});}})[_0x2695('0x2a')](function(_0x66079b){logger['info'](_0x2695('0x2b'),_0x411e2f);logger[_0x2695('0x16')]('AddTags',_0x411e2f,JSON[_0x2695('0x17')](_0x66079b));_0x1273ed(_0x66079b);})[_0x2695('0x1c')](function(_0x5b1bb3){logger[_0x2695('0x18')](_0x2695('0x2b'),_0x5b1bb3[_0x2695('0x1a')],_0x411e2f);_0xc31195(_this[_0x2695('0x18')](0x1f4,_0x5b1bb3['message']));});});}; \ No newline at end of file +var _0xbd75=['error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','then','info','request\x20sent','debug'];(function(_0x39f642,_0x4ecab2){var _0x2e3be9=function(_0xfa734a){while(--_0xfa734a){_0x39f642['push'](_0x39f642['shift']());}};_0x2e3be9(++_0x4ecab2);}(_0xbd75,0x199));var _0x5bd7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbd75[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x5bd7('0x0'));var util=require('util');var moment=require(_0x5bd7('0x1'));var BPromise=require(_0x5bd7('0x2'));var rs=require(_0x5bd7('0x3'));var fs=require('fs');var Redis=require(_0x5bd7('0x4'));var db=require(_0x5bd7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bd7('0x6'))(_0x5bd7('0x7'));var config=require(_0x5bd7('0x8'));var jayson=require(_0x5bd7('0x9'));var client=jayson['client'][_0x5bd7('0xa')]({'port':0x232a});config['redis']=_[_0x5bd7('0xb')](config[_0x5bd7('0xc')],{'host':_0x5bd7('0xd'),'port':0x18eb});var socket=require(_0x5bd7('0xe'))(new Redis(config[_0x5bd7('0xc')]));require(_0x5bd7('0xf'))['register'](socket);function respondWithRpcPromise(_0x4cfc4c,_0x4a2dad,_0x1ef3bf){return new BPromise(function(_0x4840ea,_0x2a23a7){return client['request'](_0x4cfc4c,_0x1ef3bf)[_0x5bd7('0x10')](function(_0x5857d0){logger[_0x5bd7('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x4a2dad,_0x5bd7('0x12'));logger[_0x5bd7('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4a2dad,'request\x20sent',JSON['stringify'](_0x5857d0));if(_0x5857d0[_0x5bd7('0x14')]){if(_0x5857d0['error']['code']===0x1f4){logger['error'](_0x5bd7('0x15'),_0x4a2dad,_0x5857d0[_0x5bd7('0x14')][_0x5bd7('0x16')]);return _0x2a23a7(_0x5857d0[_0x5bd7('0x14')][_0x5bd7('0x16')]);}logger[_0x5bd7('0x14')](_0x5bd7('0x15'),_0x4a2dad,_0x5857d0[_0x5bd7('0x14')]['message']);return _0x4840ea(_0x5857d0[_0x5bd7('0x14')][_0x5bd7('0x16')]);}else{logger[_0x5bd7('0x11')](_0x5bd7('0x15'),_0x4a2dad,'request\x20sent');_0x4840ea(_0x5857d0[_0x5bd7('0x17')][_0x5bd7('0x16')]);}})[_0x5bd7('0x18')](function(_0x4ee659){logger['error'](_0x5bd7('0x15'),_0x4a2dad,_0x4ee659);_0x2a23a7(_0x4ee659);});});}exports[_0x5bd7('0x19')]=function(_0x535266){var _0x3f98e9=this;return new Promise(function(_0x22dbb7,_0x3a6099){return db[_0x5bd7('0x1a')][_0x5bd7('0x1b')](_0x535266[_0x5bd7('0x1c')],{'raw':_0x535266['options']?_0x535266[_0x5bd7('0x1d')][_0x5bd7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x535266[_0x5bd7('0x1d')]?_0x535266[_0x5bd7('0x1d')]['where']||null:null,'attributes':_0x535266['options']?_0x535266[_0x5bd7('0x1d')]['attributes']||null:null,'limit':_0x535266['options']?_0x535266['options'][_0x5bd7('0x1f')]||null:null})['then'](function(_0x4466fb){logger[_0x5bd7('0x11')](_0x5bd7('0x19'),_0x535266);logger[_0x5bd7('0x13')]('UpdateFaxInteraction',_0x535266,JSON[_0x5bd7('0x20')](_0x4466fb));_0x22dbb7(_0x4466fb);})[_0x5bd7('0x18')](function(_0xdb304a){logger[_0x5bd7('0x14')]('UpdateFaxInteraction',_0xdb304a['message'],_0x535266);_0x3a6099(_0x3f98e9['error'](0x1f4,_0xdb304a['message']));});});};exports[_0x5bd7('0x21')]=function(_0x7b3ffc){return new Promise(function(_0x3d0e21,_0x475b0f){return db[_0x5bd7('0x1a')][_0x5bd7('0x22')]({'where':_0x7b3ffc[_0x5bd7('0x1d')]?_0x7b3ffc['options']['where']||null:null})[_0x5bd7('0x10')](function(_0x3df4c0){if(_0x3df4c0){return _0x3df4c0[_0x5bd7('0x23')](_0x7b3ffc[_0x5bd7('0x1c')][_0x5bd7('0x24')],_[_0x5bd7('0x25')](_0x7b3ffc[_0x5bd7('0x1c')],[_0x5bd7('0x24'),'id'])||{});}})['spread'](function(_0x44b8ad){logger[_0x5bd7('0x11')](_0x5bd7('0x26'),_0x7b3ffc);logger['debug'](_0x5bd7('0x26'),_0x7b3ffc,JSON[_0x5bd7('0x20')](_0x44b8ad));_0x3d0e21(_0x44b8ad);})[_0x5bd7('0x18')](function(_0x508437){logger[_0x5bd7('0x14')](_0x5bd7('0x26'),_0x508437[_0x5bd7('0x16')],_0x7b3ffc);_0x475b0f(_this[_0x5bd7('0x14')](0x1f4,_0x508437[_0x5bd7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6804cb5..1804b82 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 _0x0427=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x0427,0x6c));var _0x7042=function(_0x281316,_0x5d9b00){_0x281316=_0x281316-0x0;var _0x2030c=_0x0427[_0x281316];return _0x2030c;};'use strict';var FaxInteractionEvents=require(_0x7042('0x0'));var events=[_0x7042('0x1'),'remove',_0x7042('0x2')];function createListener(_0x3f99e6,_0x2a9b8a){return function(_0x40ee39){_0x2a9b8a[_0x7042('0x3')](_0x3f99e6,_0x40ee39);};}function removeListener(_0x5e33c5,_0x1ab30e){return function(){FaxInteractionEvents[_0x7042('0x4')](_0x5e33c5,_0x1ab30e);};}exports[_0x7042('0x5')]=function(_0xb6e6e1){for(var _0x3bbe8e=0x0,_0x2608cd=events[_0x7042('0x6')];_0x3bbe8e<_0x2608cd;_0x3bbe8e++){var _0x55515e=events[_0x3bbe8e];var _0x385195=createListener(_0x7042('0x7')+_0x55515e,_0xb6e6e1);FaxInteractionEvents['on'](_0x55515e,_0x385195);}}; \ No newline at end of file +var _0xb233=['emit','register','faxInteraction:','save','remove','update'];(function(_0x1ed8cb,_0x2f0e7b){var _0x2dbcf5=function(_0x1e194c){while(--_0x1e194c){_0x1ed8cb['push'](_0x1ed8cb['shift']());}};_0x2dbcf5(++_0x2f0e7b);}(_0xb233,0x1a1));var _0x3b23=function(_0x42b969,_0x4f4c97){_0x42b969=_0x42b969-0x0;var _0x22349a=_0xb233[_0x42b969];return _0x22349a;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x3b23('0x0'),_0x3b23('0x1'),_0x3b23('0x2')];function createListener(_0x49bff4,_0x5e7dcb){return function(_0x583400){_0x5e7dcb[_0x3b23('0x3')](_0x49bff4,_0x583400);};}function removeListener(_0x12f080,_0x3bcba1){return function(){FaxInteractionEvents['removeListener'](_0x12f080,_0x3bcba1);};}exports[_0x3b23('0x4')]=function(_0x5742a9){for(var _0x3f7ff5=0x0,_0x45c413=events['length'];_0x3f7ff5<_0x45c413;_0x3f7ff5++){var _0x2e2d5b=events[_0x3f7ff5];var _0xad5dd1=createListener(_0x3b23('0x5')+_0x2e2d5b,_0x5742a9);FaxInteractionEvents['on'](_0x2e2d5b,_0xad5dd1);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9606291..c06a69c 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 _0xfbab=['removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','/:id','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy'];(function(_0x8a8ce3,_0x187f4d){var _0x3859bd=function(_0x11000f){while(--_0x11000f){_0x8a8ce3['push'](_0x8a8ce3['shift']());}};_0x3859bd(++_0x187f4d);}(_0xfbab,0x86));var _0xbfba=function(_0x555c33,_0x4f0e47){_0x555c33=_0x555c33-0x0;var _0x46269b=_0xfbab[_0x555c33];return _0x46269b;};'use strict';var multer=require(_0xbfba('0x0'));var util=require(_0xbfba('0x1'));var path=require(_0xbfba('0x2'));var timeout=require(_0xbfba('0x3'));var express=require(_0xbfba('0x4'));var router=express[_0xbfba('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbfba('0x6'));var config=require(_0xbfba('0x7'));var controller=require('./faxInteraction.controller');router[_0xbfba('0x8')]('/',auth[_0xbfba('0x9')](),controller[_0xbfba('0xa')]);router['get']('/describe',auth[_0xbfba('0x9')](),controller[_0xbfba('0xb')]);router[_0xbfba('0x8')]('/:id',auth[_0xbfba('0x9')](),controller[_0xbfba('0xc')]);router[_0xbfba('0x8')](_0xbfba('0xd'),auth[_0xbfba('0x9')](),controller[_0xbfba('0xe')]);router['get'](_0xbfba('0xf'),auth[_0xbfba('0x9')](),controller[_0xbfba('0x10')]);router[_0xbfba('0x11')]('/',auth[_0xbfba('0x9')](),controller[_0xbfba('0x12')]);router[_0xbfba('0x11')](_0xbfba('0xd'),auth['isAuthenticated'](),controller[_0xbfba('0x13')]);router[_0xbfba('0x11')](_0xbfba('0x14'),auth[_0xbfba('0x9')](),interaction[_0xbfba('0x15')]('fax',_0xbfba('0x16')),controller[_0xbfba('0x17')]);router['put'](_0xbfba('0x18'),auth[_0xbfba('0x9')](),interaction['tracked'](_0xbfba('0x19'),_0xbfba('0x1a')),controller[_0xbfba('0x1b')]);router[_0xbfba('0x1c')](_0xbfba('0x18'),auth[_0xbfba('0x9')](),interaction[_0xbfba('0x15')](_0xbfba('0x19'),_0xbfba('0x1d')),controller[_0xbfba('0x1e')]);router[_0xbfba('0x1c')]('/:id/tags',auth[_0xbfba('0x9')](),controller[_0xbfba('0x1f')]);module[_0xbfba('0x20')]=router; \ No newline at end of file +var _0xd19f=['/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','fax','addTags','put','update','tracked','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get'];(function(_0x558d1c,_0x1bd139){var _0x3744a4=function(_0x4bb057){while(--_0x4bb057){_0x558d1c['push'](_0x558d1c['shift']());}};_0x3744a4(++_0x1bd139);}(_0xd19f,0x1e4));var _0xfd19=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xd19f[_0x25701b];return _0x3a8a2c;};'use strict';var multer=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var path=require(_0xfd19('0x2'));var timeout=require(_0xfd19('0x3'));var express=require(_0xfd19('0x4'));var router=express[_0xfd19('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd19('0x6'));var config=require(_0xfd19('0x7'));var controller=require(_0xfd19('0x8'));router['get']('/',auth[_0xfd19('0x9')](),controller[_0xfd19('0xa')]);router[_0xfd19('0xb')](_0xfd19('0xc'),auth[_0xfd19('0x9')](),controller['describe']);router[_0xfd19('0xb')](_0xfd19('0xd'),auth['isAuthenticated'](),controller[_0xfd19('0xe')]);router[_0xfd19('0xb')](_0xfd19('0xf'),auth[_0xfd19('0x9')](),controller[_0xfd19('0x10')]);router[_0xfd19('0xb')](_0xfd19('0x11'),auth[_0xfd19('0x9')](),controller['download']);router[_0xfd19('0x12')]('/',auth[_0xfd19('0x9')](),controller[_0xfd19('0x13')]);router[_0xfd19('0x12')]('/:id/messages',auth[_0xfd19('0x9')](),controller['addMessage']);router[_0xfd19('0x12')](_0xfd19('0x14'),auth[_0xfd19('0x9')](),interaction['tracked'](_0xfd19('0x15'),'faxinteraction:addtags'),controller[_0xfd19('0x16')]);router[_0xfd19('0x17')](_0xfd19('0xd'),auth[_0xfd19('0x9')](),interaction['tracked']('fax','faxinteraction:update'),controller[_0xfd19('0x18')]);router['delete'](_0xfd19('0xd'),auth[_0xfd19('0x9')](),interaction[_0xfd19('0x19')](_0xfd19('0x15'),_0xfd19('0x1a')),controller[_0xfd19('0x1b')]);router[_0xfd19('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0xfd19('0x1d')]);module[_0xfd19('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5809e9b..a1a2abf 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 _0xe3e9=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe3e9,0x104));var _0x9e3e=function(_0x702425,_0x761375){_0x702425=_0x702425-0x0;var _0x34e658=_0xe3e9[_0x702425];return _0x34e658;};'use strict';var Sequelize=require(_0x9e3e('0x0'));module[_0x9e3e('0x1')]={'body':{'type':Sequelize[_0x9e3e('0x2')](_0x9e3e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e3e('0x4')]('in',_0x9e3e('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e3e('0x6')]}}; \ No newline at end of file +var _0x63c6=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x27d9c0,_0x122973){var _0x41833a=function(_0x3d112b){while(--_0x3d112b){_0x27d9c0['push'](_0x27d9c0['shift']());}};_0x41833a(++_0x122973);}(_0x63c6,0x101));var _0x663c=function(_0xce1889,_0x37dbc4){_0xce1889=_0xce1889-0x0;var _0x4cdc88=_0x63c6[_0xce1889];return _0x4cdc88;};'use strict';var Sequelize=require(_0x663c('0x0'));module[_0x663c('0x1')]={'body':{'type':Sequelize[_0x663c('0x2')](_0x663c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x663c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x663c('0x5')]('in','out'),'defaultValue':_0x663c('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x663c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x663c('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6c7fe2f..2c36bee 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 _0x97e4=['reject','save','update','end','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','interface','rejectmessage','create','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','download','join','files','attachments','basename','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','defaults','./faxMessage.socket','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','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply'];(function(_0x4e2555,_0x3e00c8){var _0x56a3f7=function(_0x327acd){while(--_0x327acd){_0x4e2555['push'](_0x4e2555['shift']());}};_0x56a3f7(++_0x3e00c8);}(_0x97e4,0x1d8));var _0x497e=function(_0x314e22,_0x891517){_0x314e22=_0x314e22-0x0;var _0x4ac0f5=_0x97e4[_0x314e22];return _0x4ac0f5;};'use strict';var pdf=require(_0x497e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x497e('0x1'));var zipdir=require(_0x497e('0x2'));var jsonpatch=require(_0x497e('0x3'));var rp=require('request-promise');var moment=require(_0x497e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x497e('0x5'));var util=require('util');var path=require(_0x497e('0x6'));var sox=require(_0x497e('0x7'));var csv=require(_0x497e('0x8'));var ejs=require(_0x497e('0x9'));var fs=require('fs');var _=require(_0x497e('0xa'));var squel=require(_0x497e('0xb'));var crypto=require('crypto');var jsforce=require(_0x497e('0xc'));var deskjs=require(_0x497e('0xd'));var toCsv=require(_0x497e('0x8'));var querystring=require(_0x497e('0xe'));var Papa=require(_0x497e('0xf'));var Redis=require('ioredis');var authService=require(_0x497e('0x10'));var qs=require(_0x497e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x497e('0x12'));var logger=require('../../config/logger')(_0x497e('0x13'));var utils=require(_0x497e('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x497e('0x15')]=_[_0x497e('0x16')](config[_0x497e('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x497e('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x497e('0x18')][_0x497e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x59cde3,_0x5770fc,_0x4ebd6d){if(_0x4ebd6d){var _0x51a7ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51a7ff[_0x497e('0x1a')](_0x5770fc)){return _0x59cde3;}else{throw new db['Sequelize'][(_0x497e('0x1b'))](_0x497e('0x1c'));}}else{return _0x59cde3;}}function respondWithRpcPromise(_0x214448,_0x13986c,_0x3e2e32,_0x31aa3d){return new BPromise(function(_0x405b1b,_0x46de3b){var _0x9fd008=_0x31aa3d||client;return _0x9fd008[_0x497e('0x1d')](_0x214448,_0x3e2e32)[_0x497e('0x1e')](function(_0x8ece3b){logger[_0x497e('0x1f')](_0x497e('0x20'),_0x13986c,_0x497e('0x21'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x13986c,'request\x20sent',JSON[_0x497e('0x22')](_0x8ece3b));if(_0x8ece3b[_0x497e('0x23')]){if(_0x8ece3b[_0x497e('0x23')][_0x497e('0x24')]===0x1f4){logger['error'](_0x497e('0x20'),_0x13986c,_0x8ece3b[_0x497e('0x23')][_0x497e('0x25')]);return _0x46de3b(_0x8ece3b[_0x497e('0x23')][_0x497e('0x25')]);}logger[_0x497e('0x23')](_0x497e('0x20'),_0x13986c,_0x8ece3b[_0x497e('0x23')][_0x497e('0x25')]);return _0x405b1b(_0x8ece3b[_0x497e('0x23')]['message']);}else{logger[_0x497e('0x1f')](_0x497e('0x20'),_0x13986c,_0x497e('0x21'));_0x405b1b(_0x8ece3b[_0x497e('0x26')]['message']);}})[_0x497e('0x27')](function(_0x547f62){logger[_0x497e('0x23')](_0x497e('0x20'),_0x13986c,_0x547f62);_0x46de3b(_0x547f62);});});}function respondWithStatusCode(_0x50b6ef,_0x5b3ce){_0x5b3ce=_0x5b3ce||0xcc;return function(_0x376025){if(_0x376025){return _0x50b6ef[_0x497e('0x28')](_0x5b3ce);}return _0x50b6ef[_0x497e('0x29')](_0x5b3ce)['end']();};}function respondWithResult(_0x447820,_0x3445e6){_0x3445e6=_0x3445e6||0xc8;return function(_0x2982c1){if(_0x2982c1){return _0x447820['status'](_0x3445e6)[_0x497e('0x2a')](_0x2982c1);}};}function respondWithFilteredResult(_0x2dc6d6,_0xaa0c37){return function(_0x6e9381){if(_0x6e9381){var _0x43665a=_0x6e9381[_0x497e('0x2b')],_0x383fe6=_0xaa0c37[_0x497e('0x2c')],_0x3c1ba6=_0xaa0c37[_0x497e('0x2c')]+_0xaa0c37[_0x497e('0x2d')],_0x5442c2;if(_0x3c1ba6>=_0x43665a){_0x3c1ba6=_0x43665a;_0x5442c2=0xc8;}else{_0x5442c2=0xce;}_0x2dc6d6['status'](_0x5442c2);return _0x2dc6d6[_0x497e('0x2e')]('Content-Range',_0x383fe6+'-'+_0x3c1ba6+'/'+_0x43665a)[_0x497e('0x2a')](_0x6e9381);}return null;};}function patchUpdates(_0x13f157){return function(_0x4c4f92){try{jsonpatch[_0x497e('0x2f')](_0x4c4f92,_0x13f157,!![]);}catch(_0xd2b824){return BPromise[_0x497e('0x30')](_0xd2b824);}return _0x4c4f92[_0x497e('0x31')]();};}function saveUpdates(_0x3f8e31,_0x3e1085){return function(_0x3fa8ce){if(_0x3fa8ce){return _0x3fa8ce[_0x497e('0x32')](_0x3f8e31)[_0x497e('0x1e')](function(_0xf4dafb){return _0xf4dafb;});}return null;};}function removeEntity(_0x3b15dc,_0xd8cd9){return function(_0x22a105){if(_0x22a105){return _0x22a105['destroy']()[_0x497e('0x1e')](function(){_0x3b15dc['status'](0xcc)[_0x497e('0x33')]();});}};}function handleEntityNotFound(_0x20f798,_0x15c7ef){return function(_0x22872c){if(!_0x22872c){_0x20f798[_0x497e('0x28')](0x194);}return _0x22872c;};}function handleError(_0x1090de,_0x2f7e00){_0x2f7e00=_0x2f7e00||0x1f4;return function(_0x4826e1){logger[_0x497e('0x23')](_0x4826e1['stack']);if(_0x4826e1[_0x497e('0x34')]){delete _0x4826e1[_0x497e('0x34')];}_0x1090de['status'](_0x2f7e00)[_0x497e('0x35')](_0x4826e1);};}exports[_0x497e('0x36')]=function(_0x16e8a6,_0x4c4b45){var _0x395e99={},_0x15d1b5={},_0x2e6b9f={'count':0x0,'rows':[]};var _0x227e74=_[_0x497e('0x37')](db[_0x497e('0x38')][_0x497e('0x39')],function(_0x136ab8){return{'name':_0x136ab8[_0x497e('0x3a')],'type':_0x136ab8[_0x497e('0x3b')][_0x497e('0x3c')]};});_0x15d1b5[_0x497e('0x3d')]=_['map'](_0x227e74,_0x497e('0x34'));_0x15d1b5[_0x497e('0x3e')]=_[_0x497e('0x3f')](_0x16e8a6[_0x497e('0x3e')]);_0x15d1b5['filters']=_[_0x497e('0x40')](_0x15d1b5[_0x497e('0x3d')],_0x15d1b5[_0x497e('0x3e')]);_0x395e99['attributes']=_[_0x497e('0x40')](_0x15d1b5['model'],qs[_0x497e('0x41')](_0x16e8a6['query'][_0x497e('0x41')]));_0x395e99[_0x497e('0x42')]=_0x395e99['attributes'][_0x497e('0x43')]?_0x395e99['attributes']:_0x15d1b5['model'];if(!_0x16e8a6[_0x497e('0x3e')][_0x497e('0x44')](_0x497e('0x45'))){_0x395e99[_0x497e('0x2d')]=qs[_0x497e('0x2d')](_0x16e8a6['query']['limit']);_0x395e99[_0x497e('0x2c')]=qs[_0x497e('0x2c')](_0x16e8a6['query']['offset']);}_0x395e99[_0x497e('0x46')]=qs['sort'](_0x16e8a6[_0x497e('0x3e')][_0x497e('0x47')]);_0x395e99[_0x497e('0x48')]=qs[_0x497e('0x49')](_[_0x497e('0x4a')](_0x16e8a6['query'],_0x15d1b5[_0x497e('0x49')]),_0x227e74);if(_0x16e8a6[_0x497e('0x3e')][_0x497e('0x4b')]){_0x395e99['where']=_[_0x497e('0x4c')](_0x395e99[_0x497e('0x48')],{'$or':_['map'](_0x227e74,function(_0x5e5f73){if(_0x5e5f73['type']!==_0x497e('0x4d')){var _0x1c153d={};_0x1c153d[_0x5e5f73[_0x497e('0x34')]]={'$like':'%'+_0x16e8a6[_0x497e('0x3e')]['filter']+'%'};return _0x1c153d;}})});}_0x395e99=_[_0x497e('0x4c')]({},_0x395e99,_0x16e8a6[_0x497e('0x4e')]);var _0x3e36b9={'where':_0x395e99[_0x497e('0x48')]};return db['FaxMessage'][_0x497e('0x2b')](_0x3e36b9)['then'](function(_0x575c6e){_0x2e6b9f[_0x497e('0x2b')]=_0x575c6e;if(_0x16e8a6['query'][_0x497e('0x4f')]){_0x395e99[_0x497e('0x50')]=[{'all':!![]}];}return db[_0x497e('0x38')]['findAll'](_0x395e99);})[_0x497e('0x1e')](function(_0x30f4e0){_0x2e6b9f[_0x497e('0x51')]=_0x30f4e0;return _0x2e6b9f;})[_0x497e('0x1e')](respondWithFilteredResult(_0x4c4b45,_0x395e99))[_0x497e('0x27')](handleError(_0x4c4b45,null));};exports[_0x497e('0x52')]=function(_0x31fc24,_0x4e7c31){var _0x20b204={'raw':!![],'where':{'id':_0x31fc24[_0x497e('0x53')]['id']}},_0x39a082={};_0x39a082['model']=_[_0x497e('0x3f')](db[_0x497e('0x38')]['rawAttributes']);_0x39a082['query']=_[_0x497e('0x3f')](_0x31fc24[_0x497e('0x3e')]);_0x39a082['filters']=_[_0x497e('0x40')](_0x39a082[_0x497e('0x3d')],_0x39a082['query']);_0x20b204[_0x497e('0x42')]=_[_0x497e('0x40')](_0x39a082[_0x497e('0x3d')],qs[_0x497e('0x41')](_0x31fc24[_0x497e('0x3e')][_0x497e('0x41')]));_0x20b204['attributes']=_0x20b204[_0x497e('0x42')][_0x497e('0x43')]?_0x20b204[_0x497e('0x42')]:_0x39a082[_0x497e('0x3d')];if(_0x31fc24[_0x497e('0x3e')][_0x497e('0x4f')]){_0x20b204[_0x497e('0x50')]=[{'all':!![]}];}_0x20b204=_[_0x497e('0x4c')]({},_0x20b204,_0x31fc24[_0x497e('0x4e')]);return db[_0x497e('0x38')][_0x497e('0x54')](_0x20b204)[_0x497e('0x1e')](handleEntityNotFound(_0x4e7c31,null))[_0x497e('0x1e')](respondWithResult(_0x4e7c31,null))[_0x497e('0x27')](handleError(_0x4e7c31,null));};exports[_0x497e('0x32')]=function(_0x1a2eb2,_0x1045e7){if(_0x1a2eb2[_0x497e('0x55')]['id']){delete _0x1a2eb2['body']['id'];}return db[_0x497e('0x38')]['find']({'where':{'id':_0x1a2eb2['params']['id']}})[_0x497e('0x1e')](handleEntityNotFound(_0x1045e7,null))[_0x497e('0x1e')](saveUpdates(_0x1a2eb2['body'],null))[_0x497e('0x1e')](respondWithResult(_0x1045e7,null))['catch'](handleError(_0x1045e7,null));};exports['destroy']=function(_0x56645a,_0x40be66){return db[_0x497e('0x38')][_0x497e('0x54')]({'where':{'id':_0x56645a['params']['id']}})['then'](handleEntityNotFound(_0x40be66,null))[_0x497e('0x1e')](removeEntity(_0x40be66,null))[_0x497e('0x27')](handleError(_0x40be66,null));};exports['describe']=function(_0x4d9ebe,_0x2f631e){return db[_0x497e('0x38')][_0x497e('0x56')]()[_0x497e('0x1e')](respondWithResult(_0x2f631e,null))['catch'](handleError(_0x2f631e,null));};var interaction_log=require(_0x497e('0x57'))(_0x497e('0x58'));exports[_0x497e('0x59')]=function(_0x7f08db,_0x4cace9,_0x4bcffa){var _0x41819b={'channel':_0x497e('0x5a')};if(_0x7f08db[_0x497e('0x55')]['id']){delete _0x7f08db[_0x497e('0x55')]['id'];}_0x7f08db[_0x497e('0x55')][_0x497e('0x5b')]=!![];_0x7f08db[_0x497e('0x55')]['readAt']=moment()[_0x497e('0x5c')](_0x497e('0x5d'));_0x7f08db[_0x497e('0x55')][_0x497e('0x5e')]=_0x7f08db[_0x497e('0x55')][_0x497e('0x5e')]||_0x7f08db[_0x497e('0x5f')]['id'];return db[_0x497e('0x38')][_0x497e('0x54')]({'where':{'id':_0x7f08db[_0x497e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x497e('0x60')],'as':'Contact'}]})[_0x497e('0x1e')](handleEntityNotFound(_0x4cace9,null))['then'](saveUpdates(_0x7f08db[_0x497e('0x55')],null))['then'](function(_0x462c90){if(_0x462c90){_0x41819b['message']=_0x462c90[_0x497e('0x61')]({'plain':!![]});return db[_0x497e('0x62')]['find']({'where':{'id':_0x462c90[_0x497e('0x63')]}});}return null;})[_0x497e('0x1e')](handleEntityNotFound(_0x4cace9,null))['then'](function(_0x4288e8){if(_0x4288e8){return _0x4288e8[_0x497e('0x32')]({'UserId':_0x7f08db[_0x497e('0x55')][_0x497e('0x5e')],'read1stAt':_[_0x497e('0x64')](_0x4288e8[_0x497e('0x65')])?moment()[_0x497e('0x5c')](_0x497e('0x5d')):undefined});}return null;})[_0x497e('0x1e')](function(_0x4de410){if(_0x4de410){_0x41819b[_0x497e('0x66')]=_0x4de410[_0x497e('0x61')]({'plain':!![]});interaction_log[_0x497e('0x1f')](_0x497e('0x67'),_0x7f08db[_0x497e('0x5f')]['id'],_0x7f08db[_0x497e('0x5f')][_0x497e('0x34')],_0x7f08db[_0x497e('0x5f')]['role'],_0x41819b[_0x497e('0x66')]['id'],_0x7f08db['body']?JSON[_0x497e('0x22')](_0x7f08db[_0x497e('0x55')]):_0x497e('0x68'));return respondWithRpcPromise(_0x497e('0x69'),_0x497e('0x6a'),_0x41819b);}return null;})[_0x497e('0x1e')](function(_0x991df8){if(_0x991df8){if(_0x7f08db[_0x497e('0x55')][_0x497e('0x6b')]){_0x41819b[_0x497e('0x25')]['interface']=util[_0x497e('0x5c')](_0x497e('0x6c'),_0x7f08db[_0x497e('0x5f')]['name']);_0x41819b['message'][_0x497e('0x6d')]=_0x41819b[_0x497e('0x6d')];_0x41819b[_0x497e('0x25')][_0x497e('0x6e')]=_0x497e('0x59');return respondWithRpcPromise('EventManager',_0x497e('0x6f'),{'event':_0x497e('0x70'),'message':_0x41819b['message']},client9002)[_0x497e('0x1e')](function(){return _0x41819b;});}return _0x41819b;}return null;})['then'](respondWithResult(_0x4cace9,null))[_0x497e('0x27')](handleError(_0x4cace9,null));};var interaction_log=require('../../config/logger')(_0x497e('0x58'));exports[_0x497e('0x30')]=function(_0x50faa5,_0x3a7369,_0x170bf6){var _0x104485={'agent':{},'channel':_0x497e('0x5a')};if(_0x50faa5[_0x497e('0x55')]['id']){delete _0x50faa5['body']['id'];}_0x50faa5[_0x497e('0x55')][_0x497e('0x5e')]=_0x50faa5[_0x497e('0x55')][_0x497e('0x5e')]||_0x50faa5['user']['id'];_0x104485['agent']['id']=_0x50faa5[_0x497e('0x55')][_0x497e('0x5e')];return db[_0x497e('0x38')][_0x497e('0x54')]({'where':{'id':_0x50faa5[_0x497e('0x53')]['id'],'UserId':null}})[_0x497e('0x1e')](handleEntityNotFound(_0x3a7369,null))[_0x497e('0x1e')](function(_0x39a2ad){if(_0x39a2ad){_0x104485[_0x497e('0x25')]=_0x39a2ad['get']({'plain':!![]});return db[_0x497e('0x62')]['find']({'where':{'id':_0x39a2ad[_0x497e('0x63')]}});}return null;})[_0x497e('0x1e')](handleEntityNotFound(_0x3a7369,null))['then'](function(_0x7aab7f){if(_0x7aab7f){_0x104485['interaction']=_0x7aab7f[_0x497e('0x61')]({'plain':!![]});interaction_log[_0x497e('0x1f')](_0x497e('0x71'),_0x50faa5[_0x497e('0x5f')]['id'],_0x50faa5[_0x497e('0x5f')][_0x497e('0x34')],_0x50faa5[_0x497e('0x5f')][_0x497e('0x72')],_0x104485['interaction']['id'],_0x50faa5['body']?JSON[_0x497e('0x22')](_0x50faa5['body']):_0x497e('0x68'));return respondWithRpcPromise('RejectMessage',_0x497e('0x73'),_0x104485);}return null;})[_0x497e('0x1e')](function(_0x495502){if(_0x495502){_0x495502[_0x497e('0x25')][_0x497e('0x74')]=util['format'](_0x497e('0x6c'),_0x50faa5[_0x497e('0x5f')]['name']);_0x495502[_0x497e('0x25')][_0x497e('0x6d')]=_0x104485[_0x497e('0x6d')];_0x495502[_0x497e('0x25')][_0x497e('0x6e')]=_0x497e('0x30');respondWithRpcPromise(_0x497e('0x6f'),_0x497e('0x6f'),{'event':_0x497e('0x75'),'message':_0x495502[_0x497e('0x25')]},client9002);return _0x104485;}return null;})[_0x497e('0x1e')](respondWithResult(_0x3a7369,null))[_0x497e('0x27')](handleError(_0x3a7369,null));};exports[_0x497e('0x76')]=function(_0x3e7d17,_0x7fa9f7){var _0x2cd7be;return db[_0x497e('0x38')][_0x497e('0x76')](_0x3e7d17['body'],{})[_0x497e('0x1e')](function(_0x5ed1f5){_0x2cd7be=_0x5ed1f5;return db['CmContact']['findOne']({'where':{'id':_0x2cd7be[_0x497e('0x77')]}});})['then'](function(_0x2cc55b){if(_['isNil'](_0x2cc55b)){return;}else{_0x2cd7be[_0x497e('0x5a')]=_0x2cc55b[_0x497e('0x5a')];return db[_0x497e('0x78')][_0x497e('0x79')]({'where':{'id':_0x2cd7be[_0x497e('0x7a')]}});}})['then'](function(_0x11a1f4){return respondWithRpcPromise(_0x497e('0x7b'),_0x497e('0x7b'),{'FaxAccountId':_[_0x497e('0x64')](_0x3e7d17[_0x497e('0x55')])?undefined:_0x3e7d17[_0x497e('0x55')][_0x497e('0x7c')],'path':_[_0x497e('0x64')](_0x11a1f4)?undefined:util[_0x497e('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x11a1f4['basename']),'fax':_[_0x497e('0x64')](_0x2cd7be[_0x497e('0x5a')])?undefined:_0x2cd7be[_0x497e('0x5a')],'AttachmentId':_0x2cd7be[_0x497e('0x7a')]},client9002);})['then'](respondWithResult(_0x7fa9f7,0xc9))[_0x497e('0x27')](handleError(_0x7fa9f7,null));};exports[_0x497e('0x7d')]=function(_0x5a8572,_0x3dbac5){var _0x515371=path[_0x497e('0x7e')](config['root'],'server',_0x497e('0x7f'),_0x497e('0x80'));return db[_0x497e('0x38')]['find']({'where':{'id':_0x5a8572[_0x497e('0x53')]['id']},'include':[{'model':db[_0x497e('0x78')],'as':_0x497e('0x78')}]})[_0x497e('0x1e')](handleEntityNotFound(_0x3dbac5,null))[_0x497e('0x1e')](function(_0x2eaec0){if(_0x2eaec0){return _0x3dbac5[_0x497e('0x7d')](path[_0x497e('0x7e')](_0x515371,_0x2eaec0[_0x497e('0x78')][_0x497e('0x81')]));}})[_0x497e('0x27')](handleError(_0x3dbac5,null));}; \ No newline at end of file +var _0x9d65=['acceptMessage','manual','format','SIP/%s','channel','event','EventManager','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','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','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','request\x20sent','catch','sendStatus','status','json','count','offset','limit','set','save','update','destroy','name','send','index','map','FaxMessage','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','body','find','describe','../../config/logger','fax-interactions','accept','fax','readAt','UserId','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d65,0x98));var _0x59d6=function(_0x4103d6,_0x42e4f6){_0x4103d6=_0x4103d6-0x0;var _0x565ccb=_0x9d65[_0x4103d6];return _0x565ccb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x59d6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x59d6('0x1'));var rp=require(_0x59d6('0x2'));var moment=require(_0x59d6('0x3'));var BPromise=require(_0x59d6('0x4'));var Mustache=require(_0x59d6('0x5'));var util=require('util');var path=require(_0x59d6('0x6'));var sox=require(_0x59d6('0x7'));var csv=require(_0x59d6('0x8'));var ejs=require(_0x59d6('0x9'));var fs=require('fs');var _=require(_0x59d6('0xa'));var squel=require(_0x59d6('0xb'));var crypto=require(_0x59d6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x59d6('0xd'));var toCsv=require(_0x59d6('0x8'));var querystring=require('querystring');var Papa=require(_0x59d6('0xe'));var Redis=require(_0x59d6('0xf'));var authService=require(_0x59d6('0x10'));var qs=require(_0x59d6('0x11'));var as=require(_0x59d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x59d6('0x13'));var utils=require(_0x59d6('0x14'));var config=require('../../config/environment');var db=require(_0x59d6('0x15'))['db'];config[_0x59d6('0x16')]=_[_0x59d6('0x17')](config['redis'],{'host':_0x59d6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59d6('0x16')]));require(_0x59d6('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x59d6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3d0893,_0x4cfb54,_0x3a9d8a){if(_0x3a9d8a){var _0x39bc08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39bc08[_0x59d6('0x1b')](_0x4cfb54)){return _0x3d0893;}else{throw new db[(_0x59d6('0x1c'))][(_0x59d6('0x1d'))](_0x59d6('0x1e'));}}else{return _0x3d0893;}}function respondWithRpcPromise(_0x3f0e85,_0x2bcdb8,_0x36a42a,_0xeb78d2){return new BPromise(function(_0x43ed6e,_0x1f5df3){var _0x48034e=_0xeb78d2||client;return _0x48034e['request'](_0x3f0e85,_0x36a42a)[_0x59d6('0x1f')](function(_0x4cd20f){logger[_0x59d6('0x20')]('FaxMessage,\x20%s,\x20%s',_0x2bcdb8,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2bcdb8,'request\x20sent',JSON[_0x59d6('0x21')](_0x4cd20f));if(_0x4cd20f['error']){if(_0x4cd20f[_0x59d6('0x22')][_0x59d6('0x23')]===0x1f4){logger[_0x59d6('0x22')]('FaxMessage,\x20%s,\x20%s',_0x2bcdb8,_0x4cd20f['error']['message']);return _0x1f5df3(_0x4cd20f[_0x59d6('0x22')][_0x59d6('0x24')]);}logger[_0x59d6('0x22')](_0x59d6('0x25'),_0x2bcdb8,_0x4cd20f[_0x59d6('0x22')][_0x59d6('0x24')]);return _0x43ed6e(_0x4cd20f['error']['message']);}else{logger[_0x59d6('0x20')](_0x59d6('0x25'),_0x2bcdb8,_0x59d6('0x26'));_0x43ed6e(_0x4cd20f['result']['message']);}})[_0x59d6('0x27')](function(_0x31bc77){logger[_0x59d6('0x22')](_0x59d6('0x25'),_0x2bcdb8,_0x31bc77);_0x1f5df3(_0x31bc77);});});}function respondWithStatusCode(_0x4be123,_0x5218b3){_0x5218b3=_0x5218b3||0xcc;return function(_0xb382d9){if(_0xb382d9){return _0x4be123[_0x59d6('0x28')](_0x5218b3);}return _0x4be123['status'](_0x5218b3)['end']();};}function respondWithResult(_0x4b25ae,_0x9808e7){_0x9808e7=_0x9808e7||0xc8;return function(_0x19c862){if(_0x19c862){return _0x4b25ae[_0x59d6('0x29')](_0x9808e7)[_0x59d6('0x2a')](_0x19c862);}};}function respondWithFilteredResult(_0x1f5362,_0x4b3fbe){return function(_0x42cd2c){if(_0x42cd2c){var _0x1d222b=_0x42cd2c[_0x59d6('0x2b')],_0x4bdd24=_0x4b3fbe[_0x59d6('0x2c')],_0x1a2dd1=_0x4b3fbe[_0x59d6('0x2c')]+_0x4b3fbe[_0x59d6('0x2d')],_0x444152;if(_0x1a2dd1>=_0x1d222b){_0x1a2dd1=_0x1d222b;_0x444152=0xc8;}else{_0x444152=0xce;}_0x1f5362['status'](_0x444152);return _0x1f5362[_0x59d6('0x2e')]('Content-Range',_0x4bdd24+'-'+_0x1a2dd1+'/'+_0x1d222b)[_0x59d6('0x2a')](_0x42cd2c);}return null;};}function patchUpdates(_0x8b821a){return function(_0x16495e){try{jsonpatch['apply'](_0x16495e,_0x8b821a,!![]);}catch(_0x2495bb){return BPromise['reject'](_0x2495bb);}return _0x16495e[_0x59d6('0x2f')]();};}function saveUpdates(_0x2d0d97,_0x38f477){return function(_0x3aa22e){if(_0x3aa22e){return _0x3aa22e[_0x59d6('0x30')](_0x2d0d97)[_0x59d6('0x1f')](function(_0x354f63){return _0x354f63;});}return null;};}function removeEntity(_0x157ba6,_0x3cf044){return function(_0x31a4dc){if(_0x31a4dc){return _0x31a4dc[_0x59d6('0x31')]()[_0x59d6('0x1f')](function(){_0x157ba6[_0x59d6('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fdfc6,_0x3ee5fe){return function(_0x2dfb31){if(!_0x2dfb31){_0x3fdfc6[_0x59d6('0x28')](0x194);}return _0x2dfb31;};}function handleError(_0x3ad66f,_0x2c9e1d){_0x2c9e1d=_0x2c9e1d||0x1f4;return function(_0x1d2d4c){logger[_0x59d6('0x22')](_0x1d2d4c['stack']);if(_0x1d2d4c[_0x59d6('0x32')]){delete _0x1d2d4c[_0x59d6('0x32')];}_0x3ad66f[_0x59d6('0x29')](_0x2c9e1d)[_0x59d6('0x33')](_0x1d2d4c);};}exports[_0x59d6('0x34')]=function(_0x3b9e32,_0x35e393){var _0x1bd7b3={},_0x3992c8={},_0xe22732={'count':0x0,'rows':[]};var _0x4c81cb=_[_0x59d6('0x35')](db[_0x59d6('0x36')]['rawAttributes'],function(_0x19de87){return{'name':_0x19de87[_0x59d6('0x37')],'type':_0x19de87[_0x59d6('0x38')]['key']};});_0x3992c8[_0x59d6('0x39')]=_[_0x59d6('0x35')](_0x4c81cb,_0x59d6('0x32'));_0x3992c8[_0x59d6('0x3a')]=_[_0x59d6('0x3b')](_0x3b9e32[_0x59d6('0x3a')]);_0x3992c8['filters']=_[_0x59d6('0x3c')](_0x3992c8['model'],_0x3992c8['query']);_0x1bd7b3[_0x59d6('0x3d')]=_[_0x59d6('0x3c')](_0x3992c8[_0x59d6('0x39')],qs[_0x59d6('0x3e')](_0x3b9e32[_0x59d6('0x3a')]['fields']));_0x1bd7b3['attributes']=_0x1bd7b3[_0x59d6('0x3d')][_0x59d6('0x3f')]?_0x1bd7b3['attributes']:_0x3992c8[_0x59d6('0x39')];if(!_0x3b9e32[_0x59d6('0x3a')][_0x59d6('0x40')](_0x59d6('0x41'))){_0x1bd7b3[_0x59d6('0x2d')]=qs[_0x59d6('0x2d')](_0x3b9e32[_0x59d6('0x3a')][_0x59d6('0x2d')]);_0x1bd7b3[_0x59d6('0x2c')]=qs[_0x59d6('0x2c')](_0x3b9e32[_0x59d6('0x3a')][_0x59d6('0x2c')]);}_0x1bd7b3['order']=qs[_0x59d6('0x42')](_0x3b9e32['query'][_0x59d6('0x42')]);_0x1bd7b3[_0x59d6('0x43')]=qs[_0x59d6('0x44')](_['pick'](_0x3b9e32['query'],_0x3992c8[_0x59d6('0x44')]),_0x4c81cb);if(_0x3b9e32[_0x59d6('0x3a')]['filter']){_0x1bd7b3[_0x59d6('0x43')]=_[_0x59d6('0x45')](_0x1bd7b3[_0x59d6('0x43')],{'$or':_[_0x59d6('0x35')](_0x4c81cb,function(_0x4b144d){if(_0x4b144d[_0x59d6('0x38')]!==_0x59d6('0x46')){var _0x11c908={};_0x11c908[_0x4b144d[_0x59d6('0x32')]]={'$like':'%'+_0x3b9e32[_0x59d6('0x3a')][_0x59d6('0x47')]+'%'};return _0x11c908;}})});}_0x1bd7b3=_[_0x59d6('0x45')]({},_0x1bd7b3,_0x3b9e32[_0x59d6('0x48')]);var _0x2f4d2e={'where':_0x1bd7b3[_0x59d6('0x43')]};return db[_0x59d6('0x36')]['count'](_0x2f4d2e)[_0x59d6('0x1f')](function(_0x3fbb41){_0xe22732[_0x59d6('0x2b')]=_0x3fbb41;if(_0x3b9e32[_0x59d6('0x3a')][_0x59d6('0x49')]){_0x1bd7b3[_0x59d6('0x4a')]=[{'all':!![]}];}return db[_0x59d6('0x36')][_0x59d6('0x4b')](_0x1bd7b3);})[_0x59d6('0x1f')](function(_0x349722){_0xe22732['rows']=_0x349722;return _0xe22732;})[_0x59d6('0x1f')](respondWithFilteredResult(_0x35e393,_0x1bd7b3))[_0x59d6('0x27')](handleError(_0x35e393,null));};exports[_0x59d6('0x4c')]=function(_0x4bcfa1,_0x3a8ce9){var _0xa3b448={'raw':!![],'where':{'id':_0x4bcfa1[_0x59d6('0x4d')]['id']}},_0x3b6e53={};_0x3b6e53[_0x59d6('0x39')]=_[_0x59d6('0x3b')](db[_0x59d6('0x36')][_0x59d6('0x4e')]);_0x3b6e53[_0x59d6('0x3a')]=_['keys'](_0x4bcfa1[_0x59d6('0x3a')]);_0x3b6e53[_0x59d6('0x44')]=_[_0x59d6('0x3c')](_0x3b6e53['model'],_0x3b6e53['query']);_0xa3b448[_0x59d6('0x3d')]=_[_0x59d6('0x3c')](_0x3b6e53['model'],qs[_0x59d6('0x3e')](_0x4bcfa1['query'][_0x59d6('0x3e')]));_0xa3b448[_0x59d6('0x3d')]=_0xa3b448[_0x59d6('0x3d')][_0x59d6('0x3f')]?_0xa3b448[_0x59d6('0x3d')]:_0x3b6e53[_0x59d6('0x39')];if(_0x4bcfa1[_0x59d6('0x3a')][_0x59d6('0x49')]){_0xa3b448['include']=[{'all':!![]}];}_0xa3b448=_[_0x59d6('0x45')]({},_0xa3b448,_0x4bcfa1[_0x59d6('0x48')]);return db[_0x59d6('0x36')]['find'](_0xa3b448)[_0x59d6('0x1f')](handleEntityNotFound(_0x3a8ce9,null))[_0x59d6('0x1f')](respondWithResult(_0x3a8ce9,null))[_0x59d6('0x27')](handleError(_0x3a8ce9,null));};exports['update']=function(_0x3b9c87,_0x2f07a6){if(_0x3b9c87[_0x59d6('0x4f')]['id']){delete _0x3b9c87[_0x59d6('0x4f')]['id'];}return db[_0x59d6('0x36')][_0x59d6('0x50')]({'where':{'id':_0x3b9c87[_0x59d6('0x4d')]['id']}})[_0x59d6('0x1f')](handleEntityNotFound(_0x2f07a6,null))[_0x59d6('0x1f')](saveUpdates(_0x3b9c87[_0x59d6('0x4f')],null))[_0x59d6('0x1f')](respondWithResult(_0x2f07a6,null))[_0x59d6('0x27')](handleError(_0x2f07a6,null));};exports[_0x59d6('0x31')]=function(_0x277bc6,_0x33ae55){return db[_0x59d6('0x36')][_0x59d6('0x50')]({'where':{'id':_0x277bc6[_0x59d6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33ae55,null))['then'](removeEntity(_0x33ae55,null))[_0x59d6('0x27')](handleError(_0x33ae55,null));};exports[_0x59d6('0x51')]=function(_0x3cbad7,_0x2ce9fe){return db[_0x59d6('0x36')][_0x59d6('0x51')]()[_0x59d6('0x1f')](respondWithResult(_0x2ce9fe,null))['catch'](handleError(_0x2ce9fe,null));};var interaction_log=require(_0x59d6('0x52'))(_0x59d6('0x53'));exports[_0x59d6('0x54')]=function(_0x5bacf5,_0x1475b2,_0x1f4917){var _0x4ef80c={'channel':_0x59d6('0x55')};if(_0x5bacf5[_0x59d6('0x4f')]['id']){delete _0x5bacf5[_0x59d6('0x4f')]['id'];}_0x5bacf5['body']['read']=!![];_0x5bacf5[_0x59d6('0x4f')][_0x59d6('0x56')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5bacf5[_0x59d6('0x4f')][_0x59d6('0x57')]=_0x5bacf5['body']['UserId']||_0x5bacf5['user']['id'];return db[_0x59d6('0x36')]['find']({'where':{'id':_0x5bacf5[_0x59d6('0x4d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x59d6('0x58')}]})[_0x59d6('0x1f')](handleEntityNotFound(_0x1475b2,null))[_0x59d6('0x1f')](saveUpdates(_0x5bacf5[_0x59d6('0x4f')],null))['then'](function(_0x16283b){if(_0x16283b){_0x4ef80c['message']=_0x16283b['get']({'plain':!![]});return db[_0x59d6('0x59')][_0x59d6('0x50')]({'where':{'id':_0x16283b[_0x59d6('0x5a')]}});}return null;})[_0x59d6('0x1f')](handleEntityNotFound(_0x1475b2,null))['then'](function(_0x28a040){if(_0x28a040){return _0x28a040[_0x59d6('0x30')]({'UserId':_0x5bacf5[_0x59d6('0x4f')][_0x59d6('0x57')],'read1stAt':_[_0x59d6('0x5b')](_0x28a040[_0x59d6('0x5c')])?moment()['format'](_0x59d6('0x5d')):undefined});}return null;})[_0x59d6('0x1f')](function(_0x3657e0){if(_0x3657e0){_0x4ef80c['interaction']=_0x3657e0[_0x59d6('0x5e')]({'plain':!![]});interaction_log[_0x59d6('0x20')](_0x59d6('0x5f'),_0x5bacf5[_0x59d6('0x60')]['id'],_0x5bacf5['user']['name'],_0x5bacf5[_0x59d6('0x60')][_0x59d6('0x61')],_0x4ef80c[_0x59d6('0x62')]['id'],_0x5bacf5['body']?JSON[_0x59d6('0x21')](_0x5bacf5['body']):_0x59d6('0x63'));return respondWithRpcPromise('AcceptMessage',_0x59d6('0x64'),_0x4ef80c);}return null;})[_0x59d6('0x1f')](function(_0x52203e){if(_0x52203e){if(_0x5bacf5[_0x59d6('0x4f')][_0x59d6('0x65')]){_0x4ef80c[_0x59d6('0x24')]['interface']=util[_0x59d6('0x66')](_0x59d6('0x67'),_0x5bacf5[_0x59d6('0x60')][_0x59d6('0x32')]);_0x4ef80c['message'][_0x59d6('0x68')]=_0x4ef80c[_0x59d6('0x68')];_0x4ef80c[_0x59d6('0x24')][_0x59d6('0x69')]='accept';return respondWithRpcPromise(_0x59d6('0x6a'),_0x59d6('0x6a'),{'event':'acceptmessage','message':_0x4ef80c[_0x59d6('0x24')]},client9002)['then'](function(){return _0x4ef80c;});}return _0x4ef80c;}return null;})[_0x59d6('0x1f')](respondWithResult(_0x1475b2,null))['catch'](handleError(_0x1475b2,null));};var interaction_log=require(_0x59d6('0x52'))(_0x59d6('0x53'));exports[_0x59d6('0x6b')]=function(_0x34ed00,_0x5b0fd6,_0x1d1757){var _0x8726aa={'agent':{},'channel':_0x59d6('0x55')};if(_0x34ed00['body']['id']){delete _0x34ed00[_0x59d6('0x4f')]['id'];}_0x34ed00[_0x59d6('0x4f')][_0x59d6('0x57')]=_0x34ed00[_0x59d6('0x4f')][_0x59d6('0x57')]||_0x34ed00[_0x59d6('0x60')]['id'];_0x8726aa[_0x59d6('0x6c')]['id']=_0x34ed00[_0x59d6('0x4f')][_0x59d6('0x57')];return db[_0x59d6('0x36')][_0x59d6('0x50')]({'where':{'id':_0x34ed00[_0x59d6('0x4d')]['id'],'UserId':null}})[_0x59d6('0x1f')](handleEntityNotFound(_0x5b0fd6,null))['then'](function(_0x4cca40){if(_0x4cca40){_0x8726aa[_0x59d6('0x24')]=_0x4cca40[_0x59d6('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0x59d6('0x50')]({'where':{'id':_0x4cca40[_0x59d6('0x5a')]}});}return null;})['then'](handleEntityNotFound(_0x5b0fd6,null))[_0x59d6('0x1f')](function(_0x15970a){if(_0x15970a){_0x8726aa['interaction']=_0x15970a['get']({'plain':!![]});interaction_log[_0x59d6('0x20')](_0x59d6('0x6d'),_0x34ed00[_0x59d6('0x60')]['id'],_0x34ed00['user'][_0x59d6('0x32')],_0x34ed00[_0x59d6('0x60')][_0x59d6('0x61')],_0x8726aa[_0x59d6('0x62')]['id'],_0x34ed00[_0x59d6('0x4f')]?JSON[_0x59d6('0x21')](_0x34ed00['body']):_0x59d6('0x63'));return respondWithRpcPromise(_0x59d6('0x6e'),_0x59d6('0x6f'),_0x8726aa);}return null;})['then'](function(_0x188038){if(_0x188038){_0x188038[_0x59d6('0x24')]['interface']=util[_0x59d6('0x66')](_0x59d6('0x67'),_0x34ed00[_0x59d6('0x60')][_0x59d6('0x32')]);_0x188038[_0x59d6('0x24')]['channel']=_0x8726aa[_0x59d6('0x68')];_0x188038[_0x59d6('0x24')][_0x59d6('0x69')]=_0x59d6('0x6b');respondWithRpcPromise(_0x59d6('0x6a'),_0x59d6('0x6a'),{'event':'rejectmessage','message':_0x188038[_0x59d6('0x24')]},client9002);return _0x8726aa;}return null;})[_0x59d6('0x1f')](respondWithResult(_0x5b0fd6,null))['catch'](handleError(_0x5b0fd6,null));};exports[_0x59d6('0x70')]=function(_0x59d7d3,_0x5efec6){var _0x2000f2;return db[_0x59d6('0x36')][_0x59d6('0x70')](_0x59d7d3[_0x59d6('0x4f')],{})[_0x59d6('0x1f')](function(_0x384c03){_0x2000f2=_0x384c03;return db[_0x59d6('0x71')]['findOne']({'where':{'id':_0x2000f2['ContactId']}});})[_0x59d6('0x1f')](function(_0x182ea1){if(_['isNil'](_0x182ea1)){return;}else{_0x2000f2[_0x59d6('0x55')]=_0x182ea1[_0x59d6('0x55')];return db[_0x59d6('0x72')][_0x59d6('0x73')]({'where':{'id':_0x2000f2[_0x59d6('0x74')]}});}})['then'](function(_0x46f7a0){return respondWithRpcPromise(_0x59d6('0x75'),_0x59d6('0x75'),{'FaxAccountId':_['isNil'](_0x59d7d3[_0x59d6('0x4f')])?undefined:_0x59d7d3[_0x59d6('0x4f')][_0x59d6('0x76')],'path':_[_0x59d6('0x5b')](_0x46f7a0)?undefined:util[_0x59d6('0x66')](_0x59d6('0x77'),_0x46f7a0[_0x59d6('0x78')]),'fax':_[_0x59d6('0x5b')](_0x2000f2[_0x59d6('0x55')])?undefined:_0x2000f2[_0x59d6('0x55')],'AttachmentId':_0x2000f2['AttachmentId']},client9002);})[_0x59d6('0x1f')](respondWithResult(_0x5efec6,0xc9))[_0x59d6('0x27')](handleError(_0x5efec6,null));};exports[_0x59d6('0x79')]=function(_0x20d5e4,_0x1e39c5){var _0x6f6936=path[_0x59d6('0x7a')](config[_0x59d6('0x7b')],_0x59d6('0x7c'),_0x59d6('0x7d'),'attachments');return db[_0x59d6('0x36')][_0x59d6('0x50')]({'where':{'id':_0x20d5e4['params']['id']},'include':[{'model':db[_0x59d6('0x72')],'as':_0x59d6('0x72')}]})[_0x59d6('0x1f')](handleEntityNotFound(_0x1e39c5,null))[_0x59d6('0x1f')](function(_0x451f61){if(_0x451f61){return _0x1e39c5[_0x59d6('0x79')](path[_0x59d6('0x7a')](_0x6f6936,_0x451f61['Attachment'][_0x59d6('0x78')]));}})[_0x59d6('0x27')](handleError(_0x1e39c5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8140892..6975684 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x34e8,0x12c));var _0x834e=function(_0x17b2a0,_0x4e423b){_0x17b2a0=_0x17b2a0-0x0;var _0x297343=_0x34e8[_0x17b2a0];return _0x297343;};'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 +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x3e451f,_0x10500d){var _0x57978f=function(_0x52f960){while(--_0x52f960){_0x3e451f['push'](_0x3e451f['shift']());}};_0x57978f(++_0x10500d);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 412890f..05bce15 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 _0x7a9d=['fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x1b07fe,_0x5c7b78){var _0x44020a=function(_0x5adba5){while(--_0x5adba5){_0x1b07fe['push'](_0x1b07fe['shift']());}};_0x44020a(++_0x5c7b78);}(_0x7a9d,0xd6));var _0xd7a9=function(_0x29fe50,_0x4bd611){_0x29fe50=_0x29fe50-0x0;var _0x12cd09=_0x7a9d[_0x29fe50];return _0x12cd09;};'use strict';var _=require(_0xd7a9('0x0'));var util=require(_0xd7a9('0x1'));var logger=require(_0xd7a9('0x2'))(_0xd7a9('0x3'));var moment=require(_0xd7a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7a9('0x5'));var fs=require('fs');var path=require(_0xd7a9('0x6'));var rimraf=require(_0xd7a9('0x7'));var config=require(_0xd7a9('0x8'));var attributes=require(_0xd7a9('0x9'));module['exports']=function(_0x3ebcb0,_0x296971){return _0x3ebcb0['define']('FaxMessage',attributes,{'tableName':_0xd7a9('0xa'),'paranoid':![],'indexes':[{'name':_0xd7a9('0xb'),'fields':[_0xd7a9('0xc')],'type':_0xd7a9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x540f65,_0x339d98,_0x2eaa06){var _0x7f0791=_0x3ebcb0[_0xd7a9('0xe')];var _0x2c52fe=_0x540f65[_0xd7a9('0xf')]({'plain':!![]});if(_0x2c52fe[_0xd7a9('0x10')]['toLowerCase']()==='in'||_0x2c52fe[_0xd7a9('0x10')][_0xd7a9('0x11')]()===_0xd7a9('0x12')&&!_0x2c52fe[_0xd7a9('0x13')]&&!_[_0xd7a9('0x14')](_0x2c52fe['UserId'])){_0x7f0791['FaxInteraction'][_0xd7a9('0x15')]({'where':{'id':_0x2c52fe[_0xd7a9('0x16')]}})[_0xd7a9('0x17')](function(_0x277b22){if(_0x277b22){_0x277b22[_0xd7a9('0x18')]({'lastMsgAt':_0x2c52fe['createdAt'],'lastMsgDirection':_0x2c52fe['direction'][_0xd7a9('0x11')]()});}})[_0xd7a9('0x19')](function(_0x3130e7){console[_0xd7a9('0x1a')](_0x3130e7);});}_0x2eaa06();}},'charset':_0xd7a9('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5d97=['direction','toLowerCase','out','UserId','FaxInteraction','findOne','then','catch','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get'];(function(_0x54e431,_0x34d699){var _0x9f8efe=function(_0x5b5e73){while(--_0x5b5e73){_0x54e431['push'](_0x54e431['shift']());}};_0x9f8efe(++_0x34d699);}(_0x5d97,0x105));var _0x75d9=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x5d97[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x75d9('0x0'));var logger=require(_0x75d9('0x1'))('api');var moment=require(_0x75d9('0x2'));var BPromise=require(_0x75d9('0x3'));var rp=require(_0x75d9('0x4'));var fs=require('fs');var path=require(_0x75d9('0x5'));var rimraf=require('rimraf');var config=require(_0x75d9('0x6'));var attributes=require(_0x75d9('0x7'));module['exports']=function(_0x50f4ae,_0xbaf2ac){return _0x50f4ae[_0x75d9('0x8')](_0x75d9('0x9'),attributes,{'tableName':_0x75d9('0xa'),'paranoid':![],'indexes':[{'name':_0x75d9('0xb'),'fields':[_0x75d9('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x247b03,_0x423d94,_0x15bcf4){var _0xdae0d=_0x50f4ae[_0x75d9('0xd')];var _0x2fca99=_0x247b03[_0x75d9('0xe')]({'plain':!![]});if(_0x2fca99[_0x75d9('0xf')]['toLowerCase']()==='in'||_0x2fca99['direction'][_0x75d9('0x10')]()===_0x75d9('0x11')&&!_0x2fca99['secret']&&!_['isNil'](_0x2fca99[_0x75d9('0x12')])){_0xdae0d[_0x75d9('0x13')][_0x75d9('0x14')]({'where':{'id':_0x2fca99['FaxInteractionId']}})[_0x75d9('0x15')](function(_0x33106d){if(_0x33106d){_0x33106d['update']({'lastMsgAt':_0x2fca99['createdAt'],'lastMsgDirection':_0x2fca99['direction'][_0x75d9('0x10')]()});}})[_0x75d9('0x16')](function(_0x42b700){console['error'](_0x42b700);});}_0x15bcf4();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d793813..66edfdb 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 _0x8665=['code','FaxMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateFaxMessage','FaxMessage','create','body','raw','then','options','where','limit','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f9cdd,_0x30466b){var _0x4b6ebb=function(_0x545b70){while(--_0x545b70){_0x1f9cdd['push'](_0x1f9cdd['shift']());}};_0x4b6ebb(++_0x30466b);}(_0x8665,0x130));var _0x5866=function(_0x37635e,_0x21b6f5){_0x37635e=_0x37635e-0x0;var _0x3c0965=_0x8665[_0x37635e];return _0x3c0965;};'use strict';var _=require(_0x5866('0x0'));var util=require(_0x5866('0x1'));var moment=require(_0x5866('0x2'));var BPromise=require(_0x5866('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5866('0x4'));var db=require(_0x5866('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5866('0x6'));var config=require(_0x5866('0x7'));var jayson=require(_0x5866('0x8'));var client=jayson['client'][_0x5866('0x9')]({'port':0x232a});config[_0x5866('0xa')]=_['defaults'](config['redis'],{'host':_0x5866('0xb'),'port':0x18eb});var socket=require(_0x5866('0xc'))(new Redis(config[_0x5866('0xa')]));require(_0x5866('0xd'))[_0x5866('0xe')](socket);function respondWithRpcPromise(_0x486b3a,_0x2c63a8,_0x59ce50){return new BPromise(function(_0x286d4e,_0xd760f9){return client['request'](_0x486b3a,_0x59ce50)['then'](function(_0xb66a89){logger[_0x5866('0xf')]('FaxMessage,\x20%s,\x20%s',_0x2c63a8,'request\x20sent');logger[_0x5866('0x10')](_0x5866('0x11'),_0x2c63a8,'request\x20sent',JSON[_0x5866('0x12')](_0xb66a89));if(_0xb66a89[_0x5866('0x13')]){if(_0xb66a89[_0x5866('0x13')][_0x5866('0x14')]===0x1f4){logger[_0x5866('0x13')](_0x5866('0x15'),_0x2c63a8,_0xb66a89[_0x5866('0x13')]['message']);return _0xd760f9(_0xb66a89[_0x5866('0x13')][_0x5866('0x16')]);}logger[_0x5866('0x13')](_0x5866('0x15'),_0x2c63a8,_0xb66a89['error'][_0x5866('0x16')]);return _0x286d4e(_0xb66a89[_0x5866('0x13')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2c63a8,_0x5866('0x17'));_0x286d4e(_0xb66a89[_0x5866('0x18')]['message']);}})[_0x5866('0x19')](function(_0x42f9d7){logger[_0x5866('0x13')](_0x5866('0x15'),_0x2c63a8,_0x42f9d7);_0xd760f9(_0x42f9d7);});});}exports[_0x5866('0x1a')]=function(_0x179999){var _0x59e504=this;return new Promise(function(_0x5021fc,_0x4f4075){return db[_0x5866('0x1b')][_0x5866('0x1c')](_0x179999[_0x5866('0x1d')],{'raw':_0x179999['options']?_0x179999['options'][_0x5866('0x1e')]===undefined?!![]:![]:!![]})[_0x5866('0x1f')](function(_0x4e7b35){logger[_0x5866('0xf')](_0x5866('0x1a'),_0x179999);logger[_0x5866('0x10')](_0x5866('0x1a'),_0x179999,JSON[_0x5866('0x12')](_0x4e7b35));_0x5021fc(_0x4e7b35);})[_0x5866('0x19')](function(_0x4ae68d){logger[_0x5866('0x13')](_0x5866('0x1a'),_0x4ae68d['message'],_0x179999);_0x4f4075(_0x59e504[_0x5866('0x13')](0x1f4,_0x4ae68d[_0x5866('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x49c2f1){var _0xa3cd55=this;return new Promise(function(_0x6cfdcf,_0x1c28fe){return db['FaxMessage']['update'](_0x49c2f1[_0x5866('0x1d')],{'raw':_0x49c2f1[_0x5866('0x20')]?_0x49c2f1[_0x5866('0x20')][_0x5866('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49c2f1[_0x5866('0x20')]?_0x49c2f1['options'][_0x5866('0x21')]||null:null,'attributes':_0x49c2f1[_0x5866('0x20')]?_0x49c2f1[_0x5866('0x20')]['attributes']||null:null,'limit':_0x49c2f1[_0x5866('0x20')]?_0x49c2f1['options'][_0x5866('0x22')]||null:null})[_0x5866('0x1f')](function(_0x6a6f4c){logger[_0x5866('0xf')](_0x5866('0x23'),_0x49c2f1);logger[_0x5866('0x10')](_0x5866('0x23'),_0x49c2f1,JSON['stringify'](_0x6a6f4c));_0x6cfdcf(_0x6a6f4c);})[_0x5866('0x19')](function(_0x299df9){logger['error'](_0x5866('0x23'),_0x299df9['message'],_0x49c2f1);_0x1c28fe(_0xa3cd55['error'](0x1f4,_0x299df9['message']));});});}; \ No newline at end of file +var _0x82cf=['limit','UpdateFaxMessage','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','redis','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','update','attributes'];(function(_0x437b8a,_0x11701f){var _0x3b227c=function(_0x3249cc){while(--_0x3249cc){_0x437b8a['push'](_0x437b8a['shift']());}};_0x3b227c(++_0x11701f);}(_0x82cf,0xc8));var _0xf82c=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x82cf[_0x51b1a5];return _0x15c738;};'use strict';var _=require('lodash');var util=require(_0xf82c('0x0'));var moment=require(_0xf82c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf82c('0x2'));var db=require(_0xf82c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf82c('0x4'))(_0xf82c('0x5'));var config=require(_0xf82c('0x6'));var jayson=require(_0xf82c('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xf82c('0x8')](config['redis'],{'host':_0xf82c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf82c('0xa')]));require(_0xf82c('0xb'))[_0xf82c('0xc')](socket);function respondWithRpcPromise(_0x17c1d0,_0xc92c97,_0x23da80){return new BPromise(function(_0x9fd421,_0x54ac32){return client[_0xf82c('0xd')](_0x17c1d0,_0x23da80)['then'](function(_0x34e7da){logger[_0xf82c('0xe')](_0xf82c('0xf'),_0xc92c97,'request\x20sent');logger[_0xf82c('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xc92c97,_0xf82c('0x11'),JSON['stringify'](_0x34e7da));if(_0x34e7da[_0xf82c('0x12')]){if(_0x34e7da[_0xf82c('0x12')][_0xf82c('0x13')]===0x1f4){logger[_0xf82c('0x12')](_0xf82c('0xf'),_0xc92c97,_0x34e7da['error'][_0xf82c('0x14')]);return _0x54ac32(_0x34e7da[_0xf82c('0x12')][_0xf82c('0x14')]);}logger[_0xf82c('0x12')](_0xf82c('0xf'),_0xc92c97,_0x34e7da[_0xf82c('0x12')]['message']);return _0x9fd421(_0x34e7da[_0xf82c('0x12')][_0xf82c('0x14')]);}else{logger[_0xf82c('0xe')](_0xf82c('0xf'),_0xc92c97,'request\x20sent');_0x9fd421(_0x34e7da['result'][_0xf82c('0x14')]);}})['catch'](function(_0x461510){logger[_0xf82c('0x12')]('FaxMessage,\x20%s,\x20%s',_0xc92c97,_0x461510);_0x54ac32(_0x461510);});});}exports[_0xf82c('0x15')]=function(_0x4270a3){var _0x282665=this;return new Promise(function(_0x2ea54d,_0x2a0a2b){return db[_0xf82c('0x16')][_0xf82c('0x17')](_0x4270a3[_0xf82c('0x18')],{'raw':_0x4270a3[_0xf82c('0x19')]?_0x4270a3[_0xf82c('0x19')][_0xf82c('0x1a')]===undefined?!![]:![]:!![]})[_0xf82c('0x1b')](function(_0x7b94e4){logger[_0xf82c('0xe')](_0xf82c('0x15'),_0x4270a3);logger[_0xf82c('0x10')](_0xf82c('0x15'),_0x4270a3,JSON[_0xf82c('0x1c')](_0x7b94e4));_0x2ea54d(_0x7b94e4);})['catch'](function(_0x2c4ddc){logger['error']('CreateFaxMessage',_0x2c4ddc[_0xf82c('0x14')],_0x4270a3);_0x2a0a2b(_0x282665[_0xf82c('0x12')](0x1f4,_0x2c4ddc['message']));});});};exports['UpdateFaxMessage']=function(_0xde9fd5){var _0x3b5f12=this;return new Promise(function(_0x51f531,_0x46c054){return db['FaxMessage'][_0xf82c('0x1d')](_0xde9fd5['body'],{'raw':_0xde9fd5[_0xf82c('0x19')]?_0xde9fd5[_0xf82c('0x19')][_0xf82c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xde9fd5[_0xf82c('0x19')]?_0xde9fd5['options']['where']||null:null,'attributes':_0xde9fd5[_0xf82c('0x19')]?_0xde9fd5['options'][_0xf82c('0x1e')]||null:null,'limit':_0xde9fd5[_0xf82c('0x19')]?_0xde9fd5[_0xf82c('0x19')][_0xf82c('0x1f')]||null:null})[_0xf82c('0x1b')](function(_0x51007c){logger[_0xf82c('0xe')]('UpdateFaxMessage',_0xde9fd5);logger[_0xf82c('0x10')](_0xf82c('0x20'),_0xde9fd5,JSON['stringify'](_0x51007c));_0x51f531(_0x51007c);})['catch'](function(_0xc51cd0){logger[_0xf82c('0x12')](_0xf82c('0x20'),_0xc51cd0[_0xf82c('0x14')],_0xde9fd5);_0x46c054(_0x3b5f12[_0xf82c('0x12')](0x1f4,_0xc51cd0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a4559ab..914ba10 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(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_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 +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 da5a808..7a7cddc 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 _0x3c67=['/:id/accept','accept','/:id/reject','reject','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','/:id','show','/:id/download','isAuthenticated','download','tracked','fax','put'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x3c67,0x131));var _0x73c6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3c67[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x73c6('0x0'));var path=require(_0x73c6('0x1'));var timeout=require(_0x73c6('0x2'));var express=require(_0x73c6('0x3'));var router=express[_0x73c6('0x4')]();var auth=require(_0x73c6('0x5'));var interaction=require(_0x73c6('0x6'));var config=require(_0x73c6('0x7'));var controller=require(_0x73c6('0x8'));router[_0x73c6('0x9')]('/',auth['isAuthenticated'](),controller[_0x73c6('0xa')]);router[_0x73c6('0x9')](_0x73c6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x73c6('0x9')](_0x73c6('0xc'),auth['isAuthenticated'](),controller[_0x73c6('0xd')]);router[_0x73c6('0x9')](_0x73c6('0xe'),auth[_0x73c6('0xf')](),controller[_0x73c6('0x10')]);router['post']('/',auth[_0x73c6('0xf')](),interaction[_0x73c6('0x11')](_0x73c6('0x12'),'faxmessage:create'),controller['create']);router['put'](_0x73c6('0xc'),auth[_0x73c6('0xf')](),controller['update']);router[_0x73c6('0x13')](_0x73c6('0x14'),auth[_0x73c6('0xf')](),controller[_0x73c6('0x15')]);router[_0x73c6('0x13')](_0x73c6('0x16'),auth[_0x73c6('0xf')](),controller[_0x73c6('0x17')]);router[_0x73c6('0x18')]('/:id',auth[_0x73c6('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xedd0=['post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xedd0,0x110));var _0x0edd=function(_0x50feda,_0xff7bbe){_0x50feda=_0x50feda-0x0;var _0x144f6e=_0xedd0[_0x50feda];return _0x144f6e;};'use strict';var multer=require('multer');var util=require(_0x0edd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0edd('0x1'));var router=express[_0x0edd('0x2')]();var auth=require(_0x0edd('0x3'));var interaction=require(_0x0edd('0x4'));var config=require(_0x0edd('0x5'));var controller=require(_0x0edd('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0edd('0x7')](_0x0edd('0x8'),auth[_0x0edd('0x9')](),controller[_0x0edd('0xa')]);router['get'](_0x0edd('0xb'),auth[_0x0edd('0x9')](),controller[_0x0edd('0xc')]);router[_0x0edd('0x7')](_0x0edd('0xd'),auth[_0x0edd('0x9')](),controller['download']);router[_0x0edd('0xe')]('/',auth[_0x0edd('0x9')](),interaction[_0x0edd('0xf')](_0x0edd('0x10'),_0x0edd('0x11')),controller[_0x0edd('0x12')]);router[_0x0edd('0x13')](_0x0edd('0xb'),auth[_0x0edd('0x9')](),controller['update']);router['put'](_0x0edd('0x14'),auth[_0x0edd('0x9')](),controller[_0x0edd('0x15')]);router['put'](_0x0edd('0x16'),auth[_0x0edd('0x9')](),controller[_0x0edd('0x17')]);router[_0x0edd('0x18')](_0x0edd('0xb'),auth[_0x0edd('0x9')](),controller[_0x0edd('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5451514..00223b5 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 _0x44a3=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44a3,0x1a9));var _0x344a=function(_0x2d6df9,_0x45da50){_0x2d6df9=_0x2d6df9-0x0;var _0x429b18=_0x44a3[_0x2d6df9];return _0x429b18;};'use strict';var Sequelize=require(_0x344a('0x0'));module[_0x344a('0x1')]={'name':{'type':Sequelize[_0x344a('0x2')],'unique':_0x344a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x344a('0x2')]},'timeout':{'type':Sequelize[_0x344a('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x344a('0x5')](_0x344a('0x6'),'beepall',_0x344a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x344a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa142=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x4282d9,_0x158cd8){var _0x47c388=function(_0x33385b){while(--_0x33385b){_0x4282d9['push'](_0x4282d9['shift']());}};_0x47c388(++_0x158cd8);}(_0xa142,0x1eb));var _0x2a14=function(_0x15dc4a,_0x37ac48){_0x15dc4a=_0x15dc4a-0x0;var _0x23c048=_0xa142[_0x15dc4a];return _0x23c048;};'use strict';var Sequelize=require('sequelize');module[_0x2a14('0x0')]={'name':{'type':Sequelize[_0x2a14('0x1')],'unique':_0x2a14('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a14('0x1')]},'timeout':{'type':Sequelize[_0x2a14('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a14('0x4')](_0x2a14('0x5'),_0x2a14('0x6'),_0x2a14('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2a14('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 c69fc97..3ebe787 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 _0x8c7d=['fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','user','role','FaxQueues','UserProfileSection','autoAssociation','error','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','userFaxQueue:remove','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','offset','status','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','intersection','attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x2c0947,_0x3c7c78){_0x2c0947=_0x2c0947-0x0;var _0x55c180=_0x8c7d[_0x2c0947];return _0x55c180;};'use strict';var pdf=require(_0xd8c7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd8c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8c7('0x2'));var rp=require(_0xd8c7('0x3'));var moment=require(_0xd8c7('0x4'));var BPromise=require(_0xd8c7('0x5'));var Mustache=require(_0xd8c7('0x6'));var util=require(_0xd8c7('0x7'));var path=require(_0xd8c7('0x8'));var sox=require(_0xd8c7('0x9'));var csv=require(_0xd8c7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd8c7('0xb'));var crypto=require(_0xd8c7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd8c7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8c7('0xe'));var Redis=require(_0xd8c7('0xf'));var authService=require(_0xd8c7('0x10'));var qs=require(_0xd8c7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8c7('0x12'));var logger=require('../../config/logger')(_0xd8c7('0x13'));var utils=require(_0xd8c7('0x14'));var config=require(_0xd8c7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd8c7('0x16')](config[_0xd8c7('0x17')],{'host':_0xd8c7('0x18'),'port':0x18eb});var socket=require(_0xd8c7('0x19'))(new Redis(config[_0xd8c7('0x17')]));require('./faxQueue.socket')[_0xd8c7('0x1a')](socket);function respondWithStatusCode(_0x5ed37e,_0x4cf246){_0x4cf246=_0x4cf246||0xcc;return function(_0x378fbe){if(_0x378fbe){return _0x5ed37e[_0xd8c7('0x1b')](_0x4cf246);}return _0x5ed37e['status'](_0x4cf246)[_0xd8c7('0x1c')]();};}function respondWithResult(_0x4f1bbf,_0x5593f1){_0x5593f1=_0x5593f1||0xc8;return function(_0xb67ced){if(_0xb67ced){return _0x4f1bbf['status'](_0x5593f1)['json'](_0xb67ced);}};}function respondWithFilteredResult(_0x4d6b0e,_0x4e7592){return function(_0x54b772){if(_0x54b772){var _0x15d70c=_0x54b772['count'],_0x2d0408=_0x4e7592[_0xd8c7('0x1d')],_0x1f5019=_0x4e7592[_0xd8c7('0x1d')]+_0x4e7592['limit'],_0x3ce115;if(_0x1f5019>=_0x15d70c){_0x1f5019=_0x15d70c;_0x3ce115=0xc8;}else{_0x3ce115=0xce;}_0x4d6b0e[_0xd8c7('0x1e')](_0x3ce115);return _0x4d6b0e[_0xd8c7('0x1f')]('Content-Range',_0x2d0408+'-'+_0x1f5019+'/'+_0x15d70c)[_0xd8c7('0x20')](_0x54b772);}return null;};}function patchUpdates(_0x466f5b){return function(_0x32366b){try{jsonpatch[_0xd8c7('0x21')](_0x32366b,_0x466f5b,!![]);}catch(_0x1bb66e){return BPromise[_0xd8c7('0x22')](_0x1bb66e);}return _0x32366b[_0xd8c7('0x23')]();};}function saveUpdates(_0x530e0d,_0x4594e3){return function(_0x3bf864){if(_0x3bf864){return _0x3bf864[_0xd8c7('0x24')](_0x530e0d)[_0xd8c7('0x25')](function(_0x4cb023){return _0x4cb023;});}return null;};}function removeEntity(_0x326302,_0x12c0b0){return function(_0x531541){if(_0x531541){return _0x531541[_0xd8c7('0x26')]()[_0xd8c7('0x25')](function(){var _0x2b2ac1=_0x531541[_0xd8c7('0x27')]({'plain':!![]});var _0x534519='FaxQueues';return db[_0xd8c7('0x28')][_0xd8c7('0x26')]({'where':{'type':_0x534519,'resourceId':_0x2b2ac1['id']}})[_0xd8c7('0x25')](function(){return _0x531541;});})[_0xd8c7('0x25')](function(){_0x326302[_0xd8c7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0ff6,_0x3ec307){return function(_0x13cfc6){if(!_0x13cfc6){_0x3a0ff6[_0xd8c7('0x1b')](0x194);}return _0x13cfc6;};}function handleError(_0xd325e8,_0x3b2c71){_0x3b2c71=_0x3b2c71||0x1f4;return function(_0xcf5dd){logger['error'](_0xcf5dd[_0xd8c7('0x29')]);if(_0xcf5dd[_0xd8c7('0x2a')]){delete _0xcf5dd[_0xd8c7('0x2a')];}_0xd325e8['status'](_0x3b2c71)[_0xd8c7('0x2b')](_0xcf5dd);};}exports[_0xd8c7('0x2c')]=function(_0x1c9838,_0xd59cde){var _0xb58d8f={},_0x4e7323={},_0x14dd7e={'count':0x0,'rows':[]};var _0x4c3eee=_[_0xd8c7('0x2d')](db[_0xd8c7('0x2e')][_0xd8c7('0x2f')],function(_0x1f4afd){return{'name':_0x1f4afd[_0xd8c7('0x30')],'type':_0x1f4afd[_0xd8c7('0x31')]['key']};});_0x4e7323[_0xd8c7('0x32')]=_[_0xd8c7('0x2d')](_0x4c3eee,_0xd8c7('0x2a'));_0x4e7323['query']=_[_0xd8c7('0x33')](_0x1c9838[_0xd8c7('0x34')]);_0x4e7323['filters']=_[_0xd8c7('0x35')](_0x4e7323[_0xd8c7('0x32')],_0x4e7323[_0xd8c7('0x34')]);_0xb58d8f[_0xd8c7('0x36')]=_[_0xd8c7('0x35')](_0x4e7323[_0xd8c7('0x32')],qs[_0xd8c7('0x37')](_0x1c9838[_0xd8c7('0x34')][_0xd8c7('0x37')]));_0xb58d8f[_0xd8c7('0x36')]=_0xb58d8f[_0xd8c7('0x36')]['length']?_0xb58d8f[_0xd8c7('0x36')]:_0x4e7323['model'];if(!_0x1c9838['query']['hasOwnProperty'](_0xd8c7('0x38'))){_0xb58d8f[_0xd8c7('0x39')]=qs['limit'](_0x1c9838[_0xd8c7('0x34')]['limit']);_0xb58d8f[_0xd8c7('0x1d')]=qs[_0xd8c7('0x1d')](_0x1c9838[_0xd8c7('0x34')][_0xd8c7('0x1d')]);}_0xb58d8f['order']=qs[_0xd8c7('0x3a')](_0x1c9838['query'][_0xd8c7('0x3a')]);_0xb58d8f[_0xd8c7('0x3b')]=qs['filters'](_[_0xd8c7('0x3c')](_0x1c9838[_0xd8c7('0x34')],_0x4e7323['filters']),_0x4c3eee);if(_0x1c9838[_0xd8c7('0x34')][_0xd8c7('0x3d')]){_0xb58d8f['where']=_[_0xd8c7('0x3e')](_0xb58d8f[_0xd8c7('0x3b')],{'$or':_['map'](_0x4c3eee,function(_0x5dd312){if(_0x5dd312[_0xd8c7('0x31')]!==_0xd8c7('0x3f')){var _0x56c5e6={};_0x56c5e6[_0x5dd312[_0xd8c7('0x2a')]]={'$like':'%'+_0x1c9838[_0xd8c7('0x34')]['filter']+'%'};return _0x56c5e6;}})});}_0xb58d8f=_[_0xd8c7('0x3e')]({},_0xb58d8f,_0x1c9838[_0xd8c7('0x40')]);var _0x14f978={'where':_0xb58d8f['where']};return db['FaxQueue'][_0xd8c7('0x41')](_0x14f978)['then'](function(_0x3b72df){_0x14dd7e[_0xd8c7('0x41')]=_0x3b72df;if(_0x1c9838[_0xd8c7('0x34')][_0xd8c7('0x42')]){_0xb58d8f[_0xd8c7('0x43')]=[{'all':!![]}];}return db[_0xd8c7('0x2e')][_0xd8c7('0x44')](_0xb58d8f);})['then'](function(_0x2ec5fe){_0x14dd7e[_0xd8c7('0x45')]=_0x2ec5fe;return _0x14dd7e;})[_0xd8c7('0x25')](respondWithFilteredResult(_0xd59cde,_0xb58d8f))[_0xd8c7('0x46')](handleError(_0xd59cde,null));};exports[_0xd8c7('0x47')]=function(_0x23b6af,_0x4c405c){var _0x4e8163={'raw':!![],'where':{'id':_0x23b6af[_0xd8c7('0x48')]['id']}},_0x5874fa={};_0x5874fa[_0xd8c7('0x32')]=_['keys'](db['FaxQueue'][_0xd8c7('0x2f')]);_0x5874fa[_0xd8c7('0x34')]=_[_0xd8c7('0x33')](_0x23b6af[_0xd8c7('0x34')]);_0x5874fa[_0xd8c7('0x49')]=_[_0xd8c7('0x35')](_0x5874fa[_0xd8c7('0x32')],_0x5874fa['query']);_0x4e8163['attributes']=_[_0xd8c7('0x35')](_0x5874fa[_0xd8c7('0x32')],qs[_0xd8c7('0x37')](_0x23b6af[_0xd8c7('0x34')][_0xd8c7('0x37')]));_0x4e8163['attributes']=_0x4e8163['attributes']['length']?_0x4e8163[_0xd8c7('0x36')]:_0x5874fa[_0xd8c7('0x32')];if(_0x23b6af['query'][_0xd8c7('0x42')]){_0x4e8163[_0xd8c7('0x43')]=[{'all':!![]}];}_0x4e8163=_[_0xd8c7('0x3e')]({},_0x4e8163,_0x23b6af[_0xd8c7('0x40')]);return db[_0xd8c7('0x2e')][_0xd8c7('0x4a')](_0x4e8163)[_0xd8c7('0x25')](handleEntityNotFound(_0x4c405c,null))[_0xd8c7('0x25')](respondWithResult(_0x4c405c,null))['catch'](handleError(_0x4c405c,null));};exports[_0xd8c7('0x4b')]=function(_0x493030,_0x2357f4){return db[_0xd8c7('0x2e')][_0xd8c7('0x4b')](_0x493030[_0xd8c7('0x4c')],{})[_0xd8c7('0x25')](function(_0x13dbc7){var _0x40f617=_0x493030[_0xd8c7('0x4d')][_0xd8c7('0x27')]({'plain':!![]});if(!_0x40f617)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40f617[_0xd8c7('0x4e')]==='user'){var _0x5aa970=_0x13dbc7[_0xd8c7('0x27')]({'plain':!![]});var _0x5dbd10=_0xd8c7('0x4f');return db[_0xd8c7('0x50')]['find']({'where':{'name':_0x5dbd10,'userProfileId':_0x40f617['userProfileId']},'raw':!![]})['then'](function(_0x215035){if(_0x215035&&_0x215035[_0xd8c7('0x51')]===0x0){return db[_0xd8c7('0x28')]['create']({'name':_0x5aa970['name'],'resourceId':_0x5aa970['id'],'type':_0x215035[_0xd8c7('0x2a')],'sectionId':_0x215035['id']},{})[_0xd8c7('0x25')](function(){return _0x13dbc7;});}else{return _0x13dbc7;}})[_0xd8c7('0x46')](function(_0x4c740a){logger[_0xd8c7('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c740a);throw _0x4c740a;});}return _0x13dbc7;})[_0xd8c7('0x25')](respondWithResult(_0x2357f4,0xc9))[_0xd8c7('0x46')](handleError(_0x2357f4,null));};exports['update']=function(_0xdef8c0,_0x432b94){if(_0xdef8c0['body']['id']){delete _0xdef8c0['body']['id'];}return db[_0xd8c7('0x2e')][_0xd8c7('0x4a')]({'where':{'id':_0xdef8c0[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](handleEntityNotFound(_0x432b94,null))['then'](saveUpdates(_0xdef8c0[_0xd8c7('0x4c')],null))[_0xd8c7('0x25')](respondWithResult(_0x432b94,null))[_0xd8c7('0x46')](handleError(_0x432b94,null));};exports[_0xd8c7('0x26')]=function(_0x1c5aae,_0x3b6c23){return db[_0xd8c7('0x2e')][_0xd8c7('0x4a')]({'where':{'id':_0x1c5aae[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](handleEntityNotFound(_0x3b6c23,null))[_0xd8c7('0x25')](removeEntity(_0x3b6c23,null))[_0xd8c7('0x46')](handleError(_0x3b6c23,null));};exports['describe']=function(_0x5f0aac,_0x59eff2){return db[_0xd8c7('0x2e')]['describe']()[_0xd8c7('0x25')](respondWithResult(_0x59eff2,null))['catch'](handleError(_0x59eff2,null));};exports[_0xd8c7('0x53')]=function(_0x4b1562,_0x385794,_0x1ff926){var _0x3135fc={'raw':!![],'where':{}},_0x1b3976={},_0x199795;return db[_0xd8c7('0x2e')][_0xd8c7('0x54')]({'where':{'id':_0x4b1562[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](handleEntityNotFound(_0x385794,null))['then'](function(_0x1675f6){if(_0x1675f6){_0x199795=_0x1675f6[_0xd8c7('0x27')]({'plain':!![]});_0x1b3976[_0xd8c7('0x32')]=_[_0xd8c7('0x33')](db[_0xd8c7('0x55')][_0xd8c7('0x2f')]);_0x1b3976[_0xd8c7('0x34')]=_[_0xd8c7('0x33')](_0x4b1562['query']);_0x1b3976[_0xd8c7('0x49')]=_[_0xd8c7('0x35')](_0x1b3976['model'],_0x1b3976[_0xd8c7('0x34')]);_0x3135fc[_0xd8c7('0x36')]=_['intersection'](_0x1b3976[_0xd8c7('0x32')],qs[_0xd8c7('0x37')](_0x4b1562['query'][_0xd8c7('0x37')]));_0x3135fc[_0xd8c7('0x36')]=_0x3135fc[_0xd8c7('0x36')]['length']?_0x3135fc['attributes']:_0x1b3976[_0xd8c7('0x32')];if(!_0x4b1562[_0xd8c7('0x34')][_0xd8c7('0x56')](_0xd8c7('0x38'))){_0x3135fc[_0xd8c7('0x39')]=qs[_0xd8c7('0x39')](_0x4b1562[_0xd8c7('0x34')][_0xd8c7('0x39')]);_0x3135fc['offset']=qs[_0xd8c7('0x1d')](_0x4b1562[_0xd8c7('0x34')][_0xd8c7('0x1d')]);}_0x3135fc[_0xd8c7('0x57')]=qs[_0xd8c7('0x3a')](_0x4b1562[_0xd8c7('0x34')][_0xd8c7('0x3a')]);_0x3135fc[_0xd8c7('0x3b')]=qs[_0xd8c7('0x49')](_['pick'](_0x4b1562[_0xd8c7('0x34')],_0x1b3976[_0xd8c7('0x49')]));_0x3135fc[_0xd8c7('0x3b')][_0xd8c7('0x58')]=_0x1675f6['id'];if(_0x4b1562[_0xd8c7('0x34')][_0xd8c7('0x3d')]){_0x3135fc['where']=_[_0xd8c7('0x3e')](_0x3135fc[_0xd8c7('0x3b')],{'$or':_[_0xd8c7('0x2d')](_0x3135fc[_0xd8c7('0x36')],function(_0x4597d2){var _0x905875={};_0x905875[_0x4597d2]={'$like':'%'+_0x4b1562[_0xd8c7('0x34')][_0xd8c7('0x3d')]+'%'};return _0x905875;})});}_0x3135fc=_[_0xd8c7('0x3e')]({},_0x3135fc,_0x4b1562[_0xd8c7('0x40')]);return db[_0xd8c7('0x55')]['findAll'](_0x3135fc);}})[_0xd8c7('0x25')](function(_0x1de72c){if(_0x1de72c){return db['User'][_0xd8c7('0x59')]({'where':{'id':_[_0xd8c7('0x2d')](_0x1de72c,_0xd8c7('0x5a')),'role':_0xd8c7('0x5b')},'attributes':['id',_0xd8c7('0x2a'),_0xd8c7('0x5c'),_0xd8c7('0x5d'),'createdAt']});}})['then'](function(_0x45fbd7){if(_0x45fbd7){return{'count':_0x45fbd7[_0xd8c7('0x41')],'rows':_[_0xd8c7('0x2d')](_0x45fbd7[_0xd8c7('0x45')],function(_0x452021){return{'membername':_0x452021[_0xd8c7('0x2a')],'UserId':_0x452021['id'],'queue_name':_0x199795[_0xd8c7('0x2a')],'FaxQueueId':_0x199795['id'],'interface':util[_0xd8c7('0x5e')](_0xd8c7('0x5f'),_0xd8c7('0x60'),_0x452021[_0xd8c7('0x2a')]),'penalty':0x0,'paused':_0x452021['faxPause'],'createdAt':_0x452021[_0xd8c7('0x61')],'updatedAt':_0x452021[_0xd8c7('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd8c7('0x25')](respondWithFilteredResult(_0x385794,_0x3135fc))[_0xd8c7('0x46')](handleError(_0x385794,null));};exports[_0xd8c7('0x62')]=function(_0x15a7d6,_0x2e48af,_0x3cdaeb){var _0x1a149e={};var _0x465fa5={};var _0x5be6bb;var _0x462645;return db[_0xd8c7('0x2e')]['findOne']({'where':{'id':_0x15a7d6[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](handleEntityNotFound(_0x2e48af,null))['then'](function(_0x389ca4){if(_0x389ca4){_0x5be6bb=_0x389ca4;_0x465fa5[_0xd8c7('0x32')]=_[_0xd8c7('0x33')](db[_0xd8c7('0x63')]['rawAttributes']);_0x465fa5['query']=_[_0xd8c7('0x33')](_0x15a7d6['query']);_0x465fa5['filters']=_[_0xd8c7('0x35')](_0x465fa5[_0xd8c7('0x32')],_0x465fa5['query']);_0x1a149e[_0xd8c7('0x36')]=_[_0xd8c7('0x35')](_0x465fa5[_0xd8c7('0x32')],qs[_0xd8c7('0x37')](_0x15a7d6[_0xd8c7('0x34')][_0xd8c7('0x37')]));_0x1a149e[_0xd8c7('0x36')]=_0x1a149e['attributes'][_0xd8c7('0x64')]?_0x1a149e[_0xd8c7('0x36')]:_0x465fa5['model'];_0x1a149e['order']=qs[_0xd8c7('0x3a')](_0x15a7d6[_0xd8c7('0x34')]['sort']);_0x1a149e[_0xd8c7('0x3b')]=qs['filters'](_['pick'](_0x15a7d6[_0xd8c7('0x34')],_0x465fa5[_0xd8c7('0x49')]));if(_0x15a7d6[_0xd8c7('0x34')][_0xd8c7('0x3d')]){_0x1a149e['where']=_[_0xd8c7('0x3e')](_0x1a149e['where'],{'$or':_[_0xd8c7('0x2d')](_0x1a149e[_0xd8c7('0x36')],function(_0x30169f){var _0x238a01={};_0x238a01[_0x30169f]={'$like':'%'+_0x15a7d6[_0xd8c7('0x34')][_0xd8c7('0x3d')]+'%'};return _0x238a01;})});}_0x1a149e=_[_0xd8c7('0x3e')]({},_0x1a149e,_0x15a7d6[_0xd8c7('0x40')]);return _0x5be6bb[_0xd8c7('0x62')](_0x1a149e);}})[_0xd8c7('0x25')](function(_0x143d77){if(_0x143d77){_0x462645=_0x143d77['length'];if(!_0x15a7d6[_0xd8c7('0x34')][_0xd8c7('0x56')](_0xd8c7('0x38'))){_0x1a149e[_0xd8c7('0x39')]=qs[_0xd8c7('0x39')](_0x15a7d6[_0xd8c7('0x34')][_0xd8c7('0x39')]);_0x1a149e['offset']=qs['offset'](_0x15a7d6[_0xd8c7('0x34')][_0xd8c7('0x1d')]);}return _0x5be6bb[_0xd8c7('0x62')](_0x1a149e);}})[_0xd8c7('0x25')](function(_0x28eb22){if(_0x28eb22){return _0x28eb22?{'count':_0x462645,'rows':_0x28eb22}:null;}})['then'](respondWithResult(_0x2e48af,null))[_0xd8c7('0x46')](handleError(_0x2e48af,null));};exports[_0xd8c7('0x65')]=function(_0x5917a1,_0x57c98d,_0x34e2ec){var _0x58d90d=_0x5917a1[_0xd8c7('0x4c')][_0xd8c7('0x66')];return db[_0xd8c7('0x63')]['findAll']({'where':{'id':_0x58d90d},'attributes':['id'],'include':[{'model':db[_0xd8c7('0x67')],'as':_0xd8c7('0x68'),'attributes':['id',_0xd8c7('0x2a'),_0xd8c7('0x69'),_0xd8c7('0x6a'),_0xd8c7('0x6b')],'raw':!![]}]})['then'](function(_0x573d1f){if(_0x573d1f){var _0x428cfb=_[_0xd8c7('0x6c')](_0x573d1f,function(_0x3a61e7){var _0x573b13=_0x3a61e7[_0xd8c7('0x27')]({'plain':!![]});return _0x573b13[_0xd8c7('0x68')];});return db[_0xd8c7('0x2e')][_0xd8c7('0x4a')]({'where':{'id':_0x5917a1[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](function(_0x158b5a){return db[_0xd8c7('0x6d')][_0xd8c7('0x6e')](function(_0x45a65e){return _0x158b5a[_0xd8c7('0x65')](_0x58d90d,{'transaction':_0x45a65e})[_0xd8c7('0x25')](function(){return BPromise[_0xd8c7('0x6f')](_0x428cfb,function(_0x27459a){return db[_0xd8c7('0x55')][_0xd8c7('0x70')]({'where':{'UserId':_0x27459a['id'],'FaxQueueId':_0x5917a1['params']['id']},'transaction':_0x45a65e});});})['then'](function(){_0x428cfb[_0xd8c7('0x71')](function(_0xfcb6ed){socket[_0xd8c7('0x72')]('userFaxQueue:save',{'UserId':_0xfcb6ed['id'],'FaxQueueId':_0x158b5a['id']});});});});});}})[_0xd8c7('0x25')](respondWithStatusCode(_0x57c98d,null))[_0xd8c7('0x46')](handleError(_0x57c98d,null));};exports[_0xd8c7('0x73')]=function(_0x12cc75,_0x282136,_0x1d7cc6){return db[_0xd8c7('0x63')][_0xd8c7('0x44')]({'where':{'id':_0x12cc75[_0xd8c7('0x34')][_0xd8c7('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd8c7('0x67')],'as':_0xd8c7('0x68'),'attributes':['id'],'raw':!![]}]})[_0xd8c7('0x25')](handleEntityNotFound(_0x282136,null))['then'](function(_0x2e78ef){var _0x48990c=_[_0xd8c7('0x2d')](_0x2e78ef,'id');var _0x1d79bd=[];var _0x474191=[];var _0x401fc8=squel[_0xd8c7('0x74')]();_0x401fc8[_0xd8c7('0x75')](_0xd8c7('0x76'))[_0xd8c7('0x77')]('team_has_fax_queues','tq')[_0xd8c7('0x78')]('user_has_teams','ut',_0xd8c7('0x79'))[_0xd8c7('0x3b')](_0xd8c7('0x7a'),_0x12cc75[_0xd8c7('0x48')]['id']);for(var _0x28d03a=0x0;_0x28d03a<_0x2e78ef[_0xd8c7('0x64')];_0x28d03a+=0x1){let _0x5016a1=_0x2e78ef[_0x28d03a];for(var _0x3f1476=0x0;_0x3f1476<_0x5016a1[_0xd8c7('0x68')][_0xd8c7('0x64')];_0x3f1476+=0x1){let _0x3085d9=_0x5016a1[_0xd8c7('0x68')][_0x3f1476];var _0x16391a=_0x401fc8[_0xd8c7('0x7b')]();_0x16391a[_0xd8c7('0x3b')](_0xd8c7('0x7c'),_0x3085d9['id']);_0x474191[_0xd8c7('0x7d')](db[_0xd8c7('0x6d')][_0xd8c7('0x34')](_0x16391a[_0xd8c7('0x7e')](),{'type':db[_0xd8c7('0x6d')][_0xd8c7('0x7f')][_0xd8c7('0x80')]})[_0xd8c7('0x25')](function(_0x4e5b9d){if(_0x4e5b9d[_0xd8c7('0x64')]===0x1){return _0x3085d9['id'];}else{var _0x4f0d2f=_['every'](_[_0xd8c7('0x2d')](_0x4e5b9d,_0xd8c7('0x81')),function(_0x11d67f){return _[_0xd8c7('0x82')](_0x48990c,_0x11d67f);});if(_0x4f0d2f){return _0x3085d9['id'];}}}));}}return BPromise[_0xd8c7('0x83')](_0x474191)[_0xd8c7('0x25')](function(_0x342bd4){_0x1d79bd=_(_0x1d79bd)[_0xd8c7('0x84')](_0x342bd4)[_0xd8c7('0x85')]()['value']();return db['FaxQueue'][_0xd8c7('0x4a')]({'where':{'id':_0x12cc75[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](function(_0x127624){return db[_0xd8c7('0x6d')][_0xd8c7('0x6e')](function(_0x801846){return _0x127624[_0xd8c7('0x73')](_0x12cc75[_0xd8c7('0x34')][_0xd8c7('0x66')],{'transaction':_0x801846})[_0xd8c7('0x25')](function(){if(!_[_0xd8c7('0x86')](_0x1d79bd)){return _0x127624[_0xd8c7('0x87')](_0x1d79bd,{'transaction':_0x801846});}})['then'](function(){_0x1d79bd[_0xd8c7('0x71')](function(_0x2136db){socket[_0xd8c7('0x72')](_0xd8c7('0x88'),{'UserId':_0x2136db,'FaxQueueId':_0x127624['id']});});});});});});})['then'](respondWithStatusCode(_0x282136,null))['catch'](handleError(_0x282136,null));};exports['addAgents']=function(_0x147efc,_0x373e51,_0x30f52c){return db[_0xd8c7('0x2e')][_0xd8c7('0x4a')]({'where':{'id':_0x147efc[_0xd8c7('0x48')]['id']}})['then'](handleEntityNotFound(_0x373e51,null))['then'](function(_0x4f3f26){if(_0x4f3f26){return _0x4f3f26['addAgents'](_0x147efc['body'][_0xd8c7('0x66')],_['omit'](_0x147efc[_0xd8c7('0x4c')],['ids','id'])||{})[_0xd8c7('0x89')](function(_0x3ec692){for(var _0x58afe2=0x0;_0x58afe2<_0x147efc[_0xd8c7('0x4c')][_0xd8c7('0x66')]['length'];_0x58afe2+=0x1){socket[_0xd8c7('0x72')]('userFaxQueue:save',{'UserId':_0x147efc[_0xd8c7('0x4c')][_0xd8c7('0x66')][_0x58afe2],'FaxQueueId':_0x147efc[_0xd8c7('0x48')]['id']});}return _0x3ec692;});}})[_0xd8c7('0x25')](respondWithResult(_0x373e51,null))['catch'](handleError(_0x373e51,null));};exports['removeAgents']=function(_0x11a581,_0x1d13a9,_0x3aa4e2){return db[_0xd8c7('0x2e')]['find']({'where':{'id':_0x11a581[_0xd8c7('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d13a9,null))[_0xd8c7('0x25')](function(_0x28bd1a){if(_0x28bd1a){return _0x28bd1a[_0xd8c7('0x87')](_0x11a581[_0xd8c7('0x34')][_0xd8c7('0x66')])[_0xd8c7('0x25')](function(){if(_[_0xd8c7('0x8a')](_0x11a581[_0xd8c7('0x34')][_0xd8c7('0x66')])){for(var _0x43744a=0x0;_0x43744a<_0x11a581[_0xd8c7('0x34')][_0xd8c7('0x66')]['length'];_0x43744a+=0x1){socket[_0xd8c7('0x72')](_0xd8c7('0x88'),{'UserId':Number(_0x11a581[_0xd8c7('0x34')][_0xd8c7('0x66')][_0x43744a]),'FaxQueueId':Number(_0x11a581[_0xd8c7('0x48')]['id'])});}}else{socket['emit'](_0xd8c7('0x88'),{'UserId':Number(_0x11a581[_0xd8c7('0x34')]['ids']),'FaxQueueId':Number(_0x11a581[_0xd8c7('0x48')]['id'])});}});}})[_0xd8c7('0x25')](respondWithStatusCode(_0x1d13a9,null))[_0xd8c7('0x46')](handleError(_0x1d13a9,null));};exports['getAgents']=function(_0x2d0855,_0x2f6c6b,_0x18ba7e){var _0x50d305={};var _0x58aa2f={};var _0x46c89e;var _0x473165;return db[_0xd8c7('0x2e')][_0xd8c7('0x54')]({'where':{'id':_0x2d0855[_0xd8c7('0x48')]['id']}})[_0xd8c7('0x25')](handleEntityNotFound(_0x2f6c6b,null))[_0xd8c7('0x25')](function(_0x18e7c4){if(_0x18e7c4){_0x46c89e=_0x18e7c4;_0x58aa2f[_0xd8c7('0x32')]=_[_0xd8c7('0x33')](db[_0xd8c7('0x67')][_0xd8c7('0x2f')]);_0x58aa2f[_0xd8c7('0x34')]=_[_0xd8c7('0x33')](_0x2d0855[_0xd8c7('0x34')]);_0x58aa2f[_0xd8c7('0x49')]=_[_0xd8c7('0x35')](_0x58aa2f['model'],_0x58aa2f['query']);_0x50d305[_0xd8c7('0x36')]=_[_0xd8c7('0x35')](_0x58aa2f[_0xd8c7('0x32')],qs[_0xd8c7('0x37')](_0x2d0855['query'][_0xd8c7('0x37')]));_0x50d305[_0xd8c7('0x36')]=_0x50d305[_0xd8c7('0x36')][_0xd8c7('0x64')]?_0x50d305[_0xd8c7('0x36')]:_0x58aa2f['model'];_0x50d305[_0xd8c7('0x57')]=qs[_0xd8c7('0x3a')](_0x2d0855['query'][_0xd8c7('0x3a')]);_0x50d305[_0xd8c7('0x3b')]=qs[_0xd8c7('0x49')](_[_0xd8c7('0x3c')](_0x2d0855[_0xd8c7('0x34')],_0x58aa2f[_0xd8c7('0x49')]));if(_0x2d0855[_0xd8c7('0x34')][_0xd8c7('0x3d')]){_0x50d305[_0xd8c7('0x3b')]=_[_0xd8c7('0x3e')](_0x50d305[_0xd8c7('0x3b')],{'$or':_['map'](_0x50d305[_0xd8c7('0x36')],function(_0x434a14){var _0x2ee783={};_0x2ee783[_0x434a14]={'$like':'%'+_0x2d0855[_0xd8c7('0x34')]['filter']+'%'};return _0x2ee783;})});}_0x50d305=_[_0xd8c7('0x3e')]({},_0x50d305,_0x2d0855[_0xd8c7('0x40')]);return _0x46c89e[_0xd8c7('0x8b')](_0x50d305);}})[_0xd8c7('0x25')](function(_0xf60231){if(_0xf60231){_0x473165=_0xf60231[_0xd8c7('0x64')];if(!_0x2d0855[_0xd8c7('0x34')]['hasOwnProperty']('nolimit')){_0x50d305[_0xd8c7('0x39')]=qs[_0xd8c7('0x39')](_0x2d0855[_0xd8c7('0x34')][_0xd8c7('0x39')]);_0x50d305[_0xd8c7('0x1d')]=qs[_0xd8c7('0x1d')](_0x2d0855['query'][_0xd8c7('0x1d')]);}return _0x46c89e['getAgents'](_0x50d305);}})['then'](function(_0x3f2fe6){if(_0x3f2fe6){return _0x3f2fe6?{'count':_0x473165,'rows':_0x3f2fe6}:null;}})[_0xd8c7('0x25')](respondWithResult(_0x2f6c6b,null))[_0xd8c7('0x46')](handleError(_0x2f6c6b,null));}; \ No newline at end of file +var _0xa057=['from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','end','name','send','index','map','FaxQueue','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','order','FaxQueueId','options','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','faxPause','Team','getTeams','Agents','online','interface','flatMap','sequelize','each','forEach','emit','removeTeams','ids','select','field','tq.TeamId'];(function(_0x15a316,_0x12265b){var _0xb9bd29=function(_0x473313){while(--_0x473313){_0x15a316['push'](_0x15a316['shift']());}};_0xb9bd29(++_0x12265b);}(_0xa057,0x123));var _0x7a05=function(_0x313d77,_0x39489d){_0x313d77=_0x313d77-0x0;var _0x331d96=_0xa057[_0x313d77];return _0x331d96;};'use strict';var pdf=require(_0x7a05('0x0'));var emlformat=require(_0x7a05('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7a05('0x2'));var jsonpatch=require(_0x7a05('0x3'));var rp=require(_0x7a05('0x4'));var moment=require('moment');var BPromise=require(_0x7a05('0x5'));var Mustache=require(_0x7a05('0x6'));var util=require('util');var path=require(_0x7a05('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a05('0x8'));var fs=require('fs');var _=require(_0x7a05('0x9'));var squel=require(_0x7a05('0xa'));var crypto=require('crypto');var jsforce=require(_0x7a05('0xb'));var deskjs=require(_0x7a05('0xc'));var toCsv=require(_0x7a05('0xd'));var querystring=require('querystring');var Papa=require(_0x7a05('0xe'));var Redis=require(_0x7a05('0xf'));var authService=require(_0x7a05('0x10'));var qs=require(_0x7a05('0x11'));var as=require(_0x7a05('0x12'));var hardwareService=require(_0x7a05('0x13'));var logger=require('../../config/logger')(_0x7a05('0x14'));var utils=require(_0x7a05('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7a05('0x16')]=_[_0x7a05('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a05('0x16')]));require(_0x7a05('0x18'))[_0x7a05('0x19')](socket);function respondWithStatusCode(_0x2d4ba6,_0x31c140){_0x31c140=_0x31c140||0xcc;return function(_0x351ac2){if(_0x351ac2){return _0x2d4ba6[_0x7a05('0x1a')](_0x31c140);}return _0x2d4ba6[_0x7a05('0x1b')](_0x31c140)['end']();};}function respondWithResult(_0x49d016,_0x37d394){_0x37d394=_0x37d394||0xc8;return function(_0x8ad482){if(_0x8ad482){return _0x49d016['status'](_0x37d394)[_0x7a05('0x1c')](_0x8ad482);}};}function respondWithFilteredResult(_0x3b45e9,_0x4cfd13){return function(_0x1796f0){if(_0x1796f0){var _0x449d86=_0x1796f0[_0x7a05('0x1d')],_0x9e6a53=_0x4cfd13['offset'],_0x5a9477=_0x4cfd13[_0x7a05('0x1e')]+_0x4cfd13[_0x7a05('0x1f')],_0x519666;if(_0x5a9477>=_0x449d86){_0x5a9477=_0x449d86;_0x519666=0xc8;}else{_0x519666=0xce;}_0x3b45e9['status'](_0x519666);return _0x3b45e9['set']('Content-Range',_0x9e6a53+'-'+_0x5a9477+'/'+_0x449d86)[_0x7a05('0x1c')](_0x1796f0);}return null;};}function patchUpdates(_0x296177){return function(_0x443f33){try{jsonpatch[_0x7a05('0x20')](_0x443f33,_0x296177,!![]);}catch(_0x4f385d){return BPromise[_0x7a05('0x21')](_0x4f385d);}return _0x443f33[_0x7a05('0x22')]();};}function saveUpdates(_0x3e9ef2,_0x593c1b){return function(_0x955fb){if(_0x955fb){return _0x955fb[_0x7a05('0x23')](_0x3e9ef2)[_0x7a05('0x24')](function(_0x352571){return _0x352571;});}return null;};}function removeEntity(_0x1b62de,_0x472bdd){return function(_0xb23a2a){if(_0xb23a2a){return _0xb23a2a[_0x7a05('0x25')]()[_0x7a05('0x24')](function(){var _0x219a94=_0xb23a2a[_0x7a05('0x26')]({'plain':!![]});var _0x4beb4a='FaxQueues';return db['UserProfileResource'][_0x7a05('0x25')]({'where':{'type':_0x4beb4a,'resourceId':_0x219a94['id']}})[_0x7a05('0x24')](function(){return _0xb23a2a;});})[_0x7a05('0x24')](function(){_0x1b62de[_0x7a05('0x1b')](0xcc)[_0x7a05('0x27')]();});}};}function handleEntityNotFound(_0x3406b7,_0x2fafe7){return function(_0x1cc98f){if(!_0x1cc98f){_0x3406b7[_0x7a05('0x1a')](0x194);}return _0x1cc98f;};}function handleError(_0x4a5cf8,_0x49e37b){_0x49e37b=_0x49e37b||0x1f4;return function(_0x20a4f2){logger['error'](_0x20a4f2['stack']);if(_0x20a4f2[_0x7a05('0x28')]){delete _0x20a4f2[_0x7a05('0x28')];}_0x4a5cf8[_0x7a05('0x1b')](_0x49e37b)[_0x7a05('0x29')](_0x20a4f2);};}exports[_0x7a05('0x2a')]=function(_0x57f237,_0x1106ad){var _0x272034={},_0x37dbf1={},_0x479c10={'count':0x0,'rows':[]};var _0x3886a9=_[_0x7a05('0x2b')](db[_0x7a05('0x2c')]['rawAttributes'],function(_0x17579a){return{'name':_0x17579a[_0x7a05('0x2d')],'type':_0x17579a[_0x7a05('0x2e')][_0x7a05('0x2f')]};});_0x37dbf1['model']=_[_0x7a05('0x2b')](_0x3886a9,'name');_0x37dbf1[_0x7a05('0x30')]=_[_0x7a05('0x31')](_0x57f237['query']);_0x37dbf1[_0x7a05('0x32')]=_[_0x7a05('0x33')](_0x37dbf1[_0x7a05('0x34')],_0x37dbf1['query']);_0x272034[_0x7a05('0x35')]=_[_0x7a05('0x33')](_0x37dbf1['model'],qs[_0x7a05('0x36')](_0x57f237[_0x7a05('0x30')]['fields']));_0x272034['attributes']=_0x272034[_0x7a05('0x35')][_0x7a05('0x37')]?_0x272034['attributes']:_0x37dbf1[_0x7a05('0x34')];if(!_0x57f237[_0x7a05('0x30')][_0x7a05('0x38')](_0x7a05('0x39'))){_0x272034['limit']=qs[_0x7a05('0x1f')](_0x57f237[_0x7a05('0x30')][_0x7a05('0x1f')]);_0x272034[_0x7a05('0x1e')]=qs['offset'](_0x57f237['query'][_0x7a05('0x1e')]);}_0x272034['order']=qs[_0x7a05('0x3a')](_0x57f237['query']['sort']);_0x272034[_0x7a05('0x3b')]=qs[_0x7a05('0x32')](_[_0x7a05('0x3c')](_0x57f237[_0x7a05('0x30')],_0x37dbf1[_0x7a05('0x32')]),_0x3886a9);if(_0x57f237[_0x7a05('0x30')][_0x7a05('0x3d')]){_0x272034[_0x7a05('0x3b')]=_[_0x7a05('0x3e')](_0x272034[_0x7a05('0x3b')],{'$or':_['map'](_0x3886a9,function(_0x51e5a3){if(_0x51e5a3[_0x7a05('0x2e')]!==_0x7a05('0x3f')){var _0x45e6fc={};_0x45e6fc[_0x51e5a3[_0x7a05('0x28')]]={'$like':'%'+_0x57f237['query'][_0x7a05('0x3d')]+'%'};return _0x45e6fc;}})});}_0x272034=_[_0x7a05('0x3e')]({},_0x272034,_0x57f237['options']);var _0x35078e={'where':_0x272034[_0x7a05('0x3b')]};return db[_0x7a05('0x2c')][_0x7a05('0x1d')](_0x35078e)[_0x7a05('0x24')](function(_0x2f8e0e){_0x479c10[_0x7a05('0x1d')]=_0x2f8e0e;if(_0x57f237[_0x7a05('0x30')]['includeAll']){_0x272034[_0x7a05('0x40')]=[{'all':!![]}];}return db[_0x7a05('0x2c')][_0x7a05('0x41')](_0x272034);})['then'](function(_0x12d5f0){_0x479c10[_0x7a05('0x42')]=_0x12d5f0;return _0x479c10;})[_0x7a05('0x24')](respondWithFilteredResult(_0x1106ad,_0x272034))[_0x7a05('0x43')](handleError(_0x1106ad,null));};exports['show']=function(_0xbd236b,_0x4d18b3){var _0x4791fd={'raw':!![],'where':{'id':_0xbd236b[_0x7a05('0x44')]['id']}},_0x4213e3={};_0x4213e3['model']=_[_0x7a05('0x31')](db[_0x7a05('0x2c')][_0x7a05('0x45')]);_0x4213e3[_0x7a05('0x30')]=_[_0x7a05('0x31')](_0xbd236b[_0x7a05('0x30')]);_0x4213e3[_0x7a05('0x32')]=_[_0x7a05('0x33')](_0x4213e3[_0x7a05('0x34')],_0x4213e3[_0x7a05('0x30')]);_0x4791fd[_0x7a05('0x35')]=_[_0x7a05('0x33')](_0x4213e3[_0x7a05('0x34')],qs[_0x7a05('0x36')](_0xbd236b[_0x7a05('0x30')]['fields']));_0x4791fd[_0x7a05('0x35')]=_0x4791fd[_0x7a05('0x35')][_0x7a05('0x37')]?_0x4791fd[_0x7a05('0x35')]:_0x4213e3['model'];if(_0xbd236b[_0x7a05('0x30')][_0x7a05('0x46')]){_0x4791fd[_0x7a05('0x40')]=[{'all':!![]}];}_0x4791fd=_[_0x7a05('0x3e')]({},_0x4791fd,_0xbd236b['options']);return db[_0x7a05('0x2c')]['find'](_0x4791fd)[_0x7a05('0x24')](handleEntityNotFound(_0x4d18b3,null))[_0x7a05('0x24')](respondWithResult(_0x4d18b3,null))['catch'](handleError(_0x4d18b3,null));};exports[_0x7a05('0x47')]=function(_0x1b5b6a,_0x2139e3){return db['FaxQueue'][_0x7a05('0x47')](_0x1b5b6a[_0x7a05('0x48')],{})[_0x7a05('0x24')](function(_0x269770){var _0x5ad101=_0x1b5b6a[_0x7a05('0x49')]['get']({'plain':!![]});if(!_0x5ad101)throw new Error(_0x7a05('0x4a'));if(_0x5ad101[_0x7a05('0x4b')]===_0x7a05('0x49')){var _0x10fda2=_0x269770[_0x7a05('0x26')]({'plain':!![]});var _0x211260=_0x7a05('0x4c');return db[_0x7a05('0x4d')][_0x7a05('0x4e')]({'where':{'name':_0x211260,'userProfileId':_0x5ad101[_0x7a05('0x4f')]},'raw':!![]})['then'](function(_0xef36ff){if(_0xef36ff&&_0xef36ff[_0x7a05('0x50')]===0x0){return db[_0x7a05('0x51')][_0x7a05('0x47')]({'name':_0x10fda2[_0x7a05('0x28')],'resourceId':_0x10fda2['id'],'type':_0xef36ff[_0x7a05('0x28')],'sectionId':_0xef36ff['id']},{})[_0x7a05('0x24')](function(){return _0x269770;});}else{return _0x269770;}})['catch'](function(_0x197b83){logger[_0x7a05('0x52')](_0x7a05('0x53'),_0x197b83);throw _0x197b83;});}return _0x269770;})['then'](respondWithResult(_0x2139e3,0xc9))['catch'](handleError(_0x2139e3,null));};exports[_0x7a05('0x23')]=function(_0x44906c,_0x59f707){if(_0x44906c[_0x7a05('0x48')]['id']){delete _0x44906c[_0x7a05('0x48')]['id'];}return db[_0x7a05('0x2c')][_0x7a05('0x4e')]({'where':{'id':_0x44906c[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x59f707,null))[_0x7a05('0x24')](saveUpdates(_0x44906c['body'],null))[_0x7a05('0x24')](respondWithResult(_0x59f707,null))[_0x7a05('0x43')](handleError(_0x59f707,null));};exports[_0x7a05('0x25')]=function(_0x8489cd,_0x58ff5){return db[_0x7a05('0x2c')][_0x7a05('0x4e')]({'where':{'id':_0x8489cd[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x58ff5,null))[_0x7a05('0x24')](removeEntity(_0x58ff5,null))[_0x7a05('0x43')](handleError(_0x58ff5,null));};exports['describe']=function(_0x9e150b,_0x142d9a){return db[_0x7a05('0x2c')][_0x7a05('0x54')]()[_0x7a05('0x24')](respondWithResult(_0x142d9a,null))['catch'](handleError(_0x142d9a,null));};exports['getMembers']=function(_0x16902a,_0x5f0feb,_0x53afb4){var _0x4e98d7={'raw':!![],'where':{}},_0x2511d1={},_0x39c4da;return db['FaxQueue'][_0x7a05('0x55')]({'where':{'id':_0x16902a[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x5f0feb,null))[_0x7a05('0x24')](function(_0x1a1fb3){if(_0x1a1fb3){_0x39c4da=_0x1a1fb3[_0x7a05('0x26')]({'plain':!![]});_0x2511d1[_0x7a05('0x34')]=_[_0x7a05('0x31')](db['UserFaxQueue'][_0x7a05('0x45')]);_0x2511d1[_0x7a05('0x30')]=_[_0x7a05('0x31')](_0x16902a[_0x7a05('0x30')]);_0x2511d1['filters']=_[_0x7a05('0x33')](_0x2511d1[_0x7a05('0x34')],_0x2511d1['query']);_0x4e98d7['attributes']=_['intersection'](_0x2511d1[_0x7a05('0x34')],qs['fields'](_0x16902a['query'][_0x7a05('0x36')]));_0x4e98d7['attributes']=_0x4e98d7[_0x7a05('0x35')][_0x7a05('0x37')]?_0x4e98d7[_0x7a05('0x35')]:_0x2511d1[_0x7a05('0x34')];if(!_0x16902a[_0x7a05('0x30')][_0x7a05('0x38')](_0x7a05('0x39'))){_0x4e98d7[_0x7a05('0x1f')]=qs[_0x7a05('0x1f')](_0x16902a[_0x7a05('0x30')][_0x7a05('0x1f')]);_0x4e98d7[_0x7a05('0x1e')]=qs['offset'](_0x16902a[_0x7a05('0x30')][_0x7a05('0x1e')]);}_0x4e98d7[_0x7a05('0x56')]=qs[_0x7a05('0x3a')](_0x16902a[_0x7a05('0x30')][_0x7a05('0x3a')]);_0x4e98d7[_0x7a05('0x3b')]=qs[_0x7a05('0x32')](_[_0x7a05('0x3c')](_0x16902a[_0x7a05('0x30')],_0x2511d1[_0x7a05('0x32')]));_0x4e98d7[_0x7a05('0x3b')][_0x7a05('0x57')]=_0x1a1fb3['id'];if(_0x16902a[_0x7a05('0x30')]['filter']){_0x4e98d7['where']=_[_0x7a05('0x3e')](_0x4e98d7[_0x7a05('0x3b')],{'$or':_[_0x7a05('0x2b')](_0x4e98d7['attributes'],function(_0x5f354c){var _0x3a4cf7={};_0x3a4cf7[_0x5f354c]={'$like':'%'+_0x16902a[_0x7a05('0x30')][_0x7a05('0x3d')]+'%'};return _0x3a4cf7;})});}_0x4e98d7=_['merge']({},_0x4e98d7,_0x16902a[_0x7a05('0x58')]);return db['UserFaxQueue'][_0x7a05('0x41')](_0x4e98d7);}})['then'](function(_0x4d86af){if(_0x4d86af){return db[_0x7a05('0x59')][_0x7a05('0x5a')]({'where':{'id':_[_0x7a05('0x2b')](_0x4d86af,'UserId'),'role':_0x7a05('0x5b')},'attributes':['id',_0x7a05('0x28'),'faxPause',_0x7a05('0x5c'),_0x7a05('0x5d')]});}})[_0x7a05('0x24')](function(_0x3b99b7){if(_0x3b99b7){return{'count':_0x3b99b7[_0x7a05('0x1d')],'rows':_[_0x7a05('0x2b')](_0x3b99b7[_0x7a05('0x42')],function(_0xc6112c){return{'membername':_0xc6112c[_0x7a05('0x28')],'UserId':_0xc6112c['id'],'queue_name':_0x39c4da[_0x7a05('0x28')],'FaxQueueId':_0x39c4da['id'],'interface':util['format'](_0x7a05('0x5e'),'SIP',_0xc6112c[_0x7a05('0x28')]),'penalty':0x0,'paused':_0xc6112c[_0x7a05('0x5f')],'createdAt':_0xc6112c[_0x7a05('0x5d')],'updatedAt':_0xc6112c[_0x7a05('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7a05('0x24')](respondWithFilteredResult(_0x5f0feb,_0x4e98d7))['catch'](handleError(_0x5f0feb,null));};exports['getTeams']=function(_0x544c5c,_0x583ad5,_0xc8c61a){var _0x53b70c={};var _0x2090eb={};var _0xf17a8a;var _0x487adf;return db[_0x7a05('0x2c')]['findOne']({'where':{'id':_0x544c5c[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x583ad5,null))[_0x7a05('0x24')](function(_0x5b9669){if(_0x5b9669){_0xf17a8a=_0x5b9669;_0x2090eb[_0x7a05('0x34')]=_['keys'](db[_0x7a05('0x60')][_0x7a05('0x45')]);_0x2090eb[_0x7a05('0x30')]=_[_0x7a05('0x31')](_0x544c5c[_0x7a05('0x30')]);_0x2090eb[_0x7a05('0x32')]=_['intersection'](_0x2090eb['model'],_0x2090eb['query']);_0x53b70c[_0x7a05('0x35')]=_['intersection'](_0x2090eb[_0x7a05('0x34')],qs[_0x7a05('0x36')](_0x544c5c['query'][_0x7a05('0x36')]));_0x53b70c[_0x7a05('0x35')]=_0x53b70c[_0x7a05('0x35')][_0x7a05('0x37')]?_0x53b70c[_0x7a05('0x35')]:_0x2090eb[_0x7a05('0x34')];_0x53b70c['order']=qs[_0x7a05('0x3a')](_0x544c5c[_0x7a05('0x30')]['sort']);_0x53b70c[_0x7a05('0x3b')]=qs[_0x7a05('0x32')](_[_0x7a05('0x3c')](_0x544c5c[_0x7a05('0x30')],_0x2090eb[_0x7a05('0x32')]));if(_0x544c5c[_0x7a05('0x30')][_0x7a05('0x3d')]){_0x53b70c['where']=_[_0x7a05('0x3e')](_0x53b70c[_0x7a05('0x3b')],{'$or':_[_0x7a05('0x2b')](_0x53b70c[_0x7a05('0x35')],function(_0x374735){var _0x247a4e={};_0x247a4e[_0x374735]={'$like':'%'+_0x544c5c[_0x7a05('0x30')][_0x7a05('0x3d')]+'%'};return _0x247a4e;})});}_0x53b70c=_[_0x7a05('0x3e')]({},_0x53b70c,_0x544c5c['options']);return _0xf17a8a[_0x7a05('0x61')](_0x53b70c);}})[_0x7a05('0x24')](function(_0x3a24c9){if(_0x3a24c9){_0x487adf=_0x3a24c9[_0x7a05('0x37')];if(!_0x544c5c[_0x7a05('0x30')][_0x7a05('0x38')]('nolimit')){_0x53b70c['limit']=qs['limit'](_0x544c5c['query'][_0x7a05('0x1f')]);_0x53b70c[_0x7a05('0x1e')]=qs[_0x7a05('0x1e')](_0x544c5c[_0x7a05('0x30')]['offset']);}return _0xf17a8a[_0x7a05('0x61')](_0x53b70c);}})[_0x7a05('0x24')](function(_0x195a41){if(_0x195a41){return _0x195a41?{'count':_0x487adf,'rows':_0x195a41}:null;}})[_0x7a05('0x24')](respondWithResult(_0x583ad5,null))['catch'](handleError(_0x583ad5,null));};exports['addTeams']=function(_0x1ffe0c,_0xe5df47,_0x187132){var _0xa91c08=_0x1ffe0c[_0x7a05('0x48')]['ids'];return db[_0x7a05('0x60')]['findAll']({'where':{'id':_0xa91c08},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a05('0x62'),'attributes':['id',_0x7a05('0x28'),_0x7a05('0x63'),'voicePause',_0x7a05('0x64')],'raw':!![]}]})['then'](function(_0x2cdd02){if(_0x2cdd02){var _0xd6a5b3=_[_0x7a05('0x65')](_0x2cdd02,function(_0x1e6e83){var _0x2de952=_0x1e6e83[_0x7a05('0x26')]({'plain':!![]});return _0x2de952['Agents'];});return db[_0x7a05('0x2c')][_0x7a05('0x4e')]({'where':{'id':_0x1ffe0c[_0x7a05('0x44')]['id']}})['then'](function(_0x198b3d){return db[_0x7a05('0x66')]['transaction'](function(_0x17835f){return _0x198b3d['addTeams'](_0xa91c08,{'transaction':_0x17835f})[_0x7a05('0x24')](function(){return BPromise[_0x7a05('0x67')](_0xd6a5b3,function(_0x402dc1){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x402dc1['id'],'FaxQueueId':_0x1ffe0c[_0x7a05('0x44')]['id']},'transaction':_0x17835f});});})[_0x7a05('0x24')](function(){_0xd6a5b3[_0x7a05('0x68')](function(_0x29e1fb){socket[_0x7a05('0x69')]('userFaxQueue:save',{'UserId':_0x29e1fb['id'],'FaxQueueId':_0x198b3d['id']});});});});});}})[_0x7a05('0x24')](respondWithStatusCode(_0xe5df47,null))['catch'](handleError(_0xe5df47,null));};exports[_0x7a05('0x6a')]=function(_0x3f6ac5,_0x4a0bc2,_0x1976bd){return db[_0x7a05('0x60')][_0x7a05('0x41')]({'where':{'id':_0x3f6ac5[_0x7a05('0x30')][_0x7a05('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7a05('0x62'),'attributes':['id'],'raw':!![]}]})[_0x7a05('0x24')](handleEntityNotFound(_0x4a0bc2,null))[_0x7a05('0x24')](function(_0x2136ab){var _0x19c6eb=_[_0x7a05('0x2b')](_0x2136ab,'id');var _0x2324ff=[];var _0x1b5357=[];var _0x43efc4=squel[_0x7a05('0x6c')]();_0x43efc4[_0x7a05('0x6d')](_0x7a05('0x6e'))[_0x7a05('0x6f')](_0x7a05('0x70'),'tq')[_0x7a05('0x71')](_0x7a05('0x72'),'ut',_0x7a05('0x73'))[_0x7a05('0x3b')](_0x7a05('0x74'),_0x3f6ac5[_0x7a05('0x44')]['id']);for(var _0x51697c=0x0;_0x51697c<_0x2136ab[_0x7a05('0x37')];_0x51697c+=0x1){let _0x534750=_0x2136ab[_0x51697c];for(var _0x157396=0x0;_0x157396<_0x534750[_0x7a05('0x62')]['length'];_0x157396+=0x1){let _0x712158=_0x534750['Agents'][_0x157396];var _0x4de6af=_0x43efc4['clone']();_0x4de6af[_0x7a05('0x3b')](_0x7a05('0x75'),_0x712158['id']);_0x1b5357[_0x7a05('0x76')](db[_0x7a05('0x66')]['query'](_0x4de6af[_0x7a05('0x77')](),{'type':db[_0x7a05('0x66')][_0x7a05('0x78')]['SELECT']})[_0x7a05('0x24')](function(_0x2f1601){if(_0x2f1601['length']===0x1){return _0x712158['id'];}else{var _0x28d4f5=_[_0x7a05('0x79')](_[_0x7a05('0x2b')](_0x2f1601,'TeamId'),function(_0x30bb76){return _[_0x7a05('0x7a')](_0x19c6eb,_0x30bb76);});if(_0x28d4f5){return _0x712158['id'];}}}));}}return BPromise[_0x7a05('0x7b')](_0x1b5357)['then'](function(_0x320888){_0x2324ff=_(_0x2324ff)['union'](_0x320888)[_0x7a05('0x7c')]()[_0x7a05('0x7d')]();return db[_0x7a05('0x2c')]['find']({'where':{'id':_0x3f6ac5[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](function(_0x5d046e){return db['sequelize']['transaction'](function(_0x516980){return _0x5d046e[_0x7a05('0x6a')](_0x3f6ac5['query']['ids'],{'transaction':_0x516980})[_0x7a05('0x24')](function(){if(!_[_0x7a05('0x7e')](_0x2324ff)){return _0x5d046e[_0x7a05('0x7f')](_0x2324ff,{'transaction':_0x516980});}})['then'](function(){_0x2324ff[_0x7a05('0x68')](function(_0x89bd3e){socket[_0x7a05('0x69')](_0x7a05('0x80'),{'UserId':_0x89bd3e,'FaxQueueId':_0x5d046e['id']});});});});});});})[_0x7a05('0x24')](respondWithStatusCode(_0x4a0bc2,null))['catch'](handleError(_0x4a0bc2,null));};exports['addAgents']=function(_0x24ab43,_0x599452,_0x5aa96d){return db[_0x7a05('0x2c')][_0x7a05('0x4e')]({'where':{'id':_0x24ab43[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x599452,null))[_0x7a05('0x24')](function(_0x264989){if(_0x264989){return _0x264989[_0x7a05('0x81')](_0x24ab43['body'][_0x7a05('0x6b')],_[_0x7a05('0x82')](_0x24ab43[_0x7a05('0x48')],[_0x7a05('0x6b'),'id'])||{})[_0x7a05('0x83')](function(_0x5d1ea0){for(var _0xab6f9b=0x0;_0xab6f9b<_0x24ab43[_0x7a05('0x48')]['ids'][_0x7a05('0x37')];_0xab6f9b+=0x1){socket[_0x7a05('0x69')](_0x7a05('0x84'),{'UserId':_0x24ab43[_0x7a05('0x48')][_0x7a05('0x6b')][_0xab6f9b],'FaxQueueId':_0x24ab43['params']['id']});}return _0x5d1ea0;});}})[_0x7a05('0x24')](respondWithResult(_0x599452,null))[_0x7a05('0x43')](handleError(_0x599452,null));};exports[_0x7a05('0x7f')]=function(_0x3f1762,_0x3b33e8,_0x3d0e95){return db[_0x7a05('0x2c')][_0x7a05('0x4e')]({'where':{'id':_0x3f1762[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x3b33e8,null))[_0x7a05('0x24')](function(_0x27b14f){if(_0x27b14f){return _0x27b14f['removeAgents'](_0x3f1762[_0x7a05('0x30')][_0x7a05('0x6b')])[_0x7a05('0x24')](function(){if(_['isArray'](_0x3f1762[_0x7a05('0x30')][_0x7a05('0x6b')])){for(var _0x399c6c=0x0;_0x399c6c<_0x3f1762['query'][_0x7a05('0x6b')][_0x7a05('0x37')];_0x399c6c+=0x1){socket['emit'](_0x7a05('0x80'),{'UserId':Number(_0x3f1762['query'][_0x7a05('0x6b')][_0x399c6c]),'FaxQueueId':Number(_0x3f1762[_0x7a05('0x44')]['id'])});}}else{socket['emit'](_0x7a05('0x80'),{'UserId':Number(_0x3f1762[_0x7a05('0x30')]['ids']),'FaxQueueId':Number(_0x3f1762[_0x7a05('0x44')]['id'])});}});}})[_0x7a05('0x24')](respondWithStatusCode(_0x3b33e8,null))[_0x7a05('0x43')](handleError(_0x3b33e8,null));};exports[_0x7a05('0x85')]=function(_0x1349df,_0x2df2ad,_0xad01dc){var _0x1d59de={};var _0x39075b={};var _0x430d1d;var _0x402692;return db[_0x7a05('0x2c')][_0x7a05('0x55')]({'where':{'id':_0x1349df[_0x7a05('0x44')]['id']}})[_0x7a05('0x24')](handleEntityNotFound(_0x2df2ad,null))[_0x7a05('0x24')](function(_0x4cd024){if(_0x4cd024){_0x430d1d=_0x4cd024;_0x39075b[_0x7a05('0x34')]=_['keys'](db[_0x7a05('0x59')][_0x7a05('0x45')]);_0x39075b[_0x7a05('0x30')]=_[_0x7a05('0x31')](_0x1349df[_0x7a05('0x30')]);_0x39075b['filters']=_[_0x7a05('0x33')](_0x39075b['model'],_0x39075b['query']);_0x1d59de['attributes']=_[_0x7a05('0x33')](_0x39075b[_0x7a05('0x34')],qs['fields'](_0x1349df[_0x7a05('0x30')]['fields']));_0x1d59de['attributes']=_0x1d59de[_0x7a05('0x35')][_0x7a05('0x37')]?_0x1d59de[_0x7a05('0x35')]:_0x39075b[_0x7a05('0x34')];_0x1d59de['order']=qs[_0x7a05('0x3a')](_0x1349df[_0x7a05('0x30')][_0x7a05('0x3a')]);_0x1d59de[_0x7a05('0x3b')]=qs[_0x7a05('0x32')](_[_0x7a05('0x3c')](_0x1349df[_0x7a05('0x30')],_0x39075b[_0x7a05('0x32')]));if(_0x1349df['query'][_0x7a05('0x3d')]){_0x1d59de[_0x7a05('0x3b')]=_[_0x7a05('0x3e')](_0x1d59de['where'],{'$or':_[_0x7a05('0x2b')](_0x1d59de[_0x7a05('0x35')],function(_0x2fdb6d){var _0x1356c8={};_0x1356c8[_0x2fdb6d]={'$like':'%'+_0x1349df[_0x7a05('0x30')][_0x7a05('0x3d')]+'%'};return _0x1356c8;})});}_0x1d59de=_[_0x7a05('0x3e')]({},_0x1d59de,_0x1349df[_0x7a05('0x58')]);return _0x430d1d[_0x7a05('0x85')](_0x1d59de);}})[_0x7a05('0x24')](function(_0x1052c3){if(_0x1052c3){_0x402692=_0x1052c3[_0x7a05('0x37')];if(!_0x1349df[_0x7a05('0x30')][_0x7a05('0x38')](_0x7a05('0x39'))){_0x1d59de['limit']=qs[_0x7a05('0x1f')](_0x1349df['query'][_0x7a05('0x1f')]);_0x1d59de[_0x7a05('0x1e')]=qs['offset'](_0x1349df['query']['offset']);}return _0x430d1d[_0x7a05('0x85')](_0x1d59de);}})[_0x7a05('0x24')](function(_0x3c3d61){if(_0x3c3d61){return _0x3c3d61?{'count':_0x402692,'rows':_0x3c3d61}:null;}})['then'](respondWithResult(_0x2df2ad,null))['catch'](handleError(_0x2df2ad,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e21b120..e88db14 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 _0xa942=['hook','exports','../../mysqldb','FaxQueue','save','remove','emit'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0xa942,0x1ec));var _0x2a94=function(_0x3e5969,_0x1917f9){_0x3e5969=_0x3e5969-0x0;var _0x4e277c=_0xa942[_0x3e5969];return _0x4e277c;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x2a94('0x0'))['db'][_0x2a94('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a94('0x2'),'afterUpdate':'update','afterDestroy':_0x2a94('0x3')};function emitEvent(_0x55106d){return function(_0x1b3adc,_0x3995bf,_0x248e67){FaxQueueEvents[_0x2a94('0x4')](_0x55106d+':'+_0x1b3adc['id'],_0x1b3adc);FaxQueueEvents[_0x2a94('0x4')](_0x55106d,_0x1b3adc);_0x248e67(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2a94('0x5')](e,emitEvent(event));}}module[_0x2a94('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x0c76=['exports','events','FaxQueue','setMaxListeners','remove','emit','hook'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x0c76,0x94));var _0x60c7=function(_0xdfca8d,_0x377316){_0xdfca8d=_0xdfca8d-0x0;var _0x1cbe00=_0x0c76[_0xdfca8d];return _0x1cbe00;};'use strict';var EventEmitter=require(_0x60c7('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x60c7('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x60c7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x60c7('0x3')};function emitEvent(_0x1c0f34){return function(_0x16e630,_0x179413,_0x5422ca){FaxQueueEvents[_0x60c7('0x4')](_0x1c0f34+':'+_0x16e630['id'],_0x16e630);FaxQueueEvents[_0x60c7('0x4')](_0x1c0f34,_0x16e630);_0x5422ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x60c7('0x5')](e,emitEvent(event));}}module[_0x60c7('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7285ce6..38c6ada 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 _0xe48a=['FaxQueue','lodash','util','api','moment','request-promise','path','./faxQueue.attributes'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xe48a,0x1d9));var _0xae48=function(_0x16083b,_0x21dfb4){_0x16083b=_0x16083b-0x0;var _0x582fc2=_0xe48a[_0x16083b];return _0x582fc2;};'use strict';var _=require(_0xae48('0x0'));var util=require(_0xae48('0x1'));var logger=require('../../config/logger')(_0xae48('0x2'));var moment=require(_0xae48('0x3'));var BPromise=require('bluebird');var rp=require(_0xae48('0x4'));var fs=require('fs');var path=require(_0xae48('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae48('0x6'));module['exports']=function(_0x58f4c2,_0x4e2175){return _0x58f4c2['define'](_0xae48('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12f6=['./faxQueue.attributes','define','FaxQueue','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x2cc1e5,_0x2ede7c){var _0x36010c=function(_0x5c3831){while(--_0x5c3831){_0x2cc1e5['push'](_0x2cc1e5['shift']());}};_0x36010c(++_0x2ede7c);}(_0x12f6,0xdb));var _0x612f=function(_0x4890a9,_0x2da7ab){_0x4890a9=_0x4890a9-0x0;var _0x1fab72=_0x12f6[_0x4890a9];return _0x1fab72;};'use strict';var _=require('lodash');var util=require(_0x612f('0x0'));var logger=require(_0x612f('0x1'))(_0x612f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x612f('0x3'));var fs=require('fs');var path=require(_0x612f('0x4'));var rimraf=require('rimraf');var config=require(_0x612f('0x5'));var attributes=require(_0x612f('0x6'));module['exports']=function(_0x5dd2ea,_0x1fd2b1){return _0x5dd2ea[_0x612f('0x7')](_0x612f('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index d17a92f..24dd7f4 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 _0xa239=['limit','include','model','map','GetFaxQueue','stringify','ShowFaxQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxQueue','options','raw','where','attributes'];(function(_0x55ed3b,_0x51a789){var _0x2a3016=function(_0x3ce681){while(--_0x3ce681){_0x55ed3b['push'](_0x55ed3b['shift']());}};_0x2a3016(++_0x51a789);}(_0xa239,0xeb));var _0x9a23=function(_0x2ccafc,_0x43120e){_0x2ccafc=_0x2ccafc-0x0;var _0x4c4323=_0xa239[_0x2ccafc];return _0x4c4323;};'use strict';var _=require(_0x9a23('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a23('0x1'));var fs=require('fs');var Redis=require(_0x9a23('0x2'));var db=require(_0x9a23('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a23('0x4'))(_0x9a23('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a23('0x6'));var client=jayson[_0x9a23('0x7')][_0x9a23('0x8')]({'port':0x232a});config[_0x9a23('0x9')]=_[_0x9a23('0xa')](config['redis'],{'host':_0x9a23('0xb'),'port':0x18eb});var socket=require(_0x9a23('0xc'))(new Redis(config[_0x9a23('0x9')]));require('./faxQueue.socket')[_0x9a23('0xd')](socket);function respondWithRpcPromise(_0xc297c7,_0x39f2dd,_0x1997e4){return new BPromise(function(_0x381088,_0x5a6db1){return client[_0x9a23('0xe')](_0xc297c7,_0x1997e4)[_0x9a23('0xf')](function(_0x3449e2){logger[_0x9a23('0x10')](_0x9a23('0x11'),_0x39f2dd,'request\x20sent');logger[_0x9a23('0x12')](_0x9a23('0x13'),_0x39f2dd,_0x9a23('0x14'),JSON['stringify'](_0x3449e2));if(_0x3449e2[_0x9a23('0x15')]){if(_0x3449e2[_0x9a23('0x15')][_0x9a23('0x16')]===0x1f4){logger[_0x9a23('0x15')](_0x9a23('0x11'),_0x39f2dd,_0x3449e2['error'][_0x9a23('0x17')]);return _0x5a6db1(_0x3449e2['error'][_0x9a23('0x17')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x39f2dd,_0x3449e2[_0x9a23('0x15')][_0x9a23('0x17')]);return _0x381088(_0x3449e2[_0x9a23('0x15')][_0x9a23('0x17')]);}else{logger[_0x9a23('0x10')](_0x9a23('0x11'),_0x39f2dd,'request\x20sent');_0x381088(_0x3449e2[_0x9a23('0x18')]['message']);}})[_0x9a23('0x19')](function(_0x2504a6){logger[_0x9a23('0x15')](_0x9a23('0x11'),_0x39f2dd,_0x2504a6);_0x5a6db1(_0x2504a6);});});}exports['GetFaxQueue']=function(_0x109cce){var _0x3b7d53=this;return new Promise(function(_0x39cf20,_0x25405c){return db[_0x9a23('0x1a')]['findAll']({'raw':_0x109cce[_0x9a23('0x1b')]?_0x109cce['options'][_0x9a23('0x1c')]===undefined?!![]:![]:!![],'where':_0x109cce[_0x9a23('0x1b')]?_0x109cce[_0x9a23('0x1b')][_0x9a23('0x1d')]||null:null,'attributes':_0x109cce[_0x9a23('0x1b')]?_0x109cce[_0x9a23('0x1b')][_0x9a23('0x1e')]||null:null,'limit':_0x109cce['options']?_0x109cce[_0x9a23('0x1b')][_0x9a23('0x1f')]||null:null,'include':_0x109cce[_0x9a23('0x1b')]?_0x109cce[_0x9a23('0x1b')][_0x9a23('0x20')]?_['map'](_0x109cce['options'][_0x9a23('0x20')],function(_0x401a16){return{'model':db[_0x401a16[_0x9a23('0x21')]],'as':_0x401a16['as'],'attributes':_0x401a16[_0x9a23('0x1e')],'include':_0x401a16[_0x9a23('0x20')]?_[_0x9a23('0x22')](_0x401a16[_0x9a23('0x20')],function(_0x400e85){return{'model':db[_0x400e85['model']],'as':_0x400e85['as'],'attributes':_0x400e85[_0x9a23('0x1e')],'include':_0x400e85[_0x9a23('0x20')]?_[_0x9a23('0x22')](_0x400e85['include'],function(_0x5494f0){return{'model':db[_0x5494f0['model']],'as':_0x5494f0['as'],'attributes':_0x5494f0[_0x9a23('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9a23('0xf')](function(_0x257822){logger[_0x9a23('0x10')](_0x9a23('0x23'),_0x109cce);logger[_0x9a23('0x12')]('GetFaxQueue',_0x109cce,JSON[_0x9a23('0x24')](_0x257822));_0x39cf20(_0x257822);})[_0x9a23('0x19')](function(_0x2e6a25){logger[_0x9a23('0x15')](_0x9a23('0x23'),_0x2e6a25[_0x9a23('0x17')],_0x109cce);_0x25405c(_0x3b7d53[_0x9a23('0x15')](0x1f4,_0x2e6a25[_0x9a23('0x17')]));});});};exports[_0x9a23('0x25')]=function(_0xc51ed4){var _0x3eb935=this;return new Promise(function(_0x44ef3e,_0x3259d6){return db[_0x9a23('0x1a')]['find']({'raw':_0xc51ed4['options']?_0xc51ed4[_0x9a23('0x1b')][_0x9a23('0x1c')]===undefined?!![]:![]:!![],'where':_0xc51ed4[_0x9a23('0x1b')]?_0xc51ed4['options'][_0x9a23('0x1d')]||null:null,'attributes':_0xc51ed4[_0x9a23('0x1b')]?_0xc51ed4[_0x9a23('0x1b')][_0x9a23('0x1e')]||null:null,'include':_0xc51ed4['options']?_0xc51ed4[_0x9a23('0x1b')][_0x9a23('0x20')]?_[_0x9a23('0x22')](_0xc51ed4[_0x9a23('0x1b')][_0x9a23('0x20')],function(_0x5a21e4){return{'model':db[_0x5a21e4['model']],'as':_0x5a21e4['as'],'attributes':_0x5a21e4[_0x9a23('0x1e')],'include':_0x5a21e4[_0x9a23('0x20')]?_[_0x9a23('0x22')](_0x5a21e4[_0x9a23('0x20')],function(_0x412932){return{'model':db[_0x412932[_0x9a23('0x21')]],'as':_0x412932['as'],'attributes':_0x412932[_0x9a23('0x1e')],'include':_0x412932[_0x9a23('0x20')]?_[_0x9a23('0x22')](_0x412932['include'],function(_0xe5267e){return{'model':db[_0xe5267e[_0x9a23('0x21')]],'as':_0xe5267e['as'],'attributes':_0xe5267e[_0x9a23('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf24106){logger[_0x9a23('0x10')](_0x9a23('0x25'),_0xc51ed4);logger[_0x9a23('0x12')](_0x9a23('0x25'),_0xc51ed4,JSON['stringify'](_0xf24106));_0x44ef3e(_0xf24106);})[_0x9a23('0x19')](function(_0x5a8ba6){logger[_0x9a23('0x15')](_0x9a23('0x25'),_0x5a8ba6[_0x9a23('0x17')],_0xc51ed4);_0x3259d6(_0x3eb935[_0x9a23('0x15')](0x1f4,_0x5a8ba6['message']));});});}; \ No newline at end of file +var _0xddb6=['request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','debug','FaxQueue','then','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','FaxQueue,\x20%s,\x20%s'];(function(_0x1192ae,_0xc21e76){var _0x433404=function(_0x415cc1){while(--_0x415cc1){_0x1192ae['push'](_0x1192ae['shift']());}};_0x433404(++_0xc21e76);}(_0xddb6,0x1cf));var _0x6ddb=function(_0x252cfb,_0xaa0d1){_0x252cfb=_0x252cfb-0x0;var _0x3f405c=_0xddb6[_0x252cfb];return _0x3f405c;};'use strict';var _=require(_0x6ddb('0x0'));var util=require(_0x6ddb('0x1'));var moment=require(_0x6ddb('0x2'));var BPromise=require(_0x6ddb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ddb('0x4'));var db=require(_0x6ddb('0x5'))['db'];var utils=require(_0x6ddb('0x6'));var logger=require(_0x6ddb('0x7'))('rpc');var config=require(_0x6ddb('0x8'));var jayson=require(_0x6ddb('0x9'));var client=jayson[_0x6ddb('0xa')][_0x6ddb('0xb')]({'port':0x232a});config[_0x6ddb('0xc')]=_[_0x6ddb('0xd')](config[_0x6ddb('0xc')],{'host':_0x6ddb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2c8f9e,_0x3a6522,_0x2dd6c6){return new BPromise(function(_0x1f0a2c,_0x2362c9){return client[_0x6ddb('0xf')](_0x2c8f9e,_0x2dd6c6)['then'](function(_0xa80283){logger[_0x6ddb('0x10')](_0x6ddb('0x11'),_0x3a6522,_0x6ddb('0x12'));logger['debug'](_0x6ddb('0x13'),_0x3a6522,_0x6ddb('0x12'),JSON['stringify'](_0xa80283));if(_0xa80283[_0x6ddb('0x14')]){if(_0xa80283['error'][_0x6ddb('0x15')]===0x1f4){logger['error'](_0x6ddb('0x11'),_0x3a6522,_0xa80283['error'][_0x6ddb('0x16')]);return _0x2362c9(_0xa80283[_0x6ddb('0x14')]['message']);}logger[_0x6ddb('0x14')]('FaxQueue,\x20%s,\x20%s',_0x3a6522,_0xa80283['error'][_0x6ddb('0x16')]);return _0x1f0a2c(_0xa80283[_0x6ddb('0x14')][_0x6ddb('0x16')]);}else{logger[_0x6ddb('0x10')](_0x6ddb('0x11'),_0x3a6522,_0x6ddb('0x12'));_0x1f0a2c(_0xa80283['result'][_0x6ddb('0x16')]);}})[_0x6ddb('0x17')](function(_0x1135a1){logger[_0x6ddb('0x14')]('FaxQueue,\x20%s,\x20%s',_0x3a6522,_0x1135a1);_0x2362c9(_0x1135a1);});});}exports[_0x6ddb('0x18')]=function(_0x2c876a){var _0x194396=this;return new Promise(function(_0x23fcf4,_0x81432c){return db['FaxQueue']['findAll']({'raw':_0x2c876a[_0x6ddb('0x19')]?_0x2c876a[_0x6ddb('0x19')][_0x6ddb('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c876a[_0x6ddb('0x19')]?_0x2c876a[_0x6ddb('0x19')][_0x6ddb('0x1b')]||null:null,'attributes':_0x2c876a['options']?_0x2c876a[_0x6ddb('0x19')][_0x6ddb('0x1c')]||null:null,'limit':_0x2c876a[_0x6ddb('0x19')]?_0x2c876a['options'][_0x6ddb('0x1d')]||null:null,'include':_0x2c876a[_0x6ddb('0x19')]?_0x2c876a[_0x6ddb('0x19')][_0x6ddb('0x1e')]?_[_0x6ddb('0x1f')](_0x2c876a['options'][_0x6ddb('0x1e')],function(_0xc57a28){return{'model':db[_0xc57a28['model']],'as':_0xc57a28['as'],'attributes':_0xc57a28['attributes'],'include':_0xc57a28[_0x6ddb('0x1e')]?_[_0x6ddb('0x1f')](_0xc57a28[_0x6ddb('0x1e')],function(_0xa92d16){return{'model':db[_0xa92d16['model']],'as':_0xa92d16['as'],'attributes':_0xa92d16['attributes'],'include':_0xa92d16[_0x6ddb('0x1e')]?_[_0x6ddb('0x1f')](_0xa92d16['include'],function(_0x2a0bc3){return{'model':db[_0x2a0bc3[_0x6ddb('0x20')]],'as':_0x2a0bc3['as'],'attributes':_0x2a0bc3[_0x6ddb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28e4f7){logger[_0x6ddb('0x10')](_0x6ddb('0x18'),_0x2c876a);logger[_0x6ddb('0x21')](_0x6ddb('0x18'),_0x2c876a,JSON['stringify'](_0x28e4f7));_0x23fcf4(_0x28e4f7);})[_0x6ddb('0x17')](function(_0x2d815e){logger[_0x6ddb('0x14')](_0x6ddb('0x18'),_0x2d815e[_0x6ddb('0x16')],_0x2c876a);_0x81432c(_0x194396[_0x6ddb('0x14')](0x1f4,_0x2d815e[_0x6ddb('0x16')]));});});};exports['ShowFaxQueue']=function(_0x407331){var _0x509598=this;return new Promise(function(_0x5dd1f2,_0x32d52a){return db[_0x6ddb('0x22')]['find']({'raw':_0x407331[_0x6ddb('0x19')]?_0x407331[_0x6ddb('0x19')][_0x6ddb('0x1a')]===undefined?!![]:![]:!![],'where':_0x407331[_0x6ddb('0x19')]?_0x407331[_0x6ddb('0x19')][_0x6ddb('0x1b')]||null:null,'attributes':_0x407331[_0x6ddb('0x19')]?_0x407331[_0x6ddb('0x19')][_0x6ddb('0x1c')]||null:null,'include':_0x407331[_0x6ddb('0x19')]?_0x407331[_0x6ddb('0x19')][_0x6ddb('0x1e')]?_['map'](_0x407331[_0x6ddb('0x19')][_0x6ddb('0x1e')],function(_0x2b2331){return{'model':db[_0x2b2331[_0x6ddb('0x20')]],'as':_0x2b2331['as'],'attributes':_0x2b2331[_0x6ddb('0x1c')],'include':_0x2b2331[_0x6ddb('0x1e')]?_['map'](_0x2b2331[_0x6ddb('0x1e')],function(_0x3992c1){return{'model':db[_0x3992c1['model']],'as':_0x3992c1['as'],'attributes':_0x3992c1[_0x6ddb('0x1c')],'include':_0x3992c1['include']?_['map'](_0x3992c1[_0x6ddb('0x1e')],function(_0x73877e){return{'model':db[_0x73877e[_0x6ddb('0x20')]],'as':_0x73877e['as'],'attributes':_0x73877e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ddb('0x23')](function(_0x1b64a8){logger[_0x6ddb('0x10')](_0x6ddb('0x24'),_0x407331);logger[_0x6ddb('0x21')]('ShowFaxQueue',_0x407331,JSON['stringify'](_0x1b64a8));_0x5dd1f2(_0x1b64a8);})[_0x6ddb('0x17')](function(_0x1d7e4b){logger[_0x6ddb('0x14')]('ShowFaxQueue',_0x1d7e4b[_0x6ddb('0x16')],_0x407331);_0x32d52a(_0x509598[_0x6ddb('0x14')](0x1f4,_0x1d7e4b[_0x6ddb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 36af01e..71294d5 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 _0xf4ec=['remove','update','register','./faxQueue.events','save'];(function(_0x41079e,_0x1dc173){var _0x4c8e7d=function(_0x7a94dc){while(--_0x7a94dc){_0x41079e['push'](_0x41079e['shift']());}};_0x4c8e7d(++_0x1dc173);}(_0xf4ec,0xd5));var _0xcf4e=function(_0x3de8a2,_0x1c8615){_0x3de8a2=_0x3de8a2-0x0;var _0x267573=_0xf4ec[_0x3de8a2];return _0x267573;};'use strict';var FaxQueueEvents=require(_0xcf4e('0x0'));var events=[_0xcf4e('0x1'),_0xcf4e('0x2'),_0xcf4e('0x3')];function createListener(_0x36cb58,_0x3b691b){return function(_0x1c9f44){_0x3b691b['emit'](_0x36cb58,_0x1c9f44);};}function removeListener(_0x1c9994,_0x61e3f1){return function(){FaxQueueEvents['removeListener'](_0x1c9994,_0x61e3f1);};}exports[_0xcf4e('0x4')]=function(_0x37d1f7){for(var _0x4898e5=0x0,_0x21d79f=events['length'];_0x4898e5<_0x21d79f;_0x4898e5++){var _0x1c8fab=events[_0x4898e5];var _0xbee03d=createListener('faxQueue:'+_0x1c8fab,_0x37d1f7);FaxQueueEvents['on'](_0x1c8fab,_0xbee03d);}}; \ No newline at end of file +var _0xaa50=['./faxQueue.events','save','remove','emit','removeListener','length','faxQueue:'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xaa50,0x17a));var _0x0aa5=function(_0x267d24,_0x3875e1){_0x267d24=_0x267d24-0x0;var _0x3d0742=_0xaa50[_0x267d24];return _0x3d0742;};'use strict';var FaxQueueEvents=require(_0x0aa5('0x0'));var events=[_0x0aa5('0x1'),_0x0aa5('0x2'),'update'];function createListener(_0x55c5f2,_0x216d77){return function(_0x2a53be){_0x216d77[_0x0aa5('0x3')](_0x55c5f2,_0x2a53be);};}function removeListener(_0x22e12c,_0xe8b42){return function(){FaxQueueEvents[_0x0aa5('0x4')](_0x22e12c,_0xe8b42);};}exports['register']=function(_0x3e5641){for(var _0xa1819f=0x0,_0x1a5803=events[_0x0aa5('0x5')];_0xa1819f<_0x1a5803;_0xa1819f++){var _0x197d65=events[_0xa1819f];var _0x32a0aa=createListener(_0x0aa5('0x6')+_0x197d65,_0x3e5641);FaxQueueEvents['on'](_0x197d65,_0x32a0aa);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2dffad0..58e06c9 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x0b0e[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x5857a7,_0x3f8601){var _0x2c35e4=function(_0x1e3492){while(--_0x1e3492){_0x5857a7['push'](_0x5857a7['shift']());}};_0x2c35e4(++_0x3f8601);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 61cbb5c..8bf526c 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 _0xb2be=['sequelize','exports','STRING','DATE','moment'];(function(_0x7856d2,_0xcd3a92){var _0x370734=function(_0x40af61){while(--_0x40af61){_0x7856d2['push'](_0x7856d2['shift']());}};_0x370734(++_0xcd3a92);}(_0xb2be,0x1b7));var _0xeb2b=function(_0x52d231,_0x37bc71){_0x52d231=_0x52d231-0x0;var _0x550ac5=_0xb2be[_0x52d231];return _0x550ac5;};'use strict';var moment=require(_0xeb2b('0x0'));var Sequelize=require(_0xeb2b('0x1'));module[_0xeb2b('0x2')]={'uniqueid':{'type':Sequelize[_0xeb2b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xeb2b('0x3')]},'joinAt':{'type':Sequelize[_0xeb2b('0x4')]},'leaveAt':{'type':Sequelize[_0xeb2b('0x4')]},'acceptAt':{'type':Sequelize[_0xeb2b('0x4')]},'exitAt':{'type':Sequelize[_0xeb2b('0x4')]},'reason':{'type':Sequelize[_0xeb2b('0x3')]}}; \ No newline at end of file +var _0x8ec1=['exports','STRING','DATE','moment'];(function(_0x5552cf,_0x1b4e7c){var _0x21a6c7=function(_0x38fff5){while(--_0x38fff5){_0x5552cf['push'](_0x5552cf['shift']());}};_0x21a6c7(++_0x1b4e7c);}(_0x8ec1,0x147));var _0x18ec=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x8ec1[_0x5712f8];return _0x14a364;};'use strict';var moment=require(_0x18ec('0x0'));var Sequelize=require('sequelize');module[_0x18ec('0x1')]={'uniqueid':{'type':Sequelize[_0x18ec('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x18ec('0x2')]},'joinAt':{'type':Sequelize[_0x18ec('0x3')]},'leaveAt':{'type':Sequelize[_0x18ec('0x3')]},'acceptAt':{'type':Sequelize[_0x18ec('0x3')]},'exitAt':{'type':Sequelize[_0x18ec('0x3')]},'reason':{'type':Sequelize[_0x18ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a0cda80..aa3bd52 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 _0x8f52=['filters','merge','VIRTUAL','options','includeAll','findAll','rows','params','length','include','find','catch','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','query','keys','intersection','model','attributes','fields','limit','order','sort','where'];(function(_0x42affe,_0x113e33){var _0x12e022=function(_0x47afdc){while(--_0x47afdc){_0x42affe['push'](_0x42affe['shift']());}};_0x12e022(++_0x113e33);}(_0x8f52,0x1be));var _0x28f5=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x8f52[_0x43d16c];return _0x208cce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28f5('0x0'));var rimraf=require(_0x28f5('0x1'));var zipdir=require(_0x28f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28f5('0x3'));var BPromise=require(_0x28f5('0x4'));var Mustache=require(_0x28f5('0x5'));var util=require(_0x28f5('0x6'));var path=require(_0x28f5('0x7'));var sox=require(_0x28f5('0x8'));var csv=require('to-csv');var ejs=require(_0x28f5('0x9'));var fs=require('fs');var _=require(_0x28f5('0xa'));var squel=require(_0x28f5('0xb'));var crypto=require(_0x28f5('0xc'));var jsforce=require(_0x28f5('0xd'));var deskjs=require(_0x28f5('0xe'));var toCsv=require(_0x28f5('0xf'));var querystring=require(_0x28f5('0x10'));var Papa=require(_0x28f5('0x11'));var Redis=require(_0x28f5('0x12'));var authService=require(_0x28f5('0x13'));var qs=require(_0x28f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28f5('0x15'));var logger=require('../../config/logger')(_0x28f5('0x16'));var utils=require(_0x28f5('0x17'));var config=require(_0x28f5('0x18'));var db=require(_0x28f5('0x19'))['db'];function respondWithStatusCode(_0x43d20b,_0x5c8a1c){_0x5c8a1c=_0x5c8a1c||0xcc;return function(_0x3daa54){if(_0x3daa54){return _0x43d20b['sendStatus'](_0x5c8a1c);}return _0x43d20b['status'](_0x5c8a1c)[_0x28f5('0x1a')]();};}function respondWithResult(_0xb2b1dc,_0x5adcb5){_0x5adcb5=_0x5adcb5||0xc8;return function(_0x1e8f27){if(_0x1e8f27){return _0xb2b1dc[_0x28f5('0x1b')](_0x5adcb5)[_0x28f5('0x1c')](_0x1e8f27);}};}function respondWithFilteredResult(_0x244790,_0x263707){return function(_0x2c91df){if(_0x2c91df){var _0x5ae066=_0x2c91df[_0x28f5('0x1d')],_0x4ee1fd=_0x263707[_0x28f5('0x1e')],_0x247e95=_0x263707[_0x28f5('0x1e')]+_0x263707['limit'],_0xe172d0;if(_0x247e95>=_0x5ae066){_0x247e95=_0x5ae066;_0xe172d0=0xc8;}else{_0xe172d0=0xce;}_0x244790['status'](_0xe172d0);return _0x244790['set'](_0x28f5('0x1f'),_0x4ee1fd+'-'+_0x247e95+'/'+_0x5ae066)[_0x28f5('0x1c')](_0x2c91df);}return null;};}function patchUpdates(_0x2f45c7){return function(_0x12c5f1){try{jsonpatch[_0x28f5('0x20')](_0x12c5f1,_0x2f45c7,!![]);}catch(_0x29daf4){return BPromise[_0x28f5('0x21')](_0x29daf4);}return _0x12c5f1[_0x28f5('0x22')]();};}function saveUpdates(_0x5daaaf,_0x209564){return function(_0x462881){if(_0x462881){return _0x462881[_0x28f5('0x23')](_0x5daaaf)[_0x28f5('0x24')](function(_0xd42598){return _0xd42598;});}return null;};}function removeEntity(_0x379b75,_0x2e262b){return function(_0xe24c08){if(_0xe24c08){return _0xe24c08[_0x28f5('0x25')]()['then'](function(){_0x379b75[_0x28f5('0x1b')](0xcc)[_0x28f5('0x1a')]();});}};}function handleEntityNotFound(_0x7b6ffc,_0x2f90c3){return function(_0x283e18){if(!_0x283e18){_0x7b6ffc[_0x28f5('0x26')](0x194);}return _0x283e18;};}function handleError(_0x4ddb0f,_0x16b618){_0x16b618=_0x16b618||0x1f4;return function(_0x2ba2f8){logger[_0x28f5('0x27')](_0x2ba2f8[_0x28f5('0x28')]);if(_0x2ba2f8[_0x28f5('0x29')]){delete _0x2ba2f8[_0x28f5('0x29')];}_0x4ddb0f['status'](_0x16b618)[_0x28f5('0x2a')](_0x2ba2f8);};}exports[_0x28f5('0x2b')]=function(_0x468bf3,_0x18353d){var _0x18e1ed={},_0x293490={},_0x401ed2={'count':0x0,'rows':[]};var _0x5157ca=_[_0x28f5('0x2c')](db[_0x28f5('0x2d')][_0x28f5('0x2e')],function(_0x170cd9){return{'name':_0x170cd9['fieldName'],'type':_0x170cd9[_0x28f5('0x2f')]['key']};});_0x293490['model']=_[_0x28f5('0x2c')](_0x5157ca,_0x28f5('0x29'));_0x293490[_0x28f5('0x30')]=_[_0x28f5('0x31')](_0x468bf3['query']);_0x293490['filters']=_[_0x28f5('0x32')](_0x293490[_0x28f5('0x33')],_0x293490[_0x28f5('0x30')]);_0x18e1ed[_0x28f5('0x34')]=_['intersection'](_0x293490['model'],qs[_0x28f5('0x35')](_0x468bf3['query'][_0x28f5('0x35')]));_0x18e1ed[_0x28f5('0x34')]=_0x18e1ed[_0x28f5('0x34')]['length']?_0x18e1ed[_0x28f5('0x34')]:_0x293490[_0x28f5('0x33')];if(!_0x468bf3[_0x28f5('0x30')]['hasOwnProperty']('nolimit')){_0x18e1ed[_0x28f5('0x36')]=qs[_0x28f5('0x36')](_0x468bf3[_0x28f5('0x30')]['limit']);_0x18e1ed[_0x28f5('0x1e')]=qs[_0x28f5('0x1e')](_0x468bf3['query'][_0x28f5('0x1e')]);}_0x18e1ed[_0x28f5('0x37')]=qs['sort'](_0x468bf3[_0x28f5('0x30')][_0x28f5('0x38')]);_0x18e1ed[_0x28f5('0x39')]=qs[_0x28f5('0x3a')](_['pick'](_0x468bf3['query'],_0x293490[_0x28f5('0x3a')]),_0x5157ca);if(_0x468bf3[_0x28f5('0x30')]['filter']){_0x18e1ed[_0x28f5('0x39')]=_[_0x28f5('0x3b')](_0x18e1ed[_0x28f5('0x39')],{'$or':_[_0x28f5('0x2c')](_0x5157ca,function(_0x5951c2){if(_0x5951c2['type']!==_0x28f5('0x3c')){var _0x31e5d0={};_0x31e5d0[_0x5951c2[_0x28f5('0x29')]]={'$like':'%'+_0x468bf3['query']['filter']+'%'};return _0x31e5d0;}})});}_0x18e1ed=_[_0x28f5('0x3b')]({},_0x18e1ed,_0x468bf3[_0x28f5('0x3d')]);var _0xab8791={'where':_0x18e1ed[_0x28f5('0x39')]};return db['FaxQueueReport'][_0x28f5('0x1d')](_0xab8791)[_0x28f5('0x24')](function(_0x48c327){_0x401ed2[_0x28f5('0x1d')]=_0x48c327;if(_0x468bf3['query'][_0x28f5('0x3e')]){_0x18e1ed['include']=[{'all':!![]}];}return db[_0x28f5('0x2d')][_0x28f5('0x3f')](_0x18e1ed);})[_0x28f5('0x24')](function(_0x4d54c5){_0x401ed2[_0x28f5('0x40')]=_0x4d54c5;return _0x401ed2;})[_0x28f5('0x24')](respondWithFilteredResult(_0x18353d,_0x18e1ed))['catch'](handleError(_0x18353d,null));};exports['show']=function(_0xa925d4,_0x595617){var _0x139896={'raw':!![],'where':{'id':_0xa925d4[_0x28f5('0x41')]['id']}},_0x31b75b={};_0x31b75b[_0x28f5('0x33')]=_[_0x28f5('0x31')](db[_0x28f5('0x2d')][_0x28f5('0x2e')]);_0x31b75b[_0x28f5('0x30')]=_[_0x28f5('0x31')](_0xa925d4[_0x28f5('0x30')]);_0x31b75b[_0x28f5('0x3a')]=_[_0x28f5('0x32')](_0x31b75b['model'],_0x31b75b[_0x28f5('0x30')]);_0x139896[_0x28f5('0x34')]=_[_0x28f5('0x32')](_0x31b75b[_0x28f5('0x33')],qs[_0x28f5('0x35')](_0xa925d4[_0x28f5('0x30')][_0x28f5('0x35')]));_0x139896['attributes']=_0x139896[_0x28f5('0x34')][_0x28f5('0x42')]?_0x139896[_0x28f5('0x34')]:_0x31b75b[_0x28f5('0x33')];if(_0xa925d4[_0x28f5('0x30')]['includeAll']){_0x139896[_0x28f5('0x43')]=[{'all':!![]}];}_0x139896=_[_0x28f5('0x3b')]({},_0x139896,_0xa925d4[_0x28f5('0x3d')]);return db[_0x28f5('0x2d')][_0x28f5('0x44')](_0x139896)[_0x28f5('0x24')](handleEntityNotFound(_0x595617,null))[_0x28f5('0x24')](respondWithResult(_0x595617,null))[_0x28f5('0x45')](handleError(_0x595617,null));};exports['create']=function(_0x2c24e,_0x3b3b31){return db[_0x28f5('0x2d')]['create'](_0x2c24e[_0x28f5('0x46')],{})[_0x28f5('0x24')](respondWithResult(_0x3b3b31,0xc9))[_0x28f5('0x45')](handleError(_0x3b3b31,null));};exports[_0x28f5('0x23')]=function(_0x2f1e38,_0x17ad04){if(_0x2f1e38['body']['id']){delete _0x2f1e38['body']['id'];}return db[_0x28f5('0x2d')][_0x28f5('0x44')]({'where':{'id':_0x2f1e38[_0x28f5('0x41')]['id']}})['then'](handleEntityNotFound(_0x17ad04,null))[_0x28f5('0x24')](saveUpdates(_0x2f1e38['body'],null))[_0x28f5('0x24')](respondWithResult(_0x17ad04,null))[_0x28f5('0x45')](handleError(_0x17ad04,null));};exports[_0x28f5('0x25')]=function(_0x557683,_0x466012){return db[_0x28f5('0x2d')][_0x28f5('0x44')]({'where':{'id':_0x557683[_0x28f5('0x41')]['id']}})['then'](handleEntityNotFound(_0x466012,null))['then'](removeEntity(_0x466012,null))[_0x28f5('0x45')](handleError(_0x466012,null));};exports[_0x28f5('0x47')]=function(_0x3d100c,_0x2cc241){return db[_0x28f5('0x2d')][_0x28f5('0x47')]()[_0x28f5('0x24')](respondWithResult(_0x2cc241,null))[_0x28f5('0x45')](handleError(_0x2cc241,null));}; \ No newline at end of file +var _0x05f7=['../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','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','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x20538c,_0x16921c){var _0x11566d=function(_0x23b269){while(--_0x23b269){_0x20538c['push'](_0x20538c['shift']());}};_0x11566d(++_0x16921c);}(_0x05f7,0x1b1));var _0x705f=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x05f7[_0x9be28f];return _0xa9f52d;};'use strict';var pdf=require(_0x705f('0x0'));var emlformat=require(_0x705f('0x1'));var rimraf=require(_0x705f('0x2'));var zipdir=require(_0x705f('0x3'));var jsonpatch=require(_0x705f('0x4'));var rp=require(_0x705f('0x5'));var moment=require('moment');var BPromise=require(_0x705f('0x6'));var Mustache=require('mustache');var util=require(_0x705f('0x7'));var path=require(_0x705f('0x8'));var sox=require(_0x705f('0x9'));var csv=require(_0x705f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x705f('0xb'));var squel=require(_0x705f('0xc'));var crypto=require('crypto');var jsforce=require(_0x705f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x705f('0xa'));var querystring=require(_0x705f('0xe'));var Papa=require(_0x705f('0xf'));var Redis=require(_0x705f('0x10'));var authService=require(_0x705f('0x11'));var qs=require(_0x705f('0x12'));var as=require(_0x705f('0x13'));var hardwareService=require(_0x705f('0x14'));var logger=require(_0x705f('0x15'))(_0x705f('0x16'));var utils=require('../../config/utils');var config=require(_0x705f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec89c,_0x2a3e5c){_0x2a3e5c=_0x2a3e5c||0xcc;return function(_0x10fe72){if(_0x10fe72){return _0x5ec89c[_0x705f('0x18')](_0x2a3e5c);}return _0x5ec89c['status'](_0x2a3e5c)[_0x705f('0x19')]();};}function respondWithResult(_0xb4e322,_0x2f6589){_0x2f6589=_0x2f6589||0xc8;return function(_0x32974f){if(_0x32974f){return _0xb4e322[_0x705f('0x1a')](_0x2f6589)[_0x705f('0x1b')](_0x32974f);}};}function respondWithFilteredResult(_0x54ee3d,_0x45a4c5){return function(_0x1558f6){if(_0x1558f6){var _0x249e60=_0x1558f6['count'],_0x1dc4f1=_0x45a4c5[_0x705f('0x1c')],_0x33c20a=_0x45a4c5['offset']+_0x45a4c5[_0x705f('0x1d')],_0x4f9383;if(_0x33c20a>=_0x249e60){_0x33c20a=_0x249e60;_0x4f9383=0xc8;}else{_0x4f9383=0xce;}_0x54ee3d[_0x705f('0x1a')](_0x4f9383);return _0x54ee3d[_0x705f('0x1e')](_0x705f('0x1f'),_0x1dc4f1+'-'+_0x33c20a+'/'+_0x249e60)[_0x705f('0x1b')](_0x1558f6);}return null;};}function patchUpdates(_0x591d79){return function(_0x20abdd){try{jsonpatch['apply'](_0x20abdd,_0x591d79,!![]);}catch(_0x1533b6){return BPromise[_0x705f('0x20')](_0x1533b6);}return _0x20abdd[_0x705f('0x21')]();};}function saveUpdates(_0x2fb3cf,_0xa62bfa){return function(_0x3994fb){if(_0x3994fb){return _0x3994fb['update'](_0x2fb3cf)[_0x705f('0x22')](function(_0xa9a21c){return _0xa9a21c;});}return null;};}function removeEntity(_0x781dc4,_0xc91427){return function(_0x53ab06){if(_0x53ab06){return _0x53ab06[_0x705f('0x23')]()[_0x705f('0x22')](function(){_0x781dc4['status'](0xcc)[_0x705f('0x19')]();});}};}function handleEntityNotFound(_0x1e223e,_0x587cc9){return function(_0x299d7b){if(!_0x299d7b){_0x1e223e[_0x705f('0x18')](0x194);}return _0x299d7b;};}function handleError(_0x16b74c,_0x156733){_0x156733=_0x156733||0x1f4;return function(_0x4ca3bd){logger[_0x705f('0x24')](_0x4ca3bd[_0x705f('0x25')]);if(_0x4ca3bd['name']){delete _0x4ca3bd[_0x705f('0x26')];}_0x16b74c[_0x705f('0x1a')](_0x156733)[_0x705f('0x27')](_0x4ca3bd);};}exports[_0x705f('0x28')]=function(_0x566853,_0xa25063){var _0x25c2c7={},_0x3559b0={},_0x4791bf={'count':0x0,'rows':[]};var _0x3e94aa=_['map'](db[_0x705f('0x29')][_0x705f('0x2a')],function(_0x3ddfb0){return{'name':_0x3ddfb0[_0x705f('0x2b')],'type':_0x3ddfb0[_0x705f('0x2c')]['key']};});_0x3559b0[_0x705f('0x2d')]=_[_0x705f('0x2e')](_0x3e94aa,'name');_0x3559b0[_0x705f('0x2f')]=_[_0x705f('0x30')](_0x566853[_0x705f('0x2f')]);_0x3559b0[_0x705f('0x31')]=_[_0x705f('0x32')](_0x3559b0[_0x705f('0x2d')],_0x3559b0[_0x705f('0x2f')]);_0x25c2c7['attributes']=_[_0x705f('0x32')](_0x3559b0[_0x705f('0x2d')],qs['fields'](_0x566853['query'][_0x705f('0x33')]));_0x25c2c7['attributes']=_0x25c2c7[_0x705f('0x34')][_0x705f('0x35')]?_0x25c2c7[_0x705f('0x34')]:_0x3559b0['model'];if(!_0x566853[_0x705f('0x2f')]['hasOwnProperty'](_0x705f('0x36'))){_0x25c2c7[_0x705f('0x1d')]=qs[_0x705f('0x1d')](_0x566853[_0x705f('0x2f')][_0x705f('0x1d')]);_0x25c2c7['offset']=qs['offset'](_0x566853[_0x705f('0x2f')]['offset']);}_0x25c2c7[_0x705f('0x37')]=qs[_0x705f('0x38')](_0x566853[_0x705f('0x2f')][_0x705f('0x38')]);_0x25c2c7[_0x705f('0x39')]=qs['filters'](_[_0x705f('0x3a')](_0x566853[_0x705f('0x2f')],_0x3559b0['filters']),_0x3e94aa);if(_0x566853[_0x705f('0x2f')]['filter']){_0x25c2c7[_0x705f('0x39')]=_[_0x705f('0x3b')](_0x25c2c7[_0x705f('0x39')],{'$or':_[_0x705f('0x2e')](_0x3e94aa,function(_0x6e477b){if(_0x6e477b[_0x705f('0x2c')]!==_0x705f('0x3c')){var _0x35a1ee={};_0x35a1ee[_0x6e477b[_0x705f('0x26')]]={'$like':'%'+_0x566853['query'][_0x705f('0x3d')]+'%'};return _0x35a1ee;}})});}_0x25c2c7=_['merge']({},_0x25c2c7,_0x566853[_0x705f('0x3e')]);var _0x203023={'where':_0x25c2c7[_0x705f('0x39')]};return db[_0x705f('0x29')][_0x705f('0x3f')](_0x203023)[_0x705f('0x22')](function(_0x4656fa){_0x4791bf[_0x705f('0x3f')]=_0x4656fa;if(_0x566853[_0x705f('0x2f')][_0x705f('0x40')]){_0x25c2c7[_0x705f('0x41')]=[{'all':!![]}];}return db[_0x705f('0x29')][_0x705f('0x42')](_0x25c2c7);})[_0x705f('0x22')](function(_0x3adc95){_0x4791bf[_0x705f('0x43')]=_0x3adc95;return _0x4791bf;})[_0x705f('0x22')](respondWithFilteredResult(_0xa25063,_0x25c2c7))[_0x705f('0x44')](handleError(_0xa25063,null));};exports[_0x705f('0x45')]=function(_0x4a9912,_0x44c766){var _0x2ae7c2={'raw':!![],'where':{'id':_0x4a9912[_0x705f('0x46')]['id']}},_0x55c14c={};_0x55c14c[_0x705f('0x2d')]=_[_0x705f('0x30')](db[_0x705f('0x29')][_0x705f('0x2a')]);_0x55c14c[_0x705f('0x2f')]=_['keys'](_0x4a9912[_0x705f('0x2f')]);_0x55c14c[_0x705f('0x31')]=_[_0x705f('0x32')](_0x55c14c[_0x705f('0x2d')],_0x55c14c[_0x705f('0x2f')]);_0x2ae7c2[_0x705f('0x34')]=_['intersection'](_0x55c14c[_0x705f('0x2d')],qs[_0x705f('0x33')](_0x4a9912[_0x705f('0x2f')][_0x705f('0x33')]));_0x2ae7c2[_0x705f('0x34')]=_0x2ae7c2['attributes'][_0x705f('0x35')]?_0x2ae7c2['attributes']:_0x55c14c[_0x705f('0x2d')];if(_0x4a9912[_0x705f('0x2f')][_0x705f('0x40')]){_0x2ae7c2[_0x705f('0x41')]=[{'all':!![]}];}_0x2ae7c2=_[_0x705f('0x3b')]({},_0x2ae7c2,_0x4a9912['options']);return db[_0x705f('0x29')][_0x705f('0x47')](_0x2ae7c2)['then'](handleEntityNotFound(_0x44c766,null))['then'](respondWithResult(_0x44c766,null))[_0x705f('0x44')](handleError(_0x44c766,null));};exports[_0x705f('0x48')]=function(_0x3a0eff,_0x275692){return db[_0x705f('0x29')][_0x705f('0x48')](_0x3a0eff[_0x705f('0x49')],{})[_0x705f('0x22')](respondWithResult(_0x275692,0xc9))['catch'](handleError(_0x275692,null));};exports[_0x705f('0x4a')]=function(_0x1bea86,_0x24dedc){if(_0x1bea86[_0x705f('0x49')]['id']){delete _0x1bea86[_0x705f('0x49')]['id'];}return db[_0x705f('0x29')][_0x705f('0x47')]({'where':{'id':_0x1bea86[_0x705f('0x46')]['id']}})[_0x705f('0x22')](handleEntityNotFound(_0x24dedc,null))[_0x705f('0x22')](saveUpdates(_0x1bea86['body'],null))[_0x705f('0x22')](respondWithResult(_0x24dedc,null))[_0x705f('0x44')](handleError(_0x24dedc,null));};exports[_0x705f('0x23')]=function(_0x6b4b92,_0x2c277a){return db['FaxQueueReport']['find']({'where':{'id':_0x6b4b92[_0x705f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c277a,null))[_0x705f('0x22')](removeEntity(_0x2c277a,null))['catch'](handleError(_0x2c277a,null));};exports[_0x705f('0x4b')]=function(_0x1bda01,_0x3ed9a9){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x3ed9a9,null))[_0x705f('0x44')](handleError(_0x3ed9a9,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2dd7e3b..78b3bd0 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 _0xa5d7=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x52f95,_0x233936){_0x52f95=_0x52f95-0x0;var _0x50c57d=_0xa5d7[_0x52f95];return _0x50c57d;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require('moment');var BPromise=require(_0x7a5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5d('0x5'));var rimraf=require('rimraf');var config=require(_0x7a5d('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0x7a5d('0x7')]=function(_0x42a143,_0x251ef5){return _0x42a143['define'](_0x7a5d('0x8'),attributes,{'tableName':_0x7a5d('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7a5d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa76e=['FaxQueueReport','report_fax_queue','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x76d88d,_0x48b0f2){var _0x2fa9e0=function(_0x55aac5){while(--_0x55aac5){_0x76d88d['push'](_0x76d88d['shift']());}};_0x2fa9e0(++_0x48b0f2);}(_0xa76e,0xfe));var _0xea76=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa76e[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var logger=require(_0xea76('0x1'))('api');var moment=require('moment');var BPromise=require(_0xea76('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea76('0x3'));var rimraf=require(_0xea76('0x4'));var config=require(_0xea76('0x5'));var attributes=require('./faxQueueReport.attributes');module[_0xea76('0x6')]=function(_0x48ff4f,_0x337097){return _0x48ff4f['define'](_0xea76('0x7'),attributes,{'tableName':_0xea76('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','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 071fc74..8adfb10 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 _0x4945=['http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','update','body','attributes','UpdateFaxQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x596435,_0x41ea9a){var _0x4d19d9=function(_0x2376eb){while(--_0x2376eb){_0x596435['push'](_0x596435['shift']());}};_0x4d19d9(++_0x41ea9a);}(_0x4945,0x1e7));var _0x5494=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4945[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5494('0x0'));var util=require(_0x5494('0x1'));var moment=require('moment');var BPromise=require(_0x5494('0x2'));var rs=require(_0x5494('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5494('0x4'))['db'];var utils=require(_0x5494('0x5'));var logger=require('../../config/logger')(_0x5494('0x6'));var config=require('../../config/environment');var jayson=require(_0x5494('0x7'));var client=jayson[_0x5494('0x8')][_0x5494('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ab73f,_0x319470,_0x14a3b4){return new BPromise(function(_0xe01fd9,_0x39fe60){return client[_0x5494('0xa')](_0x3ab73f,_0x14a3b4)[_0x5494('0xb')](function(_0x43f50e){logger[_0x5494('0xc')](_0x5494('0xd'),_0x319470,'request\x20sent');logger[_0x5494('0xe')](_0x5494('0xf'),_0x319470,_0x5494('0x10'),JSON['stringify'](_0x43f50e));if(_0x43f50e[_0x5494('0x11')]){if(_0x43f50e[_0x5494('0x11')]['code']===0x1f4){logger[_0x5494('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x319470,_0x43f50e[_0x5494('0x11')]['message']);return _0x39fe60(_0x43f50e[_0x5494('0x11')][_0x5494('0x12')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x319470,_0x43f50e[_0x5494('0x11')]['message']);return _0xe01fd9(_0x43f50e['error']['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x319470,_0x5494('0x10'));_0xe01fd9(_0x43f50e[_0x5494('0x13')][_0x5494('0x12')]);}})[_0x5494('0x14')](function(_0x567817){logger[_0x5494('0x11')](_0x5494('0xd'),_0x319470,_0x567817);_0x39fe60(_0x567817);});});}exports[_0x5494('0x15')]=function(_0x41a3f5){var _0x1279fd=this;return new Promise(function(_0x523644,_0x1e9e15){return db[_0x5494('0x16')][_0x5494('0x17')](_0x41a3f5['body'],{'raw':_0x41a3f5[_0x5494('0x18')]?_0x41a3f5[_0x5494('0x18')][_0x5494('0x19')]===undefined?!![]:![]:!![]})[_0x5494('0xb')](function(_0xd3ff3){logger[_0x5494('0xc')](_0x5494('0x15'),_0x41a3f5);logger[_0x5494('0xe')](_0x5494('0x15'),_0x41a3f5,JSON[_0x5494('0x1a')](_0xd3ff3));_0x523644(_0xd3ff3);})[_0x5494('0x14')](function(_0x5c8ca1){logger[_0x5494('0x11')]('CreateFaxQueueReport',_0x5c8ca1['message'],_0x41a3f5);_0x1e9e15(_0x1279fd['error'](0x1f4,_0x5c8ca1['message']));});});};exports['UpdateFaxQueueReport']=function(_0x15461b){var _0x3edc6c=this;return new Promise(function(_0x4699ec,_0x248590){return db[_0x5494('0x16')][_0x5494('0x1b')](_0x15461b[_0x5494('0x1c')],{'raw':_0x15461b['options']?_0x15461b[_0x5494('0x18')][_0x5494('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15461b[_0x5494('0x18')]?_0x15461b[_0x5494('0x18')]['where']||null:null,'attributes':_0x15461b['options']?_0x15461b[_0x5494('0x18')][_0x5494('0x1d')]||null:null,'limit':_0x15461b[_0x5494('0x18')]?_0x15461b[_0x5494('0x18')]['limit']||null:null})[_0x5494('0xb')](function(_0x2ce046){logger[_0x5494('0xc')](_0x5494('0x1e'),_0x15461b);logger['debug'](_0x5494('0x1e'),_0x15461b,JSON['stringify'](_0x2ce046));_0x4699ec(_0x2ce046);})['catch'](function(_0x32f3eb){logger[_0x5494('0x11')](_0x5494('0x1e'),_0x32f3eb[_0x5494('0x12')],_0x15461b);_0x248590(_0x3edc6c['error'](0x1f4,_0x32f3eb[_0x5494('0x12')]));});});}; \ No newline at end of file +var _0x5ad7=['debug','UpdateFaxQueueReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw'];(function(_0x29228b,_0x4801be){var _0x2acdce=function(_0x5356a2){while(--_0x5356a2){_0x29228b['push'](_0x29228b['shift']());}};_0x2acdce(++_0x4801be);}(_0x5ad7,0x184));var _0x75ad=function(_0xf8d2d7,_0x4d57cb){_0xf8d2d7=_0xf8d2d7-0x0;var _0x2e6bfb=_0x5ad7[_0xf8d2d7];return _0x2e6bfb;};'use strict';var _=require(_0x75ad('0x0'));var util=require(_0x75ad('0x1'));var moment=require('moment');var BPromise=require(_0x75ad('0x2'));var rs=require(_0x75ad('0x3'));var fs=require('fs');var Redis=require(_0x75ad('0x4'));var db=require(_0x75ad('0x5'))['db'];var utils=require(_0x75ad('0x6'));var logger=require(_0x75ad('0x7'))(_0x75ad('0x8'));var config=require(_0x75ad('0x9'));var jayson=require(_0x75ad('0xa'));var client=jayson[_0x75ad('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cb960,_0x47eb42,_0x3023cf){return new BPromise(function(_0xdd22ff,_0x2982ff){return client['request'](_0x1cb960,_0x3023cf)[_0x75ad('0xc')](function(_0x2a749c){logger[_0x75ad('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x47eb42,_0x75ad('0xe'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x47eb42,'request\x20sent',JSON[_0x75ad('0xf')](_0x2a749c));if(_0x2a749c[_0x75ad('0x10')]){if(_0x2a749c[_0x75ad('0x10')][_0x75ad('0x11')]===0x1f4){logger[_0x75ad('0x10')](_0x75ad('0x12'),_0x47eb42,_0x2a749c[_0x75ad('0x10')][_0x75ad('0x13')]);return _0x2982ff(_0x2a749c[_0x75ad('0x10')][_0x75ad('0x13')]);}logger[_0x75ad('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x47eb42,_0x2a749c['error'][_0x75ad('0x13')]);return _0xdd22ff(_0x2a749c[_0x75ad('0x10')][_0x75ad('0x13')]);}else{logger['info'](_0x75ad('0x12'),_0x47eb42,_0x75ad('0xe'));_0xdd22ff(_0x2a749c[_0x75ad('0x14')][_0x75ad('0x13')]);}})[_0x75ad('0x15')](function(_0x41e2b8){logger['error'](_0x75ad('0x12'),_0x47eb42,_0x41e2b8);_0x2982ff(_0x41e2b8);});});}exports[_0x75ad('0x16')]=function(_0x3f649a){var _0x31f41a=this;return new Promise(function(_0x1110b7,_0x39757e){return db[_0x75ad('0x17')][_0x75ad('0x18')](_0x3f649a[_0x75ad('0x19')],{'raw':_0x3f649a[_0x75ad('0x1a')]?_0x3f649a[_0x75ad('0x1a')][_0x75ad('0x1b')]===undefined?!![]:![]:!![]})[_0x75ad('0xc')](function(_0xc25d85){logger[_0x75ad('0xd')](_0x75ad('0x16'),_0x3f649a);logger[_0x75ad('0x1c')](_0x75ad('0x16'),_0x3f649a,JSON[_0x75ad('0xf')](_0xc25d85));_0x1110b7(_0xc25d85);})['catch'](function(_0x4d7f3d){logger[_0x75ad('0x10')]('CreateFaxQueueReport',_0x4d7f3d[_0x75ad('0x13')],_0x3f649a);_0x39757e(_0x31f41a[_0x75ad('0x10')](0x1f4,_0x4d7f3d[_0x75ad('0x13')]));});});};exports[_0x75ad('0x1d')]=function(_0x1c3a5f){var _0x215135=this;return new Promise(function(_0x2df733,_0x4e07b0){return db[_0x75ad('0x17')][_0x75ad('0x1e')](_0x1c3a5f[_0x75ad('0x19')],{'raw':_0x1c3a5f[_0x75ad('0x1a')]?_0x1c3a5f[_0x75ad('0x1a')][_0x75ad('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c3a5f[_0x75ad('0x1a')]?_0x1c3a5f['options'][_0x75ad('0x1f')]||null:null,'attributes':_0x1c3a5f[_0x75ad('0x1a')]?_0x1c3a5f[_0x75ad('0x1a')]['attributes']||null:null,'limit':_0x1c3a5f[_0x75ad('0x1a')]?_0x1c3a5f[_0x75ad('0x1a')]['limit']||null:null})[_0x75ad('0xc')](function(_0x1aa533){logger[_0x75ad('0xd')](_0x75ad('0x1d'),_0x1c3a5f);logger[_0x75ad('0x1c')](_0x75ad('0x1d'),_0x1c3a5f,JSON['stringify'](_0x1aa533));_0x2df733(_0x1aa533);})[_0x75ad('0x15')](function(_0x523364){logger[_0x75ad('0x10')]('UpdateFaxQueueReport',_0x523364[_0x75ad('0x13')],_0x1c3a5f);_0x4e07b0(_0x215135['error'](0x1f4,_0x523364['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index afc5b5e..ee33875 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 _0x5755=['express','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0x5755,0xd8));var _0x5575=function(_0x1a562f,_0x476596){_0x1a562f=_0x1a562f-0x0;var _0x921847=_0x5755[_0x1a562f];return _0x921847;};'use strict';var multer=require(_0x5575('0x0'));var util=require(_0x5575('0x1'));var path=require(_0x5575('0x2'));var timeout=require(_0x5575('0x3'));var express=require(_0x5575('0x4'));var router=express['Router']();var auth=require(_0x5575('0x5'));var interaction=require(_0x5575('0x6'));var config=require('../../config/environment');var controller=require(_0x5575('0x7'));router[_0x5575('0x8')]('/',auth[_0x5575('0x9')](),controller[_0x5575('0xa')]);router['get'](_0x5575('0xb'),auth[_0x5575('0x9')](),controller[_0x5575('0xc')]);router[_0x5575('0x8')]('/:id',auth[_0x5575('0x9')](),controller[_0x5575('0xd')]);router['post']('/',auth[_0x5575('0x9')](),controller[_0x5575('0xe')]);router['put']('/:id',auth[_0x5575('0x9')](),controller[_0x5575('0xf')]);router[_0x5575('0x10')](_0x5575('0x11'),auth[_0x5575('0x9')](),controller[_0x5575('0x12')]);module[_0x5575('0x13')]=router; \ No newline at end of file +var _0x3b81=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxQueueReport.controller'];(function(_0xf02353,_0x5d599b){var _0x59f7df=function(_0x2c7eb0){while(--_0x2c7eb0){_0xf02353['push'](_0xf02353['shift']());}};_0x59f7df(++_0x5d599b);}(_0x3b81,0x11e));var _0x13b8=function(_0x265829,_0x340f8e){_0x265829=_0x265829-0x0;var _0x4c8713=_0x3b81[_0x265829];return _0x4c8713;};'use strict';var multer=require(_0x13b8('0x0'));var util=require(_0x13b8('0x1'));var path=require(_0x13b8('0x2'));var timeout=require(_0x13b8('0x3'));var express=require(_0x13b8('0x4'));var router=express[_0x13b8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x13b8('0x6'));var config=require('../../config/environment');var controller=require(_0x13b8('0x7'));router[_0x13b8('0x8')]('/',auth['isAuthenticated'](),controller[_0x13b8('0x9')]);router[_0x13b8('0x8')](_0x13b8('0xa'),auth[_0x13b8('0xb')](),controller[_0x13b8('0xc')]);router[_0x13b8('0x8')](_0x13b8('0xd'),auth[_0x13b8('0xb')](),controller[_0x13b8('0xe')]);router[_0x13b8('0xf')]('/',auth[_0x13b8('0xb')](),controller[_0x13b8('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x13b8('0x11')]);router[_0x13b8('0x12')](_0x13b8('0xd'),auth[_0x13b8('0xb')](),controller[_0x13b8('0x13')]);module[_0x13b8('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5d22ebe..8f07f9b 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 _0x5f1f=['exports','ENUM','agent','DATE','NOW','moment'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5f1f,0x1a9));var _0xf5f1=function(_0xa43518,_0x2a4c6b){_0xa43518=_0xa43518-0x0;var _0x5e9b94=_0x5f1f[_0xa43518];return _0x5e9b94;};'use strict';var moment=require(_0xf5f1('0x0'));var Sequelize=require('sequelize');module[_0xf5f1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf5f1('0x2')]('account',_0xf5f1('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf5f1('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xf5f1('0x5')]}}; \ No newline at end of file +var _0x2c6b=['sequelize','ENUM','account','queue','DATE','moment'];(function(_0x184e4a,_0x300787){var _0x243cfe=function(_0xb90fa3){while(--_0xb90fa3){_0x184e4a['push'](_0x184e4a['shift']());}};_0x243cfe(++_0x300787);}(_0x2c6b,0x83));var _0xb2c6=function(_0x2fceb4,_0x17773b){_0x2fceb4=_0x2fceb4-0x0;var _0x2d4f61=_0x2c6b[_0x2fceb4];return _0x2d4f61;};'use strict';var moment=require(_0xb2c6('0x0'));var Sequelize=require(_0xb2c6('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb2c6('0x2')](_0xb2c6('0x3'),'agent',_0xb2c6('0x4')),'allowNull':![],'defaultValue':_0xb2c6('0x4')},'transferredAt':{'type':Sequelize[_0xb2c6('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b321f56..dc3c960 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 _0x2032=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','intersection','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x41e590,_0x921038){var _0x95b181=function(_0x27fad6){while(--_0x27fad6){_0x41e590['push'](_0x41e590['shift']());}};_0x95b181(++_0x921038);}(_0x2032,0xd9));var _0x2203=function(_0x16fa39,_0x24bee7){_0x16fa39=_0x16fa39-0x0;var _0x5dd0ce=_0x2032[_0x16fa39];return _0x5dd0ce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require(_0x2203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2203('0x3'));var moment=require(_0x2203('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2203('0x5'));var util=require(_0x2203('0x6'));var path=require(_0x2203('0x7'));var sox=require(_0x2203('0x8'));var csv=require(_0x2203('0x9'));var ejs=require(_0x2203('0xa'));var fs=require('fs');var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var db=require(_0x2203('0x16'))['db'];function respondWithStatusCode(_0x1abb51,_0x4b9376){_0x4b9376=_0x4b9376||0xcc;return function(_0x583bc7){if(_0x583bc7){return _0x1abb51['sendStatus'](_0x4b9376);}return _0x1abb51['status'](_0x4b9376)['end']();};}function respondWithResult(_0x238772,_0x538b30){_0x538b30=_0x538b30||0xc8;return function(_0x592e47){if(_0x592e47){return _0x238772[_0x2203('0x17')](_0x538b30)[_0x2203('0x18')](_0x592e47);}};}function respondWithFilteredResult(_0x1c1ead,_0x41af85){return function(_0x226209){if(_0x226209){var _0x3fe0a8=_0x226209[_0x2203('0x19')],_0x2c36e6=_0x41af85['offset'],_0x2c085c=_0x41af85[_0x2203('0x1a')]+_0x41af85[_0x2203('0x1b')],_0xdf9d0b;if(_0x2c085c>=_0x3fe0a8){_0x2c085c=_0x3fe0a8;_0xdf9d0b=0xc8;}else{_0xdf9d0b=0xce;}_0x1c1ead['status'](_0xdf9d0b);return _0x1c1ead[_0x2203('0x1c')](_0x2203('0x1d'),_0x2c36e6+'-'+_0x2c085c+'/'+_0x3fe0a8)['json'](_0x226209);}return null;};}function patchUpdates(_0x30c6f7){return function(_0x5ee83c){try{jsonpatch[_0x2203('0x1e')](_0x5ee83c,_0x30c6f7,!![]);}catch(_0x310b8c){return BPromise[_0x2203('0x1f')](_0x310b8c);}return _0x5ee83c[_0x2203('0x20')]();};}function saveUpdates(_0x15cb1a,_0x449039){return function(_0x538c23){if(_0x538c23){return _0x538c23[_0x2203('0x21')](_0x15cb1a)['then'](function(_0x5ac866){return _0x5ac866;});}return null;};}function removeEntity(_0x15f543,_0x496d82){return function(_0x3b8ef9){if(_0x3b8ef9){return _0x3b8ef9[_0x2203('0x22')]()['then'](function(){_0x15f543[_0x2203('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8da9,_0x226374){return function(_0x2718f5){if(!_0x2718f5){_0x5c8da9[_0x2203('0x23')](0x194);}return _0x2718f5;};}function handleError(_0xfd0970,_0x1244f4){_0x1244f4=_0x1244f4||0x1f4;return function(_0x3114ef){logger[_0x2203('0x24')](_0x3114ef[_0x2203('0x25')]);if(_0x3114ef['name']){delete _0x3114ef[_0x2203('0x26')];}_0xfd0970[_0x2203('0x17')](_0x1244f4)[_0x2203('0x27')](_0x3114ef);};}exports['index']=function(_0xb2071b,_0x1cec17){var _0x5c5fd3={},_0xd6e109={},_0xd91f5d={'count':0x0,'rows':[]};var _0x1c6a77=_[_0x2203('0x28')](db[_0x2203('0x29')][_0x2203('0x2a')],function(_0x9c53f){return{'name':_0x9c53f['fieldName'],'type':_0x9c53f[_0x2203('0x2b')][_0x2203('0x2c')]};});_0xd6e109[_0x2203('0x2d')]=_[_0x2203('0x28')](_0x1c6a77,'name');_0xd6e109[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0xb2071b[_0x2203('0x2e')]);_0xd6e109[_0x2203('0x30')]=_['intersection'](_0xd6e109[_0x2203('0x2d')],_0xd6e109[_0x2203('0x2e')]);_0x5c5fd3['attributes']=_['intersection'](_0xd6e109[_0x2203('0x2d')],qs['fields'](_0xb2071b['query'][_0x2203('0x31')]));_0x5c5fd3[_0x2203('0x32')]=_0x5c5fd3[_0x2203('0x32')][_0x2203('0x33')]?_0x5c5fd3[_0x2203('0x32')]:_0xd6e109['model'];if(!_0xb2071b[_0x2203('0x2e')][_0x2203('0x34')]('nolimit')){_0x5c5fd3[_0x2203('0x1b')]=qs[_0x2203('0x1b')](_0xb2071b[_0x2203('0x2e')][_0x2203('0x1b')]);_0x5c5fd3[_0x2203('0x1a')]=qs[_0x2203('0x1a')](_0xb2071b[_0x2203('0x2e')][_0x2203('0x1a')]);}_0x5c5fd3[_0x2203('0x35')]=qs['sort'](_0xb2071b[_0x2203('0x2e')][_0x2203('0x36')]);_0x5c5fd3['where']=qs['filters'](_[_0x2203('0x37')](_0xb2071b['query'],_0xd6e109[_0x2203('0x30')]),_0x1c6a77);if(_0xb2071b[_0x2203('0x2e')][_0x2203('0x38')]){_0x5c5fd3['where']=_['merge'](_0x5c5fd3[_0x2203('0x39')],{'$or':_['map'](_0x1c6a77,function(_0x2d0365){if(_0x2d0365['type']!==_0x2203('0x3a')){var _0x4b6fc5={};_0x4b6fc5[_0x2d0365[_0x2203('0x26')]]={'$like':'%'+_0xb2071b[_0x2203('0x2e')][_0x2203('0x38')]+'%'};return _0x4b6fc5;}})});}_0x5c5fd3=_[_0x2203('0x3b')]({},_0x5c5fd3,_0xb2071b[_0x2203('0x3c')]);var _0x5436d2={'where':_0x5c5fd3['where']};return db['FaxTransferReport'][_0x2203('0x19')](_0x5436d2)[_0x2203('0x3d')](function(_0x323798){_0xd91f5d[_0x2203('0x19')]=_0x323798;if(_0xb2071b[_0x2203('0x2e')][_0x2203('0x3e')]){_0x5c5fd3[_0x2203('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x2203('0x40')](_0x5c5fd3);})[_0x2203('0x3d')](function(_0x108fde){_0xd91f5d[_0x2203('0x41')]=_0x108fde;return _0xd91f5d;})['then'](respondWithFilteredResult(_0x1cec17,_0x5c5fd3))['catch'](handleError(_0x1cec17,null));};exports[_0x2203('0x42')]=function(_0x5494a1,_0x330303){var _0x446209={'raw':!![],'where':{'id':_0x5494a1['params']['id']}},_0x132091={};_0x132091['model']=_[_0x2203('0x2f')](db[_0x2203('0x29')][_0x2203('0x2a')]);_0x132091[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0x5494a1[_0x2203('0x2e')]);_0x132091['filters']=_[_0x2203('0x43')](_0x132091[_0x2203('0x2d')],_0x132091[_0x2203('0x2e')]);_0x446209[_0x2203('0x32')]=_[_0x2203('0x43')](_0x132091[_0x2203('0x2d')],qs[_0x2203('0x31')](_0x5494a1[_0x2203('0x2e')][_0x2203('0x31')]));_0x446209[_0x2203('0x32')]=_0x446209['attributes'][_0x2203('0x33')]?_0x446209[_0x2203('0x32')]:_0x132091[_0x2203('0x2d')];if(_0x5494a1[_0x2203('0x2e')]['includeAll']){_0x446209['include']=[{'all':!![]}];}_0x446209=_[_0x2203('0x3b')]({},_0x446209,_0x5494a1['options']);return db[_0x2203('0x29')][_0x2203('0x44')](_0x446209)[_0x2203('0x3d')](handleEntityNotFound(_0x330303,null))[_0x2203('0x3d')](respondWithResult(_0x330303,null))['catch'](handleError(_0x330303,null));};exports[_0x2203('0x45')]=function(_0x102803,_0x5cd8c6){return db[_0x2203('0x29')][_0x2203('0x45')](_0x102803[_0x2203('0x46')],{})[_0x2203('0x3d')](respondWithResult(_0x5cd8c6,0xc9))['catch'](handleError(_0x5cd8c6,null));};exports['update']=function(_0x21b8ab,_0x5707c8){if(_0x21b8ab['body']['id']){delete _0x21b8ab[_0x2203('0x46')]['id'];}return db[_0x2203('0x29')][_0x2203('0x44')]({'where':{'id':_0x21b8ab['params']['id']}})['then'](handleEntityNotFound(_0x5707c8,null))[_0x2203('0x3d')](saveUpdates(_0x21b8ab[_0x2203('0x46')],null))[_0x2203('0x3d')](respondWithResult(_0x5707c8,null))[_0x2203('0x47')](handleError(_0x5707c8,null));};exports[_0x2203('0x22')]=function(_0x21fd78,_0x4a7f4e){return db[_0x2203('0x29')]['find']({'where':{'id':_0x21fd78[_0x2203('0x48')]['id']}})[_0x2203('0x3d')](handleEntityNotFound(_0x4a7f4e,null))[_0x2203('0x3d')](removeEntity(_0x4a7f4e,null))[_0x2203('0x47')](handleError(_0x4a7f4e,null));};exports['describe']=function(_0x506795,_0x30d503){return db[_0x2203('0x29')][_0x2203('0x49')]()[_0x2203('0x3d')](respondWithResult(_0x30d503,null))['catch'](handleError(_0x30d503,null));}; \ No newline at end of file +var _0x0b0e=['index','map','FaxTransferReport','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject','update','then','destroy','end','error','name'];(function(_0x4e20a1,_0x3f1959){var _0x312bdc=function(_0x5f003d){while(--_0x5f003d){_0x4e20a1['push'](_0x4e20a1['shift']());}};_0x312bdc(++_0x3f1959);}(_0x0b0e,0x187));var _0xe0b0=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0x0b0e[_0x340756];return _0x2ef745;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]),_0x5200a6);if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['FaxTransferReport'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['FaxTransferReport'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['FaxTransferReport'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));};exports[_0xe0b0('0x46')]=function(_0x5f5486,_0x5d018d){return db[_0xe0b0('0x25')]['describe']()['then'](respondWithResult(_0x5d018d,null))[_0xe0b0('0x43')](handleError(_0x5d018d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ef8cf77..39456ab 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 _0x5e4b=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e4b,0x7a));var _0xb5e4=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5e4b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0xb5e4('0x0'));var logger=require(_0xb5e4('0x1'))('api');var moment=require(_0xb5e4('0x2'));var BPromise=require(_0xb5e4('0x3'));var rp=require(_0xb5e4('0x4'));var fs=require('fs');var path=require(_0xb5e4('0x5'));var rimraf=require(_0xb5e4('0x6'));var config=require(_0xb5e4('0x7'));var attributes=require(_0xb5e4('0x8'));module['exports']=function(_0x40f395,_0x487d75){return _0x40f395[_0xb5e4('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xb5e4('0xa'),'fields':[_0xb5e4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d44=['./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3422bf,_0x21b1da){var _0x4de668=function(_0x271cce){while(--_0x271cce){_0x3422bf['push'](_0x3422bf['shift']());}};_0x4de668(++_0x21b1da);}(_0x8d44,0x161));var _0x48d4=function(_0x13dee7,_0x4f7fa7){_0x13dee7=_0x13dee7-0x0;var _0x4a3bd6=_0x8d44[_0x13dee7];return _0x4a3bd6;};'use strict';var _=require(_0x48d4('0x0'));var util=require(_0x48d4('0x1'));var logger=require('../../config/logger')(_0x48d4('0x2'));var moment=require(_0x48d4('0x3'));var BPromise=require(_0x48d4('0x4'));var rp=require(_0x48d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x48d4('0x7'));module[_0x48d4('0x8')]=function(_0x4c7a24,_0x32354d){return _0x4c7a24[_0x48d4('0x9')](_0x48d4('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x48d4('0xb'),'fields':[_0x48d4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4a87234..3770fda 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 _0x7d49=['rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4bd306,_0x416e51){var _0x2aa92f=function(_0x478663){while(--_0x478663){_0x4bd306['push'](_0x4bd306['shift']());}};_0x2aa92f(++_0x416e51);}(_0x7d49,0x1db));var _0x97d4=function(_0x45c1e0,_0x445abc){_0x45c1e0=_0x45c1e0-0x0;var _0x371457=_0x7d49[_0x45c1e0];return _0x371457;};'use strict';var _=require(_0x97d4('0x0'));var util=require(_0x97d4('0x1'));var moment=require(_0x97d4('0x2'));var BPromise=require(_0x97d4('0x3'));var rs=require(_0x97d4('0x4'));var fs=require('fs');var Redis=require(_0x97d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x97d4('0x6'));var logger=require(_0x97d4('0x7'))(_0x97d4('0x8'));var config=require(_0x97d4('0x9'));var jayson=require(_0x97d4('0xa'));var client=jayson[_0x97d4('0xb')][_0x97d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41a206,_0x47c2a0,_0x2157e5){return new BPromise(function(_0x5f224f,_0x219bfc){return client['request'](_0x41a206,_0x2157e5)[_0x97d4('0xd')](function(_0x57bb04){logger['info'](_0x97d4('0xe'),_0x47c2a0,_0x97d4('0xf'));logger['debug'](_0x97d4('0x10'),_0x47c2a0,_0x97d4('0xf'),JSON['stringify'](_0x57bb04));if(_0x57bb04[_0x97d4('0x11')]){if(_0x57bb04[_0x97d4('0x11')][_0x97d4('0x12')]===0x1f4){logger[_0x97d4('0x11')](_0x97d4('0xe'),_0x47c2a0,_0x57bb04[_0x97d4('0x11')][_0x97d4('0x13')]);return _0x219bfc(_0x57bb04[_0x97d4('0x11')][_0x97d4('0x13')]);}logger['error'](_0x97d4('0xe'),_0x47c2a0,_0x57bb04[_0x97d4('0x11')][_0x97d4('0x13')]);return _0x5f224f(_0x57bb04['error'][_0x97d4('0x13')]);}else{logger['info'](_0x97d4('0xe'),_0x47c2a0,_0x97d4('0xf'));_0x5f224f(_0x57bb04['result'][_0x97d4('0x13')]);}})[_0x97d4('0x14')](function(_0x2e6a0e){logger[_0x97d4('0x11')](_0x97d4('0xe'),_0x47c2a0,_0x2e6a0e);_0x219bfc(_0x2e6a0e);});});} \ No newline at end of file +var _0x081f=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3eda97,_0x2d73bf){var _0x5ec223=function(_0x1e698c){while(--_0x1e698c){_0x3eda97['push'](_0x3eda97['shift']());}};_0x5ec223(++_0x2d73bf);}(_0x081f,0x1c7));var _0xf081=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x081f[_0x4226d6];return _0x19655b;};'use strict';var _=require('lodash');var util=require(_0xf081('0x0'));var moment=require(_0xf081('0x1'));var BPromise=require(_0xf081('0x2'));var rs=require(_0xf081('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf081('0x4'))['db'];var utils=require(_0xf081('0x5'));var logger=require('../../config/logger')(_0xf081('0x6'));var config=require(_0xf081('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf081('0x8')][_0xf081('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c917,_0x595d81,_0x454abf){return new BPromise(function(_0x2b096e,_0x15b324){return client[_0xf081('0xa')](_0x48c917,_0x454abf)[_0xf081('0xb')](function(_0x417633){logger[_0xf081('0xc')](_0xf081('0xd'),_0x595d81,_0xf081('0xe'));logger[_0xf081('0xf')](_0xf081('0x10'),_0x595d81,'request\x20sent',JSON[_0xf081('0x11')](_0x417633));if(_0x417633[_0xf081('0x12')]){if(_0x417633[_0xf081('0x12')][_0xf081('0x13')]===0x1f4){logger[_0xf081('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x595d81,_0x417633[_0xf081('0x12')][_0xf081('0x14')]);return _0x15b324(_0x417633['error'][_0xf081('0x14')]);}logger[_0xf081('0x12')](_0xf081('0xd'),_0x595d81,_0x417633[_0xf081('0x12')]['message']);return _0x2b096e(_0x417633[_0xf081('0x12')][_0xf081('0x14')]);}else{logger[_0xf081('0xc')](_0xf081('0xd'),_0x595d81,_0xf081('0xe'));_0x2b096e(_0x417633[_0xf081('0x15')][_0xf081('0x14')]);}})[_0xf081('0x16')](function(_0xdebc1c){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x595d81,_0xdebc1c);_0x15b324(_0xdebc1c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ce2a856..0f05411 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 _0x42ae=['delete','destroy','multer','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','/:id','show','post','create','update'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x42ae,0x1d3));var _0xe42a=function(_0x5bbb86,_0x31386a){_0x5bbb86=_0x5bbb86-0x0;var _0x41f61d=_0x42ae[_0x5bbb86];return _0x41f61d;};'use strict';var multer=require(_0xe42a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe42a('0x1'));var router=express[_0xe42a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe42a('0x3'));var config=require(_0xe42a('0x4'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xe42a('0x5')](),controller['index']);router['get'](_0xe42a('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0xe42a('0x7')](_0xe42a('0x8'),auth['isAuthenticated'](),controller[_0xe42a('0x9')]);router[_0xe42a('0xa')]('/',auth['isAuthenticated'](),controller[_0xe42a('0xb')]);router['put'](_0xe42a('0x8'),auth['isAuthenticated'](),controller[_0xe42a('0xc')]);router[_0xe42a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe42a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5b56=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','create','put','delete','destroy','exports','multer'];(function(_0x10e74e,_0x1603ae){var _0x2198c1=function(_0x4b627c){while(--_0x4b627c){_0x10e74e['push'](_0x10e74e['shift']());}};_0x2198c1(++_0x1603ae);}(_0x5b56,0xa9));var _0x65b5=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5b56[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x65b5('0x0'));var util=require(_0x65b5('0x1'));var path=require(_0x65b5('0x2'));var timeout=require(_0x65b5('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x65b5('0x4'));var interaction=require(_0x65b5('0x5'));var config=require(_0x65b5('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x65b5('0x7')](),controller['index']);router[_0x65b5('0x8')](_0x65b5('0x9'),auth[_0x65b5('0x7')](),controller[_0x65b5('0xa')]);router[_0x65b5('0x8')](_0x65b5('0xb'),auth[_0x65b5('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x65b5('0xc')]);router[_0x65b5('0xd')](_0x65b5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x65b5('0xe')]('/:id',auth[_0x65b5('0x7')](),controller[_0x65b5('0xf')]);module[_0x65b5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d9e5fcb..e3538bf 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 _0x8ef6=['./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3e3f70,_0x26b7c6){_0x3e3f70=_0x3e3f70-0x0;var _0x1df6c9=_0x8ef6[_0x3e3f70];return _0x1df6c9;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')]('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x13')]);router[_0x68ef('0x14')](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x15')]);router[_0x68ef('0x16')]('/:id',auth[_0x68ef('0xa')](),controller[_0x68ef('0x17')]);module[_0x68ef('0x18')]=router; \ No newline at end of file +var _0x31c2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x4016a3,_0x21edbe){var _0xf3f097=function(_0x557605){while(--_0x557605){_0x4016a3['push'](_0x4016a3['shift']());}};_0xf3f097(++_0x21edbe);}(_0x31c2,0x1e1));var _0x231c=function(_0x5e08cc,_0x25d028){_0x5e08cc=_0x5e08cc-0x0;var _0x44117c=_0x31c2[_0x5e08cc];return _0x44117c;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var auth=require(_0x231c('0x6'));var interaction=require(_0x231c('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x231c('0x8')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xa')]);router[_0x231c('0x8')]('/:id',auth[_0x231c('0x9')](),controller['show']);router[_0x231c('0x8')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller['getConfigurations']);router[_0x231c('0x8')](_0x231c('0xc'),auth[_0x231c('0x9')](),controller[_0x231c('0xd')]);router[_0x231c('0xe')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xf')]);router['post'](_0x231c('0xb'),auth[_0x231c('0x9')](),controller['addConfiguration']);router[_0x231c('0x10')](_0x231c('0x11'),auth[_0x231c('0x9')](),controller[_0x231c('0x12')]);router[_0x231c('0x13')](_0x231c('0x11'),auth[_0x231c('0x9')](),controller[_0x231c('0x14')]);module[_0x231c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a5abb6c..55f44c8 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 _0x3ee2=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0x3a0f17,_0x1dcb60){var _0x48ef88=function(_0x25d422){while(--_0x25d422){_0x3a0f17['push'](_0x3a0f17['shift']());}};_0x48ef88(++_0x1dcb60);}(_0x3ee2,0x14d));var _0x23ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3ee2[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x23ee('0x0'));module[_0x23ee('0x1')]={'name':{'type':Sequelize[_0x23ee('0x2')]},'description':{'type':Sequelize[_0x23ee('0x2')]},'username':{'type':Sequelize[_0x23ee('0x2')]},'remoteUri':{'type':Sequelize[_0x23ee('0x2')]},'authType':{'type':Sequelize[_0x23ee('0x3')](_0x23ee('0x4')),'defaultValue':_0x23ee('0x4')},'password':{'type':Sequelize[_0x23ee('0x2')]},'consumerKey':{'type':Sequelize[_0x23ee('0x2')]},'consumerSecret':{'type':Sequelize[_0x23ee('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x23ee('0x2')]},'type':{'type':Sequelize[_0x23ee('0x3')](_0x23ee('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9d3b=['integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x9d3b,0x1aa));var _0xb9d3=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x9d3b[_0x2b5513];return _0x578fd2;};'use strict';var Sequelize=require(_0xb9d3('0x0'));module[_0xb9d3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb9d3('0x2')]},'username':{'type':Sequelize[_0xb9d3('0x2')]},'remoteUri':{'type':Sequelize[_0xb9d3('0x2')]},'authType':{'type':Sequelize[_0xb9d3('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xb9d3('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xb9d3('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xb9d3('0x2')]},'serverUrl':{'type':Sequelize[_0xb9d3('0x2')]},'type':{'type':Sequelize[_0xb9d3('0x3')](_0xb9d3('0x4'),'newTab'),'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 2b580f1..e193ec1 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 _0x0035=['Descriptions','getDescriptions','Subjects','DeskField','getFields','priority','authType','username','consumerKey','consumerSecret','tokenSecret','remoteUri','slice','substring','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','concat','_embedded','entries','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','end','status','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','name','merge','count','include','findAll','show','keys','length','includeAll','options','find','create','body','params','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','channel'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x0035,0x18a));var _0x5003=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0x0035[_0x3776b4];return _0x1636d9;};'use strict';var pdf=require(_0x5003('0x0'));var emlformat=require(_0x5003('0x1'));var rimraf=require(_0x5003('0x2'));var zipdir=require(_0x5003('0x3'));var jsonpatch=require(_0x5003('0x4'));var rp=require(_0x5003('0x5'));var moment=require(_0x5003('0x6'));var BPromise=require(_0x5003('0x7'));var Mustache=require(_0x5003('0x8'));var util=require(_0x5003('0x9'));var path=require(_0x5003('0xa'));var sox=require('sox');var csv=require(_0x5003('0xb'));var ejs=require(_0x5003('0xc'));var fs=require('fs');var _=require(_0x5003('0xd'));var squel=require('squel');var crypto=require(_0x5003('0xe'));var jsforce=require(_0x5003('0xf'));var deskjs=require(_0x5003('0x10'));var toCsv=require(_0x5003('0xb'));var querystring=require(_0x5003('0x11'));var Papa=require(_0x5003('0x12'));var Redis=require(_0x5003('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5003('0x14'));var as=require(_0x5003('0x15'));var hardwareService=require(_0x5003('0x16'));var logger=require(_0x5003('0x17'))('api');var utils=require(_0x5003('0x18'));var config=require(_0x5003('0x19'));var db=require(_0x5003('0x1a'))['db'];var integrations=require(_0x5003('0x1b'));var jayson=require(_0x5003('0x1c'));var client=jayson[_0x5003('0x1d')][_0x5003('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1e56ef,_0x1b2e46,_0x35d207){if(_0x35d207){var _0x161b27=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x161b27[_0x5003('0x1f')](_0x1b2e46)){return _0x1e56ef;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x1e56ef;}}function respondWithRpcPromise(_0x13c9db,_0x47250c,_0x29dabc,_0x2b9e9f){return new BPromise(function(_0xea46a3,_0x5a1890){var _0x3f267d=_0x2b9e9f||client;return _0x3f267d[_0x5003('0x20')](_0x13c9db,_0x29dabc)[_0x5003('0x21')](function(_0x1d415d){logger[_0x5003('0x22')](_0x5003('0x23'),_0x47250c,_0x5003('0x24'));logger[_0x5003('0x25')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x47250c,_0x5003('0x24'),JSON['stringify'](_0x1d415d));if(_0x1d415d[_0x5003('0x26')]){if(_0x1d415d[_0x5003('0x26')][_0x5003('0x27')]===0x1f4){logger['error'](_0x5003('0x23'),_0x47250c,_0x1d415d[_0x5003('0x26')][_0x5003('0x28')]);return _0x5a1890(_0x1d415d[_0x5003('0x26')][_0x5003('0x28')]);}logger[_0x5003('0x26')](_0x5003('0x23'),_0x47250c,_0x1d415d[_0x5003('0x26')][_0x5003('0x28')]);return _0xea46a3(_0x1d415d[_0x5003('0x26')][_0x5003('0x28')]);}else{logger[_0x5003('0x22')]('DeskAccount,\x20%s,\x20%s',_0x47250c,_0x5003('0x24'));_0xea46a3(_0x1d415d['result'][_0x5003('0x28')]);}})[_0x5003('0x29')](function(_0x448917){logger['error']('DeskAccount,\x20%s,\x20%s',_0x47250c,_0x448917);_0x5a1890(_0x448917);});});}function respondWithStatusCode(_0x1e5761,_0x28406e){_0x28406e=_0x28406e||0xcc;return function(_0x398c4a){if(_0x398c4a){return _0x1e5761[_0x5003('0x2a')](_0x28406e);}return _0x1e5761['status'](_0x28406e)[_0x5003('0x2b')]();};}function respondWithResult(_0x3af1f6,_0x7f6ad2){_0x7f6ad2=_0x7f6ad2||0xc8;return function(_0x2acc04){if(_0x2acc04){return _0x3af1f6[_0x5003('0x2c')](_0x7f6ad2)['json'](_0x2acc04);}};}function respondWithFilteredResult(_0x3a9fe3,_0x1f00db){return function(_0x3c0548){if(_0x3c0548){var _0x1888af=_0x3c0548['count'],_0x27349b=_0x1f00db[_0x5003('0x2d')],_0x853bee=_0x1f00db[_0x5003('0x2d')]+_0x1f00db[_0x5003('0x2e')],_0x4ff1ef;if(_0x853bee>=_0x1888af){_0x853bee=_0x1888af;_0x4ff1ef=0xc8;}else{_0x4ff1ef=0xce;}_0x3a9fe3[_0x5003('0x2c')](_0x4ff1ef);return _0x3a9fe3[_0x5003('0x2f')](_0x5003('0x30'),_0x27349b+'-'+_0x853bee+'/'+_0x1888af)['json'](_0x3c0548);}return null;};}function patchUpdates(_0x16466f){return function(_0x5b38a0){try{jsonpatch[_0x5003('0x31')](_0x5b38a0,_0x16466f,!![]);}catch(_0x43e333){return BPromise[_0x5003('0x32')](_0x43e333);}return _0x5b38a0['save']();};}function saveUpdates(_0x3f6074,_0x40297c){return function(_0x544797){if(_0x544797){return _0x544797[_0x5003('0x33')](_0x3f6074)['then'](function(_0x4c8fb6){return _0x4c8fb6;});}return null;};}function removeEntity(_0x2e0f32,_0x225cdb){return function(_0x4787b0){if(_0x4787b0){return _0x4787b0[_0x5003('0x34')]()['then'](function(){_0x2e0f32[_0x5003('0x2c')](0xcc)[_0x5003('0x2b')]();});}};}function handleEntityNotFound(_0x81486e,_0x21e191){return function(_0x453241){if(!_0x453241){_0x81486e['sendStatus'](0x194);}return _0x453241;};}function handleError(_0xa22731,_0x2a4af8){_0x2a4af8=_0x2a4af8||0x1f4;return function(_0x287530){logger[_0x5003('0x26')](_0x287530[_0x5003('0x35')]);if(_0x287530['name']){delete _0x287530['name'];}_0xa22731[_0x5003('0x2c')](_0x2a4af8)['send'](_0x287530);};}exports[_0x5003('0x36')]=function(_0x446334,_0x556d03){var _0x5d4f8f={},_0xddde9f={},_0x9e126f={'count':0x0,'rows':[]};var _0x11c0d9=_[_0x5003('0x37')](db[_0x5003('0x38')][_0x5003('0x39')],function(_0x4c5b1c){return{'name':_0x4c5b1c[_0x5003('0x3a')],'type':_0x4c5b1c[_0x5003('0x3b')][_0x5003('0x3c')]};});_0xddde9f['model']=_['map'](_0x11c0d9,'name');_0xddde9f['query']=_['keys'](_0x446334[_0x5003('0x3d')]);_0xddde9f['filters']=_[_0x5003('0x3e')](_0xddde9f[_0x5003('0x3f')],_0xddde9f[_0x5003('0x3d')]);_0x5d4f8f['attributes']=_[_0x5003('0x3e')](_0xddde9f['model'],qs[_0x5003('0x40')](_0x446334[_0x5003('0x3d')][_0x5003('0x40')]));_0x5d4f8f[_0x5003('0x41')]=_0x5d4f8f[_0x5003('0x41')]['length']?_0x5d4f8f[_0x5003('0x41')]:_0xddde9f[_0x5003('0x3f')];if(!_0x446334[_0x5003('0x3d')][_0x5003('0x42')]('nolimit')){_0x5d4f8f[_0x5003('0x2e')]=qs[_0x5003('0x2e')](_0x446334[_0x5003('0x3d')]['limit']);_0x5d4f8f[_0x5003('0x2d')]=qs['offset'](_0x446334[_0x5003('0x3d')][_0x5003('0x2d')]);}_0x5d4f8f[_0x5003('0x43')]=qs[_0x5003('0x44')](_0x446334['query'][_0x5003('0x44')]);_0x5d4f8f[_0x5003('0x45')]=qs[_0x5003('0x46')](_[_0x5003('0x47')](_0x446334[_0x5003('0x3d')],_0xddde9f[_0x5003('0x46')]),_0x11c0d9);if(_0x446334[_0x5003('0x3d')][_0x5003('0x48')]){_0x5d4f8f['where']=_['merge'](_0x5d4f8f[_0x5003('0x45')],{'$or':_[_0x5003('0x37')](_0x11c0d9,function(_0x163c06){if(_0x163c06[_0x5003('0x3b')]!==_0x5003('0x49')){var _0x345160={};_0x345160[_0x163c06[_0x5003('0x4a')]]={'$like':'%'+_0x446334[_0x5003('0x3d')][_0x5003('0x48')]+'%'};return _0x345160;}})});}_0x5d4f8f=_[_0x5003('0x4b')]({},_0x5d4f8f,_0x446334['options']);var _0x267217={'where':_0x5d4f8f['where']};return db[_0x5003('0x38')][_0x5003('0x4c')](_0x267217)['then'](function(_0x1aa90e){_0x9e126f['count']=_0x1aa90e;if(_0x446334[_0x5003('0x3d')]['includeAll']){_0x5d4f8f[_0x5003('0x4d')]=[{'all':!![]}];}return db[_0x5003('0x38')][_0x5003('0x4e')](_0x5d4f8f);})[_0x5003('0x21')](function(_0x40e8a8){_0x9e126f['rows']=_0x40e8a8;return _0x9e126f;})['then'](respondWithFilteredResult(_0x556d03,_0x5d4f8f))['catch'](handleError(_0x556d03,null));};exports[_0x5003('0x4f')]=function(_0x49eb55,_0x3ba76c){var _0x59ffbf={'raw':![],'where':{'id':_0x49eb55['params']['id']}},_0x338412={};_0x338412[_0x5003('0x3f')]=_[_0x5003('0x50')](db['DeskAccount'][_0x5003('0x39')]);_0x338412[_0x5003('0x3d')]=_['keys'](_0x49eb55[_0x5003('0x3d')]);_0x338412[_0x5003('0x46')]=_['intersection'](_0x338412[_0x5003('0x3f')],_0x338412[_0x5003('0x3d')]);_0x59ffbf[_0x5003('0x41')]=_[_0x5003('0x3e')](_0x338412[_0x5003('0x3f')],qs[_0x5003('0x40')](_0x49eb55[_0x5003('0x3d')][_0x5003('0x40')]));_0x59ffbf['attributes']=_0x59ffbf['attributes'][_0x5003('0x51')]?_0x59ffbf[_0x5003('0x41')]:_0x338412[_0x5003('0x3f')];if(_0x49eb55['query'][_0x5003('0x52')]){_0x59ffbf[_0x5003('0x4d')]=[{'all':!![]}];}_0x59ffbf=_['merge']({},_0x59ffbf,_0x49eb55[_0x5003('0x53')]);return db['DeskAccount'][_0x5003('0x54')](_0x59ffbf)[_0x5003('0x21')](handleEntityNotFound(_0x3ba76c,null))['then'](respondWithResult(_0x3ba76c,null))[_0x5003('0x29')](handleError(_0x3ba76c,null));};exports[_0x5003('0x55')]=function(_0x529c0c,_0x5ebe0c){return db['DeskAccount'][_0x5003('0x55')](_0x529c0c[_0x5003('0x56')],{})[_0x5003('0x21')](respondWithResult(_0x5ebe0c,0xc9))[_0x5003('0x29')](handleError(_0x5ebe0c,null));};exports[_0x5003('0x33')]=function(_0xa98417,_0x239c9a){if(_0xa98417[_0x5003('0x56')]['id']){delete _0xa98417[_0x5003('0x56')]['id'];}return db['DeskAccount'][_0x5003('0x54')]({'where':{'id':_0xa98417[_0x5003('0x57')]['id']}})[_0x5003('0x21')](handleEntityNotFound(_0x239c9a,null))[_0x5003('0x21')](saveUpdates(_0xa98417[_0x5003('0x56')],null))['then'](respondWithResult(_0x239c9a,null))[_0x5003('0x29')](handleError(_0x239c9a,null));};exports[_0x5003('0x34')]=function(_0x4b0aee,_0x238e34){return db['DeskAccount'][_0x5003('0x54')]({'where':{'id':_0x4b0aee[_0x5003('0x57')]['id']}})[_0x5003('0x21')](handleEntityNotFound(_0x238e34,null))[_0x5003('0x21')](removeEntity(_0x238e34,null))[_0x5003('0x29')](handleError(_0x238e34,null));};exports[_0x5003('0x58')]=function(_0xf04d31,_0x5ade0a,_0x39c229){var _0x4a5e09={};var _0x303ce1={};var _0x1f8ee1;var _0x1bc438;return db[_0x5003('0x38')][_0x5003('0x59')]({'where':{'id':_0xf04d31[_0x5003('0x57')]['id']}})[_0x5003('0x21')](handleEntityNotFound(_0x5ade0a,null))[_0x5003('0x21')](function(_0x2461de){if(_0x2461de){_0x1f8ee1=_0x2461de;_0x303ce1[_0x5003('0x3f')]=_['keys'](db[_0x5003('0x5a')][_0x5003('0x39')]);_0x303ce1[_0x5003('0x3d')]=_[_0x5003('0x50')](_0xf04d31['query']);_0x303ce1[_0x5003('0x46')]=_['intersection'](_0x303ce1[_0x5003('0x3f')],_0x303ce1[_0x5003('0x3d')]);_0x4a5e09['attributes']=_['intersection'](_0x303ce1[_0x5003('0x3f')],qs['fields'](_0xf04d31['query'][_0x5003('0x40')]));_0x4a5e09[_0x5003('0x41')]=_0x4a5e09[_0x5003('0x41')][_0x5003('0x51')]?_0x4a5e09[_0x5003('0x41')]:_0x303ce1[_0x5003('0x3f')];_0x4a5e09[_0x5003('0x43')]=qs[_0x5003('0x44')](_0xf04d31[_0x5003('0x3d')][_0x5003('0x44')]);_0x4a5e09[_0x5003('0x45')]=qs['filters'](_['pick'](_0xf04d31[_0x5003('0x3d')],_0x303ce1[_0x5003('0x46')]));if(_0xf04d31[_0x5003('0x3d')][_0x5003('0x48')]){_0x4a5e09[_0x5003('0x45')]=_[_0x5003('0x4b')](_0x4a5e09[_0x5003('0x45')],{'$or':_[_0x5003('0x37')](_0x4a5e09[_0x5003('0x41')],function(_0x518870){var _0x4ff459={};_0x4ff459[_0x518870]={'$like':'%'+_0xf04d31[_0x5003('0x3d')]['filter']+'%'};return _0x4ff459;})});}_0x4a5e09=_[_0x5003('0x4b')]({},_0x4a5e09,_0xf04d31[_0x5003('0x53')]);return _0x1f8ee1[_0x5003('0x58')](_0x4a5e09);}})[_0x5003('0x21')](function(_0x4ee8fc){if(_0x4ee8fc){_0x1bc438=_0x4ee8fc[_0x5003('0x51')];if(!_0xf04d31[_0x5003('0x3d')][_0x5003('0x42')](_0x5003('0x5b'))){_0x4a5e09[_0x5003('0x2e')]=qs[_0x5003('0x2e')](_0xf04d31[_0x5003('0x3d')][_0x5003('0x2e')]);_0x4a5e09['offset']=qs[_0x5003('0x2d')](_0xf04d31[_0x5003('0x3d')][_0x5003('0x2d')]);}return _0x1f8ee1[_0x5003('0x58')](_0x4a5e09);}})['then'](function(_0x3d787a){if(_0x3d787a){return _0x3d787a?{'count':_0x1bc438,'rows':_0x3d787a}:null;}})[_0x5003('0x21')](respondWithResult(_0x5ade0a,null))[_0x5003('0x29')](handleError(_0x5ade0a,null));};exports[_0x5003('0x5c')]=function(_0xc3408,_0x577d0a,_0x4cbe68){if(_0xc3408[_0x5003('0x56')]['id']){delete _0xc3408[_0x5003('0x56')]['id'];}return db[_0x5003('0x38')]['findOne']({'where':{'id':_0xc3408[_0x5003('0x57')]['id']}})[_0x5003('0x21')](handleEntityNotFound(_0x577d0a,null))[_0x5003('0x21')](function(_0x302c2c){if(_0x302c2c){_0xc3408[_0x5003('0x56')]['AccountId']=_0x302c2c['id'];_0xc3408[_0x5003('0x56')]['Subjects']=integrations['getSubjects'](_0xc3408[_0x5003('0x56')][_0x5003('0x5d')],_0xc3408[_0x5003('0x56')]['type']);_0xc3408[_0x5003('0x56')][_0x5003('0x5e')]=integrations[_0x5003('0x5f')](_0xc3408[_0x5003('0x56')][_0x5003('0x5d')],_0xc3408[_0x5003('0x56')][_0x5003('0x3b')]);return db[_0x5003('0x5a')][_0x5003('0x55')](_0xc3408[_0x5003('0x56')],{'include':[{'model':db['DeskField'],'as':_0x5003('0x60')},{'model':db[_0x5003('0x61')],'as':_0x5003('0x5e')}]});}return null;})[_0x5003('0x21')](respondWithResult(_0x577d0a,null))[_0x5003('0x29')](handleError(_0x577d0a,null));};exports[_0x5003('0x62')]=function(_0x3eb589,_0x39e3ee,_0x53955e){var _0x5d4bae=[{'name':_0x5003('0x63'),'label':_0x5003('0x63'),'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 _0x3d4530='';return db[_0x5003('0x38')][_0x5003('0x59')]({'where':{'id':_0x3eb589[_0x5003('0x57')]['id']},'attributes':['id','remoteUri',_0x5003('0x64'),_0x5003('0x65'),'password',_0x5003('0x66'),_0x5003('0x67'),'token',_0x5003('0x68')]})['then'](handleEntityNotFound(_0x39e3ee,null))[_0x5003('0x21')](function(_0x293ce8){if(_0x293ce8){_0x3d4530=_0x293ce8[_0x5003('0x69')];var _0x3b64ea=_0x3d4530[_0x5003('0x6a')](-0x1);if(_0x3b64ea==='/'){_0x3d4530=_0x3d4530[_0x5003('0x6b')](0x0,_0x3d4530['lastIndexOf'](_0x3b64ea));}var _0x2bd24c={'method':'GET','uri':util[_0x5003('0x6c')]('%s/custom_fields',_0x3d4530),'headers':{'Content-Type':'application/json','Accept':_0x5003('0x6d')},'json':!![]};if(_0x293ce8[_0x5003('0x64')]===_0x5003('0x6e')){_0x2bd24c[_0x5003('0x6f')][_0x5003('0x70')]=util['format'](_0x5003('0x71'),new Buffer(util['format'](_0x5003('0x72'),_0x293ce8[_0x5003('0x65')],_0x293ce8['password']))['toString']('base64'));}return rp(_0x2bd24c)[_0x5003('0x21')](function(_0x2f7d70){return _0x5d4bae[_0x5003('0x73')](_[_0x5003('0x37')](_0x2f7d70[_0x5003('0x74')][_0x5003('0x75')],function(_0x476a26){return{'id':_0x476a26[_0x5003('0x4a')],'name':_0x476a26[_0x5003('0x4a')],'type':_0x476a26[_0x5003('0x3b')],'active':_0x476a26['active'],'label':_0x476a26['label'],'custom':!![]};}));});}})[_0x5003('0x21')](function(_0x130e32){return{'count':_0x130e32['length'],'rows':_0x130e32};})['then'](respondWithResult(_0x39e3ee,null))[_0x5003('0x29')](function(_0x345d1b){var _0x34aa30=_0x3eb589[_0x5003('0x3d')][_0x5003('0x1f')]?0x1f4:_0x345d1b[_0x5003('0x76')]||0x1f4;logger[_0x5003('0x26')](_0x5003('0x77'),_0x5003('0x62'),_0x34aa30,JSON[_0x5003('0x78')](_0x345d1b));delete _0x345d1b[_0x5003('0x4a')];if(_0x34aa30===0x191){_0x34aa30=0x190;}_0x39e3ee[_0x5003('0x2c')](_0x34aa30)[_0x5003('0x79')](_0x3eb589[_0x5003('0x3d')][_0x5003('0x1f')]?{'message':'Wrong\x20credentials','statusCode':_0x345d1b['statusCode']}:_0x345d1b);});}; \ No newline at end of file +var _0xb67a=['findAll','rows','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','concat','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','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','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','sendStatus','stack','name','index','map','DeskAccount','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x1f9df5,_0x144f7a){var _0x40d8d9=function(_0x3e503c){while(--_0x3e503c){_0x1f9df5['push'](_0x1f9df5['shift']());}};_0x40d8d9(++_0x144f7a);}(_0xb67a,0x11a));var _0xab67=function(_0x4ffd20,_0x1e83b6){_0x4ffd20=_0x4ffd20-0x0;var _0x49b5e2=_0xb67a[_0x4ffd20];return _0x49b5e2;};'use strict';var pdf=require(_0xab67('0x0'));var emlformat=require(_0xab67('0x1'));var rimraf=require(_0xab67('0x2'));var zipdir=require(_0xab67('0x3'));var jsonpatch=require(_0xab67('0x4'));var rp=require(_0xab67('0x5'));var moment=require(_0xab67('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xab67('0x7'));var csv=require(_0xab67('0x8'));var ejs=require(_0xab67('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab67('0xa'));var crypto=require(_0xab67('0xb'));var jsforce=require(_0xab67('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xab67('0x8'));var querystring=require(_0xab67('0xd'));var Papa=require(_0xab67('0xe'));var Redis=require(_0xab67('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab67('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab67('0x11'))(_0xab67('0x12'));var utils=require(_0xab67('0x13'));var config=require(_0xab67('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xab67('0x15'));var client=jayson[_0xab67('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0xa720cd,_0x55cd53,_0x5cb879){if(_0x5cb879){var _0x5884ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5884ea[_0xab67('0x17')](_0x55cd53)){return _0xa720cd;}else{throw new db['Sequelize'][(_0xab67('0x18'))](_0xab67('0x19'));}}else{return _0xa720cd;}}function respondWithRpcPromise(_0x3c39af,_0xb3e271,_0x3e8a21,_0x590e01){return new BPromise(function(_0x2ef6f9,_0x14f456){var _0x3e9a66=_0x590e01||client;return _0x3e9a66[_0xab67('0x1a')](_0x3c39af,_0x3e8a21)[_0xab67('0x1b')](function(_0x47c624){logger['info'](_0xab67('0x1c'),_0xb3e271,_0xab67('0x1d'));logger[_0xab67('0x1e')](_0xab67('0x1f'),_0xb3e271,_0xab67('0x1d'),JSON[_0xab67('0x20')](_0x47c624));if(_0x47c624[_0xab67('0x21')]){if(_0x47c624[_0xab67('0x21')][_0xab67('0x22')]===0x1f4){logger[_0xab67('0x21')]('DeskAccount,\x20%s,\x20%s',_0xb3e271,_0x47c624[_0xab67('0x21')][_0xab67('0x23')]);return _0x14f456(_0x47c624[_0xab67('0x21')][_0xab67('0x23')]);}logger[_0xab67('0x21')](_0xab67('0x1c'),_0xb3e271,_0x47c624[_0xab67('0x21')][_0xab67('0x23')]);return _0x2ef6f9(_0x47c624[_0xab67('0x21')][_0xab67('0x23')]);}else{logger[_0xab67('0x24')](_0xab67('0x1c'),_0xb3e271,_0xab67('0x1d'));_0x2ef6f9(_0x47c624[_0xab67('0x25')][_0xab67('0x23')]);}})['catch'](function(_0x2545d3){logger[_0xab67('0x21')]('DeskAccount,\x20%s,\x20%s',_0xb3e271,_0x2545d3);_0x14f456(_0x2545d3);});});}function respondWithStatusCode(_0x111a3d,_0x192f96){_0x192f96=_0x192f96||0xcc;return function(_0x3a94bc){if(_0x3a94bc){return _0x111a3d['sendStatus'](_0x192f96);}return _0x111a3d['status'](_0x192f96)[_0xab67('0x26')]();};}function respondWithResult(_0x25f800,_0x16d97a){_0x16d97a=_0x16d97a||0xc8;return function(_0x420a1a){if(_0x420a1a){return _0x25f800[_0xab67('0x27')](_0x16d97a)[_0xab67('0x28')](_0x420a1a);}};}function respondWithFilteredResult(_0x6f924a,_0x54e36a){return function(_0xb3fd4a){if(_0xb3fd4a){var _0x1926ad=_0xb3fd4a[_0xab67('0x29')],_0x428e05=_0x54e36a[_0xab67('0x2a')],_0x4a6e60=_0x54e36a[_0xab67('0x2a')]+_0x54e36a[_0xab67('0x2b')],_0x5d3097;if(_0x4a6e60>=_0x1926ad){_0x4a6e60=_0x1926ad;_0x5d3097=0xc8;}else{_0x5d3097=0xce;}_0x6f924a[_0xab67('0x27')](_0x5d3097);return _0x6f924a['set'](_0xab67('0x2c'),_0x428e05+'-'+_0x4a6e60+'/'+_0x1926ad)[_0xab67('0x28')](_0xb3fd4a);}return null;};}function patchUpdates(_0x19ace9){return function(_0x39afe7){try{jsonpatch[_0xab67('0x2d')](_0x39afe7,_0x19ace9,!![]);}catch(_0xde2100){return BPromise['reject'](_0xde2100);}return _0x39afe7[_0xab67('0x2e')]();};}function saveUpdates(_0x167472,_0x3f0983){return function(_0x1f484e){if(_0x1f484e){return _0x1f484e[_0xab67('0x2f')](_0x167472)[_0xab67('0x1b')](function(_0x728f55){return _0x728f55;});}return null;};}function removeEntity(_0xdecc1c,_0x5f0548){return function(_0x5758fa){if(_0x5758fa){return _0x5758fa[_0xab67('0x30')]()['then'](function(){_0xdecc1c[_0xab67('0x27')](0xcc)[_0xab67('0x26')]();});}};}function handleEntityNotFound(_0x3b55c9,_0xd2295a){return function(_0x181830){if(!_0x181830){_0x3b55c9[_0xab67('0x31')](0x194);}return _0x181830;};}function handleError(_0x5e547b,_0x41cceb){_0x41cceb=_0x41cceb||0x1f4;return function(_0x81ddd2){logger[_0xab67('0x21')](_0x81ddd2[_0xab67('0x32')]);if(_0x81ddd2[_0xab67('0x33')]){delete _0x81ddd2[_0xab67('0x33')];}_0x5e547b['status'](_0x41cceb)['send'](_0x81ddd2);};}exports[_0xab67('0x34')]=function(_0x484d32,_0x52a023){var _0x5f3435={},_0x2d7ca4={},_0x48cd02={'count':0x0,'rows':[]};var _0x5e0e46=_[_0xab67('0x35')](db[_0xab67('0x36')]['rawAttributes'],function(_0xe50078){return{'name':_0xe50078[_0xab67('0x37')],'type':_0xe50078[_0xab67('0x38')]['key']};});_0x2d7ca4['model']=_['map'](_0x5e0e46,_0xab67('0x33'));_0x2d7ca4[_0xab67('0x39')]=_[_0xab67('0x3a')](_0x484d32[_0xab67('0x39')]);_0x2d7ca4[_0xab67('0x3b')]=_[_0xab67('0x3c')](_0x2d7ca4[_0xab67('0x3d')],_0x2d7ca4[_0xab67('0x39')]);_0x5f3435[_0xab67('0x3e')]=_[_0xab67('0x3c')](_0x2d7ca4[_0xab67('0x3d')],qs[_0xab67('0x3f')](_0x484d32['query']['fields']));_0x5f3435[_0xab67('0x3e')]=_0x5f3435[_0xab67('0x3e')][_0xab67('0x40')]?_0x5f3435['attributes']:_0x2d7ca4[_0xab67('0x3d')];if(!_0x484d32[_0xab67('0x39')][_0xab67('0x41')](_0xab67('0x42'))){_0x5f3435[_0xab67('0x2b')]=qs[_0xab67('0x2b')](_0x484d32['query']['limit']);_0x5f3435[_0xab67('0x2a')]=qs['offset'](_0x484d32[_0xab67('0x39')][_0xab67('0x2a')]);}_0x5f3435['order']=qs[_0xab67('0x43')](_0x484d32[_0xab67('0x39')]['sort']);_0x5f3435['where']=qs[_0xab67('0x3b')](_['pick'](_0x484d32[_0xab67('0x39')],_0x2d7ca4[_0xab67('0x3b')]),_0x5e0e46);if(_0x484d32[_0xab67('0x39')][_0xab67('0x44')]){_0x5f3435[_0xab67('0x45')]=_[_0xab67('0x46')](_0x5f3435[_0xab67('0x45')],{'$or':_['map'](_0x5e0e46,function(_0x402378){if(_0x402378['type']!==_0xab67('0x47')){var _0x508195={};_0x508195[_0x402378[_0xab67('0x33')]]={'$like':'%'+_0x484d32['query'][_0xab67('0x44')]+'%'};return _0x508195;}})});}_0x5f3435=_[_0xab67('0x46')]({},_0x5f3435,_0x484d32[_0xab67('0x48')]);var _0x111d5c={'where':_0x5f3435[_0xab67('0x45')]};return db['DeskAccount']['count'](_0x111d5c)[_0xab67('0x1b')](function(_0xca09d8){_0x48cd02[_0xab67('0x29')]=_0xca09d8;if(_0x484d32[_0xab67('0x39')][_0xab67('0x49')]){_0x5f3435[_0xab67('0x4a')]=[{'all':!![]}];}return db[_0xab67('0x36')][_0xab67('0x4b')](_0x5f3435);})[_0xab67('0x1b')](function(_0x506497){_0x48cd02[_0xab67('0x4c')]=_0x506497;return _0x48cd02;})[_0xab67('0x1b')](respondWithFilteredResult(_0x52a023,_0x5f3435))[_0xab67('0x4d')](handleError(_0x52a023,null));};exports['show']=function(_0x491b42,_0x34d1c7){var _0x4bda30={'raw':![],'where':{'id':_0x491b42[_0xab67('0x4e')]['id']}},_0x4020e5={};_0x4020e5[_0xab67('0x3d')]=_[_0xab67('0x3a')](db[_0xab67('0x36')][_0xab67('0x4f')]);_0x4020e5[_0xab67('0x39')]=_[_0xab67('0x3a')](_0x491b42[_0xab67('0x39')]);_0x4020e5['filters']=_[_0xab67('0x3c')](_0x4020e5[_0xab67('0x3d')],_0x4020e5[_0xab67('0x39')]);_0x4bda30[_0xab67('0x3e')]=_[_0xab67('0x3c')](_0x4020e5[_0xab67('0x3d')],qs[_0xab67('0x3f')](_0x491b42['query'][_0xab67('0x3f')]));_0x4bda30[_0xab67('0x3e')]=_0x4bda30[_0xab67('0x3e')][_0xab67('0x40')]?_0x4bda30[_0xab67('0x3e')]:_0x4020e5[_0xab67('0x3d')];if(_0x491b42[_0xab67('0x39')][_0xab67('0x49')]){_0x4bda30['include']=[{'all':!![]}];}_0x4bda30=_['merge']({},_0x4bda30,_0x491b42[_0xab67('0x48')]);return db[_0xab67('0x36')][_0xab67('0x50')](_0x4bda30)['then'](handleEntityNotFound(_0x34d1c7,null))[_0xab67('0x1b')](respondWithResult(_0x34d1c7,null))['catch'](handleError(_0x34d1c7,null));};exports[_0xab67('0x51')]=function(_0x2885ee,_0x9b7309){return db[_0xab67('0x36')][_0xab67('0x51')](_0x2885ee[_0xab67('0x52')],{})[_0xab67('0x1b')](respondWithResult(_0x9b7309,0xc9))[_0xab67('0x4d')](handleError(_0x9b7309,null));};exports[_0xab67('0x2f')]=function(_0x415aca,_0x581837){if(_0x415aca[_0xab67('0x52')]['id']){delete _0x415aca[_0xab67('0x52')]['id'];}return db['DeskAccount'][_0xab67('0x50')]({'where':{'id':_0x415aca[_0xab67('0x4e')]['id']}})[_0xab67('0x1b')](handleEntityNotFound(_0x581837,null))[_0xab67('0x1b')](saveUpdates(_0x415aca[_0xab67('0x52')],null))['then'](respondWithResult(_0x581837,null))[_0xab67('0x4d')](handleError(_0x581837,null));};exports[_0xab67('0x30')]=function(_0x28cb39,_0x5883be){return db[_0xab67('0x36')]['find']({'where':{'id':_0x28cb39[_0xab67('0x4e')]['id']}})[_0xab67('0x1b')](handleEntityNotFound(_0x5883be,null))[_0xab67('0x1b')](removeEntity(_0x5883be,null))['catch'](handleError(_0x5883be,null));};exports[_0xab67('0x53')]=function(_0x776cda,_0x547e77,_0x351fd3){var _0x4ee41d={};var _0x494802={};var _0x2b56fd;var _0x12a84a;return db[_0xab67('0x36')][_0xab67('0x54')]({'where':{'id':_0x776cda[_0xab67('0x4e')]['id']}})[_0xab67('0x1b')](handleEntityNotFound(_0x547e77,null))[_0xab67('0x1b')](function(_0x4a7d4f){if(_0x4a7d4f){_0x2b56fd=_0x4a7d4f;_0x494802['model']=_[_0xab67('0x3a')](db['DeskConfiguration'][_0xab67('0x4f')]);_0x494802[_0xab67('0x39')]=_[_0xab67('0x3a')](_0x776cda['query']);_0x494802['filters']=_[_0xab67('0x3c')](_0x494802[_0xab67('0x3d')],_0x494802['query']);_0x4ee41d[_0xab67('0x3e')]=_['intersection'](_0x494802[_0xab67('0x3d')],qs[_0xab67('0x3f')](_0x776cda[_0xab67('0x39')]['fields']));_0x4ee41d[_0xab67('0x3e')]=_0x4ee41d['attributes'][_0xab67('0x40')]?_0x4ee41d['attributes']:_0x494802[_0xab67('0x3d')];_0x4ee41d[_0xab67('0x55')]=qs[_0xab67('0x43')](_0x776cda['query'][_0xab67('0x43')]);_0x4ee41d['where']=qs['filters'](_[_0xab67('0x56')](_0x776cda[_0xab67('0x39')],_0x494802['filters']));if(_0x776cda[_0xab67('0x39')]['filter']){_0x4ee41d[_0xab67('0x45')]=_[_0xab67('0x46')](_0x4ee41d[_0xab67('0x45')],{'$or':_[_0xab67('0x35')](_0x4ee41d[_0xab67('0x3e')],function(_0x5ab1f1){var _0x2c9371={};_0x2c9371[_0x5ab1f1]={'$like':'%'+_0x776cda[_0xab67('0x39')][_0xab67('0x44')]+'%'};return _0x2c9371;})});}_0x4ee41d=_['merge']({},_0x4ee41d,_0x776cda[_0xab67('0x48')]);return _0x2b56fd['getConfigurations'](_0x4ee41d);}})['then'](function(_0x306468){if(_0x306468){_0x12a84a=_0x306468[_0xab67('0x40')];if(!_0x776cda[_0xab67('0x39')][_0xab67('0x41')](_0xab67('0x42'))){_0x4ee41d[_0xab67('0x2b')]=qs[_0xab67('0x2b')](_0x776cda['query'][_0xab67('0x2b')]);_0x4ee41d[_0xab67('0x2a')]=qs['offset'](_0x776cda['query'][_0xab67('0x2a')]);}return _0x2b56fd[_0xab67('0x53')](_0x4ee41d);}})['then'](function(_0x54b69e){if(_0x54b69e){return _0x54b69e?{'count':_0x12a84a,'rows':_0x54b69e}:null;}})[_0xab67('0x1b')](respondWithResult(_0x547e77,null))[_0xab67('0x4d')](handleError(_0x547e77,null));};exports[_0xab67('0x57')]=function(_0x14149f,_0x5b26b1,_0x5c2c37){if(_0x14149f[_0xab67('0x52')]['id']){delete _0x14149f['body']['id'];}return db[_0xab67('0x36')][_0xab67('0x54')]({'where':{'id':_0x14149f[_0xab67('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b26b1,null))['then'](function(_0x580920){if(_0x580920){_0x14149f[_0xab67('0x52')][_0xab67('0x58')]=_0x580920['id'];_0x14149f[_0xab67('0x52')][_0xab67('0x59')]=integrations[_0xab67('0x5a')](_0x14149f[_0xab67('0x52')][_0xab67('0x5b')],_0x14149f['body'][_0xab67('0x38')]);_0x14149f[_0xab67('0x52')]['Descriptions']=integrations['getDescriptions'](_0x14149f['body'][_0xab67('0x5b')],_0x14149f[_0xab67('0x52')][_0xab67('0x38')]);return db[_0xab67('0x5c')][_0xab67('0x51')](_0x14149f['body'],{'include':[{'model':db['DeskField'],'as':_0xab67('0x59')},{'model':db[_0xab67('0x5d')],'as':'Descriptions'}]});}return null;})[_0xab67('0x1b')](respondWithResult(_0x5b26b1,null))[_0xab67('0x4d')](handleError(_0x5b26b1,null));};exports[_0xab67('0x5e')]=function(_0x37c057,_0x580188,_0x6c33dd){var _0x45c0b6=[{'name':_0xab67('0x5f'),'label':_0xab67('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 _0x79c293='';return db[_0xab67('0x36')]['findOne']({'where':{'id':_0x37c057[_0xab67('0x4e')]['id']},'attributes':['id',_0xab67('0x60'),_0xab67('0x61'),_0xab67('0x62'),_0xab67('0x63'),_0xab67('0x64'),_0xab67('0x65'),_0xab67('0x66'),'tokenSecret']})[_0xab67('0x1b')](handleEntityNotFound(_0x580188,null))[_0xab67('0x1b')](function(_0x3e3186){if(_0x3e3186){_0x79c293=_0x3e3186[_0xab67('0x60')];var _0x1d774e=_0x79c293[_0xab67('0x67')](-0x1);if(_0x1d774e==='/'){_0x79c293=_0x79c293[_0xab67('0x68')](0x0,_0x79c293[_0xab67('0x69')](_0x1d774e));}var _0x39b9c2={'method':_0xab67('0x6a'),'uri':util['format']('%s/custom_fields',_0x79c293),'headers':{'Content-Type':_0xab67('0x6b'),'Accept':_0xab67('0x6b')},'json':!![]};if(_0x3e3186[_0xab67('0x61')]===_0xab67('0x6c')){_0x39b9c2['headers'][_0xab67('0x6d')]=util[_0xab67('0x6e')](_0xab67('0x6f'),new Buffer(util[_0xab67('0x6e')](_0xab67('0x70'),_0x3e3186['username'],_0x3e3186[_0xab67('0x63')]))['toString']('base64'));}return rp(_0x39b9c2)[_0xab67('0x1b')](function(_0x5edc95){return _0x45c0b6[_0xab67('0x71')](_['map'](_0x5edc95['_embedded'][_0xab67('0x72')],function(_0x315c21){return{'id':_0x315c21['name'],'name':_0x315c21[_0xab67('0x33')],'type':_0x315c21[_0xab67('0x38')],'active':_0x315c21['active'],'label':_0x315c21[_0xab67('0x73')],'custom':!![]};}));});}})['then'](function(_0x1ce8f6){return{'count':_0x1ce8f6[_0xab67('0x40')],'rows':_0x1ce8f6};})['then'](respondWithResult(_0x580188,null))[_0xab67('0x4d')](function(_0x3800ef){var _0x54b0a5=_0x37c057[_0xab67('0x39')][_0xab67('0x17')]?0x1f4:_0x3800ef[_0xab67('0x74')]||0x1f4;logger[_0xab67('0x21')](_0xab67('0x75'),'getFields',_0x54b0a5,JSON[_0xab67('0x20')](_0x3800ef));delete _0x3800ef[_0xab67('0x33')];if(_0x54b0a5===0x191){_0x54b0a5=0x190;}_0x580188['status'](_0x54b0a5)[_0xab67('0x76')](_0x37c057[_0xab67('0x39')][_0xab67('0x17')]?{'message':'Wrong\x20credentials','statusCode':_0x3800ef[_0xab67('0x74')]}:_0x3800ef);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 46eccef..9d8db7b 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 _0xa65b=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','request-promise','../../config/environment','./intDeskAccount.attributes'];(function(_0x9e1580,_0x4c9322){var _0x4d2f89=function(_0x4aedf7){while(--_0x4aedf7){_0x9e1580['push'](_0x9e1580['shift']());}};_0x4d2f89(++_0x4c9322);}(_0xa65b,0xb5));var _0xba65=function(_0x4bcc83,_0x25f6bb){_0x4bcc83=_0x4bcc83-0x0;var _0xb7db90=_0xa65b[_0x4bcc83];return _0xb7db90;};'use strict';var _=require('lodash');var util=require(_0xba65('0x0'));var logger=require(_0xba65('0x1'))(_0xba65('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba65('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba65('0x4'));var attributes=require(_0xba65('0x5'));var integrations=require(_0xba65('0x6'));module[_0xba65('0x7')]=function(_0xb5e53c,_0x15502e){return _0xb5e53c[_0xba65('0x8')](_0xba65('0x9'),attributes,{'tableName':_0xba65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28dd=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x28dd,0x15c));var _0xd28d=function(_0x4c432d,_0x435c91){_0x4c432d=_0x4c432d-0x0;var _0x4213b0=_0x28dd[_0x4c432d];return _0x4213b0;};'use strict';var _=require(_0xd28d('0x0'));var util=require(_0xd28d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd28d('0x2'));var BPromise=require(_0xd28d('0x3'));var rp=require(_0xd28d('0x4'));var fs=require('fs');var path=require(_0xd28d('0x5'));var rimraf=require('rimraf');var config=require(_0xd28d('0x6'));var attributes=require(_0xd28d('0x7'));var integrations=require(_0xd28d('0x8'));module[_0xd28d('0x9')]=function(_0x51e6c9,_0x1b9c58){return _0x51e6c9[_0xd28d('0xa')]('DeskAccount',attributes,{'tableName':_0xd28d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 9379b4c..ec4dfd5 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 _0xfa5b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','model','include','find','map','ShowDeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a5d7e,_0x2f81be){var _0x15112c=function(_0xfcc781){while(--_0xfcc781){_0x1a5d7e['push'](_0x1a5d7e['shift']());}};_0x15112c(++_0x2f81be);}(_0xfa5b,0xcc));var _0xbfa5=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xfa5b[_0x117f4c];return _0x2b24e9;};'use strict';var _=require(_0xbfa5('0x0'));var util=require('util');var moment=require(_0xbfa5('0x1'));var BPromise=require(_0xbfa5('0x2'));var rs=require(_0xbfa5('0x3'));var fs=require('fs');var Redis=require(_0xbfa5('0x4'));var db=require(_0xbfa5('0x5'))['db'];var utils=require(_0xbfa5('0x6'));var logger=require(_0xbfa5('0x7'))(_0xbfa5('0x8'));var config=require(_0xbfa5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbfa5('0xa')][_0xbfa5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x122fc4,_0x555469,_0x24a74c){return new BPromise(function(_0x332d92,_0x83ff80){return client[_0xbfa5('0xc')](_0x122fc4,_0x24a74c)[_0xbfa5('0xd')](function(_0x248874){logger[_0xbfa5('0xe')](_0xbfa5('0xf'),_0x555469,_0xbfa5('0x10'));logger[_0xbfa5('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x555469,_0xbfa5('0x10'),JSON[_0xbfa5('0x12')](_0x248874));if(_0x248874[_0xbfa5('0x13')]){if(_0x248874[_0xbfa5('0x13')]['code']===0x1f4){logger[_0xbfa5('0x13')](_0xbfa5('0xf'),_0x555469,_0x248874['error'][_0xbfa5('0x14')]);return _0x83ff80(_0x248874['error']['message']);}logger[_0xbfa5('0x13')](_0xbfa5('0xf'),_0x555469,_0x248874[_0xbfa5('0x13')][_0xbfa5('0x14')]);return _0x332d92(_0x248874['error'][_0xbfa5('0x14')]);}else{logger['info'](_0xbfa5('0xf'),_0x555469,_0xbfa5('0x10'));_0x332d92(_0x248874[_0xbfa5('0x15')][_0xbfa5('0x14')]);}})[_0xbfa5('0x16')](function(_0x41207d){logger['error'](_0xbfa5('0xf'),_0x555469,_0x41207d);_0x83ff80(_0x41207d);});});}exports[_0xbfa5('0x17')]=function(_0x4fe8db){var _0x3e901b=this;return new Promise(function(_0xbc3398,_0x1f0166){return db[_0xbfa5('0x18')][_0xbfa5('0x19')]({'raw':_0x4fe8db['options']?_0x4fe8db[_0xbfa5('0x1a')][_0xbfa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fe8db[_0xbfa5('0x1a')]?_0x4fe8db[_0xbfa5('0x1a')][_0xbfa5('0x1c')]||null:null,'attributes':_0x4fe8db[_0xbfa5('0x1a')]?_0x4fe8db[_0xbfa5('0x1a')][_0xbfa5('0x1d')]||null:null,'limit':_0x4fe8db['options']?_0x4fe8db[_0xbfa5('0x1a')]['limit']||null:null,'include':_0x4fe8db[_0xbfa5('0x1a')]?_0x4fe8db[_0xbfa5('0x1a')]['include']?_['map'](_0x4fe8db[_0xbfa5('0x1a')]['include'],function(_0x27461b){return{'model':db[_0x27461b[_0xbfa5('0x1e')]],'as':_0x27461b['as'],'attributes':_0x27461b[_0xbfa5('0x1d')],'include':_0x27461b['include']?_['map'](_0x27461b[_0xbfa5('0x1f')],function(_0x5383b4){return{'model':db[_0x5383b4[_0xbfa5('0x1e')]],'as':_0x5383b4['as'],'attributes':_0x5383b4[_0xbfa5('0x1d')],'include':_0x5383b4[_0xbfa5('0x1f')]?_['map'](_0x5383b4[_0xbfa5('0x1f')],function(_0x4b444c){return{'model':db[_0x4b444c['model']],'as':_0x4b444c['as'],'attributes':_0x4b444c[_0xbfa5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbfa5('0xd')](function(_0x567379){logger['info'](_0xbfa5('0x17'),_0x4fe8db);logger[_0xbfa5('0x11')](_0xbfa5('0x17'),_0x4fe8db,JSON[_0xbfa5('0x12')](_0x567379));_0xbc3398(_0x567379);})[_0xbfa5('0x16')](function(_0x29ae43){logger['error']('GetDeskAccount',_0x29ae43[_0xbfa5('0x14')],_0x4fe8db);_0x1f0166(_0x3e901b[_0xbfa5('0x13')](0x1f4,_0x29ae43[_0xbfa5('0x14')]));});});};exports['ShowDeskAccount']=function(_0x839297){var _0xf1a01d=this;return new Promise(function(_0x9aba52,_0x334701){return db[_0xbfa5('0x18')][_0xbfa5('0x20')]({'raw':_0x839297[_0xbfa5('0x1a')]?_0x839297[_0xbfa5('0x1a')][_0xbfa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x839297['options']?_0x839297['options'][_0xbfa5('0x1c')]||null:null,'attributes':_0x839297[_0xbfa5('0x1a')]?_0x839297[_0xbfa5('0x1a')][_0xbfa5('0x1d')]||null:null,'include':_0x839297[_0xbfa5('0x1a')]?_0x839297[_0xbfa5('0x1a')][_0xbfa5('0x1f')]?_[_0xbfa5('0x21')](_0x839297[_0xbfa5('0x1a')][_0xbfa5('0x1f')],function(_0x27724f){return{'model':db[_0x27724f[_0xbfa5('0x1e')]],'as':_0x27724f['as'],'attributes':_0x27724f[_0xbfa5('0x1d')],'include':_0x27724f[_0xbfa5('0x1f')]?_[_0xbfa5('0x21')](_0x27724f[_0xbfa5('0x1f')],function(_0x466c2c){return{'model':db[_0x466c2c[_0xbfa5('0x1e')]],'as':_0x466c2c['as'],'attributes':_0x466c2c[_0xbfa5('0x1d')],'include':_0x466c2c[_0xbfa5('0x1f')]?_[_0xbfa5('0x21')](_0x466c2c['include'],function(_0x3b1370){return{'model':db[_0x3b1370[_0xbfa5('0x1e')]],'as':_0x3b1370['as'],'attributes':_0x3b1370[_0xbfa5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54968a){logger[_0xbfa5('0xe')](_0xbfa5('0x22'),_0x839297);logger['debug'](_0xbfa5('0x22'),_0x839297,JSON[_0xbfa5('0x12')](_0x54968a));_0x9aba52(_0x54968a);})[_0xbfa5('0x16')](function(_0x55aa01){logger[_0xbfa5('0x13')]('ShowDeskAccount',_0x55aa01[_0xbfa5('0x14')],_0x839297);_0x334701(_0xf1a01d[_0xbfa5('0x13')](0x1f4,_0x55aa01[_0xbfa5('0x14')]));});});}; \ No newline at end of file +var _0x2082=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','include','model','attributes','map','where','ShowDeskAccount'];(function(_0x58ddff,_0x227041){var _0x2827ef=function(_0x55fb38){while(--_0x55fb38){_0x58ddff['push'](_0x58ddff['shift']());}};_0x2827ef(++_0x227041);}(_0x2082,0xe0));var _0x2208=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x2082[_0x34ad72];return _0x5c9aa8;};'use strict';var _=require(_0x2208('0x0'));var util=require(_0x2208('0x1'));var moment=require(_0x2208('0x2'));var BPromise=require(_0x2208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2208('0x4'))['db'];var utils=require(_0x2208('0x5'));var logger=require(_0x2208('0x6'))(_0x2208('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2208('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a472f,_0x52b0cd,_0x3df94e){return new BPromise(function(_0x4f7666,_0xe165ca){return client['request'](_0x4a472f,_0x3df94e)[_0x2208('0x9')](function(_0x15f853){logger[_0x2208('0xa')](_0x2208('0xb'),_0x52b0cd,_0x2208('0xc'));logger[_0x2208('0xd')](_0x2208('0xe'),_0x52b0cd,_0x2208('0xc'),JSON[_0x2208('0xf')](_0x15f853));if(_0x15f853[_0x2208('0x10')]){if(_0x15f853[_0x2208('0x10')]['code']===0x1f4){logger[_0x2208('0x10')]('DeskAccount,\x20%s,\x20%s',_0x52b0cd,_0x15f853['error'][_0x2208('0x11')]);return _0xe165ca(_0x15f853['error']['message']);}logger['error'](_0x2208('0xb'),_0x52b0cd,_0x15f853[_0x2208('0x10')][_0x2208('0x11')]);return _0x4f7666(_0x15f853[_0x2208('0x10')]['message']);}else{logger['info'](_0x2208('0xb'),_0x52b0cd,_0x2208('0xc'));_0x4f7666(_0x15f853[_0x2208('0x12')]['message']);}})[_0x2208('0x13')](function(_0x16d6bb){logger[_0x2208('0x10')](_0x2208('0xb'),_0x52b0cd,_0x16d6bb);_0xe165ca(_0x16d6bb);});});}exports[_0x2208('0x14')]=function(_0x187a07){var _0x50448e=this;return new Promise(function(_0x3a3e3f,_0x397c54){return db[_0x2208('0x15')][_0x2208('0x16')]({'raw':_0x187a07[_0x2208('0x17')]?_0x187a07[_0x2208('0x17')][_0x2208('0x18')]===undefined?!![]:![]:!![],'where':_0x187a07[_0x2208('0x17')]?_0x187a07[_0x2208('0x17')]['where']||null:null,'attributes':_0x187a07[_0x2208('0x17')]?_0x187a07[_0x2208('0x17')]['attributes']||null:null,'limit':_0x187a07['options']?_0x187a07['options'][_0x2208('0x19')]||null:null,'include':_0x187a07[_0x2208('0x17')]?_0x187a07[_0x2208('0x17')][_0x2208('0x1a')]?_['map'](_0x187a07['options'][_0x2208('0x1a')],function(_0x1947e5){return{'model':db[_0x1947e5[_0x2208('0x1b')]],'as':_0x1947e5['as'],'attributes':_0x1947e5[_0x2208('0x1c')],'include':_0x1947e5[_0x2208('0x1a')]?_[_0x2208('0x1d')](_0x1947e5['include'],function(_0x5e3309){return{'model':db[_0x5e3309[_0x2208('0x1b')]],'as':_0x5e3309['as'],'attributes':_0x5e3309[_0x2208('0x1c')],'include':_0x5e3309[_0x2208('0x1a')]?_[_0x2208('0x1d')](_0x5e3309[_0x2208('0x1a')],function(_0x2cca9c){return{'model':db[_0x2cca9c[_0x2208('0x1b')]],'as':_0x2cca9c['as'],'attributes':_0x2cca9c[_0x2208('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2208('0x9')](function(_0x1907e3){logger[_0x2208('0xa')]('GetDeskAccount',_0x187a07);logger[_0x2208('0xd')]('GetDeskAccount',_0x187a07,JSON['stringify'](_0x1907e3));_0x3a3e3f(_0x1907e3);})[_0x2208('0x13')](function(_0x5ccbda){logger[_0x2208('0x10')](_0x2208('0x14'),_0x5ccbda[_0x2208('0x11')],_0x187a07);_0x397c54(_0x50448e[_0x2208('0x10')](0x1f4,_0x5ccbda['message']));});});};exports['ShowDeskAccount']=function(_0x183069){var _0x24586d=this;return new Promise(function(_0x444c43,_0x51cbb8){return db[_0x2208('0x15')]['find']({'raw':_0x183069[_0x2208('0x17')]?_0x183069['options']['raw']===undefined?!![]:![]:!![],'where':_0x183069[_0x2208('0x17')]?_0x183069[_0x2208('0x17')][_0x2208('0x1e')]||null:null,'attributes':_0x183069[_0x2208('0x17')]?_0x183069[_0x2208('0x17')][_0x2208('0x1c')]||null:null,'include':_0x183069['options']?_0x183069[_0x2208('0x17')]['include']?_['map'](_0x183069[_0x2208('0x17')][_0x2208('0x1a')],function(_0x5b9e2e){return{'model':db[_0x5b9e2e[_0x2208('0x1b')]],'as':_0x5b9e2e['as'],'attributes':_0x5b9e2e[_0x2208('0x1c')],'include':_0x5b9e2e[_0x2208('0x1a')]?_[_0x2208('0x1d')](_0x5b9e2e[_0x2208('0x1a')],function(_0x353129){return{'model':db[_0x353129[_0x2208('0x1b')]],'as':_0x353129['as'],'attributes':_0x353129[_0x2208('0x1c')],'include':_0x353129[_0x2208('0x1a')]?_['map'](_0x353129[_0x2208('0x1a')],function(_0x70dfc8){return{'model':db[_0x70dfc8[_0x2208('0x1b')]],'as':_0x70dfc8['as'],'attributes':_0x70dfc8[_0x2208('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2208('0x9')](function(_0x3e2fde){logger[_0x2208('0xa')](_0x2208('0x1f'),_0x183069);logger[_0x2208('0xd')](_0x2208('0x1f'),_0x183069,JSON[_0x2208('0xf')](_0x3e2fde));_0x444c43(_0x3e2fde);})[_0x2208('0x13')](function(_0x120442){logger[_0x2208('0x10')]('ShowDeskAccount',_0x120442[_0x2208('0x11')],_0x183069);_0x51cbb8(_0x24586d[_0x2208('0x10')](0x1f4,_0x120442[_0x2208('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ca1b33b..1573aa4 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 _0xb242=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','update','exports','util','path','connect-timeout','express','Router'];(function(_0xa6271,_0x3e9ce1){var _0x4fbc16=function(_0x596149){while(--_0x596149){_0xa6271['push'](_0xa6271['shift']());}};_0x4fbc16(++_0x3e9ce1);}(_0xb242,0x1f3));var _0x2b24=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0xb242[_0x531d15];return _0x271a18;};'use strict';var multer=require('multer');var util=require(_0x2b24('0x0'));var path=require(_0x2b24('0x1'));var timeout=require(_0x2b24('0x2'));var express=require(_0x2b24('0x3'));var router=express[_0x2b24('0x4')]();var auth=require(_0x2b24('0x5'));var interaction=require(_0x2b24('0x6'));var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0x2b24('0x7')]('/',auth[_0x2b24('0x8')](),controller['index']);router[_0x2b24('0x7')](_0x2b24('0x9'),auth[_0x2b24('0x8')](),controller['show']);router[_0x2b24('0x7')]('/:id/fields',auth[_0x2b24('0x8')](),controller[_0x2b24('0xa')]);router['get'](_0x2b24('0xb'),auth['isAuthenticated'](),controller[_0x2b24('0xc')]);router[_0x2b24('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2b24('0xd')]);router['get'](_0x2b24('0xe'),auth[_0x2b24('0x8')](),controller[_0x2b24('0xf')]);router[_0x2b24('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2b24('0x10')](_0x2b24('0xe'),auth[_0x2b24('0x8')](),controller[_0x2b24('0x11')]);router[_0x2b24('0x12')]('/:id',auth[_0x2b24('0x8')](),controller[_0x2b24('0x13')]);router['delete'](_0x2b24('0x9'),auth[_0x2b24('0x8')](),controller['destroy']);module[_0x2b24('0x14')]=router; \ No newline at end of file +var _0xab9f=['../../components/interaction/service','./intDeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x17920a,_0x5da3b3){var _0x40e045=function(_0x54e3ad){while(--_0x54e3ad){_0x17920a['push'](_0x17920a['shift']());}};_0x40e045(++_0x5da3b3);}(_0xab9f,0x1bd));var _0xfab9=function(_0x4b92c3,_0x23be84){_0x4b92c3=_0x4b92c3-0x0;var _0x57d180=_0xab9f[_0x4b92c3];return _0x57d180;};'use strict';var multer=require(_0xfab9('0x0'));var util=require('util');var path=require(_0xfab9('0x1'));var timeout=require(_0xfab9('0x2'));var express=require(_0xfab9('0x3'));var router=express['Router']();var auth=require(_0xfab9('0x4'));var interaction=require(_0xfab9('0x5'));var config=require('../../config/environment');var controller=require(_0xfab9('0x6'));router['get']('/',auth[_0xfab9('0x7')](),controller['index']);router[_0xfab9('0x8')](_0xfab9('0x9'),auth[_0xfab9('0x7')](),controller[_0xfab9('0xa')]);router['get'](_0xfab9('0xb'),auth[_0xfab9('0x7')](),controller['getFields']);router['get'](_0xfab9('0xc'),auth[_0xfab9('0x7')](),controller[_0xfab9('0xd')]);router[_0xfab9('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfab9('0xe')]);router[_0xfab9('0x8')](_0xfab9('0xf'),auth[_0xfab9('0x7')](),controller[_0xfab9('0x10')]);router[_0xfab9('0x11')]('/',auth[_0xfab9('0x7')](),controller[_0xfab9('0x12')]);router[_0xfab9('0x11')](_0xfab9('0xf'),auth['isAuthenticated'](),controller[_0xfab9('0x13')]);router[_0xfab9('0x14')](_0xfab9('0x9'),auth[_0xfab9('0x7')](),controller[_0xfab9('0x15')]);router[_0xfab9('0x16')]('/:id',auth[_0xfab9('0x7')](),controller[_0xfab9('0x17')]);module[_0xfab9('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 39b74ce..78cb836 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 _0x86ea=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86ea,0xe2));var _0xa86e=function(_0x24de42,_0x109017){_0x24de42=_0x24de42-0x0;var _0xd70a4d=_0x86ea[_0x24de42];return _0xd70a4d;};'use strict';var Sequelize=require(_0xa86e('0x0'));module[_0xa86e('0x1')]={'name':{'type':Sequelize[_0xa86e('0x2')]},'description':{'type':Sequelize[_0xa86e('0x2')]}}; \ No newline at end of file +var _0x50c2=['exports','STRING','sequelize'];(function(_0x23c99f,_0x3c46e8){var _0x424726=function(_0x1bcd18){while(--_0x1bcd18){_0x23c99f['push'](_0x23c99f['shift']());}};_0x424726(++_0x3c46e8);}(_0x50c2,0xb3));var _0x250c=function(_0x57eb94,_0x8486ea){_0x57eb94=_0x57eb94-0x0;var _0x173641=_0x50c2[_0x57eb94];return _0x173641;};'use strict';var Sequelize=require(_0x250c('0x0'));module[_0x250c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x250c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 58c45f1..65f7b0d 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 _0x33c5=['filters','intersection','attributes','fields','nolimit','sort','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','rawAttributes','length','include','find','create','body','params','getFields','findOne','DeskField','order','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','set','apply','reject','save','update','destroy','status','index','map','DeskConfiguration','fieldName','type','model','name','query','keys'];(function(_0x4cddff,_0x1bf9c4){var _0x268a87=function(_0x713305){while(--_0x713305){_0x4cddff['push'](_0x4cddff['shift']());}};_0x268a87(++_0x1bf9c4);}(_0x33c5,0xe6));var _0x533c=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x33c5[_0x540160];return _0x476120;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x533c('0x0'));var rimraf=require(_0x533c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x533c('0x2'));var rp=require(_0x533c('0x3'));var moment=require(_0x533c('0x4'));var BPromise=require(_0x533c('0x5'));var Mustache=require(_0x533c('0x6'));var util=require('util');var path=require(_0x533c('0x7'));var sox=require(_0x533c('0x8'));var csv=require(_0x533c('0x9'));var ejs=require(_0x533c('0xa'));var fs=require('fs');var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x9'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var db=require(_0x533c('0x1a'))['db'];var jayson=require(_0x533c('0x1b'));var client=jayson['client'][_0x533c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xf93007,_0x300a63,_0x12ecae){if(_0x12ecae){var _0x2d5bc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d5bc8[_0x533c('0x1d')](_0x300a63)){return _0xf93007;}else{throw new db[(_0x533c('0x1e'))][(_0x533c('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 _0xf93007;}}function respondWithRpcPromise(_0x335f73,_0x7c1d33,_0x3f4a5c,_0x3e544f){return new BPromise(function(_0x56dfb7,_0x1031e7){var _0x1ed6ba=_0x3e544f||client;return _0x1ed6ba[_0x533c('0x20')](_0x335f73,_0x3f4a5c)[_0x533c('0x21')](function(_0x2854ab){logger[_0x533c('0x22')](_0x533c('0x23'),_0x7c1d33,_0x533c('0x24'));logger[_0x533c('0x25')](_0x533c('0x26'),_0x7c1d33,_0x533c('0x24'),JSON[_0x533c('0x27')](_0x2854ab));if(_0x2854ab[_0x533c('0x28')]){if(_0x2854ab[_0x533c('0x28')][_0x533c('0x29')]===0x1f4){logger[_0x533c('0x28')](_0x533c('0x23'),_0x7c1d33,_0x2854ab[_0x533c('0x28')]['message']);return _0x1031e7(_0x2854ab[_0x533c('0x28')]['message']);}logger['error'](_0x533c('0x23'),_0x7c1d33,_0x2854ab[_0x533c('0x28')]['message']);return _0x56dfb7(_0x2854ab[_0x533c('0x28')][_0x533c('0x2a')]);}else{logger[_0x533c('0x22')](_0x533c('0x23'),_0x7c1d33,'request\x20sent');_0x56dfb7(_0x2854ab[_0x533c('0x2b')][_0x533c('0x2a')]);}})[_0x533c('0x2c')](function(_0x107a97){logger[_0x533c('0x28')](_0x533c('0x23'),_0x7c1d33,_0x107a97);_0x1031e7(_0x107a97);});});}function respondWithStatusCode(_0xb51a5,_0x43f669){_0x43f669=_0x43f669||0xcc;return function(_0xb1c937){if(_0xb1c937){return _0xb51a5[_0x533c('0x2d')](_0x43f669);}return _0xb51a5['status'](_0x43f669)[_0x533c('0x2e')]();};}function respondWithResult(_0xfab4da,_0x503c2e){_0x503c2e=_0x503c2e||0xc8;return function(_0x3caaa5){if(_0x3caaa5){return _0xfab4da['status'](_0x503c2e)[_0x533c('0x2f')](_0x3caaa5);}};}function respondWithFilteredResult(_0x14d783,_0x4a0e86){return function(_0x8dd7f1){if(_0x8dd7f1){var _0x425f60=_0x8dd7f1[_0x533c('0x30')],_0x146a8e=_0x4a0e86[_0x533c('0x31')],_0x212d1b=_0x4a0e86[_0x533c('0x31')]+_0x4a0e86[_0x533c('0x32')],_0x38d886;if(_0x212d1b>=_0x425f60){_0x212d1b=_0x425f60;_0x38d886=0xc8;}else{_0x38d886=0xce;}_0x14d783['status'](_0x38d886);return _0x14d783[_0x533c('0x33')]('Content-Range',_0x146a8e+'-'+_0x212d1b+'/'+_0x425f60)[_0x533c('0x2f')](_0x8dd7f1);}return null;};}function patchUpdates(_0x11c5e7){return function(_0x39eda3){try{jsonpatch[_0x533c('0x34')](_0x39eda3,_0x11c5e7,!![]);}catch(_0x16006a){return BPromise[_0x533c('0x35')](_0x16006a);}return _0x39eda3[_0x533c('0x36')]();};}function saveUpdates(_0x624d84,_0x287ee5){return function(_0x47831f){if(_0x47831f){return _0x47831f[_0x533c('0x37')](_0x624d84)[_0x533c('0x21')](function(_0x3f7ffc){return _0x3f7ffc;});}return null;};}function removeEntity(_0x14dd9d,_0x3803d0){return function(_0x5ac6b4){if(_0x5ac6b4){return _0x5ac6b4[_0x533c('0x38')]()[_0x533c('0x21')](function(){_0x14dd9d[_0x533c('0x39')](0xcc)[_0x533c('0x2e')]();});}};}function handleEntityNotFound(_0x56694f,_0x3f1db9){return function(_0x31b4e4){if(!_0x31b4e4){_0x56694f[_0x533c('0x2d')](0x194);}return _0x31b4e4;};}function handleError(_0x40f077,_0x1255b1){_0x1255b1=_0x1255b1||0x1f4;return function(_0x56e0f0){logger['error'](_0x56e0f0['stack']);if(_0x56e0f0['name']){delete _0x56e0f0['name'];}_0x40f077[_0x533c('0x39')](_0x1255b1)['send'](_0x56e0f0);};}exports[_0x533c('0x3a')]=function(_0x55726a,_0x34243d){var _0x3cd1e6={},_0x14c121={},_0x56adcc={'count':0x0,'rows':[]};var _0x44a18d=_[_0x533c('0x3b')](db[_0x533c('0x3c')]['rawAttributes'],function(_0x160d4b){return{'name':_0x160d4b[_0x533c('0x3d')],'type':_0x160d4b[_0x533c('0x3e')]['key']};});_0x14c121[_0x533c('0x3f')]=_[_0x533c('0x3b')](_0x44a18d,_0x533c('0x40'));_0x14c121[_0x533c('0x41')]=_[_0x533c('0x42')](_0x55726a[_0x533c('0x41')]);_0x14c121[_0x533c('0x43')]=_[_0x533c('0x44')](_0x14c121[_0x533c('0x3f')],_0x14c121[_0x533c('0x41')]);_0x3cd1e6[_0x533c('0x45')]=_['intersection'](_0x14c121[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x55726a[_0x533c('0x41')][_0x533c('0x46')]));_0x3cd1e6[_0x533c('0x45')]=_0x3cd1e6[_0x533c('0x45')]['length']?_0x3cd1e6[_0x533c('0x45')]:_0x14c121[_0x533c('0x3f')];if(!_0x55726a[_0x533c('0x41')]['hasOwnProperty'](_0x533c('0x47'))){_0x3cd1e6[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x55726a[_0x533c('0x41')]['limit']);_0x3cd1e6[_0x533c('0x31')]=qs['offset'](_0x55726a[_0x533c('0x41')][_0x533c('0x31')]);}_0x3cd1e6['order']=qs[_0x533c('0x48')](_0x55726a[_0x533c('0x41')][_0x533c('0x48')]);_0x3cd1e6['where']=qs['filters'](_['pick'](_0x55726a['query'],_0x14c121[_0x533c('0x43')]),_0x44a18d);if(_0x55726a['query'][_0x533c('0x49')]){_0x3cd1e6['where']=_[_0x533c('0x4a')](_0x3cd1e6['where'],{'$or':_[_0x533c('0x3b')](_0x44a18d,function(_0x4a946b){if(_0x4a946b['type']!==_0x533c('0x4b')){var _0x1bd868={};_0x1bd868[_0x4a946b[_0x533c('0x40')]]={'$like':'%'+_0x55726a[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x1bd868;}})});}_0x3cd1e6=_['merge']({},_0x3cd1e6,_0x55726a[_0x533c('0x4c')]);var _0x22dc87={'where':_0x3cd1e6[_0x533c('0x4d')]};return db[_0x533c('0x3c')]['count'](_0x22dc87)[_0x533c('0x21')](function(_0x5080a6){_0x56adcc['count']=_0x5080a6;if(_0x55726a['query'][_0x533c('0x4e')]){_0x3cd1e6['include']=[{'all':!![]}];}return db[_0x533c('0x3c')][_0x533c('0x4f')](_0x3cd1e6);})[_0x533c('0x21')](function(_0x471c59){_0x56adcc[_0x533c('0x50')]=_0x471c59;return _0x56adcc;})[_0x533c('0x21')](respondWithFilteredResult(_0x34243d,_0x3cd1e6))[_0x533c('0x2c')](handleError(_0x34243d,null));};exports[_0x533c('0x51')]=function(_0x52411e,_0x19ccc0){var _0x6b16e1={'raw':![],'where':{'id':_0x52411e['params']['id']}},_0xaaf682={};_0xaaf682[_0x533c('0x3f')]=_[_0x533c('0x42')](db['DeskConfiguration'][_0x533c('0x52')]);_0xaaf682['query']=_[_0x533c('0x42')](_0x52411e[_0x533c('0x41')]);_0xaaf682[_0x533c('0x43')]=_[_0x533c('0x44')](_0xaaf682[_0x533c('0x3f')],_0xaaf682[_0x533c('0x41')]);_0x6b16e1[_0x533c('0x45')]=_['intersection'](_0xaaf682[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x52411e[_0x533c('0x41')][_0x533c('0x46')]));_0x6b16e1[_0x533c('0x45')]=_0x6b16e1[_0x533c('0x45')][_0x533c('0x53')]?_0x6b16e1['attributes']:_0xaaf682['model'];if(_0x52411e['query']['includeAll']){_0x6b16e1[_0x533c('0x54')]=[{'all':!![]}];}_0x6b16e1=_[_0x533c('0x4a')]({},_0x6b16e1,_0x52411e['options']);return db[_0x533c('0x3c')][_0x533c('0x55')](_0x6b16e1)[_0x533c('0x21')](handleEntityNotFound(_0x19ccc0,null))['then'](respondWithResult(_0x19ccc0,null))[_0x533c('0x2c')](handleError(_0x19ccc0,null));};exports['create']=function(_0x50cfbc,_0x209b9f){return db[_0x533c('0x3c')][_0x533c('0x56')](_0x50cfbc[_0x533c('0x57')],{})[_0x533c('0x21')](respondWithResult(_0x209b9f,0xc9))[_0x533c('0x2c')](handleError(_0x209b9f,null));};exports[_0x533c('0x37')]=function(_0x51190c,_0x1ec3d0){if(_0x51190c['body']['id']){delete _0x51190c[_0x533c('0x57')]['id'];}return db[_0x533c('0x3c')][_0x533c('0x55')]({'where':{'id':_0x51190c[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x1ec3d0,null))[_0x533c('0x21')](saveUpdates(_0x51190c[_0x533c('0x57')],null))[_0x533c('0x21')](respondWithResult(_0x1ec3d0,null))['catch'](handleError(_0x1ec3d0,null));};exports[_0x533c('0x38')]=function(_0x43a333,_0x163563){return db[_0x533c('0x3c')][_0x533c('0x55')]({'where':{'id':_0x43a333[_0x533c('0x58')]['id']}})['then'](handleEntityNotFound(_0x163563,null))[_0x533c('0x21')](removeEntity(_0x163563,null))['catch'](handleError(_0x163563,null));};exports[_0x533c('0x59')]=function(_0x451737,_0x15f70,_0x9b28b8){var _0x302b66={};var _0xc683d5={};var _0x5cc8bc;var _0x591985;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x451737[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x15f70,null))['then'](function(_0x29c95c){if(_0x29c95c){_0x5cc8bc=_0x29c95c;_0xc683d5[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0xc683d5[_0x533c('0x41')]=_[_0x533c('0x42')](_0x451737[_0x533c('0x41')]);_0xc683d5[_0x533c('0x43')]=_[_0x533c('0x44')](_0xc683d5[_0x533c('0x3f')],_0xc683d5[_0x533c('0x41')]);_0x302b66[_0x533c('0x45')]=_[_0x533c('0x44')](_0xc683d5[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x451737[_0x533c('0x41')]['fields']));_0x302b66[_0x533c('0x45')]=_0x302b66['attributes']['length']?_0x302b66[_0x533c('0x45')]:_0xc683d5[_0x533c('0x3f')];_0x302b66[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0x451737[_0x533c('0x41')][_0x533c('0x48')]);_0x302b66[_0x533c('0x4d')]=qs['filters'](_[_0x533c('0x5d')](_0x451737[_0x533c('0x41')],_0xc683d5['filters']));if(_0x451737[_0x533c('0x41')][_0x533c('0x49')]){_0x302b66[_0x533c('0x4d')]=_[_0x533c('0x4a')](_0x302b66['where'],{'$or':_[_0x533c('0x3b')](_0x302b66[_0x533c('0x45')],function(_0x50223e){var _0x1589b0={};_0x1589b0[_0x50223e]={'$like':'%'+_0x451737[_0x533c('0x41')]['filter']+'%'};return _0x1589b0;})});}_0x302b66=_[_0x533c('0x4a')]({},_0x302b66,_0x451737[_0x533c('0x4c')]);return _0x5cc8bc['getFields'](_0x302b66);}})[_0x533c('0x21')](function(_0x5183e2){if(_0x5183e2){_0x591985=_0x5183e2['length'];if(!_0x451737[_0x533c('0x41')][_0x533c('0x5e')](_0x533c('0x47'))){_0x302b66[_0x533c('0x32')]=qs['limit'](_0x451737[_0x533c('0x41')][_0x533c('0x32')]);_0x302b66[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x451737[_0x533c('0x41')]['offset']);}return _0x5cc8bc[_0x533c('0x59')](_0x302b66);}})['then'](function(_0x45b589){if(_0x45b589){return _0x45b589?{'count':_0x591985,'rows':_0x45b589}:null;}})['then'](respondWithResult(_0x15f70,null))[_0x533c('0x2c')](handleError(_0x15f70,null));};exports['getSubjects']=function(_0x4bd014,_0x511f74,_0x3283bb){var _0x3f3981={};var _0x191a3b={};var _0x52c812;var _0x2e202e;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x4bd014[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x511f74,null))['then'](function(_0x596cb0){if(_0x596cb0){_0x52c812=_0x596cb0;_0x191a3b[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0x191a3b[_0x533c('0x41')]=_[_0x533c('0x42')](_0x4bd014[_0x533c('0x41')]);_0x191a3b[_0x533c('0x43')]=_[_0x533c('0x44')](_0x191a3b['model'],_0x191a3b[_0x533c('0x41')]);_0x3f3981[_0x533c('0x45')]=_[_0x533c('0x44')](_0x191a3b[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x4bd014[_0x533c('0x41')][_0x533c('0x46')]));_0x3f3981[_0x533c('0x45')]=_0x3f3981[_0x533c('0x45')][_0x533c('0x53')]?_0x3f3981[_0x533c('0x45')]:_0x191a3b[_0x533c('0x3f')];_0x3f3981[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0x4bd014[_0x533c('0x41')][_0x533c('0x48')]);_0x3f3981[_0x533c('0x4d')]=qs['filters'](_[_0x533c('0x5d')](_0x4bd014[_0x533c('0x41')],_0x191a3b['filters']));if(_0x4bd014['query'][_0x533c('0x49')]){_0x3f3981['where']=_[_0x533c('0x4a')](_0x3f3981[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x3f3981[_0x533c('0x45')],function(_0x3f8098){var _0x54eedf={};_0x54eedf[_0x3f8098]={'$like':'%'+_0x4bd014[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x54eedf;})});}_0x3f3981=_[_0x533c('0x4a')]({},_0x3f3981,_0x4bd014[_0x533c('0x4c')]);return _0x52c812[_0x533c('0x5f')](_0x3f3981);}})[_0x533c('0x21')](function(_0x1aa938){if(_0x1aa938){_0x2e202e=_0x1aa938[_0x533c('0x53')];if(!_0x4bd014[_0x533c('0x41')][_0x533c('0x5e')](_0x533c('0x47'))){_0x3f3981[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x4bd014[_0x533c('0x41')][_0x533c('0x32')]);_0x3f3981[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x4bd014[_0x533c('0x41')]['offset']);}return _0x52c812[_0x533c('0x5f')](_0x3f3981);}})[_0x533c('0x21')](function(_0x247915){if(_0x247915){return _0x247915?{'count':_0x2e202e,'rows':_0x247915}:null;}})[_0x533c('0x21')](respondWithResult(_0x511f74,null))['catch'](handleError(_0x511f74,null));};exports[_0x533c('0x60')]=function(_0xc0cf5d,_0x4d1b98,_0x411f86){var _0x5b8ead={};var _0x291be3={};var _0x4be94e;var _0x11654c;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0xc0cf5d['params']['id']}})['then'](handleEntityNotFound(_0x4d1b98,null))['then'](function(_0x1088f9){if(_0x1088f9){_0x4be94e=_0x1088f9;_0x291be3['model']=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0x291be3[_0x533c('0x41')]=_['keys'](_0xc0cf5d['query']);_0x291be3[_0x533c('0x43')]=_['intersection'](_0x291be3[_0x533c('0x3f')],_0x291be3[_0x533c('0x41')]);_0x5b8ead[_0x533c('0x45')]=_['intersection'](_0x291be3[_0x533c('0x3f')],qs['fields'](_0xc0cf5d[_0x533c('0x41')][_0x533c('0x46')]));_0x5b8ead['attributes']=_0x5b8ead[_0x533c('0x45')][_0x533c('0x53')]?_0x5b8ead[_0x533c('0x45')]:_0x291be3[_0x533c('0x3f')];_0x5b8ead[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0xc0cf5d['query'][_0x533c('0x48')]);_0x5b8ead[_0x533c('0x4d')]=qs[_0x533c('0x43')](_['pick'](_0xc0cf5d[_0x533c('0x41')],_0x291be3['filters']));if(_0xc0cf5d['query'][_0x533c('0x49')]){_0x5b8ead[_0x533c('0x4d')]=_['merge'](_0x5b8ead[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x5b8ead[_0x533c('0x45')],function(_0x32ec4f){var _0x1dd861={};_0x1dd861[_0x32ec4f]={'$like':'%'+_0xc0cf5d[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x1dd861;})});}_0x5b8ead=_[_0x533c('0x4a')]({},_0x5b8ead,_0xc0cf5d[_0x533c('0x4c')]);return _0x4be94e[_0x533c('0x60')](_0x5b8ead);}})[_0x533c('0x21')](function(_0x243d1a){if(_0x243d1a){_0x11654c=_0x243d1a[_0x533c('0x53')];if(!_0xc0cf5d['query'][_0x533c('0x5e')](_0x533c('0x47'))){_0x5b8ead[_0x533c('0x32')]=qs['limit'](_0xc0cf5d[_0x533c('0x41')]['limit']);_0x5b8ead[_0x533c('0x31')]=qs[_0x533c('0x31')](_0xc0cf5d[_0x533c('0x41')]['offset']);}return _0x4be94e[_0x533c('0x60')](_0x5b8ead);}})[_0x533c('0x21')](function(_0x206029){if(_0x206029){return _0x206029?{'count':_0x11654c,'rows':_0x206029}:null;}})['then'](respondWithResult(_0x4d1b98,null))['catch'](handleError(_0x4d1b98,null));};exports[_0x533c('0x61')]=function(_0x5d5bb3,_0x392968,_0x5195b1){var _0x3c11d3={};var _0x27efd7={};var _0x11b782;var _0x4a362a;return db['DeskConfiguration'][_0x533c('0x5a')]({'where':{'id':_0x5d5bb3[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x392968,null))[_0x533c('0x21')](function(_0x313916){if(_0x313916){_0x11b782=_0x313916;_0x27efd7[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x62')][_0x533c('0x52')]);_0x27efd7['query']=_[_0x533c('0x42')](_0x5d5bb3[_0x533c('0x41')]);_0x27efd7[_0x533c('0x43')]=_['intersection'](_0x27efd7[_0x533c('0x3f')],_0x27efd7[_0x533c('0x41')]);_0x3c11d3[_0x533c('0x45')]=_[_0x533c('0x44')](_0x27efd7[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x5d5bb3[_0x533c('0x41')][_0x533c('0x46')]));_0x3c11d3[_0x533c('0x45')]=_0x3c11d3[_0x533c('0x45')][_0x533c('0x53')]?_0x3c11d3[_0x533c('0x45')]:_0x27efd7['model'];_0x3c11d3[_0x533c('0x5c')]=qs['sort'](_0x5d5bb3[_0x533c('0x41')][_0x533c('0x48')]);_0x3c11d3['where']=qs['filters'](_[_0x533c('0x5d')](_0x5d5bb3['query'],_0x27efd7[_0x533c('0x43')]));if(_0x5d5bb3['query'][_0x533c('0x49')]){_0x3c11d3['where']=_[_0x533c('0x4a')](_0x3c11d3[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x3c11d3[_0x533c('0x45')],function(_0x29115b){var _0x39121b={};_0x39121b[_0x29115b]={'$like':'%'+_0x5d5bb3[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x39121b;})});}_0x3c11d3=_['merge']({},_0x3c11d3,_0x5d5bb3[_0x533c('0x4c')]);return _0x11b782[_0x533c('0x61')](_0x3c11d3);}})[_0x533c('0x21')](function(_0x4abaab){if(_0x4abaab){_0x4a362a=_0x4abaab[_0x533c('0x53')];if(!_0x5d5bb3['query']['hasOwnProperty'](_0x533c('0x47'))){_0x3c11d3[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x5d5bb3['query']['limit']);_0x3c11d3[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x5d5bb3[_0x533c('0x41')][_0x533c('0x31')]);}return _0x11b782['getTags'](_0x3c11d3);}})[_0x533c('0x21')](function(_0x3c8827){if(_0x3c8827){return _0x3c8827?{'count':_0x4a362a,'rows':_0x3c8827}:null;}})[_0x533c('0x21')](respondWithResult(_0x392968,null))[_0x533c('0x2c')](handleError(_0x392968,null));};exports['setTags']=function(_0x4c9b50,_0x5f1456,_0x648909){if(_0x4c9b50[_0x533c('0x57')]['id']){delete _0x4c9b50['body']['id'];}return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x4c9b50['params']['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x5f1456,null))[_0x533c('0x21')](function(_0x504e2b){if(_0x504e2b){return _0x504e2b['setTags'](_0x4c9b50[_0x533c('0x57')]['ids']||[]);}return null;})['then'](respondWithResult(_0x5f1456,null))[_0x533c('0x2c')](handleError(_0x5f1456,null));}; \ No newline at end of file +var _0xf2cf=['json','reject','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','include','findAll','rows','params','find','create','body','getFields','findOne','DeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','set','Content-Range'];(function(_0x3b6735,_0x1c6cd4){var _0x364538=function(_0x26d0da){while(--_0x26d0da){_0x3b6735['push'](_0x3b6735['shift']());}};_0x364538(++_0x1c6cd4);}(_0xf2cf,0xf5));var _0xff2c=function(_0x46e6be,_0x4ddd09){_0x46e6be=_0x46e6be-0x0;var _0x354f0d=_0xf2cf[_0x46e6be];return _0x354f0d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff2c('0x0'));var rimraf=require(_0xff2c('0x1'));var zipdir=require(_0xff2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff2c('0x3'));var moment=require(_0xff2c('0x4'));var BPromise=require(_0xff2c('0x5'));var Mustache=require(_0xff2c('0x6'));var util=require(_0xff2c('0x7'));var path=require(_0xff2c('0x8'));var sox=require('sox');var csv=require(_0xff2c('0x9'));var ejs=require(_0xff2c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff2c('0xb'));var crypto=require(_0xff2c('0xc'));var jsforce=require(_0xff2c('0xd'));var deskjs=require(_0xff2c('0xe'));var toCsv=require(_0xff2c('0x9'));var querystring=require(_0xff2c('0xf'));var Papa=require(_0xff2c('0x10'));var Redis=require('ioredis');var authService=require(_0xff2c('0x11'));var qs=require(_0xff2c('0x12'));var as=require(_0xff2c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff2c('0x14'))(_0xff2c('0x15'));var utils=require(_0xff2c('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xff2c('0x17'));var client=jayson[_0xff2c('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x345d78,_0x4f326b,_0x53c0e1){if(_0x53c0e1){var _0x8f8578=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8f8578[_0xff2c('0x19')](_0x4f326b)){return _0x345d78;}else{throw new db[(_0xff2c('0x1a'))][(_0xff2c('0x1b'))]('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 _0x345d78;}}function respondWithRpcPromise(_0x2b1f8e,_0x49b947,_0x40d03a,_0x2eb087){return new BPromise(function(_0x5de097,_0x4f53e2){var _0x53e6e1=_0x2eb087||client;return _0x53e6e1[_0xff2c('0x1c')](_0x2b1f8e,_0x40d03a)[_0xff2c('0x1d')](function(_0x2f77e7){logger[_0xff2c('0x1e')](_0xff2c('0x1f'),_0x49b947,_0xff2c('0x20'));logger[_0xff2c('0x21')](_0xff2c('0x22'),_0x49b947,_0xff2c('0x20'),JSON[_0xff2c('0x23')](_0x2f77e7));if(_0x2f77e7[_0xff2c('0x24')]){if(_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x25')]===0x1f4){logger[_0xff2c('0x24')](_0xff2c('0x1f'),_0x49b947,_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x26')]);return _0x4f53e2(_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x26')]);}logger[_0xff2c('0x24')](_0xff2c('0x1f'),_0x49b947,_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x26')]);return _0x5de097(_0x2f77e7[_0xff2c('0x24')]['message']);}else{logger[_0xff2c('0x1e')](_0xff2c('0x1f'),_0x49b947,_0xff2c('0x20'));_0x5de097(_0x2f77e7[_0xff2c('0x27')][_0xff2c('0x26')]);}})[_0xff2c('0x28')](function(_0x4539ef){logger['error'](_0xff2c('0x1f'),_0x49b947,_0x4539ef);_0x4f53e2(_0x4539ef);});});}function respondWithStatusCode(_0x29848e,_0x360ac2){_0x360ac2=_0x360ac2||0xcc;return function(_0x35f52e){if(_0x35f52e){return _0x29848e['sendStatus'](_0x360ac2);}return _0x29848e[_0xff2c('0x29')](_0x360ac2)[_0xff2c('0x2a')]();};}function respondWithResult(_0x3fd743,_0x46f7b3){_0x46f7b3=_0x46f7b3||0xc8;return function(_0x2eee77){if(_0x2eee77){return _0x3fd743[_0xff2c('0x29')](_0x46f7b3)['json'](_0x2eee77);}};}function respondWithFilteredResult(_0x2a20d6,_0x469bc2){return function(_0x4103f0){if(_0x4103f0){var _0x4d9ccb=_0x4103f0['count'],_0x59088e=_0x469bc2[_0xff2c('0x2b')],_0x3cbf3e=_0x469bc2['offset']+_0x469bc2['limit'],_0x2205f3;if(_0x3cbf3e>=_0x4d9ccb){_0x3cbf3e=_0x4d9ccb;_0x2205f3=0xc8;}else{_0x2205f3=0xce;}_0x2a20d6[_0xff2c('0x29')](_0x2205f3);return _0x2a20d6[_0xff2c('0x2c')](_0xff2c('0x2d'),_0x59088e+'-'+_0x3cbf3e+'/'+_0x4d9ccb)[_0xff2c('0x2e')](_0x4103f0);}return null;};}function patchUpdates(_0x1c95ad){return function(_0x39297f){try{jsonpatch['apply'](_0x39297f,_0x1c95ad,!![]);}catch(_0x311136){return BPromise[_0xff2c('0x2f')](_0x311136);}return _0x39297f[_0xff2c('0x30')]();};}function saveUpdates(_0x56361f,_0x1f6750){return function(_0x4e0278){if(_0x4e0278){return _0x4e0278[_0xff2c('0x31')](_0x56361f)[_0xff2c('0x1d')](function(_0x541045){return _0x541045;});}return null;};}function removeEntity(_0x4c4080,_0x59bb0a){return function(_0x558c25){if(_0x558c25){return _0x558c25[_0xff2c('0x32')]()[_0xff2c('0x1d')](function(){_0x4c4080[_0xff2c('0x29')](0xcc)[_0xff2c('0x2a')]();});}};}function handleEntityNotFound(_0x1d6827,_0x29c4bb){return function(_0x19dd26){if(!_0x19dd26){_0x1d6827[_0xff2c('0x33')](0x194);}return _0x19dd26;};}function handleError(_0x5e676c,_0x4733f0){_0x4733f0=_0x4733f0||0x1f4;return function(_0x17027a){logger[_0xff2c('0x24')](_0x17027a['stack']);if(_0x17027a[_0xff2c('0x34')]){delete _0x17027a[_0xff2c('0x34')];}_0x5e676c[_0xff2c('0x29')](_0x4733f0)[_0xff2c('0x35')](_0x17027a);};}exports[_0xff2c('0x36')]=function(_0x3f460c,_0xbd1d7f){var _0xcf181b={},_0x28b70c={},_0x4e6da7={'count':0x0,'rows':[]};var _0x54755e=_[_0xff2c('0x37')](db['DeskConfiguration'][_0xff2c('0x38')],function(_0x3ca73c){return{'name':_0x3ca73c[_0xff2c('0x39')],'type':_0x3ca73c['type'][_0xff2c('0x3a')]};});_0x28b70c['model']=_['map'](_0x54755e,_0xff2c('0x34'));_0x28b70c['query']=_[_0xff2c('0x3b')](_0x3f460c[_0xff2c('0x3c')]);_0x28b70c['filters']=_[_0xff2c('0x3d')](_0x28b70c[_0xff2c('0x3e')],_0x28b70c[_0xff2c('0x3c')]);_0xcf181b[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x28b70c[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x40')]));_0xcf181b[_0xff2c('0x3f')]=_0xcf181b[_0xff2c('0x3f')][_0xff2c('0x41')]?_0xcf181b[_0xff2c('0x3f')]:_0x28b70c[_0xff2c('0x3e')];if(!_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x42')](_0xff2c('0x43'))){_0xcf181b[_0xff2c('0x44')]=qs['limit'](_0x3f460c['query'][_0xff2c('0x44')]);_0xcf181b[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0x3f460c['query'][_0xff2c('0x2b')]);}_0xcf181b[_0xff2c('0x45')]=qs['sort'](_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x46')]);_0xcf181b['where']=qs[_0xff2c('0x47')](_[_0xff2c('0x48')](_0x3f460c[_0xff2c('0x3c')],_0x28b70c[_0xff2c('0x47')]),_0x54755e);if(_0x3f460c[_0xff2c('0x3c')]['filter']){_0xcf181b[_0xff2c('0x49')]=_[_0xff2c('0x4a')](_0xcf181b['where'],{'$or':_['map'](_0x54755e,function(_0x31d5cf){if(_0x31d5cf['type']!==_0xff2c('0x4b')){var _0x3c9fca={};_0x3c9fca[_0x31d5cf[_0xff2c('0x34')]]={'$like':'%'+_0x3f460c['query']['filter']+'%'};return _0x3c9fca;}})});}_0xcf181b=_[_0xff2c('0x4a')]({},_0xcf181b,_0x3f460c[_0xff2c('0x4c')]);var _0x3028bb={'where':_0xcf181b['where']};return db[_0xff2c('0x4d')]['count'](_0x3028bb)[_0xff2c('0x1d')](function(_0x5cb7e6){_0x4e6da7[_0xff2c('0x4e')]=_0x5cb7e6;if(_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x4f')]){_0xcf181b[_0xff2c('0x50')]=[{'all':!![]}];}return db[_0xff2c('0x4d')][_0xff2c('0x51')](_0xcf181b);})[_0xff2c('0x1d')](function(_0x2d7377){_0x4e6da7[_0xff2c('0x52')]=_0x2d7377;return _0x4e6da7;})[_0xff2c('0x1d')](respondWithFilteredResult(_0xbd1d7f,_0xcf181b))[_0xff2c('0x28')](handleError(_0xbd1d7f,null));};exports['show']=function(_0x5d5dca,_0x19fad3){var _0x1e1c17={'raw':![],'where':{'id':_0x5d5dca[_0xff2c('0x53')]['id']}},_0x2be4f0={};_0x2be4f0['model']=_[_0xff2c('0x3b')](db[_0xff2c('0x4d')]['rawAttributes']);_0x2be4f0[_0xff2c('0x3c')]=_[_0xff2c('0x3b')](_0x5d5dca['query']);_0x2be4f0[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x2be4f0['model'],_0x2be4f0['query']);_0x1e1c17['attributes']=_[_0xff2c('0x3d')](_0x2be4f0[_0xff2c('0x3e')],qs['fields'](_0x5d5dca[_0xff2c('0x3c')][_0xff2c('0x40')]));_0x1e1c17[_0xff2c('0x3f')]=_0x1e1c17[_0xff2c('0x3f')]['length']?_0x1e1c17['attributes']:_0x2be4f0[_0xff2c('0x3e')];if(_0x5d5dca[_0xff2c('0x3c')]['includeAll']){_0x1e1c17[_0xff2c('0x50')]=[{'all':!![]}];}_0x1e1c17=_[_0xff2c('0x4a')]({},_0x1e1c17,_0x5d5dca[_0xff2c('0x4c')]);return db[_0xff2c('0x4d')][_0xff2c('0x54')](_0x1e1c17)[_0xff2c('0x1d')](handleEntityNotFound(_0x19fad3,null))['then'](respondWithResult(_0x19fad3,null))[_0xff2c('0x28')](handleError(_0x19fad3,null));};exports[_0xff2c('0x55')]=function(_0x57aa63,_0x4d2481){return db['DeskConfiguration'][_0xff2c('0x55')](_0x57aa63['body'],{})[_0xff2c('0x1d')](respondWithResult(_0x4d2481,0xc9))[_0xff2c('0x28')](handleError(_0x4d2481,null));};exports[_0xff2c('0x31')]=function(_0x4d8976,_0x3fa0f8){if(_0x4d8976[_0xff2c('0x56')]['id']){delete _0x4d8976[_0xff2c('0x56')]['id'];}return db[_0xff2c('0x4d')][_0xff2c('0x54')]({'where':{'id':_0x4d8976[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x3fa0f8,null))['then'](saveUpdates(_0x4d8976['body'],null))['then'](respondWithResult(_0x3fa0f8,null))['catch'](handleError(_0x3fa0f8,null));};exports[_0xff2c('0x32')]=function(_0x310395,_0x32dbad){return db[_0xff2c('0x4d')][_0xff2c('0x54')]({'where':{'id':_0x310395[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x32dbad,null))['then'](removeEntity(_0x32dbad,null))[_0xff2c('0x28')](handleError(_0x32dbad,null));};exports[_0xff2c('0x57')]=function(_0xabea8,_0x53e836,_0x40e90c){var _0x2bbb14={};var _0x37ad80={};var _0x5b11dc;var _0x14c41b;return db[_0xff2c('0x4d')][_0xff2c('0x58')]({'where':{'id':_0xabea8[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x53e836,null))[_0xff2c('0x1d')](function(_0x19c93a){if(_0x19c93a){_0x5b11dc=_0x19c93a;_0x37ad80[_0xff2c('0x3e')]=_['keys'](db[_0xff2c('0x59')][_0xff2c('0x38')]);_0x37ad80['query']=_[_0xff2c('0x3b')](_0xabea8[_0xff2c('0x3c')]);_0x37ad80[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x37ad80[_0xff2c('0x3e')],_0x37ad80['query']);_0x2bbb14[_0xff2c('0x3f')]=_['intersection'](_0x37ad80[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0xabea8[_0xff2c('0x3c')][_0xff2c('0x40')]));_0x2bbb14['attributes']=_0x2bbb14['attributes'][_0xff2c('0x41')]?_0x2bbb14['attributes']:_0x37ad80['model'];_0x2bbb14[_0xff2c('0x45')]=qs[_0xff2c('0x46')](_0xabea8['query']['sort']);_0x2bbb14[_0xff2c('0x49')]=qs[_0xff2c('0x47')](_['pick'](_0xabea8[_0xff2c('0x3c')],_0x37ad80[_0xff2c('0x47')]));if(_0xabea8[_0xff2c('0x3c')][_0xff2c('0x5a')]){_0x2bbb14[_0xff2c('0x49')]=_['merge'](_0x2bbb14[_0xff2c('0x49')],{'$or':_[_0xff2c('0x37')](_0x2bbb14[_0xff2c('0x3f')],function(_0x388e8b){var _0x3697d3={};_0x3697d3[_0x388e8b]={'$like':'%'+_0xabea8[_0xff2c('0x3c')][_0xff2c('0x5a')]+'%'};return _0x3697d3;})});}_0x2bbb14=_['merge']({},_0x2bbb14,_0xabea8[_0xff2c('0x4c')]);return _0x5b11dc['getFields'](_0x2bbb14);}})['then'](function(_0x324949){if(_0x324949){_0x14c41b=_0x324949['length'];if(!_0xabea8['query'][_0xff2c('0x42')](_0xff2c('0x43'))){_0x2bbb14[_0xff2c('0x44')]=qs[_0xff2c('0x44')](_0xabea8[_0xff2c('0x3c')][_0xff2c('0x44')]);_0x2bbb14[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0xabea8[_0xff2c('0x3c')][_0xff2c('0x2b')]);}return _0x5b11dc[_0xff2c('0x57')](_0x2bbb14);}})[_0xff2c('0x1d')](function(_0x31b160){if(_0x31b160){return _0x31b160?{'count':_0x14c41b,'rows':_0x31b160}:null;}})[_0xff2c('0x1d')](respondWithResult(_0x53e836,null))[_0xff2c('0x28')](handleError(_0x53e836,null));};exports[_0xff2c('0x5b')]=function(_0x4040c4,_0x4c3719,_0x4ebe57){var _0x3f6251={};var _0x4273df={};var _0x28bc2b;var _0x21cc51;return db[_0xff2c('0x4d')]['findOne']({'where':{'id':_0x4040c4['params']['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x4c3719,null))[_0xff2c('0x1d')](function(_0x3d24f6){if(_0x3d24f6){_0x28bc2b=_0x3d24f6;_0x4273df[_0xff2c('0x3e')]=_[_0xff2c('0x3b')](db[_0xff2c('0x59')][_0xff2c('0x38')]);_0x4273df[_0xff2c('0x3c')]=_[_0xff2c('0x3b')](_0x4040c4[_0xff2c('0x3c')]);_0x4273df[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x4273df[_0xff2c('0x3e')],_0x4273df[_0xff2c('0x3c')]);_0x3f6251[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x4273df[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x4040c4[_0xff2c('0x3c')]['fields']));_0x3f6251[_0xff2c('0x3f')]=_0x3f6251[_0xff2c('0x3f')][_0xff2c('0x41')]?_0x3f6251[_0xff2c('0x3f')]:_0x4273df[_0xff2c('0x3e')];_0x3f6251['order']=qs[_0xff2c('0x46')](_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x46')]);_0x3f6251['where']=qs[_0xff2c('0x47')](_[_0xff2c('0x48')](_0x4040c4[_0xff2c('0x3c')],_0x4273df[_0xff2c('0x47')]));if(_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x5a')]){_0x3f6251[_0xff2c('0x49')]=_[_0xff2c('0x4a')](_0x3f6251['where'],{'$or':_['map'](_0x3f6251[_0xff2c('0x3f')],function(_0xc92fdc){var _0x4f65a7={};_0x4f65a7[_0xc92fdc]={'$like':'%'+_0x4040c4['query'][_0xff2c('0x5a')]+'%'};return _0x4f65a7;})});}_0x3f6251=_[_0xff2c('0x4a')]({},_0x3f6251,_0x4040c4['options']);return _0x28bc2b[_0xff2c('0x5b')](_0x3f6251);}})[_0xff2c('0x1d')](function(_0x509782){if(_0x509782){_0x21cc51=_0x509782[_0xff2c('0x41')];if(!_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x42')](_0xff2c('0x43'))){_0x3f6251['limit']=qs[_0xff2c('0x44')](_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x44')]);_0x3f6251[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0x4040c4['query']['offset']);}return _0x28bc2b[_0xff2c('0x5b')](_0x3f6251);}})[_0xff2c('0x1d')](function(_0x31b9cf){if(_0x31b9cf){return _0x31b9cf?{'count':_0x21cc51,'rows':_0x31b9cf}:null;}})['then'](respondWithResult(_0x4c3719,null))[_0xff2c('0x28')](handleError(_0x4c3719,null));};exports[_0xff2c('0x5c')]=function(_0x2ce922,_0x1367fd,_0x596fe5){var _0x500d2d={};var _0x3f644e={};var _0x4b8777;var _0x3b6f53;return db[_0xff2c('0x4d')]['findOne']({'where':{'id':_0x2ce922[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x1367fd,null))[_0xff2c('0x1d')](function(_0x519804){if(_0x519804){_0x4b8777=_0x519804;_0x3f644e[_0xff2c('0x3e')]=_[_0xff2c('0x3b')](db['DeskField'][_0xff2c('0x38')]);_0x3f644e['query']=_[_0xff2c('0x3b')](_0x2ce922[_0xff2c('0x3c')]);_0x3f644e[_0xff2c('0x47')]=_['intersection'](_0x3f644e[_0xff2c('0x3e')],_0x3f644e[_0xff2c('0x3c')]);_0x500d2d[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x3f644e[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x2ce922[_0xff2c('0x3c')]['fields']));_0x500d2d[_0xff2c('0x3f')]=_0x500d2d[_0xff2c('0x3f')][_0xff2c('0x41')]?_0x500d2d['attributes']:_0x3f644e[_0xff2c('0x3e')];_0x500d2d[_0xff2c('0x45')]=qs[_0xff2c('0x46')](_0x2ce922[_0xff2c('0x3c')][_0xff2c('0x46')]);_0x500d2d[_0xff2c('0x49')]=qs[_0xff2c('0x47')](_[_0xff2c('0x48')](_0x2ce922[_0xff2c('0x3c')],_0x3f644e['filters']));if(_0x2ce922[_0xff2c('0x3c')][_0xff2c('0x5a')]){_0x500d2d[_0xff2c('0x49')]=_['merge'](_0x500d2d[_0xff2c('0x49')],{'$or':_['map'](_0x500d2d[_0xff2c('0x3f')],function(_0x729371){var _0x1058df={};_0x1058df[_0x729371]={'$like':'%'+_0x2ce922[_0xff2c('0x3c')][_0xff2c('0x5a')]+'%'};return _0x1058df;})});}_0x500d2d=_[_0xff2c('0x4a')]({},_0x500d2d,_0x2ce922[_0xff2c('0x4c')]);return _0x4b8777[_0xff2c('0x5c')](_0x500d2d);}})[_0xff2c('0x1d')](function(_0xe93b60){if(_0xe93b60){_0x3b6f53=_0xe93b60[_0xff2c('0x41')];if(!_0x2ce922[_0xff2c('0x3c')]['hasOwnProperty'](_0xff2c('0x43'))){_0x500d2d[_0xff2c('0x44')]=qs[_0xff2c('0x44')](_0x2ce922['query'][_0xff2c('0x44')]);_0x500d2d[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0x2ce922['query']['offset']);}return _0x4b8777[_0xff2c('0x5c')](_0x500d2d);}})[_0xff2c('0x1d')](function(_0x156e55){if(_0x156e55){return _0x156e55?{'count':_0x3b6f53,'rows':_0x156e55}:null;}})[_0xff2c('0x1d')](respondWithResult(_0x1367fd,null))[_0xff2c('0x28')](handleError(_0x1367fd,null));};exports[_0xff2c('0x5d')]=function(_0x55339c,_0x32aefb,_0x168c89){var _0x2ae100={};var _0x46ec63={};var _0x3e90dc;var _0x560707;return db[_0xff2c('0x4d')][_0xff2c('0x58')]({'where':{'id':_0x55339c[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x32aefb,null))[_0xff2c('0x1d')](function(_0x1a7d80){if(_0x1a7d80){_0x3e90dc=_0x1a7d80;_0x46ec63[_0xff2c('0x3e')]=_['keys'](db[_0xff2c('0x5e')][_0xff2c('0x38')]);_0x46ec63[_0xff2c('0x3c')]=_['keys'](_0x55339c[_0xff2c('0x3c')]);_0x46ec63[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x46ec63['model'],_0x46ec63['query']);_0x2ae100[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x46ec63[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x55339c['query'][_0xff2c('0x40')]));_0x2ae100[_0xff2c('0x3f')]=_0x2ae100[_0xff2c('0x3f')][_0xff2c('0x41')]?_0x2ae100[_0xff2c('0x3f')]:_0x46ec63[_0xff2c('0x3e')];_0x2ae100[_0xff2c('0x45')]=qs[_0xff2c('0x46')](_0x55339c['query'][_0xff2c('0x46')]);_0x2ae100[_0xff2c('0x49')]=qs['filters'](_[_0xff2c('0x48')](_0x55339c[_0xff2c('0x3c')],_0x46ec63[_0xff2c('0x47')]));if(_0x55339c['query'][_0xff2c('0x5a')]){_0x2ae100[_0xff2c('0x49')]=_[_0xff2c('0x4a')](_0x2ae100['where'],{'$or':_['map'](_0x2ae100[_0xff2c('0x3f')],function(_0x2c4d25){var _0x450a5e={};_0x450a5e[_0x2c4d25]={'$like':'%'+_0x55339c[_0xff2c('0x3c')][_0xff2c('0x5a')]+'%'};return _0x450a5e;})});}_0x2ae100=_[_0xff2c('0x4a')]({},_0x2ae100,_0x55339c[_0xff2c('0x4c')]);return _0x3e90dc[_0xff2c('0x5d')](_0x2ae100);}})['then'](function(_0x53f73e){if(_0x53f73e){_0x560707=_0x53f73e['length'];if(!_0x55339c[_0xff2c('0x3c')]['hasOwnProperty'](_0xff2c('0x43'))){_0x2ae100['limit']=qs['limit'](_0x55339c[_0xff2c('0x3c')][_0xff2c('0x44')]);_0x2ae100[_0xff2c('0x2b')]=qs['offset'](_0x55339c[_0xff2c('0x3c')][_0xff2c('0x2b')]);}return _0x3e90dc[_0xff2c('0x5d')](_0x2ae100);}})[_0xff2c('0x1d')](function(_0x3e7a17){if(_0x3e7a17){return _0x3e7a17?{'count':_0x560707,'rows':_0x3e7a17}:null;}})[_0xff2c('0x1d')](respondWithResult(_0x32aefb,null))[_0xff2c('0x28')](handleError(_0x32aefb,null));};exports[_0xff2c('0x5f')]=function(_0x32571d,_0x14faa9,_0x2b7a89){if(_0x32571d[_0xff2c('0x56')]['id']){delete _0x32571d[_0xff2c('0x56')]['id'];}return db[_0xff2c('0x4d')][_0xff2c('0x58')]({'where':{'id':_0x32571d[_0xff2c('0x53')]['id']}})['then'](handleEntityNotFound(_0x14faa9,null))[_0xff2c('0x1d')](function(_0x4f0152){if(_0x4f0152){return _0x4f0152[_0xff2c('0x5f')](_0x32571d[_0xff2c('0x56')][_0xff2c('0x60')]||[]);}return null;})[_0xff2c('0x1d')](respondWithResult(_0x14faa9,null))[_0xff2c('0x28')](handleError(_0x14faa9,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 694d630..dd0e55f 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 _0x7079=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','DeskConfiguration'];(function(_0x32d8f6,_0x153146){var _0x4d6740=function(_0x5e41a6){while(--_0x5e41a6){_0x32d8f6['push'](_0x32d8f6['shift']());}};_0x4d6740(++_0x153146);}(_0x7079,0xc6));var _0x9707=function(_0x23e21d,_0x536179){_0x23e21d=_0x23e21d-0x0;var _0x36439f=_0x7079[_0x23e21d];return _0x36439f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9707('0x0'))(_0x9707('0x1'));var moment=require(_0x9707('0x2'));var BPromise=require(_0x9707('0x3'));var rp=require(_0x9707('0x4'));var fs=require('fs');var path=require(_0x9707('0x5'));var rimraf=require('rimraf');var config=require(_0x9707('0x6'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x2fc159,_0x3443ca){return _0x2fc159[_0x9707('0x7')](_0x9707('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x341f=['moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x3f326d,_0x22c06d){var _0x24bc71=function(_0x2fdc4b){while(--_0x2fdc4b){_0x3f326d['push'](_0x3f326d['shift']());}};_0x24bc71(++_0x22c06d);}(_0x341f,0xed));var _0xf341=function(_0x243ecc,_0x26f0b5){_0x243ecc=_0x243ecc-0x0;var _0x3f0eb2=_0x341f[_0x243ecc];return _0x3f0eb2;};'use strict';var _=require(_0xf341('0x0'));var util=require(_0xf341('0x1'));var logger=require(_0xf341('0x2'))('api');var moment=require(_0xf341('0x3'));var BPromise=require(_0xf341('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf341('0x5'));var rimraf=require(_0xf341('0x6'));var config=require('../../config/environment');var attributes=require(_0xf341('0x7'));module['exports']=function(_0x5505d8,_0x5b7838){return _0x5505d8['define'](_0xf341('0x8'),attributes,{'tableName':_0xf341('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 1fb0e07..e0b7a0e 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 _0x25b5=['info','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then'];(function(_0xe7614d,_0x5d1444){var _0x3fe806=function(_0x5d4498){while(--_0x5d4498){_0xe7614d['push'](_0xe7614d['shift']());}};_0x3fe806(++_0x5d1444);}(_0x25b5,0x198));var _0x525b=function(_0x9f82ee,_0x4253ae){_0x9f82ee=_0x9f82ee-0x0;var _0xf5092d=_0x25b5[_0x9f82ee];return _0xf5092d;};'use strict';var _=require(_0x525b('0x0'));var util=require(_0x525b('0x1'));var moment=require(_0x525b('0x2'));var BPromise=require(_0x525b('0x3'));var rs=require(_0x525b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x525b('0x5'))['db'];var utils=require(_0x525b('0x6'));var logger=require(_0x525b('0x7'))(_0x525b('0x8'));var config=require(_0x525b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x525b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x511ef5,_0x4d6f5b,_0x17b475){return new BPromise(function(_0x3ef6f1,_0x1656ac){return client['request'](_0x511ef5,_0x17b475)[_0x525b('0xb')](function(_0x1b2d14){logger[_0x525b('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x4d6f5b,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4d6f5b,_0x525b('0xd'),JSON[_0x525b('0xe')](_0x1b2d14));if(_0x1b2d14['error']){if(_0x1b2d14[_0x525b('0xf')][_0x525b('0x10')]===0x1f4){logger[_0x525b('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x4d6f5b,_0x1b2d14['error'][_0x525b('0x11')]);return _0x1656ac(_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);}logger[_0x525b('0xf')](_0x525b('0x12'),_0x4d6f5b,_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);return _0x3ef6f1(_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);}else{logger[_0x525b('0xc')](_0x525b('0x12'),_0x4d6f5b,'request\x20sent');_0x3ef6f1(_0x1b2d14[_0x525b('0x13')][_0x525b('0x11')]);}})[_0x525b('0x14')](function(_0x4d523f){logger['error'](_0x525b('0x12'),_0x4d6f5b,_0x4d523f);_0x1656ac(_0x4d523f);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x2e5092,_0x20ff6b){var _0x12ad15=function(_0x549449){while(--_0x549449){_0x2e5092['push'](_0x2e5092['shift']());}};_0x12ad15(++_0x20ff6b);}(_0x96cc,0x16c));var _0xc96c=function(_0x4fcabf,_0x3536af){_0x4fcabf=_0x4fcabf-0x0;var _0xe9651=_0x96cc[_0x4fcabf];return _0xe9651;};'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')]('DeskConfiguration,\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']('DeskConfiguration,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7b9b049..44cabb2 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 _0xde81=['../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x202b8e,_0xd9f859){var _0x3beb83=function(_0xefda90){while(--_0xefda90){_0x202b8e['push'](_0x202b8e['shift']());}};_0x3beb83(++_0xd9f859);}(_0xde81,0x1ee));var _0x1de8=function(_0x3f2327,_0x234948){_0x3f2327=_0x3f2327-0x0;var _0x34c873=_0xde81[_0x3f2327];return _0x34c873;};'use strict';var multer=require(_0x1de8('0x0'));var util=require(_0x1de8('0x1'));var path=require(_0x1de8('0x2'));var timeout=require(_0x1de8('0x3'));var express=require(_0x1de8('0x4'));var router=express[_0x1de8('0x5')]();var auth=require(_0x1de8('0x6'));var interaction=require(_0x1de8('0x7'));var config=require('../../config/environment');var controller=require(_0x1de8('0x8'));router[_0x1de8('0x9')]('/',auth[_0x1de8('0xa')](),controller[_0x1de8('0xb')]);router[_0x1de8('0x9')](_0x1de8('0xc'),auth['isAuthenticated'](),controller[_0x1de8('0xd')]);router[_0x1de8('0xe')]('/',auth[_0x1de8('0xa')](),controller[_0x1de8('0xf')]);router[_0x1de8('0x10')](_0x1de8('0xc'),auth[_0x1de8('0xa')](),controller['update']);router[_0x1de8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1de8('0x12')]);module[_0x1de8('0x13')]=router; \ No newline at end of file +var _0xf336=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports','multer','util'];(function(_0x4176f8,_0x4116bf){var _0x5195ff=function(_0x5bbf94){while(--_0x5bbf94){_0x4176f8['push'](_0x4176f8['shift']());}};_0x5195ff(++_0x4116bf);}(_0xf336,0xc4));var _0x6f33=function(_0x152636,_0x312792){_0x152636=_0x152636-0x0;var _0x4d367f=_0xf336[_0x152636];return _0x4d367f;};'use strict';var multer=require(_0x6f33('0x0'));var util=require(_0x6f33('0x1'));var path=require(_0x6f33('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f33('0x3'));var router=express[_0x6f33('0x4')]();var auth=require(_0x6f33('0x5'));var interaction=require(_0x6f33('0x6'));var config=require(_0x6f33('0x7'));var controller=require(_0x6f33('0x8'));router[_0x6f33('0x9')]('/',auth[_0x6f33('0xa')](),controller[_0x6f33('0xb')]);router[_0x6f33('0x9')](_0x6f33('0xc'),auth[_0x6f33('0xa')](),controller[_0x6f33('0xd')]);router['post']('/',auth[_0x6f33('0xa')](),controller[_0x6f33('0xe')]);router[_0x6f33('0xf')]('/:id',auth[_0x6f33('0xa')](),controller[_0x6f33('0x10')]);router['delete']('/:id',auth[_0x6f33('0xa')](),controller['destroy']);module[_0x6f33('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f86e12a..ccde2a8 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 _0x1a3d=['sequelize','ENUM','variable','customVariable','STRING'];(function(_0x18abb4,_0x198b51){var _0x5c0758=function(_0x496ec1){while(--_0x496ec1){_0x18abb4['push'](_0x18abb4['shift']());}};_0x5c0758(++_0x198b51);}(_0x1a3d,0x181));var _0xd1a3=function(_0x4fb01a,_0x376996){_0x4fb01a=_0x4fb01a-0x0;var _0x2ea01d=_0x1a3d[_0x4fb01a];return _0x2ea01d;};'use strict';var Sequelize=require(_0xd1a3('0x0'));module['exports']={'type':{'type':Sequelize[_0xd1a3('0x1')]('string',_0xd1a3('0x2'),_0xd1a3('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd1a3('0x4')]},'key':{'type':Sequelize[_0xd1a3('0x4')]},'keyType':{'type':Sequelize[_0xd1a3('0x1')]('string',_0xd1a3('0x2'),_0xd1a3('0x3'))},'keyContent':{'type':Sequelize[_0xd1a3('0x4')]},'idField':{'type':Sequelize[_0xd1a3('0x4')]},'nameField':{'type':Sequelize[_0xd1a3('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd1a3('0x4')]}}; \ No newline at end of file +var _0x0901=['BOOLEAN','sequelize','exports','ENUM','variable','string','STRING','customVariable'];(function(_0x150b5b,_0xd0a505){var _0x1930d8=function(_0x311623){while(--_0x311623){_0x150b5b['push'](_0x150b5b['shift']());}};_0x1930d8(++_0xd0a505);}(_0x0901,0xd9));var _0x1090=function(_0x35a432,_0x5a1879){_0x35a432=_0x35a432-0x0;var _0x1490d4=_0x0901[_0x35a432];return _0x1490d4;};'use strict';var Sequelize=require(_0x1090('0x0'));module[_0x1090('0x1')]={'type':{'type':Sequelize[_0x1090('0x2')]('string',_0x1090('0x3'),'customVariable','keyValue'),'defaultValue':_0x1090('0x4')},'content':{'type':Sequelize[_0x1090('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1090('0x2')](_0x1090('0x4'),'variable',_0x1090('0x6'))},'keyContent':{'type':Sequelize[_0x1090('0x5')]},'idField':{'type':Sequelize[_0x1090('0x5')]},'nameField':{'type':Sequelize[_0x1090('0x5')]},'customField':{'type':Sequelize[_0x1090('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1174d7d..94aa040 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 _0x6a4d=['options','count','includeAll','include','rows','show','params','keys','find','catch','create','body','html-pdf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL'];(function(_0x284f42,_0x14ca71){var _0xf66221=function(_0x26bd9f){while(--_0x26bd9f){_0x284f42['push'](_0x284f42['shift']());}};_0xf66221(++_0x14ca71);}(_0x6a4d,0xe7));var _0xd6a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a4d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd6a4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6a4('0x1'));var moment=require('moment');var BPromise=require(_0xd6a4('0x2'));var Mustache=require(_0xd6a4('0x3'));var util=require(_0xd6a4('0x4'));var path=require(_0xd6a4('0x5'));var sox=require(_0xd6a4('0x6'));var csv=require('to-csv');var ejs=require(_0xd6a4('0x7'));var fs=require('fs');var _=require(_0xd6a4('0x8'));var squel=require(_0xd6a4('0x9'));var crypto=require(_0xd6a4('0xa'));var jsforce=require(_0xd6a4('0xb'));var deskjs=require(_0xd6a4('0xc'));var toCsv=require(_0xd6a4('0xd'));var querystring=require(_0xd6a4('0xe'));var Papa=require(_0xd6a4('0xf'));var Redis=require(_0xd6a4('0x10'));var authService=require(_0xd6a4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd6a4('0x12'));var hardwareService=require(_0xd6a4('0x13'));var logger=require(_0xd6a4('0x14'))(_0xd6a4('0x15'));var utils=require('../../config/utils');var config=require(_0xd6a4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b9b97,_0x4d9a6a){_0x4d9a6a=_0x4d9a6a||0xcc;return function(_0x5bf9f7){if(_0x5bf9f7){return _0x4b9b97[_0xd6a4('0x17')](_0x4d9a6a);}return _0x4b9b97['status'](_0x4d9a6a)['end']();};}function respondWithResult(_0x302a8a,_0x2d3f1c){_0x2d3f1c=_0x2d3f1c||0xc8;return function(_0x2d6f04){if(_0x2d6f04){return _0x302a8a[_0xd6a4('0x18')](_0x2d3f1c)['json'](_0x2d6f04);}};}function respondWithFilteredResult(_0x3c5116,_0x30cd29){return function(_0x3076b1){if(_0x3076b1){var _0x54ada3=_0x3076b1['count'],_0x47b3d5=_0x30cd29[_0xd6a4('0x19')],_0x165e3e=_0x30cd29[_0xd6a4('0x19')]+_0x30cd29[_0xd6a4('0x1a')],_0x3535ca;if(_0x165e3e>=_0x54ada3){_0x165e3e=_0x54ada3;_0x3535ca=0xc8;}else{_0x3535ca=0xce;}_0x3c5116[_0xd6a4('0x18')](_0x3535ca);return _0x3c5116[_0xd6a4('0x1b')](_0xd6a4('0x1c'),_0x47b3d5+'-'+_0x165e3e+'/'+_0x54ada3)['json'](_0x3076b1);}return null;};}function patchUpdates(_0xa99c39){return function(_0x17cf06){try{jsonpatch[_0xd6a4('0x1d')](_0x17cf06,_0xa99c39,!![]);}catch(_0x48c26c){return BPromise[_0xd6a4('0x1e')](_0x48c26c);}return _0x17cf06[_0xd6a4('0x1f')]();};}function saveUpdates(_0x8185d9,_0x53fcff){return function(_0x212bfc){if(_0x212bfc){return _0x212bfc[_0xd6a4('0x20')](_0x8185d9)[_0xd6a4('0x21')](function(_0xf3cee7){return _0xf3cee7;});}return null;};}function removeEntity(_0x26b1d6,_0x3bdf26){return function(_0x5772d3){if(_0x5772d3){return _0x5772d3[_0xd6a4('0x22')]()[_0xd6a4('0x21')](function(){_0x26b1d6[_0xd6a4('0x18')](0xcc)[_0xd6a4('0x23')]();});}};}function handleEntityNotFound(_0x448cf0,_0x97285a){return function(_0x4ea873){if(!_0x4ea873){_0x448cf0[_0xd6a4('0x17')](0x194);}return _0x4ea873;};}function handleError(_0x229133,_0x3a0e04){_0x3a0e04=_0x3a0e04||0x1f4;return function(_0x1c39cf){logger[_0xd6a4('0x24')](_0x1c39cf[_0xd6a4('0x25')]);if(_0x1c39cf['name']){delete _0x1c39cf[_0xd6a4('0x26')];}_0x229133[_0xd6a4('0x18')](_0x3a0e04)[_0xd6a4('0x27')](_0x1c39cf);};}exports['index']=function(_0x31f17f,_0x40aa91){var _0xdb73d7={},_0x73c149={},_0xfec479={'count':0x0,'rows':[]};var _0x8642ea=_['map'](db[_0xd6a4('0x28')][_0xd6a4('0x29')],function(_0x57d7e6){return{'name':_0x57d7e6[_0xd6a4('0x2a')],'type':_0x57d7e6[_0xd6a4('0x2b')][_0xd6a4('0x2c')]};});_0x73c149[_0xd6a4('0x2d')]=_['map'](_0x8642ea,'name');_0x73c149['query']=_['keys'](_0x31f17f[_0xd6a4('0x2e')]);_0x73c149['filters']=_[_0xd6a4('0x2f')](_0x73c149[_0xd6a4('0x2d')],_0x73c149['query']);_0xdb73d7[_0xd6a4('0x30')]=_[_0xd6a4('0x2f')](_0x73c149[_0xd6a4('0x2d')],qs['fields'](_0x31f17f[_0xd6a4('0x2e')][_0xd6a4('0x31')]));_0xdb73d7[_0xd6a4('0x30')]=_0xdb73d7[_0xd6a4('0x30')][_0xd6a4('0x32')]?_0xdb73d7['attributes']:_0x73c149[_0xd6a4('0x2d')];if(!_0x31f17f['query']['hasOwnProperty'](_0xd6a4('0x33'))){_0xdb73d7[_0xd6a4('0x1a')]=qs['limit'](_0x31f17f[_0xd6a4('0x2e')][_0xd6a4('0x1a')]);_0xdb73d7[_0xd6a4('0x19')]=qs[_0xd6a4('0x19')](_0x31f17f[_0xd6a4('0x2e')][_0xd6a4('0x19')]);}_0xdb73d7[_0xd6a4('0x34')]=qs[_0xd6a4('0x35')](_0x31f17f[_0xd6a4('0x2e')][_0xd6a4('0x35')]);_0xdb73d7[_0xd6a4('0x36')]=qs[_0xd6a4('0x37')](_[_0xd6a4('0x38')](_0x31f17f['query'],_0x73c149[_0xd6a4('0x37')]),_0x8642ea);if(_0x31f17f[_0xd6a4('0x2e')][_0xd6a4('0x39')]){_0xdb73d7[_0xd6a4('0x36')]=_[_0xd6a4('0x3a')](_0xdb73d7[_0xd6a4('0x36')],{'$or':_[_0xd6a4('0x3b')](_0x8642ea,function(_0x220eee){if(_0x220eee[_0xd6a4('0x2b')]!==_0xd6a4('0x3c')){var _0x512b99={};_0x512b99[_0x220eee[_0xd6a4('0x26')]]={'$like':'%'+_0x31f17f['query']['filter']+'%'};return _0x512b99;}})});}_0xdb73d7=_[_0xd6a4('0x3a')]({},_0xdb73d7,_0x31f17f[_0xd6a4('0x3d')]);var _0x13a0b9={'where':_0xdb73d7[_0xd6a4('0x36')]};return db['DeskField']['count'](_0x13a0b9)['then'](function(_0x5bfc06){_0xfec479[_0xd6a4('0x3e')]=_0x5bfc06;if(_0x31f17f[_0xd6a4('0x2e')][_0xd6a4('0x3f')]){_0xdb73d7[_0xd6a4('0x40')]=[{'all':!![]}];}return db[_0xd6a4('0x28')]['findAll'](_0xdb73d7);})[_0xd6a4('0x21')](function(_0x488b4e){_0xfec479[_0xd6a4('0x41')]=_0x488b4e;return _0xfec479;})[_0xd6a4('0x21')](respondWithFilteredResult(_0x40aa91,_0xdb73d7))['catch'](handleError(_0x40aa91,null));};exports[_0xd6a4('0x42')]=function(_0x4f550d,_0x560dba){var _0x2e8d65={'raw':!![],'where':{'id':_0x4f550d[_0xd6a4('0x43')]['id']}},_0x5de4a0={};_0x5de4a0[_0xd6a4('0x2d')]=_[_0xd6a4('0x44')](db[_0xd6a4('0x28')][_0xd6a4('0x29')]);_0x5de4a0[_0xd6a4('0x2e')]=_[_0xd6a4('0x44')](_0x4f550d['query']);_0x5de4a0[_0xd6a4('0x37')]=_[_0xd6a4('0x2f')](_0x5de4a0[_0xd6a4('0x2d')],_0x5de4a0[_0xd6a4('0x2e')]);_0x2e8d65[_0xd6a4('0x30')]=_[_0xd6a4('0x2f')](_0x5de4a0['model'],qs[_0xd6a4('0x31')](_0x4f550d['query']['fields']));_0x2e8d65[_0xd6a4('0x30')]=_0x2e8d65['attributes']['length']?_0x2e8d65[_0xd6a4('0x30')]:_0x5de4a0[_0xd6a4('0x2d')];if(_0x4f550d['query'][_0xd6a4('0x3f')]){_0x2e8d65[_0xd6a4('0x40')]=[{'all':!![]}];}_0x2e8d65=_[_0xd6a4('0x3a')]({},_0x2e8d65,_0x4f550d[_0xd6a4('0x3d')]);return db[_0xd6a4('0x28')][_0xd6a4('0x45')](_0x2e8d65)[_0xd6a4('0x21')](handleEntityNotFound(_0x560dba,null))['then'](respondWithResult(_0x560dba,null))[_0xd6a4('0x46')](handleError(_0x560dba,null));};exports[_0xd6a4('0x47')]=function(_0x12913b,_0x38a58a){return db['DeskField']['create'](_0x12913b['body'],{})[_0xd6a4('0x21')](respondWithResult(_0x38a58a,0xc9))[_0xd6a4('0x46')](handleError(_0x38a58a,null));};exports[_0xd6a4('0x20')]=function(_0x3b5c0b,_0x2459b3){if(_0x3b5c0b[_0xd6a4('0x48')]['id']){delete _0x3b5c0b[_0xd6a4('0x48')]['id'];}return db['DeskField']['find']({'where':{'id':_0x3b5c0b[_0xd6a4('0x43')]['id']}})[_0xd6a4('0x21')](handleEntityNotFound(_0x2459b3,null))[_0xd6a4('0x21')](saveUpdates(_0x3b5c0b[_0xd6a4('0x48')],null))[_0xd6a4('0x21')](respondWithResult(_0x2459b3,null))['catch'](handleError(_0x2459b3,null));};exports[_0xd6a4('0x22')]=function(_0xe094fc,_0x29cbfd){return db[_0xd6a4('0x28')][_0xd6a4('0x45')]({'where':{'id':_0xe094fc['params']['id']}})[_0xd6a4('0x21')](handleEntityNotFound(_0x29cbfd,null))['then'](removeEntity(_0x29cbfd,null))['catch'](handleError(_0x29cbfd,null));}; \ No newline at end of file +var _0x9ba7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','DeskField','findAll','rows','catch','show','params','keys','find','body','destroy','html-pdf'];(function(_0x3b4f0e,_0x1a607a){var _0x1d40ba=function(_0x5683a2){while(--_0x5683a2){_0x3b4f0e['push'](_0x3b4f0e['shift']());}};_0x1d40ba(++_0x1a607a);}(_0x9ba7,0xdd));var _0x79ba=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x9ba7[_0x2c2980];return _0x2a20a9;};'use strict';var pdf=require(_0x79ba('0x0'));var emlformat=require(_0x79ba('0x1'));var rimraf=require(_0x79ba('0x2'));var zipdir=require(_0x79ba('0x3'));var jsonpatch=require(_0x79ba('0x4'));var rp=require(_0x79ba('0x5'));var moment=require('moment');var BPromise=require(_0x79ba('0x6'));var Mustache=require(_0x79ba('0x7'));var util=require(_0x79ba('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x79ba('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x79ba('0xa'));var crypto=require(_0x79ba('0xb'));var jsforce=require(_0x79ba('0xc'));var deskjs=require(_0x79ba('0xd'));var toCsv=require(_0x79ba('0x9'));var querystring=require(_0x79ba('0xe'));var Papa=require('papaparse');var Redis=require(_0x79ba('0xf'));var authService=require(_0x79ba('0x10'));var qs=require(_0x79ba('0x11'));var as=require(_0x79ba('0x12'));var hardwareService=require(_0x79ba('0x13'));var logger=require(_0x79ba('0x14'))(_0x79ba('0x15'));var utils=require(_0x79ba('0x16'));var config=require('../../config/environment');var db=require(_0x79ba('0x17'))['db'];function respondWithStatusCode(_0x2eae4b,_0x53a47d){_0x53a47d=_0x53a47d||0xcc;return function(_0x274b4d){if(_0x274b4d){return _0x2eae4b[_0x79ba('0x18')](_0x53a47d);}return _0x2eae4b[_0x79ba('0x19')](_0x53a47d)[_0x79ba('0x1a')]();};}function respondWithResult(_0x2264f3,_0x4e9dba){_0x4e9dba=_0x4e9dba||0xc8;return function(_0x284fd6){if(_0x284fd6){return _0x2264f3[_0x79ba('0x19')](_0x4e9dba)[_0x79ba('0x1b')](_0x284fd6);}};}function respondWithFilteredResult(_0x301dd5,_0x301473){return function(_0x25eb9e){if(_0x25eb9e){var _0x136988=_0x25eb9e[_0x79ba('0x1c')],_0x355c36=_0x301473[_0x79ba('0x1d')],_0x5a4b62=_0x301473[_0x79ba('0x1d')]+_0x301473[_0x79ba('0x1e')],_0x37307f;if(_0x5a4b62>=_0x136988){_0x5a4b62=_0x136988;_0x37307f=0xc8;}else{_0x37307f=0xce;}_0x301dd5[_0x79ba('0x19')](_0x37307f);return _0x301dd5[_0x79ba('0x1f')](_0x79ba('0x20'),_0x355c36+'-'+_0x5a4b62+'/'+_0x136988)[_0x79ba('0x1b')](_0x25eb9e);}return null;};}function patchUpdates(_0x190d0e){return function(_0x52b104){try{jsonpatch[_0x79ba('0x21')](_0x52b104,_0x190d0e,!![]);}catch(_0x2a459a){return BPromise[_0x79ba('0x22')](_0x2a459a);}return _0x52b104[_0x79ba('0x23')]();};}function saveUpdates(_0x100ebc,_0x5a665f){return function(_0x359746){if(_0x359746){return _0x359746[_0x79ba('0x24')](_0x100ebc)[_0x79ba('0x25')](function(_0x2c4435){return _0x2c4435;});}return null;};}function removeEntity(_0x4e9c4a,_0x11582f){return function(_0x371970){if(_0x371970){return _0x371970['destroy']()['then'](function(){_0x4e9c4a[_0x79ba('0x19')](0xcc)[_0x79ba('0x1a')]();});}};}function handleEntityNotFound(_0x365ee8,_0x523f0c){return function(_0x367e00){if(!_0x367e00){_0x365ee8[_0x79ba('0x18')](0x194);}return _0x367e00;};}function handleError(_0x52fa4a,_0x1fa6a3){_0x1fa6a3=_0x1fa6a3||0x1f4;return function(_0x16f0e9){logger[_0x79ba('0x26')](_0x16f0e9[_0x79ba('0x27')]);if(_0x16f0e9[_0x79ba('0x28')]){delete _0x16f0e9['name'];}_0x52fa4a[_0x79ba('0x19')](_0x1fa6a3)[_0x79ba('0x29')](_0x16f0e9);};}exports[_0x79ba('0x2a')]=function(_0xdb1a03,_0x4553d9){var _0x192b57={},_0x2f5e92={},_0x21da92={'count':0x0,'rows':[]};var _0x22797e=_[_0x79ba('0x2b')](db['DeskField'][_0x79ba('0x2c')],function(_0x5a178e){return{'name':_0x5a178e[_0x79ba('0x2d')],'type':_0x5a178e[_0x79ba('0x2e')][_0x79ba('0x2f')]};});_0x2f5e92[_0x79ba('0x30')]=_[_0x79ba('0x2b')](_0x22797e,_0x79ba('0x28'));_0x2f5e92[_0x79ba('0x31')]=_['keys'](_0xdb1a03[_0x79ba('0x31')]);_0x2f5e92[_0x79ba('0x32')]=_[_0x79ba('0x33')](_0x2f5e92[_0x79ba('0x30')],_0x2f5e92[_0x79ba('0x31')]);_0x192b57[_0x79ba('0x34')]=_[_0x79ba('0x33')](_0x2f5e92[_0x79ba('0x30')],qs[_0x79ba('0x35')](_0xdb1a03[_0x79ba('0x31')]['fields']));_0x192b57[_0x79ba('0x34')]=_0x192b57['attributes'][_0x79ba('0x36')]?_0x192b57[_0x79ba('0x34')]:_0x2f5e92['model'];if(!_0xdb1a03[_0x79ba('0x31')][_0x79ba('0x37')]('nolimit')){_0x192b57[_0x79ba('0x1e')]=qs[_0x79ba('0x1e')](_0xdb1a03['query']['limit']);_0x192b57[_0x79ba('0x1d')]=qs[_0x79ba('0x1d')](_0xdb1a03[_0x79ba('0x31')]['offset']);}_0x192b57[_0x79ba('0x38')]=qs[_0x79ba('0x39')](_0xdb1a03['query'][_0x79ba('0x39')]);_0x192b57[_0x79ba('0x3a')]=qs[_0x79ba('0x32')](_['pick'](_0xdb1a03[_0x79ba('0x31')],_0x2f5e92[_0x79ba('0x32')]),_0x22797e);if(_0xdb1a03['query'][_0x79ba('0x3b')]){_0x192b57['where']=_['merge'](_0x192b57[_0x79ba('0x3a')],{'$or':_[_0x79ba('0x2b')](_0x22797e,function(_0x3b55c1){if(_0x3b55c1[_0x79ba('0x2e')]!=='VIRTUAL'){var _0x5c7d56={};_0x5c7d56[_0x3b55c1['name']]={'$like':'%'+_0xdb1a03[_0x79ba('0x31')]['filter']+'%'};return _0x5c7d56;}})});}_0x192b57=_[_0x79ba('0x3c')]({},_0x192b57,_0xdb1a03[_0x79ba('0x3d')]);var _0x13a1bd={'where':_0x192b57[_0x79ba('0x3a')]};return db['DeskField'][_0x79ba('0x1c')](_0x13a1bd)[_0x79ba('0x25')](function(_0x5e1490){_0x21da92['count']=_0x5e1490;if(_0xdb1a03[_0x79ba('0x31')][_0x79ba('0x3e')]){_0x192b57[_0x79ba('0x3f')]=[{'all':!![]}];}return db[_0x79ba('0x40')][_0x79ba('0x41')](_0x192b57);})[_0x79ba('0x25')](function(_0x33b79e){_0x21da92[_0x79ba('0x42')]=_0x33b79e;return _0x21da92;})['then'](respondWithFilteredResult(_0x4553d9,_0x192b57))[_0x79ba('0x43')](handleError(_0x4553d9,null));};exports[_0x79ba('0x44')]=function(_0x20f05a,_0x39ebc3){var _0x529ce2={'raw':!![],'where':{'id':_0x20f05a[_0x79ba('0x45')]['id']}},_0x5acbc1={};_0x5acbc1['model']=_['keys'](db[_0x79ba('0x40')][_0x79ba('0x2c')]);_0x5acbc1['query']=_[_0x79ba('0x46')](_0x20f05a['query']);_0x5acbc1[_0x79ba('0x32')]=_['intersection'](_0x5acbc1[_0x79ba('0x30')],_0x5acbc1[_0x79ba('0x31')]);_0x529ce2['attributes']=_[_0x79ba('0x33')](_0x5acbc1['model'],qs[_0x79ba('0x35')](_0x20f05a[_0x79ba('0x31')]['fields']));_0x529ce2['attributes']=_0x529ce2[_0x79ba('0x34')]['length']?_0x529ce2[_0x79ba('0x34')]:_0x5acbc1['model'];if(_0x20f05a[_0x79ba('0x31')][_0x79ba('0x3e')]){_0x529ce2[_0x79ba('0x3f')]=[{'all':!![]}];}_0x529ce2=_[_0x79ba('0x3c')]({},_0x529ce2,_0x20f05a[_0x79ba('0x3d')]);return db[_0x79ba('0x40')][_0x79ba('0x47')](_0x529ce2)[_0x79ba('0x25')](handleEntityNotFound(_0x39ebc3,null))[_0x79ba('0x25')](respondWithResult(_0x39ebc3,null))[_0x79ba('0x43')](handleError(_0x39ebc3,null));};exports['create']=function(_0x5eecf5,_0x40dd54){return db[_0x79ba('0x40')]['create'](_0x5eecf5[_0x79ba('0x48')],{})[_0x79ba('0x25')](respondWithResult(_0x40dd54,0xc9))[_0x79ba('0x43')](handleError(_0x40dd54,null));};exports[_0x79ba('0x24')]=function(_0x4c56ed,_0x25952){if(_0x4c56ed[_0x79ba('0x48')]['id']){delete _0x4c56ed[_0x79ba('0x48')]['id'];}return db[_0x79ba('0x40')][_0x79ba('0x47')]({'where':{'id':_0x4c56ed[_0x79ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x25952,null))[_0x79ba('0x25')](saveUpdates(_0x4c56ed[_0x79ba('0x48')],null))[_0x79ba('0x25')](respondWithResult(_0x25952,null))[_0x79ba('0x43')](handleError(_0x25952,null));};exports[_0x79ba('0x49')]=function(_0x2eefcd,_0x20d777){return db['DeskField'][_0x79ba('0x47')]({'where':{'id':_0x2eefcd['params']['id']}})[_0x79ba('0x25')](handleEntityNotFound(_0x20d777,null))[_0x79ba('0x25')](removeEntity(_0x20d777,null))[_0x79ba('0x43')](handleError(_0x20d777,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 95c8665..4c2f16e 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 _0x3010=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3010,0x130));var _0x0301=function(_0x33c176,_0x2d28f2){_0x33c176=_0x33c176-0x0;var _0x31c161=_0x3010[_0x33c176];return _0x31c161;};'use strict';var _=require(_0x0301('0x0'));var util=require(_0x0301('0x1'));var logger=require('../../config/logger')(_0x0301('0x2'));var moment=require(_0x0301('0x3'));var BPromise=require(_0x0301('0x4'));var rp=require(_0x0301('0x5'));var fs=require('fs');var path=require(_0x0301('0x6'));var rimraf=require(_0x0301('0x7'));var config=require(_0x0301('0x8'));var attributes=require(_0x0301('0x9'));module[_0x0301('0xa')]=function(_0x510876,_0x249400){return _0x510876['define'](_0x0301('0xb'),attributes,{'tableName':_0x0301('0xc'),'paranoid':![],'indexes':[{'name':_0x0301('0xd'),'fields':[_0x0301('0xe'),_0x0301('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe3d=['define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfe3d,0x198));var _0xdfe3=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xfe3d[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xdfe3('0x0'));var util=require(_0xdfe3('0x1'));var logger=require(_0xdfe3('0x2'))(_0xdfe3('0x3'));var moment=require('moment');var BPromise=require(_0xdfe3('0x4'));var rp=require(_0xdfe3('0x5'));var fs=require('fs');var path=require(_0xdfe3('0x6'));var rimraf=require('rimraf');var config=require(_0xdfe3('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0xff57e9,_0x490305){return _0xff57e9[_0xdfe3('0x8')]('DeskField',attributes,{'tableName':_0xdfe3('0x9'),'paranoid':![],'indexes':[{'name':_0xdfe3('0xa'),'fields':[_0xdfe3('0xb'),_0xdfe3('0xc')],'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 245c2ea..c3635fb 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 _0xea0a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xf9d40b,_0xbb19d9){var _0x188530=function(_0x3b0a9c){while(--_0x3b0a9c){_0xf9d40b['push'](_0xf9d40b['shift']());}};_0x188530(++_0xbb19d9);}(_0xea0a,0x1d5));var _0xaea0=function(_0x3e74f4,_0x3e9c91){_0x3e74f4=_0x3e74f4-0x0;var _0x489758=_0xea0a[_0x3e74f4];return _0x489758;};'use strict';var _=require(_0xaea0('0x0'));var util=require(_0xaea0('0x1'));var moment=require(_0xaea0('0x2'));var BPromise=require(_0xaea0('0x3'));var rs=require(_0xaea0('0x4'));var fs=require('fs');var Redis=require(_0xaea0('0x5'));var db=require(_0xaea0('0x6'))['db'];var utils=require(_0xaea0('0x7'));var logger=require(_0xaea0('0x8'))(_0xaea0('0x9'));var config=require('../../config/environment');var jayson=require(_0xaea0('0xa'));var client=jayson[_0xaea0('0xb')][_0xaea0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5327b4,_0x41956d,_0x2a449d){return new BPromise(function(_0x378a85,_0x39e039){return client[_0xaea0('0xd')](_0x5327b4,_0x2a449d)[_0xaea0('0xe')](function(_0x3b4c5b){logger[_0xaea0('0xf')](_0xaea0('0x10'),_0x41956d,_0xaea0('0x11'));logger[_0xaea0('0x12')](_0xaea0('0x13'),_0x41956d,_0xaea0('0x11'),JSON[_0xaea0('0x14')](_0x3b4c5b));if(_0x3b4c5b[_0xaea0('0x15')]){if(_0x3b4c5b[_0xaea0('0x15')]['code']===0x1f4){logger[_0xaea0('0x15')]('DeskField,\x20%s,\x20%s',_0x41956d,_0x3b4c5b['error']['message']);return _0x39e039(_0x3b4c5b[_0xaea0('0x15')]['message']);}logger[_0xaea0('0x15')](_0xaea0('0x10'),_0x41956d,_0x3b4c5b[_0xaea0('0x15')]['message']);return _0x378a85(_0x3b4c5b[_0xaea0('0x15')][_0xaea0('0x16')]);}else{logger[_0xaea0('0xf')](_0xaea0('0x10'),_0x41956d,_0xaea0('0x11'));_0x378a85(_0x3b4c5b[_0xaea0('0x17')][_0xaea0('0x16')]);}})[_0xaea0('0x18')](function(_0x289036){logger[_0xaea0('0x15')](_0xaea0('0x10'),_0x41956d,_0x289036);_0x39e039(_0x289036);});});} \ No newline at end of file +var _0x25b8=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x92e6a,_0x4c3e17){var _0x687db8=function(_0x1e3cb2){while(--_0x1e3cb2){_0x92e6a['push'](_0x92e6a['shift']());}};_0x687db8(++_0x4c3e17);}(_0x25b8,0xb8));var _0x825b=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x25b8[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x825b('0x0'));var util=require(_0x825b('0x1'));var moment=require(_0x825b('0x2'));var BPromise=require('bluebird');var rs=require(_0x825b('0x3'));var fs=require('fs');var Redis=require(_0x825b('0x4'));var db=require(_0x825b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x825b('0x6'))(_0x825b('0x7'));var config=require(_0x825b('0x8'));var jayson=require(_0x825b('0x9'));var client=jayson['client'][_0x825b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x150c59,_0x356e38,_0x410445){return new BPromise(function(_0x18227a,_0x3d5899){return client['request'](_0x150c59,_0x410445)['then'](function(_0x5a0add){logger[_0x825b('0xb')](_0x825b('0xc'),_0x356e38,_0x825b('0xd'));logger[_0x825b('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x356e38,_0x825b('0xd'),JSON[_0x825b('0xf')](_0x5a0add));if(_0x5a0add[_0x825b('0x10')]){if(_0x5a0add[_0x825b('0x10')]['code']===0x1f4){logger['error'](_0x825b('0xc'),_0x356e38,_0x5a0add[_0x825b('0x10')][_0x825b('0x11')]);return _0x3d5899(_0x5a0add['error'][_0x825b('0x11')]);}logger['error'](_0x825b('0xc'),_0x356e38,_0x5a0add[_0x825b('0x10')][_0x825b('0x11')]);return _0x18227a(_0x5a0add['error'][_0x825b('0x11')]);}else{logger[_0x825b('0xb')]('DeskField,\x20%s,\x20%s',_0x356e38,_0x825b('0xd'));_0x18227a(_0x5a0add['result'][_0x825b('0x11')]);}})[_0x825b('0x12')](function(_0x5683f4){logger[_0x825b('0x10')](_0x825b('0xc'),_0x356e38,_0x5683f4);_0x3d5899(_0x5683f4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a4d29ec..77e8762 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 _0x309b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x48e331,_0x262cde){var _0x25d878=function(_0xc2a20a){while(--_0xc2a20a){_0x48e331['push'](_0x48e331['shift']());}};_0x25d878(++_0x262cde);}(_0x309b,0xf6));var _0xb309=function(_0x58c50e,_0x573495){_0x58c50e=_0x58c50e-0x0;var _0x4a8199=_0x309b[_0x58c50e];return _0x4a8199;};'use strict';var multer=require(_0xb309('0x0'));var util=require(_0xb309('0x1'));var path=require(_0xb309('0x2'));var timeout=require(_0xb309('0x3'));var express=require(_0xb309('0x4'));var router=express[_0xb309('0x5')]();var auth=require(_0xb309('0x6'));var interaction=require(_0xb309('0x7'));var config=require(_0xb309('0x8'));var controller=require(_0xb309('0x9'));router[_0xb309('0xa')]('/',auth[_0xb309('0xb')](),controller[_0xb309('0xc')]);router[_0xb309('0xa')](_0xb309('0xd'),auth[_0xb309('0xb')](),controller['show']);router[_0xb309('0xa')](_0xb309('0xe'),auth[_0xb309('0xb')](),controller[_0xb309('0xf')]);router['get'](_0xb309('0x10'),auth[_0xb309('0xb')](),controller[_0xb309('0x11')]);router[_0xb309('0x12')]('/',auth[_0xb309('0xb')](),controller['create']);router['post'](_0xb309('0xe'),auth[_0xb309('0xb')](),controller['addConfiguration']);router[_0xb309('0x13')]('/:id',auth[_0xb309('0xb')](),controller[_0xb309('0x14')]);router[_0xb309('0x15')](_0xb309('0xd'),auth[_0xb309('0xb')](),controller[_0xb309('0x16')]);module[_0xb309('0x17')]=router; \ No newline at end of file +var _0xbf03=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbf03,0x127));var _0x3bf0=function(_0x56c3ca,_0x54b0ca){_0x56c3ca=_0x56c3ca-0x0;var _0x34f5f7=_0xbf03[_0x56c3ca];return _0x34f5f7;};'use strict';var multer=require(_0x3bf0('0x0'));var util=require(_0x3bf0('0x1'));var path=require('path');var timeout=require(_0x3bf0('0x2'));var express=require('express');var router=express[_0x3bf0('0x3')]();var auth=require(_0x3bf0('0x4'));var interaction=require(_0x3bf0('0x5'));var config=require(_0x3bf0('0x6'));var controller=require(_0x3bf0('0x7'));router['get']('/',auth[_0x3bf0('0x8')](),controller[_0x3bf0('0x9')]);router[_0x3bf0('0xa')]('/:id',auth[_0x3bf0('0x8')](),controller['show']);router[_0x3bf0('0xa')](_0x3bf0('0xb'),auth[_0x3bf0('0x8')](),controller[_0x3bf0('0xc')]);router[_0x3bf0('0xa')](_0x3bf0('0xd'),auth['isAuthenticated'](),controller[_0x3bf0('0xe')]);router[_0x3bf0('0xf')]('/',auth[_0x3bf0('0x8')](),controller[_0x3bf0('0x10')]);router['post'](_0x3bf0('0xb'),auth['isAuthenticated'](),controller[_0x3bf0('0x11')]);router[_0x3bf0('0x12')](_0x3bf0('0x13'),auth[_0x3bf0('0x8')](),controller[_0x3bf0('0x14')]);router[_0x3bf0('0x15')](_0x3bf0('0x13'),auth[_0x3bf0('0x8')](),controller['destroy']);module[_0x3bf0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a55081e..cd58420 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 _0xeb7e=['exports','STRING'];(function(_0x476e8c,_0x475be7){var _0x521d4d=function(_0x555b51){while(--_0x555b51){_0x476e8c['push'](_0x476e8c['shift']());}};_0x521d4d(++_0x475be7);}(_0xeb7e,0xaa));var _0xeeb7=function(_0x25d431,_0x2b1703){_0x25d431=_0x25d431-0x0;var _0x348a21=_0xeb7e[_0x25d431];return _0x348a21;};'use strict';var Sequelize=require('sequelize');module[_0xeeb7('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xeeb7('0x1')]},'remoteUri':{'type':Sequelize[_0xeeb7('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xeeb7('0x1')]},'clientSecret':{'type':Sequelize[_0xeeb7('0x1')]},'serverUrl':{'type':Sequelize[_0xeeb7('0x1')]},'description':{'type':Sequelize[_0xeeb7('0x1')]}}; \ No newline at end of file +var _0xffe7=['STRING','sequelize','exports'];(function(_0x1bb52c,_0x5c4870){var _0x2e8307=function(_0x5493bd){while(--_0x5493bd){_0x1bb52c['push'](_0x1bb52c['shift']());}};_0x2e8307(++_0x5c4870);}(_0xffe7,0x14b));var _0x7ffe=function(_0x9310b1,_0x5a2120){_0x9310b1=_0x9310b1-0x0;var _0x58ede3=_0xffe7[_0x9310b1];return _0x58ede3;};'use strict';var Sequelize=require(_0x7ffe('0x0'));module[_0x7ffe('0x1')]={'name':{'type':Sequelize[_0x7ffe('0x2')]},'username':{'type':Sequelize[_0x7ffe('0x2')]},'password':{'type':Sequelize[_0x7ffe('0x2')]},'remoteUri':{'type':Sequelize[_0x7ffe('0x2')]},'tenantId':{'type':Sequelize[_0x7ffe('0x2')]},'clientId':{'type':Sequelize[_0x7ffe('0x2')]},'clientSecret':{'type':Sequelize[_0x7ffe('0x2')]},'serverUrl':{'type':Sequelize[_0x7ffe('0x2')]},'description':{'type':Sequelize[_0x7ffe('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 209488c..39fd0c4 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 _0xfe18=['StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','Bearer\x20','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','true','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dynamics365Account','count','includeAll','include','findAll','rows','show','params','length','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','clientSecret','GET','4.0','MetadataId','EntityDefinitions(','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfe18,0xe9));var _0x8fe1=function(_0x54ab63,_0x56ce3c){_0x54ab63=_0x54ab63-0x0;var _0x1e903b=_0xfe18[_0x54ab63];return _0x1e903b;};'use strict';var pdf=require(_0x8fe1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8fe1('0x1'));var zipdir=require(_0x8fe1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fe1('0x3'));var moment=require('moment');var BPromise=require(_0x8fe1('0x4'));var Mustache=require(_0x8fe1('0x5'));var util=require(_0x8fe1('0x6'));var path=require('path');var sox=require(_0x8fe1('0x7'));var csv=require(_0x8fe1('0x8'));var ejs=require(_0x8fe1('0x9'));var fs=require('fs');var _=require(_0x8fe1('0xa'));var squel=require(_0x8fe1('0xb'));var crypto=require(_0x8fe1('0xc'));var jsforce=require(_0x8fe1('0xd'));var deskjs=require(_0x8fe1('0xe'));var toCsv=require(_0x8fe1('0x8'));var querystring=require(_0x8fe1('0xf'));var Papa=require('papaparse');var Redis=require(_0x8fe1('0x10'));var authService=require(_0x8fe1('0x11'));var qs=require(_0x8fe1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fe1('0x13'))(_0x8fe1('0x14'));var utils=require(_0x8fe1('0x15'));var config=require(_0x8fe1('0x16'));var db=require(_0x8fe1('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8fe1('0x18'));var client=jayson[_0x8fe1('0x19')][_0x8fe1('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x39644e,_0x56bf8f,_0xbf1a02){if(_0xbf1a02){var _0x5f538c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f538c[_0x8fe1('0x1b')](_0x56bf8f)){return _0x39644e;}else{throw new db[(_0x8fe1('0x1c'))][(_0x8fe1('0x1d'))](_0x8fe1('0x1e'));}}else{return _0x39644e;}}function respondWithRpcPromise(_0x446145,_0x5d22a3,_0x1aa1e8,_0x3a1337){return new BPromise(function(_0xc67423,_0x30ab5e){var _0x388d13=_0x3a1337||client;return _0x388d13[_0x8fe1('0x1f')](_0x446145,_0x1aa1e8)[_0x8fe1('0x20')](function(_0x25f739){logger[_0x8fe1('0x21')](_0x8fe1('0x22'),_0x5d22a3,_0x8fe1('0x23'));logger[_0x8fe1('0x24')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5d22a3,_0x8fe1('0x23'),JSON['stringify'](_0x25f739));if(_0x25f739[_0x8fe1('0x25')]){if(_0x25f739[_0x8fe1('0x25')][_0x8fe1('0x26')]===0x1f4){logger[_0x8fe1('0x25')](_0x8fe1('0x22'),_0x5d22a3,_0x25f739['error']['message']);return _0x30ab5e(_0x25f739['error']['message']);}logger[_0x8fe1('0x25')](_0x8fe1('0x22'),_0x5d22a3,_0x25f739[_0x8fe1('0x25')][_0x8fe1('0x27')]);return _0xc67423(_0x25f739[_0x8fe1('0x25')]['message']);}else{logger[_0x8fe1('0x21')](_0x8fe1('0x22'),_0x5d22a3,_0x8fe1('0x23'));_0xc67423(_0x25f739[_0x8fe1('0x28')]['message']);}})[_0x8fe1('0x29')](function(_0x2cba12){logger['error'](_0x8fe1('0x22'),_0x5d22a3,_0x2cba12);_0x30ab5e(_0x2cba12);});});}function respondWithStatusCode(_0x2b5d32,_0x1ffee1){_0x1ffee1=_0x1ffee1||0xcc;return function(_0x3a8fe6){if(_0x3a8fe6){return _0x2b5d32[_0x8fe1('0x2a')](_0x1ffee1);}return _0x2b5d32[_0x8fe1('0x2b')](_0x1ffee1)[_0x8fe1('0x2c')]();};}function respondWithResult(_0x112270,_0x4979fc){_0x4979fc=_0x4979fc||0xc8;return function(_0x1f9883){if(_0x1f9883){return _0x112270[_0x8fe1('0x2b')](_0x4979fc)[_0x8fe1('0x2d')](_0x1f9883);}};}function respondWithFilteredResult(_0x2642a8,_0x4254f8){return function(_0x20de4b){if(_0x20de4b){var _0x32d117=_0x20de4b['count'],_0x59c97c=_0x4254f8[_0x8fe1('0x2e')],_0x2f09f2=_0x4254f8['offset']+_0x4254f8['limit'],_0x142360;if(_0x2f09f2>=_0x32d117){_0x2f09f2=_0x32d117;_0x142360=0xc8;}else{_0x142360=0xce;}_0x2642a8[_0x8fe1('0x2b')](_0x142360);return _0x2642a8[_0x8fe1('0x2f')](_0x8fe1('0x30'),_0x59c97c+'-'+_0x2f09f2+'/'+_0x32d117)[_0x8fe1('0x2d')](_0x20de4b);}return null;};}function patchUpdates(_0x42968e){return function(_0x67e49a){try{jsonpatch[_0x8fe1('0x31')](_0x67e49a,_0x42968e,!![]);}catch(_0x255769){return BPromise[_0x8fe1('0x32')](_0x255769);}return _0x67e49a['save']();};}function saveUpdates(_0x1b5204,_0x1f7602){return function(_0x506ad9){if(_0x506ad9){return _0x506ad9[_0x8fe1('0x33')](_0x1b5204)[_0x8fe1('0x20')](function(_0x2a6692){return _0x2a6692;});}return null;};}function removeEntity(_0xf54206,_0x1df653){return function(_0x4039b3){if(_0x4039b3){return _0x4039b3[_0x8fe1('0x34')]()[_0x8fe1('0x20')](function(){_0xf54206[_0x8fe1('0x2b')](0xcc)[_0x8fe1('0x2c')]();});}};}function handleEntityNotFound(_0x5ea1fe,_0x2b98ba){return function(_0x337455){if(!_0x337455){_0x5ea1fe[_0x8fe1('0x2a')](0x194);}return _0x337455;};}function handleError(_0x3ee463,_0x1e0dd2){_0x1e0dd2=_0x1e0dd2||0x1f4;return function(_0x31dc49){logger[_0x8fe1('0x25')](_0x31dc49[_0x8fe1('0x35')]);if(_0x31dc49[_0x8fe1('0x36')]){delete _0x31dc49[_0x8fe1('0x36')];}_0x3ee463[_0x8fe1('0x2b')](_0x1e0dd2)[_0x8fe1('0x37')](_0x31dc49);};}exports['index']=function(_0x3cfe9c,_0x1732a1){var _0x33bd16={},_0x4e6a83={},_0x2d3722={'count':0x0,'rows':[]};var _0x175327=_[_0x8fe1('0x38')](db['Dynamics365Account'][_0x8fe1('0x39')],function(_0x3c38dd){return{'name':_0x3c38dd[_0x8fe1('0x3a')],'type':_0x3c38dd[_0x8fe1('0x3b')]['key']};});_0x4e6a83['model']=_[_0x8fe1('0x38')](_0x175327,'name');_0x4e6a83[_0x8fe1('0x3c')]=_[_0x8fe1('0x3d')](_0x3cfe9c[_0x8fe1('0x3c')]);_0x4e6a83[_0x8fe1('0x3e')]=_[_0x8fe1('0x3f')](_0x4e6a83[_0x8fe1('0x40')],_0x4e6a83[_0x8fe1('0x3c')]);_0x33bd16['attributes']=_[_0x8fe1('0x3f')](_0x4e6a83[_0x8fe1('0x40')],qs[_0x8fe1('0x41')](_0x3cfe9c[_0x8fe1('0x3c')]['fields']));_0x33bd16[_0x8fe1('0x42')]=_0x33bd16[_0x8fe1('0x42')]['length']?_0x33bd16[_0x8fe1('0x42')]:_0x4e6a83[_0x8fe1('0x40')];if(!_0x3cfe9c[_0x8fe1('0x3c')][_0x8fe1('0x43')](_0x8fe1('0x44'))){_0x33bd16[_0x8fe1('0x45')]=qs[_0x8fe1('0x45')](_0x3cfe9c[_0x8fe1('0x3c')][_0x8fe1('0x45')]);_0x33bd16['offset']=qs[_0x8fe1('0x2e')](_0x3cfe9c['query'][_0x8fe1('0x2e')]);}_0x33bd16[_0x8fe1('0x46')]=qs[_0x8fe1('0x47')](_0x3cfe9c[_0x8fe1('0x3c')]['sort']);_0x33bd16[_0x8fe1('0x48')]=qs[_0x8fe1('0x3e')](_[_0x8fe1('0x49')](_0x3cfe9c[_0x8fe1('0x3c')],_0x4e6a83[_0x8fe1('0x3e')]),_0x175327);if(_0x3cfe9c[_0x8fe1('0x3c')][_0x8fe1('0x4a')]){_0x33bd16[_0x8fe1('0x48')]=_['merge'](_0x33bd16[_0x8fe1('0x48')],{'$or':_[_0x8fe1('0x38')](_0x175327,function(_0x4c08ea){if(_0x4c08ea['type']!==_0x8fe1('0x4b')){var _0x41f552={};_0x41f552[_0x4c08ea[_0x8fe1('0x36')]]={'$like':'%'+_0x3cfe9c['query']['filter']+'%'};return _0x41f552;}})});}_0x33bd16=_[_0x8fe1('0x4c')]({},_0x33bd16,_0x3cfe9c[_0x8fe1('0x4d')]);var _0x5d9e5a={'where':_0x33bd16['where']};return db[_0x8fe1('0x4e')][_0x8fe1('0x4f')](_0x5d9e5a)[_0x8fe1('0x20')](function(_0x61c213){_0x2d3722['count']=_0x61c213;if(_0x3cfe9c['query'][_0x8fe1('0x50')]){_0x33bd16[_0x8fe1('0x51')]=[{'all':!![]}];}return db[_0x8fe1('0x4e')][_0x8fe1('0x52')](_0x33bd16);})['then'](function(_0x29e0f8){_0x2d3722[_0x8fe1('0x53')]=_0x29e0f8;return _0x2d3722;})[_0x8fe1('0x20')](respondWithFilteredResult(_0x1732a1,_0x33bd16))[_0x8fe1('0x29')](handleError(_0x1732a1,null));};exports[_0x8fe1('0x54')]=function(_0x97d277,_0xb6410){var _0x191a89={'raw':![],'where':{'id':_0x97d277[_0x8fe1('0x55')]['id']}},_0x49f216={};_0x49f216[_0x8fe1('0x40')]=_[_0x8fe1('0x3d')](db[_0x8fe1('0x4e')][_0x8fe1('0x39')]);_0x49f216['query']=_[_0x8fe1('0x3d')](_0x97d277[_0x8fe1('0x3c')]);_0x49f216[_0x8fe1('0x3e')]=_[_0x8fe1('0x3f')](_0x49f216['model'],_0x49f216[_0x8fe1('0x3c')]);_0x191a89[_0x8fe1('0x42')]=_[_0x8fe1('0x3f')](_0x49f216['model'],qs[_0x8fe1('0x41')](_0x97d277[_0x8fe1('0x3c')][_0x8fe1('0x41')]));_0x191a89[_0x8fe1('0x42')]=_0x191a89[_0x8fe1('0x42')][_0x8fe1('0x56')]?_0x191a89[_0x8fe1('0x42')]:_0x49f216[_0x8fe1('0x40')];if(_0x97d277[_0x8fe1('0x3c')][_0x8fe1('0x50')]){_0x191a89[_0x8fe1('0x51')]=[{'all':!![]}];}_0x191a89=_[_0x8fe1('0x4c')]({},_0x191a89,_0x97d277['options']);return db[_0x8fe1('0x4e')][_0x8fe1('0x57')](_0x191a89)[_0x8fe1('0x20')](handleEntityNotFound(_0xb6410,null))[_0x8fe1('0x20')](respondWithResult(_0xb6410,null))['catch'](handleError(_0xb6410,null));};exports[_0x8fe1('0x58')]=function(_0x26c267,_0xc288a){return db[_0x8fe1('0x4e')][_0x8fe1('0x58')](_0x26c267[_0x8fe1('0x59')],{})[_0x8fe1('0x20')](respondWithResult(_0xc288a,0xc9))[_0x8fe1('0x29')](handleError(_0xc288a,null));};exports[_0x8fe1('0x33')]=function(_0xc0c8e7,_0x4db3b7){if(_0xc0c8e7[_0x8fe1('0x59')]['id']){delete _0xc0c8e7[_0x8fe1('0x59')]['id'];}return db[_0x8fe1('0x4e')]['find']({'where':{'id':_0xc0c8e7[_0x8fe1('0x55')]['id']}})['then'](handleEntityNotFound(_0x4db3b7,null))[_0x8fe1('0x20')](saveUpdates(_0xc0c8e7[_0x8fe1('0x59')],null))[_0x8fe1('0x20')](respondWithResult(_0x4db3b7,null))[_0x8fe1('0x29')](handleError(_0x4db3b7,null));};exports[_0x8fe1('0x34')]=function(_0x866986,_0x3b8900){return db[_0x8fe1('0x4e')][_0x8fe1('0x57')]({'where':{'id':_0x866986[_0x8fe1('0x55')]['id']}})[_0x8fe1('0x20')](handleEntityNotFound(_0x3b8900,null))[_0x8fe1('0x20')](removeEntity(_0x3b8900,null))['catch'](handleError(_0x3b8900,null));};exports[_0x8fe1('0x5a')]=function(_0x58bd08,_0x2f4646,_0x1f1876){var _0x98c0e2={};var _0x36cfec={};var _0xc1ce25;var _0xc3b4ce;return db[_0x8fe1('0x4e')][_0x8fe1('0x5b')]({'where':{'id':_0x58bd08[_0x8fe1('0x55')]['id']}})[_0x8fe1('0x20')](handleEntityNotFound(_0x2f4646,null))[_0x8fe1('0x20')](function(_0x3edc02){if(_0x3edc02){_0xc1ce25=_0x3edc02;_0x36cfec[_0x8fe1('0x40')]=_['keys'](db[_0x8fe1('0x5c')][_0x8fe1('0x39')]);_0x36cfec[_0x8fe1('0x3c')]=_[_0x8fe1('0x3d')](_0x58bd08[_0x8fe1('0x3c')]);_0x36cfec[_0x8fe1('0x3e')]=_[_0x8fe1('0x3f')](_0x36cfec[_0x8fe1('0x40')],_0x36cfec[_0x8fe1('0x3c')]);_0x98c0e2['attributes']=_[_0x8fe1('0x3f')](_0x36cfec[_0x8fe1('0x40')],qs[_0x8fe1('0x41')](_0x58bd08[_0x8fe1('0x3c')][_0x8fe1('0x41')]));_0x98c0e2[_0x8fe1('0x42')]=_0x98c0e2['attributes'][_0x8fe1('0x56')]?_0x98c0e2[_0x8fe1('0x42')]:_0x36cfec[_0x8fe1('0x40')];_0x98c0e2[_0x8fe1('0x46')]=qs[_0x8fe1('0x47')](_0x58bd08[_0x8fe1('0x3c')][_0x8fe1('0x47')]);_0x98c0e2[_0x8fe1('0x48')]=qs['filters'](_[_0x8fe1('0x49')](_0x58bd08[_0x8fe1('0x3c')],_0x36cfec[_0x8fe1('0x3e')]));if(_0x58bd08[_0x8fe1('0x3c')][_0x8fe1('0x4a')]){_0x98c0e2['where']=_[_0x8fe1('0x4c')](_0x98c0e2[_0x8fe1('0x48')],{'$or':_['map'](_0x98c0e2[_0x8fe1('0x42')],function(_0x5631c6){var _0x459b34={};_0x459b34[_0x5631c6]={'$like':'%'+_0x58bd08[_0x8fe1('0x3c')][_0x8fe1('0x4a')]+'%'};return _0x459b34;})});}_0x98c0e2=_[_0x8fe1('0x4c')]({},_0x98c0e2,_0x58bd08['options']);return _0xc1ce25[_0x8fe1('0x5a')](_0x98c0e2);}})['then'](function(_0x10009d){if(_0x10009d){_0xc3b4ce=_0x10009d[_0x8fe1('0x56')];if(!_0x58bd08[_0x8fe1('0x3c')]['hasOwnProperty'](_0x8fe1('0x44'))){_0x98c0e2[_0x8fe1('0x45')]=qs[_0x8fe1('0x45')](_0x58bd08[_0x8fe1('0x3c')]['limit']);_0x98c0e2[_0x8fe1('0x2e')]=qs[_0x8fe1('0x2e')](_0x58bd08[_0x8fe1('0x3c')][_0x8fe1('0x2e')]);}return _0xc1ce25[_0x8fe1('0x5a')](_0x98c0e2);}})['then'](function(_0x442df3){if(_0x442df3){return _0x442df3?{'count':_0xc3b4ce,'rows':_0x442df3}:null;}})[_0x8fe1('0x20')](respondWithResult(_0x2f4646,null))[_0x8fe1('0x29')](handleError(_0x2f4646,null));};exports[_0x8fe1('0x5d')]=function(_0x5ef9bf,_0x33d461,_0x58f6aa){if(_0x5ef9bf[_0x8fe1('0x59')]['id']){delete _0x5ef9bf['body']['id'];}return db[_0x8fe1('0x4e')]['findOne']({'where':{'id':_0x5ef9bf['params']['id']}})[_0x8fe1('0x20')](handleEntityNotFound(_0x33d461,null))[_0x8fe1('0x20')](function(_0x597cef){if(_0x597cef){_0x5ef9bf[_0x8fe1('0x59')]['AccountId']=_0x597cef['id'];_0x5ef9bf[_0x8fe1('0x59')][_0x8fe1('0x5e')]=integrations[_0x8fe1('0x5f')](_0x5ef9bf[_0x8fe1('0x59')][_0x8fe1('0x60')],_0x5ef9bf[_0x8fe1('0x59')][_0x8fe1('0x3b')]);_0x5ef9bf[_0x8fe1('0x59')][_0x8fe1('0x61')]=integrations[_0x8fe1('0x62')](_0x5ef9bf[_0x8fe1('0x59')][_0x8fe1('0x60')],_0x5ef9bf[_0x8fe1('0x59')][_0x8fe1('0x3b')]);return db[_0x8fe1('0x5c')][_0x8fe1('0x58')](_0x5ef9bf[_0x8fe1('0x59')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x8fe1('0x63')],'as':_0x8fe1('0x61')}]});}return null;})['then'](respondWithResult(_0x33d461,null))[_0x8fe1('0x29')](handleError(_0x33d461,null));};exports['getFields']=function(_0x4eb789,_0x5f46f4,_0x158bed){var _0x288fbe=_0x4eb789[_0x8fe1('0x3c')][_0x8fe1('0x64')];var _0xa88621=_0x288fbe===_0x8fe1('0x65')?'Incident':_0x8fe1('0x66');var _0x1bbafa='';var _0x12648b='';var _0x136a84='';var _0x8bc383='';var _0x56600c='';var _0x1a97b3='';var _0x5425d5='';var _0x409c43='';var _0x48fb20=[_0x8fe1('0x67'),_0x8fe1('0x68'),_0x8fe1('0x69'),_0x8fe1('0x6a'),_0x8fe1('0x6b'),'subject',_0x8fe1('0x6c'),'regardingobjectid',_0x8fe1('0x6d'),'phonecall_activity_parties'];var _0x112ed3=[_0x8fe1('0x6e'),_0x8fe1('0x6f'),_0x8fe1('0x70'),'billedserviceunits',_0x8fe1('0x71'),_0x8fe1('0x72'),_0x8fe1('0x73'),_0x8fe1('0x74'),'createdbyexternalpartyname',_0x8fe1('0x75'),_0x8fe1('0x76'),_0x8fe1('0x77'),'createdon','createdonbehalfbyname',_0x8fe1('0x78'),_0x8fe1('0x79'),_0x8fe1('0x7a'),_0x8fe1('0x7b'),_0x8fe1('0x7c'),_0x8fe1('0x7d'),_0x8fe1('0x7e'),_0x8fe1('0x7f'),'escalatedon','exchangerate','firstresponsebykpiidname',_0x8fe1('0x80'),_0x8fe1('0x81'),_0x8fe1('0x82'),_0x8fe1('0x83'),'lastonholdtime',_0x8fe1('0x84'),_0x8fe1('0x85'),_0x8fe1('0x86'),_0x8fe1('0x87'),_0x8fe1('0x88'),'modifiedon',_0x8fe1('0x89'),_0x8fe1('0x8a'),_0x8fe1('0x8b'),_0x8fe1('0x8c'),_0x8fe1('0x8d'),_0x8fe1('0x8e'),_0x8fe1('0x8f'),_0x8fe1('0x90'),_0x8fe1('0x91'),'owneridyominame',_0x8fe1('0x92'),_0x8fe1('0x93'),_0x8fe1('0x94'),_0x8fe1('0x95'),'productidname',_0x8fe1('0x96'),_0x8fe1('0x97'),_0x8fe1('0x98'),_0x8fe1('0x99'),_0x8fe1('0x9a'),_0x8fe1('0x9b'),_0x8fe1('0x9c'),_0x8fe1('0x9d'),_0x8fe1('0x9e'),'socialprofileidname','statecode',_0x8fe1('0x9f'),_0x8fe1('0xa0'),_0x8fe1('0xa1'),_0x8fe1('0xa2'),_0x8fe1('0xa3'),_0x8fe1('0xa4'),_0x8fe1('0xa5'),'versionnumber'];var _0x2864f7=_0x48fb20[_0x8fe1('0xa6')](_0x112ed3);return db[_0x8fe1('0x4e')][_0x8fe1('0x5b')]({'where':{'id':_0x4eb789[_0x8fe1('0x55')]['id']},'attributes':['id',_0x8fe1('0xa7'),_0x8fe1('0xa8'),_0x8fe1('0xa9'),_0x8fe1('0xaa'),'clientId','clientSecret']})[_0x8fe1('0x20')](handleEntityNotFound(_0x5f46f4,null))[_0x8fe1('0x20')](function(_0x55741a){if(_0x55741a){_0x409c43=_0x55741a[_0x8fe1('0xa9')];var _0x280cc6=_0x409c43[_0x8fe1('0xab')](-0x1);if(_0x280cc6==='/'){_0x409c43=_0x409c43[_0x8fe1('0xac')](0x0,_0x409c43[_0x8fe1('0xad')](_0x280cc6));}_0x5425d5=util[_0x8fe1('0xae')](_0x8fe1('0xaf'),_0x409c43);var _0x136422={'method':_0x8fe1('0xb0'),'uri':_0x8fe1('0xb1')+_0x55741a[_0x8fe1('0xaa')]+_0x8fe1('0xb2'),'form':{'client_id':_0x55741a[_0x8fe1('0xb3')],'resource':_0x409c43,'username':_0x55741a[_0x8fe1('0xa7')],'password':_0x55741a['password'],'grant_type':_0x8fe1('0xa8'),'client_secret':_0x55741a[_0x8fe1('0xb4')]},'json':!![]};return rp(_0x136422);}})[_0x8fe1('0x20')](function(_0x5adda2){_0x1a97b3=_0x5adda2['access_token'];var _0x30b12c={'method':_0x8fe1('0xb5'),'uri':encodeURI(_0x5425d5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xa88621+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1a97b3,'If-None-Match':null,'OData-Version':_0x8fe1('0xb6')},'json':!![]};return rp(_0x30b12c);})[_0x8fe1('0x20')](function(_0x275750){var _0x9b4e90=_0x275750['value'][0x0];var _0x4b7377=_0x9b4e90[_0x8fe1('0xb7')];var _0x2fd549={'method':_0x8fe1('0xb5'),'uri':_0x5425d5+_0x8fe1('0xb8')+_0x4b7377+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x1a97b3,'If-None-Match':null,'OData-Version':_0x8fe1('0xb6')},'json':!![]};return rp(_0x2fd549);})['then'](function(_0x2e1c57){_0x1bbafa=_0x2e1c57;_0x12648b=_0x1bbafa['Attributes'];_0x12648b=_['remove'](_0x12648b,function(_0x1b95e0){return!_0x2864f7[_0x8fe1('0xb9')](_0x1b95e0[_0x8fe1('0xba')]);});var _0x2347a1=[];var _0x19ab88=[];_0x12648b[_0x8fe1('0xbb')](function(_0x597a7f){if(_0x597a7f[_0x8fe1('0xbc')]){var _0x3eb880=_0x597a7f['@odata.type'][_0x8fe1('0xac')](_0x597a7f['@odata.type'][_0x8fe1('0xad')]('.')+0x1);if(_0x3eb880===_0x8fe1('0xbd')){_0x2347a1[_0x8fe1('0xbe')](getSelectList(_0x5425d5,_0x288fbe,_0x19ab88,_0x1bbafa['MetadataId'],_0x597a7f[_0x8fe1('0xb7')],_0x1a97b3));}}});return Promise[_0x8fe1('0xbf')](_0x2347a1);})[_0x8fe1('0x20')](function(_0x455b44){_0x136a84=_0x455b44[0x0];var _0x50935d=[];var _0x1c8268=[];_0x12648b['forEach'](function(_0x4a0242){if(!_[_0x8fe1('0xc0')](_0x4a0242[_0x8fe1('0xbc')])){var _0x248fbd=_0x4a0242[_0x8fe1('0xbc')]['substring'](_0x4a0242[_0x8fe1('0xbc')][_0x8fe1('0xad')]('.')+0x1);if(_0x248fbd===_0x8fe1('0xc1')){_0x50935d[_0x8fe1('0xbe')](getBooleanList(_0x5425d5,_0x288fbe,_0x1c8268,_0x1bbafa[_0x8fe1('0xb7')],_0x4a0242[_0x8fe1('0xb7')],_0x1a97b3));}}});return Promise[_0x8fe1('0xbf')](_0x50935d);})[_0x8fe1('0x20')](function(_0x3b07ae){_0x8bc383=_0x3b07ae[0x0];var _0x5c1b50=[];var _0x3d9df8=[];_0x12648b[_0x8fe1('0xbb')](function(_0x1eb8eb){if(_0x1eb8eb[_0x8fe1('0xbc')]){var _0x2d48bb=_0x1eb8eb['@odata.type'][_0x8fe1('0xac')](_0x1eb8eb[_0x8fe1('0xbc')]['lastIndexOf']('.')+0x1);if(_0x2d48bb===_0x8fe1('0xc2')||_0x2d48bb==='DoubleAttributeMetadata'||_0x2d48bb===_0x8fe1('0xc3')||_0x2d48bb==='IntegerAttributeMetadata'||_0x2d48bb===_0x8fe1('0xc4')||_0x2d48bb==='DateTimeAttributeMetadata'||_0x2d48bb===_0x8fe1('0xc5')||_0x2d48bb===_0x8fe1('0xc6')||_0x2d48bb===_0x8fe1('0xc7')||_0x2d48bb===_0x8fe1('0xc8')){_0x5c1b50[_0x8fe1('0xbe')](getInputList(_0x5425d5,_0x288fbe,_0x2d48bb,_0x3d9df8,_0x1bbafa[_0x8fe1('0xb7')],_0x1eb8eb[_0x8fe1('0xb7')],_0x1a97b3));}}});return Promise[_0x8fe1('0xbf')](_0x5c1b50);})[_0x8fe1('0x20')](function(_0x40a847){_0x56600c=_0x40a847[0x0];var _0x1fddde=_0x136a84[_0x8fe1('0xa6')](_0x8bc383)['concat'](_0x56600c);var _0x8facf8={'count':_0x1fddde['length'],'rows':_0x1fddde};return _0x8facf8;})['then'](respondWithResult(_0x5f46f4,null))[_0x8fe1('0x29')](function(_0xc72972){var _0x571845=_0x4eb789['query'][_0x8fe1('0x1b')]?0x1f4:_0xc72972[_0x8fe1('0xc9')]||0x1f4;logger[_0x8fe1('0x25')](_0xc72972['stack']);delete _0xc72972[_0x8fe1('0x36')];if(_0x571845===0x191){_0x571845=0x190;}_0x5f46f4['status'](_0x571845)['send'](_0x4eb789[_0x8fe1('0x3c')][_0x8fe1('0x1b')]?{'message':_0x8fe1('0xca'),'statusCode':_0xc72972[_0x8fe1('0xc9')]}:_0xc72972);});};function getSelectList(_0x5a8fb4,_0x3e35b2,_0x1a6b05,_0x32781e,_0x3c1cae,_0x2145b2){var _0x1358a4={'method':_0x8fe1('0xb5'),'uri':_0x5a8fb4+_0x8fe1('0xb8')+_0x32781e+_0x8fe1('0xcb')+_0x3c1cae+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x8fe1('0xcc')+_0x2145b2,'If-None-Match':null,'OData-Version':_0x8fe1('0xb6')},'json':!![]};return rp(_0x1358a4)[_0x8fe1('0x20')](function(_0x3f4481){var _0x483014=[];var _0x3ceef1=_0x3f4481['OptionSet'][_0x8fe1('0xcd')];_0x3ceef1[_0x8fe1('0xbb')](function(_0x39f89c){_0x483014[_0x8fe1('0xbe')]({'name':_0x39f89c[_0x8fe1('0xce')][_0x8fe1('0xcf')]['Label'],'value':String(_0x39f89c['Value'])});});var _0x235f85={'id':_0x3e35b2+'_'+_0x3f4481[_0x8fe1('0xba')],'name':_0x3f4481[_0x8fe1('0xd0')][_0x8fe1('0xcf')][_0x8fe1('0xce')],'custom':![],'options':_0x483014};_0x1a6b05[_0x8fe1('0xbe')](_0x235f85);return _0x1a6b05;});}function getBooleanList(_0x2a2cac,_0x55e1da,_0x4839b4,_0x4e4424,_0x453d16,_0x1156d4){var _0x2582d6={'method':_0x8fe1('0xb5'),'uri':_0x2a2cac+_0x8fe1('0xb8')+_0x4e4424+_0x8fe1('0xcb')+_0x453d16+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x8fe1('0xcc')+_0x1156d4,'If-None-Match':null,'OData-Version':_0x8fe1('0xb6')},'json':!![]};return rp(_0x2582d6)[_0x8fe1('0x20')](function(_0x2aee24){var _0x5d4983=[];_0x5d4983[_0x8fe1('0xbe')]({'name':_0x2aee24['OptionSet'][_0x8fe1('0xd1')][_0x8fe1('0xce')][_0x8fe1('0xcf')]['Label'],'value':_0x8fe1('0xd2')},{'name':_0x2aee24[_0x8fe1('0xd3')][_0x8fe1('0xd4')][_0x8fe1('0xce')]['UserLocalizedLabel']['Label'],'value':_0x8fe1('0xd5')});var _0x4cbe4f={'id':_0x55e1da+'_'+_0x2aee24[_0x8fe1('0xba')],'name':_0x2aee24[_0x8fe1('0xd0')]['UserLocalizedLabel'][_0x8fe1('0xce')],'custom':![],'options':_0x5d4983};_0x4839b4[_0x8fe1('0xbe')](_0x4cbe4f);return _0x4839b4;});}function getInputList(_0x26f4d2,_0xa5b3b,_0x2618e6,_0x4ed9ca,_0x38c1d2,_0x11af04,_0xc62426){var _0x5dacdb={'method':_0x8fe1('0xb5'),'uri':_0x26f4d2+'EntityDefinitions('+_0x38c1d2+_0x8fe1('0xcb')+_0x11af04+_0x8fe1('0xd6')+_0x2618e6+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x8fe1('0xcc')+_0xc62426,'If-None-Match':null,'OData-Version':_0x8fe1('0xb6')},'json':!![]};return rp(_0x5dacdb)[_0x8fe1('0x20')](function(_0x603a34){var _0x2e4407={'id':_0xa5b3b+'_'+_0x603a34[_0x8fe1('0xba')],'name':_0x603a34[_0x8fe1('0xd0')][_0x8fe1('0xcf')]?_0x603a34[_0x8fe1('0xd0')][_0x8fe1('0xcf')][_0x8fe1('0xce')]:_0x603a34[_0x8fe1('0xba')],'custom':![],'options':[]};_0x4ed9ca[_0x8fe1('0xbe')](_0x2e4407);return _0x4ed9ca;});} \ No newline at end of file +var _0xfb63=['title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','tenantId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','/oauth2/token','clientId','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','send','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../components/integrations/configuration','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','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','addConfiguration','AccountId','Subjects','channel','getDescriptions','getFields','ticketType','Incident'];(function(_0x1b9169,_0x40f904){var _0x59ea07=function(_0x4c2bec){while(--_0x4c2bec){_0x1b9169['push'](_0x1b9169['shift']());}};_0x59ea07(++_0x40f904);}(_0xfb63,0x74));var _0x3fb6=function(_0x1b24f6,_0x38c2b9){_0x1b24f6=_0x1b24f6-0x0;var _0x13bcaa=_0xfb63[_0x1b24f6];return _0x13bcaa;};'use strict';var pdf=require(_0x3fb6('0x0'));var emlformat=require(_0x3fb6('0x1'));var rimraf=require(_0x3fb6('0x2'));var zipdir=require(_0x3fb6('0x3'));var jsonpatch=require(_0x3fb6('0x4'));var rp=require(_0x3fb6('0x5'));var moment=require(_0x3fb6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3fb6('0x7'));var util=require(_0x3fb6('0x8'));var path=require(_0x3fb6('0x9'));var sox=require(_0x3fb6('0xa'));var csv=require(_0x3fb6('0xb'));var ejs=require(_0x3fb6('0xc'));var fs=require('fs');var _=require(_0x3fb6('0xd'));var squel=require(_0x3fb6('0xe'));var crypto=require(_0x3fb6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3fb6('0x10'));var toCsv=require(_0x3fb6('0xb'));var querystring=require(_0x3fb6('0x11'));var Papa=require('papaparse');var Redis=require(_0x3fb6('0x12'));var authService=require(_0x3fb6('0x13'));var qs=require(_0x3fb6('0x14'));var as=require(_0x3fb6('0x15'));var hardwareService=require(_0x3fb6('0x16'));var logger=require(_0x3fb6('0x17'))(_0x3fb6('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x3fb6('0x19'));var jayson=require(_0x3fb6('0x1a'));var client=jayson[_0x3fb6('0x1b')][_0x3fb6('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2c24a6,_0x23f70a,_0x5eb860){if(_0x5eb860){var _0x4ca0d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ca0d3[_0x3fb6('0x1d')](_0x23f70a)){return _0x2c24a6;}else{throw new db[(_0x3fb6('0x1e'))]['ValidationError'](_0x3fb6('0x1f'));}}else{return _0x2c24a6;}}function respondWithRpcPromise(_0x17e16d,_0x49176e,_0x3520ca,_0x36db63){return new BPromise(function(_0x46ac54,_0x47739f){var _0x47ab1f=_0x36db63||client;return _0x47ab1f['request'](_0x17e16d,_0x3520ca)[_0x3fb6('0x20')](function(_0x128861){logger[_0x3fb6('0x21')](_0x3fb6('0x22'),_0x49176e,_0x3fb6('0x23'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x49176e,_0x3fb6('0x23'),JSON[_0x3fb6('0x24')](_0x128861));if(_0x128861[_0x3fb6('0x25')]){if(_0x128861[_0x3fb6('0x25')][_0x3fb6('0x26')]===0x1f4){logger[_0x3fb6('0x25')](_0x3fb6('0x22'),_0x49176e,_0x128861[_0x3fb6('0x25')][_0x3fb6('0x27')]);return _0x47739f(_0x128861[_0x3fb6('0x25')]['message']);}logger[_0x3fb6('0x25')](_0x3fb6('0x22'),_0x49176e,_0x128861[_0x3fb6('0x25')][_0x3fb6('0x27')]);return _0x46ac54(_0x128861[_0x3fb6('0x25')][_0x3fb6('0x27')]);}else{logger[_0x3fb6('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x49176e,_0x3fb6('0x23'));_0x46ac54(_0x128861['result']['message']);}})[_0x3fb6('0x28')](function(_0x4f76aa){logger[_0x3fb6('0x25')](_0x3fb6('0x22'),_0x49176e,_0x4f76aa);_0x47739f(_0x4f76aa);});});}function respondWithStatusCode(_0x110659,_0x4ea5d8){_0x4ea5d8=_0x4ea5d8||0xcc;return function(_0xfaa80c){if(_0xfaa80c){return _0x110659[_0x3fb6('0x29')](_0x4ea5d8);}return _0x110659[_0x3fb6('0x2a')](_0x4ea5d8)[_0x3fb6('0x2b')]();};}function respondWithResult(_0x5bcd69,_0x3857c4){_0x3857c4=_0x3857c4||0xc8;return function(_0x36e6b0){if(_0x36e6b0){return _0x5bcd69[_0x3fb6('0x2a')](_0x3857c4)[_0x3fb6('0x2c')](_0x36e6b0);}};}function respondWithFilteredResult(_0x47cdd3,_0x45769d){return function(_0x518ac3){if(_0x518ac3){var _0x300f0d=_0x518ac3[_0x3fb6('0x2d')],_0x5f3e73=_0x45769d[_0x3fb6('0x2e')],_0x2783c8=_0x45769d[_0x3fb6('0x2e')]+_0x45769d[_0x3fb6('0x2f')],_0x452f79;if(_0x2783c8>=_0x300f0d){_0x2783c8=_0x300f0d;_0x452f79=0xc8;}else{_0x452f79=0xce;}_0x47cdd3[_0x3fb6('0x2a')](_0x452f79);return _0x47cdd3[_0x3fb6('0x30')](_0x3fb6('0x31'),_0x5f3e73+'-'+_0x2783c8+'/'+_0x300f0d)[_0x3fb6('0x2c')](_0x518ac3);}return null;};}function patchUpdates(_0x4de544){return function(_0xb9adc1){try{jsonpatch[_0x3fb6('0x32')](_0xb9adc1,_0x4de544,!![]);}catch(_0x3a7aca){return BPromise[_0x3fb6('0x33')](_0x3a7aca);}return _0xb9adc1[_0x3fb6('0x34')]();};}function saveUpdates(_0x2cc06b,_0x587c27){return function(_0x5414ab){if(_0x5414ab){return _0x5414ab[_0x3fb6('0x35')](_0x2cc06b)['then'](function(_0x2fb38a){return _0x2fb38a;});}return null;};}function removeEntity(_0x4a2818,_0x558b6b){return function(_0x21a024){if(_0x21a024){return _0x21a024[_0x3fb6('0x36')]()[_0x3fb6('0x20')](function(){_0x4a2818[_0x3fb6('0x2a')](0xcc)[_0x3fb6('0x2b')]();});}};}function handleEntityNotFound(_0xec90e7,_0x41706d){return function(_0x13c32f){if(!_0x13c32f){_0xec90e7['sendStatus'](0x194);}return _0x13c32f;};}function handleError(_0x1f34d1,_0x1934af){_0x1934af=_0x1934af||0x1f4;return function(_0x414ef1){logger[_0x3fb6('0x25')](_0x414ef1[_0x3fb6('0x37')]);if(_0x414ef1['name']){delete _0x414ef1[_0x3fb6('0x38')];}_0x1f34d1[_0x3fb6('0x2a')](_0x1934af)['send'](_0x414ef1);};}exports[_0x3fb6('0x39')]=function(_0x2ba7db,_0x273e26){var _0x1e222c={},_0xc10fd3={},_0x376e90={'count':0x0,'rows':[]};var _0x5b4bd6=_[_0x3fb6('0x3a')](db[_0x3fb6('0x3b')][_0x3fb6('0x3c')],function(_0x131cff){return{'name':_0x131cff[_0x3fb6('0x3d')],'type':_0x131cff[_0x3fb6('0x3e')][_0x3fb6('0x3f')]};});_0xc10fd3[_0x3fb6('0x40')]=_[_0x3fb6('0x3a')](_0x5b4bd6,'name');_0xc10fd3['query']=_[_0x3fb6('0x41')](_0x2ba7db['query']);_0xc10fd3[_0x3fb6('0x42')]=_[_0x3fb6('0x43')](_0xc10fd3[_0x3fb6('0x40')],_0xc10fd3[_0x3fb6('0x44')]);_0x1e222c[_0x3fb6('0x45')]=_[_0x3fb6('0x43')](_0xc10fd3['model'],qs[_0x3fb6('0x46')](_0x2ba7db[_0x3fb6('0x44')]['fields']));_0x1e222c['attributes']=_0x1e222c['attributes']['length']?_0x1e222c[_0x3fb6('0x45')]:_0xc10fd3['model'];if(!_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x47')](_0x3fb6('0x48'))){_0x1e222c[_0x3fb6('0x2f')]=qs[_0x3fb6('0x2f')](_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x2f')]);_0x1e222c['offset']=qs[_0x3fb6('0x2e')](_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x2e')]);}_0x1e222c[_0x3fb6('0x49')]=qs[_0x3fb6('0x4a')](_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x4a')]);_0x1e222c[_0x3fb6('0x4b')]=qs['filters'](_[_0x3fb6('0x4c')](_0x2ba7db[_0x3fb6('0x44')],_0xc10fd3[_0x3fb6('0x42')]),_0x5b4bd6);if(_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x4d')]){_0x1e222c[_0x3fb6('0x4b')]=_[_0x3fb6('0x4e')](_0x1e222c['where'],{'$or':_[_0x3fb6('0x3a')](_0x5b4bd6,function(_0x33e974){if(_0x33e974[_0x3fb6('0x3e')]!=='VIRTUAL'){var _0x15a3c4={};_0x15a3c4[_0x33e974[_0x3fb6('0x38')]]={'$like':'%'+_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x4d')]+'%'};return _0x15a3c4;}})});}_0x1e222c=_[_0x3fb6('0x4e')]({},_0x1e222c,_0x2ba7db[_0x3fb6('0x4f')]);var _0x4e819a={'where':_0x1e222c[_0x3fb6('0x4b')]};return db[_0x3fb6('0x3b')][_0x3fb6('0x2d')](_0x4e819a)[_0x3fb6('0x20')](function(_0x25a6cf){_0x376e90[_0x3fb6('0x2d')]=_0x25a6cf;if(_0x2ba7db[_0x3fb6('0x44')][_0x3fb6('0x50')]){_0x1e222c[_0x3fb6('0x51')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x1e222c);})[_0x3fb6('0x20')](function(_0x2897e5){_0x376e90['rows']=_0x2897e5;return _0x376e90;})[_0x3fb6('0x20')](respondWithFilteredResult(_0x273e26,_0x1e222c))[_0x3fb6('0x28')](handleError(_0x273e26,null));};exports[_0x3fb6('0x52')]=function(_0x1c1833,_0x498fbd){var _0x42a80b={'raw':![],'where':{'id':_0x1c1833[_0x3fb6('0x53')]['id']}},_0x4450ac={};_0x4450ac[_0x3fb6('0x40')]=_[_0x3fb6('0x41')](db[_0x3fb6('0x3b')]['rawAttributes']);_0x4450ac[_0x3fb6('0x44')]=_[_0x3fb6('0x41')](_0x1c1833[_0x3fb6('0x44')]);_0x4450ac[_0x3fb6('0x42')]=_[_0x3fb6('0x43')](_0x4450ac[_0x3fb6('0x40')],_0x4450ac[_0x3fb6('0x44')]);_0x42a80b[_0x3fb6('0x45')]=_[_0x3fb6('0x43')](_0x4450ac['model'],qs['fields'](_0x1c1833['query'][_0x3fb6('0x46')]));_0x42a80b[_0x3fb6('0x45')]=_0x42a80b[_0x3fb6('0x45')]['length']?_0x42a80b[_0x3fb6('0x45')]:_0x4450ac['model'];if(_0x1c1833[_0x3fb6('0x44')][_0x3fb6('0x50')]){_0x42a80b[_0x3fb6('0x51')]=[{'all':!![]}];}_0x42a80b=_[_0x3fb6('0x4e')]({},_0x42a80b,_0x1c1833[_0x3fb6('0x4f')]);return db[_0x3fb6('0x3b')][_0x3fb6('0x54')](_0x42a80b)[_0x3fb6('0x20')](handleEntityNotFound(_0x498fbd,null))[_0x3fb6('0x20')](respondWithResult(_0x498fbd,null))[_0x3fb6('0x28')](handleError(_0x498fbd,null));};exports[_0x3fb6('0x55')]=function(_0x275371,_0x14590d){return db[_0x3fb6('0x3b')][_0x3fb6('0x55')](_0x275371[_0x3fb6('0x56')],{})[_0x3fb6('0x20')](respondWithResult(_0x14590d,0xc9))['catch'](handleError(_0x14590d,null));};exports[_0x3fb6('0x35')]=function(_0x28d6f7,_0x205958){if(_0x28d6f7[_0x3fb6('0x56')]['id']){delete _0x28d6f7['body']['id'];}return db['Dynamics365Account'][_0x3fb6('0x54')]({'where':{'id':_0x28d6f7[_0x3fb6('0x53')]['id']}})[_0x3fb6('0x20')](handleEntityNotFound(_0x205958,null))[_0x3fb6('0x20')](saveUpdates(_0x28d6f7[_0x3fb6('0x56')],null))[_0x3fb6('0x20')](respondWithResult(_0x205958,null))[_0x3fb6('0x28')](handleError(_0x205958,null));};exports['destroy']=function(_0x799d8f,_0x447563){return db[_0x3fb6('0x3b')][_0x3fb6('0x54')]({'where':{'id':_0x799d8f[_0x3fb6('0x53')]['id']}})[_0x3fb6('0x20')](handleEntityNotFound(_0x447563,null))['then'](removeEntity(_0x447563,null))[_0x3fb6('0x28')](handleError(_0x447563,null));};exports[_0x3fb6('0x57')]=function(_0x55c0a0,_0x1772e3,_0x4d7d25){var _0x12f291={};var _0xdd34dc={};var _0x5b2d38;var _0x2e4597;return db['Dynamics365Account'][_0x3fb6('0x58')]({'where':{'id':_0x55c0a0[_0x3fb6('0x53')]['id']}})['then'](handleEntityNotFound(_0x1772e3,null))[_0x3fb6('0x20')](function(_0x1a83d4){if(_0x1a83d4){_0x5b2d38=_0x1a83d4;_0xdd34dc[_0x3fb6('0x40')]=_[_0x3fb6('0x41')](db[_0x3fb6('0x59')][_0x3fb6('0x3c')]);_0xdd34dc[_0x3fb6('0x44')]=_[_0x3fb6('0x41')](_0x55c0a0[_0x3fb6('0x44')]);_0xdd34dc[_0x3fb6('0x42')]=_[_0x3fb6('0x43')](_0xdd34dc['model'],_0xdd34dc[_0x3fb6('0x44')]);_0x12f291[_0x3fb6('0x45')]=_[_0x3fb6('0x43')](_0xdd34dc[_0x3fb6('0x40')],qs[_0x3fb6('0x46')](_0x55c0a0[_0x3fb6('0x44')]['fields']));_0x12f291[_0x3fb6('0x45')]=_0x12f291[_0x3fb6('0x45')]['length']?_0x12f291[_0x3fb6('0x45')]:_0xdd34dc['model'];_0x12f291[_0x3fb6('0x49')]=qs['sort'](_0x55c0a0[_0x3fb6('0x44')][_0x3fb6('0x4a')]);_0x12f291[_0x3fb6('0x4b')]=qs[_0x3fb6('0x42')](_[_0x3fb6('0x4c')](_0x55c0a0[_0x3fb6('0x44')],_0xdd34dc[_0x3fb6('0x42')]));if(_0x55c0a0[_0x3fb6('0x44')]['filter']){_0x12f291[_0x3fb6('0x4b')]=_[_0x3fb6('0x4e')](_0x12f291[_0x3fb6('0x4b')],{'$or':_['map'](_0x12f291['attributes'],function(_0x40bbfd){var _0x22a0f5={};_0x22a0f5[_0x40bbfd]={'$like':'%'+_0x55c0a0[_0x3fb6('0x44')]['filter']+'%'};return _0x22a0f5;})});}_0x12f291=_[_0x3fb6('0x4e')]({},_0x12f291,_0x55c0a0[_0x3fb6('0x4f')]);return _0x5b2d38['getConfigurations'](_0x12f291);}})[_0x3fb6('0x20')](function(_0x49b51e){if(_0x49b51e){_0x2e4597=_0x49b51e[_0x3fb6('0x5a')];if(!_0x55c0a0[_0x3fb6('0x44')]['hasOwnProperty'](_0x3fb6('0x48'))){_0x12f291[_0x3fb6('0x2f')]=qs['limit'](_0x55c0a0['query'][_0x3fb6('0x2f')]);_0x12f291[_0x3fb6('0x2e')]=qs[_0x3fb6('0x2e')](_0x55c0a0['query'][_0x3fb6('0x2e')]);}return _0x5b2d38[_0x3fb6('0x57')](_0x12f291);}})[_0x3fb6('0x20')](function(_0x30dea3){if(_0x30dea3){return _0x30dea3?{'count':_0x2e4597,'rows':_0x30dea3}:null;}})[_0x3fb6('0x20')](respondWithResult(_0x1772e3,null))[_0x3fb6('0x28')](handleError(_0x1772e3,null));};exports[_0x3fb6('0x5b')]=function(_0x470dbf,_0x2ebadf,_0x156290){if(_0x470dbf[_0x3fb6('0x56')]['id']){delete _0x470dbf[_0x3fb6('0x56')]['id'];}return db[_0x3fb6('0x3b')][_0x3fb6('0x58')]({'where':{'id':_0x470dbf[_0x3fb6('0x53')]['id']}})[_0x3fb6('0x20')](handleEntityNotFound(_0x2ebadf,null))['then'](function(_0x2c7ac2){if(_0x2c7ac2){_0x470dbf[_0x3fb6('0x56')][_0x3fb6('0x5c')]=_0x2c7ac2['id'];_0x470dbf[_0x3fb6('0x56')][_0x3fb6('0x5d')]=integrations['getSubjects'](_0x470dbf[_0x3fb6('0x56')][_0x3fb6('0x5e')],_0x470dbf['body'][_0x3fb6('0x3e')]);_0x470dbf[_0x3fb6('0x56')]['Descriptions']=integrations[_0x3fb6('0x5f')](_0x470dbf[_0x3fb6('0x56')][_0x3fb6('0x5e')],_0x470dbf[_0x3fb6('0x56')][_0x3fb6('0x3e')]);return db[_0x3fb6('0x59')][_0x3fb6('0x55')](_0x470dbf[_0x3fb6('0x56')],{'include':[{'model':db['Dynamics365Field'],'as':_0x3fb6('0x5d')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x3fb6('0x20')](respondWithResult(_0x2ebadf,null))[_0x3fb6('0x28')](handleError(_0x2ebadf,null));};exports[_0x3fb6('0x60')]=function(_0x6e7594,_0x451ccb,_0x3ec6da){var _0x359cc2=_0x6e7594[_0x3fb6('0x44')][_0x3fb6('0x61')];var _0x350b17=_0x359cc2==='incident'?_0x3fb6('0x62'):'PhoneCall';var _0x92007='';var _0x586143='';var _0x5221ba='';var _0xd7d4af='';var _0x41ae8f='';var _0x3518fa='';var _0x283ade='';var _0x5a74d1='';var _0x3d6299=[_0x3fb6('0x63'),_0x3fb6('0x64'),_0x3fb6('0x65'),_0x3fb6('0x66'),_0x3fb6('0x67'),_0x3fb6('0x68'),_0x3fb6('0x69'),_0x3fb6('0x6a'),_0x3fb6('0x6b'),_0x3fb6('0x6c')];var _0x502447=['accountidname',_0x3fb6('0x6d'),_0x3fb6('0x6e'),_0x3fb6('0x6f'),_0x3fb6('0x70'),_0x3fb6('0x71'),'contractdetailidname','contractidname',_0x3fb6('0x72'),_0x3fb6('0x73'),_0x3fb6('0x74'),_0x3fb6('0x75'),_0x3fb6('0x76'),_0x3fb6('0x77'),_0x3fb6('0x78'),_0x3fb6('0x79'),_0x3fb6('0x7a'),'customeridyominame',_0x3fb6('0x7b'),_0x3fb6('0x7c'),'entityimage_timestamp',_0x3fb6('0x7d'),_0x3fb6('0x7e'),_0x3fb6('0x7f'),_0x3fb6('0x80'),_0x3fb6('0x81'),'importsequencenumber',_0x3fb6('0x82'),_0x3fb6('0x83'),_0x3fb6('0x84'),'masteridname',_0x3fb6('0x85'),_0x3fb6('0x86'),_0x3fb6('0x87'),'modifiedbyyominame',_0x3fb6('0x88'),'modifiedonbehalfbyname',_0x3fb6('0x89'),_0x3fb6('0x8a'),_0x3fb6('0x8b'),_0x3fb6('0x8c'),_0x3fb6('0x8d'),_0x3fb6('0x8e'),'owneridname',_0x3fb6('0x8f'),_0x3fb6('0x90'),_0x3fb6('0x91'),_0x3fb6('0x92'),_0x3fb6('0x93'),_0x3fb6('0x94'),_0x3fb6('0x95'),_0x3fb6('0x96'),_0x3fb6('0x97'),'resolvebykpiidname',_0x3fb6('0x98'),_0x3fb6('0x99'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x3fb6('0x9a'),_0x3fb6('0x9b'),'statecode',_0x3fb6('0x9c'),_0x3fb6('0x9d'),_0x3fb6('0x9e'),_0x3fb6('0x9f'),_0x3fb6('0xa0'),_0x3fb6('0xa1'),_0x3fb6('0xa2'),'versionnumber'];var _0x50f283=_0x3d6299[_0x3fb6('0xa3')](_0x502447);return db[_0x3fb6('0x3b')][_0x3fb6('0x58')]({'where':{'id':_0x6e7594[_0x3fb6('0x53')]['id']},'attributes':['id',_0x3fb6('0xa4'),_0x3fb6('0xa5'),'remoteUri',_0x3fb6('0xa6'),'clientId',_0x3fb6('0xa7')]})['then'](handleEntityNotFound(_0x451ccb,null))[_0x3fb6('0x20')](function(_0x2895ba){if(_0x2895ba){_0x5a74d1=_0x2895ba['remoteUri'];var _0x197548=_0x5a74d1[_0x3fb6('0xa8')](-0x1);if(_0x197548==='/'){_0x5a74d1=_0x5a74d1[_0x3fb6('0xa9')](0x0,_0x5a74d1[_0x3fb6('0xaa')](_0x197548));}_0x283ade=util['format'](_0x3fb6('0xab'),_0x5a74d1);var _0x8f1fba={'method':_0x3fb6('0xac'),'uri':'https://login.microsoftonline.com/'+_0x2895ba[_0x3fb6('0xa6')]+_0x3fb6('0xad'),'form':{'client_id':_0x2895ba[_0x3fb6('0xae')],'resource':_0x5a74d1,'username':_0x2895ba[_0x3fb6('0xa4')],'password':_0x2895ba[_0x3fb6('0xa5')],'grant_type':_0x3fb6('0xa5'),'client_secret':_0x2895ba[_0x3fb6('0xa7')]},'json':!![]};return rp(_0x8f1fba);}})[_0x3fb6('0x20')](function(_0x37f776){_0x3518fa=_0x37f776[_0x3fb6('0xaf')];var _0x461744={'method':'GET','uri':encodeURI(_0x283ade+_0x3fb6('0xb0')+_0x350b17+'\x27'),'headers':{'Authorization':_0x3fb6('0xb1')+_0x3518fa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x461744);})['then'](function(_0x37ecac){var _0x586622=_0x37ecac[_0x3fb6('0xb2')][0x0];var _0x2680e8=_0x586622[_0x3fb6('0xb3')];var _0x5542aa={'method':'GET','uri':_0x283ade+_0x3fb6('0xb4')+_0x2680e8+_0x3fb6('0xb5'),'headers':{'Authorization':_0x3fb6('0xb1')+_0x3518fa,'If-None-Match':null,'OData-Version':_0x3fb6('0xb6')},'json':!![]};return rp(_0x5542aa);})[_0x3fb6('0x20')](function(_0x597aa3){_0x92007=_0x597aa3;_0x586143=_0x92007[_0x3fb6('0xb7')];_0x586143=_['remove'](_0x586143,function(_0x51b339){return!_0x50f283['includes'](_0x51b339['LogicalName']);});var _0x6d8dad=[];var _0x2f04ed=[];_0x586143[_0x3fb6('0xb8')](function(_0x103bb8){if(_0x103bb8[_0x3fb6('0xb9')]){var _0x5807d6=_0x103bb8[_0x3fb6('0xb9')][_0x3fb6('0xa9')](_0x103bb8['@odata.type'][_0x3fb6('0xaa')]('.')+0x1);if(_0x5807d6===_0x3fb6('0xba')){_0x6d8dad[_0x3fb6('0xbb')](getSelectList(_0x283ade,_0x359cc2,_0x2f04ed,_0x92007['MetadataId'],_0x103bb8[_0x3fb6('0xb3')],_0x3518fa));}}});return Promise[_0x3fb6('0xbc')](_0x6d8dad);})[_0x3fb6('0x20')](function(_0x451620){_0x5221ba=_0x451620[0x0];var _0x414162=[];var _0x4de4ca=[];_0x586143[_0x3fb6('0xb8')](function(_0x2adbe0){if(!_['isNil'](_0x2adbe0[_0x3fb6('0xb9')])){var _0x38b167=_0x2adbe0['@odata.type'][_0x3fb6('0xa9')](_0x2adbe0[_0x3fb6('0xb9')]['lastIndexOf']('.')+0x1);if(_0x38b167===_0x3fb6('0xbd')){_0x414162['push'](getBooleanList(_0x283ade,_0x359cc2,_0x4de4ca,_0x92007[_0x3fb6('0xb3')],_0x2adbe0['MetadataId'],_0x3518fa));}}});return Promise[_0x3fb6('0xbc')](_0x414162);})[_0x3fb6('0x20')](function(_0x25c6ab){_0xd7d4af=_0x25c6ab[0x0];var _0x5ae078=[];var _0x1549d1=[];_0x586143['forEach'](function(_0x1f3c47){if(_0x1f3c47[_0x3fb6('0xb9')]){var _0x1edd3f=_0x1f3c47[_0x3fb6('0xb9')][_0x3fb6('0xa9')](_0x1f3c47[_0x3fb6('0xb9')][_0x3fb6('0xaa')]('.')+0x1);if(_0x1edd3f===_0x3fb6('0xbe')||_0x1edd3f===_0x3fb6('0xbf')||_0x1edd3f===_0x3fb6('0xc0')||_0x1edd3f===_0x3fb6('0xc1')||_0x1edd3f===_0x3fb6('0xc2')||_0x1edd3f==='DateTimeAttributeMetadata'||_0x1edd3f===_0x3fb6('0xc3')||_0x1edd3f===_0x3fb6('0xc4')||_0x1edd3f===_0x3fb6('0xc5')||_0x1edd3f===_0x3fb6('0xc6')){_0x5ae078['push'](getInputList(_0x283ade,_0x359cc2,_0x1edd3f,_0x1549d1,_0x92007[_0x3fb6('0xb3')],_0x1f3c47[_0x3fb6('0xb3')],_0x3518fa));}}});return Promise[_0x3fb6('0xbc')](_0x5ae078);})[_0x3fb6('0x20')](function(_0x1dfdc){_0x41ae8f=_0x1dfdc[0x0];var _0x2e0451=_0x5221ba[_0x3fb6('0xa3')](_0xd7d4af)['concat'](_0x41ae8f);var _0x32f8ca={'count':_0x2e0451[_0x3fb6('0x5a')],'rows':_0x2e0451};return _0x32f8ca;})[_0x3fb6('0x20')](respondWithResult(_0x451ccb,null))[_0x3fb6('0x28')](function(_0x2f1299){var _0x14b0a5=_0x6e7594['query'][_0x3fb6('0x1d')]?0x1f4:_0x2f1299[_0x3fb6('0xc7')]||0x1f4;logger['error'](_0x2f1299[_0x3fb6('0x37')]);delete _0x2f1299['name'];if(_0x14b0a5===0x191){_0x14b0a5=0x190;}_0x451ccb[_0x3fb6('0x2a')](_0x14b0a5)[_0x3fb6('0xc8')](_0x6e7594[_0x3fb6('0x44')][_0x3fb6('0x1d')]?{'message':'Wrong\x20credentials','statusCode':_0x2f1299['statusCode']}:_0x2f1299);});};function getSelectList(_0x199490,_0x27c709,_0x569649,_0x261b7b,_0x2b62d3,_0x4aff6a){var _0x4662b6={'method':_0x3fb6('0xc9'),'uri':_0x199490+_0x3fb6('0xb4')+_0x261b7b+_0x3fb6('0xca')+_0x2b62d3+_0x3fb6('0xcb')+_0x3fb6('0xcc'),'headers':{'Authorization':'Bearer\x20'+_0x4aff6a,'If-None-Match':null,'OData-Version':_0x3fb6('0xb6')},'json':!![]};return rp(_0x4662b6)[_0x3fb6('0x20')](function(_0x3bab04){var _0x2ff60d=[];var _0x32972c=_0x3bab04[_0x3fb6('0xcd')]['Options'];_0x32972c[_0x3fb6('0xb8')](function(_0x3c6b2f){_0x2ff60d[_0x3fb6('0xbb')]({'name':_0x3c6b2f[_0x3fb6('0xce')]['UserLocalizedLabel'][_0x3fb6('0xce')],'value':String(_0x3c6b2f[_0x3fb6('0xcf')])});});var _0x2e4c99={'id':_0x27c709+'_'+_0x3bab04[_0x3fb6('0xd0')],'name':_0x3bab04[_0x3fb6('0xd1')][_0x3fb6('0xd2')][_0x3fb6('0xce')],'custom':![],'options':_0x2ff60d};_0x569649[_0x3fb6('0xbb')](_0x2e4c99);return _0x569649;});}function getBooleanList(_0x954d04,_0x3a6d65,_0xed892a,_0x19c227,_0x543d06,_0x49259e){var _0x11bb4b={'method':_0x3fb6('0xc9'),'uri':_0x954d04+_0x3fb6('0xb4')+_0x19c227+_0x3fb6('0xca')+_0x543d06+_0x3fb6('0xd3'),'headers':{'Authorization':'Bearer\x20'+_0x49259e,'If-None-Match':null,'OData-Version':_0x3fb6('0xb6')},'json':!![]};return rp(_0x11bb4b)['then'](function(_0x40a5b6){var _0x322d5c=[];_0x322d5c[_0x3fb6('0xbb')]({'name':_0x40a5b6[_0x3fb6('0xcd')]['TrueOption'][_0x3fb6('0xce')]['UserLocalizedLabel'][_0x3fb6('0xce')],'value':_0x3fb6('0xd4')},{'name':_0x40a5b6[_0x3fb6('0xcd')][_0x3fb6('0xd5')][_0x3fb6('0xce')][_0x3fb6('0xd2')][_0x3fb6('0xce')],'value':_0x3fb6('0xd6')});var _0x3a5f35={'id':_0x3a6d65+'_'+_0x40a5b6[_0x3fb6('0xd0')],'name':_0x40a5b6[_0x3fb6('0xd1')]['UserLocalizedLabel'][_0x3fb6('0xce')],'custom':![],'options':_0x322d5c};_0xed892a['push'](_0x3a5f35);return _0xed892a;});}function getInputList(_0xe90a73,_0x1f7a4a,_0x4a3395,_0x20f960,_0x43de29,_0x36f598,_0x525900){var _0x106b1d={'method':_0x3fb6('0xc9'),'uri':_0xe90a73+_0x3fb6('0xb4')+_0x43de29+_0x3fb6('0xca')+_0x36f598+')/Microsoft.Dynamics.CRM.'+_0x4a3395+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x3fb6('0xb1')+_0x525900,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x106b1d)[_0x3fb6('0x20')](function(_0x2fa971){var _0x3010d1={'id':_0x1f7a4a+'_'+_0x2fa971[_0x3fb6('0xd0')],'name':_0x2fa971[_0x3fb6('0xd1')][_0x3fb6('0xd2')]?_0x2fa971[_0x3fb6('0xd1')][_0x3fb6('0xd2')][_0x3fb6('0xce')]:_0x2fa971[_0x3fb6('0xd0')],'custom':![],'options':[]};_0x20f960[_0x3fb6('0xbb')](_0x3010d1);return _0x20f960;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index db07110..256e909 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 _0x4282=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x4b33c0,_0x17fb55){var _0x43c889=function(_0x410c0d){while(--_0x410c0d){_0x4b33c0['push'](_0x4b33c0['shift']());}};_0x43c889(++_0x17fb55);}(_0x4282,0x11e));var _0x2428=function(_0x47c1e9,_0x5026c9){_0x47c1e9=_0x47c1e9-0x0;var _0x2227c0=_0x4282[_0x47c1e9];return _0x2227c0;};'use strict';var _=require(_0x2428('0x0'));var util=require(_0x2428('0x1'));var logger=require(_0x2428('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2428('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2428('0x4'));var rimraf=require(_0x2428('0x5'));var config=require(_0x2428('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2428('0x7')]=function(_0x3cdc40,_0x3393d1){return _0x3cdc40[_0x2428('0x8')](_0x2428('0x9'),attributes,{'tableName':_0x2428('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee87=['define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','exports'];(function(_0x28fc06,_0x2eb2aa){var _0x5ce4b9=function(_0x1be951){while(--_0x1be951){_0x28fc06['push'](_0x28fc06['shift']());}};_0x5ce4b9(++_0x2eb2aa);}(_0xee87,0x10d));var _0x7ee8=function(_0x5ad815,_0x4785d3){_0x5ad815=_0x5ad815-0x0;var _0x2b65ce=_0xee87[_0x5ad815];return _0x2b65ce;};'use strict';var _=require('lodash');var util=require(_0x7ee8('0x0'));var logger=require(_0x7ee8('0x1'))(_0x7ee8('0x2'));var moment=require(_0x7ee8('0x3'));var BPromise=require(_0x7ee8('0x4'));var rp=require(_0x7ee8('0x5'));var fs=require('fs');var path=require(_0x7ee8('0x6'));var rimraf=require(_0x7ee8('0x7'));var config=require(_0x7ee8('0x8'));var attributes=require(_0x7ee8('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7ee8('0xa')]=function(_0x516d9e,_0x2dfed7){return _0x516d9e[_0x7ee8('0xb')](_0x7ee8('0xc'),attributes,{'tableName':_0x7ee8('0xd'),'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 5956091..77708a3 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 _0xe1d3=['map','model','GetDynamics365Account','ShowDynamics365Account','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xe1d3,0x159));var _0x3e1d=function(_0x259a78,_0x256404){_0x259a78=_0x259a78-0x0;var _0x10eb89=_0xe1d3[_0x259a78];return _0x10eb89;};'use strict';var _=require(_0x3e1d('0x0'));var util=require(_0x3e1d('0x1'));var moment=require(_0x3e1d('0x2'));var BPromise=require(_0x3e1d('0x3'));var rs=require(_0x3e1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1d('0x6'))(_0x3e1d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e1d('0x8')][_0x3e1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2caae6,_0x2b58a1,_0x2b5c34){return new BPromise(function(_0x4bf63b,_0xf4e7ca){return client[_0x3e1d('0xa')](_0x2caae6,_0x2b5c34)['then'](function(_0x3a7aab){logger[_0x3e1d('0xb')](_0x3e1d('0xc'),_0x2b58a1,_0x3e1d('0xd'));logger[_0x3e1d('0xe')](_0x3e1d('0xf'),_0x2b58a1,_0x3e1d('0xd'),JSON[_0x3e1d('0x10')](_0x3a7aab));if(_0x3a7aab[_0x3e1d('0x11')]){if(_0x3a7aab[_0x3e1d('0x11')][_0x3e1d('0x12')]===0x1f4){logger[_0x3e1d('0x11')](_0x3e1d('0xc'),_0x2b58a1,_0x3a7aab[_0x3e1d('0x11')]['message']);return _0xf4e7ca(_0x3a7aab[_0x3e1d('0x11')][_0x3e1d('0x13')]);}logger['error'](_0x3e1d('0xc'),_0x2b58a1,_0x3a7aab[_0x3e1d('0x11')]['message']);return _0x4bf63b(_0x3a7aab[_0x3e1d('0x11')][_0x3e1d('0x13')]);}else{logger[_0x3e1d('0xb')](_0x3e1d('0xc'),_0x2b58a1,_0x3e1d('0xd'));_0x4bf63b(_0x3a7aab['result'][_0x3e1d('0x13')]);}})[_0x3e1d('0x14')](function(_0x5549be){logger[_0x3e1d('0x11')](_0x3e1d('0xc'),_0x2b58a1,_0x5549be);_0xf4e7ca(_0x5549be);});});}exports['GetDynamics365Account']=function(_0x38a13f){var _0x46062f=this;return new Promise(function(_0x2e0007,_0x201482){return db[_0x3e1d('0x15')][_0x3e1d('0x16')]({'raw':_0x38a13f['options']?_0x38a13f[_0x3e1d('0x17')][_0x3e1d('0x18')]===undefined?!![]:![]:!![],'where':_0x38a13f['options']?_0x38a13f[_0x3e1d('0x17')][_0x3e1d('0x19')]||null:null,'attributes':_0x38a13f[_0x3e1d('0x17')]?_0x38a13f['options'][_0x3e1d('0x1a')]||null:null,'limit':_0x38a13f['options']?_0x38a13f[_0x3e1d('0x17')][_0x3e1d('0x1b')]||null:null,'include':_0x38a13f[_0x3e1d('0x17')]?_0x38a13f[_0x3e1d('0x17')][_0x3e1d('0x1c')]?_[_0x3e1d('0x1d')](_0x38a13f[_0x3e1d('0x17')][_0x3e1d('0x1c')],function(_0x2f4abb){return{'model':db[_0x2f4abb['model']],'as':_0x2f4abb['as'],'attributes':_0x2f4abb[_0x3e1d('0x1a')],'include':_0x2f4abb[_0x3e1d('0x1c')]?_[_0x3e1d('0x1d')](_0x2f4abb[_0x3e1d('0x1c')],function(_0x212c45){return{'model':db[_0x212c45[_0x3e1d('0x1e')]],'as':_0x212c45['as'],'attributes':_0x212c45['attributes'],'include':_0x212c45['include']?_['map'](_0x212c45[_0x3e1d('0x1c')],function(_0x8d01e2){return{'model':db[_0x8d01e2[_0x3e1d('0x1e')]],'as':_0x8d01e2['as'],'attributes':_0x8d01e2[_0x3e1d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13eb37){logger[_0x3e1d('0xb')](_0x3e1d('0x1f'),_0x38a13f);logger['debug']('GetDynamics365Account',_0x38a13f,JSON['stringify'](_0x13eb37));_0x2e0007(_0x13eb37);})[_0x3e1d('0x14')](function(_0x422f55){logger[_0x3e1d('0x11')](_0x3e1d('0x1f'),_0x422f55['message'],_0x38a13f);_0x201482(_0x46062f[_0x3e1d('0x11')](0x1f4,_0x422f55[_0x3e1d('0x13')]));});});};exports[_0x3e1d('0x20')]=function(_0x2e20c9){var _0x5c425f=this;return new Promise(function(_0x2597a2,_0x53a158){return db[_0x3e1d('0x15')]['find']({'raw':_0x2e20c9['options']?_0x2e20c9[_0x3e1d('0x17')][_0x3e1d('0x18')]===undefined?!![]:![]:!![],'where':_0x2e20c9[_0x3e1d('0x17')]?_0x2e20c9[_0x3e1d('0x17')][_0x3e1d('0x19')]||null:null,'attributes':_0x2e20c9[_0x3e1d('0x17')]?_0x2e20c9[_0x3e1d('0x17')][_0x3e1d('0x1a')]||null:null,'include':_0x2e20c9['options']?_0x2e20c9[_0x3e1d('0x17')]['include']?_[_0x3e1d('0x1d')](_0x2e20c9[_0x3e1d('0x17')][_0x3e1d('0x1c')],function(_0x33b615){return{'model':db[_0x33b615[_0x3e1d('0x1e')]],'as':_0x33b615['as'],'attributes':_0x33b615['attributes'],'include':_0x33b615[_0x3e1d('0x1c')]?_[_0x3e1d('0x1d')](_0x33b615[_0x3e1d('0x1c')],function(_0x28a789){return{'model':db[_0x28a789[_0x3e1d('0x1e')]],'as':_0x28a789['as'],'attributes':_0x28a789[_0x3e1d('0x1a')],'include':_0x28a789['include']?_[_0x3e1d('0x1d')](_0x28a789[_0x3e1d('0x1c')],function(_0x6f9c0){return{'model':db[_0x6f9c0[_0x3e1d('0x1e')]],'as':_0x6f9c0['as'],'attributes':_0x6f9c0[_0x3e1d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3e1d('0x21')](function(_0x558e46){logger[_0x3e1d('0xb')](_0x3e1d('0x20'),_0x2e20c9);logger['debug']('ShowDynamics365Account',_0x2e20c9,JSON['stringify'](_0x558e46));_0x2597a2(_0x558e46);})[_0x3e1d('0x14')](function(_0x29d1bd){logger['error']('ShowDynamics365Account',_0x29d1bd['message'],_0x2e20c9);_0x53a158(_0x5c425f['error'](0x1f4,_0x29d1bd['message']));});});}; \ No newline at end of file +var _0xa381=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5cc776,_0xdad861){var _0x3a8491=function(_0x1cce4a){while(--_0x1cce4a){_0x5cc776['push'](_0x5cc776['shift']());}};_0x3a8491(++_0xdad861);}(_0xa381,0x79));var _0x1a38=function(_0x1e203a,_0x397111){_0x1e203a=_0x1e203a-0x0;var _0x2a5006=_0xa381[_0x1e203a];return _0x2a5006;};'use strict';var _=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a38('0x2'));var fs=require('fs');var Redis=require(_0x1a38('0x3'));var db=require(_0x1a38('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a38('0x5'))(_0x1a38('0x6'));var config=require(_0x1a38('0x7'));var jayson=require(_0x1a38('0x8'));var client=jayson['client'][_0x1a38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569e9f,_0x5c8ab1,_0x3d12f8){return new BPromise(function(_0x4df1db,_0x46e61d){return client[_0x1a38('0xa')](_0x569e9f,_0x3d12f8)[_0x1a38('0xb')](function(_0x4676ff){logger['info'](_0x1a38('0xc'),_0x5c8ab1,_0x1a38('0xd'));logger[_0x1a38('0xe')](_0x1a38('0xf'),_0x5c8ab1,_0x1a38('0xd'),JSON[_0x1a38('0x10')](_0x4676ff));if(_0x4676ff[_0x1a38('0x11')]){if(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x12')]===0x1f4){logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);return _0x46e61d(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);}logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);return _0x4df1db(_0x4676ff[_0x1a38('0x11')][_0x1a38('0x13')]);}else{logger[_0x1a38('0x14')](_0x1a38('0xc'),_0x5c8ab1,'request\x20sent');_0x4df1db(_0x4676ff['result'][_0x1a38('0x13')]);}})['catch'](function(_0x424d27){logger[_0x1a38('0x11')](_0x1a38('0xc'),_0x5c8ab1,_0x424d27);_0x46e61d(_0x424d27);});});}exports[_0x1a38('0x15')]=function(_0x25ebb0){var _0x22ac36=this;return new Promise(function(_0x408e8f,_0x2aef00){return db[_0x1a38('0x16')]['findAll']({'raw':_0x25ebb0[_0x1a38('0x17')]?_0x25ebb0['options'][_0x1a38('0x18')]===undefined?!![]:![]:!![],'where':_0x25ebb0[_0x1a38('0x17')]?_0x25ebb0['options'][_0x1a38('0x19')]||null:null,'attributes':_0x25ebb0['options']?_0x25ebb0['options'][_0x1a38('0x1a')]||null:null,'limit':_0x25ebb0[_0x1a38('0x17')]?_0x25ebb0[_0x1a38('0x17')][_0x1a38('0x1b')]||null:null,'include':_0x25ebb0['options']?_0x25ebb0[_0x1a38('0x17')][_0x1a38('0x1c')]?_[_0x1a38('0x1d')](_0x25ebb0['options'][_0x1a38('0x1c')],function(_0x214228){return{'model':db[_0x214228[_0x1a38('0x1e')]],'as':_0x214228['as'],'attributes':_0x214228[_0x1a38('0x1a')],'include':_0x214228[_0x1a38('0x1c')]?_[_0x1a38('0x1d')](_0x214228[_0x1a38('0x1c')],function(_0x160ac1){return{'model':db[_0x160ac1[_0x1a38('0x1e')]],'as':_0x160ac1['as'],'attributes':_0x160ac1[_0x1a38('0x1a')],'include':_0x160ac1['include']?_[_0x1a38('0x1d')](_0x160ac1['include'],function(_0x398827){return{'model':db[_0x398827[_0x1a38('0x1e')]],'as':_0x398827['as'],'attributes':_0x398827['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a38('0xb')](function(_0x571533){logger[_0x1a38('0x14')](_0x1a38('0x15'),_0x25ebb0);logger[_0x1a38('0xe')]('GetDynamics365Account',_0x25ebb0,JSON['stringify'](_0x571533));_0x408e8f(_0x571533);})[_0x1a38('0x1f')](function(_0x2a4027){logger[_0x1a38('0x11')](_0x1a38('0x15'),_0x2a4027[_0x1a38('0x13')],_0x25ebb0);_0x2aef00(_0x22ac36[_0x1a38('0x11')](0x1f4,_0x2a4027[_0x1a38('0x13')]));});});};exports[_0x1a38('0x20')]=function(_0x50011f){var _0x5680bd=this;return new Promise(function(_0x1c940c,_0x464f0b){return db[_0x1a38('0x16')][_0x1a38('0x21')]({'raw':_0x50011f[_0x1a38('0x17')]?_0x50011f[_0x1a38('0x17')][_0x1a38('0x18')]===undefined?!![]:![]:!![],'where':_0x50011f['options']?_0x50011f[_0x1a38('0x17')]['where']||null:null,'attributes':_0x50011f[_0x1a38('0x17')]?_0x50011f[_0x1a38('0x17')][_0x1a38('0x1a')]||null:null,'include':_0x50011f[_0x1a38('0x17')]?_0x50011f[_0x1a38('0x17')]['include']?_[_0x1a38('0x1d')](_0x50011f[_0x1a38('0x17')][_0x1a38('0x1c')],function(_0x2255fc){return{'model':db[_0x2255fc[_0x1a38('0x1e')]],'as':_0x2255fc['as'],'attributes':_0x2255fc[_0x1a38('0x1a')],'include':_0x2255fc['include']?_[_0x1a38('0x1d')](_0x2255fc[_0x1a38('0x1c')],function(_0xe5cff5){return{'model':db[_0xe5cff5['model']],'as':_0xe5cff5['as'],'attributes':_0xe5cff5[_0x1a38('0x1a')],'include':_0xe5cff5[_0x1a38('0x1c')]?_['map'](_0xe5cff5['include'],function(_0x5fa5a9){return{'model':db[_0x5fa5a9[_0x1a38('0x1e')]],'as':_0x5fa5a9['as'],'attributes':_0x5fa5a9[_0x1a38('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1a38('0xb')](function(_0x490ab4){logger['info'](_0x1a38('0x20'),_0x50011f);logger[_0x1a38('0xe')](_0x1a38('0x20'),_0x50011f,JSON[_0x1a38('0x10')](_0x490ab4));_0x1c940c(_0x490ab4);})[_0x1a38('0x1f')](function(_0x3b3f27){logger[_0x1a38('0x11')](_0x1a38('0x20'),_0x3b3f27[_0x1a38('0x13')],_0x50011f);_0x464f0b(_0x5680bd[_0x1a38('0x11')](0x1f4,_0x3b3f27[_0x1a38('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e673f68..b3f8fe6 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 _0xb06b=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x56aa42,_0x49fdda){var _0x10e1f9=function(_0x128e5d){while(--_0x128e5d){_0x56aa42['push'](_0x56aa42['shift']());}};_0x10e1f9(++_0x49fdda);}(_0xb06b,0x9d));var _0xbb06=function(_0x1f0fd7,_0x59cc1b){_0x1f0fd7=_0x1f0fd7-0x0;var _0x850b9c=_0xb06b[_0x1f0fd7];return _0x850b9c;};'use strict';var multer=require(_0xbb06('0x0'));var util=require(_0xbb06('0x1'));var path=require(_0xbb06('0x2'));var timeout=require(_0xbb06('0x3'));var express=require('express');var router=express[_0xbb06('0x4')]();var auth=require(_0xbb06('0x5'));var interaction=require(_0xbb06('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xbb06('0x7')]('/',auth[_0xbb06('0x8')](),controller[_0xbb06('0x9')]);router['get'](_0xbb06('0xa'),auth[_0xbb06('0x8')](),controller[_0xbb06('0xb')]);router[_0xbb06('0x7')](_0xbb06('0xc'),auth[_0xbb06('0x8')](),controller[_0xbb06('0xd')]);router[_0xbb06('0x7')]('/:id/subjects',auth[_0xbb06('0x8')](),controller[_0xbb06('0xe')]);router[_0xbb06('0x7')](_0xbb06('0xf'),auth[_0xbb06('0x8')](),controller[_0xbb06('0x10')]);router[_0xbb06('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb06('0x12')]);router['put']('/:id',auth[_0xbb06('0x8')](),controller['update']);router[_0xbb06('0x13')](_0xbb06('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xbb06('0x14')]=router; \ No newline at end of file +var _0x428e=['getDescriptions','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x513674,_0x4a839c){var _0x303a93=function(_0x1cfdaf){while(--_0x1cfdaf){_0x513674['push'](_0x513674['shift']());}};_0x303a93(++_0x4a839c);}(_0x428e,0x1a4));var _0xe428=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x428e[_0x4df1f5];return _0x56585b;};'use strict';var multer=require('multer');var util=require(_0xe428('0x0'));var path=require(_0xe428('0x1'));var timeout=require(_0xe428('0x2'));var express=require(_0xe428('0x3'));var router=express[_0xe428('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe428('0x5'));var config=require(_0xe428('0x6'));var controller=require(_0xe428('0x7'));router['get']('/',auth[_0xe428('0x8')](),controller[_0xe428('0x9')]);router[_0xe428('0xa')](_0xe428('0xb'),auth[_0xe428('0x8')](),controller[_0xe428('0xc')]);router[_0xe428('0xa')](_0xe428('0xd'),auth[_0xe428('0x8')](),controller[_0xe428('0xe')]);router[_0xe428('0xa')](_0xe428('0xf'),auth[_0xe428('0x8')](),controller['getSubjects']);router[_0xe428('0xa')](_0xe428('0x10'),auth[_0xe428('0x8')](),controller[_0xe428('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe428('0x12')]);router[_0xe428('0x13')](_0xe428('0xb'),auth[_0xe428('0x8')](),controller[_0xe428('0x14')]);router[_0xe428('0x15')]('/:id',auth[_0xe428('0x8')](),controller['destroy']);module[_0xe428('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 063374f..2a04c5d 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 _0x5b35=['incident','exports','STRING'];(function(_0x5365b8,_0x3e45f2){var _0x418916=function(_0x5d51df){while(--_0x5d51df){_0x5365b8['push'](_0x5365b8['shift']());}};_0x418916(++_0x3e45f2);}(_0x5b35,0x127));var _0x55b3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5b35[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0x55b3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x55b3('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x55b3('0x2'),'phonecall'),'defaultValue':'incident'}}; \ No newline at end of file +var _0xc395=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xc395,0x14c));var _0x5c39=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xc395[_0x409353];return _0x4f4b59;};'use strict';var Sequelize=require(_0x5c39('0x0'));module[_0x5c39('0x1')]={'name':{'type':Sequelize[_0x5c39('0x2')]},'description':{'type':Sequelize[_0x5c39('0x2')]},'ticketType':{'type':Sequelize[_0x5c39('0x3')](_0x5c39('0x4'),_0x5c39('0x5')),'defaultValue':_0x5c39('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 805ce33..a006f47 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 _0xaea9=['ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','end','status','count','offset','apply','reject','update','sendStatus','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','include','catch','show','params','rawAttributes','find','create','body','destroy','findOne','Dynamics365Field','getFields','hasOwnProperty','nolimit','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaea9,0xa7));var _0x9aea=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xaea9[_0x1cfa0d];return _0xe33279;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9aea('0x0'));var zipdir=require(_0x9aea('0x1'));var jsonpatch=require(_0x9aea('0x2'));var rp=require(_0x9aea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9aea('0x4'));var path=require('path');var sox=require(_0x9aea('0x5'));var csv=require(_0x9aea('0x6'));var ejs=require(_0x9aea('0x7'));var fs=require('fs');var _=require(_0x9aea('0x8'));var squel=require(_0x9aea('0x9'));var crypto=require(_0x9aea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9aea('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9aea('0xc'));var Redis=require(_0x9aea('0xd'));var authService=require(_0x9aea('0xe'));var qs=require(_0x9aea('0xf'));var as=require(_0x9aea('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9aea('0x11'))(_0x9aea('0x12'));var utils=require(_0x9aea('0x13'));var config=require('../../config/environment');var db=require(_0x9aea('0x14'))['db'];var jayson=require(_0x9aea('0x15'));var client=jayson[_0x9aea('0x16')][_0x9aea('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1c0502,_0x771712,_0xddeca4){if(_0xddeca4){var _0x9baffc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9baffc[_0x9aea('0x18')](_0x771712)){return _0x1c0502;}else{throw new db[(_0x9aea('0x19'))][(_0x9aea('0x1a'))](_0x9aea('0x1b'));}}else{return _0x1c0502;}}function respondWithRpcPromise(_0x4df457,_0x5a4013,_0x598926,_0x3cb802){return new BPromise(function(_0x265efb,_0x3d639a){var _0x449f51=_0x3cb802||client;return _0x449f51[_0x9aea('0x1c')](_0x4df457,_0x598926)[_0x9aea('0x1d')](function(_0x5349b1){logger[_0x9aea('0x1e')](_0x9aea('0x1f'),_0x5a4013,_0x9aea('0x20'));logger[_0x9aea('0x21')](_0x9aea('0x22'),_0x5a4013,_0x9aea('0x20'),JSON['stringify'](_0x5349b1));if(_0x5349b1[_0x9aea('0x23')]){if(_0x5349b1['error'][_0x9aea('0x24')]===0x1f4){logger[_0x9aea('0x23')](_0x9aea('0x1f'),_0x5a4013,_0x5349b1[_0x9aea('0x23')][_0x9aea('0x25')]);return _0x3d639a(_0x5349b1[_0x9aea('0x23')][_0x9aea('0x25')]);}logger[_0x9aea('0x23')](_0x9aea('0x1f'),_0x5a4013,_0x5349b1[_0x9aea('0x23')][_0x9aea('0x25')]);return _0x265efb(_0x5349b1[_0x9aea('0x23')][_0x9aea('0x25')]);}else{logger['info'](_0x9aea('0x1f'),_0x5a4013,_0x9aea('0x20'));_0x265efb(_0x5349b1['result'][_0x9aea('0x25')]);}})['catch'](function(_0x470df2){logger[_0x9aea('0x23')](_0x9aea('0x1f'),_0x5a4013,_0x470df2);_0x3d639a(_0x470df2);});});}function respondWithStatusCode(_0xd5bcc6,_0x571e68){_0x571e68=_0x571e68||0xcc;return function(_0x2af9b6){if(_0x2af9b6){return _0xd5bcc6['sendStatus'](_0x571e68);}return _0xd5bcc6['status'](_0x571e68)[_0x9aea('0x26')]();};}function respondWithResult(_0x11e168,_0x553fac){_0x553fac=_0x553fac||0xc8;return function(_0x302e08){if(_0x302e08){return _0x11e168[_0x9aea('0x27')](_0x553fac)['json'](_0x302e08);}};}function respondWithFilteredResult(_0x4b67d2,_0x4253aa){return function(_0x4d1e41){if(_0x4d1e41){var _0x1f1d25=_0x4d1e41[_0x9aea('0x28')],_0x2c8ba4=_0x4253aa['offset'],_0x9eb6bd=_0x4253aa[_0x9aea('0x29')]+_0x4253aa['limit'],_0x18da04;if(_0x9eb6bd>=_0x1f1d25){_0x9eb6bd=_0x1f1d25;_0x18da04=0xc8;}else{_0x18da04=0xce;}_0x4b67d2[_0x9aea('0x27')](_0x18da04);return _0x4b67d2['set']('Content-Range',_0x2c8ba4+'-'+_0x9eb6bd+'/'+_0x1f1d25)['json'](_0x4d1e41);}return null;};}function patchUpdates(_0x4a581c){return function(_0x55bb3c){try{jsonpatch[_0x9aea('0x2a')](_0x55bb3c,_0x4a581c,!![]);}catch(_0x12db44){return BPromise[_0x9aea('0x2b')](_0x12db44);}return _0x55bb3c['save']();};}function saveUpdates(_0x50a653,_0x1126b7){return function(_0x37380d){if(_0x37380d){return _0x37380d[_0x9aea('0x2c')](_0x50a653)[_0x9aea('0x1d')](function(_0x55f8e2){return _0x55f8e2;});}return null;};}function removeEntity(_0x447119,_0x136af8){return function(_0x3763b5){if(_0x3763b5){return _0x3763b5['destroy']()['then'](function(){_0x447119[_0x9aea('0x27')](0xcc)[_0x9aea('0x26')]();});}};}function handleEntityNotFound(_0x3fc670,_0x1e0509){return function(_0x26cc4b){if(!_0x26cc4b){_0x3fc670[_0x9aea('0x2d')](0x194);}return _0x26cc4b;};}function handleError(_0x84ea09,_0x467373){_0x467373=_0x467373||0x1f4;return function(_0x5b2a5b){logger[_0x9aea('0x23')](_0x5b2a5b[_0x9aea('0x2e')]);if(_0x5b2a5b[_0x9aea('0x2f')]){delete _0x5b2a5b[_0x9aea('0x2f')];}_0x84ea09[_0x9aea('0x27')](_0x467373)[_0x9aea('0x30')](_0x5b2a5b);};}exports[_0x9aea('0x31')]=function(_0x34932e,_0x52de89){var _0x10b898={},_0x1ec326={},_0x342f97={'count':0x0,'rows':[]};var _0x3fe757=_[_0x9aea('0x32')](db['Dynamics365Configuration']['rawAttributes'],function(_0x13c400){return{'name':_0x13c400[_0x9aea('0x33')],'type':_0x13c400[_0x9aea('0x34')]['key']};});_0x1ec326[_0x9aea('0x35')]=_[_0x9aea('0x32')](_0x3fe757,_0x9aea('0x2f'));_0x1ec326['query']=_[_0x9aea('0x36')](_0x34932e[_0x9aea('0x37')]);_0x1ec326[_0x9aea('0x38')]=_[_0x9aea('0x39')](_0x1ec326[_0x9aea('0x35')],_0x1ec326[_0x9aea('0x37')]);_0x10b898[_0x9aea('0x3a')]=_[_0x9aea('0x39')](_0x1ec326['model'],qs[_0x9aea('0x3b')](_0x34932e[_0x9aea('0x37')]['fields']));_0x10b898[_0x9aea('0x3a')]=_0x10b898[_0x9aea('0x3a')][_0x9aea('0x3c')]?_0x10b898[_0x9aea('0x3a')]:_0x1ec326[_0x9aea('0x35')];if(!_0x34932e['query']['hasOwnProperty']('nolimit')){_0x10b898['limit']=qs[_0x9aea('0x3d')](_0x34932e[_0x9aea('0x37')][_0x9aea('0x3d')]);_0x10b898[_0x9aea('0x29')]=qs[_0x9aea('0x29')](_0x34932e[_0x9aea('0x37')][_0x9aea('0x29')]);}_0x10b898['order']=qs[_0x9aea('0x3e')](_0x34932e[_0x9aea('0x37')][_0x9aea('0x3e')]);_0x10b898[_0x9aea('0x3f')]=qs[_0x9aea('0x38')](_[_0x9aea('0x40')](_0x34932e['query'],_0x1ec326[_0x9aea('0x38')]),_0x3fe757);if(_0x34932e['query'][_0x9aea('0x41')]){_0x10b898['where']=_[_0x9aea('0x42')](_0x10b898['where'],{'$or':_['map'](_0x3fe757,function(_0x3976fb){if(_0x3976fb['type']!==_0x9aea('0x43')){var _0x5931e2={};_0x5931e2[_0x3976fb[_0x9aea('0x2f')]]={'$like':'%'+_0x34932e['query'][_0x9aea('0x41')]+'%'};return _0x5931e2;}})});}_0x10b898=_[_0x9aea('0x42')]({},_0x10b898,_0x34932e[_0x9aea('0x44')]);var _0x576d02={'where':_0x10b898[_0x9aea('0x3f')]};return db[_0x9aea('0x45')][_0x9aea('0x28')](_0x576d02)[_0x9aea('0x1d')](function(_0x1e2cb5){_0x342f97['count']=_0x1e2cb5;if(_0x34932e[_0x9aea('0x37')]['includeAll']){_0x10b898[_0x9aea('0x46')]=[{'all':!![]}];}return db[_0x9aea('0x45')]['findAll'](_0x10b898);})[_0x9aea('0x1d')](function(_0x277e4d){_0x342f97['rows']=_0x277e4d;return _0x342f97;})[_0x9aea('0x1d')](respondWithFilteredResult(_0x52de89,_0x10b898))[_0x9aea('0x47')](handleError(_0x52de89,null));};exports[_0x9aea('0x48')]=function(_0x4f1f40,_0x3b763b){var _0x61ac30={'raw':![],'where':{'id':_0x4f1f40[_0x9aea('0x49')]['id']}},_0x3ae5a2={};_0x3ae5a2[_0x9aea('0x35')]=_[_0x9aea('0x36')](db[_0x9aea('0x45')][_0x9aea('0x4a')]);_0x3ae5a2[_0x9aea('0x37')]=_[_0x9aea('0x36')](_0x4f1f40[_0x9aea('0x37')]);_0x3ae5a2[_0x9aea('0x38')]=_['intersection'](_0x3ae5a2['model'],_0x3ae5a2[_0x9aea('0x37')]);_0x61ac30[_0x9aea('0x3a')]=_[_0x9aea('0x39')](_0x3ae5a2[_0x9aea('0x35')],qs['fields'](_0x4f1f40[_0x9aea('0x37')]['fields']));_0x61ac30[_0x9aea('0x3a')]=_0x61ac30['attributes'][_0x9aea('0x3c')]?_0x61ac30[_0x9aea('0x3a')]:_0x3ae5a2['model'];if(_0x4f1f40[_0x9aea('0x37')]['includeAll']){_0x61ac30[_0x9aea('0x46')]=[{'all':!![]}];}_0x61ac30=_[_0x9aea('0x42')]({},_0x61ac30,_0x4f1f40[_0x9aea('0x44')]);return db[_0x9aea('0x45')][_0x9aea('0x4b')](_0x61ac30)['then'](handleEntityNotFound(_0x3b763b,null))[_0x9aea('0x1d')](respondWithResult(_0x3b763b,null))['catch'](handleError(_0x3b763b,null));};exports[_0x9aea('0x4c')]=function(_0x5dcb24,_0x22b23f){return db[_0x9aea('0x45')][_0x9aea('0x4c')](_0x5dcb24[_0x9aea('0x4d')],{})[_0x9aea('0x1d')](respondWithResult(_0x22b23f,0xc9))[_0x9aea('0x47')](handleError(_0x22b23f,null));};exports[_0x9aea('0x2c')]=function(_0x5297b8,_0x2a87cd){if(_0x5297b8[_0x9aea('0x4d')]['id']){delete _0x5297b8[_0x9aea('0x4d')]['id'];}return db[_0x9aea('0x45')][_0x9aea('0x4b')]({'where':{'id':_0x5297b8[_0x9aea('0x49')]['id']}})[_0x9aea('0x1d')](handleEntityNotFound(_0x2a87cd,null))['then'](saveUpdates(_0x5297b8[_0x9aea('0x4d')],null))[_0x9aea('0x1d')](respondWithResult(_0x2a87cd,null))['catch'](handleError(_0x2a87cd,null));};exports[_0x9aea('0x4e')]=function(_0x5e9b77,_0x479eb2){return db[_0x9aea('0x45')][_0x9aea('0x4b')]({'where':{'id':_0x5e9b77['params']['id']}})['then'](handleEntityNotFound(_0x479eb2,null))['then'](removeEntity(_0x479eb2,null))[_0x9aea('0x47')](handleError(_0x479eb2,null));};exports['getFields']=function(_0x3e6365,_0x2d012e,_0x587e3b){var _0x5a13b5={};var _0x2aa1b7={};var _0x1f4733;var _0x498416;return db[_0x9aea('0x45')][_0x9aea('0x4f')]({'where':{'id':_0x3e6365[_0x9aea('0x49')]['id']}})[_0x9aea('0x1d')](handleEntityNotFound(_0x2d012e,null))[_0x9aea('0x1d')](function(_0x3328b2){if(_0x3328b2){_0x1f4733=_0x3328b2;_0x2aa1b7['model']=_[_0x9aea('0x36')](db[_0x9aea('0x50')][_0x9aea('0x4a')]);_0x2aa1b7[_0x9aea('0x37')]=_[_0x9aea('0x36')](_0x3e6365[_0x9aea('0x37')]);_0x2aa1b7[_0x9aea('0x38')]=_[_0x9aea('0x39')](_0x2aa1b7[_0x9aea('0x35')],_0x2aa1b7[_0x9aea('0x37')]);_0x5a13b5[_0x9aea('0x3a')]=_[_0x9aea('0x39')](_0x2aa1b7[_0x9aea('0x35')],qs[_0x9aea('0x3b')](_0x3e6365['query'][_0x9aea('0x3b')]));_0x5a13b5[_0x9aea('0x3a')]=_0x5a13b5['attributes']['length']?_0x5a13b5[_0x9aea('0x3a')]:_0x2aa1b7[_0x9aea('0x35')];_0x5a13b5['order']=qs[_0x9aea('0x3e')](_0x3e6365[_0x9aea('0x37')][_0x9aea('0x3e')]);_0x5a13b5['where']=qs[_0x9aea('0x38')](_[_0x9aea('0x40')](_0x3e6365[_0x9aea('0x37')],_0x2aa1b7[_0x9aea('0x38')]));if(_0x3e6365['query'][_0x9aea('0x41')]){_0x5a13b5['where']=_[_0x9aea('0x42')](_0x5a13b5[_0x9aea('0x3f')],{'$or':_[_0x9aea('0x32')](_0x5a13b5[_0x9aea('0x3a')],function(_0x77cd66){var _0x356ce6={};_0x356ce6[_0x77cd66]={'$like':'%'+_0x3e6365[_0x9aea('0x37')][_0x9aea('0x41')]+'%'};return _0x356ce6;})});}_0x5a13b5=_[_0x9aea('0x42')]({},_0x5a13b5,_0x3e6365['options']);return _0x1f4733[_0x9aea('0x51')](_0x5a13b5);}})['then'](function(_0x1a8ae2){if(_0x1a8ae2){_0x498416=_0x1a8ae2[_0x9aea('0x3c')];if(!_0x3e6365[_0x9aea('0x37')][_0x9aea('0x52')](_0x9aea('0x53'))){_0x5a13b5[_0x9aea('0x3d')]=qs[_0x9aea('0x3d')](_0x3e6365['query']['limit']);_0x5a13b5['offset']=qs[_0x9aea('0x29')](_0x3e6365[_0x9aea('0x37')][_0x9aea('0x29')]);}return _0x1f4733[_0x9aea('0x51')](_0x5a13b5);}})[_0x9aea('0x1d')](function(_0x3d0a65){if(_0x3d0a65){return _0x3d0a65?{'count':_0x498416,'rows':_0x3d0a65}:null;}})[_0x9aea('0x1d')](respondWithResult(_0x2d012e,null))[_0x9aea('0x47')](handleError(_0x2d012e,null));};exports['getSubjects']=function(_0x2674d9,_0x471145,_0x507fd0){var _0x2ad591={};var _0x1434eb={};var _0x51b388;var _0x10b2f1;return db[_0x9aea('0x45')][_0x9aea('0x4f')]({'where':{'id':_0x2674d9['params']['id']}})[_0x9aea('0x1d')](handleEntityNotFound(_0x471145,null))['then'](function(_0x8dfcb5){if(_0x8dfcb5){_0x51b388=_0x8dfcb5;_0x1434eb['model']=_['keys'](db[_0x9aea('0x50')][_0x9aea('0x4a')]);_0x1434eb[_0x9aea('0x37')]=_['keys'](_0x2674d9[_0x9aea('0x37')]);_0x1434eb[_0x9aea('0x38')]=_[_0x9aea('0x39')](_0x1434eb[_0x9aea('0x35')],_0x1434eb[_0x9aea('0x37')]);_0x2ad591[_0x9aea('0x3a')]=_[_0x9aea('0x39')](_0x1434eb[_0x9aea('0x35')],qs[_0x9aea('0x3b')](_0x2674d9['query'][_0x9aea('0x3b')]));_0x2ad591[_0x9aea('0x3a')]=_0x2ad591['attributes'][_0x9aea('0x3c')]?_0x2ad591['attributes']:_0x1434eb[_0x9aea('0x35')];_0x2ad591[_0x9aea('0x54')]=qs[_0x9aea('0x3e')](_0x2674d9[_0x9aea('0x37')][_0x9aea('0x3e')]);_0x2ad591[_0x9aea('0x3f')]=qs[_0x9aea('0x38')](_['pick'](_0x2674d9[_0x9aea('0x37')],_0x1434eb[_0x9aea('0x38')]));if(_0x2674d9[_0x9aea('0x37')][_0x9aea('0x41')]){_0x2ad591['where']=_['merge'](_0x2ad591[_0x9aea('0x3f')],{'$or':_['map'](_0x2ad591[_0x9aea('0x3a')],function(_0x41f8c8){var _0x5b1f83={};_0x5b1f83[_0x41f8c8]={'$like':'%'+_0x2674d9[_0x9aea('0x37')][_0x9aea('0x41')]+'%'};return _0x5b1f83;})});}_0x2ad591=_[_0x9aea('0x42')]({},_0x2ad591,_0x2674d9[_0x9aea('0x44')]);return _0x51b388[_0x9aea('0x55')](_0x2ad591);}})['then'](function(_0x277dd7){if(_0x277dd7){_0x10b2f1=_0x277dd7[_0x9aea('0x3c')];if(!_0x2674d9[_0x9aea('0x37')][_0x9aea('0x52')](_0x9aea('0x53'))){_0x2ad591[_0x9aea('0x3d')]=qs[_0x9aea('0x3d')](_0x2674d9[_0x9aea('0x37')]['limit']);_0x2ad591[_0x9aea('0x29')]=qs[_0x9aea('0x29')](_0x2674d9[_0x9aea('0x37')][_0x9aea('0x29')]);}return _0x51b388[_0x9aea('0x55')](_0x2ad591);}})['then'](function(_0x2cface){if(_0x2cface){return _0x2cface?{'count':_0x10b2f1,'rows':_0x2cface}:null;}})[_0x9aea('0x1d')](respondWithResult(_0x471145,null))[_0x9aea('0x47')](handleError(_0x471145,null));};exports[_0x9aea('0x56')]=function(_0x3de72d,_0x44abf5,_0xfb9d8b){var _0x136087={};var _0x1e89a8={};var _0x5201f1;var _0x1475f3;return db['Dynamics365Configuration'][_0x9aea('0x4f')]({'where':{'id':_0x3de72d[_0x9aea('0x49')]['id']}})[_0x9aea('0x1d')](handleEntityNotFound(_0x44abf5,null))['then'](function(_0x2891f0){if(_0x2891f0){_0x5201f1=_0x2891f0;_0x1e89a8[_0x9aea('0x35')]=_[_0x9aea('0x36')](db[_0x9aea('0x50')][_0x9aea('0x4a')]);_0x1e89a8['query']=_['keys'](_0x3de72d[_0x9aea('0x37')]);_0x1e89a8[_0x9aea('0x38')]=_['intersection'](_0x1e89a8[_0x9aea('0x35')],_0x1e89a8[_0x9aea('0x37')]);_0x136087[_0x9aea('0x3a')]=_[_0x9aea('0x39')](_0x1e89a8[_0x9aea('0x35')],qs[_0x9aea('0x3b')](_0x3de72d[_0x9aea('0x37')][_0x9aea('0x3b')]));_0x136087[_0x9aea('0x3a')]=_0x136087[_0x9aea('0x3a')]['length']?_0x136087['attributes']:_0x1e89a8[_0x9aea('0x35')];_0x136087[_0x9aea('0x54')]=qs[_0x9aea('0x3e')](_0x3de72d[_0x9aea('0x37')][_0x9aea('0x3e')]);_0x136087[_0x9aea('0x3f')]=qs[_0x9aea('0x38')](_['pick'](_0x3de72d['query'],_0x1e89a8[_0x9aea('0x38')]));if(_0x3de72d[_0x9aea('0x37')][_0x9aea('0x41')]){_0x136087[_0x9aea('0x3f')]=_[_0x9aea('0x42')](_0x136087['where'],{'$or':_[_0x9aea('0x32')](_0x136087[_0x9aea('0x3a')],function(_0x50aed1){var _0x69bacf={};_0x69bacf[_0x50aed1]={'$like':'%'+_0x3de72d[_0x9aea('0x37')][_0x9aea('0x41')]+'%'};return _0x69bacf;})});}_0x136087=_[_0x9aea('0x42')]({},_0x136087,_0x3de72d[_0x9aea('0x44')]);return _0x5201f1[_0x9aea('0x56')](_0x136087);}})[_0x9aea('0x1d')](function(_0x5a7d9b){if(_0x5a7d9b){_0x1475f3=_0x5a7d9b['length'];if(!_0x3de72d['query']['hasOwnProperty']('nolimit')){_0x136087[_0x9aea('0x3d')]=qs[_0x9aea('0x3d')](_0x3de72d[_0x9aea('0x37')][_0x9aea('0x3d')]);_0x136087[_0x9aea('0x29')]=qs[_0x9aea('0x29')](_0x3de72d[_0x9aea('0x37')]['offset']);}return _0x5201f1['getDescriptions'](_0x136087);}})[_0x9aea('0x1d')](function(_0x2191a){if(_0x2191a){return _0x2191a?{'count':_0x1475f3,'rows':_0x2191a}:null;}})[_0x9aea('0x1d')](respondWithResult(_0x44abf5,null))[_0x9aea('0x47')](handleError(_0x44abf5,null));}; \ No newline at end of file +var _0x7174=['destroy','stack','name','send','map','Dynamics365Configuration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','length','find','create','body','getFields','findOne','order','hasOwnProperty','nolimit','getSubjects','getDescriptions','Dynamics365Field','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','error','message','info','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x9bed30,_0x3d5c1a){var _0x53e9af=function(_0x249abb){while(--_0x249abb){_0x9bed30['push'](_0x9bed30['shift']());}};_0x53e9af(++_0x3d5c1a);}(_0x7174,0x80));var _0x4717=function(_0x406ddc,_0xca0824){_0x406ddc=_0x406ddc-0x0;var _0x31f788=_0x7174[_0x406ddc];return _0x31f788;};'use strict';var pdf=require(_0x4717('0x0'));var emlformat=require(_0x4717('0x1'));var rimraf=require(_0x4717('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4717('0x3'));var moment=require('moment');var BPromise=require(_0x4717('0x4'));var Mustache=require(_0x4717('0x5'));var util=require(_0x4717('0x6'));var path=require('path');var sox=require(_0x4717('0x7'));var csv=require(_0x4717('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4717('0x9'));var squel=require(_0x4717('0xa'));var crypto=require(_0x4717('0xb'));var jsforce=require(_0x4717('0xc'));var deskjs=require(_0x4717('0xd'));var toCsv=require(_0x4717('0x8'));var querystring=require(_0x4717('0xe'));var Papa=require(_0x4717('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4717('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4717('0x11'));var logger=require(_0x4717('0x12'))('api');var utils=require(_0x4717('0x13'));var config=require(_0x4717('0x14'));var db=require(_0x4717('0x15'))['db'];var jayson=require(_0x4717('0x16'));var client=jayson[_0x4717('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x5e17db,_0x134132,_0xf615dc){if(_0xf615dc){var _0x48a6e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48a6e0[_0x4717('0x18')](_0x134132)){return _0x5e17db;}else{throw new db[(_0x4717('0x19'))]['ValidationError'](_0x4717('0x1a'));}}else{return _0x5e17db;}}function respondWithRpcPromise(_0x427673,_0x43da56,_0x51e6e5,_0x5704e3){return new BPromise(function(_0x50844b,_0x568174){var _0x4cde00=_0x5704e3||client;return _0x4cde00[_0x4717('0x1b')](_0x427673,_0x51e6e5)['then'](function(_0x599a32){logger['info'](_0x4717('0x1c'),_0x43da56,_0x4717('0x1d'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x43da56,_0x4717('0x1d'),JSON['stringify'](_0x599a32));if(_0x599a32[_0x4717('0x1e')]){if(_0x599a32['error']['code']===0x1f4){logger['error'](_0x4717('0x1c'),_0x43da56,_0x599a32['error'][_0x4717('0x1f')]);return _0x568174(_0x599a32['error']['message']);}logger[_0x4717('0x1e')](_0x4717('0x1c'),_0x43da56,_0x599a32[_0x4717('0x1e')][_0x4717('0x1f')]);return _0x50844b(_0x599a32['error'][_0x4717('0x1f')]);}else{logger[_0x4717('0x20')](_0x4717('0x1c'),_0x43da56,_0x4717('0x1d'));_0x50844b(_0x599a32['result'][_0x4717('0x1f')]);}})[_0x4717('0x21')](function(_0x1abef5){logger[_0x4717('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43da56,_0x1abef5);_0x568174(_0x1abef5);});});}function respondWithStatusCode(_0x490c8a,_0x2ffa38){_0x2ffa38=_0x2ffa38||0xcc;return function(_0xf49294){if(_0xf49294){return _0x490c8a[_0x4717('0x22')](_0x2ffa38);}return _0x490c8a[_0x4717('0x23')](_0x2ffa38)[_0x4717('0x24')]();};}function respondWithResult(_0x355f1d,_0x15b15d){_0x15b15d=_0x15b15d||0xc8;return function(_0x146514){if(_0x146514){return _0x355f1d[_0x4717('0x23')](_0x15b15d)[_0x4717('0x25')](_0x146514);}};}function respondWithFilteredResult(_0x4b051b,_0x583ff9){return function(_0x574ad8){if(_0x574ad8){var _0x265164=_0x574ad8[_0x4717('0x26')],_0xe980c1=_0x583ff9[_0x4717('0x27')],_0x2f0001=_0x583ff9[_0x4717('0x27')]+_0x583ff9['limit'],_0x54eb9d;if(_0x2f0001>=_0x265164){_0x2f0001=_0x265164;_0x54eb9d=0xc8;}else{_0x54eb9d=0xce;}_0x4b051b['status'](_0x54eb9d);return _0x4b051b['set'](_0x4717('0x28'),_0xe980c1+'-'+_0x2f0001+'/'+_0x265164)[_0x4717('0x25')](_0x574ad8);}return null;};}function patchUpdates(_0x482ea3){return function(_0x51623e){try{jsonpatch[_0x4717('0x29')](_0x51623e,_0x482ea3,!![]);}catch(_0x8e3da1){return BPromise[_0x4717('0x2a')](_0x8e3da1);}return _0x51623e[_0x4717('0x2b')]();};}function saveUpdates(_0x586920,_0x18bd50){return function(_0x11af4d){if(_0x11af4d){return _0x11af4d[_0x4717('0x2c')](_0x586920)[_0x4717('0x2d')](function(_0x2bbbb4){return _0x2bbbb4;});}return null;};}function removeEntity(_0x1fd893,_0x3cc9f5){return function(_0x17bbad){if(_0x17bbad){return _0x17bbad[_0x4717('0x2e')]()[_0x4717('0x2d')](function(){_0x1fd893[_0x4717('0x23')](0xcc)[_0x4717('0x24')]();});}};}function handleEntityNotFound(_0x102161,_0x895591){return function(_0x4be5d1){if(!_0x4be5d1){_0x102161[_0x4717('0x22')](0x194);}return _0x4be5d1;};}function handleError(_0x462b81,_0x53a758){_0x53a758=_0x53a758||0x1f4;return function(_0x4c493e){logger[_0x4717('0x1e')](_0x4c493e[_0x4717('0x2f')]);if(_0x4c493e[_0x4717('0x30')]){delete _0x4c493e['name'];}_0x462b81['status'](_0x53a758)[_0x4717('0x31')](_0x4c493e);};}exports['index']=function(_0x31c9c4,_0x708d13){var _0x1c94f0={},_0x2578e7={},_0x477cb2={'count':0x0,'rows':[]};var _0x43be21=_[_0x4717('0x32')](db[_0x4717('0x33')]['rawAttributes'],function(_0x15746f){return{'name':_0x15746f[_0x4717('0x34')],'type':_0x15746f[_0x4717('0x35')]['key']};});_0x2578e7[_0x4717('0x36')]=_['map'](_0x43be21,_0x4717('0x30'));_0x2578e7[_0x4717('0x37')]=_[_0x4717('0x38')](_0x31c9c4[_0x4717('0x37')]);_0x2578e7[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x2578e7[_0x4717('0x36')],_0x2578e7['query']);_0x1c94f0[_0x4717('0x3b')]=_[_0x4717('0x3a')](_0x2578e7['model'],qs[_0x4717('0x3c')](_0x31c9c4[_0x4717('0x37')]['fields']));_0x1c94f0[_0x4717('0x3b')]=_0x1c94f0[_0x4717('0x3b')]['length']?_0x1c94f0[_0x4717('0x3b')]:_0x2578e7[_0x4717('0x36')];if(!_0x31c9c4[_0x4717('0x37')]['hasOwnProperty']('nolimit')){_0x1c94f0[_0x4717('0x3d')]=qs['limit'](_0x31c9c4['query'][_0x4717('0x3d')]);_0x1c94f0['offset']=qs[_0x4717('0x27')](_0x31c9c4[_0x4717('0x37')][_0x4717('0x27')]);}_0x1c94f0['order']=qs[_0x4717('0x3e')](_0x31c9c4[_0x4717('0x37')]['sort']);_0x1c94f0[_0x4717('0x3f')]=qs[_0x4717('0x39')](_[_0x4717('0x40')](_0x31c9c4[_0x4717('0x37')],_0x2578e7[_0x4717('0x39')]),_0x43be21);if(_0x31c9c4[_0x4717('0x37')][_0x4717('0x41')]){_0x1c94f0[_0x4717('0x3f')]=_[_0x4717('0x42')](_0x1c94f0[_0x4717('0x3f')],{'$or':_[_0x4717('0x32')](_0x43be21,function(_0x1808c6){if(_0x1808c6[_0x4717('0x35')]!==_0x4717('0x43')){var _0x188c12={};_0x188c12[_0x1808c6[_0x4717('0x30')]]={'$like':'%'+_0x31c9c4['query']['filter']+'%'};return _0x188c12;}})});}_0x1c94f0=_[_0x4717('0x42')]({},_0x1c94f0,_0x31c9c4[_0x4717('0x44')]);var _0x372759={'where':_0x1c94f0['where']};return db[_0x4717('0x33')][_0x4717('0x26')](_0x372759)[_0x4717('0x2d')](function(_0x32b2f3){_0x477cb2['count']=_0x32b2f3;if(_0x31c9c4[_0x4717('0x37')][_0x4717('0x45')]){_0x1c94f0[_0x4717('0x46')]=[{'all':!![]}];}return db[_0x4717('0x33')][_0x4717('0x47')](_0x1c94f0);})[_0x4717('0x2d')](function(_0x5db118){_0x477cb2['rows']=_0x5db118;return _0x477cb2;})['then'](respondWithFilteredResult(_0x708d13,_0x1c94f0))[_0x4717('0x21')](handleError(_0x708d13,null));};exports[_0x4717('0x48')]=function(_0x39572d,_0x542690){var _0xc96395={'raw':![],'where':{'id':_0x39572d[_0x4717('0x49')]['id']}},_0x4d007f={};_0x4d007f['model']=_[_0x4717('0x38')](db[_0x4717('0x33')][_0x4717('0x4a')]);_0x4d007f[_0x4717('0x37')]=_[_0x4717('0x38')](_0x39572d[_0x4717('0x37')]);_0x4d007f[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x4d007f[_0x4717('0x36')],_0x4d007f[_0x4717('0x37')]);_0xc96395['attributes']=_[_0x4717('0x3a')](_0x4d007f[_0x4717('0x36')],qs[_0x4717('0x3c')](_0x39572d['query'][_0x4717('0x3c')]));_0xc96395[_0x4717('0x3b')]=_0xc96395['attributes'][_0x4717('0x4b')]?_0xc96395[_0x4717('0x3b')]:_0x4d007f[_0x4717('0x36')];if(_0x39572d['query'][_0x4717('0x45')]){_0xc96395[_0x4717('0x46')]=[{'all':!![]}];}_0xc96395=_[_0x4717('0x42')]({},_0xc96395,_0x39572d[_0x4717('0x44')]);return db[_0x4717('0x33')][_0x4717('0x4c')](_0xc96395)[_0x4717('0x2d')](handleEntityNotFound(_0x542690,null))[_0x4717('0x2d')](respondWithResult(_0x542690,null))['catch'](handleError(_0x542690,null));};exports[_0x4717('0x4d')]=function(_0x34d4eb,_0xae11e0){return db['Dynamics365Configuration'][_0x4717('0x4d')](_0x34d4eb[_0x4717('0x4e')],{})[_0x4717('0x2d')](respondWithResult(_0xae11e0,0xc9))['catch'](handleError(_0xae11e0,null));};exports[_0x4717('0x2c')]=function(_0x579f48,_0x4bedae){if(_0x579f48['body']['id']){delete _0x579f48['body']['id'];}return db[_0x4717('0x33')][_0x4717('0x4c')]({'where':{'id':_0x579f48['params']['id']}})['then'](handleEntityNotFound(_0x4bedae,null))[_0x4717('0x2d')](saveUpdates(_0x579f48[_0x4717('0x4e')],null))[_0x4717('0x2d')](respondWithResult(_0x4bedae,null))[_0x4717('0x21')](handleError(_0x4bedae,null));};exports['destroy']=function(_0xd4294c,_0x2aa198){return db[_0x4717('0x33')][_0x4717('0x4c')]({'where':{'id':_0xd4294c[_0x4717('0x49')]['id']}})[_0x4717('0x2d')](handleEntityNotFound(_0x2aa198,null))['then'](removeEntity(_0x2aa198,null))[_0x4717('0x21')](handleError(_0x2aa198,null));};exports[_0x4717('0x4f')]=function(_0x20f6f2,_0x2ce0bf,_0x468bbc){var _0x39fce4={};var _0x4434e2={};var _0x19af82;var _0x53ca66;return db[_0x4717('0x33')][_0x4717('0x50')]({'where':{'id':_0x20f6f2[_0x4717('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ce0bf,null))[_0x4717('0x2d')](function(_0x32263a){if(_0x32263a){_0x19af82=_0x32263a;_0x4434e2[_0x4717('0x36')]=_[_0x4717('0x38')](db['Dynamics365Field'][_0x4717('0x4a')]);_0x4434e2[_0x4717('0x37')]=_[_0x4717('0x38')](_0x20f6f2['query']);_0x4434e2[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x4434e2['model'],_0x4434e2[_0x4717('0x37')]);_0x39fce4['attributes']=_['intersection'](_0x4434e2[_0x4717('0x36')],qs[_0x4717('0x3c')](_0x20f6f2[_0x4717('0x37')][_0x4717('0x3c')]));_0x39fce4['attributes']=_0x39fce4[_0x4717('0x3b')][_0x4717('0x4b')]?_0x39fce4[_0x4717('0x3b')]:_0x4434e2[_0x4717('0x36')];_0x39fce4[_0x4717('0x51')]=qs[_0x4717('0x3e')](_0x20f6f2[_0x4717('0x37')]['sort']);_0x39fce4[_0x4717('0x3f')]=qs['filters'](_[_0x4717('0x40')](_0x20f6f2[_0x4717('0x37')],_0x4434e2[_0x4717('0x39')]));if(_0x20f6f2['query'][_0x4717('0x41')]){_0x39fce4[_0x4717('0x3f')]=_['merge'](_0x39fce4['where'],{'$or':_[_0x4717('0x32')](_0x39fce4[_0x4717('0x3b')],function(_0x7778c){var _0x123cf2={};_0x123cf2[_0x7778c]={'$like':'%'+_0x20f6f2[_0x4717('0x37')]['filter']+'%'};return _0x123cf2;})});}_0x39fce4=_[_0x4717('0x42')]({},_0x39fce4,_0x20f6f2['options']);return _0x19af82[_0x4717('0x4f')](_0x39fce4);}})[_0x4717('0x2d')](function(_0x381cf2){if(_0x381cf2){_0x53ca66=_0x381cf2[_0x4717('0x4b')];if(!_0x20f6f2[_0x4717('0x37')][_0x4717('0x52')](_0x4717('0x53'))){_0x39fce4[_0x4717('0x3d')]=qs[_0x4717('0x3d')](_0x20f6f2['query'][_0x4717('0x3d')]);_0x39fce4['offset']=qs[_0x4717('0x27')](_0x20f6f2['query']['offset']);}return _0x19af82[_0x4717('0x4f')](_0x39fce4);}})[_0x4717('0x2d')](function(_0x480b5b){if(_0x480b5b){return _0x480b5b?{'count':_0x53ca66,'rows':_0x480b5b}:null;}})[_0x4717('0x2d')](respondWithResult(_0x2ce0bf,null))[_0x4717('0x21')](handleError(_0x2ce0bf,null));};exports[_0x4717('0x54')]=function(_0x40844e,_0x1747eb,_0x147342){var _0x11f436={};var _0x32e8aa={};var _0x264415;var _0x54920d;return db[_0x4717('0x33')][_0x4717('0x50')]({'where':{'id':_0x40844e[_0x4717('0x49')]['id']}})[_0x4717('0x2d')](handleEntityNotFound(_0x1747eb,null))[_0x4717('0x2d')](function(_0x151e82){if(_0x151e82){_0x264415=_0x151e82;_0x32e8aa[_0x4717('0x36')]=_[_0x4717('0x38')](db['Dynamics365Field']['rawAttributes']);_0x32e8aa[_0x4717('0x37')]=_['keys'](_0x40844e[_0x4717('0x37')]);_0x32e8aa[_0x4717('0x39')]=_['intersection'](_0x32e8aa['model'],_0x32e8aa[_0x4717('0x37')]);_0x11f436['attributes']=_[_0x4717('0x3a')](_0x32e8aa[_0x4717('0x36')],qs[_0x4717('0x3c')](_0x40844e[_0x4717('0x37')][_0x4717('0x3c')]));_0x11f436[_0x4717('0x3b')]=_0x11f436['attributes']['length']?_0x11f436[_0x4717('0x3b')]:_0x32e8aa[_0x4717('0x36')];_0x11f436[_0x4717('0x51')]=qs[_0x4717('0x3e')](_0x40844e['query']['sort']);_0x11f436[_0x4717('0x3f')]=qs[_0x4717('0x39')](_[_0x4717('0x40')](_0x40844e['query'],_0x32e8aa[_0x4717('0x39')]));if(_0x40844e[_0x4717('0x37')][_0x4717('0x41')]){_0x11f436[_0x4717('0x3f')]=_[_0x4717('0x42')](_0x11f436[_0x4717('0x3f')],{'$or':_[_0x4717('0x32')](_0x11f436['attributes'],function(_0x2689ce){var _0x151238={};_0x151238[_0x2689ce]={'$like':'%'+_0x40844e[_0x4717('0x37')][_0x4717('0x41')]+'%'};return _0x151238;})});}_0x11f436=_['merge']({},_0x11f436,_0x40844e[_0x4717('0x44')]);return _0x264415[_0x4717('0x54')](_0x11f436);}})['then'](function(_0xdfb7d3){if(_0xdfb7d3){_0x54920d=_0xdfb7d3[_0x4717('0x4b')];if(!_0x40844e[_0x4717('0x37')][_0x4717('0x52')](_0x4717('0x53'))){_0x11f436['limit']=qs[_0x4717('0x3d')](_0x40844e[_0x4717('0x37')][_0x4717('0x3d')]);_0x11f436['offset']=qs[_0x4717('0x27')](_0x40844e[_0x4717('0x37')][_0x4717('0x27')]);}return _0x264415[_0x4717('0x54')](_0x11f436);}})[_0x4717('0x2d')](function(_0x4d392b){if(_0x4d392b){return _0x4d392b?{'count':_0x54920d,'rows':_0x4d392b}:null;}})[_0x4717('0x2d')](respondWithResult(_0x1747eb,null))[_0x4717('0x21')](handleError(_0x1747eb,null));};exports[_0x4717('0x55')]=function(_0x3a7b18,_0x579919,_0x19bd8c){var _0x4f113e={};var _0x5dd232={};var _0x26572b;var _0x36e92b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3a7b18['params']['id']}})['then'](handleEntityNotFound(_0x579919,null))[_0x4717('0x2d')](function(_0x32a662){if(_0x32a662){_0x26572b=_0x32a662;_0x5dd232['model']=_[_0x4717('0x38')](db[_0x4717('0x56')][_0x4717('0x4a')]);_0x5dd232[_0x4717('0x37')]=_[_0x4717('0x38')](_0x3a7b18[_0x4717('0x37')]);_0x5dd232[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x5dd232['model'],_0x5dd232[_0x4717('0x37')]);_0x4f113e['attributes']=_[_0x4717('0x3a')](_0x5dd232[_0x4717('0x36')],qs[_0x4717('0x3c')](_0x3a7b18[_0x4717('0x37')][_0x4717('0x3c')]));_0x4f113e[_0x4717('0x3b')]=_0x4f113e[_0x4717('0x3b')][_0x4717('0x4b')]?_0x4f113e[_0x4717('0x3b')]:_0x5dd232[_0x4717('0x36')];_0x4f113e['order']=qs[_0x4717('0x3e')](_0x3a7b18[_0x4717('0x37')][_0x4717('0x3e')]);_0x4f113e[_0x4717('0x3f')]=qs[_0x4717('0x39')](_[_0x4717('0x40')](_0x3a7b18['query'],_0x5dd232[_0x4717('0x39')]));if(_0x3a7b18[_0x4717('0x37')][_0x4717('0x41')]){_0x4f113e[_0x4717('0x3f')]=_[_0x4717('0x42')](_0x4f113e[_0x4717('0x3f')],{'$or':_[_0x4717('0x32')](_0x4f113e[_0x4717('0x3b')],function(_0x289e8a){var _0x523b93={};_0x523b93[_0x289e8a]={'$like':'%'+_0x3a7b18[_0x4717('0x37')][_0x4717('0x41')]+'%'};return _0x523b93;})});}_0x4f113e=_[_0x4717('0x42')]({},_0x4f113e,_0x3a7b18[_0x4717('0x44')]);return _0x26572b['getDescriptions'](_0x4f113e);}})[_0x4717('0x2d')](function(_0x2f5a6f){if(_0x2f5a6f){_0x36e92b=_0x2f5a6f[_0x4717('0x4b')];if(!_0x3a7b18['query'][_0x4717('0x52')](_0x4717('0x53'))){_0x4f113e[_0x4717('0x3d')]=qs[_0x4717('0x3d')](_0x3a7b18[_0x4717('0x37')][_0x4717('0x3d')]);_0x4f113e['offset']=qs[_0x4717('0x27')](_0x3a7b18['query'][_0x4717('0x27')]);}return _0x26572b['getDescriptions'](_0x4f113e);}})[_0x4717('0x2d')](function(_0x5280b9){if(_0x5280b9){return _0x5280b9?{'count':_0x36e92b,'rows':_0x5280b9}:null;}})[_0x4717('0x2d')](respondWithResult(_0x579919,null))[_0x4717('0x21')](handleError(_0x579919,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index b1a028c..8c61bbd 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 _0xfdec=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfdec,0x1ce));var _0xcfde=function(_0x5b4ecb,_0x20ea97){_0x5b4ecb=_0x5b4ecb-0x0;var _0x13a2f7=_0xfdec[_0x5b4ecb];return _0x13a2f7;};'use strict';var _=require(_0xcfde('0x0'));var util=require('util');var logger=require(_0xcfde('0x1'))(_0xcfde('0x2'));var moment=require(_0xcfde('0x3'));var BPromise=require(_0xcfde('0x4'));var rp=require(_0xcfde('0x5'));var fs=require('fs');var path=require(_0xcfde('0x6'));var rimraf=require(_0xcfde('0x7'));var config=require('../../config/environment');var attributes=require(_0xcfde('0x8'));module['exports']=function(_0x51603d,_0x3b60e1){return _0x51603d['define'](_0xcfde('0x9'),attributes,{'tableName':_0xcfde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b82=['./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b82,0x9f));var _0x25b8=function(_0x219ab5,_0x143062){_0x219ab5=_0x219ab5-0x0;var _0x55704f=_0x5b82[_0x219ab5];return _0x55704f;};'use strict';var _=require('lodash');var util=require(_0x25b8('0x0'));var logger=require(_0x25b8('0x1'))(_0x25b8('0x2'));var moment=require(_0x25b8('0x3'));var BPromise=require(_0x25b8('0x4'));var rp=require(_0x25b8('0x5'));var fs=require('fs');var path=require(_0x25b8('0x6'));var rimraf=require(_0x25b8('0x7'));var config=require(_0x25b8('0x8'));var attributes=require(_0x25b8('0x9'));module[_0x25b8('0xa')]=function(_0x1c5401,_0xaaaeb4){return _0x1c5401['define']('Dynamics365Configuration',attributes,{'tableName':_0x25b8('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 29a543f..9972fab 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 _0xd7d3=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x5efbb6,_0x1ef225){var _0x4c4d63=function(_0x12875a){while(--_0x12875a){_0x5efbb6['push'](_0x5efbb6['shift']());}};_0x4c4d63(++_0x1ef225);}(_0xd7d3,0xe4));var _0x3d7d=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xd7d3[_0x434783];return _0x13efcf;};'use strict';var _=require(_0x3d7d('0x0'));var util=require('util');var moment=require(_0x3d7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d7d('0x2'));var fs=require('fs');var Redis=require(_0x3d7d('0x3'));var db=require(_0x3d7d('0x4'))['db'];var utils=require(_0x3d7d('0x5'));var logger=require(_0x3d7d('0x6'))('rpc');var config=require(_0x3d7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3d7d('0x8')][_0x3d7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9440c,_0x374a8b,_0x4e11e4){return new BPromise(function(_0x41d969,_0x3e7ffd){return client[_0x3d7d('0xa')](_0xc9440c,_0x4e11e4)[_0x3d7d('0xb')](function(_0x4fedf4){logger[_0x3d7d('0xc')](_0x3d7d('0xd'),_0x374a8b,_0x3d7d('0xe'));logger[_0x3d7d('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x374a8b,'request\x20sent',JSON['stringify'](_0x4fedf4));if(_0x4fedf4['error']){if(_0x4fedf4[_0x3d7d('0x10')]['code']===0x1f4){logger[_0x3d7d('0x10')](_0x3d7d('0xd'),_0x374a8b,_0x4fedf4[_0x3d7d('0x10')]['message']);return _0x3e7ffd(_0x4fedf4[_0x3d7d('0x10')][_0x3d7d('0x11')]);}logger[_0x3d7d('0x10')](_0x3d7d('0xd'),_0x374a8b,_0x4fedf4[_0x3d7d('0x10')]['message']);return _0x41d969(_0x4fedf4['error'][_0x3d7d('0x11')]);}else{logger[_0x3d7d('0xc')](_0x3d7d('0xd'),_0x374a8b,_0x3d7d('0xe'));_0x41d969(_0x4fedf4[_0x3d7d('0x12')]['message']);}})['catch'](function(_0x2642bf){logger[_0x3d7d('0x10')](_0x3d7d('0xd'),_0x374a8b,_0x2642bf);_0x3e7ffd(_0x2642bf);});});} \ No newline at end of file +var _0xcd44=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4496d4,_0x35a23c){var _0x549149=function(_0x466c13){while(--_0x466c13){_0x4496d4['push'](_0x4496d4['shift']());}};_0x549149(++_0x35a23c);}(_0xcd44,0xd7));var _0x4cd4=function(_0x5aeede,_0x1cc3af){_0x5aeede=_0x5aeede-0x0;var _0x1e9786=_0xcd44[_0x5aeede];return _0x1e9786;};'use strict';var _=require(_0x4cd4('0x0'));var util=require(_0x4cd4('0x1'));var moment=require(_0x4cd4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cd4('0x3'));var db=require(_0x4cd4('0x4'))['db'];var utils=require(_0x4cd4('0x5'));var logger=require(_0x4cd4('0x6'))(_0x4cd4('0x7'));var config=require(_0x4cd4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4cd4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b8d24,_0x307c61,_0x4efdf0){return new BPromise(function(_0xb3f19c,_0x35f7a5){return client[_0x4cd4('0xa')](_0x4b8d24,_0x4efdf0)[_0x4cd4('0xb')](function(_0xcafe17){logger[_0x4cd4('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x307c61,_0x4cd4('0xd'));logger[_0x4cd4('0xe')](_0x4cd4('0xf'),_0x307c61,'request\x20sent',JSON['stringify'](_0xcafe17));if(_0xcafe17[_0x4cd4('0x10')]){if(_0xcafe17[_0x4cd4('0x10')][_0x4cd4('0x11')]===0x1f4){logger[_0x4cd4('0x10')](_0x4cd4('0x12'),_0x307c61,_0xcafe17[_0x4cd4('0x10')]['message']);return _0x35f7a5(_0xcafe17['error'][_0x4cd4('0x13')]);}logger[_0x4cd4('0x10')](_0x4cd4('0x12'),_0x307c61,_0xcafe17[_0x4cd4('0x10')][_0x4cd4('0x13')]);return _0xb3f19c(_0xcafe17[_0x4cd4('0x10')][_0x4cd4('0x13')]);}else{logger[_0x4cd4('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x307c61,_0x4cd4('0xd'));_0xb3f19c(_0xcafe17[_0x4cd4('0x14')]['message']);}})[_0x4cd4('0x15')](function(_0x25148f){logger[_0x4cd4('0x10')](_0x4cd4('0x12'),_0x307c61,_0x25148f);_0x35f7a5(_0x25148f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 50c6178..8d62bb1 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 _0x131e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','connect-timeout','express','Router'];(function(_0x58a357,_0x436b1c){var _0x56092e=function(_0xa3d2c2){while(--_0xa3d2c2){_0x58a357['push'](_0x58a357['shift']());}};_0x56092e(++_0x436b1c);}(_0x131e,0x1ec));var _0xe131=function(_0x228fc4,_0x204f26){_0x228fc4=_0x228fc4-0x0;var _0x52e89a=_0x131e[_0x228fc4];return _0x52e89a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe131('0x0'));var express=require(_0xe131('0x1'));var router=express[_0xe131('0x2')]();var auth=require(_0xe131('0x3'));var interaction=require(_0xe131('0x4'));var config=require(_0xe131('0x5'));var controller=require('./intDynamics365Field.controller');router[_0xe131('0x6')]('/',auth[_0xe131('0x7')](),controller[_0xe131('0x8')]);router[_0xe131('0x6')](_0xe131('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe131('0xa')]);router[_0xe131('0xb')]('/:id',auth[_0xe131('0x7')](),controller['update']);router[_0xe131('0xc')](_0xe131('0x9'),auth[_0xe131('0x7')](),controller[_0xe131('0xd')]);module[_0xe131('0xe')]=router; \ No newline at end of file +var _0x0e9f=['delete','exports','multer','util','express','../../components/interaction/service','get','isAuthenticated','show','post','put','/:id'];(function(_0x371bee,_0x441831){var _0x270836=function(_0x16eade){while(--_0x16eade){_0x371bee['push'](_0x371bee['shift']());}};_0x270836(++_0x441831);}(_0x0e9f,0x116));var _0xf0e9=function(_0x1db798,_0x3c0abb){_0x1db798=_0x1db798-0x0;var _0x2a3867=_0x0e9f[_0x1db798];return _0x2a3867;};'use strict';var multer=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf0e9('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf0e9('0x3'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0xf0e9('0x4')]('/',auth[_0xf0e9('0x5')](),controller['index']);router[_0xf0e9('0x4')]('/:id',auth[_0xf0e9('0x5')](),controller[_0xf0e9('0x6')]);router[_0xf0e9('0x7')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0e9('0x8')](_0xf0e9('0x9'),auth[_0xf0e9('0x5')](),controller['update']);router[_0xf0e9('0xa')](_0xf0e9('0x9'),auth[_0xf0e9('0x5')](),controller['destroy']);module[_0xf0e9('0xb')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 90acaf7..f2cc3fd 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 _0x0b15=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x216cbd,_0x5f0a02){var _0xd52a8c=function(_0x910123){while(--_0x910123){_0x216cbd['push'](_0x216cbd['shift']());}};_0xd52a8c(++_0x5f0a02);}(_0x0b15,0x16f));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x50b1('0x0'));module[_0x50b1('0x1')]={'type':{'type':Sequelize[_0x50b1('0x2')](_0x50b1('0x3'),'variable',_0x50b1('0x4'),_0x50b1('0x5')),'defaultValue':_0x50b1('0x3')},'content':{'type':Sequelize[_0x50b1('0x6')]},'key':{'type':Sequelize[_0x50b1('0x6')]},'keyType':{'type':Sequelize[_0x50b1('0x2')](_0x50b1('0x3'),_0x50b1('0x7'),_0x50b1('0x4'))},'keyContent':{'type':Sequelize[_0x50b1('0x6')]},'idField':{'type':Sequelize[_0x50b1('0x6')]},'nameField':{'type':Sequelize[_0x50b1('0x6')]},'customField':{'type':Sequelize[_0x50b1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x50b1('0x6')]}}; \ No newline at end of file +var _0xe633=['customVariable','keyValue','STRING','string','BOOLEAN','exports','ENUM','variable'];(function(_0x380c7f,_0x234003){var _0x57f3c2=function(_0x5b0848){while(--_0x5b0848){_0x380c7f['push'](_0x380c7f['shift']());}};_0x57f3c2(++_0x234003);}(_0xe633,0x14d));var _0x3e63=function(_0x1a44cc,_0x295c21){_0x1a44cc=_0x1a44cc-0x0;var _0x4c41ba=_0xe633[_0x1a44cc];return _0x4c41ba;};'use strict';var Sequelize=require('sequelize');module[_0x3e63('0x0')]={'type':{'type':Sequelize[_0x3e63('0x1')]('string',_0x3e63('0x2'),_0x3e63('0x3'),_0x3e63('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3e63('0x5')]},'key':{'type':Sequelize[_0x3e63('0x5')]},'keyType':{'type':Sequelize[_0x3e63('0x1')](_0x3e63('0x6'),_0x3e63('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3e63('0x5')]},'idField':{'type':Sequelize[_0x3e63('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3e63('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e63('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9de0dc2..cd0319b 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 _0x3d8f=['destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x255008,_0x157a3c){var _0x209b41=function(_0x2ca030){while(--_0x2ca030){_0x255008['push'](_0x255008['shift']());}};_0x209b41(++_0x157a3c);}(_0x3d8f,0x1d3));var _0xf3d8=function(_0x4fd0db,_0x151f07){_0x4fd0db=_0x4fd0db-0x0;var _0x3844ec=_0x3d8f[_0x4fd0db];return _0x3844ec;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3d8('0x0'));var rimraf=require(_0xf3d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3d8('0x2'));var rp=require(_0xf3d8('0x3'));var moment=require(_0xf3d8('0x4'));var BPromise=require(_0xf3d8('0x5'));var Mustache=require(_0xf3d8('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf3d8('0x7'));var ejs=require(_0xf3d8('0x8'));var fs=require('fs');var _=require(_0xf3d8('0x9'));var squel=require(_0xf3d8('0xa'));var crypto=require(_0xf3d8('0xb'));var jsforce=require(_0xf3d8('0xc'));var deskjs=require(_0xf3d8('0xd'));var toCsv=require(_0xf3d8('0x7'));var querystring=require(_0xf3d8('0xe'));var Papa=require(_0xf3d8('0xf'));var Redis=require(_0xf3d8('0x10'));var authService=require(_0xf3d8('0x11'));var qs=require(_0xf3d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3d8('0x13'))(_0xf3d8('0x14'));var utils=require(_0xf3d8('0x15'));var config=require(_0xf3d8('0x16'));var db=require(_0xf3d8('0x17'))['db'];function respondWithStatusCode(_0x6e8adc,_0x522095){_0x522095=_0x522095||0xcc;return function(_0x61cdce){if(_0x61cdce){return _0x6e8adc[_0xf3d8('0x18')](_0x522095);}return _0x6e8adc[_0xf3d8('0x19')](_0x522095)[_0xf3d8('0x1a')]();};}function respondWithResult(_0x3e7aab,_0x4c25a7){_0x4c25a7=_0x4c25a7||0xc8;return function(_0x42ff23){if(_0x42ff23){return _0x3e7aab[_0xf3d8('0x19')](_0x4c25a7)['json'](_0x42ff23);}};}function respondWithFilteredResult(_0x148b47,_0x15780d){return function(_0x262437){if(_0x262437){var _0x34b3e1=_0x262437[_0xf3d8('0x1b')],_0x247aeb=_0x15780d[_0xf3d8('0x1c')],_0x3c67de=_0x15780d[_0xf3d8('0x1c')]+_0x15780d['limit'],_0x115773;if(_0x3c67de>=_0x34b3e1){_0x3c67de=_0x34b3e1;_0x115773=0xc8;}else{_0x115773=0xce;}_0x148b47[_0xf3d8('0x19')](_0x115773);return _0x148b47[_0xf3d8('0x1d')](_0xf3d8('0x1e'),_0x247aeb+'-'+_0x3c67de+'/'+_0x34b3e1)[_0xf3d8('0x1f')](_0x262437);}return null;};}function patchUpdates(_0x290e97){return function(_0x2fc8b6){try{jsonpatch[_0xf3d8('0x20')](_0x2fc8b6,_0x290e97,!![]);}catch(_0x1c25ae){return BPromise[_0xf3d8('0x21')](_0x1c25ae);}return _0x2fc8b6[_0xf3d8('0x22')]();};}function saveUpdates(_0x5a29ea,_0x3110d4){return function(_0x158f08){if(_0x158f08){return _0x158f08[_0xf3d8('0x23')](_0x5a29ea)[_0xf3d8('0x24')](function(_0x14cb5f){return _0x14cb5f;});}return null;};}function removeEntity(_0x2332d4,_0x3140f6){return function(_0x418c0a){if(_0x418c0a){return _0x418c0a[_0xf3d8('0x25')]()[_0xf3d8('0x24')](function(){_0x2332d4[_0xf3d8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c230d,_0x10ddc1){return function(_0x49c769){if(!_0x49c769){_0x4c230d[_0xf3d8('0x18')](0x194);}return _0x49c769;};}function handleError(_0x58f61a,_0x58d6e2){_0x58d6e2=_0x58d6e2||0x1f4;return function(_0x72e2aa){logger[_0xf3d8('0x26')](_0x72e2aa[_0xf3d8('0x27')]);if(_0x72e2aa[_0xf3d8('0x28')]){delete _0x72e2aa[_0xf3d8('0x28')];}_0x58f61a['status'](_0x58d6e2)['send'](_0x72e2aa);};}exports[_0xf3d8('0x29')]=function(_0x50839a,_0x244989){var _0xe9c94d={},_0x14609c={},_0x114320={'count':0x0,'rows':[]};var _0x5223fb=_[_0xf3d8('0x2a')](db[_0xf3d8('0x2b')][_0xf3d8('0x2c')],function(_0x2481f3){return{'name':_0x2481f3[_0xf3d8('0x2d')],'type':_0x2481f3[_0xf3d8('0x2e')]['key']};});_0x14609c[_0xf3d8('0x2f')]=_[_0xf3d8('0x2a')](_0x5223fb,_0xf3d8('0x28'));_0x14609c[_0xf3d8('0x30')]=_[_0xf3d8('0x31')](_0x50839a[_0xf3d8('0x30')]);_0x14609c[_0xf3d8('0x32')]=_[_0xf3d8('0x33')](_0x14609c[_0xf3d8('0x2f')],_0x14609c[_0xf3d8('0x30')]);_0xe9c94d[_0xf3d8('0x34')]=_[_0xf3d8('0x33')](_0x14609c['model'],qs[_0xf3d8('0x35')](_0x50839a[_0xf3d8('0x30')][_0xf3d8('0x35')]));_0xe9c94d['attributes']=_0xe9c94d[_0xf3d8('0x34')][_0xf3d8('0x36')]?_0xe9c94d[_0xf3d8('0x34')]:_0x14609c['model'];if(!_0x50839a[_0xf3d8('0x30')]['hasOwnProperty'](_0xf3d8('0x37'))){_0xe9c94d[_0xf3d8('0x38')]=qs['limit'](_0x50839a[_0xf3d8('0x30')][_0xf3d8('0x38')]);_0xe9c94d['offset']=qs[_0xf3d8('0x1c')](_0x50839a['query'][_0xf3d8('0x1c')]);}_0xe9c94d['order']=qs[_0xf3d8('0x39')](_0x50839a[_0xf3d8('0x30')][_0xf3d8('0x39')]);_0xe9c94d[_0xf3d8('0x3a')]=qs[_0xf3d8('0x32')](_[_0xf3d8('0x3b')](_0x50839a['query'],_0x14609c[_0xf3d8('0x32')]),_0x5223fb);if(_0x50839a[_0xf3d8('0x30')][_0xf3d8('0x3c')]){_0xe9c94d[_0xf3d8('0x3a')]=_[_0xf3d8('0x3d')](_0xe9c94d[_0xf3d8('0x3a')],{'$or':_[_0xf3d8('0x2a')](_0x5223fb,function(_0x3102a3){if(_0x3102a3[_0xf3d8('0x2e')]!==_0xf3d8('0x3e')){var _0x53b930={};_0x53b930[_0x3102a3[_0xf3d8('0x28')]]={'$like':'%'+_0x50839a[_0xf3d8('0x30')][_0xf3d8('0x3c')]+'%'};return _0x53b930;}})});}_0xe9c94d=_[_0xf3d8('0x3d')]({},_0xe9c94d,_0x50839a[_0xf3d8('0x3f')]);var _0x26e794={'where':_0xe9c94d[_0xf3d8('0x3a')]};return db[_0xf3d8('0x2b')][_0xf3d8('0x1b')](_0x26e794)[_0xf3d8('0x24')](function(_0x4fe64d){_0x114320['count']=_0x4fe64d;if(_0x50839a[_0xf3d8('0x30')][_0xf3d8('0x40')]){_0xe9c94d['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0xe9c94d);})[_0xf3d8('0x24')](function(_0x5a37fd){_0x114320[_0xf3d8('0x41')]=_0x5a37fd;return _0x114320;})[_0xf3d8('0x24')](respondWithFilteredResult(_0x244989,_0xe9c94d))['catch'](handleError(_0x244989,null));};exports[_0xf3d8('0x42')]=function(_0x34ca21,_0x3cd2cf){var _0x17792e={'raw':!![],'where':{'id':_0x34ca21[_0xf3d8('0x43')]['id']}},_0x458106={};_0x458106[_0xf3d8('0x2f')]=_['keys'](db[_0xf3d8('0x2b')][_0xf3d8('0x2c')]);_0x458106[_0xf3d8('0x30')]=_[_0xf3d8('0x31')](_0x34ca21[_0xf3d8('0x30')]);_0x458106[_0xf3d8('0x32')]=_['intersection'](_0x458106[_0xf3d8('0x2f')],_0x458106[_0xf3d8('0x30')]);_0x17792e[_0xf3d8('0x34')]=_['intersection'](_0x458106[_0xf3d8('0x2f')],qs[_0xf3d8('0x35')](_0x34ca21[_0xf3d8('0x30')][_0xf3d8('0x35')]));_0x17792e[_0xf3d8('0x34')]=_0x17792e[_0xf3d8('0x34')][_0xf3d8('0x36')]?_0x17792e[_0xf3d8('0x34')]:_0x458106[_0xf3d8('0x2f')];if(_0x34ca21[_0xf3d8('0x30')]['includeAll']){_0x17792e['include']=[{'all':!![]}];}_0x17792e=_[_0xf3d8('0x3d')]({},_0x17792e,_0x34ca21[_0xf3d8('0x3f')]);return db[_0xf3d8('0x2b')][_0xf3d8('0x44')](_0x17792e)[_0xf3d8('0x24')](handleEntityNotFound(_0x3cd2cf,null))['then'](respondWithResult(_0x3cd2cf,null))[_0xf3d8('0x45')](handleError(_0x3cd2cf,null));};exports[_0xf3d8('0x46')]=function(_0x3c20e4,_0x3dc682){return db['Dynamics365Field'][_0xf3d8('0x46')](_0x3c20e4[_0xf3d8('0x47')],{})[_0xf3d8('0x24')](respondWithResult(_0x3dc682,0xc9))['catch'](handleError(_0x3dc682,null));};exports[_0xf3d8('0x23')]=function(_0x5b0ea1,_0x447ad0){if(_0x5b0ea1[_0xf3d8('0x47')]['id']){delete _0x5b0ea1[_0xf3d8('0x47')]['id'];}return db[_0xf3d8('0x2b')][_0xf3d8('0x44')]({'where':{'id':_0x5b0ea1[_0xf3d8('0x43')]['id']}})[_0xf3d8('0x24')](handleEntityNotFound(_0x447ad0,null))[_0xf3d8('0x24')](saveUpdates(_0x5b0ea1[_0xf3d8('0x47')],null))[_0xf3d8('0x24')](respondWithResult(_0x447ad0,null))[_0xf3d8('0x45')](handleError(_0x447ad0,null));};exports[_0xf3d8('0x25')]=function(_0x5294a8,_0x70bfcb){return db['Dynamics365Field']['find']({'where':{'id':_0x5294a8['params']['id']}})[_0xf3d8('0x24')](handleEntityNotFound(_0x70bfcb,null))[_0xf3d8('0x24')](removeEntity(_0x70bfcb,null))[_0xf3d8('0x45')](handleError(_0x70bfcb,null));}; \ No newline at end of file +var _0x7061=['find','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','length'];(function(_0x572b63,_0x238825){var _0x311fe0=function(_0x2bfe8f){while(--_0x2bfe8f){_0x572b63['push'](_0x572b63['shift']());}};_0x311fe0(++_0x238825);}(_0x7061,0x1f3));var _0x1706=function(_0x35070d,_0x1aa473){_0x35070d=_0x35070d-0x0;var _0x5e97bc=_0x7061[_0x35070d];return _0x5e97bc;};'use strict';var pdf=require(_0x1706('0x0'));var emlformat=require(_0x1706('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1706('0x2'));var rp=require(_0x1706('0x3'));var moment=require(_0x1706('0x4'));var BPromise=require(_0x1706('0x5'));var Mustache=require(_0x1706('0x6'));var util=require(_0x1706('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1706('0x8'));var ejs=require(_0x1706('0x9'));var fs=require('fs');var _=require(_0x1706('0xa'));var squel=require(_0x1706('0xb'));var crypto=require(_0x1706('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1706('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1706('0xe'));var Papa=require(_0x1706('0xf'));var Redis=require(_0x1706('0x10'));var authService=require(_0x1706('0x11'));var qs=require(_0x1706('0x12'));var as=require(_0x1706('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1706('0x14'));var config=require(_0x1706('0x15'));var db=require(_0x1706('0x16'))['db'];function respondWithStatusCode(_0x3e60d4,_0xe8d252){_0xe8d252=_0xe8d252||0xcc;return function(_0x198cc4){if(_0x198cc4){return _0x3e60d4[_0x1706('0x17')](_0xe8d252);}return _0x3e60d4[_0x1706('0x18')](_0xe8d252)[_0x1706('0x19')]();};}function respondWithResult(_0x440c65,_0xb94c95){_0xb94c95=_0xb94c95||0xc8;return function(_0x5f145c){if(_0x5f145c){return _0x440c65[_0x1706('0x18')](_0xb94c95)[_0x1706('0x1a')](_0x5f145c);}};}function respondWithFilteredResult(_0x28fc41,_0x46002b){return function(_0xdbd9d4){if(_0xdbd9d4){var _0x4242a1=_0xdbd9d4['count'],_0x116c50=_0x46002b['offset'],_0x4ba06a=_0x46002b[_0x1706('0x1b')]+_0x46002b[_0x1706('0x1c')],_0x524ef0;if(_0x4ba06a>=_0x4242a1){_0x4ba06a=_0x4242a1;_0x524ef0=0xc8;}else{_0x524ef0=0xce;}_0x28fc41[_0x1706('0x18')](_0x524ef0);return _0x28fc41[_0x1706('0x1d')](_0x1706('0x1e'),_0x116c50+'-'+_0x4ba06a+'/'+_0x4242a1)[_0x1706('0x1a')](_0xdbd9d4);}return null;};}function patchUpdates(_0x3adcf8){return function(_0x1c6d53){try{jsonpatch[_0x1706('0x1f')](_0x1c6d53,_0x3adcf8,!![]);}catch(_0xdd1a2){return BPromise[_0x1706('0x20')](_0xdd1a2);}return _0x1c6d53['save']();};}function saveUpdates(_0xba6d3a,_0xad6f56){return function(_0x2cc25e){if(_0x2cc25e){return _0x2cc25e[_0x1706('0x21')](_0xba6d3a)[_0x1706('0x22')](function(_0x33b313){return _0x33b313;});}return null;};}function removeEntity(_0x38b993,_0x5dece3){return function(_0x22d6d5){if(_0x22d6d5){return _0x22d6d5[_0x1706('0x23')]()[_0x1706('0x22')](function(){_0x38b993[_0x1706('0x18')](0xcc)[_0x1706('0x19')]();});}};}function handleEntityNotFound(_0x420b65,_0xc499c2){return function(_0x52f786){if(!_0x52f786){_0x420b65[_0x1706('0x17')](0x194);}return _0x52f786;};}function handleError(_0x569e68,_0x3c90ef){_0x3c90ef=_0x3c90ef||0x1f4;return function(_0x5e8038){logger[_0x1706('0x24')](_0x5e8038['stack']);if(_0x5e8038[_0x1706('0x25')]){delete _0x5e8038[_0x1706('0x25')];}_0x569e68[_0x1706('0x18')](_0x3c90ef)[_0x1706('0x26')](_0x5e8038);};}exports['index']=function(_0x192c87,_0x1271f2){var _0x3a8330={},_0xcb94f9={},_0x280de0={'count':0x0,'rows':[]};var _0x375980=_[_0x1706('0x27')](db[_0x1706('0x28')][_0x1706('0x29')],function(_0x5a04f5){return{'name':_0x5a04f5['fieldName'],'type':_0x5a04f5[_0x1706('0x2a')][_0x1706('0x2b')]};});_0xcb94f9[_0x1706('0x2c')]=_[_0x1706('0x27')](_0x375980,'name');_0xcb94f9['query']=_['keys'](_0x192c87[_0x1706('0x2d')]);_0xcb94f9[_0x1706('0x2e')]=_[_0x1706('0x2f')](_0xcb94f9[_0x1706('0x2c')],_0xcb94f9[_0x1706('0x2d')]);_0x3a8330[_0x1706('0x30')]=_[_0x1706('0x2f')](_0xcb94f9[_0x1706('0x2c')],qs[_0x1706('0x31')](_0x192c87[_0x1706('0x2d')][_0x1706('0x31')]));_0x3a8330[_0x1706('0x30')]=_0x3a8330[_0x1706('0x30')]['length']?_0x3a8330['attributes']:_0xcb94f9[_0x1706('0x2c')];if(!_0x192c87[_0x1706('0x2d')][_0x1706('0x32')](_0x1706('0x33'))){_0x3a8330[_0x1706('0x1c')]=qs[_0x1706('0x1c')](_0x192c87['query'][_0x1706('0x1c')]);_0x3a8330['offset']=qs[_0x1706('0x1b')](_0x192c87['query'][_0x1706('0x1b')]);}_0x3a8330[_0x1706('0x34')]=qs['sort'](_0x192c87['query'][_0x1706('0x35')]);_0x3a8330['where']=qs[_0x1706('0x2e')](_[_0x1706('0x36')](_0x192c87[_0x1706('0x2d')],_0xcb94f9[_0x1706('0x2e')]),_0x375980);if(_0x192c87[_0x1706('0x2d')][_0x1706('0x37')]){_0x3a8330[_0x1706('0x38')]=_[_0x1706('0x39')](_0x3a8330[_0x1706('0x38')],{'$or':_[_0x1706('0x27')](_0x375980,function(_0x7b1bf9){if(_0x7b1bf9[_0x1706('0x2a')]!==_0x1706('0x3a')){var _0x136202={};_0x136202[_0x7b1bf9[_0x1706('0x25')]]={'$like':'%'+_0x192c87[_0x1706('0x2d')][_0x1706('0x37')]+'%'};return _0x136202;}})});}_0x3a8330=_[_0x1706('0x39')]({},_0x3a8330,_0x192c87[_0x1706('0x3b')]);var _0x1cd294={'where':_0x3a8330['where']};return db[_0x1706('0x28')][_0x1706('0x3c')](_0x1cd294)['then'](function(_0x3eb7f1){_0x280de0['count']=_0x3eb7f1;if(_0x192c87[_0x1706('0x2d')][_0x1706('0x3d')]){_0x3a8330[_0x1706('0x3e')]=[{'all':!![]}];}return db[_0x1706('0x28')][_0x1706('0x3f')](_0x3a8330);})[_0x1706('0x22')](function(_0x2fb735){_0x280de0[_0x1706('0x40')]=_0x2fb735;return _0x280de0;})[_0x1706('0x22')](respondWithFilteredResult(_0x1271f2,_0x3a8330))[_0x1706('0x41')](handleError(_0x1271f2,null));};exports['show']=function(_0x496935,_0x4ed893){var _0x2142f8={'raw':!![],'where':{'id':_0x496935[_0x1706('0x42')]['id']}},_0xd0ed32={};_0xd0ed32['model']=_[_0x1706('0x43')](db['Dynamics365Field']['rawAttributes']);_0xd0ed32[_0x1706('0x2d')]=_['keys'](_0x496935[_0x1706('0x2d')]);_0xd0ed32[_0x1706('0x2e')]=_[_0x1706('0x2f')](_0xd0ed32[_0x1706('0x2c')],_0xd0ed32[_0x1706('0x2d')]);_0x2142f8[_0x1706('0x30')]=_['intersection'](_0xd0ed32['model'],qs[_0x1706('0x31')](_0x496935[_0x1706('0x2d')]['fields']));_0x2142f8[_0x1706('0x30')]=_0x2142f8[_0x1706('0x30')][_0x1706('0x44')]?_0x2142f8[_0x1706('0x30')]:_0xd0ed32[_0x1706('0x2c')];if(_0x496935['query'][_0x1706('0x3d')]){_0x2142f8[_0x1706('0x3e')]=[{'all':!![]}];}_0x2142f8=_[_0x1706('0x39')]({},_0x2142f8,_0x496935[_0x1706('0x3b')]);return db[_0x1706('0x28')][_0x1706('0x45')](_0x2142f8)[_0x1706('0x22')](handleEntityNotFound(_0x4ed893,null))['then'](respondWithResult(_0x4ed893,null))[_0x1706('0x41')](handleError(_0x4ed893,null));};exports['create']=function(_0xd7ad2e,_0x4e8d3d){return db[_0x1706('0x28')]['create'](_0xd7ad2e['body'],{})[_0x1706('0x22')](respondWithResult(_0x4e8d3d,0xc9))[_0x1706('0x41')](handleError(_0x4e8d3d,null));};exports[_0x1706('0x21')]=function(_0x37dc16,_0x1394ee){if(_0x37dc16[_0x1706('0x46')]['id']){delete _0x37dc16['body']['id'];}return db[_0x1706('0x28')][_0x1706('0x45')]({'where':{'id':_0x37dc16[_0x1706('0x42')]['id']}})[_0x1706('0x22')](handleEntityNotFound(_0x1394ee,null))[_0x1706('0x22')](saveUpdates(_0x37dc16[_0x1706('0x46')],null))['then'](respondWithResult(_0x1394ee,null))[_0x1706('0x41')](handleError(_0x1394ee,null));};exports[_0x1706('0x23')]=function(_0x2155ad,_0x278298){return db[_0x1706('0x28')][_0x1706('0x45')]({'where':{'id':_0x2155ad[_0x1706('0x42')]['id']}})[_0x1706('0x22')](handleEntityNotFound(_0x278298,null))[_0x1706('0x22')](removeEntity(_0x278298,null))[_0x1706('0x41')](handleError(_0x278298,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b1ecb8b..4b696ce 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 _0xd748=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fa558,_0x818728){var _0x388552=function(_0x1434a6){while(--_0x1434a6){_0x3fa558['push'](_0x3fa558['shift']());}};_0x388552(++_0x818728);}(_0xd748,0x71));var _0x8d74=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xd748[_0x1fd9e7];return _0x1781f2;};'use strict';var _=require(_0x8d74('0x0'));var util=require(_0x8d74('0x1'));var logger=require(_0x8d74('0x2'))(_0x8d74('0x3'));var moment=require(_0x8d74('0x4'));var BPromise=require(_0x8d74('0x5'));var rp=require(_0x8d74('0x6'));var fs=require('fs');var path=require(_0x8d74('0x7'));var rimraf=require(_0x8d74('0x8'));var config=require(_0x8d74('0x9'));var attributes=require(_0x8d74('0xa'));module['exports']=function(_0x177840,_0x177db5){return _0x177840['define'](_0x8d74('0xb'),attributes,{'tableName':_0x8d74('0xc'),'paranoid':![],'indexes':[{'name':_0x8d74('0xd'),'fields':['idField',_0x8d74('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4d7=['./intDynamics365Field.attributes','exports','dynamics365_unique_index','idField','FieldId','lodash','moment','bluebird','rimraf','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd4d7,0xe1));var _0x7d4d=function(_0x50499c,_0x188984){_0x50499c=_0x50499c-0x0;var _0xd422b3=_0xd4d7[_0x50499c];return _0xd422b3;};'use strict';var _=require(_0x7d4d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d4d('0x1'));var BPromise=require(_0x7d4d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d4d('0x3'));var config=require(_0x7d4d('0x4'));var attributes=require(_0x7d4d('0x5'));module[_0x7d4d('0x6')]=function(_0xc5d0a9,_0x3719b5){return _0xc5d0a9['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x7d4d('0x7'),'fields':[_0x7d4d('0x8'),_0x7d4d('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 e7bf3c3..b827513 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 _0xbacd=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x50f720,_0x5e1469){var _0x1a5867=function(_0x2f47f4){while(--_0x2f47f4){_0x50f720['push'](_0x50f720['shift']());}};_0x1a5867(++_0x5e1469);}(_0xbacd,0x1c5));var _0xdbac=function(_0x37cb53,_0x5c92d2){_0x37cb53=_0x37cb53-0x0;var _0x5219b8=_0xbacd[_0x37cb53];return _0x5219b8;};'use strict';var _=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var moment=require('moment');var BPromise=require(_0xdbac('0x2'));var rs=require(_0xdbac('0x3'));var fs=require('fs');var Redis=require(_0xdbac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbac('0x5'));var logger=require(_0xdbac('0x6'))(_0xdbac('0x7'));var config=require(_0xdbac('0x8'));var jayson=require(_0xdbac('0x9'));var client=jayson[_0xdbac('0xa')][_0xdbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa5f9cf,_0xe7dcd6,_0x2f5331){return new BPromise(function(_0x30be11,_0x227cb1){return client[_0xdbac('0xc')](_0xa5f9cf,_0x2f5331)[_0xdbac('0xd')](function(_0x2f90c4){logger['info'](_0xdbac('0xe'),_0xe7dcd6,_0xdbac('0xf'));logger['debug'](_0xdbac('0x10'),_0xe7dcd6,'request\x20sent',JSON[_0xdbac('0x11')](_0x2f90c4));if(_0x2f90c4[_0xdbac('0x12')]){if(_0x2f90c4[_0xdbac('0x12')][_0xdbac('0x13')]===0x1f4){logger[_0xdbac('0x12')](_0xdbac('0xe'),_0xe7dcd6,_0x2f90c4[_0xdbac('0x12')][_0xdbac('0x14')]);return _0x227cb1(_0x2f90c4[_0xdbac('0x12')]['message']);}logger[_0xdbac('0x12')](_0xdbac('0xe'),_0xe7dcd6,_0x2f90c4[_0xdbac('0x12')][_0xdbac('0x14')]);return _0x30be11(_0x2f90c4[_0xdbac('0x12')][_0xdbac('0x14')]);}else{logger[_0xdbac('0x15')](_0xdbac('0xe'),_0xe7dcd6,'request\x20sent');_0x30be11(_0x2f90c4[_0xdbac('0x16')][_0xdbac('0x14')]);}})[_0xdbac('0x17')](function(_0x4a0d28){logger[_0xdbac('0x12')](_0xdbac('0xe'),_0xe7dcd6,_0x4a0d28);_0x227cb1(_0x4a0d28);});});} \ No newline at end of file +var _0xdfa0=['code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa9dcbd,_0x2ff501){var _0x168dfb=function(_0x456e9a){while(--_0x456e9a){_0xa9dcbd['push'](_0xa9dcbd['shift']());}};_0x168dfb(++_0x2ff501);}(_0xdfa0,0x69));var _0x0dfa=function(_0x4dc40a,_0x5464dc){_0x4dc40a=_0x4dc40a-0x0;var _0x56c215=_0xdfa0[_0x4dc40a];return _0x56c215;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var moment=require(_0x0dfa('0x1'));var BPromise=require(_0x0dfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dfa('0x3'));var db=require(_0x0dfa('0x4'))['db'];var utils=require(_0x0dfa('0x5'));var logger=require('../../config/logger')(_0x0dfa('0x6'));var config=require('../../config/environment');var jayson=require(_0x0dfa('0x7'));var client=jayson[_0x0dfa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417f7a,_0x29ca78,_0x32280b){return new BPromise(function(_0x16070c,_0x3b6881){return client['request'](_0x417f7a,_0x32280b)[_0x0dfa('0x9')](function(_0x2f813e){logger[_0x0dfa('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x29ca78,_0x0dfa('0xb'));logger['debug'](_0x0dfa('0xc'),_0x29ca78,_0x0dfa('0xb'),JSON[_0x0dfa('0xd')](_0x2f813e));if(_0x2f813e['error']){if(_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0xf')]===0x1f4){logger['error'](_0x0dfa('0x10'),_0x29ca78,_0x2f813e[_0x0dfa('0xe')]['message']);return _0x3b6881(_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0x11')]);}logger[_0x0dfa('0xe')](_0x0dfa('0x10'),_0x29ca78,_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0x11')]);return _0x16070c(_0x2f813e['error'][_0x0dfa('0x11')]);}else{logger[_0x0dfa('0xa')](_0x0dfa('0x10'),_0x29ca78,_0x0dfa('0xb'));_0x16070c(_0x2f813e[_0x0dfa('0x12')][_0x0dfa('0x11')]);}})[_0x0dfa('0x13')](function(_0x3c79f0){logger[_0x0dfa('0xe')](_0x0dfa('0x10'),_0x29ca78,_0x3c79f0);_0x3b6881(_0x3c79f0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2ad72c4..9026c3b 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 _0xc682=['connect-timeout','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration','put','update','destroy','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc682,0x120));var _0x2c68=function(_0x434cd9,_0x457492){_0x434cd9=_0x434cd9-0x0;var _0x2f771d=_0xc682[_0x434cd9];return _0x2f771d;};'use strict';var multer=require('multer');var util=require(_0x2c68('0x0'));var path=require('path');var timeout=require(_0x2c68('0x1'));var express=require('express');var router=express[_0x2c68('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c68('0x3'));var config=require('../../config/environment');var controller=require(_0x2c68('0x4'));router[_0x2c68('0x5')]('/',auth[_0x2c68('0x6')](),controller[_0x2c68('0x7')]);router[_0x2c68('0x5')](_0x2c68('0x8'),auth[_0x2c68('0x6')](),controller[_0x2c68('0x9')]);router[_0x2c68('0x5')](_0x2c68('0xa'),auth[_0x2c68('0x6')](),controller['getConfigurations']);router[_0x2c68('0x5')]('/:id/fields',auth[_0x2c68('0x6')](),controller[_0x2c68('0xb')]);router[_0x2c68('0xc')]('/',auth[_0x2c68('0x6')](),controller['create']);router[_0x2c68('0xc')](_0x2c68('0xa'),auth[_0x2c68('0x6')](),controller[_0x2c68('0xd')]);router[_0x2c68('0xe')](_0x2c68('0x8'),auth[_0x2c68('0x6')](),controller[_0x2c68('0xf')]);router['delete'](_0x2c68('0x8'),auth['isAuthenticated'](),controller[_0x2c68('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5d22=['put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration'];(function(_0x5ef41d,_0x1060ad){var _0x1bc4d5=function(_0xf3a0fb){while(--_0xf3a0fb){_0x5ef41d['push'](_0x5ef41d['shift']());}};_0x1bc4d5(++_0x1060ad);}(_0x5d22,0x137));var _0x25d2=function(_0x222a87,_0x199916){_0x222a87=_0x222a87-0x0;var _0x3d09a1=_0x5d22[_0x222a87];return _0x3d09a1;};'use strict';var multer=require(_0x25d2('0x0'));var util=require(_0x25d2('0x1'));var path=require(_0x25d2('0x2'));var timeout=require(_0x25d2('0x3'));var express=require(_0x25d2('0x4'));var router=express[_0x25d2('0x5')]();var auth=require(_0x25d2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x25d2('0x7'));var controller=require(_0x25d2('0x8'));router[_0x25d2('0x9')]('/',auth[_0x25d2('0xa')](),controller[_0x25d2('0xb')]);router[_0x25d2('0x9')](_0x25d2('0xc'),auth[_0x25d2('0xa')](),controller[_0x25d2('0xd')]);router[_0x25d2('0x9')]('/:id/configurations',auth[_0x25d2('0xa')](),controller[_0x25d2('0xe')]);router[_0x25d2('0x9')]('/:id/fields',auth[_0x25d2('0xa')](),controller[_0x25d2('0xf')]);router[_0x25d2('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x25d2('0x10')](_0x25d2('0x11'),auth[_0x25d2('0xa')](),controller[_0x25d2('0x12')]);router[_0x25d2('0x13')](_0x25d2('0xc'),auth[_0x25d2('0xa')](),controller[_0x25d2('0x14')]);router[_0x25d2('0x15')]('/:id',auth[_0x25d2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 440d378..ee2b0c5 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 _0x1c01=['sequelize','exports','STRING','username','remoteUri'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x1c01,0x190));var _0x11c0=function(_0x5735af,_0x470700){_0x5735af=_0x5735af-0x0;var _0x4d3242=_0x1c01[_0x5735af];return _0x4d3242;};'use strict';var Sequelize=require(_0x11c0('0x0'));module[_0x11c0('0x1')]={'name':{'type':Sequelize[_0x11c0('0x2')]},'description':{'type':Sequelize[_0x11c0('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x11c0('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x11c0('0x4')},'serverUrl':{'type':Sequelize[_0x11c0('0x2')]}}; \ No newline at end of file +var _0x01d3=['username','remoteUri','sequelize','exports','STRING'];(function(_0x344757,_0x1b60e8){var _0x8dd577=function(_0xc26b9d){while(--_0xc26b9d){_0x344757['push'](_0x344757['shift']());}};_0x8dd577(++_0x1b60e8);}(_0x01d3,0xa2));var _0x301d=function(_0x4f6c8c,_0x432530){_0x4f6c8c=_0x4f6c8c-0x0;var _0x3fc3e2=_0x01d3[_0x4f6c8c];return _0x3fc3e2;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'name':{'type':Sequelize[_0x301d('0x2')]},'description':{'type':Sequelize[_0x301d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x301d('0x3')},'apiKey':{'type':Sequelize[_0x301d('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x301d('0x4')},'serverUrl':{'type':Sequelize[_0x301d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index dd5a17b..fbf50c0 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 _0x7217=['Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','label','capitalize','statusCode','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','options','FreshdeskAccount','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','update','getConfigurations','FreshdeskConfiguration','filter','nolimit','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields'];(function(_0x21c23e,_0x1d33e3){var _0xa7b7e2=function(_0x6ac2a8){while(--_0x6ac2a8){_0x21c23e['push'](_0x21c23e['shift']());}};_0xa7b7e2(++_0x1d33e3);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'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 integrations=require(_0x7721('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x7721('0x1c')][_0x7721('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x57ff6d,_0x109900,_0x30da54){if(_0x30da54){var _0x3f01c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f01c5[_0x7721('0x1e')](_0x109900)){return _0x57ff6d;}else{throw new db['Sequelize'][(_0x7721('0x1f'))](_0x7721('0x20'));}}else{return _0x57ff6d;}}function respondWithRpcPromise(_0x534f1b,_0x4e199a,_0x4b183e,_0x5ed54){return new BPromise(function(_0x25a628,_0x3cc909){var _0x32550d=_0x5ed54||client;return _0x32550d['request'](_0x534f1b,_0x4b183e)[_0x7721('0x21')](function(_0x54a838){logger[_0x7721('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x4e199a,_0x7721('0x23'));logger[_0x7721('0x24')](_0x7721('0x25'),_0x4e199a,_0x7721('0x23'),JSON[_0x7721('0x26')](_0x54a838));if(_0x54a838[_0x7721('0x27')]){if(_0x54a838[_0x7721('0x27')][_0x7721('0x28')]===0x1f4){logger[_0x7721('0x27')](_0x7721('0x29'),_0x4e199a,_0x54a838['error'][_0x7721('0x2a')]);return _0x3cc909(_0x54a838[_0x7721('0x27')][_0x7721('0x2a')]);}logger[_0x7721('0x27')]('FreshdeskAccount,\x20%s,\x20%s',_0x4e199a,_0x54a838[_0x7721('0x27')]['message']);return _0x25a628(_0x54a838[_0x7721('0x27')][_0x7721('0x2a')]);}else{logger[_0x7721('0x22')](_0x7721('0x29'),_0x4e199a,_0x7721('0x23'));_0x25a628(_0x54a838[_0x7721('0x2b')][_0x7721('0x2a')]);}})['catch'](function(_0x216f20){logger[_0x7721('0x27')](_0x7721('0x29'),_0x4e199a,_0x216f20);_0x3cc909(_0x216f20);});});}function respondWithStatusCode(_0x1f67c7,_0x40d550){_0x40d550=_0x40d550||0xcc;return function(_0x16355a){if(_0x16355a){return _0x1f67c7[_0x7721('0x2c')](_0x40d550);}return _0x1f67c7[_0x7721('0x2d')](_0x40d550)[_0x7721('0x2e')]();};}function respondWithResult(_0x52316e,_0x258ddf){_0x258ddf=_0x258ddf||0xc8;return function(_0x5b0551){if(_0x5b0551){return _0x52316e['status'](_0x258ddf)[_0x7721('0x2f')](_0x5b0551);}};}function respondWithFilteredResult(_0x343c19,_0x53c904){return function(_0x158d98){if(_0x158d98){var _0x1ea4d=_0x158d98['count'],_0x37b9f0=_0x53c904[_0x7721('0x30')],_0xd7d703=_0x53c904[_0x7721('0x30')]+_0x53c904['limit'],_0x1da2d8;if(_0xd7d703>=_0x1ea4d){_0xd7d703=_0x1ea4d;_0x1da2d8=0xc8;}else{_0x1da2d8=0xce;}_0x343c19['status'](_0x1da2d8);return _0x343c19[_0x7721('0x31')](_0x7721('0x32'),_0x37b9f0+'-'+_0xd7d703+'/'+_0x1ea4d)['json'](_0x158d98);}return null;};}function patchUpdates(_0x46f772){return function(_0x4651b5){try{jsonpatch[_0x7721('0x33')](_0x4651b5,_0x46f772,!![]);}catch(_0x58d54b){return BPromise[_0x7721('0x34')](_0x58d54b);}return _0x4651b5[_0x7721('0x35')]();};}function saveUpdates(_0x1492d4,_0x3f15e2){return function(_0xc0f3c4){if(_0xc0f3c4){return _0xc0f3c4['update'](_0x1492d4)[_0x7721('0x21')](function(_0x3e4e56){return _0x3e4e56;});}return null;};}function removeEntity(_0xb2386d,_0x5c5b33){return function(_0x35de7a){if(_0x35de7a){return _0x35de7a[_0x7721('0x36')]()['then'](function(){_0xb2386d[_0x7721('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6ba0,_0x326c50){return function(_0x19d082){if(!_0x19d082){_0x2d6ba0[_0x7721('0x2c')](0x194);}return _0x19d082;};}function handleError(_0x1c84c0,_0x13c635){_0x13c635=_0x13c635||0x1f4;return function(_0x2f1fe0){logger[_0x7721('0x27')](_0x2f1fe0[_0x7721('0x37')]);if(_0x2f1fe0[_0x7721('0x38')]){delete _0x2f1fe0[_0x7721('0x38')];}_0x1c84c0['status'](_0x13c635)[_0x7721('0x39')](_0x2f1fe0);};}exports['index']=function(_0x212384,_0x35614c){var _0x7942f7={},_0x1d03de={},_0x3968f3={'count':0x0,'rows':[]};var _0x378ba5=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0x539560){return{'name':_0x539560[_0x7721('0x3a')],'type':_0x539560[_0x7721('0x3b')][_0x7721('0x3c')]};});_0x1d03de[_0x7721('0x3d')]=_['map'](_0x378ba5,_0x7721('0x38'));_0x1d03de['query']=_[_0x7721('0x3e')](_0x212384[_0x7721('0x3f')]);_0x1d03de['filters']=_[_0x7721('0x40')](_0x1d03de[_0x7721('0x3d')],_0x1d03de['query']);_0x7942f7['attributes']=_[_0x7721('0x40')](_0x1d03de[_0x7721('0x3d')],qs[_0x7721('0x41')](_0x212384[_0x7721('0x3f')]['fields']));_0x7942f7[_0x7721('0x42')]=_0x7942f7[_0x7721('0x42')][_0x7721('0x43')]?_0x7942f7[_0x7721('0x42')]:_0x1d03de[_0x7721('0x3d')];if(!_0x212384['query'][_0x7721('0x44')]('nolimit')){_0x7942f7[_0x7721('0x45')]=qs['limit'](_0x212384[_0x7721('0x3f')][_0x7721('0x45')]);_0x7942f7[_0x7721('0x30')]=qs['offset'](_0x212384[_0x7721('0x3f')][_0x7721('0x30')]);}_0x7942f7[_0x7721('0x46')]=qs['sort'](_0x212384[_0x7721('0x3f')][_0x7721('0x47')]);_0x7942f7[_0x7721('0x48')]=qs[_0x7721('0x49')](_[_0x7721('0x4a')](_0x212384[_0x7721('0x3f')],_0x1d03de[_0x7721('0x49')]),_0x378ba5);if(_0x212384['query']['filter']){_0x7942f7[_0x7721('0x48')]=_[_0x7721('0x4b')](_0x7942f7[_0x7721('0x48')],{'$or':_[_0x7721('0x4c')](_0x378ba5,function(_0x335145){if(_0x335145[_0x7721('0x3b')]!==_0x7721('0x4d')){var _0x2966fe={};_0x2966fe[_0x335145[_0x7721('0x38')]]={'$like':'%'+_0x212384[_0x7721('0x3f')]['filter']+'%'};return _0x2966fe;}})});}_0x7942f7=_['merge']({},_0x7942f7,_0x212384[_0x7721('0x4e')]);var _0x6a4664={'where':_0x7942f7[_0x7721('0x48')]};return db[_0x7721('0x4f')]['count'](_0x6a4664)[_0x7721('0x21')](function(_0x2d5a88){_0x3968f3['count']=_0x2d5a88;if(_0x212384[_0x7721('0x3f')]['includeAll']){_0x7942f7[_0x7721('0x50')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7721('0x51')](_0x7942f7);})[_0x7721('0x21')](function(_0xf17c40){_0x3968f3['rows']=_0xf17c40;return _0x3968f3;})[_0x7721('0x21')](respondWithFilteredResult(_0x35614c,_0x7942f7))[_0x7721('0x52')](handleError(_0x35614c,null));};exports['show']=function(_0x223d93,_0x1196c2){var _0xf88e8c={'raw':![],'where':{'id':_0x223d93[_0x7721('0x53')]['id']}},_0x5c4078={};_0x5c4078['model']=_[_0x7721('0x3e')](db[_0x7721('0x4f')][_0x7721('0x54')]);_0x5c4078[_0x7721('0x3f')]=_[_0x7721('0x3e')](_0x223d93[_0x7721('0x3f')]);_0x5c4078[_0x7721('0x49')]=_[_0x7721('0x40')](_0x5c4078[_0x7721('0x3d')],_0x5c4078[_0x7721('0x3f')]);_0xf88e8c[_0x7721('0x42')]=_[_0x7721('0x40')](_0x5c4078[_0x7721('0x3d')],qs[_0x7721('0x41')](_0x223d93[_0x7721('0x3f')]['fields']));_0xf88e8c[_0x7721('0x42')]=_0xf88e8c[_0x7721('0x42')][_0x7721('0x43')]?_0xf88e8c[_0x7721('0x42')]:_0x5c4078[_0x7721('0x3d')];if(_0x223d93[_0x7721('0x3f')][_0x7721('0x55')]){_0xf88e8c['include']=[{'all':!![]}];}_0xf88e8c=_[_0x7721('0x4b')]({},_0xf88e8c,_0x223d93[_0x7721('0x4e')]);return db[_0x7721('0x4f')][_0x7721('0x56')](_0xf88e8c)[_0x7721('0x21')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x21')](respondWithResult(_0x1196c2,null))[_0x7721('0x52')](handleError(_0x1196c2,null));};exports[_0x7721('0x57')]=function(_0x11b300,_0x3b968d){return db[_0x7721('0x4f')]['create'](_0x11b300[_0x7721('0x58')],{})[_0x7721('0x21')](respondWithResult(_0x3b968d,0xc9))[_0x7721('0x52')](handleError(_0x3b968d,null));};exports[_0x7721('0x59')]=function(_0x15ed3b,_0x3e7918){if(_0x15ed3b[_0x7721('0x58')]['id']){delete _0x15ed3b[_0x7721('0x58')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x56')]({'where':{'id':_0x15ed3b[_0x7721('0x53')]['id']}})[_0x7721('0x21')](handleEntityNotFound(_0x3e7918,null))[_0x7721('0x21')](saveUpdates(_0x15ed3b[_0x7721('0x58')],null))[_0x7721('0x21')](respondWithResult(_0x3e7918,null))['catch'](handleError(_0x3e7918,null));};exports['destroy']=function(_0x4e112e,_0x885a3a){return db['FreshdeskAccount']['find']({'where':{'id':_0x4e112e['params']['id']}})['then'](handleEntityNotFound(_0x885a3a,null))[_0x7721('0x21')](removeEntity(_0x885a3a,null))[_0x7721('0x52')](handleError(_0x885a3a,null));};exports[_0x7721('0x5a')]=function(_0x5343a1,_0x5181d7,_0x5925b7){var _0x51a3a2={};var _0x484b8e={};var _0x24d1dc;var _0x4f0d38;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x5343a1[_0x7721('0x53')]['id']}})[_0x7721('0x21')](handleEntityNotFound(_0x5181d7,null))[_0x7721('0x21')](function(_0x4a94c8){if(_0x4a94c8){_0x24d1dc=_0x4a94c8;_0x484b8e[_0x7721('0x3d')]=_[_0x7721('0x3e')](db[_0x7721('0x5b')][_0x7721('0x54')]);_0x484b8e[_0x7721('0x3f')]=_[_0x7721('0x3e')](_0x5343a1[_0x7721('0x3f')]);_0x484b8e[_0x7721('0x49')]=_[_0x7721('0x40')](_0x484b8e[_0x7721('0x3d')],_0x484b8e[_0x7721('0x3f')]);_0x51a3a2[_0x7721('0x42')]=_[_0x7721('0x40')](_0x484b8e[_0x7721('0x3d')],qs[_0x7721('0x41')](_0x5343a1['query'][_0x7721('0x41')]));_0x51a3a2[_0x7721('0x42')]=_0x51a3a2[_0x7721('0x42')][_0x7721('0x43')]?_0x51a3a2['attributes']:_0x484b8e[_0x7721('0x3d')];_0x51a3a2[_0x7721('0x46')]=qs['sort'](_0x5343a1[_0x7721('0x3f')]['sort']);_0x51a3a2[_0x7721('0x48')]=qs[_0x7721('0x49')](_[_0x7721('0x4a')](_0x5343a1[_0x7721('0x3f')],_0x484b8e[_0x7721('0x49')]));if(_0x5343a1[_0x7721('0x3f')][_0x7721('0x5c')]){_0x51a3a2[_0x7721('0x48')]=_[_0x7721('0x4b')](_0x51a3a2['where'],{'$or':_[_0x7721('0x4c')](_0x51a3a2[_0x7721('0x42')],function(_0x112033){var _0x3a11e2={};_0x3a11e2[_0x112033]={'$like':'%'+_0x5343a1[_0x7721('0x3f')][_0x7721('0x5c')]+'%'};return _0x3a11e2;})});}_0x51a3a2=_[_0x7721('0x4b')]({},_0x51a3a2,_0x5343a1['options']);return _0x24d1dc[_0x7721('0x5a')](_0x51a3a2);}})[_0x7721('0x21')](function(_0x53c918){if(_0x53c918){_0x4f0d38=_0x53c918[_0x7721('0x43')];if(!_0x5343a1['query'][_0x7721('0x44')](_0x7721('0x5d'))){_0x51a3a2[_0x7721('0x45')]=qs[_0x7721('0x45')](_0x5343a1[_0x7721('0x3f')][_0x7721('0x45')]);_0x51a3a2[_0x7721('0x30')]=qs['offset'](_0x5343a1[_0x7721('0x3f')][_0x7721('0x30')]);}return _0x24d1dc[_0x7721('0x5a')](_0x51a3a2);}})['then'](function(_0x5cef5a){if(_0x5cef5a){return _0x5cef5a?{'count':_0x4f0d38,'rows':_0x5cef5a}:null;}})['then'](respondWithResult(_0x5181d7,null))['catch'](handleError(_0x5181d7,null));};exports['addConfiguration']=function(_0x1fc5f7,_0x2645dd,_0x580473){if(_0x1fc5f7[_0x7721('0x58')]['id']){delete _0x1fc5f7[_0x7721('0x58')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x5e')]({'where':{'id':_0x1fc5f7['params']['id']}})[_0x7721('0x21')](handleEntityNotFound(_0x2645dd,null))[_0x7721('0x21')](function(_0x322afc){if(_0x322afc){_0x1fc5f7[_0x7721('0x58')][_0x7721('0x5f')]=_0x322afc['id'];_0x1fc5f7['body'][_0x7721('0x60')]=integrations[_0x7721('0x61')](_0x1fc5f7[_0x7721('0x58')]['channel'],_0x1fc5f7['body'][_0x7721('0x3b')]);_0x1fc5f7[_0x7721('0x58')][_0x7721('0x62')]=integrations[_0x7721('0x63')](_0x1fc5f7[_0x7721('0x58')]['channel'],_0x1fc5f7['body'][_0x7721('0x3b')]);return db[_0x7721('0x5b')][_0x7721('0x57')](_0x1fc5f7[_0x7721('0x58')],{'include':[{'model':db[_0x7721('0x64')],'as':_0x7721('0x60')},{'model':db[_0x7721('0x64')],'as':'Descriptions'}]});}return null;})[_0x7721('0x21')](respondWithResult(_0x2645dd,null))[_0x7721('0x52')](handleError(_0x2645dd,null));};exports[_0x7721('0x65')]=function(_0x5e85d9,_0xdc60ee,_0x1a53d6){var _0xdcd3e0='';return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x5e85d9['params']['id']},'attributes':['id',_0x7721('0x66'),_0x7721('0x67')]})[_0x7721('0x21')](handleEntityNotFound(_0xdc60ee,null))[_0x7721('0x21')](function(_0x3605cb){if(_0x3605cb){_0xdcd3e0=_0x3605cb[_0x7721('0x66')];var _0x59e80c=_0xdcd3e0[_0x7721('0x68')](-0x1);if(_0x59e80c==='/'){_0xdcd3e0=_0xdcd3e0[_0x7721('0x69')](0x0,_0xdcd3e0[_0x7721('0x6a')](_0x59e80c));}return rp({'method':'GET','uri':util[_0x7721('0x6b')](_0x7721('0x6c'),_0xdcd3e0,_0x7721('0x6d')),'headers':{'Authorization':util[_0x7721('0x6b')](_0x7721('0x6e'),new Buffer(util['format'](_0x7721('0x6f'),_0x3605cb['apiKey']))[_0x7721('0x70')](_0x7721('0x71')))},'json':!![]});}})[_0x7721('0x21')](function(_0x7f0598){if(_0x7f0598){var _0x963dbe=[_0x7721('0x72'),_0x7721('0x73'),_0x7721('0x74'),_0x7721('0x75'),_0x7721('0x2d'),_0x7721('0x76'),'group',_0x7721('0x77'),_0x7721('0x78'),_0x7721('0x79'),'company'];_[_0x7721('0x7a')](_0x7f0598,function(_0x26b2cc){return _0x963dbe[_0x7721('0x7b')](_0x26b2cc[_0x7721('0x38')])||!_0x26b2cc[_0x7721('0x7c')]&&_0x26b2cc['type']!==_0x7721('0x7d')&&_0x26b2cc[_0x7721('0x3b')]!==_0x7721('0x7e');});return{'count':_0x7f0598[_0x7721('0x43')],'rows':_[_0x7721('0x4c')](_0x7f0598,function(_0x51f3d7){return{'id':_0x51f3d7['name'],'name':_0x51f3d7[_0x7721('0x7f')],'custom':!_0x51f3d7[_0x7721('0x7c')],'options':_0x51f3d7['choices']?_[_0x7721('0x4c')](_0x51f3d7['choices'],function(_0x453792){return{'name':_[_0x7721('0x80')](_0x453792),'value':_0x453792};}):[]};})};}})['then'](respondWithResult(_0xdc60ee,null))[_0x7721('0x52')](function(_0x5209e1){var _0x56069f=_0x5e85d9['query'][_0x7721('0x1e')]?0x1f4:_0x5209e1[_0x7721('0x81')]||0x1f4;logger[_0x7721('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x56069f,JSON['stringify'](_0x5209e1));delete _0x5209e1[_0x7721('0x38')];if(_0x56069f===0x191){_0x56069f=0x190;}_0xdc60ee[_0x7721('0x2d')](_0x56069f)[_0x7721('0x39')](_0x5e85d9[_0x7721('0x3f')][_0x7721('0x1e')]?{'message':_0x7721('0x82'),'statusCode':_0x5209e1['statusCode']}:_0x5209e1);});}; \ No newline at end of file +var _0x5fc3=['params','includeAll','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','group','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','client','test','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','filter','where','merge','FreshdeskAccount','include','findAll','rows','show'];(function(_0x234805,_0x68c911){var _0x277cfc=function(_0x16a373){while(--_0x16a373){_0x234805['push'](_0x234805['shift']());}};_0x277cfc(++_0x68c911);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x5fc3[_0x3cf4d3];return _0x4e547b;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var db=require(_0x35fc('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x35fc('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x397738,_0x22055e,_0x2a6ad2){if(_0x2a6ad2){var _0x29730f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29730f[_0x35fc('0x19')](_0x22055e)){return _0x397738;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x397738;}}function respondWithRpcPromise(_0x558364,_0x398b67,_0x229d56,_0x53b898){return new BPromise(function(_0x154958,_0x227a49){var _0x1121fa=_0x53b898||client;return _0x1121fa['request'](_0x558364,_0x229d56)[_0x35fc('0x1a')](function(_0x45c8b7){logger['info'](_0x35fc('0x1b'),_0x398b67,_0x35fc('0x1c'));logger[_0x35fc('0x1d')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x398b67,_0x35fc('0x1c'),JSON[_0x35fc('0x1e')](_0x45c8b7));if(_0x45c8b7[_0x35fc('0x1f')]){if(_0x45c8b7['error'][_0x35fc('0x20')]===0x1f4){logger[_0x35fc('0x1f')](_0x35fc('0x1b'),_0x398b67,_0x45c8b7[_0x35fc('0x1f')][_0x35fc('0x21')]);return _0x227a49(_0x45c8b7[_0x35fc('0x1f')][_0x35fc('0x21')]);}logger[_0x35fc('0x1f')](_0x35fc('0x1b'),_0x398b67,_0x45c8b7[_0x35fc('0x1f')]['message']);return _0x154958(_0x45c8b7[_0x35fc('0x1f')][_0x35fc('0x21')]);}else{logger[_0x35fc('0x22')](_0x35fc('0x1b'),_0x398b67,_0x35fc('0x1c'));_0x154958(_0x45c8b7['result'][_0x35fc('0x21')]);}})[_0x35fc('0x23')](function(_0x561bf8){logger[_0x35fc('0x1f')](_0x35fc('0x1b'),_0x398b67,_0x561bf8);_0x227a49(_0x561bf8);});});}function respondWithStatusCode(_0x3d4a98,_0x51cfec){_0x51cfec=_0x51cfec||0xcc;return function(_0x4086e9){if(_0x4086e9){return _0x3d4a98['sendStatus'](_0x51cfec);}return _0x3d4a98[_0x35fc('0x24')](_0x51cfec)[_0x35fc('0x25')]();};}function respondWithResult(_0x5cb986,_0x519264){_0x519264=_0x519264||0xc8;return function(_0x47774c){if(_0x47774c){return _0x5cb986['status'](_0x519264)[_0x35fc('0x26')](_0x47774c);}};}function respondWithFilteredResult(_0x1a5d92,_0x57001c){return function(_0x26b7cb){if(_0x26b7cb){var _0x645eac=_0x26b7cb[_0x35fc('0x27')],_0x383837=_0x57001c[_0x35fc('0x28')],_0x9f3c8a=_0x57001c[_0x35fc('0x28')]+_0x57001c['limit'],_0x3735da;if(_0x9f3c8a>=_0x645eac){_0x9f3c8a=_0x645eac;_0x3735da=0xc8;}else{_0x3735da=0xce;}_0x1a5d92[_0x35fc('0x24')](_0x3735da);return _0x1a5d92[_0x35fc('0x29')](_0x35fc('0x2a'),_0x383837+'-'+_0x9f3c8a+'/'+_0x645eac)['json'](_0x26b7cb);}return null;};}function patchUpdates(_0xe79f52){return function(_0x16f067){try{jsonpatch[_0x35fc('0x2b')](_0x16f067,_0xe79f52,!![]);}catch(_0xe6e4ba){return BPromise[_0x35fc('0x2c')](_0xe6e4ba);}return _0x16f067[_0x35fc('0x2d')]();};}function saveUpdates(_0x222ddb,_0x37b435){return function(_0xf4dfab){if(_0xf4dfab){return _0xf4dfab[_0x35fc('0x2e')](_0x222ddb)['then'](function(_0x5e0313){return _0x5e0313;});}return null;};}function removeEntity(_0x114bc1,_0x4af5fe){return function(_0x37b394){if(_0x37b394){return _0x37b394[_0x35fc('0x2f')]()[_0x35fc('0x1a')](function(){_0x114bc1[_0x35fc('0x24')](0xcc)[_0x35fc('0x25')]();});}};}function handleEntityNotFound(_0x12e78f,_0x4e43b4){return function(_0x3fe193){if(!_0x3fe193){_0x12e78f[_0x35fc('0x30')](0x194);}return _0x3fe193;};}function handleError(_0x46b9ef,_0x4441d8){_0x4441d8=_0x4441d8||0x1f4;return function(_0x2bbd36){logger[_0x35fc('0x1f')](_0x2bbd36['stack']);if(_0x2bbd36[_0x35fc('0x31')]){delete _0x2bbd36[_0x35fc('0x31')];}_0x46b9ef[_0x35fc('0x24')](_0x4441d8)['send'](_0x2bbd36);};}exports[_0x35fc('0x32')]=function(_0x48d223,_0x2ecb2e){var _0x33a377={},_0x266a11={},_0x2e00e3={'count':0x0,'rows':[]};var _0x4de4b7=_['map'](db['FreshdeskAccount'][_0x35fc('0x33')],function(_0x56c06c){return{'name':_0x56c06c[_0x35fc('0x34')],'type':_0x56c06c['type'][_0x35fc('0x35')]};});_0x266a11[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0x4de4b7,_0x35fc('0x31'));_0x266a11[_0x35fc('0x38')]=_[_0x35fc('0x39')](_0x48d223[_0x35fc('0x38')]);_0x266a11['filters']=_[_0x35fc('0x3a')](_0x266a11[_0x35fc('0x36')],_0x266a11['query']);_0x33a377[_0x35fc('0x3b')]=_[_0x35fc('0x3a')](_0x266a11[_0x35fc('0x36')],qs[_0x35fc('0x3c')](_0x48d223[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x33a377['attributes']=_0x33a377[_0x35fc('0x3b')][_0x35fc('0x3d')]?_0x33a377[_0x35fc('0x3b')]:_0x266a11['model'];if(!_0x48d223[_0x35fc('0x38')][_0x35fc('0x3e')]('nolimit')){_0x33a377[_0x35fc('0x3f')]=qs[_0x35fc('0x3f')](_0x48d223[_0x35fc('0x38')][_0x35fc('0x3f')]);_0x33a377[_0x35fc('0x28')]=qs[_0x35fc('0x28')](_0x48d223[_0x35fc('0x38')][_0x35fc('0x28')]);}_0x33a377['order']=qs['sort'](_0x48d223[_0x35fc('0x38')][_0x35fc('0x40')]);_0x33a377['where']=qs['filters'](_['pick'](_0x48d223[_0x35fc('0x38')],_0x266a11[_0x35fc('0x41')]),_0x4de4b7);if(_0x48d223['query'][_0x35fc('0x42')]){_0x33a377[_0x35fc('0x43')]=_[_0x35fc('0x44')](_0x33a377[_0x35fc('0x43')],{'$or':_['map'](_0x4de4b7,function(_0x57105c){if(_0x57105c['type']!=='VIRTUAL'){var _0x56bdb9={};_0x56bdb9[_0x57105c[_0x35fc('0x31')]]={'$like':'%'+_0x48d223[_0x35fc('0x38')]['filter']+'%'};return _0x56bdb9;}})});}_0x33a377=_[_0x35fc('0x44')]({},_0x33a377,_0x48d223['options']);var _0x13d16c={'where':_0x33a377[_0x35fc('0x43')]};return db[_0x35fc('0x45')][_0x35fc('0x27')](_0x13d16c)[_0x35fc('0x1a')](function(_0x5d3d0f){_0x2e00e3[_0x35fc('0x27')]=_0x5d3d0f;if(_0x48d223[_0x35fc('0x38')]['includeAll']){_0x33a377[_0x35fc('0x46')]=[{'all':!![]}];}return db[_0x35fc('0x45')][_0x35fc('0x47')](_0x33a377);})[_0x35fc('0x1a')](function(_0x5bc8c3){_0x2e00e3[_0x35fc('0x48')]=_0x5bc8c3;return _0x2e00e3;})['then'](respondWithFilteredResult(_0x2ecb2e,_0x33a377))['catch'](handleError(_0x2ecb2e,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){var _0xca8aef={'raw':![],'where':{'id':_0x9db7e8[_0x35fc('0x4a')]['id']}},_0xf2ca20={};_0xf2ca20[_0x35fc('0x36')]=_[_0x35fc('0x39')](db['FreshdeskAccount'][_0x35fc('0x33')]);_0xf2ca20[_0x35fc('0x38')]=_[_0x35fc('0x39')](_0x9db7e8[_0x35fc('0x38')]);_0xf2ca20[_0x35fc('0x41')]=_[_0x35fc('0x3a')](_0xf2ca20[_0x35fc('0x36')],_0xf2ca20[_0x35fc('0x38')]);_0xca8aef[_0x35fc('0x3b')]=_[_0x35fc('0x3a')](_0xf2ca20[_0x35fc('0x36')],qs[_0x35fc('0x3c')](_0x9db7e8[_0x35fc('0x38')][_0x35fc('0x3c')]));_0xca8aef['attributes']=_0xca8aef['attributes'][_0x35fc('0x3d')]?_0xca8aef[_0x35fc('0x3b')]:_0xf2ca20[_0x35fc('0x36')];if(_0x9db7e8[_0x35fc('0x38')][_0x35fc('0x4b')]){_0xca8aef[_0x35fc('0x46')]=[{'all':!![]}];}_0xca8aef=_['merge']({},_0xca8aef,_0x9db7e8['options']);return db[_0x35fc('0x45')][_0x35fc('0x4c')](_0xca8aef)[_0x35fc('0x1a')](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0x1a')](respondWithResult(_0x18dc78,null))['catch'](handleError(_0x18dc78,null));};exports[_0x35fc('0x4d')]=function(_0x13281f,_0x4965d2){return db[_0x35fc('0x45')][_0x35fc('0x4d')](_0x13281f['body'],{})[_0x35fc('0x1a')](respondWithResult(_0x4965d2,0xc9))[_0x35fc('0x23')](handleError(_0x4965d2,null));};exports[_0x35fc('0x2e')]=function(_0x18f18b,_0x5e4018){if(_0x18f18b['body']['id']){delete _0x18f18b['body']['id'];}return db[_0x35fc('0x45')][_0x35fc('0x4c')]({'where':{'id':_0x18f18b['params']['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x5e4018,null))[_0x35fc('0x1a')](saveUpdates(_0x18f18b[_0x35fc('0x4e')],null))[_0x35fc('0x1a')](respondWithResult(_0x5e4018,null))[_0x35fc('0x23')](handleError(_0x5e4018,null));};exports['destroy']=function(_0x2d9d45,_0x757aa6){return db[_0x35fc('0x45')]['find']({'where':{'id':_0x2d9d45[_0x35fc('0x4a')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x757aa6,null))['then'](removeEntity(_0x757aa6,null))[_0x35fc('0x23')](handleError(_0x757aa6,null));};exports[_0x35fc('0x4f')]=function(_0x1c46b1,_0x1c4c33,_0x314666){var _0x41453b={};var _0x8501d1={};var _0x998fd9;var _0x53a79d;return db[_0x35fc('0x45')][_0x35fc('0x50')]({'where':{'id':_0x1c46b1[_0x35fc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c4c33,null))[_0x35fc('0x1a')](function(_0x559d2b){if(_0x559d2b){_0x998fd9=_0x559d2b;_0x8501d1['model']=_['keys'](db[_0x35fc('0x51')][_0x35fc('0x33')]);_0x8501d1[_0x35fc('0x38')]=_[_0x35fc('0x39')](_0x1c46b1[_0x35fc('0x38')]);_0x8501d1['filters']=_['intersection'](_0x8501d1['model'],_0x8501d1['query']);_0x41453b['attributes']=_[_0x35fc('0x3a')](_0x8501d1[_0x35fc('0x36')],qs[_0x35fc('0x3c')](_0x1c46b1[_0x35fc('0x38')]['fields']));_0x41453b[_0x35fc('0x3b')]=_0x41453b[_0x35fc('0x3b')][_0x35fc('0x3d')]?_0x41453b[_0x35fc('0x3b')]:_0x8501d1[_0x35fc('0x36')];_0x41453b[_0x35fc('0x52')]=qs[_0x35fc('0x40')](_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x40')]);_0x41453b['where']=qs[_0x35fc('0x41')](_['pick'](_0x1c46b1[_0x35fc('0x38')],_0x8501d1[_0x35fc('0x41')]));if(_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x42')]){_0x41453b['where']=_[_0x35fc('0x44')](_0x41453b['where'],{'$or':_['map'](_0x41453b['attributes'],function(_0x10dd1a){var _0x5dfeb7={};_0x5dfeb7[_0x10dd1a]={'$like':'%'+_0x1c46b1[_0x35fc('0x38')]['filter']+'%'};return _0x5dfeb7;})});}_0x41453b=_[_0x35fc('0x44')]({},_0x41453b,_0x1c46b1['options']);return _0x998fd9[_0x35fc('0x4f')](_0x41453b);}})[_0x35fc('0x1a')](function(_0x3400f0){if(_0x3400f0){_0x53a79d=_0x3400f0[_0x35fc('0x3d')];if(!_0x1c46b1['query'][_0x35fc('0x3e')](_0x35fc('0x53'))){_0x41453b[_0x35fc('0x3f')]=qs['limit'](_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x3f')]);_0x41453b[_0x35fc('0x28')]=qs[_0x35fc('0x28')](_0x1c46b1[_0x35fc('0x38')][_0x35fc('0x28')]);}return _0x998fd9[_0x35fc('0x4f')](_0x41453b);}})[_0x35fc('0x1a')](function(_0x5159a0){if(_0x5159a0){return _0x5159a0?{'count':_0x53a79d,'rows':_0x5159a0}:null;}})[_0x35fc('0x1a')](respondWithResult(_0x1c4c33,null))[_0x35fc('0x23')](handleError(_0x1c4c33,null));};exports[_0x35fc('0x54')]=function(_0x4a926d,_0x1c88d8,_0x1b76f0){if(_0x4a926d['body']['id']){delete _0x4a926d['body']['id'];}return db[_0x35fc('0x45')]['findOne']({'where':{'id':_0x4a926d[_0x35fc('0x4a')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x1c88d8,null))[_0x35fc('0x1a')](function(_0x10952a){if(_0x10952a){_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x55')]=_0x10952a['id'];_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x56')]=integrations[_0x35fc('0x57')](_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x58')],_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x59')]);_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x5a')]=integrations[_0x35fc('0x5b')](_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x58')],_0x4a926d[_0x35fc('0x4e')][_0x35fc('0x59')]);return db['FreshdeskConfiguration'][_0x35fc('0x4d')](_0x4a926d['body'],{'include':[{'model':db[_0x35fc('0x5c')],'as':_0x35fc('0x56')},{'model':db[_0x35fc('0x5c')],'as':_0x35fc('0x5a')}]});}return null;})[_0x35fc('0x1a')](respondWithResult(_0x1c88d8,null))[_0x35fc('0x23')](handleError(_0x1c88d8,null));};exports[_0x35fc('0x5d')]=function(_0x32023a,_0x2fed7b,_0x2656e5){var _0x2ee880='';return db['FreshdeskAccount'][_0x35fc('0x50')]({'where':{'id':_0x32023a[_0x35fc('0x4a')]['id']},'attributes':['id',_0x35fc('0x5e'),_0x35fc('0x5f')]})[_0x35fc('0x1a')](handleEntityNotFound(_0x2fed7b,null))[_0x35fc('0x1a')](function(_0x5416cd){if(_0x5416cd){_0x2ee880=_0x5416cd[_0x35fc('0x5e')];var _0x3353e0=_0x2ee880[_0x35fc('0x60')](-0x1);if(_0x3353e0==='/'){_0x2ee880=_0x2ee880[_0x35fc('0x61')](0x0,_0x2ee880[_0x35fc('0x62')](_0x3353e0));}return rp({'method':_0x35fc('0x63'),'uri':util[_0x35fc('0x64')](_0x35fc('0x65'),_0x2ee880,_0x35fc('0x66')),'headers':{'Authorization':util['format'](_0x35fc('0x67'),new Buffer(util['format'](_0x35fc('0x68'),_0x5416cd[_0x35fc('0x5f')]))['toString'](_0x35fc('0x69')))},'json':!![]});}})[_0x35fc('0x1a')](function(_0xcaa49){if(_0xcaa49){var _0x4274d6=[_0x35fc('0x6a'),_0x35fc('0x6b'),_0x35fc('0x6c'),_0x35fc('0x6d'),_0x35fc('0x24'),'priority','group','source','ticket_type',_0x35fc('0x6e'),_0x35fc('0x6f')];_[_0x35fc('0x70')](_0xcaa49,function(_0x1f5cbc){return _0x4274d6[_0x35fc('0x71')](_0x1f5cbc['name'])||!_0x1f5cbc[_0x35fc('0x72')]&&_0x1f5cbc[_0x35fc('0x59')]!==_0x35fc('0x73')&&_0x1f5cbc[_0x35fc('0x59')]!=='custom_dropdown';});return{'count':_0xcaa49[_0x35fc('0x3d')],'rows':_[_0x35fc('0x37')](_0xcaa49,function(_0x32b2df){return{'id':_0x32b2df['name'],'name':_0x32b2df[_0x35fc('0x74')],'custom':!_0x32b2df[_0x35fc('0x72')],'options':_0x32b2df[_0x35fc('0x75')]?_[_0x35fc('0x37')](_0x32b2df[_0x35fc('0x75')],function(_0x31d276){return{'name':_[_0x35fc('0x76')](_0x31d276),'value':_0x31d276};}):[]};})};}})[_0x35fc('0x1a')](respondWithResult(_0x2fed7b,null))['catch'](function(_0x2faff7){var _0xa2c5f8=_0x32023a[_0x35fc('0x38')][_0x35fc('0x19')]?0x1f4:_0x2faff7[_0x35fc('0x77')]||0x1f4;logger[_0x35fc('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x35fc('0x5d'),_0xa2c5f8,JSON['stringify'](_0x2faff7));delete _0x2faff7['name'];if(_0xa2c5f8===0x191){_0xa2c5f8=0x190;}_0x2fed7b[_0x35fc('0x24')](_0xa2c5f8)['send'](_0x32023a[_0x35fc('0x38')][_0x35fc('0x19')]?{'message':_0x35fc('0x78'),'statusCode':_0x2faff7['statusCode']}:_0x2faff7);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 34e0527..955e303 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 _0x3445=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x47ecd2,_0x2f9687){var _0x1da7fa=function(_0x3e7bf3){while(--_0x3e7bf3){_0x47ecd2['push'](_0x47ecd2['shift']());}};_0x1da7fa(++_0x2f9687);}(_0x3445,0x176));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var logger=require(_0x5344('0x2'))(_0x5344('0x3'));var moment=require(_0x5344('0x4'));var BPromise=require(_0x5344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5344('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x5344('0x7'));module[_0x5344('0x8')]=function(_0x2e7dcb,_0xf41288){return _0x2e7dcb[_0x5344('0x9')](_0x5344('0xa'),attributes,{'tableName':_0x5344('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5381=['moment','bluebird','request-promise','path','rimraf','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x4d0007,_0x1bb915){var _0x4d40df=function(_0x4becc7){while(--_0x4becc7){_0x4d0007['push'](_0x4d0007['shift']());}};_0x4d40df(++_0x1bb915);}(_0x5381,0x82));var _0x1538=function(_0x9beb50,_0xa586a3){_0x9beb50=_0x9beb50-0x0;var _0x1c2860=_0x5381[_0x9beb50];return _0x1c2860;};'use strict';var _=require(_0x1538('0x0'));var util=require(_0x1538('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1538('0x2'));var BPromise=require(_0x1538('0x3'));var rp=require(_0x1538('0x4'));var fs=require('fs');var path=require(_0x1538('0x5'));var rimraf=require(_0x1538('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1538('0x7')]=function(_0x3727d9,_0x42760e){return _0x3727d9[_0x1538('0x8')](_0x1538('0x9'),attributes,{'tableName':_0x1538('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index a2f256f..d92c191 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 _0x80a3=['moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','options','attributes','limit','map','model','include','catch','find','raw','where','ShowFreshdeskAccount','util'];(function(_0x5246ac,_0x380020){var _0x46f3a1=function(_0x774c7f){while(--_0x774c7f){_0x5246ac['push'](_0x5246ac['shift']());}};_0x46f3a1(++_0x380020);}(_0x80a3,0x192));var _0x380a=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x80a3[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require(_0x380a('0x0'));var moment=require(_0x380a('0x1'));var BPromise=require('bluebird');var rs=require(_0x380a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x380a('0x3'));var logger=require('../../config/logger')(_0x380a('0x4'));var config=require('../../config/environment');var jayson=require(_0x380a('0x5'));var client=jayson[_0x380a('0x6')][_0x380a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9905dd,_0x549295,_0x53eb14){return new BPromise(function(_0x35c0ae,_0x326864){return client['request'](_0x9905dd,_0x53eb14)[_0x380a('0x8')](function(_0x59dec9){logger[_0x380a('0x9')](_0x380a('0xa'),_0x549295,_0x380a('0xb'));logger[_0x380a('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x549295,_0x380a('0xb'),JSON[_0x380a('0xd')](_0x59dec9));if(_0x59dec9[_0x380a('0xe')]){if(_0x59dec9[_0x380a('0xe')][_0x380a('0xf')]===0x1f4){logger['error'](_0x380a('0xa'),_0x549295,_0x59dec9[_0x380a('0xe')]['message']);return _0x326864(_0x59dec9[_0x380a('0xe')][_0x380a('0x10')]);}logger[_0x380a('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x549295,_0x59dec9[_0x380a('0xe')][_0x380a('0x10')]);return _0x35c0ae(_0x59dec9['error'][_0x380a('0x10')]);}else{logger[_0x380a('0x9')](_0x380a('0xa'),_0x549295,_0x380a('0xb'));_0x35c0ae(_0x59dec9[_0x380a('0x11')][_0x380a('0x10')]);}})['catch'](function(_0x555ee3){logger['error'](_0x380a('0xa'),_0x549295,_0x555ee3);_0x326864(_0x555ee3);});});}exports[_0x380a('0x12')]=function(_0x58a0c9){var _0x36fbb0=this;return new Promise(function(_0x2156c6,_0x529001){return db[_0x380a('0x13')]['findAll']({'raw':_0x58a0c9[_0x380a('0x14')]?_0x58a0c9[_0x380a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x58a0c9[_0x380a('0x14')]?_0x58a0c9[_0x380a('0x14')]['where']||null:null,'attributes':_0x58a0c9[_0x380a('0x14')]?_0x58a0c9[_0x380a('0x14')][_0x380a('0x15')]||null:null,'limit':_0x58a0c9[_0x380a('0x14')]?_0x58a0c9[_0x380a('0x14')][_0x380a('0x16')]||null:null,'include':_0x58a0c9['options']?_0x58a0c9[_0x380a('0x14')]['include']?_[_0x380a('0x17')](_0x58a0c9[_0x380a('0x14')]['include'],function(_0x581cb9){return{'model':db[_0x581cb9[_0x380a('0x18')]],'as':_0x581cb9['as'],'attributes':_0x581cb9['attributes'],'include':_0x581cb9[_0x380a('0x19')]?_['map'](_0x581cb9[_0x380a('0x19')],function(_0x4247a4){return{'model':db[_0x4247a4[_0x380a('0x18')]],'as':_0x4247a4['as'],'attributes':_0x4247a4['attributes'],'include':_0x4247a4['include']?_[_0x380a('0x17')](_0x4247a4['include'],function(_0xdf338c){return{'model':db[_0xdf338c[_0x380a('0x18')]],'as':_0xdf338c['as'],'attributes':_0xdf338c[_0x380a('0x15')]};}):[]};}):[]};}):[]:[]})[_0x380a('0x8')](function(_0x43c949){logger[_0x380a('0x9')](_0x380a('0x12'),_0x58a0c9);logger[_0x380a('0xc')](_0x380a('0x12'),_0x58a0c9,JSON[_0x380a('0xd')](_0x43c949));_0x2156c6(_0x43c949);})[_0x380a('0x1a')](function(_0x4aa99a){logger[_0x380a('0xe')](_0x380a('0x12'),_0x4aa99a['message'],_0x58a0c9);_0x529001(_0x36fbb0[_0x380a('0xe')](0x1f4,_0x4aa99a[_0x380a('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x272020){var _0xc2068d=this;return new Promise(function(_0x496436,_0x4b3477){return db[_0x380a('0x13')][_0x380a('0x1b')]({'raw':_0x272020[_0x380a('0x14')]?_0x272020[_0x380a('0x14')][_0x380a('0x1c')]===undefined?!![]:![]:!![],'where':_0x272020['options']?_0x272020[_0x380a('0x14')][_0x380a('0x1d')]||null:null,'attributes':_0x272020['options']?_0x272020[_0x380a('0x14')][_0x380a('0x15')]||null:null,'include':_0x272020[_0x380a('0x14')]?_0x272020[_0x380a('0x14')][_0x380a('0x19')]?_[_0x380a('0x17')](_0x272020[_0x380a('0x14')][_0x380a('0x19')],function(_0xd07639){return{'model':db[_0xd07639[_0x380a('0x18')]],'as':_0xd07639['as'],'attributes':_0xd07639['attributes'],'include':_0xd07639[_0x380a('0x19')]?_[_0x380a('0x17')](_0xd07639[_0x380a('0x19')],function(_0x458d83){return{'model':db[_0x458d83['model']],'as':_0x458d83['as'],'attributes':_0x458d83[_0x380a('0x15')],'include':_0x458d83[_0x380a('0x19')]?_[_0x380a('0x17')](_0x458d83[_0x380a('0x19')],function(_0x5776d0){return{'model':db[_0x5776d0[_0x380a('0x18')]],'as':_0x5776d0['as'],'attributes':_0x5776d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x380a('0x8')](function(_0x3cf331){logger[_0x380a('0x9')](_0x380a('0x1e'),_0x272020);logger[_0x380a('0xc')](_0x380a('0x1e'),_0x272020,JSON['stringify'](_0x3cf331));_0x496436(_0x3cf331);})['catch'](function(_0x54ae76){logger[_0x380a('0xe')](_0x380a('0x1e'),_0x54ae76[_0x380a('0x10')],_0x272020);_0x4b3477(_0xc2068d[_0x380a('0xe')](0x1f4,_0x54ae76[_0x380a('0x10')]));});});}; \ No newline at end of file +var _0x97ba=['map','include','model','then','GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','request\x20sent','catch','FreshdeskAccount','findAll','options','where','attributes','limit'];(function(_0x248a2f,_0x431022){var _0x203a43=function(_0x3a4cea){while(--_0x3a4cea){_0x248a2f['push'](_0x248a2f['shift']());}};_0x203a43(++_0x431022);}(_0x97ba,0xc8));var _0xa97b=function(_0x222755,_0x4b08c6){_0x222755=_0x222755-0x0;var _0x30ef8e=_0x97ba[_0x222755];return _0x30ef8e;};'use strict';var _=require(_0xa97b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa97b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa97b('0x2'))['db'];var utils=require(_0xa97b('0x3'));var logger=require(_0xa97b('0x4'))(_0xa97b('0x5'));var config=require(_0xa97b('0x6'));var jayson=require(_0xa97b('0x7'));var client=jayson[_0xa97b('0x8')][_0xa97b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30fe11,_0x506a54,_0xb30db8){return new BPromise(function(_0xde5b40,_0x3c7f79){return client['request'](_0x30fe11,_0xb30db8)['then'](function(_0x4790b6){logger[_0xa97b('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x506a54,'request\x20sent');logger[_0xa97b('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x506a54,'request\x20sent',JSON[_0xa97b('0xc')](_0x4790b6));if(_0x4790b6[_0xa97b('0xd')]){if(_0x4790b6[_0xa97b('0xd')]['code']===0x1f4){logger[_0xa97b('0xd')](_0xa97b('0xe'),_0x506a54,_0x4790b6[_0xa97b('0xd')]['message']);return _0x3c7f79(_0x4790b6[_0xa97b('0xd')]['message']);}logger[_0xa97b('0xd')](_0xa97b('0xe'),_0x506a54,_0x4790b6[_0xa97b('0xd')][_0xa97b('0xf')]);return _0xde5b40(_0x4790b6['error'][_0xa97b('0xf')]);}else{logger[_0xa97b('0xa')](_0xa97b('0xe'),_0x506a54,_0xa97b('0x10'));_0xde5b40(_0x4790b6['result'][_0xa97b('0xf')]);}})[_0xa97b('0x11')](function(_0x129baf){logger[_0xa97b('0xd')](_0xa97b('0xe'),_0x506a54,_0x129baf);_0x3c7f79(_0x129baf);});});}exports['GetFreshdeskAccount']=function(_0x2bb251){var _0x2092b4=this;return new Promise(function(_0x301e9d,_0x44398b){return db[_0xa97b('0x12')][_0xa97b('0x13')]({'raw':_0x2bb251[_0xa97b('0x14')]?_0x2bb251[_0xa97b('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2bb251[_0xa97b('0x14')]?_0x2bb251[_0xa97b('0x14')][_0xa97b('0x15')]||null:null,'attributes':_0x2bb251['options']?_0x2bb251[_0xa97b('0x14')][_0xa97b('0x16')]||null:null,'limit':_0x2bb251['options']?_0x2bb251['options'][_0xa97b('0x17')]||null:null,'include':_0x2bb251[_0xa97b('0x14')]?_0x2bb251[_0xa97b('0x14')]['include']?_[_0xa97b('0x18')](_0x2bb251['options'][_0xa97b('0x19')],function(_0x51451d){return{'model':db[_0x51451d[_0xa97b('0x1a')]],'as':_0x51451d['as'],'attributes':_0x51451d[_0xa97b('0x16')],'include':_0x51451d[_0xa97b('0x19')]?_[_0xa97b('0x18')](_0x51451d[_0xa97b('0x19')],function(_0x4807da){return{'model':db[_0x4807da[_0xa97b('0x1a')]],'as':_0x4807da['as'],'attributes':_0x4807da[_0xa97b('0x16')],'include':_0x4807da[_0xa97b('0x19')]?_[_0xa97b('0x18')](_0x4807da['include'],function(_0x2e2e1b){return{'model':db[_0x2e2e1b[_0xa97b('0x1a')]],'as':_0x2e2e1b['as'],'attributes':_0x2e2e1b['attributes']};}):[]};}):[]};}):[]:[]})[_0xa97b('0x1b')](function(_0x1a7b55){logger[_0xa97b('0xa')](_0xa97b('0x1c'),_0x2bb251);logger[_0xa97b('0xb')]('GetFreshdeskAccount',_0x2bb251,JSON['stringify'](_0x1a7b55));_0x301e9d(_0x1a7b55);})[_0xa97b('0x11')](function(_0x48cdc0){logger[_0xa97b('0xd')](_0xa97b('0x1c'),_0x48cdc0['message'],_0x2bb251);_0x44398b(_0x2092b4['error'](0x1f4,_0x48cdc0['message']));});});};exports[_0xa97b('0x1d')]=function(_0x48bfe2){var _0x51f86c=this;return new Promise(function(_0x3c120f,_0x226acb){return db[_0xa97b('0x12')][_0xa97b('0x1e')]({'raw':_0x48bfe2[_0xa97b('0x14')]?_0x48bfe2['options'][_0xa97b('0x1f')]===undefined?!![]:![]:!![],'where':_0x48bfe2['options']?_0x48bfe2[_0xa97b('0x14')][_0xa97b('0x15')]||null:null,'attributes':_0x48bfe2[_0xa97b('0x14')]?_0x48bfe2[_0xa97b('0x14')][_0xa97b('0x16')]||null:null,'include':_0x48bfe2[_0xa97b('0x14')]?_0x48bfe2['options'][_0xa97b('0x19')]?_[_0xa97b('0x18')](_0x48bfe2[_0xa97b('0x14')][_0xa97b('0x19')],function(_0x4c10db){return{'model':db[_0x4c10db[_0xa97b('0x1a')]],'as':_0x4c10db['as'],'attributes':_0x4c10db[_0xa97b('0x16')],'include':_0x4c10db['include']?_[_0xa97b('0x18')](_0x4c10db[_0xa97b('0x19')],function(_0x318947){return{'model':db[_0x318947[_0xa97b('0x1a')]],'as':_0x318947['as'],'attributes':_0x318947['attributes'],'include':_0x318947[_0xa97b('0x19')]?_[_0xa97b('0x18')](_0x318947[_0xa97b('0x19')],function(_0x5b77f3){return{'model':db[_0x5b77f3[_0xa97b('0x1a')]],'as':_0x5b77f3['as'],'attributes':_0x5b77f3[_0xa97b('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa97b('0x1b')](function(_0x443d70){logger[_0xa97b('0xa')]('ShowFreshdeskAccount',_0x48bfe2);logger[_0xa97b('0xb')]('ShowFreshdeskAccount',_0x48bfe2,JSON[_0xa97b('0xc')](_0x443d70));_0x3c120f(_0x443d70);})[_0xa97b('0x11')](function(_0x2f655e){logger['error'](_0xa97b('0x1d'),_0x2f655e[_0xa97b('0xf')],_0x48bfe2);_0x226acb(_0x51f86c[_0xa97b('0xd')](0x1f4,_0x2f655e[_0xa97b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4d80246..3c957ba 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 _0x794a=['../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x359079,_0x29ac4e){var _0x1b0e5d=function(_0x34f20c){while(--_0x34f20c){_0x359079['push'](_0x359079['shift']());}};_0x1b0e5d(++_0x29ac4e);}(_0x794a,0x10e));var _0xa794=function(_0x1e3f22,_0xf293aa){_0x1e3f22=_0x1e3f22-0x0;var _0x243d0a=_0x794a[_0x1e3f22];return _0x243d0a;};'use strict';var multer=require('multer');var util=require(_0xa794('0x0'));var path=require(_0xa794('0x1'));var timeout=require(_0xa794('0x2'));var express=require(_0xa794('0x3'));var router=express[_0xa794('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa794('0x5'));var config=require('../../config/environment');var controller=require(_0xa794('0x6'));router[_0xa794('0x7')]('/',auth[_0xa794('0x8')](),controller[_0xa794('0x9')]);router[_0xa794('0x7')](_0xa794('0xa'),auth[_0xa794('0x8')](),controller['show']);router['get'](_0xa794('0xb'),auth['isAuthenticated'](),controller[_0xa794('0xc')]);router['get'](_0xa794('0xd'),auth[_0xa794('0x8')](),controller[_0xa794('0xe')]);router[_0xa794('0x7')](_0xa794('0xf'),auth[_0xa794('0x8')](),controller[_0xa794('0x10')]);router['get'](_0xa794('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0xa794('0x12')]('/',auth[_0xa794('0x8')](),controller[_0xa794('0x13')]);router['post'](_0xa794('0x11'),auth[_0xa794('0x8')](),controller[_0xa794('0x14')]);router[_0xa794('0x15')](_0xa794('0xa'),auth[_0xa794('0x8')](),controller[_0xa794('0x16')]);router['delete'](_0xa794('0xa'),auth[_0xa794('0x8')](),controller[_0xa794('0x17')]);module[_0xa794('0x18')]=router; \ No newline at end of file +var _0x06eb=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intFreshdeskConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy'];(function(_0x51d3dc,_0x4cda7f){var _0x4d4ba1=function(_0x353c44){while(--_0x353c44){_0x51d3dc['push'](_0x51d3dc['shift']());}};_0x4d4ba1(++_0x4cda7f);}(_0x06eb,0x139));var _0xb06e=function(_0x46a536,_0x13d6bd){_0x46a536=_0x46a536-0x0;var _0x561fc0=_0x06eb[_0x46a536];return _0x561fc0;};'use strict';var multer=require(_0xb06e('0x0'));var util=require('util');var path=require(_0xb06e('0x1'));var timeout=require(_0xb06e('0x2'));var express=require(_0xb06e('0x3'));var router=express[_0xb06e('0x4')]();var auth=require(_0xb06e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb06e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb06e('0x7')]);router[_0xb06e('0x8')](_0xb06e('0x9'),auth[_0xb06e('0xa')](),controller['show']);router[_0xb06e('0x8')](_0xb06e('0xb'),auth[_0xb06e('0xa')](),controller['getFields']);router['get'](_0xb06e('0xc'),auth[_0xb06e('0xa')](),controller[_0xb06e('0xd')]);router[_0xb06e('0x8')]('/:id/descriptions',auth[_0xb06e('0xa')](),controller[_0xb06e('0xe')]);router[_0xb06e('0x8')](_0xb06e('0xf'),auth[_0xb06e('0xa')](),controller[_0xb06e('0x10')]);router[_0xb06e('0x11')]('/',auth[_0xb06e('0xa')](),controller[_0xb06e('0x12')]);router[_0xb06e('0x11')](_0xb06e('0xf'),auth[_0xb06e('0xa')](),controller[_0xb06e('0x13')]);router[_0xb06e('0x14')]('/:id',auth[_0xb06e('0xa')](),controller[_0xb06e('0x15')]);router['delete'](_0xb06e('0x9'),auth[_0xb06e('0xa')](),controller[_0xb06e('0x16')]);module[_0xb06e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index bb52c5b..c1ced34 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 _0xcabc=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcabc,0x1d4));var _0xccab=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcabc[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xccab('0x0'));module[_0xccab('0x1')]={'name':{'type':Sequelize[_0xccab('0x2')]},'description':{'type':Sequelize[_0xccab('0x2')]}}; \ No newline at end of file +var _0x4a18=['exports','STRING','sequelize'];(function(_0x2e9d8e,_0x3a377e){var _0x4dfc9b=function(_0x499ec4){while(--_0x499ec4){_0x2e9d8e['push'](_0x2e9d8e['shift']());}};_0x4dfc9b(++_0x3a377e);}(_0x4a18,0x116));var _0x84a1=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x4a18[_0x2ef44b];return _0x2405b9;};'use strict';var Sequelize=require(_0x84a1('0x0'));module[_0x84a1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x84a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2c2a421..aec8c1e 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 _0xa9b1=['include','findAll','show','params','keys','includeAll','find','create','body','getFields','FreshdeskField','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','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~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1a9b('0x0'));var zipdir=require(_0x1a9b('0x1'));var jsonpatch=require(_0x1a9b('0x2'));var rp=require(_0x1a9b('0x3'));var moment=require(_0x1a9b('0x4'));var BPromise=require(_0x1a9b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a9b('0x6'));var csv=require(_0x1a9b('0x7'));var ejs=require(_0x1a9b('0x8'));var fs=require('fs');var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x7'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1a9b('0x14'))['db'];var jayson=require(_0x1a9b('0x15'));var client=jayson[_0x1a9b('0x16')][_0x1a9b('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2c3170,_0x8fe93a,_0x5ab149){if(_0x5ab149){var _0x3c1ba4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c1ba4[_0x1a9b('0x18')](_0x8fe93a)){return _0x2c3170;}else{throw new db[(_0x1a9b('0x19'))]['ValidationError'](_0x1a9b('0x1a'));}}else{return _0x2c3170;}}function respondWithRpcPromise(_0x38145b,_0x55a00d,_0x2a7d72,_0x57ca87){return new BPromise(function(_0x439acd,_0x34b776){var _0xa77d19=_0x57ca87||client;return _0xa77d19[_0x1a9b('0x1b')](_0x38145b,_0x2a7d72)[_0x1a9b('0x1c')](function(_0x20b8dc){logger[_0x1a9b('0x1d')](_0x1a9b('0x1e'),_0x55a00d,_0x1a9b('0x1f'));logger[_0x1a9b('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x55a00d,_0x1a9b('0x1f'),JSON[_0x1a9b('0x21')](_0x20b8dc));if(_0x20b8dc[_0x1a9b('0x22')]){if(_0x20b8dc[_0x1a9b('0x22')]['code']===0x1f4){logger[_0x1a9b('0x22')](_0x1a9b('0x1e'),_0x55a00d,_0x20b8dc['error'][_0x1a9b('0x23')]);return _0x34b776(_0x20b8dc[_0x1a9b('0x22')][_0x1a9b('0x23')]);}logger[_0x1a9b('0x22')](_0x1a9b('0x1e'),_0x55a00d,_0x20b8dc['error'][_0x1a9b('0x23')]);return _0x439acd(_0x20b8dc[_0x1a9b('0x22')][_0x1a9b('0x23')]);}else{logger[_0x1a9b('0x1d')](_0x1a9b('0x1e'),_0x55a00d,_0x1a9b('0x1f'));_0x439acd(_0x20b8dc[_0x1a9b('0x24')]['message']);}})[_0x1a9b('0x25')](function(_0x559869){logger[_0x1a9b('0x22')](_0x1a9b('0x1e'),_0x55a00d,_0x559869);_0x34b776(_0x559869);});});}function respondWithStatusCode(_0xad6541,_0x4e7234){_0x4e7234=_0x4e7234||0xcc;return function(_0x213841){if(_0x213841){return _0xad6541[_0x1a9b('0x26')](_0x4e7234);}return _0xad6541[_0x1a9b('0x27')](_0x4e7234)[_0x1a9b('0x28')]();};}function respondWithResult(_0x18c9dd,_0x22c3a5){_0x22c3a5=_0x22c3a5||0xc8;return function(_0x49d440){if(_0x49d440){return _0x18c9dd[_0x1a9b('0x27')](_0x22c3a5)[_0x1a9b('0x29')](_0x49d440);}};}function respondWithFilteredResult(_0x566fb4,_0x165fc0){return function(_0xbc54e3){if(_0xbc54e3){var _0x5d70dc=_0xbc54e3['count'],_0x5d7e8c=_0x165fc0[_0x1a9b('0x2a')],_0x3f8e98=_0x165fc0[_0x1a9b('0x2a')]+_0x165fc0[_0x1a9b('0x2b')],_0x1d981e;if(_0x3f8e98>=_0x5d70dc){_0x3f8e98=_0x5d70dc;_0x1d981e=0xc8;}else{_0x1d981e=0xce;}_0x566fb4[_0x1a9b('0x27')](_0x1d981e);return _0x566fb4[_0x1a9b('0x2c')](_0x1a9b('0x2d'),_0x5d7e8c+'-'+_0x3f8e98+'/'+_0x5d70dc)[_0x1a9b('0x29')](_0xbc54e3);}return null;};}function patchUpdates(_0x5ed1e3){return function(_0x3ba2fe){try{jsonpatch[_0x1a9b('0x2e')](_0x3ba2fe,_0x5ed1e3,!![]);}catch(_0x3af95c){return BPromise[_0x1a9b('0x2f')](_0x3af95c);}return _0x3ba2fe[_0x1a9b('0x30')]();};}function saveUpdates(_0x284b5f,_0xe0dd38){return function(_0x3fadcd){if(_0x3fadcd){return _0x3fadcd[_0x1a9b('0x31')](_0x284b5f)[_0x1a9b('0x1c')](function(_0xa2995c){return _0xa2995c;});}return null;};}function removeEntity(_0x4c0827,_0x579a34){return function(_0x26a8e9){if(_0x26a8e9){return _0x26a8e9[_0x1a9b('0x32')]()[_0x1a9b('0x1c')](function(){_0x4c0827['status'](0xcc)[_0x1a9b('0x28')]();});}};}function handleEntityNotFound(_0x50f835,_0x2595f1){return function(_0x59b5ba){if(!_0x59b5ba){_0x50f835[_0x1a9b('0x26')](0x194);}return _0x59b5ba;};}function handleError(_0x30d39d,_0x56cbaa){_0x56cbaa=_0x56cbaa||0x1f4;return function(_0x250662){logger['error'](_0x250662[_0x1a9b('0x33')]);if(_0x250662[_0x1a9b('0x34')]){delete _0x250662[_0x1a9b('0x34')];}_0x30d39d[_0x1a9b('0x27')](_0x56cbaa)['send'](_0x250662);};}exports[_0x1a9b('0x35')]=function(_0x31dae0,_0x26bcb6){var _0x5ceda8={},_0x126f89={},_0x5be8b9={'count':0x0,'rows':[]};var _0x51a28a=_[_0x1a9b('0x36')](db[_0x1a9b('0x37')][_0x1a9b('0x38')],function(_0x42f540){return{'name':_0x42f540[_0x1a9b('0x39')],'type':_0x42f540[_0x1a9b('0x3a')][_0x1a9b('0x3b')]};});_0x126f89['model']=_[_0x1a9b('0x36')](_0x51a28a,_0x1a9b('0x34'));_0x126f89[_0x1a9b('0x3c')]=_['keys'](_0x31dae0[_0x1a9b('0x3c')]);_0x126f89[_0x1a9b('0x3d')]=_[_0x1a9b('0x3e')](_0x126f89[_0x1a9b('0x3f')],_0x126f89['query']);_0x5ceda8['attributes']=_[_0x1a9b('0x3e')](_0x126f89[_0x1a9b('0x3f')],qs[_0x1a9b('0x40')](_0x31dae0['query']['fields']));_0x5ceda8[_0x1a9b('0x41')]=_0x5ceda8[_0x1a9b('0x41')][_0x1a9b('0x42')]?_0x5ceda8[_0x1a9b('0x41')]:_0x126f89[_0x1a9b('0x3f')];if(!_0x31dae0[_0x1a9b('0x3c')][_0x1a9b('0x43')]('nolimit')){_0x5ceda8[_0x1a9b('0x2b')]=qs[_0x1a9b('0x2b')](_0x31dae0[_0x1a9b('0x3c')][_0x1a9b('0x2b')]);_0x5ceda8[_0x1a9b('0x2a')]=qs[_0x1a9b('0x2a')](_0x31dae0[_0x1a9b('0x3c')][_0x1a9b('0x2a')]);}_0x5ceda8[_0x1a9b('0x44')]=qs[_0x1a9b('0x45')](_0x31dae0[_0x1a9b('0x3c')][_0x1a9b('0x45')]);_0x5ceda8[_0x1a9b('0x46')]=qs[_0x1a9b('0x3d')](_[_0x1a9b('0x47')](_0x31dae0[_0x1a9b('0x3c')],_0x126f89['filters']),_0x51a28a);if(_0x31dae0[_0x1a9b('0x3c')][_0x1a9b('0x48')]){_0x5ceda8['where']=_[_0x1a9b('0x49')](_0x5ceda8['where'],{'$or':_['map'](_0x51a28a,function(_0x2311eb){if(_0x2311eb[_0x1a9b('0x3a')]!==_0x1a9b('0x4a')){var _0x432b3d={};_0x432b3d[_0x2311eb[_0x1a9b('0x34')]]={'$like':'%'+_0x31dae0[_0x1a9b('0x3c')][_0x1a9b('0x48')]+'%'};return _0x432b3d;}})});}_0x5ceda8=_['merge']({},_0x5ceda8,_0x31dae0[_0x1a9b('0x4b')]);var _0x3595fa={'where':_0x5ceda8[_0x1a9b('0x46')]};return db[_0x1a9b('0x37')]['count'](_0x3595fa)[_0x1a9b('0x1c')](function(_0x43d00a){_0x5be8b9[_0x1a9b('0x4c')]=_0x43d00a;if(_0x31dae0[_0x1a9b('0x3c')]['includeAll']){_0x5ceda8[_0x1a9b('0x4d')]=[{'all':!![]}];}return db[_0x1a9b('0x37')][_0x1a9b('0x4e')](_0x5ceda8);})[_0x1a9b('0x1c')](function(_0x38c609){_0x5be8b9['rows']=_0x38c609;return _0x5be8b9;})['then'](respondWithFilteredResult(_0x26bcb6,_0x5ceda8))[_0x1a9b('0x25')](handleError(_0x26bcb6,null));};exports[_0x1a9b('0x4f')]=function(_0x5dad36,_0x52b06e){var _0x252140={'raw':![],'where':{'id':_0x5dad36[_0x1a9b('0x50')]['id']}},_0x369156={};_0x369156['model']=_[_0x1a9b('0x51')](db[_0x1a9b('0x37')][_0x1a9b('0x38')]);_0x369156[_0x1a9b('0x3c')]=_[_0x1a9b('0x51')](_0x5dad36[_0x1a9b('0x3c')]);_0x369156[_0x1a9b('0x3d')]=_['intersection'](_0x369156['model'],_0x369156['query']);_0x252140[_0x1a9b('0x41')]=_[_0x1a9b('0x3e')](_0x369156[_0x1a9b('0x3f')],qs[_0x1a9b('0x40')](_0x5dad36[_0x1a9b('0x3c')]['fields']));_0x252140[_0x1a9b('0x41')]=_0x252140[_0x1a9b('0x41')][_0x1a9b('0x42')]?_0x252140[_0x1a9b('0x41')]:_0x369156[_0x1a9b('0x3f')];if(_0x5dad36[_0x1a9b('0x3c')][_0x1a9b('0x52')]){_0x252140[_0x1a9b('0x4d')]=[{'all':!![]}];}_0x252140=_[_0x1a9b('0x49')]({},_0x252140,_0x5dad36[_0x1a9b('0x4b')]);return db[_0x1a9b('0x37')][_0x1a9b('0x53')](_0x252140)[_0x1a9b('0x1c')](handleEntityNotFound(_0x52b06e,null))[_0x1a9b('0x1c')](respondWithResult(_0x52b06e,null))[_0x1a9b('0x25')](handleError(_0x52b06e,null));};exports[_0x1a9b('0x54')]=function(_0x3b6c1f,_0x2f3db2){return db[_0x1a9b('0x37')][_0x1a9b('0x54')](_0x3b6c1f[_0x1a9b('0x55')],{})['then'](respondWithResult(_0x2f3db2,0xc9))['catch'](handleError(_0x2f3db2,null));};exports[_0x1a9b('0x31')]=function(_0x46edfb,_0x1da0c4){if(_0x46edfb[_0x1a9b('0x55')]['id']){delete _0x46edfb['body']['id'];}return db[_0x1a9b('0x37')]['find']({'where':{'id':_0x46edfb[_0x1a9b('0x50')]['id']}})[_0x1a9b('0x1c')](handleEntityNotFound(_0x1da0c4,null))[_0x1a9b('0x1c')](saveUpdates(_0x46edfb[_0x1a9b('0x55')],null))[_0x1a9b('0x1c')](respondWithResult(_0x1da0c4,null))[_0x1a9b('0x25')](handleError(_0x1da0c4,null));};exports[_0x1a9b('0x32')]=function(_0x414d2e,_0x2c8323){return db[_0x1a9b('0x37')][_0x1a9b('0x53')]({'where':{'id':_0x414d2e[_0x1a9b('0x50')]['id']}})[_0x1a9b('0x1c')](handleEntityNotFound(_0x2c8323,null))[_0x1a9b('0x1c')](removeEntity(_0x2c8323,null))[_0x1a9b('0x25')](handleError(_0x2c8323,null));};exports[_0x1a9b('0x56')]=function(_0x1f1a92,_0x20c44d,_0x4e4eab){var _0x475bd2={};var _0x8b4544={};var _0x11d8da;var _0x2ac21f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1f1a92[_0x1a9b('0x50')]['id']}})[_0x1a9b('0x1c')](handleEntityNotFound(_0x20c44d,null))[_0x1a9b('0x1c')](function(_0x427909){if(_0x427909){_0x11d8da=_0x427909;_0x8b4544[_0x1a9b('0x3f')]=_[_0x1a9b('0x51')](db[_0x1a9b('0x57')][_0x1a9b('0x38')]);_0x8b4544[_0x1a9b('0x3c')]=_[_0x1a9b('0x51')](_0x1f1a92[_0x1a9b('0x3c')]);_0x8b4544[_0x1a9b('0x3d')]=_[_0x1a9b('0x3e')](_0x8b4544[_0x1a9b('0x3f')],_0x8b4544[_0x1a9b('0x3c')]);_0x475bd2[_0x1a9b('0x41')]=_[_0x1a9b('0x3e')](_0x8b4544[_0x1a9b('0x3f')],qs[_0x1a9b('0x40')](_0x1f1a92['query'][_0x1a9b('0x40')]));_0x475bd2[_0x1a9b('0x41')]=_0x475bd2[_0x1a9b('0x41')]['length']?_0x475bd2[_0x1a9b('0x41')]:_0x8b4544[_0x1a9b('0x3f')];_0x475bd2['order']=qs[_0x1a9b('0x45')](_0x1f1a92[_0x1a9b('0x3c')][_0x1a9b('0x45')]);_0x475bd2[_0x1a9b('0x46')]=qs[_0x1a9b('0x3d')](_[_0x1a9b('0x47')](_0x1f1a92[_0x1a9b('0x3c')],_0x8b4544[_0x1a9b('0x3d')]));if(_0x1f1a92['query']['filter']){_0x475bd2[_0x1a9b('0x46')]=_[_0x1a9b('0x49')](_0x475bd2[_0x1a9b('0x46')],{'$or':_[_0x1a9b('0x36')](_0x475bd2['attributes'],function(_0x1f32a1){var _0x2b4567={};_0x2b4567[_0x1f32a1]={'$like':'%'+_0x1f1a92[_0x1a9b('0x3c')]['filter']+'%'};return _0x2b4567;})});}_0x475bd2=_['merge']({},_0x475bd2,_0x1f1a92[_0x1a9b('0x4b')]);return _0x11d8da['getFields'](_0x475bd2);}})['then'](function(_0x786e98){if(_0x786e98){_0x2ac21f=_0x786e98[_0x1a9b('0x42')];if(!_0x1f1a92[_0x1a9b('0x3c')]['hasOwnProperty'](_0x1a9b('0x58'))){_0x475bd2[_0x1a9b('0x2b')]=qs[_0x1a9b('0x2b')](_0x1f1a92['query'][_0x1a9b('0x2b')]);_0x475bd2['offset']=qs['offset'](_0x1f1a92[_0x1a9b('0x3c')][_0x1a9b('0x2a')]);}return _0x11d8da[_0x1a9b('0x56')](_0x475bd2);}})[_0x1a9b('0x1c')](function(_0x5f226b){if(_0x5f226b){return _0x5f226b?{'count':_0x2ac21f,'rows':_0x5f226b}:null;}})['then'](respondWithResult(_0x20c44d,null))[_0x1a9b('0x25')](handleError(_0x20c44d,null));};exports[_0x1a9b('0x59')]=function(_0x423f45,_0x16dfa9,_0x5e0572){var _0xa58bee={};var _0x38afc0={};var _0x96333;var _0x47be7e;return db[_0x1a9b('0x37')][_0x1a9b('0x5a')]({'where':{'id':_0x423f45['params']['id']}})[_0x1a9b('0x1c')](handleEntityNotFound(_0x16dfa9,null))[_0x1a9b('0x1c')](function(_0xdd61c){if(_0xdd61c){_0x96333=_0xdd61c;_0x38afc0[_0x1a9b('0x3f')]=_['keys'](db[_0x1a9b('0x57')]['rawAttributes']);_0x38afc0[_0x1a9b('0x3c')]=_[_0x1a9b('0x51')](_0x423f45['query']);_0x38afc0[_0x1a9b('0x3d')]=_[_0x1a9b('0x3e')](_0x38afc0[_0x1a9b('0x3f')],_0x38afc0['query']);_0xa58bee[_0x1a9b('0x41')]=_['intersection'](_0x38afc0['model'],qs['fields'](_0x423f45[_0x1a9b('0x3c')][_0x1a9b('0x40')]));_0xa58bee[_0x1a9b('0x41')]=_0xa58bee[_0x1a9b('0x41')][_0x1a9b('0x42')]?_0xa58bee[_0x1a9b('0x41')]:_0x38afc0[_0x1a9b('0x3f')];_0xa58bee[_0x1a9b('0x44')]=qs[_0x1a9b('0x45')](_0x423f45['query'][_0x1a9b('0x45')]);_0xa58bee['where']=qs[_0x1a9b('0x3d')](_[_0x1a9b('0x47')](_0x423f45[_0x1a9b('0x3c')],_0x38afc0[_0x1a9b('0x3d')]));if(_0x423f45[_0x1a9b('0x3c')][_0x1a9b('0x48')]){_0xa58bee[_0x1a9b('0x46')]=_[_0x1a9b('0x49')](_0xa58bee[_0x1a9b('0x46')],{'$or':_[_0x1a9b('0x36')](_0xa58bee[_0x1a9b('0x41')],function(_0x1c46a3){var _0x3cf148={};_0x3cf148[_0x1c46a3]={'$like':'%'+_0x423f45[_0x1a9b('0x3c')]['filter']+'%'};return _0x3cf148;})});}_0xa58bee=_[_0x1a9b('0x49')]({},_0xa58bee,_0x423f45['options']);return _0x96333[_0x1a9b('0x59')](_0xa58bee);}})[_0x1a9b('0x1c')](function(_0x965984){if(_0x965984){_0x47be7e=_0x965984[_0x1a9b('0x42')];if(!_0x423f45[_0x1a9b('0x3c')]['hasOwnProperty'](_0x1a9b('0x58'))){_0xa58bee['limit']=qs['limit'](_0x423f45[_0x1a9b('0x3c')][_0x1a9b('0x2b')]);_0xa58bee[_0x1a9b('0x2a')]=qs[_0x1a9b('0x2a')](_0x423f45[_0x1a9b('0x3c')]['offset']);}return _0x96333[_0x1a9b('0x59')](_0xa58bee);}})['then'](function(_0x438da7){if(_0x438da7){return _0x438da7?{'count':_0x47be7e,'rows':_0x438da7}:null;}})[_0x1a9b('0x1c')](respondWithResult(_0x16dfa9,null))[_0x1a9b('0x25')](handleError(_0x16dfa9,null));};exports[_0x1a9b('0x5b')]=function(_0xa2d400,_0x50a588,_0x3d0325){var _0x24f05f={};var _0x4dc989={};var _0x482d5a;var _0x192783;return db[_0x1a9b('0x37')][_0x1a9b('0x5a')]({'where':{'id':_0xa2d400['params']['id']}})['then'](handleEntityNotFound(_0x50a588,null))[_0x1a9b('0x1c')](function(_0x617a7a){if(_0x617a7a){_0x482d5a=_0x617a7a;_0x4dc989['model']=_[_0x1a9b('0x51')](db[_0x1a9b('0x57')][_0x1a9b('0x38')]);_0x4dc989[_0x1a9b('0x3c')]=_['keys'](_0xa2d400[_0x1a9b('0x3c')]);_0x4dc989['filters']=_['intersection'](_0x4dc989[_0x1a9b('0x3f')],_0x4dc989[_0x1a9b('0x3c')]);_0x24f05f[_0x1a9b('0x41')]=_[_0x1a9b('0x3e')](_0x4dc989[_0x1a9b('0x3f')],qs['fields'](_0xa2d400[_0x1a9b('0x3c')][_0x1a9b('0x40')]));_0x24f05f[_0x1a9b('0x41')]=_0x24f05f[_0x1a9b('0x41')][_0x1a9b('0x42')]?_0x24f05f[_0x1a9b('0x41')]:_0x4dc989[_0x1a9b('0x3f')];_0x24f05f['order']=qs['sort'](_0xa2d400[_0x1a9b('0x3c')]['sort']);_0x24f05f[_0x1a9b('0x46')]=qs[_0x1a9b('0x3d')](_[_0x1a9b('0x47')](_0xa2d400[_0x1a9b('0x3c')],_0x4dc989[_0x1a9b('0x3d')]));if(_0xa2d400[_0x1a9b('0x3c')][_0x1a9b('0x48')]){_0x24f05f[_0x1a9b('0x46')]=_[_0x1a9b('0x49')](_0x24f05f[_0x1a9b('0x46')],{'$or':_['map'](_0x24f05f[_0x1a9b('0x41')],function(_0x20d560){var _0x391368={};_0x391368[_0x20d560]={'$like':'%'+_0xa2d400[_0x1a9b('0x3c')][_0x1a9b('0x48')]+'%'};return _0x391368;})});}_0x24f05f=_[_0x1a9b('0x49')]({},_0x24f05f,_0xa2d400[_0x1a9b('0x4b')]);return _0x482d5a[_0x1a9b('0x5b')](_0x24f05f);}})[_0x1a9b('0x1c')](function(_0x4c2faf){if(_0x4c2faf){_0x192783=_0x4c2faf[_0x1a9b('0x42')];if(!_0xa2d400[_0x1a9b('0x3c')][_0x1a9b('0x43')](_0x1a9b('0x58'))){_0x24f05f['limit']=qs['limit'](_0xa2d400[_0x1a9b('0x3c')][_0x1a9b('0x2b')]);_0x24f05f[_0x1a9b('0x2a')]=qs[_0x1a9b('0x2a')](_0xa2d400[_0x1a9b('0x3c')][_0x1a9b('0x2a')]);}return _0x482d5a[_0x1a9b('0x5b')](_0x24f05f);}})['then'](function(_0x25a803){if(_0x25a803){return _0x25a803?{'count':_0x192783,'rows':_0x25a803}:null;}})[_0x1a9b('0x1c')](respondWithResult(_0x50a588,null))[_0x1a9b('0x25')](handleError(_0x50a588,null));};exports[_0x1a9b('0x5c')]=function(_0x47cd6c,_0xc2fc78,_0x500990){var _0x41a115={};var _0x4b65e7={};var _0x3f8754;var _0x2faa2f;return db[_0x1a9b('0x37')][_0x1a9b('0x5a')]({'where':{'id':_0x47cd6c['params']['id']}})['then'](handleEntityNotFound(_0xc2fc78,null))[_0x1a9b('0x1c')](function(_0x864572){if(_0x864572){_0x3f8754=_0x864572;_0x4b65e7[_0x1a9b('0x3f')]=_[_0x1a9b('0x51')](db[_0x1a9b('0x5d')][_0x1a9b('0x38')]);_0x4b65e7[_0x1a9b('0x3c')]=_[_0x1a9b('0x51')](_0x47cd6c[_0x1a9b('0x3c')]);_0x4b65e7[_0x1a9b('0x3d')]=_[_0x1a9b('0x3e')](_0x4b65e7['model'],_0x4b65e7[_0x1a9b('0x3c')]);_0x41a115[_0x1a9b('0x41')]=_[_0x1a9b('0x3e')](_0x4b65e7[_0x1a9b('0x3f')],qs[_0x1a9b('0x40')](_0x47cd6c[_0x1a9b('0x3c')][_0x1a9b('0x40')]));_0x41a115[_0x1a9b('0x41')]=_0x41a115['attributes'][_0x1a9b('0x42')]?_0x41a115['attributes']:_0x4b65e7[_0x1a9b('0x3f')];_0x41a115[_0x1a9b('0x44')]=qs['sort'](_0x47cd6c[_0x1a9b('0x3c')][_0x1a9b('0x45')]);_0x41a115[_0x1a9b('0x46')]=qs[_0x1a9b('0x3d')](_[_0x1a9b('0x47')](_0x47cd6c['query'],_0x4b65e7['filters']));if(_0x47cd6c[_0x1a9b('0x3c')]['filter']){_0x41a115[_0x1a9b('0x46')]=_[_0x1a9b('0x49')](_0x41a115['where'],{'$or':_[_0x1a9b('0x36')](_0x41a115['attributes'],function(_0x291690){var _0x439847={};_0x439847[_0x291690]={'$like':'%'+_0x47cd6c['query'][_0x1a9b('0x48')]+'%'};return _0x439847;})});}_0x41a115=_[_0x1a9b('0x49')]({},_0x41a115,_0x47cd6c[_0x1a9b('0x4b')]);return _0x3f8754['getTags'](_0x41a115);}})[_0x1a9b('0x1c')](function(_0x42928c){if(_0x42928c){_0x2faa2f=_0x42928c[_0x1a9b('0x42')];if(!_0x47cd6c[_0x1a9b('0x3c')][_0x1a9b('0x43')](_0x1a9b('0x58'))){_0x41a115['limit']=qs[_0x1a9b('0x2b')](_0x47cd6c[_0x1a9b('0x3c')][_0x1a9b('0x2b')]);_0x41a115[_0x1a9b('0x2a')]=qs[_0x1a9b('0x2a')](_0x47cd6c[_0x1a9b('0x3c')][_0x1a9b('0x2a')]);}return _0x3f8754['getTags'](_0x41a115);}})[_0x1a9b('0x1c')](function(_0x25ae01){if(_0x25ae01){return _0x25ae01?{'count':_0x2faa2f,'rows':_0x25ae01}:null;}})[_0x1a9b('0x1c')](respondWithResult(_0xc2fc78,null))[_0x1a9b('0x25')](handleError(_0xc2fc78,null));};exports[_0x1a9b('0x5e')]=function(_0x7d7571,_0x5010fd,_0x51cc28){if(_0x7d7571['body']['id']){delete _0x7d7571['body']['id'];}return db[_0x1a9b('0x37')][_0x1a9b('0x5a')]({'where':{'id':_0x7d7571[_0x1a9b('0x50')]['id']}})['then'](handleEntityNotFound(_0x5010fd,null))['then'](function(_0xc8764f){if(_0xc8764f){return _0xc8764f['setTags'](_0x7d7571[_0x1a9b('0x55')][_0x1a9b('0x5f')]||[]);}return null;})[_0x1a9b('0x1c')](respondWithResult(_0x5010fd,null))[_0x1a9b('0x25')](handleError(_0x5010fd,null));}; \ No newline at end of file +var _0xcc92=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','length','include','find','create','body','getFields','FreshdeskField','pick','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','debug','request\x20sent','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xcc92,0x141));var _0x2cc9=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xcc92[_0x57da0a];return _0x3145d5;};'use strict';var pdf=require(_0x2cc9('0x0'));var emlformat=require(_0x2cc9('0x1'));var rimraf=require(_0x2cc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cc9('0x3'));var rp=require(_0x2cc9('0x4'));var moment=require(_0x2cc9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2cc9('0x6'));var path=require(_0x2cc9('0x7'));var sox=require('sox');var csv=require(_0x2cc9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cc9('0x9'));var squel=require(_0x2cc9('0xa'));var crypto=require(_0x2cc9('0xb'));var jsforce=require(_0x2cc9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2cc9('0x8'));var querystring=require('querystring');var Papa=require(_0x2cc9('0xd'));var Redis=require(_0x2cc9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2cc9('0xf'));var hardwareService=require(_0x2cc9('0x10'));var logger=require(_0x2cc9('0x11'))(_0x2cc9('0x12'));var utils=require(_0x2cc9('0x13'));var config=require(_0x2cc9('0x14'));var db=require(_0x2cc9('0x15'))['db'];var jayson=require(_0x2cc9('0x16'));var client=jayson[_0x2cc9('0x17')][_0x2cc9('0x18')]({'port':0x232a});function checkPasswordPattern(_0x27bccc,_0x3f2bff,_0x5ada00){if(_0x5ada00){var _0x4276ca=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4276ca[_0x2cc9('0x19')](_0x3f2bff)){return _0x27bccc;}else{throw new db[(_0x2cc9('0x1a'))][(_0x2cc9('0x1b'))]('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 _0x27bccc;}}function respondWithRpcPromise(_0x59769b,_0x29b974,_0x3c380c,_0x39aa00){return new BPromise(function(_0x58ec11,_0x2fa037){var _0x28778b=_0x39aa00||client;return _0x28778b[_0x2cc9('0x1c')](_0x59769b,_0x3c380c)['then'](function(_0x16051c){logger[_0x2cc9('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x29b974,'request\x20sent');logger[_0x2cc9('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x29b974,_0x2cc9('0x1f'),JSON['stringify'](_0x16051c));if(_0x16051c[_0x2cc9('0x20')]){if(_0x16051c[_0x2cc9('0x20')][_0x2cc9('0x21')]===0x1f4){logger['error'](_0x2cc9('0x22'),_0x29b974,_0x16051c[_0x2cc9('0x20')][_0x2cc9('0x23')]);return _0x2fa037(_0x16051c['error']['message']);}logger[_0x2cc9('0x20')](_0x2cc9('0x22'),_0x29b974,_0x16051c['error'][_0x2cc9('0x23')]);return _0x58ec11(_0x16051c[_0x2cc9('0x20')][_0x2cc9('0x23')]);}else{logger[_0x2cc9('0x1d')](_0x2cc9('0x22'),_0x29b974,_0x2cc9('0x1f'));_0x58ec11(_0x16051c['result'][_0x2cc9('0x23')]);}})[_0x2cc9('0x24')](function(_0xc61a5f){logger[_0x2cc9('0x20')](_0x2cc9('0x22'),_0x29b974,_0xc61a5f);_0x2fa037(_0xc61a5f);});});}function respondWithStatusCode(_0x3b9f47,_0x57f8ae){_0x57f8ae=_0x57f8ae||0xcc;return function(_0x3267d8){if(_0x3267d8){return _0x3b9f47[_0x2cc9('0x25')](_0x57f8ae);}return _0x3b9f47[_0x2cc9('0x26')](_0x57f8ae)['end']();};}function respondWithResult(_0x38a88c,_0x2b775d){_0x2b775d=_0x2b775d||0xc8;return function(_0x29a8c5){if(_0x29a8c5){return _0x38a88c[_0x2cc9('0x26')](_0x2b775d)[_0x2cc9('0x27')](_0x29a8c5);}};}function respondWithFilteredResult(_0x22b074,_0x574def){return function(_0x4790bb){if(_0x4790bb){var _0x4f16ad=_0x4790bb[_0x2cc9('0x28')],_0x454117=_0x574def[_0x2cc9('0x29')],_0x1672ab=_0x574def[_0x2cc9('0x29')]+_0x574def[_0x2cc9('0x2a')],_0x15b5f0;if(_0x1672ab>=_0x4f16ad){_0x1672ab=_0x4f16ad;_0x15b5f0=0xc8;}else{_0x15b5f0=0xce;}_0x22b074[_0x2cc9('0x26')](_0x15b5f0);return _0x22b074[_0x2cc9('0x2b')](_0x2cc9('0x2c'),_0x454117+'-'+_0x1672ab+'/'+_0x4f16ad)[_0x2cc9('0x27')](_0x4790bb);}return null;};}function patchUpdates(_0x24450b){return function(_0x14451d){try{jsonpatch[_0x2cc9('0x2d')](_0x14451d,_0x24450b,!![]);}catch(_0x4b95ce){return BPromise[_0x2cc9('0x2e')](_0x4b95ce);}return _0x14451d[_0x2cc9('0x2f')]();};}function saveUpdates(_0x41e578,_0x52d079){return function(_0x4908bc){if(_0x4908bc){return _0x4908bc[_0x2cc9('0x30')](_0x41e578)['then'](function(_0x1a8dda){return _0x1a8dda;});}return null;};}function removeEntity(_0x12789b,_0x402ae0){return function(_0x26619c){if(_0x26619c){return _0x26619c[_0x2cc9('0x31')]()[_0x2cc9('0x32')](function(){_0x12789b[_0x2cc9('0x26')](0xcc)[_0x2cc9('0x33')]();});}};}function handleEntityNotFound(_0x471f67,_0x41e6c9){return function(_0x2ea3c4){if(!_0x2ea3c4){_0x471f67[_0x2cc9('0x25')](0x194);}return _0x2ea3c4;};}function handleError(_0x36e11e,_0x4d0c50){_0x4d0c50=_0x4d0c50||0x1f4;return function(_0x3373d3){logger['error'](_0x3373d3[_0x2cc9('0x34')]);if(_0x3373d3[_0x2cc9('0x35')]){delete _0x3373d3['name'];}_0x36e11e[_0x2cc9('0x26')](_0x4d0c50)[_0x2cc9('0x36')](_0x3373d3);};}exports[_0x2cc9('0x37')]=function(_0xb158e9,_0x1bdce9){var _0x2b9bdb={},_0x17da48={},_0xa70d7={'count':0x0,'rows':[]};var _0x1a07af=_[_0x2cc9('0x38')](db[_0x2cc9('0x39')][_0x2cc9('0x3a')],function(_0x202767){return{'name':_0x202767[_0x2cc9('0x3b')],'type':_0x202767[_0x2cc9('0x3c')][_0x2cc9('0x3d')]};});_0x17da48[_0x2cc9('0x3e')]=_[_0x2cc9('0x38')](_0x1a07af,'name');_0x17da48[_0x2cc9('0x3f')]=_[_0x2cc9('0x40')](_0xb158e9[_0x2cc9('0x3f')]);_0x17da48[_0x2cc9('0x41')]=_[_0x2cc9('0x42')](_0x17da48[_0x2cc9('0x3e')],_0x17da48[_0x2cc9('0x3f')]);_0x2b9bdb['attributes']=_[_0x2cc9('0x42')](_0x17da48[_0x2cc9('0x3e')],qs[_0x2cc9('0x43')](_0xb158e9[_0x2cc9('0x3f')][_0x2cc9('0x43')]));_0x2b9bdb[_0x2cc9('0x44')]=_0x2b9bdb[_0x2cc9('0x44')]['length']?_0x2b9bdb['attributes']:_0x17da48[_0x2cc9('0x3e')];if(!_0xb158e9[_0x2cc9('0x3f')][_0x2cc9('0x45')](_0x2cc9('0x46'))){_0x2b9bdb['limit']=qs[_0x2cc9('0x2a')](_0xb158e9[_0x2cc9('0x3f')][_0x2cc9('0x2a')]);_0x2b9bdb[_0x2cc9('0x29')]=qs['offset'](_0xb158e9['query'][_0x2cc9('0x29')]);}_0x2b9bdb[_0x2cc9('0x47')]=qs[_0x2cc9('0x48')](_0xb158e9['query'][_0x2cc9('0x48')]);_0x2b9bdb[_0x2cc9('0x49')]=qs['filters'](_['pick'](_0xb158e9[_0x2cc9('0x3f')],_0x17da48[_0x2cc9('0x41')]),_0x1a07af);if(_0xb158e9['query'][_0x2cc9('0x4a')]){_0x2b9bdb[_0x2cc9('0x49')]=_[_0x2cc9('0x4b')](_0x2b9bdb['where'],{'$or':_[_0x2cc9('0x38')](_0x1a07af,function(_0x4c924c){if(_0x4c924c['type']!==_0x2cc9('0x4c')){var _0x28e29a={};_0x28e29a[_0x4c924c[_0x2cc9('0x35')]]={'$like':'%'+_0xb158e9[_0x2cc9('0x3f')][_0x2cc9('0x4a')]+'%'};return _0x28e29a;}})});}_0x2b9bdb=_[_0x2cc9('0x4b')]({},_0x2b9bdb,_0xb158e9[_0x2cc9('0x4d')]);var _0x24f7de={'where':_0x2b9bdb[_0x2cc9('0x49')]};return db[_0x2cc9('0x39')][_0x2cc9('0x28')](_0x24f7de)[_0x2cc9('0x32')](function(_0x11f773){_0xa70d7['count']=_0x11f773;if(_0xb158e9[_0x2cc9('0x3f')][_0x2cc9('0x4e')]){_0x2b9bdb['include']=[{'all':!![]}];}return db[_0x2cc9('0x39')]['findAll'](_0x2b9bdb);})[_0x2cc9('0x32')](function(_0x156cc2){_0xa70d7[_0x2cc9('0x4f')]=_0x156cc2;return _0xa70d7;})[_0x2cc9('0x32')](respondWithFilteredResult(_0x1bdce9,_0x2b9bdb))[_0x2cc9('0x24')](handleError(_0x1bdce9,null));};exports[_0x2cc9('0x50')]=function(_0x3c06c8,_0x4c8bc9){var _0x6126fc={'raw':![],'where':{'id':_0x3c06c8[_0x2cc9('0x51')]['id']}},_0x2a502f={};_0x2a502f[_0x2cc9('0x3e')]=_[_0x2cc9('0x40')](db[_0x2cc9('0x39')][_0x2cc9('0x3a')]);_0x2a502f[_0x2cc9('0x3f')]=_[_0x2cc9('0x40')](_0x3c06c8[_0x2cc9('0x3f')]);_0x2a502f[_0x2cc9('0x41')]=_['intersection'](_0x2a502f['model'],_0x2a502f['query']);_0x6126fc[_0x2cc9('0x44')]=_[_0x2cc9('0x42')](_0x2a502f[_0x2cc9('0x3e')],qs['fields'](_0x3c06c8['query']['fields']));_0x6126fc[_0x2cc9('0x44')]=_0x6126fc[_0x2cc9('0x44')][_0x2cc9('0x52')]?_0x6126fc['attributes']:_0x2a502f[_0x2cc9('0x3e')];if(_0x3c06c8[_0x2cc9('0x3f')][_0x2cc9('0x4e')]){_0x6126fc[_0x2cc9('0x53')]=[{'all':!![]}];}_0x6126fc=_[_0x2cc9('0x4b')]({},_0x6126fc,_0x3c06c8[_0x2cc9('0x4d')]);return db['FreshdeskConfiguration'][_0x2cc9('0x54')](_0x6126fc)[_0x2cc9('0x32')](handleEntityNotFound(_0x4c8bc9,null))[_0x2cc9('0x32')](respondWithResult(_0x4c8bc9,null))[_0x2cc9('0x24')](handleError(_0x4c8bc9,null));};exports[_0x2cc9('0x55')]=function(_0x28ff9f,_0x2a412f){return db['FreshdeskConfiguration'][_0x2cc9('0x55')](_0x28ff9f[_0x2cc9('0x56')],{})['then'](respondWithResult(_0x2a412f,0xc9))[_0x2cc9('0x24')](handleError(_0x2a412f,null));};exports[_0x2cc9('0x30')]=function(_0x166450,_0x372f4e){if(_0x166450[_0x2cc9('0x56')]['id']){delete _0x166450[_0x2cc9('0x56')]['id'];}return db['FreshdeskConfiguration'][_0x2cc9('0x54')]({'where':{'id':_0x166450[_0x2cc9('0x51')]['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x372f4e,null))[_0x2cc9('0x32')](saveUpdates(_0x166450[_0x2cc9('0x56')],null))[_0x2cc9('0x32')](respondWithResult(_0x372f4e,null))[_0x2cc9('0x24')](handleError(_0x372f4e,null));};exports[_0x2cc9('0x31')]=function(_0x4432c7,_0x257d52){return db[_0x2cc9('0x39')][_0x2cc9('0x54')]({'where':{'id':_0x4432c7[_0x2cc9('0x51')]['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x257d52,null))[_0x2cc9('0x32')](removeEntity(_0x257d52,null))['catch'](handleError(_0x257d52,null));};exports[_0x2cc9('0x57')]=function(_0x283208,_0x37062b,_0x1417e9){var _0x7460ec={};var _0x345fad={};var _0x2ec4b3;var _0x10bf86;return db[_0x2cc9('0x39')]['findOne']({'where':{'id':_0x283208['params']['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x37062b,null))['then'](function(_0x149953){if(_0x149953){_0x2ec4b3=_0x149953;_0x345fad['model']=_['keys'](db[_0x2cc9('0x58')][_0x2cc9('0x3a')]);_0x345fad[_0x2cc9('0x3f')]=_['keys'](_0x283208[_0x2cc9('0x3f')]);_0x345fad[_0x2cc9('0x41')]=_[_0x2cc9('0x42')](_0x345fad[_0x2cc9('0x3e')],_0x345fad[_0x2cc9('0x3f')]);_0x7460ec[_0x2cc9('0x44')]=_['intersection'](_0x345fad[_0x2cc9('0x3e')],qs['fields'](_0x283208['query'][_0x2cc9('0x43')]));_0x7460ec[_0x2cc9('0x44')]=_0x7460ec[_0x2cc9('0x44')][_0x2cc9('0x52')]?_0x7460ec[_0x2cc9('0x44')]:_0x345fad['model'];_0x7460ec[_0x2cc9('0x47')]=qs[_0x2cc9('0x48')](_0x283208['query'][_0x2cc9('0x48')]);_0x7460ec[_0x2cc9('0x49')]=qs['filters'](_[_0x2cc9('0x59')](_0x283208[_0x2cc9('0x3f')],_0x345fad[_0x2cc9('0x41')]));if(_0x283208['query'][_0x2cc9('0x4a')]){_0x7460ec[_0x2cc9('0x49')]=_['merge'](_0x7460ec[_0x2cc9('0x49')],{'$or':_['map'](_0x7460ec[_0x2cc9('0x44')],function(_0x4cd240){var _0x49ef18={};_0x49ef18[_0x4cd240]={'$like':'%'+_0x283208['query'][_0x2cc9('0x4a')]+'%'};return _0x49ef18;})});}_0x7460ec=_[_0x2cc9('0x4b')]({},_0x7460ec,_0x283208[_0x2cc9('0x4d')]);return _0x2ec4b3[_0x2cc9('0x57')](_0x7460ec);}})[_0x2cc9('0x32')](function(_0x14af26){if(_0x14af26){_0x10bf86=_0x14af26[_0x2cc9('0x52')];if(!_0x283208[_0x2cc9('0x3f')][_0x2cc9('0x45')](_0x2cc9('0x46'))){_0x7460ec[_0x2cc9('0x2a')]=qs['limit'](_0x283208['query'][_0x2cc9('0x2a')]);_0x7460ec[_0x2cc9('0x29')]=qs[_0x2cc9('0x29')](_0x283208[_0x2cc9('0x3f')][_0x2cc9('0x29')]);}return _0x2ec4b3['getFields'](_0x7460ec);}})[_0x2cc9('0x32')](function(_0x479ee4){if(_0x479ee4){return _0x479ee4?{'count':_0x10bf86,'rows':_0x479ee4}:null;}})['then'](respondWithResult(_0x37062b,null))[_0x2cc9('0x24')](handleError(_0x37062b,null));};exports[_0x2cc9('0x5a')]=function(_0x5a16f8,_0x18fc4e,_0x261e60){var _0x28a644={};var _0x2bbebc={};var _0x1045f9;var _0xc4d39f;return db[_0x2cc9('0x39')][_0x2cc9('0x5b')]({'where':{'id':_0x5a16f8[_0x2cc9('0x51')]['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x18fc4e,null))['then'](function(_0x14a31a){if(_0x14a31a){_0x1045f9=_0x14a31a;_0x2bbebc[_0x2cc9('0x3e')]=_[_0x2cc9('0x40')](db[_0x2cc9('0x58')][_0x2cc9('0x3a')]);_0x2bbebc[_0x2cc9('0x3f')]=_[_0x2cc9('0x40')](_0x5a16f8['query']);_0x2bbebc[_0x2cc9('0x41')]=_[_0x2cc9('0x42')](_0x2bbebc[_0x2cc9('0x3e')],_0x2bbebc['query']);_0x28a644[_0x2cc9('0x44')]=_[_0x2cc9('0x42')](_0x2bbebc[_0x2cc9('0x3e')],qs['fields'](_0x5a16f8[_0x2cc9('0x3f')]['fields']));_0x28a644[_0x2cc9('0x44')]=_0x28a644[_0x2cc9('0x44')]['length']?_0x28a644['attributes']:_0x2bbebc[_0x2cc9('0x3e')];_0x28a644[_0x2cc9('0x47')]=qs[_0x2cc9('0x48')](_0x5a16f8[_0x2cc9('0x3f')]['sort']);_0x28a644[_0x2cc9('0x49')]=qs[_0x2cc9('0x41')](_['pick'](_0x5a16f8['query'],_0x2bbebc['filters']));if(_0x5a16f8[_0x2cc9('0x3f')][_0x2cc9('0x4a')]){_0x28a644['where']=_['merge'](_0x28a644['where'],{'$or':_['map'](_0x28a644[_0x2cc9('0x44')],function(_0x1283a9){var _0x120ace={};_0x120ace[_0x1283a9]={'$like':'%'+_0x5a16f8[_0x2cc9('0x3f')][_0x2cc9('0x4a')]+'%'};return _0x120ace;})});}_0x28a644=_[_0x2cc9('0x4b')]({},_0x28a644,_0x5a16f8[_0x2cc9('0x4d')]);return _0x1045f9[_0x2cc9('0x5a')](_0x28a644);}})[_0x2cc9('0x32')](function(_0x5125c1){if(_0x5125c1){_0xc4d39f=_0x5125c1[_0x2cc9('0x52')];if(!_0x5a16f8[_0x2cc9('0x3f')]['hasOwnProperty']('nolimit')){_0x28a644[_0x2cc9('0x2a')]=qs['limit'](_0x5a16f8[_0x2cc9('0x3f')]['limit']);_0x28a644[_0x2cc9('0x29')]=qs['offset'](_0x5a16f8[_0x2cc9('0x3f')][_0x2cc9('0x29')]);}return _0x1045f9[_0x2cc9('0x5a')](_0x28a644);}})[_0x2cc9('0x32')](function(_0x27b67e){if(_0x27b67e){return _0x27b67e?{'count':_0xc4d39f,'rows':_0x27b67e}:null;}})['then'](respondWithResult(_0x18fc4e,null))['catch'](handleError(_0x18fc4e,null));};exports['getDescriptions']=function(_0x3a9327,_0x17dd86,_0x3d4f0b){var _0x5d8846={};var _0x49edba={};var _0x1c99b8;var _0x2290b9;return db['FreshdeskConfiguration'][_0x2cc9('0x5b')]({'where':{'id':_0x3a9327[_0x2cc9('0x51')]['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x17dd86,null))[_0x2cc9('0x32')](function(_0x235b5d){if(_0x235b5d){_0x1c99b8=_0x235b5d;_0x49edba[_0x2cc9('0x3e')]=_[_0x2cc9('0x40')](db[_0x2cc9('0x58')]['rawAttributes']);_0x49edba[_0x2cc9('0x3f')]=_['keys'](_0x3a9327[_0x2cc9('0x3f')]);_0x49edba[_0x2cc9('0x41')]=_[_0x2cc9('0x42')](_0x49edba[_0x2cc9('0x3e')],_0x49edba[_0x2cc9('0x3f')]);_0x5d8846[_0x2cc9('0x44')]=_['intersection'](_0x49edba[_0x2cc9('0x3e')],qs[_0x2cc9('0x43')](_0x3a9327[_0x2cc9('0x3f')]['fields']));_0x5d8846[_0x2cc9('0x44')]=_0x5d8846['attributes'][_0x2cc9('0x52')]?_0x5d8846[_0x2cc9('0x44')]:_0x49edba['model'];_0x5d8846['order']=qs[_0x2cc9('0x48')](_0x3a9327['query'][_0x2cc9('0x48')]);_0x5d8846[_0x2cc9('0x49')]=qs[_0x2cc9('0x41')](_[_0x2cc9('0x59')](_0x3a9327[_0x2cc9('0x3f')],_0x49edba[_0x2cc9('0x41')]));if(_0x3a9327[_0x2cc9('0x3f')]['filter']){_0x5d8846[_0x2cc9('0x49')]=_['merge'](_0x5d8846[_0x2cc9('0x49')],{'$or':_[_0x2cc9('0x38')](_0x5d8846[_0x2cc9('0x44')],function(_0x1bcef0){var _0x59f744={};_0x59f744[_0x1bcef0]={'$like':'%'+_0x3a9327['query'][_0x2cc9('0x4a')]+'%'};return _0x59f744;})});}_0x5d8846=_[_0x2cc9('0x4b')]({},_0x5d8846,_0x3a9327['options']);return _0x1c99b8[_0x2cc9('0x5c')](_0x5d8846);}})[_0x2cc9('0x32')](function(_0x46c5b1){if(_0x46c5b1){_0x2290b9=_0x46c5b1['length'];if(!_0x3a9327[_0x2cc9('0x3f')][_0x2cc9('0x45')](_0x2cc9('0x46'))){_0x5d8846[_0x2cc9('0x2a')]=qs['limit'](_0x3a9327[_0x2cc9('0x3f')][_0x2cc9('0x2a')]);_0x5d8846['offset']=qs['offset'](_0x3a9327['query'][_0x2cc9('0x29')]);}return _0x1c99b8[_0x2cc9('0x5c')](_0x5d8846);}})['then'](function(_0xa178e3){if(_0xa178e3){return _0xa178e3?{'count':_0x2290b9,'rows':_0xa178e3}:null;}})[_0x2cc9('0x32')](respondWithResult(_0x17dd86,null))[_0x2cc9('0x24')](handleError(_0x17dd86,null));};exports[_0x2cc9('0x5d')]=function(_0x4558d4,_0x5d3d9a,_0x3edf43){var _0x354d97={};var _0x463d99={};var _0x34d791;var _0x20ec58;return db[_0x2cc9('0x39')][_0x2cc9('0x5b')]({'where':{'id':_0x4558d4[_0x2cc9('0x51')]['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x5d3d9a,null))['then'](function(_0x4b7e82){if(_0x4b7e82){_0x34d791=_0x4b7e82;_0x463d99[_0x2cc9('0x3e')]=_['keys'](db[_0x2cc9('0x5e')]['rawAttributes']);_0x463d99[_0x2cc9('0x3f')]=_['keys'](_0x4558d4['query']);_0x463d99[_0x2cc9('0x41')]=_[_0x2cc9('0x42')](_0x463d99['model'],_0x463d99[_0x2cc9('0x3f')]);_0x354d97[_0x2cc9('0x44')]=_[_0x2cc9('0x42')](_0x463d99[_0x2cc9('0x3e')],qs[_0x2cc9('0x43')](_0x4558d4[_0x2cc9('0x3f')][_0x2cc9('0x43')]));_0x354d97[_0x2cc9('0x44')]=_0x354d97[_0x2cc9('0x44')][_0x2cc9('0x52')]?_0x354d97['attributes']:_0x463d99['model'];_0x354d97[_0x2cc9('0x47')]=qs['sort'](_0x4558d4[_0x2cc9('0x3f')][_0x2cc9('0x48')]);_0x354d97[_0x2cc9('0x49')]=qs[_0x2cc9('0x41')](_[_0x2cc9('0x59')](_0x4558d4[_0x2cc9('0x3f')],_0x463d99[_0x2cc9('0x41')]));if(_0x4558d4['query'][_0x2cc9('0x4a')]){_0x354d97[_0x2cc9('0x49')]=_[_0x2cc9('0x4b')](_0x354d97[_0x2cc9('0x49')],{'$or':_[_0x2cc9('0x38')](_0x354d97[_0x2cc9('0x44')],function(_0x341ebe){var _0x226aeb={};_0x226aeb[_0x341ebe]={'$like':'%'+_0x4558d4['query'][_0x2cc9('0x4a')]+'%'};return _0x226aeb;})});}_0x354d97=_[_0x2cc9('0x4b')]({},_0x354d97,_0x4558d4[_0x2cc9('0x4d')]);return _0x34d791[_0x2cc9('0x5d')](_0x354d97);}})[_0x2cc9('0x32')](function(_0x3c43ef){if(_0x3c43ef){_0x20ec58=_0x3c43ef[_0x2cc9('0x52')];if(!_0x4558d4['query'][_0x2cc9('0x45')](_0x2cc9('0x46'))){_0x354d97[_0x2cc9('0x2a')]=qs[_0x2cc9('0x2a')](_0x4558d4[_0x2cc9('0x3f')][_0x2cc9('0x2a')]);_0x354d97[_0x2cc9('0x29')]=qs['offset'](_0x4558d4[_0x2cc9('0x3f')]['offset']);}return _0x34d791['getTags'](_0x354d97);}})[_0x2cc9('0x32')](function(_0x2fb85e){if(_0x2fb85e){return _0x2fb85e?{'count':_0x20ec58,'rows':_0x2fb85e}:null;}})[_0x2cc9('0x32')](respondWithResult(_0x5d3d9a,null))[_0x2cc9('0x24')](handleError(_0x5d3d9a,null));};exports[_0x2cc9('0x5f')]=function(_0x2cf170,_0x3627bf,_0x14ca2f){if(_0x2cf170[_0x2cc9('0x56')]['id']){delete _0x2cf170['body']['id'];}return db[_0x2cc9('0x39')]['findOne']({'where':{'id':_0x2cf170['params']['id']}})[_0x2cc9('0x32')](handleEntityNotFound(_0x3627bf,null))[_0x2cc9('0x32')](function(_0x4e8755){if(_0x4e8755){return _0x4e8755[_0x2cc9('0x5f')](_0x2cf170[_0x2cc9('0x56')][_0x2cc9('0x60')]||[]);}return null;})[_0x2cc9('0x32')](respondWithResult(_0x3627bf,null))['catch'](handleError(_0x3627bf,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a9f38cb..90233c9 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 _0x8ef6=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x198a68,_0x1ab1cc){var _0x5f0d21=function(_0x2cf1d0){while(--_0x2cf1d0){_0x198a68['push'](_0x198a68['shift']());}};_0x5f0d21(++_0x1ab1cc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x51f30e,_0x592c0d){_0x51f30e=_0x51f30e-0x0;var _0x133eae=_0x8ef6[_0x51f30e];return _0x133eae;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x12991d,_0xda22c){var _0x46f3b2=function(_0x2958cb){while(--_0x2958cb){_0x12991d['push'](_0x12991d['shift']());}};_0x46f3b2(++_0xda22c);}(_0x53ec,0x192));var _0xc53e=function(_0xc036bb,_0x5cab81){_0xc036bb=_0xc036bb-0x0;var _0x523ab9=_0x53ec[_0xc036bb];return _0x523ab9;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 15b7161..9950838 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 _0x2650=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2650,0xe1));var _0x0265=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2650[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0265('0x0'));var util=require(_0x0265('0x1'));var moment=require(_0x0265('0x2'));var BPromise=require(_0x0265('0x3'));var rs=require(_0x0265('0x4'));var fs=require('fs');var Redis=require(_0x0265('0x5'));var db=require(_0x0265('0x6'))['db'];var utils=require(_0x0265('0x7'));var logger=require(_0x0265('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0265('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16fe41,_0x1444cf,_0x52f1fc){return new BPromise(function(_0x3f50c0,_0xdc2f3f){return client[_0x0265('0xa')](_0x16fe41,_0x52f1fc)[_0x0265('0xb')](function(_0x3ac516){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1444cf,_0x0265('0xc'));logger[_0x0265('0xd')](_0x0265('0xe'),_0x1444cf,_0x0265('0xc'),JSON[_0x0265('0xf')](_0x3ac516));if(_0x3ac516[_0x0265('0x10')]){if(_0x3ac516[_0x0265('0x10')][_0x0265('0x11')]===0x1f4){logger['error'](_0x0265('0x12'),_0x1444cf,_0x3ac516[_0x0265('0x10')][_0x0265('0x13')]);return _0xdc2f3f(_0x3ac516[_0x0265('0x10')][_0x0265('0x13')]);}logger['error'](_0x0265('0x12'),_0x1444cf,_0x3ac516['error'][_0x0265('0x13')]);return _0x3f50c0(_0x3ac516[_0x0265('0x10')][_0x0265('0x13')]);}else{logger[_0x0265('0x14')](_0x0265('0x12'),_0x1444cf,'request\x20sent');_0x3f50c0(_0x3ac516[_0x0265('0x15')][_0x0265('0x13')]);}})[_0x0265('0x16')](function(_0x1b8fc3){logger['error'](_0x0265('0x12'),_0x1444cf,_0x1b8fc3);_0xdc2f3f(_0x1b8fc3);});});} \ No newline at end of file +var _0xed30=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xed30,0xa7));var _0x0ed3=function(_0x5788c5,_0x38c685){_0x5788c5=_0x5788c5-0x0;var _0x190849=_0xed30[_0x5788c5];return _0x190849;};'use strict';var _=require(_0x0ed3('0x0'));var util=require(_0x0ed3('0x1'));var moment=require(_0x0ed3('0x2'));var BPromise=require(_0x0ed3('0x3'));var rs=require(_0x0ed3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ed3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0ed3('0x6'));var config=require(_0x0ed3('0x7'));var jayson=require(_0x0ed3('0x8'));var client=jayson['client'][_0x0ed3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19805d,_0x5e7e5b,_0x4c32a4){return new BPromise(function(_0x134f58,_0x4f242f){return client[_0x0ed3('0xa')](_0x19805d,_0x4c32a4)['then'](function(_0x45b1ca){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5e7e5b,_0x0ed3('0xb'));logger[_0x0ed3('0xc')](_0x0ed3('0xd'),_0x5e7e5b,'request\x20sent',JSON[_0x0ed3('0xe')](_0x45b1ca));if(_0x45b1ca[_0x0ed3('0xf')]){if(_0x45b1ca[_0x0ed3('0xf')][_0x0ed3('0x10')]===0x1f4){logger[_0x0ed3('0xf')](_0x0ed3('0x11'),_0x5e7e5b,_0x45b1ca[_0x0ed3('0xf')]['message']);return _0x4f242f(_0x45b1ca[_0x0ed3('0xf')][_0x0ed3('0x12')]);}logger[_0x0ed3('0xf')](_0x0ed3('0x11'),_0x5e7e5b,_0x45b1ca['error'][_0x0ed3('0x12')]);return _0x134f58(_0x45b1ca[_0x0ed3('0xf')][_0x0ed3('0x12')]);}else{logger[_0x0ed3('0x13')](_0x0ed3('0x11'),_0x5e7e5b,'request\x20sent');_0x134f58(_0x45b1ca['result'][_0x0ed3('0x12')]);}})['catch'](function(_0xad9863){logger[_0x0ed3('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5e7e5b,_0xad9863);_0x4f242f(_0xad9863);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2fcc6ef..45fc9fa 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 _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x20e555,_0x40aea6){var _0x182077=function(_0x1d0d69){while(--_0x1d0d69){_0x20e555['push'](_0x20e555['shift']());}};_0x182077(++_0x40aea6);}(_0x70e0,0x17b));var _0x070e=function(_0x3fc6c7,_0x31ab97){_0x3fc6c7=_0x3fc6c7-0x0;var _0x18052f=_0x70e0[_0x3fc6c7];return _0x18052f;};'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('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x34e8,0x12c));var _0x834e=function(_0x144341,_0x33b8b7){_0x144341=_0x144341-0x0;var _0x5b53ae=_0x34e8[_0x144341];return _0x5b53ae;};'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('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 467f3f8..cd10ace 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 _0x3d9f=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x15c3d2,_0x28bc0f){var _0x1ad464=function(_0x1a2e67){while(--_0x1a2e67){_0x15c3d2['push'](_0x15c3d2['shift']());}};_0x1ad464(++_0x28bc0f);}(_0x3d9f,0xd2));var _0xf3d9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x3d9f[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0xf3d9('0x0'));module[_0xf3d9('0x1')]={'type':{'type':Sequelize[_0xf3d9('0x2')](_0xf3d9('0x3'),_0xf3d9('0x4'),_0xf3d9('0x5'),_0xf3d9('0x6')),'defaultValue':_0xf3d9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf3d9('0x3'),'variable',_0xf3d9('0x5'))},'keyContent':{'type':Sequelize[_0xf3d9('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf3d9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf3d9('0x7')]}}; \ No newline at end of file +var _0x7b6f=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x3a7917,_0x2d7dd6){var _0x5cceaf=function(_0x181f73){while(--_0x181f73){_0x3a7917['push'](_0x3a7917['shift']());}};_0x5cceaf(++_0x2d7dd6);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x262b56,_0x489281){_0x262b56=_0x262b56-0x0;var _0x106c6e=_0x7b6f[_0x262b56];return _0x106c6e;};'use strict';var Sequelize=require(_0xf7b6('0x0'));module['exports']={'type':{'type':Sequelize[_0xf7b6('0x1')](_0xf7b6('0x2'),_0xf7b6('0x3'),_0xf7b6('0x4'),_0xf7b6('0x5')),'defaultValue':_0xf7b6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf7b6('0x6')]},'keyType':{'type':Sequelize[_0xf7b6('0x1')](_0xf7b6('0x2'),_0xf7b6('0x3'),_0xf7b6('0x4'))},'keyContent':{'type':Sequelize[_0xf7b6('0x6')]},'idField':{'type':Sequelize[_0xf7b6('0x6')]},'nameField':{'type':Sequelize[_0xf7b6('0x6')]},'customField':{'type':Sequelize[_0xf7b6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 6e32053..1145a42 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 _0x19ab=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rawAttributes','include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','map','FreshdeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0x19ab,0x1e5));var _0xb19a=function(_0x4d3490,_0x253cd5){_0x4d3490=_0x4d3490-0x0;var _0x28788a=_0x19ab[_0x4d3490];return _0x28788a;};'use strict';var pdf=require(_0xb19a('0x0'));var emlformat=require(_0xb19a('0x1'));var rimraf=require(_0xb19a('0x2'));var zipdir=require(_0xb19a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb19a('0x4'));var BPromise=require(_0xb19a('0x5'));var Mustache=require(_0xb19a('0x6'));var util=require(_0xb19a('0x7'));var path=require(_0xb19a('0x8'));var sox=require(_0xb19a('0x9'));var csv=require('to-csv');var ejs=require(_0xb19a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb19a('0xb'));var jsforce=require(_0xb19a('0xc'));var deskjs=require(_0xb19a('0xd'));var toCsv=require(_0xb19a('0xe'));var querystring=require('querystring');var Papa=require(_0xb19a('0xf'));var Redis=require(_0xb19a('0x10'));var authService=require(_0xb19a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb19a('0x12'));var hardwareService=require(_0xb19a('0x13'));var logger=require(_0xb19a('0x14'))(_0xb19a('0x15'));var utils=require('../../config/utils');var config=require(_0xb19a('0x16'));var db=require(_0xb19a('0x17'))['db'];function respondWithStatusCode(_0x2c48e8,_0x5aecd2){_0x5aecd2=_0x5aecd2||0xcc;return function(_0x1d010e){if(_0x1d010e){return _0x2c48e8['sendStatus'](_0x5aecd2);}return _0x2c48e8[_0xb19a('0x18')](_0x5aecd2)[_0xb19a('0x19')]();};}function respondWithResult(_0x5d9bdc,_0x475bf4){_0x475bf4=_0x475bf4||0xc8;return function(_0x2ebf6f){if(_0x2ebf6f){return _0x5d9bdc[_0xb19a('0x18')](_0x475bf4)[_0xb19a('0x1a')](_0x2ebf6f);}};}function respondWithFilteredResult(_0x23b2d9,_0x332f7b){return function(_0x327aa2){if(_0x327aa2){var _0x3b1c50=_0x327aa2[_0xb19a('0x1b')],_0x4ce3d4=_0x332f7b[_0xb19a('0x1c')],_0x4cdbb6=_0x332f7b['offset']+_0x332f7b[_0xb19a('0x1d')],_0x535c98;if(_0x4cdbb6>=_0x3b1c50){_0x4cdbb6=_0x3b1c50;_0x535c98=0xc8;}else{_0x535c98=0xce;}_0x23b2d9[_0xb19a('0x18')](_0x535c98);return _0x23b2d9['set'](_0xb19a('0x1e'),_0x4ce3d4+'-'+_0x4cdbb6+'/'+_0x3b1c50)[_0xb19a('0x1a')](_0x327aa2);}return null;};}function patchUpdates(_0x513dcc){return function(_0x575b49){try{jsonpatch[_0xb19a('0x1f')](_0x575b49,_0x513dcc,!![]);}catch(_0xeb63f6){return BPromise[_0xb19a('0x20')](_0xeb63f6);}return _0x575b49['save']();};}function saveUpdates(_0x426baf,_0x49f675){return function(_0x2e7208){if(_0x2e7208){return _0x2e7208[_0xb19a('0x21')](_0x426baf)['then'](function(_0xf2290a){return _0xf2290a;});}return null;};}function removeEntity(_0x179d52,_0x25fe34){return function(_0x1437fb){if(_0x1437fb){return _0x1437fb[_0xb19a('0x22')]()[_0xb19a('0x23')](function(){_0x179d52[_0xb19a('0x18')](0xcc)[_0xb19a('0x19')]();});}};}function handleEntityNotFound(_0x285c5e,_0x5f05a7){return function(_0x25196d){if(!_0x25196d){_0x285c5e[_0xb19a('0x24')](0x194);}return _0x25196d;};}function handleError(_0x31f6cd,_0x506ecf){_0x506ecf=_0x506ecf||0x1f4;return function(_0x5c67f3){logger[_0xb19a('0x25')](_0x5c67f3['stack']);if(_0x5c67f3[_0xb19a('0x26')]){delete _0x5c67f3[_0xb19a('0x26')];}_0x31f6cd[_0xb19a('0x18')](_0x506ecf)['send'](_0x5c67f3);};}exports['index']=function(_0x49ed1a,_0x105e9d){var _0x420b35={},_0x5d827a={},_0x1698f4={'count':0x0,'rows':[]};var _0x1b42d7=_[_0xb19a('0x27')](db[_0xb19a('0x28')]['rawAttributes'],function(_0x2a626d){return{'name':_0x2a626d[_0xb19a('0x29')],'type':_0x2a626d[_0xb19a('0x2a')][_0xb19a('0x2b')]};});_0x5d827a[_0xb19a('0x2c')]=_['map'](_0x1b42d7,_0xb19a('0x26'));_0x5d827a[_0xb19a('0x2d')]=_[_0xb19a('0x2e')](_0x49ed1a[_0xb19a('0x2d')]);_0x5d827a[_0xb19a('0x2f')]=_[_0xb19a('0x30')](_0x5d827a[_0xb19a('0x2c')],_0x5d827a['query']);_0x420b35['attributes']=_[_0xb19a('0x30')](_0x5d827a[_0xb19a('0x2c')],qs[_0xb19a('0x31')](_0x49ed1a[_0xb19a('0x2d')][_0xb19a('0x31')]));_0x420b35['attributes']=_0x420b35[_0xb19a('0x32')][_0xb19a('0x33')]?_0x420b35[_0xb19a('0x32')]:_0x5d827a[_0xb19a('0x2c')];if(!_0x49ed1a[_0xb19a('0x2d')]['hasOwnProperty'](_0xb19a('0x34'))){_0x420b35[_0xb19a('0x1d')]=qs[_0xb19a('0x1d')](_0x49ed1a[_0xb19a('0x2d')][_0xb19a('0x1d')]);_0x420b35[_0xb19a('0x1c')]=qs['offset'](_0x49ed1a['query'][_0xb19a('0x1c')]);}_0x420b35[_0xb19a('0x35')]=qs[_0xb19a('0x36')](_0x49ed1a[_0xb19a('0x2d')][_0xb19a('0x36')]);_0x420b35[_0xb19a('0x37')]=qs[_0xb19a('0x2f')](_[_0xb19a('0x38')](_0x49ed1a[_0xb19a('0x2d')],_0x5d827a[_0xb19a('0x2f')]),_0x1b42d7);if(_0x49ed1a['query'][_0xb19a('0x39')]){_0x420b35['where']=_[_0xb19a('0x3a')](_0x420b35[_0xb19a('0x37')],{'$or':_[_0xb19a('0x27')](_0x1b42d7,function(_0x11a9cb){if(_0x11a9cb[_0xb19a('0x2a')]!==_0xb19a('0x3b')){var _0x2ea0d1={};_0x2ea0d1[_0x11a9cb[_0xb19a('0x26')]]={'$like':'%'+_0x49ed1a[_0xb19a('0x2d')][_0xb19a('0x39')]+'%'};return _0x2ea0d1;}})});}_0x420b35=_[_0xb19a('0x3a')]({},_0x420b35,_0x49ed1a['options']);var _0x2fec9f={'where':_0x420b35[_0xb19a('0x37')]};return db[_0xb19a('0x28')]['count'](_0x2fec9f)[_0xb19a('0x23')](function(_0x2a99ae){_0x1698f4['count']=_0x2a99ae;if(_0x49ed1a['query'][_0xb19a('0x3c')]){_0x420b35['include']=[{'all':!![]}];}return db[_0xb19a('0x28')]['findAll'](_0x420b35);})['then'](function(_0x4e842d){_0x1698f4['rows']=_0x4e842d;return _0x1698f4;})[_0xb19a('0x23')](respondWithFilteredResult(_0x105e9d,_0x420b35))['catch'](handleError(_0x105e9d,null));};exports['show']=function(_0x247f9a,_0x24723e){var _0x1a65f6={'raw':!![],'where':{'id':_0x247f9a['params']['id']}},_0x1a6156={};_0x1a6156[_0xb19a('0x2c')]=_[_0xb19a('0x2e')](db[_0xb19a('0x28')][_0xb19a('0x3d')]);_0x1a6156[_0xb19a('0x2d')]=_[_0xb19a('0x2e')](_0x247f9a[_0xb19a('0x2d')]);_0x1a6156[_0xb19a('0x2f')]=_[_0xb19a('0x30')](_0x1a6156[_0xb19a('0x2c')],_0x1a6156[_0xb19a('0x2d')]);_0x1a65f6['attributes']=_[_0xb19a('0x30')](_0x1a6156[_0xb19a('0x2c')],qs[_0xb19a('0x31')](_0x247f9a[_0xb19a('0x2d')][_0xb19a('0x31')]));_0x1a65f6[_0xb19a('0x32')]=_0x1a65f6[_0xb19a('0x32')][_0xb19a('0x33')]?_0x1a65f6[_0xb19a('0x32')]:_0x1a6156['model'];if(_0x247f9a[_0xb19a('0x2d')][_0xb19a('0x3c')]){_0x1a65f6[_0xb19a('0x3e')]=[{'all':!![]}];}_0x1a65f6=_[_0xb19a('0x3a')]({},_0x1a65f6,_0x247f9a['options']);return db['FreshdeskField'][_0xb19a('0x3f')](_0x1a65f6)['then'](handleEntityNotFound(_0x24723e,null))[_0xb19a('0x23')](respondWithResult(_0x24723e,null))[_0xb19a('0x40')](handleError(_0x24723e,null));};exports[_0xb19a('0x41')]=function(_0x2a4a99,_0x5cfd9f){return db['FreshdeskField'][_0xb19a('0x41')](_0x2a4a99[_0xb19a('0x42')],{})[_0xb19a('0x23')](respondWithResult(_0x5cfd9f,0xc9))[_0xb19a('0x40')](handleError(_0x5cfd9f,null));};exports[_0xb19a('0x21')]=function(_0x1b112b,_0x2e12dd){if(_0x1b112b[_0xb19a('0x42')]['id']){delete _0x1b112b[_0xb19a('0x42')]['id'];}return db[_0xb19a('0x28')]['find']({'where':{'id':_0x1b112b['params']['id']}})[_0xb19a('0x23')](handleEntityNotFound(_0x2e12dd,null))[_0xb19a('0x23')](saveUpdates(_0x1b112b[_0xb19a('0x42')],null))[_0xb19a('0x23')](respondWithResult(_0x2e12dd,null))[_0xb19a('0x40')](handleError(_0x2e12dd,null));};exports[_0xb19a('0x22')]=function(_0x5de05b,_0xb7c3d7){return db[_0xb19a('0x28')][_0xb19a('0x3f')]({'where':{'id':_0x5de05b['params']['id']}})[_0xb19a('0x23')](handleEntityNotFound(_0xb7c3d7,null))['then'](removeEntity(_0xb7c3d7,null))['catch'](handleError(_0xb7c3d7,null));}; \ No newline at end of file +var _0x2fbf=['intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','count','include','rows','show','params','includeAll','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters'];(function(_0x31787b,_0x400e6a){var _0x550f08=function(_0x479c4f){while(--_0x479c4f){_0x31787b['push'](_0x31787b['shift']());}};_0x550f08(++_0x400e6a);}(_0x2fbf,0xac));var _0xf2fb=function(_0x4b5840,_0x232533){_0x4b5840=_0x4b5840-0x0;var _0x2ca931=_0x2fbf[_0x4b5840];return _0x2ca931;};'use strict';var pdf=require(_0xf2fb('0x0'));var emlformat=require(_0xf2fb('0x1'));var rimraf=require(_0xf2fb('0x2'));var zipdir=require(_0xf2fb('0x3'));var jsonpatch=require(_0xf2fb('0x4'));var rp=require(_0xf2fb('0x5'));var moment=require(_0xf2fb('0x6'));var BPromise=require(_0xf2fb('0x7'));var Mustache=require(_0xf2fb('0x8'));var util=require(_0xf2fb('0x9'));var path=require(_0xf2fb('0xa'));var sox=require('sox');var csv=require(_0xf2fb('0xb'));var ejs=require(_0xf2fb('0xc'));var fs=require('fs');var _=require(_0xf2fb('0xd'));var squel=require(_0xf2fb('0xe'));var crypto=require('crypto');var jsforce=require(_0xf2fb('0xf'));var deskjs=require(_0xf2fb('0x10'));var toCsv=require(_0xf2fb('0xb'));var querystring=require(_0xf2fb('0x11'));var Papa=require('papaparse');var Redis=require(_0xf2fb('0x12'));var authService=require(_0xf2fb('0x13'));var qs=require(_0xf2fb('0x14'));var as=require(_0xf2fb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2fb('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf2fb('0x17'));var db=require(_0xf2fb('0x18'))['db'];function respondWithStatusCode(_0x541fab,_0x55eee5){_0x55eee5=_0x55eee5||0xcc;return function(_0x578858){if(_0x578858){return _0x541fab[_0xf2fb('0x19')](_0x55eee5);}return _0x541fab[_0xf2fb('0x1a')](_0x55eee5)[_0xf2fb('0x1b')]();};}function respondWithResult(_0x39a626,_0x4dd516){_0x4dd516=_0x4dd516||0xc8;return function(_0x24cff9){if(_0x24cff9){return _0x39a626[_0xf2fb('0x1a')](_0x4dd516)[_0xf2fb('0x1c')](_0x24cff9);}};}function respondWithFilteredResult(_0x4c3008,_0x1e1d25){return function(_0x5a4b80){if(_0x5a4b80){var _0x1f8143=_0x5a4b80['count'],_0x627380=_0x1e1d25['offset'],_0x4dd666=_0x1e1d25[_0xf2fb('0x1d')]+_0x1e1d25[_0xf2fb('0x1e')],_0x1acdb0;if(_0x4dd666>=_0x1f8143){_0x4dd666=_0x1f8143;_0x1acdb0=0xc8;}else{_0x1acdb0=0xce;}_0x4c3008['status'](_0x1acdb0);return _0x4c3008[_0xf2fb('0x1f')]('Content-Range',_0x627380+'-'+_0x4dd666+'/'+_0x1f8143)['json'](_0x5a4b80);}return null;};}function patchUpdates(_0x4597fc){return function(_0x17bb45){try{jsonpatch[_0xf2fb('0x20')](_0x17bb45,_0x4597fc,!![]);}catch(_0x25a651){return BPromise['reject'](_0x25a651);}return _0x17bb45[_0xf2fb('0x21')]();};}function saveUpdates(_0x442e48,_0x4a31b5){return function(_0x546831){if(_0x546831){return _0x546831[_0xf2fb('0x22')](_0x442e48)[_0xf2fb('0x23')](function(_0xfddee8){return _0xfddee8;});}return null;};}function removeEntity(_0x326b9e,_0x11aab0){return function(_0x4d13f7){if(_0x4d13f7){return _0x4d13f7[_0xf2fb('0x24')]()['then'](function(){_0x326b9e[_0xf2fb('0x1a')](0xcc)[_0xf2fb('0x1b')]();});}};}function handleEntityNotFound(_0x4ed5cd,_0x35c6c3){return function(_0x1f4ef6){if(!_0x1f4ef6){_0x4ed5cd['sendStatus'](0x194);}return _0x1f4ef6;};}function handleError(_0x11967f,_0x3f588c){_0x3f588c=_0x3f588c||0x1f4;return function(_0x3097e0){logger[_0xf2fb('0x25')](_0x3097e0[_0xf2fb('0x26')]);if(_0x3097e0[_0xf2fb('0x27')]){delete _0x3097e0['name'];}_0x11967f['status'](_0x3f588c)[_0xf2fb('0x28')](_0x3097e0);};}exports[_0xf2fb('0x29')]=function(_0x10dd7c,_0x241321){var _0x231e68={},_0x1a579b={},_0x3432ab={'count':0x0,'rows':[]};var _0x2b7333=_[_0xf2fb('0x2a')](db[_0xf2fb('0x2b')][_0xf2fb('0x2c')],function(_0x54138c){return{'name':_0x54138c[_0xf2fb('0x2d')],'type':_0x54138c[_0xf2fb('0x2e')]['key']};});_0x1a579b['model']=_['map'](_0x2b7333,_0xf2fb('0x27'));_0x1a579b[_0xf2fb('0x2f')]=_[_0xf2fb('0x30')](_0x10dd7c[_0xf2fb('0x2f')]);_0x1a579b[_0xf2fb('0x31')]=_[_0xf2fb('0x32')](_0x1a579b[_0xf2fb('0x33')],_0x1a579b['query']);_0x231e68['attributes']=_[_0xf2fb('0x32')](_0x1a579b['model'],qs['fields'](_0x10dd7c[_0xf2fb('0x2f')][_0xf2fb('0x34')]));_0x231e68[_0xf2fb('0x35')]=_0x231e68[_0xf2fb('0x35')][_0xf2fb('0x36')]?_0x231e68[_0xf2fb('0x35')]:_0x1a579b[_0xf2fb('0x33')];if(!_0x10dd7c['query'][_0xf2fb('0x37')]('nolimit')){_0x231e68[_0xf2fb('0x1e')]=qs['limit'](_0x10dd7c['query'][_0xf2fb('0x1e')]);_0x231e68[_0xf2fb('0x1d')]=qs[_0xf2fb('0x1d')](_0x10dd7c[_0xf2fb('0x2f')][_0xf2fb('0x1d')]);}_0x231e68[_0xf2fb('0x38')]=qs[_0xf2fb('0x39')](_0x10dd7c[_0xf2fb('0x2f')][_0xf2fb('0x39')]);_0x231e68['where']=qs[_0xf2fb('0x31')](_[_0xf2fb('0x3a')](_0x10dd7c[_0xf2fb('0x2f')],_0x1a579b[_0xf2fb('0x31')]),_0x2b7333);if(_0x10dd7c['query'][_0xf2fb('0x3b')]){_0x231e68['where']=_[_0xf2fb('0x3c')](_0x231e68[_0xf2fb('0x3d')],{'$or':_[_0xf2fb('0x2a')](_0x2b7333,function(_0x17dcc3){if(_0x17dcc3[_0xf2fb('0x2e')]!==_0xf2fb('0x3e')){var _0x5c6688={};_0x5c6688[_0x17dcc3[_0xf2fb('0x27')]]={'$like':'%'+_0x10dd7c['query'][_0xf2fb('0x3b')]+'%'};return _0x5c6688;}})});}_0x231e68=_['merge']({},_0x231e68,_0x10dd7c[_0xf2fb('0x3f')]);var _0x14e3cf={'where':_0x231e68[_0xf2fb('0x3d')]};return db[_0xf2fb('0x2b')][_0xf2fb('0x40')](_0x14e3cf)[_0xf2fb('0x23')](function(_0x74eaa7){_0x3432ab['count']=_0x74eaa7;if(_0x10dd7c['query']['includeAll']){_0x231e68[_0xf2fb('0x41')]=[{'all':!![]}];}return db[_0xf2fb('0x2b')]['findAll'](_0x231e68);})['then'](function(_0x239ef0){_0x3432ab[_0xf2fb('0x42')]=_0x239ef0;return _0x3432ab;})[_0xf2fb('0x23')](respondWithFilteredResult(_0x241321,_0x231e68))['catch'](handleError(_0x241321,null));};exports[_0xf2fb('0x43')]=function(_0x4cafa9,_0x4757c1){var _0x5c6fe5={'raw':!![],'where':{'id':_0x4cafa9[_0xf2fb('0x44')]['id']}},_0x38c204={};_0x38c204['model']=_[_0xf2fb('0x30')](db[_0xf2fb('0x2b')][_0xf2fb('0x2c')]);_0x38c204['query']=_[_0xf2fb('0x30')](_0x4cafa9[_0xf2fb('0x2f')]);_0x38c204[_0xf2fb('0x31')]=_[_0xf2fb('0x32')](_0x38c204[_0xf2fb('0x33')],_0x38c204[_0xf2fb('0x2f')]);_0x5c6fe5['attributes']=_['intersection'](_0x38c204[_0xf2fb('0x33')],qs[_0xf2fb('0x34')](_0x4cafa9[_0xf2fb('0x2f')][_0xf2fb('0x34')]));_0x5c6fe5['attributes']=_0x5c6fe5[_0xf2fb('0x35')][_0xf2fb('0x36')]?_0x5c6fe5[_0xf2fb('0x35')]:_0x38c204[_0xf2fb('0x33')];if(_0x4cafa9[_0xf2fb('0x2f')][_0xf2fb('0x45')]){_0x5c6fe5['include']=[{'all':!![]}];}_0x5c6fe5=_['merge']({},_0x5c6fe5,_0x4cafa9[_0xf2fb('0x3f')]);return db[_0xf2fb('0x2b')]['find'](_0x5c6fe5)[_0xf2fb('0x23')](handleEntityNotFound(_0x4757c1,null))['then'](respondWithResult(_0x4757c1,null))[_0xf2fb('0x46')](handleError(_0x4757c1,null));};exports['create']=function(_0x350100,_0x72a2c){return db[_0xf2fb('0x2b')][_0xf2fb('0x47')](_0x350100['body'],{})[_0xf2fb('0x23')](respondWithResult(_0x72a2c,0xc9))[_0xf2fb('0x46')](handleError(_0x72a2c,null));};exports[_0xf2fb('0x22')]=function(_0x3ce71a,_0x520d1b){if(_0x3ce71a[_0xf2fb('0x48')]['id']){delete _0x3ce71a['body']['id'];}return db[_0xf2fb('0x2b')]['find']({'where':{'id':_0x3ce71a[_0xf2fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x520d1b,null))[_0xf2fb('0x23')](saveUpdates(_0x3ce71a['body'],null))[_0xf2fb('0x23')](respondWithResult(_0x520d1b,null))[_0xf2fb('0x46')](handleError(_0x520d1b,null));};exports[_0xf2fb('0x24')]=function(_0x2f609d,_0x54a58b){return db['FreshdeskField'][_0xf2fb('0x49')]({'where':{'id':_0x2f609d[_0xf2fb('0x44')]['id']}})[_0xf2fb('0x23')](handleEntityNotFound(_0x54a58b,null))[_0xf2fb('0x23')](removeEntity(_0x54a58b,null))[_0xf2fb('0x46')](handleError(_0x54a58b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 42e859f..28ed0a1 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 _0xd80d=['define','int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xd80d,0x13f));var _0xdd80=function(_0x243e3d,_0x3b77ff){_0x243e3d=_0x243e3d-0x0;var _0x4a30ad=_0xd80d[_0x243e3d];return _0x4a30ad;};'use strict';var _=require(_0xdd80('0x0'));var util=require(_0xdd80('0x1'));var logger=require(_0xdd80('0x2'))(_0xdd80('0x3'));var moment=require(_0xdd80('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd80('0x5'));var fs=require('fs');var path=require(_0xdd80('0x6'));var rimraf=require(_0xdd80('0x7'));var config=require(_0xdd80('0x8'));var attributes=require(_0xdd80('0x9'));module[_0xdd80('0xa')]=function(_0x1858dd,_0x54abc5){return _0x1858dd[_0xdd80('0xb')]('FreshdeskField',attributes,{'tableName':_0xdd80('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xdd80('0xd'),_0xdd80('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32c6=['path','rimraf','../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x32c6,0x95));var _0x632c=function(_0x292d52,_0x138fcf){_0x292d52=_0x292d52-0x0;var _0x179a52=_0x32c6[_0x292d52];return _0x179a52;};'use strict';var _=require(_0x632c('0x0'));var util=require('util');var logger=require(_0x632c('0x1'))(_0x632c('0x2'));var moment=require(_0x632c('0x3'));var BPromise=require(_0x632c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x632c('0x5'));var rimraf=require(_0x632c('0x6'));var config=require(_0x632c('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x632c('0x8')]=function(_0x2ac96e,_0x5c464e){return _0x2ac96e['define'](_0x632c('0x9'),attributes,{'tableName':_0x632c('0xa'),'paranoid':![],'indexes':[{'name':_0x632c('0xb'),'fields':[_0x632c('0xc'),_0x632c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 99f4150..232f5a8 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x22bb1b,_0x4925c8){_0x22bb1b=_0x22bb1b-0x0;var _0x57f7be=_0x7a54[_0x22bb1b];return _0x57f7be;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x7b0cd6,_0x49104e){_0x7b0cd6=_0x7b0cd6-0x0;var _0x42038d=_0x7a54[_0x7b0cd6];return _0x42038d;};'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 efdf1ed..88ef1b2 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 _0xc14c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','connect-timeout'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xc14c,0xdb));var _0xcc14=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc14c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcc14('0x0'));var express=require('express');var router=express[_0xcc14('0x1')]();var auth=require(_0xcc14('0x2'));var interaction=require(_0xcc14('0x3'));var config=require(_0xcc14('0x4'));var controller=require(_0xcc14('0x5'));router[_0xcc14('0x6')]('/',auth[_0xcc14('0x7')](),controller[_0xcc14('0x8')]);router[_0xcc14('0x6')](_0xcc14('0x9'),auth[_0xcc14('0x7')](),controller[_0xcc14('0xa')]);router[_0xcc14('0x6')]('/:id/configurations',auth[_0xcc14('0x7')](),controller[_0xcc14('0xb')]);router[_0xcc14('0x6')]('/:id/fields',auth[_0xcc14('0x7')](),controller['getFields']);router[_0xcc14('0xc')]('/',auth[_0xcc14('0x7')](),controller[_0xcc14('0xd')]);router[_0xcc14('0xc')](_0xcc14('0xe'),auth['isAuthenticated'](),controller[_0xcc14('0xf')]);router[_0xcc14('0x10')](_0xcc14('0x9'),auth['isAuthenticated'](),controller[_0xcc14('0x11')]);router[_0xcc14('0x12')](_0xcc14('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc14('0x13')]=router; \ No newline at end of file +var _0x9803=['getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x3b5646,_0x2db929){var _0x9a471a=function(_0x2ef01f){while(--_0x2ef01f){_0x3b5646['push'](_0x3b5646['shift']());}};_0x9a471a(++_0x2db929);}(_0x9803,0xe5));var _0x3980=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9803[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3980('0x0'));var util=require('util');var path=require(_0x3980('0x1'));var timeout=require(_0x3980('0x2'));var express=require('express');var router=express[_0x3980('0x3')]();var auth=require(_0x3980('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3980('0x5'));var controller=require(_0x3980('0x6'));router[_0x3980('0x7')]('/',auth['isAuthenticated'](),controller[_0x3980('0x8')]);router[_0x3980('0x7')](_0x3980('0x9'),auth[_0x3980('0xa')](),controller[_0x3980('0xb')]);router[_0x3980('0x7')](_0x3980('0xc'),auth[_0x3980('0xa')](),controller[_0x3980('0xd')]);router[_0x3980('0x7')]('/:id/fields',auth[_0x3980('0xa')](),controller[_0x3980('0xe')]);router[_0x3980('0xf')]('/',auth['isAuthenticated'](),controller[_0x3980('0x10')]);router[_0x3980('0xf')](_0x3980('0xc'),auth[_0x3980('0xa')](),controller[_0x3980('0x11')]);router['put'](_0x3980('0x9'),auth[_0x3980('0xa')](),controller[_0x3980('0x12')]);router[_0x3980('0x13')]('/:id',auth[_0x3980('0xa')](),controller[_0x3980('0x14')]);module[_0x3980('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 687b10d..0fc68c2 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 _0xd9fb=['STRING','username','remoteUri','sequelize','exports'];(function(_0x54980b,_0x3bb9a5){var _0x58f35c=function(_0xc5fb3){while(--_0xc5fb3){_0x54980b['push'](_0x54980b['shift']());}};_0x58f35c(++_0x3bb9a5);}(_0xd9fb,0x189));var _0xbd9f=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xd9fb[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0xbd9f('0x0'));module[_0xbd9f('0x1')]={'name':{'type':Sequelize[_0xbd9f('0x2')]},'description':{'type':Sequelize[_0xbd9f('0x2')]},'username':{'type':Sequelize[_0xbd9f('0x2')],'unique':_0xbd9f('0x3')},'apiKey':{'type':Sequelize[_0xbd9f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xbd9f('0x4')},'serverUrl':{'type':Sequelize[_0xbd9f('0x2')]}}; \ No newline at end of file +var _0x0424=['username','STRING'];(function(_0x2fbb34,_0x358b15){var _0x26914a=function(_0x240fc1){while(--_0x240fc1){_0x2fbb34['push'](_0x2fbb34['shift']());}};_0x26914a(++_0x358b15);}(_0x0424,0x159));var _0x4042=function(_0x10f060,_0x312a7b){_0x10f060=_0x10f060-0x0;var _0x512722=_0x0424[_0x10f060];return _0x512722;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a33da12..61b2030 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 _0x67bf=['addConfiguration','Subjects','channel','Descriptions','FreshsalesField','getFields','remoteUri','apiKey','username','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','map','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','options'];(function(_0x201286,_0x173536){var _0x58b500=function(_0x3bca47){while(--_0x3bca47){_0x201286['push'](_0x201286['shift']());}};_0x58b500(++_0x173536);}(_0x67bf,0x16d));var _0xf67b=function(_0x2d80d0,_0x33ee32){_0x2d80d0=_0x2d80d0-0x0;var _0x5b7582=_0x67bf[_0x2d80d0];return _0x5b7582;};'use strict';var pdf=require(_0xf67b('0x0'));var emlformat=require(_0xf67b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf67b('0x2'));var jsonpatch=require(_0xf67b('0x3'));var rp=require(_0xf67b('0x4'));var moment=require(_0xf67b('0x5'));var BPromise=require(_0xf67b('0x6'));var Mustache=require(_0xf67b('0x7'));var util=require(_0xf67b('0x8'));var path=require(_0xf67b('0x9'));var sox=require('sox');var csv=require(_0xf67b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf67b('0xb'));var squel=require(_0xf67b('0xc'));var crypto=require(_0xf67b('0xd'));var jsforce=require(_0xf67b('0xe'));var deskjs=require(_0xf67b('0xf'));var toCsv=require(_0xf67b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf67b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf67b('0x11'));var as=require(_0xf67b('0x12'));var hardwareService=require(_0xf67b('0x13'));var logger=require(_0xf67b('0x14'))(_0xf67b('0x15'));var utils=require(_0xf67b('0x16'));var config=require(_0xf67b('0x17'));var db=require(_0xf67b('0x18'))['db'];var integrations=require(_0xf67b('0x19'));var jayson=require(_0xf67b('0x1a'));var client=jayson[_0xf67b('0x1b')][_0xf67b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3734ba,_0x50898b,_0x3fb550){if(_0x3fb550){var _0x456fa4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x456fa4[_0xf67b('0x1d')](_0x50898b)){return _0x3734ba;}else{throw new db[(_0xf67b('0x1e'))][(_0xf67b('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 _0x3734ba;}}function respondWithRpcPromise(_0x1cb436,_0x251bd0,_0x5f0ebe,_0x48e89f){return new BPromise(function(_0x5b62ad,_0x1068b4){var _0x592e20=_0x48e89f||client;return _0x592e20[_0xf67b('0x20')](_0x1cb436,_0x5f0ebe)['then'](function(_0x40525a){logger[_0xf67b('0x21')](_0xf67b('0x22'),_0x251bd0,_0xf67b('0x23'));logger[_0xf67b('0x24')](_0xf67b('0x25'),_0x251bd0,'request\x20sent',JSON[_0xf67b('0x26')](_0x40525a));if(_0x40525a[_0xf67b('0x27')]){if(_0x40525a[_0xf67b('0x27')]['code']===0x1f4){logger[_0xf67b('0x27')](_0xf67b('0x22'),_0x251bd0,_0x40525a[_0xf67b('0x27')]['message']);return _0x1068b4(_0x40525a[_0xf67b('0x27')][_0xf67b('0x28')]);}logger[_0xf67b('0x27')](_0xf67b('0x22'),_0x251bd0,_0x40525a[_0xf67b('0x27')][_0xf67b('0x28')]);return _0x5b62ad(_0x40525a[_0xf67b('0x27')]['message']);}else{logger[_0xf67b('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x251bd0,_0xf67b('0x23'));_0x5b62ad(_0x40525a['result'][_0xf67b('0x28')]);}})[_0xf67b('0x29')](function(_0x56961c){logger[_0xf67b('0x27')]('FreshsalesAccount,\x20%s,\x20%s',_0x251bd0,_0x56961c);_0x1068b4(_0x56961c);});});}function respondWithStatusCode(_0x1f63da,_0x2402ce){_0x2402ce=_0x2402ce||0xcc;return function(_0x1f4f95){if(_0x1f4f95){return _0x1f63da[_0xf67b('0x2a')](_0x2402ce);}return _0x1f63da['status'](_0x2402ce)[_0xf67b('0x2b')]();};}function respondWithResult(_0x21a5ac,_0x1007bd){_0x1007bd=_0x1007bd||0xc8;return function(_0x40e950){if(_0x40e950){return _0x21a5ac['status'](_0x1007bd)[_0xf67b('0x2c')](_0x40e950);}};}function respondWithFilteredResult(_0x19e22e,_0x1c4c5b){return function(_0x40a564){if(_0x40a564){var _0x576032=_0x40a564[_0xf67b('0x2d')],_0x2ca08d=_0x1c4c5b[_0xf67b('0x2e')],_0x1bae04=_0x1c4c5b[_0xf67b('0x2e')]+_0x1c4c5b[_0xf67b('0x2f')],_0x3c79f1;if(_0x1bae04>=_0x576032){_0x1bae04=_0x576032;_0x3c79f1=0xc8;}else{_0x3c79f1=0xce;}_0x19e22e[_0xf67b('0x30')](_0x3c79f1);return _0x19e22e[_0xf67b('0x31')](_0xf67b('0x32'),_0x2ca08d+'-'+_0x1bae04+'/'+_0x576032)[_0xf67b('0x2c')](_0x40a564);}return null;};}function patchUpdates(_0x7d567f){return function(_0x2e0c5c){try{jsonpatch[_0xf67b('0x33')](_0x2e0c5c,_0x7d567f,!![]);}catch(_0x559eef){return BPromise[_0xf67b('0x34')](_0x559eef);}return _0x2e0c5c[_0xf67b('0x35')]();};}function saveUpdates(_0x4d4171,_0x18ba8a){return function(_0x2af6ce){if(_0x2af6ce){return _0x2af6ce[_0xf67b('0x36')](_0x4d4171)['then'](function(_0x10e778){return _0x10e778;});}return null;};}function removeEntity(_0x17d56c,_0x1ae963){return function(_0xeaa5fc){if(_0xeaa5fc){return _0xeaa5fc['destroy']()['then'](function(){_0x17d56c[_0xf67b('0x30')](0xcc)[_0xf67b('0x2b')]();});}};}function handleEntityNotFound(_0x46c56d,_0x22521b){return function(_0x44ea8e){if(!_0x44ea8e){_0x46c56d[_0xf67b('0x2a')](0x194);}return _0x44ea8e;};}function handleError(_0x5bd8ea,_0x339a2e){_0x339a2e=_0x339a2e||0x1f4;return function(_0x471ec9){logger[_0xf67b('0x27')](_0x471ec9[_0xf67b('0x37')]);if(_0x471ec9[_0xf67b('0x38')]){delete _0x471ec9[_0xf67b('0x38')];}_0x5bd8ea[_0xf67b('0x30')](_0x339a2e)[_0xf67b('0x39')](_0x471ec9);};}exports[_0xf67b('0x3a')]=function(_0xed0386,_0x4d4913){var _0x2880d8={},_0x4a4767={},_0xe7538e={'count':0x0,'rows':[]};var _0x10bc29=_['map'](db[_0xf67b('0x3b')][_0xf67b('0x3c')],function(_0x421919){return{'name':_0x421919[_0xf67b('0x3d')],'type':_0x421919[_0xf67b('0x3e')]['key']};});_0x4a4767[_0xf67b('0x3f')]=_['map'](_0x10bc29,'name');_0x4a4767[_0xf67b('0x40')]=_[_0xf67b('0x41')](_0xed0386[_0xf67b('0x40')]);_0x4a4767['filters']=_[_0xf67b('0x42')](_0x4a4767[_0xf67b('0x3f')],_0x4a4767['query']);_0x2880d8[_0xf67b('0x43')]=_['intersection'](_0x4a4767[_0xf67b('0x3f')],qs[_0xf67b('0x44')](_0xed0386[_0xf67b('0x40')][_0xf67b('0x44')]));_0x2880d8[_0xf67b('0x43')]=_0x2880d8['attributes'][_0xf67b('0x45')]?_0x2880d8[_0xf67b('0x43')]:_0x4a4767[_0xf67b('0x3f')];if(!_0xed0386[_0xf67b('0x40')][_0xf67b('0x46')](_0xf67b('0x47'))){_0x2880d8[_0xf67b('0x2f')]=qs[_0xf67b('0x2f')](_0xed0386[_0xf67b('0x40')]['limit']);_0x2880d8[_0xf67b('0x2e')]=qs[_0xf67b('0x2e')](_0xed0386[_0xf67b('0x40')][_0xf67b('0x2e')]);}_0x2880d8[_0xf67b('0x48')]=qs['sort'](_0xed0386[_0xf67b('0x40')][_0xf67b('0x49')]);_0x2880d8['where']=qs[_0xf67b('0x4a')](_[_0xf67b('0x4b')](_0xed0386[_0xf67b('0x40')],_0x4a4767[_0xf67b('0x4a')]),_0x10bc29);if(_0xed0386[_0xf67b('0x40')]['filter']){_0x2880d8[_0xf67b('0x4c')]=_[_0xf67b('0x4d')](_0x2880d8['where'],{'$or':_[_0xf67b('0x4e')](_0x10bc29,function(_0x5530bd){if(_0x5530bd[_0xf67b('0x3e')]!==_0xf67b('0x4f')){var _0xac19ad={};_0xac19ad[_0x5530bd[_0xf67b('0x38')]]={'$like':'%'+_0xed0386['query'][_0xf67b('0x50')]+'%'};return _0xac19ad;}})});}_0x2880d8=_[_0xf67b('0x4d')]({},_0x2880d8,_0xed0386['options']);var _0x26af40={'where':_0x2880d8[_0xf67b('0x4c')]};return db[_0xf67b('0x3b')]['count'](_0x26af40)[_0xf67b('0x51')](function(_0x5b53fb){_0xe7538e[_0xf67b('0x2d')]=_0x5b53fb;if(_0xed0386['query'][_0xf67b('0x52')]){_0x2880d8[_0xf67b('0x53')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xf67b('0x54')](_0x2880d8);})[_0xf67b('0x51')](function(_0x424b22){_0xe7538e[_0xf67b('0x55')]=_0x424b22;return _0xe7538e;})[_0xf67b('0x51')](respondWithFilteredResult(_0x4d4913,_0x2880d8))[_0xf67b('0x29')](handleError(_0x4d4913,null));};exports[_0xf67b('0x56')]=function(_0x480dbc,_0x3cec89){var _0x26cc0e={'raw':![],'where':{'id':_0x480dbc[_0xf67b('0x57')]['id']}},_0x164ce6={};_0x164ce6[_0xf67b('0x3f')]=_[_0xf67b('0x41')](db[_0xf67b('0x3b')][_0xf67b('0x3c')]);_0x164ce6[_0xf67b('0x40')]=_[_0xf67b('0x41')](_0x480dbc[_0xf67b('0x40')]);_0x164ce6[_0xf67b('0x4a')]=_['intersection'](_0x164ce6['model'],_0x164ce6[_0xf67b('0x40')]);_0x26cc0e[_0xf67b('0x43')]=_[_0xf67b('0x42')](_0x164ce6[_0xf67b('0x3f')],qs[_0xf67b('0x44')](_0x480dbc[_0xf67b('0x40')][_0xf67b('0x44')]));_0x26cc0e[_0xf67b('0x43')]=_0x26cc0e['attributes'][_0xf67b('0x45')]?_0x26cc0e[_0xf67b('0x43')]:_0x164ce6[_0xf67b('0x3f')];if(_0x480dbc[_0xf67b('0x40')][_0xf67b('0x52')]){_0x26cc0e['include']=[{'all':!![]}];}_0x26cc0e=_[_0xf67b('0x4d')]({},_0x26cc0e,_0x480dbc['options']);return db['FreshsalesAccount'][_0xf67b('0x58')](_0x26cc0e)[_0xf67b('0x51')](handleEntityNotFound(_0x3cec89,null))[_0xf67b('0x51')](respondWithResult(_0x3cec89,null))[_0xf67b('0x29')](handleError(_0x3cec89,null));};exports[_0xf67b('0x59')]=function(_0x129e7d,_0x298c1b){return db[_0xf67b('0x3b')][_0xf67b('0x59')](_0x129e7d[_0xf67b('0x5a')],{})[_0xf67b('0x51')](respondWithResult(_0x298c1b,0xc9))[_0xf67b('0x29')](handleError(_0x298c1b,null));};exports['update']=function(_0x4b173c,_0x1b3966){if(_0x4b173c['body']['id']){delete _0x4b173c['body']['id'];}return db[_0xf67b('0x3b')][_0xf67b('0x58')]({'where':{'id':_0x4b173c[_0xf67b('0x57')]['id']}})[_0xf67b('0x51')](handleEntityNotFound(_0x1b3966,null))[_0xf67b('0x51')](saveUpdates(_0x4b173c[_0xf67b('0x5a')],null))[_0xf67b('0x51')](respondWithResult(_0x1b3966,null))[_0xf67b('0x29')](handleError(_0x1b3966,null));};exports['destroy']=function(_0x107a59,_0x5badd8){return db[_0xf67b('0x3b')][_0xf67b('0x58')]({'where':{'id':_0x107a59[_0xf67b('0x57')]['id']}})[_0xf67b('0x51')](handleEntityNotFound(_0x5badd8,null))[_0xf67b('0x51')](removeEntity(_0x5badd8,null))[_0xf67b('0x29')](handleError(_0x5badd8,null));};exports[_0xf67b('0x5b')]=function(_0x20b56a,_0x3cb5b0,_0x489e97){var _0x59d4eb={};var _0xf93e37={};var _0x2ea304;var _0x176f10;return db['FreshsalesAccount'][_0xf67b('0x5c')]({'where':{'id':_0x20b56a[_0xf67b('0x57')]['id']}})[_0xf67b('0x51')](handleEntityNotFound(_0x3cb5b0,null))[_0xf67b('0x51')](function(_0x2fa827){if(_0x2fa827){_0x2ea304=_0x2fa827;_0xf93e37[_0xf67b('0x3f')]=_[_0xf67b('0x41')](db[_0xf67b('0x5d')][_0xf67b('0x3c')]);_0xf93e37[_0xf67b('0x40')]=_[_0xf67b('0x41')](_0x20b56a[_0xf67b('0x40')]);_0xf93e37[_0xf67b('0x4a')]=_[_0xf67b('0x42')](_0xf93e37['model'],_0xf93e37[_0xf67b('0x40')]);_0x59d4eb[_0xf67b('0x43')]=_[_0xf67b('0x42')](_0xf93e37[_0xf67b('0x3f')],qs[_0xf67b('0x44')](_0x20b56a[_0xf67b('0x40')][_0xf67b('0x44')]));_0x59d4eb[_0xf67b('0x43')]=_0x59d4eb[_0xf67b('0x43')]['length']?_0x59d4eb[_0xf67b('0x43')]:_0xf93e37[_0xf67b('0x3f')];_0x59d4eb[_0xf67b('0x48')]=qs[_0xf67b('0x49')](_0x20b56a[_0xf67b('0x40')][_0xf67b('0x49')]);_0x59d4eb[_0xf67b('0x4c')]=qs[_0xf67b('0x4a')](_[_0xf67b('0x4b')](_0x20b56a[_0xf67b('0x40')],_0xf93e37[_0xf67b('0x4a')]));if(_0x20b56a['query'][_0xf67b('0x50')]){_0x59d4eb['where']=_[_0xf67b('0x4d')](_0x59d4eb[_0xf67b('0x4c')],{'$or':_[_0xf67b('0x4e')](_0x59d4eb[_0xf67b('0x43')],function(_0x1115c1){var _0x40e4f8={};_0x40e4f8[_0x1115c1]={'$like':'%'+_0x20b56a['query'][_0xf67b('0x50')]+'%'};return _0x40e4f8;})});}_0x59d4eb=_[_0xf67b('0x4d')]({},_0x59d4eb,_0x20b56a[_0xf67b('0x5e')]);return _0x2ea304[_0xf67b('0x5b')](_0x59d4eb);}})[_0xf67b('0x51')](function(_0x5e01bd){if(_0x5e01bd){_0x176f10=_0x5e01bd['length'];if(!_0x20b56a[_0xf67b('0x40')]['hasOwnProperty'](_0xf67b('0x47'))){_0x59d4eb[_0xf67b('0x2f')]=qs['limit'](_0x20b56a[_0xf67b('0x40')][_0xf67b('0x2f')]);_0x59d4eb[_0xf67b('0x2e')]=qs[_0xf67b('0x2e')](_0x20b56a['query'][_0xf67b('0x2e')]);}return _0x2ea304[_0xf67b('0x5b')](_0x59d4eb);}})[_0xf67b('0x51')](function(_0xb36e53){if(_0xb36e53){return _0xb36e53?{'count':_0x176f10,'rows':_0xb36e53}:null;}})[_0xf67b('0x51')](respondWithResult(_0x3cb5b0,null))['catch'](handleError(_0x3cb5b0,null));};exports[_0xf67b('0x5f')]=function(_0x10e0ba,_0x159ba4,_0x5b74b1){if(_0x10e0ba[_0xf67b('0x5a')]['id']){delete _0x10e0ba[_0xf67b('0x5a')]['id'];}return db[_0xf67b('0x3b')][_0xf67b('0x5c')]({'where':{'id':_0x10e0ba[_0xf67b('0x57')]['id']}})[_0xf67b('0x51')](handleEntityNotFound(_0x159ba4,null))[_0xf67b('0x51')](function(_0x3b248a){if(_0x3b248a){_0x10e0ba[_0xf67b('0x5a')]['AccountId']=_0x3b248a['id'];_0x10e0ba[_0xf67b('0x5a')][_0xf67b('0x60')]=integrations['getSubjects'](_0x10e0ba[_0xf67b('0x5a')][_0xf67b('0x61')],_0x10e0ba[_0xf67b('0x5a')][_0xf67b('0x3e')]);_0x10e0ba[_0xf67b('0x5a')][_0xf67b('0x62')]=integrations['getDescriptions'](_0x10e0ba[_0xf67b('0x5a')][_0xf67b('0x61')],_0x10e0ba[_0xf67b('0x5a')][_0xf67b('0x3e')]);return db[_0xf67b('0x5d')][_0xf67b('0x59')](_0x10e0ba['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xf67b('0x60')},{'model':db[_0xf67b('0x63')],'as':_0xf67b('0x62')}]});}return null;})[_0xf67b('0x51')](respondWithResult(_0x159ba4,null))[_0xf67b('0x29')](handleError(_0x159ba4,null));};exports[_0xf67b('0x64')]=function(_0x31e9fc,_0x3a50d8,_0x19d00e){var _0x37a8dc='';var _0x377b39='';return db[_0xf67b('0x3b')][_0xf67b('0x5c')]({'where':{'id':_0x31e9fc[_0xf67b('0x57')]['id']},'attributes':['id','username',_0xf67b('0x65'),_0xf67b('0x66')]})[_0xf67b('0x51')](handleEntityNotFound(_0x3a50d8,null))['then'](function(_0x553292){if(_0x553292){_0x377b39=_0x553292[_0xf67b('0x67')];_0x37a8dc=_0x553292[_0xf67b('0x65')];var _0x397152=_0x553292[_0xf67b('0x65')]['slice'](-0x1);if(_0x397152==='/'){_0x37a8dc=_0x37a8dc[_0xf67b('0x68')](0x0,_0x37a8dc['lastIndexOf'](_0x397152));}return rp({'method':_0xf67b('0x69'),'uri':util[_0xf67b('0x6a')](_0xf67b('0x6b'),_0x37a8dc,_0xf67b('0x6c')),'headers':{'Authorization':_0xf67b('0x6d')+_0x553292[_0xf67b('0x66')]},'json':!![]});}})[_0xf67b('0x51')](function(_0x42af2e){if(_0x42af2e){var _0x3714f3=_0x42af2e[_0xf67b('0x6e')];var _0x341910=![];var _0x5efa55=null;for(_0x5efa55=0x0;_0x5efa55<_0x3714f3[_0xf67b('0x45')];_0x5efa55++){if(_0x3714f3[_0x5efa55][_0xf67b('0x6f')]===_0x377b39){_0x341910=!![];}}if(_0x341910){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf67b('0x70')});}}})['then'](respondWithResult(_0x3a50d8,null))['catch'](function(_0x3f41ea){var _0x49afae=_0x31e9fc[_0xf67b('0x40')]['test']?0x1f4:_0x3f41ea[_0xf67b('0x71')]||0x1f4;logger[_0xf67b('0x27')](_0xf67b('0x72'),_0xf67b('0x64'),_0x49afae,JSON[_0xf67b('0x26')](_0x3f41ea));delete _0x3f41ea[_0xf67b('0x38')];if(_0x49afae===0x191){_0x49afae=0x190;}_0x3a50d8['status'](_0x49afae)['send'](_0x31e9fc[_0xf67b('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3f41ea[_0xf67b('0x71')]}:_0x3f41ea);});}; \ No newline at end of file +var _0x97d8=['type','key','model','query','attributes','intersection','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','fields','merge','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','status','json','count','offset','limit','set','reject','update','end','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName'];(function(_0xcda482,_0x2de121){var _0x50b43c=function(_0x27c9ec){while(--_0x27c9ec){_0xcda482['push'](_0xcda482['shift']());}};_0x50b43c(++_0x2de121);}(_0x97d8,0x193));var _0x897d=function(_0x325c74,_0x54f82c){_0x325c74=_0x325c74-0x0;var _0x57e4f5=_0x97d8[_0x325c74];return _0x57e4f5;};'use strict';var pdf=require(_0x897d('0x0'));var emlformat=require(_0x897d('0x1'));var rimraf=require(_0x897d('0x2'));var zipdir=require(_0x897d('0x3'));var jsonpatch=require(_0x897d('0x4'));var rp=require(_0x897d('0x5'));var moment=require('moment');var BPromise=require(_0x897d('0x6'));var Mustache=require(_0x897d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x897d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x897d('0x9'));var squel=require(_0x897d('0xa'));var crypto=require(_0x897d('0xb'));var jsforce=require(_0x897d('0xc'));var deskjs=require(_0x897d('0xd'));var toCsv=require(_0x897d('0xe'));var querystring=require(_0x897d('0xf'));var Papa=require(_0x897d('0x10'));var Redis=require(_0x897d('0x11'));var authService=require(_0x897d('0x12'));var qs=require(_0x897d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x897d('0x14'))(_0x897d('0x15'));var utils=require(_0x897d('0x16'));var config=require(_0x897d('0x17'));var db=require(_0x897d('0x18'))['db'];var integrations=require(_0x897d('0x19'));var jayson=require(_0x897d('0x1a'));var client=jayson[_0x897d('0x1b')][_0x897d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3aa654,_0x245501,_0x384276){if(_0x384276){var _0x57b92b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57b92b['test'](_0x245501)){return _0x3aa654;}else{throw new db['Sequelize'][(_0x897d('0x1d'))](_0x897d('0x1e'));}}else{return _0x3aa654;}}function respondWithRpcPromise(_0x1e8531,_0x24b36c,_0x1affdf,_0xed5310){return new BPromise(function(_0x52d220,_0x5574ed){var _0x5a940d=_0xed5310||client;return _0x5a940d[_0x897d('0x1f')](_0x1e8531,_0x1affdf)[_0x897d('0x20')](function(_0x24b259){logger[_0x897d('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x24b36c,'request\x20sent');logger[_0x897d('0x22')](_0x897d('0x23'),_0x24b36c,_0x897d('0x24'),JSON[_0x897d('0x25')](_0x24b259));if(_0x24b259[_0x897d('0x26')]){if(_0x24b259['error'][_0x897d('0x27')]===0x1f4){logger['error'](_0x897d('0x28'),_0x24b36c,_0x24b259[_0x897d('0x26')][_0x897d('0x29')]);return _0x5574ed(_0x24b259[_0x897d('0x26')][_0x897d('0x29')]);}logger[_0x897d('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x24b36c,_0x24b259[_0x897d('0x26')][_0x897d('0x29')]);return _0x52d220(_0x24b259['error'][_0x897d('0x29')]);}else{logger[_0x897d('0x21')](_0x897d('0x28'),_0x24b36c,_0x897d('0x24'));_0x52d220(_0x24b259[_0x897d('0x2a')][_0x897d('0x29')]);}})['catch'](function(_0x4c0d04){logger[_0x897d('0x26')](_0x897d('0x28'),_0x24b36c,_0x4c0d04);_0x5574ed(_0x4c0d04);});});}function respondWithStatusCode(_0x13eb47,_0x1951c2){_0x1951c2=_0x1951c2||0xcc;return function(_0x589e85){if(_0x589e85){return _0x13eb47['sendStatus'](_0x1951c2);}return _0x13eb47[_0x897d('0x2b')](_0x1951c2)['end']();};}function respondWithResult(_0x1920d0,_0x5f2714){_0x5f2714=_0x5f2714||0xc8;return function(_0x3050db){if(_0x3050db){return _0x1920d0['status'](_0x5f2714)[_0x897d('0x2c')](_0x3050db);}};}function respondWithFilteredResult(_0xdf1911,_0x179064){return function(_0x1bbca0){if(_0x1bbca0){var _0x2427cb=_0x1bbca0[_0x897d('0x2d')],_0x9b7799=_0x179064['offset'],_0x34c9c4=_0x179064[_0x897d('0x2e')]+_0x179064[_0x897d('0x2f')],_0xd5573b;if(_0x34c9c4>=_0x2427cb){_0x34c9c4=_0x2427cb;_0xd5573b=0xc8;}else{_0xd5573b=0xce;}_0xdf1911[_0x897d('0x2b')](_0xd5573b);return _0xdf1911[_0x897d('0x30')]('Content-Range',_0x9b7799+'-'+_0x34c9c4+'/'+_0x2427cb)['json'](_0x1bbca0);}return null;};}function patchUpdates(_0x52857f){return function(_0x1bb034){try{jsonpatch['apply'](_0x1bb034,_0x52857f,!![]);}catch(_0x186ff8){return BPromise[_0x897d('0x31')](_0x186ff8);}return _0x1bb034['save']();};}function saveUpdates(_0x4a4828,_0x37cb2b){return function(_0x5d6ef2){if(_0x5d6ef2){return _0x5d6ef2[_0x897d('0x32')](_0x4a4828)[_0x897d('0x20')](function(_0x1a8611){return _0x1a8611;});}return null;};}function removeEntity(_0x2ef466,_0x1d7634){return function(_0x119052){if(_0x119052){return _0x119052['destroy']()[_0x897d('0x20')](function(){_0x2ef466[_0x897d('0x2b')](0xcc)[_0x897d('0x33')]();});}};}function handleEntityNotFound(_0x1548e1,_0x24c59d){return function(_0x3e328a){if(!_0x3e328a){_0x1548e1[_0x897d('0x34')](0x194);}return _0x3e328a;};}function handleError(_0x581294,_0x309edf){_0x309edf=_0x309edf||0x1f4;return function(_0x15e98b){logger['error'](_0x15e98b[_0x897d('0x35')]);if(_0x15e98b[_0x897d('0x36')]){delete _0x15e98b[_0x897d('0x36')];}_0x581294[_0x897d('0x2b')](_0x309edf)[_0x897d('0x37')](_0x15e98b);};}exports[_0x897d('0x38')]=function(_0x1435a8,_0x6b4cc8){var _0x13f27e={},_0x2d7a75={},_0x5346d8={'count':0x0,'rows':[]};var _0x566d44=_[_0x897d('0x39')](db[_0x897d('0x3a')][_0x897d('0x3b')],function(_0x16b1e5){return{'name':_0x16b1e5[_0x897d('0x3c')],'type':_0x16b1e5[_0x897d('0x3d')][_0x897d('0x3e')]};});_0x2d7a75[_0x897d('0x3f')]=_[_0x897d('0x39')](_0x566d44,_0x897d('0x36'));_0x2d7a75[_0x897d('0x40')]=_['keys'](_0x1435a8[_0x897d('0x40')]);_0x2d7a75['filters']=_['intersection'](_0x2d7a75[_0x897d('0x3f')],_0x2d7a75[_0x897d('0x40')]);_0x13f27e[_0x897d('0x41')]=_[_0x897d('0x42')](_0x2d7a75[_0x897d('0x3f')],qs['fields'](_0x1435a8[_0x897d('0x40')]['fields']));_0x13f27e[_0x897d('0x41')]=_0x13f27e[_0x897d('0x41')][_0x897d('0x43')]?_0x13f27e[_0x897d('0x41')]:_0x2d7a75['model'];if(!_0x1435a8[_0x897d('0x40')]['hasOwnProperty'](_0x897d('0x44'))){_0x13f27e[_0x897d('0x2f')]=qs[_0x897d('0x2f')](_0x1435a8[_0x897d('0x40')]['limit']);_0x13f27e[_0x897d('0x2e')]=qs[_0x897d('0x2e')](_0x1435a8[_0x897d('0x40')][_0x897d('0x2e')]);}_0x13f27e[_0x897d('0x45')]=qs['sort'](_0x1435a8[_0x897d('0x40')][_0x897d('0x46')]);_0x13f27e[_0x897d('0x47')]=qs[_0x897d('0x48')](_[_0x897d('0x49')](_0x1435a8['query'],_0x2d7a75[_0x897d('0x48')]),_0x566d44);if(_0x1435a8[_0x897d('0x40')][_0x897d('0x4a')]){_0x13f27e[_0x897d('0x47')]=_['merge'](_0x13f27e['where'],{'$or':_[_0x897d('0x39')](_0x566d44,function(_0x364f2b){if(_0x364f2b[_0x897d('0x3d')]!==_0x897d('0x4b')){var _0x1e4ab3={};_0x1e4ab3[_0x364f2b[_0x897d('0x36')]]={'$like':'%'+_0x1435a8[_0x897d('0x40')]['filter']+'%'};return _0x1e4ab3;}})});}_0x13f27e=_['merge']({},_0x13f27e,_0x1435a8[_0x897d('0x4c')]);var _0x1973be={'where':_0x13f27e[_0x897d('0x47')]};return db['FreshsalesAccount'][_0x897d('0x2d')](_0x1973be)[_0x897d('0x20')](function(_0x5230ff){_0x5346d8['count']=_0x5230ff;if(_0x1435a8[_0x897d('0x40')][_0x897d('0x4d')]){_0x13f27e[_0x897d('0x4e')]=[{'all':!![]}];}return db[_0x897d('0x3a')][_0x897d('0x4f')](_0x13f27e);})['then'](function(_0x4cd836){_0x5346d8['rows']=_0x4cd836;return _0x5346d8;})[_0x897d('0x20')](respondWithFilteredResult(_0x6b4cc8,_0x13f27e))[_0x897d('0x50')](handleError(_0x6b4cc8,null));};exports['show']=function(_0x1a1e3e,_0x24924e){var _0x164a42={'raw':![],'where':{'id':_0x1a1e3e[_0x897d('0x51')]['id']}},_0x4fec01={};_0x4fec01['model']=_[_0x897d('0x52')](db[_0x897d('0x3a')][_0x897d('0x3b')]);_0x4fec01[_0x897d('0x40')]=_[_0x897d('0x52')](_0x1a1e3e[_0x897d('0x40')]);_0x4fec01[_0x897d('0x48')]=_[_0x897d('0x42')](_0x4fec01[_0x897d('0x3f')],_0x4fec01[_0x897d('0x40')]);_0x164a42['attributes']=_['intersection'](_0x4fec01[_0x897d('0x3f')],qs[_0x897d('0x53')](_0x1a1e3e[_0x897d('0x40')][_0x897d('0x53')]));_0x164a42[_0x897d('0x41')]=_0x164a42[_0x897d('0x41')][_0x897d('0x43')]?_0x164a42['attributes']:_0x4fec01[_0x897d('0x3f')];if(_0x1a1e3e[_0x897d('0x40')]['includeAll']){_0x164a42[_0x897d('0x4e')]=[{'all':!![]}];}_0x164a42=_[_0x897d('0x54')]({},_0x164a42,_0x1a1e3e[_0x897d('0x4c')]);return db['FreshsalesAccount'][_0x897d('0x55')](_0x164a42)[_0x897d('0x20')](handleEntityNotFound(_0x24924e,null))[_0x897d('0x20')](respondWithResult(_0x24924e,null))[_0x897d('0x50')](handleError(_0x24924e,null));};exports['create']=function(_0x18d6a2,_0x4ba808){return db[_0x897d('0x3a')][_0x897d('0x56')](_0x18d6a2['body'],{})[_0x897d('0x20')](respondWithResult(_0x4ba808,0xc9))[_0x897d('0x50')](handleError(_0x4ba808,null));};exports['update']=function(_0xf84546,_0x386bfc){if(_0xf84546[_0x897d('0x57')]['id']){delete _0xf84546[_0x897d('0x57')]['id'];}return db[_0x897d('0x3a')][_0x897d('0x55')]({'where':{'id':_0xf84546[_0x897d('0x51')]['id']}})[_0x897d('0x20')](handleEntityNotFound(_0x386bfc,null))[_0x897d('0x20')](saveUpdates(_0xf84546[_0x897d('0x57')],null))[_0x897d('0x20')](respondWithResult(_0x386bfc,null))[_0x897d('0x50')](handleError(_0x386bfc,null));};exports[_0x897d('0x58')]=function(_0x454b35,_0x45aed2){return db[_0x897d('0x3a')][_0x897d('0x55')]({'where':{'id':_0x454b35['params']['id']}})[_0x897d('0x20')](handleEntityNotFound(_0x45aed2,null))[_0x897d('0x20')](removeEntity(_0x45aed2,null))[_0x897d('0x50')](handleError(_0x45aed2,null));};exports[_0x897d('0x59')]=function(_0x225708,_0x4c0841,_0x11e4a0){var _0x39a333={};var _0xdd9848={};var _0x15ffcc;var _0x25ce53;return db[_0x897d('0x3a')][_0x897d('0x5a')]({'where':{'id':_0x225708[_0x897d('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c0841,null))['then'](function(_0x41454d){if(_0x41454d){_0x15ffcc=_0x41454d;_0xdd9848['model']=_[_0x897d('0x52')](db[_0x897d('0x5b')]['rawAttributes']);_0xdd9848[_0x897d('0x40')]=_[_0x897d('0x52')](_0x225708[_0x897d('0x40')]);_0xdd9848['filters']=_['intersection'](_0xdd9848[_0x897d('0x3f')],_0xdd9848[_0x897d('0x40')]);_0x39a333[_0x897d('0x41')]=_[_0x897d('0x42')](_0xdd9848[_0x897d('0x3f')],qs['fields'](_0x225708[_0x897d('0x40')][_0x897d('0x53')]));_0x39a333[_0x897d('0x41')]=_0x39a333[_0x897d('0x41')][_0x897d('0x43')]?_0x39a333['attributes']:_0xdd9848['model'];_0x39a333[_0x897d('0x45')]=qs['sort'](_0x225708[_0x897d('0x40')][_0x897d('0x46')]);_0x39a333[_0x897d('0x47')]=qs[_0x897d('0x48')](_[_0x897d('0x49')](_0x225708[_0x897d('0x40')],_0xdd9848[_0x897d('0x48')]));if(_0x225708[_0x897d('0x40')][_0x897d('0x4a')]){_0x39a333[_0x897d('0x47')]=_[_0x897d('0x54')](_0x39a333['where'],{'$or':_['map'](_0x39a333[_0x897d('0x41')],function(_0x283c4d){var _0x327abc={};_0x327abc[_0x283c4d]={'$like':'%'+_0x225708[_0x897d('0x40')][_0x897d('0x4a')]+'%'};return _0x327abc;})});}_0x39a333=_[_0x897d('0x54')]({},_0x39a333,_0x225708[_0x897d('0x4c')]);return _0x15ffcc['getConfigurations'](_0x39a333);}})[_0x897d('0x20')](function(_0x1a79cf){if(_0x1a79cf){_0x25ce53=_0x1a79cf[_0x897d('0x43')];if(!_0x225708[_0x897d('0x40')][_0x897d('0x5c')](_0x897d('0x44'))){_0x39a333['limit']=qs['limit'](_0x225708['query'][_0x897d('0x2f')]);_0x39a333[_0x897d('0x2e')]=qs[_0x897d('0x2e')](_0x225708[_0x897d('0x40')][_0x897d('0x2e')]);}return _0x15ffcc[_0x897d('0x59')](_0x39a333);}})['then'](function(_0x43e214){if(_0x43e214){return _0x43e214?{'count':_0x25ce53,'rows':_0x43e214}:null;}})[_0x897d('0x20')](respondWithResult(_0x4c0841,null))[_0x897d('0x50')](handleError(_0x4c0841,null));};exports[_0x897d('0x5d')]=function(_0xa80b9b,_0x2cc83a,_0x424b96){if(_0xa80b9b[_0x897d('0x57')]['id']){delete _0xa80b9b[_0x897d('0x57')]['id'];}return db[_0x897d('0x3a')][_0x897d('0x5a')]({'where':{'id':_0xa80b9b[_0x897d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2cc83a,null))[_0x897d('0x20')](function(_0x669406){if(_0x669406){_0xa80b9b[_0x897d('0x57')][_0x897d('0x5e')]=_0x669406['id'];_0xa80b9b[_0x897d('0x57')][_0x897d('0x5f')]=integrations[_0x897d('0x60')](_0xa80b9b['body']['channel'],_0xa80b9b[_0x897d('0x57')][_0x897d('0x3d')]);_0xa80b9b[_0x897d('0x57')][_0x897d('0x61')]=integrations['getDescriptions'](_0xa80b9b['body'][_0x897d('0x62')],_0xa80b9b['body']['type']);return db[_0x897d('0x5b')]['create'](_0xa80b9b[_0x897d('0x57')],{'include':[{'model':db['FreshsalesField'],'as':_0x897d('0x5f')},{'model':db[_0x897d('0x63')],'as':'Descriptions'}]});}return null;})[_0x897d('0x20')](respondWithResult(_0x2cc83a,null))[_0x897d('0x50')](handleError(_0x2cc83a,null));};exports[_0x897d('0x64')]=function(_0x3084fb,_0x8f48c2,_0x5436f3){var _0x203151='';var _0x3c3fa5='';return db[_0x897d('0x3a')]['findOne']({'where':{'id':_0x3084fb[_0x897d('0x51')]['id']},'attributes':['id',_0x897d('0x65'),_0x897d('0x66'),'apiKey']})[_0x897d('0x20')](handleEntityNotFound(_0x8f48c2,null))[_0x897d('0x20')](function(_0x2bb0be){if(_0x2bb0be){_0x3c3fa5=_0x2bb0be['username'];_0x203151=_0x2bb0be['remoteUri'];var _0x58da62=_0x2bb0be[_0x897d('0x66')][_0x897d('0x67')](-0x1);if(_0x58da62==='/'){_0x203151=_0x203151[_0x897d('0x68')](0x0,_0x203151[_0x897d('0x69')](_0x58da62));}return rp({'method':'GET','uri':util[_0x897d('0x6a')](_0x897d('0x6b'),_0x203151,_0x897d('0x6c')),'headers':{'Authorization':_0x897d('0x6d')+_0x2bb0be[_0x897d('0x6e')]},'json':!![]});}})[_0x897d('0x20')](function(_0x17fcdb){if(_0x17fcdb){var _0x3ea16e=_0x17fcdb['users'];var _0x57ca61=![];var _0x305667=null;for(_0x305667=0x0;_0x305667<_0x3ea16e[_0x897d('0x43')];_0x305667++){if(_0x3ea16e[_0x305667][_0x897d('0x6f')]===_0x3c3fa5){_0x57ca61=!![];}}if(_0x57ca61){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x897d('0x70')});}}})[_0x897d('0x20')](respondWithResult(_0x8f48c2,null))[_0x897d('0x50')](function(_0xc20a78){var _0x510f74=_0x3084fb[_0x897d('0x40')][_0x897d('0x71')]?0x1f4:_0xc20a78[_0x897d('0x72')]||0x1f4;logger[_0x897d('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x897d('0x64'),_0x510f74,JSON[_0x897d('0x25')](_0xc20a78));delete _0xc20a78[_0x897d('0x36')];if(_0x510f74===0x191){_0x510f74=0x190;}_0x8f48c2[_0x897d('0x2b')](_0x510f74)['send'](_0x3084fb[_0x897d('0x40')][_0x897d('0x71')]?{'message':_0x897d('0x73'),'statusCode':_0xc20a78[_0x897d('0x72')]}:_0xc20a78);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2fa2c26..6850c7b 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 _0xd67b=['api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util'];(function(_0x27b5f1,_0x4830e7){var _0x3d485f=function(_0x5725a9){while(--_0x5725a9){_0x27b5f1['push'](_0x27b5f1['shift']());}};_0x3d485f(++_0x4830e7);}(_0xd67b,0x133));var _0xbd67=function(_0x47bcde,_0x255dad){_0x47bcde=_0x47bcde-0x0;var _0x35d587=_0xd67b[_0x47bcde];return _0x35d587;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xbd67('0x6'));module[_0xbd67('0x7')]=function(_0x2ad142,_0x27b016){return _0x2ad142[_0xbd67('0x8')](_0xbd67('0x9'),attributes,{'tableName':_0xbd67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5178=['rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x20605b,_0x1f5484){var _0x20d6f4=function(_0xc2bce){while(--_0xc2bce){_0x20605b['push'](_0x20605b['shift']());}};_0x20d6f4(++_0x1f5484);}(_0x5178,0x171));var _0x8517=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5178[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x8517('0x7'));module['exports']=function(_0x13ba05,_0x45498e){return _0x13ba05[_0x8517('0x8')](_0x8517('0x9'),attributes,{'tableName':_0x8517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 7ccab0a..02f197c 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 _0xa3e8=['result','catch','FreshsalesAccount','findAll','options','where','include','map','model','attributes','debug','GetFreshsalesAccount','ShowFreshsalesAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x58f4f7,_0x327ab1){var _0x20b1d3=function(_0x16ec37){while(--_0x16ec37){_0x58f4f7['push'](_0x58f4f7['shift']());}};_0x20b1d3(++_0x327ab1);}(_0xa3e8,0x127));var _0x8a3e=function(_0x71f24a,_0x2cd601){_0x71f24a=_0x71f24a-0x0;var _0x5cdc17=_0xa3e8[_0x71f24a];return _0x5cdc17;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var moment=require(_0x8a3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a3e('0x3'));var fs=require('fs');var Redis=require(_0x8a3e('0x4'));var db=require(_0x8a3e('0x5'))['db'];var utils=require(_0x8a3e('0x6'));var logger=require(_0x8a3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a3e('0x8')][_0x8a3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2052a8,_0x5a2a25,_0x27f08d){return new BPromise(function(_0x4c7f41,_0x437cde){return client[_0x8a3e('0xa')](_0x2052a8,_0x27f08d)[_0x8a3e('0xb')](function(_0x402a96){logger[_0x8a3e('0xc')](_0x8a3e('0xd'),_0x5a2a25,_0x8a3e('0xe'));logger['debug'](_0x8a3e('0xf'),_0x5a2a25,_0x8a3e('0xe'),JSON[_0x8a3e('0x10')](_0x402a96));if(_0x402a96['error']){if(_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x12')]===0x1f4){logger[_0x8a3e('0x11')](_0x8a3e('0xd'),_0x5a2a25,_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);return _0x437cde(_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);}logger[_0x8a3e('0x11')](_0x8a3e('0xd'),_0x5a2a25,_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);return _0x4c7f41(_0x402a96[_0x8a3e('0x11')]['message']);}else{logger[_0x8a3e('0xc')](_0x8a3e('0xd'),_0x5a2a25,_0x8a3e('0xe'));_0x4c7f41(_0x402a96[_0x8a3e('0x14')][_0x8a3e('0x13')]);}})[_0x8a3e('0x15')](function(_0x48e5a8){logger[_0x8a3e('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x5a2a25,_0x48e5a8);_0x437cde(_0x48e5a8);});});}exports['GetFreshsalesAccount']=function(_0x2f0b46){var _0xb2f9c3=this;return new Promise(function(_0xcb1a1f,_0xe36063){return db[_0x8a3e('0x16')][_0x8a3e('0x17')]({'raw':_0x2f0b46[_0x8a3e('0x18')]?_0x2f0b46[_0x8a3e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2f0b46[_0x8a3e('0x18')]?_0x2f0b46['options'][_0x8a3e('0x19')]||null:null,'attributes':_0x2f0b46[_0x8a3e('0x18')]?_0x2f0b46[_0x8a3e('0x18')]['attributes']||null:null,'limit':_0x2f0b46[_0x8a3e('0x18')]?_0x2f0b46[_0x8a3e('0x18')]['limit']||null:null,'include':_0x2f0b46[_0x8a3e('0x18')]?_0x2f0b46[_0x8a3e('0x18')][_0x8a3e('0x1a')]?_[_0x8a3e('0x1b')](_0x2f0b46[_0x8a3e('0x18')][_0x8a3e('0x1a')],function(_0x2bb49e){return{'model':db[_0x2bb49e[_0x8a3e('0x1c')]],'as':_0x2bb49e['as'],'attributes':_0x2bb49e[_0x8a3e('0x1d')],'include':_0x2bb49e[_0x8a3e('0x1a')]?_[_0x8a3e('0x1b')](_0x2bb49e[_0x8a3e('0x1a')],function(_0x489015){return{'model':db[_0x489015[_0x8a3e('0x1c')]],'as':_0x489015['as'],'attributes':_0x489015['attributes'],'include':_0x489015[_0x8a3e('0x1a')]?_['map'](_0x489015[_0x8a3e('0x1a')],function(_0x3e0cdb){return{'model':db[_0x3e0cdb[_0x8a3e('0x1c')]],'as':_0x3e0cdb['as'],'attributes':_0x3e0cdb[_0x8a3e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8a3e('0xb')](function(_0x15c3ef){logger[_0x8a3e('0xc')]('GetFreshsalesAccount',_0x2f0b46);logger[_0x8a3e('0x1e')](_0x8a3e('0x1f'),_0x2f0b46,JSON[_0x8a3e('0x10')](_0x15c3ef));_0xcb1a1f(_0x15c3ef);})[_0x8a3e('0x15')](function(_0x459309){logger[_0x8a3e('0x11')](_0x8a3e('0x1f'),_0x459309['message'],_0x2f0b46);_0xe36063(_0xb2f9c3[_0x8a3e('0x11')](0x1f4,_0x459309[_0x8a3e('0x13')]));});});};exports[_0x8a3e('0x20')]=function(_0xb21ef){var _0x9587fd=this;return new Promise(function(_0x2ef24a,_0x35ec0f){return db[_0x8a3e('0x16')][_0x8a3e('0x21')]({'raw':_0xb21ef[_0x8a3e('0x18')]?_0xb21ef[_0x8a3e('0x18')][_0x8a3e('0x22')]===undefined?!![]:![]:!![],'where':_0xb21ef[_0x8a3e('0x18')]?_0xb21ef[_0x8a3e('0x18')][_0x8a3e('0x19')]||null:null,'attributes':_0xb21ef['options']?_0xb21ef['options']['attributes']||null:null,'include':_0xb21ef[_0x8a3e('0x18')]?_0xb21ef[_0x8a3e('0x18')]['include']?_['map'](_0xb21ef[_0x8a3e('0x18')]['include'],function(_0x5aef1a){return{'model':db[_0x5aef1a[_0x8a3e('0x1c')]],'as':_0x5aef1a['as'],'attributes':_0x5aef1a[_0x8a3e('0x1d')],'include':_0x5aef1a[_0x8a3e('0x1a')]?_[_0x8a3e('0x1b')](_0x5aef1a[_0x8a3e('0x1a')],function(_0x48dc8c){return{'model':db[_0x48dc8c[_0x8a3e('0x1c')]],'as':_0x48dc8c['as'],'attributes':_0x48dc8c[_0x8a3e('0x1d')],'include':_0x48dc8c['include']?_[_0x8a3e('0x1b')](_0x48dc8c['include'],function(_0x8db886){return{'model':db[_0x8db886[_0x8a3e('0x1c')]],'as':_0x8db886['as'],'attributes':_0x8db886[_0x8a3e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8a3e('0xb')](function(_0x235ce4){logger[_0x8a3e('0xc')](_0x8a3e('0x20'),_0xb21ef);logger[_0x8a3e('0x1e')]('ShowFreshsalesAccount',_0xb21ef,JSON[_0x8a3e('0x10')](_0x235ce4));_0x2ef24a(_0x235ce4);})[_0x8a3e('0x15')](function(_0xd94665){logger[_0x8a3e('0x11')](_0x8a3e('0x20'),_0xd94665[_0x8a3e('0x13')],_0xb21ef);_0x35ec0f(_0x9587fd['error'](0x1f4,_0xd94665[_0x8a3e('0x13')]));});});}; \ No newline at end of file +var _0xf963=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','map','include','model','attributes','then','info','find','ShowFreshsalesAccount','lodash','bluebird','randomstring'];(function(_0x5660d9,_0x42b506){var _0x28bcba=function(_0x38ae1e){while(--_0x38ae1e){_0x5660d9['push'](_0x5660d9['shift']());}};_0x28bcba(++_0x42b506);}(_0xf963,0x11d));var _0x3f96=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf963[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f96('0x1'));var rs=require(_0x3f96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f96('0x3'));var logger=require(_0x3f96('0x4'))(_0x3f96('0x5'));var config=require(_0x3f96('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3f96('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fa84a,_0x43633b,_0x422ffd){return new BPromise(function(_0x478a28,_0x14e2af){return client[_0x3f96('0x8')](_0x1fa84a,_0x422ffd)['then'](function(_0x50a3bf){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x43633b,_0x3f96('0x9'));logger[_0x3f96('0xa')](_0x3f96('0xb'),_0x43633b,_0x3f96('0x9'),JSON[_0x3f96('0xc')](_0x50a3bf));if(_0x50a3bf['error']){if(_0x50a3bf[_0x3f96('0xd')][_0x3f96('0xe')]===0x1f4){logger[_0x3f96('0xd')](_0x3f96('0xf'),_0x43633b,_0x50a3bf['error'][_0x3f96('0x10')]);return _0x14e2af(_0x50a3bf['error'][_0x3f96('0x10')]);}logger[_0x3f96('0xd')](_0x3f96('0xf'),_0x43633b,_0x50a3bf['error'][_0x3f96('0x10')]);return _0x478a28(_0x50a3bf['error'][_0x3f96('0x10')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x43633b,'request\x20sent');_0x478a28(_0x50a3bf[_0x3f96('0x11')][_0x3f96('0x10')]);}})[_0x3f96('0x12')](function(_0x71cde7){logger['error'](_0x3f96('0xf'),_0x43633b,_0x71cde7);_0x14e2af(_0x71cde7);});});}exports[_0x3f96('0x13')]=function(_0x36de2a){var _0x4ffc54=this;return new Promise(function(_0x239a9d,_0x1ae655){return db[_0x3f96('0x14')]['findAll']({'raw':_0x36de2a[_0x3f96('0x15')]?_0x36de2a[_0x3f96('0x15')][_0x3f96('0x16')]===undefined?!![]:![]:!![],'where':_0x36de2a[_0x3f96('0x15')]?_0x36de2a[_0x3f96('0x15')][_0x3f96('0x17')]||null:null,'attributes':_0x36de2a['options']?_0x36de2a[_0x3f96('0x15')]['attributes']||null:null,'limit':_0x36de2a[_0x3f96('0x15')]?_0x36de2a[_0x3f96('0x15')]['limit']||null:null,'include':_0x36de2a[_0x3f96('0x15')]?_0x36de2a[_0x3f96('0x15')]['include']?_[_0x3f96('0x18')](_0x36de2a[_0x3f96('0x15')][_0x3f96('0x19')],function(_0x2e6f30){return{'model':db[_0x2e6f30[_0x3f96('0x1a')]],'as':_0x2e6f30['as'],'attributes':_0x2e6f30[_0x3f96('0x1b')],'include':_0x2e6f30[_0x3f96('0x19')]?_['map'](_0x2e6f30['include'],function(_0x39cccc){return{'model':db[_0x39cccc['model']],'as':_0x39cccc['as'],'attributes':_0x39cccc['attributes'],'include':_0x39cccc[_0x3f96('0x19')]?_['map'](_0x39cccc[_0x3f96('0x19')],function(_0x5d0c7a){return{'model':db[_0x5d0c7a[_0x3f96('0x1a')]],'as':_0x5d0c7a['as'],'attributes':_0x5d0c7a[_0x3f96('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3f96('0x1c')](function(_0x3cba14){logger[_0x3f96('0x1d')](_0x3f96('0x13'),_0x36de2a);logger['debug'](_0x3f96('0x13'),_0x36de2a,JSON[_0x3f96('0xc')](_0x3cba14));_0x239a9d(_0x3cba14);})['catch'](function(_0xcac1b){logger[_0x3f96('0xd')]('GetFreshsalesAccount',_0xcac1b[_0x3f96('0x10')],_0x36de2a);_0x1ae655(_0x4ffc54['error'](0x1f4,_0xcac1b[_0x3f96('0x10')]));});});};exports['ShowFreshsalesAccount']=function(_0xdf260b){var _0x4646d8=this;return new Promise(function(_0x10035a,_0xa2b132){return db[_0x3f96('0x14')][_0x3f96('0x1e')]({'raw':_0xdf260b[_0x3f96('0x15')]?_0xdf260b[_0x3f96('0x15')][_0x3f96('0x16')]===undefined?!![]:![]:!![],'where':_0xdf260b[_0x3f96('0x15')]?_0xdf260b[_0x3f96('0x15')][_0x3f96('0x17')]||null:null,'attributes':_0xdf260b[_0x3f96('0x15')]?_0xdf260b['options']['attributes']||null:null,'include':_0xdf260b[_0x3f96('0x15')]?_0xdf260b['options'][_0x3f96('0x19')]?_[_0x3f96('0x18')](_0xdf260b['options'][_0x3f96('0x19')],function(_0x4b33b5){return{'model':db[_0x4b33b5[_0x3f96('0x1a')]],'as':_0x4b33b5['as'],'attributes':_0x4b33b5['attributes'],'include':_0x4b33b5[_0x3f96('0x19')]?_[_0x3f96('0x18')](_0x4b33b5['include'],function(_0xe791a3){return{'model':db[_0xe791a3['model']],'as':_0xe791a3['as'],'attributes':_0xe791a3[_0x3f96('0x1b')],'include':_0xe791a3['include']?_[_0x3f96('0x18')](_0xe791a3[_0x3f96('0x19')],function(_0x21d23e){return{'model':db[_0x21d23e[_0x3f96('0x1a')]],'as':_0x21d23e['as'],'attributes':_0x21d23e[_0x3f96('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x372dbc){logger[_0x3f96('0x1d')](_0x3f96('0x1f'),_0xdf260b);logger[_0x3f96('0xa')](_0x3f96('0x1f'),_0xdf260b,JSON[_0x3f96('0xc')](_0x372dbc));_0x10035a(_0x372dbc);})['catch'](function(_0x212e0a){logger[_0x3f96('0xd')]('ShowFreshsalesAccount',_0x212e0a[_0x3f96('0x10')],_0xdf260b);_0xa2b132(_0x4646d8[_0x3f96('0xd')](0x1f4,_0x212e0a[_0x3f96('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index bdde8f5..754053a 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 _0x1cd6=['create','/:id','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post'];(function(_0x1c2ee2,_0x32ff20){var _0x202ff9=function(_0x55ca0d){while(--_0x55ca0d){_0x1c2ee2['push'](_0x1c2ee2['shift']());}};_0x202ff9(++_0x32ff20);}(_0x1cd6,0x9c));var _0x61cd=function(_0xe645d5,_0x4e9b6d){_0xe645d5=_0xe645d5-0x0;var _0x482f65=_0x1cd6[_0xe645d5];return _0x482f65;};'use strict';var multer=require(_0x61cd('0x0'));var util=require(_0x61cd('0x1'));var path=require('path');var timeout=require(_0x61cd('0x2'));var express=require('express');var router=express[_0x61cd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x61cd('0x4'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x61cd('0x5')]('/',auth[_0x61cd('0x6')](),controller[_0x61cd('0x7')]);router[_0x61cd('0x5')]('/:id',auth[_0x61cd('0x6')](),controller[_0x61cd('0x8')]);router['get'](_0x61cd('0x9'),auth[_0x61cd('0x6')](),controller[_0x61cd('0xa')]);router[_0x61cd('0x5')](_0x61cd('0xb'),auth[_0x61cd('0x6')](),controller[_0x61cd('0xc')]);router[_0x61cd('0x5')](_0x61cd('0xd'),auth[_0x61cd('0x6')](),controller['getFields']);router[_0x61cd('0xe')]('/',auth['isAuthenticated'](),controller[_0x61cd('0xf')]);router['put'](_0x61cd('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x61cd('0x11')](_0x61cd('0x10'),auth[_0x61cd('0x6')](),controller[_0x61cd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x103d=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','/:id','show','get','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','delete'];(function(_0x44d5c1,_0x1aae23){var _0x48ea86=function(_0x30f6dc){while(--_0x30f6dc){_0x44d5c1['push'](_0x44d5c1['shift']());}};_0x48ea86(++_0x1aae23);}(_0x103d,0x17e));var _0xd103=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x103d[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0xd103('0x0'));var util=require(_0xd103('0x1'));var path=require(_0xd103('0x2'));var timeout=require(_0xd103('0x3'));var express=require('express');var router=express[_0xd103('0x4')]();var auth=require(_0xd103('0x5'));var interaction=require(_0xd103('0x6'));var config=require('../../config/environment');var controller=require(_0xd103('0x7'));router['get']('/',auth[_0xd103('0x8')](),controller['index']);router['get'](_0xd103('0x9'),auth[_0xd103('0x8')](),controller[_0xd103('0xa')]);router[_0xd103('0xb')](_0xd103('0xc'),auth[_0xd103('0x8')](),controller['getSubjects']);router[_0xd103('0xb')](_0xd103('0xd'),auth['isAuthenticated'](),controller[_0xd103('0xe')]);router['get'](_0xd103('0xf'),auth[_0xd103('0x8')](),controller['getFields']);router['post']('/',auth[_0xd103('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd103('0x10')](_0xd103('0x9'),auth[_0xd103('0x8')](),controller[_0xd103('0x11')]);module[_0xd103('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b1f00f3..2c929b8 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 _0x87f9=['exports','STRING'];(function(_0xe03448,_0x5b41f5){var _0x441dbc=function(_0x45a679){while(--_0x45a679){_0xe03448['push'](_0xe03448['shift']());}};_0x441dbc(++_0x5b41f5);}(_0x87f9,0x130));var _0x987f=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x87f9[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0x987f('0x0')]={'name':{'type':Sequelize[_0x987f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb0ee=['sequelize','STRING'];(function(_0x38090f,_0x4d8b9d){var _0x525d06=function(_0x3d79f6){while(--_0x3d79f6){_0x38090f['push'](_0x38090f['shift']());}};_0x525d06(++_0x4d8b9d);}(_0xb0ee,0xee));var _0xeb0e=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xb0ee[_0x2f45ea];return _0x485a84;};'use strict';var Sequelize=require(_0xeb0e('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb0e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 40e0165..fd06b9d 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 _0xe8a0=['../../config/utils','../../config/environment','../../mysqldb','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','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','destroy','stack','name','send','index','map','FreshsalesConfiguration','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4b2d97,_0x4dd360){var _0x53d33e=function(_0x4acb97){while(--_0x4acb97){_0x4b2d97['push'](_0x4b2d97['shift']());}};_0x53d33e(++_0x4dd360);}(_0xe8a0,0x1c0));var _0x0e8a=function(_0x2defde,_0x5609ee){_0x2defde=_0x2defde-0x0;var _0x1b9cac=_0xe8a0[_0x2defde];return _0x1b9cac;};'use strict';var pdf=require(_0x0e8a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e8a('0x1'));var zipdir=require(_0x0e8a('0x2'));var jsonpatch=require(_0x0e8a('0x3'));var rp=require(_0x0e8a('0x4'));var moment=require(_0x0e8a('0x5'));var BPromise=require(_0x0e8a('0x6'));var Mustache=require(_0x0e8a('0x7'));var util=require(_0x0e8a('0x8'));var path=require('path');var sox=require(_0x0e8a('0x9'));var csv=require(_0x0e8a('0xa'));var ejs=require(_0x0e8a('0xb'));var fs=require('fs');var _=require(_0x0e8a('0xc'));var squel=require(_0x0e8a('0xd'));var crypto=require(_0x0e8a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0e8a('0xa'));var querystring=require(_0x0e8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x0e8a('0x10'));var authService=require(_0x0e8a('0x11'));var qs=require(_0x0e8a('0x12'));var as=require(_0x0e8a('0x13'));var hardwareService=require(_0x0e8a('0x14'));var logger=require(_0x0e8a('0x15'))('api');var utils=require(_0x0e8a('0x16'));var config=require(_0x0e8a('0x17'));var db=require(_0x0e8a('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0e8a('0x19')][_0x0e8a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x33450b,_0x12b3f2,_0x52b9f2){if(_0x52b9f2){var _0x26a990=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26a990[_0x0e8a('0x1b')](_0x12b3f2)){return _0x33450b;}else{throw new db[(_0x0e8a('0x1c'))][(_0x0e8a('0x1d'))](_0x0e8a('0x1e'));}}else{return _0x33450b;}}function respondWithRpcPromise(_0x4f422a,_0x582e42,_0x9e93bc,_0x2300b7){return new BPromise(function(_0x12b026,_0x1b22ee){var _0x488ede=_0x2300b7||client;return _0x488ede['request'](_0x4f422a,_0x9e93bc)[_0x0e8a('0x1f')](function(_0x4e0b13){logger[_0x0e8a('0x20')](_0x0e8a('0x21'),_0x582e42,_0x0e8a('0x22'));logger[_0x0e8a('0x23')](_0x0e8a('0x24'),_0x582e42,_0x0e8a('0x22'),JSON[_0x0e8a('0x25')](_0x4e0b13));if(_0x4e0b13['error']){if(_0x4e0b13['error'][_0x0e8a('0x26')]===0x1f4){logger[_0x0e8a('0x27')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x582e42,_0x4e0b13[_0x0e8a('0x27')]['message']);return _0x1b22ee(_0x4e0b13['error']['message']);}logger[_0x0e8a('0x27')](_0x0e8a('0x21'),_0x582e42,_0x4e0b13[_0x0e8a('0x27')][_0x0e8a('0x28')]);return _0x12b026(_0x4e0b13[_0x0e8a('0x27')]['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x582e42,_0x0e8a('0x22'));_0x12b026(_0x4e0b13[_0x0e8a('0x29')][_0x0e8a('0x28')]);}})['catch'](function(_0x5d71ed){logger['error'](_0x0e8a('0x21'),_0x582e42,_0x5d71ed);_0x1b22ee(_0x5d71ed);});});}function respondWithStatusCode(_0x39539c,_0x5216fa){_0x5216fa=_0x5216fa||0xcc;return function(_0x10d939){if(_0x10d939){return _0x39539c[_0x0e8a('0x2a')](_0x5216fa);}return _0x39539c[_0x0e8a('0x2b')](_0x5216fa)[_0x0e8a('0x2c')]();};}function respondWithResult(_0x52efa0,_0x76c139){_0x76c139=_0x76c139||0xc8;return function(_0x33b98c){if(_0x33b98c){return _0x52efa0['status'](_0x76c139)[_0x0e8a('0x2d')](_0x33b98c);}};}function respondWithFilteredResult(_0x49f9c9,_0xd94ee4){return function(_0xc86e59){if(_0xc86e59){var _0x24d0a3=_0xc86e59[_0x0e8a('0x2e')],_0x44405b=_0xd94ee4[_0x0e8a('0x2f')],_0xe1d164=_0xd94ee4['offset']+_0xd94ee4[_0x0e8a('0x30')],_0x5b8046;if(_0xe1d164>=_0x24d0a3){_0xe1d164=_0x24d0a3;_0x5b8046=0xc8;}else{_0x5b8046=0xce;}_0x49f9c9[_0x0e8a('0x2b')](_0x5b8046);return _0x49f9c9[_0x0e8a('0x31')](_0x0e8a('0x32'),_0x44405b+'-'+_0xe1d164+'/'+_0x24d0a3)[_0x0e8a('0x2d')](_0xc86e59);}return null;};}function patchUpdates(_0x12a95c){return function(_0x2d69a5){try{jsonpatch['apply'](_0x2d69a5,_0x12a95c,!![]);}catch(_0x526af4){return BPromise['reject'](_0x526af4);}return _0x2d69a5['save']();};}function saveUpdates(_0x4bae09,_0x99cc68){return function(_0x189a37){if(_0x189a37){return _0x189a37['update'](_0x4bae09)[_0x0e8a('0x1f')](function(_0x9c9b4c){return _0x9c9b4c;});}return null;};}function removeEntity(_0x33a49c,_0x16be70){return function(_0x55390b){if(_0x55390b){return _0x55390b[_0x0e8a('0x33')]()[_0x0e8a('0x1f')](function(){_0x33a49c['status'](0xcc)[_0x0e8a('0x2c')]();});}};}function handleEntityNotFound(_0x433b9a,_0x1b1262){return function(_0x50d922){if(!_0x50d922){_0x433b9a[_0x0e8a('0x2a')](0x194);}return _0x50d922;};}function handleError(_0x38d786,_0x53985d){_0x53985d=_0x53985d||0x1f4;return function(_0x38f2fe){logger[_0x0e8a('0x27')](_0x38f2fe[_0x0e8a('0x34')]);if(_0x38f2fe[_0x0e8a('0x35')]){delete _0x38f2fe[_0x0e8a('0x35')];}_0x38d786[_0x0e8a('0x2b')](_0x53985d)[_0x0e8a('0x36')](_0x38f2fe);};}exports[_0x0e8a('0x37')]=function(_0x1c07ea,_0x32a5ec){var _0x553c12={},_0x159bcf={},_0x5b5abd={'count':0x0,'rows':[]};var _0x39ad26=_[_0x0e8a('0x38')](db[_0x0e8a('0x39')]['rawAttributes'],function(_0x4fdec8){return{'name':_0x4fdec8[_0x0e8a('0x3a')],'type':_0x4fdec8['type']['key']};});_0x159bcf[_0x0e8a('0x3b')]=_[_0x0e8a('0x38')](_0x39ad26,_0x0e8a('0x35'));_0x159bcf['query']=_[_0x0e8a('0x3c')](_0x1c07ea[_0x0e8a('0x3d')]);_0x159bcf[_0x0e8a('0x3e')]=_[_0x0e8a('0x3f')](_0x159bcf[_0x0e8a('0x3b')],_0x159bcf['query']);_0x553c12[_0x0e8a('0x40')]=_[_0x0e8a('0x3f')](_0x159bcf[_0x0e8a('0x3b')],qs['fields'](_0x1c07ea['query'][_0x0e8a('0x41')]));_0x553c12['attributes']=_0x553c12[_0x0e8a('0x40')][_0x0e8a('0x42')]?_0x553c12[_0x0e8a('0x40')]:_0x159bcf[_0x0e8a('0x3b')];if(!_0x1c07ea[_0x0e8a('0x3d')][_0x0e8a('0x43')](_0x0e8a('0x44'))){_0x553c12['limit']=qs[_0x0e8a('0x30')](_0x1c07ea[_0x0e8a('0x3d')][_0x0e8a('0x30')]);_0x553c12['offset']=qs['offset'](_0x1c07ea[_0x0e8a('0x3d')][_0x0e8a('0x2f')]);}_0x553c12['order']=qs[_0x0e8a('0x45')](_0x1c07ea[_0x0e8a('0x3d')][_0x0e8a('0x45')]);_0x553c12[_0x0e8a('0x46')]=qs['filters'](_[_0x0e8a('0x47')](_0x1c07ea[_0x0e8a('0x3d')],_0x159bcf[_0x0e8a('0x3e')]),_0x39ad26);if(_0x1c07ea['query'][_0x0e8a('0x48')]){_0x553c12['where']=_[_0x0e8a('0x49')](_0x553c12['where'],{'$or':_[_0x0e8a('0x38')](_0x39ad26,function(_0x388c60){if(_0x388c60[_0x0e8a('0x4a')]!==_0x0e8a('0x4b')){var _0x5320b7={};_0x5320b7[_0x388c60[_0x0e8a('0x35')]]={'$like':'%'+_0x1c07ea[_0x0e8a('0x3d')][_0x0e8a('0x48')]+'%'};return _0x5320b7;}})});}_0x553c12=_['merge']({},_0x553c12,_0x1c07ea[_0x0e8a('0x4c')]);var _0x146d4f={'where':_0x553c12[_0x0e8a('0x46')]};return db[_0x0e8a('0x39')][_0x0e8a('0x2e')](_0x146d4f)[_0x0e8a('0x1f')](function(_0x28f150){_0x5b5abd[_0x0e8a('0x2e')]=_0x28f150;if(_0x1c07ea['query'][_0x0e8a('0x4d')]){_0x553c12[_0x0e8a('0x4e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x0e8a('0x4f')](_0x553c12);})[_0x0e8a('0x1f')](function(_0x50f375){_0x5b5abd[_0x0e8a('0x50')]=_0x50f375;return _0x5b5abd;})[_0x0e8a('0x1f')](respondWithFilteredResult(_0x32a5ec,_0x553c12))[_0x0e8a('0x51')](handleError(_0x32a5ec,null));};exports[_0x0e8a('0x52')]=function(_0x4b9584,_0x24be87){var _0x56a6ee={'raw':![],'where':{'id':_0x4b9584[_0x0e8a('0x53')]['id']}},_0x46b7c9={};_0x46b7c9[_0x0e8a('0x3b')]=_[_0x0e8a('0x3c')](db[_0x0e8a('0x39')][_0x0e8a('0x54')]);_0x46b7c9['query']=_[_0x0e8a('0x3c')](_0x4b9584['query']);_0x46b7c9[_0x0e8a('0x3e')]=_[_0x0e8a('0x3f')](_0x46b7c9[_0x0e8a('0x3b')],_0x46b7c9[_0x0e8a('0x3d')]);_0x56a6ee['attributes']=_[_0x0e8a('0x3f')](_0x46b7c9[_0x0e8a('0x3b')],qs[_0x0e8a('0x41')](_0x4b9584['query'][_0x0e8a('0x41')]));_0x56a6ee['attributes']=_0x56a6ee[_0x0e8a('0x40')]['length']?_0x56a6ee[_0x0e8a('0x40')]:_0x46b7c9[_0x0e8a('0x3b')];if(_0x4b9584[_0x0e8a('0x3d')]['includeAll']){_0x56a6ee[_0x0e8a('0x4e')]=[{'all':!![]}];}_0x56a6ee=_[_0x0e8a('0x49')]({},_0x56a6ee,_0x4b9584[_0x0e8a('0x4c')]);return db[_0x0e8a('0x39')][_0x0e8a('0x55')](_0x56a6ee)[_0x0e8a('0x1f')](handleEntityNotFound(_0x24be87,null))[_0x0e8a('0x1f')](respondWithResult(_0x24be87,null))['catch'](handleError(_0x24be87,null));};exports[_0x0e8a('0x56')]=function(_0x37747e,_0x1ce014){return db[_0x0e8a('0x39')][_0x0e8a('0x56')](_0x37747e['body'],{})['then'](respondWithResult(_0x1ce014,0xc9))[_0x0e8a('0x51')](handleError(_0x1ce014,null));};exports['update']=function(_0x1472b7,_0x431926){if(_0x1472b7[_0x0e8a('0x57')]['id']){delete _0x1472b7[_0x0e8a('0x57')]['id'];}return db[_0x0e8a('0x39')][_0x0e8a('0x55')]({'where':{'id':_0x1472b7[_0x0e8a('0x53')]['id']}})[_0x0e8a('0x1f')](handleEntityNotFound(_0x431926,null))[_0x0e8a('0x1f')](saveUpdates(_0x1472b7[_0x0e8a('0x57')],null))['then'](respondWithResult(_0x431926,null))[_0x0e8a('0x51')](handleError(_0x431926,null));};exports['destroy']=function(_0x3425ce,_0x3f361e){return db[_0x0e8a('0x39')]['find']({'where':{'id':_0x3425ce['params']['id']}})[_0x0e8a('0x1f')](handleEntityNotFound(_0x3f361e,null))[_0x0e8a('0x1f')](removeEntity(_0x3f361e,null))['catch'](handleError(_0x3f361e,null));};exports[_0x0e8a('0x58')]=function(_0x55811e,_0x166d3e,_0x26198c){var _0x120254={};var _0xf068a6={};var _0x2ee37c;var _0x4868a5;return db[_0x0e8a('0x39')][_0x0e8a('0x59')]({'where':{'id':_0x55811e['params']['id']}})[_0x0e8a('0x1f')](handleEntityNotFound(_0x166d3e,null))[_0x0e8a('0x1f')](function(_0x1f0c59){if(_0x1f0c59){_0x2ee37c=_0x1f0c59;_0xf068a6[_0x0e8a('0x3b')]=_['keys'](db['FreshsalesField'][_0x0e8a('0x54')]);_0xf068a6[_0x0e8a('0x3d')]=_['keys'](_0x55811e[_0x0e8a('0x3d')]);_0xf068a6['filters']=_[_0x0e8a('0x3f')](_0xf068a6['model'],_0xf068a6['query']);_0x120254[_0x0e8a('0x40')]=_[_0x0e8a('0x3f')](_0xf068a6[_0x0e8a('0x3b')],qs[_0x0e8a('0x41')](_0x55811e[_0x0e8a('0x3d')]['fields']));_0x120254[_0x0e8a('0x40')]=_0x120254['attributes'][_0x0e8a('0x42')]?_0x120254[_0x0e8a('0x40')]:_0xf068a6['model'];_0x120254['order']=qs[_0x0e8a('0x45')](_0x55811e[_0x0e8a('0x3d')][_0x0e8a('0x45')]);_0x120254['where']=qs['filters'](_['pick'](_0x55811e['query'],_0xf068a6[_0x0e8a('0x3e')]));if(_0x55811e[_0x0e8a('0x3d')][_0x0e8a('0x48')]){_0x120254[_0x0e8a('0x46')]=_['merge'](_0x120254[_0x0e8a('0x46')],{'$or':_[_0x0e8a('0x38')](_0x120254['attributes'],function(_0x2e89b9){var _0x80b211={};_0x80b211[_0x2e89b9]={'$like':'%'+_0x55811e[_0x0e8a('0x3d')]['filter']+'%'};return _0x80b211;})});}_0x120254=_[_0x0e8a('0x49')]({},_0x120254,_0x55811e[_0x0e8a('0x4c')]);return _0x2ee37c[_0x0e8a('0x58')](_0x120254);}})[_0x0e8a('0x1f')](function(_0x3ed004){if(_0x3ed004){_0x4868a5=_0x3ed004[_0x0e8a('0x42')];if(!_0x55811e[_0x0e8a('0x3d')][_0x0e8a('0x43')](_0x0e8a('0x44'))){_0x120254['limit']=qs[_0x0e8a('0x30')](_0x55811e[_0x0e8a('0x3d')][_0x0e8a('0x30')]);_0x120254[_0x0e8a('0x2f')]=qs['offset'](_0x55811e[_0x0e8a('0x3d')][_0x0e8a('0x2f')]);}return _0x2ee37c['getSubjects'](_0x120254);}})[_0x0e8a('0x1f')](function(_0x1aebb7){if(_0x1aebb7){return _0x1aebb7?{'count':_0x4868a5,'rows':_0x1aebb7}:null;}})[_0x0e8a('0x1f')](respondWithResult(_0x166d3e,null))[_0x0e8a('0x51')](handleError(_0x166d3e,null));};exports[_0x0e8a('0x5a')]=function(_0x2ce99c,_0x2941f9,_0x58e8d1){var _0x24ce9b={};var _0x851cba={};var _0x100cc1;var _0x2bcd0;return db[_0x0e8a('0x39')][_0x0e8a('0x59')]({'where':{'id':_0x2ce99c[_0x0e8a('0x53')]['id']}})['then'](handleEntityNotFound(_0x2941f9,null))[_0x0e8a('0x1f')](function(_0x1030a3){if(_0x1030a3){_0x100cc1=_0x1030a3;_0x851cba[_0x0e8a('0x3b')]=_[_0x0e8a('0x3c')](db[_0x0e8a('0x5b')][_0x0e8a('0x54')]);_0x851cba[_0x0e8a('0x3d')]=_[_0x0e8a('0x3c')](_0x2ce99c[_0x0e8a('0x3d')]);_0x851cba[_0x0e8a('0x3e')]=_[_0x0e8a('0x3f')](_0x851cba[_0x0e8a('0x3b')],_0x851cba[_0x0e8a('0x3d')]);_0x24ce9b[_0x0e8a('0x40')]=_[_0x0e8a('0x3f')](_0x851cba[_0x0e8a('0x3b')],qs['fields'](_0x2ce99c['query'][_0x0e8a('0x41')]));_0x24ce9b['attributes']=_0x24ce9b[_0x0e8a('0x40')][_0x0e8a('0x42')]?_0x24ce9b[_0x0e8a('0x40')]:_0x851cba[_0x0e8a('0x3b')];_0x24ce9b['order']=qs['sort'](_0x2ce99c['query'][_0x0e8a('0x45')]);_0x24ce9b[_0x0e8a('0x46')]=qs[_0x0e8a('0x3e')](_[_0x0e8a('0x47')](_0x2ce99c[_0x0e8a('0x3d')],_0x851cba[_0x0e8a('0x3e')]));if(_0x2ce99c[_0x0e8a('0x3d')][_0x0e8a('0x48')]){_0x24ce9b['where']=_[_0x0e8a('0x49')](_0x24ce9b[_0x0e8a('0x46')],{'$or':_[_0x0e8a('0x38')](_0x24ce9b[_0x0e8a('0x40')],function(_0xb3b921){var _0x3f711d={};_0x3f711d[_0xb3b921]={'$like':'%'+_0x2ce99c['query'][_0x0e8a('0x48')]+'%'};return _0x3f711d;})});}_0x24ce9b=_[_0x0e8a('0x49')]({},_0x24ce9b,_0x2ce99c[_0x0e8a('0x4c')]);return _0x100cc1[_0x0e8a('0x5a')](_0x24ce9b);}})[_0x0e8a('0x1f')](function(_0x5c6387){if(_0x5c6387){_0x2bcd0=_0x5c6387['length'];if(!_0x2ce99c[_0x0e8a('0x3d')][_0x0e8a('0x43')](_0x0e8a('0x44'))){_0x24ce9b[_0x0e8a('0x30')]=qs[_0x0e8a('0x30')](_0x2ce99c['query'][_0x0e8a('0x30')]);_0x24ce9b[_0x0e8a('0x2f')]=qs['offset'](_0x2ce99c[_0x0e8a('0x3d')][_0x0e8a('0x2f')]);}return _0x100cc1['getDescriptions'](_0x24ce9b);}})[_0x0e8a('0x1f')](function(_0x4a2976){if(_0x4a2976){return _0x4a2976?{'count':_0x2bcd0,'rows':_0x4a2976}:null;}})['then'](respondWithResult(_0x2941f9,null))[_0x0e8a('0x51')](handleError(_0x2941f9,null));};exports[_0x0e8a('0x5c')]=function(_0x236a43,_0x4a98ef,_0x1b9ee9){var _0x304412={};var _0x4ddf9f={};var _0x4f77eb;var _0x1d0953;return db[_0x0e8a('0x39')][_0x0e8a('0x59')]({'where':{'id':_0x236a43[_0x0e8a('0x53')]['id']}})['then'](handleEntityNotFound(_0x4a98ef,null))[_0x0e8a('0x1f')](function(_0x18f041){if(_0x18f041){_0x4f77eb=_0x18f041;_0x4ddf9f['model']=_[_0x0e8a('0x3c')](db[_0x0e8a('0x5b')]['rawAttributes']);_0x4ddf9f['query']=_[_0x0e8a('0x3c')](_0x236a43['query']);_0x4ddf9f[_0x0e8a('0x3e')]=_[_0x0e8a('0x3f')](_0x4ddf9f[_0x0e8a('0x3b')],_0x4ddf9f[_0x0e8a('0x3d')]);_0x304412[_0x0e8a('0x40')]=_[_0x0e8a('0x3f')](_0x4ddf9f['model'],qs[_0x0e8a('0x41')](_0x236a43[_0x0e8a('0x3d')][_0x0e8a('0x41')]));_0x304412[_0x0e8a('0x40')]=_0x304412[_0x0e8a('0x40')][_0x0e8a('0x42')]?_0x304412[_0x0e8a('0x40')]:_0x4ddf9f[_0x0e8a('0x3b')];_0x304412[_0x0e8a('0x5d')]=qs[_0x0e8a('0x45')](_0x236a43['query']['sort']);_0x304412[_0x0e8a('0x46')]=qs[_0x0e8a('0x3e')](_['pick'](_0x236a43['query'],_0x4ddf9f[_0x0e8a('0x3e')]));if(_0x236a43[_0x0e8a('0x3d')]['filter']){_0x304412[_0x0e8a('0x46')]=_['merge'](_0x304412['where'],{'$or':_[_0x0e8a('0x38')](_0x304412[_0x0e8a('0x40')],function(_0x543af5){var _0xd5acee={};_0xd5acee[_0x543af5]={'$like':'%'+_0x236a43[_0x0e8a('0x3d')][_0x0e8a('0x48')]+'%'};return _0xd5acee;})});}_0x304412=_[_0x0e8a('0x49')]({},_0x304412,_0x236a43[_0x0e8a('0x4c')]);return _0x4f77eb[_0x0e8a('0x5c')](_0x304412);}})[_0x0e8a('0x1f')](function(_0xc229db){if(_0xc229db){_0x1d0953=_0xc229db[_0x0e8a('0x42')];if(!_0x236a43[_0x0e8a('0x3d')]['hasOwnProperty'](_0x0e8a('0x44'))){_0x304412[_0x0e8a('0x30')]=qs[_0x0e8a('0x30')](_0x236a43[_0x0e8a('0x3d')][_0x0e8a('0x30')]);_0x304412[_0x0e8a('0x2f')]=qs[_0x0e8a('0x2f')](_0x236a43[_0x0e8a('0x3d')][_0x0e8a('0x2f')]);}return _0x4f77eb[_0x0e8a('0x5c')](_0x304412);}})[_0x0e8a('0x1f')](function(_0x5c05b0){if(_0x5c05b0){return _0x5c05b0?{'count':_0x1d0953,'rows':_0x5c05b0}:null;}})['then'](respondWithResult(_0x4a98ef,null))[_0x0e8a('0x51')](handleError(_0x4a98ef,null));}; \ No newline at end of file +var _0x40d7=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','getSubjects','findOne','nolimit','getDescriptions','FreshsalesField','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters'];(function(_0x5bc178,_0x3061b7){var _0x5598ec=function(_0x5771a2){while(--_0x5771a2){_0x5bc178['push'](_0x5bc178['shift']());}};_0x5598ec(++_0x3061b7);}(_0x40d7,0x12b));var _0x740d=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x40d7[_0xbe40ad];return _0x50fac9;};'use strict';var pdf=require(_0x740d('0x0'));var emlformat=require(_0x740d('0x1'));var rimraf=require(_0x740d('0x2'));var zipdir=require(_0x740d('0x3'));var jsonpatch=require(_0x740d('0x4'));var rp=require(_0x740d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x740d('0x6'));var util=require('util');var path=require(_0x740d('0x7'));var sox=require(_0x740d('0x8'));var csv=require(_0x740d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x740d('0xa'));var squel=require('squel');var crypto=require(_0x740d('0xb'));var jsforce=require(_0x740d('0xc'));var deskjs=require(_0x740d('0xd'));var toCsv=require(_0x740d('0x9'));var querystring=require(_0x740d('0xe'));var Papa=require(_0x740d('0xf'));var Redis=require(_0x740d('0x10'));var authService=require(_0x740d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x740d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x740d('0x13'))(_0x740d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x740d('0x15'))['db'];var jayson=require(_0x740d('0x16'));var client=jayson['client'][_0x740d('0x17')]({'port':0x232a});function checkPasswordPattern(_0x290765,_0x1be7cf,_0x1d7816){if(_0x1d7816){var _0x4e8d8e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e8d8e[_0x740d('0x18')](_0x1be7cf)){return _0x290765;}else{throw new db[(_0x740d('0x19'))][(_0x740d('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 _0x290765;}}function respondWithRpcPromise(_0x5a567d,_0x360ddb,_0x503faa,_0x10c3a3){return new BPromise(function(_0x3ede11,_0x22937a){var _0x203b80=_0x10c3a3||client;return _0x203b80[_0x740d('0x1b')](_0x5a567d,_0x503faa)[_0x740d('0x1c')](function(_0x2f0a62){logger['info'](_0x740d('0x1d'),_0x360ddb,_0x740d('0x1e'));logger[_0x740d('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x360ddb,_0x740d('0x1e'),JSON[_0x740d('0x20')](_0x2f0a62));if(_0x2f0a62[_0x740d('0x21')]){if(_0x2f0a62['error']['code']===0x1f4){logger[_0x740d('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x360ddb,_0x2f0a62['error'][_0x740d('0x22')]);return _0x22937a(_0x2f0a62['error']['message']);}logger[_0x740d('0x21')](_0x740d('0x1d'),_0x360ddb,_0x2f0a62[_0x740d('0x21')][_0x740d('0x22')]);return _0x3ede11(_0x2f0a62['error'][_0x740d('0x22')]);}else{logger[_0x740d('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x360ddb,'request\x20sent');_0x3ede11(_0x2f0a62[_0x740d('0x24')][_0x740d('0x22')]);}})[_0x740d('0x25')](function(_0x325b22){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x360ddb,_0x325b22);_0x22937a(_0x325b22);});});}function respondWithStatusCode(_0x213684,_0x39dd1e){_0x39dd1e=_0x39dd1e||0xcc;return function(_0x8320f8){if(_0x8320f8){return _0x213684[_0x740d('0x26')](_0x39dd1e);}return _0x213684[_0x740d('0x27')](_0x39dd1e)['end']();};}function respondWithResult(_0x5374cb,_0x3e45c8){_0x3e45c8=_0x3e45c8||0xc8;return function(_0x1848dd){if(_0x1848dd){return _0x5374cb[_0x740d('0x27')](_0x3e45c8)[_0x740d('0x28')](_0x1848dd);}};}function respondWithFilteredResult(_0x5e2791,_0x1a8581){return function(_0x57b3b9){if(_0x57b3b9){var _0x18a87e=_0x57b3b9[_0x740d('0x29')],_0x44a338=_0x1a8581[_0x740d('0x2a')],_0x1834e0=_0x1a8581[_0x740d('0x2a')]+_0x1a8581[_0x740d('0x2b')],_0x47a59c;if(_0x1834e0>=_0x18a87e){_0x1834e0=_0x18a87e;_0x47a59c=0xc8;}else{_0x47a59c=0xce;}_0x5e2791[_0x740d('0x27')](_0x47a59c);return _0x5e2791[_0x740d('0x2c')](_0x740d('0x2d'),_0x44a338+'-'+_0x1834e0+'/'+_0x18a87e)[_0x740d('0x28')](_0x57b3b9);}return null;};}function patchUpdates(_0x316390){return function(_0x2ae4ab){try{jsonpatch['apply'](_0x2ae4ab,_0x316390,!![]);}catch(_0x6135b5){return BPromise[_0x740d('0x2e')](_0x6135b5);}return _0x2ae4ab[_0x740d('0x2f')]();};}function saveUpdates(_0x59921b,_0x35f82a){return function(_0x3787f1){if(_0x3787f1){return _0x3787f1[_0x740d('0x30')](_0x59921b)[_0x740d('0x1c')](function(_0xaad491){return _0xaad491;});}return null;};}function removeEntity(_0x138fd9,_0x1a388c){return function(_0xb0a845){if(_0xb0a845){return _0xb0a845[_0x740d('0x31')]()[_0x740d('0x1c')](function(){_0x138fd9[_0x740d('0x27')](0xcc)[_0x740d('0x32')]();});}};}function handleEntityNotFound(_0x181e45,_0x5242f8){return function(_0x5abc5c){if(!_0x5abc5c){_0x181e45[_0x740d('0x26')](0x194);}return _0x5abc5c;};}function handleError(_0x104a77,_0x3793ff){_0x3793ff=_0x3793ff||0x1f4;return function(_0x189428){logger['error'](_0x189428[_0x740d('0x33')]);if(_0x189428['name']){delete _0x189428['name'];}_0x104a77[_0x740d('0x27')](_0x3793ff)[_0x740d('0x34')](_0x189428);};}exports[_0x740d('0x35')]=function(_0x2a8ecd,_0x1c5262){var _0xd0e830={},_0x4a0915={},_0x747214={'count':0x0,'rows':[]};var _0x3cf463=_[_0x740d('0x36')](db[_0x740d('0x37')][_0x740d('0x38')],function(_0x9a43f4){return{'name':_0x9a43f4[_0x740d('0x39')],'type':_0x9a43f4[_0x740d('0x3a')][_0x740d('0x3b')]};});_0x4a0915[_0x740d('0x3c')]=_[_0x740d('0x36')](_0x3cf463,_0x740d('0x3d'));_0x4a0915[_0x740d('0x3e')]=_[_0x740d('0x3f')](_0x2a8ecd[_0x740d('0x3e')]);_0x4a0915['filters']=_[_0x740d('0x40')](_0x4a0915[_0x740d('0x3c')],_0x4a0915[_0x740d('0x3e')]);_0xd0e830[_0x740d('0x41')]=_['intersection'](_0x4a0915[_0x740d('0x3c')],qs[_0x740d('0x42')](_0x2a8ecd[_0x740d('0x3e')]['fields']));_0xd0e830[_0x740d('0x41')]=_0xd0e830[_0x740d('0x41')][_0x740d('0x43')]?_0xd0e830[_0x740d('0x41')]:_0x4a0915['model'];if(!_0x2a8ecd[_0x740d('0x3e')][_0x740d('0x44')]('nolimit')){_0xd0e830[_0x740d('0x2b')]=qs[_0x740d('0x2b')](_0x2a8ecd[_0x740d('0x3e')][_0x740d('0x2b')]);_0xd0e830[_0x740d('0x2a')]=qs[_0x740d('0x2a')](_0x2a8ecd[_0x740d('0x3e')][_0x740d('0x2a')]);}_0xd0e830[_0x740d('0x45')]=qs[_0x740d('0x46')](_0x2a8ecd[_0x740d('0x3e')][_0x740d('0x46')]);_0xd0e830[_0x740d('0x47')]=qs[_0x740d('0x48')](_[_0x740d('0x49')](_0x2a8ecd['query'],_0x4a0915[_0x740d('0x48')]),_0x3cf463);if(_0x2a8ecd[_0x740d('0x3e')][_0x740d('0x4a')]){_0xd0e830['where']=_[_0x740d('0x4b')](_0xd0e830['where'],{'$or':_[_0x740d('0x36')](_0x3cf463,function(_0xb73134){if(_0xb73134['type']!==_0x740d('0x4c')){var _0x58f8ca={};_0x58f8ca[_0xb73134[_0x740d('0x3d')]]={'$like':'%'+_0x2a8ecd['query']['filter']+'%'};return _0x58f8ca;}})});}_0xd0e830=_[_0x740d('0x4b')]({},_0xd0e830,_0x2a8ecd[_0x740d('0x4d')]);var _0x5d6fad={'where':_0xd0e830[_0x740d('0x47')]};return db[_0x740d('0x37')][_0x740d('0x29')](_0x5d6fad)[_0x740d('0x1c')](function(_0x267d5d){_0x747214[_0x740d('0x29')]=_0x267d5d;if(_0x2a8ecd[_0x740d('0x3e')]['includeAll']){_0xd0e830[_0x740d('0x4e')]=[{'all':!![]}];}return db[_0x740d('0x37')][_0x740d('0x4f')](_0xd0e830);})[_0x740d('0x1c')](function(_0x6737bc){_0x747214[_0x740d('0x50')]=_0x6737bc;return _0x747214;})[_0x740d('0x1c')](respondWithFilteredResult(_0x1c5262,_0xd0e830))[_0x740d('0x25')](handleError(_0x1c5262,null));};exports[_0x740d('0x51')]=function(_0xfb0793,_0x2dcba7){var _0x53f85c={'raw':![],'where':{'id':_0xfb0793[_0x740d('0x52')]['id']}},_0x5bd3f1={};_0x5bd3f1['model']=_['keys'](db[_0x740d('0x37')]['rawAttributes']);_0x5bd3f1[_0x740d('0x3e')]=_[_0x740d('0x3f')](_0xfb0793[_0x740d('0x3e')]);_0x5bd3f1[_0x740d('0x48')]=_[_0x740d('0x40')](_0x5bd3f1[_0x740d('0x3c')],_0x5bd3f1[_0x740d('0x3e')]);_0x53f85c[_0x740d('0x41')]=_['intersection'](_0x5bd3f1[_0x740d('0x3c')],qs['fields'](_0xfb0793[_0x740d('0x3e')]['fields']));_0x53f85c[_0x740d('0x41')]=_0x53f85c[_0x740d('0x41')]['length']?_0x53f85c[_0x740d('0x41')]:_0x5bd3f1['model'];if(_0xfb0793[_0x740d('0x3e')][_0x740d('0x53')]){_0x53f85c[_0x740d('0x4e')]=[{'all':!![]}];}_0x53f85c=_[_0x740d('0x4b')]({},_0x53f85c,_0xfb0793[_0x740d('0x4d')]);return db[_0x740d('0x37')][_0x740d('0x54')](_0x53f85c)['then'](handleEntityNotFound(_0x2dcba7,null))['then'](respondWithResult(_0x2dcba7,null))['catch'](handleError(_0x2dcba7,null));};exports[_0x740d('0x55')]=function(_0x4efbac,_0x1628c8){return db[_0x740d('0x37')][_0x740d('0x55')](_0x4efbac['body'],{})['then'](respondWithResult(_0x1628c8,0xc9))[_0x740d('0x25')](handleError(_0x1628c8,null));};exports[_0x740d('0x30')]=function(_0x54e1af,_0x588fc6){if(_0x54e1af[_0x740d('0x56')]['id']){delete _0x54e1af['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x54e1af[_0x740d('0x52')]['id']}})[_0x740d('0x1c')](handleEntityNotFound(_0x588fc6,null))['then'](saveUpdates(_0x54e1af[_0x740d('0x56')],null))['then'](respondWithResult(_0x588fc6,null))['catch'](handleError(_0x588fc6,null));};exports[_0x740d('0x31')]=function(_0x5dbe2e,_0x27ba65){return db[_0x740d('0x37')][_0x740d('0x54')]({'where':{'id':_0x5dbe2e[_0x740d('0x52')]['id']}})[_0x740d('0x1c')](handleEntityNotFound(_0x27ba65,null))[_0x740d('0x1c')](removeEntity(_0x27ba65,null))[_0x740d('0x25')](handleError(_0x27ba65,null));};exports[_0x740d('0x57')]=function(_0x541317,_0x506ddb,_0x599a5b){var _0x104499={};var _0x4a8ab6={};var _0x5f5a66;var _0x24ad28;return db[_0x740d('0x37')][_0x740d('0x58')]({'where':{'id':_0x541317[_0x740d('0x52')]['id']}})[_0x740d('0x1c')](handleEntityNotFound(_0x506ddb,null))[_0x740d('0x1c')](function(_0x458272){if(_0x458272){_0x5f5a66=_0x458272;_0x4a8ab6['model']=_['keys'](db['FreshsalesField']['rawAttributes']);_0x4a8ab6[_0x740d('0x3e')]=_['keys'](_0x541317[_0x740d('0x3e')]);_0x4a8ab6['filters']=_[_0x740d('0x40')](_0x4a8ab6[_0x740d('0x3c')],_0x4a8ab6[_0x740d('0x3e')]);_0x104499[_0x740d('0x41')]=_[_0x740d('0x40')](_0x4a8ab6[_0x740d('0x3c')],qs['fields'](_0x541317[_0x740d('0x3e')][_0x740d('0x42')]));_0x104499['attributes']=_0x104499['attributes'][_0x740d('0x43')]?_0x104499['attributes']:_0x4a8ab6[_0x740d('0x3c')];_0x104499['order']=qs[_0x740d('0x46')](_0x541317[_0x740d('0x3e')][_0x740d('0x46')]);_0x104499[_0x740d('0x47')]=qs['filters'](_[_0x740d('0x49')](_0x541317[_0x740d('0x3e')],_0x4a8ab6[_0x740d('0x48')]));if(_0x541317[_0x740d('0x3e')]['filter']){_0x104499['where']=_[_0x740d('0x4b')](_0x104499['where'],{'$or':_[_0x740d('0x36')](_0x104499[_0x740d('0x41')],function(_0x39e935){var _0x2f7665={};_0x2f7665[_0x39e935]={'$like':'%'+_0x541317['query'][_0x740d('0x4a')]+'%'};return _0x2f7665;})});}_0x104499=_[_0x740d('0x4b')]({},_0x104499,_0x541317['options']);return _0x5f5a66[_0x740d('0x57')](_0x104499);}})[_0x740d('0x1c')](function(_0x2917a4){if(_0x2917a4){_0x24ad28=_0x2917a4[_0x740d('0x43')];if(!_0x541317[_0x740d('0x3e')][_0x740d('0x44')](_0x740d('0x59'))){_0x104499[_0x740d('0x2b')]=qs[_0x740d('0x2b')](_0x541317['query'][_0x740d('0x2b')]);_0x104499[_0x740d('0x2a')]=qs[_0x740d('0x2a')](_0x541317[_0x740d('0x3e')][_0x740d('0x2a')]);}return _0x5f5a66[_0x740d('0x57')](_0x104499);}})[_0x740d('0x1c')](function(_0x55b71a){if(_0x55b71a){return _0x55b71a?{'count':_0x24ad28,'rows':_0x55b71a}:null;}})[_0x740d('0x1c')](respondWithResult(_0x506ddb,null))[_0x740d('0x25')](handleError(_0x506ddb,null));};exports[_0x740d('0x5a')]=function(_0x18e6e1,_0x1e0dde,_0x313bd3){var _0x44ea46={};var _0xc14194={};var _0x32e48c;var _0x4c437d;return db['FreshsalesConfiguration'][_0x740d('0x58')]({'where':{'id':_0x18e6e1[_0x740d('0x52')]['id']}})[_0x740d('0x1c')](handleEntityNotFound(_0x1e0dde,null))[_0x740d('0x1c')](function(_0x10f022){if(_0x10f022){_0x32e48c=_0x10f022;_0xc14194[_0x740d('0x3c')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0xc14194['query']=_['keys'](_0x18e6e1[_0x740d('0x3e')]);_0xc14194[_0x740d('0x48')]=_[_0x740d('0x40')](_0xc14194[_0x740d('0x3c')],_0xc14194['query']);_0x44ea46['attributes']=_[_0x740d('0x40')](_0xc14194[_0x740d('0x3c')],qs[_0x740d('0x42')](_0x18e6e1[_0x740d('0x3e')][_0x740d('0x42')]));_0x44ea46['attributes']=_0x44ea46[_0x740d('0x41')][_0x740d('0x43')]?_0x44ea46['attributes']:_0xc14194[_0x740d('0x3c')];_0x44ea46[_0x740d('0x45')]=qs[_0x740d('0x46')](_0x18e6e1[_0x740d('0x3e')][_0x740d('0x46')]);_0x44ea46[_0x740d('0x47')]=qs['filters'](_[_0x740d('0x49')](_0x18e6e1[_0x740d('0x3e')],_0xc14194[_0x740d('0x48')]));if(_0x18e6e1[_0x740d('0x3e')][_0x740d('0x4a')]){_0x44ea46[_0x740d('0x47')]=_['merge'](_0x44ea46[_0x740d('0x47')],{'$or':_[_0x740d('0x36')](_0x44ea46['attributes'],function(_0x164a0a){var _0x4c0415={};_0x4c0415[_0x164a0a]={'$like':'%'+_0x18e6e1[_0x740d('0x3e')][_0x740d('0x4a')]+'%'};return _0x4c0415;})});}_0x44ea46=_[_0x740d('0x4b')]({},_0x44ea46,_0x18e6e1[_0x740d('0x4d')]);return _0x32e48c[_0x740d('0x5a')](_0x44ea46);}})[_0x740d('0x1c')](function(_0x4276e6){if(_0x4276e6){_0x4c437d=_0x4276e6['length'];if(!_0x18e6e1[_0x740d('0x3e')]['hasOwnProperty'](_0x740d('0x59'))){_0x44ea46[_0x740d('0x2b')]=qs[_0x740d('0x2b')](_0x18e6e1['query'][_0x740d('0x2b')]);_0x44ea46['offset']=qs[_0x740d('0x2a')](_0x18e6e1[_0x740d('0x3e')]['offset']);}return _0x32e48c[_0x740d('0x5a')](_0x44ea46);}})[_0x740d('0x1c')](function(_0x376657){if(_0x376657){return _0x376657?{'count':_0x4c437d,'rows':_0x376657}:null;}})[_0x740d('0x1c')](respondWithResult(_0x1e0dde,null))[_0x740d('0x25')](handleError(_0x1e0dde,null));};exports['getFields']=function(_0x3f29f1,_0x55034e,_0x4ed745){var _0x1eae3a={};var _0x26ebc1={};var _0x10fa55;var _0x518dc8;return db[_0x740d('0x37')]['findOne']({'where':{'id':_0x3f29f1['params']['id']}})['then'](handleEntityNotFound(_0x55034e,null))[_0x740d('0x1c')](function(_0x394466){if(_0x394466){_0x10fa55=_0x394466;_0x26ebc1[_0x740d('0x3c')]=_['keys'](db[_0x740d('0x5b')][_0x740d('0x38')]);_0x26ebc1[_0x740d('0x3e')]=_[_0x740d('0x3f')](_0x3f29f1[_0x740d('0x3e')]);_0x26ebc1['filters']=_[_0x740d('0x40')](_0x26ebc1[_0x740d('0x3c')],_0x26ebc1[_0x740d('0x3e')]);_0x1eae3a['attributes']=_[_0x740d('0x40')](_0x26ebc1['model'],qs['fields'](_0x3f29f1['query'][_0x740d('0x42')]));_0x1eae3a['attributes']=_0x1eae3a['attributes'][_0x740d('0x43')]?_0x1eae3a[_0x740d('0x41')]:_0x26ebc1[_0x740d('0x3c')];_0x1eae3a[_0x740d('0x45')]=qs[_0x740d('0x46')](_0x3f29f1[_0x740d('0x3e')][_0x740d('0x46')]);_0x1eae3a[_0x740d('0x47')]=qs[_0x740d('0x48')](_[_0x740d('0x49')](_0x3f29f1[_0x740d('0x3e')],_0x26ebc1[_0x740d('0x48')]));if(_0x3f29f1[_0x740d('0x3e')][_0x740d('0x4a')]){_0x1eae3a[_0x740d('0x47')]=_[_0x740d('0x4b')](_0x1eae3a[_0x740d('0x47')],{'$or':_[_0x740d('0x36')](_0x1eae3a[_0x740d('0x41')],function(_0x81cd88){var _0xafd7e9={};_0xafd7e9[_0x81cd88]={'$like':'%'+_0x3f29f1['query'][_0x740d('0x4a')]+'%'};return _0xafd7e9;})});}_0x1eae3a=_[_0x740d('0x4b')]({},_0x1eae3a,_0x3f29f1[_0x740d('0x4d')]);return _0x10fa55[_0x740d('0x5c')](_0x1eae3a);}})[_0x740d('0x1c')](function(_0x5c23ef){if(_0x5c23ef){_0x518dc8=_0x5c23ef[_0x740d('0x43')];if(!_0x3f29f1[_0x740d('0x3e')]['hasOwnProperty'](_0x740d('0x59'))){_0x1eae3a[_0x740d('0x2b')]=qs['limit'](_0x3f29f1[_0x740d('0x3e')][_0x740d('0x2b')]);_0x1eae3a[_0x740d('0x2a')]=qs[_0x740d('0x2a')](_0x3f29f1[_0x740d('0x3e')][_0x740d('0x2a')]);}return _0x10fa55[_0x740d('0x5c')](_0x1eae3a);}})['then'](function(_0xccf72a){if(_0xccf72a){return _0xccf72a?{'count':_0x518dc8,'rows':_0xccf72a}:null;}})[_0x740d('0x1c')](respondWithResult(_0x55034e,null))[_0x740d('0x25')](handleError(_0x55034e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 449764b..234bc89 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 _0x636b=['bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util','../../config/logger','moment'];(function(_0x42e03c,_0x14a571){var _0x482922=function(_0x3ad990){while(--_0x3ad990){_0x42e03c['push'](_0x42e03c['shift']());}};_0x482922(++_0x14a571);}(_0x636b,0x147));var _0xb636=function(_0x3990c1,_0x3a2631){_0x3990c1=_0x3990c1-0x0;var _0x578c4f=_0x636b[_0x3990c1];return _0x578c4f;};'use strict';var _=require('lodash');var util=require(_0xb636('0x0'));var logger=require(_0xb636('0x1'))('api');var moment=require(_0xb636('0x2'));var BPromise=require(_0xb636('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb636('0x4'));var rimraf=require(_0xb636('0x5'));var config=require(_0xb636('0x6'));var attributes=require(_0xb636('0x7'));module[_0xb636('0x8')]=function(_0x45d2e5,_0xad2236){return _0x45d2e5[_0xb636('0x9')](_0xb636('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3faa=['int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x286658,_0x48f2c4){var _0x4dd1e6=function(_0x1cd8cb){while(--_0x1cd8cb){_0x286658['push'](_0x286658['shift']());}};_0x4dd1e6(++_0x48f2c4);}(_0x3faa,0x179));var _0xa3fa=function(_0x257d96,_0x1b20be){_0x257d96=_0x257d96-0x0;var _0x116f5d=_0x3faa[_0x257d96];return _0x116f5d;};'use strict';var _=require('lodash');var util=require(_0xa3fa('0x0'));var logger=require(_0xa3fa('0x1'))(_0xa3fa('0x2'));var moment=require(_0xa3fa('0x3'));var BPromise=require(_0xa3fa('0x4'));var rp=require(_0xa3fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3fa('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x3d540e,_0x5e960b){return _0x3d540e['define']('FreshsalesConfiguration',attributes,{'tableName':_0xa3fa('0x7'),'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 ea77bf0..b87ed4f 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 _0xd4bd=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5b4c26,_0x755f31){var _0x1c4dd1=function(_0x510fe8){while(--_0x510fe8){_0x5b4c26['push'](_0x5b4c26['shift']());}};_0x1c4dd1(++_0x755f31);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x12f570,_0x2bdad1){_0x12f570=_0x12f570-0x0;var _0x820efc=_0xd4bd[_0x12f570];return _0x820efc;};'use strict';var _=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var moment=require(_0xdd4b('0x2'));var BPromise=require(_0xdd4b('0x3'));var rs=require(_0xdd4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd4b('0x5'))['db'];var utils=require(_0xdd4b('0x6'));var logger=require(_0xdd4b('0x7'))(_0xdd4b('0x8'));var config=require(_0xdd4b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x543281,_0x4292d3,_0x173584){return new BPromise(function(_0x4ac6a5,_0x521de8){return client[_0xdd4b('0xb')](_0x543281,_0x173584)[_0xdd4b('0xc')](function(_0x5d2a80){logger[_0xdd4b('0xd')](_0xdd4b('0xe'),_0x4292d3,_0xdd4b('0xf'));logger['debug'](_0xdd4b('0x10'),_0x4292d3,_0xdd4b('0xf'),JSON[_0xdd4b('0x11')](_0x5d2a80));if(_0x5d2a80[_0xdd4b('0x12')]){if(_0x5d2a80[_0xdd4b('0x12')][_0xdd4b('0x13')]===0x1f4){logger[_0xdd4b('0x12')](_0xdd4b('0xe'),_0x4292d3,_0x5d2a80['error'][_0xdd4b('0x14')]);return _0x521de8(_0x5d2a80['error'][_0xdd4b('0x14')]);}logger[_0xdd4b('0x12')](_0xdd4b('0xe'),_0x4292d3,_0x5d2a80[_0xdd4b('0x12')][_0xdd4b('0x14')]);return _0x4ac6a5(_0x5d2a80[_0xdd4b('0x12')]['message']);}else{logger['info'](_0xdd4b('0xe'),_0x4292d3,_0xdd4b('0xf'));_0x4ac6a5(_0x5d2a80[_0xdd4b('0x15')][_0xdd4b('0x14')]);}})[_0xdd4b('0x16')](function(_0x17af01){logger[_0xdd4b('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4292d3,_0x17af01);_0x521de8(_0x17af01);});});} \ No newline at end of file +var _0x44f8=['moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x44f8,0x1de));var _0x844f=function(_0x16e016,_0x5c355f){_0x16e016=_0x16e016-0x0;var _0x1a095b=_0x44f8[_0x16e016];return _0x1a095b;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index bad69a8..c04615d 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 _0xe8c5=['index','show','post','put','/:id','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x5e848d,_0x1dbd20){var _0x3785e5=function(_0xc82b39){while(--_0xc82b39){_0x5e848d['push'](_0x5e848d['shift']());}};_0x3785e5(++_0x1dbd20);}(_0xe8c5,0x91));var _0x5e8c=function(_0x4bac88,_0x3bdfb){_0x4bac88=_0x4bac88-0x0;var _0x470e82=_0xe8c5[_0x4bac88];return _0x470e82;};'use strict';var multer=require(_0x5e8c('0x0'));var util=require(_0x5e8c('0x1'));var path=require('path');var timeout=require(_0x5e8c('0x2'));var express=require('express');var router=express[_0x5e8c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5e8c('0x4'));var config=require(_0x5e8c('0x5'));var controller=require(_0x5e8c('0x6'));router[_0x5e8c('0x7')]('/',auth[_0x5e8c('0x8')](),controller[_0x5e8c('0x9')]);router[_0x5e8c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5e8c('0xa')]);router[_0x5e8c('0xb')]('/',auth[_0x5e8c('0x8')](),controller['create']);router[_0x5e8c('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5e8c('0xd'),auth[_0x5e8c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8297=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x306a03,_0x12a6e4){var _0x19de21=function(_0xbf86a3){while(--_0xbf86a3){_0x306a03['push'](_0x306a03['shift']());}};_0x19de21(++_0x12a6e4);}(_0x8297,0x165));var _0x7829=function(_0x587c27,_0x1f0075){_0x587c27=_0x587c27-0x0;var _0x5b85fd=_0x8297[_0x587c27];return _0x5b85fd;};'use strict';var multer=require(_0x7829('0x0'));var util=require('util');var path=require(_0x7829('0x1'));var timeout=require(_0x7829('0x2'));var express=require(_0x7829('0x3'));var router=express[_0x7829('0x4')]();var auth=require(_0x7829('0x5'));var interaction=require(_0x7829('0x6'));var config=require(_0x7829('0x7'));var controller=require(_0x7829('0x8'));router[_0x7829('0x9')]('/',auth[_0x7829('0xa')](),controller[_0x7829('0xb')]);router[_0x7829('0x9')](_0x7829('0xc'),auth[_0x7829('0xa')](),controller['show']);router['post']('/',auth[_0x7829('0xa')](),controller[_0x7829('0xd')]);router[_0x7829('0xe')](_0x7829('0xc'),auth[_0x7829('0xa')](),controller[_0x7829('0xf')]);router[_0x7829('0x10')](_0x7829('0xc'),auth['isAuthenticated'](),controller[_0x7829('0x11')]);module[_0x7829('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 60a87d5..f428f6c 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 _0x0db0=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0db0,0x1ed));var _0x00db=function(_0x2bf00b,_0xc27791){_0x2bf00b=_0x2bf00b-0x0;var _0x1bc255=_0x0db0[_0x2bf00b];return _0x1bc255;};'use strict';var Sequelize=require(_0x00db('0x0'));module[_0x00db('0x1')]={'type':{'type':Sequelize[_0x00db('0x2')](_0x00db('0x3'),_0x00db('0x4'),_0x00db('0x5'),_0x00db('0x6')),'defaultValue':_0x00db('0x3')},'content':{'type':Sequelize[_0x00db('0x7')]},'key':{'type':Sequelize[_0x00db('0x7')]},'keyType':{'type':Sequelize[_0x00db('0x2')](_0x00db('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x00db('0x7')]},'nameField':{'type':Sequelize[_0x00db('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd2fe=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x14915a,_0x222f6b){var _0x2f683c=function(_0x28e694){while(--_0x28e694){_0x14915a['push'](_0x14915a['shift']());}};_0x2f683c(++_0x222f6b);}(_0xd2fe,0xea));var _0xed2f=function(_0x20bf3f,_0x6729a7){_0x20bf3f=_0x20bf3f-0x0;var _0x10c51f=_0xd2fe[_0x20bf3f];return _0x10c51f;};'use strict';var Sequelize=require('sequelize');module[_0xed2f('0x0')]={'type':{'type':Sequelize['ENUM'](_0xed2f('0x1'),_0xed2f('0x2'),_0xed2f('0x3'),_0xed2f('0x4')),'defaultValue':_0xed2f('0x1')},'content':{'type':Sequelize[_0xed2f('0x5')]},'key':{'type':Sequelize[_0xed2f('0x5')]},'keyType':{'type':Sequelize[_0xed2f('0x6')]('string',_0xed2f('0x2'),_0xed2f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xed2f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xed2f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed2f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index df84e57..b40618d 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 _0xbd42=['fields','hasOwnProperty','sort','filters','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows','then','catch','params','length','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','end','error','name','index','map','FreshsalesField','rawAttributes','type','model','query','keys','attributes','intersection'];(function(_0x21a6f0,_0x34f377){var _0x394ada=function(_0x523061){while(--_0x523061){_0x21a6f0['push'](_0x21a6f0['shift']());}};_0x394ada(++_0x34f377);}(_0xbd42,0x145));var _0x2bd4=function(_0x596391,_0x4715b1){_0x596391=_0x596391-0x0;var _0x4cb168=_0xbd42[_0x596391];return _0x4cb168;};'use strict';var pdf=require(_0x2bd4('0x0'));var emlformat=require(_0x2bd4('0x1'));var rimraf=require(_0x2bd4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bd4('0x3'));var rp=require('request-promise');var moment=require(_0x2bd4('0x4'));var BPromise=require(_0x2bd4('0x5'));var Mustache=require('mustache');var util=require(_0x2bd4('0x6'));var path=require(_0x2bd4('0x7'));var sox=require('sox');var csv=require(_0x2bd4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bd4('0x9'));var squel=require(_0x2bd4('0xa'));var crypto=require('crypto');var jsforce=require(_0x2bd4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2bd4('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2bd4('0xd'));var logger=require(_0x2bd4('0xe'))(_0x2bd4('0xf'));var utils=require('../../config/utils');var config=require(_0x2bd4('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c45f,_0x1f62b7){_0x1f62b7=_0x1f62b7||0xcc;return function(_0xb7b139){if(_0xb7b139){return _0x2c45f[_0x2bd4('0x11')](_0x1f62b7);}return _0x2c45f[_0x2bd4('0x12')](_0x1f62b7)['end']();};}function respondWithResult(_0x471e4e,_0x499d18){_0x499d18=_0x499d18||0xc8;return function(_0x1d235c){if(_0x1d235c){return _0x471e4e[_0x2bd4('0x12')](_0x499d18)[_0x2bd4('0x13')](_0x1d235c);}};}function respondWithFilteredResult(_0x3600e9,_0x46a639){return function(_0x187ad5){if(_0x187ad5){var _0x4c4c3a=_0x187ad5['count'],_0x284126=_0x46a639[_0x2bd4('0x14')],_0x48842e=_0x46a639[_0x2bd4('0x14')]+_0x46a639[_0x2bd4('0x15')],_0x575bb1;if(_0x48842e>=_0x4c4c3a){_0x48842e=_0x4c4c3a;_0x575bb1=0xc8;}else{_0x575bb1=0xce;}_0x3600e9[_0x2bd4('0x12')](_0x575bb1);return _0x3600e9[_0x2bd4('0x16')]('Content-Range',_0x284126+'-'+_0x48842e+'/'+_0x4c4c3a)[_0x2bd4('0x13')](_0x187ad5);}return null;};}function patchUpdates(_0x28f366){return function(_0x1465e4){try{jsonpatch[_0x2bd4('0x17')](_0x1465e4,_0x28f366,!![]);}catch(_0x489aca){return BPromise[_0x2bd4('0x18')](_0x489aca);}return _0x1465e4[_0x2bd4('0x19')]();};}function saveUpdates(_0xd3bc91,_0x31b454){return function(_0x69e422){if(_0x69e422){return _0x69e422[_0x2bd4('0x1a')](_0xd3bc91)['then'](function(_0x3ddcb7){return _0x3ddcb7;});}return null;};}function removeEntity(_0x86d485,_0x2041ae){return function(_0x2289bf){if(_0x2289bf){return _0x2289bf[_0x2bd4('0x1b')]()['then'](function(){_0x86d485[_0x2bd4('0x12')](0xcc)[_0x2bd4('0x1c')]();});}};}function handleEntityNotFound(_0x183556,_0x3a8f08){return function(_0x5a5178){if(!_0x5a5178){_0x183556['sendStatus'](0x194);}return _0x5a5178;};}function handleError(_0x427404,_0x5441e3){_0x5441e3=_0x5441e3||0x1f4;return function(_0x5e8762){logger[_0x2bd4('0x1d')](_0x5e8762['stack']);if(_0x5e8762[_0x2bd4('0x1e')]){delete _0x5e8762[_0x2bd4('0x1e')];}_0x427404['status'](_0x5441e3)['send'](_0x5e8762);};}exports[_0x2bd4('0x1f')]=function(_0x184320,_0x4ab1fb){var _0x17d4d6={},_0x577263={},_0x5e28a4={'count':0x0,'rows':[]};var _0x1900ac=_[_0x2bd4('0x20')](db[_0x2bd4('0x21')][_0x2bd4('0x22')],function(_0x2a795b){return{'name':_0x2a795b['fieldName'],'type':_0x2a795b[_0x2bd4('0x23')]['key']};});_0x577263[_0x2bd4('0x24')]=_[_0x2bd4('0x20')](_0x1900ac,_0x2bd4('0x1e'));_0x577263[_0x2bd4('0x25')]=_[_0x2bd4('0x26')](_0x184320[_0x2bd4('0x25')]);_0x577263['filters']=_['intersection'](_0x577263[_0x2bd4('0x24')],_0x577263[_0x2bd4('0x25')]);_0x17d4d6[_0x2bd4('0x27')]=_[_0x2bd4('0x28')](_0x577263[_0x2bd4('0x24')],qs[_0x2bd4('0x29')](_0x184320['query'][_0x2bd4('0x29')]));_0x17d4d6[_0x2bd4('0x27')]=_0x17d4d6[_0x2bd4('0x27')]['length']?_0x17d4d6[_0x2bd4('0x27')]:_0x577263[_0x2bd4('0x24')];if(!_0x184320[_0x2bd4('0x25')][_0x2bd4('0x2a')]('nolimit')){_0x17d4d6[_0x2bd4('0x15')]=qs[_0x2bd4('0x15')](_0x184320[_0x2bd4('0x25')][_0x2bd4('0x15')]);_0x17d4d6['offset']=qs[_0x2bd4('0x14')](_0x184320[_0x2bd4('0x25')]['offset']);}_0x17d4d6['order']=qs[_0x2bd4('0x2b')](_0x184320[_0x2bd4('0x25')][_0x2bd4('0x2b')]);_0x17d4d6['where']=qs[_0x2bd4('0x2c')](_['pick'](_0x184320[_0x2bd4('0x25')],_0x577263[_0x2bd4('0x2c')]),_0x1900ac);if(_0x184320[_0x2bd4('0x25')][_0x2bd4('0x2d')]){_0x17d4d6[_0x2bd4('0x2e')]=_['merge'](_0x17d4d6[_0x2bd4('0x2e')],{'$or':_['map'](_0x1900ac,function(_0x1841df){if(_0x1841df[_0x2bd4('0x23')]!==_0x2bd4('0x2f')){var _0x3f9133={};_0x3f9133[_0x1841df[_0x2bd4('0x1e')]]={'$like':'%'+_0x184320[_0x2bd4('0x25')][_0x2bd4('0x2d')]+'%'};return _0x3f9133;}})});}_0x17d4d6=_[_0x2bd4('0x30')]({},_0x17d4d6,_0x184320[_0x2bd4('0x31')]);var _0x4621b2={'where':_0x17d4d6['where']};return db[_0x2bd4('0x21')][_0x2bd4('0x32')](_0x4621b2)['then'](function(_0x2e7cc1){_0x5e28a4[_0x2bd4('0x32')]=_0x2e7cc1;if(_0x184320[_0x2bd4('0x25')][_0x2bd4('0x33')]){_0x17d4d6[_0x2bd4('0x34')]=[{'all':!![]}];}return db[_0x2bd4('0x21')]['findAll'](_0x17d4d6);})['then'](function(_0x6f77ea){_0x5e28a4[_0x2bd4('0x35')]=_0x6f77ea;return _0x5e28a4;})[_0x2bd4('0x36')](respondWithFilteredResult(_0x4ab1fb,_0x17d4d6))[_0x2bd4('0x37')](handleError(_0x4ab1fb,null));};exports['show']=function(_0x128926,_0x38eb05){var _0x23c21b={'raw':!![],'where':{'id':_0x128926[_0x2bd4('0x38')]['id']}},_0x36abc3={};_0x36abc3[_0x2bd4('0x24')]=_[_0x2bd4('0x26')](db['FreshsalesField'][_0x2bd4('0x22')]);_0x36abc3[_0x2bd4('0x25')]=_['keys'](_0x128926[_0x2bd4('0x25')]);_0x36abc3[_0x2bd4('0x2c')]=_[_0x2bd4('0x28')](_0x36abc3[_0x2bd4('0x24')],_0x36abc3[_0x2bd4('0x25')]);_0x23c21b['attributes']=_[_0x2bd4('0x28')](_0x36abc3[_0x2bd4('0x24')],qs[_0x2bd4('0x29')](_0x128926['query'][_0x2bd4('0x29')]));_0x23c21b[_0x2bd4('0x27')]=_0x23c21b[_0x2bd4('0x27')][_0x2bd4('0x39')]?_0x23c21b['attributes']:_0x36abc3['model'];if(_0x128926[_0x2bd4('0x25')][_0x2bd4('0x33')]){_0x23c21b['include']=[{'all':!![]}];}_0x23c21b=_[_0x2bd4('0x30')]({},_0x23c21b,_0x128926[_0x2bd4('0x31')]);return db[_0x2bd4('0x21')]['find'](_0x23c21b)[_0x2bd4('0x36')](handleEntityNotFound(_0x38eb05,null))[_0x2bd4('0x36')](respondWithResult(_0x38eb05,null))[_0x2bd4('0x37')](handleError(_0x38eb05,null));};exports[_0x2bd4('0x3a')]=function(_0x5dd184,_0xa176a6){return db[_0x2bd4('0x21')][_0x2bd4('0x3a')](_0x5dd184[_0x2bd4('0x3b')],{})['then'](respondWithResult(_0xa176a6,0xc9))['catch'](handleError(_0xa176a6,null));};exports[_0x2bd4('0x1a')]=function(_0x4d44c5,_0x12ddba){if(_0x4d44c5['body']['id']){delete _0x4d44c5[_0x2bd4('0x3b')]['id'];}return db[_0x2bd4('0x21')][_0x2bd4('0x3c')]({'where':{'id':_0x4d44c5[_0x2bd4('0x38')]['id']}})[_0x2bd4('0x36')](handleEntityNotFound(_0x12ddba,null))['then'](saveUpdates(_0x4d44c5[_0x2bd4('0x3b')],null))['then'](respondWithResult(_0x12ddba,null))['catch'](handleError(_0x12ddba,null));};exports[_0x2bd4('0x1b')]=function(_0x5f3464,_0x3f6840){return db[_0x2bd4('0x21')][_0x2bd4('0x3c')]({'where':{'id':_0x5f3464[_0x2bd4('0x38')]['id']}})[_0x2bd4('0x36')](handleEntityNotFound(_0x3f6840,null))[_0x2bd4('0x36')](removeEntity(_0x3f6840,null))[_0x2bd4('0x37')](handleError(_0x3f6840,null));}; \ No newline at end of file +var _0xcf71=['save','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','keys','includeAll','find','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject'];(function(_0x195a12,_0x558d3c){var _0x5aaf55=function(_0x2fc58b){while(--_0x2fc58b){_0x195a12['push'](_0x195a12['shift']());}};_0x5aaf55(++_0x558d3c);}(_0xcf71,0x6f));var _0x1cf7=function(_0x581182,_0x4d140b){_0x581182=_0x581182-0x0;var _0x27eed2=_0xcf71[_0x581182];return _0x27eed2;};'use strict';var pdf=require(_0x1cf7('0x0'));var emlformat=require(_0x1cf7('0x1'));var rimraf=require(_0x1cf7('0x2'));var zipdir=require(_0x1cf7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cf7('0x4'));var moment=require(_0x1cf7('0x5'));var BPromise=require(_0x1cf7('0x6'));var Mustache=require(_0x1cf7('0x7'));var util=require(_0x1cf7('0x8'));var path=require('path');var sox=require(_0x1cf7('0x9'));var csv=require(_0x1cf7('0xa'));var ejs=require(_0x1cf7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1cf7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1cf7('0xa'));var querystring=require(_0x1cf7('0xd'));var Papa=require(_0x1cf7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1cf7('0xf'));var as=require(_0x1cf7('0x10'));var hardwareService=require(_0x1cf7('0x11'));var logger=require(_0x1cf7('0x12'))('api');var utils=require(_0x1cf7('0x13'));var config=require(_0x1cf7('0x14'));var db=require(_0x1cf7('0x15'))['db'];function respondWithStatusCode(_0x3c081a,_0x1814f8){_0x1814f8=_0x1814f8||0xcc;return function(_0x3551ee){if(_0x3551ee){return _0x3c081a[_0x1cf7('0x16')](_0x1814f8);}return _0x3c081a[_0x1cf7('0x17')](_0x1814f8)['end']();};}function respondWithResult(_0x291bb7,_0x115af5){_0x115af5=_0x115af5||0xc8;return function(_0x5cd8ba){if(_0x5cd8ba){return _0x291bb7[_0x1cf7('0x17')](_0x115af5)[_0x1cf7('0x18')](_0x5cd8ba);}};}function respondWithFilteredResult(_0x19a301,_0x259394){return function(_0x5cc4b3){if(_0x5cc4b3){var _0x5d4fff=_0x5cc4b3['count'],_0x45ca36=_0x259394[_0x1cf7('0x19')],_0x2e454a=_0x259394['offset']+_0x259394[_0x1cf7('0x1a')],_0x1bea06;if(_0x2e454a>=_0x5d4fff){_0x2e454a=_0x5d4fff;_0x1bea06=0xc8;}else{_0x1bea06=0xce;}_0x19a301[_0x1cf7('0x17')](_0x1bea06);return _0x19a301[_0x1cf7('0x1b')](_0x1cf7('0x1c'),_0x45ca36+'-'+_0x2e454a+'/'+_0x5d4fff)[_0x1cf7('0x18')](_0x5cc4b3);}return null;};}function patchUpdates(_0x59b2ff){return function(_0x17007a){try{jsonpatch[_0x1cf7('0x1d')](_0x17007a,_0x59b2ff,!![]);}catch(_0x1ba4b6){return BPromise[_0x1cf7('0x1e')](_0x1ba4b6);}return _0x17007a[_0x1cf7('0x1f')]();};}function saveUpdates(_0x3208ac,_0x5852e8){return function(_0x3e0db9){if(_0x3e0db9){return _0x3e0db9['update'](_0x3208ac)[_0x1cf7('0x20')](function(_0x4ba85a){return _0x4ba85a;});}return null;};}function removeEntity(_0x416c71,_0x340951){return function(_0x3e4051){if(_0x3e4051){return _0x3e4051[_0x1cf7('0x21')]()[_0x1cf7('0x20')](function(){_0x416c71[_0x1cf7('0x17')](0xcc)[_0x1cf7('0x22')]();});}};}function handleEntityNotFound(_0x50f18c,_0x5ef4ac){return function(_0x594a48){if(!_0x594a48){_0x50f18c[_0x1cf7('0x16')](0x194);}return _0x594a48;};}function handleError(_0x5d947f,_0x4b661b){_0x4b661b=_0x4b661b||0x1f4;return function(_0x2aa814){logger[_0x1cf7('0x23')](_0x2aa814[_0x1cf7('0x24')]);if(_0x2aa814[_0x1cf7('0x25')]){delete _0x2aa814[_0x1cf7('0x25')];}_0x5d947f[_0x1cf7('0x17')](_0x4b661b)[_0x1cf7('0x26')](_0x2aa814);};}exports[_0x1cf7('0x27')]=function(_0x2d2eba,_0x207e96){var _0xa9782c={},_0x36db44={},_0x5dff21={'count':0x0,'rows':[]};var _0x5701e8=_[_0x1cf7('0x28')](db[_0x1cf7('0x29')][_0x1cf7('0x2a')],function(_0x2a8bea){return{'name':_0x2a8bea[_0x1cf7('0x2b')],'type':_0x2a8bea[_0x1cf7('0x2c')][_0x1cf7('0x2d')]};});_0x36db44[_0x1cf7('0x2e')]=_['map'](_0x5701e8,_0x1cf7('0x25'));_0x36db44[_0x1cf7('0x2f')]=_['keys'](_0x2d2eba['query']);_0x36db44[_0x1cf7('0x30')]=_['intersection'](_0x36db44[_0x1cf7('0x2e')],_0x36db44[_0x1cf7('0x2f')]);_0xa9782c[_0x1cf7('0x31')]=_[_0x1cf7('0x32')](_0x36db44['model'],qs[_0x1cf7('0x33')](_0x2d2eba[_0x1cf7('0x2f')][_0x1cf7('0x33')]));_0xa9782c[_0x1cf7('0x31')]=_0xa9782c[_0x1cf7('0x31')][_0x1cf7('0x34')]?_0xa9782c[_0x1cf7('0x31')]:_0x36db44[_0x1cf7('0x2e')];if(!_0x2d2eba[_0x1cf7('0x2f')]['hasOwnProperty']('nolimit')){_0xa9782c['limit']=qs['limit'](_0x2d2eba[_0x1cf7('0x2f')][_0x1cf7('0x1a')]);_0xa9782c[_0x1cf7('0x19')]=qs[_0x1cf7('0x19')](_0x2d2eba['query'][_0x1cf7('0x19')]);}_0xa9782c[_0x1cf7('0x35')]=qs[_0x1cf7('0x36')](_0x2d2eba[_0x1cf7('0x2f')][_0x1cf7('0x36')]);_0xa9782c[_0x1cf7('0x37')]=qs[_0x1cf7('0x30')](_[_0x1cf7('0x38')](_0x2d2eba['query'],_0x36db44['filters']),_0x5701e8);if(_0x2d2eba[_0x1cf7('0x2f')]['filter']){_0xa9782c[_0x1cf7('0x37')]=_['merge'](_0xa9782c[_0x1cf7('0x37')],{'$or':_[_0x1cf7('0x28')](_0x5701e8,function(_0x3eeabc){if(_0x3eeabc[_0x1cf7('0x2c')]!=='VIRTUAL'){var _0x4e6fec={};_0x4e6fec[_0x3eeabc[_0x1cf7('0x25')]]={'$like':'%'+_0x2d2eba[_0x1cf7('0x2f')][_0x1cf7('0x39')]+'%'};return _0x4e6fec;}})});}_0xa9782c=_[_0x1cf7('0x3a')]({},_0xa9782c,_0x2d2eba[_0x1cf7('0x3b')]);var _0x105a28={'where':_0xa9782c['where']};return db[_0x1cf7('0x29')][_0x1cf7('0x3c')](_0x105a28)[_0x1cf7('0x20')](function(_0x532cc8){_0x5dff21[_0x1cf7('0x3c')]=_0x532cc8;if(_0x2d2eba[_0x1cf7('0x2f')]['includeAll']){_0xa9782c[_0x1cf7('0x3d')]=[{'all':!![]}];}return db[_0x1cf7('0x29')][_0x1cf7('0x3e')](_0xa9782c);})[_0x1cf7('0x20')](function(_0x272d21){_0x5dff21[_0x1cf7('0x3f')]=_0x272d21;return _0x5dff21;})['then'](respondWithFilteredResult(_0x207e96,_0xa9782c))[_0x1cf7('0x40')](handleError(_0x207e96,null));};exports[_0x1cf7('0x41')]=function(_0x5c1d0f,_0x555aca){var _0x55c999={'raw':!![],'where':{'id':_0x5c1d0f['params']['id']}},_0x2483cf={};_0x2483cf[_0x1cf7('0x2e')]=_[_0x1cf7('0x42')](db[_0x1cf7('0x29')][_0x1cf7('0x2a')]);_0x2483cf[_0x1cf7('0x2f')]=_[_0x1cf7('0x42')](_0x5c1d0f[_0x1cf7('0x2f')]);_0x2483cf['filters']=_[_0x1cf7('0x32')](_0x2483cf[_0x1cf7('0x2e')],_0x2483cf[_0x1cf7('0x2f')]);_0x55c999[_0x1cf7('0x31')]=_['intersection'](_0x2483cf[_0x1cf7('0x2e')],qs[_0x1cf7('0x33')](_0x5c1d0f[_0x1cf7('0x2f')][_0x1cf7('0x33')]));_0x55c999['attributes']=_0x55c999[_0x1cf7('0x31')][_0x1cf7('0x34')]?_0x55c999[_0x1cf7('0x31')]:_0x2483cf[_0x1cf7('0x2e')];if(_0x5c1d0f[_0x1cf7('0x2f')][_0x1cf7('0x43')]){_0x55c999[_0x1cf7('0x3d')]=[{'all':!![]}];}_0x55c999=_[_0x1cf7('0x3a')]({},_0x55c999,_0x5c1d0f['options']);return db['FreshsalesField'][_0x1cf7('0x44')](_0x55c999)[_0x1cf7('0x20')](handleEntityNotFound(_0x555aca,null))[_0x1cf7('0x20')](respondWithResult(_0x555aca,null))[_0x1cf7('0x40')](handleError(_0x555aca,null));};exports['create']=function(_0x5b41c7,_0x5bd329){return db['FreshsalesField']['create'](_0x5b41c7[_0x1cf7('0x45')],{})['then'](respondWithResult(_0x5bd329,0xc9))['catch'](handleError(_0x5bd329,null));};exports['update']=function(_0x135332,_0x22ba93){if(_0x135332[_0x1cf7('0x45')]['id']){delete _0x135332[_0x1cf7('0x45')]['id'];}return db[_0x1cf7('0x29')][_0x1cf7('0x44')]({'where':{'id':_0x135332[_0x1cf7('0x46')]['id']}})[_0x1cf7('0x20')](handleEntityNotFound(_0x22ba93,null))[_0x1cf7('0x20')](saveUpdates(_0x135332[_0x1cf7('0x45')],null))[_0x1cf7('0x20')](respondWithResult(_0x22ba93,null))['catch'](handleError(_0x22ba93,null));};exports[_0x1cf7('0x21')]=function(_0x289a6c,_0x5b51d0){return db[_0x1cf7('0x29')][_0x1cf7('0x44')]({'where':{'id':_0x289a6c[_0x1cf7('0x46')]['id']}})[_0x1cf7('0x20')](handleEntityNotFound(_0x5b51d0,null))['then'](removeEntity(_0x5b51d0,null))['catch'](handleError(_0x5b51d0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 687ccca..8bd4ef0 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 _0x0147=['exports','define','FreshsalesField','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ae730,_0x31b581){var _0x203089=function(_0x4189b2){while(--_0x4189b2){_0x4ae730['push'](_0x4ae730['shift']());}};_0x203089(++_0x31b581);}(_0x0147,0xf4));var _0x7014=function(_0x100d0d,_0x3dac4e){_0x100d0d=_0x100d0d-0x0;var _0x270846=_0x0147[_0x100d0d];return _0x270846;};'use strict';var _=require('lodash');var util=require(_0x7014('0x0'));var logger=require(_0x7014('0x1'))(_0x7014('0x2'));var moment=require(_0x7014('0x3'));var BPromise=require(_0x7014('0x4'));var rp=require(_0x7014('0x5'));var fs=require('fs');var path=require(_0x7014('0x6'));var rimraf=require(_0x7014('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x7014('0x8')]=function(_0x3b6cae,_0x205c65){return _0x3b6cae[_0x7014('0x9')](_0x7014('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7014('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe54a=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util'];(function(_0x43919e,_0x24eec7){var _0x56d809=function(_0x6931f2){while(--_0x6931f2){_0x43919e['push'](_0x43919e['shift']());}};_0x56d809(++_0x24eec7);}(_0xe54a,0x193));var _0xae54=function(_0x1fce64,_0x50880e){_0x1fce64=_0x1fce64-0x0;var _0x13767c=_0xe54a[_0x1fce64];return _0x13767c;};'use strict';var _=require(_0xae54('0x0'));var util=require(_0xae54('0x1'));var logger=require(_0xae54('0x2'))(_0xae54('0x3'));var moment=require(_0xae54('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae54('0x5'));var rimraf=require(_0xae54('0x6'));var config=require(_0xae54('0x7'));var attributes=require(_0xae54('0x8'));module[_0xae54('0x9')]=function(_0x3d0a10,_0x4d9c74){return _0x3d0a10[_0xae54('0xa')](_0xae54('0xb'),attributes,{'tableName':_0xae54('0xc'),'paranoid':![],'indexes':[{'name':_0xae54('0xd'),'fields':[_0xae54('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 79f2143..da17f4c 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 _0xfe39=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0xe906de,_0x1a5142){var _0x35e8c9=function(_0x27b1e0){while(--_0x27b1e0){_0xe906de['push'](_0xe906de['shift']());}};_0x35e8c9(++_0x1a5142);}(_0xfe39,0x1b3));var _0x9fe3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xfe39[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var moment=require('moment');var BPromise=require(_0x9fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fe3('0x3'))['db'];var utils=require(_0x9fe3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fe3('0x5'));var jayson=require(_0x9fe3('0x6'));var client=jayson[_0x9fe3('0x7')][_0x9fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc469b7,_0x4183ce,_0x25868f){return new BPromise(function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0x9')](_0xc469b7,_0x25868f)[_0x9fe3('0xa')](function(_0x35c391){logger[_0x9fe3('0xb')](_0x9fe3('0xc'),_0x4183ce,'request\x20sent');logger['debug'](_0x9fe3('0xd'),_0x4183ce,_0x9fe3('0xe'),JSON['stringify'](_0x35c391));if(_0x35c391[_0x9fe3('0xf')]){if(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x10')]===0x1f4){logger[_0x9fe3('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x4183ce,'request\x20sent');_0x5a3bd6(_0x35c391[_0x9fe3('0x12')][_0x9fe3('0x11')]);}})[_0x9fe3('0x13')](function(_0x2d28d4){logger['error'](_0x9fe3('0xc'),_0x4183ce,_0x2d28d4);_0x211eb2(_0x2d28d4);});});} \ No newline at end of file +var _0xbb48=['request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56310b,_0x450ac3){var _0x3a857e=function(_0xebabf7){while(--_0xebabf7){_0x56310b['push'](_0x56310b['shift']());}};_0x3a857e(++_0x450ac3);}(_0xbb48,0x1ee));var _0x8bb4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbb48[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8bb4('0x0'));var util=require(_0x8bb4('0x1'));var moment=require(_0x8bb4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bb4('0x3'));var db=require(_0x8bb4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bb4('0x5'))(_0x8bb4('0x6'));var config=require(_0x8bb4('0x7'));var jayson=require(_0x8bb4('0x8'));var client=jayson[_0x8bb4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7a97,_0x6e62e1,_0x1d14c4){return new BPromise(function(_0x3302dc,_0x481f2e){return client[_0x8bb4('0xa')](_0x4e7a97,_0x1d14c4)['then'](function(_0x3e0b58){logger[_0x8bb4('0xb')](_0x8bb4('0xc'),_0x6e62e1,_0x8bb4('0xd'));logger['debug'](_0x8bb4('0xe'),_0x6e62e1,_0x8bb4('0xd'),JSON[_0x8bb4('0xf')](_0x3e0b58));if(_0x3e0b58[_0x8bb4('0x10')]){if(_0x3e0b58[_0x8bb4('0x10')]['code']===0x1f4){logger[_0x8bb4('0x10')](_0x8bb4('0xc'),_0x6e62e1,_0x3e0b58['error']['message']);return _0x481f2e(_0x3e0b58[_0x8bb4('0x10')][_0x8bb4('0x11')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x6e62e1,_0x3e0b58['error'][_0x8bb4('0x11')]);return _0x3302dc(_0x3e0b58['error'][_0x8bb4('0x11')]);}else{logger['info'](_0x8bb4('0xc'),_0x6e62e1,_0x8bb4('0xd'));_0x3302dc(_0x3e0b58['result'][_0x8bb4('0x11')]);}})['catch'](function(_0xbf4389){logger[_0x8bb4('0x10')](_0x8bb4('0xc'),_0x6e62e1,_0xbf4389);_0x481f2e(_0xbf4389);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 8dcd78d..b9c4fee 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 _0x2aec=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x4cb4b0,_0x27b8d6){var _0x184cd2=function(_0x338ce7){while(--_0x338ce7){_0x4cb4b0['push'](_0x4cb4b0['shift']());}};_0x184cd2(++_0x27b8d6);}(_0x2aec,0x1dd));var _0xc2ae=function(_0x4eab6e,_0x5b030b){_0x4eab6e=_0x4eab6e-0x0;var _0x4b3865=_0x2aec[_0x4eab6e];return _0x4b3865;};'use strict';var multer=require(_0xc2ae('0x0'));var util=require('util');var path=require(_0xc2ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2ae('0x2'));var router=express[_0xc2ae('0x3')]();var auth=require(_0xc2ae('0x4'));var interaction=require(_0xc2ae('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router[_0xc2ae('0x6')]('/',auth[_0xc2ae('0x7')](),controller[_0xc2ae('0x8')]);router[_0xc2ae('0x6')](_0xc2ae('0x9'),auth['isAuthenticated'](),controller[_0xc2ae('0xa')]);router[_0xc2ae('0x6')](_0xc2ae('0xb'),auth[_0xc2ae('0x7')](),controller[_0xc2ae('0xc')]);router[_0xc2ae('0x6')](_0xc2ae('0xd'),auth[_0xc2ae('0x7')](),controller[_0xc2ae('0xe')]);router[_0xc2ae('0xf')]('/',auth['isAuthenticated'](),controller[_0xc2ae('0x10')]);router[_0xc2ae('0xf')](_0xc2ae('0xb'),auth[_0xc2ae('0x7')](),controller[_0xc2ae('0x11')]);router[_0xc2ae('0x12')](_0xc2ae('0x9'),auth[_0xc2ae('0x7')](),controller['update']);router[_0xc2ae('0x13')](_0xc2ae('0x9'),auth[_0xc2ae('0x7')](),controller[_0xc2ae('0x14')]);module[_0xc2ae('0x15')]=router; \ No newline at end of file +var _0xac3d=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','delete','exports'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0xac3d,0x69));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdac3('0x0'));var util=require(_0xdac3('0x1'));var path=require(_0xdac3('0x2'));var timeout=require('connect-timeout');var express=require(_0xdac3('0x3'));var router=express['Router']();var auth=require(_0xdac3('0x4'));var interaction=require(_0xdac3('0x5'));var config=require(_0xdac3('0x6'));var controller=require(_0xdac3('0x7'));router[_0xdac3('0x8')]('/',auth['isAuthenticated'](),controller[_0xdac3('0x9')]);router['get']('/:id',auth[_0xdac3('0xa')](),controller['show']);router['get'](_0xdac3('0xb'),auth[_0xdac3('0xa')](),controller[_0xdac3('0xc')]);router['get'](_0xdac3('0xd'),auth[_0xdac3('0xa')](),controller['getFields']);router[_0xdac3('0xe')]('/',auth[_0xdac3('0xa')](),controller[_0xdac3('0xf')]);router[_0xdac3('0xe')](_0xdac3('0xb'),auth[_0xdac3('0xa')](),controller[_0xdac3('0x10')]);router[_0xdac3('0x11')](_0xdac3('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xdac3('0x13')](_0xdac3('0x12'),auth[_0xdac3('0xa')](),controller['destroy']);module[_0xdac3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e9e657a..3c10023 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 _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x289280,_0x48c75b){var _0x18ae4f=function(_0x14ca20){while(--_0x14ca20){_0x289280['push'](_0x289280['shift']());}};_0x18ae4f(++_0x48c75b);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c43f8,_0x261d10){_0x2c43f8=_0x2c43f8-0x0;var _0x3c0c0f=_0x5fab[_0x2c43f8];return _0x3c0c0f;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file +var _0x4975=['username','integrationTab','sequelize','STRING'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x4975,0x86));var _0x5497=function(_0x4f8be2,_0x573415){_0x4f8be2=_0x4f8be2-0x0;var _0x68f53=_0x4975[_0x4f8be2];return _0x68f53;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'name':{'type':Sequelize[_0x5497('0x1')]},'description':{'type':Sequelize[_0x5497('0x1')]},'username':{'type':Sequelize[_0x5497('0x1')],'unique':_0x5497('0x2')},'remoteUri':{'type':Sequelize[_0x5497('0x1')]},'password':{'type':Sequelize[_0x5497('0x1')]},'clientId':{'type':Sequelize[_0x5497('0x1')]},'clientSecret':{'type':Sequelize[_0x5497('0x1')]},'securityToken':{'type':Sequelize[_0x5497('0x1')]},'serverUrl':{'type':Sequelize[_0x5497('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5497('0x3'),'newTab'),'defaultValue':_0x5497('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6658829..c65446b 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 _0x7352=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','set','Content-Range','reject','update','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','filters','where','merge','filter','options','includeAll','include','findAll','show','params','length','create','body','find','getConfigurations','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','Priority','Type','Case','Origin','Status','IsEscalated','SuppliedName','remove','includes','label','custom','picklistValues','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent'];(function(_0x41f07e,_0x3427ca){var _0x346c6b=function(_0x486c9d){while(--_0x486c9d){_0x41f07e['push'](_0x41f07e['shift']());}};_0x346c6b(++_0x3427ca);}(_0x7352,0x64));var _0x2735=function(_0x2db2e4,_0x49130e){_0x2db2e4=_0x2db2e4-0x0;var _0x2ef52d=_0x7352[_0x2db2e4];return _0x2ef52d;};'use strict';var pdf=require(_0x2735('0x0'));var emlformat=require(_0x2735('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2735('0x2'));var jsonpatch=require(_0x2735('0x3'));var rp=require('request-promise');var moment=require(_0x2735('0x4'));var BPromise=require(_0x2735('0x5'));var Mustache=require(_0x2735('0x6'));var util=require(_0x2735('0x7'));var path=require(_0x2735('0x8'));var sox=require(_0x2735('0x9'));var csv=require(_0x2735('0xa'));var ejs=require(_0x2735('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2735('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2735('0xd'));var toCsv=require(_0x2735('0xa'));var querystring=require(_0x2735('0xe'));var Papa=require(_0x2735('0xf'));var Redis=require('ioredis');var authService=require(_0x2735('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2735('0x11'));var hardwareService=require(_0x2735('0x12'));var logger=require(_0x2735('0x13'))(_0x2735('0x14'));var utils=require(_0x2735('0x15'));var config=require(_0x2735('0x16'));var db=require(_0x2735('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x2735('0x18')][_0x2735('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2928f3,_0x6113dd,_0x8b68ff){if(_0x8b68ff){var _0x25a7e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25a7e8[_0x2735('0x1a')](_0x6113dd)){return _0x2928f3;}else{throw new db[(_0x2735('0x1b'))]['ValidationError'](_0x2735('0x1c'));}}else{return _0x2928f3;}}function respondWithRpcPromise(_0x43c125,_0x4a1d24,_0x126e81,_0x3b77ae){return new BPromise(function(_0x3fe6eb,_0x48ec75){var _0xf33e7d=_0x3b77ae||client;return _0xf33e7d[_0x2735('0x1d')](_0x43c125,_0x126e81)[_0x2735('0x1e')](function(_0x2f64c0){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4a1d24,_0x2735('0x1f'));logger[_0x2735('0x20')](_0x2735('0x21'),_0x4a1d24,_0x2735('0x1f'),JSON[_0x2735('0x22')](_0x2f64c0));if(_0x2f64c0[_0x2735('0x23')]){if(_0x2f64c0['error'][_0x2735('0x24')]===0x1f4){logger[_0x2735('0x23')](_0x2735('0x25'),_0x4a1d24,_0x2f64c0[_0x2735('0x23')]['message']);return _0x48ec75(_0x2f64c0['error']['message']);}logger[_0x2735('0x23')](_0x2735('0x25'),_0x4a1d24,_0x2f64c0[_0x2735('0x23')][_0x2735('0x26')]);return _0x3fe6eb(_0x2f64c0[_0x2735('0x23')][_0x2735('0x26')]);}else{logger[_0x2735('0x27')](_0x2735('0x25'),_0x4a1d24,_0x2735('0x1f'));_0x3fe6eb(_0x2f64c0[_0x2735('0x28')][_0x2735('0x26')]);}})[_0x2735('0x29')](function(_0x30cd6d){logger[_0x2735('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x4a1d24,_0x30cd6d);_0x48ec75(_0x30cd6d);});});}function respondWithStatusCode(_0x2f6eb9,_0x1640ad){_0x1640ad=_0x1640ad||0xcc;return function(_0x59875b){if(_0x59875b){return _0x2f6eb9[_0x2735('0x2a')](_0x1640ad);}return _0x2f6eb9[_0x2735('0x2b')](_0x1640ad)['end']();};}function respondWithResult(_0x598057,_0x252b30){_0x252b30=_0x252b30||0xc8;return function(_0x2bffd0){if(_0x2bffd0){return _0x598057[_0x2735('0x2b')](_0x252b30)['json'](_0x2bffd0);}};}function respondWithFilteredResult(_0x31cd32,_0x433ea1){return function(_0x524800){if(_0x524800){var _0x3b4cc8=_0x524800[_0x2735('0x2c')],_0x475ae6=_0x433ea1[_0x2735('0x2d')],_0x4030fa=_0x433ea1['offset']+_0x433ea1['limit'],_0x204574;if(_0x4030fa>=_0x3b4cc8){_0x4030fa=_0x3b4cc8;_0x204574=0xc8;}else{_0x204574=0xce;}_0x31cd32[_0x2735('0x2b')](_0x204574);return _0x31cd32[_0x2735('0x2e')](_0x2735('0x2f'),_0x475ae6+'-'+_0x4030fa+'/'+_0x3b4cc8)['json'](_0x524800);}return null;};}function patchUpdates(_0xde4837){return function(_0xb7e290){try{jsonpatch['apply'](_0xb7e290,_0xde4837,!![]);}catch(_0x92db88){return BPromise[_0x2735('0x30')](_0x92db88);}return _0xb7e290['save']();};}function saveUpdates(_0x2a660f,_0x3f891f){return function(_0xea125){if(_0xea125){return _0xea125[_0x2735('0x31')](_0x2a660f)[_0x2735('0x1e')](function(_0x4c8f7a){return _0x4c8f7a;});}return null;};}function removeEntity(_0x408f43,_0x3199d8){return function(_0x4f32bb){if(_0x4f32bb){return _0x4f32bb['destroy']()[_0x2735('0x1e')](function(){_0x408f43[_0x2735('0x2b')](0xcc)[_0x2735('0x32')]();});}};}function handleEntityNotFound(_0x244a42,_0xff9aed){return function(_0x1cc64c){if(!_0x1cc64c){_0x244a42[_0x2735('0x2a')](0x194);}return _0x1cc64c;};}function handleError(_0x4d0f83,_0x36e74b){_0x36e74b=_0x36e74b||0x1f4;return function(_0x25e589){logger[_0x2735('0x23')](_0x25e589[_0x2735('0x33')]);if(_0x25e589[_0x2735('0x34')]){delete _0x25e589[_0x2735('0x34')];}_0x4d0f83[_0x2735('0x2b')](_0x36e74b)[_0x2735('0x35')](_0x25e589);};}exports[_0x2735('0x36')]=function(_0x73c3ad,_0x5d6975){var _0x11d370={},_0x11774e={},_0x53599b={'count':0x0,'rows':[]};var _0x565c94=_[_0x2735('0x37')](db[_0x2735('0x38')][_0x2735('0x39')],function(_0x4f42a6){return{'name':_0x4f42a6[_0x2735('0x3a')],'type':_0x4f42a6[_0x2735('0x3b')]['key']};});_0x11774e[_0x2735('0x3c')]=_[_0x2735('0x37')](_0x565c94,_0x2735('0x34'));_0x11774e[_0x2735('0x3d')]=_[_0x2735('0x3e')](_0x73c3ad[_0x2735('0x3d')]);_0x11774e['filters']=_[_0x2735('0x3f')](_0x11774e[_0x2735('0x3c')],_0x11774e[_0x2735('0x3d')]);_0x11d370[_0x2735('0x40')]=_[_0x2735('0x3f')](_0x11774e[_0x2735('0x3c')],qs[_0x2735('0x41')](_0x73c3ad[_0x2735('0x3d')][_0x2735('0x41')]));_0x11d370[_0x2735('0x40')]=_0x11d370[_0x2735('0x40')]['length']?_0x11d370[_0x2735('0x40')]:_0x11774e[_0x2735('0x3c')];if(!_0x73c3ad[_0x2735('0x3d')]['hasOwnProperty'](_0x2735('0x42'))){_0x11d370[_0x2735('0x43')]=qs[_0x2735('0x43')](_0x73c3ad[_0x2735('0x3d')][_0x2735('0x43')]);_0x11d370[_0x2735('0x2d')]=qs[_0x2735('0x2d')](_0x73c3ad[_0x2735('0x3d')][_0x2735('0x2d')]);}_0x11d370[_0x2735('0x44')]=qs[_0x2735('0x45')](_0x73c3ad[_0x2735('0x3d')][_0x2735('0x45')]);_0x11d370['where']=qs['filters'](_['pick'](_0x73c3ad[_0x2735('0x3d')],_0x11774e[_0x2735('0x46')]),_0x565c94);if(_0x73c3ad['query']['filter']){_0x11d370[_0x2735('0x47')]=_[_0x2735('0x48')](_0x11d370[_0x2735('0x47')],{'$or':_['map'](_0x565c94,function(_0x3cefbb){if(_0x3cefbb[_0x2735('0x3b')]!=='VIRTUAL'){var _0x4d3d6d={};_0x4d3d6d[_0x3cefbb[_0x2735('0x34')]]={'$like':'%'+_0x73c3ad['query'][_0x2735('0x49')]+'%'};return _0x4d3d6d;}})});}_0x11d370=_[_0x2735('0x48')]({},_0x11d370,_0x73c3ad[_0x2735('0x4a')]);var _0x457511={'where':_0x11d370[_0x2735('0x47')]};return db[_0x2735('0x38')][_0x2735('0x2c')](_0x457511)[_0x2735('0x1e')](function(_0x558e29){_0x53599b[_0x2735('0x2c')]=_0x558e29;if(_0x73c3ad['query'][_0x2735('0x4b')]){_0x11d370[_0x2735('0x4c')]=[{'all':!![]}];}return db[_0x2735('0x38')][_0x2735('0x4d')](_0x11d370);})[_0x2735('0x1e')](function(_0x4fecca){_0x53599b['rows']=_0x4fecca;return _0x53599b;})[_0x2735('0x1e')](respondWithFilteredResult(_0x5d6975,_0x11d370))[_0x2735('0x29')](handleError(_0x5d6975,null));};exports[_0x2735('0x4e')]=function(_0x5e4388,_0x53a5b1){var _0x4c1efc={'raw':![],'where':{'id':_0x5e4388[_0x2735('0x4f')]['id']}},_0x1df2d6={};_0x1df2d6[_0x2735('0x3c')]=_['keys'](db[_0x2735('0x38')][_0x2735('0x39')]);_0x1df2d6[_0x2735('0x3d')]=_[_0x2735('0x3e')](_0x5e4388[_0x2735('0x3d')]);_0x1df2d6[_0x2735('0x46')]=_[_0x2735('0x3f')](_0x1df2d6[_0x2735('0x3c')],_0x1df2d6[_0x2735('0x3d')]);_0x4c1efc[_0x2735('0x40')]=_[_0x2735('0x3f')](_0x1df2d6['model'],qs[_0x2735('0x41')](_0x5e4388[_0x2735('0x3d')][_0x2735('0x41')]));_0x4c1efc[_0x2735('0x40')]=_0x4c1efc['attributes'][_0x2735('0x50')]?_0x4c1efc[_0x2735('0x40')]:_0x1df2d6[_0x2735('0x3c')];if(_0x5e4388['query'][_0x2735('0x4b')]){_0x4c1efc[_0x2735('0x4c')]=[{'all':!![]}];}_0x4c1efc=_[_0x2735('0x48')]({},_0x4c1efc,_0x5e4388['options']);return db[_0x2735('0x38')]['find'](_0x4c1efc)[_0x2735('0x1e')](handleEntityNotFound(_0x53a5b1,null))[_0x2735('0x1e')](respondWithResult(_0x53a5b1,null))['catch'](handleError(_0x53a5b1,null));};exports[_0x2735('0x51')]=function(_0x334301,_0x9f27af){return db[_0x2735('0x38')][_0x2735('0x51')](_0x334301['body'],{})['then'](respondWithResult(_0x9f27af,0xc9))[_0x2735('0x29')](handleError(_0x9f27af,null));};exports[_0x2735('0x31')]=function(_0x586968,_0x17d9eb){if(_0x586968[_0x2735('0x52')]['id']){delete _0x586968[_0x2735('0x52')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x586968[_0x2735('0x4f')]['id']}})[_0x2735('0x1e')](handleEntityNotFound(_0x17d9eb,null))[_0x2735('0x1e')](saveUpdates(_0x586968[_0x2735('0x52')],null))['then'](respondWithResult(_0x17d9eb,null))[_0x2735('0x29')](handleError(_0x17d9eb,null));};exports['destroy']=function(_0x43eb50,_0x337df9){return db['SalesforceAccount'][_0x2735('0x53')]({'where':{'id':_0x43eb50['params']['id']}})[_0x2735('0x1e')](handleEntityNotFound(_0x337df9,null))['then'](removeEntity(_0x337df9,null))[_0x2735('0x29')](handleError(_0x337df9,null));};exports[_0x2735('0x54')]=function(_0x97fe35,_0xb04b7d,_0x2b109e){var _0x5dabda={};var _0x8b75c5={};var _0x2e8a6c;var _0x449f38;return db['SalesforceAccount']['findOne']({'where':{'id':_0x97fe35[_0x2735('0x4f')]['id']}})[_0x2735('0x1e')](handleEntityNotFound(_0xb04b7d,null))['then'](function(_0x42ff5f){if(_0x42ff5f){_0x2e8a6c=_0x42ff5f;_0x8b75c5[_0x2735('0x3c')]=_[_0x2735('0x3e')](db[_0x2735('0x55')][_0x2735('0x39')]);_0x8b75c5[_0x2735('0x3d')]=_[_0x2735('0x3e')](_0x97fe35[_0x2735('0x3d')]);_0x8b75c5['filters']=_[_0x2735('0x3f')](_0x8b75c5['model'],_0x8b75c5['query']);_0x5dabda[_0x2735('0x40')]=_[_0x2735('0x3f')](_0x8b75c5[_0x2735('0x3c')],qs[_0x2735('0x41')](_0x97fe35['query'][_0x2735('0x41')]));_0x5dabda[_0x2735('0x40')]=_0x5dabda['attributes'][_0x2735('0x50')]?_0x5dabda[_0x2735('0x40')]:_0x8b75c5[_0x2735('0x3c')];_0x5dabda[_0x2735('0x44')]=qs[_0x2735('0x45')](_0x97fe35['query'][_0x2735('0x45')]);_0x5dabda[_0x2735('0x47')]=qs[_0x2735('0x46')](_[_0x2735('0x56')](_0x97fe35[_0x2735('0x3d')],_0x8b75c5[_0x2735('0x46')]));if(_0x97fe35[_0x2735('0x3d')][_0x2735('0x49')]){_0x5dabda['where']=_[_0x2735('0x48')](_0x5dabda['where'],{'$or':_[_0x2735('0x37')](_0x5dabda[_0x2735('0x40')],function(_0x498e64){var _0x435cca={};_0x435cca[_0x498e64]={'$like':'%'+_0x97fe35[_0x2735('0x3d')]['filter']+'%'};return _0x435cca;})});}_0x5dabda=_['merge']({},_0x5dabda,_0x97fe35[_0x2735('0x4a')]);return _0x2e8a6c[_0x2735('0x54')](_0x5dabda);}})['then'](function(_0x551cfd){if(_0x551cfd){_0x449f38=_0x551cfd['length'];if(!_0x97fe35['query'][_0x2735('0x57')](_0x2735('0x42'))){_0x5dabda['limit']=qs['limit'](_0x97fe35[_0x2735('0x3d')][_0x2735('0x43')]);_0x5dabda['offset']=qs[_0x2735('0x2d')](_0x97fe35['query'][_0x2735('0x2d')]);}return _0x2e8a6c[_0x2735('0x54')](_0x5dabda);}})[_0x2735('0x1e')](function(_0x3a8673){if(_0x3a8673){return _0x3a8673?{'count':_0x449f38,'rows':_0x3a8673}:null;}})[_0x2735('0x1e')](respondWithResult(_0xb04b7d,null))[_0x2735('0x29')](handleError(_0xb04b7d,null));};exports[_0x2735('0x58')]=function(_0x3de4c6,_0xcef548,_0x6ba923){if(_0x3de4c6[_0x2735('0x52')]['id']){delete _0x3de4c6[_0x2735('0x52')]['id'];}return db[_0x2735('0x38')][_0x2735('0x59')]({'where':{'id':_0x3de4c6[_0x2735('0x4f')]['id']}})[_0x2735('0x1e')](handleEntityNotFound(_0xcef548,null))[_0x2735('0x1e')](function(_0x33d456){if(_0x33d456){_0x3de4c6['body']['AccountId']=_0x33d456['id'];_0x3de4c6[_0x2735('0x52')][_0x2735('0x5a')]=integrations[_0x2735('0x5b')](_0x3de4c6['body'][_0x2735('0x5c')],_0x3de4c6[_0x2735('0x52')]['type']);_0x3de4c6['body'][_0x2735('0x5d')]=integrations[_0x2735('0x5e')](_0x3de4c6[_0x2735('0x52')]['channel'],_0x3de4c6[_0x2735('0x52')][_0x2735('0x3b')]);return db['SalesforceConfiguration']['create'](_0x3de4c6['body'],{'include':[{'model':db[_0x2735('0x5f')],'as':'Subjects'},{'model':db[_0x2735('0x5f')],'as':_0x2735('0x5d')}]});}return null;})['then'](respondWithResult(_0xcef548,null))['catch'](handleError(_0xcef548,null));};exports[_0x2735('0x60')]=function(_0x37f7c8,_0xfc4b65,_0x7fa041){var _0x5dec1a;var _0x4480f5='';var _0x5ec57a=_0x2735('0x61');return db[_0x2735('0x38')]['findOne']({'where':{'id':_0x37f7c8[_0x2735('0x4f')]['id']},'attributes':['id','remoteUri',_0x2735('0x62'),_0x2735('0x63'),_0x2735('0x64'),_0x2735('0x65'),_0x2735('0x66')]})[_0x2735('0x1e')](handleEntityNotFound(_0xfc4b65,null))['then'](function(_0x45b94d){if(_0x45b94d){_0x4480f5=_0x45b94d['remoteUri'];var _0x48994f=_0x4480f5[_0x2735('0x67')](-0x1);if(_0x48994f==='/'){_0x4480f5=_0x4480f5[_0x2735('0x68')](0x0,_0x4480f5[_0x2735('0x69')](_0x48994f));}_0x5dec1a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4480f5,'clientId':_0x45b94d[_0x2735('0x62')],'clientSecret':_0x45b94d[_0x2735('0x63')]}});return _0x5dec1a[_0x2735('0x6a')](_0x45b94d[_0x2735('0x64')],_0x45b94d[_0x2735('0x65')]['concat'](_0x45b94d[_0x2735('0x66')]));}})[_0x2735('0x1e')](function(_0x4c60f3){if(_0x4c60f3){if(!_[_0x2735('0x6b')](_0x37f7c8[_0x2735('0x3d')][_0x2735('0x6c')])){_0x5ec57a=_0x37f7c8['query'][_0x2735('0x6c')];}return _0x5dec1a[_0x2735('0x6d')](_0x5ec57a)[_0x2735('0x6e')]();}})[_0x2735('0x1e')](function(_0xd19f34){var _0x1dbea6=['CallDisposition',_0x2735('0x6f'),_0x2735('0x70'),_0x2735('0x71'),'IsArchived',_0x2735('0x72'),'Status',_0x2735('0x73')];if(!_[_0x2735('0x6b')](_0x37f7c8[_0x2735('0x3d')][_0x2735('0x6c')])&&_0x37f7c8['query'][_0x2735('0x6c')]===_0x2735('0x74')){_0x1dbea6=[_0x2735('0x73'),_0x2735('0x75'),'Reason',_0x2735('0x76'),_0x2735('0x72'),_0x2735('0x77'),_0x2735('0x78'),'SuppliedCompany'];}if(_0xd19f34){_[_0x2735('0x79')](_0xd19f34[_0x2735('0x41')],function(_0x131c3f){return _0x131c3f['custom']===![]&&!_0x1dbea6[_0x2735('0x7a')](_0x131c3f[_0x2735('0x34')]);});return{'count':_0xd19f34['fields'][_0x2735('0x50')],'rows':_[_0x2735('0x37')](_0xd19f34['fields'],function(_0x35dde5){return{'id':_0x35dde5[_0x2735('0x34')],'name':_0x35dde5[_0x2735('0x7b')],'custom':_0x35dde5[_0x2735('0x7c')],'options':_0x35dde5[_0x2735('0x7d')][_0x2735('0x50')]>0x0?_[_0x2735('0x37')](_0x35dde5[_0x2735('0x7d')],function(_0xef3148){return{'name':_0xef3148[_0x2735('0x7b')],'value':_0xef3148['value']};}):_0x35dde5[_0x2735('0x3b')]=='boolean'?[{'name':_0x2735('0x7e'),'value':_0x2735('0x7f')},{'name':_0x2735('0x80'),'value':_0x2735('0x81')}]:[]};})};}})[_0x2735('0x1e')](respondWithResult(_0xfc4b65,null))[_0x2735('0x29')](function(_0x1d8b5a){var _0x5e5b44=_0x37f7c8['query'][_0x2735('0x1a')]?0x1f4:_0x1d8b5a[_0x2735('0x82')]||0x1f4;logger[_0x2735('0x23')](_0x2735('0x83'),_0x2735('0x60'),_0x5e5b44,JSON[_0x2735('0x22')](_0x1d8b5a));delete _0x1d8b5a[_0x2735('0x34')];if(_0x5e5b44===0x191){_0x5e5b44=0x190;}_0xfc4b65['status'](_0x5e5b44)[_0x2735('0x35')](_0x37f7c8[_0x2735('0x3d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1d8b5a[_0x2735('0x82')]}:_0x1d8b5a);});}; \ No newline at end of file +var _0x4a5e=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','SalesforceAccount','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','create','body','find','getConfigurations','findOne','SalesforceConfiguration','pick','map','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','Connection','clientId','login','concat','isNil','ticketType','sobject','CallDurationInSeconds','CallType','Priority','Type','Origin','Status','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','false','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x457673,_0x246c06){var _0x62e14=function(_0x33a69a){while(--_0x33a69a){_0x457673['push'](_0x457673['shift']());}};_0x62e14(++_0x246c06);}(_0x4a5e,0x179));var _0xe4a5=function(_0xc78832,_0x27a347){_0xc78832=_0xc78832-0x0;var _0x21753a=_0x4a5e[_0xc78832];return _0x21753a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe4a5('0x0'));var zipdir=require(_0xe4a5('0x1'));var jsonpatch=require(_0xe4a5('0x2'));var rp=require(_0xe4a5('0x3'));var moment=require(_0xe4a5('0x4'));var BPromise=require(_0xe4a5('0x5'));var Mustache=require(_0xe4a5('0x6'));var util=require(_0xe4a5('0x7'));var path=require(_0xe4a5('0x8'));var sox=require(_0xe4a5('0x9'));var csv=require(_0xe4a5('0xa'));var ejs=require(_0xe4a5('0xb'));var fs=require('fs');var _=require(_0xe4a5('0xc'));var squel=require(_0xe4a5('0xd'));var crypto=require(_0xe4a5('0xe'));var jsforce=require(_0xe4a5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe4a5('0xa'));var querystring=require('querystring');var Papa=require(_0xe4a5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe4a5('0x11'));var as=require(_0xe4a5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe4a5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xe4a5('0x14'));var jayson=require(_0xe4a5('0x15'));var client=jayson[_0xe4a5('0x16')][_0xe4a5('0x17')]({'port':0x232a});function checkPasswordPattern(_0x74b2bc,_0x576146,_0x10e8f0){if(_0x10e8f0){var _0x54968d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54968d[_0xe4a5('0x18')](_0x576146)){return _0x74b2bc;}else{throw new db[(_0xe4a5('0x19'))][(_0xe4a5('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 _0x74b2bc;}}function respondWithRpcPromise(_0x4b28f6,_0xe975cb,_0x23a8cb,_0x5873d3){return new BPromise(function(_0x34a8e1,_0xa44ae4){var _0x2ee5c7=_0x5873d3||client;return _0x2ee5c7[_0xe4a5('0x1b')](_0x4b28f6,_0x23a8cb)[_0xe4a5('0x1c')](function(_0xeeca84){logger[_0xe4a5('0x1d')](_0xe4a5('0x1e'),_0xe975cb,_0xe4a5('0x1f'));logger['debug'](_0xe4a5('0x20'),_0xe975cb,_0xe4a5('0x1f'),JSON['stringify'](_0xeeca84));if(_0xeeca84[_0xe4a5('0x21')]){if(_0xeeca84[_0xe4a5('0x21')][_0xe4a5('0x22')]===0x1f4){logger[_0xe4a5('0x21')](_0xe4a5('0x1e'),_0xe975cb,_0xeeca84['error'][_0xe4a5('0x23')]);return _0xa44ae4(_0xeeca84[_0xe4a5('0x21')]['message']);}logger[_0xe4a5('0x21')](_0xe4a5('0x1e'),_0xe975cb,_0xeeca84['error'][_0xe4a5('0x23')]);return _0x34a8e1(_0xeeca84[_0xe4a5('0x21')][_0xe4a5('0x23')]);}else{logger[_0xe4a5('0x1d')](_0xe4a5('0x1e'),_0xe975cb,_0xe4a5('0x1f'));_0x34a8e1(_0xeeca84[_0xe4a5('0x24')]['message']);}})[_0xe4a5('0x25')](function(_0xe489ac){logger['error'](_0xe4a5('0x1e'),_0xe975cb,_0xe489ac);_0xa44ae4(_0xe489ac);});});}function respondWithStatusCode(_0x342d34,_0x5c7868){_0x5c7868=_0x5c7868||0xcc;return function(_0x2eb4d6){if(_0x2eb4d6){return _0x342d34[_0xe4a5('0x26')](_0x5c7868);}return _0x342d34[_0xe4a5('0x27')](_0x5c7868)['end']();};}function respondWithResult(_0x2d0352,_0x59022d){_0x59022d=_0x59022d||0xc8;return function(_0x84ea2a){if(_0x84ea2a){return _0x2d0352[_0xe4a5('0x27')](_0x59022d)[_0xe4a5('0x28')](_0x84ea2a);}};}function respondWithFilteredResult(_0x1d2faf,_0x2e3f6f){return function(_0x530d93){if(_0x530d93){var _0x4eca24=_0x530d93[_0xe4a5('0x29')],_0x11f795=_0x2e3f6f[_0xe4a5('0x2a')],_0x2baad9=_0x2e3f6f[_0xe4a5('0x2a')]+_0x2e3f6f[_0xe4a5('0x2b')],_0x2c6145;if(_0x2baad9>=_0x4eca24){_0x2baad9=_0x4eca24;_0x2c6145=0xc8;}else{_0x2c6145=0xce;}_0x1d2faf[_0xe4a5('0x27')](_0x2c6145);return _0x1d2faf[_0xe4a5('0x2c')]('Content-Range',_0x11f795+'-'+_0x2baad9+'/'+_0x4eca24)[_0xe4a5('0x28')](_0x530d93);}return null;};}function patchUpdates(_0x44bd30){return function(_0x1d8af8){try{jsonpatch[_0xe4a5('0x2d')](_0x1d8af8,_0x44bd30,!![]);}catch(_0x223675){return BPromise[_0xe4a5('0x2e')](_0x223675);}return _0x1d8af8[_0xe4a5('0x2f')]();};}function saveUpdates(_0x35c6bb,_0x1a82f7){return function(_0x379cbd){if(_0x379cbd){return _0x379cbd[_0xe4a5('0x30')](_0x35c6bb)[_0xe4a5('0x1c')](function(_0xeb58da){return _0xeb58da;});}return null;};}function removeEntity(_0x3333e0,_0x4074c0){return function(_0xfc64aa){if(_0xfc64aa){return _0xfc64aa['destroy']()['then'](function(){_0x3333e0[_0xe4a5('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268991,_0x492b1d){return function(_0x321574){if(!_0x321574){_0x268991[_0xe4a5('0x26')](0x194);}return _0x321574;};}function handleError(_0x4aaa84,_0x5377dd){_0x5377dd=_0x5377dd||0x1f4;return function(_0x184394){logger[_0xe4a5('0x21')](_0x184394[_0xe4a5('0x31')]);if(_0x184394['name']){delete _0x184394[_0xe4a5('0x32')];}_0x4aaa84['status'](_0x5377dd)[_0xe4a5('0x33')](_0x184394);};}exports[_0xe4a5('0x34')]=function(_0x4a356d,_0x44bb92){var _0x1b4817={},_0x5ef061={},_0x1be55a={'count':0x0,'rows':[]};var _0x1a5d1f=_['map'](db[_0xe4a5('0x35')]['rawAttributes'],function(_0x375d4f){return{'name':_0x375d4f['fieldName'],'type':_0x375d4f[_0xe4a5('0x36')]['key']};});_0x5ef061[_0xe4a5('0x37')]=_['map'](_0x1a5d1f,_0xe4a5('0x32'));_0x5ef061[_0xe4a5('0x38')]=_[_0xe4a5('0x39')](_0x4a356d['query']);_0x5ef061[_0xe4a5('0x3a')]=_[_0xe4a5('0x3b')](_0x5ef061['model'],_0x5ef061['query']);_0x1b4817[_0xe4a5('0x3c')]=_[_0xe4a5('0x3b')](_0x5ef061[_0xe4a5('0x37')],qs[_0xe4a5('0x3d')](_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x3d')]));_0x1b4817[_0xe4a5('0x3c')]=_0x1b4817[_0xe4a5('0x3c')][_0xe4a5('0x3e')]?_0x1b4817[_0xe4a5('0x3c')]:_0x5ef061[_0xe4a5('0x37')];if(!_0x4a356d['query'][_0xe4a5('0x3f')](_0xe4a5('0x40'))){_0x1b4817[_0xe4a5('0x2b')]=qs['limit'](_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x2b')]);_0x1b4817[_0xe4a5('0x2a')]=qs[_0xe4a5('0x2a')](_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x2a')]);}_0x1b4817[_0xe4a5('0x41')]=qs[_0xe4a5('0x42')](_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x42')]);_0x1b4817[_0xe4a5('0x43')]=qs[_0xe4a5('0x3a')](_['pick'](_0x4a356d[_0xe4a5('0x38')],_0x5ef061['filters']),_0x1a5d1f);if(_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x44')]){_0x1b4817[_0xe4a5('0x43')]=_[_0xe4a5('0x45')](_0x1b4817[_0xe4a5('0x43')],{'$or':_['map'](_0x1a5d1f,function(_0x4fa5b4){if(_0x4fa5b4[_0xe4a5('0x36')]!==_0xe4a5('0x46')){var _0x11ee0e={};_0x11ee0e[_0x4fa5b4[_0xe4a5('0x32')]]={'$like':'%'+_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x44')]+'%'};return _0x11ee0e;}})});}_0x1b4817=_[_0xe4a5('0x45')]({},_0x1b4817,_0x4a356d[_0xe4a5('0x47')]);var _0x470eb8={'where':_0x1b4817['where']};return db[_0xe4a5('0x35')][_0xe4a5('0x29')](_0x470eb8)[_0xe4a5('0x1c')](function(_0x3e4c2f){_0x1be55a[_0xe4a5('0x29')]=_0x3e4c2f;if(_0x4a356d[_0xe4a5('0x38')][_0xe4a5('0x48')]){_0x1b4817[_0xe4a5('0x49')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xe4a5('0x4a')](_0x1b4817);})[_0xe4a5('0x1c')](function(_0x1848af){_0x1be55a['rows']=_0x1848af;return _0x1be55a;})[_0xe4a5('0x1c')](respondWithFilteredResult(_0x44bb92,_0x1b4817))[_0xe4a5('0x25')](handleError(_0x44bb92,null));};exports[_0xe4a5('0x4b')]=function(_0x34d38c,_0x31b3b7){var _0x57c8ee={'raw':![],'where':{'id':_0x34d38c[_0xe4a5('0x4c')]['id']}},_0x1dcd42={};_0x1dcd42[_0xe4a5('0x37')]=_[_0xe4a5('0x39')](db['SalesforceAccount'][_0xe4a5('0x4d')]);_0x1dcd42[_0xe4a5('0x38')]=_[_0xe4a5('0x39')](_0x34d38c[_0xe4a5('0x38')]);_0x1dcd42[_0xe4a5('0x3a')]=_[_0xe4a5('0x3b')](_0x1dcd42[_0xe4a5('0x37')],_0x1dcd42[_0xe4a5('0x38')]);_0x57c8ee[_0xe4a5('0x3c')]=_['intersection'](_0x1dcd42[_0xe4a5('0x37')],qs[_0xe4a5('0x3d')](_0x34d38c[_0xe4a5('0x38')][_0xe4a5('0x3d')]));_0x57c8ee[_0xe4a5('0x3c')]=_0x57c8ee['attributes']['length']?_0x57c8ee['attributes']:_0x1dcd42[_0xe4a5('0x37')];if(_0x34d38c['query'][_0xe4a5('0x48')]){_0x57c8ee[_0xe4a5('0x49')]=[{'all':!![]}];}_0x57c8ee=_[_0xe4a5('0x45')]({},_0x57c8ee,_0x34d38c[_0xe4a5('0x47')]);return db[_0xe4a5('0x35')]['find'](_0x57c8ee)[_0xe4a5('0x1c')](handleEntityNotFound(_0x31b3b7,null))['then'](respondWithResult(_0x31b3b7,null))[_0xe4a5('0x25')](handleError(_0x31b3b7,null));};exports[_0xe4a5('0x4e')]=function(_0x162a99,_0x49a118){return db['SalesforceAccount']['create'](_0x162a99[_0xe4a5('0x4f')],{})[_0xe4a5('0x1c')](respondWithResult(_0x49a118,0xc9))[_0xe4a5('0x25')](handleError(_0x49a118,null));};exports['update']=function(_0x50ac1a,_0x47bd83){if(_0x50ac1a[_0xe4a5('0x4f')]['id']){delete _0x50ac1a['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x50ac1a[_0xe4a5('0x4c')]['id']}})[_0xe4a5('0x1c')](handleEntityNotFound(_0x47bd83,null))[_0xe4a5('0x1c')](saveUpdates(_0x50ac1a[_0xe4a5('0x4f')],null))[_0xe4a5('0x1c')](respondWithResult(_0x47bd83,null))[_0xe4a5('0x25')](handleError(_0x47bd83,null));};exports['destroy']=function(_0x5517af,_0x442e12){return db[_0xe4a5('0x35')][_0xe4a5('0x50')]({'where':{'id':_0x5517af[_0xe4a5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x442e12,null))[_0xe4a5('0x1c')](removeEntity(_0x442e12,null))['catch'](handleError(_0x442e12,null));};exports[_0xe4a5('0x51')]=function(_0x19d5d6,_0x552d17,_0x476c37){var _0x2fc8c2={};var _0x506e58={};var _0x67c0af;var _0x55f78c;return db[_0xe4a5('0x35')][_0xe4a5('0x52')]({'where':{'id':_0x19d5d6['params']['id']}})[_0xe4a5('0x1c')](handleEntityNotFound(_0x552d17,null))[_0xe4a5('0x1c')](function(_0x20ad96){if(_0x20ad96){_0x67c0af=_0x20ad96;_0x506e58['model']=_[_0xe4a5('0x39')](db[_0xe4a5('0x53')][_0xe4a5('0x4d')]);_0x506e58[_0xe4a5('0x38')]=_[_0xe4a5('0x39')](_0x19d5d6[_0xe4a5('0x38')]);_0x506e58[_0xe4a5('0x3a')]=_[_0xe4a5('0x3b')](_0x506e58[_0xe4a5('0x37')],_0x506e58[_0xe4a5('0x38')]);_0x2fc8c2[_0xe4a5('0x3c')]=_[_0xe4a5('0x3b')](_0x506e58[_0xe4a5('0x37')],qs['fields'](_0x19d5d6[_0xe4a5('0x38')]['fields']));_0x2fc8c2[_0xe4a5('0x3c')]=_0x2fc8c2[_0xe4a5('0x3c')][_0xe4a5('0x3e')]?_0x2fc8c2[_0xe4a5('0x3c')]:_0x506e58[_0xe4a5('0x37')];_0x2fc8c2[_0xe4a5('0x41')]=qs[_0xe4a5('0x42')](_0x19d5d6[_0xe4a5('0x38')]['sort']);_0x2fc8c2[_0xe4a5('0x43')]=qs['filters'](_[_0xe4a5('0x54')](_0x19d5d6[_0xe4a5('0x38')],_0x506e58[_0xe4a5('0x3a')]));if(_0x19d5d6[_0xe4a5('0x38')][_0xe4a5('0x44')]){_0x2fc8c2['where']=_['merge'](_0x2fc8c2[_0xe4a5('0x43')],{'$or':_[_0xe4a5('0x55')](_0x2fc8c2[_0xe4a5('0x3c')],function(_0x4287fd){var _0x1ca048={};_0x1ca048[_0x4287fd]={'$like':'%'+_0x19d5d6[_0xe4a5('0x38')][_0xe4a5('0x44')]+'%'};return _0x1ca048;})});}_0x2fc8c2=_[_0xe4a5('0x45')]({},_0x2fc8c2,_0x19d5d6[_0xe4a5('0x47')]);return _0x67c0af[_0xe4a5('0x51')](_0x2fc8c2);}})[_0xe4a5('0x1c')](function(_0x308843){if(_0x308843){_0x55f78c=_0x308843[_0xe4a5('0x3e')];if(!_0x19d5d6[_0xe4a5('0x38')]['hasOwnProperty'](_0xe4a5('0x40'))){_0x2fc8c2['limit']=qs[_0xe4a5('0x2b')](_0x19d5d6[_0xe4a5('0x38')][_0xe4a5('0x2b')]);_0x2fc8c2['offset']=qs[_0xe4a5('0x2a')](_0x19d5d6[_0xe4a5('0x38')][_0xe4a5('0x2a')]);}return _0x67c0af['getConfigurations'](_0x2fc8c2);}})[_0xe4a5('0x1c')](function(_0x227c52){if(_0x227c52){return _0x227c52?{'count':_0x55f78c,'rows':_0x227c52}:null;}})[_0xe4a5('0x1c')](respondWithResult(_0x552d17,null))[_0xe4a5('0x25')](handleError(_0x552d17,null));};exports[_0xe4a5('0x56')]=function(_0x264372,_0x4a2233,_0x2cffa1){if(_0x264372['body']['id']){delete _0x264372[_0xe4a5('0x4f')]['id'];}return db[_0xe4a5('0x35')]['findOne']({'where':{'id':_0x264372[_0xe4a5('0x4c')]['id']}})[_0xe4a5('0x1c')](handleEntityNotFound(_0x4a2233,null))[_0xe4a5('0x1c')](function(_0x430144){if(_0x430144){_0x264372[_0xe4a5('0x4f')][_0xe4a5('0x57')]=_0x430144['id'];_0x264372['body'][_0xe4a5('0x58')]=integrations[_0xe4a5('0x59')](_0x264372['body']['channel'],_0x264372[_0xe4a5('0x4f')][_0xe4a5('0x36')]);_0x264372[_0xe4a5('0x4f')][_0xe4a5('0x5a')]=integrations[_0xe4a5('0x5b')](_0x264372[_0xe4a5('0x4f')][_0xe4a5('0x5c')],_0x264372['body'][_0xe4a5('0x36')]);return db['SalesforceConfiguration'][_0xe4a5('0x4e')](_0x264372[_0xe4a5('0x4f')],{'include':[{'model':db[_0xe4a5('0x5d')],'as':_0xe4a5('0x58')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xe4a5('0x1c')](respondWithResult(_0x4a2233,null))[_0xe4a5('0x25')](handleError(_0x4a2233,null));};exports[_0xe4a5('0x5e')]=function(_0x158c55,_0x2135b7,_0x1e0130){var _0x750118;var _0x3c0b29='';var _0x59d5a1=_0xe4a5('0x5f');return db['SalesforceAccount'][_0xe4a5('0x52')]({'where':{'id':_0x158c55[_0xe4a5('0x4c')]['id']},'attributes':['id',_0xe4a5('0x60'),'clientId',_0xe4a5('0x61'),_0xe4a5('0x62'),_0xe4a5('0x63'),_0xe4a5('0x64')]})[_0xe4a5('0x1c')](handleEntityNotFound(_0x2135b7,null))[_0xe4a5('0x1c')](function(_0x48ac2c){if(_0x48ac2c){_0x3c0b29=_0x48ac2c[_0xe4a5('0x60')];var _0x16d596=_0x3c0b29['slice'](-0x1);if(_0x16d596==='/'){_0x3c0b29=_0x3c0b29[_0xe4a5('0x65')](0x0,_0x3c0b29['lastIndexOf'](_0x16d596));}_0x750118=new jsforce[(_0xe4a5('0x66'))]({'oauth2':{'loginUrl':_0x3c0b29,'clientId':_0x48ac2c[_0xe4a5('0x67')],'clientSecret':_0x48ac2c[_0xe4a5('0x61')]}});return _0x750118[_0xe4a5('0x68')](_0x48ac2c[_0xe4a5('0x62')],_0x48ac2c['password'][_0xe4a5('0x69')](_0x48ac2c[_0xe4a5('0x64')]));}})[_0xe4a5('0x1c')](function(_0x1b72c8){if(_0x1b72c8){if(!_[_0xe4a5('0x6a')](_0x158c55[_0xe4a5('0x38')]['ticketType'])){_0x59d5a1=_0x158c55[_0xe4a5('0x38')][_0xe4a5('0x6b')];}return _0x750118[_0xe4a5('0x6c')](_0x59d5a1)['describe']();}})[_0xe4a5('0x1c')](function(_0x1f66ac){var _0x4310f7=['CallDisposition',_0xe4a5('0x6d'),'CallObject',_0xe4a5('0x6e'),'IsArchived',_0xe4a5('0x6f'),'Status',_0xe4a5('0x70')];if(!_[_0xe4a5('0x6a')](_0x158c55[_0xe4a5('0x38')][_0xe4a5('0x6b')])&&_0x158c55['query'][_0xe4a5('0x6b')]==='Case'){_0x4310f7=[_0xe4a5('0x70'),_0xe4a5('0x71'),'Reason',_0xe4a5('0x72'),_0xe4a5('0x6f'),_0xe4a5('0x73'),_0xe4a5('0x74'),_0xe4a5('0x75')];}if(_0x1f66ac){_[_0xe4a5('0x76')](_0x1f66ac[_0xe4a5('0x3d')],function(_0x206c71){return _0x206c71[_0xe4a5('0x77')]===![]&&!_0x4310f7[_0xe4a5('0x78')](_0x206c71[_0xe4a5('0x32')]);});return{'count':_0x1f66ac[_0xe4a5('0x3d')][_0xe4a5('0x3e')],'rows':_[_0xe4a5('0x55')](_0x1f66ac[_0xe4a5('0x3d')],function(_0x65d357){return{'id':_0x65d357[_0xe4a5('0x32')],'name':_0x65d357[_0xe4a5('0x79')],'custom':_0x65d357[_0xe4a5('0x77')],'options':_0x65d357[_0xe4a5('0x7a')]['length']>0x0?_[_0xe4a5('0x55')](_0x65d357[_0xe4a5('0x7a')],function(_0x52a96f){return{'name':_0x52a96f[_0xe4a5('0x79')],'value':_0x52a96f['value']};}):_0x65d357[_0xe4a5('0x36')]=='boolean'?[{'name':'True','value':'true'},{'name':'False','value':_0xe4a5('0x7b')}]:[]};})};}})[_0xe4a5('0x1c')](respondWithResult(_0x2135b7,null))[_0xe4a5('0x25')](function(_0x519bab){var _0x4d1512=_0x158c55[_0xe4a5('0x38')][_0xe4a5('0x18')]?0x1f4:_0x519bab['statusCode']||0x1f4;logger[_0xe4a5('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0xe4a5('0x5e'),_0x4d1512,JSON[_0xe4a5('0x7c')](_0x519bab));delete _0x519bab[_0xe4a5('0x32')];if(_0x4d1512===0x191){_0x4d1512=0x190;}_0x2135b7[_0xe4a5('0x27')](_0x4d1512)['send'](_0x158c55[_0xe4a5('0x38')][_0xe4a5('0x18')]?{'message':_0xe4a5('0x7d'),'statusCode':_0x519bab[_0xe4a5('0x7e')]}:_0x519bab);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 188ae6c..8131bb8 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 _0xfbcf=['int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x5f1c73,_0x4f9432){var _0x3c1fa4=function(_0x334bd2){while(--_0x334bd2){_0x5f1c73['push'](_0x5f1c73['shift']());}};_0x3c1fa4(++_0x4f9432);}(_0xfbcf,0xb5));var _0xffbc=function(_0x3914f9,_0x3ca373){_0x3914f9=_0x3914f9-0x0;var _0x1594c6=_0xfbcf[_0x3914f9];return _0x1594c6;};'use strict';var _=require(_0xffbc('0x0'));var util=require(_0xffbc('0x1'));var logger=require('../../config/logger')(_0xffbc('0x2'));var moment=require(_0xffbc('0x3'));var BPromise=require(_0xffbc('0x4'));var rp=require(_0xffbc('0x5'));var fs=require('fs');var path=require(_0xffbc('0x6'));var rimraf=require(_0xffbc('0x7'));var config=require(_0xffbc('0x8'));var attributes=require(_0xffbc('0x9'));var integrations=require(_0xffbc('0xa'));module[_0xffbc('0xb')]=function(_0x32426f,_0x968868){return _0x32426f[_0xffbc('0xc')](_0xffbc('0xd'),attributes,{'tableName':_0xffbc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d88=['SalesforceAccount','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','define'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x7d88,0x9a));var _0x87d8=function(_0x52f019,_0x4c3f76){_0x52f019=_0x52f019-0x0;var _0x490049=_0x7d88[_0x52f019];return _0x490049;};'use strict';var _=require(_0x87d8('0x0'));var util=require(_0x87d8('0x1'));var logger=require(_0x87d8('0x2'))('api');var moment=require(_0x87d8('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d8('0x4'));var fs=require('fs');var path=require(_0x87d8('0x5'));var rimraf=require('rimraf');var config=require(_0x87d8('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x368472,_0x2d5cc8){return _0x368472[_0x87d8('0x7')](_0x87d8('0x8'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index c0d944b..c23dadd 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 _0xe14d=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xe14d,0x1ee));var _0xde14=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xe14d[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')]({'raw':_0x3cc317[_0xde14('0x1c')]?_0x3cc317['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cc317['options']?_0x3cc317[_0xde14('0x1c')]['where']||null:null,'attributes':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1e')]||null:null,'limit':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1f')]||null:null,'include':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')]?_[_0xde14('0x21')](_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')],function(_0x8f8033){return{'model':db[_0x8f8033['model']],'as':_0x8f8033['as'],'attributes':_0x8f8033[_0xde14('0x1e')],'include':_0x8f8033[_0xde14('0x20')]?_[_0xde14('0x21')](_0x8f8033[_0xde14('0x20')],function(_0x1bb7be){return{'model':db[_0x1bb7be[_0xde14('0x22')]],'as':_0x1bb7be['as'],'attributes':_0x1bb7be[_0xde14('0x1e')],'include':_0x1bb7be[_0xde14('0x20')]?_[_0xde14('0x21')](_0x1bb7be[_0xde14('0x20')],function(_0x4eff65){return{'model':db[_0x4eff65[_0xde14('0x22')]],'as':_0x4eff65['as'],'attributes':_0x4eff65[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0xf8279a){logger['info'](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON['stringify'](_0xf8279a));_0x590a8b(_0xf8279a);})[_0xde14('0x18')](function(_0x582537){logger[_0xde14('0x14')](_0xde14('0x19'),_0x582537[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x582537[_0xde14('0x16')]));});});};exports[_0xde14('0x23')]=function(_0xae9dca){var _0x464666=this;return new Promise(function(_0x4e7c5b,_0xbfc01b){return db[_0xde14('0x1a')]['find']({'raw':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0xae9dca[_0xde14('0x1c')]?_0xae9dca[_0xde14('0x1c')][_0xde14('0x24')]||null:null,'attributes':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1e')]||null:null,'include':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x20')]?_[_0xde14('0x21')](_0xae9dca[_0xde14('0x1c')][_0xde14('0x20')],function(_0x2713fb){return{'model':db[_0x2713fb[_0xde14('0x22')]],'as':_0x2713fb['as'],'attributes':_0x2713fb[_0xde14('0x1e')],'include':_0x2713fb[_0xde14('0x20')]?_[_0xde14('0x21')](_0x2713fb['include'],function(_0x50084f){return{'model':db[_0x50084f[_0xde14('0x22')]],'as':_0x50084f['as'],'attributes':_0x50084f[_0xde14('0x1e')],'include':_0x50084f[_0xde14('0x20')]?_[_0xde14('0x21')](_0x50084f[_0xde14('0x20')],function(_0x23813f){return{'model':db[_0x23813f[_0xde14('0x22')]],'as':_0x23813f['as'],'attributes':_0x23813f[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0x4e33e0){logger[_0xde14('0xe')]('ShowSalesforceAccount',_0xae9dca);logger['debug']('ShowSalesforceAccount',_0xae9dca,JSON[_0xde14('0x13')](_0x4e33e0));_0x4e7c5b(_0x4e33e0);})[_0xde14('0x18')](function(_0x398f63){logger[_0xde14('0x14')](_0xde14('0x23'),_0x398f63[_0xde14('0x16')],_0xae9dca);_0xbfc01b(_0x464666[_0xde14('0x14')](0x1f4,_0x398f63[_0xde14('0x16')]));});});}; \ No newline at end of file +var _0x9a19=['then','ShowSalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x3e1fda,_0x492a91){var _0x3cd277=function(_0x1905c7){while(--_0x1905c7){_0x3e1fda['push'](_0x3e1fda['shift']());}};_0x3cd277(++_0x492a91);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});}exports[_0x99a1('0x19')]=function(_0xbf62f1){var _0x1a8c41=this;return new Promise(function(_0x1fcd00,_0x74a113){return db[_0x99a1('0x1a')][_0x99a1('0x1b')]({'raw':_0xbf62f1[_0x99a1('0x1c')]?_0xbf62f1[_0x99a1('0x1c')][_0x99a1('0x1d')]===undefined?!![]:![]:!![],'where':_0xbf62f1[_0x99a1('0x1c')]?_0xbf62f1['options'][_0x99a1('0x1e')]||null:null,'attributes':_0xbf62f1[_0x99a1('0x1c')]?_0xbf62f1['options'][_0x99a1('0x1f')]||null:null,'limit':_0xbf62f1['options']?_0xbf62f1[_0x99a1('0x1c')][_0x99a1('0x20')]||null:null,'include':_0xbf62f1[_0x99a1('0x1c')]?_0xbf62f1[_0x99a1('0x1c')]['include']?_[_0x99a1('0x21')](_0xbf62f1[_0x99a1('0x1c')]['include'],function(_0x44df2d){return{'model':db[_0x44df2d['model']],'as':_0x44df2d['as'],'attributes':_0x44df2d[_0x99a1('0x1f')],'include':_0x44df2d[_0x99a1('0x22')]?_[_0x99a1('0x21')](_0x44df2d[_0x99a1('0x22')],function(_0x3c813){return{'model':db[_0x3c813[_0x99a1('0x23')]],'as':_0x3c813['as'],'attributes':_0x3c813['attributes'],'include':_0x3c813[_0x99a1('0x22')]?_['map'](_0x3c813['include'],function(_0xafea84){return{'model':db[_0xafea84[_0x99a1('0x23')]],'as':_0xafea84['as'],'attributes':_0xafea84[_0x99a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x99a1('0x24')](function(_0x25d560){logger[_0x99a1('0xe')](_0x99a1('0x19'),_0xbf62f1);logger['debug'](_0x99a1('0x19'),_0xbf62f1,JSON['stringify'](_0x25d560));_0x1fcd00(_0x25d560);})[_0x99a1('0x18')](function(_0x1137f2){logger[_0x99a1('0x14')]('GetSalesforceAccount',_0x1137f2[_0x99a1('0x16')],_0xbf62f1);_0x74a113(_0x1a8c41[_0x99a1('0x14')](0x1f4,_0x1137f2['message']));});});};exports[_0x99a1('0x25')]=function(_0x1434a0){var _0x36aa34=this;return new Promise(function(_0x303d1e,_0x2a5b8c){return db[_0x99a1('0x1a')][_0x99a1('0x26')]({'raw':_0x1434a0[_0x99a1('0x1c')]?_0x1434a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1434a0[_0x99a1('0x1c')]?_0x1434a0['options'][_0x99a1('0x1e')]||null:null,'attributes':_0x1434a0[_0x99a1('0x1c')]?_0x1434a0['options'][_0x99a1('0x1f')]||null:null,'include':_0x1434a0[_0x99a1('0x1c')]?_0x1434a0[_0x99a1('0x1c')][_0x99a1('0x22')]?_[_0x99a1('0x21')](_0x1434a0[_0x99a1('0x1c')][_0x99a1('0x22')],function(_0x38bb91){return{'model':db[_0x38bb91[_0x99a1('0x23')]],'as':_0x38bb91['as'],'attributes':_0x38bb91[_0x99a1('0x1f')],'include':_0x38bb91[_0x99a1('0x22')]?_[_0x99a1('0x21')](_0x38bb91[_0x99a1('0x22')],function(_0x1b49be){return{'model':db[_0x1b49be['model']],'as':_0x1b49be['as'],'attributes':_0x1b49be['attributes'],'include':_0x1b49be[_0x99a1('0x22')]?_[_0x99a1('0x21')](_0x1b49be[_0x99a1('0x22')],function(_0x4131e0){return{'model':db[_0x4131e0[_0x99a1('0x23')]],'as':_0x4131e0['as'],'attributes':_0x4131e0[_0x99a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x99a1('0x24')](function(_0x54840d){logger[_0x99a1('0xe')](_0x99a1('0x25'),_0x1434a0);logger['debug'](_0x99a1('0x25'),_0x1434a0,JSON[_0x99a1('0x13')](_0x54840d));_0x303d1e(_0x54840d);})[_0x99a1('0x18')](function(_0x3cd1a0){logger[_0x99a1('0x14')](_0x99a1('0x25'),_0x3cd1a0[_0x99a1('0x16')],_0x1434a0);_0x2a5b8c(_0x36aa34[_0x99a1('0x14')](0x1f4,_0x3cd1a0[_0x99a1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6178114..d46991f 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 _0x4fb6=['/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x51c4f3,_0x1ce048){var _0x2d46be=function(_0x2f2163){while(--_0x2f2163){_0x51c4f3['push'](_0x51c4f3['shift']());}};_0x2d46be(++_0x1ce048);}(_0x4fb6,0x18c));var _0x64fb=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x4fb6[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x64fb('0x0'));var util=require(_0x64fb('0x1'));var path=require(_0x64fb('0x2'));var timeout=require(_0x64fb('0x3'));var express=require(_0x64fb('0x4'));var router=express[_0x64fb('0x5')]();var auth=require(_0x64fb('0x6'));var interaction=require(_0x64fb('0x7'));var config=require(_0x64fb('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x64fb('0x9')]('/',auth[_0x64fb('0xa')](),controller[_0x64fb('0xb')]);router[_0x64fb('0x9')](_0x64fb('0xc'),auth[_0x64fb('0xa')](),controller['show']);router[_0x64fb('0x9')](_0x64fb('0xd'),auth[_0x64fb('0xa')](),controller[_0x64fb('0xe')]);router[_0x64fb('0x9')](_0x64fb('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x64fb('0x9')](_0x64fb('0x10'),auth[_0x64fb('0xa')](),controller[_0x64fb('0x11')]);router[_0x64fb('0x12')]('/',auth['isAuthenticated'](),controller[_0x64fb('0x13')]);router[_0x64fb('0x14')](_0x64fb('0xc'),auth[_0x64fb('0xa')](),controller['update']);router[_0x64fb('0x15')]('/:id',auth[_0x64fb('0xa')](),controller[_0x64fb('0x16')]);module[_0x64fb('0x17')]=router; \ No newline at end of file +var _0x2a62=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','exports'];(function(_0x4556c3,_0x4ed15e){var _0x223b52=function(_0x5bbdd6){while(--_0x5bbdd6){_0x4556c3['push'](_0x4556c3['shift']());}};_0x223b52(++_0x4ed15e);}(_0x2a62,0x12c));var _0x22a6=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2a62[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x22a6('0x0'));var util=require(_0x22a6('0x1'));var path=require(_0x22a6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x22a6('0x3')]();var auth=require(_0x22a6('0x4'));var interaction=require(_0x22a6('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router[_0x22a6('0x6')]('/',auth[_0x22a6('0x7')](),controller[_0x22a6('0x8')]);router['get'](_0x22a6('0x9'),auth[_0x22a6('0x7')](),controller['show']);router[_0x22a6('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x22a6('0xa')]);router[_0x22a6('0x6')](_0x22a6('0xb'),auth['isAuthenticated'](),controller[_0x22a6('0xc')]);router[_0x22a6('0x6')](_0x22a6('0xd'),auth[_0x22a6('0x7')](),controller[_0x22a6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22a6('0xf')]);router[_0x22a6('0x10')](_0x22a6('0x9'),auth[_0x22a6('0x7')](),controller[_0x22a6('0x11')]);router[_0x22a6('0x12')](_0x22a6('0x9'),auth[_0x22a6('0x7')](),controller['destroy']);module[_0x22a6('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 34e5351..629b387 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 _0x63be=['contact_lead','nothing','contact','sequelize','exports','STRING','ENUM','Task','Case','lead'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x63be,0x1cf));var _0xe63b=function(_0x4d02b8,_0x490dd4){_0x4d02b8=_0x4d02b8-0x0;var _0x235d8e=_0x63be[_0x4d02b8];return _0x235d8e;};'use strict';var Sequelize=require(_0xe63b('0x0'));module[_0xe63b('0x1')]={'name':{'type':Sequelize[_0xe63b('0x2')]},'description':{'type':Sequelize[_0xe63b('0x2')]},'ticketType':{'type':Sequelize[_0xe63b('0x3')](_0xe63b('0x4'),_0xe63b('0x5')),'defaultValue':_0xe63b('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xe63b('0x6')),'defaultValue':_0xe63b('0x7')},'moduleCreate':{'type':Sequelize[_0xe63b('0x3')](_0xe63b('0x8'),_0xe63b('0x9'),_0xe63b('0x6')),'defaultValue':_0xe63b('0x6')}}; \ No newline at end of file +var _0x2808=['lead','sequelize','exports','STRING','Task','Case','contact_lead','contact'];(function(_0x4ddffb,_0xcc3cfe){var _0x5b6772=function(_0x3a6a30){while(--_0x3a6a30){_0x4ddffb['push'](_0x4ddffb['shift']());}};_0x5b6772(++_0xcc3cfe);}(_0x2808,0xd9));var _0x8280=function(_0x39b526,_0x10420e){_0x39b526=_0x39b526-0x0;var _0x4fd5ce=_0x2808[_0x39b526];return _0x4fd5ce;};'use strict';var Sequelize=require(_0x8280('0x0'));module[_0x8280('0x1')]={'name':{'type':Sequelize[_0x8280('0x2')]},'description':{'type':Sequelize[_0x8280('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x8280('0x3'),_0x8280('0x4')),'defaultValue':_0x8280('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x8280('0x5'),_0x8280('0x6'),_0x8280('0x7')),'defaultValue':_0x8280('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x8280('0x6'),_0x8280('0x7')),'defaultValue':_0x8280('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 908ae46..6df32be 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 _0xf46d=['mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','jayson/promise','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','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\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','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','update','getFields','findOne','SalesforceField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird'];(function(_0x3b327f,_0x1ba83d){var _0x316491=function(_0x463470){while(--_0x463470){_0x3b327f['push'](_0x3b327f['shift']());}};_0x316491(++_0x1ba83d);}(_0xf46d,0x1c3));var _0xdf46=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xf46d[_0x1e500e];return _0x10dc5e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdf46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf46('0x1'));var jsonpatch=require(_0xdf46('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf46('0x3'));var Mustache=require(_0xdf46('0x4'));var util=require('util');var path=require(_0xdf46('0x5'));var sox=require(_0xdf46('0x6'));var csv=require(_0xdf46('0x7'));var ejs=require(_0xdf46('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf46('0x9'));var crypto=require(_0xdf46('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdf46('0xb'));var toCsv=require(_0xdf46('0x7'));var querystring=require(_0xdf46('0xc'));var Papa=require('papaparse');var Redis=require(_0xdf46('0xd'));var authService=require(_0xdf46('0xe'));var qs=require(_0xdf46('0xf'));var as=require(_0xdf46('0x10'));var hardwareService=require(_0xdf46('0x11'));var logger=require(_0xdf46('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xdf46('0x13'));var client=jayson['client'][_0xdf46('0x14')]({'port':0x232a});function checkPasswordPattern(_0x37df88,_0x1e033e,_0x294f94){if(_0x294f94){var _0x56b9ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56b9ac[_0xdf46('0x15')](_0x1e033e)){return _0x37df88;}else{throw new db['Sequelize'][(_0xdf46('0x16'))](_0xdf46('0x17'));}}else{return _0x37df88;}}function respondWithRpcPromise(_0x28d701,_0x534b32,_0x3c4586,_0x150e58){return new BPromise(function(_0x597be0,_0x310cba){var _0xacf1bb=_0x150e58||client;return _0xacf1bb[_0xdf46('0x18')](_0x28d701,_0x3c4586)[_0xdf46('0x19')](function(_0x53c887){logger[_0xdf46('0x1a')](_0xdf46('0x1b'),_0x534b32,'request\x20sent');logger[_0xdf46('0x1c')](_0xdf46('0x1d'),_0x534b32,_0xdf46('0x1e'),JSON[_0xdf46('0x1f')](_0x53c887));if(_0x53c887[_0xdf46('0x20')]){if(_0x53c887[_0xdf46('0x20')][_0xdf46('0x21')]===0x1f4){logger[_0xdf46('0x20')](_0xdf46('0x1b'),_0x534b32,_0x53c887['error'][_0xdf46('0x22')]);return _0x310cba(_0x53c887['error'][_0xdf46('0x22')]);}logger[_0xdf46('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x534b32,_0x53c887[_0xdf46('0x20')]['message']);return _0x597be0(_0x53c887[_0xdf46('0x20')][_0xdf46('0x22')]);}else{logger[_0xdf46('0x1a')](_0xdf46('0x1b'),_0x534b32,_0xdf46('0x1e'));_0x597be0(_0x53c887[_0xdf46('0x23')][_0xdf46('0x22')]);}})['catch'](function(_0x162e6e){logger[_0xdf46('0x20')](_0xdf46('0x1b'),_0x534b32,_0x162e6e);_0x310cba(_0x162e6e);});});}function respondWithStatusCode(_0x2f634f,_0x5c3df1){_0x5c3df1=_0x5c3df1||0xcc;return function(_0x5b4bf1){if(_0x5b4bf1){return _0x2f634f[_0xdf46('0x24')](_0x5c3df1);}return _0x2f634f[_0xdf46('0x25')](_0x5c3df1)['end']();};}function respondWithResult(_0x3b38c9,_0x32636b){_0x32636b=_0x32636b||0xc8;return function(_0x40ff85){if(_0x40ff85){return _0x3b38c9[_0xdf46('0x25')](_0x32636b)['json'](_0x40ff85);}};}function respondWithFilteredResult(_0x514090,_0x548338){return function(_0x3cad73){if(_0x3cad73){var _0x39a62a=_0x3cad73[_0xdf46('0x26')],_0x3dd8c7=_0x548338[_0xdf46('0x27')],_0x1c3eec=_0x548338[_0xdf46('0x27')]+_0x548338[_0xdf46('0x28')],_0xd77fe3;if(_0x1c3eec>=_0x39a62a){_0x1c3eec=_0x39a62a;_0xd77fe3=0xc8;}else{_0xd77fe3=0xce;}_0x514090[_0xdf46('0x25')](_0xd77fe3);return _0x514090[_0xdf46('0x29')](_0xdf46('0x2a'),_0x3dd8c7+'-'+_0x1c3eec+'/'+_0x39a62a)[_0xdf46('0x2b')](_0x3cad73);}return null;};}function patchUpdates(_0x235fb3){return function(_0x28e8ba){try{jsonpatch[_0xdf46('0x2c')](_0x28e8ba,_0x235fb3,!![]);}catch(_0x4c33d0){return BPromise[_0xdf46('0x2d')](_0x4c33d0);}return _0x28e8ba[_0xdf46('0x2e')]();};}function saveUpdates(_0x47a911,_0x3732af){return function(_0x38cb77){if(_0x38cb77){return _0x38cb77['update'](_0x47a911)['then'](function(_0x1c499e){return _0x1c499e;});}return null;};}function removeEntity(_0x4256a6,_0x46d8e6){return function(_0x1ca80a){if(_0x1ca80a){return _0x1ca80a[_0xdf46('0x2f')]()[_0xdf46('0x19')](function(){_0x4256a6[_0xdf46('0x25')](0xcc)[_0xdf46('0x30')]();});}};}function handleEntityNotFound(_0x1cefec,_0x58c5ae){return function(_0x2617dc){if(!_0x2617dc){_0x1cefec[_0xdf46('0x24')](0x194);}return _0x2617dc;};}function handleError(_0x1c86dc,_0x764a16){_0x764a16=_0x764a16||0x1f4;return function(_0xff6b87){logger[_0xdf46('0x20')](_0xff6b87[_0xdf46('0x31')]);if(_0xff6b87[_0xdf46('0x32')]){delete _0xff6b87[_0xdf46('0x32')];}_0x1c86dc['status'](_0x764a16)[_0xdf46('0x33')](_0xff6b87);};}exports[_0xdf46('0x34')]=function(_0x143009,_0x3769c2){var _0x3780b5={},_0x454b77={},_0x1e7388={'count':0x0,'rows':[]};var _0x59adba=_[_0xdf46('0x35')](db[_0xdf46('0x36')][_0xdf46('0x37')],function(_0x2d028c){return{'name':_0x2d028c[_0xdf46('0x38')],'type':_0x2d028c[_0xdf46('0x39')][_0xdf46('0x3a')]};});_0x454b77['model']=_[_0xdf46('0x35')](_0x59adba,_0xdf46('0x32'));_0x454b77['query']=_[_0xdf46('0x3b')](_0x143009[_0xdf46('0x3c')]);_0x454b77[_0xdf46('0x3d')]=_[_0xdf46('0x3e')](_0x454b77['model'],_0x454b77[_0xdf46('0x3c')]);_0x3780b5['attributes']=_[_0xdf46('0x3e')](_0x454b77[_0xdf46('0x3f')],qs['fields'](_0x143009[_0xdf46('0x3c')]['fields']));_0x3780b5[_0xdf46('0x40')]=_0x3780b5[_0xdf46('0x40')][_0xdf46('0x41')]?_0x3780b5[_0xdf46('0x40')]:_0x454b77[_0xdf46('0x3f')];if(!_0x143009[_0xdf46('0x3c')]['hasOwnProperty']('nolimit')){_0x3780b5[_0xdf46('0x28')]=qs[_0xdf46('0x28')](_0x143009[_0xdf46('0x3c')]['limit']);_0x3780b5['offset']=qs[_0xdf46('0x27')](_0x143009['query'][_0xdf46('0x27')]);}_0x3780b5[_0xdf46('0x42')]=qs[_0xdf46('0x43')](_0x143009[_0xdf46('0x3c')]['sort']);_0x3780b5['where']=qs[_0xdf46('0x3d')](_[_0xdf46('0x44')](_0x143009[_0xdf46('0x3c')],_0x454b77[_0xdf46('0x3d')]),_0x59adba);if(_0x143009[_0xdf46('0x3c')][_0xdf46('0x45')]){_0x3780b5[_0xdf46('0x46')]=_[_0xdf46('0x47')](_0x3780b5[_0xdf46('0x46')],{'$or':_[_0xdf46('0x35')](_0x59adba,function(_0x3fde18){if(_0x3fde18['type']!=='VIRTUAL'){var _0x4e8a44={};_0x4e8a44[_0x3fde18[_0xdf46('0x32')]]={'$like':'%'+_0x143009[_0xdf46('0x3c')][_0xdf46('0x45')]+'%'};return _0x4e8a44;}})});}_0x3780b5=_[_0xdf46('0x47')]({},_0x3780b5,_0x143009[_0xdf46('0x48')]);var _0x3c9c81={'where':_0x3780b5[_0xdf46('0x46')]};return db[_0xdf46('0x36')][_0xdf46('0x26')](_0x3c9c81)[_0xdf46('0x19')](function(_0x347fbe){_0x1e7388[_0xdf46('0x26')]=_0x347fbe;if(_0x143009['query'][_0xdf46('0x49')]){_0x3780b5[_0xdf46('0x4a')]=[{'all':!![]}];}return db[_0xdf46('0x36')]['findAll'](_0x3780b5);})[_0xdf46('0x19')](function(_0x125eab){_0x1e7388[_0xdf46('0x4b')]=_0x125eab;return _0x1e7388;})['then'](respondWithFilteredResult(_0x3769c2,_0x3780b5))[_0xdf46('0x4c')](handleError(_0x3769c2,null));};exports[_0xdf46('0x4d')]=function(_0x4d5bf5,_0xd2e819){var _0x563cc6={'raw':![],'where':{'id':_0x4d5bf5[_0xdf46('0x4e')]['id']}},_0x52605b={};_0x52605b[_0xdf46('0x3f')]=_[_0xdf46('0x3b')](db['SalesforceConfiguration'][_0xdf46('0x37')]);_0x52605b['query']=_['keys'](_0x4d5bf5[_0xdf46('0x3c')]);_0x52605b[_0xdf46('0x3d')]=_[_0xdf46('0x3e')](_0x52605b[_0xdf46('0x3f')],_0x52605b[_0xdf46('0x3c')]);_0x563cc6[_0xdf46('0x40')]=_[_0xdf46('0x3e')](_0x52605b['model'],qs[_0xdf46('0x4f')](_0x4d5bf5[_0xdf46('0x3c')][_0xdf46('0x4f')]));_0x563cc6[_0xdf46('0x40')]=_0x563cc6[_0xdf46('0x40')][_0xdf46('0x41')]?_0x563cc6['attributes']:_0x52605b['model'];if(_0x4d5bf5[_0xdf46('0x3c')][_0xdf46('0x49')]){_0x563cc6[_0xdf46('0x4a')]=[{'all':!![]}];}_0x563cc6=_[_0xdf46('0x47')]({},_0x563cc6,_0x4d5bf5[_0xdf46('0x48')]);return db[_0xdf46('0x36')][_0xdf46('0x50')](_0x563cc6)[_0xdf46('0x19')](handleEntityNotFound(_0xd2e819,null))['then'](respondWithResult(_0xd2e819,null))[_0xdf46('0x4c')](handleError(_0xd2e819,null));};exports[_0xdf46('0x51')]=function(_0x2807c4,_0x4adeb3){return db['SalesforceConfiguration']['create'](_0x2807c4[_0xdf46('0x52')],{})['then'](respondWithResult(_0x4adeb3,0xc9))[_0xdf46('0x4c')](handleError(_0x4adeb3,null));};exports[_0xdf46('0x53')]=function(_0x52e181,_0xe13ac2){if(_0x52e181['body']['id']){delete _0x52e181['body']['id'];}return db['SalesforceConfiguration'][_0xdf46('0x50')]({'where':{'id':_0x52e181[_0xdf46('0x4e')]['id']}})[_0xdf46('0x19')](handleEntityNotFound(_0xe13ac2,null))[_0xdf46('0x19')](saveUpdates(_0x52e181[_0xdf46('0x52')],null))[_0xdf46('0x19')](respondWithResult(_0xe13ac2,null))[_0xdf46('0x4c')](handleError(_0xe13ac2,null));};exports['destroy']=function(_0x79918d,_0x1d1184){return db[_0xdf46('0x36')][_0xdf46('0x50')]({'where':{'id':_0x79918d[_0xdf46('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d1184,null))[_0xdf46('0x19')](removeEntity(_0x1d1184,null))[_0xdf46('0x4c')](handleError(_0x1d1184,null));};exports[_0xdf46('0x54')]=function(_0x802ca,_0x1c5892,_0x344016){var _0x21c009={};var _0x2be9b6={};var _0x35dd3c;var _0x224d89;return db[_0xdf46('0x36')][_0xdf46('0x55')]({'where':{'id':_0x802ca[_0xdf46('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1c5892,null))['then'](function(_0x184f72){if(_0x184f72){_0x35dd3c=_0x184f72;_0x2be9b6[_0xdf46('0x3f')]=_[_0xdf46('0x3b')](db[_0xdf46('0x56')][_0xdf46('0x37')]);_0x2be9b6['query']=_[_0xdf46('0x3b')](_0x802ca['query']);_0x2be9b6[_0xdf46('0x3d')]=_['intersection'](_0x2be9b6[_0xdf46('0x3f')],_0x2be9b6['query']);_0x21c009[_0xdf46('0x40')]=_[_0xdf46('0x3e')](_0x2be9b6[_0xdf46('0x3f')],qs[_0xdf46('0x4f')](_0x802ca['query'][_0xdf46('0x4f')]));_0x21c009[_0xdf46('0x40')]=_0x21c009['attributes'][_0xdf46('0x41')]?_0x21c009[_0xdf46('0x40')]:_0x2be9b6[_0xdf46('0x3f')];_0x21c009[_0xdf46('0x42')]=qs[_0xdf46('0x43')](_0x802ca['query']['sort']);_0x21c009[_0xdf46('0x46')]=qs[_0xdf46('0x3d')](_[_0xdf46('0x44')](_0x802ca['query'],_0x2be9b6[_0xdf46('0x3d')]));if(_0x802ca[_0xdf46('0x3c')][_0xdf46('0x45')]){_0x21c009[_0xdf46('0x46')]=_[_0xdf46('0x47')](_0x21c009[_0xdf46('0x46')],{'$or':_[_0xdf46('0x35')](_0x21c009['attributes'],function(_0x246d2d){var _0x4ce0d6={};_0x4ce0d6[_0x246d2d]={'$like':'%'+_0x802ca[_0xdf46('0x3c')][_0xdf46('0x45')]+'%'};return _0x4ce0d6;})});}_0x21c009=_[_0xdf46('0x47')]({},_0x21c009,_0x802ca[_0xdf46('0x48')]);return _0x35dd3c[_0xdf46('0x54')](_0x21c009);}})['then'](function(_0x14b977){if(_0x14b977){_0x224d89=_0x14b977[_0xdf46('0x41')];if(!_0x802ca[_0xdf46('0x3c')][_0xdf46('0x57')](_0xdf46('0x58'))){_0x21c009[_0xdf46('0x28')]=qs['limit'](_0x802ca[_0xdf46('0x3c')]['limit']);_0x21c009[_0xdf46('0x27')]=qs[_0xdf46('0x27')](_0x802ca[_0xdf46('0x3c')][_0xdf46('0x27')]);}return _0x35dd3c[_0xdf46('0x54')](_0x21c009);}})[_0xdf46('0x19')](function(_0x5788df){if(_0x5788df){return _0x5788df?{'count':_0x224d89,'rows':_0x5788df}:null;}})[_0xdf46('0x19')](respondWithResult(_0x1c5892,null))['catch'](handleError(_0x1c5892,null));};exports['getSubjects']=function(_0x59f65c,_0x4a99af,_0x44cdd7){var _0x2b8c82={};var _0x19b0c0={};var _0x326550;var _0x503b23;return db['SalesforceConfiguration'][_0xdf46('0x55')]({'where':{'id':_0x59f65c[_0xdf46('0x4e')]['id']}})[_0xdf46('0x19')](handleEntityNotFound(_0x4a99af,null))[_0xdf46('0x19')](function(_0x395d5e){if(_0x395d5e){_0x326550=_0x395d5e;_0x19b0c0[_0xdf46('0x3f')]=_[_0xdf46('0x3b')](db['SalesforceField'][_0xdf46('0x37')]);_0x19b0c0[_0xdf46('0x3c')]=_[_0xdf46('0x3b')](_0x59f65c[_0xdf46('0x3c')]);_0x19b0c0[_0xdf46('0x3d')]=_[_0xdf46('0x3e')](_0x19b0c0[_0xdf46('0x3f')],_0x19b0c0['query']);_0x2b8c82['attributes']=_[_0xdf46('0x3e')](_0x19b0c0[_0xdf46('0x3f')],qs[_0xdf46('0x4f')](_0x59f65c[_0xdf46('0x3c')][_0xdf46('0x4f')]));_0x2b8c82[_0xdf46('0x40')]=_0x2b8c82[_0xdf46('0x40')][_0xdf46('0x41')]?_0x2b8c82['attributes']:_0x19b0c0[_0xdf46('0x3f')];_0x2b8c82[_0xdf46('0x42')]=qs[_0xdf46('0x43')](_0x59f65c[_0xdf46('0x3c')][_0xdf46('0x43')]);_0x2b8c82[_0xdf46('0x46')]=qs['filters'](_[_0xdf46('0x44')](_0x59f65c['query'],_0x19b0c0[_0xdf46('0x3d')]));if(_0x59f65c[_0xdf46('0x3c')][_0xdf46('0x45')]){_0x2b8c82[_0xdf46('0x46')]=_[_0xdf46('0x47')](_0x2b8c82[_0xdf46('0x46')],{'$or':_['map'](_0x2b8c82['attributes'],function(_0xc5f4b2){var _0x57ac68={};_0x57ac68[_0xc5f4b2]={'$like':'%'+_0x59f65c[_0xdf46('0x3c')][_0xdf46('0x45')]+'%'};return _0x57ac68;})});}_0x2b8c82=_[_0xdf46('0x47')]({},_0x2b8c82,_0x59f65c['options']);return _0x326550[_0xdf46('0x59')](_0x2b8c82);}})[_0xdf46('0x19')](function(_0x54ac69){if(_0x54ac69){_0x503b23=_0x54ac69[_0xdf46('0x41')];if(!_0x59f65c[_0xdf46('0x3c')]['hasOwnProperty'](_0xdf46('0x58'))){_0x2b8c82[_0xdf46('0x28')]=qs['limit'](_0x59f65c['query']['limit']);_0x2b8c82['offset']=qs['offset'](_0x59f65c[_0xdf46('0x3c')]['offset']);}return _0x326550[_0xdf46('0x59')](_0x2b8c82);}})[_0xdf46('0x19')](function(_0x4800ff){if(_0x4800ff){return _0x4800ff?{'count':_0x503b23,'rows':_0x4800ff}:null;}})[_0xdf46('0x19')](respondWithResult(_0x4a99af,null))[_0xdf46('0x4c')](handleError(_0x4a99af,null));};exports['getDescriptions']=function(_0x2a49c3,_0x440ba5,_0x3261d8){var _0x120137={};var _0xaf69a7={};var _0xf8eb2c;var _0x2f8ff2;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2a49c3[_0xdf46('0x4e')]['id']}})[_0xdf46('0x19')](handleEntityNotFound(_0x440ba5,null))['then'](function(_0x5ee152){if(_0x5ee152){_0xf8eb2c=_0x5ee152;_0xaf69a7['model']=_['keys'](db[_0xdf46('0x56')][_0xdf46('0x37')]);_0xaf69a7[_0xdf46('0x3c')]=_[_0xdf46('0x3b')](_0x2a49c3['query']);_0xaf69a7[_0xdf46('0x3d')]=_['intersection'](_0xaf69a7['model'],_0xaf69a7[_0xdf46('0x3c')]);_0x120137[_0xdf46('0x40')]=_[_0xdf46('0x3e')](_0xaf69a7['model'],qs['fields'](_0x2a49c3[_0xdf46('0x3c')][_0xdf46('0x4f')]));_0x120137[_0xdf46('0x40')]=_0x120137[_0xdf46('0x40')][_0xdf46('0x41')]?_0x120137[_0xdf46('0x40')]:_0xaf69a7[_0xdf46('0x3f')];_0x120137['order']=qs['sort'](_0x2a49c3[_0xdf46('0x3c')][_0xdf46('0x43')]);_0x120137[_0xdf46('0x46')]=qs[_0xdf46('0x3d')](_[_0xdf46('0x44')](_0x2a49c3[_0xdf46('0x3c')],_0xaf69a7[_0xdf46('0x3d')]));if(_0x2a49c3[_0xdf46('0x3c')][_0xdf46('0x45')]){_0x120137[_0xdf46('0x46')]=_['merge'](_0x120137['where'],{'$or':_[_0xdf46('0x35')](_0x120137[_0xdf46('0x40')],function(_0x5e6cc3){var _0x3b825d={};_0x3b825d[_0x5e6cc3]={'$like':'%'+_0x2a49c3[_0xdf46('0x3c')][_0xdf46('0x45')]+'%'};return _0x3b825d;})});}_0x120137=_['merge']({},_0x120137,_0x2a49c3[_0xdf46('0x48')]);return _0xf8eb2c[_0xdf46('0x5a')](_0x120137);}})[_0xdf46('0x19')](function(_0x3ea413){if(_0x3ea413){_0x2f8ff2=_0x3ea413[_0xdf46('0x41')];if(!_0x2a49c3[_0xdf46('0x3c')][_0xdf46('0x57')](_0xdf46('0x58'))){_0x120137[_0xdf46('0x28')]=qs[_0xdf46('0x28')](_0x2a49c3['query']['limit']);_0x120137['offset']=qs[_0xdf46('0x27')](_0x2a49c3[_0xdf46('0x3c')][_0xdf46('0x27')]);}return _0xf8eb2c[_0xdf46('0x5a')](_0x120137);}})[_0xdf46('0x19')](function(_0x4457a9){if(_0x4457a9){return _0x4457a9?{'count':_0x2f8ff2,'rows':_0x4457a9}:null;}})['then'](respondWithResult(_0x440ba5,null))['catch'](handleError(_0x440ba5,null));}; \ No newline at end of file +var _0xc018=['filter','type','merge','count','includeAll','findAll','rows','catch','params','include','options','find','create','body','findOne','SalesforceField','sort','getFields','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','pick'];(function(_0x27d5ea,_0x4e5046){var _0x584a16=function(_0xe9f2a3){while(--_0xe9f2a3){_0x27d5ea['push'](_0x27d5ea['shift']());}};_0x584a16(++_0x4e5046);}(_0xc018,0xce));var _0x8c01=function(_0x27b9f3,_0x44859e){_0x27b9f3=_0x27b9f3-0x0;var _0xa351e=_0xc018[_0x27b9f3];return _0xa351e;};'use strict';var pdf=require(_0x8c01('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c01('0x1'));var zipdir=require(_0x8c01('0x2'));var jsonpatch=require(_0x8c01('0x3'));var rp=require(_0x8c01('0x4'));var moment=require(_0x8c01('0x5'));var BPromise=require(_0x8c01('0x6'));var Mustache=require(_0x8c01('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8c01('0x8'));var csv=require(_0x8c01('0x9'));var ejs=require(_0x8c01('0xa'));var fs=require('fs');var _=require(_0x8c01('0xb'));var squel=require(_0x8c01('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c01('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8c01('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c01('0xf'));var authService=require(_0x8c01('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c01('0x12'))(_0x8c01('0x13'));var utils=require('../../config/utils');var config=require(_0x8c01('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8c01('0x15'));var client=jayson[_0x8c01('0x16')][_0x8c01('0x17')]({'port':0x232a});function checkPasswordPattern(_0x20611c,_0x46e926,_0x1fead4){if(_0x1fead4){var _0x3a0006=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a0006[_0x8c01('0x18')](_0x46e926)){return _0x20611c;}else{throw new db[(_0x8c01('0x19'))][(_0x8c01('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 _0x20611c;}}function respondWithRpcPromise(_0x13120b,_0x19b7b0,_0x1870b6,_0x41b26d){return new BPromise(function(_0x208623,_0x45ed55){var _0x2a4f90=_0x41b26d||client;return _0x2a4f90[_0x8c01('0x1b')](_0x13120b,_0x1870b6)[_0x8c01('0x1c')](function(_0x204758){logger[_0x8c01('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x19b7b0,_0x8c01('0x1e'));logger['debug'](_0x8c01('0x1f'),_0x19b7b0,_0x8c01('0x1e'),JSON[_0x8c01('0x20')](_0x204758));if(_0x204758[_0x8c01('0x21')]){if(_0x204758[_0x8c01('0x21')][_0x8c01('0x22')]===0x1f4){logger[_0x8c01('0x21')](_0x8c01('0x23'),_0x19b7b0,_0x204758[_0x8c01('0x21')][_0x8c01('0x24')]);return _0x45ed55(_0x204758[_0x8c01('0x21')][_0x8c01('0x24')]);}logger[_0x8c01('0x21')](_0x8c01('0x23'),_0x19b7b0,_0x204758[_0x8c01('0x21')][_0x8c01('0x24')]);return _0x208623(_0x204758['error'][_0x8c01('0x24')]);}else{logger[_0x8c01('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x19b7b0,_0x8c01('0x1e'));_0x208623(_0x204758[_0x8c01('0x25')][_0x8c01('0x24')]);}})['catch'](function(_0x17ebbf){logger['error'](_0x8c01('0x23'),_0x19b7b0,_0x17ebbf);_0x45ed55(_0x17ebbf);});});}function respondWithStatusCode(_0x3fbbda,_0x3bddb8){_0x3bddb8=_0x3bddb8||0xcc;return function(_0x1792ea){if(_0x1792ea){return _0x3fbbda[_0x8c01('0x26')](_0x3bddb8);}return _0x3fbbda['status'](_0x3bddb8)['end']();};}function respondWithResult(_0x25050c,_0x2e7446){_0x2e7446=_0x2e7446||0xc8;return function(_0x1d0a1e){if(_0x1d0a1e){return _0x25050c[_0x8c01('0x27')](_0x2e7446)['json'](_0x1d0a1e);}};}function respondWithFilteredResult(_0x3fc4d6,_0x3abb21){return function(_0x420259){if(_0x420259){var _0x50fa98=_0x420259['count'],_0x1703f4=_0x3abb21[_0x8c01('0x28')],_0x1dc6d7=_0x3abb21[_0x8c01('0x28')]+_0x3abb21['limit'],_0x4eae5d;if(_0x1dc6d7>=_0x50fa98){_0x1dc6d7=_0x50fa98;_0x4eae5d=0xc8;}else{_0x4eae5d=0xce;}_0x3fc4d6[_0x8c01('0x27')](_0x4eae5d);return _0x3fc4d6[_0x8c01('0x29')](_0x8c01('0x2a'),_0x1703f4+'-'+_0x1dc6d7+'/'+_0x50fa98)[_0x8c01('0x2b')](_0x420259);}return null;};}function patchUpdates(_0x4344f7){return function(_0xac42af){try{jsonpatch[_0x8c01('0x2c')](_0xac42af,_0x4344f7,!![]);}catch(_0x66003c){return BPromise[_0x8c01('0x2d')](_0x66003c);}return _0xac42af[_0x8c01('0x2e')]();};}function saveUpdates(_0x68d653,_0x22903d){return function(_0x29a557){if(_0x29a557){return _0x29a557[_0x8c01('0x2f')](_0x68d653)['then'](function(_0x50db7e){return _0x50db7e;});}return null;};}function removeEntity(_0xad2c96,_0xd5a967){return function(_0x310335){if(_0x310335){return _0x310335[_0x8c01('0x30')]()['then'](function(){_0xad2c96[_0x8c01('0x27')](0xcc)[_0x8c01('0x31')]();});}};}function handleEntityNotFound(_0x341476,_0x548e5){return function(_0x94534e){if(!_0x94534e){_0x341476[_0x8c01('0x26')](0x194);}return _0x94534e;};}function handleError(_0x2e271a,_0x48bc08){_0x48bc08=_0x48bc08||0x1f4;return function(_0xf97beb){logger[_0x8c01('0x21')](_0xf97beb[_0x8c01('0x32')]);if(_0xf97beb[_0x8c01('0x33')]){delete _0xf97beb[_0x8c01('0x33')];}_0x2e271a[_0x8c01('0x27')](_0x48bc08)[_0x8c01('0x34')](_0xf97beb);};}exports[_0x8c01('0x35')]=function(_0x3d9033,_0x259dfe){var _0x170dc3={},_0x15b027={},_0x42b765={'count':0x0,'rows':[]};var _0x117fa5=_[_0x8c01('0x36')](db[_0x8c01('0x37')][_0x8c01('0x38')],function(_0xc54660){return{'name':_0xc54660[_0x8c01('0x39')],'type':_0xc54660['type'][_0x8c01('0x3a')]};});_0x15b027['model']=_[_0x8c01('0x36')](_0x117fa5,_0x8c01('0x33'));_0x15b027[_0x8c01('0x3b')]=_[_0x8c01('0x3c')](_0x3d9033[_0x8c01('0x3b')]);_0x15b027[_0x8c01('0x3d')]=_['intersection'](_0x15b027[_0x8c01('0x3e')],_0x15b027[_0x8c01('0x3b')]);_0x170dc3[_0x8c01('0x3f')]=_[_0x8c01('0x40')](_0x15b027[_0x8c01('0x3e')],qs[_0x8c01('0x41')](_0x3d9033[_0x8c01('0x3b')][_0x8c01('0x41')]));_0x170dc3[_0x8c01('0x3f')]=_0x170dc3[_0x8c01('0x3f')][_0x8c01('0x42')]?_0x170dc3['attributes']:_0x15b027['model'];if(!_0x3d9033['query'][_0x8c01('0x43')](_0x8c01('0x44'))){_0x170dc3[_0x8c01('0x45')]=qs['limit'](_0x3d9033['query'][_0x8c01('0x45')]);_0x170dc3['offset']=qs[_0x8c01('0x28')](_0x3d9033['query']['offset']);}_0x170dc3[_0x8c01('0x46')]=qs['sort'](_0x3d9033[_0x8c01('0x3b')]['sort']);_0x170dc3[_0x8c01('0x47')]=qs['filters'](_[_0x8c01('0x48')](_0x3d9033[_0x8c01('0x3b')],_0x15b027[_0x8c01('0x3d')]),_0x117fa5);if(_0x3d9033[_0x8c01('0x3b')][_0x8c01('0x49')]){_0x170dc3[_0x8c01('0x47')]=_['merge'](_0x170dc3['where'],{'$or':_['map'](_0x117fa5,function(_0x58e16e){if(_0x58e16e[_0x8c01('0x4a')]!=='VIRTUAL'){var _0x1c0c7e={};_0x1c0c7e[_0x58e16e[_0x8c01('0x33')]]={'$like':'%'+_0x3d9033[_0x8c01('0x3b')][_0x8c01('0x49')]+'%'};return _0x1c0c7e;}})});}_0x170dc3=_[_0x8c01('0x4b')]({},_0x170dc3,_0x3d9033['options']);var _0x6101df={'where':_0x170dc3[_0x8c01('0x47')]};return db[_0x8c01('0x37')][_0x8c01('0x4c')](_0x6101df)[_0x8c01('0x1c')](function(_0x5de752){_0x42b765[_0x8c01('0x4c')]=_0x5de752;if(_0x3d9033['query'][_0x8c01('0x4d')]){_0x170dc3['include']=[{'all':!![]}];}return db[_0x8c01('0x37')][_0x8c01('0x4e')](_0x170dc3);})[_0x8c01('0x1c')](function(_0x1ceaaf){_0x42b765[_0x8c01('0x4f')]=_0x1ceaaf;return _0x42b765;})[_0x8c01('0x1c')](respondWithFilteredResult(_0x259dfe,_0x170dc3))[_0x8c01('0x50')](handleError(_0x259dfe,null));};exports['show']=function(_0x57c7cb,_0x5f2141){var _0x59a819={'raw':![],'where':{'id':_0x57c7cb[_0x8c01('0x51')]['id']}},_0x3f12fb={};_0x3f12fb[_0x8c01('0x3e')]=_[_0x8c01('0x3c')](db[_0x8c01('0x37')][_0x8c01('0x38')]);_0x3f12fb['query']=_[_0x8c01('0x3c')](_0x57c7cb['query']);_0x3f12fb[_0x8c01('0x3d')]=_['intersection'](_0x3f12fb['model'],_0x3f12fb[_0x8c01('0x3b')]);_0x59a819['attributes']=_[_0x8c01('0x40')](_0x3f12fb[_0x8c01('0x3e')],qs[_0x8c01('0x41')](_0x57c7cb[_0x8c01('0x3b')][_0x8c01('0x41')]));_0x59a819[_0x8c01('0x3f')]=_0x59a819[_0x8c01('0x3f')][_0x8c01('0x42')]?_0x59a819['attributes']:_0x3f12fb[_0x8c01('0x3e')];if(_0x57c7cb[_0x8c01('0x3b')][_0x8c01('0x4d')]){_0x59a819[_0x8c01('0x52')]=[{'all':!![]}];}_0x59a819=_[_0x8c01('0x4b')]({},_0x59a819,_0x57c7cb[_0x8c01('0x53')]);return db[_0x8c01('0x37')][_0x8c01('0x54')](_0x59a819)[_0x8c01('0x1c')](handleEntityNotFound(_0x5f2141,null))['then'](respondWithResult(_0x5f2141,null))[_0x8c01('0x50')](handleError(_0x5f2141,null));};exports[_0x8c01('0x55')]=function(_0x594067,_0x2801c4){return db[_0x8c01('0x37')]['create'](_0x594067['body'],{})[_0x8c01('0x1c')](respondWithResult(_0x2801c4,0xc9))[_0x8c01('0x50')](handleError(_0x2801c4,null));};exports[_0x8c01('0x2f')]=function(_0x32ce10,_0x32ddab){if(_0x32ce10[_0x8c01('0x56')]['id']){delete _0x32ce10[_0x8c01('0x56')]['id'];}return db['SalesforceConfiguration'][_0x8c01('0x54')]({'where':{'id':_0x32ce10[_0x8c01('0x51')]['id']}})['then'](handleEntityNotFound(_0x32ddab,null))[_0x8c01('0x1c')](saveUpdates(_0x32ce10[_0x8c01('0x56')],null))[_0x8c01('0x1c')](respondWithResult(_0x32ddab,null))[_0x8c01('0x50')](handleError(_0x32ddab,null));};exports['destroy']=function(_0x5ae74a,_0x243b08){return db[_0x8c01('0x37')][_0x8c01('0x54')]({'where':{'id':_0x5ae74a[_0x8c01('0x51')]['id']}})['then'](handleEntityNotFound(_0x243b08,null))[_0x8c01('0x1c')](removeEntity(_0x243b08,null))[_0x8c01('0x50')](handleError(_0x243b08,null));};exports['getFields']=function(_0xf56d32,_0xa12cbb,_0x5bb919){var _0x343d36={};var _0x50175b={};var _0x3197fb;var _0x3200e7;return db['SalesforceConfiguration'][_0x8c01('0x57')]({'where':{'id':_0xf56d32[_0x8c01('0x51')]['id']}})[_0x8c01('0x1c')](handleEntityNotFound(_0xa12cbb,null))[_0x8c01('0x1c')](function(_0x21d9f9){if(_0x21d9f9){_0x3197fb=_0x21d9f9;_0x50175b[_0x8c01('0x3e')]=_[_0x8c01('0x3c')](db[_0x8c01('0x58')]['rawAttributes']);_0x50175b[_0x8c01('0x3b')]=_[_0x8c01('0x3c')](_0xf56d32[_0x8c01('0x3b')]);_0x50175b['filters']=_[_0x8c01('0x40')](_0x50175b[_0x8c01('0x3e')],_0x50175b[_0x8c01('0x3b')]);_0x343d36[_0x8c01('0x3f')]=_['intersection'](_0x50175b[_0x8c01('0x3e')],qs[_0x8c01('0x41')](_0xf56d32[_0x8c01('0x3b')][_0x8c01('0x41')]));_0x343d36[_0x8c01('0x3f')]=_0x343d36[_0x8c01('0x3f')][_0x8c01('0x42')]?_0x343d36[_0x8c01('0x3f')]:_0x50175b[_0x8c01('0x3e')];_0x343d36[_0x8c01('0x46')]=qs['sort'](_0xf56d32[_0x8c01('0x3b')][_0x8c01('0x59')]);_0x343d36[_0x8c01('0x47')]=qs[_0x8c01('0x3d')](_['pick'](_0xf56d32['query'],_0x50175b['filters']));if(_0xf56d32[_0x8c01('0x3b')][_0x8c01('0x49')]){_0x343d36['where']=_[_0x8c01('0x4b')](_0x343d36[_0x8c01('0x47')],{'$or':_[_0x8c01('0x36')](_0x343d36[_0x8c01('0x3f')],function(_0x49b86e){var _0x32c0dd={};_0x32c0dd[_0x49b86e]={'$like':'%'+_0xf56d32[_0x8c01('0x3b')][_0x8c01('0x49')]+'%'};return _0x32c0dd;})});}_0x343d36=_[_0x8c01('0x4b')]({},_0x343d36,_0xf56d32[_0x8c01('0x53')]);return _0x3197fb[_0x8c01('0x5a')](_0x343d36);}})[_0x8c01('0x1c')](function(_0x382645){if(_0x382645){_0x3200e7=_0x382645['length'];if(!_0xf56d32['query']['hasOwnProperty'](_0x8c01('0x44'))){_0x343d36['limit']=qs[_0x8c01('0x45')](_0xf56d32['query'][_0x8c01('0x45')]);_0x343d36['offset']=qs[_0x8c01('0x28')](_0xf56d32[_0x8c01('0x3b')][_0x8c01('0x28')]);}return _0x3197fb[_0x8c01('0x5a')](_0x343d36);}})[_0x8c01('0x1c')](function(_0x17919c){if(_0x17919c){return _0x17919c?{'count':_0x3200e7,'rows':_0x17919c}:null;}})[_0x8c01('0x1c')](respondWithResult(_0xa12cbb,null))[_0x8c01('0x50')](handleError(_0xa12cbb,null));};exports[_0x8c01('0x5b')]=function(_0x4a24bd,_0x4eac31,_0x1ee786){var _0x30c54c={};var _0x35ead5={};var _0x23ec84;var _0x12b667;return db[_0x8c01('0x37')][_0x8c01('0x57')]({'where':{'id':_0x4a24bd[_0x8c01('0x51')]['id']}})[_0x8c01('0x1c')](handleEntityNotFound(_0x4eac31,null))[_0x8c01('0x1c')](function(_0x3ccdf1){if(_0x3ccdf1){_0x23ec84=_0x3ccdf1;_0x35ead5[_0x8c01('0x3e')]=_[_0x8c01('0x3c')](db[_0x8c01('0x58')]['rawAttributes']);_0x35ead5['query']=_[_0x8c01('0x3c')](_0x4a24bd[_0x8c01('0x3b')]);_0x35ead5[_0x8c01('0x3d')]=_[_0x8c01('0x40')](_0x35ead5[_0x8c01('0x3e')],_0x35ead5[_0x8c01('0x3b')]);_0x30c54c['attributes']=_[_0x8c01('0x40')](_0x35ead5[_0x8c01('0x3e')],qs[_0x8c01('0x41')](_0x4a24bd['query'][_0x8c01('0x41')]));_0x30c54c[_0x8c01('0x3f')]=_0x30c54c['attributes']['length']?_0x30c54c[_0x8c01('0x3f')]:_0x35ead5[_0x8c01('0x3e')];_0x30c54c[_0x8c01('0x46')]=qs[_0x8c01('0x59')](_0x4a24bd[_0x8c01('0x3b')]['sort']);_0x30c54c[_0x8c01('0x47')]=qs[_0x8c01('0x3d')](_[_0x8c01('0x48')](_0x4a24bd[_0x8c01('0x3b')],_0x35ead5[_0x8c01('0x3d')]));if(_0x4a24bd[_0x8c01('0x3b')][_0x8c01('0x49')]){_0x30c54c[_0x8c01('0x47')]=_[_0x8c01('0x4b')](_0x30c54c['where'],{'$or':_['map'](_0x30c54c[_0x8c01('0x3f')],function(_0x2cc5a8){var _0x3e8946={};_0x3e8946[_0x2cc5a8]={'$like':'%'+_0x4a24bd['query']['filter']+'%'};return _0x3e8946;})});}_0x30c54c=_['merge']({},_0x30c54c,_0x4a24bd['options']);return _0x23ec84[_0x8c01('0x5b')](_0x30c54c);}})['then'](function(_0x45800a){if(_0x45800a){_0x12b667=_0x45800a['length'];if(!_0x4a24bd[_0x8c01('0x3b')][_0x8c01('0x43')]('nolimit')){_0x30c54c[_0x8c01('0x45')]=qs[_0x8c01('0x45')](_0x4a24bd['query']['limit']);_0x30c54c[_0x8c01('0x28')]=qs['offset'](_0x4a24bd[_0x8c01('0x3b')][_0x8c01('0x28')]);}return _0x23ec84[_0x8c01('0x5b')](_0x30c54c);}})[_0x8c01('0x1c')](function(_0x2d35ab){if(_0x2d35ab){return _0x2d35ab?{'count':_0x12b667,'rows':_0x2d35ab}:null;}})[_0x8c01('0x1c')](respondWithResult(_0x4eac31,null))[_0x8c01('0x50')](handleError(_0x4eac31,null));};exports[_0x8c01('0x5c')]=function(_0x21a201,_0x31833d,_0x4521b1){var _0x5d7445={};var _0x4e52bb={};var _0x3c1815;var _0x487a18;return db['SalesforceConfiguration'][_0x8c01('0x57')]({'where':{'id':_0x21a201[_0x8c01('0x51')]['id']}})['then'](handleEntityNotFound(_0x31833d,null))[_0x8c01('0x1c')](function(_0x50c2a8){if(_0x50c2a8){_0x3c1815=_0x50c2a8;_0x4e52bb['model']=_[_0x8c01('0x3c')](db['SalesforceField']['rawAttributes']);_0x4e52bb[_0x8c01('0x3b')]=_[_0x8c01('0x3c')](_0x21a201[_0x8c01('0x3b')]);_0x4e52bb[_0x8c01('0x3d')]=_[_0x8c01('0x40')](_0x4e52bb[_0x8c01('0x3e')],_0x4e52bb[_0x8c01('0x3b')]);_0x5d7445['attributes']=_[_0x8c01('0x40')](_0x4e52bb[_0x8c01('0x3e')],qs['fields'](_0x21a201[_0x8c01('0x3b')][_0x8c01('0x41')]));_0x5d7445[_0x8c01('0x3f')]=_0x5d7445[_0x8c01('0x3f')]['length']?_0x5d7445['attributes']:_0x4e52bb[_0x8c01('0x3e')];_0x5d7445[_0x8c01('0x46')]=qs['sort'](_0x21a201[_0x8c01('0x3b')][_0x8c01('0x59')]);_0x5d7445['where']=qs[_0x8c01('0x3d')](_[_0x8c01('0x48')](_0x21a201[_0x8c01('0x3b')],_0x4e52bb[_0x8c01('0x3d')]));if(_0x21a201[_0x8c01('0x3b')][_0x8c01('0x49')]){_0x5d7445[_0x8c01('0x47')]=_[_0x8c01('0x4b')](_0x5d7445['where'],{'$or':_[_0x8c01('0x36')](_0x5d7445['attributes'],function(_0x2d0e24){var _0x23f4e5={};_0x23f4e5[_0x2d0e24]={'$like':'%'+_0x21a201[_0x8c01('0x3b')][_0x8c01('0x49')]+'%'};return _0x23f4e5;})});}_0x5d7445=_['merge']({},_0x5d7445,_0x21a201[_0x8c01('0x53')]);return _0x3c1815[_0x8c01('0x5c')](_0x5d7445);}})[_0x8c01('0x1c')](function(_0x19ecd4){if(_0x19ecd4){_0x487a18=_0x19ecd4[_0x8c01('0x42')];if(!_0x21a201['query'][_0x8c01('0x43')](_0x8c01('0x44'))){_0x5d7445[_0x8c01('0x45')]=qs[_0x8c01('0x45')](_0x21a201[_0x8c01('0x3b')][_0x8c01('0x45')]);_0x5d7445[_0x8c01('0x28')]=qs[_0x8c01('0x28')](_0x21a201[_0x8c01('0x3b')][_0x8c01('0x28')]);}return _0x3c1815[_0x8c01('0x5c')](_0x5d7445);}})[_0x8c01('0x1c')](function(_0x1bdd33){if(_0x1bdd33){return _0x1bdd33?{'count':_0x487a18,'rows':_0x1bdd33}:null;}})[_0x8c01('0x1c')](respondWithResult(_0x31833d,null))[_0x8c01('0x50')](handleError(_0x31833d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8569c8c..e84cc45 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 _0xab0c=['path','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x309069,_0x4a8db9){var _0x5a122d=function(_0x5238d9){while(--_0x5238d9){_0x309069['push'](_0x309069['shift']());}};_0x5a122d(++_0x4a8db9);}(_0xab0c,0x1ce));var _0xcab0=function(_0x534414,_0x1a790e){_0x534414=_0x534414-0x0;var _0x153f82=_0xab0c[_0x534414];return _0x153f82;};'use strict';var _=require(_0xcab0('0x0'));var util=require(_0xcab0('0x1'));var logger=require(_0xcab0('0x2'))(_0xcab0('0x3'));var moment=require(_0xcab0('0x4'));var BPromise=require('bluebird');var rp=require(_0xcab0('0x5'));var fs=require('fs');var path=require(_0xcab0('0x6'));var rimraf=require(_0xcab0('0x7'));var config=require('../../config/environment');var attributes=require(_0xcab0('0x8'));module[_0xcab0('0x9')]=function(_0x214eab,_0xf314f2){return _0x214eab['define'](_0xcab0('0xa'),attributes,{'tableName':_0xcab0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b93=['util','../../config/logger','api','bluebird','request-promise','path','exports','define','SalesforceConfiguration','lodash'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x5b93,0xf9));var _0x35b9=function(_0x23544e,_0x327000){_0x23544e=_0x23544e-0x0;var _0x52e676=_0x5b93[_0x23544e];return _0x52e676;};'use strict';var _=require(_0x35b9('0x0'));var util=require(_0x35b9('0x1'));var logger=require(_0x35b9('0x2'))(_0x35b9('0x3'));var moment=require('moment');var BPromise=require(_0x35b9('0x4'));var rp=require(_0x35b9('0x5'));var fs=require('fs');var path=require(_0x35b9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x35b9('0x7')]=function(_0x3f5a59,_0x2aa38b){return _0x3f5a59[_0x35b9('0x8')](_0x35b9('0x9'),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 a6018f0..6a6eaaa 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 _0x4033=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x4033,0x1ed));var _0x3403=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x4033[_0x158f01];return _0x5ef74e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3403('0x0'));var BPromise=require('bluebird');var rs=require(_0x3403('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3403('0x2'))['db'];var utils=require(_0x3403('0x3'));var logger=require(_0x3403('0x4'))(_0x3403('0x5'));var config=require('../../config/environment');var jayson=require(_0x3403('0x6'));var client=jayson[_0x3403('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7c32,_0x5d4b03,_0x338255){return new BPromise(function(_0x4b935a,_0x59055a){return client[_0x3403('0x8')](_0x3a7c32,_0x338255)[_0x3403('0x9')](function(_0x400e85){logger[_0x3403('0xa')](_0x3403('0xb'),_0x5d4b03,_0x3403('0xc'));logger[_0x3403('0xd')](_0x3403('0xe'),_0x5d4b03,'request\x20sent',JSON[_0x3403('0xf')](_0x400e85));if(_0x400e85['error']){if(_0x400e85[_0x3403('0x10')][_0x3403('0x11')]===0x1f4){logger[_0x3403('0x10')](_0x3403('0xb'),_0x5d4b03,_0x400e85[_0x3403('0x10')][_0x3403('0x12')]);return _0x59055a(_0x400e85[_0x3403('0x10')][_0x3403('0x12')]);}logger['error'](_0x3403('0xb'),_0x5d4b03,_0x400e85['error'][_0x3403('0x12')]);return _0x4b935a(_0x400e85[_0x3403('0x10')][_0x3403('0x12')]);}else{logger['info'](_0x3403('0xb'),_0x5d4b03,_0x3403('0xc'));_0x4b935a(_0x400e85[_0x3403('0x13')][_0x3403('0x12')]);}})[_0x3403('0x14')](function(_0x34b9d6){logger[_0x3403('0x10')](_0x3403('0xb'),_0x5d4b03,_0x34b9d6);_0x59055a(_0x34b9d6);});});} \ No newline at end of file +var _0xefe1=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xefe1,0x1e1));var _0x1efe=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xefe1[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x1efe('0x0'));var util=require('util');var moment=require(_0x1efe('0x1'));var BPromise=require(_0x1efe('0x2'));var rs=require(_0x1efe('0x3'));var fs=require('fs');var Redis=require(_0x1efe('0x4'));var db=require(_0x1efe('0x5'))['db'];var utils=require(_0x1efe('0x6'));var logger=require(_0x1efe('0x7'))(_0x1efe('0x8'));var config=require(_0x1efe('0x9'));var jayson=require(_0x1efe('0xa'));var client=jayson[_0x1efe('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d60d7,_0x2b01f3,_0x5d815d){return new BPromise(function(_0x52951c,_0x26f389){return client[_0x1efe('0xc')](_0x5d60d7,_0x5d815d)[_0x1efe('0xd')](function(_0x275850){logger[_0x1efe('0xe')](_0x1efe('0xf'),_0x2b01f3,'request\x20sent');logger[_0x1efe('0x10')](_0x1efe('0x11'),_0x2b01f3,_0x1efe('0x12'),JSON[_0x1efe('0x13')](_0x275850));if(_0x275850[_0x1efe('0x14')]){if(_0x275850['error'][_0x1efe('0x15')]===0x1f4){logger[_0x1efe('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2b01f3,_0x275850[_0x1efe('0x14')][_0x1efe('0x16')]);return _0x26f389(_0x275850[_0x1efe('0x14')]['message']);}logger[_0x1efe('0x14')](_0x1efe('0xf'),_0x2b01f3,_0x275850[_0x1efe('0x14')]['message']);return _0x52951c(_0x275850[_0x1efe('0x14')][_0x1efe('0x16')]);}else{logger[_0x1efe('0xe')](_0x1efe('0xf'),_0x2b01f3,_0x1efe('0x12'));_0x52951c(_0x275850[_0x1efe('0x17')][_0x1efe('0x16')]);}})['catch'](function(_0x2107bc){logger[_0x1efe('0x14')](_0x1efe('0xf'),_0x2b01f3,_0x2107bc);_0x26f389(_0x2107bc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 53483e1..01cb7f1 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 _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x1c3120,_0x2a89a2){var _0x28a64e=function(_0x3df602){while(--_0x3df602){_0x1c3120['push'](_0x1c3120['shift']());}};_0x28a64e(++_0x2a89a2);}(_0x2eb2,0x19f));var _0x22eb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x2eb2[_0x397cfb];return _0x15fed9;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x277c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x5bbaba,_0xcd9b1c){var _0x15a1a7=function(_0x11f8a4){while(--_0x11f8a4){_0x5bbaba['push'](_0x5bbaba['shift']());}};_0x15a1a7(++_0xcd9b1c);}(_0x277c,0x153));var _0xc277=function(_0x4d3804,_0x44675c){_0x4d3804=_0x4d3804-0x0;var _0x25b8dc=_0x277c[_0x4d3804];return _0x25b8dc;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var auth=require(_0xc277('0x5'));var interaction=require(_0xc277('0x6'));var config=require(_0xc277('0x7'));var controller=require(_0xc277('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc277('0x9')]);router['get'](_0xc277('0xa'),auth['isAuthenticated'](),controller[_0xc277('0xb')]);router[_0xc277('0xc')]('/',auth['isAuthenticated'](),controller[_0xc277('0xd')]);router[_0xc277('0xe')](_0xc277('0xa'),auth[_0xc277('0xf')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc277('0x12')]);module[_0xc277('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 48915bd..c0b185c 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 _0x66d3=['sequelize','string','variable','customVariable','STRING','ENUM'];(function(_0x59e0d0,_0x4c06f7){var _0x3e5384=function(_0x46b024){while(--_0x46b024){_0x59e0d0['push'](_0x59e0d0['shift']());}};_0x3e5384(++_0x4c06f7);}(_0x66d3,0x1aa));var _0x366d=function(_0x4cac56,_0x1b03fd){_0x4cac56=_0x4cac56-0x0;var _0x2698fd=_0x66d3[_0x4cac56];return _0x2698fd;};'use strict';var Sequelize=require(_0x366d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x366d('0x1'),_0x366d('0x2'),_0x366d('0x3'),'keyValue'),'defaultValue':_0x366d('0x1')},'content':{'type':Sequelize[_0x366d('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x366d('0x5')]('string',_0x366d('0x2'),_0x366d('0x3'))},'keyContent':{'type':Sequelize[_0x366d('0x4')]},'idField':{'type':Sequelize[_0x366d('0x4')]},'variableName':{'type':Sequelize[_0x366d('0x4')]}}; \ No newline at end of file +var _0x163a=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x40bcf9,_0x5349f0){var _0xe8cc4e=function(_0x38e12e){while(--_0x38e12e){_0x40bcf9['push'](_0x40bcf9['shift']());}};_0xe8cc4e(++_0x5349f0);}(_0x163a,0x1ec));var _0xa163=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x163a[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require(_0xa163('0x0'));module[_0xa163('0x1')]={'type':{'type':Sequelize[_0xa163('0x2')](_0xa163('0x3'),_0xa163('0x4'),'customVariable',_0xa163('0x5')),'defaultValue':_0xa163('0x3')},'content':{'type':Sequelize[_0xa163('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa163('0x2')](_0xa163('0x3'),_0xa163('0x4'),_0xa163('0x7'))},'keyContent':{'type':Sequelize[_0xa163('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xa163('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8d9f0dd..a417b8c 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 _0x9d96=['update','destroy','error','stack','send','index','map','SalesforceField','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','name','merge','options','include','findAll','then','rows','catch','show','params','rawAttributes','includeAll','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save'];(function(_0xc4c695,_0x2b338a){var _0x10c854=function(_0x367328){while(--_0x367328){_0xc4c695['push'](_0xc4c695['shift']());}};_0x10c854(++_0x2b338a);}(_0x9d96,0x75));var _0x69d9=function(_0x347620,_0x4ec8bd){_0x347620=_0x347620-0x0;var _0x465959=_0x9d96[_0x347620];return _0x465959;};'use strict';var pdf=require(_0x69d9('0x0'));var emlformat=require(_0x69d9('0x1'));var rimraf=require(_0x69d9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69d9('0x3'));var rp=require(_0x69d9('0x4'));var moment=require(_0x69d9('0x5'));var BPromise=require(_0x69d9('0x6'));var Mustache=require(_0x69d9('0x7'));var util=require('util');var path=require(_0x69d9('0x8'));var sox=require('sox');var csv=require(_0x69d9('0x9'));var ejs=require(_0x69d9('0xa'));var fs=require('fs');var _=require(_0x69d9('0xb'));var squel=require('squel');var crypto=require(_0x69d9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x69d9('0xd'));var toCsv=require(_0x69d9('0x9'));var querystring=require(_0x69d9('0xe'));var Papa=require(_0x69d9('0xf'));var Redis=require(_0x69d9('0x10'));var authService=require(_0x69d9('0x11'));var qs=require(_0x69d9('0x12'));var as=require(_0x69d9('0x13'));var hardwareService=require(_0x69d9('0x14'));var logger=require(_0x69d9('0x15'))(_0x69d9('0x16'));var utils=require(_0x69d9('0x17'));var config=require(_0x69d9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x438c2f,_0x48a6d6){_0x48a6d6=_0x48a6d6||0xcc;return function(_0x1e486f){if(_0x1e486f){return _0x438c2f[_0x69d9('0x19')](_0x48a6d6);}return _0x438c2f[_0x69d9('0x1a')](_0x48a6d6)[_0x69d9('0x1b')]();};}function respondWithResult(_0x3e1d6c,_0x392ae5){_0x392ae5=_0x392ae5||0xc8;return function(_0x83a687){if(_0x83a687){return _0x3e1d6c[_0x69d9('0x1a')](_0x392ae5)[_0x69d9('0x1c')](_0x83a687);}};}function respondWithFilteredResult(_0x1184ec,_0x2729fe){return function(_0x4dec91){if(_0x4dec91){var _0x4dfbce=_0x4dec91[_0x69d9('0x1d')],_0xdba687=_0x2729fe['offset'],_0x1ccf57=_0x2729fe[_0x69d9('0x1e')]+_0x2729fe['limit'],_0x2d13ca;if(_0x1ccf57>=_0x4dfbce){_0x1ccf57=_0x4dfbce;_0x2d13ca=0xc8;}else{_0x2d13ca=0xce;}_0x1184ec[_0x69d9('0x1a')](_0x2d13ca);return _0x1184ec[_0x69d9('0x1f')](_0x69d9('0x20'),_0xdba687+'-'+_0x1ccf57+'/'+_0x4dfbce)[_0x69d9('0x1c')](_0x4dec91);}return null;};}function patchUpdates(_0x2ebe9f){return function(_0x553910){try{jsonpatch['apply'](_0x553910,_0x2ebe9f,!![]);}catch(_0x5188f5){return BPromise[_0x69d9('0x21')](_0x5188f5);}return _0x553910[_0x69d9('0x22')]();};}function saveUpdates(_0xabaf85,_0x909023){return function(_0x46889a){if(_0x46889a){return _0x46889a[_0x69d9('0x23')](_0xabaf85)['then'](function(_0x285787){return _0x285787;});}return null;};}function removeEntity(_0x244d42,_0x8ba384){return function(_0x5aeaae){if(_0x5aeaae){return _0x5aeaae[_0x69d9('0x24')]()['then'](function(){_0x244d42[_0x69d9('0x1a')](0xcc)[_0x69d9('0x1b')]();});}};}function handleEntityNotFound(_0x18315d,_0x175284){return function(_0x2a223e){if(!_0x2a223e){_0x18315d[_0x69d9('0x19')](0x194);}return _0x2a223e;};}function handleError(_0x130883,_0x31f090){_0x31f090=_0x31f090||0x1f4;return function(_0x2d8752){logger[_0x69d9('0x25')](_0x2d8752[_0x69d9('0x26')]);if(_0x2d8752['name']){delete _0x2d8752['name'];}_0x130883[_0x69d9('0x1a')](_0x31f090)[_0x69d9('0x27')](_0x2d8752);};}exports[_0x69d9('0x28')]=function(_0x41be06,_0x484412){var _0x76fe6a={},_0x4f9502={},_0x167ab0={'count':0x0,'rows':[]};var _0x4671dc=_[_0x69d9('0x29')](db[_0x69d9('0x2a')]['rawAttributes'],function(_0x5d9f46){return{'name':_0x5d9f46[_0x69d9('0x2b')],'type':_0x5d9f46['type'][_0x69d9('0x2c')]};});_0x4f9502['model']=_[_0x69d9('0x29')](_0x4671dc,'name');_0x4f9502[_0x69d9('0x2d')]=_[_0x69d9('0x2e')](_0x41be06[_0x69d9('0x2d')]);_0x4f9502['filters']=_[_0x69d9('0x2f')](_0x4f9502[_0x69d9('0x30')],_0x4f9502['query']);_0x76fe6a[_0x69d9('0x31')]=_['intersection'](_0x4f9502[_0x69d9('0x30')],qs['fields'](_0x41be06[_0x69d9('0x2d')][_0x69d9('0x32')]));_0x76fe6a['attributes']=_0x76fe6a['attributes']['length']?_0x76fe6a[_0x69d9('0x31')]:_0x4f9502['model'];if(!_0x41be06[_0x69d9('0x2d')][_0x69d9('0x33')](_0x69d9('0x34'))){_0x76fe6a[_0x69d9('0x35')]=qs[_0x69d9('0x35')](_0x41be06[_0x69d9('0x2d')]['limit']);_0x76fe6a['offset']=qs[_0x69d9('0x1e')](_0x41be06[_0x69d9('0x2d')][_0x69d9('0x1e')]);}_0x76fe6a[_0x69d9('0x36')]=qs[_0x69d9('0x37')](_0x41be06[_0x69d9('0x2d')][_0x69d9('0x37')]);_0x76fe6a[_0x69d9('0x38')]=qs['filters'](_[_0x69d9('0x39')](_0x41be06[_0x69d9('0x2d')],_0x4f9502[_0x69d9('0x3a')]),_0x4671dc);if(_0x41be06[_0x69d9('0x2d')][_0x69d9('0x3b')]){_0x76fe6a[_0x69d9('0x38')]=_['merge'](_0x76fe6a['where'],{'$or':_['map'](_0x4671dc,function(_0x439746){if(_0x439746['type']!==_0x69d9('0x3c')){var _0x30cb16={};_0x30cb16[_0x439746[_0x69d9('0x3d')]]={'$like':'%'+_0x41be06[_0x69d9('0x2d')][_0x69d9('0x3b')]+'%'};return _0x30cb16;}})});}_0x76fe6a=_[_0x69d9('0x3e')]({},_0x76fe6a,_0x41be06[_0x69d9('0x3f')]);var _0x164975={'where':_0x76fe6a[_0x69d9('0x38')]};return db[_0x69d9('0x2a')][_0x69d9('0x1d')](_0x164975)['then'](function(_0x5637a6){_0x167ab0['count']=_0x5637a6;if(_0x41be06['query']['includeAll']){_0x76fe6a[_0x69d9('0x40')]=[{'all':!![]}];}return db[_0x69d9('0x2a')][_0x69d9('0x41')](_0x76fe6a);})[_0x69d9('0x42')](function(_0x358ba1){_0x167ab0[_0x69d9('0x43')]=_0x358ba1;return _0x167ab0;})['then'](respondWithFilteredResult(_0x484412,_0x76fe6a))[_0x69d9('0x44')](handleError(_0x484412,null));};exports[_0x69d9('0x45')]=function(_0x4cfa51,_0x4da93b){var _0x21eabc={'raw':!![],'where':{'id':_0x4cfa51[_0x69d9('0x46')]['id']}},_0x4494c9={};_0x4494c9['model']=_[_0x69d9('0x2e')](db[_0x69d9('0x2a')][_0x69d9('0x47')]);_0x4494c9[_0x69d9('0x2d')]=_[_0x69d9('0x2e')](_0x4cfa51[_0x69d9('0x2d')]);_0x4494c9['filters']=_[_0x69d9('0x2f')](_0x4494c9[_0x69d9('0x30')],_0x4494c9['query']);_0x21eabc[_0x69d9('0x31')]=_[_0x69d9('0x2f')](_0x4494c9[_0x69d9('0x30')],qs[_0x69d9('0x32')](_0x4cfa51['query'][_0x69d9('0x32')]));_0x21eabc[_0x69d9('0x31')]=_0x21eabc[_0x69d9('0x31')]['length']?_0x21eabc[_0x69d9('0x31')]:_0x4494c9[_0x69d9('0x30')];if(_0x4cfa51[_0x69d9('0x2d')][_0x69d9('0x48')]){_0x21eabc[_0x69d9('0x40')]=[{'all':!![]}];}_0x21eabc=_[_0x69d9('0x3e')]({},_0x21eabc,_0x4cfa51['options']);return db[_0x69d9('0x2a')][_0x69d9('0x49')](_0x21eabc)['then'](handleEntityNotFound(_0x4da93b,null))[_0x69d9('0x42')](respondWithResult(_0x4da93b,null))[_0x69d9('0x44')](handleError(_0x4da93b,null));};exports[_0x69d9('0x4a')]=function(_0x2baf32,_0xd61329){return db[_0x69d9('0x2a')][_0x69d9('0x4a')](_0x2baf32['body'],{})[_0x69d9('0x42')](respondWithResult(_0xd61329,0xc9))[_0x69d9('0x44')](handleError(_0xd61329,null));};exports[_0x69d9('0x23')]=function(_0x2fa096,_0x3361ea){if(_0x2fa096['body']['id']){delete _0x2fa096[_0x69d9('0x4b')]['id'];}return db['SalesforceField'][_0x69d9('0x49')]({'where':{'id':_0x2fa096[_0x69d9('0x46')]['id']}})[_0x69d9('0x42')](handleEntityNotFound(_0x3361ea,null))[_0x69d9('0x42')](saveUpdates(_0x2fa096[_0x69d9('0x4b')],null))[_0x69d9('0x42')](respondWithResult(_0x3361ea,null))[_0x69d9('0x44')](handleError(_0x3361ea,null));};exports[_0x69d9('0x24')]=function(_0x1c3fc4,_0x344683){return db[_0x69d9('0x2a')][_0x69d9('0x49')]({'where':{'id':_0x1c3fc4['params']['id']}})[_0x69d9('0x42')](handleEntityNotFound(_0x344683,null))[_0x69d9('0x42')](removeEntity(_0x344683,null))['catch'](handleError(_0x344683,null));}; \ No newline at end of file +var _0x9a01=['path','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','limit','set','reject','save','update','destroy','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','SalesforceField','count','includeAll','then','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x19a2eb,_0x2df439){var _0x3c8514=function(_0x2b6204){while(--_0x2b6204){_0x19a2eb['push'](_0x19a2eb['shift']());}};_0x3c8514(++_0x2df439);}(_0x9a01,0x142));var _0x19a0=function(_0x3480d1,_0x296947){_0x3480d1=_0x3480d1-0x0;var _0x86e4df=_0x9a01[_0x3480d1];return _0x86e4df;};'use strict';var pdf=require(_0x19a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x19a0('0x1'));var zipdir=require(_0x19a0('0x2'));var jsonpatch=require(_0x19a0('0x3'));var rp=require(_0x19a0('0x4'));var moment=require('moment');var BPromise=require(_0x19a0('0x5'));var Mustache=require(_0x19a0('0x6'));var util=require(_0x19a0('0x7'));var path=require(_0x19a0('0x8'));var sox=require('sox');var csv=require(_0x19a0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x19a0('0xa'));var squel=require(_0x19a0('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x19a0('0xc'));var toCsv=require(_0x19a0('0x9'));var querystring=require(_0x19a0('0xd'));var Papa=require(_0x19a0('0xe'));var Redis=require('ioredis');var authService=require(_0x19a0('0xf'));var qs=require(_0x19a0('0x10'));var as=require(_0x19a0('0x11'));var hardwareService=require(_0x19a0('0x12'));var logger=require(_0x19a0('0x13'))(_0x19a0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21ce4d,_0x3e1a36){_0x3e1a36=_0x3e1a36||0xcc;return function(_0x4a96ca){if(_0x4a96ca){return _0x21ce4d[_0x19a0('0x15')](_0x3e1a36);}return _0x21ce4d[_0x19a0('0x16')](_0x3e1a36)[_0x19a0('0x17')]();};}function respondWithResult(_0x5002c2,_0x33a4b6){_0x33a4b6=_0x33a4b6||0xc8;return function(_0x47c94c){if(_0x47c94c){return _0x5002c2['status'](_0x33a4b6)[_0x19a0('0x18')](_0x47c94c);}};}function respondWithFilteredResult(_0x41b888,_0x3949fb){return function(_0x4d1baa){if(_0x4d1baa){var _0x192b77=_0x4d1baa['count'],_0x28bd78=_0x3949fb[_0x19a0('0x19')],_0x5dff97=_0x3949fb[_0x19a0('0x19')]+_0x3949fb[_0x19a0('0x1a')],_0x45e5f7;if(_0x5dff97>=_0x192b77){_0x5dff97=_0x192b77;_0x45e5f7=0xc8;}else{_0x45e5f7=0xce;}_0x41b888[_0x19a0('0x16')](_0x45e5f7);return _0x41b888[_0x19a0('0x1b')]('Content-Range',_0x28bd78+'-'+_0x5dff97+'/'+_0x192b77)[_0x19a0('0x18')](_0x4d1baa);}return null;};}function patchUpdates(_0x4a2960){return function(_0x3a77d2){try{jsonpatch['apply'](_0x3a77d2,_0x4a2960,!![]);}catch(_0x33b26a){return BPromise[_0x19a0('0x1c')](_0x33b26a);}return _0x3a77d2[_0x19a0('0x1d')]();};}function saveUpdates(_0x2eef38,_0x5ea1fc){return function(_0x268413){if(_0x268413){return _0x268413[_0x19a0('0x1e')](_0x2eef38)['then'](function(_0x1aefa6){return _0x1aefa6;});}return null;};}function removeEntity(_0x128d4b,_0x4ca7e7){return function(_0x26a801){if(_0x26a801){return _0x26a801[_0x19a0('0x1f')]()['then'](function(){_0x128d4b[_0x19a0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b185,_0x359cbd){return function(_0x22d7c0){if(!_0x22d7c0){_0x48b185[_0x19a0('0x15')](0x194);}return _0x22d7c0;};}function handleError(_0x31df86,_0x5af4f5){_0x5af4f5=_0x5af4f5||0x1f4;return function(_0x56cf17){logger[_0x19a0('0x20')](_0x56cf17['stack']);if(_0x56cf17['name']){delete _0x56cf17[_0x19a0('0x21')];}_0x31df86[_0x19a0('0x16')](_0x5af4f5)[_0x19a0('0x22')](_0x56cf17);};}exports[_0x19a0('0x23')]=function(_0x2b2f2a,_0x31273a){var _0x38e5bc={},_0x39cc7a={},_0x1a0025={'count':0x0,'rows':[]};var _0x82d51=_[_0x19a0('0x24')](db['SalesforceField'][_0x19a0('0x25')],function(_0x566c45){return{'name':_0x566c45[_0x19a0('0x26')],'type':_0x566c45['type']['key']};});_0x39cc7a[_0x19a0('0x27')]=_['map'](_0x82d51,_0x19a0('0x21'));_0x39cc7a[_0x19a0('0x28')]=_[_0x19a0('0x29')](_0x2b2f2a[_0x19a0('0x28')]);_0x39cc7a['filters']=_[_0x19a0('0x2a')](_0x39cc7a[_0x19a0('0x27')],_0x39cc7a[_0x19a0('0x28')]);_0x38e5bc[_0x19a0('0x2b')]=_[_0x19a0('0x2a')](_0x39cc7a[_0x19a0('0x27')],qs[_0x19a0('0x2c')](_0x2b2f2a['query'][_0x19a0('0x2c')]));_0x38e5bc[_0x19a0('0x2b')]=_0x38e5bc['attributes'][_0x19a0('0x2d')]?_0x38e5bc[_0x19a0('0x2b')]:_0x39cc7a[_0x19a0('0x27')];if(!_0x2b2f2a[_0x19a0('0x28')]['hasOwnProperty']('nolimit')){_0x38e5bc[_0x19a0('0x1a')]=qs[_0x19a0('0x1a')](_0x2b2f2a[_0x19a0('0x28')][_0x19a0('0x1a')]);_0x38e5bc[_0x19a0('0x19')]=qs['offset'](_0x2b2f2a[_0x19a0('0x28')][_0x19a0('0x19')]);}_0x38e5bc['order']=qs[_0x19a0('0x2e')](_0x2b2f2a[_0x19a0('0x28')][_0x19a0('0x2e')]);_0x38e5bc[_0x19a0('0x2f')]=qs['filters'](_[_0x19a0('0x30')](_0x2b2f2a[_0x19a0('0x28')],_0x39cc7a[_0x19a0('0x31')]),_0x82d51);if(_0x2b2f2a[_0x19a0('0x28')][_0x19a0('0x32')]){_0x38e5bc['where']=_[_0x19a0('0x33')](_0x38e5bc[_0x19a0('0x2f')],{'$or':_[_0x19a0('0x24')](_0x82d51,function(_0xeb83fd){if(_0xeb83fd[_0x19a0('0x34')]!==_0x19a0('0x35')){var _0x51f5de={};_0x51f5de[_0xeb83fd[_0x19a0('0x21')]]={'$like':'%'+_0x2b2f2a[_0x19a0('0x28')]['filter']+'%'};return _0x51f5de;}})});}_0x38e5bc=_[_0x19a0('0x33')]({},_0x38e5bc,_0x2b2f2a[_0x19a0('0x36')]);var _0x51d132={'where':_0x38e5bc['where']};return db[_0x19a0('0x37')]['count'](_0x51d132)['then'](function(_0x271b3d){_0x1a0025[_0x19a0('0x38')]=_0x271b3d;if(_0x2b2f2a[_0x19a0('0x28')][_0x19a0('0x39')]){_0x38e5bc['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x38e5bc);})[_0x19a0('0x3a')](function(_0xd3990f){_0x1a0025[_0x19a0('0x3b')]=_0xd3990f;return _0x1a0025;})[_0x19a0('0x3a')](respondWithFilteredResult(_0x31273a,_0x38e5bc))[_0x19a0('0x3c')](handleError(_0x31273a,null));};exports[_0x19a0('0x3d')]=function(_0x1d6f52,_0x4593e9){var _0x5f5679={'raw':!![],'where':{'id':_0x1d6f52[_0x19a0('0x3e')]['id']}},_0x7fa951={};_0x7fa951[_0x19a0('0x27')]=_[_0x19a0('0x29')](db[_0x19a0('0x37')][_0x19a0('0x25')]);_0x7fa951[_0x19a0('0x28')]=_['keys'](_0x1d6f52['query']);_0x7fa951[_0x19a0('0x31')]=_[_0x19a0('0x2a')](_0x7fa951[_0x19a0('0x27')],_0x7fa951[_0x19a0('0x28')]);_0x5f5679[_0x19a0('0x2b')]=_[_0x19a0('0x2a')](_0x7fa951['model'],qs[_0x19a0('0x2c')](_0x1d6f52['query'][_0x19a0('0x2c')]));_0x5f5679[_0x19a0('0x2b')]=_0x5f5679[_0x19a0('0x2b')][_0x19a0('0x2d')]?_0x5f5679[_0x19a0('0x2b')]:_0x7fa951[_0x19a0('0x27')];if(_0x1d6f52[_0x19a0('0x28')][_0x19a0('0x39')]){_0x5f5679['include']=[{'all':!![]}];}_0x5f5679=_[_0x19a0('0x33')]({},_0x5f5679,_0x1d6f52[_0x19a0('0x36')]);return db['SalesforceField'][_0x19a0('0x3f')](_0x5f5679)[_0x19a0('0x3a')](handleEntityNotFound(_0x4593e9,null))['then'](respondWithResult(_0x4593e9,null))['catch'](handleError(_0x4593e9,null));};exports[_0x19a0('0x40')]=function(_0x2a22d2,_0xb8b5f0){return db[_0x19a0('0x37')]['create'](_0x2a22d2[_0x19a0('0x41')],{})['then'](respondWithResult(_0xb8b5f0,0xc9))[_0x19a0('0x3c')](handleError(_0xb8b5f0,null));};exports['update']=function(_0xdfdc90,_0x584428){if(_0xdfdc90[_0x19a0('0x41')]['id']){delete _0xdfdc90[_0x19a0('0x41')]['id'];}return db['SalesforceField'][_0x19a0('0x3f')]({'where':{'id':_0xdfdc90[_0x19a0('0x3e')]['id']}})[_0x19a0('0x3a')](handleEntityNotFound(_0x584428,null))[_0x19a0('0x3a')](saveUpdates(_0xdfdc90['body'],null))[_0x19a0('0x3a')](respondWithResult(_0x584428,null))['catch'](handleError(_0x584428,null));};exports[_0x19a0('0x1f')]=function(_0x343080,_0x2d2fc8){return db[_0x19a0('0x37')][_0x19a0('0x3f')]({'where':{'id':_0x343080[_0x19a0('0x3e')]['id']}})[_0x19a0('0x3a')](handleEntityNotFound(_0x2d2fc8,null))[_0x19a0('0x3a')](removeEntity(_0x2d2fc8,null))['catch'](handleError(_0x2d2fc8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 8cc0c9f..3df8023 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 _0x1eaa=['SalesforceField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','define'];(function(_0x1555d0,_0x1e6ff5){var _0x48dbd6=function(_0x3c1c80){while(--_0x3c1c80){_0x1555d0['push'](_0x1555d0['shift']());}};_0x48dbd6(++_0x1e6ff5);}(_0x1eaa,0xd3));var _0xa1ea=function(_0x20a140,_0x47a4d7){_0x20a140=_0x20a140-0x0;var _0x9184d7=_0x1eaa[_0x20a140];return _0x9184d7;};'use strict';var _=require(_0xa1ea('0x0'));var util=require(_0xa1ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa1ea('0x2'));var BPromise=require(_0xa1ea('0x3'));var rp=require(_0xa1ea('0x4'));var fs=require('fs');var path=require(_0xa1ea('0x5'));var rimraf=require(_0xa1ea('0x6'));var config=require('../../config/environment');var attributes=require(_0xa1ea('0x7'));module['exports']=function(_0x398771,_0x3e8e37){return _0x398771[_0xa1ea('0x8')](_0xa1ea('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xa1ea('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d5a=['SalesforceField','int_salesforce_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceField.attributes','exports'];(function(_0x376f48,_0xdcd5bf){var _0x50aba9=function(_0x3b1b79){while(--_0x3b1b79){_0x376f48['push'](_0x376f48['shift']());}};_0x50aba9(++_0xdcd5bf);}(_0x1d5a,0x1d7));var _0xa1d5=function(_0x74d0f,_0x5883f0){_0x74d0f=_0x74d0f-0x0;var _0x339591=_0x1d5a[_0x74d0f];return _0x339591;};'use strict';var _=require(_0xa1d5('0x0'));var util=require(_0xa1d5('0x1'));var logger=require(_0xa1d5('0x2'))(_0xa1d5('0x3'));var moment=require(_0xa1d5('0x4'));var BPromise=require(_0xa1d5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1d5('0x6'));var rimraf=require(_0xa1d5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1d5('0x8'));module[_0xa1d5('0x9')]=function(_0x2a56a8,_0x978b19){return _0x2a56a8['define'](_0xa1d5('0xa'),attributes,{'tableName':_0xa1d5('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xa1d5('0xc')],'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 2080a6b..ee1e1d1 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xda3f,0xec));var _0xfda3=function(_0xc9e484,_0x6ad32d){_0xc9e484=_0xc9e484-0x0;var _0x31e3e6=_0xda3f[_0xc9e484];return _0x31e3e6;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('SalesforceField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x519a3a,_0x314d5a){var _0x590492=function(_0x50d419){while(--_0x50d419){_0x519a3a['push'](_0x519a3a['shift']());}};_0x590492(++_0x314d5a);}(_0x0bb5,0x148));var _0x50bb=function(_0x5eb95e,_0x2a2842){_0x5eb95e=_0x5eb95e-0x0;var _0x355797=_0x0bb5[_0x5eb95e];return _0x355797;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 23b857b..395cb6d 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 _0x0b31=['path','express','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0b31,0x1a2));var _0x10b3=function(_0x4fda41,_0x1925f3){_0x4fda41=_0x4fda41-0x0;var _0x46e719=_0x0b31[_0x4fda41];return _0x46e719;};'use strict';var multer=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var path=require(_0x10b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10b3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x10b3('0x4'));var config=require(_0x10b3('0x5'));var controller=require(_0x10b3('0x6'));router[_0x10b3('0x7')]('/',auth[_0x10b3('0x8')](),controller[_0x10b3('0x9')]);router[_0x10b3('0x7')](_0x10b3('0xa'),auth[_0x10b3('0x8')](),controller['show']);router[_0x10b3('0x7')](_0x10b3('0xb'),auth[_0x10b3('0x8')](),controller[_0x10b3('0xc')]);router['get'](_0x10b3('0xd'),auth[_0x10b3('0x8')](),controller['getFields']);router[_0x10b3('0xe')]('/',auth[_0x10b3('0x8')](),controller[_0x10b3('0xf')]);router[_0x10b3('0xe')](_0x10b3('0xb'),auth['isAuthenticated'](),controller[_0x10b3('0x10')]);router[_0x10b3('0x11')](_0x10b3('0xa'),auth[_0x10b3('0x8')](),controller['update']);router[_0x10b3('0x12')](_0x10b3('0xa'),auth[_0x10b3('0x8')](),controller[_0x10b3('0x13')]);module[_0x10b3('0x14')]=router; \ No newline at end of file +var _0x0738=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x4f12c3,_0x5831e3){var _0x4f39af=function(_0x5db48f){while(--_0x5db48f){_0x4f12c3['push'](_0x4f12c3['shift']());}};_0x4f39af(++_0x5831e3);}(_0x0738,0x6e));var _0x8073=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x0738[_0x35387d];return _0x3aba56;};'use strict';var multer=require(_0x8073('0x0'));var util=require('util');var path=require(_0x8073('0x1'));var timeout=require(_0x8073('0x2'));var express=require(_0x8073('0x3'));var router=express[_0x8073('0x4')]();var auth=require(_0x8073('0x5'));var interaction=require(_0x8073('0x6'));var config=require(_0x8073('0x7'));var controller=require(_0x8073('0x8'));router[_0x8073('0x9')]('/',auth[_0x8073('0xa')](),controller[_0x8073('0xb')]);router['get'](_0x8073('0xc'),auth[_0x8073('0xa')](),controller[_0x8073('0xd')]);router[_0x8073('0x9')](_0x8073('0xe'),auth[_0x8073('0xa')](),controller[_0x8073('0xf')]);router[_0x8073('0x9')](_0x8073('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x8073('0x11')]('/',auth[_0x8073('0xa')](),controller[_0x8073('0x12')]);router[_0x8073('0x11')]('/:id/configurations',auth[_0x8073('0xa')](),controller[_0x8073('0x13')]);router['put'](_0x8073('0xc'),auth['isAuthenticated'](),controller[_0x8073('0x14')]);router[_0x8073('0x15')](_0x8073('0xc'),auth[_0x8073('0xa')](),controller['destroy']);module[_0x8073('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 0062ab0..a9bcd1f 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 _0x5298=['username','remoteUri','STRING'];(function(_0xaa40,_0x2c1df0){var _0x350665=function(_0x19c2fa){while(--_0x19c2fa){_0xaa40['push'](_0xaa40['shift']());}};_0x350665(++_0x2c1df0);}(_0x5298,0x13d));var _0x8529=function(_0x51d2e8,_0x465d74){_0x51d2e8=_0x51d2e8-0x0;var _0x2cd392=_0x5298[_0x51d2e8];return _0x2cd392;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8529('0x0')]},'description':{'type':Sequelize[_0x8529('0x0')]},'username':{'type':Sequelize[_0x8529('0x0')],'unique':_0x8529('0x1')},'password':{'type':Sequelize[_0x8529('0x0')]},'email':{'type':Sequelize[_0x8529('0x0')]},'remoteUri':{'type':Sequelize[_0x8529('0x0')],'unique':_0x8529('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e40=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1d184c,_0xf3d623){var _0x1b1fd4=function(_0x27affd){while(--_0x27affd){_0x1d184c['push'](_0x1d184c['shift']());}};_0x1b1fd4(++_0xf3d623);}(_0x0e40,0x171));var _0x00e4=function(_0x590862,_0x5c4a72){_0x590862=_0x590862-0x0;var _0x875b5e=_0x0e40[_0x590862];return _0x875b5e;};'use strict';var Sequelize=require(_0x00e4('0x0'));module[_0x00e4('0x1')]={'name':{'type':Sequelize[_0x00e4('0x2')]},'description':{'type':Sequelize[_0x00e4('0x2')]},'username':{'type':Sequelize[_0x00e4('0x2')],'unique':_0x00e4('0x3')},'password':{'type':Sequelize[_0x00e4('0x2')]},'email':{'type':Sequelize[_0x00e4('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x00e4('0x4')},'serverUrl':{'type':Sequelize[_0x00e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0831524..4e144bc 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 _0xc48e=['substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','log','remove','includes','forEach','label','all','assign','TCL:\x20_object','internalType','push','ServiceNow\x20error:\x20','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','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~!@#$%^&-_=+[{]}.','request','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','end','status','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','ServicenowAccount','rawAttributes','fieldName','type','map','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','pick','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','hold_reason','knowledge','close_code','notify','incident_state','severity','category','made_sla','caused_by','upon_reject','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','password','remoteUri','serverUrl','slice'];(function(_0xed353f,_0x4ddc1c){var _0x205fde=function(_0x21452a){while(--_0x21452a){_0xed353f['push'](_0xed353f['shift']());}};_0x205fde(++_0x4ddc1c);}(_0xc48e,0xe0));var _0xec48=function(_0x4c1aaa,_0x231c94){_0x4c1aaa=_0x4c1aaa-0x0;var _0x42e9da=_0xc48e[_0x4c1aaa];return _0x42e9da;};'use strict';var pdf=require(_0xec48('0x0'));var emlformat=require(_0xec48('0x1'));var rimraf=require(_0xec48('0x2'));var zipdir=require(_0xec48('0x3'));var jsonpatch=require(_0xec48('0x4'));var rp=require(_0xec48('0x5'));var moment=require(_0xec48('0x6'));var BPromise=require(_0xec48('0x7'));var Mustache=require(_0xec48('0x8'));var util=require(_0xec48('0x9'));var path=require(_0xec48('0xa'));var sox=require(_0xec48('0xb'));var csv=require('to-csv');var ejs=require(_0xec48('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xec48('0xd'));var crypto=require(_0xec48('0xe'));var jsforce=require(_0xec48('0xf'));var deskjs=require(_0xec48('0x10'));var toCsv=require(_0xec48('0x11'));var querystring=require(_0xec48('0x12'));var Papa=require(_0xec48('0x13'));var Redis=require(_0xec48('0x14'));var authService=require(_0xec48('0x15'));var qs=require(_0xec48('0x16'));var as=require(_0xec48('0x17'));var hardwareService=require(_0xec48('0x18'));var logger=require(_0xec48('0x19'))(_0xec48('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xec48('0x1b'))['db'];var integrations=require(_0xec48('0x1c'));var jayson=require('jayson/promise');var client=jayson[_0xec48('0x1d')][_0xec48('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5d408d,_0x55d148,_0x5c90be){if(_0x5c90be){var _0x2d0cc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d0cc4[_0xec48('0x1f')](_0x55d148)){return _0x5d408d;}else{throw new db[(_0xec48('0x20'))]['ValidationError'](_0xec48('0x21'));}}else{return _0x5d408d;}}function respondWithRpcPromise(_0x34265f,_0x315c5c,_0x4fb0d5,_0x527ed3){return new BPromise(function(_0x4dcea5,_0x2a02a4){var _0x3aa098=_0x527ed3||client;return _0x3aa098[_0xec48('0x22')](_0x34265f,_0x4fb0d5)['then'](function(_0x4dadb7){logger[_0xec48('0x23')](_0xec48('0x24'),_0x315c5c,'request\x20sent');logger[_0xec48('0x25')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x315c5c,_0xec48('0x26'),JSON[_0xec48('0x27')](_0x4dadb7));if(_0x4dadb7[_0xec48('0x28')]){if(_0x4dadb7[_0xec48('0x28')][_0xec48('0x29')]===0x1f4){logger[_0xec48('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x315c5c,_0x4dadb7['error']['message']);return _0x2a02a4(_0x4dadb7[_0xec48('0x28')][_0xec48('0x2a')]);}logger[_0xec48('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x315c5c,_0x4dadb7['error']['message']);return _0x4dcea5(_0x4dadb7[_0xec48('0x28')]['message']);}else{logger[_0xec48('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0x315c5c,_0xec48('0x26'));_0x4dcea5(_0x4dadb7[_0xec48('0x2b')]['message']);}})[_0xec48('0x2c')](function(_0x414ae){logger[_0xec48('0x28')](_0xec48('0x24'),_0x315c5c,_0x414ae);_0x2a02a4(_0x414ae);});});}function respondWithStatusCode(_0x558bf5,_0x3c5dc7){_0x3c5dc7=_0x3c5dc7||0xcc;return function(_0x379d0d){if(_0x379d0d){return _0x558bf5['sendStatus'](_0x3c5dc7);}return _0x558bf5['status'](_0x3c5dc7)[_0xec48('0x2d')]();};}function respondWithResult(_0x9b1b49,_0x33ef03){_0x33ef03=_0x33ef03||0xc8;return function(_0x3c5205){if(_0x3c5205){return _0x9b1b49[_0xec48('0x2e')](_0x33ef03)['json'](_0x3c5205);}};}function respondWithFilteredResult(_0x22e547,_0x7622b6){return function(_0x30eae6){if(_0x30eae6){var _0x1cd954=_0x30eae6[_0xec48('0x2f')],_0x16418e=_0x7622b6[_0xec48('0x30')],_0x5b4fb9=_0x7622b6[_0xec48('0x30')]+_0x7622b6[_0xec48('0x31')],_0x1b19ba;if(_0x5b4fb9>=_0x1cd954){_0x5b4fb9=_0x1cd954;_0x1b19ba=0xc8;}else{_0x1b19ba=0xce;}_0x22e547[_0xec48('0x2e')](_0x1b19ba);return _0x22e547[_0xec48('0x32')](_0xec48('0x33'),_0x16418e+'-'+_0x5b4fb9+'/'+_0x1cd954)['json'](_0x30eae6);}return null;};}function patchUpdates(_0x3aed0b){return function(_0x241db1){try{jsonpatch[_0xec48('0x34')](_0x241db1,_0x3aed0b,!![]);}catch(_0x401bc7){return BPromise[_0xec48('0x35')](_0x401bc7);}return _0x241db1['save']();};}function saveUpdates(_0x495115,_0x43b7da){return function(_0x4e7a99){if(_0x4e7a99){return _0x4e7a99[_0xec48('0x36')](_0x495115)[_0xec48('0x37')](function(_0x1f6763){return _0x1f6763;});}return null;};}function removeEntity(_0x55d9c2,_0x44686d){return function(_0x104357){if(_0x104357){return _0x104357[_0xec48('0x38')]()[_0xec48('0x37')](function(){_0x55d9c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1b719,_0x17b2be){return function(_0x31f9c3){if(!_0x31f9c3){_0xa1b719[_0xec48('0x39')](0x194);}return _0x31f9c3;};}function handleError(_0x482ee8,_0xa39f92){_0xa39f92=_0xa39f92||0x1f4;return function(_0x5774f4){logger[_0xec48('0x28')](_0x5774f4[_0xec48('0x3a')]);if(_0x5774f4[_0xec48('0x3b')]){delete _0x5774f4[_0xec48('0x3b')];}_0x482ee8['status'](_0xa39f92)['send'](_0x5774f4);};}exports['index']=function(_0x5869db,_0x301fb9){var _0x114c4b={},_0x2c74b0={},_0x5ea137={'count':0x0,'rows':[]};var _0x4cf77b=_['map'](db[_0xec48('0x3c')][_0xec48('0x3d')],function(_0x2fc44a){return{'name':_0x2fc44a[_0xec48('0x3e')],'type':_0x2fc44a[_0xec48('0x3f')]['key']};});_0x2c74b0['model']=_[_0xec48('0x40')](_0x4cf77b,_0xec48('0x3b'));_0x2c74b0['query']=_[_0xec48('0x41')](_0x5869db['query']);_0x2c74b0[_0xec48('0x42')]=_['intersection'](_0x2c74b0[_0xec48('0x43')],_0x2c74b0[_0xec48('0x44')]);_0x114c4b[_0xec48('0x45')]=_[_0xec48('0x46')](_0x2c74b0[_0xec48('0x43')],qs[_0xec48('0x47')](_0x5869db[_0xec48('0x44')][_0xec48('0x47')]));_0x114c4b[_0xec48('0x45')]=_0x114c4b['attributes'][_0xec48('0x48')]?_0x114c4b['attributes']:_0x2c74b0['model'];if(!_0x5869db[_0xec48('0x44')][_0xec48('0x49')](_0xec48('0x4a'))){_0x114c4b[_0xec48('0x31')]=qs[_0xec48('0x31')](_0x5869db['query'][_0xec48('0x31')]);_0x114c4b['offset']=qs[_0xec48('0x30')](_0x5869db[_0xec48('0x44')][_0xec48('0x30')]);}_0x114c4b['order']=qs[_0xec48('0x4b')](_0x5869db[_0xec48('0x44')][_0xec48('0x4b')]);_0x114c4b[_0xec48('0x4c')]=qs[_0xec48('0x42')](_['pick'](_0x5869db[_0xec48('0x44')],_0x2c74b0[_0xec48('0x42')]),_0x4cf77b);if(_0x5869db['query']['filter']){_0x114c4b[_0xec48('0x4c')]=_[_0xec48('0x4d')](_0x114c4b[_0xec48('0x4c')],{'$or':_[_0xec48('0x40')](_0x4cf77b,function(_0x321a03){if(_0x321a03[_0xec48('0x3f')]!==_0xec48('0x4e')){var _0x24f10c={};_0x24f10c[_0x321a03[_0xec48('0x3b')]]={'$like':'%'+_0x5869db[_0xec48('0x44')][_0xec48('0x4f')]+'%'};return _0x24f10c;}})});}_0x114c4b=_['merge']({},_0x114c4b,_0x5869db[_0xec48('0x50')]);var _0x464db4={'where':_0x114c4b[_0xec48('0x4c')]};return db[_0xec48('0x3c')][_0xec48('0x2f')](_0x464db4)['then'](function(_0x556e17){_0x5ea137[_0xec48('0x2f')]=_0x556e17;if(_0x5869db[_0xec48('0x44')][_0xec48('0x51')]){_0x114c4b[_0xec48('0x52')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xec48('0x53')](_0x114c4b);})['then'](function(_0x42c1b8){_0x5ea137[_0xec48('0x54')]=_0x42c1b8;return _0x5ea137;})[_0xec48('0x37')](respondWithFilteredResult(_0x301fb9,_0x114c4b))[_0xec48('0x2c')](handleError(_0x301fb9,null));};exports['show']=function(_0x53c109,_0x24c728){var _0x3d7f4f={'raw':![],'where':{'id':_0x53c109[_0xec48('0x55')]['id']}},_0x12eca1={};_0x12eca1[_0xec48('0x43')]=_[_0xec48('0x41')](db[_0xec48('0x3c')][_0xec48('0x3d')]);_0x12eca1[_0xec48('0x44')]=_[_0xec48('0x41')](_0x53c109[_0xec48('0x44')]);_0x12eca1[_0xec48('0x42')]=_[_0xec48('0x46')](_0x12eca1[_0xec48('0x43')],_0x12eca1[_0xec48('0x44')]);_0x3d7f4f[_0xec48('0x45')]=_['intersection'](_0x12eca1[_0xec48('0x43')],qs[_0xec48('0x47')](_0x53c109[_0xec48('0x44')][_0xec48('0x47')]));_0x3d7f4f['attributes']=_0x3d7f4f[_0xec48('0x45')]['length']?_0x3d7f4f[_0xec48('0x45')]:_0x12eca1[_0xec48('0x43')];if(_0x53c109[_0xec48('0x44')]['includeAll']){_0x3d7f4f[_0xec48('0x52')]=[{'all':!![]}];}_0x3d7f4f=_[_0xec48('0x4d')]({},_0x3d7f4f,_0x53c109['options']);return db['ServicenowAccount'][_0xec48('0x56')](_0x3d7f4f)[_0xec48('0x37')](handleEntityNotFound(_0x24c728,null))[_0xec48('0x37')](respondWithResult(_0x24c728,null))[_0xec48('0x2c')](handleError(_0x24c728,null));};exports[_0xec48('0x57')]=function(_0x5aa4ec,_0x36fbca){return db['ServicenowAccount']['create'](_0x5aa4ec[_0xec48('0x58')],{})[_0xec48('0x37')](respondWithResult(_0x36fbca,0xc9))[_0xec48('0x2c')](handleError(_0x36fbca,null));};exports['update']=function(_0x5986ca,_0x229c23){if(_0x5986ca['body']['id']){delete _0x5986ca[_0xec48('0x58')]['id'];}return db[_0xec48('0x3c')][_0xec48('0x56')]({'where':{'id':_0x5986ca['params']['id']}})[_0xec48('0x37')](handleEntityNotFound(_0x229c23,null))['then'](saveUpdates(_0x5986ca[_0xec48('0x58')],null))[_0xec48('0x37')](respondWithResult(_0x229c23,null))[_0xec48('0x2c')](handleError(_0x229c23,null));};exports['destroy']=function(_0x8f94f6,_0x3c71e8){return db[_0xec48('0x3c')][_0xec48('0x56')]({'where':{'id':_0x8f94f6['params']['id']}})[_0xec48('0x37')](handleEntityNotFound(_0x3c71e8,null))[_0xec48('0x37')](removeEntity(_0x3c71e8,null))[_0xec48('0x2c')](handleError(_0x3c71e8,null));};exports[_0xec48('0x59')]=function(_0x4e14f2,_0x1f9eb4,_0x515c0c){var _0x5c0c5c={};var _0x4a8172={};var _0x32d709;var _0x45a99e;return db[_0xec48('0x3c')][_0xec48('0x5a')]({'where':{'id':_0x4e14f2['params']['id']}})['then'](handleEntityNotFound(_0x1f9eb4,null))[_0xec48('0x37')](function(_0x15e703){if(_0x15e703){_0x32d709=_0x15e703;_0x4a8172[_0xec48('0x43')]=_['keys'](db[_0xec48('0x5b')][_0xec48('0x3d')]);_0x4a8172[_0xec48('0x44')]=_[_0xec48('0x41')](_0x4e14f2[_0xec48('0x44')]);_0x4a8172[_0xec48('0x42')]=_[_0xec48('0x46')](_0x4a8172['model'],_0x4a8172[_0xec48('0x44')]);_0x5c0c5c['attributes']=_[_0xec48('0x46')](_0x4a8172[_0xec48('0x43')],qs[_0xec48('0x47')](_0x4e14f2[_0xec48('0x44')]['fields']));_0x5c0c5c[_0xec48('0x45')]=_0x5c0c5c[_0xec48('0x45')][_0xec48('0x48')]?_0x5c0c5c['attributes']:_0x4a8172[_0xec48('0x43')];_0x5c0c5c[_0xec48('0x5c')]=qs['sort'](_0x4e14f2[_0xec48('0x44')]['sort']);_0x5c0c5c['where']=qs['filters'](_[_0xec48('0x5d')](_0x4e14f2[_0xec48('0x44')],_0x4a8172['filters']));if(_0x4e14f2[_0xec48('0x44')]['filter']){_0x5c0c5c[_0xec48('0x4c')]=_[_0xec48('0x4d')](_0x5c0c5c[_0xec48('0x4c')],{'$or':_['map'](_0x5c0c5c['attributes'],function(_0x794eb9){var _0x30f329={};_0x30f329[_0x794eb9]={'$like':'%'+_0x4e14f2[_0xec48('0x44')][_0xec48('0x4f')]+'%'};return _0x30f329;})});}_0x5c0c5c=_[_0xec48('0x4d')]({},_0x5c0c5c,_0x4e14f2[_0xec48('0x50')]);return _0x32d709[_0xec48('0x59')](_0x5c0c5c);}})[_0xec48('0x37')](function(_0x26182d){if(_0x26182d){_0x45a99e=_0x26182d[_0xec48('0x48')];if(!_0x4e14f2[_0xec48('0x44')][_0xec48('0x49')](_0xec48('0x4a'))){_0x5c0c5c[_0xec48('0x31')]=qs[_0xec48('0x31')](_0x4e14f2[_0xec48('0x44')][_0xec48('0x31')]);_0x5c0c5c[_0xec48('0x30')]=qs[_0xec48('0x30')](_0x4e14f2[_0xec48('0x44')][_0xec48('0x30')]);}return _0x32d709['getConfigurations'](_0x5c0c5c);}})[_0xec48('0x37')](function(_0x50e478){if(_0x50e478){return _0x50e478?{'count':_0x45a99e,'rows':_0x50e478}:null;}})['then'](respondWithResult(_0x1f9eb4,null))[_0xec48('0x2c')](handleError(_0x1f9eb4,null));};exports['addConfiguration']=function(_0x125d7f,_0x1d3fcc,_0x1ae277){if(_0x125d7f['body']['id']){delete _0x125d7f['body']['id'];}return db[_0xec48('0x3c')]['findOne']({'where':{'id':_0x125d7f[_0xec48('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d3fcc,null))[_0xec48('0x37')](function(_0x3baedb){if(_0x3baedb){_0x125d7f[_0xec48('0x58')]['AccountId']=_0x3baedb['id'];_0x125d7f[_0xec48('0x58')]['Subjects']=integrations[_0xec48('0x5e')](_0x125d7f[_0xec48('0x58')][_0xec48('0x5f')],_0x125d7f[_0xec48('0x58')][_0xec48('0x3f')]);_0x125d7f['body'][_0xec48('0x60')]=integrations['getDescriptions'](_0x125d7f[_0xec48('0x58')][_0xec48('0x5f')],_0x125d7f[_0xec48('0x58')][_0xec48('0x3f')]);return db[_0xec48('0x5b')][_0xec48('0x57')](_0x125d7f[_0xec48('0x58')],{'include':[{'model':db[_0xec48('0x61')],'as':_0xec48('0x62')},{'model':db[_0xec48('0x61')],'as':_0xec48('0x60')}]});}return null;})['then'](respondWithResult(_0x1d3fcc,null))[_0xec48('0x2c')](handleError(_0x1d3fcc,null));};exports[_0xec48('0x63')]=function(_0x59ed2c,_0x1b229f,_0xef71bc){var _0x4079a2=['made_sla',_0xec48('0x64'),_0xec48('0x65'),'subcategory',_0xec48('0x66'),_0xec48('0x67'),_0xec48('0x68'),_0xec48('0x69'),_0xec48('0x6a')];var _0x311048=['parent',_0xec48('0x6b'),_0xec48('0x6c'),'watch_list',_0xec48('0x6d'),'sys_updated_on','child_incidents','hold_reason','approval_history','number',_0xec48('0x6e'),_0xec48('0x6f'),_0xec48('0x70'),_0xec48('0x71'),'sys_created_on',_0xec48('0x72'),'state','sys_created_by',_0xec48('0x65'),'order',_0xec48('0x73'),_0xec48('0x74'),_0xec48('0x75'),'delivery_plan',_0xec48('0x76'),_0xec48('0x77'),_0xec48('0x78'),_0xec48('0x79'),_0xec48('0x7a'),_0xec48('0x7b'),_0xec48('0x7c'),'time_worked',_0xec48('0x7d'),_0xec48('0x7e'),_0xec48('0x7f'),'group_list',_0xec48('0x80'),_0xec48('0x81'),_0xec48('0x82'),_0xec48('0x83'),_0xec48('0x84'),'subcategory',_0xec48('0x85'),'short_description',_0xec48('0x66'),_0xec48('0x86'),_0xec48('0x87'),_0xec48('0x88'),_0xec48('0x89'),_0xec48('0x8a'),'additional_assignee_list',_0xec48('0x8b'),_0xec48('0x8c'),_0xec48('0x67'),_0xec48('0x8d'),_0xec48('0x8e'),_0xec48('0x8f'),_0xec48('0x90'),_0xec48('0x91'),_0xec48('0x92'),'contact_type',_0xec48('0x93'),_0xec48('0x68'),_0xec48('0x94'),_0xec48('0x95'),_0xec48('0x96'),_0xec48('0x97'),_0xec48('0x98'),'assigned_to',_0xec48('0x69'),'comments',_0xec48('0x99'),_0xec48('0x9a'),_0xec48('0x9b'),_0xec48('0x9c'),_0xec48('0x9d'),'reopen_count',_0xec48('0x9e'),'escalation',_0xec48('0x9f'),_0xec48('0xa0'),_0xec48('0xa1'),_0xec48('0x6a')];var _0x42f2ac='';var _0x11db9e='';var _0x2369ff=[];var _0xe61927='';var _0x5406c2='';var _0x427fb9=[];var _0x5923fb='';var _0xb0f66a='';var _0x440710={};var _0x11da0d='';return db['ServicenowAccount'][_0xec48('0x5a')]({'where':{'id':_0x59ed2c[_0xec48('0x55')]['id']},'attributes':['id','username',_0xec48('0xa2'),'email',_0xec48('0xa3'),_0xec48('0xa4')]})[_0xec48('0x37')](handleEntityNotFound(_0x1b229f,null))[_0xec48('0x37')](function(_0x488d05){if(_0x488d05){_0x11da0d=_0x488d05[_0xec48('0xa3')];var _0x4764f9=_0x11da0d[_0xec48('0xa5')](-0x1);if(_0x4764f9==='/'){_0x11da0d=_0x11da0d[_0xec48('0xa6')](0x0,_0x11da0d[_0xec48('0xa7')](_0x4764f9));}_0xb0f66a=util[_0xec48('0xa8')](_0xec48('0xa9'),_0x11da0d);_0x5923fb=util[_0xec48('0xa8')](_0xec48('0xaa'),_0x11da0d);_0x440710={'user':_0x488d05[_0xec48('0xab')],'pass':_0x488d05[_0xec48('0xa2')]};var _0x3523fe={'method':_0xec48('0xac'),'uri':_0xb0f66a+_0xec48('0xad'),'auth':_0x440710,'json':!![]};return rp(_0x3523fe);}})[_0xec48('0x37')](function(_0x2a082f){if(_0x2a082f[_0xec48('0x2b')][_0xec48('0x48')]>0x0){_0x42f2ac=_0x2a082f[_0xec48('0x2b')];}console[_0xec48('0xae')]('incident\x20table\x20objects',_0x42f2ac);_0x427fb9=[];_0x11db9e=Object['assign']([],_0x42f2ac);_[_0xec48('0xaf')](_0x11db9e,function(_0x1d63b8){return!_0x4079a2[_0xec48('0xb0')](_0x1d63b8[_0xec48('0x3b')]);});_0x11db9e[_0xec48('0xb1')](function(_0x5a3de1){var _0x2bce51=createFieldObject(_0x5923fb,_0x440710,_0x5a3de1['internalType'],_0x5a3de1['name'],_0x5a3de1[_0xec48('0xb2')],![]);_0x427fb9['push'](_0x2bce51);});return Promise[_0xec48('0xb3')](_0x427fb9);})[_0xec48('0x37')](function(_0x13dba8){_0x2369ff=_0x13dba8;_0xe61927=Object[_0xec48('0xb4')]([],_0x42f2ac);console[_0xec48('0xae')](_0xec48('0xb5'),_0x42f2ac);_[_0xec48('0xaf')](_0xe61927,function(_0x58b0c5){return _0x311048[_0xec48('0xb0')](_0x58b0c5[_0xec48('0x3b')]);});console[_0xec48('0xae')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xe61927);_0x427fb9=[];_0xe61927['forEach'](function(_0x201585){var _0x3b2e97=createFieldObject(_0x5923fb,_0x440710,_0x201585[_0xec48('0xb6')],_0x201585['name'],_0x201585['label'],!![]);_0x427fb9[_0xec48('0xb7')](_0x3b2e97);});return Promise['all'](_0x427fb9);})['then'](function(_0x2378c9){_0x5406c2=_0x2378c9;var _0x5e25e3=_0x2369ff['concat'](_0x5406c2);return{'count':_0x5e25e3[_0xec48('0x48')],'rows':_0x5e25e3};})[_0xec48('0x37')](respondWithResult(_0x1b229f,null))[_0xec48('0x2c')](function(_0x451a5b){console['log'](_0xec48('0xb8')+_0x451a5b);var _0x34b0a9=_0x59ed2c['query'][_0xec48('0x1f')]?0x1f4:_0x451a5b[_0xec48('0xb9')]||0x1f4;logger[_0xec48('0x28')](_0x451a5b[_0xec48('0x3a')]);delete _0x451a5b[_0xec48('0x3b')];if(_0x34b0a9===0x191){_0x34b0a9=0x190;}_0x1b229f['status'](_0x34b0a9)[_0xec48('0xba')](_0x59ed2c[_0xec48('0x44')][_0xec48('0x1f')]?{'message':_0xec48('0xbb'),'statusCode':_0x451a5b['statusCode']}:_0x451a5b);});};function createFieldObject(_0x4f827f,_0x373f23,_0x10d054,_0x336ea0,_0x7d09a5,_0x513c56){return new Promise(function(_0x5ae098,_0x5292d7){var _0x40a4d1={'id':_0x336ea0,'name':_0x7d09a5,'custom':_0x513c56};if(_0x10d054===_0xec48('0xbc')){_0x40a4d1['options']=[{'name':_0xec48('0xbd'),'value':_0xec48('0xbe')},{'name':_0xec48('0xbf'),'value':_0xec48('0xc0')}];_0x5ae098(_0x40a4d1);}else{var _0x20e646={'method':_0xec48('0xac'),'uri':_0x4f827f+_0xec48('0xc1')+_0x336ea0,'auth':_0x373f23,'json':!![]};return rp(_0x20e646)[_0xec48('0x37')](function(_0xf09195){var _0x4e65e7=[];if(_0xf09195[_0xec48('0x2b')][_0xec48('0x48')]>0x0){_0xf09195[_0xec48('0x2b')][_0xec48('0xb1')](function(_0x4a91f1){if(_0x4a91f1['inactive']===_0xec48('0xc0')){var _0x160472={'name':_0x4a91f1['label'],'value':_0x4a91f1[_0xec48('0xc2')]};_0x4e65e7[_0xec48('0xb7')](_0x160472);}});}_0x40a4d1[_0xec48('0x50')]=_0x4e65e7;if(_0x40a4d1[_0xec48('0x50')]['length']>0x0){_0x5ae098(_0x40a4d1);}else{if(_0x513c56==![]){_0x5ae098();}else{_0x5ae098(_0x40a4d1);}}});}});} \ No newline at end of file +var _0xdec1=['resolved_by','sys_updated_by','opened_by','sys_domain','state','knowledge','cmdb_ci','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','caller_id','approval_set','work_notes','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','urgency','reassignment_count','activity_due','assigned_to','approval','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','password','GET','log','assign','remove','forEach','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','Sequelize','ValidationError','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','status','end','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','params','fields','find','create','body','findOne','ServicenowConfiguration','order','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','subcategory','close_code','notify','incident_state','severity','category','made_sla','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history'];(function(_0x226eb8,_0xba260f){var _0x5ca318=function(_0x25b597){while(--_0x25b597){_0x226eb8['push'](_0x226eb8['shift']());}};_0x5ca318(++_0xba260f);}(_0xdec1,0x105));var _0x1dec=function(_0x343fe2,_0x4ce0da){_0x343fe2=_0x343fe2-0x0;var _0x304ee3=_0xdec1[_0x343fe2];return _0x304ee3;};'use strict';var pdf=require(_0x1dec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1dec('0x1'));var zipdir=require(_0x1dec('0x2'));var jsonpatch=require(_0x1dec('0x3'));var rp=require('request-promise');var moment=require(_0x1dec('0x4'));var BPromise=require(_0x1dec('0x5'));var Mustache=require(_0x1dec('0x6'));var util=require('util');var path=require(_0x1dec('0x7'));var sox=require(_0x1dec('0x8'));var csv=require('to-csv');var ejs=require(_0x1dec('0x9'));var fs=require('fs');var _=require(_0x1dec('0xa'));var squel=require('squel');var crypto=require(_0x1dec('0xb'));var jsforce=require(_0x1dec('0xc'));var deskjs=require(_0x1dec('0xd'));var toCsv=require(_0x1dec('0xe'));var querystring=require(_0x1dec('0xf'));var Papa=require('papaparse');var Redis=require(_0x1dec('0x10'));var authService=require(_0x1dec('0x11'));var qs=require(_0x1dec('0x12'));var as=require(_0x1dec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dec('0x14'))(_0x1dec('0x15'));var utils=require('../../config/utils');var config=require(_0x1dec('0x16'));var db=require(_0x1dec('0x17'))['db'];var integrations=require(_0x1dec('0x18'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x14dcf9,_0x1c6fc8,_0x4baa54){if(_0x4baa54){var _0x448909=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x448909['test'](_0x1c6fc8)){return _0x14dcf9;}else{throw new db[(_0x1dec('0x19'))][(_0x1dec('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 _0x14dcf9;}}function respondWithRpcPromise(_0x50c06b,_0x166739,_0x572249,_0x450332){return new BPromise(function(_0x13d3af,_0x221876){var _0x7c47aa=_0x450332||client;return _0x7c47aa['request'](_0x50c06b,_0x572249)[_0x1dec('0x1b')](function(_0x26005f){logger[_0x1dec('0x1c')](_0x1dec('0x1d'),_0x166739,_0x1dec('0x1e'));logger['debug'](_0x1dec('0x1f'),_0x166739,'request\x20sent',JSON[_0x1dec('0x20')](_0x26005f));if(_0x26005f[_0x1dec('0x21')]){if(_0x26005f['error'][_0x1dec('0x22')]===0x1f4){logger[_0x1dec('0x21')](_0x1dec('0x1d'),_0x166739,_0x26005f['error'][_0x1dec('0x23')]);return _0x221876(_0x26005f['error'][_0x1dec('0x23')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x166739,_0x26005f[_0x1dec('0x21')][_0x1dec('0x23')]);return _0x13d3af(_0x26005f['error'][_0x1dec('0x23')]);}else{logger[_0x1dec('0x1c')]('ServicenowAccount,\x20%s,\x20%s',_0x166739,_0x1dec('0x1e'));_0x13d3af(_0x26005f[_0x1dec('0x24')][_0x1dec('0x23')]);}})['catch'](function(_0x1a3bfb){logger[_0x1dec('0x21')](_0x1dec('0x1d'),_0x166739,_0x1a3bfb);_0x221876(_0x1a3bfb);});});}function respondWithStatusCode(_0x4479b8,_0x4235c2){_0x4235c2=_0x4235c2||0xcc;return function(_0x178fa4){if(_0x178fa4){return _0x4479b8[_0x1dec('0x25')](_0x4235c2);}return _0x4479b8['status'](_0x4235c2)['end']();};}function respondWithResult(_0x5f5b50,_0x50201e){_0x50201e=_0x50201e||0xc8;return function(_0x4e49c4){if(_0x4e49c4){return _0x5f5b50['status'](_0x50201e)[_0x1dec('0x26')](_0x4e49c4);}};}function respondWithFilteredResult(_0x174c33,_0x105f81){return function(_0x20f6fd){if(_0x20f6fd){var _0x56f7ff=_0x20f6fd['count'],_0x2e8f95=_0x105f81[_0x1dec('0x27')],_0x3aa9f6=_0x105f81[_0x1dec('0x27')]+_0x105f81[_0x1dec('0x28')],_0x4f9420;if(_0x3aa9f6>=_0x56f7ff){_0x3aa9f6=_0x56f7ff;_0x4f9420=0xc8;}else{_0x4f9420=0xce;}_0x174c33['status'](_0x4f9420);return _0x174c33[_0x1dec('0x29')](_0x1dec('0x2a'),_0x2e8f95+'-'+_0x3aa9f6+'/'+_0x56f7ff)[_0x1dec('0x26')](_0x20f6fd);}return null;};}function patchUpdates(_0x57090a){return function(_0x34924a){try{jsonpatch[_0x1dec('0x2b')](_0x34924a,_0x57090a,!![]);}catch(_0x2a4e2f){return BPromise[_0x1dec('0x2c')](_0x2a4e2f);}return _0x34924a[_0x1dec('0x2d')]();};}function saveUpdates(_0x11eb54,_0x46d8b1){return function(_0x178d0c){if(_0x178d0c){return _0x178d0c[_0x1dec('0x2e')](_0x11eb54)[_0x1dec('0x1b')](function(_0x4bf611){return _0x4bf611;});}return null;};}function removeEntity(_0x137841,_0x32b087){return function(_0x5d6b2d){if(_0x5d6b2d){return _0x5d6b2d[_0x1dec('0x2f')]()[_0x1dec('0x1b')](function(){_0x137841[_0x1dec('0x30')](0xcc)[_0x1dec('0x31')]();});}};}function handleEntityNotFound(_0x1567d9,_0x1319f1){return function(_0x521064){if(!_0x521064){_0x1567d9[_0x1dec('0x25')](0x194);}return _0x521064;};}function handleError(_0x5d04c4,_0x3dcd7f){_0x3dcd7f=_0x3dcd7f||0x1f4;return function(_0x434b62){logger[_0x1dec('0x21')](_0x434b62['stack']);if(_0x434b62[_0x1dec('0x32')]){delete _0x434b62[_0x1dec('0x32')];}_0x5d04c4[_0x1dec('0x30')](_0x3dcd7f)[_0x1dec('0x33')](_0x434b62);};}exports[_0x1dec('0x34')]=function(_0x44b77d,_0x389a57){var _0xa1c74d={},_0x43d866={},_0x2a4e7c={'count':0x0,'rows':[]};var _0x445a3f=_[_0x1dec('0x35')](db[_0x1dec('0x36')][_0x1dec('0x37')],function(_0x1c9592){return{'name':_0x1c9592[_0x1dec('0x38')],'type':_0x1c9592[_0x1dec('0x39')]['key']};});_0x43d866[_0x1dec('0x3a')]=_[_0x1dec('0x35')](_0x445a3f,'name');_0x43d866[_0x1dec('0x3b')]=_[_0x1dec('0x3c')](_0x44b77d[_0x1dec('0x3b')]);_0x43d866[_0x1dec('0x3d')]=_[_0x1dec('0x3e')](_0x43d866['model'],_0x43d866[_0x1dec('0x3b')]);_0xa1c74d['attributes']=_[_0x1dec('0x3e')](_0x43d866[_0x1dec('0x3a')],qs['fields'](_0x44b77d[_0x1dec('0x3b')]['fields']));_0xa1c74d[_0x1dec('0x3f')]=_0xa1c74d[_0x1dec('0x3f')][_0x1dec('0x40')]?_0xa1c74d[_0x1dec('0x3f')]:_0x43d866['model'];if(!_0x44b77d[_0x1dec('0x3b')][_0x1dec('0x41')]('nolimit')){_0xa1c74d[_0x1dec('0x28')]=qs[_0x1dec('0x28')](_0x44b77d['query'][_0x1dec('0x28')]);_0xa1c74d[_0x1dec('0x27')]=qs['offset'](_0x44b77d[_0x1dec('0x3b')][_0x1dec('0x27')]);}_0xa1c74d['order']=qs[_0x1dec('0x42')](_0x44b77d[_0x1dec('0x3b')][_0x1dec('0x42')]);_0xa1c74d[_0x1dec('0x43')]=qs['filters'](_[_0x1dec('0x44')](_0x44b77d[_0x1dec('0x3b')],_0x43d866[_0x1dec('0x3d')]),_0x445a3f);if(_0x44b77d['query'][_0x1dec('0x45')]){_0xa1c74d['where']=_[_0x1dec('0x46')](_0xa1c74d[_0x1dec('0x43')],{'$or':_[_0x1dec('0x35')](_0x445a3f,function(_0x3cddd4){if(_0x3cddd4[_0x1dec('0x39')]!==_0x1dec('0x47')){var _0x3d108d={};_0x3d108d[_0x3cddd4['name']]={'$like':'%'+_0x44b77d[_0x1dec('0x3b')]['filter']+'%'};return _0x3d108d;}})});}_0xa1c74d=_[_0x1dec('0x46')]({},_0xa1c74d,_0x44b77d[_0x1dec('0x48')]);var _0x162d68={'where':_0xa1c74d[_0x1dec('0x43')]};return db[_0x1dec('0x36')]['count'](_0x162d68)[_0x1dec('0x1b')](function(_0x3b97f3){_0x2a4e7c[_0x1dec('0x49')]=_0x3b97f3;if(_0x44b77d['query'][_0x1dec('0x4a')]){_0xa1c74d[_0x1dec('0x4b')]=[{'all':!![]}];}return db[_0x1dec('0x36')]['findAll'](_0xa1c74d);})[_0x1dec('0x1b')](function(_0x5cdea9){_0x2a4e7c['rows']=_0x5cdea9;return _0x2a4e7c;})['then'](respondWithFilteredResult(_0x389a57,_0xa1c74d))[_0x1dec('0x4c')](handleError(_0x389a57,null));};exports['show']=function(_0x3607c2,_0x4dbde7){var _0x4bda15={'raw':![],'where':{'id':_0x3607c2[_0x1dec('0x4d')]['id']}},_0x4f739d={};_0x4f739d[_0x1dec('0x3a')]=_[_0x1dec('0x3c')](db['ServicenowAccount']['rawAttributes']);_0x4f739d['query']=_['keys'](_0x3607c2[_0x1dec('0x3b')]);_0x4f739d['filters']=_[_0x1dec('0x3e')](_0x4f739d['model'],_0x4f739d[_0x1dec('0x3b')]);_0x4bda15['attributes']=_[_0x1dec('0x3e')](_0x4f739d['model'],qs[_0x1dec('0x4e')](_0x3607c2['query'][_0x1dec('0x4e')]));_0x4bda15[_0x1dec('0x3f')]=_0x4bda15[_0x1dec('0x3f')]['length']?_0x4bda15['attributes']:_0x4f739d[_0x1dec('0x3a')];if(_0x3607c2['query'][_0x1dec('0x4a')]){_0x4bda15['include']=[{'all':!![]}];}_0x4bda15=_[_0x1dec('0x46')]({},_0x4bda15,_0x3607c2[_0x1dec('0x48')]);return db['ServicenowAccount'][_0x1dec('0x4f')](_0x4bda15)['then'](handleEntityNotFound(_0x4dbde7,null))[_0x1dec('0x1b')](respondWithResult(_0x4dbde7,null))[_0x1dec('0x4c')](handleError(_0x4dbde7,null));};exports[_0x1dec('0x50')]=function(_0x1399d6,_0x1b9a5a){return db['ServicenowAccount'][_0x1dec('0x50')](_0x1399d6[_0x1dec('0x51')],{})['then'](respondWithResult(_0x1b9a5a,0xc9))['catch'](handleError(_0x1b9a5a,null));};exports[_0x1dec('0x2e')]=function(_0xb70932,_0x20ffbc){if(_0xb70932['body']['id']){delete _0xb70932['body']['id'];}return db[_0x1dec('0x36')][_0x1dec('0x4f')]({'where':{'id':_0xb70932[_0x1dec('0x4d')]['id']}})[_0x1dec('0x1b')](handleEntityNotFound(_0x20ffbc,null))[_0x1dec('0x1b')](saveUpdates(_0xb70932[_0x1dec('0x51')],null))[_0x1dec('0x1b')](respondWithResult(_0x20ffbc,null))[_0x1dec('0x4c')](handleError(_0x20ffbc,null));};exports[_0x1dec('0x2f')]=function(_0x2ddbad,_0x2f2b6a){return db['ServicenowAccount'][_0x1dec('0x4f')]({'where':{'id':_0x2ddbad[_0x1dec('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f2b6a,null))[_0x1dec('0x1b')](removeEntity(_0x2f2b6a,null))[_0x1dec('0x4c')](handleError(_0x2f2b6a,null));};exports['getConfigurations']=function(_0x1b422b,_0x3970e0,_0x3f925a){var _0x2c5092={};var _0x54ea66={};var _0x4d3b60;var _0x42f2f3;return db[_0x1dec('0x36')][_0x1dec('0x52')]({'where':{'id':_0x1b422b['params']['id']}})[_0x1dec('0x1b')](handleEntityNotFound(_0x3970e0,null))[_0x1dec('0x1b')](function(_0x576f90){if(_0x576f90){_0x4d3b60=_0x576f90;_0x54ea66['model']=_[_0x1dec('0x3c')](db[_0x1dec('0x53')][_0x1dec('0x37')]);_0x54ea66[_0x1dec('0x3b')]=_[_0x1dec('0x3c')](_0x1b422b[_0x1dec('0x3b')]);_0x54ea66[_0x1dec('0x3d')]=_[_0x1dec('0x3e')](_0x54ea66['model'],_0x54ea66['query']);_0x2c5092[_0x1dec('0x3f')]=_[_0x1dec('0x3e')](_0x54ea66['model'],qs[_0x1dec('0x4e')](_0x1b422b[_0x1dec('0x3b')]['fields']));_0x2c5092[_0x1dec('0x3f')]=_0x2c5092[_0x1dec('0x3f')]['length']?_0x2c5092[_0x1dec('0x3f')]:_0x54ea66[_0x1dec('0x3a')];_0x2c5092[_0x1dec('0x54')]=qs[_0x1dec('0x42')](_0x1b422b['query'][_0x1dec('0x42')]);_0x2c5092['where']=qs[_0x1dec('0x3d')](_[_0x1dec('0x44')](_0x1b422b['query'],_0x54ea66[_0x1dec('0x3d')]));if(_0x1b422b[_0x1dec('0x3b')][_0x1dec('0x45')]){_0x2c5092['where']=_[_0x1dec('0x46')](_0x2c5092['where'],{'$or':_[_0x1dec('0x35')](_0x2c5092['attributes'],function(_0x5eadb0){var _0x1ba217={};_0x1ba217[_0x5eadb0]={'$like':'%'+_0x1b422b[_0x1dec('0x3b')][_0x1dec('0x45')]+'%'};return _0x1ba217;})});}_0x2c5092=_['merge']({},_0x2c5092,_0x1b422b['options']);return _0x4d3b60['getConfigurations'](_0x2c5092);}})['then'](function(_0x56279b){if(_0x56279b){_0x42f2f3=_0x56279b['length'];if(!_0x1b422b['query']['hasOwnProperty'](_0x1dec('0x55'))){_0x2c5092[_0x1dec('0x28')]=qs[_0x1dec('0x28')](_0x1b422b[_0x1dec('0x3b')][_0x1dec('0x28')]);_0x2c5092[_0x1dec('0x27')]=qs['offset'](_0x1b422b[_0x1dec('0x3b')][_0x1dec('0x27')]);}return _0x4d3b60['getConfigurations'](_0x2c5092);}})[_0x1dec('0x1b')](function(_0x450b04){if(_0x450b04){return _0x450b04?{'count':_0x42f2f3,'rows':_0x450b04}:null;}})[_0x1dec('0x1b')](respondWithResult(_0x3970e0,null))['catch'](handleError(_0x3970e0,null));};exports[_0x1dec('0x56')]=function(_0x5d503b,_0x367098,_0x3ad17d){if(_0x5d503b['body']['id']){delete _0x5d503b['body']['id'];}return db['ServicenowAccount'][_0x1dec('0x52')]({'where':{'id':_0x5d503b[_0x1dec('0x4d')]['id']}})[_0x1dec('0x1b')](handleEntityNotFound(_0x367098,null))[_0x1dec('0x1b')](function(_0x2bad13){if(_0x2bad13){_0x5d503b['body'][_0x1dec('0x57')]=_0x2bad13['id'];_0x5d503b[_0x1dec('0x51')]['Subjects']=integrations[_0x1dec('0x58')](_0x5d503b[_0x1dec('0x51')][_0x1dec('0x59')],_0x5d503b[_0x1dec('0x51')]['type']);_0x5d503b[_0x1dec('0x51')][_0x1dec('0x5a')]=integrations['getDescriptions'](_0x5d503b[_0x1dec('0x51')][_0x1dec('0x59')],_0x5d503b[_0x1dec('0x51')]['type']);return db['ServicenowConfiguration'][_0x1dec('0x50')](_0x5d503b[_0x1dec('0x51')],{'include':[{'model':db[_0x1dec('0x5b')],'as':_0x1dec('0x5c')},{'model':db[_0x1dec('0x5b')],'as':_0x1dec('0x5a')}]});}return null;})[_0x1dec('0x1b')](respondWithResult(_0x367098,null))[_0x1dec('0x4c')](handleError(_0x367098,null));};exports[_0x1dec('0x5d')]=function(_0x2c7338,_0x463728,_0x3d3ab7){var _0x58dfc2=['made_sla','hold_reason','knowledge',_0x1dec('0x5e'),_0x1dec('0x5f'),_0x1dec('0x60'),_0x1dec('0x61'),_0x1dec('0x62'),_0x1dec('0x63')];var _0x342515=['parent',_0x1dec('0x64'),'caused_by',_0x1dec('0x65'),_0x1dec('0x66'),_0x1dec('0x67'),_0x1dec('0x68'),_0x1dec('0x69'),_0x1dec('0x6a'),'number',_0x1dec('0x6b'),_0x1dec('0x6c'),_0x1dec('0x6d'),'user_input','sys_created_on',_0x1dec('0x6e'),_0x1dec('0x6f'),'sys_created_by',_0x1dec('0x70'),_0x1dec('0x54'),'calendar_stc','closed_at',_0x1dec('0x71'),_0x1dec('0x72'),_0x1dec('0x73'),'active','work_notes_list',_0x1dec('0x74'),_0x1dec('0x75'),_0x1dec('0x76'),_0x1dec('0x77'),_0x1dec('0x78'),_0x1dec('0x79'),_0x1dec('0x7a'),_0x1dec('0x7b'),_0x1dec('0x7c'),_0x1dec('0x7d'),'reopened_time','resolved_at',_0x1dec('0x7e'),_0x1dec('0x7f'),_0x1dec('0x5e'),_0x1dec('0x80'),'short_description',_0x1dec('0x5f'),'correlation_display','delivery_task',_0x1dec('0x81'),_0x1dec('0x82'),_0x1dec('0x83'),_0x1dec('0x84'),'description',_0x1dec('0x85'),_0x1dec('0x60'),_0x1dec('0x86'),_0x1dec('0x87'),_0x1dec('0x88'),_0x1dec('0x89'),'parent_incident',_0x1dec('0x8a'),_0x1dec('0x8b'),'reopened_by','incident_state',_0x1dec('0x8c'),'problem_id','company',_0x1dec('0x8d'),_0x1dec('0x8e'),_0x1dec('0x8f'),_0x1dec('0x62'),'comments','sla_due',_0x1dec('0x90'),'comments_and_work_notes',_0x1dec('0x91'),_0x1dec('0x92'),_0x1dec('0x93'),_0x1dec('0x94'),'escalation',_0x1dec('0x95'),_0x1dec('0x96'),_0x1dec('0x97'),_0x1dec('0x63')];var _0x155ac2='';var _0x3a11b5='';var _0x116e00=[];var _0x456168='';var _0x4f0422='';var _0x27f182=[];var _0x1c8879='';var _0x16168b='';var _0x1500b9={};var _0x201184='';return db[_0x1dec('0x36')][_0x1dec('0x52')]({'where':{'id':_0x2c7338[_0x1dec('0x4d')]['id']},'attributes':['id',_0x1dec('0x98'),'password',_0x1dec('0x99'),_0x1dec('0x9a'),_0x1dec('0x9b')]})[_0x1dec('0x1b')](handleEntityNotFound(_0x463728,null))[_0x1dec('0x1b')](function(_0x47e4cf){if(_0x47e4cf){_0x201184=_0x47e4cf[_0x1dec('0x9a')];var _0x3c5e86=_0x201184['slice'](-0x1);if(_0x3c5e86==='/'){_0x201184=_0x201184[_0x1dec('0x9c')](0x0,_0x201184['lastIndexOf'](_0x3c5e86));}_0x16168b=util[_0x1dec('0x9d')](_0x1dec('0x9e'),_0x201184);_0x1c8879=util[_0x1dec('0x9d')]('%s/api/now/table/',_0x201184);_0x1500b9={'user':_0x47e4cf['username'],'pass':_0x47e4cf[_0x1dec('0x9f')]};var _0x1a90ba={'method':_0x1dec('0xa0'),'uri':_0x16168b+'incident?sysparm_display_value=all','auth':_0x1500b9,'json':!![]};return rp(_0x1a90ba);}})['then'](function(_0x2206ff){if(_0x2206ff[_0x1dec('0x24')][_0x1dec('0x40')]>0x0){_0x155ac2=_0x2206ff['result'];}console[_0x1dec('0xa1')]('incident\x20table\x20objects',_0x155ac2);_0x27f182=[];_0x3a11b5=Object[_0x1dec('0xa2')]([],_0x155ac2);_[_0x1dec('0xa3')](_0x3a11b5,function(_0x2ec512){return!_0x58dfc2['includes'](_0x2ec512['name']);});_0x3a11b5[_0x1dec('0xa4')](function(_0x133c68){var _0x335d66=createFieldObject(_0x1c8879,_0x1500b9,_0x133c68['internalType'],_0x133c68[_0x1dec('0x32')],_0x133c68[_0x1dec('0xa5')],![]);_0x27f182['push'](_0x335d66);});return Promise[_0x1dec('0xa6')](_0x27f182);})['then'](function(_0x3def1b){_0x116e00=_0x3def1b;_0x456168=Object['assign']([],_0x155ac2);console[_0x1dec('0xa1')](_0x1dec('0xa7'),_0x155ac2);_[_0x1dec('0xa3')](_0x456168,function(_0x295ba6){return _0x342515['includes'](_0x295ba6['name']);});console[_0x1dec('0xa1')](_0x1dec('0xa8'),_0x456168);_0x27f182=[];_0x456168[_0x1dec('0xa4')](function(_0x3b8d77){var _0x323104=createFieldObject(_0x1c8879,_0x1500b9,_0x3b8d77[_0x1dec('0xa9')],_0x3b8d77[_0x1dec('0x32')],_0x3b8d77[_0x1dec('0xa5')],!![]);_0x27f182[_0x1dec('0xaa')](_0x323104);});return Promise[_0x1dec('0xa6')](_0x27f182);})[_0x1dec('0x1b')](function(_0x50772b){_0x4f0422=_0x50772b;var _0x30217d=_0x116e00[_0x1dec('0xab')](_0x4f0422);return{'count':_0x30217d[_0x1dec('0x40')],'rows':_0x30217d};})[_0x1dec('0x1b')](respondWithResult(_0x463728,null))['catch'](function(_0x365dc8){console[_0x1dec('0xa1')](_0x1dec('0xac')+_0x365dc8);var _0x548452=_0x2c7338['query'][_0x1dec('0xad')]?0x1f4:_0x365dc8['statusCode']||0x1f4;logger[_0x1dec('0x21')](_0x365dc8[_0x1dec('0xae')]);delete _0x365dc8[_0x1dec('0x32')];if(_0x548452===0x191){_0x548452=0x190;}_0x463728[_0x1dec('0x30')](_0x548452)[_0x1dec('0x33')](_0x2c7338[_0x1dec('0x3b')][_0x1dec('0xad')]?{'message':_0x1dec('0xaf'),'statusCode':_0x365dc8[_0x1dec('0xb0')]}:_0x365dc8);});};function createFieldObject(_0x19dbd4,_0x222577,_0x485ab4,_0x143dd8,_0x4b9d69,_0x22555a){return new Promise(function(_0x11b68a,_0x20b662){var _0x5e0f60={'id':_0x143dd8,'name':_0x4b9d69,'custom':_0x22555a};if(_0x485ab4===_0x1dec('0xb1')){_0x5e0f60['options']=[{'name':_0x1dec('0xb2'),'value':'true'},{'name':_0x1dec('0xb3'),'value':_0x1dec('0xb4')}];_0x11b68a(_0x5e0f60);}else{var _0x184136={'method':_0x1dec('0xa0'),'uri':_0x19dbd4+_0x1dec('0xb5')+_0x143dd8,'auth':_0x222577,'json':!![]};return rp(_0x184136)[_0x1dec('0x1b')](function(_0x1a30c2){var _0x5e8623=[];if(_0x1a30c2['result'][_0x1dec('0x40')]>0x0){_0x1a30c2[_0x1dec('0x24')][_0x1dec('0xa4')](function(_0x4ef90d){if(_0x4ef90d[_0x1dec('0xb6')]==='false'){var _0x457822={'name':_0x4ef90d[_0x1dec('0xa5')],'value':_0x4ef90d[_0x1dec('0xb7')]};_0x5e8623[_0x1dec('0xaa')](_0x457822);}});}_0x5e0f60[_0x1dec('0x48')]=_0x5e8623;if(_0x5e0f60[_0x1dec('0x48')][_0x1dec('0x40')]>0x0){_0x11b68a(_0x5e0f60);}else{if(_0x22555a==![]){_0x11b68a();}else{_0x11b68a(_0x5e0f60);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7281a41..31f2da2 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 _0xd5fb=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3e514e,_0x5a4696){var _0x53f565=function(_0x8e89ef){while(--_0x8e89ef){_0x3e514e['push'](_0x3e514e['shift']());}};_0x53f565(++_0x5a4696);}(_0xd5fb,0x13d));var _0xbd5f=function(_0x5121f7,_0x189f9c){_0x5121f7=_0x5121f7-0x0;var _0x26fdf8=_0xd5fb[_0x5121f7];return _0x26fdf8;};'use strict';var _=require(_0xbd5f('0x0'));var util=require('util');var logger=require(_0xbd5f('0x1'))(_0xbd5f('0x2'));var moment=require(_0xbd5f('0x3'));var BPromise=require(_0xbd5f('0x4'));var rp=require(_0xbd5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd5f('0x6'));var config=require(_0xbd5f('0x7'));var attributes=require(_0xbd5f('0x8'));var integrations=require(_0xbd5f('0x9'));module[_0xbd5f('0xa')]=function(_0x212451,_0x11185f){return _0x212451['define']('ServicenowAccount',attributes,{'tableName':_0xbd5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb657=['int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount'];(function(_0x262428,_0x4698f0){var _0x30a3d7=function(_0x1fd473){while(--_0x1fd473){_0x262428['push'](_0x262428['shift']());}};_0x30a3d7(++_0x4698f0);}(_0xb657,0xf3));var _0x7b65=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xb657[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x7b65('0x0'));var util=require(_0x7b65('0x1'));var logger=require(_0x7b65('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7b65('0x3'));var rp=require(_0x7b65('0x4'));var fs=require('fs');var path=require(_0x7b65('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b65('0x6'));var integrations=require(_0x7b65('0x7'));module[_0x7b65('0x8')]=function(_0x262880,_0x298220){return _0x262880['define'](_0x7b65('0x9'),attributes,{'tableName':_0x7b65('0xa'),'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 0c41f78..8e55200 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 _0x8449=['GetServicenowAccount','ShowServicenowAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','ServicenowAccount','options','raw','attributes','limit','include','model','map'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x8449,0x1d1));var _0x9844=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x8449[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x9844('0x0'));var util=require(_0x9844('0x1'));var moment=require(_0x9844('0x2'));var BPromise=require('bluebird');var rs=require(_0x9844('0x3'));var fs=require('fs');var Redis=require(_0x9844('0x4'));var db=require(_0x9844('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9844('0x6'))(_0x9844('0x7'));var config=require(_0x9844('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9844('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdb5108,_0x151fe3,_0x5c71f8){return new BPromise(function(_0x5b7ba8,_0xc56494){return client[_0x9844('0xa')](_0xdb5108,_0x5c71f8)[_0x9844('0xb')](function(_0x14ed8e){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x151fe3,_0x9844('0xc'));logger[_0x9844('0xd')](_0x9844('0xe'),_0x151fe3,_0x9844('0xc'),JSON[_0x9844('0xf')](_0x14ed8e));if(_0x14ed8e[_0x9844('0x10')]){if(_0x14ed8e['error']['code']===0x1f4){logger[_0x9844('0x10')](_0x9844('0x11'),_0x151fe3,_0x14ed8e[_0x9844('0x10')][_0x9844('0x12')]);return _0xc56494(_0x14ed8e[_0x9844('0x10')][_0x9844('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x151fe3,_0x14ed8e[_0x9844('0x10')][_0x9844('0x12')]);return _0x5b7ba8(_0x14ed8e['error']['message']);}else{logger[_0x9844('0x13')](_0x9844('0x11'),_0x151fe3,_0x9844('0xc'));_0x5b7ba8(_0x14ed8e[_0x9844('0x14')][_0x9844('0x12')]);}})[_0x9844('0x15')](function(_0x482f33){logger['error'](_0x9844('0x11'),_0x151fe3,_0x482f33);_0xc56494(_0x482f33);});});}exports['GetServicenowAccount']=function(_0xff0e41){var _0x4a52c5=this;return new Promise(function(_0x4b023e,_0x278bb0){return db[_0x9844('0x16')]['findAll']({'raw':_0xff0e41[_0x9844('0x17')]?_0xff0e41['options'][_0x9844('0x18')]===undefined?!![]:![]:!![],'where':_0xff0e41['options']?_0xff0e41[_0x9844('0x17')]['where']||null:null,'attributes':_0xff0e41['options']?_0xff0e41[_0x9844('0x17')][_0x9844('0x19')]||null:null,'limit':_0xff0e41[_0x9844('0x17')]?_0xff0e41[_0x9844('0x17')][_0x9844('0x1a')]||null:null,'include':_0xff0e41[_0x9844('0x17')]?_0xff0e41[_0x9844('0x17')][_0x9844('0x1b')]?_['map'](_0xff0e41[_0x9844('0x17')][_0x9844('0x1b')],function(_0x4898a3){return{'model':db[_0x4898a3[_0x9844('0x1c')]],'as':_0x4898a3['as'],'attributes':_0x4898a3[_0x9844('0x19')],'include':_0x4898a3['include']?_[_0x9844('0x1d')](_0x4898a3[_0x9844('0x1b')],function(_0x266604){return{'model':db[_0x266604['model']],'as':_0x266604['as'],'attributes':_0x266604[_0x9844('0x19')],'include':_0x266604[_0x9844('0x1b')]?_[_0x9844('0x1d')](_0x266604[_0x9844('0x1b')],function(_0x1536ed){return{'model':db[_0x1536ed['model']],'as':_0x1536ed['as'],'attributes':_0x1536ed[_0x9844('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9844('0xb')](function(_0x2df94b){logger[_0x9844('0x13')](_0x9844('0x1e'),_0xff0e41);logger[_0x9844('0xd')](_0x9844('0x1e'),_0xff0e41,JSON['stringify'](_0x2df94b));_0x4b023e(_0x2df94b);})[_0x9844('0x15')](function(_0x2c307b){logger['error'](_0x9844('0x1e'),_0x2c307b[_0x9844('0x12')],_0xff0e41);_0x278bb0(_0x4a52c5[_0x9844('0x10')](0x1f4,_0x2c307b[_0x9844('0x12')]));});});};exports[_0x9844('0x1f')]=function(_0x71f019){var _0x489a09=this;return new Promise(function(_0x174ad0,_0x3b4083){return db['ServicenowAccount'][_0x9844('0x20')]({'raw':_0x71f019[_0x9844('0x17')]?_0x71f019[_0x9844('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x71f019[_0x9844('0x17')]?_0x71f019['options']['where']||null:null,'attributes':_0x71f019['options']?_0x71f019[_0x9844('0x17')][_0x9844('0x19')]||null:null,'include':_0x71f019['options']?_0x71f019[_0x9844('0x17')][_0x9844('0x1b')]?_[_0x9844('0x1d')](_0x71f019['options'][_0x9844('0x1b')],function(_0x51acf3){return{'model':db[_0x51acf3[_0x9844('0x1c')]],'as':_0x51acf3['as'],'attributes':_0x51acf3['attributes'],'include':_0x51acf3['include']?_[_0x9844('0x1d')](_0x51acf3[_0x9844('0x1b')],function(_0x461576){return{'model':db[_0x461576[_0x9844('0x1c')]],'as':_0x461576['as'],'attributes':_0x461576[_0x9844('0x19')],'include':_0x461576[_0x9844('0x1b')]?_[_0x9844('0x1d')](_0x461576[_0x9844('0x1b')],function(_0x5f4350){return{'model':db[_0x5f4350[_0x9844('0x1c')]],'as':_0x5f4350['as'],'attributes':_0x5f4350[_0x9844('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9844('0xb')](function(_0x2556fc){logger[_0x9844('0x13')](_0x9844('0x1f'),_0x71f019);logger[_0x9844('0xd')](_0x9844('0x1f'),_0x71f019,JSON['stringify'](_0x2556fc));_0x174ad0(_0x2556fc);})[_0x9844('0x15')](function(_0xdcab59){logger[_0x9844('0x10')](_0x9844('0x1f'),_0xdcab59['message'],_0x71f019);_0x3b4083(_0x489a09[_0x9844('0x10')](0x1f4,_0xdcab59['message']));});});}; \ No newline at end of file +var _0xaf0b=['options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','ServicenowAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0xaf0b,0xc1));var _0xbaf0=function(_0x4ded1e,_0x5991da){_0x4ded1e=_0x4ded1e-0x0;var _0x427b7f=_0xaf0b[_0x4ded1e];return _0x427b7f;};'use strict';var _=require(_0xbaf0('0x0'));var util=require('util');var moment=require(_0xbaf0('0x1'));var BPromise=require(_0xbaf0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaf0('0x3'))['db'];var utils=require(_0xbaf0('0x4'));var logger=require(_0xbaf0('0x5'))(_0xbaf0('0x6'));var config=require(_0xbaf0('0x7'));var jayson=require(_0xbaf0('0x8'));var client=jayson[_0xbaf0('0x9')][_0xbaf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346fc4,_0x449eb1,_0x5cf14c){return new BPromise(function(_0x5f357b,_0x3ac32d){return client[_0xbaf0('0xb')](_0x346fc4,_0x5cf14c)[_0xbaf0('0xc')](function(_0xe96115){logger[_0xbaf0('0xd')](_0xbaf0('0xe'),_0x449eb1,_0xbaf0('0xf'));logger[_0xbaf0('0x10')](_0xbaf0('0x11'),_0x449eb1,_0xbaf0('0xf'),JSON['stringify'](_0xe96115));if(_0xe96115[_0xbaf0('0x12')]){if(_0xe96115[_0xbaf0('0x12')][_0xbaf0('0x13')]===0x1f4){logger['error'](_0xbaf0('0xe'),_0x449eb1,_0xe96115[_0xbaf0('0x12')][_0xbaf0('0x14')]);return _0x3ac32d(_0xe96115[_0xbaf0('0x12')]['message']);}logger[_0xbaf0('0x12')](_0xbaf0('0xe'),_0x449eb1,_0xe96115[_0xbaf0('0x12')]['message']);return _0x5f357b(_0xe96115[_0xbaf0('0x12')][_0xbaf0('0x14')]);}else{logger[_0xbaf0('0xd')](_0xbaf0('0xe'),_0x449eb1,_0xbaf0('0xf'));_0x5f357b(_0xe96115['result']['message']);}})[_0xbaf0('0x15')](function(_0xa4efa0){logger[_0xbaf0('0x12')](_0xbaf0('0xe'),_0x449eb1,_0xa4efa0);_0x3ac32d(_0xa4efa0);});});}exports['GetServicenowAccount']=function(_0x352a8f){var _0x2a3d28=this;return new Promise(function(_0x5d0120,_0x3f1cb3){return db['ServicenowAccount'][_0xbaf0('0x16')]({'raw':_0x352a8f['options']?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x18')]===undefined?!![]:![]:!![],'where':_0x352a8f['options']?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x19')]||null:null,'attributes':_0x352a8f[_0xbaf0('0x17')]?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x1a')]||null:null,'limit':_0x352a8f[_0xbaf0('0x17')]?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x1b')]||null:null,'include':_0x352a8f[_0xbaf0('0x17')]?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x352a8f[_0xbaf0('0x17')]['include'],function(_0x5cedc0){return{'model':db[_0x5cedc0['model']],'as':_0x5cedc0['as'],'attributes':_0x5cedc0[_0xbaf0('0x1a')],'include':_0x5cedc0['include']?_[_0xbaf0('0x1d')](_0x5cedc0[_0xbaf0('0x1c')],function(_0x1b48bc){return{'model':db[_0x1b48bc[_0xbaf0('0x1e')]],'as':_0x1b48bc['as'],'attributes':_0x1b48bc[_0xbaf0('0x1a')],'include':_0x1b48bc[_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x1b48bc[_0xbaf0('0x1c')],function(_0x67196a){return{'model':db[_0x67196a[_0xbaf0('0x1e')]],'as':_0x67196a['as'],'attributes':_0x67196a['attributes']};}):[]};}):[]};}):[]:[]})[_0xbaf0('0xc')](function(_0x17606a){logger[_0xbaf0('0xd')](_0xbaf0('0x1f'),_0x352a8f);logger[_0xbaf0('0x10')](_0xbaf0('0x1f'),_0x352a8f,JSON[_0xbaf0('0x20')](_0x17606a));_0x5d0120(_0x17606a);})[_0xbaf0('0x15')](function(_0x4fe845){logger[_0xbaf0('0x12')]('GetServicenowAccount',_0x4fe845['message'],_0x352a8f);_0x3f1cb3(_0x2a3d28[_0xbaf0('0x12')](0x1f4,_0x4fe845['message']));});});};exports[_0xbaf0('0x21')]=function(_0x47f582){var _0x2940e9=this;return new Promise(function(_0x247ae8,_0x3ee498){return db[_0xbaf0('0x22')][_0xbaf0('0x23')]({'raw':_0x47f582[_0xbaf0('0x17')]?_0x47f582[_0xbaf0('0x17')][_0xbaf0('0x18')]===undefined?!![]:![]:!![],'where':_0x47f582['options']?_0x47f582[_0xbaf0('0x17')][_0xbaf0('0x19')]||null:null,'attributes':_0x47f582['options']?_0x47f582[_0xbaf0('0x17')][_0xbaf0('0x1a')]||null:null,'include':_0x47f582[_0xbaf0('0x17')]?_0x47f582[_0xbaf0('0x17')]['include']?_[_0xbaf0('0x1d')](_0x47f582[_0xbaf0('0x17')]['include'],function(_0x465526){return{'model':db[_0x465526[_0xbaf0('0x1e')]],'as':_0x465526['as'],'attributes':_0x465526[_0xbaf0('0x1a')],'include':_0x465526[_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x465526[_0xbaf0('0x1c')],function(_0x57e274){return{'model':db[_0x57e274['model']],'as':_0x57e274['as'],'attributes':_0x57e274['attributes'],'include':_0x57e274[_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x57e274[_0xbaf0('0x1c')],function(_0x1fc5c3){return{'model':db[_0x1fc5c3[_0xbaf0('0x1e')]],'as':_0x1fc5c3['as'],'attributes':_0x1fc5c3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e08ae){logger['info']('ShowServicenowAccount',_0x47f582);logger[_0xbaf0('0x10')](_0xbaf0('0x21'),_0x47f582,JSON[_0xbaf0('0x20')](_0x5e08ae));_0x247ae8(_0x5e08ae);})[_0xbaf0('0x15')](function(_0x2eab5e){logger['error'](_0xbaf0('0x21'),_0x2eab5e['message'],_0x47f582);_0x3ee498(_0x2940e9[_0xbaf0('0x12')](0x1f4,_0x2eab5e['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ab2a11c..ee02868 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 _0x8ac7=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8ac7,0xdd));var _0x78ac=function(_0x4de2bd,_0x4bb81a){_0x4de2bd=_0x4de2bd-0x0;var _0x2889c5=_0x8ac7[_0x4de2bd];return _0x2889c5;};'use strict';var multer=require(_0x78ac('0x0'));var util=require('util');var path=require(_0x78ac('0x1'));var timeout=require(_0x78ac('0x2'));var express=require(_0x78ac('0x3'));var router=express[_0x78ac('0x4')]();var auth=require(_0x78ac('0x5'));var interaction=require(_0x78ac('0x6'));var config=require(_0x78ac('0x7'));var controller=require(_0x78ac('0x8'));router[_0x78ac('0x9')]('/',auth[_0x78ac('0xa')](),controller[_0x78ac('0xb')]);router[_0x78ac('0x9')]('/:id',auth[_0x78ac('0xa')](),controller[_0x78ac('0xc')]);router[_0x78ac('0x9')](_0x78ac('0xd'),auth[_0x78ac('0xa')](),controller[_0x78ac('0xe')]);router[_0x78ac('0x9')]('/:id/subjects',auth[_0x78ac('0xa')](),controller[_0x78ac('0xf')]);router[_0x78ac('0x9')](_0x78ac('0x10'),auth[_0x78ac('0xa')](),controller[_0x78ac('0x11')]);router[_0x78ac('0x12')]('/',auth[_0x78ac('0xa')](),controller[_0x78ac('0x13')]);router[_0x78ac('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x78ac('0x15')]);router[_0x78ac('0x16')](_0x78ac('0x17'),auth[_0x78ac('0xa')](),controller[_0x78ac('0x18')]);module[_0x78ac('0x19')]=router; \ No newline at end of file +var _0x9fd1=['getSubjects','/:id/descriptions','post','create','put','update','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','/:id','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9fd1,0x1a9));var _0x19fd=function(_0x2074fb,_0x26707f){_0x2074fb=_0x2074fb-0x0;var _0x4c71d3=_0x9fd1[_0x2074fb];return _0x4c71d3;};'use strict';var multer=require('multer');var util=require(_0x19fd('0x0'));var path=require('path');var timeout=require(_0x19fd('0x1'));var express=require('express');var router=express[_0x19fd('0x2')]();var auth=require(_0x19fd('0x3'));var interaction=require(_0x19fd('0x4'));var config=require(_0x19fd('0x5'));var controller=require(_0x19fd('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x19fd('0x7')]);router['get'](_0x19fd('0x8'),auth[_0x19fd('0x9')](),controller[_0x19fd('0xa')]);router[_0x19fd('0xb')](_0x19fd('0xc'),auth[_0x19fd('0x9')](),controller[_0x19fd('0xd')]);router[_0x19fd('0xb')](_0x19fd('0xe'),auth[_0x19fd('0x9')](),controller[_0x19fd('0xf')]);router['get'](_0x19fd('0x10'),auth[_0x19fd('0x9')](),controller['getDescriptions']);router[_0x19fd('0x11')]('/',auth[_0x19fd('0x9')](),controller[_0x19fd('0x12')]);router[_0x19fd('0x13')]('/:id',auth[_0x19fd('0x9')](),controller[_0x19fd('0x14')]);router['delete'](_0x19fd('0x8'),auth[_0x19fd('0x9')](),controller[_0x19fd('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0e61857..e243a48 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 _0xe32a=['STRING','exports'];(function(_0x1b7464,_0x539051){var _0x1d25e5=function(_0x5c3f28){while(--_0x5c3f28){_0x1b7464['push'](_0x1b7464['shift']());}};_0x1d25e5(++_0x539051);}(_0xe32a,0x12b));var _0xae32=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0xe32a[_0x60286b];return _0x5dff69;};'use strict';var Sequelize=require('sequelize');module[_0xae32('0x0')]={'name':{'type':Sequelize[_0xae32('0x1')]},'description':{'type':Sequelize[_0xae32('0x1')]}}; \ No newline at end of file +var _0x267c=['exports','STRING'];(function(_0x1a5792,_0x55fbfc){var _0x5b9345=function(_0x57bc8f){while(--_0x57bc8f){_0x1a5792['push'](_0x1a5792['shift']());}};_0x5b9345(++_0x55fbfc);}(_0x267c,0xde));var _0xc267=function(_0x1eed2e,_0x1faa70){_0x1eed2e=_0x1eed2e-0x0;var _0x4cea24=_0x267c[_0x1eed2e];return _0x4cea24;};'use strict';var Sequelize=require('sequelize');module[_0xc267('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc267('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index df5e710..ad0c1f5 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 _0x1eba=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','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','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','options','find','create','body','params','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x56f028,_0x412a04){var _0x2f8c5d=function(_0x5805f7){while(--_0x5805f7){_0x56f028['push'](_0x56f028['shift']());}};_0x2f8c5d(++_0x412a04);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x1eba[_0x30faee];return _0x3a90ab;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa1eb('0x18'));var client=jayson[_0xa1eb('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x16a623,_0x4a3774,_0x4e65dc){if(_0x4e65dc){var _0x35a353=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35a353['test'](_0x4a3774)){return _0x16a623;}else{throw new db[(_0xa1eb('0x1a'))][(_0xa1eb('0x1b'))](_0xa1eb('0x1c'));}}else{return _0x16a623;}}function respondWithRpcPromise(_0x2877cb,_0x3cd675,_0x44f37d,_0x1c858c){return new BPromise(function(_0x45d6dd,_0x211e42){var _0x4aa527=_0x1c858c||client;return _0x4aa527[_0xa1eb('0x1d')](_0x2877cb,_0x44f37d)['then'](function(_0x1401ef){logger[_0xa1eb('0x1e')](_0xa1eb('0x1f'),_0x3cd675,_0xa1eb('0x20'));logger['debug'](_0xa1eb('0x21'),_0x3cd675,_0xa1eb('0x20'),JSON[_0xa1eb('0x22')](_0x1401ef));if(_0x1401ef[_0xa1eb('0x23')]){if(_0x1401ef[_0xa1eb('0x23')][_0xa1eb('0x24')]===0x1f4){logger[_0xa1eb('0x23')](_0xa1eb('0x1f'),_0x3cd675,_0x1401ef['error'][_0xa1eb('0x25')]);return _0x211e42(_0x1401ef['error'][_0xa1eb('0x25')]);}logger[_0xa1eb('0x23')](_0xa1eb('0x1f'),_0x3cd675,_0x1401ef[_0xa1eb('0x23')]['message']);return _0x45d6dd(_0x1401ef['error'][_0xa1eb('0x25')]);}else{logger[_0xa1eb('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3cd675,_0xa1eb('0x20'));_0x45d6dd(_0x1401ef[_0xa1eb('0x26')][_0xa1eb('0x25')]);}})[_0xa1eb('0x27')](function(_0x23b49e){logger[_0xa1eb('0x23')](_0xa1eb('0x1f'),_0x3cd675,_0x23b49e);_0x211e42(_0x23b49e);});});}function respondWithStatusCode(_0x364b1c,_0xd7bb88){_0xd7bb88=_0xd7bb88||0xcc;return function(_0x352796){if(_0x352796){return _0x364b1c[_0xa1eb('0x28')](_0xd7bb88);}return _0x364b1c[_0xa1eb('0x29')](_0xd7bb88)['end']();};}function respondWithResult(_0x7c617e,_0xbd5517){_0xbd5517=_0xbd5517||0xc8;return function(_0x491f37){if(_0x491f37){return _0x7c617e[_0xa1eb('0x29')](_0xbd5517)['json'](_0x491f37);}};}function respondWithFilteredResult(_0x3aae71,_0x2d31d1){return function(_0x53a890){if(_0x53a890){var _0x45ff0d=_0x53a890[_0xa1eb('0x2a')],_0x1581ee=_0x2d31d1[_0xa1eb('0x2b')],_0x136835=_0x2d31d1['offset']+_0x2d31d1[_0xa1eb('0x2c')],_0x4f64bb;if(_0x136835>=_0x45ff0d){_0x136835=_0x45ff0d;_0x4f64bb=0xc8;}else{_0x4f64bb=0xce;}_0x3aae71[_0xa1eb('0x29')](_0x4f64bb);return _0x3aae71[_0xa1eb('0x2d')](_0xa1eb('0x2e'),_0x1581ee+'-'+_0x136835+'/'+_0x45ff0d)[_0xa1eb('0x2f')](_0x53a890);}return null;};}function patchUpdates(_0x52f9c7){return function(_0x9d49d8){try{jsonpatch[_0xa1eb('0x30')](_0x9d49d8,_0x52f9c7,!![]);}catch(_0x198fdb){return BPromise[_0xa1eb('0x31')](_0x198fdb);}return _0x9d49d8[_0xa1eb('0x32')]();};}function saveUpdates(_0xcd9efd,_0x1d5b64){return function(_0xcfda64){if(_0xcfda64){return _0xcfda64[_0xa1eb('0x33')](_0xcd9efd)[_0xa1eb('0x34')](function(_0x4345a3){return _0x4345a3;});}return null;};}function removeEntity(_0x4fdba4,_0x563b11){return function(_0x126d50){if(_0x126d50){return _0x126d50[_0xa1eb('0x35')]()[_0xa1eb('0x34')](function(){_0x4fdba4[_0xa1eb('0x29')](0xcc)[_0xa1eb('0x36')]();});}};}function handleEntityNotFound(_0x58d336,_0x49ddb9){return function(_0x151446){if(!_0x151446){_0x58d336[_0xa1eb('0x28')](0x194);}return _0x151446;};}function handleError(_0x516c14,_0x48b23d){_0x48b23d=_0x48b23d||0x1f4;return function(_0x3761bf){logger['error'](_0x3761bf[_0xa1eb('0x37')]);if(_0x3761bf['name']){delete _0x3761bf[_0xa1eb('0x38')];}_0x516c14[_0xa1eb('0x29')](_0x48b23d)[_0xa1eb('0x39')](_0x3761bf);};}exports['index']=function(_0x355839,_0x3d59b9){var _0x35ed30={},_0x481405={},_0x140f1e={'count':0x0,'rows':[]};var _0x27273a=_[_0xa1eb('0x3a')](db[_0xa1eb('0x3b')][_0xa1eb('0x3c')],function(_0x5912d5){return{'name':_0x5912d5[_0xa1eb('0x3d')],'type':_0x5912d5[_0xa1eb('0x3e')][_0xa1eb('0x3f')]};});_0x481405[_0xa1eb('0x40')]=_[_0xa1eb('0x3a')](_0x27273a,_0xa1eb('0x38'));_0x481405[_0xa1eb('0x41')]=_[_0xa1eb('0x42')](_0x355839['query']);_0x481405[_0xa1eb('0x43')]=_[_0xa1eb('0x44')](_0x481405[_0xa1eb('0x40')],_0x481405[_0xa1eb('0x41')]);_0x35ed30[_0xa1eb('0x45')]=_['intersection'](_0x481405[_0xa1eb('0x40')],qs[_0xa1eb('0x46')](_0x355839[_0xa1eb('0x41')]['fields']));_0x35ed30[_0xa1eb('0x45')]=_0x35ed30[_0xa1eb('0x45')][_0xa1eb('0x47')]?_0x35ed30[_0xa1eb('0x45')]:_0x481405[_0xa1eb('0x40')];if(!_0x355839[_0xa1eb('0x41')][_0xa1eb('0x48')]('nolimit')){_0x35ed30[_0xa1eb('0x2c')]=qs[_0xa1eb('0x2c')](_0x355839['query'][_0xa1eb('0x2c')]);_0x35ed30['offset']=qs[_0xa1eb('0x2b')](_0x355839[_0xa1eb('0x41')][_0xa1eb('0x2b')]);}_0x35ed30[_0xa1eb('0x49')]=qs[_0xa1eb('0x4a')](_0x355839[_0xa1eb('0x41')][_0xa1eb('0x4a')]);_0x35ed30[_0xa1eb('0x4b')]=qs[_0xa1eb('0x43')](_[_0xa1eb('0x4c')](_0x355839[_0xa1eb('0x41')],_0x481405[_0xa1eb('0x43')]),_0x27273a);if(_0x355839[_0xa1eb('0x41')][_0xa1eb('0x4d')]){_0x35ed30[_0xa1eb('0x4b')]=_[_0xa1eb('0x4e')](_0x35ed30['where'],{'$or':_[_0xa1eb('0x3a')](_0x27273a,function(_0x4fd053){if(_0x4fd053[_0xa1eb('0x3e')]!==_0xa1eb('0x4f')){var _0x54a29f={};_0x54a29f[_0x4fd053['name']]={'$like':'%'+_0x355839[_0xa1eb('0x41')][_0xa1eb('0x4d')]+'%'};return _0x54a29f;}})});}_0x35ed30=_[_0xa1eb('0x4e')]({},_0x35ed30,_0x355839['options']);var _0x267893={'where':_0x35ed30[_0xa1eb('0x4b')]};return db[_0xa1eb('0x3b')][_0xa1eb('0x2a')](_0x267893)[_0xa1eb('0x34')](function(_0x6f47c5){_0x140f1e[_0xa1eb('0x2a')]=_0x6f47c5;if(_0x355839[_0xa1eb('0x41')][_0xa1eb('0x50')]){_0x35ed30[_0xa1eb('0x51')]=[{'all':!![]}];}return db[_0xa1eb('0x3b')][_0xa1eb('0x52')](_0x35ed30);})[_0xa1eb('0x34')](function(_0x10e15a){_0x140f1e['rows']=_0x10e15a;return _0x140f1e;})[_0xa1eb('0x34')](respondWithFilteredResult(_0x3d59b9,_0x35ed30))[_0xa1eb('0x27')](handleError(_0x3d59b9,null));};exports[_0xa1eb('0x53')]=function(_0x977d00,_0x2b0cbf){var _0x12dfd4={'raw':![],'where':{'id':_0x977d00['params']['id']}},_0x2374c0={};_0x2374c0[_0xa1eb('0x40')]=_[_0xa1eb('0x42')](db[_0xa1eb('0x3b')][_0xa1eb('0x3c')]);_0x2374c0[_0xa1eb('0x41')]=_[_0xa1eb('0x42')](_0x977d00[_0xa1eb('0x41')]);_0x2374c0[_0xa1eb('0x43')]=_[_0xa1eb('0x44')](_0x2374c0['model'],_0x2374c0[_0xa1eb('0x41')]);_0x12dfd4['attributes']=_[_0xa1eb('0x44')](_0x2374c0['model'],qs[_0xa1eb('0x46')](_0x977d00[_0xa1eb('0x41')][_0xa1eb('0x46')]));_0x12dfd4['attributes']=_0x12dfd4[_0xa1eb('0x45')][_0xa1eb('0x47')]?_0x12dfd4['attributes']:_0x2374c0[_0xa1eb('0x40')];if(_0x977d00[_0xa1eb('0x41')][_0xa1eb('0x50')]){_0x12dfd4[_0xa1eb('0x51')]=[{'all':!![]}];}_0x12dfd4=_[_0xa1eb('0x4e')]({},_0x12dfd4,_0x977d00[_0xa1eb('0x54')]);return db[_0xa1eb('0x3b')][_0xa1eb('0x55')](_0x12dfd4)[_0xa1eb('0x34')](handleEntityNotFound(_0x2b0cbf,null))[_0xa1eb('0x34')](respondWithResult(_0x2b0cbf,null))[_0xa1eb('0x27')](handleError(_0x2b0cbf,null));};exports[_0xa1eb('0x56')]=function(_0x159a19,_0x260c4a){return db[_0xa1eb('0x3b')][_0xa1eb('0x56')](_0x159a19[_0xa1eb('0x57')],{})['then'](respondWithResult(_0x260c4a,0xc9))[_0xa1eb('0x27')](handleError(_0x260c4a,null));};exports[_0xa1eb('0x33')]=function(_0x2161ed,_0x1085ca){if(_0x2161ed[_0xa1eb('0x57')]['id']){delete _0x2161ed[_0xa1eb('0x57')]['id'];}return db['ServicenowConfiguration'][_0xa1eb('0x55')]({'where':{'id':_0x2161ed[_0xa1eb('0x58')]['id']}})[_0xa1eb('0x34')](handleEntityNotFound(_0x1085ca,null))[_0xa1eb('0x34')](saveUpdates(_0x2161ed[_0xa1eb('0x57')],null))[_0xa1eb('0x34')](respondWithResult(_0x1085ca,null))[_0xa1eb('0x27')](handleError(_0x1085ca,null));};exports['destroy']=function(_0x257236,_0xdebe47){return db[_0xa1eb('0x3b')][_0xa1eb('0x55')]({'where':{'id':_0x257236['params']['id']}})['then'](handleEntityNotFound(_0xdebe47,null))['then'](removeEntity(_0xdebe47,null))['catch'](handleError(_0xdebe47,null));};exports[_0xa1eb('0x59')]=function(_0x1e1e5d,_0x591907,_0x4643f3){var _0x3e2d2f={};var _0x262b22={};var _0x167be2;var _0x4edf8e;return db['ServicenowConfiguration'][_0xa1eb('0x5a')]({'where':{'id':_0x1e1e5d[_0xa1eb('0x58')]['id']}})[_0xa1eb('0x34')](handleEntityNotFound(_0x591907,null))[_0xa1eb('0x34')](function(_0x3203c6){if(_0x3203c6){_0x167be2=_0x3203c6;_0x262b22[_0xa1eb('0x40')]=_['keys'](db['ServicenowField'][_0xa1eb('0x3c')]);_0x262b22['query']=_[_0xa1eb('0x42')](_0x1e1e5d['query']);_0x262b22[_0xa1eb('0x43')]=_[_0xa1eb('0x44')](_0x262b22['model'],_0x262b22[_0xa1eb('0x41')]);_0x3e2d2f[_0xa1eb('0x45')]=_['intersection'](_0x262b22[_0xa1eb('0x40')],qs[_0xa1eb('0x46')](_0x1e1e5d[_0xa1eb('0x41')]['fields']));_0x3e2d2f[_0xa1eb('0x45')]=_0x3e2d2f[_0xa1eb('0x45')]['length']?_0x3e2d2f[_0xa1eb('0x45')]:_0x262b22[_0xa1eb('0x40')];_0x3e2d2f[_0xa1eb('0x49')]=qs['sort'](_0x1e1e5d[_0xa1eb('0x41')]['sort']);_0x3e2d2f[_0xa1eb('0x4b')]=qs[_0xa1eb('0x43')](_[_0xa1eb('0x4c')](_0x1e1e5d[_0xa1eb('0x41')],_0x262b22[_0xa1eb('0x43')]));if(_0x1e1e5d['query'][_0xa1eb('0x4d')]){_0x3e2d2f[_0xa1eb('0x4b')]=_[_0xa1eb('0x4e')](_0x3e2d2f['where'],{'$or':_[_0xa1eb('0x3a')](_0x3e2d2f['attributes'],function(_0x4e582c){var _0x4e5e70={};_0x4e5e70[_0x4e582c]={'$like':'%'+_0x1e1e5d['query'][_0xa1eb('0x4d')]+'%'};return _0x4e5e70;})});}_0x3e2d2f=_[_0xa1eb('0x4e')]({},_0x3e2d2f,_0x1e1e5d[_0xa1eb('0x54')]);return _0x167be2[_0xa1eb('0x59')](_0x3e2d2f);}})[_0xa1eb('0x34')](function(_0x99ce4f){if(_0x99ce4f){_0x4edf8e=_0x99ce4f[_0xa1eb('0x47')];if(!_0x1e1e5d[_0xa1eb('0x41')][_0xa1eb('0x48')](_0xa1eb('0x5b'))){_0x3e2d2f['limit']=qs[_0xa1eb('0x2c')](_0x1e1e5d[_0xa1eb('0x41')][_0xa1eb('0x2c')]);_0x3e2d2f[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1e1e5d[_0xa1eb('0x41')]['offset']);}return _0x167be2[_0xa1eb('0x59')](_0x3e2d2f);}})[_0xa1eb('0x34')](function(_0x16c5a3){if(_0x16c5a3){return _0x16c5a3?{'count':_0x4edf8e,'rows':_0x16c5a3}:null;}})['then'](respondWithResult(_0x591907,null))[_0xa1eb('0x27')](handleError(_0x591907,null));};exports[_0xa1eb('0x5c')]=function(_0x1403cf,_0xf39210,_0x197e38){var _0x540746={};var _0x2eca4e={};var _0x50eff6;var _0x2597de;return db['ServicenowConfiguration'][_0xa1eb('0x5a')]({'where':{'id':_0x1403cf[_0xa1eb('0x58')]['id']}})[_0xa1eb('0x34')](handleEntityNotFound(_0xf39210,null))[_0xa1eb('0x34')](function(_0x47c618){if(_0x47c618){_0x50eff6=_0x47c618;_0x2eca4e[_0xa1eb('0x40')]=_[_0xa1eb('0x42')](db[_0xa1eb('0x5d')][_0xa1eb('0x3c')]);_0x2eca4e['query']=_[_0xa1eb('0x42')](_0x1403cf[_0xa1eb('0x41')]);_0x2eca4e[_0xa1eb('0x43')]=_[_0xa1eb('0x44')](_0x2eca4e[_0xa1eb('0x40')],_0x2eca4e[_0xa1eb('0x41')]);_0x540746[_0xa1eb('0x45')]=_[_0xa1eb('0x44')](_0x2eca4e[_0xa1eb('0x40')],qs['fields'](_0x1403cf['query']['fields']));_0x540746[_0xa1eb('0x45')]=_0x540746['attributes'][_0xa1eb('0x47')]?_0x540746[_0xa1eb('0x45')]:_0x2eca4e['model'];_0x540746['order']=qs[_0xa1eb('0x4a')](_0x1403cf[_0xa1eb('0x41')][_0xa1eb('0x4a')]);_0x540746[_0xa1eb('0x4b')]=qs[_0xa1eb('0x43')](_['pick'](_0x1403cf['query'],_0x2eca4e[_0xa1eb('0x43')]));if(_0x1403cf[_0xa1eb('0x41')][_0xa1eb('0x4d')]){_0x540746[_0xa1eb('0x4b')]=_['merge'](_0x540746[_0xa1eb('0x4b')],{'$or':_[_0xa1eb('0x3a')](_0x540746[_0xa1eb('0x45')],function(_0x4050d6){var _0x3863ce={};_0x3863ce[_0x4050d6]={'$like':'%'+_0x1403cf[_0xa1eb('0x41')][_0xa1eb('0x4d')]+'%'};return _0x3863ce;})});}_0x540746=_[_0xa1eb('0x4e')]({},_0x540746,_0x1403cf[_0xa1eb('0x54')]);return _0x50eff6[_0xa1eb('0x5c')](_0x540746);}})[_0xa1eb('0x34')](function(_0x4fa17f){if(_0x4fa17f){_0x2597de=_0x4fa17f[_0xa1eb('0x47')];if(!_0x1403cf[_0xa1eb('0x41')][_0xa1eb('0x48')](_0xa1eb('0x5b'))){_0x540746[_0xa1eb('0x2c')]=qs[_0xa1eb('0x2c')](_0x1403cf['query'][_0xa1eb('0x2c')]);_0x540746[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x1403cf[_0xa1eb('0x41')]['offset']);}return _0x50eff6['getSubjects'](_0x540746);}})[_0xa1eb('0x34')](function(_0x5e0cd5){if(_0x5e0cd5){return _0x5e0cd5?{'count':_0x2597de,'rows':_0x5e0cd5}:null;}})[_0xa1eb('0x34')](respondWithResult(_0xf39210,null))[_0xa1eb('0x27')](handleError(_0xf39210,null));};exports['getDescriptions']=function(_0x2f9822,_0x1b01f9,_0x525498){var _0x355058={};var _0x3a6be1={};var _0x3dc3bf;var _0x2d54e9;return db[_0xa1eb('0x3b')][_0xa1eb('0x5a')]({'where':{'id':_0x2f9822[_0xa1eb('0x58')]['id']}})[_0xa1eb('0x34')](handleEntityNotFound(_0x1b01f9,null))[_0xa1eb('0x34')](function(_0x64943f){if(_0x64943f){_0x3dc3bf=_0x64943f;_0x3a6be1[_0xa1eb('0x40')]=_['keys'](db[_0xa1eb('0x5d')][_0xa1eb('0x3c')]);_0x3a6be1[_0xa1eb('0x41')]=_[_0xa1eb('0x42')](_0x2f9822['query']);_0x3a6be1[_0xa1eb('0x43')]=_[_0xa1eb('0x44')](_0x3a6be1[_0xa1eb('0x40')],_0x3a6be1['query']);_0x355058[_0xa1eb('0x45')]=_[_0xa1eb('0x44')](_0x3a6be1[_0xa1eb('0x40')],qs['fields'](_0x2f9822[_0xa1eb('0x41')]['fields']));_0x355058[_0xa1eb('0x45')]=_0x355058[_0xa1eb('0x45')][_0xa1eb('0x47')]?_0x355058[_0xa1eb('0x45')]:_0x3a6be1[_0xa1eb('0x40')];_0x355058[_0xa1eb('0x49')]=qs[_0xa1eb('0x4a')](_0x2f9822[_0xa1eb('0x41')]['sort']);_0x355058[_0xa1eb('0x4b')]=qs[_0xa1eb('0x43')](_[_0xa1eb('0x4c')](_0x2f9822[_0xa1eb('0x41')],_0x3a6be1[_0xa1eb('0x43')]));if(_0x2f9822['query'][_0xa1eb('0x4d')]){_0x355058[_0xa1eb('0x4b')]=_['merge'](_0x355058[_0xa1eb('0x4b')],{'$or':_['map'](_0x355058['attributes'],function(_0x29f795){var _0x22f25d={};_0x22f25d[_0x29f795]={'$like':'%'+_0x2f9822['query'][_0xa1eb('0x4d')]+'%'};return _0x22f25d;})});}_0x355058=_[_0xa1eb('0x4e')]({},_0x355058,_0x2f9822['options']);return _0x3dc3bf[_0xa1eb('0x5e')](_0x355058);}})[_0xa1eb('0x34')](function(_0x4d2598){if(_0x4d2598){_0x2d54e9=_0x4d2598['length'];if(!_0x2f9822[_0xa1eb('0x41')]['hasOwnProperty'](_0xa1eb('0x5b'))){_0x355058[_0xa1eb('0x2c')]=qs[_0xa1eb('0x2c')](_0x2f9822[_0xa1eb('0x41')][_0xa1eb('0x2c')]);_0x355058[_0xa1eb('0x2b')]=qs['offset'](_0x2f9822[_0xa1eb('0x41')]['offset']);}return _0x3dc3bf[_0xa1eb('0x5e')](_0x355058);}})[_0xa1eb('0x34')](function(_0x3ca0ee){if(_0x3ca0ee){return _0x3ca0ee?{'count':_0x2d54e9,'rows':_0x3ca0ee}:null;}})[_0xa1eb('0x34')](respondWithResult(_0x1b01f9,null))[_0xa1eb('0x27')](handleError(_0x1b01f9,null));}; \ No newline at end of file +var _0x3266=['findAll','rows','show','params','fields','include','find','create','body','getFields','findOne','ServicenowField','options','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','update','then','destroy','name','send','map','ServicenowConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll'];(function(_0x415466,_0x55a445){var _0x3b4e05=function(_0x3ba6e2){while(--_0x3ba6e2){_0x415466['push'](_0x415466['shift']());}};_0x3b4e05(++_0x55a445);}(_0x3266,0x6a));var _0x6326=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x3266[_0x39e283];return _0x7de89f;};'use strict';var pdf=require(_0x6326('0x0'));var emlformat=require(_0x6326('0x1'));var rimraf=require(_0x6326('0x2'));var zipdir=require(_0x6326('0x3'));var jsonpatch=require(_0x6326('0x4'));var rp=require(_0x6326('0x5'));var moment=require(_0x6326('0x6'));var BPromise=require(_0x6326('0x7'));var Mustache=require(_0x6326('0x8'));var util=require('util');var path=require(_0x6326('0x9'));var sox=require('sox');var csv=require(_0x6326('0xa'));var ejs=require(_0x6326('0xb'));var fs=require('fs');var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xa'));var querystring=require(_0x6326('0xf'));var Papa=require(_0x6326('0x10'));var Redis=require(_0x6326('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x12'));var as=require(_0x6326('0x13'));var hardwareService=require(_0x6326('0x14'));var logger=require(_0x6326('0x15'))(_0x6326('0x16'));var utils=require(_0x6326('0x17'));var config=require(_0x6326('0x18'));var db=require(_0x6326('0x19'))['db'];var jayson=require(_0x6326('0x1a'));var client=jayson[_0x6326('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x5381d0,_0x301f34,_0x136946){if(_0x136946){var _0x591b81=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x591b81[_0x6326('0x1c')](_0x301f34)){return _0x5381d0;}else{throw new db['Sequelize'][(_0x6326('0x1d'))](_0x6326('0x1e'));}}else{return _0x5381d0;}}function respondWithRpcPromise(_0x3d6ac0,_0x41c352,_0x1ed3a3,_0x2c1879){return new BPromise(function(_0x55923a,_0x1104c5){var _0x518e6f=_0x2c1879||client;return _0x518e6f['request'](_0x3d6ac0,_0x1ed3a3)['then'](function(_0x51e7b9){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x41c352,_0x6326('0x1f'));logger[_0x6326('0x20')](_0x6326('0x21'),_0x41c352,'request\x20sent',JSON['stringify'](_0x51e7b9));if(_0x51e7b9[_0x6326('0x22')]){if(_0x51e7b9[_0x6326('0x22')][_0x6326('0x23')]===0x1f4){logger[_0x6326('0x22')](_0x6326('0x24'),_0x41c352,_0x51e7b9[_0x6326('0x22')][_0x6326('0x25')]);return _0x1104c5(_0x51e7b9['error'][_0x6326('0x25')]);}logger['error'](_0x6326('0x24'),_0x41c352,_0x51e7b9[_0x6326('0x22')][_0x6326('0x25')]);return _0x55923a(_0x51e7b9[_0x6326('0x22')][_0x6326('0x25')]);}else{logger[_0x6326('0x26')](_0x6326('0x24'),_0x41c352,_0x6326('0x1f'));_0x55923a(_0x51e7b9[_0x6326('0x27')][_0x6326('0x25')]);}})[_0x6326('0x28')](function(_0x4933e1){logger[_0x6326('0x22')](_0x6326('0x24'),_0x41c352,_0x4933e1);_0x1104c5(_0x4933e1);});});}function respondWithStatusCode(_0x575701,_0x4e272b){_0x4e272b=_0x4e272b||0xcc;return function(_0x4d28fd){if(_0x4d28fd){return _0x575701[_0x6326('0x29')](_0x4e272b);}return _0x575701['status'](_0x4e272b)[_0x6326('0x2a')]();};}function respondWithResult(_0x1a48da,_0x5a907f){_0x5a907f=_0x5a907f||0xc8;return function(_0x15e33d){if(_0x15e33d){return _0x1a48da[_0x6326('0x2b')](_0x5a907f)[_0x6326('0x2c')](_0x15e33d);}};}function respondWithFilteredResult(_0x2983e4,_0x2d2180){return function(_0x45d037){if(_0x45d037){var _0x40e036=_0x45d037[_0x6326('0x2d')],_0x27802c=_0x2d2180[_0x6326('0x2e')],_0x461e0f=_0x2d2180[_0x6326('0x2e')]+_0x2d2180[_0x6326('0x2f')],_0x127744;if(_0x461e0f>=_0x40e036){_0x461e0f=_0x40e036;_0x127744=0xc8;}else{_0x127744=0xce;}_0x2983e4[_0x6326('0x2b')](_0x127744);return _0x2983e4[_0x6326('0x30')]('Content-Range',_0x27802c+'-'+_0x461e0f+'/'+_0x40e036)[_0x6326('0x2c')](_0x45d037);}return null;};}function patchUpdates(_0x47303c){return function(_0x1f8982){try{jsonpatch['apply'](_0x1f8982,_0x47303c,!![]);}catch(_0x1bd9a6){return BPromise['reject'](_0x1bd9a6);}return _0x1f8982['save']();};}function saveUpdates(_0xfb6b62,_0x7ac8d9){return function(_0x160a12){if(_0x160a12){return _0x160a12[_0x6326('0x31')](_0xfb6b62)[_0x6326('0x32')](function(_0x380593){return _0x380593;});}return null;};}function removeEntity(_0x1a7924,_0x46c803){return function(_0x2b42ff){if(_0x2b42ff){return _0x2b42ff[_0x6326('0x33')]()[_0x6326('0x32')](function(){_0x1a7924[_0x6326('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe1bb4f,_0x315276){return function(_0x4d51ca){if(!_0x4d51ca){_0xe1bb4f[_0x6326('0x29')](0x194);}return _0x4d51ca;};}function handleError(_0x2958af,_0x28ef24){_0x28ef24=_0x28ef24||0x1f4;return function(_0x592b37){logger[_0x6326('0x22')](_0x592b37['stack']);if(_0x592b37['name']){delete _0x592b37[_0x6326('0x34')];}_0x2958af[_0x6326('0x2b')](_0x28ef24)[_0x6326('0x35')](_0x592b37);};}exports['index']=function(_0x40d890,_0x55a431){var _0xe5d93c={},_0x4fb95d={},_0x3168f9={'count':0x0,'rows':[]};var _0x32f860=_[_0x6326('0x36')](db[_0x6326('0x37')][_0x6326('0x38')],function(_0x207fb1){return{'name':_0x207fb1['fieldName'],'type':_0x207fb1[_0x6326('0x39')][_0x6326('0x3a')]};});_0x4fb95d['model']=_[_0x6326('0x36')](_0x32f860,'name');_0x4fb95d['query']=_[_0x6326('0x3b')](_0x40d890[_0x6326('0x3c')]);_0x4fb95d[_0x6326('0x3d')]=_[_0x6326('0x3e')](_0x4fb95d[_0x6326('0x3f')],_0x4fb95d[_0x6326('0x3c')]);_0xe5d93c['attributes']=_['intersection'](_0x4fb95d[_0x6326('0x3f')],qs['fields'](_0x40d890[_0x6326('0x3c')]['fields']));_0xe5d93c[_0x6326('0x40')]=_0xe5d93c[_0x6326('0x40')][_0x6326('0x41')]?_0xe5d93c[_0x6326('0x40')]:_0x4fb95d[_0x6326('0x3f')];if(!_0x40d890[_0x6326('0x3c')][_0x6326('0x42')](_0x6326('0x43'))){_0xe5d93c[_0x6326('0x2f')]=qs[_0x6326('0x2f')](_0x40d890[_0x6326('0x3c')]['limit']);_0xe5d93c[_0x6326('0x2e')]=qs['offset'](_0x40d890[_0x6326('0x3c')][_0x6326('0x2e')]);}_0xe5d93c[_0x6326('0x44')]=qs[_0x6326('0x45')](_0x40d890['query'][_0x6326('0x45')]);_0xe5d93c[_0x6326('0x46')]=qs['filters'](_[_0x6326('0x47')](_0x40d890[_0x6326('0x3c')],_0x4fb95d[_0x6326('0x3d')]),_0x32f860);if(_0x40d890[_0x6326('0x3c')]['filter']){_0xe5d93c[_0x6326('0x46')]=_[_0x6326('0x48')](_0xe5d93c[_0x6326('0x46')],{'$or':_[_0x6326('0x36')](_0x32f860,function(_0x44d852){if(_0x44d852[_0x6326('0x39')]!==_0x6326('0x49')){var _0x5a0da3={};_0x5a0da3[_0x44d852[_0x6326('0x34')]]={'$like':'%'+_0x40d890[_0x6326('0x3c')][_0x6326('0x4a')]+'%'};return _0x5a0da3;}})});}_0xe5d93c=_[_0x6326('0x48')]({},_0xe5d93c,_0x40d890['options']);var _0x163f8d={'where':_0xe5d93c['where']};return db[_0x6326('0x37')][_0x6326('0x2d')](_0x163f8d)[_0x6326('0x32')](function(_0x3fbc11){_0x3168f9[_0x6326('0x2d')]=_0x3fbc11;if(_0x40d890['query'][_0x6326('0x4b')]){_0xe5d93c['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x6326('0x4c')](_0xe5d93c);})[_0x6326('0x32')](function(_0x5b14f4){_0x3168f9[_0x6326('0x4d')]=_0x5b14f4;return _0x3168f9;})[_0x6326('0x32')](respondWithFilteredResult(_0x55a431,_0xe5d93c))[_0x6326('0x28')](handleError(_0x55a431,null));};exports[_0x6326('0x4e')]=function(_0x3a3907,_0x4f8dc0){var _0x4af0ee={'raw':![],'where':{'id':_0x3a3907[_0x6326('0x4f')]['id']}},_0x2d82c0={};_0x2d82c0[_0x6326('0x3f')]=_[_0x6326('0x3b')](db[_0x6326('0x37')][_0x6326('0x38')]);_0x2d82c0[_0x6326('0x3c')]=_['keys'](_0x3a3907[_0x6326('0x3c')]);_0x2d82c0[_0x6326('0x3d')]=_[_0x6326('0x3e')](_0x2d82c0[_0x6326('0x3f')],_0x2d82c0[_0x6326('0x3c')]);_0x4af0ee['attributes']=_[_0x6326('0x3e')](_0x2d82c0['model'],qs[_0x6326('0x50')](_0x3a3907[_0x6326('0x3c')]['fields']));_0x4af0ee[_0x6326('0x40')]=_0x4af0ee['attributes'][_0x6326('0x41')]?_0x4af0ee[_0x6326('0x40')]:_0x2d82c0[_0x6326('0x3f')];if(_0x3a3907[_0x6326('0x3c')]['includeAll']){_0x4af0ee[_0x6326('0x51')]=[{'all':!![]}];}_0x4af0ee=_[_0x6326('0x48')]({},_0x4af0ee,_0x3a3907['options']);return db[_0x6326('0x37')][_0x6326('0x52')](_0x4af0ee)[_0x6326('0x32')](handleEntityNotFound(_0x4f8dc0,null))['then'](respondWithResult(_0x4f8dc0,null))[_0x6326('0x28')](handleError(_0x4f8dc0,null));};exports[_0x6326('0x53')]=function(_0x59a167,_0x16e606){return db['ServicenowConfiguration'][_0x6326('0x53')](_0x59a167[_0x6326('0x54')],{})[_0x6326('0x32')](respondWithResult(_0x16e606,0xc9))[_0x6326('0x28')](handleError(_0x16e606,null));};exports[_0x6326('0x31')]=function(_0x420290,_0xa3a043){if(_0x420290['body']['id']){delete _0x420290['body']['id'];}return db['ServicenowConfiguration'][_0x6326('0x52')]({'where':{'id':_0x420290['params']['id']}})[_0x6326('0x32')](handleEntityNotFound(_0xa3a043,null))[_0x6326('0x32')](saveUpdates(_0x420290[_0x6326('0x54')],null))[_0x6326('0x32')](respondWithResult(_0xa3a043,null))[_0x6326('0x28')](handleError(_0xa3a043,null));};exports['destroy']=function(_0x23bf64,_0x2e4244){return db['ServicenowConfiguration'][_0x6326('0x52')]({'where':{'id':_0x23bf64[_0x6326('0x4f')]['id']}})[_0x6326('0x32')](handleEntityNotFound(_0x2e4244,null))[_0x6326('0x32')](removeEntity(_0x2e4244,null))[_0x6326('0x28')](handleError(_0x2e4244,null));};exports[_0x6326('0x55')]=function(_0x320d43,_0x2f624f,_0x2c7a8d){var _0x37506f={};var _0x4c6544={};var _0x426b5a;var _0x128ae0;return db[_0x6326('0x37')][_0x6326('0x56')]({'where':{'id':_0x320d43['params']['id']}})['then'](handleEntityNotFound(_0x2f624f,null))[_0x6326('0x32')](function(_0x4740eb){if(_0x4740eb){_0x426b5a=_0x4740eb;_0x4c6544[_0x6326('0x3f')]=_[_0x6326('0x3b')](db[_0x6326('0x57')]['rawAttributes']);_0x4c6544['query']=_[_0x6326('0x3b')](_0x320d43[_0x6326('0x3c')]);_0x4c6544[_0x6326('0x3d')]=_[_0x6326('0x3e')](_0x4c6544['model'],_0x4c6544[_0x6326('0x3c')]);_0x37506f[_0x6326('0x40')]=_[_0x6326('0x3e')](_0x4c6544[_0x6326('0x3f')],qs[_0x6326('0x50')](_0x320d43[_0x6326('0x3c')]['fields']));_0x37506f[_0x6326('0x40')]=_0x37506f['attributes'][_0x6326('0x41')]?_0x37506f[_0x6326('0x40')]:_0x4c6544['model'];_0x37506f[_0x6326('0x44')]=qs[_0x6326('0x45')](_0x320d43[_0x6326('0x3c')][_0x6326('0x45')]);_0x37506f[_0x6326('0x46')]=qs[_0x6326('0x3d')](_[_0x6326('0x47')](_0x320d43[_0x6326('0x3c')],_0x4c6544[_0x6326('0x3d')]));if(_0x320d43[_0x6326('0x3c')]['filter']){_0x37506f[_0x6326('0x46')]=_[_0x6326('0x48')](_0x37506f[_0x6326('0x46')],{'$or':_[_0x6326('0x36')](_0x37506f[_0x6326('0x40')],function(_0x5599da){var _0x299795={};_0x299795[_0x5599da]={'$like':'%'+_0x320d43[_0x6326('0x3c')][_0x6326('0x4a')]+'%'};return _0x299795;})});}_0x37506f=_[_0x6326('0x48')]({},_0x37506f,_0x320d43[_0x6326('0x58')]);return _0x426b5a['getFields'](_0x37506f);}})[_0x6326('0x32')](function(_0x564332){if(_0x564332){_0x128ae0=_0x564332['length'];if(!_0x320d43[_0x6326('0x3c')][_0x6326('0x42')](_0x6326('0x43'))){_0x37506f[_0x6326('0x2f')]=qs['limit'](_0x320d43['query']['limit']);_0x37506f['offset']=qs[_0x6326('0x2e')](_0x320d43['query'][_0x6326('0x2e')]);}return _0x426b5a[_0x6326('0x55')](_0x37506f);}})['then'](function(_0x4c1d7e){if(_0x4c1d7e){return _0x4c1d7e?{'count':_0x128ae0,'rows':_0x4c1d7e}:null;}})['then'](respondWithResult(_0x2f624f,null))[_0x6326('0x28')](handleError(_0x2f624f,null));};exports['getSubjects']=function(_0x22cae7,_0x488e03,_0x4d41c0){var _0x528944={};var _0x47f0c0={};var _0x19916e;var _0x5880ae;return db[_0x6326('0x37')][_0x6326('0x56')]({'where':{'id':_0x22cae7['params']['id']}})[_0x6326('0x32')](handleEntityNotFound(_0x488e03,null))['then'](function(_0xe8f08c){if(_0xe8f08c){_0x19916e=_0xe8f08c;_0x47f0c0[_0x6326('0x3f')]=_[_0x6326('0x3b')](db[_0x6326('0x57')][_0x6326('0x38')]);_0x47f0c0[_0x6326('0x3c')]=_[_0x6326('0x3b')](_0x22cae7[_0x6326('0x3c')]);_0x47f0c0[_0x6326('0x3d')]=_[_0x6326('0x3e')](_0x47f0c0[_0x6326('0x3f')],_0x47f0c0[_0x6326('0x3c')]);_0x528944[_0x6326('0x40')]=_[_0x6326('0x3e')](_0x47f0c0[_0x6326('0x3f')],qs[_0x6326('0x50')](_0x22cae7[_0x6326('0x3c')]['fields']));_0x528944['attributes']=_0x528944['attributes']['length']?_0x528944[_0x6326('0x40')]:_0x47f0c0['model'];_0x528944['order']=qs['sort'](_0x22cae7['query']['sort']);_0x528944['where']=qs[_0x6326('0x3d')](_[_0x6326('0x47')](_0x22cae7['query'],_0x47f0c0[_0x6326('0x3d')]));if(_0x22cae7[_0x6326('0x3c')][_0x6326('0x4a')]){_0x528944['where']=_[_0x6326('0x48')](_0x528944[_0x6326('0x46')],{'$or':_[_0x6326('0x36')](_0x528944[_0x6326('0x40')],function(_0x3e9477){var _0x483813={};_0x483813[_0x3e9477]={'$like':'%'+_0x22cae7[_0x6326('0x3c')]['filter']+'%'};return _0x483813;})});}_0x528944=_['merge']({},_0x528944,_0x22cae7[_0x6326('0x58')]);return _0x19916e['getSubjects'](_0x528944);}})['then'](function(_0x52a91d){if(_0x52a91d){_0x5880ae=_0x52a91d['length'];if(!_0x22cae7['query']['hasOwnProperty']('nolimit')){_0x528944[_0x6326('0x2f')]=qs[_0x6326('0x2f')](_0x22cae7[_0x6326('0x3c')][_0x6326('0x2f')]);_0x528944['offset']=qs['offset'](_0x22cae7['query'][_0x6326('0x2e')]);}return _0x19916e[_0x6326('0x59')](_0x528944);}})['then'](function(_0x21a82c){if(_0x21a82c){return _0x21a82c?{'count':_0x5880ae,'rows':_0x21a82c}:null;}})['then'](respondWithResult(_0x488e03,null))['catch'](handleError(_0x488e03,null));};exports[_0x6326('0x5a')]=function(_0xc626ff,_0x2d81b0,_0x3c2348){var _0x2da14d={};var _0x26929e={};var _0x45560f;var _0x580cdf;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xc626ff[_0x6326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d81b0,null))['then'](function(_0xaea64f){if(_0xaea64f){_0x45560f=_0xaea64f;_0x26929e[_0x6326('0x3f')]=_['keys'](db[_0x6326('0x57')]['rawAttributes']);_0x26929e['query']=_[_0x6326('0x3b')](_0xc626ff[_0x6326('0x3c')]);_0x26929e['filters']=_['intersection'](_0x26929e[_0x6326('0x3f')],_0x26929e[_0x6326('0x3c')]);_0x2da14d[_0x6326('0x40')]=_[_0x6326('0x3e')](_0x26929e['model'],qs['fields'](_0xc626ff[_0x6326('0x3c')][_0x6326('0x50')]));_0x2da14d[_0x6326('0x40')]=_0x2da14d[_0x6326('0x40')][_0x6326('0x41')]?_0x2da14d[_0x6326('0x40')]:_0x26929e[_0x6326('0x3f')];_0x2da14d[_0x6326('0x44')]=qs['sort'](_0xc626ff[_0x6326('0x3c')]['sort']);_0x2da14d[_0x6326('0x46')]=qs[_0x6326('0x3d')](_[_0x6326('0x47')](_0xc626ff[_0x6326('0x3c')],_0x26929e[_0x6326('0x3d')]));if(_0xc626ff[_0x6326('0x3c')]['filter']){_0x2da14d[_0x6326('0x46')]=_[_0x6326('0x48')](_0x2da14d['where'],{'$or':_[_0x6326('0x36')](_0x2da14d[_0x6326('0x40')],function(_0x3104c5){var _0x2a0c01={};_0x2a0c01[_0x3104c5]={'$like':'%'+_0xc626ff[_0x6326('0x3c')][_0x6326('0x4a')]+'%'};return _0x2a0c01;})});}_0x2da14d=_[_0x6326('0x48')]({},_0x2da14d,_0xc626ff['options']);return _0x45560f[_0x6326('0x5a')](_0x2da14d);}})[_0x6326('0x32')](function(_0x458a7e){if(_0x458a7e){_0x580cdf=_0x458a7e[_0x6326('0x41')];if(!_0xc626ff[_0x6326('0x3c')]['hasOwnProperty'](_0x6326('0x43'))){_0x2da14d[_0x6326('0x2f')]=qs['limit'](_0xc626ff[_0x6326('0x3c')][_0x6326('0x2f')]);_0x2da14d[_0x6326('0x2e')]=qs[_0x6326('0x2e')](_0xc626ff[_0x6326('0x3c')][_0x6326('0x2e')]);}return _0x45560f[_0x6326('0x5a')](_0x2da14d);}})[_0x6326('0x32')](function(_0x4c1b0e){if(_0x4c1b0e){return _0x4c1b0e?{'count':_0x580cdf,'rows':_0x4c1b0e}:null;}})[_0x6326('0x32')](respondWithResult(_0x2d81b0,null))[_0x6326('0x28')](handleError(_0x2d81b0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c2fc107..6f93384 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 _0x2015=['api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2015,0x193));var _0x5201=function(_0x113159,_0x30fed9){_0x113159=_0x113159-0x0;var _0x42107a=_0x2015[_0x113159];return _0x42107a;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var logger=require(_0x5201('0x2'))(_0x5201('0x3'));var moment=require(_0x5201('0x4'));var BPromise=require(_0x5201('0x5'));var rp=require(_0x5201('0x6'));var fs=require('fs');var path=require(_0x5201('0x7'));var rimraf=require('rimraf');var config=require(_0x5201('0x8'));var attributes=require(_0x5201('0x9'));module[_0x5201('0xa')]=function(_0x10e33b,_0xf013a){return _0x10e33b[_0x5201('0xb')](_0x5201('0xc'),attributes,{'tableName':_0x5201('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd945=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations'];(function(_0x25d578,_0x1b9919){var _0x5d2338=function(_0x1853a3){while(--_0x1853a3){_0x25d578['push'](_0x25d578['shift']());}};_0x5d2338(++_0x1b9919);}(_0xd945,0x84));var _0x5d94=function(_0x57c198,_0x5523b5){_0x57c198=_0x57c198-0x0;var _0x5d75d7=_0xd945[_0x57c198];return _0x5d75d7;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var logger=require(_0x5d94('0x2'))('api');var moment=require(_0x5d94('0x3'));var BPromise=require(_0x5d94('0x4'));var rp=require(_0x5d94('0x5'));var fs=require('fs');var path=require(_0x5d94('0x6'));var rimraf=require(_0x5d94('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d94('0x8'));module[_0x5d94('0x9')]=function(_0x30b667,_0x3056d3){return _0x30b667[_0x5d94('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x5d94('0xb'),'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 c5988c8..43bbd18 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 _0x41f1=['rpc','../../config/environment','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x41f1,0x120));var _0x141f=function(_0xff6ae1,_0x5c13e2){_0xff6ae1=_0xff6ae1-0x0;var _0x389fa2=_0x41f1[_0xff6ae1];return _0x389fa2;};'use strict';var _=require(_0x141f('0x0'));var util=require('util');var moment=require(_0x141f('0x1'));var BPromise=require(_0x141f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x141f('0x3'));var db=require(_0x141f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x141f('0x5'))(_0x141f('0x6'));var config=require(_0x141f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x141f('0x8')][_0x141f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467088,_0x2a3b55,_0x3967b3){return new BPromise(function(_0x567cc8,_0x20c93a){return client['request'](_0x467088,_0x3967b3)[_0x141f('0xa')](function(_0x2f5afe){logger[_0x141f('0xb')](_0x141f('0xc'),_0x2a3b55,'request\x20sent');logger[_0x141f('0xd')](_0x141f('0xe'),_0x2a3b55,_0x141f('0xf'),JSON['stringify'](_0x2f5afe));if(_0x2f5afe['error']){if(_0x2f5afe[_0x141f('0x10')][_0x141f('0x11')]===0x1f4){logger['error'](_0x141f('0xc'),_0x2a3b55,_0x2f5afe[_0x141f('0x10')][_0x141f('0x12')]);return _0x20c93a(_0x2f5afe[_0x141f('0x10')][_0x141f('0x12')]);}logger['error'](_0x141f('0xc'),_0x2a3b55,_0x2f5afe[_0x141f('0x10')][_0x141f('0x12')]);return _0x567cc8(_0x2f5afe[_0x141f('0x10')][_0x141f('0x12')]);}else{logger[_0x141f('0xb')](_0x141f('0xc'),_0x2a3b55,_0x141f('0xf'));_0x567cc8(_0x2f5afe[_0x141f('0x13')][_0x141f('0x12')]);}})[_0x141f('0x14')](function(_0x377d30){logger[_0x141f('0x10')](_0x141f('0xc'),_0x2a3b55,_0x377d30);_0x20c93a(_0x377d30);});});} \ No newline at end of file +var _0xca20=['request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x571428,_0x1f4d30){var _0x5df406=function(_0xf32358){while(--_0xf32358){_0x571428['push'](_0x571428['shift']());}};_0x5df406(++_0x1f4d30);}(_0xca20,0xa5));var _0x0ca2=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0xca20[_0x112e2a];return _0x4f8af9;};'use strict';var _=require(_0x0ca2('0x0'));var util=require(_0x0ca2('0x1'));var moment=require(_0x0ca2('0x2'));var BPromise=require(_0x0ca2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ca2('0x4'));var db=require(_0x0ca2('0x5'))['db'];var utils=require(_0x0ca2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ca2('0x7'));var jayson=require(_0x0ca2('0x8'));var client=jayson[_0x0ca2('0x9')][_0x0ca2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b55c3,_0x46a2b2,_0x2da9a4){return new BPromise(function(_0x20fc50,_0x5e9e90){return client[_0x0ca2('0xb')](_0x4b55c3,_0x2da9a4)[_0x0ca2('0xc')](function(_0x86bb1a){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x46a2b2,_0x0ca2('0xd'));logger[_0x0ca2('0xe')](_0x0ca2('0xf'),_0x46a2b2,_0x0ca2('0xd'),JSON[_0x0ca2('0x10')](_0x86bb1a));if(_0x86bb1a[_0x0ca2('0x11')]){if(_0x86bb1a['error'][_0x0ca2('0x12')]===0x1f4){logger[_0x0ca2('0x11')](_0x0ca2('0x13'),_0x46a2b2,_0x86bb1a[_0x0ca2('0x11')]['message']);return _0x5e9e90(_0x86bb1a['error'][_0x0ca2('0x14')]);}logger[_0x0ca2('0x11')](_0x0ca2('0x13'),_0x46a2b2,_0x86bb1a[_0x0ca2('0x11')][_0x0ca2('0x14')]);return _0x20fc50(_0x86bb1a[_0x0ca2('0x11')][_0x0ca2('0x14')]);}else{logger['info'](_0x0ca2('0x13'),_0x46a2b2,_0x0ca2('0xd'));_0x20fc50(_0x86bb1a['result']['message']);}})[_0x0ca2('0x15')](function(_0x15e757){logger['error'](_0x0ca2('0x13'),_0x46a2b2,_0x15e757);_0x5e9e90(_0x15e757);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 46d9646..5b1fc7e 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 _0xb41d=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','show','create','put','/:id'];(function(_0x4eae87,_0x2f46ce){var _0x4f8c9e=function(_0x55db90){while(--_0x55db90){_0x4eae87['push'](_0x4eae87['shift']());}};_0x4f8c9e(++_0x2f46ce);}(_0xb41d,0x1de));var _0xdb41=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb41d[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xdb41('0x0'));var util=require(_0xdb41('0x1'));var path=require(_0xdb41('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb41('0x3'));var router=express[_0xdb41('0x4')]();var auth=require(_0xdb41('0x5'));var interaction=require(_0xdb41('0x6'));var config=require(_0xdb41('0x7'));var controller=require(_0xdb41('0x8'));router[_0xdb41('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb41('0xa')]);router[_0xdb41('0x9')]('/:id',auth[_0xdb41('0xb')](),controller[_0xdb41('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdb41('0xd')]);router[_0xdb41('0xe')](_0xdb41('0xf'),auth[_0xdb41('0xb')](),controller['update']);router[_0xdb41('0x10')](_0xdb41('0xf'),auth['isAuthenticated'](),controller[_0xdb41('0x11')]);module[_0xdb41('0x12')]=router; \ No newline at end of file +var _0x3de1=['create','put','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2e31a3,_0x3535ab){var _0x4bea6c=function(_0x230d31){while(--_0x230d31){_0x2e31a3['push'](_0x2e31a3['shift']());}};_0x4bea6c(++_0x3535ab);}(_0x3de1,0xe0));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x13de('0x0'));var util=require(_0x13de('0x1'));var path=require(_0x13de('0x2'));var timeout=require(_0x13de('0x3'));var express=require(_0x13de('0x4'));var router=express[_0x13de('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x13de('0x6'));var config=require('../../config/environment');var controller=require(_0x13de('0x7'));router[_0x13de('0x8')]('/',auth[_0x13de('0x9')](),controller[_0x13de('0xa')]);router[_0x13de('0x8')](_0x13de('0xb'),auth[_0x13de('0x9')](),controller[_0x13de('0xc')]);router[_0x13de('0xd')]('/',auth[_0x13de('0x9')](),controller[_0x13de('0xe')]);router[_0x13de('0xf')](_0x13de('0xb'),auth[_0x13de('0x9')](),controller['update']);router[_0x13de('0x10')](_0x13de('0xb'),auth['isAuthenticated'](),controller['destroy']);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 6658547..d6481b2 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 _0xf492=['string','keyValue','STRING','customVariable','sequelize','ENUM'];(function(_0x184129,_0x515b80){var _0x4441e5=function(_0x79ccf3){while(--_0x79ccf3){_0x184129['push'](_0x184129['shift']());}};_0x4441e5(++_0x515b80);}(_0xf492,0xb2));var _0x2f49=function(_0xe635aa,_0xb2db1c){_0xe635aa=_0xe635aa-0x0;var _0x203c0e=_0xf492[_0xe635aa];return _0x203c0e;};'use strict';var Sequelize=require(_0x2f49('0x0'));module['exports']={'type':{'type':Sequelize[_0x2f49('0x1')](_0x2f49('0x2'),'variable','customVariable',_0x2f49('0x3')),'defaultValue':_0x2f49('0x2')},'content':{'type':Sequelize[_0x2f49('0x4')]},'key':{'type':Sequelize[_0x2f49('0x4')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x2f49('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2f49('0x4')]},'nameField':{'type':Sequelize[_0x2f49('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f49('0x4')]}}; \ No newline at end of file +var _0x3d11=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x4c09d6,_0x3ddb94){var _0x40627f=function(_0x4495df){while(--_0x4495df){_0x4c09d6['push'](_0x4c09d6['shift']());}};_0x40627f(++_0x3ddb94);}(_0x3d11,0x105));var _0x13d1=function(_0x1cfadd,_0x378b48){_0x1cfadd=_0x1cfadd-0x0;var _0x2ae494=_0x3d11[_0x1cfadd];return _0x2ae494;};'use strict';var Sequelize=require(_0x13d1('0x0'));module[_0x13d1('0x1')]={'type':{'type':Sequelize[_0x13d1('0x2')](_0x13d1('0x3'),_0x13d1('0x4'),_0x13d1('0x5'),_0x13d1('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x13d1('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x13d1('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x13d1('0x7')]},'nameField':{'type':Sequelize[_0x13d1('0x7')]},'customField':{'type':Sequelize[_0x13d1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x13d1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0632aa9..7a52885 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(_0x94ae20,_0x1799f2){var _0x5edd9f=function(_0x5ad310){while(--_0x5ad310){_0x94ae20['push'](_0x94ae20['shift']());}};_0x5edd9f(++_0x1799f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x2041f7,_0x49509d){var _0x3fbc1b=function(_0x34c3a4){while(--_0x34c3a4){_0x2041f7['push'](_0x2041f7['shift']());}};_0x3fbc1b(++_0x49509d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 680667c..0a0ec1d 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 _0x6612=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x250dad,_0x352a8c){var _0xb2de6a=function(_0x36fd28){while(--_0x36fd28){_0x250dad['push'](_0x250dad['shift']());}};_0xb2de6a(++_0x352a8c);}(_0x6612,0x1f4));var _0x2661=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x6612[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x2661('0x0'));var util=require(_0x2661('0x1'));var logger=require('../../config/logger')(_0x2661('0x2'));var moment=require(_0x2661('0x3'));var BPromise=require(_0x2661('0x4'));var rp=require(_0x2661('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2661('0x6'));var config=require(_0x2661('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x2661('0x8')]=function(_0x26e944,_0x249390){return _0x26e944[_0x2661('0x9')](_0x2661('0xa'),attributes,{'tableName':_0x2661('0xb'),'paranoid':![],'indexes':[{'name':_0x2661('0xc'),'fields':[_0x2661('0xd'),_0x2661('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbee5=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1b54e1,_0x52acd8){var _0x289d2c=function(_0x568200){while(--_0x568200){_0x1b54e1['push'](_0x1b54e1['shift']());}};_0x289d2c(++_0x52acd8);}(_0xbee5,0x65));var _0x5bee=function(_0x4caf7b,_0x268fc4){_0x4caf7b=_0x4caf7b-0x0;var _0x4fbfc9=_0xbee5[_0x4caf7b];return _0x4fbfc9;};'use strict';var _=require(_0x5bee('0x0'));var util=require(_0x5bee('0x1'));var logger=require('../../config/logger')(_0x5bee('0x2'));var moment=require(_0x5bee('0x3'));var BPromise=require(_0x5bee('0x4'));var rp=require(_0x5bee('0x5'));var fs=require('fs');var path=require(_0x5bee('0x6'));var rimraf=require(_0x5bee('0x7'));var config=require(_0x5bee('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x5bee('0x9')]=function(_0x23b5df,_0x55af7d){return _0x23b5df[_0x5bee('0xa')](_0x5bee('0xb'),attributes,{'tableName':_0x5bee('0xc'),'paranoid':![],'indexes':[{'name':_0x5bee('0xd'),'fields':[_0x5bee('0xe'),_0x5bee('0xf')],'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 fc0dbc2..868fffe 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 _0x5af3=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5076e4,_0x1b2ad1){var _0x2e3ff9=function(_0x39b1f5){while(--_0x39b1f5){_0x5076e4['push'](_0x5076e4['shift']());}};_0x2e3ff9(++_0x1b2ad1);}(_0x5af3,0x1bb));var _0x35af=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x5af3[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x35af('0x0'));var util=require(_0x35af('0x1'));var moment=require('moment');var BPromise=require(_0x35af('0x2'));var rs=require(_0x35af('0x3'));var fs=require('fs');var Redis=require(_0x35af('0x4'));var db=require(_0x35af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x35af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x35af('0x7'));var client=jayson[_0x35af('0x8')][_0x35af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21227e,_0x374795,_0x48c490){return new BPromise(function(_0x569303,_0x1825ed){return client[_0x35af('0xa')](_0x21227e,_0x48c490)['then'](function(_0x753de){logger[_0x35af('0xb')](_0x35af('0xc'),_0x374795,_0x35af('0xd'));logger[_0x35af('0xe')](_0x35af('0xf'),_0x374795,'request\x20sent',JSON['stringify'](_0x753de));if(_0x753de[_0x35af('0x10')]){if(_0x753de[_0x35af('0x10')]['code']===0x1f4){logger[_0x35af('0x10')](_0x35af('0xc'),_0x374795,_0x753de[_0x35af('0x10')]['message']);return _0x1825ed(_0x753de[_0x35af('0x10')][_0x35af('0x11')]);}logger[_0x35af('0x10')]('ServicenowField,\x20%s,\x20%s',_0x374795,_0x753de[_0x35af('0x10')][_0x35af('0x11')]);return _0x569303(_0x753de['error']['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x374795,_0x35af('0xd'));_0x569303(_0x753de[_0x35af('0x12')][_0x35af('0x11')]);}})[_0x35af('0x13')](function(_0x50dd7c){logger['error'](_0x35af('0xc'),_0x374795,_0x50dd7c);_0x1825ed(_0x50dd7c);});});} \ No newline at end of file +var _0xf4cb=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowField,\x20%s,\x20%s','debug'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf4cb,0x17c));var _0xbf4c=function(_0x300179,_0x239640){_0x300179=_0x300179-0x0;var _0x3e5eb1=_0xf4cb[_0x300179];return _0x3e5eb1;};'use strict';var _=require(_0xbf4c('0x0'));var util=require(_0xbf4c('0x1'));var moment=require(_0xbf4c('0x2'));var BPromise=require(_0xbf4c('0x3'));var rs=require(_0xbf4c('0x4'));var fs=require('fs');var Redis=require(_0xbf4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf4c('0x6'));var logger=require(_0xbf4c('0x7'))('rpc');var config=require(_0xbf4c('0x8'));var jayson=require(_0xbf4c('0x9'));var client=jayson['client'][_0xbf4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d38d1,_0x82dd7e,_0x4e685f){return new BPromise(function(_0x2e377f,_0x45096b){return client[_0xbf4c('0xb')](_0x2d38d1,_0x4e685f)[_0xbf4c('0xc')](function(_0x254816){logger[_0xbf4c('0xd')](_0xbf4c('0xe'),_0x82dd7e,'request\x20sent');logger[_0xbf4c('0xf')](_0xbf4c('0x10'),_0x82dd7e,_0xbf4c('0x11'),JSON[_0xbf4c('0x12')](_0x254816));if(_0x254816['error']){if(_0x254816[_0xbf4c('0x13')]['code']===0x1f4){logger[_0xbf4c('0x13')](_0xbf4c('0xe'),_0x82dd7e,_0x254816[_0xbf4c('0x13')][_0xbf4c('0x14')]);return _0x45096b(_0x254816['error'][_0xbf4c('0x14')]);}logger['error'](_0xbf4c('0xe'),_0x82dd7e,_0x254816[_0xbf4c('0x13')][_0xbf4c('0x14')]);return _0x2e377f(_0x254816[_0xbf4c('0x13')]['message']);}else{logger[_0xbf4c('0xd')](_0xbf4c('0xe'),_0x82dd7e,_0xbf4c('0x11'));_0x2e377f(_0x254816['result']['message']);}})[_0xbf4c('0x15')](function(_0x1dcad0){logger['error'](_0xbf4c('0xe'),_0x82dd7e,_0x1dcad0);_0x45096b(_0x1dcad0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 215399e..25d8f2c 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 _0x803b=['index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller'];(function(_0x444958,_0x2fc23c){var _0x36403e=function(_0x46935d){while(--_0x46935d){_0x444958['push'](_0x444958['shift']());}};_0x36403e(++_0x2fc23c);}(_0x803b,0x130));var _0xb803=function(_0x224b70,_0x370d73){_0x224b70=_0x224b70-0x0;var _0x2b0573=_0x803b[_0x224b70];return _0x2b0573;};'use strict';var multer=require(_0xb803('0x0'));var util=require('util');var path=require(_0xb803('0x1'));var timeout=require('connect-timeout');var express=require(_0xb803('0x2'));var router=express[_0xb803('0x3')]();var auth=require(_0xb803('0x4'));var interaction=require(_0xb803('0x5'));var config=require(_0xb803('0x6'));var controller=require(_0xb803('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb803('0x8')]);router['get'](_0xb803('0x9'),auth[_0xb803('0xa')](),controller[_0xb803('0xb')]);router[_0xb803('0xc')](_0xb803('0xd'),auth[_0xb803('0xa')](),controller[_0xb803('0xe')]);router[_0xb803('0xc')](_0xb803('0xf'),auth[_0xb803('0xa')](),controller[_0xb803('0x10')]);router[_0xb803('0x11')]('/',auth['isAuthenticated'](),controller[_0xb803('0x12')]);router[_0xb803('0x11')](_0xb803('0xd'),auth[_0xb803('0xa')](),controller[_0xb803('0x13')]);router['put']('/:id',auth[_0xb803('0xa')](),controller[_0xb803('0x14')]);router[_0xb803('0x15')](_0xb803('0x9'),auth['isAuthenticated'](),controller[_0xb803('0x16')]);module[_0xb803('0x17')]=router; \ No newline at end of file +var _0xebe5=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete'];(function(_0x1130b6,_0x4cc4c8){var _0x20e3d4=function(_0x443d50){while(--_0x443d50){_0x1130b6['push'](_0x1130b6['shift']());}};_0x20e3d4(++_0x4cc4c8);}(_0xebe5,0xb2));var _0x5ebe=function(_0x2081e4,_0x1731cf){_0x2081e4=_0x2081e4-0x0;var _0x459bd0=_0xebe5[_0x2081e4];return _0x459bd0;};'use strict';var multer=require(_0x5ebe('0x0'));var util=require(_0x5ebe('0x1'));var path=require('path');var timeout=require(_0x5ebe('0x2'));var express=require(_0x5ebe('0x3'));var router=express['Router']();var auth=require(_0x5ebe('0x4'));var interaction=require(_0x5ebe('0x5'));var config=require('../../config/environment');var controller=require(_0x5ebe('0x6'));router['get']('/',auth[_0x5ebe('0x7')](),controller[_0x5ebe('0x8')]);router[_0x5ebe('0x9')](_0x5ebe('0xa'),auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xb')]);router[_0x5ebe('0x9')](_0x5ebe('0xc'),auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xd')]);router[_0x5ebe('0x9')](_0x5ebe('0xe'),auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xf')]);router[_0x5ebe('0x10')]('/',auth[_0x5ebe('0x7')](),controller['create']);router[_0x5ebe('0x10')](_0x5ebe('0xc'),auth[_0x5ebe('0x7')](),controller['addConfiguration']);router[_0x5ebe('0x11')](_0x5ebe('0xa'),auth[_0x5ebe('0x7')](),controller[_0x5ebe('0x12')]);router[_0x5ebe('0x13')](_0x5ebe('0xa'),auth['isAuthenticated'](),controller[_0x5ebe('0x14')]);module[_0x5ebe('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 9ddd4b1..a98c5ea 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 _0x824c=['remoteUri','STRING','username'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x824c,0x1b7));var _0xc824=function(_0x54ed3b,_0x1a1ee6){_0x54ed3b=_0x54ed3b-0x0;var _0x4314f6=_0x824c[_0x54ed3b];return _0x4314f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc824('0x0')]},'description':{'type':Sequelize[_0xc824('0x0')]},'username':{'type':Sequelize[_0xc824('0x0')],'unique':_0xc824('0x1')},'password':{'type':Sequelize[_0xc824('0x0')]},'remoteUri':{'type':Sequelize[_0xc824('0x0')],'unique':_0xc824('0x2')},'serverUrl':{'type':Sequelize[_0xc824('0x0')]}}; \ No newline at end of file +var _0xdf1e=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0xdf1e,0x19a));var _0xedf1=function(_0x319bcb,_0x4ca579){_0x319bcb=_0x319bcb-0x0;var _0x4199ed=_0xdf1e[_0x319bcb];return _0x4199ed;};'use strict';var Sequelize=require(_0xedf1('0x0'));module[_0xedf1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xedf1('0x2')]},'username':{'type':Sequelize[_0xedf1('0x2')],'unique':_0xedf1('0x3')},'password':{'type':Sequelize[_0xedf1('0x2')]},'remoteUri':{'type':Sequelize[_0xedf1('0x2')],'unique':_0xedf1('0x4')},'serverUrl':{'type':Sequelize[_0xedf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 9a5af22..a1fe253 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 _0xfad1=['sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','update','findOne','SugarcrmConfiguration','getConfigurations','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','username','password','remoteUri','substring','POST','format','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','getFields,\x20%s,\x20%s,\x20%s','send','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x1f47c6,_0x159601){var _0x7e306d=function(_0x493246){while(--_0x493246){_0x1f47c6['push'](_0x1f47c6['shift']());}};_0x7e306d(++_0x159601);}(_0xfad1,0xb9));var _0x1fad=function(_0x28f2ec,_0x2e2184){_0x28f2ec=_0x28f2ec-0x0;var _0xfbdd69=_0xfad1[_0x28f2ec];return _0xfbdd69;};'use strict';var pdf=require(_0x1fad('0x0'));var emlformat=require(_0x1fad('0x1'));var rimraf=require(_0x1fad('0x2'));var zipdir=require(_0x1fad('0x3'));var jsonpatch=require(_0x1fad('0x4'));var rp=require(_0x1fad('0x5'));var moment=require(_0x1fad('0x6'));var BPromise=require(_0x1fad('0x7'));var Mustache=require('mustache');var util=require(_0x1fad('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1fad('0x9'));var ejs=require(_0x1fad('0xa'));var fs=require('fs');var _=require(_0x1fad('0xb'));var squel=require('squel');var crypto=require(_0x1fad('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1fad('0xd'));var toCsv=require(_0x1fad('0x9'));var querystring=require(_0x1fad('0xe'));var Papa=require('papaparse');var Redis=require(_0x1fad('0xf'));var authService=require(_0x1fad('0x10'));var qs=require(_0x1fad('0x11'));var as=require(_0x1fad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fad('0x13'))(_0x1fad('0x14'));var utils=require(_0x1fad('0x15'));var config=require(_0x1fad('0x16'));var db=require(_0x1fad('0x17'))['db'];var integrations=require(_0x1fad('0x18'));var jayson=require(_0x1fad('0x19'));var client=jayson[_0x1fad('0x1a')][_0x1fad('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1266c3,_0x32e625,_0x2bb3c6){if(_0x2bb3c6){var _0x4b5f92=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b5f92['test'](_0x32e625)){return _0x1266c3;}else{throw new db[(_0x1fad('0x1c'))][(_0x1fad('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 _0x1266c3;}}function respondWithRpcPromise(_0x389799,_0x1d9b4d,_0xba7b52,_0x5792ac){return new BPromise(function(_0x2cc9fe,_0x81e95a){var _0x649022=_0x5792ac||client;return _0x649022['request'](_0x389799,_0xba7b52)['then'](function(_0x178f34){logger[_0x1fad('0x1e')](_0x1fad('0x1f'),_0x1d9b4d,'request\x20sent');logger[_0x1fad('0x20')](_0x1fad('0x21'),_0x1d9b4d,_0x1fad('0x22'),JSON[_0x1fad('0x23')](_0x178f34));if(_0x178f34['error']){if(_0x178f34[_0x1fad('0x24')]['code']===0x1f4){logger[_0x1fad('0x24')](_0x1fad('0x1f'),_0x1d9b4d,_0x178f34[_0x1fad('0x24')][_0x1fad('0x25')]);return _0x81e95a(_0x178f34[_0x1fad('0x24')][_0x1fad('0x25')]);}logger[_0x1fad('0x24')](_0x1fad('0x1f'),_0x1d9b4d,_0x178f34[_0x1fad('0x24')][_0x1fad('0x25')]);return _0x2cc9fe(_0x178f34[_0x1fad('0x24')][_0x1fad('0x25')]);}else{logger[_0x1fad('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x1d9b4d,_0x1fad('0x22'));_0x2cc9fe(_0x178f34[_0x1fad('0x26')][_0x1fad('0x25')]);}})[_0x1fad('0x27')](function(_0x2892fc){logger[_0x1fad('0x24')](_0x1fad('0x1f'),_0x1d9b4d,_0x2892fc);_0x81e95a(_0x2892fc);});});}function respondWithStatusCode(_0x4d1167,_0x594f97){_0x594f97=_0x594f97||0xcc;return function(_0x277fa9){if(_0x277fa9){return _0x4d1167[_0x1fad('0x28')](_0x594f97);}return _0x4d1167[_0x1fad('0x29')](_0x594f97)[_0x1fad('0x2a')]();};}function respondWithResult(_0x2b5220,_0x3d7707){_0x3d7707=_0x3d7707||0xc8;return function(_0x22adbc){if(_0x22adbc){return _0x2b5220['status'](_0x3d7707)[_0x1fad('0x2b')](_0x22adbc);}};}function respondWithFilteredResult(_0x2df30c,_0x1a39fe){return function(_0x32d06f){if(_0x32d06f){var _0x5890ef=_0x32d06f[_0x1fad('0x2c')],_0x5358c4=_0x1a39fe[_0x1fad('0x2d')],_0x5c7890=_0x1a39fe[_0x1fad('0x2d')]+_0x1a39fe[_0x1fad('0x2e')],_0xe8d50f;if(_0x5c7890>=_0x5890ef){_0x5c7890=_0x5890ef;_0xe8d50f=0xc8;}else{_0xe8d50f=0xce;}_0x2df30c[_0x1fad('0x29')](_0xe8d50f);return _0x2df30c[_0x1fad('0x2f')](_0x1fad('0x30'),_0x5358c4+'-'+_0x5c7890+'/'+_0x5890ef)[_0x1fad('0x2b')](_0x32d06f);}return null;};}function patchUpdates(_0x1a3ad4){return function(_0x35be29){try{jsonpatch['apply'](_0x35be29,_0x1a3ad4,!![]);}catch(_0x55541b){return BPromise[_0x1fad('0x31')](_0x55541b);}return _0x35be29[_0x1fad('0x32')]();};}function saveUpdates(_0x448d8f,_0x597ffb){return function(_0x4fb4c5){if(_0x4fb4c5){return _0x4fb4c5['update'](_0x448d8f)[_0x1fad('0x33')](function(_0xb93063){return _0xb93063;});}return null;};}function removeEntity(_0x4d6daf,_0x409fbc){return function(_0x5a81e7){if(_0x5a81e7){return _0x5a81e7[_0x1fad('0x34')]()['then'](function(){_0x4d6daf['status'](0xcc)[_0x1fad('0x2a')]();});}};}function handleEntityNotFound(_0x588da5,_0x4a7563){return function(_0xf8c3e3){if(!_0xf8c3e3){_0x588da5[_0x1fad('0x28')](0x194);}return _0xf8c3e3;};}function handleError(_0x5c1d4c,_0x421eb9){_0x421eb9=_0x421eb9||0x1f4;return function(_0xa39509){logger[_0x1fad('0x24')](_0xa39509['stack']);if(_0xa39509[_0x1fad('0x35')]){delete _0xa39509[_0x1fad('0x35')];}_0x5c1d4c[_0x1fad('0x29')](_0x421eb9)['send'](_0xa39509);};}exports[_0x1fad('0x36')]=function(_0x5e6d06,_0x254c8b){var _0x57c1c6={},_0x52efe5={},_0x4bb5da={'count':0x0,'rows':[]};var _0x3d072c=_[_0x1fad('0x37')](db[_0x1fad('0x38')][_0x1fad('0x39')],function(_0x530936){return{'name':_0x530936[_0x1fad('0x3a')],'type':_0x530936['type'][_0x1fad('0x3b')]};});_0x52efe5['model']=_['map'](_0x3d072c,_0x1fad('0x35'));_0x52efe5['query']=_[_0x1fad('0x3c')](_0x5e6d06['query']);_0x52efe5[_0x1fad('0x3d')]=_[_0x1fad('0x3e')](_0x52efe5[_0x1fad('0x3f')],_0x52efe5[_0x1fad('0x40')]);_0x57c1c6['attributes']=_[_0x1fad('0x3e')](_0x52efe5[_0x1fad('0x3f')],qs[_0x1fad('0x41')](_0x5e6d06[_0x1fad('0x40')]['fields']));_0x57c1c6[_0x1fad('0x42')]=_0x57c1c6[_0x1fad('0x42')][_0x1fad('0x43')]?_0x57c1c6[_0x1fad('0x42')]:_0x52efe5[_0x1fad('0x3f')];if(!_0x5e6d06['query'][_0x1fad('0x44')](_0x1fad('0x45'))){_0x57c1c6[_0x1fad('0x2e')]=qs['limit'](_0x5e6d06['query'][_0x1fad('0x2e')]);_0x57c1c6['offset']=qs[_0x1fad('0x2d')](_0x5e6d06['query']['offset']);}_0x57c1c6[_0x1fad('0x46')]=qs[_0x1fad('0x47')](_0x5e6d06[_0x1fad('0x40')]['sort']);_0x57c1c6[_0x1fad('0x48')]=qs[_0x1fad('0x3d')](_[_0x1fad('0x49')](_0x5e6d06['query'],_0x52efe5[_0x1fad('0x3d')]),_0x3d072c);if(_0x5e6d06[_0x1fad('0x40')]['filter']){_0x57c1c6[_0x1fad('0x48')]=_['merge'](_0x57c1c6[_0x1fad('0x48')],{'$or':_['map'](_0x3d072c,function(_0x1252ce){if(_0x1252ce[_0x1fad('0x4a')]!==_0x1fad('0x4b')){var _0x26f0aa={};_0x26f0aa[_0x1252ce[_0x1fad('0x35')]]={'$like':'%'+_0x5e6d06['query'][_0x1fad('0x4c')]+'%'};return _0x26f0aa;}})});}_0x57c1c6=_['merge']({},_0x57c1c6,_0x5e6d06[_0x1fad('0x4d')]);var _0xf333eb={'where':_0x57c1c6[_0x1fad('0x48')]};return db['SugarcrmAccount'][_0x1fad('0x2c')](_0xf333eb)['then'](function(_0x3db20e){_0x4bb5da['count']=_0x3db20e;if(_0x5e6d06[_0x1fad('0x40')][_0x1fad('0x4e')]){_0x57c1c6[_0x1fad('0x4f')]=[{'all':!![]}];}return db[_0x1fad('0x38')][_0x1fad('0x50')](_0x57c1c6);})[_0x1fad('0x33')](function(_0x5d483d){_0x4bb5da[_0x1fad('0x51')]=_0x5d483d;return _0x4bb5da;})[_0x1fad('0x33')](respondWithFilteredResult(_0x254c8b,_0x57c1c6))[_0x1fad('0x27')](handleError(_0x254c8b,null));};exports[_0x1fad('0x52')]=function(_0x299a90,_0x31a3f2){var _0x294778={'raw':![],'where':{'id':_0x299a90[_0x1fad('0x53')]['id']}},_0x37288c={};_0x37288c[_0x1fad('0x3f')]=_[_0x1fad('0x3c')](db[_0x1fad('0x38')]['rawAttributes']);_0x37288c['query']=_[_0x1fad('0x3c')](_0x299a90['query']);_0x37288c[_0x1fad('0x3d')]=_[_0x1fad('0x3e')](_0x37288c[_0x1fad('0x3f')],_0x37288c[_0x1fad('0x40')]);_0x294778['attributes']=_['intersection'](_0x37288c[_0x1fad('0x3f')],qs[_0x1fad('0x41')](_0x299a90[_0x1fad('0x40')][_0x1fad('0x41')]));_0x294778[_0x1fad('0x42')]=_0x294778['attributes'][_0x1fad('0x43')]?_0x294778['attributes']:_0x37288c[_0x1fad('0x3f')];if(_0x299a90[_0x1fad('0x40')][_0x1fad('0x4e')]){_0x294778[_0x1fad('0x4f')]=[{'all':!![]}];}_0x294778=_[_0x1fad('0x54')]({},_0x294778,_0x299a90[_0x1fad('0x4d')]);return db[_0x1fad('0x38')][_0x1fad('0x55')](_0x294778)['then'](handleEntityNotFound(_0x31a3f2,null))[_0x1fad('0x33')](respondWithResult(_0x31a3f2,null))[_0x1fad('0x27')](handleError(_0x31a3f2,null));};exports['create']=function(_0x1b6481,_0x4eddef){return db[_0x1fad('0x38')][_0x1fad('0x56')](_0x1b6481[_0x1fad('0x57')],{})[_0x1fad('0x33')](respondWithResult(_0x4eddef,0xc9))[_0x1fad('0x27')](handleError(_0x4eddef,null));};exports[_0x1fad('0x58')]=function(_0x52bed7,_0x29c35f){if(_0x52bed7[_0x1fad('0x57')]['id']){delete _0x52bed7[_0x1fad('0x57')]['id'];}return db['SugarcrmAccount'][_0x1fad('0x55')]({'where':{'id':_0x52bed7[_0x1fad('0x53')]['id']}})[_0x1fad('0x33')](handleEntityNotFound(_0x29c35f,null))[_0x1fad('0x33')](saveUpdates(_0x52bed7[_0x1fad('0x57')],null))[_0x1fad('0x33')](respondWithResult(_0x29c35f,null))[_0x1fad('0x27')](handleError(_0x29c35f,null));};exports[_0x1fad('0x34')]=function(_0x46d464,_0x4bcf15){return db['SugarcrmAccount'][_0x1fad('0x55')]({'where':{'id':_0x46d464[_0x1fad('0x53')]['id']}})[_0x1fad('0x33')](handleEntityNotFound(_0x4bcf15,null))['then'](removeEntity(_0x4bcf15,null))[_0x1fad('0x27')](handleError(_0x4bcf15,null));};exports['getConfigurations']=function(_0x4d6b75,_0xe46a8f,_0x59d571){var _0x3be4e0={};var _0x41eef5={};var _0x4dc35e;var _0x2d66e4;return db[_0x1fad('0x38')][_0x1fad('0x59')]({'where':{'id':_0x4d6b75['params']['id']}})[_0x1fad('0x33')](handleEntityNotFound(_0xe46a8f,null))[_0x1fad('0x33')](function(_0x515705){if(_0x515705){_0x4dc35e=_0x515705;_0x41eef5[_0x1fad('0x3f')]=_[_0x1fad('0x3c')](db[_0x1fad('0x5a')]['rawAttributes']);_0x41eef5[_0x1fad('0x40')]=_[_0x1fad('0x3c')](_0x4d6b75['query']);_0x41eef5['filters']=_['intersection'](_0x41eef5[_0x1fad('0x3f')],_0x41eef5[_0x1fad('0x40')]);_0x3be4e0['attributes']=_[_0x1fad('0x3e')](_0x41eef5[_0x1fad('0x3f')],qs[_0x1fad('0x41')](_0x4d6b75[_0x1fad('0x40')][_0x1fad('0x41')]));_0x3be4e0[_0x1fad('0x42')]=_0x3be4e0[_0x1fad('0x42')][_0x1fad('0x43')]?_0x3be4e0[_0x1fad('0x42')]:_0x41eef5[_0x1fad('0x3f')];_0x3be4e0[_0x1fad('0x46')]=qs[_0x1fad('0x47')](_0x4d6b75[_0x1fad('0x40')][_0x1fad('0x47')]);_0x3be4e0[_0x1fad('0x48')]=qs['filters'](_['pick'](_0x4d6b75[_0x1fad('0x40')],_0x41eef5[_0x1fad('0x3d')]));if(_0x4d6b75[_0x1fad('0x40')]['filter']){_0x3be4e0[_0x1fad('0x48')]=_[_0x1fad('0x54')](_0x3be4e0[_0x1fad('0x48')],{'$or':_[_0x1fad('0x37')](_0x3be4e0[_0x1fad('0x42')],function(_0x14c4d9){var _0x3a8acd={};_0x3a8acd[_0x14c4d9]={'$like':'%'+_0x4d6b75[_0x1fad('0x40')]['filter']+'%'};return _0x3a8acd;})});}_0x3be4e0=_['merge']({},_0x3be4e0,_0x4d6b75[_0x1fad('0x4d')]);return _0x4dc35e[_0x1fad('0x5b')](_0x3be4e0);}})['then'](function(_0x2b390b){if(_0x2b390b){_0x2d66e4=_0x2b390b[_0x1fad('0x43')];if(!_0x4d6b75[_0x1fad('0x40')][_0x1fad('0x44')](_0x1fad('0x45'))){_0x3be4e0['limit']=qs['limit'](_0x4d6b75['query'][_0x1fad('0x2e')]);_0x3be4e0[_0x1fad('0x2d')]=qs[_0x1fad('0x2d')](_0x4d6b75[_0x1fad('0x40')][_0x1fad('0x2d')]);}return _0x4dc35e['getConfigurations'](_0x3be4e0);}})[_0x1fad('0x33')](function(_0x41f320){if(_0x41f320){return _0x41f320?{'count':_0x2d66e4,'rows':_0x41f320}:null;}})[_0x1fad('0x33')](respondWithResult(_0xe46a8f,null))[_0x1fad('0x27')](handleError(_0xe46a8f,null));};exports['addConfiguration']=function(_0x2b139a,_0x1d7690,_0x30c1fa){if(_0x2b139a[_0x1fad('0x57')]['id']){delete _0x2b139a[_0x1fad('0x57')]['id'];}return db[_0x1fad('0x38')][_0x1fad('0x59')]({'where':{'id':_0x2b139a['params']['id']}})[_0x1fad('0x33')](handleEntityNotFound(_0x1d7690,null))[_0x1fad('0x33')](function(_0x50b8d8){if(_0x50b8d8){_0x2b139a[_0x1fad('0x57')][_0x1fad('0x5c')]=_0x50b8d8['id'];_0x2b139a[_0x1fad('0x57')][_0x1fad('0x5d')]=integrations['getSubjects'](_0x2b139a['body'][_0x1fad('0x5e')],_0x2b139a[_0x1fad('0x57')][_0x1fad('0x4a')]);_0x2b139a[_0x1fad('0x57')]['Descriptions']=integrations[_0x1fad('0x5f')](_0x2b139a[_0x1fad('0x57')][_0x1fad('0x5e')],_0x2b139a[_0x1fad('0x57')]['type']);return db[_0x1fad('0x5a')][_0x1fad('0x56')](_0x2b139a[_0x1fad('0x57')],{'include':[{'model':db[_0x1fad('0x60')],'as':_0x1fad('0x5d')},{'model':db[_0x1fad('0x60')],'as':_0x1fad('0x61')}]});}return null;})[_0x1fad('0x33')](respondWithResult(_0x1d7690,null))[_0x1fad('0x27')](handleError(_0x1d7690,null));};exports[_0x1fad('0x62')]=function(_0x201cf9,_0x5703cd,_0xf2c70d){var _0x3688c7='';var _0x2cab8d=['id',_0x1fad('0x35'),_0x1fad('0x63'),'created_by',_0x1fad('0x64'),_0x1fad('0x65'),_0x1fad('0x66'),'duration_minutes',_0x1fad('0x67'),'parent_type','parent_name','direction'];return db[_0x1fad('0x38')][_0x1fad('0x59')]({'where':{'id':_0x201cf9[_0x1fad('0x53')]['id']},'attributes':['id',_0x1fad('0x68'),_0x1fad('0x69'),_0x1fad('0x6a')]})[_0x1fad('0x33')](handleEntityNotFound(_0x5703cd,null))[_0x1fad('0x33')](function(_0x48a39d){if(_0x48a39d){_0x3688c7=_0x48a39d['remoteUri'];var _0x2db987=_0x3688c7['slice'](-0x1);if(_0x2db987==='/'){_0x3688c7=_0x3688c7[_0x1fad('0x6b')](0x0,_0x3688c7['lastIndexOf'](_0x2db987));}return rp({'method':_0x1fad('0x6c'),'uri':util[_0x1fad('0x6d')]('%s%s',_0x3688c7,_0x1fad('0x6e')),'json':!![],'form':{'method':'login','input_type':_0x1fad('0x6f'),'response_type':_0x1fad('0x6f'),'rest_data':JSON[_0x1fad('0x23')]({'user_auth':{'user_name':_0x48a39d['username'],'password':_0x48a39d[_0x1fad('0x69')],'encryption':_0x1fad('0x70')},'application':_0x1fad('0x71')})}});}})[_0x1fad('0x33')](function(_0xef08d){if(_0xef08d&&_0xef08d[_0x1fad('0x35')]!=='Invalid\x20Login'&&_0xef08d['name']!==_0x1fad('0x72')){return rp({'method':_0x1fad('0x6c'),'uri':util['format'](_0x1fad('0x73'),_0x3688c7,_0x1fad('0x6e')),'json':!![],'form':{'method':_0x1fad('0x74'),'input_type':_0x1fad('0x6f'),'response_type':_0x1fad('0x6f'),'rest_data':JSON[_0x1fad('0x23')]({'session':_0xef08d['id'],'module_name':_0x1fad('0x75')})}})[_0x1fad('0x33')](function(_0x5eea8c){if(_0x5eea8c){var _0x150960=_['values'](_0x5eea8c[_0x1fad('0x76')]);_[_0x1fad('0x77')](_0x150960,function(_0x42d6c7){return _0x2cab8d[_0x1fad('0x78')](_0x42d6c7[_0x1fad('0x35')]);});return{'count':_0x150960[_0x1fad('0x43')],'rows':_['map'](_0x150960,function(_0x27fc3a){return{'id':_0x27fc3a[_0x1fad('0x35')],'name':_0x27fc3a[_0x1fad('0x79')],'custom':_[_0x1fad('0x7a')](_0x27fc3a[_0x1fad('0x35')],'_c')?!![]:![],'options':_0x27fc3a[_0x1fad('0x4d')]?_[_0x1fad('0x37')](_[_0x1fad('0x7b')](_0x27fc3a['options']),function(_0x3af8f6){return{'name':_0x3af8f6[_0x1fad('0x7c')],'value':_0x3af8f6[_0x1fad('0x35')]};}):[]};})};}})[_0x1fad('0x33')](respondWithResult(_0x5703cd,null))[_0x1fad('0x27')](function(_0x465294){var _0x1b7d5e=_0x201cf9[_0x1fad('0x40')]['test']?0x1f4:_0x465294['statusCode']||0x1f4;logger[_0x1fad('0x24')](_0x1fad('0x7d'),'getFields',_0x1b7d5e,JSON[_0x1fad('0x23')](_0x465294));delete _0x465294[_0x1fad('0x35')];if(_0x1b7d5e===0x191){_0x1b7d5e=0x190;}_0x5703cd[_0x1fad('0x29')](_0x1b7d5e)[_0x1fad('0x7e')](_0x201cf9[_0x1fad('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x465294[_0x1fad('0x7f')]}:_0x465294);});}else{var _0x42e4fd=0x1f4;_0x5703cd['status'](_0x42e4fd)[_0x1fad('0x7e')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x7d87=['debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','set','Content-Range','apply','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','offset','order','sort','where','merge','filter','options','SugarcrmAccount','findAll','show','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','username','remoteUri','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','Invalid\x20Login','Password\x20Expired','get_module_fields','module_fields','remove','includes','endsWith','statusCode','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','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','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x1652d9,_0x5b0af){var _0x4ef4d6=function(_0x1aa89d){while(--_0x1aa89d){_0x1652d9['push'](_0x1652d9['shift']());}};_0x4ef4d6(++_0x5b0af);}(_0x7d87,0x14c));var _0x77d8=function(_0x4c2bc5,_0x4984e2){_0x4c2bc5=_0x4c2bc5-0x0;var _0x487209=_0x7d87[_0x4c2bc5];return _0x487209;};'use strict';var pdf=require(_0x77d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x77d8('0x1'));var zipdir=require(_0x77d8('0x2'));var jsonpatch=require(_0x77d8('0x3'));var rp=require(_0x77d8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77d8('0x5'));var util=require(_0x77d8('0x6'));var path=require(_0x77d8('0x7'));var sox=require(_0x77d8('0x8'));var csv=require(_0x77d8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77d8('0xa'));var squel=require(_0x77d8('0xb'));var crypto=require(_0x77d8('0xc'));var jsforce=require(_0x77d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x77d8('0x9'));var querystring=require('querystring');var Papa=require(_0x77d8('0xe'));var Redis=require('ioredis');var authService=require(_0x77d8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x77d8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77d8('0x11'))(_0x77d8('0x12'));var utils=require(_0x77d8('0x13'));var config=require('../../config/environment');var db=require(_0x77d8('0x14'))['db'];var integrations=require(_0x77d8('0x15'));var jayson=require(_0x77d8('0x16'));var client=jayson[_0x77d8('0x17')][_0x77d8('0x18')]({'port':0x232a});function checkPasswordPattern(_0x59db98,_0xf59ee9,_0x3d955e){if(_0x3d955e){var _0x41c855=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41c855['test'](_0xf59ee9)){return _0x59db98;}else{throw new db['Sequelize'][(_0x77d8('0x19'))](_0x77d8('0x1a'));}}else{return _0x59db98;}}function respondWithRpcPromise(_0x252eaa,_0x5d0ddb,_0x28a00f,_0x1e1f0c){return new BPromise(function(_0x8b8f79,_0x29cab4){var _0x49ef02=_0x1e1f0c||client;return _0x49ef02[_0x77d8('0x1b')](_0x252eaa,_0x28a00f)[_0x77d8('0x1c')](function(_0x42b718){logger[_0x77d8('0x1d')](_0x77d8('0x1e'),_0x5d0ddb,'request\x20sent');logger[_0x77d8('0x1f')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5d0ddb,_0x77d8('0x20'),JSON[_0x77d8('0x21')](_0x42b718));if(_0x42b718[_0x77d8('0x22')]){if(_0x42b718[_0x77d8('0x22')]['code']===0x1f4){logger[_0x77d8('0x22')](_0x77d8('0x1e'),_0x5d0ddb,_0x42b718[_0x77d8('0x22')][_0x77d8('0x23')]);return _0x29cab4(_0x42b718[_0x77d8('0x22')][_0x77d8('0x23')]);}logger[_0x77d8('0x22')](_0x77d8('0x1e'),_0x5d0ddb,_0x42b718['error'][_0x77d8('0x23')]);return _0x8b8f79(_0x42b718[_0x77d8('0x22')][_0x77d8('0x23')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5d0ddb,'request\x20sent');_0x8b8f79(_0x42b718[_0x77d8('0x24')]['message']);}})[_0x77d8('0x25')](function(_0x4d182d){logger[_0x77d8('0x22')](_0x77d8('0x1e'),_0x5d0ddb,_0x4d182d);_0x29cab4(_0x4d182d);});});}function respondWithStatusCode(_0x4b7b86,_0x50b2e5){_0x50b2e5=_0x50b2e5||0xcc;return function(_0x32b22c){if(_0x32b22c){return _0x4b7b86[_0x77d8('0x26')](_0x50b2e5);}return _0x4b7b86[_0x77d8('0x27')](_0x50b2e5)['end']();};}function respondWithResult(_0x316ec4,_0x1f8cd4){_0x1f8cd4=_0x1f8cd4||0xc8;return function(_0x3014ff){if(_0x3014ff){return _0x316ec4[_0x77d8('0x27')](_0x1f8cd4)[_0x77d8('0x28')](_0x3014ff);}};}function respondWithFilteredResult(_0x35df74,_0x58a062){return function(_0x411f61){if(_0x411f61){var _0x27c4a6=_0x411f61[_0x77d8('0x29')],_0x595775=_0x58a062['offset'],_0x31a61e=_0x58a062['offset']+_0x58a062['limit'],_0x1d763d;if(_0x31a61e>=_0x27c4a6){_0x31a61e=_0x27c4a6;_0x1d763d=0xc8;}else{_0x1d763d=0xce;}_0x35df74[_0x77d8('0x27')](_0x1d763d);return _0x35df74[_0x77d8('0x2a')](_0x77d8('0x2b'),_0x595775+'-'+_0x31a61e+'/'+_0x27c4a6)[_0x77d8('0x28')](_0x411f61);}return null;};}function patchUpdates(_0xa771b0){return function(_0x5e07df){try{jsonpatch[_0x77d8('0x2c')](_0x5e07df,_0xa771b0,!![]);}catch(_0xd0abc0){return BPromise['reject'](_0xd0abc0);}return _0x5e07df[_0x77d8('0x2d')]();};}function saveUpdates(_0x970dc4,_0x1258b2){return function(_0x420c27){if(_0x420c27){return _0x420c27[_0x77d8('0x2e')](_0x970dc4)[_0x77d8('0x1c')](function(_0x3acbc3){return _0x3acbc3;});}return null;};}function removeEntity(_0x508d9c,_0x152496){return function(_0x44508a){if(_0x44508a){return _0x44508a[_0x77d8('0x2f')]()[_0x77d8('0x1c')](function(){_0x508d9c[_0x77d8('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x494837,_0x159e2d){return function(_0x37f1cd){if(!_0x37f1cd){_0x494837[_0x77d8('0x26')](0x194);}return _0x37f1cd;};}function handleError(_0x7ec66a,_0x34ccb9){_0x34ccb9=_0x34ccb9||0x1f4;return function(_0xe5ec53){logger['error'](_0xe5ec53[_0x77d8('0x30')]);if(_0xe5ec53[_0x77d8('0x31')]){delete _0xe5ec53[_0x77d8('0x31')];}_0x7ec66a[_0x77d8('0x27')](_0x34ccb9)[_0x77d8('0x32')](_0xe5ec53);};}exports['index']=function(_0x57d9c8,_0x581f5a){var _0x2bda9b={},_0x3d2aec={},_0x2a5fe2={'count':0x0,'rows':[]};var _0x150483=_[_0x77d8('0x33')](db['SugarcrmAccount'][_0x77d8('0x34')],function(_0x43cd75){return{'name':_0x43cd75[_0x77d8('0x35')],'type':_0x43cd75[_0x77d8('0x36')][_0x77d8('0x37')]};});_0x3d2aec[_0x77d8('0x38')]=_['map'](_0x150483,_0x77d8('0x31'));_0x3d2aec[_0x77d8('0x39')]=_[_0x77d8('0x3a')](_0x57d9c8[_0x77d8('0x39')]);_0x3d2aec[_0x77d8('0x3b')]=_[_0x77d8('0x3c')](_0x3d2aec[_0x77d8('0x38')],_0x3d2aec['query']);_0x2bda9b['attributes']=_[_0x77d8('0x3c')](_0x3d2aec[_0x77d8('0x38')],qs[_0x77d8('0x3d')](_0x57d9c8['query'][_0x77d8('0x3d')]));_0x2bda9b['attributes']=_0x2bda9b[_0x77d8('0x3e')][_0x77d8('0x3f')]?_0x2bda9b[_0x77d8('0x3e')]:_0x3d2aec[_0x77d8('0x38')];if(!_0x57d9c8[_0x77d8('0x39')]['hasOwnProperty'](_0x77d8('0x40'))){_0x2bda9b['limit']=qs[_0x77d8('0x41')](_0x57d9c8['query'][_0x77d8('0x41')]);_0x2bda9b[_0x77d8('0x42')]=qs[_0x77d8('0x42')](_0x57d9c8[_0x77d8('0x39')][_0x77d8('0x42')]);}_0x2bda9b[_0x77d8('0x43')]=qs[_0x77d8('0x44')](_0x57d9c8[_0x77d8('0x39')][_0x77d8('0x44')]);_0x2bda9b[_0x77d8('0x45')]=qs['filters'](_['pick'](_0x57d9c8[_0x77d8('0x39')],_0x3d2aec[_0x77d8('0x3b')]),_0x150483);if(_0x57d9c8[_0x77d8('0x39')]['filter']){_0x2bda9b[_0x77d8('0x45')]=_[_0x77d8('0x46')](_0x2bda9b[_0x77d8('0x45')],{'$or':_[_0x77d8('0x33')](_0x150483,function(_0x2f7f41){if(_0x2f7f41[_0x77d8('0x36')]!=='VIRTUAL'){var _0x5907e0={};_0x5907e0[_0x2f7f41[_0x77d8('0x31')]]={'$like':'%'+_0x57d9c8[_0x77d8('0x39')][_0x77d8('0x47')]+'%'};return _0x5907e0;}})});}_0x2bda9b=_['merge']({},_0x2bda9b,_0x57d9c8[_0x77d8('0x48')]);var _0x4b1c9a={'where':_0x2bda9b[_0x77d8('0x45')]};return db[_0x77d8('0x49')][_0x77d8('0x29')](_0x4b1c9a)[_0x77d8('0x1c')](function(_0x1cc8a8){_0x2a5fe2[_0x77d8('0x29')]=_0x1cc8a8;if(_0x57d9c8[_0x77d8('0x39')]['includeAll']){_0x2bda9b['include']=[{'all':!![]}];}return db[_0x77d8('0x49')][_0x77d8('0x4a')](_0x2bda9b);})['then'](function(_0x1c385d){_0x2a5fe2['rows']=_0x1c385d;return _0x2a5fe2;})[_0x77d8('0x1c')](respondWithFilteredResult(_0x581f5a,_0x2bda9b))['catch'](handleError(_0x581f5a,null));};exports[_0x77d8('0x4b')]=function(_0x2b92df,_0x4fe175){var _0x283537={'raw':![],'where':{'id':_0x2b92df[_0x77d8('0x4c')]['id']}},_0x41f825={};_0x41f825['model']=_[_0x77d8('0x3a')](db['SugarcrmAccount']['rawAttributes']);_0x41f825[_0x77d8('0x39')]=_[_0x77d8('0x3a')](_0x2b92df[_0x77d8('0x39')]);_0x41f825[_0x77d8('0x3b')]=_[_0x77d8('0x3c')](_0x41f825[_0x77d8('0x38')],_0x41f825[_0x77d8('0x39')]);_0x283537[_0x77d8('0x3e')]=_['intersection'](_0x41f825[_0x77d8('0x38')],qs[_0x77d8('0x3d')](_0x2b92df[_0x77d8('0x39')][_0x77d8('0x3d')]));_0x283537['attributes']=_0x283537[_0x77d8('0x3e')][_0x77d8('0x3f')]?_0x283537[_0x77d8('0x3e')]:_0x41f825['model'];if(_0x2b92df[_0x77d8('0x39')][_0x77d8('0x4d')]){_0x283537['include']=[{'all':!![]}];}_0x283537=_[_0x77d8('0x46')]({},_0x283537,_0x2b92df[_0x77d8('0x48')]);return db[_0x77d8('0x49')][_0x77d8('0x4e')](_0x283537)[_0x77d8('0x1c')](handleEntityNotFound(_0x4fe175,null))['then'](respondWithResult(_0x4fe175,null))['catch'](handleError(_0x4fe175,null));};exports[_0x77d8('0x4f')]=function(_0x335e56,_0x5f4660){return db['SugarcrmAccount'][_0x77d8('0x4f')](_0x335e56[_0x77d8('0x50')],{})[_0x77d8('0x1c')](respondWithResult(_0x5f4660,0xc9))['catch'](handleError(_0x5f4660,null));};exports['update']=function(_0x3cdd4d,_0x1f650c){if(_0x3cdd4d[_0x77d8('0x50')]['id']){delete _0x3cdd4d[_0x77d8('0x50')]['id'];}return db[_0x77d8('0x49')][_0x77d8('0x4e')]({'where':{'id':_0x3cdd4d[_0x77d8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f650c,null))[_0x77d8('0x1c')](saveUpdates(_0x3cdd4d[_0x77d8('0x50')],null))[_0x77d8('0x1c')](respondWithResult(_0x1f650c,null))['catch'](handleError(_0x1f650c,null));};exports[_0x77d8('0x2f')]=function(_0x4ec16c,_0x41f495){return db[_0x77d8('0x49')][_0x77d8('0x4e')]({'where':{'id':_0x4ec16c['params']['id']}})[_0x77d8('0x1c')](handleEntityNotFound(_0x41f495,null))[_0x77d8('0x1c')](removeEntity(_0x41f495,null))[_0x77d8('0x25')](handleError(_0x41f495,null));};exports[_0x77d8('0x51')]=function(_0x3c26d2,_0x42b266,_0x83de9d){var _0x18e3a8={};var _0x1990ad={};var _0x164def;var _0x5a49ed;return db['SugarcrmAccount'][_0x77d8('0x52')]({'where':{'id':_0x3c26d2[_0x77d8('0x4c')]['id']}})[_0x77d8('0x1c')](handleEntityNotFound(_0x42b266,null))[_0x77d8('0x1c')](function(_0x7927b4){if(_0x7927b4){_0x164def=_0x7927b4;_0x1990ad[_0x77d8('0x38')]=_['keys'](db[_0x77d8('0x53')][_0x77d8('0x34')]);_0x1990ad[_0x77d8('0x39')]=_['keys'](_0x3c26d2['query']);_0x1990ad[_0x77d8('0x3b')]=_['intersection'](_0x1990ad['model'],_0x1990ad[_0x77d8('0x39')]);_0x18e3a8[_0x77d8('0x3e')]=_[_0x77d8('0x3c')](_0x1990ad[_0x77d8('0x38')],qs[_0x77d8('0x3d')](_0x3c26d2['query'][_0x77d8('0x3d')]));_0x18e3a8[_0x77d8('0x3e')]=_0x18e3a8[_0x77d8('0x3e')][_0x77d8('0x3f')]?_0x18e3a8[_0x77d8('0x3e')]:_0x1990ad[_0x77d8('0x38')];_0x18e3a8[_0x77d8('0x43')]=qs[_0x77d8('0x44')](_0x3c26d2[_0x77d8('0x39')][_0x77d8('0x44')]);_0x18e3a8['where']=qs['filters'](_['pick'](_0x3c26d2['query'],_0x1990ad['filters']));if(_0x3c26d2[_0x77d8('0x39')][_0x77d8('0x47')]){_0x18e3a8[_0x77d8('0x45')]=_[_0x77d8('0x46')](_0x18e3a8[_0x77d8('0x45')],{'$or':_[_0x77d8('0x33')](_0x18e3a8[_0x77d8('0x3e')],function(_0x1afd28){var _0x3426f7={};_0x3426f7[_0x1afd28]={'$like':'%'+_0x3c26d2[_0x77d8('0x39')][_0x77d8('0x47')]+'%'};return _0x3426f7;})});}_0x18e3a8=_['merge']({},_0x18e3a8,_0x3c26d2[_0x77d8('0x48')]);return _0x164def['getConfigurations'](_0x18e3a8);}})[_0x77d8('0x1c')](function(_0x2503d8){if(_0x2503d8){_0x5a49ed=_0x2503d8[_0x77d8('0x3f')];if(!_0x3c26d2[_0x77d8('0x39')][_0x77d8('0x54')](_0x77d8('0x40'))){_0x18e3a8[_0x77d8('0x41')]=qs[_0x77d8('0x41')](_0x3c26d2[_0x77d8('0x39')]['limit']);_0x18e3a8[_0x77d8('0x42')]=qs[_0x77d8('0x42')](_0x3c26d2[_0x77d8('0x39')][_0x77d8('0x42')]);}return _0x164def[_0x77d8('0x51')](_0x18e3a8);}})[_0x77d8('0x1c')](function(_0x17c1ea){if(_0x17c1ea){return _0x17c1ea?{'count':_0x5a49ed,'rows':_0x17c1ea}:null;}})[_0x77d8('0x1c')](respondWithResult(_0x42b266,null))[_0x77d8('0x25')](handleError(_0x42b266,null));};exports[_0x77d8('0x55')]=function(_0x5bb9ab,_0x3d6996,_0x4fecb3){if(_0x5bb9ab[_0x77d8('0x50')]['id']){delete _0x5bb9ab['body']['id'];}return db['SugarcrmAccount'][_0x77d8('0x52')]({'where':{'id':_0x5bb9ab[_0x77d8('0x4c')]['id']}})[_0x77d8('0x1c')](handleEntityNotFound(_0x3d6996,null))[_0x77d8('0x1c')](function(_0x511389){if(_0x511389){_0x5bb9ab[_0x77d8('0x50')][_0x77d8('0x56')]=_0x511389['id'];_0x5bb9ab[_0x77d8('0x50')][_0x77d8('0x57')]=integrations[_0x77d8('0x58')](_0x5bb9ab['body'][_0x77d8('0x59')],_0x5bb9ab[_0x77d8('0x50')][_0x77d8('0x36')]);_0x5bb9ab[_0x77d8('0x50')][_0x77d8('0x5a')]=integrations[_0x77d8('0x5b')](_0x5bb9ab['body']['channel'],_0x5bb9ab[_0x77d8('0x50')][_0x77d8('0x36')]);return db[_0x77d8('0x53')][_0x77d8('0x4f')](_0x5bb9ab[_0x77d8('0x50')],{'include':[{'model':db['SugarcrmField'],'as':_0x77d8('0x57')},{'model':db[_0x77d8('0x5c')],'as':'Descriptions'}]});}return null;})[_0x77d8('0x1c')](respondWithResult(_0x3d6996,null))[_0x77d8('0x25')](handleError(_0x3d6996,null));};exports[_0x77d8('0x5d')]=function(_0x4ea06a,_0x16179e,_0x1ba831){var _0x25de11='';var _0x31fc63=['id','name',_0x77d8('0x5e'),_0x77d8('0x5f'),_0x77d8('0x60'),_0x77d8('0x61'),_0x77d8('0x62'),_0x77d8('0x63'),'parent_id',_0x77d8('0x64'),_0x77d8('0x65'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4ea06a['params']['id']},'attributes':['id',_0x77d8('0x66'),'password',_0x77d8('0x67')]})[_0x77d8('0x1c')](handleEntityNotFound(_0x16179e,null))[_0x77d8('0x1c')](function(_0x1ef6dd){if(_0x1ef6dd){_0x25de11=_0x1ef6dd['remoteUri'];var _0x2a5862=_0x25de11['slice'](-0x1);if(_0x2a5862==='/'){_0x25de11=_0x25de11['substring'](0x0,_0x25de11['lastIndexOf'](_0x2a5862));}return rp({'method':_0x77d8('0x68'),'uri':util[_0x77d8('0x69')](_0x77d8('0x6a'),_0x25de11,_0x77d8('0x6b')),'json':!![],'form':{'method':_0x77d8('0x6c'),'input_type':_0x77d8('0x6d'),'response_type':_0x77d8('0x6d'),'rest_data':JSON[_0x77d8('0x21')]({'user_auth':{'user_name':_0x1ef6dd[_0x77d8('0x66')],'password':_0x1ef6dd[_0x77d8('0x6e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x77d8('0x1c')](function(_0x2005c7){if(_0x2005c7&&_0x2005c7['name']!==_0x77d8('0x6f')&&_0x2005c7[_0x77d8('0x31')]!==_0x77d8('0x70')){return rp({'method':_0x77d8('0x68'),'uri':util['format']('%s%s',_0x25de11,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x77d8('0x71'),'input_type':_0x77d8('0x6d'),'response_type':_0x77d8('0x6d'),'rest_data':JSON[_0x77d8('0x21')]({'session':_0x2005c7['id'],'module_name':'Calls'})}})[_0x77d8('0x1c')](function(_0xab202a){if(_0xab202a){var _0x395a07=_['values'](_0xab202a[_0x77d8('0x72')]);_[_0x77d8('0x73')](_0x395a07,function(_0x267f9c){return _0x31fc63[_0x77d8('0x74')](_0x267f9c['name']);});return{'count':_0x395a07[_0x77d8('0x3f')],'rows':_[_0x77d8('0x33')](_0x395a07,function(_0x1a3e94){return{'id':_0x1a3e94[_0x77d8('0x31')],'name':_0x1a3e94['label'],'custom':_[_0x77d8('0x75')](_0x1a3e94[_0x77d8('0x31')],'_c')?!![]:![],'options':_0x1a3e94['options']?_[_0x77d8('0x33')](_['values'](_0x1a3e94[_0x77d8('0x48')]),function(_0x3fb8c7){return{'name':_0x3fb8c7['value'],'value':_0x3fb8c7[_0x77d8('0x31')]};}):[]};})};}})[_0x77d8('0x1c')](respondWithResult(_0x16179e,null))[_0x77d8('0x25')](function(_0x46c0ed){var _0x653902=_0x4ea06a['query']['test']?0x1f4:_0x46c0ed[_0x77d8('0x76')]||0x1f4;logger[_0x77d8('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x77d8('0x5d'),_0x653902,JSON['stringify'](_0x46c0ed));delete _0x46c0ed[_0x77d8('0x31')];if(_0x653902===0x191){_0x653902=0x190;}_0x16179e[_0x77d8('0x27')](_0x653902)['send'](_0x4ea06a[_0x77d8('0x39')][_0x77d8('0x77')]?{'message':_0x77d8('0x78'),'statusCode':_0x46c0ed[_0x77d8('0x76')]}:_0x46c0ed);});}else{var _0x2a2a37=0x1f4;_0x16179e[_0x77d8('0x27')](_0x2a2a37)[_0x77d8('0x32')]({'message':_0x77d8('0x78'),'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 f8c9e59..dd8cdf2 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 _0xca3a=['path','../../config/environment','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e3fc2,_0xdb372a){var _0x23eb3d=function(_0x296cb4){while(--_0x296cb4){_0x1e3fc2['push'](_0x1e3fc2['shift']());}};_0x23eb3d(++_0xdb372a);}(_0xca3a,0xf7));var _0xaca3=function(_0x2b6f0e,_0x2a763b){_0x2b6f0e=_0x2b6f0e-0x0;var _0x267bb2=_0xca3a[_0x2b6f0e];return _0x267bb2;};'use strict';var _=require(_0xaca3('0x0'));var util=require('util');var logger=require(_0xaca3('0x1'))(_0xaca3('0x2'));var moment=require(_0xaca3('0x3'));var BPromise=require(_0xaca3('0x4'));var rp=require(_0xaca3('0x5'));var fs=require('fs');var path=require(_0xaca3('0x6'));var rimraf=require('rimraf');var config=require(_0xaca3('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xaca3('0x8'));module['exports']=function(_0x51a376,_0x266ef4){return _0x51a376[_0xaca3('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xaca3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd6a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','util'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0xcd6a,0x196));var _0xacd6=function(_0x5f640f,_0x1128ce){_0x5f640f=_0x5f640f-0x0;var _0x20ebe5=_0xcd6a[_0x5f640f];return _0x20ebe5;};'use strict';var _=require('lodash');var util=require(_0xacd6('0x0'));var logger=require(_0xacd6('0x1'))(_0xacd6('0x2'));var moment=require(_0xacd6('0x3'));var BPromise=require(_0xacd6('0x4'));var rp=require(_0xacd6('0x5'));var fs=require('fs');var path=require(_0xacd6('0x6'));var rimraf=require(_0xacd6('0x7'));var config=require(_0xacd6('0x8'));var attributes=require(_0xacd6('0x9'));var integrations=require(_0xacd6('0xa'));module['exports']=function(_0x35ff6a,_0x1b89c5){return _0x35ff6a['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index ab26b7c..b3df69f 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 _0xae56=['model','attributes','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','include','map'];(function(_0x4a148c,_0x5e15c0){var _0x480f05=function(_0x32df31){while(--_0x32df31){_0x4a148c['push'](_0x4a148c['shift']());}};_0x480f05(++_0x5e15c0);}(_0xae56,0x1e0));var _0x6ae5=function(_0x4cdb45,_0x136327){_0x4cdb45=_0x4cdb45-0x0;var _0x4ac374=_0xae56[_0x4cdb45];return _0x4ac374;};'use strict';var _=require(_0x6ae5('0x0'));var util=require(_0x6ae5('0x1'));var moment=require(_0x6ae5('0x2'));var BPromise=require(_0x6ae5('0x3'));var rs=require(_0x6ae5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ae5('0x5'));var logger=require(_0x6ae5('0x6'))(_0x6ae5('0x7'));var config=require(_0x6ae5('0x8'));var jayson=require(_0x6ae5('0x9'));var client=jayson[_0x6ae5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52a6c5,_0x37fabf,_0x4005dd){return new BPromise(function(_0x373728,_0x205029){return client[_0x6ae5('0xb')](_0x52a6c5,_0x4005dd)[_0x6ae5('0xc')](function(_0x39c406){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x37fabf,'request\x20sent');logger[_0x6ae5('0xd')](_0x6ae5('0xe'),_0x37fabf,'request\x20sent',JSON[_0x6ae5('0xf')](_0x39c406));if(_0x39c406[_0x6ae5('0x10')]){if(_0x39c406['error']['code']===0x1f4){logger['error'](_0x6ae5('0x11'),_0x37fabf,_0x39c406[_0x6ae5('0x10')][_0x6ae5('0x12')]);return _0x205029(_0x39c406[_0x6ae5('0x10')][_0x6ae5('0x12')]);}logger[_0x6ae5('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x37fabf,_0x39c406[_0x6ae5('0x10')][_0x6ae5('0x12')]);return _0x373728(_0x39c406[_0x6ae5('0x10')][_0x6ae5('0x12')]);}else{logger[_0x6ae5('0x13')](_0x6ae5('0x11'),_0x37fabf,'request\x20sent');_0x373728(_0x39c406[_0x6ae5('0x14')][_0x6ae5('0x12')]);}})[_0x6ae5('0x15')](function(_0x43b51d){logger['error'](_0x6ae5('0x11'),_0x37fabf,_0x43b51d);_0x205029(_0x43b51d);});});}exports[_0x6ae5('0x16')]=function(_0x5dacb0){var _0x2ab148=this;return new Promise(function(_0x184d0a,_0x38de80){return db[_0x6ae5('0x17')][_0x6ae5('0x18')]({'raw':_0x5dacb0['options']?_0x5dacb0[_0x6ae5('0x19')][_0x6ae5('0x1a')]===undefined?!![]:![]:!![],'where':_0x5dacb0['options']?_0x5dacb0[_0x6ae5('0x19')][_0x6ae5('0x1b')]||null:null,'attributes':_0x5dacb0[_0x6ae5('0x19')]?_0x5dacb0[_0x6ae5('0x19')]['attributes']||null:null,'limit':_0x5dacb0[_0x6ae5('0x19')]?_0x5dacb0[_0x6ae5('0x19')]['limit']||null:null,'include':_0x5dacb0[_0x6ae5('0x19')]?_0x5dacb0[_0x6ae5('0x19')][_0x6ae5('0x1c')]?_[_0x6ae5('0x1d')](_0x5dacb0[_0x6ae5('0x19')][_0x6ae5('0x1c')],function(_0x1b73e1){return{'model':db[_0x1b73e1['model']],'as':_0x1b73e1['as'],'attributes':_0x1b73e1['attributes'],'include':_0x1b73e1['include']?_[_0x6ae5('0x1d')](_0x1b73e1[_0x6ae5('0x1c')],function(_0x4c0e18){return{'model':db[_0x4c0e18[_0x6ae5('0x1e')]],'as':_0x4c0e18['as'],'attributes':_0x4c0e18[_0x6ae5('0x1f')],'include':_0x4c0e18[_0x6ae5('0x1c')]?_[_0x6ae5('0x1d')](_0x4c0e18[_0x6ae5('0x1c')],function(_0x4f402e){return{'model':db[_0x4f402e[_0x6ae5('0x1e')]],'as':_0x4f402e['as'],'attributes':_0x4f402e[_0x6ae5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6ae5('0xc')](function(_0x31ba6d){logger[_0x6ae5('0x13')](_0x6ae5('0x16'),_0x5dacb0);logger['debug'](_0x6ae5('0x16'),_0x5dacb0,JSON[_0x6ae5('0xf')](_0x31ba6d));_0x184d0a(_0x31ba6d);})[_0x6ae5('0x15')](function(_0xdf0d3b){logger[_0x6ae5('0x10')](_0x6ae5('0x16'),_0xdf0d3b[_0x6ae5('0x12')],_0x5dacb0);_0x38de80(_0x2ab148[_0x6ae5('0x10')](0x1f4,_0xdf0d3b[_0x6ae5('0x12')]));});});};exports[_0x6ae5('0x20')]=function(_0x2bcbeb){var _0x3dcc2d=this;return new Promise(function(_0x4d61e6,_0x3d2f17){return db[_0x6ae5('0x17')][_0x6ae5('0x21')]({'raw':_0x2bcbeb[_0x6ae5('0x19')]?_0x2bcbeb[_0x6ae5('0x19')][_0x6ae5('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bcbeb[_0x6ae5('0x19')]?_0x2bcbeb['options'][_0x6ae5('0x1b')]||null:null,'attributes':_0x2bcbeb[_0x6ae5('0x19')]?_0x2bcbeb[_0x6ae5('0x19')][_0x6ae5('0x1f')]||null:null,'include':_0x2bcbeb[_0x6ae5('0x19')]?_0x2bcbeb['options'][_0x6ae5('0x1c')]?_['map'](_0x2bcbeb[_0x6ae5('0x19')][_0x6ae5('0x1c')],function(_0x334508){return{'model':db[_0x334508['model']],'as':_0x334508['as'],'attributes':_0x334508[_0x6ae5('0x1f')],'include':_0x334508['include']?_['map'](_0x334508['include'],function(_0x51472d){return{'model':db[_0x51472d[_0x6ae5('0x1e')]],'as':_0x51472d['as'],'attributes':_0x51472d[_0x6ae5('0x1f')],'include':_0x51472d[_0x6ae5('0x1c')]?_['map'](_0x51472d[_0x6ae5('0x1c')],function(_0x5751b0){return{'model':db[_0x5751b0[_0x6ae5('0x1e')]],'as':_0x5751b0['as'],'attributes':_0x5751b0[_0x6ae5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6ae5('0xc')](function(_0x23df7e){logger['info'](_0x6ae5('0x20'),_0x2bcbeb);logger[_0x6ae5('0xd')](_0x6ae5('0x20'),_0x2bcbeb,JSON['stringify'](_0x23df7e));_0x4d61e6(_0x23df7e);})['catch'](function(_0x35967f){logger[_0x6ae5('0x10')](_0x6ae5('0x20'),_0x35967f[_0x6ae5('0x12')],_0x2bcbeb);_0x3d2f17(_0x3dcc2d['error'](0x1f4,_0x35967f['message']));});});}; \ No newline at end of file +var _0xe67a=['request','info','request\x20sent','debug','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','then','ShowSugarcrmAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x28e714,_0x1ca825){var _0x2c3bf2=function(_0x2e0af6){while(--_0x2e0af6){_0x28e714['push'](_0x28e714['shift']());}};_0x2c3bf2(++_0x1ca825);}(_0xe67a,0xfc));var _0xae67=function(_0x55e044,_0x35fb5b){_0x55e044=_0x55e044-0x0;var _0x244094=_0xe67a[_0x55e044];return _0x244094;};'use strict';var _=require(_0xae67('0x0'));var util=require(_0xae67('0x1'));var moment=require(_0xae67('0x2'));var BPromise=require(_0xae67('0x3'));var rs=require(_0xae67('0x4'));var fs=require('fs');var Redis=require(_0xae67('0x5'));var db=require(_0xae67('0x6'))['db'];var utils=require(_0xae67('0x7'));var logger=require(_0xae67('0x8'))(_0xae67('0x9'));var config=require(_0xae67('0xa'));var jayson=require(_0xae67('0xb'));var client=jayson[_0xae67('0xc')][_0xae67('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x159629,_0x41ba35,_0x276f07){return new BPromise(function(_0xf2ddba,_0x1e4819){return client[_0xae67('0xe')](_0x159629,_0x276f07)['then'](function(_0x2c67db){logger[_0xae67('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x41ba35,_0xae67('0x10'));logger[_0xae67('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x41ba35,_0xae67('0x10'),JSON[_0xae67('0x12')](_0x2c67db));if(_0x2c67db[_0xae67('0x13')]){if(_0x2c67db[_0xae67('0x13')][_0xae67('0x14')]===0x1f4){logger[_0xae67('0x13')](_0xae67('0x15'),_0x41ba35,_0x2c67db[_0xae67('0x13')][_0xae67('0x16')]);return _0x1e4819(_0x2c67db[_0xae67('0x13')][_0xae67('0x16')]);}logger['error'](_0xae67('0x15'),_0x41ba35,_0x2c67db['error'][_0xae67('0x16')]);return _0xf2ddba(_0x2c67db[_0xae67('0x13')][_0xae67('0x16')]);}else{logger['info'](_0xae67('0x15'),_0x41ba35,_0xae67('0x10'));_0xf2ddba(_0x2c67db[_0xae67('0x17')][_0xae67('0x16')]);}})[_0xae67('0x18')](function(_0x266173){logger[_0xae67('0x13')](_0xae67('0x15'),_0x41ba35,_0x266173);_0x1e4819(_0x266173);});});}exports[_0xae67('0x19')]=function(_0x19b954){var _0x1142a2=this;return new Promise(function(_0x32225c,_0x2421bc){return db[_0xae67('0x1a')][_0xae67('0x1b')]({'raw':_0x19b954[_0xae67('0x1c')]?_0x19b954[_0xae67('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x19b954[_0xae67('0x1c')]?_0x19b954[_0xae67('0x1c')][_0xae67('0x1d')]||null:null,'attributes':_0x19b954[_0xae67('0x1c')]?_0x19b954[_0xae67('0x1c')][_0xae67('0x1e')]||null:null,'limit':_0x19b954[_0xae67('0x1c')]?_0x19b954[_0xae67('0x1c')]['limit']||null:null,'include':_0x19b954[_0xae67('0x1c')]?_0x19b954[_0xae67('0x1c')][_0xae67('0x1f')]?_[_0xae67('0x20')](_0x19b954['options'][_0xae67('0x1f')],function(_0x22680f){return{'model':db[_0x22680f['model']],'as':_0x22680f['as'],'attributes':_0x22680f['attributes'],'include':_0x22680f['include']?_[_0xae67('0x20')](_0x22680f[_0xae67('0x1f')],function(_0x19412d){return{'model':db[_0x19412d[_0xae67('0x21')]],'as':_0x19412d['as'],'attributes':_0x19412d[_0xae67('0x1e')],'include':_0x19412d[_0xae67('0x1f')]?_[_0xae67('0x20')](_0x19412d['include'],function(_0x32700c){return{'model':db[_0x32700c[_0xae67('0x21')]],'as':_0x32700c['as'],'attributes':_0x32700c[_0xae67('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae67('0x22')](function(_0x4ad8c1){logger[_0xae67('0xf')](_0xae67('0x19'),_0x19b954);logger[_0xae67('0x11')](_0xae67('0x19'),_0x19b954,JSON['stringify'](_0x4ad8c1));_0x32225c(_0x4ad8c1);})[_0xae67('0x18')](function(_0x2b981d){logger[_0xae67('0x13')](_0xae67('0x19'),_0x2b981d[_0xae67('0x16')],_0x19b954);_0x2421bc(_0x1142a2[_0xae67('0x13')](0x1f4,_0x2b981d[_0xae67('0x16')]));});});};exports[_0xae67('0x23')]=function(_0x37b125){var _0xee5462=this;return new Promise(function(_0x17711e,_0x5cb364){return db['SugarcrmAccount'][_0xae67('0x24')]({'raw':_0x37b125[_0xae67('0x1c')]?_0x37b125[_0xae67('0x1c')][_0xae67('0x25')]===undefined?!![]:![]:!![],'where':_0x37b125['options']?_0x37b125[_0xae67('0x1c')][_0xae67('0x1d')]||null:null,'attributes':_0x37b125[_0xae67('0x1c')]?_0x37b125[_0xae67('0x1c')][_0xae67('0x1e')]||null:null,'include':_0x37b125[_0xae67('0x1c')]?_0x37b125[_0xae67('0x1c')]['include']?_[_0xae67('0x20')](_0x37b125[_0xae67('0x1c')]['include'],function(_0x33a8a3){return{'model':db[_0x33a8a3[_0xae67('0x21')]],'as':_0x33a8a3['as'],'attributes':_0x33a8a3['attributes'],'include':_0x33a8a3[_0xae67('0x1f')]?_[_0xae67('0x20')](_0x33a8a3[_0xae67('0x1f')],function(_0x4de71e){return{'model':db[_0x4de71e[_0xae67('0x21')]],'as':_0x4de71e['as'],'attributes':_0x4de71e[_0xae67('0x1e')],'include':_0x4de71e[_0xae67('0x1f')]?_[_0xae67('0x20')](_0x4de71e['include'],function(_0x201d72){return{'model':db[_0x201d72[_0xae67('0x21')]],'as':_0x201d72['as'],'attributes':_0x201d72[_0xae67('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e77dd){logger[_0xae67('0xf')](_0xae67('0x23'),_0x37b125);logger[_0xae67('0x11')](_0xae67('0x23'),_0x37b125,JSON['stringify'](_0x3e77dd));_0x17711e(_0x3e77dd);})[_0xae67('0x18')](function(_0x823da){logger[_0xae67('0x13')](_0xae67('0x23'),_0x823da['message'],_0x37b125);_0x5cb364(_0xee5462[_0xae67('0x13')](0x1f4,_0x823da[_0xae67('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bbfa144..6e5cb60 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 _0x8425=['index','get','/:id','isAuthenticated','show','/:id/fields','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x51064f,_0x16440a){var _0x54947e=function(_0x5af8b7){while(--_0x5af8b7){_0x51064f['push'](_0x51064f['shift']());}};_0x54947e(++_0x16440a);}(_0x8425,0x1c5));var _0x5842=function(_0x2cc752,_0x4a48b3){_0x2cc752=_0x2cc752-0x0;var _0x463e7a=_0x8425[_0x2cc752];return _0x463e7a;};'use strict';var multer=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var path=require(_0x5842('0x2'));var timeout=require(_0x5842('0x3'));var express=require('express');var router=express[_0x5842('0x4')]();var auth=require(_0x5842('0x5'));var interaction=require(_0x5842('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5842('0x7')]);router[_0x5842('0x8')](_0x5842('0x9'),auth[_0x5842('0xa')](),controller[_0x5842('0xb')]);router[_0x5842('0x8')](_0x5842('0xc'),auth[_0x5842('0xa')](),controller['getFields']);router[_0x5842('0x8')]('/:id/subjects',auth[_0x5842('0xa')](),controller['getSubjects']);router[_0x5842('0x8')](_0x5842('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5842('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5842('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5842('0x10')]);router[_0x5842('0x11')](_0x5842('0x9'),auth['isAuthenticated'](),controller[_0x5842('0x12')]);module[_0x5842('0x13')]=router; \ No newline at end of file +var _0x4793=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x57c22b,_0x54a1fa){var _0x5c982e=function(_0x52dab3){while(--_0x52dab3){_0x57c22b['push'](_0x57c22b['shift']());}};_0x5c982e(++_0x54a1fa);}(_0x4793,0x1ce));var _0x3479=function(_0x3b75ef,_0x1e4556){_0x3b75ef=_0x3b75ef-0x0;var _0xb67556=_0x4793[_0x3b75ef];return _0xb67556;};'use strict';var multer=require(_0x3479('0x0'));var util=require(_0x3479('0x1'));var path=require(_0x3479('0x2'));var timeout=require(_0x3479('0x3'));var express=require('express');var router=express[_0x3479('0x4')]();var auth=require(_0x3479('0x5'));var interaction=require(_0x3479('0x6'));var config=require(_0x3479('0x7'));var controller=require(_0x3479('0x8'));router[_0x3479('0x9')]('/',auth['isAuthenticated'](),controller[_0x3479('0xa')]);router['get'](_0x3479('0xb'),auth[_0x3479('0xc')](),controller[_0x3479('0xd')]);router[_0x3479('0x9')](_0x3479('0xe'),auth[_0x3479('0xc')](),controller[_0x3479('0xf')]);router[_0x3479('0x9')](_0x3479('0x10'),auth[_0x3479('0xc')](),controller['getSubjects']);router[_0x3479('0x9')](_0x3479('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3479('0x12')]('/',auth['isAuthenticated'](),controller[_0x3479('0x13')]);router[_0x3479('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3479('0x15')]);router['delete'](_0x3479('0xb'),auth[_0x3479('0xc')](),controller[_0x3479('0x16')]);module[_0x3479('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 a688135..4d8fc94 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeff5=['STRING','exports'];(function(_0xf89788,_0x3702bd){var _0x5dc967=function(_0x121bed){while(--_0x121bed){_0xf89788['push'](_0xf89788['shift']());}};_0x5dc967(++_0x3702bd);}(_0xeff5,0xb1));var _0x5eff=function(_0x8df24f,_0x708352){_0x8df24f=_0x8df24f-0x0;var _0x22d3c1=_0xeff5[_0x8df24f];return _0x22d3c1;};'use strict';var Sequelize=require('sequelize');module[_0x5eff('0x0')]={'name':{'type':Sequelize[_0x5eff('0x1')]},'description':{'type':Sequelize[_0x5eff('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 38f8e62..213dc03 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 _0xa2e9=['catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','SugarcrmConfiguration','includeAll','findAll','rows','show','params','rawAttributes','include','options','create','body','find','getFields','SugarcrmField','order','hasOwnProperty','findOne','getSubjects','getDescriptions','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x5263c4,_0x2c5da7){var _0x45e20a=function(_0x295e46){while(--_0x295e46){_0x5263c4['push'](_0x5263c4['shift']());}};_0x45e20a(++_0x2c5da7);}(_0xa2e9,0xfd));var _0x9a2e=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0xa2e9[_0x4b4638];return _0x59e92b;};'use strict';var pdf=require(_0x9a2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9a2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a2e('0x2'));var rp=require(_0x9a2e('0x3'));var moment=require(_0x9a2e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9a2e('0x5'));var util=require(_0x9a2e('0x6'));var path=require(_0x9a2e('0x7'));var sox=require(_0x9a2e('0x8'));var csv=require('to-csv');var ejs=require(_0x9a2e('0x9'));var fs=require('fs');var _=require(_0x9a2e('0xa'));var squel=require(_0x9a2e('0xb'));var crypto=require(_0x9a2e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9a2e('0xd'));var toCsv=require(_0x9a2e('0xe'));var querystring=require(_0x9a2e('0xf'));var Papa=require(_0x9a2e('0x10'));var Redis=require(_0x9a2e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a2e('0x12'));var as=require(_0x9a2e('0x13'));var hardwareService=require(_0x9a2e('0x14'));var logger=require(_0x9a2e('0x15'))(_0x9a2e('0x16'));var utils=require(_0x9a2e('0x17'));var config=require(_0x9a2e('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9a2e('0x19'));var client=jayson[_0x9a2e('0x1a')][_0x9a2e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xaab9d5,_0x5c6c0e,_0x16f110){if(_0x16f110){var _0x579f07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x579f07['test'](_0x5c6c0e)){return _0xaab9d5;}else{throw new db[(_0x9a2e('0x1c'))][(_0x9a2e('0x1d'))](_0x9a2e('0x1e'));}}else{return _0xaab9d5;}}function respondWithRpcPromise(_0x19b355,_0x500410,_0x5c6f1c,_0x1ac6f4){return new BPromise(function(_0x5bebd5,_0x1a2092){var _0x4f0d3d=_0x1ac6f4||client;return _0x4f0d3d[_0x9a2e('0x1f')](_0x19b355,_0x5c6f1c)['then'](function(_0x1ee988){logger[_0x9a2e('0x20')](_0x9a2e('0x21'),_0x500410,_0x9a2e('0x22'));logger[_0x9a2e('0x23')](_0x9a2e('0x24'),_0x500410,_0x9a2e('0x22'),JSON['stringify'](_0x1ee988));if(_0x1ee988[_0x9a2e('0x25')]){if(_0x1ee988['error'][_0x9a2e('0x26')]===0x1f4){logger['error'](_0x9a2e('0x21'),_0x500410,_0x1ee988[_0x9a2e('0x25')]['message']);return _0x1a2092(_0x1ee988['error'][_0x9a2e('0x27')]);}logger[_0x9a2e('0x25')](_0x9a2e('0x21'),_0x500410,_0x1ee988[_0x9a2e('0x25')][_0x9a2e('0x27')]);return _0x5bebd5(_0x1ee988[_0x9a2e('0x25')][_0x9a2e('0x27')]);}else{logger[_0x9a2e('0x20')](_0x9a2e('0x21'),_0x500410,_0x9a2e('0x22'));_0x5bebd5(_0x1ee988[_0x9a2e('0x28')][_0x9a2e('0x27')]);}})[_0x9a2e('0x29')](function(_0x365dda){logger[_0x9a2e('0x25')](_0x9a2e('0x21'),_0x500410,_0x365dda);_0x1a2092(_0x365dda);});});}function respondWithStatusCode(_0x1265c9,_0x516f26){_0x516f26=_0x516f26||0xcc;return function(_0x4d0927){if(_0x4d0927){return _0x1265c9[_0x9a2e('0x2a')](_0x516f26);}return _0x1265c9[_0x9a2e('0x2b')](_0x516f26)[_0x9a2e('0x2c')]();};}function respondWithResult(_0x2845fb,_0x4abbb1){_0x4abbb1=_0x4abbb1||0xc8;return function(_0x295921){if(_0x295921){return _0x2845fb[_0x9a2e('0x2b')](_0x4abbb1)[_0x9a2e('0x2d')](_0x295921);}};}function respondWithFilteredResult(_0x4de065,_0x1fa920){return function(_0x33f7b2){if(_0x33f7b2){var _0x5ec5a9=_0x33f7b2[_0x9a2e('0x2e')],_0x112a5c=_0x1fa920[_0x9a2e('0x2f')],_0x1004cc=_0x1fa920[_0x9a2e('0x2f')]+_0x1fa920['limit'],_0x596766;if(_0x1004cc>=_0x5ec5a9){_0x1004cc=_0x5ec5a9;_0x596766=0xc8;}else{_0x596766=0xce;}_0x4de065[_0x9a2e('0x2b')](_0x596766);return _0x4de065[_0x9a2e('0x30')](_0x9a2e('0x31'),_0x112a5c+'-'+_0x1004cc+'/'+_0x5ec5a9)[_0x9a2e('0x2d')](_0x33f7b2);}return null;};}function patchUpdates(_0x2d7d6d){return function(_0x3b3d5c){try{jsonpatch[_0x9a2e('0x32')](_0x3b3d5c,_0x2d7d6d,!![]);}catch(_0x4a46b9){return BPromise[_0x9a2e('0x33')](_0x4a46b9);}return _0x3b3d5c['save']();};}function saveUpdates(_0x2542ab,_0x44935c){return function(_0x1fb1f9){if(_0x1fb1f9){return _0x1fb1f9[_0x9a2e('0x34')](_0x2542ab)[_0x9a2e('0x35')](function(_0x4626ed){return _0x4626ed;});}return null;};}function removeEntity(_0x40022f,_0xb9b53a){return function(_0x5b51a6){if(_0x5b51a6){return _0x5b51a6[_0x9a2e('0x36')]()[_0x9a2e('0x35')](function(){_0x40022f[_0x9a2e('0x2b')](0xcc)[_0x9a2e('0x2c')]();});}};}function handleEntityNotFound(_0x17f140,_0x372b98){return function(_0xe48bb9){if(!_0xe48bb9){_0x17f140[_0x9a2e('0x2a')](0x194);}return _0xe48bb9;};}function handleError(_0x169cf2,_0x4c1e15){_0x4c1e15=_0x4c1e15||0x1f4;return function(_0x55891a){logger[_0x9a2e('0x25')](_0x55891a[_0x9a2e('0x37')]);if(_0x55891a[_0x9a2e('0x38')]){delete _0x55891a[_0x9a2e('0x38')];}_0x169cf2['status'](_0x4c1e15)[_0x9a2e('0x39')](_0x55891a);};}exports[_0x9a2e('0x3a')]=function(_0x2c6cc2,_0x2337e8){var _0x3048fb={},_0x284eca={},_0x351e2b={'count':0x0,'rows':[]};var _0x26f791=_[_0x9a2e('0x3b')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x44271d){return{'name':_0x44271d[_0x9a2e('0x3c')],'type':_0x44271d[_0x9a2e('0x3d')][_0x9a2e('0x3e')]};});_0x284eca[_0x9a2e('0x3f')]=_['map'](_0x26f791,_0x9a2e('0x38'));_0x284eca[_0x9a2e('0x40')]=_[_0x9a2e('0x41')](_0x2c6cc2['query']);_0x284eca[_0x9a2e('0x42')]=_[_0x9a2e('0x43')](_0x284eca[_0x9a2e('0x3f')],_0x284eca[_0x9a2e('0x40')]);_0x3048fb[_0x9a2e('0x44')]=_[_0x9a2e('0x43')](_0x284eca[_0x9a2e('0x3f')],qs[_0x9a2e('0x45')](_0x2c6cc2[_0x9a2e('0x40')]['fields']));_0x3048fb[_0x9a2e('0x44')]=_0x3048fb['attributes'][_0x9a2e('0x46')]?_0x3048fb[_0x9a2e('0x44')]:_0x284eca[_0x9a2e('0x3f')];if(!_0x2c6cc2['query']['hasOwnProperty'](_0x9a2e('0x47'))){_0x3048fb['limit']=qs[_0x9a2e('0x48')](_0x2c6cc2['query'][_0x9a2e('0x48')]);_0x3048fb[_0x9a2e('0x2f')]=qs[_0x9a2e('0x2f')](_0x2c6cc2[_0x9a2e('0x40')][_0x9a2e('0x2f')]);}_0x3048fb['order']=qs[_0x9a2e('0x49')](_0x2c6cc2[_0x9a2e('0x40')][_0x9a2e('0x49')]);_0x3048fb[_0x9a2e('0x4a')]=qs[_0x9a2e('0x42')](_[_0x9a2e('0x4b')](_0x2c6cc2['query'],_0x284eca[_0x9a2e('0x42')]),_0x26f791);if(_0x2c6cc2[_0x9a2e('0x40')][_0x9a2e('0x4c')]){_0x3048fb['where']=_[_0x9a2e('0x4d')](_0x3048fb[_0x9a2e('0x4a')],{'$or':_[_0x9a2e('0x3b')](_0x26f791,function(_0x5ed080){if(_0x5ed080[_0x9a2e('0x3d')]!==_0x9a2e('0x4e')){var _0x3ec04c={};_0x3ec04c[_0x5ed080[_0x9a2e('0x38')]]={'$like':'%'+_0x2c6cc2[_0x9a2e('0x40')]['filter']+'%'};return _0x3ec04c;}})});}_0x3048fb=_[_0x9a2e('0x4d')]({},_0x3048fb,_0x2c6cc2['options']);var _0x3c3b4d={'where':_0x3048fb[_0x9a2e('0x4a')]};return db[_0x9a2e('0x4f')][_0x9a2e('0x2e')](_0x3c3b4d)[_0x9a2e('0x35')](function(_0xcfde88){_0x351e2b[_0x9a2e('0x2e')]=_0xcfde88;if(_0x2c6cc2[_0x9a2e('0x40')][_0x9a2e('0x50')]){_0x3048fb['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x9a2e('0x51')](_0x3048fb);})['then'](function(_0x28f1b2){_0x351e2b[_0x9a2e('0x52')]=_0x28f1b2;return _0x351e2b;})[_0x9a2e('0x35')](respondWithFilteredResult(_0x2337e8,_0x3048fb))[_0x9a2e('0x29')](handleError(_0x2337e8,null));};exports[_0x9a2e('0x53')]=function(_0x7fde28,_0x3706bc){var _0x69c782={'raw':![],'where':{'id':_0x7fde28[_0x9a2e('0x54')]['id']}},_0x484203={};_0x484203[_0x9a2e('0x3f')]=_[_0x9a2e('0x41')](db[_0x9a2e('0x4f')][_0x9a2e('0x55')]);_0x484203[_0x9a2e('0x40')]=_[_0x9a2e('0x41')](_0x7fde28[_0x9a2e('0x40')]);_0x484203['filters']=_['intersection'](_0x484203[_0x9a2e('0x3f')],_0x484203[_0x9a2e('0x40')]);_0x69c782[_0x9a2e('0x44')]=_[_0x9a2e('0x43')](_0x484203[_0x9a2e('0x3f')],qs[_0x9a2e('0x45')](_0x7fde28['query']['fields']));_0x69c782[_0x9a2e('0x44')]=_0x69c782[_0x9a2e('0x44')][_0x9a2e('0x46')]?_0x69c782[_0x9a2e('0x44')]:_0x484203[_0x9a2e('0x3f')];if(_0x7fde28[_0x9a2e('0x40')]['includeAll']){_0x69c782[_0x9a2e('0x56')]=[{'all':!![]}];}_0x69c782=_[_0x9a2e('0x4d')]({},_0x69c782,_0x7fde28[_0x9a2e('0x57')]);return db[_0x9a2e('0x4f')]['find'](_0x69c782)[_0x9a2e('0x35')](handleEntityNotFound(_0x3706bc,null))[_0x9a2e('0x35')](respondWithResult(_0x3706bc,null))[_0x9a2e('0x29')](handleError(_0x3706bc,null));};exports[_0x9a2e('0x58')]=function(_0x292031,_0x220ca2){return db[_0x9a2e('0x4f')][_0x9a2e('0x58')](_0x292031[_0x9a2e('0x59')],{})[_0x9a2e('0x35')](respondWithResult(_0x220ca2,0xc9))['catch'](handleError(_0x220ca2,null));};exports[_0x9a2e('0x34')]=function(_0x486b9f,_0x41c730){if(_0x486b9f[_0x9a2e('0x59')]['id']){delete _0x486b9f[_0x9a2e('0x59')]['id'];}return db[_0x9a2e('0x4f')][_0x9a2e('0x5a')]({'where':{'id':_0x486b9f[_0x9a2e('0x54')]['id']}})[_0x9a2e('0x35')](handleEntityNotFound(_0x41c730,null))[_0x9a2e('0x35')](saveUpdates(_0x486b9f['body'],null))['then'](respondWithResult(_0x41c730,null))[_0x9a2e('0x29')](handleError(_0x41c730,null));};exports['destroy']=function(_0x5ddfc8,_0x50c856){return db[_0x9a2e('0x4f')][_0x9a2e('0x5a')]({'where':{'id':_0x5ddfc8[_0x9a2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x50c856,null))[_0x9a2e('0x35')](removeEntity(_0x50c856,null))['catch'](handleError(_0x50c856,null));};exports[_0x9a2e('0x5b')]=function(_0x5864eb,_0xbae5e2,_0x2fd369){var _0xb86448={};var _0x37c342={};var _0xcf2e7a;var _0x2367d0;return db[_0x9a2e('0x4f')]['findOne']({'where':{'id':_0x5864eb[_0x9a2e('0x54')]['id']}})[_0x9a2e('0x35')](handleEntityNotFound(_0xbae5e2,null))[_0x9a2e('0x35')](function(_0x42ef22){if(_0x42ef22){_0xcf2e7a=_0x42ef22;_0x37c342[_0x9a2e('0x3f')]=_[_0x9a2e('0x41')](db[_0x9a2e('0x5c')][_0x9a2e('0x55')]);_0x37c342[_0x9a2e('0x40')]=_[_0x9a2e('0x41')](_0x5864eb['query']);_0x37c342[_0x9a2e('0x42')]=_['intersection'](_0x37c342[_0x9a2e('0x3f')],_0x37c342[_0x9a2e('0x40')]);_0xb86448['attributes']=_['intersection'](_0x37c342['model'],qs['fields'](_0x5864eb[_0x9a2e('0x40')][_0x9a2e('0x45')]));_0xb86448[_0x9a2e('0x44')]=_0xb86448[_0x9a2e('0x44')][_0x9a2e('0x46')]?_0xb86448['attributes']:_0x37c342['model'];_0xb86448[_0x9a2e('0x5d')]=qs[_0x9a2e('0x49')](_0x5864eb[_0x9a2e('0x40')][_0x9a2e('0x49')]);_0xb86448[_0x9a2e('0x4a')]=qs[_0x9a2e('0x42')](_[_0x9a2e('0x4b')](_0x5864eb[_0x9a2e('0x40')],_0x37c342[_0x9a2e('0x42')]));if(_0x5864eb['query']['filter']){_0xb86448[_0x9a2e('0x4a')]=_[_0x9a2e('0x4d')](_0xb86448[_0x9a2e('0x4a')],{'$or':_[_0x9a2e('0x3b')](_0xb86448[_0x9a2e('0x44')],function(_0x2a9160){var _0x5cccf9={};_0x5cccf9[_0x2a9160]={'$like':'%'+_0x5864eb[_0x9a2e('0x40')][_0x9a2e('0x4c')]+'%'};return _0x5cccf9;})});}_0xb86448=_[_0x9a2e('0x4d')]({},_0xb86448,_0x5864eb['options']);return _0xcf2e7a[_0x9a2e('0x5b')](_0xb86448);}})[_0x9a2e('0x35')](function(_0x13ae24){if(_0x13ae24){_0x2367d0=_0x13ae24[_0x9a2e('0x46')];if(!_0x5864eb[_0x9a2e('0x40')][_0x9a2e('0x5e')]('nolimit')){_0xb86448[_0x9a2e('0x48')]=qs[_0x9a2e('0x48')](_0x5864eb[_0x9a2e('0x40')][_0x9a2e('0x48')]);_0xb86448[_0x9a2e('0x2f')]=qs[_0x9a2e('0x2f')](_0x5864eb['query'][_0x9a2e('0x2f')]);}return _0xcf2e7a['getFields'](_0xb86448);}})[_0x9a2e('0x35')](function(_0x14477b){if(_0x14477b){return _0x14477b?{'count':_0x2367d0,'rows':_0x14477b}:null;}})[_0x9a2e('0x35')](respondWithResult(_0xbae5e2,null))[_0x9a2e('0x29')](handleError(_0xbae5e2,null));};exports['getSubjects']=function(_0x44f7f4,_0x6ac98d,_0x43480e){var _0x62d65={};var _0x1af339={};var _0x2d6be3;var _0x410a28;return db[_0x9a2e('0x4f')][_0x9a2e('0x5f')]({'where':{'id':_0x44f7f4[_0x9a2e('0x54')]['id']}})[_0x9a2e('0x35')](handleEntityNotFound(_0x6ac98d,null))['then'](function(_0x27d715){if(_0x27d715){_0x2d6be3=_0x27d715;_0x1af339['model']=_[_0x9a2e('0x41')](db['SugarcrmField'][_0x9a2e('0x55')]);_0x1af339[_0x9a2e('0x40')]=_['keys'](_0x44f7f4[_0x9a2e('0x40')]);_0x1af339['filters']=_[_0x9a2e('0x43')](_0x1af339[_0x9a2e('0x3f')],_0x1af339[_0x9a2e('0x40')]);_0x62d65[_0x9a2e('0x44')]=_[_0x9a2e('0x43')](_0x1af339[_0x9a2e('0x3f')],qs[_0x9a2e('0x45')](_0x44f7f4['query'][_0x9a2e('0x45')]));_0x62d65[_0x9a2e('0x44')]=_0x62d65[_0x9a2e('0x44')][_0x9a2e('0x46')]?_0x62d65[_0x9a2e('0x44')]:_0x1af339[_0x9a2e('0x3f')];_0x62d65['order']=qs[_0x9a2e('0x49')](_0x44f7f4['query'][_0x9a2e('0x49')]);_0x62d65['where']=qs[_0x9a2e('0x42')](_[_0x9a2e('0x4b')](_0x44f7f4[_0x9a2e('0x40')],_0x1af339['filters']));if(_0x44f7f4[_0x9a2e('0x40')][_0x9a2e('0x4c')]){_0x62d65['where']=_[_0x9a2e('0x4d')](_0x62d65[_0x9a2e('0x4a')],{'$or':_[_0x9a2e('0x3b')](_0x62d65['attributes'],function(_0x47c8e0){var _0x13b147={};_0x13b147[_0x47c8e0]={'$like':'%'+_0x44f7f4[_0x9a2e('0x40')][_0x9a2e('0x4c')]+'%'};return _0x13b147;})});}_0x62d65=_['merge']({},_0x62d65,_0x44f7f4['options']);return _0x2d6be3[_0x9a2e('0x60')](_0x62d65);}})['then'](function(_0x7dfc1c){if(_0x7dfc1c){_0x410a28=_0x7dfc1c['length'];if(!_0x44f7f4[_0x9a2e('0x40')][_0x9a2e('0x5e')](_0x9a2e('0x47'))){_0x62d65[_0x9a2e('0x48')]=qs[_0x9a2e('0x48')](_0x44f7f4['query']['limit']);_0x62d65['offset']=qs['offset'](_0x44f7f4[_0x9a2e('0x40')]['offset']);}return _0x2d6be3[_0x9a2e('0x60')](_0x62d65);}})[_0x9a2e('0x35')](function(_0x280dc1){if(_0x280dc1){return _0x280dc1?{'count':_0x410a28,'rows':_0x280dc1}:null;}})[_0x9a2e('0x35')](respondWithResult(_0x6ac98d,null))[_0x9a2e('0x29')](handleError(_0x6ac98d,null));};exports[_0x9a2e('0x61')]=function(_0x2b305f,_0x980f86,_0x306f8b){var _0x1ae316={};var _0x223422={};var _0x25c8f1;var _0x28e5d3;return db[_0x9a2e('0x4f')][_0x9a2e('0x5f')]({'where':{'id':_0x2b305f['params']['id']}})[_0x9a2e('0x35')](handleEntityNotFound(_0x980f86,null))['then'](function(_0x2e782c){if(_0x2e782c){_0x25c8f1=_0x2e782c;_0x223422['model']=_['keys'](db[_0x9a2e('0x5c')]['rawAttributes']);_0x223422[_0x9a2e('0x40')]=_[_0x9a2e('0x41')](_0x2b305f[_0x9a2e('0x40')]);_0x223422['filters']=_[_0x9a2e('0x43')](_0x223422[_0x9a2e('0x3f')],_0x223422[_0x9a2e('0x40')]);_0x1ae316[_0x9a2e('0x44')]=_['intersection'](_0x223422[_0x9a2e('0x3f')],qs[_0x9a2e('0x45')](_0x2b305f['query'][_0x9a2e('0x45')]));_0x1ae316['attributes']=_0x1ae316[_0x9a2e('0x44')][_0x9a2e('0x46')]?_0x1ae316[_0x9a2e('0x44')]:_0x223422[_0x9a2e('0x3f')];_0x1ae316['order']=qs[_0x9a2e('0x49')](_0x2b305f[_0x9a2e('0x40')][_0x9a2e('0x49')]);_0x1ae316[_0x9a2e('0x4a')]=qs[_0x9a2e('0x42')](_['pick'](_0x2b305f[_0x9a2e('0x40')],_0x223422[_0x9a2e('0x42')]));if(_0x2b305f[_0x9a2e('0x40')][_0x9a2e('0x4c')]){_0x1ae316[_0x9a2e('0x4a')]=_[_0x9a2e('0x4d')](_0x1ae316[_0x9a2e('0x4a')],{'$or':_[_0x9a2e('0x3b')](_0x1ae316['attributes'],function(_0x50e916){var _0x4551c1={};_0x4551c1[_0x50e916]={'$like':'%'+_0x2b305f[_0x9a2e('0x40')][_0x9a2e('0x4c')]+'%'};return _0x4551c1;})});}_0x1ae316=_['merge']({},_0x1ae316,_0x2b305f['options']);return _0x25c8f1[_0x9a2e('0x61')](_0x1ae316);}})['then'](function(_0xf52195){if(_0xf52195){_0x28e5d3=_0xf52195[_0x9a2e('0x46')];if(!_0x2b305f[_0x9a2e('0x40')][_0x9a2e('0x5e')](_0x9a2e('0x47'))){_0x1ae316[_0x9a2e('0x48')]=qs[_0x9a2e('0x48')](_0x2b305f['query'][_0x9a2e('0x48')]);_0x1ae316[_0x9a2e('0x2f')]=qs[_0x9a2e('0x2f')](_0x2b305f[_0x9a2e('0x40')][_0x9a2e('0x2f')]);}return _0x25c8f1['getDescriptions'](_0x1ae316);}})['then'](function(_0x3d4793){if(_0x3d4793){return _0x3d4793?{'count':_0x28e5d3,'rows':_0x3d4793}:null;}})[_0x9a2e('0x35')](respondWithResult(_0x980f86,null))[_0x9a2e('0x29')](handleError(_0x980f86,null));}; \ No newline at end of file +var _0x7669=['include','find','catch','create','body','destroy','getFields','SugarcrmField','order','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','count','offset','limit','set','Content-Range','reject','save','update','sendStatus','stack','name','map','SugarcrmConfiguration','rawAttributes','keys','filters','query','attributes','model','fields','length','sort','pick','where','type','filter','merge','options','includeAll','findAll','show','params','intersection'];(function(_0x58e475,_0x359ff1){var _0x520403=function(_0x556cca){while(--_0x556cca){_0x58e475['push'](_0x58e475['shift']());}};_0x520403(++_0x359ff1);}(_0x7669,0x68));var _0x9766=function(_0xa91af9,_0x475d5d){_0xa91af9=_0xa91af9-0x0;var _0x493ce3=_0x7669[_0xa91af9];return _0x493ce3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9766('0x0'));var zipdir=require(_0x9766('0x1'));var jsonpatch=require(_0x9766('0x2'));var rp=require(_0x9766('0x3'));var moment=require('moment');var BPromise=require(_0x9766('0x4'));var Mustache=require(_0x9766('0x5'));var util=require(_0x9766('0x6'));var path=require(_0x9766('0x7'));var sox=require(_0x9766('0x8'));var csv=require(_0x9766('0x9'));var ejs=require(_0x9766('0xa'));var fs=require('fs');var _=require(_0x9766('0xb'));var squel=require(_0x9766('0xc'));var crypto=require(_0x9766('0xd'));var jsforce=require(_0x9766('0xe'));var deskjs=require(_0x9766('0xf'));var toCsv=require(_0x9766('0x9'));var querystring=require(_0x9766('0x10'));var Papa=require(_0x9766('0x11'));var Redis=require(_0x9766('0x12'));var authService=require(_0x9766('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9766('0x14'));var hardwareService=require(_0x9766('0x15'));var logger=require(_0x9766('0x16'))(_0x9766('0x17'));var utils=require(_0x9766('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x9766('0x19'));var client=jayson[_0x9766('0x1a')][_0x9766('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4dfe0d,_0x4bac2d,_0x18488a){if(_0x18488a){var _0x2b0837=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b0837[_0x9766('0x1c')](_0x4bac2d)){return _0x4dfe0d;}else{throw new db[(_0x9766('0x1d'))][(_0x9766('0x1e'))](_0x9766('0x1f'));}}else{return _0x4dfe0d;}}function respondWithRpcPromise(_0x152553,_0x56b517,_0x195d33,_0x496190){return new BPromise(function(_0x10b1f6,_0x3e33c9){var _0x1a4495=_0x496190||client;return _0x1a4495['request'](_0x152553,_0x195d33)[_0x9766('0x20')](function(_0x40608e){logger[_0x9766('0x21')](_0x9766('0x22'),_0x56b517,_0x9766('0x23'));logger['debug'](_0x9766('0x24'),_0x56b517,'request\x20sent',JSON[_0x9766('0x25')](_0x40608e));if(_0x40608e[_0x9766('0x26')]){if(_0x40608e[_0x9766('0x26')][_0x9766('0x27')]===0x1f4){logger[_0x9766('0x26')](_0x9766('0x22'),_0x56b517,_0x40608e[_0x9766('0x26')][_0x9766('0x28')]);return _0x3e33c9(_0x40608e[_0x9766('0x26')][_0x9766('0x28')]);}logger['error'](_0x9766('0x22'),_0x56b517,_0x40608e[_0x9766('0x26')][_0x9766('0x28')]);return _0x10b1f6(_0x40608e[_0x9766('0x26')][_0x9766('0x28')]);}else{logger[_0x9766('0x21')](_0x9766('0x22'),_0x56b517,_0x9766('0x23'));_0x10b1f6(_0x40608e['result'][_0x9766('0x28')]);}})['catch'](function(_0x3626e3){logger['error'](_0x9766('0x22'),_0x56b517,_0x3626e3);_0x3e33c9(_0x3626e3);});});}function respondWithStatusCode(_0x2c987b,_0x1df2bd){_0x1df2bd=_0x1df2bd||0xcc;return function(_0x32c391){if(_0x32c391){return _0x2c987b['sendStatus'](_0x1df2bd);}return _0x2c987b[_0x9766('0x29')](_0x1df2bd)[_0x9766('0x2a')]();};}function respondWithResult(_0x515d60,_0x1cb998){_0x1cb998=_0x1cb998||0xc8;return function(_0x2c2390){if(_0x2c2390){return _0x515d60[_0x9766('0x29')](_0x1cb998)['json'](_0x2c2390);}};}function respondWithFilteredResult(_0x300743,_0x4e8a54){return function(_0x278c05){if(_0x278c05){var _0x41df15=_0x278c05[_0x9766('0x2b')],_0xc7e1d3=_0x4e8a54[_0x9766('0x2c')],_0x518a87=_0x4e8a54['offset']+_0x4e8a54[_0x9766('0x2d')],_0x2ad78e;if(_0x518a87>=_0x41df15){_0x518a87=_0x41df15;_0x2ad78e=0xc8;}else{_0x2ad78e=0xce;}_0x300743[_0x9766('0x29')](_0x2ad78e);return _0x300743[_0x9766('0x2e')](_0x9766('0x2f'),_0xc7e1d3+'-'+_0x518a87+'/'+_0x41df15)['json'](_0x278c05);}return null;};}function patchUpdates(_0x3e3c56){return function(_0x1b80ed){try{jsonpatch['apply'](_0x1b80ed,_0x3e3c56,!![]);}catch(_0x2b817c){return BPromise[_0x9766('0x30')](_0x2b817c);}return _0x1b80ed[_0x9766('0x31')]();};}function saveUpdates(_0x2c65ed,_0x28666a){return function(_0x249533){if(_0x249533){return _0x249533[_0x9766('0x32')](_0x2c65ed)[_0x9766('0x20')](function(_0x11f0fc){return _0x11f0fc;});}return null;};}function removeEntity(_0xbfb325,_0x513e6c){return function(_0xaa0eaf){if(_0xaa0eaf){return _0xaa0eaf['destroy']()[_0x9766('0x20')](function(){_0xbfb325[_0x9766('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3abb,_0x1eb9a7){return function(_0x43079f){if(!_0x43079f){_0x5b3abb[_0x9766('0x33')](0x194);}return _0x43079f;};}function handleError(_0x12c8ad,_0x167e54){_0x167e54=_0x167e54||0x1f4;return function(_0x5669b1){logger['error'](_0x5669b1[_0x9766('0x34')]);if(_0x5669b1[_0x9766('0x35')]){delete _0x5669b1[_0x9766('0x35')];}_0x12c8ad[_0x9766('0x29')](_0x167e54)['send'](_0x5669b1);};}exports['index']=function(_0x150028,_0x102290){var _0x394633={},_0x297c67={},_0x2d6483={'count':0x0,'rows':[]};var _0x595c1d=_[_0x9766('0x36')](db[_0x9766('0x37')][_0x9766('0x38')],function(_0x1ffa46){return{'name':_0x1ffa46['fieldName'],'type':_0x1ffa46['type']['key']};});_0x297c67['model']=_[_0x9766('0x36')](_0x595c1d,_0x9766('0x35'));_0x297c67['query']=_[_0x9766('0x39')](_0x150028['query']);_0x297c67[_0x9766('0x3a')]=_['intersection'](_0x297c67['model'],_0x297c67[_0x9766('0x3b')]);_0x394633[_0x9766('0x3c')]=_['intersection'](_0x297c67[_0x9766('0x3d')],qs[_0x9766('0x3e')](_0x150028['query'][_0x9766('0x3e')]));_0x394633[_0x9766('0x3c')]=_0x394633[_0x9766('0x3c')][_0x9766('0x3f')]?_0x394633[_0x9766('0x3c')]:_0x297c67[_0x9766('0x3d')];if(!_0x150028[_0x9766('0x3b')]['hasOwnProperty']('nolimit')){_0x394633[_0x9766('0x2d')]=qs['limit'](_0x150028['query'][_0x9766('0x2d')]);_0x394633[_0x9766('0x2c')]=qs[_0x9766('0x2c')](_0x150028['query'][_0x9766('0x2c')]);}_0x394633['order']=qs[_0x9766('0x40')](_0x150028['query']['sort']);_0x394633['where']=qs[_0x9766('0x3a')](_[_0x9766('0x41')](_0x150028[_0x9766('0x3b')],_0x297c67[_0x9766('0x3a')]),_0x595c1d);if(_0x150028[_0x9766('0x3b')]['filter']){_0x394633[_0x9766('0x42')]=_['merge'](_0x394633['where'],{'$or':_[_0x9766('0x36')](_0x595c1d,function(_0x5a557a){if(_0x5a557a[_0x9766('0x43')]!=='VIRTUAL'){var _0x145e77={};_0x145e77[_0x5a557a[_0x9766('0x35')]]={'$like':'%'+_0x150028['query'][_0x9766('0x44')]+'%'};return _0x145e77;}})});}_0x394633=_[_0x9766('0x45')]({},_0x394633,_0x150028[_0x9766('0x46')]);var _0x3a6f34={'where':_0x394633[_0x9766('0x42')]};return db[_0x9766('0x37')][_0x9766('0x2b')](_0x3a6f34)['then'](function(_0x482402){_0x2d6483[_0x9766('0x2b')]=_0x482402;if(_0x150028['query'][_0x9766('0x47')]){_0x394633['include']=[{'all':!![]}];}return db[_0x9766('0x37')][_0x9766('0x48')](_0x394633);})['then'](function(_0x5df68d){_0x2d6483['rows']=_0x5df68d;return _0x2d6483;})[_0x9766('0x20')](respondWithFilteredResult(_0x102290,_0x394633))['catch'](handleError(_0x102290,null));};exports[_0x9766('0x49')]=function(_0x5b3004,_0x2037ea){var _0x49992b={'raw':![],'where':{'id':_0x5b3004[_0x9766('0x4a')]['id']}},_0x51213f={};_0x51213f[_0x9766('0x3d')]=_[_0x9766('0x39')](db[_0x9766('0x37')][_0x9766('0x38')]);_0x51213f[_0x9766('0x3b')]=_['keys'](_0x5b3004[_0x9766('0x3b')]);_0x51213f['filters']=_[_0x9766('0x4b')](_0x51213f[_0x9766('0x3d')],_0x51213f[_0x9766('0x3b')]);_0x49992b[_0x9766('0x3c')]=_[_0x9766('0x4b')](_0x51213f['model'],qs[_0x9766('0x3e')](_0x5b3004[_0x9766('0x3b')][_0x9766('0x3e')]));_0x49992b[_0x9766('0x3c')]=_0x49992b[_0x9766('0x3c')][_0x9766('0x3f')]?_0x49992b[_0x9766('0x3c')]:_0x51213f['model'];if(_0x5b3004[_0x9766('0x3b')][_0x9766('0x47')]){_0x49992b[_0x9766('0x4c')]=[{'all':!![]}];}_0x49992b=_[_0x9766('0x45')]({},_0x49992b,_0x5b3004[_0x9766('0x46')]);return db[_0x9766('0x37')][_0x9766('0x4d')](_0x49992b)[_0x9766('0x20')](handleEntityNotFound(_0x2037ea,null))[_0x9766('0x20')](respondWithResult(_0x2037ea,null))[_0x9766('0x4e')](handleError(_0x2037ea,null));};exports[_0x9766('0x4f')]=function(_0x3396a2,_0x3ad23e){return db[_0x9766('0x37')][_0x9766('0x4f')](_0x3396a2['body'],{})[_0x9766('0x20')](respondWithResult(_0x3ad23e,0xc9))[_0x9766('0x4e')](handleError(_0x3ad23e,null));};exports[_0x9766('0x32')]=function(_0xd434fd,_0x2d54f4){if(_0xd434fd[_0x9766('0x50')]['id']){delete _0xd434fd[_0x9766('0x50')]['id'];}return db[_0x9766('0x37')][_0x9766('0x4d')]({'where':{'id':_0xd434fd[_0x9766('0x4a')]['id']}})[_0x9766('0x20')](handleEntityNotFound(_0x2d54f4,null))[_0x9766('0x20')](saveUpdates(_0xd434fd['body'],null))[_0x9766('0x20')](respondWithResult(_0x2d54f4,null))[_0x9766('0x4e')](handleError(_0x2d54f4,null));};exports[_0x9766('0x51')]=function(_0xfc6a21,_0x2b8189){return db['SugarcrmConfiguration'][_0x9766('0x4d')]({'where':{'id':_0xfc6a21[_0x9766('0x4a')]['id']}})[_0x9766('0x20')](handleEntityNotFound(_0x2b8189,null))['then'](removeEntity(_0x2b8189,null))[_0x9766('0x4e')](handleError(_0x2b8189,null));};exports[_0x9766('0x52')]=function(_0x21ac11,_0x3e2252,_0x53e0a1){var _0x184226={};var _0x275f02={};var _0x3505cd;var _0x12eb4d;return db[_0x9766('0x37')]['findOne']({'where':{'id':_0x21ac11[_0x9766('0x4a')]['id']}})[_0x9766('0x20')](handleEntityNotFound(_0x3e2252,null))[_0x9766('0x20')](function(_0x5e23d0){if(_0x5e23d0){_0x3505cd=_0x5e23d0;_0x275f02[_0x9766('0x3d')]=_[_0x9766('0x39')](db[_0x9766('0x53')][_0x9766('0x38')]);_0x275f02[_0x9766('0x3b')]=_[_0x9766('0x39')](_0x21ac11[_0x9766('0x3b')]);_0x275f02[_0x9766('0x3a')]=_[_0x9766('0x4b')](_0x275f02[_0x9766('0x3d')],_0x275f02['query']);_0x184226[_0x9766('0x3c')]=_[_0x9766('0x4b')](_0x275f02[_0x9766('0x3d')],qs['fields'](_0x21ac11[_0x9766('0x3b')][_0x9766('0x3e')]));_0x184226['attributes']=_0x184226['attributes'][_0x9766('0x3f')]?_0x184226[_0x9766('0x3c')]:_0x275f02['model'];_0x184226[_0x9766('0x54')]=qs[_0x9766('0x40')](_0x21ac11[_0x9766('0x3b')][_0x9766('0x40')]);_0x184226['where']=qs[_0x9766('0x3a')](_[_0x9766('0x41')](_0x21ac11[_0x9766('0x3b')],_0x275f02['filters']));if(_0x21ac11[_0x9766('0x3b')][_0x9766('0x44')]){_0x184226[_0x9766('0x42')]=_['merge'](_0x184226['where'],{'$or':_[_0x9766('0x36')](_0x184226[_0x9766('0x3c')],function(_0x5a4970){var _0x18e30b={};_0x18e30b[_0x5a4970]={'$like':'%'+_0x21ac11[_0x9766('0x3b')][_0x9766('0x44')]+'%'};return _0x18e30b;})});}_0x184226=_['merge']({},_0x184226,_0x21ac11[_0x9766('0x46')]);return _0x3505cd['getFields'](_0x184226);}})['then'](function(_0xbe9b55){if(_0xbe9b55){_0x12eb4d=_0xbe9b55[_0x9766('0x3f')];if(!_0x21ac11[_0x9766('0x3b')][_0x9766('0x55')](_0x9766('0x56'))){_0x184226['limit']=qs[_0x9766('0x2d')](_0x21ac11[_0x9766('0x3b')]['limit']);_0x184226['offset']=qs[_0x9766('0x2c')](_0x21ac11[_0x9766('0x3b')][_0x9766('0x2c')]);}return _0x3505cd[_0x9766('0x52')](_0x184226);}})[_0x9766('0x20')](function(_0x37ea6f){if(_0x37ea6f){return _0x37ea6f?{'count':_0x12eb4d,'rows':_0x37ea6f}:null;}})[_0x9766('0x20')](respondWithResult(_0x3e2252,null))[_0x9766('0x4e')](handleError(_0x3e2252,null));};exports['getSubjects']=function(_0x568187,_0x27ad8a,_0x315858){var _0x236096={};var _0x256399={};var _0x3ab83d;var _0x3ee240;return db[_0x9766('0x37')][_0x9766('0x57')]({'where':{'id':_0x568187[_0x9766('0x4a')]['id']}})[_0x9766('0x20')](handleEntityNotFound(_0x27ad8a,null))[_0x9766('0x20')](function(_0x2e4a55){if(_0x2e4a55){_0x3ab83d=_0x2e4a55;_0x256399[_0x9766('0x3d')]=_['keys'](db[_0x9766('0x53')][_0x9766('0x38')]);_0x256399[_0x9766('0x3b')]=_['keys'](_0x568187[_0x9766('0x3b')]);_0x256399['filters']=_[_0x9766('0x4b')](_0x256399[_0x9766('0x3d')],_0x256399['query']);_0x236096['attributes']=_[_0x9766('0x4b')](_0x256399[_0x9766('0x3d')],qs['fields'](_0x568187[_0x9766('0x3b')][_0x9766('0x3e')]));_0x236096[_0x9766('0x3c')]=_0x236096['attributes'][_0x9766('0x3f')]?_0x236096[_0x9766('0x3c')]:_0x256399[_0x9766('0x3d')];_0x236096['order']=qs[_0x9766('0x40')](_0x568187[_0x9766('0x3b')][_0x9766('0x40')]);_0x236096[_0x9766('0x42')]=qs[_0x9766('0x3a')](_[_0x9766('0x41')](_0x568187[_0x9766('0x3b')],_0x256399[_0x9766('0x3a')]));if(_0x568187[_0x9766('0x3b')]['filter']){_0x236096[_0x9766('0x42')]=_[_0x9766('0x45')](_0x236096[_0x9766('0x42')],{'$or':_['map'](_0x236096['attributes'],function(_0x50c63d){var _0x306ffb={};_0x306ffb[_0x50c63d]={'$like':'%'+_0x568187['query'][_0x9766('0x44')]+'%'};return _0x306ffb;})});}_0x236096=_[_0x9766('0x45')]({},_0x236096,_0x568187[_0x9766('0x46')]);return _0x3ab83d[_0x9766('0x58')](_0x236096);}})[_0x9766('0x20')](function(_0x1b989d){if(_0x1b989d){_0x3ee240=_0x1b989d[_0x9766('0x3f')];if(!_0x568187[_0x9766('0x3b')][_0x9766('0x55')](_0x9766('0x56'))){_0x236096['limit']=qs[_0x9766('0x2d')](_0x568187[_0x9766('0x3b')][_0x9766('0x2d')]);_0x236096[_0x9766('0x2c')]=qs[_0x9766('0x2c')](_0x568187[_0x9766('0x3b')][_0x9766('0x2c')]);}return _0x3ab83d[_0x9766('0x58')](_0x236096);}})[_0x9766('0x20')](function(_0x4e520f){if(_0x4e520f){return _0x4e520f?{'count':_0x3ee240,'rows':_0x4e520f}:null;}})[_0x9766('0x20')](respondWithResult(_0x27ad8a,null))['catch'](handleError(_0x27ad8a,null));};exports[_0x9766('0x59')]=function(_0x135d7e,_0x384bcb,_0x2298f8){var _0x430aee={};var _0x314ae1={};var _0x3f3fc6;var _0x39d333;return db['SugarcrmConfiguration'][_0x9766('0x57')]({'where':{'id':_0x135d7e['params']['id']}})['then'](handleEntityNotFound(_0x384bcb,null))[_0x9766('0x20')](function(_0x4b373d){if(_0x4b373d){_0x3f3fc6=_0x4b373d;_0x314ae1[_0x9766('0x3d')]=_[_0x9766('0x39')](db['SugarcrmField']['rawAttributes']);_0x314ae1[_0x9766('0x3b')]=_[_0x9766('0x39')](_0x135d7e[_0x9766('0x3b')]);_0x314ae1[_0x9766('0x3a')]=_[_0x9766('0x4b')](_0x314ae1[_0x9766('0x3d')],_0x314ae1[_0x9766('0x3b')]);_0x430aee[_0x9766('0x3c')]=_[_0x9766('0x4b')](_0x314ae1[_0x9766('0x3d')],qs['fields'](_0x135d7e['query'][_0x9766('0x3e')]));_0x430aee['attributes']=_0x430aee[_0x9766('0x3c')][_0x9766('0x3f')]?_0x430aee[_0x9766('0x3c')]:_0x314ae1['model'];_0x430aee['order']=qs[_0x9766('0x40')](_0x135d7e[_0x9766('0x3b')]['sort']);_0x430aee['where']=qs['filters'](_['pick'](_0x135d7e[_0x9766('0x3b')],_0x314ae1[_0x9766('0x3a')]));if(_0x135d7e['query'][_0x9766('0x44')]){_0x430aee[_0x9766('0x42')]=_[_0x9766('0x45')](_0x430aee['where'],{'$or':_[_0x9766('0x36')](_0x430aee[_0x9766('0x3c')],function(_0x1a1ab3){var _0x2d79aa={};_0x2d79aa[_0x1a1ab3]={'$like':'%'+_0x135d7e[_0x9766('0x3b')][_0x9766('0x44')]+'%'};return _0x2d79aa;})});}_0x430aee=_['merge']({},_0x430aee,_0x135d7e['options']);return _0x3f3fc6[_0x9766('0x59')](_0x430aee);}})[_0x9766('0x20')](function(_0x30d637){if(_0x30d637){_0x39d333=_0x30d637[_0x9766('0x3f')];if(!_0x135d7e[_0x9766('0x3b')][_0x9766('0x55')](_0x9766('0x56'))){_0x430aee['limit']=qs[_0x9766('0x2d')](_0x135d7e[_0x9766('0x3b')][_0x9766('0x2d')]);_0x430aee[_0x9766('0x2c')]=qs[_0x9766('0x2c')](_0x135d7e[_0x9766('0x3b')][_0x9766('0x2c')]);}return _0x3f3fc6[_0x9766('0x59')](_0x430aee);}})[_0x9766('0x20')](function(_0xef6e77){if(_0xef6e77){return _0xef6e77?{'count':_0x39d333,'rows':_0xef6e77}:null;}})['then'](respondWithResult(_0x384bcb,null))[_0x9766('0x4e')](handleError(_0x384bcb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6bcd7a1..4c7694d 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 _0x4d86=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','lodash'];(function(_0x52b62b,_0x1100cd){var _0x3d14d0=function(_0x1b5ef7){while(--_0x1b5ef7){_0x52b62b['push'](_0x52b62b['shift']());}};_0x3d14d0(++_0x1100cd);}(_0x4d86,0x15e));var _0x64d8=function(_0x5bf344,_0x220bfb){_0x5bf344=_0x5bf344-0x0;var _0x4fa4d9=_0x4d86[_0x5bf344];return _0x4fa4d9;};'use strict';var _=require(_0x64d8('0x0'));var util=require(_0x64d8('0x1'));var logger=require(_0x64d8('0x2'))('api');var moment=require(_0x64d8('0x3'));var BPromise=require(_0x64d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x64d8('0x5'));var config=require(_0x64d8('0x6'));var attributes=require(_0x64d8('0x7'));module['exports']=function(_0x3a15e8,_0x39adf4){return _0x3a15e8['define'](_0x64d8('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b63=['SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1168c2,_0x1ed2ce){var _0x5ab8b5=function(_0x49bca8){while(--_0x49bca8){_0x1168c2['push'](_0x1168c2['shift']());}};_0x5ab8b5(++_0x1ed2ce);}(_0x6b63,0x1b1));var _0x36b6=function(_0x15052d,_0x2407c6){_0x15052d=_0x15052d-0x0;var _0x154cc2=_0x6b63[_0x15052d];return _0x154cc2;};'use strict';var _=require(_0x36b6('0x0'));var util=require(_0x36b6('0x1'));var logger=require(_0x36b6('0x2'))(_0x36b6('0x3'));var moment=require(_0x36b6('0x4'));var BPromise=require(_0x36b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36b6('0x6'));var rimraf=require(_0x36b6('0x7'));var config=require(_0x36b6('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x36b6('0x9')]=function(_0x234778,_0x505a45){return _0x234778[_0x36b6('0xa')](_0x36b6('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index b562a0b..b97cdfd 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 _0xfa6a=['../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5e6487,_0x2718b8){var _0x70c092=function(_0x16300f){while(--_0x16300f){_0x5e6487['push'](_0x5e6487['shift']());}};_0x70c092(++_0x2718b8);}(_0xfa6a,0x8d));var _0xafa6=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xfa6a[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xafa6('0x0'));var util=require(_0xafa6('0x1'));var moment=require(_0xafa6('0x2'));var BPromise=require(_0xafa6('0x3'));var rs=require(_0xafa6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafa6('0x5'))['db'];var utils=require(_0xafa6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xafa6('0x7'));var jayson=require(_0xafa6('0x8'));var client=jayson[_0xafa6('0x9')][_0xafa6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c56c6,_0x56f10f,_0x2e5b24){return new BPromise(function(_0x108970,_0x51606b){return client['request'](_0x1c56c6,_0x2e5b24)[_0xafa6('0xb')](function(_0x2cbf4b){logger[_0xafa6('0xc')](_0xafa6('0xd'),_0x56f10f,'request\x20sent');logger[_0xafa6('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x56f10f,_0xafa6('0xf'),JSON[_0xafa6('0x10')](_0x2cbf4b));if(_0x2cbf4b[_0xafa6('0x11')]){if(_0x2cbf4b['error'][_0xafa6('0x12')]===0x1f4){logger['error'](_0xafa6('0xd'),_0x56f10f,_0x2cbf4b['error'][_0xafa6('0x13')]);return _0x51606b(_0x2cbf4b[_0xafa6('0x11')][_0xafa6('0x13')]);}logger['error'](_0xafa6('0xd'),_0x56f10f,_0x2cbf4b[_0xafa6('0x11')][_0xafa6('0x13')]);return _0x108970(_0x2cbf4b[_0xafa6('0x11')]['message']);}else{logger['info'](_0xafa6('0xd'),_0x56f10f,_0xafa6('0xf'));_0x108970(_0x2cbf4b['result']['message']);}})[_0xafa6('0x14')](function(_0x36b5f2){logger[_0xafa6('0x11')](_0xafa6('0xd'),_0x56f10f,_0x36b5f2);_0x51606b(_0x36b5f2);});});} \ No newline at end of file +var _0x4787=['stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4787,0xa8));var _0x7478=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x4787[_0x494d1f];return _0x457b6e;};'use strict';var _=require('lodash');var util=require(_0x7478('0x0'));var moment=require(_0x7478('0x1'));var BPromise=require(_0x7478('0x2'));var rs=require(_0x7478('0x3'));var fs=require('fs');var Redis=require(_0x7478('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7478('0x5'));var logger=require(_0x7478('0x6'))(_0x7478('0x7'));var config=require('../../config/environment');var jayson=require(_0x7478('0x8'));var client=jayson[_0x7478('0x9')][_0x7478('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19ceb7,_0x2c7502,_0x5753ad){return new BPromise(function(_0x37cb8f,_0x1e3824){return client[_0x7478('0xb')](_0x19ceb7,_0x5753ad)[_0x7478('0xc')](function(_0x531d8d){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c7502,_0x7478('0xd'));logger[_0x7478('0xe')](_0x7478('0xf'),_0x2c7502,_0x7478('0xd'),JSON[_0x7478('0x10')](_0x531d8d));if(_0x531d8d[_0x7478('0x11')]){if(_0x531d8d[_0x7478('0x11')][_0x7478('0x12')]===0x1f4){logger[_0x7478('0x11')](_0x7478('0x13'),_0x2c7502,_0x531d8d[_0x7478('0x11')][_0x7478('0x14')]);return _0x1e3824(_0x531d8d['error'][_0x7478('0x14')]);}logger['error'](_0x7478('0x13'),_0x2c7502,_0x531d8d[_0x7478('0x11')][_0x7478('0x14')]);return _0x37cb8f(_0x531d8d[_0x7478('0x11')][_0x7478('0x14')]);}else{logger['info'](_0x7478('0x13'),_0x2c7502,_0x7478('0xd'));_0x37cb8f(_0x531d8d[_0x7478('0x15')]['message']);}})[_0x7478('0x16')](function(_0x89b07b){logger[_0x7478('0x11')](_0x7478('0x13'),_0x2c7502,_0x89b07b);_0x1e3824(_0x89b07b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 06774e4..5cda0be 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 _0xd3c4=['../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5d2a16,_0x5ca1ca){var _0x2fd4b7=function(_0x1d4c8a){while(--_0x1d4c8a){_0x5d2a16['push'](_0x5d2a16['shift']());}};_0x2fd4b7(++_0x5ca1ca);}(_0xd3c4,0x78));var _0x4d3c=function(_0x4c202f,_0x4313d4){_0x4c202f=_0x4c202f-0x0;var _0x7b5f7=_0xd3c4[_0x4c202f];return _0x7b5f7;};'use strict';var multer=require(_0x4d3c('0x0'));var util=require(_0x4d3c('0x1'));var path=require(_0x4d3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d3c('0x3'));var router=express[_0x4d3c('0x4')]();var auth=require(_0x4d3c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d3c('0x6'));var controller=require(_0x4d3c('0x7'));router[_0x4d3c('0x8')]('/',auth[_0x4d3c('0x9')](),controller[_0x4d3c('0xa')]);router[_0x4d3c('0x8')](_0x4d3c('0xb'),auth['isAuthenticated'](),controller[_0x4d3c('0xc')]);router[_0x4d3c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4d3c('0xe')](_0x4d3c('0xb'),auth['isAuthenticated'](),controller[_0x4d3c('0xf')]);router[_0x4d3c('0x10')](_0x4d3c('0xb'),auth[_0x4d3c('0x9')](),controller['destroy']);module[_0x4d3c('0x11')]=router; \ No newline at end of file +var _0x0e6f=['/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x251f27,_0x1237bc){var _0x452654=function(_0x38cbf1){while(--_0x38cbf1){_0x251f27['push'](_0x251f27['shift']());}};_0x452654(++_0x1237bc);}(_0x0e6f,0x111));var _0xf0e6=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0x0e6f[_0x3c0cd6];return _0x4381ec;};'use strict';var multer=require(_0xf0e6('0x0'));var util=require(_0xf0e6('0x1'));var path=require(_0xf0e6('0x2'));var timeout=require(_0xf0e6('0x3'));var express=require('express');var router=express[_0xf0e6('0x4')]();var auth=require(_0xf0e6('0x5'));var interaction=require(_0xf0e6('0x6'));var config=require(_0xf0e6('0x7'));var controller=require(_0xf0e6('0x8'));router[_0xf0e6('0x9')]('/',auth[_0xf0e6('0xa')](),controller[_0xf0e6('0xb')]);router[_0xf0e6('0x9')](_0xf0e6('0xc'),auth[_0xf0e6('0xa')](),controller[_0xf0e6('0xd')]);router['post']('/',auth[_0xf0e6('0xa')](),controller['create']);router[_0xf0e6('0xe')](_0xf0e6('0xc'),auth['isAuthenticated'](),controller[_0xf0e6('0xf')]);router[_0xf0e6('0x10')]('/:id',auth[_0xf0e6('0xa')](),controller[_0xf0e6('0x11')]);module[_0xf0e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 10eed6f..f073124 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 _0x09f4=['BOOLEAN','exports','ENUM','variable','customVariable','string','STRING'];(function(_0x505b1,_0x3f2a5d){var _0x6f5380=function(_0x439bda){while(--_0x439bda){_0x505b1['push'](_0x505b1['shift']());}};_0x6f5380(++_0x3f2a5d);}(_0x09f4,0x1a5));var _0x409f=function(_0x271aaf,_0xe30f46){_0x271aaf=_0x271aaf-0x0;var _0x5ad63f=_0x09f4[_0x271aaf];return _0x5ad63f;};'use strict';var Sequelize=require('sequelize');module[_0x409f('0x0')]={'type':{'type':Sequelize[_0x409f('0x1')]('string',_0x409f('0x2'),_0x409f('0x3'),'keyValue'),'defaultValue':_0x409f('0x4')},'content':{'type':Sequelize[_0x409f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x409f('0x1')](_0x409f('0x4'),_0x409f('0x2'),_0x409f('0x3'))},'keyContent':{'type':Sequelize[_0x409f('0x5')]},'idField':{'type':Sequelize[_0x409f('0x5')]},'nameField':{'type':Sequelize[_0x409f('0x5')]},'customField':{'type':Sequelize[_0x409f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x409f('0x5')]}}; \ No newline at end of file +var _0xe914=['exports','string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xe914,0x7f));var _0x4e91=function(_0x1654e,_0x31262b){_0x1654e=_0x1654e-0x0;var _0x544920=_0xe914[_0x1654e];return _0x544920;};'use strict';var Sequelize=require(_0x4e91('0x0'));module[_0x4e91('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4e91('0x2'),_0x4e91('0x3'),_0x4e91('0x4'),_0x4e91('0x5')),'defaultValue':_0x4e91('0x2')},'content':{'type':Sequelize[_0x4e91('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4e91('0x7')](_0x4e91('0x2'),'variable',_0x4e91('0x4'))},'keyContent':{'type':Sequelize[_0x4e91('0x6')]},'idField':{'type':Sequelize[_0x4e91('0x6')]},'nameField':{'type':Sequelize[_0x4e91('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 86111c1..f7aa858 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 _0x21a1=['where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','map','SugarcrmField','rawAttributes','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort'];(function(_0x4c62d4,_0x58c0b4){var _0x25c3f9=function(_0x821986){while(--_0x821986){_0x4c62d4['push'](_0x4c62d4['shift']());}};_0x25c3f9(++_0x58c0b4);}(_0x21a1,0x1b7));var _0x121a=function(_0x111256,_0x114397){_0x111256=_0x111256-0x0;var _0x2ab653=_0x21a1[_0x111256];return _0x2ab653;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x121a('0x0'));var rimraf=require(_0x121a('0x1'));var zipdir=require(_0x121a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x121a('0x3'));var Mustache=require(_0x121a('0x4'));var util=require(_0x121a('0x5'));var path=require(_0x121a('0x6'));var sox=require(_0x121a('0x7'));var csv=require('to-csv');var ejs=require(_0x121a('0x8'));var fs=require('fs');var _=require(_0x121a('0x9'));var squel=require(_0x121a('0xa'));var crypto=require(_0x121a('0xb'));var jsforce=require(_0x121a('0xc'));var deskjs=require(_0x121a('0xd'));var toCsv=require(_0x121a('0xe'));var querystring=require('querystring');var Papa=require(_0x121a('0xf'));var Redis=require('ioredis');var authService=require(_0x121a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x121a('0x11'))(_0x121a('0x12'));var utils=require(_0x121a('0x13'));var config=require(_0x121a('0x14'));var db=require(_0x121a('0x15'))['db'];function respondWithStatusCode(_0xf26ea,_0x34776b){_0x34776b=_0x34776b||0xcc;return function(_0x51bfa8){if(_0x51bfa8){return _0xf26ea[_0x121a('0x16')](_0x34776b);}return _0xf26ea[_0x121a('0x17')](_0x34776b)[_0x121a('0x18')]();};}function respondWithResult(_0x4ca12d,_0x47382d){_0x47382d=_0x47382d||0xc8;return function(_0x3921b2){if(_0x3921b2){return _0x4ca12d['status'](_0x47382d)[_0x121a('0x19')](_0x3921b2);}};}function respondWithFilteredResult(_0x1fff4c,_0x5846f6){return function(_0x1cda93){if(_0x1cda93){var _0xfde3d4=_0x1cda93[_0x121a('0x1a')],_0x36e8d3=_0x5846f6[_0x121a('0x1b')],_0x116ce3=_0x5846f6[_0x121a('0x1b')]+_0x5846f6[_0x121a('0x1c')],_0x5a23af;if(_0x116ce3>=_0xfde3d4){_0x116ce3=_0xfde3d4;_0x5a23af=0xc8;}else{_0x5a23af=0xce;}_0x1fff4c['status'](_0x5a23af);return _0x1fff4c['set'](_0x121a('0x1d'),_0x36e8d3+'-'+_0x116ce3+'/'+_0xfde3d4)[_0x121a('0x19')](_0x1cda93);}return null;};}function patchUpdates(_0x5e5390){return function(_0x39d195){try{jsonpatch[_0x121a('0x1e')](_0x39d195,_0x5e5390,!![]);}catch(_0x4560a4){return BPromise[_0x121a('0x1f')](_0x4560a4);}return _0x39d195[_0x121a('0x20')]();};}function saveUpdates(_0x3897ec,_0x3b5798){return function(_0xa897a0){if(_0xa897a0){return _0xa897a0[_0x121a('0x21')](_0x3897ec)['then'](function(_0x7f1fbd){return _0x7f1fbd;});}return null;};}function removeEntity(_0x798191,_0x10120e){return function(_0x117dc8){if(_0x117dc8){return _0x117dc8['destroy']()[_0x121a('0x22')](function(){_0x798191[_0x121a('0x17')](0xcc)[_0x121a('0x18')]();});}};}function handleEntityNotFound(_0x522b20,_0x75d389){return function(_0x517dce){if(!_0x517dce){_0x522b20[_0x121a('0x16')](0x194);}return _0x517dce;};}function handleError(_0x1f3cc4,_0x2c39b7){_0x2c39b7=_0x2c39b7||0x1f4;return function(_0x130941){logger['error'](_0x130941[_0x121a('0x23')]);if(_0x130941[_0x121a('0x24')]){delete _0x130941[_0x121a('0x24')];}_0x1f3cc4[_0x121a('0x17')](_0x2c39b7)[_0x121a('0x25')](_0x130941);};}exports['index']=function(_0x45c271,_0x44325c){var _0x2d0f36={},_0x1ad551={},_0x55120f={'count':0x0,'rows':[]};var _0x35164b=_[_0x121a('0x26')](db[_0x121a('0x27')][_0x121a('0x28')],function(_0x1fb39c){return{'name':_0x1fb39c['fieldName'],'type':_0x1fb39c['type'][_0x121a('0x29')]};});_0x1ad551['model']=_[_0x121a('0x26')](_0x35164b,_0x121a('0x24'));_0x1ad551[_0x121a('0x2a')]=_['keys'](_0x45c271[_0x121a('0x2a')]);_0x1ad551[_0x121a('0x2b')]=_[_0x121a('0x2c')](_0x1ad551[_0x121a('0x2d')],_0x1ad551[_0x121a('0x2a')]);_0x2d0f36[_0x121a('0x2e')]=_['intersection'](_0x1ad551[_0x121a('0x2d')],qs['fields'](_0x45c271[_0x121a('0x2a')][_0x121a('0x2f')]));_0x2d0f36['attributes']=_0x2d0f36[_0x121a('0x2e')]['length']?_0x2d0f36[_0x121a('0x2e')]:_0x1ad551['model'];if(!_0x45c271[_0x121a('0x2a')][_0x121a('0x30')]('nolimit')){_0x2d0f36['limit']=qs[_0x121a('0x1c')](_0x45c271[_0x121a('0x2a')][_0x121a('0x1c')]);_0x2d0f36[_0x121a('0x1b')]=qs[_0x121a('0x1b')](_0x45c271[_0x121a('0x2a')]['offset']);}_0x2d0f36[_0x121a('0x31')]=qs[_0x121a('0x32')](_0x45c271[_0x121a('0x2a')]['sort']);_0x2d0f36[_0x121a('0x33')]=qs[_0x121a('0x2b')](_[_0x121a('0x34')](_0x45c271['query'],_0x1ad551[_0x121a('0x2b')]),_0x35164b);if(_0x45c271[_0x121a('0x2a')][_0x121a('0x35')]){_0x2d0f36[_0x121a('0x33')]=_[_0x121a('0x36')](_0x2d0f36['where'],{'$or':_[_0x121a('0x26')](_0x35164b,function(_0x213ca5){if(_0x213ca5[_0x121a('0x37')]!=='VIRTUAL'){var _0x1cfb9c={};_0x1cfb9c[_0x213ca5[_0x121a('0x24')]]={'$like':'%'+_0x45c271[_0x121a('0x2a')]['filter']+'%'};return _0x1cfb9c;}})});}_0x2d0f36=_['merge']({},_0x2d0f36,_0x45c271[_0x121a('0x38')]);var _0x395099={'where':_0x2d0f36[_0x121a('0x33')]};return db[_0x121a('0x27')][_0x121a('0x1a')](_0x395099)[_0x121a('0x22')](function(_0x5af82d){_0x55120f[_0x121a('0x1a')]=_0x5af82d;if(_0x45c271['query'][_0x121a('0x39')]){_0x2d0f36[_0x121a('0x3a')]=[{'all':!![]}];}return db[_0x121a('0x27')][_0x121a('0x3b')](_0x2d0f36);})[_0x121a('0x22')](function(_0x5ae708){_0x55120f[_0x121a('0x3c')]=_0x5ae708;return _0x55120f;})[_0x121a('0x22')](respondWithFilteredResult(_0x44325c,_0x2d0f36))[_0x121a('0x3d')](handleError(_0x44325c,null));};exports[_0x121a('0x3e')]=function(_0x65f81a,_0xb3d3bf){var _0x1aabdb={'raw':!![],'where':{'id':_0x65f81a[_0x121a('0x3f')]['id']}},_0x230a63={};_0x230a63[_0x121a('0x2d')]=_[_0x121a('0x40')](db[_0x121a('0x27')][_0x121a('0x28')]);_0x230a63[_0x121a('0x2a')]=_[_0x121a('0x40')](_0x65f81a[_0x121a('0x2a')]);_0x230a63['filters']=_[_0x121a('0x2c')](_0x230a63[_0x121a('0x2d')],_0x230a63[_0x121a('0x2a')]);_0x1aabdb['attributes']=_[_0x121a('0x2c')](_0x230a63[_0x121a('0x2d')],qs[_0x121a('0x2f')](_0x65f81a['query']['fields']));_0x1aabdb['attributes']=_0x1aabdb['attributes'][_0x121a('0x41')]?_0x1aabdb[_0x121a('0x2e')]:_0x230a63['model'];if(_0x65f81a[_0x121a('0x2a')]['includeAll']){_0x1aabdb['include']=[{'all':!![]}];}_0x1aabdb=_[_0x121a('0x36')]({},_0x1aabdb,_0x65f81a[_0x121a('0x38')]);return db['SugarcrmField']['find'](_0x1aabdb)[_0x121a('0x22')](handleEntityNotFound(_0xb3d3bf,null))[_0x121a('0x22')](respondWithResult(_0xb3d3bf,null))[_0x121a('0x3d')](handleError(_0xb3d3bf,null));};exports[_0x121a('0x42')]=function(_0x594058,_0x1b4df4){return db[_0x121a('0x27')]['create'](_0x594058[_0x121a('0x43')],{})[_0x121a('0x22')](respondWithResult(_0x1b4df4,0xc9))[_0x121a('0x3d')](handleError(_0x1b4df4,null));};exports[_0x121a('0x21')]=function(_0x1e0045,_0x228f3b){if(_0x1e0045['body']['id']){delete _0x1e0045[_0x121a('0x43')]['id'];}return db[_0x121a('0x27')][_0x121a('0x44')]({'where':{'id':_0x1e0045[_0x121a('0x3f')]['id']}})[_0x121a('0x22')](handleEntityNotFound(_0x228f3b,null))[_0x121a('0x22')](saveUpdates(_0x1e0045[_0x121a('0x43')],null))[_0x121a('0x22')](respondWithResult(_0x228f3b,null))['catch'](handleError(_0x228f3b,null));};exports[_0x121a('0x45')]=function(_0x50aba7,_0x2e1cbf){return db[_0x121a('0x27')]['find']({'where':{'id':_0x50aba7[_0x121a('0x3f')]['id']}})[_0x121a('0x22')](handleEntityNotFound(_0x2e1cbf,null))[_0x121a('0x22')](removeEntity(_0x2e1cbf,null))[_0x121a('0x3d')](handleError(_0x2e1cbf,null));}; \ No newline at end of file +var _0xe0d1=['mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','SugarcrmField','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x93d7e0,_0x3ecdf4){var _0x1e93e8=function(_0x594198){while(--_0x594198){_0x93d7e0['push'](_0x93d7e0['shift']());}};_0x1e93e8(++_0x3ecdf4);}(_0xe0d1,0x1b0));var _0x1e0d=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xe0d1[_0x2300c7];return _0x23f720;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1e0d('0x0'));var zipdir=require(_0x1e0d('0x1'));var jsonpatch=require(_0x1e0d('0x2'));var rp=require(_0x1e0d('0x3'));var moment=require(_0x1e0d('0x4'));var BPromise=require(_0x1e0d('0x5'));var Mustache=require(_0x1e0d('0x6'));var util=require('util');var path=require(_0x1e0d('0x7'));var sox=require('sox');var csv=require(_0x1e0d('0x8'));var ejs=require(_0x1e0d('0x9'));var fs=require('fs');var _=require(_0x1e0d('0xa'));var squel=require(_0x1e0d('0xb'));var crypto=require(_0x1e0d('0xc'));var jsforce=require(_0x1e0d('0xd'));var deskjs=require(_0x1e0d('0xe'));var toCsv=require(_0x1e0d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1e0d('0xf'));var authService=require(_0x1e0d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1e0d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e0d('0x12'))(_0x1e0d('0x13'));var utils=require(_0x1e0d('0x14'));var config=require(_0x1e0d('0x15'));var db=require(_0x1e0d('0x16'))['db'];function respondWithStatusCode(_0x12e43d,_0x23e50e){_0x23e50e=_0x23e50e||0xcc;return function(_0x47e6fd){if(_0x47e6fd){return _0x12e43d[_0x1e0d('0x17')](_0x23e50e);}return _0x12e43d[_0x1e0d('0x18')](_0x23e50e)[_0x1e0d('0x19')]();};}function respondWithResult(_0x1cea7e,_0x5172ab){_0x5172ab=_0x5172ab||0xc8;return function(_0x5fe075){if(_0x5fe075){return _0x1cea7e[_0x1e0d('0x18')](_0x5172ab)[_0x1e0d('0x1a')](_0x5fe075);}};}function respondWithFilteredResult(_0x54daa7,_0x45e939){return function(_0x402c0e){if(_0x402c0e){var _0x434157=_0x402c0e['count'],_0x3ac5c2=_0x45e939[_0x1e0d('0x1b')],_0x4ddb4f=_0x45e939[_0x1e0d('0x1b')]+_0x45e939['limit'],_0x15b1c1;if(_0x4ddb4f>=_0x434157){_0x4ddb4f=_0x434157;_0x15b1c1=0xc8;}else{_0x15b1c1=0xce;}_0x54daa7[_0x1e0d('0x18')](_0x15b1c1);return _0x54daa7[_0x1e0d('0x1c')](_0x1e0d('0x1d'),_0x3ac5c2+'-'+_0x4ddb4f+'/'+_0x434157)[_0x1e0d('0x1a')](_0x402c0e);}return null;};}function patchUpdates(_0x3d1f06){return function(_0x37231e){try{jsonpatch['apply'](_0x37231e,_0x3d1f06,!![]);}catch(_0x260901){return BPromise[_0x1e0d('0x1e')](_0x260901);}return _0x37231e[_0x1e0d('0x1f')]();};}function saveUpdates(_0x503c98,_0x43c4cb){return function(_0x4b1b66){if(_0x4b1b66){return _0x4b1b66[_0x1e0d('0x20')](_0x503c98)[_0x1e0d('0x21')](function(_0xe6d9){return _0xe6d9;});}return null;};}function removeEntity(_0x445352,_0x15050a){return function(_0x4bb7b1){if(_0x4bb7b1){return _0x4bb7b1[_0x1e0d('0x22')]()[_0x1e0d('0x21')](function(){_0x445352[_0x1e0d('0x18')](0xcc)[_0x1e0d('0x19')]();});}};}function handleEntityNotFound(_0x149946,_0xb31899){return function(_0x275cfd){if(!_0x275cfd){_0x149946[_0x1e0d('0x17')](0x194);}return _0x275cfd;};}function handleError(_0x1417c4,_0x664bbd){_0x664bbd=_0x664bbd||0x1f4;return function(_0xf63dc0){logger[_0x1e0d('0x23')](_0xf63dc0[_0x1e0d('0x24')]);if(_0xf63dc0[_0x1e0d('0x25')]){delete _0xf63dc0[_0x1e0d('0x25')];}_0x1417c4[_0x1e0d('0x18')](_0x664bbd)[_0x1e0d('0x26')](_0xf63dc0);};}exports['index']=function(_0x13b955,_0x4bd08e){var _0x2e861b={},_0xc7cc01={},_0x9c248b={'count':0x0,'rows':[]};var _0x34f9b1=_['map'](db['SugarcrmField'][_0x1e0d('0x27')],function(_0x58a02b){return{'name':_0x58a02b[_0x1e0d('0x28')],'type':_0x58a02b[_0x1e0d('0x29')][_0x1e0d('0x2a')]};});_0xc7cc01['model']=_[_0x1e0d('0x2b')](_0x34f9b1,_0x1e0d('0x25'));_0xc7cc01[_0x1e0d('0x2c')]=_[_0x1e0d('0x2d')](_0x13b955['query']);_0xc7cc01[_0x1e0d('0x2e')]=_[_0x1e0d('0x2f')](_0xc7cc01[_0x1e0d('0x30')],_0xc7cc01[_0x1e0d('0x2c')]);_0x2e861b[_0x1e0d('0x31')]=_['intersection'](_0xc7cc01['model'],qs[_0x1e0d('0x32')](_0x13b955[_0x1e0d('0x2c')]['fields']));_0x2e861b[_0x1e0d('0x31')]=_0x2e861b[_0x1e0d('0x31')][_0x1e0d('0x33')]?_0x2e861b[_0x1e0d('0x31')]:_0xc7cc01[_0x1e0d('0x30')];if(!_0x13b955[_0x1e0d('0x2c')][_0x1e0d('0x34')](_0x1e0d('0x35'))){_0x2e861b[_0x1e0d('0x36')]=qs[_0x1e0d('0x36')](_0x13b955['query'][_0x1e0d('0x36')]);_0x2e861b[_0x1e0d('0x1b')]=qs[_0x1e0d('0x1b')](_0x13b955[_0x1e0d('0x2c')][_0x1e0d('0x1b')]);}_0x2e861b[_0x1e0d('0x37')]=qs[_0x1e0d('0x38')](_0x13b955[_0x1e0d('0x2c')][_0x1e0d('0x38')]);_0x2e861b[_0x1e0d('0x39')]=qs[_0x1e0d('0x2e')](_[_0x1e0d('0x3a')](_0x13b955['query'],_0xc7cc01[_0x1e0d('0x2e')]),_0x34f9b1);if(_0x13b955['query']['filter']){_0x2e861b[_0x1e0d('0x39')]=_[_0x1e0d('0x3b')](_0x2e861b[_0x1e0d('0x39')],{'$or':_[_0x1e0d('0x2b')](_0x34f9b1,function(_0x1cdf65){if(_0x1cdf65[_0x1e0d('0x29')]!=='VIRTUAL'){var _0x1e598c={};_0x1e598c[_0x1cdf65['name']]={'$like':'%'+_0x13b955[_0x1e0d('0x2c')]['filter']+'%'};return _0x1e598c;}})});}_0x2e861b=_['merge']({},_0x2e861b,_0x13b955[_0x1e0d('0x3c')]);var _0xa0bea3={'where':_0x2e861b['where']};return db[_0x1e0d('0x3d')][_0x1e0d('0x3e')](_0xa0bea3)[_0x1e0d('0x21')](function(_0xf70cf6){_0x9c248b[_0x1e0d('0x3e')]=_0xf70cf6;if(_0x13b955[_0x1e0d('0x2c')][_0x1e0d('0x3f')]){_0x2e861b['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x1e0d('0x40')](_0x2e861b);})['then'](function(_0x86342d){_0x9c248b[_0x1e0d('0x41')]=_0x86342d;return _0x9c248b;})[_0x1e0d('0x21')](respondWithFilteredResult(_0x4bd08e,_0x2e861b))[_0x1e0d('0x42')](handleError(_0x4bd08e,null));};exports[_0x1e0d('0x43')]=function(_0x181aaf,_0x162a98){var _0x329506={'raw':!![],'where':{'id':_0x181aaf[_0x1e0d('0x44')]['id']}},_0x97cf0f={};_0x97cf0f[_0x1e0d('0x30')]=_[_0x1e0d('0x2d')](db['SugarcrmField'][_0x1e0d('0x27')]);_0x97cf0f[_0x1e0d('0x2c')]=_[_0x1e0d('0x2d')](_0x181aaf[_0x1e0d('0x2c')]);_0x97cf0f[_0x1e0d('0x2e')]=_[_0x1e0d('0x2f')](_0x97cf0f['model'],_0x97cf0f['query']);_0x329506['attributes']=_[_0x1e0d('0x2f')](_0x97cf0f[_0x1e0d('0x30')],qs[_0x1e0d('0x32')](_0x181aaf[_0x1e0d('0x2c')][_0x1e0d('0x32')]));_0x329506[_0x1e0d('0x31')]=_0x329506[_0x1e0d('0x31')][_0x1e0d('0x33')]?_0x329506[_0x1e0d('0x31')]:_0x97cf0f[_0x1e0d('0x30')];if(_0x181aaf[_0x1e0d('0x2c')][_0x1e0d('0x3f')]){_0x329506[_0x1e0d('0x45')]=[{'all':!![]}];}_0x329506=_['merge']({},_0x329506,_0x181aaf['options']);return db[_0x1e0d('0x3d')][_0x1e0d('0x46')](_0x329506)[_0x1e0d('0x21')](handleEntityNotFound(_0x162a98,null))[_0x1e0d('0x21')](respondWithResult(_0x162a98,null))[_0x1e0d('0x42')](handleError(_0x162a98,null));};exports['create']=function(_0x385a9a,_0x25a2f4){return db['SugarcrmField'][_0x1e0d('0x47')](_0x385a9a[_0x1e0d('0x48')],{})[_0x1e0d('0x21')](respondWithResult(_0x25a2f4,0xc9))[_0x1e0d('0x42')](handleError(_0x25a2f4,null));};exports[_0x1e0d('0x20')]=function(_0x25001f,_0x50bdfc){if(_0x25001f[_0x1e0d('0x48')]['id']){delete _0x25001f[_0x1e0d('0x48')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x25001f[_0x1e0d('0x44')]['id']}})[_0x1e0d('0x21')](handleEntityNotFound(_0x50bdfc,null))[_0x1e0d('0x21')](saveUpdates(_0x25001f['body'],null))[_0x1e0d('0x21')](respondWithResult(_0x50bdfc,null))[_0x1e0d('0x42')](handleError(_0x50bdfc,null));};exports['destroy']=function(_0xeecd9e,_0x515dea){return db[_0x1e0d('0x3d')][_0x1e0d('0x46')]({'where':{'id':_0xeecd9e['params']['id']}})[_0x1e0d('0x21')](handleEntityNotFound(_0x515dea,null))[_0x1e0d('0x21')](removeEntity(_0x515dea,null))[_0x1e0d('0x42')](handleError(_0x515dea,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 8e3d261..22a605d 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 _0xe3b4=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','idField','FieldId','util','../../config/logger','api','moment','request-promise'];(function(_0x301902,_0x3d828b){var _0x2c0346=function(_0x54954b){while(--_0x54954b){_0x301902['push'](_0x301902['shift']());}};_0x2c0346(++_0x3d828b);}(_0xe3b4,0x13f));var _0x4e3b=function(_0x87f56c,_0x39ca01){_0x87f56c=_0x87f56c-0x0;var _0x502de0=_0xe3b4[_0x87f56c];return _0x502de0;};'use strict';var _=require('lodash');var util=require(_0x4e3b('0x0'));var logger=require(_0x4e3b('0x1'))(_0x4e3b('0x2'));var moment=require(_0x4e3b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e3b('0x4'));var fs=require('fs');var path=require(_0x4e3b('0x5'));var rimraf=require(_0x4e3b('0x6'));var config=require(_0x4e3b('0x7'));var attributes=require(_0x4e3b('0x8'));module['exports']=function(_0x311353,_0x1fea2e){return _0x311353['define'](_0x4e3b('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x4e3b('0xa'),_0x4e3b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e45=['moment','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','../../config/logger','api'];(function(_0xb28c53,_0xa65eb4){var _0x502ab=function(_0x15890c){while(--_0x15890c){_0xb28c53['push'](_0xb28c53['shift']());}};_0x502ab(++_0xa65eb4);}(_0x1e45,0x1b7));var _0x51e4=function(_0x262da8,_0xd055d5){_0x262da8=_0x262da8-0x0;var _0x33fda9=_0x1e45[_0x262da8];return _0x33fda9;};'use strict';var _=require(_0x51e4('0x0'));var util=require('util');var logger=require(_0x51e4('0x1'))(_0x51e4('0x2'));var moment=require(_0x51e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x51e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51e4('0x5'));var config=require('../../config/environment');var attributes=require(_0x51e4('0x6'));module[_0x51e4('0x7')]=function(_0x2c4bad,_0xec9872){return _0x2c4bad[_0x51e4('0x8')](_0x51e4('0x9'),attributes,{'tableName':_0x51e4('0xa'),'paranoid':![],'indexes':[{'name':_0x51e4('0xb'),'fields':['idField',_0x51e4('0xc')],'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 8038684..fa42ffc 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x565f17,_0x3949f7){var _0x3eac3a=function(_0x32853d){while(--_0x32853d){_0x565f17['push'](_0x565f17['shift']());}};_0x3eac3a(++_0x3949f7);}(_0xdb28,0x106));var _0x8db2=function(_0x361c84,_0x2960ef){_0x361c84=_0x361c84-0x0;var _0x272fea=_0xdb28[_0x361c84];return _0x272fea;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1d59dd,_0x5124b0){var _0x7b418=function(_0x10a26a){while(--_0x10a26a){_0x1d59dd['push'](_0x1d59dd['shift']());}};_0x7b418(++_0x5124b0);}(_0xb10b,0x12a));var _0xbb10=function(_0x206fc3,_0x251f21){_0x206fc3=_0x206fc3-0x0;var _0xea0c75=_0xb10b[_0x206fc3];return _0xea0c75;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f36184d..cd3f9e5 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 _0x624f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer'];(function(_0x20c542,_0x23f98d){var _0x385cc1=function(_0x3bc09b){while(--_0x3bc09b){_0x20c542['push'](_0x20c542['shift']());}};_0x385cc1(++_0x23f98d);}(_0x624f,0x14f));var _0xf624=function(_0x298e21,_0x7f8997){_0x298e21=_0x298e21-0x0;var _0x29d5e5=_0x624f[_0x298e21];return _0x29d5e5;};'use strict';var multer=require(_0xf624('0x0'));var util=require(_0xf624('0x1'));var path=require(_0xf624('0x2'));var timeout=require(_0xf624('0x3'));var express=require(_0xf624('0x4'));var router=express[_0xf624('0x5')]();var auth=require(_0xf624('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf624('0x7'));var controller=require(_0xf624('0x8'));router[_0xf624('0x9')]('/',auth[_0xf624('0xa')](),controller[_0xf624('0xb')]);router[_0xf624('0x9')](_0xf624('0xc'),auth[_0xf624('0xa')](),controller[_0xf624('0xd')]);router['get'](_0xf624('0xe'),auth['isAuthenticated'](),controller[_0xf624('0xf')]);router[_0xf624('0x9')](_0xf624('0x10'),auth[_0xf624('0xa')](),controller[_0xf624('0x11')]);router[_0xf624('0x12')]('/',auth[_0xf624('0xa')](),controller[_0xf624('0x13')]);router[_0xf624('0x12')]('/:id/configurations',auth[_0xf624('0xa')](),controller[_0xf624('0x14')]);router[_0xf624('0x15')]('/:id',auth[_0xf624('0xa')](),controller[_0xf624('0x16')]);router['delete']('/:id',auth[_0xf624('0xa')](),controller['destroy']);module[_0xf624('0x17')]=router; \ No newline at end of file +var _0x92af=['post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','get','/:id','/:id/configurations','isAuthenticated','/:id/fields','getFields','create'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x92af,0x1ea));var _0xf92a=function(_0x1b0991,_0x57db11){_0x1b0991=_0x1b0991-0x0;var _0x139dd4=_0x92af[_0x1b0991];return _0x139dd4;};'use strict';var multer=require(_0xf92a('0x0'));var util=require(_0xf92a('0x1'));var path=require(_0xf92a('0x2'));var timeout=require('connect-timeout');var express=require(_0xf92a('0x3'));var router=express[_0xf92a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf92a('0x5'));var config=require(_0xf92a('0x6'));var controller=require(_0xf92a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf92a('0x8')]);router[_0xf92a('0x9')](_0xf92a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf92a('0x9')](_0xf92a('0xb'),auth[_0xf92a('0xc')](),controller['getConfigurations']);router[_0xf92a('0x9')](_0xf92a('0xd'),auth['isAuthenticated'](),controller[_0xf92a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf92a('0xf')]);router[_0xf92a('0x10')]('/:id/configurations',auth[_0xf92a('0xc')](),controller[_0xf92a('0x11')]);router[_0xf92a('0x12')]('/:id',auth[_0xf92a('0xc')](),controller[_0xf92a('0x13')]);router[_0xf92a('0x14')](_0xf92a('0xa'),auth[_0xf92a('0xc')](),controller[_0xf92a('0x15')]);module[_0xf92a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3078936..0724354 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 _0x06ae=['STRING','sequelize','exports'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x06ae,0x1ea));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xe06a('0x0'));module[_0xe06a('0x1')]={'name':{'type':Sequelize[_0xe06a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe06a('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xe06a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe06a('0x2')]},'accessKey':{'type':Sequelize[_0xe06a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa496=['STRING'];(function(_0x53ba78,_0x29cb46){var _0x163be2=function(_0x53719f){while(--_0x53719f){_0x53ba78['push'](_0x53ba78['shift']());}};_0x163be2(++_0x29cb46);}(_0xa496,0x1e7));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6a49('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x6a49('0x0')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6a49('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x6a49('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x6a49('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 36a41ae..35d182e 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 _0xafa6=['code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','getConfigurations','VtigerConfiguration','order','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','describe','sessionName','autogenerated','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x4d6f6f,_0xef3141){var _0x4b7e32=function(_0x23bd05){while(--_0x23bd05){_0x4d6f6f['push'](_0x4d6f6f['shift']());}};_0x4b7e32(++_0xef3141);}(_0xafa6,0x174));var _0x6afa=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xafa6[_0x20a558];return _0x53d3f7;};'use strict';var pdf=require(_0x6afa('0x0'));var emlformat=require(_0x6afa('0x1'));var rimraf=require(_0x6afa('0x2'));var zipdir=require(_0x6afa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6afa('0x4'));var BPromise=require(_0x6afa('0x5'));var Mustache=require('mustache');var util=require(_0x6afa('0x6'));var path=require('path');var sox=require(_0x6afa('0x7'));var csv=require(_0x6afa('0x8'));var ejs=require(_0x6afa('0x9'));var fs=require('fs');var _=require(_0x6afa('0xa'));var squel=require(_0x6afa('0xb'));var crypto=require(_0x6afa('0xc'));var jsforce=require(_0x6afa('0xd'));var deskjs=require(_0x6afa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6afa('0xf'));var Papa=require(_0x6afa('0x10'));var Redis=require('ioredis');var authService=require(_0x6afa('0x11'));var qs=require(_0x6afa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6afa('0x13'))(_0x6afa('0x14'));var utils=require(_0x6afa('0x15'));var config=require(_0x6afa('0x16'));var db=require(_0x6afa('0x17'))['db'];var integrations=require(_0x6afa('0x18'));var jayson=require(_0x6afa('0x19'));var client=jayson[_0x6afa('0x1a')][_0x6afa('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xd53445,_0x2962ce,_0xf34f5a){if(_0xf34f5a){var _0x5ae081=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ae081[_0x6afa('0x1c')](_0x2962ce)){return _0xd53445;}else{throw new db[(_0x6afa('0x1d'))][(_0x6afa('0x1e'))](_0x6afa('0x1f'));}}else{return _0xd53445;}}function respondWithRpcPromise(_0x3d9c70,_0x2ff3f3,_0xfe2242,_0x581053){return new BPromise(function(_0x4c7134,_0x27b75c){var _0x3198de=_0x581053||client;return _0x3198de[_0x6afa('0x20')](_0x3d9c70,_0xfe2242)[_0x6afa('0x21')](function(_0x24b731){logger[_0x6afa('0x22')](_0x6afa('0x23'),_0x2ff3f3,_0x6afa('0x24'));logger[_0x6afa('0x25')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2ff3f3,_0x6afa('0x24'),JSON['stringify'](_0x24b731));if(_0x24b731['error']){if(_0x24b731[_0x6afa('0x26')][_0x6afa('0x27')]===0x1f4){logger[_0x6afa('0x26')](_0x6afa('0x23'),_0x2ff3f3,_0x24b731['error']['message']);return _0x27b75c(_0x24b731[_0x6afa('0x26')][_0x6afa('0x28')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2ff3f3,_0x24b731[_0x6afa('0x26')][_0x6afa('0x28')]);return _0x4c7134(_0x24b731[_0x6afa('0x26')]['message']);}else{logger[_0x6afa('0x22')](_0x6afa('0x23'),_0x2ff3f3,'request\x20sent');_0x4c7134(_0x24b731[_0x6afa('0x29')]['message']);}})['catch'](function(_0x3aa98e){logger['error'](_0x6afa('0x23'),_0x2ff3f3,_0x3aa98e);_0x27b75c(_0x3aa98e);});});}function respondWithStatusCode(_0x2e445a,_0x51a9c3){_0x51a9c3=_0x51a9c3||0xcc;return function(_0x44b9e2){if(_0x44b9e2){return _0x2e445a[_0x6afa('0x2a')](_0x51a9c3);}return _0x2e445a['status'](_0x51a9c3)[_0x6afa('0x2b')]();};}function respondWithResult(_0x351caf,_0x5385a1){_0x5385a1=_0x5385a1||0xc8;return function(_0x25bf7b){if(_0x25bf7b){return _0x351caf[_0x6afa('0x2c')](_0x5385a1)[_0x6afa('0x2d')](_0x25bf7b);}};}function respondWithFilteredResult(_0xfb3a20,_0x3ac4d2){return function(_0x23e63a){if(_0x23e63a){var _0x140bef=_0x23e63a[_0x6afa('0x2e')],_0x1e2b03=_0x3ac4d2[_0x6afa('0x2f')],_0x48cd48=_0x3ac4d2[_0x6afa('0x2f')]+_0x3ac4d2[_0x6afa('0x30')],_0x322bb9;if(_0x48cd48>=_0x140bef){_0x48cd48=_0x140bef;_0x322bb9=0xc8;}else{_0x322bb9=0xce;}_0xfb3a20['status'](_0x322bb9);return _0xfb3a20[_0x6afa('0x31')](_0x6afa('0x32'),_0x1e2b03+'-'+_0x48cd48+'/'+_0x140bef)[_0x6afa('0x2d')](_0x23e63a);}return null;};}function patchUpdates(_0x14524a){return function(_0xcf96ed){try{jsonpatch[_0x6afa('0x33')](_0xcf96ed,_0x14524a,!![]);}catch(_0x2af247){return BPromise[_0x6afa('0x34')](_0x2af247);}return _0xcf96ed[_0x6afa('0x35')]();};}function saveUpdates(_0x5a0609,_0x13aef7){return function(_0x311007){if(_0x311007){return _0x311007[_0x6afa('0x36')](_0x5a0609)['then'](function(_0x6bd6df){return _0x6bd6df;});}return null;};}function removeEntity(_0x1f5add,_0x665211){return function(_0x2eaa16){if(_0x2eaa16){return _0x2eaa16['destroy']()[_0x6afa('0x21')](function(){_0x1f5add[_0x6afa('0x2c')](0xcc)[_0x6afa('0x2b')]();});}};}function handleEntityNotFound(_0x1a366b,_0x1aad55){return function(_0x4fbb8b){if(!_0x4fbb8b){_0x1a366b[_0x6afa('0x2a')](0x194);}return _0x4fbb8b;};}function handleError(_0x326d3f,_0x35aeb6){_0x35aeb6=_0x35aeb6||0x1f4;return function(_0x1b046c){logger[_0x6afa('0x26')](_0x1b046c[_0x6afa('0x37')]);if(_0x1b046c['name']){delete _0x1b046c[_0x6afa('0x38')];}_0x326d3f[_0x6afa('0x2c')](_0x35aeb6)[_0x6afa('0x39')](_0x1b046c);};}exports[_0x6afa('0x3a')]=function(_0x5d3c4d,_0x133c78){var _0x2ca5bf={},_0x389810={},_0xef84b={'count':0x0,'rows':[]};var _0x4ae662=_[_0x6afa('0x3b')](db[_0x6afa('0x3c')][_0x6afa('0x3d')],function(_0x7a04ff){return{'name':_0x7a04ff[_0x6afa('0x3e')],'type':_0x7a04ff['type']['key']};});_0x389810[_0x6afa('0x3f')]=_[_0x6afa('0x3b')](_0x4ae662,_0x6afa('0x38'));_0x389810[_0x6afa('0x40')]=_['keys'](_0x5d3c4d['query']);_0x389810[_0x6afa('0x41')]=_[_0x6afa('0x42')](_0x389810[_0x6afa('0x3f')],_0x389810['query']);_0x2ca5bf[_0x6afa('0x43')]=_[_0x6afa('0x42')](_0x389810[_0x6afa('0x3f')],qs['fields'](_0x5d3c4d[_0x6afa('0x40')][_0x6afa('0x44')]));_0x2ca5bf[_0x6afa('0x43')]=_0x2ca5bf[_0x6afa('0x43')][_0x6afa('0x45')]?_0x2ca5bf[_0x6afa('0x43')]:_0x389810[_0x6afa('0x3f')];if(!_0x5d3c4d[_0x6afa('0x40')][_0x6afa('0x46')]('nolimit')){_0x2ca5bf[_0x6afa('0x30')]=qs[_0x6afa('0x30')](_0x5d3c4d[_0x6afa('0x40')][_0x6afa('0x30')]);_0x2ca5bf['offset']=qs['offset'](_0x5d3c4d['query'][_0x6afa('0x2f')]);}_0x2ca5bf['order']=qs[_0x6afa('0x47')](_0x5d3c4d['query']['sort']);_0x2ca5bf[_0x6afa('0x48')]=qs[_0x6afa('0x41')](_['pick'](_0x5d3c4d[_0x6afa('0x40')],_0x389810[_0x6afa('0x41')]),_0x4ae662);if(_0x5d3c4d['query'][_0x6afa('0x49')]){_0x2ca5bf['where']=_[_0x6afa('0x4a')](_0x2ca5bf[_0x6afa('0x48')],{'$or':_[_0x6afa('0x3b')](_0x4ae662,function(_0x3ba8ae){if(_0x3ba8ae[_0x6afa('0x4b')]!==_0x6afa('0x4c')){var _0x3db1fc={};_0x3db1fc[_0x3ba8ae[_0x6afa('0x38')]]={'$like':'%'+_0x5d3c4d['query'][_0x6afa('0x49')]+'%'};return _0x3db1fc;}})});}_0x2ca5bf=_[_0x6afa('0x4a')]({},_0x2ca5bf,_0x5d3c4d['options']);var _0xcd0d76={'where':_0x2ca5bf['where']};return db[_0x6afa('0x3c')]['count'](_0xcd0d76)[_0x6afa('0x21')](function(_0x541f29){_0xef84b[_0x6afa('0x2e')]=_0x541f29;if(_0x5d3c4d[_0x6afa('0x40')][_0x6afa('0x4d')]){_0x2ca5bf[_0x6afa('0x4e')]=[{'all':!![]}];}return db[_0x6afa('0x3c')][_0x6afa('0x4f')](_0x2ca5bf);})[_0x6afa('0x21')](function(_0x197b71){_0xef84b[_0x6afa('0x50')]=_0x197b71;return _0xef84b;})[_0x6afa('0x21')](respondWithFilteredResult(_0x133c78,_0x2ca5bf))[_0x6afa('0x51')](handleError(_0x133c78,null));};exports[_0x6afa('0x52')]=function(_0x334b84,_0x1489b2){var _0x416e6d={'raw':![],'where':{'id':_0x334b84['params']['id']}},_0x2069f4={};_0x2069f4['model']=_[_0x6afa('0x53')](db['VtigerAccount']['rawAttributes']);_0x2069f4[_0x6afa('0x40')]=_['keys'](_0x334b84['query']);_0x2069f4[_0x6afa('0x41')]=_['intersection'](_0x2069f4['model'],_0x2069f4[_0x6afa('0x40')]);_0x416e6d[_0x6afa('0x43')]=_[_0x6afa('0x42')](_0x2069f4['model'],qs[_0x6afa('0x44')](_0x334b84['query'][_0x6afa('0x44')]));_0x416e6d[_0x6afa('0x43')]=_0x416e6d[_0x6afa('0x43')][_0x6afa('0x45')]?_0x416e6d[_0x6afa('0x43')]:_0x2069f4[_0x6afa('0x3f')];if(_0x334b84[_0x6afa('0x40')][_0x6afa('0x4d')]){_0x416e6d['include']=[{'all':!![]}];}_0x416e6d=_[_0x6afa('0x4a')]({},_0x416e6d,_0x334b84[_0x6afa('0x54')]);return db['VtigerAccount'][_0x6afa('0x55')](_0x416e6d)[_0x6afa('0x21')](handleEntityNotFound(_0x1489b2,null))[_0x6afa('0x21')](respondWithResult(_0x1489b2,null))[_0x6afa('0x51')](handleError(_0x1489b2,null));};exports[_0x6afa('0x56')]=function(_0x200c7c,_0x59565b){return db[_0x6afa('0x3c')]['create'](_0x200c7c['body'],{})[_0x6afa('0x21')](respondWithResult(_0x59565b,0xc9))['catch'](handleError(_0x59565b,null));};exports['update']=function(_0x2f1320,_0xbe0c66){if(_0x2f1320['body']['id']){delete _0x2f1320[_0x6afa('0x57')]['id'];}return db[_0x6afa('0x3c')]['find']({'where':{'id':_0x2f1320[_0x6afa('0x58')]['id']}})[_0x6afa('0x21')](handleEntityNotFound(_0xbe0c66,null))['then'](saveUpdates(_0x2f1320[_0x6afa('0x57')],null))[_0x6afa('0x21')](respondWithResult(_0xbe0c66,null))[_0x6afa('0x51')](handleError(_0xbe0c66,null));};exports[_0x6afa('0x59')]=function(_0x3ae5eb,_0x38a449){return db[_0x6afa('0x3c')][_0x6afa('0x55')]({'where':{'id':_0x3ae5eb[_0x6afa('0x58')]['id']}})['then'](handleEntityNotFound(_0x38a449,null))[_0x6afa('0x21')](removeEntity(_0x38a449,null))['catch'](handleError(_0x38a449,null));};exports[_0x6afa('0x5a')]=function(_0x4fcacd,_0x52f477,_0x228361){var _0x30118a={};var _0x40b6b7={};var _0x9adb2b;var _0x27ee94;return db[_0x6afa('0x3c')]['findOne']({'where':{'id':_0x4fcacd[_0x6afa('0x58')]['id']}})['then'](handleEntityNotFound(_0x52f477,null))['then'](function(_0x440211){if(_0x440211){_0x9adb2b=_0x440211;_0x40b6b7[_0x6afa('0x3f')]=_['keys'](db[_0x6afa('0x5b')][_0x6afa('0x3d')]);_0x40b6b7[_0x6afa('0x40')]=_[_0x6afa('0x53')](_0x4fcacd[_0x6afa('0x40')]);_0x40b6b7[_0x6afa('0x41')]=_[_0x6afa('0x42')](_0x40b6b7['model'],_0x40b6b7[_0x6afa('0x40')]);_0x30118a[_0x6afa('0x43')]=_[_0x6afa('0x42')](_0x40b6b7[_0x6afa('0x3f')],qs[_0x6afa('0x44')](_0x4fcacd[_0x6afa('0x40')][_0x6afa('0x44')]));_0x30118a['attributes']=_0x30118a[_0x6afa('0x43')][_0x6afa('0x45')]?_0x30118a[_0x6afa('0x43')]:_0x40b6b7[_0x6afa('0x3f')];_0x30118a[_0x6afa('0x5c')]=qs[_0x6afa('0x47')](_0x4fcacd['query']['sort']);_0x30118a[_0x6afa('0x48')]=qs[_0x6afa('0x41')](_['pick'](_0x4fcacd[_0x6afa('0x40')],_0x40b6b7[_0x6afa('0x41')]));if(_0x4fcacd[_0x6afa('0x40')]['filter']){_0x30118a[_0x6afa('0x48')]=_['merge'](_0x30118a[_0x6afa('0x48')],{'$or':_[_0x6afa('0x3b')](_0x30118a[_0x6afa('0x43')],function(_0x32d7d0){var _0x5d3136={};_0x5d3136[_0x32d7d0]={'$like':'%'+_0x4fcacd['query'][_0x6afa('0x49')]+'%'};return _0x5d3136;})});}_0x30118a=_[_0x6afa('0x4a')]({},_0x30118a,_0x4fcacd[_0x6afa('0x54')]);return _0x9adb2b[_0x6afa('0x5a')](_0x30118a);}})[_0x6afa('0x21')](function(_0x4e2402){if(_0x4e2402){_0x27ee94=_0x4e2402[_0x6afa('0x45')];if(!_0x4fcacd[_0x6afa('0x40')][_0x6afa('0x46')](_0x6afa('0x5d'))){_0x30118a[_0x6afa('0x30')]=qs[_0x6afa('0x30')](_0x4fcacd[_0x6afa('0x40')][_0x6afa('0x30')]);_0x30118a[_0x6afa('0x2f')]=qs['offset'](_0x4fcacd[_0x6afa('0x40')][_0x6afa('0x2f')]);}return _0x9adb2b[_0x6afa('0x5a')](_0x30118a);}})[_0x6afa('0x21')](function(_0x28dfe5){if(_0x28dfe5){return _0x28dfe5?{'count':_0x27ee94,'rows':_0x28dfe5}:null;}})[_0x6afa('0x21')](respondWithResult(_0x52f477,null))[_0x6afa('0x51')](handleError(_0x52f477,null));};exports['addConfiguration']=function(_0x49d1d2,_0x71c7c4,_0x36d6e2){if(_0x49d1d2[_0x6afa('0x57')]['id']){delete _0x49d1d2[_0x6afa('0x57')]['id'];}return db[_0x6afa('0x3c')][_0x6afa('0x5e')]({'where':{'id':_0x49d1d2[_0x6afa('0x58')]['id']}})[_0x6afa('0x21')](handleEntityNotFound(_0x71c7c4,null))[_0x6afa('0x21')](function(_0x784a8e){if(_0x784a8e){_0x49d1d2[_0x6afa('0x57')][_0x6afa('0x5f')]=_0x784a8e['id'];_0x49d1d2[_0x6afa('0x57')][_0x6afa('0x60')]=integrations[_0x6afa('0x61')](_0x49d1d2['body'][_0x6afa('0x62')],_0x49d1d2[_0x6afa('0x57')][_0x6afa('0x4b')]);_0x49d1d2[_0x6afa('0x57')][_0x6afa('0x63')]=integrations[_0x6afa('0x64')](_0x49d1d2[_0x6afa('0x57')][_0x6afa('0x62')],_0x49d1d2['body'][_0x6afa('0x4b')]);return db[_0x6afa('0x5b')][_0x6afa('0x56')](_0x49d1d2[_0x6afa('0x57')],{'include':[{'model':db[_0x6afa('0x65')],'as':_0x6afa('0x60')},{'model':db[_0x6afa('0x65')],'as':_0x6afa('0x63')}]});}return null;})[_0x6afa('0x21')](respondWithResult(_0x71c7c4,null))[_0x6afa('0x51')](handleError(_0x71c7c4,null));};var md5=require(_0x6afa('0x66'));exports[_0x6afa('0x67')]=function(_0xf5ddd7,_0x1afba7,_0x48291b){var _0x4e2a93=null;var _0x3a833c=null;var _0x4849fd=null;var _0x4aff40=null;var _0x3dc201='';return db[_0x6afa('0x3c')][_0x6afa('0x5e')]({'where':{'id':_0xf5ddd7[_0x6afa('0x58')]['id']},'attributes':['id',_0x6afa('0x38'),'username',_0x6afa('0x68'),_0x6afa('0x69'),_0x6afa('0x6a'),_0x6afa('0x6b'),_0x6afa('0x6c')]})[_0x6afa('0x21')](handleEntityNotFound(_0x1afba7,null))[_0x6afa('0x21')](function(_0x31d793){if(_0x31d793){_0x4e2a93=_0x31d793[_0x6afa('0x6d')];_0x3a833c=_0x31d793[_0x6afa('0x6c')];_0x4849fd=_0x31d793[_0x6afa('0x69')];_0x3dc201=_0x31d793[_0x6afa('0x6a')];var _0x11a1b6=_0x3dc201[_0x6afa('0x6e')](-0x1);if(_0x11a1b6==='/'){_0x3dc201=_0x3dc201[_0x6afa('0x6f')](0x0,_0x3dc201[_0x6afa('0x70')](_0x11a1b6));}_0x4aff40=util[_0x6afa('0x71')](_0x6afa('0x72'),_0x3dc201);var _0x9ccf52={'method':_0x6afa('0x73'),'uri':_0x4aff40,'qs':{'operation':_0x6afa('0x74'),'username':_0x31d793[_0x6afa('0x6d')]},'json':!![]};return rp(_0x9ccf52);}})[_0x6afa('0x21')](function(_0x46e442){if(_0x46e442[_0x6afa('0x75')]){var _0x1176e={'method':'POST','uri':_0x4aff40,'form':{'operation':_0x6afa('0x76'),'username':_0x4e2a93,'accessKey':md5(_0x46e442[_0x6afa('0x29')]['token']+_0x3a833c)},'json':!![]};return rp(_0x1176e);}})[_0x6afa('0x21')](function(_0x127caf){if(_0x127caf[_0x6afa('0x75')]){var _0x2d065f={'method':'GET','uri':_0x4aff40,'qs':{'operation':_0x6afa('0x77'),'username':_0x4e2a93,'sessionName':_0x127caf['result'][_0x6afa('0x78')],'elementType':_0x4849fd},'json':!![]};return rp(_0x2d065f);}})[_0x6afa('0x21')](function(_0x4e9768){if(_0x4e9768[_0x6afa('0x75')]){var _0x23bceb=[_0x6afa('0x79'),'reference','owner'];_[_0x6afa('0x7a')](_0x4e9768['result'][_0x6afa('0x44')],function(_0xb5b38b){return _0x23bceb[_0x6afa('0x7b')](_0xb5b38b[_0x6afa('0x4b')]['name']);});_[_0x6afa('0x7a')](_0x4e9768['result'][_0x6afa('0x44')],function(_0x58ccb4){return _0x58ccb4[_0x6afa('0x7c')]===_0x6afa('0x7d');});return{'count':_0x4e9768['result'][_0x6afa('0x44')][_0x6afa('0x45')],'rows':_[_0x6afa('0x3b')](_0x4e9768[_0x6afa('0x29')]['fields'],function(_0x3381a9){return{'id':_0x3381a9['name'],'name':_0x3381a9[_0x6afa('0x7e')],'custom':_[_0x6afa('0x7f')](_0x3381a9[_0x6afa('0x38')],_0x6afa('0x80'))?!![]:![],'options':_0x3381a9[_0x6afa('0x4b')]['name']===_0x6afa('0x81')&&_0x3381a9[_0x6afa('0x4b')]['picklistValues']['length']>0x0?_[_0x6afa('0x3b')](_0x3381a9['type'][_0x6afa('0x82')],function(_0x1ee60d){return{'name':_0x1ee60d[_0x6afa('0x7e')],'value':_0x1ee60d[_0x6afa('0x83')]};}):[]};})};}})['then'](respondWithResult(_0x1afba7,null))['catch'](function(_0x16454e){console[_0x6afa('0x84')](_0x6afa('0x85')+_0x16454e);var _0x2af6d9=_0xf5ddd7[_0x6afa('0x40')]['test']?0x1f4:_0x16454e[_0x6afa('0x86')]||0x1f4;logger[_0x6afa('0x26')](_0x6afa('0x87'),'getFields',_0x2af6d9,JSON[_0x6afa('0x88')](_0x16454e));delete _0x16454e[_0x6afa('0x38')];if(_0x2af6d9===0x191){_0x2af6d9=0x190;}_0x1afba7[_0x6afa('0x2c')](_0x2af6d9)[_0x6afa('0x39')](_0xf5ddd7[_0x6afa('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x16454e[_0x6afa('0x86')]}:_0x16454e);});}; \ No newline at end of file +var _0x7f3d=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','show','find','create','body','params','getConfigurations','options','addConfiguration','findOne','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','Subjects','username','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','token','describe','autogenerated','owner','remove','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','statusCode','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields'];(function(_0x4913a8,_0x5a8cbd){var _0x50a4de=function(_0x31892e){while(--_0x31892e){_0x4913a8['push'](_0x4913a8['shift']());}};_0x50a4de(++_0x5a8cbd);}(_0x7f3d,0xbc));var _0xd7f3=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x7f3d[_0x2cc711];return _0x31a52e;};'use strict';var pdf=require(_0xd7f3('0x0'));var emlformat=require(_0xd7f3('0x1'));var rimraf=require(_0xd7f3('0x2'));var zipdir=require(_0xd7f3('0x3'));var jsonpatch=require(_0xd7f3('0x4'));var rp=require(_0xd7f3('0x5'));var moment=require(_0xd7f3('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd7f3('0x7'));var path=require(_0xd7f3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd7f3('0x9'));var fs=require('fs');var _=require(_0xd7f3('0xa'));var squel=require('squel');var crypto=require(_0xd7f3('0xb'));var jsforce=require(_0xd7f3('0xc'));var deskjs=require(_0xd7f3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd7f3('0xe'));var Papa=require(_0xd7f3('0xf'));var Redis=require(_0xd7f3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd7f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7f3('0x12'))(_0xd7f3('0x13'));var utils=require(_0xd7f3('0x14'));var config=require('../../config/environment');var db=require(_0xd7f3('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd7f3('0x16'));var client=jayson[_0xd7f3('0x17')][_0xd7f3('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3200ec,_0x311d24,_0x8f29bc){if(_0x8f29bc){var _0x12d93a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12d93a[_0xd7f3('0x19')](_0x311d24)){return _0x3200ec;}else{throw new db[(_0xd7f3('0x1a'))][(_0xd7f3('0x1b'))](_0xd7f3('0x1c'));}}else{return _0x3200ec;}}function respondWithRpcPromise(_0x398b7f,_0x228c5d,_0x150dfe,_0x500351){return new BPromise(function(_0x14feb8,_0x732928){var _0xd321d1=_0x500351||client;return _0xd321d1['request'](_0x398b7f,_0x150dfe)[_0xd7f3('0x1d')](function(_0x1b19dd){logger[_0xd7f3('0x1e')](_0xd7f3('0x1f'),_0x228c5d,_0xd7f3('0x20'));logger[_0xd7f3('0x21')](_0xd7f3('0x22'),_0x228c5d,_0xd7f3('0x20'),JSON[_0xd7f3('0x23')](_0x1b19dd));if(_0x1b19dd[_0xd7f3('0x24')]){if(_0x1b19dd[_0xd7f3('0x24')][_0xd7f3('0x25')]===0x1f4){logger[_0xd7f3('0x24')](_0xd7f3('0x1f'),_0x228c5d,_0x1b19dd[_0xd7f3('0x24')][_0xd7f3('0x26')]);return _0x732928(_0x1b19dd[_0xd7f3('0x24')][_0xd7f3('0x26')]);}logger[_0xd7f3('0x24')](_0xd7f3('0x1f'),_0x228c5d,_0x1b19dd['error']['message']);return _0x14feb8(_0x1b19dd[_0xd7f3('0x24')][_0xd7f3('0x26')]);}else{logger[_0xd7f3('0x1e')](_0xd7f3('0x1f'),_0x228c5d,_0xd7f3('0x20'));_0x14feb8(_0x1b19dd[_0xd7f3('0x27')][_0xd7f3('0x26')]);}})[_0xd7f3('0x28')](function(_0x132267){logger[_0xd7f3('0x24')](_0xd7f3('0x1f'),_0x228c5d,_0x132267);_0x732928(_0x132267);});});}function respondWithStatusCode(_0x508212,_0xa7a731){_0xa7a731=_0xa7a731||0xcc;return function(_0x550b47){if(_0x550b47){return _0x508212['sendStatus'](_0xa7a731);}return _0x508212[_0xd7f3('0x29')](_0xa7a731)[_0xd7f3('0x2a')]();};}function respondWithResult(_0x334e8d,_0x11e45f){_0x11e45f=_0x11e45f||0xc8;return function(_0x2ee1ba){if(_0x2ee1ba){return _0x334e8d[_0xd7f3('0x29')](_0x11e45f)[_0xd7f3('0x2b')](_0x2ee1ba);}};}function respondWithFilteredResult(_0x28e5f8,_0x572553){return function(_0x3319ab){if(_0x3319ab){var _0x317978=_0x3319ab[_0xd7f3('0x2c')],_0xb99665=_0x572553['offset'],_0xba6e70=_0x572553[_0xd7f3('0x2d')]+_0x572553[_0xd7f3('0x2e')],_0x50e197;if(_0xba6e70>=_0x317978){_0xba6e70=_0x317978;_0x50e197=0xc8;}else{_0x50e197=0xce;}_0x28e5f8[_0xd7f3('0x29')](_0x50e197);return _0x28e5f8['set'](_0xd7f3('0x2f'),_0xb99665+'-'+_0xba6e70+'/'+_0x317978)['json'](_0x3319ab);}return null;};}function patchUpdates(_0x194f77){return function(_0x5f0d69){try{jsonpatch[_0xd7f3('0x30')](_0x5f0d69,_0x194f77,!![]);}catch(_0x30c54d){return BPromise[_0xd7f3('0x31')](_0x30c54d);}return _0x5f0d69[_0xd7f3('0x32')]();};}function saveUpdates(_0x36c63e,_0x535bfe){return function(_0x56c1e2){if(_0x56c1e2){return _0x56c1e2[_0xd7f3('0x33')](_0x36c63e)[_0xd7f3('0x1d')](function(_0x4c15bc){return _0x4c15bc;});}return null;};}function removeEntity(_0x4557b4,_0x1bc296){return function(_0xfbe6ab){if(_0xfbe6ab){return _0xfbe6ab[_0xd7f3('0x34')]()[_0xd7f3('0x1d')](function(){_0x4557b4[_0xd7f3('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fd52,_0x3fdda2){return function(_0x51f145){if(!_0x51f145){_0x12fd52['sendStatus'](0x194);}return _0x51f145;};}function handleError(_0x2edc1d,_0x6966ac){_0x6966ac=_0x6966ac||0x1f4;return function(_0x31cd48){logger['error'](_0x31cd48[_0xd7f3('0x35')]);if(_0x31cd48[_0xd7f3('0x36')]){delete _0x31cd48[_0xd7f3('0x36')];}_0x2edc1d['status'](_0x6966ac)[_0xd7f3('0x37')](_0x31cd48);};}exports[_0xd7f3('0x38')]=function(_0x246633,_0x575b18){var _0x5a0322={},_0x4885a9={},_0x2a9b48={'count':0x0,'rows':[]};var _0xcf0c17=_['map'](db[_0xd7f3('0x39')][_0xd7f3('0x3a')],function(_0x44e71b){return{'name':_0x44e71b[_0xd7f3('0x3b')],'type':_0x44e71b[_0xd7f3('0x3c')][_0xd7f3('0x3d')]};});_0x4885a9['model']=_['map'](_0xcf0c17,_0xd7f3('0x36'));_0x4885a9['query']=_[_0xd7f3('0x3e')](_0x246633[_0xd7f3('0x3f')]);_0x4885a9['filters']=_[_0xd7f3('0x40')](_0x4885a9['model'],_0x4885a9['query']);_0x5a0322[_0xd7f3('0x41')]=_[_0xd7f3('0x40')](_0x4885a9[_0xd7f3('0x42')],qs['fields'](_0x246633[_0xd7f3('0x3f')][_0xd7f3('0x43')]));_0x5a0322[_0xd7f3('0x41')]=_0x5a0322[_0xd7f3('0x41')][_0xd7f3('0x44')]?_0x5a0322[_0xd7f3('0x41')]:_0x4885a9[_0xd7f3('0x42')];if(!_0x246633[_0xd7f3('0x3f')][_0xd7f3('0x45')](_0xd7f3('0x46'))){_0x5a0322[_0xd7f3('0x2e')]=qs['limit'](_0x246633[_0xd7f3('0x3f')][_0xd7f3('0x2e')]);_0x5a0322['offset']=qs['offset'](_0x246633['query'][_0xd7f3('0x2d')]);}_0x5a0322[_0xd7f3('0x47')]=qs[_0xd7f3('0x48')](_0x246633[_0xd7f3('0x3f')][_0xd7f3('0x48')]);_0x5a0322[_0xd7f3('0x49')]=qs[_0xd7f3('0x4a')](_[_0xd7f3('0x4b')](_0x246633['query'],_0x4885a9[_0xd7f3('0x4a')]),_0xcf0c17);if(_0x246633[_0xd7f3('0x3f')][_0xd7f3('0x4c')]){_0x5a0322['where']=_[_0xd7f3('0x4d')](_0x5a0322[_0xd7f3('0x49')],{'$or':_[_0xd7f3('0x4e')](_0xcf0c17,function(_0x36a8eb){if(_0x36a8eb[_0xd7f3('0x3c')]!==_0xd7f3('0x4f')){var _0x254868={};_0x254868[_0x36a8eb[_0xd7f3('0x36')]]={'$like':'%'+_0x246633[_0xd7f3('0x3f')]['filter']+'%'};return _0x254868;}})});}_0x5a0322=_['merge']({},_0x5a0322,_0x246633['options']);var _0x140616={'where':_0x5a0322['where']};return db[_0xd7f3('0x39')][_0xd7f3('0x2c')](_0x140616)['then'](function(_0x3afc74){_0x2a9b48[_0xd7f3('0x2c')]=_0x3afc74;if(_0x246633['query'][_0xd7f3('0x50')]){_0x5a0322[_0xd7f3('0x51')]=[{'all':!![]}];}return db[_0xd7f3('0x39')]['findAll'](_0x5a0322);})['then'](function(_0x2cef16){_0x2a9b48[_0xd7f3('0x52')]=_0x2cef16;return _0x2a9b48;})[_0xd7f3('0x1d')](respondWithFilteredResult(_0x575b18,_0x5a0322))['catch'](handleError(_0x575b18,null));};exports[_0xd7f3('0x53')]=function(_0x593244,_0x9f92b1){var _0x23c51e={'raw':![],'where':{'id':_0x593244['params']['id']}},_0x2bce25={};_0x2bce25[_0xd7f3('0x42')]=_[_0xd7f3('0x3e')](db[_0xd7f3('0x39')]['rawAttributes']);_0x2bce25[_0xd7f3('0x3f')]=_[_0xd7f3('0x3e')](_0x593244[_0xd7f3('0x3f')]);_0x2bce25[_0xd7f3('0x4a')]=_[_0xd7f3('0x40')](_0x2bce25[_0xd7f3('0x42')],_0x2bce25[_0xd7f3('0x3f')]);_0x23c51e[_0xd7f3('0x41')]=_[_0xd7f3('0x40')](_0x2bce25[_0xd7f3('0x42')],qs[_0xd7f3('0x43')](_0x593244['query']['fields']));_0x23c51e[_0xd7f3('0x41')]=_0x23c51e[_0xd7f3('0x41')]['length']?_0x23c51e[_0xd7f3('0x41')]:_0x2bce25[_0xd7f3('0x42')];if(_0x593244[_0xd7f3('0x3f')][_0xd7f3('0x50')]){_0x23c51e['include']=[{'all':!![]}];}_0x23c51e=_[_0xd7f3('0x4d')]({},_0x23c51e,_0x593244['options']);return db[_0xd7f3('0x39')][_0xd7f3('0x54')](_0x23c51e)[_0xd7f3('0x1d')](handleEntityNotFound(_0x9f92b1,null))['then'](respondWithResult(_0x9f92b1,null))[_0xd7f3('0x28')](handleError(_0x9f92b1,null));};exports[_0xd7f3('0x55')]=function(_0x5c3508,_0x70112b){return db[_0xd7f3('0x39')]['create'](_0x5c3508[_0xd7f3('0x56')],{})[_0xd7f3('0x1d')](respondWithResult(_0x70112b,0xc9))[_0xd7f3('0x28')](handleError(_0x70112b,null));};exports[_0xd7f3('0x33')]=function(_0x18f0a1,_0x2c6ef7){if(_0x18f0a1[_0xd7f3('0x56')]['id']){delete _0x18f0a1['body']['id'];}return db[_0xd7f3('0x39')][_0xd7f3('0x54')]({'where':{'id':_0x18f0a1['params']['id']}})[_0xd7f3('0x1d')](handleEntityNotFound(_0x2c6ef7,null))['then'](saveUpdates(_0x18f0a1[_0xd7f3('0x56')],null))[_0xd7f3('0x1d')](respondWithResult(_0x2c6ef7,null))[_0xd7f3('0x28')](handleError(_0x2c6ef7,null));};exports[_0xd7f3('0x34')]=function(_0x2d128b,_0x1143d3){return db[_0xd7f3('0x39')]['find']({'where':{'id':_0x2d128b[_0xd7f3('0x57')]['id']}})['then'](handleEntityNotFound(_0x1143d3,null))['then'](removeEntity(_0x1143d3,null))[_0xd7f3('0x28')](handleError(_0x1143d3,null));};exports[_0xd7f3('0x58')]=function(_0x2059e9,_0x1faa84,_0x11f428){var _0x42f952={};var _0x3be91d={};var _0x486e09;var _0x41780e;return db[_0xd7f3('0x39')]['findOne']({'where':{'id':_0x2059e9[_0xd7f3('0x57')]['id']}})[_0xd7f3('0x1d')](handleEntityNotFound(_0x1faa84,null))[_0xd7f3('0x1d')](function(_0x1dc1c1){if(_0x1dc1c1){_0x486e09=_0x1dc1c1;_0x3be91d[_0xd7f3('0x42')]=_[_0xd7f3('0x3e')](db['VtigerConfiguration']['rawAttributes']);_0x3be91d[_0xd7f3('0x3f')]=_[_0xd7f3('0x3e')](_0x2059e9[_0xd7f3('0x3f')]);_0x3be91d['filters']=_[_0xd7f3('0x40')](_0x3be91d[_0xd7f3('0x42')],_0x3be91d['query']);_0x42f952[_0xd7f3('0x41')]=_[_0xd7f3('0x40')](_0x3be91d[_0xd7f3('0x42')],qs[_0xd7f3('0x43')](_0x2059e9[_0xd7f3('0x3f')][_0xd7f3('0x43')]));_0x42f952[_0xd7f3('0x41')]=_0x42f952[_0xd7f3('0x41')][_0xd7f3('0x44')]?_0x42f952['attributes']:_0x3be91d[_0xd7f3('0x42')];_0x42f952['order']=qs['sort'](_0x2059e9[_0xd7f3('0x3f')]['sort']);_0x42f952['where']=qs[_0xd7f3('0x4a')](_[_0xd7f3('0x4b')](_0x2059e9[_0xd7f3('0x3f')],_0x3be91d[_0xd7f3('0x4a')]));if(_0x2059e9['query'][_0xd7f3('0x4c')]){_0x42f952[_0xd7f3('0x49')]=_['merge'](_0x42f952[_0xd7f3('0x49')],{'$or':_[_0xd7f3('0x4e')](_0x42f952[_0xd7f3('0x41')],function(_0x444c09){var _0x3fb62e={};_0x3fb62e[_0x444c09]={'$like':'%'+_0x2059e9['query'][_0xd7f3('0x4c')]+'%'};return _0x3fb62e;})});}_0x42f952=_['merge']({},_0x42f952,_0x2059e9[_0xd7f3('0x59')]);return _0x486e09[_0xd7f3('0x58')](_0x42f952);}})[_0xd7f3('0x1d')](function(_0x11c556){if(_0x11c556){_0x41780e=_0x11c556[_0xd7f3('0x44')];if(!_0x2059e9['query'][_0xd7f3('0x45')](_0xd7f3('0x46'))){_0x42f952[_0xd7f3('0x2e')]=qs[_0xd7f3('0x2e')](_0x2059e9[_0xd7f3('0x3f')][_0xd7f3('0x2e')]);_0x42f952[_0xd7f3('0x2d')]=qs['offset'](_0x2059e9[_0xd7f3('0x3f')][_0xd7f3('0x2d')]);}return _0x486e09[_0xd7f3('0x58')](_0x42f952);}})[_0xd7f3('0x1d')](function(_0x2a5766){if(_0x2a5766){return _0x2a5766?{'count':_0x41780e,'rows':_0x2a5766}:null;}})[_0xd7f3('0x1d')](respondWithResult(_0x1faa84,null))['catch'](handleError(_0x1faa84,null));};exports[_0xd7f3('0x5a')]=function(_0x362816,_0x2d6188,_0x292ef3){if(_0x362816[_0xd7f3('0x56')]['id']){delete _0x362816[_0xd7f3('0x56')]['id'];}return db[_0xd7f3('0x39')][_0xd7f3('0x5b')]({'where':{'id':_0x362816[_0xd7f3('0x57')]['id']}})[_0xd7f3('0x1d')](handleEntityNotFound(_0x2d6188,null))[_0xd7f3('0x1d')](function(_0xdd50a0){if(_0xdd50a0){_0x362816['body']['AccountId']=_0xdd50a0['id'];_0x362816[_0xd7f3('0x56')]['Subjects']=integrations['getSubjects'](_0x362816[_0xd7f3('0x56')][_0xd7f3('0x5c')],_0x362816['body']['type']);_0x362816[_0xd7f3('0x56')][_0xd7f3('0x5d')]=integrations[_0xd7f3('0x5e')](_0x362816[_0xd7f3('0x56')][_0xd7f3('0x5c')],_0x362816[_0xd7f3('0x56')][_0xd7f3('0x3c')]);return db[_0xd7f3('0x5f')][_0xd7f3('0x55')](_0x362816[_0xd7f3('0x56')],{'include':[{'model':db[_0xd7f3('0x60')],'as':_0xd7f3('0x61')},{'model':db[_0xd7f3('0x60')],'as':_0xd7f3('0x5d')}]});}return null;})[_0xd7f3('0x1d')](respondWithResult(_0x2d6188,null))[_0xd7f3('0x28')](handleError(_0x2d6188,null));};var md5=require('md5');exports['getFields']=function(_0xdc7400,_0x3fab60,_0x4b486b){var _0x19f793=null;var _0x4104a4=null;var _0x3b0a46=null;var _0x3b07c8=null;var _0x36825a='';return db[_0xd7f3('0x39')]['findOne']({'where':{'id':_0xdc7400['params']['id']},'attributes':['id',_0xd7f3('0x36'),_0xd7f3('0x62'),'description',_0xd7f3('0x63'),_0xd7f3('0x64'),_0xd7f3('0x65'),_0xd7f3('0x66')]})[_0xd7f3('0x1d')](handleEntityNotFound(_0x3fab60,null))[_0xd7f3('0x1d')](function(_0x2544a4){if(_0x2544a4){_0x19f793=_0x2544a4[_0xd7f3('0x62')];_0x4104a4=_0x2544a4[_0xd7f3('0x66')];_0x3b0a46=_0x2544a4['moduleName'];_0x36825a=_0x2544a4[_0xd7f3('0x64')];var _0x37cbc9=_0x36825a[_0xd7f3('0x67')](-0x1);if(_0x37cbc9==='/'){_0x36825a=_0x36825a['substring'](0x0,_0x36825a[_0xd7f3('0x68')](_0x37cbc9));}_0x3b07c8=util[_0xd7f3('0x69')](_0xd7f3('0x6a'),_0x36825a);var _0x5110e4={'method':_0xd7f3('0x6b'),'uri':_0x3b07c8,'qs':{'operation':_0xd7f3('0x6c'),'username':_0x2544a4[_0xd7f3('0x62')]},'json':!![]};return rp(_0x5110e4);}})[_0xd7f3('0x1d')](function(_0xa95e5a){if(_0xa95e5a[_0xd7f3('0x6d')]){var _0x38ada5={'method':_0xd7f3('0x6e'),'uri':_0x3b07c8,'form':{'operation':'login','username':_0x19f793,'accessKey':md5(_0xa95e5a[_0xd7f3('0x27')][_0xd7f3('0x6f')]+_0x4104a4)},'json':!![]};return rp(_0x38ada5);}})[_0xd7f3('0x1d')](function(_0x332263){if(_0x332263[_0xd7f3('0x6d')]){var _0x2a9064={'method':_0xd7f3('0x6b'),'uri':_0x3b07c8,'qs':{'operation':_0xd7f3('0x70'),'username':_0x19f793,'sessionName':_0x332263[_0xd7f3('0x27')]['sessionName'],'elementType':_0x3b0a46},'json':!![]};return rp(_0x2a9064);}})['then'](function(_0x3ec360){if(_0x3ec360[_0xd7f3('0x6d')]){var _0x71c778=[_0xd7f3('0x71'),'reference',_0xd7f3('0x72')];_[_0xd7f3('0x73')](_0x3ec360[_0xd7f3('0x27')][_0xd7f3('0x43')],function(_0x4710ea){return _0x71c778['includes'](_0x4710ea[_0xd7f3('0x3c')][_0xd7f3('0x36')]);});_[_0xd7f3('0x73')](_0x3ec360[_0xd7f3('0x27')][_0xd7f3('0x43')],function(_0x3f2cd6){return _0x3f2cd6['editable']===_0xd7f3('0x74');});return{'count':_0x3ec360[_0xd7f3('0x27')][_0xd7f3('0x43')][_0xd7f3('0x44')],'rows':_[_0xd7f3('0x4e')](_0x3ec360[_0xd7f3('0x27')]['fields'],function(_0x2999ce){return{'id':_0x2999ce['name'],'name':_0x2999ce['label'],'custom':_[_0xd7f3('0x75')](_0x2999ce['name'],_0xd7f3('0x76'))?!![]:![],'options':_0x2999ce[_0xd7f3('0x3c')][_0xd7f3('0x36')]===_0xd7f3('0x77')&&_0x2999ce[_0xd7f3('0x3c')]['picklistValues']['length']>0x0?_[_0xd7f3('0x4e')](_0x2999ce[_0xd7f3('0x3c')][_0xd7f3('0x78')],function(_0x2121d4){return{'name':_0x2121d4[_0xd7f3('0x79')],'value':_0x2121d4[_0xd7f3('0x7a')]};}):[]};})};}})[_0xd7f3('0x1d')](respondWithResult(_0x3fab60,null))[_0xd7f3('0x28')](function(_0x2a03f8){console[_0xd7f3('0x7b')](_0xd7f3('0x7c')+_0x2a03f8);var _0x8ba685=_0xdc7400[_0xd7f3('0x3f')][_0xd7f3('0x19')]?0x1f4:_0x2a03f8[_0xd7f3('0x7d')]||0x1f4;logger[_0xd7f3('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xd7f3('0x7e'),_0x8ba685,JSON[_0xd7f3('0x23')](_0x2a03f8));delete _0x2a03f8[_0xd7f3('0x36')];if(_0x8ba685===0x191){_0x8ba685=0x190;}_0x3fab60[_0xd7f3('0x29')](_0x8ba685)[_0xd7f3('0x37')](_0xdc7400[_0xd7f3('0x3f')][_0xd7f3('0x19')]?{'message':_0xd7f3('0x7f'),'statusCode':_0x2a03f8[_0xd7f3('0x7d')]}:_0x2a03f8);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6187828..14eeefd 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 _0x27d1=['define','int_vtiger_accounts','util','api','moment','bluebird','request-promise','path','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27d1,0xfe));var _0x127d=function(_0x49f744,_0x501293){_0x49f744=_0x49f744-0x0;var _0x111c19=_0x27d1[_0x49f744];return _0x111c19;};'use strict';var _=require('lodash');var util=require(_0x127d('0x0'));var logger=require('../../config/logger')(_0x127d('0x1'));var moment=require(_0x127d('0x2'));var BPromise=require(_0x127d('0x3'));var rp=require(_0x127d('0x4'));var fs=require('fs');var path=require(_0x127d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x127d('0x6')]=function(_0x23a9e7,_0x6744d4){return _0x23a9e7[_0x127d('0x7')]('VtigerAccount',attributes,{'tableName':_0x127d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdefe=['api','moment','bluebird','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xdefe,0x19e));var _0xedef=function(_0x2a9f2d,_0xc194f4){_0x2a9f2d=_0x2a9f2d-0x0;var _0x287ce2=_0xdefe[_0x2a9f2d];return _0x287ce2;};'use strict';var _=require(_0xedef('0x0'));var util=require('util');var logger=require(_0xedef('0x1'))(_0xedef('0x2'));var moment=require(_0xedef('0x3'));var BPromise=require(_0xedef('0x4'));var rp=require(_0xedef('0x5'));var fs=require('fs');var path=require(_0xedef('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xedef('0x7'));var integrations=require(_0xedef('0x8'));module[_0xedef('0x9')]=function(_0x5e6739,_0x1396e0){return _0x5e6739[_0xedef('0xa')](_0xedef('0xb'),attributes,{'tableName':_0xedef('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 ac55524..47e4d09 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 _0xc532=['VtigerAccount','options','raw','attributes','map','include','model','then','catch','ShowVtigerAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','info','result','GetVtigerAccount'];(function(_0x5b0e74,_0x1db2ae){var _0xa9cfb=function(_0x395823){while(--_0x395823){_0x5b0e74['push'](_0x5b0e74['shift']());}};_0xa9cfb(++_0x1db2ae);}(_0xc532,0x103));var _0x2c53=function(_0xd5c39d,_0x4b976c){_0xd5c39d=_0xd5c39d-0x0;var _0x67da71=_0xc532[_0xd5c39d];return _0x67da71;};'use strict';var _=require(_0x2c53('0x0'));var util=require(_0x2c53('0x1'));var moment=require('moment');var BPromise=require(_0x2c53('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c53('0x3'));var db=require(_0x2c53('0x4'))['db'];var utils=require(_0x2c53('0x5'));var logger=require('../../config/logger')(_0x2c53('0x6'));var config=require(_0x2c53('0x7'));var jayson=require(_0x2c53('0x8'));var client=jayson['client'][_0x2c53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59f95c,_0xaa1b32,_0x5acdbc){return new BPromise(function(_0x1d2c54,_0x56a010){return client['request'](_0x59f95c,_0x5acdbc)['then'](function(_0x4f02e9){logger['info']('VtigerAccount,\x20%s,\x20%s',_0xaa1b32,_0x2c53('0xa'));logger[_0x2c53('0xb')](_0x2c53('0xc'),_0xaa1b32,'request\x20sent',JSON[_0x2c53('0xd')](_0x4f02e9));if(_0x4f02e9[_0x2c53('0xe')]){if(_0x4f02e9[_0x2c53('0xe')]['code']===0x1f4){logger[_0x2c53('0xe')](_0x2c53('0xf'),_0xaa1b32,_0x4f02e9[_0x2c53('0xe')][_0x2c53('0x10')]);return _0x56a010(_0x4f02e9[_0x2c53('0xe')][_0x2c53('0x10')]);}logger[_0x2c53('0xe')](_0x2c53('0xf'),_0xaa1b32,_0x4f02e9['error']['message']);return _0x1d2c54(_0x4f02e9[_0x2c53('0xe')]['message']);}else{logger[_0x2c53('0x11')](_0x2c53('0xf'),_0xaa1b32,_0x2c53('0xa'));_0x1d2c54(_0x4f02e9[_0x2c53('0x12')][_0x2c53('0x10')]);}})['catch'](function(_0x1245ed){logger[_0x2c53('0xe')](_0x2c53('0xf'),_0xaa1b32,_0x1245ed);_0x56a010(_0x1245ed);});});}exports[_0x2c53('0x13')]=function(_0x527431){var _0x5e59ab=this;return new Promise(function(_0x121c8c,_0x4b9602){return db[_0x2c53('0x14')]['findAll']({'raw':_0x527431[_0x2c53('0x15')]?_0x527431[_0x2c53('0x15')][_0x2c53('0x16')]===undefined?!![]:![]:!![],'where':_0x527431['options']?_0x527431[_0x2c53('0x15')]['where']||null:null,'attributes':_0x527431['options']?_0x527431[_0x2c53('0x15')][_0x2c53('0x17')]||null:null,'limit':_0x527431['options']?_0x527431[_0x2c53('0x15')]['limit']||null:null,'include':_0x527431[_0x2c53('0x15')]?_0x527431['options']['include']?_[_0x2c53('0x18')](_0x527431['options'][_0x2c53('0x19')],function(_0x4a165f){return{'model':db[_0x4a165f[_0x2c53('0x1a')]],'as':_0x4a165f['as'],'attributes':_0x4a165f[_0x2c53('0x17')],'include':_0x4a165f[_0x2c53('0x19')]?_['map'](_0x4a165f[_0x2c53('0x19')],function(_0x25bc1d){return{'model':db[_0x25bc1d[_0x2c53('0x1a')]],'as':_0x25bc1d['as'],'attributes':_0x25bc1d[_0x2c53('0x17')],'include':_0x25bc1d[_0x2c53('0x19')]?_[_0x2c53('0x18')](_0x25bc1d[_0x2c53('0x19')],function(_0x5ec9e1){return{'model':db[_0x5ec9e1[_0x2c53('0x1a')]],'as':_0x5ec9e1['as'],'attributes':_0x5ec9e1[_0x2c53('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2c53('0x1b')](function(_0x1565cf){logger['info'](_0x2c53('0x13'),_0x527431);logger[_0x2c53('0xb')](_0x2c53('0x13'),_0x527431,JSON[_0x2c53('0xd')](_0x1565cf));_0x121c8c(_0x1565cf);})[_0x2c53('0x1c')](function(_0x33b73b){logger[_0x2c53('0xe')](_0x2c53('0x13'),_0x33b73b[_0x2c53('0x10')],_0x527431);_0x4b9602(_0x5e59ab[_0x2c53('0xe')](0x1f4,_0x33b73b[_0x2c53('0x10')]));});});};exports[_0x2c53('0x1d')]=function(_0x1aa926){var _0x554e9b=this;return new Promise(function(_0x5c1acc,_0x417753){return db[_0x2c53('0x14')]['find']({'raw':_0x1aa926[_0x2c53('0x15')]?_0x1aa926[_0x2c53('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1aa926[_0x2c53('0x15')]?_0x1aa926[_0x2c53('0x15')][_0x2c53('0x1e')]||null:null,'attributes':_0x1aa926[_0x2c53('0x15')]?_0x1aa926['options'][_0x2c53('0x17')]||null:null,'include':_0x1aa926['options']?_0x1aa926[_0x2c53('0x15')]['include']?_[_0x2c53('0x18')](_0x1aa926[_0x2c53('0x15')][_0x2c53('0x19')],function(_0x561bc8){return{'model':db[_0x561bc8['model']],'as':_0x561bc8['as'],'attributes':_0x561bc8[_0x2c53('0x17')],'include':_0x561bc8[_0x2c53('0x19')]?_[_0x2c53('0x18')](_0x561bc8[_0x2c53('0x19')],function(_0x38acd8){return{'model':db[_0x38acd8['model']],'as':_0x38acd8['as'],'attributes':_0x38acd8[_0x2c53('0x17')],'include':_0x38acd8[_0x2c53('0x19')]?_[_0x2c53('0x18')](_0x38acd8[_0x2c53('0x19')],function(_0x48c079){return{'model':db[_0x48c079['model']],'as':_0x48c079['as'],'attributes':_0x48c079[_0x2c53('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2c53('0x1b')](function(_0x167833){logger[_0x2c53('0x11')](_0x2c53('0x1d'),_0x1aa926);logger[_0x2c53('0xb')](_0x2c53('0x1d'),_0x1aa926,JSON[_0x2c53('0xd')](_0x167833));_0x5c1acc(_0x167833);})[_0x2c53('0x1c')](function(_0x477022){logger['error']('ShowVtigerAccount',_0x477022['message'],_0x1aa926);_0x417753(_0x554e9b[_0x2c53('0xe')](0x1f4,_0x477022[_0x2c53('0x10')]));});});}; \ No newline at end of file +var _0xf415=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf415,0x87));var _0x5f41=function(_0x3c3c59,_0x121ada){_0x3c3c59=_0x3c3c59-0x0;var _0x3e6952=_0xf415[_0x3c3c59];return _0x3e6952;};'use strict';var _=require(_0x5f41('0x0'));var util=require(_0x5f41('0x1'));var moment=require(_0x5f41('0x2'));var BPromise=require(_0x5f41('0x3'));var rs=require(_0x5f41('0x4'));var fs=require('fs');var Redis=require(_0x5f41('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f41('0x6'))(_0x5f41('0x7'));var config=require(_0x5f41('0x8'));var jayson=require(_0x5f41('0x9'));var client=jayson['client'][_0x5f41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d0fd,_0x3fa52e,_0x19bf0b){return new BPromise(function(_0x38f0fa,_0xec02b9){return client[_0x5f41('0xb')](_0x31d0fd,_0x19bf0b)[_0x5f41('0xc')](function(_0x5938cd){logger[_0x5f41('0xd')](_0x5f41('0xe'),_0x3fa52e,_0x5f41('0xf'));logger['debug'](_0x5f41('0x10'),_0x3fa52e,_0x5f41('0xf'),JSON[_0x5f41('0x11')](_0x5938cd));if(_0x5938cd[_0x5f41('0x12')]){if(_0x5938cd[_0x5f41('0x12')][_0x5f41('0x13')]===0x1f4){logger[_0x5f41('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x3fa52e,_0x5938cd[_0x5f41('0x12')]['message']);return _0xec02b9(_0x5938cd[_0x5f41('0x12')]['message']);}logger[_0x5f41('0x12')](_0x5f41('0xe'),_0x3fa52e,_0x5938cd[_0x5f41('0x12')][_0x5f41('0x14')]);return _0x38f0fa(_0x5938cd[_0x5f41('0x12')][_0x5f41('0x14')]);}else{logger[_0x5f41('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x3fa52e,_0x5f41('0xf'));_0x38f0fa(_0x5938cd['result'][_0x5f41('0x14')]);}})[_0x5f41('0x15')](function(_0x9117d4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3fa52e,_0x9117d4);_0xec02b9(_0x9117d4);});});}exports[_0x5f41('0x16')]=function(_0x544270){var _0x25619d=this;return new Promise(function(_0x2a749d,_0x56731c){return db[_0x5f41('0x17')][_0x5f41('0x18')]({'raw':_0x544270['options']?_0x544270[_0x5f41('0x19')][_0x5f41('0x1a')]===undefined?!![]:![]:!![],'where':_0x544270['options']?_0x544270[_0x5f41('0x19')][_0x5f41('0x1b')]||null:null,'attributes':_0x544270[_0x5f41('0x19')]?_0x544270[_0x5f41('0x19')][_0x5f41('0x1c')]||null:null,'limit':_0x544270[_0x5f41('0x19')]?_0x544270[_0x5f41('0x19')]['limit']||null:null,'include':_0x544270['options']?_0x544270['options'][_0x5f41('0x1d')]?_[_0x5f41('0x1e')](_0x544270[_0x5f41('0x19')][_0x5f41('0x1d')],function(_0x5121d1){return{'model':db[_0x5121d1[_0x5f41('0x1f')]],'as':_0x5121d1['as'],'attributes':_0x5121d1[_0x5f41('0x1c')],'include':_0x5121d1['include']?_[_0x5f41('0x1e')](_0x5121d1[_0x5f41('0x1d')],function(_0x19d5df){return{'model':db[_0x19d5df['model']],'as':_0x19d5df['as'],'attributes':_0x19d5df[_0x5f41('0x1c')],'include':_0x19d5df[_0x5f41('0x1d')]?_[_0x5f41('0x1e')](_0x19d5df[_0x5f41('0x1d')],function(_0x59ab5b){return{'model':db[_0x59ab5b[_0x5f41('0x1f')]],'as':_0x59ab5b['as'],'attributes':_0x59ab5b[_0x5f41('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5f41('0xc')](function(_0x3fefb4){logger[_0x5f41('0xd')]('GetVtigerAccount',_0x544270);logger[_0x5f41('0x20')]('GetVtigerAccount',_0x544270,JSON[_0x5f41('0x11')](_0x3fefb4));_0x2a749d(_0x3fefb4);})['catch'](function(_0x3f7618){logger[_0x5f41('0x12')]('GetVtigerAccount',_0x3f7618['message'],_0x544270);_0x56731c(_0x25619d[_0x5f41('0x12')](0x1f4,_0x3f7618[_0x5f41('0x14')]));});});};exports[_0x5f41('0x21')]=function(_0x182b5d){var _0x573ea0=this;return new Promise(function(_0x55186a,_0x59f28b){return db[_0x5f41('0x17')][_0x5f41('0x22')]({'raw':_0x182b5d['options']?_0x182b5d[_0x5f41('0x19')][_0x5f41('0x1a')]===undefined?!![]:![]:!![],'where':_0x182b5d[_0x5f41('0x19')]?_0x182b5d['options'][_0x5f41('0x1b')]||null:null,'attributes':_0x182b5d[_0x5f41('0x19')]?_0x182b5d[_0x5f41('0x19')][_0x5f41('0x1c')]||null:null,'include':_0x182b5d[_0x5f41('0x19')]?_0x182b5d[_0x5f41('0x19')][_0x5f41('0x1d')]?_[_0x5f41('0x1e')](_0x182b5d[_0x5f41('0x19')][_0x5f41('0x1d')],function(_0x1d3556){return{'model':db[_0x1d3556[_0x5f41('0x1f')]],'as':_0x1d3556['as'],'attributes':_0x1d3556['attributes'],'include':_0x1d3556[_0x5f41('0x1d')]?_['map'](_0x1d3556[_0x5f41('0x1d')],function(_0x2e13f6){return{'model':db[_0x2e13f6['model']],'as':_0x2e13f6['as'],'attributes':_0x2e13f6[_0x5f41('0x1c')],'include':_0x2e13f6[_0x5f41('0x1d')]?_['map'](_0x2e13f6[_0x5f41('0x1d')],function(_0x207152){return{'model':db[_0x207152['model']],'as':_0x207152['as'],'attributes':_0x207152[_0x5f41('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5f41('0xc')](function(_0x1fbe9f){logger['info']('ShowVtigerAccount',_0x182b5d);logger[_0x5f41('0x20')](_0x5f41('0x21'),_0x182b5d,JSON[_0x5f41('0x11')](_0x1fbe9f));_0x55186a(_0x1fbe9f);})[_0x5f41('0x15')](function(_0x209c38){logger['error']('ShowVtigerAccount',_0x209c38[_0x5f41('0x14')],_0x182b5d);_0x59f28b(_0x573ea0[_0x5f41('0x12')](0x1f4,_0x209c38[_0x5f41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8d6cdc2..8f6a52c 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x4c94d1,_0x573a4f){var _0x48c2c3=function(_0x326bcc){while(--_0x326bcc){_0x4c94d1['push'](_0x4c94d1['shift']());}};_0x48c2c3(++_0x573a4f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f95869a..397811e 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 _0x2a66=['STRING','sequelize','exports'];(function(_0x556baa,_0x149ec3){var _0x28771f=function(_0x5a5bde){while(--_0x5a5bde){_0x556baa['push'](_0x556baa['shift']());}};_0x28771f(++_0x149ec3);}(_0x2a66,0x76));var _0x62a6=function(_0x5160b6,_0x261d95){_0x5160b6=_0x5160b6-0x0;var _0x200f73=_0x2a66[_0x5160b6];return _0x200f73;};'use strict';var Sequelize=require(_0x62a6('0x0'));module[_0x62a6('0x1')]={'name':{'type':Sequelize[_0x62a6('0x2')]},'description':{'type':Sequelize[_0x62a6('0x2')]}}; \ No newline at end of file +var _0x006c=['sequelize'];(function(_0x2c3caf,_0x2f237c){var _0x220d6b=function(_0x36f25c){while(--_0x36f25c){_0x2c3caf['push'](_0x2c3caf['shift']());}};_0x220d6b(++_0x2f237c);}(_0x006c,0x1c1));var _0xc006=function(_0x36f951,_0x13a77b){_0x36f951=_0x36f951-0x0;var _0x59c536=_0x006c[_0x36f951];return _0x59c536;};'use strict';var Sequelize=require(_0xc006('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b09143b..c4d72fe 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 _0xc153=['limit','Content-Range','apply','save','update','sendStatus','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','include','findAll','rows','attributes','find','create','body','params','destroy','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset'];(function(_0x5e4fa8,_0x18dbd9){var _0x4f385c=function(_0x7c4d74){while(--_0x7c4d74){_0x5e4fa8['push'](_0x5e4fa8['shift']());}};_0x4f385c(++_0x18dbd9);}(_0xc153,0x89));var _0x3c15=function(_0x5e5018,_0x4a8db4){_0x5e5018=_0x5e5018-0x0;var _0x47a9b5=_0xc153[_0x5e5018];return _0x47a9b5;};'use strict';var pdf=require(_0x3c15('0x0'));var emlformat=require(_0x3c15('0x1'));var rimraf=require(_0x3c15('0x2'));var zipdir=require(_0x3c15('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c15('0x4'));var moment=require(_0x3c15('0x5'));var BPromise=require(_0x3c15('0x6'));var Mustache=require(_0x3c15('0x7'));var util=require(_0x3c15('0x8'));var path=require(_0x3c15('0x9'));var sox=require(_0x3c15('0xa'));var csv=require(_0x3c15('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c15('0xc'));var squel=require(_0x3c15('0xd'));var crypto=require(_0x3c15('0xe'));var jsforce=require(_0x3c15('0xf'));var deskjs=require(_0x3c15('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c15('0x11'));var Redis=require(_0x3c15('0x12'));var authService=require(_0x3c15('0x13'));var qs=require(_0x3c15('0x14'));var as=require(_0x3c15('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c15('0x16'))(_0x3c15('0x17'));var utils=require('../../config/utils');var config=require(_0x3c15('0x18'));var db=require(_0x3c15('0x19'))['db'];var jayson=require(_0x3c15('0x1a'));var client=jayson[_0x3c15('0x1b')][_0x3c15('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2dcad5,_0x1d538d,_0x5c1adf){if(_0x5c1adf){var _0x196d86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x196d86[_0x3c15('0x1d')](_0x1d538d)){return _0x2dcad5;}else{throw new db[(_0x3c15('0x1e'))][(_0x3c15('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 _0x2dcad5;}}function respondWithRpcPromise(_0xb1697d,_0x471a02,_0x38d25e,_0x491a1e){return new BPromise(function(_0x48b06c,_0x5b7003){var _0x2c53c1=_0x491a1e||client;return _0x2c53c1[_0x3c15('0x20')](_0xb1697d,_0x38d25e)[_0x3c15('0x21')](function(_0x55dd78){logger[_0x3c15('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x471a02,_0x3c15('0x23'));logger[_0x3c15('0x24')](_0x3c15('0x25'),_0x471a02,_0x3c15('0x23'),JSON[_0x3c15('0x26')](_0x55dd78));if(_0x55dd78['error']){if(_0x55dd78[_0x3c15('0x27')]['code']===0x1f4){logger[_0x3c15('0x27')](_0x3c15('0x28'),_0x471a02,_0x55dd78[_0x3c15('0x27')][_0x3c15('0x29')]);return _0x5b7003(_0x55dd78[_0x3c15('0x27')][_0x3c15('0x29')]);}logger[_0x3c15('0x27')](_0x3c15('0x28'),_0x471a02,_0x55dd78['error'][_0x3c15('0x29')]);return _0x48b06c(_0x55dd78[_0x3c15('0x27')][_0x3c15('0x29')]);}else{logger[_0x3c15('0x22')](_0x3c15('0x28'),_0x471a02,_0x3c15('0x23'));_0x48b06c(_0x55dd78[_0x3c15('0x2a')][_0x3c15('0x29')]);}})[_0x3c15('0x2b')](function(_0x51fbf3){logger[_0x3c15('0x27')]('VtigerConfiguration,\x20%s,\x20%s',_0x471a02,_0x51fbf3);_0x5b7003(_0x51fbf3);});});}function respondWithStatusCode(_0x473244,_0x43d390){_0x43d390=_0x43d390||0xcc;return function(_0x17d7ed){if(_0x17d7ed){return _0x473244['sendStatus'](_0x43d390);}return _0x473244[_0x3c15('0x2c')](_0x43d390)[_0x3c15('0x2d')]();};}function respondWithResult(_0xaeb9e2,_0x31522e){_0x31522e=_0x31522e||0xc8;return function(_0xc656b2){if(_0xc656b2){return _0xaeb9e2[_0x3c15('0x2c')](_0x31522e)[_0x3c15('0x2e')](_0xc656b2);}};}function respondWithFilteredResult(_0x50b32a,_0x273ea0){return function(_0x31c67b){if(_0x31c67b){var _0x52a95c=_0x31c67b[_0x3c15('0x2f')],_0x193115=_0x273ea0[_0x3c15('0x30')],_0x4bc693=_0x273ea0['offset']+_0x273ea0[_0x3c15('0x31')],_0x1bd81f;if(_0x4bc693>=_0x52a95c){_0x4bc693=_0x52a95c;_0x1bd81f=0xc8;}else{_0x1bd81f=0xce;}_0x50b32a[_0x3c15('0x2c')](_0x1bd81f);return _0x50b32a['set'](_0x3c15('0x32'),_0x193115+'-'+_0x4bc693+'/'+_0x52a95c)[_0x3c15('0x2e')](_0x31c67b);}return null;};}function patchUpdates(_0x37d2b7){return function(_0x368e02){try{jsonpatch[_0x3c15('0x33')](_0x368e02,_0x37d2b7,!![]);}catch(_0x2b97fa){return BPromise['reject'](_0x2b97fa);}return _0x368e02[_0x3c15('0x34')]();};}function saveUpdates(_0x561abb,_0x53ba18){return function(_0x6ab0c0){if(_0x6ab0c0){return _0x6ab0c0[_0x3c15('0x35')](_0x561abb)['then'](function(_0xda486c){return _0xda486c;});}return null;};}function removeEntity(_0x498252,_0x2f36da){return function(_0x59119a){if(_0x59119a){return _0x59119a['destroy']()[_0x3c15('0x21')](function(){_0x498252['status'](0xcc)[_0x3c15('0x2d')]();});}};}function handleEntityNotFound(_0x22feb0,_0x432ab0){return function(_0x1fc1e1){if(!_0x1fc1e1){_0x22feb0[_0x3c15('0x36')](0x194);}return _0x1fc1e1;};}function handleError(_0x628575,_0x324a61){_0x324a61=_0x324a61||0x1f4;return function(_0x4acd03){logger[_0x3c15('0x27')](_0x4acd03[_0x3c15('0x37')]);if(_0x4acd03[_0x3c15('0x38')]){delete _0x4acd03[_0x3c15('0x38')];}_0x628575[_0x3c15('0x2c')](_0x324a61)[_0x3c15('0x39')](_0x4acd03);};}exports['index']=function(_0x28b425,_0x5f0e19){var _0x3776e3={},_0x240603={},_0x549549={'count':0x0,'rows':[]};var _0x255364=_[_0x3c15('0x3a')](db[_0x3c15('0x3b')][_0x3c15('0x3c')],function(_0xb4bc4){return{'name':_0xb4bc4[_0x3c15('0x3d')],'type':_0xb4bc4['type']['key']};});_0x240603[_0x3c15('0x3e')]=_[_0x3c15('0x3a')](_0x255364,_0x3c15('0x38'));_0x240603[_0x3c15('0x3f')]=_[_0x3c15('0x40')](_0x28b425['query']);_0x240603[_0x3c15('0x41')]=_[_0x3c15('0x42')](_0x240603[_0x3c15('0x3e')],_0x240603['query']);_0x3776e3['attributes']=_[_0x3c15('0x42')](_0x240603[_0x3c15('0x3e')],qs[_0x3c15('0x43')](_0x28b425['query'][_0x3c15('0x43')]));_0x3776e3['attributes']=_0x3776e3['attributes'][_0x3c15('0x44')]?_0x3776e3['attributes']:_0x240603[_0x3c15('0x3e')];if(!_0x28b425['query'][_0x3c15('0x45')](_0x3c15('0x46'))){_0x3776e3[_0x3c15('0x31')]=qs[_0x3c15('0x31')](_0x28b425[_0x3c15('0x3f')][_0x3c15('0x31')]);_0x3776e3[_0x3c15('0x30')]=qs[_0x3c15('0x30')](_0x28b425[_0x3c15('0x3f')][_0x3c15('0x30')]);}_0x3776e3[_0x3c15('0x47')]=qs[_0x3c15('0x48')](_0x28b425[_0x3c15('0x3f')][_0x3c15('0x48')]);_0x3776e3[_0x3c15('0x49')]=qs[_0x3c15('0x41')](_['pick'](_0x28b425['query'],_0x240603[_0x3c15('0x41')]),_0x255364);if(_0x28b425[_0x3c15('0x3f')][_0x3c15('0x4a')]){_0x3776e3[_0x3c15('0x49')]=_[_0x3c15('0x4b')](_0x3776e3[_0x3c15('0x49')],{'$or':_[_0x3c15('0x3a')](_0x255364,function(_0x1087a6){if(_0x1087a6[_0x3c15('0x4c')]!=='VIRTUAL'){var _0x223129={};_0x223129[_0x1087a6[_0x3c15('0x38')]]={'$like':'%'+_0x28b425[_0x3c15('0x3f')][_0x3c15('0x4a')]+'%'};return _0x223129;}})});}_0x3776e3=_[_0x3c15('0x4b')]({},_0x3776e3,_0x28b425[_0x3c15('0x4d')]);var _0x105fb3={'where':_0x3776e3[_0x3c15('0x49')]};return db[_0x3c15('0x3b')][_0x3c15('0x2f')](_0x105fb3)[_0x3c15('0x21')](function(_0x5b40ec){_0x549549[_0x3c15('0x2f')]=_0x5b40ec;if(_0x28b425['query']['includeAll']){_0x3776e3[_0x3c15('0x4e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x3c15('0x4f')](_0x3776e3);})[_0x3c15('0x21')](function(_0x5cc520){_0x549549[_0x3c15('0x50')]=_0x5cc520;return _0x549549;})[_0x3c15('0x21')](respondWithFilteredResult(_0x5f0e19,_0x3776e3))[_0x3c15('0x2b')](handleError(_0x5f0e19,null));};exports['show']=function(_0x36ad4e,_0x10f8ab){var _0x5bce3f={'raw':![],'where':{'id':_0x36ad4e['params']['id']}},_0x1bd0e8={};_0x1bd0e8[_0x3c15('0x3e')]=_['keys'](db['VtigerConfiguration'][_0x3c15('0x3c')]);_0x1bd0e8[_0x3c15('0x3f')]=_[_0x3c15('0x40')](_0x36ad4e[_0x3c15('0x3f')]);_0x1bd0e8[_0x3c15('0x41')]=_['intersection'](_0x1bd0e8[_0x3c15('0x3e')],_0x1bd0e8[_0x3c15('0x3f')]);_0x5bce3f['attributes']=_[_0x3c15('0x42')](_0x1bd0e8[_0x3c15('0x3e')],qs[_0x3c15('0x43')](_0x36ad4e['query'][_0x3c15('0x43')]));_0x5bce3f[_0x3c15('0x51')]=_0x5bce3f[_0x3c15('0x51')]['length']?_0x5bce3f[_0x3c15('0x51')]:_0x1bd0e8['model'];if(_0x36ad4e['query']['includeAll']){_0x5bce3f[_0x3c15('0x4e')]=[{'all':!![]}];}_0x5bce3f=_[_0x3c15('0x4b')]({},_0x5bce3f,_0x36ad4e[_0x3c15('0x4d')]);return db[_0x3c15('0x3b')][_0x3c15('0x52')](_0x5bce3f)['then'](handleEntityNotFound(_0x10f8ab,null))[_0x3c15('0x21')](respondWithResult(_0x10f8ab,null))['catch'](handleError(_0x10f8ab,null));};exports[_0x3c15('0x53')]=function(_0x4bf699,_0xc9ecee){return db['VtigerConfiguration'][_0x3c15('0x53')](_0x4bf699[_0x3c15('0x54')],{})[_0x3c15('0x21')](respondWithResult(_0xc9ecee,0xc9))[_0x3c15('0x2b')](handleError(_0xc9ecee,null));};exports[_0x3c15('0x35')]=function(_0x720d49,_0x12fa66){if(_0x720d49[_0x3c15('0x54')]['id']){delete _0x720d49[_0x3c15('0x54')]['id'];}return db[_0x3c15('0x3b')][_0x3c15('0x52')]({'where':{'id':_0x720d49[_0x3c15('0x55')]['id']}})[_0x3c15('0x21')](handleEntityNotFound(_0x12fa66,null))['then'](saveUpdates(_0x720d49[_0x3c15('0x54')],null))['then'](respondWithResult(_0x12fa66,null))[_0x3c15('0x2b')](handleError(_0x12fa66,null));};exports[_0x3c15('0x56')]=function(_0x34b43e,_0x4bc000){return db[_0x3c15('0x3b')][_0x3c15('0x52')]({'where':{'id':_0x34b43e[_0x3c15('0x55')]['id']}})[_0x3c15('0x21')](handleEntityNotFound(_0x4bc000,null))[_0x3c15('0x21')](removeEntity(_0x4bc000,null))[_0x3c15('0x2b')](handleError(_0x4bc000,null));};exports[_0x3c15('0x57')]=function(_0x34102a,_0xea7748,_0x3d8cd4){var _0x107b7c={};var _0x46449e={};var _0x4f1041;var _0x1935c1;return db[_0x3c15('0x3b')][_0x3c15('0x58')]({'where':{'id':_0x34102a[_0x3c15('0x55')]['id']}})['then'](handleEntityNotFound(_0xea7748,null))['then'](function(_0x2542a3){if(_0x2542a3){_0x4f1041=_0x2542a3;_0x46449e['model']=_[_0x3c15('0x40')](db[_0x3c15('0x59')][_0x3c15('0x3c')]);_0x46449e[_0x3c15('0x3f')]=_[_0x3c15('0x40')](_0x34102a[_0x3c15('0x3f')]);_0x46449e[_0x3c15('0x41')]=_[_0x3c15('0x42')](_0x46449e[_0x3c15('0x3e')],_0x46449e[_0x3c15('0x3f')]);_0x107b7c['attributes']=_[_0x3c15('0x42')](_0x46449e['model'],qs['fields'](_0x34102a[_0x3c15('0x3f')]['fields']));_0x107b7c[_0x3c15('0x51')]=_0x107b7c[_0x3c15('0x51')][_0x3c15('0x44')]?_0x107b7c[_0x3c15('0x51')]:_0x46449e[_0x3c15('0x3e')];_0x107b7c['order']=qs['sort'](_0x34102a[_0x3c15('0x3f')][_0x3c15('0x48')]);_0x107b7c['where']=qs[_0x3c15('0x41')](_[_0x3c15('0x5a')](_0x34102a[_0x3c15('0x3f')],_0x46449e[_0x3c15('0x41')]));if(_0x34102a[_0x3c15('0x3f')][_0x3c15('0x4a')]){_0x107b7c[_0x3c15('0x49')]=_[_0x3c15('0x4b')](_0x107b7c['where'],{'$or':_[_0x3c15('0x3a')](_0x107b7c[_0x3c15('0x51')],function(_0x421fc4){var _0x400e0b={};_0x400e0b[_0x421fc4]={'$like':'%'+_0x34102a['query'][_0x3c15('0x4a')]+'%'};return _0x400e0b;})});}_0x107b7c=_[_0x3c15('0x4b')]({},_0x107b7c,_0x34102a[_0x3c15('0x4d')]);return _0x4f1041[_0x3c15('0x57')](_0x107b7c);}})['then'](function(_0x33d93a){if(_0x33d93a){_0x1935c1=_0x33d93a['length'];if(!_0x34102a[_0x3c15('0x3f')][_0x3c15('0x45')](_0x3c15('0x46'))){_0x107b7c[_0x3c15('0x31')]=qs[_0x3c15('0x31')](_0x34102a[_0x3c15('0x3f')][_0x3c15('0x31')]);_0x107b7c[_0x3c15('0x30')]=qs['offset'](_0x34102a[_0x3c15('0x3f')][_0x3c15('0x30')]);}return _0x4f1041[_0x3c15('0x57')](_0x107b7c);}})[_0x3c15('0x21')](function(_0x3fb1d7){if(_0x3fb1d7){return _0x3fb1d7?{'count':_0x1935c1,'rows':_0x3fb1d7}:null;}})['then'](respondWithResult(_0xea7748,null))['catch'](handleError(_0xea7748,null));};exports[_0x3c15('0x5b')]=function(_0x1c81f1,_0x1770f6,_0x116440){var _0x1e2764={};var _0x2874d8={};var _0xfcdea0;var _0x53e9d1;return db[_0x3c15('0x3b')][_0x3c15('0x58')]({'where':{'id':_0x1c81f1['params']['id']}})[_0x3c15('0x21')](handleEntityNotFound(_0x1770f6,null))['then'](function(_0x478784){if(_0x478784){_0xfcdea0=_0x478784;_0x2874d8[_0x3c15('0x3e')]=_[_0x3c15('0x40')](db[_0x3c15('0x59')][_0x3c15('0x3c')]);_0x2874d8[_0x3c15('0x3f')]=_['keys'](_0x1c81f1['query']);_0x2874d8[_0x3c15('0x41')]=_[_0x3c15('0x42')](_0x2874d8[_0x3c15('0x3e')],_0x2874d8[_0x3c15('0x3f')]);_0x1e2764[_0x3c15('0x51')]=_[_0x3c15('0x42')](_0x2874d8['model'],qs[_0x3c15('0x43')](_0x1c81f1[_0x3c15('0x3f')][_0x3c15('0x43')]));_0x1e2764[_0x3c15('0x51')]=_0x1e2764['attributes'][_0x3c15('0x44')]?_0x1e2764[_0x3c15('0x51')]:_0x2874d8['model'];_0x1e2764['order']=qs[_0x3c15('0x48')](_0x1c81f1[_0x3c15('0x3f')][_0x3c15('0x48')]);_0x1e2764[_0x3c15('0x49')]=qs[_0x3c15('0x41')](_['pick'](_0x1c81f1[_0x3c15('0x3f')],_0x2874d8[_0x3c15('0x41')]));if(_0x1c81f1[_0x3c15('0x3f')][_0x3c15('0x4a')]){_0x1e2764[_0x3c15('0x49')]=_[_0x3c15('0x4b')](_0x1e2764[_0x3c15('0x49')],{'$or':_['map'](_0x1e2764[_0x3c15('0x51')],function(_0x319414){var _0x29ab26={};_0x29ab26[_0x319414]={'$like':'%'+_0x1c81f1[_0x3c15('0x3f')]['filter']+'%'};return _0x29ab26;})});}_0x1e2764=_[_0x3c15('0x4b')]({},_0x1e2764,_0x1c81f1[_0x3c15('0x4d')]);return _0xfcdea0[_0x3c15('0x5b')](_0x1e2764);}})[_0x3c15('0x21')](function(_0x4ce88b){if(_0x4ce88b){_0x53e9d1=_0x4ce88b[_0x3c15('0x44')];if(!_0x1c81f1[_0x3c15('0x3f')]['hasOwnProperty']('nolimit')){_0x1e2764['limit']=qs[_0x3c15('0x31')](_0x1c81f1[_0x3c15('0x3f')]['limit']);_0x1e2764[_0x3c15('0x30')]=qs[_0x3c15('0x30')](_0x1c81f1['query'][_0x3c15('0x30')]);}return _0xfcdea0['getSubjects'](_0x1e2764);}})[_0x3c15('0x21')](function(_0x1a7849){if(_0x1a7849){return _0x1a7849?{'count':_0x53e9d1,'rows':_0x1a7849}:null;}})[_0x3c15('0x21')](respondWithResult(_0x1770f6,null))[_0x3c15('0x2b')](handleError(_0x1770f6,null));};exports[_0x3c15('0x5c')]=function(_0x324dc3,_0x44a176,_0xfdc853){var _0x2314f7={};var _0x36fe3a={};var _0x4888e1;var _0x297c31;return db[_0x3c15('0x3b')][_0x3c15('0x58')]({'where':{'id':_0x324dc3['params']['id']}})[_0x3c15('0x21')](handleEntityNotFound(_0x44a176,null))[_0x3c15('0x21')](function(_0x21bfcf){if(_0x21bfcf){_0x4888e1=_0x21bfcf;_0x36fe3a['model']=_[_0x3c15('0x40')](db[_0x3c15('0x59')][_0x3c15('0x3c')]);_0x36fe3a[_0x3c15('0x3f')]=_[_0x3c15('0x40')](_0x324dc3[_0x3c15('0x3f')]);_0x36fe3a[_0x3c15('0x41')]=_[_0x3c15('0x42')](_0x36fe3a[_0x3c15('0x3e')],_0x36fe3a[_0x3c15('0x3f')]);_0x2314f7[_0x3c15('0x51')]=_[_0x3c15('0x42')](_0x36fe3a['model'],qs['fields'](_0x324dc3['query'][_0x3c15('0x43')]));_0x2314f7[_0x3c15('0x51')]=_0x2314f7['attributes'][_0x3c15('0x44')]?_0x2314f7[_0x3c15('0x51')]:_0x36fe3a[_0x3c15('0x3e')];_0x2314f7[_0x3c15('0x47')]=qs[_0x3c15('0x48')](_0x324dc3[_0x3c15('0x3f')][_0x3c15('0x48')]);_0x2314f7['where']=qs[_0x3c15('0x41')](_[_0x3c15('0x5a')](_0x324dc3[_0x3c15('0x3f')],_0x36fe3a[_0x3c15('0x41')]));if(_0x324dc3[_0x3c15('0x3f')][_0x3c15('0x4a')]){_0x2314f7['where']=_[_0x3c15('0x4b')](_0x2314f7[_0x3c15('0x49')],{'$or':_[_0x3c15('0x3a')](_0x2314f7[_0x3c15('0x51')],function(_0xbf6b8d){var _0x454499={};_0x454499[_0xbf6b8d]={'$like':'%'+_0x324dc3[_0x3c15('0x3f')]['filter']+'%'};return _0x454499;})});}_0x2314f7=_[_0x3c15('0x4b')]({},_0x2314f7,_0x324dc3['options']);return _0x4888e1['getDescriptions'](_0x2314f7);}})['then'](function(_0xf3747d){if(_0xf3747d){_0x297c31=_0xf3747d[_0x3c15('0x44')];if(!_0x324dc3[_0x3c15('0x3f')][_0x3c15('0x45')](_0x3c15('0x46'))){_0x2314f7[_0x3c15('0x31')]=qs[_0x3c15('0x31')](_0x324dc3[_0x3c15('0x3f')][_0x3c15('0x31')]);_0x2314f7[_0x3c15('0x30')]=qs['offset'](_0x324dc3[_0x3c15('0x3f')]['offset']);}return _0x4888e1['getDescriptions'](_0x2314f7);}})[_0x3c15('0x21')](function(_0x1710e7){if(_0x1710e7){return _0x1710e7?{'count':_0x297c31,'rows':_0x1710e7}:null;}})[_0x3c15('0x21')](respondWithResult(_0x44a176,null))['catch'](handleError(_0x44a176,null));}; \ No newline at end of file +var _0x59b9=['type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','show','includeAll','merge','find','create','body','params','getFields','findOne','getSubjects','VtigerField','getDescriptions','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','request\x20sent','debug','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName'];(function(_0x4f56e0,_0x2bd06a){var _0x291cae=function(_0x381d7e){while(--_0x381d7e){_0x4f56e0['push'](_0x4f56e0['shift']());}};_0x291cae(++_0x2bd06a);}(_0x59b9,0x1f2));var _0x959b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x59b9[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x959b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x959b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x959b('0x2'));var rp=require(_0x959b('0x3'));var moment=require(_0x959b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x959b('0x5'));var util=require(_0x959b('0x6'));var path=require(_0x959b('0x7'));var sox=require(_0x959b('0x8'));var csv=require(_0x959b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x959b('0xa'));var squel=require('squel');var crypto=require(_0x959b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x959b('0xc'));var toCsv=require(_0x959b('0x9'));var querystring=require('querystring');var Papa=require(_0x959b('0xd'));var Redis=require(_0x959b('0xe'));var authService=require(_0x959b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x959b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x959b('0x11'))(_0x959b('0x12'));var utils=require(_0x959b('0x13'));var config=require(_0x959b('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x959b('0x15'));var client=jayson[_0x959b('0x16')][_0x959b('0x17')]({'port':0x232a});function checkPasswordPattern(_0x560186,_0x400468,_0x3c6013){if(_0x3c6013){var _0x4b37ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b37ab[_0x959b('0x18')](_0x400468)){return _0x560186;}else{throw new db[(_0x959b('0x19'))][(_0x959b('0x1a'))](_0x959b('0x1b'));}}else{return _0x560186;}}function respondWithRpcPromise(_0x720ff7,_0x4d8b7f,_0x3e030a,_0x4f14f0){return new BPromise(function(_0x1a01b9,_0x48e098){var _0xacdfa6=_0x4f14f0||client;return _0xacdfa6[_0x959b('0x1c')](_0x720ff7,_0x3e030a)[_0x959b('0x1d')](function(_0x1e9fe8){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x4d8b7f,_0x959b('0x1e'));logger[_0x959b('0x1f')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4d8b7f,_0x959b('0x1e'),JSON[_0x959b('0x20')](_0x1e9fe8));if(_0x1e9fe8[_0x959b('0x21')]){if(_0x1e9fe8['error'][_0x959b('0x22')]===0x1f4){logger[_0x959b('0x21')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d8b7f,_0x1e9fe8[_0x959b('0x21')][_0x959b('0x23')]);return _0x48e098(_0x1e9fe8[_0x959b('0x21')]['message']);}logger[_0x959b('0x21')](_0x959b('0x24'),_0x4d8b7f,_0x1e9fe8[_0x959b('0x21')][_0x959b('0x23')]);return _0x1a01b9(_0x1e9fe8['error'][_0x959b('0x23')]);}else{logger[_0x959b('0x25')](_0x959b('0x24'),_0x4d8b7f,_0x959b('0x1e'));_0x1a01b9(_0x1e9fe8[_0x959b('0x26')][_0x959b('0x23')]);}})[_0x959b('0x27')](function(_0x3d3a07){logger[_0x959b('0x21')](_0x959b('0x24'),_0x4d8b7f,_0x3d3a07);_0x48e098(_0x3d3a07);});});}function respondWithStatusCode(_0xc5c5b3,_0x380c4a){_0x380c4a=_0x380c4a||0xcc;return function(_0x122f14){if(_0x122f14){return _0xc5c5b3[_0x959b('0x28')](_0x380c4a);}return _0xc5c5b3[_0x959b('0x29')](_0x380c4a)[_0x959b('0x2a')]();};}function respondWithResult(_0xdec76,_0x3e4288){_0x3e4288=_0x3e4288||0xc8;return function(_0x49ad4d){if(_0x49ad4d){return _0xdec76[_0x959b('0x29')](_0x3e4288)['json'](_0x49ad4d);}};}function respondWithFilteredResult(_0x51aff9,_0x4dac31){return function(_0x6fd7bb){if(_0x6fd7bb){var _0x1e2180=_0x6fd7bb[_0x959b('0x2b')],_0x33c235=_0x4dac31[_0x959b('0x2c')],_0x447d6d=_0x4dac31[_0x959b('0x2c')]+_0x4dac31[_0x959b('0x2d')],_0x219205;if(_0x447d6d>=_0x1e2180){_0x447d6d=_0x1e2180;_0x219205=0xc8;}else{_0x219205=0xce;}_0x51aff9[_0x959b('0x29')](_0x219205);return _0x51aff9[_0x959b('0x2e')]('Content-Range',_0x33c235+'-'+_0x447d6d+'/'+_0x1e2180)['json'](_0x6fd7bb);}return null;};}function patchUpdates(_0x433177){return function(_0x3e59f5){try{jsonpatch[_0x959b('0x2f')](_0x3e59f5,_0x433177,!![]);}catch(_0x1a971f){return BPromise[_0x959b('0x30')](_0x1a971f);}return _0x3e59f5[_0x959b('0x31')]();};}function saveUpdates(_0x2dff44,_0x406582){return function(_0x40095a){if(_0x40095a){return _0x40095a[_0x959b('0x32')](_0x2dff44)['then'](function(_0x14a3f1){return _0x14a3f1;});}return null;};}function removeEntity(_0x44735d,_0x304076){return function(_0x3ef07b){if(_0x3ef07b){return _0x3ef07b[_0x959b('0x33')]()[_0x959b('0x1d')](function(){_0x44735d[_0x959b('0x29')](0xcc)[_0x959b('0x2a')]();});}};}function handleEntityNotFound(_0x17e30b,_0x4f7e7f){return function(_0x5950fb){if(!_0x5950fb){_0x17e30b[_0x959b('0x28')](0x194);}return _0x5950fb;};}function handleError(_0x8636b9,_0x4508d4){_0x4508d4=_0x4508d4||0x1f4;return function(_0x4e0c68){logger[_0x959b('0x21')](_0x4e0c68[_0x959b('0x34')]);if(_0x4e0c68[_0x959b('0x35')]){delete _0x4e0c68[_0x959b('0x35')];}_0x8636b9[_0x959b('0x29')](_0x4508d4)[_0x959b('0x36')](_0x4e0c68);};}exports[_0x959b('0x37')]=function(_0x5bf0fe,_0x4eda79){var _0x236ae8={},_0xda11d={},_0x8cb556={'count':0x0,'rows':[]};var _0x1c22b8=_[_0x959b('0x38')](db[_0x959b('0x39')][_0x959b('0x3a')],function(_0x385d3f){return{'name':_0x385d3f[_0x959b('0x3b')],'type':_0x385d3f[_0x959b('0x3c')][_0x959b('0x3d')]};});_0xda11d[_0x959b('0x3e')]=_[_0x959b('0x38')](_0x1c22b8,'name');_0xda11d[_0x959b('0x3f')]=_[_0x959b('0x40')](_0x5bf0fe['query']);_0xda11d[_0x959b('0x41')]=_['intersection'](_0xda11d['model'],_0xda11d[_0x959b('0x3f')]);_0x236ae8[_0x959b('0x42')]=_[_0x959b('0x43')](_0xda11d[_0x959b('0x3e')],qs[_0x959b('0x44')](_0x5bf0fe[_0x959b('0x3f')][_0x959b('0x44')]));_0x236ae8['attributes']=_0x236ae8[_0x959b('0x42')][_0x959b('0x45')]?_0x236ae8[_0x959b('0x42')]:_0xda11d[_0x959b('0x3e')];if(!_0x5bf0fe[_0x959b('0x3f')][_0x959b('0x46')](_0x959b('0x47'))){_0x236ae8[_0x959b('0x2d')]=qs[_0x959b('0x2d')](_0x5bf0fe[_0x959b('0x3f')][_0x959b('0x2d')]);_0x236ae8[_0x959b('0x2c')]=qs[_0x959b('0x2c')](_0x5bf0fe[_0x959b('0x3f')]['offset']);}_0x236ae8[_0x959b('0x48')]=qs[_0x959b('0x49')](_0x5bf0fe[_0x959b('0x3f')][_0x959b('0x49')]);_0x236ae8[_0x959b('0x4a')]=qs[_0x959b('0x41')](_[_0x959b('0x4b')](_0x5bf0fe['query'],_0xda11d[_0x959b('0x41')]),_0x1c22b8);if(_0x5bf0fe[_0x959b('0x3f')][_0x959b('0x4c')]){_0x236ae8['where']=_['merge'](_0x236ae8[_0x959b('0x4a')],{'$or':_[_0x959b('0x38')](_0x1c22b8,function(_0x4842c1){if(_0x4842c1[_0x959b('0x3c')]!==_0x959b('0x4d')){var _0x515f6b={};_0x515f6b[_0x4842c1[_0x959b('0x35')]]={'$like':'%'+_0x5bf0fe[_0x959b('0x3f')]['filter']+'%'};return _0x515f6b;}})});}_0x236ae8=_['merge']({},_0x236ae8,_0x5bf0fe[_0x959b('0x4e')]);var _0x2aca39={'where':_0x236ae8[_0x959b('0x4a')]};return db[_0x959b('0x39')]['count'](_0x2aca39)['then'](function(_0x14ab37){_0x8cb556[_0x959b('0x2b')]=_0x14ab37;if(_0x5bf0fe[_0x959b('0x3f')]['includeAll']){_0x236ae8[_0x959b('0x4f')]=[{'all':!![]}];}return db[_0x959b('0x39')]['findAll'](_0x236ae8);})[_0x959b('0x1d')](function(_0x32bdba){_0x8cb556[_0x959b('0x50')]=_0x32bdba;return _0x8cb556;})['then'](respondWithFilteredResult(_0x4eda79,_0x236ae8))[_0x959b('0x27')](handleError(_0x4eda79,null));};exports[_0x959b('0x51')]=function(_0x331db,_0x2c3e6d){var _0x14df34={'raw':![],'where':{'id':_0x331db['params']['id']}},_0x1c015d={};_0x1c015d['model']=_['keys'](db[_0x959b('0x39')]['rawAttributes']);_0x1c015d[_0x959b('0x3f')]=_[_0x959b('0x40')](_0x331db['query']);_0x1c015d[_0x959b('0x41')]=_[_0x959b('0x43')](_0x1c015d[_0x959b('0x3e')],_0x1c015d[_0x959b('0x3f')]);_0x14df34[_0x959b('0x42')]=_['intersection'](_0x1c015d[_0x959b('0x3e')],qs[_0x959b('0x44')](_0x331db[_0x959b('0x3f')][_0x959b('0x44')]));_0x14df34[_0x959b('0x42')]=_0x14df34[_0x959b('0x42')][_0x959b('0x45')]?_0x14df34[_0x959b('0x42')]:_0x1c015d[_0x959b('0x3e')];if(_0x331db[_0x959b('0x3f')][_0x959b('0x52')]){_0x14df34[_0x959b('0x4f')]=[{'all':!![]}];}_0x14df34=_[_0x959b('0x53')]({},_0x14df34,_0x331db[_0x959b('0x4e')]);return db[_0x959b('0x39')][_0x959b('0x54')](_0x14df34)[_0x959b('0x1d')](handleEntityNotFound(_0x2c3e6d,null))['then'](respondWithResult(_0x2c3e6d,null))[_0x959b('0x27')](handleError(_0x2c3e6d,null));};exports['create']=function(_0x243151,_0x1fe797){return db['VtigerConfiguration'][_0x959b('0x55')](_0x243151['body'],{})['then'](respondWithResult(_0x1fe797,0xc9))[_0x959b('0x27')](handleError(_0x1fe797,null));};exports[_0x959b('0x32')]=function(_0x2ef15f,_0x1f6fbe){if(_0x2ef15f[_0x959b('0x56')]['id']){delete _0x2ef15f[_0x959b('0x56')]['id'];}return db['VtigerConfiguration'][_0x959b('0x54')]({'where':{'id':_0x2ef15f[_0x959b('0x57')]['id']}})[_0x959b('0x1d')](handleEntityNotFound(_0x1f6fbe,null))[_0x959b('0x1d')](saveUpdates(_0x2ef15f['body'],null))['then'](respondWithResult(_0x1f6fbe,null))[_0x959b('0x27')](handleError(_0x1f6fbe,null));};exports[_0x959b('0x33')]=function(_0x26a35c,_0x2dceed){return db[_0x959b('0x39')][_0x959b('0x54')]({'where':{'id':_0x26a35c[_0x959b('0x57')]['id']}})[_0x959b('0x1d')](handleEntityNotFound(_0x2dceed,null))[_0x959b('0x1d')](removeEntity(_0x2dceed,null))[_0x959b('0x27')](handleError(_0x2dceed,null));};exports[_0x959b('0x58')]=function(_0x1bf897,_0x169602,_0xacc3e){var _0x4b1457={};var _0x18cbef={};var _0x38905d;var _0x21966c;return db[_0x959b('0x39')][_0x959b('0x59')]({'where':{'id':_0x1bf897['params']['id']}})[_0x959b('0x1d')](handleEntityNotFound(_0x169602,null))['then'](function(_0x1244d3){if(_0x1244d3){_0x38905d=_0x1244d3;_0x18cbef[_0x959b('0x3e')]=_[_0x959b('0x40')](db['VtigerField'][_0x959b('0x3a')]);_0x18cbef[_0x959b('0x3f')]=_[_0x959b('0x40')](_0x1bf897['query']);_0x18cbef['filters']=_[_0x959b('0x43')](_0x18cbef[_0x959b('0x3e')],_0x18cbef['query']);_0x4b1457[_0x959b('0x42')]=_[_0x959b('0x43')](_0x18cbef[_0x959b('0x3e')],qs[_0x959b('0x44')](_0x1bf897[_0x959b('0x3f')][_0x959b('0x44')]));_0x4b1457[_0x959b('0x42')]=_0x4b1457[_0x959b('0x42')][_0x959b('0x45')]?_0x4b1457['attributes']:_0x18cbef[_0x959b('0x3e')];_0x4b1457[_0x959b('0x48')]=qs['sort'](_0x1bf897[_0x959b('0x3f')]['sort']);_0x4b1457[_0x959b('0x4a')]=qs[_0x959b('0x41')](_[_0x959b('0x4b')](_0x1bf897[_0x959b('0x3f')],_0x18cbef[_0x959b('0x41')]));if(_0x1bf897[_0x959b('0x3f')]['filter']){_0x4b1457['where']=_[_0x959b('0x53')](_0x4b1457[_0x959b('0x4a')],{'$or':_[_0x959b('0x38')](_0x4b1457[_0x959b('0x42')],function(_0x2d8fee){var _0x3196cf={};_0x3196cf[_0x2d8fee]={'$like':'%'+_0x1bf897[_0x959b('0x3f')][_0x959b('0x4c')]+'%'};return _0x3196cf;})});}_0x4b1457=_[_0x959b('0x53')]({},_0x4b1457,_0x1bf897[_0x959b('0x4e')]);return _0x38905d['getFields'](_0x4b1457);}})[_0x959b('0x1d')](function(_0x40588e){if(_0x40588e){_0x21966c=_0x40588e[_0x959b('0x45')];if(!_0x1bf897[_0x959b('0x3f')][_0x959b('0x46')](_0x959b('0x47'))){_0x4b1457['limit']=qs[_0x959b('0x2d')](_0x1bf897[_0x959b('0x3f')][_0x959b('0x2d')]);_0x4b1457['offset']=qs['offset'](_0x1bf897[_0x959b('0x3f')][_0x959b('0x2c')]);}return _0x38905d[_0x959b('0x58')](_0x4b1457);}})[_0x959b('0x1d')](function(_0x5d326a){if(_0x5d326a){return _0x5d326a?{'count':_0x21966c,'rows':_0x5d326a}:null;}})[_0x959b('0x1d')](respondWithResult(_0x169602,null))[_0x959b('0x27')](handleError(_0x169602,null));};exports[_0x959b('0x5a')]=function(_0x2a664f,_0x4dd876,_0x1c920b){var _0x4638ed={};var _0x32814a={};var _0x4c76df;var _0x5a96bd;return db['VtigerConfiguration'][_0x959b('0x59')]({'where':{'id':_0x2a664f[_0x959b('0x57')]['id']}})[_0x959b('0x1d')](handleEntityNotFound(_0x4dd876,null))[_0x959b('0x1d')](function(_0x35dfb0){if(_0x35dfb0){_0x4c76df=_0x35dfb0;_0x32814a[_0x959b('0x3e')]=_['keys'](db[_0x959b('0x5b')][_0x959b('0x3a')]);_0x32814a[_0x959b('0x3f')]=_[_0x959b('0x40')](_0x2a664f[_0x959b('0x3f')]);_0x32814a[_0x959b('0x41')]=_['intersection'](_0x32814a[_0x959b('0x3e')],_0x32814a[_0x959b('0x3f')]);_0x4638ed[_0x959b('0x42')]=_['intersection'](_0x32814a[_0x959b('0x3e')],qs[_0x959b('0x44')](_0x2a664f[_0x959b('0x3f')]['fields']));_0x4638ed[_0x959b('0x42')]=_0x4638ed[_0x959b('0x42')][_0x959b('0x45')]?_0x4638ed[_0x959b('0x42')]:_0x32814a[_0x959b('0x3e')];_0x4638ed[_0x959b('0x48')]=qs[_0x959b('0x49')](_0x2a664f[_0x959b('0x3f')][_0x959b('0x49')]);_0x4638ed[_0x959b('0x4a')]=qs['filters'](_[_0x959b('0x4b')](_0x2a664f['query'],_0x32814a[_0x959b('0x41')]));if(_0x2a664f[_0x959b('0x3f')][_0x959b('0x4c')]){_0x4638ed[_0x959b('0x4a')]=_[_0x959b('0x53')](_0x4638ed[_0x959b('0x4a')],{'$or':_[_0x959b('0x38')](_0x4638ed[_0x959b('0x42')],function(_0x1c1859){var _0x50de63={};_0x50de63[_0x1c1859]={'$like':'%'+_0x2a664f[_0x959b('0x3f')][_0x959b('0x4c')]+'%'};return _0x50de63;})});}_0x4638ed=_[_0x959b('0x53')]({},_0x4638ed,_0x2a664f[_0x959b('0x4e')]);return _0x4c76df[_0x959b('0x5a')](_0x4638ed);}})[_0x959b('0x1d')](function(_0x53c48e){if(_0x53c48e){_0x5a96bd=_0x53c48e[_0x959b('0x45')];if(!_0x2a664f[_0x959b('0x3f')][_0x959b('0x46')]('nolimit')){_0x4638ed[_0x959b('0x2d')]=qs['limit'](_0x2a664f['query'][_0x959b('0x2d')]);_0x4638ed[_0x959b('0x2c')]=qs['offset'](_0x2a664f['query']['offset']);}return _0x4c76df[_0x959b('0x5a')](_0x4638ed);}})['then'](function(_0x20e5a3){if(_0x20e5a3){return _0x20e5a3?{'count':_0x5a96bd,'rows':_0x20e5a3}:null;}})['then'](respondWithResult(_0x4dd876,null))[_0x959b('0x27')](handleError(_0x4dd876,null));};exports[_0x959b('0x5c')]=function(_0x4066bf,_0x137553,_0x352f4c){var _0x4b62db={};var _0x42aaff={};var _0x51454a;var _0x2aa72e;return db[_0x959b('0x39')][_0x959b('0x59')]({'where':{'id':_0x4066bf[_0x959b('0x57')]['id']}})['then'](handleEntityNotFound(_0x137553,null))[_0x959b('0x1d')](function(_0x702109){if(_0x702109){_0x51454a=_0x702109;_0x42aaff[_0x959b('0x3e')]=_[_0x959b('0x40')](db[_0x959b('0x5b')][_0x959b('0x3a')]);_0x42aaff['query']=_[_0x959b('0x40')](_0x4066bf['query']);_0x42aaff['filters']=_[_0x959b('0x43')](_0x42aaff['model'],_0x42aaff[_0x959b('0x3f')]);_0x4b62db['attributes']=_[_0x959b('0x43')](_0x42aaff[_0x959b('0x3e')],qs['fields'](_0x4066bf[_0x959b('0x3f')][_0x959b('0x44')]));_0x4b62db['attributes']=_0x4b62db[_0x959b('0x42')][_0x959b('0x45')]?_0x4b62db['attributes']:_0x42aaff[_0x959b('0x3e')];_0x4b62db['order']=qs[_0x959b('0x49')](_0x4066bf['query'][_0x959b('0x49')]);_0x4b62db[_0x959b('0x4a')]=qs[_0x959b('0x41')](_['pick'](_0x4066bf[_0x959b('0x3f')],_0x42aaff[_0x959b('0x41')]));if(_0x4066bf[_0x959b('0x3f')]['filter']){_0x4b62db[_0x959b('0x4a')]=_[_0x959b('0x53')](_0x4b62db['where'],{'$or':_['map'](_0x4b62db[_0x959b('0x42')],function(_0x56c92d){var _0x2d5404={};_0x2d5404[_0x56c92d]={'$like':'%'+_0x4066bf[_0x959b('0x3f')][_0x959b('0x4c')]+'%'};return _0x2d5404;})});}_0x4b62db=_['merge']({},_0x4b62db,_0x4066bf[_0x959b('0x4e')]);return _0x51454a[_0x959b('0x5c')](_0x4b62db);}})[_0x959b('0x1d')](function(_0xda1932){if(_0xda1932){_0x2aa72e=_0xda1932[_0x959b('0x45')];if(!_0x4066bf[_0x959b('0x3f')]['hasOwnProperty'](_0x959b('0x47'))){_0x4b62db[_0x959b('0x2d')]=qs['limit'](_0x4066bf[_0x959b('0x3f')][_0x959b('0x2d')]);_0x4b62db[_0x959b('0x2c')]=qs[_0x959b('0x2c')](_0x4066bf['query']['offset']);}return _0x51454a[_0x959b('0x5c')](_0x4b62db);}})[_0x959b('0x1d')](function(_0x3d0a0a){if(_0x3d0a0a){return _0x3d0a0a?{'count':_0x2aa72e,'rows':_0x3d0a0a}:null;}})['then'](respondWithResult(_0x137553,null))[_0x959b('0x27')](handleError(_0x137553,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d405559..977036f 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 _0x94f4=['moment','bluebird','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x94f4,0x11d));var _0x494f=function(_0x2b7689,_0x25b882){_0x2b7689=_0x2b7689-0x0;var _0x3199d8=_0x94f4[_0x2b7689];return _0x3199d8;};'use strict';var _=require(_0x494f('0x0'));var util=require(_0x494f('0x1'));var logger=require(_0x494f('0x2'))('api');var moment=require(_0x494f('0x3'));var BPromise=require(_0x494f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x494f('0x5'));var config=require(_0x494f('0x6'));var attributes=require(_0x494f('0x7'));module[_0x494f('0x8')]=function(_0x591f6a,_0x3b008f){return _0x591f6a[_0x494f('0x9')](_0x494f('0xa'),attributes,{'tableName':_0x494f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78fc=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x38e9d6,_0x59308b){var _0xbc1da8=function(_0x3cd3b2){while(--_0x3cd3b2){_0x38e9d6['push'](_0x38e9d6['shift']());}};_0xbc1da8(++_0x59308b);}(_0x78fc,0x1b7));var _0xc78f=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x78fc[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require(_0xc78f('0x0'));var util=require(_0xc78f('0x1'));var logger=require(_0xc78f('0x2'))(_0xc78f('0x3'));var moment=require(_0xc78f('0x4'));var BPromise=require(_0xc78f('0x5'));var rp=require(_0xc78f('0x6'));var fs=require('fs');var path=require(_0xc78f('0x7'));var rimraf=require('rimraf');var config=require(_0xc78f('0x8'));var attributes=require(_0xc78f('0x9'));module['exports']=function(_0x5d3160,_0x26f6e0){return _0x5d3160[_0xc78f('0xa')](_0xc78f('0xb'),attributes,{'tableName':_0xc78f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 9e65250..1c7bbaf 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 _0x5e0a=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1bbd68,_0x3787b0){var _0x60d825=function(_0xef1ceb){while(--_0xef1ceb){_0x1bbd68['push'](_0x1bbd68['shift']());}};_0x60d825(++_0x3787b0);}(_0x5e0a,0xb1));var _0xa5e0=function(_0xa892a6,_0x7cc6a1){_0xa892a6=_0xa892a6-0x0;var _0x19fbd5=_0x5e0a[_0xa892a6];return _0x19fbd5;};'use strict';var _=require(_0xa5e0('0x0'));var util=require(_0xa5e0('0x1'));var moment=require('moment');var BPromise=require(_0xa5e0('0x2'));var rs=require(_0xa5e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5e0('0x4'))['db'];var utils=require(_0xa5e0('0x5'));var logger=require(_0xa5e0('0x6'))(_0xa5e0('0x7'));var config=require(_0xa5e0('0x8'));var jayson=require(_0xa5e0('0x9'));var client=jayson[_0xa5e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377585,_0x2de16a,_0x1c135a){return new BPromise(function(_0x5294cf,_0x44b640){return client[_0xa5e0('0xb')](_0x377585,_0x1c135a)['then'](function(_0x6a4766){logger[_0xa5e0('0xc')](_0xa5e0('0xd'),_0x2de16a,_0xa5e0('0xe'));logger[_0xa5e0('0xf')](_0xa5e0('0x10'),_0x2de16a,_0xa5e0('0xe'),JSON['stringify'](_0x6a4766));if(_0x6a4766['error']){if(_0x6a4766[_0xa5e0('0x11')][_0xa5e0('0x12')]===0x1f4){logger[_0xa5e0('0x11')](_0xa5e0('0xd'),_0x2de16a,_0x6a4766[_0xa5e0('0x11')][_0xa5e0('0x13')]);return _0x44b640(_0x6a4766[_0xa5e0('0x11')][_0xa5e0('0x13')]);}logger[_0xa5e0('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x2de16a,_0x6a4766[_0xa5e0('0x11')]['message']);return _0x5294cf(_0x6a4766[_0xa5e0('0x11')][_0xa5e0('0x13')]);}else{logger[_0xa5e0('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2de16a,_0xa5e0('0xe'));_0x5294cf(_0x6a4766[_0xa5e0('0x14')][_0xa5e0('0x13')]);}})[_0xa5e0('0x15')](function(_0x218bd3){logger['error'](_0xa5e0('0xd'),_0x2de16a,_0x218bd3);_0x44b640(_0x218bd3);});});} \ No newline at end of file +var _0x42ee=['then','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x42ee,0x199));var _0xe42e=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x42ee[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0xe42e('0x0'));var util=require(_0xe42e('0x1'));var moment=require(_0xe42e('0x2'));var BPromise=require(_0xe42e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe42e('0x4'))['db'];var utils=require(_0xe42e('0x5'));var logger=require(_0xe42e('0x6'))('rpc');var config=require(_0xe42e('0x7'));var jayson=require(_0xe42e('0x8'));var client=jayson[_0xe42e('0x9')][_0xe42e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5074ca,_0x362ff7,_0x545664){return new BPromise(function(_0x1370b3,_0x4c4909){return client['request'](_0x5074ca,_0x545664)[_0xe42e('0xb')](function(_0x37d6d9){logger['info'](_0xe42e('0xc'),_0x362ff7,'request\x20sent');logger['debug'](_0xe42e('0xd'),_0x362ff7,'request\x20sent',JSON['stringify'](_0x37d6d9));if(_0x37d6d9[_0xe42e('0xe')]){if(_0x37d6d9[_0xe42e('0xe')][_0xe42e('0xf')]===0x1f4){logger[_0xe42e('0xe')](_0xe42e('0xc'),_0x362ff7,_0x37d6d9[_0xe42e('0xe')][_0xe42e('0x10')]);return _0x4c4909(_0x37d6d9[_0xe42e('0xe')][_0xe42e('0x10')]);}logger[_0xe42e('0xe')](_0xe42e('0xc'),_0x362ff7,_0x37d6d9[_0xe42e('0xe')][_0xe42e('0x10')]);return _0x1370b3(_0x37d6d9[_0xe42e('0xe')][_0xe42e('0x10')]);}else{logger[_0xe42e('0x11')](_0xe42e('0xc'),_0x362ff7,_0xe42e('0x12'));_0x1370b3(_0x37d6d9[_0xe42e('0x13')][_0xe42e('0x10')]);}})[_0xe42e('0x14')](function(_0x187410){logger['error'](_0xe42e('0xc'),_0x362ff7,_0x187410);_0x4c4909(_0x187410);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9a91857..c23f8ae 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 _0x111a=['get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x230123,_0x4ecc7d){var _0x1b2f07=function(_0x1b43c6){while(--_0x1b43c6){_0x230123['push'](_0x230123['shift']());}};_0x1b2f07(++_0x4ecc7d);}(_0x111a,0x1c4));var _0xa111=function(_0x5208b7,_0x1ba54d){_0x5208b7=_0x5208b7-0x0;var _0x5d50bb=_0x111a[_0x5208b7];return _0x5d50bb;};'use strict';var multer=require(_0xa111('0x0'));var util=require(_0xa111('0x1'));var path=require(_0xa111('0x2'));var timeout=require(_0xa111('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xa111('0x4'));var interaction=require(_0xa111('0x5'));var config=require(_0xa111('0x6'));var controller=require('./intVtigerField.controller');router[_0xa111('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa111('0x7')]('/:id',auth[_0xa111('0x8')](),controller['show']);router[_0xa111('0x9')]('/',auth[_0xa111('0x8')](),controller[_0xa111('0xa')]);router[_0xa111('0xb')](_0xa111('0xc'),auth[_0xa111('0x8')](),controller[_0xa111('0xd')]);router[_0xa111('0xe')](_0xa111('0xc'),auth['isAuthenticated'](),controller[_0xa111('0xf')]);module[_0xa111('0x10')]=router; \ No newline at end of file +var _0xefbc=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','show','post','isAuthenticated','create','put','update','/:id','destroy'];(function(_0x17249c,_0x168d62){var _0x324e7b=function(_0x1b1397){while(--_0x1b1397){_0x17249c['push'](_0x17249c['shift']());}};_0x324e7b(++_0x168d62);}(_0xefbc,0x11e));var _0xcefb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xefbc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcefb('0x0'));var util=require(_0xcefb('0x1'));var path=require('path');var timeout=require(_0xcefb('0x2'));var express=require(_0xcefb('0x3'));var router=express[_0xcefb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcefb('0x5'));var config=require(_0xcefb('0x6'));var controller=require(_0xcefb('0x7'));router[_0xcefb('0x8')]('/',auth['isAuthenticated'](),controller[_0xcefb('0x9')]);router[_0xcefb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcefb('0xa')]);router[_0xcefb('0xb')]('/',auth[_0xcefb('0xc')](),controller[_0xcefb('0xd')]);router[_0xcefb('0xe')]('/:id',auth[_0xcefb('0xc')](),controller[_0xcefb('0xf')]);router['delete'](_0xcefb('0x10'),auth[_0xcefb('0xc')](),controller[_0xcefb('0x11')]);module[_0xcefb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index eb83bbc..cd95991 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 _0x86dd=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','exports','string'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0x86dd,0x1ee));var _0xd86d=function(_0x46c386,_0x3d500a){_0x46c386=_0x46c386-0x0;var _0x4a1d25=_0x86dd[_0x46c386];return _0x4a1d25;};'use strict';var Sequelize=require('sequelize');module[_0xd86d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xd86d('0x1'),_0xd86d('0x2'),_0xd86d('0x3'),_0xd86d('0x4')),'defaultValue':_0xd86d('0x1')},'content':{'type':Sequelize[_0xd86d('0x5')]},'key':{'type':Sequelize[_0xd86d('0x5')]},'keyType':{'type':Sequelize[_0xd86d('0x6')](_0xd86d('0x1'),_0xd86d('0x2'),_0xd86d('0x3'))},'keyContent':{'type':Sequelize[_0xd86d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd86d('0x5')]},'customField':{'type':Sequelize[_0xd86d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb94=['variable','customVariable','keyValue','string','STRING','exports','ENUM'];(function(_0xe8a12,_0x59690c){var _0x3567d4=function(_0x14fd7f){while(--_0x14fd7f){_0xe8a12['push'](_0xe8a12['shift']());}};_0x3567d4(++_0x59690c);}(_0xdb94,0xe5));var _0x4db9=function(_0x3e2ebe,_0x57a926){_0x3e2ebe=_0x3e2ebe-0x0;var _0x54d761=_0xdb94[_0x3e2ebe];return _0x54d761;};'use strict';var Sequelize=require('sequelize');module[_0x4db9('0x0')]={'type':{'type':Sequelize[_0x4db9('0x1')]('string',_0x4db9('0x2'),_0x4db9('0x3'),_0x4db9('0x4')),'defaultValue':_0x4db9('0x5')},'content':{'type':Sequelize[_0x4db9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4db9('0x1')]('string',_0x4db9('0x2'),_0x4db9('0x3'))},'keyContent':{'type':Sequelize[_0x4db9('0x6')]},'idField':{'type':Sequelize[_0x4db9('0x6')]},'nameField':{'type':Sequelize[_0x4db9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4db9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1a3ad0b..325e6a5 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 _0xbbb6=['fields','length','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','keys','create','body','find','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xbbb6,0x127));var _0x6bbb=function(_0x2166e1,_0x4a9a63){_0x2166e1=_0x2166e1-0x0;var _0x42ada1=_0xbbb6[_0x2166e1];return _0x42ada1;};'use strict';var pdf=require(_0x6bbb('0x0'));var emlformat=require(_0x6bbb('0x1'));var rimraf=require(_0x6bbb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bbb('0x3'));var BPromise=require(_0x6bbb('0x4'));var Mustache=require(_0x6bbb('0x5'));var util=require('util');var path=require(_0x6bbb('0x6'));var sox=require(_0x6bbb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6bbb('0x8'));var squel=require(_0x6bbb('0x9'));var crypto=require(_0x6bbb('0xa'));var jsforce=require(_0x6bbb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6bbb('0xc'));var querystring=require(_0x6bbb('0xd'));var Papa=require(_0x6bbb('0xe'));var Redis=require('ioredis');var authService=require(_0x6bbb('0xf'));var qs=require(_0x6bbb('0x10'));var as=require(_0x6bbb('0x11'));var hardwareService=require(_0x6bbb('0x12'));var logger=require(_0x6bbb('0x13'))(_0x6bbb('0x14'));var utils=require('../../config/utils');var config=require(_0x6bbb('0x15'));var db=require(_0x6bbb('0x16'))['db'];function respondWithStatusCode(_0x1a5841,_0x2fbc61){_0x2fbc61=_0x2fbc61||0xcc;return function(_0x1cd582){if(_0x1cd582){return _0x1a5841['sendStatus'](_0x2fbc61);}return _0x1a5841['status'](_0x2fbc61)[_0x6bbb('0x17')]();};}function respondWithResult(_0x4baa76,_0x1fe58b){_0x1fe58b=_0x1fe58b||0xc8;return function(_0x305f1a){if(_0x305f1a){return _0x4baa76[_0x6bbb('0x18')](_0x1fe58b)[_0x6bbb('0x19')](_0x305f1a);}};}function respondWithFilteredResult(_0x5673cc,_0x4c407a){return function(_0x207753){if(_0x207753){var _0x731032=_0x207753['count'],_0x22c0f9=_0x4c407a[_0x6bbb('0x1a')],_0x5a01ab=_0x4c407a[_0x6bbb('0x1a')]+_0x4c407a[_0x6bbb('0x1b')],_0x763643;if(_0x5a01ab>=_0x731032){_0x5a01ab=_0x731032;_0x763643=0xc8;}else{_0x763643=0xce;}_0x5673cc[_0x6bbb('0x18')](_0x763643);return _0x5673cc[_0x6bbb('0x1c')]('Content-Range',_0x22c0f9+'-'+_0x5a01ab+'/'+_0x731032)['json'](_0x207753);}return null;};}function patchUpdates(_0x5dc407){return function(_0x1c0322){try{jsonpatch[_0x6bbb('0x1d')](_0x1c0322,_0x5dc407,!![]);}catch(_0x1b9c39){return BPromise[_0x6bbb('0x1e')](_0x1b9c39);}return _0x1c0322['save']();};}function saveUpdates(_0x526823,_0x381389){return function(_0x1895bd){if(_0x1895bd){return _0x1895bd[_0x6bbb('0x1f')](_0x526823)[_0x6bbb('0x20')](function(_0x140065){return _0x140065;});}return null;};}function removeEntity(_0x28200c,_0x561249){return function(_0x334768){if(_0x334768){return _0x334768[_0x6bbb('0x21')]()[_0x6bbb('0x20')](function(){_0x28200c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d16d,_0x133ac3){return function(_0x6d0ffe){if(!_0x6d0ffe){_0x42d16d[_0x6bbb('0x22')](0x194);}return _0x6d0ffe;};}function handleError(_0xa2ee66,_0x57f8a0){_0x57f8a0=_0x57f8a0||0x1f4;return function(_0x35a39c){logger[_0x6bbb('0x23')](_0x35a39c[_0x6bbb('0x24')]);if(_0x35a39c[_0x6bbb('0x25')]){delete _0x35a39c[_0x6bbb('0x25')];}_0xa2ee66[_0x6bbb('0x18')](_0x57f8a0)[_0x6bbb('0x26')](_0x35a39c);};}exports['index']=function(_0x4fef24,_0x723cb){var _0x243931={},_0x252508={},_0x4b3464={'count':0x0,'rows':[]};var _0x182f7b=_[_0x6bbb('0x27')](db[_0x6bbb('0x28')][_0x6bbb('0x29')],function(_0x41a160){return{'name':_0x41a160[_0x6bbb('0x2a')],'type':_0x41a160[_0x6bbb('0x2b')][_0x6bbb('0x2c')]};});_0x252508['model']=_[_0x6bbb('0x27')](_0x182f7b,'name');_0x252508[_0x6bbb('0x2d')]=_['keys'](_0x4fef24[_0x6bbb('0x2d')]);_0x252508[_0x6bbb('0x2e')]=_[_0x6bbb('0x2f')](_0x252508['model'],_0x252508[_0x6bbb('0x2d')]);_0x243931[_0x6bbb('0x30')]=_['intersection'](_0x252508[_0x6bbb('0x31')],qs[_0x6bbb('0x32')](_0x4fef24[_0x6bbb('0x2d')][_0x6bbb('0x32')]));_0x243931['attributes']=_0x243931[_0x6bbb('0x30')][_0x6bbb('0x33')]?_0x243931['attributes']:_0x252508['model'];if(!_0x4fef24[_0x6bbb('0x2d')]['hasOwnProperty']('nolimit')){_0x243931[_0x6bbb('0x1b')]=qs[_0x6bbb('0x1b')](_0x4fef24[_0x6bbb('0x2d')][_0x6bbb('0x1b')]);_0x243931[_0x6bbb('0x1a')]=qs[_0x6bbb('0x1a')](_0x4fef24[_0x6bbb('0x2d')][_0x6bbb('0x1a')]);}_0x243931[_0x6bbb('0x34')]=qs[_0x6bbb('0x35')](_0x4fef24['query'][_0x6bbb('0x35')]);_0x243931[_0x6bbb('0x36')]=qs[_0x6bbb('0x2e')](_['pick'](_0x4fef24['query'],_0x252508['filters']),_0x182f7b);if(_0x4fef24[_0x6bbb('0x2d')][_0x6bbb('0x37')]){_0x243931[_0x6bbb('0x36')]=_[_0x6bbb('0x38')](_0x243931[_0x6bbb('0x36')],{'$or':_[_0x6bbb('0x27')](_0x182f7b,function(_0x4c7e1e){if(_0x4c7e1e[_0x6bbb('0x2b')]!==_0x6bbb('0x39')){var _0x31a9c1={};_0x31a9c1[_0x4c7e1e[_0x6bbb('0x25')]]={'$like':'%'+_0x4fef24['query'][_0x6bbb('0x37')]+'%'};return _0x31a9c1;}})});}_0x243931=_[_0x6bbb('0x38')]({},_0x243931,_0x4fef24[_0x6bbb('0x3a')]);var _0x1a29af={'where':_0x243931[_0x6bbb('0x36')]};return db['VtigerField'][_0x6bbb('0x3b')](_0x1a29af)[_0x6bbb('0x20')](function(_0x364007){_0x4b3464['count']=_0x364007;if(_0x4fef24['query']['includeAll']){_0x243931[_0x6bbb('0x3c')]=[{'all':!![]}];}return db['VtigerField'][_0x6bbb('0x3d')](_0x243931);})[_0x6bbb('0x20')](function(_0x1d9e6c){_0x4b3464[_0x6bbb('0x3e')]=_0x1d9e6c;return _0x4b3464;})[_0x6bbb('0x20')](respondWithFilteredResult(_0x723cb,_0x243931))[_0x6bbb('0x3f')](handleError(_0x723cb,null));};exports['show']=function(_0x566e00,_0xa8653e){var _0xddc8f2={'raw':!![],'where':{'id':_0x566e00[_0x6bbb('0x40')]['id']}},_0x246e7d={};_0x246e7d[_0x6bbb('0x31')]=_[_0x6bbb('0x41')](db['VtigerField'][_0x6bbb('0x29')]);_0x246e7d['query']=_[_0x6bbb('0x41')](_0x566e00[_0x6bbb('0x2d')]);_0x246e7d['filters']=_[_0x6bbb('0x2f')](_0x246e7d[_0x6bbb('0x31')],_0x246e7d['query']);_0xddc8f2[_0x6bbb('0x30')]=_[_0x6bbb('0x2f')](_0x246e7d['model'],qs[_0x6bbb('0x32')](_0x566e00[_0x6bbb('0x2d')]['fields']));_0xddc8f2[_0x6bbb('0x30')]=_0xddc8f2['attributes'][_0x6bbb('0x33')]?_0xddc8f2[_0x6bbb('0x30')]:_0x246e7d[_0x6bbb('0x31')];if(_0x566e00[_0x6bbb('0x2d')]['includeAll']){_0xddc8f2[_0x6bbb('0x3c')]=[{'all':!![]}];}_0xddc8f2=_[_0x6bbb('0x38')]({},_0xddc8f2,_0x566e00['options']);return db[_0x6bbb('0x28')]['find'](_0xddc8f2)[_0x6bbb('0x20')](handleEntityNotFound(_0xa8653e,null))[_0x6bbb('0x20')](respondWithResult(_0xa8653e,null))[_0x6bbb('0x3f')](handleError(_0xa8653e,null));};exports[_0x6bbb('0x42')]=function(_0x349ba7,_0x1f2309){return db['VtigerField'][_0x6bbb('0x42')](_0x349ba7[_0x6bbb('0x43')],{})[_0x6bbb('0x20')](respondWithResult(_0x1f2309,0xc9))['catch'](handleError(_0x1f2309,null));};exports[_0x6bbb('0x1f')]=function(_0x3009d5,_0x5576ba){if(_0x3009d5[_0x6bbb('0x43')]['id']){delete _0x3009d5[_0x6bbb('0x43')]['id'];}return db[_0x6bbb('0x28')]['find']({'where':{'id':_0x3009d5[_0x6bbb('0x40')]['id']}})[_0x6bbb('0x20')](handleEntityNotFound(_0x5576ba,null))[_0x6bbb('0x20')](saveUpdates(_0x3009d5[_0x6bbb('0x43')],null))[_0x6bbb('0x20')](respondWithResult(_0x5576ba,null))[_0x6bbb('0x3f')](handleError(_0x5576ba,null));};exports[_0x6bbb('0x21')]=function(_0x2ca04b,_0x96a8){return db[_0x6bbb('0x28')][_0x6bbb('0x44')]({'where':{'id':_0x2ca04b[_0x6bbb('0x40')]['id']}})['then'](handleEntityNotFound(_0x96a8,null))[_0x6bbb('0x20')](removeEntity(_0x96a8,null))[_0x6bbb('0x3f')](handleError(_0x96a8,null));}; \ No newline at end of file +var _0x280b=['options','includeAll','include','VtigerField','findAll','rows','show','keys','find','catch','create','body','params','eml-format','rimraf','request-promise','moment','path','sox','ejs','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','limit','order','sort','where','filters','filter','VIRTUAL','merge'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0x280b,0x1bf));var _0xb280=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x280b[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb280('0x0'));var rimraf=require(_0xb280('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb280('0x2'));var moment=require(_0xb280('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb280('0x4'));var sox=require(_0xb280('0x5'));var csv=require('to-csv');var ejs=require(_0xb280('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb280('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xb280('0x8'));var querystring=require('querystring');var Papa=require(_0xb280('0x9'));var Redis=require(_0xb280('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb280('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb280('0xc'))('api');var utils=require(_0xb280('0xd'));var config=require('../../config/environment');var db=require(_0xb280('0xe'))['db'];function respondWithStatusCode(_0x3a9573,_0xa0fe52){_0xa0fe52=_0xa0fe52||0xcc;return function(_0xd1a2c5){if(_0xd1a2c5){return _0x3a9573['sendStatus'](_0xa0fe52);}return _0x3a9573['status'](_0xa0fe52)[_0xb280('0xf')]();};}function respondWithResult(_0x2a748b,_0x543a4d){_0x543a4d=_0x543a4d||0xc8;return function(_0x42df7f){if(_0x42df7f){return _0x2a748b[_0xb280('0x10')](_0x543a4d)[_0xb280('0x11')](_0x42df7f);}};}function respondWithFilteredResult(_0x3e627e,_0x729571){return function(_0xe4dc32){if(_0xe4dc32){var _0x3eb853=_0xe4dc32[_0xb280('0x12')],_0x106274=_0x729571[_0xb280('0x13')],_0x4a0f99=_0x729571['offset']+_0x729571['limit'],_0x6ed7c5;if(_0x4a0f99>=_0x3eb853){_0x4a0f99=_0x3eb853;_0x6ed7c5=0xc8;}else{_0x6ed7c5=0xce;}_0x3e627e['status'](_0x6ed7c5);return _0x3e627e[_0xb280('0x14')](_0xb280('0x15'),_0x106274+'-'+_0x4a0f99+'/'+_0x3eb853)[_0xb280('0x11')](_0xe4dc32);}return null;};}function patchUpdates(_0x475f78){return function(_0x2c8aeb){try{jsonpatch[_0xb280('0x16')](_0x2c8aeb,_0x475f78,!![]);}catch(_0x101fc5){return BPromise[_0xb280('0x17')](_0x101fc5);}return _0x2c8aeb[_0xb280('0x18')]();};}function saveUpdates(_0x318b41,_0x52cc87){return function(_0x4570fc){if(_0x4570fc){return _0x4570fc[_0xb280('0x19')](_0x318b41)[_0xb280('0x1a')](function(_0x4d405a){return _0x4d405a;});}return null;};}function removeEntity(_0x27fd83,_0x336088){return function(_0x19214b){if(_0x19214b){return _0x19214b[_0xb280('0x1b')]()[_0xb280('0x1a')](function(){_0x27fd83[_0xb280('0x10')](0xcc)[_0xb280('0xf')]();});}};}function handleEntityNotFound(_0x145c92,_0xd7a11d){return function(_0x2a54e7){if(!_0x2a54e7){_0x145c92[_0xb280('0x1c')](0x194);}return _0x2a54e7;};}function handleError(_0x60d937,_0x3a7b1d){_0x3a7b1d=_0x3a7b1d||0x1f4;return function(_0x135c63){logger['error'](_0x135c63['stack']);if(_0x135c63[_0xb280('0x1d')]){delete _0x135c63[_0xb280('0x1d')];}_0x60d937[_0xb280('0x10')](_0x3a7b1d)['send'](_0x135c63);};}exports['index']=function(_0x27f0e0,_0x42979e){var _0x1ceef6={},_0x19e8f4={},_0x228713={'count':0x0,'rows':[]};var _0x1efb1a=_[_0xb280('0x1e')](db['VtigerField'][_0xb280('0x1f')],function(_0x1312aa){return{'name':_0x1312aa[_0xb280('0x20')],'type':_0x1312aa[_0xb280('0x21')][_0xb280('0x22')]};});_0x19e8f4[_0xb280('0x23')]=_[_0xb280('0x1e')](_0x1efb1a,_0xb280('0x1d'));_0x19e8f4[_0xb280('0x24')]=_['keys'](_0x27f0e0[_0xb280('0x24')]);_0x19e8f4['filters']=_['intersection'](_0x19e8f4['model'],_0x19e8f4[_0xb280('0x24')]);_0x1ceef6[_0xb280('0x25')]=_[_0xb280('0x26')](_0x19e8f4[_0xb280('0x23')],qs[_0xb280('0x27')](_0x27f0e0['query']['fields']));_0x1ceef6['attributes']=_0x1ceef6['attributes'][_0xb280('0x28')]?_0x1ceef6[_0xb280('0x25')]:_0x19e8f4[_0xb280('0x23')];if(!_0x27f0e0[_0xb280('0x24')]['hasOwnProperty']('nolimit')){_0x1ceef6['limit']=qs[_0xb280('0x29')](_0x27f0e0[_0xb280('0x24')]['limit']);_0x1ceef6[_0xb280('0x13')]=qs[_0xb280('0x13')](_0x27f0e0[_0xb280('0x24')][_0xb280('0x13')]);}_0x1ceef6[_0xb280('0x2a')]=qs[_0xb280('0x2b')](_0x27f0e0['query'][_0xb280('0x2b')]);_0x1ceef6[_0xb280('0x2c')]=qs['filters'](_['pick'](_0x27f0e0[_0xb280('0x24')],_0x19e8f4[_0xb280('0x2d')]),_0x1efb1a);if(_0x27f0e0[_0xb280('0x24')][_0xb280('0x2e')]){_0x1ceef6['where']=_['merge'](_0x1ceef6[_0xb280('0x2c')],{'$or':_[_0xb280('0x1e')](_0x1efb1a,function(_0x15426a){if(_0x15426a[_0xb280('0x21')]!==_0xb280('0x2f')){var _0x48a7a8={};_0x48a7a8[_0x15426a[_0xb280('0x1d')]]={'$like':'%'+_0x27f0e0['query'][_0xb280('0x2e')]+'%'};return _0x48a7a8;}})});}_0x1ceef6=_[_0xb280('0x30')]({},_0x1ceef6,_0x27f0e0[_0xb280('0x31')]);var _0x503f8e={'where':_0x1ceef6[_0xb280('0x2c')]};return db['VtigerField'][_0xb280('0x12')](_0x503f8e)[_0xb280('0x1a')](function(_0x44b3bf){_0x228713[_0xb280('0x12')]=_0x44b3bf;if(_0x27f0e0[_0xb280('0x24')][_0xb280('0x32')]){_0x1ceef6[_0xb280('0x33')]=[{'all':!![]}];}return db[_0xb280('0x34')][_0xb280('0x35')](_0x1ceef6);})[_0xb280('0x1a')](function(_0x78b7d1){_0x228713[_0xb280('0x36')]=_0x78b7d1;return _0x228713;})[_0xb280('0x1a')](respondWithFilteredResult(_0x42979e,_0x1ceef6))['catch'](handleError(_0x42979e,null));};exports[_0xb280('0x37')]=function(_0x5d9e4c,_0x485c28){var _0x3732e4={'raw':!![],'where':{'id':_0x5d9e4c['params']['id']}},_0x39b550={};_0x39b550[_0xb280('0x23')]=_['keys'](db['VtigerField']['rawAttributes']);_0x39b550[_0xb280('0x24')]=_[_0xb280('0x38')](_0x5d9e4c[_0xb280('0x24')]);_0x39b550['filters']=_['intersection'](_0x39b550[_0xb280('0x23')],_0x39b550['query']);_0x3732e4[_0xb280('0x25')]=_['intersection'](_0x39b550[_0xb280('0x23')],qs[_0xb280('0x27')](_0x5d9e4c[_0xb280('0x24')]['fields']));_0x3732e4['attributes']=_0x3732e4['attributes'][_0xb280('0x28')]?_0x3732e4[_0xb280('0x25')]:_0x39b550[_0xb280('0x23')];if(_0x5d9e4c[_0xb280('0x24')]['includeAll']){_0x3732e4['include']=[{'all':!![]}];}_0x3732e4=_[_0xb280('0x30')]({},_0x3732e4,_0x5d9e4c[_0xb280('0x31')]);return db['VtigerField'][_0xb280('0x39')](_0x3732e4)[_0xb280('0x1a')](handleEntityNotFound(_0x485c28,null))['then'](respondWithResult(_0x485c28,null))[_0xb280('0x3a')](handleError(_0x485c28,null));};exports['create']=function(_0x2509c0,_0x5dc8e1){return db['VtigerField'][_0xb280('0x3b')](_0x2509c0[_0xb280('0x3c')],{})[_0xb280('0x1a')](respondWithResult(_0x5dc8e1,0xc9))[_0xb280('0x3a')](handleError(_0x5dc8e1,null));};exports[_0xb280('0x19')]=function(_0x5d9c6d,_0xf5524c){if(_0x5d9c6d['body']['id']){delete _0x5d9c6d[_0xb280('0x3c')]['id'];}return db['VtigerField'][_0xb280('0x39')]({'where':{'id':_0x5d9c6d[_0xb280('0x3d')]['id']}})[_0xb280('0x1a')](handleEntityNotFound(_0xf5524c,null))[_0xb280('0x1a')](saveUpdates(_0x5d9c6d[_0xb280('0x3c')],null))[_0xb280('0x1a')](respondWithResult(_0xf5524c,null))['catch'](handleError(_0xf5524c,null));};exports['destroy']=function(_0x22b6af,_0x2c01a){return db['VtigerField'][_0xb280('0x39')]({'where':{'id':_0x22b6af[_0xb280('0x3d')]['id']}})[_0xb280('0x1a')](handleEntityNotFound(_0x2c01a,null))['then'](removeEntity(_0x2c01a,null))[_0xb280('0x3a')](handleError(_0x2c01a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f6b110b..d0c31b8 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 _0xbdb7=['define','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x378fcb,_0x32e78c){_0x378fcb=_0x378fcb-0x0;var _0x5dfe9b=_0xbdb7[_0x378fcb];return _0x5dfe9b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7bdb('0xb'),'fields':[_0x7bdb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['path','rimraf','./intVtigerField.attributes','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x15977d,_0x207a5f){var _0x32cc3f=function(_0x39150a){while(--_0x39150a){_0x15977d['push'](_0x15977d['shift']());}};_0x32cc3f(++_0x207a5f);}(_0x70e0,0x17b));var _0x070e=function(_0x2fae1b,_0x11edd3){_0x2fae1b=_0x2fae1b-0x0;var _0x1e0ebf=_0x70e0[_0x2fae1b];return _0x1e0ebf;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VtigerField',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0xa'),_0x070e('0xb')],'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 0e85986..ad0f6bd 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 _0x1491=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x1491,0x1b1));var _0x1149=function(_0x3790b5,_0x3b5208){_0x3790b5=_0x3790b5-0x0;var _0x13f944=_0x1491[_0x3790b5];return _0x13f944;};'use strict';var _=require(_0x1149('0x0'));var util=require(_0x1149('0x1'));var moment=require(_0x1149('0x2'));var BPromise=require(_0x1149('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1149('0x4'));var db=require(_0x1149('0x5'))['db'];var utils=require(_0x1149('0x6'));var logger=require(_0x1149('0x7'))(_0x1149('0x8'));var config=require(_0x1149('0x9'));var jayson=require(_0x1149('0xa'));var client=jayson[_0x1149('0xb')][_0x1149('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaa7515,_0x15513b,_0x3bf02f){return new BPromise(function(_0x285f6c,_0xde257c){return client[_0x1149('0xd')](_0xaa7515,_0x3bf02f)[_0x1149('0xe')](function(_0x17a116){logger[_0x1149('0xf')](_0x1149('0x10'),_0x15513b,'request\x20sent');logger[_0x1149('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x15513b,'request\x20sent',JSON['stringify'](_0x17a116));if(_0x17a116[_0x1149('0x12')]){if(_0x17a116['error']['code']===0x1f4){logger[_0x1149('0x12')]('VtigerField,\x20%s,\x20%s',_0x15513b,_0x17a116[_0x1149('0x12')][_0x1149('0x13')]);return _0xde257c(_0x17a116[_0x1149('0x12')][_0x1149('0x13')]);}logger[_0x1149('0x12')](_0x1149('0x10'),_0x15513b,_0x17a116['error'][_0x1149('0x13')]);return _0x285f6c(_0x17a116['error']['message']);}else{logger[_0x1149('0xf')](_0x1149('0x10'),_0x15513b,'request\x20sent');_0x285f6c(_0x17a116[_0x1149('0x14')][_0x1149('0x13')]);}})[_0x1149('0x15')](function(_0x165b15){logger[_0x1149('0x12')](_0x1149('0x10'),_0x15513b,_0x165b15);_0xde257c(_0x165b15);});});} \ No newline at end of file +var _0x1399=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x48dba2,_0x368080){var _0x33aa76=function(_0xa62894){while(--_0xa62894){_0x48dba2['push'](_0x48dba2['shift']());}};_0x33aa76(++_0x368080);}(_0x1399,0x16c));var _0x9139=function(_0x44714c,_0x2ac454){_0x44714c=_0x44714c-0x0;var _0x57d4d5=_0x1399[_0x44714c];return _0x57d4d5;};'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(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d2ed,_0x4d5d1e,_0x51832d){return new BPromise(function(_0x11a03f,_0x59aec5){return client['request'](_0x11d2ed,_0x51832d)[_0x9139('0xa')](function(_0x385e2c){logger['info'](_0x9139('0xb'),_0x4d5d1e,_0x9139('0xc'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'),JSON[_0x9139('0xd')](_0x385e2c));if(_0x385e2c[_0x9139('0xe')]){if(_0x385e2c[_0x9139('0xe')][_0x9139('0xf')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x4d5d1e,_0x385e2c['error'][_0x9139('0x10')]);return _0x59aec5(_0x385e2c['error'][_0x9139('0x10')]);}logger[_0x9139('0xe')](_0x9139('0xb'),_0x4d5d1e,_0x385e2c[_0x9139('0xe')]['message']);return _0x11a03f(_0x385e2c[_0x9139('0xe')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'));_0x11a03f(_0x385e2c[_0x9139('0x11')][_0x9139('0x10')]);}})[_0x9139('0x12')](function(_0x18801b){logger[_0x9139('0xe')]('VtigerField,\x20%s,\x20%s',_0x4d5d1e,_0x18801b);_0x59aec5(_0x18801b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 7c0e856..82e8244 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 _0xef41=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x25b4a0,_0x54dccb){var _0x1633dd=function(_0x17aebf){while(--_0x17aebf){_0x25b4a0['push'](_0x25b4a0['shift']());}};_0x1633dd(++_0x54dccb);}(_0xef41,0x65));var _0x1ef4=function(_0x43d79c,_0x531a55){_0x43d79c=_0x43d79c-0x0;var _0x4866b0=_0xef41[_0x43d79c];return _0x4866b0;};'use strict';var multer=require(_0x1ef4('0x0'));var util=require(_0x1ef4('0x1'));var path=require('path');var timeout=require(_0x1ef4('0x2'));var express=require('express');var router=express[_0x1ef4('0x3')]();var auth=require(_0x1ef4('0x4'));var interaction=require(_0x1ef4('0x5'));var config=require(_0x1ef4('0x6'));var controller=require(_0x1ef4('0x7'));router[_0x1ef4('0x8')]('/',auth[_0x1ef4('0x9')](),controller[_0x1ef4('0xa')]);router['get'](_0x1ef4('0xb'),auth[_0x1ef4('0x9')](),controller['show']);router[_0x1ef4('0x8')](_0x1ef4('0xc'),auth['isAuthenticated'](),controller[_0x1ef4('0xd')]);router['get'](_0x1ef4('0xe'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0xf')]);router[_0x1ef4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1ef4('0x10')](_0x1ef4('0xc'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0x11')]);router[_0x1ef4('0x12')](_0x1ef4('0xb'),auth[_0x1ef4('0x9')](),controller[_0x1ef4('0x13')]);router[_0x1ef4('0x14')](_0x1ef4('0xb'),auth[_0x1ef4('0x9')](),controller['destroy']);module[_0x1ef4('0x15')]=router; \ No newline at end of file +var _0x0add=['post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0add,0x193));var _0xd0ad=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x0add[_0x13ff53];return _0x290228;};'use strict';var multer=require(_0xd0ad('0x0'));var util=require(_0xd0ad('0x1'));var path=require(_0xd0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0ad('0x3'));var router=express[_0xd0ad('0x4')]();var auth=require(_0xd0ad('0x5'));var interaction=require(_0xd0ad('0x6'));var config=require(_0xd0ad('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0xd0ad('0x8')](),controller['index']);router[_0xd0ad('0x9')]('/:id',auth[_0xd0ad('0x8')](),controller['show']);router['get'](_0xd0ad('0xa'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0xb')]);router[_0xd0ad('0x9')](_0xd0ad('0xc'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0xd')]);router['post']('/',auth[_0xd0ad('0x8')](),controller[_0xd0ad('0xe')]);router[_0xd0ad('0xf')](_0xd0ad('0xa'),auth[_0xd0ad('0x8')](),controller['addConfiguration']);router[_0xd0ad('0x10')](_0xd0ad('0x11'),auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x12')]);router[_0xd0ad('0x13')]('/:id',auth[_0xd0ad('0x8')](),controller[_0xd0ad('0x14')]);module[_0xd0ad('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4e002f3..a6c3236 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 _0xe96f=['STRING','username','remoteUri','password','ENUM','integrationTab','newTab','sequelize'];(function(_0x2d44c3,_0x4ce66a){var _0x54cf65=function(_0x110af3){while(--_0x110af3){_0x2d44c3['push'](_0x2d44c3['shift']());}};_0x54cf65(++_0x4ce66a);}(_0xe96f,0x137));var _0xfe96=function(_0x4dcb6b,_0x3afe61){_0x4dcb6b=_0x4dcb6b-0x0;var _0x244656=_0xe96f[_0x4dcb6b];return _0x244656;};'use strict';var Sequelize=require(_0xfe96('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfe96('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xfe96('0x2')},'password':{'type':Sequelize[_0xfe96('0x1')]},'token':{'type':Sequelize[_0xfe96('0x1')]},'remoteUri':{'type':Sequelize[_0xfe96('0x1')],'unique':_0xfe96('0x3')},'authType':{'type':Sequelize['ENUM'](_0xfe96('0x4'),'token'),'defaultValue':_0xfe96('0x4')},'serverUrl':{'type':Sequelize[_0xfe96('0x1')]},'type':{'type':Sequelize[_0xfe96('0x5')](_0xfe96('0x6'),_0xfe96('0x7')),'defaultValue':_0xfe96('0x6')}}; \ No newline at end of file +var _0xccc6=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x2ab863,_0x18b374){var _0x329ce8=function(_0x2e22fd){while(--_0x2e22fd){_0x2ab863['push'](_0x2ab863['shift']());}};_0x329ce8(++_0x18b374);}(_0xccc6,0x17f));var _0x6ccc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xccc6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6ccc('0x0'));module[_0x6ccc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ccc('0x2')]},'username':{'type':Sequelize[_0x6ccc('0x2')],'unique':_0x6ccc('0x3')},'password':{'type':Sequelize[_0x6ccc('0x2')]},'token':{'type':Sequelize[_0x6ccc('0x2')]},'remoteUri':{'type':Sequelize[_0x6ccc('0x2')],'unique':_0x6ccc('0x4')},'authType':{'type':Sequelize[_0x6ccc('0x5')](_0x6ccc('0x6'),_0x6ccc('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x6ccc('0x2')]},'type':{'type':Sequelize[_0x6ccc('0x5')](_0x6ccc('0x8'),_0x6ccc('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1294b4d..0f39356 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 _0xd604=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','query','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','keys','options','create','body','find','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','GET','format','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','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','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model'];(function(_0x1d64e9,_0x312968){var _0x197892=function(_0x586b13){while(--_0x586b13){_0x1d64e9['push'](_0x1d64e9['shift']());}};_0x197892(++_0x312968);}(_0xd604,0xc3));var _0x4d60=function(_0x41563e,_0x114309){_0x41563e=_0x41563e-0x0;var _0x1d4830=_0xd604[_0x41563e];return _0x1d4830;};'use strict';var pdf=require(_0x4d60('0x0'));var emlformat=require(_0x4d60('0x1'));var rimraf=require(_0x4d60('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d60('0x3'));var rp=require(_0x4d60('0x4'));var moment=require(_0x4d60('0x5'));var BPromise=require(_0x4d60('0x6'));var Mustache=require('mustache');var util=require(_0x4d60('0x7'));var path=require('path');var sox=require(_0x4d60('0x8'));var csv=require(_0x4d60('0x9'));var ejs=require(_0x4d60('0xa'));var fs=require('fs');var _=require(_0x4d60('0xb'));var squel=require(_0x4d60('0xc'));var crypto=require(_0x4d60('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4d60('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4d60('0xf'));var Papa=require(_0x4d60('0x10'));var Redis=require(_0x4d60('0x11'));var authService=require(_0x4d60('0x12'));var qs=require(_0x4d60('0x13'));var as=require(_0x4d60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d60('0x15'))(_0x4d60('0x16'));var utils=require(_0x4d60('0x17'));var config=require(_0x4d60('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x4d60('0x19')][_0x4d60('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5d93b6,_0x20e15d,_0x54dbb5){if(_0x54dbb5){var _0x1a0ce2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0ce2[_0x4d60('0x1b')](_0x20e15d)){return _0x5d93b6;}else{throw new db['Sequelize'][(_0x4d60('0x1c'))](_0x4d60('0x1d'));}}else{return _0x5d93b6;}}function respondWithRpcPromise(_0x3c88f1,_0x568966,_0x20dc92,_0x38ae9a){return new BPromise(function(_0x33a4fb,_0x5919cd){var _0x6e6628=_0x38ae9a||client;return _0x6e6628[_0x4d60('0x1e')](_0x3c88f1,_0x20dc92)[_0x4d60('0x1f')](function(_0x2cf4a6){logger[_0x4d60('0x20')](_0x4d60('0x21'),_0x568966,_0x4d60('0x22'));logger['debug'](_0x4d60('0x23'),_0x568966,_0x4d60('0x22'),JSON[_0x4d60('0x24')](_0x2cf4a6));if(_0x2cf4a6[_0x4d60('0x25')]){if(_0x2cf4a6['error'][_0x4d60('0x26')]===0x1f4){logger[_0x4d60('0x25')](_0x4d60('0x21'),_0x568966,_0x2cf4a6['error']['message']);return _0x5919cd(_0x2cf4a6['error'][_0x4d60('0x27')]);}logger[_0x4d60('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x568966,_0x2cf4a6[_0x4d60('0x25')][_0x4d60('0x27')]);return _0x33a4fb(_0x2cf4a6['error'][_0x4d60('0x27')]);}else{logger[_0x4d60('0x20')](_0x4d60('0x21'),_0x568966,'request\x20sent');_0x33a4fb(_0x2cf4a6['result'][_0x4d60('0x27')]);}})['catch'](function(_0x2169b6){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x568966,_0x2169b6);_0x5919cd(_0x2169b6);});});}function respondWithStatusCode(_0x348a03,_0x2b100e){_0x2b100e=_0x2b100e||0xcc;return function(_0x1d1fd4){if(_0x1d1fd4){return _0x348a03[_0x4d60('0x28')](_0x2b100e);}return _0x348a03['status'](_0x2b100e)[_0x4d60('0x29')]();};}function respondWithResult(_0x4b495d,_0x1f5452){_0x1f5452=_0x1f5452||0xc8;return function(_0x27cc5c){if(_0x27cc5c){return _0x4b495d[_0x4d60('0x2a')](_0x1f5452)[_0x4d60('0x2b')](_0x27cc5c);}};}function respondWithFilteredResult(_0x392654,_0x34c697){return function(_0x3b99e9){if(_0x3b99e9){var _0x2f9f68=_0x3b99e9['count'],_0x40d540=_0x34c697['offset'],_0x426ff2=_0x34c697[_0x4d60('0x2c')]+_0x34c697[_0x4d60('0x2d')],_0x206891;if(_0x426ff2>=_0x2f9f68){_0x426ff2=_0x2f9f68;_0x206891=0xc8;}else{_0x206891=0xce;}_0x392654[_0x4d60('0x2a')](_0x206891);return _0x392654[_0x4d60('0x2e')](_0x4d60('0x2f'),_0x40d540+'-'+_0x426ff2+'/'+_0x2f9f68)[_0x4d60('0x2b')](_0x3b99e9);}return null;};}function patchUpdates(_0x42d31c){return function(_0x3889cd){try{jsonpatch[_0x4d60('0x30')](_0x3889cd,_0x42d31c,!![]);}catch(_0x5d2b71){return BPromise[_0x4d60('0x31')](_0x5d2b71);}return _0x3889cd[_0x4d60('0x32')]();};}function saveUpdates(_0xea0906,_0x44c726){return function(_0x350aff){if(_0x350aff){return _0x350aff[_0x4d60('0x33')](_0xea0906)[_0x4d60('0x1f')](function(_0x50c22f){return _0x50c22f;});}return null;};}function removeEntity(_0x5d324e,_0xee7bd7){return function(_0x40a8d4){if(_0x40a8d4){return _0x40a8d4['destroy']()[_0x4d60('0x1f')](function(){_0x5d324e[_0x4d60('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eeafd,_0x4b82b1){return function(_0xa3c79d){if(!_0xa3c79d){_0x4eeafd[_0x4d60('0x28')](0x194);}return _0xa3c79d;};}function handleError(_0x2da33f,_0x3a5ed9){_0x3a5ed9=_0x3a5ed9||0x1f4;return function(_0x688e69){logger[_0x4d60('0x25')](_0x688e69[_0x4d60('0x34')]);if(_0x688e69[_0x4d60('0x35')]){delete _0x688e69[_0x4d60('0x35')];}_0x2da33f['status'](_0x3a5ed9)[_0x4d60('0x36')](_0x688e69);};}exports[_0x4d60('0x37')]=function(_0x1cf2fb,_0x17a4ba){var _0x32c62b={},_0x3ef152={},_0x294d97={'count':0x0,'rows':[]};var _0x5443c5=_[_0x4d60('0x38')](db[_0x4d60('0x39')][_0x4d60('0x3a')],function(_0x13a8fe){return{'name':_0x13a8fe[_0x4d60('0x3b')],'type':_0x13a8fe[_0x4d60('0x3c')][_0x4d60('0x3d')]};});_0x3ef152[_0x4d60('0x3e')]=_[_0x4d60('0x38')](_0x5443c5,_0x4d60('0x35'));_0x3ef152['query']=_['keys'](_0x1cf2fb['query']);_0x3ef152[_0x4d60('0x3f')]=_['intersection'](_0x3ef152[_0x4d60('0x3e')],_0x3ef152['query']);_0x32c62b[_0x4d60('0x40')]=_[_0x4d60('0x41')](_0x3ef152['model'],qs[_0x4d60('0x42')](_0x1cf2fb['query'][_0x4d60('0x42')]));_0x32c62b[_0x4d60('0x40')]=_0x32c62b[_0x4d60('0x40')][_0x4d60('0x43')]?_0x32c62b[_0x4d60('0x40')]:_0x3ef152[_0x4d60('0x3e')];if(!_0x1cf2fb['query'][_0x4d60('0x44')](_0x4d60('0x45'))){_0x32c62b[_0x4d60('0x2d')]=qs[_0x4d60('0x2d')](_0x1cf2fb[_0x4d60('0x46')][_0x4d60('0x2d')]);_0x32c62b[_0x4d60('0x2c')]=qs['offset'](_0x1cf2fb['query']['offset']);}_0x32c62b[_0x4d60('0x47')]=qs[_0x4d60('0x48')](_0x1cf2fb[_0x4d60('0x46')][_0x4d60('0x48')]);_0x32c62b[_0x4d60('0x49')]=qs['filters'](_[_0x4d60('0x4a')](_0x1cf2fb[_0x4d60('0x46')],_0x3ef152['filters']),_0x5443c5);if(_0x1cf2fb[_0x4d60('0x46')][_0x4d60('0x4b')]){_0x32c62b[_0x4d60('0x49')]=_[_0x4d60('0x4c')](_0x32c62b[_0x4d60('0x49')],{'$or':_['map'](_0x5443c5,function(_0x25c248){if(_0x25c248[_0x4d60('0x3c')]!==_0x4d60('0x4d')){var _0x46e28f={};_0x46e28f[_0x25c248[_0x4d60('0x35')]]={'$like':'%'+_0x1cf2fb[_0x4d60('0x46')][_0x4d60('0x4b')]+'%'};return _0x46e28f;}})});}_0x32c62b=_['merge']({},_0x32c62b,_0x1cf2fb['options']);var _0x5559b3={'where':_0x32c62b[_0x4d60('0x49')]};return db[_0x4d60('0x39')][_0x4d60('0x4e')](_0x5559b3)[_0x4d60('0x1f')](function(_0x4a840f){_0x294d97[_0x4d60('0x4e')]=_0x4a840f;if(_0x1cf2fb['query']['includeAll']){_0x32c62b[_0x4d60('0x4f')]=[{'all':!![]}];}return db[_0x4d60('0x39')][_0x4d60('0x50')](_0x32c62b);})[_0x4d60('0x1f')](function(_0x562781){_0x294d97[_0x4d60('0x51')]=_0x562781;return _0x294d97;})['then'](respondWithFilteredResult(_0x17a4ba,_0x32c62b))[_0x4d60('0x52')](handleError(_0x17a4ba,null));};exports[_0x4d60('0x53')]=function(_0x509b2b,_0x577b71){var _0x2b330a={'raw':![],'where':{'id':_0x509b2b[_0x4d60('0x54')]['id']}},_0x1cb69e={};_0x1cb69e[_0x4d60('0x3e')]=_[_0x4d60('0x55')](db[_0x4d60('0x39')][_0x4d60('0x3a')]);_0x1cb69e[_0x4d60('0x46')]=_[_0x4d60('0x55')](_0x509b2b['query']);_0x1cb69e[_0x4d60('0x3f')]=_['intersection'](_0x1cb69e[_0x4d60('0x3e')],_0x1cb69e[_0x4d60('0x46')]);_0x2b330a[_0x4d60('0x40')]=_[_0x4d60('0x41')](_0x1cb69e['model'],qs['fields'](_0x509b2b[_0x4d60('0x46')][_0x4d60('0x42')]));_0x2b330a['attributes']=_0x2b330a[_0x4d60('0x40')]['length']?_0x2b330a[_0x4d60('0x40')]:_0x1cb69e[_0x4d60('0x3e')];if(_0x509b2b['query']['includeAll']){_0x2b330a[_0x4d60('0x4f')]=[{'all':!![]}];}_0x2b330a=_['merge']({},_0x2b330a,_0x509b2b[_0x4d60('0x56')]);return db[_0x4d60('0x39')]['find'](_0x2b330a)['then'](handleEntityNotFound(_0x577b71,null))[_0x4d60('0x1f')](respondWithResult(_0x577b71,null))[_0x4d60('0x52')](handleError(_0x577b71,null));};exports[_0x4d60('0x57')]=function(_0x10f5c8,_0x399a4e){return db['ZendeskAccount'][_0x4d60('0x57')](_0x10f5c8[_0x4d60('0x58')],{})[_0x4d60('0x1f')](respondWithResult(_0x399a4e,0xc9))[_0x4d60('0x52')](handleError(_0x399a4e,null));};exports[_0x4d60('0x33')]=function(_0x427df5,_0x3cbdce){if(_0x427df5[_0x4d60('0x58')]['id']){delete _0x427df5[_0x4d60('0x58')]['id'];}return db[_0x4d60('0x39')][_0x4d60('0x59')]({'where':{'id':_0x427df5[_0x4d60('0x54')]['id']}})[_0x4d60('0x1f')](handleEntityNotFound(_0x3cbdce,null))['then'](saveUpdates(_0x427df5[_0x4d60('0x58')],null))['then'](respondWithResult(_0x3cbdce,null))[_0x4d60('0x52')](handleError(_0x3cbdce,null));};exports[_0x4d60('0x5a')]=function(_0x52cd5b,_0x1444b6){return db[_0x4d60('0x39')]['find']({'where':{'id':_0x52cd5b[_0x4d60('0x54')]['id']}})[_0x4d60('0x1f')](handleEntityNotFound(_0x1444b6,null))[_0x4d60('0x1f')](removeEntity(_0x1444b6,null))[_0x4d60('0x52')](handleError(_0x1444b6,null));};exports[_0x4d60('0x5b')]=function(_0x2fc755,_0x3d7225,_0x59a43c){var _0x16f22f={};var _0x2d5113={};var _0x1d5311;var _0x1bcc63;return db[_0x4d60('0x39')][_0x4d60('0x5c')]({'where':{'id':_0x2fc755[_0x4d60('0x54')]['id']}})[_0x4d60('0x1f')](handleEntityNotFound(_0x3d7225,null))[_0x4d60('0x1f')](function(_0x3a91e2){if(_0x3a91e2){_0x1d5311=_0x3a91e2;_0x2d5113[_0x4d60('0x3e')]=_['keys'](db['ZendeskConfiguration'][_0x4d60('0x3a')]);_0x2d5113[_0x4d60('0x46')]=_[_0x4d60('0x55')](_0x2fc755['query']);_0x2d5113[_0x4d60('0x3f')]=_['intersection'](_0x2d5113['model'],_0x2d5113['query']);_0x16f22f[_0x4d60('0x40')]=_[_0x4d60('0x41')](_0x2d5113[_0x4d60('0x3e')],qs[_0x4d60('0x42')](_0x2fc755['query'][_0x4d60('0x42')]));_0x16f22f[_0x4d60('0x40')]=_0x16f22f[_0x4d60('0x40')][_0x4d60('0x43')]?_0x16f22f['attributes']:_0x2d5113['model'];_0x16f22f[_0x4d60('0x47')]=qs[_0x4d60('0x48')](_0x2fc755[_0x4d60('0x46')][_0x4d60('0x48')]);_0x16f22f['where']=qs[_0x4d60('0x3f')](_[_0x4d60('0x4a')](_0x2fc755[_0x4d60('0x46')],_0x2d5113['filters']));if(_0x2fc755[_0x4d60('0x46')]['filter']){_0x16f22f['where']=_[_0x4d60('0x4c')](_0x16f22f[_0x4d60('0x49')],{'$or':_[_0x4d60('0x38')](_0x16f22f[_0x4d60('0x40')],function(_0x5e4fcc){var _0x463608={};_0x463608[_0x5e4fcc]={'$like':'%'+_0x2fc755[_0x4d60('0x46')][_0x4d60('0x4b')]+'%'};return _0x463608;})});}_0x16f22f=_['merge']({},_0x16f22f,_0x2fc755[_0x4d60('0x56')]);return _0x1d5311[_0x4d60('0x5b')](_0x16f22f);}})['then'](function(_0x55dae7){if(_0x55dae7){_0x1bcc63=_0x55dae7['length'];if(!_0x2fc755[_0x4d60('0x46')][_0x4d60('0x44')]('nolimit')){_0x16f22f[_0x4d60('0x2d')]=qs['limit'](_0x2fc755['query'][_0x4d60('0x2d')]);_0x16f22f[_0x4d60('0x2c')]=qs[_0x4d60('0x2c')](_0x2fc755[_0x4d60('0x46')]['offset']);}return _0x1d5311[_0x4d60('0x5b')](_0x16f22f);}})[_0x4d60('0x1f')](function(_0x505874){if(_0x505874){return _0x505874?{'count':_0x1bcc63,'rows':_0x505874}:null;}})['then'](respondWithResult(_0x3d7225,null))[_0x4d60('0x52')](handleError(_0x3d7225,null));};exports[_0x4d60('0x5d')]=function(_0x139b87,_0x416776,_0x1ef6b0){if(_0x139b87['body']['id']){delete _0x139b87[_0x4d60('0x58')]['id'];}return db[_0x4d60('0x39')][_0x4d60('0x5c')]({'where':{'id':_0x139b87['params']['id']}})[_0x4d60('0x1f')](handleEntityNotFound(_0x416776,null))[_0x4d60('0x1f')](function(_0x4a0822){if(_0x4a0822){_0x139b87[_0x4d60('0x58')][_0x4d60('0x5e')]=_0x4a0822['id'];_0x139b87['body'][_0x4d60('0x5f')]=integrations[_0x4d60('0x60')](_0x139b87[_0x4d60('0x58')][_0x4d60('0x61')],_0x139b87['body'][_0x4d60('0x3c')]);_0x139b87[_0x4d60('0x58')]['Descriptions']=integrations[_0x4d60('0x62')](_0x139b87['body'][_0x4d60('0x61')],_0x139b87[_0x4d60('0x58')][_0x4d60('0x3c')]);return db[_0x4d60('0x63')][_0x4d60('0x57')](_0x139b87[_0x4d60('0x58')],{'include':[{'model':db[_0x4d60('0x64')],'as':'Subjects'},{'model':db[_0x4d60('0x64')],'as':_0x4d60('0x65')}]});}return null;})['then'](respondWithResult(_0x416776,null))[_0x4d60('0x52')](handleError(_0x416776,null));};exports[_0x4d60('0x66')]=function(_0x2e865d,_0x29ac5f,_0x26c645){var _0x2b8ca0='';return db[_0x4d60('0x39')][_0x4d60('0x5c')]({'where':{'id':_0x2e865d['params']['id']},'attributes':['id',_0x4d60('0x67'),_0x4d60('0x68'),_0x4d60('0x69'),_0x4d60('0x6a'),_0x4d60('0x6b')]})[_0x4d60('0x1f')](handleEntityNotFound(_0x29ac5f,null))[_0x4d60('0x1f')](function(_0x2d990e){if(_0x2d990e){_0x2b8ca0=_0x2d990e[_0x4d60('0x6b')];var _0x1c495b=_0x2b8ca0[_0x4d60('0x6c')](-0x1);if(_0x1c495b==='/'){_0x2b8ca0=_0x2b8ca0['substring'](0x0,_0x2b8ca0['lastIndexOf'](_0x1c495b));}var _0x362219={'method':_0x4d60('0x6d'),'uri':util[_0x4d60('0x6e')]('%s/%s',_0x2b8ca0,_0x4d60('0x6f')),'json':!![]};switch(_0x2d990e[_0x4d60('0x6a')]){case _0x4d60('0x68'):_0x362219[_0x4d60('0x70')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4d60('0x6e')](_0x4d60('0x71'),_0x2d990e[_0x4d60('0x67')],_0x2d990e[_0x4d60('0x68')]))[_0x4d60('0x72')](_0x4d60('0x73')))};break;case _0x4d60('0x69'):_0x362219[_0x4d60('0x70')]={'Authorization':util[_0x4d60('0x6e')](_0x4d60('0x74'),new Buffer(util[_0x4d60('0x6e')]('%s/token:%s',_0x2d990e[_0x4d60('0x67')],_0x2d990e[_0x4d60('0x69')]))[_0x4d60('0x72')](_0x4d60('0x73')))};break;default:throw new db[(_0x4d60('0x75'))][(_0x4d60('0x1c'))]('Unknown\x20authentication\x20type');}return rp(_0x362219);}})['then'](function(_0x5140ba){if(_0x5140ba){var _0x2e0b7f=['subject',_0x4d60('0x76'),_0x4d60('0x77'),_0x4d60('0x78')];_[_0x4d60('0x79')](_0x5140ba[_0x4d60('0x6f')],function(_0x2b5033){return _0x2e0b7f[_0x4d60('0x7a')](_0x2b5033[_0x4d60('0x3c')]);});return{'count':_0x5140ba[_0x4d60('0x6f')][_0x4d60('0x43')],'rows':_[_0x4d60('0x38')](_0x5140ba[_0x4d60('0x6f')],function(_0x5b3767){return{'id':_0x5b3767['id'],'name':_0x5b3767[_0x4d60('0x7b')]>0x7?_0x5b3767[_0x4d60('0x7c')]:_0x5b3767[_0x4d60('0x3c')],'custom':_0x5b3767[_0x4d60('0x7b')]>0x7?!![]:![],'options':_0x5b3767[_0x4d60('0x7d')]?_0x5b3767[_0x4d60('0x7d')]:_0x5b3767[_0x4d60('0x7e')]?_0x5b3767[_0x4d60('0x7e')]:[]};})};}})[_0x4d60('0x1f')](respondWithResult(_0x29ac5f,null))[_0x4d60('0x52')](function(_0x3f2464){var _0x49b9ec=_0x2e865d[_0x4d60('0x46')][_0x4d60('0x1b')]?0x1f4:_0x3f2464['statusCode']||0x1f4;logger['error'](_0x4d60('0x7f'),_0x4d60('0x66'),_0x49b9ec,JSON[_0x4d60('0x24')](_0x3f2464));delete _0x3f2464[_0x4d60('0x35')];if(_0x49b9ec===0x191){_0x49b9ec=0x190;}_0x29ac5f[_0x4d60('0x2a')](_0x49b9ec)[_0x4d60('0x36')](_0x2e865d['query'][_0x4d60('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x3f2464[_0x4d60('0x80')]}:_0x3f2464);});}; \ No newline at end of file +var _0x2686=['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','then','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','limit','set','apply','reject','save','update','destroy','stack','send','index','ZendeskAccount','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','ZendeskField','getFields','token','authType','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','password','headers','%s:%s','toString','username','base64','ValidationError','subject','group','assignee','includes','position','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','statusCode','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client'];(function(_0x146c2d,_0x6c2964){var _0x1af398=function(_0x11dfbb){while(--_0x11dfbb){_0x146c2d['push'](_0x146c2d['shift']());}};_0x1af398(++_0x6c2964);}(_0x2686,0xe1));var _0x6268=function(_0x25e576,_0x270d3d){_0x25e576=_0x25e576-0x0;var _0x38ce09=_0x2686[_0x25e576];return _0x38ce09;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6268('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6268('0x1'));var rp=require(_0x6268('0x2'));var moment=require('moment');var BPromise=require(_0x6268('0x3'));var Mustache=require(_0x6268('0x4'));var util=require('util');var path=require(_0x6268('0x5'));var sox=require(_0x6268('0x6'));var csv=require('to-csv');var ejs=require(_0x6268('0x7'));var fs=require('fs');var _=require(_0x6268('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6268('0x9'));var deskjs=require(_0x6268('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6268('0xb'));var Papa=require('papaparse');var Redis=require(_0x6268('0xc'));var authService=require(_0x6268('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6268('0xe'));var hardwareService=require(_0x6268('0xf'));var logger=require(_0x6268('0x10'))(_0x6268('0x11'));var utils=require('../../config/utils');var config=require(_0x6268('0x12'));var db=require(_0x6268('0x13'))['db'];var integrations=require(_0x6268('0x14'));var jayson=require(_0x6268('0x15'));var client=jayson[_0x6268('0x16')][_0x6268('0x17')]({'port':0x232a});function checkPasswordPattern(_0xbd690c,_0x2d3586,_0x3412e4){if(_0x3412e4){var _0x15db6d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15db6d[_0x6268('0x18')](_0x2d3586)){return _0xbd690c;}else{throw new db[(_0x6268('0x19'))]['ValidationError'](_0x6268('0x1a'));}}else{return _0xbd690c;}}function respondWithRpcPromise(_0xa0f969,_0x2cf3ec,_0x41e997,_0x518f5d){return new BPromise(function(_0x1cfff0,_0x3a6416){var _0x207827=_0x518f5d||client;return _0x207827[_0x6268('0x1b')](_0xa0f969,_0x41e997)[_0x6268('0x1c')](function(_0x7835a7){logger[_0x6268('0x1d')](_0x6268('0x1e'),_0x2cf3ec,'request\x20sent');logger[_0x6268('0x1f')](_0x6268('0x20'),_0x2cf3ec,_0x6268('0x21'),JSON[_0x6268('0x22')](_0x7835a7));if(_0x7835a7[_0x6268('0x23')]){if(_0x7835a7[_0x6268('0x23')][_0x6268('0x24')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2cf3ec,_0x7835a7[_0x6268('0x23')][_0x6268('0x25')]);return _0x3a6416(_0x7835a7[_0x6268('0x23')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2cf3ec,_0x7835a7[_0x6268('0x23')][_0x6268('0x25')]);return _0x1cfff0(_0x7835a7[_0x6268('0x23')][_0x6268('0x25')]);}else{logger[_0x6268('0x1d')](_0x6268('0x1e'),_0x2cf3ec,'request\x20sent');_0x1cfff0(_0x7835a7[_0x6268('0x26')][_0x6268('0x25')]);}})['catch'](function(_0x3fa910){logger[_0x6268('0x23')](_0x6268('0x1e'),_0x2cf3ec,_0x3fa910);_0x3a6416(_0x3fa910);});});}function respondWithStatusCode(_0x194581,_0x259851){_0x259851=_0x259851||0xcc;return function(_0x545ecd){if(_0x545ecd){return _0x194581[_0x6268('0x27')](_0x259851);}return _0x194581[_0x6268('0x28')](_0x259851)[_0x6268('0x29')]();};}function respondWithResult(_0x2e0108,_0x16e753){_0x16e753=_0x16e753||0xc8;return function(_0x1b0c8a){if(_0x1b0c8a){return _0x2e0108[_0x6268('0x28')](_0x16e753)[_0x6268('0x2a')](_0x1b0c8a);}};}function respondWithFilteredResult(_0x36c22c,_0x26adaf){return function(_0x1f3297){if(_0x1f3297){var _0x3ad2b5=_0x1f3297[_0x6268('0x2b')],_0x4a9891=_0x26adaf['offset'],_0x1676f9=_0x26adaf[_0x6268('0x2c')]+_0x26adaf[_0x6268('0x2d')],_0x44c10f;if(_0x1676f9>=_0x3ad2b5){_0x1676f9=_0x3ad2b5;_0x44c10f=0xc8;}else{_0x44c10f=0xce;}_0x36c22c['status'](_0x44c10f);return _0x36c22c[_0x6268('0x2e')]('Content-Range',_0x4a9891+'-'+_0x1676f9+'/'+_0x3ad2b5)['json'](_0x1f3297);}return null;};}function patchUpdates(_0x55d3b6){return function(_0x836962){try{jsonpatch[_0x6268('0x2f')](_0x836962,_0x55d3b6,!![]);}catch(_0x5338b6){return BPromise[_0x6268('0x30')](_0x5338b6);}return _0x836962[_0x6268('0x31')]();};}function saveUpdates(_0x4a09b5,_0x2ab5c2){return function(_0x1b0f86){if(_0x1b0f86){return _0x1b0f86[_0x6268('0x32')](_0x4a09b5)[_0x6268('0x1c')](function(_0x5f52d1){return _0x5f52d1;});}return null;};}function removeEntity(_0x14343c,_0x222af5){return function(_0xc007ff){if(_0xc007ff){return _0xc007ff[_0x6268('0x33')]()[_0x6268('0x1c')](function(){_0x14343c[_0x6268('0x28')](0xcc)[_0x6268('0x29')]();});}};}function handleEntityNotFound(_0x1f4ad3,_0x401d3f){return function(_0x308656){if(!_0x308656){_0x1f4ad3[_0x6268('0x27')](0x194);}return _0x308656;};}function handleError(_0x468c36,_0x56e053){_0x56e053=_0x56e053||0x1f4;return function(_0x36556a){logger[_0x6268('0x23')](_0x36556a[_0x6268('0x34')]);if(_0x36556a['name']){delete _0x36556a['name'];}_0x468c36[_0x6268('0x28')](_0x56e053)[_0x6268('0x35')](_0x36556a);};}exports[_0x6268('0x36')]=function(_0x147df3,_0x126334){var _0x1e8541={},_0x466266={},_0x424196={'count':0x0,'rows':[]};var _0x1bacba=_['map'](db[_0x6268('0x37')][_0x6268('0x38')],function(_0x45dadb){return{'name':_0x45dadb['fieldName'],'type':_0x45dadb[_0x6268('0x39')][_0x6268('0x3a')]};});_0x466266[_0x6268('0x3b')]=_[_0x6268('0x3c')](_0x1bacba,_0x6268('0x3d'));_0x466266[_0x6268('0x3e')]=_[_0x6268('0x3f')](_0x147df3[_0x6268('0x3e')]);_0x466266[_0x6268('0x40')]=_[_0x6268('0x41')](_0x466266[_0x6268('0x3b')],_0x466266['query']);_0x1e8541['attributes']=_[_0x6268('0x41')](_0x466266['model'],qs[_0x6268('0x42')](_0x147df3[_0x6268('0x3e')][_0x6268('0x42')]));_0x1e8541[_0x6268('0x43')]=_0x1e8541[_0x6268('0x43')][_0x6268('0x44')]?_0x1e8541['attributes']:_0x466266[_0x6268('0x3b')];if(!_0x147df3['query'][_0x6268('0x45')](_0x6268('0x46'))){_0x1e8541[_0x6268('0x2d')]=qs[_0x6268('0x2d')](_0x147df3['query']['limit']);_0x1e8541['offset']=qs[_0x6268('0x2c')](_0x147df3['query'][_0x6268('0x2c')]);}_0x1e8541[_0x6268('0x47')]=qs[_0x6268('0x48')](_0x147df3[_0x6268('0x3e')]['sort']);_0x1e8541[_0x6268('0x49')]=qs[_0x6268('0x40')](_[_0x6268('0x4a')](_0x147df3['query'],_0x466266['filters']),_0x1bacba);if(_0x147df3['query'][_0x6268('0x4b')]){_0x1e8541[_0x6268('0x49')]=_[_0x6268('0x4c')](_0x1e8541[_0x6268('0x49')],{'$or':_[_0x6268('0x3c')](_0x1bacba,function(_0x29675c){if(_0x29675c[_0x6268('0x39')]!=='VIRTUAL'){var _0x568101={};_0x568101[_0x29675c[_0x6268('0x3d')]]={'$like':'%'+_0x147df3[_0x6268('0x3e')][_0x6268('0x4b')]+'%'};return _0x568101;}})});}_0x1e8541=_[_0x6268('0x4c')]({},_0x1e8541,_0x147df3[_0x6268('0x4d')]);var _0x596b91={'where':_0x1e8541[_0x6268('0x49')]};return db[_0x6268('0x37')][_0x6268('0x2b')](_0x596b91)[_0x6268('0x1c')](function(_0x54be3e){_0x424196['count']=_0x54be3e;if(_0x147df3['query'][_0x6268('0x4e')]){_0x1e8541['include']=[{'all':!![]}];}return db[_0x6268('0x37')][_0x6268('0x4f')](_0x1e8541);})[_0x6268('0x1c')](function(_0x955442){_0x424196[_0x6268('0x50')]=_0x955442;return _0x424196;})[_0x6268('0x1c')](respondWithFilteredResult(_0x126334,_0x1e8541))['catch'](handleError(_0x126334,null));};exports[_0x6268('0x51')]=function(_0x291747,_0x1c3cbf){var _0x4afcae={'raw':![],'where':{'id':_0x291747[_0x6268('0x52')]['id']}},_0x1bd838={};_0x1bd838['model']=_[_0x6268('0x3f')](db[_0x6268('0x37')][_0x6268('0x38')]);_0x1bd838[_0x6268('0x3e')]=_[_0x6268('0x3f')](_0x291747[_0x6268('0x3e')]);_0x1bd838[_0x6268('0x40')]=_[_0x6268('0x41')](_0x1bd838[_0x6268('0x3b')],_0x1bd838['query']);_0x4afcae[_0x6268('0x43')]=_[_0x6268('0x41')](_0x1bd838['model'],qs[_0x6268('0x42')](_0x291747[_0x6268('0x3e')]['fields']));_0x4afcae[_0x6268('0x43')]=_0x4afcae['attributes'][_0x6268('0x44')]?_0x4afcae[_0x6268('0x43')]:_0x1bd838['model'];if(_0x291747['query'][_0x6268('0x4e')]){_0x4afcae[_0x6268('0x53')]=[{'all':!![]}];}_0x4afcae=_[_0x6268('0x4c')]({},_0x4afcae,_0x291747[_0x6268('0x4d')]);return db[_0x6268('0x37')][_0x6268('0x54')](_0x4afcae)[_0x6268('0x1c')](handleEntityNotFound(_0x1c3cbf,null))['then'](respondWithResult(_0x1c3cbf,null))[_0x6268('0x55')](handleError(_0x1c3cbf,null));};exports['create']=function(_0x34eaa0,_0x54d84a){return db['ZendeskAccount']['create'](_0x34eaa0[_0x6268('0x56')],{})[_0x6268('0x1c')](respondWithResult(_0x54d84a,0xc9))[_0x6268('0x55')](handleError(_0x54d84a,null));};exports[_0x6268('0x32')]=function(_0x33cf26,_0x3ab0d2){if(_0x33cf26[_0x6268('0x56')]['id']){delete _0x33cf26[_0x6268('0x56')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x33cf26[_0x6268('0x52')]['id']}})[_0x6268('0x1c')](handleEntityNotFound(_0x3ab0d2,null))[_0x6268('0x1c')](saveUpdates(_0x33cf26[_0x6268('0x56')],null))[_0x6268('0x1c')](respondWithResult(_0x3ab0d2,null))[_0x6268('0x55')](handleError(_0x3ab0d2,null));};exports[_0x6268('0x33')]=function(_0x401dee,_0x383bd5){return db['ZendeskAccount'][_0x6268('0x54')]({'where':{'id':_0x401dee[_0x6268('0x52')]['id']}})[_0x6268('0x1c')](handleEntityNotFound(_0x383bd5,null))[_0x6268('0x1c')](removeEntity(_0x383bd5,null))['catch'](handleError(_0x383bd5,null));};exports[_0x6268('0x57')]=function(_0x18d53b,_0x85e790,_0x4cd403){var _0x4c290c={};var _0x362351={};var _0x5915a3;var _0x40a6ce;return db['ZendeskAccount'][_0x6268('0x58')]({'where':{'id':_0x18d53b[_0x6268('0x52')]['id']}})[_0x6268('0x1c')](handleEntityNotFound(_0x85e790,null))[_0x6268('0x1c')](function(_0x573392){if(_0x573392){_0x5915a3=_0x573392;_0x362351['model']=_[_0x6268('0x3f')](db[_0x6268('0x59')][_0x6268('0x38')]);_0x362351[_0x6268('0x3e')]=_[_0x6268('0x3f')](_0x18d53b[_0x6268('0x3e')]);_0x362351['filters']=_[_0x6268('0x41')](_0x362351[_0x6268('0x3b')],_0x362351[_0x6268('0x3e')]);_0x4c290c[_0x6268('0x43')]=_[_0x6268('0x41')](_0x362351[_0x6268('0x3b')],qs['fields'](_0x18d53b['query'][_0x6268('0x42')]));_0x4c290c[_0x6268('0x43')]=_0x4c290c[_0x6268('0x43')][_0x6268('0x44')]?_0x4c290c[_0x6268('0x43')]:_0x362351['model'];_0x4c290c[_0x6268('0x47')]=qs[_0x6268('0x48')](_0x18d53b[_0x6268('0x3e')][_0x6268('0x48')]);_0x4c290c[_0x6268('0x49')]=qs[_0x6268('0x40')](_[_0x6268('0x4a')](_0x18d53b['query'],_0x362351['filters']));if(_0x18d53b[_0x6268('0x3e')][_0x6268('0x4b')]){_0x4c290c['where']=_['merge'](_0x4c290c[_0x6268('0x49')],{'$or':_[_0x6268('0x3c')](_0x4c290c['attributes'],function(_0x2f7419){var _0x1bb032={};_0x1bb032[_0x2f7419]={'$like':'%'+_0x18d53b[_0x6268('0x3e')]['filter']+'%'};return _0x1bb032;})});}_0x4c290c=_[_0x6268('0x4c')]({},_0x4c290c,_0x18d53b['options']);return _0x5915a3['getConfigurations'](_0x4c290c);}})[_0x6268('0x1c')](function(_0x1c6bea){if(_0x1c6bea){_0x40a6ce=_0x1c6bea[_0x6268('0x44')];if(!_0x18d53b[_0x6268('0x3e')][_0x6268('0x45')]('nolimit')){_0x4c290c[_0x6268('0x2d')]=qs['limit'](_0x18d53b[_0x6268('0x3e')][_0x6268('0x2d')]);_0x4c290c['offset']=qs[_0x6268('0x2c')](_0x18d53b['query']['offset']);}return _0x5915a3['getConfigurations'](_0x4c290c);}})[_0x6268('0x1c')](function(_0x39168a){if(_0x39168a){return _0x39168a?{'count':_0x40a6ce,'rows':_0x39168a}:null;}})[_0x6268('0x1c')](respondWithResult(_0x85e790,null))[_0x6268('0x55')](handleError(_0x85e790,null));};exports[_0x6268('0x5a')]=function(_0x32c867,_0x1862c9,_0x50ee45){if(_0x32c867[_0x6268('0x56')]['id']){delete _0x32c867[_0x6268('0x56')]['id'];}return db[_0x6268('0x37')][_0x6268('0x58')]({'where':{'id':_0x32c867[_0x6268('0x52')]['id']}})[_0x6268('0x1c')](handleEntityNotFound(_0x1862c9,null))[_0x6268('0x1c')](function(_0x445f81){if(_0x445f81){_0x32c867[_0x6268('0x56')][_0x6268('0x5b')]=_0x445f81['id'];_0x32c867[_0x6268('0x56')][_0x6268('0x5c')]=integrations[_0x6268('0x5d')](_0x32c867[_0x6268('0x56')]['channel'],_0x32c867['body']['type']);_0x32c867[_0x6268('0x56')][_0x6268('0x5e')]=integrations[_0x6268('0x5f')](_0x32c867[_0x6268('0x56')][_0x6268('0x60')],_0x32c867[_0x6268('0x56')][_0x6268('0x39')]);return db[_0x6268('0x59')][_0x6268('0x61')](_0x32c867[_0x6268('0x56')],{'include':[{'model':db['ZendeskField'],'as':_0x6268('0x5c')},{'model':db[_0x6268('0x62')],'as':'Descriptions'}]});}return null;})[_0x6268('0x1c')](respondWithResult(_0x1862c9,null))[_0x6268('0x55')](handleError(_0x1862c9,null));};exports[_0x6268('0x63')]=function(_0x2678a6,_0x8523cf,_0x3b1946){var _0x39064a='';return db[_0x6268('0x37')][_0x6268('0x58')]({'where':{'id':_0x2678a6[_0x6268('0x52')]['id']},'attributes':['id','username','password',_0x6268('0x64'),_0x6268('0x65'),'remoteUri']})[_0x6268('0x1c')](handleEntityNotFound(_0x8523cf,null))[_0x6268('0x1c')](function(_0x318e59){if(_0x318e59){_0x39064a=_0x318e59['remoteUri'];var _0x52375f=_0x39064a[_0x6268('0x66')](-0x1);if(_0x52375f==='/'){_0x39064a=_0x39064a[_0x6268('0x67')](0x0,_0x39064a[_0x6268('0x68')](_0x52375f));}var _0x19ab3c={'method':'GET','uri':util[_0x6268('0x69')](_0x6268('0x6a'),_0x39064a,_0x6268('0x6b')),'json':!![]};switch(_0x318e59['authType']){case _0x6268('0x6c'):_0x19ab3c[_0x6268('0x6d')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x6268('0x69')](_0x6268('0x6e'),_0x318e59['username'],_0x318e59['password']))[_0x6268('0x6f')]('base64'))};break;case _0x6268('0x64'):_0x19ab3c['headers']={'Authorization':util[_0x6268('0x69')]('Basic\x20%s',new Buffer(util[_0x6268('0x69')]('%s/token:%s',_0x318e59[_0x6268('0x70')],_0x318e59['token']))['toString'](_0x6268('0x71')))};break;default:throw new db[(_0x6268('0x19'))][(_0x6268('0x72'))]('Unknown\x20authentication\x20type');}return rp(_0x19ab3c);}})[_0x6268('0x1c')](function(_0x1e3a3a){if(_0x1e3a3a){var _0x29c57d=[_0x6268('0x73'),'description',_0x6268('0x74'),_0x6268('0x75')];_['remove'](_0x1e3a3a[_0x6268('0x6b')],function(_0x4fe889){return _0x29c57d[_0x6268('0x76')](_0x4fe889['type']);});return{'count':_0x1e3a3a[_0x6268('0x6b')][_0x6268('0x44')],'rows':_[_0x6268('0x3c')](_0x1e3a3a[_0x6268('0x6b')],function(_0x5fda11){return{'id':_0x5fda11['id'],'name':_0x5fda11[_0x6268('0x77')]>0x7?_0x5fda11['title']:_0x5fda11[_0x6268('0x39')],'custom':_0x5fda11[_0x6268('0x77')]>0x7?!![]:![],'options':_0x5fda11[_0x6268('0x78')]?_0x5fda11[_0x6268('0x78')]:_0x5fda11['custom_field_options']?_0x5fda11[_0x6268('0x79')]:[]};})};}})[_0x6268('0x1c')](respondWithResult(_0x8523cf,null))[_0x6268('0x55')](function(_0x3b23d1){var _0x5d9a9b=_0x2678a6[_0x6268('0x3e')][_0x6268('0x18')]?0x1f4:_0x3b23d1['statusCode']||0x1f4;logger[_0x6268('0x23')](_0x6268('0x7a'),_0x6268('0x63'),_0x5d9a9b,JSON['stringify'](_0x3b23d1));delete _0x3b23d1[_0x6268('0x3d')];if(_0x5d9a9b===0x191){_0x5d9a9b=0x190;}_0x8523cf[_0x6268('0x28')](_0x5d9a9b)['send'](_0x2678a6[_0x6268('0x3e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3b23d1[_0x6268('0x7b')]}:_0x3b23d1);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index adfe074..095b436 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 _0xa58d=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','../../config/logger','api','moment','bluebird'];(function(_0x59e8bc,_0x275074){var _0x4ea75e=function(_0x1017d8){while(--_0x1017d8){_0x59e8bc['push'](_0x59e8bc['shift']());}};_0x4ea75e(++_0x275074);}(_0xa58d,0x1b8));var _0xda58=function(_0x252bce,_0xc74acf){_0x252bce=_0x252bce-0x0;var _0x3696b5=_0xa58d[_0x252bce];return _0x3696b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda58('0x0'))(_0xda58('0x1'));var moment=require(_0xda58('0x2'));var BPromise=require(_0xda58('0x3'));var rp=require(_0xda58('0x4'));var fs=require('fs');var path=require(_0xda58('0x5'));var rimraf=require(_0xda58('0x6'));var config=require(_0xda58('0x7'));var attributes=require(_0xda58('0x8'));var integrations=require(_0xda58('0x9'));module['exports']=function(_0x3b87fa,_0x702b6a){return _0x3b87fa['define'](_0xda58('0xa'),attributes,{'tableName':_0xda58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6843=['ZendeskAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x6843,0x12d));var _0x3684=function(_0x4e3859,_0x4cfff1){_0x4e3859=_0x4e3859-0x0;var _0x519d2c=_0x6843[_0x4e3859];return _0x519d2c;};'use strict';var _=require(_0x3684('0x0'));var util=require('util');var logger=require(_0x3684('0x1'))(_0x3684('0x2'));var moment=require(_0x3684('0x3'));var BPromise=require(_0x3684('0x4'));var rp=require(_0x3684('0x5'));var fs=require('fs');var path=require(_0x3684('0x6'));var rimraf=require(_0x3684('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3684('0x8'));module[_0x3684('0x9')]=function(_0x5d02ee,_0x3cd902){return _0x5d02ee[_0x3684('0xa')](_0x3684('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index dd1ee3a..79fc182 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x679838,_0x2884cb){var _0x4aa5ca=function(_0xb9d736){while(--_0xb9d736){_0x679838['push'](_0x679838['shift']());}};_0x4aa5ca(++_0x2884cb);}(_0xe706,0xa3));var _0x6e70=function(_0x2f430a,_0x46d370){_0x2f430a=_0x2f430a-0x0;var _0x10def3=_0xe706[_0x2f430a];return _0x10def3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x28ab8f,_0x1aa2fe){var _0x176a3d=function(_0x13a7f4){while(--_0x13a7f4){_0x28ab8f['push'](_0x28ab8f['shift']());}};_0x176a3d(++_0x1aa2fe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9dc0108..0ed1822 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 _0x2236=['./intZendeskConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x12890e,_0x1986c1){var _0x3b7321=function(_0x21720e){while(--_0x21720e){_0x12890e['push'](_0x12890e['shift']());}};_0x3b7321(++_0x1986c1);}(_0x2236,0x1c6));var _0x6223=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x2236[_0x4d8666];return _0x37175b;};'use strict';var multer=require(_0x6223('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6223('0x1'));var express=require(_0x6223('0x2'));var router=express[_0x6223('0x3')]();var auth=require(_0x6223('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6223('0x5'));var controller=require(_0x6223('0x6'));router[_0x6223('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6223('0x7')](_0x6223('0x8'),auth[_0x6223('0x9')](),controller['show']);router['get'](_0x6223('0xa'),auth[_0x6223('0x9')](),controller[_0x6223('0xb')]);router[_0x6223('0x7')](_0x6223('0xc'),auth[_0x6223('0x9')](),controller[_0x6223('0xd')]);router[_0x6223('0x7')]('/:id/descriptions',auth[_0x6223('0x9')](),controller[_0x6223('0xe')]);router[_0x6223('0x7')](_0x6223('0xf'),auth[_0x6223('0x9')](),controller[_0x6223('0x10')]);router[_0x6223('0x11')]('/',auth[_0x6223('0x9')](),controller[_0x6223('0x12')]);router[_0x6223('0x11')](_0x6223('0xf'),auth[_0x6223('0x9')](),controller[_0x6223('0x13')]);router['put'](_0x6223('0x8'),auth[_0x6223('0x9')](),controller[_0x6223('0x14')]);router[_0x6223('0x15')](_0x6223('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x6223('0x16')]=router; \ No newline at end of file +var _0xc128=['getTags','post','create','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0xcb6d2b,_0x1a56ac){var _0x2c3687=function(_0x1b6ed0){while(--_0x1b6ed0){_0xcb6d2b['push'](_0xcb6d2b['shift']());}};_0x2c3687(++_0x1a56ac);}(_0xc128,0xb5));var _0x8c12=function(_0x58f02c,_0x4538b0){_0x58f02c=_0x58f02c-0x0;var _0x2270fd=_0xc128[_0x58f02c];return _0x2270fd;};'use strict';var multer=require(_0x8c12('0x0'));var util=require(_0x8c12('0x1'));var path=require(_0x8c12('0x2'));var timeout=require(_0x8c12('0x3'));var express=require('express');var router=express[_0x8c12('0x4')]();var auth=require(_0x8c12('0x5'));var interaction=require(_0x8c12('0x6'));var config=require(_0x8c12('0x7'));var controller=require(_0x8c12('0x8'));router['get']('/',auth[_0x8c12('0x9')](),controller[_0x8c12('0xa')]);router[_0x8c12('0xb')](_0x8c12('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8c12('0xb')]('/:id/fields',auth[_0x8c12('0x9')](),controller['getFields']);router[_0x8c12('0xb')](_0x8c12('0xd'),auth[_0x8c12('0x9')](),controller['getSubjects']);router[_0x8c12('0xb')](_0x8c12('0xe'),auth[_0x8c12('0x9')](),controller[_0x8c12('0xf')]);router[_0x8c12('0xb')](_0x8c12('0x10'),auth[_0x8c12('0x9')](),controller[_0x8c12('0x11')]);router[_0x8c12('0x12')]('/',auth[_0x8c12('0x9')](),controller[_0x8c12('0x13')]);router[_0x8c12('0x12')](_0x8c12('0x10'),auth[_0x8c12('0x9')](),controller['setTags']);router['put'](_0x8c12('0xc'),auth[_0x8c12('0x9')](),controller[_0x8c12('0x14')]);router[_0x8c12('0x15')](_0x8c12('0xc'),auth[_0x8c12('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2685e68..70cb155 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 _0xdded=['sequelize','exports','STRING'];(function(_0x2a8221,_0x19452b){var _0x19bf4f=function(_0x22ab32){while(--_0x22ab32){_0x2a8221['push'](_0x2a8221['shift']());}};_0x19bf4f(++_0x19452b);}(_0xdded,0xdb));var _0xddde=function(_0x1e61fe,_0x3eecf7){_0x1e61fe=_0x1e61fe-0x0;var _0x1a3a02=_0xdded[_0x1e61fe];return _0x1a3a02;};'use strict';var Sequelize=require(_0xddde('0x0'));module[_0xddde('0x1')]={'name':{'type':Sequelize[_0xddde('0x2')]},'description':{'type':Sequelize[_0xddde('0x2')]}}; \ No newline at end of file +var _0x9bc8=['STRING','exports'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x9bc8,0x13d));var _0x89bc=function(_0x4aa2e8,_0x5e2158){_0x4aa2e8=_0x4aa2e8-0x0;var _0x44949e=_0x9bc8[_0x4aa2e8];return _0x44949e;};'use strict';var Sequelize=require('sequelize');module[_0x89bc('0x0')]={'name':{'type':Sequelize[_0x89bc('0x1')]},'description':{'type':Sequelize[_0x89bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 608db3c..941834a 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 _0x6d83=['jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','filter','count','includeAll','include','rows','catch','show','params','keys','find','create','body','getFields','ZendeskField','options','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','moment','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x187309,_0x2cb520){var _0x1d3711=function(_0x5ab037){while(--_0x5ab037){_0x187309['push'](_0x187309['shift']());}};_0x1d3711(++_0x2cb520);}(_0x6d83,0x109));var _0x36d8=function(_0x5f66ec,_0x395c37){_0x5f66ec=_0x5f66ec-0x0;var _0xf315eb=_0x6d83[_0x5f66ec];return _0xf315eb;};'use strict';var pdf=require(_0x36d8('0x0'));var emlformat=require(_0x36d8('0x1'));var rimraf=require(_0x36d8('0x2'));var zipdir=require(_0x36d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x36d8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x36d8('0x5'));var sox=require(_0x36d8('0x6'));var csv=require(_0x36d8('0x7'));var ejs=require(_0x36d8('0x8'));var fs=require('fs');var _=require(_0x36d8('0x9'));var squel=require('squel');var crypto=require(_0x36d8('0xa'));var jsforce=require(_0x36d8('0xb'));var deskjs=require(_0x36d8('0xc'));var toCsv=require(_0x36d8('0x7'));var querystring=require(_0x36d8('0xd'));var Papa=require(_0x36d8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x36d8('0xf'));var hardwareService=require(_0x36d8('0x10'));var logger=require(_0x36d8('0x11'))(_0x36d8('0x12'));var utils=require(_0x36d8('0x13'));var config=require('../../config/environment');var db=require(_0x36d8('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x36d8('0x15')][_0x36d8('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3180ce,_0x2485f7,_0x7747c9){if(_0x7747c9){var _0xa5a78d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa5a78d['test'](_0x2485f7)){return _0x3180ce;}else{throw new db['Sequelize'][(_0x36d8('0x17'))](_0x36d8('0x18'));}}else{return _0x3180ce;}}function respondWithRpcPromise(_0x1cc7f3,_0x4c7a74,_0x1ba0d2,_0x31263d){return new BPromise(function(_0x3bfe69,_0x22dfd9){var _0x49b9a6=_0x31263d||client;return _0x49b9a6[_0x36d8('0x19')](_0x1cc7f3,_0x1ba0d2)[_0x36d8('0x1a')](function(_0x58c4ba){logger['info'](_0x36d8('0x1b'),_0x4c7a74,_0x36d8('0x1c'));logger[_0x36d8('0x1d')](_0x36d8('0x1e'),_0x4c7a74,_0x36d8('0x1c'),JSON['stringify'](_0x58c4ba));if(_0x58c4ba['error']){if(_0x58c4ba[_0x36d8('0x1f')][_0x36d8('0x20')]===0x1f4){logger['error'](_0x36d8('0x1b'),_0x4c7a74,_0x58c4ba[_0x36d8('0x1f')][_0x36d8('0x21')]);return _0x22dfd9(_0x58c4ba[_0x36d8('0x1f')][_0x36d8('0x21')]);}logger[_0x36d8('0x1f')](_0x36d8('0x1b'),_0x4c7a74,_0x58c4ba['error'][_0x36d8('0x21')]);return _0x3bfe69(_0x58c4ba[_0x36d8('0x1f')][_0x36d8('0x21')]);}else{logger[_0x36d8('0x22')](_0x36d8('0x1b'),_0x4c7a74,_0x36d8('0x1c'));_0x3bfe69(_0x58c4ba['result'][_0x36d8('0x21')]);}})['catch'](function(_0x4d016a){logger[_0x36d8('0x1f')](_0x36d8('0x1b'),_0x4c7a74,_0x4d016a);_0x22dfd9(_0x4d016a);});});}function respondWithStatusCode(_0x576238,_0x446c63){_0x446c63=_0x446c63||0xcc;return function(_0x3bafc7){if(_0x3bafc7){return _0x576238[_0x36d8('0x23')](_0x446c63);}return _0x576238['status'](_0x446c63)[_0x36d8('0x24')]();};}function respondWithResult(_0x46fac9,_0x41c139){_0x41c139=_0x41c139||0xc8;return function(_0x5eec2c){if(_0x5eec2c){return _0x46fac9[_0x36d8('0x25')](_0x41c139)[_0x36d8('0x26')](_0x5eec2c);}};}function respondWithFilteredResult(_0xb20346,_0x4cbe38){return function(_0x3ec589){if(_0x3ec589){var _0x2ed05a=_0x3ec589['count'],_0x3e37a8=_0x4cbe38[_0x36d8('0x27')],_0x51face=_0x4cbe38[_0x36d8('0x27')]+_0x4cbe38[_0x36d8('0x28')],_0xe786ff;if(_0x51face>=_0x2ed05a){_0x51face=_0x2ed05a;_0xe786ff=0xc8;}else{_0xe786ff=0xce;}_0xb20346[_0x36d8('0x25')](_0xe786ff);return _0xb20346[_0x36d8('0x29')]('Content-Range',_0x3e37a8+'-'+_0x51face+'/'+_0x2ed05a)['json'](_0x3ec589);}return null;};}function patchUpdates(_0x4c55be){return function(_0x21e44f){try{jsonpatch[_0x36d8('0x2a')](_0x21e44f,_0x4c55be,!![]);}catch(_0x50d6b8){return BPromise[_0x36d8('0x2b')](_0x50d6b8);}return _0x21e44f[_0x36d8('0x2c')]();};}function saveUpdates(_0x144a23,_0x1f3031){return function(_0x170b06){if(_0x170b06){return _0x170b06[_0x36d8('0x2d')](_0x144a23)[_0x36d8('0x1a')](function(_0x20e032){return _0x20e032;});}return null;};}function removeEntity(_0x21fb0a,_0x1b564e){return function(_0x1c42c3){if(_0x1c42c3){return _0x1c42c3[_0x36d8('0x2e')]()[_0x36d8('0x1a')](function(){_0x21fb0a[_0x36d8('0x25')](0xcc)[_0x36d8('0x24')]();});}};}function handleEntityNotFound(_0x582c7d,_0x3e8735){return function(_0x4566e8){if(!_0x4566e8){_0x582c7d[_0x36d8('0x23')](0x194);}return _0x4566e8;};}function handleError(_0x2b5c48,_0x119314){_0x119314=_0x119314||0x1f4;return function(_0x4134e4){logger['error'](_0x4134e4[_0x36d8('0x2f')]);if(_0x4134e4[_0x36d8('0x30')]){delete _0x4134e4[_0x36d8('0x30')];}_0x2b5c48[_0x36d8('0x25')](_0x119314)[_0x36d8('0x31')](_0x4134e4);};}exports[_0x36d8('0x32')]=function(_0x1cdff7,_0x2c69ec){var _0x1864d6={},_0x643039={},_0x53cb40={'count':0x0,'rows':[]};var _0x335702=_[_0x36d8('0x33')](db[_0x36d8('0x34')][_0x36d8('0x35')],function(_0x1f778a){return{'name':_0x1f778a[_0x36d8('0x36')],'type':_0x1f778a[_0x36d8('0x37')]['key']};});_0x643039[_0x36d8('0x38')]=_[_0x36d8('0x33')](_0x335702,_0x36d8('0x30'));_0x643039[_0x36d8('0x39')]=_['keys'](_0x1cdff7[_0x36d8('0x39')]);_0x643039['filters']=_[_0x36d8('0x3a')](_0x643039[_0x36d8('0x38')],_0x643039[_0x36d8('0x39')]);_0x1864d6['attributes']=_[_0x36d8('0x3a')](_0x643039[_0x36d8('0x38')],qs[_0x36d8('0x3b')](_0x1cdff7[_0x36d8('0x39')][_0x36d8('0x3b')]));_0x1864d6[_0x36d8('0x3c')]=_0x1864d6[_0x36d8('0x3c')][_0x36d8('0x3d')]?_0x1864d6['attributes']:_0x643039[_0x36d8('0x38')];if(!_0x1cdff7[_0x36d8('0x39')]['hasOwnProperty']('nolimit')){_0x1864d6[_0x36d8('0x28')]=qs[_0x36d8('0x28')](_0x1cdff7[_0x36d8('0x39')][_0x36d8('0x28')]);_0x1864d6[_0x36d8('0x27')]=qs[_0x36d8('0x27')](_0x1cdff7[_0x36d8('0x39')][_0x36d8('0x27')]);}_0x1864d6[_0x36d8('0x3e')]=qs['sort'](_0x1cdff7[_0x36d8('0x39')][_0x36d8('0x3f')]);_0x1864d6[_0x36d8('0x40')]=qs[_0x36d8('0x41')](_[_0x36d8('0x42')](_0x1cdff7[_0x36d8('0x39')],_0x643039[_0x36d8('0x41')]),_0x335702);if(_0x1cdff7[_0x36d8('0x39')]['filter']){_0x1864d6['where']=_[_0x36d8('0x43')](_0x1864d6[_0x36d8('0x40')],{'$or':_[_0x36d8('0x33')](_0x335702,function(_0x42caed){if(_0x42caed[_0x36d8('0x37')]!=='VIRTUAL'){var _0x18c432={};_0x18c432[_0x42caed[_0x36d8('0x30')]]={'$like':'%'+_0x1cdff7[_0x36d8('0x39')][_0x36d8('0x44')]+'%'};return _0x18c432;}})});}_0x1864d6=_['merge']({},_0x1864d6,_0x1cdff7['options']);var _0x8e4c9={'where':_0x1864d6[_0x36d8('0x40')]};return db[_0x36d8('0x34')][_0x36d8('0x45')](_0x8e4c9)[_0x36d8('0x1a')](function(_0x2435ec){_0x53cb40[_0x36d8('0x45')]=_0x2435ec;if(_0x1cdff7[_0x36d8('0x39')][_0x36d8('0x46')]){_0x1864d6[_0x36d8('0x47')]=[{'all':!![]}];}return db[_0x36d8('0x34')]['findAll'](_0x1864d6);})[_0x36d8('0x1a')](function(_0x58bb1a){_0x53cb40[_0x36d8('0x48')]=_0x58bb1a;return _0x53cb40;})['then'](respondWithFilteredResult(_0x2c69ec,_0x1864d6))[_0x36d8('0x49')](handleError(_0x2c69ec,null));};exports[_0x36d8('0x4a')]=function(_0x5acadc,_0x51ae5d){var _0x178d33={'raw':![],'where':{'id':_0x5acadc[_0x36d8('0x4b')]['id']}},_0x120cd1={};_0x120cd1[_0x36d8('0x38')]=_[_0x36d8('0x4c')](db[_0x36d8('0x34')][_0x36d8('0x35')]);_0x120cd1[_0x36d8('0x39')]=_[_0x36d8('0x4c')](_0x5acadc[_0x36d8('0x39')]);_0x120cd1[_0x36d8('0x41')]=_[_0x36d8('0x3a')](_0x120cd1[_0x36d8('0x38')],_0x120cd1[_0x36d8('0x39')]);_0x178d33[_0x36d8('0x3c')]=_[_0x36d8('0x3a')](_0x120cd1[_0x36d8('0x38')],qs[_0x36d8('0x3b')](_0x5acadc[_0x36d8('0x39')][_0x36d8('0x3b')]));_0x178d33[_0x36d8('0x3c')]=_0x178d33[_0x36d8('0x3c')][_0x36d8('0x3d')]?_0x178d33[_0x36d8('0x3c')]:_0x120cd1[_0x36d8('0x38')];if(_0x5acadc[_0x36d8('0x39')][_0x36d8('0x46')]){_0x178d33[_0x36d8('0x47')]=[{'all':!![]}];}_0x178d33=_[_0x36d8('0x43')]({},_0x178d33,_0x5acadc['options']);return db[_0x36d8('0x34')][_0x36d8('0x4d')](_0x178d33)['then'](handleEntityNotFound(_0x51ae5d,null))[_0x36d8('0x1a')](respondWithResult(_0x51ae5d,null))[_0x36d8('0x49')](handleError(_0x51ae5d,null));};exports[_0x36d8('0x4e')]=function(_0x3f3f8b,_0x237dee){return db[_0x36d8('0x34')][_0x36d8('0x4e')](_0x3f3f8b[_0x36d8('0x4f')],{})[_0x36d8('0x1a')](respondWithResult(_0x237dee,0xc9))['catch'](handleError(_0x237dee,null));};exports[_0x36d8('0x2d')]=function(_0x2687b5,_0x5956e3){if(_0x2687b5[_0x36d8('0x4f')]['id']){delete _0x2687b5[_0x36d8('0x4f')]['id'];}return db['ZendeskConfiguration'][_0x36d8('0x4d')]({'where':{'id':_0x2687b5[_0x36d8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5956e3,null))[_0x36d8('0x1a')](saveUpdates(_0x2687b5[_0x36d8('0x4f')],null))[_0x36d8('0x1a')](respondWithResult(_0x5956e3,null))['catch'](handleError(_0x5956e3,null));};exports['destroy']=function(_0x4d0cf6,_0x4086ce){return db[_0x36d8('0x34')][_0x36d8('0x4d')]({'where':{'id':_0x4d0cf6[_0x36d8('0x4b')]['id']}})[_0x36d8('0x1a')](handleEntityNotFound(_0x4086ce,null))[_0x36d8('0x1a')](removeEntity(_0x4086ce,null))[_0x36d8('0x49')](handleError(_0x4086ce,null));};exports[_0x36d8('0x50')]=function(_0x24e357,_0xb9c1c7,_0x5426a5){var _0x39f77a={};var _0x8795e9={};var _0x2fb805;var _0x44dce2;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x24e357[_0x36d8('0x4b')]['id']}})[_0x36d8('0x1a')](handleEntityNotFound(_0xb9c1c7,null))[_0x36d8('0x1a')](function(_0xd4088){if(_0xd4088){_0x2fb805=_0xd4088;_0x8795e9[_0x36d8('0x38')]=_['keys'](db[_0x36d8('0x51')]['rawAttributes']);_0x8795e9[_0x36d8('0x39')]=_['keys'](_0x24e357['query']);_0x8795e9[_0x36d8('0x41')]=_[_0x36d8('0x3a')](_0x8795e9[_0x36d8('0x38')],_0x8795e9[_0x36d8('0x39')]);_0x39f77a[_0x36d8('0x3c')]=_[_0x36d8('0x3a')](_0x8795e9[_0x36d8('0x38')],qs[_0x36d8('0x3b')](_0x24e357[_0x36d8('0x39')][_0x36d8('0x3b')]));_0x39f77a[_0x36d8('0x3c')]=_0x39f77a[_0x36d8('0x3c')][_0x36d8('0x3d')]?_0x39f77a['attributes']:_0x8795e9[_0x36d8('0x38')];_0x39f77a[_0x36d8('0x3e')]=qs[_0x36d8('0x3f')](_0x24e357[_0x36d8('0x39')][_0x36d8('0x3f')]);_0x39f77a[_0x36d8('0x40')]=qs['filters'](_[_0x36d8('0x42')](_0x24e357[_0x36d8('0x39')],_0x8795e9['filters']));if(_0x24e357[_0x36d8('0x39')][_0x36d8('0x44')]){_0x39f77a[_0x36d8('0x40')]=_[_0x36d8('0x43')](_0x39f77a[_0x36d8('0x40')],{'$or':_[_0x36d8('0x33')](_0x39f77a[_0x36d8('0x3c')],function(_0x949565){var _0x3286b4={};_0x3286b4[_0x949565]={'$like':'%'+_0x24e357['query'][_0x36d8('0x44')]+'%'};return _0x3286b4;})});}_0x39f77a=_[_0x36d8('0x43')]({},_0x39f77a,_0x24e357[_0x36d8('0x52')]);return _0x2fb805[_0x36d8('0x50')](_0x39f77a);}})[_0x36d8('0x1a')](function(_0x2c3943){if(_0x2c3943){_0x44dce2=_0x2c3943[_0x36d8('0x3d')];if(!_0x24e357[_0x36d8('0x39')][_0x36d8('0x53')](_0x36d8('0x54'))){_0x39f77a['limit']=qs[_0x36d8('0x28')](_0x24e357[_0x36d8('0x39')][_0x36d8('0x28')]);_0x39f77a[_0x36d8('0x27')]=qs[_0x36d8('0x27')](_0x24e357['query'][_0x36d8('0x27')]);}return _0x2fb805[_0x36d8('0x50')](_0x39f77a);}})[_0x36d8('0x1a')](function(_0x728106){if(_0x728106){return _0x728106?{'count':_0x44dce2,'rows':_0x728106}:null;}})[_0x36d8('0x1a')](respondWithResult(_0xb9c1c7,null))[_0x36d8('0x49')](handleError(_0xb9c1c7,null));};exports[_0x36d8('0x55')]=function(_0x1f670f,_0xbe70f0,_0x16cd4e){var _0x4a33eb={};var _0x59f606={};var _0x3c6a73;var _0x15ae73;return db[_0x36d8('0x34')][_0x36d8('0x56')]({'where':{'id':_0x1f670f['params']['id']}})[_0x36d8('0x1a')](handleEntityNotFound(_0xbe70f0,null))['then'](function(_0x1908d2){if(_0x1908d2){_0x3c6a73=_0x1908d2;_0x59f606['model']=_[_0x36d8('0x4c')](db[_0x36d8('0x51')][_0x36d8('0x35')]);_0x59f606[_0x36d8('0x39')]=_[_0x36d8('0x4c')](_0x1f670f['query']);_0x59f606[_0x36d8('0x41')]=_[_0x36d8('0x3a')](_0x59f606[_0x36d8('0x38')],_0x59f606[_0x36d8('0x39')]);_0x4a33eb[_0x36d8('0x3c')]=_[_0x36d8('0x3a')](_0x59f606[_0x36d8('0x38')],qs['fields'](_0x1f670f[_0x36d8('0x39')]['fields']));_0x4a33eb['attributes']=_0x4a33eb[_0x36d8('0x3c')][_0x36d8('0x3d')]?_0x4a33eb[_0x36d8('0x3c')]:_0x59f606['model'];_0x4a33eb[_0x36d8('0x3e')]=qs[_0x36d8('0x3f')](_0x1f670f[_0x36d8('0x39')][_0x36d8('0x3f')]);_0x4a33eb[_0x36d8('0x40')]=qs[_0x36d8('0x41')](_['pick'](_0x1f670f['query'],_0x59f606[_0x36d8('0x41')]));if(_0x1f670f[_0x36d8('0x39')][_0x36d8('0x44')]){_0x4a33eb[_0x36d8('0x40')]=_[_0x36d8('0x43')](_0x4a33eb[_0x36d8('0x40')],{'$or':_[_0x36d8('0x33')](_0x4a33eb[_0x36d8('0x3c')],function(_0x143988){var _0x442c13={};_0x442c13[_0x143988]={'$like':'%'+_0x1f670f['query'][_0x36d8('0x44')]+'%'};return _0x442c13;})});}_0x4a33eb=_['merge']({},_0x4a33eb,_0x1f670f[_0x36d8('0x52')]);return _0x3c6a73[_0x36d8('0x55')](_0x4a33eb);}})['then'](function(_0x42e288){if(_0x42e288){_0x15ae73=_0x42e288[_0x36d8('0x3d')];if(!_0x1f670f[_0x36d8('0x39')]['hasOwnProperty'](_0x36d8('0x54'))){_0x4a33eb[_0x36d8('0x28')]=qs[_0x36d8('0x28')](_0x1f670f[_0x36d8('0x39')]['limit']);_0x4a33eb[_0x36d8('0x27')]=qs['offset'](_0x1f670f[_0x36d8('0x39')][_0x36d8('0x27')]);}return _0x3c6a73[_0x36d8('0x55')](_0x4a33eb);}})[_0x36d8('0x1a')](function(_0x576c3f){if(_0x576c3f){return _0x576c3f?{'count':_0x15ae73,'rows':_0x576c3f}:null;}})['then'](respondWithResult(_0xbe70f0,null))['catch'](handleError(_0xbe70f0,null));};exports[_0x36d8('0x57')]=function(_0x51d8d5,_0x57e9c1,_0x52a1dd){var _0x1d2036={};var _0x34ca40={};var _0x217f6d;var _0xec04a;return db['ZendeskConfiguration'][_0x36d8('0x56')]({'where':{'id':_0x51d8d5[_0x36d8('0x4b')]['id']}})[_0x36d8('0x1a')](handleEntityNotFound(_0x57e9c1,null))['then'](function(_0x5b550b){if(_0x5b550b){_0x217f6d=_0x5b550b;_0x34ca40['model']=_[_0x36d8('0x4c')](db[_0x36d8('0x51')][_0x36d8('0x35')]);_0x34ca40[_0x36d8('0x39')]=_[_0x36d8('0x4c')](_0x51d8d5['query']);_0x34ca40[_0x36d8('0x41')]=_[_0x36d8('0x3a')](_0x34ca40['model'],_0x34ca40[_0x36d8('0x39')]);_0x1d2036[_0x36d8('0x3c')]=_[_0x36d8('0x3a')](_0x34ca40[_0x36d8('0x38')],qs['fields'](_0x51d8d5[_0x36d8('0x39')][_0x36d8('0x3b')]));_0x1d2036[_0x36d8('0x3c')]=_0x1d2036['attributes'][_0x36d8('0x3d')]?_0x1d2036[_0x36d8('0x3c')]:_0x34ca40[_0x36d8('0x38')];_0x1d2036['order']=qs[_0x36d8('0x3f')](_0x51d8d5[_0x36d8('0x39')]['sort']);_0x1d2036[_0x36d8('0x40')]=qs['filters'](_[_0x36d8('0x42')](_0x51d8d5[_0x36d8('0x39')],_0x34ca40['filters']));if(_0x51d8d5[_0x36d8('0x39')][_0x36d8('0x44')]){_0x1d2036[_0x36d8('0x40')]=_[_0x36d8('0x43')](_0x1d2036[_0x36d8('0x40')],{'$or':_['map'](_0x1d2036[_0x36d8('0x3c')],function(_0x6f8b6d){var _0x2a454c={};_0x2a454c[_0x6f8b6d]={'$like':'%'+_0x51d8d5[_0x36d8('0x39')][_0x36d8('0x44')]+'%'};return _0x2a454c;})});}_0x1d2036=_[_0x36d8('0x43')]({},_0x1d2036,_0x51d8d5[_0x36d8('0x52')]);return _0x217f6d['getDescriptions'](_0x1d2036);}})[_0x36d8('0x1a')](function(_0x494575){if(_0x494575){_0xec04a=_0x494575[_0x36d8('0x3d')];if(!_0x51d8d5[_0x36d8('0x39')][_0x36d8('0x53')](_0x36d8('0x54'))){_0x1d2036[_0x36d8('0x28')]=qs[_0x36d8('0x28')](_0x51d8d5['query']['limit']);_0x1d2036[_0x36d8('0x27')]=qs[_0x36d8('0x27')](_0x51d8d5[_0x36d8('0x39')][_0x36d8('0x27')]);}return _0x217f6d[_0x36d8('0x57')](_0x1d2036);}})['then'](function(_0x3c295f){if(_0x3c295f){return _0x3c295f?{'count':_0xec04a,'rows':_0x3c295f}:null;}})[_0x36d8('0x1a')](respondWithResult(_0x57e9c1,null))[_0x36d8('0x49')](handleError(_0x57e9c1,null));};exports[_0x36d8('0x58')]=function(_0x27f918,_0x2cc146,_0x29d301){var _0x1d3dde={};var _0x5d736d={};var _0x545a5b;var _0x4e08a2;return db[_0x36d8('0x34')]['findOne']({'where':{'id':_0x27f918[_0x36d8('0x4b')]['id']}})[_0x36d8('0x1a')](handleEntityNotFound(_0x2cc146,null))[_0x36d8('0x1a')](function(_0x215a90){if(_0x215a90){_0x545a5b=_0x215a90;_0x5d736d[_0x36d8('0x38')]=_[_0x36d8('0x4c')](db[_0x36d8('0x59')][_0x36d8('0x35')]);_0x5d736d[_0x36d8('0x39')]=_[_0x36d8('0x4c')](_0x27f918['query']);_0x5d736d[_0x36d8('0x41')]=_[_0x36d8('0x3a')](_0x5d736d[_0x36d8('0x38')],_0x5d736d[_0x36d8('0x39')]);_0x1d3dde[_0x36d8('0x3c')]=_[_0x36d8('0x3a')](_0x5d736d['model'],qs['fields'](_0x27f918['query'][_0x36d8('0x3b')]));_0x1d3dde['attributes']=_0x1d3dde[_0x36d8('0x3c')][_0x36d8('0x3d')]?_0x1d3dde[_0x36d8('0x3c')]:_0x5d736d[_0x36d8('0x38')];_0x1d3dde[_0x36d8('0x3e')]=qs['sort'](_0x27f918['query'][_0x36d8('0x3f')]);_0x1d3dde[_0x36d8('0x40')]=qs[_0x36d8('0x41')](_[_0x36d8('0x42')](_0x27f918[_0x36d8('0x39')],_0x5d736d[_0x36d8('0x41')]));if(_0x27f918[_0x36d8('0x39')][_0x36d8('0x44')]){_0x1d3dde[_0x36d8('0x40')]=_[_0x36d8('0x43')](_0x1d3dde[_0x36d8('0x40')],{'$or':_[_0x36d8('0x33')](_0x1d3dde[_0x36d8('0x3c')],function(_0x495b1b){var _0x3b119e={};_0x3b119e[_0x495b1b]={'$like':'%'+_0x27f918[_0x36d8('0x39')][_0x36d8('0x44')]+'%'};return _0x3b119e;})});}_0x1d3dde=_['merge']({},_0x1d3dde,_0x27f918['options']);return _0x545a5b[_0x36d8('0x58')](_0x1d3dde);}})[_0x36d8('0x1a')](function(_0x57cfe7){if(_0x57cfe7){_0x4e08a2=_0x57cfe7[_0x36d8('0x3d')];if(!_0x27f918[_0x36d8('0x39')][_0x36d8('0x53')](_0x36d8('0x54'))){_0x1d3dde['limit']=qs[_0x36d8('0x28')](_0x27f918[_0x36d8('0x39')][_0x36d8('0x28')]);_0x1d3dde['offset']=qs[_0x36d8('0x27')](_0x27f918[_0x36d8('0x39')][_0x36d8('0x27')]);}return _0x545a5b['getTags'](_0x1d3dde);}})[_0x36d8('0x1a')](function(_0x124f88){if(_0x124f88){return _0x124f88?{'count':_0x4e08a2,'rows':_0x124f88}:null;}})[_0x36d8('0x1a')](respondWithResult(_0x2cc146,null))['catch'](handleError(_0x2cc146,null));};exports[_0x36d8('0x5a')]=function(_0x24f9b2,_0xd0086b,_0x20f009){if(_0x24f9b2['body']['id']){delete _0x24f9b2['body']['id'];}return db[_0x36d8('0x34')][_0x36d8('0x56')]({'where':{'id':_0x24f9b2[_0x36d8('0x4b')]['id']}})[_0x36d8('0x1a')](handleEntityNotFound(_0xd0086b,null))[_0x36d8('0x1a')](function(_0x1b89c6){if(_0x1b89c6){return _0x1b89c6[_0x36d8('0x5a')](_0x24f9b2['body'][_0x36d8('0x5b')]||[]);}return null;})[_0x36d8('0x1a')](respondWithResult(_0xd0086b,null))[_0x36d8('0x49')](handleError(_0xd0086b,null));}; \ No newline at end of file +var _0x5b80=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../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','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query','keys'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5b80,0xe4));var _0x05b8=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x5b80[_0x2df507];return _0x1f7167;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05b8('0x0'));var rimraf=require(_0x05b8('0x1'));var zipdir=require(_0x05b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05b8('0x3'));var moment=require('moment');var BPromise=require(_0x05b8('0x4'));var Mustache=require(_0x05b8('0x5'));var util=require(_0x05b8('0x6'));var path=require(_0x05b8('0x7'));var sox=require(_0x05b8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x05b8('0x9'));var crypto=require(_0x05b8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x05b8('0xb'));var toCsv=require(_0x05b8('0xc'));var querystring=require(_0x05b8('0xd'));var Papa=require(_0x05b8('0xe'));var Redis=require(_0x05b8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x05b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05b8('0x11'));var logger=require(_0x05b8('0x12'))('api');var utils=require(_0x05b8('0x13'));var config=require(_0x05b8('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x05b8('0x15'));var client=jayson[_0x05b8('0x16')][_0x05b8('0x17')]({'port':0x232a});function checkPasswordPattern(_0x44dadd,_0x1a8b02,_0x2e647f){if(_0x2e647f){var _0x26c528=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26c528[_0x05b8('0x18')](_0x1a8b02)){return _0x44dadd;}else{throw new db[(_0x05b8('0x19'))][(_0x05b8('0x1a'))](_0x05b8('0x1b'));}}else{return _0x44dadd;}}function respondWithRpcPromise(_0x5b9183,_0x2493b6,_0x406b4f,_0x3d7bda){return new BPromise(function(_0x23fd11,_0x1c80e6){var _0x4ad1c9=_0x3d7bda||client;return _0x4ad1c9[_0x05b8('0x1c')](_0x5b9183,_0x406b4f)[_0x05b8('0x1d')](function(_0x210f30){logger[_0x05b8('0x1e')](_0x05b8('0x1f'),_0x2493b6,_0x05b8('0x20'));logger[_0x05b8('0x21')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2493b6,'request\x20sent',JSON[_0x05b8('0x22')](_0x210f30));if(_0x210f30['error']){if(_0x210f30[_0x05b8('0x23')]['code']===0x1f4){logger['error'](_0x05b8('0x1f'),_0x2493b6,_0x210f30['error']['message']);return _0x1c80e6(_0x210f30[_0x05b8('0x23')][_0x05b8('0x24')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2493b6,_0x210f30['error'][_0x05b8('0x24')]);return _0x23fd11(_0x210f30['error'][_0x05b8('0x24')]);}else{logger[_0x05b8('0x1e')](_0x05b8('0x1f'),_0x2493b6,_0x05b8('0x20'));_0x23fd11(_0x210f30[_0x05b8('0x25')]['message']);}})['catch'](function(_0x4f7000){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2493b6,_0x4f7000);_0x1c80e6(_0x4f7000);});});}function respondWithStatusCode(_0x1cc74b,_0x54d3f7){_0x54d3f7=_0x54d3f7||0xcc;return function(_0x12ebfc){if(_0x12ebfc){return _0x1cc74b[_0x05b8('0x26')](_0x54d3f7);}return _0x1cc74b[_0x05b8('0x27')](_0x54d3f7)[_0x05b8('0x28')]();};}function respondWithResult(_0x41352b,_0x17490b){_0x17490b=_0x17490b||0xc8;return function(_0x54976){if(_0x54976){return _0x41352b[_0x05b8('0x27')](_0x17490b)[_0x05b8('0x29')](_0x54976);}};}function respondWithFilteredResult(_0x12acad,_0x214017){return function(_0x12339e){if(_0x12339e){var _0x5545bc=_0x12339e[_0x05b8('0x2a')],_0x57af87=_0x214017[_0x05b8('0x2b')],_0x394fd3=_0x214017['offset']+_0x214017[_0x05b8('0x2c')],_0x494c42;if(_0x394fd3>=_0x5545bc){_0x394fd3=_0x5545bc;_0x494c42=0xc8;}else{_0x494c42=0xce;}_0x12acad[_0x05b8('0x27')](_0x494c42);return _0x12acad[_0x05b8('0x2d')](_0x05b8('0x2e'),_0x57af87+'-'+_0x394fd3+'/'+_0x5545bc)[_0x05b8('0x29')](_0x12339e);}return null;};}function patchUpdates(_0x54854c){return function(_0x1e538e){try{jsonpatch['apply'](_0x1e538e,_0x54854c,!![]);}catch(_0x4c9c82){return BPromise[_0x05b8('0x2f')](_0x4c9c82);}return _0x1e538e[_0x05b8('0x30')]();};}function saveUpdates(_0x2c690a,_0x1fd10f){return function(_0x3872dc){if(_0x3872dc){return _0x3872dc[_0x05b8('0x31')](_0x2c690a)['then'](function(_0xe0d61c){return _0xe0d61c;});}return null;};}function removeEntity(_0x1df6ec,_0x444efc){return function(_0x58dc75){if(_0x58dc75){return _0x58dc75[_0x05b8('0x32')]()[_0x05b8('0x1d')](function(){_0x1df6ec[_0x05b8('0x27')](0xcc)[_0x05b8('0x28')]();});}};}function handleEntityNotFound(_0x466c5b,_0xa9c521){return function(_0x5b3214){if(!_0x5b3214){_0x466c5b['sendStatus'](0x194);}return _0x5b3214;};}function handleError(_0x53d58b,_0x23cf1c){_0x23cf1c=_0x23cf1c||0x1f4;return function(_0x74ca3d){logger[_0x05b8('0x23')](_0x74ca3d[_0x05b8('0x33')]);if(_0x74ca3d['name']){delete _0x74ca3d[_0x05b8('0x34')];}_0x53d58b[_0x05b8('0x27')](_0x23cf1c)[_0x05b8('0x35')](_0x74ca3d);};}exports[_0x05b8('0x36')]=function(_0x1543ab,_0x1b63b6){var _0x3089d1={},_0x4e478a={},_0x5e81be={'count':0x0,'rows':[]};var _0x2500ae=_['map'](db[_0x05b8('0x37')]['rawAttributes'],function(_0xe251b4){return{'name':_0xe251b4[_0x05b8('0x38')],'type':_0xe251b4[_0x05b8('0x39')][_0x05b8('0x3a')]};});_0x4e478a[_0x05b8('0x3b')]=_[_0x05b8('0x3c')](_0x2500ae,'name');_0x4e478a[_0x05b8('0x3d')]=_[_0x05b8('0x3e')](_0x1543ab[_0x05b8('0x3d')]);_0x4e478a[_0x05b8('0x3f')]=_['intersection'](_0x4e478a['model'],_0x4e478a[_0x05b8('0x3d')]);_0x3089d1['attributes']=_[_0x05b8('0x40')](_0x4e478a[_0x05b8('0x3b')],qs[_0x05b8('0x41')](_0x1543ab['query'][_0x05b8('0x41')]));_0x3089d1[_0x05b8('0x42')]=_0x3089d1[_0x05b8('0x42')][_0x05b8('0x43')]?_0x3089d1['attributes']:_0x4e478a[_0x05b8('0x3b')];if(!_0x1543ab[_0x05b8('0x3d')][_0x05b8('0x44')](_0x05b8('0x45'))){_0x3089d1[_0x05b8('0x2c')]=qs[_0x05b8('0x2c')](_0x1543ab['query'][_0x05b8('0x2c')]);_0x3089d1[_0x05b8('0x2b')]=qs[_0x05b8('0x2b')](_0x1543ab[_0x05b8('0x3d')][_0x05b8('0x2b')]);}_0x3089d1[_0x05b8('0x46')]=qs[_0x05b8('0x47')](_0x1543ab['query']['sort']);_0x3089d1[_0x05b8('0x48')]=qs[_0x05b8('0x3f')](_[_0x05b8('0x49')](_0x1543ab['query'],_0x4e478a['filters']),_0x2500ae);if(_0x1543ab[_0x05b8('0x3d')][_0x05b8('0x4a')]){_0x3089d1[_0x05b8('0x48')]=_[_0x05b8('0x4b')](_0x3089d1[_0x05b8('0x48')],{'$or':_[_0x05b8('0x3c')](_0x2500ae,function(_0x1ebc37){if(_0x1ebc37[_0x05b8('0x39')]!==_0x05b8('0x4c')){var _0x14c05a={};_0x14c05a[_0x1ebc37['name']]={'$like':'%'+_0x1543ab[_0x05b8('0x3d')][_0x05b8('0x4a')]+'%'};return _0x14c05a;}})});}_0x3089d1=_[_0x05b8('0x4b')]({},_0x3089d1,_0x1543ab[_0x05b8('0x4d')]);var _0x2280d2={'where':_0x3089d1[_0x05b8('0x48')]};return db['ZendeskConfiguration'][_0x05b8('0x2a')](_0x2280d2)[_0x05b8('0x1d')](function(_0x3e1a97){_0x5e81be['count']=_0x3e1a97;if(_0x1543ab[_0x05b8('0x3d')]['includeAll']){_0x3089d1['include']=[{'all':!![]}];}return db[_0x05b8('0x37')][_0x05b8('0x4e')](_0x3089d1);})[_0x05b8('0x1d')](function(_0x26435d){_0x5e81be[_0x05b8('0x4f')]=_0x26435d;return _0x5e81be;})['then'](respondWithFilteredResult(_0x1b63b6,_0x3089d1))[_0x05b8('0x50')](handleError(_0x1b63b6,null));};exports[_0x05b8('0x51')]=function(_0x53c59f,_0x1f103a){var _0x19a81e={'raw':![],'where':{'id':_0x53c59f[_0x05b8('0x52')]['id']}},_0x25feda={};_0x25feda[_0x05b8('0x3b')]=_[_0x05b8('0x3e')](db['ZendeskConfiguration'][_0x05b8('0x53')]);_0x25feda['query']=_[_0x05b8('0x3e')](_0x53c59f[_0x05b8('0x3d')]);_0x25feda['filters']=_[_0x05b8('0x40')](_0x25feda[_0x05b8('0x3b')],_0x25feda[_0x05b8('0x3d')]);_0x19a81e[_0x05b8('0x42')]=_[_0x05b8('0x40')](_0x25feda['model'],qs[_0x05b8('0x41')](_0x53c59f[_0x05b8('0x3d')][_0x05b8('0x41')]));_0x19a81e[_0x05b8('0x42')]=_0x19a81e[_0x05b8('0x42')][_0x05b8('0x43')]?_0x19a81e[_0x05b8('0x42')]:_0x25feda['model'];if(_0x53c59f[_0x05b8('0x3d')][_0x05b8('0x54')]){_0x19a81e[_0x05b8('0x55')]=[{'all':!![]}];}_0x19a81e=_[_0x05b8('0x4b')]({},_0x19a81e,_0x53c59f['options']);return db['ZendeskConfiguration'][_0x05b8('0x56')](_0x19a81e)[_0x05b8('0x1d')](handleEntityNotFound(_0x1f103a,null))['then'](respondWithResult(_0x1f103a,null))[_0x05b8('0x50')](handleError(_0x1f103a,null));};exports[_0x05b8('0x57')]=function(_0x177a22,_0x3470df){return db[_0x05b8('0x37')][_0x05b8('0x57')](_0x177a22['body'],{})[_0x05b8('0x1d')](respondWithResult(_0x3470df,0xc9))[_0x05b8('0x50')](handleError(_0x3470df,null));};exports[_0x05b8('0x31')]=function(_0x27cf45,_0x3bdbce){if(_0x27cf45[_0x05b8('0x58')]['id']){delete _0x27cf45[_0x05b8('0x58')]['id'];}return db[_0x05b8('0x37')]['find']({'where':{'id':_0x27cf45['params']['id']}})[_0x05b8('0x1d')](handleEntityNotFound(_0x3bdbce,null))[_0x05b8('0x1d')](saveUpdates(_0x27cf45[_0x05b8('0x58')],null))[_0x05b8('0x1d')](respondWithResult(_0x3bdbce,null))[_0x05b8('0x50')](handleError(_0x3bdbce,null));};exports['destroy']=function(_0x5dda82,_0x27d64b){return db[_0x05b8('0x37')][_0x05b8('0x56')]({'where':{'id':_0x5dda82[_0x05b8('0x52')]['id']}})[_0x05b8('0x1d')](handleEntityNotFound(_0x27d64b,null))[_0x05b8('0x1d')](removeEntity(_0x27d64b,null))['catch'](handleError(_0x27d64b,null));};exports[_0x05b8('0x59')]=function(_0xb1fc0d,_0x1bfc24,_0x1845e1){var _0xc71cce={};var _0x35b404={};var _0x2e06b4;var _0x23dbfd;return db[_0x05b8('0x37')][_0x05b8('0x5a')]({'where':{'id':_0xb1fc0d['params']['id']}})['then'](handleEntityNotFound(_0x1bfc24,null))['then'](function(_0x1311d3){if(_0x1311d3){_0x2e06b4=_0x1311d3;_0x35b404[_0x05b8('0x3b')]=_[_0x05b8('0x3e')](db[_0x05b8('0x5b')][_0x05b8('0x53')]);_0x35b404[_0x05b8('0x3d')]=_['keys'](_0xb1fc0d[_0x05b8('0x3d')]);_0x35b404[_0x05b8('0x3f')]=_['intersection'](_0x35b404[_0x05b8('0x3b')],_0x35b404['query']);_0xc71cce[_0x05b8('0x42')]=_[_0x05b8('0x40')](_0x35b404[_0x05b8('0x3b')],qs['fields'](_0xb1fc0d[_0x05b8('0x3d')][_0x05b8('0x41')]));_0xc71cce[_0x05b8('0x42')]=_0xc71cce['attributes'][_0x05b8('0x43')]?_0xc71cce[_0x05b8('0x42')]:_0x35b404[_0x05b8('0x3b')];_0xc71cce['order']=qs[_0x05b8('0x47')](_0xb1fc0d[_0x05b8('0x3d')]['sort']);_0xc71cce[_0x05b8('0x48')]=qs[_0x05b8('0x3f')](_[_0x05b8('0x49')](_0xb1fc0d['query'],_0x35b404[_0x05b8('0x3f')]));if(_0xb1fc0d[_0x05b8('0x3d')]['filter']){_0xc71cce[_0x05b8('0x48')]=_[_0x05b8('0x4b')](_0xc71cce[_0x05b8('0x48')],{'$or':_['map'](_0xc71cce[_0x05b8('0x42')],function(_0x3c945b){var _0x31d8ae={};_0x31d8ae[_0x3c945b]={'$like':'%'+_0xb1fc0d['query']['filter']+'%'};return _0x31d8ae;})});}_0xc71cce=_[_0x05b8('0x4b')]({},_0xc71cce,_0xb1fc0d[_0x05b8('0x4d')]);return _0x2e06b4[_0x05b8('0x59')](_0xc71cce);}})[_0x05b8('0x1d')](function(_0x3f0534){if(_0x3f0534){_0x23dbfd=_0x3f0534[_0x05b8('0x43')];if(!_0xb1fc0d['query'][_0x05b8('0x44')](_0x05b8('0x45'))){_0xc71cce['limit']=qs[_0x05b8('0x2c')](_0xb1fc0d['query'][_0x05b8('0x2c')]);_0xc71cce[_0x05b8('0x2b')]=qs[_0x05b8('0x2b')](_0xb1fc0d[_0x05b8('0x3d')][_0x05b8('0x2b')]);}return _0x2e06b4[_0x05b8('0x59')](_0xc71cce);}})[_0x05b8('0x1d')](function(_0x17fb8c){if(_0x17fb8c){return _0x17fb8c?{'count':_0x23dbfd,'rows':_0x17fb8c}:null;}})[_0x05b8('0x1d')](respondWithResult(_0x1bfc24,null))[_0x05b8('0x50')](handleError(_0x1bfc24,null));};exports[_0x05b8('0x5c')]=function(_0x417a0e,_0x234e99,_0x19c279){var _0x7e58f4={};var _0xbfe5b2={};var _0x407267;var _0x38cd34;return db['ZendeskConfiguration'][_0x05b8('0x5a')]({'where':{'id':_0x417a0e[_0x05b8('0x52')]['id']}})[_0x05b8('0x1d')](handleEntityNotFound(_0x234e99,null))['then'](function(_0x3b970f){if(_0x3b970f){_0x407267=_0x3b970f;_0xbfe5b2[_0x05b8('0x3b')]=_[_0x05b8('0x3e')](db[_0x05b8('0x5b')][_0x05b8('0x53')]);_0xbfe5b2[_0x05b8('0x3d')]=_[_0x05b8('0x3e')](_0x417a0e[_0x05b8('0x3d')]);_0xbfe5b2[_0x05b8('0x3f')]=_['intersection'](_0xbfe5b2[_0x05b8('0x3b')],_0xbfe5b2[_0x05b8('0x3d')]);_0x7e58f4['attributes']=_[_0x05b8('0x40')](_0xbfe5b2[_0x05b8('0x3b')],qs[_0x05b8('0x41')](_0x417a0e[_0x05b8('0x3d')][_0x05b8('0x41')]));_0x7e58f4['attributes']=_0x7e58f4[_0x05b8('0x42')][_0x05b8('0x43')]?_0x7e58f4['attributes']:_0xbfe5b2[_0x05b8('0x3b')];_0x7e58f4[_0x05b8('0x46')]=qs[_0x05b8('0x47')](_0x417a0e[_0x05b8('0x3d')][_0x05b8('0x47')]);_0x7e58f4[_0x05b8('0x48')]=qs[_0x05b8('0x3f')](_[_0x05b8('0x49')](_0x417a0e[_0x05b8('0x3d')],_0xbfe5b2[_0x05b8('0x3f')]));if(_0x417a0e[_0x05b8('0x3d')]['filter']){_0x7e58f4['where']=_[_0x05b8('0x4b')](_0x7e58f4[_0x05b8('0x48')],{'$or':_[_0x05b8('0x3c')](_0x7e58f4[_0x05b8('0x42')],function(_0x59fcf7){var _0x5308a5={};_0x5308a5[_0x59fcf7]={'$like':'%'+_0x417a0e['query'][_0x05b8('0x4a')]+'%'};return _0x5308a5;})});}_0x7e58f4=_[_0x05b8('0x4b')]({},_0x7e58f4,_0x417a0e[_0x05b8('0x4d')]);return _0x407267['getSubjects'](_0x7e58f4);}})[_0x05b8('0x1d')](function(_0x195895){if(_0x195895){_0x38cd34=_0x195895[_0x05b8('0x43')];if(!_0x417a0e[_0x05b8('0x3d')][_0x05b8('0x44')](_0x05b8('0x45'))){_0x7e58f4[_0x05b8('0x2c')]=qs[_0x05b8('0x2c')](_0x417a0e['query'][_0x05b8('0x2c')]);_0x7e58f4[_0x05b8('0x2b')]=qs[_0x05b8('0x2b')](_0x417a0e[_0x05b8('0x3d')][_0x05b8('0x2b')]);}return _0x407267[_0x05b8('0x5c')](_0x7e58f4);}})[_0x05b8('0x1d')](function(_0xadbf70){if(_0xadbf70){return _0xadbf70?{'count':_0x38cd34,'rows':_0xadbf70}:null;}})[_0x05b8('0x1d')](respondWithResult(_0x234e99,null))[_0x05b8('0x50')](handleError(_0x234e99,null));};exports[_0x05b8('0x5d')]=function(_0x5276ba,_0x49f7ab,_0x241f17){var _0x5bd257={};var _0x40ef77={};var _0x3deab0;var _0x4a6484;return db[_0x05b8('0x37')][_0x05b8('0x5a')]({'where':{'id':_0x5276ba[_0x05b8('0x52')]['id']}})['then'](handleEntityNotFound(_0x49f7ab,null))['then'](function(_0x2b3afc){if(_0x2b3afc){_0x3deab0=_0x2b3afc;_0x40ef77[_0x05b8('0x3b')]=_[_0x05b8('0x3e')](db['ZendeskField'][_0x05b8('0x53')]);_0x40ef77['query']=_['keys'](_0x5276ba['query']);_0x40ef77[_0x05b8('0x3f')]=_[_0x05b8('0x40')](_0x40ef77[_0x05b8('0x3b')],_0x40ef77[_0x05b8('0x3d')]);_0x5bd257[_0x05b8('0x42')]=_[_0x05b8('0x40')](_0x40ef77[_0x05b8('0x3b')],qs[_0x05b8('0x41')](_0x5276ba['query'][_0x05b8('0x41')]));_0x5bd257[_0x05b8('0x42')]=_0x5bd257[_0x05b8('0x42')][_0x05b8('0x43')]?_0x5bd257[_0x05b8('0x42')]:_0x40ef77['model'];_0x5bd257[_0x05b8('0x46')]=qs['sort'](_0x5276ba[_0x05b8('0x3d')][_0x05b8('0x47')]);_0x5bd257[_0x05b8('0x48')]=qs[_0x05b8('0x3f')](_[_0x05b8('0x49')](_0x5276ba[_0x05b8('0x3d')],_0x40ef77[_0x05b8('0x3f')]));if(_0x5276ba[_0x05b8('0x3d')][_0x05b8('0x4a')]){_0x5bd257[_0x05b8('0x48')]=_[_0x05b8('0x4b')](_0x5bd257[_0x05b8('0x48')],{'$or':_[_0x05b8('0x3c')](_0x5bd257[_0x05b8('0x42')],function(_0x5155ca){var _0x464dd5={};_0x464dd5[_0x5155ca]={'$like':'%'+_0x5276ba[_0x05b8('0x3d')]['filter']+'%'};return _0x464dd5;})});}_0x5bd257=_[_0x05b8('0x4b')]({},_0x5bd257,_0x5276ba[_0x05b8('0x4d')]);return _0x3deab0[_0x05b8('0x5d')](_0x5bd257);}})[_0x05b8('0x1d')](function(_0x1004a9){if(_0x1004a9){_0x4a6484=_0x1004a9['length'];if(!_0x5276ba[_0x05b8('0x3d')][_0x05b8('0x44')]('nolimit')){_0x5bd257[_0x05b8('0x2c')]=qs[_0x05b8('0x2c')](_0x5276ba[_0x05b8('0x3d')][_0x05b8('0x2c')]);_0x5bd257[_0x05b8('0x2b')]=qs[_0x05b8('0x2b')](_0x5276ba[_0x05b8('0x3d')]['offset']);}return _0x3deab0[_0x05b8('0x5d')](_0x5bd257);}})['then'](function(_0x2cc3fd){if(_0x2cc3fd){return _0x2cc3fd?{'count':_0x4a6484,'rows':_0x2cc3fd}:null;}})[_0x05b8('0x1d')](respondWithResult(_0x49f7ab,null))['catch'](handleError(_0x49f7ab,null));};exports[_0x05b8('0x5e')]=function(_0x47c1b0,_0x6c3afb,_0x2ace68){var _0x1c1365={};var _0x1185bc={};var _0x2ce27e;var _0x2b3fc9;return db['ZendeskConfiguration'][_0x05b8('0x5a')]({'where':{'id':_0x47c1b0[_0x05b8('0x52')]['id']}})[_0x05b8('0x1d')](handleEntityNotFound(_0x6c3afb,null))[_0x05b8('0x1d')](function(_0x98f07d){if(_0x98f07d){_0x2ce27e=_0x98f07d;_0x1185bc[_0x05b8('0x3b')]=_[_0x05b8('0x3e')](db[_0x05b8('0x5f')][_0x05b8('0x53')]);_0x1185bc[_0x05b8('0x3d')]=_[_0x05b8('0x3e')](_0x47c1b0[_0x05b8('0x3d')]);_0x1185bc['filters']=_[_0x05b8('0x40')](_0x1185bc[_0x05b8('0x3b')],_0x1185bc[_0x05b8('0x3d')]);_0x1c1365[_0x05b8('0x42')]=_[_0x05b8('0x40')](_0x1185bc[_0x05b8('0x3b')],qs['fields'](_0x47c1b0['query'][_0x05b8('0x41')]));_0x1c1365[_0x05b8('0x42')]=_0x1c1365['attributes'][_0x05b8('0x43')]?_0x1c1365['attributes']:_0x1185bc[_0x05b8('0x3b')];_0x1c1365[_0x05b8('0x46')]=qs[_0x05b8('0x47')](_0x47c1b0[_0x05b8('0x3d')][_0x05b8('0x47')]);_0x1c1365['where']=qs[_0x05b8('0x3f')](_[_0x05b8('0x49')](_0x47c1b0[_0x05b8('0x3d')],_0x1185bc[_0x05b8('0x3f')]));if(_0x47c1b0[_0x05b8('0x3d')][_0x05b8('0x4a')]){_0x1c1365['where']=_[_0x05b8('0x4b')](_0x1c1365[_0x05b8('0x48')],{'$or':_['map'](_0x1c1365[_0x05b8('0x42')],function(_0x2423ec){var _0x28f35d={};_0x28f35d[_0x2423ec]={'$like':'%'+_0x47c1b0[_0x05b8('0x3d')]['filter']+'%'};return _0x28f35d;})});}_0x1c1365=_[_0x05b8('0x4b')]({},_0x1c1365,_0x47c1b0[_0x05b8('0x4d')]);return _0x2ce27e[_0x05b8('0x5e')](_0x1c1365);}})[_0x05b8('0x1d')](function(_0x64f8c4){if(_0x64f8c4){_0x2b3fc9=_0x64f8c4[_0x05b8('0x43')];if(!_0x47c1b0[_0x05b8('0x3d')]['hasOwnProperty'](_0x05b8('0x45'))){_0x1c1365[_0x05b8('0x2c')]=qs[_0x05b8('0x2c')](_0x47c1b0['query'][_0x05b8('0x2c')]);_0x1c1365['offset']=qs[_0x05b8('0x2b')](_0x47c1b0[_0x05b8('0x3d')][_0x05b8('0x2b')]);}return _0x2ce27e['getTags'](_0x1c1365);}})[_0x05b8('0x1d')](function(_0x58b8e6){if(_0x58b8e6){return _0x58b8e6?{'count':_0x2b3fc9,'rows':_0x58b8e6}:null;}})[_0x05b8('0x1d')](respondWithResult(_0x6c3afb,null))[_0x05b8('0x50')](handleError(_0x6c3afb,null));};exports['setTags']=function(_0x1333e6,_0x52af40,_0x43b57a){if(_0x1333e6[_0x05b8('0x58')]['id']){delete _0x1333e6[_0x05b8('0x58')]['id'];}return db[_0x05b8('0x37')][_0x05b8('0x5a')]({'where':{'id':_0x1333e6[_0x05b8('0x52')]['id']}})['then'](handleEntityNotFound(_0x52af40,null))[_0x05b8('0x1d')](function(_0x3b5e09){if(_0x3b5e09){return _0x3b5e09['setTags'](_0x1333e6[_0x05b8('0x58')][_0x05b8('0x60')]||[]);}return null;})['then'](respondWithResult(_0x52af40,null))[_0x05b8('0x50')](handleError(_0x52af40,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index fcd454a..fe26af5 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 _0x3aab=['lodash','util','moment','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3aab,0x64));var _0xb3aa=function(_0x314c02,_0x1ec6b4){_0x314c02=_0x314c02-0x0;var _0x1b1526=_0x3aab[_0x314c02];return _0x1b1526;};'use strict';var _=require(_0xb3aa('0x0'));var util=require(_0xb3aa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb3aa('0x2'));var BPromise=require('bluebird');var rp=require(_0xb3aa('0x3'));var fs=require('fs');var path=require(_0xb3aa('0x4'));var rimraf=require('rimraf');var config=require(_0xb3aa('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xb3aa('0x6')]=function(_0x52cea2,_0x279ac){return _0x52cea2[_0xb3aa('0x7')](_0xb3aa('0x8'),attributes,{'tableName':_0xb3aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x327f=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x327f,0x1cf));var _0xf327=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x327f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xf327('0x0'));var logger=require(_0xf327('0x1'))(_0xf327('0x2'));var moment=require(_0xf327('0x3'));var BPromise=require(_0xf327('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf327('0x5'));var rimraf=require(_0xf327('0x6'));var config=require(_0xf327('0x7'));var attributes=require(_0xf327('0x8'));module[_0xf327('0x9')]=function(_0x5efc03,_0x304a89){return _0x5efc03[_0xf327('0xa')](_0xf327('0xb'),attributes,{'tableName':_0xf327('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index b5c3c1a..19cc318 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 _0x0f50=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0xc2a56e,_0x3650fb){var _0x20c022=function(_0x2e23bf){while(--_0x2e23bf){_0xc2a56e['push'](_0xc2a56e['shift']());}};_0x20c022(++_0x3650fb);}(_0x0f50,0x16a));var _0x00f5=function(_0x5854fc,_0x3c2669){_0x5854fc=_0x5854fc-0x0;var _0x5c3488=_0x0f50[_0x5854fc];return _0x5c3488;};'use strict';var _=require(_0x00f5('0x0'));var util=require(_0x00f5('0x1'));var moment=require(_0x00f5('0x2'));var BPromise=require(_0x00f5('0x3'));var rs=require(_0x00f5('0x4'));var fs=require('fs');var Redis=require(_0x00f5('0x5'));var db=require(_0x00f5('0x6'))['db'];var utils=require(_0x00f5('0x7'));var logger=require(_0x00f5('0x8'))('rpc');var config=require(_0x00f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x00f5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d8166,_0xfb52a2,_0x5c3fc2){return new BPromise(function(_0x9fb682,_0x5bd893){return client[_0x00f5('0xb')](_0x3d8166,_0x5c3fc2)['then'](function(_0x332132){logger['info'](_0x00f5('0xc'),_0xfb52a2,_0x00f5('0xd'));logger[_0x00f5('0xe')](_0x00f5('0xf'),_0xfb52a2,_0x00f5('0xd'),JSON[_0x00f5('0x10')](_0x332132));if(_0x332132[_0x00f5('0x11')]){if(_0x332132[_0x00f5('0x11')][_0x00f5('0x12')]===0x1f4){logger[_0x00f5('0x11')](_0x00f5('0xc'),_0xfb52a2,_0x332132[_0x00f5('0x11')][_0x00f5('0x13')]);return _0x5bd893(_0x332132[_0x00f5('0x11')][_0x00f5('0x13')]);}logger['error'](_0x00f5('0xc'),_0xfb52a2,_0x332132[_0x00f5('0x11')][_0x00f5('0x13')]);return _0x9fb682(_0x332132[_0x00f5('0x11')][_0x00f5('0x13')]);}else{logger[_0x00f5('0x14')](_0x00f5('0xc'),_0xfb52a2,'request\x20sent');_0x9fb682(_0x332132[_0x00f5('0x15')][_0x00f5('0x13')]);}})['catch'](function(_0x5d7bf0){logger[_0x00f5('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0xfb52a2,_0x5d7bf0);_0x5bd893(_0x5d7bf0);});});} \ No newline at end of file +var _0xe509=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x253cdb,_0x142a36){var _0x1ae7f4=function(_0x476a82){while(--_0x476a82){_0x253cdb['push'](_0x253cdb['shift']());}};_0x1ae7f4(++_0x142a36);}(_0xe509,0x1aa));var _0x9e50=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xe509[_0x120bc2];return _0x454a41;};'use strict';var _=require(_0x9e50('0x0'));var util=require(_0x9e50('0x1'));var moment=require(_0x9e50('0x2'));var BPromise=require(_0x9e50('0x3'));var rs=require(_0x9e50('0x4'));var fs=require('fs');var Redis=require(_0x9e50('0x5'));var db=require(_0x9e50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e50('0x7'))('rpc');var config=require(_0x9e50('0x8'));var jayson=require(_0x9e50('0x9'));var client=jayson[_0x9e50('0xa')][_0x9e50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53e59f,_0x461393,_0x177ff5){return new BPromise(function(_0x1ddd7e,_0x2bb70b){return client[_0x9e50('0xc')](_0x53e59f,_0x177ff5)[_0x9e50('0xd')](function(_0x425648){logger['info'](_0x9e50('0xe'),_0x461393,_0x9e50('0xf'));logger[_0x9e50('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x461393,_0x9e50('0xf'),JSON['stringify'](_0x425648));if(_0x425648['error']){if(_0x425648[_0x9e50('0x11')][_0x9e50('0x12')]===0x1f4){logger[_0x9e50('0x11')](_0x9e50('0xe'),_0x461393,_0x425648['error'][_0x9e50('0x13')]);return _0x2bb70b(_0x425648['error']['message']);}logger['error'](_0x9e50('0xe'),_0x461393,_0x425648[_0x9e50('0x11')][_0x9e50('0x13')]);return _0x1ddd7e(_0x425648['error'][_0x9e50('0x13')]);}else{logger['info'](_0x9e50('0xe'),_0x461393,_0x9e50('0xf'));_0x1ddd7e(_0x425648[_0x9e50('0x14')][_0x9e50('0x13')]);}})[_0x9e50('0x15')](function(_0xda6099){logger[_0x9e50('0x11')](_0x9e50('0xe'),_0x461393,_0xda6099);_0x2bb70b(_0xda6099);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 68976f4..47f0227 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 _0xca3d=['./intZendeskField.controller','index','get','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xca3d,0xa4));var _0xdca3=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0xca3d[_0x147c96];return _0x4ec711;};'use strict';var multer=require(_0xdca3('0x0'));var util=require(_0xdca3('0x1'));var path=require(_0xdca3('0x2'));var timeout=require(_0xdca3('0x3'));var express=require(_0xdca3('0x4'));var router=express[_0xdca3('0x5')]();var auth=require(_0xdca3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdca3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdca3('0x8')]);router[_0xdca3('0x9')](_0xdca3('0xa'),auth['isAuthenticated'](),controller[_0xdca3('0xb')]);router[_0xdca3('0xc')]('/',auth[_0xdca3('0xd')](),controller['create']);router[_0xdca3('0xe')](_0xdca3('0xa'),auth['isAuthenticated'](),controller[_0xdca3('0xf')]);router[_0xdca3('0x10')](_0xdca3('0xa'),auth[_0xdca3('0xd')](),controller[_0xdca3('0x11')]);module[_0xdca3('0x12')]=router; \ No newline at end of file +var _0x447e=['delete','exports','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x447e,0x10c));var _0xe447=function(_0x759990,_0x51c61f){_0x759990=_0x759990-0x0;var _0x3e8981=_0x447e[_0x759990];return _0x3e8981;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe447('0x0'));var timeout=require(_0xe447('0x1'));var express=require(_0xe447('0x2'));var router=express['Router']();var auth=require(_0xe447('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xe447('0x4')]('/',auth[_0xe447('0x5')](),controller[_0xe447('0x6')]);router[_0xe447('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xe447('0x7')]);router[_0xe447('0x8')]('/',auth[_0xe447('0x5')](),controller[_0xe447('0x9')]);router[_0xe447('0xa')](_0xe447('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe447('0xc')](_0xe447('0xb'),auth[_0xe447('0x5')](),controller['destroy']);module[_0xe447('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 059b9a1..1d0fd81 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 _0x27a8=['customVariable','keyValue','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x3de185,_0x39aa9f){var _0x3fba76=function(_0x471b0c){while(--_0x471b0c){_0x3de185['push'](_0x3de185['shift']());}};_0x3fba76(++_0x39aa9f);}(_0x27a8,0x170));var _0x827a=function(_0x54e167,_0x2fb491){_0x54e167=_0x54e167-0x0;var _0x2ffddd=_0x27a8[_0x54e167];return _0x2ffddd;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x827a('0x0')](_0x827a('0x1'),_0x827a('0x2'),_0x827a('0x3'),_0x827a('0x4')),'defaultValue':_0x827a('0x1')},'content':{'type':Sequelize[_0x827a('0x5')]},'key':{'type':Sequelize[_0x827a('0x5')]},'keyType':{'type':Sequelize[_0x827a('0x0')](_0x827a('0x1'),_0x827a('0x2'),_0x827a('0x3'))},'keyContent':{'type':Sequelize[_0x827a('0x5')]},'idField':{'type':Sequelize[_0x827a('0x5')]},'nameField':{'type':Sequelize[_0x827a('0x5')]},'customField':{'type':Sequelize[_0x827a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x827a('0x5')]}}; \ No newline at end of file +var _0x01e7=['sequelize','string','keyValue','STRING','ENUM','variable','customVariable'];(function(_0xb47e97,_0x1c9b7b){var _0x3dc310=function(_0x215d94){while(--_0x215d94){_0xb47e97['push'](_0xb47e97['shift']());}};_0x3dc310(++_0x1c9b7b);}(_0x01e7,0x134));var _0x701e=function(_0x1b30e0,_0x632b84){_0x1b30e0=_0x1b30e0-0x0;var _0x3d0c52=_0x01e7[_0x1b30e0];return _0x3d0c52;};'use strict';var Sequelize=require(_0x701e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x701e('0x1'),'variable','customVariable',_0x701e('0x2')),'defaultValue':_0x701e('0x1')},'content':{'type':Sequelize[_0x701e('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x701e('0x4')](_0x701e('0x1'),_0x701e('0x5'),_0x701e('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x701e('0x3')]},'nameField':{'type':Sequelize[_0x701e('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x701e('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8a78d78..7af2de5 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 _0x9f71=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','then','name','send','index','map','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','ZendeskField','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body'];(function(_0x4bbcc1,_0x594e19){var _0x34435b=function(_0x124582){while(--_0x124582){_0x4bbcc1['push'](_0x4bbcc1['shift']());}};_0x34435b(++_0x594e19);}(_0x9f71,0x118));var _0x19f7=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x9f71[_0x40bffc];return _0x3007e9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x19f7('0x0'));var jsonpatch=require(_0x19f7('0x1'));var rp=require(_0x19f7('0x2'));var moment=require('moment');var BPromise=require(_0x19f7('0x3'));var Mustache=require(_0x19f7('0x4'));var util=require(_0x19f7('0x5'));var path=require(_0x19f7('0x6'));var sox=require(_0x19f7('0x7'));var csv=require(_0x19f7('0x8'));var ejs=require(_0x19f7('0x9'));var fs=require('fs');var _=require(_0x19f7('0xa'));var squel=require(_0x19f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x19f7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x19f7('0x8'));var querystring=require(_0x19f7('0xd'));var Papa=require(_0x19f7('0xe'));var Redis=require(_0x19f7('0xf'));var authService=require(_0x19f7('0x10'));var qs=require(_0x19f7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19f7('0x12'));var logger=require(_0x19f7('0x13'))(_0x19f7('0x14'));var utils=require(_0x19f7('0x15'));var config=require('../../config/environment');var db=require(_0x19f7('0x16'))['db'];function respondWithStatusCode(_0x499137,_0x2d668a){_0x2d668a=_0x2d668a||0xcc;return function(_0x406b09){if(_0x406b09){return _0x499137[_0x19f7('0x17')](_0x2d668a);}return _0x499137[_0x19f7('0x18')](_0x2d668a)[_0x19f7('0x19')]();};}function respondWithResult(_0x415b46,_0x5f484a){_0x5f484a=_0x5f484a||0xc8;return function(_0x47e352){if(_0x47e352){return _0x415b46[_0x19f7('0x18')](_0x5f484a)[_0x19f7('0x1a')](_0x47e352);}};}function respondWithFilteredResult(_0x190ddb,_0x2ae189){return function(_0x95e8cd){if(_0x95e8cd){var _0x343f5a=_0x95e8cd[_0x19f7('0x1b')],_0x17f444=_0x2ae189[_0x19f7('0x1c')],_0x53e90c=_0x2ae189['offset']+_0x2ae189['limit'],_0xc56fb0;if(_0x53e90c>=_0x343f5a){_0x53e90c=_0x343f5a;_0xc56fb0=0xc8;}else{_0xc56fb0=0xce;}_0x190ddb[_0x19f7('0x18')](_0xc56fb0);return _0x190ddb['set'](_0x19f7('0x1d'),_0x17f444+'-'+_0x53e90c+'/'+_0x343f5a)[_0x19f7('0x1a')](_0x95e8cd);}return null;};}function patchUpdates(_0x18a63b){return function(_0x20e65e){try{jsonpatch[_0x19f7('0x1e')](_0x20e65e,_0x18a63b,!![]);}catch(_0x3cd37c){return BPromise['reject'](_0x3cd37c);}return _0x20e65e[_0x19f7('0x1f')]();};}function saveUpdates(_0xea1752,_0x570bc1){return function(_0x2c47aa){if(_0x2c47aa){return _0x2c47aa[_0x19f7('0x20')](_0xea1752)['then'](function(_0x2600b7){return _0x2600b7;});}return null;};}function removeEntity(_0x49bd91,_0x42e0c4){return function(_0x1f69af){if(_0x1f69af){return _0x1f69af[_0x19f7('0x21')]()[_0x19f7('0x22')](function(){_0x49bd91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x241ad5,_0x2e81d4){return function(_0x5dd8a8){if(!_0x5dd8a8){_0x241ad5[_0x19f7('0x17')](0x194);}return _0x5dd8a8;};}function handleError(_0x1505a4,_0x121f86){_0x121f86=_0x121f86||0x1f4;return function(_0x55d662){logger['error'](_0x55d662['stack']);if(_0x55d662[_0x19f7('0x23')]){delete _0x55d662[_0x19f7('0x23')];}_0x1505a4[_0x19f7('0x18')](_0x121f86)[_0x19f7('0x24')](_0x55d662);};}exports[_0x19f7('0x25')]=function(_0x46511d,_0x1b7e64){var _0x3f9742={},_0x39ae2f={},_0x5e9e95={'count':0x0,'rows':[]};var _0x14c0e8=_[_0x19f7('0x26')](db['ZendeskField']['rawAttributes'],function(_0x4b9164){return{'name':_0x4b9164['fieldName'],'type':_0x4b9164[_0x19f7('0x27')][_0x19f7('0x28')]};});_0x39ae2f['model']=_[_0x19f7('0x26')](_0x14c0e8,'name');_0x39ae2f[_0x19f7('0x29')]=_[_0x19f7('0x2a')](_0x46511d['query']);_0x39ae2f[_0x19f7('0x2b')]=_[_0x19f7('0x2c')](_0x39ae2f[_0x19f7('0x2d')],_0x39ae2f[_0x19f7('0x29')]);_0x3f9742['attributes']=_['intersection'](_0x39ae2f[_0x19f7('0x2d')],qs['fields'](_0x46511d['query'][_0x19f7('0x2e')]));_0x3f9742[_0x19f7('0x2f')]=_0x3f9742[_0x19f7('0x2f')]['length']?_0x3f9742[_0x19f7('0x2f')]:_0x39ae2f[_0x19f7('0x2d')];if(!_0x46511d[_0x19f7('0x29')][_0x19f7('0x30')]('nolimit')){_0x3f9742[_0x19f7('0x31')]=qs[_0x19f7('0x31')](_0x46511d[_0x19f7('0x29')][_0x19f7('0x31')]);_0x3f9742['offset']=qs[_0x19f7('0x1c')](_0x46511d[_0x19f7('0x29')][_0x19f7('0x1c')]);}_0x3f9742[_0x19f7('0x32')]=qs[_0x19f7('0x33')](_0x46511d[_0x19f7('0x29')][_0x19f7('0x33')]);_0x3f9742[_0x19f7('0x34')]=qs[_0x19f7('0x2b')](_[_0x19f7('0x35')](_0x46511d['query'],_0x39ae2f['filters']),_0x14c0e8);if(_0x46511d[_0x19f7('0x29')][_0x19f7('0x36')]){_0x3f9742[_0x19f7('0x34')]=_[_0x19f7('0x37')](_0x3f9742['where'],{'$or':_[_0x19f7('0x26')](_0x14c0e8,function(_0x13c5d8){if(_0x13c5d8[_0x19f7('0x27')]!=='VIRTUAL'){var _0x2743a0={};_0x2743a0[_0x13c5d8[_0x19f7('0x23')]]={'$like':'%'+_0x46511d['query'][_0x19f7('0x36')]+'%'};return _0x2743a0;}})});}_0x3f9742=_[_0x19f7('0x37')]({},_0x3f9742,_0x46511d[_0x19f7('0x38')]);var _0x3add3e={'where':_0x3f9742['where']};return db[_0x19f7('0x39')][_0x19f7('0x1b')](_0x3add3e)[_0x19f7('0x22')](function(_0x12fb16){_0x5e9e95[_0x19f7('0x1b')]=_0x12fb16;if(_0x46511d['query']['includeAll']){_0x3f9742[_0x19f7('0x3a')]=[{'all':!![]}];}return db[_0x19f7('0x39')][_0x19f7('0x3b')](_0x3f9742);})['then'](function(_0x13fc17){_0x5e9e95[_0x19f7('0x3c')]=_0x13fc17;return _0x5e9e95;})[_0x19f7('0x22')](respondWithFilteredResult(_0x1b7e64,_0x3f9742))[_0x19f7('0x3d')](handleError(_0x1b7e64,null));};exports[_0x19f7('0x3e')]=function(_0x1cb95d,_0x2a6a2a){var _0x46163f={'raw':!![],'where':{'id':_0x1cb95d[_0x19f7('0x3f')]['id']}},_0xb52b9f={};_0xb52b9f['model']=_['keys'](db[_0x19f7('0x39')][_0x19f7('0x40')]);_0xb52b9f[_0x19f7('0x29')]=_[_0x19f7('0x2a')](_0x1cb95d[_0x19f7('0x29')]);_0xb52b9f['filters']=_[_0x19f7('0x2c')](_0xb52b9f[_0x19f7('0x2d')],_0xb52b9f[_0x19f7('0x29')]);_0x46163f[_0x19f7('0x2f')]=_[_0x19f7('0x2c')](_0xb52b9f[_0x19f7('0x2d')],qs[_0x19f7('0x2e')](_0x1cb95d['query'][_0x19f7('0x2e')]));_0x46163f[_0x19f7('0x2f')]=_0x46163f[_0x19f7('0x2f')][_0x19f7('0x41')]?_0x46163f[_0x19f7('0x2f')]:_0xb52b9f[_0x19f7('0x2d')];if(_0x1cb95d[_0x19f7('0x29')][_0x19f7('0x42')]){_0x46163f['include']=[{'all':!![]}];}_0x46163f=_[_0x19f7('0x37')]({},_0x46163f,_0x1cb95d['options']);return db[_0x19f7('0x39')][_0x19f7('0x43')](_0x46163f)[_0x19f7('0x22')](handleEntityNotFound(_0x2a6a2a,null))[_0x19f7('0x22')](respondWithResult(_0x2a6a2a,null))[_0x19f7('0x3d')](handleError(_0x2a6a2a,null));};exports[_0x19f7('0x44')]=function(_0x2c842f,_0x18b490){return db['ZendeskField'][_0x19f7('0x44')](_0x2c842f[_0x19f7('0x45')],{})[_0x19f7('0x22')](respondWithResult(_0x18b490,0xc9))[_0x19f7('0x3d')](handleError(_0x18b490,null));};exports['update']=function(_0x39623b,_0x303333){if(_0x39623b[_0x19f7('0x45')]['id']){delete _0x39623b[_0x19f7('0x45')]['id'];}return db[_0x19f7('0x39')][_0x19f7('0x43')]({'where':{'id':_0x39623b[_0x19f7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x303333,null))[_0x19f7('0x22')](saveUpdates(_0x39623b[_0x19f7('0x45')],null))[_0x19f7('0x22')](respondWithResult(_0x303333,null))[_0x19f7('0x3d')](handleError(_0x303333,null));};exports[_0x19f7('0x21')]=function(_0x57da03,_0x3322bf){return db[_0x19f7('0x39')][_0x19f7('0x43')]({'where':{'id':_0x57da03[_0x19f7('0x3f')]['id']}})[_0x19f7('0x22')](handleEntityNotFound(_0x3322bf,null))[_0x19f7('0x22')](removeEntity(_0x3322bf,null))[_0x19f7('0x3d')](handleError(_0x3322bf,null));}; \ No newline at end of file +var _0x8d36=['options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include'];(function(_0xa239e0,_0x54a409){var _0x53fe61=function(_0x23ad38){while(--_0x23ad38){_0xa239e0['push'](_0xa239e0['shift']());}};_0x53fe61(++_0x54a409);}(_0x8d36,0x128));var _0x68d3=function(_0x50368e,_0x466c09){_0x50368e=_0x50368e-0x0;var _0x4a65cd=_0x8d36[_0x50368e];return _0x4a65cd;};'use strict';var pdf=require(_0x68d3('0x0'));var emlformat=require(_0x68d3('0x1'));var rimraf=require(_0x68d3('0x2'));var zipdir=require(_0x68d3('0x3'));var jsonpatch=require(_0x68d3('0x4'));var rp=require('request-promise');var moment=require(_0x68d3('0x5'));var BPromise=require(_0x68d3('0x6'));var Mustache=require(_0x68d3('0x7'));var util=require(_0x68d3('0x8'));var path=require(_0x68d3('0x9'));var sox=require(_0x68d3('0xa'));var csv=require(_0x68d3('0xb'));var ejs=require(_0x68d3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68d3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x68d3('0xb'));var querystring=require(_0x68d3('0xe'));var Papa=require(_0x68d3('0xf'));var Redis=require('ioredis');var authService=require(_0x68d3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68d3('0x11'));var logger=require(_0x68d3('0x12'))(_0x68d3('0x13'));var utils=require(_0x68d3('0x14'));var config=require(_0x68d3('0x15'));var db=require(_0x68d3('0x16'))['db'];function respondWithStatusCode(_0x25b799,_0x521cde){_0x521cde=_0x521cde||0xcc;return function(_0x9c9262){if(_0x9c9262){return _0x25b799[_0x68d3('0x17')](_0x521cde);}return _0x25b799[_0x68d3('0x18')](_0x521cde)[_0x68d3('0x19')]();};}function respondWithResult(_0x9bf694,_0x11894e){_0x11894e=_0x11894e||0xc8;return function(_0x5c08d2){if(_0x5c08d2){return _0x9bf694[_0x68d3('0x18')](_0x11894e)[_0x68d3('0x1a')](_0x5c08d2);}};}function respondWithFilteredResult(_0x45dc9f,_0x5e2464){return function(_0x54adac){if(_0x54adac){var _0x50eec1=_0x54adac['count'],_0x53fa71=_0x5e2464[_0x68d3('0x1b')],_0x464255=_0x5e2464['offset']+_0x5e2464[_0x68d3('0x1c')],_0x25a28e;if(_0x464255>=_0x50eec1){_0x464255=_0x50eec1;_0x25a28e=0xc8;}else{_0x25a28e=0xce;}_0x45dc9f[_0x68d3('0x18')](_0x25a28e);return _0x45dc9f[_0x68d3('0x1d')](_0x68d3('0x1e'),_0x53fa71+'-'+_0x464255+'/'+_0x50eec1)['json'](_0x54adac);}return null;};}function patchUpdates(_0x56ae69){return function(_0x403565){try{jsonpatch[_0x68d3('0x1f')](_0x403565,_0x56ae69,!![]);}catch(_0x4cec20){return BPromise['reject'](_0x4cec20);}return _0x403565[_0x68d3('0x20')]();};}function saveUpdates(_0x5e77ed,_0x3f368b){return function(_0x5e6560){if(_0x5e6560){return _0x5e6560[_0x68d3('0x21')](_0x5e77ed)[_0x68d3('0x22')](function(_0x1f5032){return _0x1f5032;});}return null;};}function removeEntity(_0x32671f,_0x2f8b7f){return function(_0x34d5e3){if(_0x34d5e3){return _0x34d5e3[_0x68d3('0x23')]()[_0x68d3('0x22')](function(){_0x32671f[_0x68d3('0x18')](0xcc)[_0x68d3('0x19')]();});}};}function handleEntityNotFound(_0x4e349b,_0x5c5261){return function(_0x4716a1){if(!_0x4716a1){_0x4e349b['sendStatus'](0x194);}return _0x4716a1;};}function handleError(_0x43d031,_0x11de5a){_0x11de5a=_0x11de5a||0x1f4;return function(_0x4b518f){logger[_0x68d3('0x24')](_0x4b518f[_0x68d3('0x25')]);if(_0x4b518f[_0x68d3('0x26')]){delete _0x4b518f[_0x68d3('0x26')];}_0x43d031['status'](_0x11de5a)[_0x68d3('0x27')](_0x4b518f);};}exports[_0x68d3('0x28')]=function(_0x4e25b2,_0x56888b){var _0x1c818a={},_0x1a89ec={},_0x3f7970={'count':0x0,'rows':[]};var _0x444fe8=_[_0x68d3('0x29')](db[_0x68d3('0x2a')][_0x68d3('0x2b')],function(_0x338965){return{'name':_0x338965[_0x68d3('0x2c')],'type':_0x338965[_0x68d3('0x2d')][_0x68d3('0x2e')]};});_0x1a89ec['model']=_[_0x68d3('0x29')](_0x444fe8,_0x68d3('0x26'));_0x1a89ec[_0x68d3('0x2f')]=_['keys'](_0x4e25b2[_0x68d3('0x2f')]);_0x1a89ec[_0x68d3('0x30')]=_[_0x68d3('0x31')](_0x1a89ec[_0x68d3('0x32')],_0x1a89ec['query']);_0x1c818a['attributes']=_[_0x68d3('0x31')](_0x1a89ec[_0x68d3('0x32')],qs[_0x68d3('0x33')](_0x4e25b2['query']['fields']));_0x1c818a[_0x68d3('0x34')]=_0x1c818a[_0x68d3('0x34')][_0x68d3('0x35')]?_0x1c818a[_0x68d3('0x34')]:_0x1a89ec[_0x68d3('0x32')];if(!_0x4e25b2[_0x68d3('0x2f')]['hasOwnProperty']('nolimit')){_0x1c818a[_0x68d3('0x1c')]=qs['limit'](_0x4e25b2[_0x68d3('0x2f')][_0x68d3('0x1c')]);_0x1c818a['offset']=qs[_0x68d3('0x1b')](_0x4e25b2[_0x68d3('0x2f')][_0x68d3('0x1b')]);}_0x1c818a[_0x68d3('0x36')]=qs[_0x68d3('0x37')](_0x4e25b2[_0x68d3('0x2f')]['sort']);_0x1c818a[_0x68d3('0x38')]=qs[_0x68d3('0x30')](_['pick'](_0x4e25b2[_0x68d3('0x2f')],_0x1a89ec[_0x68d3('0x30')]),_0x444fe8);if(_0x4e25b2['query'][_0x68d3('0x39')]){_0x1c818a[_0x68d3('0x38')]=_[_0x68d3('0x3a')](_0x1c818a['where'],{'$or':_[_0x68d3('0x29')](_0x444fe8,function(_0x420c8a){if(_0x420c8a[_0x68d3('0x2d')]!==_0x68d3('0x3b')){var _0x34d5a9={};_0x34d5a9[_0x420c8a['name']]={'$like':'%'+_0x4e25b2[_0x68d3('0x2f')][_0x68d3('0x39')]+'%'};return _0x34d5a9;}})});}_0x1c818a=_['merge']({},_0x1c818a,_0x4e25b2['options']);var _0x23863f={'where':_0x1c818a[_0x68d3('0x38')]};return db[_0x68d3('0x2a')][_0x68d3('0x3c')](_0x23863f)[_0x68d3('0x22')](function(_0x43cafd){_0x3f7970[_0x68d3('0x3c')]=_0x43cafd;if(_0x4e25b2[_0x68d3('0x2f')][_0x68d3('0x3d')]){_0x1c818a['include']=[{'all':!![]}];}return db[_0x68d3('0x2a')][_0x68d3('0x3e')](_0x1c818a);})[_0x68d3('0x22')](function(_0x5e45d8){_0x3f7970[_0x68d3('0x3f')]=_0x5e45d8;return _0x3f7970;})[_0x68d3('0x22')](respondWithFilteredResult(_0x56888b,_0x1c818a))[_0x68d3('0x40')](handleError(_0x56888b,null));};exports[_0x68d3('0x41')]=function(_0x2ffd21,_0x2e28e5){var _0x3ab4ed={'raw':!![],'where':{'id':_0x2ffd21[_0x68d3('0x42')]['id']}},_0x639319={};_0x639319[_0x68d3('0x32')]=_[_0x68d3('0x43')](db[_0x68d3('0x2a')][_0x68d3('0x2b')]);_0x639319[_0x68d3('0x2f')]=_[_0x68d3('0x43')](_0x2ffd21[_0x68d3('0x2f')]);_0x639319[_0x68d3('0x30')]=_[_0x68d3('0x31')](_0x639319['model'],_0x639319[_0x68d3('0x2f')]);_0x3ab4ed['attributes']=_[_0x68d3('0x31')](_0x639319[_0x68d3('0x32')],qs['fields'](_0x2ffd21['query']['fields']));_0x3ab4ed['attributes']=_0x3ab4ed[_0x68d3('0x34')][_0x68d3('0x35')]?_0x3ab4ed['attributes']:_0x639319[_0x68d3('0x32')];if(_0x2ffd21[_0x68d3('0x2f')][_0x68d3('0x3d')]){_0x3ab4ed[_0x68d3('0x44')]=[{'all':!![]}];}_0x3ab4ed=_['merge']({},_0x3ab4ed,_0x2ffd21[_0x68d3('0x45')]);return db[_0x68d3('0x2a')][_0x68d3('0x46')](_0x3ab4ed)[_0x68d3('0x22')](handleEntityNotFound(_0x2e28e5,null))[_0x68d3('0x22')](respondWithResult(_0x2e28e5,null))[_0x68d3('0x40')](handleError(_0x2e28e5,null));};exports[_0x68d3('0x47')]=function(_0x5e5826,_0x5622f0){return db[_0x68d3('0x2a')]['create'](_0x5e5826[_0x68d3('0x48')],{})['then'](respondWithResult(_0x5622f0,0xc9))[_0x68d3('0x40')](handleError(_0x5622f0,null));};exports[_0x68d3('0x21')]=function(_0x46f2b6,_0x5ebf23){if(_0x46f2b6['body']['id']){delete _0x46f2b6[_0x68d3('0x48')]['id'];}return db[_0x68d3('0x2a')][_0x68d3('0x46')]({'where':{'id':_0x46f2b6['params']['id']}})[_0x68d3('0x22')](handleEntityNotFound(_0x5ebf23,null))[_0x68d3('0x22')](saveUpdates(_0x46f2b6[_0x68d3('0x48')],null))['then'](respondWithResult(_0x5ebf23,null))['catch'](handleError(_0x5ebf23,null));};exports['destroy']=function(_0x5c8ee2,_0x1b641f){return db[_0x68d3('0x2a')][_0x68d3('0x46')]({'where':{'id':_0x5c8ee2[_0x68d3('0x42')]['id']}})[_0x68d3('0x22')](handleEntityNotFound(_0x1b641f,null))[_0x68d3('0x22')](removeEntity(_0x1b641f,null))[_0x68d3('0x40')](handleError(_0x1b641f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index df64141..6ae6e32 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 _0x6599=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x4054de,_0x33a729){var _0x2f2181=function(_0x5255c2){while(--_0x5255c2){_0x4054de['push'](_0x4054de['shift']());}};_0x2f2181(++_0x33a729);}(_0x6599,0xb0));var _0x9659=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x6599[_0xf73c09];return _0xa8923c;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var logger=require(_0x9659('0x1'))(_0x9659('0x2'));var moment=require(_0x9659('0x3'));var BPromise=require(_0x9659('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9659('0x5'));var rimraf=require('rimraf');var config=require(_0x9659('0x6'));var attributes=require('./intZendeskField.attributes');module[_0x9659('0x7')]=function(_0xb08ede,_0x159ac2){return _0xb08ede['define']('ZendeskField',attributes,{'tableName':_0x9659('0x8'),'paranoid':![],'indexes':[{'name':_0x9659('0x9'),'fields':['idField',_0x9659('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1152=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x240156,_0xc55307){var _0x33faca=function(_0x102eed){while(--_0x102eed){_0x240156['push'](_0x240156['shift']());}};_0x33faca(++_0xc55307);}(_0x1152,0x182));var _0x2115=function(_0x4f8b6a,_0x2ead69){_0x4f8b6a=_0x4f8b6a-0x0;var _0x192d31=_0x1152[_0x4f8b6a];return _0x192d31;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require(_0x2115('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x2115('0x9')]=function(_0x241dcb,_0x51a3cf){return _0x241dcb['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x2115('0xa'),_0x2115('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index e06c9ea..22ef798 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 _0x9000=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9000,0x155));var _0x0900=function(_0x28caf4,_0x797e55){_0x28caf4=_0x28caf4-0x0;var _0x503f93=_0x9000[_0x28caf4];return _0x503f93;};'use strict';var _=require('lodash');var util=require(_0x0900('0x0'));var moment=require(_0x0900('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0900('0x2'));var db=require(_0x0900('0x3'))['db'];var utils=require(_0x0900('0x4'));var logger=require(_0x0900('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0900('0x6'));var client=jayson['client'][_0x0900('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b4901,_0x14ab01,_0x493e4b){return new BPromise(function(_0x1e71da,_0x58943f){return client['request'](_0x2b4901,_0x493e4b)['then'](function(_0x54f5a7){logger[_0x0900('0x8')](_0x0900('0x9'),_0x14ab01,_0x0900('0xa'));logger[_0x0900('0xb')](_0x0900('0xc'),_0x14ab01,_0x0900('0xa'),JSON['stringify'](_0x54f5a7));if(_0x54f5a7[_0x0900('0xd')]){if(_0x54f5a7[_0x0900('0xd')]['code']===0x1f4){logger[_0x0900('0xd')]('ZendeskField,\x20%s,\x20%s',_0x14ab01,_0x54f5a7[_0x0900('0xd')][_0x0900('0xe')]);return _0x58943f(_0x54f5a7[_0x0900('0xd')][_0x0900('0xe')]);}logger[_0x0900('0xd')](_0x0900('0x9'),_0x14ab01,_0x54f5a7['error'][_0x0900('0xe')]);return _0x1e71da(_0x54f5a7['error']['message']);}else{logger[_0x0900('0x8')]('ZendeskField,\x20%s,\x20%s',_0x14ab01,_0x0900('0xa'));_0x1e71da(_0x54f5a7[_0x0900('0xf')]['message']);}})[_0x0900('0x10')](function(_0x52c720){logger[_0x0900('0xd')]('ZendeskField,\x20%s,\x20%s',_0x14ab01,_0x52c720);_0x58943f(_0x52c720);});});} \ No newline at end of file +var _0x69c1=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1be2fe,_0x1d8c95){var _0xb725b3=function(_0x354c42){while(--_0x354c42){_0x1be2fe['push'](_0x1be2fe['shift']());}};_0xb725b3(++_0x1d8c95);}(_0x69c1,0xb1));var _0x169c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x69c1[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x169c('0x0'));var util=require(_0x169c('0x1'));var moment=require(_0x169c('0x2'));var BPromise=require(_0x169c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x169c('0x4'));var db=require(_0x169c('0x5'))['db'];var utils=require(_0x169c('0x6'));var logger=require('../../config/logger')(_0x169c('0x7'));var config=require(_0x169c('0x8'));var jayson=require(_0x169c('0x9'));var client=jayson[_0x169c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52d50c,_0x2fc176,_0x42e3de){return new BPromise(function(_0x1f78cb,_0x50c44a){return client[_0x169c('0xb')](_0x52d50c,_0x42e3de)[_0x169c('0xc')](function(_0x57d256){logger[_0x169c('0xd')](_0x169c('0xe'),_0x2fc176,_0x169c('0xf'));logger[_0x169c('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x2fc176,_0x169c('0xf'),JSON[_0x169c('0x11')](_0x57d256));if(_0x57d256[_0x169c('0x12')]){if(_0x57d256['error']['code']===0x1f4){logger['error'](_0x169c('0xe'),_0x2fc176,_0x57d256[_0x169c('0x12')]['message']);return _0x50c44a(_0x57d256['error'][_0x169c('0x13')]);}logger['error'](_0x169c('0xe'),_0x2fc176,_0x57d256[_0x169c('0x12')][_0x169c('0x13')]);return _0x1f78cb(_0x57d256[_0x169c('0x12')]['message']);}else{logger[_0x169c('0xd')](_0x169c('0xe'),_0x2fc176,'request\x20sent');_0x1f78cb(_0x57d256[_0x169c('0x14')][_0x169c('0x13')]);}})[_0x169c('0x15')](function(_0x16cfa4){logger[_0x169c('0x12')](_0x169c('0xe'),_0x2fc176,_0x16cfa4);_0x50c44a(_0x16cfa4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 1f2b2b1..83bd255 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 _0xa4b8=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4b8,0xd9));var _0x8a4b=function(_0x4d05f8,_0x3efc70){_0x4d05f8=_0x4d05f8-0x0;var _0x220513=_0xa4b8[_0x4d05f8];return _0x220513;};'use strict';var multer=require(_0x8a4b('0x0'));var util=require(_0x8a4b('0x1'));var path=require(_0x8a4b('0x2'));var timeout=require(_0x8a4b('0x3'));var express=require(_0x8a4b('0x4'));var router=express[_0x8a4b('0x5')]();var auth=require(_0x8a4b('0x6'));var interaction=require(_0x8a4b('0x7'));var config=require(_0x8a4b('0x8'));var controller=require(_0x8a4b('0x9'));router['get']('/',auth[_0x8a4b('0xa')](),controller[_0x8a4b('0xb')]);router[_0x8a4b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8a4b('0xd')]);router[_0x8a4b('0xc')](_0x8a4b('0xe'),auth['isAuthenticated'](),controller[_0x8a4b('0xf')]);router[_0x8a4b('0xc')](_0x8a4b('0x10'),auth[_0x8a4b('0xa')](),controller[_0x8a4b('0x11')]);router[_0x8a4b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a4b('0x12')](_0x8a4b('0xe'),auth[_0x8a4b('0xa')](),controller['addConfiguration']);router[_0x8a4b('0x13')](_0x8a4b('0x14'),auth['isAuthenticated'](),controller[_0x8a4b('0x15')]);router[_0x8a4b('0x16')]('/:id',auth[_0x8a4b('0xa')](),controller[_0x8a4b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4dc8=['index','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x4dc8,0x117));var _0x84dc=function(_0x4ca41a,_0x329d67){_0x4ca41a=_0x4ca41a-0x0;var _0x52a3dc=_0x4dc8[_0x4ca41a];return _0x52a3dc;};'use strict';var multer=require(_0x84dc('0x0'));var util=require(_0x84dc('0x1'));var path=require(_0x84dc('0x2'));var timeout=require(_0x84dc('0x3'));var express=require('express');var router=express[_0x84dc('0x4')]();var auth=require(_0x84dc('0x5'));var interaction=require(_0x84dc('0x6'));var config=require(_0x84dc('0x7'));var controller=require(_0x84dc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x84dc('0x9')]);router[_0x84dc('0xa')]('/:id',auth[_0x84dc('0xb')](),controller[_0x84dc('0xc')]);router[_0x84dc('0xa')](_0x84dc('0xd'),auth[_0x84dc('0xb')](),controller[_0x84dc('0xe')]);router['get'](_0x84dc('0xf'),auth[_0x84dc('0xb')](),controller[_0x84dc('0x10')]);router[_0x84dc('0x11')]('/',auth[_0x84dc('0xb')](),controller[_0x84dc('0x12')]);router['post'](_0x84dc('0xd'),auth[_0x84dc('0xb')](),controller['addConfiguration']);router[_0x84dc('0x13')]('/:id',auth[_0x84dc('0xb')](),controller[_0x84dc('0x14')]);router[_0x84dc('0x15')]('/:id',auth[_0x84dc('0xb')](),controller[_0x84dc('0x16')]);module[_0x84dc('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 548ebaf..f593617 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 _0x880e=['sequelize','exports','STRING'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x880e,0x189));var _0xe880=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x880e[_0x14490c];return _0x2f6825;};'use strict';var Sequelize=require(_0xe880('0x0'));module[_0xe880('0x1')]={'name':{'type':Sequelize[_0xe880('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe880('0x2')]},'zone':{'type':Sequelize[_0xe880('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe880('0x2')]},'code':{'type':Sequelize[_0xe880('0x2')]},'refreshToken':{'type':Sequelize[_0xe880('0x2')]}}; \ No newline at end of file +var _0xec8a=['STRING','sequelize','exports'];(function(_0x13f3af,_0x2ac326){var _0xda3c9f=function(_0x5d96e9){while(--_0x5d96e9){_0x13f3af['push'](_0x13f3af['shift']());}};_0xda3c9f(++_0x2ac326);}(_0xec8a,0x184));var _0xaec8=function(_0x47927e,_0x41c7e5){_0x47927e=_0x47927e-0x0;var _0x6b262f=_0xec8a[_0x47927e];return _0x6b262f;};'use strict';var Sequelize=require(_0xaec8('0x0'));module[_0xaec8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaec8('0x2')]},'zone':{'type':Sequelize[_0xaec8('0x2')]},'clientId':{'type':Sequelize[_0xaec8('0x2')]},'clientSecret':{'type':Sequelize[_0xaec8('0x2')]},'serverUrl':{'type':Sequelize[_0xaec8('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 0198f8f..cf56424 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 _0x5a70=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','request','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','Content-Range','apply','reject','save','update','then','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','ZohoAccount','count','include','findAll','rows','show','params','includeAll','create','body','find','findOne','ZohoConfiguration','rawAttributes','getConfigurations','AccountId','Subjects','getSubjects','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','getFields','host','clientSecret','refreshToken','zoho.eu','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Subject','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','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'];(function(_0x546b1f,_0xeaf457){var _0x4941c1=function(_0xee5838){while(--_0xee5838){_0x546b1f['push'](_0x546b1f['shift']());}};_0x4941c1(++_0xeaf457);}(_0x5a70,0x18c));var _0x05a7=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5a70[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x05a7('0x0'));var emlformat=require(_0x05a7('0x1'));var rimraf=require(_0x05a7('0x2'));var zipdir=require(_0x05a7('0x3'));var jsonpatch=require(_0x05a7('0x4'));var rp=require(_0x05a7('0x5'));var moment=require(_0x05a7('0x6'));var BPromise=require(_0x05a7('0x7'));var Mustache=require(_0x05a7('0x8'));var util=require(_0x05a7('0x9'));var path=require(_0x05a7('0xa'));var sox=require(_0x05a7('0xb'));var csv=require('to-csv');var ejs=require(_0x05a7('0xc'));var fs=require('fs');var _=require(_0x05a7('0xd'));var squel=require(_0x05a7('0xe'));var crypto=require(_0x05a7('0xf'));var jsforce=require(_0x05a7('0x10'));var deskjs=require(_0x05a7('0x11'));var toCsv=require(_0x05a7('0x12'));var querystring=require(_0x05a7('0x13'));var Papa=require(_0x05a7('0x14'));var Redis=require(_0x05a7('0x15'));var authService=require(_0x05a7('0x16'));var qs=require(_0x05a7('0x17'));var as=require(_0x05a7('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05a7('0x19'))('api');var utils=require(_0x05a7('0x1a'));var config=require(_0x05a7('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x05a7('0x1c'));var client=jayson[_0x05a7('0x1d')][_0x05a7('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1e54a7,_0x223f7e,_0x134c61){if(_0x134c61){var _0x2625f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2625f2['test'](_0x223f7e)){return _0x1e54a7;}else{throw new db[(_0x05a7('0x1f'))]['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 _0x1e54a7;}}function respondWithRpcPromise(_0x5d74f1,_0xbd52fa,_0x2e726c,_0x784f3b){return new BPromise(function(_0x3d6dd3,_0x54cf86){var _0x245229=_0x784f3b||client;return _0x245229[_0x05a7('0x20')](_0x5d74f1,_0x2e726c)['then'](function(_0x241cfa){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xbd52fa,'request\x20sent');logger[_0x05a7('0x21')](_0x05a7('0x22'),_0xbd52fa,_0x05a7('0x23'),JSON['stringify'](_0x241cfa));if(_0x241cfa['error']){if(_0x241cfa[_0x05a7('0x24')][_0x05a7('0x25')]===0x1f4){logger['error'](_0x05a7('0x26'),_0xbd52fa,_0x241cfa[_0x05a7('0x24')][_0x05a7('0x27')]);return _0x54cf86(_0x241cfa[_0x05a7('0x24')][_0x05a7('0x27')]);}logger[_0x05a7('0x24')]('ZohoAccount,\x20%s,\x20%s',_0xbd52fa,_0x241cfa[_0x05a7('0x24')][_0x05a7('0x27')]);return _0x3d6dd3(_0x241cfa[_0x05a7('0x24')][_0x05a7('0x27')]);}else{logger[_0x05a7('0x28')]('ZohoAccount,\x20%s,\x20%s',_0xbd52fa,_0x05a7('0x23'));_0x3d6dd3(_0x241cfa[_0x05a7('0x29')][_0x05a7('0x27')]);}})[_0x05a7('0x2a')](function(_0x4d41ca){logger[_0x05a7('0x24')](_0x05a7('0x26'),_0xbd52fa,_0x4d41ca);_0x54cf86(_0x4d41ca);});});}function respondWithStatusCode(_0x222dd1,_0x4c9d5a){_0x4c9d5a=_0x4c9d5a||0xcc;return function(_0x431b23){if(_0x431b23){return _0x222dd1[_0x05a7('0x2b')](_0x4c9d5a);}return _0x222dd1['status'](_0x4c9d5a)[_0x05a7('0x2c')]();};}function respondWithResult(_0x12434b,_0x1b43ea){_0x1b43ea=_0x1b43ea||0xc8;return function(_0x837479){if(_0x837479){return _0x12434b[_0x05a7('0x2d')](_0x1b43ea)[_0x05a7('0x2e')](_0x837479);}};}function respondWithFilteredResult(_0x3244ec,_0x2805e4){return function(_0x58b815){if(_0x58b815){var _0x1f66dd=_0x58b815['count'],_0xe46ce5=_0x2805e4[_0x05a7('0x2f')],_0x53377d=_0x2805e4['offset']+_0x2805e4['limit'],_0x1a2a4d;if(_0x53377d>=_0x1f66dd){_0x53377d=_0x1f66dd;_0x1a2a4d=0xc8;}else{_0x1a2a4d=0xce;}_0x3244ec['status'](_0x1a2a4d);return _0x3244ec['set'](_0x05a7('0x30'),_0xe46ce5+'-'+_0x53377d+'/'+_0x1f66dd)[_0x05a7('0x2e')](_0x58b815);}return null;};}function patchUpdates(_0x5e1acd){return function(_0x2a6587){try{jsonpatch[_0x05a7('0x31')](_0x2a6587,_0x5e1acd,!![]);}catch(_0x39ab99){return BPromise[_0x05a7('0x32')](_0x39ab99);}return _0x2a6587[_0x05a7('0x33')]();};}function saveUpdates(_0x4dfbff,_0x1e133f){return function(_0x19c532){if(_0x19c532){return _0x19c532[_0x05a7('0x34')](_0x4dfbff)[_0x05a7('0x35')](function(_0x9d5a7){return _0x9d5a7;});}return null;};}function removeEntity(_0x2b28b3,_0x4253cc){return function(_0x36a0cd){if(_0x36a0cd){return _0x36a0cd['destroy']()[_0x05a7('0x35')](function(){_0x2b28b3[_0x05a7('0x2d')](0xcc)[_0x05a7('0x2c')]();});}};}function handleEntityNotFound(_0x40c956,_0x5e3c48){return function(_0x3a6912){if(!_0x3a6912){_0x40c956[_0x05a7('0x2b')](0x194);}return _0x3a6912;};}function handleError(_0x11db3a,_0x20349f){_0x20349f=_0x20349f||0x1f4;return function(_0x468410){logger['error'](_0x468410[_0x05a7('0x36')]);if(_0x468410['name']){delete _0x468410[_0x05a7('0x37')];}_0x11db3a[_0x05a7('0x2d')](_0x20349f)['send'](_0x468410);};}exports[_0x05a7('0x38')]=function(_0x2f3d6a,_0x3477ab){var _0xb52453={},_0x1df684={},_0x3b887c={'count':0x0,'rows':[]};var _0xdb251a=_[_0x05a7('0x39')](db['ZohoAccount']['rawAttributes'],function(_0x57c013){return{'name':_0x57c013[_0x05a7('0x3a')],'type':_0x57c013[_0x05a7('0x3b')][_0x05a7('0x3c')]};});_0x1df684[_0x05a7('0x3d')]=_[_0x05a7('0x39')](_0xdb251a,_0x05a7('0x37'));_0x1df684[_0x05a7('0x3e')]=_[_0x05a7('0x3f')](_0x2f3d6a[_0x05a7('0x3e')]);_0x1df684[_0x05a7('0x40')]=_[_0x05a7('0x41')](_0x1df684[_0x05a7('0x3d')],_0x1df684[_0x05a7('0x3e')]);_0xb52453[_0x05a7('0x42')]=_[_0x05a7('0x41')](_0x1df684[_0x05a7('0x3d')],qs[_0x05a7('0x43')](_0x2f3d6a['query'][_0x05a7('0x43')]));_0xb52453['attributes']=_0xb52453[_0x05a7('0x42')][_0x05a7('0x44')]?_0xb52453['attributes']:_0x1df684[_0x05a7('0x3d')];if(!_0x2f3d6a[_0x05a7('0x3e')][_0x05a7('0x45')]('nolimit')){_0xb52453['limit']=qs[_0x05a7('0x46')](_0x2f3d6a[_0x05a7('0x3e')][_0x05a7('0x46')]);_0xb52453[_0x05a7('0x2f')]=qs['offset'](_0x2f3d6a[_0x05a7('0x3e')][_0x05a7('0x2f')]);}_0xb52453[_0x05a7('0x47')]=qs[_0x05a7('0x48')](_0x2f3d6a[_0x05a7('0x3e')]['sort']);_0xb52453[_0x05a7('0x49')]=qs['filters'](_['pick'](_0x2f3d6a[_0x05a7('0x3e')],_0x1df684[_0x05a7('0x40')]),_0xdb251a);if(_0x2f3d6a['query'][_0x05a7('0x4a')]){_0xb52453[_0x05a7('0x49')]=_[_0x05a7('0x4b')](_0xb52453[_0x05a7('0x49')],{'$or':_['map'](_0xdb251a,function(_0x285d70){if(_0x285d70[_0x05a7('0x3b')]!==_0x05a7('0x4c')){var _0x57c86f={};_0x57c86f[_0x285d70['name']]={'$like':'%'+_0x2f3d6a['query'][_0x05a7('0x4a')]+'%'};return _0x57c86f;}})});}_0xb52453=_[_0x05a7('0x4b')]({},_0xb52453,_0x2f3d6a[_0x05a7('0x4d')]);var _0x17c296={'where':_0xb52453['where']};return db[_0x05a7('0x4e')][_0x05a7('0x4f')](_0x17c296)['then'](function(_0x1e6e0d){_0x3b887c[_0x05a7('0x4f')]=_0x1e6e0d;if(_0x2f3d6a['query']['includeAll']){_0xb52453[_0x05a7('0x50')]=[{'all':!![]}];}return db[_0x05a7('0x4e')][_0x05a7('0x51')](_0xb52453);})[_0x05a7('0x35')](function(_0x2d35ed){_0x3b887c[_0x05a7('0x52')]=_0x2d35ed;return _0x3b887c;})[_0x05a7('0x35')](respondWithFilteredResult(_0x3477ab,_0xb52453))[_0x05a7('0x2a')](handleError(_0x3477ab,null));};exports[_0x05a7('0x53')]=function(_0x2027e2,_0x4eea53){var _0x46137e={'raw':![],'where':{'id':_0x2027e2[_0x05a7('0x54')]['id']}},_0x48b479={};_0x48b479[_0x05a7('0x3d')]=_[_0x05a7('0x3f')](db[_0x05a7('0x4e')]['rawAttributes']);_0x48b479[_0x05a7('0x3e')]=_[_0x05a7('0x3f')](_0x2027e2['query']);_0x48b479['filters']=_[_0x05a7('0x41')](_0x48b479[_0x05a7('0x3d')],_0x48b479[_0x05a7('0x3e')]);_0x46137e['attributes']=_[_0x05a7('0x41')](_0x48b479[_0x05a7('0x3d')],qs['fields'](_0x2027e2['query'][_0x05a7('0x43')]));_0x46137e['attributes']=_0x46137e[_0x05a7('0x42')]['length']?_0x46137e[_0x05a7('0x42')]:_0x48b479[_0x05a7('0x3d')];if(_0x2027e2[_0x05a7('0x3e')][_0x05a7('0x55')]){_0x46137e[_0x05a7('0x50')]=[{'all':!![]}];}_0x46137e=_[_0x05a7('0x4b')]({},_0x46137e,_0x2027e2[_0x05a7('0x4d')]);return db['ZohoAccount']['find'](_0x46137e)['then'](handleEntityNotFound(_0x4eea53,null))[_0x05a7('0x35')](respondWithResult(_0x4eea53,null))[_0x05a7('0x2a')](handleError(_0x4eea53,null));};exports[_0x05a7('0x56')]=function(_0x5ba926,_0x353a2c){return db['ZohoAccount'][_0x05a7('0x56')](_0x5ba926[_0x05a7('0x57')],{})['then'](respondWithResult(_0x353a2c,0xc9))[_0x05a7('0x2a')](handleError(_0x353a2c,null));};exports[_0x05a7('0x34')]=function(_0x1e091a,_0x80e56a){if(_0x1e091a['body']['id']){delete _0x1e091a[_0x05a7('0x57')]['id'];}return db[_0x05a7('0x4e')][_0x05a7('0x58')]({'where':{'id':_0x1e091a[_0x05a7('0x54')]['id']}})[_0x05a7('0x35')](handleEntityNotFound(_0x80e56a,null))[_0x05a7('0x35')](saveUpdates(_0x1e091a[_0x05a7('0x57')],null))[_0x05a7('0x35')](respondWithResult(_0x80e56a,null))[_0x05a7('0x2a')](handleError(_0x80e56a,null));};exports['destroy']=function(_0x141d23,_0x4f3e7b){return db['ZohoAccount'][_0x05a7('0x58')]({'where':{'id':_0x141d23[_0x05a7('0x54')]['id']}})[_0x05a7('0x35')](handleEntityNotFound(_0x4f3e7b,null))[_0x05a7('0x35')](removeEntity(_0x4f3e7b,null))[_0x05a7('0x2a')](handleError(_0x4f3e7b,null));};exports['getConfigurations']=function(_0xd56bc2,_0x52a63c,_0x5de9f0){var _0x182f24={};var _0x549489={};var _0x13534c;var _0x1651bf;return db[_0x05a7('0x4e')][_0x05a7('0x59')]({'where':{'id':_0xd56bc2[_0x05a7('0x54')]['id']}})[_0x05a7('0x35')](handleEntityNotFound(_0x52a63c,null))[_0x05a7('0x35')](function(_0x4cc5d5){if(_0x4cc5d5){_0x13534c=_0x4cc5d5;_0x549489[_0x05a7('0x3d')]=_[_0x05a7('0x3f')](db[_0x05a7('0x5a')][_0x05a7('0x5b')]);_0x549489[_0x05a7('0x3e')]=_['keys'](_0xd56bc2[_0x05a7('0x3e')]);_0x549489[_0x05a7('0x40')]=_[_0x05a7('0x41')](_0x549489[_0x05a7('0x3d')],_0x549489[_0x05a7('0x3e')]);_0x182f24[_0x05a7('0x42')]=_[_0x05a7('0x41')](_0x549489['model'],qs[_0x05a7('0x43')](_0xd56bc2['query']['fields']));_0x182f24[_0x05a7('0x42')]=_0x182f24[_0x05a7('0x42')][_0x05a7('0x44')]?_0x182f24[_0x05a7('0x42')]:_0x549489[_0x05a7('0x3d')];_0x182f24[_0x05a7('0x47')]=qs[_0x05a7('0x48')](_0xd56bc2[_0x05a7('0x3e')][_0x05a7('0x48')]);_0x182f24['where']=qs['filters'](_['pick'](_0xd56bc2[_0x05a7('0x3e')],_0x549489[_0x05a7('0x40')]));if(_0xd56bc2[_0x05a7('0x3e')]['filter']){_0x182f24[_0x05a7('0x49')]=_[_0x05a7('0x4b')](_0x182f24[_0x05a7('0x49')],{'$or':_[_0x05a7('0x39')](_0x182f24[_0x05a7('0x42')],function(_0x1f8418){var _0x4a628e={};_0x4a628e[_0x1f8418]={'$like':'%'+_0xd56bc2['query']['filter']+'%'};return _0x4a628e;})});}_0x182f24=_[_0x05a7('0x4b')]({},_0x182f24,_0xd56bc2['options']);return _0x13534c[_0x05a7('0x5c')](_0x182f24);}})[_0x05a7('0x35')](function(_0x329c4d){if(_0x329c4d){_0x1651bf=_0x329c4d[_0x05a7('0x44')];if(!_0xd56bc2[_0x05a7('0x3e')][_0x05a7('0x45')]('nolimit')){_0x182f24[_0x05a7('0x46')]=qs[_0x05a7('0x46')](_0xd56bc2[_0x05a7('0x3e')][_0x05a7('0x46')]);_0x182f24[_0x05a7('0x2f')]=qs[_0x05a7('0x2f')](_0xd56bc2['query'][_0x05a7('0x2f')]);}return _0x13534c[_0x05a7('0x5c')](_0x182f24);}})[_0x05a7('0x35')](function(_0x842367){if(_0x842367){return _0x842367?{'count':_0x1651bf,'rows':_0x842367}:null;}})[_0x05a7('0x35')](respondWithResult(_0x52a63c,null))[_0x05a7('0x2a')](handleError(_0x52a63c,null));};exports['addConfiguration']=function(_0x593aa3,_0x318c4b,_0x46e8ae){if(_0x593aa3[_0x05a7('0x57')]['id']){delete _0x593aa3[_0x05a7('0x57')]['id'];}return db[_0x05a7('0x4e')][_0x05a7('0x59')]({'where':{'id':_0x593aa3[_0x05a7('0x54')]['id']}})[_0x05a7('0x35')](handleEntityNotFound(_0x318c4b,null))['then'](function(_0x599b20){if(_0x599b20){_0x593aa3[_0x05a7('0x57')][_0x05a7('0x5d')]=_0x599b20['id'];_0x593aa3['body'][_0x05a7('0x5e')]=integrations[_0x05a7('0x5f')](_0x593aa3['body']['channel'],_0x593aa3[_0x05a7('0x57')][_0x05a7('0x3b')]);_0x593aa3['body']['Descriptions']=integrations['getDescriptions'](_0x593aa3[_0x05a7('0x57')][_0x05a7('0x60')],_0x593aa3[_0x05a7('0x57')][_0x05a7('0x3b')]);return db['ZohoConfiguration'][_0x05a7('0x56')](_0x593aa3[_0x05a7('0x57')],{'include':[{'model':db[_0x05a7('0x61')],'as':_0x05a7('0x5e')},{'model':db[_0x05a7('0x61')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x318c4b,null))[_0x05a7('0x2a')](handleError(_0x318c4b,null));};function getAccessToken(_0x26535b){return new Promise(function(_0x58d5b0,_0x55f7bb){var _0x552de8;switch(_0x26535b[_0x05a7('0x62')]){case'US':_0x552de8=_0x05a7('0x63');break;case'AU':_0x552de8=_0x05a7('0x64');break;case'EU':_0x552de8=_0x05a7('0x65');break;case'IN':_0x552de8='https://accounts.zoho.in';break;case'CN':_0x552de8=_0x05a7('0x66');break;default:_0x552de8=_0x05a7('0x65');break;}var _0x59f5f9={'method':_0x05a7('0x67'),'uri':_0x552de8+_0x05a7('0x68'),'qs':{'refresh_token':_0x26535b['refreshToken'],'client_id':_0x26535b[_0x05a7('0x69')],'client_secret':_0x26535b['clientSecret'],'grant_type':_0x05a7('0x6a')},'json':!![]};return rp(_0x59f5f9)[_0x05a7('0x35')](function(_0x2d0c1c){if(_0x2d0c1c['access_token']){_0x58d5b0(_0x2d0c1c['access_token']);}else{_0x55f7bb('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x22c680){_0x55f7bb(_0x22c680);});});}exports[_0x05a7('0x6b')]=function(_0x407244,_0x3eab54,_0x67ed03){var _0x690e5,_0x448cb7,_0x12c1df,_0x428b02,_0x312e3b;return db[_0x05a7('0x4e')][_0x05a7('0x59')]({'where':{'id':_0x407244['params']['id']},'attributes':['id',_0x05a7('0x6c'),'zone',_0x05a7('0x69'),_0x05a7('0x6d'),'serverUrl',_0x05a7('0x25'),_0x05a7('0x6e')]})[_0x05a7('0x35')](handleEntityNotFound(_0x3eab54,null))[_0x05a7('0x35')](function(_0x2a91ea){_0x312e3b=_0x2a91ea;_0x690e5=_0x312e3b[_0x05a7('0x6c')];_0x448cb7=_0x690e5===_0x05a7('0x6f')?'eu':'com';_0x12c1df=_0x312e3b[_0x05a7('0x70')];var _0xae9b19=_0x12c1df[_0x05a7('0x71')](-0x1);if(_0xae9b19==='/'||_0xae9b19==='\x5c'||_0xae9b19===':'){_0x12c1df=_0x12c1df['substring'](0x0,_0x12c1df[_0x05a7('0x72')](_0xae9b19));}if(!_0x312e3b[_0x05a7('0x6e')]){throw new Error(_0x05a7('0x73'));}return getAccessToken(_0x312e3b);})['then'](function(_0x252b22){if(_0x252b22){return rp({'method':'GET','uri':util[_0x05a7('0x74')](_0x05a7('0x75'),_0x448cb7),'qs':{'module':_0x05a7('0x76')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x252b22},'json':!![]});}})['then'](function(_0xc22b0a){if(_0xc22b0a){if(_0xc22b0a[_0x05a7('0x77')]&&_0xc22b0a[_0x05a7('0x77')][_0x05a7('0x24')]){throw new Error(_0xc22b0a['response']['error'][_0x05a7('0x27')]);}var _0x5920c6=[];var _0x4edf2d=[];var _0x269b3a=['Owner',_0x05a7('0x78'),'Description',_0x05a7('0x79'),_0x05a7('0x7a'),'Call_Result',_0x05a7('0x7b'),_0x05a7('0x7c')];_0x4edf2d=_[_0x05a7('0x7d')](_0xc22b0a['fields'],function(_0x49a5d6){return _0x269b3a[_0x05a7('0x7e')](_0x49a5d6[_0x05a7('0x7f')]);});for(var _0x29d693=0x0;_0x29d693<_0x4edf2d['length'];_0x29d693++){if(_0x4edf2d[_0x29d693][_0x05a7('0x80')]===![]){_0x5920c6[_0x05a7('0x81')]({'id':_0x4edf2d[_0x29d693]['id'],'name':_0x4edf2d[_0x29d693][_0x05a7('0x82')],'custom':_0x4edf2d[_0x29d693][_0x05a7('0x83')],'options':_0x4edf2d[_0x29d693]['data_type']===_0x05a7('0x84')&&_0x4edf2d[_0x29d693][_0x05a7('0x85')][_0x05a7('0x44')]>-0x1?_['map'](_0x4edf2d[_0x29d693][_0x05a7('0x85')],function(_0x1f6f4e){return{'name':_0x1f6f4e,'value':_0x1f6f4e};}):[]});}}return{'count':_0x5920c6['length'],'rows':_0x5920c6};}else{return{'count':0x0,'rows':[]};}})[_0x05a7('0x35')](respondWithResult(_0x3eab54,null))[_0x05a7('0x2a')](function(_0x443e56){var _0x410237=_0x407244[_0x05a7('0x3e')][_0x05a7('0x86')]?0x1f4:_0x443e56[_0x05a7('0x87')]||0x1f4;logger[_0x05a7('0x24')](_0x05a7('0x88'),_0x05a7('0x6b'),_0x410237,JSON[_0x05a7('0x89')](_0x443e56));delete _0x443e56[_0x05a7('0x37')];if(_0x410237===0x191){_0x410237=0x190;}_0x3eab54[_0x05a7('0x2d')](_0x410237)[_0x05a7('0x8a')](_0x407244['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x443e56['statusCode']}:_0x443e56);});}; \ No newline at end of file +var _0x3f22=['remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','Wrong\x20credentials','statusCode','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../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','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','ZohoAccount','fieldName','type','key','query','keys','intersection','model','attributes','fields','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','rawAttributes','length','options','find','create','body','update','getConfigurations','findOne','params','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Type'];(function(_0x24f34f,_0x3587a5){var _0x3ed63d=function(_0x4a23a6){while(--_0x4a23a6){_0x24f34f['push'](_0x24f34f['shift']());}};_0x3ed63d(++_0x3587a5);}(_0x3f22,0x1a3));var _0x23f2=function(_0x4bea27,_0x1757ce){_0x4bea27=_0x4bea27-0x0;var _0x43ecb7=_0x3f22[_0x4bea27];return _0x43ecb7;};'use strict';var pdf=require(_0x23f2('0x0'));var emlformat=require(_0x23f2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23f2('0x2'));var moment=require(_0x23f2('0x3'));var BPromise=require(_0x23f2('0x4'));var Mustache=require(_0x23f2('0x5'));var util=require(_0x23f2('0x6'));var path=require(_0x23f2('0x7'));var sox=require(_0x23f2('0x8'));var csv=require(_0x23f2('0x9'));var ejs=require(_0x23f2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23f2('0xb'));var crypto=require(_0x23f2('0xc'));var jsforce=require(_0x23f2('0xd'));var deskjs=require(_0x23f2('0xe'));var toCsv=require(_0x23f2('0x9'));var querystring=require('querystring');var Papa=require(_0x23f2('0xf'));var Redis=require(_0x23f2('0x10'));var authService=require(_0x23f2('0x11'));var qs=require(_0x23f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x23f2('0x13'));var utils=require(_0x23f2('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x23f2('0x15'));var jayson=require(_0x23f2('0x16'));var client=jayson[_0x23f2('0x17')][_0x23f2('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4a51e4,_0x21efe6,_0x55a53e){if(_0x55a53e){var _0x4d447d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d447d[_0x23f2('0x19')](_0x21efe6)){return _0x4a51e4;}else{throw new db['Sequelize']['ValidationError'](_0x23f2('0x1a'));}}else{return _0x4a51e4;}}function respondWithRpcPromise(_0x282dcc,_0x3cc1f6,_0x4344f1,_0x537948){return new BPromise(function(_0x8cad3a,_0x447b45){var _0x52e608=_0x537948||client;return _0x52e608[_0x23f2('0x1b')](_0x282dcc,_0x4344f1)[_0x23f2('0x1c')](function(_0x464d80){logger[_0x23f2('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x3cc1f6,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3cc1f6,_0x23f2('0x1e'),JSON[_0x23f2('0x1f')](_0x464d80));if(_0x464d80[_0x23f2('0x20')]){if(_0x464d80[_0x23f2('0x20')][_0x23f2('0x21')]===0x1f4){logger['error'](_0x23f2('0x22'),_0x3cc1f6,_0x464d80[_0x23f2('0x20')][_0x23f2('0x23')]);return _0x447b45(_0x464d80[_0x23f2('0x20')][_0x23f2('0x23')]);}logger[_0x23f2('0x20')](_0x23f2('0x22'),_0x3cc1f6,_0x464d80[_0x23f2('0x20')][_0x23f2('0x23')]);return _0x8cad3a(_0x464d80['error']['message']);}else{logger[_0x23f2('0x1d')](_0x23f2('0x22'),_0x3cc1f6,_0x23f2('0x1e'));_0x8cad3a(_0x464d80[_0x23f2('0x24')][_0x23f2('0x23')]);}})[_0x23f2('0x25')](function(_0x1ddeb0){logger[_0x23f2('0x20')](_0x23f2('0x22'),_0x3cc1f6,_0x1ddeb0);_0x447b45(_0x1ddeb0);});});}function respondWithStatusCode(_0x5348d5,_0x51acd9){_0x51acd9=_0x51acd9||0xcc;return function(_0x5ca9fb){if(_0x5ca9fb){return _0x5348d5[_0x23f2('0x26')](_0x51acd9);}return _0x5348d5[_0x23f2('0x27')](_0x51acd9)[_0x23f2('0x28')]();};}function respondWithResult(_0x325a84,_0x41e61f){_0x41e61f=_0x41e61f||0xc8;return function(_0x4f9c54){if(_0x4f9c54){return _0x325a84[_0x23f2('0x27')](_0x41e61f)[_0x23f2('0x29')](_0x4f9c54);}};}function respondWithFilteredResult(_0x566e8d,_0x6c8865){return function(_0x32c621){if(_0x32c621){var _0x20dbfd=_0x32c621[_0x23f2('0x2a')],_0x7681d4=_0x6c8865[_0x23f2('0x2b')],_0x3d2f04=_0x6c8865[_0x23f2('0x2b')]+_0x6c8865[_0x23f2('0x2c')],_0x3d657a;if(_0x3d2f04>=_0x20dbfd){_0x3d2f04=_0x20dbfd;_0x3d657a=0xc8;}else{_0x3d657a=0xce;}_0x566e8d[_0x23f2('0x27')](_0x3d657a);return _0x566e8d[_0x23f2('0x2d')](_0x23f2('0x2e'),_0x7681d4+'-'+_0x3d2f04+'/'+_0x20dbfd)[_0x23f2('0x29')](_0x32c621);}return null;};}function patchUpdates(_0x1beb47){return function(_0x2a18fd){try{jsonpatch[_0x23f2('0x2f')](_0x2a18fd,_0x1beb47,!![]);}catch(_0x16bf01){return BPromise[_0x23f2('0x30')](_0x16bf01);}return _0x2a18fd[_0x23f2('0x31')]();};}function saveUpdates(_0x1b3530,_0x22e1b0){return function(_0x5a9684){if(_0x5a9684){return _0x5a9684['update'](_0x1b3530)[_0x23f2('0x1c')](function(_0x2383aa){return _0x2383aa;});}return null;};}function removeEntity(_0x2c4aa9,_0x253fde){return function(_0x498583){if(_0x498583){return _0x498583[_0x23f2('0x32')]()[_0x23f2('0x1c')](function(){_0x2c4aa9[_0x23f2('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35875a,_0x31fdf8){return function(_0x560ba7){if(!_0x560ba7){_0x35875a[_0x23f2('0x26')](0x194);}return _0x560ba7;};}function handleError(_0x224700,_0x586cd3){_0x586cd3=_0x586cd3||0x1f4;return function(_0x3a1545){logger[_0x23f2('0x20')](_0x3a1545[_0x23f2('0x33')]);if(_0x3a1545[_0x23f2('0x34')]){delete _0x3a1545['name'];}_0x224700[_0x23f2('0x27')](_0x586cd3)['send'](_0x3a1545);};}exports[_0x23f2('0x35')]=function(_0x1f67dd,_0x51ec4d){var _0x4ce611={},_0x34ad5a={},_0x33b051={'count':0x0,'rows':[]};var _0x22af04=_[_0x23f2('0x36')](db[_0x23f2('0x37')]['rawAttributes'],function(_0xe07d4c){return{'name':_0xe07d4c[_0x23f2('0x38')],'type':_0xe07d4c[_0x23f2('0x39')][_0x23f2('0x3a')]};});_0x34ad5a['model']=_[_0x23f2('0x36')](_0x22af04,_0x23f2('0x34'));_0x34ad5a[_0x23f2('0x3b')]=_[_0x23f2('0x3c')](_0x1f67dd[_0x23f2('0x3b')]);_0x34ad5a['filters']=_[_0x23f2('0x3d')](_0x34ad5a[_0x23f2('0x3e')],_0x34ad5a['query']);_0x4ce611[_0x23f2('0x3f')]=_[_0x23f2('0x3d')](_0x34ad5a['model'],qs['fields'](_0x1f67dd[_0x23f2('0x3b')][_0x23f2('0x40')]));_0x4ce611['attributes']=_0x4ce611[_0x23f2('0x3f')]['length']?_0x4ce611[_0x23f2('0x3f')]:_0x34ad5a['model'];if(!_0x1f67dd[_0x23f2('0x3b')]['hasOwnProperty']('nolimit')){_0x4ce611[_0x23f2('0x2c')]=qs[_0x23f2('0x2c')](_0x1f67dd['query'][_0x23f2('0x2c')]);_0x4ce611['offset']=qs[_0x23f2('0x2b')](_0x1f67dd[_0x23f2('0x3b')]['offset']);}_0x4ce611[_0x23f2('0x41')]=qs[_0x23f2('0x42')](_0x1f67dd[_0x23f2('0x3b')][_0x23f2('0x42')]);_0x4ce611[_0x23f2('0x43')]=qs[_0x23f2('0x44')](_[_0x23f2('0x45')](_0x1f67dd['query'],_0x34ad5a[_0x23f2('0x44')]),_0x22af04);if(_0x1f67dd['query'][_0x23f2('0x46')]){_0x4ce611[_0x23f2('0x43')]=_[_0x23f2('0x47')](_0x4ce611['where'],{'$or':_[_0x23f2('0x36')](_0x22af04,function(_0x54a860){if(_0x54a860[_0x23f2('0x39')]!=='VIRTUAL'){var _0x38ff17={};_0x38ff17[_0x54a860[_0x23f2('0x34')]]={'$like':'%'+_0x1f67dd[_0x23f2('0x3b')][_0x23f2('0x46')]+'%'};return _0x38ff17;}})});}_0x4ce611=_[_0x23f2('0x47')]({},_0x4ce611,_0x1f67dd['options']);var _0x222de8={'where':_0x4ce611[_0x23f2('0x43')]};return db[_0x23f2('0x37')][_0x23f2('0x2a')](_0x222de8)[_0x23f2('0x1c')](function(_0x1e2e47){_0x33b051[_0x23f2('0x2a')]=_0x1e2e47;if(_0x1f67dd[_0x23f2('0x3b')][_0x23f2('0x48')]){_0x4ce611[_0x23f2('0x49')]=[{'all':!![]}];}return db[_0x23f2('0x37')][_0x23f2('0x4a')](_0x4ce611);})['then'](function(_0x57a069){_0x33b051[_0x23f2('0x4b')]=_0x57a069;return _0x33b051;})[_0x23f2('0x1c')](respondWithFilteredResult(_0x51ec4d,_0x4ce611))['catch'](handleError(_0x51ec4d,null));};exports['show']=function(_0x444307,_0x4ec2a1){var _0x21aa9f={'raw':![],'where':{'id':_0x444307['params']['id']}},_0x423b41={};_0x423b41[_0x23f2('0x3e')]=_[_0x23f2('0x3c')](db[_0x23f2('0x37')][_0x23f2('0x4c')]);_0x423b41[_0x23f2('0x3b')]=_['keys'](_0x444307['query']);_0x423b41[_0x23f2('0x44')]=_[_0x23f2('0x3d')](_0x423b41['model'],_0x423b41[_0x23f2('0x3b')]);_0x21aa9f[_0x23f2('0x3f')]=_[_0x23f2('0x3d')](_0x423b41['model'],qs[_0x23f2('0x40')](_0x444307['query'][_0x23f2('0x40')]));_0x21aa9f[_0x23f2('0x3f')]=_0x21aa9f[_0x23f2('0x3f')][_0x23f2('0x4d')]?_0x21aa9f[_0x23f2('0x3f')]:_0x423b41[_0x23f2('0x3e')];if(_0x444307[_0x23f2('0x3b')]['includeAll']){_0x21aa9f[_0x23f2('0x49')]=[{'all':!![]}];}_0x21aa9f=_['merge']({},_0x21aa9f,_0x444307[_0x23f2('0x4e')]);return db[_0x23f2('0x37')][_0x23f2('0x4f')](_0x21aa9f)['then'](handleEntityNotFound(_0x4ec2a1,null))['then'](respondWithResult(_0x4ec2a1,null))['catch'](handleError(_0x4ec2a1,null));};exports[_0x23f2('0x50')]=function(_0x2c7640,_0x1a9806){return db[_0x23f2('0x37')][_0x23f2('0x50')](_0x2c7640[_0x23f2('0x51')],{})['then'](respondWithResult(_0x1a9806,0xc9))[_0x23f2('0x25')](handleError(_0x1a9806,null));};exports[_0x23f2('0x52')]=function(_0x928b70,_0x511294){if(_0x928b70[_0x23f2('0x51')]['id']){delete _0x928b70[_0x23f2('0x51')]['id'];}return db[_0x23f2('0x37')]['find']({'where':{'id':_0x928b70['params']['id']}})[_0x23f2('0x1c')](handleEntityNotFound(_0x511294,null))['then'](saveUpdates(_0x928b70[_0x23f2('0x51')],null))[_0x23f2('0x1c')](respondWithResult(_0x511294,null))[_0x23f2('0x25')](handleError(_0x511294,null));};exports['destroy']=function(_0x379504,_0x48429f){return db[_0x23f2('0x37')][_0x23f2('0x4f')]({'where':{'id':_0x379504['params']['id']}})[_0x23f2('0x1c')](handleEntityNotFound(_0x48429f,null))[_0x23f2('0x1c')](removeEntity(_0x48429f,null))[_0x23f2('0x25')](handleError(_0x48429f,null));};exports[_0x23f2('0x53')]=function(_0x2ec9dd,_0x4a05ba,_0x19390b){var _0x277066={};var _0xb1b662={};var _0x42089d;var _0x45b4ae;return db[_0x23f2('0x37')][_0x23f2('0x54')]({'where':{'id':_0x2ec9dd[_0x23f2('0x55')]['id']}})[_0x23f2('0x1c')](handleEntityNotFound(_0x4a05ba,null))[_0x23f2('0x1c')](function(_0x35cba6){if(_0x35cba6){_0x42089d=_0x35cba6;_0xb1b662[_0x23f2('0x3e')]=_['keys'](db[_0x23f2('0x56')][_0x23f2('0x4c')]);_0xb1b662['query']=_[_0x23f2('0x3c')](_0x2ec9dd[_0x23f2('0x3b')]);_0xb1b662[_0x23f2('0x44')]=_[_0x23f2('0x3d')](_0xb1b662['model'],_0xb1b662[_0x23f2('0x3b')]);_0x277066[_0x23f2('0x3f')]=_[_0x23f2('0x3d')](_0xb1b662[_0x23f2('0x3e')],qs[_0x23f2('0x40')](_0x2ec9dd[_0x23f2('0x3b')][_0x23f2('0x40')]));_0x277066['attributes']=_0x277066[_0x23f2('0x3f')][_0x23f2('0x4d')]?_0x277066[_0x23f2('0x3f')]:_0xb1b662[_0x23f2('0x3e')];_0x277066[_0x23f2('0x41')]=qs[_0x23f2('0x42')](_0x2ec9dd[_0x23f2('0x3b')][_0x23f2('0x42')]);_0x277066[_0x23f2('0x43')]=qs[_0x23f2('0x44')](_[_0x23f2('0x45')](_0x2ec9dd[_0x23f2('0x3b')],_0xb1b662[_0x23f2('0x44')]));if(_0x2ec9dd['query'][_0x23f2('0x46')]){_0x277066[_0x23f2('0x43')]=_[_0x23f2('0x47')](_0x277066[_0x23f2('0x43')],{'$or':_['map'](_0x277066['attributes'],function(_0x11a7de){var _0x59a0b2={};_0x59a0b2[_0x11a7de]={'$like':'%'+_0x2ec9dd[_0x23f2('0x3b')]['filter']+'%'};return _0x59a0b2;})});}_0x277066=_[_0x23f2('0x47')]({},_0x277066,_0x2ec9dd['options']);return _0x42089d[_0x23f2('0x53')](_0x277066);}})[_0x23f2('0x1c')](function(_0x2ba9ec){if(_0x2ba9ec){_0x45b4ae=_0x2ba9ec[_0x23f2('0x4d')];if(!_0x2ec9dd[_0x23f2('0x3b')][_0x23f2('0x57')]('nolimit')){_0x277066[_0x23f2('0x2c')]=qs['limit'](_0x2ec9dd[_0x23f2('0x3b')][_0x23f2('0x2c')]);_0x277066['offset']=qs[_0x23f2('0x2b')](_0x2ec9dd[_0x23f2('0x3b')][_0x23f2('0x2b')]);}return _0x42089d[_0x23f2('0x53')](_0x277066);}})[_0x23f2('0x1c')](function(_0x3e92d2){if(_0x3e92d2){return _0x3e92d2?{'count':_0x45b4ae,'rows':_0x3e92d2}:null;}})[_0x23f2('0x1c')](respondWithResult(_0x4a05ba,null))['catch'](handleError(_0x4a05ba,null));};exports[_0x23f2('0x58')]=function(_0x2ee60c,_0x4db2f2,_0x235ca9){if(_0x2ee60c[_0x23f2('0x51')]['id']){delete _0x2ee60c[_0x23f2('0x51')]['id'];}return db[_0x23f2('0x37')]['findOne']({'where':{'id':_0x2ee60c[_0x23f2('0x55')]['id']}})[_0x23f2('0x1c')](handleEntityNotFound(_0x4db2f2,null))[_0x23f2('0x1c')](function(_0x158659){if(_0x158659){_0x2ee60c[_0x23f2('0x51')][_0x23f2('0x59')]=_0x158659['id'];_0x2ee60c[_0x23f2('0x51')][_0x23f2('0x5a')]=integrations[_0x23f2('0x5b')](_0x2ee60c[_0x23f2('0x51')]['channel'],_0x2ee60c[_0x23f2('0x51')]['type']);_0x2ee60c[_0x23f2('0x51')]['Descriptions']=integrations[_0x23f2('0x5c')](_0x2ee60c[_0x23f2('0x51')][_0x23f2('0x5d')],_0x2ee60c[_0x23f2('0x51')][_0x23f2('0x39')]);return db[_0x23f2('0x56')][_0x23f2('0x50')](_0x2ee60c[_0x23f2('0x51')],{'include':[{'model':db[_0x23f2('0x5e')],'as':_0x23f2('0x5a')},{'model':db['ZohoField'],'as':_0x23f2('0x5f')}]});}return null;})[_0x23f2('0x1c')](respondWithResult(_0x4db2f2,null))[_0x23f2('0x25')](handleError(_0x4db2f2,null));};function getAccessToken(_0xb021ef){return new Promise(function(_0x5c91e2,_0x55579a){var _0x41905f;switch(_0xb021ef[_0x23f2('0x60')]){case'US':_0x41905f=_0x23f2('0x61');break;case'AU':_0x41905f=_0x23f2('0x62');break;case'EU':_0x41905f=_0x23f2('0x63');break;case'IN':_0x41905f=_0x23f2('0x64');break;case'CN':_0x41905f=_0x23f2('0x65');break;default:_0x41905f=_0x23f2('0x63');break;}var _0x3f4d4b={'method':'POST','uri':_0x41905f+'/oauth/v2/token','qs':{'refresh_token':_0xb021ef[_0x23f2('0x66')],'client_id':_0xb021ef[_0x23f2('0x67')],'client_secret':_0xb021ef[_0x23f2('0x68')],'grant_type':_0x23f2('0x69')},'json':!![]};return rp(_0x3f4d4b)[_0x23f2('0x1c')](function(_0x372575){if(_0x372575[_0x23f2('0x6a')]){_0x5c91e2(_0x372575[_0x23f2('0x6a')]);}else{_0x55579a(_0x23f2('0x6b'));}})[_0x23f2('0x25')](function(_0xd78e00){_0x55579a(_0xd78e00);});});}exports[_0x23f2('0x6c')]=function(_0x22b793,_0x3657fd,_0x2aab8f){var _0x5cc86b,_0x5ab4e7,_0x5163a4,_0x527218,_0x4482cc;return db['ZohoAccount'][_0x23f2('0x54')]({'where':{'id':_0x22b793[_0x23f2('0x55')]['id']},'attributes':['id',_0x23f2('0x6d'),_0x23f2('0x60'),_0x23f2('0x67'),_0x23f2('0x68'),'serverUrl',_0x23f2('0x21'),_0x23f2('0x66')]})[_0x23f2('0x1c')](handleEntityNotFound(_0x3657fd,null))[_0x23f2('0x1c')](function(_0x19dcc7){_0x4482cc=_0x19dcc7;_0x5cc86b=_0x4482cc['host'];_0x5ab4e7=_0x5cc86b===_0x23f2('0x6e')?'eu':_0x23f2('0x6f');_0x5163a4=_0x4482cc['serverUrl'];var _0x3c1e9f=_0x5163a4[_0x23f2('0x70')](-0x1);if(_0x3c1e9f==='/'||_0x3c1e9f==='\x5c'||_0x3c1e9f===':'){_0x5163a4=_0x5163a4[_0x23f2('0x71')](0x0,_0x5163a4['lastIndexOf'](_0x3c1e9f));}if(!_0x4482cc[_0x23f2('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4482cc);})[_0x23f2('0x1c')](function(_0x449c81){if(_0x449c81){return rp({'method':_0x23f2('0x72'),'uri':util[_0x23f2('0x73')](_0x23f2('0x74'),_0x5ab4e7),'qs':{'module':'Calls'},'headers':{'Authorization':_0x23f2('0x75')+_0x449c81},'json':!![]});}})['then'](function(_0x11057a){if(_0x11057a){if(_0x11057a[_0x23f2('0x76')]&&_0x11057a[_0x23f2('0x76')][_0x23f2('0x20')]){throw new Error(_0x11057a[_0x23f2('0x76')]['error'][_0x23f2('0x23')]);}var _0x1caad8=[];var _0xfc04f5=[];var _0x2e63bb=[_0x23f2('0x77'),_0x23f2('0x78'),_0x23f2('0x79'),_0x23f2('0x7a'),_0x23f2('0x7b'),'Call_Result','Call_Start_Time',_0x23f2('0x7c')];_0xfc04f5=_[_0x23f2('0x7d')](_0x11057a[_0x23f2('0x40')],function(_0x2cbf40){return _0x2e63bb['includes'](_0x2cbf40[_0x23f2('0x7e')]);});for(var _0x2ee7a2=0x0;_0x2ee7a2<_0xfc04f5['length'];_0x2ee7a2++){if(_0xfc04f5[_0x2ee7a2][_0x23f2('0x7f')]===![]){_0x1caad8[_0x23f2('0x80')]({'id':_0xfc04f5[_0x2ee7a2]['id'],'name':_0xfc04f5[_0x2ee7a2][_0x23f2('0x81')],'custom':_0xfc04f5[_0x2ee7a2][_0x23f2('0x82')],'options':_0xfc04f5[_0x2ee7a2][_0x23f2('0x83')]===_0x23f2('0x84')&&_0xfc04f5[_0x2ee7a2][_0x23f2('0x85')][_0x23f2('0x4d')]>-0x1?_[_0x23f2('0x36')](_0xfc04f5[_0x2ee7a2]['pick_list_values'],function(_0x2cd1ad){return{'name':_0x2cd1ad,'value':_0x2cd1ad};}):[]});}}return{'count':_0x1caad8[_0x23f2('0x4d')],'rows':_0x1caad8};}else{return{'count':0x0,'rows':[]};}})[_0x23f2('0x1c')](respondWithResult(_0x3657fd,null))['catch'](function(_0x3820be){var _0x138ba5=_0x22b793[_0x23f2('0x3b')][_0x23f2('0x19')]?0x1f4:_0x3820be['statusCode']||0x1f4;logger[_0x23f2('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x23f2('0x6c'),_0x138ba5,JSON[_0x23f2('0x1f')](_0x3820be));delete _0x3820be[_0x23f2('0x34')];if(_0x138ba5===0x191){_0x138ba5=0x190;}_0x3657fd[_0x23f2('0x27')](_0x138ba5)['send'](_0x22b793[_0x23f2('0x3b')][_0x23f2('0x19')]?{'message':_0x23f2('0x86'),'statusCode':_0x3820be[_0x23f2('0x87')]}:_0x3820be);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 053a8eb..cf5bbcc 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 _0xbb25=['then','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbb25,0x85));var _0x5bb2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb25[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5bb2('0x0'));var logger=require(_0x5bb2('0x1'))(_0x5bb2('0x2'));var moment=require(_0x5bb2('0x3'));var BPromise=require(_0x5bb2('0x4'));var rp=require(_0x5bb2('0x5'));var fs=require('fs');var path=require(_0x5bb2('0x6'));var rimraf=require(_0x5bb2('0x7'));var config=require('../../config/environment');var attributes=require(_0x5bb2('0x8'));var integrations=require(_0x5bb2('0x9'));module[_0x5bb2('0xa')]=function(_0x790068,_0x4f9f2d){return _0x790068[_0x5bb2('0xb')]('ZohoAccount',attributes,{'tableName':_0x5bb2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x295e3c,_0x38d922,_0xd095b7){if(_0x295e3c[_0x5bb2('0xd')](_0x5bb2('0xe'))||_0x295e3c[_0x5bb2('0xd')](_0x5bb2('0xf'))||_0x295e3c[_0x5bb2('0xd')](_0x5bb2('0x10'))||_0x295e3c[_0x5bb2('0xd')](_0x5bb2('0x11'))||_0x295e3c[_0x5bb2('0xd')](_0x5bb2('0x12'))||_0x295e3c[_0x5bb2('0xd')](_0x5bb2('0x13'))){var _0x504fec,_0x2b915d;_0x504fec=_0x295e3c[_0x5bb2('0xf')];var _0x281439=_0x504fec[_0x5bb2('0x14')](-0x1);if(_0x281439==='/'||_0x281439==='\x5c'||_0x281439===':'){_0x504fec=_0x504fec[_0x5bb2('0x15')](0x0,_0x504fec[_0x5bb2('0x16')](_0x281439));}switch(_0x295e3c[_0x5bb2('0xe')]){case'US':_0x2b915d='https://accounts.zoho.com';break;case'AU':_0x2b915d=_0x5bb2('0x17');break;case'IN':_0x2b915d=_0x5bb2('0x18');break;case'CN':_0x2b915d=_0x5bb2('0x19');break;default:_0x2b915d=_0x5bb2('0x1a');break;}var _0x582b37={'method':_0x5bb2('0x1b'),'uri':_0x2b915d+_0x5bb2('0x1c'),'form':{'grant_type':_0x5bb2('0x1d'),'client_id':_0x295e3c[_0x5bb2('0x10')],'client_secret':_0x295e3c['clientSecret'],'redirect_uri':_0x295e3c[_0x5bb2('0xf')],'code':_0x295e3c['code']},'headers':{'Content-Type':_0x5bb2('0x1e')}};return rp(_0x582b37)['then'](function(_0x3b4646){var _0x44fee2=JSON[_0x5bb2('0x1f')](_0x3b4646);if(_0x44fee2[_0x5bb2('0x20')]){_0x295e3c[_0x5bb2('0x21')]=_0x44fee2[_0x5bb2('0x20')];logger[_0x5bb2('0x22')](util[_0x5bb2('0x23')](_0x5bb2('0x24'),_0x295e3c[_0x5bb2('0x25')],_0x295e3c['id']));}else{logger[_0x5bb2('0x26')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x295e3c[_0x5bb2('0x25')],_0x295e3c['id']),util[_0x5bb2('0x27')](_0x44fee2,{'showHidden':![],'depth':null}));}return _0xd095b7(null,_0x38d922);})[_0x5bb2('0x28')](function(_0x2917a0){logger[_0x5bb2('0x26')](util['format'](_0x5bb2('0x29'),_0x295e3c[_0x5bb2('0x25')],_0x295e3c['id']),util[_0x5bb2('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0xd095b7(_0x2917a0);});}else{return _0xd095b7(null,_0x38d922);}},'beforeUpdate':function(_0x187d77,_0x28d810,_0x213669){if(_0x187d77['changed'](_0x5bb2('0xe'))||_0x187d77[_0x5bb2('0xd')](_0x5bb2('0xf'))||_0x187d77[_0x5bb2('0xd')]('clientId')||_0x187d77[_0x5bb2('0xd')](_0x5bb2('0x11'))||_0x187d77[_0x5bb2('0xd')]('code')||_0x187d77[_0x5bb2('0xd')](_0x5bb2('0x13'))){var _0x28440b,_0x296839;_0x28440b=_0x187d77[_0x5bb2('0xf')];var _0x58933d=_0x28440b[_0x5bb2('0x14')](-0x1);if(_0x58933d==='/'||_0x58933d==='\x5c'||_0x58933d===':'){_0x28440b=_0x28440b[_0x5bb2('0x15')](0x0,_0x28440b['lastIndexOf'](_0x58933d));}switch(_0x187d77[_0x5bb2('0xe')]){case'US':_0x296839=_0x5bb2('0x2a');break;case'AU':_0x296839=_0x5bb2('0x17');break;case'IN':_0x296839=_0x5bb2('0x18');break;case'CN':_0x296839='https://accounts.zoho.com.cn';break;default:_0x296839=_0x5bb2('0x1a');break;}var _0x4f8f61={'method':'POST','uri':_0x296839+_0x5bb2('0x1c'),'form':{'grant_type':_0x5bb2('0x1d'),'client_id':_0x187d77[_0x5bb2('0x10')],'client_secret':_0x187d77['clientSecret'],'redirect_uri':_0x187d77[_0x5bb2('0xf')],'code':_0x187d77[_0x5bb2('0x12')]},'headers':{'Content-Type':_0x5bb2('0x1e')}};return rp(_0x4f8f61)[_0x5bb2('0x2b')](function(_0x5b7988){var _0x170a38=JSON[_0x5bb2('0x1f')](_0x5b7988);if(_0x170a38[_0x5bb2('0x20')]){_0x187d77[_0x5bb2('0x21')]=_0x170a38[_0x5bb2('0x20')];logger[_0x5bb2('0x22')](util[_0x5bb2('0x23')](_0x5bb2('0x24'),_0x187d77[_0x5bb2('0x25')],_0x187d77['id']));}else{logger[_0x5bb2('0x26')](util[_0x5bb2('0x23')](_0x5bb2('0x29'),_0x187d77[_0x5bb2('0x25')],_0x187d77['id']),util[_0x5bb2('0x27')](_0x170a38,{'showHidden':![],'depth':null}));}return _0x213669(null,_0x28d810);})[_0x5bb2('0x28')](function(_0x2f49b7){logger[_0x5bb2('0x26')](util[_0x5bb2('0x23')](_0x5bb2('0x29'),_0x187d77['name'],_0x187d77['id']),util[_0x5bb2('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x213669(_0x2f49b7);});}else{return _0x213669(null,_0x28d810);}}}});}; \ No newline at end of file +var _0x2831=['catch','inspect','https://accounts.zoho.com.au','https://accounts.zoho.in','then','lodash','util','../../config/logger','api','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','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'];(function(_0x19f048,_0x4fe3fa){var _0xda5df8=function(_0x2529dd){while(--_0x2529dd){_0x19f048['push'](_0x19f048['shift']());}};_0xda5df8(++_0x4fe3fa);}(_0x2831,0x1cd));var _0x1283=function(_0x356cd6,_0x362338){_0x356cd6=_0x356cd6-0x0;var _0x4f3745=_0x2831[_0x356cd6];return _0x4f3745;};'use strict';var _=require(_0x1283('0x0'));var util=require(_0x1283('0x1'));var logger=require(_0x1283('0x2'))(_0x1283('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1283('0x4'));var fs=require('fs');var path=require(_0x1283('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1283('0x6'));var integrations=require(_0x1283('0x7'));module['exports']=function(_0x223a0d,_0x44f122){return _0x223a0d['define'](_0x1283('0x8'),attributes,{'tableName':_0x1283('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1676af,_0x3698bb,_0x42bf49){if(_0x1676af[_0x1283('0xa')](_0x1283('0xb'))||_0x1676af[_0x1283('0xa')](_0x1283('0xc'))||_0x1676af['changed'](_0x1283('0xd'))||_0x1676af[_0x1283('0xa')](_0x1283('0xe'))||_0x1676af[_0x1283('0xa')](_0x1283('0xf'))||_0x1676af[_0x1283('0xa')]('host')){var _0x540653,_0x4ca246;_0x540653=_0x1676af['serverUrl'];var _0x2eb0d7=_0x540653[_0x1283('0x10')](-0x1);if(_0x2eb0d7==='/'||_0x2eb0d7==='\x5c'||_0x2eb0d7===':'){_0x540653=_0x540653[_0x1283('0x11')](0x0,_0x540653['lastIndexOf'](_0x2eb0d7));}switch(_0x1676af[_0x1283('0xb')]){case'US':_0x4ca246=_0x1283('0x12');break;case'AU':_0x4ca246='https://accounts.zoho.com.au';break;case'IN':_0x4ca246='https://accounts.zoho.in';break;case'CN':_0x4ca246=_0x1283('0x13');break;default:_0x4ca246=_0x1283('0x14');break;}var _0x41276a={'method':_0x1283('0x15'),'uri':_0x4ca246+_0x1283('0x16'),'form':{'grant_type':_0x1283('0x17'),'client_id':_0x1676af['clientId'],'client_secret':_0x1676af['clientSecret'],'redirect_uri':_0x1676af['serverUrl'],'code':_0x1676af[_0x1283('0xf')]},'headers':{'Content-Type':_0x1283('0x18')}};return rp(_0x41276a)['then'](function(_0x332501){var _0x2b8bd1=JSON[_0x1283('0x19')](_0x332501);if(_0x2b8bd1[_0x1283('0x1a')]){_0x1676af[_0x1283('0x1b')]=_0x2b8bd1[_0x1283('0x1a')];logger['info'](util[_0x1283('0x1c')](_0x1283('0x1d'),_0x1676af[_0x1283('0x1e')],_0x1676af['id']));}else{logger[_0x1283('0x1f')](util[_0x1283('0x1c')](_0x1283('0x20'),_0x1676af[_0x1283('0x1e')],_0x1676af['id']),util['inspect'](_0x2b8bd1,{'showHidden':![],'depth':null}));}return _0x42bf49(null,_0x3698bb);})[_0x1283('0x21')](function(_0x5c6f9b){logger[_0x1283('0x1f')](util[_0x1283('0x1c')](_0x1283('0x20'),_0x1676af[_0x1283('0x1e')],_0x1676af['id']),util[_0x1283('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x42bf49(_0x5c6f9b);});}else{return _0x42bf49(null,_0x3698bb);}},'beforeUpdate':function(_0x1e97e3,_0x414bea,_0x29301b){if(_0x1e97e3[_0x1283('0xa')](_0x1283('0xb'))||_0x1e97e3['changed'](_0x1283('0xc'))||_0x1e97e3['changed'](_0x1283('0xd'))||_0x1e97e3[_0x1283('0xa')]('clientSecret')||_0x1e97e3[_0x1283('0xa')](_0x1283('0xf'))||_0x1e97e3[_0x1283('0xa')]('host')){var _0x449466,_0x126ea0;_0x449466=_0x1e97e3[_0x1283('0xc')];var _0x50ca6c=_0x449466[_0x1283('0x10')](-0x1);if(_0x50ca6c==='/'||_0x50ca6c==='\x5c'||_0x50ca6c===':'){_0x449466=_0x449466[_0x1283('0x11')](0x0,_0x449466['lastIndexOf'](_0x50ca6c));}switch(_0x1e97e3[_0x1283('0xb')]){case'US':_0x126ea0=_0x1283('0x12');break;case'AU':_0x126ea0=_0x1283('0x23');break;case'IN':_0x126ea0=_0x1283('0x24');break;case'CN':_0x126ea0='https://accounts.zoho.com.cn';break;default:_0x126ea0=_0x1283('0x14');break;}var _0x587008={'method':_0x1283('0x15'),'uri':_0x126ea0+_0x1283('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x1e97e3['clientId'],'client_secret':_0x1e97e3[_0x1283('0xe')],'redirect_uri':_0x1e97e3[_0x1283('0xc')],'code':_0x1e97e3[_0x1283('0xf')]},'headers':{'Content-Type':_0x1283('0x18')}};return rp(_0x587008)[_0x1283('0x25')](function(_0x3fd0fd){var _0x204023=JSON[_0x1283('0x19')](_0x3fd0fd);if(_0x204023[_0x1283('0x1a')]){_0x1e97e3[_0x1283('0x1b')]=_0x204023[_0x1283('0x1a')];logger['info'](util[_0x1283('0x1c')](_0x1283('0x1d'),_0x1e97e3['name'],_0x1e97e3['id']));}else{logger[_0x1283('0x1f')](util[_0x1283('0x1c')](_0x1283('0x20'),_0x1e97e3[_0x1283('0x1e')],_0x1e97e3['id']),util[_0x1283('0x22')](_0x204023,{'showHidden':![],'depth':null}));}return _0x29301b(null,_0x414bea);})[_0x1283('0x21')](function(_0x1ec4ed){logger[_0x1283('0x1f')](util[_0x1283('0x1c')](_0x1283('0x20'),_0x1e97e3['name'],_0x1e97e3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x29301b(_0x1ec4ed);});}else{return _0x29301b(null,_0x414bea);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1da62d0..c400b21 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 _0x1b5b=['catch','ZohoAccount','findAll','options','raw','where','limit','include','model','attributes','map','GetZohoAccount','ShowZohoAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result'];(function(_0x4207a6,_0x3a3110){var _0x42b37a=function(_0x574360){while(--_0x574360){_0x4207a6['push'](_0x4207a6['shift']());}};_0x42b37a(++_0x3a3110);}(_0x1b5b,0x74));var _0xb1b5=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x1b5b[_0x364a36];return _0x5cd6fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb1b5('0x0'));var rs=require(_0xb1b5('0x1'));var fs=require('fs');var Redis=require(_0xb1b5('0x2'));var db=require(_0xb1b5('0x3'))['db'];var utils=require(_0xb1b5('0x4'));var logger=require(_0xb1b5('0x5'))(_0xb1b5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1b5('0x7')][_0xb1b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48dd61,_0x10fb16,_0x758f11){return new BPromise(function(_0xe1260f,_0x52942a){return client['request'](_0x48dd61,_0x758f11)[_0xb1b5('0x9')](function(_0x27892f){logger[_0xb1b5('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x10fb16,_0xb1b5('0xb'));logger[_0xb1b5('0xc')](_0xb1b5('0xd'),_0x10fb16,_0xb1b5('0xb'),JSON[_0xb1b5('0xe')](_0x27892f));if(_0x27892f[_0xb1b5('0xf')]){if(_0x27892f[_0xb1b5('0xf')][_0xb1b5('0x10')]===0x1f4){logger['error'](_0xb1b5('0x11'),_0x10fb16,_0x27892f[_0xb1b5('0xf')][_0xb1b5('0x12')]);return _0x52942a(_0x27892f['error'][_0xb1b5('0x12')]);}logger['error'](_0xb1b5('0x11'),_0x10fb16,_0x27892f[_0xb1b5('0xf')][_0xb1b5('0x12')]);return _0xe1260f(_0x27892f[_0xb1b5('0xf')][_0xb1b5('0x12')]);}else{logger[_0xb1b5('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x10fb16,'request\x20sent');_0xe1260f(_0x27892f[_0xb1b5('0x13')][_0xb1b5('0x12')]);}})[_0xb1b5('0x14')](function(_0x57b8f8){logger[_0xb1b5('0xf')](_0xb1b5('0x11'),_0x10fb16,_0x57b8f8);_0x52942a(_0x57b8f8);});});}exports['GetZohoAccount']=function(_0xbf2994){var _0x1edc1c=this;return new Promise(function(_0x1a8405,_0x58a395){return db[_0xb1b5('0x15')][_0xb1b5('0x16')]({'raw':_0xbf2994[_0xb1b5('0x17')]?_0xbf2994['options'][_0xb1b5('0x18')]===undefined?!![]:![]:!![],'where':_0xbf2994[_0xb1b5('0x17')]?_0xbf2994[_0xb1b5('0x17')][_0xb1b5('0x19')]||null:null,'attributes':_0xbf2994[_0xb1b5('0x17')]?_0xbf2994[_0xb1b5('0x17')]['attributes']||null:null,'limit':_0xbf2994['options']?_0xbf2994[_0xb1b5('0x17')][_0xb1b5('0x1a')]||null:null,'include':_0xbf2994[_0xb1b5('0x17')]?_0xbf2994[_0xb1b5('0x17')][_0xb1b5('0x1b')]?_['map'](_0xbf2994[_0xb1b5('0x17')]['include'],function(_0x55bb60){return{'model':db[_0x55bb60[_0xb1b5('0x1c')]],'as':_0x55bb60['as'],'attributes':_0x55bb60[_0xb1b5('0x1d')],'include':_0x55bb60[_0xb1b5('0x1b')]?_[_0xb1b5('0x1e')](_0x55bb60[_0xb1b5('0x1b')],function(_0x2d17d4){return{'model':db[_0x2d17d4[_0xb1b5('0x1c')]],'as':_0x2d17d4['as'],'attributes':_0x2d17d4['attributes'],'include':_0x2d17d4[_0xb1b5('0x1b')]?_[_0xb1b5('0x1e')](_0x2d17d4[_0xb1b5('0x1b')],function(_0x2f62fb){return{'model':db[_0x2f62fb[_0xb1b5('0x1c')]],'as':_0x2f62fb['as'],'attributes':_0x2f62fb[_0xb1b5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e3085){logger[_0xb1b5('0xa')](_0xb1b5('0x1f'),_0xbf2994);logger[_0xb1b5('0xc')](_0xb1b5('0x1f'),_0xbf2994,JSON[_0xb1b5('0xe')](_0x5e3085));_0x1a8405(_0x5e3085);})[_0xb1b5('0x14')](function(_0x29f71f){logger[_0xb1b5('0xf')](_0xb1b5('0x1f'),_0x29f71f[_0xb1b5('0x12')],_0xbf2994);_0x58a395(_0x1edc1c[_0xb1b5('0xf')](0x1f4,_0x29f71f[_0xb1b5('0x12')]));});});};exports[_0xb1b5('0x20')]=function(_0x59cf7f){var _0x148408=this;return new Promise(function(_0x1469d,_0x411814){return db[_0xb1b5('0x15')][_0xb1b5('0x21')]({'raw':_0x59cf7f[_0xb1b5('0x17')]?_0x59cf7f[_0xb1b5('0x17')][_0xb1b5('0x18')]===undefined?!![]:![]:!![],'where':_0x59cf7f['options']?_0x59cf7f[_0xb1b5('0x17')][_0xb1b5('0x19')]||null:null,'attributes':_0x59cf7f[_0xb1b5('0x17')]?_0x59cf7f[_0xb1b5('0x17')][_0xb1b5('0x1d')]||null:null,'include':_0x59cf7f[_0xb1b5('0x17')]?_0x59cf7f[_0xb1b5('0x17')][_0xb1b5('0x1b')]?_[_0xb1b5('0x1e')](_0x59cf7f[_0xb1b5('0x17')][_0xb1b5('0x1b')],function(_0x4eab19){return{'model':db[_0x4eab19[_0xb1b5('0x1c')]],'as':_0x4eab19['as'],'attributes':_0x4eab19[_0xb1b5('0x1d')],'include':_0x4eab19['include']?_[_0xb1b5('0x1e')](_0x4eab19[_0xb1b5('0x1b')],function(_0x17edce){return{'model':db[_0x17edce[_0xb1b5('0x1c')]],'as':_0x17edce['as'],'attributes':_0x17edce[_0xb1b5('0x1d')],'include':_0x17edce[_0xb1b5('0x1b')]?_[_0xb1b5('0x1e')](_0x17edce[_0xb1b5('0x1b')],function(_0x1d9af5){return{'model':db[_0x1d9af5[_0xb1b5('0x1c')]],'as':_0x1d9af5['as'],'attributes':_0x1d9af5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1b5('0x9')](function(_0x547f6b){logger[_0xb1b5('0xa')](_0xb1b5('0x20'),_0x59cf7f);logger[_0xb1b5('0xc')](_0xb1b5('0x20'),_0x59cf7f,JSON[_0xb1b5('0xe')](_0x547f6b));_0x1469d(_0x547f6b);})[_0xb1b5('0x14')](function(_0x55ca7a){logger[_0xb1b5('0xf')](_0xb1b5('0x20'),_0x55ca7a['message'],_0x59cf7f);_0x411814(_0x148408[_0xb1b5('0xf')](0x1f4,_0x55ca7a['message']));});});}; \ No newline at end of file +var _0x7ef3=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x153846,_0x1227ad){var _0x3ee557=function(_0x514e76){while(--_0x514e76){_0x153846['push'](_0x153846['shift']());}};_0x3ee557(++_0x1227ad);}(_0x7ef3,0x106));var _0x37ef=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7ef3[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x37ef('0x0'));var util=require(_0x37ef('0x1'));var moment=require(_0x37ef('0x2'));var BPromise=require(_0x37ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x37ef('0x4'));var logger=require(_0x37ef('0x5'))(_0x37ef('0x6'));var config=require(_0x37ef('0x7'));var jayson=require(_0x37ef('0x8'));var client=jayson[_0x37ef('0x9')][_0x37ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x326584,_0x2b2f36,_0x5acabf){return new BPromise(function(_0x14e472,_0x2d7309){return client[_0x37ef('0xb')](_0x326584,_0x5acabf)[_0x37ef('0xc')](function(_0x501ef4){logger[_0x37ef('0xd')](_0x37ef('0xe'),_0x2b2f36,'request\x20sent');logger[_0x37ef('0xf')](_0x37ef('0x10'),_0x2b2f36,_0x37ef('0x11'),JSON['stringify'](_0x501ef4));if(_0x501ef4['error']){if(_0x501ef4['error'][_0x37ef('0x12')]===0x1f4){logger[_0x37ef('0x13')](_0x37ef('0xe'),_0x2b2f36,_0x501ef4['error'][_0x37ef('0x14')]);return _0x2d7309(_0x501ef4[_0x37ef('0x13')]['message']);}logger[_0x37ef('0x13')](_0x37ef('0xe'),_0x2b2f36,_0x501ef4[_0x37ef('0x13')][_0x37ef('0x14')]);return _0x14e472(_0x501ef4[_0x37ef('0x13')][_0x37ef('0x14')]);}else{logger[_0x37ef('0xd')](_0x37ef('0xe'),_0x2b2f36,_0x37ef('0x11'));_0x14e472(_0x501ef4[_0x37ef('0x15')][_0x37ef('0x14')]);}})[_0x37ef('0x16')](function(_0x29789f){logger[_0x37ef('0x13')](_0x37ef('0xe'),_0x2b2f36,_0x29789f);_0x2d7309(_0x29789f);});});}exports[_0x37ef('0x17')]=function(_0x458328){var _0x1f6120=this;return new Promise(function(_0x54cf92,_0x7996ba){return db[_0x37ef('0x18')][_0x37ef('0x19')]({'raw':_0x458328['options']?_0x458328[_0x37ef('0x1a')][_0x37ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x458328[_0x37ef('0x1a')]?_0x458328['options'][_0x37ef('0x1c')]||null:null,'attributes':_0x458328[_0x37ef('0x1a')]?_0x458328[_0x37ef('0x1a')][_0x37ef('0x1d')]||null:null,'limit':_0x458328[_0x37ef('0x1a')]?_0x458328[_0x37ef('0x1a')][_0x37ef('0x1e')]||null:null,'include':_0x458328['options']?_0x458328[_0x37ef('0x1a')][_0x37ef('0x1f')]?_[_0x37ef('0x20')](_0x458328[_0x37ef('0x1a')][_0x37ef('0x1f')],function(_0x21981d){return{'model':db[_0x21981d[_0x37ef('0x21')]],'as':_0x21981d['as'],'attributes':_0x21981d[_0x37ef('0x1d')],'include':_0x21981d[_0x37ef('0x1f')]?_[_0x37ef('0x20')](_0x21981d[_0x37ef('0x1f')],function(_0x466abf){return{'model':db[_0x466abf[_0x37ef('0x21')]],'as':_0x466abf['as'],'attributes':_0x466abf[_0x37ef('0x1d')],'include':_0x466abf['include']?_[_0x37ef('0x20')](_0x466abf['include'],function(_0x34ba4a){return{'model':db[_0x34ba4a[_0x37ef('0x21')]],'as':_0x34ba4a['as'],'attributes':_0x34ba4a[_0x37ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x37ef('0xc')](function(_0x5386be){logger[_0x37ef('0xd')](_0x37ef('0x17'),_0x458328);logger[_0x37ef('0xf')]('GetZohoAccount',_0x458328,JSON[_0x37ef('0x22')](_0x5386be));_0x54cf92(_0x5386be);})[_0x37ef('0x16')](function(_0xbd4ca5){logger[_0x37ef('0x13')](_0x37ef('0x17'),_0xbd4ca5['message'],_0x458328);_0x7996ba(_0x1f6120[_0x37ef('0x13')](0x1f4,_0xbd4ca5[_0x37ef('0x14')]));});});};exports[_0x37ef('0x23')]=function(_0x26e72f){var _0x265180=this;return new Promise(function(_0x5304de,_0x555442){return db['ZohoAccount']['find']({'raw':_0x26e72f[_0x37ef('0x1a')]?_0x26e72f[_0x37ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x26e72f[_0x37ef('0x1a')]?_0x26e72f[_0x37ef('0x1a')][_0x37ef('0x1c')]||null:null,'attributes':_0x26e72f[_0x37ef('0x1a')]?_0x26e72f[_0x37ef('0x1a')][_0x37ef('0x1d')]||null:null,'include':_0x26e72f[_0x37ef('0x1a')]?_0x26e72f[_0x37ef('0x1a')][_0x37ef('0x1f')]?_['map'](_0x26e72f[_0x37ef('0x1a')][_0x37ef('0x1f')],function(_0x5af4f3){return{'model':db[_0x5af4f3[_0x37ef('0x21')]],'as':_0x5af4f3['as'],'attributes':_0x5af4f3['attributes'],'include':_0x5af4f3[_0x37ef('0x1f')]?_[_0x37ef('0x20')](_0x5af4f3[_0x37ef('0x1f')],function(_0x5c5d20){return{'model':db[_0x5c5d20[_0x37ef('0x21')]],'as':_0x5c5d20['as'],'attributes':_0x5c5d20['attributes'],'include':_0x5c5d20['include']?_['map'](_0x5c5d20[_0x37ef('0x1f')],function(_0xbafb3c){return{'model':db[_0xbafb3c['model']],'as':_0xbafb3c['as'],'attributes':_0xbafb3c[_0x37ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x37ef('0xc')](function(_0x195f09){logger[_0x37ef('0xd')](_0x37ef('0x23'),_0x26e72f);logger[_0x37ef('0xf')](_0x37ef('0x23'),_0x26e72f,JSON['stringify'](_0x195f09));_0x5304de(_0x195f09);})['catch'](function(_0x1a1631){logger[_0x37ef('0x13')](_0x37ef('0x23'),_0x1a1631[_0x37ef('0x14')],_0x26e72f);_0x555442(_0x265180['error'](0x1f4,_0x1a1631['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1a9d497..23b9f3a 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 _0xc2e8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','/:id','update','delete','destroy','multer','util'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xc2e8,0x70));var _0x8c2e=function(_0x333a1a,_0x38ce54){_0x333a1a=_0x333a1a-0x0;var _0xa56834=_0xc2e8[_0x333a1a];return _0xa56834;};'use strict';var multer=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c2e('0x2'));var router=express['Router']();var auth=require(_0x8c2e('0x3'));var interaction=require(_0x8c2e('0x4'));var config=require(_0x8c2e('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x8c2e('0x6')]('/',auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8c2e('0x9'),auth[_0x8c2e('0x7')](),controller[_0x8c2e('0xa')]);router[_0x8c2e('0x6')](_0x8c2e('0xb'),auth[_0x8c2e('0x7')](),controller[_0x8c2e('0xc')]);router[_0x8c2e('0x6')]('/:id/descriptions',auth[_0x8c2e('0x7')](),controller[_0x8c2e('0xd')]);router[_0x8c2e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8c2e('0xf'),auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x10')]);router[_0x8c2e('0x11')](_0x8c2e('0xf'),auth[_0x8c2e('0x7')](),controller[_0x8c2e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7b05=['create','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0x593e89,_0x41e4c8){var _0x1ff565=function(_0x1878a0){while(--_0x1878a0){_0x593e89['push'](_0x593e89['shift']());}};_0x1ff565(++_0x41e4c8);}(_0x7b05,0x91));var _0x57b0=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x7b05[_0xcda377];return _0x1c024f;};'use strict';var multer=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var path=require(_0x57b0('0x2'));var timeout=require(_0x57b0('0x3'));var express=require('express');var router=express[_0x57b0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x57b0('0x5'));var config=require(_0x57b0('0x6'));var controller=require(_0x57b0('0x7'));router[_0x57b0('0x8')]('/',auth[_0x57b0('0x9')](),controller['index']);router[_0x57b0('0x8')]('/:id',auth[_0x57b0('0x9')](),controller[_0x57b0('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x57b0('0x8')](_0x57b0('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x57b0('0xc'),auth[_0x57b0('0x9')](),controller[_0x57b0('0xd')]);router[_0x57b0('0xe')]('/',auth[_0x57b0('0x9')](),controller[_0x57b0('0xf')]);router['put'](_0x57b0('0x10'),auth[_0x57b0('0x9')](),controller[_0x57b0('0x11')]);router['delete']('/:id',auth[_0x57b0('0x9')](),controller[_0x57b0('0x12')]);module[_0x57b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8975151..04c9bf7 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 _0x1c41=['nothing','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0x5361dd,_0x56dfb2){var _0x4f4077=function(_0x15819f){while(--_0x15819f){_0x5361dd['push'](_0x5361dd['shift']());}};_0x4f4077(++_0x56dfb2);}(_0x1c41,0x113));var _0x11c4=function(_0x44d869,_0x49425f){_0x44d869=_0x44d869-0x0;var _0x1ed521=_0x1c41[_0x44d869];return _0x1ed521;};'use strict';var Sequelize=require(_0x11c4('0x0'));module[_0x11c4('0x1')]={'name':{'type':Sequelize[_0x11c4('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x11c4('0x3'),_0x11c4('0x4'),_0x11c4('0x5')),'defaultValue':_0x11c4('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x11c4('0x6'),_0x11c4('0x4'),_0x11c4('0x3')),'defaultValue':_0x11c4('0x6')},'description':{'type':Sequelize[_0x11c4('0x2')]}}; \ No newline at end of file +var _0xc53b=['contact','contact_lead','STRING','sequelize','exports','ENUM','lead'];(function(_0x322813,_0x3084fa){var _0x1e9000=function(_0x53478c){while(--_0x53478c){_0x322813['push'](_0x322813['shift']());}};_0x1e9000(++_0x3084fa);}(_0xc53b,0xa4));var _0xbc53=function(_0x3f7a26,_0x2632a4){_0x3f7a26=_0x3f7a26-0x0;var _0x6a596d=_0xc53b[_0x3f7a26];return _0x6a596d;};'use strict';var Sequelize=require(_0xbc53('0x0'));module[_0xbc53('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xbc53('0x2')](_0xbc53('0x3'),_0xbc53('0x4'),'nothing'),'defaultValue':_0xbc53('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xbc53('0x5'),_0xbc53('0x4'),_0xbc53('0x3')),'defaultValue':_0xbc53('0x5')},'description':{'type':Sequelize[_0xbc53('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 435e4c2..ff3c548 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 _0x7df9=['nolimit','offset','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','ZohoConfiguration','find','create','update','body','ZohoField','order','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','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\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','end','status','json','limit','set','Content-Range','reject','save','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x257a8e,_0x4d076e){var _0x331b6e=function(_0x49f428){while(--_0x49f428){_0x257a8e['push'](_0x257a8e['shift']());}};_0x331b6e(++_0x4d076e);}(_0x7df9,0x1dd));var _0x97df=function(_0x4862b1,_0x521d1a){_0x4862b1=_0x4862b1-0x0;var _0x510eb7=_0x7df9[_0x4862b1];return _0x510eb7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97df('0x0'));var rimraf=require(_0x97df('0x1'));var zipdir=require(_0x97df('0x2'));var jsonpatch=require(_0x97df('0x3'));var rp=require('request-promise');var moment=require(_0x97df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97df('0x5'));var util=require(_0x97df('0x6'));var path=require(_0x97df('0x7'));var sox=require(_0x97df('0x8'));var csv=require(_0x97df('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97df('0xa'));var squel=require('squel');var crypto=require(_0x97df('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x97df('0xc'));var toCsv=require(_0x97df('0x9'));var querystring=require(_0x97df('0xd'));var Papa=require(_0x97df('0xe'));var Redis=require(_0x97df('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x97df('0x10'));var as=require(_0x97df('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97df('0x12'));var utils=require('../../config/utils');var config=require(_0x97df('0x13'));var db=require(_0x97df('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x97df('0x15')][_0x97df('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2f418e,_0x4e756b,_0x32e69f){if(_0x32e69f){var _0x1b08ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b08ce[_0x97df('0x17')](_0x4e756b)){return _0x2f418e;}else{throw new db[(_0x97df('0x18'))][(_0x97df('0x19'))](_0x97df('0x1a'));}}else{return _0x2f418e;}}function respondWithRpcPromise(_0x78803,_0x38dd87,_0x22c185,_0x5cdc66){return new BPromise(function(_0x33afb7,_0x579cd5){var _0x4c8d07=_0x5cdc66||client;return _0x4c8d07['request'](_0x78803,_0x22c185)['then'](function(_0x1a27cd){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x38dd87,_0x97df('0x1b'));logger['debug'](_0x97df('0x1c'),_0x38dd87,_0x97df('0x1b'),JSON[_0x97df('0x1d')](_0x1a27cd));if(_0x1a27cd['error']){if(_0x1a27cd[_0x97df('0x1e')][_0x97df('0x1f')]===0x1f4){logger[_0x97df('0x1e')](_0x97df('0x20'),_0x38dd87,_0x1a27cd[_0x97df('0x1e')][_0x97df('0x21')]);return _0x579cd5(_0x1a27cd[_0x97df('0x1e')][_0x97df('0x21')]);}logger[_0x97df('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x38dd87,_0x1a27cd['error'][_0x97df('0x21')]);return _0x33afb7(_0x1a27cd['error']['message']);}else{logger[_0x97df('0x22')](_0x97df('0x20'),_0x38dd87,_0x97df('0x1b'));_0x33afb7(_0x1a27cd[_0x97df('0x23')][_0x97df('0x21')]);}})[_0x97df('0x24')](function(_0x15aa5c){logger[_0x97df('0x1e')](_0x97df('0x20'),_0x38dd87,_0x15aa5c);_0x579cd5(_0x15aa5c);});});}function respondWithStatusCode(_0x5dd6ce,_0x4aca6f){_0x4aca6f=_0x4aca6f||0xcc;return function(_0x277930){if(_0x277930){return _0x5dd6ce['sendStatus'](_0x4aca6f);}return _0x5dd6ce['status'](_0x4aca6f)[_0x97df('0x25')]();};}function respondWithResult(_0x705843,_0x15a802){_0x15a802=_0x15a802||0xc8;return function(_0x5084c3){if(_0x5084c3){return _0x705843[_0x97df('0x26')](_0x15a802)[_0x97df('0x27')](_0x5084c3);}};}function respondWithFilteredResult(_0x4a6547,_0x142937){return function(_0xbb935d){if(_0xbb935d){var _0x10e9ac=_0xbb935d['count'],_0xeb2cc6=_0x142937['offset'],_0x21b41f=_0x142937['offset']+_0x142937[_0x97df('0x28')],_0x84933f;if(_0x21b41f>=_0x10e9ac){_0x21b41f=_0x10e9ac;_0x84933f=0xc8;}else{_0x84933f=0xce;}_0x4a6547[_0x97df('0x26')](_0x84933f);return _0x4a6547[_0x97df('0x29')](_0x97df('0x2a'),_0xeb2cc6+'-'+_0x21b41f+'/'+_0x10e9ac)[_0x97df('0x27')](_0xbb935d);}return null;};}function patchUpdates(_0x265fa5){return function(_0x419fe7){try{jsonpatch['apply'](_0x419fe7,_0x265fa5,!![]);}catch(_0x378b2d){return BPromise[_0x97df('0x2b')](_0x378b2d);}return _0x419fe7[_0x97df('0x2c')]();};}function saveUpdates(_0x2caf4c,_0x4ede5e){return function(_0x60086b){if(_0x60086b){return _0x60086b['update'](_0x2caf4c)[_0x97df('0x2d')](function(_0x4398ee){return _0x4398ee;});}return null;};}function removeEntity(_0x84cab9,_0x1b3e15){return function(_0x2621de){if(_0x2621de){return _0x2621de[_0x97df('0x2e')]()[_0x97df('0x2d')](function(){_0x84cab9[_0x97df('0x26')](0xcc)[_0x97df('0x25')]();});}};}function handleEntityNotFound(_0x1bcdd5,_0x17d5c1){return function(_0x2d25fd){if(!_0x2d25fd){_0x1bcdd5['sendStatus'](0x194);}return _0x2d25fd;};}function handleError(_0x4115ea,_0x5a3d60){_0x5a3d60=_0x5a3d60||0x1f4;return function(_0x259781){logger['error'](_0x259781['stack']);if(_0x259781[_0x97df('0x2f')]){delete _0x259781[_0x97df('0x2f')];}_0x4115ea[_0x97df('0x26')](_0x5a3d60)[_0x97df('0x30')](_0x259781);};}exports[_0x97df('0x31')]=function(_0x5c69d8,_0x1f1d4c){var _0x33954e={},_0x394045={},_0x109c4c={'count':0x0,'rows':[]};var _0x2494c0=_[_0x97df('0x32')](db['ZohoConfiguration'][_0x97df('0x33')],function(_0x4fedd9){return{'name':_0x4fedd9['fieldName'],'type':_0x4fedd9[_0x97df('0x34')][_0x97df('0x35')]};});_0x394045[_0x97df('0x36')]=_['map'](_0x2494c0,'name');_0x394045[_0x97df('0x37')]=_[_0x97df('0x38')](_0x5c69d8[_0x97df('0x37')]);_0x394045[_0x97df('0x39')]=_[_0x97df('0x3a')](_0x394045[_0x97df('0x36')],_0x394045[_0x97df('0x37')]);_0x33954e[_0x97df('0x3b')]=_[_0x97df('0x3a')](_0x394045[_0x97df('0x36')],qs['fields'](_0x5c69d8[_0x97df('0x37')][_0x97df('0x3c')]));_0x33954e[_0x97df('0x3b')]=_0x33954e['attributes'][_0x97df('0x3d')]?_0x33954e[_0x97df('0x3b')]:_0x394045[_0x97df('0x36')];if(!_0x5c69d8[_0x97df('0x37')][_0x97df('0x3e')](_0x97df('0x3f'))){_0x33954e[_0x97df('0x28')]=qs['limit'](_0x5c69d8[_0x97df('0x37')][_0x97df('0x28')]);_0x33954e[_0x97df('0x40')]=qs['offset'](_0x5c69d8[_0x97df('0x37')][_0x97df('0x40')]);}_0x33954e['order']=qs[_0x97df('0x41')](_0x5c69d8[_0x97df('0x37')]['sort']);_0x33954e['where']=qs[_0x97df('0x39')](_[_0x97df('0x42')](_0x5c69d8[_0x97df('0x37')],_0x394045[_0x97df('0x39')]),_0x2494c0);if(_0x5c69d8['query'][_0x97df('0x43')]){_0x33954e['where']=_[_0x97df('0x44')](_0x33954e[_0x97df('0x45')],{'$or':_[_0x97df('0x32')](_0x2494c0,function(_0x456ac3){if(_0x456ac3['type']!==_0x97df('0x46')){var _0x54b5f9={};_0x54b5f9[_0x456ac3[_0x97df('0x2f')]]={'$like':'%'+_0x5c69d8[_0x97df('0x37')][_0x97df('0x43')]+'%'};return _0x54b5f9;}})});}_0x33954e=_[_0x97df('0x44')]({},_0x33954e,_0x5c69d8[_0x97df('0x47')]);var _0x12b5cb={'where':_0x33954e[_0x97df('0x45')]};return db['ZohoConfiguration']['count'](_0x12b5cb)[_0x97df('0x2d')](function(_0x24c762){_0x109c4c[_0x97df('0x48')]=_0x24c762;if(_0x5c69d8['query'][_0x97df('0x49')]){_0x33954e[_0x97df('0x4a')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x97df('0x4b')](_0x33954e);})[_0x97df('0x2d')](function(_0x2ab731){_0x109c4c[_0x97df('0x4c')]=_0x2ab731;return _0x109c4c;})[_0x97df('0x2d')](respondWithFilteredResult(_0x1f1d4c,_0x33954e))[_0x97df('0x24')](handleError(_0x1f1d4c,null));};exports[_0x97df('0x4d')]=function(_0x4077b9,_0xabcaf5){var _0x4418a={'raw':![],'where':{'id':_0x4077b9[_0x97df('0x4e')]['id']}},_0xc4f5a6={};_0xc4f5a6['model']=_['keys'](db[_0x97df('0x4f')]['rawAttributes']);_0xc4f5a6[_0x97df('0x37')]=_[_0x97df('0x38')](_0x4077b9[_0x97df('0x37')]);_0xc4f5a6['filters']=_[_0x97df('0x3a')](_0xc4f5a6['model'],_0xc4f5a6[_0x97df('0x37')]);_0x4418a[_0x97df('0x3b')]=_[_0x97df('0x3a')](_0xc4f5a6['model'],qs['fields'](_0x4077b9[_0x97df('0x37')][_0x97df('0x3c')]));_0x4418a[_0x97df('0x3b')]=_0x4418a['attributes'][_0x97df('0x3d')]?_0x4418a[_0x97df('0x3b')]:_0xc4f5a6['model'];if(_0x4077b9[_0x97df('0x37')]['includeAll']){_0x4418a[_0x97df('0x4a')]=[{'all':!![]}];}_0x4418a=_[_0x97df('0x44')]({},_0x4418a,_0x4077b9[_0x97df('0x47')]);return db[_0x97df('0x4f')][_0x97df('0x50')](_0x4418a)[_0x97df('0x2d')](handleEntityNotFound(_0xabcaf5,null))[_0x97df('0x2d')](respondWithResult(_0xabcaf5,null))['catch'](handleError(_0xabcaf5,null));};exports[_0x97df('0x51')]=function(_0x386c10,_0x11fde4){return db[_0x97df('0x4f')][_0x97df('0x51')](_0x386c10['body'],{})[_0x97df('0x2d')](respondWithResult(_0x11fde4,0xc9))['catch'](handleError(_0x11fde4,null));};exports[_0x97df('0x52')]=function(_0x4d2b00,_0x102af6){if(_0x4d2b00[_0x97df('0x53')]['id']){delete _0x4d2b00[_0x97df('0x53')]['id'];}return db[_0x97df('0x4f')]['find']({'where':{'id':_0x4d2b00[_0x97df('0x4e')]['id']}})[_0x97df('0x2d')](handleEntityNotFound(_0x102af6,null))[_0x97df('0x2d')](saveUpdates(_0x4d2b00[_0x97df('0x53')],null))[_0x97df('0x2d')](respondWithResult(_0x102af6,null))[_0x97df('0x24')](handleError(_0x102af6,null));};exports['destroy']=function(_0x2eef83,_0x245e96){return db['ZohoConfiguration']['find']({'where':{'id':_0x2eef83['params']['id']}})[_0x97df('0x2d')](handleEntityNotFound(_0x245e96,null))[_0x97df('0x2d')](removeEntity(_0x245e96,null))['catch'](handleError(_0x245e96,null));};exports['getFields']=function(_0x14e3a4,_0x2c1b71,_0x2e312e){var _0x24090d={};var _0x45f672={};var _0x56d21a;var _0x17fabd;return db[_0x97df('0x4f')]['findOne']({'where':{'id':_0x14e3a4[_0x97df('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c1b71,null))[_0x97df('0x2d')](function(_0x12cfef){if(_0x12cfef){_0x56d21a=_0x12cfef;_0x45f672[_0x97df('0x36')]=_[_0x97df('0x38')](db[_0x97df('0x54')][_0x97df('0x33')]);_0x45f672[_0x97df('0x37')]=_['keys'](_0x14e3a4[_0x97df('0x37')]);_0x45f672['filters']=_[_0x97df('0x3a')](_0x45f672[_0x97df('0x36')],_0x45f672[_0x97df('0x37')]);_0x24090d['attributes']=_[_0x97df('0x3a')](_0x45f672[_0x97df('0x36')],qs[_0x97df('0x3c')](_0x14e3a4[_0x97df('0x37')][_0x97df('0x3c')]));_0x24090d[_0x97df('0x3b')]=_0x24090d[_0x97df('0x3b')]['length']?_0x24090d[_0x97df('0x3b')]:_0x45f672[_0x97df('0x36')];_0x24090d[_0x97df('0x55')]=qs['sort'](_0x14e3a4[_0x97df('0x37')]['sort']);_0x24090d[_0x97df('0x45')]=qs[_0x97df('0x39')](_[_0x97df('0x42')](_0x14e3a4['query'],_0x45f672['filters']));if(_0x14e3a4[_0x97df('0x37')][_0x97df('0x43')]){_0x24090d[_0x97df('0x45')]=_[_0x97df('0x44')](_0x24090d['where'],{'$or':_[_0x97df('0x32')](_0x24090d[_0x97df('0x3b')],function(_0x595d91){var _0x2e2403={};_0x2e2403[_0x595d91]={'$like':'%'+_0x14e3a4[_0x97df('0x37')][_0x97df('0x43')]+'%'};return _0x2e2403;})});}_0x24090d=_['merge']({},_0x24090d,_0x14e3a4[_0x97df('0x47')]);return _0x56d21a['getFields'](_0x24090d);}})['then'](function(_0x3c1ccf){if(_0x3c1ccf){_0x17fabd=_0x3c1ccf[_0x97df('0x3d')];if(!_0x14e3a4['query']['hasOwnProperty']('nolimit')){_0x24090d[_0x97df('0x28')]=qs[_0x97df('0x28')](_0x14e3a4['query'][_0x97df('0x28')]);_0x24090d[_0x97df('0x40')]=qs[_0x97df('0x40')](_0x14e3a4[_0x97df('0x37')][_0x97df('0x40')]);}return _0x56d21a[_0x97df('0x56')](_0x24090d);}})['then'](function(_0x1096ef){if(_0x1096ef){return _0x1096ef?{'count':_0x17fabd,'rows':_0x1096ef}:null;}})[_0x97df('0x2d')](respondWithResult(_0x2c1b71,null))['catch'](handleError(_0x2c1b71,null));};exports[_0x97df('0x57')]=function(_0x2bf4e6,_0x4a917c,_0x4384fa){var _0x341d14={};var _0x5f499d={};var _0x41a4bb;var _0x3a9626;return db[_0x97df('0x4f')][_0x97df('0x58')]({'where':{'id':_0x2bf4e6[_0x97df('0x4e')]['id']}})[_0x97df('0x2d')](handleEntityNotFound(_0x4a917c,null))[_0x97df('0x2d')](function(_0x186c0e){if(_0x186c0e){_0x41a4bb=_0x186c0e;_0x5f499d[_0x97df('0x36')]=_[_0x97df('0x38')](db[_0x97df('0x54')]['rawAttributes']);_0x5f499d[_0x97df('0x37')]=_['keys'](_0x2bf4e6[_0x97df('0x37')]);_0x5f499d['filters']=_[_0x97df('0x3a')](_0x5f499d[_0x97df('0x36')],_0x5f499d[_0x97df('0x37')]);_0x341d14[_0x97df('0x3b')]=_['intersection'](_0x5f499d[_0x97df('0x36')],qs[_0x97df('0x3c')](_0x2bf4e6[_0x97df('0x37')][_0x97df('0x3c')]));_0x341d14[_0x97df('0x3b')]=_0x341d14['attributes']['length']?_0x341d14[_0x97df('0x3b')]:_0x5f499d[_0x97df('0x36')];_0x341d14[_0x97df('0x55')]=qs[_0x97df('0x41')](_0x2bf4e6[_0x97df('0x37')][_0x97df('0x41')]);_0x341d14[_0x97df('0x45')]=qs['filters'](_[_0x97df('0x42')](_0x2bf4e6[_0x97df('0x37')],_0x5f499d['filters']));if(_0x2bf4e6[_0x97df('0x37')][_0x97df('0x43')]){_0x341d14['where']=_['merge'](_0x341d14[_0x97df('0x45')],{'$or':_['map'](_0x341d14[_0x97df('0x3b')],function(_0x1767df){var _0x24807b={};_0x24807b[_0x1767df]={'$like':'%'+_0x2bf4e6[_0x97df('0x37')][_0x97df('0x43')]+'%'};return _0x24807b;})});}_0x341d14=_['merge']({},_0x341d14,_0x2bf4e6[_0x97df('0x47')]);return _0x41a4bb[_0x97df('0x57')](_0x341d14);}})[_0x97df('0x2d')](function(_0x1e36a9){if(_0x1e36a9){_0x3a9626=_0x1e36a9[_0x97df('0x3d')];if(!_0x2bf4e6[_0x97df('0x37')]['hasOwnProperty'](_0x97df('0x3f'))){_0x341d14[_0x97df('0x28')]=qs['limit'](_0x2bf4e6[_0x97df('0x37')][_0x97df('0x28')]);_0x341d14[_0x97df('0x40')]=qs['offset'](_0x2bf4e6[_0x97df('0x37')]['offset']);}return _0x41a4bb[_0x97df('0x57')](_0x341d14);}})[_0x97df('0x2d')](function(_0x2071b8){if(_0x2071b8){return _0x2071b8?{'count':_0x3a9626,'rows':_0x2071b8}:null;}})[_0x97df('0x2d')](respondWithResult(_0x4a917c,null))[_0x97df('0x24')](handleError(_0x4a917c,null));};exports[_0x97df('0x59')]=function(_0x52c854,_0x281cdf,_0x539df0){var _0x2cf1a1={};var _0x2fad46={};var _0x524492;var _0x2e7fcb;return db[_0x97df('0x4f')][_0x97df('0x58')]({'where':{'id':_0x52c854[_0x97df('0x4e')]['id']}})['then'](handleEntityNotFound(_0x281cdf,null))[_0x97df('0x2d')](function(_0x3be39f){if(_0x3be39f){_0x524492=_0x3be39f;_0x2fad46[_0x97df('0x36')]=_[_0x97df('0x38')](db['ZohoField'][_0x97df('0x33')]);_0x2fad46[_0x97df('0x37')]=_[_0x97df('0x38')](_0x52c854[_0x97df('0x37')]);_0x2fad46[_0x97df('0x39')]=_['intersection'](_0x2fad46['model'],_0x2fad46[_0x97df('0x37')]);_0x2cf1a1[_0x97df('0x3b')]=_[_0x97df('0x3a')](_0x2fad46[_0x97df('0x36')],qs[_0x97df('0x3c')](_0x52c854[_0x97df('0x37')][_0x97df('0x3c')]));_0x2cf1a1[_0x97df('0x3b')]=_0x2cf1a1[_0x97df('0x3b')]['length']?_0x2cf1a1[_0x97df('0x3b')]:_0x2fad46[_0x97df('0x36')];_0x2cf1a1['order']=qs['sort'](_0x52c854['query'][_0x97df('0x41')]);_0x2cf1a1[_0x97df('0x45')]=qs[_0x97df('0x39')](_['pick'](_0x52c854[_0x97df('0x37')],_0x2fad46[_0x97df('0x39')]));if(_0x52c854['query']['filter']){_0x2cf1a1['where']=_[_0x97df('0x44')](_0x2cf1a1[_0x97df('0x45')],{'$or':_[_0x97df('0x32')](_0x2cf1a1[_0x97df('0x3b')],function(_0x42f456){var _0x88213b={};_0x88213b[_0x42f456]={'$like':'%'+_0x52c854[_0x97df('0x37')][_0x97df('0x43')]+'%'};return _0x88213b;})});}_0x2cf1a1=_[_0x97df('0x44')]({},_0x2cf1a1,_0x52c854[_0x97df('0x47')]);return _0x524492[_0x97df('0x59')](_0x2cf1a1);}})[_0x97df('0x2d')](function(_0x1f795d){if(_0x1f795d){_0x2e7fcb=_0x1f795d['length'];if(!_0x52c854[_0x97df('0x37')][_0x97df('0x3e')](_0x97df('0x3f'))){_0x2cf1a1[_0x97df('0x28')]=qs[_0x97df('0x28')](_0x52c854['query'][_0x97df('0x28')]);_0x2cf1a1[_0x97df('0x40')]=qs['offset'](_0x52c854[_0x97df('0x37')][_0x97df('0x40')]);}return _0x524492[_0x97df('0x59')](_0x2cf1a1);}})[_0x97df('0x2d')](function(_0xe920e){if(_0xe920e){return _0xe920e?{'count':_0x2e7fcb,'rows':_0xe920e}:null;}})['then'](respondWithResult(_0x281cdf,null))[_0x97df('0x24')](handleError(_0x281cdf,null));}; \ No newline at end of file +var _0x137c=['limit','set','Content-Range','apply','save','name','send','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','params','includeAll','find','create','body','update','getFields','ZohoField','getSubjects','findOne','getDescriptions','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','json','count','offset'];(function(_0x2cd2fd,_0x5f5c36){var _0x6c68cc=function(_0x6bb91c){while(--_0x6bb91c){_0x2cd2fd['push'](_0x2cd2fd['shift']());}};_0x6c68cc(++_0x5f5c36);}(_0x137c,0x82));var _0xc137=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x137c[_0x1034bb];return _0x453fdb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc137('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc137('0x1'));var rp=require('request-promise');var moment=require(_0xc137('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc137('0x3'));var util=require('util');var path=require(_0xc137('0x4'));var sox=require('sox');var csv=require(_0xc137('0x5'));var ejs=require(_0xc137('0x6'));var fs=require('fs');var _=require(_0xc137('0x7'));var squel=require(_0xc137('0x8'));var crypto=require(_0xc137('0x9'));var jsforce=require(_0xc137('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc137('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc137('0xb'));var authService=require(_0xc137('0xc'));var qs=require(_0xc137('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc137('0xe'));var logger=require(_0xc137('0xf'))(_0xc137('0x10'));var utils=require(_0xc137('0x11'));var config=require('../../config/environment');var db=require(_0xc137('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc137('0x13')][_0xc137('0x14')]({'port':0x232a});function checkPasswordPattern(_0x3afef6,_0x62ecc,_0x59de68){if(_0x59de68){var _0x33d52a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33d52a[_0xc137('0x15')](_0x62ecc)){return _0x3afef6;}else{throw new db[(_0xc137('0x16'))][(_0xc137('0x17'))](_0xc137('0x18'));}}else{return _0x3afef6;}}function respondWithRpcPromise(_0x2def95,_0x3f65a9,_0x47c932,_0x19e43b){return new BPromise(function(_0x522686,_0x39cbb1){var _0x2d9816=_0x19e43b||client;return _0x2d9816[_0xc137('0x19')](_0x2def95,_0x47c932)[_0xc137('0x1a')](function(_0x25ba67){logger[_0xc137('0x1b')](_0xc137('0x1c'),_0x3f65a9,_0xc137('0x1d'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3f65a9,_0xc137('0x1d'),JSON['stringify'](_0x25ba67));if(_0x25ba67[_0xc137('0x1e')]){if(_0x25ba67[_0xc137('0x1e')]['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3f65a9,_0x25ba67['error']['message']);return _0x39cbb1(_0x25ba67['error'][_0xc137('0x1f')]);}logger['error'](_0xc137('0x1c'),_0x3f65a9,_0x25ba67['error'][_0xc137('0x1f')]);return _0x522686(_0x25ba67[_0xc137('0x1e')]['message']);}else{logger[_0xc137('0x1b')](_0xc137('0x1c'),_0x3f65a9,_0xc137('0x1d'));_0x522686(_0x25ba67[_0xc137('0x20')][_0xc137('0x1f')]);}})[_0xc137('0x21')](function(_0x28ac18){logger[_0xc137('0x1e')](_0xc137('0x1c'),_0x3f65a9,_0x28ac18);_0x39cbb1(_0x28ac18);});});}function respondWithStatusCode(_0x13aa62,_0x34515a){_0x34515a=_0x34515a||0xcc;return function(_0x3958e0){if(_0x3958e0){return _0x13aa62[_0xc137('0x22')](_0x34515a);}return _0x13aa62['status'](_0x34515a)[_0xc137('0x23')]();};}function respondWithResult(_0xe9cf05,_0x1f3a04){_0x1f3a04=_0x1f3a04||0xc8;return function(_0x2c0760){if(_0x2c0760){return _0xe9cf05[_0xc137('0x24')](_0x1f3a04)[_0xc137('0x25')](_0x2c0760);}};}function respondWithFilteredResult(_0x203c64,_0x2fa4fc){return function(_0x3c2f37){if(_0x3c2f37){var _0x4b1756=_0x3c2f37[_0xc137('0x26')],_0x33041e=_0x2fa4fc[_0xc137('0x27')],_0x3542b2=_0x2fa4fc[_0xc137('0x27')]+_0x2fa4fc[_0xc137('0x28')],_0x482842;if(_0x3542b2>=_0x4b1756){_0x3542b2=_0x4b1756;_0x482842=0xc8;}else{_0x482842=0xce;}_0x203c64[_0xc137('0x24')](_0x482842);return _0x203c64[_0xc137('0x29')](_0xc137('0x2a'),_0x33041e+'-'+_0x3542b2+'/'+_0x4b1756)['json'](_0x3c2f37);}return null;};}function patchUpdates(_0x3ee4d2){return function(_0x3a43df){try{jsonpatch[_0xc137('0x2b')](_0x3a43df,_0x3ee4d2,!![]);}catch(_0x156f60){return BPromise['reject'](_0x156f60);}return _0x3a43df[_0xc137('0x2c')]();};}function saveUpdates(_0x151093,_0x4cad77){return function(_0x44e2e1){if(_0x44e2e1){return _0x44e2e1['update'](_0x151093)[_0xc137('0x1a')](function(_0xf14f84){return _0xf14f84;});}return null;};}function removeEntity(_0x4b972f,_0x3eeae0){return function(_0x554d36){if(_0x554d36){return _0x554d36['destroy']()['then'](function(){_0x4b972f[_0xc137('0x24')](0xcc)[_0xc137('0x23')]();});}};}function handleEntityNotFound(_0x49b71d,_0xce9323){return function(_0x5b7456){if(!_0x5b7456){_0x49b71d[_0xc137('0x22')](0x194);}return _0x5b7456;};}function handleError(_0x132864,_0x1ef1f4){_0x1ef1f4=_0x1ef1f4||0x1f4;return function(_0x4ca4d6){logger[_0xc137('0x1e')](_0x4ca4d6['stack']);if(_0x4ca4d6['name']){delete _0x4ca4d6[_0xc137('0x2d')];}_0x132864[_0xc137('0x24')](_0x1ef1f4)[_0xc137('0x2e')](_0x4ca4d6);};}exports['index']=function(_0x656f51,_0x929f89){var _0x101707={},_0x4c4bf0={},_0x2bf0ca={'count':0x0,'rows':[]};var _0x2c842b=_['map'](db[_0xc137('0x2f')][_0xc137('0x30')],function(_0x4577bd){return{'name':_0x4577bd[_0xc137('0x31')],'type':_0x4577bd[_0xc137('0x32')][_0xc137('0x33')]};});_0x4c4bf0[_0xc137('0x34')]=_[_0xc137('0x35')](_0x2c842b,_0xc137('0x2d'));_0x4c4bf0['query']=_[_0xc137('0x36')](_0x656f51[_0xc137('0x37')]);_0x4c4bf0[_0xc137('0x38')]=_[_0xc137('0x39')](_0x4c4bf0[_0xc137('0x34')],_0x4c4bf0[_0xc137('0x37')]);_0x101707[_0xc137('0x3a')]=_['intersection'](_0x4c4bf0['model'],qs[_0xc137('0x3b')](_0x656f51[_0xc137('0x37')][_0xc137('0x3b')]));_0x101707[_0xc137('0x3a')]=_0x101707[_0xc137('0x3a')][_0xc137('0x3c')]?_0x101707['attributes']:_0x4c4bf0[_0xc137('0x34')];if(!_0x656f51['query'][_0xc137('0x3d')](_0xc137('0x3e'))){_0x101707['limit']=qs[_0xc137('0x28')](_0x656f51['query'][_0xc137('0x28')]);_0x101707['offset']=qs[_0xc137('0x27')](_0x656f51[_0xc137('0x37')]['offset']);}_0x101707[_0xc137('0x3f')]=qs['sort'](_0x656f51[_0xc137('0x37')][_0xc137('0x40')]);_0x101707[_0xc137('0x41')]=qs['filters'](_[_0xc137('0x42')](_0x656f51['query'],_0x4c4bf0[_0xc137('0x38')]),_0x2c842b);if(_0x656f51['query'][_0xc137('0x43')]){_0x101707[_0xc137('0x41')]=_['merge'](_0x101707[_0xc137('0x41')],{'$or':_[_0xc137('0x35')](_0x2c842b,function(_0x249d92){if(_0x249d92[_0xc137('0x32')]!==_0xc137('0x44')){var _0x43e78b={};_0x43e78b[_0x249d92[_0xc137('0x2d')]]={'$like':'%'+_0x656f51[_0xc137('0x37')]['filter']+'%'};return _0x43e78b;}})});}_0x101707=_[_0xc137('0x45')]({},_0x101707,_0x656f51[_0xc137('0x46')]);var _0x30d19c={'where':_0x101707[_0xc137('0x41')]};return db[_0xc137('0x2f')]['count'](_0x30d19c)[_0xc137('0x1a')](function(_0x1a1f49){_0x2bf0ca[_0xc137('0x26')]=_0x1a1f49;if(_0x656f51[_0xc137('0x37')]['includeAll']){_0x101707[_0xc137('0x47')]=[{'all':!![]}];}return db[_0xc137('0x2f')][_0xc137('0x48')](_0x101707);})[_0xc137('0x1a')](function(_0x323339){_0x2bf0ca[_0xc137('0x49')]=_0x323339;return _0x2bf0ca;})[_0xc137('0x1a')](respondWithFilteredResult(_0x929f89,_0x101707))[_0xc137('0x21')](handleError(_0x929f89,null));};exports['show']=function(_0x1605a5,_0x2a46cc){var _0x2d199a={'raw':![],'where':{'id':_0x1605a5[_0xc137('0x4a')]['id']}},_0x588093={};_0x588093[_0xc137('0x34')]=_[_0xc137('0x36')](db[_0xc137('0x2f')][_0xc137('0x30')]);_0x588093[_0xc137('0x37')]=_[_0xc137('0x36')](_0x1605a5['query']);_0x588093[_0xc137('0x38')]=_[_0xc137('0x39')](_0x588093[_0xc137('0x34')],_0x588093['query']);_0x2d199a[_0xc137('0x3a')]=_[_0xc137('0x39')](_0x588093['model'],qs[_0xc137('0x3b')](_0x1605a5[_0xc137('0x37')][_0xc137('0x3b')]));_0x2d199a[_0xc137('0x3a')]=_0x2d199a['attributes']['length']?_0x2d199a[_0xc137('0x3a')]:_0x588093[_0xc137('0x34')];if(_0x1605a5[_0xc137('0x37')][_0xc137('0x4b')]){_0x2d199a[_0xc137('0x47')]=[{'all':!![]}];}_0x2d199a=_[_0xc137('0x45')]({},_0x2d199a,_0x1605a5[_0xc137('0x46')]);return db['ZohoConfiguration'][_0xc137('0x4c')](_0x2d199a)['then'](handleEntityNotFound(_0x2a46cc,null))[_0xc137('0x1a')](respondWithResult(_0x2a46cc,null))['catch'](handleError(_0x2a46cc,null));};exports[_0xc137('0x4d')]=function(_0x574057,_0x8f3e40){return db[_0xc137('0x2f')][_0xc137('0x4d')](_0x574057[_0xc137('0x4e')],{})[_0xc137('0x1a')](respondWithResult(_0x8f3e40,0xc9))[_0xc137('0x21')](handleError(_0x8f3e40,null));};exports[_0xc137('0x4f')]=function(_0xfabf6d,_0x45f808){if(_0xfabf6d[_0xc137('0x4e')]['id']){delete _0xfabf6d[_0xc137('0x4e')]['id'];}return db[_0xc137('0x2f')][_0xc137('0x4c')]({'where':{'id':_0xfabf6d[_0xc137('0x4a')]['id']}})[_0xc137('0x1a')](handleEntityNotFound(_0x45f808,null))[_0xc137('0x1a')](saveUpdates(_0xfabf6d[_0xc137('0x4e')],null))[_0xc137('0x1a')](respondWithResult(_0x45f808,null))[_0xc137('0x21')](handleError(_0x45f808,null));};exports['destroy']=function(_0x54c4ab,_0x342ca6){return db[_0xc137('0x2f')][_0xc137('0x4c')]({'where':{'id':_0x54c4ab[_0xc137('0x4a')]['id']}})[_0xc137('0x1a')](handleEntityNotFound(_0x342ca6,null))[_0xc137('0x1a')](removeEntity(_0x342ca6,null))[_0xc137('0x21')](handleError(_0x342ca6,null));};exports[_0xc137('0x50')]=function(_0x15f8e2,_0x30b225,_0x44f077){var _0x1d325b={};var _0x194a74={};var _0xa7ee9a;var _0x2ee8fd;return db[_0xc137('0x2f')]['findOne']({'where':{'id':_0x15f8e2['params']['id']}})[_0xc137('0x1a')](handleEntityNotFound(_0x30b225,null))[_0xc137('0x1a')](function(_0xf0e13b){if(_0xf0e13b){_0xa7ee9a=_0xf0e13b;_0x194a74[_0xc137('0x34')]=_['keys'](db[_0xc137('0x51')][_0xc137('0x30')]);_0x194a74['query']=_[_0xc137('0x36')](_0x15f8e2[_0xc137('0x37')]);_0x194a74[_0xc137('0x38')]=_[_0xc137('0x39')](_0x194a74[_0xc137('0x34')],_0x194a74[_0xc137('0x37')]);_0x1d325b[_0xc137('0x3a')]=_[_0xc137('0x39')](_0x194a74['model'],qs['fields'](_0x15f8e2['query'][_0xc137('0x3b')]));_0x1d325b[_0xc137('0x3a')]=_0x1d325b['attributes'][_0xc137('0x3c')]?_0x1d325b[_0xc137('0x3a')]:_0x194a74[_0xc137('0x34')];_0x1d325b['order']=qs['sort'](_0x15f8e2[_0xc137('0x37')]['sort']);_0x1d325b[_0xc137('0x41')]=qs[_0xc137('0x38')](_[_0xc137('0x42')](_0x15f8e2['query'],_0x194a74['filters']));if(_0x15f8e2[_0xc137('0x37')]['filter']){_0x1d325b[_0xc137('0x41')]=_[_0xc137('0x45')](_0x1d325b[_0xc137('0x41')],{'$or':_[_0xc137('0x35')](_0x1d325b[_0xc137('0x3a')],function(_0x558dca){var _0x25d2b1={};_0x25d2b1[_0x558dca]={'$like':'%'+_0x15f8e2[_0xc137('0x37')][_0xc137('0x43')]+'%'};return _0x25d2b1;})});}_0x1d325b=_[_0xc137('0x45')]({},_0x1d325b,_0x15f8e2[_0xc137('0x46')]);return _0xa7ee9a[_0xc137('0x50')](_0x1d325b);}})[_0xc137('0x1a')](function(_0x17a970){if(_0x17a970){_0x2ee8fd=_0x17a970['length'];if(!_0x15f8e2[_0xc137('0x37')][_0xc137('0x3d')]('nolimit')){_0x1d325b['limit']=qs['limit'](_0x15f8e2[_0xc137('0x37')][_0xc137('0x28')]);_0x1d325b['offset']=qs[_0xc137('0x27')](_0x15f8e2[_0xc137('0x37')]['offset']);}return _0xa7ee9a[_0xc137('0x50')](_0x1d325b);}})[_0xc137('0x1a')](function(_0x2140a3){if(_0x2140a3){return _0x2140a3?{'count':_0x2ee8fd,'rows':_0x2140a3}:null;}})['then'](respondWithResult(_0x30b225,null))[_0xc137('0x21')](handleError(_0x30b225,null));};exports[_0xc137('0x52')]=function(_0x30b880,_0x11b5bf,_0x201ff3){var _0x5843d5={};var _0x4e9469={};var _0x2cf2e9;var _0x2d8b3a;return db[_0xc137('0x2f')][_0xc137('0x53')]({'where':{'id':_0x30b880[_0xc137('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11b5bf,null))[_0xc137('0x1a')](function(_0x29117d){if(_0x29117d){_0x2cf2e9=_0x29117d;_0x4e9469['model']=_[_0xc137('0x36')](db[_0xc137('0x51')][_0xc137('0x30')]);_0x4e9469['query']=_['keys'](_0x30b880['query']);_0x4e9469[_0xc137('0x38')]=_[_0xc137('0x39')](_0x4e9469['model'],_0x4e9469[_0xc137('0x37')]);_0x5843d5[_0xc137('0x3a')]=_['intersection'](_0x4e9469[_0xc137('0x34')],qs[_0xc137('0x3b')](_0x30b880['query']['fields']));_0x5843d5[_0xc137('0x3a')]=_0x5843d5[_0xc137('0x3a')][_0xc137('0x3c')]?_0x5843d5['attributes']:_0x4e9469[_0xc137('0x34')];_0x5843d5['order']=qs[_0xc137('0x40')](_0x30b880[_0xc137('0x37')][_0xc137('0x40')]);_0x5843d5[_0xc137('0x41')]=qs[_0xc137('0x38')](_[_0xc137('0x42')](_0x30b880[_0xc137('0x37')],_0x4e9469[_0xc137('0x38')]));if(_0x30b880['query'][_0xc137('0x43')]){_0x5843d5[_0xc137('0x41')]=_[_0xc137('0x45')](_0x5843d5[_0xc137('0x41')],{'$or':_[_0xc137('0x35')](_0x5843d5[_0xc137('0x3a')],function(_0x333b87){var _0x26d756={};_0x26d756[_0x333b87]={'$like':'%'+_0x30b880[_0xc137('0x37')][_0xc137('0x43')]+'%'};return _0x26d756;})});}_0x5843d5=_[_0xc137('0x45')]({},_0x5843d5,_0x30b880[_0xc137('0x46')]);return _0x2cf2e9[_0xc137('0x52')](_0x5843d5);}})['then'](function(_0x4871ec){if(_0x4871ec){_0x2d8b3a=_0x4871ec['length'];if(!_0x30b880[_0xc137('0x37')][_0xc137('0x3d')](_0xc137('0x3e'))){_0x5843d5[_0xc137('0x28')]=qs[_0xc137('0x28')](_0x30b880[_0xc137('0x37')][_0xc137('0x28')]);_0x5843d5[_0xc137('0x27')]=qs[_0xc137('0x27')](_0x30b880['query'][_0xc137('0x27')]);}return _0x2cf2e9[_0xc137('0x52')](_0x5843d5);}})[_0xc137('0x1a')](function(_0x559690){if(_0x559690){return _0x559690?{'count':_0x2d8b3a,'rows':_0x559690}:null;}})['then'](respondWithResult(_0x11b5bf,null))[_0xc137('0x21')](handleError(_0x11b5bf,null));};exports['getDescriptions']=function(_0x57c5c9,_0x56336c,_0x586730){var _0x52c579={};var _0x56394c={};var _0xb9ce00;var _0x4700c7;return db['ZohoConfiguration'][_0xc137('0x53')]({'where':{'id':_0x57c5c9['params']['id']}})[_0xc137('0x1a')](handleEntityNotFound(_0x56336c,null))['then'](function(_0x3d0d4b){if(_0x3d0d4b){_0xb9ce00=_0x3d0d4b;_0x56394c[_0xc137('0x34')]=_['keys'](db[_0xc137('0x51')]['rawAttributes']);_0x56394c[_0xc137('0x37')]=_[_0xc137('0x36')](_0x57c5c9[_0xc137('0x37')]);_0x56394c['filters']=_[_0xc137('0x39')](_0x56394c[_0xc137('0x34')],_0x56394c[_0xc137('0x37')]);_0x52c579[_0xc137('0x3a')]=_[_0xc137('0x39')](_0x56394c['model'],qs[_0xc137('0x3b')](_0x57c5c9['query'][_0xc137('0x3b')]));_0x52c579[_0xc137('0x3a')]=_0x52c579[_0xc137('0x3a')][_0xc137('0x3c')]?_0x52c579[_0xc137('0x3a')]:_0x56394c[_0xc137('0x34')];_0x52c579[_0xc137('0x3f')]=qs['sort'](_0x57c5c9[_0xc137('0x37')][_0xc137('0x40')]);_0x52c579[_0xc137('0x41')]=qs[_0xc137('0x38')](_[_0xc137('0x42')](_0x57c5c9[_0xc137('0x37')],_0x56394c[_0xc137('0x38')]));if(_0x57c5c9[_0xc137('0x37')]['filter']){_0x52c579['where']=_['merge'](_0x52c579['where'],{'$or':_[_0xc137('0x35')](_0x52c579[_0xc137('0x3a')],function(_0x345f55){var _0x364fa4={};_0x364fa4[_0x345f55]={'$like':'%'+_0x57c5c9[_0xc137('0x37')][_0xc137('0x43')]+'%'};return _0x364fa4;})});}_0x52c579=_[_0xc137('0x45')]({},_0x52c579,_0x57c5c9[_0xc137('0x46')]);return _0xb9ce00['getDescriptions'](_0x52c579);}})[_0xc137('0x1a')](function(_0x4348c1){if(_0x4348c1){_0x4700c7=_0x4348c1[_0xc137('0x3c')];if(!_0x57c5c9[_0xc137('0x37')]['hasOwnProperty'](_0xc137('0x3e'))){_0x52c579['limit']=qs[_0xc137('0x28')](_0x57c5c9['query'][_0xc137('0x28')]);_0x52c579['offset']=qs[_0xc137('0x27')](_0x57c5c9[_0xc137('0x37')][_0xc137('0x27')]);}return _0xb9ce00[_0xc137('0x54')](_0x52c579);}})['then'](function(_0x439993){if(_0x439993){return _0x439993?{'count':_0x4700c7,'rows':_0x439993}:null;}})[_0xc137('0x1a')](respondWithResult(_0x56336c,null))[_0xc137('0x21')](handleError(_0x56336c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index bdab96b..7febb71 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 _0x3828=['define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x209c4b,_0x4d724b){var _0x2d9bc0=function(_0x9704a8){while(--_0x9704a8){_0x209c4b['push'](_0x209c4b['shift']());}};_0x2d9bc0(++_0x4d724b);}(_0x3828,0x15d));var _0x8382=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3828[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0x8382('0x0'));var logger=require(_0x8382('0x1'))(_0x8382('0x2'));var moment=require(_0x8382('0x3'));var BPromise=require(_0x8382('0x4'));var rp=require(_0x8382('0x5'));var fs=require('fs');var path=require(_0x8382('0x6'));var rimraf=require(_0x8382('0x7'));var config=require(_0x8382('0x8'));var attributes=require(_0x8382('0x9'));module[_0x8382('0xa')]=function(_0x46a790,_0x8e5fb4){return _0x46a790[_0x8382('0xb')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf66=['../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','request-promise','path'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbf66,0x1c7));var _0x6bf6=function(_0x5b859a,_0x41499c){_0x5b859a=_0x5b859a-0x0;var _0x5379c7=_0xbf66[_0x5b859a];return _0x5379c7;};'use strict';var _=require(_0x6bf6('0x0'));var util=require(_0x6bf6('0x1'));var logger=require(_0x6bf6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6bf6('0x3'));var fs=require('fs');var path=require(_0x6bf6('0x4'));var rimraf=require('rimraf');var config=require(_0x6bf6('0x5'));var attributes=require(_0x6bf6('0x6'));module[_0x6bf6('0x7')]=function(_0x5253ea,_0x43a419){return _0x5253ea['define'](_0x6bf6('0x8'),attributes,{'tableName':_0x6bf6('0x9'),'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 a7f6a52..dba6cdc 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 _0x353e=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x353e,0x1dc));var _0xe353=function(_0x5c20dd,_0x39676e){_0x5c20dd=_0x5c20dd-0x0;var _0xf78adc=_0x353e[_0x5c20dd];return _0xf78adc;};'use strict';var _=require('lodash');var util=require(_0xe353('0x0'));var moment=require(_0xe353('0x1'));var BPromise=require(_0xe353('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe353('0x3'));var db=require(_0xe353('0x4'))['db'];var utils=require(_0xe353('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe353('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe353('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2abe33,_0x126048,_0x173e80){return new BPromise(function(_0x3b4bc5,_0x389b86){return client[_0xe353('0x8')](_0x2abe33,_0x173e80)[_0xe353('0x9')](function(_0xc39204){logger[_0xe353('0xa')](_0xe353('0xb'),_0x126048,_0xe353('0xc'));logger[_0xe353('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x126048,_0xe353('0xc'),JSON[_0xe353('0xe')](_0xc39204));if(_0xc39204['error']){if(_0xc39204[_0xe353('0xf')][_0xe353('0x10')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x126048,_0xc39204[_0xe353('0xf')][_0xe353('0x11')]);return _0x389b86(_0xc39204[_0xe353('0xf')]['message']);}logger['error'](_0xe353('0xb'),_0x126048,_0xc39204[_0xe353('0xf')]['message']);return _0x3b4bc5(_0xc39204[_0xe353('0xf')][_0xe353('0x11')]);}else{logger['info'](_0xe353('0xb'),_0x126048,'request\x20sent');_0x3b4bc5(_0xc39204[_0xe353('0x12')]['message']);}})[_0xe353('0x13')](function(_0x2e447b){logger[_0xe353('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x126048,_0x2e447b);_0x389b86(_0x2e447b);});});} \ No newline at end of file +var _0x8910=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x8910,0x1c9));var _0x0891=function(_0x3c600d,_0x4b5c85){_0x3c600d=_0x3c600d-0x0;var _0xd195e3=_0x8910[_0x3c600d];return _0xd195e3;};'use strict';var _=require(_0x0891('0x0'));var util=require(_0x0891('0x1'));var moment=require(_0x0891('0x2'));var BPromise=require(_0x0891('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0891('0x4'));var db=require(_0x0891('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0891('0x6'))(_0x0891('0x7'));var config=require(_0x0891('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1141a4,_0x314adf,_0x264f61){return new BPromise(function(_0x1c00ff,_0x4edbf3){return client[_0x0891('0xa')](_0x1141a4,_0x264f61)[_0x0891('0xb')](function(_0x2d663e){logger[_0x0891('0xc')](_0x0891('0xd'),_0x314adf,_0x0891('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x314adf,'request\x20sent',JSON[_0x0891('0xf')](_0x2d663e));if(_0x2d663e['error']){if(_0x2d663e[_0x0891('0x10')]['code']===0x1f4){logger[_0x0891('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x314adf,_0x2d663e[_0x0891('0x10')][_0x0891('0x11')]);return _0x4edbf3(_0x2d663e[_0x0891('0x10')][_0x0891('0x11')]);}logger['error'](_0x0891('0xd'),_0x314adf,_0x2d663e[_0x0891('0x10')][_0x0891('0x11')]);return _0x1c00ff(_0x2d663e['error']['message']);}else{logger[_0x0891('0xc')](_0x0891('0xd'),_0x314adf,_0x0891('0xe'));_0x1c00ff(_0x2d663e[_0x0891('0x12')][_0x0891('0x11')]);}})[_0x0891('0x13')](function(_0x255af2){logger[_0x0891('0x10')](_0x0891('0xd'),_0x314adf,_0x255af2);_0x4edbf3(_0x255af2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 95c0026..9e88da2 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 _0x1eba=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x1eba[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa1eb('0x5'));var config=require(_0xa1eb('0x6'));var controller=require(_0xa1eb('0x7'));router[_0xa1eb('0x8')]('/',auth[_0xa1eb('0x9')](),controller[_0xa1eb('0xa')]);router[_0xa1eb('0x8')](_0xa1eb('0xb'),auth[_0xa1eb('0x9')](),controller[_0xa1eb('0xc')]);router[_0xa1eb('0xd')]('/',auth[_0xa1eb('0x9')](),controller['create']);router[_0xa1eb('0xe')]('/:id',auth[_0xa1eb('0x9')](),controller['update']);router[_0xa1eb('0xf')]('/:id',auth[_0xa1eb('0x9')](),controller['destroy']);module[_0xa1eb('0x10')]=router; \ No newline at end of file +var _0xe820=['create','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','post'];(function(_0x2db93a,_0x554021){var _0x149be6=function(_0x1ab958){while(--_0x1ab958){_0x2db93a['push'](_0x2db93a['shift']());}};_0x149be6(++_0x554021);}(_0xe820,0xd2));var _0x0e82=function(_0x42f391,_0x2dbedd){_0x42f391=_0x42f391-0x0;var _0x5e31a6=_0xe820[_0x42f391];return _0x5e31a6;};'use strict';var multer=require(_0x0e82('0x0'));var util=require('util');var path=require(_0x0e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e82('0x2')]();var auth=require(_0x0e82('0x3'));var interaction=require(_0x0e82('0x4'));var config=require('../../config/environment');var controller=require(_0x0e82('0x5'));router['get']('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0x7')]);router[_0x0e82('0x8')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller['show']);router[_0x0e82('0xa')]('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0xb')]);router[_0x0e82('0xc')](_0x0e82('0x9'),auth['isAuthenticated'](),controller[_0x0e82('0xd')]);router[_0x0e82('0xe')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xf')]);module[_0x0e82('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 3474f0f..1933893 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 _0x6208=['STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable'];(function(_0x51d29f,_0x21419b){var _0x16cc99=function(_0x4abe07){while(--_0x4abe07){_0x51d29f['push'](_0x51d29f['shift']());}};_0x16cc99(++_0x21419b);}(_0x6208,0x17d));var _0x8620=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x6208[_0x1d5400];return _0x21d9fe;};'use strict';var Sequelize=require(_0x8620('0x0'));module['exports']={'type':{'type':Sequelize[_0x8620('0x1')](_0x8620('0x2'),'variable',_0x8620('0x3'),'keyValue'),'defaultValue':_0x8620('0x2')},'content':{'type':Sequelize[_0x8620('0x4')]},'key':{'type':Sequelize[_0x8620('0x4')]},'keyType':{'type':Sequelize[_0x8620('0x1')](_0x8620('0x2'),_0x8620('0x5'),_0x8620('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8620('0x4')]},'nameField':{'type':Sequelize[_0x8620('0x4')]},'customField':{'type':Sequelize[_0x8620('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8620('0x4')]}}; \ No newline at end of file +var _0xb138=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xb138,0x1dd));var _0x8b13=function(_0x6b1fb,_0x35f6b7){_0x6b1fb=_0x6b1fb-0x0;var _0x493db0=_0xb138[_0x6b1fb];return _0x493db0;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'type':{'type':Sequelize[_0x8b13('0x2')](_0x8b13('0x3'),_0x8b13('0x4'),_0x8b13('0x5'),_0x8b13('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8b13('0x7')]},'key':{'type':Sequelize[_0x8b13('0x7')]},'keyType':{'type':Sequelize[_0x8b13('0x2')]('string',_0x8b13('0x4'),_0x8b13('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8b13('0x7')]},'nameField':{'type':Sequelize[_0x8b13('0x7')]},'customField':{'type':Sequelize[_0x8b13('0x8')],'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 7b44297..113e2f2 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(_0x558e1e,_0x3fd803){var _0x5ba193=function(_0x1c2975){while(--_0x1c2975){_0x558e1e['push'](_0x558e1e['shift']());}};_0x5ba193(++_0x3fd803);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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(_0xb14376,_0x5b0bf2){var _0x232f52=function(_0x29342e){while(--_0x29342e){_0xb14376['push'](_0xb14376['shift']());}};_0x232f52(++_0x5b0bf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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 58ba400..f2b0b09 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 _0x094c=['../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x55d178,_0x1226a4){var _0x9dd7a3=function(_0x1279ec){while(--_0x1279ec){_0x55d178['push'](_0x55d178['shift']());}};_0x9dd7a3(++_0x1226a4);}(_0x094c,0x97));var _0xc094=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x094c[_0x3b90ab];return _0x206e92;};'use strict';var _=require(_0xc094('0x0'));var util=require(_0xc094('0x1'));var logger=require(_0xc094('0x2'))(_0xc094('0x3'));var moment=require(_0xc094('0x4'));var BPromise=require(_0xc094('0x5'));var rp=require(_0xc094('0x6'));var fs=require('fs');var path=require(_0xc094('0x7'));var rimraf=require(_0xc094('0x8'));var config=require(_0xc094('0x9'));var attributes=require('./intZohoField.attributes');module[_0xc094('0xa')]=function(_0xe19090,_0x58f0be){return _0xe19090[_0xc094('0xb')](_0xc094('0xc'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xc094('0xd'),'fields':[_0xc094('0xe'),_0xc094('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ed4=['bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x10dfdf,_0xd11233){var _0x2ff0c7=function(_0x3b3d32){while(--_0x3b3d32){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x2ff0c7(++_0xd11233);}(_0x1ed4,0x1dc));var _0x41ed=function(_0x45fba9,_0x29f0eb){_0x45fba9=_0x45fba9-0x0;var _0x16adaa=_0x1ed4[_0x45fba9];return _0x16adaa;};'use strict';var _=require(_0x41ed('0x0'));var util=require('util');var logger=require(_0x41ed('0x1'))(_0x41ed('0x2'));var moment=require(_0x41ed('0x3'));var BPromise=require(_0x41ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41ed('0x5'));var rimraf=require(_0x41ed('0x6'));var config=require(_0x41ed('0x7'));var attributes=require(_0x41ed('0x8'));module['exports']=function(_0x5f13ee,_0x496d57){return _0x5f13ee[_0x41ed('0x9')](_0x41ed('0xa'),attributes,{'tableName':_0x41ed('0xb'),'paranoid':![],'indexes':[{'name':_0x41ed('0xc'),'fields':[_0x41ed('0xd'),_0x41ed('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 df7b46a..082c206 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 _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x174da0,_0x33f7cb){var _0x27bb71=function(_0x56a959){while(--_0x56a959){_0x174da0['push'](_0x174da0['shift']());}};_0x27bb71(++_0x33f7cb);}(_0xee14,0x13a));var _0x4ee1=function(_0x11bb16,_0x4f8035){_0x11bb16=_0x11bb16-0x0;var _0x4da15a=_0xee14[_0x11bb16];return _0x4da15a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('ZohoField,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('ZohoField,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x177966,_0x49d680){var _0x550ede=function(_0x257218){while(--_0x257218){_0x177966['push'](_0x177966['shift']());}};_0x550ede(++_0x49d680);}(_0x24ca,0x1bc));var _0xa24c=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x24ca[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('ZohoField,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 61062cf..98d2ff9 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 _0x6b52=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x6b52,0xdf));var _0x26b5=function(_0xd3d466,_0x127e24){_0xd3d466=_0xd3d466-0x0;var _0x378e91=_0x6b52[_0xd3d466];return _0x378e91;};'use strict';var multer=require(_0x26b5('0x0'));var util=require(_0x26b5('0x1'));var path=require(_0x26b5('0x2'));var timeout=require(_0x26b5('0x3'));var express=require(_0x26b5('0x4'));var router=express[_0x26b5('0x5')]();var auth=require(_0x26b5('0x6'));var interaction=require(_0x26b5('0x7'));var config=require(_0x26b5('0x8'));module[_0x26b5('0x9')]=router; \ No newline at end of file +var _0xa927=['path','express','../../components/interaction/service','multer'];(function(_0x53bf73,_0x82a07e){var _0x5d90c8=function(_0x12a3e8){while(--_0x12a3e8){_0x53bf73['push'](_0x53bf73['shift']());}};_0x5d90c8(++_0x82a07e);}(_0xa927,0xc7));var _0x7a92=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa927[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7a92('0x0'));var util=require('util');var path=require(_0x7a92('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a92('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7a92('0x3'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 85b54f2..c736910 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 _0xac0e=['BOOLEAN','state','exports','STRING','unique_name_and_version','INTEGER'];(function(_0x235c90,_0x422d8e){var _0x5dad00=function(_0x40e7b8){while(--_0x40e7b8){_0x235c90['push'](_0x235c90['shift']());}};_0x5dad00(++_0x422d8e);}(_0xac0e,0x1be));var _0xeac0=function(_0x4d3c5d,_0x3a87cd){_0x4d3c5d=_0x4d3c5d-0x0;var _0x362f80=_0xac0e[_0x4d3c5d];return _0x362f80;};'use strict';var Sequelize=require('sequelize');module[_0xeac0('0x0')]={'name':{'type':Sequelize[_0xeac0('0x1')],'allowNull':![],'unique':_0xeac0('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeac0('0x2')},'main':{'type':Sequelize[_0xeac0('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xeac0('0x1')]},'path':{'type':Sequelize[_0xeac0('0x1')]},'type':{'type':Sequelize[_0xeac0('0x1')]},'size':{'type':Sequelize[_0xeac0('0x3')]},'active':{'type':Sequelize[_0xeac0('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xeac0('0x1')]},'logo':{'type':Sequelize[_0xeac0('0x1')]},'state':{'type':Sequelize[_0xeac0('0x1')],'unique':_0xeac0('0x5')},'description':{'type':Sequelize[_0xeac0('0x1')]},'title':{'type':Sequelize[_0xeac0('0x1')]},'remoteUri':{'type':Sequelize[_0xeac0('0x1')]},'link':{'type':Sequelize[_0xeac0('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf344=['state','sequelize','exports','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x283623,_0x4f58e6){var _0x14e480=function(_0x2ae203){while(--_0x2ae203){_0x283623['push'](_0x283623['shift']());}};_0x14e480(++_0x4f58e6);}(_0xf344,0xe8));var _0x4f34=function(_0x557f20,_0x4c4360){_0x557f20=_0x557f20-0x0;var _0xd0bd9=_0xf344[_0x557f20];return _0xd0bd9;};'use strict';var Sequelize=require(_0x4f34('0x0'));module[_0x4f34('0x1')]={'name':{'type':Sequelize[_0x4f34('0x2')],'allowNull':![],'unique':_0x4f34('0x3')},'version':{'type':Sequelize[_0x4f34('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x4f34('0x2')],'defaultValue':_0x4f34('0x4')},'filename':{'type':Sequelize[_0x4f34('0x2')]},'path':{'type':Sequelize[_0x4f34('0x2')]},'type':{'type':Sequelize[_0x4f34('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x4f34('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x4f34('0x2')]},'logo':{'type':Sequelize[_0x4f34('0x2')]},'state':{'type':Sequelize[_0x4f34('0x2')],'unique':_0x4f34('0x6')},'description':{'type':Sequelize[_0x4f34('0x2')]},'title':{'type':Sequelize[_0x4f34('0x2')]},'remoteUri':{'type':Sequelize[_0x4f34('0x2')]},'link':{'type':Sequelize[_0x4f34('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 8ac90f2..032e05d 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 _0xd30d=['create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','stack','name','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','pick','where','merge','filter','options','include','rows','catch','show','params','includeAll'];(function(_0xc24eb4,_0x271c50){var _0x2d2de5=function(_0x30c205){while(--_0x30c205){_0xc24eb4['push'](_0xc24eb4['shift']());}};_0x2d2de5(++_0x271c50);}(_0xd30d,0x95));var _0xdd30=function(_0x5d7f93,_0xb82233){_0x5d7f93=_0x5d7f93-0x0;var _0x2a693a=_0xd30d[_0x5d7f93];return _0x2a693a;};'use strict';var pdf=require(_0xdd30('0x0'));var emlformat=require(_0xdd30('0x1'));var rimraf=require(_0xdd30('0x2'));var zipdir=require(_0xdd30('0x3'));var jsonpatch=require(_0xdd30('0x4'));var rp=require(_0xdd30('0x5'));var moment=require(_0xdd30('0x6'));var BPromise=require(_0xdd30('0x7'));var Mustache=require(_0xdd30('0x8'));var util=require(_0xdd30('0x9'));var path=require(_0xdd30('0xa'));var sox=require(_0xdd30('0xb'));var csv=require(_0xdd30('0xc'));var ejs=require(_0xdd30('0xd'));var fs=require('fs');var _=require(_0xdd30('0xe'));var squel=require(_0xdd30('0xf'));var crypto=require(_0xdd30('0x10'));var jsforce=require(_0xdd30('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdd30('0x12'));var Papa=require(_0xdd30('0x13'));var Redis=require(_0xdd30('0x14'));var authService=require(_0xdd30('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xdd30('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd30('0x17'))(_0xdd30('0x18'));var utils=require(_0xdd30('0x19'));var config=require(_0xdd30('0x1a'));var db=require(_0xdd30('0x1b'))['db'];function respondWithStatusCode(_0x4a16b5,_0x4068af){_0x4068af=_0x4068af||0xcc;return function(_0x3ece1b){if(_0x3ece1b){return _0x4a16b5[_0xdd30('0x1c')](_0x4068af);}return _0x4a16b5[_0xdd30('0x1d')](_0x4068af)[_0xdd30('0x1e')]();};}function respondWithResult(_0x3c8e0b,_0x39f403){_0x39f403=_0x39f403||0xc8;return function(_0x3418cc){if(_0x3418cc){return _0x3c8e0b['status'](_0x39f403)[_0xdd30('0x1f')](_0x3418cc);}};}function respondWithFilteredResult(_0x32cc54,_0x4a1e60){return function(_0x86317a){if(_0x86317a){var _0x2f7098=_0x86317a[_0xdd30('0x20')],_0x1f996e=_0x4a1e60[_0xdd30('0x21')],_0x1e7310=_0x4a1e60['offset']+_0x4a1e60['limit'],_0x1b7cc2;if(_0x1e7310>=_0x2f7098){_0x1e7310=_0x2f7098;_0x1b7cc2=0xc8;}else{_0x1b7cc2=0xce;}_0x32cc54['status'](_0x1b7cc2);return _0x32cc54[_0xdd30('0x22')]('Content-Range',_0x1f996e+'-'+_0x1e7310+'/'+_0x2f7098)[_0xdd30('0x1f')](_0x86317a);}return null;};}function patchUpdates(_0x31ba1e){return function(_0x2b0fdb){try{jsonpatch[_0xdd30('0x23')](_0x2b0fdb,_0x31ba1e,!![]);}catch(_0x48ace9){return BPromise[_0xdd30('0x24')](_0x48ace9);}return _0x2b0fdb['save']();};}function saveUpdates(_0x269b51,_0x2b7fb3){return function(_0x6322ac){if(_0x6322ac){return _0x6322ac[_0xdd30('0x25')](_0x269b51)[_0xdd30('0x26')](function(_0x4d58c0){return _0x4d58c0;});}return null;};}function removeEntity(_0x12d402,_0x423712){return function(_0x33e282){if(_0x33e282){return _0x33e282[_0xdd30('0x27')]()['then'](function(){_0x12d402[_0xdd30('0x1d')](0xcc)[_0xdd30('0x1e')]();});}};}function handleEntityNotFound(_0x1553d3,_0x29efd9){return function(_0x22f0d6){if(!_0x22f0d6){_0x1553d3[_0xdd30('0x1c')](0x194);}return _0x22f0d6;};}function handleError(_0x15a7b9,_0x420578){_0x420578=_0x420578||0x1f4;return function(_0x4cc322){logger['error'](_0x4cc322[_0xdd30('0x28')]);if(_0x4cc322[_0xdd30('0x29')]){delete _0x4cc322[_0xdd30('0x29')];}_0x15a7b9['status'](_0x420578)['send'](_0x4cc322);};}exports[_0xdd30('0x2a')]=function(_0x295edb,_0xf0539f){var _0x3fcc29={},_0x368554={},_0x39d974={'count':0x0,'rows':[]};var _0x1fc6dd=_[_0xdd30('0x2b')](db[_0xdd30('0x2c')][_0xdd30('0x2d')],function(_0x2045a6){return{'name':_0x2045a6[_0xdd30('0x2e')],'type':_0x2045a6['type'][_0xdd30('0x2f')]};});_0x368554[_0xdd30('0x30')]=_[_0xdd30('0x2b')](_0x1fc6dd,_0xdd30('0x29'));_0x368554[_0xdd30('0x31')]=_[_0xdd30('0x32')](_0x295edb[_0xdd30('0x31')]);_0x368554[_0xdd30('0x33')]=_[_0xdd30('0x34')](_0x368554[_0xdd30('0x30')],_0x368554[_0xdd30('0x31')]);_0x3fcc29[_0xdd30('0x35')]=_[_0xdd30('0x34')](_0x368554[_0xdd30('0x30')],qs['fields'](_0x295edb[_0xdd30('0x31')][_0xdd30('0x36')]));_0x3fcc29['attributes']=_0x3fcc29['attributes'][_0xdd30('0x37')]?_0x3fcc29['attributes']:_0x368554[_0xdd30('0x30')];if(!_0x295edb[_0xdd30('0x31')][_0xdd30('0x38')](_0xdd30('0x39'))){_0x3fcc29[_0xdd30('0x3a')]=qs['limit'](_0x295edb['query']['limit']);_0x3fcc29['offset']=qs[_0xdd30('0x21')](_0x295edb[_0xdd30('0x31')]['offset']);}_0x3fcc29['order']=qs['sort'](_0x295edb[_0xdd30('0x31')]['sort']);_0x3fcc29['where']=qs[_0xdd30('0x33')](_[_0xdd30('0x3b')](_0x295edb['query'],_0x368554['filters']),_0x1fc6dd);if(_0x295edb[_0xdd30('0x31')]['filter']){_0x3fcc29[_0xdd30('0x3c')]=_[_0xdd30('0x3d')](_0x3fcc29[_0xdd30('0x3c')],{'$or':_['map'](_0x1fc6dd,function(_0x4da8f4){if(_0x4da8f4['type']!=='VIRTUAL'){var _0x1caec3={};_0x1caec3[_0x4da8f4[_0xdd30('0x29')]]={'$like':'%'+_0x295edb[_0xdd30('0x31')][_0xdd30('0x3e')]+'%'};return _0x1caec3;}})});}_0x3fcc29=_[_0xdd30('0x3d')]({},_0x3fcc29,_0x295edb[_0xdd30('0x3f')]);var _0xb324bf={'where':_0x3fcc29[_0xdd30('0x3c')]};return db[_0xdd30('0x2c')][_0xdd30('0x20')](_0xb324bf)[_0xdd30('0x26')](function(_0x2d6db1){_0x39d974[_0xdd30('0x20')]=_0x2d6db1;if(_0x295edb['query']['includeAll']){_0x3fcc29[_0xdd30('0x40')]=[{'all':!![]}];}return db[_0xdd30('0x2c')]['findAll'](_0x3fcc29);})[_0xdd30('0x26')](function(_0x84c0a7){_0x39d974[_0xdd30('0x41')]=_0x84c0a7;return _0x39d974;})[_0xdd30('0x26')](respondWithFilteredResult(_0xf0539f,_0x3fcc29))[_0xdd30('0x42')](handleError(_0xf0539f,null));};exports[_0xdd30('0x43')]=function(_0x4ea29c,_0x20bbd0){var _0x4ef336={'raw':![],'where':{'id':_0x4ea29c[_0xdd30('0x44')]['id']}},_0x34ca03={};_0x34ca03['model']=_[_0xdd30('0x32')](db[_0xdd30('0x2c')][_0xdd30('0x2d')]);_0x34ca03[_0xdd30('0x31')]=_[_0xdd30('0x32')](_0x4ea29c[_0xdd30('0x31')]);_0x34ca03[_0xdd30('0x33')]=_[_0xdd30('0x34')](_0x34ca03['model'],_0x34ca03[_0xdd30('0x31')]);_0x4ef336[_0xdd30('0x35')]=_['intersection'](_0x34ca03[_0xdd30('0x30')],qs[_0xdd30('0x36')](_0x4ea29c['query'][_0xdd30('0x36')]));_0x4ef336[_0xdd30('0x35')]=_0x4ef336[_0xdd30('0x35')][_0xdd30('0x37')]?_0x4ef336[_0xdd30('0x35')]:_0x34ca03['model'];if(_0x4ea29c['query'][_0xdd30('0x45')]){_0x4ef336[_0xdd30('0x40')]=[{'all':!![]}];}_0x4ef336=_[_0xdd30('0x3d')]({},_0x4ef336,_0x4ea29c[_0xdd30('0x3f')]);return db[_0xdd30('0x2c')]['find'](_0x4ef336)[_0xdd30('0x26')](handleEntityNotFound(_0x20bbd0,null))[_0xdd30('0x26')](respondWithResult(_0x20bbd0,null))[_0xdd30('0x42')](handleError(_0x20bbd0,null));};exports['create']=function(_0xf95060,_0x2553a5){return db['Integration'][_0xdd30('0x46')](_0xf95060[_0xdd30('0x47')],{})[_0xdd30('0x26')](respondWithResult(_0x2553a5,0xc9))[_0xdd30('0x42')](handleError(_0x2553a5,null));};exports[_0xdd30('0x25')]=function(_0x3c52d7,_0xfdd9de){if(_0x3c52d7[_0xdd30('0x47')]['id']){delete _0x3c52d7[_0xdd30('0x47')]['id'];}return db[_0xdd30('0x2c')][_0xdd30('0x48')]({'where':{'id':_0x3c52d7[_0xdd30('0x44')]['id']}})[_0xdd30('0x26')](handleEntityNotFound(_0xfdd9de,null))[_0xdd30('0x26')](saveUpdates(_0x3c52d7[_0xdd30('0x47')],null))['then'](respondWithResult(_0xfdd9de,null))[_0xdd30('0x42')](handleError(_0xfdd9de,null));};exports['destroy']=function(_0x473dde,_0xb397f4){return db[_0xdd30('0x2c')][_0xdd30('0x48')]({'where':{'id':_0x473dde[_0xdd30('0x44')]['id']}})[_0xdd30('0x26')](handleEntityNotFound(_0xb397f4,null))['then'](removeEntity(_0xb397f4,null))[_0xdd30('0x42')](handleError(_0xb397f4,null));}; \ No newline at end of file +var _0x9828=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','length','find','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9828,0x79));var _0x8982=function(_0x2a302d,_0x2936fa){_0x2a302d=_0x2a302d-0x0;var _0xbf002f=_0x9828[_0x2a302d];return _0xbf002f;};'use strict';var pdf=require(_0x8982('0x0'));var emlformat=require(_0x8982('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8982('0x2'));var rp=require(_0x8982('0x3'));var moment=require('moment');var BPromise=require(_0x8982('0x4'));var Mustache=require(_0x8982('0x5'));var util=require(_0x8982('0x6'));var path=require(_0x8982('0x7'));var sox=require(_0x8982('0x8'));var csv=require('to-csv');var ejs=require(_0x8982('0x9'));var fs=require('fs');var _=require(_0x8982('0xa'));var squel=require(_0x8982('0xb'));var crypto=require(_0x8982('0xc'));var jsforce=require(_0x8982('0xd'));var deskjs=require(_0x8982('0xe'));var toCsv=require(_0x8982('0xf'));var querystring=require(_0x8982('0x10'));var Papa=require(_0x8982('0x11'));var Redis=require(_0x8982('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8982('0x13'));var as=require(_0x8982('0x14'));var hardwareService=require(_0x8982('0x15'));var logger=require(_0x8982('0x16'))(_0x8982('0x17'));var utils=require(_0x8982('0x18'));var config=require(_0x8982('0x19'));var db=require(_0x8982('0x1a'))['db'];function respondWithStatusCode(_0x47a711,_0x414db3){_0x414db3=_0x414db3||0xcc;return function(_0x799c1d){if(_0x799c1d){return _0x47a711[_0x8982('0x1b')](_0x414db3);}return _0x47a711[_0x8982('0x1c')](_0x414db3)[_0x8982('0x1d')]();};}function respondWithResult(_0x453a3a,_0x17e44b){_0x17e44b=_0x17e44b||0xc8;return function(_0x244732){if(_0x244732){return _0x453a3a[_0x8982('0x1c')](_0x17e44b)[_0x8982('0x1e')](_0x244732);}};}function respondWithFilteredResult(_0x435d96,_0x3f52a2){return function(_0xb929d4){if(_0xb929d4){var _0x257217=_0xb929d4[_0x8982('0x1f')],_0x46c6e9=_0x3f52a2[_0x8982('0x20')],_0x161e18=_0x3f52a2['offset']+_0x3f52a2[_0x8982('0x21')],_0x4d5f28;if(_0x161e18>=_0x257217){_0x161e18=_0x257217;_0x4d5f28=0xc8;}else{_0x4d5f28=0xce;}_0x435d96['status'](_0x4d5f28);return _0x435d96[_0x8982('0x22')](_0x8982('0x23'),_0x46c6e9+'-'+_0x161e18+'/'+_0x257217)[_0x8982('0x1e')](_0xb929d4);}return null;};}function patchUpdates(_0xb1611a){return function(_0x11721b){try{jsonpatch['apply'](_0x11721b,_0xb1611a,!![]);}catch(_0x39ebef){return BPromise[_0x8982('0x24')](_0x39ebef);}return _0x11721b[_0x8982('0x25')]();};}function saveUpdates(_0x53c0ba,_0x318df4){return function(_0xdc3c7e){if(_0xdc3c7e){return _0xdc3c7e[_0x8982('0x26')](_0x53c0ba)[_0x8982('0x27')](function(_0x5276b5){return _0x5276b5;});}return null;};}function removeEntity(_0x244560,_0x39c189){return function(_0xe59113){if(_0xe59113){return _0xe59113[_0x8982('0x28')]()[_0x8982('0x27')](function(){_0x244560[_0x8982('0x1c')](0xcc)[_0x8982('0x1d')]();});}};}function handleEntityNotFound(_0xdb9443,_0x15420d){return function(_0x3e1525){if(!_0x3e1525){_0xdb9443[_0x8982('0x1b')](0x194);}return _0x3e1525;};}function handleError(_0x2b7606,_0x3cd5fd){_0x3cd5fd=_0x3cd5fd||0x1f4;return function(_0x4ddb0f){logger[_0x8982('0x29')](_0x4ddb0f['stack']);if(_0x4ddb0f[_0x8982('0x2a')]){delete _0x4ddb0f[_0x8982('0x2a')];}_0x2b7606[_0x8982('0x1c')](_0x3cd5fd)[_0x8982('0x2b')](_0x4ddb0f);};}exports[_0x8982('0x2c')]=function(_0x3eaec6,_0x3afbb0){var _0x25ae2b={},_0x35600f={},_0x29d7e1={'count':0x0,'rows':[]};var _0x595c0d=_[_0x8982('0x2d')](db[_0x8982('0x2e')][_0x8982('0x2f')],function(_0x4ff7df){return{'name':_0x4ff7df[_0x8982('0x30')],'type':_0x4ff7df[_0x8982('0x31')][_0x8982('0x32')]};});_0x35600f[_0x8982('0x33')]=_[_0x8982('0x2d')](_0x595c0d,_0x8982('0x2a'));_0x35600f[_0x8982('0x34')]=_[_0x8982('0x35')](_0x3eaec6[_0x8982('0x34')]);_0x35600f[_0x8982('0x36')]=_[_0x8982('0x37')](_0x35600f[_0x8982('0x33')],_0x35600f[_0x8982('0x34')]);_0x25ae2b['attributes']=_[_0x8982('0x37')](_0x35600f[_0x8982('0x33')],qs[_0x8982('0x38')](_0x3eaec6[_0x8982('0x34')][_0x8982('0x38')]));_0x25ae2b['attributes']=_0x25ae2b[_0x8982('0x39')]['length']?_0x25ae2b['attributes']:_0x35600f['model'];if(!_0x3eaec6[_0x8982('0x34')]['hasOwnProperty']('nolimit')){_0x25ae2b[_0x8982('0x21')]=qs[_0x8982('0x21')](_0x3eaec6[_0x8982('0x34')][_0x8982('0x21')]);_0x25ae2b[_0x8982('0x20')]=qs[_0x8982('0x20')](_0x3eaec6['query'][_0x8982('0x20')]);}_0x25ae2b[_0x8982('0x3a')]=qs[_0x8982('0x3b')](_0x3eaec6[_0x8982('0x34')][_0x8982('0x3b')]);_0x25ae2b['where']=qs['filters'](_[_0x8982('0x3c')](_0x3eaec6['query'],_0x35600f[_0x8982('0x36')]),_0x595c0d);if(_0x3eaec6[_0x8982('0x34')][_0x8982('0x3d')]){_0x25ae2b[_0x8982('0x3e')]=_[_0x8982('0x3f')](_0x25ae2b[_0x8982('0x3e')],{'$or':_['map'](_0x595c0d,function(_0x10ef66){if(_0x10ef66[_0x8982('0x31')]!=='VIRTUAL'){var _0x2b7f14={};_0x2b7f14[_0x10ef66[_0x8982('0x2a')]]={'$like':'%'+_0x3eaec6['query'][_0x8982('0x3d')]+'%'};return _0x2b7f14;}})});}_0x25ae2b=_[_0x8982('0x3f')]({},_0x25ae2b,_0x3eaec6[_0x8982('0x40')]);var _0x31d36d={'where':_0x25ae2b['where']};return db[_0x8982('0x2e')][_0x8982('0x1f')](_0x31d36d)['then'](function(_0x373dd0){_0x29d7e1[_0x8982('0x1f')]=_0x373dd0;if(_0x3eaec6[_0x8982('0x34')][_0x8982('0x41')]){_0x25ae2b[_0x8982('0x42')]=[{'all':!![]}];}return db[_0x8982('0x2e')][_0x8982('0x43')](_0x25ae2b);})[_0x8982('0x27')](function(_0x10dd1a){_0x29d7e1['rows']=_0x10dd1a;return _0x29d7e1;})['then'](respondWithFilteredResult(_0x3afbb0,_0x25ae2b))[_0x8982('0x44')](handleError(_0x3afbb0,null));};exports['show']=function(_0x142847,_0x312811){var _0x232a18={'raw':![],'where':{'id':_0x142847[_0x8982('0x45')]['id']}},_0x21c3c3={};_0x21c3c3[_0x8982('0x33')]=_['keys'](db[_0x8982('0x2e')][_0x8982('0x2f')]);_0x21c3c3[_0x8982('0x34')]=_[_0x8982('0x35')](_0x142847[_0x8982('0x34')]);_0x21c3c3[_0x8982('0x36')]=_['intersection'](_0x21c3c3[_0x8982('0x33')],_0x21c3c3['query']);_0x232a18[_0x8982('0x39')]=_['intersection'](_0x21c3c3['model'],qs['fields'](_0x142847['query'][_0x8982('0x38')]));_0x232a18['attributes']=_0x232a18[_0x8982('0x39')][_0x8982('0x46')]?_0x232a18[_0x8982('0x39')]:_0x21c3c3[_0x8982('0x33')];if(_0x142847[_0x8982('0x34')][_0x8982('0x41')]){_0x232a18[_0x8982('0x42')]=[{'all':!![]}];}_0x232a18=_[_0x8982('0x3f')]({},_0x232a18,_0x142847[_0x8982('0x40')]);return db[_0x8982('0x2e')][_0x8982('0x47')](_0x232a18)[_0x8982('0x27')](handleEntityNotFound(_0x312811,null))['then'](respondWithResult(_0x312811,null))[_0x8982('0x44')](handleError(_0x312811,null));};exports['create']=function(_0x414345,_0x321269){return db[_0x8982('0x2e')]['create'](_0x414345[_0x8982('0x48')],{})['then'](respondWithResult(_0x321269,0xc9))[_0x8982('0x44')](handleError(_0x321269,null));};exports[_0x8982('0x26')]=function(_0x5cc15e,_0xf2e77f){if(_0x5cc15e[_0x8982('0x48')]['id']){delete _0x5cc15e[_0x8982('0x48')]['id'];}return db[_0x8982('0x2e')][_0x8982('0x47')]({'where':{'id':_0x5cc15e[_0x8982('0x45')]['id']}})[_0x8982('0x27')](handleEntityNotFound(_0xf2e77f,null))[_0x8982('0x27')](saveUpdates(_0x5cc15e[_0x8982('0x48')],null))[_0x8982('0x27')](respondWithResult(_0xf2e77f,null))[_0x8982('0x44')](handleError(_0xf2e77f,null));};exports[_0x8982('0x28')]=function(_0x1808bf,_0x2fc98c){return db[_0x8982('0x2e')]['find']({'where':{'id':_0x1808bf[_0x8982('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fc98c,null))[_0x8982('0x27')](removeEntity(_0x2fc98c,null))[_0x8982('0x44')](handleError(_0x2fc98c,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8700b89..321500f 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 _0x9ef6=['path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x9ef6,0x12e));var _0x69ef=function(_0x44960d,_0x27ab5f){_0x44960d=_0x44960d-0x0;var _0x370dbf=_0x9ef6[_0x44960d];return _0x370dbf;};'use strict';var _=require(_0x69ef('0x0'));var util=require(_0x69ef('0x1'));var logger=require(_0x69ef('0x2'))(_0x69ef('0x3'));var moment=require(_0x69ef('0x4'));var BPromise=require('bluebird');var rp=require(_0x69ef('0x5'));var fs=require('fs');var path=require(_0x69ef('0x6'));var rimraf=require(_0x69ef('0x7'));var config=require(_0x69ef('0x8'));var attributes=require(_0x69ef('0x9'));module[_0x69ef('0xa')]=function(_0x220304,_0x1d5149){return _0x220304[_0x69ef('0xb')](_0x69ef('0xc'),attributes,{'tableName':_0x69ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1afb=['rimraf','exports','Integration','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x5b6f2f,_0x49e281){var _0x48fba4=function(_0x581381){while(--_0x581381){_0x5b6f2f['push'](_0x5b6f2f['shift']());}};_0x48fba4(++_0x49e281);}(_0x1afb,0xdb));var _0xb1af=function(_0x5cad33,_0x2a888f){_0x5cad33=_0x5cad33-0x0;var _0x5950a0=_0x1afb[_0x5cad33];return _0x5950a0;};'use strict';var _=require(_0xb1af('0x0'));var util=require('util');var logger=require(_0xb1af('0x1'))(_0xb1af('0x2'));var moment=require(_0xb1af('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1af('0x4'));var fs=require('fs');var path=require(_0xb1af('0x5'));var rimraf=require(_0xb1af('0x6'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0xb1af('0x7')]=function(_0x548e46,_0x442dc6){return _0x548e46['define'](_0xb1af('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 73a2d5c..141090a 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 _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2cba9b,_0x4bf060){var _0x4117cf=function(_0x328d08){while(--_0x328d08){_0x2cba9b['push'](_0x2cba9b['shift']());}};_0x4117cf(++_0x4bf060);}(_0x17ba,0xab));var _0xa17b=function(_0x3ab41a,_0x1d06bb){_0x3ab41a=_0x3ab41a-0x0;var _0x2a9c0d=_0x17ba[_0x3ab41a];return _0x2a9c0d;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('Integration,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('Integration,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file +var _0xa24e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0xa24e,0x137));var _0xea24=function(_0x2e2051,_0x26b49e){_0x2e2051=_0x2e2051-0x0;var _0x199c53=_0xa24e[_0x2e2051];return _0x199c53;};'use strict';var _=require(_0xea24('0x0'));var util=require(_0xea24('0x1'));var moment=require(_0xea24('0x2'));var BPromise=require(_0xea24('0x3'));var rs=require(_0xea24('0x4'));var fs=require('fs');var Redis=require(_0xea24('0x5'));var db=require(_0xea24('0x6'))['db'];var utils=require(_0xea24('0x7'));var logger=require(_0xea24('0x8'))('rpc');var config=require(_0xea24('0x9'));var jayson=require(_0xea24('0xa'));var client=jayson[_0xea24('0xb')][_0xea24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x361c92,_0x4a4793,_0x1ecec0){return new BPromise(function(_0x21c18a,_0xbd2e67){return client[_0xea24('0xd')](_0x361c92,_0x1ecec0)[_0xea24('0xe')](function(_0x478a96){logger['info'](_0xea24('0xf'),_0x4a4793,'request\x20sent');logger[_0xea24('0x10')](_0xea24('0x11'),_0x4a4793,_0xea24('0x12'),JSON[_0xea24('0x13')](_0x478a96));if(_0x478a96['error']){if(_0x478a96[_0xea24('0x14')][_0xea24('0x15')]===0x1f4){logger[_0xea24('0x14')](_0xea24('0xf'),_0x4a4793,_0x478a96[_0xea24('0x14')][_0xea24('0x16')]);return _0xbd2e67(_0x478a96[_0xea24('0x14')]['message']);}logger[_0xea24('0x14')]('Integration,\x20%s,\x20%s',_0x4a4793,_0x478a96[_0xea24('0x14')][_0xea24('0x16')]);return _0x21c18a(_0x478a96['error']['message']);}else{logger[_0xea24('0x17')]('Integration,\x20%s,\x20%s',_0x4a4793,_0xea24('0x12'));_0x21c18a(_0x478a96[_0xea24('0x18')][_0xea24('0x16')]);}})[_0xea24('0x19')](function(_0x502ea8){logger[_0xea24('0x14')]('Integration,\x20%s,\x20%s',_0x4a4793,_0x502ea8);_0xbd2e67(_0x502ea8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 968e65b..29d7ec4 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 _0x43d8=['put','delete','multer','util','path','express','Router','../../components/auth/service','./integrationReport.controller','index','get','describe','/:id','isAuthenticated','show','create'];(function(_0x5ebb9b,_0x4431dd){var _0x40d801=function(_0x1b6713){while(--_0x1b6713){_0x5ebb9b['push'](_0x5ebb9b['shift']());}};_0x40d801(++_0x4431dd);}(_0x43d8,0x1d2));var _0x843d=function(_0x588c33,_0xe686f7){_0x588c33=_0x588c33-0x0;var _0x5c639c=_0x43d8[_0x588c33];return _0x5c639c;};'use strict';var multer=require(_0x843d('0x0'));var util=require(_0x843d('0x1'));var path=require(_0x843d('0x2'));var timeout=require('connect-timeout');var express=require(_0x843d('0x3'));var router=express[_0x843d('0x4')]();var auth=require(_0x843d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x843d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x843d('0x7')]);router[_0x843d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x843d('0x9')]);router[_0x843d('0x8')](_0x843d('0xa'),auth[_0x843d('0xb')](),controller[_0x843d('0xc')]);router['post']('/',auth[_0x843d('0xb')](),controller[_0x843d('0xd')]);router[_0x843d('0xe')](_0x843d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x843d('0xf')]('/:id',auth[_0x843d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc953=['get','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./integrationReport.controller','isAuthenticated','index'];(function(_0x28b6c3,_0x3d3327){var _0x351127=function(_0x58a85f){while(--_0x58a85f){_0x28b6c3['push'](_0x28b6c3['shift']());}};_0x351127(++_0x3d3327);}(_0xc953,0x195));var _0x3c95=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xc953[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var path=require(_0x3c95('0x2'));var timeout=require(_0x3c95('0x3'));var express=require(_0x3c95('0x4'));var router=express['Router']();var auth=require(_0x3c95('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c95('0x6'));router['get']('/',auth[_0x3c95('0x7')](),controller[_0x3c95('0x8')]);router[_0x3c95('0x9')](_0x3c95('0xa'),auth[_0x3c95('0x7')](),controller[_0x3c95('0xb')]);router[_0x3c95('0x9')](_0x3c95('0xc'),auth[_0x3c95('0x7')](),controller[_0x3c95('0xd')]);router['post']('/',auth[_0x3c95('0x7')](),controller['create']);router['put'](_0x3c95('0xc'),auth[_0x3c95('0x7')](),controller[_0x3c95('0xe')]);router[_0x3c95('0xf')](_0x3c95('0xc'),auth['isAuthenticated'](),controller[_0x3c95('0x10')]);module[_0x3c95('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 93d07cb..07a210e 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 _0x9bec=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x5ee83b,_0x6b72e2){var _0x5bfe0c=function(_0x44fad5){while(--_0x44fad5){_0x5ee83b['push'](_0x5ee83b['shift']());}};_0x5bfe0c(++_0x6b72e2);}(_0x9bec,0x10d));var _0xc9be=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x9bec[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xc9be('0x0'));module[_0xc9be('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xc9be('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xc9be('0x3')]},'contacts':{'type':Sequelize[_0xc9be('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc9be('0x2')]},'calleridname':{'type':Sequelize[_0xc9be('0x2')]},'queue':{'type':Sequelize[_0xc9be('0x2')]},'interface':{'type':Sequelize[_0xc9be('0x2')]},'membername':{'type':Sequelize[_0xc9be('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc9be('0x4')]},'agentconnectAt':{'type':Sequelize[_0xc9be('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xc9be('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc9be('0x4')]},'talktime':{'type':Sequelize[_0xc9be('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc9be('0x3')]},'reason':{'type':Sequelize[_0xc9be('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xc9be('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc9be('0x4')]},'agentdump':{'type':Sequelize[_0xc9be('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc9be('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc9be('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc9be('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc9be('0x2')]},'connectedlinename':{'type':Sequelize[_0xc9be('0x2')]},'language':{'type':Sequelize[_0xc9be('0x2')]},'accountcode':{'type':Sequelize[_0xc9be('0x2')]},'context':{'type':Sequelize[_0xc9be('0x2')]},'exten':{'type':Sequelize[_0xc9be('0x2')]},'priority':{'type':Sequelize[_0xc9be('0x2')]},'destchannel':{'type':Sequelize[_0xc9be('0x2')]},'destchannelstate':{'type':Sequelize[_0xc9be('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc9be('0x2')]},'destcalleridname':{'type':Sequelize[_0xc9be('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc9be('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc9be('0x2')]},'destcontext':{'type':Sequelize[_0xc9be('0x2')]},'destexten':{'type':Sequelize[_0xc9be('0x2')]},'destpriority':{'type':Sequelize[_0xc9be('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc9be('0x2')]},'subject':{'type':Sequelize[_0xc9be('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc9be('0x2')]},'cc':{'type':Sequelize[_0xc9be('0x2')]},'attachment':{'type':Sequelize[_0xc9be('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xc9be('0x6')]},'status':{'type':Sequelize[_0xc9be('0x7')](_0xc9be('0x8'),_0xc9be('0x9'),_0xc9be('0xa'),_0xc9be('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc9be('0x2')]},'appdata':{'type':Sequelize[_0xc9be('0x2')]},'projectId':{'type':Sequelize[_0xc9be('0x3')]}}; \ No newline at end of file +var _0x1b17=['STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED','exports'];(function(_0x51d57b,_0x31700c){var _0xd21892=function(_0x1bf0fe){while(--_0x1bf0fe){_0x51d57b['push'](_0x51d57b['shift']());}};_0xd21892(++_0x31700c);}(_0x1b17,0x13f));var _0x71b1=function(_0x5a09e9,_0x391256){_0x5a09e9=_0x5a09e9-0x0;var _0x5e4735=_0x1b17[_0x5a09e9];return _0x5e4735;};'use strict';var Sequelize=require('sequelize');module[_0x71b1('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x71b1('0x1')]},'exitStatus':{'type':Sequelize[_0x71b1('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x71b1('0x2')]},'contacts':{'type':Sequelize[_0x71b1('0x1')]},'uniqueid':{'type':Sequelize[_0x71b1('0x1')]},'calleridnum':{'type':Sequelize[_0x71b1('0x1')]},'calleridname':{'type':Sequelize[_0x71b1('0x1')]},'queue':{'type':Sequelize[_0x71b1('0x1')]},'interface':{'type':Sequelize[_0x71b1('0x1')]},'membername':{'type':Sequelize[_0x71b1('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x71b1('0x3')]},'holdtime':{'type':Sequelize[_0x71b1('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x71b1('0x3')]},'talktime':{'type':Sequelize[_0x71b1('0x2')]},'agentacw':{'type':Sequelize[_0x71b1('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x71b1('0x2')]},'reason':{'type':Sequelize[_0x71b1('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x71b1('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x71b1('0x3')]},'agentdump':{'type':Sequelize[_0x71b1('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x71b1('0x3')]},'lastevent':{'type':Sequelize[_0x71b1('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x71b1('0x1')]},'connectedlinenum':{'type':Sequelize[_0x71b1('0x1')]},'connectedlinename':{'type':Sequelize[_0x71b1('0x1')]},'language':{'type':Sequelize[_0x71b1('0x1')]},'accountcode':{'type':Sequelize[_0x71b1('0x1')]},'context':{'type':Sequelize[_0x71b1('0x1')]},'exten':{'type':Sequelize[_0x71b1('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x71b1('0x1')]},'destchannelstate':{'type':Sequelize[_0x71b1('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x71b1('0x1')]},'destcalleridname':{'type':Sequelize[_0x71b1('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x71b1('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x71b1('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x71b1('0x1')]},'destexten':{'type':Sequelize[_0x71b1('0x1')]},'destpriority':{'type':Sequelize[_0x71b1('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x71b1('0x1')]},'inReplyTo':{'type':Sequelize[_0x71b1('0x1')]},'subject':{'type':Sequelize[_0x71b1('0x1')]},'from':{'type':Sequelize[_0x71b1('0x1')]},'to':{'type':Sequelize[_0x71b1('0x1')]},'cc':{'type':Sequelize[_0x71b1('0x1')]},'attachment':{'type':Sequelize[_0x71b1('0x5')]},'html':{'type':Sequelize[_0x71b1('0x5')]},'text':{'type':Sequelize[_0x71b1('0x5')]},'status':{'type':Sequelize['ENUM']('SENT',_0x71b1('0x6'),_0x71b1('0x7'),'FAILED')},'url':{'type':Sequelize[_0x71b1('0x1')]},'app':{'type':Sequelize[_0x71b1('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x71b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4c310cb..63413bc 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 _0xfaeb=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','end','status','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','send','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','IntegrationReport','rows','catch','show','params','rawAttributes','options','create','body','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfaeb,0x14b));var _0xbfae=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xfaeb[_0x503950];return _0x1657a9;};'use strict';var pdf=require(_0xbfae('0x0'));var emlformat=require(_0xbfae('0x1'));var rimraf=require(_0xbfae('0x2'));var zipdir=require(_0xbfae('0x3'));var jsonpatch=require(_0xbfae('0x4'));var rp=require(_0xbfae('0x5'));var moment=require(_0xbfae('0x6'));var BPromise=require(_0xbfae('0x7'));var Mustache=require('mustache');var util=require(_0xbfae('0x8'));var path=require('path');var sox=require(_0xbfae('0x9'));var csv=require(_0xbfae('0xa'));var ejs=require(_0xbfae('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbfae('0xc'));var jsforce=require(_0xbfae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbfae('0xa'));var querystring=require(_0xbfae('0xe'));var Papa=require('papaparse');var Redis=require(_0xbfae('0xf'));var authService=require(_0xbfae('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbfae('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfae('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbfae('0x13'))['db'];function respondWithStatusCode(_0x540df9,_0x4ae7eb){_0x4ae7eb=_0x4ae7eb||0xcc;return function(_0x5e5a83){if(_0x5e5a83){return _0x540df9[_0xbfae('0x14')](_0x4ae7eb);}return _0x540df9['status'](_0x4ae7eb)[_0xbfae('0x15')]();};}function respondWithResult(_0x5997c0,_0x2032cc){_0x2032cc=_0x2032cc||0xc8;return function(_0x5ee607){if(_0x5ee607){return _0x5997c0[_0xbfae('0x16')](_0x2032cc)['json'](_0x5ee607);}};}function respondWithFilteredResult(_0x3f8647,_0x4c8136){return function(_0x5b7657){if(_0x5b7657){var _0x15d327=_0x5b7657[_0xbfae('0x17')],_0x2a99fa=_0x4c8136[_0xbfae('0x18')],_0x34b6b4=_0x4c8136[_0xbfae('0x18')]+_0x4c8136[_0xbfae('0x19')],_0x3abe75;if(_0x34b6b4>=_0x15d327){_0x34b6b4=_0x15d327;_0x3abe75=0xc8;}else{_0x3abe75=0xce;}_0x3f8647[_0xbfae('0x16')](_0x3abe75);return _0x3f8647[_0xbfae('0x1a')]('Content-Range',_0x2a99fa+'-'+_0x34b6b4+'/'+_0x15d327)['json'](_0x5b7657);}return null;};}function patchUpdates(_0x314ac3){return function(_0x2ffb52){try{jsonpatch[_0xbfae('0x1b')](_0x2ffb52,_0x314ac3,!![]);}catch(_0x112421){return BPromise[_0xbfae('0x1c')](_0x112421);}return _0x2ffb52['save']();};}function saveUpdates(_0x19390a,_0x3b1cf4){return function(_0x10e32c){if(_0x10e32c){return _0x10e32c[_0xbfae('0x1d')](_0x19390a)['then'](function(_0x8e6070){return _0x8e6070;});}return null;};}function removeEntity(_0x5c87d7,_0x1cee35){return function(_0x2c5c0c){if(_0x2c5c0c){return _0x2c5c0c[_0xbfae('0x1e')]()[_0xbfae('0x1f')](function(){_0x5c87d7['status'](0xcc)[_0xbfae('0x15')]();});}};}function handleEntityNotFound(_0x5cf535,_0x4d7b47){return function(_0x2b2a6b){if(!_0x2b2a6b){_0x5cf535[_0xbfae('0x14')](0x194);}return _0x2b2a6b;};}function handleError(_0x3cf7bd,_0x2709a2){_0x2709a2=_0x2709a2||0x1f4;return function(_0x48cf6f){logger[_0xbfae('0x20')](_0x48cf6f[_0xbfae('0x21')]);if(_0x48cf6f[_0xbfae('0x22')]){delete _0x48cf6f['name'];}_0x3cf7bd[_0xbfae('0x16')](_0x2709a2)[_0xbfae('0x23')](_0x48cf6f);};}exports['index']=function(_0x4df8e9,_0xa1da52){var _0xd4cbaf={},_0x27acd5={},_0x33f742={'count':0x0,'rows':[]};var _0x33b5e5=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x14752d){return{'name':_0x14752d['fieldName'],'type':_0x14752d[_0xbfae('0x24')]['key']};});_0x27acd5[_0xbfae('0x25')]=_[_0xbfae('0x26')](_0x33b5e5,_0xbfae('0x22'));_0x27acd5[_0xbfae('0x27')]=_[_0xbfae('0x28')](_0x4df8e9[_0xbfae('0x27')]);_0x27acd5[_0xbfae('0x29')]=_[_0xbfae('0x2a')](_0x27acd5['model'],_0x27acd5[_0xbfae('0x27')]);_0xd4cbaf[_0xbfae('0x2b')]=_[_0xbfae('0x2a')](_0x27acd5[_0xbfae('0x25')],qs[_0xbfae('0x2c')](_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x2c')]));_0xd4cbaf[_0xbfae('0x2b')]=_0xd4cbaf['attributes'][_0xbfae('0x2d')]?_0xd4cbaf[_0xbfae('0x2b')]:_0x27acd5[_0xbfae('0x25')];if(!_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x2e')](_0xbfae('0x2f'))){_0xd4cbaf[_0xbfae('0x19')]=qs[_0xbfae('0x19')](_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x19')]);_0xd4cbaf['offset']=qs[_0xbfae('0x18')](_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x18')]);}_0xd4cbaf[_0xbfae('0x30')]=qs[_0xbfae('0x31')](_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x31')]);_0xd4cbaf[_0xbfae('0x32')]=qs[_0xbfae('0x29')](_['pick'](_0x4df8e9[_0xbfae('0x27')],_0x27acd5[_0xbfae('0x29')]),_0x33b5e5);if(_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x33')]){_0xd4cbaf[_0xbfae('0x32')]=_[_0xbfae('0x34')](_0xd4cbaf['where'],{'$or':_[_0xbfae('0x26')](_0x33b5e5,function(_0x11961e){if(_0x11961e[_0xbfae('0x24')]!=='VIRTUAL'){var _0x3b4285={};_0x3b4285[_0x11961e[_0xbfae('0x22')]]={'$like':'%'+_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x33')]+'%'};return _0x3b4285;}})});}_0xd4cbaf=_['merge']({},_0xd4cbaf,_0x4df8e9['options']);var _0xbc1e0b={'where':_0xd4cbaf[_0xbfae('0x32')]};return db['IntegrationReport'][_0xbfae('0x17')](_0xbc1e0b)[_0xbfae('0x1f')](function(_0x344f91){_0x33f742[_0xbfae('0x17')]=_0x344f91;if(_0x4df8e9[_0xbfae('0x27')][_0xbfae('0x35')]){_0xd4cbaf[_0xbfae('0x36')]=[{'all':!![]}];}return db[_0xbfae('0x37')]['findAll'](_0xd4cbaf);})[_0xbfae('0x1f')](function(_0x2dde70){_0x33f742[_0xbfae('0x38')]=_0x2dde70;return _0x33f742;})[_0xbfae('0x1f')](respondWithFilteredResult(_0xa1da52,_0xd4cbaf))[_0xbfae('0x39')](handleError(_0xa1da52,null));};exports[_0xbfae('0x3a')]=function(_0x37425d,_0x44bc96){var _0x136a5d={'raw':![],'where':{'id':_0x37425d[_0xbfae('0x3b')]['id']}},_0x256968={};_0x256968[_0xbfae('0x25')]=_[_0xbfae('0x28')](db[_0xbfae('0x37')][_0xbfae('0x3c')]);_0x256968['query']=_['keys'](_0x37425d['query']);_0x256968[_0xbfae('0x29')]=_[_0xbfae('0x2a')](_0x256968['model'],_0x256968[_0xbfae('0x27')]);_0x136a5d['attributes']=_[_0xbfae('0x2a')](_0x256968[_0xbfae('0x25')],qs['fields'](_0x37425d[_0xbfae('0x27')]['fields']));_0x136a5d['attributes']=_0x136a5d['attributes'][_0xbfae('0x2d')]?_0x136a5d['attributes']:_0x256968['model'];if(_0x37425d[_0xbfae('0x27')][_0xbfae('0x35')]){_0x136a5d['include']=[{'all':!![]}];}_0x136a5d=_[_0xbfae('0x34')]({},_0x136a5d,_0x37425d[_0xbfae('0x3d')]);return db['IntegrationReport']['find'](_0x136a5d)['then'](handleEntityNotFound(_0x44bc96,null))[_0xbfae('0x1f')](respondWithResult(_0x44bc96,null))['catch'](handleError(_0x44bc96,null));};exports[_0xbfae('0x3e')]=function(_0x4fcdca,_0x309857){return db['IntegrationReport']['create'](_0x4fcdca[_0xbfae('0x3f')],{})['then'](respondWithResult(_0x309857,0xc9))[_0xbfae('0x39')](handleError(_0x309857,null));};exports[_0xbfae('0x1d')]=function(_0x1825fc,_0x2e761c){if(_0x1825fc[_0xbfae('0x3f')]['id']){delete _0x1825fc[_0xbfae('0x3f')]['id'];}return db['IntegrationReport'][_0xbfae('0x40')]({'where':{'id':_0x1825fc[_0xbfae('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2e761c,null))[_0xbfae('0x1f')](saveUpdates(_0x1825fc[_0xbfae('0x3f')],null))['then'](respondWithResult(_0x2e761c,null))[_0xbfae('0x39')](handleError(_0x2e761c,null));};exports[_0xbfae('0x1e')]=function(_0x459900,_0x3a5f9a){return db['IntegrationReport'][_0xbfae('0x40')]({'where':{'id':_0x459900[_0xbfae('0x3b')]['id']}})[_0xbfae('0x1f')](handleEntityNotFound(_0x3a5f9a,null))[_0xbfae('0x1f')](removeEntity(_0x3a5f9a,null))[_0xbfae('0x39')](handleError(_0x3a5f9a,null));};exports[_0xbfae('0x41')]=function(_0x59719a,_0x2a8963){return db[_0xbfae('0x37')][_0xbfae('0x41')]()['then'](respondWithResult(_0x2a8963,null))[_0xbfae('0x39')](handleError(_0x2a8963,null));}; \ No newline at end of file +var _0x9f0d=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','reject','save','update','then','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x2c4841,_0x10c9fe){var _0x1a24c0=function(_0xf068df){while(--_0xf068df){_0x2c4841['push'](_0x2c4841['shift']());}};_0x1a24c0(++_0x10c9fe);}(_0x9f0d,0x16b));var _0xd9f0=function(_0x574a32,_0x4b9abf){_0x574a32=_0x574a32-0x0;var _0x3c1730=_0x9f0d[_0x574a32];return _0x3c1730;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd9f0('0x0'));var rimraf=require(_0xd9f0('0x1'));var zipdir=require(_0xd9f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9f0('0x3'));var moment=require(_0xd9f0('0x4'));var BPromise=require(_0xd9f0('0x5'));var Mustache=require(_0xd9f0('0x6'));var util=require(_0xd9f0('0x7'));var path=require('path');var sox=require(_0xd9f0('0x8'));var csv=require(_0xd9f0('0x9'));var ejs=require(_0xd9f0('0xa'));var fs=require('fs');var _=require(_0xd9f0('0xb'));var squel=require(_0xd9f0('0xc'));var crypto=require(_0xd9f0('0xd'));var jsforce=require(_0xd9f0('0xe'));var deskjs=require(_0xd9f0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9f0('0x10'));var Papa=require(_0xd9f0('0x11'));var Redis=require(_0xd9f0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9f0('0x13'));var logger=require(_0xd9f0('0x14'))('api');var utils=require(_0xd9f0('0x15'));var config=require('../../config/environment');var db=require(_0xd9f0('0x16'))['db'];function respondWithStatusCode(_0xd2059d,_0x117c9d){_0x117c9d=_0x117c9d||0xcc;return function(_0x10de5f){if(_0x10de5f){return _0xd2059d[_0xd9f0('0x17')](_0x117c9d);}return _0xd2059d['status'](_0x117c9d)[_0xd9f0('0x18')]();};}function respondWithResult(_0x4c4026,_0x14c246){_0x14c246=_0x14c246||0xc8;return function(_0x5e5eb5){if(_0x5e5eb5){return _0x4c4026['status'](_0x14c246)['json'](_0x5e5eb5);}};}function respondWithFilteredResult(_0x937d08,_0x3cf164){return function(_0x3b0e4f){if(_0x3b0e4f){var _0x1eeed0=_0x3b0e4f[_0xd9f0('0x19')],_0x282df7=_0x3cf164[_0xd9f0('0x1a')],_0x4b08f9=_0x3cf164[_0xd9f0('0x1a')]+_0x3cf164['limit'],_0x27147c;if(_0x4b08f9>=_0x1eeed0){_0x4b08f9=_0x1eeed0;_0x27147c=0xc8;}else{_0x27147c=0xce;}_0x937d08[_0xd9f0('0x1b')](_0x27147c);return _0x937d08[_0xd9f0('0x1c')](_0xd9f0('0x1d'),_0x282df7+'-'+_0x4b08f9+'/'+_0x1eeed0)['json'](_0x3b0e4f);}return null;};}function patchUpdates(_0x3ec433){return function(_0x23c424){try{jsonpatch['apply'](_0x23c424,_0x3ec433,!![]);}catch(_0x159d36){return BPromise[_0xd9f0('0x1e')](_0x159d36);}return _0x23c424[_0xd9f0('0x1f')]();};}function saveUpdates(_0xed90ca,_0x129568){return function(_0x16e815){if(_0x16e815){return _0x16e815[_0xd9f0('0x20')](_0xed90ca)[_0xd9f0('0x21')](function(_0x5ef3f4){return _0x5ef3f4;});}return null;};}function removeEntity(_0x1af198,_0x605ecf){return function(_0x40bf75){if(_0x40bf75){return _0x40bf75['destroy']()[_0xd9f0('0x21')](function(){_0x1af198['status'](0xcc)[_0xd9f0('0x18')]();});}};}function handleEntityNotFound(_0x2e2080,_0x3cf6f5){return function(_0x18f402){if(!_0x18f402){_0x2e2080[_0xd9f0('0x17')](0x194);}return _0x18f402;};}function handleError(_0x10fcc8,_0x51a14f){_0x51a14f=_0x51a14f||0x1f4;return function(_0xa76261){logger[_0xd9f0('0x22')](_0xa76261[_0xd9f0('0x23')]);if(_0xa76261['name']){delete _0xa76261[_0xd9f0('0x24')];}_0x10fcc8[_0xd9f0('0x1b')](_0x51a14f)['send'](_0xa76261);};}exports[_0xd9f0('0x25')]=function(_0x32fcf6,_0x18f18c){var _0x58be33={},_0x3ba910={},_0x3e10b6={'count':0x0,'rows':[]};var _0x4b0ee6=_[_0xd9f0('0x26')](db[_0xd9f0('0x27')][_0xd9f0('0x28')],function(_0x5ac6fe){return{'name':_0x5ac6fe[_0xd9f0('0x29')],'type':_0x5ac6fe[_0xd9f0('0x2a')][_0xd9f0('0x2b')]};});_0x3ba910[_0xd9f0('0x2c')]=_['map'](_0x4b0ee6,'name');_0x3ba910[_0xd9f0('0x2d')]=_[_0xd9f0('0x2e')](_0x32fcf6[_0xd9f0('0x2d')]);_0x3ba910[_0xd9f0('0x2f')]=_[_0xd9f0('0x30')](_0x3ba910[_0xd9f0('0x2c')],_0x3ba910['query']);_0x58be33[_0xd9f0('0x31')]=_[_0xd9f0('0x30')](_0x3ba910['model'],qs[_0xd9f0('0x32')](_0x32fcf6[_0xd9f0('0x2d')][_0xd9f0('0x32')]));_0x58be33[_0xd9f0('0x31')]=_0x58be33[_0xd9f0('0x31')]['length']?_0x58be33[_0xd9f0('0x31')]:_0x3ba910[_0xd9f0('0x2c')];if(!_0x32fcf6[_0xd9f0('0x2d')][_0xd9f0('0x33')](_0xd9f0('0x34'))){_0x58be33[_0xd9f0('0x35')]=qs[_0xd9f0('0x35')](_0x32fcf6['query'][_0xd9f0('0x35')]);_0x58be33[_0xd9f0('0x1a')]=qs[_0xd9f0('0x1a')](_0x32fcf6[_0xd9f0('0x2d')]['offset']);}_0x58be33[_0xd9f0('0x36')]=qs[_0xd9f0('0x37')](_0x32fcf6[_0xd9f0('0x2d')][_0xd9f0('0x37')]);_0x58be33['where']=qs[_0xd9f0('0x2f')](_[_0xd9f0('0x38')](_0x32fcf6['query'],_0x3ba910[_0xd9f0('0x2f')]),_0x4b0ee6);if(_0x32fcf6[_0xd9f0('0x2d')][_0xd9f0('0x39')]){_0x58be33[_0xd9f0('0x3a')]=_[_0xd9f0('0x3b')](_0x58be33[_0xd9f0('0x3a')],{'$or':_['map'](_0x4b0ee6,function(_0x278c99){if(_0x278c99[_0xd9f0('0x2a')]!==_0xd9f0('0x3c')){var _0x31dcf8={};_0x31dcf8[_0x278c99['name']]={'$like':'%'+_0x32fcf6[_0xd9f0('0x2d')]['filter']+'%'};return _0x31dcf8;}})});}_0x58be33=_[_0xd9f0('0x3b')]({},_0x58be33,_0x32fcf6[_0xd9f0('0x3d')]);var _0x5190ea={'where':_0x58be33[_0xd9f0('0x3a')]};return db['IntegrationReport'][_0xd9f0('0x19')](_0x5190ea)[_0xd9f0('0x21')](function(_0x2f59da){_0x3e10b6[_0xd9f0('0x19')]=_0x2f59da;if(_0x32fcf6[_0xd9f0('0x2d')][_0xd9f0('0x3e')]){_0x58be33[_0xd9f0('0x3f')]=[{'all':!![]}];}return db[_0xd9f0('0x27')][_0xd9f0('0x40')](_0x58be33);})[_0xd9f0('0x21')](function(_0x5de52a){_0x3e10b6[_0xd9f0('0x41')]=_0x5de52a;return _0x3e10b6;})[_0xd9f0('0x21')](respondWithFilteredResult(_0x18f18c,_0x58be33))[_0xd9f0('0x42')](handleError(_0x18f18c,null));};exports[_0xd9f0('0x43')]=function(_0x889264,_0x28bd07){var _0x2aecf1={'raw':![],'where':{'id':_0x889264[_0xd9f0('0x44')]['id']}},_0x56880a={};_0x56880a[_0xd9f0('0x2c')]=_[_0xd9f0('0x2e')](db[_0xd9f0('0x27')][_0xd9f0('0x28')]);_0x56880a[_0xd9f0('0x2d')]=_[_0xd9f0('0x2e')](_0x889264['query']);_0x56880a[_0xd9f0('0x2f')]=_[_0xd9f0('0x30')](_0x56880a[_0xd9f0('0x2c')],_0x56880a[_0xd9f0('0x2d')]);_0x2aecf1[_0xd9f0('0x31')]=_[_0xd9f0('0x30')](_0x56880a[_0xd9f0('0x2c')],qs[_0xd9f0('0x32')](_0x889264['query'][_0xd9f0('0x32')]));_0x2aecf1[_0xd9f0('0x31')]=_0x2aecf1['attributes'][_0xd9f0('0x45')]?_0x2aecf1[_0xd9f0('0x31')]:_0x56880a['model'];if(_0x889264[_0xd9f0('0x2d')]['includeAll']){_0x2aecf1[_0xd9f0('0x3f')]=[{'all':!![]}];}_0x2aecf1=_['merge']({},_0x2aecf1,_0x889264[_0xd9f0('0x3d')]);return db[_0xd9f0('0x27')]['find'](_0x2aecf1)[_0xd9f0('0x21')](handleEntityNotFound(_0x28bd07,null))[_0xd9f0('0x21')](respondWithResult(_0x28bd07,null))[_0xd9f0('0x42')](handleError(_0x28bd07,null));};exports[_0xd9f0('0x46')]=function(_0x38e499,_0x3251c6){return db[_0xd9f0('0x27')][_0xd9f0('0x46')](_0x38e499['body'],{})[_0xd9f0('0x21')](respondWithResult(_0x3251c6,0xc9))[_0xd9f0('0x42')](handleError(_0x3251c6,null));};exports[_0xd9f0('0x20')]=function(_0x6c6558,_0x2631c1){if(_0x6c6558[_0xd9f0('0x47')]['id']){delete _0x6c6558[_0xd9f0('0x47')]['id'];}return db[_0xd9f0('0x27')][_0xd9f0('0x48')]({'where':{'id':_0x6c6558['params']['id']}})[_0xd9f0('0x21')](handleEntityNotFound(_0x2631c1,null))[_0xd9f0('0x21')](saveUpdates(_0x6c6558[_0xd9f0('0x47')],null))[_0xd9f0('0x21')](respondWithResult(_0x2631c1,null))[_0xd9f0('0x42')](handleError(_0x2631c1,null));};exports[_0xd9f0('0x49')]=function(_0x12d8fc,_0x11abce){return db['IntegrationReport'][_0xd9f0('0x48')]({'where':{'id':_0x12d8fc['params']['id']}})[_0xd9f0('0x21')](handleEntityNotFound(_0x11abce,null))[_0xd9f0('0x21')](removeEntity(_0x11abce,null))[_0xd9f0('0x42')](handleError(_0x11abce,null));};exports[_0xd9f0('0x4a')]=function(_0x3a559c,_0x3d8aa6){return db[_0xd9f0('0x27')][_0xd9f0('0x4a')]()['then'](respondWithResult(_0x3d8aa6,null))[_0xd9f0('0x42')](handleError(_0x3d8aa6,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 853ce72..f700f26 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 _0x5079=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5079,0x155));var _0x9507=function(_0x59b533,_0x59fdcc){_0x59b533=_0x59b533-0x0;var _0x2beced=_0x5079[_0x59b533];return _0x2beced;};'use strict';var _=require(_0x9507('0x0'));var util=require(_0x9507('0x1'));var logger=require(_0x9507('0x2'))(_0x9507('0x3'));var moment=require(_0x9507('0x4'));var BPromise=require(_0x9507('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9507('0x6'));var rimraf=require(_0x9507('0x7'));var config=require(_0x9507('0x8'));var attributes=require(_0x9507('0x9'));module[_0x9507('0xa')]=function(_0x5bcbe2,_0x5ecd88){return _0x5bcbe2[_0x9507('0xb')](_0x9507('0xc'),attributes,{'tableName':_0x9507('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd019=['exports','define','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x58637c,_0x4c5305){var _0x24c2a5=function(_0x271aea){while(--_0x271aea){_0x58637c['push'](_0x58637c['shift']());}};_0x24c2a5(++_0x4c5305);}(_0xd019,0x1cf));var _0x9d01=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xd019[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x9d01('0x0'));var util=require(_0x9d01('0x1'));var logger=require(_0x9d01('0x2'))('api');var moment=require(_0x9d01('0x3'));var BPromise=require(_0x9d01('0x4'));var rp=require(_0x9d01('0x5'));var fs=require('fs');var path=require(_0x9d01('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x9d01('0x7')]=function(_0x47353e,_0xe4a038){return _0x47353e[_0x9d01('0x8')]('IntegrationReport',attributes,{'tableName':_0x9d01('0x9'),'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 41840ff..3ae0482 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 _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x4fc2,0x111));var _0x24fc=function(_0x1ce919,_0x1bbb96){_0x1ce919=_0x1ce919-0x0;var _0x34ec94=_0x4fc2[_0x1ce919];return _0x34ec94;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file +var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x62264a,_0x506551){var _0x4ac02f=function(_0x58fc20){while(--_0x58fc20){_0x62264a['push'](_0x62264a['shift']());}};_0x4ac02f(++_0x506551);}(_0x757a,0xde));var _0xa757=function(_0x54a951,_0x23f9d2){_0x54a951=_0x54a951-0x0;var _0x5d6032=_0x757a[_0x54a951];return _0x5d6032;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index de9247a..38b1f32 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 _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x2404c0,_0xe15b8c){var _0x4424d6=function(_0x4e6bcf){while(--_0x4e6bcf){_0x2404c0['push'](_0x2404c0['shift']());}};_0x4424d6(++_0xe15b8c);}(_0x7217,0x19e));var _0x7721=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x7217[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xe')](_0x7721('0x11'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);module[_0x7721('0x16')]=router; \ No newline at end of file +var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2c372,_0x5ed108){var _0x4b6fec=function(_0x21f8d7){while(--_0x21f8d7){_0x2c372['push'](_0x2c372['shift']());}};_0x4b6fec(++_0x5ed108);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 6b738d3..1dc1784 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 _0xe832=['STRING','sequelize','exports'];(function(_0x36dff4,_0x26cea3){var _0x5a0a85=function(_0x58020a){while(--_0x58020a){_0x36dff4['push'](_0x36dff4['shift']());}};_0x5a0a85(++_0x26cea3);}(_0xe832,0x16f));var _0x2e83=function(_0x4d7684,_0xbd5628){_0x4d7684=_0x4d7684-0x0;var _0x430ba9=_0xe832[_0x4d7684];return _0x430ba9;};'use strict';var Sequelize=require(_0x2e83('0x0'));module[_0x2e83('0x1')]={'name':{'type':Sequelize[_0x2e83('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2e83('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc542=['sequelize','exports','STRING'];(function(_0xf301c5,_0x4a5a61){var _0x439780=function(_0x5dde32){while(--_0x5dde32){_0xf301c5['push'](_0xf301c5['shift']());}};_0x439780(++_0x4a5a61);}(_0xc542,0xae));var _0x2c54=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xc542[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x2c54('0x0'));module[_0x2c54('0x1')]={'name':{'type':Sequelize[_0x2c54('0x2')]},'description':{'type':Sequelize[_0x2c54('0x2')]},'interval':{'type':Sequelize[_0x2c54('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 37484b9..60ee6b8 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 _0x72c7=['rows','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','create','catch','getIntervals','findOne','order','addIntervals','sequelize','transaction','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','name','index','map','Interval','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll'];(function(_0x29c365,_0x49c985){var _0x5a99d4=function(_0x2fbe02){while(--_0x2fbe02){_0x29c365['push'](_0x29c365['shift']());}};_0x5a99d4(++_0x49c985);}(_0x72c7,0x70));var _0x772c=function(_0x1bec0d,_0x338db4){_0x1bec0d=_0x1bec0d-0x0;var _0x49e3e3=_0x72c7[_0x1bec0d];return _0x49e3e3;};'use strict';var pdf=require(_0x772c('0x0'));var emlformat=require(_0x772c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x772c('0x2'));var jsonpatch=require(_0x772c('0x3'));var rp=require(_0x772c('0x4'));var moment=require(_0x772c('0x5'));var BPromise=require(_0x772c('0x6'));var Mustache=require('mustache');var util=require(_0x772c('0x7'));var path=require(_0x772c('0x8'));var sox=require(_0x772c('0x9'));var csv=require(_0x772c('0xa'));var ejs=require(_0x772c('0xb'));var fs=require('fs');var _=require(_0x772c('0xc'));var squel=require('squel');var crypto=require(_0x772c('0xd'));var jsforce=require(_0x772c('0xe'));var deskjs=require(_0x772c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x772c('0x10'));var Papa=require(_0x772c('0x11'));var Redis=require(_0x772c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x772c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x772c('0x14'));var logger=require(_0x772c('0x15'))(_0x772c('0x16'));var utils=require(_0x772c('0x17'));var config=require('../../config/environment');var db=require(_0x772c('0x18'))['db'];var extensions=require(_0x772c('0x19'));function respondWithStatusCode(_0x4812c0,_0x1a01f7){_0x1a01f7=_0x1a01f7||0xcc;return function(_0x52b645){if(_0x52b645){return _0x4812c0[_0x772c('0x1a')](_0x1a01f7);}return _0x4812c0[_0x772c('0x1b')](_0x1a01f7)[_0x772c('0x1c')]();};}function respondWithResult(_0x308960,_0xc57ff0){_0xc57ff0=_0xc57ff0||0xc8;return function(_0x3ea182){if(_0x3ea182){return _0x308960['status'](_0xc57ff0)[_0x772c('0x1d')](_0x3ea182);}};}function respondWithFilteredResult(_0xce081b,_0x26a31a){return function(_0x200f1e){if(_0x200f1e){var _0x1e4372=_0x200f1e[_0x772c('0x1e')],_0xb5e882=_0x26a31a['offset'],_0x2eabb5=_0x26a31a['offset']+_0x26a31a[_0x772c('0x1f')],_0x1ce5a2;if(_0x2eabb5>=_0x1e4372){_0x2eabb5=_0x1e4372;_0x1ce5a2=0xc8;}else{_0x1ce5a2=0xce;}_0xce081b[_0x772c('0x1b')](_0x1ce5a2);return _0xce081b['set'](_0x772c('0x20'),_0xb5e882+'-'+_0x2eabb5+'/'+_0x1e4372)[_0x772c('0x1d')](_0x200f1e);}return null;};}function patchUpdates(_0x3a2291){return function(_0x5aa3e3){try{jsonpatch[_0x772c('0x21')](_0x5aa3e3,_0x3a2291,!![]);}catch(_0x40cacf){return BPromise[_0x772c('0x22')](_0x40cacf);}return _0x5aa3e3[_0x772c('0x23')]();};}function saveUpdates(_0x2f1cc2,_0x57d023){return function(_0x43f24b){if(_0x43f24b){return _0x43f24b['update'](_0x2f1cc2)[_0x772c('0x24')](function(_0x25bf04){return _0x25bf04;});}return null;};}function removeEntity(_0x5de8de,_0x456092){return function(_0x45047d){if(_0x45047d){return _0x45047d[_0x772c('0x25')]()[_0x772c('0x24')](function(){var _0x5f305e=_0x45047d[_0x772c('0x26')]({'plain':!![]});var _0x55b396=_0x772c('0x27');return db[_0x772c('0x28')][_0x772c('0x25')]({'where':{'type':_0x55b396,'resourceId':_0x5f305e['id']}})['then'](function(){return _0x45047d;});})[_0x772c('0x24')](function(){_0x5de8de[_0x772c('0x1b')](0xcc)[_0x772c('0x1c')]();});}};}function handleEntityNotFound(_0x59ca7b,_0x9b5f12){return function(_0x1872cb){if(!_0x1872cb){_0x59ca7b[_0x772c('0x1a')](0x194);}return _0x1872cb;};}function handleError(_0x5067af,_0x3fe260){_0x3fe260=_0x3fe260||0x1f4;return function(_0x5d347b){logger['error'](_0x5d347b['stack']);if(_0x5d347b[_0x772c('0x29')]){delete _0x5d347b[_0x772c('0x29')];}_0x5067af[_0x772c('0x1b')](_0x3fe260)['send'](_0x5d347b);};}exports[_0x772c('0x2a')]=function(_0x5f2c77,_0x40e22b){var _0x555a8e={},_0x3ef5d6={},_0x3dccf5={'count':0x0,'rows':[]};var _0x110203=_[_0x772c('0x2b')](db[_0x772c('0x2c')]['rawAttributes'],function(_0x184988){return{'name':_0x184988['fieldName'],'type':_0x184988[_0x772c('0x2d')][_0x772c('0x2e')]};});_0x3ef5d6[_0x772c('0x2f')]=_[_0x772c('0x2b')](_0x110203,_0x772c('0x29'));_0x3ef5d6[_0x772c('0x30')]=_[_0x772c('0x31')](_0x5f2c77['query']);_0x3ef5d6[_0x772c('0x32')]=_[_0x772c('0x33')](_0x3ef5d6[_0x772c('0x2f')],_0x3ef5d6[_0x772c('0x30')]);_0x555a8e[_0x772c('0x34')]=_[_0x772c('0x33')](_0x3ef5d6[_0x772c('0x2f')],qs[_0x772c('0x35')](_0x5f2c77[_0x772c('0x30')][_0x772c('0x35')]));_0x555a8e[_0x772c('0x34')]=_0x555a8e[_0x772c('0x34')][_0x772c('0x36')]?_0x555a8e[_0x772c('0x34')]:_0x3ef5d6[_0x772c('0x2f')];if(!_0x5f2c77['query'][_0x772c('0x37')](_0x772c('0x38'))){_0x555a8e['limit']=qs['limit'](_0x5f2c77[_0x772c('0x30')][_0x772c('0x1f')]);_0x555a8e[_0x772c('0x39')]=qs['offset'](_0x5f2c77['query'][_0x772c('0x39')]);}_0x555a8e['order']=qs['sort'](_0x5f2c77[_0x772c('0x30')][_0x772c('0x3a')]);_0x555a8e[_0x772c('0x3b')]=qs[_0x772c('0x32')](_[_0x772c('0x3c')](_0x5f2c77['query'],_0x3ef5d6[_0x772c('0x32')]),_0x110203);if(_0x5f2c77[_0x772c('0x30')]['filter']){_0x555a8e[_0x772c('0x3b')]=_['merge'](_0x555a8e['where'],{'$or':_[_0x772c('0x2b')](_0x110203,function(_0x4e9b31){if(_0x4e9b31[_0x772c('0x2d')]!==_0x772c('0x3d')){var _0x2d8645={};_0x2d8645[_0x4e9b31['name']]={'$like':'%'+_0x5f2c77[_0x772c('0x30')][_0x772c('0x3e')]+'%'};return _0x2d8645;}})});}_0x555a8e=_[_0x772c('0x3f')]({},_0x555a8e,_0x5f2c77[_0x772c('0x40')]);var _0x40ec45={'where':_0x555a8e[_0x772c('0x3b')]};return db[_0x772c('0x2c')]['count'](_0x40ec45)['then'](function(_0x51dbbb){_0x3dccf5[_0x772c('0x1e')]=_0x51dbbb;if(_0x5f2c77[_0x772c('0x30')][_0x772c('0x41')]){_0x555a8e[_0x772c('0x42')]=[{'all':!![]}];}return db[_0x772c('0x2c')][_0x772c('0x43')](_0x555a8e);})[_0x772c('0x24')](function(_0x21ea80){_0x3dccf5[_0x772c('0x44')]=_0x21ea80;return _0x3dccf5;})[_0x772c('0x24')](respondWithFilteredResult(_0x40e22b,_0x555a8e))['catch'](handleError(_0x40e22b,null));};exports[_0x772c('0x45')]=function(_0x183704,_0x4bf000){var _0x47965b={'raw':!![],'where':{'id':_0x183704[_0x772c('0x46')]['id']}},_0x4777bd={};_0x4777bd[_0x772c('0x2f')]=_[_0x772c('0x31')](db[_0x772c('0x2c')][_0x772c('0x47')]);_0x4777bd[_0x772c('0x30')]=_[_0x772c('0x31')](_0x183704[_0x772c('0x30')]);_0x4777bd[_0x772c('0x32')]=_[_0x772c('0x33')](_0x4777bd[_0x772c('0x2f')],_0x4777bd[_0x772c('0x30')]);_0x47965b[_0x772c('0x34')]=_[_0x772c('0x33')](_0x4777bd[_0x772c('0x2f')],qs[_0x772c('0x35')](_0x183704[_0x772c('0x30')][_0x772c('0x35')]));_0x47965b[_0x772c('0x34')]=_0x47965b[_0x772c('0x34')][_0x772c('0x36')]?_0x47965b['attributes']:_0x4777bd[_0x772c('0x2f')];if(_0x183704[_0x772c('0x30')][_0x772c('0x41')]){_0x47965b[_0x772c('0x42')]=[{'all':!![]}];}_0x47965b=_[_0x772c('0x3f')]({},_0x47965b,_0x183704['options']);return db[_0x772c('0x2c')][_0x772c('0x48')](_0x47965b)['then'](handleEntityNotFound(_0x4bf000,null))[_0x772c('0x24')](respondWithResult(_0x4bf000,null))['catch'](handleError(_0x4bf000,null));};exports['create']=function(_0x3da20e,_0x2054eb){return db[_0x772c('0x2c')]['create'](_0x3da20e[_0x772c('0x49')],{})[_0x772c('0x24')](function(_0x5ee14b){var _0x405e87=_0x3da20e[_0x772c('0x4a')][_0x772c('0x26')]({'plain':!![]});if(!_0x405e87)throw new Error(_0x772c('0x4b'));if(_0x405e87['role']==='user'){var _0x46c8d5=_0x5ee14b[_0x772c('0x26')]({'plain':!![]});var _0x3f6150=_0x772c('0x27');return db[_0x772c('0x4c')][_0x772c('0x48')]({'where':{'name':_0x3f6150,'userProfileId':_0x405e87[_0x772c('0x4d')]},'raw':!![]})['then'](function(_0x5f7429){if(_0x5f7429&&_0x5f7429['autoAssociation']===0x0){return db[_0x772c('0x28')]['create']({'name':_0x46c8d5[_0x772c('0x29')],'resourceId':_0x46c8d5['id'],'type':_0x5f7429[_0x772c('0x29')],'sectionId':_0x5f7429['id']},{})[_0x772c('0x24')](function(){return _0x5ee14b;});}else{return _0x5ee14b;}})['catch'](function(_0x445cbc){logger[_0x772c('0x4e')](_0x772c('0x4f'),_0x445cbc);throw _0x445cbc;});}return _0x5ee14b;})[_0x772c('0x24')](respondWithResult(_0x2054eb,0xc9))['catch'](handleError(_0x2054eb,null));};exports['update']=function(_0x13f57e,_0x27b208){if(_0x13f57e['body']['id']){delete _0x13f57e[_0x772c('0x49')]['id'];}return db[_0x772c('0x2c')][_0x772c('0x48')]({'where':{'id':_0x13f57e['params']['id']}})[_0x772c('0x24')](handleEntityNotFound(_0x27b208,null))[_0x772c('0x24')](saveUpdates(_0x13f57e['body'],null))[_0x772c('0x24')](respondWithResult(_0x27b208,null))['catch'](handleError(_0x27b208,null));};exports[_0x772c('0x25')]=function(_0x3efd26,_0x465924){return db['Interval'][_0x772c('0x48')]({'where':{'id':_0x3efd26[_0x772c('0x46')]['id']}})[_0x772c('0x24')](handleEntityNotFound(_0x465924,null))['then'](removeEntity(_0x465924,null))['catch'](handleError(_0x465924,null));};exports[_0x772c('0x50')]=function(_0x873e89,_0x15de1c,_0x32dbdb){if(_0x873e89['body']['id']){delete _0x873e89[_0x772c('0x49')]['id'];}return db[_0x772c('0x2c')][_0x772c('0x48')]({'where':{'id':_0x873e89[_0x772c('0x46')]['id']}})[_0x772c('0x24')](handleEntityNotFound(_0x15de1c,null))[_0x772c('0x24')](function(_0x3c462a){if(_0x3c462a){_0x873e89[_0x772c('0x49')][_0x772c('0x51')]=_0x3c462a['id'];return db[_0x772c('0x2c')][_0x772c('0x52')](_0x873e89['body']);}})[_0x772c('0x24')](respondWithResult(_0x15de1c,null))[_0x772c('0x53')](handleError(_0x15de1c,null));};exports[_0x772c('0x54')]=function(_0xdafc2f,_0x5e2b67,_0x5a942e){var _0x411e87={};var _0x638f79={};var _0x277758;var _0x159409;return db[_0x772c('0x2c')][_0x772c('0x55')]({'where':{'id':_0xdafc2f[_0x772c('0x46')]['id']}})[_0x772c('0x24')](handleEntityNotFound(_0x5e2b67,null))[_0x772c('0x24')](function(_0xe0ce02){if(_0xe0ce02){_0x277758=_0xe0ce02;_0x638f79[_0x772c('0x2f')]=_[_0x772c('0x31')](db[_0x772c('0x2c')][_0x772c('0x47')]);_0x638f79[_0x772c('0x30')]=_['keys'](_0xdafc2f[_0x772c('0x30')]);_0x638f79[_0x772c('0x32')]=_['intersection'](_0x638f79[_0x772c('0x2f')],_0x638f79[_0x772c('0x30')]);_0x411e87['attributes']=_['intersection'](_0x638f79[_0x772c('0x2f')],qs['fields'](_0xdafc2f[_0x772c('0x30')][_0x772c('0x35')]));_0x411e87['attributes']=_0x411e87[_0x772c('0x34')][_0x772c('0x36')]?_0x411e87[_0x772c('0x34')]:_0x638f79['model'];_0x411e87[_0x772c('0x56')]=qs['sort'](_0xdafc2f[_0x772c('0x30')][_0x772c('0x3a')]);_0x411e87[_0x772c('0x3b')]=qs['filters'](_[_0x772c('0x3c')](_0xdafc2f[_0x772c('0x30')],_0x638f79[_0x772c('0x32')]));if(_0xdafc2f[_0x772c('0x30')][_0x772c('0x3e')]){_0x411e87['where']=_['merge'](_0x411e87['where'],{'$or':_['map'](_0x411e87['attributes'],function(_0x3af849){var _0x264dbb={};_0x264dbb[_0x3af849]={'$like':'%'+_0xdafc2f['query'][_0x772c('0x3e')]+'%'};return _0x264dbb;})});}_0x411e87=_[_0x772c('0x3f')]({},_0x411e87,_0xdafc2f[_0x772c('0x40')]);return _0x277758[_0x772c('0x54')](_0x411e87);}})[_0x772c('0x24')](function(_0xd6638){if(_0xd6638){_0x159409=_0xd6638[_0x772c('0x36')];if(!_0xdafc2f['query'][_0x772c('0x37')](_0x772c('0x38'))){_0x411e87[_0x772c('0x1f')]=qs[_0x772c('0x1f')](_0xdafc2f[_0x772c('0x30')]['limit']);_0x411e87[_0x772c('0x39')]=qs['offset'](_0xdafc2f['query'][_0x772c('0x39')]);}return _0x277758[_0x772c('0x54')](_0x411e87);}})[_0x772c('0x24')](function(_0x3d7842){if(_0x3d7842){return _0x3d7842?{'count':_0x159409,'rows':_0x3d7842}:null;}})[_0x772c('0x24')](respondWithResult(_0x5e2b67,null))[_0x772c('0x53')](handleError(_0x5e2b67,null));};exports[_0x772c('0x57')]=function(_0x4e7d35,_0x2dd3ed,_0x115987){return db[_0x772c('0x2c')][_0x772c('0x55')]({'where':{'id':_0x4e7d35[_0x772c('0x46')]['id']}})[_0x772c('0x24')](handleEntityNotFound(_0x2dd3ed,null))['then'](function(_0x3937a1){if(_0x3937a1){return db[_0x772c('0x58')][_0x772c('0x59')](function(_0x1f58e5){return db[_0x772c('0x2c')][_0x772c('0x25')]({'where':{'IntervalId':_0x4e7d35[_0x772c('0x46')]['id']},'transaction':_0x1f58e5})['then'](function(_0x1ec6c1){var _0x292b95=_[_0x772c('0x2b')](_0x4e7d35['body'],function(_0x2d152c){delete _0x2d152c['id'];_0x2d152c['IntervalId']=_0x4e7d35[_0x772c('0x46')]['id'];return _0x2d152c;});return db['Interval']['bulkCreate'](_0x292b95,{'transaction':_0x1f58e5});});})[_0x772c('0x24')](function(){return db[_0x772c('0x2c')][_0x772c('0x43')]({'where':{'IntervalId':_0x4e7d35[_0x772c('0x46')]['id']}});});}})[_0x772c('0x24')](respondWithResult(_0x2dd3ed,null))[_0x772c('0x53')](handleError(_0x2dd3ed,null));}; \ No newline at end of file +var _0xfd1c=['status','set','Content-Range','apply','reject','update','destroy','then','get','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','Interval','includeAll','include','rows','catch','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','options','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','end','json','count','offset'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xfd1c,0x14a));var _0xcfd1=function(_0x12d773,_0x253abd){_0x12d773=_0x12d773-0x0;var _0x152e37=_0xfd1c[_0x12d773];return _0x152e37;};'use strict';var pdf=require(_0xcfd1('0x0'));var emlformat=require(_0xcfd1('0x1'));var rimraf=require(_0xcfd1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfd1('0x3'));var rp=require(_0xcfd1('0x4'));var moment=require(_0xcfd1('0x5'));var BPromise=require(_0xcfd1('0x6'));var Mustache=require('mustache');var util=require(_0xcfd1('0x7'));var path=require(_0xcfd1('0x8'));var sox=require(_0xcfd1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcfd1('0xa'));var squel=require(_0xcfd1('0xb'));var crypto=require(_0xcfd1('0xc'));var jsforce=require(_0xcfd1('0xd'));var deskjs=require(_0xcfd1('0xe'));var toCsv=require(_0xcfd1('0xf'));var querystring=require('querystring');var Papa=require(_0xcfd1('0x10'));var Redis=require(_0xcfd1('0x11'));var authService=require(_0xcfd1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcfd1('0x13'));var hardwareService=require(_0xcfd1('0x14'));var logger=require(_0xcfd1('0x15'))(_0xcfd1('0x16'));var utils=require(_0xcfd1('0x17'));var config=require(_0xcfd1('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0xcfd1('0x19'));function respondWithStatusCode(_0x1c6482,_0x5a3c1f){_0x5a3c1f=_0x5a3c1f||0xcc;return function(_0x4b3f60){if(_0x4b3f60){return _0x1c6482['sendStatus'](_0x5a3c1f);}return _0x1c6482['status'](_0x5a3c1f)[_0xcfd1('0x1a')]();};}function respondWithResult(_0x1505ef,_0x1d12fb){_0x1d12fb=_0x1d12fb||0xc8;return function(_0x3997a4){if(_0x3997a4){return _0x1505ef['status'](_0x1d12fb)[_0xcfd1('0x1b')](_0x3997a4);}};}function respondWithFilteredResult(_0xf5fc79,_0x137c2d){return function(_0x79ed4){if(_0x79ed4){var _0x2e4cac=_0x79ed4[_0xcfd1('0x1c')],_0x10ac55=_0x137c2d[_0xcfd1('0x1d')],_0x1b6605=_0x137c2d['offset']+_0x137c2d['limit'],_0x5141a9;if(_0x1b6605>=_0x2e4cac){_0x1b6605=_0x2e4cac;_0x5141a9=0xc8;}else{_0x5141a9=0xce;}_0xf5fc79[_0xcfd1('0x1e')](_0x5141a9);return _0xf5fc79[_0xcfd1('0x1f')](_0xcfd1('0x20'),_0x10ac55+'-'+_0x1b6605+'/'+_0x2e4cac)['json'](_0x79ed4);}return null;};}function patchUpdates(_0x3342fb){return function(_0x62995c){try{jsonpatch[_0xcfd1('0x21')](_0x62995c,_0x3342fb,!![]);}catch(_0x5c7722){return BPromise[_0xcfd1('0x22')](_0x5c7722);}return _0x62995c['save']();};}function saveUpdates(_0x360f07,_0x4fcd63){return function(_0x85757c){if(_0x85757c){return _0x85757c[_0xcfd1('0x23')](_0x360f07)['then'](function(_0x2532b7){return _0x2532b7;});}return null;};}function removeEntity(_0x3460fe,_0x2a1f6b){return function(_0x3d6a7b){if(_0x3d6a7b){return _0x3d6a7b[_0xcfd1('0x24')]()[_0xcfd1('0x25')](function(){var _0x105b93=_0x3d6a7b[_0xcfd1('0x26')]({'plain':!![]});var _0x56a9d8='Intervals';return db['UserProfileResource'][_0xcfd1('0x24')]({'where':{'type':_0x56a9d8,'resourceId':_0x105b93['id']}})['then'](function(){return _0x3d6a7b;});})[_0xcfd1('0x25')](function(){_0x3460fe['status'](0xcc)[_0xcfd1('0x1a')]();});}};}function handleEntityNotFound(_0x4cd27c,_0x17008b){return function(_0x3c557d){if(!_0x3c557d){_0x4cd27c[_0xcfd1('0x27')](0x194);}return _0x3c557d;};}function handleError(_0x3ad905,_0x5a2150){_0x5a2150=_0x5a2150||0x1f4;return function(_0x4b354f){logger[_0xcfd1('0x28')](_0x4b354f[_0xcfd1('0x29')]);if(_0x4b354f[_0xcfd1('0x2a')]){delete _0x4b354f[_0xcfd1('0x2a')];}_0x3ad905['status'](_0x5a2150)[_0xcfd1('0x2b')](_0x4b354f);};}exports[_0xcfd1('0x2c')]=function(_0x1a5fce,_0x2a1ccc){var _0xf71d0e={},_0x153edb={},_0x5cab6b={'count':0x0,'rows':[]};var _0x22f47c=_[_0xcfd1('0x2d')](db['Interval'][_0xcfd1('0x2e')],function(_0x118acf){return{'name':_0x118acf['fieldName'],'type':_0x118acf[_0xcfd1('0x2f')][_0xcfd1('0x30')]};});_0x153edb[_0xcfd1('0x31')]=_['map'](_0x22f47c,_0xcfd1('0x2a'));_0x153edb['query']=_[_0xcfd1('0x32')](_0x1a5fce[_0xcfd1('0x33')]);_0x153edb[_0xcfd1('0x34')]=_[_0xcfd1('0x35')](_0x153edb[_0xcfd1('0x31')],_0x153edb[_0xcfd1('0x33')]);_0xf71d0e[_0xcfd1('0x36')]=_[_0xcfd1('0x35')](_0x153edb[_0xcfd1('0x31')],qs[_0xcfd1('0x37')](_0x1a5fce['query'][_0xcfd1('0x37')]));_0xf71d0e['attributes']=_0xf71d0e[_0xcfd1('0x36')]['length']?_0xf71d0e[_0xcfd1('0x36')]:_0x153edb[_0xcfd1('0x31')];if(!_0x1a5fce[_0xcfd1('0x33')]['hasOwnProperty'](_0xcfd1('0x38'))){_0xf71d0e['limit']=qs[_0xcfd1('0x39')](_0x1a5fce[_0xcfd1('0x33')][_0xcfd1('0x39')]);_0xf71d0e[_0xcfd1('0x1d')]=qs['offset'](_0x1a5fce[_0xcfd1('0x33')][_0xcfd1('0x1d')]);}_0xf71d0e['order']=qs[_0xcfd1('0x3a')](_0x1a5fce[_0xcfd1('0x33')][_0xcfd1('0x3a')]);_0xf71d0e[_0xcfd1('0x3b')]=qs[_0xcfd1('0x34')](_[_0xcfd1('0x3c')](_0x1a5fce[_0xcfd1('0x33')],_0x153edb[_0xcfd1('0x34')]),_0x22f47c);if(_0x1a5fce[_0xcfd1('0x33')][_0xcfd1('0x3d')]){_0xf71d0e[_0xcfd1('0x3b')]=_[_0xcfd1('0x3e')](_0xf71d0e[_0xcfd1('0x3b')],{'$or':_['map'](_0x22f47c,function(_0x1d1b75){if(_0x1d1b75[_0xcfd1('0x2f')]!==_0xcfd1('0x3f')){var _0x27f17b={};_0x27f17b[_0x1d1b75[_0xcfd1('0x2a')]]={'$like':'%'+_0x1a5fce['query']['filter']+'%'};return _0x27f17b;}})});}_0xf71d0e=_[_0xcfd1('0x3e')]({},_0xf71d0e,_0x1a5fce['options']);var _0x24401c={'where':_0xf71d0e[_0xcfd1('0x3b')]};return db[_0xcfd1('0x40')][_0xcfd1('0x1c')](_0x24401c)[_0xcfd1('0x25')](function(_0x30edf3){_0x5cab6b[_0xcfd1('0x1c')]=_0x30edf3;if(_0x1a5fce[_0xcfd1('0x33')][_0xcfd1('0x41')]){_0xf71d0e[_0xcfd1('0x42')]=[{'all':!![]}];}return db[_0xcfd1('0x40')]['findAll'](_0xf71d0e);})[_0xcfd1('0x25')](function(_0x36b0fc){_0x5cab6b[_0xcfd1('0x43')]=_0x36b0fc;return _0x5cab6b;})[_0xcfd1('0x25')](respondWithFilteredResult(_0x2a1ccc,_0xf71d0e))[_0xcfd1('0x44')](handleError(_0x2a1ccc,null));};exports['show']=function(_0xcda756,_0x1dd569){var _0x5428df={'raw':!![],'where':{'id':_0xcda756[_0xcfd1('0x45')]['id']}},_0x374774={};_0x374774[_0xcfd1('0x31')]=_[_0xcfd1('0x32')](db[_0xcfd1('0x40')][_0xcfd1('0x2e')]);_0x374774[_0xcfd1('0x33')]=_[_0xcfd1('0x32')](_0xcda756[_0xcfd1('0x33')]);_0x374774['filters']=_['intersection'](_0x374774[_0xcfd1('0x31')],_0x374774[_0xcfd1('0x33')]);_0x5428df['attributes']=_[_0xcfd1('0x35')](_0x374774[_0xcfd1('0x31')],qs[_0xcfd1('0x37')](_0xcda756[_0xcfd1('0x33')]['fields']));_0x5428df[_0xcfd1('0x36')]=_0x5428df[_0xcfd1('0x36')][_0xcfd1('0x46')]?_0x5428df[_0xcfd1('0x36')]:_0x374774['model'];if(_0xcda756[_0xcfd1('0x33')]['includeAll']){_0x5428df[_0xcfd1('0x42')]=[{'all':!![]}];}_0x5428df=_['merge']({},_0x5428df,_0xcda756['options']);return db[_0xcfd1('0x40')][_0xcfd1('0x47')](_0x5428df)[_0xcfd1('0x25')](handleEntityNotFound(_0x1dd569,null))[_0xcfd1('0x25')](respondWithResult(_0x1dd569,null))['catch'](handleError(_0x1dd569,null));};exports[_0xcfd1('0x48')]=function(_0x39ead1,_0x4f8161){return db[_0xcfd1('0x40')][_0xcfd1('0x48')](_0x39ead1[_0xcfd1('0x49')],{})[_0xcfd1('0x25')](function(_0x4efbac){var _0x449f8b=_0x39ead1['user'][_0xcfd1('0x26')]({'plain':!![]});if(!_0x449f8b)throw new Error(_0xcfd1('0x4a'));if(_0x449f8b['role']===_0xcfd1('0x4b')){var _0x4cf056=_0x4efbac[_0xcfd1('0x26')]({'plain':!![]});var _0x5200aa='Intervals';return db['UserProfileSection'][_0xcfd1('0x47')]({'where':{'name':_0x5200aa,'userProfileId':_0x449f8b[_0xcfd1('0x4c')]},'raw':!![]})[_0xcfd1('0x25')](function(_0x1145da){if(_0x1145da&&_0x1145da[_0xcfd1('0x4d')]===0x0){return db[_0xcfd1('0x4e')][_0xcfd1('0x48')]({'name':_0x4cf056['name'],'resourceId':_0x4cf056['id'],'type':_0x1145da[_0xcfd1('0x2a')],'sectionId':_0x1145da['id']},{})[_0xcfd1('0x25')](function(){return _0x4efbac;});}else{return _0x4efbac;}})[_0xcfd1('0x44')](function(_0xb06693){logger[_0xcfd1('0x28')](_0xcfd1('0x4f'),_0xb06693);throw _0xb06693;});}return _0x4efbac;})['then'](respondWithResult(_0x4f8161,0xc9))[_0xcfd1('0x44')](handleError(_0x4f8161,null));};exports[_0xcfd1('0x23')]=function(_0x2d07bb,_0xdcd9e9){if(_0x2d07bb[_0xcfd1('0x49')]['id']){delete _0x2d07bb['body']['id'];}return db[_0xcfd1('0x40')][_0xcfd1('0x47')]({'where':{'id':_0x2d07bb[_0xcfd1('0x45')]['id']}})[_0xcfd1('0x25')](handleEntityNotFound(_0xdcd9e9,null))['then'](saveUpdates(_0x2d07bb[_0xcfd1('0x49')],null))[_0xcfd1('0x25')](respondWithResult(_0xdcd9e9,null))[_0xcfd1('0x44')](handleError(_0xdcd9e9,null));};exports[_0xcfd1('0x24')]=function(_0x4bcf4d,_0x75abde){return db['Interval'][_0xcfd1('0x47')]({'where':{'id':_0x4bcf4d[_0xcfd1('0x45')]['id']}})[_0xcfd1('0x25')](handleEntityNotFound(_0x75abde,null))[_0xcfd1('0x25')](removeEntity(_0x75abde,null))[_0xcfd1('0x44')](handleError(_0x75abde,null));};exports[_0xcfd1('0x50')]=function(_0x3400a3,_0x1d31de,_0xc952de){if(_0x3400a3['body']['id']){delete _0x3400a3['body']['id'];}return db[_0xcfd1('0x40')][_0xcfd1('0x47')]({'where':{'id':_0x3400a3[_0xcfd1('0x45')]['id']}})[_0xcfd1('0x25')](handleEntityNotFound(_0x1d31de,null))[_0xcfd1('0x25')](function(_0x62ff4){if(_0x62ff4){_0x3400a3[_0xcfd1('0x49')][_0xcfd1('0x51')]=_0x62ff4['id'];return db[_0xcfd1('0x40')]['create'](_0x3400a3[_0xcfd1('0x49')]);}})[_0xcfd1('0x25')](respondWithResult(_0x1d31de,null))[_0xcfd1('0x44')](handleError(_0x1d31de,null));};exports[_0xcfd1('0x52')]=function(_0x48ee36,_0x4259ae,_0x3cf42f){var _0x46ad2a={};var _0x5d005b={};var _0x55f6d6;var _0x2ab47f;return db[_0xcfd1('0x40')][_0xcfd1('0x53')]({'where':{'id':_0x48ee36[_0xcfd1('0x45')]['id']}})[_0xcfd1('0x25')](handleEntityNotFound(_0x4259ae,null))[_0xcfd1('0x25')](function(_0x174c6d){if(_0x174c6d){_0x55f6d6=_0x174c6d;_0x5d005b['model']=_[_0xcfd1('0x32')](db['Interval']['rawAttributes']);_0x5d005b[_0xcfd1('0x33')]=_['keys'](_0x48ee36[_0xcfd1('0x33')]);_0x5d005b[_0xcfd1('0x34')]=_['intersection'](_0x5d005b[_0xcfd1('0x31')],_0x5d005b[_0xcfd1('0x33')]);_0x46ad2a[_0xcfd1('0x36')]=_[_0xcfd1('0x35')](_0x5d005b[_0xcfd1('0x31')],qs[_0xcfd1('0x37')](_0x48ee36[_0xcfd1('0x33')][_0xcfd1('0x37')]));_0x46ad2a[_0xcfd1('0x36')]=_0x46ad2a[_0xcfd1('0x36')][_0xcfd1('0x46')]?_0x46ad2a[_0xcfd1('0x36')]:_0x5d005b[_0xcfd1('0x31')];_0x46ad2a['order']=qs['sort'](_0x48ee36[_0xcfd1('0x33')][_0xcfd1('0x3a')]);_0x46ad2a[_0xcfd1('0x3b')]=qs['filters'](_[_0xcfd1('0x3c')](_0x48ee36['query'],_0x5d005b[_0xcfd1('0x34')]));if(_0x48ee36[_0xcfd1('0x33')][_0xcfd1('0x3d')]){_0x46ad2a[_0xcfd1('0x3b')]=_['merge'](_0x46ad2a[_0xcfd1('0x3b')],{'$or':_[_0xcfd1('0x2d')](_0x46ad2a[_0xcfd1('0x36')],function(_0x234e67){var _0x14446b={};_0x14446b[_0x234e67]={'$like':'%'+_0x48ee36[_0xcfd1('0x33')][_0xcfd1('0x3d')]+'%'};return _0x14446b;})});}_0x46ad2a=_[_0xcfd1('0x3e')]({},_0x46ad2a,_0x48ee36[_0xcfd1('0x54')]);return _0x55f6d6['getIntervals'](_0x46ad2a);}})[_0xcfd1('0x25')](function(_0x3e0d65){if(_0x3e0d65){_0x2ab47f=_0x3e0d65[_0xcfd1('0x46')];if(!_0x48ee36[_0xcfd1('0x33')][_0xcfd1('0x55')]('nolimit')){_0x46ad2a[_0xcfd1('0x39')]=qs[_0xcfd1('0x39')](_0x48ee36[_0xcfd1('0x33')][_0xcfd1('0x39')]);_0x46ad2a['offset']=qs[_0xcfd1('0x1d')](_0x48ee36[_0xcfd1('0x33')]['offset']);}return _0x55f6d6[_0xcfd1('0x52')](_0x46ad2a);}})[_0xcfd1('0x25')](function(_0x19f538){if(_0x19f538){return _0x19f538?{'count':_0x2ab47f,'rows':_0x19f538}:null;}})[_0xcfd1('0x25')](respondWithResult(_0x4259ae,null))[_0xcfd1('0x44')](handleError(_0x4259ae,null));};exports[_0xcfd1('0x56')]=function(_0x2d600a,_0x22e0f1,_0x2a3658){return db[_0xcfd1('0x40')][_0xcfd1('0x53')]({'where':{'id':_0x2d600a['params']['id']}})[_0xcfd1('0x25')](handleEntityNotFound(_0x22e0f1,null))[_0xcfd1('0x25')](function(_0x23f531){if(_0x23f531){return db[_0xcfd1('0x57')][_0xcfd1('0x58')](function(_0x13b91f){return db[_0xcfd1('0x40')][_0xcfd1('0x24')]({'where':{'IntervalId':_0x2d600a[_0xcfd1('0x45')]['id']},'transaction':_0x13b91f})[_0xcfd1('0x25')](function(_0xf9983){var _0x547e90=_[_0xcfd1('0x2d')](_0x2d600a[_0xcfd1('0x49')],function(_0x3f406d){delete _0x3f406d['id'];_0x3f406d[_0xcfd1('0x51')]=_0x2d600a[_0xcfd1('0x45')]['id'];return _0x3f406d;});return db[_0xcfd1('0x40')][_0xcfd1('0x59')](_0x547e90,{'transaction':_0x13b91f});});})[_0xcfd1('0x25')](function(){return db[_0xcfd1('0x40')]['findAll']({'where':{'IntervalId':_0x2d600a[_0xcfd1('0x45')]['id']}});});}})[_0xcfd1('0x25')](respondWithResult(_0x22e0f1,null))[_0xcfd1('0x44')](handleError(_0x22e0f1,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d010572..4c3252e 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 _0x222f=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','Interval','tools_intervals','rewrite'];(function(_0xa14321,_0xec78a0){var _0x370207=function(_0x1a7a78){while(--_0x1a7a78){_0xa14321['push'](_0xa14321['shift']());}};_0x370207(++_0xec78a0);}(_0x222f,0x1a4));var _0xf222=function(_0x133f69,_0x2d4632){_0x133f69=_0x133f69-0x0;var _0x3b67bb=_0x222f[_0x133f69];return _0x3b67bb;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0xf222('0x8'));module['exports']=function(_0x112e6d,_0x26f129){return _0x112e6d['define'](_0xf222('0x9'),attributes,{'tableName':_0xf222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4aceb4,_0x31c027){extensions[_0xf222('0xb')](_0x112e6d,_0x4aceb4);},'afterBulkCreate':function(_0x878804,_0x2eb41f,_0x46ccfe){_0x46ccfe();extensions[_0xf222('0xb')](_0x112e6d,_0x878804[0x0]);},'afterUpdate':function(_0x47d55a,_0x2e29ad){extensions[_0xf222('0xb')](_0x112e6d,_0x47d55a);},'afterDestroy':function(_0x226dbd,_0x182bc3){extensions['rewrite'](_0x112e6d,_0x226dbd);}}});}; \ No newline at end of file +var _0x4fdc=['Interval','rewrite','util','api','moment','bluebird','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x59fde2,_0x4c630b){var _0x52ecae=function(_0xd4dc8e){while(--_0xd4dc8e){_0x59fde2['push'](_0x59fde2['shift']());}};_0x52ecae(++_0x4c630b);}(_0x4fdc,0x84));var _0xc4fd=function(_0x45861b,_0xcc23fc){_0x45861b=_0x45861b-0x0;var _0x5585d0=_0x4fdc[_0x45861b];return _0x5585d0;};'use strict';var _=require('lodash');var util=require(_0xc4fd('0x0'));var logger=require('../../config/logger')(_0xc4fd('0x1'));var moment=require(_0xc4fd('0x2'));var BPromise=require(_0xc4fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4fd('0x4'));var rimraf=require(_0xc4fd('0x5'));var config=require(_0xc4fd('0x6'));var attributes=require(_0xc4fd('0x7'));var extensions=require(_0xc4fd('0x8'));module[_0xc4fd('0x9')]=function(_0x3157b2,_0x57502f){return _0x3157b2[_0xc4fd('0xa')](_0xc4fd('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x72b9e3,_0x5b1df4){extensions['rewrite'](_0x3157b2,_0x72b9e3);},'afterBulkCreate':function(_0x448be9,_0x3b058e,_0x1bfa74){_0x1bfa74();extensions[_0xc4fd('0xc')](_0x3157b2,_0x448be9[0x0]);},'afterUpdate':function(_0x476d78,_0x18f81e){extensions[_0xc4fd('0xc')](_0x3157b2,_0x476d78);},'afterDestroy':function(_0x3b9a49,_0x50f5b1){extensions['rewrite'](_0x3157b2,_0x3b9a49);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ed03a7f..c11a7dd 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 _0xfe83=['error','message','catch','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowInterval','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4f1821,_0xbbbf0f){var _0x2dc421=function(_0x4c0b4c){while(--_0x4c0b4c){_0x4f1821['push'](_0x4f1821['shift']());}};_0x2dc421(++_0xbbbf0f);}(_0xfe83,0xb0));var _0x3fe8=function(_0x5625ea,_0x16e444){_0x5625ea=_0x5625ea-0x0;var _0x420bc5=_0xfe83[_0x5625ea];return _0x420bc5;};'use strict';var _=require(_0x3fe8('0x0'));var util=require(_0x3fe8('0x1'));var moment=require(_0x3fe8('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fe8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3fe8('0x4'));var logger=require(_0x3fe8('0x5'))(_0x3fe8('0x6'));var config=require(_0x3fe8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3fe8('0x8')][_0x3fe8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xde5221,_0xbdfe1b,_0x2eca09){return new BPromise(function(_0x2c25e4,_0x7f1428){return client['request'](_0xde5221,_0x2eca09)[_0x3fe8('0xa')](function(_0x37d49f){logger['info'](_0x3fe8('0xb'),_0xbdfe1b,'request\x20sent');logger[_0x3fe8('0xc')](_0x3fe8('0xd'),_0xbdfe1b,_0x3fe8('0xe'),JSON[_0x3fe8('0xf')](_0x37d49f));if(_0x37d49f['error']){if(_0x37d49f['error']['code']===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0xbdfe1b,_0x37d49f[_0x3fe8('0x10')][_0x3fe8('0x11')]);return _0x7f1428(_0x37d49f[_0x3fe8('0x10')]['message']);}logger[_0x3fe8('0x10')](_0x3fe8('0xb'),_0xbdfe1b,_0x37d49f['error'][_0x3fe8('0x11')]);return _0x2c25e4(_0x37d49f['error'][_0x3fe8('0x11')]);}else{logger['info'](_0x3fe8('0xb'),_0xbdfe1b,_0x3fe8('0xe'));_0x2c25e4(_0x37d49f['result'][_0x3fe8('0x11')]);}})[_0x3fe8('0x12')](function(_0x29a961){logger[_0x3fe8('0x10')]('Interval,\x20%s,\x20%s',_0xbdfe1b,_0x29a961);_0x7f1428(_0x29a961);});});}exports[_0x3fe8('0x13')]=function(_0x3d7bd1){var _0xe5776f=this;return new Promise(function(_0x391d0d,_0x4b7b88){return db['Interval'][_0x3fe8('0x14')]({'raw':_0x3d7bd1[_0x3fe8('0x15')]?_0x3d7bd1[_0x3fe8('0x15')][_0x3fe8('0x16')]===undefined?!![]:![]:!![],'where':_0x3d7bd1[_0x3fe8('0x15')]?_0x3d7bd1[_0x3fe8('0x15')][_0x3fe8('0x17')]||null:null,'attributes':_0x3d7bd1[_0x3fe8('0x15')]?_0x3d7bd1[_0x3fe8('0x15')][_0x3fe8('0x18')]||null:null,'limit':_0x3d7bd1[_0x3fe8('0x15')]?_0x3d7bd1[_0x3fe8('0x15')][_0x3fe8('0x19')]||null:null,'include':_0x3d7bd1[_0x3fe8('0x15')]?_0x3d7bd1[_0x3fe8('0x15')][_0x3fe8('0x1a')]?_[_0x3fe8('0x1b')](_0x3d7bd1['options'][_0x3fe8('0x1a')],function(_0x269d2a){return{'model':db[_0x269d2a[_0x3fe8('0x1c')]],'as':_0x269d2a['as'],'attributes':_0x269d2a[_0x3fe8('0x18')],'include':_0x269d2a[_0x3fe8('0x1a')]?_[_0x3fe8('0x1b')](_0x269d2a[_0x3fe8('0x1a')],function(_0x5e4016){return{'model':db[_0x5e4016[_0x3fe8('0x1c')]],'as':_0x5e4016['as'],'attributes':_0x5e4016[_0x3fe8('0x18')],'include':_0x5e4016[_0x3fe8('0x1a')]?_['map'](_0x5e4016['include'],function(_0x5964db){return{'model':db[_0x5964db[_0x3fe8('0x1c')]],'as':_0x5964db['as'],'attributes':_0x5964db[_0x3fe8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x296ef6){logger[_0x3fe8('0x1d')](_0x3fe8('0x13'),_0x3d7bd1);logger[_0x3fe8('0xc')](_0x3fe8('0x13'),_0x3d7bd1,JSON['stringify'](_0x296ef6));_0x391d0d(_0x296ef6);})['catch'](function(_0x233e66){logger[_0x3fe8('0x10')]('GetInterval',_0x233e66[_0x3fe8('0x11')],_0x3d7bd1);_0x4b7b88(_0xe5776f[_0x3fe8('0x10')](0x1f4,_0x233e66['message']));});});};exports[_0x3fe8('0x1e')]=function(_0x326d13){var _0x94d187=this;return new Promise(function(_0x2ef7fd,_0x37d93e){return db['Interval'][_0x3fe8('0x1f')]({'raw':_0x326d13['options']?_0x326d13['options'][_0x3fe8('0x16')]===undefined?!![]:![]:!![],'where':_0x326d13['options']?_0x326d13[_0x3fe8('0x15')]['where']||null:null,'attributes':_0x326d13[_0x3fe8('0x15')]?_0x326d13['options'][_0x3fe8('0x18')]||null:null,'include':_0x326d13[_0x3fe8('0x15')]?_0x326d13[_0x3fe8('0x15')]['include']?_['map'](_0x326d13[_0x3fe8('0x15')][_0x3fe8('0x1a')],function(_0x53a9a1){return{'model':db[_0x53a9a1[_0x3fe8('0x1c')]],'as':_0x53a9a1['as'],'attributes':_0x53a9a1[_0x3fe8('0x18')],'include':_0x53a9a1[_0x3fe8('0x1a')]?_[_0x3fe8('0x1b')](_0x53a9a1['include'],function(_0x546984){return{'model':db[_0x546984['model']],'as':_0x546984['as'],'attributes':_0x546984[_0x3fe8('0x18')],'include':_0x546984['include']?_[_0x3fe8('0x1b')](_0x546984['include'],function(_0x2523b8){return{'model':db[_0x2523b8[_0x3fe8('0x1c')]],'as':_0x2523b8['as'],'attributes':_0x2523b8[_0x3fe8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3fe8('0xa')](function(_0x2ed6c6){logger[_0x3fe8('0x1d')](_0x3fe8('0x1e'),_0x326d13);logger[_0x3fe8('0xc')](_0x3fe8('0x1e'),_0x326d13,JSON[_0x3fe8('0xf')](_0x2ed6c6));_0x2ef7fd(_0x2ed6c6);})[_0x3fe8('0x12')](function(_0x169291){logger[_0x3fe8('0x10')](_0x3fe8('0x1e'),_0x169291[_0x3fe8('0x11')],_0x326d13);_0x37d93e(_0x94d187[_0x3fe8('0x10')](0x1f4,_0x169291[_0x3fe8('0x11')]));});});}; \ No newline at end of file +var _0xb068=['../../config/logger','../../config/environment','jayson/promise','client','request','then','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','info','ShowInterval','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0xb068,0x1b4));var _0x8b06=function(_0x58f80b,_0x12fecf){_0x58f80b=_0x58f80b-0x0;var _0x1720c0=_0xb068[_0x58f80b];return _0x1720c0;};'use strict';var _=require(_0x8b06('0x0'));var util=require(_0x8b06('0x1'));var moment=require(_0x8b06('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b06('0x4'))['db'];var utils=require(_0x8b06('0x5'));var logger=require(_0x8b06('0x6'))('rpc');var config=require(_0x8b06('0x7'));var jayson=require(_0x8b06('0x8'));var client=jayson[_0x8b06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357daf,_0x53d58e,_0x5919ca){return new BPromise(function(_0x7992fd,_0x9a71a2){return client[_0x8b06('0xa')](_0x357daf,_0x5919ca)[_0x8b06('0xb')](function(_0x13309c){logger['info'](_0x8b06('0xc'),_0x53d58e,'request\x20sent');logger[_0x8b06('0xd')](_0x8b06('0xe'),_0x53d58e,_0x8b06('0xf'),JSON[_0x8b06('0x10')](_0x13309c));if(_0x13309c[_0x8b06('0x11')]){if(_0x13309c[_0x8b06('0x11')][_0x8b06('0x12')]===0x1f4){logger['error'](_0x8b06('0xc'),_0x53d58e,_0x13309c[_0x8b06('0x11')][_0x8b06('0x13')]);return _0x9a71a2(_0x13309c[_0x8b06('0x11')][_0x8b06('0x13')]);}logger['error'](_0x8b06('0xc'),_0x53d58e,_0x13309c[_0x8b06('0x11')][_0x8b06('0x13')]);return _0x7992fd(_0x13309c[_0x8b06('0x11')][_0x8b06('0x13')]);}else{logger['info'](_0x8b06('0xc'),_0x53d58e,_0x8b06('0xf'));_0x7992fd(_0x13309c[_0x8b06('0x14')]['message']);}})[_0x8b06('0x15')](function(_0x551aea){logger[_0x8b06('0x11')](_0x8b06('0xc'),_0x53d58e,_0x551aea);_0x9a71a2(_0x551aea);});});}exports[_0x8b06('0x16')]=function(_0x4a4220){var _0x5e40d0=this;return new Promise(function(_0x5baee8,_0x470cbb){return db[_0x8b06('0x17')][_0x8b06('0x18')]({'raw':_0x4a4220[_0x8b06('0x19')]?_0x4a4220[_0x8b06('0x19')][_0x8b06('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a4220[_0x8b06('0x19')]?_0x4a4220[_0x8b06('0x19')][_0x8b06('0x1b')]||null:null,'attributes':_0x4a4220[_0x8b06('0x19')]?_0x4a4220[_0x8b06('0x19')][_0x8b06('0x1c')]||null:null,'limit':_0x4a4220[_0x8b06('0x19')]?_0x4a4220[_0x8b06('0x19')]['limit']||null:null,'include':_0x4a4220[_0x8b06('0x19')]?_0x4a4220[_0x8b06('0x19')][_0x8b06('0x1d')]?_[_0x8b06('0x1e')](_0x4a4220['options'][_0x8b06('0x1d')],function(_0x548f2a){return{'model':db[_0x548f2a[_0x8b06('0x1f')]],'as':_0x548f2a['as'],'attributes':_0x548f2a[_0x8b06('0x1c')],'include':_0x548f2a[_0x8b06('0x1d')]?_[_0x8b06('0x1e')](_0x548f2a[_0x8b06('0x1d')],function(_0x16b342){return{'model':db[_0x16b342['model']],'as':_0x16b342['as'],'attributes':_0x16b342['attributes'],'include':_0x16b342['include']?_[_0x8b06('0x1e')](_0x16b342[_0x8b06('0x1d')],function(_0x5d706c){return{'model':db[_0x5d706c['model']],'as':_0x5d706c['as'],'attributes':_0x5d706c[_0x8b06('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8b06('0xb')](function(_0x2399b8){logger[_0x8b06('0x20')](_0x8b06('0x16'),_0x4a4220);logger[_0x8b06('0xd')]('GetInterval',_0x4a4220,JSON[_0x8b06('0x10')](_0x2399b8));_0x5baee8(_0x2399b8);})[_0x8b06('0x15')](function(_0x21cc65){logger[_0x8b06('0x11')]('GetInterval',_0x21cc65['message'],_0x4a4220);_0x470cbb(_0x5e40d0[_0x8b06('0x11')](0x1f4,_0x21cc65[_0x8b06('0x13')]));});});};exports[_0x8b06('0x21')]=function(_0x1797d3){var _0x593778=this;return new Promise(function(_0x3ca585,_0x504876){return db[_0x8b06('0x17')]['find']({'raw':_0x1797d3[_0x8b06('0x19')]?_0x1797d3[_0x8b06('0x19')][_0x8b06('0x1a')]===undefined?!![]:![]:!![],'where':_0x1797d3['options']?_0x1797d3[_0x8b06('0x19')]['where']||null:null,'attributes':_0x1797d3[_0x8b06('0x19')]?_0x1797d3[_0x8b06('0x19')][_0x8b06('0x1c')]||null:null,'include':_0x1797d3['options']?_0x1797d3[_0x8b06('0x19')][_0x8b06('0x1d')]?_[_0x8b06('0x1e')](_0x1797d3['options']['include'],function(_0x4d233e){return{'model':db[_0x4d233e['model']],'as':_0x4d233e['as'],'attributes':_0x4d233e[_0x8b06('0x1c')],'include':_0x4d233e[_0x8b06('0x1d')]?_['map'](_0x4d233e[_0x8b06('0x1d')],function(_0x2169b4){return{'model':db[_0x2169b4['model']],'as':_0x2169b4['as'],'attributes':_0x2169b4['attributes'],'include':_0x2169b4['include']?_[_0x8b06('0x1e')](_0x2169b4[_0x8b06('0x1d')],function(_0x361f55){return{'model':db[_0x361f55[_0x8b06('0x1f')]],'as':_0x361f55['as'],'attributes':_0x361f55[_0x8b06('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8b06('0xb')](function(_0x2dcd0d){logger[_0x8b06('0x20')](_0x8b06('0x21'),_0x1797d3);logger[_0x8b06('0xd')](_0x8b06('0x21'),_0x1797d3,JSON[_0x8b06('0x10')](_0x2dcd0d));_0x3ca585(_0x2dcd0d);})[_0x8b06('0x15')](function(_0x4a836c){logger[_0x8b06('0x11')](_0x8b06('0x21'),_0x4a836c[_0x8b06('0x13')],_0x1797d3);_0x504876(_0x593778['error'](0x1f4,_0x4a836c[_0x8b06('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0bb1d61..da28cba 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 _0x8237=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x21f896,_0x5ad19d){var _0x1248db=function(_0x176c89){while(--_0x176c89){_0x21f896['push'](_0x21f896['shift']());}};_0x1248db(++_0x5ad19d);}(_0x8237,0x183));var _0x7823=function(_0x7b0df4,_0x4ccbc){_0x7b0df4=_0x7b0df4-0x0;var _0x356947=_0x8237[_0x7b0df4];return _0x356947;};'use strict';var express=require(_0x7823('0x0'));var router=express[_0x7823('0x1')]();var auth=require(_0x7823('0x2'));var controller=require(_0x7823('0x3'));router[_0x7823('0x4')]('/',auth[_0x7823('0x5')](),controller[_0x7823('0x6')]);module[_0x7823('0x7')]=router; \ No newline at end of file +var _0x011c=['send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x14f8d1,_0x33c9b0){var _0x43d7eb=function(_0xac2b1b){while(--_0xac2b1b){_0x14f8d1['push'](_0x14f8d1['shift']());}};_0x43d7eb(++_0x33c9b0);}(_0x011c,0x8e));var _0xc011=function(_0x26264d,_0x4c84bc){_0x26264d=_0x26264d-0x0;var _0x58f26c=_0x011c[_0x26264d];return _0x58f26c;};'use strict';var express=require(_0xc011('0x0'));var router=express[_0xc011('0x1')]();var auth=require(_0xc011('0x2'));var controller=require(_0xc011('0x3'));router[_0xc011('0x4')]('/',auth['isAuthenticated'](),controller[_0xc011('0x5')]);module[_0xc011('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 d83f1ea..5295f74 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 _0xbadb=['end','openIssue','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','data','statusCode','json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write'];(function(_0x13bc21,_0x2386cb){var _0x1cb395=function(_0x490dff){while(--_0x490dff){_0x13bc21['push'](_0x13bc21['shift']());}};_0x1cb395(++_0x2386cb);}(_0xbadb,0x160));var _0xbbad=function(_0x316fb6,_0x36f1f7){_0x316fb6=_0x316fb6-0x0;var _0x66a9a9=_0xbadb[_0x316fb6];return _0x66a9a9;};'use strict';var BPromise=require(_0xbbad('0x0'));var https=require('https');var logger=require(_0xbbad('0x1'))(_0xbbad('0x2'));var USERNAME='support';var PASSWORD=_0xbbad('0x3');function openIssue(_0x6aeb64,_0x291ad2){var _0x92ed20={'fields':{'project':{'key':_0x6aeb64[_0xbbad('0x4')]||_0xbbad('0x5')},'summary':(_0x6aeb64['summary']||_0xbbad('0x6'))+_0xbbad('0x7')+_0x6aeb64['ip'],'description':_0x6aeb64['description']||JSON[_0xbbad('0x8')](_0x6aeb64),'issuetype':{'name':_0x6aeb64[_0xbbad('0x9')]||_0xbbad('0xa')}}};_0x92ed20[_0xbbad('0xb')][_0xbbad('0xc')]=_0x6aeb64['email'];_0x92ed20[_0xbbad('0xb')][_0xbbad('0xd')]=_0x6aeb64['oldToken'];_0x92ed20[_0xbbad('0xb')][_0xbbad('0xe')]=_0x6aeb64['newToken'];_0x92ed20[_0xbbad('0xb')]['customfield_11503']=_0x6aeb64[_0xbbad('0xf')];_0x92ed20[_0xbbad('0xb')][_0xbbad('0x10')]=_0x6aeb64[_0xbbad('0x11')];_0x92ed20[_0xbbad('0xb')][_0xbbad('0x12')]=_0x6aeb64['ip'];var _0x25c245={'host':_0xbbad('0x13'),'port':0x1bb,'path':_0xbbad('0x14'),'method':_0xbbad('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xbbad('0x16'),'Authorization':_0xbbad('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xbbad('0x18')](_0xbbad('0x19'))}};var _0x4fefc9=JSON[_0xbbad('0x8')](_0x92ed20);var _0x261de3=https[_0xbbad('0x1a')](_0x25c245,function(_0x233490){_0x233490['setEncoding']('utf8');var _0x406c71='';_0x233490['on'](_0xbbad('0x1b'),function(_0x58f35b){_0x406c71+=_0x58f35b;});_0x233490['on']('end',function(){if(_0x291ad2){return _0x291ad2['status'](_0x233490[_0xbbad('0x1c')])[_0xbbad('0x1d')](JSON[_0xbbad('0x1e')](_0x406c71));}});});_0x261de3['on']('error',function(_0x345394){if(_0x291ad2){return _0x291ad2[_0xbbad('0x1f')](0x1f4)[_0xbbad('0x1d')]({'errors':[{'message':_0xbbad('0x20'),'type':_0xbbad('0x21')}]});}});_0x261de3[_0xbbad('0x22')](_0x4fefc9);_0x261de3[_0xbbad('0x23')]();}exports[_0xbbad('0x24')]=openIssue;exports[_0xbbad('0x25')]=function(_0x46483a,_0x451ba6){_0x46483a['body']['ip']=_0x46483a['headers'][_0xbbad('0x26')]||_0x46483a[_0xbbad('0x27')][_0xbbad('0x28')]||_0x46483a['socket'][_0xbbad('0x28')]||_0x46483a['connection'][_0xbbad('0x29')][_0xbbad('0x28')];return openIssue(_0x46483a[_0xbbad('0x2a')],_0x451ba6);}; \ No newline at end of file +var _0xc275=['x-forwarded-for','socket','remoteAddress','connection','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','write','openIssue','send','body','headers'];(function(_0x123e79,_0x4f620d){var _0x317dbe=function(_0x34cfaf){while(--_0x34cfaf){_0x123e79['push'](_0x123e79['shift']());}};_0x317dbe(++_0x4f620d);}(_0xc275,0x7c));var _0x5c27=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc275[_0x4ff09b];return _0x3f5c2e;};'use strict';var BPromise=require('bluebird');var https=require(_0x5c27('0x0'));var logger=require(_0x5c27('0x1'))(_0x5c27('0x2'));var USERNAME=_0x5c27('0x3');var PASSWORD=_0x5c27('0x4');function openIssue(_0x18c5a4,_0x420138){var _0x160ef4={'fields':{'project':{'key':_0x18c5a4['key']||_0x5c27('0x5')},'summary':(_0x18c5a4[_0x5c27('0x6')]||'Report')+'\x20from\x20'+_0x18c5a4['ip'],'description':_0x18c5a4[_0x5c27('0x7')]||JSON[_0x5c27('0x8')](_0x18c5a4),'issuetype':{'name':_0x18c5a4[_0x5c27('0x9')]||_0x5c27('0xa')}}};_0x160ef4['fields']['customfield_11500']=_0x18c5a4['email'];_0x160ef4[_0x5c27('0xb')][_0x5c27('0xc')]=_0x18c5a4[_0x5c27('0xd')];_0x160ef4[_0x5c27('0xb')][_0x5c27('0xe')]=_0x18c5a4[_0x5c27('0xf')];_0x160ef4[_0x5c27('0xb')]['customfield_11503']=_0x18c5a4['name'];_0x160ef4[_0x5c27('0xb')][_0x5c27('0x10')]=_0x18c5a4['reason'];_0x160ef4['fields']['customfield_10102']=_0x18c5a4['ip'];var _0x23e48b={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x5c27('0x11'),'method':_0x5c27('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x5c27('0x13'),'Authorization':_0x5c27('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x5c27('0x15')](_0x5c27('0x16'))}};var _0x37251e=JSON[_0x5c27('0x8')](_0x160ef4);var _0x26b807=https['request'](_0x23e48b,function(_0x2e5a7a){_0x2e5a7a[_0x5c27('0x17')](_0x5c27('0x18'));var _0x2196a8='';_0x2e5a7a['on'](_0x5c27('0x19'),function(_0x572028){_0x2196a8+=_0x572028;});_0x2e5a7a['on'](_0x5c27('0x1a'),function(){if(_0x420138){return _0x420138[_0x5c27('0x1b')](_0x2e5a7a[_0x5c27('0x1c')])[_0x5c27('0x1d')](JSON[_0x5c27('0x1e')](_0x2196a8));}});});_0x26b807['on']('error',function(_0x279605){if(_0x420138){return _0x420138[_0x5c27('0x1b')](0x1f4)[_0x5c27('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x26b807[_0x5c27('0x1f')](_0x37251e);_0x26b807[_0x5c27('0x1a')]();}exports[_0x5c27('0x20')]=openIssue;exports[_0x5c27('0x21')]=function(_0x30d720,_0x4c2b72){_0x30d720[_0x5c27('0x22')]['ip']=_0x30d720[_0x5c27('0x23')][_0x5c27('0x24')]||_0x30d720['connection']['remoteAddress']||_0x30d720[_0x5c27('0x25')][_0x5c27('0x26')]||_0x30d720[_0x5c27('0x27')]['socket'][_0x5c27('0x26')];return openIssue(_0x30d720['body'],_0x4c2b72);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ede6843..123a192 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 _0x4456=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','update'];(function(_0x388e72,_0x3ea102){var _0x3dc3ae=function(_0x97c695){while(--_0x97c695){_0x388e72['push'](_0x388e72['shift']());}};_0x3dc3ae(++_0x3ea102);}(_0x4456,0x159));var _0x6445=function(_0x43f306,_0xfe842f){_0x43f306=_0x43f306-0x0;var _0x53d7d8=_0x4456[_0x43f306];return _0x53d7d8;};'use strict';var multer=require(_0x6445('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6445('0x1'));var express=require(_0x6445('0x2'));var router=express[_0x6445('0x3')]();var auth=require(_0x6445('0x4'));var interaction=require(_0x6445('0x5'));var config=require(_0x6445('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x6445('0x7')]('/',auth[_0x6445('0x8')](),controller['index']);router[_0x6445('0x7')](_0x6445('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6445('0x7')](_0x6445('0xa'),auth[_0x6445('0x8')](),controller[_0x6445('0xb')]);router[_0x6445('0xc')]('/',auth[_0x6445('0x8')](),controller[_0x6445('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6445('0xe')]);router[_0x6445('0xf')](_0x6445('0xa'),auth[_0x6445('0x8')](),controller[_0x6445('0x10')]);module[_0x6445('0x11')]=router; \ No newline at end of file +var _0x6189=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','get','/describe','describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0xaebc1f,_0x2d6bde){var _0x157b02=function(_0x2236a1){while(--_0x2236a1){_0xaebc1f['push'](_0xaebc1f['shift']());}};_0x157b02(++_0x2d6bde);}(_0x6189,0x1cd));var _0x9618=function(_0x4a1c00,_0x30abb5){_0x4a1c00=_0x4a1c00-0x0;var _0x54c7c6=_0x6189[_0x4a1c00];return _0x54c7c6;};'use strict';var multer=require('multer');var util=require(_0x9618('0x0'));var path=require('path');var timeout=require(_0x9618('0x1'));var express=require(_0x9618('0x2'));var router=express[_0x9618('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9618('0x4'));var config=require(_0x9618('0x5'));var controller=require(_0x9618('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9618('0x7')]);router[_0x9618('0x8')](_0x9618('0x9'),auth['isAuthenticated'](),controller[_0x9618('0xa')]);router[_0x9618('0x8')]('/:id',auth[_0x9618('0xb')](),controller[_0x9618('0xc')]);router[_0x9618('0xd')]('/',auth['isAuthenticated'](),controller[_0x9618('0xe')]);router[_0x9618('0xf')](_0x9618('0x10'),auth['isAuthenticated'](),controller[_0x9618('0x11')]);router[_0x9618('0x12')](_0x9618('0x10'),auth[_0x9618('0xb')](),controller[_0x9618('0x13')]);module[_0x9618('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 13b4ed1..cef4b9a 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 _0x8c41=['STRING','TEXT','exports'];(function(_0x1120e5,_0x1d7637){var _0x192fef=function(_0x4e926a){while(--_0x4e926a){_0x1120e5['push'](_0x1120e5['shift']());}};_0x192fef(++_0x1d7637);}(_0x8c41,0x19d));var _0x18c4=function(_0x46fe60,_0x19c144){_0x46fe60=_0x46fe60-0x0;var _0x1a8eb4=_0x8c41[_0x46fe60];return _0x1a8eb4;};'use strict';var Sequelize=require('sequelize');module[_0x18c4('0x0')]={'question':{'type':Sequelize[_0x18c4('0x1')]},'answer':{'type':Sequelize[_0x18c4('0x2')]('long')},'membername':{'type':Sequelize[_0x18c4('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x18c4('0x1')]},'uniqueid':{'type':Sequelize[_0x18c4('0x1')]},'calleridname':{'type':Sequelize[_0x18c4('0x1')]},'calleridnum':{'type':Sequelize[_0x18c4('0x1')]},'questionId':{'type':Sequelize[_0x18c4('0x1')]}}; \ No newline at end of file +var _0xfc2c=['STRING','TEXT','long','exports'];(function(_0x49e468,_0x2f3552){var _0x15a4bb=function(_0x91fdc5){while(--_0x91fdc5){_0x49e468['push'](_0x49e468['shift']());}};_0x15a4bb(++_0x2f3552);}(_0xfc2c,0xef));var _0xcfc2=function(_0x3cf30d,_0x359123){_0x3cf30d=_0x3cf30d-0x0;var _0x5bbb88=_0xfc2c[_0x3cf30d];return _0x5bbb88;};'use strict';var Sequelize=require('sequelize');module[_0xcfc2('0x0')]={'question':{'type':Sequelize[_0xcfc2('0x1')]},'answer':{'type':Sequelize[_0xcfc2('0x2')](_0xcfc2('0x3'))},'membername':{'type':Sequelize[_0xcfc2('0x1')]},'projectname':{'type':Sequelize[_0xcfc2('0x1')]},'queue':{'type':Sequelize[_0xcfc2('0x1')]},'uniqueid':{'type':Sequelize[_0xcfc2('0x1')]},'calleridname':{'type':Sequelize[_0xcfc2('0x1')]},'calleridnum':{'type':Sequelize[_0xcfc2('0x1')]},'questionId':{'type':Sequelize[_0xcfc2('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index aaaa29d..3f9536b 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 _0x0d43=['intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0d43,0x68));var _0x30d4=function(_0xd24b43,_0x11caa4){_0xd24b43=_0xd24b43-0x0;var _0x2b1b44=_0x0d43[_0xd24b43];return _0x2b1b44;};'use strict';var pdf=require(_0x30d4('0x0'));var emlformat=require(_0x30d4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x30d4('0x2'));var jsonpatch=require(_0x30d4('0x3'));var rp=require(_0x30d4('0x4'));var moment=require(_0x30d4('0x5'));var BPromise=require(_0x30d4('0x6'));var Mustache=require(_0x30d4('0x7'));var util=require(_0x30d4('0x8'));var path=require(_0x30d4('0x9'));var sox=require(_0x30d4('0xa'));var csv=require(_0x30d4('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30d4('0xc'));var deskjs=require(_0x30d4('0xd'));var toCsv=require(_0x30d4('0xb'));var querystring=require(_0x30d4('0xe'));var Papa=require(_0x30d4('0xf'));var Redis=require(_0x30d4('0x10'));var authService=require(_0x30d4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x30d4('0x12'));var hardwareService=require(_0x30d4('0x13'));var logger=require(_0x30d4('0x14'))(_0x30d4('0x15'));var utils=require(_0x30d4('0x16'));var config=require(_0x30d4('0x17'));var db=require(_0x30d4('0x18'))['db'];function respondWithStatusCode(_0x532a12,_0x3df491){_0x3df491=_0x3df491||0xcc;return function(_0x769732){if(_0x769732){return _0x532a12[_0x30d4('0x19')](_0x3df491);}return _0x532a12[_0x30d4('0x1a')](_0x3df491)[_0x30d4('0x1b')]();};}function respondWithResult(_0x567ede,_0x249b30){_0x249b30=_0x249b30||0xc8;return function(_0x1ed0d0){if(_0x1ed0d0){return _0x567ede[_0x30d4('0x1a')](_0x249b30)[_0x30d4('0x1c')](_0x1ed0d0);}};}function respondWithFilteredResult(_0xdbef18,_0x400ad8){return function(_0x542e0b){if(_0x542e0b){var _0x1a298d=_0x542e0b[_0x30d4('0x1d')],_0x2a3674=_0x400ad8[_0x30d4('0x1e')],_0xaf2ea1=_0x400ad8[_0x30d4('0x1e')]+_0x400ad8['limit'],_0x578f8d;if(_0xaf2ea1>=_0x1a298d){_0xaf2ea1=_0x1a298d;_0x578f8d=0xc8;}else{_0x578f8d=0xce;}_0xdbef18[_0x30d4('0x1a')](_0x578f8d);return _0xdbef18[_0x30d4('0x1f')](_0x30d4('0x20'),_0x2a3674+'-'+_0xaf2ea1+'/'+_0x1a298d)[_0x30d4('0x1c')](_0x542e0b);}return null;};}function patchUpdates(_0x25650e){return function(_0x333ead){try{jsonpatch[_0x30d4('0x21')](_0x333ead,_0x25650e,!![]);}catch(_0x538c10){return BPromise[_0x30d4('0x22')](_0x538c10);}return _0x333ead[_0x30d4('0x23')]();};}function saveUpdates(_0x5dbea6,_0x41cee3){return function(_0x4a1663){if(_0x4a1663){return _0x4a1663[_0x30d4('0x24')](_0x5dbea6)[_0x30d4('0x25')](function(_0xd3f758){return _0xd3f758;});}return null;};}function removeEntity(_0x354e3c,_0x316f5a){return function(_0x428340){if(_0x428340){return _0x428340[_0x30d4('0x26')]()[_0x30d4('0x25')](function(){_0x354e3c[_0x30d4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e036,_0x9803cd){return function(_0x381338){if(!_0x381338){_0x45e036['sendStatus'](0x194);}return _0x381338;};}function handleError(_0x2820c5,_0x242223){_0x242223=_0x242223||0x1f4;return function(_0x412e9f){logger['error'](_0x412e9f['stack']);if(_0x412e9f[_0x30d4('0x27')]){delete _0x412e9f[_0x30d4('0x27')];}_0x2820c5[_0x30d4('0x1a')](_0x242223)[_0x30d4('0x28')](_0x412e9f);};}exports[_0x30d4('0x29')]=function(_0x406e58,_0x2e246d){var _0x41bfe5={},_0x191db3={},_0x29597e={'count':0x0,'rows':[]};var _0x33621a=_['map'](db['JscriptyAnswerReport'][_0x30d4('0x2a')],function(_0x3db923){return{'name':_0x3db923[_0x30d4('0x2b')],'type':_0x3db923['type'][_0x30d4('0x2c')]};});_0x191db3[_0x30d4('0x2d')]=_[_0x30d4('0x2e')](_0x33621a,_0x30d4('0x27'));_0x191db3[_0x30d4('0x2f')]=_[_0x30d4('0x30')](_0x406e58[_0x30d4('0x2f')]);_0x191db3[_0x30d4('0x31')]=_[_0x30d4('0x32')](_0x191db3[_0x30d4('0x2d')],_0x191db3['query']);_0x41bfe5[_0x30d4('0x33')]=_[_0x30d4('0x32')](_0x191db3[_0x30d4('0x2d')],qs[_0x30d4('0x34')](_0x406e58['query'][_0x30d4('0x34')]));_0x41bfe5['attributes']=_0x41bfe5[_0x30d4('0x33')][_0x30d4('0x35')]?_0x41bfe5[_0x30d4('0x33')]:_0x191db3[_0x30d4('0x2d')];if(!_0x406e58[_0x30d4('0x2f')][_0x30d4('0x36')](_0x30d4('0x37'))){_0x41bfe5[_0x30d4('0x38')]=qs['limit'](_0x406e58[_0x30d4('0x2f')]['limit']);_0x41bfe5['offset']=qs[_0x30d4('0x1e')](_0x406e58[_0x30d4('0x2f')]['offset']);}_0x41bfe5[_0x30d4('0x39')]=qs[_0x30d4('0x3a')](_0x406e58[_0x30d4('0x2f')][_0x30d4('0x3a')]);_0x41bfe5[_0x30d4('0x3b')]=qs[_0x30d4('0x31')](_[_0x30d4('0x3c')](_0x406e58[_0x30d4('0x2f')],_0x191db3[_0x30d4('0x31')]),_0x33621a);if(_0x406e58['query'][_0x30d4('0x3d')]){_0x41bfe5['where']=_[_0x30d4('0x3e')](_0x41bfe5[_0x30d4('0x3b')],{'$or':_[_0x30d4('0x2e')](_0x33621a,function(_0x319bbe){if(_0x319bbe[_0x30d4('0x3f')]!==_0x30d4('0x40')){var _0x1f1ca6={};_0x1f1ca6[_0x319bbe[_0x30d4('0x27')]]={'$like':'%'+_0x406e58[_0x30d4('0x2f')][_0x30d4('0x3d')]+'%'};return _0x1f1ca6;}})});}_0x41bfe5=_[_0x30d4('0x3e')]({},_0x41bfe5,_0x406e58[_0x30d4('0x41')]);var _0x569646={'where':_0x41bfe5[_0x30d4('0x3b')]};return db[_0x30d4('0x42')]['count'](_0x569646)[_0x30d4('0x25')](function(_0x24238b){_0x29597e['count']=_0x24238b;if(_0x406e58[_0x30d4('0x2f')][_0x30d4('0x43')]){_0x41bfe5[_0x30d4('0x44')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x30d4('0x45')](_0x41bfe5);})['then'](function(_0x1d0e42){_0x29597e[_0x30d4('0x46')]=_0x1d0e42;return _0x29597e;})[_0x30d4('0x25')](respondWithFilteredResult(_0x2e246d,_0x41bfe5))[_0x30d4('0x47')](handleError(_0x2e246d,null));};exports['show']=function(_0x5b8b3f,_0x8a805a){var _0x22622c={'raw':!![],'where':{'id':_0x5b8b3f[_0x30d4('0x48')]['id']}},_0x5048ce={};_0x5048ce[_0x30d4('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0x30d4('0x2a')]);_0x5048ce[_0x30d4('0x2f')]=_[_0x30d4('0x30')](_0x5b8b3f['query']);_0x5048ce['filters']=_[_0x30d4('0x32')](_0x5048ce[_0x30d4('0x2d')],_0x5048ce[_0x30d4('0x2f')]);_0x22622c[_0x30d4('0x33')]=_[_0x30d4('0x32')](_0x5048ce[_0x30d4('0x2d')],qs[_0x30d4('0x34')](_0x5b8b3f[_0x30d4('0x2f')][_0x30d4('0x34')]));_0x22622c[_0x30d4('0x33')]=_0x22622c[_0x30d4('0x33')][_0x30d4('0x35')]?_0x22622c['attributes']:_0x5048ce['model'];if(_0x5b8b3f[_0x30d4('0x2f')][_0x30d4('0x43')]){_0x22622c[_0x30d4('0x44')]=[{'all':!![]}];}_0x22622c=_[_0x30d4('0x3e')]({},_0x22622c,_0x5b8b3f[_0x30d4('0x41')]);return db[_0x30d4('0x42')][_0x30d4('0x49')](_0x22622c)['then'](handleEntityNotFound(_0x8a805a,null))[_0x30d4('0x25')](respondWithResult(_0x8a805a,null))[_0x30d4('0x47')](handleError(_0x8a805a,null));};exports['create']=function(_0x547fef,_0x4849a5){return db[_0x30d4('0x42')][_0x30d4('0x4a')](_0x547fef[_0x30d4('0x4b')],{})['then'](respondWithResult(_0x4849a5,0xc9))[_0x30d4('0x47')](handleError(_0x4849a5,null));};exports[_0x30d4('0x24')]=function(_0x3f425b,_0x3f0063){if(_0x3f425b[_0x30d4('0x4b')]['id']){delete _0x3f425b['body']['id'];}return db[_0x30d4('0x42')][_0x30d4('0x49')]({'where':{'id':_0x3f425b[_0x30d4('0x48')]['id']}})[_0x30d4('0x25')](handleEntityNotFound(_0x3f0063,null))[_0x30d4('0x25')](saveUpdates(_0x3f425b[_0x30d4('0x4b')],null))[_0x30d4('0x25')](respondWithResult(_0x3f0063,null))[_0x30d4('0x47')](handleError(_0x3f0063,null));};exports['destroy']=function(_0x24b7e5,_0x499273){return db[_0x30d4('0x42')]['find']({'where':{'id':_0x24b7e5['params']['id']}})[_0x30d4('0x25')](handleEntityNotFound(_0x499273,null))[_0x30d4('0x25')](removeEntity(_0x499273,null))['catch'](handleError(_0x499273,null));};exports[_0x30d4('0x4c')]=function(_0x23447b,_0x40ec53){return db['JscriptyAnswerReport'][_0x30d4('0x4c')]()[_0x30d4('0x25')](respondWithResult(_0x40ec53,null))[_0x30d4('0x47')](handleError(_0x40ec53,null));}; \ No newline at end of file +var _0xf617=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','JscriptyAnswerReport','includeAll','findAll','catch','show','params','length','include','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf617,0x145));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7f61('0x0'));var emlformat=require(_0x7f61('0x1'));var rimraf=require(_0x7f61('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f61('0x3'));var moment=require(_0x7f61('0x4'));var BPromise=require(_0x7f61('0x5'));var Mustache=require(_0x7f61('0x6'));var util=require(_0x7f61('0x7'));var path=require('path');var sox=require(_0x7f61('0x8'));var csv=require(_0x7f61('0x9'));var ejs=require(_0x7f61('0xa'));var fs=require('fs');var _=require(_0x7f61('0xb'));var squel=require(_0x7f61('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f61('0xd'));var deskjs=require(_0x7f61('0xe'));var toCsv=require(_0x7f61('0x9'));var querystring=require(_0x7f61('0xf'));var Papa=require(_0x7f61('0x10'));var Redis=require(_0x7f61('0x11'));var authService=require(_0x7f61('0x12'));var qs=require(_0x7f61('0x13'));var as=require(_0x7f61('0x14'));var hardwareService=require(_0x7f61('0x15'));var logger=require(_0x7f61('0x16'))(_0x7f61('0x17'));var utils=require('../../config/utils');var config=require(_0x7f61('0x18'));var db=require(_0x7f61('0x19'))['db'];function respondWithStatusCode(_0x2709c8,_0x1d3c4e){_0x1d3c4e=_0x1d3c4e||0xcc;return function(_0x124d60){if(_0x124d60){return _0x2709c8[_0x7f61('0x1a')](_0x1d3c4e);}return _0x2709c8[_0x7f61('0x1b')](_0x1d3c4e)[_0x7f61('0x1c')]();};}function respondWithResult(_0x4ffa2f,_0x2238dd){_0x2238dd=_0x2238dd||0xc8;return function(_0x4a1430){if(_0x4a1430){return _0x4ffa2f[_0x7f61('0x1b')](_0x2238dd)[_0x7f61('0x1d')](_0x4a1430);}};}function respondWithFilteredResult(_0x42907e,_0xf21439){return function(_0xe7f38c){if(_0xe7f38c){var _0x28a2c6=_0xe7f38c[_0x7f61('0x1e')],_0x41b582=_0xf21439[_0x7f61('0x1f')],_0x3df724=_0xf21439['offset']+_0xf21439[_0x7f61('0x20')],_0x1c9d94;if(_0x3df724>=_0x28a2c6){_0x3df724=_0x28a2c6;_0x1c9d94=0xc8;}else{_0x1c9d94=0xce;}_0x42907e[_0x7f61('0x1b')](_0x1c9d94);return _0x42907e['set'](_0x7f61('0x21'),_0x41b582+'-'+_0x3df724+'/'+_0x28a2c6)['json'](_0xe7f38c);}return null;};}function patchUpdates(_0xdf8e70){return function(_0x62e8b){try{jsonpatch[_0x7f61('0x22')](_0x62e8b,_0xdf8e70,!![]);}catch(_0x24089a){return BPromise[_0x7f61('0x23')](_0x24089a);}return _0x62e8b[_0x7f61('0x24')]();};}function saveUpdates(_0x2c3046,_0x3d8d4a){return function(_0x394be5){if(_0x394be5){return _0x394be5[_0x7f61('0x25')](_0x2c3046)[_0x7f61('0x26')](function(_0x35b783){return _0x35b783;});}return null;};}function removeEntity(_0x4bfe47,_0x412eb4){return function(_0x114295){if(_0x114295){return _0x114295[_0x7f61('0x27')]()['then'](function(){_0x4bfe47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x62bf82,_0x847a38){return function(_0x2ef93c){if(!_0x2ef93c){_0x62bf82['sendStatus'](0x194);}return _0x2ef93c;};}function handleError(_0x3e6cce,_0x14d022){_0x14d022=_0x14d022||0x1f4;return function(_0x10db89){logger[_0x7f61('0x28')](_0x10db89[_0x7f61('0x29')]);if(_0x10db89['name']){delete _0x10db89[_0x7f61('0x2a')];}_0x3e6cce['status'](_0x14d022)['send'](_0x10db89);};}exports[_0x7f61('0x2b')]=function(_0x179732,_0x490981){var _0x20c9fa={},_0x2c805b={},_0x33ba9f={'count':0x0,'rows':[]};var _0x5b0493=_[_0x7f61('0x2c')](db['JscriptyAnswerReport'][_0x7f61('0x2d')],function(_0x1386b4){return{'name':_0x1386b4[_0x7f61('0x2e')],'type':_0x1386b4[_0x7f61('0x2f')][_0x7f61('0x30')]};});_0x2c805b['model']=_[_0x7f61('0x2c')](_0x5b0493,_0x7f61('0x2a'));_0x2c805b[_0x7f61('0x31')]=_[_0x7f61('0x32')](_0x179732[_0x7f61('0x31')]);_0x2c805b[_0x7f61('0x33')]=_['intersection'](_0x2c805b[_0x7f61('0x34')],_0x2c805b[_0x7f61('0x31')]);_0x20c9fa[_0x7f61('0x35')]=_[_0x7f61('0x36')](_0x2c805b[_0x7f61('0x34')],qs[_0x7f61('0x37')](_0x179732[_0x7f61('0x31')][_0x7f61('0x37')]));_0x20c9fa[_0x7f61('0x35')]=_0x20c9fa[_0x7f61('0x35')]['length']?_0x20c9fa['attributes']:_0x2c805b[_0x7f61('0x34')];if(!_0x179732[_0x7f61('0x31')][_0x7f61('0x38')](_0x7f61('0x39'))){_0x20c9fa[_0x7f61('0x20')]=qs[_0x7f61('0x20')](_0x179732[_0x7f61('0x31')][_0x7f61('0x20')]);_0x20c9fa[_0x7f61('0x1f')]=qs[_0x7f61('0x1f')](_0x179732[_0x7f61('0x31')][_0x7f61('0x1f')]);}_0x20c9fa[_0x7f61('0x3a')]=qs[_0x7f61('0x3b')](_0x179732[_0x7f61('0x31')][_0x7f61('0x3b')]);_0x20c9fa[_0x7f61('0x3c')]=qs['filters'](_[_0x7f61('0x3d')](_0x179732[_0x7f61('0x31')],_0x2c805b[_0x7f61('0x33')]),_0x5b0493);if(_0x179732[_0x7f61('0x31')][_0x7f61('0x3e')]){_0x20c9fa[_0x7f61('0x3c')]=_[_0x7f61('0x3f')](_0x20c9fa[_0x7f61('0x3c')],{'$or':_[_0x7f61('0x2c')](_0x5b0493,function(_0x5932f2){if(_0x5932f2[_0x7f61('0x2f')]!=='VIRTUAL'){var _0xf660a2={};_0xf660a2[_0x5932f2[_0x7f61('0x2a')]]={'$like':'%'+_0x179732[_0x7f61('0x31')]['filter']+'%'};return _0xf660a2;}})});}_0x20c9fa=_[_0x7f61('0x3f')]({},_0x20c9fa,_0x179732[_0x7f61('0x40')]);var _0x4ed7d7={'where':_0x20c9fa[_0x7f61('0x3c')]};return db[_0x7f61('0x41')][_0x7f61('0x1e')](_0x4ed7d7)['then'](function(_0x2bd441){_0x33ba9f[_0x7f61('0x1e')]=_0x2bd441;if(_0x179732[_0x7f61('0x31')][_0x7f61('0x42')]){_0x20c9fa['include']=[{'all':!![]}];}return db[_0x7f61('0x41')][_0x7f61('0x43')](_0x20c9fa);})['then'](function(_0x2ab5ee){_0x33ba9f['rows']=_0x2ab5ee;return _0x33ba9f;})[_0x7f61('0x26')](respondWithFilteredResult(_0x490981,_0x20c9fa))[_0x7f61('0x44')](handleError(_0x490981,null));};exports[_0x7f61('0x45')]=function(_0x31152f,_0x268e2a){var _0x973d33={'raw':!![],'where':{'id':_0x31152f[_0x7f61('0x46')]['id']}},_0x59f358={};_0x59f358['model']=_[_0x7f61('0x32')](db[_0x7f61('0x41')][_0x7f61('0x2d')]);_0x59f358[_0x7f61('0x31')]=_[_0x7f61('0x32')](_0x31152f[_0x7f61('0x31')]);_0x59f358[_0x7f61('0x33')]=_['intersection'](_0x59f358[_0x7f61('0x34')],_0x59f358['query']);_0x973d33[_0x7f61('0x35')]=_[_0x7f61('0x36')](_0x59f358['model'],qs[_0x7f61('0x37')](_0x31152f[_0x7f61('0x31')][_0x7f61('0x37')]));_0x973d33[_0x7f61('0x35')]=_0x973d33[_0x7f61('0x35')][_0x7f61('0x47')]?_0x973d33[_0x7f61('0x35')]:_0x59f358[_0x7f61('0x34')];if(_0x31152f[_0x7f61('0x31')][_0x7f61('0x42')]){_0x973d33[_0x7f61('0x48')]=[{'all':!![]}];}_0x973d33=_[_0x7f61('0x3f')]({},_0x973d33,_0x31152f[_0x7f61('0x40')]);return db['JscriptyAnswerReport']['find'](_0x973d33)[_0x7f61('0x26')](handleEntityNotFound(_0x268e2a,null))[_0x7f61('0x26')](respondWithResult(_0x268e2a,null))[_0x7f61('0x44')](handleError(_0x268e2a,null));};exports[_0x7f61('0x49')]=function(_0x399b3e,_0x511ea0){return db[_0x7f61('0x41')][_0x7f61('0x49')](_0x399b3e[_0x7f61('0x4a')],{})[_0x7f61('0x26')](respondWithResult(_0x511ea0,0xc9))['catch'](handleError(_0x511ea0,null));};exports[_0x7f61('0x25')]=function(_0x137125,_0x189e32){if(_0x137125['body']['id']){delete _0x137125[_0x7f61('0x4a')]['id'];}return db[_0x7f61('0x41')]['find']({'where':{'id':_0x137125[_0x7f61('0x46')]['id']}})['then'](handleEntityNotFound(_0x189e32,null))[_0x7f61('0x26')](saveUpdates(_0x137125['body'],null))[_0x7f61('0x26')](respondWithResult(_0x189e32,null))[_0x7f61('0x44')](handleError(_0x189e32,null));};exports[_0x7f61('0x27')]=function(_0x14f7a0,_0x42a37d){return db[_0x7f61('0x41')]['find']({'where':{'id':_0x14f7a0[_0x7f61('0x46')]['id']}})[_0x7f61('0x26')](handleEntityNotFound(_0x42a37d,null))[_0x7f61('0x26')](removeEntity(_0x42a37d,null))[_0x7f61('0x44')](handleError(_0x42a37d,null));};exports[_0x7f61('0x4b')]=function(_0x146977,_0x51bc18){return db[_0x7f61('0x41')][_0x7f61('0x4b')]()[_0x7f61('0x26')](respondWithResult(_0x51bc18,null))['catch'](handleError(_0x51bc18,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e8b6a48..090ecf5 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 _0xe81d=['define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x553609,_0x47cd99){var _0x4bb23a=function(_0x163862){while(--_0x163862){_0x553609['push'](_0x553609['shift']());}};_0x4bb23a(++_0x47cd99);}(_0xe81d,0x16b));var _0xde81=function(_0x154d3f,_0x3e5ebc){_0x154d3f=_0x154d3f-0x0;var _0x4ff05a=_0xe81d[_0x154d3f];return _0x4ff05a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde81('0x0'))('api');var moment=require('moment');var BPromise=require(_0xde81('0x1'));var rp=require(_0xde81('0x2'));var fs=require('fs');var path=require(_0xde81('0x3'));var rimraf=require('rimraf');var config=require(_0xde81('0x4'));var attributes=require(_0xde81('0x5'));module['exports']=function(_0x52eca2,_0x4c98e0){return _0x52eca2[_0xde81('0x6')](_0xde81('0x7'),attributes,{'tableName':_0xde81('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf206=['path','rimraf','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b81ab,_0x51703e){var _0xf39764=function(_0x1d90cd){while(--_0x1d90cd){_0x3b81ab['push'](_0x3b81ab['shift']());}};_0xf39764(++_0x51703e);}(_0xf206,0x89));var _0x6f20=function(_0x38d0e1,_0x5e44c0){_0x38d0e1=_0x38d0e1-0x0;var _0x29d381=_0xf206[_0x38d0e1];return _0x29d381;};'use strict';var _=require(_0x6f20('0x0'));var util=require('util');var logger=require(_0x6f20('0x1'))(_0x6f20('0x2'));var moment=require(_0x6f20('0x3'));var BPromise=require(_0x6f20('0x4'));var rp=require(_0x6f20('0x5'));var fs=require('fs');var path=require(_0x6f20('0x6'));var rimraf=require(_0x6f20('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f20('0x8'));module['exports']=function(_0x1abef6,_0x33fe6c){return _0x1abef6[_0x6f20('0x9')](_0x6f20('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index dc1d101..8ccb61b 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 _0xea09=['jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4b4342,_0x205298){var _0xe74e4a=function(_0x5b58e0){while(--_0x5b58e0){_0x4b4342['push'](_0x4b4342['shift']());}};_0xe74e4a(++_0x205298);}(_0xea09,0x1ee));var _0x9ea0=function(_0x292195,_0x3b1b84){_0x292195=_0x292195-0x0;var _0x446a7e=_0xea09[_0x292195];return _0x446a7e;};'use strict';var _=require(_0x9ea0('0x0'));var util=require(_0x9ea0('0x1'));var moment=require(_0x9ea0('0x2'));var BPromise=require(_0x9ea0('0x3'));var rs=require(_0x9ea0('0x4'));var fs=require('fs');var Redis=require(_0x9ea0('0x5'));var db=require(_0x9ea0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea0('0x7'))(_0x9ea0('0x8'));var config=require(_0x9ea0('0x9'));var jayson=require(_0x9ea0('0xa'));var client=jayson[_0x9ea0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x200293,_0x477325,_0x14ce94){return new BPromise(function(_0x5744a1,_0xef0ca6){return client[_0x9ea0('0xc')](_0x200293,_0x14ce94)[_0x9ea0('0xd')](function(_0x45c5b8){logger[_0x9ea0('0xe')](_0x9ea0('0xf'),_0x477325,_0x9ea0('0x10'));logger[_0x9ea0('0x11')](_0x9ea0('0x12'),_0x477325,_0x9ea0('0x10'),JSON[_0x9ea0('0x13')](_0x45c5b8));if(_0x45c5b8[_0x9ea0('0x14')]){if(_0x45c5b8['error'][_0x9ea0('0x15')]===0x1f4){logger[_0x9ea0('0x14')](_0x9ea0('0xf'),_0x477325,_0x45c5b8[_0x9ea0('0x14')][_0x9ea0('0x16')]);return _0xef0ca6(_0x45c5b8[_0x9ea0('0x14')][_0x9ea0('0x16')]);}logger[_0x9ea0('0x14')](_0x9ea0('0xf'),_0x477325,_0x45c5b8[_0x9ea0('0x14')]['message']);return _0x5744a1(_0x45c5b8[_0x9ea0('0x14')][_0x9ea0('0x16')]);}else{logger[_0x9ea0('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x477325,_0x9ea0('0x10'));_0x5744a1(_0x45c5b8[_0x9ea0('0x17')][_0x9ea0('0x16')]);}})['catch'](function(_0x5ac08b){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x477325,_0x5ac08b);_0xef0ca6(_0x5ac08b);});});} \ No newline at end of file +var _0x1b9d=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1b9d,0x1e6));var _0xd1b9=function(_0x8969c2,_0xc524b7){_0x8969c2=_0x8969c2-0x0;var _0x519f23=_0x1b9d[_0x8969c2];return _0x519f23;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd1b9('0x0'));var BPromise=require(_0xd1b9('0x1'));var rs=require(_0xd1b9('0x2'));var fs=require('fs');var Redis=require(_0xd1b9('0x3'));var db=require(_0xd1b9('0x4'))['db'];var utils=require(_0xd1b9('0x5'));var logger=require(_0xd1b9('0x6'))('rpc');var config=require(_0xd1b9('0x7'));var jayson=require(_0xd1b9('0x8'));var client=jayson[_0xd1b9('0x9')][_0xd1b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f4af0,_0x25e5e6,_0x477ff7){return new BPromise(function(_0x2945bc,_0x5b580f){return client[_0xd1b9('0xb')](_0x2f4af0,_0x477ff7)[_0xd1b9('0xc')](function(_0x145abb){logger[_0xd1b9('0xd')](_0xd1b9('0xe'),_0x25e5e6,_0xd1b9('0xf'));logger[_0xd1b9('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x25e5e6,_0xd1b9('0xf'),JSON[_0xd1b9('0x11')](_0x145abb));if(_0x145abb[_0xd1b9('0x12')]){if(_0x145abb[_0xd1b9('0x12')]['code']===0x1f4){logger[_0xd1b9('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x25e5e6,_0x145abb[_0xd1b9('0x12')]['message']);return _0x5b580f(_0x145abb[_0xd1b9('0x12')][_0xd1b9('0x13')]);}logger[_0xd1b9('0x12')](_0xd1b9('0xe'),_0x25e5e6,_0x145abb[_0xd1b9('0x12')][_0xd1b9('0x13')]);return _0x2945bc(_0x145abb[_0xd1b9('0x12')][_0xd1b9('0x13')]);}else{logger[_0xd1b9('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x25e5e6,_0xd1b9('0xf'));_0x2945bc(_0x145abb[_0xd1b9('0x14')][_0xd1b9('0x13')]);}})[_0xd1b9('0x15')](function(_0x408889){logger[_0xd1b9('0x12')](_0xd1b9('0xe'),_0x25e5e6,_0x408889);_0x5b580f(_0x408889);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index cf4beb2..ab93ee9 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 _0x889e=['post','create','/:id/clone','clone','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0xdb799c,_0x5c8231){var _0x281b2b=function(_0x35c05b){while(--_0x35c05b){_0xdb799c['push'](_0xdb799c['shift']());}};_0x281b2b(++_0x5c8231);}(_0x889e,0x183));var _0xe889=function(_0x100d21,_0x129632){_0x100d21=_0x100d21-0x0;var _0x3055dd=_0x889e[_0x100d21];return _0x3055dd;};'use strict';var multer=require(_0xe889('0x0'));var util=require(_0xe889('0x1'));var path=require('path');var timeout=require(_0xe889('0x2'));var express=require(_0xe889('0x3'));var router=express[_0xe889('0x4')]();var auth=require(_0xe889('0x5'));var interaction=require(_0xe889('0x6'));var config=require(_0xe889('0x7'));var controller=require(_0xe889('0x8'));router[_0xe889('0x9')]('/',auth[_0xe889('0xa')](),controller[_0xe889('0xb')]);router[_0xe889('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe889('0x9')](_0xe889('0xc'),auth[_0xe889('0xa')](),controller[_0xe889('0xd')]);router[_0xe889('0x9')](_0xe889('0xe'),auth[_0xe889('0xa')](),controller[_0xe889('0xf')]);router[_0xe889('0x9')](_0xe889('0x10'),auth[_0xe889('0xa')](),timeout(_0xe889('0x11')),controller[_0xe889('0x12')]);router[_0xe889('0x13')]('/',auth[_0xe889('0xa')](),controller[_0xe889('0x14')]);router[_0xe889('0x13')](_0xe889('0x15'),auth[_0xe889('0xa')](),controller[_0xe889('0x16')]);router[_0xe889('0x17')]('/:id',auth[_0xe889('0xa')](),controller[_0xe889('0x18')]);router[_0xe889('0x19')](_0xe889('0x1a'),auth['isAuthenticated'](),controller[_0xe889('0x1b')]);module[_0xe889('0x1c')]=router; \ No newline at end of file +var _0xdfae=['destroy','util','connect-timeout','express','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','/:id/clone','clone','put','update','delete'];(function(_0x548efe,_0x15a90c){var _0x269b5c=function(_0x2e80a4){while(--_0x2e80a4){_0x548efe['push'](_0x548efe['shift']());}};_0x269b5c(++_0x15a90c);}(_0xdfae,0x18d));var _0xedfa=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0xdfae[_0x175a55];return _0x167adf;};'use strict';var multer=require('multer');var util=require(_0xedfa('0x0'));var path=require('path');var timeout=require(_0xedfa('0x1'));var express=require(_0xedfa('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xedfa('0x3'));var controller=require(_0xedfa('0x4'));router[_0xedfa('0x5')]('/',auth[_0xedfa('0x6')](),controller[_0xedfa('0x7')]);router[_0xedfa('0x5')](_0xedfa('0x8'),auth[_0xedfa('0x6')](),controller[_0xedfa('0x9')]);router[_0xedfa('0x5')](_0xedfa('0xa'),auth[_0xedfa('0x6')](),controller[_0xedfa('0xb')]);router[_0xedfa('0x5')](_0xedfa('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xedfa('0x5')](_0xedfa('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router[_0xedfa('0xe')]('/',auth[_0xedfa('0x6')](),controller[_0xedfa('0xf')]);router[_0xedfa('0xe')](_0xedfa('0x10'),auth[_0xedfa('0x6')](),controller[_0xedfa('0x11')]);router[_0xedfa('0x12')](_0xedfa('0x8'),auth[_0xedfa('0x6')](),controller[_0xedfa('0x13')]);router[_0xedfa('0x14')](_0xedfa('0x8'),auth[_0xedfa('0x6')](),controller[_0xedfa('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ca49469..93d6447 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 _0x6e64=['description','BOOLEAN','sequelize','lodash','util','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','getDataValue'];(function(_0x2790d3,_0x13c132){var _0x3fc78e=function(_0x53b020){while(--_0x53b020){_0x2790d3['push'](_0x2790d3['shift']());}};_0x3fc78e(++_0x13c132);}(_0x6e64,0xac));var _0x46e6=function(_0x242b31,_0x103ab5){_0x242b31=_0x242b31-0x0;var _0x2645ea=_0x6e64[_0x242b31];return _0x2645ea;};'use strict';var Sequelize=require(_0x46e6('0x0'));var _=require(_0x46e6('0x1'));var util=require(_0x46e6('0x2'));module[_0x46e6('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x46e6('0x4')},'description':{'type':Sequelize[_0x46e6('0x5')]},'formData':{'type':Sequelize[_0x46e6('0x6')](_0x46e6('0x7')),'set':function(_0x400130){if(_[_0x46e6('0x8')](_0x400130)){this[_0x46e6('0x9')]('formData',JSON[_0x46e6('0xa')](_0x400130));}else if(_[_0x46e6('0xb')](_0x400130)){this['setDataValue'](_0x46e6('0xc'),_0x400130);}else{this[_0x46e6('0x9')]('formData',util[_0x46e6('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x46e6('0x4'))||'',this[_0x46e6('0xe')](_0x46e6('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x46e6('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x7dd0=['STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','description','BOOLEAN','sequelize','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7dd0,0x15e));var _0x07dd=function(_0x3c95dd,_0x1ea377){_0x3c95dd=_0x3c95dd-0x0;var _0x29b69b=_0x7dd0[_0x3c95dd];return _0x29b69b;};'use strict';var Sequelize=require(_0x07dd('0x0'));var _=require('lodash');var util=require(_0x07dd('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x07dd('0x2')]},'formData':{'type':Sequelize[_0x07dd('0x3')](_0x07dd('0x4')),'set':function(_0x55e3c6){if(_[_0x07dd('0x5')](_0x55e3c6)){this[_0x07dd('0x6')](_0x07dd('0x7'),JSON[_0x07dd('0x8')](_0x55e3c6));}else if(_[_0x07dd('0x9')](_0x55e3c6)){this[_0x07dd('0x6')]('formData',_0x55e3c6);}else{this[_0x07dd('0x6')](_0x07dd('0x7'),util[_0x07dd('0xa')](_0x07dd('0xb'),this['getDataValue'](_0x07dd('0xc'))||'',this[_0x07dd('0xd')](_0x07dd('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x07dd('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2fbc549..0e2af2c 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 _0xbea3=['Projects','UserProfileResource','destroy','end','error','stack','name','send','index','map','JscriptyProject','type','key','model','query','keys','filters','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','role','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','startTime','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','apply','reject','update','then'];(function(_0xd1e54b,_0x22673f){var _0x25ea86=function(_0x44a337){while(--_0x44a337){_0xd1e54b['push'](_0xd1e54b['shift']());}};_0x25ea86(++_0x22673f);}(_0xbea3,0x139));var _0x3bea=function(_0xfbcd43,_0x1c8289){_0xfbcd43=_0xfbcd43-0x0;var _0x1ba9db=_0xbea3[_0xfbcd43];return _0x1ba9db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3bea('0x0'));var rimraf=require(_0x3bea('0x1'));var zipdir=require(_0x3bea('0x2'));var jsonpatch=require(_0x3bea('0x3'));var rp=require('request-promise');var moment=require(_0x3bea('0x4'));var BPromise=require(_0x3bea('0x5'));var Mustache=require(_0x3bea('0x6'));var util=require(_0x3bea('0x7'));var path=require(_0x3bea('0x8'));var sox=require('sox');var csv=require(_0x3bea('0x9'));var ejs=require(_0x3bea('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3bea('0xb'));var jsforce=require(_0x3bea('0xc'));var deskjs=require(_0x3bea('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3bea('0xe'));var Redis=require(_0x3bea('0xf'));var authService=require(_0x3bea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3bea('0x11'));var hardwareService=require(_0x3bea('0x12'));var logger=require('../../config/logger')(_0x3bea('0x13'));var utils=require(_0x3bea('0x14'));var config=require(_0x3bea('0x15'));var db=require(_0x3bea('0x16'))['db'];function respondWithStatusCode(_0x38ee11,_0x23a7ed){_0x23a7ed=_0x23a7ed||0xcc;return function(_0x1de13a){if(_0x1de13a){return _0x38ee11['sendStatus'](_0x23a7ed);}return _0x38ee11[_0x3bea('0x17')](_0x23a7ed)['end']();};}function respondWithResult(_0x5f4198,_0x2266ca){_0x2266ca=_0x2266ca||0xc8;return function(_0x4d74e2){if(_0x4d74e2){return _0x5f4198[_0x3bea('0x17')](_0x2266ca)[_0x3bea('0x18')](_0x4d74e2);}};}function respondWithFilteredResult(_0x26b287,_0x4d0370){return function(_0x47d96e){if(_0x47d96e){var _0x3d5d72=_0x47d96e['count'],_0x550e75=_0x4d0370[_0x3bea('0x19')],_0x287f2f=_0x4d0370['offset']+_0x4d0370['limit'],_0x291f5f;if(_0x287f2f>=_0x3d5d72){_0x287f2f=_0x3d5d72;_0x291f5f=0xc8;}else{_0x291f5f=0xce;}_0x26b287['status'](_0x291f5f);return _0x26b287[_0x3bea('0x1a')](_0x3bea('0x1b'),_0x550e75+'-'+_0x287f2f+'/'+_0x3d5d72)[_0x3bea('0x18')](_0x47d96e);}return null;};}function patchUpdates(_0x4eae21){return function(_0x5a0df9){try{jsonpatch[_0x3bea('0x1c')](_0x5a0df9,_0x4eae21,!![]);}catch(_0x138f5b){return BPromise[_0x3bea('0x1d')](_0x138f5b);}return _0x5a0df9['save']();};}function saveUpdates(_0x233030,_0x21322d){return function(_0x519c3e){if(_0x519c3e){return _0x519c3e[_0x3bea('0x1e')](_0x233030)[_0x3bea('0x1f')](function(_0x4d6c81){return _0x4d6c81;});}return null;};}function removeEntity(_0x33079e,_0x450307){return function(_0x38994b){if(_0x38994b){return _0x38994b['destroy']()[_0x3bea('0x1f')](function(){var _0xa7c7f2=_0x38994b['get']({'plain':!![]});var _0x54b9d8=_0x3bea('0x20');return db[_0x3bea('0x21')][_0x3bea('0x22')]({'where':{'type':_0x54b9d8,'resourceId':_0xa7c7f2['id']}})[_0x3bea('0x1f')](function(){return _0x38994b;});})[_0x3bea('0x1f')](function(){_0x33079e[_0x3bea('0x17')](0xcc)[_0x3bea('0x23')]();});}};}function handleEntityNotFound(_0x2b0186,_0x40fa7b){return function(_0x3b753a){if(!_0x3b753a){_0x2b0186['sendStatus'](0x194);}return _0x3b753a;};}function handleError(_0x4fdd1e,_0x23d80b){_0x23d80b=_0x23d80b||0x1f4;return function(_0x16aa3d){logger[_0x3bea('0x24')](_0x16aa3d[_0x3bea('0x25')]);if(_0x16aa3d[_0x3bea('0x26')]){delete _0x16aa3d[_0x3bea('0x26')];}_0x4fdd1e['status'](_0x23d80b)[_0x3bea('0x27')](_0x16aa3d);};}exports[_0x3bea('0x28')]=function(_0x2f941f,_0x10ae17){var _0x29c53e={},_0x219e0d={},_0x59c05e={'count':0x0,'rows':[]};var _0x4c3df8=_[_0x3bea('0x29')](db[_0x3bea('0x2a')]['rawAttributes'],function(_0x12e7d6){return{'name':_0x12e7d6['fieldName'],'type':_0x12e7d6[_0x3bea('0x2b')][_0x3bea('0x2c')]};});_0x219e0d[_0x3bea('0x2d')]=_['map'](_0x4c3df8,_0x3bea('0x26'));_0x219e0d[_0x3bea('0x2e')]=_[_0x3bea('0x2f')](_0x2f941f[_0x3bea('0x2e')]);_0x219e0d[_0x3bea('0x30')]=_['intersection'](_0x219e0d[_0x3bea('0x2d')],_0x219e0d[_0x3bea('0x2e')]);_0x29c53e['attributes']=_['intersection'](_0x219e0d['model'],qs[_0x3bea('0x31')](_0x2f941f[_0x3bea('0x2e')][_0x3bea('0x31')]));_0x29c53e[_0x3bea('0x32')]=_0x29c53e[_0x3bea('0x32')][_0x3bea('0x33')]?_0x29c53e[_0x3bea('0x32')]:_0x219e0d['model'];if(!_0x2f941f[_0x3bea('0x2e')]['hasOwnProperty'](_0x3bea('0x34'))){_0x29c53e[_0x3bea('0x35')]=qs[_0x3bea('0x35')](_0x2f941f[_0x3bea('0x2e')]['limit']);_0x29c53e[_0x3bea('0x19')]=qs[_0x3bea('0x19')](_0x2f941f['query'][_0x3bea('0x19')]);}_0x29c53e[_0x3bea('0x36')]=qs[_0x3bea('0x37')](_0x2f941f[_0x3bea('0x2e')][_0x3bea('0x37')]);_0x29c53e[_0x3bea('0x38')]=qs[_0x3bea('0x30')](_['pick'](_0x2f941f[_0x3bea('0x2e')],_0x219e0d['filters']),_0x4c3df8);if(_0x2f941f[_0x3bea('0x2e')][_0x3bea('0x39')]){_0x29c53e[_0x3bea('0x38')]=_[_0x3bea('0x3a')](_0x29c53e['where'],{'$or':_[_0x3bea('0x29')](_0x4c3df8,function(_0x407470){if(_0x407470[_0x3bea('0x2b')]!==_0x3bea('0x3b')){var _0x33d7e3={};_0x33d7e3[_0x407470[_0x3bea('0x26')]]={'$like':'%'+_0x2f941f['query'][_0x3bea('0x39')]+'%'};return _0x33d7e3;}})});}_0x29c53e=_[_0x3bea('0x3a')]({},_0x29c53e,_0x2f941f[_0x3bea('0x3c')]);var _0x538b00={'where':_0x29c53e[_0x3bea('0x38')]};return db[_0x3bea('0x2a')]['count'](_0x538b00)[_0x3bea('0x1f')](function(_0x599c19){_0x59c05e[_0x3bea('0x3d')]=_0x599c19;if(_0x2f941f[_0x3bea('0x2e')][_0x3bea('0x3e')]){_0x29c53e[_0x3bea('0x3f')]=[{'all':!![]}];}return db[_0x3bea('0x2a')][_0x3bea('0x40')](_0x29c53e);})[_0x3bea('0x1f')](function(_0x2811be){_0x59c05e['rows']=_0x2811be;return _0x59c05e;})[_0x3bea('0x1f')](respondWithFilteredResult(_0x10ae17,_0x29c53e))[_0x3bea('0x41')](handleError(_0x10ae17,null));};exports[_0x3bea('0x42')]=function(_0x572e8e,_0x1e4342){var _0x5ae7b7={'raw':![],'where':{'id':_0x572e8e[_0x3bea('0x43')]['id']}},_0x5c4a0f={};_0x5c4a0f[_0x3bea('0x2d')]=_[_0x3bea('0x2f')](db[_0x3bea('0x2a')][_0x3bea('0x44')]);_0x5c4a0f[_0x3bea('0x2e')]=_['keys'](_0x572e8e[_0x3bea('0x2e')]);_0x5c4a0f[_0x3bea('0x30')]=_[_0x3bea('0x45')](_0x5c4a0f[_0x3bea('0x2d')],_0x5c4a0f[_0x3bea('0x2e')]);_0x5ae7b7[_0x3bea('0x32')]=_['intersection'](_0x5c4a0f[_0x3bea('0x2d')],qs[_0x3bea('0x31')](_0x572e8e[_0x3bea('0x2e')][_0x3bea('0x31')]));_0x5ae7b7[_0x3bea('0x32')]=_0x5ae7b7[_0x3bea('0x32')][_0x3bea('0x33')]?_0x5ae7b7[_0x3bea('0x32')]:_0x5c4a0f[_0x3bea('0x2d')];if(_0x572e8e['query'][_0x3bea('0x3e')]){_0x5ae7b7['include']=[{'all':!![]}];}_0x5ae7b7=_['merge']({},_0x5ae7b7,_0x572e8e['options']);return db[_0x3bea('0x2a')]['find'](_0x5ae7b7)[_0x3bea('0x1f')](handleEntityNotFound(_0x1e4342,null))[_0x3bea('0x1f')](respondWithResult(_0x1e4342,null))['catch'](handleError(_0x1e4342,null));};exports[_0x3bea('0x46')]=function(_0x476c86,_0x28bb8e){return db[_0x3bea('0x2a')][_0x3bea('0x46')](_0x476c86[_0x3bea('0x47')],{})[_0x3bea('0x1f')](function(_0x3d6a54){var _0x5bf724=_0x476c86[_0x3bea('0x48')][_0x3bea('0x49')]({'plain':!![]});if(!_0x5bf724)throw new Error(_0x3bea('0x4a'));if(_0x5bf724['role']===_0x3bea('0x48')){var _0x366de7=_0x3d6a54[_0x3bea('0x49')]({'plain':!![]});var _0x464bf3='Projects';return db[_0x3bea('0x4b')][_0x3bea('0x4c')]({'where':{'name':_0x464bf3,'userProfileId':_0x5bf724[_0x3bea('0x4d')]},'raw':!![]})['then'](function(_0x155589){if(_0x155589&&_0x155589[_0x3bea('0x4e')]===0x0){return db[_0x3bea('0x21')][_0x3bea('0x46')]({'name':_0x366de7['name'],'resourceId':_0x366de7['id'],'type':_0x155589[_0x3bea('0x26')],'sectionId':_0x155589['id']},{})[_0x3bea('0x1f')](function(){return _0x3d6a54;});}else{return _0x3d6a54;}})[_0x3bea('0x41')](function(_0x47f205){logger[_0x3bea('0x24')](_0x3bea('0x4f'),_0x47f205);throw _0x47f205;});}return _0x3d6a54;})[_0x3bea('0x1f')](respondWithResult(_0x28bb8e,0xc9))[_0x3bea('0x41')](handleError(_0x28bb8e,null));};exports[_0x3bea('0x50')]=function(_0x47b2b2,_0x3328c7){var _0x4af236={'where':{'id':_0x47b2b2['params']['id']}},_0x44b21c={};_0x44b21c[_0x3bea('0x2d')]=_[_0x3bea('0x2f')](db[_0x3bea('0x2a')][_0x3bea('0x44')]);_0x4af236[_0x3bea('0x32')]=_[_0x3bea('0x45')](_0x44b21c[_0x3bea('0x2d')],qs['fields'](_0x47b2b2[_0x3bea('0x2e')]['fields']));_0x4af236[_0x3bea('0x32')]=_0x4af236[_0x3bea('0x32')]['length']?_0x4af236[_0x3bea('0x32')]:_0x44b21c[_0x3bea('0x2d')];if(_0x47b2b2[_0x3bea('0x2e')][_0x3bea('0x3e')]){_0x4af236[_0x3bea('0x3f')]=[{'all':!![]}];}_0x4af236=_[_0x3bea('0x3a')]({},_0x4af236,_0x47b2b2[_0x3bea('0x3c')]);return db[_0x3bea('0x2a')][_0x3bea('0x4c')](_0x4af236)[_0x3bea('0x1f')](handleEntityNotFound(_0x3328c7,null))[_0x3bea('0x1f')](function(_0x45d9df){if(_0x45d9df){var _0x4474a6=_0x45d9df['get']({'plain':!![]});_0x4474a6=qs[_0x3bea('0x51')](_0x4474a6,['id','createdAt',_0x3bea('0x52')]);_0x47b2b2['body']=_[_0x3bea('0x51')](_0x47b2b2[_0x3bea('0x47')],['id',_0x3bea('0x53'),_0x3bea('0x52')]);return db[_0x3bea('0x2a')][_0x3bea('0x46')](_[_0x3bea('0x3a')](_0x4474a6,_0x47b2b2[_0x3bea('0x47')]),{'include':_0x47b2b2['query'][_0x3bea('0x3e')]?[{'all':!![]}]:undefined})[_0x3bea('0x1f')](function(_0x11c24b){var _0x473692=_0x47b2b2['user'][_0x3bea('0x49')]({'plain':!![]});if(!_0x473692)throw new Error(_0x3bea('0x4a'));if(_0x473692[_0x3bea('0x54')]===_0x3bea('0x48')){var _0x33a20f=_0x11c24b['get']({'plain':!![]});var _0x1e80e8=_0x3bea('0x20');return db[_0x3bea('0x4b')][_0x3bea('0x4c')]({'where':{'name':_0x1e80e8,'userProfileId':_0x473692[_0x3bea('0x4d')]},'raw':!![]})['then'](function(_0xe10886){if(_0xe10886&&_0xe10886['autoAssociation']===0x0){return db[_0x3bea('0x21')]['create']({'name':_0x33a20f[_0x3bea('0x26')],'resourceId':_0x33a20f['id'],'type':_0xe10886[_0x3bea('0x26')],'sectionId':_0xe10886['id']},{})['then'](function(){return _0x11c24b;});}else{return _0x11c24b;}})[_0x3bea('0x41')](function(_0xf254a7){logger[_0x3bea('0x24')](_0x3bea('0x4f'),_0xf254a7);throw _0xf254a7;});}return _0x11c24b;});}})['then'](respondWithResult(_0x3328c7,0xc9))[_0x3bea('0x41')](handleError(_0x3328c7,null));};exports['update']=function(_0x45e5a0,_0x2a8c26){if(_0x45e5a0[_0x3bea('0x47')]['id']){delete _0x45e5a0[_0x3bea('0x47')]['id'];}return db[_0x3bea('0x2a')]['find']({'where':{'id':_0x45e5a0[_0x3bea('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a8c26,null))[_0x3bea('0x1f')](saveUpdates(_0x45e5a0[_0x3bea('0x47')],null))[_0x3bea('0x1f')](respondWithResult(_0x2a8c26,null))['catch'](handleError(_0x2a8c26,null));};exports['destroy']=function(_0x3bb260,_0x4a3ce5){return db['JscriptyProject'][_0x3bea('0x4c')]({'where':{'id':_0x3bb260['params']['id']}})['then'](handleEntityNotFound(_0x4a3ce5,null))['then'](removeEntity(_0x4a3ce5,null))[_0x3bea('0x41')](handleError(_0x4a3ce5,null));};exports[_0x3bea('0x55')]=function(_0x4746c2,_0x5c2e9b,_0x43ba2b){var _0x4746ca={'raw':!![],'where':{}};var _0x55306f={};var _0x25143c={'count':0x0,'rows':[]};return db[_0x3bea('0x2a')][_0x3bea('0x56')]({'where':{'id':_0x4746c2[_0x3bea('0x43')]['id']}})[_0x3bea('0x1f')](handleEntityNotFound(_0x5c2e9b,null))[_0x3bea('0x1f')](function(_0x3caf4d){if(_0x3caf4d){_0x55306f['model']=_[_0x3bea('0x2f')](db[_0x3bea('0x57')][_0x3bea('0x44')]);_0x55306f[_0x3bea('0x2e')]=_[_0x3bea('0x2f')](_0x4746c2[_0x3bea('0x2e')]);_0x55306f[_0x3bea('0x30')]=_[_0x3bea('0x45')](_0x55306f['model'],_0x55306f[_0x3bea('0x2e')]);_0x4746ca['attributes']=_['intersection'](_0x55306f[_0x3bea('0x2d')],qs[_0x3bea('0x31')](_0x4746c2[_0x3bea('0x2e')][_0x3bea('0x31')]));_0x4746ca[_0x3bea('0x32')]=_0x4746ca['attributes']['length']?_0x4746ca[_0x3bea('0x32')]:_0x55306f[_0x3bea('0x2d')];if(!_0x4746c2[_0x3bea('0x2e')][_0x3bea('0x58')](_0x3bea('0x34'))){_0x4746ca[_0x3bea('0x35')]=qs[_0x3bea('0x35')](_0x4746c2['query']['limit']);_0x4746ca[_0x3bea('0x19')]=qs[_0x3bea('0x19')](_0x4746c2[_0x3bea('0x2e')]['offset']);}_0x4746ca[_0x3bea('0x36')]=qs[_0x3bea('0x37')](_0x4746c2[_0x3bea('0x2e')][_0x3bea('0x37')]);_0x4746ca[_0x3bea('0x38')]=qs[_0x3bea('0x30')](_[_0x3bea('0x59')](_0x4746c2[_0x3bea('0x2e')],_0x55306f[_0x3bea('0x30')]));_0x4746ca[_0x3bea('0x38')][_0x3bea('0x5a')]=_0x3caf4d['id'];if(_0x4746c2[_0x3bea('0x2e')]['filter']){_0x4746ca[_0x3bea('0x38')]=_[_0x3bea('0x3a')](_0x4746ca[_0x3bea('0x38')],{'$or':_[_0x3bea('0x29')](_0x4746ca[_0x3bea('0x32')],function(_0x4cc11f){var _0x55f8f5={};_0x55f8f5[_0x4cc11f]={'$like':'%'+_0x4746c2[_0x3bea('0x2e')]['filter']+'%'};return _0x55f8f5;})});}_0x4746ca=_['merge']({},_0x4746ca,_0x4746c2['options']);return db['JscriptySessionReport'][_0x3bea('0x3d')]({'where':_0x4746ca['where']})['then'](function(_0x1f926c){_0x25143c['count']=_0x1f926c;if(_0x4746c2[_0x3bea('0x2e')][_0x3bea('0x3e')]){_0x4746ca[_0x3bea('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3bea('0x40')](_0x4746ca);})[_0x3bea('0x1f')](function(_0x1ad8c5){_0x25143c[_0x3bea('0x5b')]=_0x1ad8c5;return _0x25143c;});}})[_0x3bea('0x1f')](respondWithFilteredResult(_0x5c2e9b,_0x4746ca))[_0x3bea('0x41')](handleError(_0x5c2e9b,null));};exports[_0x3bea('0x5c')]=function(_0x37a2e6,_0x35eaa8,_0xaa1187){var _0x30fdd2={'raw':!![],'where':{}};var _0x58b4b5={};var _0x341025={'count':0x0,'rows':[]};return db[_0x3bea('0x2a')]['findOne']({'where':{'id':_0x37a2e6[_0x3bea('0x43')]['id']}})['then'](handleEntityNotFound(_0x35eaa8,null))[_0x3bea('0x1f')](function(_0x23045c){if(_0x23045c){_0x58b4b5[_0x3bea('0x2d')]=_['keys'](db[_0x3bea('0x5d')][_0x3bea('0x44')]);_0x58b4b5[_0x3bea('0x2e')]=_[_0x3bea('0x2f')](_0x37a2e6[_0x3bea('0x2e')]);_0x58b4b5[_0x3bea('0x30')]=_[_0x3bea('0x45')](_0x58b4b5[_0x3bea('0x2d')],_0x58b4b5['query']);_0x30fdd2[_0x3bea('0x32')]=_['intersection'](_0x58b4b5['model'],qs['fields'](_0x37a2e6[_0x3bea('0x2e')][_0x3bea('0x31')]));_0x30fdd2[_0x3bea('0x32')]=_0x30fdd2[_0x3bea('0x32')][_0x3bea('0x33')]?_0x30fdd2['attributes']:_0x58b4b5[_0x3bea('0x2d')];if(!_0x37a2e6[_0x3bea('0x2e')][_0x3bea('0x58')](_0x3bea('0x34'))){_0x30fdd2['limit']=qs[_0x3bea('0x35')](_0x37a2e6[_0x3bea('0x2e')]['limit']);_0x30fdd2[_0x3bea('0x19')]=qs[_0x3bea('0x19')](_0x37a2e6[_0x3bea('0x2e')][_0x3bea('0x19')]);}_0x30fdd2[_0x3bea('0x36')]=qs['sort'](_0x37a2e6[_0x3bea('0x2e')]['sort']);_0x30fdd2[_0x3bea('0x38')]=qs[_0x3bea('0x30')](_['pick'](_0x37a2e6[_0x3bea('0x2e')],_0x58b4b5['filters']));_0x30fdd2[_0x3bea('0x38')]['ProjectId']=_0x23045c['id'];if(_0x37a2e6[_0x3bea('0x2e')][_0x3bea('0x39')]){_0x30fdd2[_0x3bea('0x38')]=_[_0x3bea('0x3a')](_0x30fdd2[_0x3bea('0x38')],{'$or':_[_0x3bea('0x29')](_0x30fdd2['attributes'],function(_0x37cc5d){var _0x46dea0={};_0x46dea0[_0x37cc5d]={'$like':'%'+_0x37a2e6['query'][_0x3bea('0x39')]+'%'};return _0x46dea0;})});}_0x30fdd2=_[_0x3bea('0x3a')]({},_0x30fdd2,_0x37a2e6[_0x3bea('0x3c')]);return db[_0x3bea('0x5d')]['count']({'where':_0x30fdd2[_0x3bea('0x38')]})[_0x3bea('0x1f')](function(_0xc20a6c){_0x341025[_0x3bea('0x3d')]=_0xc20a6c;if(_0x37a2e6['query'][_0x3bea('0x3e')]){_0x30fdd2[_0x3bea('0x3f')]=[{'all':!![]}];}return db[_0x3bea('0x5d')]['findAll'](_0x30fdd2);})[_0x3bea('0x1f')](function(_0x409106){_0x341025[_0x3bea('0x5b')]=_0x409106;return _0x341025;});}})[_0x3bea('0x1f')](respondWithFilteredResult(_0x35eaa8,_0x30fdd2))[_0x3bea('0x41')](handleError(_0x35eaa8,null));};function char(_0x26f51f){return _0x3bea('0x5e')===typeof _0x26f51f?String[_0x3bea('0x5f')][_0x3bea('0x1c')](null,arguments):_0x26f51f;}function needsEncapsulation(_0xfb4698){return!!_0xfb4698&&(_0xfb4698[_0x3bea('0x60')]()['indexOf'](char(0xd))>=0x0||_0xfb4698['toString']()['indexOf'](char(0xa))>=0x0||_0xfb4698[_0x3bea('0x60')]()['indexOf'](char(0x2c))>=0x0||_0xfb4698['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x383736){var _0x42ee49=char(0x22),_0x2daa74='\x5c'+char(0x22),_0x572747=_0x383736[_0x3bea('0x60')]()['replace'](new RegExp(_0x42ee49,'g'),_0x2daa74);return _0x42ee49+_0x572747+_0x42ee49;}exports['getSummary']=function(_0x1144be,_0x152fda,_0x530042){var _0x2f7db5,_0x1b049a;var _0x1d72e6={'where':{'ProjectId':_0x1144be['params']['id']}};if(_0x1144be[_0x3bea('0x2e')][_0x3bea('0x61')]){_0x1d72e6[_0x3bea('0x38')]['starttime']=JSON['parse'](_0x1144be[_0x3bea('0x2e')][_0x3bea('0x61')]);}return db[_0x3bea('0x57')][_0x3bea('0x40')](_0x1d72e6)[_0x3bea('0x1f')](handleEntityNotFound(_0x152fda,null))['then'](function(_0x563e87){if(_0x563e87){_0x2f7db5=_0x563e87;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x3bea('0x29')](_0x2f7db5,'id')},'ProjectId':_0x1144be[_0x3bea('0x43')]['id']},'order':_0x3bea('0x62')});}})[_0x3bea('0x1f')](handleEntityNotFound(_0x152fda,null))['then'](function(_0x10eae1){if(_0x10eae1){_0x1b049a=_0x10eae1;var _0x234471={};for(var _0x2acaf9=0x0,_0x421b7d=_0x1b049a[_0x3bea('0x33')];_0x2acaf9<_0x421b7d;_0x2acaf9++){if(!_0x234471[_0x3bea('0x58')](_0x1b049a[_0x2acaf9][_0x3bea('0x63')])){_0x234471[_0x1b049a[_0x2acaf9]['questionId']]=needsEncapsulation(_0x1b049a[_0x2acaf9]['question'])?encapsulate(_0x1b049a[_0x2acaf9][_0x3bea('0x64')]):_0x1b049a[_0x2acaf9][_0x3bea('0x64')];}}var _0x460a5b=[],_0x5d8a6e={};for(var _0x3bbd81=0x0,_0x186dc5=_0x2f7db5[_0x3bea('0x33')];_0x3bbd81<_0x186dc5;_0x3bbd81++){_0x5d8a6e={'ProjectId':_0x1144be[_0x3bea('0x43')]['id'],'SessionId':_0x2f7db5[_0x3bbd81]['id'],'StartTime':moment(_0x2f7db5[_0x3bbd81][_0x3bea('0x65')])[_0x3bea('0x66')](_0x3bea('0x67'))};for(var _0x550764=0x0,_0x3910ea=_0x1b049a[_0x3bea('0x33')];_0x550764<_0x3910ea;_0x550764++){if(_0x1b049a[_0x550764]['SessionId']==_0x2f7db5[_0x3bbd81]['id']&&_0x234471[_0x3bea('0x58')](_0x1b049a[_0x550764][_0x3bea('0x63')])){_0x5d8a6e[_0x234471[_0x1b049a[_0x550764]['questionId']]]=_0x1b049a[_0x550764]['answer'];}}for(var _0x3ebae1 in _0x234471){if(!_0x5d8a6e[_0x3bea('0x58')](_0x234471[_0x3ebae1])){_0x5d8a6e[_0x234471[_0x3ebae1]]=null;}}_0x460a5b[_0x3bea('0x68')](_0x5d8a6e);}return _0x460a5b;}})['then'](function(_0x3f6ad9){if(!_[_0x3bea('0x69')](_0x3f6ad9)){var _0x44226f=toCsv(_0x3f6ad9);var _0x1a30b6=Date[_0x3bea('0x6a')]();fs['writeFileSync'](util[_0x3bea('0x66')](_0x3bea('0x6b'),_0x1144be[_0x3bea('0x43')]['id'],_0x1a30b6),_0x44226f);_0x152fda[_0x3bea('0x6c')](_0x3bea('0x6d'),'attachment;\x20filename='+util[_0x3bea('0x66')](_0x3bea('0x6e'),_0x1144be[_0x3bea('0x43')]['id'],_0x1a30b6));_0x152fda[_0x3bea('0x6c')](_0x3bea('0x6f'),_0x3bea('0x70'));return _0x152fda[_0x3bea('0x71')](util[_0x3bea('0x66')](_0x3bea('0x6b'),_0x1144be[_0x3bea('0x43')]['id'],_0x1a30b6));}else{return _0x152fda[_0x3bea('0x72')](0xcc);}})[_0x3bea('0x41')](handleError(_0x152fda,null));}; \ No newline at end of file +var _0x91c4=['JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/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','reject','save','update','then','Projects','UserProfileResource','destroy','error','name','send','index','JscriptyProject','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getSessions','findOne','JscriptySessionReport'];(function(_0x15bcce,_0x237a80){var _0x242d2e=function(_0x14bd98){while(--_0x14bd98){_0x15bcce['push'](_0x15bcce['shift']());}};_0x242d2e(++_0x237a80);}(_0x91c4,0x96));var _0x491c=function(_0x350a33,_0x7fe9be){_0x350a33=_0x350a33-0x0;var _0x22dc3e=_0x91c4[_0x350a33];return _0x22dc3e;};'use strict';var pdf=require(_0x491c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x491c('0x1'));var zipdir=require(_0x491c('0x2'));var jsonpatch=require(_0x491c('0x3'));var rp=require(_0x491c('0x4'));var moment=require(_0x491c('0x5'));var BPromise=require(_0x491c('0x6'));var Mustache=require(_0x491c('0x7'));var util=require(_0x491c('0x8'));var path=require('path');var sox=require(_0x491c('0x9'));var csv=require(_0x491c('0xa'));var ejs=require(_0x491c('0xb'));var fs=require('fs');var _=require(_0x491c('0xc'));var squel=require(_0x491c('0xd'));var crypto=require('crypto');var jsforce=require(_0x491c('0xe'));var deskjs=require(_0x491c('0xf'));var toCsv=require(_0x491c('0xa'));var querystring=require(_0x491c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x491c('0x11'));var qs=require(_0x491c('0x12'));var as=require(_0x491c('0x13'));var hardwareService=require(_0x491c('0x14'));var logger=require(_0x491c('0x15'))('api');var utils=require(_0x491c('0x16'));var config=require(_0x491c('0x17'));var db=require(_0x491c('0x18'))['db'];function respondWithStatusCode(_0x17a72b,_0x325588){_0x325588=_0x325588||0xcc;return function(_0x4f03ff){if(_0x4f03ff){return _0x17a72b[_0x491c('0x19')](_0x325588);}return _0x17a72b[_0x491c('0x1a')](_0x325588)[_0x491c('0x1b')]();};}function respondWithResult(_0x216ee7,_0x41624b){_0x41624b=_0x41624b||0xc8;return function(_0x437916){if(_0x437916){return _0x216ee7[_0x491c('0x1a')](_0x41624b)['json'](_0x437916);}};}function respondWithFilteredResult(_0x50741a,_0x14620f){return function(_0x53583a){if(_0x53583a){var _0x420dcd=_0x53583a[_0x491c('0x1c')],_0x4fa721=_0x14620f['offset'],_0x239786=_0x14620f[_0x491c('0x1d')]+_0x14620f[_0x491c('0x1e')],_0x24c125;if(_0x239786>=_0x420dcd){_0x239786=_0x420dcd;_0x24c125=0xc8;}else{_0x24c125=0xce;}_0x50741a[_0x491c('0x1a')](_0x24c125);return _0x50741a[_0x491c('0x1f')](_0x491c('0x20'),_0x4fa721+'-'+_0x239786+'/'+_0x420dcd)[_0x491c('0x21')](_0x53583a);}return null;};}function patchUpdates(_0x415715){return function(_0x148043){try{jsonpatch[_0x491c('0x22')](_0x148043,_0x415715,!![]);}catch(_0x16e5ca){return BPromise[_0x491c('0x23')](_0x16e5ca);}return _0x148043[_0x491c('0x24')]();};}function saveUpdates(_0x2388ef,_0x58541b){return function(_0x1a937f){if(_0x1a937f){return _0x1a937f[_0x491c('0x25')](_0x2388ef)['then'](function(_0x500708){return _0x500708;});}return null;};}function removeEntity(_0x510d03,_0x5ae7ae){return function(_0x4b50a7){if(_0x4b50a7){return _0x4b50a7['destroy']()[_0x491c('0x26')](function(){var _0x2faaa4=_0x4b50a7['get']({'plain':!![]});var _0x1b4bf0=_0x491c('0x27');return db[_0x491c('0x28')][_0x491c('0x29')]({'where':{'type':_0x1b4bf0,'resourceId':_0x2faaa4['id']}})[_0x491c('0x26')](function(){return _0x4b50a7;});})['then'](function(){_0x510d03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3668c0,_0xdaf517){return function(_0x5c26df){if(!_0x5c26df){_0x3668c0['sendStatus'](0x194);}return _0x5c26df;};}function handleError(_0x52b759,_0x32fcdd){_0x32fcdd=_0x32fcdd||0x1f4;return function(_0xeb3d82){logger[_0x491c('0x2a')](_0xeb3d82['stack']);if(_0xeb3d82[_0x491c('0x2b')]){delete _0xeb3d82['name'];}_0x52b759['status'](_0x32fcdd)[_0x491c('0x2c')](_0xeb3d82);};}exports[_0x491c('0x2d')]=function(_0x198be4,_0x33e283){var _0x42aa7b={},_0x4e9508={},_0x199fcb={'count':0x0,'rows':[]};var _0x18bb18=_['map'](db[_0x491c('0x2e')][_0x491c('0x2f')],function(_0x2a643f){return{'name':_0x2a643f[_0x491c('0x30')],'type':_0x2a643f['type'][_0x491c('0x31')]};});_0x4e9508[_0x491c('0x32')]=_[_0x491c('0x33')](_0x18bb18,'name');_0x4e9508['query']=_[_0x491c('0x34')](_0x198be4[_0x491c('0x35')]);_0x4e9508['filters']=_[_0x491c('0x36')](_0x4e9508['model'],_0x4e9508[_0x491c('0x35')]);_0x42aa7b[_0x491c('0x37')]=_[_0x491c('0x36')](_0x4e9508[_0x491c('0x32')],qs['fields'](_0x198be4[_0x491c('0x35')][_0x491c('0x38')]));_0x42aa7b[_0x491c('0x37')]=_0x42aa7b[_0x491c('0x37')][_0x491c('0x39')]?_0x42aa7b['attributes']:_0x4e9508[_0x491c('0x32')];if(!_0x198be4[_0x491c('0x35')][_0x491c('0x3a')](_0x491c('0x3b'))){_0x42aa7b[_0x491c('0x1e')]=qs[_0x491c('0x1e')](_0x198be4[_0x491c('0x35')][_0x491c('0x1e')]);_0x42aa7b['offset']=qs[_0x491c('0x1d')](_0x198be4[_0x491c('0x35')][_0x491c('0x1d')]);}_0x42aa7b[_0x491c('0x3c')]=qs['sort'](_0x198be4[_0x491c('0x35')][_0x491c('0x3d')]);_0x42aa7b[_0x491c('0x3e')]=qs[_0x491c('0x3f')](_[_0x491c('0x40')](_0x198be4[_0x491c('0x35')],_0x4e9508['filters']),_0x18bb18);if(_0x198be4[_0x491c('0x35')][_0x491c('0x41')]){_0x42aa7b[_0x491c('0x3e')]=_[_0x491c('0x42')](_0x42aa7b[_0x491c('0x3e')],{'$or':_[_0x491c('0x33')](_0x18bb18,function(_0xb87e54){if(_0xb87e54[_0x491c('0x43')]!=='VIRTUAL'){var _0x560f5d={};_0x560f5d[_0xb87e54[_0x491c('0x2b')]]={'$like':'%'+_0x198be4[_0x491c('0x35')][_0x491c('0x41')]+'%'};return _0x560f5d;}})});}_0x42aa7b=_[_0x491c('0x42')]({},_0x42aa7b,_0x198be4['options']);var _0x4913a3={'where':_0x42aa7b[_0x491c('0x3e')]};return db[_0x491c('0x2e')]['count'](_0x4913a3)[_0x491c('0x26')](function(_0x4b521d){_0x199fcb[_0x491c('0x1c')]=_0x4b521d;if(_0x198be4[_0x491c('0x35')]['includeAll']){_0x42aa7b[_0x491c('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0x491c('0x45')](_0x42aa7b);})[_0x491c('0x26')](function(_0x2e2490){_0x199fcb[_0x491c('0x46')]=_0x2e2490;return _0x199fcb;})['then'](respondWithFilteredResult(_0x33e283,_0x42aa7b))['catch'](handleError(_0x33e283,null));};exports[_0x491c('0x47')]=function(_0x1844e2,_0x51683b){var _0x1c4b9e={'raw':![],'where':{'id':_0x1844e2[_0x491c('0x48')]['id']}},_0x3c3335={};_0x3c3335[_0x491c('0x32')]=_[_0x491c('0x34')](db[_0x491c('0x2e')][_0x491c('0x2f')]);_0x3c3335['query']=_[_0x491c('0x34')](_0x1844e2[_0x491c('0x35')]);_0x3c3335['filters']=_['intersection'](_0x3c3335[_0x491c('0x32')],_0x3c3335[_0x491c('0x35')]);_0x1c4b9e['attributes']=_['intersection'](_0x3c3335[_0x491c('0x32')],qs[_0x491c('0x38')](_0x1844e2[_0x491c('0x35')][_0x491c('0x38')]));_0x1c4b9e[_0x491c('0x37')]=_0x1c4b9e[_0x491c('0x37')][_0x491c('0x39')]?_0x1c4b9e[_0x491c('0x37')]:_0x3c3335[_0x491c('0x32')];if(_0x1844e2[_0x491c('0x35')][_0x491c('0x49')]){_0x1c4b9e[_0x491c('0x44')]=[{'all':!![]}];}_0x1c4b9e=_['merge']({},_0x1c4b9e,_0x1844e2[_0x491c('0x4a')]);return db[_0x491c('0x2e')][_0x491c('0x4b')](_0x1c4b9e)[_0x491c('0x26')](handleEntityNotFound(_0x51683b,null))[_0x491c('0x26')](respondWithResult(_0x51683b,null))[_0x491c('0x4c')](handleError(_0x51683b,null));};exports[_0x491c('0x4d')]=function(_0x219d5a,_0xff5aa){return db[_0x491c('0x2e')]['create'](_0x219d5a[_0x491c('0x4e')],{})[_0x491c('0x26')](function(_0x39da5c){var _0x1bd77f=_0x219d5a[_0x491c('0x4f')]['get']({'plain':!![]});if(!_0x1bd77f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd77f[_0x491c('0x50')]===_0x491c('0x4f')){var _0x423cb6=_0x39da5c[_0x491c('0x51')]({'plain':!![]});var _0x6434b8=_0x491c('0x27');return db[_0x491c('0x52')][_0x491c('0x4b')]({'where':{'name':_0x6434b8,'userProfileId':_0x1bd77f[_0x491c('0x53')]},'raw':!![]})[_0x491c('0x26')](function(_0x51062f){if(_0x51062f&&_0x51062f['autoAssociation']===0x0){return db['UserProfileResource'][_0x491c('0x4d')]({'name':_0x423cb6[_0x491c('0x2b')],'resourceId':_0x423cb6['id'],'type':_0x51062f[_0x491c('0x2b')],'sectionId':_0x51062f['id']},{})['then'](function(){return _0x39da5c;});}else{return _0x39da5c;}})['catch'](function(_0x4ed3d4){logger[_0x491c('0x2a')](_0x491c('0x54'),_0x4ed3d4);throw _0x4ed3d4;});}return _0x39da5c;})[_0x491c('0x26')](respondWithResult(_0xff5aa,0xc9))[_0x491c('0x4c')](handleError(_0xff5aa,null));};exports[_0x491c('0x55')]=function(_0x56ed7c,_0x26604b){var _0x258b03={'where':{'id':_0x56ed7c[_0x491c('0x48')]['id']}},_0x144ac0={};_0x144ac0[_0x491c('0x32')]=_[_0x491c('0x34')](db[_0x491c('0x2e')][_0x491c('0x2f')]);_0x258b03[_0x491c('0x37')]=_['intersection'](_0x144ac0['model'],qs[_0x491c('0x38')](_0x56ed7c[_0x491c('0x35')]['fields']));_0x258b03[_0x491c('0x37')]=_0x258b03[_0x491c('0x37')][_0x491c('0x39')]?_0x258b03['attributes']:_0x144ac0[_0x491c('0x32')];if(_0x56ed7c[_0x491c('0x35')][_0x491c('0x49')]){_0x258b03[_0x491c('0x44')]=[{'all':!![]}];}_0x258b03=_['merge']({},_0x258b03,_0x56ed7c[_0x491c('0x4a')]);return db[_0x491c('0x2e')][_0x491c('0x4b')](_0x258b03)[_0x491c('0x26')](handleEntityNotFound(_0x26604b,null))['then'](function(_0x1b5458){if(_0x1b5458){var _0x5464ed=_0x1b5458[_0x491c('0x51')]({'plain':!![]});_0x5464ed=qs[_0x491c('0x56')](_0x5464ed,['id',_0x491c('0x57'),_0x491c('0x58')]);_0x56ed7c['body']=_['omit'](_0x56ed7c[_0x491c('0x4e')],['id',_0x491c('0x57'),'updatedAt']);return db[_0x491c('0x2e')][_0x491c('0x4d')](_[_0x491c('0x42')](_0x5464ed,_0x56ed7c[_0x491c('0x4e')]),{'include':_0x56ed7c[_0x491c('0x35')][_0x491c('0x49')]?[{'all':!![]}]:undefined})[_0x491c('0x26')](function(_0x4d484d){var _0x2bd57b=_0x56ed7c['user'][_0x491c('0x51')]({'plain':!![]});if(!_0x2bd57b)throw new Error(_0x491c('0x59'));if(_0x2bd57b[_0x491c('0x50')]===_0x491c('0x4f')){var _0x107baf=_0x4d484d[_0x491c('0x51')]({'plain':!![]});var _0xd3dfe4=_0x491c('0x27');return db[_0x491c('0x52')][_0x491c('0x4b')]({'where':{'name':_0xd3dfe4,'userProfileId':_0x2bd57b[_0x491c('0x53')]},'raw':!![]})[_0x491c('0x26')](function(_0x436c6f){if(_0x436c6f&&_0x436c6f[_0x491c('0x5a')]===0x0){return db['UserProfileResource'][_0x491c('0x4d')]({'name':_0x107baf[_0x491c('0x2b')],'resourceId':_0x107baf['id'],'type':_0x436c6f[_0x491c('0x2b')],'sectionId':_0x436c6f['id']},{})[_0x491c('0x26')](function(){return _0x4d484d;});}else{return _0x4d484d;}})[_0x491c('0x4c')](function(_0x3334a9){logger['error'](_0x491c('0x54'),_0x3334a9);throw _0x3334a9;});}return _0x4d484d;});}})[_0x491c('0x26')](respondWithResult(_0x26604b,0xc9))['catch'](handleError(_0x26604b,null));};exports['update']=function(_0x2cd141,_0x3eb755){if(_0x2cd141['body']['id']){delete _0x2cd141[_0x491c('0x4e')]['id'];}return db[_0x491c('0x2e')]['find']({'where':{'id':_0x2cd141[_0x491c('0x48')]['id']}})[_0x491c('0x26')](handleEntityNotFound(_0x3eb755,null))[_0x491c('0x26')](saveUpdates(_0x2cd141[_0x491c('0x4e')],null))[_0x491c('0x26')](respondWithResult(_0x3eb755,null))[_0x491c('0x4c')](handleError(_0x3eb755,null));};exports['destroy']=function(_0x43f351,_0x23d9f6){return db[_0x491c('0x2e')][_0x491c('0x4b')]({'where':{'id':_0x43f351[_0x491c('0x48')]['id']}})[_0x491c('0x26')](handleEntityNotFound(_0x23d9f6,null))['then'](removeEntity(_0x23d9f6,null))['catch'](handleError(_0x23d9f6,null));};exports[_0x491c('0x5b')]=function(_0xb707c6,_0x3d9c04,_0x5c3840){var _0x24ea7a={'raw':!![],'where':{}};var _0xa0f8a={};var _0x3b40f8={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x491c('0x5c')]({'where':{'id':_0xb707c6[_0x491c('0x48')]['id']}})[_0x491c('0x26')](handleEntityNotFound(_0x3d9c04,null))[_0x491c('0x26')](function(_0x18d4bb){if(_0x18d4bb){_0xa0f8a[_0x491c('0x32')]=_[_0x491c('0x34')](db['JscriptySessionReport'][_0x491c('0x2f')]);_0xa0f8a[_0x491c('0x35')]=_[_0x491c('0x34')](_0xb707c6[_0x491c('0x35')]);_0xa0f8a[_0x491c('0x3f')]=_[_0x491c('0x36')](_0xa0f8a[_0x491c('0x32')],_0xa0f8a[_0x491c('0x35')]);_0x24ea7a['attributes']=_['intersection'](_0xa0f8a[_0x491c('0x32')],qs['fields'](_0xb707c6[_0x491c('0x35')]['fields']));_0x24ea7a[_0x491c('0x37')]=_0x24ea7a[_0x491c('0x37')][_0x491c('0x39')]?_0x24ea7a[_0x491c('0x37')]:_0xa0f8a[_0x491c('0x32')];if(!_0xb707c6['query'][_0x491c('0x3a')](_0x491c('0x3b'))){_0x24ea7a[_0x491c('0x1e')]=qs[_0x491c('0x1e')](_0xb707c6['query'][_0x491c('0x1e')]);_0x24ea7a[_0x491c('0x1d')]=qs['offset'](_0xb707c6[_0x491c('0x35')]['offset']);}_0x24ea7a['order']=qs[_0x491c('0x3d')](_0xb707c6['query'][_0x491c('0x3d')]);_0x24ea7a['where']=qs[_0x491c('0x3f')](_[_0x491c('0x40')](_0xb707c6[_0x491c('0x35')],_0xa0f8a[_0x491c('0x3f')]));_0x24ea7a[_0x491c('0x3e')]['ProjectId']=_0x18d4bb['id'];if(_0xb707c6[_0x491c('0x35')][_0x491c('0x41')]){_0x24ea7a['where']=_[_0x491c('0x42')](_0x24ea7a[_0x491c('0x3e')],{'$or':_[_0x491c('0x33')](_0x24ea7a['attributes'],function(_0xdd594f){var _0x1bc552={};_0x1bc552[_0xdd594f]={'$like':'%'+_0xb707c6[_0x491c('0x35')][_0x491c('0x41')]+'%'};return _0x1bc552;})});}_0x24ea7a=_[_0x491c('0x42')]({},_0x24ea7a,_0xb707c6[_0x491c('0x4a')]);return db['JscriptySessionReport'][_0x491c('0x1c')]({'where':_0x24ea7a[_0x491c('0x3e')]})[_0x491c('0x26')](function(_0x58d450){_0x3b40f8[_0x491c('0x1c')]=_0x58d450;if(_0xb707c6[_0x491c('0x35')][_0x491c('0x49')]){_0x24ea7a[_0x491c('0x44')]=[{'all':!![]}];}return db[_0x491c('0x5d')][_0x491c('0x45')](_0x24ea7a);})[_0x491c('0x26')](function(_0xba7b81){_0x3b40f8[_0x491c('0x46')]=_0xba7b81;return _0x3b40f8;});}})[_0x491c('0x26')](respondWithFilteredResult(_0x3d9c04,_0x24ea7a))[_0x491c('0x4c')](handleError(_0x3d9c04,null));};exports['getAnswers']=function(_0x7c35a,_0x46d01d,_0x36657f){var _0x15ea98={'raw':!![],'where':{}};var _0x5bd043={};var _0x39aa70={'count':0x0,'rows':[]};return db[_0x491c('0x2e')][_0x491c('0x5c')]({'where':{'id':_0x7c35a[_0x491c('0x48')]['id']}})[_0x491c('0x26')](handleEntityNotFound(_0x46d01d,null))[_0x491c('0x26')](function(_0x5aaccd){if(_0x5aaccd){_0x5bd043[_0x491c('0x32')]=_[_0x491c('0x34')](db[_0x491c('0x5e')][_0x491c('0x2f')]);_0x5bd043[_0x491c('0x35')]=_[_0x491c('0x34')](_0x7c35a[_0x491c('0x35')]);_0x5bd043[_0x491c('0x3f')]=_[_0x491c('0x36')](_0x5bd043[_0x491c('0x32')],_0x5bd043[_0x491c('0x35')]);_0x15ea98[_0x491c('0x37')]=_['intersection'](_0x5bd043[_0x491c('0x32')],qs[_0x491c('0x38')](_0x7c35a[_0x491c('0x35')]['fields']));_0x15ea98['attributes']=_0x15ea98[_0x491c('0x37')][_0x491c('0x39')]?_0x15ea98['attributes']:_0x5bd043[_0x491c('0x32')];if(!_0x7c35a[_0x491c('0x35')][_0x491c('0x3a')](_0x491c('0x3b'))){_0x15ea98['limit']=qs[_0x491c('0x1e')](_0x7c35a['query'][_0x491c('0x1e')]);_0x15ea98[_0x491c('0x1d')]=qs[_0x491c('0x1d')](_0x7c35a[_0x491c('0x35')]['offset']);}_0x15ea98[_0x491c('0x3c')]=qs[_0x491c('0x3d')](_0x7c35a['query']['sort']);_0x15ea98[_0x491c('0x3e')]=qs[_0x491c('0x3f')](_['pick'](_0x7c35a['query'],_0x5bd043[_0x491c('0x3f')]));_0x15ea98[_0x491c('0x3e')]['ProjectId']=_0x5aaccd['id'];if(_0x7c35a['query'][_0x491c('0x41')]){_0x15ea98[_0x491c('0x3e')]=_[_0x491c('0x42')](_0x15ea98[_0x491c('0x3e')],{'$or':_[_0x491c('0x33')](_0x15ea98['attributes'],function(_0x409738){var _0x4433e6={};_0x4433e6[_0x409738]={'$like':'%'+_0x7c35a['query'][_0x491c('0x41')]+'%'};return _0x4433e6;})});}_0x15ea98=_['merge']({},_0x15ea98,_0x7c35a[_0x491c('0x4a')]);return db[_0x491c('0x5e')][_0x491c('0x1c')]({'where':_0x15ea98[_0x491c('0x3e')]})[_0x491c('0x26')](function(_0x42d6ce){_0x39aa70['count']=_0x42d6ce;if(_0x7c35a[_0x491c('0x35')][_0x491c('0x49')]){_0x15ea98[_0x491c('0x44')]=[{'all':!![]}];}return db[_0x491c('0x5e')]['findAll'](_0x15ea98);})[_0x491c('0x26')](function(_0x69e1d9){_0x39aa70[_0x491c('0x46')]=_0x69e1d9;return _0x39aa70;});}})[_0x491c('0x26')](respondWithFilteredResult(_0x46d01d,_0x15ea98))['catch'](handleError(_0x46d01d,null));};function char(_0x4947f6){return _0x491c('0x5f')===typeof _0x4947f6?String[_0x491c('0x60')][_0x491c('0x22')](null,arguments):_0x4947f6;}function needsEncapsulation(_0x29ab3d){return!!_0x29ab3d&&(_0x29ab3d[_0x491c('0x61')]()[_0x491c('0x62')](char(0xd))>=0x0||_0x29ab3d['toString']()[_0x491c('0x62')](char(0xa))>=0x0||_0x29ab3d[_0x491c('0x61')]()['indexOf'](char(0x2c))>=0x0||_0x29ab3d[_0x491c('0x61')]()[_0x491c('0x62')](char(0x22))>=0x0);}function encapsulate(_0x407049){var _0x2b0587=char(0x22),_0x1ea375='\x5c'+char(0x22),_0x2b882c=_0x407049[_0x491c('0x61')]()[_0x491c('0x63')](new RegExp(_0x2b0587,'g'),_0x1ea375);return _0x2b0587+_0x2b882c+_0x2b0587;}exports[_0x491c('0x64')]=function(_0x59a7c7,_0x9ff94b,_0x175a8f){var _0x41ea0d,_0x360ff7;var _0x461a92={'where':{'ProjectId':_0x59a7c7[_0x491c('0x48')]['id']}};if(_0x59a7c7[_0x491c('0x35')][_0x491c('0x65')]){_0x461a92[_0x491c('0x3e')][_0x491c('0x66')]=JSON[_0x491c('0x67')](_0x59a7c7[_0x491c('0x35')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x461a92)[_0x491c('0x26')](handleEntityNotFound(_0x9ff94b,null))[_0x491c('0x26')](function(_0x38541b){if(_0x38541b){_0x41ea0d=_0x38541b;return db[_0x491c('0x68')][_0x491c('0x45')]({'where':{'SessionId':{'$in':_[_0x491c('0x33')](_0x41ea0d,'id')},'ProjectId':_0x59a7c7['params']['id']},'order':_0x491c('0x69')});}})[_0x491c('0x26')](handleEntityNotFound(_0x9ff94b,null))['then'](function(_0x5d3ea9){if(_0x5d3ea9){_0x360ff7=_0x5d3ea9;var _0x308fe1={};for(var _0x1140c2=0x0,_0x389f19=_0x360ff7[_0x491c('0x39')];_0x1140c2<_0x389f19;_0x1140c2++){if(!_0x308fe1['hasOwnProperty'](_0x360ff7[_0x1140c2][_0x491c('0x6a')])){_0x308fe1[_0x360ff7[_0x1140c2][_0x491c('0x6a')]]=needsEncapsulation(_0x360ff7[_0x1140c2][_0x491c('0x6b')])?encapsulate(_0x360ff7[_0x1140c2][_0x491c('0x6b')]):_0x360ff7[_0x1140c2][_0x491c('0x6b')];}}var _0x425947=[],_0x9cb878={};for(var _0x42e909=0x0,_0x2dbef4=_0x41ea0d['length'];_0x42e909<_0x2dbef4;_0x42e909++){_0x9cb878={'ProjectId':_0x59a7c7[_0x491c('0x48')]['id'],'SessionId':_0x41ea0d[_0x42e909]['id'],'StartTime':moment(_0x41ea0d[_0x42e909][_0x491c('0x66')])['format'](_0x491c('0x6c'))};for(var _0x755356=0x0,_0x48b2fe=_0x360ff7[_0x491c('0x39')];_0x755356<_0x48b2fe;_0x755356++){if(_0x360ff7[_0x755356][_0x491c('0x6d')]==_0x41ea0d[_0x42e909]['id']&&_0x308fe1[_0x491c('0x3a')](_0x360ff7[_0x755356][_0x491c('0x6a')])){_0x9cb878[_0x308fe1[_0x360ff7[_0x755356][_0x491c('0x6a')]]]=_0x360ff7[_0x755356][_0x491c('0x6e')];}}for(var _0x3579ae in _0x308fe1){if(!_0x9cb878[_0x491c('0x3a')](_0x308fe1[_0x3579ae])){_0x9cb878[_0x308fe1[_0x3579ae]]=null;}}_0x425947[_0x491c('0x6f')](_0x9cb878);}return _0x425947;}})['then'](function(_0x2c4ee0){if(!_[_0x491c('0x70')](_0x2c4ee0)){var _0x1a8860=toCsv(_0x2c4ee0);var _0x10d31e=Date[_0x491c('0x71')]();fs[_0x491c('0x72')](util['format'](_0x491c('0x73'),_0x59a7c7[_0x491c('0x48')]['id'],_0x10d31e),_0x1a8860);_0x9ff94b[_0x491c('0x74')](_0x491c('0x75'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x59a7c7[_0x491c('0x48')]['id'],_0x10d31e));_0x9ff94b['setHeader'](_0x491c('0x76'),_0x491c('0x77'));return _0x9ff94b[_0x491c('0x78')](util[_0x491c('0x79')](_0x491c('0x73'),_0x59a7c7[_0x491c('0x48')]['id'],_0x10d31e));}else{return _0x9ff94b[_0x491c('0x19')](0xcc);}})['catch'](handleError(_0x9ff94b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9aaa34a..0a99e33 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 _0x6995=['../../config/logger','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x1d3451,_0x1f6c84){var _0x92a808=function(_0x2921f2){while(--_0x2921f2){_0x1d3451['push'](_0x1d3451['shift']());}};_0x92a808(++_0x1f6c84);}(_0x6995,0x156));var _0x5699=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6995[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5699('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5699('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5699('0x2'));var config=require(_0x5699('0x3'));var attributes=require(_0x5699('0x4'));module[_0x5699('0x5')]=function(_0xce54a4,_0x20dae4){return _0xce54a4[_0x5699('0x6')](_0x5699('0x7'),attributes,{'tableName':_0x5699('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8f0=['define','jscripty_projects','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x2b8fe5,_0x1090bb){var _0x1b251a=function(_0x13b804){while(--_0x13b804){_0x2b8fe5['push'](_0x2b8fe5['shift']());}};_0x1b251a(++_0x1090bb);}(_0xc8f0,0x16a));var _0x0c8f=function(_0x2676e0,_0x78c572){_0x2676e0=_0x2676e0-0x0;var _0x575bba=_0xc8f0[_0x2676e0];return _0x575bba;};'use strict';var _=require('lodash');var util=require(_0x0c8f('0x0'));var logger=require(_0x0c8f('0x1'))(_0x0c8f('0x2'));var moment=require('moment');var BPromise=require(_0x0c8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c8f('0x4'));var rimraf=require(_0x0c8f('0x5'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x0c8f('0x6')]=function(_0x482268,_0x4b622c){return _0x482268[_0x0c8f('0x7')]('JscriptyProject',attributes,{'tableName':_0x0c8f('0x8'),'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 68c787c..4345dd8 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 _0x1e19=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyProject,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1e19,0x11a));var _0x91e1=function(_0x5c4986,_0x5001a4){_0x5c4986=_0x5c4986-0x0;var _0x3bb2f3=_0x1e19[_0x5c4986];return _0x3bb2f3;};'use strict';var _=require(_0x91e1('0x0'));var util=require('util');var moment=require(_0x91e1('0x1'));var BPromise=require(_0x91e1('0x2'));var rs=require(_0x91e1('0x3'));var fs=require('fs');var Redis=require(_0x91e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91e1('0x5'));var logger=require(_0x91e1('0x6'))(_0x91e1('0x7'));var config=require(_0x91e1('0x8'));var jayson=require(_0x91e1('0x9'));var client=jayson[_0x91e1('0xa')][_0x91e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x224042,_0x540bf6,_0x2851f5){return new BPromise(function(_0x2e8367,_0x42be7c){return client[_0x91e1('0xc')](_0x224042,_0x2851f5)[_0x91e1('0xd')](function(_0x322ed7){logger['info'](_0x91e1('0xe'),_0x540bf6,'request\x20sent');logger[_0x91e1('0xf')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540bf6,'request\x20sent',JSON[_0x91e1('0x10')](_0x322ed7));if(_0x322ed7[_0x91e1('0x11')]){if(_0x322ed7[_0x91e1('0x11')][_0x91e1('0x12')]===0x1f4){logger[_0x91e1('0x11')](_0x91e1('0xe'),_0x540bf6,_0x322ed7['error'][_0x91e1('0x13')]);return _0x42be7c(_0x322ed7['error'][_0x91e1('0x13')]);}logger[_0x91e1('0x11')](_0x91e1('0xe'),_0x540bf6,_0x322ed7[_0x91e1('0x11')]['message']);return _0x2e8367(_0x322ed7[_0x91e1('0x11')][_0x91e1('0x13')]);}else{logger[_0x91e1('0x14')](_0x91e1('0xe'),_0x540bf6,_0x91e1('0x15'));_0x2e8367(_0x322ed7[_0x91e1('0x16')][_0x91e1('0x13')]);}})[_0x91e1('0x17')](function(_0x56a076){logger[_0x91e1('0x11')](_0x91e1('0xe'),_0x540bf6,_0x56a076);_0x42be7c(_0x56a076);});});} \ No newline at end of file +var _0x872c=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x481e35,_0x3ec80b){var _0x1dd292=function(_0x51a377){while(--_0x51a377){_0x481e35['push'](_0x481e35['shift']());}};_0x1dd292(++_0x3ec80b);}(_0x872c,0x1e1));var _0xc872=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x872c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xc872('0x0'));var util=require('util');var moment=require(_0xc872('0x1'));var BPromise=require(_0xc872('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc872('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc872('0x4'));var logger=require(_0xc872('0x5'))(_0xc872('0x6'));var config=require(_0xc872('0x7'));var jayson=require(_0xc872('0x8'));var client=jayson[_0xc872('0x9')][_0xc872('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ff3c3,_0x4cf033,_0x118018){return new BPromise(function(_0x4d2acf,_0x52b306){return client['request'](_0x5ff3c3,_0x118018)[_0xc872('0xb')](function(_0x3d8926){logger['info'](_0xc872('0xc'),_0x4cf033,_0xc872('0xd'));logger[_0xc872('0xe')](_0xc872('0xf'),_0x4cf033,'request\x20sent',JSON[_0xc872('0x10')](_0x3d8926));if(_0x3d8926['error']){if(_0x3d8926[_0xc872('0x11')][_0xc872('0x12')]===0x1f4){logger[_0xc872('0x11')](_0xc872('0xc'),_0x4cf033,_0x3d8926['error'][_0xc872('0x13')]);return _0x52b306(_0x3d8926[_0xc872('0x11')][_0xc872('0x13')]);}logger[_0xc872('0x11')](_0xc872('0xc'),_0x4cf033,_0x3d8926[_0xc872('0x11')][_0xc872('0x13')]);return _0x4d2acf(_0x3d8926[_0xc872('0x11')]['message']);}else{logger[_0xc872('0x14')](_0xc872('0xc'),_0x4cf033,_0xc872('0xd'));_0x4d2acf(_0x3d8926[_0xc872('0x15')][_0xc872('0x13')]);}})[_0xc872('0x16')](function(_0x1f6d16){logger['error'](_0xc872('0xc'),_0x4cf033,_0x1f6d16);_0x52b306(_0x1f6d16);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7a93016..09f67c2 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 _0x4dcc=['/:id','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','put'];(function(_0x107bd,_0x5d25af){var _0x2464a0=function(_0x444bb9){while(--_0x444bb9){_0x107bd['push'](_0x107bd['shift']());}};_0x2464a0(++_0x5d25af);}(_0x4dcc,0x6c));var _0xc4dc=function(_0x51f593,_0x38d2ec){_0x51f593=_0x51f593-0x0;var _0x4ccfbf=_0x4dcc[_0x51f593];return _0x4ccfbf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc4dc('0x0'));var timeout=require('connect-timeout');var express=require(_0xc4dc('0x1'));var router=express[_0xc4dc('0x2')]();var auth=require(_0xc4dc('0x3'));var interaction=require(_0xc4dc('0x4'));var config=require(_0xc4dc('0x5'));var controller=require(_0xc4dc('0x6'));router[_0xc4dc('0x7')]('/',auth[_0xc4dc('0x8')](),controller[_0xc4dc('0x9')]);router[_0xc4dc('0x7')](_0xc4dc('0xa'),auth[_0xc4dc('0x8')](),controller['describe']);router[_0xc4dc('0x7')]('/:id',auth[_0xc4dc('0x8')](),controller['show']);router['post']('/',auth[_0xc4dc('0x8')](),controller['create']);router[_0xc4dc('0xb')](_0xc4dc('0xc'),auth[_0xc4dc('0x8')](),controller['update']);router[_0xc4dc('0xd')](_0xc4dc('0xc'),auth[_0xc4dc('0x8')](),controller['destroy']);module[_0xc4dc('0xe')]=router; \ No newline at end of file +var _0x9fe6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9fe6,0xd7));var _0x69fe=function(_0x912e3c,_0x5cd9f0){_0x912e3c=_0x912e3c-0x0;var _0x3a13b4=_0x9fe6[_0x912e3c];return _0x3a13b4;};'use strict';var multer=require(_0x69fe('0x0'));var util=require(_0x69fe('0x1'));var path=require(_0x69fe('0x2'));var timeout=require(_0x69fe('0x3'));var express=require(_0x69fe('0x4'));var router=express['Router']();var auth=require(_0x69fe('0x5'));var interaction=require(_0x69fe('0x6'));var config=require(_0x69fe('0x7'));var controller=require(_0x69fe('0x8'));router[_0x69fe('0x9')]('/',auth['isAuthenticated'](),controller[_0x69fe('0xa')]);router[_0x69fe('0x9')](_0x69fe('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x69fe('0x9')](_0x69fe('0xc'),auth[_0x69fe('0xd')](),controller[_0x69fe('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x69fe('0xf')](_0x69fe('0xc'),auth[_0x69fe('0xd')](),controller[_0x69fe('0x10')]);router[_0x69fe('0x11')]('/:id',auth[_0x69fe('0xd')](),controller[_0x69fe('0x12')]);module[_0x69fe('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f692086..acbd219 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 _0x2673=['long','STRING','sequelize'];(function(_0x26b4ac,_0x46991e){var _0x2e90b5=function(_0x1392c3){while(--_0x1392c3){_0x26b4ac['push'](_0x26b4ac['shift']());}};_0x2e90b5(++_0x46991e);}(_0x2673,0x1df));var _0x3267=function(_0x5c06fe,_0x12193a){_0x5c06fe=_0x5c06fe-0x0;var _0xf8ec9a=_0x2673[_0x5c06fe];return _0xf8ec9a;};'use strict';var Sequelize=require(_0x3267('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x3267('0x1'))},'membername':{'type':Sequelize[_0x3267('0x2')]},'projectname':{'type':Sequelize[_0x3267('0x2')]},'queue':{'type':Sequelize[_0x3267('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3267('0x2')]},'calleridnum':{'type':Sequelize[_0x3267('0x2')]},'questionId':{'type':Sequelize[_0x3267('0x2')]}}; \ No newline at end of file +var _0x2866=['STRING','exports','TEXT'];(function(_0x22e6f4,_0x4bc737){var _0x2745f3=function(_0x30397c){while(--_0x30397c){_0x22e6f4['push'](_0x22e6f4['shift']());}};_0x2745f3(++_0x4bc737);}(_0x2866,0x17b));var _0x6286=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x2866[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require('sequelize');module[_0x6286('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x6286('0x1')]('long')},'membername':{'type':Sequelize[_0x6286('0x2')]},'projectname':{'type':Sequelize[_0x6286('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6286('0x2')]},'calleridname':{'type':Sequelize[_0x6286('0x2')]},'calleridnum':{'type':Sequelize[_0x6286('0x2')]},'questionId':{'type':Sequelize[_0x6286('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 5659423..49fc665 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 _0x5889=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','merge','options','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','reject','save','destroy','then','error','stack','name','index','map'];(function(_0x5be14f,_0x52d1e9){var _0x39bf3c=function(_0x33d2ae){while(--_0x33d2ae){_0x5be14f['push'](_0x5be14f['shift']());}};_0x39bf3c(++_0x52d1e9);}(_0x5889,0x192));var _0x9588=function(_0x266103,_0x338328){_0x266103=_0x266103-0x0;var _0x4e306c=_0x5889[_0x266103];return _0x4e306c;};'use strict';var pdf=require(_0x9588('0x0'));var emlformat=require(_0x9588('0x1'));var rimraf=require(_0x9588('0x2'));var zipdir=require(_0x9588('0x3'));var jsonpatch=require(_0x9588('0x4'));var rp=require(_0x9588('0x5'));var moment=require('moment');var BPromise=require(_0x9588('0x6'));var Mustache=require(_0x9588('0x7'));var util=require(_0x9588('0x8'));var path=require(_0x9588('0x9'));var sox=require(_0x9588('0xa'));var csv=require(_0x9588('0xb'));var ejs=require(_0x9588('0xc'));var fs=require('fs');var _=require(_0x9588('0xd'));var squel=require(_0x9588('0xe'));var crypto=require('crypto');var jsforce=require(_0x9588('0xf'));var deskjs=require(_0x9588('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9588('0x11'));var Redis=require(_0x9588('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9588('0x13'));var as=require(_0x9588('0x14'));var hardwareService=require(_0x9588('0x15'));var logger=require(_0x9588('0x16'))(_0x9588('0x17'));var utils=require(_0x9588('0x18'));var config=require('../../config/environment');var db=require(_0x9588('0x19'))['db'];function respondWithStatusCode(_0x26ebf3,_0x359631){_0x359631=_0x359631||0xcc;return function(_0x421dd4){if(_0x421dd4){return _0x26ebf3[_0x9588('0x1a')](_0x359631);}return _0x26ebf3['status'](_0x359631)['end']();};}function respondWithResult(_0x4f933b,_0x32115b){_0x32115b=_0x32115b||0xc8;return function(_0x24d554){if(_0x24d554){return _0x4f933b['status'](_0x32115b)[_0x9588('0x1b')](_0x24d554);}};}function respondWithFilteredResult(_0x259af5,_0x11fe62){return function(_0x4130ce){if(_0x4130ce){var _0x330178=_0x4130ce[_0x9588('0x1c')],_0x3e6d6b=_0x11fe62[_0x9588('0x1d')],_0x448c54=_0x11fe62[_0x9588('0x1d')]+_0x11fe62[_0x9588('0x1e')],_0x56a74d;if(_0x448c54>=_0x330178){_0x448c54=_0x330178;_0x56a74d=0xc8;}else{_0x56a74d=0xce;}_0x259af5[_0x9588('0x1f')](_0x56a74d);return _0x259af5['set'](_0x9588('0x20'),_0x3e6d6b+'-'+_0x448c54+'/'+_0x330178)['json'](_0x4130ce);}return null;};}function patchUpdates(_0x7218b){return function(_0x1e1f7f){try{jsonpatch['apply'](_0x1e1f7f,_0x7218b,!![]);}catch(_0x1bd7ff){return BPromise[_0x9588('0x21')](_0x1bd7ff);}return _0x1e1f7f[_0x9588('0x22')]();};}function saveUpdates(_0x4caa17,_0x570647){return function(_0x46c4fa){if(_0x46c4fa){return _0x46c4fa['update'](_0x4caa17)['then'](function(_0x48bc7c){return _0x48bc7c;});}return null;};}function removeEntity(_0x547abc,_0x16d357){return function(_0xdeb4c0){if(_0xdeb4c0){return _0xdeb4c0[_0x9588('0x23')]()[_0x9588('0x24')](function(){_0x547abc[_0x9588('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7ba9,_0x4fa1a2){return function(_0x2cd46a){if(!_0x2cd46a){_0x5b7ba9[_0x9588('0x1a')](0x194);}return _0x2cd46a;};}function handleError(_0x44b261,_0x1566d6){_0x1566d6=_0x1566d6||0x1f4;return function(_0x4a9592){logger[_0x9588('0x25')](_0x4a9592[_0x9588('0x26')]);if(_0x4a9592[_0x9588('0x27')]){delete _0x4a9592[_0x9588('0x27')];}_0x44b261[_0x9588('0x1f')](_0x1566d6)['send'](_0x4a9592);};}exports[_0x9588('0x28')]=function(_0x571d18,_0xdd6fd0){var _0x422d45={},_0x2ee4f4={},_0x5376a2={'count':0x0,'rows':[]};var _0x3eb6b0=_[_0x9588('0x29')](db['JscriptyQuestionReport'][_0x9588('0x2a')],function(_0x4a83e2){return{'name':_0x4a83e2[_0x9588('0x2b')],'type':_0x4a83e2[_0x9588('0x2c')][_0x9588('0x2d')]};});_0x2ee4f4[_0x9588('0x2e')]=_[_0x9588('0x29')](_0x3eb6b0,_0x9588('0x27'));_0x2ee4f4[_0x9588('0x2f')]=_[_0x9588('0x30')](_0x571d18[_0x9588('0x2f')]);_0x2ee4f4[_0x9588('0x31')]=_[_0x9588('0x32')](_0x2ee4f4[_0x9588('0x2e')],_0x2ee4f4[_0x9588('0x2f')]);_0x422d45['attributes']=_[_0x9588('0x32')](_0x2ee4f4['model'],qs['fields'](_0x571d18[_0x9588('0x2f')][_0x9588('0x33')]));_0x422d45[_0x9588('0x34')]=_0x422d45[_0x9588('0x34')][_0x9588('0x35')]?_0x422d45['attributes']:_0x2ee4f4['model'];if(!_0x571d18[_0x9588('0x2f')]['hasOwnProperty'](_0x9588('0x36'))){_0x422d45[_0x9588('0x1e')]=qs[_0x9588('0x1e')](_0x571d18[_0x9588('0x2f')][_0x9588('0x1e')]);_0x422d45[_0x9588('0x1d')]=qs[_0x9588('0x1d')](_0x571d18[_0x9588('0x2f')]['offset']);}_0x422d45[_0x9588('0x37')]=qs[_0x9588('0x38')](_0x571d18[_0x9588('0x2f')][_0x9588('0x38')]);_0x422d45['where']=qs[_0x9588('0x31')](_['pick'](_0x571d18[_0x9588('0x2f')],_0x2ee4f4[_0x9588('0x31')]),_0x3eb6b0);if(_0x571d18[_0x9588('0x2f')]['filter']){_0x422d45[_0x9588('0x39')]=_['merge'](_0x422d45[_0x9588('0x39')],{'$or':_['map'](_0x3eb6b0,function(_0x5f0eaa){if(_0x5f0eaa[_0x9588('0x2c')]!=='VIRTUAL'){var _0x4a7898={};_0x4a7898[_0x5f0eaa[_0x9588('0x27')]]={'$like':'%'+_0x571d18[_0x9588('0x2f')][_0x9588('0x3a')]+'%'};return _0x4a7898;}})});}_0x422d45=_['merge']({},_0x422d45,_0x571d18['options']);var _0x3bab39={'where':_0x422d45[_0x9588('0x39')]};return db[_0x9588('0x3b')][_0x9588('0x1c')](_0x3bab39)['then'](function(_0x3f550a){_0x5376a2[_0x9588('0x1c')]=_0x3f550a;if(_0x571d18['query'][_0x9588('0x3c')]){_0x422d45[_0x9588('0x3d')]=[{'all':!![]}];}return db[_0x9588('0x3b')][_0x9588('0x3e')](_0x422d45);})[_0x9588('0x24')](function(_0x43e0a5){_0x5376a2[_0x9588('0x3f')]=_0x43e0a5;return _0x5376a2;})[_0x9588('0x24')](respondWithFilteredResult(_0xdd6fd0,_0x422d45))[_0x9588('0x40')](handleError(_0xdd6fd0,null));};exports[_0x9588('0x41')]=function(_0x503f2b,_0x14d9fe){var _0x51680e={'raw':!![],'where':{'id':_0x503f2b[_0x9588('0x42')]['id']}},_0xf54886={};_0xf54886['model']=_[_0x9588('0x30')](db[_0x9588('0x3b')][_0x9588('0x2a')]);_0xf54886[_0x9588('0x2f')]=_['keys'](_0x503f2b[_0x9588('0x2f')]);_0xf54886[_0x9588('0x31')]=_[_0x9588('0x32')](_0xf54886[_0x9588('0x2e')],_0xf54886[_0x9588('0x2f')]);_0x51680e[_0x9588('0x34')]=_['intersection'](_0xf54886[_0x9588('0x2e')],qs[_0x9588('0x33')](_0x503f2b[_0x9588('0x2f')][_0x9588('0x33')]));_0x51680e[_0x9588('0x34')]=_0x51680e[_0x9588('0x34')][_0x9588('0x35')]?_0x51680e['attributes']:_0xf54886['model'];if(_0x503f2b[_0x9588('0x2f')]['includeAll']){_0x51680e[_0x9588('0x3d')]=[{'all':!![]}];}_0x51680e=_[_0x9588('0x43')]({},_0x51680e,_0x503f2b[_0x9588('0x44')]);return db[_0x9588('0x3b')]['find'](_0x51680e)[_0x9588('0x24')](handleEntityNotFound(_0x14d9fe,null))[_0x9588('0x24')](respondWithResult(_0x14d9fe,null))[_0x9588('0x40')](handleError(_0x14d9fe,null));};exports[_0x9588('0x45')]=function(_0x147712,_0xf5446e){return db['JscriptyQuestionReport'][_0x9588('0x45')](_0x147712[_0x9588('0x46')],{})['then'](respondWithResult(_0xf5446e,0xc9))[_0x9588('0x40')](handleError(_0xf5446e,null));};exports[_0x9588('0x47')]=function(_0x3c87aa,_0x5a2abd){if(_0x3c87aa[_0x9588('0x46')]['id']){delete _0x3c87aa['body']['id'];}return db[_0x9588('0x3b')][_0x9588('0x48')]({'where':{'id':_0x3c87aa[_0x9588('0x42')]['id']}})[_0x9588('0x24')](handleEntityNotFound(_0x5a2abd,null))['then'](saveUpdates(_0x3c87aa[_0x9588('0x46')],null))[_0x9588('0x24')](respondWithResult(_0x5a2abd,null))[_0x9588('0x40')](handleError(_0x5a2abd,null));};exports[_0x9588('0x23')]=function(_0x363625,_0x28135c){return db[_0x9588('0x3b')][_0x9588('0x48')]({'where':{'id':_0x363625[_0x9588('0x42')]['id']}})[_0x9588('0x24')](handleEntityNotFound(_0x28135c,null))['then'](removeEntity(_0x28135c,null))[_0x9588('0x40')](handleError(_0x28135c,null));};exports[_0x9588('0x49')]=function(_0x26dda5,_0x92ab48){return db[_0x9588('0x3b')][_0x9588('0x49')]()[_0x9588('0x24')](respondWithResult(_0x92ab48,null))['catch'](handleError(_0x92ab48,null));}; \ No newline at end of file +var _0x5441=['type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','JscriptyQuestionReport','rawAttributes'];(function(_0x1b7ce6,_0x5dc18c){var _0x370357=function(_0x44da85){while(--_0x44da85){_0x1b7ce6['push'](_0x1b7ce6['shift']());}};_0x370357(++_0x5dc18c);}(_0x5441,0xb4));var _0x1544=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x5441[_0x1ae5ab];return _0x1ce001;};'use strict';var pdf=require(_0x1544('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1544('0x1'));var zipdir=require(_0x1544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1544('0x3'));var moment=require(_0x1544('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1544('0x5'));var path=require(_0x1544('0x6'));var sox=require(_0x1544('0x7'));var csv=require(_0x1544('0x8'));var ejs=require(_0x1544('0x9'));var fs=require('fs');var _=require(_0x1544('0xa'));var squel=require(_0x1544('0xb'));var crypto=require('crypto');var jsforce=require(_0x1544('0xc'));var deskjs=require(_0x1544('0xd'));var toCsv=require(_0x1544('0x8'));var querystring=require(_0x1544('0xe'));var Papa=require(_0x1544('0xf'));var Redis=require(_0x1544('0x10'));var authService=require(_0x1544('0x11'));var qs=require(_0x1544('0x12'));var as=require(_0x1544('0x13'));var hardwareService=require(_0x1544('0x14'));var logger=require(_0x1544('0x15'))('api');var utils=require(_0x1544('0x16'));var config=require(_0x1544('0x17'));var db=require(_0x1544('0x18'))['db'];function respondWithStatusCode(_0x575fe7,_0x4f7279){_0x4f7279=_0x4f7279||0xcc;return function(_0x2d706d){if(_0x2d706d){return _0x575fe7[_0x1544('0x19')](_0x4f7279);}return _0x575fe7[_0x1544('0x1a')](_0x4f7279)[_0x1544('0x1b')]();};}function respondWithResult(_0x406020,_0x11443e){_0x11443e=_0x11443e||0xc8;return function(_0xc9c2a8){if(_0xc9c2a8){return _0x406020[_0x1544('0x1a')](_0x11443e)['json'](_0xc9c2a8);}};}function respondWithFilteredResult(_0x449c1e,_0x74539){return function(_0x3d2ea7){if(_0x3d2ea7){var _0x26c8f3=_0x3d2ea7[_0x1544('0x1c')],_0x243720=_0x74539[_0x1544('0x1d')],_0x510e03=_0x74539[_0x1544('0x1d')]+_0x74539['limit'],_0x28d197;if(_0x510e03>=_0x26c8f3){_0x510e03=_0x26c8f3;_0x28d197=0xc8;}else{_0x28d197=0xce;}_0x449c1e['status'](_0x28d197);return _0x449c1e[_0x1544('0x1e')](_0x1544('0x1f'),_0x243720+'-'+_0x510e03+'/'+_0x26c8f3)[_0x1544('0x20')](_0x3d2ea7);}return null;};}function patchUpdates(_0x413ca9){return function(_0x563c43){try{jsonpatch[_0x1544('0x21')](_0x563c43,_0x413ca9,!![]);}catch(_0xfb2069){return BPromise[_0x1544('0x22')](_0xfb2069);}return _0x563c43[_0x1544('0x23')]();};}function saveUpdates(_0xb23ff1,_0x4cfa8f){return function(_0x1d354f){if(_0x1d354f){return _0x1d354f[_0x1544('0x24')](_0xb23ff1)[_0x1544('0x25')](function(_0x533ab6){return _0x533ab6;});}return null;};}function removeEntity(_0x492ef0,_0xa098be){return function(_0x14e0e6){if(_0x14e0e6){return _0x14e0e6[_0x1544('0x26')]()[_0x1544('0x25')](function(){_0x492ef0['status'](0xcc)[_0x1544('0x1b')]();});}};}function handleEntityNotFound(_0x1a34f4,_0x391f06){return function(_0x1cbb4d){if(!_0x1cbb4d){_0x1a34f4[_0x1544('0x19')](0x194);}return _0x1cbb4d;};}function handleError(_0x163bbb,_0x413d2d){_0x413d2d=_0x413d2d||0x1f4;return function(_0x4695e4){logger[_0x1544('0x27')](_0x4695e4[_0x1544('0x28')]);if(_0x4695e4['name']){delete _0x4695e4[_0x1544('0x29')];}_0x163bbb[_0x1544('0x1a')](_0x413d2d)['send'](_0x4695e4);};}exports[_0x1544('0x2a')]=function(_0x175ac1,_0x4af724){var _0x39f053={},_0x3bc4bd={},_0x3e2645={'count':0x0,'rows':[]};var _0x3de995=_['map'](db[_0x1544('0x2b')][_0x1544('0x2c')],function(_0x25a5ee){return{'name':_0x25a5ee['fieldName'],'type':_0x25a5ee[_0x1544('0x2d')][_0x1544('0x2e')]};});_0x3bc4bd[_0x1544('0x2f')]=_['map'](_0x3de995,'name');_0x3bc4bd[_0x1544('0x30')]=_[_0x1544('0x31')](_0x175ac1[_0x1544('0x30')]);_0x3bc4bd[_0x1544('0x32')]=_[_0x1544('0x33')](_0x3bc4bd[_0x1544('0x2f')],_0x3bc4bd[_0x1544('0x30')]);_0x39f053[_0x1544('0x34')]=_[_0x1544('0x33')](_0x3bc4bd['model'],qs[_0x1544('0x35')](_0x175ac1[_0x1544('0x30')][_0x1544('0x35')]));_0x39f053[_0x1544('0x34')]=_0x39f053[_0x1544('0x34')][_0x1544('0x36')]?_0x39f053[_0x1544('0x34')]:_0x3bc4bd[_0x1544('0x2f')];if(!_0x175ac1['query']['hasOwnProperty']('nolimit')){_0x39f053[_0x1544('0x37')]=qs[_0x1544('0x37')](_0x175ac1[_0x1544('0x30')][_0x1544('0x37')]);_0x39f053[_0x1544('0x1d')]=qs['offset'](_0x175ac1['query'][_0x1544('0x1d')]);}_0x39f053[_0x1544('0x38')]=qs[_0x1544('0x39')](_0x175ac1['query'][_0x1544('0x39')]);_0x39f053[_0x1544('0x3a')]=qs['filters'](_[_0x1544('0x3b')](_0x175ac1['query'],_0x3bc4bd[_0x1544('0x32')]),_0x3de995);if(_0x175ac1[_0x1544('0x30')]['filter']){_0x39f053[_0x1544('0x3a')]=_[_0x1544('0x3c')](_0x39f053[_0x1544('0x3a')],{'$or':_[_0x1544('0x3d')](_0x3de995,function(_0x671063){if(_0x671063[_0x1544('0x2d')]!=='VIRTUAL'){var _0x386e05={};_0x386e05[_0x671063[_0x1544('0x29')]]={'$like':'%'+_0x175ac1['query'][_0x1544('0x3e')]+'%'};return _0x386e05;}})});}_0x39f053=_['merge']({},_0x39f053,_0x175ac1[_0x1544('0x3f')]);var _0x55ac33={'where':_0x39f053[_0x1544('0x3a')]};return db[_0x1544('0x2b')][_0x1544('0x1c')](_0x55ac33)[_0x1544('0x25')](function(_0x3b5432){_0x3e2645[_0x1544('0x1c')]=_0x3b5432;if(_0x175ac1[_0x1544('0x30')][_0x1544('0x40')]){_0x39f053[_0x1544('0x41')]=[{'all':!![]}];}return db[_0x1544('0x2b')][_0x1544('0x42')](_0x39f053);})['then'](function(_0x4675d7){_0x3e2645[_0x1544('0x43')]=_0x4675d7;return _0x3e2645;})['then'](respondWithFilteredResult(_0x4af724,_0x39f053))['catch'](handleError(_0x4af724,null));};exports[_0x1544('0x44')]=function(_0x3c32af,_0x302acc){var _0x3a1409={'raw':!![],'where':{'id':_0x3c32af[_0x1544('0x45')]['id']}},_0x3703d9={};_0x3703d9['model']=_[_0x1544('0x31')](db[_0x1544('0x2b')][_0x1544('0x2c')]);_0x3703d9[_0x1544('0x30')]=_[_0x1544('0x31')](_0x3c32af['query']);_0x3703d9[_0x1544('0x32')]=_['intersection'](_0x3703d9[_0x1544('0x2f')],_0x3703d9['query']);_0x3a1409[_0x1544('0x34')]=_['intersection'](_0x3703d9[_0x1544('0x2f')],qs['fields'](_0x3c32af[_0x1544('0x30')]['fields']));_0x3a1409['attributes']=_0x3a1409[_0x1544('0x34')][_0x1544('0x36')]?_0x3a1409['attributes']:_0x3703d9[_0x1544('0x2f')];if(_0x3c32af['query'][_0x1544('0x40')]){_0x3a1409['include']=[{'all':!![]}];}_0x3a1409=_[_0x1544('0x3c')]({},_0x3a1409,_0x3c32af[_0x1544('0x3f')]);return db[_0x1544('0x2b')][_0x1544('0x46')](_0x3a1409)[_0x1544('0x25')](handleEntityNotFound(_0x302acc,null))[_0x1544('0x25')](respondWithResult(_0x302acc,null))['catch'](handleError(_0x302acc,null));};exports[_0x1544('0x47')]=function(_0x2cf841,_0x4e037d){return db['JscriptyQuestionReport']['create'](_0x2cf841[_0x1544('0x48')],{})['then'](respondWithResult(_0x4e037d,0xc9))[_0x1544('0x49')](handleError(_0x4e037d,null));};exports['update']=function(_0x43c99f,_0x2747c1){if(_0x43c99f[_0x1544('0x48')]['id']){delete _0x43c99f[_0x1544('0x48')]['id'];}return db[_0x1544('0x2b')][_0x1544('0x46')]({'where':{'id':_0x43c99f[_0x1544('0x45')]['id']}})['then'](handleEntityNotFound(_0x2747c1,null))[_0x1544('0x25')](saveUpdates(_0x43c99f[_0x1544('0x48')],null))[_0x1544('0x25')](respondWithResult(_0x2747c1,null))[_0x1544('0x49')](handleError(_0x2747c1,null));};exports[_0x1544('0x26')]=function(_0x165ee8,_0x5e3d99){return db[_0x1544('0x2b')][_0x1544('0x46')]({'where':{'id':_0x165ee8[_0x1544('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e3d99,null))['then'](removeEntity(_0x5e3d99,null))[_0x1544('0x49')](handleError(_0x5e3d99,null));};exports[_0x1544('0x4a')]=function(_0x53d5a1,_0x4e7d73){return db[_0x1544('0x2b')][_0x1544('0x4a')]()[_0x1544('0x25')](respondWithResult(_0x4e7d73,null))[_0x1544('0x49')](handleError(_0x4e7d73,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 709c7fa..529d60d 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 _0xd123=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions'];(function(_0x2a30ba,_0x2f1e3e){var _0x225c1e=function(_0x562ef9){while(--_0x562ef9){_0x2a30ba['push'](_0x2a30ba['shift']());}};_0x225c1e(++_0x2f1e3e);}(_0xd123,0x108));var _0x3d12=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0xd123[_0xb0b922];return _0x5dc41e;};'use strict';var _=require(_0x3d12('0x0'));var util=require(_0x3d12('0x1'));var logger=require(_0x3d12('0x2'))('api');var moment=require(_0x3d12('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d12('0x4'));var fs=require('fs');var path=require(_0x3d12('0x5'));var rimraf=require(_0x3d12('0x6'));var config=require(_0x3d12('0x7'));var attributes=require(_0x3d12('0x8'));module['exports']=function(_0x13a9ec,_0xdf394){return _0x13a9ec[_0x3d12('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x3d12('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x737c=['./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4da9f3,_0x580501){var _0x3d12f9=function(_0x1d05e4){while(--_0x1d05e4){_0x4da9f3['push'](_0x4da9f3['shift']());}};_0x3d12f9(++_0x580501);}(_0x737c,0xe2));var _0xc737=function(_0x31678f,_0x4bd077){_0x31678f=_0x31678f-0x0;var _0x49d438=_0x737c[_0x31678f];return _0x49d438;};'use strict';var _=require(_0xc737('0x0'));var util=require(_0xc737('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc737('0x2'));var rp=require(_0xc737('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc737('0x4'));var config=require(_0xc737('0x5'));var attributes=require(_0xc737('0x6'));module['exports']=function(_0xa8e779,_0x5898a6){return _0xa8e779['define']('JscriptyQuestionReport',attributes,{'tableName':_0xc737('0x7'),'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 bf1b520..e0097ec 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 _0x0f54=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x0f54,0x169));var _0x40f5=function(_0x3a641e,_0x55e6f9){_0x3a641e=_0x3a641e-0x0;var _0x3e0e56=_0x0f54[_0x3a641e];return _0x3e0e56;};'use strict';var _=require(_0x40f5('0x0'));var util=require(_0x40f5('0x1'));var moment=require(_0x40f5('0x2'));var BPromise=require(_0x40f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40f5('0x4'));var db=require(_0x40f5('0x5'))['db'];var utils=require(_0x40f5('0x6'));var logger=require(_0x40f5('0x7'))(_0x40f5('0x8'));var config=require(_0x40f5('0x9'));var jayson=require(_0x40f5('0xa'));var client=jayson[_0x40f5('0xb')][_0x40f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54af9c,_0x56a9ee,_0x58c719){return new BPromise(function(_0x34a5e5,_0x529051){return client[_0x40f5('0xd')](_0x54af9c,_0x58c719)[_0x40f5('0xe')](function(_0x54cd38){logger[_0x40f5('0xf')](_0x40f5('0x10'),_0x56a9ee,_0x40f5('0x11'));logger[_0x40f5('0x12')](_0x40f5('0x13'),_0x56a9ee,_0x40f5('0x11'),JSON[_0x40f5('0x14')](_0x54cd38));if(_0x54cd38[_0x40f5('0x15')]){if(_0x54cd38['error']['code']===0x1f4){logger[_0x40f5('0x15')](_0x40f5('0x10'),_0x56a9ee,_0x54cd38[_0x40f5('0x15')][_0x40f5('0x16')]);return _0x529051(_0x54cd38[_0x40f5('0x15')][_0x40f5('0x16')]);}logger[_0x40f5('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x56a9ee,_0x54cd38['error'][_0x40f5('0x16')]);return _0x34a5e5(_0x54cd38[_0x40f5('0x15')][_0x40f5('0x16')]);}else{logger[_0x40f5('0xf')](_0x40f5('0x10'),_0x56a9ee,_0x40f5('0x11'));_0x34a5e5(_0x54cd38[_0x40f5('0x17')][_0x40f5('0x16')]);}})[_0x40f5('0x18')](function(_0x18707b){logger[_0x40f5('0x15')](_0x40f5('0x10'),_0x56a9ee,_0x18707b);_0x529051(_0x18707b);});});} \ No newline at end of file +var _0xbf70=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring'];(function(_0x282ff9,_0x268bfe){var _0x542612=function(_0x4ad95c){while(--_0x4ad95c){_0x282ff9['push'](_0x282ff9['shift']());}};_0x542612(++_0x268bfe);}(_0xbf70,0x1b1));var _0x0bf7=function(_0xbffd26,_0x2f96ae){_0xbffd26=_0xbffd26-0x0;var _0x5b641b=_0xbf70[_0xbffd26];return _0x5b641b;};'use strict';var _=require('lodash');var util=require(_0x0bf7('0x0'));var moment=require(_0x0bf7('0x1'));var BPromise=require(_0x0bf7('0x2'));var rs=require(_0x0bf7('0x3'));var fs=require('fs');var Redis=require(_0x0bf7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bf7('0x5'));var logger=require(_0x0bf7('0x6'))('rpc');var config=require(_0x0bf7('0x7'));var jayson=require(_0x0bf7('0x8'));var client=jayson[_0x0bf7('0x9')][_0x0bf7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5823bf,_0x495ae8,_0x482588){return new BPromise(function(_0x3c177e,_0x4f7702){return client[_0x0bf7('0xb')](_0x5823bf,_0x482588)[_0x0bf7('0xc')](function(_0x323104){logger[_0x0bf7('0xd')](_0x0bf7('0xe'),_0x495ae8,_0x0bf7('0xf'));logger[_0x0bf7('0x10')](_0x0bf7('0x11'),_0x495ae8,_0x0bf7('0xf'),JSON[_0x0bf7('0x12')](_0x323104));if(_0x323104[_0x0bf7('0x13')]){if(_0x323104[_0x0bf7('0x13')][_0x0bf7('0x14')]===0x1f4){logger['error'](_0x0bf7('0xe'),_0x495ae8,_0x323104[_0x0bf7('0x13')][_0x0bf7('0x15')]);return _0x4f7702(_0x323104['error'][_0x0bf7('0x15')]);}logger['error'](_0x0bf7('0xe'),_0x495ae8,_0x323104[_0x0bf7('0x13')][_0x0bf7('0x15')]);return _0x3c177e(_0x323104[_0x0bf7('0x13')]['message']);}else{logger[_0x0bf7('0xd')](_0x0bf7('0xe'),_0x495ae8,'request\x20sent');_0x3c177e(_0x323104[_0x0bf7('0x16')]['message']);}})['catch'](function(_0x504880){logger['error'](_0x0bf7('0xe'),_0x495ae8,_0x504880);_0x4f7702(_0x504880);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 63ebeac..4c89bfd 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 _0x8c52=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/:id','show','/:id/questions','post','create','put','update','delete','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8c52,0x7e));var _0x28c5=function(_0x87dd0e,_0x390eec){_0x87dd0e=_0x87dd0e-0x0;var _0x3f6891=_0x8c52[_0x87dd0e];return _0x3f6891;};'use strict';var multer=require(_0x28c5('0x0'));var util=require('util');var path=require(_0x28c5('0x1'));var timeout=require(_0x28c5('0x2'));var express=require(_0x28c5('0x3'));var router=express[_0x28c5('0x4')]();var auth=require(_0x28c5('0x5'));var interaction=require(_0x28c5('0x6'));var config=require(_0x28c5('0x7'));var controller=require(_0x28c5('0x8'));router[_0x28c5('0x9')]('/',auth[_0x28c5('0xa')](),controller[_0x28c5('0xb')]);router[_0x28c5('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x28c5('0xc'),auth[_0x28c5('0xa')](),controller[_0x28c5('0xd')]);router['get'](_0x28c5('0xe'),auth[_0x28c5('0xa')](),controller['getQuestions']);router[_0x28c5('0xf')]('/',auth[_0x28c5('0xa')](),controller[_0x28c5('0x10')]);router[_0x28c5('0x11')](_0x28c5('0xc'),auth[_0x28c5('0xa')](),controller[_0x28c5('0x12')]);router[_0x28c5('0x13')](_0x28c5('0xc'),auth[_0x28c5('0xa')](),controller['destroy']);module[_0x28c5('0x14')]=router; \ No newline at end of file +var _0x207c=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','/describe','isAuthenticated','/:id','/:id/questions','getQuestions','post','delete'];(function(_0x3700d9,_0x52962f){var _0x1cd957=function(_0x5861cd){while(--_0x5861cd){_0x3700d9['push'](_0x3700d9['shift']());}};_0x1cd957(++_0x52962f);}(_0x207c,0x1e8));var _0xc207=function(_0x1e354d,_0x4cdd11){_0x1e354d=_0x1e354d-0x0;var _0x25445d=_0x207c[_0x1e354d];return _0x25445d;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['describe']);router[_0xc207('0x8')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0x8')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')]('/',auth[_0xc207('0xa')](),controller['create']);router['put']('/:id',auth[_0xc207('0xa')](),controller['update']);router[_0xc207('0xf')](_0xc207('0xb'),auth['isAuthenticated'](),controller[_0xc207('0x10')]);module[_0xc207('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c0f7f20..ba4ba2f 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 _0xe99c=['BOOLEAN','sequelize','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0xf1081a,_0xfe4f04){var _0x311841=function(_0x6945c4){while(--_0x6945c4){_0xf1081a['push'](_0xf1081a['shift']());}};_0x311841(++_0xfe4f04);}(_0xe99c,0xa1));var _0xce99=function(_0x2facf7,_0x268453){_0x2facf7=_0x2facf7-0x0;var _0x240543=_0xe99c[_0x2facf7];return _0x240543;};'use strict';var moment=require('moment');var Sequelize=require(_0xce99('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xce99('0x1')],'set':function(_0x1ecea8){this[_0xce99('0x2')](_0xce99('0x3'),_0x1ecea8);this[_0xce99('0x2')](_0xce99('0x4'),moment()['format'](_0xce99('0x5')));}},'endtime':{'type':Sequelize[_0xce99('0x1')]},'membername':{'type':Sequelize[_0xce99('0x6')]},'projectname':{'type':Sequelize[_0xce99('0x6')]},'queue':{'type':Sequelize[_0xce99('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xce99('0x6')]},'calleridnum':{'type':Sequelize[_0xce99('0x6')]},'completed':{'type':Sequelize[_0xce99('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b83=['setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE'];(function(_0x594a71,_0x1347b7){var _0x480fc5=function(_0x348446){while(--_0x348446){_0x594a71['push'](_0x594a71['shift']());}};_0x480fc5(++_0x1347b7);}(_0x4b83,0xf3));var _0x34b8=function(_0x3b4426,_0x326d0f){_0x3b4426=_0x3b4426-0x0;var _0x1afb34=_0x4b83[_0x3b4426];return _0x1afb34;};'use strict';var moment=require('moment');var Sequelize=require(_0x34b8('0x0'));module[_0x34b8('0x1')]={'starttime':{'type':Sequelize[_0x34b8('0x2')],'set':function(_0x282beb){this[_0x34b8('0x3')]('starttime',_0x282beb);this['setDataValue']('endtime',moment()['format'](_0x34b8('0x4')));}},'endtime':{'type':Sequelize[_0x34b8('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x34b8('0x5')]},'uniqueid':{'type':Sequelize[_0x34b8('0x5')]},'calleridname':{'type':Sequelize[_0x34b8('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'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 1c27aec..74f1cb6 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 _0x3104=['error','stack','name','send','index','map','JscriptySessionReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','create','body','update','find','describe','findOne','JscriptyQuestionReport','order','pick','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','json','offset','limit','Content-Range','reject','save','then','destroy','status','sendStatus'];(function(_0x3d3c34,_0xf49b4){var _0x5dca13=function(_0x51c895){while(--_0x51c895){_0x3d3c34['push'](_0x3d3c34['shift']());}};_0x5dca13(++_0xf49b4);}(_0x3104,0x174));var _0x4310=function(_0x1961a2,_0x20170c){_0x1961a2=_0x1961a2-0x0;var _0x3dcfa7=_0x3104[_0x1961a2];return _0x3dcfa7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4310('0x0'));var rimraf=require(_0x4310('0x1'));var zipdir=require(_0x4310('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4310('0x3'));var moment=require(_0x4310('0x4'));var BPromise=require(_0x4310('0x5'));var Mustache=require(_0x4310('0x6'));var util=require(_0x4310('0x7'));var path=require(_0x4310('0x8'));var sox=require(_0x4310('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4310('0xa'));var squel=require(_0x4310('0xb'));var crypto=require(_0x4310('0xc'));var jsforce=require(_0x4310('0xd'));var deskjs=require(_0x4310('0xe'));var toCsv=require(_0x4310('0xf'));var querystring=require(_0x4310('0x10'));var Papa=require(_0x4310('0x11'));var Redis=require(_0x4310('0x12'));var authService=require(_0x4310('0x13'));var qs=require(_0x4310('0x14'));var as=require(_0x4310('0x15'));var hardwareService=require(_0x4310('0x16'));var logger=require(_0x4310('0x17'))(_0x4310('0x18'));var utils=require(_0x4310('0x19'));var config=require(_0x4310('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55e3d4,_0x374daf){_0x374daf=_0x374daf||0xcc;return function(_0x3d3607){if(_0x3d3607){return _0x55e3d4['sendStatus'](_0x374daf);}return _0x55e3d4['status'](_0x374daf)[_0x4310('0x1b')]();};}function respondWithResult(_0x1070de,_0x58d794){_0x58d794=_0x58d794||0xc8;return function(_0x2195bc){if(_0x2195bc){return _0x1070de['status'](_0x58d794)[_0x4310('0x1c')](_0x2195bc);}};}function respondWithFilteredResult(_0x1acc7a,_0x457244){return function(_0x3962ca){if(_0x3962ca){var _0xe5094b=_0x3962ca['count'],_0x39c728=_0x457244[_0x4310('0x1d')],_0x5652a6=_0x457244[_0x4310('0x1d')]+_0x457244[_0x4310('0x1e')],_0xa2a95;if(_0x5652a6>=_0xe5094b){_0x5652a6=_0xe5094b;_0xa2a95=0xc8;}else{_0xa2a95=0xce;}_0x1acc7a['status'](_0xa2a95);return _0x1acc7a['set'](_0x4310('0x1f'),_0x39c728+'-'+_0x5652a6+'/'+_0xe5094b)[_0x4310('0x1c')](_0x3962ca);}return null;};}function patchUpdates(_0x14f603){return function(_0x491c7b){try{jsonpatch['apply'](_0x491c7b,_0x14f603,!![]);}catch(_0x41c791){return BPromise[_0x4310('0x20')](_0x41c791);}return _0x491c7b[_0x4310('0x21')]();};}function saveUpdates(_0x3f9512,_0x126143){return function(_0x5ce577){if(_0x5ce577){return _0x5ce577['update'](_0x3f9512)[_0x4310('0x22')](function(_0x1c3fb7){return _0x1c3fb7;});}return null;};}function removeEntity(_0x25200e,_0x4b95ab){return function(_0x45711d){if(_0x45711d){return _0x45711d[_0x4310('0x23')]()[_0x4310('0x22')](function(){_0x25200e[_0x4310('0x24')](0xcc)[_0x4310('0x1b')]();});}};}function handleEntityNotFound(_0xc16c48,_0x2aa8d0){return function(_0x143149){if(!_0x143149){_0xc16c48[_0x4310('0x25')](0x194);}return _0x143149;};}function handleError(_0x12d60d,_0x4eec3d){_0x4eec3d=_0x4eec3d||0x1f4;return function(_0x1ac90f){logger[_0x4310('0x26')](_0x1ac90f[_0x4310('0x27')]);if(_0x1ac90f[_0x4310('0x28')]){delete _0x1ac90f[_0x4310('0x28')];}_0x12d60d[_0x4310('0x24')](_0x4eec3d)[_0x4310('0x29')](_0x1ac90f);};}exports[_0x4310('0x2a')]=function(_0x24a2a2,_0x598f58){var _0x10919a={},_0xa66f95={},_0x59de70={'count':0x0,'rows':[]};var _0x87c252=_[_0x4310('0x2b')](db[_0x4310('0x2c')]['rawAttributes'],function(_0x3f5230){return{'name':_0x3f5230[_0x4310('0x2d')],'type':_0x3f5230[_0x4310('0x2e')]['key']};});_0xa66f95[_0x4310('0x2f')]=_[_0x4310('0x2b')](_0x87c252,_0x4310('0x28'));_0xa66f95[_0x4310('0x30')]=_[_0x4310('0x31')](_0x24a2a2[_0x4310('0x30')]);_0xa66f95[_0x4310('0x32')]=_[_0x4310('0x33')](_0xa66f95[_0x4310('0x2f')],_0xa66f95[_0x4310('0x30')]);_0x10919a[_0x4310('0x34')]=_[_0x4310('0x33')](_0xa66f95['model'],qs[_0x4310('0x35')](_0x24a2a2[_0x4310('0x30')]['fields']));_0x10919a[_0x4310('0x34')]=_0x10919a[_0x4310('0x34')]['length']?_0x10919a[_0x4310('0x34')]:_0xa66f95[_0x4310('0x2f')];if(!_0x24a2a2[_0x4310('0x30')][_0x4310('0x36')](_0x4310('0x37'))){_0x10919a[_0x4310('0x1e')]=qs[_0x4310('0x1e')](_0x24a2a2[_0x4310('0x30')][_0x4310('0x1e')]);_0x10919a['offset']=qs[_0x4310('0x1d')](_0x24a2a2[_0x4310('0x30')][_0x4310('0x1d')]);}_0x10919a['order']=qs['sort'](_0x24a2a2['query'][_0x4310('0x38')]);_0x10919a[_0x4310('0x39')]=qs['filters'](_['pick'](_0x24a2a2[_0x4310('0x30')],_0xa66f95[_0x4310('0x32')]),_0x87c252);if(_0x24a2a2[_0x4310('0x30')][_0x4310('0x3a')]){_0x10919a[_0x4310('0x39')]=_[_0x4310('0x3b')](_0x10919a[_0x4310('0x39')],{'$or':_[_0x4310('0x2b')](_0x87c252,function(_0x38cf9f){if(_0x38cf9f[_0x4310('0x2e')]!==_0x4310('0x3c')){var _0x24a0a7={};_0x24a0a7[_0x38cf9f[_0x4310('0x28')]]={'$like':'%'+_0x24a2a2[_0x4310('0x30')][_0x4310('0x3a')]+'%'};return _0x24a0a7;}})});}_0x10919a=_[_0x4310('0x3b')]({},_0x10919a,_0x24a2a2[_0x4310('0x3d')]);var _0x237a2b={'where':_0x10919a[_0x4310('0x39')]};return db[_0x4310('0x2c')][_0x4310('0x3e')](_0x237a2b)[_0x4310('0x22')](function(_0xa7a4ec){_0x59de70['count']=_0xa7a4ec;if(_0x24a2a2['query'][_0x4310('0x3f')]){_0x10919a[_0x4310('0x40')]=[{'all':!![]}];}return db[_0x4310('0x2c')][_0x4310('0x41')](_0x10919a);})[_0x4310('0x22')](function(_0xfcab39){_0x59de70[_0x4310('0x42')]=_0xfcab39;return _0x59de70;})['then'](respondWithFilteredResult(_0x598f58,_0x10919a))['catch'](handleError(_0x598f58,null));};exports[_0x4310('0x43')]=function(_0x37bcf5,_0x1e419a){var _0x454d99={'raw':!![],'where':{'id':_0x37bcf5[_0x4310('0x44')]['id']}},_0x32ffc2={};_0x32ffc2[_0x4310('0x2f')]=_[_0x4310('0x31')](db[_0x4310('0x2c')][_0x4310('0x45')]);_0x32ffc2['query']=_['keys'](_0x37bcf5[_0x4310('0x30')]);_0x32ffc2['filters']=_['intersection'](_0x32ffc2[_0x4310('0x2f')],_0x32ffc2['query']);_0x454d99[_0x4310('0x34')]=_['intersection'](_0x32ffc2[_0x4310('0x2f')],qs[_0x4310('0x35')](_0x37bcf5[_0x4310('0x30')][_0x4310('0x35')]));_0x454d99[_0x4310('0x34')]=_0x454d99[_0x4310('0x34')][_0x4310('0x46')]?_0x454d99[_0x4310('0x34')]:_0x32ffc2[_0x4310('0x2f')];if(_0x37bcf5[_0x4310('0x30')][_0x4310('0x3f')]){_0x454d99[_0x4310('0x40')]=[{'all':!![]}];}_0x454d99=_[_0x4310('0x3b')]({},_0x454d99,_0x37bcf5[_0x4310('0x3d')]);return db[_0x4310('0x2c')]['find'](_0x454d99)[_0x4310('0x22')](handleEntityNotFound(_0x1e419a,null))[_0x4310('0x22')](respondWithResult(_0x1e419a,null))[_0x4310('0x47')](handleError(_0x1e419a,null));};exports[_0x4310('0x48')]=function(_0x48206a,_0x5032da){return db[_0x4310('0x2c')][_0x4310('0x48')](_0x48206a[_0x4310('0x49')],{})[_0x4310('0x22')](respondWithResult(_0x5032da,0xc9))[_0x4310('0x47')](handleError(_0x5032da,null));};exports[_0x4310('0x4a')]=function(_0x5b2163,_0x251011){if(_0x5b2163['body']['id']){delete _0x5b2163[_0x4310('0x49')]['id'];}return db[_0x4310('0x2c')]['find']({'where':{'id':_0x5b2163[_0x4310('0x44')]['id']}})[_0x4310('0x22')](handleEntityNotFound(_0x251011,null))[_0x4310('0x22')](saveUpdates(_0x5b2163[_0x4310('0x49')],null))['then'](respondWithResult(_0x251011,null))[_0x4310('0x47')](handleError(_0x251011,null));};exports[_0x4310('0x23')]=function(_0x45ca24,_0x11917c){return db[_0x4310('0x2c')][_0x4310('0x4b')]({'where':{'id':_0x45ca24[_0x4310('0x44')]['id']}})[_0x4310('0x22')](handleEntityNotFound(_0x11917c,null))['then'](removeEntity(_0x11917c,null))['catch'](handleError(_0x11917c,null));};exports[_0x4310('0x4c')]=function(_0x14344e,_0x4d0e33){return db[_0x4310('0x2c')][_0x4310('0x4c')]()[_0x4310('0x22')](respondWithResult(_0x4d0e33,null))['catch'](handleError(_0x4d0e33,null));};exports['getQuestions']=function(_0x333812,_0x410ad8,_0x639442){var _0x4934ac={'raw':!![],'where':{}};var _0x86b352={};var _0x1d3223={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x4310('0x4d')]({'where':{'id':_0x333812['params']['id']}})['then'](handleEntityNotFound(_0x410ad8,null))[_0x4310('0x22')](function(_0xa7e1ce){if(_0xa7e1ce){_0x86b352['model']=_[_0x4310('0x31')](db[_0x4310('0x4e')][_0x4310('0x45')]);_0x86b352[_0x4310('0x30')]=_[_0x4310('0x31')](_0x333812[_0x4310('0x30')]);_0x86b352[_0x4310('0x32')]=_[_0x4310('0x33')](_0x86b352[_0x4310('0x2f')],_0x86b352[_0x4310('0x30')]);_0x4934ac['attributes']=_[_0x4310('0x33')](_0x86b352[_0x4310('0x2f')],qs[_0x4310('0x35')](_0x333812[_0x4310('0x30')][_0x4310('0x35')]));_0x4934ac[_0x4310('0x34')]=_0x4934ac['attributes'][_0x4310('0x46')]?_0x4934ac['attributes']:_0x86b352['model'];if(!_0x333812[_0x4310('0x30')]['hasOwnProperty'](_0x4310('0x37'))){_0x4934ac[_0x4310('0x1e')]=qs[_0x4310('0x1e')](_0x333812[_0x4310('0x30')][_0x4310('0x1e')]);_0x4934ac[_0x4310('0x1d')]=qs[_0x4310('0x1d')](_0x333812[_0x4310('0x30')][_0x4310('0x1d')]);}_0x4934ac[_0x4310('0x4f')]=qs['sort'](_0x333812['query'][_0x4310('0x38')]);_0x4934ac['where']=qs[_0x4310('0x32')](_[_0x4310('0x50')](_0x333812[_0x4310('0x30')],_0x86b352[_0x4310('0x32')]));_0x4934ac['where'][_0x4310('0x51')]=_0xa7e1ce['id'];if(_0x333812[_0x4310('0x30')][_0x4310('0x3a')]){_0x4934ac[_0x4310('0x39')]=_['merge'](_0x4934ac[_0x4310('0x39')],{'$or':_[_0x4310('0x2b')](_0x4934ac[_0x4310('0x34')],function(_0xb1d1ab){var _0x1ad507={};_0x1ad507[_0xb1d1ab]={'$like':'%'+_0x333812['query'][_0x4310('0x3a')]+'%'};return _0x1ad507;})});}_0x4934ac=_[_0x4310('0x3b')]({},_0x4934ac,_0x333812['options']);return db[_0x4310('0x4e')][_0x4310('0x3e')]({'where':_0x4934ac[_0x4310('0x39')]})[_0x4310('0x22')](function(_0x43bafd){_0x1d3223[_0x4310('0x3e')]=_0x43bafd;if(_0x333812[_0x4310('0x30')][_0x4310('0x3f')]){_0x4934ac[_0x4310('0x40')]=[{'all':!![]}];}return db[_0x4310('0x4e')][_0x4310('0x41')](_0x4934ac);})['then'](function(_0x51be76){_0x1d3223[_0x4310('0x42')]=_0x51be76;return _0x1d3223;});}})[_0x4310('0x22')](respondWithFilteredResult(_0x410ad8,_0x4934ac))[_0x4310('0x47')](handleError(_0x410ad8,null));}; \ No newline at end of file +var _0x3bc7=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3dd822,_0x3b9fed){var _0x4f58d0=function(_0x41be33){while(--_0x41be33){_0x3dd822['push'](_0x3dd822['shift']());}};_0x4f58d0(++_0x3b9fed);}(_0x3bc7,0x8f));var _0x73bc=function(_0x19ea33,_0x4a33bd){_0x19ea33=_0x19ea33-0x0;var _0x3a10f2=_0x3bc7[_0x19ea33];return _0x3a10f2;};'use strict';var pdf=require(_0x73bc('0x0'));var emlformat=require(_0x73bc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x73bc('0x2'));var jsonpatch=require(_0x73bc('0x3'));var rp=require('request-promise');var moment=require(_0x73bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73bc('0x5'));var util=require(_0x73bc('0x6'));var path=require('path');var sox=require(_0x73bc('0x7'));var csv=require(_0x73bc('0x8'));var ejs=require(_0x73bc('0x9'));var fs=require('fs');var _=require(_0x73bc('0xa'));var squel=require(_0x73bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x73bc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x73bc('0x8'));var querystring=require(_0x73bc('0xd'));var Papa=require(_0x73bc('0xe'));var Redis=require(_0x73bc('0xf'));var authService=require(_0x73bc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73bc('0x12'))(_0x73bc('0x13'));var utils=require(_0x73bc('0x14'));var config=require(_0x73bc('0x15'));var db=require(_0x73bc('0x16'))['db'];function respondWithStatusCode(_0x412e02,_0x3a858e){_0x3a858e=_0x3a858e||0xcc;return function(_0x4dbbb8){if(_0x4dbbb8){return _0x412e02['sendStatus'](_0x3a858e);}return _0x412e02[_0x73bc('0x17')](_0x3a858e)[_0x73bc('0x18')]();};}function respondWithResult(_0x451546,_0x1b7026){_0x1b7026=_0x1b7026||0xc8;return function(_0x588ecd){if(_0x588ecd){return _0x451546[_0x73bc('0x17')](_0x1b7026)[_0x73bc('0x19')](_0x588ecd);}};}function respondWithFilteredResult(_0x4edaad,_0x33fea3){return function(_0x49f055){if(_0x49f055){var _0x51d8e1=_0x49f055[_0x73bc('0x1a')],_0x38fe9c=_0x33fea3[_0x73bc('0x1b')],_0x5cadd1=_0x33fea3[_0x73bc('0x1b')]+_0x33fea3[_0x73bc('0x1c')],_0x1e1f10;if(_0x5cadd1>=_0x51d8e1){_0x5cadd1=_0x51d8e1;_0x1e1f10=0xc8;}else{_0x1e1f10=0xce;}_0x4edaad['status'](_0x1e1f10);return _0x4edaad['set']('Content-Range',_0x38fe9c+'-'+_0x5cadd1+'/'+_0x51d8e1)['json'](_0x49f055);}return null;};}function patchUpdates(_0x23b2a4){return function(_0x55d408){try{jsonpatch[_0x73bc('0x1d')](_0x55d408,_0x23b2a4,!![]);}catch(_0x4bd496){return BPromise[_0x73bc('0x1e')](_0x4bd496);}return _0x55d408[_0x73bc('0x1f')]();};}function saveUpdates(_0x2d18af,_0x43113c){return function(_0x1e22b1){if(_0x1e22b1){return _0x1e22b1[_0x73bc('0x20')](_0x2d18af)['then'](function(_0x4e2405){return _0x4e2405;});}return null;};}function removeEntity(_0x3ff8db,_0x350764){return function(_0x1fc783){if(_0x1fc783){return _0x1fc783[_0x73bc('0x21')]()[_0x73bc('0x22')](function(){_0x3ff8db[_0x73bc('0x17')](0xcc)[_0x73bc('0x18')]();});}};}function handleEntityNotFound(_0xef530b,_0x465ea0){return function(_0x47a51f){if(!_0x47a51f){_0xef530b[_0x73bc('0x23')](0x194);}return _0x47a51f;};}function handleError(_0x1f3706,_0x1c38db){_0x1c38db=_0x1c38db||0x1f4;return function(_0x352826){logger[_0x73bc('0x24')](_0x352826['stack']);if(_0x352826[_0x73bc('0x25')]){delete _0x352826[_0x73bc('0x25')];}_0x1f3706[_0x73bc('0x17')](_0x1c38db)[_0x73bc('0x26')](_0x352826);};}exports[_0x73bc('0x27')]=function(_0x159b9c,_0x1f3a78){var _0x3bb757={},_0xd8aa5a={},_0x14c86d={'count':0x0,'rows':[]};var _0x51f214=_['map'](db['JscriptySessionReport'][_0x73bc('0x28')],function(_0xa57aa1){return{'name':_0xa57aa1[_0x73bc('0x29')],'type':_0xa57aa1[_0x73bc('0x2a')][_0x73bc('0x2b')]};});_0xd8aa5a[_0x73bc('0x2c')]=_[_0x73bc('0x2d')](_0x51f214,_0x73bc('0x25'));_0xd8aa5a['query']=_[_0x73bc('0x2e')](_0x159b9c[_0x73bc('0x2f')]);_0xd8aa5a[_0x73bc('0x30')]=_['intersection'](_0xd8aa5a['model'],_0xd8aa5a[_0x73bc('0x2f')]);_0x3bb757[_0x73bc('0x31')]=_['intersection'](_0xd8aa5a[_0x73bc('0x2c')],qs[_0x73bc('0x32')](_0x159b9c[_0x73bc('0x2f')][_0x73bc('0x32')]));_0x3bb757[_0x73bc('0x31')]=_0x3bb757[_0x73bc('0x31')][_0x73bc('0x33')]?_0x3bb757[_0x73bc('0x31')]:_0xd8aa5a[_0x73bc('0x2c')];if(!_0x159b9c['query'][_0x73bc('0x34')](_0x73bc('0x35'))){_0x3bb757[_0x73bc('0x1c')]=qs['limit'](_0x159b9c[_0x73bc('0x2f')][_0x73bc('0x1c')]);_0x3bb757[_0x73bc('0x1b')]=qs[_0x73bc('0x1b')](_0x159b9c[_0x73bc('0x2f')]['offset']);}_0x3bb757['order']=qs['sort'](_0x159b9c[_0x73bc('0x2f')][_0x73bc('0x36')]);_0x3bb757[_0x73bc('0x37')]=qs[_0x73bc('0x30')](_[_0x73bc('0x38')](_0x159b9c[_0x73bc('0x2f')],_0xd8aa5a[_0x73bc('0x30')]),_0x51f214);if(_0x159b9c[_0x73bc('0x2f')][_0x73bc('0x39')]){_0x3bb757[_0x73bc('0x37')]=_['merge'](_0x3bb757[_0x73bc('0x37')],{'$or':_['map'](_0x51f214,function(_0x35f4f3){if(_0x35f4f3[_0x73bc('0x2a')]!=='VIRTUAL'){var _0x5a6ba6={};_0x5a6ba6[_0x35f4f3['name']]={'$like':'%'+_0x159b9c[_0x73bc('0x2f')][_0x73bc('0x39')]+'%'};return _0x5a6ba6;}})});}_0x3bb757=_[_0x73bc('0x3a')]({},_0x3bb757,_0x159b9c[_0x73bc('0x3b')]);var _0x2075ce={'where':_0x3bb757[_0x73bc('0x37')]};return db[_0x73bc('0x3c')][_0x73bc('0x1a')](_0x2075ce)['then'](function(_0x501303){_0x14c86d[_0x73bc('0x1a')]=_0x501303;if(_0x159b9c[_0x73bc('0x2f')][_0x73bc('0x3d')]){_0x3bb757[_0x73bc('0x3e')]=[{'all':!![]}];}return db[_0x73bc('0x3c')][_0x73bc('0x3f')](_0x3bb757);})['then'](function(_0x4d829f){_0x14c86d[_0x73bc('0x40')]=_0x4d829f;return _0x14c86d;})[_0x73bc('0x22')](respondWithFilteredResult(_0x1f3a78,_0x3bb757))['catch'](handleError(_0x1f3a78,null));};exports[_0x73bc('0x41')]=function(_0x2e946e,_0x2324f7){var _0x49072d={'raw':!![],'where':{'id':_0x2e946e[_0x73bc('0x42')]['id']}},_0xeae588={};_0xeae588['model']=_[_0x73bc('0x2e')](db[_0x73bc('0x3c')]['rawAttributes']);_0xeae588[_0x73bc('0x2f')]=_[_0x73bc('0x2e')](_0x2e946e[_0x73bc('0x2f')]);_0xeae588[_0x73bc('0x30')]=_[_0x73bc('0x43')](_0xeae588['model'],_0xeae588['query']);_0x49072d[_0x73bc('0x31')]=_['intersection'](_0xeae588[_0x73bc('0x2c')],qs[_0x73bc('0x32')](_0x2e946e['query'][_0x73bc('0x32')]));_0x49072d[_0x73bc('0x31')]=_0x49072d[_0x73bc('0x31')]['length']?_0x49072d[_0x73bc('0x31')]:_0xeae588[_0x73bc('0x2c')];if(_0x2e946e['query'][_0x73bc('0x3d')]){_0x49072d['include']=[{'all':!![]}];}_0x49072d=_[_0x73bc('0x3a')]({},_0x49072d,_0x2e946e['options']);return db['JscriptySessionReport'][_0x73bc('0x44')](_0x49072d)[_0x73bc('0x22')](handleEntityNotFound(_0x2324f7,null))[_0x73bc('0x22')](respondWithResult(_0x2324f7,null))['catch'](handleError(_0x2324f7,null));};exports[_0x73bc('0x45')]=function(_0x56b57d,_0x412ece){return db[_0x73bc('0x3c')][_0x73bc('0x45')](_0x56b57d[_0x73bc('0x46')],{})[_0x73bc('0x22')](respondWithResult(_0x412ece,0xc9))[_0x73bc('0x47')](handleError(_0x412ece,null));};exports[_0x73bc('0x20')]=function(_0x2580ed,_0x408cf1){if(_0x2580ed[_0x73bc('0x46')]['id']){delete _0x2580ed[_0x73bc('0x46')]['id'];}return db['JscriptySessionReport'][_0x73bc('0x44')]({'where':{'id':_0x2580ed[_0x73bc('0x42')]['id']}})[_0x73bc('0x22')](handleEntityNotFound(_0x408cf1,null))[_0x73bc('0x22')](saveUpdates(_0x2580ed[_0x73bc('0x46')],null))['then'](respondWithResult(_0x408cf1,null))['catch'](handleError(_0x408cf1,null));};exports[_0x73bc('0x21')]=function(_0x119c37,_0x335f74){return db['JscriptySessionReport']['find']({'where':{'id':_0x119c37[_0x73bc('0x42')]['id']}})[_0x73bc('0x22')](handleEntityNotFound(_0x335f74,null))[_0x73bc('0x22')](removeEntity(_0x335f74,null))[_0x73bc('0x47')](handleError(_0x335f74,null));};exports[_0x73bc('0x48')]=function(_0x58fcff,_0x20f970){return db[_0x73bc('0x3c')][_0x73bc('0x48')]()[_0x73bc('0x22')](respondWithResult(_0x20f970,null))[_0x73bc('0x47')](handleError(_0x20f970,null));};exports[_0x73bc('0x49')]=function(_0x16e5ca,_0x2ada10,_0x251654){var _0x31c85c={'raw':!![],'where':{}};var _0x4359be={};var _0x3a7986={'count':0x0,'rows':[]};return db[_0x73bc('0x3c')][_0x73bc('0x4a')]({'where':{'id':_0x16e5ca[_0x73bc('0x42')]['id']}})[_0x73bc('0x22')](handleEntityNotFound(_0x2ada10,null))[_0x73bc('0x22')](function(_0x3dd616){if(_0x3dd616){_0x4359be[_0x73bc('0x2c')]=_['keys'](db[_0x73bc('0x4b')]['rawAttributes']);_0x4359be[_0x73bc('0x2f')]=_[_0x73bc('0x2e')](_0x16e5ca[_0x73bc('0x2f')]);_0x4359be[_0x73bc('0x30')]=_[_0x73bc('0x43')](_0x4359be[_0x73bc('0x2c')],_0x4359be[_0x73bc('0x2f')]);_0x31c85c[_0x73bc('0x31')]=_[_0x73bc('0x43')](_0x4359be[_0x73bc('0x2c')],qs[_0x73bc('0x32')](_0x16e5ca[_0x73bc('0x2f')][_0x73bc('0x32')]));_0x31c85c[_0x73bc('0x31')]=_0x31c85c['attributes']['length']?_0x31c85c['attributes']:_0x4359be['model'];if(!_0x16e5ca['query']['hasOwnProperty']('nolimit')){_0x31c85c[_0x73bc('0x1c')]=qs[_0x73bc('0x1c')](_0x16e5ca[_0x73bc('0x2f')][_0x73bc('0x1c')]);_0x31c85c[_0x73bc('0x1b')]=qs[_0x73bc('0x1b')](_0x16e5ca[_0x73bc('0x2f')]['offset']);}_0x31c85c[_0x73bc('0x4c')]=qs['sort'](_0x16e5ca[_0x73bc('0x2f')][_0x73bc('0x36')]);_0x31c85c[_0x73bc('0x37')]=qs[_0x73bc('0x30')](_[_0x73bc('0x38')](_0x16e5ca['query'],_0x4359be[_0x73bc('0x30')]));_0x31c85c[_0x73bc('0x37')][_0x73bc('0x4d')]=_0x3dd616['id'];if(_0x16e5ca[_0x73bc('0x2f')][_0x73bc('0x39')]){_0x31c85c[_0x73bc('0x37')]=_[_0x73bc('0x3a')](_0x31c85c[_0x73bc('0x37')],{'$or':_[_0x73bc('0x2d')](_0x31c85c[_0x73bc('0x31')],function(_0x350df8){var _0x6ad664={};_0x6ad664[_0x350df8]={'$like':'%'+_0x16e5ca['query']['filter']+'%'};return _0x6ad664;})});}_0x31c85c=_[_0x73bc('0x3a')]({},_0x31c85c,_0x16e5ca[_0x73bc('0x3b')]);return db[_0x73bc('0x4b')][_0x73bc('0x1a')]({'where':_0x31c85c[_0x73bc('0x37')]})['then'](function(_0x4a5115){_0x3a7986[_0x73bc('0x1a')]=_0x4a5115;if(_0x16e5ca[_0x73bc('0x2f')]['includeAll']){_0x31c85c[_0x73bc('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x73bc('0x3f')](_0x31c85c);})[_0x73bc('0x22')](function(_0x5398e6){_0x3a7986['rows']=_0x5398e6;return _0x3a7986;});}})[_0x73bc('0x22')](respondWithFilteredResult(_0x2ada10,_0x31c85c))[_0x73bc('0x47')](handleError(_0x2ada10,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4f9dc6b..7223c1f 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 _0x553a=['bluebird','rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','moment'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x553a,0x192));var _0xa553=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x553a[_0x460666];return _0x555cbf;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var logger=require('../../config/logger')(_0xa553('0x1'));var moment=require(_0xa553('0x2'));var BPromise=require(_0xa553('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa553('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0xa553('0x5')]=function(_0x53190d,_0x5ddf5e){return _0x53190d[_0xa553('0x6')](_0xa553('0x7'),attributes,{'tableName':_0xa553('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x4af5d9,_0x1198c8){_0x4af5d9=_0x4af5d9-0x0;var _0xf6a1fd=_0x9bd9[_0x4af5d9];return _0xf6a1fd;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 7ed4ec3..36e5afc 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 _0xa3d2=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0xa3d2,0x84));var _0x2a3d=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xa3d2[_0x523adf];return _0x283870;};'use strict';var _=require(_0x2a3d('0x0'));var util=require(_0x2a3d('0x1'));var moment=require(_0x2a3d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a3d('0x4'))['db'];var utils=require(_0x2a3d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2a3d('0x6'));var jayson=require(_0x2a3d('0x7'));var client=jayson[_0x2a3d('0x8')][_0x2a3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x516e10,_0x28ede7,_0x302950){return new BPromise(function(_0x26bcb6,_0x1373d2){return client[_0x2a3d('0xa')](_0x516e10,_0x302950)['then'](function(_0x565532){logger[_0x2a3d('0xb')](_0x2a3d('0xc'),_0x28ede7,_0x2a3d('0xd'));logger[_0x2a3d('0xe')](_0x2a3d('0xf'),_0x28ede7,'request\x20sent',JSON['stringify'](_0x565532));if(_0x565532[_0x2a3d('0x10')]){if(_0x565532['error'][_0x2a3d('0x11')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x28ede7,_0x565532[_0x2a3d('0x10')][_0x2a3d('0x12')]);return _0x1373d2(_0x565532[_0x2a3d('0x10')][_0x2a3d('0x12')]);}logger[_0x2a3d('0x10')](_0x2a3d('0xc'),_0x28ede7,_0x565532[_0x2a3d('0x10')]['message']);return _0x26bcb6(_0x565532['error']['message']);}else{logger[_0x2a3d('0xb')](_0x2a3d('0xc'),_0x28ede7,_0x2a3d('0xd'));_0x26bcb6(_0x565532[_0x2a3d('0x13')][_0x2a3d('0x12')]);}})[_0x2a3d('0x14')](function(_0x11e2c7){logger['error'](_0x2a3d('0xc'),_0x28ede7,_0x11e2c7);_0x1373d2(_0x11e2c7);});});} \ No newline at end of file +var _0x5123=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x12e15a,_0x39f548){var _0x96ff4c=function(_0x1cfe66){while(--_0x1cfe66){_0x12e15a['push'](_0x12e15a['shift']());}};_0x96ff4c(++_0x39f548);}(_0x5123,0xb9));var _0x3512=function(_0x1f0ac0,_0x5f13d3){_0x1f0ac0=_0x1f0ac0-0x0;var _0x273ec8=_0x5123[_0x1f0ac0];return _0x273ec8;};'use strict';var _=require(_0x3512('0x0'));var util=require(_0x3512('0x1'));var moment=require(_0x3512('0x2'));var BPromise=require(_0x3512('0x3'));var rs=require(_0x3512('0x4'));var fs=require('fs');var Redis=require(_0x3512('0x5'));var db=require(_0x3512('0x6'))['db'];var utils=require(_0x3512('0x7'));var logger=require(_0x3512('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3512('0x9'));var client=jayson['client'][_0x3512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c13e,_0x1adada,_0x582706){return new BPromise(function(_0x3d5da5,_0x38b989){return client[_0x3512('0xb')](_0x29c13e,_0x582706)[_0x3512('0xc')](function(_0xbccd97){logger[_0x3512('0xd')](_0x3512('0xe'),_0x1adada,_0x3512('0xf'));logger[_0x3512('0x10')](_0x3512('0x11'),_0x1adada,'request\x20sent',JSON['stringify'](_0xbccd97));if(_0xbccd97[_0x3512('0x12')]){if(_0xbccd97[_0x3512('0x12')]['code']===0x1f4){logger[_0x3512('0x12')](_0x3512('0xe'),_0x1adada,_0xbccd97[_0x3512('0x12')][_0x3512('0x13')]);return _0x38b989(_0xbccd97['error'][_0x3512('0x13')]);}logger[_0x3512('0x12')](_0x3512('0xe'),_0x1adada,_0xbccd97[_0x3512('0x12')]['message']);return _0x3d5da5(_0xbccd97[_0x3512('0x12')][_0x3512('0x13')]);}else{logger[_0x3512('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x1adada,_0x3512('0xf'));_0x3d5da5(_0xbccd97[_0x3512('0x14')][_0x3512('0x13')]);}})[_0x3512('0x15')](function(_0x4a8e7e){logger[_0x3512('0x12')](_0x3512('0xe'),_0x1adada,_0x4a8e7e);_0x38b989(_0x4a8e7e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7712ece..150b1b2 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 _0xe258=['/:id','update','exports','multer','path','connect-timeout','Router','../../config/environment','./license.controller','index'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe258,0xdf));var _0x8e25=function(_0x13d3dc,_0x49d990){_0x13d3dc=_0x13d3dc-0x0;var _0x58c5a5=_0xe258[_0x13d3dc];return _0x58c5a5;};'use strict';var multer=require(_0x8e25('0x0'));var util=require('util');var path=require(_0x8e25('0x1'));var timeout=require(_0x8e25('0x2'));var express=require('express');var router=express[_0x8e25('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e25('0x4'));var controller=require(_0x8e25('0x5'));router['get']('/',controller[_0x8e25('0x6')]);router['put'](_0x8e25('0x7'),auth['isAuthenticated'](),controller[_0x8e25('0x8')]);module[_0x8e25('0x9')]=router; \ No newline at end of file +var _0x1bc2=['update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x1bc2,0x11f));var _0x21bc=function(_0x470383,_0x4e59c6){_0x470383=_0x470383-0x0;var _0x1df8d8=_0x1bc2[_0x470383];return _0x1df8d8;};'use strict';var multer=require(_0x21bc('0x0'));var util=require('util');var path=require(_0x21bc('0x1'));var timeout=require(_0x21bc('0x2'));var express=require(_0x21bc('0x3'));var router=express[_0x21bc('0x4')]();var auth=require(_0x21bc('0x5'));var interaction=require(_0x21bc('0x6'));var config=require(_0x21bc('0x7'));var controller=require(_0x21bc('0x8'));router[_0x21bc('0x9')]('/',controller['index']);router[_0x21bc('0xa')](_0x21bc('0xb'),auth[_0x21bc('0xc')](),controller[_0x21bc('0xd')]);module[_0x21bc('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index da97165..e25182a 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 _0x0295=['sequelize','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0295,0x1f0));var _0x5029=function(_0x1cef07,_0x1eb5f2){_0x1cef07=_0x1cef07-0x0;var _0x2f0a89=_0x0295[_0x1cef07];return _0x2f0a89;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x5029('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x5edb5e,_0x400999){var _0xed3a81=function(_0x17620d){while(--_0x17620d){_0x5edb5e['push'](_0x5edb5e['shift']());}};_0xed3a81(++_0x400999);}(_0x814b,0x1a2));var _0xb814=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x814b[_0x58a4ac];return _0x545810;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'license':{'type':Sequelize[_0xb814('0x2')]},'data1':{'type':Sequelize[_0xb814('0x3')]},'data2':{'type':Sequelize[_0xb814('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xb814('0x4')],'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 ce9ee4f..686c2d6 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 _0x7e77=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','body','License','find','params','checkLicense','demo','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x7e77,0x6a));var _0x77e7=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x7e77[_0x1589dd];return _0x1bddd1;};'use strict';var pdf=require(_0x77e7('0x0'));var emlformat=require(_0x77e7('0x1'));var rimraf=require(_0x77e7('0x2'));var zipdir=require(_0x77e7('0x3'));var jsonpatch=require(_0x77e7('0x4'));var rp=require(_0x77e7('0x5'));var moment=require(_0x77e7('0x6'));var BPromise=require(_0x77e7('0x7'));var Mustache=require(_0x77e7('0x8'));var util=require(_0x77e7('0x9'));var path=require(_0x77e7('0xa'));var sox=require(_0x77e7('0xb'));var csv=require(_0x77e7('0xc'));var ejs=require(_0x77e7('0xd'));var fs=require('fs');var _=require(_0x77e7('0xe'));var squel=require(_0x77e7('0xf'));var crypto=require(_0x77e7('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x77e7('0x11'));var toCsv=require(_0x77e7('0xc'));var querystring=require(_0x77e7('0x12'));var Papa=require('papaparse');var Redis=require(_0x77e7('0x13'));var authService=require(_0x77e7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x77e7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77e7('0x16'))(_0x77e7('0x17'));var utils=require(_0x77e7('0x18'));var config=require(_0x77e7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45644a,_0x276ca8){_0x276ca8=_0x276ca8||0xcc;return function(_0x510b3a){if(_0x510b3a){return _0x45644a[_0x77e7('0x1a')](_0x276ca8);}return _0x45644a[_0x77e7('0x1b')](_0x276ca8)['end']();};}function respondWithResult(_0x3b2882,_0x39ed4c){_0x39ed4c=_0x39ed4c||0xc8;return function(_0x450926){if(_0x450926){return _0x3b2882[_0x77e7('0x1b')](_0x39ed4c)[_0x77e7('0x1c')](_0x450926);}};}function respondWithFilteredResult(_0x12a12e,_0x3c5ccc){return function(_0x1ba8a0){if(_0x1ba8a0){var _0x55b34b=_0x1ba8a0['count'],_0x7e5d06=_0x3c5ccc[_0x77e7('0x1d')],_0x37857b=_0x3c5ccc[_0x77e7('0x1d')]+_0x3c5ccc['limit'],_0x6c5cab;if(_0x37857b>=_0x55b34b){_0x37857b=_0x55b34b;_0x6c5cab=0xc8;}else{_0x6c5cab=0xce;}_0x12a12e[_0x77e7('0x1b')](_0x6c5cab);return _0x12a12e[_0x77e7('0x1e')](_0x77e7('0x1f'),_0x7e5d06+'-'+_0x37857b+'/'+_0x55b34b)[_0x77e7('0x1c')](_0x1ba8a0);}return null;};}function patchUpdates(_0x5204b2){return function(_0x11d4a6){try{jsonpatch['apply'](_0x11d4a6,_0x5204b2,!![]);}catch(_0x2a3e9b){return BPromise['reject'](_0x2a3e9b);}return _0x11d4a6[_0x77e7('0x20')]();};}function saveUpdates(_0x3d80be,_0x12984){return function(_0x1dc576){if(_0x1dc576){return _0x1dc576[_0x77e7('0x21')](_0x3d80be)[_0x77e7('0x22')](function(_0x8395ac){return _0x8395ac;});}return null;};}function removeEntity(_0x339d29,_0x61e3ab){return function(_0x4faa1e){if(_0x4faa1e){return _0x4faa1e[_0x77e7('0x23')]()[_0x77e7('0x22')](function(){_0x339d29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10eac7,_0x5494e3){return function(_0x9e53cc){if(!_0x9e53cc){_0x10eac7[_0x77e7('0x1a')](0x194);}return _0x9e53cc;};}function handleError(_0x195607,_0x22b60e){_0x22b60e=_0x22b60e||0x1f4;return function(_0xcd3868){logger[_0x77e7('0x24')](_0xcd3868['stack']);if(_0xcd3868[_0x77e7('0x25')]){delete _0xcd3868[_0x77e7('0x25')];}_0x195607['status'](_0x22b60e)[_0x77e7('0x26')](_0xcd3868);};}var utilLicense=require('../../config/license/util');exports[_0x77e7('0x27')]=function(_0x348e90,_0x1263f4){var _0x5b3ca2={'raw':!![],'where':{'id':0x1}},_0x115979={};_0x115979[_0x77e7('0x28')]=_[_0x77e7('0x29')](db['License'][_0x77e7('0x2a')]);_0x115979[_0x77e7('0x2b')]=_[_0x77e7('0x29')](_0x348e90[_0x77e7('0x2b')]);_0x115979[_0x77e7('0x2c')]=_[_0x77e7('0x2d')](_0x115979[_0x77e7('0x28')],_0x115979[_0x77e7('0x2b')]);_0x5b3ca2[_0x77e7('0x2e')]=_[_0x77e7('0x2d')](_0x115979[_0x77e7('0x28')],qs[_0x77e7('0x2f')](_0x348e90[_0x77e7('0x2b')][_0x77e7('0x2f')]));_0x5b3ca2[_0x77e7('0x2e')]=_0x5b3ca2[_0x77e7('0x2e')][_0x77e7('0x30')]?_0x5b3ca2[_0x77e7('0x2e')]:_0x115979[_0x77e7('0x28')];_0x5b3ca2=_[_0x77e7('0x31')]({},_0x5b3ca2,_0x348e90[_0x77e7('0x32')]);return utilLicense[_0x77e7('0x33')](_0x5b3ca2)['then'](respondWithResult(_0x1263f4,null))['catch'](handleError(_0x1263f4,null));};exports[_0x77e7('0x21')]=function(_0x4a6958,_0x29b735){if(_0x4a6958[_0x77e7('0x34')]['id']){delete _0x4a6958[_0x77e7('0x34')]['id'];}return db[_0x77e7('0x35')][_0x77e7('0x36')]({'where':{'id':_0x4a6958[_0x77e7('0x37')]['id']}})[_0x77e7('0x22')](handleEntityNotFound(_0x29b735,null))[_0x77e7('0x22')](function(_0x314bb3){var _0xdd9ab=_0x314bb3['get']({'plain':!![]});return utilLicense[_0x77e7('0x38')](_0xdd9ab,_0x4a6958[_0x77e7('0x34')]['key']);})[_0x77e7('0x22')](function(_0x3ee46e){if(!_0x3ee46e[_0x77e7('0x39')]){return saveUpdates(_0x4a6958[_0x77e7('0x34')],null);}return _0x3ee46e;})[_0x77e7('0x22')](respondWithResult(_0x29b735,null))[_0x77e7('0x3a')](handleError(_0x29b735,null));}; \ No newline at end of file +var _0xeca4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','getLicense','body','find','params','get','checkLicense','key','demo','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x407ebf,_0x2b47f5){var _0x29d7db=function(_0x4a25bf){while(--_0x4a25bf){_0x407ebf['push'](_0x407ebf['shift']());}};_0x29d7db(++_0x2b47f5);}(_0xeca4,0x161));var _0x4eca=function(_0x5b0ec3,_0x1ed39e){_0x5b0ec3=_0x5b0ec3-0x0;var _0x5b9d43=_0xeca4[_0x5b0ec3];return _0x5b9d43;};'use strict';var pdf=require(_0x4eca('0x0'));var emlformat=require(_0x4eca('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4eca('0x2'));var jsonpatch=require(_0x4eca('0x3'));var rp=require(_0x4eca('0x4'));var moment=require(_0x4eca('0x5'));var BPromise=require(_0x4eca('0x6'));var Mustache=require(_0x4eca('0x7'));var util=require(_0x4eca('0x8'));var path=require(_0x4eca('0x9'));var sox=require(_0x4eca('0xa'));var csv=require(_0x4eca('0xb'));var ejs=require(_0x4eca('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4eca('0xd'));var crypto=require(_0x4eca('0xe'));var jsforce=require(_0x4eca('0xf'));var deskjs=require(_0x4eca('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4eca('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4eca('0x12'));var qs=require(_0x4eca('0x13'));var as=require(_0x4eca('0x14'));var hardwareService=require(_0x4eca('0x15'));var logger=require(_0x4eca('0x16'))(_0x4eca('0x17'));var utils=require(_0x4eca('0x18'));var config=require(_0x4eca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x405636,_0x819593){_0x819593=_0x819593||0xcc;return function(_0x597f5e){if(_0x597f5e){return _0x405636[_0x4eca('0x1a')](_0x819593);}return _0x405636[_0x4eca('0x1b')](_0x819593)[_0x4eca('0x1c')]();};}function respondWithResult(_0x5743ea,_0x2898cb){_0x2898cb=_0x2898cb||0xc8;return function(_0x3166a5){if(_0x3166a5){return _0x5743ea[_0x4eca('0x1b')](_0x2898cb)[_0x4eca('0x1d')](_0x3166a5);}};}function respondWithFilteredResult(_0x326b2d,_0x1b50c0){return function(_0x4cbc03){if(_0x4cbc03){var _0x46915a=_0x4cbc03['count'],_0x512685=_0x1b50c0[_0x4eca('0x1e')],_0x2386fd=_0x1b50c0[_0x4eca('0x1e')]+_0x1b50c0[_0x4eca('0x1f')],_0x567e09;if(_0x2386fd>=_0x46915a){_0x2386fd=_0x46915a;_0x567e09=0xc8;}else{_0x567e09=0xce;}_0x326b2d[_0x4eca('0x1b')](_0x567e09);return _0x326b2d[_0x4eca('0x20')](_0x4eca('0x21'),_0x512685+'-'+_0x2386fd+'/'+_0x46915a)[_0x4eca('0x1d')](_0x4cbc03);}return null;};}function patchUpdates(_0x1a1160){return function(_0x59c03b){try{jsonpatch[_0x4eca('0x22')](_0x59c03b,_0x1a1160,!![]);}catch(_0xf37509){return BPromise[_0x4eca('0x23')](_0xf37509);}return _0x59c03b['save']();};}function saveUpdates(_0x37b47c,_0x5e38c2){return function(_0x31a108){if(_0x31a108){return _0x31a108[_0x4eca('0x24')](_0x37b47c)[_0x4eca('0x25')](function(_0x5e1992){return _0x5e1992;});}return null;};}function removeEntity(_0x515ba3,_0x2f1080){return function(_0x523fbe){if(_0x523fbe){return _0x523fbe[_0x4eca('0x26')]()[_0x4eca('0x25')](function(){_0x515ba3[_0x4eca('0x1b')](0xcc)[_0x4eca('0x1c')]();});}};}function handleEntityNotFound(_0x523d84,_0xef22ab){return function(_0x186e0a){if(!_0x186e0a){_0x523d84[_0x4eca('0x1a')](0x194);}return _0x186e0a;};}function handleError(_0xaa95a4,_0x5cf101){_0x5cf101=_0x5cf101||0x1f4;return function(_0x3a2a11){logger[_0x4eca('0x27')](_0x3a2a11[_0x4eca('0x28')]);if(_0x3a2a11[_0x4eca('0x29')]){delete _0x3a2a11[_0x4eca('0x29')];}_0xaa95a4[_0x4eca('0x1b')](_0x5cf101)['send'](_0x3a2a11);};}var utilLicense=require('../../config/license/util');exports[_0x4eca('0x2a')]=function(_0x351a75,_0x1f1265){var _0x337985={'raw':!![],'where':{'id':0x1}},_0x4f9d63={};_0x4f9d63[_0x4eca('0x2b')]=_[_0x4eca('0x2c')](db[_0x4eca('0x2d')][_0x4eca('0x2e')]);_0x4f9d63[_0x4eca('0x2f')]=_[_0x4eca('0x2c')](_0x351a75[_0x4eca('0x2f')]);_0x4f9d63[_0x4eca('0x30')]=_[_0x4eca('0x31')](_0x4f9d63[_0x4eca('0x2b')],_0x4f9d63[_0x4eca('0x2f')]);_0x337985['attributes']=_[_0x4eca('0x31')](_0x4f9d63[_0x4eca('0x2b')],qs[_0x4eca('0x32')](_0x351a75[_0x4eca('0x2f')][_0x4eca('0x32')]));_0x337985[_0x4eca('0x33')]=_0x337985[_0x4eca('0x33')][_0x4eca('0x34')]?_0x337985['attributes']:_0x4f9d63['model'];_0x337985=_['merge']({},_0x337985,_0x351a75['options']);return utilLicense[_0x4eca('0x35')](_0x337985)[_0x4eca('0x25')](respondWithResult(_0x1f1265,null))['catch'](handleError(_0x1f1265,null));};exports['update']=function(_0x4fff8d,_0x59e2c4){if(_0x4fff8d[_0x4eca('0x36')]['id']){delete _0x4fff8d[_0x4eca('0x36')]['id'];}return db[_0x4eca('0x2d')][_0x4eca('0x37')]({'where':{'id':_0x4fff8d[_0x4eca('0x38')]['id']}})['then'](handleEntityNotFound(_0x59e2c4,null))[_0x4eca('0x25')](function(_0x49079e){var _0x26889e=_0x49079e[_0x4eca('0x39')]({'plain':!![]});return utilLicense[_0x4eca('0x3a')](_0x26889e,_0x4fff8d['body'][_0x4eca('0x3b')]);})[_0x4eca('0x25')](function(_0x4bf987){if(!_0x4bf987[_0x4eca('0x3c')]){return saveUpdates(_0x4fff8d[_0x4eca('0x36')],null);}return _0x4bf987;})['then'](respondWithResult(_0x59e2c4,null))[_0x4eca('0x3d')](handleError(_0x59e2c4,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 68700f8..2b50c04 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0xb10b,0x12a));var _0xbb10=function(_0x28f153,_0x4852ed){_0x28f153=_0x28f153-0x0;var _0x56b861=_0xb10b[_0x28f153];return _0x56b861;};'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')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xb10b,0x12a));var _0xbb10=function(_0x37d3e0,_0x51d1f4){_0x37d3e0=_0x37d3e0-0x0;var _0x5512a3=_0xb10b[_0x37d3e0];return _0x5512a3;};'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')]('License',attributes,{'tableName':_0xbb10('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 d5d4407..78fc4c0 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 _0x49aa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x176e33,_0x39fdb6){var _0xce99fd=function(_0x21a135){while(--_0x21a135){_0x176e33['push'](_0x176e33['shift']());}};_0xce99fd(++_0x39fdb6);}(_0x49aa,0x173));var _0xa49a=function(_0x324b63,_0x167613){_0x324b63=_0x324b63-0x0;var _0x1a3430=_0x49aa[_0x324b63];return _0x1a3430;};'use strict';var _=require(_0xa49a('0x0'));var util=require(_0xa49a('0x1'));var moment=require(_0xa49a('0x2'));var BPromise=require('bluebird');var rs=require(_0xa49a('0x3'));var fs=require('fs');var Redis=require(_0xa49a('0x4'));var db=require(_0xa49a('0x5'))['db'];var utils=require(_0xa49a('0x6'));var logger=require(_0xa49a('0x7'))(_0xa49a('0x8'));var config=require('../../config/environment');var jayson=require(_0xa49a('0x9'));var client=jayson[_0xa49a('0xa')][_0xa49a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40ea52,_0x16155a,_0x5e5aa7){return new BPromise(function(_0x5f2fa4,_0x4aef33){return client[_0xa49a('0xc')](_0x40ea52,_0x5e5aa7)[_0xa49a('0xd')](function(_0x76de4c){logger[_0xa49a('0xe')](_0xa49a('0xf'),_0x16155a,'request\x20sent');logger[_0xa49a('0x10')](_0xa49a('0x11'),_0x16155a,_0xa49a('0x12'),JSON[_0xa49a('0x13')](_0x76de4c));if(_0x76de4c[_0xa49a('0x14')]){if(_0x76de4c[_0xa49a('0x14')][_0xa49a('0x15')]===0x1f4){logger['error'](_0xa49a('0xf'),_0x16155a,_0x76de4c[_0xa49a('0x14')][_0xa49a('0x16')]);return _0x4aef33(_0x76de4c[_0xa49a('0x14')][_0xa49a('0x16')]);}logger[_0xa49a('0x14')](_0xa49a('0xf'),_0x16155a,_0x76de4c['error'][_0xa49a('0x16')]);return _0x5f2fa4(_0x76de4c[_0xa49a('0x14')][_0xa49a('0x16')]);}else{logger[_0xa49a('0xe')]('License,\x20%s,\x20%s',_0x16155a,_0xa49a('0x12'));_0x5f2fa4(_0x76de4c[_0xa49a('0x17')]['message']);}})[_0xa49a('0x18')](function(_0x274807){logger['error'](_0xa49a('0xf'),_0x16155a,_0x274807);_0x4aef33(_0x274807);});});} \ No newline at end of file +var _0xd138=['rpc','request','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','License,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb'];(function(_0x1e06c2,_0xed1164){var _0x5dc866=function(_0x652500){while(--_0x652500){_0x1e06c2['push'](_0x1e06c2['shift']());}};_0x5dc866(++_0xed1164);}(_0xd138,0x1dc));var _0x8d13=function(_0x3816f1,_0x3d14f9){_0x3816f1=_0x3816f1-0x0;var _0x541c4e=_0xd138[_0x3816f1];return _0x541c4e;};'use strict';var _=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var moment=require(_0x8d13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d13('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d13('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57ca7f,_0x317105,_0x296da6){return new BPromise(function(_0x1ab1f6,_0x5846d4){return client[_0x8d13('0x5')](_0x57ca7f,_0x296da6)['then'](function(_0x29a579){logger[_0x8d13('0x6')]('License,\x20%s,\x20%s',_0x317105,'request\x20sent');logger[_0x8d13('0x7')](_0x8d13('0x8'),_0x317105,_0x8d13('0x9'),JSON['stringify'](_0x29a579));if(_0x29a579[_0x8d13('0xa')]){if(_0x29a579[_0x8d13('0xa')][_0x8d13('0xb')]===0x1f4){logger['error'](_0x8d13('0xc'),_0x317105,_0x29a579[_0x8d13('0xa')][_0x8d13('0xd')]);return _0x5846d4(_0x29a579[_0x8d13('0xa')][_0x8d13('0xd')]);}logger[_0x8d13('0xa')](_0x8d13('0xc'),_0x317105,_0x29a579[_0x8d13('0xa')][_0x8d13('0xd')]);return _0x1ab1f6(_0x29a579['error'][_0x8d13('0xd')]);}else{logger['info'](_0x8d13('0xc'),_0x317105,_0x8d13('0x9'));_0x1ab1f6(_0x29a579['result'][_0x8d13('0xd')]);}})[_0x8d13('0xe')](function(_0x426cae){logger[_0x8d13('0xa')](_0x8d13('0xc'),_0x317105,_0x426cae);_0x5846d4(_0x426cae);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ddd6d64..b84bd15 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 _0xdc22=['getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers','getAnswers'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xdc22,0x92));var _0x2dc2=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0xdc22[_0x1757f2];return _0x5e7212;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2dc2('0x0'));var timeout=require('connect-timeout');var express=require(_0x2dc2('0x1'));var router=express[_0x2dc2('0x2')]();var auth=require(_0x2dc2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2dc2('0x4'));var controller=require(_0x2dc2('0x5'));router[_0x2dc2('0x6')]('/',auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x8')]);router[_0x2dc2('0x6')](_0x2dc2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2dc2('0x6')](_0x2dc2('0xa'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0xb')]);router[_0x2dc2('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x2dc2('0x6')](_0x2dc2('0xc'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0xd')]);router['get']('/:id/in_servers',auth[_0x2dc2('0x7')](),controller[_0x2dc2('0xe')]);router[_0x2dc2('0x6')](_0x2dc2('0xf'),auth[_0x2dc2('0x7')](),controller['getSmtp']);router[_0x2dc2('0x6')](_0x2dc2('0x10'),auth[_0x2dc2('0x7')](),controller['getInteractions']);router['get'](_0x2dc2('0x11'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x12')]);router['get'](_0x2dc2('0x13'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x14')]);router['get'](_0x2dc2('0x15'),auth['isAuthenticated'](),controller[_0x2dc2('0x16')]);router['get'](_0x2dc2('0x17'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x18')]);router[_0x2dc2('0x19')](_0x2dc2('0x1a'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x1b')]);router[_0x2dc2('0x19')](_0x2dc2('0xc'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x1c')]);router[_0x2dc2('0x19')]('/',auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x1d')]);router[_0x2dc2('0x19')](_0x2dc2('0x1e'),auth[_0x2dc2('0x7')](),controller['addImap']);router['post'](_0x2dc2('0xf'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x1f')]);router[_0x2dc2('0x19')](_0x2dc2('0x10'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x20')]);router[_0x2dc2('0x19')](_0x2dc2('0x11'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x21')]);router[_0x2dc2('0x19')](_0x2dc2('0x22'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x23')]);router[_0x2dc2('0x19')](_0x2dc2('0x17'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x2dc2('0xa'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x24')]);router[_0x2dc2('0x25')](_0x2dc2('0x1a'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x2dc2('0x25')](_0x2dc2('0xc'),auth[_0x2dc2('0x7')](),controller['removeAnswers']);router[_0x2dc2('0x25')](_0x2dc2('0x1e'),auth['isAuthenticated'](),controller['removeImap']);router[_0x2dc2('0x25')](_0x2dc2('0xf'),auth[_0x2dc2('0x7')](),controller['removeSmtp']);router[_0x2dc2('0x25')](_0x2dc2('0xa'),auth[_0x2dc2('0x7')](),controller[_0x2dc2('0x26')]);router[_0x2dc2('0x25')](_0x2dc2('0x17'),auth[_0x2dc2('0x7')](),controller['removeAgents']);module[_0x2dc2('0x27')]=router; \ No newline at end of file +var _0x424f=['removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','post','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers'];(function(_0x46d1fe,_0x5799cc){var _0xb4c964=function(_0x55949a){while(--_0x55949a){_0x46d1fe['push'](_0x46d1fe['shift']());}};_0xb4c964(++_0x5799cc);}(_0x424f,0x19d));var _0xf424=function(_0x170e43,_0x33121c){_0x170e43=_0x170e43-0x0;var _0x50c372=_0x424f[_0x170e43];return _0x50c372;};'use strict';var multer=require(_0xf424('0x0'));var util=require(_0xf424('0x1'));var path=require(_0xf424('0x2'));var timeout=require(_0xf424('0x3'));var express=require(_0xf424('0x4'));var router=express[_0xf424('0x5')]();var auth=require(_0xf424('0x6'));var interaction=require(_0xf424('0x7'));var config=require(_0xf424('0x8'));var controller=require(_0xf424('0x9'));router['get']('/',auth[_0xf424('0xa')](),controller[_0xf424('0xb')]);router[_0xf424('0xc')](_0xf424('0xd'),auth[_0xf424('0xa')](),controller['describe']);router[_0xf424('0xc')](_0xf424('0xe'),auth[_0xf424('0xa')](),controller[_0xf424('0xf')]);router[_0xf424('0xc')](_0xf424('0x10'),auth['isAuthenticated'](),controller[_0xf424('0x11')]);router[_0xf424('0xc')](_0xf424('0x12'),auth[_0xf424('0xa')](),controller['getAnswers']);router[_0xf424('0xc')](_0xf424('0x13'),auth['isAuthenticated'](),controller['getImap']);router[_0xf424('0xc')]('/:id/out_servers',auth[_0xf424('0xa')](),controller['getSmtp']);router[_0xf424('0xc')](_0xf424('0x14'),auth[_0xf424('0xa')](),controller[_0xf424('0x15')]);router['get'](_0xf424('0x16'),auth['isAuthenticated'](),controller[_0xf424('0x17')]);router[_0xf424('0xc')](_0xf424('0x18'),auth[_0xf424('0xa')](),controller[_0xf424('0x19')]);router['get'](_0xf424('0x1a'),auth['isAuthenticated'](),controller[_0xf424('0x1b')]);router['get'](_0xf424('0x1c'),auth['isAuthenticated'](),controller[_0xf424('0x1d')]);router['post'](_0xf424('0x10'),auth[_0xf424('0xa')](),controller[_0xf424('0x1e')]);router['post'](_0xf424('0x12'),auth[_0xf424('0xa')](),controller[_0xf424('0x1f')]);router[_0xf424('0x20')]('/',auth['isAuthenticated'](),controller[_0xf424('0x21')]);router['post'](_0xf424('0x13'),auth[_0xf424('0xa')](),controller[_0xf424('0x22')]);router[_0xf424('0x20')](_0xf424('0x23'),auth[_0xf424('0xa')](),controller[_0xf424('0x24')]);router['post']('/:id/interactions',auth[_0xf424('0xa')](),controller[_0xf424('0x25')]);router[_0xf424('0x20')](_0xf424('0x16'),auth[_0xf424('0xa')](),controller[_0xf424('0x26')]);router[_0xf424('0x20')](_0xf424('0x27'),auth[_0xf424('0xa')](),controller[_0xf424('0x28')]);router['post'](_0xf424('0x1c'),auth[_0xf424('0xa')](),controller[_0xf424('0x29')]);router[_0xf424('0x2a')]('/:id',auth['isAuthenticated'](),controller[_0xf424('0x2b')]);router[_0xf424('0x2c')](_0xf424('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf424('0x2c')](_0xf424('0x12'),auth['isAuthenticated'](),controller[_0xf424('0x2d')]);router[_0xf424('0x2c')](_0xf424('0x13'),auth[_0xf424('0xa')](),controller[_0xf424('0x2e')]);router[_0xf424('0x2c')](_0xf424('0x23'),auth['isAuthenticated'](),controller[_0xf424('0x2f')]);router[_0xf424('0x2c')]('/:id',auth['isAuthenticated'](),controller[_0xf424('0x30')]);router[_0xf424('0x2c')]('/:id/users',auth['isAuthenticated'](),controller[_0xf424('0x31')]);module[_0xf424('0x32')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 315444d..37968a3 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 _0xc8e8=['sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x22c38a,_0x2bb3f5){var _0xa83cc8=function(_0x15a6b6){while(--_0x15a6b6){_0x22c38a['push'](_0x22c38a['shift']());}};_0xa83cc8(++_0x2bb3f5);}(_0xc8e8,0x1ae));var _0x8c8e=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xc8e8[_0x487496];return _0x539dc8;};'use strict';var Sequelize=require(_0x8c8e('0x0'));module[_0x8c8e('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8c8e('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x8c8e('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8c8e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x8c8e('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8c8e('0x5');}},'notificationSound':{'type':Sequelize[_0x8c8e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8c8e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8c8e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8c8e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8c8e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c8e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x8c8e('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8c8e('0x8'),'set':function(_0x3d3084){if(!_0x3d3084)this['setDataValue'](_0x8c8e('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x3d3084);}}}; \ No newline at end of file +var _0x3aea=['setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2e93cc,_0x22f82d){var _0x37cddc=function(_0x306c56){while(--_0x306c56){_0x2e93cc['push'](_0x2e93cc['shift']());}};_0x37cddc(++_0x22f82d);}(_0x3aea,0xe5));var _0xa3ae=function(_0x528c81,_0x549728){_0x528c81=_0x528c81-0x0;var _0x120e31=_0x3aea[_0x528c81];return _0x120e31;};'use strict';var Sequelize=require(_0xa3ae('0x0'));module[_0xa3ae('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa3ae('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa3ae('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa3ae('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa3ae('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa3ae('0x4')]},'markAsUnread':{'type':Sequelize[_0xa3ae('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa3ae('0x2')],'allowNull':![],'defaultValue':_0xa3ae('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xa3ae('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa3ae('0x4')],'defaultValue':function(){return _0xa3ae('0x7');}},'notificationSound':{'type':Sequelize[_0xa3ae('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa3ae('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa3ae('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa3ae('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa3ae('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa3ae('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xa3ae('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa3ae('0x3')],'defaultValue':![],'comment':_0xa3ae('0xa'),'set':function(_0x438e12){if(!_0x438e12)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa3ae('0xb')]('mandatoryDisposition',_0x438e12);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ab1fa38..d25d680 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 _0xb225=['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','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','status','offset','limit','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','end','sendStatus','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','body','describe','find','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','filter','options','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','ListId','active','description','isNil','cauthentication','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','Contact','fullname','internal','Tag','Tags','color','tag','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','updatedAt','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','attach','out','Interaction','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','test'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0xb225,0x9e));var _0x5b22=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xb225[_0x1347f8];return _0x218368;};'use strict';var pdf=require(_0x5b22('0x0'));var emlformat=require(_0x5b22('0x1'));var rimraf=require(_0x5b22('0x2'));var zipdir=require(_0x5b22('0x3'));var jsonpatch=require(_0x5b22('0x4'));var rp=require(_0x5b22('0x5'));var moment=require(_0x5b22('0x6'));var BPromise=require(_0x5b22('0x7'));var Mustache=require(_0x5b22('0x8'));var util=require('util');var path=require(_0x5b22('0x9'));var sox=require(_0x5b22('0xa'));var csv=require(_0x5b22('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5b22('0xc'));var crypto=require('crypto');var jsforce=require(_0x5b22('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b22('0xe'));var Papa=require(_0x5b22('0xf'));var Redis=require(_0x5b22('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b22('0x11'));var logger=require(_0x5b22('0x12'))(_0x5b22('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5b22('0x14'))['db'];config[_0x5b22('0x15')]=_[_0x5b22('0x16')](config[_0x5b22('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b22('0x17'))(new Redis(config[_0x5b22('0x15')]));require(_0x5b22('0x18'))[_0x5b22('0x19')](socket);var jayson=require(_0x5b22('0x1a'));var client=jayson[_0x5b22('0x1b')][_0x5b22('0x1c')]({'port':0x232b});function checkPasswordPattern(_0xd6baa5,_0x2fe7a7,_0x4831c6){if(_0x4831c6){var _0x3a2628=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a2628[_0x5b22('0x1d')](_0x2fe7a7)){return _0xd6baa5;}else{throw new db[(_0x5b22('0x1e'))][(_0x5b22('0x1f'))](_0x5b22('0x20'));}}else{return _0xd6baa5;}}function respondWithRpcPromise(_0x109b80,_0x14486d,_0x3117d5,_0x35953f){return new BPromise(function(_0x1c2f13,_0x5e4814){var _0x70650f=_0x35953f||client;return _0x70650f[_0x5b22('0x21')](_0x109b80,_0x3117d5)[_0x5b22('0x22')](function(_0x35af13){logger['info']('MailAccount,\x20%s,\x20%s',_0x14486d,_0x5b22('0x23'));logger[_0x5b22('0x24')](_0x5b22('0x25'),_0x14486d,_0x5b22('0x23'),JSON[_0x5b22('0x26')](_0x35af13));if(_0x35af13[_0x5b22('0x27')]){if(_0x35af13['error'][_0x5b22('0x28')]===0x1f4){logger['error'](_0x5b22('0x29'),_0x14486d,_0x35af13[_0x5b22('0x27')]['message']);return _0x5e4814(_0x35af13['error']['message']);}logger[_0x5b22('0x27')](_0x5b22('0x29'),_0x14486d,_0x35af13['error'][_0x5b22('0x2a')]);return _0x1c2f13(_0x35af13[_0x5b22('0x27')][_0x5b22('0x2a')]);}else{logger[_0x5b22('0x2b')](_0x5b22('0x29'),_0x14486d,_0x5b22('0x23'));_0x1c2f13(_0x35af13[_0x5b22('0x2c')][_0x5b22('0x2a')]);}})['catch'](function(_0x3c16d7){logger[_0x5b22('0x27')](_0x5b22('0x29'),_0x14486d,_0x3c16d7);_0x5e4814(_0x3c16d7);});});}function respondWithStatusCode(_0x5ce66c,_0x4d2250){_0x4d2250=_0x4d2250||0xcc;return function(_0x15f395){if(_0x15f395){return _0x5ce66c['sendStatus'](_0x4d2250);}return _0x5ce66c['status'](_0x4d2250)['end']();};}function respondWithResult(_0x43cfa7,_0xf6ca77){_0xf6ca77=_0xf6ca77||0xc8;return function(_0x54161c){if(_0x54161c){return _0x43cfa7[_0x5b22('0x2d')](_0xf6ca77)['json'](_0x54161c);}};}function respondWithFilteredResult(_0x49b251,_0x697169){return function(_0x20bc2f){if(_0x20bc2f){var _0x29195e=_0x20bc2f['count'],_0x2274aa=_0x697169[_0x5b22('0x2e')],_0x317b18=_0x697169['offset']+_0x697169[_0x5b22('0x2f')],_0x22b978;if(_0x317b18>=_0x29195e){_0x317b18=_0x29195e;_0x22b978=0xc8;}else{_0x22b978=0xce;}_0x49b251['status'](_0x22b978);return _0x49b251['set']('Content-Range',_0x2274aa+'-'+_0x317b18+'/'+_0x29195e)['json'](_0x20bc2f);}return null;};}function patchUpdates(_0x1945a1){return function(_0x399282){try{jsonpatch[_0x5b22('0x30')](_0x399282,_0x1945a1,!![]);}catch(_0x455a23){return BPromise[_0x5b22('0x31')](_0x455a23);}return _0x399282[_0x5b22('0x32')]();};}function saveUpdates(_0x41a8dc,_0x52b49a){return function(_0x14d335){if(_0x14d335){return _0x14d335[_0x5b22('0x33')](_0x41a8dc)[_0x5b22('0x22')](function(_0x2f273f){return _0x2f273f;});}return null;};}function removeEntity(_0x26473e,_0x1de6ec){return function(_0x3dac06){if(_0x3dac06){return _0x3dac06[_0x5b22('0x34')]()[_0x5b22('0x22')](function(){var _0xc52419=_0x3dac06['get']({'plain':!![]});var _0x476948=_0x5b22('0x35');return db[_0x5b22('0x36')]['destroy']({'where':{'type':_0x476948,'resourceId':_0xc52419['id']}})[_0x5b22('0x22')](function(){return _0x3dac06;});})[_0x5b22('0x22')](function(){_0x26473e['status'](0xcc)[_0x5b22('0x37')]();});}};}function handleEntityNotFound(_0x5463dd,_0x3ff3fd){return function(_0x1461c5){if(!_0x1461c5){_0x5463dd[_0x5b22('0x38')](0x194);}return _0x1461c5;};}function handleError(_0x1f518a,_0x4a6e3d){_0x4a6e3d=_0x4a6e3d||0x1f4;return function(_0x58fd70){logger[_0x5b22('0x27')](_0x58fd70['stack']);if(_0x58fd70[_0x5b22('0x39')]){delete _0x58fd70[_0x5b22('0x39')];}_0x1f518a[_0x5b22('0x2d')](_0x4a6e3d)[_0x5b22('0x3a')](_0x58fd70);};}exports[_0x5b22('0x3b')]=function(_0x2c35c9,_0x5e667c){var _0xd1aabd={'include':[{'model':db[_0x5b22('0x3c')],'as':_0x5b22('0x3d')},{'model':db[_0x5b22('0x3e')],'as':_0x5b22('0x3f')},{'model':db[_0x5b22('0x40')],'as':_0x5b22('0x41')}]},_0x10bbfe={},_0xccd907={'count':0x0,'rows':[]};var _0x2f4d28=_['map'](db[_0x5b22('0x42')][_0x5b22('0x43')],function(_0x386b4b){return{'name':_0x386b4b[_0x5b22('0x44')],'type':_0x386b4b[_0x5b22('0x45')][_0x5b22('0x46')]};});_0x10bbfe[_0x5b22('0x47')]=_[_0x5b22('0x48')](_0x2f4d28,_0x5b22('0x39'));_0x10bbfe[_0x5b22('0x49')]=_['keys'](_0x2c35c9[_0x5b22('0x49')]);_0x10bbfe[_0x5b22('0x4a')]=_[_0x5b22('0x4b')](_0x10bbfe['model'],_0x10bbfe['query']);_0xd1aabd[_0x5b22('0x4c')]=_[_0x5b22('0x4b')](_0x10bbfe[_0x5b22('0x47')],qs[_0x5b22('0x4d')](_0x2c35c9[_0x5b22('0x49')][_0x5b22('0x4d')]));_0xd1aabd[_0x5b22('0x4c')]=_0xd1aabd[_0x5b22('0x4c')][_0x5b22('0x4e')]?_0xd1aabd[_0x5b22('0x4c')]:_0x10bbfe[_0x5b22('0x47')];if(!_0x2c35c9[_0x5b22('0x49')]['hasOwnProperty'](_0x5b22('0x4f'))){_0xd1aabd[_0x5b22('0x2f')]=qs[_0x5b22('0x2f')](_0x2c35c9[_0x5b22('0x49')][_0x5b22('0x2f')]);_0xd1aabd[_0x5b22('0x2e')]=qs[_0x5b22('0x2e')](_0x2c35c9[_0x5b22('0x49')][_0x5b22('0x2e')]);}_0xd1aabd[_0x5b22('0x50')]=qs[_0x5b22('0x51')](_0x2c35c9[_0x5b22('0x49')][_0x5b22('0x51')]);_0xd1aabd[_0x5b22('0x52')]=qs[_0x5b22('0x4a')](_[_0x5b22('0x53')](_0x2c35c9[_0x5b22('0x49')],_0x10bbfe[_0x5b22('0x4a')]),_0x2f4d28);if(_0x2c35c9[_0x5b22('0x49')]['filter']){_0xd1aabd['where']=_[_0x5b22('0x54')](_0xd1aabd['where'],{'$or':_[_0x5b22('0x48')](_0x2f4d28,function(_0x5ec0dd){if(_0x5ec0dd['type']!=='VIRTUAL'){var _0x18d71c={};_0x18d71c[_0x5ec0dd[_0x5b22('0x39')]]={'$like':'%'+_0x2c35c9['query']['filter']+'%'};return _0x18d71c;}})});}_0xd1aabd=_[_0x5b22('0x54')]({},_0xd1aabd,_0x2c35c9['options']);var _0x2205b5={'where':_0xd1aabd['where']};return db['MailAccount'][_0x5b22('0x55')](_0x2205b5)[_0x5b22('0x22')](function(_0x532de1){_0xccd907[_0x5b22('0x55')]=_0x532de1;if(_0x2c35c9[_0x5b22('0x49')][_0x5b22('0x56')]){_0xd1aabd[_0x5b22('0x57')]=[{'all':!![]}];}return db[_0x5b22('0x42')][_0x5b22('0x58')](_0xd1aabd);})[_0x5b22('0x22')](function(_0x131f74){_0xccd907[_0x5b22('0x59')]=_0x131f74;return _0xccd907;})['then'](respondWithFilteredResult(_0x5e667c,_0xd1aabd))[_0x5b22('0x5a')](handleError(_0x5e667c,null));};exports[_0x5b22('0x5b')]=function(_0x5978b5,_0x149ace){var _0xae7810={'raw':![],'where':{'id':_0x5978b5[_0x5b22('0x5c')]['id']},'include':[{'model':db[_0x5b22('0x3c')],'as':_0x5b22('0x3d')},{'model':db[_0x5b22('0x3e')],'as':_0x5b22('0x3f')},{'model':db['Pause'],'as':_0x5b22('0x41')}]},_0x11a5a7={};_0x11a5a7['model']=_[_0x5b22('0x5d')](db[_0x5b22('0x42')][_0x5b22('0x43')]);_0x11a5a7[_0x5b22('0x49')]=_[_0x5b22('0x5d')](_0x5978b5[_0x5b22('0x49')]);_0x11a5a7[_0x5b22('0x4a')]=_[_0x5b22('0x4b')](_0x11a5a7[_0x5b22('0x47')],_0x11a5a7[_0x5b22('0x49')]);_0xae7810[_0x5b22('0x4c')]=_[_0x5b22('0x4b')](_0x11a5a7['model'],qs['fields'](_0x5978b5[_0x5b22('0x49')][_0x5b22('0x4d')]));_0xae7810[_0x5b22('0x4c')]=_0xae7810[_0x5b22('0x4c')][_0x5b22('0x4e')]?_0xae7810[_0x5b22('0x4c')]:_0x11a5a7['model'];if(_0x5978b5[_0x5b22('0x49')][_0x5b22('0x56')]){_0xae7810[_0x5b22('0x57')]=[{'all':!![]}];}_0xae7810=_['merge']({},_0xae7810,_0x5978b5['options']);return db[_0x5b22('0x42')]['find'](_0xae7810)['then'](handleEntityNotFound(_0x149ace,null))[_0x5b22('0x22')](respondWithResult(_0x149ace,null))[_0x5b22('0x5a')](handleError(_0x149ace,null));};exports[_0x5b22('0x33')]=function(_0x1f492c,_0x5e420f){if(_0x1f492c[_0x5b22('0x5e')]['id']){delete _0x1f492c[_0x5b22('0x5e')]['id'];}return db[_0x5b22('0x42')]['find']({'where':{'id':_0x1f492c[_0x5b22('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x5b22('0x3d')},{'model':db[_0x5b22('0x3e')],'as':_0x5b22('0x3f')},{'model':db[_0x5b22('0x40')],'as':_0x5b22('0x41')}]})[_0x5b22('0x22')](handleEntityNotFound(_0x5e420f,null))[_0x5b22('0x22')](saveUpdates(_0x1f492c['body'],null))[_0x5b22('0x22')](function(_0x318b3a){if(_0x318b3a&&_0x1f492c[_0x5b22('0x5e')][_0x5b22('0x3d')]){return db[_0x5b22('0x3c')]['update'](_0x1f492c[_0x5b22('0x5e')][_0x5b22('0x3d')],{'where':{'MailAccountId':_0x318b3a['id']}})['then'](function(){return _0x318b3a;});}return _0x318b3a;})[_0x5b22('0x22')](function(_0x32510f){if(_0x32510f&&_0x1f492c['body']['Smtp']){return db[_0x5b22('0x3e')][_0x5b22('0x33')](_0x1f492c[_0x5b22('0x5e')][_0x5b22('0x3f')],{'where':{'MailAccountId':_0x32510f['id']}})[_0x5b22('0x22')](function(){return _0x32510f;});}return _0x32510f;})['then'](respondWithResult(_0x5e420f,null))[_0x5b22('0x5a')](handleError(_0x5e420f,null));};exports[_0x5b22('0x5f')]=function(_0x26d08a,_0x692bcb){return db[_0x5b22('0x42')][_0x5b22('0x5f')]()[_0x5b22('0x22')](respondWithResult(_0x692bcb,null))['catch'](handleError(_0x692bcb,null));};exports['addDisposition']=function(_0x67f453,_0x18fa65,_0x1b7741){if(_0x67f453[_0x5b22('0x5e')]['id']){delete _0x67f453['body']['id'];}return db[_0x5b22('0x42')][_0x5b22('0x60')]({'where':{'id':_0x67f453['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x18fa65,null))[_0x5b22('0x22')](function(_0x6027e7){if(_0x6027e7){_0x67f453[_0x5b22('0x5e')][_0x5b22('0x61')]=_0x6027e7['id'];return db[_0x5b22('0x62')][_0x5b22('0x63')](_0x67f453[_0x5b22('0x5e')]);}})['then'](respondWithResult(_0x18fa65,null))[_0x5b22('0x5a')](handleError(_0x18fa65,null));};exports[_0x5b22('0x64')]=function(_0x26b03b,_0x4ebe39,_0x133392){var _0x4f0a8b={'raw':![],'where':{}};var _0x41fe02={};var _0x75acad={'count':0x0,'rows':[]};return db[_0x5b22('0x42')][_0x5b22('0x65')]({'where':{'id':_0x26b03b[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x4ebe39,null))['then'](function(_0x1f0971){if(_0x1f0971){_0x41fe02['model']=_[_0x5b22('0x5d')](db[_0x5b22('0x62')][_0x5b22('0x43')]);_0x41fe02[_0x5b22('0x49')]=_['keys'](_0x26b03b[_0x5b22('0x49')]);_0x41fe02[_0x5b22('0x4a')]=_[_0x5b22('0x4b')](_0x41fe02[_0x5b22('0x47')],_0x41fe02[_0x5b22('0x49')]);_0x4f0a8b[_0x5b22('0x4c')]=_['intersection'](_0x41fe02[_0x5b22('0x47')],qs[_0x5b22('0x4d')](_0x26b03b[_0x5b22('0x49')][_0x5b22('0x4d')]));_0x4f0a8b['attributes']=_0x4f0a8b[_0x5b22('0x4c')]['length']?_0x4f0a8b[_0x5b22('0x4c')]:_0x41fe02['model'];if(!_0x26b03b[_0x5b22('0x49')][_0x5b22('0x66')](_0x5b22('0x4f'))){_0x4f0a8b[_0x5b22('0x2f')]=qs[_0x5b22('0x2f')](_0x26b03b[_0x5b22('0x49')][_0x5b22('0x2f')]);_0x4f0a8b[_0x5b22('0x2e')]=qs['offset'](_0x26b03b['query'][_0x5b22('0x2e')]);}_0x4f0a8b[_0x5b22('0x50')]=qs[_0x5b22('0x51')](_0x26b03b[_0x5b22('0x49')][_0x5b22('0x51')]);_0x4f0a8b[_0x5b22('0x52')]=qs[_0x5b22('0x4a')](_[_0x5b22('0x53')](_0x26b03b[_0x5b22('0x49')],_0x41fe02['filters']));_0x4f0a8b[_0x5b22('0x52')]['MailAccountId']=_0x1f0971['id'];if(_0x26b03b[_0x5b22('0x49')]['filter']){_0x4f0a8b[_0x5b22('0x52')]=_[_0x5b22('0x54')](_0x4f0a8b[_0x5b22('0x52')],{'$or':_[_0x5b22('0x48')](_0x4f0a8b[_0x5b22('0x4c')],function(_0x59563d){var _0x37ce44={};_0x37ce44[_0x59563d]={'$like':'%'+_0x26b03b[_0x5b22('0x49')][_0x5b22('0x67')]+'%'};return _0x37ce44;})});}_0x4f0a8b=_[_0x5b22('0x54')]({},_0x4f0a8b,_0x26b03b[_0x5b22('0x68')]);return db[_0x5b22('0x62')][_0x5b22('0x55')]({'where':_0x4f0a8b['where']})[_0x5b22('0x22')](function(_0x102a35){_0x75acad[_0x5b22('0x55')]=_0x102a35;if(_0x26b03b[_0x5b22('0x49')][_0x5b22('0x56')]){_0x4f0a8b[_0x5b22('0x57')]=[{'all':!![]}];}return db[_0x5b22('0x62')][_0x5b22('0x58')](_0x4f0a8b);})[_0x5b22('0x22')](function(_0x367748){_0x75acad[_0x5b22('0x59')]=_0x367748;return _0x75acad;});}})[_0x5b22('0x22')](respondWithFilteredResult(_0x4ebe39,_0x4f0a8b))['catch'](handleError(_0x4ebe39,null));};exports[_0x5b22('0x69')]=function(_0x1a9015,_0x5188db,_0x261517){return db[_0x5b22('0x42')][_0x5b22('0x60')]({'where':{'id':_0x1a9015['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x5188db,null))['then'](function(_0xe140c3){if(_0xe140c3){return _0xe140c3['removeDispositions'](_0x1a9015[_0x5b22('0x49')][_0x5b22('0x6a')]);}})['then'](respondWithStatusCode(_0x5188db,null))[_0x5b22('0x5a')](handleError(_0x5188db,null));};exports[_0x5b22('0x6b')]=function(_0x2adc79,_0xba94c7,_0x22aaa0){if(_0x2adc79['body']['id']){delete _0x2adc79[_0x5b22('0x5e')]['id'];}return db[_0x5b22('0x42')][_0x5b22('0x60')]({'where':{'id':_0x2adc79['params']['id']}})['then'](handleEntityNotFound(_0xba94c7,null))[_0x5b22('0x22')](function(_0x309cab){if(_0x309cab){_0x2adc79[_0x5b22('0x5e')]['MailAccountId']=_0x309cab['id'];return db[_0x5b22('0x6c')]['create'](_0x2adc79[_0x5b22('0x5e')]);}})['then'](respondWithResult(_0xba94c7,null))[_0x5b22('0x5a')](handleError(_0xba94c7,null));};exports['getAnswers']=function(_0xdba0fd,_0x3cfc3c,_0x252ce3){var _0x2e1784={'raw':![],'where':{}};var _0x5a09d8={};var _0x15cb47={'count':0x0,'rows':[]};return db[_0x5b22('0x42')][_0x5b22('0x65')]({'where':{'id':_0xdba0fd['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x3cfc3c,null))[_0x5b22('0x22')](function(_0x571e5f){if(_0x571e5f){_0x5a09d8[_0x5b22('0x47')]=_[_0x5b22('0x5d')](db[_0x5b22('0x6c')][_0x5b22('0x43')]);_0x5a09d8[_0x5b22('0x49')]=_[_0x5b22('0x5d')](_0xdba0fd[_0x5b22('0x49')]);_0x5a09d8[_0x5b22('0x4a')]=_['intersection'](_0x5a09d8[_0x5b22('0x47')],_0x5a09d8[_0x5b22('0x49')]);_0x2e1784[_0x5b22('0x4c')]=_['intersection'](_0x5a09d8['model'],qs[_0x5b22('0x4d')](_0xdba0fd[_0x5b22('0x49')][_0x5b22('0x4d')]));_0x2e1784[_0x5b22('0x4c')]=_0x2e1784['attributes'][_0x5b22('0x4e')]?_0x2e1784[_0x5b22('0x4c')]:_0x5a09d8[_0x5b22('0x47')];if(!_0xdba0fd[_0x5b22('0x49')][_0x5b22('0x66')]('nolimit')){_0x2e1784['limit']=qs[_0x5b22('0x2f')](_0xdba0fd[_0x5b22('0x49')][_0x5b22('0x2f')]);_0x2e1784['offset']=qs[_0x5b22('0x2e')](_0xdba0fd['query'][_0x5b22('0x2e')]);}_0x2e1784[_0x5b22('0x50')]=qs[_0x5b22('0x51')](_0xdba0fd['query']['sort']);_0x2e1784[_0x5b22('0x52')]=qs[_0x5b22('0x4a')](_[_0x5b22('0x53')](_0xdba0fd['query'],_0x5a09d8[_0x5b22('0x4a')]));_0x2e1784[_0x5b22('0x52')][_0x5b22('0x61')]=_0x571e5f['id'];if(_0xdba0fd[_0x5b22('0x49')][_0x5b22('0x67')]){_0x2e1784[_0x5b22('0x52')]=_[_0x5b22('0x54')](_0x2e1784['where'],{'$or':_[_0x5b22('0x48')](_0x2e1784[_0x5b22('0x4c')],function(_0x1b38c3){var _0x508867={};_0x508867[_0x1b38c3]={'$like':'%'+_0xdba0fd[_0x5b22('0x49')][_0x5b22('0x67')]+'%'};return _0x508867;})});}_0x2e1784=_[_0x5b22('0x54')]({},_0x2e1784,_0xdba0fd[_0x5b22('0x68')]);return db[_0x5b22('0x6c')]['count']({'where':_0x2e1784[_0x5b22('0x52')]})[_0x5b22('0x22')](function(_0xc31ec6){_0x15cb47[_0x5b22('0x55')]=_0xc31ec6;if(_0xdba0fd[_0x5b22('0x49')]['includeAll']){_0x2e1784[_0x5b22('0x57')]=[{'all':!![]}];}return db[_0x5b22('0x6c')][_0x5b22('0x58')](_0x2e1784);})[_0x5b22('0x22')](function(_0x2701a3){_0x15cb47[_0x5b22('0x59')]=_0x2701a3;return _0x15cb47;});}})[_0x5b22('0x22')](respondWithFilteredResult(_0x3cfc3c,_0x2e1784))[_0x5b22('0x5a')](handleError(_0x3cfc3c,null));};exports[_0x5b22('0x6d')]=function(_0x477430,_0x2d0e17,_0x3ba214){return db[_0x5b22('0x42')]['find']({'where':{'id':_0x477430[_0x5b22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2d0e17,null))['then'](function(_0x18836e){if(_0x18836e){return _0x18836e[_0x5b22('0x6d')](_0x477430['query'][_0x5b22('0x6a')]);}})[_0x5b22('0x22')](respondWithStatusCode(_0x2d0e17,null))[_0x5b22('0x5a')](handleError(_0x2d0e17,null));};exports[_0x5b22('0x63')]=function(_0x13b824,_0x597a40){var _0x317425={'name':_0x13b824[_0x5b22('0x5e')]['name'],'key':_0x13b824[_0x5b22('0x5e')][_0x5b22('0x46')],'email':_0x13b824[_0x5b22('0x5e')]['email'],'ListId':_0x13b824[_0x5b22('0x5e')][_0x5b22('0x6e')],'active':!_['isNil'](_0x13b824['body']['active'])?_0x13b824['body'][_0x5b22('0x6f')]:!![],'description':_0x13b824['body'][_0x5b22('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x5b22('0x71')](_0x13b824['body']['cservice'])){if(_0x13b824[_0x5b22('0x5e')][_0x5b22('0x72')]){_0x317425[_0x5b22('0x3d')][_0x5b22('0x73')]=_0x317425['Smtp']['user']=_0x13b824['body'][_0x5b22('0x74')];_0x317425[_0x5b22('0x3d')][_0x5b22('0x75')]=_0x317425[_0x5b22('0x3f')][_0x5b22('0x76')]=_0x13b824[_0x5b22('0x5e')]['cpassword'];}else{_0x317425[_0x5b22('0x3d')][_0x5b22('0x77')]=_0x317425['Smtp'][_0x5b22('0x77')]=![];}_0x317425[_0x5b22('0x3d')]['host']=_0x13b824['body'][_0x5b22('0x3d')][_0x5b22('0x78')];_0x317425['Imap'][_0x5b22('0x79')]=_0x13b824[_0x5b22('0x5e')][_0x5b22('0x3d')][_0x5b22('0x79')];_0x317425['Smtp'][_0x5b22('0x78')]=_0x13b824[_0x5b22('0x5e')][_0x5b22('0x3f')]['host'];_0x317425[_0x5b22('0x3f')][_0x5b22('0x79')]=_0x13b824['body']['Smtp'][_0x5b22('0x79')];}else{_0x317425['Imap'][_0x5b22('0x7a')]=_0x317425['Smtp'][_0x5b22('0x7a')]=_0x13b824[_0x5b22('0x5e')][_0x5b22('0x7b')];_0x317425[_0x5b22('0x3d')][_0x5b22('0x73')]=_0x317425[_0x5b22('0x3f')][_0x5b22('0x73')]=_0x13b824[_0x5b22('0x5e')][_0x5b22('0x74')];_0x317425[_0x5b22('0x3d')][_0x5b22('0x75')]=_0x317425['Smtp'][_0x5b22('0x76')]=_0x13b824[_0x5b22('0x5e')][_0x5b22('0x7c')];}return db['MailAccount']['create'](_0x317425,{'include':[{'model':db[_0x5b22('0x3e')],'as':_0x5b22('0x3f')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x5b22('0x22')](function(_0x41c2f2){var _0x53f980=_0x13b824[_0x5b22('0x73')][_0x5b22('0x7d')]({'plain':!![]});if(!_0x53f980)throw new Error(_0x5b22('0x7e'));if(_0x53f980['role']===_0x5b22('0x73')){var _0x108277=_0x41c2f2['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MailAccounts','userProfileId':_0x53f980[_0x5b22('0x7f')]},'raw':!![]})[_0x5b22('0x22')](function(_0x51bdeb){if(_0x51bdeb&&_0x51bdeb[_0x5b22('0x80')]===0x0){return db[_0x5b22('0x36')][_0x5b22('0x63')]({'name':_0x108277['name'],'resourceId':_0x108277['id'],'type':_0x51bdeb[_0x5b22('0x39')],'sectionId':_0x51bdeb['id']},{})['then'](function(){return _0x41c2f2;});}else{return _0x41c2f2;}})[_0x5b22('0x5a')](function(_0x19e615){logger[_0x5b22('0x27')](_0x5b22('0x81'),_0x19e615);throw _0x19e615;});}return _0x41c2f2;})[_0x5b22('0x22')](respondWithResult(_0x597a40,0xc9))[_0x5b22('0x5a')](handleError(_0x597a40,null));};exports[_0x5b22('0x82')]=function(_0x44c8c5,_0x536e68,_0xfb4d91){return db['MailAccount']['findOne']({'where':{'id':_0x44c8c5['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x536e68,null))[_0x5b22('0x22')](function(_0x407c73){if(_0x407c73){return _0x407c73['getImap']();}return null;})[_0x5b22('0x22')](respondWithResult(_0x536e68,null))[_0x5b22('0x5a')](handleError(_0x536e68,null));};exports[_0x5b22('0x83')]=function(_0x5ea39e,_0x4490ed,_0x551d7e){if(_0x5ea39e[_0x5b22('0x5e')]['id']){delete _0x5ea39e[_0x5b22('0x5e')]['id'];}return db[_0x5b22('0x42')]['find']({'where':{'id':_0x5ea39e['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x4490ed,null))[_0x5b22('0x22')](function(_0x572350){if(_0x572350){_0x5ea39e[_0x5b22('0x5e')]['MailAccountId']=_0x572350['id'];return db[_0x5b22('0x3c')][_0x5b22('0x63')](_0x5ea39e[_0x5b22('0x5e')]);}})['then'](respondWithResult(_0x4490ed,null))['catch'](handleError(_0x4490ed,null));};exports[_0x5b22('0x84')]=function(_0x3fd4c2,_0xf2959d,_0x524ed7){return db[_0x5b22('0x42')][_0x5b22('0x65')]({'where':{'id':_0x3fd4c2[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0xf2959d,null))['then'](function(_0x50e8da){if(_0x50e8da){return _0x50e8da['setImap'](null);}return null;})[_0x5b22('0x22')](respondWithStatusCode(_0xf2959d,null))['catch'](handleError(_0xf2959d,null));};exports['getSmtp']=function(_0x46f0a0,_0xa09fd4,_0x3ce08a){return db['MailAccount'][_0x5b22('0x65')]({'where':{'id':_0x46f0a0[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0xa09fd4,null))[_0x5b22('0x22')](function(_0x1bfaba){if(_0x1bfaba){return _0x1bfaba[_0x5b22('0x85')]();}return null;})[_0x5b22('0x22')](respondWithResult(_0xa09fd4,null))[_0x5b22('0x5a')](handleError(_0xa09fd4,null));};exports['addSmtp']=function(_0x247452,_0x54ca70,_0x3c6e95){if(_0x247452['body']['id']){delete _0x247452['body']['id'];}return db[_0x5b22('0x42')]['find']({'where':{'id':_0x247452['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x54ca70,null))['then'](function(_0x37ee50){if(_0x37ee50){_0x247452['body'][_0x5b22('0x61')]=_0x37ee50['id'];return db[_0x5b22('0x3e')][_0x5b22('0x63')](_0x247452[_0x5b22('0x5e')]);}})[_0x5b22('0x22')](respondWithResult(_0x54ca70,null))[_0x5b22('0x5a')](handleError(_0x54ca70,null));};exports[_0x5b22('0x86')]=function(_0x4589f9,_0xc37909,_0x45ee4b){return db[_0x5b22('0x42')]['findOne']({'where':{'id':_0x4589f9[_0x5b22('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc37909,null))[_0x5b22('0x22')](function(_0x474f30){if(_0x474f30){return _0x474f30[_0x5b22('0x87')](null);}return null;})[_0x5b22('0x22')](respondWithStatusCode(_0xc37909,null))['catch'](handleError(_0xc37909,null));};exports[_0x5b22('0x88')]=function(_0x5b5333,_0x9fc919,_0x7073e9){return db[_0x5b22('0x89')][_0x5b22('0x60')]({'where':{'id':_0x5b5333[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x9fc919,null))[_0x5b22('0x22')](function(_0x529106){if(_0x529106){return _0x529106[_0x5b22('0x88')](_0x5b5333[_0x5b22('0x5e')][_0x5b22('0x6a')],_['omit'](_0x5b5333[_0x5b22('0x5e')],[_0x5b22('0x6a'),'id'])||{});}})[_0x5b22('0x22')](respondWithResult(_0x9fc919,null))['catch'](handleError(_0x9fc919,null));};exports['getInteractions']=function(_0xaca3ea,_0x37c933,_0x10cef0){var _0x4d710c={'raw':![],'where':{}};var _0x457ede={};var _0xbaadc5={'count':0x0,'rows':[]};return db[_0x5b22('0x42')][_0x5b22('0x65')]({'where':{'id':_0xaca3ea['params']['id']}})['then'](handleEntityNotFound(_0x37c933,null))[_0x5b22('0x22')](function(_0x3fb925){if(_0x3fb925){_0x457ede[_0x5b22('0x47')]=_[_0x5b22('0x5d')](db[_0x5b22('0x89')][_0x5b22('0x43')]);_0x457ede[_0x5b22('0x49')]=_[_0x5b22('0x5d')](_0xaca3ea[_0x5b22('0x49')]);_0x457ede[_0x5b22('0x4a')]=_['intersection'](_0x457ede[_0x5b22('0x47')],_0x457ede[_0x5b22('0x49')]);_0x4d710c[_0x5b22('0x4c')]=_[_0x5b22('0x4b')](_0x457ede[_0x5b22('0x47')],qs[_0x5b22('0x4d')](_0xaca3ea[_0x5b22('0x49')][_0x5b22('0x4d')]));_0x4d710c['attributes']=_0x4d710c[_0x5b22('0x4c')][_0x5b22('0x4e')]?_0x4d710c[_0x5b22('0x4c')]:_0x457ede[_0x5b22('0x47')];if(!_0xaca3ea['query']['hasOwnProperty'](_0x5b22('0x4f'))){_0x4d710c[_0x5b22('0x2f')]=qs['limit'](_0xaca3ea[_0x5b22('0x49')][_0x5b22('0x2f')]);_0x4d710c[_0x5b22('0x2e')]=qs[_0x5b22('0x2e')](_0xaca3ea['query'][_0x5b22('0x2e')]);}_0x4d710c['order']=qs[_0x5b22('0x51')](_0xaca3ea[_0x5b22('0x49')]['sort']);_0x4d710c[_0x5b22('0x52')]=qs[_0x5b22('0x4a')](_[_0x5b22('0x53')](_0xaca3ea['query'],_0x457ede[_0x5b22('0x4a')]));_0x4d710c[_0x5b22('0x52')]['MailAccountId']=_0x3fb925['id'];if(_0xaca3ea[_0x5b22('0x49')]['filter']){_0x4d710c['where']=_['merge'](_0x4d710c[_0x5b22('0x52')],{'$or':_[_0x5b22('0x48')](_0x4d710c[_0x5b22('0x4c')],function(_0x52c4db){var _0x1a0e36={};_0x1a0e36[_0x52c4db]={'$like':'%'+_0xaca3ea[_0x5b22('0x49')][_0x5b22('0x67')]+'%'};return _0x1a0e36;})});}_0x4d710c=_[_0x5b22('0x54')]({},_0x4d710c,_0xaca3ea[_0x5b22('0x68')]);return db[_0x5b22('0x89')][_0x5b22('0x55')]({'where':_0x4d710c['where']})[_0x5b22('0x22')](function(_0x2dfe02){_0xbaadc5[_0x5b22('0x55')]=_0x2dfe02;if(_0xaca3ea['query'][_0x5b22('0x56')]){_0x4d710c[_0x5b22('0x57')]=[{'model':db['CmContact'],'as':_0x5b22('0x8a'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x5b22('0x39'),_0x5b22('0x8b'),_0x5b22('0x8c')],'required':![]},{'model':db[_0x5b22('0x8d')],'as':_0x5b22('0x8e'),'attributes':['id',_0x5b22('0x39'),_0x5b22('0x8f')],'where':_0xaca3ea['query']['tag']?{'id':_0xaca3ea[_0x5b22('0x49')][_0x5b22('0x90')]}:undefined,'required':_0xaca3ea[_0x5b22('0x49')][_0x5b22('0x90')]?!![]:![]}];}return db[_0x5b22('0x89')][_0x5b22('0x58')](_0x4d710c);})['then'](function(_0x9a66d3){_0xbaadc5[_0x5b22('0x59')]=_0x9a66d3;return _0xbaadc5;});}})[_0x5b22('0x22')](respondWithFilteredResult(_0x37c933,_0x4d710c))[_0x5b22('0x5a')](handleError(_0x37c933,null));};exports['addApplications']=function(_0x40acdb,_0x357551,_0xd23d38){return db[_0x5b22('0x42')][_0x5b22('0x65')]({'where':{'id':_0x40acdb[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x357551,null))['then'](function(_0x31ae84){if(_0x31ae84){return db['sequelize'][_0x5b22('0x91')](function(_0x1fefed){return db[_0x5b22('0x92')]['destroy']({'where':{'MailAccountId':_0x40acdb[_0x5b22('0x5c')]['id']},'transaction':_0x1fefed})[_0x5b22('0x22')](function(_0x1584da){var _0x39360d=_[_0x5b22('0x48')](_0x40acdb[_0x5b22('0x5e')],function(_0x5d6496){_0x5d6496[_0x5b22('0x61')]=_0x40acdb['params']['id'];return _0x5d6496;});return db[_0x5b22('0x92')][_0x5b22('0x93')](_0x39360d,{'transaction':_0x1fefed});});})[_0x5b22('0x22')](function(){return db[_0x5b22('0x92')][_0x5b22('0x94')]({'where':{'MailAccountId':_0x40acdb[_0x5b22('0x5c')]['id']},'order':_0x5b22('0x95')});});}})[_0x5b22('0x22')](respondWithResult(_0x357551,null))[_0x5b22('0x5a')](handleError(_0x357551,null));};exports['getApplications']=function(_0x36c266,_0x44cf2,_0xa41e15){var _0x5d91e6={};var _0x2a1e75={};var _0x4d47f2;var _0x544be3;return db[_0x5b22('0x42')]['findOne']({'where':{'id':_0x36c266[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x44cf2,null))[_0x5b22('0x22')](function(_0xc198f3){if(_0xc198f3){_0x4d47f2=_0xc198f3;_0x2a1e75[_0x5b22('0x47')]=_[_0x5b22('0x5d')](db['MailApplication'][_0x5b22('0x43')]);_0x2a1e75[_0x5b22('0x49')]=_[_0x5b22('0x5d')](_0x36c266['query']);_0x2a1e75['filters']=_[_0x5b22('0x4b')](_0x2a1e75['model'],_0x2a1e75[_0x5b22('0x49')]);_0x5d91e6[_0x5b22('0x4c')]=_[_0x5b22('0x4b')](_0x2a1e75[_0x5b22('0x47')],qs[_0x5b22('0x4d')](_0x36c266['query'][_0x5b22('0x4d')]));_0x5d91e6[_0x5b22('0x4c')]=_0x5d91e6[_0x5b22('0x4c')][_0x5b22('0x4e')]?_0x5d91e6[_0x5b22('0x4c')]:_0x2a1e75[_0x5b22('0x47')];_0x5d91e6[_0x5b22('0x50')]=qs[_0x5b22('0x51')](_0x36c266[_0x5b22('0x49')]['sort']);_0x5d91e6[_0x5b22('0x52')]=qs['filters'](_[_0x5b22('0x53')](_0x36c266[_0x5b22('0x49')],_0x2a1e75[_0x5b22('0x4a')]));if(_0x36c266['query']['filter']){_0x5d91e6['where']=_[_0x5b22('0x54')](_0x5d91e6[_0x5b22('0x52')],{'$or':_[_0x5b22('0x48')](_0x5d91e6[_0x5b22('0x4c')],function(_0x59315c){var _0x37c6e8={};_0x37c6e8[_0x59315c]={'$like':'%'+_0x36c266[_0x5b22('0x49')][_0x5b22('0x67')]+'%'};return _0x37c6e8;})});}_0x5d91e6=_[_0x5b22('0x54')]({},_0x5d91e6,_0x36c266[_0x5b22('0x68')]);return _0x4d47f2['getApplications'](_0x5d91e6);}})[_0x5b22('0x22')](function(_0x2f0863){if(_0x2f0863){_0x544be3=_0x2f0863['length'];if(!_0x36c266['query']['hasOwnProperty'](_0x5b22('0x4f'))){_0x5d91e6[_0x5b22('0x2f')]=qs[_0x5b22('0x2f')](_0x36c266[_0x5b22('0x49')][_0x5b22('0x2f')]);_0x5d91e6[_0x5b22('0x2e')]=qs['offset'](_0x36c266[_0x5b22('0x49')][_0x5b22('0x2e')]);}return _0x4d47f2[_0x5b22('0x96')](_0x5d91e6);}})[_0x5b22('0x22')](function(_0x439b58){if(_0x439b58){return _0x439b58?{'count':_0x544be3,'rows':_0x439b58}:null;}})[_0x5b22('0x22')](respondWithResult(_0x44cf2,null))[_0x5b22('0x5a')](handleError(_0x44cf2,null));};exports['getMessages']=function(_0x52c186,_0x5adfe6,_0x36e7d0){var _0x2d77ce={'raw':!![],'where':{}};var _0x30aaf5={};var _0x230209={'count':0x0,'rows':[]};return db[_0x5b22('0x42')][_0x5b22('0x65')]({'where':{'id':_0x52c186[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x5adfe6,null))[_0x5b22('0x22')](function(_0x564c60){if(_0x564c60){_0x30aaf5['model']=_['keys'](db[_0x5b22('0x97')][_0x5b22('0x43')]);_0x30aaf5[_0x5b22('0x49')]=_[_0x5b22('0x5d')](_0x52c186[_0x5b22('0x49')]);_0x30aaf5[_0x5b22('0x4a')]=_[_0x5b22('0x4b')](_0x30aaf5[_0x5b22('0x47')],_0x30aaf5[_0x5b22('0x49')]);_0x2d77ce[_0x5b22('0x4c')]=_[_0x5b22('0x4b')](_0x30aaf5['model'],qs[_0x5b22('0x4d')](_0x52c186[_0x5b22('0x49')][_0x5b22('0x4d')]));_0x2d77ce[_0x5b22('0x4c')]=_0x2d77ce[_0x5b22('0x4c')]['length']?_0x2d77ce['attributes']:_0x30aaf5['model'];if(!_0x52c186[_0x5b22('0x49')][_0x5b22('0x66')](_0x5b22('0x4f'))){_0x2d77ce['limit']=qs['limit'](_0x52c186['query'][_0x5b22('0x2f')]);_0x2d77ce['offset']=qs['offset'](_0x52c186[_0x5b22('0x49')][_0x5b22('0x2e')]);}_0x2d77ce[_0x5b22('0x50')]=qs['sort'](_0x52c186[_0x5b22('0x49')][_0x5b22('0x51')]);_0x2d77ce['where']=qs[_0x5b22('0x4a')](_[_0x5b22('0x53')](_0x52c186[_0x5b22('0x49')],_0x30aaf5[_0x5b22('0x4a')]));_0x2d77ce[_0x5b22('0x52')][_0x5b22('0x61')]=_0x564c60['id'];if(_0x52c186[_0x5b22('0x49')][_0x5b22('0x67')]){_0x2d77ce['where']=_[_0x5b22('0x54')](_0x2d77ce[_0x5b22('0x52')],{'$or':_[_0x5b22('0x48')](_0x2d77ce[_0x5b22('0x4c')],function(_0x174e98){var _0x1e6bcc={};_0x1e6bcc[_0x174e98]={'$like':'%'+_0x52c186[_0x5b22('0x49')][_0x5b22('0x67')]+'%'};return _0x1e6bcc;})});}if(_0x52c186[_0x5b22('0x49')][_0x5b22('0x98')]){var _0x31b924=_0x52c186[_0x5b22('0x49')][_0x5b22('0x98')][_0x5b22('0x99')](',');var _0x21bdb1={};_0x21bdb1[_0x31b924[0x0]]={'$gte':moment(_0x31b924[0x1])[_0x5b22('0x9a')](_0x5b22('0x9b'))};_0x2d77ce[_0x5b22('0x52')]=_[_0x5b22('0x54')](_0x2d77ce['where'],_0x21bdb1);}_0x2d77ce=_[_0x5b22('0x54')]({},_0x2d77ce,_0x52c186[_0x5b22('0x68')]);return db[_0x5b22('0x97')][_0x5b22('0x55')]({'where':_0x2d77ce[_0x5b22('0x52')]})[_0x5b22('0x22')](function(_0x2b71cb){_0x230209[_0x5b22('0x55')]=_0x2b71cb;if(_0x52c186['query'][_0x5b22('0x56')]){_0x2d77ce[_0x5b22('0x57')]=[{'all':!![]}];}return db[_0x5b22('0x97')]['findAll'](_0x2d77ce);})[_0x5b22('0x22')](function(_0x108722){_0x230209[_0x5b22('0x59')]=_0x108722;return _0x230209;});}})['then'](respondWithFilteredResult(_0x5adfe6,_0x2d77ce))[_0x5b22('0x5a')](handleError(_0x5adfe6,null));};exports['send']=function(_0x373115,_0x17307d,_0x1a72a2){var _0x4026e9,_0x9aecce={},_0x18cf40;if(_0x373115['body']['to']){_0x18cf40=_0x373115[_0x5b22('0x5e')]['to'][_0x5b22('0x99')](',')[0x0];}return db['MailAccount'][_0x5b22('0x60')]({'where':{'id':_0x373115[_0x5b22('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x5b22('0x9c'),'include':[{'model':db[_0x5b22('0x9d')],'as':_0x5b22('0x9e'),'where':{'email':_0x18cf40},'limit':0x1,'order':[[_0x5b22('0x9f'),'DESC']]}]},{'model':db[_0x5b22('0x3e')],'as':_0x5b22('0x3f'),'raw':!![]}]})[_0x5b22('0x22')](handleEntityNotFound(_0x17307d,null))['then'](function(_0x5e189c){if(_0x5e189c){_0x4026e9=_0x5e189c;if(_0x5e189c[_0x5b22('0x3f')]){if(_[_0x5b22('0x71')](_0x373115[_0x5b22('0x5e')]['from'])){_0x373115[_0x5b22('0x5e')][_0x5b22('0xa0')]=util[_0x5b22('0x9a')](_0x5b22('0xa1'),_0x5e189c[_0x5b22('0x39')],_0x5e189c[_0x5b22('0xa2')]||_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x73')]);}if(_0x373115['body'][_0x5b22('0xa3')]&&_0x373115[_0x5b22('0x5e')]['attachments'][_0x5b22('0x4e')]){for(var _0x17c9d9=0x0;_0x17c9d9<_0x373115[_0x5b22('0x5e')]['attachments']['length'];_0x17c9d9+=0x1){_0x373115['body'][_0x5b22('0xa3')][_0x17c9d9]={'filename':_0x373115[_0x5b22('0x5e')]['attachments'][_0x17c9d9][_0x5b22('0x39')],'path':path[_0x5b22('0xa4')](config[_0x5b22('0xa5')],_0x5b22('0xa6'),_0x373115[_0x5b22('0x5e')][_0x5b22('0xa3')][_0x17c9d9][_0x5b22('0xa7')])};}}var _0x2ba80b={'tls':{'rejectUnauthorized':![]}};if(_[_0x5b22('0x71')](_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x7a')])){if(_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x77')]){_0x2ba80b[_0x5b22('0xa8')]={'user':_0x5e189c['Smtp'][_0x5b22('0x73')],'pass':_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x76')]};}_0x2ba80b[_0x5b22('0x78')]=_0x5e189c['Smtp']['host'];_0x2ba80b['port']=_0x5e189c[_0x5b22('0x3f')]['port'];_0x2ba80b[_0x5b22('0xa9')]=_0x5e189c[_0x5b22('0x3f')][_0x5b22('0xa9')];}else{_0x2ba80b[_0x5b22('0x7a')]=_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x7a')];_0x2ba80b['auth']={'user':_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x73')],'pass':_0x5e189c[_0x5b22('0x3f')][_0x5b22('0x76')]};}return respondWithRpcPromise(_0x5b22('0xaa'),'sendMail',{'account':_0x2ba80b,'message':_0x373115[_0x5b22('0x5e')]});}else{throw new Error(_0x5b22('0xab'));}}})['then'](function(_0x54b17e){if(_0x54b17e){_0x9aecce=_0x54b17e;if(_0x4026e9['List']){if(_0x4026e9[_0x5b22('0x9c')]['Contacts']['length']){return _0x4026e9[_0x5b22('0x9c')][_0x5b22('0x9e')][0x0];}else{return db[_0x5b22('0x9d')][_0x5b22('0x63')](_[_0x5b22('0x16')](_0x373115['body'],{'firstName':_0x373115['body']['to'],'email':_0x373115[_0x5b22('0x5e')]['to'],'phone':_0x373115[_0x5b22('0x5e')]['to'],'ListId':_0x4026e9[_0x5b22('0x6e')]}));}}else{throw new Error(_0x5b22('0xab'));}}})[_0x5b22('0x22')](function(_0x6684f3){if(_0x6684f3){var _0x56e655={'UserId':_0x373115[_0x5b22('0x73')]['id'],'ContactId':_0x6684f3['id'],'MailAccountId':_0x4026e9['id'],'inReplyTo':_0x9aecce[_0x5b22('0xac')],'to':_0x373115['body'][_0x5b22('0xa0')],'cc':_0x373115[_0x5b22('0x5e')]['cc'],'subject':_0x373115[_0x5b22('0x5e')]['subject'],'attach':_0x373115[_0x5b22('0x5e')][_0x5b22('0xad')],'firstMsgDirection':_0x5b22('0xae'),'lastMsgAt':moment()[_0x5b22('0x9a')](_0x5b22('0x9b')),'lastMsgDirection':_0x5b22('0xae'),'lastMsgBody':_0x373115[_0x5b22('0x5e')][_0x5b22('0x5e')],'Messages':[_[_0x5b22('0x54')](_0x373115[_0x5b22('0x5e')],{'messageId':_0x9aecce[_0x5b22('0xac')],'sentAt':moment()[_0x5b22('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x4026e9['id'],'UserId':_0x373115[_0x5b22('0x73')]['id'],'ContactId':_0x6684f3['id']})]};if(_0x373115[_0x5b22('0x5e')][_0x5b22('0xaf')]){_0x56e655=_[_0x5b22('0x54')](_0x56e655,_0x373115['body'][_0x5b22('0xaf')]);}return db[_0x5b22('0x89')][_0x5b22('0x63')](_0x56e655,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x5b22('0x22')](respondWithResult(_0x17307d,null))['catch'](handleError(_0x17307d,null));};exports[_0x5b22('0xb0')]=function(_0x4d2a67,_0x48dc92,_0xf5cb50){return db[_0x5b22('0x42')][_0x5b22('0x60')]({'where':{'id':_0x4d2a67[_0x5b22('0x5c')]['id']},'include':[{'model':db[_0x5b22('0x3e')],'as':'Smtp','raw':!![]}]})[_0x5b22('0x22')](handleEntityNotFound(_0x48dc92,null))[_0x5b22('0x22')](function(_0x27528b){if(_0x27528b&&_0x27528b[_0x5b22('0x3f')]){var _0x13649f={'id':_0x27528b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x27528b[_0x5b22('0x3f')]['service']){_0x13649f[_0x5b22('0x7a')]=_0x27528b[_0x5b22('0x3f')]['service'];}else{_0x13649f[_0x5b22('0x78')]=_0x27528b[_0x5b22('0x3f')]['host'];_0x13649f['port']=_0x27528b[_0x5b22('0x3f')]['port'];_0x13649f[_0x5b22('0xa9')]=_0x27528b[_0x5b22('0x3f')][_0x5b22('0xa9')];}if(_0x27528b['Smtp']['authentication']){_0x13649f[_0x5b22('0xa8')]={'user':_0x27528b[_0x5b22('0x3f')][_0x5b22('0x73')],'pass':_0x27528b['Smtp'][_0x5b22('0x76')]};}return respondWithRpcPromise('VerifySmtp',_0x5b22('0xb0'),{'account':_0x13649f});}})['then'](respondWithResult(_0x48dc92,null))[_0x5b22('0x5a')](handleError(_0x48dc92,null));};exports[_0x5b22('0x34')]=function(_0xa5ea2e,_0x372388){return db['MailAccount'][_0x5b22('0x60')]({'where':{'id':_0xa5ea2e[_0x5b22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x372388,null))[_0x5b22('0x22')](function(_0x24adb6){if(_0x24adb6&&_0x24adb6[_0x5b22('0x7a')]){throw new db[(_0x5b22('0x1e'))]['ValidationError'](_0x5b22('0xb1'));}return _0x24adb6;})[_0x5b22('0x22')](removeEntity(_0x372388,null))['catch'](handleError(_0x372388,null));};exports[_0x5b22('0xb2')]=function(_0x3f0680,_0x2bdead,_0xb2cfb7){return db['MailAccount'][_0x5b22('0x60')]({'where':{'id':_0x3f0680[_0x5b22('0x5c')]['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x2bdead,null))[_0x5b22('0x22')](function(_0x10cc75){if(_0x10cc75){return _0x10cc75[_0x5b22('0xb2')](_0x3f0680[_0x5b22('0x5e')][_0x5b22('0x6a')],_[_0x5b22('0xb3')](_0x3f0680[_0x5b22('0x5e')],[_0x5b22('0x6a'),'id'])||{})[_0x5b22('0xb4')](function(_0x2b2786){for(var _0x396a84=0x0;_0x396a84<_0x3f0680[_0x5b22('0x5e')][_0x5b22('0x6a')]['length'];_0x396a84+=0x1){socket[_0x5b22('0xb5')](_0x5b22('0xb6'),{'UserId':_0x3f0680[_0x5b22('0x5e')][_0x5b22('0x6a')][_0x396a84],'MailAccountId':_0x3f0680[_0x5b22('0x5c')]['id']});}return _0x2b2786;});}})['then'](respondWithResult(_0x2bdead,null))[_0x5b22('0x5a')](handleError(_0x2bdead,null));};exports[_0x5b22('0xb7')]=function(_0xca151b,_0x10fc5b,_0x4b6b80){return db[_0x5b22('0x42')][_0x5b22('0x60')]({'where':{'id':_0xca151b[_0x5b22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x10fc5b,null))[_0x5b22('0x22')](function(_0x987793){if(_0x987793){return _0x987793['removeAgents'](_0xca151b[_0x5b22('0x49')][_0x5b22('0x6a')])['then'](function(){if(_[_0x5b22('0xb8')](_0xca151b[_0x5b22('0x49')][_0x5b22('0x6a')])){for(var _0x17aee4=0x0;_0x17aee4<_0xca151b[_0x5b22('0x49')][_0x5b22('0x6a')][_0x5b22('0x4e')];_0x17aee4+=0x1){socket[_0x5b22('0xb5')](_0x5b22('0xb9'),{'UserId':Number(_0xca151b[_0x5b22('0x49')][_0x5b22('0x6a')][_0x17aee4]),'MailAccountId':Number(_0xca151b['params']['id'])});}}else{socket['emit'](_0x5b22('0xb9'),{'UserId':Number(_0xca151b[_0x5b22('0x49')][_0x5b22('0x6a')]),'MailAccountId':Number(_0xca151b[_0x5b22('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x10fc5b,null))['catch'](handleError(_0x10fc5b,null));};exports[_0x5b22('0xba')]=function(_0x5b679e,_0x3e73b8,_0x583f04){var _0x1a49c6={};var _0x445470={};var _0x38b69f;var _0x361593;return db[_0x5b22('0x42')]['findOne']({'where':{'id':_0x5b679e['params']['id']}})[_0x5b22('0x22')](handleEntityNotFound(_0x3e73b8,null))[_0x5b22('0x22')](function(_0x485528){if(_0x485528){_0x38b69f=_0x485528;_0x445470[_0x5b22('0x47')]=_[_0x5b22('0x5d')](db[_0x5b22('0xbb')]['rawAttributes']);_0x445470['query']=_[_0x5b22('0x5d')](_0x5b679e['query']);_0x445470[_0x5b22('0x4a')]=_[_0x5b22('0x4b')](_0x445470['model'],_0x445470[_0x5b22('0x49')]);_0x1a49c6[_0x5b22('0x4c')]=_[_0x5b22('0x4b')](_0x445470[_0x5b22('0x47')],qs[_0x5b22('0x4d')](_0x5b679e[_0x5b22('0x49')][_0x5b22('0x4d')]));_0x1a49c6[_0x5b22('0x4c')]=_0x1a49c6['attributes'][_0x5b22('0x4e')]?_0x1a49c6[_0x5b22('0x4c')]:_0x445470['model'];_0x1a49c6['order']=qs['sort'](_0x5b679e[_0x5b22('0x49')][_0x5b22('0x51')]);_0x1a49c6[_0x5b22('0x52')]=qs[_0x5b22('0x4a')](_[_0x5b22('0x53')](_0x5b679e['query'],_0x445470[_0x5b22('0x4a')]));if(_0x5b679e['query'][_0x5b22('0x67')]){_0x1a49c6[_0x5b22('0x52')]=_[_0x5b22('0x54')](_0x1a49c6[_0x5b22('0x52')],{'$or':_[_0x5b22('0x48')](_0x1a49c6['attributes'],function(_0x220117){var _0x3e3ed5={};_0x3e3ed5[_0x220117]={'$like':'%'+_0x5b679e['query']['filter']+'%'};return _0x3e3ed5;})});}_0x1a49c6=_[_0x5b22('0x54')]({},_0x1a49c6,_0x5b679e[_0x5b22('0x68')]);return _0x38b69f[_0x5b22('0xba')](_0x1a49c6);}})[_0x5b22('0x22')](function(_0x4fa59e){if(_0x4fa59e){_0x361593=_0x4fa59e['length'];if(!_0x5b679e[_0x5b22('0x49')][_0x5b22('0x66')](_0x5b22('0x4f'))){_0x1a49c6[_0x5b22('0x2f')]=qs[_0x5b22('0x2f')](_0x5b679e[_0x5b22('0x49')]['limit']);_0x1a49c6[_0x5b22('0x2e')]=qs[_0x5b22('0x2e')](_0x5b679e[_0x5b22('0x49')][_0x5b22('0x2e')]);}return _0x38b69f['getAgents'](_0x1a49c6);}})[_0x5b22('0x22')](function(_0x34ae3a){if(_0x34ae3a){return _0x34ae3a?{'count':_0x361593,'rows':_0x34ae3a}:null;}})[_0x5b22('0x22')](respondWithResult(_0x3e73b8,null))[_0x5b22('0x5a')](handleError(_0x3e73b8,null));}; \ No newline at end of file +var _0x5a84=['socket.io-emitter','./mailAccount.socket','register','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~!@#$%^&-_=+[{]}.','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','destroy','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','includeAll','rows','show','params','MailServerOut','rawAttributes','find','update','body','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','where','options','include','findAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','get','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','from','attachments','root','server/files/attachments','basename','auth','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','attach','Interaction','Messages','verifySmtp','secure','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','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','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults'];(function(_0x306aeb,_0x4b1ac9){var _0x34a75d=function(_0x1deebb){while(--_0x1deebb){_0x306aeb['push'](_0x306aeb['shift']());}};_0x34a75d(++_0x4b1ac9);}(_0x5a84,0xa7));var _0x45a8=function(_0x4fa7cf,_0x50685f){_0x4fa7cf=_0x4fa7cf-0x0;var _0x31ca29=_0x5a84[_0x4fa7cf];return _0x31ca29;};'use strict';var pdf=require(_0x45a8('0x0'));var emlformat=require(_0x45a8('0x1'));var rimraf=require(_0x45a8('0x2'));var zipdir=require(_0x45a8('0x3'));var jsonpatch=require(_0x45a8('0x4'));var rp=require(_0x45a8('0x5'));var moment=require(_0x45a8('0x6'));var BPromise=require(_0x45a8('0x7'));var Mustache=require(_0x45a8('0x8'));var util=require(_0x45a8('0x9'));var path=require(_0x45a8('0xa'));var sox=require(_0x45a8('0xb'));var csv=require(_0x45a8('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x45a8('0xd'));var squel=require(_0x45a8('0xe'));var crypto=require(_0x45a8('0xf'));var jsforce=require(_0x45a8('0x10'));var deskjs=require(_0x45a8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x45a8('0x12'));var Papa=require(_0x45a8('0x13'));var Redis=require(_0x45a8('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x45a8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45a8('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x45a8('0x17'));var config=require(_0x45a8('0x18'));var db=require('../../mysqldb')['db'];config[_0x45a8('0x19')]=_[_0x45a8('0x1a')](config[_0x45a8('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x45a8('0x1b'))(new Redis(config['redis']));require(_0x45a8('0x1c'))[_0x45a8('0x1d')](socket);var jayson=require(_0x45a8('0x1e'));var client=jayson[_0x45a8('0x1f')][_0x45a8('0x20')]({'port':0x232b});function checkPasswordPattern(_0x3fa98b,_0x3c5845,_0x5a72a4){if(_0x5a72a4){var _0x520504=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x520504[_0x45a8('0x21')](_0x3c5845)){return _0x3fa98b;}else{throw new db[(_0x45a8('0x22'))]['ValidationError'](_0x45a8('0x23'));}}else{return _0x3fa98b;}}function respondWithRpcPromise(_0x3c009d,_0x44ff42,_0x79d594,_0x2604f4){return new BPromise(function(_0xd374ad,_0x4ef25b){var _0x24fc65=_0x2604f4||client;return _0x24fc65[_0x45a8('0x24')](_0x3c009d,_0x79d594)[_0x45a8('0x25')](function(_0x2787ea){logger['info'](_0x45a8('0x26'),_0x44ff42,_0x45a8('0x27'));logger[_0x45a8('0x28')](_0x45a8('0x29'),_0x44ff42,_0x45a8('0x27'),JSON[_0x45a8('0x2a')](_0x2787ea));if(_0x2787ea[_0x45a8('0x2b')]){if(_0x2787ea[_0x45a8('0x2b')][_0x45a8('0x2c')]===0x1f4){logger[_0x45a8('0x2b')](_0x45a8('0x26'),_0x44ff42,_0x2787ea[_0x45a8('0x2b')][_0x45a8('0x2d')]);return _0x4ef25b(_0x2787ea[_0x45a8('0x2b')][_0x45a8('0x2d')]);}logger[_0x45a8('0x2b')](_0x45a8('0x26'),_0x44ff42,_0x2787ea[_0x45a8('0x2b')][_0x45a8('0x2d')]);return _0xd374ad(_0x2787ea[_0x45a8('0x2b')][_0x45a8('0x2d')]);}else{logger[_0x45a8('0x2e')](_0x45a8('0x26'),_0x44ff42,_0x45a8('0x27'));_0xd374ad(_0x2787ea[_0x45a8('0x2f')]['message']);}})[_0x45a8('0x30')](function(_0x11a2ea){logger['error'](_0x45a8('0x26'),_0x44ff42,_0x11a2ea);_0x4ef25b(_0x11a2ea);});});}function respondWithStatusCode(_0x418f35,_0x3eda02){_0x3eda02=_0x3eda02||0xcc;return function(_0x49e300){if(_0x49e300){return _0x418f35[_0x45a8('0x31')](_0x3eda02);}return _0x418f35[_0x45a8('0x32')](_0x3eda02)[_0x45a8('0x33')]();};}function respondWithResult(_0x545734,_0x25b464){_0x25b464=_0x25b464||0xc8;return function(_0x2a8cb2){if(_0x2a8cb2){return _0x545734[_0x45a8('0x32')](_0x25b464)[_0x45a8('0x34')](_0x2a8cb2);}};}function respondWithFilteredResult(_0x39ec27,_0x3828b9){return function(_0x58d327){if(_0x58d327){var _0x5418e8=_0x58d327[_0x45a8('0x35')],_0x22cfc3=_0x3828b9[_0x45a8('0x36')],_0x3ed759=_0x3828b9[_0x45a8('0x36')]+_0x3828b9[_0x45a8('0x37')],_0xc0ed9c;if(_0x3ed759>=_0x5418e8){_0x3ed759=_0x5418e8;_0xc0ed9c=0xc8;}else{_0xc0ed9c=0xce;}_0x39ec27['status'](_0xc0ed9c);return _0x39ec27['set'](_0x45a8('0x38'),_0x22cfc3+'-'+_0x3ed759+'/'+_0x5418e8)['json'](_0x58d327);}return null;};}function patchUpdates(_0x2a964b){return function(_0x13389b){try{jsonpatch['apply'](_0x13389b,_0x2a964b,!![]);}catch(_0x19f582){return BPromise['reject'](_0x19f582);}return _0x13389b[_0x45a8('0x39')]();};}function saveUpdates(_0x30dd02,_0x278265){return function(_0x20a23f){if(_0x20a23f){return _0x20a23f['update'](_0x30dd02)['then'](function(_0x549b58){return _0x549b58;});}return null;};}function removeEntity(_0x50ce49,_0x51117d){return function(_0xd6c37c){if(_0xd6c37c){return _0xd6c37c[_0x45a8('0x3a')]()[_0x45a8('0x25')](function(){var _0xa01bf7=_0xd6c37c['get']({'plain':!![]});var _0x8411ca=_0x45a8('0x3b');return db[_0x45a8('0x3c')]['destroy']({'where':{'type':_0x8411ca,'resourceId':_0xa01bf7['id']}})[_0x45a8('0x25')](function(){return _0xd6c37c;});})[_0x45a8('0x25')](function(){_0x50ce49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c403,_0x242f8e){return function(_0x365301){if(!_0x365301){_0x47c403[_0x45a8('0x31')](0x194);}return _0x365301;};}function handleError(_0x5c171e,_0x5d3cf7){_0x5d3cf7=_0x5d3cf7||0x1f4;return function(_0x45d9a4){logger[_0x45a8('0x2b')](_0x45d9a4[_0x45a8('0x3d')]);if(_0x45d9a4[_0x45a8('0x3e')]){delete _0x45d9a4['name'];}_0x5c171e[_0x45a8('0x32')](_0x5d3cf7)[_0x45a8('0x3f')](_0x45d9a4);};}exports[_0x45a8('0x40')]=function(_0x5b6392,_0x18d741){var _0x35bcf1={'include':[{'model':db[_0x45a8('0x41')],'as':_0x45a8('0x42')},{'model':db['MailServerOut'],'as':_0x45a8('0x43')},{'model':db[_0x45a8('0x44')],'as':_0x45a8('0x45')}]},_0x11652a={},_0x46c281={'count':0x0,'rows':[]};var _0x27703c=_['map'](db[_0x45a8('0x46')]['rawAttributes'],function(_0x20c7e4){return{'name':_0x20c7e4[_0x45a8('0x47')],'type':_0x20c7e4[_0x45a8('0x48')][_0x45a8('0x49')]};});_0x11652a[_0x45a8('0x4a')]=_[_0x45a8('0x4b')](_0x27703c,'name');_0x11652a[_0x45a8('0x4c')]=_[_0x45a8('0x4d')](_0x5b6392[_0x45a8('0x4c')]);_0x11652a[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x11652a[_0x45a8('0x4a')],_0x11652a[_0x45a8('0x4c')]);_0x35bcf1['attributes']=_[_0x45a8('0x4f')](_0x11652a[_0x45a8('0x4a')],qs[_0x45a8('0x50')](_0x5b6392[_0x45a8('0x4c')]['fields']));_0x35bcf1[_0x45a8('0x51')]=_0x35bcf1[_0x45a8('0x51')][_0x45a8('0x52')]?_0x35bcf1['attributes']:_0x11652a['model'];if(!_0x5b6392[_0x45a8('0x4c')][_0x45a8('0x53')](_0x45a8('0x54'))){_0x35bcf1[_0x45a8('0x37')]=qs[_0x45a8('0x37')](_0x5b6392[_0x45a8('0x4c')][_0x45a8('0x37')]);_0x35bcf1['offset']=qs[_0x45a8('0x36')](_0x5b6392[_0x45a8('0x4c')][_0x45a8('0x36')]);}_0x35bcf1[_0x45a8('0x55')]=qs[_0x45a8('0x56')](_0x5b6392[_0x45a8('0x4c')][_0x45a8('0x56')]);_0x35bcf1['where']=qs[_0x45a8('0x4e')](_[_0x45a8('0x57')](_0x5b6392[_0x45a8('0x4c')],_0x11652a[_0x45a8('0x4e')]),_0x27703c);if(_0x5b6392['query'][_0x45a8('0x58')]){_0x35bcf1['where']=_['merge'](_0x35bcf1['where'],{'$or':_[_0x45a8('0x4b')](_0x27703c,function(_0x5a721a){if(_0x5a721a[_0x45a8('0x48')]!=='VIRTUAL'){var _0x58f06d={};_0x58f06d[_0x5a721a[_0x45a8('0x3e')]]={'$like':'%'+_0x5b6392[_0x45a8('0x4c')][_0x45a8('0x58')]+'%'};return _0x58f06d;}})});}_0x35bcf1=_[_0x45a8('0x59')]({},_0x35bcf1,_0x5b6392['options']);var _0x47cc99={'where':_0x35bcf1['where']};return db[_0x45a8('0x46')][_0x45a8('0x35')](_0x47cc99)['then'](function(_0x56cd6c){_0x46c281['count']=_0x56cd6c;if(_0x5b6392[_0x45a8('0x4c')][_0x45a8('0x5a')]){_0x35bcf1['include']=[{'all':!![]}];}return db[_0x45a8('0x46')]['findAll'](_0x35bcf1);})[_0x45a8('0x25')](function(_0x4f4fcb){_0x46c281[_0x45a8('0x5b')]=_0x4f4fcb;return _0x46c281;})[_0x45a8('0x25')](respondWithFilteredResult(_0x18d741,_0x35bcf1))[_0x45a8('0x30')](handleError(_0x18d741,null));};exports[_0x45a8('0x5c')]=function(_0x84277a,_0x17a9d7){var _0x491c45={'raw':![],'where':{'id':_0x84277a[_0x45a8('0x5d')]['id']},'include':[{'model':db[_0x45a8('0x41')],'as':_0x45a8('0x42')},{'model':db[_0x45a8('0x5e')],'as':_0x45a8('0x43')},{'model':db[_0x45a8('0x44')],'as':'mandatoryDispositionPause'}]},_0x204aab={};_0x204aab['model']=_[_0x45a8('0x4d')](db[_0x45a8('0x46')][_0x45a8('0x5f')]);_0x204aab[_0x45a8('0x4c')]=_[_0x45a8('0x4d')](_0x84277a[_0x45a8('0x4c')]);_0x204aab['filters']=_[_0x45a8('0x4f')](_0x204aab['model'],_0x204aab[_0x45a8('0x4c')]);_0x491c45['attributes']=_[_0x45a8('0x4f')](_0x204aab[_0x45a8('0x4a')],qs[_0x45a8('0x50')](_0x84277a[_0x45a8('0x4c')][_0x45a8('0x50')]));_0x491c45['attributes']=_0x491c45[_0x45a8('0x51')][_0x45a8('0x52')]?_0x491c45['attributes']:_0x204aab['model'];if(_0x84277a[_0x45a8('0x4c')][_0x45a8('0x5a')]){_0x491c45['include']=[{'all':!![]}];}_0x491c45=_['merge']({},_0x491c45,_0x84277a['options']);return db[_0x45a8('0x46')][_0x45a8('0x60')](_0x491c45)['then'](handleEntityNotFound(_0x17a9d7,null))[_0x45a8('0x25')](respondWithResult(_0x17a9d7,null))[_0x45a8('0x30')](handleError(_0x17a9d7,null));};exports[_0x45a8('0x61')]=function(_0x2b1afc,_0x21ed84){if(_0x2b1afc[_0x45a8('0x62')]['id']){delete _0x2b1afc[_0x45a8('0x62')]['id'];}return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x2b1afc[_0x45a8('0x5d')]['id']},'include':[{'model':db[_0x45a8('0x41')],'as':_0x45a8('0x42')},{'model':db[_0x45a8('0x5e')],'as':_0x45a8('0x43')},{'model':db['Pause'],'as':_0x45a8('0x45')}]})[_0x45a8('0x25')](handleEntityNotFound(_0x21ed84,null))[_0x45a8('0x25')](saveUpdates(_0x2b1afc[_0x45a8('0x62')],null))['then'](function(_0x4a7ad6){if(_0x4a7ad6&&_0x2b1afc['body'][_0x45a8('0x42')]){return db[_0x45a8('0x41')][_0x45a8('0x61')](_0x2b1afc[_0x45a8('0x62')][_0x45a8('0x42')],{'where':{'MailAccountId':_0x4a7ad6['id']}})[_0x45a8('0x25')](function(){return _0x4a7ad6;});}return _0x4a7ad6;})[_0x45a8('0x25')](function(_0x1c9e5a){if(_0x1c9e5a&&_0x2b1afc[_0x45a8('0x62')][_0x45a8('0x43')]){return db['MailServerOut'][_0x45a8('0x61')](_0x2b1afc['body']['Smtp'],{'where':{'MailAccountId':_0x1c9e5a['id']}})[_0x45a8('0x25')](function(){return _0x1c9e5a;});}return _0x1c9e5a;})[_0x45a8('0x25')](respondWithResult(_0x21ed84,null))[_0x45a8('0x30')](handleError(_0x21ed84,null));};exports[_0x45a8('0x63')]=function(_0x52320b,_0x32dfde){return db[_0x45a8('0x46')]['describe']()['then'](respondWithResult(_0x32dfde,null))[_0x45a8('0x30')](handleError(_0x32dfde,null));};exports[_0x45a8('0x64')]=function(_0x2ab534,_0x978793,_0xd7d82a){if(_0x2ab534[_0x45a8('0x62')]['id']){delete _0x2ab534['body']['id'];}return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x2ab534[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x978793,null))[_0x45a8('0x25')](function(_0x4592ce){if(_0x4592ce){_0x2ab534[_0x45a8('0x62')][_0x45a8('0x65')]=_0x4592ce['id'];return db['Disposition'][_0x45a8('0x66')](_0x2ab534[_0x45a8('0x62')]);}})[_0x45a8('0x25')](respondWithResult(_0x978793,null))[_0x45a8('0x30')](handleError(_0x978793,null));};exports[_0x45a8('0x67')]=function(_0x11d7e1,_0x29ce86,_0x4af72d){var _0x28a7d1={'raw':![],'where':{}};var _0x1c5a9b={};var _0x1c89fc={'count':0x0,'rows':[]};return db['MailAccount'][_0x45a8('0x68')]({'where':{'id':_0x11d7e1[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x29ce86,null))[_0x45a8('0x25')](function(_0x35a1d7){if(_0x35a1d7){_0x1c5a9b['model']=_[_0x45a8('0x4d')](db[_0x45a8('0x69')][_0x45a8('0x5f')]);_0x1c5a9b[_0x45a8('0x4c')]=_['keys'](_0x11d7e1[_0x45a8('0x4c')]);_0x1c5a9b[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x1c5a9b['model'],_0x1c5a9b[_0x45a8('0x4c')]);_0x28a7d1[_0x45a8('0x51')]=_[_0x45a8('0x4f')](_0x1c5a9b[_0x45a8('0x4a')],qs[_0x45a8('0x50')](_0x11d7e1[_0x45a8('0x4c')][_0x45a8('0x50')]));_0x28a7d1[_0x45a8('0x51')]=_0x28a7d1['attributes'][_0x45a8('0x52')]?_0x28a7d1[_0x45a8('0x51')]:_0x1c5a9b[_0x45a8('0x4a')];if(!_0x11d7e1[_0x45a8('0x4c')][_0x45a8('0x53')](_0x45a8('0x54'))){_0x28a7d1['limit']=qs[_0x45a8('0x37')](_0x11d7e1[_0x45a8('0x4c')][_0x45a8('0x37')]);_0x28a7d1[_0x45a8('0x36')]=qs[_0x45a8('0x36')](_0x11d7e1[_0x45a8('0x4c')][_0x45a8('0x36')]);}_0x28a7d1['order']=qs[_0x45a8('0x56')](_0x11d7e1[_0x45a8('0x4c')][_0x45a8('0x56')]);_0x28a7d1[_0x45a8('0x6a')]=qs['filters'](_[_0x45a8('0x57')](_0x11d7e1['query'],_0x1c5a9b[_0x45a8('0x4e')]));_0x28a7d1[_0x45a8('0x6a')][_0x45a8('0x65')]=_0x35a1d7['id'];if(_0x11d7e1[_0x45a8('0x4c')][_0x45a8('0x58')]){_0x28a7d1[_0x45a8('0x6a')]=_['merge'](_0x28a7d1[_0x45a8('0x6a')],{'$or':_[_0x45a8('0x4b')](_0x28a7d1[_0x45a8('0x51')],function(_0x1bc923){var _0x20b1a6={};_0x20b1a6[_0x1bc923]={'$like':'%'+_0x11d7e1['query'][_0x45a8('0x58')]+'%'};return _0x20b1a6;})});}_0x28a7d1=_[_0x45a8('0x59')]({},_0x28a7d1,_0x11d7e1[_0x45a8('0x6b')]);return db[_0x45a8('0x69')][_0x45a8('0x35')]({'where':_0x28a7d1[_0x45a8('0x6a')]})['then'](function(_0x2e2a40){_0x1c89fc[_0x45a8('0x35')]=_0x2e2a40;if(_0x11d7e1[_0x45a8('0x4c')]['includeAll']){_0x28a7d1[_0x45a8('0x6c')]=[{'all':!![]}];}return db['Disposition'][_0x45a8('0x6d')](_0x28a7d1);})[_0x45a8('0x25')](function(_0x57e73d){_0x1c89fc[_0x45a8('0x5b')]=_0x57e73d;return _0x1c89fc;});}})[_0x45a8('0x25')](respondWithFilteredResult(_0x29ce86,_0x28a7d1))['catch'](handleError(_0x29ce86,null));};exports[_0x45a8('0x6e')]=function(_0x38d63a,_0x52b375,_0x270ef9){return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x38d63a[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x52b375,null))['then'](function(_0x92c864){if(_0x92c864){return _0x92c864['removeDispositions'](_0x38d63a[_0x45a8('0x4c')]['ids']);}})[_0x45a8('0x25')](respondWithStatusCode(_0x52b375,null))[_0x45a8('0x30')](handleError(_0x52b375,null));};exports['addAnswer']=function(_0x2b6657,_0x14dba8,_0x55b266){if(_0x2b6657['body']['id']){delete _0x2b6657[_0x45a8('0x62')]['id'];}return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x2b6657['params']['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x14dba8,null))['then'](function(_0x530f2b){if(_0x530f2b){_0x2b6657[_0x45a8('0x62')]['MailAccountId']=_0x530f2b['id'];return db[_0x45a8('0x6f')][_0x45a8('0x66')](_0x2b6657[_0x45a8('0x62')]);}})['then'](respondWithResult(_0x14dba8,null))[_0x45a8('0x30')](handleError(_0x14dba8,null));};exports[_0x45a8('0x70')]=function(_0x284465,_0x539063,_0x33c1e5){var _0x29cf46={'raw':![],'where':{}};var _0x4a5103={};var _0x43d889={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x284465[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x539063,null))[_0x45a8('0x25')](function(_0x536b30){if(_0x536b30){_0x4a5103['model']=_[_0x45a8('0x4d')](db[_0x45a8('0x6f')][_0x45a8('0x5f')]);_0x4a5103[_0x45a8('0x4c')]=_[_0x45a8('0x4d')](_0x284465[_0x45a8('0x4c')]);_0x4a5103[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x4a5103['model'],_0x4a5103[_0x45a8('0x4c')]);_0x29cf46[_0x45a8('0x51')]=_['intersection'](_0x4a5103[_0x45a8('0x4a')],qs['fields'](_0x284465[_0x45a8('0x4c')][_0x45a8('0x50')]));_0x29cf46[_0x45a8('0x51')]=_0x29cf46['attributes']['length']?_0x29cf46[_0x45a8('0x51')]:_0x4a5103[_0x45a8('0x4a')];if(!_0x284465[_0x45a8('0x4c')][_0x45a8('0x53')](_0x45a8('0x54'))){_0x29cf46[_0x45a8('0x37')]=qs['limit'](_0x284465[_0x45a8('0x4c')][_0x45a8('0x37')]);_0x29cf46['offset']=qs[_0x45a8('0x36')](_0x284465[_0x45a8('0x4c')][_0x45a8('0x36')]);}_0x29cf46[_0x45a8('0x55')]=qs[_0x45a8('0x56')](_0x284465[_0x45a8('0x4c')][_0x45a8('0x56')]);_0x29cf46[_0x45a8('0x6a')]=qs['filters'](_[_0x45a8('0x57')](_0x284465[_0x45a8('0x4c')],_0x4a5103[_0x45a8('0x4e')]));_0x29cf46[_0x45a8('0x6a')][_0x45a8('0x65')]=_0x536b30['id'];if(_0x284465[_0x45a8('0x4c')]['filter']){_0x29cf46[_0x45a8('0x6a')]=_[_0x45a8('0x59')](_0x29cf46['where'],{'$or':_[_0x45a8('0x4b')](_0x29cf46[_0x45a8('0x51')],function(_0x191a01){var _0x1e64cc={};_0x1e64cc[_0x191a01]={'$like':'%'+_0x284465[_0x45a8('0x4c')][_0x45a8('0x58')]+'%'};return _0x1e64cc;})});}_0x29cf46=_[_0x45a8('0x59')]({},_0x29cf46,_0x284465[_0x45a8('0x6b')]);return db['CannedAnswer'][_0x45a8('0x35')]({'where':_0x29cf46[_0x45a8('0x6a')]})[_0x45a8('0x25')](function(_0x4aacfe){_0x43d889['count']=_0x4aacfe;if(_0x284465[_0x45a8('0x4c')][_0x45a8('0x5a')]){_0x29cf46['include']=[{'all':!![]}];}return db[_0x45a8('0x6f')][_0x45a8('0x6d')](_0x29cf46);})[_0x45a8('0x25')](function(_0x5a0762){_0x43d889['rows']=_0x5a0762;return _0x43d889;});}})['then'](respondWithFilteredResult(_0x539063,_0x29cf46))[_0x45a8('0x30')](handleError(_0x539063,null));};exports[_0x45a8('0x71')]=function(_0x580979,_0x1cbfe6,_0x22af62){return db[_0x45a8('0x46')]['find']({'where':{'id':_0x580979[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x1cbfe6,null))[_0x45a8('0x25')](function(_0x28c524){if(_0x28c524){return _0x28c524['removeAnswers'](_0x580979['query']['ids']);}})['then'](respondWithStatusCode(_0x1cbfe6,null))['catch'](handleError(_0x1cbfe6,null));};exports[_0x45a8('0x66')]=function(_0x17b527,_0x3f29b5){var _0xb18ce={'name':_0x17b527[_0x45a8('0x62')][_0x45a8('0x3e')],'key':_0x17b527[_0x45a8('0x62')]['key'],'email':_0x17b527[_0x45a8('0x62')][_0x45a8('0x72')],'ListId':_0x17b527['body'][_0x45a8('0x73')],'active':!_[_0x45a8('0x74')](_0x17b527[_0x45a8('0x62')]['active'])?_0x17b527['body'][_0x45a8('0x75')]:!![],'description':_0x17b527['body'][_0x45a8('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x45a8('0x74')](_0x17b527[_0x45a8('0x62')][_0x45a8('0x77')])){if(_0x17b527['body'][_0x45a8('0x78')]){_0xb18ce[_0x45a8('0x42')][_0x45a8('0x79')]=_0xb18ce['Smtp'][_0x45a8('0x79')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x7a')];_0xb18ce['Imap'][_0x45a8('0x7b')]=_0xb18ce[_0x45a8('0x43')][_0x45a8('0x7c')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x7d')];}else{_0xb18ce[_0x45a8('0x42')][_0x45a8('0x7e')]=_0xb18ce[_0x45a8('0x43')][_0x45a8('0x7e')]=![];}_0xb18ce[_0x45a8('0x42')][_0x45a8('0x7f')]=_0x17b527[_0x45a8('0x62')]['Imap'][_0x45a8('0x7f')];_0xb18ce[_0x45a8('0x42')][_0x45a8('0x80')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x42')]['port'];_0xb18ce[_0x45a8('0x43')]['host']=_0x17b527[_0x45a8('0x62')][_0x45a8('0x43')]['host'];_0xb18ce[_0x45a8('0x43')][_0x45a8('0x80')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x43')][_0x45a8('0x80')];}else{_0xb18ce[_0x45a8('0x42')]['service']=_0xb18ce[_0x45a8('0x43')][_0x45a8('0x81')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x77')];_0xb18ce[_0x45a8('0x42')][_0x45a8('0x79')]=_0xb18ce['Smtp'][_0x45a8('0x79')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x7a')];_0xb18ce[_0x45a8('0x42')][_0x45a8('0x7b')]=_0xb18ce[_0x45a8('0x43')][_0x45a8('0x7c')]=_0x17b527[_0x45a8('0x62')][_0x45a8('0x7d')];}return db['MailAccount']['create'](_0xb18ce,{'include':[{'model':db['MailServerOut'],'as':_0x45a8('0x43')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x45a8('0x25')](function(_0x3541aa){var _0x44cd72=_0x17b527[_0x45a8('0x79')][_0x45a8('0x82')]({'plain':!![]});if(!_0x44cd72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44cd72['role']==='user'){var _0x57d8af=_0x3541aa[_0x45a8('0x82')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x45a8('0x3b'),'userProfileId':_0x44cd72[_0x45a8('0x83')]},'raw':!![]})[_0x45a8('0x25')](function(_0x394a87){if(_0x394a87&&_0x394a87[_0x45a8('0x84')]===0x0){return db[_0x45a8('0x3c')][_0x45a8('0x66')]({'name':_0x57d8af[_0x45a8('0x3e')],'resourceId':_0x57d8af['id'],'type':_0x394a87[_0x45a8('0x3e')],'sectionId':_0x394a87['id']},{})[_0x45a8('0x25')](function(){return _0x3541aa;});}else{return _0x3541aa;}})[_0x45a8('0x30')](function(_0x34bc11){logger[_0x45a8('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34bc11);throw _0x34bc11;});}return _0x3541aa;})[_0x45a8('0x25')](respondWithResult(_0x3f29b5,0xc9))[_0x45a8('0x30')](handleError(_0x3f29b5,null));};exports[_0x45a8('0x85')]=function(_0x319657,_0x1357db,_0x2c8f85){return db[_0x45a8('0x46')][_0x45a8('0x68')]({'where':{'id':_0x319657['params']['id']}})['then'](handleEntityNotFound(_0x1357db,null))[_0x45a8('0x25')](function(_0xab9f89){if(_0xab9f89){return _0xab9f89[_0x45a8('0x85')]();}return null;})[_0x45a8('0x25')](respondWithResult(_0x1357db,null))[_0x45a8('0x30')](handleError(_0x1357db,null));};exports[_0x45a8('0x86')]=function(_0x539657,_0x339a08,_0x469bc8){if(_0x539657['body']['id']){delete _0x539657['body']['id'];}return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x539657['params']['id']}})['then'](handleEntityNotFound(_0x339a08,null))[_0x45a8('0x25')](function(_0x953b9d){if(_0x953b9d){_0x539657['body'][_0x45a8('0x65')]=_0x953b9d['id'];return db[_0x45a8('0x41')][_0x45a8('0x66')](_0x539657[_0x45a8('0x62')]);}})['then'](respondWithResult(_0x339a08,null))[_0x45a8('0x30')](handleError(_0x339a08,null));};exports[_0x45a8('0x87')]=function(_0x252475,_0x584413,_0x29f94e){return db[_0x45a8('0x46')]['findOne']({'where':{'id':_0x252475[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x584413,null))[_0x45a8('0x25')](function(_0x58eaf9){if(_0x58eaf9){return _0x58eaf9[_0x45a8('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x584413,null))['catch'](handleError(_0x584413,null));};exports[_0x45a8('0x89')]=function(_0x2b9f26,_0x18df9a,_0x3de90a){return db[_0x45a8('0x46')][_0x45a8('0x68')]({'where':{'id':_0x2b9f26[_0x45a8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x18df9a,null))[_0x45a8('0x25')](function(_0x2b5095){if(_0x2b5095){return _0x2b5095[_0x45a8('0x89')]();}return null;})['then'](respondWithResult(_0x18df9a,null))[_0x45a8('0x30')](handleError(_0x18df9a,null));};exports[_0x45a8('0x8a')]=function(_0x6a9f52,_0x1ee1fd,_0x35b5f7){if(_0x6a9f52[_0x45a8('0x62')]['id']){delete _0x6a9f52[_0x45a8('0x62')]['id'];}return db['MailAccount'][_0x45a8('0x60')]({'where':{'id':_0x6a9f52[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x1ee1fd,null))['then'](function(_0x14a2e0){if(_0x14a2e0){_0x6a9f52[_0x45a8('0x62')][_0x45a8('0x65')]=_0x14a2e0['id'];return db[_0x45a8('0x5e')][_0x45a8('0x66')](_0x6a9f52[_0x45a8('0x62')]);}})[_0x45a8('0x25')](respondWithResult(_0x1ee1fd,null))[_0x45a8('0x30')](handleError(_0x1ee1fd,null));};exports['removeSmtp']=function(_0x4d2c4b,_0x355eb5,_0x301241){return db['MailAccount'][_0x45a8('0x68')]({'where':{'id':_0x4d2c4b['params']['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x355eb5,null))['then'](function(_0x3af320){if(_0x3af320){return _0x3af320[_0x45a8('0x8b')](null);}return null;})[_0x45a8('0x25')](respondWithStatusCode(_0x355eb5,null))[_0x45a8('0x30')](handleError(_0x355eb5,null));};exports[_0x45a8('0x8c')]=function(_0x43f6c2,_0x133c7b,_0x592840){return db[_0x45a8('0x8d')][_0x45a8('0x60')]({'where':{'id':_0x43f6c2[_0x45a8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x133c7b,null))[_0x45a8('0x25')](function(_0x24a4fe){if(_0x24a4fe){return _0x24a4fe[_0x45a8('0x8c')](_0x43f6c2[_0x45a8('0x62')][_0x45a8('0x8e')],_[_0x45a8('0x8f')](_0x43f6c2[_0x45a8('0x62')],[_0x45a8('0x8e'),'id'])||{});}})[_0x45a8('0x25')](respondWithResult(_0x133c7b,null))['catch'](handleError(_0x133c7b,null));};exports['getInteractions']=function(_0x359710,_0x382d02,_0x30b93b){var _0x2c16ff={'raw':![],'where':{}};var _0x550420={};var _0x1bae44={'count':0x0,'rows':[]};return db[_0x45a8('0x46')][_0x45a8('0x68')]({'where':{'id':_0x359710[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x382d02,null))[_0x45a8('0x25')](function(_0x223409){if(_0x223409){_0x550420[_0x45a8('0x4a')]=_[_0x45a8('0x4d')](db[_0x45a8('0x8d')][_0x45a8('0x5f')]);_0x550420['query']=_[_0x45a8('0x4d')](_0x359710[_0x45a8('0x4c')]);_0x550420[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x550420['model'],_0x550420[_0x45a8('0x4c')]);_0x2c16ff[_0x45a8('0x51')]=_[_0x45a8('0x4f')](_0x550420['model'],qs['fields'](_0x359710[_0x45a8('0x4c')][_0x45a8('0x50')]));_0x2c16ff['attributes']=_0x2c16ff['attributes'][_0x45a8('0x52')]?_0x2c16ff[_0x45a8('0x51')]:_0x550420[_0x45a8('0x4a')];if(!_0x359710[_0x45a8('0x4c')][_0x45a8('0x53')](_0x45a8('0x54'))){_0x2c16ff[_0x45a8('0x37')]=qs[_0x45a8('0x37')](_0x359710[_0x45a8('0x4c')][_0x45a8('0x37')]);_0x2c16ff[_0x45a8('0x36')]=qs['offset'](_0x359710[_0x45a8('0x4c')][_0x45a8('0x36')]);}_0x2c16ff[_0x45a8('0x55')]=qs[_0x45a8('0x56')](_0x359710['query'][_0x45a8('0x56')]);_0x2c16ff[_0x45a8('0x6a')]=qs[_0x45a8('0x4e')](_[_0x45a8('0x57')](_0x359710['query'],_0x550420['filters']));_0x2c16ff[_0x45a8('0x6a')]['MailAccountId']=_0x223409['id'];if(_0x359710['query'][_0x45a8('0x58')]){_0x2c16ff[_0x45a8('0x6a')]=_[_0x45a8('0x59')](_0x2c16ff[_0x45a8('0x6a')],{'$or':_[_0x45a8('0x4b')](_0x2c16ff['attributes'],function(_0x14beb9){var _0x434a09={};_0x434a09[_0x14beb9]={'$like':'%'+_0x359710[_0x45a8('0x4c')]['filter']+'%'};return _0x434a09;})});}_0x2c16ff=_[_0x45a8('0x59')]({},_0x2c16ff,_0x359710[_0x45a8('0x6b')]);return db[_0x45a8('0x8d')][_0x45a8('0x35')]({'where':_0x2c16ff[_0x45a8('0x6a')]})[_0x45a8('0x25')](function(_0x51561a){_0x1bae44[_0x45a8('0x35')]=_0x51561a;if(_0x359710[_0x45a8('0x4c')][_0x45a8('0x5a')]){_0x2c16ff['include']=[{'model':db[_0x45a8('0x90')],'as':_0x45a8('0x91'),'required':![]},{'model':db['User'],'as':_0x45a8('0x92'),'attributes':[_0x45a8('0x3e'),_0x45a8('0x93'),_0x45a8('0x94')],'required':![]},{'model':db[_0x45a8('0x95')],'as':_0x45a8('0x96'),'attributes':['id',_0x45a8('0x3e'),'color'],'where':_0x359710[_0x45a8('0x4c')][_0x45a8('0x97')]?{'id':_0x359710[_0x45a8('0x4c')]['tag']}:undefined,'required':_0x359710[_0x45a8('0x4c')][_0x45a8('0x97')]?!![]:![]}];}return db[_0x45a8('0x8d')][_0x45a8('0x6d')](_0x2c16ff);})['then'](function(_0x1eeb7c){_0x1bae44[_0x45a8('0x5b')]=_0x1eeb7c;return _0x1bae44;});}})[_0x45a8('0x25')](respondWithFilteredResult(_0x382d02,_0x2c16ff))[_0x45a8('0x30')](handleError(_0x382d02,null));};exports[_0x45a8('0x98')]=function(_0x23812c,_0x286b01,_0x52376e){return db[_0x45a8('0x46')]['findOne']({'where':{'id':_0x23812c['params']['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x286b01,null))[_0x45a8('0x25')](function(_0xead8c8){if(_0xead8c8){return db['sequelize']['transaction'](function(_0x2b9c63){return db[_0x45a8('0x99')]['destroy']({'where':{'MailAccountId':_0x23812c['params']['id']},'transaction':_0x2b9c63})['then'](function(_0x2ccde5){var _0x4c0b92=_[_0x45a8('0x4b')](_0x23812c[_0x45a8('0x62')],function(_0x694f6b){_0x694f6b['MailAccountId']=_0x23812c[_0x45a8('0x5d')]['id'];return _0x694f6b;});return db['MailApplication']['bulkCreate'](_0x4c0b92,{'transaction':_0x2b9c63});});})[_0x45a8('0x25')](function(){return db['MailApplication'][_0x45a8('0x9a')]({'where':{'MailAccountId':_0x23812c[_0x45a8('0x5d')]['id']},'order':_0x45a8('0x9b')});});}})[_0x45a8('0x25')](respondWithResult(_0x286b01,null))['catch'](handleError(_0x286b01,null));};exports['getApplications']=function(_0x2f37cb,_0x4bddea,_0xd394e3){var _0x2c5605={};var _0x487679={};var _0x196cb7;var _0x16fa89;return db['MailAccount'][_0x45a8('0x68')]({'where':{'id':_0x2f37cb[_0x45a8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4bddea,null))['then'](function(_0x52faab){if(_0x52faab){_0x196cb7=_0x52faab;_0x487679[_0x45a8('0x4a')]=_['keys'](db[_0x45a8('0x99')][_0x45a8('0x5f')]);_0x487679[_0x45a8('0x4c')]=_[_0x45a8('0x4d')](_0x2f37cb[_0x45a8('0x4c')]);_0x487679[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x487679[_0x45a8('0x4a')],_0x487679[_0x45a8('0x4c')]);_0x2c5605[_0x45a8('0x51')]=_['intersection'](_0x487679[_0x45a8('0x4a')],qs['fields'](_0x2f37cb[_0x45a8('0x4c')]['fields']));_0x2c5605[_0x45a8('0x51')]=_0x2c5605[_0x45a8('0x51')][_0x45a8('0x52')]?_0x2c5605[_0x45a8('0x51')]:_0x487679[_0x45a8('0x4a')];_0x2c5605['order']=qs[_0x45a8('0x56')](_0x2f37cb[_0x45a8('0x4c')][_0x45a8('0x56')]);_0x2c5605[_0x45a8('0x6a')]=qs['filters'](_[_0x45a8('0x57')](_0x2f37cb[_0x45a8('0x4c')],_0x487679[_0x45a8('0x4e')]));if(_0x2f37cb[_0x45a8('0x4c')][_0x45a8('0x58')]){_0x2c5605['where']=_[_0x45a8('0x59')](_0x2c5605[_0x45a8('0x6a')],{'$or':_[_0x45a8('0x4b')](_0x2c5605[_0x45a8('0x51')],function(_0x32148f){var _0x4dee7f={};_0x4dee7f[_0x32148f]={'$like':'%'+_0x2f37cb[_0x45a8('0x4c')][_0x45a8('0x58')]+'%'};return _0x4dee7f;})});}_0x2c5605=_[_0x45a8('0x59')]({},_0x2c5605,_0x2f37cb[_0x45a8('0x6b')]);return _0x196cb7[_0x45a8('0x9c')](_0x2c5605);}})['then'](function(_0x46a74e){if(_0x46a74e){_0x16fa89=_0x46a74e[_0x45a8('0x52')];if(!_0x2f37cb[_0x45a8('0x4c')][_0x45a8('0x53')]('nolimit')){_0x2c5605[_0x45a8('0x37')]=qs['limit'](_0x2f37cb[_0x45a8('0x4c')]['limit']);_0x2c5605[_0x45a8('0x36')]=qs[_0x45a8('0x36')](_0x2f37cb[_0x45a8('0x4c')][_0x45a8('0x36')]);}return _0x196cb7['getApplications'](_0x2c5605);}})['then'](function(_0x24f8d2){if(_0x24f8d2){return _0x24f8d2?{'count':_0x16fa89,'rows':_0x24f8d2}:null;}})[_0x45a8('0x25')](respondWithResult(_0x4bddea,null))[_0x45a8('0x30')](handleError(_0x4bddea,null));};exports[_0x45a8('0x9d')]=function(_0x3cedc8,_0x58b60c,_0x323156){var _0x313d14={'raw':!![],'where':{}};var _0x884249={};var _0x577084={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3cedc8[_0x45a8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x58b60c,null))['then'](function(_0x48f7c3){if(_0x48f7c3){_0x884249[_0x45a8('0x4a')]=_[_0x45a8('0x4d')](db[_0x45a8('0x9e')]['rawAttributes']);_0x884249['query']=_[_0x45a8('0x4d')](_0x3cedc8[_0x45a8('0x4c')]);_0x884249[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x884249[_0x45a8('0x4a')],_0x884249[_0x45a8('0x4c')]);_0x313d14['attributes']=_['intersection'](_0x884249[_0x45a8('0x4a')],qs[_0x45a8('0x50')](_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x50')]));_0x313d14[_0x45a8('0x51')]=_0x313d14[_0x45a8('0x51')][_0x45a8('0x52')]?_0x313d14[_0x45a8('0x51')]:_0x884249[_0x45a8('0x4a')];if(!_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x53')](_0x45a8('0x54'))){_0x313d14[_0x45a8('0x37')]=qs[_0x45a8('0x37')](_0x3cedc8[_0x45a8('0x4c')]['limit']);_0x313d14[_0x45a8('0x36')]=qs[_0x45a8('0x36')](_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x36')]);}_0x313d14['order']=qs[_0x45a8('0x56')](_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x56')]);_0x313d14[_0x45a8('0x6a')]=qs[_0x45a8('0x4e')](_[_0x45a8('0x57')](_0x3cedc8['query'],_0x884249['filters']));_0x313d14['where'][_0x45a8('0x65')]=_0x48f7c3['id'];if(_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x58')]){_0x313d14['where']=_[_0x45a8('0x59')](_0x313d14[_0x45a8('0x6a')],{'$or':_[_0x45a8('0x4b')](_0x313d14[_0x45a8('0x51')],function(_0x280af1){var _0x39379b={};_0x39379b[_0x280af1]={'$like':'%'+_0x3cedc8['query']['filter']+'%'};return _0x39379b;})});}if(_0x3cedc8[_0x45a8('0x4c')]['$gte']){var _0x1b66c6=_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x9f')]['split'](',');var _0x34510d={};_0x34510d[_0x1b66c6[0x0]]={'$gte':moment(_0x1b66c6[0x1])[_0x45a8('0xa0')](_0x45a8('0xa1'))};_0x313d14[_0x45a8('0x6a')]=_['merge'](_0x313d14[_0x45a8('0x6a')],_0x34510d);}_0x313d14=_['merge']({},_0x313d14,_0x3cedc8['options']);return db[_0x45a8('0x9e')][_0x45a8('0x35')]({'where':_0x313d14[_0x45a8('0x6a')]})[_0x45a8('0x25')](function(_0x4e2de7){_0x577084[_0x45a8('0x35')]=_0x4e2de7;if(_0x3cedc8[_0x45a8('0x4c')][_0x45a8('0x5a')]){_0x313d14[_0x45a8('0x6c')]=[{'all':!![]}];}return db[_0x45a8('0x9e')][_0x45a8('0x6d')](_0x313d14);})[_0x45a8('0x25')](function(_0x43937f){_0x577084[_0x45a8('0x5b')]=_0x43937f;return _0x577084;});}})['then'](respondWithFilteredResult(_0x58b60c,_0x313d14))[_0x45a8('0x30')](handleError(_0x58b60c,null));};exports[_0x45a8('0x3f')]=function(_0x5de05a,_0x4d6424,_0x26ae9b){var _0x4d23db,_0xaa2fa1={},_0xef8b07;if(_0x5de05a['body']['to']){_0xef8b07=_0x5de05a[_0x45a8('0x62')]['to']['split'](',')[0x0];}return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x5de05a[_0x45a8('0x5d')]['id']},'include':[{'model':db[_0x45a8('0xa2')],'as':'List','include':[{'model':db[_0x45a8('0x90')],'as':_0x45a8('0xa3'),'where':{'email':_0xef8b07},'limit':0x1,'order':[[_0x45a8('0xa4'),_0x45a8('0xa5')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x45a8('0x25')](handleEntityNotFound(_0x4d6424,null))[_0x45a8('0x25')](function(_0x55ee91){if(_0x55ee91){_0x4d23db=_0x55ee91;if(_0x55ee91[_0x45a8('0x43')]){if(_[_0x45a8('0x74')](_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa6')])){_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa6')]=util['format']('%s\x20<%s>',_0x55ee91[_0x45a8('0x3e')],_0x55ee91[_0x45a8('0x72')]||_0x55ee91[_0x45a8('0x43')][_0x45a8('0x79')]);}if(_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa7')]&&_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa7')][_0x45a8('0x52')]){for(var _0x51ede2=0x0;_0x51ede2<_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa7')]['length'];_0x51ede2+=0x1){_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa7')][_0x51ede2]={'filename':_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa7')][_0x51ede2][_0x45a8('0x3e')],'path':path['join'](config[_0x45a8('0xa8')],_0x45a8('0xa9'),_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa7')][_0x51ede2][_0x45a8('0xaa')])};}}var _0x444cf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x55ee91[_0x45a8('0x43')][_0x45a8('0x81')])){if(_0x55ee91[_0x45a8('0x43')][_0x45a8('0x7e')]){_0x444cf7[_0x45a8('0xab')]={'user':_0x55ee91[_0x45a8('0x43')]['user'],'pass':_0x55ee91[_0x45a8('0x43')]['pass']};}_0x444cf7[_0x45a8('0x7f')]=_0x55ee91[_0x45a8('0x43')][_0x45a8('0x7f')];_0x444cf7[_0x45a8('0x80')]=_0x55ee91[_0x45a8('0x43')][_0x45a8('0x80')];_0x444cf7['secure']=_0x55ee91[_0x45a8('0x43')]['secure'];}else{_0x444cf7[_0x45a8('0x81')]=_0x55ee91['Smtp'][_0x45a8('0x81')];_0x444cf7[_0x45a8('0xab')]={'user':_0x55ee91[_0x45a8('0x43')][_0x45a8('0x79')],'pass':_0x55ee91['Smtp'][_0x45a8('0x7c')]};}return respondWithRpcPromise(_0x45a8('0xac'),_0x45a8('0xad'),{'account':_0x444cf7,'message':_0x5de05a[_0x45a8('0x62')]});}else{throw new Error('List\x20not\x20found');}}})[_0x45a8('0x25')](function(_0x2e2bac){if(_0x2e2bac){_0xaa2fa1=_0x2e2bac;if(_0x4d23db[_0x45a8('0xae')]){if(_0x4d23db[_0x45a8('0xae')][_0x45a8('0xa3')]['length']){return _0x4d23db['List'][_0x45a8('0xa3')][0x0];}else{return db[_0x45a8('0x90')]['create'](_[_0x45a8('0x1a')](_0x5de05a['body'],{'firstName':_0x5de05a[_0x45a8('0x62')]['to'],'email':_0x5de05a[_0x45a8('0x62')]['to'],'phone':_0x5de05a[_0x45a8('0x62')]['to'],'ListId':_0x4d23db[_0x45a8('0x73')]}));}}else{throw new Error(_0x45a8('0xaf'));}}})[_0x45a8('0x25')](function(_0xa7e5d9){if(_0xa7e5d9){var _0x3eb4c6={'UserId':_0x5de05a[_0x45a8('0x79')]['id'],'ContactId':_0xa7e5d9['id'],'MailAccountId':_0x4d23db['id'],'inReplyTo':_0xaa2fa1[_0x45a8('0xb0')],'to':_0x5de05a[_0x45a8('0x62')][_0x45a8('0xa6')],'cc':_0x5de05a[_0x45a8('0x62')]['cc'],'subject':_0x5de05a[_0x45a8('0x62')][_0x45a8('0xb1')],'attach':_0x5de05a[_0x45a8('0x62')][_0x45a8('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x45a8('0xa0')](_0x45a8('0xa1')),'lastMsgDirection':'out','lastMsgBody':_0x5de05a[_0x45a8('0x62')][_0x45a8('0x62')],'Messages':[_[_0x45a8('0x59')](_0x5de05a[_0x45a8('0x62')],{'messageId':_0xaa2fa1[_0x45a8('0xb0')],'sentAt':moment()[_0x45a8('0xa0')](_0x45a8('0xa1')),'read':!![],'MailAccountId':_0x4d23db['id'],'UserId':_0x5de05a[_0x45a8('0x79')]['id'],'ContactId':_0xa7e5d9['id']})]};if(_0x5de05a['body'][_0x45a8('0xb3')]){_0x3eb4c6=_['merge'](_0x3eb4c6,_0x5de05a[_0x45a8('0x62')][_0x45a8('0xb3')]);}return db['MailInteraction']['create'](_0x3eb4c6,{'include':[{'model':db['MailMessage'],'as':_0x45a8('0xb4')}]});}})[_0x45a8('0x25')](respondWithResult(_0x4d6424,null))[_0x45a8('0x30')](handleError(_0x4d6424,null));};exports[_0x45a8('0xb5')]=function(_0x8bddcb,_0x106da2,_0x588d23){return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x8bddcb[_0x45a8('0x5d')]['id']},'include':[{'model':db[_0x45a8('0x5e')],'as':'Smtp','raw':!![]}]})[_0x45a8('0x25')](handleEntityNotFound(_0x106da2,null))[_0x45a8('0x25')](function(_0x3919d5){if(_0x3919d5&&_0x3919d5[_0x45a8('0x43')]){var _0x2eff5b={'id':_0x3919d5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3919d5[_0x45a8('0x43')][_0x45a8('0x81')]){_0x2eff5b[_0x45a8('0x81')]=_0x3919d5[_0x45a8('0x43')][_0x45a8('0x81')];}else{_0x2eff5b[_0x45a8('0x7f')]=_0x3919d5[_0x45a8('0x43')][_0x45a8('0x7f')];_0x2eff5b[_0x45a8('0x80')]=_0x3919d5[_0x45a8('0x43')][_0x45a8('0x80')];_0x2eff5b[_0x45a8('0xb6')]=_0x3919d5[_0x45a8('0x43')][_0x45a8('0xb6')];}if(_0x3919d5[_0x45a8('0x43')]['authentication']){_0x2eff5b[_0x45a8('0xab')]={'user':_0x3919d5['Smtp'][_0x45a8('0x79')],'pass':_0x3919d5[_0x45a8('0x43')][_0x45a8('0x7c')]};}return respondWithRpcPromise(_0x45a8('0xb7'),_0x45a8('0xb5'),{'account':_0x2eff5b});}})[_0x45a8('0x25')](respondWithResult(_0x106da2,null))[_0x45a8('0x30')](handleError(_0x106da2,null));};exports[_0x45a8('0x3a')]=function(_0x7c5b5b,_0x14f492){return db['MailAccount'][_0x45a8('0x60')]({'where':{'id':_0x7c5b5b[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x14f492,null))[_0x45a8('0x25')](function(_0x23d8f5){if(_0x23d8f5&&_0x23d8f5[_0x45a8('0x81')]){throw new db[(_0x45a8('0x22'))][(_0x45a8('0xb8'))](_0x45a8('0xb9'));}return _0x23d8f5;})['then'](removeEntity(_0x14f492,null))[_0x45a8('0x30')](handleError(_0x14f492,null));};exports['addAgents']=function(_0x145a33,_0xa109a8,_0x5112eb){return db[_0x45a8('0x46')][_0x45a8('0x60')]({'where':{'id':_0x145a33[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0xa109a8,null))['then'](function(_0x29185d){if(_0x29185d){return _0x29185d[_0x45a8('0xba')](_0x145a33['body'][_0x45a8('0x8e')],_[_0x45a8('0x8f')](_0x145a33[_0x45a8('0x62')],[_0x45a8('0x8e'),'id'])||{})['spread'](function(_0xc29f8f){for(var _0x25a3aa=0x0;_0x25a3aa<_0x145a33[_0x45a8('0x62')][_0x45a8('0x8e')]['length'];_0x25a3aa+=0x1){socket['emit'](_0x45a8('0xbb'),{'UserId':_0x145a33[_0x45a8('0x62')][_0x45a8('0x8e')][_0x25a3aa],'MailAccountId':_0x145a33[_0x45a8('0x5d')]['id']});}return _0xc29f8f;});}})[_0x45a8('0x25')](respondWithResult(_0xa109a8,null))[_0x45a8('0x30')](handleError(_0xa109a8,null));};exports[_0x45a8('0xbc')]=function(_0xcbc499,_0x1d4ac9,_0x490cb1){return db[_0x45a8('0x46')]['find']({'where':{'id':_0xcbc499[_0x45a8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1d4ac9,null))[_0x45a8('0x25')](function(_0x4a0d68){if(_0x4a0d68){return _0x4a0d68[_0x45a8('0xbc')](_0xcbc499[_0x45a8('0x4c')][_0x45a8('0x8e')])['then'](function(){if(_[_0x45a8('0xbd')](_0xcbc499[_0x45a8('0x4c')][_0x45a8('0x8e')])){for(var _0x59d25b=0x0;_0x59d25b<_0xcbc499[_0x45a8('0x4c')][_0x45a8('0x8e')][_0x45a8('0x52')];_0x59d25b+=0x1){socket[_0x45a8('0xbe')]('userMailAccount:remove',{'UserId':Number(_0xcbc499[_0x45a8('0x4c')]['ids'][_0x59d25b]),'MailAccountId':Number(_0xcbc499['params']['id'])});}}else{socket[_0x45a8('0xbe')](_0x45a8('0xbf'),{'UserId':Number(_0xcbc499[_0x45a8('0x4c')][_0x45a8('0x8e')]),'MailAccountId':Number(_0xcbc499['params']['id'])});}});}})[_0x45a8('0x25')](respondWithStatusCode(_0x1d4ac9,null))[_0x45a8('0x30')](handleError(_0x1d4ac9,null));};exports[_0x45a8('0xc0')]=function(_0x246ebc,_0x3dcb0c,_0x3a97c0){var _0x50f1c2={};var _0x78a869={};var _0x312cf9;var _0xa4d587;return db['MailAccount'][_0x45a8('0x68')]({'where':{'id':_0x246ebc[_0x45a8('0x5d')]['id']}})[_0x45a8('0x25')](handleEntityNotFound(_0x3dcb0c,null))[_0x45a8('0x25')](function(_0x53a668){if(_0x53a668){_0x312cf9=_0x53a668;_0x78a869[_0x45a8('0x4a')]=_['keys'](db[_0x45a8('0xc1')][_0x45a8('0x5f')]);_0x78a869['query']=_[_0x45a8('0x4d')](_0x246ebc[_0x45a8('0x4c')]);_0x78a869[_0x45a8('0x4e')]=_[_0x45a8('0x4f')](_0x78a869[_0x45a8('0x4a')],_0x78a869[_0x45a8('0x4c')]);_0x50f1c2[_0x45a8('0x51')]=_['intersection'](_0x78a869[_0x45a8('0x4a')],qs['fields'](_0x246ebc[_0x45a8('0x4c')][_0x45a8('0x50')]));_0x50f1c2['attributes']=_0x50f1c2['attributes'][_0x45a8('0x52')]?_0x50f1c2['attributes']:_0x78a869[_0x45a8('0x4a')];_0x50f1c2[_0x45a8('0x55')]=qs[_0x45a8('0x56')](_0x246ebc[_0x45a8('0x4c')]['sort']);_0x50f1c2[_0x45a8('0x6a')]=qs[_0x45a8('0x4e')](_[_0x45a8('0x57')](_0x246ebc['query'],_0x78a869['filters']));if(_0x246ebc[_0x45a8('0x4c')][_0x45a8('0x58')]){_0x50f1c2[_0x45a8('0x6a')]=_[_0x45a8('0x59')](_0x50f1c2['where'],{'$or':_[_0x45a8('0x4b')](_0x50f1c2[_0x45a8('0x51')],function(_0x3881bf){var _0xb27425={};_0xb27425[_0x3881bf]={'$like':'%'+_0x246ebc[_0x45a8('0x4c')][_0x45a8('0x58')]+'%'};return _0xb27425;})});}_0x50f1c2=_[_0x45a8('0x59')]({},_0x50f1c2,_0x246ebc['options']);return _0x312cf9[_0x45a8('0xc0')](_0x50f1c2);}})[_0x45a8('0x25')](function(_0x47fc9a){if(_0x47fc9a){_0xa4d587=_0x47fc9a[_0x45a8('0x52')];if(!_0x246ebc[_0x45a8('0x4c')][_0x45a8('0x53')](_0x45a8('0x54'))){_0x50f1c2[_0x45a8('0x37')]=qs[_0x45a8('0x37')](_0x246ebc[_0x45a8('0x4c')][_0x45a8('0x37')]);_0x50f1c2[_0x45a8('0x36')]=qs[_0x45a8('0x36')](_0x246ebc[_0x45a8('0x4c')]['offset']);}return _0x312cf9[_0x45a8('0xc0')](_0x50f1c2);}})[_0x45a8('0x25')](function(_0x1df0b7){if(_0x1df0b7){return _0x1df0b7?{'count':_0xa4d587,'rows':_0x1df0b7}:null;}})[_0x45a8('0x25')](respondWithResult(_0x3dcb0c,null))['catch'](handleError(_0x3dcb0c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e5c4cca..2b32566 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 _0x17f4=['hasOwnProperty','exports','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x8d5b4a,_0x5e2551){var _0x2a9ce9=function(_0x58b2f3){while(--_0x58b2f3){_0x8d5b4a['push'](_0x8d5b4a['shift']());}};_0x2a9ce9(++_0x5e2551);}(_0x17f4,0x1ea));var _0x417f=function(_0x54a14f,_0x59c124){_0x54a14f=_0x54a14f-0x0;var _0x47d334=_0x17f4[_0x54a14f];return _0x47d334;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x417f('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x417f('0x1')](0x0);var events={'afterCreate':_0x417f('0x2'),'afterUpdate':_0x417f('0x3'),'afterDestroy':_0x417f('0x4')};function emitEvent(_0x46741d){return function(_0x5e1b33,_0x3666cd,_0x354d68){MailAccountEvents['emit'](_0x46741d+':'+_0x5e1b33['id'],_0x5e1b33);MailAccountEvents[_0x417f('0x5')](_0x46741d,_0x5e1b33);_0x354d68(null);};}for(var e in events){if(events[_0x417f('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x417f('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xa90f=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x54b82a,_0xa88a0b){var _0x20a5f2=function(_0x30d121){while(--_0x30d121){_0x54b82a['push'](_0x54b82a['shift']());}};_0x20a5f2(++_0xa88a0b);}(_0xa90f,0x183));var _0xfa90=function(_0x45494,_0x1040a5){_0x45494=_0x45494-0x0;var _0x2ee547=_0xa90f[_0x45494];return _0x2ee547;};'use strict';var EventEmitter=require(_0xfa90('0x0'));var MailAccount=require(_0xfa90('0x1'))['db'][_0xfa90('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfa90('0x3')](0x0);var events={'afterCreate':_0xfa90('0x4'),'afterUpdate':_0xfa90('0x5'),'afterDestroy':_0xfa90('0x6')};function emitEvent(_0x443de4){return function(_0x3b3097,_0x2ac4f7,_0x397881){MailAccountEvents[_0xfa90('0x7')](_0x443de4+':'+_0x3b3097['id'],_0x3b3097);MailAccountEvents[_0xfa90('0x7')](_0x443de4,_0x3b3097);_0x397881(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xfa90('0x8')](e,emitEvent(event));}}module[_0xfa90('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 3cf6fc6..5ca57e5 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 _0xa084=['MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x3587a0,_0xae4563){var _0x58ccf5=function(_0x49b625){while(--_0x49b625){_0x3587a0['push'](_0x3587a0['shift']());}};_0x58ccf5(++_0xae4563);}(_0xa084,0x1f0));var _0x4a08=function(_0x3ca7c6,_0x39a174){_0x3ca7c6=_0x3ca7c6-0x0;var _0x2b5cfe=_0xa084[_0x3ca7c6];return _0x2b5cfe;};'use strict';var _=require(_0x4a08('0x0'));var util=require(_0x4a08('0x1'));var logger=require(_0x4a08('0x2'))(_0x4a08('0x3'));var moment=require(_0x4a08('0x4'));var BPromise=require(_0x4a08('0x5'));var rp=require(_0x4a08('0x6'));var fs=require('fs');var path=require(_0x4a08('0x7'));var rimraf=require(_0x4a08('0x8'));var config=require(_0x4a08('0x9'));var attributes=require(_0x4a08('0xa'));module['exports']=function(_0x2585da,_0x479e24){return _0x2585da['define'](_0x4a08('0xb'),attributes,{'tableName':_0x4a08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9e=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','api','bluebird','path','../../config/environment'];(function(_0x7cacf9,_0x6dac99){var _0xde6456=function(_0x2fdf27){while(--_0x2fdf27){_0x7cacf9['push'](_0x7cacf9['shift']());}};_0xde6456(++_0x6dac99);}(_0x9b9e,0x1d1));var _0xe9b9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9b9e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe9b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe9b9('0x1'));var moment=require('moment');var BPromise=require(_0xe9b9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9b9('0x3'));var rimraf=require('rimraf');var config=require(_0xe9b9('0x4'));var attributes=require(_0xe9b9('0x5'));module[_0xe9b9('0x6')]=function(_0x57a3b5,_0x5c8dcf){return _0x57a3b5[_0xe9b9('0x7')](_0xe9b9('0x8'),attributes,{'tableName':_0xe9b9('0x9'),'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 6dfd9b7..f776f02 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 _0x3f49=['MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetMailAccount','MailAccount','findAll','options','attributes','include','map','model','catch','ShowMailAccount','find','raw','NotifyMailAccount','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','list','orderBy','applications','priority','asc','autoclose','push','length','close','create','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','attach','interaction','get','attachments','originTo','originCc','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x36adf0,_0x1c5ba0){var _0x26c05d=function(_0x233666){while(--_0x233666){_0x36adf0['push'](_0x36adf0['shift']());}};_0x26c05d(++_0x1c5ba0);}(_0x3f49,0x11f));var _0x93f4=function(_0x2bfe6f,_0x21b9a1){_0x2bfe6f=_0x2bfe6f-0x0;var _0x5bdcc5=_0x3f49[_0x2bfe6f];return _0x5bdcc5;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var moment=require('moment');var BPromise=require(_0x93f4('0x2'));var rs=require(_0x93f4('0x3'));var fs=require('fs');var Redis=require(_0x93f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f4('0x5'));var logger=require(_0x93f4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f4('0x7'));var client=jayson[_0x93f4('0x8')][_0x93f4('0x9')]({'port':0x232c});config['redis']=_[_0x93f4('0xa')](config['redis'],{'host':_0x93f4('0xb'),'port':0x18eb});var socket=require(_0x93f4('0xc'))(new Redis(config[_0x93f4('0xd')]));require(_0x93f4('0xe'))[_0x93f4('0xf')](socket);function respondWithRpcPromise(_0x35976f,_0x3c0833,_0x996161){return new BPromise(function(_0x4a7b76,_0x506b51){return client[_0x93f4('0x10')](_0x35976f,_0x996161)[_0x93f4('0x11')](function(_0x1da54d){logger[_0x93f4('0x12')](_0x93f4('0x13'),_0x3c0833,_0x93f4('0x14'));logger[_0x93f4('0x15')](_0x93f4('0x16'),_0x3c0833,'request\x20sent',JSON[_0x93f4('0x17')](_0x1da54d));if(_0x1da54d['error']){if(_0x1da54d['error'][_0x93f4('0x18')]===0x1f4){logger[_0x93f4('0x19')](_0x93f4('0x13'),_0x3c0833,_0x1da54d['error']['message']);return _0x506b51(_0x1da54d[_0x93f4('0x19')][_0x93f4('0x1a')]);}logger[_0x93f4('0x19')]('MailAccount,\x20%s,\x20%s',_0x3c0833,_0x1da54d[_0x93f4('0x19')][_0x93f4('0x1a')]);return _0x4a7b76(_0x1da54d['error'][_0x93f4('0x1a')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x3c0833,_0x93f4('0x14'));_0x4a7b76(_0x1da54d['result'][_0x93f4('0x1a')]);}})['catch'](function(_0x4ca0a4){logger['error'](_0x93f4('0x13'),_0x3c0833,_0x4ca0a4);_0x506b51(_0x4ca0a4);});});}exports[_0x93f4('0x1b')]=function(_0x525784){var _0x1ef4b3=this;return new Promise(function(_0x5bacf5,_0x3ead08){return db[_0x93f4('0x1c')][_0x93f4('0x1d')]({'raw':_0x525784[_0x93f4('0x1e')]?_0x525784['options']['raw']===undefined?!![]:![]:!![],'where':_0x525784[_0x93f4('0x1e')]?_0x525784[_0x93f4('0x1e')]['where']||null:null,'attributes':_0x525784['options']?_0x525784['options'][_0x93f4('0x1f')]||null:null,'limit':_0x525784[_0x93f4('0x1e')]?_0x525784[_0x93f4('0x1e')]['limit']||null:null,'include':_0x525784[_0x93f4('0x1e')]?_0x525784['options'][_0x93f4('0x20')]?_[_0x93f4('0x21')](_0x525784['options'][_0x93f4('0x20')],function(_0x1decfc){return{'model':db[_0x1decfc[_0x93f4('0x22')]],'as':_0x1decfc['as'],'attributes':_0x1decfc[_0x93f4('0x1f')],'include':_0x1decfc['include']?_[_0x93f4('0x21')](_0x1decfc[_0x93f4('0x20')],function(_0x2fa1b1){return{'model':db[_0x2fa1b1[_0x93f4('0x22')]],'as':_0x2fa1b1['as'],'attributes':_0x2fa1b1['attributes'],'include':_0x2fa1b1[_0x93f4('0x20')]?_[_0x93f4('0x21')](_0x2fa1b1[_0x93f4('0x20')],function(_0x7f57d6){return{'model':db[_0x7f57d6[_0x93f4('0x22')]],'as':_0x7f57d6['as'],'attributes':_0x7f57d6[_0x93f4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x93f4('0x11')](function(_0x2fce95){logger['info'](_0x93f4('0x1b'),_0x525784);logger[_0x93f4('0x15')]('GetMailAccount',_0x525784,JSON['stringify'](_0x2fce95));_0x5bacf5(_0x2fce95);})[_0x93f4('0x23')](function(_0x551bf9){logger[_0x93f4('0x19')]('GetMailAccount',_0x551bf9[_0x93f4('0x1a')],_0x525784);_0x3ead08(_0x1ef4b3['error'](0x1f4,_0x551bf9['message']));});});};exports[_0x93f4('0x24')]=function(_0x35c095){var _0x181abf=this;return new Promise(function(_0x5c4a00,_0x22666f){return db[_0x93f4('0x1c')][_0x93f4('0x25')]({'raw':_0x35c095[_0x93f4('0x1e')]?_0x35c095[_0x93f4('0x1e')][_0x93f4('0x26')]===undefined?!![]:![]:!![],'where':_0x35c095[_0x93f4('0x1e')]?_0x35c095[_0x93f4('0x1e')]['where']||null:null,'attributes':_0x35c095[_0x93f4('0x1e')]?_0x35c095[_0x93f4('0x1e')]['attributes']||null:null,'include':_0x35c095[_0x93f4('0x1e')]?_0x35c095[_0x93f4('0x1e')]['include']?_['map'](_0x35c095[_0x93f4('0x1e')][_0x93f4('0x20')],function(_0x26fb01){return{'model':db[_0x26fb01[_0x93f4('0x22')]],'as':_0x26fb01['as'],'attributes':_0x26fb01[_0x93f4('0x1f')],'include':_0x26fb01[_0x93f4('0x20')]?_[_0x93f4('0x21')](_0x26fb01[_0x93f4('0x20')],function(_0x25a197){return{'model':db[_0x25a197[_0x93f4('0x22')]],'as':_0x25a197['as'],'attributes':_0x25a197[_0x93f4('0x1f')],'include':_0x25a197[_0x93f4('0x20')]?_[_0x93f4('0x21')](_0x25a197[_0x93f4('0x20')],function(_0x20f018){return{'model':db[_0x20f018[_0x93f4('0x22')]],'as':_0x20f018['as'],'attributes':_0x20f018[_0x93f4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x93f4('0x11')](function(_0x5e6c30){logger[_0x93f4('0x12')]('ShowMailAccount',_0x35c095);logger[_0x93f4('0x15')](_0x93f4('0x24'),_0x35c095,JSON[_0x93f4('0x17')](_0x5e6c30));_0x5c4a00(_0x5e6c30);})[_0x93f4('0x23')](function(_0x44c9a5){logger[_0x93f4('0x19')](_0x93f4('0x24'),_0x44c9a5[_0x93f4('0x1a')],_0x35c095);_0x22666f(_0x181abf[_0x93f4('0x19')](0x1f4,_0x44c9a5[_0x93f4('0x1a')]));});});};exports[_0x93f4('0x27')]=function(_0x1cff88){var _0x1fdf49=this;return new Promise(function(_0x36482e,_0x2e527c){var _0x5c90b3={'body':_0x1cff88['body'],'channel':'mail'};var _0x41b77f=_[_0x93f4('0x28')](_[_0x93f4('0x29')](db[_0x93f4('0x2a')]['rawAttributes']),[_0x93f4('0x2b'),_0x93f4('0x2c'),_0x93f4('0x2d'),_0x93f4('0x2e')]);var _0x5fb9aa=![];if(_0x1cff88[_0x93f4('0x2f')]['id']){delete _0x1cff88[_0x93f4('0x2f')]['id'];}if(_[_0x93f4('0x30')](_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x31')])){return _0x2e527c(_0x1fdf49['error'](0x1f4,_0x93f4('0x32')));}if(_['isNil'](_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x2f')])||_0x1cff88[_0x93f4('0x2f')]['body']===''){return _0x2e527c(_0x1fdf49[_0x93f4('0x19')](0x1f4,_0x93f4('0x33')));}if(_[_0x93f4('0x30')](_0x1cff88[_0x93f4('0x2f')]['mapKey'])){return _0x2e527c(_0x1fdf49[_0x93f4('0x19')](0x1f4,_0x93f4('0x34')+_0x41b77f));}if(!_[_0x93f4('0x35')](_0x41b77f,_0x1cff88['body'][_0x93f4('0x36')])){return _0x2e527c(_0x1fdf49[_0x93f4('0x19')](0x1f4,_0x93f4('0x37')+_0x41b77f));}var _0x32e941={};_0x32e941[_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x36')]]=_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x31')];return db[_0x93f4('0x1c')][_0x93f4('0x25')]({'where':{'id':_0x1cff88[_0x93f4('0x38')]['id']},'include':[{'model':db[_0x93f4('0x39')],'as':_0x93f4('0x3a'),'include':[{'model':db[_0x93f4('0x2a')],'as':_0x93f4('0x3b'),'where':_0x32e941,'limit':0x1,'order':[['updatedAt',_0x93f4('0x3c')]]}]},{'model':db[_0x93f4('0x3d')],'as':_0x93f4('0x3e')},{'model':db[_0x93f4('0x3f')],'as':_0x93f4('0x40')}]})[_0x93f4('0x11')](function(_0x5478bb){if(_0x5478bb&&_0x5478bb[_0x93f4('0x3a')]){var _0x32434d=_0x5478bb['get']({'plain':!![]});_0x5c90b3[_0x93f4('0x38')]=_[_0x93f4('0x41')](_0x32434d,[_0x93f4('0x3e'),_0x93f4('0x3a')]);_0x5c90b3['applications']=_0x32434d[_0x93f4('0x3e')];_0x5c90b3[_0x93f4('0x42')]=_0x32434d[_0x93f4('0x3a')];_0x5c90b3['applications']=_[_0x93f4('0x43')](_0x5c90b3[_0x93f4('0x44')],[_0x93f4('0x45')],[_0x93f4('0x46')]);if(_0x5c90b3['account']&&_0x5c90b3['account'][_0x93f4('0x47')]){_0x5c90b3[_0x93f4('0x44')][_0x93f4('0x48')]({'id':0x0,'priority':_0x5c90b3[_0x93f4('0x44')][_0x93f4('0x49')]+0x1,'app':_0x93f4('0x4a'),'appdata':_0x93f4('0x47'),'interval':'*,*,*,*'});}if(_0x5c90b3[_0x93f4('0x38')][_0x93f4('0x3e')]){delete _0x5c90b3[_0x93f4('0x38')][_0x93f4('0x3e')];}if(_0x5c90b3[_0x93f4('0x38')][_0x93f4('0x3a')]){delete _0x5c90b3[_0x93f4('0x38')][_0x93f4('0x3a')];}if(_0x32434d['List']['Contacts']['length']){return _0x32434d[_0x93f4('0x3a')][_0x93f4('0x3b')][0x0];}var _0x350771=_[_0x93f4('0xa')](_0x1cff88['body'],{'firstName':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x31')],'ListId':_0x32434d[_0x93f4('0x2e')]});_0x350771[_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x36')]]=_0x1cff88['body'][_0x93f4('0x31')];return db[_0x93f4('0x2a')][_0x93f4('0x4b')](_0x350771);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x8d827e){_0x5c90b3['contact']=_0x8d827e;if(_0x8d827e){if(!_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x4c')]){_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x4c')]=rs[_0x93f4('0x4d')]()+'\x20'+_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x31')];}var _0x2499b5={'ContactId':_0x8d827e['id'],'MailAccountId':_0x1cff88[_0x93f4('0x38')]['id'],'inReplyTo':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x4c')],'to':_0x1cff88['body'][_0x93f4('0x1a')][_0x93f4('0x31')],'cc':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')]['cc'],'subject':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x4e')],'attach':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')]['attach'],'lastMsgAt':moment()[_0x93f4('0x4f')](_0x93f4('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x2f')]};return db[_0x93f4('0x51')][_0x93f4('0x25')]({'where':{'closed':![],'MailAccountId':_0x1cff88[_0x93f4('0x38')]['id']},'include':[{'model':db[_0x93f4('0x52')],'as':_0x93f4('0x53'),'attributes':[_0x93f4('0x4c')],'where':{'messageId':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x54')]}}]})[_0x93f4('0x11')](function(_0x1f3922){if(_0x1f3922){return[_0x1f3922,![]];}return db[_0x93f4('0x51')][_0x93f4('0x4b')](_0x2499b5)[_0x93f4('0x11')](function(_0x43e5e9){return[_0x43e5e9,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x93f4('0x55')](function(_0x3a6b82,_0x424342){if(_0x3a6b82){_0x5fb9aa=_0x424342;if(!_0x424342){return _0x3a6b82[_0x93f4('0x56')]({'inReplyTo':_0x1cff88['body'][_0x93f4('0x1a')][_0x93f4('0x4c')],'to':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x31')],'cc':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')]['cc'],'subject':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x4e')],'attach':_0x3a6b82[_0x93f4('0x57')]?_0x3a6b82[_0x93f4('0x57')]:_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x57')],'substatus':null,'substatusAt':moment()[_0x93f4('0x4f')](_0x93f4('0x50')),'lastMsgAt':moment()['format'](_0x93f4('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x1cff88[_0x93f4('0x2f')]['body']});}else{return _0x3a6b82;}}})[_0x93f4('0x11')](function(_0x2e92b8){_0x5c90b3[_0x93f4('0x58')]=_0x2e92b8[_0x93f4('0x59')]({'plain':!![]});_0x5c90b3['interaction']['created']=_0x5fb9aa;return db[_0x93f4('0x52')][_0x93f4('0x4b')]({'body':_0x1cff88[_0x93f4('0x2f')]['body'],'MailAccountId':_0x1cff88['account']['id'],'MailInteractionId':_0x2e92b8['id'],'direction':'in','ContactId':_0x5c90b3['contact']['id'],'messageId':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x4c')],'from':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x31')],'to':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')]['to'],'cc':_0x1cff88['body'][_0x93f4('0x1a')]['cc'],'subject':_0x1cff88['body'][_0x93f4('0x1a')][_0x93f4('0x4e')],'attach':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x57')],'Attachments':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x5a')],'originTo':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x5b')],'originCc':_0x1cff88[_0x93f4('0x2f')][_0x93f4('0x1a')][_0x93f4('0x5c')],'bcc':_0x1cff88['body'][_0x93f4('0x1a')]['bcc']},{'include':[{'model':db[_0x93f4('0x5d')],'as':_0x93f4('0x5e')}]});})[_0x93f4('0x11')](function(_0x23857a){_0x5c90b3[_0x93f4('0x1a')]=_0x23857a;if(_0x5c90b3['interaction']['UserId']){return db[_0x93f4('0x5f')][_0x93f4('0x25')]({'attributes':['id',_0x93f4('0x60')],'where':{'id':_0x5c90b3['interaction'][_0x93f4('0x61')]}})[_0x93f4('0x11')](function(_0x508022){if(_0x508022){_0x5c90b3[_0x93f4('0x44')][_0x93f4('0x62')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x508022[_0x93f4('0x60')]+','+(_0x5c90b3['account'][_0x93f4('0x63')]||0xa),'interval':_0x93f4('0x64')});}return respondWithRpcPromise('Start',_0x93f4('0x65'),_0x5c90b3);});}return respondWithRpcPromise(_0x93f4('0x66'),'startRouting',_0x5c90b3);})[_0x93f4('0x11')](function(_0x1a49bc){_0x36482e(_0x1a49bc);})['catch'](function(_0x3d10b8){_0x2e527c(_0x1fdf49[_0x93f4('0x19')](0x1f4,_0x3d10b8[_0x93f4('0x1a')]));});});}; \ No newline at end of file +var _0x24cf=['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','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','subject','attach','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetMailAccount','MailAccount','options','raw','limit','include','map','model','attributes','ShowMailAccount','find','where','then','stringify','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt'];(function(_0x4e4cd8,_0x2fa08f){var _0x49e062=function(_0x4fd809){while(--_0x4fd809){_0x4e4cd8['push'](_0x4e4cd8['shift']());}};_0x49e062(++_0x2fa08f);}(_0x24cf,0x1d5));var _0xf24c=function(_0x2cbb2e,_0x2ffae6){_0x2cbb2e=_0x2cbb2e-0x0;var _0x38c860=_0x24cf[_0x2cbb2e];return _0x38c860;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf24c('0x0'));var BPromise=require(_0xf24c('0x1'));var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0xf24c('0x9')](config['redis'],{'host':_0xf24c('0xa'),'port':0x18eb});var socket=require(_0xf24c('0xb'))(new Redis(config[_0xf24c('0xc')]));require(_0xf24c('0xd'))['register'](socket);function respondWithRpcPromise(_0x4347ba,_0x37193c,_0x260dfd){return new BPromise(function(_0x21a4cc,_0x3bfc0f){return client[_0xf24c('0xe')](_0x4347ba,_0x260dfd)['then'](function(_0x13a62e){logger[_0xf24c('0xf')](_0xf24c('0x10'),_0x37193c,'request\x20sent');logger[_0xf24c('0x11')](_0xf24c('0x12'),_0x37193c,'request\x20sent',JSON['stringify'](_0x13a62e));if(_0x13a62e[_0xf24c('0x13')]){if(_0x13a62e['error'][_0xf24c('0x14')]===0x1f4){logger[_0xf24c('0x13')]('MailAccount,\x20%s,\x20%s',_0x37193c,_0x13a62e[_0xf24c('0x13')][_0xf24c('0x15')]);return _0x3bfc0f(_0x13a62e[_0xf24c('0x13')][_0xf24c('0x15')]);}logger[_0xf24c('0x13')]('MailAccount,\x20%s,\x20%s',_0x37193c,_0x13a62e['error'][_0xf24c('0x15')]);return _0x21a4cc(_0x13a62e[_0xf24c('0x13')]['message']);}else{logger[_0xf24c('0xf')](_0xf24c('0x10'),_0x37193c,_0xf24c('0x16'));_0x21a4cc(_0x13a62e[_0xf24c('0x17')][_0xf24c('0x15')]);}})[_0xf24c('0x18')](function(_0x36ceba){logger[_0xf24c('0x13')](_0xf24c('0x10'),_0x37193c,_0x36ceba);_0x3bfc0f(_0x36ceba);});});}exports[_0xf24c('0x19')]=function(_0x2e6f8f){var _0x2ea5de=this;return new Promise(function(_0x555e78,_0x24bf58){return db[_0xf24c('0x1a')]['findAll']({'raw':_0x2e6f8f[_0xf24c('0x1b')]?_0x2e6f8f[_0xf24c('0x1b')][_0xf24c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e6f8f['options']?_0x2e6f8f[_0xf24c('0x1b')]['where']||null:null,'attributes':_0x2e6f8f[_0xf24c('0x1b')]?_0x2e6f8f[_0xf24c('0x1b')]['attributes']||null:null,'limit':_0x2e6f8f[_0xf24c('0x1b')]?_0x2e6f8f[_0xf24c('0x1b')][_0xf24c('0x1d')]||null:null,'include':_0x2e6f8f[_0xf24c('0x1b')]?_0x2e6f8f[_0xf24c('0x1b')][_0xf24c('0x1e')]?_[_0xf24c('0x1f')](_0x2e6f8f[_0xf24c('0x1b')][_0xf24c('0x1e')],function(_0xc9fd87){return{'model':db[_0xc9fd87[_0xf24c('0x20')]],'as':_0xc9fd87['as'],'attributes':_0xc9fd87['attributes'],'include':_0xc9fd87['include']?_[_0xf24c('0x1f')](_0xc9fd87['include'],function(_0x535e78){return{'model':db[_0x535e78[_0xf24c('0x20')]],'as':_0x535e78['as'],'attributes':_0x535e78['attributes'],'include':_0x535e78[_0xf24c('0x1e')]?_[_0xf24c('0x1f')](_0x535e78['include'],function(_0x563ebe){return{'model':db[_0x563ebe['model']],'as':_0x563ebe['as'],'attributes':_0x563ebe[_0xf24c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33f5b9){logger[_0xf24c('0xf')](_0xf24c('0x19'),_0x2e6f8f);logger['debug'](_0xf24c('0x19'),_0x2e6f8f,JSON['stringify'](_0x33f5b9));_0x555e78(_0x33f5b9);})['catch'](function(_0x461d5b){logger[_0xf24c('0x13')](_0xf24c('0x19'),_0x461d5b[_0xf24c('0x15')],_0x2e6f8f);_0x24bf58(_0x2ea5de['error'](0x1f4,_0x461d5b[_0xf24c('0x15')]));});});};exports[_0xf24c('0x22')]=function(_0x40cb38){var _0x311801=this;return new Promise(function(_0x3cfe5d,_0x16c827){return db['MailAccount'][_0xf24c('0x23')]({'raw':_0x40cb38[_0xf24c('0x1b')]?_0x40cb38[_0xf24c('0x1b')][_0xf24c('0x1c')]===undefined?!![]:![]:!![],'where':_0x40cb38[_0xf24c('0x1b')]?_0x40cb38[_0xf24c('0x1b')][_0xf24c('0x24')]||null:null,'attributes':_0x40cb38['options']?_0x40cb38[_0xf24c('0x1b')]['attributes']||null:null,'include':_0x40cb38[_0xf24c('0x1b')]?_0x40cb38[_0xf24c('0x1b')]['include']?_[_0xf24c('0x1f')](_0x40cb38['options'][_0xf24c('0x1e')],function(_0x269d1b){return{'model':db[_0x269d1b[_0xf24c('0x20')]],'as':_0x269d1b['as'],'attributes':_0x269d1b['attributes'],'include':_0x269d1b[_0xf24c('0x1e')]?_['map'](_0x269d1b[_0xf24c('0x1e')],function(_0x527472){return{'model':db[_0x527472['model']],'as':_0x527472['as'],'attributes':_0x527472['attributes'],'include':_0x527472[_0xf24c('0x1e')]?_[_0xf24c('0x1f')](_0x527472[_0xf24c('0x1e')],function(_0x3334b3){return{'model':db[_0x3334b3[_0xf24c('0x20')]],'as':_0x3334b3['as'],'attributes':_0x3334b3[_0xf24c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf24c('0x25')](function(_0x4d6963){logger[_0xf24c('0xf')](_0xf24c('0x22'),_0x40cb38);logger[_0xf24c('0x11')](_0xf24c('0x22'),_0x40cb38,JSON[_0xf24c('0x26')](_0x4d6963));_0x3cfe5d(_0x4d6963);})['catch'](function(_0x177c02){logger['error'](_0xf24c('0x22'),_0x177c02[_0xf24c('0x15')],_0x40cb38);_0x16c827(_0x311801[_0xf24c('0x13')](0x1f4,_0x177c02[_0xf24c('0x15')]));});});};exports[_0xf24c('0x27')]=function(_0x24b183){var _0x3e5d78=this;return new Promise(function(_0x37f00a,_0x46d8d1){var _0x1341a5={'body':_0x24b183[_0xf24c('0x28')],'channel':'mail'};var _0x5d55f0=_[_0xf24c('0x29')](_[_0xf24c('0x2a')](db[_0xf24c('0x2b')][_0xf24c('0x2c')]),[_0xf24c('0x2d'),_0xf24c('0x2e'),_0xf24c('0x2f'),_0xf24c('0x30')]);var _0x39b45b=![];if(_0x24b183[_0xf24c('0x28')]['id']){delete _0x24b183[_0xf24c('0x28')]['id'];}if(_['isNil'](_0x24b183[_0xf24c('0x28')]['from'])){return _0x46d8d1(_0x3e5d78[_0xf24c('0x13')](0x1f4,_0xf24c('0x31')));}if(_[_0xf24c('0x32')](_0x24b183[_0xf24c('0x28')][_0xf24c('0x28')])||_0x24b183[_0xf24c('0x28')][_0xf24c('0x28')]===''){return _0x46d8d1(_0x3e5d78[_0xf24c('0x13')](0x1f4,_0xf24c('0x33')));}if(_[_0xf24c('0x32')](_0x24b183[_0xf24c('0x28')][_0xf24c('0x34')])){return _0x46d8d1(_0x3e5d78[_0xf24c('0x13')](0x1f4,_0xf24c('0x35')+_0x5d55f0));}if(!_[_0xf24c('0x36')](_0x5d55f0,_0x24b183['body']['mapKey'])){return _0x46d8d1(_0x3e5d78[_0xf24c('0x13')](0x1f4,_0xf24c('0x37')+_0x5d55f0));}var _0x5f378d={};_0x5f378d[_0x24b183[_0xf24c('0x28')][_0xf24c('0x34')]]=_0x24b183['body'][_0xf24c('0x38')];return db[_0xf24c('0x1a')][_0xf24c('0x23')]({'where':{'id':_0x24b183[_0xf24c('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xf24c('0x3a'),'include':[{'model':db[_0xf24c('0x2b')],'as':_0xf24c('0x3b'),'where':_0x5f378d,'limit':0x1,'order':[[_0xf24c('0x2e'),_0xf24c('0x3c')]]}]},{'model':db[_0xf24c('0x3d')],'as':_0xf24c('0x3e')},{'model':db[_0xf24c('0x3f')],'as':_0xf24c('0x40')}]})[_0xf24c('0x25')](function(_0x4054c4){if(_0x4054c4&&_0x4054c4[_0xf24c('0x3a')]){var _0x31d9e0=_0x4054c4[_0xf24c('0x41')]({'plain':!![]});_0x1341a5[_0xf24c('0x39')]=_[_0xf24c('0x42')](_0x31d9e0,[_0xf24c('0x3e'),'List']);_0x1341a5[_0xf24c('0x43')]=_0x31d9e0[_0xf24c('0x3e')];_0x1341a5[_0xf24c('0x44')]=_0x31d9e0[_0xf24c('0x3a')];_0x1341a5[_0xf24c('0x43')]=_[_0xf24c('0x45')](_0x1341a5[_0xf24c('0x43')],[_0xf24c('0x46')],[_0xf24c('0x47')]);if(_0x1341a5[_0xf24c('0x39')]&&_0x1341a5['account'][_0xf24c('0x48')]){_0x1341a5[_0xf24c('0x43')]['push']({'id':0x0,'priority':_0x1341a5['applications'][_0xf24c('0x49')]+0x1,'app':_0xf24c('0x4a'),'appdata':_0xf24c('0x48'),'interval':_0xf24c('0x4b')});}if(_0x1341a5[_0xf24c('0x39')][_0xf24c('0x3e')]){delete _0x1341a5[_0xf24c('0x39')][_0xf24c('0x3e')];}if(_0x1341a5[_0xf24c('0x39')]['List']){delete _0x1341a5[_0xf24c('0x39')]['List'];}if(_0x31d9e0['List'][_0xf24c('0x3b')][_0xf24c('0x49')]){return _0x31d9e0[_0xf24c('0x3a')][_0xf24c('0x3b')][0x0];}var _0x168df5=_[_0xf24c('0x9')](_0x24b183[_0xf24c('0x28')],{'firstName':_0x24b183[_0xf24c('0x28')][_0xf24c('0x38')],'ListId':_0x31d9e0[_0xf24c('0x30')]});_0x168df5[_0x24b183['body']['mapKey']]=_0x24b183[_0xf24c('0x28')]['from'];return db[_0xf24c('0x2b')][_0xf24c('0x4c')](_0x168df5);}else{throw new Error(_0xf24c('0x4d'));}})[_0xf24c('0x25')](function(_0x26366e){_0x1341a5[_0xf24c('0x4e')]=_0x26366e;if(_0x26366e){if(!_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x4f')]){_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x4f')]=rs['generate']()+'\x20'+_0x24b183['body'][_0xf24c('0x15')][_0xf24c('0x38')];}var _0x5ae31a={'ContactId':_0x26366e['id'],'MailAccountId':_0x24b183[_0xf24c('0x39')]['id'],'inReplyTo':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x4f')],'to':_0x24b183[_0xf24c('0x28')]['message'][_0xf24c('0x38')],'cc':_0x24b183[_0xf24c('0x28')]['message']['cc'],'subject':_0x24b183['body']['message'][_0xf24c('0x50')],'attach':_0x24b183['body'][_0xf24c('0x15')][_0xf24c('0x51')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x24b183['body'][_0xf24c('0x28')]};return db[_0xf24c('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x24b183[_0xf24c('0x39')]['id']},'include':[{'model':db[_0xf24c('0x53')],'as':'Messages','attributes':[_0xf24c('0x4f')],'where':{'messageId':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x54')]}}]})[_0xf24c('0x25')](function(_0x59ecb4){if(_0x59ecb4){return[_0x59ecb4,![]];}return db['MailInteraction'][_0xf24c('0x4c')](_0x5ae31a)[_0xf24c('0x25')](function(_0x524f0a){return[_0x524f0a,!![]];});});}else{throw new Error(_0xf24c('0x55'));}})[_0xf24c('0x56')](function(_0x442840,_0x452071){if(_0x442840){_0x39b45b=_0x452071;if(!_0x452071){return _0x442840[_0xf24c('0x57')]({'inReplyTo':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x4f')],'to':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x38')],'cc':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')]['cc'],'subject':_0x24b183['body'][_0xf24c('0x15')][_0xf24c('0x50')],'attach':_0x442840[_0xf24c('0x51')]?_0x442840['attach']:_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x51')],'substatus':null,'substatusAt':moment()['format'](_0xf24c('0x58')),'lastMsgAt':moment()['format'](_0xf24c('0x58')),'lastMsgDirection':'in','lastMsgBody':_0x24b183[_0xf24c('0x28')][_0xf24c('0x28')]});}else{return _0x442840;}}})['then'](function(_0xcabeb){_0x1341a5[_0xf24c('0x59')]=_0xcabeb[_0xf24c('0x41')]({'plain':!![]});_0x1341a5[_0xf24c('0x59')][_0xf24c('0x5a')]=_0x39b45b;return db[_0xf24c('0x53')][_0xf24c('0x4c')]({'body':_0x24b183['body']['body'],'MailAccountId':_0x24b183[_0xf24c('0x39')]['id'],'MailInteractionId':_0xcabeb['id'],'direction':'in','ContactId':_0x1341a5[_0xf24c('0x4e')]['id'],'messageId':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')]['messageId'],'from':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x38')],'to':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')]['to'],'cc':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')]['cc'],'subject':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x50')],'attach':_0x24b183[_0xf24c('0x28')]['message'][_0xf24c('0x51')],'Attachments':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x5b')],'originTo':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x5c')],'originCc':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x5d')],'bcc':_0x24b183[_0xf24c('0x28')][_0xf24c('0x15')][_0xf24c('0x5e')]},{'include':[{'model':db[_0xf24c('0x5f')],'as':_0xf24c('0x60')}]});})[_0xf24c('0x25')](function(_0x16048e){_0x1341a5[_0xf24c('0x15')]=_0x16048e;if(_0x1341a5[_0xf24c('0x59')][_0xf24c('0x61')]){return db[_0xf24c('0x62')][_0xf24c('0x23')]({'attributes':['id',_0xf24c('0x63')],'where':{'id':_0x1341a5[_0xf24c('0x59')][_0xf24c('0x61')]}})[_0xf24c('0x25')](function(_0x6bfada){if(_0x6bfada){_0x1341a5[_0xf24c('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x6bfada[_0xf24c('0x63')]+','+(_0x1341a5[_0xf24c('0x39')][_0xf24c('0x64')]||0xa),'interval':_0xf24c('0x4b')});}return respondWithRpcPromise(_0xf24c('0x65'),'startRouting',_0x1341a5);});}return respondWithRpcPromise(_0xf24c('0x65'),_0xf24c('0x66'),_0x1341a5);})['then'](function(_0x18ab52){_0x37f00a(_0x18ab52);})[_0xf24c('0x18')](function(_0x228fe9){_0x46d8d1(_0x3e5d78['error'](0x1f4,_0x228fe9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9fbafcd..4b769ac 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 _0x0d4d=['remove','update','emit','removeListener','mailAccount:','./mailAccount.events','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0d4d,0x132));var _0xd0d4=function(_0x5c7e67,_0xa7f921){_0x5c7e67=_0x5c7e67-0x0;var _0x158be4=_0x0d4d[_0x5c7e67];return _0x158be4;};'use strict';var MailAccountEvents=require(_0xd0d4('0x0'));var events=[_0xd0d4('0x1'),_0xd0d4('0x2'),_0xd0d4('0x3')];function createListener(_0x1f74ab,_0x1515e0){return function(_0x4d5c19){_0x1515e0[_0xd0d4('0x4')](_0x1f74ab,_0x4d5c19);};}function removeListener(_0x58909f,_0x2e99ee){return function(){MailAccountEvents[_0xd0d4('0x5')](_0x58909f,_0x2e99ee);};}exports['register']=function(_0x34d93b){for(var _0x3db5ab=0x0,_0x1c5d01=events['length'];_0x3db5ab<_0x1c5d01;_0x3db5ab++){var _0x5bfae8=events[_0x3db5ab];var _0x5403c0=createListener(_0xd0d4('0x6')+_0x5bfae8,_0x34d93b);MailAccountEvents['on'](_0x5bfae8,_0x5403c0);}}; \ No newline at end of file +var _0xae30=['length','mailAccount:','./mailAccount.events','save','remove','emit','removeListener','register'];(function(_0x38a3f3,_0x2513e3){var _0x3f9a06=function(_0x3abac7){while(--_0x3abac7){_0x38a3f3['push'](_0x38a3f3['shift']());}};_0x3f9a06(++_0x2513e3);}(_0xae30,0x10a));var _0x0ae3=function(_0x5a3f92,_0x23e7df){_0x5a3f92=_0x5a3f92-0x0;var _0x467063=_0xae30[_0x5a3f92];return _0x467063;};'use strict';var MailAccountEvents=require(_0x0ae3('0x0'));var events=[_0x0ae3('0x1'),_0x0ae3('0x2'),'update'];function createListener(_0x565144,_0x1352ef){return function(_0x405dd0){_0x1352ef[_0x0ae3('0x3')](_0x565144,_0x405dd0);};}function removeListener(_0x51f481,_0x23a7a1){return function(){MailAccountEvents[_0x0ae3('0x4')](_0x51f481,_0x23a7a1);};}exports[_0x0ae3('0x5')]=function(_0x7ce33e){for(var _0x2b8c53=0x0,_0xda3853=events[_0x0ae3('0x6')];_0x2b8c53<_0xda3853;_0x2b8c53++){var _0x15b7e2=events[_0x2b8c53];var _0x32ea6e=createListener(_0x0ae3('0x7')+_0x15b7e2,_0x7ce33e);MailAccountEvents['on'](_0x15b7e2,_0x32ea6e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 44e9e3b..104a72a 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 _0xe605=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x57c5cd,_0x1b8b10){var _0x45a665=function(_0x1f5b31){while(--_0x1f5b31){_0x57c5cd['push'](_0x57c5cd['shift']());}};_0x45a665(++_0x1b8b10);}(_0xe605,0x92));var _0x5e60=function(_0x241259,_0x5df3e6){_0x241259=_0x241259-0x0;var _0x298004=_0xe605[_0x241259];return _0x298004;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var auth=require(_0x5e60('0x5'));var interaction=require(_0x5e60('0x6'));var config=require(_0x5e60('0x7'));var controller=require(_0x5e60('0x8'));router[_0x5e60('0x9')](_0x5e60('0xa'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xd')]('/:id',auth[_0x5e60('0xb')](),controller['update']);router['delete']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xe')]);module[_0x5e60('0xf')]=router; \ No newline at end of file +var _0x4ded=['/:id','show','put','isAuthenticated','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get'];(function(_0x38894d,_0x1883d8){var _0x5614fe=function(_0x181989){while(--_0x181989){_0x38894d['push'](_0x38894d['shift']());}};_0x5614fe(++_0x1883d8);}(_0x4ded,0x116));var _0xd4de=function(_0x394594,_0x1309be){_0x394594=_0x394594-0x0;var _0x1984d3=_0x4ded[_0x394594];return _0x1984d3;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var auth=require(_0xd4de('0x6'));var interaction=require(_0xd4de('0x7'));var config=require(_0xd4de('0x8'));var controller=require(_0xd4de('0x9'));router[_0xd4de('0xa')](_0xd4de('0xb'),auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xd')](_0xd4de('0xb'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0x10')]('/:id',auth[_0xd4de('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 407e5b5..8cc6477 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 _0xe21d=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xe21d,0x149));var _0xde21=function(_0x9cbc6c,_0x1fd5d8){_0x9cbc6c=_0x9cbc6c-0x0;var _0x63adb5=_0xe21d[_0x9cbc6c];return _0x63adb5;};'use strict';var Sequelize=require(_0xde21('0x0'));module[_0xde21('0x1')]={'priority':{'type':Sequelize[_0xde21('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xde21('0x3')},'appdata':{'type':Sequelize[_0xde21('0x4')]()},'description':{'type':Sequelize[_0xde21('0x5')]},'interval':{'type':Sequelize[_0xde21('0x5')],'defaultValue':_0xde21('0x6')}}; \ No newline at end of file +var _0x13c0=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x29a986,_0x18d77d){var _0xd4a8a4=function(_0x508a12){while(--_0x508a12){_0x29a986['push'](_0x29a986['shift']());}};_0xd4a8a4(++_0x18d77d);}(_0x13c0,0xb6));var _0x013c=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x13c0[_0x5c1cdc];return _0x2e8317;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'priority':{'type':Sequelize[_0x013c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x013c('0x3')],'allowNull':![],'defaultValue':_0x013c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x013c('0x3')]},'interval':{'type':Sequelize[_0x013c('0x3')],'defaultValue':_0x013c('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c741e60..fbb08ac 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 _0xf8de=['rawAttributes','query','intersection','attributes','fields','include','merge','options','catch','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','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','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','show','params','model','keys','MailApplication'];(function(_0x5e97b7,_0x135f4d){var _0x3b7a89=function(_0x12c22d){while(--_0x12c22d){_0x5e97b7['push'](_0x5e97b7['shift']());}};_0x3b7a89(++_0x135f4d);}(_0xf8de,0x1d4));var _0xef8d=function(_0x356c3e,_0x1bb914){_0x356c3e=_0x356c3e-0x0;var _0x1156f4=_0xf8de[_0x356c3e];return _0x1156f4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xef8d('0x0'));var rimraf=require(_0xef8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef8d('0x2'));var rp=require('request-promise');var moment=require(_0xef8d('0x3'));var BPromise=require(_0xef8d('0x4'));var Mustache=require(_0xef8d('0x5'));var util=require('util');var path=require(_0xef8d('0x6'));var sox=require(_0xef8d('0x7'));var csv=require('to-csv');var ejs=require(_0xef8d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef8d('0x9'));var jsforce=require(_0xef8d('0xa'));var deskjs=require(_0xef8d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef8d('0xc'));var Redis=require(_0xef8d('0xd'));var authService=require(_0xef8d('0xe'));var qs=require(_0xef8d('0xf'));var as=require(_0xef8d('0x10'));var hardwareService=require(_0xef8d('0x11'));var logger=require(_0xef8d('0x12'))(_0xef8d('0x13'));var utils=require(_0xef8d('0x14'));var config=require(_0xef8d('0x15'));var db=require(_0xef8d('0x16'))['db'];function respondWithStatusCode(_0x306468,_0xf48324){_0xf48324=_0xf48324||0xcc;return function(_0x241e49){if(_0x241e49){return _0x306468[_0xef8d('0x17')](_0xf48324);}return _0x306468[_0xef8d('0x18')](_0xf48324)['end']();};}function respondWithResult(_0x47e289,_0x3d306f){_0x3d306f=_0x3d306f||0xc8;return function(_0x58879c){if(_0x58879c){return _0x47e289[_0xef8d('0x18')](_0x3d306f)[_0xef8d('0x19')](_0x58879c);}};}function respondWithFilteredResult(_0x4135a4,_0xc42005){return function(_0x54ee0e){if(_0x54ee0e){var _0x594012=_0x54ee0e[_0xef8d('0x1a')],_0x40fd5a=_0xc42005[_0xef8d('0x1b')],_0x3facb7=_0xc42005['offset']+_0xc42005[_0xef8d('0x1c')],_0x286620;if(_0x3facb7>=_0x594012){_0x3facb7=_0x594012;_0x286620=0xc8;}else{_0x286620=0xce;}_0x4135a4[_0xef8d('0x18')](_0x286620);return _0x4135a4[_0xef8d('0x1d')](_0xef8d('0x1e'),_0x40fd5a+'-'+_0x3facb7+'/'+_0x594012)[_0xef8d('0x19')](_0x54ee0e);}return null;};}function patchUpdates(_0xb179e){return function(_0x5cf793){try{jsonpatch[_0xef8d('0x1f')](_0x5cf793,_0xb179e,!![]);}catch(_0x138968){return BPromise[_0xef8d('0x20')](_0x138968);}return _0x5cf793[_0xef8d('0x21')]();};}function saveUpdates(_0x1cf384,_0x586168){return function(_0x2deb31){if(_0x2deb31){return _0x2deb31[_0xef8d('0x22')](_0x1cf384)[_0xef8d('0x23')](function(_0x19c3ca){return _0x19c3ca;});}return null;};}function removeEntity(_0x32a787,_0x59c271){return function(_0x18de6d){if(_0x18de6d){return _0x18de6d['destroy']()['then'](function(){_0x32a787[_0xef8d('0x18')](0xcc)[_0xef8d('0x24')]();});}};}function handleEntityNotFound(_0x43cf28,_0xe77713){return function(_0x330c0e){if(!_0x330c0e){_0x43cf28[_0xef8d('0x17')](0x194);}return _0x330c0e;};}function handleError(_0x278a2b,_0x5bf32f){_0x5bf32f=_0x5bf32f||0x1f4;return function(_0x230c8c){logger['error'](_0x230c8c[_0xef8d('0x25')]);if(_0x230c8c[_0xef8d('0x26')]){delete _0x230c8c[_0xef8d('0x26')];}_0x278a2b[_0xef8d('0x18')](_0x5bf32f)[_0xef8d('0x27')](_0x230c8c);};}exports[_0xef8d('0x28')]=function(_0x10bcd8,_0x57dc17){var _0x24d970={'raw':!![],'where':{'id':_0x10bcd8[_0xef8d('0x29')]['id']}},_0x9491c1={};_0x9491c1[_0xef8d('0x2a')]=_[_0xef8d('0x2b')](db[_0xef8d('0x2c')][_0xef8d('0x2d')]);_0x9491c1[_0xef8d('0x2e')]=_[_0xef8d('0x2b')](_0x10bcd8[_0xef8d('0x2e')]);_0x9491c1['filters']=_[_0xef8d('0x2f')](_0x9491c1[_0xef8d('0x2a')],_0x9491c1[_0xef8d('0x2e')]);_0x24d970[_0xef8d('0x30')]=_[_0xef8d('0x2f')](_0x9491c1['model'],qs[_0xef8d('0x31')](_0x10bcd8[_0xef8d('0x2e')]['fields']));_0x24d970[_0xef8d('0x30')]=_0x24d970[_0xef8d('0x30')]['length']?_0x24d970[_0xef8d('0x30')]:_0x9491c1[_0xef8d('0x2a')];if(_0x10bcd8['query']['includeAll']){_0x24d970[_0xef8d('0x32')]=[{'all':!![]}];}_0x24d970=_[_0xef8d('0x33')]({},_0x24d970,_0x10bcd8[_0xef8d('0x34')]);return db[_0xef8d('0x2c')]['find'](_0x24d970)['then'](handleEntityNotFound(_0x57dc17,null))['then'](respondWithResult(_0x57dc17,null))[_0xef8d('0x35')](handleError(_0x57dc17,null));};exports['update']=function(_0x44c7f6,_0x4c2993){if(_0x44c7f6[_0xef8d('0x36')]['id']){delete _0x44c7f6[_0xef8d('0x36')]['id'];}return db[_0xef8d('0x2c')][_0xef8d('0x37')]({'where':{'id':_0x44c7f6[_0xef8d('0x29')]['id']}})['then'](handleEntityNotFound(_0x4c2993,null))[_0xef8d('0x23')](saveUpdates(_0x44c7f6[_0xef8d('0x36')],null))['then'](respondWithResult(_0x4c2993,null))[_0xef8d('0x35')](handleError(_0x4c2993,null));};exports[_0xef8d('0x38')]=function(_0x13b05b,_0x326089){return db[_0xef8d('0x2c')][_0xef8d('0x37')]({'where':{'id':_0x13b05b[_0xef8d('0x29')]['id']}})[_0xef8d('0x23')](handleEntityNotFound(_0x326089,null))[_0xef8d('0x23')](removeEntity(_0x326089,null))['catch'](handleError(_0x326089,null));}; \ No newline at end of file +var _0x9ca8=['catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','update'];(function(_0x390316,_0x22c246){var _0x52cf92=function(_0x14db06){while(--_0x14db06){_0x390316['push'](_0x390316['shift']());}};_0x52cf92(++_0x22c246);}(_0x9ca8,0x123));var _0x89ca=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x9ca8[_0x1abeb2];return _0x48da20;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89ca('0x1'));var jsonpatch=require(_0x89ca('0x2'));var rp=require(_0x89ca('0x3'));var moment=require(_0x89ca('0x4'));var BPromise=require(_0x89ca('0x5'));var Mustache=require('mustache');var util=require(_0x89ca('0x6'));var path=require(_0x89ca('0x7'));var sox=require(_0x89ca('0x8'));var csv=require(_0x89ca('0x9'));var ejs=require(_0x89ca('0xa'));var fs=require('fs');var _=require(_0x89ca('0xb'));var squel=require(_0x89ca('0xc'));var crypto=require(_0x89ca('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x89ca('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x89ca('0xe'));var authService=require(_0x89ca('0xf'));var qs=require(_0x89ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89ca('0x11'));var logger=require(_0x89ca('0x12'))(_0x89ca('0x13'));var utils=require(_0x89ca('0x14'));var config=require(_0x89ca('0x15'));var db=require(_0x89ca('0x16'))['db'];function respondWithStatusCode(_0x4699cc,_0x38e8a1){_0x38e8a1=_0x38e8a1||0xcc;return function(_0x3a84d7){if(_0x3a84d7){return _0x4699cc[_0x89ca('0x17')](_0x38e8a1);}return _0x4699cc['status'](_0x38e8a1)['end']();};}function respondWithResult(_0x2b4e1a,_0x566d29){_0x566d29=_0x566d29||0xc8;return function(_0x5949d6){if(_0x5949d6){return _0x2b4e1a[_0x89ca('0x18')](_0x566d29)[_0x89ca('0x19')](_0x5949d6);}};}function respondWithFilteredResult(_0x3c118f,_0x3d0624){return function(_0x31f26d){if(_0x31f26d){var _0x4a1210=_0x31f26d[_0x89ca('0x1a')],_0x3b765c=_0x3d0624[_0x89ca('0x1b')],_0x246d60=_0x3d0624[_0x89ca('0x1b')]+_0x3d0624[_0x89ca('0x1c')],_0xfbaab9;if(_0x246d60>=_0x4a1210){_0x246d60=_0x4a1210;_0xfbaab9=0xc8;}else{_0xfbaab9=0xce;}_0x3c118f['status'](_0xfbaab9);return _0x3c118f[_0x89ca('0x1d')]('Content-Range',_0x3b765c+'-'+_0x246d60+'/'+_0x4a1210)[_0x89ca('0x19')](_0x31f26d);}return null;};}function patchUpdates(_0x5f2331){return function(_0x51e67a){try{jsonpatch[_0x89ca('0x1e')](_0x51e67a,_0x5f2331,!![]);}catch(_0x11b154){return BPromise[_0x89ca('0x1f')](_0x11b154);}return _0x51e67a[_0x89ca('0x20')]();};}function saveUpdates(_0x2c8ec1,_0x35d987){return function(_0x3d77eb){if(_0x3d77eb){return _0x3d77eb['update'](_0x2c8ec1)[_0x89ca('0x21')](function(_0x45771c){return _0x45771c;});}return null;};}function removeEntity(_0x3c7c77,_0x9fa1fd){return function(_0x5bb555){if(_0x5bb555){return _0x5bb555[_0x89ca('0x22')]()['then'](function(){_0x3c7c77[_0x89ca('0x18')](0xcc)[_0x89ca('0x23')]();});}};}function handleEntityNotFound(_0x10c31c,_0x5bfa1a){return function(_0x3f0a48){if(!_0x3f0a48){_0x10c31c['sendStatus'](0x194);}return _0x3f0a48;};}function handleError(_0xa4ff16,_0x583ced){_0x583ced=_0x583ced||0x1f4;return function(_0x48d832){logger[_0x89ca('0x24')](_0x48d832[_0x89ca('0x25')]);if(_0x48d832['name']){delete _0x48d832[_0x89ca('0x26')];}_0xa4ff16[_0x89ca('0x18')](_0x583ced)[_0x89ca('0x27')](_0x48d832);};}exports[_0x89ca('0x28')]=function(_0x4c1d18,_0x34fe99){var _0xf57cbf={'raw':!![],'where':{'id':_0x4c1d18[_0x89ca('0x29')]['id']}},_0x36d80e={};_0x36d80e[_0x89ca('0x2a')]=_[_0x89ca('0x2b')](db[_0x89ca('0x2c')]['rawAttributes']);_0x36d80e[_0x89ca('0x2d')]=_['keys'](_0x4c1d18[_0x89ca('0x2d')]);_0x36d80e[_0x89ca('0x2e')]=_[_0x89ca('0x2f')](_0x36d80e['model'],_0x36d80e[_0x89ca('0x2d')]);_0xf57cbf[_0x89ca('0x30')]=_['intersection'](_0x36d80e[_0x89ca('0x2a')],qs[_0x89ca('0x31')](_0x4c1d18[_0x89ca('0x2d')][_0x89ca('0x31')]));_0xf57cbf['attributes']=_0xf57cbf[_0x89ca('0x30')][_0x89ca('0x32')]?_0xf57cbf[_0x89ca('0x30')]:_0x36d80e[_0x89ca('0x2a')];if(_0x4c1d18[_0x89ca('0x2d')][_0x89ca('0x33')]){_0xf57cbf[_0x89ca('0x34')]=[{'all':!![]}];}_0xf57cbf=_[_0x89ca('0x35')]({},_0xf57cbf,_0x4c1d18[_0x89ca('0x36')]);return db['MailApplication'][_0x89ca('0x37')](_0xf57cbf)[_0x89ca('0x21')](handleEntityNotFound(_0x34fe99,null))[_0x89ca('0x21')](respondWithResult(_0x34fe99,null))['catch'](handleError(_0x34fe99,null));};exports[_0x89ca('0x38')]=function(_0x4db830,_0x183d22){if(_0x4db830['body']['id']){delete _0x4db830['body']['id'];}return db[_0x89ca('0x2c')]['find']({'where':{'id':_0x4db830[_0x89ca('0x29')]['id']}})[_0x89ca('0x21')](handleEntityNotFound(_0x183d22,null))[_0x89ca('0x21')](saveUpdates(_0x4db830['body'],null))['then'](respondWithResult(_0x183d22,null))[_0x89ca('0x39')](handleError(_0x183d22,null));};exports[_0x89ca('0x22')]=function(_0x5c7a0a,_0x3e30c3){return db[_0x89ca('0x2c')][_0x89ca('0x37')]({'where':{'id':_0x5c7a0a['params']['id']}})['then'](handleEntityNotFound(_0x3e30c3,null))['then'](removeEntity(_0x3e30c3,null))[_0x89ca('0x39')](handleError(_0x3e30c3,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index fd5eea1..5bb6f7b 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 _0xacfe=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4'];(function(_0x37e30b,_0x2db234){var _0x552a28=function(_0x2a2dd3){while(--_0x2a2dd3){_0x37e30b['push'](_0x37e30b['shift']());}};_0x552a28(++_0x2db234);}(_0xacfe,0xfd));var _0xeacf=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xacfe[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeacf('0x0'))(_0xeacf('0x1'));var moment=require(_0xeacf('0x2'));var BPromise=require(_0xeacf('0x3'));var rp=require(_0xeacf('0x4'));var fs=require('fs');var path=require(_0xeacf('0x5'));var rimraf=require(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var attributes=require(_0xeacf('0x8'));module[_0xeacf('0x9')]=function(_0x369ad7,_0x229f28){return _0x369ad7[_0xeacf('0xa')]('MailApplication',attributes,{'tableName':_0xeacf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeacf('0xc'),'collate':_0xeacf('0xd')});}; \ No newline at end of file +var _0xf117=['utf8mb4_unicode_ci','../../config/logger','moment','rimraf','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0xf117,0x191));var _0x7f11=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf117[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f11('0x0'))('api');var moment=require(_0x7f11('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f11('0x2'));var config=require('../../config/environment');var attributes=require(_0x7f11('0x3'));module[_0x7f11('0x4')]=function(_0x100430,_0x499de2){return _0x100430['define'](_0x7f11('0x5'),attributes,{'tableName':_0x7f11('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7f11('0x7')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 73f1ca5..dcbbf55 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 _0x57a6=['limit','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/logger','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes'];(function(_0x590e51,_0x5c5583){var _0x46bf65=function(_0x1a5e9e){while(--_0x1a5e9e){_0x590e51['push'](_0x590e51['shift']());}};_0x46bf65(++_0x5c5583);}(_0x57a6,0x10a));var _0x657a=function(_0x27218f,_0x48dcd1){_0x27218f=_0x27218f-0x0;var _0x43a59b=_0x57a6[_0x27218f];return _0x43a59b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x657a('0x0'));var BPromise=require('bluebird');var rs=require(_0x657a('0x1'));var fs=require('fs');var Redis=require(_0x657a('0x2'));var db=require(_0x657a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x657a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x657a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x26ab38,_0x4cdb88,_0x39c7d5){return new BPromise(function(_0xc902c1,_0x4042f8){return client[_0x657a('0x6')](_0x26ab38,_0x39c7d5)[_0x657a('0x7')](function(_0x33dd28){logger[_0x657a('0x8')](_0x657a('0x9'),_0x4cdb88,_0x657a('0xa'));logger[_0x657a('0xb')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x4cdb88,_0x657a('0xa'),JSON['stringify'](_0x33dd28));if(_0x33dd28[_0x657a('0xc')]){if(_0x33dd28[_0x657a('0xc')]['code']===0x1f4){logger['error'](_0x657a('0x9'),_0x4cdb88,_0x33dd28[_0x657a('0xc')][_0x657a('0xd')]);return _0x4042f8(_0x33dd28[_0x657a('0xc')][_0x657a('0xd')]);}logger[_0x657a('0xc')](_0x657a('0x9'),_0x4cdb88,_0x33dd28[_0x657a('0xc')]['message']);return _0xc902c1(_0x33dd28['error'][_0x657a('0xd')]);}else{logger['info'](_0x657a('0x9'),_0x4cdb88,'request\x20sent');_0xc902c1(_0x33dd28['result'][_0x657a('0xd')]);}})[_0x657a('0xe')](function(_0x545960){logger[_0x657a('0xc')](_0x657a('0x9'),_0x4cdb88,_0x545960);_0x4042f8(_0x545960);});});}exports[_0x657a('0xf')]=function(_0x6bb28a){var _0x536913=this;return new Promise(function(_0xe78800,_0x23efa5){return db[_0x657a('0x10')][_0x657a('0x11')](_0x6bb28a['body'],{'raw':_0x6bb28a['options']?_0x6bb28a[_0x657a('0x12')][_0x657a('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6bb28a[_0x657a('0x12')]?_0x6bb28a[_0x657a('0x12')][_0x657a('0x14')]||null:null,'attributes':_0x6bb28a[_0x657a('0x12')]?_0x6bb28a[_0x657a('0x12')][_0x657a('0x15')]||null:null,'limit':_0x6bb28a['options']?_0x6bb28a['options'][_0x657a('0x16')]||null:null})[_0x657a('0x7')](function(_0x5b8d13){logger[_0x657a('0x8')](_0x657a('0xf'),_0x6bb28a);logger['debug'](_0x657a('0xf'),_0x6bb28a,JSON[_0x657a('0x17')](_0x5b8d13));_0xe78800(_0x5b8d13);})['catch'](function(_0x4201a8){logger['error'](_0x657a('0xf'),_0x4201a8[_0x657a('0xd')],_0x6bb28a);_0x23efa5(_0x536913[_0x657a('0xc')](0x1f4,_0x4201a8['message']));});});}; \ No newline at end of file +var _0xa898=['options','raw','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','MailApplication','update','body'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xa898,0x80));var _0x8a89=function(_0x5619b7,_0x881d68){_0x5619b7=_0x5619b7-0x0;var _0x376db0=_0xa898[_0x5619b7];return _0x376db0;};'use strict';var _=require('lodash');var util=require(_0x8a89('0x0'));var moment=require(_0x8a89('0x1'));var BPromise=require(_0x8a89('0x2'));var rs=require(_0x8a89('0x3'));var fs=require('fs');var Redis=require(_0x8a89('0x4'));var db=require(_0x8a89('0x5'))['db'];var utils=require(_0x8a89('0x6'));var logger=require('../../config/logger')(_0x8a89('0x7'));var config=require('../../config/environment');var jayson=require(_0x8a89('0x8'));var client=jayson[_0x8a89('0x9')][_0x8a89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552154,_0x1242ae,_0x38e67a){return new BPromise(function(_0x293e94,_0xe23d0c){return client[_0x8a89('0xb')](_0x552154,_0x38e67a)[_0x8a89('0xc')](function(_0x3d38e5){logger['info']('MailApplication,\x20%s,\x20%s',_0x1242ae,_0x8a89('0xd'));logger[_0x8a89('0xe')](_0x8a89('0xf'),_0x1242ae,_0x8a89('0xd'),JSON['stringify'](_0x3d38e5));if(_0x3d38e5[_0x8a89('0x10')]){if(_0x3d38e5[_0x8a89('0x10')][_0x8a89('0x11')]===0x1f4){logger[_0x8a89('0x10')](_0x8a89('0x12'),_0x1242ae,_0x3d38e5[_0x8a89('0x10')][_0x8a89('0x13')]);return _0xe23d0c(_0x3d38e5['error'][_0x8a89('0x13')]);}logger[_0x8a89('0x10')](_0x8a89('0x12'),_0x1242ae,_0x3d38e5[_0x8a89('0x10')][_0x8a89('0x13')]);return _0x293e94(_0x3d38e5[_0x8a89('0x10')][_0x8a89('0x13')]);}else{logger[_0x8a89('0x14')]('MailApplication,\x20%s,\x20%s',_0x1242ae,_0x8a89('0xd'));_0x293e94(_0x3d38e5[_0x8a89('0x15')][_0x8a89('0x13')]);}})[_0x8a89('0x16')](function(_0x5d03ce){logger[_0x8a89('0x10')](_0x8a89('0x12'),_0x1242ae,_0x5d03ce);_0xe23d0c(_0x5d03ce);});});}exports[_0x8a89('0x17')]=function(_0x48c9e2){var _0x55a0bf=this;return new Promise(function(_0x30c38a,_0x41608d){return db[_0x8a89('0x18')][_0x8a89('0x19')](_0x48c9e2[_0x8a89('0x1a')],{'raw':_0x48c9e2[_0x8a89('0x1b')]?_0x48c9e2[_0x8a89('0x1b')][_0x8a89('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48c9e2[_0x8a89('0x1b')]?_0x48c9e2[_0x8a89('0x1b')]['where']||null:null,'attributes':_0x48c9e2[_0x8a89('0x1b')]?_0x48c9e2[_0x8a89('0x1b')]['attributes']||null:null,'limit':_0x48c9e2[_0x8a89('0x1b')]?_0x48c9e2[_0x8a89('0x1b')][_0x8a89('0x1d')]||null:null})[_0x8a89('0xc')](function(_0x39152c){logger[_0x8a89('0x14')]('UpdateMailApplication',_0x48c9e2);logger[_0x8a89('0xe')](_0x8a89('0x17'),_0x48c9e2,JSON[_0x8a89('0x1e')](_0x39152c));_0x30c38a(_0x39152c);})['catch'](function(_0x25a18b){logger[_0x8a89('0x10')](_0x8a89('0x17'),_0x25a18b[_0x8a89('0x13')],_0x48c9e2);_0x41608d(_0x55a0bf[_0x8a89('0x10')](0x1f4,_0x25a18b[_0x8a89('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6da1404..f0683d5 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 _0x13fe=['removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','describe','show','getMessages','download','create','post','/:id/messages','addMessage','/:id/tags','mail','mailinteraction:addtags','put','/:id','tracked','mailinteraction:update','delete','destroy'];(function(_0x4fc12e,_0x3936b6){var _0x52a522=function(_0x53fe32){while(--_0x53fe32){_0x4fc12e['push'](_0x4fc12e['shift']());}};_0x52a522(++_0x3936b6);}(_0x13fe,0x138));var _0xe13f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x13fe[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xe13f('0x0'));var util=require(_0xe13f('0x1'));var path=require(_0xe13f('0x2'));var timeout=require(_0xe13f('0x3'));var express=require(_0xe13f('0x4'));var router=express[_0xe13f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe13f('0x6'));var config=require(_0xe13f('0x7'));var controller=require(_0xe13f('0x8'));router[_0xe13f('0x9')]('/',auth[_0xe13f('0xa')](),controller[_0xe13f('0xb')]);router[_0xe13f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe13f('0xc')]);router[_0xe13f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe13f('0xd')]);router[_0xe13f('0x9')]('/:id/messages',auth[_0xe13f('0xa')](),controller[_0xe13f('0xe')]);router['get']('/:id/download',auth[_0xe13f('0xa')](),controller[_0xe13f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe13f('0x10')]);router[_0xe13f('0x11')](_0xe13f('0x12'),auth[_0xe13f('0xa')](),controller[_0xe13f('0x13')]);router['post'](_0xe13f('0x14'),auth[_0xe13f('0xa')](),interaction['tracked'](_0xe13f('0x15'),_0xe13f('0x16')),controller['addTags']);router[_0xe13f('0x17')](_0xe13f('0x18'),auth[_0xe13f('0xa')](),interaction[_0xe13f('0x19')](_0xe13f('0x15'),_0xe13f('0x1a')),controller['update']);router[_0xe13f('0x1b')]('/:id',auth[_0xe13f('0xa')](),interaction['tracked'](_0xe13f('0x15'),'mailinteraction:destroy'),controller[_0xe13f('0x1c')]);router[_0xe13f('0x1b')](_0xe13f('0x14'),auth[_0xe13f('0xa')](),controller[_0xe13f('0x1d')]);module[_0xe13f('0x1e')]=router; \ No newline at end of file +var _0x3248=['create','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','download','post'];(function(_0x14b693,_0x1a76a1){var _0x5a391f=function(_0x490137){while(--_0x490137){_0x14b693['push'](_0x14b693['shift']());}};_0x5a391f(++_0x1a76a1);}(_0x3248,0x1b0));var _0x8324=function(_0x52db86,_0xa8c1a7){_0x52db86=_0x52db86-0x0;var _0x33d5cf=_0x3248[_0x52db86];return _0x33d5cf;};'use strict';var multer=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var path=require(_0x8324('0x2'));var timeout=require(_0x8324('0x3'));var express=require(_0x8324('0x4'));var router=express[_0x8324('0x5')]();var auth=require(_0x8324('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8324('0x7'));router[_0x8324('0x8')]('/',auth['isAuthenticated'](),controller[_0x8324('0x9')]);router[_0x8324('0x8')](_0x8324('0xa'),auth[_0x8324('0xb')](),controller[_0x8324('0xc')]);router['get'](_0x8324('0xd'),auth[_0x8324('0xb')](),controller[_0x8324('0xe')]);router['get']('/:id/messages',auth[_0x8324('0xb')](),controller[_0x8324('0xf')]);router[_0x8324('0x8')]('/:id/download',auth[_0x8324('0xb')](),controller[_0x8324('0x10')]);router[_0x8324('0x11')]('/',auth[_0x8324('0xb')](),controller[_0x8324('0x12')]);router[_0x8324('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8324('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8324('0x13')](_0x8324('0x14'),_0x8324('0x15')),controller['addTags']);router[_0x8324('0x16')](_0x8324('0xd'),auth[_0x8324('0xb')](),interaction['tracked'](_0x8324('0x14'),_0x8324('0x17')),controller[_0x8324('0x18')]);router[_0x8324('0x19')](_0x8324('0xd'),auth[_0x8324('0xb')](),interaction['tracked']('mail',_0x8324('0x1a')),controller[_0x8324('0x1b')]);router[_0x8324('0x19')]('/:id/tags',auth[_0x8324('0xb')](),controller[_0x8324('0x1c')]);module[_0x8324('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 463bbe6..7d313e4 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 _0xcdf4=['STRING','TEXT','ENUM','out','long','exports','BOOLEAN','DATE'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xcdf4,0x1d5));var _0x4cdf=function(_0x4f7672,_0x1fec22){_0x4f7672=_0x4f7672-0x0;var _0x1dcd12=_0xcdf4[_0x4f7672];return _0x1dcd12;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x4cdf('0x0')]={'closed':{'type':Sequelize[_0x4cdf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4cdf('0x2')]},'disposition':{'type':Sequelize[_0x4cdf('0x3')]},'note':{'type':Sequelize[_0x4cdf('0x3')]},'inReplyTo':{'type':Sequelize[_0x4cdf('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4cdf('0x3')]},'cc':{'type':Sequelize[_0x4cdf('0x4')]('long')},'subject':{'type':Sequelize[_0x4cdf('0x4')]()},'attach':{'type':Sequelize[_0x4cdf('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4cdf('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x4cdf('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x4cdf('0x5')]('in',_0x4cdf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4cdf('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4cdf('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x4cdf('0x7'))},'lastMsgText':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file +var _0xca38=['BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize'];(function(_0x321ff5,_0x3bf925){var _0x3dc4de=function(_0x7d8156){while(--_0x7d8156){_0x321ff5['push'](_0x321ff5['shift']());}};_0x3dc4de(++_0x3bf925);}(_0xca38,0x177));var _0x8ca3=function(_0x3d5fdc,_0x12bdfc){_0x3d5fdc=_0x3d5fdc-0x0;var _0x2a0a34=_0xca38[_0x3d5fdc];return _0x2a0a34;};'use strict';var Sequelize=require(_0x8ca3('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x8ca3('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8ca3('0x2')]},'note':{'type':Sequelize[_0x8ca3('0x2')]},'inReplyTo':{'type':Sequelize[_0x8ca3('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8ca3('0x3')](_0x8ca3('0x4'))},'subject':{'type':Sequelize[_0x8ca3('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8ca3('0x5')]},'substatus':{'type':Sequelize[_0x8ca3('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x8ca3('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x8ca3('0x6')]('in',_0x8ca3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8ca3('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x8ca3('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x8ca3('0x4'))},'lastMsgText':{'type':Sequelize[_0x8ca3('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 34ae878..9a4f3da 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(_0x287adf,_0x519d3a){var _0x2e8cc8=function(_0x59b753){while(--_0x59b753){_0x287adf['push'](_0x287adf['shift']());}};_0x2e8cc8(++_0x519d3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x25cd7b,_0x4f5c92){var _0x7e8489=function(_0xc63e8b){while(--_0xc63e8b){_0x25cd7b['push'](_0x25cd7b['shift']());}};_0x7e8489(++_0x4f5c92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var 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 abc7c32..5bc2bee 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 _0x3733=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x582804,_0x16c49e){var _0x134456=function(_0x505643){while(--_0x505643){_0x582804['push'](_0x582804['shift']());}};_0x134456(++_0x16c49e);}(_0x3733,0x14b));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x3373('0x0'))['db'][_0x3373('0x1')];var MailMessage=require(_0x3373('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3373('0x2')](0x0);var events={'afterCreate':_0x3373('0x3'),'afterUpdate':_0x3373('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10da99){return function(_0x27dfce,_0x4186b1,_0x5bd043){_0x27dfce[_0x3373('0x5')]({'attributes':['id'],'raw':!![]})[_0x3373('0x6')](function(_0x4c3dbd){_0x27dfce[_0x3373('0x7')](_0x3373('0x8'),_0x4c3dbd[_0x3373('0x9')](function(_0x5d11eb){return{'id':_0x5d11eb['id']};}));return MailMessage[_0x3373('0xa')]({'where':{'MailInteractionId':_0x27dfce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3373('0x6')](function(_0x5a72c1){_0x27dfce[_0x3373('0x7')](_0x3373('0xb'),_0x5a72c1[_0x3373('0xc')]);MailInteractionEvents['emit'](_0x10da99+':'+_0x27dfce['id'],_0x27dfce);MailInteractionEvents['emit'](_0x10da99,_0x27dfce);_0x5bd043(null);})[_0x3373('0xd')](_0x5bd043(null));};}for(var e in events){if(events[_0x3373('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x3373('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x7ea0=['hook','events','../../mysqldb','MailInteraction','save','update','then','setDataValue','Users','map','unreadMessages','emit','hasOwnProperty'];(function(_0x1bcedc,_0x1c332a){var _0x2d48bc=function(_0x5d0cd7){while(--_0x5d0cd7){_0x1bcedc['push'](_0x1bcedc['shift']());}};_0x2d48bc(++_0x1c332a);}(_0x7ea0,0x105));var _0x07ea=function(_0x24ad0e,_0x531473){_0x24ad0e=_0x24ad0e-0x0;var _0x26154e=_0x7ea0[_0x24ad0e];return _0x26154e;};'use strict';var EventEmitter=require(_0x07ea('0x0'));var MailInteraction=require(_0x07ea('0x1'))['db'][_0x07ea('0x2')];var MailMessage=require(_0x07ea('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x07ea('0x3'),'afterUpdate':_0x07ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a72a7){return function(_0x25c059,_0x223070,_0x2d8ba7){_0x25c059['getUsers']({'attributes':['id'],'raw':!![]})[_0x07ea('0x5')](function(_0x1473ef){_0x25c059[_0x07ea('0x6')](_0x07ea('0x7'),_0x1473ef[_0x07ea('0x8')](function(_0x2b435c){return{'id':_0x2b435c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x25c059['id'],'direction':'in','read':![]},'raw':!![]});})[_0x07ea('0x5')](function(_0x2bba39){_0x25c059[_0x07ea('0x6')](_0x07ea('0x9'),_0x2bba39['length']);MailInteractionEvents[_0x07ea('0xa')](_0x4a72a7+':'+_0x25c059['id'],_0x25c059);MailInteractionEvents[_0x07ea('0xa')](_0x4a72a7,_0x25c059);_0x2d8ba7(null);})['catch'](_0x2d8ba7(null));};}for(var e in events){if(events[_0x07ea('0xb')](e)){var event=events[e];MailInteraction[_0x07ea('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index aae618b..d4c6543 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 _0x9c44=['MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','changed','substatus','YYYY-MM-DD\x20HH:mm:ss','get','update','then','catch','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','./mailInteraction.attributes','define'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x49c4('0xa'),'to'],'type':_0x49c4('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d13fb,_0x4487ca,_0x4c7d3a){if(_0x1d13fb['substatus']){_0x1d13fb[_0x49c4('0xc')]=moment()[_0x49c4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1d13fb[_0x49c4('0xe')]){_0x1d13fb[_0x49c4('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4c7d3a(null,_0x4487ca);},'beforeUpdate':function(_0x1d19bf,_0x6d1b08,_0x5487cd){if(_0x1d19bf[_0x49c4('0x10')](_0x49c4('0x11'))){_0x1d19bf['substatusAt']=_0x1d19bf[_0x49c4('0x11')]?moment()[_0x49c4('0xd')](_0x49c4('0x12')):null;}if(_0x1d19bf[_0x49c4('0x10')](_0x49c4('0xe'))){_0x1d19bf[_0x49c4('0xf')]=moment()[_0x49c4('0xd')](_0x49c4('0x12'));_0x1d19bf['substatus']=null;_0x1d19bf[_0x49c4('0xc')]=null;}_0x5487cd(null,_0x1d19bf);},'afterUpdate':function(_0x141003,_0x13a2db,_0x81e831){var _0x2abc78=_0xc1278f['models'];var _0x44e607=_0x141003[_0x49c4('0x13')]({'plain':!![]});if(_0x44e607['closed']){return _0x2abc78['MailMessage'][_0x49c4('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x44e607['id']}})[_0x49c4('0x15')](function(){_0x81e831();})[_0x49c4('0x16')](function(_0x59f29b){_0x81e831(_0x59f29b);});}else{_0x81e831();}}},'charset':_0x49c4('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x008c=['then','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','substatus','closedAt','models','update'];(function(_0x2edd98,_0x58f98e){var _0x4f2efe=function(_0x301715){while(--_0x301715){_0x2edd98['push'](_0x2edd98['shift']());}};_0x4f2efe(++_0x58f98e);}(_0x008c,0x188));var _0xc008=function(_0x5d0a06,_0x2f8043){_0x5d0a06=_0x5d0a06-0x0;var _0x2350ca=_0x008c[_0x5d0a06];return _0x2350ca;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MailInteraction',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc008('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52041f,_0x27830d,_0x7231b4){if(_0x52041f['substatus']){_0x52041f['substatusAt']=moment()['format'](_0xc008('0xe'));}if(_0x52041f[_0xc008('0xf')]){_0x52041f['closedAt']=moment()[_0xc008('0x10')](_0xc008('0xe'));}_0x7231b4(null,_0x27830d);},'beforeUpdate':function(_0x2ea200,_0x2a5b4e,_0x9ffa93){if(_0x2ea200[_0xc008('0x11')](_0xc008('0x12'))){_0x2ea200['substatusAt']=_0x2ea200['substatus']?moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ea200[_0xc008('0x11')](_0xc008('0xf'))){_0x2ea200[_0xc008('0x13')]=moment()[_0xc008('0x10')](_0xc008('0xe'));_0x2ea200['substatus']=null;_0x2ea200['substatusAt']=null;}_0x9ffa93(null,_0x2ea200);},'afterUpdate':function(_0x4bd0f4,_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x13aa7[_0xc008('0x14')];var _0x4fe771=_0x4bd0f4['get']({'plain':!![]});if(_0x4fe771['closed']){return _0x3cafe3['MailMessage'][_0xc008('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4fe771['id']}})[_0xc008('0x16')](function(){_0x15a6ad();})['catch'](function(_0x813397){_0x15a6ad(_0x813397);});}else{_0x15a6ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index aeb6417..99dd5d9 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 _0xc7ea=['jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','catch','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xc7ea,0x171));var _0xac7e=function(_0x50bd74,_0x47e8fa){_0x50bd74=_0x50bd74-0x0;var _0x509e03=_0xc7ea[_0x50bd74];return _0x509e03;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var moment=require('moment');var BPromise=require(_0xac7e('0x2'));var rs=require(_0xac7e('0x3'));var fs=require('fs');var Redis=require(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7e('0x6'))(_0xac7e('0x7'));var config=require(_0xac7e('0x8'));var jayson=require(_0xac7e('0x9'));var client=jayson[_0xac7e('0xa')][_0xac7e('0xb')]({'port':0x232a});config[_0xac7e('0xc')]=_[_0xac7e('0xd')](config[_0xac7e('0xc')],{'host':_0xac7e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac7e('0xc')]));require(_0xac7e('0xf'))[_0xac7e('0x10')](socket);function respondWithRpcPromise(_0x173b59,_0x39d2e3,_0x260889){return new BPromise(function(_0x10873d,_0x240869){return client[_0xac7e('0x11')](_0x173b59,_0x260889)[_0xac7e('0x12')](function(_0x404fc0){logger[_0xac7e('0x13')]('MailInteraction,\x20%s,\x20%s',_0x39d2e3,_0xac7e('0x14'));logger[_0xac7e('0x15')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x39d2e3,_0xac7e('0x14'),JSON[_0xac7e('0x16')](_0x404fc0));if(_0x404fc0[_0xac7e('0x17')]){if(_0x404fc0[_0xac7e('0x17')][_0xac7e('0x18')]===0x1f4){logger['error'](_0xac7e('0x19'),_0x39d2e3,_0x404fc0[_0xac7e('0x17')][_0xac7e('0x1a')]);return _0x240869(_0x404fc0[_0xac7e('0x17')][_0xac7e('0x1a')]);}logger[_0xac7e('0x17')](_0xac7e('0x19'),_0x39d2e3,_0x404fc0[_0xac7e('0x17')]['message']);return _0x10873d(_0x404fc0[_0xac7e('0x17')][_0xac7e('0x1a')]);}else{logger[_0xac7e('0x13')](_0xac7e('0x19'),_0x39d2e3,_0xac7e('0x14'));_0x10873d(_0x404fc0['result'][_0xac7e('0x1a')]);}})['catch'](function(_0xba3d01){logger['error'](_0xac7e('0x19'),_0x39d2e3,_0xba3d01);_0x240869(_0xba3d01);});});}exports[_0xac7e('0x1b')]=function(_0x231ab0){var _0x41ae40=this;return new Promise(function(_0x3be919,_0x2ad784){return db['MailInteraction'][_0xac7e('0x1c')](_0x231ab0[_0xac7e('0x1d')],{'raw':_0x231ab0['options']?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x231ab0[_0xac7e('0x1e')]?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x20')]||null:null,'attributes':_0x231ab0[_0xac7e('0x1e')]?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x21')]||null:null,'limit':_0x231ab0[_0xac7e('0x1e')]?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x22')]||null:null})['then'](function(_0x57c945){logger[_0xac7e('0x13')](_0xac7e('0x1b'),_0x231ab0);logger[_0xac7e('0x15')]('UpdateMailInteraction',_0x231ab0,JSON[_0xac7e('0x16')](_0x57c945));_0x3be919(_0x57c945);})[_0xac7e('0x23')](function(_0x2cafcb){logger[_0xac7e('0x17')]('UpdateMailInteraction',_0x2cafcb['message'],_0x231ab0);_0x2ad784(_0x41ae40[_0xac7e('0x17')](0x1f4,_0x2cafcb['message']));});});};exports['AddTagsToMailInteraction']=function(_0x24fa95){return new Promise(function(_0x43eb5e,_0x3ecfc1){return db['MailInteraction'][_0xac7e('0x24')]({'where':_0x24fa95[_0xac7e('0x1e')]?_0x24fa95[_0xac7e('0x1e')][_0xac7e('0x20')]||null:null})['then'](function(_0x12450b){if(_0x12450b){return _0x12450b[_0xac7e('0x25')](_0x24fa95[_0xac7e('0x1d')]['ids'],_[_0xac7e('0x26')](_0x24fa95[_0xac7e('0x1d')],[_0xac7e('0x27'),'id'])||{});}})[_0xac7e('0x28')](function(_0x4b4dee){logger[_0xac7e('0x13')]('AddTags',_0x24fa95);logger[_0xac7e('0x15')](_0xac7e('0x29'),_0x24fa95,JSON[_0xac7e('0x16')](_0x4b4dee));_0x43eb5e(_0x4b4dee);})['catch'](function(_0x194465){logger[_0xac7e('0x17')]('AddTags',_0x194465['message'],_0x24fa95);_0x3ecfc1(_this[_0xac7e('0x17')](0x1f4,_0x194465[_0xac7e('0x1a')]));});});}; \ No newline at end of file +var _0xd0a4=['addTags','body','ids','spread','AddTags','debug','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','info','MailInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','stringify','find','then'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0a4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0a('0x2'));var db=require(_0x4d0a('0x3'))['db'];var utils=require(_0x4d0a('0x4'));var logger=require(_0x4d0a('0x5'))(_0x4d0a('0x6'));var config=require(_0x4d0a('0x7'));var jayson=require(_0x4d0a('0x8'));var client=jayson[_0x4d0a('0x9')][_0x4d0a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4d0a('0xb')],{'host':_0x4d0a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d0a('0xb')]));require(_0x4d0a('0xd'))['register'](socket);function respondWithRpcPromise(_0xd0dd55,_0x44f69e,_0x1b1554){return new BPromise(function(_0xebd730,_0x37ac92){return client['request'](_0xd0dd55,_0x1b1554)['then'](function(_0x5a35be){logger[_0x4d0a('0xe')](_0x4d0a('0xf'),_0x44f69e,_0x4d0a('0x10'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x44f69e,'request\x20sent',JSON['stringify'](_0x5a35be));if(_0x5a35be[_0x4d0a('0x11')]){if(_0x5a35be['error'][_0x4d0a('0x12')]===0x1f4){logger[_0x4d0a('0x11')](_0x4d0a('0xf'),_0x44f69e,_0x5a35be['error'][_0x4d0a('0x13')]);return _0x37ac92(_0x5a35be[_0x4d0a('0x11')][_0x4d0a('0x13')]);}logger[_0x4d0a('0x11')](_0x4d0a('0xf'),_0x44f69e,_0x5a35be[_0x4d0a('0x11')][_0x4d0a('0x13')]);return _0xebd730(_0x5a35be[_0x4d0a('0x11')]['message']);}else{logger[_0x4d0a('0xe')](_0x4d0a('0xf'),_0x44f69e,_0x4d0a('0x10'));_0xebd730(_0x5a35be[_0x4d0a('0x14')][_0x4d0a('0x13')]);}})['catch'](function(_0x106a27){logger[_0x4d0a('0x11')](_0x4d0a('0xf'),_0x44f69e,_0x106a27);_0x37ac92(_0x106a27);});});}exports[_0x4d0a('0x15')]=function(_0x585ceb){var _0x3c6465=this;return new Promise(function(_0x50188c,_0x53c0a7){return db[_0x4d0a('0x16')][_0x4d0a('0x17')](_0x585ceb['body'],{'raw':_0x585ceb[_0x4d0a('0x18')]?_0x585ceb['options'][_0x4d0a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x585ceb[_0x4d0a('0x18')]?_0x585ceb[_0x4d0a('0x18')][_0x4d0a('0x1a')]||null:null,'attributes':_0x585ceb[_0x4d0a('0x18')]?_0x585ceb[_0x4d0a('0x18')][_0x4d0a('0x1b')]||null:null,'limit':_0x585ceb[_0x4d0a('0x18')]?_0x585ceb['options'][_0x4d0a('0x1c')]||null:null})['then'](function(_0x125e8f){logger[_0x4d0a('0xe')]('UpdateMailInteraction',_0x585ceb);logger['debug'](_0x4d0a('0x15'),_0x585ceb,JSON[_0x4d0a('0x1d')](_0x125e8f));_0x50188c(_0x125e8f);})['catch'](function(_0x4d9a45){logger['error'](_0x4d0a('0x15'),_0x4d9a45[_0x4d0a('0x13')],_0x585ceb);_0x53c0a7(_0x3c6465['error'](0x1f4,_0x4d9a45[_0x4d0a('0x13')]));});});};exports['AddTagsToMailInteraction']=function(_0x53760a){return new Promise(function(_0x35bee1,_0x214196){return db['MailInteraction'][_0x4d0a('0x1e')]({'where':_0x53760a['options']?_0x53760a[_0x4d0a('0x18')][_0x4d0a('0x1a')]||null:null})[_0x4d0a('0x1f')](function(_0x4e7937){if(_0x4e7937){return _0x4e7937[_0x4d0a('0x20')](_0x53760a[_0x4d0a('0x21')][_0x4d0a('0x22')],_['omit'](_0x53760a['body'],[_0x4d0a('0x22'),'id'])||{});}})[_0x4d0a('0x23')](function(_0x190d90){logger[_0x4d0a('0xe')](_0x4d0a('0x24'),_0x53760a);logger[_0x4d0a('0x25')](_0x4d0a('0x24'),_0x53760a,JSON[_0x4d0a('0x1d')](_0x190d90));_0x35bee1(_0x190d90);})[_0x4d0a('0x26')](function(_0xfb6015){logger['error']('AddTags',_0xfb6015[_0x4d0a('0x13')],_0x53760a);_0x214196(_this['error'](0x1f4,_0xfb6015['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0075e3b..192666f 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 _0x3d7b=['removeListener','register','length','save','remove','emit'];(function(_0x54a4e6,_0x10d7e2){var _0x88a9f4=function(_0x2ea0ce){while(--_0x2ea0ce){_0x54a4e6['push'](_0x54a4e6['shift']());}};_0x88a9f4(++_0x10d7e2);}(_0x3d7b,0x17d));var _0xb3d7=function(_0x2a41a8,_0x22d5e5){_0x2a41a8=_0x2a41a8-0x0;var _0x5b1c31=_0x3d7b[_0x2a41a8];return _0x5b1c31;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xb3d7('0x0'),_0xb3d7('0x1'),'update'];function createListener(_0x313f2a,_0x37024c){return function(_0x5d7ee5){_0x37024c[_0xb3d7('0x2')](_0x313f2a,_0x5d7ee5);};}function removeListener(_0x282a8b,_0x4d747b){return function(){MailInteractionEvents[_0xb3d7('0x3')](_0x282a8b,_0x4d747b);};}exports[_0xb3d7('0x4')]=function(_0x515805){for(var _0x25bf52=0x0,_0x49dca2=events[_0xb3d7('0x5')];_0x25bf52<_0x49dca2;_0x25bf52++){var _0x4426ff=events[_0x25bf52];var _0x3cab85=createListener('mailInteraction:'+_0x4426ff,_0x515805);MailInteractionEvents['on'](_0x4426ff,_0x3cab85);}}; \ No newline at end of file +var _0xedab=['remove','emit','register','length','./mailInteraction.events','save'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xedab,0xa0));var _0xbeda=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xedab[_0x1406ae];return _0x23a076;};'use strict';var MailInteractionEvents=require(_0xbeda('0x0'));var events=[_0xbeda('0x1'),_0xbeda('0x2'),'update'];function createListener(_0x509991,_0x18a0e7){return function(_0x51408e){_0x18a0e7[_0xbeda('0x3')](_0x509991,_0x51408e);};}function removeListener(_0x4f1c6d,_0x220152){return function(){MailInteractionEvents['removeListener'](_0x4f1c6d,_0x220152);};}exports[_0xbeda('0x4')]=function(_0x111346){for(var _0x32caf6=0x0,_0x352892=events[_0xbeda('0x5')];_0x32caf6<_0x352892;_0x32caf6++){var _0x334b5a=events[_0x32caf6];var _0x5e24fc=createListener('mailInteraction:'+_0x334b5a,_0x111346);MailInteractionEvents['on'](_0x334b5a,_0x5e24fc);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e5d7112..ef71bba 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 _0xe14b=['create','put','/:id','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','tracked','mailmessage:create'];(function(_0x1bc924,_0xa0c2ec){var _0x11ac13=function(_0x4c7b81){while(--_0x4c7b81){_0x1bc924['push'](_0x1bc924['shift']());}};_0x11ac13(++_0xa0c2ec);}(_0xe14b,0x93));var _0xbe14=function(_0x185722,_0x2c22e0){_0x185722=_0x185722-0x0;var _0x19ecdb=_0xe14b[_0x185722];return _0x19ecdb;};'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('./mailMessage.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0x5')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller['download']);router['post']('/',auth[_0xbe14('0x6')](),interaction[_0xbe14('0xc')]('mail',_0xbe14('0xd')),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x12'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x13')]);router[_0xbe14('0xf')](_0xbe14('0x14'),auth[_0xbe14('0x6')](),controller['reject']);router['delete'](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x15')]);module[_0xbe14('0x16')]=router; \ No newline at end of file +var _0x34e8=['./mailMessage.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55c978,_0x22aa10){var _0xa41f85=function(_0x437ef3){while(--_0x437ef3){_0x55c978['push'](_0x55c978['shift']());}};_0xa41f85(++_0x22aa10);}(_0x34e8,0x12c));var _0x834e=function(_0x48dca9,_0x5bdbeb){_0x48dca9=_0x48dca9-0x0;var _0x5ad148=_0x34e8[_0x48dca9];return _0x5ad148;};'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')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')]('/',auth[_0x834e('0xa')](),interaction[_0x834e('0x11')](_0x834e('0x12'),_0x834e('0x13')),controller[_0x834e('0x14')]);router[_0x834e('0x15')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0x16')]);router['put'](_0x834e('0x17'),auth[_0x834e('0xa')](),controller[_0x834e('0x18')]);router[_0x834e('0x15')]('/:id/reject',auth[_0x834e('0xa')](),controller[_0x834e('0x19')]);router['delete'](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e4f7a59..f487305 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 _0x5532=['TEXT','DATE','INTEGER','sequelize','lodash','exports','long','medium','BOOLEAN','ENUM','out'];(function(_0x50d086,_0x4e96e0){var _0x2e9e27=function(_0x545d54){while(--_0x545d54){_0x50d086['push'](_0x50d086['shift']());}};_0x2e9e27(++_0x4e96e0);}(_0x5532,0x19a));var _0x2553=function(_0x2f2ed4,_0x44eba1){_0x2f2ed4=_0x2f2ed4-0x0;var _0x41b94f=_0x5532[_0x2f2ed4];return _0x41b94f;};'use strict';var Sequelize=require(_0x2553('0x0'));var _=require(_0x2553('0x1'));module[_0x2553('0x2')]={'body':{'type':Sequelize['TEXT'](_0x2553('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2553('0x4'))},'read':{'type':Sequelize[_0x2553('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2553('0x6')]('in','out'),'defaultValue':_0x2553('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2553('0x8')](_0x2553('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x2553('0x3'))},'bcc':{'type':Sequelize[_0x2553('0x8')](_0x2553('0x3'))},'subject':{'type':Sequelize[_0x2553('0x8')]},'sentAt':{'type':Sequelize[_0x2553('0x9')]},'attach':{'type':Sequelize[_0x2553('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2553('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2553('0x9')]},'originTo':{'type':Sequelize[_0x2553('0x8')](_0x2553('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x2553('0x3'))}}; \ No newline at end of file +var _0xd906=['medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE','exports','TEXT','long'];(function(_0x278b6e,_0x165cd3){var _0x12910d=function(_0x1b0772){while(--_0x1b0772){_0x278b6e['push'](_0x278b6e['shift']());}};_0x12910d(++_0x165cd3);}(_0xd906,0x6b));var _0x6d90=function(_0x1e7cf2,_0x320b92){_0x1e7cf2=_0x1e7cf2-0x0;var _0x3e028d=_0xd906[_0x1e7cf2];return _0x3e028d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x6d90('0x0')]={'body':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6d90('0x4')]('in',_0x6d90('0x5')),'defaultValue':_0x6d90('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6d90('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x2'))},'cc':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x2'))},'bcc':{'type':Sequelize[_0x6d90('0x1')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x6d90('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6d90('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6d90('0x9')]},'originTo':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x2'))},'originCc':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e8631cd..bc860d2 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 _0x903b=['filter','where','merge','type','MailMessage','findAll','rows','show','params','keys','fields','includeAll','include','options','find','catch','body','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','defaults','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','format','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','interaction','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','null','RejectMessage','rejectmessage','download','toString','root','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','Bcc','basename','existsSync','readFileSync','build','writeFileSync','log','unlinkSync','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','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~!@#$%^&-_=+[{]}.','request','info','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','sendStatus','end','status','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0x903b,0x104));var _0xb903=function(_0x295acb,_0x884661){_0x295acb=_0x295acb-0x0;var _0x47d637=_0x903b[_0x295acb];return _0x47d637;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb903('0x0'));var rp=require(_0xb903('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb903('0x2'));var util=require(_0xb903('0x3'));var path=require('path');var sox=require(_0xb903('0x4'));var csv=require(_0xb903('0x5'));var ejs=require(_0xb903('0x6'));var fs=require('fs');var _=require(_0xb903('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb903('0x8'));var deskjs=require(_0xb903('0x9'));var toCsv=require(_0xb903('0x5'));var querystring=require(_0xb903('0xa'));var Papa=require(_0xb903('0xb'));var Redis=require('ioredis');var authService=require(_0xb903('0xc'));var qs=require(_0xb903('0xd'));var as=require(_0xb903('0xe'));var hardwareService=require(_0xb903('0xf'));var logger=require(_0xb903('0x10'))(_0xb903('0x11'));var utils=require(_0xb903('0x12'));var config=require(_0xb903('0x13'));var db=require('../../mysqldb')['db'];config[_0xb903('0x14')]=_['defaults'](config[_0xb903('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xb903('0x15'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xb903('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb903('0x17')][_0xb903('0x18')]({'port':0x232c});var client9003=jayson[_0xb903('0x17')][_0xb903('0x18')]({'port':0x232b});var client9002=jayson[_0xb903('0x17')][_0xb903('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1ecf8e,_0x5f4ea9,_0x422d48){if(_0x422d48){var _0x54a408=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54a408[_0xb903('0x19')](_0x5f4ea9)){return _0x1ecf8e;}else{throw new db[(_0xb903('0x1a'))]['ValidationError'](_0xb903('0x1b'));}}else{return _0x1ecf8e;}}function respondWithRpcPromise(_0x412f2e,_0x4691b5,_0x3e2148,_0xea60ba){return new BPromise(function(_0x3bd2b0,_0x439fc7){var _0x4fdb85=_0xea60ba||client;return _0x4fdb85[_0xb903('0x1c')](_0x412f2e,_0x3e2148)['then'](function(_0x4667aa){logger[_0xb903('0x1d')]('MailMessage,\x20%s,\x20%s',_0x4691b5,'request\x20sent');logger['debug'](_0xb903('0x1e'),_0x4691b5,_0xb903('0x1f'),JSON[_0xb903('0x20')](_0x4667aa));if(_0x4667aa['error']){if(_0x4667aa[_0xb903('0x21')][_0xb903('0x22')]===0x1f4){logger[_0xb903('0x21')](_0xb903('0x23'),_0x4691b5,_0x4667aa[_0xb903('0x21')][_0xb903('0x24')]);return _0x439fc7(_0x4667aa['error'][_0xb903('0x24')]);}logger['error'](_0xb903('0x23'),_0x4691b5,_0x4667aa[_0xb903('0x21')][_0xb903('0x24')]);return _0x3bd2b0(_0x4667aa[_0xb903('0x21')]['message']);}else{logger[_0xb903('0x1d')]('MailMessage,\x20%s,\x20%s',_0x4691b5,_0xb903('0x1f'));_0x3bd2b0(_0x4667aa[_0xb903('0x25')][_0xb903('0x24')]);}})['catch'](function(_0x3e9f7){logger[_0xb903('0x21')](_0xb903('0x23'),_0x4691b5,_0x3e9f7);_0x439fc7(_0x3e9f7);});});}function respondWithStatusCode(_0x2d9f19,_0x12e9da){_0x12e9da=_0x12e9da||0xcc;return function(_0x109cd4){if(_0x109cd4){return _0x2d9f19[_0xb903('0x26')](_0x12e9da);}return _0x2d9f19['status'](_0x12e9da)[_0xb903('0x27')]();};}function respondWithResult(_0x1ea8d7,_0x5b6c68){_0x5b6c68=_0x5b6c68||0xc8;return function(_0xa5dd2){if(_0xa5dd2){return _0x1ea8d7[_0xb903('0x28')](_0x5b6c68)['json'](_0xa5dd2);}};}function respondWithFilteredResult(_0x1e507d,_0x37e828){return function(_0xbd87ab){if(_0xbd87ab){var _0x12e0b5=_0xbd87ab[_0xb903('0x29')],_0x19922d=_0x37e828[_0xb903('0x2a')],_0x995508=_0x37e828['offset']+_0x37e828['limit'],_0xccefc0;if(_0x995508>=_0x12e0b5){_0x995508=_0x12e0b5;_0xccefc0=0xc8;}else{_0xccefc0=0xce;}_0x1e507d['status'](_0xccefc0);return _0x1e507d['set'](_0xb903('0x2b'),_0x19922d+'-'+_0x995508+'/'+_0x12e0b5)[_0xb903('0x2c')](_0xbd87ab);}return null;};}function patchUpdates(_0x13b6f6){return function(_0x3b35d5){try{jsonpatch[_0xb903('0x2d')](_0x3b35d5,_0x13b6f6,!![]);}catch(_0x5e8dab){return BPromise[_0xb903('0x2e')](_0x5e8dab);}return _0x3b35d5[_0xb903('0x2f')]();};}function saveUpdates(_0x28f54f,_0x1a1d7c){return function(_0x1c57d3){if(_0x1c57d3){return _0x1c57d3[_0xb903('0x30')](_0x28f54f)[_0xb903('0x31')](function(_0x5b6488){return _0x5b6488;});}return null;};}function removeEntity(_0x370a77,_0x287877){return function(_0x3ae0c4){if(_0x3ae0c4){return _0x3ae0c4[_0xb903('0x32')]()[_0xb903('0x31')](function(){_0x370a77[_0xb903('0x28')](0xcc)[_0xb903('0x27')]();});}};}function handleEntityNotFound(_0x51e38b,_0x2e76f7){return function(_0x4727e3){if(!_0x4727e3){_0x51e38b['sendStatus'](0x194);}return _0x4727e3;};}function handleError(_0x314faa,_0x74dd81){_0x74dd81=_0x74dd81||0x1f4;return function(_0xb1f37a){logger[_0xb903('0x21')](_0xb1f37a[_0xb903('0x33')]);if(_0xb1f37a[_0xb903('0x34')]){delete _0xb1f37a[_0xb903('0x34')];}_0x314faa[_0xb903('0x28')](_0x74dd81)[_0xb903('0x35')](_0xb1f37a);};}exports[_0xb903('0x36')]=function(_0x4ded23,_0x14218f){var _0xf2b811={},_0x38a76a={},_0x27cb3c={'count':0x0,'rows':[]};var _0x34a9b7=_['map'](db['MailMessage'][_0xb903('0x37')],function(_0x418e2e){return{'name':_0x418e2e['fieldName'],'type':_0x418e2e['type'][_0xb903('0x38')]};});_0x38a76a[_0xb903('0x39')]=_[_0xb903('0x3a')](_0x34a9b7,'name');_0x38a76a[_0xb903('0x3b')]=_['keys'](_0x4ded23[_0xb903('0x3b')]);_0x38a76a[_0xb903('0x3c')]=_[_0xb903('0x3d')](_0x38a76a[_0xb903('0x39')],_0x38a76a[_0xb903('0x3b')]);_0xf2b811[_0xb903('0x3e')]=_[_0xb903('0x3d')](_0x38a76a[_0xb903('0x39')],qs['fields'](_0x4ded23[_0xb903('0x3b')]['fields']));_0xf2b811[_0xb903('0x3e')]=_0xf2b811[_0xb903('0x3e')][_0xb903('0x3f')]?_0xf2b811[_0xb903('0x3e')]:_0x38a76a['model'];if(!_0x4ded23[_0xb903('0x3b')][_0xb903('0x40')](_0xb903('0x41'))){_0xf2b811[_0xb903('0x42')]=qs[_0xb903('0x42')](_0x4ded23[_0xb903('0x3b')][_0xb903('0x42')]);_0xf2b811[_0xb903('0x2a')]=qs[_0xb903('0x2a')](_0x4ded23[_0xb903('0x3b')][_0xb903('0x2a')]);}_0xf2b811[_0xb903('0x43')]=qs[_0xb903('0x44')](_0x4ded23[_0xb903('0x3b')][_0xb903('0x44')]);_0xf2b811['where']=qs[_0xb903('0x3c')](_[_0xb903('0x45')](_0x4ded23['query'],_0x38a76a['filters']),_0x34a9b7);if(_0x4ded23[_0xb903('0x3b')][_0xb903('0x46')]){_0xf2b811[_0xb903('0x47')]=_[_0xb903('0x48')](_0xf2b811[_0xb903('0x47')],{'$or':_['map'](_0x34a9b7,function(_0x5e2429){if(_0x5e2429[_0xb903('0x49')]!=='VIRTUAL'){var _0x22b4eb={};_0x22b4eb[_0x5e2429[_0xb903('0x34')]]={'$like':'%'+_0x4ded23[_0xb903('0x3b')][_0xb903('0x46')]+'%'};return _0x22b4eb;}})});}_0xf2b811=_[_0xb903('0x48')]({},_0xf2b811,_0x4ded23['options']);var _0x1ce962={'where':_0xf2b811[_0xb903('0x47')]};return db[_0xb903('0x4a')][_0xb903('0x29')](_0x1ce962)[_0xb903('0x31')](function(_0x54ab60){_0x27cb3c[_0xb903('0x29')]=_0x54ab60;if(_0x4ded23[_0xb903('0x3b')]['includeAll']){_0xf2b811['include']=[{'all':!![]}];}return db[_0xb903('0x4a')][_0xb903('0x4b')](_0xf2b811);})[_0xb903('0x31')](function(_0x4a2056){_0x27cb3c[_0xb903('0x4c')]=_0x4a2056;return _0x27cb3c;})[_0xb903('0x31')](respondWithFilteredResult(_0x14218f,_0xf2b811))['catch'](handleError(_0x14218f,null));};exports[_0xb903('0x4d')]=function(_0x1210df,_0x323280){var _0x56ea8e={'raw':!![],'where':{'id':_0x1210df[_0xb903('0x4e')]['id']}},_0x3cec16={};_0x3cec16[_0xb903('0x39')]=_['keys'](db[_0xb903('0x4a')][_0xb903('0x37')]);_0x3cec16[_0xb903('0x3b')]=_[_0xb903('0x4f')](_0x1210df[_0xb903('0x3b')]);_0x3cec16[_0xb903('0x3c')]=_[_0xb903('0x3d')](_0x3cec16[_0xb903('0x39')],_0x3cec16[_0xb903('0x3b')]);_0x56ea8e[_0xb903('0x3e')]=_[_0xb903('0x3d')](_0x3cec16[_0xb903('0x39')],qs[_0xb903('0x50')](_0x1210df[_0xb903('0x3b')][_0xb903('0x50')]));_0x56ea8e[_0xb903('0x3e')]=_0x56ea8e['attributes'][_0xb903('0x3f')]?_0x56ea8e[_0xb903('0x3e')]:_0x3cec16[_0xb903('0x39')];if(_0x1210df['query'][_0xb903('0x51')]){_0x56ea8e[_0xb903('0x52')]=[{'all':!![]}];}_0x56ea8e=_['merge']({},_0x56ea8e,_0x1210df[_0xb903('0x53')]);return db[_0xb903('0x4a')][_0xb903('0x54')](_0x56ea8e)['then'](handleEntityNotFound(_0x323280,null))[_0xb903('0x31')](respondWithResult(_0x323280,null))[_0xb903('0x55')](handleError(_0x323280,null));};exports['update']=function(_0x5495fe,_0x3a0956){if(_0x5495fe['body']['id']){delete _0x5495fe[_0xb903('0x56')]['id'];}return db[_0xb903('0x4a')][_0xb903('0x54')]({'where':{'id':_0x5495fe[_0xb903('0x4e')]['id']}})[_0xb903('0x31')](handleEntityNotFound(_0x3a0956,null))['then'](saveUpdates(_0x5495fe['body'],null))[_0xb903('0x31')](respondWithResult(_0x3a0956,null))[_0xb903('0x55')](handleError(_0x3a0956,null));};exports[_0xb903('0x32')]=function(_0x129f06,_0x537756){return db[_0xb903('0x4a')][_0xb903('0x54')]({'where':{'id':_0x129f06[_0xb903('0x4e')]['id']}})[_0xb903('0x31')](handleEntityNotFound(_0x537756,null))[_0xb903('0x31')](removeEntity(_0x537756,null))[_0xb903('0x55')](handleError(_0x537756,null));};exports[_0xb903('0x57')]=function(_0x4150ae,_0x4f6074){return db['MailMessage'][_0xb903('0x57')]()['then'](respondWithResult(_0x4f6074,null))[_0xb903('0x55')](handleError(_0x4f6074,null));};exports[_0xb903('0x58')]=function(_0x21ab3c,_0x2af365){return db['MailMessage'][_0xb903('0x58')](_0x21ab3c[_0xb903('0x56')])[_0xb903('0x31')](function(_0x44cb27){if(_0x44cb27){if(_0x44cb27[_0xb903('0x59')]==='out'&&!_0x44cb27[_0xb903('0x5a')]){var _0x50603c,_0x29c460,_0x29a822;if(_0x21ab3c['body']['to']){_0x29c460=_0x21ab3c['body']['to'][_0xb903('0x5b')](',')[0x0];}return db[_0xb903('0x5c')][_0xb903('0x5d')]({'where':{'id':_0x44cb27[_0xb903('0x5e')]},'include':[{'model':db[_0xb903('0x5f')],'as':_0xb903('0x60'),'include':[{'model':db[_0xb903('0x61')],'as':_0xb903('0x62'),'where':{'email':_0x29c460},'limit':0x1,'order':[[_0xb903('0x63'),_0xb903('0x64')]]}]},{'model':db[_0xb903('0x65')],'as':_0xb903('0x66'),'raw':!![]}]})[_0xb903('0x31')](function(_0x26e28c){_0x50603c=_0x26e28c;if(_0x50603c&&_0x50603c[_0xb903('0x66')]){var _0xed5c48={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x50603c[_0xb903('0x66')][_0xb903('0x67')])){_0xed5c48[_0xb903('0x68')]=_0x50603c[_0xb903('0x66')][_0xb903('0x68')];_0xed5c48[_0xb903('0x69')]=_0x50603c[_0xb903('0x66')][_0xb903('0x69')];_0xed5c48[_0xb903('0x6a')]=_0x50603c[_0xb903('0x66')]['secure'];if(_0x50603c[_0xb903('0x66')][_0xb903('0x6b')]){_0xed5c48[_0xb903('0x6c')]={'user':_0x50603c['Smtp'][_0xb903('0x6d')],'pass':_0x50603c[_0xb903('0x66')][_0xb903('0x6e')]};}}else{_0xed5c48[_0xb903('0x67')]=_0x50603c[_0xb903('0x66')][_0xb903('0x67')];_0xed5c48['auth']={'user':_0x50603c[_0xb903('0x66')][_0xb903('0x6d')],'pass':_0x50603c[_0xb903('0x66')][_0xb903('0x6e')]};_0xed5c48[_0xb903('0x6a')]=_0x50603c['Smtp']['secure'];}if(_0x21ab3c[_0xb903('0x56')][_0xb903('0x6f')]&&_0x21ab3c['body'][_0xb903('0x6f')][_0xb903('0x3f')]){for(var _0x256c3a=0x0;_0x256c3a<_0x21ab3c[_0xb903('0x56')][_0xb903('0x6f')][_0xb903('0x3f')];_0x256c3a+=0x1){_0x21ab3c[_0xb903('0x56')]['attachments'][_0x256c3a]={'filename':_0x21ab3c[_0xb903('0x56')][_0xb903('0x6f')][_0x256c3a][_0xb903('0x34')],'path':path[_0xb903('0x70')](config['root'],_0xb903('0x71'),_0x21ab3c[_0xb903('0x56')][_0xb903('0x6f')][_0x256c3a]['basename'])};}}_0x29a822={'account':_0xed5c48,'message':_0x21ab3c['body']};return;}})[_0xb903('0x31')](function(){if(_0x50603c[_0xb903('0x60')]){if(_0x50603c[_0xb903('0x60')][_0xb903('0x62')][_0xb903('0x3f')]){return _0x50603c[_0xb903('0x60')]['Contacts'][0x0];}else{return db[_0xb903('0x61')][_0xb903('0x58')](_[_0xb903('0x72')](_0x21ab3c[_0xb903('0x56')],{'firstName':_0x21ab3c['body']['to'],'email':_0x21ab3c[_0xb903('0x56')]['to'],'phone':_0x21ab3c[_0xb903('0x56')]['to'],'ListId':_0x50603c['ListId']}));}}else{throw new Error(_0xb903('0x73'));}})[_0xb903('0x31')](function(){if(_0x29a822){return respondWithRpcPromise(_0xb903('0x74'),'sendMail',_0x29a822,client9003)[_0xb903('0x31')](function(_0x278a30){return _0x44cb27[_0xb903('0x30')]({'read':!![],'messageId':_0x278a30[_0xb903('0x75')],'sentAt':moment()['format'](_0xb903('0x76'))});})[_0xb903('0x55')](function(_0xbf5edc){logger[_0xb903('0x21')]('%s',JSON[_0xb903('0x20')](_0xbf5edc));return _0x44cb27;});}return _0x44cb27;});}return _0x44cb27;}})[_0xb903('0x31')](respondWithResult(_0x2af365,0xc9))[_0xb903('0x55')](handleError(_0x2af365,null));};var interaction_log=require(_0xb903('0x10'))(_0xb903('0x77'));exports[_0xb903('0x78')]=function(_0x23955c,_0x3505d3,_0x4420d9){var _0x32ffa0={'channel':_0xb903('0x79')};if(_0x23955c[_0xb903('0x56')]['id']){delete _0x23955c['body']['id'];}_0x23955c[_0xb903('0x56')][_0xb903('0x7a')]=!![];_0x23955c[_0xb903('0x56')]['readAt']=moment()[_0xb903('0x7b')](_0xb903('0x76'));_0x23955c[_0xb903('0x56')][_0xb903('0x7c')]=_0x23955c[_0xb903('0x56')][_0xb903('0x7c')]||_0x23955c[_0xb903('0x6d')]['id'];return db[_0xb903('0x4a')][_0xb903('0x54')]({'where':{'id':_0x23955c['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb903('0x7d')}]})[_0xb903('0x31')](handleEntityNotFound(_0x3505d3,null))[_0xb903('0x31')](saveUpdates(_0x23955c[_0xb903('0x56')],null))[_0xb903('0x31')](function(_0x5e1d5d){if(_0x5e1d5d){_0x32ffa0[_0xb903('0x24')]=_0x5e1d5d[_0xb903('0x7e')]({'plain':!![]});return db[_0xb903('0x7f')][_0xb903('0x54')]({'where':{'id':_0x5e1d5d[_0xb903('0x80')]}});}return null;})[_0xb903('0x31')](handleEntityNotFound(_0x3505d3,null))[_0xb903('0x31')](function(_0x30cbac){if(_0x30cbac){return _0x30cbac[_0xb903('0x30')]({'UserId':_0x23955c[_0xb903('0x56')][_0xb903('0x7c')],'read1stAt':_[_0xb903('0x81')](_0x30cbac['read1stAt'])?moment()[_0xb903('0x7b')](_0xb903('0x76')):undefined});}return null;})[_0xb903('0x31')](function(_0x564fd6){if(_0x564fd6){_0x32ffa0[_0xb903('0x82')]=_0x564fd6[_0xb903('0x7e')]({'plain':!![]});interaction_log[_0xb903('0x1d')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23955c[_0xb903('0x6d')]['id'],_0x23955c[_0xb903('0x6d')][_0xb903('0x34')],_0x23955c[_0xb903('0x6d')][_0xb903('0x83')],_0x32ffa0[_0xb903('0x82')]['id'],_0x23955c[_0xb903('0x56')]?JSON[_0xb903('0x20')](_0x23955c[_0xb903('0x56')]):'null');return respondWithRpcPromise(_0xb903('0x84'),_0xb903('0x85'),_0x32ffa0);}return null;})['then'](function(_0x43ccf4){if(_0x43ccf4){if(_0x23955c[_0xb903('0x56')][_0xb903('0x86')]){_0x32ffa0[_0xb903('0x24')][_0xb903('0x87')]=util['format'](_0xb903('0x88'),_0x23955c[_0xb903('0x6d')][_0xb903('0x34')]);_0x32ffa0[_0xb903('0x24')][_0xb903('0x89')]=_0x32ffa0[_0xb903('0x89')];_0x32ffa0[_0xb903('0x24')][_0xb903('0x8a')]=_0xb903('0x78');return respondWithRpcPromise('EventManager',_0xb903('0x8b'),{'event':_0xb903('0x8c'),'message':_0x32ffa0[_0xb903('0x24')]},client9002)[_0xb903('0x31')](function(){return _0x32ffa0;});}return _0x32ffa0;}return null;})[_0xb903('0x31')](respondWithResult(_0x3505d3,null))['catch'](handleError(_0x3505d3,null));};var interaction_log=require(_0xb903('0x10'))(_0xb903('0x77'));exports['reject']=function(_0x45bcb8,_0x59c855,_0x1cf2f6){var _0x12b3fe={'agent':{},'channel':_0xb903('0x79')};if(_0x45bcb8[_0xb903('0x56')]['id']){delete _0x45bcb8[_0xb903('0x56')]['id'];}_0x45bcb8[_0xb903('0x56')][_0xb903('0x7c')]=_0x45bcb8['body'][_0xb903('0x7c')]||_0x45bcb8[_0xb903('0x6d')]['id'];_0x12b3fe['agent']['id']=_0x45bcb8[_0xb903('0x56')][_0xb903('0x7c')];return db[_0xb903('0x4a')][_0xb903('0x54')]({'where':{'id':_0x45bcb8[_0xb903('0x4e')]['id'],'UserId':null}})[_0xb903('0x31')](handleEntityNotFound(_0x59c855,null))[_0xb903('0x31')](function(_0x248a8e){if(_0x248a8e){_0x12b3fe[_0xb903('0x24')]=_0x248a8e[_0xb903('0x7e')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x248a8e['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x59c855,null))[_0xb903('0x31')](function(_0x1e4533){if(_0x1e4533){_0x12b3fe['interaction']=_0x1e4533['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x45bcb8[_0xb903('0x6d')]['id'],_0x45bcb8[_0xb903('0x6d')][_0xb903('0x34')],_0x45bcb8[_0xb903('0x6d')][_0xb903('0x83')],_0x12b3fe[_0xb903('0x82')]['id'],_0x45bcb8[_0xb903('0x56')]?JSON['stringify'](_0x45bcb8[_0xb903('0x56')]):_0xb903('0x8d'));return respondWithRpcPromise(_0xb903('0x8e'),'rejectMessage',_0x12b3fe);}return null;})[_0xb903('0x31')](function(_0x4ecc16){if(_0x4ecc16){_0x4ecc16[_0xb903('0x24')][_0xb903('0x87')]=util['format'](_0xb903('0x88'),_0x45bcb8[_0xb903('0x6d')]['name']);_0x4ecc16[_0xb903('0x24')]['channel']=_0x12b3fe[_0xb903('0x89')];_0x4ecc16[_0xb903('0x24')][_0xb903('0x8a')]=_0xb903('0x2e');respondWithRpcPromise(_0xb903('0x8b'),_0xb903('0x8b'),{'event':_0xb903('0x8f'),'message':_0x4ecc16['message']},client9002);return _0x12b3fe;}return null;})['then'](respondWithResult(_0x59c855,null))[_0xb903('0x55')](handleError(_0x59c855,null));};exports[_0xb903('0x90')]=function(_0x100a1e,_0x5ba215){var _0x5519c9=moment()['unix']()[_0xb903('0x91')]();var _0x5498cc=path[_0xb903('0x70')](config[_0xb903('0x92')],'server',_0xb903('0x93'),_0xb903('0x94'));var _0x389a3d=path[_0xb903('0x70')](config[_0xb903('0x92')],_0xb903('0x95'),_0xb903('0x93'),_0xb903('0x6f'));var _0x2e5e0d=util[_0xb903('0x7b')](_0xb903('0x96'),_0x5519c9);return db[_0xb903('0x4a')]['find']({'where':{'id':_0x100a1e['params']['id']},'attributes':['id',_0xb903('0x56'),_0xb903('0x97'),'to','cc',_0xb903('0x98'),_0xb903('0x99'),_0xb903('0x9a')],'include':_0x100a1e[_0xb903('0x3b')]['attachments']?[{'model':db[_0xb903('0x9b')],'as':_0xb903('0x9c')}]:undefined})[_0xb903('0x31')](handleEntityNotFound(_0x5ba215,null))['then'](function(_0xb0582e){if(_0xb0582e){var _0x326319=_0xb0582e;var _0x48d39a={'from':_0x326319[_0xb903('0x97')],'to':_0x326319['to'],'subject':_0x326319['subject'],'html':_0x326319[_0xb903('0x56')],'headers':{'Date':moment(_0x326319[_0xb903('0x9a')])[_0xb903('0x7b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xb0582e['cc']){_0x48d39a['headers']['Cc']=_0xb0582e['cc'];}if(_0xb0582e['bcc']){_0x48d39a['headers'][_0xb903('0x9d')]=_0xb0582e[_0xb903('0x98')];}return new BPromise(function(_0x576a8a,_0x495b64){if(_0xb0582e['Attachments']){for(var _0x5ba93=0x0;_0x5ba93<_0xb0582e['Attachments']['length'];_0x5ba93++){var _0x305c0c=_0xb0582e[_0xb903('0x9c')][_0x5ba93];var _0x3d63a5=path[_0xb903('0x70')](_0x389a3d,_0x305c0c[_0xb903('0x9e')]);if(fs[_0xb903('0x9f')](_0x3d63a5)){_0x48d39a[_0xb903('0x6f')]['push']({'name':_0x305c0c[_0xb903('0x34')],'contentType':_0x305c0c[_0xb903('0x49')],'data':fs[_0xb903('0xa0')](_0x3d63a5)});}}}emlformat[_0xb903('0xa1')](_0x48d39a,function(_0x187aa6,_0x58c5ca){if(_0x187aa6)return _0x495b64(_0x187aa6);fs[_0xb903('0xa2')](path[_0xb903('0x70')](_0x5498cc,_0x2e5e0d),_0x58c5ca);return _0x576a8a(_0x58c5ca);});});}})['then'](function(_0x3d94b4){if(_0x3d94b4){return _0x5ba215[_0xb903('0x90')](path['join'](_0x5498cc,_0x2e5e0d),_0x2e5e0d,function(_0x3d4893){if(_0x3d4893){console[_0xb903('0xa3')]('err',_0x3d4893);}else{fs[_0xb903('0xa4')](path[_0xb903('0x70')](_0x5498cc,_0x2e5e0d));}});}})[_0xb903('0x55')](handleError(_0x5ba215,null));}; \ No newline at end of file +var _0xbc17=['findAll','rows','keys','include','find','body','params','describe','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','service','host','port','authentication','auth','user','pass','secure','attachments','join','root','server/files/attachments','basename','List','create','ListId','List\x20not\x20found','SendMail','messageId','format','mail-interactions','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','Attachment','Attachments','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','writeFileSync','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','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','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','MailMessage'];(function(_0x358879,_0x4390ac){var _0x5666d7=function(_0x43a40c){while(--_0x43a40c){_0x358879['push'](_0x358879['shift']());}};_0x5666d7(++_0x4390ac);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x339702,_0x465d98){_0x339702=_0x339702-0x0;var _0x55cc03=_0xbc17[_0x339702];return _0x55cc03;};'use strict';var pdf=require(_0x7bc1('0x0'));var emlformat=require(_0x7bc1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7bc1('0x2'));var jsonpatch=require(_0x7bc1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bc1('0x4'));var Mustache=require(_0x7bc1('0x5'));var util=require('util');var path=require(_0x7bc1('0x6'));var sox=require('sox');var csv=require(_0x7bc1('0x7'));var ejs=require(_0x7bc1('0x8'));var fs=require('fs');var _=require(_0x7bc1('0x9'));var squel=require(_0x7bc1('0xa'));var crypto=require(_0x7bc1('0xb'));var jsforce=require(_0x7bc1('0xc'));var deskjs=require(_0x7bc1('0xd'));var toCsv=require(_0x7bc1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bc1('0xe'));var authService=require(_0x7bc1('0xf'));var qs=require(_0x7bc1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc1('0x11'));var logger=require(_0x7bc1('0x12'))(_0x7bc1('0x13'));var utils=require(_0x7bc1('0x14'));var config=require(_0x7bc1('0x15'));var db=require(_0x7bc1('0x16'))['db'];config[_0x7bc1('0x17')]=_[_0x7bc1('0x18')](config[_0x7bc1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bc1('0x19'))(new Redis(config[_0x7bc1('0x17')]));require('./mailMessage.socket')[_0x7bc1('0x1a')](socket);var jayson=require(_0x7bc1('0x1b'));var client=jayson['client'][_0x7bc1('0x1c')]({'port':0x232c});var client9003=jayson[_0x7bc1('0x1d')]['http']({'port':0x232b});var client9002=jayson[_0x7bc1('0x1d')][_0x7bc1('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1eaf32,_0x3aadaf,_0x193f75){if(_0x193f75){var _0x5a5a59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a5a59[_0x7bc1('0x1e')](_0x3aadaf)){return _0x1eaf32;}else{throw new db['Sequelize'][(_0x7bc1('0x1f'))](_0x7bc1('0x20'));}}else{return _0x1eaf32;}}function respondWithRpcPromise(_0xdf994,_0x22e6fd,_0x20ce32,_0xb3dd2c){return new BPromise(function(_0x10f01f,_0x135025){var _0x4e49d0=_0xb3dd2c||client;return _0x4e49d0[_0x7bc1('0x21')](_0xdf994,_0x20ce32)[_0x7bc1('0x22')](function(_0xd76572){logger[_0x7bc1('0x23')](_0x7bc1('0x24'),_0x22e6fd,'request\x20sent');logger[_0x7bc1('0x25')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x22e6fd,_0x7bc1('0x26'),JSON[_0x7bc1('0x27')](_0xd76572));if(_0xd76572[_0x7bc1('0x28')]){if(_0xd76572[_0x7bc1('0x28')][_0x7bc1('0x29')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x22e6fd,_0xd76572[_0x7bc1('0x28')][_0x7bc1('0x2a')]);return _0x135025(_0xd76572['error']['message']);}logger[_0x7bc1('0x28')](_0x7bc1('0x24'),_0x22e6fd,_0xd76572['error'][_0x7bc1('0x2a')]);return _0x10f01f(_0xd76572[_0x7bc1('0x28')][_0x7bc1('0x2a')]);}else{logger[_0x7bc1('0x23')](_0x7bc1('0x24'),_0x22e6fd,_0x7bc1('0x26'));_0x10f01f(_0xd76572[_0x7bc1('0x2b')][_0x7bc1('0x2a')]);}})[_0x7bc1('0x2c')](function(_0xd41222){logger[_0x7bc1('0x28')](_0x7bc1('0x24'),_0x22e6fd,_0xd41222);_0x135025(_0xd41222);});});}function respondWithStatusCode(_0x37130a,_0x36d3ff){_0x36d3ff=_0x36d3ff||0xcc;return function(_0x58d79c){if(_0x58d79c){return _0x37130a[_0x7bc1('0x2d')](_0x36d3ff);}return _0x37130a[_0x7bc1('0x2e')](_0x36d3ff)[_0x7bc1('0x2f')]();};}function respondWithResult(_0xc4f3ab,_0x6614c){_0x6614c=_0x6614c||0xc8;return function(_0x101c38){if(_0x101c38){return _0xc4f3ab[_0x7bc1('0x2e')](_0x6614c)[_0x7bc1('0x30')](_0x101c38);}};}function respondWithFilteredResult(_0x1033cb,_0x1352c2){return function(_0x4903b6){if(_0x4903b6){var _0x89d7cb=_0x4903b6[_0x7bc1('0x31')],_0x4a86a2=_0x1352c2[_0x7bc1('0x32')],_0x35e3ee=_0x1352c2[_0x7bc1('0x32')]+_0x1352c2[_0x7bc1('0x33')],_0x415608;if(_0x35e3ee>=_0x89d7cb){_0x35e3ee=_0x89d7cb;_0x415608=0xc8;}else{_0x415608=0xce;}_0x1033cb[_0x7bc1('0x2e')](_0x415608);return _0x1033cb['set'](_0x7bc1('0x34'),_0x4a86a2+'-'+_0x35e3ee+'/'+_0x89d7cb)[_0x7bc1('0x30')](_0x4903b6);}return null;};}function patchUpdates(_0x171b7b){return function(_0x14edcc){try{jsonpatch['apply'](_0x14edcc,_0x171b7b,!![]);}catch(_0x1d3a27){return BPromise[_0x7bc1('0x35')](_0x1d3a27);}return _0x14edcc['save']();};}function saveUpdates(_0x25229f,_0x5b86ac){return function(_0x5ceb40){if(_0x5ceb40){return _0x5ceb40[_0x7bc1('0x36')](_0x25229f)[_0x7bc1('0x22')](function(_0x16b8ec){return _0x16b8ec;});}return null;};}function removeEntity(_0x2466de,_0x369e39){return function(_0x510bdb){if(_0x510bdb){return _0x510bdb[_0x7bc1('0x37')]()[_0x7bc1('0x22')](function(){_0x2466de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f280e,_0x48ef4f){return function(_0x3fd13c){if(!_0x3fd13c){_0x2f280e[_0x7bc1('0x2d')](0x194);}return _0x3fd13c;};}function handleError(_0x3c1b53,_0x443b19){_0x443b19=_0x443b19||0x1f4;return function(_0x7200b3){logger[_0x7bc1('0x28')](_0x7200b3[_0x7bc1('0x38')]);if(_0x7200b3[_0x7bc1('0x39')]){delete _0x7200b3[_0x7bc1('0x39')];}_0x3c1b53[_0x7bc1('0x2e')](_0x443b19)[_0x7bc1('0x3a')](_0x7200b3);};}exports[_0x7bc1('0x3b')]=function(_0x35fd42,_0x163b1f){var _0x3e4344={},_0x445f6c={},_0x10fbc6={'count':0x0,'rows':[]};var _0x34bc3a=_[_0x7bc1('0x3c')](db['MailMessage'][_0x7bc1('0x3d')],function(_0x1eee4f){return{'name':_0x1eee4f[_0x7bc1('0x3e')],'type':_0x1eee4f['type']['key']};});_0x445f6c[_0x7bc1('0x3f')]=_['map'](_0x34bc3a,'name');_0x445f6c['query']=_['keys'](_0x35fd42[_0x7bc1('0x40')]);_0x445f6c[_0x7bc1('0x41')]=_[_0x7bc1('0x42')](_0x445f6c[_0x7bc1('0x3f')],_0x445f6c[_0x7bc1('0x40')]);_0x3e4344[_0x7bc1('0x43')]=_[_0x7bc1('0x42')](_0x445f6c['model'],qs[_0x7bc1('0x44')](_0x35fd42[_0x7bc1('0x40')][_0x7bc1('0x44')]));_0x3e4344[_0x7bc1('0x43')]=_0x3e4344[_0x7bc1('0x43')][_0x7bc1('0x45')]?_0x3e4344[_0x7bc1('0x43')]:_0x445f6c[_0x7bc1('0x3f')];if(!_0x35fd42[_0x7bc1('0x40')]['hasOwnProperty'](_0x7bc1('0x46'))){_0x3e4344[_0x7bc1('0x33')]=qs[_0x7bc1('0x33')](_0x35fd42[_0x7bc1('0x40')][_0x7bc1('0x33')]);_0x3e4344[_0x7bc1('0x32')]=qs[_0x7bc1('0x32')](_0x35fd42['query'][_0x7bc1('0x32')]);}_0x3e4344['order']=qs[_0x7bc1('0x47')](_0x35fd42['query'][_0x7bc1('0x47')]);_0x3e4344[_0x7bc1('0x48')]=qs[_0x7bc1('0x41')](_[_0x7bc1('0x49')](_0x35fd42[_0x7bc1('0x40')],_0x445f6c['filters']),_0x34bc3a);if(_0x35fd42[_0x7bc1('0x40')][_0x7bc1('0x4a')]){_0x3e4344[_0x7bc1('0x48')]=_[_0x7bc1('0x4b')](_0x3e4344[_0x7bc1('0x48')],{'$or':_['map'](_0x34bc3a,function(_0x2399bc){if(_0x2399bc[_0x7bc1('0x4c')]!=='VIRTUAL'){var _0x3d515f={};_0x3d515f[_0x2399bc[_0x7bc1('0x39')]]={'$like':'%'+_0x35fd42[_0x7bc1('0x40')]['filter']+'%'};return _0x3d515f;}})});}_0x3e4344=_[_0x7bc1('0x4b')]({},_0x3e4344,_0x35fd42[_0x7bc1('0x4d')]);var _0x4c34e7={'where':_0x3e4344[_0x7bc1('0x48')]};return db['MailMessage']['count'](_0x4c34e7)[_0x7bc1('0x22')](function(_0x164ecb){_0x10fbc6[_0x7bc1('0x31')]=_0x164ecb;if(_0x35fd42[_0x7bc1('0x40')][_0x7bc1('0x4e')]){_0x3e4344['include']=[{'all':!![]}];}return db[_0x7bc1('0x4f')][_0x7bc1('0x50')](_0x3e4344);})[_0x7bc1('0x22')](function(_0x37d724){_0x10fbc6[_0x7bc1('0x51')]=_0x37d724;return _0x10fbc6;})['then'](respondWithFilteredResult(_0x163b1f,_0x3e4344))[_0x7bc1('0x2c')](handleError(_0x163b1f,null));};exports['show']=function(_0x37f51b,_0x20902e){var _0x4147b1={'raw':!![],'where':{'id':_0x37f51b['params']['id']}},_0x40508e={};_0x40508e[_0x7bc1('0x3f')]=_[_0x7bc1('0x52')](db[_0x7bc1('0x4f')][_0x7bc1('0x3d')]);_0x40508e[_0x7bc1('0x40')]=_['keys'](_0x37f51b[_0x7bc1('0x40')]);_0x40508e[_0x7bc1('0x41')]=_[_0x7bc1('0x42')](_0x40508e['model'],_0x40508e['query']);_0x4147b1['attributes']=_[_0x7bc1('0x42')](_0x40508e[_0x7bc1('0x3f')],qs[_0x7bc1('0x44')](_0x37f51b[_0x7bc1('0x40')][_0x7bc1('0x44')]));_0x4147b1['attributes']=_0x4147b1['attributes'][_0x7bc1('0x45')]?_0x4147b1['attributes']:_0x40508e[_0x7bc1('0x3f')];if(_0x37f51b[_0x7bc1('0x40')][_0x7bc1('0x4e')]){_0x4147b1[_0x7bc1('0x53')]=[{'all':!![]}];}_0x4147b1=_[_0x7bc1('0x4b')]({},_0x4147b1,_0x37f51b[_0x7bc1('0x4d')]);return db[_0x7bc1('0x4f')][_0x7bc1('0x54')](_0x4147b1)[_0x7bc1('0x22')](handleEntityNotFound(_0x20902e,null))[_0x7bc1('0x22')](respondWithResult(_0x20902e,null))[_0x7bc1('0x2c')](handleError(_0x20902e,null));};exports['update']=function(_0x3328c8,_0xfe0160){if(_0x3328c8[_0x7bc1('0x55')]['id']){delete _0x3328c8[_0x7bc1('0x55')]['id'];}return db[_0x7bc1('0x4f')][_0x7bc1('0x54')]({'where':{'id':_0x3328c8[_0x7bc1('0x56')]['id']}})[_0x7bc1('0x22')](handleEntityNotFound(_0xfe0160,null))['then'](saveUpdates(_0x3328c8[_0x7bc1('0x55')],null))[_0x7bc1('0x22')](respondWithResult(_0xfe0160,null))[_0x7bc1('0x2c')](handleError(_0xfe0160,null));};exports['destroy']=function(_0x48c736,_0x42c4a4){return db[_0x7bc1('0x4f')][_0x7bc1('0x54')]({'where':{'id':_0x48c736['params']['id']}})[_0x7bc1('0x22')](handleEntityNotFound(_0x42c4a4,null))[_0x7bc1('0x22')](removeEntity(_0x42c4a4,null))['catch'](handleError(_0x42c4a4,null));};exports[_0x7bc1('0x57')]=function(_0x329ef7,_0x49f755){return db[_0x7bc1('0x4f')][_0x7bc1('0x57')]()['then'](respondWithResult(_0x49f755,null))[_0x7bc1('0x2c')](handleError(_0x49f755,null));};exports['create']=function(_0x25ff5c,_0x5e2556){return db['MailMessage']['create'](_0x25ff5c[_0x7bc1('0x55')])[_0x7bc1('0x22')](function(_0x341007){if(_0x341007){if(_0x341007[_0x7bc1('0x58')]==='out'&&!_0x341007[_0x7bc1('0x59')]){var _0x2b2436,_0x5db0b0,_0x329d7e;if(_0x25ff5c[_0x7bc1('0x55')]['to']){_0x5db0b0=_0x25ff5c[_0x7bc1('0x55')]['to'][_0x7bc1('0x5a')](',')[0x0];}return db[_0x7bc1('0x5b')][_0x7bc1('0x5c')]({'where':{'id':_0x341007[_0x7bc1('0x5d')]},'include':[{'model':db[_0x7bc1('0x5e')],'as':'List','include':[{'model':db[_0x7bc1('0x5f')],'as':_0x7bc1('0x60'),'where':{'email':_0x5db0b0},'limit':0x1,'order':[['updatedAt',_0x7bc1('0x61')]]}]},{'model':db[_0x7bc1('0x62')],'as':_0x7bc1('0x63'),'raw':!![]}]})['then'](function(_0x597618){_0x2b2436=_0x597618;if(_0x2b2436&&_0x2b2436[_0x7bc1('0x63')]){var _0x406e98={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x64')])){_0x406e98[_0x7bc1('0x65')]=_0x2b2436[_0x7bc1('0x63')]['host'];_0x406e98['port']=_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x66')];_0x406e98['secure']=_0x2b2436[_0x7bc1('0x63')]['secure'];if(_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x67')]){_0x406e98[_0x7bc1('0x68')]={'user':_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x69')],'pass':_0x2b2436['Smtp']['pass']};}}else{_0x406e98[_0x7bc1('0x64')]=_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x64')];_0x406e98[_0x7bc1('0x68')]={'user':_0x2b2436[_0x7bc1('0x63')]['user'],'pass':_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x6a')]};_0x406e98[_0x7bc1('0x6b')]=_0x2b2436[_0x7bc1('0x63')][_0x7bc1('0x6b')];}if(_0x25ff5c[_0x7bc1('0x55')]['attachments']&&_0x25ff5c[_0x7bc1('0x55')]['attachments'][_0x7bc1('0x45')]){for(var _0x580fb7=0x0;_0x580fb7<_0x25ff5c[_0x7bc1('0x55')][_0x7bc1('0x6c')][_0x7bc1('0x45')];_0x580fb7+=0x1){_0x25ff5c[_0x7bc1('0x55')]['attachments'][_0x580fb7]={'filename':_0x25ff5c[_0x7bc1('0x55')][_0x7bc1('0x6c')][_0x580fb7][_0x7bc1('0x39')],'path':path[_0x7bc1('0x6d')](config[_0x7bc1('0x6e')],_0x7bc1('0x6f'),_0x25ff5c[_0x7bc1('0x55')][_0x7bc1('0x6c')][_0x580fb7][_0x7bc1('0x70')])};}}_0x329d7e={'account':_0x406e98,'message':_0x25ff5c[_0x7bc1('0x55')]};return;}})[_0x7bc1('0x22')](function(){if(_0x2b2436[_0x7bc1('0x71')]){if(_0x2b2436[_0x7bc1('0x71')]['Contacts'][_0x7bc1('0x45')]){return _0x2b2436[_0x7bc1('0x71')][_0x7bc1('0x60')][0x0];}else{return db[_0x7bc1('0x5f')][_0x7bc1('0x72')](_[_0x7bc1('0x18')](_0x25ff5c[_0x7bc1('0x55')],{'firstName':_0x25ff5c[_0x7bc1('0x55')]['to'],'email':_0x25ff5c[_0x7bc1('0x55')]['to'],'phone':_0x25ff5c['body']['to'],'ListId':_0x2b2436[_0x7bc1('0x73')]}));}}else{throw new Error(_0x7bc1('0x74'));}})[_0x7bc1('0x22')](function(){if(_0x329d7e){return respondWithRpcPromise(_0x7bc1('0x75'),'sendMail',_0x329d7e,client9003)[_0x7bc1('0x22')](function(_0x13bb3e){return _0x341007[_0x7bc1('0x36')]({'read':!![],'messageId':_0x13bb3e[_0x7bc1('0x76')],'sentAt':moment()[_0x7bc1('0x77')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7bc1('0x2c')](function(_0x54f093){logger[_0x7bc1('0x28')]('%s',JSON[_0x7bc1('0x27')](_0x54f093));return _0x341007;});}return _0x341007;});}return _0x341007;}})['then'](respondWithResult(_0x5e2556,0xc9))[_0x7bc1('0x2c')](handleError(_0x5e2556,null));};var interaction_log=require('../../config/logger')(_0x7bc1('0x78'));exports['accept']=function(_0x3c558d,_0x9e5995,_0x29ffc0){var _0x5d757b={'channel':'mail'};if(_0x3c558d[_0x7bc1('0x55')]['id']){delete _0x3c558d[_0x7bc1('0x55')]['id'];}_0x3c558d[_0x7bc1('0x55')][_0x7bc1('0x79')]=!![];_0x3c558d[_0x7bc1('0x55')][_0x7bc1('0x7a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c558d[_0x7bc1('0x55')][_0x7bc1('0x7b')]=_0x3c558d[_0x7bc1('0x55')][_0x7bc1('0x7b')]||_0x3c558d[_0x7bc1('0x69')]['id'];return db['MailMessage'][_0x7bc1('0x54')]({'where':{'id':_0x3c558d[_0x7bc1('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x7bc1('0x5f')],'as':_0x7bc1('0x7c')}]})[_0x7bc1('0x22')](handleEntityNotFound(_0x9e5995,null))[_0x7bc1('0x22')](saveUpdates(_0x3c558d[_0x7bc1('0x55')],null))[_0x7bc1('0x22')](function(_0x3db99b){if(_0x3db99b){_0x5d757b[_0x7bc1('0x2a')]=_0x3db99b[_0x7bc1('0x7d')]({'plain':!![]});return db[_0x7bc1('0x7e')]['find']({'where':{'id':_0x3db99b[_0x7bc1('0x7f')]}});}return null;})[_0x7bc1('0x22')](handleEntityNotFound(_0x9e5995,null))['then'](function(_0x4a57b7){if(_0x4a57b7){return _0x4a57b7[_0x7bc1('0x36')]({'UserId':_0x3c558d['body'][_0x7bc1('0x7b')],'read1stAt':_[_0x7bc1('0x80')](_0x4a57b7[_0x7bc1('0x81')])?moment()[_0x7bc1('0x77')](_0x7bc1('0x82')):undefined});}return null;})[_0x7bc1('0x22')](function(_0x22b51b){if(_0x22b51b){_0x5d757b['interaction']=_0x22b51b[_0x7bc1('0x7d')]({'plain':!![]});interaction_log['info'](_0x7bc1('0x83'),_0x3c558d[_0x7bc1('0x69')]['id'],_0x3c558d['user'][_0x7bc1('0x39')],_0x3c558d[_0x7bc1('0x69')]['role'],_0x5d757b[_0x7bc1('0x84')]['id'],_0x3c558d[_0x7bc1('0x55')]?JSON[_0x7bc1('0x27')](_0x3c558d['body']):'null');return respondWithRpcPromise(_0x7bc1('0x85'),_0x7bc1('0x86'),_0x5d757b);}return null;})[_0x7bc1('0x22')](function(_0x516dc8){if(_0x516dc8){if(_0x3c558d['body'][_0x7bc1('0x87')]){_0x5d757b[_0x7bc1('0x2a')][_0x7bc1('0x88')]=util[_0x7bc1('0x77')](_0x7bc1('0x89'),_0x3c558d['user'][_0x7bc1('0x39')]);_0x5d757b[_0x7bc1('0x2a')][_0x7bc1('0x8a')]=_0x5d757b['channel'];_0x5d757b[_0x7bc1('0x2a')][_0x7bc1('0x8b')]=_0x7bc1('0x8c');return respondWithRpcPromise(_0x7bc1('0x8d'),_0x7bc1('0x8d'),{'event':_0x7bc1('0x8e'),'message':_0x5d757b[_0x7bc1('0x2a')]},client9002)[_0x7bc1('0x22')](function(){return _0x5d757b;});}return _0x5d757b;}return null;})[_0x7bc1('0x22')](respondWithResult(_0x9e5995,null))['catch'](handleError(_0x9e5995,null));};var interaction_log=require(_0x7bc1('0x12'))('mail-interactions');exports[_0x7bc1('0x35')]=function(_0x5d27b1,_0x5ce94f,_0x2895d2){var _0xa1a68f={'agent':{},'channel':'mail'};if(_0x5d27b1[_0x7bc1('0x55')]['id']){delete _0x5d27b1[_0x7bc1('0x55')]['id'];}_0x5d27b1[_0x7bc1('0x55')][_0x7bc1('0x7b')]=_0x5d27b1[_0x7bc1('0x55')][_0x7bc1('0x7b')]||_0x5d27b1[_0x7bc1('0x69')]['id'];_0xa1a68f[_0x7bc1('0x8f')]['id']=_0x5d27b1[_0x7bc1('0x55')][_0x7bc1('0x7b')];return db[_0x7bc1('0x4f')][_0x7bc1('0x54')]({'where':{'id':_0x5d27b1[_0x7bc1('0x56')]['id'],'UserId':null}})[_0x7bc1('0x22')](handleEntityNotFound(_0x5ce94f,null))[_0x7bc1('0x22')](function(_0x4cae1f){if(_0x4cae1f){_0xa1a68f[_0x7bc1('0x2a')]=_0x4cae1f[_0x7bc1('0x7d')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x4cae1f[_0x7bc1('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x5ce94f,null))['then'](function(_0x37444e){if(_0x37444e){_0xa1a68f['interaction']=_0x37444e['get']({'plain':!![]});interaction_log['info'](_0x7bc1('0x90'),_0x5d27b1[_0x7bc1('0x69')]['id'],_0x5d27b1['user'][_0x7bc1('0x39')],_0x5d27b1[_0x7bc1('0x69')][_0x7bc1('0x91')],_0xa1a68f[_0x7bc1('0x84')]['id'],_0x5d27b1[_0x7bc1('0x55')]?JSON[_0x7bc1('0x27')](_0x5d27b1[_0x7bc1('0x55')]):'null');return respondWithRpcPromise(_0x7bc1('0x92'),'rejectMessage',_0xa1a68f);}return null;})['then'](function(_0xa6298d){if(_0xa6298d){_0xa6298d[_0x7bc1('0x2a')]['interface']=util[_0x7bc1('0x77')]('SIP/%s',_0x5d27b1[_0x7bc1('0x69')][_0x7bc1('0x39')]);_0xa6298d[_0x7bc1('0x2a')]['channel']=_0xa1a68f[_0x7bc1('0x8a')];_0xa6298d[_0x7bc1('0x2a')][_0x7bc1('0x8b')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x7bc1('0x93'),'message':_0xa6298d['message']},client9002);return _0xa1a68f;}return null;})['then'](respondWithResult(_0x5ce94f,null))[_0x7bc1('0x2c')](handleError(_0x5ce94f,null));};exports[_0x7bc1('0x94')]=function(_0x317379,_0x336859){var _0x39b9f6=moment()[_0x7bc1('0x95')]()[_0x7bc1('0x96')]();var _0x1e919c=path[_0x7bc1('0x6d')](config[_0x7bc1('0x6e')],_0x7bc1('0x97'),_0x7bc1('0x98'),_0x7bc1('0x99'));var _0xfa193d=path['join'](config[_0x7bc1('0x6e')],_0x7bc1('0x97'),'files','attachments');var _0x2aefd0=util['format'](_0x7bc1('0x9a'),_0x39b9f6);return db[_0x7bc1('0x4f')]['find']({'where':{'id':_0x317379[_0x7bc1('0x56')]['id']},'attributes':['id','body',_0x7bc1('0x9b'),'to','cc',_0x7bc1('0x9c'),'subject','createdAt'],'include':_0x317379[_0x7bc1('0x40')]['attachments']?[{'model':db[_0x7bc1('0x9d')],'as':_0x7bc1('0x9e')}]:undefined})[_0x7bc1('0x22')](handleEntityNotFound(_0x336859,null))['then'](function(_0x22e2b8){if(_0x22e2b8){var _0x584b9a=_0x22e2b8;var _0x16f198={'from':_0x584b9a[_0x7bc1('0x9b')],'to':_0x584b9a['to'],'subject':_0x584b9a[_0x7bc1('0x9f')],'html':_0x584b9a[_0x7bc1('0x55')],'headers':{'Date':moment(_0x584b9a[_0x7bc1('0xa0')])[_0x7bc1('0x77')](_0x7bc1('0xa1'))},'attachments':[]};if(_0x22e2b8['cc']){_0x16f198[_0x7bc1('0xa2')]['Cc']=_0x22e2b8['cc'];}if(_0x22e2b8[_0x7bc1('0x9c')]){_0x16f198[_0x7bc1('0xa2')][_0x7bc1('0xa3')]=_0x22e2b8[_0x7bc1('0x9c')];}return new BPromise(function(_0x4b11c8,_0x4d9d33){if(_0x22e2b8[_0x7bc1('0x9e')]){for(var _0x25142e=0x0;_0x25142e<_0x22e2b8['Attachments'][_0x7bc1('0x45')];_0x25142e++){var _0x58b032=_0x22e2b8[_0x7bc1('0x9e')][_0x25142e];var _0x21327e=path['join'](_0xfa193d,_0x58b032[_0x7bc1('0x70')]);if(fs[_0x7bc1('0xa4')](_0x21327e)){_0x16f198[_0x7bc1('0x6c')]['push']({'name':_0x58b032[_0x7bc1('0x39')],'contentType':_0x58b032['type'],'data':fs[_0x7bc1('0xa5')](_0x21327e)});}}}emlformat['build'](_0x16f198,function(_0x192557,_0x42a62e){if(_0x192557)return _0x4d9d33(_0x192557);fs[_0x7bc1('0xa6')](path['join'](_0x1e919c,_0x2aefd0),_0x42a62e);return _0x4b11c8(_0x42a62e);});});}})[_0x7bc1('0x22')](function(_0x351b42){if(_0x351b42){return _0x336859[_0x7bc1('0x94')](path[_0x7bc1('0x6d')](_0x1e919c,_0x2aefd0),_0x2aefd0,function(_0x18ba07){if(_0x18ba07){console[_0x7bc1('0xa7')](_0x7bc1('0xa8'),_0x18ba07);}else{fs['unlinkSync'](path['join'](_0x1e919c,_0x2aefd0));}});}})['catch'](handleError(_0x336859,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 1525b0e..39a5da0 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 _0xb344=['setMaxListeners','update','remove','emit','hook','../../mysqldb'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xb344,0x1af));var _0x4b34=function(_0x2bd211,_0x522300){_0x2bd211=_0x2bd211-0x0;var _0x5b963e=_0xb344[_0x2bd211];return _0x5b963e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x4b34('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4b34('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b34('0x2'),'afterDestroy':_0x4b34('0x3')};function emitEvent(_0x36b56d){return function(_0x200d42,_0x26fa2b,_0x3ba177){MailMessageEvents[_0x4b34('0x4')](_0x36b56d+':'+_0x200d42['id'],_0x200d42);MailMessageEvents[_0x4b34('0x4')](_0x36b56d,_0x200d42);_0x3ba177(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x4b34('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb069=['hasOwnProperty','hook','events','MailMessage','setMaxListeners','save','remove','emit'];(function(_0x51bbe8,_0x538079){var _0x15d8f9=function(_0x258444){while(--_0x258444){_0x51bbe8['push'](_0x51bbe8['shift']());}};_0x15d8f9(++_0x538079);}(_0xb069,0x1a2));var _0x9b06=function(_0x3706c6,_0x6c6db3){_0x3706c6=_0x3706c6-0x0;var _0x60787f=_0xb069[_0x3706c6];return _0x60787f;};'use strict';var EventEmitter=require(_0x9b06('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x9b06('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9b06('0x2')](0x0);var events={'afterCreate':_0x9b06('0x3'),'afterUpdate':'update','afterDestroy':_0x9b06('0x4')};function emitEvent(_0x54742c){return function(_0x35f8a1,_0x2a53dd,_0x4e0481){MailMessageEvents[_0x9b06('0x5')](_0x54742c+':'+_0x35f8a1['id'],_0x35f8a1);MailMessageEvents[_0x9b06('0x5')](_0x54742c,_0x35f8a1);_0x4e0481(null);};}for(var e in events){if(events[_0x9b06('0x6')](e)){var event=events[e];MailMessage[_0x9b06('0x7')](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 05a45fb..7b04300 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 _0x96d4=['plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','MailMessage','mail_messages','messageId'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x96d4,0xdc));var _0x496d=function(_0x4c2426,_0x30e4b9){_0x4c2426=_0x4c2426-0x0;var _0x17431c=_0x96d4[_0x4c2426];return _0x17431c;};'use strict';var _=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var logger=require(_0x496d('0x2'))(_0x496d('0x3'));var moment=require(_0x496d('0x4'));var BPromise=require(_0x496d('0x5'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x496d('0x6'));var rimraf=require(_0x496d('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x496d('0x8')]=function(_0xd5b104,_0x3cac34){return _0xd5b104['define'](_0x496d('0x9'),attributes,{'tableName':_0x496d('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x496d('0xb')]},{'name':'fti_mail_messages','fields':[_0x496d('0xc'),_0x496d('0xd')],'type':_0x496d('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e0926,_0x44c461,_0x1a725e){if(_0x3e0926[_0x496d('0xf')]){_0x3e0926[_0x496d('0xc')]=htmlToText[_0x496d('0x10')](_0x3e0926['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1a725e(null,_0x44c461);},'afterCreate':function(_0x5b44ad,_0x12b196,_0x2a0938){var _0x179338=_0xd5b104[_0x496d('0x11')];var _0x445ce8=_0x5b44ad['get']({'plain':!![]});if(_0x445ce8[_0x496d('0x12')][_0x496d('0x13')]()==='in'||_0x445ce8['direction'][_0x496d('0x13')]()==='out'&&!_0x445ce8[_0x496d('0x14')]&&!_['isNil'](_0x445ce8['UserId'])){_0x179338[_0x496d('0x15')][_0x496d('0x16')]({'where':{'id':_0x445ce8[_0x496d('0x17')]}})[_0x496d('0x18')](function(_0x563d79){if(_0x563d79){_0x563d79[_0x496d('0x19')]({'lastMsgAt':_0x445ce8[_0x496d('0x1a')],'lastMsgDirection':_0x445ce8[_0x496d('0x12')][_0x496d('0x13')](),'lastMsgBody':_0x445ce8[_0x496d('0xf')]});}})['catch'](function(_0x5f4428){console[_0x496d('0x1b')](_0x5f4428);});}_0x2a0938();}},'charset':_0x496d('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc1bf=['findOne','MailInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','fromString','body','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x3903ef,_0x30063f){var _0x5a340b=function(_0x14ef71){while(--_0x14ef71){_0x3903ef['push'](_0x3903ef['shift']());}};_0x5a340b(++_0x30063f);}(_0xc1bf,0xd3));var _0xfc1b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc1bf[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfc1b('0x0'));var util=require(_0xfc1b('0x1'));var logger=require(_0xfc1b('0x2'))('api');var moment=require(_0xfc1b('0x3'));var BPromise=require(_0xfc1b('0x4'));var rp=require(_0xfc1b('0x5'));var htmlToText=require(_0xfc1b('0x6'));var fs=require('fs');var path=require(_0xfc1b('0x7'));var rimraf=require(_0xfc1b('0x8'));var config=require(_0xfc1b('0x9'));var attributes=require('./mailMessage.attributes');module[_0xfc1b('0xa')]=function(_0x52bac4,_0x54fdee){return _0x52bac4[_0xfc1b('0xb')](_0xfc1b('0xc'),attributes,{'tableName':_0xfc1b('0xd'),'paranoid':![],'indexes':[{'name':_0xfc1b('0xe'),'fields':['messageId']},{'name':_0xfc1b('0xf'),'fields':[_0xfc1b('0x10'),'subject'],'type':_0xfc1b('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1290b7,_0x34edb8,_0x2f9a56){if(_0x1290b7['body']){_0x1290b7[_0xfc1b('0x10')]=htmlToText[_0xfc1b('0x12')](_0x1290b7[_0xfc1b('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2f9a56(null,_0x34edb8);},'afterCreate':function(_0x1a395f,_0x319fc0,_0x2227e1){var _0x50b23e=_0x52bac4['models'];var _0x18f468=_0x1a395f[_0xfc1b('0x14')]({'plain':!![]});if(_0x18f468[_0xfc1b('0x15')]['toLowerCase']()==='in'||_0x18f468[_0xfc1b('0x15')][_0xfc1b('0x16')]()===_0xfc1b('0x17')&&!_0x18f468[_0xfc1b('0x18')]&&!_[_0xfc1b('0x19')](_0x18f468[_0xfc1b('0x1a')])){_0x50b23e['MailInteraction'][_0xfc1b('0x1b')]({'where':{'id':_0x18f468[_0xfc1b('0x1c')]}})[_0xfc1b('0x1d')](function(_0x62fda6){if(_0x62fda6){_0x62fda6[_0xfc1b('0x1e')]({'lastMsgAt':_0x18f468['createdAt'],'lastMsgDirection':_0x18f468['direction'][_0xfc1b('0x16')](),'lastMsgBody':_0x18f468[_0xfc1b('0x13')]});}})['catch'](function(_0x3ae741){console[_0xfc1b('0x1f')](_0x3ae741);});}_0x2227e1();}},'charset':_0xfc1b('0x20'),'collate':_0xfc1b('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bc578ff..0223815 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 _0x39c7=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','body','options','raw'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x39c7,0x85));var _0x739c=function(_0x27926c,_0x37d579){_0x27926c=_0x27926c-0x0;var _0x584578=_0x39c7[_0x27926c];return _0x584578;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var moment=require(_0x739c('0x1'));var BPromise=require(_0x739c('0x2'));var rs=require(_0x739c('0x3'));var fs=require('fs');var Redis=require(_0x739c('0x4'));var db=require(_0x739c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x739c('0x6'))(_0x739c('0x7'));var config=require(_0x739c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x739c('0x9')]({'port':0x232a});config[_0x739c('0xa')]=_['defaults'](config['redis'],{'host':_0x739c('0xb'),'port':0x18eb});var socket=require(_0x739c('0xc'))(new Redis(config['redis']));require(_0x739c('0xd'))[_0x739c('0xe')](socket);function respondWithRpcPromise(_0x5a2a66,_0x530e42,_0xd334){return new BPromise(function(_0xed987a,_0x2a31bd){return client[_0x739c('0xf')](_0x5a2a66,_0xd334)[_0x739c('0x10')](function(_0x17ceae){logger[_0x739c('0x11')](_0x739c('0x12'),_0x530e42,_0x739c('0x13'));logger[_0x739c('0x14')](_0x739c('0x15'),_0x530e42,_0x739c('0x13'),JSON['stringify'](_0x17ceae));if(_0x17ceae[_0x739c('0x16')]){if(_0x17ceae[_0x739c('0x16')][_0x739c('0x17')]===0x1f4){logger[_0x739c('0x16')](_0x739c('0x12'),_0x530e42,_0x17ceae[_0x739c('0x16')][_0x739c('0x18')]);return _0x2a31bd(_0x17ceae[_0x739c('0x16')][_0x739c('0x18')]);}logger[_0x739c('0x16')]('MailMessage,\x20%s,\x20%s',_0x530e42,_0x17ceae['error'][_0x739c('0x18')]);return _0xed987a(_0x17ceae[_0x739c('0x16')][_0x739c('0x18')]);}else{logger['info'](_0x739c('0x12'),_0x530e42,_0x739c('0x13'));_0xed987a(_0x17ceae[_0x739c('0x19')][_0x739c('0x18')]);}})[_0x739c('0x1a')](function(_0x5e412f){logger[_0x739c('0x16')](_0x739c('0x12'),_0x530e42,_0x5e412f);_0x2a31bd(_0x5e412f);});});}exports[_0x739c('0x1b')]=function(_0x4fc201){var _0x6554ff=this;return new Promise(function(_0x48fc13,_0x4a02b9){return db[_0x739c('0x1c')]['create'](_0x4fc201[_0x739c('0x1d')],{'raw':_0x4fc201[_0x739c('0x1e')]?_0x4fc201['options'][_0x739c('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x147baf){logger['info'](_0x739c('0x1b'),_0x4fc201);logger[_0x739c('0x14')](_0x739c('0x1b'),_0x4fc201,JSON[_0x739c('0x20')](_0x147baf));_0x48fc13(_0x147baf);})[_0x739c('0x1a')](function(_0xc138ce){logger[_0x739c('0x16')](_0x739c('0x1b'),_0xc138ce['message'],_0x4fc201);_0x4a02b9(_0x6554ff[_0x739c('0x16')](0x1f4,_0xc138ce[_0x739c('0x18')]));});});}; \ No newline at end of file +var _0xef96=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info'];(function(_0x36fe8c,_0x1e2027){var _0x1a9034=function(_0x3c285d){while(--_0x3c285d){_0x36fe8c['push'](_0x36fe8c['shift']());}};_0x1a9034(++_0x1e2027);}(_0xef96,0x162));var _0x6ef9=function(_0x5172c3,_0x1bbdf9){_0x5172c3=_0x5172c3-0x0;var _0x1275e0=_0xef96[_0x5172c3];return _0x1275e0;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var moment=require(_0x6ef9('0x2'));var BPromise=require(_0x6ef9('0x3'));var rs=require(_0x6ef9('0x4'));var fs=require('fs');var Redis=require(_0x6ef9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ef9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ef9('0x7'));var client=jayson[_0x6ef9('0x8')][_0x6ef9('0x9')]({'port':0x232a});config['redis']=_[_0x6ef9('0xa')](config['redis'],{'host':_0x6ef9('0xb'),'port':0x18eb});var socket=require(_0x6ef9('0xc'))(new Redis(config[_0x6ef9('0xd')]));require('./mailMessage.socket')[_0x6ef9('0xe')](socket);function respondWithRpcPromise(_0x4ccb23,_0xb9346c,_0x418b1d){return new BPromise(function(_0x46734b,_0x5aee3b){return client[_0x6ef9('0xf')](_0x4ccb23,_0x418b1d)[_0x6ef9('0x10')](function(_0xcee555){logger[_0x6ef9('0x11')]('MailMessage,\x20%s,\x20%s',_0xb9346c,_0x6ef9('0x12'));logger[_0x6ef9('0x13')](_0x6ef9('0x14'),_0xb9346c,_0x6ef9('0x12'),JSON[_0x6ef9('0x15')](_0xcee555));if(_0xcee555[_0x6ef9('0x16')]){if(_0xcee555[_0x6ef9('0x16')]['code']===0x1f4){logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);return _0x5aee3b(_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);}logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0xcee555[_0x6ef9('0x16')]['message']);return _0x46734b(_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0xb9346c,_0x6ef9('0x12'));_0x46734b(_0xcee555['result'][_0x6ef9('0x18')]);}})[_0x6ef9('0x19')](function(_0x9b792d){logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0x9b792d);_0x5aee3b(_0x9b792d);});});}exports[_0x6ef9('0x1a')]=function(_0x493cdd){var _0x56fabb=this;return new Promise(function(_0x1ac999,_0x243de4){return db['MailMessage'][_0x6ef9('0x1b')](_0x493cdd[_0x6ef9('0x1c')],{'raw':_0x493cdd[_0x6ef9('0x1d')]?_0x493cdd[_0x6ef9('0x1d')][_0x6ef9('0x1e')]===undefined?!![]:![]:!![]})[_0x6ef9('0x10')](function(_0x404515){logger['info']('CreateMailMessage',_0x493cdd);logger[_0x6ef9('0x13')](_0x6ef9('0x1a'),_0x493cdd,JSON['stringify'](_0x404515));_0x1ac999(_0x404515);})['catch'](function(_0x22b3d6){logger['error'](_0x6ef9('0x1a'),_0x22b3d6[_0x6ef9('0x18')],_0x493cdd);_0x243de4(_0x56fabb[_0x6ef9('0x16')](0x1f4,_0x22b3d6[_0x6ef9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a9f44a6..908ccbc 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 _0xc5ba=['length','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x31877d,_0x56b8af){var _0x53ccfa=function(_0x5f57b4){while(--_0x5f57b4){_0x31877d['push'](_0x31877d['shift']());}};_0x53ccfa(++_0x56b8af);}(_0xc5ba,0xb9));var _0xac5b=function(_0x16ee48,_0x4e660d){_0x16ee48=_0x16ee48-0x0;var _0x23f7bf=_0xc5ba[_0x16ee48];return _0x23f7bf;};'use strict';var MailMessageEvents=require(_0xac5b('0x0'));var events=[_0xac5b('0x1'),_0xac5b('0x2'),_0xac5b('0x3')];function createListener(_0x2faba9,_0x34fad9){return function(_0x3158cd){_0x34fad9[_0xac5b('0x4')](_0x2faba9,_0x3158cd);};}function removeListener(_0x3d0dc6,_0x3c48f1){return function(){MailMessageEvents[_0xac5b('0x5')](_0x3d0dc6,_0x3c48f1);};}exports[_0xac5b('0x6')]=function(_0x23cf2f){for(var _0x17fcf3=0x0,_0x38602a=events[_0xac5b('0x7')];_0x17fcf3<_0x38602a;_0x17fcf3++){var _0xc193a7=events[_0x17fcf3];var _0x4a7fc7=createListener('mailMessage:'+_0xc193a7,_0x23cf2f);MailMessageEvents['on'](_0xc193a7,_0x4a7fc7);}}; \ No newline at end of file +var _0x330c=['remove','update','emit','removeListener','length','mailMessage:','./mailMessage.events','save'];(function(_0x42babc,_0x1287c0){var _0x3b240a=function(_0xd07e1f){while(--_0xd07e1f){_0x42babc['push'](_0x42babc['shift']());}};_0x3b240a(++_0x1287c0);}(_0x330c,0x186));var _0xc330=function(_0x3443dd,_0x22bbb6){_0x3443dd=_0x3443dd-0x0;var _0x5808f1=_0x330c[_0x3443dd];return _0x5808f1;};'use strict';var MailMessageEvents=require(_0xc330('0x0'));var events=[_0xc330('0x1'),_0xc330('0x2'),_0xc330('0x3')];function createListener(_0x48e3fc,_0x17e47c){return function(_0x197a49){_0x17e47c[_0xc330('0x4')](_0x48e3fc,_0x197a49);};}function removeListener(_0x207daa,_0x3852b2){return function(){MailMessageEvents[_0xc330('0x5')](_0x207daa,_0x3852b2);};}exports['register']=function(_0x4f49fb){for(var _0x53d0ca=0x0,_0x1a6a2e=events[_0xc330('0x6')];_0x53d0ca<_0x1a6a2e;_0x53d0ca++){var _0x253c40=events[_0x53d0ca];var _0x114bf0=createListener(_0xc330('0x7')+_0x253c40,_0x4f49fb);MailMessageEvents['on'](_0x253c40,_0x114bf0);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9ce3d79..c7c47fe 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 _0x368c=['/:id/teams','addTeams','addAgents','put','/:id','update','delete','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/users','post','create'];(function(_0x18b5f8,_0x1a875f){var _0x504fd3=function(_0x18c822){while(--_0x18c822){_0x18b5f8['push'](_0x18b5f8['shift']());}};_0x504fd3(++_0x1a875f);}(_0x368c,0x1ad));var _0xc368=function(_0x1b798a,_0x221c76){_0x1b798a=_0x1b798a-0x0;var _0x4930a5=_0x368c[_0x1b798a];return _0x4930a5;};'use strict';var multer=require(_0xc368('0x0'));var util=require(_0xc368('0x1'));var path=require(_0xc368('0x2'));var timeout=require('connect-timeout');var express=require(_0xc368('0x3'));var router=express[_0xc368('0x4')]();var auth=require(_0xc368('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc368('0x6'));var controller=require(_0xc368('0x7'));router[_0xc368('0x8')]('/',auth[_0xc368('0x9')](),controller[_0xc368('0xa')]);router['get'](_0xc368('0xb'),auth[_0xc368('0x9')](),controller[_0xc368('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc368('0xd')]);router['get'](_0xc368('0xe'),auth[_0xc368('0x9')](),controller[_0xc368('0xf')]);router['get']('/:id/teams',auth[_0xc368('0x9')](),controller['getTeams']);router[_0xc368('0x8')](_0xc368('0x10'),auth[_0xc368('0x9')](),controller['getAgents']);router[_0xc368('0x11')]('/',auth[_0xc368('0x9')](),controller[_0xc368('0x12')]);router[_0xc368('0x11')](_0xc368('0x13'),auth[_0xc368('0x9')](),controller[_0xc368('0x14')]);router[_0xc368('0x11')](_0xc368('0x10'),auth[_0xc368('0x9')](),controller[_0xc368('0x15')]);router[_0xc368('0x16')](_0xc368('0x17'),auth[_0xc368('0x9')](),controller[_0xc368('0x18')]);router['delete'](_0xc368('0x17'),auth[_0xc368('0x9')](),controller['destroy']);router[_0xc368('0x19')](_0xc368('0x13'),auth['isAuthenticated'](),controller[_0xc368('0x1a')]);router[_0xc368('0x19')](_0xc368('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc368('0x1b')]=router; \ No newline at end of file +var _0xe13f=['update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','Router','./mailQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','put'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0xe13f,0x147));var _0xfe13=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe13f[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0xfe13('0x0'));var util=require(_0xfe13('0x1'));var path=require(_0xfe13('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe13('0x3'));var router=express[_0xfe13('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfe13('0x5'));router[_0xfe13('0x6')]('/',auth['isAuthenticated'](),controller[_0xfe13('0x7')]);router[_0xfe13('0x6')](_0xfe13('0x8'),auth[_0xfe13('0x9')](),controller['describe']);router[_0xfe13('0x6')](_0xfe13('0xa'),auth[_0xfe13('0x9')](),controller[_0xfe13('0xb')]);router[_0xfe13('0x6')](_0xfe13('0xc'),auth[_0xfe13('0x9')](),controller[_0xfe13('0xd')]);router['get'](_0xfe13('0xe'),auth[_0xfe13('0x9')](),controller['getTeams']);router[_0xfe13('0x6')](_0xfe13('0xf'),auth[_0xfe13('0x9')](),controller['getAgents']);router[_0xfe13('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfe13('0x10')]('/:id/teams',auth[_0xfe13('0x9')](),controller['addTeams']);router['post'](_0xfe13('0xf'),auth[_0xfe13('0x9')](),controller['addAgents']);router[_0xfe13('0x11')](_0xfe13('0xa'),auth[_0xfe13('0x9')](),controller[_0xfe13('0x12')]);router[_0xfe13('0x13')](_0xfe13('0xa'),auth[_0xfe13('0x9')](),controller[_0xfe13('0x14')]);router['delete'](_0xfe13('0xe'),auth[_0xfe13('0x9')](),controller[_0xfe13('0x15')]);router[_0xfe13('0x13')](_0xfe13('0xf'),auth['isAuthenticated'](),controller[_0xfe13('0x16')]);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 292a670..0c63c38 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 _0x2cc1=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x30a91f,_0x4ea02e){var _0x2be1ef=function(_0x1374c1){while(--_0x1374c1){_0x30a91f['push'](_0x30a91f['shift']());}};_0x2be1ef(++_0x4ea02e);}(_0x2cc1,0xf4));var _0x12cc=function(_0x1132c7,_0x4a733d){_0x1132c7=_0x1132c7-0x0;var _0x56b032=_0x2cc1[_0x1132c7];return _0x56b032;};'use strict';var Sequelize=require(_0x12cc('0x0'));module[_0x12cc('0x1')]={'name':{'type':Sequelize[_0x12cc('0x2')],'unique':_0x12cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x12cc('0x2')]},'timeout':{'type':Sequelize[_0x12cc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x12cc('0x5'),_0x12cc('0x6'),_0x12cc('0x7'))}}; \ No newline at end of file +var _0x7373=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x28ee82,_0x5c252f){var _0x13cd70=function(_0x2b6762){while(--_0x2b6762){_0x28ee82['push'](_0x28ee82['shift']());}};_0x13cd70(++_0x5c252f);}(_0x7373,0x1db));var _0x3737=function(_0x5b6ea3,_0x2ce23e){_0x5b6ea3=_0x5b6ea3-0x0;var _0x5794bc=_0x7373[_0x5b6ea3];return _0x5794bc;};'use strict';var Sequelize=require(_0x3737('0x0'));module['exports']={'name':{'type':Sequelize[_0x3737('0x1')],'unique':_0x3737('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3737('0x1')]},'timeout':{'type':Sequelize[_0x3737('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3737('0x4')](_0x3737('0x5'),_0x3737('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a7f9b4b..02e8ecb 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 _0x49af=['transaction','findOrCreate','forEach','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','removeTeams','isEmpty','spread','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','sendStatus','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x49af,0x139));var _0xf49a=function(_0x425b09,_0x199b95){_0x425b09=_0x425b09-0x0;var _0x4654d2=_0x49af[_0x425b09];return _0x4654d2;};'use strict';var pdf=require(_0xf49a('0x0'));var emlformat=require(_0xf49a('0x1'));var rimraf=require(_0xf49a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf49a('0x3'));var rp=require('request-promise');var moment=require(_0xf49a('0x4'));var BPromise=require(_0xf49a('0x5'));var Mustache=require('mustache');var util=require(_0xf49a('0x6'));var path=require(_0xf49a('0x7'));var sox=require(_0xf49a('0x8'));var csv=require(_0xf49a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf49a('0xa'));var squel=require(_0xf49a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf49a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf49a('0xc'));var qs=require(_0xf49a('0xd'));var as=require(_0xf49a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf49a('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xf49a('0x10'));var db=require(_0xf49a('0x11'))['db'];config[_0xf49a('0x12')]=_[_0xf49a('0x13')](config[_0xf49a('0x12')],{'host':_0xf49a('0x14'),'port':0x18eb});var socket=require(_0xf49a('0x15'))(new Redis(config[_0xf49a('0x12')]));require(_0xf49a('0x16'))[_0xf49a('0x17')](socket);function respondWithStatusCode(_0xb69345,_0x9d1814){_0x9d1814=_0x9d1814||0xcc;return function(_0x5e46e6){if(_0x5e46e6){return _0xb69345['sendStatus'](_0x9d1814);}return _0xb69345['status'](_0x9d1814)[_0xf49a('0x18')]();};}function respondWithResult(_0x2f24df,_0x2d95a1){_0x2d95a1=_0x2d95a1||0xc8;return function(_0x4dacc0){if(_0x4dacc0){return _0x2f24df[_0xf49a('0x19')](_0x2d95a1)[_0xf49a('0x1a')](_0x4dacc0);}};}function respondWithFilteredResult(_0x32da1b,_0x39ea48){return function(_0x187bd2){if(_0x187bd2){var _0x47fddc=_0x187bd2['count'],_0x40606b=_0x39ea48[_0xf49a('0x1b')],_0x131430=_0x39ea48[_0xf49a('0x1b')]+_0x39ea48[_0xf49a('0x1c')],_0x51ee9f;if(_0x131430>=_0x47fddc){_0x131430=_0x47fddc;_0x51ee9f=0xc8;}else{_0x51ee9f=0xce;}_0x32da1b[_0xf49a('0x19')](_0x51ee9f);return _0x32da1b[_0xf49a('0x1d')](_0xf49a('0x1e'),_0x40606b+'-'+_0x131430+'/'+_0x47fddc)[_0xf49a('0x1a')](_0x187bd2);}return null;};}function patchUpdates(_0x4f07d8){return function(_0xee4be8){try{jsonpatch[_0xf49a('0x1f')](_0xee4be8,_0x4f07d8,!![]);}catch(_0x3753f4){return BPromise[_0xf49a('0x20')](_0x3753f4);}return _0xee4be8[_0xf49a('0x21')]();};}function saveUpdates(_0x1fad1b,_0x3495be){return function(_0x11131d){if(_0x11131d){return _0x11131d[_0xf49a('0x22')](_0x1fad1b)['then'](function(_0x1dbb14){return _0x1dbb14;});}return null;};}function removeEntity(_0x471a24,_0x5e77e5){return function(_0x47242a){if(_0x47242a){return _0x47242a[_0xf49a('0x23')]()[_0xf49a('0x24')](function(){var _0x562e33=_0x47242a[_0xf49a('0x25')]({'plain':!![]});var _0xcf0f4a=_0xf49a('0x26');return db['UserProfileResource'][_0xf49a('0x23')]({'where':{'type':_0xcf0f4a,'resourceId':_0x562e33['id']}})[_0xf49a('0x24')](function(){return _0x47242a;});})[_0xf49a('0x24')](function(){_0x471a24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5defec,_0x3588a6){return function(_0xd1dc59){if(!_0xd1dc59){_0x5defec[_0xf49a('0x27')](0x194);}return _0xd1dc59;};}function handleError(_0xdb1b3d,_0x51b110){_0x51b110=_0x51b110||0x1f4;return function(_0x508e4b){logger['error'](_0x508e4b[_0xf49a('0x28')]);if(_0x508e4b[_0xf49a('0x29')]){delete _0x508e4b[_0xf49a('0x29')];}_0xdb1b3d[_0xf49a('0x19')](_0x51b110)[_0xf49a('0x2a')](_0x508e4b);};}exports[_0xf49a('0x2b')]=function(_0x3cebe6,_0x394b59){var _0x13bb2b={},_0x575f78={},_0x440d87={'count':0x0,'rows':[]};var _0x418a8a=_[_0xf49a('0x2c')](db[_0xf49a('0x2d')][_0xf49a('0x2e')],function(_0x4e30b6){return{'name':_0x4e30b6[_0xf49a('0x2f')],'type':_0x4e30b6[_0xf49a('0x30')][_0xf49a('0x31')]};});_0x575f78[_0xf49a('0x32')]=_[_0xf49a('0x2c')](_0x418a8a,'name');_0x575f78['query']=_['keys'](_0x3cebe6[_0xf49a('0x33')]);_0x575f78[_0xf49a('0x34')]=_[_0xf49a('0x35')](_0x575f78[_0xf49a('0x32')],_0x575f78[_0xf49a('0x33')]);_0x13bb2b[_0xf49a('0x36')]=_['intersection'](_0x575f78[_0xf49a('0x32')],qs[_0xf49a('0x37')](_0x3cebe6['query']['fields']));_0x13bb2b[_0xf49a('0x36')]=_0x13bb2b[_0xf49a('0x36')][_0xf49a('0x38')]?_0x13bb2b[_0xf49a('0x36')]:_0x575f78['model'];if(!_0x3cebe6[_0xf49a('0x33')]['hasOwnProperty'](_0xf49a('0x39'))){_0x13bb2b['limit']=qs[_0xf49a('0x1c')](_0x3cebe6[_0xf49a('0x33')][_0xf49a('0x1c')]);_0x13bb2b['offset']=qs['offset'](_0x3cebe6['query']['offset']);}_0x13bb2b[_0xf49a('0x3a')]=qs[_0xf49a('0x3b')](_0x3cebe6['query'][_0xf49a('0x3b')]);_0x13bb2b[_0xf49a('0x3c')]=qs['filters'](_[_0xf49a('0x3d')](_0x3cebe6[_0xf49a('0x33')],_0x575f78[_0xf49a('0x34')]),_0x418a8a);if(_0x3cebe6['query'][_0xf49a('0x3e')]){_0x13bb2b[_0xf49a('0x3c')]=_[_0xf49a('0x3f')](_0x13bb2b[_0xf49a('0x3c')],{'$or':_['map'](_0x418a8a,function(_0x38ab9a){if(_0x38ab9a['type']!==_0xf49a('0x40')){var _0x2d34cf={};_0x2d34cf[_0x38ab9a[_0xf49a('0x29')]]={'$like':'%'+_0x3cebe6[_0xf49a('0x33')][_0xf49a('0x3e')]+'%'};return _0x2d34cf;}})});}_0x13bb2b=_[_0xf49a('0x3f')]({},_0x13bb2b,_0x3cebe6[_0xf49a('0x41')]);var _0x25a50c={'where':_0x13bb2b[_0xf49a('0x3c')]};return db[_0xf49a('0x2d')][_0xf49a('0x42')](_0x25a50c)[_0xf49a('0x24')](function(_0x457126){_0x440d87[_0xf49a('0x42')]=_0x457126;if(_0x3cebe6[_0xf49a('0x33')][_0xf49a('0x43')]){_0x13bb2b['include']=[{'all':!![]}];}return db['MailQueue'][_0xf49a('0x44')](_0x13bb2b);})['then'](function(_0x3b4028){_0x440d87[_0xf49a('0x45')]=_0x3b4028;return _0x440d87;})[_0xf49a('0x24')](respondWithFilteredResult(_0x394b59,_0x13bb2b))[_0xf49a('0x46')](handleError(_0x394b59,null));};exports[_0xf49a('0x47')]=function(_0x205144,_0x233e22){var _0x138350={'raw':!![],'where':{'id':_0x205144['params']['id']}},_0x157798={};_0x157798['model']=_['keys'](db['MailQueue'][_0xf49a('0x2e')]);_0x157798[_0xf49a('0x33')]=_[_0xf49a('0x48')](_0x205144[_0xf49a('0x33')]);_0x157798[_0xf49a('0x34')]=_[_0xf49a('0x35')](_0x157798[_0xf49a('0x32')],_0x157798['query']);_0x138350[_0xf49a('0x36')]=_[_0xf49a('0x35')](_0x157798[_0xf49a('0x32')],qs['fields'](_0x205144['query'][_0xf49a('0x37')]));_0x138350[_0xf49a('0x36')]=_0x138350[_0xf49a('0x36')][_0xf49a('0x38')]?_0x138350[_0xf49a('0x36')]:_0x157798[_0xf49a('0x32')];if(_0x205144[_0xf49a('0x33')][_0xf49a('0x43')]){_0x138350[_0xf49a('0x49')]=[{'all':!![]}];}_0x138350=_[_0xf49a('0x3f')]({},_0x138350,_0x205144[_0xf49a('0x41')]);return db[_0xf49a('0x2d')][_0xf49a('0x4a')](_0x138350)[_0xf49a('0x24')](handleEntityNotFound(_0x233e22,null))[_0xf49a('0x24')](respondWithResult(_0x233e22,null))['catch'](handleError(_0x233e22,null));};exports[_0xf49a('0x4b')]=function(_0x2b5806,_0x3aeeb1){return db[_0xf49a('0x2d')]['create'](_0x2b5806[_0xf49a('0x4c')],{})[_0xf49a('0x24')](function(_0x1ca3cf){var _0x15d30d=_0x2b5806[_0xf49a('0x4d')][_0xf49a('0x25')]({'plain':!![]});if(!_0x15d30d)throw new Error(_0xf49a('0x4e'));if(_0x15d30d['role']===_0xf49a('0x4d')){var _0x54c072=_0x1ca3cf[_0xf49a('0x25')]({'plain':!![]});var _0x31e068='MailQueues';return db['UserProfileSection'][_0xf49a('0x4a')]({'where':{'name':_0x31e068,'userProfileId':_0x15d30d[_0xf49a('0x4f')]},'raw':!![]})[_0xf49a('0x24')](function(_0x2d89fe){if(_0x2d89fe&&_0x2d89fe[_0xf49a('0x50')]===0x0){return db['UserProfileResource'][_0xf49a('0x4b')]({'name':_0x54c072[_0xf49a('0x29')],'resourceId':_0x54c072['id'],'type':_0x2d89fe[_0xf49a('0x29')],'sectionId':_0x2d89fe['id']},{})['then'](function(){return _0x1ca3cf;});}else{return _0x1ca3cf;}})[_0xf49a('0x46')](function(_0x40de82){logger['error'](_0xf49a('0x51'),_0x40de82);throw _0x40de82;});}return _0x1ca3cf;})['then'](respondWithResult(_0x3aeeb1,0xc9))[_0xf49a('0x46')](handleError(_0x3aeeb1,null));};exports['update']=function(_0x14ed55,_0xcf68f9){if(_0x14ed55[_0xf49a('0x4c')]['id']){delete _0x14ed55[_0xf49a('0x4c')]['id'];}return db[_0xf49a('0x2d')][_0xf49a('0x4a')]({'where':{'id':_0x14ed55[_0xf49a('0x52')]['id']}})[_0xf49a('0x24')](handleEntityNotFound(_0xcf68f9,null))['then'](saveUpdates(_0x14ed55[_0xf49a('0x4c')],null))[_0xf49a('0x24')](respondWithResult(_0xcf68f9,null))['catch'](handleError(_0xcf68f9,null));};exports[_0xf49a('0x23')]=function(_0x13e9b7,_0x4608a1){return db[_0xf49a('0x2d')][_0xf49a('0x4a')]({'where':{'id':_0x13e9b7[_0xf49a('0x52')]['id']}})[_0xf49a('0x24')](handleEntityNotFound(_0x4608a1,null))[_0xf49a('0x24')](removeEntity(_0x4608a1,null))[_0xf49a('0x46')](handleError(_0x4608a1,null));};exports[_0xf49a('0x53')]=function(_0x14f2f9,_0x1c5a27){return db[_0xf49a('0x2d')][_0xf49a('0x53')]()[_0xf49a('0x24')](respondWithResult(_0x1c5a27,null))['catch'](handleError(_0x1c5a27,null));};exports[_0xf49a('0x54')]=function(_0x45f1e5,_0x21f29e,_0x4124a3){var _0xaa9df7={'raw':!![],'where':{}},_0x19a8ae={},_0x5088d1;return db[_0xf49a('0x2d')][_0xf49a('0x55')]({'where':{'id':_0x45f1e5[_0xf49a('0x52')]['id']}})['then'](handleEntityNotFound(_0x21f29e,null))[_0xf49a('0x24')](function(_0x881c11){if(_0x881c11){_0x5088d1=_0x881c11[_0xf49a('0x25')]({'plain':!![]});_0x19a8ae[_0xf49a('0x32')]=_[_0xf49a('0x48')](db[_0xf49a('0x56')][_0xf49a('0x2e')]);_0x19a8ae[_0xf49a('0x33')]=_['keys'](_0x45f1e5[_0xf49a('0x33')]);_0x19a8ae[_0xf49a('0x34')]=_[_0xf49a('0x35')](_0x19a8ae[_0xf49a('0x32')],_0x19a8ae['query']);_0xaa9df7[_0xf49a('0x36')]=_[_0xf49a('0x35')](_0x19a8ae[_0xf49a('0x32')],qs['fields'](_0x45f1e5[_0xf49a('0x33')][_0xf49a('0x37')]));_0xaa9df7[_0xf49a('0x36')]=_0xaa9df7['attributes'][_0xf49a('0x38')]?_0xaa9df7[_0xf49a('0x36')]:_0x19a8ae[_0xf49a('0x32')];if(!_0x45f1e5[_0xf49a('0x33')][_0xf49a('0x57')]('nolimit')){_0xaa9df7[_0xf49a('0x1c')]=qs[_0xf49a('0x1c')](_0x45f1e5['query'][_0xf49a('0x1c')]);_0xaa9df7['offset']=qs['offset'](_0x45f1e5[_0xf49a('0x33')]['offset']);}_0xaa9df7[_0xf49a('0x3a')]=qs[_0xf49a('0x3b')](_0x45f1e5['query'][_0xf49a('0x3b')]);_0xaa9df7[_0xf49a('0x3c')]=qs[_0xf49a('0x34')](_[_0xf49a('0x3d')](_0x45f1e5[_0xf49a('0x33')],_0x19a8ae[_0xf49a('0x34')]));_0xaa9df7[_0xf49a('0x3c')][_0xf49a('0x58')]=_0x881c11['id'];if(_0x45f1e5[_0xf49a('0x33')][_0xf49a('0x3e')]){_0xaa9df7[_0xf49a('0x3c')]=_['merge'](_0xaa9df7['where'],{'$or':_['map'](_0xaa9df7['attributes'],function(_0x16eecb){var _0x31eb32={};_0x31eb32[_0x16eecb]={'$like':'%'+_0x45f1e5[_0xf49a('0x33')][_0xf49a('0x3e')]+'%'};return _0x31eb32;})});}_0xaa9df7=_[_0xf49a('0x3f')]({},_0xaa9df7,_0x45f1e5['options']);return db[_0xf49a('0x56')][_0xf49a('0x44')](_0xaa9df7);}})['then'](function(_0x3bb4e4){if(_0x3bb4e4){return db[_0xf49a('0x59')][_0xf49a('0x5a')]({'where':{'id':_[_0xf49a('0x2c')](_0x3bb4e4,_0xf49a('0x5b')),'role':'agent'},'attributes':['id',_0xf49a('0x29'),_0xf49a('0x5c'),_0xf49a('0x5d'),_0xf49a('0x5e')]});}})[_0xf49a('0x24')](function(_0x3c5936){if(_0x3c5936){return{'count':_0x3c5936[_0xf49a('0x42')],'rows':_[_0xf49a('0x2c')](_0x3c5936[_0xf49a('0x45')],function(_0x3fcd13){return{'membername':_0x3fcd13['name'],'UserId':_0x3fcd13['id'],'queue_name':_0x5088d1[_0xf49a('0x29')],'MailQueueId':_0x5088d1['id'],'interface':util[_0xf49a('0x5f')](_0xf49a('0x60'),_0xf49a('0x61'),_0x3fcd13[_0xf49a('0x29')]),'penalty':0x0,'paused':_0x3fcd13[_0xf49a('0x5c')],'createdAt':_0x3fcd13[_0xf49a('0x5e')],'updatedAt':_0x3fcd13['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x21f29e,_0xaa9df7))[_0xf49a('0x46')](handleError(_0x21f29e,null));};exports['getTeams']=function(_0x25321d,_0x6c70d2,_0x4f24e6){var _0x3d8d25={};var _0x4c5211={};var _0x5598b4;var _0x220279;return db[_0xf49a('0x2d')][_0xf49a('0x55')]({'where':{'id':_0x25321d[_0xf49a('0x52')]['id']}})[_0xf49a('0x24')](handleEntityNotFound(_0x6c70d2,null))[_0xf49a('0x24')](function(_0x15b09d){if(_0x15b09d){_0x5598b4=_0x15b09d;_0x4c5211['model']=_[_0xf49a('0x48')](db[_0xf49a('0x62')][_0xf49a('0x2e')]);_0x4c5211[_0xf49a('0x33')]=_[_0xf49a('0x48')](_0x25321d[_0xf49a('0x33')]);_0x4c5211[_0xf49a('0x34')]=_['intersection'](_0x4c5211['model'],_0x4c5211['query']);_0x3d8d25['attributes']=_[_0xf49a('0x35')](_0x4c5211[_0xf49a('0x32')],qs[_0xf49a('0x37')](_0x25321d['query'][_0xf49a('0x37')]));_0x3d8d25[_0xf49a('0x36')]=_0x3d8d25[_0xf49a('0x36')]['length']?_0x3d8d25[_0xf49a('0x36')]:_0x4c5211['model'];_0x3d8d25[_0xf49a('0x3a')]=qs[_0xf49a('0x3b')](_0x25321d[_0xf49a('0x33')][_0xf49a('0x3b')]);_0x3d8d25[_0xf49a('0x3c')]=qs['filters'](_[_0xf49a('0x3d')](_0x25321d[_0xf49a('0x33')],_0x4c5211[_0xf49a('0x34')]));if(_0x25321d[_0xf49a('0x33')][_0xf49a('0x3e')]){_0x3d8d25[_0xf49a('0x3c')]=_[_0xf49a('0x3f')](_0x3d8d25[_0xf49a('0x3c')],{'$or':_[_0xf49a('0x2c')](_0x3d8d25['attributes'],function(_0x49bf5b){var _0x50b9e0={};_0x50b9e0[_0x49bf5b]={'$like':'%'+_0x25321d[_0xf49a('0x33')][_0xf49a('0x3e')]+'%'};return _0x50b9e0;})});}_0x3d8d25=_[_0xf49a('0x3f')]({},_0x3d8d25,_0x25321d[_0xf49a('0x41')]);return _0x5598b4[_0xf49a('0x63')](_0x3d8d25);}})['then'](function(_0x5ba03a){if(_0x5ba03a){_0x220279=_0x5ba03a[_0xf49a('0x38')];if(!_0x25321d['query'][_0xf49a('0x57')]('nolimit')){_0x3d8d25[_0xf49a('0x1c')]=qs[_0xf49a('0x1c')](_0x25321d[_0xf49a('0x33')][_0xf49a('0x1c')]);_0x3d8d25[_0xf49a('0x1b')]=qs[_0xf49a('0x1b')](_0x25321d['query'][_0xf49a('0x1b')]);}return _0x5598b4[_0xf49a('0x63')](_0x3d8d25);}})[_0xf49a('0x24')](function(_0x470552){if(_0x470552){return _0x470552?{'count':_0x220279,'rows':_0x470552}:null;}})[_0xf49a('0x24')](respondWithResult(_0x6c70d2,null))[_0xf49a('0x46')](handleError(_0x6c70d2,null));};exports[_0xf49a('0x64')]=function(_0x1f7470,_0x569ae0,_0x192135){var _0x42f88f=_0x1f7470['body'][_0xf49a('0x65')];return db['Team'][_0xf49a('0x44')]({'where':{'id':_0x42f88f},'attributes':['id'],'include':[{'model':db[_0xf49a('0x59')],'as':'Agents','attributes':['id',_0xf49a('0x29'),_0xf49a('0x66'),_0xf49a('0x67'),_0xf49a('0x68')],'raw':!![]}]})[_0xf49a('0x24')](function(_0x1b8160){if(_0x1b8160){var _0x53b096=_[_0xf49a('0x69')](_0x1b8160,function(_0x5c7323){var _0xf05e52=_0x5c7323[_0xf49a('0x25')]({'plain':!![]});return _0xf05e52[_0xf49a('0x6a')];});return db[_0xf49a('0x2d')][_0xf49a('0x4a')]({'where':{'id':_0x1f7470[_0xf49a('0x52')]['id']}})['then'](function(_0x32cc97){return db['sequelize'][_0xf49a('0x6b')](function(_0x5a5c96){return _0x32cc97[_0xf49a('0x64')](_0x42f88f,{'transaction':_0x5a5c96})[_0xf49a('0x24')](function(){return BPromise['each'](_0x53b096,function(_0x52d14c){return db['UserMailQueue'][_0xf49a('0x6c')]({'where':{'UserId':_0x52d14c['id'],'MailQueueId':_0x1f7470['params']['id']},'transaction':_0x5a5c96});});})[_0xf49a('0x24')](function(){_0x53b096[_0xf49a('0x6d')](function(_0x5140fd){socket['emit'](_0xf49a('0x6e'),{'UserId':_0x5140fd['id'],'MailQueueId':_0x32cc97['id']});});});});});}})[_0xf49a('0x24')](respondWithStatusCode(_0x569ae0,null))[_0xf49a('0x46')](handleError(_0x569ae0,null));};exports['removeTeams']=function(_0x26a6f2,_0x3b3973,_0x22e9f5){return db[_0xf49a('0x62')][_0xf49a('0x44')]({'where':{'id':_0x26a6f2['query'][_0xf49a('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf49a('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf49a('0x24')](handleEntityNotFound(_0x3b3973,null))[_0xf49a('0x24')](function(_0x586953){var _0x351fca=_[_0xf49a('0x2c')](_0x586953,'id');var _0x429845=[];var _0x1dd52b=[];var _0x23a0bb=squel['select']();_0x23a0bb[_0xf49a('0x6f')](_0xf49a('0x70'))[_0xf49a('0x71')](_0xf49a('0x72'),'tq')[_0xf49a('0x73')](_0xf49a('0x74'),'ut',_0xf49a('0x75'))[_0xf49a('0x3c')](_0xf49a('0x76'),_0x26a6f2[_0xf49a('0x52')]['id']);for(var _0x80ab89=0x0;_0x80ab89<_0x586953[_0xf49a('0x38')];_0x80ab89+=0x1){let _0x28017b=_0x586953[_0x80ab89];for(var _0x28e25b=0x0;_0x28e25b<_0x28017b['Agents'][_0xf49a('0x38')];_0x28e25b+=0x1){let _0x2d6b77=_0x28017b[_0xf49a('0x6a')][_0x28e25b];var _0x5b82e6=_0x23a0bb[_0xf49a('0x77')]();_0x5b82e6[_0xf49a('0x3c')]('ut.UserId\x20=\x20?',_0x2d6b77['id']);_0x1dd52b[_0xf49a('0x78')](db['sequelize'][_0xf49a('0x33')](_0x5b82e6[_0xf49a('0x79')](),{'type':db['sequelize'][_0xf49a('0x7a')][_0xf49a('0x7b')]})['then'](function(_0x40b61e){if(_0x40b61e[_0xf49a('0x38')]===0x1){return _0x2d6b77['id'];}else{var _0x1a7438=_[_0xf49a('0x7c')](_[_0xf49a('0x2c')](_0x40b61e,_0xf49a('0x7d')),function(_0x58317c){return _[_0xf49a('0x7e')](_0x351fca,_0x58317c);});if(_0x1a7438){return _0x2d6b77['id'];}}}));}}return BPromise[_0xf49a('0x7f')](_0x1dd52b)[_0xf49a('0x24')](function(_0x1cd115){_0x429845=_(_0x429845)[_0xf49a('0x80')](_0x1cd115)[_0xf49a('0x81')]()[_0xf49a('0x82')]();return db['MailQueue']['find']({'where':{'id':_0x26a6f2[_0xf49a('0x52')]['id']}})['then'](function(_0x4983f3){return db[_0xf49a('0x83')]['transaction'](function(_0x5abb0b){return _0x4983f3[_0xf49a('0x84')](_0x26a6f2[_0xf49a('0x33')]['ids'],{'transaction':_0x5abb0b})[_0xf49a('0x24')](function(){if(!_[_0xf49a('0x85')](_0x429845)){return _0x4983f3['removeAgents'](_0x429845,{'transaction':_0x5abb0b});}})[_0xf49a('0x24')](function(){_0x429845[_0xf49a('0x6d')](function(_0x5ea372){socket['emit']('userMailQueue:remove',{'UserId':_0x5ea372,'MailQueueId':_0x4983f3['id']});});});});});});})[_0xf49a('0x24')](respondWithStatusCode(_0x3b3973,null))[_0xf49a('0x46')](handleError(_0x3b3973,null));};exports['addAgents']=function(_0x298618,_0x1fde58,_0x23af6c){return db[_0xf49a('0x2d')][_0xf49a('0x4a')]({'where':{'id':_0x298618[_0xf49a('0x52')]['id']}})[_0xf49a('0x24')](handleEntityNotFound(_0x1fde58,null))[_0xf49a('0x24')](function(_0x27d478){if(_0x27d478){return _0x27d478['addAgents'](_0x298618[_0xf49a('0x4c')]['ids'],_['omit'](_0x298618['body'],['ids','id'])||{})[_0xf49a('0x86')](function(_0xfe4116){for(var _0x243eec=0x0;_0x243eec<_0x298618[_0xf49a('0x4c')][_0xf49a('0x65')]['length'];_0x243eec+=0x1){socket[_0xf49a('0x87')](_0xf49a('0x6e'),{'UserId':_0x298618[_0xf49a('0x4c')][_0xf49a('0x65')][_0x243eec],'MailQueueId':_0x298618[_0xf49a('0x52')]['id']});}return _0xfe4116;});}})[_0xf49a('0x24')](respondWithResult(_0x1fde58,null))[_0xf49a('0x46')](handleError(_0x1fde58,null));};exports[_0xf49a('0x88')]=function(_0x2502d9,_0x64d7d4,_0x296ff7){return db[_0xf49a('0x2d')][_0xf49a('0x4a')]({'where':{'id':_0x2502d9[_0xf49a('0x52')]['id']}})[_0xf49a('0x24')](handleEntityNotFound(_0x64d7d4,null))[_0xf49a('0x24')](function(_0x2bc7e5){if(_0x2bc7e5){return _0x2bc7e5[_0xf49a('0x88')](_0x2502d9['query'][_0xf49a('0x65')])['then'](function(){if(_[_0xf49a('0x89')](_0x2502d9['query']['ids'])){for(var _0x16f020=0x0;_0x16f020<_0x2502d9[_0xf49a('0x33')][_0xf49a('0x65')][_0xf49a('0x38')];_0x16f020+=0x1){socket[_0xf49a('0x87')](_0xf49a('0x8a'),{'UserId':Number(_0x2502d9[_0xf49a('0x33')][_0xf49a('0x65')][_0x16f020]),'MailQueueId':Number(_0x2502d9[_0xf49a('0x52')]['id'])});}}else{socket[_0xf49a('0x87')](_0xf49a('0x8a'),{'UserId':Number(_0x2502d9['query']['ids']),'MailQueueId':Number(_0x2502d9['params']['id'])});}});}})[_0xf49a('0x24')](respondWithStatusCode(_0x64d7d4,null))[_0xf49a('0x46')](handleError(_0x64d7d4,null));};exports[_0xf49a('0x8b')]=function(_0x32a692,_0x39d51c,_0x1b5b2f){var _0x19b7f9={};var _0x5552f5={};var _0x48bfd4;var _0x153d09;return db['MailQueue'][_0xf49a('0x55')]({'where':{'id':_0x32a692['params']['id']}})[_0xf49a('0x24')](handleEntityNotFound(_0x39d51c,null))[_0xf49a('0x24')](function(_0x49cbd9){if(_0x49cbd9){_0x48bfd4=_0x49cbd9;_0x5552f5[_0xf49a('0x32')]=_['keys'](db[_0xf49a('0x59')]['rawAttributes']);_0x5552f5[_0xf49a('0x33')]=_[_0xf49a('0x48')](_0x32a692['query']);_0x5552f5[_0xf49a('0x34')]=_[_0xf49a('0x35')](_0x5552f5['model'],_0x5552f5['query']);_0x19b7f9[_0xf49a('0x36')]=_['intersection'](_0x5552f5[_0xf49a('0x32')],qs[_0xf49a('0x37')](_0x32a692['query'][_0xf49a('0x37')]));_0x19b7f9[_0xf49a('0x36')]=_0x19b7f9['attributes'][_0xf49a('0x38')]?_0x19b7f9[_0xf49a('0x36')]:_0x5552f5[_0xf49a('0x32')];_0x19b7f9[_0xf49a('0x3a')]=qs[_0xf49a('0x3b')](_0x32a692[_0xf49a('0x33')][_0xf49a('0x3b')]);_0x19b7f9[_0xf49a('0x3c')]=qs[_0xf49a('0x34')](_[_0xf49a('0x3d')](_0x32a692[_0xf49a('0x33')],_0x5552f5['filters']));if(_0x32a692[_0xf49a('0x33')]['filter']){_0x19b7f9[_0xf49a('0x3c')]=_[_0xf49a('0x3f')](_0x19b7f9['where'],{'$or':_[_0xf49a('0x2c')](_0x19b7f9[_0xf49a('0x36')],function(_0x770b88){var _0x2cf31b={};_0x2cf31b[_0x770b88]={'$like':'%'+_0x32a692[_0xf49a('0x33')][_0xf49a('0x3e')]+'%'};return _0x2cf31b;})});}_0x19b7f9=_[_0xf49a('0x3f')]({},_0x19b7f9,_0x32a692['options']);return _0x48bfd4['getAgents'](_0x19b7f9);}})[_0xf49a('0x24')](function(_0x3ba7bf){if(_0x3ba7bf){_0x153d09=_0x3ba7bf[_0xf49a('0x38')];if(!_0x32a692[_0xf49a('0x33')]['hasOwnProperty'](_0xf49a('0x39'))){_0x19b7f9['limit']=qs[_0xf49a('0x1c')](_0x32a692[_0xf49a('0x33')][_0xf49a('0x1c')]);_0x19b7f9[_0xf49a('0x1b')]=qs[_0xf49a('0x1b')](_0x32a692[_0xf49a('0x33')][_0xf49a('0x1b')]);}return _0x48bfd4[_0xf49a('0x8b')](_0x19b7f9);}})[_0xf49a('0x24')](function(_0x306dc1){if(_0x306dc1){return _0x306dc1?{'count':_0x153d09,'rows':_0x306dc1}:null;}})[_0xf49a('0x24')](respondWithResult(_0x39d51c,null))[_0xf49a('0x46')](handleError(_0x39d51c,null));}; \ No newline at end of file +var _0xbc53=['limit','set','apply','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','sequelize','toString','every','TeamId','all','union','value','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset'];(function(_0x5c0d01,_0x1aeb42){var _0x3f01c9=function(_0x2a5b31){while(--_0x2a5b31){_0x5c0d01['push'](_0x5c0d01['shift']());}};_0x3f01c9(++_0x1aeb42);}(_0xbc53,0x1f4));var _0x3bc5=function(_0x17a249,_0x4f941c){_0x17a249=_0x17a249-0x0;var _0x19e05f=_0xbc53[_0x17a249];return _0x19e05f;};'use strict';var pdf=require(_0x3bc5('0x0'));var emlformat=require(_0x3bc5('0x1'));var rimraf=require(_0x3bc5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bc5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3bc5('0x4'));var Mustache=require('mustache');var util=require(_0x3bc5('0x5'));var path=require('path');var sox=require(_0x3bc5('0x6'));var csv=require(_0x3bc5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3bc5('0x8'));var squel=require(_0x3bc5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3bc5('0xa'));var toCsv=require(_0x3bc5('0x7'));var querystring=require(_0x3bc5('0xb'));var Papa=require(_0x3bc5('0xc'));var Redis=require(_0x3bc5('0xd'));var authService=require(_0x3bc5('0xe'));var qs=require(_0x3bc5('0xf'));var as=require(_0x3bc5('0x10'));var hardwareService=require(_0x3bc5('0x11'));var logger=require('../../config/logger')(_0x3bc5('0x12'));var utils=require(_0x3bc5('0x13'));var config=require(_0x3bc5('0x14'));var db=require(_0x3bc5('0x15'))['db'];config[_0x3bc5('0x16')]=_[_0x3bc5('0x17')](config[_0x3bc5('0x16')],{'host':_0x3bc5('0x18'),'port':0x18eb});var socket=require(_0x3bc5('0x19'))(new Redis(config[_0x3bc5('0x16')]));require(_0x3bc5('0x1a'))[_0x3bc5('0x1b')](socket);function respondWithStatusCode(_0x19d984,_0x3a21ff){_0x3a21ff=_0x3a21ff||0xcc;return function(_0x524e57){if(_0x524e57){return _0x19d984[_0x3bc5('0x1c')](_0x3a21ff);}return _0x19d984['status'](_0x3a21ff)['end']();};}function respondWithResult(_0x135a6c,_0x54c1f6){_0x54c1f6=_0x54c1f6||0xc8;return function(_0x39a60b){if(_0x39a60b){return _0x135a6c[_0x3bc5('0x1d')](_0x54c1f6)[_0x3bc5('0x1e')](_0x39a60b);}};}function respondWithFilteredResult(_0x3ee77d,_0x5475ea){return function(_0x19c4ad){if(_0x19c4ad){var _0x37d4be=_0x19c4ad['count'],_0x52f566=_0x5475ea[_0x3bc5('0x1f')],_0xce3bf6=_0x5475ea[_0x3bc5('0x1f')]+_0x5475ea[_0x3bc5('0x20')],_0x33f59d;if(_0xce3bf6>=_0x37d4be){_0xce3bf6=_0x37d4be;_0x33f59d=0xc8;}else{_0x33f59d=0xce;}_0x3ee77d[_0x3bc5('0x1d')](_0x33f59d);return _0x3ee77d[_0x3bc5('0x21')]('Content-Range',_0x52f566+'-'+_0xce3bf6+'/'+_0x37d4be)[_0x3bc5('0x1e')](_0x19c4ad);}return null;};}function patchUpdates(_0x9f84e1){return function(_0x543507){try{jsonpatch[_0x3bc5('0x22')](_0x543507,_0x9f84e1,!![]);}catch(_0x3ca16f){return BPromise['reject'](_0x3ca16f);}return _0x543507['save']();};}function saveUpdates(_0x175f2a,_0x2d8540){return function(_0x1747d5){if(_0x1747d5){return _0x1747d5['update'](_0x175f2a)[_0x3bc5('0x23')](function(_0x1db0e6){return _0x1db0e6;});}return null;};}function removeEntity(_0x228f1c,_0x358ee3){return function(_0x20c489){if(_0x20c489){return _0x20c489[_0x3bc5('0x24')]()[_0x3bc5('0x23')](function(){var _0x12513d=_0x20c489[_0x3bc5('0x25')]({'plain':!![]});var _0xa2762c=_0x3bc5('0x26');return db[_0x3bc5('0x27')][_0x3bc5('0x24')]({'where':{'type':_0xa2762c,'resourceId':_0x12513d['id']}})[_0x3bc5('0x23')](function(){return _0x20c489;});})['then'](function(){_0x228f1c[_0x3bc5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e10d,_0x55ec56){return function(_0x9558df){if(!_0x9558df){_0x49e10d[_0x3bc5('0x1c')](0x194);}return _0x9558df;};}function handleError(_0x2b31e,_0x5d6821){_0x5d6821=_0x5d6821||0x1f4;return function(_0x59db50){logger[_0x3bc5('0x28')](_0x59db50[_0x3bc5('0x29')]);if(_0x59db50[_0x3bc5('0x2a')]){delete _0x59db50[_0x3bc5('0x2a')];}_0x2b31e['status'](_0x5d6821)[_0x3bc5('0x2b')](_0x59db50);};}exports[_0x3bc5('0x2c')]=function(_0xa2546e,_0x2c923a){var _0x23b623={},_0x4fe16e={},_0x4db375={'count':0x0,'rows':[]};var _0x5516c8=_[_0x3bc5('0x2d')](db[_0x3bc5('0x2e')][_0x3bc5('0x2f')],function(_0x1fef36){return{'name':_0x1fef36[_0x3bc5('0x30')],'type':_0x1fef36[_0x3bc5('0x31')]['key']};});_0x4fe16e['model']=_[_0x3bc5('0x2d')](_0x5516c8,_0x3bc5('0x2a'));_0x4fe16e[_0x3bc5('0x32')]=_['keys'](_0xa2546e[_0x3bc5('0x32')]);_0x4fe16e[_0x3bc5('0x33')]=_[_0x3bc5('0x34')](_0x4fe16e[_0x3bc5('0x35')],_0x4fe16e[_0x3bc5('0x32')]);_0x23b623[_0x3bc5('0x36')]=_['intersection'](_0x4fe16e[_0x3bc5('0x35')],qs[_0x3bc5('0x37')](_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x37')]));_0x23b623[_0x3bc5('0x36')]=_0x23b623[_0x3bc5('0x36')][_0x3bc5('0x38')]?_0x23b623[_0x3bc5('0x36')]:_0x4fe16e[_0x3bc5('0x35')];if(!_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x39')]('nolimit')){_0x23b623[_0x3bc5('0x20')]=qs[_0x3bc5('0x20')](_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x20')]);_0x23b623['offset']=qs[_0x3bc5('0x1f')](_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x1f')]);}_0x23b623[_0x3bc5('0x3a')]=qs[_0x3bc5('0x3b')](_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x3b')]);_0x23b623[_0x3bc5('0x3c')]=qs['filters'](_[_0x3bc5('0x3d')](_0xa2546e['query'],_0x4fe16e[_0x3bc5('0x33')]),_0x5516c8);if(_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x3e')]){_0x23b623[_0x3bc5('0x3c')]=_[_0x3bc5('0x3f')](_0x23b623[_0x3bc5('0x3c')],{'$or':_[_0x3bc5('0x2d')](_0x5516c8,function(_0x70b468){if(_0x70b468[_0x3bc5('0x31')]!=='VIRTUAL'){var _0x3ff2fe={};_0x3ff2fe[_0x70b468[_0x3bc5('0x2a')]]={'$like':'%'+_0xa2546e[_0x3bc5('0x32')][_0x3bc5('0x3e')]+'%'};return _0x3ff2fe;}})});}_0x23b623=_[_0x3bc5('0x3f')]({},_0x23b623,_0xa2546e[_0x3bc5('0x40')]);var _0x50607a={'where':_0x23b623[_0x3bc5('0x3c')]};return db[_0x3bc5('0x2e')][_0x3bc5('0x41')](_0x50607a)['then'](function(_0x10a123){_0x4db375[_0x3bc5('0x41')]=_0x10a123;if(_0xa2546e['query'][_0x3bc5('0x42')]){_0x23b623[_0x3bc5('0x43')]=[{'all':!![]}];}return db[_0x3bc5('0x2e')][_0x3bc5('0x44')](_0x23b623);})['then'](function(_0x5c8193){_0x4db375[_0x3bc5('0x45')]=_0x5c8193;return _0x4db375;})[_0x3bc5('0x23')](respondWithFilteredResult(_0x2c923a,_0x23b623))[_0x3bc5('0x46')](handleError(_0x2c923a,null));};exports[_0x3bc5('0x47')]=function(_0x139079,_0x28ba6b){var _0x46e690={'raw':!![],'where':{'id':_0x139079['params']['id']}},_0x14f0af={};_0x14f0af['model']=_[_0x3bc5('0x48')](db['MailQueue'][_0x3bc5('0x2f')]);_0x14f0af[_0x3bc5('0x32')]=_[_0x3bc5('0x48')](_0x139079[_0x3bc5('0x32')]);_0x14f0af[_0x3bc5('0x33')]=_[_0x3bc5('0x34')](_0x14f0af[_0x3bc5('0x35')],_0x14f0af[_0x3bc5('0x32')]);_0x46e690[_0x3bc5('0x36')]=_[_0x3bc5('0x34')](_0x14f0af[_0x3bc5('0x35')],qs[_0x3bc5('0x37')](_0x139079[_0x3bc5('0x32')]['fields']));_0x46e690[_0x3bc5('0x36')]=_0x46e690[_0x3bc5('0x36')][_0x3bc5('0x38')]?_0x46e690[_0x3bc5('0x36')]:_0x14f0af['model'];if(_0x139079[_0x3bc5('0x32')][_0x3bc5('0x42')]){_0x46e690[_0x3bc5('0x43')]=[{'all':!![]}];}_0x46e690=_[_0x3bc5('0x3f')]({},_0x46e690,_0x139079[_0x3bc5('0x40')]);return db[_0x3bc5('0x2e')][_0x3bc5('0x49')](_0x46e690)[_0x3bc5('0x23')](handleEntityNotFound(_0x28ba6b,null))['then'](respondWithResult(_0x28ba6b,null))[_0x3bc5('0x46')](handleError(_0x28ba6b,null));};exports[_0x3bc5('0x4a')]=function(_0x58d488,_0x3b9ce7){return db[_0x3bc5('0x2e')][_0x3bc5('0x4a')](_0x58d488[_0x3bc5('0x4b')],{})[_0x3bc5('0x23')](function(_0x1fdb86){var _0x22e676=_0x58d488[_0x3bc5('0x4c')]['get']({'plain':!![]});if(!_0x22e676)throw new Error(_0x3bc5('0x4d'));if(_0x22e676['role']===_0x3bc5('0x4c')){var _0x436622=_0x1fdb86[_0x3bc5('0x25')]({'plain':!![]});var _0x43db18=_0x3bc5('0x26');return db['UserProfileSection'][_0x3bc5('0x49')]({'where':{'name':_0x43db18,'userProfileId':_0x22e676['userProfileId']},'raw':!![]})[_0x3bc5('0x23')](function(_0x40feee){if(_0x40feee&&_0x40feee[_0x3bc5('0x4e')]===0x0){return db['UserProfileResource'][_0x3bc5('0x4a')]({'name':_0x436622[_0x3bc5('0x2a')],'resourceId':_0x436622['id'],'type':_0x40feee[_0x3bc5('0x2a')],'sectionId':_0x40feee['id']},{})[_0x3bc5('0x23')](function(){return _0x1fdb86;});}else{return _0x1fdb86;}})[_0x3bc5('0x46')](function(_0x2e9bb6){logger['error'](_0x3bc5('0x4f'),_0x2e9bb6);throw _0x2e9bb6;});}return _0x1fdb86;})[_0x3bc5('0x23')](respondWithResult(_0x3b9ce7,0xc9))[_0x3bc5('0x46')](handleError(_0x3b9ce7,null));};exports[_0x3bc5('0x50')]=function(_0xa5cc6f,_0x18058e){if(_0xa5cc6f[_0x3bc5('0x4b')]['id']){delete _0xa5cc6f[_0x3bc5('0x4b')]['id'];}return db[_0x3bc5('0x2e')]['find']({'where':{'id':_0xa5cc6f[_0x3bc5('0x51')]['id']}})[_0x3bc5('0x23')](handleEntityNotFound(_0x18058e,null))[_0x3bc5('0x23')](saveUpdates(_0xa5cc6f['body'],null))[_0x3bc5('0x23')](respondWithResult(_0x18058e,null))[_0x3bc5('0x46')](handleError(_0x18058e,null));};exports['destroy']=function(_0x1546e3,_0x34f070){return db[_0x3bc5('0x2e')][_0x3bc5('0x49')]({'where':{'id':_0x1546e3['params']['id']}})['then'](handleEntityNotFound(_0x34f070,null))['then'](removeEntity(_0x34f070,null))['catch'](handleError(_0x34f070,null));};exports[_0x3bc5('0x52')]=function(_0x3bd245,_0x320011){return db[_0x3bc5('0x2e')][_0x3bc5('0x52')]()['then'](respondWithResult(_0x320011,null))['catch'](handleError(_0x320011,null));};exports[_0x3bc5('0x53')]=function(_0x4464c6,_0x5236ae,_0x36ef46){var _0x288cd2={'raw':!![],'where':{}},_0x3fc700={},_0x1fd5ab;return db[_0x3bc5('0x2e')][_0x3bc5('0x54')]({'where':{'id':_0x4464c6[_0x3bc5('0x51')]['id']}})[_0x3bc5('0x23')](handleEntityNotFound(_0x5236ae,null))[_0x3bc5('0x23')](function(_0x569085){if(_0x569085){_0x1fd5ab=_0x569085[_0x3bc5('0x25')]({'plain':!![]});_0x3fc700[_0x3bc5('0x35')]=_['keys'](db[_0x3bc5('0x55')][_0x3bc5('0x2f')]);_0x3fc700[_0x3bc5('0x32')]=_[_0x3bc5('0x48')](_0x4464c6[_0x3bc5('0x32')]);_0x3fc700[_0x3bc5('0x33')]=_[_0x3bc5('0x34')](_0x3fc700[_0x3bc5('0x35')],_0x3fc700['query']);_0x288cd2[_0x3bc5('0x36')]=_[_0x3bc5('0x34')](_0x3fc700[_0x3bc5('0x35')],qs['fields'](_0x4464c6[_0x3bc5('0x32')][_0x3bc5('0x37')]));_0x288cd2[_0x3bc5('0x36')]=_0x288cd2[_0x3bc5('0x36')][_0x3bc5('0x38')]?_0x288cd2[_0x3bc5('0x36')]:_0x3fc700['model'];if(!_0x4464c6[_0x3bc5('0x32')][_0x3bc5('0x39')](_0x3bc5('0x56'))){_0x288cd2[_0x3bc5('0x20')]=qs[_0x3bc5('0x20')](_0x4464c6[_0x3bc5('0x32')][_0x3bc5('0x20')]);_0x288cd2[_0x3bc5('0x1f')]=qs['offset'](_0x4464c6['query'][_0x3bc5('0x1f')]);}_0x288cd2[_0x3bc5('0x3a')]=qs['sort'](_0x4464c6[_0x3bc5('0x32')][_0x3bc5('0x3b')]);_0x288cd2[_0x3bc5('0x3c')]=qs[_0x3bc5('0x33')](_['pick'](_0x4464c6[_0x3bc5('0x32')],_0x3fc700[_0x3bc5('0x33')]));_0x288cd2[_0x3bc5('0x3c')][_0x3bc5('0x57')]=_0x569085['id'];if(_0x4464c6[_0x3bc5('0x32')][_0x3bc5('0x3e')]){_0x288cd2[_0x3bc5('0x3c')]=_[_0x3bc5('0x3f')](_0x288cd2['where'],{'$or':_['map'](_0x288cd2[_0x3bc5('0x36')],function(_0x3501cf){var _0x4f0a84={};_0x4f0a84[_0x3501cf]={'$like':'%'+_0x4464c6[_0x3bc5('0x32')][_0x3bc5('0x3e')]+'%'};return _0x4f0a84;})});}_0x288cd2=_[_0x3bc5('0x3f')]({},_0x288cd2,_0x4464c6['options']);return db[_0x3bc5('0x55')][_0x3bc5('0x44')](_0x288cd2);}})[_0x3bc5('0x23')](function(_0x30b4fb){if(_0x30b4fb){return db[_0x3bc5('0x58')][_0x3bc5('0x59')]({'where':{'id':_[_0x3bc5('0x2d')](_0x30b4fb,'UserId'),'role':_0x3bc5('0x5a')},'attributes':['id',_0x3bc5('0x2a'),_0x3bc5('0x5b'),_0x3bc5('0x5c'),_0x3bc5('0x5d')]});}})[_0x3bc5('0x23')](function(_0x145076){if(_0x145076){return{'count':_0x145076[_0x3bc5('0x41')],'rows':_['map'](_0x145076[_0x3bc5('0x45')],function(_0x293502){return{'membername':_0x293502[_0x3bc5('0x2a')],'UserId':_0x293502['id'],'queue_name':_0x1fd5ab[_0x3bc5('0x2a')],'MailQueueId':_0x1fd5ab['id'],'interface':util[_0x3bc5('0x5e')](_0x3bc5('0x5f'),'SIP',_0x293502['name']),'penalty':0x0,'paused':_0x293502[_0x3bc5('0x5b')],'createdAt':_0x293502['createdAt'],'updatedAt':_0x293502[_0x3bc5('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3bc5('0x23')](respondWithFilteredResult(_0x5236ae,_0x288cd2))['catch'](handleError(_0x5236ae,null));};exports['getTeams']=function(_0x3bb78c,_0x1ac13e,_0x309111){var _0x537a81={};var _0x213750={};var _0x21fd5d;var _0x590380;return db['MailQueue']['findOne']({'where':{'id':_0x3bb78c[_0x3bc5('0x51')]['id']}})[_0x3bc5('0x23')](handleEntityNotFound(_0x1ac13e,null))[_0x3bc5('0x23')](function(_0x16045d){if(_0x16045d){_0x21fd5d=_0x16045d;_0x213750[_0x3bc5('0x35')]=_[_0x3bc5('0x48')](db[_0x3bc5('0x60')][_0x3bc5('0x2f')]);_0x213750['query']=_[_0x3bc5('0x48')](_0x3bb78c[_0x3bc5('0x32')]);_0x213750[_0x3bc5('0x33')]=_['intersection'](_0x213750[_0x3bc5('0x35')],_0x213750[_0x3bc5('0x32')]);_0x537a81[_0x3bc5('0x36')]=_[_0x3bc5('0x34')](_0x213750[_0x3bc5('0x35')],qs['fields'](_0x3bb78c[_0x3bc5('0x32')][_0x3bc5('0x37')]));_0x537a81[_0x3bc5('0x36')]=_0x537a81[_0x3bc5('0x36')][_0x3bc5('0x38')]?_0x537a81[_0x3bc5('0x36')]:_0x213750['model'];_0x537a81['order']=qs[_0x3bc5('0x3b')](_0x3bb78c[_0x3bc5('0x32')]['sort']);_0x537a81[_0x3bc5('0x3c')]=qs[_0x3bc5('0x33')](_['pick'](_0x3bb78c[_0x3bc5('0x32')],_0x213750[_0x3bc5('0x33')]));if(_0x3bb78c[_0x3bc5('0x32')][_0x3bc5('0x3e')]){_0x537a81['where']=_[_0x3bc5('0x3f')](_0x537a81[_0x3bc5('0x3c')],{'$or':_[_0x3bc5('0x2d')](_0x537a81[_0x3bc5('0x36')],function(_0x30c93e){var _0x165b62={};_0x165b62[_0x30c93e]={'$like':'%'+_0x3bb78c[_0x3bc5('0x32')][_0x3bc5('0x3e')]+'%'};return _0x165b62;})});}_0x537a81=_[_0x3bc5('0x3f')]({},_0x537a81,_0x3bb78c[_0x3bc5('0x40')]);return _0x21fd5d[_0x3bc5('0x61')](_0x537a81);}})[_0x3bc5('0x23')](function(_0x4091d8){if(_0x4091d8){_0x590380=_0x4091d8[_0x3bc5('0x38')];if(!_0x3bb78c[_0x3bc5('0x32')][_0x3bc5('0x39')](_0x3bc5('0x56'))){_0x537a81['limit']=qs['limit'](_0x3bb78c[_0x3bc5('0x32')][_0x3bc5('0x20')]);_0x537a81[_0x3bc5('0x1f')]=qs['offset'](_0x3bb78c[_0x3bc5('0x32')]['offset']);}return _0x21fd5d[_0x3bc5('0x61')](_0x537a81);}})['then'](function(_0x5d6052){if(_0x5d6052){return _0x5d6052?{'count':_0x590380,'rows':_0x5d6052}:null;}})['then'](respondWithResult(_0x1ac13e,null))['catch'](handleError(_0x1ac13e,null));};exports[_0x3bc5('0x62')]=function(_0x1772ba,_0x3f2f3a,_0x1424e9){var _0xcaddad=_0x1772ba['body'][_0x3bc5('0x63')];return db[_0x3bc5('0x60')][_0x3bc5('0x44')]({'where':{'id':_0xcaddad},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3bc5('0x64'),'attributes':['id',_0x3bc5('0x2a'),_0x3bc5('0x65'),_0x3bc5('0x66'),_0x3bc5('0x67')],'raw':!![]}]})[_0x3bc5('0x23')](function(_0x5c1a9d){if(_0x5c1a9d){var _0x43e441=_[_0x3bc5('0x68')](_0x5c1a9d,function(_0x2a77d6){var _0x1cb912=_0x2a77d6['get']({'plain':!![]});return _0x1cb912[_0x3bc5('0x64')];});return db[_0x3bc5('0x2e')][_0x3bc5('0x49')]({'where':{'id':_0x1772ba[_0x3bc5('0x51')]['id']}})['then'](function(_0x1d771b){return db['sequelize'][_0x3bc5('0x69')](function(_0x50035f){return _0x1d771b[_0x3bc5('0x62')](_0xcaddad,{'transaction':_0x50035f})[_0x3bc5('0x23')](function(){return BPromise[_0x3bc5('0x6a')](_0x43e441,function(_0x130c92){return db[_0x3bc5('0x55')]['findOrCreate']({'where':{'UserId':_0x130c92['id'],'MailQueueId':_0x1772ba[_0x3bc5('0x51')]['id']},'transaction':_0x50035f});});})['then'](function(){_0x43e441['forEach'](function(_0x6f462d){socket[_0x3bc5('0x6b')](_0x3bc5('0x6c'),{'UserId':_0x6f462d['id'],'MailQueueId':_0x1d771b['id']});});});});});}})[_0x3bc5('0x23')](respondWithStatusCode(_0x3f2f3a,null))[_0x3bc5('0x46')](handleError(_0x3f2f3a,null));};exports[_0x3bc5('0x6d')]=function(_0x1fd391,_0x27bb1a,_0x5ac5f3){return db[_0x3bc5('0x60')][_0x3bc5('0x44')]({'where':{'id':_0x1fd391[_0x3bc5('0x32')][_0x3bc5('0x63')]},'attributes':['id'],'include':[{'model':db[_0x3bc5('0x58')],'as':_0x3bc5('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3bc5('0x23')](handleEntityNotFound(_0x27bb1a,null))[_0x3bc5('0x23')](function(_0x88ffc0){var _0x46940d=_[_0x3bc5('0x2d')](_0x88ffc0,'id');var _0x2b091d=[];var _0x40de80=[];var _0x1d67b7=squel[_0x3bc5('0x6e')]();_0x1d67b7[_0x3bc5('0x6f')](_0x3bc5('0x70'))[_0x3bc5('0x71')](_0x3bc5('0x72'),'tq')[_0x3bc5('0x73')](_0x3bc5('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x1fd391['params']['id']);for(var _0x1de766=0x0;_0x1de766<_0x88ffc0[_0x3bc5('0x38')];_0x1de766+=0x1){let _0x38bc1f=_0x88ffc0[_0x1de766];for(var _0x28317f=0x0;_0x28317f<_0x38bc1f['Agents'][_0x3bc5('0x38')];_0x28317f+=0x1){let _0x71fdd4=_0x38bc1f[_0x3bc5('0x64')][_0x28317f];var _0x1adc68=_0x1d67b7[_0x3bc5('0x75')]();_0x1adc68[_0x3bc5('0x3c')](_0x3bc5('0x76'),_0x71fdd4['id']);_0x40de80['push'](db[_0x3bc5('0x77')][_0x3bc5('0x32')](_0x1adc68[_0x3bc5('0x78')](),{'type':db[_0x3bc5('0x77')]['QueryTypes']['SELECT']})[_0x3bc5('0x23')](function(_0x4cc55a){if(_0x4cc55a[_0x3bc5('0x38')]===0x1){return _0x71fdd4['id'];}else{var _0x14f3e6=_[_0x3bc5('0x79')](_[_0x3bc5('0x2d')](_0x4cc55a,_0x3bc5('0x7a')),function(_0x531682){return _['includes'](_0x46940d,_0x531682);});if(_0x14f3e6){return _0x71fdd4['id'];}}}));}}return BPromise[_0x3bc5('0x7b')](_0x40de80)[_0x3bc5('0x23')](function(_0x3fa155){_0x2b091d=_(_0x2b091d)[_0x3bc5('0x7c')](_0x3fa155)['compact']()[_0x3bc5('0x7d')]();return db[_0x3bc5('0x2e')]['find']({'where':{'id':_0x1fd391['params']['id']}})[_0x3bc5('0x23')](function(_0x1ad52d){return db[_0x3bc5('0x77')][_0x3bc5('0x69')](function(_0x5a1c4f){return _0x1ad52d[_0x3bc5('0x6d')](_0x1fd391[_0x3bc5('0x32')]['ids'],{'transaction':_0x5a1c4f})['then'](function(){if(!_['isEmpty'](_0x2b091d)){return _0x1ad52d[_0x3bc5('0x7e')](_0x2b091d,{'transaction':_0x5a1c4f});}})[_0x3bc5('0x23')](function(){_0x2b091d[_0x3bc5('0x7f')](function(_0x161275){socket['emit'](_0x3bc5('0x80'),{'UserId':_0x161275,'MailQueueId':_0x1ad52d['id']});});});});});});})['then'](respondWithStatusCode(_0x27bb1a,null))[_0x3bc5('0x46')](handleError(_0x27bb1a,null));};exports[_0x3bc5('0x81')]=function(_0xc61cac,_0x419c4e,_0x9b6946){return db[_0x3bc5('0x2e')][_0x3bc5('0x49')]({'where':{'id':_0xc61cac['params']['id']}})[_0x3bc5('0x23')](handleEntityNotFound(_0x419c4e,null))[_0x3bc5('0x23')](function(_0xa68096){if(_0xa68096){return _0xa68096[_0x3bc5('0x81')](_0xc61cac['body'][_0x3bc5('0x63')],_[_0x3bc5('0x82')](_0xc61cac[_0x3bc5('0x4b')],[_0x3bc5('0x63'),'id'])||{})[_0x3bc5('0x83')](function(_0x3ea24c){for(var _0x282889=0x0;_0x282889<_0xc61cac[_0x3bc5('0x4b')]['ids'][_0x3bc5('0x38')];_0x282889+=0x1){socket['emit'](_0x3bc5('0x6c'),{'UserId':_0xc61cac[_0x3bc5('0x4b')][_0x3bc5('0x63')][_0x282889],'MailQueueId':_0xc61cac[_0x3bc5('0x51')]['id']});}return _0x3ea24c;});}})[_0x3bc5('0x23')](respondWithResult(_0x419c4e,null))['catch'](handleError(_0x419c4e,null));};exports[_0x3bc5('0x7e')]=function(_0x4cb21b,_0x59d422,_0x1e9576){return db['MailQueue'][_0x3bc5('0x49')]({'where':{'id':_0x4cb21b[_0x3bc5('0x51')]['id']}})[_0x3bc5('0x23')](handleEntityNotFound(_0x59d422,null))[_0x3bc5('0x23')](function(_0x536dbf){if(_0x536dbf){return _0x536dbf[_0x3bc5('0x7e')](_0x4cb21b['query'][_0x3bc5('0x63')])['then'](function(){if(_['isArray'](_0x4cb21b[_0x3bc5('0x32')]['ids'])){for(var _0x31a2c5=0x0;_0x31a2c5<_0x4cb21b[_0x3bc5('0x32')][_0x3bc5('0x63')][_0x3bc5('0x38')];_0x31a2c5+=0x1){socket[_0x3bc5('0x6b')](_0x3bc5('0x80'),{'UserId':Number(_0x4cb21b[_0x3bc5('0x32')][_0x3bc5('0x63')][_0x31a2c5]),'MailQueueId':Number(_0x4cb21b[_0x3bc5('0x51')]['id'])});}}else{socket[_0x3bc5('0x6b')](_0x3bc5('0x80'),{'UserId':Number(_0x4cb21b[_0x3bc5('0x32')][_0x3bc5('0x63')]),'MailQueueId':Number(_0x4cb21b['params']['id'])});}});}})[_0x3bc5('0x23')](respondWithStatusCode(_0x59d422,null))[_0x3bc5('0x46')](handleError(_0x59d422,null));};exports[_0x3bc5('0x84')]=function(_0x150c26,_0x1ce533,_0x5d2185){var _0x4b9bc4={};var _0x3678c4={};var _0x25706c;var _0x3d68a2;return db[_0x3bc5('0x2e')][_0x3bc5('0x54')]({'where':{'id':_0x150c26['params']['id']}})['then'](handleEntityNotFound(_0x1ce533,null))['then'](function(_0x35c456){if(_0x35c456){_0x25706c=_0x35c456;_0x3678c4[_0x3bc5('0x35')]=_[_0x3bc5('0x48')](db[_0x3bc5('0x58')][_0x3bc5('0x2f')]);_0x3678c4[_0x3bc5('0x32')]=_[_0x3bc5('0x48')](_0x150c26[_0x3bc5('0x32')]);_0x3678c4[_0x3bc5('0x33')]=_[_0x3bc5('0x34')](_0x3678c4[_0x3bc5('0x35')],_0x3678c4['query']);_0x4b9bc4[_0x3bc5('0x36')]=_[_0x3bc5('0x34')](_0x3678c4[_0x3bc5('0x35')],qs['fields'](_0x150c26[_0x3bc5('0x32')][_0x3bc5('0x37')]));_0x4b9bc4[_0x3bc5('0x36')]=_0x4b9bc4[_0x3bc5('0x36')][_0x3bc5('0x38')]?_0x4b9bc4[_0x3bc5('0x36')]:_0x3678c4['model'];_0x4b9bc4[_0x3bc5('0x3a')]=qs[_0x3bc5('0x3b')](_0x150c26[_0x3bc5('0x32')][_0x3bc5('0x3b')]);_0x4b9bc4['where']=qs[_0x3bc5('0x33')](_[_0x3bc5('0x3d')](_0x150c26['query'],_0x3678c4[_0x3bc5('0x33')]));if(_0x150c26[_0x3bc5('0x32')][_0x3bc5('0x3e')]){_0x4b9bc4['where']=_[_0x3bc5('0x3f')](_0x4b9bc4[_0x3bc5('0x3c')],{'$or':_[_0x3bc5('0x2d')](_0x4b9bc4[_0x3bc5('0x36')],function(_0x527a0f){var _0x5303e1={};_0x5303e1[_0x527a0f]={'$like':'%'+_0x150c26[_0x3bc5('0x32')][_0x3bc5('0x3e')]+'%'};return _0x5303e1;})});}_0x4b9bc4=_[_0x3bc5('0x3f')]({},_0x4b9bc4,_0x150c26[_0x3bc5('0x40')]);return _0x25706c['getAgents'](_0x4b9bc4);}})[_0x3bc5('0x23')](function(_0x5d1e7d){if(_0x5d1e7d){_0x3d68a2=_0x5d1e7d[_0x3bc5('0x38')];if(!_0x150c26[_0x3bc5('0x32')][_0x3bc5('0x39')](_0x3bc5('0x56'))){_0x4b9bc4[_0x3bc5('0x20')]=qs['limit'](_0x150c26['query']['limit']);_0x4b9bc4[_0x3bc5('0x1f')]=qs[_0x3bc5('0x1f')](_0x150c26[_0x3bc5('0x32')]['offset']);}return _0x25706c[_0x3bc5('0x84')](_0x4b9bc4);}})[_0x3bc5('0x23')](function(_0x5ba61e){if(_0x5ba61e){return _0x5ba61e?{'count':_0x3d68a2,'rows':_0x5ba61e}:null;}})[_0x3bc5('0x23')](respondWithResult(_0x1ce533,null))['catch'](handleError(_0x1ce533,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1fad76a..5a01a2a 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 _0x7f61=['hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3b196d,_0x4f3eb2){var _0x430025=function(_0x2dfb93){while(--_0x2dfb93){_0x3b196d['push'](_0x3b196d['shift']());}};_0x430025(++_0x4f3eb2);}(_0x7f61,0xfe));var _0x17f6=function(_0x966863,_0x38f224){_0x966863=_0x966863-0x0;var _0x49c720=_0x7f61[_0x966863];return _0x49c720;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x17f6('0x0'))['db'][_0x17f6('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x17f6('0x2')](0x0);var events={'afterCreate':_0x17f6('0x3'),'afterUpdate':_0x17f6('0x4'),'afterDestroy':_0x17f6('0x5')};function emitEvent(_0xf72840){return function(_0x1cba56,_0x53a80c,_0x523126){MailQueueEvents[_0x17f6('0x6')](_0xf72840+':'+_0x1cba56['id'],_0x1cba56);MailQueueEvents[_0x17f6('0x6')](_0xf72840,_0x1cba56);_0x523126(null);};}for(var e in events){if(events[_0x17f6('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x17f6('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x00cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x00cd,0x13c));var _0xd00c=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x00cd[_0x454018];return _0x24697d;};'use strict';var EventEmitter=require(_0xd00c('0x0'));var MailQueue=require(_0xd00c('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd00c('0x2'),'afterDestroy':_0xd00c('0x3')};function emitEvent(_0x4e29bd){return function(_0x247fe1,_0x406e1c,_0x3c3b30){MailQueueEvents[_0xd00c('0x4')](_0x4e29bd+':'+_0x247fe1['id'],_0x247fe1);MailQueueEvents[_0xd00c('0x4')](_0x4e29bd,_0x247fe1);_0x3c3b30(null);};}for(var e in events){if(events[_0xd00c('0x5')](e)){var event=events[e];MailQueue[_0xd00c('0x6')](e,emitEvent(event));}}module[_0xd00c('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 1b3df80..20c2736 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 _0xb695=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailQueue.attributes'];(function(_0x7cb905,_0x5c2772){var _0x411552=function(_0xa6c946){while(--_0xa6c946){_0x7cb905['push'](_0x7cb905['shift']());}};_0x411552(++_0x5c2772);}(_0xb695,0x1b1));var _0x5b69=function(_0x1e3a0a,_0x411e1c){_0x1e3a0a=_0x1e3a0a-0x0;var _0x1e52b8=_0xb695[_0x1e3a0a];return _0x1e52b8;};'use strict';var _=require(_0x5b69('0x0'));var util=require(_0x5b69('0x1'));var logger=require(_0x5b69('0x2'))(_0x5b69('0x3'));var moment=require(_0x5b69('0x4'));var BPromise=require(_0x5b69('0x5'));var rp=require(_0x5b69('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b69('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b69('0x8'));module[_0x5b69('0x9')]=function(_0x456f16,_0x44a76e){return _0x456f16[_0x5b69('0xa')](_0x5b69('0xb'),attributes,{'tableName':_0x5b69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc892=['../../config/environment','exports','define','MailQueue','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x2c46a7,_0x14d549){var _0x59fc85=function(_0x1514a5){while(--_0x1514a5){_0x2c46a7['push'](_0x2c46a7['shift']());}};_0x59fc85(++_0x14d549);}(_0xc892,0xcc));var _0x2c89=function(_0x47e2d0,_0x4d7a21){_0x47e2d0=_0x47e2d0-0x0;var _0xa9deb8=_0xc892[_0x47e2d0];return _0xa9deb8;};'use strict';var _=require(_0x2c89('0x0'));var util=require(_0x2c89('0x1'));var logger=require(_0x2c89('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c89('0x3'));var fs=require('fs');var path=require(_0x2c89('0x4'));var rimraf=require(_0x2c89('0x5'));var config=require(_0x2c89('0x6'));var attributes=require('./mailQueue.attributes');module[_0x2c89('0x7')]=function(_0x337bde,_0x1db281){return _0x337bde[_0x2c89('0x8')](_0x2c89('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a1d21bb..495114f 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 _0x671a=['GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','map','include','model','ShowMailQueue','where','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5b9f4b,_0x117a26){var _0x474db1=function(_0x2bf0b8){while(--_0x2bf0b8){_0x5b9f4b['push'](_0x5b9f4b['shift']());}};_0x474db1(++_0x117a26);}(_0x671a,0xf0));var _0xa671=function(_0x3494e8,_0x4111ea){_0x3494e8=_0x3494e8-0x0;var _0x20bd8c=_0x671a[_0x3494e8];return _0x20bd8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa671('0x0'));var BPromise=require(_0xa671('0x1'));var rs=require(_0xa671('0x2'));var fs=require('fs');var Redis=require(_0xa671('0x3'));var db=require(_0xa671('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa671('0x5'));var config=require('../../config/environment');var jayson=require(_0xa671('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xa671('0x7')]=_[_0xa671('0x8')](config[_0xa671('0x7')],{'host':_0xa671('0x9'),'port':0x18eb});var socket=require(_0xa671('0xa'))(new Redis(config[_0xa671('0x7')]));require(_0xa671('0xb'))[_0xa671('0xc')](socket);function respondWithRpcPromise(_0x2ad3d2,_0x54d33b,_0x2e9b68){return new BPromise(function(_0x2e0f5a,_0x14c9e2){return client[_0xa671('0xd')](_0x2ad3d2,_0x2e9b68)[_0xa671('0xe')](function(_0x29447d){logger[_0xa671('0xf')](_0xa671('0x10'),_0x54d33b,_0xa671('0x11'));logger[_0xa671('0x12')](_0xa671('0x13'),_0x54d33b,_0xa671('0x11'),JSON[_0xa671('0x14')](_0x29447d));if(_0x29447d[_0xa671('0x15')]){if(_0x29447d[_0xa671('0x15')][_0xa671('0x16')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x54d33b,_0x29447d[_0xa671('0x15')][_0xa671('0x17')]);return _0x14c9e2(_0x29447d[_0xa671('0x15')][_0xa671('0x17')]);}logger[_0xa671('0x15')]('MailQueue,\x20%s,\x20%s',_0x54d33b,_0x29447d[_0xa671('0x15')][_0xa671('0x17')]);return _0x2e0f5a(_0x29447d[_0xa671('0x15')][_0xa671('0x17')]);}else{logger[_0xa671('0xf')]('MailQueue,\x20%s,\x20%s',_0x54d33b,_0xa671('0x11'));_0x2e0f5a(_0x29447d[_0xa671('0x18')]['message']);}})[_0xa671('0x19')](function(_0x2504a6){logger[_0xa671('0x15')]('MailQueue,\x20%s,\x20%s',_0x54d33b,_0x2504a6);_0x14c9e2(_0x2504a6);});});}exports[_0xa671('0x1a')]=function(_0x53b3da){var _0x1a3824=this;return new Promise(function(_0x42aefe,_0x3009b3){return db[_0xa671('0x1b')][_0xa671('0x1c')]({'raw':_0x53b3da[_0xa671('0x1d')]?_0x53b3da[_0xa671('0x1d')][_0xa671('0x1e')]===undefined?!![]:![]:!![],'where':_0x53b3da['options']?_0x53b3da[_0xa671('0x1d')]['where']||null:null,'attributes':_0x53b3da[_0xa671('0x1d')]?_0x53b3da[_0xa671('0x1d')][_0xa671('0x1f')]||null:null,'limit':_0x53b3da[_0xa671('0x1d')]?_0x53b3da[_0xa671('0x1d')][_0xa671('0x20')]||null:null,'include':_0x53b3da[_0xa671('0x1d')]?_0x53b3da['options']['include']?_[_0xa671('0x21')](_0x53b3da[_0xa671('0x1d')][_0xa671('0x22')],function(_0x130504){return{'model':db[_0x130504['model']],'as':_0x130504['as'],'attributes':_0x130504['attributes'],'include':_0x130504[_0xa671('0x22')]?_[_0xa671('0x21')](_0x130504[_0xa671('0x22')],function(_0x13a0cc){return{'model':db[_0x13a0cc[_0xa671('0x23')]],'as':_0x13a0cc['as'],'attributes':_0x13a0cc['attributes'],'include':_0x13a0cc[_0xa671('0x22')]?_[_0xa671('0x21')](_0x13a0cc[_0xa671('0x22')],function(_0x16f442){return{'model':db[_0x16f442[_0xa671('0x23')]],'as':_0x16f442['as'],'attributes':_0x16f442[_0xa671('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa671('0xe')](function(_0x5bd14b){logger['info'](_0xa671('0x1a'),_0x53b3da);logger[_0xa671('0x12')](_0xa671('0x1a'),_0x53b3da,JSON[_0xa671('0x14')](_0x5bd14b));_0x42aefe(_0x5bd14b);})[_0xa671('0x19')](function(_0x3bc74c){logger[_0xa671('0x15')](_0xa671('0x1a'),_0x3bc74c[_0xa671('0x17')],_0x53b3da);_0x3009b3(_0x1a3824[_0xa671('0x15')](0x1f4,_0x3bc74c[_0xa671('0x17')]));});});};exports[_0xa671('0x24')]=function(_0x5e5c04){var _0x4c18da=this;return new Promise(function(_0x20aeea,_0x57d8f1){return db[_0xa671('0x1b')]['find']({'raw':_0x5e5c04['options']?_0x5e5c04['options'][_0xa671('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e5c04[_0xa671('0x1d')]?_0x5e5c04[_0xa671('0x1d')][_0xa671('0x25')]||null:null,'attributes':_0x5e5c04[_0xa671('0x1d')]?_0x5e5c04[_0xa671('0x1d')][_0xa671('0x1f')]||null:null,'include':_0x5e5c04['options']?_0x5e5c04['options'][_0xa671('0x22')]?_[_0xa671('0x21')](_0x5e5c04[_0xa671('0x1d')][_0xa671('0x22')],function(_0x1d7865){return{'model':db[_0x1d7865['model']],'as':_0x1d7865['as'],'attributes':_0x1d7865[_0xa671('0x1f')],'include':_0x1d7865[_0xa671('0x22')]?_['map'](_0x1d7865[_0xa671('0x22')],function(_0x435153){return{'model':db[_0x435153[_0xa671('0x23')]],'as':_0x435153['as'],'attributes':_0x435153[_0xa671('0x1f')],'include':_0x435153[_0xa671('0x22')]?_[_0xa671('0x21')](_0x435153[_0xa671('0x22')],function(_0x3fa41d){return{'model':db[_0x3fa41d[_0xa671('0x23')]],'as':_0x3fa41d['as'],'attributes':_0x3fa41d[_0xa671('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa671('0xe')](function(_0x21009f){logger[_0xa671('0xf')](_0xa671('0x24'),_0x5e5c04);logger[_0xa671('0x12')](_0xa671('0x24'),_0x5e5c04,JSON[_0xa671('0x14')](_0x21009f));_0x20aeea(_0x21009f);})['catch'](function(_0x4912a5){logger[_0xa671('0x15')](_0xa671('0x24'),_0x4912a5['message'],_0x5e5c04);_0x57d8f1(_0x4c18da[_0xa671('0x15')](0x1f4,_0x4912a5['message']));});});}; \ No newline at end of file +var _0xb087=['request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','findAll','options','where','attributes','limit','include','map','model','info','MailQueue','find','raw','ShowMailQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','debug','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5de327,_0xd1c73a){var _0xf24847=function(_0x395ab4){while(--_0x395ab4){_0x5de327['push'](_0x5de327['shift']());}};_0xf24847(++_0xd1c73a);}(_0xb087,0x1ef));var _0x7b08=function(_0x7fb16c,_0x9c68dd){_0x7fb16c=_0x7fb16c-0x0;var _0x4f2062=_0xb087[_0x7fb16c];return _0x4f2062;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b08('0x0'));var BPromise=require(_0x7b08('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b08('0x2'));var db=require(_0x7b08('0x3'))['db'];var utils=require(_0x7b08('0x4'));var logger=require(_0x7b08('0x5'))(_0x7b08('0x6'));var config=require(_0x7b08('0x7'));var jayson=require(_0x7b08('0x8'));var client=jayson[_0x7b08('0x9')][_0x7b08('0xa')]({'port':0x232a});config['redis']=_[_0x7b08('0xb')](config[_0x7b08('0xc')],{'host':_0x7b08('0xd'),'port':0x18eb});var socket=require(_0x7b08('0xe'))(new Redis(config['redis']));require(_0x7b08('0xf'))[_0x7b08('0x10')](socket);function respondWithRpcPromise(_0x36048d,_0x401f21,_0x69f1bb){return new BPromise(function(_0x57dc41,_0x50df51){return client[_0x7b08('0x11')](_0x36048d,_0x69f1bb)[_0x7b08('0x12')](function(_0x3302b8){logger['info']('MailQueue,\x20%s,\x20%s',_0x401f21,'request\x20sent');logger[_0x7b08('0x13')](_0x7b08('0x14'),_0x401f21,_0x7b08('0x15'),JSON[_0x7b08('0x16')](_0x3302b8));if(_0x3302b8[_0x7b08('0x17')]){if(_0x3302b8[_0x7b08('0x17')][_0x7b08('0x18')]===0x1f4){logger[_0x7b08('0x17')](_0x7b08('0x19'),_0x401f21,_0x3302b8[_0x7b08('0x17')]['message']);return _0x50df51(_0x3302b8[_0x7b08('0x17')][_0x7b08('0x1a')]);}logger[_0x7b08('0x17')](_0x7b08('0x19'),_0x401f21,_0x3302b8[_0x7b08('0x17')][_0x7b08('0x1a')]);return _0x57dc41(_0x3302b8[_0x7b08('0x17')][_0x7b08('0x1a')]);}else{logger['info'](_0x7b08('0x19'),_0x401f21,_0x7b08('0x15'));_0x57dc41(_0x3302b8[_0x7b08('0x1b')][_0x7b08('0x1a')]);}})[_0x7b08('0x1c')](function(_0x40a881){logger[_0x7b08('0x17')](_0x7b08('0x19'),_0x401f21,_0x40a881);_0x50df51(_0x40a881);});});}exports[_0x7b08('0x1d')]=function(_0x13c30f){var _0xdc3578=this;return new Promise(function(_0x147b48,_0x349aae){return db['MailQueue'][_0x7b08('0x1e')]({'raw':_0x13c30f[_0x7b08('0x1f')]?_0x13c30f[_0x7b08('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x13c30f[_0x7b08('0x1f')]?_0x13c30f['options'][_0x7b08('0x20')]||null:null,'attributes':_0x13c30f[_0x7b08('0x1f')]?_0x13c30f[_0x7b08('0x1f')][_0x7b08('0x21')]||null:null,'limit':_0x13c30f[_0x7b08('0x1f')]?_0x13c30f[_0x7b08('0x1f')][_0x7b08('0x22')]||null:null,'include':_0x13c30f[_0x7b08('0x1f')]?_0x13c30f[_0x7b08('0x1f')][_0x7b08('0x23')]?_['map'](_0x13c30f['options'][_0x7b08('0x23')],function(_0x4e9793){return{'model':db[_0x4e9793['model']],'as':_0x4e9793['as'],'attributes':_0x4e9793[_0x7b08('0x21')],'include':_0x4e9793[_0x7b08('0x23')]?_[_0x7b08('0x24')](_0x4e9793[_0x7b08('0x23')],function(_0x4ec878){return{'model':db[_0x4ec878['model']],'as':_0x4ec878['as'],'attributes':_0x4ec878[_0x7b08('0x21')],'include':_0x4ec878['include']?_[_0x7b08('0x24')](_0x4ec878[_0x7b08('0x23')],function(_0x1b4fd2){return{'model':db[_0x1b4fd2[_0x7b08('0x25')]],'as':_0x1b4fd2['as'],'attributes':_0x1b4fd2[_0x7b08('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7b08('0x12')](function(_0x2da209){logger[_0x7b08('0x26')](_0x7b08('0x1d'),_0x13c30f);logger[_0x7b08('0x13')](_0x7b08('0x1d'),_0x13c30f,JSON[_0x7b08('0x16')](_0x2da209));_0x147b48(_0x2da209);})[_0x7b08('0x1c')](function(_0x50b4ab){logger[_0x7b08('0x17')](_0x7b08('0x1d'),_0x50b4ab['message'],_0x13c30f);_0x349aae(_0xdc3578['error'](0x1f4,_0x50b4ab[_0x7b08('0x1a')]));});});};exports['ShowMailQueue']=function(_0x5afa1c){var _0x2e9e70=this;return new Promise(function(_0xb12ec0,_0x22288a){return db[_0x7b08('0x27')][_0x7b08('0x28')]({'raw':_0x5afa1c[_0x7b08('0x1f')]?_0x5afa1c[_0x7b08('0x1f')][_0x7b08('0x29')]===undefined?!![]:![]:!![],'where':_0x5afa1c[_0x7b08('0x1f')]?_0x5afa1c[_0x7b08('0x1f')][_0x7b08('0x20')]||null:null,'attributes':_0x5afa1c[_0x7b08('0x1f')]?_0x5afa1c['options'][_0x7b08('0x21')]||null:null,'include':_0x5afa1c[_0x7b08('0x1f')]?_0x5afa1c[_0x7b08('0x1f')]['include']?_[_0x7b08('0x24')](_0x5afa1c[_0x7b08('0x1f')][_0x7b08('0x23')],function(_0x5b20a8){return{'model':db[_0x5b20a8[_0x7b08('0x25')]],'as':_0x5b20a8['as'],'attributes':_0x5b20a8[_0x7b08('0x21')],'include':_0x5b20a8[_0x7b08('0x23')]?_[_0x7b08('0x24')](_0x5b20a8['include'],function(_0x6bb5f){return{'model':db[_0x6bb5f[_0x7b08('0x25')]],'as':_0x6bb5f['as'],'attributes':_0x6bb5f['attributes'],'include':_0x6bb5f['include']?_['map'](_0x6bb5f['include'],function(_0x48922b){return{'model':db[_0x48922b['model']],'as':_0x48922b['as'],'attributes':_0x48922b[_0x7b08('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7b08('0x12')](function(_0x1552ce){logger[_0x7b08('0x26')](_0x7b08('0x2a'),_0x5afa1c);logger[_0x7b08('0x13')]('ShowMailQueue',_0x5afa1c,JSON[_0x7b08('0x16')](_0x1552ce));_0xb12ec0(_0x1552ce);})['catch'](function(_0x2bcc6f){logger[_0x7b08('0x17')](_0x7b08('0x2a'),_0x2bcc6f['message'],_0x5afa1c);_0x22288a(_0x2e9e70[_0x7b08('0x17')](0x1f4,_0x2bcc6f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6afa321..19fbf71 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 _0xe234=['emit','register','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0xe234,0xb2));var _0x4e23=function(_0x328bb5,_0x21f240){_0x328bb5=_0x328bb5-0x0;var _0x5f3e16=_0xe234[_0x328bb5];return _0x5f3e16;};'use strict';var MailQueueEvents=require(_0x4e23('0x0'));var events=[_0x4e23('0x1'),_0x4e23('0x2'),_0x4e23('0x3')];function createListener(_0xc4f8e4,_0x4014f2){return function(_0x445b0c){_0x4014f2[_0x4e23('0x4')](_0xc4f8e4,_0x445b0c);};}function removeListener(_0x3fc981,_0x36d8e3){return function(){MailQueueEvents['removeListener'](_0x3fc981,_0x36d8e3);};}exports[_0x4e23('0x5')]=function(_0x2d4601){for(var _0x457e5c=0x0,_0x403def=events['length'];_0x457e5c<_0x403def;_0x457e5c++){var _0x3a7a01=events[_0x457e5c];var _0x24c3f=createListener(_0x4e23('0x6')+_0x3a7a01,_0x2d4601);MailQueueEvents['on'](_0x3a7a01,_0x24c3f);}}; \ No newline at end of file +var _0x7adb=['removeListener','register','length','remove','emit'];(function(_0x487487,_0x29697d){var _0x4140f3=function(_0x3f4a7b){while(--_0x3f4a7b){_0x487487['push'](_0x487487['shift']());}};_0x4140f3(++_0x29697d);}(_0x7adb,0x85));var _0xb7ad=function(_0x1fca9c,_0x480e7b){_0x1fca9c=_0x1fca9c-0x0;var _0xb97953=_0x7adb[_0x1fca9c];return _0xb97953;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xb7ad('0x0'),'update'];function createListener(_0x28383b,_0x355e32){return function(_0x123e49){_0x355e32[_0xb7ad('0x1')](_0x28383b,_0x123e49);};}function removeListener(_0x553ed6,_0x9f8cfe){return function(){MailQueueEvents[_0xb7ad('0x2')](_0x553ed6,_0x9f8cfe);};}exports[_0xb7ad('0x3')]=function(_0x506825){for(var _0x24fe08=0x0,_0xb81eb6=events[_0xb7ad('0x4')];_0x24fe08<_0xb81eb6;_0x24fe08++){var _0x550b4b=events[_0x24fe08];var _0x3f41cd=createListener('mailQueue:'+_0x550b4b,_0x506825);MailQueueEvents['on'](_0x550b4b,_0x3f41cd);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b492a6f..df0c201 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 _0xb2d5=['./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x137678,_0x417d5a){var _0x21151c=function(_0xf71bab){while(--_0xf71bab){_0x137678['push'](_0x137678['shift']());}};_0x21151c(++_0x417d5a);}(_0xb2d5,0xc7));var _0x5b2d=function(_0x1985dd,_0x2b9aba){_0x1985dd=_0x1985dd-0x0;var _0x3b7588=_0xb2d5[_0x1985dd];return _0x3b7588;};'use strict';var multer=require('multer');var util=require(_0x5b2d('0x0'));var path=require(_0x5b2d('0x1'));var timeout=require(_0x5b2d('0x2'));var express=require(_0x5b2d('0x3'));var router=express[_0x5b2d('0x4')]();var auth=require(_0x5b2d('0x5'));var interaction=require(_0x5b2d('0x6'));var config=require(_0x5b2d('0x7'));var controller=require(_0x5b2d('0x8'));router[_0x5b2d('0x9')]('/',auth[_0x5b2d('0xa')](),controller[_0x5b2d('0xb')]);router['get'](_0x5b2d('0xc'),auth[_0x5b2d('0xa')](),controller[_0x5b2d('0xd')]);router['get'](_0x5b2d('0xe'),auth[_0x5b2d('0xa')](),controller[_0x5b2d('0xf')]);router[_0x5b2d('0x10')]('/',auth['isAuthenticated'](),controller[_0x5b2d('0x11')]);router[_0x5b2d('0x12')](_0x5b2d('0xe'),auth[_0x5b2d('0xa')](),controller[_0x5b2d('0x13')]);router[_0x5b2d('0x14')](_0x5b2d('0xe'),auth['isAuthenticated'](),controller[_0x5b2d('0x15')]);module[_0x5b2d('0x16')]=router; \ No newline at end of file +var _0xf468=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0xaeaed5,_0x1aac92){var _0x567dcf=function(_0x50f227){while(--_0x50f227){_0xaeaed5['push'](_0xaeaed5['shift']());}};_0x567dcf(++_0x1aac92);}(_0xf468,0xd3));var _0x8f46=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xf468[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x8f46('0x0'));var util=require(_0x8f46('0x1'));var path=require(_0x8f46('0x2'));var timeout=require(_0x8f46('0x3'));var express=require(_0x8f46('0x4'));var router=express['Router']();var auth=require(_0x8f46('0x5'));var interaction=require(_0x8f46('0x6'));var config=require(_0x8f46('0x7'));var controller=require(_0x8f46('0x8'));router[_0x8f46('0x9')]('/',auth[_0x8f46('0xa')](),controller[_0x8f46('0xb')]);router[_0x8f46('0x9')](_0x8f46('0xc'),auth[_0x8f46('0xa')](),controller[_0x8f46('0xd')]);router['get'](_0x8f46('0xe'),auth['isAuthenticated'](),controller[_0x8f46('0xf')]);router[_0x8f46('0x10')]('/',auth[_0x8f46('0xa')](),controller[_0x8f46('0x11')]);router[_0x8f46('0x12')](_0x8f46('0xe'),auth[_0x8f46('0xa')](),controller[_0x8f46('0x13')]);router[_0x8f46('0x14')](_0x8f46('0xe'),auth[_0x8f46('0xa')](),controller[_0x8f46('0x15')]);module[_0x8f46('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 25fb1ce..3fb893f 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 _0xc74c=['sequelize','exports','STRING','DATE','moment'];(function(_0xac7ad6,_0x2f4507){var _0x2ed3c8=function(_0x155332){while(--_0x155332){_0xac7ad6['push'](_0xac7ad6['shift']());}};_0x2ed3c8(++_0x2f4507);}(_0xc74c,0xe5));var _0xcc74=function(_0x51ce13,_0x26f575){_0x51ce13=_0x51ce13-0x0;var _0xa8b4a7=_0xc74c[_0x51ce13];return _0xa8b4a7;};'use strict';var moment=require(_0xcc74('0x0'));var Sequelize=require(_0xcc74('0x1'));module[_0xcc74('0x2')]={'uniqueid':{'type':Sequelize[_0xcc74('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcc74('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcc74('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcc74('0x4')]},'reason':{'type':Sequelize[_0xcc74('0x3')]}}; \ No newline at end of file +var _0xb2b0=['STRING','DATE','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb2b0,0x14f));var _0x0b2b=function(_0x4a0dea,_0x111365){_0x4a0dea=_0x4a0dea-0x0;var _0x1c6333=_0xb2b0[_0x4a0dea];return _0x1c6333;};'use strict';var moment=require(_0x0b2b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0b2b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0b2b('0x1')]},'joinAt':{'type':Sequelize[_0x0b2b('0x2')]},'leaveAt':{'type':Sequelize[_0x0b2b('0x2')]},'acceptAt':{'type':Sequelize[_0x0b2b('0x2')]},'exitAt':{'type':Sequelize[_0x0b2b('0x2')]},'reason':{'type':Sequelize[_0x0b2b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0a4be57..9594e38 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 _0x5ed2=['params','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','MailQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','options','includeAll','include','findAll','catch'];(function(_0x314df6,_0x595687){var _0xa65572=function(_0x41f35c){while(--_0x41f35c){_0x314df6['push'](_0x314df6['shift']());}};_0xa65572(++_0x595687);}(_0x5ed2,0x114));var _0x25ed=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0x5ed2[_0x1d0499];return _0x153fb3;};'use strict';var pdf=require(_0x25ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25ed('0x1'));var zipdir=require(_0x25ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25ed('0x3'));var moment=require(_0x25ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25ed('0x5'));var util=require(_0x25ed('0x6'));var path=require(_0x25ed('0x7'));var sox=require(_0x25ed('0x8'));var csv=require('to-csv');var ejs=require(_0x25ed('0x9'));var fs=require('fs');var _=require(_0x25ed('0xa'));var squel=require(_0x25ed('0xb'));var crypto=require(_0x25ed('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x25ed('0xd'));var Redis=require(_0x25ed('0xe'));var authService=require(_0x25ed('0xf'));var qs=require(_0x25ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25ed('0x11'));var logger=require(_0x25ed('0x12'))(_0x25ed('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x25ed('0x14'))['db'];function respondWithStatusCode(_0x320852,_0x1530e0){_0x1530e0=_0x1530e0||0xcc;return function(_0x623120){if(_0x623120){return _0x320852[_0x25ed('0x15')](_0x1530e0);}return _0x320852[_0x25ed('0x16')](_0x1530e0)['end']();};}function respondWithResult(_0x2830f6,_0xbdc943){_0xbdc943=_0xbdc943||0xc8;return function(_0x4730c5){if(_0x4730c5){return _0x2830f6['status'](_0xbdc943)[_0x25ed('0x17')](_0x4730c5);}};}function respondWithFilteredResult(_0x58d00b,_0x3e9b5e){return function(_0x7244b7){if(_0x7244b7){var _0x43e295=_0x7244b7[_0x25ed('0x18')],_0x551342=_0x3e9b5e[_0x25ed('0x19')],_0xfabdb=_0x3e9b5e[_0x25ed('0x19')]+_0x3e9b5e[_0x25ed('0x1a')],_0x419076;if(_0xfabdb>=_0x43e295){_0xfabdb=_0x43e295;_0x419076=0xc8;}else{_0x419076=0xce;}_0x58d00b['status'](_0x419076);return _0x58d00b[_0x25ed('0x1b')](_0x25ed('0x1c'),_0x551342+'-'+_0xfabdb+'/'+_0x43e295)['json'](_0x7244b7);}return null;};}function patchUpdates(_0x1ad999){return function(_0x3a144b){try{jsonpatch[_0x25ed('0x1d')](_0x3a144b,_0x1ad999,!![]);}catch(_0x5cac52){return BPromise[_0x25ed('0x1e')](_0x5cac52);}return _0x3a144b[_0x25ed('0x1f')]();};}function saveUpdates(_0x3ba174,_0x2fb6ba){return function(_0xc04e54){if(_0xc04e54){return _0xc04e54[_0x25ed('0x20')](_0x3ba174)[_0x25ed('0x21')](function(_0xb3e59){return _0xb3e59;});}return null;};}function removeEntity(_0x24f315,_0x3414ac){return function(_0x3bc398){if(_0x3bc398){return _0x3bc398[_0x25ed('0x22')]()[_0x25ed('0x21')](function(){_0x24f315[_0x25ed('0x16')](0xcc)[_0x25ed('0x23')]();});}};}function handleEntityNotFound(_0x453181,_0x1e33f1){return function(_0x5d72ed){if(!_0x5d72ed){_0x453181[_0x25ed('0x15')](0x194);}return _0x5d72ed;};}function handleError(_0x384d51,_0x457c3b){_0x457c3b=_0x457c3b||0x1f4;return function(_0x18d8fb){logger['error'](_0x18d8fb[_0x25ed('0x24')]);if(_0x18d8fb[_0x25ed('0x25')]){delete _0x18d8fb[_0x25ed('0x25')];}_0x384d51['status'](_0x457c3b)['send'](_0x18d8fb);};}exports[_0x25ed('0x26')]=function(_0x5141ba,_0x2e7de5){var _0x24a133={},_0x49d696={},_0x38d6e0={'count':0x0,'rows':[]};var _0x387fdf=_['map'](db[_0x25ed('0x27')][_0x25ed('0x28')],function(_0x31bde0){return{'name':_0x31bde0[_0x25ed('0x29')],'type':_0x31bde0[_0x25ed('0x2a')][_0x25ed('0x2b')]};});_0x49d696[_0x25ed('0x2c')]=_['map'](_0x387fdf,_0x25ed('0x25'));_0x49d696['query']=_[_0x25ed('0x2d')](_0x5141ba[_0x25ed('0x2e')]);_0x49d696[_0x25ed('0x2f')]=_['intersection'](_0x49d696[_0x25ed('0x2c')],_0x49d696['query']);_0x24a133[_0x25ed('0x30')]=_[_0x25ed('0x31')](_0x49d696[_0x25ed('0x2c')],qs[_0x25ed('0x32')](_0x5141ba['query'][_0x25ed('0x32')]));_0x24a133[_0x25ed('0x30')]=_0x24a133[_0x25ed('0x30')][_0x25ed('0x33')]?_0x24a133[_0x25ed('0x30')]:_0x49d696['model'];if(!_0x5141ba[_0x25ed('0x2e')][_0x25ed('0x34')](_0x25ed('0x35'))){_0x24a133[_0x25ed('0x1a')]=qs[_0x25ed('0x1a')](_0x5141ba[_0x25ed('0x2e')][_0x25ed('0x1a')]);_0x24a133[_0x25ed('0x19')]=qs[_0x25ed('0x19')](_0x5141ba[_0x25ed('0x2e')][_0x25ed('0x19')]);}_0x24a133[_0x25ed('0x36')]=qs['sort'](_0x5141ba[_0x25ed('0x2e')]['sort']);_0x24a133[_0x25ed('0x37')]=qs[_0x25ed('0x2f')](_['pick'](_0x5141ba[_0x25ed('0x2e')],_0x49d696[_0x25ed('0x2f')]),_0x387fdf);if(_0x5141ba[_0x25ed('0x2e')][_0x25ed('0x38')]){_0x24a133[_0x25ed('0x37')]=_[_0x25ed('0x39')](_0x24a133['where'],{'$or':_[_0x25ed('0x3a')](_0x387fdf,function(_0x5e64e0){if(_0x5e64e0[_0x25ed('0x2a')]!=='VIRTUAL'){var _0x3cb4b7={};_0x3cb4b7[_0x5e64e0[_0x25ed('0x25')]]={'$like':'%'+_0x5141ba[_0x25ed('0x2e')]['filter']+'%'};return _0x3cb4b7;}})});}_0x24a133=_[_0x25ed('0x39')]({},_0x24a133,_0x5141ba[_0x25ed('0x3b')]);var _0x2c8cd9={'where':_0x24a133[_0x25ed('0x37')]};return db['MailQueueReport'][_0x25ed('0x18')](_0x2c8cd9)[_0x25ed('0x21')](function(_0x46fac6){_0x38d6e0[_0x25ed('0x18')]=_0x46fac6;if(_0x5141ba[_0x25ed('0x2e')][_0x25ed('0x3c')]){_0x24a133[_0x25ed('0x3d')]=[{'all':!![]}];}return db[_0x25ed('0x27')][_0x25ed('0x3e')](_0x24a133);})[_0x25ed('0x21')](function(_0x50998b){_0x38d6e0['rows']=_0x50998b;return _0x38d6e0;})[_0x25ed('0x21')](respondWithFilteredResult(_0x2e7de5,_0x24a133))[_0x25ed('0x3f')](handleError(_0x2e7de5,null));};exports['show']=function(_0x32625a,_0x235778){var _0x5d53dd={'raw':!![],'where':{'id':_0x32625a[_0x25ed('0x40')]['id']}},_0x3070c9={};_0x3070c9['model']=_[_0x25ed('0x2d')](db[_0x25ed('0x27')][_0x25ed('0x28')]);_0x3070c9['query']=_[_0x25ed('0x2d')](_0x32625a['query']);_0x3070c9['filters']=_[_0x25ed('0x31')](_0x3070c9[_0x25ed('0x2c')],_0x3070c9[_0x25ed('0x2e')]);_0x5d53dd['attributes']=_[_0x25ed('0x31')](_0x3070c9[_0x25ed('0x2c')],qs[_0x25ed('0x32')](_0x32625a[_0x25ed('0x2e')][_0x25ed('0x32')]));_0x5d53dd[_0x25ed('0x30')]=_0x5d53dd[_0x25ed('0x30')]['length']?_0x5d53dd['attributes']:_0x3070c9[_0x25ed('0x2c')];if(_0x32625a[_0x25ed('0x2e')][_0x25ed('0x3c')]){_0x5d53dd[_0x25ed('0x3d')]=[{'all':!![]}];}_0x5d53dd=_['merge']({},_0x5d53dd,_0x32625a[_0x25ed('0x3b')]);return db[_0x25ed('0x27')]['find'](_0x5d53dd)[_0x25ed('0x21')](handleEntityNotFound(_0x235778,null))['then'](respondWithResult(_0x235778,null))['catch'](handleError(_0x235778,null));};exports[_0x25ed('0x41')]=function(_0x575f84,_0x2d8b64){return db['MailQueueReport']['create'](_0x575f84[_0x25ed('0x42')],{})[_0x25ed('0x21')](respondWithResult(_0x2d8b64,0xc9))['catch'](handleError(_0x2d8b64,null));};exports[_0x25ed('0x20')]=function(_0x14aaab,_0x56a572){if(_0x14aaab['body']['id']){delete _0x14aaab[_0x25ed('0x42')]['id'];}return db[_0x25ed('0x27')]['find']({'where':{'id':_0x14aaab[_0x25ed('0x40')]['id']}})[_0x25ed('0x21')](handleEntityNotFound(_0x56a572,null))[_0x25ed('0x21')](saveUpdates(_0x14aaab['body'],null))[_0x25ed('0x21')](respondWithResult(_0x56a572,null))[_0x25ed('0x3f')](handleError(_0x56a572,null));};exports[_0x25ed('0x22')]=function(_0x140954,_0x5a6d45){return db[_0x25ed('0x27')][_0x25ed('0x43')]({'where':{'id':_0x140954['params']['id']}})[_0x25ed('0x21')](handleEntityNotFound(_0x5a6d45,null))[_0x25ed('0x21')](removeEntity(_0x5a6d45,null))['catch'](handleError(_0x5a6d45,null));};exports['describe']=function(_0x423ca2,_0x4ab6e1){return db[_0x25ed('0x27')]['describe']()[_0x25ed('0x21')](respondWithResult(_0x4ab6e1,null))[_0x25ed('0x3f')](handleError(_0x4ab6e1,null));}; \ No newline at end of file +var _0xf8ca=['offset','limit','save','update','then','destroy','error','name','send','index','map','MailQueueReport','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','show','rawAttributes','options','catch','create','body','params','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xf8ca,0x1be));var _0xaf8c=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xf8ca[_0x1573ea];return _0x51c0e2;};'use strict';var pdf=require(_0xaf8c('0x0'));var emlformat=require(_0xaf8c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaf8c('0x2'));var jsonpatch=require(_0xaf8c('0x3'));var rp=require(_0xaf8c('0x4'));var moment=require(_0xaf8c('0x5'));var BPromise=require(_0xaf8c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaf8c('0x7'));var sox=require(_0xaf8c('0x8'));var csv=require(_0xaf8c('0x9'));var ejs=require(_0xaf8c('0xa'));var fs=require('fs');var _=require(_0xaf8c('0xb'));var squel=require(_0xaf8c('0xc'));var crypto=require(_0xaf8c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaf8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf8c('0xf'));var Papa=require(_0xaf8c('0x10'));var Redis=require('ioredis');var authService=require(_0xaf8c('0x11'));var qs=require(_0xaf8c('0x12'));var as=require(_0xaf8c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf8c('0x14'))(_0xaf8c('0x15'));var utils=require(_0xaf8c('0x16'));var config=require(_0xaf8c('0x17'));var db=require(_0xaf8c('0x18'))['db'];function respondWithStatusCode(_0x511b80,_0x3b0f24){_0x3b0f24=_0x3b0f24||0xcc;return function(_0x1cc52d){if(_0x1cc52d){return _0x511b80[_0xaf8c('0x19')](_0x3b0f24);}return _0x511b80[_0xaf8c('0x1a')](_0x3b0f24)[_0xaf8c('0x1b')]();};}function respondWithResult(_0x3d6156,_0x1f97ad){_0x1f97ad=_0x1f97ad||0xc8;return function(_0x37c9fd){if(_0x37c9fd){return _0x3d6156[_0xaf8c('0x1a')](_0x1f97ad)[_0xaf8c('0x1c')](_0x37c9fd);}};}function respondWithFilteredResult(_0x345a03,_0x42d39f){return function(_0x36ff9e){if(_0x36ff9e){var _0x59f77c=_0x36ff9e[_0xaf8c('0x1d')],_0x2b6adb=_0x42d39f['offset'],_0x20d7b1=_0x42d39f[_0xaf8c('0x1e')]+_0x42d39f[_0xaf8c('0x1f')],_0x4af6fe;if(_0x20d7b1>=_0x59f77c){_0x20d7b1=_0x59f77c;_0x4af6fe=0xc8;}else{_0x4af6fe=0xce;}_0x345a03[_0xaf8c('0x1a')](_0x4af6fe);return _0x345a03['set']('Content-Range',_0x2b6adb+'-'+_0x20d7b1+'/'+_0x59f77c)[_0xaf8c('0x1c')](_0x36ff9e);}return null;};}function patchUpdates(_0x422f69){return function(_0x3ab52f){try{jsonpatch['apply'](_0x3ab52f,_0x422f69,!![]);}catch(_0x29353a){return BPromise['reject'](_0x29353a);}return _0x3ab52f[_0xaf8c('0x20')]();};}function saveUpdates(_0x29f344,_0x431e34){return function(_0x58d123){if(_0x58d123){return _0x58d123[_0xaf8c('0x21')](_0x29f344)[_0xaf8c('0x22')](function(_0x4cf3e4){return _0x4cf3e4;});}return null;};}function removeEntity(_0x32a7ad,_0x6a0b08){return function(_0xc827a9){if(_0xc827a9){return _0xc827a9[_0xaf8c('0x23')]()[_0xaf8c('0x22')](function(){_0x32a7ad[_0xaf8c('0x1a')](0xcc)[_0xaf8c('0x1b')]();});}};}function handleEntityNotFound(_0x5c0903,_0x504b06){return function(_0x193489){if(!_0x193489){_0x5c0903[_0xaf8c('0x19')](0x194);}return _0x193489;};}function handleError(_0x533ad8,_0x2e3581){_0x2e3581=_0x2e3581||0x1f4;return function(_0x4ea40e){logger[_0xaf8c('0x24')](_0x4ea40e['stack']);if(_0x4ea40e['name']){delete _0x4ea40e[_0xaf8c('0x25')];}_0x533ad8[_0xaf8c('0x1a')](_0x2e3581)[_0xaf8c('0x26')](_0x4ea40e);};}exports[_0xaf8c('0x27')]=function(_0x1840b2,_0xf657f7){var _0x4f20ab={},_0xb7ffe3={},_0xac6c8c={'count':0x0,'rows':[]};var _0x5aa04b=_[_0xaf8c('0x28')](db[_0xaf8c('0x29')]['rawAttributes'],function(_0x541888){return{'name':_0x541888['fieldName'],'type':_0x541888['type']['key']};});_0xb7ffe3[_0xaf8c('0x2a')]=_[_0xaf8c('0x28')](_0x5aa04b,_0xaf8c('0x25'));_0xb7ffe3[_0xaf8c('0x2b')]=_[_0xaf8c('0x2c')](_0x1840b2[_0xaf8c('0x2b')]);_0xb7ffe3['filters']=_['intersection'](_0xb7ffe3[_0xaf8c('0x2a')],_0xb7ffe3[_0xaf8c('0x2b')]);_0x4f20ab['attributes']=_[_0xaf8c('0x2d')](_0xb7ffe3['model'],qs[_0xaf8c('0x2e')](_0x1840b2['query'][_0xaf8c('0x2e')]));_0x4f20ab['attributes']=_0x4f20ab[_0xaf8c('0x2f')][_0xaf8c('0x30')]?_0x4f20ab['attributes']:_0xb7ffe3['model'];if(!_0x1840b2[_0xaf8c('0x2b')]['hasOwnProperty'](_0xaf8c('0x31'))){_0x4f20ab['limit']=qs[_0xaf8c('0x1f')](_0x1840b2['query'][_0xaf8c('0x1f')]);_0x4f20ab['offset']=qs['offset'](_0x1840b2[_0xaf8c('0x2b')][_0xaf8c('0x1e')]);}_0x4f20ab['order']=qs[_0xaf8c('0x32')](_0x1840b2['query'][_0xaf8c('0x32')]);_0x4f20ab[_0xaf8c('0x33')]=qs[_0xaf8c('0x34')](_[_0xaf8c('0x35')](_0x1840b2[_0xaf8c('0x2b')],_0xb7ffe3['filters']),_0x5aa04b);if(_0x1840b2[_0xaf8c('0x2b')][_0xaf8c('0x36')]){_0x4f20ab[_0xaf8c('0x33')]=_[_0xaf8c('0x37')](_0x4f20ab[_0xaf8c('0x33')],{'$or':_[_0xaf8c('0x28')](_0x5aa04b,function(_0x56953e){if(_0x56953e[_0xaf8c('0x38')]!=='VIRTUAL'){var _0x3ea884={};_0x3ea884[_0x56953e[_0xaf8c('0x25')]]={'$like':'%'+_0x1840b2[_0xaf8c('0x2b')]['filter']+'%'};return _0x3ea884;}})});}_0x4f20ab=_['merge']({},_0x4f20ab,_0x1840b2['options']);var _0x80d3c9={'where':_0x4f20ab[_0xaf8c('0x33')]};return db[_0xaf8c('0x29')][_0xaf8c('0x1d')](_0x80d3c9)[_0xaf8c('0x22')](function(_0x1dba7c){_0xac6c8c[_0xaf8c('0x1d')]=_0x1dba7c;if(_0x1840b2['query'][_0xaf8c('0x39')]){_0x4f20ab[_0xaf8c('0x3a')]=[{'all':!![]}];}return db[_0xaf8c('0x29')]['findAll'](_0x4f20ab);})[_0xaf8c('0x22')](function(_0x265ca7){_0xac6c8c['rows']=_0x265ca7;return _0xac6c8c;})[_0xaf8c('0x22')](respondWithFilteredResult(_0xf657f7,_0x4f20ab))['catch'](handleError(_0xf657f7,null));};exports[_0xaf8c('0x3b')]=function(_0x31214e,_0x3c38e1){var _0x3c83eb={'raw':!![],'where':{'id':_0x31214e['params']['id']}},_0x556e73={};_0x556e73[_0xaf8c('0x2a')]=_[_0xaf8c('0x2c')](db[_0xaf8c('0x29')][_0xaf8c('0x3c')]);_0x556e73[_0xaf8c('0x2b')]=_['keys'](_0x31214e[_0xaf8c('0x2b')]);_0x556e73[_0xaf8c('0x34')]=_[_0xaf8c('0x2d')](_0x556e73[_0xaf8c('0x2a')],_0x556e73[_0xaf8c('0x2b')]);_0x3c83eb[_0xaf8c('0x2f')]=_[_0xaf8c('0x2d')](_0x556e73[_0xaf8c('0x2a')],qs[_0xaf8c('0x2e')](_0x31214e[_0xaf8c('0x2b')][_0xaf8c('0x2e')]));_0x3c83eb[_0xaf8c('0x2f')]=_0x3c83eb['attributes'][_0xaf8c('0x30')]?_0x3c83eb[_0xaf8c('0x2f')]:_0x556e73[_0xaf8c('0x2a')];if(_0x31214e[_0xaf8c('0x2b')][_0xaf8c('0x39')]){_0x3c83eb[_0xaf8c('0x3a')]=[{'all':!![]}];}_0x3c83eb=_[_0xaf8c('0x37')]({},_0x3c83eb,_0x31214e[_0xaf8c('0x3d')]);return db['MailQueueReport']['find'](_0x3c83eb)[_0xaf8c('0x22')](handleEntityNotFound(_0x3c38e1,null))['then'](respondWithResult(_0x3c38e1,null))[_0xaf8c('0x3e')](handleError(_0x3c38e1,null));};exports[_0xaf8c('0x3f')]=function(_0x69556a,_0x4da3e1){return db[_0xaf8c('0x29')][_0xaf8c('0x3f')](_0x69556a[_0xaf8c('0x40')],{})[_0xaf8c('0x22')](respondWithResult(_0x4da3e1,0xc9))['catch'](handleError(_0x4da3e1,null));};exports[_0xaf8c('0x21')]=function(_0x343225,_0x270504){if(_0x343225[_0xaf8c('0x40')]['id']){delete _0x343225[_0xaf8c('0x40')]['id'];}return db[_0xaf8c('0x29')]['find']({'where':{'id':_0x343225[_0xaf8c('0x41')]['id']}})[_0xaf8c('0x22')](handleEntityNotFound(_0x270504,null))[_0xaf8c('0x22')](saveUpdates(_0x343225[_0xaf8c('0x40')],null))[_0xaf8c('0x22')](respondWithResult(_0x270504,null))[_0xaf8c('0x3e')](handleError(_0x270504,null));};exports[_0xaf8c('0x23')]=function(_0x483995,_0x4daa90){return db[_0xaf8c('0x29')][_0xaf8c('0x42')]({'where':{'id':_0x483995[_0xaf8c('0x41')]['id']}})[_0xaf8c('0x22')](handleEntityNotFound(_0x4daa90,null))[_0xaf8c('0x22')](removeEntity(_0x4daa90,null))['catch'](handleError(_0x4daa90,null));};exports[_0xaf8c('0x43')]=function(_0x3deaa4,_0x1f06fa){return db[_0xaf8c('0x29')][_0xaf8c('0x43')]()[_0xaf8c('0x22')](respondWithResult(_0x1f06fa,null))[_0xaf8c('0x3e')](handleError(_0x1f06fa,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 5a5201d..bcbf541 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 _0xaac4=['exports','define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x4c8b6d,_0x17d3f3){var _0x527bf8=function(_0x4fa366){while(--_0x4fa366){_0x4c8b6d['push'](_0x4c8b6d['shift']());}};_0x527bf8(++_0x17d3f3);}(_0xaac4,0x6c));var _0x4aac=function(_0x3818c0,_0x542521){_0x3818c0=_0x3818c0-0x0;var _0x55ec33=_0xaac4[_0x3818c0];return _0x55ec33;};'use strict';var _=require(_0x4aac('0x0'));var util=require(_0x4aac('0x1'));var logger=require('../../config/logger')(_0x4aac('0x2'));var moment=require(_0x4aac('0x3'));var BPromise=require(_0x4aac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4aac('0x5'));var rimraf=require(_0x4aac('0x6'));var config=require(_0x4aac('0x7'));var attributes=require(_0x4aac('0x8'));module[_0x4aac('0x9')]=function(_0x4c94f2,_0x2d795c){return _0x4c94f2[_0x4aac('0xa')](_0x4aac('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4aac('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c77=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','util','../../config/logger','api'];(function(_0x2a378c,_0x7f0bc4){var _0x5ee673=function(_0x10b5f1){while(--_0x10b5f1){_0x2a378c['push'](_0x2a378c['shift']());}};_0x5ee673(++_0x7f0bc4);}(_0x1c77,0xed));var _0x71c7=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x1c77[_0x413aac];return _0x569b11;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var logger=require(_0x71c7('0x1'))(_0x71c7('0x2'));var moment=require(_0x71c7('0x3'));var BPromise=require(_0x71c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c7('0x5'));var rimraf=require(_0x71c7('0x6'));var config=require(_0x71c7('0x7'));var attributes=require(_0x71c7('0x8'));module[_0x71c7('0x9')]=function(_0x1ee344,_0x2fb422){return _0x1ee344['define']('MailQueueReport',attributes,{'tableName':_0x71c7('0xa'),'paranoid':![],'indexes':[{'name':_0x71c7('0xb'),'fields':[_0x71c7('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 f92763f..6e3df84 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(_0x242ff0,_0x2f43b8){var _0xa16645=function(_0x341c5d){while(--_0x341c5d){_0x242ff0['push'](_0x242ff0['shift']());}};_0xa16645(++_0x2f43b8);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'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 _0x4137=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','CreateMailQueueReport','create','body','options','then','catch','UpdateMailQueueReport','MailQueueReport','update'];(function(_0x593f68,_0x39dc51){var _0x160833=function(_0x56557e){while(--_0x56557e){_0x593f68['push'](_0x593f68['shift']());}};_0x160833(++_0x39dc51);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['MailQueueReport'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7413('0x1b')](function(_0x12d94d){logger[_0x7413('0xe')](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x12d94d));_0x2a3417(_0x12d94d);})[_0x7413('0x1c')](function(_0x56a06a){logger['error'](_0x7413('0x17'),_0x56a06a['message'],_0x19157f);_0x26dafe(_0x12a01e[_0x7413('0x13')](0x1f4,_0x56a06a[_0x7413('0x16')]));});});};exports[_0x7413('0x1d')]=function(_0x2fc0f4){var _0x1d46e9=this;return new Promise(function(_0x346ce8,_0x1d97fd){return db[_0x7413('0x1e')][_0x7413('0x1f')](_0x2fc0f4['body'],{'raw':_0x2fc0f4['options']?_0x2fc0f4[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fc0f4[_0x7413('0x1a')]?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x20')]||null:null,'attributes':_0x2fc0f4['options']?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x21')]||null:null,'limit':_0x2fc0f4[_0x7413('0x1a')]?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x22')]||null:null})[_0x7413('0x1b')](function(_0x5eb4d9){logger[_0x7413('0xe')]('UpdateMailQueueReport',_0x2fc0f4);logger[_0x7413('0x10')](_0x7413('0x1d'),_0x2fc0f4,JSON[_0x7413('0x12')](_0x5eb4d9));_0x346ce8(_0x5eb4d9);})[_0x7413('0x1c')](function(_0x25fa52){logger[_0x7413('0x13')]('UpdateMailQueueReport',_0x25fa52[_0x7413('0x16')],_0x2fc0f4);_0x1d97fd(_0x1d46e9[_0x7413('0x13')](0x1f4,_0x25fa52[_0x7413('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 482f4bb..d1151b8 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 _0x89a6=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x1fabfb,_0x4c8925){var _0xca8d2b=function(_0x1bf104){while(--_0x1bf104){_0x1fabfb['push'](_0x1fabfb['shift']());}};_0xca8d2b(++_0x4c8925);}(_0x89a6,0x6a));var _0x689a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x89a6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x689a('0x0'));var util=require(_0x689a('0x1'));var path=require(_0x689a('0x2'));var timeout=require(_0x689a('0x3'));var express=require(_0x689a('0x4'));var router=express[_0x689a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x689a('0x6'));var config=require(_0x689a('0x7'));module[_0x689a('0x8')]=router; \ No newline at end of file +var _0x9f41=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3241fd,_0x17d8a6){var _0x4797c6=function(_0x2f4434){while(--_0x2f4434){_0x3241fd['push'](_0x3241fd['shift']());}};_0x4797c6(++_0x17d8a6);}(_0x9f41,0x18f));var _0x19f4=function(_0x107244,_0x6e77e2){_0x107244=_0x107244-0x0;var _0x10e351=_0x9f41[_0x107244];return _0x10e351;};'use strict';var multer=require(_0x19f4('0x0'));var util=require('util');var path=require(_0x19f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x19f4('0x2'));var router=express[_0x19f4('0x3')]();var auth=require(_0x19f4('0x4'));var interaction=require(_0x19f4('0x5'));var config=require(_0x19f4('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 ed756fd..776f816 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 _0x15d9=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN','username'];(function(_0x7b97cd,_0x44541a){var _0x26f8e9=function(_0x5c1525){while(--_0x5c1525){_0x7b97cd['push'](_0x7b97cd['shift']());}};_0x26f8e9(++_0x44541a);}(_0x15d9,0x1ec));var _0x915d=function(_0x2a19c1,_0x56d2cb){_0x2a19c1=_0x2a19c1-0x0;var _0x1b69e0=_0x15d9[_0x2a19c1];return _0x1b69e0;};'use strict';var Sequelize=require(_0x915d('0x0'));module[_0x915d('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x915d('0x2')]},'authentication':{'type':Sequelize[_0x915d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x915d('0x2')],'unique':_0x915d('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x915d('0x5')]},'tls':{'type':Sequelize[_0x915d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x915d('0x6')},'connTimeout':{'type':Sequelize[_0x915d('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x915d('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4cd9=['INTEGER','STRING','BOOLEAN','username'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x4cd9,0x129));var _0x94cd=function(_0x432f37,_0x2488b3){_0x432f37=_0x432f37-0x0;var _0x4e4b34=_0x4cd9[_0x432f37];return _0x4e4b34;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x94cd('0x0')]},'host':{'type':Sequelize[_0x94cd('0x0')]},'authentication':{'type':Sequelize[_0x94cd('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x94cd('0x0')],'unique':_0x94cd('0x2')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x94cd('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x94cd('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x94cd('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x94cd('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 787d6ff..3e7fa89 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 _0x6ec2=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','mail_servers_in'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0x6ec2,0x78));var _0x26ec=function(_0x3014fc,_0x5925bc){_0x3014fc=_0x3014fc-0x0;var _0x1928f7=_0x6ec2[_0x3014fc];return _0x1928f7;};'use strict';var _=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var logger=require(_0x26ec('0x2'))(_0x26ec('0x3'));var moment=require(_0x26ec('0x4'));var BPromise=require(_0x26ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26ec('0x6'));var rimraf=require(_0x26ec('0x7'));var config=require(_0x26ec('0x8'));var attributes=require(_0x26ec('0x9'));module[_0x26ec('0xa')]=function(_0x4ce209,_0x3b5955){return _0x4ce209['define']('MailServerIn',attributes,{'tableName':_0x26ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2bb=['moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','api'];(function(_0x19fb2b,_0x212bd8){var _0x3be612=function(_0x264ede){while(--_0x264ede){_0x19fb2b['push'](_0x19fb2b['shift']());}};_0x3be612(++_0x212bd8);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x2f0c70,_0x5a90c1){_0x2f0c70=_0x2f0c70-0x0;var _0x1c4cd5=_0xd2bb[_0x2f0c70];return _0x1c4cd5;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 92acf62..aac3817 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 _0x8a18=['error','code','message','result','catch','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','GetMailServerIn','debug','lodash','util','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a18,0x91));var _0x88a1=function(_0x5a68b4,_0x18f2ba){_0x5a68b4=_0x5a68b4-0x0;var _0x20c0e3=_0x8a18[_0x5a68b4];return _0x20c0e3;};'use strict';var _=require(_0x88a1('0x0'));var util=require(_0x88a1('0x1'));var moment=require('moment');var BPromise=require(_0x88a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x88a1('0x4'));var logger=require('../../config/logger')(_0x88a1('0x5'));var config=require('../../config/environment');var jayson=require(_0x88a1('0x6'));var client=jayson[_0x88a1('0x7')][_0x88a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ec949,_0x1355db,_0x407432){return new BPromise(function(_0x454c39,_0x1e7e43){return client[_0x88a1('0x9')](_0x3ec949,_0x407432)['then'](function(_0x5a1633){logger[_0x88a1('0xa')](_0x88a1('0xb'),_0x1355db,_0x88a1('0xc'));logger['debug'](_0x88a1('0xd'),_0x1355db,_0x88a1('0xc'),JSON[_0x88a1('0xe')](_0x5a1633));if(_0x5a1633[_0x88a1('0xf')]){if(_0x5a1633[_0x88a1('0xf')][_0x88a1('0x10')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1355db,_0x5a1633[_0x88a1('0xf')]['message']);return _0x1e7e43(_0x5a1633['error'][_0x88a1('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x1355db,_0x5a1633[_0x88a1('0xf')][_0x88a1('0x11')]);return _0x454c39(_0x5a1633[_0x88a1('0xf')][_0x88a1('0x11')]);}else{logger['info'](_0x88a1('0xb'),_0x1355db,_0x88a1('0xc'));_0x454c39(_0x5a1633[_0x88a1('0x12')][_0x88a1('0x11')]);}})[_0x88a1('0x13')](function(_0x1641e4){logger[_0x88a1('0xf')](_0x88a1('0xb'),_0x1355db,_0x1641e4);_0x1e7e43(_0x1641e4);});});}exports['GetMailServerIn']=function(_0x52e7d5){var _0x480fa2=this;return new Promise(function(_0x2db2d8,_0x1531d3){return db[_0x88a1('0x14')][_0x88a1('0x15')]({'raw':_0x52e7d5[_0x88a1('0x16')]?_0x52e7d5[_0x88a1('0x16')][_0x88a1('0x17')]===undefined?!![]:![]:!![],'where':_0x52e7d5[_0x88a1('0x16')]?_0x52e7d5[_0x88a1('0x16')][_0x88a1('0x18')]||null:null,'attributes':_0x52e7d5[_0x88a1('0x16')]?_0x52e7d5['options']['attributes']||null:null,'limit':_0x52e7d5[_0x88a1('0x16')]?_0x52e7d5[_0x88a1('0x16')][_0x88a1('0x19')]||null:null,'include':_0x52e7d5[_0x88a1('0x16')]?_0x52e7d5['options'][_0x88a1('0x1a')]?_[_0x88a1('0x1b')](_0x52e7d5[_0x88a1('0x16')][_0x88a1('0x1a')],function(_0x3068d8){return{'model':db[_0x3068d8[_0x88a1('0x1c')]],'as':_0x3068d8['as'],'attributes':_0x3068d8[_0x88a1('0x1d')],'include':_0x3068d8['include']?_[_0x88a1('0x1b')](_0x3068d8['include'],function(_0x2badf7){return{'model':db[_0x2badf7[_0x88a1('0x1c')]],'as':_0x2badf7['as'],'attributes':_0x2badf7['attributes'],'include':_0x2badf7[_0x88a1('0x1a')]?_[_0x88a1('0x1b')](_0x2badf7[_0x88a1('0x1a')],function(_0x2927ef){return{'model':db[_0x2927ef[_0x88a1('0x1c')]],'as':_0x2927ef['as'],'attributes':_0x2927ef[_0x88a1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29787a){logger[_0x88a1('0xa')](_0x88a1('0x1e'),_0x52e7d5);logger[_0x88a1('0x1f')](_0x88a1('0x1e'),_0x52e7d5,JSON[_0x88a1('0xe')](_0x29787a));_0x2db2d8(_0x29787a);})[_0x88a1('0x13')](function(_0x1e43b6){logger[_0x88a1('0xf')](_0x88a1('0x1e'),_0x1e43b6['message'],_0x52e7d5);_0x1531d3(_0x480fa2[_0x88a1('0xf')](0x1f4,_0x1e43b6[_0x88a1('0x11')]));});});}; \ No newline at end of file +var _0x1d03=['map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1d03,0xef));var _0x31d0=function(_0x2d5b1a,_0x10b4ed){_0x2d5b1a=_0x2d5b1a-0x0;var _0x1f4671=_0x1d03[_0x2d5b1a];return _0x1f4671;};'use strict';var _=require(_0x31d0('0x0'));var util=require(_0x31d0('0x1'));var moment=require(_0x31d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x31d0('0x3'));var fs=require('fs');var Redis=require(_0x31d0('0x4'));var db=require(_0x31d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x31d0('0x6'))(_0x31d0('0x7'));var config=require(_0x31d0('0x8'));var jayson=require(_0x31d0('0x9'));var client=jayson[_0x31d0('0xa')][_0x31d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22651a,_0x4aef44,_0x2ab95c){return new BPromise(function(_0x15b510,_0x49b846){return client['request'](_0x22651a,_0x2ab95c)[_0x31d0('0xc')](function(_0x315f68){logger[_0x31d0('0xd')](_0x31d0('0xe'),_0x4aef44,'request\x20sent');logger[_0x31d0('0xf')](_0x31d0('0x10'),_0x4aef44,_0x31d0('0x11'),JSON[_0x31d0('0x12')](_0x315f68));if(_0x315f68[_0x31d0('0x13')]){if(_0x315f68['error'][_0x31d0('0x14')]===0x1f4){logger[_0x31d0('0x13')](_0x31d0('0xe'),_0x4aef44,_0x315f68[_0x31d0('0x13')][_0x31d0('0x15')]);return _0x49b846(_0x315f68[_0x31d0('0x13')][_0x31d0('0x15')]);}logger[_0x31d0('0x13')](_0x31d0('0xe'),_0x4aef44,_0x315f68[_0x31d0('0x13')][_0x31d0('0x15')]);return _0x15b510(_0x315f68[_0x31d0('0x13')][_0x31d0('0x15')]);}else{logger[_0x31d0('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4aef44,_0x31d0('0x11'));_0x15b510(_0x315f68[_0x31d0('0x16')]['message']);}})[_0x31d0('0x17')](function(_0x5e766f){logger['error'](_0x31d0('0xe'),_0x4aef44,_0x5e766f);_0x49b846(_0x5e766f);});});}exports[_0x31d0('0x18')]=function(_0xdf45ab){var _0x44c0a3=this;return new Promise(function(_0x4be46b,_0x25a5d5){return db['MailServerIn'][_0x31d0('0x19')]({'raw':_0xdf45ab[_0x31d0('0x1a')]?_0xdf45ab['options'][_0x31d0('0x1b')]===undefined?!![]:![]:!![],'where':_0xdf45ab[_0x31d0('0x1a')]?_0xdf45ab[_0x31d0('0x1a')][_0x31d0('0x1c')]||null:null,'attributes':_0xdf45ab['options']?_0xdf45ab[_0x31d0('0x1a')][_0x31d0('0x1d')]||null:null,'limit':_0xdf45ab['options']?_0xdf45ab[_0x31d0('0x1a')][_0x31d0('0x1e')]||null:null,'include':_0xdf45ab[_0x31d0('0x1a')]?_0xdf45ab['options'][_0x31d0('0x1f')]?_['map'](_0xdf45ab[_0x31d0('0x1a')][_0x31d0('0x1f')],function(_0x368289){return{'model':db[_0x368289[_0x31d0('0x20')]],'as':_0x368289['as'],'attributes':_0x368289['attributes'],'include':_0x368289['include']?_[_0x31d0('0x21')](_0x368289[_0x31d0('0x1f')],function(_0x3abe93){return{'model':db[_0x3abe93[_0x31d0('0x20')]],'as':_0x3abe93['as'],'attributes':_0x3abe93[_0x31d0('0x1d')],'include':_0x3abe93[_0x31d0('0x1f')]?_[_0x31d0('0x21')](_0x3abe93[_0x31d0('0x1f')],function(_0x357aee){return{'model':db[_0x357aee[_0x31d0('0x20')]],'as':_0x357aee['as'],'attributes':_0x357aee[_0x31d0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x31d0('0xc')](function(_0x1200a1){logger[_0x31d0('0xd')](_0x31d0('0x18'),_0xdf45ab);logger[_0x31d0('0xf')](_0x31d0('0x18'),_0xdf45ab,JSON['stringify'](_0x1200a1));_0x4be46b(_0x1200a1);})[_0x31d0('0x17')](function(_0x42b2ba){logger['error'](_0x31d0('0x18'),_0x42b2ba[_0x31d0('0x15')],_0xdf45ab);_0x25a5d5(_0x44c0a3[_0x31d0('0x13')](0x1f4,_0x42b2ba[_0x31d0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index dd3bd61..70100b5 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 _0xd928=['create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','post','isAuthenticated'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0xd928,0x18c));var _0x8d92=function(_0x1027ba,_0x16741d){_0x1027ba=_0x1027ba-0x0;var _0x3950be=_0xd928[_0x1027ba];return _0x3950be;};'use strict';var multer=require(_0x8d92('0x0'));var util=require(_0x8d92('0x1'));var path=require(_0x8d92('0x2'));var timeout=require(_0x8d92('0x3'));var express=require(_0x8d92('0x4'));var router=express[_0x8d92('0x5')]();var auth=require(_0x8d92('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8d92('0x7'));var controller=require(_0x8d92('0x8'));router[_0x8d92('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8d92('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8d92('0xa')]('/',auth[_0x8d92('0xb')](),controller[_0x8d92('0xc')]);router['put'](_0x8d92('0xd'),auth[_0x8d92('0xb')](),controller[_0x8d92('0xe')]);router['delete']('/:id',auth[_0x8d92('0xb')](),controller[_0x8d92('0xf')]);module[_0x8d92('0x10')]=router; \ No newline at end of file +var _0xd865=['destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./mailServerOut.controller','index','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x1aaf59,_0x5e3cb4){var _0x2fd689=function(_0x8e7487){while(--_0x8e7487){_0x1aaf59['push'](_0x1aaf59['shift']());}};_0x2fd689(++_0x5e3cb4);}(_0xd865,0x19a));var _0x5d86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd865[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5d86('0x0'));var util=require('util');var path=require(_0x5d86('0x1'));var timeout=require(_0x5d86('0x2'));var express=require('express');var router=express[_0x5d86('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5d86('0x4'));var config=require('../../config/environment');var controller=require(_0x5d86('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d86('0x6')]);router[_0x5d86('0x7')](_0x5d86('0x8'),auth[_0x5d86('0x9')](),controller[_0x5d86('0xa')]);router[_0x5d86('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5d86('0xc')](_0x5d86('0x8'),auth[_0x5d86('0x9')](),controller[_0x5d86('0xd')]);router[_0x5d86('0xe')](_0x5d86('0x8'),auth[_0x5d86('0x9')](),controller[_0x5d86('0xf')]);module[_0x5d86('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 7a2970a..c42f045 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 _0x13f5=['exports','STRING','BOOLEAN','sequelize'];(function(_0xbc86ec,_0x174672){var _0x5961dd=function(_0x564ac4){while(--_0x564ac4){_0xbc86ec['push'](_0xbc86ec['shift']());}};_0x5961dd(++_0x174672);}(_0x13f5,0xc3));var _0x513f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x13f5[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'description':{'type':Sequelize[_0x513f('0x2')]},'host':{'type':Sequelize[_0x513f('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x513f('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x513f('0x2')]},'authentication':{'type':Sequelize[_0x513f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x00cd=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x00cd,0xee));var _0xd00c=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x00cd[_0x1deb72];return _0x18bbdf;};'use strict';var Sequelize=require(_0xd00c('0x0'));module[_0xd00c('0x1')]={'description':{'type':Sequelize[_0xd00c('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xd00c('0x2')]},'port':{'type':Sequelize[_0xd00c('0x3')]},'secure':{'type':Sequelize[_0xd00c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xd00c('0x2')]},'authentication':{'type':Sequelize[_0xd00c('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 0af407c..c7c4ddf 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 _0x2dac=['end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','fields','length','attributes','order','sort','where','filter','merge','VIRTUAL','options','MailServerOut','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3aed97,_0x11ca9f){var _0x367fc0=function(_0x34a927){while(--_0x34a927){_0x3aed97['push'](_0x3aed97['shift']());}};_0x367fc0(++_0x11ca9f);}(_0x2dac,0x107));var _0xc2da=function(_0x4555f2,_0x50a9b6){_0x4555f2=_0x4555f2-0x0;var _0x155ccd=_0x2dac[_0x4555f2];return _0x155ccd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2da('0x0'));var rimraf=require(_0xc2da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2da('0x2'));var rp=require(_0xc2da('0x3'));var moment=require(_0xc2da('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc2da('0x5'));var sox=require(_0xc2da('0x6'));var csv=require(_0xc2da('0x7'));var ejs=require(_0xc2da('0x8'));var fs=require('fs');var _=require(_0xc2da('0x9'));var squel=require(_0xc2da('0xa'));var crypto=require(_0xc2da('0xb'));var jsforce=require(_0xc2da('0xc'));var deskjs=require(_0xc2da('0xd'));var toCsv=require(_0xc2da('0x7'));var querystring=require(_0xc2da('0xe'));var Papa=require(_0xc2da('0xf'));var Redis=require('ioredis');var authService=require(_0xc2da('0x10'));var qs=require(_0xc2da('0x11'));var as=require(_0xc2da('0x12'));var hardwareService=require(_0xc2da('0x13'));var logger=require(_0xc2da('0x14'))(_0xc2da('0x15'));var utils=require('../../config/utils');var config=require(_0xc2da('0x16'));var db=require(_0xc2da('0x17'))['db'];function respondWithStatusCode(_0x475e35,_0x4491f5){_0x4491f5=_0x4491f5||0xcc;return function(_0x1c560d){if(_0x1c560d){return _0x475e35[_0xc2da('0x18')](_0x4491f5);}return _0x475e35['status'](_0x4491f5)[_0xc2da('0x19')]();};}function respondWithResult(_0x56375e,_0x23f55c){_0x23f55c=_0x23f55c||0xc8;return function(_0x38b474){if(_0x38b474){return _0x56375e[_0xc2da('0x1a')](_0x23f55c)[_0xc2da('0x1b')](_0x38b474);}};}function respondWithFilteredResult(_0x5ce9a3,_0x19ff55){return function(_0xc3a2bc){if(_0xc3a2bc){var _0x2b1b7e=_0xc3a2bc['count'],_0x44dc4d=_0x19ff55[_0xc2da('0x1c')],_0x4a25c9=_0x19ff55['offset']+_0x19ff55[_0xc2da('0x1d')],_0xe373b3;if(_0x4a25c9>=_0x2b1b7e){_0x4a25c9=_0x2b1b7e;_0xe373b3=0xc8;}else{_0xe373b3=0xce;}_0x5ce9a3[_0xc2da('0x1a')](_0xe373b3);return _0x5ce9a3[_0xc2da('0x1e')](_0xc2da('0x1f'),_0x44dc4d+'-'+_0x4a25c9+'/'+_0x2b1b7e)[_0xc2da('0x1b')](_0xc3a2bc);}return null;};}function patchUpdates(_0x28d9d2){return function(_0x3d4053){try{jsonpatch[_0xc2da('0x20')](_0x3d4053,_0x28d9d2,!![]);}catch(_0x42182d){return BPromise[_0xc2da('0x21')](_0x42182d);}return _0x3d4053['save']();};}function saveUpdates(_0x314bb6,_0x122e4b){return function(_0x3329f4){if(_0x3329f4){return _0x3329f4[_0xc2da('0x22')](_0x314bb6)['then'](function(_0x3d575f){return _0x3d575f;});}return null;};}function removeEntity(_0x255c26,_0x57d563){return function(_0x51b7d3){if(_0x51b7d3){return _0x51b7d3[_0xc2da('0x23')]()[_0xc2da('0x24')](function(){_0x255c26['status'](0xcc)[_0xc2da('0x19')]();});}};}function handleEntityNotFound(_0x2d7d04,_0x4c426){return function(_0x10830e){if(!_0x10830e){_0x2d7d04[_0xc2da('0x18')](0x194);}return _0x10830e;};}function handleError(_0x148053,_0x470fd6){_0x470fd6=_0x470fd6||0x1f4;return function(_0x477c76){logger[_0xc2da('0x25')](_0x477c76['stack']);if(_0x477c76[_0xc2da('0x26')]){delete _0x477c76['name'];}_0x148053[_0xc2da('0x1a')](_0x470fd6)[_0xc2da('0x27')](_0x477c76);};}exports[_0xc2da('0x28')]=function(_0x1fa184,_0x17dfeb){var _0x21c995={},_0x4b5399={},_0x516b95={'count':0x0,'rows':[]};var _0x1c603b=_[_0xc2da('0x29')](db['MailServerOut']['rawAttributes'],function(_0x512861){return{'name':_0x512861[_0xc2da('0x2a')],'type':_0x512861[_0xc2da('0x2b')]['key']};});_0x4b5399[_0xc2da('0x2c')]=_[_0xc2da('0x29')](_0x1c603b,_0xc2da('0x26'));_0x4b5399['query']=_[_0xc2da('0x2d')](_0x1fa184[_0xc2da('0x2e')]);_0x4b5399[_0xc2da('0x2f')]=_[_0xc2da('0x30')](_0x4b5399[_0xc2da('0x2c')],_0x4b5399['query']);_0x21c995['attributes']=_['intersection'](_0x4b5399[_0xc2da('0x2c')],qs[_0xc2da('0x31')](_0x1fa184[_0xc2da('0x2e')][_0xc2da('0x31')]));_0x21c995['attributes']=_0x21c995['attributes'][_0xc2da('0x32')]?_0x21c995[_0xc2da('0x33')]:_0x4b5399[_0xc2da('0x2c')];if(!_0x1fa184['query']['hasOwnProperty']('nolimit')){_0x21c995[_0xc2da('0x1d')]=qs[_0xc2da('0x1d')](_0x1fa184[_0xc2da('0x2e')][_0xc2da('0x1d')]);_0x21c995[_0xc2da('0x1c')]=qs['offset'](_0x1fa184[_0xc2da('0x2e')][_0xc2da('0x1c')]);}_0x21c995[_0xc2da('0x34')]=qs[_0xc2da('0x35')](_0x1fa184[_0xc2da('0x2e')]['sort']);_0x21c995[_0xc2da('0x36')]=qs[_0xc2da('0x2f')](_['pick'](_0x1fa184[_0xc2da('0x2e')],_0x4b5399['filters']),_0x1c603b);if(_0x1fa184[_0xc2da('0x2e')][_0xc2da('0x37')]){_0x21c995[_0xc2da('0x36')]=_[_0xc2da('0x38')](_0x21c995[_0xc2da('0x36')],{'$or':_[_0xc2da('0x29')](_0x1c603b,function(_0x1b88aa){if(_0x1b88aa['type']!==_0xc2da('0x39')){var _0x513199={};_0x513199[_0x1b88aa[_0xc2da('0x26')]]={'$like':'%'+_0x1fa184[_0xc2da('0x2e')]['filter']+'%'};return _0x513199;}})});}_0x21c995=_[_0xc2da('0x38')]({},_0x21c995,_0x1fa184[_0xc2da('0x3a')]);var _0x15b533={'where':_0x21c995[_0xc2da('0x36')]};return db[_0xc2da('0x3b')]['count'](_0x15b533)[_0xc2da('0x24')](function(_0x494e15){_0x516b95[_0xc2da('0x3c')]=_0x494e15;if(_0x1fa184[_0xc2da('0x2e')][_0xc2da('0x3d')]){_0x21c995[_0xc2da('0x3e')]=[{'all':!![]}];}return db[_0xc2da('0x3b')][_0xc2da('0x3f')](_0x21c995);})[_0xc2da('0x24')](function(_0x46ecb6){_0x516b95[_0xc2da('0x40')]=_0x46ecb6;return _0x516b95;})[_0xc2da('0x24')](respondWithFilteredResult(_0x17dfeb,_0x21c995))[_0xc2da('0x41')](handleError(_0x17dfeb,null));};exports[_0xc2da('0x42')]=function(_0x554ecf,_0x48eecc){var _0x2e800e={'raw':!![],'where':{'id':_0x554ecf[_0xc2da('0x43')]['id']}},_0x4a14a4={};_0x4a14a4[_0xc2da('0x2c')]=_['keys'](db[_0xc2da('0x3b')][_0xc2da('0x44')]);_0x4a14a4['query']=_[_0xc2da('0x2d')](_0x554ecf['query']);_0x4a14a4[_0xc2da('0x2f')]=_[_0xc2da('0x30')](_0x4a14a4[_0xc2da('0x2c')],_0x4a14a4[_0xc2da('0x2e')]);_0x2e800e[_0xc2da('0x33')]=_['intersection'](_0x4a14a4['model'],qs[_0xc2da('0x31')](_0x554ecf[_0xc2da('0x2e')][_0xc2da('0x31')]));_0x2e800e['attributes']=_0x2e800e[_0xc2da('0x33')][_0xc2da('0x32')]?_0x2e800e[_0xc2da('0x33')]:_0x4a14a4[_0xc2da('0x2c')];if(_0x554ecf[_0xc2da('0x2e')][_0xc2da('0x3d')]){_0x2e800e[_0xc2da('0x3e')]=[{'all':!![]}];}_0x2e800e=_[_0xc2da('0x38')]({},_0x2e800e,_0x554ecf[_0xc2da('0x3a')]);return db[_0xc2da('0x3b')][_0xc2da('0x45')](_0x2e800e)['then'](handleEntityNotFound(_0x48eecc,null))[_0xc2da('0x24')](respondWithResult(_0x48eecc,null))[_0xc2da('0x41')](handleError(_0x48eecc,null));};exports['create']=function(_0x420c38,_0x54dfae){return db[_0xc2da('0x3b')][_0xc2da('0x46')](_0x420c38[_0xc2da('0x47')],{})[_0xc2da('0x24')](respondWithResult(_0x54dfae,0xc9))[_0xc2da('0x41')](handleError(_0x54dfae,null));};exports[_0xc2da('0x22')]=function(_0x36bd73,_0x420f99){if(_0x36bd73[_0xc2da('0x47')]['id']){delete _0x36bd73[_0xc2da('0x47')]['id'];}return db['MailServerOut'][_0xc2da('0x45')]({'where':{'id':_0x36bd73[_0xc2da('0x43')]['id']}})[_0xc2da('0x24')](handleEntityNotFound(_0x420f99,null))[_0xc2da('0x24')](saveUpdates(_0x36bd73[_0xc2da('0x47')],null))[_0xc2da('0x24')](respondWithResult(_0x420f99,null))[_0xc2da('0x41')](handleError(_0x420f99,null));};exports['destroy']=function(_0x230eb5,_0x57a88e){return db['MailServerOut'][_0xc2da('0x45')]({'where':{'id':_0x230eb5[_0xc2da('0x43')]['id']}})[_0xc2da('0x24')](handleEntityNotFound(_0x57a88e,null))[_0xc2da('0x24')](removeEntity(_0x57a88e,null))['catch'](handleError(_0x57a88e,null));}; \ No newline at end of file +var _0xa412=['fieldName','type','key','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','model','keys','intersection','find','create','body','catch','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','error','name','index','MailServerOut','rawAttributes'];(function(_0x2b4667,_0x285ce1){var _0x39fc62=function(_0x5b5944){while(--_0x5b5944){_0x2b4667['push'](_0x2b4667['shift']());}};_0x39fc62(++_0x285ce1);}(_0xa412,0xa7));var _0x2a41=function(_0x106513,_0x19c8e0){_0x106513=_0x106513-0x0;var _0x144294=_0xa412[_0x106513];return _0x144294;};'use strict';var pdf=require(_0x2a41('0x0'));var emlformat=require(_0x2a41('0x1'));var rimraf=require(_0x2a41('0x2'));var zipdir=require(_0x2a41('0x3'));var jsonpatch=require(_0x2a41('0x4'));var rp=require(_0x2a41('0x5'));var moment=require(_0x2a41('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2a41('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2a41('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a41('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a41('0xa'));var deskjs=require(_0x2a41('0xb'));var toCsv=require(_0x2a41('0xc'));var querystring=require(_0x2a41('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a41('0xe'));var as=require(_0x2a41('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a41('0x10'));var utils=require(_0x2a41('0x11'));var config=require(_0x2a41('0x12'));var db=require(_0x2a41('0x13'))['db'];function respondWithStatusCode(_0xbf5263,_0x1daf60){_0x1daf60=_0x1daf60||0xcc;return function(_0x1bd621){if(_0x1bd621){return _0xbf5263[_0x2a41('0x14')](_0x1daf60);}return _0xbf5263[_0x2a41('0x15')](_0x1daf60)[_0x2a41('0x16')]();};}function respondWithResult(_0x3a367f,_0x3dcee3){_0x3dcee3=_0x3dcee3||0xc8;return function(_0x239ba9){if(_0x239ba9){return _0x3a367f[_0x2a41('0x15')](_0x3dcee3)['json'](_0x239ba9);}};}function respondWithFilteredResult(_0xfd12,_0x5ca50a){return function(_0xb4036f){if(_0xb4036f){var _0x2e6f0d=_0xb4036f[_0x2a41('0x17')],_0x2396f8=_0x5ca50a['offset'],_0x14ea80=_0x5ca50a[_0x2a41('0x18')]+_0x5ca50a[_0x2a41('0x19')],_0x964d32;if(_0x14ea80>=_0x2e6f0d){_0x14ea80=_0x2e6f0d;_0x964d32=0xc8;}else{_0x964d32=0xce;}_0xfd12[_0x2a41('0x15')](_0x964d32);return _0xfd12[_0x2a41('0x1a')](_0x2a41('0x1b'),_0x2396f8+'-'+_0x14ea80+'/'+_0x2e6f0d)[_0x2a41('0x1c')](_0xb4036f);}return null;};}function patchUpdates(_0xecdf55){return function(_0x27cff2){try{jsonpatch[_0x2a41('0x1d')](_0x27cff2,_0xecdf55,!![]);}catch(_0x2ca568){return BPromise[_0x2a41('0x1e')](_0x2ca568);}return _0x27cff2[_0x2a41('0x1f')]();};}function saveUpdates(_0x21775b,_0x3f1411){return function(_0xb2ef4a){if(_0xb2ef4a){return _0xb2ef4a['update'](_0x21775b)['then'](function(_0x98088d){return _0x98088d;});}return null;};}function removeEntity(_0x49c88d,_0x13ad82){return function(_0x257fa2){if(_0x257fa2){return _0x257fa2['destroy']()['then'](function(){_0x49c88d[_0x2a41('0x15')](0xcc)[_0x2a41('0x16')]();});}};}function handleEntityNotFound(_0x45e5da,_0xd7a07d){return function(_0x2afa61){if(!_0x2afa61){_0x45e5da[_0x2a41('0x14')](0x194);}return _0x2afa61;};}function handleError(_0xbc78b4,_0x569f8e){_0x569f8e=_0x569f8e||0x1f4;return function(_0x4c44d6){logger[_0x2a41('0x20')](_0x4c44d6['stack']);if(_0x4c44d6['name']){delete _0x4c44d6[_0x2a41('0x21')];}_0xbc78b4[_0x2a41('0x15')](_0x569f8e)['send'](_0x4c44d6);};}exports[_0x2a41('0x22')]=function(_0x5ccdb9,_0x4c48dc){var _0x2670ba={},_0x139dde={},_0x580b64={'count':0x0,'rows':[]};var _0x54c633=_['map'](db[_0x2a41('0x23')][_0x2a41('0x24')],function(_0x25d3d8){return{'name':_0x25d3d8[_0x2a41('0x25')],'type':_0x25d3d8[_0x2a41('0x26')][_0x2a41('0x27')]};});_0x139dde['model']=_[_0x2a41('0x28')](_0x54c633,'name');_0x139dde['query']=_['keys'](_0x5ccdb9[_0x2a41('0x29')]);_0x139dde[_0x2a41('0x2a')]=_['intersection'](_0x139dde['model'],_0x139dde['query']);_0x2670ba[_0x2a41('0x2b')]=_['intersection'](_0x139dde['model'],qs[_0x2a41('0x2c')](_0x5ccdb9[_0x2a41('0x29')][_0x2a41('0x2c')]));_0x2670ba[_0x2a41('0x2b')]=_0x2670ba['attributes'][_0x2a41('0x2d')]?_0x2670ba[_0x2a41('0x2b')]:_0x139dde['model'];if(!_0x5ccdb9[_0x2a41('0x29')][_0x2a41('0x2e')](_0x2a41('0x2f'))){_0x2670ba['limit']=qs['limit'](_0x5ccdb9['query']['limit']);_0x2670ba[_0x2a41('0x18')]=qs[_0x2a41('0x18')](_0x5ccdb9['query'][_0x2a41('0x18')]);}_0x2670ba[_0x2a41('0x30')]=qs[_0x2a41('0x31')](_0x5ccdb9[_0x2a41('0x29')][_0x2a41('0x31')]);_0x2670ba['where']=qs[_0x2a41('0x2a')](_['pick'](_0x5ccdb9[_0x2a41('0x29')],_0x139dde[_0x2a41('0x2a')]),_0x54c633);if(_0x5ccdb9['query'][_0x2a41('0x32')]){_0x2670ba['where']=_[_0x2a41('0x33')](_0x2670ba[_0x2a41('0x34')],{'$or':_['map'](_0x54c633,function(_0x53f36a){if(_0x53f36a['type']!==_0x2a41('0x35')){var _0x2506a1={};_0x2506a1[_0x53f36a['name']]={'$like':'%'+_0x5ccdb9['query'][_0x2a41('0x32')]+'%'};return _0x2506a1;}})});}_0x2670ba=_['merge']({},_0x2670ba,_0x5ccdb9[_0x2a41('0x36')]);var _0x3cc3bd={'where':_0x2670ba[_0x2a41('0x34')]};return db['MailServerOut'][_0x2a41('0x17')](_0x3cc3bd)[_0x2a41('0x37')](function(_0x18a7fc){_0x580b64['count']=_0x18a7fc;if(_0x5ccdb9['query'][_0x2a41('0x38')]){_0x2670ba[_0x2a41('0x39')]=[{'all':!![]}];}return db[_0x2a41('0x23')][_0x2a41('0x3a')](_0x2670ba);})[_0x2a41('0x37')](function(_0x2f3982){_0x580b64['rows']=_0x2f3982;return _0x580b64;})[_0x2a41('0x37')](respondWithFilteredResult(_0x4c48dc,_0x2670ba))['catch'](handleError(_0x4c48dc,null));};exports['show']=function(_0x58efa7,_0x43435f){var _0x2755c8={'raw':!![],'where':{'id':_0x58efa7['params']['id']}},_0x24141d={};_0x24141d[_0x2a41('0x3b')]=_[_0x2a41('0x3c')](db[_0x2a41('0x23')][_0x2a41('0x24')]);_0x24141d['query']=_[_0x2a41('0x3c')](_0x58efa7[_0x2a41('0x29')]);_0x24141d['filters']=_['intersection'](_0x24141d[_0x2a41('0x3b')],_0x24141d[_0x2a41('0x29')]);_0x2755c8[_0x2a41('0x2b')]=_[_0x2a41('0x3d')](_0x24141d[_0x2a41('0x3b')],qs[_0x2a41('0x2c')](_0x58efa7['query'][_0x2a41('0x2c')]));_0x2755c8['attributes']=_0x2755c8['attributes'][_0x2a41('0x2d')]?_0x2755c8['attributes']:_0x24141d[_0x2a41('0x3b')];if(_0x58efa7[_0x2a41('0x29')][_0x2a41('0x38')]){_0x2755c8[_0x2a41('0x39')]=[{'all':!![]}];}_0x2755c8=_['merge']({},_0x2755c8,_0x58efa7[_0x2a41('0x36')]);return db[_0x2a41('0x23')][_0x2a41('0x3e')](_0x2755c8)[_0x2a41('0x37')](handleEntityNotFound(_0x43435f,null))[_0x2a41('0x37')](respondWithResult(_0x43435f,null))['catch'](handleError(_0x43435f,null));};exports[_0x2a41('0x3f')]=function(_0x3d2bd6,_0x541ea4){return db['MailServerOut']['create'](_0x3d2bd6[_0x2a41('0x40')],{})[_0x2a41('0x37')](respondWithResult(_0x541ea4,0xc9))[_0x2a41('0x41')](handleError(_0x541ea4,null));};exports['update']=function(_0x2753d9,_0x3b1a39){if(_0x2753d9[_0x2a41('0x40')]['id']){delete _0x2753d9['body']['id'];}return db[_0x2a41('0x23')][_0x2a41('0x3e')]({'where':{'id':_0x2753d9['params']['id']}})[_0x2a41('0x37')](handleEntityNotFound(_0x3b1a39,null))['then'](saveUpdates(_0x2753d9[_0x2a41('0x40')],null))[_0x2a41('0x37')](respondWithResult(_0x3b1a39,null))['catch'](handleError(_0x3b1a39,null));};exports[_0x2a41('0x42')]=function(_0x2c4ce9,_0x433004){return db[_0x2a41('0x23')][_0x2a41('0x3e')]({'where':{'id':_0x2c4ce9[_0x2a41('0x43')]['id']}})[_0x2a41('0x37')](handleEntityNotFound(_0x433004,null))[_0x2a41('0x37')](removeEntity(_0x433004,null))[_0x2a41('0x41')](handleError(_0x433004,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f98dbcd..a8703fa 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 _0xd653=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./mailServerOut.attributes'];(function(_0x20c664,_0x317fce){var _0x49978f=function(_0x4919ff){while(--_0x4919ff){_0x20c664['push'](_0x20c664['shift']());}};_0x49978f(++_0x317fce);}(_0xd653,0x16c));var _0x3d65=function(_0x4bfbef,_0x463e6e){_0x4bfbef=_0x4bfbef-0x0;var _0x568581=_0xd653[_0x4bfbef];return _0x568581;};'use strict';var _=require(_0x3d65('0x0'));var util=require(_0x3d65('0x1'));var logger=require(_0x3d65('0x2'))(_0x3d65('0x3'));var moment=require('moment');var BPromise=require(_0x3d65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d65('0x5'));var rimraf=require('rimraf');var config=require(_0x3d65('0x6'));var attributes=require(_0x3d65('0x7'));module[_0x3d65('0x8')]=function(_0x10d11d,_0x43378c){return _0x10d11d[_0x3d65('0x9')](_0x3d65('0xa'),attributes,{'tableName':_0x3d65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcef5=['bluebird','path','./mailServerOut.attributes','define','mail_servers_out','lodash','../../config/logger'];(function(_0x10a6c5,_0x3b8168){var _0x79e4b8=function(_0x4699c8){while(--_0x4699c8){_0x10a6c5['push'](_0x10a6c5['shift']());}};_0x79e4b8(++_0x3b8168);}(_0xcef5,0x1c5));var _0x5cef=function(_0x531eb8,_0x2460ac){_0x531eb8=_0x531eb8-0x0;var _0x59e715=_0xcef5[_0x531eb8];return _0x59e715;};'use strict';var _=require(_0x5cef('0x0'));var util=require('util');var logger=require(_0x5cef('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5cef('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cef('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5cef('0x4'));module['exports']=function(_0x5a96e9,_0x26336f){return _0x5a96e9[_0x5cef('0x5')]('MailServerOut',attributes,{'tableName':_0x5cef('0x6'),'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 6a565f7..7de4128 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 _0x6b8d=['info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x6b8d,0xc3));var _0xd6b8=function(_0x3be3fb,_0x48238b){_0x3be3fb=_0x3be3fb-0x0;var _0x142700=_0x6b8d[_0x3be3fb];return _0x142700;};'use strict';var _=require(_0xd6b8('0x0'));var util=require(_0xd6b8('0x1'));var moment=require(_0xd6b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6b8('0x3'));var fs=require('fs');var Redis=require(_0xd6b8('0x4'));var db=require(_0xd6b8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd6b8('0x6'));var config=require(_0xd6b8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6b8('0x8')][_0xd6b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x138878,_0x46d732,_0x431817){return new BPromise(function(_0x29a547,_0x526a2c){return client[_0xd6b8('0xa')](_0x138878,_0x431817)[_0xd6b8('0xb')](function(_0x4c7b2d){logger[_0xd6b8('0xc')]('MailServerOut,\x20%s,\x20%s',_0x46d732,_0xd6b8('0xd'));logger[_0xd6b8('0xe')](_0xd6b8('0xf'),_0x46d732,'request\x20sent',JSON[_0xd6b8('0x10')](_0x4c7b2d));if(_0x4c7b2d[_0xd6b8('0x11')]){if(_0x4c7b2d['error'][_0xd6b8('0x12')]===0x1f4){logger[_0xd6b8('0x11')](_0xd6b8('0x13'),_0x46d732,_0x4c7b2d[_0xd6b8('0x11')][_0xd6b8('0x14')]);return _0x526a2c(_0x4c7b2d['error'][_0xd6b8('0x14')]);}logger['error'](_0xd6b8('0x13'),_0x46d732,_0x4c7b2d[_0xd6b8('0x11')][_0xd6b8('0x14')]);return _0x29a547(_0x4c7b2d['error'][_0xd6b8('0x14')]);}else{logger[_0xd6b8('0xc')]('MailServerOut,\x20%s,\x20%s',_0x46d732,'request\x20sent');_0x29a547(_0x4c7b2d[_0xd6b8('0x15')][_0xd6b8('0x14')]);}})[_0xd6b8('0x16')](function(_0x5e3a1c){logger[_0xd6b8('0x11')]('MailServerOut,\x20%s,\x20%s',_0x46d732,_0x5e3a1c);_0x526a2c(_0x5e3a1c);});});} \ No newline at end of file +var _0xa094=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','MailServerOut,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x3fec5c,_0x3fbf6c){var _0x3e6ddb=function(_0x5de0f9){while(--_0x5de0f9){_0x3fec5c['push'](_0x3fec5c['shift']());}};_0x3e6ddb(++_0x3fbf6c);}(_0xa094,0x128));var _0x4a09=function(_0x35bbbb,_0x1ae878){_0x35bbbb=_0x35bbbb-0x0;var _0x5879b2=_0xa094[_0x35bbbb];return _0x5879b2;};'use strict';var _=require(_0x4a09('0x0'));var util=require(_0x4a09('0x1'));var moment=require(_0x4a09('0x2'));var BPromise=require(_0x4a09('0x3'));var rs=require(_0x4a09('0x4'));var fs=require('fs');var Redis=require(_0x4a09('0x5'));var db=require(_0x4a09('0x6'))['db'];var utils=require(_0x4a09('0x7'));var logger=require(_0x4a09('0x8'))(_0x4a09('0x9'));var config=require(_0x4a09('0xa'));var jayson=require(_0x4a09('0xb'));var client=jayson[_0x4a09('0xc')][_0x4a09('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ec77d,_0x422199,_0x36b372){return new BPromise(function(_0x3409d1,_0x2efd3e){return client[_0x4a09('0xe')](_0x1ec77d,_0x36b372)[_0x4a09('0xf')](function(_0x476cbf){logger[_0x4a09('0x10')]('MailServerOut,\x20%s,\x20%s',_0x422199,_0x4a09('0x11'));logger[_0x4a09('0x12')](_0x4a09('0x13'),_0x422199,'request\x20sent',JSON[_0x4a09('0x14')](_0x476cbf));if(_0x476cbf[_0x4a09('0x15')]){if(_0x476cbf[_0x4a09('0x15')]['code']===0x1f4){logger['error'](_0x4a09('0x16'),_0x422199,_0x476cbf['error'][_0x4a09('0x17')]);return _0x2efd3e(_0x476cbf[_0x4a09('0x15')][_0x4a09('0x17')]);}logger['error'](_0x4a09('0x16'),_0x422199,_0x476cbf[_0x4a09('0x15')][_0x4a09('0x17')]);return _0x3409d1(_0x476cbf['error'][_0x4a09('0x17')]);}else{logger[_0x4a09('0x10')](_0x4a09('0x16'),_0x422199,_0x4a09('0x11'));_0x3409d1(_0x476cbf['result'][_0x4a09('0x17')]);}})[_0x4a09('0x18')](function(_0x1e9ad8){logger[_0x4a09('0x15')](_0x4a09('0x16'),_0x422199,_0x1e9ad8);_0x2efd3e(_0x1e9ad8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d13b04f..cf72b2c 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 _0x56d0=['/:id','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','show','post','create'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x56d0,0x1a2));var _0x056d=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0x56d0[_0x43026b];return _0x4a96cd;};'use strict';var multer=require(_0x056d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x056d('0x1'));var express=require(_0x056d('0x2'));var router=express[_0x056d('0x3')]();var auth=require(_0x056d('0x4'));var interaction=require(_0x056d('0x5'));var config=require(_0x056d('0x6'));var controller=require(_0x056d('0x7'));router[_0x056d('0x8')]('/',auth[_0x056d('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x056d('0xa')]);router[_0x056d('0x8')]('/:id',auth[_0x056d('0x9')](),controller[_0x056d('0xb')]);router[_0x056d('0xc')]('/',auth[_0x056d('0x9')](),controller[_0x056d('0xd')]);router['put'](_0x056d('0xe'),auth['isAuthenticated'](),controller[_0x056d('0xf')]);router[_0x056d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x056d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3dd6=['Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','post','put','update','delete','util','path','connect-timeout'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0x3dd6,0x9d));var _0x63dd=function(_0x3ac063,_0x52424f){_0x3ac063=_0x3ac063-0x0;var _0xa682d=_0x3dd6[_0x3ac063];return _0xa682d;};'use strict';var multer=require('multer');var util=require(_0x63dd('0x0'));var path=require(_0x63dd('0x1'));var timeout=require(_0x63dd('0x2'));var express=require('express');var router=express[_0x63dd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x63dd('0x4'));var config=require(_0x63dd('0x5'));var controller=require(_0x63dd('0x6'));router['get']('/',auth[_0x63dd('0x7')](),controller[_0x63dd('0x8')]);router[_0x63dd('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x63dd('0xa')]);router[_0x63dd('0x9')](_0x63dd('0xb'),auth[_0x63dd('0x7')](),controller['show']);router[_0x63dd('0xc')]('/',auth[_0x63dd('0x7')](),controller['create']);router[_0x63dd('0xd')](_0x63dd('0xb'),auth[_0x63dd('0x7')](),controller[_0x63dd('0xe')]);router[_0x63dd('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9a52545..7bc0b2c 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0324=['exports','STRING','name'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0324,0x90));var _0x4032=function(_0x53db55,_0x3435b8){_0x53db55=_0x53db55-0x0;var _0x1cdc31=_0x0324[_0x53db55];return _0x1cdc31;};'use strict';var Sequelize=require('sequelize');module[_0x4032('0x0')]={'name':{'type':Sequelize[_0x4032('0x1')],'unique':_0x4032('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4032('0x1')]}}; \ No newline at end of file +var _0xbb61=['STRING','name','sequelize'];(function(_0x1975b8,_0x511308){var _0x202b34=function(_0x2a4f92){while(--_0x2a4f92){_0x1975b8['push'](_0x1975b8['shift']());}};_0x202b34(++_0x511308);}(_0xbb61,0x131));var _0x1bb6=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xbb61[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require(_0x1bb6('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bb6('0x1')],'unique':_0x1bb6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1bb6('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index fe08780..650b18b 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 _0xbd22=['status','json','count','limit','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','MailSubstatus','then','includeAll','include','findAll','rows','catch','show','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3b92d1,_0x338375){var _0x13db31=function(_0x414951){while(--_0x414951){_0x3b92d1['push'](_0x3b92d1['shift']());}};_0x13db31(++_0x338375);}(_0xbd22,0xc5));var _0x2bd2=function(_0xf24154,_0x21763d){_0xf24154=_0xf24154-0x0;var _0x45ae3f=_0xbd22[_0xf24154];return _0x45ae3f;};'use strict';var pdf=require(_0x2bd2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2bd2('0x1'));var zipdir=require(_0x2bd2('0x2'));var jsonpatch=require(_0x2bd2('0x3'));var rp=require(_0x2bd2('0x4'));var moment=require(_0x2bd2('0x5'));var BPromise=require(_0x2bd2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2bd2('0x7'));var sox=require(_0x2bd2('0x8'));var csv=require(_0x2bd2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bd2('0xa'));var squel=require(_0x2bd2('0xb'));var crypto=require(_0x2bd2('0xc'));var jsforce=require(_0x2bd2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2bd2('0x9'));var querystring=require('querystring');var Papa=require(_0x2bd2('0xe'));var Redis=require(_0x2bd2('0xf'));var authService=require(_0x2bd2('0x10'));var qs=require(_0x2bd2('0x11'));var as=require(_0x2bd2('0x12'));var hardwareService=require(_0x2bd2('0x13'));var logger=require(_0x2bd2('0x14'))(_0x2bd2('0x15'));var utils=require(_0x2bd2('0x16'));var config=require(_0x2bd2('0x17'));var db=require(_0x2bd2('0x18'))['db'];function respondWithStatusCode(_0x26b63c,_0x9c8168){_0x9c8168=_0x9c8168||0xcc;return function(_0x1001b4){if(_0x1001b4){return _0x26b63c['sendStatus'](_0x9c8168);}return _0x26b63c['status'](_0x9c8168)['end']();};}function respondWithResult(_0x2f52d1,_0x47583d){_0x47583d=_0x47583d||0xc8;return function(_0x11e7f1){if(_0x11e7f1){return _0x2f52d1[_0x2bd2('0x19')](_0x47583d)[_0x2bd2('0x1a')](_0x11e7f1);}};}function respondWithFilteredResult(_0x2d9474,_0x2a5f8c){return function(_0x25742c){if(_0x25742c){var _0x51fac1=_0x25742c[_0x2bd2('0x1b')],_0x4cf4e7=_0x2a5f8c['offset'],_0x139aa9=_0x2a5f8c['offset']+_0x2a5f8c[_0x2bd2('0x1c')],_0xdf2570;if(_0x139aa9>=_0x51fac1){_0x139aa9=_0x51fac1;_0xdf2570=0xc8;}else{_0xdf2570=0xce;}_0x2d9474[_0x2bd2('0x19')](_0xdf2570);return _0x2d9474['set']('Content-Range',_0x4cf4e7+'-'+_0x139aa9+'/'+_0x51fac1)[_0x2bd2('0x1a')](_0x25742c);}return null;};}function patchUpdates(_0x18a2aa){return function(_0x4b537b){try{jsonpatch[_0x2bd2('0x1d')](_0x4b537b,_0x18a2aa,!![]);}catch(_0x30a93){return BPromise[_0x2bd2('0x1e')](_0x30a93);}return _0x4b537b[_0x2bd2('0x1f')]();};}function saveUpdates(_0x33fac7,_0x3ecf91){return function(_0x4870f3){if(_0x4870f3){return _0x4870f3[_0x2bd2('0x20')](_0x33fac7)['then'](function(_0x23687c){return _0x23687c;});}return null;};}function removeEntity(_0x47ee2d,_0x5061c8){return function(_0xb16ea6){if(_0xb16ea6){return _0xb16ea6[_0x2bd2('0x21')]()['then'](function(){_0x47ee2d[_0x2bd2('0x19')](0xcc)[_0x2bd2('0x22')]();});}};}function handleEntityNotFound(_0x51cb2c,_0x21fe86){return function(_0x40fafd){if(!_0x40fafd){_0x51cb2c[_0x2bd2('0x23')](0x194);}return _0x40fafd;};}function handleError(_0x347364,_0x54013c){_0x54013c=_0x54013c||0x1f4;return function(_0x49fedf){logger[_0x2bd2('0x24')](_0x49fedf[_0x2bd2('0x25')]);if(_0x49fedf['name']){delete _0x49fedf[_0x2bd2('0x26')];}_0x347364[_0x2bd2('0x19')](_0x54013c)[_0x2bd2('0x27')](_0x49fedf);};}exports['index']=function(_0x20eb14,_0x5cde56){var _0x545693={},_0xb7a95a={},_0x59571a={'count':0x0,'rows':[]};var _0x4efbb1=_[_0x2bd2('0x28')](db['MailSubstatus'][_0x2bd2('0x29')],function(_0x4203cb){return{'name':_0x4203cb['fieldName'],'type':_0x4203cb[_0x2bd2('0x2a')][_0x2bd2('0x2b')]};});_0xb7a95a[_0x2bd2('0x2c')]=_[_0x2bd2('0x28')](_0x4efbb1,_0x2bd2('0x26'));_0xb7a95a['query']=_[_0x2bd2('0x2d')](_0x20eb14[_0x2bd2('0x2e')]);_0xb7a95a[_0x2bd2('0x2f')]=_[_0x2bd2('0x30')](_0xb7a95a[_0x2bd2('0x2c')],_0xb7a95a[_0x2bd2('0x2e')]);_0x545693['attributes']=_['intersection'](_0xb7a95a[_0x2bd2('0x2c')],qs[_0x2bd2('0x31')](_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x31')]));_0x545693['attributes']=_0x545693['attributes'][_0x2bd2('0x32')]?_0x545693[_0x2bd2('0x33')]:_0xb7a95a[_0x2bd2('0x2c')];if(!_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x34')](_0x2bd2('0x35'))){_0x545693['limit']=qs[_0x2bd2('0x1c')](_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x1c')]);_0x545693[_0x2bd2('0x36')]=qs[_0x2bd2('0x36')](_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x36')]);}_0x545693[_0x2bd2('0x37')]=qs[_0x2bd2('0x38')](_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x38')]);_0x545693[_0x2bd2('0x39')]=qs[_0x2bd2('0x2f')](_['pick'](_0x20eb14[_0x2bd2('0x2e')],_0xb7a95a['filters']),_0x4efbb1);if(_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x3a')]){_0x545693[_0x2bd2('0x39')]=_[_0x2bd2('0x3b')](_0x545693[_0x2bd2('0x39')],{'$or':_[_0x2bd2('0x28')](_0x4efbb1,function(_0x4bd5c1){if(_0x4bd5c1['type']!==_0x2bd2('0x3c')){var _0x4e6065={};_0x4e6065[_0x4bd5c1[_0x2bd2('0x26')]]={'$like':'%'+_0x20eb14[_0x2bd2('0x2e')]['filter']+'%'};return _0x4e6065;}})});}_0x545693=_['merge']({},_0x545693,_0x20eb14[_0x2bd2('0x3d')]);var _0x269f1e={'where':_0x545693['where']};return db[_0x2bd2('0x3e')][_0x2bd2('0x1b')](_0x269f1e)[_0x2bd2('0x3f')](function(_0x41feef){_0x59571a[_0x2bd2('0x1b')]=_0x41feef;if(_0x20eb14[_0x2bd2('0x2e')][_0x2bd2('0x40')]){_0x545693[_0x2bd2('0x41')]=[{'all':!![]}];}return db[_0x2bd2('0x3e')][_0x2bd2('0x42')](_0x545693);})[_0x2bd2('0x3f')](function(_0x378aea){_0x59571a[_0x2bd2('0x43')]=_0x378aea;return _0x59571a;})[_0x2bd2('0x3f')](respondWithFilteredResult(_0x5cde56,_0x545693))[_0x2bd2('0x44')](handleError(_0x5cde56,null));};exports[_0x2bd2('0x45')]=function(_0x35f5cf,_0x1d95a4){var _0xa4ef87={'raw':!![],'where':{'id':_0x35f5cf['params']['id']}},_0x37d267={};_0x37d267[_0x2bd2('0x2c')]=_['keys'](db[_0x2bd2('0x3e')]['rawAttributes']);_0x37d267[_0x2bd2('0x2e')]=_['keys'](_0x35f5cf[_0x2bd2('0x2e')]);_0x37d267['filters']=_[_0x2bd2('0x30')](_0x37d267[_0x2bd2('0x2c')],_0x37d267[_0x2bd2('0x2e')]);_0xa4ef87['attributes']=_['intersection'](_0x37d267[_0x2bd2('0x2c')],qs[_0x2bd2('0x31')](_0x35f5cf[_0x2bd2('0x2e')][_0x2bd2('0x31')]));_0xa4ef87[_0x2bd2('0x33')]=_0xa4ef87[_0x2bd2('0x33')]['length']?_0xa4ef87[_0x2bd2('0x33')]:_0x37d267[_0x2bd2('0x2c')];if(_0x35f5cf[_0x2bd2('0x2e')]['includeAll']){_0xa4ef87[_0x2bd2('0x41')]=[{'all':!![]}];}_0xa4ef87=_[_0x2bd2('0x3b')]({},_0xa4ef87,_0x35f5cf[_0x2bd2('0x3d')]);return db[_0x2bd2('0x3e')]['find'](_0xa4ef87)[_0x2bd2('0x3f')](handleEntityNotFound(_0x1d95a4,null))[_0x2bd2('0x3f')](respondWithResult(_0x1d95a4,null))[_0x2bd2('0x44')](handleError(_0x1d95a4,null));};exports['create']=function(_0x165a82,_0x52cbe3){return db[_0x2bd2('0x3e')]['create'](_0x165a82[_0x2bd2('0x46')],{})[_0x2bd2('0x3f')](respondWithResult(_0x52cbe3,0xc9))[_0x2bd2('0x44')](handleError(_0x52cbe3,null));};exports[_0x2bd2('0x20')]=function(_0x1797fb,_0x225506){if(_0x1797fb['body']['id']){delete _0x1797fb['body']['id'];}return db[_0x2bd2('0x3e')][_0x2bd2('0x47')]({'where':{'id':_0x1797fb[_0x2bd2('0x48')]['id']}})[_0x2bd2('0x3f')](handleEntityNotFound(_0x225506,null))[_0x2bd2('0x3f')](saveUpdates(_0x1797fb[_0x2bd2('0x46')],null))[_0x2bd2('0x3f')](respondWithResult(_0x225506,null))[_0x2bd2('0x44')](handleError(_0x225506,null));};exports[_0x2bd2('0x21')]=function(_0x178516,_0x44f7e5){return db[_0x2bd2('0x3e')]['find']({'where':{'id':_0x178516[_0x2bd2('0x48')]['id']}})['then'](handleEntityNotFound(_0x44f7e5,null))[_0x2bd2('0x3f')](removeEntity(_0x44f7e5,null))[_0x2bd2('0x44')](handleError(_0x44f7e5,null));};exports[_0x2bd2('0x49')]=function(_0xe88c32,_0x205599){return db['MailSubstatus'][_0x2bd2('0x49')]()[_0x2bd2('0x3f')](respondWithResult(_0x205599,null))['catch'](handleError(_0x205599,null));}; \ No newline at end of file +var _0x6e10=['Content-Range','apply','reject','update','then','end','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','offset','sort','where','pick','filter','merge','options','includeAll','include','catch','show','find','create','body','params','describe','html-pdf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','limit','set'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x6e10,0x17d));var _0x06e1=function(_0x61df4b,_0x1ab1e9){_0x61df4b=_0x61df4b-0x0;var _0x5c9a73=_0x6e10[_0x61df4b];return _0x5c9a73;};'use strict';var pdf=require(_0x06e1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06e1('0x1'));var jsonpatch=require(_0x06e1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x06e1('0x3'));var util=require(_0x06e1('0x4'));var path=require(_0x06e1('0x5'));var sox=require(_0x06e1('0x6'));var csv=require(_0x06e1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x06e1('0x8'));var squel=require(_0x06e1('0x9'));var crypto=require(_0x06e1('0xa'));var jsforce=require(_0x06e1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x06e1('0x7'));var querystring=require(_0x06e1('0xc'));var Papa=require(_0x06e1('0xd'));var Redis=require(_0x06e1('0xe'));var authService=require(_0x06e1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x06e1('0x10'));var hardwareService=require(_0x06e1('0x11'));var logger=require(_0x06e1('0x12'))('api');var utils=require(_0x06e1('0x13'));var config=require(_0x06e1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4286e1,_0x1f59ab){_0x1f59ab=_0x1f59ab||0xcc;return function(_0x17d6df){if(_0x17d6df){return _0x4286e1[_0x06e1('0x15')](_0x1f59ab);}return _0x4286e1[_0x06e1('0x16')](_0x1f59ab)['end']();};}function respondWithResult(_0x4e6ea7,_0x11fb89){_0x11fb89=_0x11fb89||0xc8;return function(_0x4ff280){if(_0x4ff280){return _0x4e6ea7['status'](_0x11fb89)[_0x06e1('0x17')](_0x4ff280);}};}function respondWithFilteredResult(_0x12960c,_0x6f1e05){return function(_0x5e4f66){if(_0x5e4f66){var _0x2532b7=_0x5e4f66[_0x06e1('0x18')],_0x4f98f7=_0x6f1e05['offset'],_0x265a00=_0x6f1e05['offset']+_0x6f1e05[_0x06e1('0x19')],_0x4216cf;if(_0x265a00>=_0x2532b7){_0x265a00=_0x2532b7;_0x4216cf=0xc8;}else{_0x4216cf=0xce;}_0x12960c['status'](_0x4216cf);return _0x12960c[_0x06e1('0x1a')](_0x06e1('0x1b'),_0x4f98f7+'-'+_0x265a00+'/'+_0x2532b7)[_0x06e1('0x17')](_0x5e4f66);}return null;};}function patchUpdates(_0x303192){return function(_0x10aa28){try{jsonpatch[_0x06e1('0x1c')](_0x10aa28,_0x303192,!![]);}catch(_0x3271fe){return BPromise[_0x06e1('0x1d')](_0x3271fe);}return _0x10aa28['save']();};}function saveUpdates(_0x368667,_0x50e27b){return function(_0x28c2ca){if(_0x28c2ca){return _0x28c2ca[_0x06e1('0x1e')](_0x368667)['then'](function(_0x848646){return _0x848646;});}return null;};}function removeEntity(_0x52cb47,_0x4b2a48){return function(_0x17c34f){if(_0x17c34f){return _0x17c34f['destroy']()[_0x06e1('0x1f')](function(){_0x52cb47[_0x06e1('0x16')](0xcc)[_0x06e1('0x20')]();});}};}function handleEntityNotFound(_0x196513,_0x472ed9){return function(_0x2c5caa){if(!_0x2c5caa){_0x196513[_0x06e1('0x15')](0x194);}return _0x2c5caa;};}function handleError(_0x116d5a,_0x5544f4){_0x5544f4=_0x5544f4||0x1f4;return function(_0x146d7a){logger[_0x06e1('0x21')](_0x146d7a[_0x06e1('0x22')]);if(_0x146d7a[_0x06e1('0x23')]){delete _0x146d7a[_0x06e1('0x23')];}_0x116d5a[_0x06e1('0x16')](_0x5544f4)[_0x06e1('0x24')](_0x146d7a);};}exports['index']=function(_0x486a98,_0x4a9a32){var _0x2c3160={},_0x461ec0={},_0x232365={'count':0x0,'rows':[]};var _0x31a139=_[_0x06e1('0x25')](db[_0x06e1('0x26')][_0x06e1('0x27')],function(_0x27f43d){return{'name':_0x27f43d[_0x06e1('0x28')],'type':_0x27f43d[_0x06e1('0x29')][_0x06e1('0x2a')]};});_0x461ec0['model']=_[_0x06e1('0x25')](_0x31a139,_0x06e1('0x23'));_0x461ec0['query']=_[_0x06e1('0x2b')](_0x486a98[_0x06e1('0x2c')]);_0x461ec0[_0x06e1('0x2d')]=_['intersection'](_0x461ec0['model'],_0x461ec0[_0x06e1('0x2c')]);_0x2c3160[_0x06e1('0x2e')]=_[_0x06e1('0x2f')](_0x461ec0['model'],qs[_0x06e1('0x30')](_0x486a98[_0x06e1('0x2c')][_0x06e1('0x30')]));_0x2c3160[_0x06e1('0x2e')]=_0x2c3160[_0x06e1('0x2e')][_0x06e1('0x31')]?_0x2c3160[_0x06e1('0x2e')]:_0x461ec0[_0x06e1('0x32')];if(!_0x486a98[_0x06e1('0x2c')][_0x06e1('0x33')]('nolimit')){_0x2c3160[_0x06e1('0x19')]=qs[_0x06e1('0x19')](_0x486a98[_0x06e1('0x2c')]['limit']);_0x2c3160[_0x06e1('0x34')]=qs[_0x06e1('0x34')](_0x486a98[_0x06e1('0x2c')]['offset']);}_0x2c3160['order']=qs[_0x06e1('0x35')](_0x486a98[_0x06e1('0x2c')]['sort']);_0x2c3160[_0x06e1('0x36')]=qs[_0x06e1('0x2d')](_[_0x06e1('0x37')](_0x486a98[_0x06e1('0x2c')],_0x461ec0[_0x06e1('0x2d')]),_0x31a139);if(_0x486a98['query'][_0x06e1('0x38')]){_0x2c3160[_0x06e1('0x36')]=_[_0x06e1('0x39')](_0x2c3160[_0x06e1('0x36')],{'$or':_['map'](_0x31a139,function(_0x4f0898){if(_0x4f0898[_0x06e1('0x29')]!=='VIRTUAL'){var _0x83a75={};_0x83a75[_0x4f0898[_0x06e1('0x23')]]={'$like':'%'+_0x486a98[_0x06e1('0x2c')][_0x06e1('0x38')]+'%'};return _0x83a75;}})});}_0x2c3160=_['merge']({},_0x2c3160,_0x486a98[_0x06e1('0x3a')]);var _0x381334={'where':_0x2c3160[_0x06e1('0x36')]};return db[_0x06e1('0x26')][_0x06e1('0x18')](_0x381334)[_0x06e1('0x1f')](function(_0x2658d8){_0x232365[_0x06e1('0x18')]=_0x2658d8;if(_0x486a98['query'][_0x06e1('0x3b')]){_0x2c3160[_0x06e1('0x3c')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2c3160);})[_0x06e1('0x1f')](function(_0x32e8c5){_0x232365['rows']=_0x32e8c5;return _0x232365;})['then'](respondWithFilteredResult(_0x4a9a32,_0x2c3160))[_0x06e1('0x3d')](handleError(_0x4a9a32,null));};exports[_0x06e1('0x3e')]=function(_0x25e82d,_0x46a7e3){var _0x4143fd={'raw':!![],'where':{'id':_0x25e82d['params']['id']}},_0x23a149={};_0x23a149['model']=_[_0x06e1('0x2b')](db[_0x06e1('0x26')][_0x06e1('0x27')]);_0x23a149[_0x06e1('0x2c')]=_[_0x06e1('0x2b')](_0x25e82d[_0x06e1('0x2c')]);_0x23a149[_0x06e1('0x2d')]=_['intersection'](_0x23a149[_0x06e1('0x32')],_0x23a149[_0x06e1('0x2c')]);_0x4143fd[_0x06e1('0x2e')]=_[_0x06e1('0x2f')](_0x23a149[_0x06e1('0x32')],qs[_0x06e1('0x30')](_0x25e82d['query'][_0x06e1('0x30')]));_0x4143fd[_0x06e1('0x2e')]=_0x4143fd[_0x06e1('0x2e')][_0x06e1('0x31')]?_0x4143fd['attributes']:_0x23a149[_0x06e1('0x32')];if(_0x25e82d['query'][_0x06e1('0x3b')]){_0x4143fd[_0x06e1('0x3c')]=[{'all':!![]}];}_0x4143fd=_[_0x06e1('0x39')]({},_0x4143fd,_0x25e82d[_0x06e1('0x3a')]);return db[_0x06e1('0x26')][_0x06e1('0x3f')](_0x4143fd)[_0x06e1('0x1f')](handleEntityNotFound(_0x46a7e3,null))[_0x06e1('0x1f')](respondWithResult(_0x46a7e3,null))['catch'](handleError(_0x46a7e3,null));};exports[_0x06e1('0x40')]=function(_0x321b39,_0x28118d){return db[_0x06e1('0x26')]['create'](_0x321b39[_0x06e1('0x41')],{})[_0x06e1('0x1f')](respondWithResult(_0x28118d,0xc9))[_0x06e1('0x3d')](handleError(_0x28118d,null));};exports[_0x06e1('0x1e')]=function(_0x3f0032,_0x4c8e52){if(_0x3f0032[_0x06e1('0x41')]['id']){delete _0x3f0032['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x3f0032['params']['id']}})['then'](handleEntityNotFound(_0x4c8e52,null))[_0x06e1('0x1f')](saveUpdates(_0x3f0032['body'],null))[_0x06e1('0x1f')](respondWithResult(_0x4c8e52,null))[_0x06e1('0x3d')](handleError(_0x4c8e52,null));};exports['destroy']=function(_0x23b8a8,_0x186989){return db['MailSubstatus']['find']({'where':{'id':_0x23b8a8[_0x06e1('0x42')]['id']}})[_0x06e1('0x1f')](handleEntityNotFound(_0x186989,null))[_0x06e1('0x1f')](removeEntity(_0x186989,null))['catch'](handleError(_0x186989,null));};exports[_0x06e1('0x43')]=function(_0x5cbe7,_0x260474){return db['MailSubstatus'][_0x06e1('0x43')]()['then'](respondWithResult(_0x260474,null))['catch'](handleError(_0x260474,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3dc0a3d..8b62d9c 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 _0xb1e0=['bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb1e0,0x1e9));var _0x0b1e=function(_0x530a61,_0x6448ad){_0x530a61=_0x530a61-0x0;var _0x17eb62=_0xb1e0[_0x530a61];return _0x17eb62;};'use strict';var _=require(_0x0b1e('0x0'));var util=require(_0x0b1e('0x1'));var logger=require(_0x0b1e('0x2'))(_0x0b1e('0x3'));var moment=require(_0x0b1e('0x4'));var BPromise=require(_0x0b1e('0x5'));var rp=require(_0x0b1e('0x6'));var fs=require('fs');var path=require(_0x0b1e('0x7'));var rimraf=require(_0x0b1e('0x8'));var config=require(_0x0b1e('0x9'));var attributes=require(_0x0b1e('0xa'));module['exports']=function(_0x569ec9,_0x41e88c){return _0x569ec9[_0x0b1e('0xb')](_0x0b1e('0xc'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd508=['lodash','util','api','moment','request-promise','path','../../config/environment','exports','MailSubstatus','mail_substatuses'];(function(_0x216214,_0x300f2b){var _0x1539fc=function(_0x115492){while(--_0x115492){_0x216214['push'](_0x216214['shift']());}};_0x1539fc(++_0x300f2b);}(_0xd508,0x1f4));var _0x8d50=function(_0x4c7998,_0x489acc){_0x4c7998=_0x4c7998-0x0;var _0x15f6bc=_0xd508[_0x4c7998];return _0x15f6bc;};'use strict';var _=require(_0x8d50('0x0'));var util=require(_0x8d50('0x1'));var logger=require('../../config/logger')(_0x8d50('0x2'));var moment=require(_0x8d50('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d50('0x4'));var fs=require('fs');var path=require(_0x8d50('0x5'));var rimraf=require('rimraf');var config=require(_0x8d50('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x8d50('0x7')]=function(_0x2bbfd0,_0xdafdfb){return _0x2bbfd0['define'](_0x8d50('0x8'),attributes,{'tableName':_0x8d50('0x9'),'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 cf3223e..6753f49 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 _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x392f1a,_0x1898dd){var _0x3d17f1=function(_0x485843){while(--_0x485843){_0x392f1a['push'](_0x392f1a['shift']());}};_0x3d17f1(++_0x1898dd);}(_0xb58b,0x1f1));var _0xbb58=function(_0x58a2d0,_0x5c799b){_0x58a2d0=_0x58a2d0-0x0;var _0x3d8541=_0xb58b[_0x58a2d0];return _0x3d8541;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});} \ No newline at end of file +var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x223a3d,_0x2ea1a7){var _0x29cd6c=function(_0x27b4ed){while(--_0x27b4ed){_0x223a3d['push'](_0x223a3d['shift']());}};_0x29cd6c(++_0x2ea1a7);}(_0x2dae,0xc3));var _0xe2da=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x2dae[_0x39cf70];return _0x580424;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 99d3e55..599e185 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 _0x908c=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','express'];(function(_0x53ce82,_0x5d9e8f){var _0x1154c6=function(_0x5780a4){while(--_0x5780a4){_0x53ce82['push'](_0x53ce82['shift']());}};_0x1154c6(++_0x5d9e8f);}(_0x908c,0x94));var _0xc908=function(_0x353694,_0x3c6761){_0x353694=_0x353694-0x0;var _0x1609b3=_0x908c[_0x353694];return _0x1609b3;};'use strict';var multer=require(_0xc908('0x0'));var util=require(_0xc908('0x1'));var path=require(_0xc908('0x2'));var timeout=require('connect-timeout');var express=require(_0xc908('0x3'));var router=express[_0xc908('0x4')]();var auth=require(_0xc908('0x5'));var interaction=require(_0xc908('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xc908('0x7')]('/',auth[_0xc908('0x8')](),controller[_0xc908('0x9')]);router[_0xc908('0x7')](_0xc908('0xa'),auth[_0xc908('0x8')](),controller['describe']);router[_0xc908('0x7')](_0xc908('0xb'),auth[_0xc908('0x8')](),controller[_0xc908('0xc')]);router[_0xc908('0xd')]('/',auth[_0xc908('0x8')](),controller[_0xc908('0xe')]);router[_0xc908('0xf')](_0xc908('0xb'),auth[_0xc908('0x8')](),controller[_0xc908('0x10')]);router[_0xc908('0x11')]('/:id',auth[_0xc908('0x8')](),controller['destroy']);module[_0xc908('0x12')]=router; \ No newline at end of file +var _0x8b49=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x20861e,_0x270147){var _0xef5594=function(_0x40f304){while(--_0x40f304){_0x20861e['push'](_0x20861e['shift']());}};_0xef5594(++_0x270147);}(_0x8b49,0x136));var _0x98b4=function(_0x5da794,_0xf1cf6){_0x5da794=_0x5da794-0x0;var _0x2517ad=_0x8b49[_0x5da794];return _0x2517ad;};'use strict';var multer=require(_0x98b4('0x0'));var util=require('util');var path=require(_0x98b4('0x1'));var timeout=require(_0x98b4('0x2'));var express=require('express');var router=express[_0x98b4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x98b4('0x4'));var config=require(_0x98b4('0x5'));var controller=require(_0x98b4('0x6'));router[_0x98b4('0x7')]('/',auth[_0x98b4('0x8')](),controller[_0x98b4('0x9')]);router[_0x98b4('0x7')](_0x98b4('0xa'),auth['isAuthenticated'](),controller[_0x98b4('0xb')]);router['get']('/:id',auth[_0x98b4('0x8')](),controller['show']);router[_0x98b4('0xc')]('/',auth[_0x98b4('0x8')](),controller['create']);router[_0x98b4('0xd')](_0x98b4('0xe'),auth[_0x98b4('0x8')](),controller[_0x98b4('0xf')]);router[_0x98b4('0x10')](_0x98b4('0xe'),auth[_0x98b4('0x8')](),controller[_0x98b4('0x11')]);module[_0x98b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 659be96..ac1461c 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 _0xcf95=['ENUM','account','agent','queue','moment','exports','STRING'];(function(_0x4cc198,_0x11a598){var _0x3e8858=function(_0x226554){while(--_0x226554){_0x4cc198['push'](_0x4cc198['shift']());}};_0x3e8858(++_0x11a598);}(_0xcf95,0x1cb));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x5cf9('0x0'));var Sequelize=require('sequelize');module[_0x5cf9('0x1')]={'uniqueid':{'type':Sequelize[_0x5cf9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5cf9('0x3')](_0x5cf9('0x4'),_0x5cf9('0x5'),_0x5cf9('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x08b0=['sequelize','exports','STRING','agent','DATE','NOW','moment'];(function(_0x2cd544,_0x45f986){var _0x4a4020=function(_0x4fafc7){while(--_0x4fafc7){_0x2cd544['push'](_0x2cd544['shift']());}};_0x4a4020(++_0x45f986);}(_0x08b0,0x1b1));var _0x008b=function(_0xf244e0,_0x20556c){_0xf244e0=_0xf244e0-0x0;var _0xe94095=_0x08b0[_0xf244e0];return _0xe94095;};'use strict';var moment=require(_0x008b('0x0'));var Sequelize=require(_0x008b('0x1'));module[_0x008b('0x2')]={'uniqueid':{'type':Sequelize[_0x008b('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x008b('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x008b('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x008b('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1c3ee25..feba0ae 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 _0xf0cc=['rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','offset','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','index','MailTransferReport'];(function(_0x1e05c8,_0x34eaa6){var _0x1e9ad6=function(_0x2402c2){while(--_0x2402c2){_0x1e05c8['push'](_0x1e05c8['shift']());}};_0x1e9ad6(++_0x34eaa6);}(_0xf0cc,0xaa));var _0xcf0c=function(_0x406195,_0x50c01e){_0x406195=_0x406195-0x0;var _0x4c1a26=_0xf0cc[_0x406195];return _0x4c1a26;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf0c('0x0'));var rimraf=require(_0xcf0c('0x1'));var zipdir=require(_0xcf0c('0x2'));var jsonpatch=require(_0xcf0c('0x3'));var rp=require('request-promise');var moment=require(_0xcf0c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcf0c('0x5'));var path=require(_0xcf0c('0x6'));var sox=require(_0xcf0c('0x7'));var csv=require(_0xcf0c('0x8'));var ejs=require(_0xcf0c('0x9'));var fs=require('fs');var _=require(_0xcf0c('0xa'));var squel=require(_0xcf0c('0xb'));var crypto=require(_0xcf0c('0xc'));var jsforce=require(_0xcf0c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x8'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xe'));var Redis=require(_0xcf0c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcf0c('0x10'));var as=require(_0xcf0c('0x11'));var hardwareService=require(_0xcf0c('0x12'));var logger=require(_0xcf0c('0x13'))(_0xcf0c('0x14'));var utils=require(_0xcf0c('0x15'));var config=require(_0xcf0c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ffca2,_0x300103){_0x300103=_0x300103||0xcc;return function(_0x7db74d){if(_0x7db74d){return _0x3ffca2[_0xcf0c('0x17')](_0x300103);}return _0x3ffca2[_0xcf0c('0x18')](_0x300103)[_0xcf0c('0x19')]();};}function respondWithResult(_0x3f2269,_0x22d805){_0x22d805=_0x22d805||0xc8;return function(_0x1041f1){if(_0x1041f1){return _0x3f2269[_0xcf0c('0x18')](_0x22d805)[_0xcf0c('0x1a')](_0x1041f1);}};}function respondWithFilteredResult(_0x163f2b,_0x2c1926){return function(_0x213825){if(_0x213825){var _0x13e7fa=_0x213825[_0xcf0c('0x1b')],_0x331f62=_0x2c1926['offset'],_0x2237cc=_0x2c1926['offset']+_0x2c1926[_0xcf0c('0x1c')],_0xe7584;if(_0x2237cc>=_0x13e7fa){_0x2237cc=_0x13e7fa;_0xe7584=0xc8;}else{_0xe7584=0xce;}_0x163f2b['status'](_0xe7584);return _0x163f2b[_0xcf0c('0x1d')](_0xcf0c('0x1e'),_0x331f62+'-'+_0x2237cc+'/'+_0x13e7fa)[_0xcf0c('0x1a')](_0x213825);}return null;};}function patchUpdates(_0x50ca15){return function(_0x371ab4){try{jsonpatch[_0xcf0c('0x1f')](_0x371ab4,_0x50ca15,!![]);}catch(_0x1790c7){return BPromise[_0xcf0c('0x20')](_0x1790c7);}return _0x371ab4['save']();};}function saveUpdates(_0xd24470,_0x35e6a8){return function(_0x4a5248){if(_0x4a5248){return _0x4a5248[_0xcf0c('0x21')](_0xd24470)[_0xcf0c('0x22')](function(_0x36c781){return _0x36c781;});}return null;};}function removeEntity(_0xa143ea,_0x2dd269){return function(_0x365a2c){if(_0x365a2c){return _0x365a2c[_0xcf0c('0x23')]()['then'](function(){_0xa143ea[_0xcf0c('0x18')](0xcc)[_0xcf0c('0x19')]();});}};}function handleEntityNotFound(_0x3a2f46,_0xb5fe4c){return function(_0x210f2e){if(!_0x210f2e){_0x3a2f46[_0xcf0c('0x17')](0x194);}return _0x210f2e;};}function handleError(_0x57470f,_0x823daf){_0x823daf=_0x823daf||0x1f4;return function(_0x43a3ad){logger[_0xcf0c('0x24')](_0x43a3ad['stack']);if(_0x43a3ad[_0xcf0c('0x25')]){delete _0x43a3ad[_0xcf0c('0x25')];}_0x57470f[_0xcf0c('0x18')](_0x823daf)['send'](_0x43a3ad);};}exports[_0xcf0c('0x26')]=function(_0x1323a1,_0x21f94d){var _0x51c22e={},_0x167350={},_0x5d7200={'count':0x0,'rows':[]};var _0x19f996=_['map'](db[_0xcf0c('0x27')][_0xcf0c('0x28')],function(_0x5d1140){return{'name':_0x5d1140[_0xcf0c('0x29')],'type':_0x5d1140[_0xcf0c('0x2a')][_0xcf0c('0x2b')]};});_0x167350[_0xcf0c('0x2c')]=_[_0xcf0c('0x2d')](_0x19f996,_0xcf0c('0x25'));_0x167350[_0xcf0c('0x2e')]=_[_0xcf0c('0x2f')](_0x1323a1[_0xcf0c('0x2e')]);_0x167350['filters']=_[_0xcf0c('0x30')](_0x167350[_0xcf0c('0x2c')],_0x167350['query']);_0x51c22e[_0xcf0c('0x31')]=_['intersection'](_0x167350['model'],qs[_0xcf0c('0x32')](_0x1323a1['query'][_0xcf0c('0x32')]));_0x51c22e[_0xcf0c('0x31')]=_0x51c22e[_0xcf0c('0x31')][_0xcf0c('0x33')]?_0x51c22e[_0xcf0c('0x31')]:_0x167350[_0xcf0c('0x2c')];if(!_0x1323a1[_0xcf0c('0x2e')]['hasOwnProperty']('nolimit')){_0x51c22e[_0xcf0c('0x1c')]=qs[_0xcf0c('0x1c')](_0x1323a1[_0xcf0c('0x2e')]['limit']);_0x51c22e['offset']=qs[_0xcf0c('0x34')](_0x1323a1['query'][_0xcf0c('0x34')]);}_0x51c22e['order']=qs['sort'](_0x1323a1['query'][_0xcf0c('0x35')]);_0x51c22e[_0xcf0c('0x36')]=qs[_0xcf0c('0x37')](_[_0xcf0c('0x38')](_0x1323a1[_0xcf0c('0x2e')],_0x167350['filters']),_0x19f996);if(_0x1323a1[_0xcf0c('0x2e')]['filter']){_0x51c22e[_0xcf0c('0x36')]=_[_0xcf0c('0x39')](_0x51c22e[_0xcf0c('0x36')],{'$or':_['map'](_0x19f996,function(_0x53f20f){if(_0x53f20f['type']!==_0xcf0c('0x3a')){var _0x5ee8e2={};_0x5ee8e2[_0x53f20f['name']]={'$like':'%'+_0x1323a1[_0xcf0c('0x2e')][_0xcf0c('0x3b')]+'%'};return _0x5ee8e2;}})});}_0x51c22e=_['merge']({},_0x51c22e,_0x1323a1[_0xcf0c('0x3c')]);var _0x448585={'where':_0x51c22e[_0xcf0c('0x36')]};return db[_0xcf0c('0x27')][_0xcf0c('0x1b')](_0x448585)['then'](function(_0x211f9c){_0x5d7200['count']=_0x211f9c;if(_0x1323a1[_0xcf0c('0x2e')][_0xcf0c('0x3d')]){_0x51c22e[_0xcf0c('0x3e')]=[{'all':!![]}];}return db[_0xcf0c('0x27')][_0xcf0c('0x3f')](_0x51c22e);})['then'](function(_0x485ab0){_0x5d7200['rows']=_0x485ab0;return _0x5d7200;})[_0xcf0c('0x22')](respondWithFilteredResult(_0x21f94d,_0x51c22e))[_0xcf0c('0x40')](handleError(_0x21f94d,null));};exports[_0xcf0c('0x41')]=function(_0x440d87,_0x2d306d){var _0x5d3757={'raw':!![],'where':{'id':_0x440d87[_0xcf0c('0x42')]['id']}},_0x4f7861={};_0x4f7861[_0xcf0c('0x2c')]=_[_0xcf0c('0x2f')](db[_0xcf0c('0x27')]['rawAttributes']);_0x4f7861[_0xcf0c('0x2e')]=_['keys'](_0x440d87['query']);_0x4f7861['filters']=_[_0xcf0c('0x30')](_0x4f7861[_0xcf0c('0x2c')],_0x4f7861['query']);_0x5d3757[_0xcf0c('0x31')]=_[_0xcf0c('0x30')](_0x4f7861[_0xcf0c('0x2c')],qs[_0xcf0c('0x32')](_0x440d87[_0xcf0c('0x2e')][_0xcf0c('0x32')]));_0x5d3757[_0xcf0c('0x31')]=_0x5d3757['attributes']['length']?_0x5d3757[_0xcf0c('0x31')]:_0x4f7861['model'];if(_0x440d87[_0xcf0c('0x2e')][_0xcf0c('0x3d')]){_0x5d3757['include']=[{'all':!![]}];}_0x5d3757=_[_0xcf0c('0x39')]({},_0x5d3757,_0x440d87['options']);return db[_0xcf0c('0x27')]['find'](_0x5d3757)[_0xcf0c('0x22')](handleEntityNotFound(_0x2d306d,null))['then'](respondWithResult(_0x2d306d,null))[_0xcf0c('0x40')](handleError(_0x2d306d,null));};exports[_0xcf0c('0x43')]=function(_0x5cb4bf,_0x3f5b86){return db[_0xcf0c('0x27')][_0xcf0c('0x43')](_0x5cb4bf[_0xcf0c('0x44')],{})[_0xcf0c('0x22')](respondWithResult(_0x3f5b86,0xc9))['catch'](handleError(_0x3f5b86,null));};exports[_0xcf0c('0x21')]=function(_0x7418d6,_0x43d928){if(_0x7418d6[_0xcf0c('0x44')]['id']){delete _0x7418d6[_0xcf0c('0x44')]['id'];}return db['MailTransferReport'][_0xcf0c('0x45')]({'where':{'id':_0x7418d6[_0xcf0c('0x42')]['id']}})[_0xcf0c('0x22')](handleEntityNotFound(_0x43d928,null))['then'](saveUpdates(_0x7418d6[_0xcf0c('0x44')],null))[_0xcf0c('0x22')](respondWithResult(_0x43d928,null))[_0xcf0c('0x40')](handleError(_0x43d928,null));};exports[_0xcf0c('0x23')]=function(_0x4bd0d1,_0x1e2c1f){return db[_0xcf0c('0x27')][_0xcf0c('0x45')]({'where':{'id':_0x4bd0d1[_0xcf0c('0x42')]['id']}})[_0xcf0c('0x22')](handleEntityNotFound(_0x1e2c1f,null))[_0xcf0c('0x22')](removeEntity(_0x1e2c1f,null))['catch'](handleError(_0x1e2c1f,null));};exports['describe']=function(_0x470f33,_0x3fe9c5){return db[_0xcf0c('0x27')]['describe']()[_0xcf0c('0x22')](respondWithResult(_0x3fe9c5,null))[_0xcf0c('0x40')](handleError(_0x3fe9c5,null));}; \ No newline at end of file +var _0x9c9e=['name','map','MailTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','error','stack'];(function(_0x179bea,_0x24fe04){var _0x20be22=function(_0x1c54ab){while(--_0x1c54ab){_0x179bea['push'](_0x179bea['shift']());}};_0x20be22(++_0x24fe04);}(_0x9c9e,0x148));var _0xe9c9=function(_0x40cc23,_0x253065){_0x40cc23=_0x40cc23-0x0;var _0x26f6da=_0x9c9e[_0x40cc23];return _0x26f6da;};'use strict';var pdf=require(_0xe9c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9c9('0x2'));var rp=require(_0xe9c9('0x3'));var moment=require('moment');var BPromise=require(_0xe9c9('0x4'));var Mustache=require(_0xe9c9('0x5'));var util=require('util');var path=require(_0xe9c9('0x6'));var sox=require('sox');var csv=require(_0xe9c9('0x7'));var ejs=require(_0xe9c9('0x8'));var fs=require('fs');var _=require(_0xe9c9('0x9'));var squel=require(_0xe9c9('0xa'));var crypto=require(_0xe9c9('0xb'));var jsforce=require(_0xe9c9('0xc'));var deskjs=require(_0xe9c9('0xd'));var toCsv=require(_0xe9c9('0x7'));var querystring=require(_0xe9c9('0xe'));var Papa=require('papaparse');var Redis=require(_0xe9c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9c9('0x10'));var as=require(_0xe9c9('0x11'));var hardwareService=require(_0xe9c9('0x12'));var logger=require(_0xe9c9('0x13'))(_0xe9c9('0x14'));var utils=require('../../config/utils');var config=require(_0xe9c9('0x15'));var db=require(_0xe9c9('0x16'))['db'];function respondWithStatusCode(_0xa17965,_0x243250){_0x243250=_0x243250||0xcc;return function(_0x3377f8){if(_0x3377f8){return _0xa17965[_0xe9c9('0x17')](_0x243250);}return _0xa17965[_0xe9c9('0x18')](_0x243250)[_0xe9c9('0x19')]();};}function respondWithResult(_0x489e61,_0x3a9f0f){_0x3a9f0f=_0x3a9f0f||0xc8;return function(_0x381fca){if(_0x381fca){return _0x489e61['status'](_0x3a9f0f)['json'](_0x381fca);}};}function respondWithFilteredResult(_0x434ec2,_0x29fd96){return function(_0x5518d2){if(_0x5518d2){var _0x25ed64=_0x5518d2[_0xe9c9('0x1a')],_0x45e912=_0x29fd96[_0xe9c9('0x1b')],_0x17672c=_0x29fd96['offset']+_0x29fd96[_0xe9c9('0x1c')],_0x570bc8;if(_0x17672c>=_0x25ed64){_0x17672c=_0x25ed64;_0x570bc8=0xc8;}else{_0x570bc8=0xce;}_0x434ec2[_0xe9c9('0x18')](_0x570bc8);return _0x434ec2[_0xe9c9('0x1d')](_0xe9c9('0x1e'),_0x45e912+'-'+_0x17672c+'/'+_0x25ed64)[_0xe9c9('0x1f')](_0x5518d2);}return null;};}function patchUpdates(_0x4f7a1d){return function(_0x5acceb){try{jsonpatch['apply'](_0x5acceb,_0x4f7a1d,!![]);}catch(_0x192a4b){return BPromise['reject'](_0x192a4b);}return _0x5acceb[_0xe9c9('0x20')]();};}function saveUpdates(_0xe74bba,_0x26982f){return function(_0x3a524c){if(_0x3a524c){return _0x3a524c[_0xe9c9('0x21')](_0xe74bba)[_0xe9c9('0x22')](function(_0x23559d){return _0x23559d;});}return null;};}function removeEntity(_0x19e03e,_0x3113ac){return function(_0x6bf602){if(_0x6bf602){return _0x6bf602['destroy']()[_0xe9c9('0x22')](function(){_0x19e03e[_0xe9c9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4fcdb,_0xff965d){return function(_0xb96a08){if(!_0xb96a08){_0xc4fcdb[_0xe9c9('0x17')](0x194);}return _0xb96a08;};}function handleError(_0x482256,_0x44e627){_0x44e627=_0x44e627||0x1f4;return function(_0x1c4cbf){logger[_0xe9c9('0x23')](_0x1c4cbf[_0xe9c9('0x24')]);if(_0x1c4cbf[_0xe9c9('0x25')]){delete _0x1c4cbf[_0xe9c9('0x25')];}_0x482256['status'](_0x44e627)['send'](_0x1c4cbf);};}exports['index']=function(_0x558e70,_0x47b959){var _0x47c629={},_0x39f455={},_0x71895b={'count':0x0,'rows':[]};var _0x4ce056=_[_0xe9c9('0x26')](db[_0xe9c9('0x27')]['rawAttributes'],function(_0x2db37f){return{'name':_0x2db37f[_0xe9c9('0x28')],'type':_0x2db37f[_0xe9c9('0x29')][_0xe9c9('0x2a')]};});_0x39f455[_0xe9c9('0x2b')]=_[_0xe9c9('0x26')](_0x4ce056,_0xe9c9('0x25'));_0x39f455[_0xe9c9('0x2c')]=_[_0xe9c9('0x2d')](_0x558e70[_0xe9c9('0x2c')]);_0x39f455[_0xe9c9('0x2e')]=_[_0xe9c9('0x2f')](_0x39f455[_0xe9c9('0x2b')],_0x39f455['query']);_0x47c629[_0xe9c9('0x30')]=_[_0xe9c9('0x2f')](_0x39f455[_0xe9c9('0x2b')],qs[_0xe9c9('0x31')](_0x558e70[_0xe9c9('0x2c')][_0xe9c9('0x31')]));_0x47c629['attributes']=_0x47c629['attributes']['length']?_0x47c629['attributes']:_0x39f455['model'];if(!_0x558e70[_0xe9c9('0x2c')][_0xe9c9('0x32')](_0xe9c9('0x33'))){_0x47c629[_0xe9c9('0x1c')]=qs[_0xe9c9('0x1c')](_0x558e70['query']['limit']);_0x47c629['offset']=qs[_0xe9c9('0x1b')](_0x558e70['query'][_0xe9c9('0x1b')]);}_0x47c629[_0xe9c9('0x34')]=qs[_0xe9c9('0x35')](_0x558e70[_0xe9c9('0x2c')][_0xe9c9('0x35')]);_0x47c629[_0xe9c9('0x36')]=qs[_0xe9c9('0x2e')](_[_0xe9c9('0x37')](_0x558e70['query'],_0x39f455[_0xe9c9('0x2e')]),_0x4ce056);if(_0x558e70[_0xe9c9('0x2c')][_0xe9c9('0x38')]){_0x47c629[_0xe9c9('0x36')]=_['merge'](_0x47c629['where'],{'$or':_['map'](_0x4ce056,function(_0x463636){if(_0x463636[_0xe9c9('0x29')]!==_0xe9c9('0x39')){var _0x4a95b6={};_0x4a95b6[_0x463636['name']]={'$like':'%'+_0x558e70[_0xe9c9('0x2c')]['filter']+'%'};return _0x4a95b6;}})});}_0x47c629=_[_0xe9c9('0x3a')]({},_0x47c629,_0x558e70[_0xe9c9('0x3b')]);var _0x38094b={'where':_0x47c629[_0xe9c9('0x36')]};return db[_0xe9c9('0x27')][_0xe9c9('0x1a')](_0x38094b)[_0xe9c9('0x22')](function(_0x2bbfb5){_0x71895b[_0xe9c9('0x1a')]=_0x2bbfb5;if(_0x558e70[_0xe9c9('0x2c')][_0xe9c9('0x3c')]){_0x47c629[_0xe9c9('0x3d')]=[{'all':!![]}];}return db['MailTransferReport'][_0xe9c9('0x3e')](_0x47c629);})['then'](function(_0x180548){_0x71895b[_0xe9c9('0x3f')]=_0x180548;return _0x71895b;})['then'](respondWithFilteredResult(_0x47b959,_0x47c629))[_0xe9c9('0x40')](handleError(_0x47b959,null));};exports[_0xe9c9('0x41')]=function(_0x40b3cd,_0x21ee78){var _0x5e025c={'raw':!![],'where':{'id':_0x40b3cd[_0xe9c9('0x42')]['id']}},_0x3e9480={};_0x3e9480['model']=_['keys'](db[_0xe9c9('0x27')][_0xe9c9('0x43')]);_0x3e9480[_0xe9c9('0x2c')]=_['keys'](_0x40b3cd['query']);_0x3e9480['filters']=_[_0xe9c9('0x2f')](_0x3e9480[_0xe9c9('0x2b')],_0x3e9480[_0xe9c9('0x2c')]);_0x5e025c[_0xe9c9('0x30')]=_[_0xe9c9('0x2f')](_0x3e9480[_0xe9c9('0x2b')],qs['fields'](_0x40b3cd['query'][_0xe9c9('0x31')]));_0x5e025c[_0xe9c9('0x30')]=_0x5e025c['attributes']['length']?_0x5e025c[_0xe9c9('0x30')]:_0x3e9480['model'];if(_0x40b3cd[_0xe9c9('0x2c')][_0xe9c9('0x3c')]){_0x5e025c[_0xe9c9('0x3d')]=[{'all':!![]}];}_0x5e025c=_[_0xe9c9('0x3a')]({},_0x5e025c,_0x40b3cd['options']);return db[_0xe9c9('0x27')][_0xe9c9('0x44')](_0x5e025c)[_0xe9c9('0x22')](handleEntityNotFound(_0x21ee78,null))['then'](respondWithResult(_0x21ee78,null))[_0xe9c9('0x40')](handleError(_0x21ee78,null));};exports[_0xe9c9('0x45')]=function(_0x4765ed,_0x2416e5){return db[_0xe9c9('0x27')]['create'](_0x4765ed['body'],{})[_0xe9c9('0x22')](respondWithResult(_0x2416e5,0xc9))['catch'](handleError(_0x2416e5,null));};exports['update']=function(_0x473f10,_0x4acf10){if(_0x473f10[_0xe9c9('0x46')]['id']){delete _0x473f10[_0xe9c9('0x46')]['id'];}return db[_0xe9c9('0x27')][_0xe9c9('0x44')]({'where':{'id':_0x473f10[_0xe9c9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4acf10,null))[_0xe9c9('0x22')](saveUpdates(_0x473f10['body'],null))['then'](respondWithResult(_0x4acf10,null))['catch'](handleError(_0x4acf10,null));};exports[_0xe9c9('0x47')]=function(_0x47ff08,_0x3d5d47){return db['MailTransferReport'][_0xe9c9('0x44')]({'where':{'id':_0x47ff08[_0xe9c9('0x42')]['id']}})[_0xe9c9('0x22')](handleEntityNotFound(_0x3d5d47,null))['then'](removeEntity(_0x3d5d47,null))[_0xe9c9('0x40')](handleError(_0x3d5d47,null));};exports[_0xe9c9('0x48')]=function(_0x45e650,_0x4c3456){return db['MailTransferReport'][_0xe9c9('0x48')]()[_0xe9c9('0x22')](respondWithResult(_0x4c3456,null))[_0xe9c9('0x40')](handleError(_0x4c3456,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b3fd686..96783fd 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 _0x3083=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport'];(function(_0x137237,_0x367ef0){var _0x7d5ded=function(_0x519179){while(--_0x519179){_0x137237['push'](_0x137237['shift']());}};_0x7d5ded(++_0x367ef0);}(_0x3083,0x182));var _0x3308=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x3083[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x3308('0x0'));var util=require(_0x3308('0x1'));var logger=require(_0x3308('0x2'))(_0x3308('0x3'));var moment=require(_0x3308('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3308('0x5'));var rimraf=require(_0x3308('0x6'));var config=require('../../config/environment');var attributes=require(_0x3308('0x7'));module['exports']=function(_0x2bfe5b,_0x47d44e){return _0x2bfe5b[_0x3308('0x8')](_0x3308('0x9'),attributes,{'tableName':_0x3308('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3308('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8979=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x8979,0x136));var _0x9897=function(_0x562895,_0x311e89){_0x562895=_0x562895-0x0;var _0x4b1a16=_0x8979[_0x562895];return _0x4b1a16;};'use strict';var _=require(_0x9897('0x0'));var util=require(_0x9897('0x1'));var logger=require(_0x9897('0x2'))(_0x9897('0x3'));var moment=require(_0x9897('0x4'));var BPromise=require(_0x9897('0x5'));var rp=require(_0x9897('0x6'));var fs=require('fs');var path=require(_0x9897('0x7'));var rimraf=require(_0x9897('0x8'));var config=require('../../config/environment');var attributes=require(_0x9897('0x9'));module['exports']=function(_0xa60841,_0x1f80bd){return _0xa60841[_0x9897('0xa')](_0x9897('0xb'),attributes,{'tableName':_0x9897('0xc'),'paranoid':![],'indexes':[{'name':_0x9897('0xd'),'fields':[_0x9897('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 891febf..f30fe88 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 _0xbaef=['then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xbaef,0x12a));var _0xfbae=function(_0x189a72,_0x4ac342){_0x189a72=_0x189a72-0x0;var _0x2b457a=_0xbaef[_0x189a72];return _0x2b457a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbae('0x0'));var BPromise=require(_0xfbae('0x1'));var rs=require(_0xfbae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbae('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbae('0x4'))('rpc');var config=require(_0xfbae('0x5'));var jayson=require(_0xfbae('0x6'));var client=jayson[_0xfbae('0x7')][_0xfbae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfba83c,_0x18669c,_0x506787){return new BPromise(function(_0x3dcb1c,_0x57f244){return client[_0xfbae('0x9')](_0xfba83c,_0x506787)[_0xfbae('0xa')](function(_0x3edf6a){logger[_0xfbae('0xb')](_0xfbae('0xc'),_0x18669c,'request\x20sent');logger[_0xfbae('0xd')](_0xfbae('0xe'),_0x18669c,_0xfbae('0xf'),JSON[_0xfbae('0x10')](_0x3edf6a));if(_0x3edf6a[_0xfbae('0x11')]){if(_0x3edf6a[_0xfbae('0x11')][_0xfbae('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x18669c,_0x3edf6a[_0xfbae('0x11')][_0xfbae('0x13')]);return _0x57f244(_0x3edf6a[_0xfbae('0x11')][_0xfbae('0x13')]);}logger[_0xfbae('0x11')](_0xfbae('0xc'),_0x18669c,_0x3edf6a[_0xfbae('0x11')][_0xfbae('0x13')]);return _0x3dcb1c(_0x3edf6a['error'][_0xfbae('0x13')]);}else{logger[_0xfbae('0xb')](_0xfbae('0xc'),_0x18669c,_0xfbae('0xf'));_0x3dcb1c(_0x3edf6a[_0xfbae('0x14')]['message']);}})[_0xfbae('0x15')](function(_0x269431){logger[_0xfbae('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x18669c,_0x269431);_0x57f244(_0x269431);});});} \ No newline at end of file +var _0xeda0=['../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../config/logger','rpc'];(function(_0x5783c0,_0x112041){var _0x90059f=function(_0x256cca){while(--_0x256cca){_0x5783c0['push'](_0x5783c0['shift']());}};_0x90059f(++_0x112041);}(_0xeda0,0xab));var _0x0eda=function(_0x5591b5,_0x3adb2d){_0x5591b5=_0x5591b5-0x0;var _0x121cac=_0xeda0[_0x5591b5];return _0x121cac;};'use strict';var _=require(_0x0eda('0x0'));var util=require(_0x0eda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0eda('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0eda('0x3'))(_0x0eda('0x4'));var config=require(_0x0eda('0x5'));var jayson=require(_0x0eda('0x6'));var client=jayson[_0x0eda('0x7')][_0x0eda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x194e04,_0x1517bb,_0x2a837a){return new BPromise(function(_0x59a03a,_0x436ed3){return client[_0x0eda('0x9')](_0x194e04,_0x2a837a)[_0x0eda('0xa')](function(_0x2ec1f3){logger[_0x0eda('0xb')](_0x0eda('0xc'),_0x1517bb,'request\x20sent');logger[_0x0eda('0xd')](_0x0eda('0xe'),_0x1517bb,_0x0eda('0xf'),JSON[_0x0eda('0x10')](_0x2ec1f3));if(_0x2ec1f3[_0x0eda('0x11')]){if(_0x2ec1f3['error'][_0x0eda('0x12')]===0x1f4){logger[_0x0eda('0x11')](_0x0eda('0xc'),_0x1517bb,_0x2ec1f3[_0x0eda('0x11')]['message']);return _0x436ed3(_0x2ec1f3[_0x0eda('0x11')][_0x0eda('0x13')]);}logger['error'](_0x0eda('0xc'),_0x1517bb,_0x2ec1f3[_0x0eda('0x11')][_0x0eda('0x13')]);return _0x59a03a(_0x2ec1f3[_0x0eda('0x11')]['message']);}else{logger[_0x0eda('0xb')](_0x0eda('0xc'),_0x1517bb,'request\x20sent');_0x59a03a(_0x2ec1f3[_0x0eda('0x14')][_0x0eda('0x13')]);}})[_0x0eda('0x15')](function(_0x4fec51){logger[_0x0eda('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1517bb,_0x4fec51);_0x436ed3(_0x4fec51);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 078318b..2a61bac 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 _0xc32f=['/:id','show','post','create','put','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x296a20,_0x5dac20){var _0x3465b0=function(_0x31d5d5){while(--_0x31d5d5){_0x296a20['push'](_0x296a20['shift']());}};_0x3465b0(++_0x5dac20);}(_0xc32f,0xc6));var _0xfc32=function(_0x359528,_0x4cd178){_0x359528=_0x359528-0x0;var _0xe738b1=_0xc32f[_0x359528];return _0xe738b1;};'use strict';var multer=require(_0xfc32('0x0'));var util=require(_0xfc32('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfc32('0x2'));var router=express[_0xfc32('0x3')]();var auth=require(_0xfc32('0x4'));var interaction=require(_0xfc32('0x5'));var config=require(_0xfc32('0x6'));var controller=require('./memberReport.controller');router[_0xfc32('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfc32('0x7')]('/describe',auth[_0xfc32('0x8')](),controller[_0xfc32('0x9')]);router[_0xfc32('0x7')](_0xfc32('0xa'),auth[_0xfc32('0x8')](),controller[_0xfc32('0xb')]);router[_0xfc32('0xc')]('/',auth[_0xfc32('0x8')](),controller[_0xfc32('0xd')]);router[_0xfc32('0xe')](_0xfc32('0xa'),auth[_0xfc32('0x8')](),controller['update']);router['delete'](_0xfc32('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xfc32('0xf')]=router; \ No newline at end of file +var _0x00b0=['describe','/:id','show','post','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x3a7cae,_0xfa58d){var _0x3a0869=function(_0xbcde88){while(--_0xbcde88){_0x3a7cae['push'](_0x3a7cae['shift']());}};_0x3a0869(++_0xfa58d);}(_0x00b0,0x1e3));var _0x000b=function(_0x6ccac6,_0x3613a3){_0x6ccac6=_0x6ccac6-0x0;var _0x335c4e=_0x00b0[_0x6ccac6];return _0x335c4e;};'use strict';var multer=require(_0x000b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x000b('0x1'));var express=require(_0x000b('0x2'));var router=express[_0x000b('0x3')]();var auth=require(_0x000b('0x4'));var interaction=require(_0x000b('0x5'));var config=require(_0x000b('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x000b('0x7')]);router[_0x000b('0x8')](_0x000b('0x9'),auth[_0x000b('0xa')](),controller[_0x000b('0xb')]);router['get'](_0x000b('0xc'),auth[_0x000b('0xa')](),controller[_0x000b('0xd')]);router[_0x000b('0xe')]('/',auth[_0x000b('0xa')](),controller['create']);router[_0x000b('0xf')]('/:id',auth[_0x000b('0xa')](),controller[_0x000b('0x10')]);router[_0x000b('0x11')](_0x000b('0xc'),auth['isAuthenticated'](),controller[_0x000b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 186c12a..230d637 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 _0x616b=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue','exitAt'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x616b,0x17d));var _0xb616=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0x616b[_0x3df822];return _0x4e457d;};'use strict';var Sequelize=require(_0xb616('0x0'));var moment=require('moment');module[_0xb616('0x1')]={'channel':{'type':Sequelize[_0xb616('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb616('0x2')]},'type':{'type':Sequelize[_0xb616('0x2')],'defaultValue':_0xb616('0x3'),'comment':_0xb616('0x4')},'duration':{'type':Sequelize[_0xb616('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb616('0x6')],'set':function(_0x254312){var _0xd6a820=moment(_0x254312);var _0x4e6b77=moment(this[_0xb616('0x7')]('enterAt'));var _0x59620f=_0xd6a820[_0xb616('0x8')](_0x4e6b77,'seconds');this[_0xb616('0x9')](_0xb616('0xa'),_0x254312);this[_0xb616('0x9')]('duration',_0x59620f||null);}},'data1':{'type':Sequelize[_0xb616('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb616('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xb616('0x2')],'comment':_0xb616('0xb')},'data4':{'type':Sequelize[_0xb616('0x2')],'comment':_0xb616('0xc')},'data5':{'type':Sequelize[_0xb616('0x2')],'comment':_0xb616('0xd')},'role':{'type':Sequelize[_0xb616('0x2')]},'internal':{'type':Sequelize[_0xb616('0x5')]},'uniqueid':{'type':Sequelize[_0xb616('0x2')]}}; \ No newline at end of file +var _0xdf40=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x585a32,_0x4b3dce){var _0x294211=function(_0x276515){while(--_0x276515){_0x585a32['push'](_0x585a32['shift']());}};_0x294211(++_0x4b3dce);}(_0xdf40,0x1dc));var _0x0df4=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xdf40[_0x5f1cf8];return _0x27d0fa;};'use strict';var Sequelize=require(_0x0df4('0x0'));var moment=require(_0x0df4('0x1'));module[_0x0df4('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0df4('0x3')]},'interface':{'type':Sequelize[_0x0df4('0x3')]},'type':{'type':Sequelize[_0x0df4('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x0df4('0x4')},'duration':{'type':Sequelize[_0x0df4('0x5')]},'enterAt':{'type':Sequelize[_0x0df4('0x6')]},'exitAt':{'type':Sequelize[_0x0df4('0x6')],'set':function(_0x98e918){var _0x3222b4=moment(_0x98e918);var _0xe2703e=moment(this[_0x0df4('0x7')](_0x0df4('0x8')));var _0x3212d6=_0x3222b4[_0x0df4('0x9')](_0xe2703e,'seconds');this[_0x0df4('0xa')](_0x0df4('0xb'),_0x98e918);this[_0x0df4('0xa')](_0x0df4('0xc'),_0x3212d6||null);}},'data1':{'type':Sequelize[_0x0df4('0x3')],'comment':_0x0df4('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0x0df4('0xe')},'data3':{'type':Sequelize[_0x0df4('0x3')],'comment':_0x0df4('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x0df4('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x0df4('0x11')},'role':{'type':Sequelize[_0x0df4('0x3')]},'internal':{'type':Sequelize[_0x0df4('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0d3fcca..815fa96 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 _0xc796=['includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','MemberReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0xc796,0x12f));var _0x6c79=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0xc796[_0x5341ff];return _0x53be58;};'use strict';var pdf=require(_0x6c79('0x0'));var emlformat=require(_0x6c79('0x1'));var rimraf=require(_0x6c79('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c79('0x3'));var rp=require('request-promise');var moment=require(_0x6c79('0x4'));var BPromise=require(_0x6c79('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6c79('0x6'));var csv=require(_0x6c79('0x7'));var ejs=require(_0x6c79('0x8'));var fs=require('fs');var _=require(_0x6c79('0x9'));var squel=require('squel');var crypto=require(_0x6c79('0xa'));var jsforce=require(_0x6c79('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c79('0xc'));var Papa=require(_0x6c79('0xd'));var Redis=require(_0x6c79('0xe'));var authService=require(_0x6c79('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6c79('0x10'));var hardwareService=require(_0x6c79('0x11'));var logger=require(_0x6c79('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6c79('0x13'));var db=require(_0x6c79('0x14'))['db'];function respondWithStatusCode(_0x46d4a,_0x4a0618){_0x4a0618=_0x4a0618||0xcc;return function(_0x37783d){if(_0x37783d){return _0x46d4a[_0x6c79('0x15')](_0x4a0618);}return _0x46d4a['status'](_0x4a0618)[_0x6c79('0x16')]();};}function respondWithResult(_0x247cdc,_0x31aa76){_0x31aa76=_0x31aa76||0xc8;return function(_0x2bacb7){if(_0x2bacb7){return _0x247cdc[_0x6c79('0x17')](_0x31aa76)['json'](_0x2bacb7);}};}function respondWithFilteredResult(_0x49f8fa,_0x52441d){return function(_0x6d2faf){if(_0x6d2faf){var _0x5cd05b=_0x6d2faf['count'],_0x4ebe13=_0x52441d[_0x6c79('0x18')],_0x355d09=_0x52441d[_0x6c79('0x18')]+_0x52441d['limit'],_0x26eeb2;if(_0x355d09>=_0x5cd05b){_0x355d09=_0x5cd05b;_0x26eeb2=0xc8;}else{_0x26eeb2=0xce;}_0x49f8fa[_0x6c79('0x17')](_0x26eeb2);return _0x49f8fa['set'](_0x6c79('0x19'),_0x4ebe13+'-'+_0x355d09+'/'+_0x5cd05b)[_0x6c79('0x1a')](_0x6d2faf);}return null;};}function patchUpdates(_0x4d6f3c){return function(_0x2653b1){try{jsonpatch[_0x6c79('0x1b')](_0x2653b1,_0x4d6f3c,!![]);}catch(_0x4379d0){return BPromise[_0x6c79('0x1c')](_0x4379d0);}return _0x2653b1[_0x6c79('0x1d')]();};}function saveUpdates(_0x301fac,_0x148135){return function(_0x393560){if(_0x393560){return _0x393560[_0x6c79('0x1e')](_0x301fac)['then'](function(_0x5b5eee){return _0x5b5eee;});}return null;};}function removeEntity(_0xf8ce21,_0x589989){return function(_0x23df4b){if(_0x23df4b){return _0x23df4b[_0x6c79('0x1f')]()[_0x6c79('0x20')](function(){_0xf8ce21[_0x6c79('0x17')](0xcc)[_0x6c79('0x16')]();});}};}function handleEntityNotFound(_0x10d0be,_0x5c40a6){return function(_0x57298e){if(!_0x57298e){_0x10d0be[_0x6c79('0x15')](0x194);}return _0x57298e;};}function handleError(_0xdfb750,_0x4899a){_0x4899a=_0x4899a||0x1f4;return function(_0x1c17f5){logger[_0x6c79('0x21')](_0x1c17f5[_0x6c79('0x22')]);if(_0x1c17f5[_0x6c79('0x23')]){delete _0x1c17f5[_0x6c79('0x23')];}_0xdfb750['status'](_0x4899a)['send'](_0x1c17f5);};}exports[_0x6c79('0x24')]=function(_0x25a06d,_0x558e23){var _0x21ad5d={},_0x5e7a41={},_0x19445b={'count':0x0,'rows':[]};var _0xbfd1f1=_['map'](db[_0x6c79('0x25')][_0x6c79('0x26')],function(_0x5b85a7){return{'name':_0x5b85a7[_0x6c79('0x27')],'type':_0x5b85a7[_0x6c79('0x28')]['key']};});_0x5e7a41[_0x6c79('0x29')]=_[_0x6c79('0x2a')](_0xbfd1f1,_0x6c79('0x23'));_0x5e7a41[_0x6c79('0x2b')]=_[_0x6c79('0x2c')](_0x25a06d[_0x6c79('0x2b')]);_0x5e7a41[_0x6c79('0x2d')]=_[_0x6c79('0x2e')](_0x5e7a41[_0x6c79('0x29')],_0x5e7a41[_0x6c79('0x2b')]);_0x21ad5d[_0x6c79('0x2f')]=_[_0x6c79('0x2e')](_0x5e7a41[_0x6c79('0x29')],qs[_0x6c79('0x30')](_0x25a06d['query'][_0x6c79('0x30')]));_0x21ad5d[_0x6c79('0x2f')]=_0x21ad5d[_0x6c79('0x2f')][_0x6c79('0x31')]?_0x21ad5d[_0x6c79('0x2f')]:_0x5e7a41[_0x6c79('0x29')];if(!_0x25a06d[_0x6c79('0x2b')][_0x6c79('0x32')](_0x6c79('0x33'))){_0x21ad5d[_0x6c79('0x34')]=qs[_0x6c79('0x34')](_0x25a06d['query']['limit']);_0x21ad5d[_0x6c79('0x18')]=qs['offset'](_0x25a06d[_0x6c79('0x2b')][_0x6c79('0x18')]);}_0x21ad5d[_0x6c79('0x35')]=qs[_0x6c79('0x36')](_0x25a06d[_0x6c79('0x2b')][_0x6c79('0x36')]);_0x21ad5d[_0x6c79('0x37')]=qs['filters'](_[_0x6c79('0x38')](_0x25a06d[_0x6c79('0x2b')],_0x5e7a41['filters']),_0xbfd1f1);if(_0x25a06d[_0x6c79('0x2b')][_0x6c79('0x39')]){_0x21ad5d[_0x6c79('0x37')]=_[_0x6c79('0x3a')](_0x21ad5d['where'],{'$or':_[_0x6c79('0x2a')](_0xbfd1f1,function(_0x5c4667){if(_0x5c4667['type']!==_0x6c79('0x3b')){var _0x44ba6b={};_0x44ba6b[_0x5c4667[_0x6c79('0x23')]]={'$like':'%'+_0x25a06d[_0x6c79('0x2b')][_0x6c79('0x39')]+'%'};return _0x44ba6b;}})});}_0x21ad5d=_[_0x6c79('0x3a')]({},_0x21ad5d,_0x25a06d[_0x6c79('0x3c')]);var _0x4245a0={'where':_0x21ad5d['where']};return db[_0x6c79('0x25')][_0x6c79('0x3d')](_0x4245a0)['then'](function(_0x20c4ed){_0x19445b[_0x6c79('0x3d')]=_0x20c4ed;if(_0x25a06d[_0x6c79('0x2b')][_0x6c79('0x3e')]){_0x21ad5d[_0x6c79('0x3f')]=[{'all':!![]}];}return db[_0x6c79('0x25')][_0x6c79('0x40')](_0x21ad5d);})[_0x6c79('0x20')](function(_0x369b7f){_0x19445b[_0x6c79('0x41')]=_0x369b7f;return _0x19445b;})[_0x6c79('0x20')](respondWithFilteredResult(_0x558e23,_0x21ad5d))['catch'](handleError(_0x558e23,null));};exports[_0x6c79('0x42')]=function(_0x1545bc,_0x45fde9){var _0x463e6b={'raw':!![],'where':{'id':_0x1545bc[_0x6c79('0x43')]['id']}},_0x471c13={};_0x471c13['model']=_[_0x6c79('0x2c')](db[_0x6c79('0x25')]['rawAttributes']);_0x471c13[_0x6c79('0x2b')]=_[_0x6c79('0x2c')](_0x1545bc['query']);_0x471c13[_0x6c79('0x2d')]=_[_0x6c79('0x2e')](_0x471c13[_0x6c79('0x29')],_0x471c13[_0x6c79('0x2b')]);_0x463e6b[_0x6c79('0x2f')]=_['intersection'](_0x471c13['model'],qs[_0x6c79('0x30')](_0x1545bc['query'][_0x6c79('0x30')]));_0x463e6b[_0x6c79('0x2f')]=_0x463e6b[_0x6c79('0x2f')]['length']?_0x463e6b['attributes']:_0x471c13[_0x6c79('0x29')];if(_0x1545bc[_0x6c79('0x2b')]['includeAll']){_0x463e6b[_0x6c79('0x3f')]=[{'all':!![]}];}_0x463e6b=_[_0x6c79('0x3a')]({},_0x463e6b,_0x1545bc['options']);return db[_0x6c79('0x25')][_0x6c79('0x44')](_0x463e6b)[_0x6c79('0x20')](handleEntityNotFound(_0x45fde9,null))['then'](respondWithResult(_0x45fde9,null))[_0x6c79('0x45')](handleError(_0x45fde9,null));};exports['create']=function(_0x4f0c94,_0x44316b){return db['MemberReport'][_0x6c79('0x46')](_0x4f0c94[_0x6c79('0x47')],{})[_0x6c79('0x20')](respondWithResult(_0x44316b,0xc9))[_0x6c79('0x45')](handleError(_0x44316b,null));};exports[_0x6c79('0x1e')]=function(_0x13ea79,_0x38a014){if(_0x13ea79[_0x6c79('0x47')]['id']){delete _0x13ea79[_0x6c79('0x47')]['id'];}return db[_0x6c79('0x25')][_0x6c79('0x44')]({'where':{'id':_0x13ea79[_0x6c79('0x43')]['id']}})[_0x6c79('0x20')](handleEntityNotFound(_0x38a014,null))['then'](saveUpdates(_0x13ea79[_0x6c79('0x47')],null))['then'](respondWithResult(_0x38a014,null))[_0x6c79('0x45')](handleError(_0x38a014,null));};exports[_0x6c79('0x1f')]=function(_0x5e82ba,_0x48c718){return db['MemberReport'][_0x6c79('0x44')]({'where':{'id':_0x5e82ba[_0x6c79('0x43')]['id']}})['then'](handleEntityNotFound(_0x48c718,null))['then'](removeEntity(_0x48c718,null))[_0x6c79('0x45')](handleError(_0x48c718,null));};exports[_0x6c79('0x48')]=function(_0x135c14,_0xb413d1){return db[_0x6c79('0x25')][_0x6c79('0x48')]()[_0x6c79('0x20')](respondWithResult(_0xb413d1,null))[_0x6c79('0x45')](handleError(_0xb413d1,null));}; \ No newline at end of file +var _0x4826=['query','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','params','keys','fields','include','options','find','body','catch','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','MemberReport','rawAttributes','type','key','model','filters','intersection'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4826,0xa7));var _0x6482=function(_0x3b9bf1,_0x4189c2){_0x3b9bf1=_0x3b9bf1-0x0;var _0x20e4d1=_0x4826[_0x3b9bf1];return _0x20e4d1;};'use strict';var pdf=require(_0x6482('0x0'));var emlformat=require(_0x6482('0x1'));var rimraf=require(_0x6482('0x2'));var zipdir=require(_0x6482('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6482('0x4'));var BPromise=require(_0x6482('0x5'));var Mustache=require(_0x6482('0x6'));var util=require(_0x6482('0x7'));var path=require('path');var sox=require(_0x6482('0x8'));var csv=require(_0x6482('0x9'));var ejs=require(_0x6482('0xa'));var fs=require('fs');var _=require(_0x6482('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6482('0xc'));var deskjs=require(_0x6482('0xd'));var toCsv=require(_0x6482('0x9'));var querystring=require(_0x6482('0xe'));var Papa=require(_0x6482('0xf'));var Redis=require(_0x6482('0x10'));var authService=require(_0x6482('0x11'));var qs=require(_0x6482('0x12'));var as=require(_0x6482('0x13'));var hardwareService=require(_0x6482('0x14'));var logger=require(_0x6482('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6482('0x16'));var db=require(_0x6482('0x17'))['db'];function respondWithStatusCode(_0x457ef1,_0x10428b){_0x10428b=_0x10428b||0xcc;return function(_0x311d61){if(_0x311d61){return _0x457ef1[_0x6482('0x18')](_0x10428b);}return _0x457ef1[_0x6482('0x19')](_0x10428b)['end']();};}function respondWithResult(_0x2dc7a2,_0x4a732d){_0x4a732d=_0x4a732d||0xc8;return function(_0x28e930){if(_0x28e930){return _0x2dc7a2['status'](_0x4a732d)['json'](_0x28e930);}};}function respondWithFilteredResult(_0x2128dc,_0x45dda1){return function(_0x385ee4){if(_0x385ee4){var _0x1fe178=_0x385ee4[_0x6482('0x1a')],_0x50a9ee=_0x45dda1[_0x6482('0x1b')],_0x315ec5=_0x45dda1[_0x6482('0x1b')]+_0x45dda1['limit'],_0xfcd31d;if(_0x315ec5>=_0x1fe178){_0x315ec5=_0x1fe178;_0xfcd31d=0xc8;}else{_0xfcd31d=0xce;}_0x2128dc[_0x6482('0x19')](_0xfcd31d);return _0x2128dc[_0x6482('0x1c')]('Content-Range',_0x50a9ee+'-'+_0x315ec5+'/'+_0x1fe178)[_0x6482('0x1d')](_0x385ee4);}return null;};}function patchUpdates(_0x4dce92){return function(_0x108010){try{jsonpatch[_0x6482('0x1e')](_0x108010,_0x4dce92,!![]);}catch(_0x45d4d2){return BPromise[_0x6482('0x1f')](_0x45d4d2);}return _0x108010[_0x6482('0x20')]();};}function saveUpdates(_0x27df87,_0x442ec5){return function(_0x20df0d){if(_0x20df0d){return _0x20df0d[_0x6482('0x21')](_0x27df87)[_0x6482('0x22')](function(_0x1f1f73){return _0x1f1f73;});}return null;};}function removeEntity(_0x516703,_0x25d022){return function(_0x34bb25){if(_0x34bb25){return _0x34bb25['destroy']()['then'](function(){_0x516703[_0x6482('0x19')](0xcc)[_0x6482('0x23')]();});}};}function handleEntityNotFound(_0x159f4d,_0x4e2bad){return function(_0x172173){if(!_0x172173){_0x159f4d['sendStatus'](0x194);}return _0x172173;};}function handleError(_0x34410b,_0x9bd8f4){_0x9bd8f4=_0x9bd8f4||0x1f4;return function(_0x3b2dd7){logger[_0x6482('0x24')](_0x3b2dd7[_0x6482('0x25')]);if(_0x3b2dd7['name']){delete _0x3b2dd7[_0x6482('0x26')];}_0x34410b['status'](_0x9bd8f4)[_0x6482('0x27')](_0x3b2dd7);};}exports[_0x6482('0x28')]=function(_0x17e962,_0x42eb36){var _0x176b4c={},_0x1ea6c0={},_0x498737={'count':0x0,'rows':[]};var _0x24c9f4=_[_0x6482('0x29')](db[_0x6482('0x2a')][_0x6482('0x2b')],function(_0x138be1){return{'name':_0x138be1['fieldName'],'type':_0x138be1[_0x6482('0x2c')][_0x6482('0x2d')]};});_0x1ea6c0[_0x6482('0x2e')]=_['map'](_0x24c9f4,_0x6482('0x26'));_0x1ea6c0['query']=_['keys'](_0x17e962['query']);_0x1ea6c0[_0x6482('0x2f')]=_[_0x6482('0x30')](_0x1ea6c0[_0x6482('0x2e')],_0x1ea6c0[_0x6482('0x31')]);_0x176b4c[_0x6482('0x32')]=_[_0x6482('0x30')](_0x1ea6c0[_0x6482('0x2e')],qs['fields'](_0x17e962[_0x6482('0x31')]['fields']));_0x176b4c['attributes']=_0x176b4c['attributes']['length']?_0x176b4c['attributes']:_0x1ea6c0[_0x6482('0x2e')];if(!_0x17e962[_0x6482('0x31')][_0x6482('0x33')](_0x6482('0x34'))){_0x176b4c[_0x6482('0x35')]=qs[_0x6482('0x35')](_0x17e962[_0x6482('0x31')][_0x6482('0x35')]);_0x176b4c[_0x6482('0x1b')]=qs['offset'](_0x17e962[_0x6482('0x31')]['offset']);}_0x176b4c['order']=qs[_0x6482('0x36')](_0x17e962['query'][_0x6482('0x36')]);_0x176b4c['where']=qs['filters'](_[_0x6482('0x37')](_0x17e962[_0x6482('0x31')],_0x1ea6c0[_0x6482('0x2f')]),_0x24c9f4);if(_0x17e962[_0x6482('0x31')][_0x6482('0x38')]){_0x176b4c[_0x6482('0x39')]=_[_0x6482('0x3a')](_0x176b4c[_0x6482('0x39')],{'$or':_['map'](_0x24c9f4,function(_0x538ee8){if(_0x538ee8[_0x6482('0x2c')]!==_0x6482('0x3b')){var _0x442709={};_0x442709[_0x538ee8[_0x6482('0x26')]]={'$like':'%'+_0x17e962[_0x6482('0x31')][_0x6482('0x38')]+'%'};return _0x442709;}})});}_0x176b4c=_[_0x6482('0x3a')]({},_0x176b4c,_0x17e962['options']);var _0x7a46c={'where':_0x176b4c[_0x6482('0x39')]};return db[_0x6482('0x2a')][_0x6482('0x1a')](_0x7a46c)[_0x6482('0x22')](function(_0x390e75){_0x498737[_0x6482('0x1a')]=_0x390e75;if(_0x17e962['query'][_0x6482('0x3c')]){_0x176b4c['include']=[{'all':!![]}];}return db[_0x6482('0x2a')]['findAll'](_0x176b4c);})[_0x6482('0x22')](function(_0x2f59f7){_0x498737[_0x6482('0x3d')]=_0x2f59f7;return _0x498737;})['then'](respondWithFilteredResult(_0x42eb36,_0x176b4c))['catch'](handleError(_0x42eb36,null));};exports['show']=function(_0x23f660,_0x2a8f96){var _0x57f7d9={'raw':!![],'where':{'id':_0x23f660[_0x6482('0x3e')]['id']}},_0x163f18={};_0x163f18['model']=_[_0x6482('0x3f')](db[_0x6482('0x2a')][_0x6482('0x2b')]);_0x163f18[_0x6482('0x31')]=_[_0x6482('0x3f')](_0x23f660[_0x6482('0x31')]);_0x163f18['filters']=_['intersection'](_0x163f18[_0x6482('0x2e')],_0x163f18[_0x6482('0x31')]);_0x57f7d9[_0x6482('0x32')]=_[_0x6482('0x30')](_0x163f18[_0x6482('0x2e')],qs[_0x6482('0x40')](_0x23f660[_0x6482('0x31')][_0x6482('0x40')]));_0x57f7d9['attributes']=_0x57f7d9['attributes']['length']?_0x57f7d9[_0x6482('0x32')]:_0x163f18[_0x6482('0x2e')];if(_0x23f660[_0x6482('0x31')]['includeAll']){_0x57f7d9[_0x6482('0x41')]=[{'all':!![]}];}_0x57f7d9=_[_0x6482('0x3a')]({},_0x57f7d9,_0x23f660[_0x6482('0x42')]);return db['MemberReport'][_0x6482('0x43')](_0x57f7d9)[_0x6482('0x22')](handleEntityNotFound(_0x2a8f96,null))[_0x6482('0x22')](respondWithResult(_0x2a8f96,null))['catch'](handleError(_0x2a8f96,null));};exports['create']=function(_0x110252,_0x3a47cf){return db[_0x6482('0x2a')]['create'](_0x110252[_0x6482('0x44')],{})[_0x6482('0x22')](respondWithResult(_0x3a47cf,0xc9))[_0x6482('0x45')](handleError(_0x3a47cf,null));};exports[_0x6482('0x21')]=function(_0x3f976d,_0x4da129){if(_0x3f976d[_0x6482('0x44')]['id']){delete _0x3f976d[_0x6482('0x44')]['id'];}return db['MemberReport'][_0x6482('0x43')]({'where':{'id':_0x3f976d[_0x6482('0x3e')]['id']}})[_0x6482('0x22')](handleEntityNotFound(_0x4da129,null))[_0x6482('0x22')](saveUpdates(_0x3f976d[_0x6482('0x44')],null))[_0x6482('0x22')](respondWithResult(_0x4da129,null))[_0x6482('0x45')](handleError(_0x4da129,null));};exports[_0x6482('0x46')]=function(_0x151bcc,_0x2a2372){return db['MemberReport']['find']({'where':{'id':_0x151bcc[_0x6482('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2a2372,null))[_0x6482('0x22')](removeEntity(_0x2a2372,null))[_0x6482('0x45')](handleError(_0x2a2372,null));};exports[_0x6482('0x47')]=function(_0xa6e1bc,_0x22db30){return db[_0x6482('0x2a')][_0x6482('0x47')]()[_0x6482('0x22')](respondWithResult(_0x22db30,null))['catch'](handleError(_0x22db30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 91e8694..511ea6b 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 _0x57d4=['path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','interface','lodash','util','api','moment','bluebird','request-promise'];(function(_0x29a40a,_0x234214){var _0x6182e9=function(_0x569d5d){while(--_0x569d5d){_0x29a40a['push'](_0x29a40a['shift']());}};_0x6182e9(++_0x234214);}(_0x57d4,0x78));var _0x457d=function(_0x4cc620,_0x210a03){_0x4cc620=_0x4cc620-0x0;var _0x13d46a=_0x57d4[_0x4cc620];return _0x13d46a;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));module[_0x457d('0xa')]=function(_0x247ec7,_0x3fd867){return _0x247ec7['define'](_0x457d('0xb'),attributes,{'tableName':_0x457d('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x457d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56a4=['rimraf','../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','membername','lodash','util','api','moment','path'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x56a4,0x11b));var _0x456a=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x56a4[_0x4f1da5];return _0xe972a8;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('MemberReport',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[{'name':_0x456a('0xa'),'fields':[_0x456a('0xb'),'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 fa714da..796bc91 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 _0xcffa=['../../config/utils','../../config/logger','rpc','jayson/promise','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetMemberReport','MemberReport','raw','options','where','attributes','include','model','debug','CreateMemberReport','create','body','stringify','UpdateMemberReport','update','lodash','util','bluebird','ioredis'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xcffa,0xe3));var _0xacff=function(_0x302356,_0x5c507c){_0x302356=_0x302356-0x0;var _0x442d93=_0xcffa[_0x302356];return _0x442d93;};'use strict';var _=require(_0xacff('0x0'));var util=require(_0xacff('0x1'));var moment=require('moment');var BPromise=require(_0xacff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xacff('0x4'));var logger=require(_0xacff('0x5'))(_0xacff('0x6'));var config=require('../../config/environment');var jayson=require(_0xacff('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x419fda,_0x3d14d6,_0x33b2dd){return new BPromise(function(_0x1095e7,_0x3821ef){return client['request'](_0x419fda,_0x33b2dd)[_0xacff('0x8')](function(_0x13e3e7){logger[_0xacff('0x9')](_0xacff('0xa'),_0x3d14d6,'request\x20sent');logger['debug'](_0xacff('0xb'),_0x3d14d6,_0xacff('0xc'),JSON['stringify'](_0x13e3e7));if(_0x13e3e7['error']){if(_0x13e3e7['error'][_0xacff('0xd')]===0x1f4){logger[_0xacff('0xe')](_0xacff('0xa'),_0x3d14d6,_0x13e3e7[_0xacff('0xe')][_0xacff('0xf')]);return _0x3821ef(_0x13e3e7[_0xacff('0xe')][_0xacff('0xf')]);}logger['error'](_0xacff('0xa'),_0x3d14d6,_0x13e3e7[_0xacff('0xe')][_0xacff('0xf')]);return _0x1095e7(_0x13e3e7[_0xacff('0xe')][_0xacff('0xf')]);}else{logger[_0xacff('0x9')]('MemberReport,\x20%s,\x20%s',_0x3d14d6,_0xacff('0xc'));_0x1095e7(_0x13e3e7[_0xacff('0x10')]['message']);}})[_0xacff('0x11')](function(_0x1c5f7a){logger['error'](_0xacff('0xa'),_0x3d14d6,_0x1c5f7a);_0x3821ef(_0x1c5f7a);});});}exports[_0xacff('0x12')]=function(_0x330c08){var _0x33d88d=this;return new Promise(function(_0x3d5c6f,_0x40e7f7){return db[_0xacff('0x13')]['findAll']({'raw':_0x330c08['options']?_0x330c08['options'][_0xacff('0x14')]===undefined?!![]:![]:!![],'where':_0x330c08[_0xacff('0x15')]?_0x330c08[_0xacff('0x15')][_0xacff('0x16')]||null:null,'attributes':_0x330c08[_0xacff('0x15')]?_0x330c08['options'][_0xacff('0x17')]||null:null,'limit':_0x330c08[_0xacff('0x15')]?_0x330c08['options']['limit']||null:null,'include':_0x330c08[_0xacff('0x15')]?_0x330c08[_0xacff('0x15')][_0xacff('0x18')]?_['map'](_0x330c08['options'][_0xacff('0x18')],function(_0x193a0a){return{'model':db[_0x193a0a[_0xacff('0x19')]],'as':_0x193a0a['as'],'attributes':_0x193a0a[_0xacff('0x17')],'include':_0x193a0a[_0xacff('0x18')]?_['map'](_0x193a0a['include'],function(_0x4cac88){return{'model':db[_0x4cac88[_0xacff('0x19')]],'as':_0x4cac88['as'],'attributes':_0x4cac88['attributes'],'include':_0x4cac88[_0xacff('0x18')]?_['map'](_0x4cac88[_0xacff('0x18')],function(_0xf7e365){return{'model':db[_0xf7e365['model']],'as':_0xf7e365['as'],'attributes':_0xf7e365[_0xacff('0x17')]};}):[]};}):[]};}):[]:[]})[_0xacff('0x8')](function(_0x1dfb87){logger[_0xacff('0x9')](_0xacff('0x12'),_0x330c08);logger[_0xacff('0x1a')](_0xacff('0x12'),_0x330c08,JSON['stringify'](_0x1dfb87));_0x3d5c6f(_0x1dfb87);})[_0xacff('0x11')](function(_0x4287a4){logger['error'](_0xacff('0x12'),_0x4287a4[_0xacff('0xf')],_0x330c08);_0x40e7f7(_0x33d88d['error'](0x1f4,_0x4287a4[_0xacff('0xf')]));});});};exports[_0xacff('0x1b')]=function(_0x3be66a){var _0x372c9c=this;return new Promise(function(_0x52865d,_0x732d28){return db[_0xacff('0x13')][_0xacff('0x1c')](_0x3be66a[_0xacff('0x1d')],{'raw':_0x3be66a[_0xacff('0x15')]?_0x3be66a[_0xacff('0x15')][_0xacff('0x14')]===undefined?!![]:![]:!![]})[_0xacff('0x8')](function(_0x8117c1){logger[_0xacff('0x9')](_0xacff('0x1b'),_0x3be66a);logger[_0xacff('0x1a')](_0xacff('0x1b'),_0x3be66a,JSON[_0xacff('0x1e')](_0x8117c1));_0x52865d(_0x8117c1);})[_0xacff('0x11')](function(_0x18c082){logger[_0xacff('0xe')](_0xacff('0x1b'),_0x18c082[_0xacff('0xf')],_0x3be66a);_0x732d28(_0x372c9c[_0xacff('0xe')](0x1f4,_0x18c082[_0xacff('0xf')]));});});};exports[_0xacff('0x1f')]=function(_0x5491f3){var _0x1f847a=this;return new Promise(function(_0x5c5326,_0x3586e2){return db[_0xacff('0x13')][_0xacff('0x20')](_0x5491f3['body'],{'raw':_0x5491f3['options']?_0x5491f3[_0xacff('0x15')][_0xacff('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5491f3[_0xacff('0x15')]?_0x5491f3[_0xacff('0x15')]['where']||null:null,'attributes':_0x5491f3[_0xacff('0x15')]?_0x5491f3[_0xacff('0x15')]['attributes']||null:null,'limit':_0x5491f3[_0xacff('0x15')]?_0x5491f3[_0xacff('0x15')]['limit']||null:null})[_0xacff('0x8')](function(_0x4b3bb9){logger['info'](_0xacff('0x1f'),_0x5491f3);logger['debug'](_0xacff('0x1f'),_0x5491f3,JSON['stringify'](_0x4b3bb9));_0x5c5326(_0x4b3bb9);})[_0xacff('0x11')](function(_0x25b968){logger[_0xacff('0xe')]('UpdateMemberReport',_0x25b968['message'],_0x5491f3);_0x3586e2(_0x1f847a['error'](0x1f4,_0x25b968[_0xacff('0xf')]));});});}; \ No newline at end of file +var _0xdc9f=['GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','then','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x4b1f65,_0x2197b9){var _0x57616b=function(_0x72f3b){while(--_0x72f3b){_0x4b1f65['push'](_0x4b1f65['shift']());}};_0x57616b(++_0x2197b9);}(_0xdc9f,0xb5));var _0xfdc9=function(_0x2a5b54,_0x409fc8){_0x2a5b54=_0x2a5b54-0x0;var _0x38baaf=_0xdc9f[_0x2a5b54];return _0x38baaf;};'use strict';var _=require(_0xfdc9('0x0'));var util=require(_0xfdc9('0x1'));var moment=require(_0xfdc9('0x2'));var BPromise=require(_0xfdc9('0x3'));var rs=require(_0xfdc9('0x4'));var fs=require('fs');var Redis=require(_0xfdc9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfdc9('0x6'))(_0xfdc9('0x7'));var config=require(_0xfdc9('0x8'));var jayson=require(_0xfdc9('0x9'));var client=jayson[_0xfdc9('0xa')][_0xfdc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x478521,_0x35b136,_0x44a67b){return new BPromise(function(_0x5a2dfc,_0x589daf){return client[_0xfdc9('0xc')](_0x478521,_0x44a67b)['then'](function(_0x20af8e){logger['info'](_0xfdc9('0xd'),_0x35b136,_0xfdc9('0xe'));logger[_0xfdc9('0xf')](_0xfdc9('0x10'),_0x35b136,_0xfdc9('0xe'),JSON[_0xfdc9('0x11')](_0x20af8e));if(_0x20af8e['error']){if(_0x20af8e[_0xfdc9('0x12')][_0xfdc9('0x13')]===0x1f4){logger[_0xfdc9('0x12')]('MemberReport,\x20%s,\x20%s',_0x35b136,_0x20af8e[_0xfdc9('0x12')][_0xfdc9('0x14')]);return _0x589daf(_0x20af8e[_0xfdc9('0x12')][_0xfdc9('0x14')]);}logger[_0xfdc9('0x12')](_0xfdc9('0xd'),_0x35b136,_0x20af8e['error']['message']);return _0x5a2dfc(_0x20af8e[_0xfdc9('0x12')][_0xfdc9('0x14')]);}else{logger[_0xfdc9('0x15')](_0xfdc9('0xd'),_0x35b136,_0xfdc9('0xe'));_0x5a2dfc(_0x20af8e[_0xfdc9('0x16')][_0xfdc9('0x14')]);}})[_0xfdc9('0x17')](function(_0x45e560){logger[_0xfdc9('0x12')]('MemberReport,\x20%s,\x20%s',_0x35b136,_0x45e560);_0x589daf(_0x45e560);});});}exports[_0xfdc9('0x18')]=function(_0x13af9c){var _0x5741e0=this;return new Promise(function(_0x523a7b,_0x38b2f){return db[_0xfdc9('0x19')][_0xfdc9('0x1a')]({'raw':_0x13af9c[_0xfdc9('0x1b')]?_0x13af9c['options'][_0xfdc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x13af9c[_0xfdc9('0x1b')]?_0x13af9c[_0xfdc9('0x1b')][_0xfdc9('0x1d')]||null:null,'attributes':_0x13af9c['options']?_0x13af9c[_0xfdc9('0x1b')][_0xfdc9('0x1e')]||null:null,'limit':_0x13af9c[_0xfdc9('0x1b')]?_0x13af9c[_0xfdc9('0x1b')][_0xfdc9('0x1f')]||null:null,'include':_0x13af9c[_0xfdc9('0x1b')]?_0x13af9c[_0xfdc9('0x1b')]['include']?_[_0xfdc9('0x20')](_0x13af9c[_0xfdc9('0x1b')][_0xfdc9('0x21')],function(_0x1acd8d){return{'model':db[_0x1acd8d[_0xfdc9('0x22')]],'as':_0x1acd8d['as'],'attributes':_0x1acd8d['attributes'],'include':_0x1acd8d['include']?_[_0xfdc9('0x20')](_0x1acd8d[_0xfdc9('0x21')],function(_0xbfda45){return{'model':db[_0xbfda45[_0xfdc9('0x22')]],'as':_0xbfda45['as'],'attributes':_0xbfda45[_0xfdc9('0x1e')],'include':_0xbfda45[_0xfdc9('0x21')]?_[_0xfdc9('0x20')](_0xbfda45[_0xfdc9('0x21')],function(_0x269fcc){return{'model':db[_0x269fcc['model']],'as':_0x269fcc['as'],'attributes':_0x269fcc[_0xfdc9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfdc9('0x23')](function(_0x39ea16){logger['info']('GetMemberReport',_0x13af9c);logger['debug'](_0xfdc9('0x18'),_0x13af9c,JSON[_0xfdc9('0x11')](_0x39ea16));_0x523a7b(_0x39ea16);})[_0xfdc9('0x17')](function(_0x2f9f74){logger[_0xfdc9('0x12')](_0xfdc9('0x18'),_0x2f9f74[_0xfdc9('0x14')],_0x13af9c);_0x38b2f(_0x5741e0['error'](0x1f4,_0x2f9f74[_0xfdc9('0x14')]));});});};exports[_0xfdc9('0x24')]=function(_0x26903f){var _0x1bed09=this;return new Promise(function(_0x37af36,_0x17c46e){return db[_0xfdc9('0x19')][_0xfdc9('0x25')](_0x26903f[_0xfdc9('0x26')],{'raw':_0x26903f['options']?_0x26903f[_0xfdc9('0x1b')][_0xfdc9('0x1c')]===undefined?!![]:![]:!![]})[_0xfdc9('0x23')](function(_0x34300e){logger['info']('CreateMemberReport',_0x26903f);logger[_0xfdc9('0xf')](_0xfdc9('0x24'),_0x26903f,JSON[_0xfdc9('0x11')](_0x34300e));_0x37af36(_0x34300e);})['catch'](function(_0x9792d0){logger[_0xfdc9('0x12')](_0xfdc9('0x24'),_0x9792d0[_0xfdc9('0x14')],_0x26903f);_0x17c46e(_0x1bed09[_0xfdc9('0x12')](0x1f4,_0x9792d0[_0xfdc9('0x14')]));});});};exports[_0xfdc9('0x27')]=function(_0x3c2fa2){var _0x15c9be=this;return new Promise(function(_0x10cf5f,_0x12e417){return db[_0xfdc9('0x19')][_0xfdc9('0x28')](_0x3c2fa2[_0xfdc9('0x26')],{'raw':_0x3c2fa2['options']?_0x3c2fa2[_0xfdc9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c2fa2['options']?_0x3c2fa2[_0xfdc9('0x1b')]['where']||null:null,'attributes':_0x3c2fa2[_0xfdc9('0x1b')]?_0x3c2fa2[_0xfdc9('0x1b')][_0xfdc9('0x1e')]||null:null,'limit':_0x3c2fa2[_0xfdc9('0x1b')]?_0x3c2fa2[_0xfdc9('0x1b')][_0xfdc9('0x1f')]||null:null})[_0xfdc9('0x23')](function(_0x4f5027){logger[_0xfdc9('0x15')]('UpdateMemberReport',_0x3c2fa2);logger['debug']('UpdateMemberReport',_0x3c2fa2,JSON[_0xfdc9('0x11')](_0x4f5027));_0x10cf5f(_0x4f5027);})[_0xfdc9('0x17')](function(_0x337ac9){logger[_0xfdc9('0x12')]('UpdateMemberReport',_0x337ac9[_0xfdc9('0x14')],_0x3c2fa2);_0x12e417(_0x15c9be[_0xfdc9('0x12')](0x1f4,_0x337ac9[_0xfdc9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 523f867..689be8b 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 _0x63a5=['./migration.controller','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19db4a,_0x39f04d){var _0x274fd4=function(_0x558813){while(--_0x558813){_0x19db4a['push'](_0x19db4a['shift']());}};_0x274fd4(++_0x39f04d);}(_0x63a5,0x18e));var _0x563a=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x63a5[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var path=require(_0x563a('0x2'));var timeout=require('connect-timeout');var express=require(_0x563a('0x3'));var router=express['Router']();var auth=require(_0x563a('0x4'));var interaction=require(_0x563a('0x5'));var config=require(_0x563a('0x6'));var controller=require(_0x563a('0x7'));router['get']('/',controller['index']);module[_0x563a('0x8')]=router; \ No newline at end of file +var _0xeffd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x5351d4,_0x9fad72){var _0x158dd6=function(_0x21c0b4){while(--_0x21c0b4){_0x5351d4['push'](_0x5351d4['shift']());}};_0x158dd6(++_0x9fad72);}(_0xeffd,0x6b));var _0xdeff=function(_0x3eb975,_0x2e601e){_0x3eb975=_0x3eb975-0x0;var _0x4b81e6=_0xeffd[_0x3eb975];return _0x4b81e6;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')]('/',controller[_0xdeff('0xa')]);module[_0xdeff('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 50733ac..b60bac9 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 _0x9b5c=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b5c,0x6a));var _0xc9b5=function(_0x56821f,_0x39b3cd){_0x56821f=_0x56821f-0x0;var _0x408ce3=_0x9b5c[_0x56821f];return _0x408ce3;};'use strict';var Sequelize=require(_0xc9b5('0x0'));module[_0xc9b5('0x1')]={'version':{'type':Sequelize[_0xc9b5('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x597f=['STRING','version','sequelize'];(function(_0x12e73c,_0x2cbe1d){var _0x4c41cb=function(_0x10283b){while(--_0x10283b){_0x12e73c['push'](_0x12e73c['shift']());}};_0x4c41cb(++_0x2cbe1d);}(_0x597f,0xd1));var _0xf597=function(_0x1e23b8,_0x4690f9){_0x1e23b8=_0x1e23b8-0x0;var _0x11f0f3=_0x597f[_0x1e23b8];return _0x11f0f3;};'use strict';var Sequelize=require(_0xf597('0x0'));module['exports']={'version':{'type':Sequelize[_0xf597('0x1')],'unique':_0xf597('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 270835e..131ede5 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 _0x9c44=['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','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Migration','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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['Migration'][_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));}; \ No newline at end of file +var _0x008c=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','Migration','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x208542,_0x1696ff){var _0x476179=function(_0xa395ea){while(--_0xa395ea){_0x208542['push'](_0x208542['shift']());}};_0x476179(++_0x1696ff);}(_0x008c,0x188));var _0xc008=function(_0x18fd4b,_0x475e2e){_0x18fd4b=_0x18fd4b-0x0;var _0xe5d6b4=_0x008c[_0x18fd4b];return _0xe5d6b4;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 539cd4f..a5db3b2 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 _0x758e=['Migration','lodash','api','moment','bluebird','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x460fab,_0x463804){var _0x4860fb=function(_0x4fd15e){while(--_0x4fd15e){_0x460fab['push'](_0x460fab['shift']());}};_0x4860fb(++_0x463804);}(_0x758e,0x1af));var _0xe758=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x758e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe758('0x4'));var config=require(_0xe758('0x5'));var attributes=require(_0xe758('0x6'));module[_0xe758('0x7')]=function(_0x5a2226,_0x2cdf89){return _0x5a2226[_0xe758('0x8')](_0xe758('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fdc=['util','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x4fdc,0x84));var _0xc4fd=function(_0x45973a,_0x3f4653){_0x45973a=_0x45973a-0x0;var _0x1da67b=_0x4fdc[_0x45973a];return _0x1da67b;};'use strict';var _=require('lodash');var util=require(_0xc4fd('0x0'));var logger=require('../../config/logger')(_0xc4fd('0x1'));var moment=require(_0xc4fd('0x2'));var BPromise=require(_0xc4fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4fd('0x4'));var rimraf=require(_0xc4fd('0x5'));var config=require(_0xc4fd('0x6'));var attributes=require(_0xc4fd('0x7'));module[_0xc4fd('0x8')]=function(_0x2547d5,_0x3157b2){return _0x2547d5['define'](_0xc4fd('0x9'),attributes,{'tableName':_0xc4fd('0xa'),'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 37426e2..a332ff9 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 _0xabd6=['jayson/promise','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xabd6,0x19d));var _0x6abd=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0xabd6[_0x214a25];return _0x405988;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6abd('0x0'));var BPromise=require(_0x6abd('0x1'));var rs=require(_0x6abd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6abd('0x3'));var logger=require('../../config/logger')(_0x6abd('0x4'));var config=require('../../config/environment');var jayson=require(_0x6abd('0x5'));var client=jayson[_0x6abd('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x529c0e,_0x1705bc,_0x37126f){return new BPromise(function(_0x85d2ab,_0x4d8bde){return client[_0x6abd('0x7')](_0x529c0e,_0x37126f)[_0x6abd('0x8')](function(_0x166400){logger['info'](_0x6abd('0x9'),_0x1705bc,_0x6abd('0xa'));logger[_0x6abd('0xb')](_0x6abd('0xc'),_0x1705bc,_0x6abd('0xa'),JSON['stringify'](_0x166400));if(_0x166400[_0x6abd('0xd')]){if(_0x166400['error'][_0x6abd('0xe')]===0x1f4){logger[_0x6abd('0xd')](_0x6abd('0x9'),_0x1705bc,_0x166400[_0x6abd('0xd')][_0x6abd('0xf')]);return _0x4d8bde(_0x166400[_0x6abd('0xd')][_0x6abd('0xf')]);}logger[_0x6abd('0xd')]('Migration,\x20%s,\x20%s',_0x1705bc,_0x166400[_0x6abd('0xd')][_0x6abd('0xf')]);return _0x85d2ab(_0x166400[_0x6abd('0xd')][_0x6abd('0xf')]);}else{logger[_0x6abd('0x10')]('Migration,\x20%s,\x20%s',_0x1705bc,_0x6abd('0xa'));_0x85d2ab(_0x166400[_0x6abd('0x11')][_0x6abd('0xf')]);}})[_0x6abd('0x12')](function(_0x185b9d){logger[_0x6abd('0xd')](_0x6abd('0x9'),_0x1705bc,_0x185b9d);_0x4d8bde(_0x185b9d);});});} \ No newline at end of file +var _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message'];(function(_0x5ed167,_0x4c7bfa){var _0x1885f0=function(_0x3c6a92){while(--_0x3c6a92){_0x5ed167['push'](_0x5ed167['shift']());}};_0x1885f0(++_0x4c7bfa);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x5e8ec9,_0x45546d){_0x5e8ec9=_0x5e8ec9-0x0;var _0x1f0d28=_0xd2f5[_0x5e8ec9];return _0x1f0d28;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf53b,_0x57673f,_0x3062bf){return new BPromise(function(_0x72bf9f,_0x330195){return client['request'](_0xbf53b,_0x3062bf)['then'](function(_0x43293d){logger[_0x5d2f('0xa')]('Migration,\x20%s,\x20%s',_0x57673f,_0x5d2f('0xb'));logger[_0x5d2f('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x57673f,'request\x20sent',JSON[_0x5d2f('0xd')](_0x43293d));if(_0x43293d[_0x5d2f('0xe')]){if(_0x43293d['error'][_0x5d2f('0xf')]===0x1f4){logger[_0x5d2f('0xe')](_0x5d2f('0x10'),_0x57673f,_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);return _0x330195(_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);}logger['error']('Migration,\x20%s,\x20%s',_0x57673f,_0x43293d['error']['message']);return _0x72bf9f(_0x43293d[_0x5d2f('0xe')]['message']);}else{logger[_0x5d2f('0xa')](_0x5d2f('0x10'),_0x57673f,_0x5d2f('0xb'));_0x72bf9f(_0x43293d[_0x5d2f('0x12')]['message']);}})[_0x5d2f('0x13')](function(_0x875750){logger['error'](_0x5d2f('0x10'),_0x57673f,_0x875750);_0x330195(_0x875750);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 662293f..2b5e34a 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 _0xc9c3=['show','post','create','put','update','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','/:id','isAuthenticated'];(function(_0x4242b8,_0x222703){var _0x47c1c8=function(_0x1ef3b0){while(--_0x1ef3b0){_0x4242b8['push'](_0x4242b8['shift']());}};_0x47c1c8(++_0x222703);}(_0xc9c3,0x96));var _0x3c9c=function(_0x4dc4ee,_0x5501bc){_0x4dc4ee=_0x4dc4ee-0x0;var _0x456ff8=_0xc9c3[_0x4dc4ee];return _0x456ff8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x3c9c('0x1'));var router=express[_0x3c9c('0x2')]();var auth=require(_0x3c9c('0x3'));var interaction=require(_0x3c9c('0x4'));var config=require(_0x3c9c('0x5'));var controller=require(_0x3c9c('0x6'));router[_0x3c9c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3c9c('0x8'),auth[_0x3c9c('0x9')](),controller[_0x3c9c('0xa')]);router[_0x3c9c('0xb')]('/',auth[_0x3c9c('0x9')](),controller[_0x3c9c('0xc')]);router[_0x3c9c('0xd')](_0x3c9c('0x8'),auth[_0x3c9c('0x9')](),controller[_0x3c9c('0xe')]);router['delete'](_0x3c9c('0x8'),auth[_0x3c9c('0x9')](),controller['destroy']);module[_0x3c9c('0xf')]=router; \ No newline at end of file +var _0x9e71=['../../components/interaction/service','./network.controller','get','isAuthenticated','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e71,0x1a8));var _0x19e7=function(_0x51078e,_0x5b721f){_0x51078e=_0x51078e-0x0;var _0xa72295=_0x9e71[_0x51078e];return _0xa72295;};'use strict';var multer=require(_0x19e7('0x0'));var util=require(_0x19e7('0x1'));var path=require('path');var timeout=require(_0x19e7('0x2'));var express=require(_0x19e7('0x3'));var router=express[_0x19e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x19e7('0x5'));var config=require('../../config/environment');var controller=require(_0x19e7('0x6'));router[_0x19e7('0x7')]('/',auth[_0x19e7('0x8')](),controller['index']);router[_0x19e7('0x7')](_0x19e7('0x9'),auth[_0x19e7('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x19e7('0x9'),auth['isAuthenticated'](),controller[_0x19e7('0xa')]);router['delete'](_0x19e7('0x9'),auth[_0x19e7('0x8')](),controller[_0x19e7('0xb')]);module[_0x19e7('0xc')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1dde459..c3993a0 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(_0x455b6,_0x5dd482){var _0x4838ac=function(_0x3ba231){while(--_0x3ba231){_0x455b6['push'](_0x455b6['shift']());}};_0x4838ac(++_0x5dd482);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x2acd2a,_0x3bf251){var _0x30f913=function(_0x17a993){while(--_0x17a993){_0x2acd2a['push'](_0x2acd2a['shift']());}};_0x30f913(++_0x3bf251);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 4dc2210..31279d5 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 _0x1b02=['readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','TURN','chan_sip.so','STUN','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','then','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','params','keys','find','create','transaction','body','findAll','toUpperCase'];(function(_0x578135,_0x57a442){var _0x537304=function(_0x5bcd9c){while(--_0x5bcd9c){_0x578135['push'](_0x578135['shift']());}};_0x537304(++_0x57a442);}(_0x1b02,0x151));var _0x21b0=function(_0x54d1ae,_0x56a2b9){_0x54d1ae=_0x54d1ae-0x0;var _0x5b033b=_0x1b02[_0x54d1ae];return _0x5b033b;};'use strict';var pdf=require(_0x21b0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x21b0('0x1'));var jsonpatch=require(_0x21b0('0x2'));var rp=require(_0x21b0('0x3'));var moment=require(_0x21b0('0x4'));var BPromise=require(_0x21b0('0x5'));var Mustache=require('mustache');var util=require(_0x21b0('0x6'));var path=require(_0x21b0('0x7'));var sox=require(_0x21b0('0x8'));var csv=require('to-csv');var ejs=require(_0x21b0('0x9'));var fs=require('fs');var _=require(_0x21b0('0xa'));var squel=require(_0x21b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x21b0('0xc'));var deskjs=require(_0x21b0('0xd'));var toCsv=require(_0x21b0('0xe'));var querystring=require('querystring');var Papa=require(_0x21b0('0xf'));var Redis=require(_0x21b0('0x10'));var authService=require(_0x21b0('0x11'));var qs=require(_0x21b0('0x12'));var as=require(_0x21b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21b0('0x14'))('api');var utils=require(_0x21b0('0x15'));var config=require(_0x21b0('0x16'));var db=require(_0x21b0('0x17'))['db'];var jayson=require(_0x21b0('0x18'));var client=jayson[_0x21b0('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x4df4d1,_0x41dcda,_0x1c606e){if(_0x1c606e){var _0x22fb26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22fb26['test'](_0x41dcda)){return _0x4df4d1;}else{throw new db[(_0x21b0('0x1a'))]['ValidationError'](_0x21b0('0x1b'));}}else{return _0x4df4d1;}}function respondWithRpcPromise(_0x40edee,_0x12bf95,_0x56499f,_0x5cdc45){return new BPromise(function(_0x1bf1e6,_0x4bb092){var _0x32717a=_0x5cdc45||client;return _0x32717a['request'](_0x40edee,_0x56499f)[_0x21b0('0x1c')](function(_0x40eb62){logger[_0x21b0('0x1d')](_0x21b0('0x1e'),_0x12bf95,'request\x20sent');logger[_0x21b0('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x12bf95,_0x21b0('0x20'),JSON[_0x21b0('0x21')](_0x40eb62));if(_0x40eb62[_0x21b0('0x22')]){if(_0x40eb62[_0x21b0('0x22')][_0x21b0('0x23')]===0x1f4){logger['error'](_0x21b0('0x1e'),_0x12bf95,_0x40eb62[_0x21b0('0x22')]['message']);return _0x4bb092(_0x40eb62[_0x21b0('0x22')]['message']);}logger[_0x21b0('0x22')](_0x21b0('0x1e'),_0x12bf95,_0x40eb62['error'][_0x21b0('0x24')]);return _0x1bf1e6(_0x40eb62[_0x21b0('0x22')][_0x21b0('0x24')]);}else{logger[_0x21b0('0x1d')](_0x21b0('0x1e'),_0x12bf95,_0x21b0('0x20'));_0x1bf1e6(_0x40eb62[_0x21b0('0x25')][_0x21b0('0x24')]);}})[_0x21b0('0x26')](function(_0xf7507b){logger[_0x21b0('0x22')](_0x21b0('0x1e'),_0x12bf95,_0xf7507b);_0x4bb092(_0xf7507b);});});}function respondWithStatusCode(_0x4366ff,_0x1bab81){_0x1bab81=_0x1bab81||0xcc;return function(_0x2d7e98){if(_0x2d7e98){return _0x4366ff[_0x21b0('0x27')](_0x1bab81);}return _0x4366ff[_0x21b0('0x28')](_0x1bab81)['end']();};}function respondWithResult(_0x536ba9,_0x150918){_0x150918=_0x150918||0xc8;return function(_0x572212){if(_0x572212){return _0x536ba9[_0x21b0('0x28')](_0x150918)['json'](_0x572212);}};}function respondWithFilteredResult(_0x53c057,_0x1e36b3){return function(_0x2a2764){if(_0x2a2764){var _0x5ad173=_0x2a2764[_0x21b0('0x29')],_0x4b9957=_0x1e36b3[_0x21b0('0x2a')],_0x3aa282=_0x1e36b3['offset']+_0x1e36b3['limit'],_0x4894ab;if(_0x3aa282>=_0x5ad173){_0x3aa282=_0x5ad173;_0x4894ab=0xc8;}else{_0x4894ab=0xce;}_0x53c057[_0x21b0('0x28')](_0x4894ab);return _0x53c057['set'](_0x21b0('0x2b'),_0x4b9957+'-'+_0x3aa282+'/'+_0x5ad173)[_0x21b0('0x2c')](_0x2a2764);}return null;};}function patchUpdates(_0x1877ec){return function(_0x2b0114){try{jsonpatch[_0x21b0('0x2d')](_0x2b0114,_0x1877ec,!![]);}catch(_0x4ef4cc){return BPromise[_0x21b0('0x2e')](_0x4ef4cc);}return _0x2b0114[_0x21b0('0x2f')]();};}function saveUpdates(_0x1d3ec7,_0x590497){return function(_0x17ad38){if(_0x17ad38){return _0x17ad38[_0x21b0('0x30')](_0x1d3ec7)[_0x21b0('0x1c')](function(_0xca836a){return _0xca836a;});}return null;};}function removeEntity(_0x3bfc86,_0x1f793b){return function(_0x25397a){if(_0x25397a){return _0x25397a[_0x21b0('0x31')]()[_0x21b0('0x1c')](function(){_0x3bfc86[_0x21b0('0x28')](0xcc)[_0x21b0('0x32')]();});}};}function handleEntityNotFound(_0x126062,_0x287ca0){return function(_0x59832c){if(!_0x59832c){_0x126062[_0x21b0('0x27')](0x194);}return _0x59832c;};}function handleError(_0x10ef96,_0x5079cf){_0x5079cf=_0x5079cf||0x1f4;return function(_0x238f9e){logger[_0x21b0('0x22')](_0x238f9e[_0x21b0('0x33')]);if(_0x238f9e[_0x21b0('0x34')]){delete _0x238f9e[_0x21b0('0x34')];}_0x10ef96[_0x21b0('0x28')](_0x5079cf)[_0x21b0('0x35')](_0x238f9e);};}exports['index']=function(_0x12c7b4,_0xea9598){var _0x19d3a7={},_0xaccb2e={},_0x31aef5={'count':0x0,'rows':[]};var _0x280553=_[_0x21b0('0x36')](db[_0x21b0('0x37')][_0x21b0('0x38')],function(_0x320850){return{'name':_0x320850[_0x21b0('0x39')],'type':_0x320850[_0x21b0('0x3a')][_0x21b0('0x3b')]};});_0xaccb2e['model']=_[_0x21b0('0x36')](_0x280553,_0x21b0('0x34'));_0xaccb2e['query']=_['keys'](_0x12c7b4[_0x21b0('0x3c')]);_0xaccb2e['filters']=_[_0x21b0('0x3d')](_0xaccb2e[_0x21b0('0x3e')],_0xaccb2e['query']);_0x19d3a7['attributes']=_['intersection'](_0xaccb2e[_0x21b0('0x3e')],qs[_0x21b0('0x3f')](_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x3f')]));_0x19d3a7[_0x21b0('0x40')]=_0x19d3a7[_0x21b0('0x40')][_0x21b0('0x41')]?_0x19d3a7[_0x21b0('0x40')]:_0xaccb2e[_0x21b0('0x3e')];if(!_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x42')](_0x21b0('0x43'))){_0x19d3a7['limit']=qs[_0x21b0('0x44')](_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x44')]);_0x19d3a7[_0x21b0('0x2a')]=qs[_0x21b0('0x2a')](_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x2a')]);}_0x19d3a7['order']=qs[_0x21b0('0x45')](_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x45')]);_0x19d3a7['where']=qs[_0x21b0('0x46')](_[_0x21b0('0x47')](_0x12c7b4[_0x21b0('0x3c')],_0xaccb2e[_0x21b0('0x46')]),_0x280553);if(_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x48')]){_0x19d3a7[_0x21b0('0x49')]=_[_0x21b0('0x4a')](_0x19d3a7[_0x21b0('0x49')],{'$or':_['map'](_0x280553,function(_0x54bbbb){if(_0x54bbbb[_0x21b0('0x3a')]!==_0x21b0('0x4b')){var _0x49bf42={};_0x49bf42[_0x54bbbb[_0x21b0('0x34')]]={'$like':'%'+_0x12c7b4[_0x21b0('0x3c')][_0x21b0('0x48')]+'%'};return _0x49bf42;}})});}_0x19d3a7=_[_0x21b0('0x4a')]({},_0x19d3a7,_0x12c7b4[_0x21b0('0x4c')]);var _0x1ae09f={'where':_0x19d3a7[_0x21b0('0x49')]};return db[_0x21b0('0x37')][_0x21b0('0x29')](_0x1ae09f)['then'](function(_0x313327){_0x31aef5['count']=_0x313327;if(_0x12c7b4['query'][_0x21b0('0x4d')]){_0x19d3a7['include']=[{'all':!![]}];}return db['Network']['findAll'](_0x19d3a7);})[_0x21b0('0x1c')](function(_0xb6ba8d){_0x31aef5[_0x21b0('0x4e')]=_0xb6ba8d;return _0x31aef5;})[_0x21b0('0x1c')](respondWithFilteredResult(_0xea9598,_0x19d3a7))['catch'](handleError(_0xea9598,null));};exports['show']=function(_0x1544bf,_0x5454cb){var _0x55a260={'raw':!![],'where':{'id':_0x1544bf[_0x21b0('0x4f')]['id']}},_0x127bb2={};_0x127bb2[_0x21b0('0x3e')]=_[_0x21b0('0x50')](db[_0x21b0('0x37')][_0x21b0('0x38')]);_0x127bb2[_0x21b0('0x3c')]=_[_0x21b0('0x50')](_0x1544bf[_0x21b0('0x3c')]);_0x127bb2[_0x21b0('0x46')]=_['intersection'](_0x127bb2[_0x21b0('0x3e')],_0x127bb2[_0x21b0('0x3c')]);_0x55a260['attributes']=_['intersection'](_0x127bb2['model'],qs[_0x21b0('0x3f')](_0x1544bf[_0x21b0('0x3c')][_0x21b0('0x3f')]));_0x55a260[_0x21b0('0x40')]=_0x55a260[_0x21b0('0x40')][_0x21b0('0x41')]?_0x55a260[_0x21b0('0x40')]:_0x127bb2[_0x21b0('0x3e')];if(_0x1544bf[_0x21b0('0x3c')][_0x21b0('0x4d')]){_0x55a260['include']=[{'all':!![]}];}_0x55a260=_[_0x21b0('0x4a')]({},_0x55a260,_0x1544bf[_0x21b0('0x4c')]);return db[_0x21b0('0x37')][_0x21b0('0x51')](_0x55a260)[_0x21b0('0x1c')](handleEntityNotFound(_0x5454cb,null))[_0x21b0('0x1c')](respondWithResult(_0x5454cb,null))[_0x21b0('0x26')](handleError(_0x5454cb,null));};exports[_0x21b0('0x52')]=function(_0x75a0a3,_0x4fa175,_0x4128c0){var _0x1d1906;return db['sequelize'][_0x21b0('0x53')](function(_0x2b94b4){return db['Network'][_0x21b0('0x52')](_0x75a0a3[_0x21b0('0x54')],{'raw':!![]})[_0x21b0('0x1c')](function(_0x4d112a){_0x1d1906=_0x4d112a;return db['Network'][_0x21b0('0x55')]({'where':{'type':_0x75a0a3[_0x21b0('0x54')][_0x21b0('0x3a')]},'raw':!![]});})[_0x21b0('0x1c')](function(_0x3c9eb2){if(_0x1d1906[_0x21b0('0x3a')][_0x21b0('0x56')]()=='STUN'){var _0x564571=fs[_0x21b0('0x57')](path[_0x21b0('0x58')](config[_0x21b0('0x59')],_0x21b0('0x5a')),_0x21b0('0x5b'));var _0x45738e=ejs['render'](_0x564571,{'networks':_0x3c9eb2||[]});fs[_0x21b0('0x5c')](_0x21b0('0x5d'),_0x45738e);return respondWithRpcPromise(_0x21b0('0x5e'),'create',{'module':'res_stun_monitor.so'});}else if(_0x1d1906['type'][_0x21b0('0x56')]()=='TURN'){var _0x528bbc=fs[_0x21b0('0x57')](path[_0x21b0('0x58')](config[_0x21b0('0x59')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x304a47=ejs['render'](_0x528bbc,{'networks':_0x3c9eb2||[]});fs[_0x21b0('0x5c')](_0x21b0('0x5f'),_0x304a47);return respondWithRpcPromise(_0x21b0('0x5e'),_0x21b0('0x52'),{'module':_0x21b0('0x60')});}else{var _0x35913a=fs[_0x21b0('0x57')](path['join'](config['root'],_0x21b0('0x61')),_0x21b0('0x5b'));var _0x3b49d4=ejs[_0x21b0('0x62')](_0x35913a,{'networks':_0x3c9eb2||[]});fs[_0x21b0('0x5c')](util[_0x21b0('0x63')](_0x21b0('0x64'),_0x75a0a3[_0x21b0('0x54')][_0x21b0('0x3a')][_0x21b0('0x65')]()),_0x3b49d4);return respondWithRpcPromise(_0x21b0('0x5e'),'create',{'module':'chan_sip.so'});}return null;})[_0x21b0('0x1c')](function(){return _0x1d1906;});})[_0x21b0('0x1c')](respondWithResult(_0x4fa175,0xc9))[_0x21b0('0x26')](handleError(_0x4fa175,null));};exports['update']=function(_0x5c4a2a,_0x1f6ec7,_0x19fbbf){var _0x49e746;return db[_0x21b0('0x66')][_0x21b0('0x53')](function(_0x35b773){return db[_0x21b0('0x37')][_0x21b0('0x51')]({'where':{'id':_0x5c4a2a['params']['id']}})[_0x21b0('0x1c')](handleEntityNotFound(_0x1f6ec7,null))['then'](saveUpdates(_0x5c4a2a['body'],null))[_0x21b0('0x1c')](function(_0x5ea44c){if(_0x5ea44c){_0x49e746=_0x5ea44c;return db[_0x21b0('0x37')][_0x21b0('0x55')]({'where':{'type':_0x49e746[_0x21b0('0x3a')]},'raw':!![]});}return null;})[_0x21b0('0x1c')](function(_0x3c9b09){if(_0x49e746[_0x21b0('0x3a')][_0x21b0('0x56')]()=='STUN'){var _0x495b24=fs[_0x21b0('0x57')](path[_0x21b0('0x58')](config['root'],_0x21b0('0x5a')),_0x21b0('0x5b'));var _0x1996dc=ejs[_0x21b0('0x62')](_0x495b24,{'networks':_0x3c9b09||[]});fs[_0x21b0('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x1996dc);return respondWithRpcPromise(_0x21b0('0x5e'),_0x21b0('0x30'),{'module':_0x21b0('0x60')});}else if(_0x49e746[_0x21b0('0x3a')][_0x21b0('0x56')]()==_0x21b0('0x67')){var _0xf3d4ba=fs[_0x21b0('0x57')](path[_0x21b0('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x21b0('0x5b'));var _0x17a486=ejs[_0x21b0('0x62')](_0xf3d4ba,{'networks':_0x3c9b09||[]});fs['writeFileSync'](_0x21b0('0x5f'),_0x17a486);return respondWithRpcPromise(_0x21b0('0x5e'),'update',{'module':_0x21b0('0x60')});}else{var _0x459eae=fs[_0x21b0('0x57')](path[_0x21b0('0x58')](config[_0x21b0('0x59')],'server/files/templates/network.ejs'),'utf8');var _0x4b25d5=ejs[_0x21b0('0x62')](_0x459eae,{'networks':_0x3c9b09||[]});fs[_0x21b0('0x5c')](util[_0x21b0('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x5c4a2a[_0x21b0('0x54')][_0x21b0('0x3a')][_0x21b0('0x65')]()),_0x4b25d5);return respondWithRpcPromise('Reload',_0x21b0('0x30'),{'module':_0x21b0('0x68')});}return null;})[_0x21b0('0x1c')](function(_0x1ad83c){if(_0x1ad83c){return _0x49e746;}return null;});})['then'](respondWithResult(_0x1f6ec7,null))['catch'](handleError(_0x1f6ec7,null));};exports[_0x21b0('0x31')]=function(_0x1c9fd9,_0xffb907,_0x27e2c1){var _0x349b7a;return db[_0x21b0('0x37')][_0x21b0('0x51')]({'where':{'id':_0x1c9fd9[_0x21b0('0x4f')]['id']}})[_0x21b0('0x1c')](function(_0xf81218){_0x349b7a=_0xf81218;return _0xf81218;})['then'](handleEntityNotFound(_0xffb907,null))['then'](removeEntity(_0xffb907,null))[_0x21b0('0x1c')](function(){if(_0x349b7a){return db['Network'][_0x21b0('0x55')]({'where':{'type':_0x349b7a[_0x21b0('0x3a')]},'raw':!![]});}})[_0x21b0('0x1c')](function(_0x4dbb8a){if(_0x349b7a[_0x21b0('0x3a')]['toUpperCase']()==_0x21b0('0x69')){var _0x5ddc1a=fs['readFileSync'](path[_0x21b0('0x58')](config[_0x21b0('0x59')],_0x21b0('0x5a')),_0x21b0('0x5b'));var _0x137612=ejs[_0x21b0('0x62')](_0x5ddc1a,{'networks':_0x4dbb8a||[]});fs[_0x21b0('0x5c')](_0x21b0('0x5d'),_0x137612);return respondWithRpcPromise(_0x21b0('0x5e'),_0x21b0('0x31'),{'module':_0x21b0('0x60')});}else if(_0x349b7a[_0x21b0('0x3a')]['toUpperCase']()==_0x21b0('0x67')){var _0x57f3bb=fs[_0x21b0('0x57')](path['join'](config[_0x21b0('0x59')],'server/files/templates/turn_multiple.ejs'),_0x21b0('0x5b'));var _0x3a674e=ejs['render'](_0x57f3bb,{'networks':_0x4dbb8a||[]});fs[_0x21b0('0x5c')](_0x21b0('0x5f'),_0x3a674e);return respondWithRpcPromise('Reload',_0x21b0('0x31'),{'module':_0x21b0('0x60')});}else{var _0x263ea1=fs[_0x21b0('0x57')](path[_0x21b0('0x58')](config['root'],_0x21b0('0x61')),_0x21b0('0x5b'));var _0x5c50bb=ejs['render'](_0x263ea1,{'networks':_0x4dbb8a||[]});fs['writeFileSync'](util[_0x21b0('0x63')](_0x21b0('0x64'),_0x1c9fd9['body'][_0x21b0('0x3a')][_0x21b0('0x65')]()),_0x5c50bb);return respondWithRpcPromise(_0x21b0('0x5e'),_0x21b0('0x31'),{'module':_0x21b0('0x68')});}return null;})[_0x21b0('0x26')](handleError(_0xffb907,null));}; \ No newline at end of file +var _0x32c3=['transaction','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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~!@#$%^&-_=+[{]}.','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','include','find','sequelize'];(function(_0x60e554,_0x3ec425){var _0x279ca0=function(_0x479a86){while(--_0x479a86){_0x60e554['push'](_0x60e554['shift']());}};_0x279ca0(++_0x3ec425);}(_0x32c3,0xfb));var _0x332c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32c3[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x332c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x332c('0x1'));var jsonpatch=require(_0x332c('0x2'));var rp=require(_0x332c('0x3'));var moment=require(_0x332c('0x4'));var BPromise=require(_0x332c('0x5'));var Mustache=require(_0x332c('0x6'));var util=require('util');var path=require(_0x332c('0x7'));var sox=require(_0x332c('0x8'));var csv=require('to-csv');var ejs=require(_0x332c('0x9'));var fs=require('fs');var _=require(_0x332c('0xa'));var squel=require(_0x332c('0xb'));var crypto=require(_0x332c('0xc'));var jsforce=require(_0x332c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x332c('0xe'));var querystring=require(_0x332c('0xf'));var Papa=require('papaparse');var Redis=require(_0x332c('0x10'));var authService=require(_0x332c('0x11'));var qs=require(_0x332c('0x12'));var as=require(_0x332c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x332c('0x14'))(_0x332c('0x15'));var utils=require(_0x332c('0x16'));var config=require(_0x332c('0x17'));var db=require(_0x332c('0x18'))['db'];var jayson=require(_0x332c('0x19'));var client=jayson[_0x332c('0x1a')][_0x332c('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x191f99,_0x1fbbc1,_0x3d6243){if(_0x3d6243){var _0x12df0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12df0e[_0x332c('0x1c')](_0x1fbbc1)){return _0x191f99;}else{throw new db[(_0x332c('0x1d'))][(_0x332c('0x1e'))](_0x332c('0x1f'));}}else{return _0x191f99;}}function respondWithRpcPromise(_0x498838,_0xe76af3,_0x45ac94,_0x2950ba){return new BPromise(function(_0x597c03,_0x2309cf){var _0x1fc90b=_0x2950ba||client;return _0x1fc90b['request'](_0x498838,_0x45ac94)[_0x332c('0x20')](function(_0x511891){logger[_0x332c('0x21')](_0x332c('0x22'),_0xe76af3,'request\x20sent');logger[_0x332c('0x23')](_0x332c('0x24'),_0xe76af3,_0x332c('0x25'),JSON['stringify'](_0x511891));if(_0x511891[_0x332c('0x26')]){if(_0x511891[_0x332c('0x26')][_0x332c('0x27')]===0x1f4){logger['error'](_0x332c('0x22'),_0xe76af3,_0x511891[_0x332c('0x26')][_0x332c('0x28')]);return _0x2309cf(_0x511891['error'][_0x332c('0x28')]);}logger[_0x332c('0x26')](_0x332c('0x22'),_0xe76af3,_0x511891[_0x332c('0x26')][_0x332c('0x28')]);return _0x597c03(_0x511891[_0x332c('0x26')][_0x332c('0x28')]);}else{logger[_0x332c('0x21')]('Network,\x20%s,\x20%s',_0xe76af3,'request\x20sent');_0x597c03(_0x511891['result'][_0x332c('0x28')]);}})[_0x332c('0x29')](function(_0x181550){logger[_0x332c('0x26')](_0x332c('0x22'),_0xe76af3,_0x181550);_0x2309cf(_0x181550);});});}function respondWithStatusCode(_0xef8d8c,_0x2fafa4){_0x2fafa4=_0x2fafa4||0xcc;return function(_0x39b329){if(_0x39b329){return _0xef8d8c[_0x332c('0x2a')](_0x2fafa4);}return _0xef8d8c[_0x332c('0x2b')](_0x2fafa4)[_0x332c('0x2c')]();};}function respondWithResult(_0x2f4496,_0xab051b){_0xab051b=_0xab051b||0xc8;return function(_0x1703cf){if(_0x1703cf){return _0x2f4496[_0x332c('0x2b')](_0xab051b)[_0x332c('0x2d')](_0x1703cf);}};}function respondWithFilteredResult(_0x1d28ad,_0x23d4c0){return function(_0xed58c0){if(_0xed58c0){var _0x4268a8=_0xed58c0[_0x332c('0x2e')],_0x23c0b2=_0x23d4c0[_0x332c('0x2f')],_0x4b7ba7=_0x23d4c0[_0x332c('0x2f')]+_0x23d4c0[_0x332c('0x30')],_0x444161;if(_0x4b7ba7>=_0x4268a8){_0x4b7ba7=_0x4268a8;_0x444161=0xc8;}else{_0x444161=0xce;}_0x1d28ad[_0x332c('0x2b')](_0x444161);return _0x1d28ad[_0x332c('0x31')](_0x332c('0x32'),_0x23c0b2+'-'+_0x4b7ba7+'/'+_0x4268a8)['json'](_0xed58c0);}return null;};}function patchUpdates(_0x5a164b){return function(_0x5ea16d){try{jsonpatch[_0x332c('0x33')](_0x5ea16d,_0x5a164b,!![]);}catch(_0x39482c){return BPromise[_0x332c('0x34')](_0x39482c);}return _0x5ea16d[_0x332c('0x35')]();};}function saveUpdates(_0x247c22,_0x82d12c){return function(_0x148df2){if(_0x148df2){return _0x148df2[_0x332c('0x36')](_0x247c22)[_0x332c('0x20')](function(_0x177fb1){return _0x177fb1;});}return null;};}function removeEntity(_0x54694a,_0x232343){return function(_0x36c2d0){if(_0x36c2d0){return _0x36c2d0['destroy']()[_0x332c('0x20')](function(){_0x54694a[_0x332c('0x2b')](0xcc)[_0x332c('0x2c')]();});}};}function handleEntityNotFound(_0x2aa5c2,_0xcebf9c){return function(_0x3095ce){if(!_0x3095ce){_0x2aa5c2[_0x332c('0x2a')](0x194);}return _0x3095ce;};}function handleError(_0x2bd6d6,_0x2017e0){_0x2017e0=_0x2017e0||0x1f4;return function(_0xf489b8){logger[_0x332c('0x26')](_0xf489b8[_0x332c('0x37')]);if(_0xf489b8[_0x332c('0x38')]){delete _0xf489b8[_0x332c('0x38')];}_0x2bd6d6[_0x332c('0x2b')](_0x2017e0)['send'](_0xf489b8);};}exports[_0x332c('0x39')]=function(_0x1a8c90,_0x412d6b){var _0x45ab73={},_0x2def33={},_0x419525={'count':0x0,'rows':[]};var _0x111d46=_[_0x332c('0x3a')](db[_0x332c('0x3b')][_0x332c('0x3c')],function(_0x301fb9){return{'name':_0x301fb9[_0x332c('0x3d')],'type':_0x301fb9[_0x332c('0x3e')][_0x332c('0x3f')]};});_0x2def33[_0x332c('0x40')]=_[_0x332c('0x3a')](_0x111d46,'name');_0x2def33[_0x332c('0x41')]=_['keys'](_0x1a8c90[_0x332c('0x41')]);_0x2def33[_0x332c('0x42')]=_[_0x332c('0x43')](_0x2def33['model'],_0x2def33[_0x332c('0x41')]);_0x45ab73[_0x332c('0x44')]=_[_0x332c('0x43')](_0x2def33['model'],qs['fields'](_0x1a8c90[_0x332c('0x41')][_0x332c('0x45')]));_0x45ab73[_0x332c('0x44')]=_0x45ab73['attributes'][_0x332c('0x46')]?_0x45ab73['attributes']:_0x2def33['model'];if(!_0x1a8c90[_0x332c('0x41')][_0x332c('0x47')](_0x332c('0x48'))){_0x45ab73['limit']=qs[_0x332c('0x30')](_0x1a8c90[_0x332c('0x41')][_0x332c('0x30')]);_0x45ab73[_0x332c('0x2f')]=qs[_0x332c('0x2f')](_0x1a8c90[_0x332c('0x41')][_0x332c('0x2f')]);}_0x45ab73[_0x332c('0x49')]=qs[_0x332c('0x4a')](_0x1a8c90[_0x332c('0x41')][_0x332c('0x4a')]);_0x45ab73[_0x332c('0x4b')]=qs[_0x332c('0x42')](_['pick'](_0x1a8c90[_0x332c('0x41')],_0x2def33[_0x332c('0x42')]),_0x111d46);if(_0x1a8c90[_0x332c('0x41')]['filter']){_0x45ab73['where']=_[_0x332c('0x4c')](_0x45ab73[_0x332c('0x4b')],{'$or':_['map'](_0x111d46,function(_0x691e81){if(_0x691e81[_0x332c('0x3e')]!==_0x332c('0x4d')){var _0x444da5={};_0x444da5[_0x691e81[_0x332c('0x38')]]={'$like':'%'+_0x1a8c90[_0x332c('0x41')][_0x332c('0x4e')]+'%'};return _0x444da5;}})});}_0x45ab73=_['merge']({},_0x45ab73,_0x1a8c90[_0x332c('0x4f')]);var _0x192f5e={'where':_0x45ab73[_0x332c('0x4b')]};return db[_0x332c('0x3b')][_0x332c('0x2e')](_0x192f5e)[_0x332c('0x20')](function(_0x5f42ee){_0x419525[_0x332c('0x2e')]=_0x5f42ee;if(_0x1a8c90['query'][_0x332c('0x50')]){_0x45ab73['include']=[{'all':!![]}];}return db[_0x332c('0x3b')][_0x332c('0x51')](_0x45ab73);})[_0x332c('0x20')](function(_0xda0b04){_0x419525[_0x332c('0x52')]=_0xda0b04;return _0x419525;})['then'](respondWithFilteredResult(_0x412d6b,_0x45ab73))['catch'](handleError(_0x412d6b,null));};exports[_0x332c('0x53')]=function(_0x1dc602,_0x2f80dc){var _0x431e47={'raw':!![],'where':{'id':_0x1dc602['params']['id']}},_0x37090d={};_0x37090d[_0x332c('0x40')]=_[_0x332c('0x54')](db['Network'][_0x332c('0x3c')]);_0x37090d[_0x332c('0x41')]=_[_0x332c('0x54')](_0x1dc602['query']);_0x37090d[_0x332c('0x42')]=_[_0x332c('0x43')](_0x37090d[_0x332c('0x40')],_0x37090d['query']);_0x431e47[_0x332c('0x44')]=_[_0x332c('0x43')](_0x37090d[_0x332c('0x40')],qs[_0x332c('0x45')](_0x1dc602[_0x332c('0x41')][_0x332c('0x45')]));_0x431e47['attributes']=_0x431e47[_0x332c('0x44')][_0x332c('0x46')]?_0x431e47[_0x332c('0x44')]:_0x37090d[_0x332c('0x40')];if(_0x1dc602[_0x332c('0x41')][_0x332c('0x50')]){_0x431e47[_0x332c('0x55')]=[{'all':!![]}];}_0x431e47=_[_0x332c('0x4c')]({},_0x431e47,_0x1dc602['options']);return db[_0x332c('0x3b')][_0x332c('0x56')](_0x431e47)['then'](handleEntityNotFound(_0x2f80dc,null))[_0x332c('0x20')](respondWithResult(_0x2f80dc,null))['catch'](handleError(_0x2f80dc,null));};exports['create']=function(_0x4ce6d7,_0x5ad14e,_0x151a00){var _0x5acdd7;return db[_0x332c('0x57')][_0x332c('0x58')](function(_0x5bf740){return db[_0x332c('0x3b')][_0x332c('0x59')](_0x4ce6d7[_0x332c('0x5a')],{'raw':!![]})[_0x332c('0x20')](function(_0x4a6b67){_0x5acdd7=_0x4a6b67;return db[_0x332c('0x3b')][_0x332c('0x51')]({'where':{'type':_0x4ce6d7[_0x332c('0x5a')]['type']},'raw':!![]});})[_0x332c('0x20')](function(_0xbb2c66){if(_0x5acdd7[_0x332c('0x3e')][_0x332c('0x5b')]()==_0x332c('0x5c')){var _0x36666c=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config[_0x332c('0x5f')],_0x332c('0x60')),_0x332c('0x61'));var _0x463508=ejs[_0x332c('0x62')](_0x36666c,{'networks':_0xbb2c66||[]});fs['writeFileSync'](_0x332c('0x63'),_0x463508);return respondWithRpcPromise(_0x332c('0x64'),_0x332c('0x59'),{'module':_0x332c('0x65')});}else if(_0x5acdd7[_0x332c('0x3e')][_0x332c('0x5b')]()==_0x332c('0x66')){var _0xa9c560=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config[_0x332c('0x5f')],_0x332c('0x67')),'utf8');var _0x5acb4a=ejs['render'](_0xa9c560,{'networks':_0xbb2c66||[]});fs[_0x332c('0x68')](_0x332c('0x69'),_0x5acb4a);return respondWithRpcPromise(_0x332c('0x64'),'create',{'module':_0x332c('0x65')});}else{var _0x38c363=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config['root'],_0x332c('0x6a')),_0x332c('0x61'));var _0x3ff5c4=ejs[_0x332c('0x62')](_0x38c363,{'networks':_0xbb2c66||[]});fs[_0x332c('0x68')](util[_0x332c('0x6b')](_0x332c('0x6c'),_0x4ce6d7[_0x332c('0x5a')][_0x332c('0x3e')][_0x332c('0x6d')]()),_0x3ff5c4);return respondWithRpcPromise(_0x332c('0x64'),_0x332c('0x59'),{'module':_0x332c('0x6e')});}return null;})[_0x332c('0x20')](function(){return _0x5acdd7;});})['then'](respondWithResult(_0x5ad14e,0xc9))[_0x332c('0x29')](handleError(_0x5ad14e,null));};exports[_0x332c('0x36')]=function(_0x43007c,_0x5adcb4,_0x1037e5){var _0xe4073;return db[_0x332c('0x57')][_0x332c('0x58')](function(_0x263127){return db['Network'][_0x332c('0x56')]({'where':{'id':_0x43007c[_0x332c('0x6f')]['id']}})[_0x332c('0x20')](handleEntityNotFound(_0x5adcb4,null))['then'](saveUpdates(_0x43007c['body'],null))[_0x332c('0x20')](function(_0x1c217d){if(_0x1c217d){_0xe4073=_0x1c217d;return db[_0x332c('0x3b')][_0x332c('0x51')]({'where':{'type':_0xe4073[_0x332c('0x3e')]},'raw':!![]});}return null;})['then'](function(_0x2729ef){if(_0xe4073[_0x332c('0x3e')]['toUpperCase']()==_0x332c('0x5c')){var _0x1aee70=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config[_0x332c('0x5f')],_0x332c('0x60')),_0x332c('0x61'));var _0x3b3ecf=ejs[_0x332c('0x62')](_0x1aee70,{'networks':_0x2729ef||[]});fs[_0x332c('0x68')](_0x332c('0x63'),_0x3b3ecf);return respondWithRpcPromise(_0x332c('0x64'),_0x332c('0x36'),{'module':_0x332c('0x65')});}else if(_0xe4073[_0x332c('0x3e')][_0x332c('0x5b')]()==_0x332c('0x66')){var _0x4491aa=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config[_0x332c('0x5f')],'server/files/templates/turn_multiple.ejs'),_0x332c('0x61'));var _0x15994e=ejs[_0x332c('0x62')](_0x4491aa,{'networks':_0x2729ef||[]});fs['writeFileSync'](_0x332c('0x69'),_0x15994e);return respondWithRpcPromise(_0x332c('0x64'),'update',{'module':'res_stun_monitor.so'});}else{var _0x556a9e=fs['readFileSync'](path[_0x332c('0x5e')](config[_0x332c('0x5f')],_0x332c('0x6a')),_0x332c('0x61'));var _0x588279=ejs[_0x332c('0x62')](_0x556a9e,{'networks':_0x2729ef||[]});fs[_0x332c('0x68')](util[_0x332c('0x6b')]('/etc/asterisk/sip_xcally_%s.conf',_0x43007c['body'][_0x332c('0x3e')]['toLowerCase']()),_0x588279);return respondWithRpcPromise(_0x332c('0x64'),'update',{'module':'chan_sip.so'});}return null;})['then'](function(_0x3a51ca){if(_0x3a51ca){return _0xe4073;}return null;});})[_0x332c('0x20')](respondWithResult(_0x5adcb4,null))[_0x332c('0x29')](handleError(_0x5adcb4,null));};exports['destroy']=function(_0x23975c,_0x386cd4,_0x156c1f){var _0x9f75a;return db[_0x332c('0x3b')][_0x332c('0x56')]({'where':{'id':_0x23975c[_0x332c('0x6f')]['id']}})[_0x332c('0x20')](function(_0x531f19){_0x9f75a=_0x531f19;return _0x531f19;})[_0x332c('0x20')](handleEntityNotFound(_0x386cd4,null))['then'](removeEntity(_0x386cd4,null))[_0x332c('0x20')](function(){if(_0x9f75a){return db[_0x332c('0x3b')]['findAll']({'where':{'type':_0x9f75a[_0x332c('0x3e')]},'raw':!![]});}})[_0x332c('0x20')](function(_0x5ce7c8){if(_0x9f75a['type']['toUpperCase']()=='STUN'){var _0x143292=fs['readFileSync'](path[_0x332c('0x5e')](config['root'],_0x332c('0x60')),_0x332c('0x61'));var _0x478550=ejs[_0x332c('0x62')](_0x143292,{'networks':_0x5ce7c8||[]});fs[_0x332c('0x68')](_0x332c('0x63'),_0x478550);return respondWithRpcPromise(_0x332c('0x64'),_0x332c('0x70'),{'module':_0x332c('0x65')});}else if(_0x9f75a['type'][_0x332c('0x5b')]()=='TURN'){var _0x425ca9=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config[_0x332c('0x5f')],'server/files/templates/turn_multiple.ejs'),_0x332c('0x61'));var _0x4cd65a=ejs[_0x332c('0x62')](_0x425ca9,{'networks':_0x5ce7c8||[]});fs[_0x332c('0x68')]('/etc/asterisk/turn_xcally.conf',_0x4cd65a);return respondWithRpcPromise('Reload','destroy',{'module':_0x332c('0x65')});}else{var _0x35f76b=fs[_0x332c('0x5d')](path[_0x332c('0x5e')](config['root'],_0x332c('0x6a')),_0x332c('0x61'));var _0x53841c=ejs[_0x332c('0x62')](_0x35f76b,{'networks':_0x5ce7c8||[]});fs['writeFileSync'](util[_0x332c('0x6b')](_0x332c('0x6c'),_0x23975c[_0x332c('0x5a')][_0x332c('0x3e')]['toLowerCase']()),_0x53841c);return respondWithRpcPromise('Reload',_0x332c('0x70'),{'module':'chan_sip.so'});}return null;})[_0x332c('0x29')](handleError(_0x386cd4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 75f0165..20c2671 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 _0xfd28=['rimraf','./network.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x138a39,_0x3ea62b){var _0x2e904a=function(_0x2d6e34){while(--_0x2d6e34){_0x138a39['push'](_0x138a39['shift']());}};_0x2e904a(++_0x3ea62b);}(_0xfd28,0x148));var _0x8fd2=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xfd28[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x593e=['path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x422892,_0xe08b65){var _0x3e6b67=function(_0x117f29){while(--_0x117f29){_0x422892['push'](_0x422892['shift']());}};_0x3e6b67(++_0xe08b65);}(_0x593e,0xcb));var _0xe593=function(_0x5e98b8,_0xe7613b){_0x5e98b8=_0x5e98b8-0x0;var _0x26ec4d=_0x593e[_0x5e98b8];return _0x26ec4d;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var logger=require(_0xe593('0x2'))(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var rp=require(_0xe593('0x6'));var fs=require('fs');var path=require(_0xe593('0x7'));var rimraf=require('rimraf');var config=require(_0xe593('0x8'));var attributes=require(_0xe593('0x9'));module[_0xe593('0xa')]=function(_0x1e50d3,_0x3b7082){return _0x1e50d3[_0xe593('0xb')](_0xe593('0xc'),attributes,{'tableName':_0xe593('0xd'),'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 718f420..054be68 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 _0x69d8=['then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x6418ed,_0x83d340){var _0x44c6cb=function(_0x54113b){while(--_0x54113b){_0x6418ed['push'](_0x6418ed['shift']());}};_0x44c6cb(++_0x83d340);}(_0x69d8,0x11d));var _0x869d=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x69d8[_0x31880d];return _0x423823;};'use strict';var _=require(_0x869d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x869d('0x1'));var rs=require(_0x869d('0x2'));var fs=require('fs');var Redis=require(_0x869d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x869d('0x4'));var logger=require(_0x869d('0x5'))('rpc');var config=require(_0x869d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x869d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x585928,_0x52e671,_0x204035){return new BPromise(function(_0x22791a,_0x173f8b){return client[_0x869d('0x8')](_0x585928,_0x204035)[_0x869d('0x9')](function(_0x3836c4){logger['info']('Network,\x20%s,\x20%s',_0x52e671,_0x869d('0xa'));logger[_0x869d('0xb')](_0x869d('0xc'),_0x52e671,_0x869d('0xa'),JSON[_0x869d('0xd')](_0x3836c4));if(_0x3836c4[_0x869d('0xe')]){if(_0x3836c4[_0x869d('0xe')][_0x869d('0xf')]===0x1f4){logger[_0x869d('0xe')](_0x869d('0x10'),_0x52e671,_0x3836c4[_0x869d('0xe')][_0x869d('0x11')]);return _0x173f8b(_0x3836c4[_0x869d('0xe')][_0x869d('0x11')]);}logger['error']('Network,\x20%s,\x20%s',_0x52e671,_0x3836c4[_0x869d('0xe')]['message']);return _0x22791a(_0x3836c4[_0x869d('0xe')][_0x869d('0x11')]);}else{logger[_0x869d('0x12')](_0x869d('0x10'),_0x52e671,_0x869d('0xa'));_0x22791a(_0x3836c4[_0x869d('0x13')]['message']);}})[_0x869d('0x14')](function(_0x2590e5){logger[_0x869d('0xe')](_0x869d('0x10'),_0x52e671,_0x2590e5);_0x173f8b(_0x2590e5);});});} \ No newline at end of file +var _0x99fb=['request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','Network,\x20%s,\x20%s'];(function(_0x4e3f26,_0xd30c27){var _0x19daba=function(_0x26e282){while(--_0x26e282){_0x4e3f26['push'](_0x4e3f26['shift']());}};_0x19daba(++_0xd30c27);}(_0x99fb,0x194));var _0xb99f=function(_0x49490f,_0x5cd51c){_0x49490f=_0x49490f-0x0;var _0x30fced=_0x99fb[_0x49490f];return _0x30fced;};'use strict';var _=require(_0xb99f('0x0'));var util=require(_0xb99f('0x1'));var moment=require(_0xb99f('0x2'));var BPromise=require(_0xb99f('0x3'));var rs=require(_0xb99f('0x4'));var fs=require('fs');var Redis=require(_0xb99f('0x5'));var db=require(_0xb99f('0x6'))['db'];var utils=require(_0xb99f('0x7'));var logger=require(_0xb99f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb99f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b895c,_0x21722e,_0x4cd995){return new BPromise(function(_0x129e93,_0x49ee72){return client[_0xb99f('0xa')](_0x3b895c,_0x4cd995)[_0xb99f('0xb')](function(_0x1fa9c3){logger[_0xb99f('0xc')](_0xb99f('0xd'),_0x21722e,_0xb99f('0xe'));logger['debug'](_0xb99f('0xf'),_0x21722e,'request\x20sent',JSON[_0xb99f('0x10')](_0x1fa9c3));if(_0x1fa9c3[_0xb99f('0x11')]){if(_0x1fa9c3[_0xb99f('0x11')][_0xb99f('0x12')]===0x1f4){logger[_0xb99f('0x11')](_0xb99f('0xd'),_0x21722e,_0x1fa9c3[_0xb99f('0x11')][_0xb99f('0x13')]);return _0x49ee72(_0x1fa9c3['error'][_0xb99f('0x13')]);}logger[_0xb99f('0x11')](_0xb99f('0xd'),_0x21722e,_0x1fa9c3[_0xb99f('0x11')]['message']);return _0x129e93(_0x1fa9c3[_0xb99f('0x11')][_0xb99f('0x13')]);}else{logger[_0xb99f('0xc')]('Network,\x20%s,\x20%s',_0x21722e,_0xb99f('0xe'));_0x129e93(_0x1fa9c3[_0xb99f('0x14')][_0xb99f('0x13')]);}})[_0xb99f('0x15')](function(_0x529fa0){logger[_0xb99f('0x11')](_0xb99f('0xd'),_0x21722e,_0x529fa0);_0x49ee72(_0x529fa0);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 87fe3ea..da39c1b 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 _0xdb64=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./notification.controller','post','sendNotification','exports','multer','util'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xdb64,0x172));var _0x4db6=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xdb64[_0x104a84];return _0x4973ff;};'use strict';var multer=require(_0x4db6('0x0'));var util=require(_0x4db6('0x1'));var path=require(_0x4db6('0x2'));var timeout=require(_0x4db6('0x3'));var express=require(_0x4db6('0x4'));var router=express[_0x4db6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4db6('0x6'));var config=require(_0x4db6('0x7'));var controller=require(_0x4db6('0x8'));router[_0x4db6('0x9')]('/',auth['isAuthenticated'](),controller[_0x4db6('0xa')]);module[_0x4db6('0xb')]=router; \ No newline at end of file +var _0x24ca=['Router','../../components/auth/service','../../components/interaction/service','./notification.controller','sendNotification','exports','multer','path','connect-timeout','express'];(function(_0xcd4d8e,_0x1fc2fd){var _0x1c3c61=function(_0x293f3c){while(--_0x293f3c){_0xcd4d8e['push'](_0xcd4d8e['shift']());}};_0x1c3c61(++_0x1fc2fd);}(_0x24ca,0x1aa));var _0xa24c=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x24ca[_0x26b8b5];return _0x2150a9;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express[_0xa24c('0x4')]();var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require('../../config/environment');var controller=require(_0xa24c('0x7'));router['post']('/',auth['isAuthenticated'](),controller[_0xa24c('0x8')]);module[_0xa24c('0x9')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 8480967..8e5c443 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 _0xf37a=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x4baa48,_0x4519d7){var _0xe20abe=function(_0x36e517){while(--_0x36e517){_0x4baa48['push'](_0x4baa48['shift']());}};_0xe20abe(++_0x4519d7);}(_0xf37a,0x149));var _0xaf37=function(_0x4db9ed,_0x1e1a7e){_0x4db9ed=_0x4db9ed-0x0;var _0x218dab=_0xf37a[_0x4db9ed];return _0x218dab;};'use strict';var Sequelize=require(_0xaf37('0x0'));module[_0xaf37('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xaf37('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xaf37('0x3')]}}; \ No newline at end of file +var _0x2778=['TEXT','BOOLEAN','exports','STRING'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x2778,0x106));var _0x8277=function(_0x5cbef3,_0x47fe39){_0x5cbef3=_0x5cbef3-0x0;var _0x227caf=_0x2778[_0x5cbef3];return _0x227caf;};'use strict';var Sequelize=require('sequelize');module[_0x8277('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x8277('0x1')]},'recipientsId':{'type':Sequelize[_0x8277('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8277('0x1')]},'beep':{'type':Sequelize[_0x8277('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 1fe71fc..8cc2521 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 _0x9027=['Template','findOne','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','view','startCase','User','union','ids','replace','queue','Queue','all','html-pdf','rimraf','request-promise','moment','mustache','util','path','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','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','sendNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','notification:send','catch'];(function(_0x3cf801,_0x3d508b){var _0x518bf9=function(_0x4e8167){while(--_0x4e8167){_0x3cf801['push'](_0x3cf801['shift']());}};_0x518bf9(++_0x3d508b);}(_0x9027,0xd9));var _0x7902=function(_0x924d28,_0x1106b5){_0x924d28=_0x924d28-0x0;var _0x59b88c=_0x9027[_0x924d28];return _0x59b88c;};'use strict';var pdf=require(_0x7902('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7902('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7902('0x2'));var moment=require(_0x7902('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7902('0x4'));var util=require(_0x7902('0x5'));var path=require(_0x7902('0x6'));var sox=require(_0x7902('0x7'));var csv=require(_0x7902('0x8'));var ejs=require(_0x7902('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7902('0xa'));var crypto=require(_0x7902('0xb'));var jsforce=require(_0x7902('0xc'));var deskjs=require(_0x7902('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7902('0xe'));var Papa=require(_0x7902('0xf'));var Redis=require(_0x7902('0x10'));var authService=require(_0x7902('0x11'));var qs=require(_0x7902('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7902('0x13'));var logger=require(_0x7902('0x14'))(_0x7902('0x15'));var utils=require(_0x7902('0x16'));var config=require(_0x7902('0x17'));var db=require(_0x7902('0x18'))['db'];config[_0x7902('0x19')]=_[_0x7902('0x1a')](config[_0x7902('0x19')],{'host':_0x7902('0x1b'),'port':0x18eb});var socket=require(_0x7902('0x1c'))(new Redis(config[_0x7902('0x19')]));require(_0x7902('0x1d'))[_0x7902('0x1e')](socket);function respondWithStatusCode(_0x2115f9,_0x42d4b9){_0x42d4b9=_0x42d4b9||0xcc;return function(_0x1126d8){if(_0x1126d8){return _0x2115f9[_0x7902('0x1f')](_0x42d4b9);}return _0x2115f9['status'](_0x42d4b9)['end']();};}function respondWithResult(_0x262efc,_0x4c7809){_0x4c7809=_0x4c7809||0xc8;return function(_0x4d2738){if(_0x4d2738){return _0x262efc[_0x7902('0x20')](_0x4c7809)[_0x7902('0x21')](_0x4d2738);}};}function respondWithFilteredResult(_0x5de04f,_0x1141c0){return function(_0x36b439){if(_0x36b439){var _0x36e8d4=_0x36b439[_0x7902('0x22')],_0x28ea87=_0x1141c0['offset'],_0x2a6741=_0x1141c0[_0x7902('0x23')]+_0x1141c0['limit'],_0x525707;if(_0x2a6741>=_0x36e8d4){_0x2a6741=_0x36e8d4;_0x525707=0xc8;}else{_0x525707=0xce;}_0x5de04f[_0x7902('0x20')](_0x525707);return _0x5de04f[_0x7902('0x24')](_0x7902('0x25'),_0x28ea87+'-'+_0x2a6741+'/'+_0x36e8d4)[_0x7902('0x21')](_0x36b439);}return null;};}function patchUpdates(_0x4ab5e6){return function(_0x20c771){try{jsonpatch[_0x7902('0x26')](_0x20c771,_0x4ab5e6,!![]);}catch(_0x41b297){return BPromise[_0x7902('0x27')](_0x41b297);}return _0x20c771[_0x7902('0x28')]();};}function saveUpdates(_0x146154,_0x55b301){return function(_0xca5d27){if(_0xca5d27){return _0xca5d27[_0x7902('0x29')](_0x146154)[_0x7902('0x2a')](function(_0x4e7b6c){return _0x4e7b6c;});}return null;};}function removeEntity(_0x98be6d,_0x555d7b){return function(_0xee820b){if(_0xee820b){return _0xee820b[_0x7902('0x2b')]()['then'](function(){_0x98be6d[_0x7902('0x20')](0xcc)[_0x7902('0x2c')]();});}};}function handleEntityNotFound(_0x518336,_0x526c62){return function(_0x5ac958){if(!_0x5ac958){_0x518336[_0x7902('0x1f')](0x194);}return _0x5ac958;};}function handleError(_0x2eeab4,_0x590894){_0x590894=_0x590894||0x1f4;return function(_0x325194){logger[_0x7902('0x2d')](_0x325194[_0x7902('0x2e')]);if(_0x325194[_0x7902('0x2f')]){delete _0x325194['name'];}_0x2eeab4[_0x7902('0x20')](_0x590894)['send'](_0x325194);};}exports[_0x7902('0x30')]=function(_0x32b166,_0x46ccd4,_0x1f0b90){if(!_0x32b166[_0x7902('0x31')][_0x7902('0x32')](_0x7902('0x33'))&&!_0x32b166[_0x7902('0x31')][_0x7902('0x32')]('TemplateId')){throw new db[(_0x7902('0x34'))][(_0x7902('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x32b166['body']['hasOwnProperty']('TemplateId')&&!_0x32b166[_0x7902('0x31')][_0x7902('0x32')]('view')){throw new db[(_0x7902('0x34'))][(_0x7902('0x35'))](_0x7902('0x36'));}if(!_0x32b166[_0x7902('0x31')][_0x7902('0x32')]('recipients')){throw new db['Sequelize'][(_0x7902('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1fb0b8=JSON[_0x7902('0x37')](_0x32b166['body']['recipients']);}catch(_0x1a81f5){logger['error'](_0x1a81f5);throw new db['Sequelize'][(_0x7902('0x35'))](_0x7902('0x38'));}var _0x3f3744=[_0x7902('0x39'),_0x7902('0x3a'),'mailqueue',_0x7902('0x3b'),_0x7902('0x3c'),_0x7902('0x3d'),_0x7902('0x3e'),_0x7902('0x3f'),_0x7902('0x40')];if(_[_0x7902('0x41')](_0x1fb0b8,function(_0x1639d8){return!_[_0x7902('0x42')](_0x3f3744,_0x1639d8[_0x7902('0x43')][_0x7902('0x44')]());})){throw new db['Sequelize'][(_0x7902('0x35'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5f57b6={};_0x5f57b6['senderName']=_0x32b166[_0x7902('0x31')][_0x7902('0x32')](_0x7902('0x45'))?_0x32b166[_0x7902('0x31')][_0x7902('0x45')]:_0x32b166[_0x7902('0x40')][_0x7902('0x46')];_0x5f57b6[_0x7902('0x47')]=_[_0x7902('0x48')](_0x32b166[_0x7902('0x31')][_0x7902('0x47')])?null:_0x32b166[_0x7902('0x31')][_0x7902('0x47')];_0x5f57b6['beep']=_0x32b166['body'][_0x7902('0x49')]||![];_0x5f57b6[_0x7902('0x4a')]=_0x32b166[_0x7902('0x40')]['id'];return getContent(_0x32b166[_0x7902('0x31')])[_0x7902('0x2a')](function(_0x49084f){_0x5f57b6[_0x7902('0x31')]=_0x49084f;return getRecipients(_0x1fb0b8);})[_0x7902('0x2a')](function(_0x1ac694){_0x5f57b6[_0x7902('0x4b')]=_[_0x7902('0x4c')](_0x1ac694)[_0x7902('0x4d')](',');return db[_0x7902('0x4e')][_0x7902('0x4f')](function(_0x2cbd4f){return db[_0x7902('0x50')][_0x7902('0x51')](_0x5f57b6,{'raw':!![],'transaction':_0x2cbd4f})[_0x7902('0x2a')](function(_0x21fc3a){var _0x1d1b8b={'sender':_0x5f57b6[_0x7902('0x45')],'description':_0x5f57b6['recipientsDescription'],'content':_0x5f57b6['body'],'beep':_0x5f57b6[_0x7902('0x49')]};_0x1ac694[_0x7902('0x52')](function(_0x8ba59c){_0x1d1b8b[_0x7902('0x53')]=_0x8ba59c;socket['emit'](_0x7902('0x54'),_0x1d1b8b);});return _0x21fc3a;});});})[_0x7902('0x2a')](respondWithResult(_0x46ccd4,0xc9))[_0x7902('0x55')](handleError(_0x46ccd4,null));};function getContent(_0x493882){return new BPromise(function(_0x5e9680,_0x1c8f96){if(_0x493882[_0x7902('0x33')]){_0x5e9680(_0x493882[_0x7902('0x33')]);return;}return db[_0x7902('0x56')][_0x7902('0x57')]({'attributes':['html'],'where':{'id':_0x493882[_0x7902('0x58')]},'raw':!![]})[_0x7902('0x2a')](function(_0x5b308e){if(!_0x5b308e)throw new db[(_0x7902('0x34'))]['ValidationError'](_0x7902('0x59'));var _0x596bed=Mustache[_0x7902('0x5a')](_0x5b308e[_0x7902('0x5b')],_0x493882[_0x7902('0x5c')]);_0x5e9680(_0x596bed);})['catch'](function(_0x2cc11f){_0x1c8f96(_0x2cc11f);});});}function getRecipients(_0x3518dc){return new BPromise(function(_0x2ece5c,_0x20ff94){var _0xd8940a=[];var _0x319555=[];_0x3518dc[_0x7902('0x52')](function(_0x52bc49){var _0x21867c=_[_0x7902('0x5d')](_0x52bc49[_0x7902('0x43')]['toLowerCase']());if(_0x21867c===_0x7902('0x5e')){_0xd8940a=_[_0x7902('0x5f')](_0xd8940a,_0x52bc49[_0x7902('0x60')]);}else{if(_['includes'](_0x21867c,'queue'))_0x21867c=_0x21867c[_0x7902('0x61')](_0x7902('0x62'),_0x7902('0x63'));_0x52bc49[_0x7902('0x60')][_0x7902('0x52')](function(_0x1ae943){_0x319555['push'](getAgents(_0x21867c,_0x1ae943));});}});return BPromise[_0x7902('0x64')](_0x319555)[_0x7902('0x2a')](function(_0x167a18){_0xd8940a=_[_0x7902('0x5f')](_0xd8940a,_['flatten'](_0x167a18));_0x2ece5c(_0xd8940a);})[_0x7902('0x55')](function(_0x3c9c5b){_0x20ff94(_0x3c9c5b);});});}function getAgents(_0x4a513f,_0x6097ce){return new BPromise(function(_0x34f7d9,_0x2764d2){return db[_0x4a513f][_0x7902('0x57')]({'where':{'id':_0x6097ce}})[_0x7902('0x2a')](function(_0x325454){return _0x325454['getAgents']({'attributes':['id'],'raw':!![]})[_0x7902('0x2a')](function(_0x3eb70c){var _0x1e33f7=_['map'](_0x3eb70c,'id');_0x34f7d9(_0x1e33f7);});})[_0x7902('0x55')](function(_0x2f4589){_0x2764d2(_0x2f4589);});});} \ No newline at end of file +var _0xd6db=['mailqueue','openchannelqueue','team','user','some','includes','model','toLowerCase','senderName','recipientsDescription','beep','SenderId','sortBy','join','sequelize','recipient','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','union','ids','queue','replace','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','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'];(function(_0x278aea,_0x3c128a){var _0x2f0185=function(_0x4023d9){while(--_0x4023d9){_0x278aea['push'](_0x278aea['shift']());}};_0x2f0185(++_0x3c128a);}(_0xd6db,0x1a6));var _0xbd6d=function(_0x3a227d,_0x271209){_0x3a227d=_0x3a227d-0x0;var _0x1b94cf=_0xd6db[_0x3a227d];return _0x1b94cf;};'use strict';var pdf=require(_0xbd6d('0x0'));var emlformat=require(_0xbd6d('0x1'));var rimraf=require(_0xbd6d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd6d('0x3'));var rp=require(_0xbd6d('0x4'));var moment=require(_0xbd6d('0x5'));var BPromise=require(_0xbd6d('0x6'));var Mustache=require(_0xbd6d('0x7'));var util=require(_0xbd6d('0x8'));var path=require(_0xbd6d('0x9'));var sox=require(_0xbd6d('0xa'));var csv=require(_0xbd6d('0xb'));var ejs=require(_0xbd6d('0xc'));var fs=require('fs');var _=require(_0xbd6d('0xd'));var squel=require(_0xbd6d('0xe'));var crypto=require(_0xbd6d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbd6d('0x10'));var toCsv=require(_0xbd6d('0xb'));var querystring=require(_0xbd6d('0x11'));var Papa=require(_0xbd6d('0x12'));var Redis=require(_0xbd6d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd6d('0x14'));var as=require(_0xbd6d('0x15'));var hardwareService=require(_0xbd6d('0x16'));var logger=require(_0xbd6d('0x17'))('api');var utils=require(_0xbd6d('0x18'));var config=require('../../config/environment');var db=require(_0xbd6d('0x19'))['db'];config['redis']=_[_0xbd6d('0x1a')](config[_0xbd6d('0x1b')],{'host':_0xbd6d('0x1c'),'port':0x18eb});var socket=require(_0xbd6d('0x1d'))(new Redis(config[_0xbd6d('0x1b')]));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x4eebba,_0x2514f1){_0x2514f1=_0x2514f1||0xcc;return function(_0xa681cc){if(_0xa681cc){return _0x4eebba[_0xbd6d('0x1e')](_0x2514f1);}return _0x4eebba['status'](_0x2514f1)[_0xbd6d('0x1f')]();};}function respondWithResult(_0x32fc79,_0x211dd3){_0x211dd3=_0x211dd3||0xc8;return function(_0x1fee6e){if(_0x1fee6e){return _0x32fc79[_0xbd6d('0x20')](_0x211dd3)['json'](_0x1fee6e);}};}function respondWithFilteredResult(_0x2db8d3,_0x426b4b){return function(_0x2d812a){if(_0x2d812a){var _0x1ab646=_0x2d812a[_0xbd6d('0x21')],_0x3de725=_0x426b4b[_0xbd6d('0x22')],_0x389f44=_0x426b4b[_0xbd6d('0x22')]+_0x426b4b[_0xbd6d('0x23')],_0x43593e;if(_0x389f44>=_0x1ab646){_0x389f44=_0x1ab646;_0x43593e=0xc8;}else{_0x43593e=0xce;}_0x2db8d3[_0xbd6d('0x20')](_0x43593e);return _0x2db8d3[_0xbd6d('0x24')](_0xbd6d('0x25'),_0x3de725+'-'+_0x389f44+'/'+_0x1ab646)[_0xbd6d('0x26')](_0x2d812a);}return null;};}function patchUpdates(_0x1c4d3f){return function(_0xc38f77){try{jsonpatch[_0xbd6d('0x27')](_0xc38f77,_0x1c4d3f,!![]);}catch(_0x18ecd2){return BPromise['reject'](_0x18ecd2);}return _0xc38f77[_0xbd6d('0x28')]();};}function saveUpdates(_0x5707cc,_0x468ad0){return function(_0x1635a5){if(_0x1635a5){return _0x1635a5[_0xbd6d('0x29')](_0x5707cc)[_0xbd6d('0x2a')](function(_0x5554a8){return _0x5554a8;});}return null;};}function removeEntity(_0x2dce95,_0x2091f1){return function(_0x51209e){if(_0x51209e){return _0x51209e[_0xbd6d('0x2b')]()['then'](function(){_0x2dce95[_0xbd6d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23c8d7,_0x259eb3){return function(_0x200b3f){if(!_0x200b3f){_0x23c8d7[_0xbd6d('0x1e')](0x194);}return _0x200b3f;};}function handleError(_0x5dafa6,_0x3f1813){_0x3f1813=_0x3f1813||0x1f4;return function(_0x5bb839){logger[_0xbd6d('0x2c')](_0x5bb839[_0xbd6d('0x2d')]);if(_0x5bb839[_0xbd6d('0x2e')]){delete _0x5bb839['name'];}_0x5dafa6[_0xbd6d('0x20')](_0x3f1813)[_0xbd6d('0x2f')](_0x5bb839);};}exports['sendNotification']=function(_0x23971d,_0x25caf2,_0x13cd2f){if(!_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x31')](_0xbd6d('0x32'))&&!_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x31')](_0xbd6d('0x33'))){throw new db[(_0xbd6d('0x34'))][(_0xbd6d('0x35'))](_0xbd6d('0x36'));}else{if(_0x23971d[_0xbd6d('0x30')]['hasOwnProperty'](_0xbd6d('0x33'))&&!_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x31')](_0xbd6d('0x37'))){throw new db[(_0xbd6d('0x34'))][(_0xbd6d('0x35'))](_0xbd6d('0x38'));}if(!_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x31')](_0xbd6d('0x39'))){throw new db[(_0xbd6d('0x34'))]['ValidationError'](_0xbd6d('0x3a'));}else{try{var _0x22db80=JSON[_0xbd6d('0x3b')](_0x23971d['body'][_0xbd6d('0x39')]);}catch(_0x32083d){logger[_0xbd6d('0x2c')](_0x32083d);throw new db['Sequelize']['ValidationError'](_0xbd6d('0x3c'));}var _0x50cd0f=[_0xbd6d('0x3d'),_0xbd6d('0x3e'),_0xbd6d('0x3f'),_0xbd6d('0x40'),'smsqueue','voicequeue','whatsappqueue',_0xbd6d('0x41'),_0xbd6d('0x42')];if(_[_0xbd6d('0x43')](_0x22db80,function(_0x228655){return!_[_0xbd6d('0x44')](_0x50cd0f,_0x228655[_0xbd6d('0x45')][_0xbd6d('0x46')]());})){throw new db[(_0xbd6d('0x34'))][(_0xbd6d('0x35'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3aae7f={};_0x3aae7f[_0xbd6d('0x47')]=_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x31')](_0xbd6d('0x47'))?_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x47')]:_0x23971d[_0xbd6d('0x42')]['fullname'];_0x3aae7f[_0xbd6d('0x48')]=_['isEmpty'](_0x23971d['body'][_0xbd6d('0x48')])?null:_0x23971d[_0xbd6d('0x30')]['recipientsDescription'];_0x3aae7f[_0xbd6d('0x49')]=_0x23971d[_0xbd6d('0x30')][_0xbd6d('0x49')]||![];_0x3aae7f[_0xbd6d('0x4a')]=_0x23971d[_0xbd6d('0x42')]['id'];return getContent(_0x23971d[_0xbd6d('0x30')])[_0xbd6d('0x2a')](function(_0xcf9a2d){_0x3aae7f[_0xbd6d('0x30')]=_0xcf9a2d;return getRecipients(_0x22db80);})['then'](function(_0x540f16){_0x3aae7f['recipientsId']=_[_0xbd6d('0x4b')](_0x540f16)[_0xbd6d('0x4c')](',');return db[_0xbd6d('0x4d')]['transaction'](function(_0x41e205){return db['Notification']['create'](_0x3aae7f,{'raw':!![],'transaction':_0x41e205})['then'](function(_0x5c3be5){var _0x558e8c={'sender':_0x3aae7f[_0xbd6d('0x47')],'description':_0x3aae7f[_0xbd6d('0x48')],'content':_0x3aae7f['body'],'beep':_0x3aae7f[_0xbd6d('0x49')]};_0x540f16['forEach'](function(_0x1e3f19){_0x558e8c[_0xbd6d('0x4e')]=_0x1e3f19;socket[_0xbd6d('0x4f')](_0xbd6d('0x50'),_0x558e8c);});return _0x5c3be5;});});})[_0xbd6d('0x2a')](respondWithResult(_0x25caf2,0xc9))[_0xbd6d('0x51')](handleError(_0x25caf2,null));};function getContent(_0x2630f7){return new BPromise(function(_0x4f6504,_0x5901ee){if(_0x2630f7[_0xbd6d('0x32')]){_0x4f6504(_0x2630f7[_0xbd6d('0x32')]);return;}return db[_0xbd6d('0x52')][_0xbd6d('0x53')]({'attributes':[_0xbd6d('0x54')],'where':{'id':_0x2630f7['TemplateId']},'raw':!![]})['then'](function(_0x24ee95){if(!_0x24ee95)throw new db[(_0xbd6d('0x34'))][(_0xbd6d('0x35'))](_0xbd6d('0x55'));var _0x4806b2=Mustache['render'](_0x24ee95[_0xbd6d('0x54')],_0x2630f7[_0xbd6d('0x37')]);_0x4f6504(_0x4806b2);})[_0xbd6d('0x51')](function(_0x203f88){_0x5901ee(_0x203f88);});});}function getRecipients(_0x23c138){return new BPromise(function(_0x1f1d42,_0x1e5219){var _0x16e2db=[];var _0x12dd5f=[];_0x23c138[_0xbd6d('0x56')](function(_0x16fe03){var _0x2b88ea=_[_0xbd6d('0x57')](_0x16fe03['model'][_0xbd6d('0x46')]());if(_0x2b88ea==='User'){_0x16e2db=_[_0xbd6d('0x58')](_0x16e2db,_0x16fe03[_0xbd6d('0x59')]);}else{if(_['includes'](_0x2b88ea,_0xbd6d('0x5a')))_0x2b88ea=_0x2b88ea[_0xbd6d('0x5b')](_0xbd6d('0x5a'),'Queue');_0x16fe03[_0xbd6d('0x59')]['forEach'](function(_0x3b0b24){_0x12dd5f[_0xbd6d('0x5c')](getAgents(_0x2b88ea,_0x3b0b24));});}});return BPromise[_0xbd6d('0x5d')](_0x12dd5f)['then'](function(_0x46d968){_0x16e2db=_[_0xbd6d('0x58')](_0x16e2db,_[_0xbd6d('0x5e')](_0x46d968));_0x1f1d42(_0x16e2db);})['catch'](function(_0x1a91b0){_0x1e5219(_0x1a91b0);});});}function getAgents(_0x2c4998,_0x4baf05){return new BPromise(function(_0x53bb0e,_0x133ae9){return db[_0x2c4998]['findOne']({'where':{'id':_0x4baf05}})['then'](function(_0x1de617){return _0x1de617[_0xbd6d('0x5f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9bdf1){var _0x597d20=_[_0xbd6d('0x60')](_0x9bdf1,'id');_0x53bb0e(_0x597d20);});})[_0xbd6d('0x51')](function(_0x250c2a){_0x133ae9(_0x250c2a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index c73f14e..22dc2a4 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x41c9e0,_0x3088b5){var _0x5c3f9e=function(_0x1201a8){while(--_0x1201a8){_0x41c9e0['push'](_0x41c9e0['shift']());}};_0x5c3f9e(++_0x3088b5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x9171e0,_0x2ee1b3){var _0x2659fb=function(_0x48eacc){while(--_0x48eacc){_0x9171e0['push'](_0x9171e0['shift']());}};_0x2659fb(++_0x2ee1b3);}(_0xdb28,0x106));var _0x8db2=function(_0x40b226,_0x1f7635){_0x40b226=_0x40b226-0x0;var _0x1ea9a3=_0xdb28[_0x40b226];return _0x1ea9a3;};'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 diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 0562365..2cdc378 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 _0x9354=['../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x351171,_0x51e3cb){var _0x45e2f2=function(_0x2ffae8){while(--_0x2ffae8){_0x351171['push'](_0x351171['shift']());}};_0x45e2f2(++_0x51e3cb);}(_0x9354,0x96));var _0x4935=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0x9354[_0x15af0f];return _0x2bd1cb;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4935('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./notification.attributes','define','Notification','notifications'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8603,0x190));var _0x3860=function(_0x2ed244,_0x129f94){_0x2ed244=_0x2ed244-0x0;var _0x116cf9=_0x8603[_0x2ed244];return _0x116cf9;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 2ba9bd3..c76a190 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 _0x500e=['debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x5a1280,_0x11ceeb){var _0x2fcfd6=function(_0x5338ec){while(--_0x5338ec){_0x5a1280['push'](_0x5a1280['shift']());}};_0x2fcfd6(++_0x11ceeb);}(_0x500e,0x73));var _0xe500=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x500e[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0xe500('0x0'));var util=require(_0xe500('0x1'));var moment=require(_0xe500('0x2'));var BPromise=require('bluebird');var rs=require(_0xe500('0x3'));var fs=require('fs');var Redis=require(_0xe500('0x4'));var db=require(_0xe500('0x5'))['db'];var utils=require(_0xe500('0x6'));var logger=require(_0xe500('0x7'))(_0xe500('0x8'));var config=require(_0xe500('0x9'));var jayson=require(_0xe500('0xa'));var client=jayson[_0xe500('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xe500('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe500('0xd'))(new Redis(config[_0xe500('0xc')]));require('./notification.socket')[_0xe500('0xe')](socket);function respondWithRpcPromise(_0x1fe848,_0x42c4ae,_0x44096a){return new BPromise(function(_0x58d401,_0x282f20){return client[_0xe500('0xf')](_0x1fe848,_0x44096a)[_0xe500('0x10')](function(_0x16e357){logger[_0xe500('0x11')](_0xe500('0x12'),_0x42c4ae,_0xe500('0x13'));logger[_0xe500('0x14')](_0xe500('0x15'),_0x42c4ae,'request\x20sent',JSON['stringify'](_0x16e357));if(_0x16e357[_0xe500('0x16')]){if(_0x16e357[_0xe500('0x16')][_0xe500('0x17')]===0x1f4){logger[_0xe500('0x16')](_0xe500('0x12'),_0x42c4ae,_0x16e357['error'][_0xe500('0x18')]);return _0x282f20(_0x16e357[_0xe500('0x16')][_0xe500('0x18')]);}logger[_0xe500('0x16')](_0xe500('0x12'),_0x42c4ae,_0x16e357['error'][_0xe500('0x18')]);return _0x58d401(_0x16e357[_0xe500('0x16')][_0xe500('0x18')]);}else{logger[_0xe500('0x11')]('Notification,\x20%s,\x20%s',_0x42c4ae,_0xe500('0x13'));_0x58d401(_0x16e357[_0xe500('0x19')][_0xe500('0x18')]);}})[_0xe500('0x1a')](function(_0x1d951b){logger[_0xe500('0x16')](_0xe500('0x12'),_0x42c4ae,_0x1d951b);_0x282f20(_0x1d951b);});});} \ No newline at end of file +var _0x4829=['../../config/environment','jayson/promise','http','redis','register','request','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x549326,_0xac005){var _0x5ecb80=function(_0x344b4a){while(--_0x344b4a){_0x549326['push'](_0x549326['shift']());}};_0x5ecb80(++_0xac005);}(_0x4829,0xc6));var _0x9482=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4829[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x9482('0x0'));var util=require(_0x9482('0x1'));var moment=require(_0x9482('0x2'));var BPromise=require(_0x9482('0x3'));var rs=require(_0x9482('0x4'));var fs=require('fs');var Redis=require(_0x9482('0x5'));var db=require(_0x9482('0x6'))['db'];var utils=require(_0x9482('0x7'));var logger=require(_0x9482('0x8'))(_0x9482('0x9'));var config=require(_0x9482('0xa'));var jayson=require(_0x9482('0xb'));var client=jayson['client'][_0x9482('0xc')]({'port':0x232a});config[_0x9482('0xd')]=_['defaults'](config[_0x9482('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./notification.socket')[_0x9482('0xe')](socket);function respondWithRpcPromise(_0x49372e,_0x382397,_0x3ecca2){return new BPromise(function(_0x3d3a0d,_0xd4a84f){return client[_0x9482('0xf')](_0x49372e,_0x3ecca2)['then'](function(_0x707caa){logger['info'](_0x9482('0x10'),_0x382397,'request\x20sent');logger[_0x9482('0x11')](_0x9482('0x12'),_0x382397,_0x9482('0x13'),JSON['stringify'](_0x707caa));if(_0x707caa['error']){if(_0x707caa[_0x9482('0x14')][_0x9482('0x15')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x382397,_0x707caa[_0x9482('0x14')][_0x9482('0x16')]);return _0xd4a84f(_0x707caa[_0x9482('0x14')]['message']);}logger[_0x9482('0x14')]('Notification,\x20%s,\x20%s',_0x382397,_0x707caa[_0x9482('0x14')][_0x9482('0x16')]);return _0x3d3a0d(_0x707caa['error']['message']);}else{logger[_0x9482('0x17')](_0x9482('0x10'),_0x382397,_0x9482('0x13'));_0x3d3a0d(_0x707caa[_0x9482('0x18')][_0x9482('0x16')]);}})[_0x9482('0x19')](function(_0x49da5a){logger[_0x9482('0x14')]('Notification,\x20%s,\x20%s',_0x382397,_0x49da5a);_0xd4a84f(_0x49da5a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 9ac25f2..d888823 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 _0x62c6=['notification:','./notification.events','save','remove','update','removeListener','register','length'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x62c6,0x181));var _0x662c=function(_0x365d65,_0x4c3c3a){_0x365d65=_0x365d65-0x0;var _0x40d8c3=_0x62c6[_0x365d65];return _0x40d8c3;};'use strict';var NotificationEvents=require(_0x662c('0x0'));var events=[_0x662c('0x1'),_0x662c('0x2'),_0x662c('0x3')];function createListener(_0x174421,_0x5eeb9c){return function(_0x461186){_0x5eeb9c['emit'](_0x174421,_0x461186);};}function removeListener(_0x551fbe,_0x39bbe2){return function(){NotificationEvents[_0x662c('0x4')](_0x551fbe,_0x39bbe2);};}exports[_0x662c('0x5')]=function(_0x1678d6){for(var _0x1adb99=0x0,_0x4cbab8=events[_0x662c('0x6')];_0x1adb99<_0x4cbab8;_0x1adb99++){var _0xb2c387=events[_0x1adb99];var _0xb0477=createListener(_0x662c('0x7')+_0xb2c387,_0x1678d6);NotificationEvents['on'](_0xb2c387,_0xb0477);}}; \ No newline at end of file +var _0xc307=['length','notification:','save','remove','update','removeListener'];(function(_0x3ca71c,_0x3370b2){var _0x699178=function(_0x17fbe6){while(--_0x17fbe6){_0x3ca71c['push'](_0x3ca71c['shift']());}};_0x699178(++_0x3370b2);}(_0xc307,0x6e));var _0x7c30=function(_0x1b96d9,_0x171cc3){_0x1b96d9=_0x1b96d9-0x0;var _0x3fa8c1=_0xc307[_0x1b96d9];return _0x3fa8c1;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x7c30('0x0'),_0x7c30('0x1'),_0x7c30('0x2')];function createListener(_0x4eae69,_0x4aa300){return function(_0x3c2b31){_0x4aa300['emit'](_0x4eae69,_0x3c2b31);};}function removeListener(_0xe4b049,_0x5028aa){return function(){NotificationEvents[_0x7c30('0x3')](_0xe4b049,_0x5028aa);};}exports['register']=function(_0x2a3666){for(var _0x3d357b=0x0,_0xe048a1=events[_0x7c30('0x4')];_0x3d357b<_0xe048a1;_0x3d357b++){var _0x491d12=events[_0x3d357b];var _0x2fbe90=createListener(_0x7c30('0x5')+_0x491d12,_0x2a3666);NotificationEvents['on'](_0x491d12,_0x2fbe90);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 3254b1c..ecb1708 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 _0x2770=['delete','/:id/canned_answers','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','update','destroy','removeDispositions'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x2770,0x18a));var _0x0277=function(_0x4b554e,_0x2d8a54){_0x4b554e=_0x4b554e-0x0;var _0xd2c592=_0x2770[_0x4b554e];return _0xd2c592;};'use strict';var multer=require(_0x0277('0x0'));var util=require(_0x0277('0x1'));var path=require('path');var timeout=require(_0x0277('0x2'));var express=require(_0x0277('0x3'));var router=express[_0x0277('0x4')]();var auth=require(_0x0277('0x5'));var interaction=require(_0x0277('0x6'));var config=require(_0x0277('0x7'));var controller=require(_0x0277('0x8'));router[_0x0277('0x9')]('/',auth['isAuthenticated'](),controller[_0x0277('0xa')]);router['get'](_0x0277('0xb'),auth[_0x0277('0xc')](),controller[_0x0277('0xd')]);router[_0x0277('0x9')](_0x0277('0xe'),auth[_0x0277('0xc')](),controller[_0x0277('0xf')]);router[_0x0277('0x9')](_0x0277('0x10'),auth[_0x0277('0xc')](),controller[_0x0277('0x11')]);router['get']('/:id/canned_answers',auth[_0x0277('0xc')](),controller[_0x0277('0x12')]);router['get'](_0x0277('0x13'),auth[_0x0277('0xc')](),controller[_0x0277('0x14')]);router['get'](_0x0277('0x15'),auth[_0x0277('0xc')](),controller['getInteractions']);router[_0x0277('0x9')](_0x0277('0x16'),auth[_0x0277('0xc')](),controller[_0x0277('0x17')]);router[_0x0277('0x18')]('/',auth[_0x0277('0xc')](),controller['create']);router[_0x0277('0x18')](_0x0277('0x10'),auth['isAuthenticated'](),controller[_0x0277('0x19')]);router['post']('/:id/canned_answers',auth[_0x0277('0xc')](),controller[_0x0277('0x1a')]);router[_0x0277('0x18')]('/:id/notify',controller[_0x0277('0x1b')]);router['post'](_0x0277('0x13'),auth['isAuthenticated'](),controller[_0x0277('0x1c')]);router[_0x0277('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x0277('0x1d')]);router[_0x0277('0x18')](_0x0277('0x1e'),auth['isAuthenticated'](),controller[_0x0277('0x1f')]);router['put'](_0x0277('0xe'),auth[_0x0277('0xc')](),controller[_0x0277('0x20')]);router['delete']('/:id',auth[_0x0277('0xc')](),controller[_0x0277('0x21')]);router['delete'](_0x0277('0x10'),auth[_0x0277('0xc')](),controller[_0x0277('0x22')]);router[_0x0277('0x23')](_0x0277('0x24'),auth[_0x0277('0xc')](),controller[_0x0277('0x25')]);router[_0x0277('0x23')](_0x0277('0x16'),auth[_0x0277('0xc')](),controller['removeAgents']);module[_0x0277('0x26')]=router; \ No newline at end of file +var _0x3527=['../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','getAgents','/:id/dispositions','addDisposition','post','addAnswer','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x50499c,_0x188984){var _0xd422b3=function(_0x35e6cf){while(--_0x35e6cf){_0x50499c['push'](_0x50499c['shift']());}};_0xd422b3(++_0x188984);}(_0x3527,0x10a));var _0x7352=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0x3527[_0x593d89];return _0x4aa403;};'use strict';var multer=require(_0x7352('0x0'));var util=require('util');var path=require(_0x7352('0x1'));var timeout=require(_0x7352('0x2'));var express=require('express');var router=express[_0x7352('0x3')]();var auth=require(_0x7352('0x4'));var interaction=require(_0x7352('0x5'));var config=require(_0x7352('0x6'));var controller=require(_0x7352('0x7'));router[_0x7352('0x8')]('/',auth[_0x7352('0x9')](),controller[_0x7352('0xa')]);router['get'](_0x7352('0xb'),auth[_0x7352('0x9')](),controller['describe']);router['get'](_0x7352('0xc'),auth[_0x7352('0x9')](),controller[_0x7352('0xd')]);router[_0x7352('0x8')]('/:id/dispositions',auth[_0x7352('0x9')](),controller['getDispositions']);router[_0x7352('0x8')](_0x7352('0xe'),auth[_0x7352('0x9')](),controller[_0x7352('0xf')]);router[_0x7352('0x8')](_0x7352('0x10'),auth[_0x7352('0x9')](),controller['getApplications']);router[_0x7352('0x8')]('/:id/interactions',auth[_0x7352('0x9')](),controller[_0x7352('0x11')]);router[_0x7352('0x8')]('/:id/users',auth[_0x7352('0x9')](),controller[_0x7352('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7352('0x13'),auth[_0x7352('0x9')](),controller[_0x7352('0x14')]);router[_0x7352('0x15')]('/:id/canned_answers',auth[_0x7352('0x9')](),controller[_0x7352('0x16')]);router['post']('/:id/notify',controller['notify']);router[_0x7352('0x15')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7352('0x17')]);router[_0x7352('0x15')]('/:id/users',auth[_0x7352('0x9')](),controller[_0x7352('0x18')]);router['post'](_0x7352('0x19'),auth[_0x7352('0x9')](),controller[_0x7352('0x1a')]);router[_0x7352('0x1b')](_0x7352('0xc'),auth[_0x7352('0x9')](),controller['update']);router[_0x7352('0x1c')](_0x7352('0xc'),auth[_0x7352('0x9')](),controller[_0x7352('0x1d')]);router[_0x7352('0x1c')](_0x7352('0x13'),auth[_0x7352('0x9')](),controller[_0x7352('0x1e')]);router[_0x7352('0x1c')](_0x7352('0xe'),auth[_0x7352('0x9')](),controller[_0x7352('0x1f')]);router['delete']('/:id/users',auth[_0x7352('0x9')](),controller[_0x7352('0x20')]);module[_0x7352('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 2cdd92c..950bdc9 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 _0xc537=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','TEXT'];(function(_0x304462,_0x4ca3fb){var _0x1ea84a=function(_0x49ef1e){while(--_0x49ef1e){_0x304462['push'](_0x304462['shift']());}};_0x1ea84a(++_0x4ca3fb);}(_0xc537,0xe2));var _0x7c53=function(_0x149ffd,_0x8c849c){_0x149ffd=_0x149ffd-0x0;var _0x35db8d=_0xc537[_0x149ffd];return _0x35db8d;};'use strict';var Sequelize=require(_0x7c53('0x0'));var rs=require('randomstring');module[_0x7c53('0x1')]={'name':{'type':Sequelize[_0x7c53('0x2')],'unique':_0x7c53('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7c53('0x2')]},'token':{'type':Sequelize[_0x7c53('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x7c53('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7c53('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7c53('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7c53('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7c53('0x2')]},'queueTransfer':{'type':Sequelize[_0x7c53('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c53('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c53('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7c53('0x5')],'defaultValue':![],'comment':_0x7c53('0x7'),'set':function(_0x549e16){if(!_0x549e16)this[_0x7c53('0x8')](_0x7c53('0x9'),null);this[_0x7c53('0x8')](_0x7c53('0xa'),_0x549e16);}}}; \ No newline at end of file +var _0xe569=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xd4791b,_0x1af776){var _0x230202=function(_0x2d172f){while(--_0x2d172f){_0xd4791b['push'](_0xd4791b['shift']());}};_0x230202(++_0x1af776);}(_0xe569,0x1a4));var _0x9e56=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0xe569[_0x549cad];return _0x5a9eed;};'use strict';var Sequelize=require(_0x9e56('0x0'));var rs=require(_0x9e56('0x1'));module[_0x9e56('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e56('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9e56('0x4')]},'token':{'type':Sequelize[_0x9e56('0x4')],'defaultValue':function(){return rs[_0x9e56('0x5')]();}},'replyUri':{'type':Sequelize[_0x9e56('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9e56('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9e56('0x6')],'defaultValue':function(){return _0x9e56('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9e56('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9e56('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9e56('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9e56('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9e56('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9e56('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e56('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9e56('0x8')],'defaultValue':![],'comment':_0x9e56('0xa'),'set':function(_0x2cbcd8){if(!_0x2cbcd8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9e56('0xb')](_0x9e56('0xc'),_0x2cbcd8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9ea689f..6b8fe45 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 _0xb085=['type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','show','params','include','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','pick','OpenchannelAccountId','count','includeAll','removeDispositions','ids','addAnswer','getAnswers','notify','openchannel','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','DESC','OpenchannelApplication','account','applications','asc','Applications','Contacts','defaults','contact','lastName','threadId','OpenchannelInteraction','spread','firstName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','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','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','end','offset','limit','status','set','json','apply','reject','save','update','destroy','OpenchannelAccounts','sendStatus','stack','name','send','index','map','OpenchannelAccount','rawAttributes','fieldName'];(function(_0x3af9b3,_0x5de8ee){var _0x265ecb=function(_0x27fdb7){while(--_0x27fdb7){_0x3af9b3['push'](_0x3af9b3['shift']());}};_0x265ecb(++_0x5de8ee);}(_0xb085,0x1f0));var _0x5b08=function(_0x2f1f5b,_0x3ac3ba){_0x2f1f5b=_0x2f1f5b-0x0;var _0x45a711=_0xb085[_0x2f1f5b];return _0x45a711;};'use strict';var pdf=require(_0x5b08('0x0'));var emlformat=require(_0x5b08('0x1'));var rimraf=require(_0x5b08('0x2'));var zipdir=require(_0x5b08('0x3'));var jsonpatch=require(_0x5b08('0x4'));var rp=require(_0x5b08('0x5'));var moment=require(_0x5b08('0x6'));var BPromise=require(_0x5b08('0x7'));var Mustache=require(_0x5b08('0x8'));var util=require('util');var path=require(_0x5b08('0x9'));var sox=require(_0x5b08('0xa'));var csv=require('to-csv');var ejs=require(_0x5b08('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b08('0xc'));var crypto=require('crypto');var jsforce=require(_0x5b08('0xd'));var deskjs=require(_0x5b08('0xe'));var toCsv=require(_0x5b08('0xf'));var querystring=require(_0x5b08('0x10'));var Papa=require(_0x5b08('0x11'));var Redis=require(_0x5b08('0x12'));var authService=require(_0x5b08('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5b08('0x14'));var hardwareService=require(_0x5b08('0x15'));var logger=require(_0x5b08('0x16'))(_0x5b08('0x17'));var utils=require(_0x5b08('0x18'));var config=require(_0x5b08('0x19'));var db=require('../../mysqldb')['db'];config[_0x5b08('0x1a')]=_['defaults'](config[_0x5b08('0x1a')],{'host':_0x5b08('0x1b'),'port':0x18eb});var socket=require(_0x5b08('0x1c'))(new Redis(config['redis']));require(_0x5b08('0x1d'))[_0x5b08('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b08('0x1f')][_0x5b08('0x20')]({'port':0x232c});var client9002=jayson[_0x5b08('0x1f')][_0x5b08('0x20')]({'port':0x232a});function checkPasswordPattern(_0x3fe5e4,_0x56cb35,_0x8ae616){if(_0x8ae616){var _0x282de2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x282de2[_0x5b08('0x21')](_0x56cb35)){return _0x3fe5e4;}else{throw new db[(_0x5b08('0x22'))][(_0x5b08('0x23'))](_0x5b08('0x24'));}}else{return _0x3fe5e4;}}function respondWithRpcPromise(_0x4bcc02,_0x382290,_0x27414b,_0x5e3cda){return new BPromise(function(_0x34b671,_0x5585c8){var _0x1e1df4=_0x5e3cda||client;return _0x1e1df4[_0x5b08('0x25')](_0x4bcc02,_0x27414b)[_0x5b08('0x26')](function(_0xa2a640){logger[_0x5b08('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x382290,_0x5b08('0x28'));logger['debug'](_0x5b08('0x29'),_0x382290,_0x5b08('0x28'),JSON[_0x5b08('0x2a')](_0xa2a640));if(_0xa2a640[_0x5b08('0x2b')]){if(_0xa2a640['error'][_0x5b08('0x2c')]===0x1f4){logger[_0x5b08('0x2b')](_0x5b08('0x2d'),_0x382290,_0xa2a640[_0x5b08('0x2b')]['message']);return _0x5585c8(_0xa2a640['error'][_0x5b08('0x2e')]);}logger[_0x5b08('0x2b')](_0x5b08('0x2d'),_0x382290,_0xa2a640[_0x5b08('0x2b')][_0x5b08('0x2e')]);return _0x34b671(_0xa2a640[_0x5b08('0x2b')][_0x5b08('0x2e')]);}else{logger[_0x5b08('0x27')](_0x5b08('0x2d'),_0x382290,'request\x20sent');_0x34b671(_0xa2a640['result'][_0x5b08('0x2e')]);}})['catch'](function(_0xdd9570){logger[_0x5b08('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x382290,_0xdd9570);_0x5585c8(_0xdd9570);});});}function respondWithStatusCode(_0x2c940d,_0x3ff1a7){_0x3ff1a7=_0x3ff1a7||0xcc;return function(_0x6e775e){if(_0x6e775e){return _0x2c940d['sendStatus'](_0x3ff1a7);}return _0x2c940d['status'](_0x3ff1a7)[_0x5b08('0x2f')]();};}function respondWithResult(_0x494780,_0x1c488d){_0x1c488d=_0x1c488d||0xc8;return function(_0xe2f1c6){if(_0xe2f1c6){return _0x494780['status'](_0x1c488d)['json'](_0xe2f1c6);}};}function respondWithFilteredResult(_0x563dd7,_0x427c07){return function(_0x534751){if(_0x534751){var _0x624c12=_0x534751['count'],_0x164030=_0x427c07[_0x5b08('0x30')],_0x35f614=_0x427c07[_0x5b08('0x30')]+_0x427c07[_0x5b08('0x31')],_0x3dce90;if(_0x35f614>=_0x624c12){_0x35f614=_0x624c12;_0x3dce90=0xc8;}else{_0x3dce90=0xce;}_0x563dd7[_0x5b08('0x32')](_0x3dce90);return _0x563dd7[_0x5b08('0x33')]('Content-Range',_0x164030+'-'+_0x35f614+'/'+_0x624c12)[_0x5b08('0x34')](_0x534751);}return null;};}function patchUpdates(_0x898785){return function(_0x1149c3){try{jsonpatch[_0x5b08('0x35')](_0x1149c3,_0x898785,!![]);}catch(_0x2cfd28){return BPromise[_0x5b08('0x36')](_0x2cfd28);}return _0x1149c3[_0x5b08('0x37')]();};}function saveUpdates(_0xb5fb09,_0x30758d){return function(_0xd19e40){if(_0xd19e40){return _0xd19e40[_0x5b08('0x38')](_0xb5fb09)[_0x5b08('0x26')](function(_0x16178a){return _0x16178a;});}return null;};}function removeEntity(_0x5c6477,_0x4a340e){return function(_0x241a5b){if(_0x241a5b){return _0x241a5b[_0x5b08('0x39')]()[_0x5b08('0x26')](function(){var _0x42cadd=_0x241a5b['get']({'plain':!![]});var _0x1bdec6=_0x5b08('0x3a');return db['UserProfileResource'][_0x5b08('0x39')]({'where':{'type':_0x1bdec6,'resourceId':_0x42cadd['id']}})[_0x5b08('0x26')](function(){return _0x241a5b;});})[_0x5b08('0x26')](function(){_0x5c6477[_0x5b08('0x32')](0xcc)[_0x5b08('0x2f')]();});}};}function handleEntityNotFound(_0x59287f,_0x32b544){return function(_0x2fceac){if(!_0x2fceac){_0x59287f[_0x5b08('0x3b')](0x194);}return _0x2fceac;};}function handleError(_0x30d9bb,_0x5ed410){_0x5ed410=_0x5ed410||0x1f4;return function(_0x1e3fa4){logger[_0x5b08('0x2b')](_0x1e3fa4[_0x5b08('0x3c')]);if(_0x1e3fa4['name']){delete _0x1e3fa4[_0x5b08('0x3d')];}_0x30d9bb[_0x5b08('0x32')](_0x5ed410)[_0x5b08('0x3e')](_0x1e3fa4);};}exports[_0x5b08('0x3f')]=function(_0x5f1baa,_0x8fa51f){var _0x2e4a4f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x10b9fe={},_0xde5678={'count':0x0,'rows':[]};var _0x2f030b=_[_0x5b08('0x40')](db[_0x5b08('0x41')][_0x5b08('0x42')],function(_0x40915a){return{'name':_0x40915a[_0x5b08('0x43')],'type':_0x40915a[_0x5b08('0x44')][_0x5b08('0x45')]};});_0x10b9fe['model']=_['map'](_0x2f030b,_0x5b08('0x3d'));_0x10b9fe['query']=_[_0x5b08('0x46')](_0x5f1baa[_0x5b08('0x47')]);_0x10b9fe['filters']=_[_0x5b08('0x48')](_0x10b9fe[_0x5b08('0x49')],_0x10b9fe[_0x5b08('0x47')]);_0x2e4a4f[_0x5b08('0x4a')]=_[_0x5b08('0x48')](_0x10b9fe[_0x5b08('0x49')],qs[_0x5b08('0x4b')](_0x5f1baa['query'][_0x5b08('0x4b')]));_0x2e4a4f[_0x5b08('0x4a')]=_0x2e4a4f[_0x5b08('0x4a')][_0x5b08('0x4c')]?_0x2e4a4f[_0x5b08('0x4a')]:_0x10b9fe[_0x5b08('0x49')];if(!_0x5f1baa[_0x5b08('0x47')][_0x5b08('0x4d')](_0x5b08('0x4e'))){_0x2e4a4f[_0x5b08('0x31')]=qs['limit'](_0x5f1baa[_0x5b08('0x47')]['limit']);_0x2e4a4f['offset']=qs[_0x5b08('0x30')](_0x5f1baa[_0x5b08('0x47')][_0x5b08('0x30')]);}_0x2e4a4f[_0x5b08('0x4f')]=qs['sort'](_0x5f1baa['query'][_0x5b08('0x50')]);_0x2e4a4f[_0x5b08('0x51')]=qs[_0x5b08('0x52')](_['pick'](_0x5f1baa[_0x5b08('0x47')],_0x10b9fe[_0x5b08('0x52')]),_0x2f030b);if(_0x5f1baa[_0x5b08('0x47')][_0x5b08('0x53')]){_0x2e4a4f[_0x5b08('0x51')]=_[_0x5b08('0x54')](_0x2e4a4f[_0x5b08('0x51')],{'$or':_[_0x5b08('0x40')](_0x2f030b,function(_0x170ed2){if(_0x170ed2[_0x5b08('0x44')]!==_0x5b08('0x55')){var _0x4b3484={};_0x4b3484[_0x170ed2['name']]={'$like':'%'+_0x5f1baa[_0x5b08('0x47')][_0x5b08('0x53')]+'%'};return _0x4b3484;}})});}_0x2e4a4f=_[_0x5b08('0x54')]({},_0x2e4a4f,_0x5f1baa['options']);var _0x34e765={'where':_0x2e4a4f[_0x5b08('0x51')]};return db[_0x5b08('0x41')]['count'](_0x34e765)[_0x5b08('0x26')](function(_0x3a9457){_0xde5678['count']=_0x3a9457;if(_0x5f1baa[_0x5b08('0x47')]['includeAll']){_0x2e4a4f['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x5b08('0x56')](_0x2e4a4f);})['then'](function(_0x293adb){_0xde5678[_0x5b08('0x57')]=_0x293adb;return _0xde5678;})[_0x5b08('0x26')](respondWithFilteredResult(_0x8fa51f,_0x2e4a4f))['catch'](handleError(_0x8fa51f,null));};exports[_0x5b08('0x58')]=function(_0x482463,_0x27e7ab){var _0x3df76a={'raw':![],'where':{'id':_0x482463[_0x5b08('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xe7b0f1={};_0xe7b0f1[_0x5b08('0x49')]=_[_0x5b08('0x46')](db['OpenchannelAccount'][_0x5b08('0x42')]);_0xe7b0f1['query']=_[_0x5b08('0x46')](_0x482463[_0x5b08('0x47')]);_0xe7b0f1[_0x5b08('0x52')]=_['intersection'](_0xe7b0f1[_0x5b08('0x49')],_0xe7b0f1[_0x5b08('0x47')]);_0x3df76a[_0x5b08('0x4a')]=_[_0x5b08('0x48')](_0xe7b0f1[_0x5b08('0x49')],qs[_0x5b08('0x4b')](_0x482463['query'][_0x5b08('0x4b')]));_0x3df76a[_0x5b08('0x4a')]=_0x3df76a[_0x5b08('0x4a')][_0x5b08('0x4c')]?_0x3df76a['attributes']:_0xe7b0f1['model'];if(_0x482463['query']['includeAll']){_0x3df76a[_0x5b08('0x5a')]=[{'all':!![]}];}_0x3df76a=_[_0x5b08('0x54')]({},_0x3df76a,_0x482463[_0x5b08('0x5b')]);return db['OpenchannelAccount'][_0x5b08('0x5c')](_0x3df76a)[_0x5b08('0x26')](handleEntityNotFound(_0x27e7ab,null))[_0x5b08('0x26')](respondWithResult(_0x27e7ab,null))['catch'](handleError(_0x27e7ab,null));};exports['create']=function(_0x5a2ca7,_0x26d281){return db[_0x5b08('0x41')][_0x5b08('0x5d')](_0x5a2ca7[_0x5b08('0x5e')],{})[_0x5b08('0x26')](function(_0x427939){var _0x2e824a=_0x5a2ca7[_0x5b08('0x5f')][_0x5b08('0x60')]({'plain':!![]});if(!_0x2e824a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e824a[_0x5b08('0x61')]===_0x5b08('0x5f')){var _0x1168ba=_0x427939[_0x5b08('0x60')]({'plain':!![]});var _0xc961d2=_0x5b08('0x3a');return db[_0x5b08('0x62')][_0x5b08('0x5c')]({'where':{'name':_0xc961d2,'userProfileId':_0x2e824a[_0x5b08('0x63')]},'raw':!![]})[_0x5b08('0x26')](function(_0x59fec0){if(_0x59fec0&&_0x59fec0[_0x5b08('0x64')]===0x0){return db[_0x5b08('0x65')][_0x5b08('0x5d')]({'name':_0x1168ba[_0x5b08('0x3d')],'resourceId':_0x1168ba['id'],'type':_0x59fec0[_0x5b08('0x3d')],'sectionId':_0x59fec0['id']},{})[_0x5b08('0x26')](function(){return _0x427939;});}else{return _0x427939;}})[_0x5b08('0x66')](function(_0x56b991){logger[_0x5b08('0x2b')](_0x5b08('0x67'),_0x56b991);throw _0x56b991;});}return _0x427939;})[_0x5b08('0x26')](respondWithResult(_0x26d281,0xc9))[_0x5b08('0x66')](handleError(_0x26d281,null));};exports[_0x5b08('0x38')]=function(_0x597238,_0x450157){if(_0x597238[_0x5b08('0x5e')]['id']){delete _0x597238['body']['id'];}return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0x597238[_0x5b08('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x5b08('0x68')}]})['then'](handleEntityNotFound(_0x450157,null))[_0x5b08('0x26')](saveUpdates(_0x597238[_0x5b08('0x5e')],null))['then'](respondWithResult(_0x450157,null))[_0x5b08('0x66')](handleError(_0x450157,null));};exports[_0x5b08('0x39')]=function(_0x3d8d74,_0x401fee){return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0x3d8d74[_0x5b08('0x59')]['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x401fee,null))['then'](removeEntity(_0x401fee,null))[_0x5b08('0x66')](handleError(_0x401fee,null));};exports[_0x5b08('0x69')]=function(_0x337409,_0x2cb5f0){return db[_0x5b08('0x41')]['describe']()[_0x5b08('0x26')](respondWithResult(_0x2cb5f0,null))['catch'](handleError(_0x2cb5f0,null));};exports[_0x5b08('0x6a')]=function(_0x1d7ae3,_0x1b1297,_0x3e87e3){if(_0x1d7ae3['body']['id']){delete _0x1d7ae3[_0x5b08('0x5e')]['id'];}return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0x1d7ae3['params']['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x1b1297,null))['then'](function(_0x5abb1c){if(_0x5abb1c){_0x1d7ae3['body'][_0x5b08('0x6b')]=_0x5abb1c['id'];return db[_0x5b08('0x6c')]['create'](_0x1d7ae3[_0x5b08('0x5e')]);}})[_0x5b08('0x26')](respondWithResult(_0x1b1297,null))[_0x5b08('0x66')](handleError(_0x1b1297,null));};exports['getDispositions']=function(_0x40a018,_0x1ed408,_0x1cab4d){var _0x3739ee={'raw':![],'where':{}};var _0x150bd9={};var _0xf21436={'count':0x0,'rows':[]};return db[_0x5b08('0x41')][_0x5b08('0x6d')]({'where':{'id':_0x40a018[_0x5b08('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ed408,null))['then'](function(_0x14f7c0){if(_0x14f7c0){_0x150bd9[_0x5b08('0x49')]=_['keys'](db[_0x5b08('0x6c')][_0x5b08('0x42')]);_0x150bd9[_0x5b08('0x47')]=_['keys'](_0x40a018[_0x5b08('0x47')]);_0x150bd9[_0x5b08('0x52')]=_[_0x5b08('0x48')](_0x150bd9[_0x5b08('0x49')],_0x150bd9[_0x5b08('0x47')]);_0x3739ee['attributes']=_[_0x5b08('0x48')](_0x150bd9[_0x5b08('0x49')],qs['fields'](_0x40a018[_0x5b08('0x47')][_0x5b08('0x4b')]));_0x3739ee[_0x5b08('0x4a')]=_0x3739ee[_0x5b08('0x4a')][_0x5b08('0x4c')]?_0x3739ee[_0x5b08('0x4a')]:_0x150bd9[_0x5b08('0x49')];if(!_0x40a018[_0x5b08('0x47')][_0x5b08('0x4d')](_0x5b08('0x4e'))){_0x3739ee[_0x5b08('0x31')]=qs[_0x5b08('0x31')](_0x40a018[_0x5b08('0x47')][_0x5b08('0x31')]);_0x3739ee[_0x5b08('0x30')]=qs[_0x5b08('0x30')](_0x40a018[_0x5b08('0x47')][_0x5b08('0x30')]);}_0x3739ee[_0x5b08('0x4f')]=qs['sort'](_0x40a018[_0x5b08('0x47')][_0x5b08('0x50')]);_0x3739ee[_0x5b08('0x51')]=qs[_0x5b08('0x52')](_[_0x5b08('0x6e')](_0x40a018[_0x5b08('0x47')],_0x150bd9[_0x5b08('0x52')]));_0x3739ee[_0x5b08('0x51')][_0x5b08('0x6f')]=_0x14f7c0['id'];if(_0x40a018[_0x5b08('0x47')][_0x5b08('0x53')]){_0x3739ee['where']=_[_0x5b08('0x54')](_0x3739ee[_0x5b08('0x51')],{'$or':_[_0x5b08('0x40')](_0x3739ee[_0x5b08('0x4a')],function(_0x5d0575){var _0xa696ad={};_0xa696ad[_0x5d0575]={'$like':'%'+_0x40a018[_0x5b08('0x47')][_0x5b08('0x53')]+'%'};return _0xa696ad;})});}_0x3739ee=_['merge']({},_0x3739ee,_0x40a018['options']);return db[_0x5b08('0x6c')][_0x5b08('0x70')]({'where':_0x3739ee[_0x5b08('0x51')]})[_0x5b08('0x26')](function(_0x806a67){_0xf21436[_0x5b08('0x70')]=_0x806a67;if(_0x40a018[_0x5b08('0x47')][_0x5b08('0x71')]){_0x3739ee['include']=[{'all':!![]}];}return db['Disposition'][_0x5b08('0x56')](_0x3739ee);})[_0x5b08('0x26')](function(_0x3fbde6){_0xf21436[_0x5b08('0x57')]=_0x3fbde6;return _0xf21436;});}})[_0x5b08('0x26')](respondWithFilteredResult(_0x1ed408,_0x3739ee))[_0x5b08('0x66')](handleError(_0x1ed408,null));};exports[_0x5b08('0x72')]=function(_0x1855b8,_0x537b0d,_0x5a85e3){return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0x1855b8['params']['id']}})['then'](handleEntityNotFound(_0x537b0d,null))[_0x5b08('0x26')](function(_0x2df515){if(_0x2df515){return _0x2df515[_0x5b08('0x72')](_0x1855b8[_0x5b08('0x47')][_0x5b08('0x73')]);}})[_0x5b08('0x26')](respondWithStatusCode(_0x537b0d,null))['catch'](handleError(_0x537b0d,null));};exports[_0x5b08('0x74')]=function(_0x2bfb74,_0x5bea13,_0x18d817){if(_0x2bfb74['body']['id']){delete _0x2bfb74['body']['id'];}return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0x2bfb74[_0x5b08('0x59')]['id']}})['then'](handleEntityNotFound(_0x5bea13,null))[_0x5b08('0x26')](function(_0x98c050){if(_0x98c050){_0x2bfb74[_0x5b08('0x5e')][_0x5b08('0x6f')]=_0x98c050['id'];return db['CannedAnswer']['create'](_0x2bfb74[_0x5b08('0x5e')]);}})[_0x5b08('0x26')](respondWithResult(_0x5bea13,null))[_0x5b08('0x66')](handleError(_0x5bea13,null));};exports[_0x5b08('0x75')]=function(_0x22a9e5,_0x2301ab,_0x54d333){var _0x3031a0={'raw':![],'where':{}};var _0x401591={};var _0xd7efd5={'count':0x0,'rows':[]};return db[_0x5b08('0x41')][_0x5b08('0x6d')]({'where':{'id':_0x22a9e5['params']['id']}})['then'](handleEntityNotFound(_0x2301ab,null))[_0x5b08('0x26')](function(_0x341b26){if(_0x341b26){_0x401591[_0x5b08('0x49')]=_['keys'](db['CannedAnswer'][_0x5b08('0x42')]);_0x401591[_0x5b08('0x47')]=_[_0x5b08('0x46')](_0x22a9e5[_0x5b08('0x47')]);_0x401591[_0x5b08('0x52')]=_[_0x5b08('0x48')](_0x401591[_0x5b08('0x49')],_0x401591[_0x5b08('0x47')]);_0x3031a0['attributes']=_[_0x5b08('0x48')](_0x401591[_0x5b08('0x49')],qs[_0x5b08('0x4b')](_0x22a9e5[_0x5b08('0x47')]['fields']));_0x3031a0[_0x5b08('0x4a')]=_0x3031a0[_0x5b08('0x4a')]['length']?_0x3031a0['attributes']:_0x401591[_0x5b08('0x49')];if(!_0x22a9e5[_0x5b08('0x47')][_0x5b08('0x4d')](_0x5b08('0x4e'))){_0x3031a0[_0x5b08('0x31')]=qs['limit'](_0x22a9e5['query'][_0x5b08('0x31')]);_0x3031a0[_0x5b08('0x30')]=qs['offset'](_0x22a9e5[_0x5b08('0x47')][_0x5b08('0x30')]);}_0x3031a0['order']=qs[_0x5b08('0x50')](_0x22a9e5[_0x5b08('0x47')]['sort']);_0x3031a0[_0x5b08('0x51')]=qs['filters'](_[_0x5b08('0x6e')](_0x22a9e5[_0x5b08('0x47')],_0x401591[_0x5b08('0x52')]));_0x3031a0[_0x5b08('0x51')][_0x5b08('0x6f')]=_0x341b26['id'];if(_0x22a9e5[_0x5b08('0x47')][_0x5b08('0x53')]){_0x3031a0['where']=_[_0x5b08('0x54')](_0x3031a0[_0x5b08('0x51')],{'$or':_[_0x5b08('0x40')](_0x3031a0[_0x5b08('0x4a')],function(_0x1eb105){var _0x30faff={};_0x30faff[_0x1eb105]={'$like':'%'+_0x22a9e5[_0x5b08('0x47')][_0x5b08('0x53')]+'%'};return _0x30faff;})});}_0x3031a0=_[_0x5b08('0x54')]({},_0x3031a0,_0x22a9e5[_0x5b08('0x5b')]);return db['CannedAnswer'][_0x5b08('0x70')]({'where':_0x3031a0[_0x5b08('0x51')]})['then'](function(_0x2504f0){_0xd7efd5[_0x5b08('0x70')]=_0x2504f0;if(_0x22a9e5[_0x5b08('0x47')][_0x5b08('0x71')]){_0x3031a0[_0x5b08('0x5a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3031a0);})[_0x5b08('0x26')](function(_0xd394c2){_0xd7efd5['rows']=_0xd394c2;return _0xd7efd5;});}})[_0x5b08('0x26')](respondWithFilteredResult(_0x2301ab,_0x3031a0))['catch'](handleError(_0x2301ab,null));};exports['removeAnswers']=function(_0xe93b8e,_0x144f57,_0x3a1117){return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0xe93b8e[_0x5b08('0x59')]['id']}})['then'](handleEntityNotFound(_0x144f57,null))[_0x5b08('0x26')](function(_0x155fc0){if(_0x155fc0){return _0x155fc0['removeAnswers'](_0xe93b8e[_0x5b08('0x47')][_0x5b08('0x73')]);}})[_0x5b08('0x26')](respondWithStatusCode(_0x144f57,null))['catch'](handleError(_0x144f57,null));};exports[_0x5b08('0x76')]=function(_0x1c6c15,_0x2962db,_0xdd35f1){var _0x3cc80e={'body':_0x1c6c15[_0x5b08('0x5e')],'channel':_0x5b08('0x77')};var _0x51546a=[];var _0xe574e=[];var _0xc562c0={};var _0x9d6ae3=![];return db['CmContact'][_0x5b08('0x69')]()['then'](function(_0x120a97){if(!_0x120a97){throw new db['Sequelize'][(_0x5b08('0x23'))](_0x5b08('0x78'));}_0x51546a=_['difference'](_[_0x5b08('0x46')](_0x120a97),[_0x5b08('0x79'),_0x5b08('0x7a')]);_0xe574e=_[_0x5b08('0x7b')](_[_0x5b08('0x46')](_0x120a97),[_0x5b08('0x79'),_0x5b08('0x7a'),_0x5b08('0x7c'),_0x5b08('0x7d')]);if(_0x1c6c15['body']['id']){delete _0x1c6c15['body']['id'];}if(_[_0x5b08('0x7e')](_0x1c6c15[_0x5b08('0x5e')]['from'])){throw new db[(_0x5b08('0x22'))]['ValidationError'](_0x5b08('0x7f'));}if(_[_0x5b08('0x7e')](_0x1c6c15['body']['body'])||_0x1c6c15['body'][_0x5b08('0x5e')]===''){throw new db[(_0x5b08('0x22'))][(_0x5b08('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5b08('0x7e')](_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x80')])){throw new db[(_0x5b08('0x22'))]['ValidationError'](_0x5b08('0x81')+_0xe574e);}if(!_[_0x5b08('0x82')](_0xe574e,_0x1c6c15['body'][_0x5b08('0x80')])){throw new db[(_0x5b08('0x22'))][(_0x5b08('0x23'))](_0x5b08('0x83')+_0xe574e);}_0xc562c0[_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x80')]]=_0x1c6c15['body'][_0x5b08('0x84')];})['then'](function(){return db['OpenchannelAccount'][_0x5b08('0x5c')]({'where':{'id':_0x1c6c15['params']['id']},'include':[{'model':db[_0x5b08('0x85')],'as':_0x5b08('0x86'),'include':[{'model':db[_0x5b08('0x87')],'as':'Contacts','where':_0xc562c0,'limit':0x1,'order':[[_0x5b08('0x7a'),_0x5b08('0x88')]]}]},{'model':db[_0x5b08('0x89')],'as':'Applications'}]});})[_0x5b08('0x26')](handleEntityNotFound(_0x2962db,null))['then'](function(_0x2e0d81){if(_0x2e0d81&&_0x2e0d81[_0x5b08('0x86')]){_0x3cc80e[_0x5b08('0x8a')]=_0x2e0d81;_0x3cc80e[_0x5b08('0x8b')]=_0x2e0d81['Applications'];_0x3cc80e['list']=_0x2e0d81[_0x5b08('0x86')];_0x3cc80e[_0x5b08('0x8b')]=_['orderBy'](_0x3cc80e[_0x5b08('0x8b')],['priority'],[_0x5b08('0x8c')]);if(_0x3cc80e[_0x5b08('0x8a')][_0x5b08('0x8d')]){delete _0x3cc80e[_0x5b08('0x8a')][_0x5b08('0x8d')];}if(_0x3cc80e[_0x5b08('0x8a')][_0x5b08('0x86')]&&_0x3cc80e['account'][_0x5b08('0x86')][_0x5b08('0x8e')][_0x5b08('0x4c')]){return _0x3cc80e[_0x5b08('0x8a')][_0x5b08('0x86')][_0x5b08('0x8e')][0x0];}var _0x44e8d1=_[_0x5b08('0x8f')](_0x1c6c15['body'],{'firstName':_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x84')],'ListId':_0x2e0d81[_0x5b08('0x7d')]});_0x44e8d1[_0x1c6c15['body']['mapKey']]=_0x1c6c15['body']['from'];return db[_0x5b08('0x87')]['create'](_0x44e8d1,{'fields':_0x51546a,'raw':!![]});}})['then'](handleEntityNotFound(_0x2962db,null))[_0x5b08('0x26')](function(_0xaa1ef6){_0x3cc80e[_0x5b08('0x90')]=_0xaa1ef6;if(_0xaa1ef6){var _0x537e3c={'ContactId':_0xaa1ef6['id'],'OpenchannelAccountId':_0x1c6c15['params']['id'],'from':(_0xaa1ef6['firstName']||'')+'\x20'+(_0xaa1ef6[_0x5b08('0x91')]||'')};var _0x1069d9={'OpenchannelAccountId':_0x1c6c15[_0x5b08('0x59')]['id'],'closed':![]};if(_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x92')]){_0x1069d9[_0x5b08('0x92')]=_0x1c6c15['body'][_0x5b08('0x92')];return db['OpenchannelInteraction'][_0x5b08('0x5c')]({'where':_0x1069d9})[_0x5b08('0x26')](function(_0x3fd909){if(_0x3fd909){return[_0x3fd909,![]];}_0x537e3c[_0x5b08('0x92')]=_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x92')];_0x537e3c['externalUrl']=_0x1c6c15['body']['externalUrl'];return db['OpenchannelInteraction']['create'](_0x537e3c)[_0x5b08('0x26')](function(_0x31e9a6){return[_0x31e9a6,!![]];});});}else{_0x1069d9['threadId']=null;}_0x1069d9['ContactId']=_0xaa1ef6['id'];return db[_0x5b08('0x93')][_0x5b08('0x5c')]({'where':_0x1069d9})[_0x5b08('0x26')](function(_0x113fbc){if(_0x113fbc){return[_0x113fbc,![]];}return db[_0x5b08('0x93')]['create'](_0x537e3c)['then'](function(_0x3db06f){return[_0x3db06f,!![]];});});}})[_0x5b08('0x94')](function(_0x2b482a,_0xc04bbd){if(_0x2b482a){_0x9d6ae3=_0xc04bbd;if(!_0xc04bbd){var _0x413780={'from':(_0x3cc80e[_0x5b08('0x90')][_0x5b08('0x95')]||'')+'\x20'+(_0x3cc80e['contact'][_0x5b08('0x91')]||'')};if(_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x92')]&&_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x96')]&&_0x1c6c15['body'][_0x5b08('0x92')]!=_0x1c6c15['body']['messageId']){_0x413780[_0x5b08('0x92')]=_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x96')];}return _0x2b482a[_0x5b08('0x38')](_0x413780);}else{return _0x2b482a;}}})[_0x5b08('0x26')](function(_0x5719d4){_0x3cc80e[_0x5b08('0x97')]=_0x5719d4[_0x5b08('0x60')]({'plain':!![]});_0x3cc80e[_0x5b08('0x97')]['created']=_0x9d6ae3;if(_0x3cc80e[_0x5b08('0x97')][_0x5b08('0x98')]){if(_0x3cc80e[_0x5b08('0x8a')][_0x5b08('0x99')]){_0x3cc80e[_0x5b08('0x8b')]['push']({'id':0x0,'priority':_0x3cc80e['applications']['length']+0x1,'app':_0x5b08('0x9a'),'appdata':_0x5b08('0x9b'),'interval':_0x5b08('0x9c')});}}return db[_0x5b08('0x9d')][_0x5b08('0x5d')]({'body':_0x1c6c15['body'][_0x5b08('0x5e')],'OpenchannelAccountId':_0x1c6c15['params']['id'],'OpenchannelInteractionId':_0x5719d4['id'],'direction':'in','ContactId':_0x3cc80e[_0x5b08('0x90')]['id'],'AttachmentId':_0x1c6c15[_0x5b08('0x5e')][_0x5b08('0x9e')]});})[_0x5b08('0x26')](function(_0x64d54a){_0x3cc80e['message']=_0x64d54a;if(_0x3cc80e[_0x5b08('0x97')][_0x5b08('0x9f')]){return db[_0x5b08('0xa0')]['find']({'attributes':['id','name'],'where':{'id':_0x3cc80e['interaction'][_0x5b08('0x9f')]}})[_0x5b08('0x26')](function(_0x7fd9e9){if(_0x7fd9e9){_0x3cc80e[_0x5b08('0x8b')][_0x5b08('0xa1')]({'id':0x0,'priority':0x0,'app':_0x5b08('0xa2'),'appdata':_0x7fd9e9['name']+','+(_0x3cc80e[_0x5b08('0x8a')][_0x5b08('0xa3')]||0xa),'interval':_0x5b08('0x9c')});_0x3cc80e[_0x5b08('0xa4')]=![];}return respondWithRpcPromise(_0x5b08('0xa5'),_0x5b08('0xa6'),_0x3cc80e);});}return respondWithRpcPromise(_0x5b08('0xa5'),'startRouting',_0x3cc80e);})[_0x5b08('0x26')](function(_0x235509){respondWithRpcPromise(_0x5b08('0xa7'),_0x5b08('0xa7'),{'event':_0x5b08('0x76'),'message':_0x235509},client9002);return _0x235509;})[_0x5b08('0x26')](respondWithResult(_0x2962db,null))[_0x5b08('0x66')](handleError(_0x2962db,null));};exports[_0x5b08('0xa8')]=function(_0x27afe2,_0x306412,_0x427a18){return db['OpenchannelAccount'][_0x5b08('0x6d')]({'where':{'id':_0x27afe2['params']['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x306412,null))[_0x5b08('0x26')](function(_0x16570a){if(_0x16570a){return db['sequelize'][_0x5b08('0xa9')](function(_0x5d074c){return db[_0x5b08('0x89')][_0x5b08('0x39')]({'where':{'OpenchannelAccountId':_0x27afe2['params']['id']},'transaction':_0x5d074c})[_0x5b08('0x26')](function(_0xd0353b){var _0x345bda=_[_0x5b08('0x40')](_0x27afe2[_0x5b08('0x5e')],function(_0x22774d){_0x22774d[_0x5b08('0x6f')]=_0x27afe2[_0x5b08('0x59')]['id'];return _0x22774d;});return db[_0x5b08('0x89')][_0x5b08('0xaa')](_0x345bda,{'transaction':_0x5d074c});});})[_0x5b08('0x26')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x27afe2[_0x5b08('0x59')]['id']},'order':_0x5b08('0xab')});});}})['then'](respondWithResult(_0x306412,null))['catch'](handleError(_0x306412,null));};exports[_0x5b08('0xac')]=function(_0x84c554,_0x5c68c8,_0x268277){var _0x46797a={};var _0x1e29fc={};var _0x48483e;var _0x48fe3d;return db['OpenchannelAccount'][_0x5b08('0x6d')]({'where':{'id':_0x84c554['params']['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x5c68c8,null))[_0x5b08('0x26')](function(_0x5c4b2f){if(_0x5c4b2f){_0x48483e=_0x5c4b2f;_0x1e29fc[_0x5b08('0x49')]=_[_0x5b08('0x46')](db[_0x5b08('0x89')][_0x5b08('0x42')]);_0x1e29fc[_0x5b08('0x47')]=_[_0x5b08('0x46')](_0x84c554[_0x5b08('0x47')]);_0x1e29fc[_0x5b08('0x52')]=_[_0x5b08('0x48')](_0x1e29fc[_0x5b08('0x49')],_0x1e29fc[_0x5b08('0x47')]);_0x46797a[_0x5b08('0x4a')]=_[_0x5b08('0x48')](_0x1e29fc['model'],qs[_0x5b08('0x4b')](_0x84c554[_0x5b08('0x47')][_0x5b08('0x4b')]));_0x46797a[_0x5b08('0x4a')]=_0x46797a[_0x5b08('0x4a')]['length']?_0x46797a[_0x5b08('0x4a')]:_0x1e29fc[_0x5b08('0x49')];_0x46797a[_0x5b08('0x4f')]=qs[_0x5b08('0x50')](_0x84c554['query'][_0x5b08('0x50')]);_0x46797a[_0x5b08('0x51')]=qs[_0x5b08('0x52')](_[_0x5b08('0x6e')](_0x84c554[_0x5b08('0x47')],_0x1e29fc[_0x5b08('0x52')]));if(_0x84c554[_0x5b08('0x47')]['filter']){_0x46797a[_0x5b08('0x51')]=_['merge'](_0x46797a[_0x5b08('0x51')],{'$or':_[_0x5b08('0x40')](_0x46797a[_0x5b08('0x4a')],function(_0x587298){var _0x36a71a={};_0x36a71a[_0x587298]={'$like':'%'+_0x84c554[_0x5b08('0x47')][_0x5b08('0x53')]+'%'};return _0x36a71a;})});}_0x46797a=_['merge']({},_0x46797a,_0x84c554[_0x5b08('0x5b')]);return _0x48483e[_0x5b08('0xac')](_0x46797a);}})[_0x5b08('0x26')](function(_0x3118f4){if(_0x3118f4){_0x48fe3d=_0x3118f4[_0x5b08('0x4c')];if(!_0x84c554[_0x5b08('0x47')][_0x5b08('0x4d')](_0x5b08('0x4e'))){_0x46797a['limit']=qs[_0x5b08('0x31')](_0x84c554['query'][_0x5b08('0x31')]);_0x46797a[_0x5b08('0x30')]=qs[_0x5b08('0x30')](_0x84c554['query']['offset']);}return _0x48483e['getApplications'](_0x46797a);}})[_0x5b08('0x26')](function(_0xb5a5be){if(_0xb5a5be){return _0xb5a5be?{'count':_0x48fe3d,'rows':_0xb5a5be}:null;}})[_0x5b08('0x26')](respondWithResult(_0x5c68c8,null))[_0x5b08('0x66')](handleError(_0x5c68c8,null));};exports[_0x5b08('0xad')]=function(_0x47fdd4,_0x1dad59,_0x41ce5b){var _0x4e4cc9={'raw':![],'where':{}};var _0x3b9c15={};var _0x22892e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5b08('0x6d')]({'where':{'id':_0x47fdd4[_0x5b08('0x59')]['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x1dad59,null))[_0x5b08('0x26')](function(_0x282b06){if(_0x282b06){_0x3b9c15['model']=_[_0x5b08('0x46')](db[_0x5b08('0x93')][_0x5b08('0x42')]);_0x3b9c15[_0x5b08('0x47')]=_[_0x5b08('0x46')](_0x47fdd4[_0x5b08('0x47')]);_0x3b9c15[_0x5b08('0x52')]=_[_0x5b08('0x48')](_0x3b9c15[_0x5b08('0x49')],_0x3b9c15['query']);_0x4e4cc9[_0x5b08('0x4a')]=_[_0x5b08('0x48')](_0x3b9c15[_0x5b08('0x49')],qs['fields'](_0x47fdd4[_0x5b08('0x47')][_0x5b08('0x4b')]));_0x4e4cc9['attributes']=_0x4e4cc9[_0x5b08('0x4a')][_0x5b08('0x4c')]?_0x4e4cc9['attributes']:_0x3b9c15[_0x5b08('0x49')];if(!_0x47fdd4[_0x5b08('0x47')]['hasOwnProperty']('nolimit')){_0x4e4cc9[_0x5b08('0x31')]=qs['limit'](_0x47fdd4[_0x5b08('0x47')][_0x5b08('0x31')]);_0x4e4cc9['offset']=qs['offset'](_0x47fdd4[_0x5b08('0x47')][_0x5b08('0x30')]);}_0x4e4cc9['order']=qs[_0x5b08('0x50')](_0x47fdd4[_0x5b08('0x47')][_0x5b08('0x50')]);_0x4e4cc9[_0x5b08('0x51')]=qs[_0x5b08('0x52')](_[_0x5b08('0x6e')](_0x47fdd4[_0x5b08('0x47')],_0x3b9c15[_0x5b08('0x52')]));_0x4e4cc9['where'][_0x5b08('0x6f')]=_0x282b06['id'];if(_0x47fdd4[_0x5b08('0x47')][_0x5b08('0x53')]){_0x4e4cc9[_0x5b08('0x51')]=_['merge'](_0x4e4cc9[_0x5b08('0x51')],{'$or':_['map'](_0x4e4cc9['attributes'],function(_0x81f4a0){var _0x145f3f={};_0x145f3f[_0x81f4a0]={'$like':'%'+_0x47fdd4['query'][_0x5b08('0x53')]+'%'};return _0x145f3f;})});}_0x4e4cc9=_[_0x5b08('0x54')]({},_0x4e4cc9,_0x47fdd4[_0x5b08('0x5b')]);return db[_0x5b08('0x93')][_0x5b08('0x70')]({'where':_0x4e4cc9[_0x5b08('0x51')]})[_0x5b08('0x26')](function(_0x4d3038){_0x22892e[_0x5b08('0x70')]=_0x4d3038;if(_0x47fdd4[_0x5b08('0x47')][_0x5b08('0x71')]){_0x4e4cc9[_0x5b08('0x5a')]=[{'model':db[_0x5b08('0x87')],'as':_0x5b08('0xae'),'required':![]},{'model':db['User'],'as':_0x5b08('0xaf'),'attributes':[_0x5b08('0x3d'),_0x5b08('0xb0'),_0x5b08('0xb1')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x47fdd4[_0x5b08('0x47')][_0x5b08('0xb2')]?{'id':_0x47fdd4['query'][_0x5b08('0xb2')]}:undefined,'required':_0x47fdd4[_0x5b08('0x47')]['tag']?!![]:![]}];}return db[_0x5b08('0x93')][_0x5b08('0x56')](_0x4e4cc9);})['then'](function(_0x28fa19){_0x22892e[_0x5b08('0x57')]=_0x28fa19;return _0x22892e;});}})[_0x5b08('0x26')](respondWithFilteredResult(_0x1dad59,_0x4e4cc9))['catch'](handleError(_0x1dad59,null));};exports[_0x5b08('0xb3')]=function(_0x418dcb,_0x47e338,_0x195e1b){return db[_0x5b08('0x41')]['find']({'where':{'id':_0x418dcb[_0x5b08('0x59')]['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x47e338,null))['then'](function(_0xacd202){if(_0xacd202){return _0xacd202[_0x5b08('0xb3')](_0x418dcb[_0x5b08('0x5e')][_0x5b08('0x73')],_['omit'](_0x418dcb[_0x5b08('0x5e')],['ids','id'])||{})[_0x5b08('0x94')](function(_0x1d8f01){for(var _0x432f7a=0x0;_0x432f7a<_0x418dcb['body'][_0x5b08('0x73')][_0x5b08('0x4c')];_0x432f7a+=0x1){socket[_0x5b08('0xb4')]('userOpenchannelAccount:save',{'UserId':_0x418dcb[_0x5b08('0x5e')][_0x5b08('0x73')][_0x432f7a],'OpenchannelAccountId':_0x418dcb[_0x5b08('0x59')]['id']});}return _0x1d8f01;});}})[_0x5b08('0x26')](respondWithResult(_0x47e338,null))['catch'](handleError(_0x47e338,null));};exports[_0x5b08('0xb5')]=function(_0x10a774,_0x27baf7,_0x141aad){return db['OpenchannelAccount'][_0x5b08('0x5c')]({'where':{'id':_0x10a774[_0x5b08('0x59')]['id']}})['then'](handleEntityNotFound(_0x27baf7,null))[_0x5b08('0x26')](function(_0x6c0810){if(_0x6c0810){return _0x6c0810['removeAgents'](_0x10a774[_0x5b08('0x47')][_0x5b08('0x73')])[_0x5b08('0x26')](function(){if(_[_0x5b08('0xb6')](_0x10a774[_0x5b08('0x47')]['ids'])){for(var _0x156c18=0x0;_0x156c18<_0x10a774[_0x5b08('0x47')][_0x5b08('0x73')][_0x5b08('0x4c')];_0x156c18+=0x1){socket['emit'](_0x5b08('0xb7'),{'UserId':Number(_0x10a774[_0x5b08('0x47')]['ids'][_0x156c18]),'OpenchannelAccountId':Number(_0x10a774[_0x5b08('0x59')]['id'])});}}else{socket[_0x5b08('0xb4')](_0x5b08('0xb7'),{'UserId':Number(_0x10a774[_0x5b08('0x47')][_0x5b08('0x73')]),'OpenchannelAccountId':Number(_0x10a774[_0x5b08('0x59')]['id'])});}});}})[_0x5b08('0x26')](respondWithStatusCode(_0x27baf7,null))['catch'](handleError(_0x27baf7,null));};exports[_0x5b08('0xb8')]=function(_0x17c9b2,_0x12aefb,_0x51a8ce){var _0x4a61b5={};var _0x24eb06={};var _0x4d4c51;var _0x1edafc;return db[_0x5b08('0x41')][_0x5b08('0x6d')]({'where':{'id':_0x17c9b2[_0x5b08('0x59')]['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x12aefb,null))[_0x5b08('0x26')](function(_0x2d05ba){if(_0x2d05ba){_0x4d4c51=_0x2d05ba;_0x24eb06[_0x5b08('0x49')]=_[_0x5b08('0x46')](db[_0x5b08('0xa0')][_0x5b08('0x42')]);_0x24eb06['query']=_[_0x5b08('0x46')](_0x17c9b2['query']);_0x24eb06[_0x5b08('0x52')]=_[_0x5b08('0x48')](_0x24eb06['model'],_0x24eb06[_0x5b08('0x47')]);_0x4a61b5[_0x5b08('0x4a')]=_[_0x5b08('0x48')](_0x24eb06[_0x5b08('0x49')],qs[_0x5b08('0x4b')](_0x17c9b2[_0x5b08('0x47')]['fields']));_0x4a61b5[_0x5b08('0x4a')]=_0x4a61b5['attributes'][_0x5b08('0x4c')]?_0x4a61b5['attributes']:_0x24eb06[_0x5b08('0x49')];_0x4a61b5['order']=qs[_0x5b08('0x50')](_0x17c9b2[_0x5b08('0x47')][_0x5b08('0x50')]);_0x4a61b5[_0x5b08('0x51')]=qs[_0x5b08('0x52')](_[_0x5b08('0x6e')](_0x17c9b2['query'],_0x24eb06['filters']));if(_0x17c9b2[_0x5b08('0x47')][_0x5b08('0x53')]){_0x4a61b5[_0x5b08('0x51')]=_[_0x5b08('0x54')](_0x4a61b5[_0x5b08('0x51')],{'$or':_[_0x5b08('0x40')](_0x4a61b5[_0x5b08('0x4a')],function(_0x1614ca){var _0x4fecf2={};_0x4fecf2[_0x1614ca]={'$like':'%'+_0x17c9b2[_0x5b08('0x47')]['filter']+'%'};return _0x4fecf2;})});}_0x4a61b5=_[_0x5b08('0x54')]({},_0x4a61b5,_0x17c9b2['options']);return _0x4d4c51[_0x5b08('0xb8')](_0x4a61b5);}})[_0x5b08('0x26')](function(_0x488f04){if(_0x488f04){_0x1edafc=_0x488f04['length'];if(!_0x17c9b2['query'][_0x5b08('0x4d')]('nolimit')){_0x4a61b5[_0x5b08('0x31')]=qs[_0x5b08('0x31')](_0x17c9b2[_0x5b08('0x47')][_0x5b08('0x31')]);_0x4a61b5[_0x5b08('0x30')]=qs[_0x5b08('0x30')](_0x17c9b2[_0x5b08('0x47')][_0x5b08('0x30')]);}return _0x4d4c51[_0x5b08('0xb8')](_0x4a61b5);}})[_0x5b08('0x26')](function(_0x48eaa2){if(_0x48eaa2){return _0x48eaa2?{'count':_0x1edafc,'rows':_0x48eaa2}:null;}})[_0x5b08('0x26')](respondWithResult(_0x12aefb,null))[_0x5b08('0x66')](handleError(_0x12aefb,null));};exports[_0x5b08('0x3e')]=function(_0x33d6c3,_0x3b55a7,_0x3a2fb2){var _0x229230,_0x4ae149,_0x565d78;if(_[_0x5b08('0x7e')](_0x33d6c3['body'][_0x5b08('0x5e')])||_0x33d6c3[_0x5b08('0x5e')][_0x5b08('0x5e')]===''){throw new db[(_0x5b08('0x22'))][(_0x5b08('0x23'))](_0x5b08('0xb9'));}if(_[_0x5b08('0x7e')](_0x33d6c3[_0x5b08('0x5e')]['to'])){}_0x229230=_0x33d6c3['body']['to'];return db['OpenchannelAccount'][_0x5b08('0x6d')]({'where':{'id':_0x33d6c3[_0x5b08('0x59')]['id']}})[_0x5b08('0x26')](handleEntityNotFound(_0x3b55a7,null))[_0x5b08('0x26')](function(_0x48e3f1){if(_0x48e3f1){return db[_0x5b08('0x41')][_0x5b08('0x5c')]({'where':{'id':_0x48e3f1['id']},'include':[{'model':db[_0x5b08('0x85')],'as':_0x5b08('0x86'),'include':[{'model':db[_0x5b08('0x87')],'as':'Contacts','where':{[_0x48e3f1[_0x5b08('0x80')]]:_0x229230},'limit':0x1,'order':[[_0x5b08('0x7a'),_0x5b08('0x88')]]}]}]})[_0x5b08('0x26')](handleEntityNotFound(_0x3b55a7,null))[_0x5b08('0x26')](function(_0x36a7f5){if(_0x36a7f5&&_0x36a7f5[_0x5b08('0x86')]){_0x4ae149=_0x36a7f5[_0x5b08('0x60')]({'plain':!![]});if(_0x4ae149[_0x5b08('0x86')]&&_0x4ae149[_0x5b08('0x86')][_0x5b08('0x8e')][_0x5b08('0x4c')]){return _0x4ae149[_0x5b08('0x86')]['Contacts'][0x0];}return db[_0x5b08('0x87')][_0x5b08('0x5d')](_[_0x5b08('0x8f')](_0x33d6c3[_0x5b08('0x5e')],{'firstName':_0x229230,[_0x36a7f5[_0x5b08('0x80')]]:_0x229230,'phone':_0x229230,'ListId':_0x4ae149['ListId']}));}})[_0x5b08('0x26')](handleEntityNotFound(_0x3b55a7,null))[_0x5b08('0x26')](function(_0x4d25a4){if(_0x4d25a4){_0x565d78=_0x4d25a4;return db[_0x5b08('0x93')]['find']({'where':{'ContactId':_0x565d78['id'],'closed':![],'OpenchannelAccountId':_0x4ae149['id']}})[_0x5b08('0x26')](function(_0xcc2a28){if(_0xcc2a28){return[_0xcc2a28,![]];}return db[_0x5b08('0x93')][_0x5b08('0x5d')]({'UserId':_0x33d6c3[_0x5b08('0x5f')]['id'],'ContactId':_0x565d78['id'],'OpenchannelAccountId':_0x4ae149['id'],'lastMsgDirection':'out','Messages':[_[_0x5b08('0x54')](_0x33d6c3[_0x5b08('0x5e')],{'read':![],'body':_0x33d6c3[_0x5b08('0x5e')][_0x5b08('0x5e')],'OpenchannelAccountId':_0x4ae149['id'],'UserId':_0x33d6c3[_0x5b08('0x5f')]['id'],'ContactId':_0x565d78['id']})]},{'include':[{'model':db[_0x5b08('0x9d')],'as':_0x5b08('0xba')}]})[_0x5b08('0x26')](function(_0x5bbc7c){return[_0x5bbc7c,!![]];});});}})[_0x5b08('0x94')](function(_0x5ab3ba,_0x3f066a){if(_0x3f066a){return _0x5ab3ba;}return db[_0x5b08('0x9d')][_0x5b08('0x5d')](_[_0x5b08('0x54')](_0x33d6c3[_0x5b08('0x5e')],{'read':![],'body':_0x33d6c3['body'][_0x5b08('0x5e')],'OpenchannelAccountId':_0x4ae149['id'],'OpenchannelInteractionId':_0x5ab3ba['id'],'UserId':_0x33d6c3['user']['id'],'ContactId':_0x565d78['id']}))[_0x5b08('0x26')](function(_0x585ce4){_0x5ab3ba['dataValues'][_0x5b08('0xba')]=[];_0x5ab3ba[_0x5b08('0xbb')]['Messages']['push'](_0x585ce4[_0x5b08('0xbb')]);return _0x5ab3ba;});});}})[_0x5b08('0x26')](respondWithResult(_0x3b55a7,null))[_0x5b08('0x66')](handleError(_0x3b55a7,null));}; \ No newline at end of file +var _0xdbbe=['OpenchannelAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','sort','OpenchannelAccountId','Disposition','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','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','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','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~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','destroy','get','stack','name','Pause','mandatoryDispositionPause','map'];(function(_0x1b2bca,_0x43cbef){var _0x481726=function(_0x498dc8){while(--_0x498dc8){_0x1b2bca['push'](_0x1b2bca['shift']());}};_0x481726(++_0x43cbef);}(_0xdbbe,0x136));var _0xedbb=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0xdbbe[_0x10e983];return _0x324138;};'use strict';var pdf=require(_0xedbb('0x0'));var emlformat=require(_0xedbb('0x1'));var rimraf=require(_0xedbb('0x2'));var zipdir=require(_0xedbb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xedbb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedbb('0x5'));var util=require(_0xedbb('0x6'));var path=require(_0xedbb('0x7'));var sox=require(_0xedbb('0x8'));var csv=require(_0xedbb('0x9'));var ejs=require(_0xedbb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedbb('0xb'));var crypto=require(_0xedbb('0xc'));var jsforce=require(_0xedbb('0xd'));var deskjs=require(_0xedbb('0xe'));var toCsv=require(_0xedbb('0x9'));var querystring=require('querystring');var Papa=require(_0xedbb('0xf'));var Redis=require('ioredis');var authService=require(_0xedbb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xedbb('0x11'));var hardwareService=require(_0xedbb('0x12'));var logger=require('../../config/logger')(_0xedbb('0x13'));var utils=require('../../config/utils');var config=require(_0xedbb('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xedbb('0x15')](config[_0xedbb('0x16')],{'host':_0xedbb('0x17'),'port':0x18eb});var socket=require(_0xedbb('0x18'))(new Redis(config[_0xedbb('0x16')]));require(_0xedbb('0x19'))[_0xedbb('0x1a')](socket);var jayson=require(_0xedbb('0x1b'));var client=jayson[_0xedbb('0x1c')][_0xedbb('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4acc06,_0x4544ff,_0x3d987e){if(_0x3d987e){var _0x283334=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x283334[_0xedbb('0x1e')](_0x4544ff)){return _0x4acc06;}else{throw new db[(_0xedbb('0x1f'))]['ValidationError'](_0xedbb('0x20'));}}else{return _0x4acc06;}}function respondWithRpcPromise(_0x42aa79,_0x22df31,_0x49772e,_0x5ca3be){return new BPromise(function(_0x32cb90,_0x3ed914){var _0x241699=_0x5ca3be||client;return _0x241699[_0xedbb('0x21')](_0x42aa79,_0x49772e)[_0xedbb('0x22')](function(_0x6f85a0){logger[_0xedbb('0x23')](_0xedbb('0x24'),_0x22df31,_0xedbb('0x25'));logger[_0xedbb('0x26')](_0xedbb('0x27'),_0x22df31,_0xedbb('0x25'),JSON[_0xedbb('0x28')](_0x6f85a0));if(_0x6f85a0['error']){if(_0x6f85a0['error'][_0xedbb('0x29')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x22df31,_0x6f85a0[_0xedbb('0x2a')][_0xedbb('0x2b')]);return _0x3ed914(_0x6f85a0[_0xedbb('0x2a')][_0xedbb('0x2b')]);}logger[_0xedbb('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x22df31,_0x6f85a0[_0xedbb('0x2a')][_0xedbb('0x2b')]);return _0x32cb90(_0x6f85a0[_0xedbb('0x2a')][_0xedbb('0x2b')]);}else{logger[_0xedbb('0x23')](_0xedbb('0x24'),_0x22df31,_0xedbb('0x25'));_0x32cb90(_0x6f85a0[_0xedbb('0x2c')][_0xedbb('0x2b')]);}})['catch'](function(_0x3f3f3a){logger[_0xedbb('0x2a')](_0xedbb('0x24'),_0x22df31,_0x3f3f3a);_0x3ed914(_0x3f3f3a);});});}function respondWithStatusCode(_0x4dd470,_0x1514b1){_0x1514b1=_0x1514b1||0xcc;return function(_0x2b8f8b){if(_0x2b8f8b){return _0x4dd470[_0xedbb('0x2d')](_0x1514b1);}return _0x4dd470['status'](_0x1514b1)[_0xedbb('0x2e')]();};}function respondWithResult(_0x3f5621,_0x122b50){_0x122b50=_0x122b50||0xc8;return function(_0x2a6103){if(_0x2a6103){return _0x3f5621[_0xedbb('0x2f')](_0x122b50)['json'](_0x2a6103);}};}function respondWithFilteredResult(_0x5917fc,_0x40dec9){return function(_0x5eabe4){if(_0x5eabe4){var _0x1d9022=_0x5eabe4[_0xedbb('0x30')],_0xfea457=_0x40dec9['offset'],_0x10fd86=_0x40dec9[_0xedbb('0x31')]+_0x40dec9[_0xedbb('0x32')],_0x593574;if(_0x10fd86>=_0x1d9022){_0x10fd86=_0x1d9022;_0x593574=0xc8;}else{_0x593574=0xce;}_0x5917fc[_0xedbb('0x2f')](_0x593574);return _0x5917fc[_0xedbb('0x33')](_0xedbb('0x34'),_0xfea457+'-'+_0x10fd86+'/'+_0x1d9022)[_0xedbb('0x35')](_0x5eabe4);}return null;};}function patchUpdates(_0x4e3452){return function(_0x290932){try{jsonpatch['apply'](_0x290932,_0x4e3452,!![]);}catch(_0x561a70){return BPromise[_0xedbb('0x36')](_0x561a70);}return _0x290932['save']();};}function saveUpdates(_0x4caf35,_0x5cb84d){return function(_0x182323){if(_0x182323){return _0x182323['update'](_0x4caf35)[_0xedbb('0x22')](function(_0xc832e0){return _0xc832e0;});}return null;};}function removeEntity(_0x2b01fc,_0x630c94){return function(_0x160622){if(_0x160622){return _0x160622[_0xedbb('0x37')]()[_0xedbb('0x22')](function(){var _0x2b9292=_0x160622[_0xedbb('0x38')]({'plain':!![]});var _0x248887='OpenchannelAccounts';return db['UserProfileResource'][_0xedbb('0x37')]({'where':{'type':_0x248887,'resourceId':_0x2b9292['id']}})['then'](function(){return _0x160622;});})['then'](function(){_0x2b01fc[_0xedbb('0x2f')](0xcc)[_0xedbb('0x2e')]();});}};}function handleEntityNotFound(_0x24e8a9,_0x5184bf){return function(_0x41fd5a){if(!_0x41fd5a){_0x24e8a9[_0xedbb('0x2d')](0x194);}return _0x41fd5a;};}function handleError(_0x1c0eea,_0x3181d8){_0x3181d8=_0x3181d8||0x1f4;return function(_0x3ab8f0){logger['error'](_0x3ab8f0[_0xedbb('0x39')]);if(_0x3ab8f0[_0xedbb('0x3a')]){delete _0x3ab8f0[_0xedbb('0x3a')];}_0x1c0eea[_0xedbb('0x2f')](_0x3181d8)['send'](_0x3ab8f0);};}exports['index']=function(_0x616159,_0x5e9824){var _0x428785={'include':[{'model':db[_0xedbb('0x3b')],'as':_0xedbb('0x3c')}]},_0x18487e={},_0x33f43b={'count':0x0,'rows':[]};var _0x3660bf=_[_0xedbb('0x3d')](db[_0xedbb('0x3e')][_0xedbb('0x3f')],function(_0x2148dc){return{'name':_0x2148dc['fieldName'],'type':_0x2148dc['type'][_0xedbb('0x40')]};});_0x18487e[_0xedbb('0x41')]=_[_0xedbb('0x3d')](_0x3660bf,_0xedbb('0x3a'));_0x18487e[_0xedbb('0x42')]=_[_0xedbb('0x43')](_0x616159[_0xedbb('0x42')]);_0x18487e[_0xedbb('0x44')]=_[_0xedbb('0x45')](_0x18487e[_0xedbb('0x41')],_0x18487e['query']);_0x428785[_0xedbb('0x46')]=_[_0xedbb('0x45')](_0x18487e['model'],qs[_0xedbb('0x47')](_0x616159[_0xedbb('0x42')]['fields']));_0x428785[_0xedbb('0x46')]=_0x428785[_0xedbb('0x46')][_0xedbb('0x48')]?_0x428785[_0xedbb('0x46')]:_0x18487e[_0xedbb('0x41')];if(!_0x616159[_0xedbb('0x42')][_0xedbb('0x49')](_0xedbb('0x4a'))){_0x428785[_0xedbb('0x32')]=qs[_0xedbb('0x32')](_0x616159[_0xedbb('0x42')][_0xedbb('0x32')]);_0x428785[_0xedbb('0x31')]=qs[_0xedbb('0x31')](_0x616159[_0xedbb('0x42')][_0xedbb('0x31')]);}_0x428785[_0xedbb('0x4b')]=qs['sort'](_0x616159['query']['sort']);_0x428785[_0xedbb('0x4c')]=qs[_0xedbb('0x44')](_[_0xedbb('0x4d')](_0x616159[_0xedbb('0x42')],_0x18487e[_0xedbb('0x44')]),_0x3660bf);if(_0x616159[_0xedbb('0x42')][_0xedbb('0x4e')]){_0x428785['where']=_['merge'](_0x428785['where'],{'$or':_[_0xedbb('0x3d')](_0x3660bf,function(_0x133c17){if(_0x133c17['type']!==_0xedbb('0x4f')){var _0x5b8940={};_0x5b8940[_0x133c17[_0xedbb('0x3a')]]={'$like':'%'+_0x616159[_0xedbb('0x42')][_0xedbb('0x4e')]+'%'};return _0x5b8940;}})});}_0x428785=_[_0xedbb('0x50')]({},_0x428785,_0x616159[_0xedbb('0x51')]);var _0x4badca={'where':_0x428785['where']};return db[_0xedbb('0x3e')][_0xedbb('0x30')](_0x4badca)[_0xedbb('0x22')](function(_0x9e02a2){_0x33f43b['count']=_0x9e02a2;if(_0x616159[_0xedbb('0x42')][_0xedbb('0x52')]){_0x428785[_0xedbb('0x53')]=[{'all':!![]}];}return db[_0xedbb('0x3e')][_0xedbb('0x54')](_0x428785);})[_0xedbb('0x22')](function(_0x1ba36a){_0x33f43b['rows']=_0x1ba36a;return _0x33f43b;})['then'](respondWithFilteredResult(_0x5e9824,_0x428785))[_0xedbb('0x55')](handleError(_0x5e9824,null));};exports['show']=function(_0x34f42c,_0x168a9e){var _0xc1c30={'raw':![],'where':{'id':_0x34f42c[_0xedbb('0x56')]['id']},'include':[{'model':db[_0xedbb('0x3b')],'as':_0xedbb('0x3c')}]},_0x580975={};_0x580975['model']=_['keys'](db[_0xedbb('0x3e')][_0xedbb('0x3f')]);_0x580975['query']=_[_0xedbb('0x43')](_0x34f42c[_0xedbb('0x42')]);_0x580975[_0xedbb('0x44')]=_[_0xedbb('0x45')](_0x580975[_0xedbb('0x41')],_0x580975[_0xedbb('0x42')]);_0xc1c30[_0xedbb('0x46')]=_[_0xedbb('0x45')](_0x580975['model'],qs[_0xedbb('0x47')](_0x34f42c[_0xedbb('0x42')][_0xedbb('0x47')]));_0xc1c30[_0xedbb('0x46')]=_0xc1c30[_0xedbb('0x46')]['length']?_0xc1c30[_0xedbb('0x46')]:_0x580975[_0xedbb('0x41')];if(_0x34f42c['query'][_0xedbb('0x52')]){_0xc1c30[_0xedbb('0x53')]=[{'all':!![]}];}_0xc1c30=_['merge']({},_0xc1c30,_0x34f42c[_0xedbb('0x51')]);return db[_0xedbb('0x3e')][_0xedbb('0x57')](_0xc1c30)['then'](handleEntityNotFound(_0x168a9e,null))[_0xedbb('0x22')](respondWithResult(_0x168a9e,null))[_0xedbb('0x55')](handleError(_0x168a9e,null));};exports[_0xedbb('0x58')]=function(_0xbbea35,_0x5be641){return db[_0xedbb('0x3e')]['create'](_0xbbea35['body'],{})[_0xedbb('0x22')](function(_0x39e01f){var _0x21b873=_0xbbea35[_0xedbb('0x59')][_0xedbb('0x38')]({'plain':!![]});if(!_0x21b873)throw new Error(_0xedbb('0x5a'));if(_0x21b873[_0xedbb('0x5b')]===_0xedbb('0x59')){var _0x52ea7a=_0x39e01f[_0xedbb('0x38')]({'plain':!![]});var _0x4a08d2='OpenchannelAccounts';return db[_0xedbb('0x5c')][_0xedbb('0x57')]({'where':{'name':_0x4a08d2,'userProfileId':_0x21b873[_0xedbb('0x5d')]},'raw':!![]})['then'](function(_0xd923e0){if(_0xd923e0&&_0xd923e0[_0xedbb('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x52ea7a[_0xedbb('0x3a')],'resourceId':_0x52ea7a['id'],'type':_0xd923e0[_0xedbb('0x3a')],'sectionId':_0xd923e0['id']},{})[_0xedbb('0x22')](function(){return _0x39e01f;});}else{return _0x39e01f;}})['catch'](function(_0x37ec07){logger[_0xedbb('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37ec07);throw _0x37ec07;});}return _0x39e01f;})[_0xedbb('0x22')](respondWithResult(_0x5be641,0xc9))[_0xedbb('0x55')](handleError(_0x5be641,null));};exports[_0xedbb('0x5f')]=function(_0x182813,_0x3d6a95){if(_0x182813['body']['id']){delete _0x182813[_0xedbb('0x60')]['id'];}return db[_0xedbb('0x3e')][_0xedbb('0x57')]({'where':{'id':_0x182813['params']['id']},'include':[{'model':db['Pause'],'as':_0xedbb('0x3c')}]})[_0xedbb('0x22')](handleEntityNotFound(_0x3d6a95,null))['then'](saveUpdates(_0x182813[_0xedbb('0x60')],null))['then'](respondWithResult(_0x3d6a95,null))['catch'](handleError(_0x3d6a95,null));};exports['destroy']=function(_0x529951,_0x5cceb7){return db[_0xedbb('0x3e')][_0xedbb('0x57')]({'where':{'id':_0x529951[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x5cceb7,null))[_0xedbb('0x22')](removeEntity(_0x5cceb7,null))['catch'](handleError(_0x5cceb7,null));};exports[_0xedbb('0x61')]=function(_0x9eff76,_0x45962f){return db[_0xedbb('0x3e')][_0xedbb('0x61')]()[_0xedbb('0x22')](respondWithResult(_0x45962f,null))[_0xedbb('0x55')](handleError(_0x45962f,null));};exports[_0xedbb('0x62')]=function(_0x4bc204,_0x34ebfb,_0x9088fd){if(_0x4bc204['body']['id']){delete _0x4bc204['body']['id'];}return db['OpenchannelAccount'][_0xedbb('0x57')]({'where':{'id':_0x4bc204[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x34ebfb,null))[_0xedbb('0x22')](function(_0x4fe595){if(_0x4fe595){_0x4bc204[_0xedbb('0x60')][_0xedbb('0x63')]=_0x4fe595['id'];return db['Disposition'][_0xedbb('0x58')](_0x4bc204[_0xedbb('0x60')]);}})[_0xedbb('0x22')](respondWithResult(_0x34ebfb,null))['catch'](handleError(_0x34ebfb,null));};exports[_0xedbb('0x64')]=function(_0x52d622,_0xf1cc0d,_0x1afbcc){var _0x1c7884={'raw':![],'where':{}};var _0x518bd9={};var _0x34085d={'count':0x0,'rows':[]};return db[_0xedbb('0x3e')][_0xedbb('0x65')]({'where':{'id':_0x52d622[_0xedbb('0x56')]['id']}})['then'](handleEntityNotFound(_0xf1cc0d,null))['then'](function(_0x44a846){if(_0x44a846){_0x518bd9[_0xedbb('0x41')]=_[_0xedbb('0x43')](db['Disposition']['rawAttributes']);_0x518bd9[_0xedbb('0x42')]=_['keys'](_0x52d622[_0xedbb('0x42')]);_0x518bd9[_0xedbb('0x44')]=_[_0xedbb('0x45')](_0x518bd9['model'],_0x518bd9['query']);_0x1c7884['attributes']=_[_0xedbb('0x45')](_0x518bd9['model'],qs[_0xedbb('0x47')](_0x52d622[_0xedbb('0x42')][_0xedbb('0x47')]));_0x1c7884['attributes']=_0x1c7884['attributes'][_0xedbb('0x48')]?_0x1c7884['attributes']:_0x518bd9[_0xedbb('0x41')];if(!_0x52d622[_0xedbb('0x42')][_0xedbb('0x49')](_0xedbb('0x4a'))){_0x1c7884[_0xedbb('0x32')]=qs[_0xedbb('0x32')](_0x52d622[_0xedbb('0x42')]['limit']);_0x1c7884[_0xedbb('0x31')]=qs[_0xedbb('0x31')](_0x52d622[_0xedbb('0x42')][_0xedbb('0x31')]);}_0x1c7884[_0xedbb('0x4b')]=qs[_0xedbb('0x66')](_0x52d622[_0xedbb('0x42')][_0xedbb('0x66')]);_0x1c7884[_0xedbb('0x4c')]=qs[_0xedbb('0x44')](_[_0xedbb('0x4d')](_0x52d622[_0xedbb('0x42')],_0x518bd9[_0xedbb('0x44')]));_0x1c7884[_0xedbb('0x4c')][_0xedbb('0x67')]=_0x44a846['id'];if(_0x52d622[_0xedbb('0x42')][_0xedbb('0x4e')]){_0x1c7884['where']=_[_0xedbb('0x50')](_0x1c7884[_0xedbb('0x4c')],{'$or':_[_0xedbb('0x3d')](_0x1c7884[_0xedbb('0x46')],function(_0x54bff9){var _0x453e9={};_0x453e9[_0x54bff9]={'$like':'%'+_0x52d622[_0xedbb('0x42')][_0xedbb('0x4e')]+'%'};return _0x453e9;})});}_0x1c7884=_[_0xedbb('0x50')]({},_0x1c7884,_0x52d622[_0xedbb('0x51')]);return db[_0xedbb('0x68')][_0xedbb('0x30')]({'where':_0x1c7884[_0xedbb('0x4c')]})['then'](function(_0x50f07f){_0x34085d[_0xedbb('0x30')]=_0x50f07f;if(_0x52d622[_0xedbb('0x42')][_0xedbb('0x52')]){_0x1c7884['include']=[{'all':!![]}];}return db['Disposition'][_0xedbb('0x54')](_0x1c7884);})[_0xedbb('0x22')](function(_0x3f6e7){_0x34085d[_0xedbb('0x69')]=_0x3f6e7;return _0x34085d;});}})[_0xedbb('0x22')](respondWithFilteredResult(_0xf1cc0d,_0x1c7884))[_0xedbb('0x55')](handleError(_0xf1cc0d,null));};exports[_0xedbb('0x6a')]=function(_0x20a3d7,_0x4607dd,_0xc632c){return db[_0xedbb('0x3e')]['find']({'where':{'id':_0x20a3d7[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x4607dd,null))[_0xedbb('0x22')](function(_0x2ab47e){if(_0x2ab47e){return _0x2ab47e[_0xedbb('0x6a')](_0x20a3d7['query'][_0xedbb('0x6b')]);}})[_0xedbb('0x22')](respondWithStatusCode(_0x4607dd,null))[_0xedbb('0x55')](handleError(_0x4607dd,null));};exports[_0xedbb('0x6c')]=function(_0x494a05,_0x58fa13,_0x2252ec){if(_0x494a05[_0xedbb('0x60')]['id']){delete _0x494a05['body']['id'];}return db[_0xedbb('0x3e')][_0xedbb('0x57')]({'where':{'id':_0x494a05[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x58fa13,null))['then'](function(_0x5a19ed){if(_0x5a19ed){_0x494a05[_0xedbb('0x60')][_0xedbb('0x67')]=_0x5a19ed['id'];return db['CannedAnswer'][_0xedbb('0x58')](_0x494a05['body']);}})[_0xedbb('0x22')](respondWithResult(_0x58fa13,null))[_0xedbb('0x55')](handleError(_0x58fa13,null));};exports[_0xedbb('0x6d')]=function(_0x33d21b,_0x1f6359,_0x176bc){var _0x59e77b={'raw':![],'where':{}};var _0x113d5f={};var _0x33222d={'count':0x0,'rows':[]};return db[_0xedbb('0x3e')]['findOne']({'where':{'id':_0x33d21b['params']['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x1f6359,null))[_0xedbb('0x22')](function(_0x512662){if(_0x512662){_0x113d5f[_0xedbb('0x41')]=_['keys'](db[_0xedbb('0x6e')][_0xedbb('0x3f')]);_0x113d5f[_0xedbb('0x42')]=_[_0xedbb('0x43')](_0x33d21b['query']);_0x113d5f[_0xedbb('0x44')]=_['intersection'](_0x113d5f['model'],_0x113d5f[_0xedbb('0x42')]);_0x59e77b['attributes']=_[_0xedbb('0x45')](_0x113d5f['model'],qs[_0xedbb('0x47')](_0x33d21b['query'][_0xedbb('0x47')]));_0x59e77b[_0xedbb('0x46')]=_0x59e77b[_0xedbb('0x46')][_0xedbb('0x48')]?_0x59e77b[_0xedbb('0x46')]:_0x113d5f[_0xedbb('0x41')];if(!_0x33d21b['query'][_0xedbb('0x49')](_0xedbb('0x4a'))){_0x59e77b[_0xedbb('0x32')]=qs[_0xedbb('0x32')](_0x33d21b[_0xedbb('0x42')][_0xedbb('0x32')]);_0x59e77b[_0xedbb('0x31')]=qs[_0xedbb('0x31')](_0x33d21b['query']['offset']);}_0x59e77b[_0xedbb('0x4b')]=qs[_0xedbb('0x66')](_0x33d21b[_0xedbb('0x42')][_0xedbb('0x66')]);_0x59e77b[_0xedbb('0x4c')]=qs['filters'](_['pick'](_0x33d21b['query'],_0x113d5f['filters']));_0x59e77b['where']['OpenchannelAccountId']=_0x512662['id'];if(_0x33d21b[_0xedbb('0x42')][_0xedbb('0x4e')]){_0x59e77b[_0xedbb('0x4c')]=_[_0xedbb('0x50')](_0x59e77b[_0xedbb('0x4c')],{'$or':_[_0xedbb('0x3d')](_0x59e77b['attributes'],function(_0x45aef3){var _0x385a37={};_0x385a37[_0x45aef3]={'$like':'%'+_0x33d21b['query'][_0xedbb('0x4e')]+'%'};return _0x385a37;})});}_0x59e77b=_['merge']({},_0x59e77b,_0x33d21b['options']);return db['CannedAnswer'][_0xedbb('0x30')]({'where':_0x59e77b[_0xedbb('0x4c')]})['then'](function(_0x36cb91){_0x33222d[_0xedbb('0x30')]=_0x36cb91;if(_0x33d21b[_0xedbb('0x42')][_0xedbb('0x52')]){_0x59e77b['include']=[{'all':!![]}];}return db[_0xedbb('0x6e')][_0xedbb('0x54')](_0x59e77b);})[_0xedbb('0x22')](function(_0x78733c){_0x33222d['rows']=_0x78733c;return _0x33222d;});}})[_0xedbb('0x22')](respondWithFilteredResult(_0x1f6359,_0x59e77b))[_0xedbb('0x55')](handleError(_0x1f6359,null));};exports['removeAnswers']=function(_0x48b501,_0x32828a,_0x1a8027){return db[_0xedbb('0x3e')][_0xedbb('0x57')]({'where':{'id':_0x48b501['params']['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x32828a,null))[_0xedbb('0x22')](function(_0x45b23e){if(_0x45b23e){return _0x45b23e['removeAnswers'](_0x48b501[_0xedbb('0x42')][_0xedbb('0x6b')]);}})[_0xedbb('0x22')](respondWithStatusCode(_0x32828a,null))['catch'](handleError(_0x32828a,null));};exports[_0xedbb('0x6f')]=function(_0x42d004,_0x42a5b0,_0x12eedf){var _0x4862e3={'body':_0x42d004[_0xedbb('0x60')],'channel':_0xedbb('0x70')};var _0xe04683=[];var _0x5e047f=[];var _0x39816b={};var _0x5b0fe6=![];return db[_0xedbb('0x71')][_0xedbb('0x61')]()[_0xedbb('0x22')](function(_0x4ff5e5){if(!_0x4ff5e5){throw new db[(_0xedbb('0x1f'))][(_0xedbb('0x72'))]('no\x20available\x20attributes');}_0xe04683=_[_0xedbb('0x73')](_['keys'](_0x4ff5e5),[_0xedbb('0x74'),_0xedbb('0x75')]);_0x5e047f=_[_0xedbb('0x73')](_[_0xedbb('0x43')](_0x4ff5e5),[_0xedbb('0x74'),_0xedbb('0x75'),_0xedbb('0x76'),_0xedbb('0x77')]);if(_0x42d004[_0xedbb('0x60')]['id']){delete _0x42d004[_0xedbb('0x60')]['id'];}if(_[_0xedbb('0x78')](_0x42d004[_0xedbb('0x60')][_0xedbb('0x79')])){throw new db['Sequelize']['ValidationError'](_0xedbb('0x7a'));}if(_[_0xedbb('0x78')](_0x42d004[_0xedbb('0x60')][_0xedbb('0x60')])||_0x42d004[_0xedbb('0x60')][_0xedbb('0x60')]===''){throw new db['Sequelize'][(_0xedbb('0x72'))](_0xedbb('0x7b'));}if(_[_0xedbb('0x78')](_0x42d004[_0xedbb('0x60')][_0xedbb('0x7c')])){throw new db[(_0xedbb('0x1f'))][(_0xedbb('0x72'))](_0xedbb('0x7d')+_0x5e047f);}if(!_['includes'](_0x5e047f,_0x42d004['body'][_0xedbb('0x7c')])){throw new db[(_0xedbb('0x1f'))][(_0xedbb('0x72'))](_0xedbb('0x7e')+_0x5e047f);}_0x39816b[_0x42d004[_0xedbb('0x60')][_0xedbb('0x7c')]]=_0x42d004[_0xedbb('0x60')][_0xedbb('0x79')];})[_0xedbb('0x22')](function(){return db[_0xedbb('0x3e')][_0xedbb('0x57')]({'where':{'id':_0x42d004[_0xedbb('0x56')]['id']},'include':[{'model':db[_0xedbb('0x7f')],'as':_0xedbb('0x80'),'include':[{'model':db[_0xedbb('0x71')],'as':'Contacts','where':_0x39816b,'limit':0x1,'order':[['updatedAt',_0xedbb('0x81')]]}]},{'model':db[_0xedbb('0x82')],'as':_0xedbb('0x83')}]});})['then'](handleEntityNotFound(_0x42a5b0,null))[_0xedbb('0x22')](function(_0x2bf42b){if(_0x2bf42b&&_0x2bf42b[_0xedbb('0x80')]){_0x4862e3[_0xedbb('0x84')]=_0x2bf42b;_0x4862e3[_0xedbb('0x85')]=_0x2bf42b['Applications'];_0x4862e3[_0xedbb('0x86')]=_0x2bf42b[_0xedbb('0x80')];_0x4862e3[_0xedbb('0x85')]=_[_0xedbb('0x87')](_0x4862e3[_0xedbb('0x85')],[_0xedbb('0x88')],[_0xedbb('0x89')]);if(_0x4862e3[_0xedbb('0x84')][_0xedbb('0x83')]){delete _0x4862e3[_0xedbb('0x84')]['Applications'];}if(_0x4862e3[_0xedbb('0x84')]['List']&&_0x4862e3[_0xedbb('0x84')][_0xedbb('0x80')]['Contacts'][_0xedbb('0x48')]){return _0x4862e3[_0xedbb('0x84')][_0xedbb('0x80')][_0xedbb('0x8a')][0x0];}var _0x2b8857=_[_0xedbb('0x15')](_0x42d004['body'],{'firstName':_0x42d004[_0xedbb('0x60')]['from'],'ListId':_0x2bf42b['ListId']});_0x2b8857[_0x42d004[_0xedbb('0x60')][_0xedbb('0x7c')]]=_0x42d004[_0xedbb('0x60')][_0xedbb('0x79')];return db[_0xedbb('0x71')][_0xedbb('0x58')](_0x2b8857,{'fields':_0xe04683,'raw':!![]});}})[_0xedbb('0x22')](handleEntityNotFound(_0x42a5b0,null))[_0xedbb('0x22')](function(_0x3cba49){_0x4862e3[_0xedbb('0x8b')]=_0x3cba49;if(_0x3cba49){var _0x12b2e3={'ContactId':_0x3cba49['id'],'OpenchannelAccountId':_0x42d004['params']['id'],'from':(_0x3cba49[_0xedbb('0x8c')]||'')+'\x20'+(_0x3cba49[_0xedbb('0x8d')]||'')};var _0x4cf0ed={'OpenchannelAccountId':_0x42d004[_0xedbb('0x56')]['id'],'closed':![]};if(_0x42d004[_0xedbb('0x60')][_0xedbb('0x8e')]){_0x4cf0ed[_0xedbb('0x8e')]=_0x42d004[_0xedbb('0x60')][_0xedbb('0x8e')];return db['OpenchannelInteraction'][_0xedbb('0x57')]({'where':_0x4cf0ed})[_0xedbb('0x22')](function(_0xbeddfc){if(_0xbeddfc){return[_0xbeddfc,![]];}_0x12b2e3[_0xedbb('0x8e')]=_0x42d004[_0xedbb('0x60')][_0xedbb('0x8e')];_0x12b2e3[_0xedbb('0x8f')]=_0x42d004[_0xedbb('0x60')][_0xedbb('0x8f')];return db[_0xedbb('0x90')][_0xedbb('0x58')](_0x12b2e3)[_0xedbb('0x22')](function(_0x30b9eb){return[_0x30b9eb,!![]];});});}else{_0x4cf0ed[_0xedbb('0x8e')]=null;}_0x4cf0ed[_0xedbb('0x91')]=_0x3cba49['id'];return db[_0xedbb('0x90')][_0xedbb('0x57')]({'where':_0x4cf0ed})['then'](function(_0x436ec7){if(_0x436ec7){return[_0x436ec7,![]];}return db[_0xedbb('0x90')]['create'](_0x12b2e3)['then'](function(_0x2d8a5f){return[_0x2d8a5f,!![]];});});}})[_0xedbb('0x92')](function(_0x15c8d2,_0x3ddda1){if(_0x15c8d2){_0x5b0fe6=_0x3ddda1;if(!_0x3ddda1){var _0x52d648={'from':(_0x4862e3['contact'][_0xedbb('0x8c')]||'')+'\x20'+(_0x4862e3[_0xedbb('0x8b')][_0xedbb('0x8d')]||'')};if(_0x42d004['body'][_0xedbb('0x8e')]&&_0x42d004['body'][_0xedbb('0x93')]&&_0x42d004[_0xedbb('0x60')][_0xedbb('0x8e')]!=_0x42d004['body'][_0xedbb('0x93')]){_0x52d648[_0xedbb('0x8e')]=_0x42d004[_0xedbb('0x60')][_0xedbb('0x93')];}return _0x15c8d2['update'](_0x52d648);}else{return _0x15c8d2;}}})[_0xedbb('0x22')](function(_0x1d11c8){_0x4862e3[_0xedbb('0x94')]=_0x1d11c8[_0xedbb('0x38')]({'plain':!![]});_0x4862e3[_0xedbb('0x94')][_0xedbb('0x95')]=_0x5b0fe6;if(_0x4862e3[_0xedbb('0x94')][_0xedbb('0x95')]){if(_0x4862e3[_0xedbb('0x84')]['autoclose']){_0x4862e3[_0xedbb('0x85')][_0xedbb('0x96')]({'id':0x0,'priority':_0x4862e3['applications'][_0xedbb('0x48')]+0x1,'app':'close','appdata':_0xedbb('0x97'),'interval':_0xedbb('0x98')});}}return db[_0xedbb('0x99')][_0xedbb('0x58')]({'body':_0x42d004['body'][_0xedbb('0x60')],'OpenchannelAccountId':_0x42d004[_0xedbb('0x56')]['id'],'OpenchannelInteractionId':_0x1d11c8['id'],'direction':'in','ContactId':_0x4862e3[_0xedbb('0x8b')]['id'],'AttachmentId':_0x42d004[_0xedbb('0x60')][_0xedbb('0x9a')]});})['then'](function(_0x38c533){_0x4862e3[_0xedbb('0x2b')]=_0x38c533;if(_0x4862e3['interaction'][_0xedbb('0x9b')]){return db[_0xedbb('0x9c')][_0xedbb('0x57')]({'attributes':['id','name'],'where':{'id':_0x4862e3['interaction']['UserId']}})[_0xedbb('0x22')](function(_0x5ce316){if(_0x5ce316){_0x4862e3[_0xedbb('0x85')][_0xedbb('0x9d')]({'id':0x0,'priority':0x0,'app':_0xedbb('0x9e'),'appdata':_0x5ce316[_0xedbb('0x3a')]+','+(_0x4862e3[_0xedbb('0x84')][_0xedbb('0x9f')]||0xa),'interval':'*,*,*,*'});_0x4862e3[_0xedbb('0xa0')]=![];}return respondWithRpcPromise(_0xedbb('0xa1'),_0xedbb('0xa2'),_0x4862e3);});}return respondWithRpcPromise(_0xedbb('0xa1'),'startRouting',_0x4862e3);})[_0xedbb('0x22')](function(_0x239ae1){respondWithRpcPromise(_0xedbb('0xa3'),'EventManager',{'event':'notify','message':_0x239ae1},client9002);return _0x239ae1;})[_0xedbb('0x22')](respondWithResult(_0x42a5b0,null))[_0xedbb('0x55')](handleError(_0x42a5b0,null));};exports[_0xedbb('0xa4')]=function(_0x2b391c,_0x26c22e,_0x366920){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2b391c[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x26c22e,null))[_0xedbb('0x22')](function(_0xad1aca){if(_0xad1aca){return db[_0xedbb('0xa5')][_0xedbb('0xa6')](function(_0x1f4cb9){return db[_0xedbb('0x82')][_0xedbb('0x37')]({'where':{'OpenchannelAccountId':_0x2b391c[_0xedbb('0x56')]['id']},'transaction':_0x1f4cb9})[_0xedbb('0x22')](function(_0x2dedb0){var _0x51c7fb=_[_0xedbb('0x3d')](_0x2b391c['body'],function(_0x53a4e4){_0x53a4e4[_0xedbb('0x67')]=_0x2b391c['params']['id'];return _0x53a4e4;});return db[_0xedbb('0x82')][_0xedbb('0xa7')](_0x51c7fb,{'transaction':_0x1f4cb9});});})[_0xedbb('0x22')](function(){return db[_0xedbb('0x82')][_0xedbb('0xa8')]({'where':{'OpenchannelAccountId':_0x2b391c[_0xedbb('0x56')]['id']},'order':_0xedbb('0x88')});});}})[_0xedbb('0x22')](respondWithResult(_0x26c22e,null))[_0xedbb('0x55')](handleError(_0x26c22e,null));};exports['getApplications']=function(_0x3557c4,_0x4979a0,_0x40c9ab){var _0x19d61e={};var _0x57f37a={};var _0x317885;var _0x1425ef;return db[_0xedbb('0x3e')][_0xedbb('0x65')]({'where':{'id':_0x3557c4[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x4979a0,null))[_0xedbb('0x22')](function(_0x1cf1dc){if(_0x1cf1dc){_0x317885=_0x1cf1dc;_0x57f37a[_0xedbb('0x41')]=_[_0xedbb('0x43')](db[_0xedbb('0x82')][_0xedbb('0x3f')]);_0x57f37a['query']=_[_0xedbb('0x43')](_0x3557c4[_0xedbb('0x42')]);_0x57f37a[_0xedbb('0x44')]=_[_0xedbb('0x45')](_0x57f37a[_0xedbb('0x41')],_0x57f37a['query']);_0x19d61e['attributes']=_[_0xedbb('0x45')](_0x57f37a['model'],qs['fields'](_0x3557c4[_0xedbb('0x42')][_0xedbb('0x47')]));_0x19d61e[_0xedbb('0x46')]=_0x19d61e[_0xedbb('0x46')]['length']?_0x19d61e[_0xedbb('0x46')]:_0x57f37a['model'];_0x19d61e[_0xedbb('0x4b')]=qs[_0xedbb('0x66')](_0x3557c4[_0xedbb('0x42')][_0xedbb('0x66')]);_0x19d61e['where']=qs['filters'](_[_0xedbb('0x4d')](_0x3557c4['query'],_0x57f37a[_0xedbb('0x44')]));if(_0x3557c4[_0xedbb('0x42')][_0xedbb('0x4e')]){_0x19d61e[_0xedbb('0x4c')]=_['merge'](_0x19d61e['where'],{'$or':_[_0xedbb('0x3d')](_0x19d61e[_0xedbb('0x46')],function(_0x136810){var _0x534ff8={};_0x534ff8[_0x136810]={'$like':'%'+_0x3557c4[_0xedbb('0x42')]['filter']+'%'};return _0x534ff8;})});}_0x19d61e=_[_0xedbb('0x50')]({},_0x19d61e,_0x3557c4[_0xedbb('0x51')]);return _0x317885['getApplications'](_0x19d61e);}})[_0xedbb('0x22')](function(_0x3018da){if(_0x3018da){_0x1425ef=_0x3018da[_0xedbb('0x48')];if(!_0x3557c4[_0xedbb('0x42')]['hasOwnProperty'](_0xedbb('0x4a'))){_0x19d61e[_0xedbb('0x32')]=qs[_0xedbb('0x32')](_0x3557c4['query']['limit']);_0x19d61e[_0xedbb('0x31')]=qs['offset'](_0x3557c4['query'][_0xedbb('0x31')]);}return _0x317885[_0xedbb('0xa9')](_0x19d61e);}})[_0xedbb('0x22')](function(_0x295700){if(_0x295700){return _0x295700?{'count':_0x1425ef,'rows':_0x295700}:null;}})[_0xedbb('0x22')](respondWithResult(_0x4979a0,null))['catch'](handleError(_0x4979a0,null));};exports['getInteractions']=function(_0x31c8a8,_0x2bead6,_0x30c6ef){var _0x339c67={'raw':![],'where':{}};var _0x3d834e={};var _0x372361={'count':0x0,'rows':[]};return db[_0xedbb('0x3e')][_0xedbb('0x65')]({'where':{'id':_0x31c8a8[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x2bead6,null))[_0xedbb('0x22')](function(_0x51ebf2){if(_0x51ebf2){_0x3d834e[_0xedbb('0x41')]=_[_0xedbb('0x43')](db[_0xedbb('0x90')][_0xedbb('0x3f')]);_0x3d834e[_0xedbb('0x42')]=_['keys'](_0x31c8a8[_0xedbb('0x42')]);_0x3d834e[_0xedbb('0x44')]=_[_0xedbb('0x45')](_0x3d834e['model'],_0x3d834e['query']);_0x339c67['attributes']=_['intersection'](_0x3d834e[_0xedbb('0x41')],qs[_0xedbb('0x47')](_0x31c8a8['query'][_0xedbb('0x47')]));_0x339c67[_0xedbb('0x46')]=_0x339c67[_0xedbb('0x46')][_0xedbb('0x48')]?_0x339c67[_0xedbb('0x46')]:_0x3d834e[_0xedbb('0x41')];if(!_0x31c8a8[_0xedbb('0x42')]['hasOwnProperty'](_0xedbb('0x4a'))){_0x339c67[_0xedbb('0x32')]=qs[_0xedbb('0x32')](_0x31c8a8[_0xedbb('0x42')][_0xedbb('0x32')]);_0x339c67['offset']=qs[_0xedbb('0x31')](_0x31c8a8[_0xedbb('0x42')][_0xedbb('0x31')]);}_0x339c67[_0xedbb('0x4b')]=qs[_0xedbb('0x66')](_0x31c8a8[_0xedbb('0x42')][_0xedbb('0x66')]);_0x339c67[_0xedbb('0x4c')]=qs['filters'](_[_0xedbb('0x4d')](_0x31c8a8[_0xedbb('0x42')],_0x3d834e[_0xedbb('0x44')]));_0x339c67[_0xedbb('0x4c')][_0xedbb('0x67')]=_0x51ebf2['id'];if(_0x31c8a8[_0xedbb('0x42')][_0xedbb('0x4e')]){_0x339c67[_0xedbb('0x4c')]=_['merge'](_0x339c67[_0xedbb('0x4c')],{'$or':_[_0xedbb('0x3d')](_0x339c67[_0xedbb('0x46')],function(_0x294e55){var _0x56ea00={};_0x56ea00[_0x294e55]={'$like':'%'+_0x31c8a8[_0xedbb('0x42')][_0xedbb('0x4e')]+'%'};return _0x56ea00;})});}_0x339c67=_[_0xedbb('0x50')]({},_0x339c67,_0x31c8a8['options']);return db[_0xedbb('0x90')]['count']({'where':_0x339c67[_0xedbb('0x4c')]})[_0xedbb('0x22')](function(_0x47a89c){_0x372361[_0xedbb('0x30')]=_0x47a89c;if(_0x31c8a8[_0xedbb('0x42')][_0xedbb('0x52')]){_0x339c67[_0xedbb('0x53')]=[{'model':db[_0xedbb('0x71')],'as':_0xedbb('0xaa'),'required':![]},{'model':db['User'],'as':_0xedbb('0xab'),'attributes':[_0xedbb('0x3a'),_0xedbb('0xac'),_0xedbb('0xad')],'required':![]},{'model':db[_0xedbb('0xae')],'as':'Tags','attributes':['id',_0xedbb('0x3a'),'color'],'where':_0x31c8a8[_0xedbb('0x42')]['tag']?{'id':_0x31c8a8['query']['tag']}:undefined,'required':_0x31c8a8[_0xedbb('0x42')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xedbb('0x54')](_0x339c67);})['then'](function(_0x21c28a){_0x372361[_0xedbb('0x69')]=_0x21c28a;return _0x372361;});}})['then'](respondWithFilteredResult(_0x2bead6,_0x339c67))[_0xedbb('0x55')](handleError(_0x2bead6,null));};exports['addAgents']=function(_0x1b9ec5,_0x521244,_0x4957fd){return db[_0xedbb('0x3e')][_0xedbb('0x57')]({'where':{'id':_0x1b9ec5[_0xedbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x521244,null))[_0xedbb('0x22')](function(_0xb07ab3){if(_0xb07ab3){return _0xb07ab3[_0xedbb('0xaf')](_0x1b9ec5['body']['ids'],_[_0xedbb('0xb0')](_0x1b9ec5[_0xedbb('0x60')],['ids','id'])||{})[_0xedbb('0x92')](function(_0x4be498){for(var _0x2b0e49=0x0;_0x2b0e49<_0x1b9ec5[_0xedbb('0x60')][_0xedbb('0x6b')]['length'];_0x2b0e49+=0x1){socket['emit'](_0xedbb('0xb1'),{'UserId':_0x1b9ec5['body'][_0xedbb('0x6b')][_0x2b0e49],'OpenchannelAccountId':_0x1b9ec5['params']['id']});}return _0x4be498;});}})['then'](respondWithResult(_0x521244,null))['catch'](handleError(_0x521244,null));};exports['removeAgents']=function(_0x11fee4,_0xd8b366,_0x16c9ee){return db['OpenchannelAccount'][_0xedbb('0x57')]({'where':{'id':_0x11fee4[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0xd8b366,null))[_0xedbb('0x22')](function(_0x4f9a85){if(_0x4f9a85){return _0x4f9a85[_0xedbb('0xb2')](_0x11fee4[_0xedbb('0x42')][_0xedbb('0x6b')])[_0xedbb('0x22')](function(){if(_[_0xedbb('0xb3')](_0x11fee4['query']['ids'])){for(var _0x5c4856=0x0;_0x5c4856<_0x11fee4['query'][_0xedbb('0x6b')][_0xedbb('0x48')];_0x5c4856+=0x1){socket['emit'](_0xedbb('0xb4'),{'UserId':Number(_0x11fee4[_0xedbb('0x42')][_0xedbb('0x6b')][_0x5c4856]),'OpenchannelAccountId':Number(_0x11fee4[_0xedbb('0x56')]['id'])});}}else{socket[_0xedbb('0xb5')](_0xedbb('0xb4'),{'UserId':Number(_0x11fee4['query'][_0xedbb('0x6b')]),'OpenchannelAccountId':Number(_0x11fee4[_0xedbb('0x56')]['id'])});}});}})[_0xedbb('0x22')](respondWithStatusCode(_0xd8b366,null))[_0xedbb('0x55')](handleError(_0xd8b366,null));};exports[_0xedbb('0xb6')]=function(_0x174cc2,_0x3da254,_0x44e8c9){var _0x1afc49={};var _0x3fc3f3={};var _0xc208f2;var _0x232e5b;return db[_0xedbb('0x3e')][_0xedbb('0x65')]({'where':{'id':_0x174cc2[_0xedbb('0x56')]['id']}})[_0xedbb('0x22')](handleEntityNotFound(_0x3da254,null))[_0xedbb('0x22')](function(_0x42a047){if(_0x42a047){_0xc208f2=_0x42a047;_0x3fc3f3['model']=_[_0xedbb('0x43')](db[_0xedbb('0x9c')][_0xedbb('0x3f')]);_0x3fc3f3[_0xedbb('0x42')]=_[_0xedbb('0x43')](_0x174cc2[_0xedbb('0x42')]);_0x3fc3f3[_0xedbb('0x44')]=_[_0xedbb('0x45')](_0x3fc3f3['model'],_0x3fc3f3[_0xedbb('0x42')]);_0x1afc49[_0xedbb('0x46')]=_[_0xedbb('0x45')](_0x3fc3f3[_0xedbb('0x41')],qs[_0xedbb('0x47')](_0x174cc2[_0xedbb('0x42')][_0xedbb('0x47')]));_0x1afc49['attributes']=_0x1afc49[_0xedbb('0x46')][_0xedbb('0x48')]?_0x1afc49[_0xedbb('0x46')]:_0x3fc3f3['model'];_0x1afc49[_0xedbb('0x4b')]=qs[_0xedbb('0x66')](_0x174cc2[_0xedbb('0x42')]['sort']);_0x1afc49[_0xedbb('0x4c')]=qs['filters'](_[_0xedbb('0x4d')](_0x174cc2[_0xedbb('0x42')],_0x3fc3f3[_0xedbb('0x44')]));if(_0x174cc2['query'][_0xedbb('0x4e')]){_0x1afc49[_0xedbb('0x4c')]=_[_0xedbb('0x50')](_0x1afc49[_0xedbb('0x4c')],{'$or':_['map'](_0x1afc49['attributes'],function(_0x85837e){var _0x2fc3f4={};_0x2fc3f4[_0x85837e]={'$like':'%'+_0x174cc2[_0xedbb('0x42')]['filter']+'%'};return _0x2fc3f4;})});}_0x1afc49=_[_0xedbb('0x50')]({},_0x1afc49,_0x174cc2['options']);return _0xc208f2['getAgents'](_0x1afc49);}})[_0xedbb('0x22')](function(_0x494d80){if(_0x494d80){_0x232e5b=_0x494d80['length'];if(!_0x174cc2[_0xedbb('0x42')]['hasOwnProperty'](_0xedbb('0x4a'))){_0x1afc49[_0xedbb('0x32')]=qs[_0xedbb('0x32')](_0x174cc2[_0xedbb('0x42')][_0xedbb('0x32')]);_0x1afc49['offset']=qs[_0xedbb('0x31')](_0x174cc2['query'][_0xedbb('0x31')]);}return _0xc208f2['getAgents'](_0x1afc49);}})['then'](function(_0x3ad0af){if(_0x3ad0af){return _0x3ad0af?{'count':_0x232e5b,'rows':_0x3ad0af}:null;}})[_0xedbb('0x22')](respondWithResult(_0x3da254,null))[_0xedbb('0x55')](handleError(_0x3da254,null));};exports['send']=function(_0x4ac6f4,_0x2906d1,_0x5f452a){var _0xfaaea0,_0x5edfdc,_0x304049;if(_[_0xedbb('0x78')](_0x4ac6f4[_0xedbb('0x60')][_0xedbb('0x60')])||_0x4ac6f4[_0xedbb('0x60')]['body']===''){throw new db[(_0xedbb('0x1f'))][(_0xedbb('0x72'))](_0xedbb('0x7b'));}if(_[_0xedbb('0x78')](_0x4ac6f4[_0xedbb('0x60')]['to'])){}_0xfaaea0=_0x4ac6f4['body']['to'];return db[_0xedbb('0x3e')][_0xedbb('0x65')]({'where':{'id':_0x4ac6f4[_0xedbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2906d1,null))[_0xedbb('0x22')](function(_0x4b68d9){if(_0x4b68d9){return db['OpenchannelAccount']['find']({'where':{'id':_0x4b68d9['id']},'include':[{'model':db['CmList'],'as':_0xedbb('0x80'),'include':[{'model':db[_0xedbb('0x71')],'as':'Contacts','where':{[_0x4b68d9[_0xedbb('0x7c')]]:_0xfaaea0},'limit':0x1,'order':[['updatedAt',_0xedbb('0x81')]]}]}]})[_0xedbb('0x22')](handleEntityNotFound(_0x2906d1,null))['then'](function(_0x104a50){if(_0x104a50&&_0x104a50['List']){_0x5edfdc=_0x104a50[_0xedbb('0x38')]({'plain':!![]});if(_0x5edfdc[_0xedbb('0x80')]&&_0x5edfdc[_0xedbb('0x80')]['Contacts'][_0xedbb('0x48')]){return _0x5edfdc[_0xedbb('0x80')][_0xedbb('0x8a')][0x0];}return db['CmContact']['create'](_[_0xedbb('0x15')](_0x4ac6f4[_0xedbb('0x60')],{'firstName':_0xfaaea0,[_0x104a50[_0xedbb('0x7c')]]:_0xfaaea0,'phone':_0xfaaea0,'ListId':_0x5edfdc[_0xedbb('0x77')]}));}})[_0xedbb('0x22')](handleEntityNotFound(_0x2906d1,null))[_0xedbb('0x22')](function(_0x253c4a){if(_0x253c4a){_0x304049=_0x253c4a;return db[_0xedbb('0x90')][_0xedbb('0x57')]({'where':{'ContactId':_0x304049['id'],'closed':![],'OpenchannelAccountId':_0x5edfdc['id']}})['then'](function(_0x4679cc){if(_0x4679cc){return[_0x4679cc,![]];}return db[_0xedbb('0x90')][_0xedbb('0x58')]({'UserId':_0x4ac6f4[_0xedbb('0x59')]['id'],'ContactId':_0x304049['id'],'OpenchannelAccountId':_0x5edfdc['id'],'lastMsgDirection':_0xedbb('0xb7'),'Messages':[_[_0xedbb('0x50')](_0x4ac6f4[_0xedbb('0x60')],{'read':![],'body':_0x4ac6f4[_0xedbb('0x60')][_0xedbb('0x60')],'OpenchannelAccountId':_0x5edfdc['id'],'UserId':_0x4ac6f4[_0xedbb('0x59')]['id'],'ContactId':_0x304049['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xedbb('0xb8')}]})['then'](function(_0x292991){return[_0x292991,!![]];});});}})['spread'](function(_0x4823b9,_0x1e099a){if(_0x1e099a){return _0x4823b9;}return db['OpenchannelMessage'][_0xedbb('0x58')](_[_0xedbb('0x50')](_0x4ac6f4[_0xedbb('0x60')],{'read':![],'body':_0x4ac6f4[_0xedbb('0x60')][_0xedbb('0x60')],'OpenchannelAccountId':_0x5edfdc['id'],'OpenchannelInteractionId':_0x4823b9['id'],'UserId':_0x4ac6f4[_0xedbb('0x59')]['id'],'ContactId':_0x304049['id']}))[_0xedbb('0x22')](function(_0x51aa60){_0x4823b9['dataValues'][_0xedbb('0xb8')]=[];_0x4823b9['dataValues'][_0xedbb('0xb8')][_0xedbb('0x96')](_0x51aa60[_0xedbb('0xb9')]);return _0x4823b9;});});}})[_0xedbb('0x22')](respondWithResult(_0x2906d1,null))[_0xedbb('0x55')](handleError(_0x2906d1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9972210..3f365c8 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 _0xbb35=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xbb35,0x143));var _0x5bb3=function(_0x5bb230,_0x35dd38){_0x5bb230=_0x5bb230-0x0;var _0x1c92b0=_0xbb35[_0x5bb230];return _0x1c92b0;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x5bb3('0x0'))['db'][_0x5bb3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5bb3('0x2')](0x0);var events={'afterCreate':_0x5bb3('0x3'),'afterUpdate':'update','afterDestroy':_0x5bb3('0x4')};function emitEvent(_0x56afbd){return function(_0x3b0e56,_0x1322f5,_0x5684af){OpenchannelAccountEvents[_0x5bb3('0x5')](_0x56afbd+':'+_0x3b0e56['id'],_0x3b0e56);OpenchannelAccountEvents[_0x5bb3('0x5')](_0x56afbd,_0x3b0e56);_0x5684af(null);};}for(var e in events){if(events[_0x5bb3('0x6')](e)){var event=events[e];OpenchannelAccount[_0x5bb3('0x7')](e,emitEvent(event));}}module[_0x5bb3('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5ff2=['exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x34fc8b,_0x217c1c){var _0x4ad153=function(_0x4569c1){while(--_0x4569c1){_0x34fc8b['push'](_0x34fc8b['shift']());}};_0x4ad153(++_0x217c1c);}(_0x5ff2,0x65));var _0x25ff=function(_0x248c51,_0xdf9962){_0x248c51=_0x248c51-0x0;var _0x28c4ce=_0x5ff2[_0x248c51];return _0x28c4ce;};'use strict';var EventEmitter=require(_0x25ff('0x0'));var OpenchannelAccount=require(_0x25ff('0x1'))['db'][_0x25ff('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x25ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x25ff('0x4'),'afterDestroy':_0x25ff('0x5')};function emitEvent(_0x156f3a){return function(_0x2279ba,_0x36ca1c,_0x4f4a14){OpenchannelAccountEvents[_0x25ff('0x6')](_0x156f3a+':'+_0x2279ba['id'],_0x2279ba);OpenchannelAccountEvents[_0x25ff('0x6')](_0x156f3a,_0x2279ba);_0x4f4a14(null);};}for(var e in events){if(events[_0x25ff('0x7')](e)){var event=events[e];OpenchannelAccount[_0x25ff('0x8')](e,emitEvent(event));}}module[_0x25ff('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c679245..0d6e204 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 _0x7882=['exports','OpenchannelAccount','openchannel_accounts','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5cbc77,_0x50a049){var _0x1e6c64=function(_0x3095cb){while(--_0x3095cb){_0x5cbc77['push'](_0x5cbc77['shift']());}};_0x1e6c64(++_0x50a049);}(_0x7882,0xe9));var _0x2788=function(_0x3763da,_0x58158b){_0x3763da=_0x3763da-0x0;var _0x5d192f=_0x7882[_0x3763da];return _0x5d192f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2788('0x0'))(_0x2788('0x1'));var moment=require('moment');var BPromise=require(_0x2788('0x2'));var rp=require(_0x2788('0x3'));var fs=require('fs');var path=require(_0x2788('0x4'));var rimraf=require(_0x2788('0x5'));var config=require(_0x2788('0x6'));var attributes=require('./openchannelAccount.attributes');module[_0x2788('0x7')]=function(_0x4a3e96,_0x5d1ccf){return _0x4a3e96['define'](_0x2788('0x8'),attributes,{'tableName':_0x2788('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd469=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelAccount','openchannel_accounts','lodash'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xd469,0x16b));var _0x9d46=function(_0x2f28fb,_0x506bbd){_0x2f28fb=_0x2f28fb-0x0;var _0x1c03e3=_0xd469[_0x2f28fb];return _0x1c03e3;};'use strict';var _=require(_0x9d46('0x0'));var util=require(_0x9d46('0x1'));var logger=require(_0x9d46('0x2'))(_0x9d46('0x3'));var moment=require(_0x9d46('0x4'));var BPromise=require(_0x9d46('0x5'));var rp=require(_0x9d46('0x6'));var fs=require('fs');var path=require(_0x9d46('0x7'));var rimraf=require(_0x9d46('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module[_0x9d46('0x9')]=function(_0x204b1f,_0x220ea5){return _0x204b1f[_0x9d46('0xa')](_0x9d46('0xb'),attributes,{'tableName':_0x9d46('0xc'),'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 4941c3f..6eaba8f 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 _0x3a0f=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x26ba02,_0x105fb2){var _0x1fe287=function(_0x42f917){while(--_0x42f917){_0x26ba02['push'](_0x26ba02['shift']());}};_0x1fe287(++_0x105fb2);}(_0x3a0f,0x95));var _0xf3a0=function(_0x101fd3,_0x5909f0){_0x101fd3=_0x101fd3-0x0;var _0x5b15fb=_0x3a0f[_0x101fd3];return _0x5b15fb;};'use strict';var _=require(_0xf3a0('0x0'));var util=require(_0xf3a0('0x1'));var moment=require(_0xf3a0('0x2'));var BPromise=require(_0xf3a0('0x3'));var rs=require(_0xf3a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3a0('0x5'));var logger=require('../../config/logger')(_0xf3a0('0x6'));var config=require(_0xf3a0('0x7'));var jayson=require(_0xf3a0('0x8'));var client=jayson['client'][_0xf3a0('0x9')]({'port':0x232a});config[_0xf3a0('0xa')]=_[_0xf3a0('0xb')](config[_0xf3a0('0xa')],{'host':_0xf3a0('0xc'),'port':0x18eb});var socket=require(_0xf3a0('0xd'))(new Redis(config[_0xf3a0('0xa')]));require(_0xf3a0('0xe'))[_0xf3a0('0xf')](socket);function respondWithRpcPromise(_0x3f00d6,_0x326154,_0x1cccc3){return new BPromise(function(_0x35e4cc,_0x2384aa){return client[_0xf3a0('0x10')](_0x3f00d6,_0x1cccc3)['then'](function(_0x269a52){logger['info'](_0xf3a0('0x11'),_0x326154,_0xf3a0('0x12'));logger[_0xf3a0('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x326154,_0xf3a0('0x12'),JSON[_0xf3a0('0x14')](_0x269a52));if(_0x269a52[_0xf3a0('0x15')]){if(_0x269a52[_0xf3a0('0x15')][_0xf3a0('0x16')]===0x1f4){logger[_0xf3a0('0x15')](_0xf3a0('0x11'),_0x326154,_0x269a52[_0xf3a0('0x15')][_0xf3a0('0x17')]);return _0x2384aa(_0x269a52[_0xf3a0('0x15')][_0xf3a0('0x17')]);}logger[_0xf3a0('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x326154,_0x269a52['error'][_0xf3a0('0x17')]);return _0x35e4cc(_0x269a52[_0xf3a0('0x15')]['message']);}else{logger[_0xf3a0('0x18')](_0xf3a0('0x11'),_0x326154,_0xf3a0('0x12'));_0x35e4cc(_0x269a52[_0xf3a0('0x19')][_0xf3a0('0x17')]);}})[_0xf3a0('0x1a')](function(_0x6b1798){logger[_0xf3a0('0x15')](_0xf3a0('0x11'),_0x326154,_0x6b1798);_0x2384aa(_0x6b1798);});});} \ No newline at end of file +var _0xeef4=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2f1056,_0x2322f1){var _0xeb59b5=function(_0x31cf68){while(--_0x31cf68){_0x2f1056['push'](_0x2f1056['shift']());}};_0xeb59b5(++_0x2322f1);}(_0xeef4,0x1b3));var _0x4eef=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0xeef4[_0x3fb030];return _0xd6899b;};'use strict';var _=require(_0x4eef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4eef('0x1'));var rs=require(_0x4eef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4eef('0x3'))['db'];var utils=require(_0x4eef('0x4'));var logger=require(_0x4eef('0x5'))(_0x4eef('0x6'));var config=require(_0x4eef('0x7'));var jayson=require(_0x4eef('0x8'));var client=jayson[_0x4eef('0x9')][_0x4eef('0xa')]({'port':0x232a});config['redis']=_[_0x4eef('0xb')](config['redis'],{'host':_0x4eef('0xc'),'port':0x18eb});var socket=require(_0x4eef('0xd'))(new Redis(config['redis']));require(_0x4eef('0xe'))[_0x4eef('0xf')](socket);function respondWithRpcPromise(_0x3b6c43,_0x958b4d,_0x51f38c){return new BPromise(function(_0x481fc9,_0x590cd6){return client[_0x4eef('0x10')](_0x3b6c43,_0x51f38c)[_0x4eef('0x11')](function(_0x3ccdc9){logger[_0x4eef('0x12')](_0x4eef('0x13'),_0x958b4d,_0x4eef('0x14'));logger[_0x4eef('0x15')](_0x4eef('0x16'),_0x958b4d,_0x4eef('0x14'),JSON[_0x4eef('0x17')](_0x3ccdc9));if(_0x3ccdc9['error']){if(_0x3ccdc9[_0x4eef('0x18')][_0x4eef('0x19')]===0x1f4){logger[_0x4eef('0x18')](_0x4eef('0x13'),_0x958b4d,_0x3ccdc9['error'][_0x4eef('0x1a')]);return _0x590cd6(_0x3ccdc9['error']['message']);}logger[_0x4eef('0x18')](_0x4eef('0x13'),_0x958b4d,_0x3ccdc9['error'][_0x4eef('0x1a')]);return _0x481fc9(_0x3ccdc9[_0x4eef('0x18')][_0x4eef('0x1a')]);}else{logger[_0x4eef('0x12')](_0x4eef('0x13'),_0x958b4d,_0x4eef('0x14'));_0x481fc9(_0x3ccdc9[_0x4eef('0x1b')]['message']);}})[_0x4eef('0x1c')](function(_0x25d2bd){logger['error'](_0x4eef('0x13'),_0x958b4d,_0x25d2bd);_0x590cd6(_0x25d2bd);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index dcaed90..25eef25 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 _0xdf8f=['./openchannelAccount.events','remove','update','length'];(function(_0x139b22,_0x5f28b8){var _0x14f737=function(_0x495609){while(--_0x495609){_0x139b22['push'](_0x139b22['shift']());}};_0x14f737(++_0x5f28b8);}(_0xdf8f,0x1f0));var _0xfdf8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdf8f[_0x122ef9];return _0x42fba0;};'use strict';var OpenchannelAccountEvents=require(_0xfdf8('0x0'));var events=['save',_0xfdf8('0x1'),_0xfdf8('0x2')];function createListener(_0x263c20,_0x357518){return function(_0x2a8406){_0x357518['emit'](_0x263c20,_0x2a8406);};}function removeListener(_0x1e4f01,_0xd8cf35){return function(){OpenchannelAccountEvents['removeListener'](_0x1e4f01,_0xd8cf35);};}exports['register']=function(_0x31cdc9){for(var _0x406b26=0x0,_0x40b33f=events[_0xfdf8('0x3')];_0x406b26<_0x40b33f;_0x406b26++){var _0x5c3cb2=events[_0x406b26];var _0x5f00b8=createListener('openchannelAccount:'+_0x5c3cb2,_0x31cdc9);OpenchannelAccountEvents['on'](_0x5c3cb2,_0x5f00b8);}}; \ No newline at end of file +var _0xe401=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x4f7eac,_0x4fbf84){var _0x25495f=function(_0x143fc6){while(--_0x143fc6){_0x4f7eac['push'](_0x4f7eac['shift']());}};_0x25495f(++_0x4fbf84);}(_0xe401,0x142));var _0x1e40=function(_0x297741,_0x21136a){_0x297741=_0x297741-0x0;var _0x62dd73=_0xe401[_0x297741];return _0x62dd73;};'use strict';var OpenchannelAccountEvents=require(_0x1e40('0x0'));var events=[_0x1e40('0x1'),_0x1e40('0x2'),_0x1e40('0x3')];function createListener(_0x24166f,_0xd2b418){return function(_0x2f6fb0){_0xd2b418[_0x1e40('0x4')](_0x24166f,_0x2f6fb0);};}function removeListener(_0x2e7fb8,_0x18d2d8){return function(){OpenchannelAccountEvents[_0x1e40('0x5')](_0x2e7fb8,_0x18d2d8);};}exports[_0x1e40('0x6')]=function(_0x48c8c3){for(var _0x35aead=0x0,_0x143295=events[_0x1e40('0x7')];_0x35aead<_0x143295;_0x35aead++){var _0x4fc504=events[_0x35aead];var _0x53f9d1=createListener(_0x1e40('0x8')+_0x4fc504,_0x48c8c3);OpenchannelAccountEvents['on'](_0x4fc504,_0x53f9d1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2e68ad7..0dbddb4 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 _0xedf5=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','create','exports','multer','util','path'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xedf5,0x1dd));var _0x5edf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedf5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5edf('0x0'));var util=require(_0x5edf('0x1'));var path=require(_0x5edf('0x2'));var timeout=require(_0x5edf('0x3'));var express=require(_0x5edf('0x4'));var router=express[_0x5edf('0x5')]();var auth=require(_0x5edf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5edf('0x7'));var controller=require(_0x5edf('0x8'));router['get']('/',auth[_0x5edf('0x9')](),controller[_0x5edf('0xa')]);router['get'](_0x5edf('0xb'),auth[_0x5edf('0x9')](),controller[_0x5edf('0xc')]);router[_0x5edf('0xd')]('/',auth[_0x5edf('0x9')](),controller[_0x5edf('0xe')]);router['put'](_0x5edf('0xb'),auth[_0x5edf('0x9')](),controller['update']);router['delete'](_0x5edf('0xb'),auth[_0x5edf('0x9')](),controller['destroy']);module[_0x5edf('0xf')]=router; \ No newline at end of file +var _0x3532=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x6c9ae2,_0x2ccb05){var _0x510425=function(_0x29be60){while(--_0x29be60){_0x6c9ae2['push'](_0x6c9ae2['shift']());}};_0x510425(++_0x2ccb05);}(_0x3532,0x96));var _0x2353=function(_0x17cdb0,_0x200508){_0x17cdb0=_0x17cdb0-0x0;var _0x516736=_0x3532[_0x17cdb0];return _0x516736;};'use strict';var multer=require('multer');var util=require(_0x2353('0x0'));var path=require(_0x2353('0x1'));var timeout=require(_0x2353('0x2'));var express=require(_0x2353('0x3'));var router=express[_0x2353('0x4')]();var auth=require(_0x2353('0x5'));var interaction=require(_0x2353('0x6'));var config=require('../../config/environment');var controller=require(_0x2353('0x7'));router[_0x2353('0x8')]('/',auth[_0x2353('0x9')](),controller[_0x2353('0xa')]);router[_0x2353('0x8')](_0x2353('0xb'),auth[_0x2353('0x9')](),controller['show']);router['post']('/',auth[_0x2353('0x9')](),controller[_0x2353('0xc')]);router[_0x2353('0xd')](_0x2353('0xb'),auth[_0x2353('0x9')](),controller[_0x2353('0xe')]);router['delete']('/:id',auth[_0x2353('0x9')](),controller[_0x2353('0xf')]);module[_0x2353('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 76b60cf..73a9424 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 _0xf3fe=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0xf3fe,0x98));var _0xef3f=function(_0x39a952,_0x17df77){_0x39a952=_0x39a952-0x0;var _0x249b08=_0xf3fe[_0x39a952];return _0x249b08;};'use strict';var Sequelize=require('sequelize');module[_0xef3f('0x0')]={'priority':{'type':Sequelize[_0xef3f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xef3f('0x2')],'allowNull':![],'defaultValue':_0xef3f('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xef3f('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xef3f('0x4')}}; \ No newline at end of file +var _0x4ad2=['*,*,*,*','exports','noop','TEXT','STRING'];(function(_0xf3d32c,_0xd29dcc){var _0x4516e6=function(_0x236a34){while(--_0x236a34){_0xf3d32c['push'](_0xf3d32c['shift']());}};_0x4516e6(++_0xd29dcc);}(_0x4ad2,0x155));var _0x24ad=function(_0x2708f3,_0x20ec17){_0x2708f3=_0x2708f3-0x0;var _0x5d8bad=_0x4ad2[_0x2708f3];return _0x5d8bad;};'use strict';var Sequelize=require('sequelize');module[_0x24ad('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x24ad('0x1')},'appdata':{'type':Sequelize[_0x24ad('0x2')]()},'description':{'type':Sequelize[_0x24ad('0x3')]},'interval':{'type':Sequelize[_0x24ad('0x3')],'defaultValue':_0x24ad('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 581a862..9318f82 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 _0xd990=['VIRTUAL','options','OpenchannelApplication','includeAll','include','show','params','keys','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd990,0x9c));var _0x0d99=function(_0x4fb3a1,_0x22e8f0){_0x4fb3a1=_0x4fb3a1-0x0;var _0x2ba272=_0xd990[_0x4fb3a1];return _0x2ba272;};'use strict';var pdf=require(_0x0d99('0x0'));var emlformat=require(_0x0d99('0x1'));var rimraf=require(_0x0d99('0x2'));var zipdir=require(_0x0d99('0x3'));var jsonpatch=require(_0x0d99('0x4'));var rp=require('request-promise');var moment=require(_0x0d99('0x5'));var BPromise=require(_0x0d99('0x6'));var Mustache=require(_0x0d99('0x7'));var util=require(_0x0d99('0x8'));var path=require(_0x0d99('0x9'));var sox=require('sox');var csv=require(_0x0d99('0xa'));var ejs=require(_0x0d99('0xb'));var fs=require('fs');var _=require(_0x0d99('0xc'));var squel=require(_0x0d99('0xd'));var crypto=require(_0x0d99('0xe'));var jsforce=require(_0x0d99('0xf'));var deskjs=require(_0x0d99('0x10'));var toCsv=require(_0x0d99('0xa'));var querystring=require(_0x0d99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0d99('0x12'));var authService=require(_0x0d99('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0d99('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d99('0x15'))(_0x0d99('0x16'));var utils=require('../../config/utils');var config=require(_0x0d99('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b8b89,_0x503a9c){_0x503a9c=_0x503a9c||0xcc;return function(_0x5f1c1c){if(_0x5f1c1c){return _0x5b8b89[_0x0d99('0x18')](_0x503a9c);}return _0x5b8b89[_0x0d99('0x19')](_0x503a9c)[_0x0d99('0x1a')]();};}function respondWithResult(_0x5cf691,_0x41b299){_0x41b299=_0x41b299||0xc8;return function(_0x43e903){if(_0x43e903){return _0x5cf691['status'](_0x41b299)[_0x0d99('0x1b')](_0x43e903);}};}function respondWithFilteredResult(_0x604f51,_0x35b684){return function(_0x393c8a){if(_0x393c8a){var _0x40c584=_0x393c8a[_0x0d99('0x1c')],_0x5b87f9=_0x35b684[_0x0d99('0x1d')],_0x30406e=_0x35b684['offset']+_0x35b684[_0x0d99('0x1e')],_0x3c5c96;if(_0x30406e>=_0x40c584){_0x30406e=_0x40c584;_0x3c5c96=0xc8;}else{_0x3c5c96=0xce;}_0x604f51['status'](_0x3c5c96);return _0x604f51[_0x0d99('0x1f')](_0x0d99('0x20'),_0x5b87f9+'-'+_0x30406e+'/'+_0x40c584)['json'](_0x393c8a);}return null;};}function patchUpdates(_0x3b7e59){return function(_0x103e8d){try{jsonpatch[_0x0d99('0x21')](_0x103e8d,_0x3b7e59,!![]);}catch(_0x130d91){return BPromise[_0x0d99('0x22')](_0x130d91);}return _0x103e8d[_0x0d99('0x23')]();};}function saveUpdates(_0x1240ee,_0xbde07c){return function(_0x2cc765){if(_0x2cc765){return _0x2cc765[_0x0d99('0x24')](_0x1240ee)[_0x0d99('0x25')](function(_0xb13989){return _0xb13989;});}return null;};}function removeEntity(_0x21f1a0,_0x516cc7){return function(_0xfef6cb){if(_0xfef6cb){return _0xfef6cb[_0x0d99('0x26')]()[_0x0d99('0x25')](function(){_0x21f1a0[_0x0d99('0x19')](0xcc)[_0x0d99('0x1a')]();});}};}function handleEntityNotFound(_0x94ec32,_0x84fbc8){return function(_0x13cbf4){if(!_0x13cbf4){_0x94ec32['sendStatus'](0x194);}return _0x13cbf4;};}function handleError(_0x176796,_0x597ce6){_0x597ce6=_0x597ce6||0x1f4;return function(_0x54a8db){logger['error'](_0x54a8db['stack']);if(_0x54a8db['name']){delete _0x54a8db[_0x0d99('0x27')];}_0x176796[_0x0d99('0x19')](_0x597ce6)[_0x0d99('0x28')](_0x54a8db);};}exports[_0x0d99('0x29')]=function(_0x462c57,_0x2fa95b){var _0x1c811c={},_0x4e9cfc={},_0x570f05={'count':0x0,'rows':[]};var _0x54bf87=_[_0x0d99('0x2a')](db['OpenchannelApplication']['rawAttributes'],function(_0x4c5918){return{'name':_0x4c5918[_0x0d99('0x2b')],'type':_0x4c5918[_0x0d99('0x2c')][_0x0d99('0x2d')]};});_0x4e9cfc['model']=_['map'](_0x54bf87,_0x0d99('0x27'));_0x4e9cfc[_0x0d99('0x2e')]=_['keys'](_0x462c57[_0x0d99('0x2e')]);_0x4e9cfc[_0x0d99('0x2f')]=_['intersection'](_0x4e9cfc['model'],_0x4e9cfc[_0x0d99('0x2e')]);_0x1c811c[_0x0d99('0x30')]=_[_0x0d99('0x31')](_0x4e9cfc[_0x0d99('0x32')],qs[_0x0d99('0x33')](_0x462c57[_0x0d99('0x2e')][_0x0d99('0x33')]));_0x1c811c['attributes']=_0x1c811c['attributes'][_0x0d99('0x34')]?_0x1c811c[_0x0d99('0x30')]:_0x4e9cfc[_0x0d99('0x32')];if(!_0x462c57[_0x0d99('0x2e')][_0x0d99('0x35')](_0x0d99('0x36'))){_0x1c811c[_0x0d99('0x1e')]=qs[_0x0d99('0x1e')](_0x462c57['query'][_0x0d99('0x1e')]);_0x1c811c[_0x0d99('0x1d')]=qs[_0x0d99('0x1d')](_0x462c57[_0x0d99('0x2e')][_0x0d99('0x1d')]);}_0x1c811c[_0x0d99('0x37')]=qs[_0x0d99('0x38')](_0x462c57[_0x0d99('0x2e')][_0x0d99('0x38')]);_0x1c811c[_0x0d99('0x39')]=qs[_0x0d99('0x2f')](_['pick'](_0x462c57['query'],_0x4e9cfc[_0x0d99('0x2f')]),_0x54bf87);if(_0x462c57[_0x0d99('0x2e')][_0x0d99('0x3a')]){_0x1c811c[_0x0d99('0x39')]=_[_0x0d99('0x3b')](_0x1c811c[_0x0d99('0x39')],{'$or':_[_0x0d99('0x2a')](_0x54bf87,function(_0xffaa4d){if(_0xffaa4d[_0x0d99('0x2c')]!==_0x0d99('0x3c')){var _0x204b9c={};_0x204b9c[_0xffaa4d[_0x0d99('0x27')]]={'$like':'%'+_0x462c57[_0x0d99('0x2e')][_0x0d99('0x3a')]+'%'};return _0x204b9c;}})});}_0x1c811c=_[_0x0d99('0x3b')]({},_0x1c811c,_0x462c57[_0x0d99('0x3d')]);var _0x73ba00={'where':_0x1c811c['where']};return db[_0x0d99('0x3e')][_0x0d99('0x1c')](_0x73ba00)['then'](function(_0x1b0d18){_0x570f05[_0x0d99('0x1c')]=_0x1b0d18;if(_0x462c57[_0x0d99('0x2e')][_0x0d99('0x3f')]){_0x1c811c[_0x0d99('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x1c811c);})[_0x0d99('0x25')](function(_0x35f05d){_0x570f05['rows']=_0x35f05d;return _0x570f05;})['then'](respondWithFilteredResult(_0x2fa95b,_0x1c811c))['catch'](handleError(_0x2fa95b,null));};exports[_0x0d99('0x41')]=function(_0x49d7ee,_0x490b06){var _0x5e1b95={'raw':!![],'where':{'id':_0x49d7ee[_0x0d99('0x42')]['id']}},_0x4cd419={};_0x4cd419[_0x0d99('0x32')]=_[_0x0d99('0x43')](db[_0x0d99('0x3e')]['rawAttributes']);_0x4cd419[_0x0d99('0x2e')]=_['keys'](_0x49d7ee[_0x0d99('0x2e')]);_0x4cd419[_0x0d99('0x2f')]=_['intersection'](_0x4cd419[_0x0d99('0x32')],_0x4cd419[_0x0d99('0x2e')]);_0x5e1b95['attributes']=_[_0x0d99('0x31')](_0x4cd419[_0x0d99('0x32')],qs[_0x0d99('0x33')](_0x49d7ee[_0x0d99('0x2e')][_0x0d99('0x33')]));_0x5e1b95[_0x0d99('0x30')]=_0x5e1b95[_0x0d99('0x30')]['length']?_0x5e1b95[_0x0d99('0x30')]:_0x4cd419['model'];if(_0x49d7ee[_0x0d99('0x2e')][_0x0d99('0x3f')]){_0x5e1b95['include']=[{'all':!![]}];}_0x5e1b95=_[_0x0d99('0x3b')]({},_0x5e1b95,_0x49d7ee[_0x0d99('0x3d')]);return db[_0x0d99('0x3e')][_0x0d99('0x44')](_0x5e1b95)[_0x0d99('0x25')](handleEntityNotFound(_0x490b06,null))[_0x0d99('0x25')](respondWithResult(_0x490b06,null))[_0x0d99('0x45')](handleError(_0x490b06,null));};exports[_0x0d99('0x46')]=function(_0x4278d7,_0x52af7c){return db[_0x0d99('0x3e')][_0x0d99('0x46')](_0x4278d7[_0x0d99('0x47')],{})[_0x0d99('0x25')](respondWithResult(_0x52af7c,0xc9))[_0x0d99('0x45')](handleError(_0x52af7c,null));};exports['update']=function(_0x9b7d93,_0x409a38){if(_0x9b7d93[_0x0d99('0x47')]['id']){delete _0x9b7d93[_0x0d99('0x47')]['id'];}return db[_0x0d99('0x3e')][_0x0d99('0x44')]({'where':{'id':_0x9b7d93[_0x0d99('0x42')]['id']}})[_0x0d99('0x25')](handleEntityNotFound(_0x409a38,null))['then'](saveUpdates(_0x9b7d93[_0x0d99('0x47')],null))[_0x0d99('0x25')](respondWithResult(_0x409a38,null))['catch'](handleError(_0x409a38,null));};exports[_0x0d99('0x26')]=function(_0x1c24bf,_0x3fd53d){return db[_0x0d99('0x3e')]['find']({'where':{'id':_0x1c24bf['params']['id']}})['then'](handleEntityNotFound(_0x3fd53d,null))[_0x0d99('0x25')](removeEntity(_0x3fd53d,null))[_0x0d99('0x45')](handleError(_0x3fd53d,null));}; \ No newline at end of file +var _0xc49d=['order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','../../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','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x57eadc,_0x353afb){var _0xbbbf50=function(_0x4edd12){while(--_0x4edd12){_0x57eadc['push'](_0x57eadc['shift']());}};_0xbbbf50(++_0x353afb);}(_0xc49d,0xa5));var _0xdc49=function(_0x10075a,_0x55e1b5){_0x10075a=_0x10075a-0x0;var _0x558368=_0xc49d[_0x10075a];return _0x558368;};'use strict';var pdf=require(_0xdc49('0x0'));var emlformat=require(_0xdc49('0x1'));var rimraf=require(_0xdc49('0x2'));var zipdir=require(_0xdc49('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc49('0x4'));var moment=require(_0xdc49('0x5'));var BPromise=require(_0xdc49('0x6'));var Mustache=require(_0xdc49('0x7'));var util=require(_0xdc49('0x8'));var path=require(_0xdc49('0x9'));var sox=require(_0xdc49('0xa'));var csv=require(_0xdc49('0xb'));var ejs=require(_0xdc49('0xc'));var fs=require('fs');var _=require(_0xdc49('0xd'));var squel=require(_0xdc49('0xe'));var crypto=require(_0xdc49('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc49('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdc49('0x10'));var qs=require(_0xdc49('0x11'));var as=require(_0xdc49('0x12'));var hardwareService=require(_0xdc49('0x13'));var logger=require(_0xdc49('0x14'))(_0xdc49('0x15'));var utils=require(_0xdc49('0x16'));var config=require(_0xdc49('0x17'));var db=require(_0xdc49('0x18'))['db'];function respondWithStatusCode(_0x5408f5,_0x80e255){_0x80e255=_0x80e255||0xcc;return function(_0x2817fa){if(_0x2817fa){return _0x5408f5[_0xdc49('0x19')](_0x80e255);}return _0x5408f5[_0xdc49('0x1a')](_0x80e255)[_0xdc49('0x1b')]();};}function respondWithResult(_0x291dff,_0x542a1d){_0x542a1d=_0x542a1d||0xc8;return function(_0x3baa72){if(_0x3baa72){return _0x291dff[_0xdc49('0x1a')](_0x542a1d)[_0xdc49('0x1c')](_0x3baa72);}};}function respondWithFilteredResult(_0x165503,_0x3616bc){return function(_0x1e36cb){if(_0x1e36cb){var _0x5e271c=_0x1e36cb[_0xdc49('0x1d')],_0x2c1e20=_0x3616bc[_0xdc49('0x1e')],_0x5e80b8=_0x3616bc[_0xdc49('0x1e')]+_0x3616bc[_0xdc49('0x1f')],_0x5b9eba;if(_0x5e80b8>=_0x5e271c){_0x5e80b8=_0x5e271c;_0x5b9eba=0xc8;}else{_0x5b9eba=0xce;}_0x165503[_0xdc49('0x1a')](_0x5b9eba);return _0x165503[_0xdc49('0x20')](_0xdc49('0x21'),_0x2c1e20+'-'+_0x5e80b8+'/'+_0x5e271c)[_0xdc49('0x1c')](_0x1e36cb);}return null;};}function patchUpdates(_0x22be4d){return function(_0x3aa013){try{jsonpatch[_0xdc49('0x22')](_0x3aa013,_0x22be4d,!![]);}catch(_0x31967b){return BPromise[_0xdc49('0x23')](_0x31967b);}return _0x3aa013['save']();};}function saveUpdates(_0x23f7ec,_0x7ba9d0){return function(_0x2e435d){if(_0x2e435d){return _0x2e435d[_0xdc49('0x24')](_0x23f7ec)[_0xdc49('0x25')](function(_0x59c576){return _0x59c576;});}return null;};}function removeEntity(_0x4ae443,_0x2cfb6f){return function(_0x419e42){if(_0x419e42){return _0x419e42[_0xdc49('0x26')]()['then'](function(){_0x4ae443[_0xdc49('0x1a')](0xcc)[_0xdc49('0x1b')]();});}};}function handleEntityNotFound(_0x7f4917,_0x7462b5){return function(_0x230e29){if(!_0x230e29){_0x7f4917[_0xdc49('0x19')](0x194);}return _0x230e29;};}function handleError(_0xbc567d,_0x32d13a){_0x32d13a=_0x32d13a||0x1f4;return function(_0x36fc55){logger[_0xdc49('0x27')](_0x36fc55[_0xdc49('0x28')]);if(_0x36fc55[_0xdc49('0x29')]){delete _0x36fc55[_0xdc49('0x29')];}_0xbc567d[_0xdc49('0x1a')](_0x32d13a)[_0xdc49('0x2a')](_0x36fc55);};}exports[_0xdc49('0x2b')]=function(_0x585758,_0x481003){var _0x5746f6={},_0x43a190={},_0x4967f8={'count':0x0,'rows':[]};var _0x1692ce=_[_0xdc49('0x2c')](db[_0xdc49('0x2d')]['rawAttributes'],function(_0x2116aa){return{'name':_0x2116aa[_0xdc49('0x2e')],'type':_0x2116aa[_0xdc49('0x2f')]['key']};});_0x43a190[_0xdc49('0x30')]=_[_0xdc49('0x2c')](_0x1692ce,_0xdc49('0x29'));_0x43a190[_0xdc49('0x31')]=_[_0xdc49('0x32')](_0x585758[_0xdc49('0x31')]);_0x43a190['filters']=_['intersection'](_0x43a190[_0xdc49('0x30')],_0x43a190[_0xdc49('0x31')]);_0x5746f6[_0xdc49('0x33')]=_[_0xdc49('0x34')](_0x43a190[_0xdc49('0x30')],qs['fields'](_0x585758['query'][_0xdc49('0x35')]));_0x5746f6[_0xdc49('0x33')]=_0x5746f6[_0xdc49('0x33')][_0xdc49('0x36')]?_0x5746f6[_0xdc49('0x33')]:_0x43a190[_0xdc49('0x30')];if(!_0x585758['query'][_0xdc49('0x37')](_0xdc49('0x38'))){_0x5746f6[_0xdc49('0x1f')]=qs['limit'](_0x585758[_0xdc49('0x31')][_0xdc49('0x1f')]);_0x5746f6[_0xdc49('0x1e')]=qs[_0xdc49('0x1e')](_0x585758[_0xdc49('0x31')][_0xdc49('0x1e')]);}_0x5746f6[_0xdc49('0x39')]=qs[_0xdc49('0x3a')](_0x585758[_0xdc49('0x31')][_0xdc49('0x3a')]);_0x5746f6['where']=qs['filters'](_['pick'](_0x585758['query'],_0x43a190[_0xdc49('0x3b')]),_0x1692ce);if(_0x585758[_0xdc49('0x31')][_0xdc49('0x3c')]){_0x5746f6[_0xdc49('0x3d')]=_[_0xdc49('0x3e')](_0x5746f6[_0xdc49('0x3d')],{'$or':_[_0xdc49('0x2c')](_0x1692ce,function(_0x2f6772){if(_0x2f6772[_0xdc49('0x2f')]!==_0xdc49('0x3f')){var _0xf9c3b3={};_0xf9c3b3[_0x2f6772[_0xdc49('0x29')]]={'$like':'%'+_0x585758[_0xdc49('0x31')]['filter']+'%'};return _0xf9c3b3;}})});}_0x5746f6=_[_0xdc49('0x3e')]({},_0x5746f6,_0x585758['options']);var _0x352fe5={'where':_0x5746f6[_0xdc49('0x3d')]};return db[_0xdc49('0x2d')]['count'](_0x352fe5)[_0xdc49('0x25')](function(_0x5c3224){_0x4967f8[_0xdc49('0x1d')]=_0x5c3224;if(_0x585758['query'][_0xdc49('0x40')]){_0x5746f6[_0xdc49('0x41')]=[{'all':!![]}];}return db[_0xdc49('0x2d')][_0xdc49('0x42')](_0x5746f6);})[_0xdc49('0x25')](function(_0x564faa){_0x4967f8[_0xdc49('0x43')]=_0x564faa;return _0x4967f8;})[_0xdc49('0x25')](respondWithFilteredResult(_0x481003,_0x5746f6))[_0xdc49('0x44')](handleError(_0x481003,null));};exports[_0xdc49('0x45')]=function(_0xebf886,_0x422d0d){var _0x399ddb={'raw':!![],'where':{'id':_0xebf886['params']['id']}},_0xa412c3={};_0xa412c3[_0xdc49('0x30')]=_['keys'](db[_0xdc49('0x2d')]['rawAttributes']);_0xa412c3['query']=_[_0xdc49('0x32')](_0xebf886[_0xdc49('0x31')]);_0xa412c3['filters']=_[_0xdc49('0x34')](_0xa412c3['model'],_0xa412c3[_0xdc49('0x31')]);_0x399ddb[_0xdc49('0x33')]=_[_0xdc49('0x34')](_0xa412c3[_0xdc49('0x30')],qs[_0xdc49('0x35')](_0xebf886[_0xdc49('0x31')][_0xdc49('0x35')]));_0x399ddb[_0xdc49('0x33')]=_0x399ddb[_0xdc49('0x33')][_0xdc49('0x36')]?_0x399ddb[_0xdc49('0x33')]:_0xa412c3[_0xdc49('0x30')];if(_0xebf886[_0xdc49('0x31')][_0xdc49('0x40')]){_0x399ddb[_0xdc49('0x41')]=[{'all':!![]}];}_0x399ddb=_[_0xdc49('0x3e')]({},_0x399ddb,_0xebf886['options']);return db[_0xdc49('0x2d')][_0xdc49('0x46')](_0x399ddb)[_0xdc49('0x25')](handleEntityNotFound(_0x422d0d,null))[_0xdc49('0x25')](respondWithResult(_0x422d0d,null))['catch'](handleError(_0x422d0d,null));};exports['create']=function(_0x45a2f2,_0x311816){return db['OpenchannelApplication'][_0xdc49('0x47')](_0x45a2f2[_0xdc49('0x48')],{})[_0xdc49('0x25')](respondWithResult(_0x311816,0xc9))[_0xdc49('0x44')](handleError(_0x311816,null));};exports[_0xdc49('0x24')]=function(_0x5411b6,_0x5531ea){if(_0x5411b6[_0xdc49('0x48')]['id']){delete _0x5411b6[_0xdc49('0x48')]['id'];}return db[_0xdc49('0x2d')][_0xdc49('0x46')]({'where':{'id':_0x5411b6[_0xdc49('0x49')]['id']}})[_0xdc49('0x25')](handleEntityNotFound(_0x5531ea,null))[_0xdc49('0x25')](saveUpdates(_0x5411b6[_0xdc49('0x48')],null))[_0xdc49('0x25')](respondWithResult(_0x5531ea,null))['catch'](handleError(_0x5531ea,null));};exports[_0xdc49('0x26')]=function(_0x51a8a0,_0x4b958e){return db[_0xdc49('0x2d')][_0xdc49('0x46')]({'where':{'id':_0x51a8a0['params']['id']}})[_0xdc49('0x25')](handleEntityNotFound(_0x4b958e,null))[_0xdc49('0x25')](removeEntity(_0x4b958e,null))[_0xdc49('0x44')](handleError(_0x4b958e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d6b8bb8..7dc76b1 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 _0x5f82=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','openchannel_applications'];(function(_0x223b58,_0x29f8c3){var _0x5cf144=function(_0x5cdbf1){while(--_0x5cdbf1){_0x223b58['push'](_0x223b58['shift']());}};_0x5cf144(++_0x29f8c3);}(_0x5f82,0xde));var _0x25f8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x5f82[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0x25f8('0x0'));var logger=require('../../config/logger')(_0x25f8('0x1'));var moment=require(_0x25f8('0x2'));var BPromise=require('bluebird');var rp=require(_0x25f8('0x3'));var fs=require('fs');var path=require(_0x25f8('0x4'));var rimraf=require(_0x25f8('0x5'));var config=require(_0x25f8('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x25f8('0x7')]=function(_0x1511e3,_0x52cc28){return _0x1511e3['define']('OpenchannelApplication',attributes,{'tableName':_0x25f8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25f8('0x9'),'collate':_0x25f8('0xa')});}; \ No newline at end of file +var _0x01be=['bluebird','request-promise','path','rimraf','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x01be,0x1b9));var _0xe01b=function(_0x2ab8f3,_0x35d830){_0x2ab8f3=_0x2ab8f3-0x0;var _0x14d2dd=_0x01be[_0x2ab8f3];return _0x14d2dd;};'use strict';var _=require(_0xe01b('0x0'));var util=require(_0xe01b('0x1'));var logger=require(_0xe01b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe01b('0x3'));var rp=require(_0xe01b('0x4'));var fs=require('fs');var path=require(_0xe01b('0x5'));var rimraf=require(_0xe01b('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xe01b('0x7')]=function(_0x3dc3bd,_0xc3f75){return _0x3dc3bd[_0xe01b('0x8')]('OpenchannelApplication',attributes,{'tableName':_0xe01b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe01b('0xa'),'collate':_0xe01b('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 799cd20..8667b4a 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(_0x27c3cd,_0x907bfb){var _0xb3bd80=function(_0xa6c5e0){while(--_0xa6c5e0){_0x27c3cd['push'](_0x27c3cd['shift']());}};_0xb3bd80(++_0x907bfb);}(_0xb10b,0x12a));var _0xbb10=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0xb10b[_0x743701];return _0x5a141d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x25ca66,_0x5e2ce6){var _0x342aed=function(_0x5caab1){while(--_0x5caab1){_0x25ca66['push'](_0x25ca66['shift']());}};_0x342aed(++_0x5e2ce6);}(_0xb10b,0x12a));var _0xbb10=function(_0x22d8a6,_0x4383d6){_0x22d8a6=_0x22d8a6-0x0;var _0x1364e0=_0xb10b[_0x22d8a6];return _0x1364e0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 49b74bb..b625f1c 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 _0x16c1=['openchannelinteraction:addtags','addTags','/:id','delete','openchannelinteraction:destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel'];(function(_0x1940d2,_0x1f23dc){var _0x1efd87=function(_0x3c4bc9){while(--_0x3c4bc9){_0x1940d2['push'](_0x1940d2['shift']());}};_0x1efd87(++_0x1f23dc);}(_0x16c1,0x11e));var _0x116c=function(_0x284d61,_0x4d7557){_0x284d61=_0x284d61-0x0;var _0xbe518a=_0x16c1[_0x284d61];return _0xbe518a;};'use strict';var multer=require(_0x116c('0x0'));var util=require('util');var path=require(_0x116c('0x1'));var timeout=require(_0x116c('0x2'));var express=require(_0x116c('0x3'));var router=express[_0x116c('0x4')]();var auth=require(_0x116c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x116c('0x6'));router[_0x116c('0x7')]('/',auth[_0x116c('0x8')](),controller[_0x116c('0x9')]);router[_0x116c('0x7')](_0x116c('0xa'),auth['isAuthenticated'](),controller[_0x116c('0xb')]);router[_0x116c('0x7')]('/:id',auth[_0x116c('0x8')](),controller[_0x116c('0xc')]);router[_0x116c('0x7')](_0x116c('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x116c('0x7')](_0x116c('0xe'),auth[_0x116c('0x8')](),controller[_0x116c('0xf')]);router[_0x116c('0x10')]('/',auth[_0x116c('0x8')](),controller[_0x116c('0x11')]);router['post'](_0x116c('0xd'),auth[_0x116c('0x8')](),controller[_0x116c('0x12')]);router['post'](_0x116c('0x13'),auth['isAuthenticated'](),interaction[_0x116c('0x14')](_0x116c('0x15'),_0x116c('0x16')),controller[_0x116c('0x17')]);router['put'](_0x116c('0x18'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller['update']);router[_0x116c('0x19')](_0x116c('0x18'),auth[_0x116c('0x8')](),interaction[_0x116c('0x14')](_0x116c('0x15'),_0x116c('0x1a')),controller['destroy']);router[_0x116c('0x19')](_0x116c('0x13'),auth[_0x116c('0x8')](),controller['removeTags']);module[_0x116c('0x1b')]=router; \ No newline at end of file +var _0xa72b=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:destroy','delete'];(function(_0xf490a2,_0x45b136){var _0x5e0552=function(_0xd2871e){while(--_0xd2871e){_0xf490a2['push'](_0xf490a2['shift']());}};_0x5e0552(++_0x45b136);}(_0xa72b,0x1c1));var _0xba72=function(_0x2bb328,_0x4eed18){_0x2bb328=_0x2bb328-0x0;var _0x20da8c=_0xa72b[_0x2bb328];return _0x20da8c;};'use strict';var multer=require(_0xba72('0x0'));var util=require(_0xba72('0x1'));var path=require(_0xba72('0x2'));var timeout=require(_0xba72('0x3'));var express=require(_0xba72('0x4'));var router=express[_0xba72('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xba72('0x6'));var config=require(_0xba72('0x7'));var controller=require(_0xba72('0x8'));router[_0xba72('0x9')]('/',auth[_0xba72('0xa')](),controller['index']);router[_0xba72('0x9')]('/describe',auth[_0xba72('0xa')](),controller['describe']);router[_0xba72('0x9')](_0xba72('0xb'),auth[_0xba72('0xa')](),controller[_0xba72('0xc')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xba72('0xd'),auth['isAuthenticated'](),controller[_0xba72('0xe')]);router[_0xba72('0xf')]('/',auth[_0xba72('0xa')](),controller[_0xba72('0x10')]);router[_0xba72('0xf')](_0xba72('0x11'),auth[_0xba72('0xa')](),controller[_0xba72('0x12')]);router[_0xba72('0xf')](_0xba72('0x13'),auth[_0xba72('0xa')](),interaction[_0xba72('0x14')](_0xba72('0x15'),_0xba72('0x16')),controller[_0xba72('0x17')]);router[_0xba72('0x18')](_0xba72('0xb'),auth[_0xba72('0xa')](),interaction[_0xba72('0x14')](_0xba72('0x15'),'openchannelinteraction:update'),controller['update']);router['delete'](_0xba72('0xb'),auth[_0xba72('0xa')](),interaction[_0xba72('0x14')](_0xba72('0x15'),_0xba72('0x19')),controller['destroy']);router[_0xba72('0x1a')](_0xba72('0x13'),auth[_0xba72('0xa')](),controller['removeTags']);module[_0xba72('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f9139d0..8e4e204 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 _0x5708=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x5708,0x11d));var _0x8570=function(_0x36510b,_0x5a69a7){_0x36510b=_0x36510b-0x0;var _0x48323c=_0x5708[_0x36510b];return _0x48323c;};'use strict';var Sequelize=require(_0x8570('0x0'));module[_0x8570('0x1')]={'closed':{'type':Sequelize[_0x8570('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8570('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8570('0x4')]},'read1stAt':{'type':Sequelize[_0x8570('0x3')]},'threadId':{'type':Sequelize[_0x8570('0x4')]},'externalUrl':{'type':Sequelize[_0x8570('0x4')]},'lastMsgAt':{'type':Sequelize[_0x8570('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8570('0x5')]('in',_0x8570('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb888=['exports','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x295ee0,_0x5ef633){var _0x36cb3c=function(_0x3d45b4){while(--_0x3d45b4){_0x295ee0['push'](_0x295ee0['shift']());}};_0x36cb3c(++_0x5ef633);}(_0xb888,0x1e5));var _0x8b88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb888[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8b88('0x0'));module[_0x8b88('0x1')]={'closed':{'type':Sequelize[_0x8b88('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8b88('0x3')]},'disposition':{'type':Sequelize[_0x8b88('0x4')]},'note':{'type':Sequelize[_0x8b88('0x4')]},'read1stAt':{'type':Sequelize[_0x8b88('0x3')]},'threadId':{'type':Sequelize[_0x8b88('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x8b88('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8b88('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8b88('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a2d180d..85bb916 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 _0x7764=['u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','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?','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)','DESC','isEmpty','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','rawAttributes','create','body','params','describe','addMessage','OpenchannelMessage','ids','getMessages','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','addTags','omit','spread','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','Owner','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','System','Contact','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','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','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','Tags','TagIds','split','forEach','push','catch','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','u.id','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users'];(function(_0x3010a5,_0x1402c6){var _0xdf5fc2=function(_0x2f8e87){while(--_0x2f8e87){_0x3010a5['push'](_0x3010a5['shift']());}};_0xdf5fc2(++_0x1402c6);}(_0x7764,0xa4));var _0x4776=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x7764[_0x2a0183];return _0x158c3a;};'use strict';var pdf=require(_0x4776('0x0'));var emlformat=require(_0x4776('0x1'));var rimraf=require(_0x4776('0x2'));var zipdir=require(_0x4776('0x3'));var jsonpatch=require(_0x4776('0x4'));var rp=require(_0x4776('0x5'));var moment=require(_0x4776('0x6'));var BPromise=require(_0x4776('0x7'));var Mustache=require(_0x4776('0x8'));var util=require(_0x4776('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x4776('0xa'));var ejs=require(_0x4776('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4776('0xc'));var crypto=require(_0x4776('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4776('0xa'));var querystring=require('querystring');var Papa=require(_0x4776('0xe'));var Redis=require(_0x4776('0xf'));var authService=require(_0x4776('0x10'));var qs=require(_0x4776('0x11'));var as=require(_0x4776('0x12'));var hardwareService=require(_0x4776('0x13'));var logger=require(_0x4776('0x14'))(_0x4776('0x15'));var utils=require(_0x4776('0x16'));var config=require(_0x4776('0x17'));var db=require(_0x4776('0x18'))['db'];config[_0x4776('0x19')]=_[_0x4776('0x1a')](config[_0x4776('0x19')],{'host':_0x4776('0x1b'),'port':0x18eb});var socket=require(_0x4776('0x1c'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x4776('0x1d')](socket);function respondWithStatusCode(_0x46429e,_0x193b42){_0x193b42=_0x193b42||0xcc;return function(_0x179273){if(_0x179273){return _0x46429e[_0x4776('0x1e')](_0x193b42);}return _0x46429e[_0x4776('0x1f')](_0x193b42)[_0x4776('0x20')]();};}function respondWithResult(_0x1389ed,_0x2256c9){_0x2256c9=_0x2256c9||0xc8;return function(_0x1eb5b5){if(_0x1eb5b5){return _0x1389ed['status'](_0x2256c9)[_0x4776('0x21')](_0x1eb5b5);}};}function respondWithFilteredResult(_0x5a5180,_0x164474){return function(_0x41b06a){if(_0x41b06a){var _0x2366da=_0x41b06a[_0x4776('0x22')],_0xed81b5=_0x164474[_0x4776('0x23')],_0xb5c938=_0x164474['offset']+_0x164474[_0x4776('0x24')],_0x4b5f50;if(_0xb5c938>=_0x2366da){_0xb5c938=_0x2366da;_0x4b5f50=0xc8;}else{_0x4b5f50=0xce;}_0x5a5180[_0x4776('0x1f')](_0x4b5f50);return _0x5a5180[_0x4776('0x25')](_0x4776('0x26'),_0xed81b5+'-'+_0xb5c938+'/'+_0x2366da)['json'](_0x41b06a);}return null;};}function patchUpdates(_0x3e2aa4){return function(_0x2462e2){try{jsonpatch[_0x4776('0x27')](_0x2462e2,_0x3e2aa4,!![]);}catch(_0x38cc97){return BPromise['reject'](_0x38cc97);}return _0x2462e2[_0x4776('0x28')]();};}function saveUpdates(_0xaa89dc,_0x32bd33){return function(_0x5e50b6){if(_0x5e50b6){return _0x5e50b6[_0x4776('0x29')](_0xaa89dc)[_0x4776('0x2a')](function(_0x7b2012){return _0x7b2012;});}return null;};}function removeEntity(_0x54f3de,_0x4e0dd1){return function(_0x5a8f1f){if(_0x5a8f1f){return _0x5a8f1f[_0x4776('0x2b')]()[_0x4776('0x2a')](function(){_0x54f3de[_0x4776('0x1f')](0xcc)[_0x4776('0x20')]();});}};}function handleEntityNotFound(_0x399a4a,_0x20e06a){return function(_0x43b7e3){if(!_0x43b7e3){_0x399a4a['sendStatus'](0x194);}return _0x43b7e3;};}function handleError(_0x7a0bb8,_0x1de3d1){_0x1de3d1=_0x1de3d1||0x1f4;return function(_0x5e4ac0){logger[_0x4776('0x2c')](_0x5e4ac0[_0x4776('0x2d')]);if(_0x5e4ac0['name']){delete _0x5e4ac0[_0x4776('0x2e')];}_0x7a0bb8[_0x4776('0x1f')](_0x1de3d1)[_0x4776('0x2f')](_0x5e4ac0);};}function getInteractionUsers(_0x15da31,_0xd8b1e7){return new BPromise(function(_0x4f57f7,_0x4bfd4b){try{if(_0xd8b1e7[_0x15da31['id']]){_0x15da31[_0x4776('0x30')]=_[_0x4776('0x31')](_0xd8b1e7[_0x15da31['id']],function(_0x2e8f13){return{'id':_0x2e8f13['id'],'fullname':_0x2e8f13['fullname']};});}}catch(_0x3b4013){_0x4bfd4b(_0x3b4013);}_0x4f57f7(_0x15da31);});}function getInteractionTags(_0x51fbc6,_0x4002a2){return new BPromise(function(_0x5128fe,_0x281cfd){try{if(_0x51fbc6['TagIds']){_0x51fbc6[_0x4776('0x32')]=[];_0x51fbc6[_0x4776('0x33')][_0x4776('0x34')](',')[_0x4776('0x35')](function(_0x560b9a){_0x51fbc6[_0x4776('0x32')][_0x4776('0x36')](_0x4002a2[_0x560b9a]);});}delete _0x51fbc6[_0x4776('0x33')];}catch(_0x2164c8){_0x281cfd(_0x2164c8);}_0x5128fe(_0x51fbc6);});}function updateOpenchannelInteraction(_0x38ea0b,_0x16324c,_0x30343f){return new BPromise(function(_0x5cef55,_0x3c2000){return getInteractionUsers(_0x38ea0b,_0x30343f)[_0x4776('0x2a')](function(_0x3ac020){return getInteractionTags(_0x3ac020,_0x16324c);})[_0x4776('0x2a')](function(_0x4307a0){_0x5cef55(_0x4307a0);})[_0x4776('0x37')](function(_0x2d3a23){_0x3c2000(_0x2d3a23);});});}exports[_0x4776('0x38')]=function(_0x4ffdfd,_0x46f5e0){var _0x506a3f={},_0x3aead0={},_0x33b873={'count':0x0,'rows':[]};var _0x1e437f=_[_0x4776('0x31')](db['OpenchannelInteraction']['rawAttributes'],function(_0x196c58){return{'name':_0x196c58[_0x4776('0x39')],'type':_0x196c58['type'][_0x4776('0x3a')]};});_0x3aead0[_0x4776('0x3b')]=_['map'](_0x1e437f,'name');_0x3aead0[_0x4776('0x3c')]=_[_0x4776('0x3d')](_0x4ffdfd[_0x4776('0x3c')]);_0x3aead0[_0x4776('0x3e')]=_[_0x4776('0x3f')](_0x3aead0[_0x4776('0x3b')],_0x3aead0[_0x4776('0x3c')]);_0x506a3f['attributes']=_[_0x4776('0x3f')](_0x3aead0['model'],qs[_0x4776('0x40')](_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x40')]));_0x506a3f[_0x4776('0x41')]=_0x506a3f[_0x4776('0x41')][_0x4776('0x42')]?_0x506a3f[_0x4776('0x41')]:_0x3aead0['model'];if(!_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x43')]('nolimit')){_0x506a3f[_0x4776('0x24')]=qs['limit'](_0x4ffdfd[_0x4776('0x3c')]['limit']);_0x506a3f[_0x4776('0x23')]=qs[_0x4776('0x23')](_0x4ffdfd['query'][_0x4776('0x23')]);}_0x506a3f[_0x4776('0x44')]=qs[_0x4776('0x45')](_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x45')]);_0x506a3f[_0x4776('0x46')]=qs[_0x4776('0x3e')](_[_0x4776('0x47')](_0x4ffdfd[_0x4776('0x3c')],_0x3aead0[_0x4776('0x3e')]),_0x1e437f);var _0x351195=[];var _0x27f762=squel[_0x4776('0x48')]()['field']('id')[_0x4776('0x49')](_0x4776('0x2e'))['field'](_0x4776('0x4a'))['from']('tools_tags');var _0x35ad4b=squel['select']()[_0x4776('0x49')](_0x4776('0x4b'))[_0x4776('0x49')]('u.fullname')[_0x4776('0x49')](_0x4776('0x4c'))[_0x4776('0x4d')](_0x4776('0x4e'),'ui')[_0x4776('0x4f')](_0x4776('0x50'),'u',_0x4776('0x51'));var _0x1df03f=squel[_0x4776('0x48')]()[_0x4776('0x4d')](_0x4776('0x52'),'i')['left_join'](_0x4776('0x53'),'c',_0x4776('0x54'))[_0x4776('0x4f')](_0x4776('0x50'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x4776('0x55'),'a',_0x4776('0x56'))[_0x4776('0x4f')](_0x4776('0x57'),'me',_0x4776('0x58'))[_0x4776('0x4f')](_0x4776('0x59'),'it',_0x4776('0x5a'))['left_join'](_0x4776('0x5b'),'t',_0x4776('0x5c'));var _0x287a82=squel[_0x4776('0x5d')]();var _0x1199c1=[];var _0x23a27d=squel[_0x4776('0x5d')]();var _0xc0f78e;if(_0x4ffdfd['query']['search']){_0xc0f78e=as[_0x4776('0x5e')](_0x4ffdfd['query'][_0x4776('0x5f')]);var _0xe93b8=_0xc0f78e[_0x4776('0x60')];for(var _0x20b119=0x0;_0x20b119<_0xc0f78e[_0x4776('0x61')][_0x4776('0x42')];_0x20b119++){var _0x5ecde3=_0xc0f78e[_0x4776('0x61')][_0x20b119];var _0x5d6d22='i';var _0xc45996=_['find'](_0x1e437f,[_0x4776('0x2e'),_0x5ecde3['field']]);if(!_0xc45996){switch(_0x5ecde3[_0x4776('0x49')]){case _0x4776('0x62'):if(_0x5ecde3[_0x4776('0x63')]==0x1){_0x1df03f['having']('`'+_0x5ecde3[_0x4776('0x49')]+_0x4776('0x64'));}else{_0x1df03f[_0x4776('0x65')]('`'+_0x5ecde3[_0x4776('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x5ecde3[_0x4776('0x66')]===_0x4776('0x67')){if(_0x5ecde3[_0x4776('0x63')][_0x4776('0x34')]('\x20')['length']>0x1){_0x287a82[_0xe93b8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4776('0x68')](_0x5ecde3[_0x4776('0x63')]),null);}else{var _0x355fbd='%'+_0x5ecde3[_0x4776('0x63')]+'%';_0x287a82[_0xe93b8](_0x4776('0x69'),_0x355fbd,_0x355fbd,_0x355fbd);}}else{_0xc45996=_[_0x4776('0x6a')](_0x1e437f,['name',_0x4776('0x6b')]);_0x5ecde3[_0x4776('0x49')]='ContactId';_0x374c88=as[_0x4776('0x6c')](_0x5d6d22,_0xc45996[_0x4776('0x6d')],_0x5ecde3);_0x287a82[_0xe93b8](_0x374c88['text'],_0x374c88[_0x4776('0x63')][_0x4776('0x6e')],_0x374c88[_0x4776('0x63')][_0x4776('0x20')]);}break;case _0x4776('0x6f'):var _0xd96f95=_0x5ecde3[_0x4776('0x63')]['split'](',')[_0x4776('0x31')](function(_0x4d7b71){return Number(_0x4d7b71);});_0xd96f95[_0x4776('0x35')](function(_0x59901e){_0x23a27d['or'](_0x4776('0x70'),'%,'+_0x59901e+',%');});_0x1199c1=_[_0x4776('0x71')](_0x1199c1,_0xd96f95);break;case _0x4776('0x72'):if(_0x5ecde3[_0x4776('0x66')]===_0x4776('0x67')){_0x287a82[_0xe93b8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ecde3['value']+'%',null);}else{_0xc45996=_[_0x4776('0x6a')](_0x1e437f,['name','UserId']);_0x5ecde3[_0x4776('0x49')]=_0x4776('0x73');_0x374c88=as[_0x4776('0x6c')](_0x5d6d22,_0xc45996['type'],_0x5ecde3);_0x287a82[_0xe93b8](_0x374c88[_0x4776('0x74')],_0x374c88[_0x4776('0x63')]['start'],_0x374c88['value'][_0x4776('0x20')]);}break;case'body':_0x374c88=as[_0x4776('0x6c')]('me',null,_0x5ecde3);_0x287a82[_0xe93b8](_0x374c88[_0x4776('0x74')],_0x374c88['value']['start'],_0x374c88[_0x4776('0x63')]['end']);break;}}else{var _0x374c88=as[_0x4776('0x6c')](_0x5d6d22,_0xc45996[_0x4776('0x6d')],_0x5ecde3);_0x287a82[_0xe93b8](_0x374c88[_0x4776('0x74')],_0x374c88[_0x4776('0x63')][_0x4776('0x6e')],_0x374c88[_0x4776('0x63')][_0x4776('0x20')]);}}}else{var _0x4f0175=_(_0x4ffdfd[_0x4776('0x3c')])['keys']()[_0x4776('0x31')](function(_0x2d755b){return _['some'](_0x1e437f,[_0x4776('0x2e'),_0x2d755b])?_0x2d755b:undefined;})[_0x4776('0x75')]()[_0x4776('0x63')]();if(!_['isEmpty'](_0x4f0175)){_0x4f0175[_0x4776('0x35')](function(_0x2b25a1){if(_0x2b25a1===_0x4776('0x76')){_0x1df03f[_0x4776('0x46')](_0x4776('0x77'),[][_0x4776('0x78')](_0x4ffdfd['query'][_0x2b25a1]));}else if(_0x2b25a1===_0x4776('0x79')){var _0x368540=JSON[_0x4776('0x7a')](_0x4ffdfd[_0x4776('0x3c')][_0x2b25a1])['$gte'];var _0x36bc89=JSON[_0x4776('0x7a')](_0x4ffdfd['query'][_0x2b25a1])[_0x4776('0x7b')];_0x1df03f[_0x4776('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x368540,_0x36bc89);}else{if(_0x4ffdfd[_0x4776('0x3c')][_0x2b25a1]===_0x4776('0x7c')){_0x1df03f[_0x4776('0x46')]('i.'+_0x2b25a1+_0x4776('0x7d'));}else{_0x1df03f[_0x4776('0x46')]('i.'+_0x2b25a1+_0x4776('0x7e'),_0x4ffdfd[_0x4776('0x3c')][_0x2b25a1]);}}});}if(_0x4ffdfd[_0x4776('0x3c')]['read']){if(_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x7f')]==0x1){_0x1df03f['having'](_0x4776('0x80'));}else{_0x1df03f[_0x4776('0x65')](_0x4776('0x81'));}}if(_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x82')]){_0x1199c1=_[_0x4776('0x83')](_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x82')])?_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x82')]:new Array(_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x82')]);_0x1199c1[_0x4776('0x35')](function(_0x9fd002){_0x23a27d['or'](_0x4776('0x70'),'%,'+_0x9fd002+',%');});}if(_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x84')]){var _0x398b66=_0x4ffdfd['query'][_0x4776('0x84')][_0x4776('0x85')]('\x5c','\x5c\x5c')[_0x4776('0x85')]('\x27\x27',_0x4776('0x86'));if(qs[_0x4776('0x87')](_0x398b66)){_0x287a82['or'](_0x4776('0x88'),_0x398b66+'%');}else{_0x287a82['or'](_0x4776('0x89'),qs[_0x4776('0x68')](_0x398b66))['or']('i.from\x20LIKE\x20?',_0x398b66+'%')['or'](_0x4776('0x8a'),_0x398b66+'%');}}}_0x1df03f[_0x4776('0x46')](_0x287a82);_0x1df03f[_0x4776('0x8b')](_0x4776('0x8c'));var _0x1c9b80={'type':db[_0x4776('0x8d')][_0x4776('0x8e')][_0x4776('0x8f')],'raw':!![]};var _0x4d0a3a=_0x1df03f[_0x4776('0x90')]();_0x4d0a3a[_0x4776('0x49')](_0x4776('0x8c'));_0x4d0a3a['field'](_0x4776('0x91'),_0x4776('0x62'));if(_0x506a3f[_0x4776('0x44')]){_0x506a3f['order'][_0x4776('0x35')](function(_0x1c3662){_0x1df03f[_0x4776('0x44')]('i.'+_0x1c3662[0x0],_0x1c3662[0x1]===_0x4776('0x92')?![]:!![]);});}if(!_[_0x4776('0x93')](_0x1199c1)){_0x1df03f[_0x4776('0x65')](_0x23a27d);_0x4d0a3a['where']('t.id\x20IN\x20?',_0x1199c1);}BPromise[_0x4776('0x94')]()[_0x4776('0x2a')](function(){if(!_0xc0f78e){if(_0x4ffdfd[_0x4776('0x3c')]['OpenchannelAccountId']||_0x4ffdfd['query']['journey'])return;_0x4d0a3a[_0x4776('0x46')](_0x4776('0x95'));_0x1df03f[_0x4776('0x46')](_0x4776('0x95'));return;}return _0x4ffdfd['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4776('0x2a')](function(_0x3b74a5){if(_[_0x4776('0x93')](_0x3b74a5)){_0x4d0a3a[_0x4776('0x46')](_0x4776('0x96'));_0x1df03f['where'](_0x4776('0x96'));}else{_0x4d0a3a[_0x4776('0x46')](_0x4776('0x77'),_[_0x4776('0x31')](_0x3b74a5,'id'));_0x1df03f[_0x4776('0x46')](_0x4776('0x77'),_['map'](_0x3b74a5,'id'));}});})[_0x4776('0x2a')](function(){db['sequelize']['query'](_0x4d0a3a[_0x4776('0x97')](),_0x1c9b80)[_0x4776('0x2a')](function(_0x2342f8){_0x33b873[_0x4776('0x22')]=_0x2342f8[_0x4776('0x42')];if(_0x33b873['count']===0x0)return[];return db['sequelize'][_0x4776('0x3c')](_0x27f762['toString'](),_0x1c9b80)['then'](function(_0x1a4da1){_0x351195=_[_0x4776('0x98')](_0x1a4da1,'id');_0x1c9b80=_[_0x4776('0x99')](_0x1c9b80,{'model':db[_0x4776('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ffdfd[_0x4776('0x3c')][_0x4776('0x40')]){_0x506a3f[_0x4776('0x41')][_0x4776('0x35')](function(_0x136361){_0x1df03f[_0x4776('0x49')]('i.'+_0x136361);});}else{_0x1df03f[_0x4776('0x49')](_0x4776('0x91'),_0x4776('0x62'));_0x1df03f[_0x4776('0x49')](_0x4776('0x9b'),_0x4776('0x9c'));_0x1df03f['field'](_0x4776('0x9d'),_0x4776('0x9e'));_0x1df03f[_0x4776('0x49')](_0x4776('0x9f'));_0x1df03f[_0x4776('0x49')](_0x4776('0xa0'),'Contact.firstName');_0x1df03f['field'](_0x4776('0xa1'),_0x4776('0xa2'));_0x1df03f[_0x4776('0x49')]('c.email',_0x4776('0xa3'));_0x1df03f[_0x4776('0x49')]('c.phone',_0x4776('0xa4'));_0x1df03f[_0x4776('0x49')]('c.mobile',_0x4776('0xa5'));_0x1df03f[_0x4776('0x49')](_0x4776('0xa6'),_0x4776('0xa7'));_0x1df03f[_0x4776('0x49')]('o.fullname',_0x4776('0xa8'));_0x1df03f[_0x4776('0x49')](_0x4776('0xa9'),_0x4776('0xaa'));_0x1df03f[_0x4776('0x49')](_0x4776('0xab'),_0x4776('0x33'));}if(_0x506a3f[_0x4776('0x24')])_0x1df03f['limit'](_0x506a3f[_0x4776('0x24')]);if(_0x506a3f[_0x4776('0x23')])_0x1df03f[_0x4776('0x23')](_0x506a3f[_0x4776('0x23')]);return db[_0x4776('0xac')][_0x4776('0x3c')](_0x1df03f['toString'](),_0x1c9b80);})[_0x4776('0x2a')](function(_0x5896be){_0x35ad4b['where'](_0x4776('0xad'),_['map'](_0x5896be,'id'));return db[_0x4776('0xac')]['query'](_0x35ad4b[_0x4776('0x97')](),_0x1c9b80)[_0x4776('0x2a')](function(_0x576be3){var _0x53cbd6=_[_0x4776('0xae')](_0x576be3,_0x4776('0xaf'));var _0x29564c=[];_0x5896be[_0x4776('0x35')](function(_0x59cd5a){_0x29564c[_0x4776('0x36')](updateOpenchannelInteraction(_0x59cd5a,_0x351195,_0x53cbd6));});return BPromise['all'](_0x29564c);});});})[_0x4776('0x2a')](function(_0x35440d){_0x33b873[_0x4776('0xb0')]=_0x35440d;return _0x33b873;})[_0x4776('0x2a')](respondWithFilteredResult(_0x46f5e0,_0x506a3f));})['catch'](handleError(_0x46f5e0,null));};exports[_0x4776('0xb1')]=function(_0x27c01d,_0x19c263){var _0x42a159={'raw':![],'where':{'id':_0x27c01d['params']['id']}},_0x1d1db5={};_0x1d1db5[_0x4776('0x3b')]=_[_0x4776('0x3d')](db['OpenchannelInteraction'][_0x4776('0xb2')]);_0x1d1db5[_0x4776('0x3c')]=_[_0x4776('0x3d')](_0x27c01d['query']);_0x1d1db5['filters']=_[_0x4776('0x3f')](_0x1d1db5[_0x4776('0x3b')],_0x1d1db5[_0x4776('0x3c')]);_0x42a159[_0x4776('0x41')]=_[_0x4776('0x3f')](_0x1d1db5[_0x4776('0x3b')],qs['fields'](_0x27c01d[_0x4776('0x3c')][_0x4776('0x40')]));_0x42a159[_0x4776('0x41')]=_0x42a159[_0x4776('0x41')]['length']?_0x42a159['attributes']:_0x1d1db5[_0x4776('0x3b')];if(_0x27c01d['query']['includeAll']){_0x42a159['include']=[{'all':!![]}];}_0x42a159=_[_0x4776('0x99')]({},_0x42a159,_0x27c01d['options']);return db[_0x4776('0x9a')]['find'](_0x42a159)[_0x4776('0x2a')](handleEntityNotFound(_0x19c263,null))[_0x4776('0x2a')](respondWithResult(_0x19c263,null))[_0x4776('0x37')](handleError(_0x19c263,null));};exports[_0x4776('0xb3')]=function(_0x52f5b5,_0x3bc851){return db[_0x4776('0x9a')]['create'](_0x52f5b5[_0x4776('0xb4')],{})['then'](respondWithResult(_0x3bc851,0xc9))[_0x4776('0x37')](handleError(_0x3bc851,null));};exports[_0x4776('0x29')]=function(_0x51ce33,_0x3d55ce){if(_0x51ce33[_0x4776('0xb4')]['id']){delete _0x51ce33['body']['id'];}return db[_0x4776('0x9a')][_0x4776('0x6a')]({'where':{'id':_0x51ce33['params']['id']}})['then'](handleEntityNotFound(_0x3d55ce,null))[_0x4776('0x2a')](saveUpdates(_0x51ce33['body'],null))[_0x4776('0x2a')](respondWithResult(_0x3d55ce,null))[_0x4776('0x37')](handleError(_0x3d55ce,null));};exports[_0x4776('0x2b')]=function(_0x5c89d3,_0x161b03){return db[_0x4776('0x9a')][_0x4776('0x6a')]({'where':{'id':_0x5c89d3[_0x4776('0xb5')]['id']}})['then'](handleEntityNotFound(_0x161b03,null))[_0x4776('0x2a')](removeEntity(_0x161b03,null))[_0x4776('0x37')](handleError(_0x161b03,null));};exports[_0x4776('0xb6')]=function(_0x368369,_0x1c031c){return db[_0x4776('0x9a')][_0x4776('0xb6')]()[_0x4776('0x2a')](respondWithResult(_0x1c031c,null))['catch'](handleError(_0x1c031c,null));};exports[_0x4776('0xb7')]=function(_0x1bf57a,_0x225c7c,_0x116d45){return db[_0x4776('0xb8')][_0x4776('0x6a')]({'where':{'id':_0x1bf57a[_0x4776('0xb5')]['id']}})[_0x4776('0x2a')](handleEntityNotFound(_0x225c7c,null))[_0x4776('0x2a')](function(_0x2fd8e8){if(_0x2fd8e8){return _0x2fd8e8[_0x4776('0xb7')](_0x1bf57a[_0x4776('0xb4')][_0x4776('0xb9')],_['omit'](_0x1bf57a[_0x4776('0xb4')],['ids','id'])||{});}})[_0x4776('0x2a')](respondWithResult(_0x225c7c,null))[_0x4776('0x37')](handleError(_0x225c7c,null));};exports[_0x4776('0xba')]=function(_0x58f573,_0x22fa9a,_0x47a0b8){var _0x18aa9f={'raw':![],'where':{}};var _0x58740c={};var _0xd364c8={'count':0x0,'rows':[]};return db[_0x4776('0x9a')]['findOne']({'where':{'id':_0x58f573[_0x4776('0xb5')]['id']}})[_0x4776('0x2a')](handleEntityNotFound(_0x22fa9a,null))[_0x4776('0x2a')](function(_0x2826bc){if(_0x2826bc){_0x58740c['model']=_[_0x4776('0x3d')](db[_0x4776('0xb8')]['rawAttributes']);_0x58740c[_0x4776('0x3c')]=_[_0x4776('0x3d')](_0x58f573[_0x4776('0x3c')]);_0x58740c[_0x4776('0x3e')]=_['intersection'](_0x58740c[_0x4776('0x3b')],_0x58740c[_0x4776('0x3c')]);_0x18aa9f['attributes']=_[_0x4776('0x3f')](_0x58740c[_0x4776('0x3b')],qs[_0x4776('0x40')](_0x58f573['query'][_0x4776('0x40')]));_0x18aa9f[_0x4776('0x41')]=_0x18aa9f[_0x4776('0x41')][_0x4776('0x42')]?_0x18aa9f['attributes']:_0x58740c['model'];if(!_0x58f573[_0x4776('0x3c')][_0x4776('0x43')](_0x4776('0xbb'))){_0x18aa9f[_0x4776('0x24')]=qs['limit'](_0x58f573['query'][_0x4776('0x24')]);_0x18aa9f[_0x4776('0x23')]=qs[_0x4776('0x23')](_0x58f573[_0x4776('0x3c')][_0x4776('0x23')]);}_0x18aa9f['order']=qs[_0x4776('0x45')](_0x58f573[_0x4776('0x3c')][_0x4776('0x45')]);_0x18aa9f[_0x4776('0x46')]=qs[_0x4776('0x3e')](_[_0x4776('0x47')](_0x58f573[_0x4776('0x3c')],_0x58740c[_0x4776('0x3e')]));_0x18aa9f[_0x4776('0x46')][_0x4776('0xaf')]=_0x2826bc['id'];if(_0x58f573[_0x4776('0x3c')]['filter']){_0x18aa9f[_0x4776('0x46')]=_[_0x4776('0x99')](_0x18aa9f[_0x4776('0x46')],{'$or':_[_0x4776('0x31')](_0x18aa9f[_0x4776('0x41')],function(_0x3cd2de){var _0x509784={};_0x509784[_0x3cd2de]={'$like':'%'+_0x58f573[_0x4776('0x3c')][_0x4776('0x84')]+'%'};return _0x509784;})});}if(_0x58f573['query'][_0x4776('0xbc')]){var _0x5bfedb=_0x58f573[_0x4776('0x3c')][_0x4776('0xbc')][_0x4776('0x34')](',');var _0x2b4e54={};_0x2b4e54[_0x5bfedb[0x0]]={'$gte':moment(_0x5bfedb[0x1])[_0x4776('0xbd')](_0x4776('0xbe'))};_0x18aa9f[_0x4776('0x46')]=_['merge'](_0x18aa9f[_0x4776('0x46')],_0x2b4e54);}_0x18aa9f=_[_0x4776('0x99')]({},_0x18aa9f,_0x58f573[_0x4776('0xbf')]);return db[_0x4776('0xb8')][_0x4776('0x22')]({'where':_0x18aa9f[_0x4776('0x46')]})[_0x4776('0x2a')](function(_0x547c20){_0xd364c8[_0x4776('0x22')]=_0x547c20;if(_0x58f573[_0x4776('0x3c')][_0x4776('0xc0')]){_0x18aa9f[_0x4776('0xc1')]=[{'all':!![]}];}return db[_0x4776('0xb8')]['findAll'](_0x18aa9f);})[_0x4776('0x2a')](function(_0x312ef5){_0xd364c8['rows']=_0x312ef5;return _0xd364c8;});}})['then'](respondWithFilteredResult(_0x22fa9a,_0x18aa9f))[_0x4776('0x37')](handleError(_0x22fa9a,null));};exports[_0x4776('0xc2')]=function(_0x1f150f,_0xd4715c,_0x7a647f){return db[_0x4776('0x9a')][_0x4776('0x6a')]({'where':{'id':_0x1f150f[_0x4776('0xb5')]['id']}})[_0x4776('0x2a')](handleEntityNotFound(_0xd4715c,null))['then'](function(_0x9373ab){if(_0x9373ab){return _0x9373ab['setTags'](_0x1f150f[_0x4776('0xb4')][_0x4776('0xb9')],_[_0x4776('0xc3')](_0x1f150f[_0x4776('0xb4')],[_0x4776('0xb9'),'id'])||{})[_0x4776('0xc4')](function(){return db[_0x4776('0x6f')][_0x4776('0xc5')]({'attributes':['id',_0x4776('0x2e'),'color'],'where':{'id':_0x1f150f[_0x4776('0xb4')][_0x4776('0xb9')]}});})[_0x4776('0x2a')](function(_0x511c56){socket[_0x4776('0xc6')]('openchannelInteractionTags:save',{'id':Number(_0x1f150f[_0x4776('0xb5')]['id']),'tags':_0x511c56||[]});return{'id':Number(_0x1f150f[_0x4776('0xb5')]['id']),'tags':_0x511c56||[]};});}})[_0x4776('0x2a')](respondWithResult(_0xd4715c,null))[_0x4776('0x37')](handleError(_0xd4715c,null));};exports['removeTags']=function(_0x34f127,_0x5385c4,_0x317a75){return db[_0x4776('0x9a')][_0x4776('0x6a')]({'where':{'id':_0x34f127[_0x4776('0xb5')]['id']}})[_0x4776('0x2a')](handleEntityNotFound(_0x5385c4,null))[_0x4776('0x2a')](function(_0xc65b27){if(_0xc65b27){return _0xc65b27[_0x4776('0xc7')](_0x34f127['query'][_0x4776('0xb9')]);}})['then'](respondWithStatusCode(_0x5385c4,null))[_0x4776('0x37')](handleError(_0x5385c4,null));};exports[_0x4776('0xc8')]=function(_0x170e8d,_0x186889){var _0x133ba=moment()[_0x4776('0xc9')]()[_0x4776('0x97')]();var _0x2e82b1=path[_0x4776('0xca')](config[_0x4776('0xcb')],_0x4776('0xcc'),_0x4776('0xcd'),_0x4776('0xce'));var _0x4ccb8a=path['join'](config['root'],'server',_0x4776('0xcd'),_0x4776('0xcf'));var _0x350549=path[_0x4776('0xca')](_0x2e82b1,_0x133ba);var _0x3d9e9e=util['format'](_0x4776('0xd0'),_0x170e8d[_0x4776('0xb5')]['id'],_0x133ba);var _0x13cb41=path[_0x4776('0xca')](_0x2e82b1,_0x3d9e9e);var _0x2aa91b=[];_0x2aa91b[_0x4776('0x36')]({'model':db[_0x4776('0x72')],'as':'User','attributes':['id',_0x4776('0xd1')],'raw':!![]});_0x2aa91b[_0x4776('0x36')]({'model':db[_0x4776('0xd2')],'as':'Contact','attributes':['id',_0x4776('0xd3'),_0x4776('0xd4')],'raw':!![]});if(_0x170e8d[_0x4776('0x3c')][_0x4776('0xcf')]){_0x2aa91b['push']({'model':db[_0x4776('0xd5')],'as':_0x4776('0xd5'),'raw':!![]});}var _0x33f171=[{'model':db[_0x4776('0xb8')],'as':_0x4776('0xd6'),'attributes':['id',_0x4776('0xb4'),_0x4776('0x79'),_0x4776('0xd7'),_0x4776('0xd8'),_0x4776('0x7f')],'include':_0x2aa91b}];_0x33f171['push']({'model':db['OpenchannelAccount'],'as':_0x4776('0xd9'),'attributes':['id',_0x4776('0x2e')]});_0x33f171['push']({'model':db[_0x4776('0x72')],'as':'Owner','attributes':['id','fullname']});return db[_0x4776('0x9a')][_0x4776('0x6a')]({'where':{'id':_0x170e8d[_0x4776('0xb5')]['id']},'include':_0x33f171})[_0x4776('0x2a')](handleEntityNotFound(_0x186889,null))['then'](function(_0x3b2cb2){if(_0x3b2cb2){var _0x469f2f=_0x3b2cb2[_0x4776('0xda')]({'plain':!![]});fs[_0x4776('0xdb')](_0x350549);var _0xf55d11={'format':'A4','border':_0x4776('0xdc'),'header':{'height':_0x4776('0xdd'),'contents':{'first':_0x4776('0xde')}},'footer':{'height':_0x4776('0xdf'),'contents':{'default':util[_0x4776('0xbd')](_0x4776('0xe0'),util[_0x4776('0xbd')]('%s\x20#%d',_0x4776('0xe1'),_0x469f2f['id']),moment()[_0x4776('0xbd')](_0x4776('0xe2'))[_0x4776('0x97')]())}}};var _0x371f84={'channel':_0x4776('0xe1'),'account':_0x469f2f['Account'][_0x4776('0x2e')],'agent':_0x469f2f[_0x4776('0xe3')]?_0x469f2f['Owner'][_0x4776('0xd1')]:'N.A.','createdAt':moment(_0x469f2f[_0x4776('0x79')])[_0x4776('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4776('0x97')](),'closedAt':_0x469f2f['closed']?moment(_0x469f2f['closedAt'])['format'](_0x4776('0xbe'))[_0x4776('0x97')]():'','disposition':_0x469f2f[_0x4776('0xe4')],'visibility':_0x469f2f[_0x4776('0xe5')]?_0x4776('0xe6'):'Private','messages':_(_0x469f2f[_0x4776('0xd6')])[_0x4776('0x84')]({'secret':![]})[_0x4776('0x31')](function(_0x472021){if(_0x472021[_0x4776('0xd5')]){var _0x4688ea=path['join'](_0x4ccb8a,_0x472021[_0x4776('0xd5')][_0x4776('0xe7')]);if(fs[_0x4776('0xe8')](_0x4688ea)){fs[_0x4776('0xe9')](_0x4688ea)[_0x4776('0xea')](fs[_0x4776('0xeb')](path[_0x4776('0xca')](_0x350549,_0x472021[_0x4776('0xd5')][_0x4776('0xe7')])));}}return{'date':moment(_0x472021[_0x4776('0x79')])[_0x4776('0xbd')](_0x4776('0xbe'))['toString'](),'sender':_0x472021[_0x4776('0xd7')]==='out'?_0x472021[_0x4776('0x72')]?_0x472021[_0x4776('0x72')][_0x4776('0xd1')]:_0x4776('0xec'):_0x472021['Contact'][_0x4776('0xd3')]+(_0x472021['Contact'][_0x4776('0xd4')]?'\x20'+_0x472021[_0x4776('0xed')][_0x4776('0xd4')]:''),'body':_0x472021[_0x4776('0xd5')]?_0x472021[_0x4776('0xd5')][_0x4776('0xe7')]:_0x472021['body'],'direction':_0x472021[_0x4776('0xd7')]==='out'?'A':'C','secret':_0x472021[_0x4776('0xd8')],'read':_0x472021[_0x4776('0x7f')],'attachment':_0x472021['Attachment']};})[_0x4776('0x63')]()};return ejs[_0x4776('0xee')](path['join'](config['root'],_0x4776('0xcc'),'views',_0x4776('0xef')),{'interaction':_0x371f84})['then'](function(_0x542268){return new BPromise(function(_0x1ca1a8,_0x3a7056){pdf[_0x4776('0xb3')](_0x542268,_0xf55d11)[_0x4776('0xf0')](path[_0x4776('0xca')](_0x350549,_0x4776('0xf1')+_0x469f2f['id']+'-'+_0x133ba+_0x4776('0xf2')),function(_0x563a0d,_0x11dd44){if(_0x563a0d)return _0x3a7056(_0x563a0d);_0x1ca1a8(_0x11dd44);});});})['then'](function(){return new BPromise(function(_0x2f759c,_0x2732ad){zipdir(_0x350549,{'saveTo':_0x13cb41},function(_0xb91109,_0xae05e5){if(_0xb91109)return _0x2732ad(_0xb91109);return _0x2f759c(_0xae05e5);});})[_0x4776('0x2a')](function(){return new BPromise(function(_0x30d5bd,_0x2d1420){rimraf(_0x350549,function(_0x1fcc49){if(_0x1fcc49)_0x2d1420(_0x1fcc49);return _0x30d5bd();});});})[_0x4776('0x2a')](function(){return _0x186889[_0x4776('0xc8')](_0x13cb41,_0x3d9e9e,function(_0x5441f2){if(_0x5441f2){console[_0x4776('0xf3')]('err',_0x5441f2);}else{fs[_0x4776('0xf4')](_0x13cb41);}});});});}else{return _0x186889[_0x4776('0x1e')](0xc8);}})[_0x4776('0x37')](handleError(_0x186889,null));}; \ No newline at end of file +var _0xd4d1=['addMessage','OpenchannelMessage','ids','getMessages','findOne','OpenchannelInteractionId','$gte','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','format','Openchannel','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','limit','Content-Range','save','update','then','end','sendStatus','name','send','map','TagIds','Tags','split','forEach','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','field','select','u.id','u.fullname','ui.OpenchannelInteractionId','from','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','openchannel_interaction_has_tags','tools_tags','expr','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','include','options','create','destroy'];(function(_0x4dad89,_0x494213){var _0x41dee5=function(_0x89bcab){while(--_0x89bcab){_0x4dad89['push'](_0x4dad89['shift']());}};_0x41dee5(++_0x494213);}(_0xd4d1,0x123));var _0x1d4d=function(_0x4003d2,_0x5a767e){_0x4003d2=_0x4003d2-0x0;var _0x2b86e3=_0xd4d1[_0x4003d2];return _0x2b86e3;};'use strict';var pdf=require(_0x1d4d('0x0'));var emlformat=require(_0x1d4d('0x1'));var rimraf=require(_0x1d4d('0x2'));var zipdir=require(_0x1d4d('0x3'));var jsonpatch=require(_0x1d4d('0x4'));var rp=require('request-promise');var moment=require(_0x1d4d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1d4d('0x6'));var util=require('util');var path=require(_0x1d4d('0x7'));var sox=require('sox');var csv=require(_0x1d4d('0x8'));var ejs=require(_0x1d4d('0x9'));var fs=require('fs');var _=require(_0x1d4d('0xa'));var squel=require('squel');var crypto=require(_0x1d4d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1d4d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1d4d('0xd'));var Papa=require(_0x1d4d('0xe'));var Redis=require(_0x1d4d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1d4d('0x10'));var as=require(_0x1d4d('0x11'));var hardwareService=require(_0x1d4d('0x12'));var logger=require('../../config/logger')(_0x1d4d('0x13'));var utils=require(_0x1d4d('0x14'));var config=require(_0x1d4d('0x15'));var db=require(_0x1d4d('0x16'))['db'];config[_0x1d4d('0x17')]=_[_0x1d4d('0x18')](config[_0x1d4d('0x17')],{'host':_0x1d4d('0x19'),'port':0x18eb});var socket=require(_0x1d4d('0x1a'))(new Redis(config[_0x1d4d('0x17')]));require('./openchannelInteraction.socket')[_0x1d4d('0x1b')](socket);function respondWithStatusCode(_0x4561e3,_0x505e7e){_0x505e7e=_0x505e7e||0xcc;return function(_0x5aea3c){if(_0x5aea3c){return _0x4561e3['sendStatus'](_0x505e7e);}return _0x4561e3[_0x1d4d('0x1c')](_0x505e7e)['end']();};}function respondWithResult(_0xcc78f9,_0x59de78){_0x59de78=_0x59de78||0xc8;return function(_0x51b82a){if(_0x51b82a){return _0xcc78f9[_0x1d4d('0x1c')](_0x59de78)[_0x1d4d('0x1d')](_0x51b82a);}};}function respondWithFilteredResult(_0x566807,_0x1adf14){return function(_0x4b7e7a){if(_0x4b7e7a){var _0x4254a6=_0x4b7e7a[_0x1d4d('0x1e')],_0x1b591b=_0x1adf14['offset'],_0x16fa99=_0x1adf14[_0x1d4d('0x1f')]+_0x1adf14[_0x1d4d('0x20')],_0x4611c7;if(_0x16fa99>=_0x4254a6){_0x16fa99=_0x4254a6;_0x4611c7=0xc8;}else{_0x4611c7=0xce;}_0x566807['status'](_0x4611c7);return _0x566807['set'](_0x1d4d('0x21'),_0x1b591b+'-'+_0x16fa99+'/'+_0x4254a6)[_0x1d4d('0x1d')](_0x4b7e7a);}return null;};}function patchUpdates(_0x3a2f35){return function(_0x4de56f){try{jsonpatch['apply'](_0x4de56f,_0x3a2f35,!![]);}catch(_0x5500e8){return BPromise['reject'](_0x5500e8);}return _0x4de56f[_0x1d4d('0x22')]();};}function saveUpdates(_0x227278,_0x321e00){return function(_0x4fdf0a){if(_0x4fdf0a){return _0x4fdf0a[_0x1d4d('0x23')](_0x227278)['then'](function(_0x4b985b){return _0x4b985b;});}return null;};}function removeEntity(_0x3ce3ba,_0x15386b){return function(_0x544f7a){if(_0x544f7a){return _0x544f7a['destroy']()[_0x1d4d('0x24')](function(){_0x3ce3ba[_0x1d4d('0x1c')](0xcc)[_0x1d4d('0x25')]();});}};}function handleEntityNotFound(_0x31affb,_0x50a238){return function(_0x38fda2){if(!_0x38fda2){_0x31affb[_0x1d4d('0x26')](0x194);}return _0x38fda2;};}function handleError(_0x14b4e9,_0x5ab0f3){_0x5ab0f3=_0x5ab0f3||0x1f4;return function(_0x310ec0){logger['error'](_0x310ec0['stack']);if(_0x310ec0[_0x1d4d('0x27')]){delete _0x310ec0[_0x1d4d('0x27')];}_0x14b4e9[_0x1d4d('0x1c')](_0x5ab0f3)[_0x1d4d('0x28')](_0x310ec0);};}function getInteractionUsers(_0x27daea,_0x575ff3){return new BPromise(function(_0xc9f05b,_0x435bcb){try{if(_0x575ff3[_0x27daea['id']]){_0x27daea['Users']=_[_0x1d4d('0x29')](_0x575ff3[_0x27daea['id']],function(_0x30a08d){return{'id':_0x30a08d['id'],'fullname':_0x30a08d['fullname']};});}}catch(_0x4d3ce8){_0x435bcb(_0x4d3ce8);}_0xc9f05b(_0x27daea);});}function getInteractionTags(_0x18bb03,_0x89cd09){return new BPromise(function(_0x369d81,_0x3f829f){try{if(_0x18bb03[_0x1d4d('0x2a')]){_0x18bb03[_0x1d4d('0x2b')]=[];_0x18bb03['TagIds'][_0x1d4d('0x2c')](',')[_0x1d4d('0x2d')](function(_0x4b3f85){_0x18bb03[_0x1d4d('0x2b')]['push'](_0x89cd09[_0x4b3f85]);});}delete _0x18bb03[_0x1d4d('0x2a')];}catch(_0x14d0c1){_0x3f829f(_0x14d0c1);}_0x369d81(_0x18bb03);});}function updateOpenchannelInteraction(_0xa2bfd1,_0x3e3c90,_0x1383ee){return new BPromise(function(_0x1df322,_0x28131f){return getInteractionUsers(_0xa2bfd1,_0x1383ee)[_0x1d4d('0x24')](function(_0x3cf167){return getInteractionTags(_0x3cf167,_0x3e3c90);})['then'](function(_0x4ddf1c){_0x1df322(_0x4ddf1c);})[_0x1d4d('0x2e')](function(_0x5c3e71){_0x28131f(_0x5c3e71);});});}exports[_0x1d4d('0x2f')]=function(_0x153bfe,_0x35c676){var _0x1755e6={},_0x25f375={},_0x39af1f={'count':0x0,'rows':[]};var _0x1a32fa=_[_0x1d4d('0x29')](db[_0x1d4d('0x30')][_0x1d4d('0x31')],function(_0x29bfc0){return{'name':_0x29bfc0[_0x1d4d('0x32')],'type':_0x29bfc0[_0x1d4d('0x33')]['key']};});_0x25f375[_0x1d4d('0x34')]=_['map'](_0x1a32fa,_0x1d4d('0x27'));_0x25f375[_0x1d4d('0x35')]=_['keys'](_0x153bfe[_0x1d4d('0x35')]);_0x25f375['filters']=_[_0x1d4d('0x36')](_0x25f375[_0x1d4d('0x34')],_0x25f375[_0x1d4d('0x35')]);_0x1755e6[_0x1d4d('0x37')]=_['intersection'](_0x25f375[_0x1d4d('0x34')],qs[_0x1d4d('0x38')](_0x153bfe['query'][_0x1d4d('0x38')]));_0x1755e6[_0x1d4d('0x37')]=_0x1755e6[_0x1d4d('0x37')][_0x1d4d('0x39')]?_0x1755e6['attributes']:_0x25f375[_0x1d4d('0x34')];if(!_0x153bfe['query'][_0x1d4d('0x3a')](_0x1d4d('0x3b'))){_0x1755e6[_0x1d4d('0x20')]=qs['limit'](_0x153bfe['query'][_0x1d4d('0x20')]);_0x1755e6[_0x1d4d('0x1f')]=qs['offset'](_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x1f')]);}_0x1755e6[_0x1d4d('0x3c')]=qs[_0x1d4d('0x3d')](_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x3d')]);_0x1755e6['where']=qs[_0x1d4d('0x3e')](_[_0x1d4d('0x3f')](_0x153bfe[_0x1d4d('0x35')],_0x25f375['filters']),_0x1a32fa);var _0x272c95=[];var _0x3959d8=squel['select']()[_0x1d4d('0x40')]('id')[_0x1d4d('0x40')](_0x1d4d('0x27'))[_0x1d4d('0x40')]('color')['from']('tools_tags');var _0x4bc2d1=squel[_0x1d4d('0x41')]()[_0x1d4d('0x40')](_0x1d4d('0x42'))[_0x1d4d('0x40')](_0x1d4d('0x43'))[_0x1d4d('0x40')](_0x1d4d('0x44'))[_0x1d4d('0x45')]('user_has_openchannel_interactions','ui')[_0x1d4d('0x46')](_0x1d4d('0x47'),'u',_0x1d4d('0x48'));var _0xb5a76f=squel['select']()[_0x1d4d('0x45')](_0x1d4d('0x49'),'i')[_0x1d4d('0x46')](_0x1d4d('0x4a'),'c',_0x1d4d('0x4b'))[_0x1d4d('0x46')]('users','o',_0x1d4d('0x4c'))[_0x1d4d('0x46')](_0x1d4d('0x4d'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x1d4d('0x46')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x1d4d('0x46')](_0x1d4d('0x4e'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x1d4d('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x2e0a57=squel[_0x1d4d('0x50')]();var _0x9dd1a5=[];var _0x158fca=squel['expr']();var _0x27b68d;if(_0x153bfe['query']['search']){_0x27b68d=as['parseSearch'](_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x51')]);var _0x11fd27=_0x27b68d[_0x1d4d('0x52')];for(var _0x3dc499=0x0;_0x3dc499<_0x27b68d[_0x1d4d('0x53')][_0x1d4d('0x39')];_0x3dc499++){var _0x792751=_0x27b68d[_0x1d4d('0x53')][_0x3dc499];var _0x1d07ef='i';var _0x28ea46=_[_0x1d4d('0x54')](_0x1a32fa,[_0x1d4d('0x27'),_0x792751[_0x1d4d('0x40')]]);if(!_0x28ea46){switch(_0x792751['field']){case'unreadMessages':if(_0x792751[_0x1d4d('0x55')]==0x1){_0xb5a76f[_0x1d4d('0x56')]('`'+_0x792751[_0x1d4d('0x40')]+_0x1d4d('0x57'));}else{_0xb5a76f[_0x1d4d('0x56')]('`'+_0x792751[_0x1d4d('0x40')]+_0x1d4d('0x58'));}break;case'Contact':if(_0x792751['operator']===_0x1d4d('0x59')){if(_0x792751['value'][_0x1d4d('0x2c')]('\x20')[_0x1d4d('0x39')]>0x1){_0x2e0a57[_0x11fd27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x792751[_0x1d4d('0x55')]),null);}else{var _0x3df075='%'+_0x792751[_0x1d4d('0x55')]+'%';_0x2e0a57[_0x11fd27](_0x1d4d('0x5a'),_0x3df075,_0x3df075,_0x3df075);}}else{_0x28ea46=_['find'](_0x1a32fa,[_0x1d4d('0x27'),'ContactId']);_0x792751[_0x1d4d('0x40')]=_0x1d4d('0x5b');_0x41ac8f=as[_0x1d4d('0x5c')](_0x1d07ef,_0x28ea46[_0x1d4d('0x33')],_0x792751);_0x2e0a57[_0x11fd27](_0x41ac8f[_0x1d4d('0x5d')],_0x41ac8f[_0x1d4d('0x55')]['start'],_0x41ac8f[_0x1d4d('0x55')]['end']);}break;case'Tag':var _0x2d30a5=_0x792751['value'][_0x1d4d('0x2c')](',')[_0x1d4d('0x29')](function(_0x744dd2){return Number(_0x744dd2);});_0x2d30a5[_0x1d4d('0x2d')](function(_0x13dd96){_0x158fca['or'](_0x1d4d('0x5e'),'%,'+_0x13dd96+',%');});_0x9dd1a5=_['union'](_0x9dd1a5,_0x2d30a5);break;case _0x1d4d('0x5f'):if(_0x792751[_0x1d4d('0x60')]===_0x1d4d('0x59')){_0x2e0a57[_0x11fd27](_0x1d4d('0x61'),'%'+_0x792751[_0x1d4d('0x55')]+'%',null);}else{_0x28ea46=_[_0x1d4d('0x54')](_0x1a32fa,['name',_0x1d4d('0x62')]);_0x792751[_0x1d4d('0x40')]=_0x1d4d('0x62');_0x41ac8f=as[_0x1d4d('0x5c')](_0x1d07ef,_0x28ea46[_0x1d4d('0x33')],_0x792751);_0x2e0a57[_0x11fd27](_0x41ac8f[_0x1d4d('0x5d')],_0x41ac8f[_0x1d4d('0x55')][_0x1d4d('0x63')],_0x41ac8f['value'][_0x1d4d('0x25')]);}break;case _0x1d4d('0x64'):_0x41ac8f=as[_0x1d4d('0x5c')]('me',null,_0x792751);_0x2e0a57[_0x11fd27](_0x41ac8f[_0x1d4d('0x5d')],_0x41ac8f[_0x1d4d('0x55')][_0x1d4d('0x63')],_0x41ac8f['value'][_0x1d4d('0x25')]);break;}}else{var _0x41ac8f=as[_0x1d4d('0x5c')](_0x1d07ef,_0x28ea46[_0x1d4d('0x33')],_0x792751);_0x2e0a57[_0x11fd27](_0x41ac8f[_0x1d4d('0x5d')],_0x41ac8f[_0x1d4d('0x55')]['start'],_0x41ac8f[_0x1d4d('0x55')]['end']);}}}else{var _0x4cc97c=_(_0x153bfe[_0x1d4d('0x35')])[_0x1d4d('0x65')]()['map'](function(_0xc8316a){return _['some'](_0x1a32fa,[_0x1d4d('0x27'),_0xc8316a])?_0xc8316a:undefined;})[_0x1d4d('0x66')]()[_0x1d4d('0x55')]();if(!_[_0x1d4d('0x67')](_0x4cc97c)){_0x4cc97c['forEach'](function(_0x5d6e0b){if(_0x5d6e0b===_0x1d4d('0x68')){_0xb5a76f[_0x1d4d('0x69')](_0x1d4d('0x6a'),[][_0x1d4d('0x6b')](_0x153bfe[_0x1d4d('0x35')][_0x5d6e0b]));}else if(_0x5d6e0b===_0x1d4d('0x6c')){var _0x38fd9b=JSON['parse'](_0x153bfe['query'][_0x5d6e0b])['$gte'];var _0x469f16=JSON['parse'](_0x153bfe[_0x1d4d('0x35')][_0x5d6e0b])[_0x1d4d('0x6d')];_0xb5a76f['where'](_0x1d4d('0x6e'),_0x38fd9b,_0x469f16);}else{if(_0x153bfe[_0x1d4d('0x35')][_0x5d6e0b]===_0x1d4d('0x6f')){_0xb5a76f[_0x1d4d('0x69')]('i.'+_0x5d6e0b+'\x20IS\x20NULL');}else{_0xb5a76f['where']('i.'+_0x5d6e0b+'\x20=\x20?',_0x153bfe[_0x1d4d('0x35')][_0x5d6e0b]);}}});}if(_0x153bfe[_0x1d4d('0x35')]['read']){if(_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x70')]==0x1){_0xb5a76f[_0x1d4d('0x56')](_0x1d4d('0x71'));}else{_0xb5a76f[_0x1d4d('0x56')](_0x1d4d('0x72'));}}if(_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x73')]){_0x9dd1a5=_[_0x1d4d('0x74')](_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x73')])?_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x73')]:new Array(_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x73')]);_0x9dd1a5[_0x1d4d('0x2d')](function(_0x47107f){_0x158fca['or'](_0x1d4d('0x5e'),'%,'+_0x47107f+',%');});}if(_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x75')]){var _0x511790=_0x153bfe[_0x1d4d('0x35')]['filter'][_0x1d4d('0x76')]('\x5c','\x5c\x5c')[_0x1d4d('0x76')]('\x27\x27',_0x1d4d('0x77'));if(qs[_0x1d4d('0x78')](_0x511790)){_0x2e0a57['or'](_0x1d4d('0x79'),_0x511790+'%');}else{_0x2e0a57['or'](_0x1d4d('0x7a'),qs[_0x1d4d('0x7b')](_0x511790))['or'](_0x1d4d('0x7c'),_0x511790+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x511790+'%');}}}_0xb5a76f['where'](_0x2e0a57);_0xb5a76f[_0x1d4d('0x7d')](_0x1d4d('0x7e'));var _0x52782d={'type':db[_0x1d4d('0x7f')][_0x1d4d('0x80')][_0x1d4d('0x81')],'raw':!![]};var _0x2c8160=_0xb5a76f[_0x1d4d('0x82')]();_0x2c8160['field']('i.id');_0x2c8160[_0x1d4d('0x40')](_0x1d4d('0x83'),_0x1d4d('0x84'));if(_0x1755e6['order']){_0x1755e6['order'][_0x1d4d('0x2d')](function(_0x71162){_0xb5a76f[_0x1d4d('0x3c')]('i.'+_0x71162[0x0],_0x71162[0x1]===_0x1d4d('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x9dd1a5)){_0xb5a76f['having'](_0x158fca);_0x2c8160['where'](_0x1d4d('0x86'),_0x9dd1a5);}BPromise[_0x1d4d('0x87')]()['then'](function(){if(!_0x27b68d){if(_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x68')]||_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x88')])return;_0x2c8160[_0x1d4d('0x69')](_0x1d4d('0x89'));_0xb5a76f['where'](_0x1d4d('0x89'));return;}return _0x153bfe[_0x1d4d('0x8a')][_0x1d4d('0x8b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x123973){if(_['isEmpty'](_0x123973)){_0x2c8160[_0x1d4d('0x69')]('i.OpenchannelAccountId\x20IS\x20NULL');_0xb5a76f['where'](_0x1d4d('0x8c'));}else{_0x2c8160['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x1d4d('0x29')](_0x123973,'id'));_0xb5a76f[_0x1d4d('0x69')](_0x1d4d('0x6a'),_[_0x1d4d('0x29')](_0x123973,'id'));}});})[_0x1d4d('0x24')](function(){db['sequelize'][_0x1d4d('0x35')](_0x2c8160['toString'](),_0x52782d)[_0x1d4d('0x24')](function(_0x268b86){_0x39af1f['count']=_0x268b86[_0x1d4d('0x39')];if(_0x39af1f[_0x1d4d('0x1e')]===0x0)return[];return db[_0x1d4d('0x8d')][_0x1d4d('0x35')](_0x3959d8['toString'](),_0x52782d)['then'](function(_0x168b3e){_0x272c95=_['keyBy'](_0x168b3e,'id');_0x52782d=_[_0x1d4d('0x8e')](_0x52782d,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x153bfe[_0x1d4d('0x35')][_0x1d4d('0x38')]){_0x1755e6[_0x1d4d('0x37')][_0x1d4d('0x2d')](function(_0x338e5f){_0xb5a76f[_0x1d4d('0x40')]('i.'+_0x338e5f);});}else{_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0x83'),_0x1d4d('0x84'));_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0x8f'),_0x1d4d('0x90'));_0xb5a76f['field'](_0x1d4d('0x91'),_0x1d4d('0x92'));_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0x93'));_0xb5a76f['field'](_0x1d4d('0x94'),_0x1d4d('0x95'));_0xb5a76f[_0x1d4d('0x40')]('c.lastName',_0x1d4d('0x96'));_0xb5a76f['field'](_0x1d4d('0x97'),_0x1d4d('0x98'));_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0x99'),_0x1d4d('0x9a'));_0xb5a76f['field'](_0x1d4d('0x9b'),'Contact.mobile');_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0x9c'),_0x1d4d('0x9d'));_0xb5a76f['field'](_0x1d4d('0x9e'),'Owner.fullname');_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0x9f'),_0x1d4d('0xa0'));_0xb5a76f[_0x1d4d('0x40')](_0x1d4d('0xa1'),_0x1d4d('0x2a'));}if(_0x1755e6[_0x1d4d('0x20')])_0xb5a76f[_0x1d4d('0x20')](_0x1755e6[_0x1d4d('0x20')]);if(_0x1755e6[_0x1d4d('0x1f')])_0xb5a76f[_0x1d4d('0x1f')](_0x1755e6[_0x1d4d('0x1f')]);return db[_0x1d4d('0x8d')][_0x1d4d('0x35')](_0xb5a76f[_0x1d4d('0xa2')](),_0x52782d);})[_0x1d4d('0x24')](function(_0x26a20b){_0x4bc2d1[_0x1d4d('0x69')](_0x1d4d('0xa3'),_[_0x1d4d('0x29')](_0x26a20b,'id'));return db[_0x1d4d('0x8d')][_0x1d4d('0x35')](_0x4bc2d1['toString'](),_0x52782d)[_0x1d4d('0x24')](function(_0x36724c){var _0x4aff40=_[_0x1d4d('0xa4')](_0x36724c,'OpenchannelInteractionId');var _0x314b61=[];_0x26a20b[_0x1d4d('0x2d')](function(_0x48949f){_0x314b61[_0x1d4d('0xa5')](updateOpenchannelInteraction(_0x48949f,_0x272c95,_0x4aff40));});return BPromise[_0x1d4d('0xa6')](_0x314b61);});});})[_0x1d4d('0x24')](function(_0x415ea9){_0x39af1f[_0x1d4d('0xa7')]=_0x415ea9;return _0x39af1f;})['then'](respondWithFilteredResult(_0x35c676,_0x1755e6));})[_0x1d4d('0x2e')](handleError(_0x35c676,null));};exports[_0x1d4d('0xa8')]=function(_0x3ba538,_0x251936){var _0x4aa0d0={'raw':![],'where':{'id':_0x3ba538[_0x1d4d('0xa9')]['id']}},_0x1c1e26={};_0x1c1e26[_0x1d4d('0x34')]=_[_0x1d4d('0x65')](db[_0x1d4d('0x30')][_0x1d4d('0x31')]);_0x1c1e26[_0x1d4d('0x35')]=_['keys'](_0x3ba538[_0x1d4d('0x35')]);_0x1c1e26[_0x1d4d('0x3e')]=_[_0x1d4d('0x36')](_0x1c1e26[_0x1d4d('0x34')],_0x1c1e26[_0x1d4d('0x35')]);_0x4aa0d0[_0x1d4d('0x37')]=_[_0x1d4d('0x36')](_0x1c1e26[_0x1d4d('0x34')],qs[_0x1d4d('0x38')](_0x3ba538['query'][_0x1d4d('0x38')]));_0x4aa0d0[_0x1d4d('0x37')]=_0x4aa0d0[_0x1d4d('0x37')][_0x1d4d('0x39')]?_0x4aa0d0[_0x1d4d('0x37')]:_0x1c1e26[_0x1d4d('0x34')];if(_0x3ba538['query'][_0x1d4d('0xaa')]){_0x4aa0d0[_0x1d4d('0xab')]=[{'all':!![]}];}_0x4aa0d0=_['merge']({},_0x4aa0d0,_0x3ba538[_0x1d4d('0xac')]);return db['OpenchannelInteraction'][_0x1d4d('0x54')](_0x4aa0d0)['then'](handleEntityNotFound(_0x251936,null))[_0x1d4d('0x24')](respondWithResult(_0x251936,null))[_0x1d4d('0x2e')](handleError(_0x251936,null));};exports[_0x1d4d('0xad')]=function(_0x8d7a3a,_0x415be4){return db[_0x1d4d('0x30')][_0x1d4d('0xad')](_0x8d7a3a['body'],{})[_0x1d4d('0x24')](respondWithResult(_0x415be4,0xc9))['catch'](handleError(_0x415be4,null));};exports['update']=function(_0x4f7d96,_0x17705c){if(_0x4f7d96[_0x1d4d('0x64')]['id']){delete _0x4f7d96[_0x1d4d('0x64')]['id'];}return db[_0x1d4d('0x30')][_0x1d4d('0x54')]({'where':{'id':_0x4f7d96['params']['id']}})[_0x1d4d('0x24')](handleEntityNotFound(_0x17705c,null))['then'](saveUpdates(_0x4f7d96[_0x1d4d('0x64')],null))['then'](respondWithResult(_0x17705c,null))[_0x1d4d('0x2e')](handleError(_0x17705c,null));};exports[_0x1d4d('0xae')]=function(_0x26b51b,_0x4624aa){return db[_0x1d4d('0x30')][_0x1d4d('0x54')]({'where':{'id':_0x26b51b[_0x1d4d('0xa9')]['id']}})['then'](handleEntityNotFound(_0x4624aa,null))[_0x1d4d('0x24')](removeEntity(_0x4624aa,null))[_0x1d4d('0x2e')](handleError(_0x4624aa,null));};exports['describe']=function(_0x2a0cd8,_0x599302){return db['OpenchannelInteraction']['describe']()['then'](respondWithResult(_0x599302,null))[_0x1d4d('0x2e')](handleError(_0x599302,null));};exports[_0x1d4d('0xaf')]=function(_0x2eb2d3,_0x58f26c,_0x23d11e){return db[_0x1d4d('0xb0')][_0x1d4d('0x54')]({'where':{'id':_0x2eb2d3[_0x1d4d('0xa9')]['id']}})[_0x1d4d('0x24')](handleEntityNotFound(_0x58f26c,null))['then'](function(_0x221022){if(_0x221022){return _0x221022[_0x1d4d('0xaf')](_0x2eb2d3[_0x1d4d('0x64')][_0x1d4d('0xb1')],_['omit'](_0x2eb2d3[_0x1d4d('0x64')],[_0x1d4d('0xb1'),'id'])||{});}})[_0x1d4d('0x24')](respondWithResult(_0x58f26c,null))[_0x1d4d('0x2e')](handleError(_0x58f26c,null));};exports[_0x1d4d('0xb2')]=function(_0x264db2,_0x3b7c50,_0x275f4d){var _0x146977={'raw':![],'where':{}};var _0x472c42={};var _0x1689f7={'count':0x0,'rows':[]};return db[_0x1d4d('0x30')][_0x1d4d('0xb3')]({'where':{'id':_0x264db2[_0x1d4d('0xa9')]['id']}})['then'](handleEntityNotFound(_0x3b7c50,null))[_0x1d4d('0x24')](function(_0x45a380){if(_0x45a380){_0x472c42[_0x1d4d('0x34')]=_[_0x1d4d('0x65')](db[_0x1d4d('0xb0')][_0x1d4d('0x31')]);_0x472c42['query']=_['keys'](_0x264db2[_0x1d4d('0x35')]);_0x472c42[_0x1d4d('0x3e')]=_['intersection'](_0x472c42['model'],_0x472c42[_0x1d4d('0x35')]);_0x146977[_0x1d4d('0x37')]=_[_0x1d4d('0x36')](_0x472c42[_0x1d4d('0x34')],qs[_0x1d4d('0x38')](_0x264db2[_0x1d4d('0x35')][_0x1d4d('0x38')]));_0x146977[_0x1d4d('0x37')]=_0x146977[_0x1d4d('0x37')][_0x1d4d('0x39')]?_0x146977[_0x1d4d('0x37')]:_0x472c42['model'];if(!_0x264db2[_0x1d4d('0x35')][_0x1d4d('0x3a')](_0x1d4d('0x3b'))){_0x146977[_0x1d4d('0x20')]=qs['limit'](_0x264db2[_0x1d4d('0x35')][_0x1d4d('0x20')]);_0x146977['offset']=qs[_0x1d4d('0x1f')](_0x264db2[_0x1d4d('0x35')][_0x1d4d('0x1f')]);}_0x146977[_0x1d4d('0x3c')]=qs['sort'](_0x264db2[_0x1d4d('0x35')][_0x1d4d('0x3d')]);_0x146977[_0x1d4d('0x69')]=qs['filters'](_['pick'](_0x264db2[_0x1d4d('0x35')],_0x472c42[_0x1d4d('0x3e')]));_0x146977[_0x1d4d('0x69')][_0x1d4d('0xb4')]=_0x45a380['id'];if(_0x264db2[_0x1d4d('0x35')][_0x1d4d('0x75')]){_0x146977[_0x1d4d('0x69')]=_[_0x1d4d('0x8e')](_0x146977[_0x1d4d('0x69')],{'$or':_[_0x1d4d('0x29')](_0x146977['attributes'],function(_0x5c6cc5){var _0x3ba10c={};_0x3ba10c[_0x5c6cc5]={'$like':'%'+_0x264db2['query'][_0x1d4d('0x75')]+'%'};return _0x3ba10c;})});}if(_0x264db2[_0x1d4d('0x35')]['$gte']){var _0xeaf8df=_0x264db2[_0x1d4d('0x35')][_0x1d4d('0xb5')][_0x1d4d('0x2c')](',');var _0xf45b3f={};_0xf45b3f[_0xeaf8df[0x0]]={'$gte':moment(_0xeaf8df[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x146977[_0x1d4d('0x69')]=_[_0x1d4d('0x8e')](_0x146977[_0x1d4d('0x69')],_0xf45b3f);}_0x146977=_[_0x1d4d('0x8e')]({},_0x146977,_0x264db2[_0x1d4d('0xac')]);return db[_0x1d4d('0xb0')][_0x1d4d('0x1e')]({'where':_0x146977['where']})[_0x1d4d('0x24')](function(_0x18bb64){_0x1689f7[_0x1d4d('0x1e')]=_0x18bb64;if(_0x264db2[_0x1d4d('0x35')][_0x1d4d('0xaa')]){_0x146977[_0x1d4d('0xab')]=[{'all':!![]}];}return db[_0x1d4d('0xb0')][_0x1d4d('0xb6')](_0x146977);})[_0x1d4d('0x24')](function(_0x21a3a5){_0x1689f7[_0x1d4d('0xa7')]=_0x21a3a5;return _0x1689f7;});}})[_0x1d4d('0x24')](respondWithFilteredResult(_0x3b7c50,_0x146977))[_0x1d4d('0x2e')](handleError(_0x3b7c50,null));};exports[_0x1d4d('0xb7')]=function(_0x5254f1,_0x2acfb3,_0x50fedc){return db['OpenchannelInteraction'][_0x1d4d('0x54')]({'where':{'id':_0x5254f1['params']['id']}})[_0x1d4d('0x24')](handleEntityNotFound(_0x2acfb3,null))[_0x1d4d('0x24')](function(_0x3b4531){if(_0x3b4531){return _0x3b4531[_0x1d4d('0xb8')](_0x5254f1[_0x1d4d('0x64')][_0x1d4d('0xb1')],_['omit'](_0x5254f1[_0x1d4d('0x64')],[_0x1d4d('0xb1'),'id'])||{})[_0x1d4d('0xb9')](function(){return db['Tag'][_0x1d4d('0xb6')]({'attributes':['id','name','color'],'where':{'id':_0x5254f1[_0x1d4d('0x64')][_0x1d4d('0xb1')]}});})[_0x1d4d('0x24')](function(_0x5d41ce){socket[_0x1d4d('0xba')](_0x1d4d('0xbb'),{'id':Number(_0x5254f1['params']['id']),'tags':_0x5d41ce||[]});return{'id':Number(_0x5254f1['params']['id']),'tags':_0x5d41ce||[]};});}})[_0x1d4d('0x24')](respondWithResult(_0x2acfb3,null))[_0x1d4d('0x2e')](handleError(_0x2acfb3,null));};exports[_0x1d4d('0xbc')]=function(_0xaf5340,_0xee7510,_0x50b7e4){return db[_0x1d4d('0x30')][_0x1d4d('0x54')]({'where':{'id':_0xaf5340['params']['id']}})['then'](handleEntityNotFound(_0xee7510,null))[_0x1d4d('0x24')](function(_0x43b733){if(_0x43b733){return _0x43b733[_0x1d4d('0xbc')](_0xaf5340[_0x1d4d('0x35')]['ids']);}})[_0x1d4d('0x24')](respondWithStatusCode(_0xee7510,null))[_0x1d4d('0x2e')](handleError(_0xee7510,null));};exports[_0x1d4d('0xbd')]=function(_0x1f3366,_0x2a90df){var _0x4591f0=moment()[_0x1d4d('0xbe')]()['toString']();var _0xaee551=path[_0x1d4d('0xbf')](config[_0x1d4d('0xc0')],_0x1d4d('0xc1'),'files','tmp');var _0x2199ca=path['join'](config[_0x1d4d('0xc0')],_0x1d4d('0xc1'),'files',_0x1d4d('0xc2'));var _0x30ef80=path[_0x1d4d('0xbf')](_0xaee551,_0x4591f0);var _0x12617a=util['format'](_0x1d4d('0xc3'),_0x1f3366[_0x1d4d('0xa9')]['id'],_0x4591f0);var _0x42e1da=path[_0x1d4d('0xbf')](_0xaee551,_0x12617a);var _0x3ad3b7=[];_0x3ad3b7[_0x1d4d('0xa5')]({'model':db[_0x1d4d('0x5f')],'as':'User','attributes':['id',_0x1d4d('0xc4')],'raw':!![]});_0x3ad3b7[_0x1d4d('0xa5')]({'model':db[_0x1d4d('0xc5')],'as':_0x1d4d('0xc6'),'attributes':['id',_0x1d4d('0xc7'),_0x1d4d('0xc8')],'raw':!![]});if(_0x1f3366[_0x1d4d('0x35')][_0x1d4d('0xc2')]){_0x3ad3b7['push']({'model':db[_0x1d4d('0xc9')],'as':_0x1d4d('0xc9'),'raw':!![]});}var _0x1bf482=[{'model':db[_0x1d4d('0xb0')],'as':_0x1d4d('0xca'),'attributes':['id',_0x1d4d('0x64'),_0x1d4d('0x6c'),_0x1d4d('0xcb'),_0x1d4d('0xcc'),_0x1d4d('0x70')],'include':_0x3ad3b7}];_0x1bf482[_0x1d4d('0xa5')]({'model':db[_0x1d4d('0xcd')],'as':'Account','attributes':['id',_0x1d4d('0x27')]});_0x1bf482[_0x1d4d('0xa5')]({'model':db[_0x1d4d('0x5f')],'as':_0x1d4d('0xce'),'attributes':['id',_0x1d4d('0xc4')]});return db[_0x1d4d('0x30')]['find']({'where':{'id':_0x1f3366[_0x1d4d('0xa9')]['id']},'include':_0x1bf482})[_0x1d4d('0x24')](handleEntityNotFound(_0x2a90df,null))[_0x1d4d('0x24')](function(_0x240969){if(_0x240969){var _0x4bb630=_0x240969[_0x1d4d('0xcf')]({'plain':!![]});fs[_0x1d4d('0xd0')](_0x30ef80);var _0x1b1061={'format':'A4','border':_0x1d4d('0xd1'),'header':{'height':_0x1d4d('0xd2'),'contents':{'first':_0x1d4d('0xd3')}},'footer':{'height':'30px','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[_0x1d4d('0xd4')]('%s\x20#%d',_0x1d4d('0xd5'),_0x4bb630['id']),moment()[_0x1d4d('0xd4')](_0x1d4d('0xd6'))['toString']())}}};var _0xfa637={'channel':'Openchannel','account':_0x4bb630['Account'][_0x1d4d('0x27')],'agent':_0x4bb630[_0x1d4d('0xce')]?_0x4bb630[_0x1d4d('0xce')][_0x1d4d('0xc4')]:'N.A.','createdAt':moment(_0x4bb630[_0x1d4d('0x6c')])[_0x1d4d('0xd4')](_0x1d4d('0xd7'))[_0x1d4d('0xa2')](),'closedAt':_0x4bb630['closed']?moment(_0x4bb630['closedAt'])[_0x1d4d('0xd4')](_0x1d4d('0xd7'))[_0x1d4d('0xa2')]():'','disposition':_0x4bb630['disposition'],'visibility':_0x4bb630[_0x1d4d('0xd8')]?_0x1d4d('0xd9'):_0x1d4d('0xda'),'messages':_(_0x4bb630[_0x1d4d('0xca')])[_0x1d4d('0x75')]({'secret':![]})[_0x1d4d('0x29')](function(_0x4279ea){if(_0x4279ea[_0x1d4d('0xc9')]){var _0x1e6b40=path[_0x1d4d('0xbf')](_0x2199ca,_0x4279ea['Attachment'][_0x1d4d('0xdb')]);if(fs[_0x1d4d('0xdc')](_0x1e6b40)){fs[_0x1d4d('0xdd')](_0x1e6b40)[_0x1d4d('0xde')](fs[_0x1d4d('0xdf')](path[_0x1d4d('0xbf')](_0x30ef80,_0x4279ea[_0x1d4d('0xc9')][_0x1d4d('0xdb')])));}}return{'date':moment(_0x4279ea[_0x1d4d('0x6c')])[_0x1d4d('0xd4')](_0x1d4d('0xd7'))[_0x1d4d('0xa2')](),'sender':_0x4279ea[_0x1d4d('0xcb')]===_0x1d4d('0xe0')?_0x4279ea['User']?_0x4279ea['User']['fullname']:_0x1d4d('0xe1'):_0x4279ea['Contact'][_0x1d4d('0xc7')]+(_0x4279ea[_0x1d4d('0xc6')]['lastName']?'\x20'+_0x4279ea[_0x1d4d('0xc6')]['lastName']:''),'body':_0x4279ea[_0x1d4d('0xc9')]?_0x4279ea[_0x1d4d('0xc9')]['basename']:_0x4279ea['body'],'direction':_0x4279ea[_0x1d4d('0xcb')]==='out'?'A':'C','secret':_0x4279ea[_0x1d4d('0xcc')],'read':_0x4279ea['read'],'attachment':_0x4279ea[_0x1d4d('0xc9')]};})['value']()};return ejs[_0x1d4d('0xe2')](path[_0x1d4d('0xbf')](config[_0x1d4d('0xc0')],_0x1d4d('0xc1'),'views',_0x1d4d('0xe3')),{'interaction':_0xfa637})[_0x1d4d('0x24')](function(_0x192041){return new BPromise(function(_0x3930a2,_0x4e8919){pdf['create'](_0x192041,_0x1b1061)['toFile'](path[_0x1d4d('0xbf')](_0x30ef80,_0x1d4d('0xe4')+_0x4bb630['id']+'-'+_0x4591f0+_0x1d4d('0xe5')),function(_0x458dbc,_0x10780d){if(_0x458dbc)return _0x4e8919(_0x458dbc);_0x3930a2(_0x10780d);});});})['then'](function(){return new BPromise(function(_0x31f7c8,_0x4b96c7){zipdir(_0x30ef80,{'saveTo':_0x42e1da},function(_0x48479f,_0x438c1d){if(_0x48479f)return _0x4b96c7(_0x48479f);return _0x31f7c8(_0x438c1d);});})['then'](function(){return new BPromise(function(_0xef3983,_0x58707c){rimraf(_0x30ef80,function(_0x4ed571){if(_0x4ed571)_0x58707c(_0x4ed571);return _0xef3983();});});})[_0x1d4d('0x24')](function(){return _0x2a90df['download'](_0x42e1da,_0x12617a,function(_0x4b8a63){if(_0x4b8a63){console[_0x1d4d('0xe6')](_0x1d4d('0xe7'),_0x4b8a63);}else{fs[_0x1d4d('0xe8')](_0x42e1da);}});});});}else{return _0x2a90df['sendStatus'](0xc8);}})[_0x1d4d('0x2e')](handleError(_0x2a90df,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index a1ae1f2..a32ccf8 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 _0x3e35=['unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','findAll'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3e35,0x96));var _0x53e3=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x3e35[_0x5cb97e];return _0x1714b4;};'use strict';var EventEmitter=require(_0x53e3('0x0'));var OpenchannelInteraction=require(_0x53e3('0x1'))['db'][_0x53e3('0x2')];var OpenchannelMessage=require(_0x53e3('0x1'))['db'][_0x53e3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x53e3('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x53e3('0x5'),'afterDestroy':_0x53e3('0x6')};function emitEvent(_0x54e725){return function(_0x33c0b0,_0x1833eb,_0x460afe){_0x33c0b0['getUsers']({'attributes':['id'],'raw':!![]})[_0x53e3('0x7')](function(_0xcb8a61){_0x33c0b0[_0x53e3('0x8')](_0x53e3('0x9'),_0xcb8a61[_0x53e3('0xa')](function(_0x815b38){return{'id':_0x815b38['id']};}));return OpenchannelMessage[_0x53e3('0xb')]({'where':{'OpenchannelInteractionId':_0x33c0b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53e3('0x7')](function(_0x2efae4){_0x33c0b0[_0x53e3('0x8')](_0x53e3('0xc'),_0x2efae4[_0x53e3('0xd')]);OpenchannelInteractionEvents[_0x53e3('0xe')](_0x54e725+':'+_0x33c0b0['id'],_0x33c0b0);OpenchannelInteractionEvents[_0x53e3('0xe')](_0x54e725,_0x33c0b0);_0x460afe(null);})['catch'](_0x460afe(null));};}for(var e in events){if(events[_0x53e3('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x53e3('0x10')](e,emitEvent(event));}}module[_0x53e3('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x00b3=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','findAll','length','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x00b3,0xfe));var _0x300b=function(_0x26dc2d,_0x4d10c3){_0x26dc2d=_0x26dc2d-0x0;var _0x2711b4=_0x00b3[_0x26dc2d];return _0x2711b4;};'use strict';var EventEmitter=require(_0x300b('0x0'));var OpenchannelInteraction=require(_0x300b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x300b('0x3')](0x0);var events={'afterCreate':_0x300b('0x4'),'afterUpdate':_0x300b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x449c88){return function(_0x3aeb48,_0x52c609,_0x4fa4f0){_0x3aeb48[_0x300b('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1e792a){_0x3aeb48[_0x300b('0x7')](_0x300b('0x8'),_0x1e792a['map'](function(_0x39aecd){return{'id':_0x39aecd['id']};}));return OpenchannelMessage[_0x300b('0x9')]({'where':{'OpenchannelInteractionId':_0x3aeb48['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1f8424){_0x3aeb48[_0x300b('0x7')]('unreadMessages',_0x1f8424[_0x300b('0xa')]);OpenchannelInteractionEvents[_0x300b('0xb')](_0x449c88+':'+_0x3aeb48['id'],_0x3aeb48);OpenchannelInteractionEvents[_0x300b('0xb')](_0x449c88,_0x3aeb48);_0x4fa4f0(null);})['catch'](_0x4fa4f0(null));};}for(var e in events){if(events[_0x300b('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x300b('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index f813be6..fe0f64e 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 _0x925b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x925b,0xc3));var _0xb925=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x925b[_0x172133];return _0x2460e5;};'use strict';var _=require(_0xb925('0x0'));var util=require(_0xb925('0x1'));var logger=require(_0xb925('0x2'))('api');var moment=require(_0xb925('0x3'));var BPromise=require(_0xb925('0x4'));var rp=require(_0xb925('0x5'));var fs=require('fs');var path=require(_0xb925('0x6'));var rimraf=require(_0xb925('0x7'));var config=require('../../config/environment');var attributes=require(_0xb925('0x8'));module['exports']=function(_0x32d280,_0x4d31f3){return _0x32d280['define']('OpenchannelInteraction',attributes,{'tableName':_0xb925('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d861d,_0x3f1640,_0x924029){if(_0x1d861d[_0xb925('0xa')](_0xb925('0xb'))){_0x1d861d[_0xb925('0xc')]=moment()['format'](_0xb925('0xd'));}_0x924029(null,_0x1d861d);}}});}; \ No newline at end of file +var _0x3414=['closed','format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','changed'];(function(_0x5a1099,_0x4ba582){var _0x58eb75=function(_0x440cf3){while(--_0x440cf3){_0x5a1099['push'](_0x5a1099['shift']());}};_0x58eb75(++_0x4ba582);}(_0x3414,0x80));var _0x4341=function(_0x59cf53,_0x43f870){_0x59cf53=_0x59cf53-0x0;var _0x54ccbb=_0x3414[_0x59cf53];return _0x54ccbb;};'use strict';var _=require('lodash');var util=require(_0x4341('0x0'));var logger=require(_0x4341('0x1'))(_0x4341('0x2'));var moment=require(_0x4341('0x3'));var BPromise=require(_0x4341('0x4'));var rp=require(_0x4341('0x5'));var fs=require('fs');var path=require(_0x4341('0x6'));var rimraf=require(_0x4341('0x7'));var config=require(_0x4341('0x8'));var attributes=require(_0x4341('0x9'));module[_0x4341('0xa')]=function(_0x2071dd,_0x3a86d9){return _0x2071dd['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2beb72,_0x51fd0e,_0x397b42){if(_0x2beb72[_0x4341('0xb')](_0x4341('0xc'))){_0x2beb72['closedAt']=moment()[_0x4341('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x397b42(null,_0x2beb72);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5dbcded..857dadc 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 _0xd171=['stringify','error','code','message','info','catch','body','options','UpdateOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5e24e4,_0x452216){var _0xf9243e=function(_0x455625){while(--_0x455625){_0x5e24e4['push'](_0x5e24e4['shift']());}};_0xf9243e(++_0x452216);}(_0xd171,0xa3));var _0x1d17=function(_0x5f170f,_0x553d8e){_0x5f170f=_0x5f170f-0x0;var _0x2419de=_0xd171[_0x5f170f];return _0x2419de;};'use strict';var _=require(_0x1d17('0x0'));var util=require(_0x1d17('0x1'));var moment=require(_0x1d17('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d17('0x3'));var db=require(_0x1d17('0x4'))['db'];var utils=require(_0x1d17('0x5'));var logger=require(_0x1d17('0x6'))(_0x1d17('0x7'));var config=require(_0x1d17('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1d17('0x9')][_0x1d17('0xa')]({'port':0x232a});config['redis']=_[_0x1d17('0xb')](config[_0x1d17('0xc')],{'host':_0x1d17('0xd'),'port':0x18eb});var socket=require(_0x1d17('0xe'))(new Redis(config[_0x1d17('0xc')]));require(_0x1d17('0xf'))['register'](socket);function respondWithRpcPromise(_0x27138b,_0x342094,_0x312f5b){return new BPromise(function(_0x1eda27,_0x6fe1fa){return client[_0x1d17('0x10')](_0x27138b,_0x312f5b)[_0x1d17('0x11')](function(_0x5c950a){logger['info'](_0x1d17('0x12'),_0x342094,_0x1d17('0x13'));logger[_0x1d17('0x14')](_0x1d17('0x15'),_0x342094,_0x1d17('0x13'),JSON[_0x1d17('0x16')](_0x5c950a));if(_0x5c950a[_0x1d17('0x17')]){if(_0x5c950a['error'][_0x1d17('0x18')]===0x1f4){logger[_0x1d17('0x17')](_0x1d17('0x12'),_0x342094,_0x5c950a['error'][_0x1d17('0x19')]);return _0x6fe1fa(_0x5c950a[_0x1d17('0x17')][_0x1d17('0x19')]);}logger[_0x1d17('0x17')](_0x1d17('0x12'),_0x342094,_0x5c950a[_0x1d17('0x17')][_0x1d17('0x19')]);return _0x1eda27(_0x5c950a[_0x1d17('0x17')][_0x1d17('0x19')]);}else{logger[_0x1d17('0x1a')](_0x1d17('0x12'),_0x342094,_0x1d17('0x13'));_0x1eda27(_0x5c950a['result'][_0x1d17('0x19')]);}})[_0x1d17('0x1b')](function(_0x34ffb5){logger[_0x1d17('0x17')](_0x1d17('0x12'),_0x342094,_0x34ffb5);_0x6fe1fa(_0x34ffb5);});});}exports['UpdateOpenchannelInteraction']=function(_0x5e64d2){var _0x549333=this;return new Promise(function(_0x1188d2,_0x29eca5){return db['OpenchannelInteraction']['update'](_0x5e64d2[_0x1d17('0x1c')],{'raw':_0x5e64d2[_0x1d17('0x1d')]?_0x5e64d2[_0x1d17('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e64d2[_0x1d17('0x1d')]?_0x5e64d2[_0x1d17('0x1d')]['where']||null:null,'attributes':_0x5e64d2[_0x1d17('0x1d')]?_0x5e64d2['options']['attributes']||null:null,'limit':_0x5e64d2[_0x1d17('0x1d')]?_0x5e64d2[_0x1d17('0x1d')]['limit']||null:null})[_0x1d17('0x11')](function(_0x5716fd){logger[_0x1d17('0x1a')](_0x1d17('0x1e'),_0x5e64d2);logger[_0x1d17('0x14')](_0x1d17('0x1e'),_0x5e64d2,JSON[_0x1d17('0x16')](_0x5716fd));_0x1188d2(_0x5716fd);})[_0x1d17('0x1b')](function(_0x50e797){logger[_0x1d17('0x17')](_0x1d17('0x1e'),_0x50e797['message'],_0x5e64d2);_0x29eca5(_0x549333['error'](0x1f4,_0x50e797[_0x1d17('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x32d8d0){return new Promise(function(_0x135b1c,_0x242387){return db[_0x1d17('0x1f')][_0x1d17('0x20')]({'where':_0x32d8d0[_0x1d17('0x1d')]?_0x32d8d0['options']['where']||null:null})[_0x1d17('0x11')](function(_0x25ee2c){if(_0x25ee2c){return _0x25ee2c[_0x1d17('0x21')](_0x32d8d0['body'][_0x1d17('0x22')],_[_0x1d17('0x23')](_0x32d8d0[_0x1d17('0x1c')],[_0x1d17('0x22'),'id'])||{});}})['spread'](function(_0x4bf240){logger[_0x1d17('0x1a')]('AddTags',_0x32d8d0);logger['debug']('AddTags',_0x32d8d0,JSON['stringify'](_0x4bf240));_0x135b1c(_0x4bf240);})['catch'](function(_0x5907aa){logger[_0x1d17('0x17')](_0x1d17('0x24'),_0x5907aa['message'],_0x32d8d0);_0x242387(_this['error'](0x1f4,_0x5907aa[_0x1d17('0x19')]));});});}; \ No newline at end of file +var _0x834c=['./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','where','ids','omit','body','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x6f116f,_0x48c8bd){var _0x120342=function(_0xa8e20a){while(--_0xa8e20a){_0x6f116f['push'](_0x6f116f['shift']());}};_0x120342(++_0x48c8bd);}(_0x834c,0x143));var _0xc834=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x834c[_0x3c97e3];return _0x9bb0ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc834('0x0'));var BPromise=require(_0xc834('0x1'));var rs=require(_0xc834('0x2'));var fs=require('fs');var Redis=require(_0xc834('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc834('0x4'));var logger=require(_0xc834('0x5'))('rpc');var config=require(_0xc834('0x6'));var jayson=require(_0xc834('0x7'));var client=jayson[_0xc834('0x8')][_0xc834('0x9')]({'port':0x232a});config[_0xc834('0xa')]=_[_0xc834('0xb')](config[_0xc834('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc834('0xc'))(new Redis(config['redis']));require(_0xc834('0xd'))[_0xc834('0xe')](socket);function respondWithRpcPromise(_0x425ed8,_0x2f22f6,_0x13cd65){return new BPromise(function(_0x30af88,_0x111e85){return client[_0xc834('0xf')](_0x425ed8,_0x13cd65)[_0xc834('0x10')](function(_0xbedee7){logger[_0xc834('0x11')](_0xc834('0x12'),_0x2f22f6,_0xc834('0x13'));logger['debug'](_0xc834('0x14'),_0x2f22f6,_0xc834('0x13'),JSON[_0xc834('0x15')](_0xbedee7));if(_0xbedee7[_0xc834('0x16')]){if(_0xbedee7[_0xc834('0x16')][_0xc834('0x17')]===0x1f4){logger[_0xc834('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2f22f6,_0xbedee7[_0xc834('0x16')][_0xc834('0x18')]);return _0x111e85(_0xbedee7['error'][_0xc834('0x18')]);}logger[_0xc834('0x16')](_0xc834('0x12'),_0x2f22f6,_0xbedee7['error']['message']);return _0x30af88(_0xbedee7[_0xc834('0x16')][_0xc834('0x18')]);}else{logger[_0xc834('0x11')](_0xc834('0x12'),_0x2f22f6,_0xc834('0x13'));_0x30af88(_0xbedee7[_0xc834('0x19')][_0xc834('0x18')]);}})[_0xc834('0x1a')](function(_0x3eb7d9){logger[_0xc834('0x16')](_0xc834('0x12'),_0x2f22f6,_0x3eb7d9);_0x111e85(_0x3eb7d9);});});}exports[_0xc834('0x1b')]=function(_0x1617cf){var _0x116407=this;return new Promise(function(_0x314373,_0x15045c){return db[_0xc834('0x1c')][_0xc834('0x1d')](_0x1617cf['body'],{'raw':_0x1617cf['options']?_0x1617cf[_0xc834('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1617cf[_0xc834('0x1e')]?_0x1617cf['options']['where']||null:null,'attributes':_0x1617cf['options']?_0x1617cf[_0xc834('0x1e')][_0xc834('0x1f')]||null:null,'limit':_0x1617cf['options']?_0x1617cf['options'][_0xc834('0x20')]||null:null})[_0xc834('0x10')](function(_0x513ed3){logger[_0xc834('0x11')](_0xc834('0x1b'),_0x1617cf);logger[_0xc834('0x21')](_0xc834('0x1b'),_0x1617cf,JSON[_0xc834('0x15')](_0x513ed3));_0x314373(_0x513ed3);})[_0xc834('0x1a')](function(_0x2c290a){logger[_0xc834('0x16')](_0xc834('0x1b'),_0x2c290a['message'],_0x1617cf);_0x15045c(_0x116407[_0xc834('0x16')](0x1f4,_0x2c290a[_0xc834('0x18')]));});});};exports[_0xc834('0x22')]=function(_0x449866){return new Promise(function(_0x13cb65,_0x5a70c0){return db[_0xc834('0x1c')][_0xc834('0x23')]({'where':_0x449866[_0xc834('0x1e')]?_0x449866[_0xc834('0x1e')][_0xc834('0x24')]||null:null})['then'](function(_0x49e93b){if(_0x49e93b){return _0x49e93b['addTags'](_0x449866['body'][_0xc834('0x25')],_[_0xc834('0x26')](_0x449866[_0xc834('0x27')],[_0xc834('0x25'),'id'])||{});}})[_0xc834('0x28')](function(_0x47af69){logger['info'](_0xc834('0x29'),_0x449866);logger[_0xc834('0x21')](_0xc834('0x29'),_0x449866,JSON[_0xc834('0x15')](_0x47af69));_0x13cb65(_0x47af69);})[_0xc834('0x1a')](function(_0x585ace){logger[_0xc834('0x16')](_0xc834('0x29'),_0x585ace[_0xc834('0x18')],_0x449866);_0x5a70c0(_this[_0xc834('0x16')](0x1f4,_0x585ace[_0xc834('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a59cecc..a9baec5 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 _0xba42=['save','update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x34e18a,_0x5cedf6){var _0x4853b8=function(_0x912d81){while(--_0x912d81){_0x34e18a['push'](_0x34e18a['shift']());}};_0x4853b8(++_0x5cedf6);}(_0xba42,0xed));var _0x2ba4=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0xba42[_0x2b55b5];return _0x103d28;};'use strict';var OpenchannelInteractionEvents=require(_0x2ba4('0x0'));var events=[_0x2ba4('0x1'),'remove',_0x2ba4('0x2')];function createListener(_0x4b10c7,_0xc0156e){return function(_0x4e5489){_0xc0156e[_0x2ba4('0x3')](_0x4b10c7,_0x4e5489);};}function removeListener(_0x246b6f,_0x42cd4f){return function(){OpenchannelInteractionEvents[_0x2ba4('0x4')](_0x246b6f,_0x42cd4f);};}exports['register']=function(_0x269bbf){for(var _0x50fec7=0x0,_0x7bddec=events[_0x2ba4('0x5')];_0x50fec7<_0x7bddec;_0x50fec7++){var _0x3d44a4=events[_0x50fec7];var _0x2304fb=createListener(_0x2ba4('0x6')+_0x3d44a4,_0x269bbf);OpenchannelInteractionEvents['on'](_0x3d44a4,_0x2304fb);}}; \ No newline at end of file +var _0x5ab2=['length','./openchannelInteraction.events','save','remove','removeListener'];(function(_0x3f0752,_0x49c7ce){var _0x3d2d59=function(_0x1c4137){while(--_0x1c4137){_0x3f0752['push'](_0x3f0752['shift']());}};_0x3d2d59(++_0x49c7ce);}(_0x5ab2,0x18c));var _0x25ab=function(_0x560371,_0x52ce95){_0x560371=_0x560371-0x0;var _0x208e07=_0x5ab2[_0x560371];return _0x208e07;};'use strict';var OpenchannelInteractionEvents=require(_0x25ab('0x0'));var events=[_0x25ab('0x1'),_0x25ab('0x2'),'update'];function createListener(_0x3e1376,_0x1c7e7d){return function(_0x1f836e){_0x1c7e7d['emit'](_0x3e1376,_0x1f836e);};}function removeListener(_0x5b2404,_0x3ae2e3){return function(){OpenchannelInteractionEvents[_0x25ab('0x3')](_0x5b2404,_0x3ae2e3);};}exports['register']=function(_0x5508e3){for(var _0x40020c=0x0,_0x2e56e6=events[_0x25ab('0x4')];_0x40020c<_0x2e56e6;_0x40020c++){var _0xbe2896=events[_0x40020c];var _0x673ca3=createListener('openchannelInteraction:'+_0xbe2896,_0x5508e3);OpenchannelInteractionEvents['on'](_0xbe2896,_0x673ca3);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5fdd3f4..f26d981 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 _0x9248=['exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','openchannel','openchannelmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy'];(function(_0x1e9ee9,_0x27fa48){var _0x15227c=function(_0x2f8f9e){while(--_0x2f8f9e){_0x1e9ee9['push'](_0x1e9ee9['shift']());}};_0x15227c(++_0x27fa48);}(_0x9248,0x153));var _0x8924=function(_0x4256d3,_0x1ff5c1){_0x4256d3=_0x4256d3-0x0;var _0x340081=_0x9248[_0x4256d3];return _0x340081;};'use strict';var multer=require(_0x8924('0x0'));var util=require(_0x8924('0x1'));var path=require(_0x8924('0x2'));var timeout=require(_0x8924('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8924('0x4'));var config=require(_0x8924('0x5'));var controller=require(_0x8924('0x6'));router[_0x8924('0x7')]('/',auth[_0x8924('0x8')](),controller[_0x8924('0x9')]);router[_0x8924('0x7')](_0x8924('0xa'),auth[_0x8924('0x8')](),controller[_0x8924('0xb')]);router[_0x8924('0x7')](_0x8924('0xc'),auth[_0x8924('0x8')](),controller[_0x8924('0xd')]);router['post']('/',auth[_0x8924('0x8')](),interaction[_0x8924('0xe')](_0x8924('0xf'),_0x8924('0x10')),controller[_0x8924('0x11')]);router[_0x8924('0x12')](_0x8924('0xc'),auth[_0x8924('0x8')](),controller[_0x8924('0x13')]);router[_0x8924('0x12')]('/:id/accept',auth[_0x8924('0x8')](),controller[_0x8924('0x14')]);router['put'](_0x8924('0x15'),auth[_0x8924('0x8')](),controller[_0x8924('0x16')]);router[_0x8924('0x17')](_0x8924('0xc'),auth['isAuthenticated'](),controller[_0x8924('0x18')]);module[_0x8924('0x19')]=router; \ No newline at end of file +var _0x4921=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','reject','delete','exports','multer','util','path','express'];(function(_0x4b4a50,_0x3e6b35){var _0x1f3e71=function(_0x3412d5){while(--_0x3412d5){_0x4b4a50['push'](_0x4b4a50['shift']());}};_0x1f3e71(++_0x3e6b35);}(_0x4921,0x164));var _0x1492=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x4921[_0x54de5d];return _0x1b349e;};'use strict';var multer=require(_0x1492('0x0'));var util=require(_0x1492('0x1'));var path=require(_0x1492('0x2'));var timeout=require('connect-timeout');var express=require(_0x1492('0x3'));var router=express[_0x1492('0x4')]();var auth=require(_0x1492('0x5'));var interaction=require(_0x1492('0x6'));var config=require(_0x1492('0x7'));var controller=require(_0x1492('0x8'));router['get']('/',auth[_0x1492('0x9')](),controller[_0x1492('0xa')]);router[_0x1492('0xb')](_0x1492('0xc'),auth[_0x1492('0x9')](),controller[_0x1492('0xd')]);router[_0x1492('0xb')](_0x1492('0xe'),auth[_0x1492('0x9')](),controller[_0x1492('0xf')]);router[_0x1492('0x10')]('/',auth[_0x1492('0x9')](),interaction[_0x1492('0x11')](_0x1492('0x12'),_0x1492('0x13')),controller['create']);router['put'](_0x1492('0xe'),auth[_0x1492('0x9')](),controller['update']);router[_0x1492('0x14')]('/:id/accept',auth[_0x1492('0x9')](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x1492('0x15')]);router[_0x1492('0x16')]('/:id',auth[_0x1492('0x9')](),controller['destroy']);module[_0x1492('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index bbdec01..dd2fed1 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 _0x71bf=['BOOLEAN','ENUM','out','DATE','sequelize','medium'];(function(_0x4a856a,_0x629995){var _0x36dac2=function(_0x543b4f){while(--_0x543b4f){_0x4a856a['push'](_0x4a856a['shift']());}};_0x36dac2(++_0x629995);}(_0x71bf,0x136));var _0xf71b=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x71bf[_0xb98d8d];return _0x489b15;};'use strict';var Sequelize=require(_0xf71b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xf71b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xf71b('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf71b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf71b('0x3')]('in',_0xf71b('0x4')),'defaultValue':_0xf71b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf71b('0x5')]}}; \ No newline at end of file +var _0x7d08=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x59ef13,_0x3e2f17){var _0x5c2f7f=function(_0x5176a5){while(--_0x5176a5){_0x59ef13['push'](_0x59ef13['shift']());}};_0x5c2f7f(++_0x3e2f17);}(_0x7d08,0x16b));var _0x87d0=function(_0x194cec,_0x5de703){_0x194cec=_0x194cec-0x0;var _0x5acf20=_0x7d08[_0x194cec];return _0x5acf20;};'use strict';var Sequelize=require(_0x87d0('0x0'));module[_0x87d0('0x1')]={'body':{'type':Sequelize[_0x87d0('0x2')](_0x87d0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x87d0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x87d0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x87d0('0x5')),'defaultValue':_0x87d0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x87d0('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index cc96ed0..500b360 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 _0xa998=['where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','show','params','options','find','create','body','describe','../../config/logger','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','rejectmessage','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','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~!@#$%^&-_=+[{]}.','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','offset','limit','set','json','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x3c3bc0,_0x11d04d){var _0x255b90=function(_0x4ea973){while(--_0x4ea973){_0x3c3bc0['push'](_0x3c3bc0['shift']());}};_0x255b90(++_0x11d04d);}(_0xa998,0x120));var _0x8a99=function(_0x59e327,_0x199686){_0x59e327=_0x59e327-0x0;var _0x28372b=_0xa998[_0x59e327];return _0x28372b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a99('0x1'));var rp=require('request-promise');var moment=require(_0x8a99('0x2'));var BPromise=require(_0x8a99('0x3'));var Mustache=require(_0x8a99('0x4'));var util=require(_0x8a99('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8a99('0x6'));var ejs=require(_0x8a99('0x7'));var fs=require('fs');var _=require(_0x8a99('0x8'));var squel=require(_0x8a99('0x9'));var crypto=require('crypto');var jsforce=require(_0x8a99('0xa'));var deskjs=require(_0x8a99('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a99('0xc'));var Redis=require('ioredis');var authService=require(_0x8a99('0xd'));var qs=require(_0x8a99('0xe'));var as=require(_0x8a99('0xf'));var hardwareService=require(_0x8a99('0x10'));var logger=require('../../config/logger')(_0x8a99('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8a99('0x12'))['db'];config[_0x8a99('0x13')]=_[_0x8a99('0x14')](config[_0x8a99('0x13')],{'host':_0x8a99('0x15'),'port':0x18eb});var socket=require(_0x8a99('0x16'))(new Redis(config[_0x8a99('0x13')]));require(_0x8a99('0x17'))[_0x8a99('0x18')](socket);var jayson=require(_0x8a99('0x19'));var client=jayson[_0x8a99('0x1a')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x47e2f2,_0x505f11,_0x4c117a){if(_0x4c117a){var _0x544d4c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x544d4c[_0x8a99('0x1b')](_0x505f11)){return _0x47e2f2;}else{throw new db[(_0x8a99('0x1c'))]['ValidationError'](_0x8a99('0x1d'));}}else{return _0x47e2f2;}}function respondWithRpcPromise(_0x30a28c,_0x2e1e79,_0x3dc596,_0x1b743b){return new BPromise(function(_0x5da2aa,_0x15a6ad){var _0x252fbf=_0x1b743b||client;return _0x252fbf[_0x8a99('0x1e')](_0x30a28c,_0x3dc596)['then'](function(_0x19f2a4){logger[_0x8a99('0x1f')](_0x8a99('0x20'),_0x2e1e79,_0x8a99('0x21'));logger[_0x8a99('0x22')](_0x8a99('0x23'),_0x2e1e79,_0x8a99('0x21'),JSON[_0x8a99('0x24')](_0x19f2a4));if(_0x19f2a4['error']){if(_0x19f2a4[_0x8a99('0x25')]['code']===0x1f4){logger[_0x8a99('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2e1e79,_0x19f2a4[_0x8a99('0x25')][_0x8a99('0x26')]);return _0x15a6ad(_0x19f2a4['error'][_0x8a99('0x26')]);}logger[_0x8a99('0x25')](_0x8a99('0x20'),_0x2e1e79,_0x19f2a4['error'][_0x8a99('0x26')]);return _0x5da2aa(_0x19f2a4[_0x8a99('0x25')][_0x8a99('0x26')]);}else{logger[_0x8a99('0x1f')](_0x8a99('0x20'),_0x2e1e79,_0x8a99('0x21'));_0x5da2aa(_0x19f2a4['result']['message']);}})[_0x8a99('0x27')](function(_0x4b57a6){logger[_0x8a99('0x25')](_0x8a99('0x20'),_0x2e1e79,_0x4b57a6);_0x15a6ad(_0x4b57a6);});});}function respondWithStatusCode(_0x17b79a,_0x19d944){_0x19d944=_0x19d944||0xcc;return function(_0x470272){if(_0x470272){return _0x17b79a['sendStatus'](_0x19d944);}return _0x17b79a[_0x8a99('0x28')](_0x19d944)[_0x8a99('0x29')]();};}function respondWithResult(_0x14cbcd,_0x4addf0){_0x4addf0=_0x4addf0||0xc8;return function(_0x3d75d6){if(_0x3d75d6){return _0x14cbcd['status'](_0x4addf0)['json'](_0x3d75d6);}};}function respondWithFilteredResult(_0x54b5c1,_0x446f37){return function(_0x3b2273){if(_0x3b2273){var _0x4b3928=_0x3b2273['count'],_0x51f766=_0x446f37[_0x8a99('0x2a')],_0x5b4ba7=_0x446f37[_0x8a99('0x2a')]+_0x446f37[_0x8a99('0x2b')],_0x4e0d50;if(_0x5b4ba7>=_0x4b3928){_0x5b4ba7=_0x4b3928;_0x4e0d50=0xc8;}else{_0x4e0d50=0xce;}_0x54b5c1['status'](_0x4e0d50);return _0x54b5c1[_0x8a99('0x2c')]('Content-Range',_0x51f766+'-'+_0x5b4ba7+'/'+_0x4b3928)[_0x8a99('0x2d')](_0x3b2273);}return null;};}function patchUpdates(_0x363e31){return function(_0x329af1){try{jsonpatch[_0x8a99('0x2e')](_0x329af1,_0x363e31,!![]);}catch(_0x253bb3){return BPromise[_0x8a99('0x2f')](_0x253bb3);}return _0x329af1['save']();};}function saveUpdates(_0x3abc3b,_0x1fd223){return function(_0x21ae27){if(_0x21ae27){return _0x21ae27[_0x8a99('0x30')](_0x3abc3b)['then'](function(_0x27c405){return _0x27c405;});}return null;};}function removeEntity(_0xeb1e28,_0x41b4ca){return function(_0x211510){if(_0x211510){return _0x211510[_0x8a99('0x31')]()[_0x8a99('0x32')](function(){_0xeb1e28['status'](0xcc)[_0x8a99('0x29')]();});}};}function handleEntityNotFound(_0xf56860,_0x544e78){return function(_0x5cc703){if(!_0x5cc703){_0xf56860[_0x8a99('0x33')](0x194);}return _0x5cc703;};}function handleError(_0x44450a,_0x2a505e){_0x2a505e=_0x2a505e||0x1f4;return function(_0x26564b){logger[_0x8a99('0x25')](_0x26564b[_0x8a99('0x34')]);if(_0x26564b[_0x8a99('0x35')]){delete _0x26564b[_0x8a99('0x35')];}_0x44450a[_0x8a99('0x28')](_0x2a505e)[_0x8a99('0x36')](_0x26564b);};}exports[_0x8a99('0x37')]=function(_0x275b2f,_0x1dab77){var _0x423a0d={},_0x3e891e={},_0x2c48c4={'count':0x0,'rows':[]};var _0x43ade9=_[_0x8a99('0x38')](db[_0x8a99('0x39')][_0x8a99('0x3a')],function(_0xd4a45e){return{'name':_0xd4a45e[_0x8a99('0x3b')],'type':_0xd4a45e[_0x8a99('0x3c')][_0x8a99('0x3d')]};});_0x3e891e[_0x8a99('0x3e')]=_[_0x8a99('0x38')](_0x43ade9,_0x8a99('0x35'));_0x3e891e[_0x8a99('0x3f')]=_[_0x8a99('0x40')](_0x275b2f[_0x8a99('0x3f')]);_0x3e891e[_0x8a99('0x41')]=_[_0x8a99('0x42')](_0x3e891e[_0x8a99('0x3e')],_0x3e891e['query']);_0x423a0d[_0x8a99('0x43')]=_['intersection'](_0x3e891e['model'],qs[_0x8a99('0x44')](_0x275b2f[_0x8a99('0x3f')]['fields']));_0x423a0d[_0x8a99('0x43')]=_0x423a0d['attributes'][_0x8a99('0x45')]?_0x423a0d['attributes']:_0x3e891e[_0x8a99('0x3e')];if(!_0x275b2f[_0x8a99('0x3f')]['hasOwnProperty'](_0x8a99('0x46'))){_0x423a0d[_0x8a99('0x2b')]=qs[_0x8a99('0x2b')](_0x275b2f[_0x8a99('0x3f')][_0x8a99('0x2b')]);_0x423a0d['offset']=qs['offset'](_0x275b2f['query'][_0x8a99('0x2a')]);}_0x423a0d['order']=qs[_0x8a99('0x47')](_0x275b2f[_0x8a99('0x3f')][_0x8a99('0x47')]);_0x423a0d[_0x8a99('0x48')]=qs['filters'](_[_0x8a99('0x49')](_0x275b2f[_0x8a99('0x3f')],_0x3e891e[_0x8a99('0x41')]),_0x43ade9);if(_0x275b2f['query']['filter']){_0x423a0d[_0x8a99('0x48')]=_[_0x8a99('0x4a')](_0x423a0d[_0x8a99('0x48')],{'$or':_[_0x8a99('0x38')](_0x43ade9,function(_0x408ee1){if(_0x408ee1[_0x8a99('0x3c')]!==_0x8a99('0x4b')){var _0x8bac9f={};_0x8bac9f[_0x408ee1[_0x8a99('0x35')]]={'$like':'%'+_0x275b2f[_0x8a99('0x3f')][_0x8a99('0x4c')]+'%'};return _0x8bac9f;}})});}_0x423a0d=_[_0x8a99('0x4a')]({},_0x423a0d,_0x275b2f['options']);var _0x2e00d6={'where':_0x423a0d[_0x8a99('0x48')]};return db[_0x8a99('0x39')][_0x8a99('0x4d')](_0x2e00d6)[_0x8a99('0x32')](function(_0x5972db){_0x2c48c4[_0x8a99('0x4d')]=_0x5972db;if(_0x275b2f[_0x8a99('0x3f')][_0x8a99('0x4e')]){_0x423a0d[_0x8a99('0x4f')]=[{'all':!![]}];}return db[_0x8a99('0x39')][_0x8a99('0x50')](_0x423a0d);})[_0x8a99('0x32')](function(_0x2c8072){_0x2c48c4['rows']=_0x2c8072;return _0x2c48c4;})[_0x8a99('0x32')](respondWithFilteredResult(_0x1dab77,_0x423a0d))[_0x8a99('0x27')](handleError(_0x1dab77,null));};exports[_0x8a99('0x51')]=function(_0x23e399,_0x326996){var _0x30286f={'raw':!![],'where':{'id':_0x23e399[_0x8a99('0x52')]['id']}},_0x56550b={};_0x56550b[_0x8a99('0x3e')]=_[_0x8a99('0x40')](db[_0x8a99('0x39')][_0x8a99('0x3a')]);_0x56550b[_0x8a99('0x3f')]=_[_0x8a99('0x40')](_0x23e399[_0x8a99('0x3f')]);_0x56550b[_0x8a99('0x41')]=_[_0x8a99('0x42')](_0x56550b[_0x8a99('0x3e')],_0x56550b[_0x8a99('0x3f')]);_0x30286f[_0x8a99('0x43')]=_[_0x8a99('0x42')](_0x56550b['model'],qs[_0x8a99('0x44')](_0x23e399[_0x8a99('0x3f')]['fields']));_0x30286f[_0x8a99('0x43')]=_0x30286f[_0x8a99('0x43')]['length']?_0x30286f[_0x8a99('0x43')]:_0x56550b[_0x8a99('0x3e')];if(_0x23e399[_0x8a99('0x3f')][_0x8a99('0x4e')]){_0x30286f[_0x8a99('0x4f')]=[{'all':!![]}];}_0x30286f=_['merge']({},_0x30286f,_0x23e399[_0x8a99('0x53')]);return db[_0x8a99('0x39')][_0x8a99('0x54')](_0x30286f)[_0x8a99('0x32')](handleEntityNotFound(_0x326996,null))[_0x8a99('0x32')](respondWithResult(_0x326996,null))['catch'](handleError(_0x326996,null));};exports[_0x8a99('0x55')]=function(_0x19d2c3,_0x558ee1){return db['OpenchannelMessage'][_0x8a99('0x55')](_0x19d2c3[_0x8a99('0x56')],{})['then'](respondWithResult(_0x558ee1,0xc9))[_0x8a99('0x27')](handleError(_0x558ee1,null));};exports[_0x8a99('0x30')]=function(_0x17e9a4,_0xc4fb30){if(_0x17e9a4[_0x8a99('0x56')]['id']){delete _0x17e9a4[_0x8a99('0x56')]['id'];}return db[_0x8a99('0x39')]['find']({'where':{'id':_0x17e9a4[_0x8a99('0x52')]['id']}})['then'](handleEntityNotFound(_0xc4fb30,null))[_0x8a99('0x32')](saveUpdates(_0x17e9a4[_0x8a99('0x56')],null))[_0x8a99('0x32')](respondWithResult(_0xc4fb30,null))['catch'](handleError(_0xc4fb30,null));};exports[_0x8a99('0x31')]=function(_0x5137a6,_0x8deaf4){return db[_0x8a99('0x39')]['find']({'where':{'id':_0x5137a6[_0x8a99('0x52')]['id']}})['then'](handleEntityNotFound(_0x8deaf4,null))[_0x8a99('0x32')](removeEntity(_0x8deaf4,null))['catch'](handleError(_0x8deaf4,null));};exports[_0x8a99('0x57')]=function(_0x5ec31d,_0x1cbdb1){return db['OpenchannelMessage'][_0x8a99('0x57')]()[_0x8a99('0x32')](respondWithResult(_0x1cbdb1,null))['catch'](handleError(_0x1cbdb1,null));};var interaction_log=require(_0x8a99('0x58'))(_0x8a99('0x59'));exports['accept']=function(_0x16b5eb,_0x312718,_0x4f35de){var _0x37eac6={'channel':_0x8a99('0x5a')};if(_0x16b5eb['body']['id']){delete _0x16b5eb[_0x8a99('0x56')]['id'];}_0x16b5eb[_0x8a99('0x56')][_0x8a99('0x5b')]=!![];_0x16b5eb[_0x8a99('0x56')][_0x8a99('0x5c')]=moment()[_0x8a99('0x5d')](_0x8a99('0x5e'));_0x16b5eb[_0x8a99('0x56')][_0x8a99('0x5f')]=_0x16b5eb[_0x8a99('0x56')][_0x8a99('0x5f')]||_0x16b5eb[_0x8a99('0x60')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x16b5eb['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x8a99('0x61')}]})[_0x8a99('0x32')](handleEntityNotFound(_0x312718,null))['then'](saveUpdates(_0x16b5eb[_0x8a99('0x56')],null))[_0x8a99('0x32')](function(_0x724e51){if(_0x724e51){_0x37eac6[_0x8a99('0x26')]=_0x724e51[_0x8a99('0x62')]({'plain':!![]});return db[_0x8a99('0x63')][_0x8a99('0x54')]({'where':{'id':_0x724e51[_0x8a99('0x64')]}});}return null;})[_0x8a99('0x32')](handleEntityNotFound(_0x312718,null))[_0x8a99('0x32')](function(_0x35e894){if(_0x35e894){return _0x35e894[_0x8a99('0x30')]({'UserId':_0x16b5eb[_0x8a99('0x56')]['UserId'],'read1stAt':_[_0x8a99('0x65')](_0x35e894[_0x8a99('0x66')])?moment()[_0x8a99('0x5d')](_0x8a99('0x5e')):undefined});}return null;})[_0x8a99('0x32')](function(_0x5218fa){if(_0x5218fa){_0x37eac6[_0x8a99('0x67')]=_0x5218fa[_0x8a99('0x62')]({'plain':!![]});interaction_log[_0x8a99('0x1f')](_0x8a99('0x68'),_0x16b5eb[_0x8a99('0x60')]['id'],_0x16b5eb[_0x8a99('0x60')][_0x8a99('0x35')],_0x16b5eb[_0x8a99('0x60')][_0x8a99('0x69')],_0x37eac6[_0x8a99('0x67')]['id'],_0x16b5eb['body']?JSON[_0x8a99('0x24')](_0x16b5eb[_0x8a99('0x56')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x37eac6);}return null;})['then'](function(_0x2c267f){if(_0x2c267f){if(_0x16b5eb[_0x8a99('0x56')][_0x8a99('0x6a')]){_0x37eac6['message'][_0x8a99('0x6b')]=util[_0x8a99('0x5d')](_0x8a99('0x6c'),_0x16b5eb[_0x8a99('0x60')][_0x8a99('0x35')]);_0x37eac6[_0x8a99('0x26')][_0x8a99('0x6d')]=_0x37eac6['channel'];_0x37eac6[_0x8a99('0x26')]['event']=_0x8a99('0x6e');return respondWithRpcPromise(_0x8a99('0x6f'),'EventManager',{'event':_0x8a99('0x70'),'message':_0x37eac6[_0x8a99('0x26')]},client9002)[_0x8a99('0x32')](function(){return _0x37eac6;});}return _0x37eac6;}return null;})[_0x8a99('0x32')](respondWithResult(_0x312718,null))[_0x8a99('0x27')](handleError(_0x312718,null));};var interaction_log=require(_0x8a99('0x58'))('openchannel-interactions');exports[_0x8a99('0x2f')]=function(_0x83a8a8,_0x24f7c7,_0x2e29f5){var _0x5aa90e={'agent':{},'channel':_0x8a99('0x5a')};if(_0x83a8a8[_0x8a99('0x56')]['id']){delete _0x83a8a8['body']['id'];}_0x83a8a8[_0x8a99('0x56')][_0x8a99('0x5f')]=_0x83a8a8[_0x8a99('0x56')]['UserId']||_0x83a8a8[_0x8a99('0x60')]['id'];_0x5aa90e[_0x8a99('0x71')]['id']=_0x83a8a8[_0x8a99('0x56')]['UserId'];return db[_0x8a99('0x39')]['find']({'where':{'id':_0x83a8a8[_0x8a99('0x52')]['id'],'UserId':null}})[_0x8a99('0x32')](handleEntityNotFound(_0x24f7c7,null))[_0x8a99('0x32')](function(_0x338d06){if(_0x338d06){_0x5aa90e[_0x8a99('0x26')]=_0x338d06[_0x8a99('0x62')]({'plain':!![]});return db[_0x8a99('0x63')][_0x8a99('0x54')]({'where':{'id':_0x338d06[_0x8a99('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x24f7c7,null))[_0x8a99('0x32')](function(_0x32a6ca){if(_0x32a6ca){_0x5aa90e[_0x8a99('0x67')]=_0x32a6ca[_0x8a99('0x62')]({'plain':!![]});interaction_log[_0x8a99('0x1f')](_0x8a99('0x72'),_0x83a8a8[_0x8a99('0x60')]['id'],_0x83a8a8[_0x8a99('0x60')]['name'],_0x83a8a8[_0x8a99('0x60')][_0x8a99('0x69')],_0x5aa90e[_0x8a99('0x67')]['id'],_0x83a8a8[_0x8a99('0x56')]?JSON['stringify'](_0x83a8a8[_0x8a99('0x56')]):_0x8a99('0x73'));return respondWithRpcPromise(_0x8a99('0x74'),_0x8a99('0x75'),_0x5aa90e);}return null;})[_0x8a99('0x32')](function(_0x10b7fa){if(_0x10b7fa){_0x10b7fa[_0x8a99('0x26')]['interface']=util['format'](_0x8a99('0x6c'),_0x83a8a8['user'][_0x8a99('0x35')]);_0x10b7fa[_0x8a99('0x26')][_0x8a99('0x6d')]=_0x5aa90e[_0x8a99('0x6d')];_0x10b7fa[_0x8a99('0x26')][_0x8a99('0x76')]=_0x8a99('0x2f');respondWithRpcPromise(_0x8a99('0x6f'),_0x8a99('0x6f'),{'event':_0x8a99('0x77'),'message':_0x10b7fa[_0x8a99('0x26')]},client9002);return _0x5aa90e;}return null;})[_0x8a99('0x32')](respondWithResult(_0x24f7c7,null))[_0x8a99('0x27')](handleError(_0x24f7c7,null));}; \ No newline at end of file +var _0x9585=['index','map','OpenchannelMessage','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','find','create','body','describe','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','UserId','get','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','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~!@#$%^&-_=+[{]}.','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x9585,0x1a4));var _0x5958=function(_0x530dbb,_0x202d4b){_0x530dbb=_0x530dbb-0x0;var _0x1f8f98=_0x9585[_0x530dbb];return _0x1f8f98;};'use strict';var pdf=require(_0x5958('0x0'));var emlformat=require(_0x5958('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5958('0x2'));var jsonpatch=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var moment=require('moment');var BPromise=require(_0x5958('0x5'));var Mustache=require(_0x5958('0x6'));var util=require('util');var path=require(_0x5958('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5958('0x8'));var fs=require('fs');var _=require(_0x5958('0x9'));var squel=require(_0x5958('0xa'));var crypto=require('crypto');var jsforce=require(_0x5958('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5958('0xc'));var querystring=require('querystring');var Papa=require(_0x5958('0xd'));var Redis=require(_0x5958('0xe'));var authService=require(_0x5958('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5958('0x10'));var logger=require(_0x5958('0x11'))(_0x5958('0x12'));var utils=require('../../config/utils');var config=require(_0x5958('0x13'));var db=require(_0x5958('0x14'))['db'];config[_0x5958('0x15')]=_[_0x5958('0x16')](config[_0x5958('0x15')],{'host':_0x5958('0x17'),'port':0x18eb});var socket=require(_0x5958('0x18'))(new Redis(config['redis']));require(_0x5958('0x19'))[_0x5958('0x1a')](socket);var jayson=require(_0x5958('0x1b'));var client=jayson[_0x5958('0x1c')][_0x5958('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x5958('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1a532b,_0x239194,_0x48c780){if(_0x48c780){var _0x1199fc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1199fc['test'](_0x239194)){return _0x1a532b;}else{throw new db[(_0x5958('0x1e'))][(_0x5958('0x1f'))](_0x5958('0x20'));}}else{return _0x1a532b;}}function respondWithRpcPromise(_0x1df88c,_0x4821b9,_0x1ba2f0,_0xfefa18){return new BPromise(function(_0x2cc624,_0x1e42a3){var _0x4df85c=_0xfefa18||client;return _0x4df85c['request'](_0x1df88c,_0x1ba2f0)['then'](function(_0x57a90e){logger[_0x5958('0x21')](_0x5958('0x22'),_0x4821b9,_0x5958('0x23'));logger[_0x5958('0x24')](_0x5958('0x25'),_0x4821b9,_0x5958('0x23'),JSON[_0x5958('0x26')](_0x57a90e));if(_0x57a90e[_0x5958('0x27')]){if(_0x57a90e[_0x5958('0x27')]['code']===0x1f4){logger[_0x5958('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x4821b9,_0x57a90e['error'][_0x5958('0x28')]);return _0x1e42a3(_0x57a90e[_0x5958('0x27')][_0x5958('0x28')]);}logger[_0x5958('0x27')](_0x5958('0x22'),_0x4821b9,_0x57a90e[_0x5958('0x27')]['message']);return _0x2cc624(_0x57a90e[_0x5958('0x27')][_0x5958('0x28')]);}else{logger[_0x5958('0x21')](_0x5958('0x22'),_0x4821b9,_0x5958('0x23'));_0x2cc624(_0x57a90e[_0x5958('0x29')][_0x5958('0x28')]);}})[_0x5958('0x2a')](function(_0x371696){logger[_0x5958('0x27')](_0x5958('0x22'),_0x4821b9,_0x371696);_0x1e42a3(_0x371696);});});}function respondWithStatusCode(_0x54425d,_0x280b00){_0x280b00=_0x280b00||0xcc;return function(_0x470b4e){if(_0x470b4e){return _0x54425d['sendStatus'](_0x280b00);}return _0x54425d[_0x5958('0x2b')](_0x280b00)[_0x5958('0x2c')]();};}function respondWithResult(_0x3ba442,_0x59d34c){_0x59d34c=_0x59d34c||0xc8;return function(_0x3e1aab){if(_0x3e1aab){return _0x3ba442[_0x5958('0x2b')](_0x59d34c)[_0x5958('0x2d')](_0x3e1aab);}};}function respondWithFilteredResult(_0x5aedf2,_0x1870dd){return function(_0x16fdcf){if(_0x16fdcf){var _0x3300d0=_0x16fdcf['count'],_0x479539=_0x1870dd[_0x5958('0x2e')],_0x25d6a8=_0x1870dd[_0x5958('0x2e')]+_0x1870dd[_0x5958('0x2f')],_0x45f4c2;if(_0x25d6a8>=_0x3300d0){_0x25d6a8=_0x3300d0;_0x45f4c2=0xc8;}else{_0x45f4c2=0xce;}_0x5aedf2[_0x5958('0x2b')](_0x45f4c2);return _0x5aedf2[_0x5958('0x30')](_0x5958('0x31'),_0x479539+'-'+_0x25d6a8+'/'+_0x3300d0)[_0x5958('0x2d')](_0x16fdcf);}return null;};}function patchUpdates(_0x45e1e1){return function(_0x1ef669){try{jsonpatch[_0x5958('0x32')](_0x1ef669,_0x45e1e1,!![]);}catch(_0x1ec022){return BPromise[_0x5958('0x33')](_0x1ec022);}return _0x1ef669[_0x5958('0x34')]();};}function saveUpdates(_0x706893,_0xdbb059){return function(_0x1fb342){if(_0x1fb342){return _0x1fb342[_0x5958('0x35')](_0x706893)[_0x5958('0x36')](function(_0x157b7c){return _0x157b7c;});}return null;};}function removeEntity(_0x5d7ffe,_0x60a6d0){return function(_0x1552c6){if(_0x1552c6){return _0x1552c6[_0x5958('0x37')]()[_0x5958('0x36')](function(){_0x5d7ffe[_0x5958('0x2b')](0xcc)[_0x5958('0x2c')]();});}};}function handleEntityNotFound(_0x1ec124,_0x16affd){return function(_0x4a76a5){if(!_0x4a76a5){_0x1ec124[_0x5958('0x38')](0x194);}return _0x4a76a5;};}function handleError(_0x5adca8,_0x10cc62){_0x10cc62=_0x10cc62||0x1f4;return function(_0x5c882d){logger[_0x5958('0x27')](_0x5c882d[_0x5958('0x39')]);if(_0x5c882d['name']){delete _0x5c882d[_0x5958('0x3a')];}_0x5adca8[_0x5958('0x2b')](_0x10cc62)[_0x5958('0x3b')](_0x5c882d);};}exports[_0x5958('0x3c')]=function(_0x24bd4d,_0x1c3521){var _0x4016b6={},_0x1a31c1={},_0x4a30ee={'count':0x0,'rows':[]};var _0x2564e6=_[_0x5958('0x3d')](db[_0x5958('0x3e')][_0x5958('0x3f')],function(_0x7123a){return{'name':_0x7123a['fieldName'],'type':_0x7123a['type'][_0x5958('0x40')]};});_0x1a31c1[_0x5958('0x41')]=_[_0x5958('0x3d')](_0x2564e6,_0x5958('0x3a'));_0x1a31c1['query']=_['keys'](_0x24bd4d[_0x5958('0x42')]);_0x1a31c1[_0x5958('0x43')]=_[_0x5958('0x44')](_0x1a31c1[_0x5958('0x41')],_0x1a31c1[_0x5958('0x42')]);_0x4016b6[_0x5958('0x45')]=_[_0x5958('0x44')](_0x1a31c1[_0x5958('0x41')],qs['fields'](_0x24bd4d[_0x5958('0x42')][_0x5958('0x46')]));_0x4016b6['attributes']=_0x4016b6[_0x5958('0x45')][_0x5958('0x47')]?_0x4016b6[_0x5958('0x45')]:_0x1a31c1[_0x5958('0x41')];if(!_0x24bd4d[_0x5958('0x42')][_0x5958('0x48')]('nolimit')){_0x4016b6['limit']=qs[_0x5958('0x2f')](_0x24bd4d['query'][_0x5958('0x2f')]);_0x4016b6[_0x5958('0x2e')]=qs['offset'](_0x24bd4d[_0x5958('0x42')][_0x5958('0x2e')]);}_0x4016b6[_0x5958('0x49')]=qs['sort'](_0x24bd4d[_0x5958('0x42')][_0x5958('0x4a')]);_0x4016b6[_0x5958('0x4b')]=qs[_0x5958('0x43')](_[_0x5958('0x4c')](_0x24bd4d[_0x5958('0x42')],_0x1a31c1[_0x5958('0x43')]),_0x2564e6);if(_0x24bd4d[_0x5958('0x42')][_0x5958('0x4d')]){_0x4016b6[_0x5958('0x4b')]=_[_0x5958('0x4e')](_0x4016b6[_0x5958('0x4b')],{'$or':_['map'](_0x2564e6,function(_0x2d5a4c){if(_0x2d5a4c['type']!=='VIRTUAL'){var _0x2956d9={};_0x2956d9[_0x2d5a4c[_0x5958('0x3a')]]={'$like':'%'+_0x24bd4d[_0x5958('0x42')]['filter']+'%'};return _0x2956d9;}})});}_0x4016b6=_[_0x5958('0x4e')]({},_0x4016b6,_0x24bd4d[_0x5958('0x4f')]);var _0x4c0c93={'where':_0x4016b6[_0x5958('0x4b')]};return db[_0x5958('0x3e')][_0x5958('0x50')](_0x4c0c93)[_0x5958('0x36')](function(_0x4b5703){_0x4a30ee[_0x5958('0x50')]=_0x4b5703;if(_0x24bd4d[_0x5958('0x42')][_0x5958('0x51')]){_0x4016b6[_0x5958('0x52')]=[{'all':!![]}];}return db[_0x5958('0x3e')]['findAll'](_0x4016b6);})['then'](function(_0x58d10b){_0x4a30ee[_0x5958('0x53')]=_0x58d10b;return _0x4a30ee;})[_0x5958('0x36')](respondWithFilteredResult(_0x1c3521,_0x4016b6))[_0x5958('0x2a')](handleError(_0x1c3521,null));};exports[_0x5958('0x54')]=function(_0x471906,_0x64c25f){var _0x39a6a0={'raw':!![],'where':{'id':_0x471906[_0x5958('0x55')]['id']}},_0x2336af={};_0x2336af[_0x5958('0x41')]=_[_0x5958('0x56')](db['OpenchannelMessage'][_0x5958('0x3f')]);_0x2336af['query']=_[_0x5958('0x56')](_0x471906[_0x5958('0x42')]);_0x2336af[_0x5958('0x43')]=_[_0x5958('0x44')](_0x2336af[_0x5958('0x41')],_0x2336af[_0x5958('0x42')]);_0x39a6a0[_0x5958('0x45')]=_[_0x5958('0x44')](_0x2336af[_0x5958('0x41')],qs[_0x5958('0x46')](_0x471906['query'][_0x5958('0x46')]));_0x39a6a0[_0x5958('0x45')]=_0x39a6a0[_0x5958('0x45')][_0x5958('0x47')]?_0x39a6a0['attributes']:_0x2336af[_0x5958('0x41')];if(_0x471906[_0x5958('0x42')]['includeAll']){_0x39a6a0['include']=[{'all':!![]}];}_0x39a6a0=_[_0x5958('0x4e')]({},_0x39a6a0,_0x471906[_0x5958('0x4f')]);return db[_0x5958('0x3e')][_0x5958('0x57')](_0x39a6a0)[_0x5958('0x36')](handleEntityNotFound(_0x64c25f,null))[_0x5958('0x36')](respondWithResult(_0x64c25f,null))['catch'](handleError(_0x64c25f,null));};exports[_0x5958('0x58')]=function(_0x2a5437,_0x32e6ad){return db[_0x5958('0x3e')]['create'](_0x2a5437[_0x5958('0x59')],{})[_0x5958('0x36')](respondWithResult(_0x32e6ad,0xc9))[_0x5958('0x2a')](handleError(_0x32e6ad,null));};exports[_0x5958('0x35')]=function(_0x2c2938,_0x1229eb){if(_0x2c2938[_0x5958('0x59')]['id']){delete _0x2c2938['body']['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x2c2938['params']['id']}})['then'](handleEntityNotFound(_0x1229eb,null))[_0x5958('0x36')](saveUpdates(_0x2c2938[_0x5958('0x59')],null))[_0x5958('0x36')](respondWithResult(_0x1229eb,null))[_0x5958('0x2a')](handleError(_0x1229eb,null));};exports[_0x5958('0x37')]=function(_0xee1a6e,_0x1d0de5){return db[_0x5958('0x3e')]['find']({'where':{'id':_0xee1a6e['params']['id']}})[_0x5958('0x36')](handleEntityNotFound(_0x1d0de5,null))[_0x5958('0x36')](removeEntity(_0x1d0de5,null))[_0x5958('0x2a')](handleError(_0x1d0de5,null));};exports[_0x5958('0x5a')]=function(_0x464ebe,_0xd1f98c){return db['OpenchannelMessage']['describe']()[_0x5958('0x36')](respondWithResult(_0xd1f98c,null))[_0x5958('0x2a')](handleError(_0xd1f98c,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x150833,_0x2c4dac,_0x1369d0){var _0x4296ab={'channel':_0x5958('0x5b')};if(_0x150833[_0x5958('0x59')]['id']){delete _0x150833[_0x5958('0x59')]['id'];}_0x150833[_0x5958('0x59')][_0x5958('0x5c')]=!![];_0x150833[_0x5958('0x59')][_0x5958('0x5d')]=moment()[_0x5958('0x5e')](_0x5958('0x5f'));_0x150833['body']['UserId']=_0x150833[_0x5958('0x59')]['UserId']||_0x150833[_0x5958('0x60')]['id'];return db['OpenchannelMessage'][_0x5958('0x57')]({'where':{'id':_0x150833[_0x5958('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x5958('0x61')],'as':_0x5958('0x62')}]})[_0x5958('0x36')](handleEntityNotFound(_0x2c4dac,null))[_0x5958('0x36')](saveUpdates(_0x150833[_0x5958('0x59')],null))[_0x5958('0x36')](function(_0x3ce1d4){if(_0x3ce1d4){_0x4296ab['message']=_0x3ce1d4['get']({'plain':!![]});return db[_0x5958('0x63')][_0x5958('0x57')]({'where':{'id':_0x3ce1d4[_0x5958('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2c4dac,null))[_0x5958('0x36')](function(_0x21c84a){if(_0x21c84a){return _0x21c84a[_0x5958('0x35')]({'UserId':_0x150833[_0x5958('0x59')]['UserId'],'read1stAt':_[_0x5958('0x65')](_0x21c84a['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5958('0x36')](function(_0x1890f4){if(_0x1890f4){_0x4296ab[_0x5958('0x66')]=_0x1890f4['get']({'plain':!![]});interaction_log['info'](_0x5958('0x67'),_0x150833[_0x5958('0x60')]['id'],_0x150833[_0x5958('0x60')]['name'],_0x150833[_0x5958('0x60')][_0x5958('0x68')],_0x4296ab[_0x5958('0x66')]['id'],_0x150833[_0x5958('0x59')]?JSON[_0x5958('0x26')](_0x150833['body']):_0x5958('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4296ab);}return null;})[_0x5958('0x36')](function(_0xfdf755){if(_0xfdf755){if(_0x150833[_0x5958('0x59')][_0x5958('0x6a')]){_0x4296ab[_0x5958('0x28')]['interface']=util[_0x5958('0x5e')](_0x5958('0x6b'),_0x150833[_0x5958('0x60')]['name']);_0x4296ab[_0x5958('0x28')]['channel']=_0x4296ab[_0x5958('0x6c')];_0x4296ab[_0x5958('0x28')][_0x5958('0x6d')]=_0x5958('0x6e');return respondWithRpcPromise('EventManager',_0x5958('0x6f'),{'event':_0x5958('0x70'),'message':_0x4296ab['message']},client9002)['then'](function(){return _0x4296ab;});}return _0x4296ab;}return null;})[_0x5958('0x36')](respondWithResult(_0x2c4dac,null))[_0x5958('0x2a')](handleError(_0x2c4dac,null));};var interaction_log=require(_0x5958('0x11'))('openchannel-interactions');exports['reject']=function(_0x13d94b,_0x503e5d,_0x2ce2d1){var _0x2fe0a2={'agent':{},'channel':'openchannel'};if(_0x13d94b[_0x5958('0x59')]['id']){delete _0x13d94b[_0x5958('0x59')]['id'];}_0x13d94b[_0x5958('0x59')]['UserId']=_0x13d94b[_0x5958('0x59')]['UserId']||_0x13d94b[_0x5958('0x60')]['id'];_0x2fe0a2[_0x5958('0x71')]['id']=_0x13d94b[_0x5958('0x59')][_0x5958('0x72')];return db['OpenchannelMessage'][_0x5958('0x57')]({'where':{'id':_0x13d94b[_0x5958('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x503e5d,null))[_0x5958('0x36')](function(_0x4b259c){if(_0x4b259c){_0x2fe0a2[_0x5958('0x28')]=_0x4b259c[_0x5958('0x73')]({'plain':!![]});return db[_0x5958('0x63')][_0x5958('0x57')]({'where':{'id':_0x4b259c[_0x5958('0x64')]}});}return null;})[_0x5958('0x36')](handleEntityNotFound(_0x503e5d,null))['then'](function(_0x5d9037){if(_0x5d9037){_0x2fe0a2[_0x5958('0x66')]=_0x5d9037[_0x5958('0x73')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13d94b[_0x5958('0x60')]['id'],_0x13d94b[_0x5958('0x60')][_0x5958('0x3a')],_0x13d94b['user'][_0x5958('0x68')],_0x2fe0a2['interaction']['id'],_0x13d94b[_0x5958('0x59')]?JSON[_0x5958('0x26')](_0x13d94b['body']):_0x5958('0x69'));return respondWithRpcPromise(_0x5958('0x74'),_0x5958('0x75'),_0x2fe0a2);}return null;})['then'](function(_0x259e10){if(_0x259e10){_0x259e10['message'][_0x5958('0x76')]=util[_0x5958('0x5e')](_0x5958('0x6b'),_0x13d94b['user'][_0x5958('0x3a')]);_0x259e10[_0x5958('0x28')][_0x5958('0x6c')]=_0x2fe0a2[_0x5958('0x6c')];_0x259e10[_0x5958('0x28')][_0x5958('0x6d')]=_0x5958('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x5958('0x77'),'message':_0x259e10['message']},client9002);return _0x2fe0a2;}return null;})[_0x5958('0x36')](respondWithResult(_0x503e5d,null))['catch'](handleError(_0x503e5d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b0d5a6b..4b1a239 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 _0xa545=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3c5646,_0x2485c1){var _0x4dd085=function(_0x4d2fcf){while(--_0x4d2fcf){_0x3c5646['push'](_0x3c5646['shift']());}};_0x4dd085(++_0x2485c1);}(_0xa545,0x13a));var _0x5a54=function(_0x344297,_0xb04130){_0x344297=_0x344297-0x0;var _0x1e0b4f=_0xa545[_0x344297];return _0x1e0b4f;};'use strict';var EventEmitter=require(_0x5a54('0x0'));var OpenchannelMessage=require(_0x5a54('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5a54('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a54('0x3'),'afterDestroy':_0x5a54('0x4')};function emitEvent(_0x13a994){return function(_0x34cf4c,_0x1d4471,_0x1935d4){OpenchannelMessageEvents[_0x5a54('0x5')](_0x13a994+':'+_0x34cf4c['id'],_0x34cf4c);OpenchannelMessageEvents[_0x5a54('0x5')](_0x13a994,_0x34cf4c);_0x1935d4(null);};}for(var e in events){if(events[_0x5a54('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5a54('0x7')](e,emitEvent(event));}}module[_0x5a54('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x85da=['events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3cb4cc,_0x34e6f0){var _0x38088d=function(_0x8481fb){while(--_0x8481fb){_0x3cb4cc['push'](_0x3cb4cc['shift']());}};_0x38088d(++_0x34e6f0);}(_0x85da,0xa8));var _0xa85d=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0x85da[_0x5e1e25];return _0x548e5f;};'use strict';var EventEmitter=require(_0xa85d('0x0'));var OpenchannelMessage=require(_0xa85d('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa85d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa85d('0x3'),'afterDestroy':'remove'};function emitEvent(_0xdfeeda){return function(_0x1d8535,_0x187804,_0x4b0633){OpenchannelMessageEvents[_0xa85d('0x4')](_0xdfeeda+':'+_0x1d8535['id'],_0x1d8535);OpenchannelMessageEvents[_0xa85d('0x4')](_0xdfeeda,_0x1d8535);_0x4b0633(null);};}for(var e in events){if(events[_0xa85d('0x5')](e)){var event=events[e];OpenchannelMessage[_0xa85d('0x6')](e,emitEvent(event));}}module[_0xa85d('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c773ee2..852387e 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 _0x238f=['threadId','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','error','secret','CmContact','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x2dbb82,_0x85cbbc){var _0x57c067=function(_0x5608f5){while(--_0x5608f5){_0x2dbb82['push'](_0x2dbb82['shift']());}};_0x57c067(++_0x85cbbc);}(_0x238f,0xa5));var _0xf238=function(_0x319ca1,_0x4c6cda){_0x319ca1=_0x319ca1-0x0;var _0x27e4ff=_0x238f[_0x319ca1];return _0x27e4ff;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var logger=require(_0xf238('0x2'))('api');var moment=require(_0xf238('0x3'));var BPromise=require(_0xf238('0x4'));var rp=require(_0xf238('0x5'));var fs=require('fs');var path=require(_0xf238('0x6'));var rimraf=require(_0xf238('0x7'));var config=require(_0xf238('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xf238('0x9')]=function(_0x2b9e9f,_0x4e4685){return _0x2b9e9f['define'](_0xf238('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xf238('0xb'),'fields':[_0xf238('0xc')],'type':_0xf238('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24b11a,_0x5a88c2,_0x446201){var _0x4eaf8b=_0x2b9e9f[_0xf238('0xe')];var _0x7928d1=_0x24b11a[_0xf238('0xf')]({'plain':!![]});if(_0x7928d1[_0xf238('0x10')][_0xf238('0x11')]()==='in'||_0x7928d1[_0xf238('0x10')][_0xf238('0x11')]()===_0xf238('0x12')&&!_0x7928d1['secret']&&!_[_0xf238('0x13')](_0x7928d1[_0xf238('0x14')])){_0x4eaf8b[_0xf238('0x15')]['findOne']({'where':{'id':_0x7928d1[_0xf238('0x16')]}})[_0xf238('0x17')](function(_0x210b0f){if(_0x210b0f){_0x210b0f[_0xf238('0x18')]({'lastMsgAt':_0x7928d1[_0xf238('0x19')],'lastMsgDirection':_0x7928d1['direction'][_0xf238('0x11')]()});}})['catch'](function(_0x5451f6){console[_0xf238('0x1a')](_0x5451f6);});}if(_0x7928d1[_0xf238('0x10')]===_0xf238('0x12')&&!_0x7928d1[_0xf238('0x1b')]){var _0xdcf24e;_0x4eaf8b[_0xf238('0x1c')]['describe']()[_0xf238('0x17')](function(_0x34053b){return _0x4eaf8b[_0xf238('0x1d')][_0xf238('0x1e')]({'where':{'id':_0x7928d1['OpenchannelAccountId']},'include':[{'model':_0x4eaf8b[_0xf238('0x15')],'as':_0xf238('0x1f'),'where':{'id':_0x7928d1[_0xf238('0x16')]},'limit':0x1,'include':[{'model':_0x4eaf8b[_0xf238('0x1c')],'as':_0xf238('0x20'),'attributes':_[_0xf238('0x21')](_0x34053b)}]}]});})[_0xf238('0x17')](function(_0x37e533){_0xdcf24e=_0x37e533[_0xf238('0xf')]({'plain':!![]});if(_0xdcf24e&&_0xdcf24e[_0xf238('0x22')]){logger[_0xf238('0x23')](_0xf238('0x24'),_0xf238('0x25'),util[_0xf238('0x26')](_0xf238('0x27'),_0x7928d1['id'],_0xdcf24e[_0xf238('0x22')]));if(_0xdcf24e[_0xf238('0x1f')]&&_0xdcf24e[_0xf238('0x1f')][_0xf238('0x28')]){_0x7928d1[_0xf238('0x29')]=_[_0xf238('0x2a')](_0xdcf24e[_0xf238('0x1f')][0x0],_0xf238('0x20'));_0x7928d1[_0xf238('0x20')]=_0xdcf24e[_0xf238('0x1f')][0x0][_0xf238('0x20')];}var _0x5a88c2={'method':_0xf238('0x2b'),'uri':encodeURI(_0xdcf24e['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5a88c2[_0xf238('0x2c')]){case _0xf238('0x2d'):_0x5a88c2['qs']=_0x7928d1;break;case _0xf238('0x2b'):_0x5a88c2['body']=_0x7928d1;break;}return rp(_0x5a88c2)[_0xf238('0x17')](function(_0x109ab3){logger[_0xf238('0x23')](_0xf238('0x24'),_0xf238('0x25'),util[_0xf238('0x26')](_0xf238('0x2e'),_0x7928d1['id'],_0xdcf24e[_0xf238('0x22')]));if(_0x109ab3[_0xf238('0xc')][_0xf238('0x2f')]&&_0x109ab3[_0xf238('0xc')]['threadId']!=_0x7928d1['Interaction']['threadId']){return _0x4eaf8b[_0xf238('0x15')][_0xf238('0x18')]({'threadId':_0x109ab3['body']['threadId']},{'logging':!![],'where':{'id':_0x7928d1['Interaction']['id']}});}else{return;}})[_0xf238('0x17')](function(){return _0x24b11a[_0xf238('0x18')]({'read':!![]});})[_0xf238('0x30')](function(_0x112f21){logger['error'](_0xf238('0x24'),_0xf238('0x25'),util[_0xf238('0x31')](_0x112f21,{'showHidden':![],'depth':null}));_0x446201();});}else{_0x446201();}})[_0xf238('0x32')](function(){_0x446201();});}else{_0x446201();}}},'charset':_0xf238('0x33'),'collate':_0xf238('0x34')});}; \ No newline at end of file +var _0x3de0=['findOne','OpenchannelInteractionId','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','then','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','threadId','inspect','finally','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction'];(function(_0x51cc11,_0x5e414f){var _0x53d7bc=function(_0x5c9ace){while(--_0x5c9ace){_0x51cc11['push'](_0x51cc11['shift']());}};_0x53d7bc(++_0x5e414f);}(_0x3de0,0x143));var _0x03de=function(_0xa5e8e1,_0x47477c){_0xa5e8e1=_0xa5e8e1-0x0;var _0x3c364d=_0x3de0[_0xa5e8e1];return _0x3c364d;};'use strict';var _=require(_0x03de('0x0'));var util=require('util');var logger=require(_0x03de('0x1'))(_0x03de('0x2'));var moment=require('moment');var BPromise=require(_0x03de('0x3'));var rp=require(_0x03de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03de('0x5'));var config=require(_0x03de('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x340386,_0x6567ae){return _0x340386[_0x03de('0x7')](_0x03de('0x8'),attributes,{'tableName':_0x03de('0x9'),'paranoid':![],'indexes':[{'name':_0x03de('0xa'),'fields':[_0x03de('0xb')],'type':_0x03de('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5828af,_0x1b6462,_0x4d275c){var _0x488946=_0x340386[_0x03de('0xd')];var _0x1d6e87=_0x5828af['get']({'plain':!![]});if(_0x1d6e87[_0x03de('0xe')][_0x03de('0xf')]()==='in'||_0x1d6e87['direction'][_0x03de('0xf')]()===_0x03de('0x10')&&!_0x1d6e87['secret']&&!_[_0x03de('0x11')](_0x1d6e87[_0x03de('0x12')])){_0x488946[_0x03de('0x13')][_0x03de('0x14')]({'where':{'id':_0x1d6e87[_0x03de('0x15')]}})['then'](function(_0xf9553d){if(_0xf9553d){_0xf9553d[_0x03de('0x16')]({'lastMsgAt':_0x1d6e87[_0x03de('0x17')],'lastMsgDirection':_0x1d6e87[_0x03de('0xe')]['toLowerCase']()});}})[_0x03de('0x18')](function(_0xedbc6b){console[_0x03de('0x19')](_0xedbc6b);});}if(_0x1d6e87[_0x03de('0xe')]===_0x03de('0x10')&&!_0x1d6e87[_0x03de('0x1a')]){var _0x9285c0;_0x488946[_0x03de('0x1b')][_0x03de('0x1c')]()['then'](function(_0x4835c0){return _0x488946[_0x03de('0x1d')][_0x03de('0x1e')]({'where':{'id':_0x1d6e87[_0x03de('0x1f')]},'include':[{'model':_0x488946['OpenchannelInteraction'],'as':_0x03de('0x20'),'where':{'id':_0x1d6e87[_0x03de('0x15')]},'limit':0x1,'include':[{'model':_0x488946[_0x03de('0x1b')],'as':_0x03de('0x21'),'attributes':_[_0x03de('0x22')](_0x4835c0)}]}]});})[_0x03de('0x23')](function(_0x3cb6ff){_0x9285c0=_0x3cb6ff['get']({'plain':!![]});if(_0x9285c0&&_0x9285c0['replyUri']){logger['info'](_0x03de('0x24'),_0x03de('0x25'),util['format'](_0x03de('0x26'),_0x1d6e87['id'],_0x9285c0[_0x03de('0x27')]));if(_0x9285c0[_0x03de('0x20')]&&_0x9285c0['Interactions'][_0x03de('0x28')]){_0x1d6e87[_0x03de('0x29')]=_['omit'](_0x9285c0[_0x03de('0x20')][0x0],_0x03de('0x21'));_0x1d6e87[_0x03de('0x21')]=_0x9285c0[_0x03de('0x20')][0x0][_0x03de('0x21')];}var _0x1b6462={'method':_0x03de('0x2a'),'uri':encodeURI(_0x9285c0[_0x03de('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1b6462[_0x03de('0x2b')]){case _0x03de('0x2c'):_0x1b6462['qs']=_0x1d6e87;break;case'POST':_0x1b6462[_0x03de('0xb')]=_0x1d6e87;break;}return rp(_0x1b6462)[_0x03de('0x23')](function(_0x5ce3c2){logger['info'](_0x03de('0x24'),_0x03de('0x25'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x1d6e87['id'],_0x9285c0[_0x03de('0x27')]));if(_0x5ce3c2[_0x03de('0xb')]['threadId']&&_0x5ce3c2[_0x03de('0xb')][_0x03de('0x2d')]!=_0x1d6e87[_0x03de('0x29')][_0x03de('0x2d')]){return _0x488946['OpenchannelInteraction']['update']({'threadId':_0x5ce3c2[_0x03de('0xb')][_0x03de('0x2d')]},{'logging':!![],'where':{'id':_0x1d6e87[_0x03de('0x29')]['id']}});}else{return;}})[_0x03de('0x23')](function(){return _0x5828af[_0x03de('0x16')]({'read':!![]});})[_0x03de('0x18')](function(_0x50752e){logger[_0x03de('0x19')](_0x03de('0x24'),_0x03de('0x25'),util[_0x03de('0x2e')](_0x50752e,{'showHidden':![],'depth':null}));_0x4d275c();});}else{_0x4d275c();}})[_0x03de('0x2f')](function(){_0x4d275c();});}else{_0x4d275c();}}},'charset':_0x03de('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index b9bf84d..e0b2fd9 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 _0xf9ac=['lodash','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','./openchannelMessage.socket','request','then','request\x20sent','debug','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options'];(function(_0x524b15,_0x51c457){var _0x28bdef=function(_0x4119f0){while(--_0x4119f0){_0x524b15['push'](_0x524b15['shift']());}};_0x28bdef(++_0x51c457);}(_0xf9ac,0x87));var _0xcf9a=function(_0x4b9024,_0x10fa48){_0x4b9024=_0x4b9024-0x0;var _0xefa8d1=_0xf9ac[_0x4b9024];return _0xefa8d1;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf9a('0x1'));var rs=require(_0xcf9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf9a('0x5'));var client=jayson[_0xcf9a('0x6')][_0xcf9a('0x7')]({'port':0x232a});config[_0xcf9a('0x8')]=_['defaults'](config[_0xcf9a('0x8')],{'host':_0xcf9a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf9a('0xa'))['register'](socket);function respondWithRpcPromise(_0x2c8a46,_0x5ac4cb,_0x35564a){return new BPromise(function(_0x49b1aa,_0x3d93ad){return client[_0xcf9a('0xb')](_0x2c8a46,_0x35564a)[_0xcf9a('0xc')](function(_0x53c5ae){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5ac4cb,_0xcf9a('0xd'));logger[_0xcf9a('0xe')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5ac4cb,_0xcf9a('0xd'),JSON[_0xcf9a('0xf')](_0x53c5ae));if(_0x53c5ae[_0xcf9a('0x10')]){if(_0x53c5ae['error'][_0xcf9a('0x11')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x5ac4cb,_0x53c5ae['error']['message']);return _0x3d93ad(_0x53c5ae[_0xcf9a('0x10')][_0xcf9a('0x12')]);}logger[_0xcf9a('0x10')](_0xcf9a('0x13'),_0x5ac4cb,_0x53c5ae[_0xcf9a('0x10')][_0xcf9a('0x12')]);return _0x49b1aa(_0x53c5ae[_0xcf9a('0x10')]['message']);}else{logger[_0xcf9a('0x14')](_0xcf9a('0x13'),_0x5ac4cb,'request\x20sent');_0x49b1aa(_0x53c5ae[_0xcf9a('0x15')]['message']);}})[_0xcf9a('0x16')](function(_0x4f1714){logger[_0xcf9a('0x10')](_0xcf9a('0x13'),_0x5ac4cb,_0x4f1714);_0x3d93ad(_0x4f1714);});});}exports[_0xcf9a('0x17')]=function(_0x2a29e0){var _0x393165=this;return new Promise(function(_0x5e4ac5,_0x557a0b){return db[_0xcf9a('0x18')]['create'](_0x2a29e0[_0xcf9a('0x19')],{'raw':_0x2a29e0[_0xcf9a('0x1a')]?_0x2a29e0[_0xcf9a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcf9a('0xc')](function(_0x2388d1){logger[_0xcf9a('0x14')]('CreateOpenchannelMessage',_0x2a29e0);logger[_0xcf9a('0xe')](_0xcf9a('0x17'),_0x2a29e0,JSON[_0xcf9a('0xf')](_0x2388d1));_0x5e4ac5(_0x2388d1);})['catch'](function(_0x4f43b9){logger[_0xcf9a('0x10')](_0xcf9a('0x17'),_0x4f43b9[_0xcf9a('0x12')],_0x2a29e0);_0x557a0b(_0x393165[_0xcf9a('0x10')](0x1f4,_0x4f43b9[_0xcf9a('0x12')]));});});}; \ No newline at end of file +var _0xbb8d=['CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1162bf,_0x5ae36b){var _0x35df1f=function(_0x957703){while(--_0x957703){_0x1162bf['push'](_0x1162bf['shift']());}};_0x35df1f(++_0x5ae36b);}(_0xbb8d,0x146));var _0xdbb8=function(_0x3dd531,_0x2a7e80){_0x3dd531=_0x3dd531-0x0;var _0x2ceec3=_0xbb8d[_0x3dd531];return _0x2ceec3;};'use strict';var _=require(_0xdbb8('0x0'));var util=require('util');var moment=require(_0xdbb8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbb8('0x2'))['db'];var utils=require(_0xdbb8('0x3'));var logger=require(_0xdbb8('0x4'))(_0xdbb8('0x5'));var config=require(_0xdbb8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdbb8('0x7')][_0xdbb8('0x8')]({'port':0x232a});config[_0xdbb8('0x9')]=_[_0xdbb8('0xa')](config['redis'],{'host':_0xdbb8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbb8('0x9')]));require(_0xdbb8('0xc'))['register'](socket);function respondWithRpcPromise(_0x419cf4,_0x3e0aa5,_0x45c7af){return new BPromise(function(_0x3113b8,_0x2eb417){return client[_0xdbb8('0xd')](_0x419cf4,_0x45c7af)[_0xdbb8('0xe')](function(_0x2b2be9){logger[_0xdbb8('0xf')](_0xdbb8('0x10'),_0x3e0aa5,'request\x20sent');logger[_0xdbb8('0x11')](_0xdbb8('0x12'),_0x3e0aa5,_0xdbb8('0x13'),JSON[_0xdbb8('0x14')](_0x2b2be9));if(_0x2b2be9[_0xdbb8('0x15')]){if(_0x2b2be9[_0xdbb8('0x15')][_0xdbb8('0x16')]===0x1f4){logger[_0xdbb8('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e0aa5,_0x2b2be9[_0xdbb8('0x15')]['message']);return _0x2eb417(_0x2b2be9[_0xdbb8('0x15')][_0xdbb8('0x17')]);}logger[_0xdbb8('0x15')](_0xdbb8('0x10'),_0x3e0aa5,_0x2b2be9[_0xdbb8('0x15')]['message']);return _0x3113b8(_0x2b2be9[_0xdbb8('0x15')]['message']);}else{logger['info'](_0xdbb8('0x10'),_0x3e0aa5,'request\x20sent');_0x3113b8(_0x2b2be9[_0xdbb8('0x18')][_0xdbb8('0x17')]);}})[_0xdbb8('0x19')](function(_0xbfba8a){logger[_0xdbb8('0x15')](_0xdbb8('0x10'),_0x3e0aa5,_0xbfba8a);_0x2eb417(_0xbfba8a);});});}exports[_0xdbb8('0x1a')]=function(_0x172786){var _0x4e1bcd=this;return new Promise(function(_0x4a5a5d,_0x4b5a99){return db[_0xdbb8('0x1b')][_0xdbb8('0x1c')](_0x172786[_0xdbb8('0x1d')],{'raw':_0x172786[_0xdbb8('0x1e')]?_0x172786[_0xdbb8('0x1e')][_0xdbb8('0x1f')]===undefined?!![]:![]:!![]})[_0xdbb8('0xe')](function(_0xe26dfa){logger['info'](_0xdbb8('0x1a'),_0x172786);logger[_0xdbb8('0x11')](_0xdbb8('0x1a'),_0x172786,JSON['stringify'](_0xe26dfa));_0x4a5a5d(_0xe26dfa);})[_0xdbb8('0x19')](function(_0x29ea69){logger['error'](_0xdbb8('0x1a'),_0x29ea69['message'],_0x172786);_0x4b5a99(_0x4e1bcd[_0xdbb8('0x15')](0x1f4,_0x29ea69[_0xdbb8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 4b3abde..8eb574d 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['openchannelMessage:','save','remove','register','length'];(function(_0x3c3249,_0x3fe770){var _0x41931d=function(_0x12b918){while(--_0x12b918){_0x3c3249['push'](_0x3c3249['shift']());}};_0x41931d(++_0x3fe770);}(_0xda3f,0xec));var _0xfda3=function(_0x585df5,_0x2ae955){_0x585df5=_0x585df5-0x0;var _0x1182e7=_0xda3f[_0x585df5];return _0x1182e7;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){OpenchannelMessageEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);OpenchannelMessageEvents['on'](_0x42476a,_0x125e2a);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x238b73,_0x5df76f){var _0x5966d9=function(_0x57802d){while(--_0x57802d){_0x238b73['push'](_0x238b73['shift']());}};_0x5966d9(++_0x5df76f);}(_0xac4a,0x13f));var _0xaac4=function(_0x8e7308,_0x16e723){_0x8e7308=_0x8e7308-0x0;var _0x3fb7b9=_0xac4a[_0x8e7308];return _0x3fb7b9;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e8a658c..79fda93 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 _0xcd59=['Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','update','destroy','removeTeams','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4625ce,_0x55986a){var _0x5d5e26=function(_0x14e834){while(--_0x14e834){_0x4625ce['push'](_0x4625ce['shift']());}};_0x5d5e26(++_0x55986a);}(_0xcd59,0x14b));var _0x9cd5=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0xcd59[_0x180ac2];return _0xfcaede;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9cd5('0x6'));var config=require(_0x9cd5('0x7'));var controller=require(_0x9cd5('0x8'));router[_0x9cd5('0x9')]('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xb')]);router[_0x9cd5('0x9')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xd')]);router['get'](_0x9cd5('0xe'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0x9')](_0x9cd5('0x10'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x11')]);router[_0x9cd5('0x9')]('/:id/teams',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x12')]);router[_0x9cd5('0x9')](_0x9cd5('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9cd5('0x14')]('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x15')]);router[_0x9cd5('0x14')](_0x9cd5('0x16'),auth[_0x9cd5('0xa')](),controller['addTeams']);router[_0x9cd5('0x14')](_0x9cd5('0x13'),auth[_0x9cd5('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x17')]);router['delete'](_0x9cd5('0xe'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x18')]);router['delete'](_0x9cd5('0x16'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x19')]);router[_0x9cd5('0x1a')](_0x9cd5('0x13'),auth[_0x9cd5('0xa')](),controller['removeAgents']);module[_0x9cd5('0x1b')]=router; \ No newline at end of file +var _0xb079=['addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x317578,_0x40e086){var _0x133ffb=function(_0x1a0114){while(--_0x1a0114){_0x317578['push'](_0x317578['shift']());}};_0x133ffb(++_0x40e086);}(_0xb079,0x1c9));var _0x9b07=function(_0x261f83,_0x558694){_0x261f83=_0x261f83-0x0;var _0x112a73=_0xb079[_0x261f83];return _0x112a73;};'use strict';var multer=require('multer');var util=require(_0x9b07('0x0'));var path=require(_0x9b07('0x1'));var timeout=require(_0x9b07('0x2'));var express=require(_0x9b07('0x3'));var router=express[_0x9b07('0x4')]();var auth=require(_0x9b07('0x5'));var interaction=require(_0x9b07('0x6'));var config=require(_0x9b07('0x7'));var controller=require(_0x9b07('0x8'));router[_0x9b07('0x9')]('/',auth[_0x9b07('0xa')](),controller['index']);router[_0x9b07('0x9')](_0x9b07('0xb'),auth['isAuthenticated'](),controller[_0x9b07('0xc')]);router['get']('/:id',auth[_0x9b07('0xa')](),controller[_0x9b07('0xd')]);router[_0x9b07('0x9')](_0x9b07('0xe'),auth['isAuthenticated'](),controller[_0x9b07('0xf')]);router[_0x9b07('0x9')](_0x9b07('0x10'),auth[_0x9b07('0xa')](),controller[_0x9b07('0x11')]);router[_0x9b07('0x9')](_0x9b07('0x12'),auth[_0x9b07('0xa')](),controller[_0x9b07('0x13')]);router[_0x9b07('0x14')]('/',auth[_0x9b07('0xa')](),controller[_0x9b07('0x15')]);router[_0x9b07('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9b07('0x16')]);router[_0x9b07('0x14')](_0x9b07('0x12'),auth[_0x9b07('0xa')](),controller[_0x9b07('0x17')]);router['put'](_0x9b07('0x18'),auth[_0x9b07('0xa')](),controller[_0x9b07('0x19')]);router['delete'](_0x9b07('0x18'),auth[_0x9b07('0xa')](),controller[_0x9b07('0x1a')]);router[_0x9b07('0x1b')](_0x9b07('0x10'),auth[_0x9b07('0xa')](),controller[_0x9b07('0x1c')]);router[_0x9b07('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x9b07('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 69f4e1a..6c384f5 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 _0x0ab9=['roundrobin','sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0x348864,_0x1bbb29){var _0x3fea80=function(_0x2d9999){while(--_0x2d9999){_0x348864['push'](_0x348864['shift']());}};_0x3fea80(++_0x1bbb29);}(_0x0ab9,0x157));var _0x90ab=function(_0x2a01ef,_0x13742e){_0x2a01ef=_0x2a01ef-0x0;var _0x36420b=_0x0ab9[_0x2a01ef];return _0x36420b;};'use strict';var Sequelize=require(_0x90ab('0x0'));module['exports']={'name':{'type':Sequelize[_0x90ab('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x90ab('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x90ab('0x3'),_0x90ab('0x4'),_0x90ab('0x5'))}}; \ No newline at end of file +var _0x44c2=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x6d3638,_0x888b7c){var _0x1a1f02=function(_0x2bc30e){while(--_0x2bc30e){_0x6d3638['push'](_0x6d3638['shift']());}};_0x1a1f02(++_0x888b7c);}(_0x44c2,0x100));var _0x244c=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0x44c2[_0x5e9d35];return _0x3beb2e;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'name':{'type':Sequelize[_0x244c('0x2')],'unique':_0x244c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x244c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x244c('0x5')](_0x244c('0x6'),_0x244c('0x7'),_0x244c('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0dd93af..be522db 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 _0xf07c=['offset','limit','set','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','end','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','show','params','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count'];(function(_0x1e5068,_0x31e9c4){var _0x2230b6=function(_0xaa2ee){while(--_0xaa2ee){_0x1e5068['push'](_0x1e5068['shift']());}};_0x2230b6(++_0x31e9c4);}(_0xf07c,0xfd));var _0xcf07=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xf07c[_0x486f4a];return _0x135d99;};'use strict';var pdf=require(_0xcf07('0x0'));var emlformat=require(_0xcf07('0x1'));var rimraf=require(_0xcf07('0x2'));var zipdir=require(_0xcf07('0x3'));var jsonpatch=require(_0xcf07('0x4'));var rp=require(_0xcf07('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcf07('0x6'));var util=require(_0xcf07('0x7'));var path=require(_0xcf07('0x8'));var sox=require(_0xcf07('0x9'));var csv=require('to-csv');var ejs=require(_0xcf07('0xa'));var fs=require('fs');var _=require(_0xcf07('0xb'));var squel=require(_0xcf07('0xc'));var crypto=require(_0xcf07('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcf07('0xe'));var toCsv=require(_0xcf07('0xf'));var querystring=require(_0xcf07('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcf07('0x11'));var qs=require(_0xcf07('0x12'));var as=require(_0xcf07('0x13'));var hardwareService=require(_0xcf07('0x14'));var logger=require(_0xcf07('0x15'))('api');var utils=require(_0xcf07('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xcf07('0x17')]=_[_0xcf07('0x18')](config[_0xcf07('0x17')],{'host':_0xcf07('0x19'),'port':0x18eb});var socket=require(_0xcf07('0x1a'))(new Redis(config[_0xcf07('0x17')]));require(_0xcf07('0x1b'))[_0xcf07('0x1c')](socket);function respondWithStatusCode(_0x125bcf,_0x5447c9){_0x5447c9=_0x5447c9||0xcc;return function(_0x426010){if(_0x426010){return _0x125bcf[_0xcf07('0x1d')](_0x5447c9);}return _0x125bcf['status'](_0x5447c9)['end']();};}function respondWithResult(_0x4f6c92,_0x4f32aa){_0x4f32aa=_0x4f32aa||0xc8;return function(_0x2273a2){if(_0x2273a2){return _0x4f6c92[_0xcf07('0x1e')](_0x4f32aa)[_0xcf07('0x1f')](_0x2273a2);}};}function respondWithFilteredResult(_0x4c6c68,_0x3f40fb){return function(_0x5b2ad4){if(_0x5b2ad4){var _0x104efe=_0x5b2ad4[_0xcf07('0x20')],_0x3bdb94=_0x3f40fb[_0xcf07('0x21')],_0x30a446=_0x3f40fb[_0xcf07('0x21')]+_0x3f40fb[_0xcf07('0x22')],_0x2c908a;if(_0x30a446>=_0x104efe){_0x30a446=_0x104efe;_0x2c908a=0xc8;}else{_0x2c908a=0xce;}_0x4c6c68[_0xcf07('0x1e')](_0x2c908a);return _0x4c6c68[_0xcf07('0x23')]('Content-Range',_0x3bdb94+'-'+_0x30a446+'/'+_0x104efe)[_0xcf07('0x1f')](_0x5b2ad4);}return null;};}function patchUpdates(_0x35cdea){return function(_0x1b3c4d){try{jsonpatch['apply'](_0x1b3c4d,_0x35cdea,!![]);}catch(_0x48c350){return BPromise[_0xcf07('0x24')](_0x48c350);}return _0x1b3c4d[_0xcf07('0x25')]();};}function saveUpdates(_0x3ddd52,_0x1e232f){return function(_0x52e37e){if(_0x52e37e){return _0x52e37e[_0xcf07('0x26')](_0x3ddd52)[_0xcf07('0x27')](function(_0x4649b0){return _0x4649b0;});}return null;};}function removeEntity(_0x511014,_0x1ecad6){return function(_0xe28507){if(_0xe28507){return _0xe28507[_0xcf07('0x28')]()[_0xcf07('0x27')](function(){var _0x4a6009=_0xe28507['get']({'plain':!![]});var _0x205c52=_0xcf07('0x29');return db[_0xcf07('0x2a')][_0xcf07('0x28')]({'where':{'type':_0x205c52,'resourceId':_0x4a6009['id']}})[_0xcf07('0x27')](function(){return _0xe28507;});})['then'](function(){_0x511014[_0xcf07('0x1e')](0xcc)[_0xcf07('0x2b')]();});}};}function handleEntityNotFound(_0x434516,_0x42813b){return function(_0x4491ec){if(!_0x4491ec){_0x434516[_0xcf07('0x1d')](0x194);}return _0x4491ec;};}function handleError(_0x346cfa,_0x650edd){_0x650edd=_0x650edd||0x1f4;return function(_0x658e47){logger[_0xcf07('0x2c')](_0x658e47[_0xcf07('0x2d')]);if(_0x658e47[_0xcf07('0x2e')]){delete _0x658e47[_0xcf07('0x2e')];}_0x346cfa['status'](_0x650edd)[_0xcf07('0x2f')](_0x658e47);};}exports[_0xcf07('0x30')]=function(_0x21f3a3,_0x295efa){var _0x52b9c9={},_0x35e6fb={},_0x2c0ca8={'count':0x0,'rows':[]};var _0x15bf21=_[_0xcf07('0x31')](db[_0xcf07('0x32')][_0xcf07('0x33')],function(_0x4b0646){return{'name':_0x4b0646['fieldName'],'type':_0x4b0646['type'][_0xcf07('0x34')]};});_0x35e6fb[_0xcf07('0x35')]=_[_0xcf07('0x31')](_0x15bf21,'name');_0x35e6fb[_0xcf07('0x36')]=_[_0xcf07('0x37')](_0x21f3a3[_0xcf07('0x36')]);_0x35e6fb[_0xcf07('0x38')]=_['intersection'](_0x35e6fb[_0xcf07('0x35')],_0x35e6fb[_0xcf07('0x36')]);_0x52b9c9[_0xcf07('0x39')]=_[_0xcf07('0x3a')](_0x35e6fb[_0xcf07('0x35')],qs[_0xcf07('0x3b')](_0x21f3a3[_0xcf07('0x36')]['fields']));_0x52b9c9[_0xcf07('0x39')]=_0x52b9c9[_0xcf07('0x39')]['length']?_0x52b9c9[_0xcf07('0x39')]:_0x35e6fb[_0xcf07('0x35')];if(!_0x21f3a3[_0xcf07('0x36')]['hasOwnProperty'](_0xcf07('0x3c'))){_0x52b9c9['limit']=qs['limit'](_0x21f3a3[_0xcf07('0x36')][_0xcf07('0x22')]);_0x52b9c9['offset']=qs['offset'](_0x21f3a3['query'][_0xcf07('0x21')]);}_0x52b9c9[_0xcf07('0x3d')]=qs[_0xcf07('0x3e')](_0x21f3a3[_0xcf07('0x36')][_0xcf07('0x3e')]);_0x52b9c9[_0xcf07('0x3f')]=qs[_0xcf07('0x38')](_[_0xcf07('0x40')](_0x21f3a3[_0xcf07('0x36')],_0x35e6fb[_0xcf07('0x38')]),_0x15bf21);if(_0x21f3a3[_0xcf07('0x36')][_0xcf07('0x41')]){_0x52b9c9[_0xcf07('0x3f')]=_[_0xcf07('0x42')](_0x52b9c9['where'],{'$or':_[_0xcf07('0x31')](_0x15bf21,function(_0x4ad73d){if(_0x4ad73d[_0xcf07('0x43')]!==_0xcf07('0x44')){var _0x30ad12={};_0x30ad12[_0x4ad73d['name']]={'$like':'%'+_0x21f3a3[_0xcf07('0x36')][_0xcf07('0x41')]+'%'};return _0x30ad12;}})});}_0x52b9c9=_[_0xcf07('0x42')]({},_0x52b9c9,_0x21f3a3[_0xcf07('0x45')]);var _0x448372={'where':_0x52b9c9[_0xcf07('0x3f')]};return db[_0xcf07('0x32')][_0xcf07('0x20')](_0x448372)[_0xcf07('0x27')](function(_0x358abd){_0x2c0ca8[_0xcf07('0x20')]=_0x358abd;if(_0x21f3a3[_0xcf07('0x36')]['includeAll']){_0x52b9c9[_0xcf07('0x46')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x52b9c9);})[_0xcf07('0x27')](function(_0x34da67){_0x2c0ca8[_0xcf07('0x47')]=_0x34da67;return _0x2c0ca8;})[_0xcf07('0x27')](respondWithFilteredResult(_0x295efa,_0x52b9c9))['catch'](handleError(_0x295efa,null));};exports[_0xcf07('0x48')]=function(_0x51b952,_0x5e8acb){var _0x201c30={'raw':!![],'where':{'id':_0x51b952[_0xcf07('0x49')]['id']}},_0x1333c0={};_0x1333c0['model']=_[_0xcf07('0x37')](db[_0xcf07('0x32')][_0xcf07('0x33')]);_0x1333c0[_0xcf07('0x36')]=_[_0xcf07('0x37')](_0x51b952[_0xcf07('0x36')]);_0x1333c0[_0xcf07('0x38')]=_[_0xcf07('0x3a')](_0x1333c0['model'],_0x1333c0[_0xcf07('0x36')]);_0x201c30[_0xcf07('0x39')]=_[_0xcf07('0x3a')](_0x1333c0[_0xcf07('0x35')],qs[_0xcf07('0x3b')](_0x51b952[_0xcf07('0x36')]['fields']));_0x201c30[_0xcf07('0x39')]=_0x201c30[_0xcf07('0x39')][_0xcf07('0x4a')]?_0x201c30[_0xcf07('0x39')]:_0x1333c0[_0xcf07('0x35')];if(_0x51b952[_0xcf07('0x36')]['includeAll']){_0x201c30[_0xcf07('0x46')]=[{'all':!![]}];}_0x201c30=_[_0xcf07('0x42')]({},_0x201c30,_0x51b952[_0xcf07('0x45')]);return db['OpenchannelQueue'][_0xcf07('0x4b')](_0x201c30)[_0xcf07('0x27')](handleEntityNotFound(_0x5e8acb,null))[_0xcf07('0x27')](respondWithResult(_0x5e8acb,null))[_0xcf07('0x4c')](handleError(_0x5e8acb,null));};exports[_0xcf07('0x4d')]=function(_0x583ea5,_0x2497c8){return db['OpenchannelQueue'][_0xcf07('0x4d')](_0x583ea5[_0xcf07('0x4e')],{})[_0xcf07('0x27')](function(_0x1f404e){var _0x1cee5d=_0x583ea5['user'][_0xcf07('0x4f')]({'plain':!![]});if(!_0x1cee5d)throw new Error(_0xcf07('0x50'));if(_0x1cee5d[_0xcf07('0x51')]===_0xcf07('0x52')){var _0x44aa3e=_0x1f404e[_0xcf07('0x4f')]({'plain':!![]});var _0x28c2b3=_0xcf07('0x29');return db['UserProfileSection'][_0xcf07('0x4b')]({'where':{'name':_0x28c2b3,'userProfileId':_0x1cee5d[_0xcf07('0x53')]},'raw':!![]})[_0xcf07('0x27')](function(_0x66d630){if(_0x66d630&&_0x66d630[_0xcf07('0x54')]===0x0){return db['UserProfileResource'][_0xcf07('0x4d')]({'name':_0x44aa3e[_0xcf07('0x2e')],'resourceId':_0x44aa3e['id'],'type':_0x66d630[_0xcf07('0x2e')],'sectionId':_0x66d630['id']},{})[_0xcf07('0x27')](function(){return _0x1f404e;});}else{return _0x1f404e;}})[_0xcf07('0x4c')](function(_0x2ecd9f){logger['error'](_0xcf07('0x55'),_0x2ecd9f);throw _0x2ecd9f;});}return _0x1f404e;})[_0xcf07('0x27')](respondWithResult(_0x2497c8,0xc9))['catch'](handleError(_0x2497c8,null));};exports[_0xcf07('0x26')]=function(_0x3a0979,_0x5447d9){if(_0x3a0979['body']['id']){delete _0x3a0979[_0xcf07('0x4e')]['id'];}return db['OpenchannelQueue'][_0xcf07('0x4b')]({'where':{'id':_0x3a0979[_0xcf07('0x49')]['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0x5447d9,null))['then'](saveUpdates(_0x3a0979[_0xcf07('0x4e')],null))[_0xcf07('0x27')](respondWithResult(_0x5447d9,null))['catch'](handleError(_0x5447d9,null));};exports[_0xcf07('0x28')]=function(_0x1bf285,_0x3ed9b3){return db[_0xcf07('0x32')][_0xcf07('0x4b')]({'where':{'id':_0x1bf285['params']['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0x3ed9b3,null))['then'](removeEntity(_0x3ed9b3,null))[_0xcf07('0x4c')](handleError(_0x3ed9b3,null));};exports[_0xcf07('0x56')]=function(_0x1ace59,_0x4d1d0b){return db[_0xcf07('0x32')]['describe']()[_0xcf07('0x27')](respondWithResult(_0x4d1d0b,null))[_0xcf07('0x4c')](handleError(_0x4d1d0b,null));};exports[_0xcf07('0x57')]=function(_0x2d61d2,_0x41ad18,_0x3c5883){var _0x5d908a={'raw':!![],'where':{}},_0x54dca6={},_0x237418;return db[_0xcf07('0x32')][_0xcf07('0x58')]({'where':{'id':_0x2d61d2['params']['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0x41ad18,null))[_0xcf07('0x27')](function(_0xa6cd20){if(_0xa6cd20){_0x237418=_0xa6cd20[_0xcf07('0x4f')]({'plain':!![]});_0x54dca6['model']=_[_0xcf07('0x37')](db[_0xcf07('0x59')][_0xcf07('0x33')]);_0x54dca6[_0xcf07('0x36')]=_['keys'](_0x2d61d2[_0xcf07('0x36')]);_0x54dca6['filters']=_['intersection'](_0x54dca6[_0xcf07('0x35')],_0x54dca6[_0xcf07('0x36')]);_0x5d908a[_0xcf07('0x39')]=_[_0xcf07('0x3a')](_0x54dca6[_0xcf07('0x35')],qs[_0xcf07('0x3b')](_0x2d61d2['query'][_0xcf07('0x3b')]));_0x5d908a[_0xcf07('0x39')]=_0x5d908a[_0xcf07('0x39')][_0xcf07('0x4a')]?_0x5d908a[_0xcf07('0x39')]:_0x54dca6[_0xcf07('0x35')];if(!_0x2d61d2[_0xcf07('0x36')]['hasOwnProperty'](_0xcf07('0x3c'))){_0x5d908a[_0xcf07('0x22')]=qs[_0xcf07('0x22')](_0x2d61d2['query'][_0xcf07('0x22')]);_0x5d908a[_0xcf07('0x21')]=qs[_0xcf07('0x21')](_0x2d61d2[_0xcf07('0x36')][_0xcf07('0x21')]);}_0x5d908a[_0xcf07('0x3d')]=qs[_0xcf07('0x3e')](_0x2d61d2[_0xcf07('0x36')][_0xcf07('0x3e')]);_0x5d908a[_0xcf07('0x3f')]=qs[_0xcf07('0x38')](_[_0xcf07('0x40')](_0x2d61d2[_0xcf07('0x36')],_0x54dca6[_0xcf07('0x38')]));_0x5d908a[_0xcf07('0x3f')][_0xcf07('0x5a')]=_0xa6cd20['id'];if(_0x2d61d2[_0xcf07('0x36')]['filter']){_0x5d908a[_0xcf07('0x3f')]=_[_0xcf07('0x42')](_0x5d908a[_0xcf07('0x3f')],{'$or':_['map'](_0x5d908a['attributes'],function(_0x341ba5){var _0x10ba6c={};_0x10ba6c[_0x341ba5]={'$like':'%'+_0x2d61d2['query']['filter']+'%'};return _0x10ba6c;})});}_0x5d908a=_['merge']({},_0x5d908a,_0x2d61d2[_0xcf07('0x45')]);return db['UserOpenchannelQueue'][_0xcf07('0x5b')](_0x5d908a);}})[_0xcf07('0x27')](function(_0x4769c3){if(_0x4769c3){return db[_0xcf07('0x5c')][_0xcf07('0x5d')]({'where':{'id':_[_0xcf07('0x31')](_0x4769c3,_0xcf07('0x5e')),'role':_0xcf07('0x5f')},'attributes':['id',_0xcf07('0x2e'),_0xcf07('0x60'),_0xcf07('0x61'),_0xcf07('0x62')]});}})[_0xcf07('0x27')](function(_0x10163a){if(_0x10163a){return{'count':_0x10163a['count'],'rows':_['map'](_0x10163a['rows'],function(_0x1a0536){return{'membername':_0x1a0536[_0xcf07('0x2e')],'UserId':_0x1a0536['id'],'queue_name':_0x237418[_0xcf07('0x2e')],'OpenchannelQueueId':_0x237418['id'],'interface':util['format'](_0xcf07('0x63'),'SIP',_0x1a0536['name']),'penalty':0x0,'paused':_0x1a0536[_0xcf07('0x60')],'createdAt':_0x1a0536[_0xcf07('0x62')],'updatedAt':_0x1a0536['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcf07('0x27')](respondWithFilteredResult(_0x41ad18,_0x5d908a))['catch'](handleError(_0x41ad18,null));};exports[_0xcf07('0x64')]=function(_0x3d9db6,_0x221472,_0x1ddaa6){var _0x2485d0={};var _0x286a29={};var _0x4770f6;var _0x542bec;return db['OpenchannelQueue'][_0xcf07('0x58')]({'where':{'id':_0x3d9db6[_0xcf07('0x49')]['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0x221472,null))[_0xcf07('0x27')](function(_0x10284a){if(_0x10284a){_0x4770f6=_0x10284a;_0x286a29[_0xcf07('0x35')]=_[_0xcf07('0x37')](db[_0xcf07('0x65')][_0xcf07('0x33')]);_0x286a29['query']=_[_0xcf07('0x37')](_0x3d9db6[_0xcf07('0x36')]);_0x286a29['filters']=_['intersection'](_0x286a29['model'],_0x286a29['query']);_0x2485d0[_0xcf07('0x39')]=_[_0xcf07('0x3a')](_0x286a29[_0xcf07('0x35')],qs[_0xcf07('0x3b')](_0x3d9db6[_0xcf07('0x36')][_0xcf07('0x3b')]));_0x2485d0[_0xcf07('0x39')]=_0x2485d0[_0xcf07('0x39')]['length']?_0x2485d0[_0xcf07('0x39')]:_0x286a29[_0xcf07('0x35')];_0x2485d0[_0xcf07('0x3d')]=qs[_0xcf07('0x3e')](_0x3d9db6[_0xcf07('0x36')][_0xcf07('0x3e')]);_0x2485d0[_0xcf07('0x3f')]=qs['filters'](_[_0xcf07('0x40')](_0x3d9db6[_0xcf07('0x36')],_0x286a29[_0xcf07('0x38')]));if(_0x3d9db6[_0xcf07('0x36')][_0xcf07('0x41')]){_0x2485d0[_0xcf07('0x3f')]=_['merge'](_0x2485d0['where'],{'$or':_[_0xcf07('0x31')](_0x2485d0[_0xcf07('0x39')],function(_0x1afee2){var _0x2db704={};_0x2db704[_0x1afee2]={'$like':'%'+_0x3d9db6[_0xcf07('0x36')][_0xcf07('0x41')]+'%'};return _0x2db704;})});}_0x2485d0=_['merge']({},_0x2485d0,_0x3d9db6[_0xcf07('0x45')]);return _0x4770f6[_0xcf07('0x64')](_0x2485d0);}})[_0xcf07('0x27')](function(_0x2c2dfa){if(_0x2c2dfa){_0x542bec=_0x2c2dfa[_0xcf07('0x4a')];if(!_0x3d9db6[_0xcf07('0x36')]['hasOwnProperty'](_0xcf07('0x3c'))){_0x2485d0['limit']=qs[_0xcf07('0x22')](_0x3d9db6[_0xcf07('0x36')][_0xcf07('0x22')]);_0x2485d0[_0xcf07('0x21')]=qs[_0xcf07('0x21')](_0x3d9db6[_0xcf07('0x36')][_0xcf07('0x21')]);}return _0x4770f6['getTeams'](_0x2485d0);}})[_0xcf07('0x27')](function(_0xc1ec80){if(_0xc1ec80){return _0xc1ec80?{'count':_0x542bec,'rows':_0xc1ec80}:null;}})['then'](respondWithResult(_0x221472,null))[_0xcf07('0x4c')](handleError(_0x221472,null));};exports['addTeams']=function(_0x486653,_0x578ab1,_0x55903c){var _0x3dc0c9=_0x486653[_0xcf07('0x4e')][_0xcf07('0x66')];return db[_0xcf07('0x65')]['findAll']({'where':{'id':_0x3dc0c9},'attributes':['id'],'include':[{'model':db[_0xcf07('0x5c')],'as':_0xcf07('0x67'),'attributes':['id','name','online',_0xcf07('0x68'),_0xcf07('0x69')],'raw':!![]}]})[_0xcf07('0x27')](function(_0x1a4579){if(_0x1a4579){var _0x59e9d7=_[_0xcf07('0x6a')](_0x1a4579,function(_0x53f4f2){var _0x5a87dd=_0x53f4f2[_0xcf07('0x4f')]({'plain':!![]});return _0x5a87dd[_0xcf07('0x67')];});return db[_0xcf07('0x32')][_0xcf07('0x4b')]({'where':{'id':_0x486653[_0xcf07('0x49')]['id']}})[_0xcf07('0x27')](function(_0x38babb){return db[_0xcf07('0x6b')][_0xcf07('0x6c')](function(_0x3772bb){return _0x38babb[_0xcf07('0x6d')](_0x3dc0c9,{'transaction':_0x3772bb})[_0xcf07('0x27')](function(){return BPromise['each'](_0x59e9d7,function(_0x49fd50){return db['UserOpenchannelQueue'][_0xcf07('0x6e')]({'where':{'UserId':_0x49fd50['id'],'OpenchannelQueueId':_0x486653[_0xcf07('0x49')]['id']},'transaction':_0x3772bb});});})[_0xcf07('0x27')](function(){_0x59e9d7[_0xcf07('0x6f')](function(_0x41908a){socket[_0xcf07('0x70')](_0xcf07('0x71'),{'UserId':_0x41908a['id'],'OpenchannelQueueId':_0x38babb['id']});});});});});}})['then'](respondWithStatusCode(_0x578ab1,null))[_0xcf07('0x4c')](handleError(_0x578ab1,null));};exports['removeTeams']=function(_0x1e988d,_0x1a5e48,_0x4757c7){return db[_0xcf07('0x65')][_0xcf07('0x5b')]({'where':{'id':_0x1e988d[_0xcf07('0x36')][_0xcf07('0x66')]},'attributes':['id'],'include':[{'model':db[_0xcf07('0x5c')],'as':_0xcf07('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1a5e48,null))[_0xcf07('0x27')](function(_0x54aff3){var _0x4e918a=_['map'](_0x54aff3,'id');var _0x35535c=[];var _0x303eff=[];var _0x8373ca=squel[_0xcf07('0x72')]();_0x8373ca[_0xcf07('0x73')](_0xcf07('0x74'))[_0xcf07('0x75')](_0xcf07('0x76'),'tq')[_0xcf07('0x77')](_0xcf07('0x78'),'ut',_0xcf07('0x79'))[_0xcf07('0x3f')](_0xcf07('0x7a'),_0x1e988d[_0xcf07('0x49')]['id']);for(var _0x2492be=0x0;_0x2492be<_0x54aff3['length'];_0x2492be+=0x1){let _0x1d1864=_0x54aff3[_0x2492be];for(var _0x2276a5=0x0;_0x2276a5<_0x1d1864[_0xcf07('0x67')][_0xcf07('0x4a')];_0x2276a5+=0x1){let _0x2e3539=_0x1d1864['Agents'][_0x2276a5];var _0x92a9ee=_0x8373ca[_0xcf07('0x7b')]();_0x92a9ee[_0xcf07('0x3f')](_0xcf07('0x7c'),_0x2e3539['id']);_0x303eff[_0xcf07('0x7d')](db[_0xcf07('0x6b')][_0xcf07('0x36')](_0x92a9ee[_0xcf07('0x7e')](),{'type':db[_0xcf07('0x6b')][_0xcf07('0x7f')]['SELECT']})[_0xcf07('0x27')](function(_0x1ff0b3){if(_0x1ff0b3['length']===0x1){return _0x2e3539['id'];}else{var _0x4cb5fe=_[_0xcf07('0x80')](_['map'](_0x1ff0b3,'TeamId'),function(_0x3df868){return _[_0xcf07('0x81')](_0x4e918a,_0x3df868);});if(_0x4cb5fe){return _0x2e3539['id'];}}}));}}return BPromise[_0xcf07('0x82')](_0x303eff)[_0xcf07('0x27')](function(_0x39decc){_0x35535c=_(_0x35535c)[_0xcf07('0x83')](_0x39decc)[_0xcf07('0x84')]()[_0xcf07('0x85')]();return db[_0xcf07('0x32')][_0xcf07('0x4b')]({'where':{'id':_0x1e988d['params']['id']}})[_0xcf07('0x27')](function(_0x33df37){return db[_0xcf07('0x6b')][_0xcf07('0x6c')](function(_0x5b1886){return _0x33df37[_0xcf07('0x86')](_0x1e988d['query'][_0xcf07('0x66')],{'transaction':_0x5b1886})['then'](function(){if(!_[_0xcf07('0x87')](_0x35535c)){return _0x33df37[_0xcf07('0x88')](_0x35535c,{'transaction':_0x5b1886});}})[_0xcf07('0x27')](function(){_0x35535c['forEach'](function(_0xd3c725){socket[_0xcf07('0x70')](_0xcf07('0x89'),{'UserId':_0xd3c725,'OpenchannelQueueId':_0x33df37['id']});});});});});});})[_0xcf07('0x27')](respondWithStatusCode(_0x1a5e48,null))[_0xcf07('0x4c')](handleError(_0x1a5e48,null));};exports[_0xcf07('0x8a')]=function(_0x590404,_0xffcdba,_0x5b660c){return db['OpenchannelQueue'][_0xcf07('0x4b')]({'where':{'id':_0x590404[_0xcf07('0x49')]['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0xffcdba,null))[_0xcf07('0x27')](function(_0x1cdb3c){if(_0x1cdb3c){return _0x1cdb3c[_0xcf07('0x8a')](_0x590404['body'][_0xcf07('0x66')],_['omit'](_0x590404[_0xcf07('0x4e')],[_0xcf07('0x66'),'id'])||{})[_0xcf07('0x8b')](function(_0x1e2856){for(var _0x25f1a5=0x0;_0x25f1a5<_0x590404[_0xcf07('0x4e')][_0xcf07('0x66')][_0xcf07('0x4a')];_0x25f1a5+=0x1){socket[_0xcf07('0x70')](_0xcf07('0x71'),{'UserId':_0x590404[_0xcf07('0x4e')][_0xcf07('0x66')][_0x25f1a5],'OpenchannelQueueId':_0x590404['params']['id']});}return _0x1e2856;});}})[_0xcf07('0x27')](respondWithResult(_0xffcdba,null))[_0xcf07('0x4c')](handleError(_0xffcdba,null));};exports[_0xcf07('0x88')]=function(_0x26231e,_0x28ad82,_0x25ec12){return db[_0xcf07('0x32')][_0xcf07('0x4b')]({'where':{'id':_0x26231e['params']['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0x28ad82,null))[_0xcf07('0x27')](function(_0x462f48){if(_0x462f48){return _0x462f48['removeAgents'](_0x26231e['query']['ids'])[_0xcf07('0x27')](function(){if(_[_0xcf07('0x8c')](_0x26231e[_0xcf07('0x36')][_0xcf07('0x66')])){for(var _0x737c41=0x0;_0x737c41<_0x26231e[_0xcf07('0x36')][_0xcf07('0x66')]['length'];_0x737c41+=0x1){socket[_0xcf07('0x70')](_0xcf07('0x89'),{'UserId':Number(_0x26231e[_0xcf07('0x36')]['ids'][_0x737c41]),'OpenchannelQueueId':Number(_0x26231e[_0xcf07('0x49')]['id'])});}}else{socket[_0xcf07('0x70')](_0xcf07('0x89'),{'UserId':Number(_0x26231e[_0xcf07('0x36')][_0xcf07('0x66')]),'OpenchannelQueueId':Number(_0x26231e['params']['id'])});}});}})[_0xcf07('0x27')](respondWithStatusCode(_0x28ad82,null))['catch'](handleError(_0x28ad82,null));};exports[_0xcf07('0x8d')]=function(_0xfd015,_0x4a4bff,_0x2870ed){var _0x195a08={};var _0x4990bf={};var _0x2f29c7;var _0x2f1c0f;return db[_0xcf07('0x32')][_0xcf07('0x58')]({'where':{'id':_0xfd015[_0xcf07('0x49')]['id']}})[_0xcf07('0x27')](handleEntityNotFound(_0x4a4bff,null))[_0xcf07('0x27')](function(_0x5864b8){if(_0x5864b8){_0x2f29c7=_0x5864b8;_0x4990bf[_0xcf07('0x35')]=_[_0xcf07('0x37')](db[_0xcf07('0x5c')]['rawAttributes']);_0x4990bf[_0xcf07('0x36')]=_[_0xcf07('0x37')](_0xfd015['query']);_0x4990bf[_0xcf07('0x38')]=_[_0xcf07('0x3a')](_0x4990bf[_0xcf07('0x35')],_0x4990bf[_0xcf07('0x36')]);_0x195a08[_0xcf07('0x39')]=_[_0xcf07('0x3a')](_0x4990bf[_0xcf07('0x35')],qs[_0xcf07('0x3b')](_0xfd015[_0xcf07('0x36')][_0xcf07('0x3b')]));_0x195a08['attributes']=_0x195a08[_0xcf07('0x39')][_0xcf07('0x4a')]?_0x195a08['attributes']:_0x4990bf['model'];_0x195a08[_0xcf07('0x3d')]=qs['sort'](_0xfd015['query'][_0xcf07('0x3e')]);_0x195a08[_0xcf07('0x3f')]=qs[_0xcf07('0x38')](_['pick'](_0xfd015[_0xcf07('0x36')],_0x4990bf[_0xcf07('0x38')]));if(_0xfd015[_0xcf07('0x36')]['filter']){_0x195a08[_0xcf07('0x3f')]=_[_0xcf07('0x42')](_0x195a08[_0xcf07('0x3f')],{'$or':_[_0xcf07('0x31')](_0x195a08[_0xcf07('0x39')],function(_0x4c4a2e){var _0xd4497d={};_0xd4497d[_0x4c4a2e]={'$like':'%'+_0xfd015[_0xcf07('0x36')]['filter']+'%'};return _0xd4497d;})});}_0x195a08=_['merge']({},_0x195a08,_0xfd015[_0xcf07('0x45')]);return _0x2f29c7[_0xcf07('0x8d')](_0x195a08);}})[_0xcf07('0x27')](function(_0x369ae3){if(_0x369ae3){_0x2f1c0f=_0x369ae3[_0xcf07('0x4a')];if(!_0xfd015[_0xcf07('0x36')][_0xcf07('0x8e')](_0xcf07('0x3c'))){_0x195a08['limit']=qs['limit'](_0xfd015[_0xcf07('0x36')]['limit']);_0x195a08[_0xcf07('0x21')]=qs[_0xcf07('0x21')](_0xfd015['query'][_0xcf07('0x21')]);}return _0x2f29c7[_0xcf07('0x8d')](_0x195a08);}})[_0xcf07('0x27')](function(_0x193bb2){if(_0x193bb2){return _0x193bb2?{'count':_0x2f1c0f,'rows':_0x193bb2}:null;}})[_0xcf07('0x27')](respondWithResult(_0x4a4bff,null))[_0xcf07('0x4c')](handleError(_0x4a4bff,null));}; \ No newline at end of file +var _0x4539=['findAll','rows','catch','show','params','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','order','pick','filter','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','toString','QueryTypes','SELECT','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','OpenchannelQueues','UserProfileResource','destroy','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x1f834f,_0x41875f){var _0x4d6901=function(_0x1f4e25){while(--_0x1f4e25){_0x1f834f['push'](_0x1f834f['shift']());}};_0x4d6901(++_0x41875f);}(_0x4539,0xce));var _0x9453=function(_0x288f37,_0x16b3d7){_0x288f37=_0x288f37-0x0;var _0x3e7934=_0x4539[_0x288f37];return _0x3e7934;};'use strict';var pdf=require(_0x9453('0x0'));var emlformat=require(_0x9453('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9453('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9453('0x3'));var moment=require(_0x9453('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9453('0x5'));var util=require(_0x9453('0x6'));var path=require(_0x9453('0x7'));var sox=require(_0x9453('0x8'));var csv=require(_0x9453('0x9'));var ejs=require(_0x9453('0xa'));var fs=require('fs');var _=require(_0x9453('0xb'));var squel=require(_0x9453('0xc'));var crypto=require(_0x9453('0xd'));var jsforce=require(_0x9453('0xe'));var deskjs=require(_0x9453('0xf'));var toCsv=require(_0x9453('0x9'));var querystring=require(_0x9453('0x10'));var Papa=require('papaparse');var Redis=require(_0x9453('0x11'));var authService=require(_0x9453('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9453('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9453('0x14'))(_0x9453('0x15'));var utils=require('../../config/utils');var config=require(_0x9453('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9453('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9453('0x18'))(new Redis(config['redis']));require(_0x9453('0x19'))[_0x9453('0x1a')](socket);function respondWithStatusCode(_0x230c7e,_0x3f9cc5){_0x3f9cc5=_0x3f9cc5||0xcc;return function(_0x4af97a){if(_0x4af97a){return _0x230c7e[_0x9453('0x1b')](_0x3f9cc5);}return _0x230c7e['status'](_0x3f9cc5)[_0x9453('0x1c')]();};}function respondWithResult(_0x548e1d,_0x15dabe){_0x15dabe=_0x15dabe||0xc8;return function(_0x1783a7){if(_0x1783a7){return _0x548e1d[_0x9453('0x1d')](_0x15dabe)[_0x9453('0x1e')](_0x1783a7);}};}function respondWithFilteredResult(_0x4d7de2,_0x2903b2){return function(_0x5f5023){if(_0x5f5023){var _0x535a4e=_0x5f5023[_0x9453('0x1f')],_0xd79ac3=_0x2903b2[_0x9453('0x20')],_0x127611=_0x2903b2[_0x9453('0x20')]+_0x2903b2['limit'],_0x212413;if(_0x127611>=_0x535a4e){_0x127611=_0x535a4e;_0x212413=0xc8;}else{_0x212413=0xce;}_0x4d7de2[_0x9453('0x1d')](_0x212413);return _0x4d7de2[_0x9453('0x21')](_0x9453('0x22'),_0xd79ac3+'-'+_0x127611+'/'+_0x535a4e)['json'](_0x5f5023);}return null;};}function patchUpdates(_0x4b71fc){return function(_0x50e776){try{jsonpatch[_0x9453('0x23')](_0x50e776,_0x4b71fc,!![]);}catch(_0x5e61df){return BPromise['reject'](_0x5e61df);}return _0x50e776[_0x9453('0x24')]();};}function saveUpdates(_0x5d586d,_0x131864){return function(_0x97f4fb){if(_0x97f4fb){return _0x97f4fb[_0x9453('0x25')](_0x5d586d)['then'](function(_0x31d010){return _0x31d010;});}return null;};}function removeEntity(_0x1ab67b,_0x19b89e){return function(_0x3b0b3e){if(_0x3b0b3e){return _0x3b0b3e['destroy']()[_0x9453('0x26')](function(){var _0x4121d9=_0x3b0b3e['get']({'plain':!![]});var _0x42edcd=_0x9453('0x27');return db[_0x9453('0x28')][_0x9453('0x29')]({'where':{'type':_0x42edcd,'resourceId':_0x4121d9['id']}})[_0x9453('0x26')](function(){return _0x3b0b3e;});})[_0x9453('0x26')](function(){_0x1ab67b[_0x9453('0x1d')](0xcc)[_0x9453('0x1c')]();});}};}function handleEntityNotFound(_0x538f16,_0x9ed7){return function(_0x3084f2){if(!_0x3084f2){_0x538f16['sendStatus'](0x194);}return _0x3084f2;};}function handleError(_0x1df55f,_0x5e5076){_0x5e5076=_0x5e5076||0x1f4;return function(_0x46b4b1){logger['error'](_0x46b4b1[_0x9453('0x2a')]);if(_0x46b4b1[_0x9453('0x2b')]){delete _0x46b4b1['name'];}_0x1df55f[_0x9453('0x1d')](_0x5e5076)[_0x9453('0x2c')](_0x46b4b1);};}exports[_0x9453('0x2d')]=function(_0x40f128,_0x550bcd){var _0x2a4ebb={},_0x370327={},_0x19daef={'count':0x0,'rows':[]};var _0x535cc0=_[_0x9453('0x2e')](db[_0x9453('0x2f')][_0x9453('0x30')],function(_0x40f873){return{'name':_0x40f873[_0x9453('0x31')],'type':_0x40f873[_0x9453('0x32')][_0x9453('0x33')]};});_0x370327[_0x9453('0x34')]=_[_0x9453('0x2e')](_0x535cc0,_0x9453('0x2b'));_0x370327[_0x9453('0x35')]=_[_0x9453('0x36')](_0x40f128['query']);_0x370327[_0x9453('0x37')]=_[_0x9453('0x38')](_0x370327[_0x9453('0x34')],_0x370327[_0x9453('0x35')]);_0x2a4ebb[_0x9453('0x39')]=_[_0x9453('0x38')](_0x370327[_0x9453('0x34')],qs['fields'](_0x40f128[_0x9453('0x35')]['fields']));_0x2a4ebb['attributes']=_0x2a4ebb['attributes'][_0x9453('0x3a')]?_0x2a4ebb[_0x9453('0x39')]:_0x370327['model'];if(!_0x40f128[_0x9453('0x35')][_0x9453('0x3b')]('nolimit')){_0x2a4ebb[_0x9453('0x3c')]=qs[_0x9453('0x3c')](_0x40f128['query'][_0x9453('0x3c')]);_0x2a4ebb[_0x9453('0x20')]=qs[_0x9453('0x20')](_0x40f128[_0x9453('0x35')][_0x9453('0x20')]);}_0x2a4ebb['order']=qs[_0x9453('0x3d')](_0x40f128[_0x9453('0x35')][_0x9453('0x3d')]);_0x2a4ebb[_0x9453('0x3e')]=qs[_0x9453('0x37')](_['pick'](_0x40f128[_0x9453('0x35')],_0x370327[_0x9453('0x37')]),_0x535cc0);if(_0x40f128[_0x9453('0x35')]['filter']){_0x2a4ebb['where']=_['merge'](_0x2a4ebb['where'],{'$or':_[_0x9453('0x2e')](_0x535cc0,function(_0xa89b56){if(_0xa89b56[_0x9453('0x32')]!==_0x9453('0x3f')){var _0x3e9909={};_0x3e9909[_0xa89b56['name']]={'$like':'%'+_0x40f128[_0x9453('0x35')]['filter']+'%'};return _0x3e9909;}})});}_0x2a4ebb=_[_0x9453('0x40')]({},_0x2a4ebb,_0x40f128[_0x9453('0x41')]);var _0x187f84={'where':_0x2a4ebb[_0x9453('0x3e')]};return db[_0x9453('0x2f')][_0x9453('0x1f')](_0x187f84)[_0x9453('0x26')](function(_0x5890e7){_0x19daef['count']=_0x5890e7;if(_0x40f128['query'][_0x9453('0x42')]){_0x2a4ebb[_0x9453('0x43')]=[{'all':!![]}];}return db[_0x9453('0x2f')][_0x9453('0x44')](_0x2a4ebb);})[_0x9453('0x26')](function(_0x59df7d){_0x19daef[_0x9453('0x45')]=_0x59df7d;return _0x19daef;})[_0x9453('0x26')](respondWithFilteredResult(_0x550bcd,_0x2a4ebb))[_0x9453('0x46')](handleError(_0x550bcd,null));};exports[_0x9453('0x47')]=function(_0x49b479,_0x53476a){var _0x1b5615={'raw':!![],'where':{'id':_0x49b479[_0x9453('0x48')]['id']}},_0x1ac548={};_0x1ac548[_0x9453('0x34')]=_[_0x9453('0x36')](db[_0x9453('0x2f')][_0x9453('0x30')]);_0x1ac548[_0x9453('0x35')]=_[_0x9453('0x36')](_0x49b479[_0x9453('0x35')]);_0x1ac548['filters']=_[_0x9453('0x38')](_0x1ac548[_0x9453('0x34')],_0x1ac548['query']);_0x1b5615[_0x9453('0x39')]=_[_0x9453('0x38')](_0x1ac548[_0x9453('0x34')],qs[_0x9453('0x49')](_0x49b479[_0x9453('0x35')]['fields']));_0x1b5615[_0x9453('0x39')]=_0x1b5615[_0x9453('0x39')][_0x9453('0x3a')]?_0x1b5615[_0x9453('0x39')]:_0x1ac548[_0x9453('0x34')];if(_0x49b479[_0x9453('0x35')][_0x9453('0x42')]){_0x1b5615[_0x9453('0x43')]=[{'all':!![]}];}_0x1b5615=_[_0x9453('0x40')]({},_0x1b5615,_0x49b479['options']);return db[_0x9453('0x2f')][_0x9453('0x4a')](_0x1b5615)['then'](handleEntityNotFound(_0x53476a,null))[_0x9453('0x26')](respondWithResult(_0x53476a,null))[_0x9453('0x46')](handleError(_0x53476a,null));};exports[_0x9453('0x4b')]=function(_0x559bcb,_0x40e157){return db[_0x9453('0x2f')][_0x9453('0x4b')](_0x559bcb[_0x9453('0x4c')],{})[_0x9453('0x26')](function(_0xfc415b){var _0x10fe42=_0x559bcb['user'][_0x9453('0x4d')]({'plain':!![]});if(!_0x10fe42)throw new Error(_0x9453('0x4e'));if(_0x10fe42[_0x9453('0x4f')]==='user'){var _0x41f0b2=_0xfc415b[_0x9453('0x4d')]({'plain':!![]});var _0x441031='OpenchannelQueues';return db[_0x9453('0x50')][_0x9453('0x4a')]({'where':{'name':_0x441031,'userProfileId':_0x10fe42[_0x9453('0x51')]},'raw':!![]})[_0x9453('0x26')](function(_0x417ac4){if(_0x417ac4&&_0x417ac4[_0x9453('0x52')]===0x0){return db[_0x9453('0x28')][_0x9453('0x4b')]({'name':_0x41f0b2[_0x9453('0x2b')],'resourceId':_0x41f0b2['id'],'type':_0x417ac4[_0x9453('0x2b')],'sectionId':_0x417ac4['id']},{})[_0x9453('0x26')](function(){return _0xfc415b;});}else{return _0xfc415b;}})[_0x9453('0x46')](function(_0x5ba4f9){logger['error'](_0x9453('0x53'),_0x5ba4f9);throw _0x5ba4f9;});}return _0xfc415b;})[_0x9453('0x26')](respondWithResult(_0x40e157,0xc9))[_0x9453('0x46')](handleError(_0x40e157,null));};exports['update']=function(_0x61887c,_0xd6c2b0){if(_0x61887c[_0x9453('0x4c')]['id']){delete _0x61887c['body']['id'];}return db['OpenchannelQueue'][_0x9453('0x4a')]({'where':{'id':_0x61887c[_0x9453('0x48')]['id']}})['then'](handleEntityNotFound(_0xd6c2b0,null))[_0x9453('0x26')](saveUpdates(_0x61887c[_0x9453('0x4c')],null))[_0x9453('0x26')](respondWithResult(_0xd6c2b0,null))['catch'](handleError(_0xd6c2b0,null));};exports[_0x9453('0x29')]=function(_0x1439b0,_0x28eb51){return db['OpenchannelQueue'][_0x9453('0x4a')]({'where':{'id':_0x1439b0[_0x9453('0x48')]['id']}})[_0x9453('0x26')](handleEntityNotFound(_0x28eb51,null))[_0x9453('0x26')](removeEntity(_0x28eb51,null))['catch'](handleError(_0x28eb51,null));};exports[_0x9453('0x54')]=function(_0x1f56f9,_0x1834f5){return db[_0x9453('0x2f')][_0x9453('0x54')]()[_0x9453('0x26')](respondWithResult(_0x1834f5,null))[_0x9453('0x46')](handleError(_0x1834f5,null));};exports[_0x9453('0x55')]=function(_0x3398cc,_0x24383c,_0x335392){var _0x104746={'raw':!![],'where':{}},_0x482650={},_0x29fc07;return db[_0x9453('0x2f')][_0x9453('0x56')]({'where':{'id':_0x3398cc['params']['id']}})['then'](handleEntityNotFound(_0x24383c,null))[_0x9453('0x26')](function(_0x5d54bc){if(_0x5d54bc){_0x29fc07=_0x5d54bc['get']({'plain':!![]});_0x482650['model']=_[_0x9453('0x36')](db[_0x9453('0x57')][_0x9453('0x30')]);_0x482650[_0x9453('0x35')]=_[_0x9453('0x36')](_0x3398cc['query']);_0x482650[_0x9453('0x37')]=_[_0x9453('0x38')](_0x482650[_0x9453('0x34')],_0x482650['query']);_0x104746[_0x9453('0x39')]=_[_0x9453('0x38')](_0x482650[_0x9453('0x34')],qs[_0x9453('0x49')](_0x3398cc['query'][_0x9453('0x49')]));_0x104746[_0x9453('0x39')]=_0x104746['attributes']['length']?_0x104746['attributes']:_0x482650[_0x9453('0x34')];if(!_0x3398cc[_0x9453('0x35')][_0x9453('0x3b')]('nolimit')){_0x104746[_0x9453('0x3c')]=qs[_0x9453('0x3c')](_0x3398cc['query'][_0x9453('0x3c')]);_0x104746[_0x9453('0x20')]=qs[_0x9453('0x20')](_0x3398cc[_0x9453('0x35')]['offset']);}_0x104746[_0x9453('0x58')]=qs[_0x9453('0x3d')](_0x3398cc[_0x9453('0x35')][_0x9453('0x3d')]);_0x104746['where']=qs[_0x9453('0x37')](_[_0x9453('0x59')](_0x3398cc[_0x9453('0x35')],_0x482650['filters']));_0x104746['where']['OpenchannelQueueId']=_0x5d54bc['id'];if(_0x3398cc[_0x9453('0x35')][_0x9453('0x5a')]){_0x104746[_0x9453('0x3e')]=_[_0x9453('0x40')](_0x104746[_0x9453('0x3e')],{'$or':_[_0x9453('0x2e')](_0x104746[_0x9453('0x39')],function(_0x41e619){var _0x2d8f4b={};_0x2d8f4b[_0x41e619]={'$like':'%'+_0x3398cc['query']['filter']+'%'};return _0x2d8f4b;})});}_0x104746=_['merge']({},_0x104746,_0x3398cc[_0x9453('0x41')]);return db['UserOpenchannelQueue'][_0x9453('0x44')](_0x104746);}})[_0x9453('0x26')](function(_0x1eb626){if(_0x1eb626){return db[_0x9453('0x5b')][_0x9453('0x5c')]({'where':{'id':_[_0x9453('0x2e')](_0x1eb626,_0x9453('0x5d')),'role':_0x9453('0x5e')},'attributes':['id',_0x9453('0x2b'),_0x9453('0x5f'),'updatedAt',_0x9453('0x60')]});}})['then'](function(_0x5f39c9){if(_0x5f39c9){return{'count':_0x5f39c9[_0x9453('0x1f')],'rows':_[_0x9453('0x2e')](_0x5f39c9[_0x9453('0x45')],function(_0x25dc1e){return{'membername':_0x25dc1e[_0x9453('0x2b')],'UserId':_0x25dc1e['id'],'queue_name':_0x29fc07[_0x9453('0x2b')],'OpenchannelQueueId':_0x29fc07['id'],'interface':util[_0x9453('0x61')](_0x9453('0x62'),_0x9453('0x63'),_0x25dc1e[_0x9453('0x2b')]),'penalty':0x0,'paused':_0x25dc1e[_0x9453('0x5f')],'createdAt':_0x25dc1e[_0x9453('0x60')],'updatedAt':_0x25dc1e[_0x9453('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9453('0x26')](respondWithFilteredResult(_0x24383c,_0x104746))[_0x9453('0x46')](handleError(_0x24383c,null));};exports[_0x9453('0x65')]=function(_0x3e5e21,_0x574478,_0x875ce){var _0x55d2a7={};var _0x386d5a={};var _0x2fd644;var _0x59d7b1;return db[_0x9453('0x2f')][_0x9453('0x56')]({'where':{'id':_0x3e5e21['params']['id']}})['then'](handleEntityNotFound(_0x574478,null))[_0x9453('0x26')](function(_0xde9645){if(_0xde9645){_0x2fd644=_0xde9645;_0x386d5a[_0x9453('0x34')]=_[_0x9453('0x36')](db[_0x9453('0x66')][_0x9453('0x30')]);_0x386d5a['query']=_[_0x9453('0x36')](_0x3e5e21[_0x9453('0x35')]);_0x386d5a[_0x9453('0x37')]=_['intersection'](_0x386d5a[_0x9453('0x34')],_0x386d5a[_0x9453('0x35')]);_0x55d2a7[_0x9453('0x39')]=_[_0x9453('0x38')](_0x386d5a[_0x9453('0x34')],qs['fields'](_0x3e5e21[_0x9453('0x35')]['fields']));_0x55d2a7['attributes']=_0x55d2a7['attributes']['length']?_0x55d2a7[_0x9453('0x39')]:_0x386d5a[_0x9453('0x34')];_0x55d2a7[_0x9453('0x58')]=qs['sort'](_0x3e5e21[_0x9453('0x35')][_0x9453('0x3d')]);_0x55d2a7[_0x9453('0x3e')]=qs[_0x9453('0x37')](_[_0x9453('0x59')](_0x3e5e21[_0x9453('0x35')],_0x386d5a[_0x9453('0x37')]));if(_0x3e5e21[_0x9453('0x35')]['filter']){_0x55d2a7[_0x9453('0x3e')]=_[_0x9453('0x40')](_0x55d2a7[_0x9453('0x3e')],{'$or':_[_0x9453('0x2e')](_0x55d2a7[_0x9453('0x39')],function(_0x4db390){var _0x40015d={};_0x40015d[_0x4db390]={'$like':'%'+_0x3e5e21['query'][_0x9453('0x5a')]+'%'};return _0x40015d;})});}_0x55d2a7=_[_0x9453('0x40')]({},_0x55d2a7,_0x3e5e21[_0x9453('0x41')]);return _0x2fd644[_0x9453('0x65')](_0x55d2a7);}})[_0x9453('0x26')](function(_0x3af914){if(_0x3af914){_0x59d7b1=_0x3af914['length'];if(!_0x3e5e21[_0x9453('0x35')][_0x9453('0x3b')]('nolimit')){_0x55d2a7[_0x9453('0x3c')]=qs[_0x9453('0x3c')](_0x3e5e21[_0x9453('0x35')]['limit']);_0x55d2a7[_0x9453('0x20')]=qs[_0x9453('0x20')](_0x3e5e21[_0x9453('0x35')]['offset']);}return _0x2fd644[_0x9453('0x65')](_0x55d2a7);}})['then'](function(_0x38fa3f){if(_0x38fa3f){return _0x38fa3f?{'count':_0x59d7b1,'rows':_0x38fa3f}:null;}})['then'](respondWithResult(_0x574478,null))[_0x9453('0x46')](handleError(_0x574478,null));};exports[_0x9453('0x67')]=function(_0x292ac4,_0x1cb89e,_0x2de706){var _0x3152c5=_0x292ac4[_0x9453('0x4c')]['ids'];return db['Team'][_0x9453('0x44')]({'where':{'id':_0x3152c5},'attributes':['id'],'include':[{'model':db[_0x9453('0x5b')],'as':_0x9453('0x68'),'attributes':['id',_0x9453('0x2b'),_0x9453('0x69'),_0x9453('0x6a'),_0x9453('0x6b')],'raw':!![]}]})['then'](function(_0x130508){if(_0x130508){var _0x25490b=_[_0x9453('0x6c')](_0x130508,function(_0x1e32cb){var _0x1ff95f=_0x1e32cb['get']({'plain':!![]});return _0x1ff95f['Agents'];});return db[_0x9453('0x2f')][_0x9453('0x4a')]({'where':{'id':_0x292ac4[_0x9453('0x48')]['id']}})[_0x9453('0x26')](function(_0x30f959){return db[_0x9453('0x6d')][_0x9453('0x6e')](function(_0x1de341){return _0x30f959[_0x9453('0x67')](_0x3152c5,{'transaction':_0x1de341})[_0x9453('0x26')](function(){return BPromise['each'](_0x25490b,function(_0x156da8){return db['UserOpenchannelQueue'][_0x9453('0x6f')]({'where':{'UserId':_0x156da8['id'],'OpenchannelQueueId':_0x292ac4[_0x9453('0x48')]['id']},'transaction':_0x1de341});});})[_0x9453('0x26')](function(){_0x25490b[_0x9453('0x70')](function(_0x43a4e1){socket[_0x9453('0x71')](_0x9453('0x72'),{'UserId':_0x43a4e1['id'],'OpenchannelQueueId':_0x30f959['id']});});});});});}})['then'](respondWithStatusCode(_0x1cb89e,null))[_0x9453('0x46')](handleError(_0x1cb89e,null));};exports[_0x9453('0x73')]=function(_0x153f83,_0x12580e,_0x4e088b){return db[_0x9453('0x66')][_0x9453('0x44')]({'where':{'id':_0x153f83['query'][_0x9453('0x74')]},'attributes':['id'],'include':[{'model':db[_0x9453('0x5b')],'as':_0x9453('0x68'),'attributes':['id'],'raw':!![]}]})[_0x9453('0x26')](handleEntityNotFound(_0x12580e,null))['then'](function(_0x107651){var _0x2e7754=_['map'](_0x107651,'id');var _0x74a461=[];var _0x10acd8=[];var _0x58948f=squel[_0x9453('0x75')]();_0x58948f['field'](_0x9453('0x76'))[_0x9453('0x77')](_0x9453('0x78'),'tq')[_0x9453('0x79')]('user_has_teams','ut',_0x9453('0x7a'))[_0x9453('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x153f83[_0x9453('0x48')]['id']);for(var _0x56d340=0x0;_0x56d340<_0x107651[_0x9453('0x3a')];_0x56d340+=0x1){let _0x1ff8d4=_0x107651[_0x56d340];for(var _0x103e2=0x0;_0x103e2<_0x1ff8d4[_0x9453('0x68')][_0x9453('0x3a')];_0x103e2+=0x1){let _0xe17bd8=_0x1ff8d4['Agents'][_0x103e2];var _0x4c8afe=_0x58948f['clone']();_0x4c8afe['where']('ut.UserId\x20=\x20?',_0xe17bd8['id']);_0x10acd8['push'](db[_0x9453('0x6d')][_0x9453('0x35')](_0x4c8afe[_0x9453('0x7b')](),{'type':db['sequelize'][_0x9453('0x7c')][_0x9453('0x7d')]})[_0x9453('0x26')](function(_0x42aad4){if(_0x42aad4[_0x9453('0x3a')]===0x1){return _0xe17bd8['id'];}else{var _0x49d15f=_['every'](_[_0x9453('0x2e')](_0x42aad4,'TeamId'),function(_0x1d4df5){return _['includes'](_0x2e7754,_0x1d4df5);});if(_0x49d15f){return _0xe17bd8['id'];}}}));}}return BPromise['all'](_0x10acd8)[_0x9453('0x26')](function(_0xe71f6){_0x74a461=_(_0x74a461)[_0x9453('0x7e')](_0xe71f6)[_0x9453('0x7f')]()[_0x9453('0x80')]();return db['OpenchannelQueue'][_0x9453('0x4a')]({'where':{'id':_0x153f83['params']['id']}})[_0x9453('0x26')](function(_0x403488){return db[_0x9453('0x6d')]['transaction'](function(_0x44a138){return _0x403488[_0x9453('0x73')](_0x153f83[_0x9453('0x35')]['ids'],{'transaction':_0x44a138})[_0x9453('0x26')](function(){if(!_[_0x9453('0x81')](_0x74a461)){return _0x403488[_0x9453('0x82')](_0x74a461,{'transaction':_0x44a138});}})[_0x9453('0x26')](function(){_0x74a461[_0x9453('0x70')](function(_0x39bc99){socket[_0x9453('0x71')](_0x9453('0x83'),{'UserId':_0x39bc99,'OpenchannelQueueId':_0x403488['id']});});});});});});})[_0x9453('0x26')](respondWithStatusCode(_0x12580e,null))[_0x9453('0x46')](handleError(_0x12580e,null));};exports[_0x9453('0x84')]=function(_0x2e4989,_0x1b63a1,_0xbb181c){return db[_0x9453('0x2f')][_0x9453('0x4a')]({'where':{'id':_0x2e4989[_0x9453('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b63a1,null))[_0x9453('0x26')](function(_0x22d5f2){if(_0x22d5f2){return _0x22d5f2[_0x9453('0x84')](_0x2e4989['body'][_0x9453('0x74')],_[_0x9453('0x85')](_0x2e4989[_0x9453('0x4c')],[_0x9453('0x74'),'id'])||{})[_0x9453('0x86')](function(_0x42f606){for(var _0x5715e3=0x0;_0x5715e3<_0x2e4989[_0x9453('0x4c')][_0x9453('0x74')]['length'];_0x5715e3+=0x1){socket['emit'](_0x9453('0x72'),{'UserId':_0x2e4989[_0x9453('0x4c')][_0x9453('0x74')][_0x5715e3],'OpenchannelQueueId':_0x2e4989[_0x9453('0x48')]['id']});}return _0x42f606;});}})[_0x9453('0x26')](respondWithResult(_0x1b63a1,null))[_0x9453('0x46')](handleError(_0x1b63a1,null));};exports[_0x9453('0x82')]=function(_0x3ef988,_0x2cfc00,_0x5574e1){return db['OpenchannelQueue'][_0x9453('0x4a')]({'where':{'id':_0x3ef988['params']['id']}})['then'](handleEntityNotFound(_0x2cfc00,null))[_0x9453('0x26')](function(_0xd22868){if(_0xd22868){return _0xd22868[_0x9453('0x82')](_0x3ef988[_0x9453('0x35')][_0x9453('0x74')])[_0x9453('0x26')](function(){if(_[_0x9453('0x87')](_0x3ef988[_0x9453('0x35')][_0x9453('0x74')])){for(var _0x5ba3d4=0x0;_0x5ba3d4<_0x3ef988[_0x9453('0x35')]['ids'][_0x9453('0x3a')];_0x5ba3d4+=0x1){socket['emit'](_0x9453('0x83'),{'UserId':Number(_0x3ef988['query'][_0x9453('0x74')][_0x5ba3d4]),'OpenchannelQueueId':Number(_0x3ef988[_0x9453('0x48')]['id'])});}}else{socket[_0x9453('0x71')](_0x9453('0x83'),{'UserId':Number(_0x3ef988[_0x9453('0x35')][_0x9453('0x74')]),'OpenchannelQueueId':Number(_0x3ef988[_0x9453('0x48')]['id'])});}});}})[_0x9453('0x26')](respondWithStatusCode(_0x2cfc00,null))['catch'](handleError(_0x2cfc00,null));};exports[_0x9453('0x88')]=function(_0xdc3648,_0x5b9efc,_0x2f3a27){var _0x509108={};var _0x108b1e={};var _0x14deea;var _0x34bb5f;return db[_0x9453('0x2f')][_0x9453('0x56')]({'where':{'id':_0xdc3648[_0x9453('0x48')]['id']}})[_0x9453('0x26')](handleEntityNotFound(_0x5b9efc,null))[_0x9453('0x26')](function(_0x244971){if(_0x244971){_0x14deea=_0x244971;_0x108b1e['model']=_['keys'](db[_0x9453('0x5b')][_0x9453('0x30')]);_0x108b1e[_0x9453('0x35')]=_[_0x9453('0x36')](_0xdc3648[_0x9453('0x35')]);_0x108b1e[_0x9453('0x37')]=_[_0x9453('0x38')](_0x108b1e[_0x9453('0x34')],_0x108b1e[_0x9453('0x35')]);_0x509108[_0x9453('0x39')]=_[_0x9453('0x38')](_0x108b1e[_0x9453('0x34')],qs[_0x9453('0x49')](_0xdc3648[_0x9453('0x35')]['fields']));_0x509108[_0x9453('0x39')]=_0x509108[_0x9453('0x39')][_0x9453('0x3a')]?_0x509108['attributes']:_0x108b1e[_0x9453('0x34')];_0x509108[_0x9453('0x58')]=qs['sort'](_0xdc3648[_0x9453('0x35')]['sort']);_0x509108[_0x9453('0x3e')]=qs[_0x9453('0x37')](_[_0x9453('0x59')](_0xdc3648[_0x9453('0x35')],_0x108b1e[_0x9453('0x37')]));if(_0xdc3648['query'][_0x9453('0x5a')]){_0x509108[_0x9453('0x3e')]=_['merge'](_0x509108['where'],{'$or':_[_0x9453('0x2e')](_0x509108[_0x9453('0x39')],function(_0x205090){var _0x4e62af={};_0x4e62af[_0x205090]={'$like':'%'+_0xdc3648[_0x9453('0x35')][_0x9453('0x5a')]+'%'};return _0x4e62af;})});}_0x509108=_['merge']({},_0x509108,_0xdc3648[_0x9453('0x41')]);return _0x14deea['getAgents'](_0x509108);}})[_0x9453('0x26')](function(_0x3cf166){if(_0x3cf166){_0x34bb5f=_0x3cf166['length'];if(!_0xdc3648[_0x9453('0x35')][_0x9453('0x3b')]('nolimit')){_0x509108[_0x9453('0x3c')]=qs[_0x9453('0x3c')](_0xdc3648[_0x9453('0x35')][_0x9453('0x3c')]);_0x509108[_0x9453('0x20')]=qs[_0x9453('0x20')](_0xdc3648[_0x9453('0x35')][_0x9453('0x20')]);}return _0x14deea[_0x9453('0x88')](_0x509108);}})[_0x9453('0x26')](function(_0x49eafa){if(_0x49eafa){return _0x49eafa?{'count':_0x34bb5f,'rows':_0x49eafa}:null;}})[_0x9453('0x26')](respondWithResult(_0x5b9efc,null))[_0x9453('0x46')](handleError(_0x5b9efc,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 80d0399..68f0487 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 _0xb6c8=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','update'];(function(_0x1553f8,_0x4df236){var _0xa43709=function(_0x20118d){while(--_0x20118d){_0x1553f8['push'](_0x1553f8['shift']());}};_0xa43709(++_0x4df236);}(_0xb6c8,0x13d));var _0x8b6c=function(_0x2ae1b5,_0x169f0a){_0x2ae1b5=_0x2ae1b5-0x0;var _0xb7a6bd=_0xb6c8[_0x2ae1b5];return _0xb7a6bd;};'use strict';var EventEmitter=require(_0x8b6c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8b6c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b6c('0x2'),'afterDestroy':_0x8b6c('0x3')};function emitEvent(_0x2c144d){return function(_0x5226c7,_0x9ffe59,_0x14aad3){OpenchannelQueueEvents[_0x8b6c('0x4')](_0x2c144d+':'+_0x5226c7['id'],_0x5226c7);OpenchannelQueueEvents['emit'](_0x2c144d,_0x5226c7);_0x14aad3(null);};}for(var e in events){if(events[_0x8b6c('0x5')](e)){var event=events[e];OpenchannelQueue[_0x8b6c('0x6')](e,emitEvent(event));}}module[_0x8b6c('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6394=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1c32c8,_0x5b2ba4){var _0x2fdcc2=function(_0x38bc08){while(--_0x38bc08){_0x1c32c8['push'](_0x1c32c8['shift']());}};_0x2fdcc2(++_0x5b2ba4);}(_0x6394,0x148));var _0x4639=function(_0x4c4e09,_0x2749fe){_0x4c4e09=_0x4c4e09-0x0;var _0x97a3b5=_0x6394[_0x4c4e09];return _0x97a3b5;};'use strict';var EventEmitter=require(_0x4639('0x0'));var OpenchannelQueue=require(_0x4639('0x1'))['db'][_0x4639('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4639('0x3')](0x0);var events={'afterCreate':_0x4639('0x4'),'afterUpdate':_0x4639('0x5'),'afterDestroy':_0x4639('0x6')};function emitEvent(_0x41274f){return function(_0x3ef8c1,_0x2b8f28,_0x4f792e){OpenchannelQueueEvents[_0x4639('0x7')](_0x41274f+':'+_0x3ef8c1['id'],_0x3ef8c1);OpenchannelQueueEvents[_0x4639('0x7')](_0x41274f,_0x3ef8c1);_0x4f792e(null);};}for(var e in events){if(events[_0x4639('0x8')](e)){var event=events[e];OpenchannelQueue[_0x4639('0x9')](e,emitEvent(event));}}module[_0x4639('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index fde6c29..29c247e 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 _0x0bca=['define','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x1b1ceb,_0x3772e9){var _0x30fed9=function(_0x28ef4b){while(--_0x28ef4b){_0x1b1ceb['push'](_0x1b1ceb['shift']());}};_0x30fed9(++_0x3772e9);}(_0x0bca,0x19b));var _0xa0bc=function(_0x32113d,_0x185cc4){_0x32113d=_0x32113d-0x0;var _0x270024=_0x0bca[_0x32113d];return _0x270024;};'use strict';var _=require('lodash');var util=require(_0xa0bc('0x0'));var logger=require(_0xa0bc('0x1'))(_0xa0bc('0x2'));var moment=require(_0xa0bc('0x3'));var BPromise=require('bluebird');var rp=require(_0xa0bc('0x4'));var fs=require('fs');var path=require(_0xa0bc('0x5'));var rimraf=require('rimraf');var config=require(_0xa0bc('0x6'));var attributes=require(_0xa0bc('0x7'));module[_0xa0bc('0x8')]=function(_0x28dc56,_0x559736){return _0x28dc56[_0xa0bc('0x9')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ea5=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment'];(function(_0x38ad74,_0x405743){var _0x1ac56c=function(_0x155be3){while(--_0x155be3){_0x38ad74['push'](_0x38ad74['shift']());}};_0x1ac56c(++_0x405743);}(_0x1ea5,0x141));var _0x51ea=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x1ea5[_0x2fd160];return _0x5c2031;};'use strict';var _=require('lodash');var util=require(_0x51ea('0x0'));var logger=require(_0x51ea('0x1'))(_0x51ea('0x2'));var moment=require(_0x51ea('0x3'));var BPromise=require(_0x51ea('0x4'));var rp=require(_0x51ea('0x5'));var fs=require('fs');var path=require(_0x51ea('0x6'));var rimraf=require(_0x51ea('0x7'));var config=require(_0x51ea('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0x51ea('0x9')]=function(_0x16e3f3,_0xefa2e9){return _0x16e3f3[_0x51ea('0xa')](_0x51ea('0xb'),attributes,{'tableName':_0x51ea('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 cade5b9..c470b92 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 _0xa3a1=['message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','then','catch','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./openchannelQueue.socket','request','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x18a997,_0x5d5357){var _0x58cc4b=function(_0x49f8cc){while(--_0x49f8cc){_0x18a997['push'](_0x18a997['shift']());}};_0x58cc4b(++_0x5d5357);}(_0xa3a1,0x11a));var _0x1a3a=function(_0x5d8c37,_0x4378ac){_0x5d8c37=_0x5d8c37-0x0;var _0x1d52bf=_0xa3a1[_0x5d8c37];return _0x1d52bf;};'use strict';var _=require(_0x1a3a('0x0'));var util=require('util');var moment=require(_0x1a3a('0x1'));var BPromise=require(_0x1a3a('0x2'));var rs=require(_0x1a3a('0x3'));var fs=require('fs');var Redis=require(_0x1a3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a3a('0x5'));var logger=require(_0x1a3a('0x6'))(_0x1a3a('0x7'));var config=require(_0x1a3a('0x8'));var jayson=require(_0x1a3a('0x9'));var client=jayson['client'][_0x1a3a('0xa')]({'port':0x232a});config[_0x1a3a('0xb')]=_[_0x1a3a('0xc')](config[_0x1a3a('0xb')],{'host':_0x1a3a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a3a('0xb')]));require(_0x1a3a('0xe'))['register'](socket);function respondWithRpcPromise(_0x3b858e,_0x10d7a6,_0x5ce3f7){return new BPromise(function(_0x3d4fcc,_0x277c98){return client[_0x1a3a('0xf')](_0x3b858e,_0x5ce3f7)['then'](function(_0x1d0d75){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x10d7a6,'request\x20sent');logger[_0x1a3a('0x10')](_0x1a3a('0x11'),_0x10d7a6,_0x1a3a('0x12'),JSON[_0x1a3a('0x13')](_0x1d0d75));if(_0x1d0d75['error']){if(_0x1d0d75['error']['code']===0x1f4){logger[_0x1a3a('0x14')](_0x1a3a('0x15'),_0x10d7a6,_0x1d0d75[_0x1a3a('0x14')][_0x1a3a('0x16')]);return _0x277c98(_0x1d0d75[_0x1a3a('0x14')][_0x1a3a('0x16')]);}logger[_0x1a3a('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x10d7a6,_0x1d0d75[_0x1a3a('0x14')][_0x1a3a('0x16')]);return _0x3d4fcc(_0x1d0d75[_0x1a3a('0x14')][_0x1a3a('0x16')]);}else{logger[_0x1a3a('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x10d7a6,_0x1a3a('0x12'));_0x3d4fcc(_0x1d0d75[_0x1a3a('0x18')][_0x1a3a('0x16')]);}})['catch'](function(_0x190de6){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x10d7a6,_0x190de6);_0x277c98(_0x190de6);});});}exports[_0x1a3a('0x19')]=function(_0x2536bf){var _0x2ca038=this;return new Promise(function(_0xce56b3,_0x4ac71c){return db[_0x1a3a('0x1a')][_0x1a3a('0x1b')]({'raw':_0x2536bf['options']?_0x2536bf[_0x1a3a('0x1c')][_0x1a3a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2536bf[_0x1a3a('0x1c')]?_0x2536bf[_0x1a3a('0x1c')]['where']||null:null,'attributes':_0x2536bf['options']?_0x2536bf[_0x1a3a('0x1c')][_0x1a3a('0x1e')]||null:null,'limit':_0x2536bf[_0x1a3a('0x1c')]?_0x2536bf[_0x1a3a('0x1c')]['limit']||null:null,'include':_0x2536bf[_0x1a3a('0x1c')]?_0x2536bf[_0x1a3a('0x1c')][_0x1a3a('0x1f')]?_[_0x1a3a('0x20')](_0x2536bf[_0x1a3a('0x1c')][_0x1a3a('0x1f')],function(_0xfd0496){return{'model':db[_0xfd0496[_0x1a3a('0x21')]],'as':_0xfd0496['as'],'attributes':_0xfd0496[_0x1a3a('0x1e')],'include':_0xfd0496[_0x1a3a('0x1f')]?_[_0x1a3a('0x20')](_0xfd0496[_0x1a3a('0x1f')],function(_0x3c8369){return{'model':db[_0x3c8369[_0x1a3a('0x21')]],'as':_0x3c8369['as'],'attributes':_0x3c8369['attributes'],'include':_0x3c8369[_0x1a3a('0x1f')]?_[_0x1a3a('0x20')](_0x3c8369[_0x1a3a('0x1f')],function(_0x492c8e){return{'model':db[_0x492c8e['model']],'as':_0x492c8e['as'],'attributes':_0x492c8e['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a3a('0x22')](function(_0x19ce80){logger[_0x1a3a('0x17')](_0x1a3a('0x19'),_0x2536bf);logger[_0x1a3a('0x10')](_0x1a3a('0x19'),_0x2536bf,JSON['stringify'](_0x19ce80));_0xce56b3(_0x19ce80);})[_0x1a3a('0x23')](function(_0x25f4fb){logger[_0x1a3a('0x14')]('GetOpenchannelQueue',_0x25f4fb[_0x1a3a('0x16')],_0x2536bf);_0x4ac71c(_0x2ca038['error'](0x1f4,_0x25f4fb[_0x1a3a('0x16')]));});});};exports[_0x1a3a('0x24')]=function(_0x57df12){var _0x18b618=this;return new Promise(function(_0x1513ef,_0x171fd4){return db[_0x1a3a('0x1a')][_0x1a3a('0x25')]({'raw':_0x57df12[_0x1a3a('0x1c')]?_0x57df12[_0x1a3a('0x1c')][_0x1a3a('0x1d')]===undefined?!![]:![]:!![],'where':_0x57df12[_0x1a3a('0x1c')]?_0x57df12['options']['where']||null:null,'attributes':_0x57df12['options']?_0x57df12[_0x1a3a('0x1c')][_0x1a3a('0x1e')]||null:null,'include':_0x57df12[_0x1a3a('0x1c')]?_0x57df12[_0x1a3a('0x1c')][_0x1a3a('0x1f')]?_[_0x1a3a('0x20')](_0x57df12[_0x1a3a('0x1c')][_0x1a3a('0x1f')],function(_0x192f4d){return{'model':db[_0x192f4d['model']],'as':_0x192f4d['as'],'attributes':_0x192f4d[_0x1a3a('0x1e')],'include':_0x192f4d[_0x1a3a('0x1f')]?_[_0x1a3a('0x20')](_0x192f4d[_0x1a3a('0x1f')],function(_0x8401f6){return{'model':db[_0x8401f6[_0x1a3a('0x21')]],'as':_0x8401f6['as'],'attributes':_0x8401f6[_0x1a3a('0x1e')],'include':_0x8401f6[_0x1a3a('0x1f')]?_[_0x1a3a('0x20')](_0x8401f6[_0x1a3a('0x1f')],function(_0x16561b){return{'model':db[_0x16561b['model']],'as':_0x16561b['as'],'attributes':_0x16561b[_0x1a3a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1a3a('0x22')](function(_0x58c198){logger[_0x1a3a('0x17')](_0x1a3a('0x24'),_0x57df12);logger['debug']('ShowOpenchannelQueue',_0x57df12,JSON[_0x1a3a('0x13')](_0x58c198));_0x1513ef(_0x58c198);})[_0x1a3a('0x23')](function(_0x45fa45){logger['error'](_0x1a3a('0x24'),_0x45fa45[_0x1a3a('0x16')],_0x57df12);_0x171fd4(_0x18b618[_0x1a3a('0x14')](0x1f4,_0x45fa45[_0x1a3a('0x16')]));});});}; \ No newline at end of file +var _0x868e=['ShowOpenchannelQueue','OpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','attributes','include','map','model','GetOpenchannelQueue'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x868e,0x16a));var _0xe868=function(_0x29f7f8,_0x38641a){_0x29f7f8=_0x29f7f8-0x0;var _0x53fc04=_0x868e[_0x29f7f8];return _0x53fc04;};'use strict';var _=require(_0xe868('0x0'));var util=require(_0xe868('0x1'));var moment=require(_0xe868('0x2'));var BPromise=require(_0xe868('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe868('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe868('0x5'))(_0xe868('0x6'));var config=require(_0xe868('0x7'));var jayson=require(_0xe868('0x8'));var client=jayson[_0xe868('0x9')]['http']({'port':0x232a});config['redis']=_[_0xe868('0xa')](config[_0xe868('0xb')],{'host':_0xe868('0xc'),'port':0x18eb});var socket=require(_0xe868('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x231a26,_0x2b9ecc,_0x35ed76){return new BPromise(function(_0xd1b45a,_0x512718){return client[_0xe868('0xe')](_0x231a26,_0x35ed76)[_0xe868('0xf')](function(_0x5b9db8){logger[_0xe868('0x10')](_0xe868('0x11'),_0x2b9ecc,_0xe868('0x12'));logger[_0xe868('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2b9ecc,_0xe868('0x12'),JSON[_0xe868('0x14')](_0x5b9db8));if(_0x5b9db8[_0xe868('0x15')]){if(_0x5b9db8[_0xe868('0x15')][_0xe868('0x16')]===0x1f4){logger[_0xe868('0x15')](_0xe868('0x11'),_0x2b9ecc,_0x5b9db8['error'][_0xe868('0x17')]);return _0x512718(_0x5b9db8[_0xe868('0x15')]['message']);}logger[_0xe868('0x15')](_0xe868('0x11'),_0x2b9ecc,_0x5b9db8[_0xe868('0x15')][_0xe868('0x17')]);return _0xd1b45a(_0x5b9db8[_0xe868('0x15')][_0xe868('0x17')]);}else{logger[_0xe868('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b9ecc,_0xe868('0x12'));_0xd1b45a(_0x5b9db8[_0xe868('0x18')][_0xe868('0x17')]);}})[_0xe868('0x19')](function(_0x1b5991){logger[_0xe868('0x15')](_0xe868('0x11'),_0x2b9ecc,_0x1b5991);_0x512718(_0x1b5991);});});}exports['GetOpenchannelQueue']=function(_0x38f6da){var _0x3aae78=this;return new Promise(function(_0xbb824d,_0x1bc478){return db['OpenchannelQueue'][_0xe868('0x1a')]({'raw':_0x38f6da[_0xe868('0x1b')]?_0x38f6da[_0xe868('0x1b')][_0xe868('0x1c')]===undefined?!![]:![]:!![],'where':_0x38f6da['options']?_0x38f6da[_0xe868('0x1b')]['where']||null:null,'attributes':_0x38f6da[_0xe868('0x1b')]?_0x38f6da[_0xe868('0x1b')][_0xe868('0x1d')]||null:null,'limit':_0x38f6da[_0xe868('0x1b')]?_0x38f6da[_0xe868('0x1b')]['limit']||null:null,'include':_0x38f6da['options']?_0x38f6da['options'][_0xe868('0x1e')]?_[_0xe868('0x1f')](_0x38f6da[_0xe868('0x1b')][_0xe868('0x1e')],function(_0x1d44bb){return{'model':db[_0x1d44bb['model']],'as':_0x1d44bb['as'],'attributes':_0x1d44bb[_0xe868('0x1d')],'include':_0x1d44bb[_0xe868('0x1e')]?_[_0xe868('0x1f')](_0x1d44bb[_0xe868('0x1e')],function(_0xaacf63){return{'model':db[_0xaacf63[_0xe868('0x20')]],'as':_0xaacf63['as'],'attributes':_0xaacf63[_0xe868('0x1d')],'include':_0xaacf63['include']?_[_0xe868('0x1f')](_0xaacf63[_0xe868('0x1e')],function(_0xfbc917){return{'model':db[_0xfbc917[_0xe868('0x20')]],'as':_0xfbc917['as'],'attributes':_0xfbc917[_0xe868('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe868('0xf')](function(_0x24ffaa){logger['info'](_0xe868('0x21'),_0x38f6da);logger['debug']('GetOpenchannelQueue',_0x38f6da,JSON['stringify'](_0x24ffaa));_0xbb824d(_0x24ffaa);})[_0xe868('0x19')](function(_0x1667cb){logger[_0xe868('0x15')](_0xe868('0x21'),_0x1667cb[_0xe868('0x17')],_0x38f6da);_0x1bc478(_0x3aae78[_0xe868('0x15')](0x1f4,_0x1667cb[_0xe868('0x17')]));});});};exports[_0xe868('0x22')]=function(_0x55c729){var _0x399324=this;return new Promise(function(_0x37b8a1,_0xf8e278){return db[_0xe868('0x23')]['find']({'raw':_0x55c729[_0xe868('0x1b')]?_0x55c729[_0xe868('0x1b')][_0xe868('0x1c')]===undefined?!![]:![]:!![],'where':_0x55c729[_0xe868('0x1b')]?_0x55c729[_0xe868('0x1b')]['where']||null:null,'attributes':_0x55c729[_0xe868('0x1b')]?_0x55c729['options'][_0xe868('0x1d')]||null:null,'include':_0x55c729[_0xe868('0x1b')]?_0x55c729['options'][_0xe868('0x1e')]?_[_0xe868('0x1f')](_0x55c729[_0xe868('0x1b')][_0xe868('0x1e')],function(_0x339411){return{'model':db[_0x339411[_0xe868('0x20')]],'as':_0x339411['as'],'attributes':_0x339411[_0xe868('0x1d')],'include':_0x339411[_0xe868('0x1e')]?_[_0xe868('0x1f')](_0x339411[_0xe868('0x1e')],function(_0x513e15){return{'model':db[_0x513e15[_0xe868('0x20')]],'as':_0x513e15['as'],'attributes':_0x513e15[_0xe868('0x1d')],'include':_0x513e15[_0xe868('0x1e')]?_[_0xe868('0x1f')](_0x513e15['include'],function(_0x3eda60){return{'model':db[_0x3eda60[_0xe868('0x20')]],'as':_0x3eda60['as'],'attributes':_0x3eda60[_0xe868('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaf0018){logger['info'](_0xe868('0x22'),_0x55c729);logger[_0xe868('0x13')](_0xe868('0x22'),_0x55c729,JSON[_0xe868('0x14')](_0xaf0018));_0x37b8a1(_0xaf0018);})['catch'](function(_0x205b36){logger[_0xe868('0x15')](_0xe868('0x22'),_0x205b36['message'],_0x55c729);_0xf8e278(_0x399324[_0xe868('0x15')](0x1f4,_0x205b36['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b25a0df..5b2e92f 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 _0x1bd0=['./openchannelQueue.events','save','remove','update','length','openchannelQueue:'];(function(_0x507919,_0x1fd54a){var _0x444bc6=function(_0x29ef4c){while(--_0x29ef4c){_0x507919['push'](_0x507919['shift']());}};_0x444bc6(++_0x1fd54a);}(_0x1bd0,0x6c));var _0x01bd=function(_0x3129d8,_0x19fd95){_0x3129d8=_0x3129d8-0x0;var _0x2a1b5d=_0x1bd0[_0x3129d8];return _0x2a1b5d;};'use strict';var OpenchannelQueueEvents=require(_0x01bd('0x0'));var events=[_0x01bd('0x1'),_0x01bd('0x2'),_0x01bd('0x3')];function createListener(_0x531db0,_0x1cb194){return function(_0xa05bc5){_0x1cb194['emit'](_0x531db0,_0xa05bc5);};}function removeListener(_0x71266e,_0x1a936c){return function(){OpenchannelQueueEvents['removeListener'](_0x71266e,_0x1a936c);};}exports['register']=function(_0x179293){for(var _0x10e3b8=0x0,_0x1824e7=events[_0x01bd('0x4')];_0x10e3b8<_0x1824e7;_0x10e3b8++){var _0x1403f5=events[_0x10e3b8];var _0x110d51=createListener(_0x01bd('0x5')+_0x1403f5,_0x179293);OpenchannelQueueEvents['on'](_0x1403f5,_0x110d51);}}; \ No newline at end of file +var _0x86b0=['register','length','openchannelQueue:','./openchannelQueue.events','save','update','emit'];(function(_0x1633d2,_0x460044){var _0x518f28=function(_0x29b9fd){while(--_0x29b9fd){_0x1633d2['push'](_0x1633d2['shift']());}};_0x518f28(++_0x460044);}(_0x86b0,0x1bc));var _0x086b=function(_0x18dbde,_0x2d79a8){_0x18dbde=_0x18dbde-0x0;var _0xd427e4=_0x86b0[_0x18dbde];return _0xd427e4;};'use strict';var OpenchannelQueueEvents=require(_0x086b('0x0'));var events=[_0x086b('0x1'),'remove',_0x086b('0x2')];function createListener(_0x357c5d,_0x264b68){return function(_0x429b45){_0x264b68[_0x086b('0x3')](_0x357c5d,_0x429b45);};}function removeListener(_0x47aa7d,_0x253b47){return function(){OpenchannelQueueEvents['removeListener'](_0x47aa7d,_0x253b47);};}exports[_0x086b('0x4')]=function(_0x49c5b9){for(var _0x419e1a=0x0,_0x323f30=events[_0x086b('0x5')];_0x419e1a<_0x323f30;_0x419e1a++){var _0x5e66b6=events[_0x419e1a];var _0x3f88a1=createListener(_0x086b('0x6')+_0x5e66b6,_0x49c5b9);OpenchannelQueueEvents['on'](_0x5e66b6,_0x3f88a1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 97e4a93..6ec7b1d 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 _0x4296=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4296,0xf4));var _0x6429=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4296[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x6429('0x0'));var util=require('util');var path=require(_0x6429('0x1'));var timeout=require(_0x6429('0x2'));var express=require(_0x6429('0x3'));var router=express[_0x6429('0x4')]();var auth=require(_0x6429('0x5'));var interaction=require(_0x6429('0x6'));var config=require(_0x6429('0x7'));var controller=require(_0x6429('0x8'));router['get']('/',auth[_0x6429('0x9')](),controller[_0x6429('0xa')]);router[_0x6429('0xb')](_0x6429('0xc'),auth[_0x6429('0x9')](),controller[_0x6429('0xd')]);router[_0x6429('0xb')](_0x6429('0xe'),auth['isAuthenticated'](),controller[_0x6429('0xf')]);router[_0x6429('0x10')]('/',auth[_0x6429('0x9')](),controller[_0x6429('0x11')]);router[_0x6429('0x12')](_0x6429('0xe'),auth[_0x6429('0x9')](),controller[_0x6429('0x13')]);router[_0x6429('0x14')](_0x6429('0xe'),auth['isAuthenticated'](),controller[_0x6429('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbd23=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','get'];(function(_0x41767b,_0x38eb62){var _0x4afb48=function(_0x576e4a){while(--_0x576e4a){_0x41767b['push'](_0x41767b['shift']());}};_0x4afb48(++_0x38eb62);}(_0xbd23,0x103));var _0x3bd2=function(_0x348e24,_0x4eb495){_0x348e24=_0x348e24-0x0;var _0x20d71d=_0xbd23[_0x348e24];return _0x20d71d;};'use strict';var multer=require(_0x3bd2('0x0'));var util=require(_0x3bd2('0x1'));var path=require(_0x3bd2('0x2'));var timeout=require(_0x3bd2('0x3'));var express=require('express');var router=express[_0x3bd2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bd2('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x3bd2('0x6')]('/',auth[_0x3bd2('0x7')](),controller[_0x3bd2('0x8')]);router[_0x3bd2('0x6')]('/describe',auth[_0x3bd2('0x7')](),controller[_0x3bd2('0x9')]);router['get'](_0x3bd2('0xa'),auth['isAuthenticated'](),controller[_0x3bd2('0xb')]);router[_0x3bd2('0xc')]('/',auth[_0x3bd2('0x7')](),controller[_0x3bd2('0xd')]);router[_0x3bd2('0xe')](_0x3bd2('0xa'),auth[_0x3bd2('0x7')](),controller[_0x3bd2('0xf')]);router[_0x3bd2('0x10')](_0x3bd2('0xa'),auth[_0x3bd2('0x7')](),controller[_0x3bd2('0x11')]);module[_0x3bd2('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 5fb0f12..f1b5be8 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 _0xf6c3=['DATE','sequelize','exports','STRING'];(function(_0x761d31,_0x501930){var _0x4ec079=function(_0x1f8036){while(--_0x1f8036){_0x761d31['push'](_0x761d31['shift']());}};_0x4ec079(++_0x501930);}(_0xf6c3,0x199));var _0x3f6c=function(_0x515c74,_0x1144d4){_0x515c74=_0x515c74-0x0;var _0x8c5187=_0xf6c3[_0x515c74];return _0x8c5187;};'use strict';var moment=require('moment');var Sequelize=require(_0x3f6c('0x0'));module[_0x3f6c('0x1')]={'uniqueid':{'type':Sequelize[_0x3f6c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3f6c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3f6c('0x3')]},'acceptAt':{'type':Sequelize[_0x3f6c('0x3')]},'exitAt':{'type':Sequelize[_0x3f6c('0x3')]},'reason':{'type':Sequelize[_0x3f6c('0x2')]}}; \ No newline at end of file +var _0xb3c6=['DATE','moment','sequelize','STRING'];(function(_0x88a523,_0x4c930c){var _0x3deebf=function(_0x9d3877){while(--_0x9d3877){_0x88a523['push'](_0x88a523['shift']());}};_0x3deebf(++_0x4c930c);}(_0xb3c6,0x109));var _0x6b3c=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xb3c6[_0x5f42f1];return _0x5534ee;};'use strict';var moment=require(_0x6b3c('0x0'));var Sequelize=require(_0x6b3c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6b3c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6b3c('0x3')]},'leaveAt':{'type':Sequelize[_0x6b3c('0x3')]},'acceptAt':{'type':Sequelize[_0x6b3c('0x3')]},'exitAt':{'type':Sequelize[_0x6b3c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a328ad1..c6b8537 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 _0xad17=['save','destroy','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','then','includeAll','rows','catch','include','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject'];(function(_0x2767fa,_0x214a0b){var _0x544e4f=function(_0x562fa3){while(--_0x562fa3){_0x2767fa['push'](_0x2767fa['shift']());}};_0x544e4f(++_0x214a0b);}(_0xad17,0xb8));var _0x7ad1=function(_0x1239c0,_0xdd70da){_0x1239c0=_0x1239c0-0x0;var _0x1b7169=_0xad17[_0x1239c0];return _0x1b7169;};'use strict';var pdf=require(_0x7ad1('0x0'));var emlformat=require(_0x7ad1('0x1'));var rimraf=require(_0x7ad1('0x2'));var zipdir=require(_0x7ad1('0x3'));var jsonpatch=require(_0x7ad1('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ad1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7ad1('0x6'));var sox=require(_0x7ad1('0x7'));var csv=require('to-csv');var ejs=require(_0x7ad1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ad1('0x9'));var deskjs=require(_0x7ad1('0xa'));var toCsv=require(_0x7ad1('0xb'));var querystring=require(_0x7ad1('0xc'));var Papa=require(_0x7ad1('0xd'));var Redis=require(_0x7ad1('0xe'));var authService=require(_0x7ad1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7ad1('0x10'));var hardwareService=require(_0x7ad1('0x11'));var logger=require(_0x7ad1('0x12'))(_0x7ad1('0x13'));var utils=require(_0x7ad1('0x14'));var config=require(_0x7ad1('0x15'));var db=require(_0x7ad1('0x16'))['db'];function respondWithStatusCode(_0x2b82ca,_0x2fa9d1){_0x2fa9d1=_0x2fa9d1||0xcc;return function(_0x25d4aa){if(_0x25d4aa){return _0x2b82ca[_0x7ad1('0x17')](_0x2fa9d1);}return _0x2b82ca[_0x7ad1('0x18')](_0x2fa9d1)['end']();};}function respondWithResult(_0x36086c,_0x15829b){_0x15829b=_0x15829b||0xc8;return function(_0x403390){if(_0x403390){return _0x36086c[_0x7ad1('0x18')](_0x15829b)[_0x7ad1('0x19')](_0x403390);}};}function respondWithFilteredResult(_0xc8e343,_0x37cfca){return function(_0x2da97f){if(_0x2da97f){var _0x41ece8=_0x2da97f['count'],_0x4d5953=_0x37cfca[_0x7ad1('0x1a')],_0x1dfcc1=_0x37cfca['offset']+_0x37cfca[_0x7ad1('0x1b')],_0xe368c8;if(_0x1dfcc1>=_0x41ece8){_0x1dfcc1=_0x41ece8;_0xe368c8=0xc8;}else{_0xe368c8=0xce;}_0xc8e343['status'](_0xe368c8);return _0xc8e343[_0x7ad1('0x1c')](_0x7ad1('0x1d'),_0x4d5953+'-'+_0x1dfcc1+'/'+_0x41ece8)[_0x7ad1('0x19')](_0x2da97f);}return null;};}function patchUpdates(_0x21cb7a){return function(_0x156d0f){try{jsonpatch[_0x7ad1('0x1e')](_0x156d0f,_0x21cb7a,!![]);}catch(_0x34e0c5){return BPromise[_0x7ad1('0x1f')](_0x34e0c5);}return _0x156d0f[_0x7ad1('0x20')]();};}function saveUpdates(_0x4437b7,_0x31221d){return function(_0x5296c7){if(_0x5296c7){return _0x5296c7['update'](_0x4437b7)['then'](function(_0xd422a0){return _0xd422a0;});}return null;};}function removeEntity(_0x1ff4cb,_0x1ea9c6){return function(_0x2385d1){if(_0x2385d1){return _0x2385d1[_0x7ad1('0x21')]()['then'](function(){_0x1ff4cb[_0x7ad1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45fc33,_0x5123ca){return function(_0x4523d1){if(!_0x4523d1){_0x45fc33[_0x7ad1('0x17')](0x194);}return _0x4523d1;};}function handleError(_0x14d635,_0x194e0e){_0x194e0e=_0x194e0e||0x1f4;return function(_0x59bc1f){logger['error'](_0x59bc1f['stack']);if(_0x59bc1f[_0x7ad1('0x22')]){delete _0x59bc1f[_0x7ad1('0x22')];}_0x14d635[_0x7ad1('0x18')](_0x194e0e)[_0x7ad1('0x23')](_0x59bc1f);};}exports[_0x7ad1('0x24')]=function(_0x2baf4d,_0x104d44){var _0x490d27={},_0x54a771={},_0xa7b1dc={'count':0x0,'rows':[]};var _0x2bfb74=_[_0x7ad1('0x25')](db[_0x7ad1('0x26')]['rawAttributes'],function(_0x201d21){return{'name':_0x201d21[_0x7ad1('0x27')],'type':_0x201d21[_0x7ad1('0x28')][_0x7ad1('0x29')]};});_0x54a771[_0x7ad1('0x2a')]=_[_0x7ad1('0x25')](_0x2bfb74,'name');_0x54a771['query']=_[_0x7ad1('0x2b')](_0x2baf4d['query']);_0x54a771[_0x7ad1('0x2c')]=_[_0x7ad1('0x2d')](_0x54a771[_0x7ad1('0x2a')],_0x54a771[_0x7ad1('0x2e')]);_0x490d27['attributes']=_[_0x7ad1('0x2d')](_0x54a771[_0x7ad1('0x2a')],qs[_0x7ad1('0x2f')](_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x2f')]));_0x490d27[_0x7ad1('0x30')]=_0x490d27[_0x7ad1('0x30')][_0x7ad1('0x31')]?_0x490d27[_0x7ad1('0x30')]:_0x54a771[_0x7ad1('0x2a')];if(!_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x32')](_0x7ad1('0x33'))){_0x490d27[_0x7ad1('0x1b')]=qs[_0x7ad1('0x1b')](_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x1b')]);_0x490d27[_0x7ad1('0x1a')]=qs[_0x7ad1('0x1a')](_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x1a')]);}_0x490d27[_0x7ad1('0x34')]=qs[_0x7ad1('0x35')](_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x35')]);_0x490d27[_0x7ad1('0x36')]=qs[_0x7ad1('0x2c')](_[_0x7ad1('0x37')](_0x2baf4d[_0x7ad1('0x2e')],_0x54a771['filters']),_0x2bfb74);if(_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x38')]){_0x490d27[_0x7ad1('0x36')]=_[_0x7ad1('0x39')](_0x490d27[_0x7ad1('0x36')],{'$or':_[_0x7ad1('0x25')](_0x2bfb74,function(_0x4ab928){if(_0x4ab928[_0x7ad1('0x28')]!==_0x7ad1('0x3a')){var _0x57dc3a={};_0x57dc3a[_0x4ab928[_0x7ad1('0x22')]]={'$like':'%'+_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x38')]+'%'};return _0x57dc3a;}})});}_0x490d27=_[_0x7ad1('0x39')]({},_0x490d27,_0x2baf4d[_0x7ad1('0x3b')]);var _0x58850d={'where':_0x490d27['where']};return db[_0x7ad1('0x26')][_0x7ad1('0x3c')](_0x58850d)[_0x7ad1('0x3d')](function(_0x2b746e){_0xa7b1dc[_0x7ad1('0x3c')]=_0x2b746e;if(_0x2baf4d[_0x7ad1('0x2e')][_0x7ad1('0x3e')]){_0x490d27['include']=[{'all':!![]}];}return db[_0x7ad1('0x26')]['findAll'](_0x490d27);})['then'](function(_0xf8fd1){_0xa7b1dc[_0x7ad1('0x3f')]=_0xf8fd1;return _0xa7b1dc;})[_0x7ad1('0x3d')](respondWithFilteredResult(_0x104d44,_0x490d27))[_0x7ad1('0x40')](handleError(_0x104d44,null));};exports['show']=function(_0x4a94c0,_0x177807){var _0x10943e={'raw':!![],'where':{'id':_0x4a94c0['params']['id']}},_0x4aa5c3={};_0x4aa5c3[_0x7ad1('0x2a')]=_[_0x7ad1('0x2b')](db['OpenchannelQueueReport']['rawAttributes']);_0x4aa5c3[_0x7ad1('0x2e')]=_[_0x7ad1('0x2b')](_0x4a94c0[_0x7ad1('0x2e')]);_0x4aa5c3[_0x7ad1('0x2c')]=_[_0x7ad1('0x2d')](_0x4aa5c3[_0x7ad1('0x2a')],_0x4aa5c3[_0x7ad1('0x2e')]);_0x10943e['attributes']=_['intersection'](_0x4aa5c3[_0x7ad1('0x2a')],qs[_0x7ad1('0x2f')](_0x4a94c0['query'][_0x7ad1('0x2f')]));_0x10943e[_0x7ad1('0x30')]=_0x10943e[_0x7ad1('0x30')]['length']?_0x10943e[_0x7ad1('0x30')]:_0x4aa5c3[_0x7ad1('0x2a')];if(_0x4a94c0[_0x7ad1('0x2e')][_0x7ad1('0x3e')]){_0x10943e[_0x7ad1('0x41')]=[{'all':!![]}];}_0x10943e=_[_0x7ad1('0x39')]({},_0x10943e,_0x4a94c0[_0x7ad1('0x3b')]);return db[_0x7ad1('0x26')][_0x7ad1('0x42')](_0x10943e)[_0x7ad1('0x3d')](handleEntityNotFound(_0x177807,null))[_0x7ad1('0x3d')](respondWithResult(_0x177807,null))['catch'](handleError(_0x177807,null));};exports[_0x7ad1('0x43')]=function(_0x3aa891,_0x511d01){return db[_0x7ad1('0x26')][_0x7ad1('0x43')](_0x3aa891[_0x7ad1('0x44')],{})[_0x7ad1('0x3d')](respondWithResult(_0x511d01,0xc9))['catch'](handleError(_0x511d01,null));};exports[_0x7ad1('0x45')]=function(_0x38a9d9,_0x4403e9){if(_0x38a9d9[_0x7ad1('0x44')]['id']){delete _0x38a9d9[_0x7ad1('0x44')]['id'];}return db[_0x7ad1('0x26')][_0x7ad1('0x42')]({'where':{'id':_0x38a9d9[_0x7ad1('0x46')]['id']}})['then'](handleEntityNotFound(_0x4403e9,null))[_0x7ad1('0x3d')](saveUpdates(_0x38a9d9[_0x7ad1('0x44')],null))['then'](respondWithResult(_0x4403e9,null))[_0x7ad1('0x40')](handleError(_0x4403e9,null));};exports[_0x7ad1('0x21')]=function(_0x37347a,_0x83017b){return db[_0x7ad1('0x26')][_0x7ad1('0x42')]({'where':{'id':_0x37347a[_0x7ad1('0x46')]['id']}})[_0x7ad1('0x3d')](handleEntityNotFound(_0x83017b,null))['then'](removeEntity(_0x83017b,null))[_0x7ad1('0x40')](handleError(_0x83017b,null));};exports[_0x7ad1('0x47')]=function(_0x3e940b,_0xfbed60){return db['OpenchannelQueueReport'][_0x7ad1('0x47')]()[_0x7ad1('0x3d')](respondWithResult(_0xfbed60,null))[_0x7ad1('0x40')](handleError(_0xfbed60,null));}; \ No newline at end of file +var _0x0c80=['../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x12f221,_0x384daf){var _0x316354=function(_0x22a9fb){while(--_0x22a9fb){_0x12f221['push'](_0x12f221['shift']());}};_0x316354(++_0x384daf);}(_0x0c80,0x7a));var _0x00c8=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0c80[_0xdea41a];return _0x15d0d8;};'use strict';var pdf=require(_0x00c8('0x0'));var emlformat=require(_0x00c8('0x1'));var rimraf=require(_0x00c8('0x2'));var zipdir=require(_0x00c8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00c8('0x4'));var moment=require(_0x00c8('0x5'));var BPromise=require(_0x00c8('0x6'));var Mustache=require(_0x00c8('0x7'));var util=require(_0x00c8('0x8'));var path=require(_0x00c8('0x9'));var sox=require(_0x00c8('0xa'));var csv=require(_0x00c8('0xb'));var ejs=require(_0x00c8('0xc'));var fs=require('fs');var _=require(_0x00c8('0xd'));var squel=require(_0x00c8('0xe'));var crypto=require(_0x00c8('0xf'));var jsforce=require(_0x00c8('0x10'));var deskjs=require(_0x00c8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x00c8('0x12'));var Papa=require(_0x00c8('0x13'));var Redis=require(_0x00c8('0x14'));var authService=require(_0x00c8('0x15'));var qs=require(_0x00c8('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00c8('0x17'));var logger=require(_0x00c8('0x18'))(_0x00c8('0x19'));var utils=require(_0x00c8('0x1a'));var config=require('../../config/environment');var db=require(_0x00c8('0x1b'))['db'];function respondWithStatusCode(_0x31fd85,_0x205a5b){_0x205a5b=_0x205a5b||0xcc;return function(_0xcd16b9){if(_0xcd16b9){return _0x31fd85[_0x00c8('0x1c')](_0x205a5b);}return _0x31fd85[_0x00c8('0x1d')](_0x205a5b)[_0x00c8('0x1e')]();};}function respondWithResult(_0x1f27fe,_0x1fcb14){_0x1fcb14=_0x1fcb14||0xc8;return function(_0x39d838){if(_0x39d838){return _0x1f27fe[_0x00c8('0x1d')](_0x1fcb14)['json'](_0x39d838);}};}function respondWithFilteredResult(_0x173c11,_0x2a651c){return function(_0x4acd4f){if(_0x4acd4f){var _0xb4ea5e=_0x4acd4f[_0x00c8('0x1f')],_0x4f7cb9=_0x2a651c[_0x00c8('0x20')],_0x338e67=_0x2a651c[_0x00c8('0x20')]+_0x2a651c[_0x00c8('0x21')],_0x5b8e05;if(_0x338e67>=_0xb4ea5e){_0x338e67=_0xb4ea5e;_0x5b8e05=0xc8;}else{_0x5b8e05=0xce;}_0x173c11[_0x00c8('0x1d')](_0x5b8e05);return _0x173c11[_0x00c8('0x22')]('Content-Range',_0x4f7cb9+'-'+_0x338e67+'/'+_0xb4ea5e)['json'](_0x4acd4f);}return null;};}function patchUpdates(_0x28ee30){return function(_0x7f917c){try{jsonpatch['apply'](_0x7f917c,_0x28ee30,!![]);}catch(_0x160612){return BPromise['reject'](_0x160612);}return _0x7f917c['save']();};}function saveUpdates(_0x4a1703,_0x4bc3e2){return function(_0x49aa8){if(_0x49aa8){return _0x49aa8[_0x00c8('0x23')](_0x4a1703)[_0x00c8('0x24')](function(_0x33205e){return _0x33205e;});}return null;};}function removeEntity(_0x5ea5a1,_0x40f4c4){return function(_0x31c799){if(_0x31c799){return _0x31c799[_0x00c8('0x25')]()[_0x00c8('0x24')](function(){_0x5ea5a1[_0x00c8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ed390,_0x1b2e74){return function(_0x4cb885){if(!_0x4cb885){_0x4ed390['sendStatus'](0x194);}return _0x4cb885;};}function handleError(_0x4efecc,_0x427bcc){_0x427bcc=_0x427bcc||0x1f4;return function(_0x134615){logger[_0x00c8('0x26')](_0x134615[_0x00c8('0x27')]);if(_0x134615[_0x00c8('0x28')]){delete _0x134615[_0x00c8('0x28')];}_0x4efecc[_0x00c8('0x1d')](_0x427bcc)[_0x00c8('0x29')](_0x134615);};}exports[_0x00c8('0x2a')]=function(_0x2414bd,_0x2e3f16){var _0x2f5fbd={},_0x5cdb74={},_0x4728d0={'count':0x0,'rows':[]};var _0x93ecbf=_[_0x00c8('0x2b')](db[_0x00c8('0x2c')]['rawAttributes'],function(_0x2513c4){return{'name':_0x2513c4[_0x00c8('0x2d')],'type':_0x2513c4[_0x00c8('0x2e')]['key']};});_0x5cdb74[_0x00c8('0x2f')]=_[_0x00c8('0x2b')](_0x93ecbf,'name');_0x5cdb74['query']=_['keys'](_0x2414bd[_0x00c8('0x30')]);_0x5cdb74[_0x00c8('0x31')]=_[_0x00c8('0x32')](_0x5cdb74[_0x00c8('0x2f')],_0x5cdb74[_0x00c8('0x30')]);_0x2f5fbd[_0x00c8('0x33')]=_[_0x00c8('0x32')](_0x5cdb74['model'],qs[_0x00c8('0x34')](_0x2414bd[_0x00c8('0x30')][_0x00c8('0x34')]));_0x2f5fbd[_0x00c8('0x33')]=_0x2f5fbd['attributes']['length']?_0x2f5fbd[_0x00c8('0x33')]:_0x5cdb74[_0x00c8('0x2f')];if(!_0x2414bd[_0x00c8('0x30')][_0x00c8('0x35')]('nolimit')){_0x2f5fbd['limit']=qs[_0x00c8('0x21')](_0x2414bd[_0x00c8('0x30')]['limit']);_0x2f5fbd['offset']=qs[_0x00c8('0x20')](_0x2414bd[_0x00c8('0x30')]['offset']);}_0x2f5fbd['order']=qs[_0x00c8('0x36')](_0x2414bd[_0x00c8('0x30')]['sort']);_0x2f5fbd[_0x00c8('0x37')]=qs[_0x00c8('0x31')](_[_0x00c8('0x38')](_0x2414bd[_0x00c8('0x30')],_0x5cdb74[_0x00c8('0x31')]),_0x93ecbf);if(_0x2414bd[_0x00c8('0x30')][_0x00c8('0x39')]){_0x2f5fbd[_0x00c8('0x37')]=_[_0x00c8('0x3a')](_0x2f5fbd[_0x00c8('0x37')],{'$or':_[_0x00c8('0x2b')](_0x93ecbf,function(_0x463fc7){if(_0x463fc7['type']!==_0x00c8('0x3b')){var _0x1d92c3={};_0x1d92c3[_0x463fc7[_0x00c8('0x28')]]={'$like':'%'+_0x2414bd['query']['filter']+'%'};return _0x1d92c3;}})});}_0x2f5fbd=_[_0x00c8('0x3a')]({},_0x2f5fbd,_0x2414bd[_0x00c8('0x3c')]);var _0x540f26={'where':_0x2f5fbd['where']};return db[_0x00c8('0x2c')][_0x00c8('0x1f')](_0x540f26)[_0x00c8('0x24')](function(_0x21cb77){_0x4728d0[_0x00c8('0x1f')]=_0x21cb77;if(_0x2414bd[_0x00c8('0x30')][_0x00c8('0x3d')]){_0x2f5fbd[_0x00c8('0x3e')]=[{'all':!![]}];}return db[_0x00c8('0x2c')]['findAll'](_0x2f5fbd);})[_0x00c8('0x24')](function(_0x5e4911){_0x4728d0[_0x00c8('0x3f')]=_0x5e4911;return _0x4728d0;})[_0x00c8('0x24')](respondWithFilteredResult(_0x2e3f16,_0x2f5fbd))[_0x00c8('0x40')](handleError(_0x2e3f16,null));};exports[_0x00c8('0x41')]=function(_0x243927,_0x28b93b){var _0x142363={'raw':!![],'where':{'id':_0x243927[_0x00c8('0x42')]['id']}},_0x339e36={};_0x339e36[_0x00c8('0x2f')]=_[_0x00c8('0x43')](db[_0x00c8('0x2c')][_0x00c8('0x44')]);_0x339e36[_0x00c8('0x30')]=_['keys'](_0x243927[_0x00c8('0x30')]);_0x339e36['filters']=_[_0x00c8('0x32')](_0x339e36['model'],_0x339e36[_0x00c8('0x30')]);_0x142363[_0x00c8('0x33')]=_[_0x00c8('0x32')](_0x339e36[_0x00c8('0x2f')],qs['fields'](_0x243927[_0x00c8('0x30')][_0x00c8('0x34')]));_0x142363[_0x00c8('0x33')]=_0x142363['attributes'][_0x00c8('0x45')]?_0x142363[_0x00c8('0x33')]:_0x339e36[_0x00c8('0x2f')];if(_0x243927[_0x00c8('0x30')][_0x00c8('0x3d')]){_0x142363['include']=[{'all':!![]}];}_0x142363=_['merge']({},_0x142363,_0x243927[_0x00c8('0x3c')]);return db[_0x00c8('0x2c')]['find'](_0x142363)['then'](handleEntityNotFound(_0x28b93b,null))[_0x00c8('0x24')](respondWithResult(_0x28b93b,null))[_0x00c8('0x40')](handleError(_0x28b93b,null));};exports[_0x00c8('0x46')]=function(_0x4c3105,_0x26ecda){return db['OpenchannelQueueReport'][_0x00c8('0x46')](_0x4c3105[_0x00c8('0x47')],{})[_0x00c8('0x24')](respondWithResult(_0x26ecda,0xc9))[_0x00c8('0x40')](handleError(_0x26ecda,null));};exports[_0x00c8('0x23')]=function(_0x31d4d5,_0x18c99e){if(_0x31d4d5[_0x00c8('0x47')]['id']){delete _0x31d4d5[_0x00c8('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x00c8('0x48')]({'where':{'id':_0x31d4d5[_0x00c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x18c99e,null))[_0x00c8('0x24')](saveUpdates(_0x31d4d5[_0x00c8('0x47')],null))[_0x00c8('0x24')](respondWithResult(_0x18c99e,null))[_0x00c8('0x40')](handleError(_0x18c99e,null));};exports[_0x00c8('0x25')]=function(_0x3cd426,_0x24a90d){return db[_0x00c8('0x2c')][_0x00c8('0x48')]({'where':{'id':_0x3cd426[_0x00c8('0x42')]['id']}})[_0x00c8('0x24')](handleEntityNotFound(_0x24a90d,null))[_0x00c8('0x24')](removeEntity(_0x24a90d,null))['catch'](handleError(_0x24a90d,null));};exports[_0x00c8('0x49')]=function(_0x28ee2d,_0x482d20){return db[_0x00c8('0x2c')][_0x00c8('0x49')]()[_0x00c8('0x24')](respondWithResult(_0x482d20,null))[_0x00c8('0x40')](handleError(_0x482d20,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4faa85c..1445fc6 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 _0x1f5f=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x2dc9b7,_0x45bf6f){var _0x5da719=function(_0x2930de){while(--_0x2930de){_0x2dc9b7['push'](_0x2dc9b7['shift']());}};_0x5da719(++_0x45bf6f);}(_0x1f5f,0xee));var _0xf1f5=function(_0x458a85,_0x202334){_0x458a85=_0x458a85-0x0;var _0x36e112=_0x1f5f[_0x458a85];return _0x36e112;};'use strict';var _=require(_0xf1f5('0x0'));var util=require(_0xf1f5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf1f5('0x2'));var BPromise=require(_0xf1f5('0x3'));var rp=require(_0xf1f5('0x4'));var fs=require('fs');var path=require(_0xf1f5('0x5'));var rimraf=require(_0xf1f5('0x6'));var config=require(_0xf1f5('0x7'));var attributes=require(_0xf1f5('0x8'));module[_0xf1f5('0x9')]=function(_0x17a8e8,_0x39f83c){return _0x17a8e8[_0xf1f5('0xa')](_0xf1f5('0xb'),attributes,{'tableName':_0xf1f5('0xc'),'paranoid':![],'indexes':[{'name':_0xf1f5('0xd'),'fields':[_0xf1f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd309=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x39b758,_0x3663a5){var _0x83694=function(_0x278166){while(--_0x278166){_0x39b758['push'](_0x39b758['shift']());}};_0x83694(++_0x3663a5);}(_0xd309,0x14d));var _0x9d30=function(_0x2c0549,_0x220266){_0x2c0549=_0x2c0549-0x0;var _0x36b520=_0xd309[_0x2c0549];return _0x36b520;};'use strict';var _=require(_0x9d30('0x0'));var util=require(_0x9d30('0x1'));var logger=require(_0x9d30('0x2'))(_0x9d30('0x3'));var moment=require(_0x9d30('0x4'));var BPromise=require(_0x9d30('0x5'));var rp=require(_0x9d30('0x6'));var fs=require('fs');var path=require(_0x9d30('0x7'));var rimraf=require(_0x9d30('0x8'));var config=require(_0x9d30('0x9'));var attributes=require(_0x9d30('0xa'));module['exports']=function(_0x50b9fd,_0x52fb6c){return _0x50b9fd['define']('OpenchannelQueueReport',attributes,{'tableName':_0x9d30('0xb'),'paranoid':![],'indexes':[{'name':_0x9d30('0xc'),'fields':[_0x9d30('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 15eff58..236eef7 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 _0xf963=['rpc','../../config/environment','client','request','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','lodash','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x5bb562,_0x12b12d){var _0x50ce6e=function(_0x4663ac){while(--_0x4663ac){_0x5bb562['push'](_0x5bb562['shift']());}};_0x50ce6e(++_0x12b12d);}(_0xf963,0x11d));var _0x3f96=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf963[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f96('0x1'));var rs=require(_0x3f96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f96('0x3'));var logger=require(_0x3f96('0x4'))(_0x3f96('0x5'));var config=require(_0x3f96('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3f96('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fa84a,_0x43633b,_0x422ffd){return new BPromise(function(_0x478a28,_0x14e2af){return client[_0x3f96('0x8')](_0x1fa84a,_0x422ffd)['then'](function(_0x50a3bf){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x43633b,_0x3f96('0x9'));logger[_0x3f96('0xa')](_0x3f96('0xb'),_0x43633b,_0x3f96('0x9'),JSON[_0x3f96('0xc')](_0x50a3bf));if(_0x50a3bf['error']){if(_0x50a3bf[_0x3f96('0xd')][_0x3f96('0xe')]===0x1f4){logger[_0x3f96('0xd')](_0x3f96('0xf'),_0x43633b,_0x50a3bf['error'][_0x3f96('0x10')]);return _0x14e2af(_0x50a3bf['error'][_0x3f96('0x10')]);}logger[_0x3f96('0xd')](_0x3f96('0xf'),_0x43633b,_0x50a3bf['error'][_0x3f96('0x10')]);return _0x478a28(_0x50a3bf['error'][_0x3f96('0x10')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x43633b,'request\x20sent');_0x478a28(_0x50a3bf[_0x3f96('0x11')][_0x3f96('0x10')]);}})[_0x3f96('0x12')](function(_0x71cde7){logger['error'](_0x3f96('0xf'),_0x43633b,_0x71cde7);_0x14e2af(_0x71cde7);});});}exports[_0x3f96('0x13')]=function(_0x36de2a){var _0x4ffc54=this;return new Promise(function(_0x239a9d,_0x1ae655){return db[_0x3f96('0x14')]['create'](_0x36de2a[_0x3f96('0x15')],{'raw':_0x36de2a[_0x3f96('0x16')]?_0x36de2a[_0x3f96('0x16')][_0x3f96('0x17')]===undefined?!![]:![]:!![]})[_0x3f96('0x18')](function(_0xb60019){logger['info'](_0x3f96('0x13'),_0x36de2a);logger['debug'](_0x3f96('0x13'),_0x36de2a,JSON[_0x3f96('0xc')](_0xb60019));_0x239a9d(_0xb60019);})['catch'](function(_0xd6ddf){logger[_0x3f96('0xd')]('CreateOpenchannelQueueReport',_0xd6ddf[_0x3f96('0x10')],_0x36de2a);_0x1ae655(_0x4ffc54[_0x3f96('0xd')](0x1f4,_0xd6ddf[_0x3f96('0x10')]));});});};exports[_0x3f96('0x19')]=function(_0x348e6f){var _0x446a2=this;return new Promise(function(_0x286cdf,_0x4fbcd9){return db['OpenchannelQueueReport'][_0x3f96('0x1a')](_0x348e6f['body'],{'raw':_0x348e6f['options']?_0x348e6f[_0x3f96('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x348e6f[_0x3f96('0x16')]?_0x348e6f['options'][_0x3f96('0x1b')]||null:null,'attributes':_0x348e6f[_0x3f96('0x16')]?_0x348e6f[_0x3f96('0x16')][_0x3f96('0x1c')]||null:null,'limit':_0x348e6f[_0x3f96('0x16')]?_0x348e6f[_0x3f96('0x16')]['limit']||null:null})[_0x3f96('0x18')](function(_0x33f37c){logger['info'](_0x3f96('0x19'),_0x348e6f);logger[_0x3f96('0xa')]('UpdateOpenchannelQueueReport',_0x348e6f,JSON[_0x3f96('0xc')](_0x33f37c));_0x286cdf(_0x33f37c);})['catch'](function(_0x3a175b){logger['error'](_0x3f96('0x19'),_0x3a175b[_0x3f96('0x10')],_0x348e6f);_0x4fbcd9(_0x446a2[_0x3f96('0xd')](0x1f4,_0x3a175b[_0x3f96('0x10')]));});});}; \ No newline at end of file +var _0x86c0=['UpdateOpenchannelQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','catch','update','raw','where','attributes'];(function(_0x95d1b6,_0x493de7){var _0x10ba90=function(_0x1263f4){while(--_0x1263f4){_0x95d1b6['push'](_0x95d1b6['shift']());}};_0x10ba90(++_0x493de7);}(_0x86c0,0x133));var _0x086c=function(_0x499c7f,_0x2d8184){_0x499c7f=_0x499c7f-0x0;var _0x433bee=_0x86c0[_0x499c7f];return _0x433bee;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var moment=require(_0x086c('0x1'));var BPromise=require(_0x086c('0x2'));var rs=require(_0x086c('0x3'));var fs=require('fs');var Redis=require(_0x086c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x086c('0x5'));var logger=require(_0x086c('0x6'))(_0x086c('0x7'));var config=require(_0x086c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x086c('0x9')][_0x086c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e27a8,_0x387428,_0x117df9){return new BPromise(function(_0x25e437,_0x52b942){return client[_0x086c('0xb')](_0x2e27a8,_0x117df9)[_0x086c('0xc')](function(_0xa1b79a){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));logger[_0x086c('0xe')](_0x086c('0xf'),_0x387428,_0x086c('0xd'),JSON[_0x086c('0x10')](_0xa1b79a));if(_0xa1b79a['error']){if(_0xa1b79a[_0x086c('0x11')][_0x086c('0x12')]===0x1f4){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error']['message']);return _0x52b942(_0xa1b79a[_0x086c('0x11')]['message']);}logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error'][_0x086c('0x14')]);return _0x25e437(_0xa1b79a[_0x086c('0x11')][_0x086c('0x14')]);}else{logger[_0x086c('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));_0x25e437(_0xa1b79a[_0x086c('0x16')][_0x086c('0x14')]);}})['catch'](function(_0x34e74f){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0x34e74f);_0x52b942(_0x34e74f);});});}exports[_0x086c('0x17')]=function(_0x2add43){var _0x5dc891=this;return new Promise(function(_0x5463d6,_0x3bac0c){return db[_0x086c('0x18')][_0x086c('0x19')](_0x2add43[_0x086c('0x1a')],{'raw':_0x2add43[_0x086c('0x1b')]?_0x2add43['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3ae033){logger[_0x086c('0x15')]('CreateOpenchannelQueueReport',_0x2add43);logger[_0x086c('0xe')]('CreateOpenchannelQueueReport',_0x2add43,JSON[_0x086c('0x10')](_0x3ae033));_0x5463d6(_0x3ae033);})[_0x086c('0x1c')](function(_0x2095d1){logger[_0x086c('0x11')]('CreateOpenchannelQueueReport',_0x2095d1[_0x086c('0x14')],_0x2add43);_0x3bac0c(_0x5dc891['error'](0x1f4,_0x2095d1['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x31aaab){var _0x4dd52d=this;return new Promise(function(_0x493bc2,_0x32b15b){return db['OpenchannelQueueReport'][_0x086c('0x1d')](_0x31aaab[_0x086c('0x1a')],{'raw':_0x31aaab['options']?_0x31aaab['options'][_0x086c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31aaab[_0x086c('0x1b')]?_0x31aaab[_0x086c('0x1b')][_0x086c('0x1f')]||null:null,'attributes':_0x31aaab['options']?_0x31aaab[_0x086c('0x1b')][_0x086c('0x20')]||null:null,'limit':_0x31aaab['options']?_0x31aaab['options']['limit']||null:null})[_0x086c('0xc')](function(_0x4fde3b){logger['info'](_0x086c('0x21'),_0x31aaab);logger['debug'](_0x086c('0x21'),_0x31aaab,JSON[_0x086c('0x10')](_0x4fde3b));_0x493bc2(_0x4fde3b);})[_0x086c('0x1c')](function(_0x55126b){logger[_0x086c('0x11')](_0x086c('0x21'),_0x55126b['message'],_0x31aaab);_0x32b15b(_0x4dd52d['error'](0x1f4,_0x55126b[_0x086c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 28de2da..4437916 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(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 6ac440b..621e547 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 _0x9174=['ENUM','queue','moment','sequelize'];(function(_0x53fec0,_0x30197c){var _0x240323=function(_0x3eef42){while(--_0x3eef42){_0x53fec0['push'](_0x53fec0['shift']());}};_0x240323(++_0x30197c);}(_0x9174,0x1b2));var _0x4917=function(_0x5019b5,_0x4a49e0){_0x5019b5=_0x5019b5-0x0;var _0x53e193=_0x9174[_0x5019b5];return _0x53e193;};'use strict';var moment=require(_0x4917('0x0'));var Sequelize=require(_0x4917('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4917('0x2')]('account','agent',_0x4917('0x3')),'allowNull':![],'defaultValue':_0x4917('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9842=['NOW','moment','sequelize','exports','STRING','queue','DATE'];(function(_0x5ddfc4,_0x2fed0b){var _0xa68c8e=function(_0x31c049){while(--_0x31c049){_0x5ddfc4['push'](_0x5ddfc4['shift']());}};_0xa68c8e(++_0x2fed0b);}(_0x9842,0x1dd));var _0x2984=function(_0x31b653,_0x326378){_0x31b653=_0x31b653-0x0;var _0x6e34af=_0x9842[_0x31b653];return _0x6e34af;};'use strict';var moment=require(_0x2984('0x0'));var Sequelize=require(_0x2984('0x1'));module[_0x2984('0x2')]={'uniqueid':{'type':Sequelize[_0x2984('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x2984('0x4')),'allowNull':![],'defaultValue':_0x2984('0x4')},'transferredAt':{'type':Sequelize[_0x2984('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x2984('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 2e34ea6..633cbb5 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 _0xff81=['stack','name','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','count','rows','show','params','keys','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','update','then','destroy','end'];(function(_0x4a7d90,_0x5496b9){var _0x5cf5cb=function(_0x5d5a80){while(--_0x5d5a80){_0x4a7d90['push'](_0x4a7d90['shift']());}};_0x5cf5cb(++_0x5496b9);}(_0xff81,0xe8));var _0x1ff8=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xff81[_0x40dd56];return _0x4f850f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1ff8('0x0'));var zipdir=require(_0x1ff8('0x1'));var jsonpatch=require(_0x1ff8('0x2'));var rp=require('request-promise');var moment=require(_0x1ff8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1ff8('0x4'));var util=require(_0x1ff8('0x5'));var path=require('path');var sox=require(_0x1ff8('0x6'));var csv=require(_0x1ff8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ff8('0x8'));var squel=require(_0x1ff8('0x9'));var crypto=require(_0x1ff8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1ff8('0xb'));var toCsv=require(_0x1ff8('0x7'));var querystring=require(_0x1ff8('0xc'));var Papa=require(_0x1ff8('0xd'));var Redis=require(_0x1ff8('0xe'));var authService=require(_0x1ff8('0xf'));var qs=require(_0x1ff8('0x10'));var as=require(_0x1ff8('0x11'));var hardwareService=require(_0x1ff8('0x12'));var logger=require('../../config/logger')(_0x1ff8('0x13'));var utils=require('../../config/utils');var config=require(_0x1ff8('0x14'));var db=require(_0x1ff8('0x15'))['db'];function respondWithStatusCode(_0xc3c3f6,_0x5da9a4){_0x5da9a4=_0x5da9a4||0xcc;return function(_0x3f717e){if(_0x3f717e){return _0xc3c3f6[_0x1ff8('0x16')](_0x5da9a4);}return _0xc3c3f6[_0x1ff8('0x17')](_0x5da9a4)['end']();};}function respondWithResult(_0x59bbc8,_0x95feb){_0x95feb=_0x95feb||0xc8;return function(_0x3de0bf){if(_0x3de0bf){return _0x59bbc8[_0x1ff8('0x17')](_0x95feb)[_0x1ff8('0x18')](_0x3de0bf);}};}function respondWithFilteredResult(_0x2007f1,_0x3a7bd6){return function(_0x128f18){if(_0x128f18){var _0x1bb1f5=_0x128f18['count'],_0xef623=_0x3a7bd6['offset'],_0x4fac7e=_0x3a7bd6[_0x1ff8('0x19')]+_0x3a7bd6[_0x1ff8('0x1a')],_0x1b9276;if(_0x4fac7e>=_0x1bb1f5){_0x4fac7e=_0x1bb1f5;_0x1b9276=0xc8;}else{_0x1b9276=0xce;}_0x2007f1['status'](_0x1b9276);return _0x2007f1[_0x1ff8('0x1b')]('Content-Range',_0xef623+'-'+_0x4fac7e+'/'+_0x1bb1f5)[_0x1ff8('0x18')](_0x128f18);}return null;};}function patchUpdates(_0x5cd8d5){return function(_0x3aced5){try{jsonpatch['apply'](_0x3aced5,_0x5cd8d5,!![]);}catch(_0x14f0da){return BPromise['reject'](_0x14f0da);}return _0x3aced5['save']();};}function saveUpdates(_0x10d4a3,_0x5829cb){return function(_0x545958){if(_0x545958){return _0x545958[_0x1ff8('0x1c')](_0x10d4a3)[_0x1ff8('0x1d')](function(_0x59a2d3){return _0x59a2d3;});}return null;};}function removeEntity(_0x5be035,_0x4641e4){return function(_0x111177){if(_0x111177){return _0x111177[_0x1ff8('0x1e')]()[_0x1ff8('0x1d')](function(){_0x5be035[_0x1ff8('0x17')](0xcc)[_0x1ff8('0x1f')]();});}};}function handleEntityNotFound(_0x5df698,_0x11ba4e){return function(_0x485e5e){if(!_0x485e5e){_0x5df698[_0x1ff8('0x16')](0x194);}return _0x485e5e;};}function handleError(_0x34c75f,_0x4e0ab8){_0x4e0ab8=_0x4e0ab8||0x1f4;return function(_0x4612f4){logger['error'](_0x4612f4[_0x1ff8('0x20')]);if(_0x4612f4[_0x1ff8('0x21')]){delete _0x4612f4[_0x1ff8('0x21')];}_0x34c75f[_0x1ff8('0x17')](_0x4e0ab8)['send'](_0x4612f4);};}exports[_0x1ff8('0x22')]=function(_0x3cab86,_0x212e85){var _0x1c8c79={},_0x5b501f={},_0x5d5dcf={'count':0x0,'rows':[]};var _0x44b8ca=_[_0x1ff8('0x23')](db[_0x1ff8('0x24')][_0x1ff8('0x25')],function(_0x89e723){return{'name':_0x89e723['fieldName'],'type':_0x89e723[_0x1ff8('0x26')][_0x1ff8('0x27')]};});_0x5b501f[_0x1ff8('0x28')]=_[_0x1ff8('0x23')](_0x44b8ca,_0x1ff8('0x21'));_0x5b501f['query']=_['keys'](_0x3cab86[_0x1ff8('0x29')]);_0x5b501f['filters']=_[_0x1ff8('0x2a')](_0x5b501f[_0x1ff8('0x28')],_0x5b501f[_0x1ff8('0x29')]);_0x1c8c79[_0x1ff8('0x2b')]=_[_0x1ff8('0x2a')](_0x5b501f[_0x1ff8('0x28')],qs[_0x1ff8('0x2c')](_0x3cab86[_0x1ff8('0x29')][_0x1ff8('0x2c')]));_0x1c8c79['attributes']=_0x1c8c79[_0x1ff8('0x2b')][_0x1ff8('0x2d')]?_0x1c8c79[_0x1ff8('0x2b')]:_0x5b501f[_0x1ff8('0x28')];if(!_0x3cab86[_0x1ff8('0x29')][_0x1ff8('0x2e')](_0x1ff8('0x2f'))){_0x1c8c79[_0x1ff8('0x1a')]=qs[_0x1ff8('0x1a')](_0x3cab86[_0x1ff8('0x29')][_0x1ff8('0x1a')]);_0x1c8c79['offset']=qs[_0x1ff8('0x19')](_0x3cab86['query'][_0x1ff8('0x19')]);}_0x1c8c79[_0x1ff8('0x30')]=qs[_0x1ff8('0x31')](_0x3cab86[_0x1ff8('0x29')]['sort']);_0x1c8c79[_0x1ff8('0x32')]=qs[_0x1ff8('0x33')](_[_0x1ff8('0x34')](_0x3cab86[_0x1ff8('0x29')],_0x5b501f[_0x1ff8('0x33')]),_0x44b8ca);if(_0x3cab86[_0x1ff8('0x29')]['filter']){_0x1c8c79[_0x1ff8('0x32')]=_[_0x1ff8('0x35')](_0x1c8c79[_0x1ff8('0x32')],{'$or':_[_0x1ff8('0x23')](_0x44b8ca,function(_0x9cc325){if(_0x9cc325['type']!=='VIRTUAL'){var _0xa13d4e={};_0xa13d4e[_0x9cc325[_0x1ff8('0x21')]]={'$like':'%'+_0x3cab86[_0x1ff8('0x29')]['filter']+'%'};return _0xa13d4e;}})});}_0x1c8c79=_[_0x1ff8('0x35')]({},_0x1c8c79,_0x3cab86[_0x1ff8('0x36')]);var _0x4714e2={'where':_0x1c8c79[_0x1ff8('0x32')]};return db['OpenchannelTransferReport'][_0x1ff8('0x37')](_0x4714e2)[_0x1ff8('0x1d')](function(_0x278d39){_0x5d5dcf[_0x1ff8('0x37')]=_0x278d39;if(_0x3cab86[_0x1ff8('0x29')]['includeAll']){_0x1c8c79['include']=[{'all':!![]}];}return db[_0x1ff8('0x24')]['findAll'](_0x1c8c79);})[_0x1ff8('0x1d')](function(_0x5da370){_0x5d5dcf[_0x1ff8('0x38')]=_0x5da370;return _0x5d5dcf;})[_0x1ff8('0x1d')](respondWithFilteredResult(_0x212e85,_0x1c8c79))['catch'](handleError(_0x212e85,null));};exports[_0x1ff8('0x39')]=function(_0x1ee4a2,_0x4e5d12){var _0x2ed3d6={'raw':!![],'where':{'id':_0x1ee4a2[_0x1ff8('0x3a')]['id']}},_0xc72fd9={};_0xc72fd9[_0x1ff8('0x28')]=_[_0x1ff8('0x3b')](db[_0x1ff8('0x24')][_0x1ff8('0x25')]);_0xc72fd9[_0x1ff8('0x29')]=_[_0x1ff8('0x3b')](_0x1ee4a2[_0x1ff8('0x29')]);_0xc72fd9['filters']=_[_0x1ff8('0x2a')](_0xc72fd9['model'],_0xc72fd9[_0x1ff8('0x29')]);_0x2ed3d6[_0x1ff8('0x2b')]=_['intersection'](_0xc72fd9[_0x1ff8('0x28')],qs['fields'](_0x1ee4a2['query']['fields']));_0x2ed3d6[_0x1ff8('0x2b')]=_0x2ed3d6['attributes'][_0x1ff8('0x2d')]?_0x2ed3d6['attributes']:_0xc72fd9['model'];if(_0x1ee4a2[_0x1ff8('0x29')]['includeAll']){_0x2ed3d6[_0x1ff8('0x3c')]=[{'all':!![]}];}_0x2ed3d6=_[_0x1ff8('0x35')]({},_0x2ed3d6,_0x1ee4a2[_0x1ff8('0x36')]);return db[_0x1ff8('0x24')][_0x1ff8('0x3d')](_0x2ed3d6)[_0x1ff8('0x1d')](handleEntityNotFound(_0x4e5d12,null))[_0x1ff8('0x1d')](respondWithResult(_0x4e5d12,null))[_0x1ff8('0x3e')](handleError(_0x4e5d12,null));};exports[_0x1ff8('0x3f')]=function(_0x68e75d,_0x43b688){return db[_0x1ff8('0x24')][_0x1ff8('0x3f')](_0x68e75d[_0x1ff8('0x40')],{})['then'](respondWithResult(_0x43b688,0xc9))['catch'](handleError(_0x43b688,null));};exports[_0x1ff8('0x1c')]=function(_0x420f09,_0x20ada4){if(_0x420f09[_0x1ff8('0x40')]['id']){delete _0x420f09[_0x1ff8('0x40')]['id'];}return db[_0x1ff8('0x24')][_0x1ff8('0x3d')]({'where':{'id':_0x420f09[_0x1ff8('0x3a')]['id']}})[_0x1ff8('0x1d')](handleEntityNotFound(_0x20ada4,null))[_0x1ff8('0x1d')](saveUpdates(_0x420f09[_0x1ff8('0x40')],null))[_0x1ff8('0x1d')](respondWithResult(_0x20ada4,null))[_0x1ff8('0x3e')](handleError(_0x20ada4,null));};exports['destroy']=function(_0x313687,_0x39b816){return db[_0x1ff8('0x24')][_0x1ff8('0x3d')]({'where':{'id':_0x313687['params']['id']}})[_0x1ff8('0x1d')](handleEntityNotFound(_0x39b816,null))[_0x1ff8('0x1d')](removeEntity(_0x39b816,null))[_0x1ff8('0x3e')](handleError(_0x39b816,null));};exports[_0x1ff8('0x41')]=function(_0x62bc87,_0x1d326c){return db[_0x1ff8('0x24')][_0x1ff8('0x41')]()[_0x1ff8('0x1d')](respondWithResult(_0x1d326c,null))['catch'](handleError(_0x1d326c,null));}; \ No newline at end of file +var _0xf146=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','model','map','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','params','fields','length','include','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x22a75f,_0xf98f1f){var _0x583584=function(_0x48a6cc){while(--_0x48a6cc){_0x22a75f['push'](_0x22a75f['shift']());}};_0x583584(++_0xf98f1f);}(_0xf146,0x178));var _0x6f14=function(_0x50c2c8,_0x17421e){_0x50c2c8=_0x50c2c8-0x0;var _0x55f8a3=_0xf146[_0x50c2c8];return _0x55f8a3;};'use strict';var pdf=require(_0x6f14('0x0'));var emlformat=require(_0x6f14('0x1'));var rimraf=require(_0x6f14('0x2'));var zipdir=require(_0x6f14('0x3'));var jsonpatch=require(_0x6f14('0x4'));var rp=require(_0x6f14('0x5'));var moment=require(_0x6f14('0x6'));var BPromise=require(_0x6f14('0x7'));var Mustache=require(_0x6f14('0x8'));var util=require(_0x6f14('0x9'));var path=require('path');var sox=require(_0x6f14('0xa'));var csv=require(_0x6f14('0xb'));var ejs=require(_0x6f14('0xc'));var fs=require('fs');var _=require(_0x6f14('0xd'));var squel=require(_0x6f14('0xe'));var crypto=require(_0x6f14('0xf'));var jsforce=require(_0x6f14('0x10'));var deskjs=require(_0x6f14('0x11'));var toCsv=require(_0x6f14('0xb'));var querystring=require(_0x6f14('0x12'));var Papa=require('papaparse');var Redis=require(_0x6f14('0x13'));var authService=require(_0x6f14('0x14'));var qs=require(_0x6f14('0x15'));var as=require(_0x6f14('0x16'));var hardwareService=require(_0x6f14('0x17'));var logger=require('../../config/logger')(_0x6f14('0x18'));var utils=require(_0x6f14('0x19'));var config=require(_0x6f14('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb3c3b,_0x2a398f){_0x2a398f=_0x2a398f||0xcc;return function(_0x412f41){if(_0x412f41){return _0xcb3c3b['sendStatus'](_0x2a398f);}return _0xcb3c3b[_0x6f14('0x1b')](_0x2a398f)[_0x6f14('0x1c')]();};}function respondWithResult(_0xae620,_0x1aec60){_0x1aec60=_0x1aec60||0xc8;return function(_0x44f264){if(_0x44f264){return _0xae620[_0x6f14('0x1b')](_0x1aec60)[_0x6f14('0x1d')](_0x44f264);}};}function respondWithFilteredResult(_0x2c9b9e,_0x52dc31){return function(_0x1800cf){if(_0x1800cf){var _0x1c8f11=_0x1800cf[_0x6f14('0x1e')],_0x3d995e=_0x52dc31['offset'],_0x141bf5=_0x52dc31[_0x6f14('0x1f')]+_0x52dc31[_0x6f14('0x20')],_0x3a17ac;if(_0x141bf5>=_0x1c8f11){_0x141bf5=_0x1c8f11;_0x3a17ac=0xc8;}else{_0x3a17ac=0xce;}_0x2c9b9e[_0x6f14('0x1b')](_0x3a17ac);return _0x2c9b9e[_0x6f14('0x21')](_0x6f14('0x22'),_0x3d995e+'-'+_0x141bf5+'/'+_0x1c8f11)[_0x6f14('0x1d')](_0x1800cf);}return null;};}function patchUpdates(_0x18f020){return function(_0x5a2a10){try{jsonpatch[_0x6f14('0x23')](_0x5a2a10,_0x18f020,!![]);}catch(_0x52e385){return BPromise[_0x6f14('0x24')](_0x52e385);}return _0x5a2a10[_0x6f14('0x25')]();};}function saveUpdates(_0x5e881d,_0x14e535){return function(_0x52a9f4){if(_0x52a9f4){return _0x52a9f4[_0x6f14('0x26')](_0x5e881d)['then'](function(_0x2731be){return _0x2731be;});}return null;};}function removeEntity(_0x5366b9,_0x19b57f){return function(_0x4eacc3){if(_0x4eacc3){return _0x4eacc3[_0x6f14('0x27')]()[_0x6f14('0x28')](function(){_0x5366b9[_0x6f14('0x1b')](0xcc)[_0x6f14('0x1c')]();});}};}function handleEntityNotFound(_0x26fae2,_0x41c1dc){return function(_0x4b1a4c){if(!_0x4b1a4c){_0x26fae2[_0x6f14('0x29')](0x194);}return _0x4b1a4c;};}function handleError(_0xcb53c2,_0x2cf2ff){_0x2cf2ff=_0x2cf2ff||0x1f4;return function(_0x1d4fa1){logger[_0x6f14('0x2a')](_0x1d4fa1[_0x6f14('0x2b')]);if(_0x1d4fa1[_0x6f14('0x2c')]){delete _0x1d4fa1[_0x6f14('0x2c')];}_0xcb53c2[_0x6f14('0x1b')](_0x2cf2ff)[_0x6f14('0x2d')](_0x1d4fa1);};}exports[_0x6f14('0x2e')]=function(_0x21884e,_0xb05a9a){var _0xdf12ed={},_0x495a1b={},_0x315909={'count':0x0,'rows':[]};var _0x128de7=_['map'](db[_0x6f14('0x2f')][_0x6f14('0x30')],function(_0x23cd15){return{'name':_0x23cd15[_0x6f14('0x31')],'type':_0x23cd15['type']['key']};});_0x495a1b[_0x6f14('0x32')]=_[_0x6f14('0x33')](_0x128de7,_0x6f14('0x2c'));_0x495a1b['query']=_[_0x6f14('0x34')](_0x21884e[_0x6f14('0x35')]);_0x495a1b[_0x6f14('0x36')]=_['intersection'](_0x495a1b['model'],_0x495a1b[_0x6f14('0x35')]);_0xdf12ed[_0x6f14('0x37')]=_[_0x6f14('0x38')](_0x495a1b[_0x6f14('0x32')],qs['fields'](_0x21884e[_0x6f14('0x35')]['fields']));_0xdf12ed['attributes']=_0xdf12ed[_0x6f14('0x37')]['length']?_0xdf12ed[_0x6f14('0x37')]:_0x495a1b['model'];if(!_0x21884e[_0x6f14('0x35')][_0x6f14('0x39')](_0x6f14('0x3a'))){_0xdf12ed[_0x6f14('0x20')]=qs['limit'](_0x21884e[_0x6f14('0x35')][_0x6f14('0x20')]);_0xdf12ed[_0x6f14('0x1f')]=qs[_0x6f14('0x1f')](_0x21884e['query'][_0x6f14('0x1f')]);}_0xdf12ed[_0x6f14('0x3b')]=qs[_0x6f14('0x3c')](_0x21884e['query'][_0x6f14('0x3c')]);_0xdf12ed[_0x6f14('0x3d')]=qs[_0x6f14('0x36')](_['pick'](_0x21884e[_0x6f14('0x35')],_0x495a1b['filters']),_0x128de7);if(_0x21884e[_0x6f14('0x35')][_0x6f14('0x3e')]){_0xdf12ed[_0x6f14('0x3d')]=_[_0x6f14('0x3f')](_0xdf12ed['where'],{'$or':_['map'](_0x128de7,function(_0x5a7712){if(_0x5a7712['type']!==_0x6f14('0x40')){var _0x189de3={};_0x189de3[_0x5a7712[_0x6f14('0x2c')]]={'$like':'%'+_0x21884e[_0x6f14('0x35')][_0x6f14('0x3e')]+'%'};return _0x189de3;}})});}_0xdf12ed=_[_0x6f14('0x3f')]({},_0xdf12ed,_0x21884e['options']);var _0x7553f0={'where':_0xdf12ed[_0x6f14('0x3d')]};return db[_0x6f14('0x2f')]['count'](_0x7553f0)[_0x6f14('0x28')](function(_0x31f6fc){_0x315909[_0x6f14('0x1e')]=_0x31f6fc;if(_0x21884e[_0x6f14('0x35')]['includeAll']){_0xdf12ed['include']=[{'all':!![]}];}return db[_0x6f14('0x2f')][_0x6f14('0x41')](_0xdf12ed);})[_0x6f14('0x28')](function(_0x2711c4){_0x315909[_0x6f14('0x42')]=_0x2711c4;return _0x315909;})[_0x6f14('0x28')](respondWithFilteredResult(_0xb05a9a,_0xdf12ed))['catch'](handleError(_0xb05a9a,null));};exports['show']=function(_0x58b78c,_0x4cd0c8){var _0x52e7d0={'raw':!![],'where':{'id':_0x58b78c[_0x6f14('0x43')]['id']}},_0x46cad9={};_0x46cad9[_0x6f14('0x32')]=_[_0x6f14('0x34')](db['OpenchannelTransferReport'][_0x6f14('0x30')]);_0x46cad9[_0x6f14('0x35')]=_[_0x6f14('0x34')](_0x58b78c[_0x6f14('0x35')]);_0x46cad9['filters']=_[_0x6f14('0x38')](_0x46cad9[_0x6f14('0x32')],_0x46cad9[_0x6f14('0x35')]);_0x52e7d0[_0x6f14('0x37')]=_[_0x6f14('0x38')](_0x46cad9[_0x6f14('0x32')],qs[_0x6f14('0x44')](_0x58b78c[_0x6f14('0x35')]['fields']));_0x52e7d0[_0x6f14('0x37')]=_0x52e7d0[_0x6f14('0x37')][_0x6f14('0x45')]?_0x52e7d0[_0x6f14('0x37')]:_0x46cad9['model'];if(_0x58b78c[_0x6f14('0x35')]['includeAll']){_0x52e7d0[_0x6f14('0x46')]=[{'all':!![]}];}_0x52e7d0=_['merge']({},_0x52e7d0,_0x58b78c['options']);return db[_0x6f14('0x2f')][_0x6f14('0x47')](_0x52e7d0)[_0x6f14('0x28')](handleEntityNotFound(_0x4cd0c8,null))[_0x6f14('0x28')](respondWithResult(_0x4cd0c8,null))[_0x6f14('0x48')](handleError(_0x4cd0c8,null));};exports['create']=function(_0x6d042f,_0x119ad1){return db['OpenchannelTransferReport'][_0x6f14('0x49')](_0x6d042f[_0x6f14('0x4a')],{})[_0x6f14('0x28')](respondWithResult(_0x119ad1,0xc9))[_0x6f14('0x48')](handleError(_0x119ad1,null));};exports['update']=function(_0x25e374,_0x1cc590){if(_0x25e374[_0x6f14('0x4a')]['id']){delete _0x25e374[_0x6f14('0x4a')]['id'];}return db[_0x6f14('0x2f')][_0x6f14('0x47')]({'where':{'id':_0x25e374[_0x6f14('0x43')]['id']}})[_0x6f14('0x28')](handleEntityNotFound(_0x1cc590,null))[_0x6f14('0x28')](saveUpdates(_0x25e374['body'],null))[_0x6f14('0x28')](respondWithResult(_0x1cc590,null))['catch'](handleError(_0x1cc590,null));};exports[_0x6f14('0x27')]=function(_0x2e946c,_0x498067){return db['OpenchannelTransferReport'][_0x6f14('0x47')]({'where':{'id':_0x2e946c[_0x6f14('0x43')]['id']}})[_0x6f14('0x28')](handleEntityNotFound(_0x498067,null))[_0x6f14('0x28')](removeEntity(_0x498067,null))[_0x6f14('0x48')](handleError(_0x498067,null));};exports[_0x6f14('0x4b')]=function(_0x15aecb,_0x1619c6){return db[_0x6f14('0x2f')]['describe']()[_0x6f14('0x28')](respondWithResult(_0x1619c6,null))[_0x6f14('0x48')](handleError(_0x1619c6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b338b00..89162b7 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 _0x9b8e=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0x9b8e,0x158));var _0xe9b8=function(_0x4c455d,_0x3ddb6a){_0x4c455d=_0x4c455d-0x0;var _0x4fe15b=_0x9b8e[_0x4c455d];return _0x4fe15b;};'use strict';var _=require(_0xe9b8('0x0'));var util=require('util');var logger=require(_0xe9b8('0x1'))(_0xe9b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe9b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9b8('0x4'));var config=require(_0xe9b8('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0xe9b8('0x6')]=function(_0x3d24e3,_0x3f6b50){return _0x3d24e3[_0xe9b8('0x7')](_0xe9b8('0x8'),attributes,{'tableName':_0xe9b8('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf0d=['../../config/environment','./openchannelTransferReport.attributes','report_openchannel_transfer','uniqueid','util','../../config/logger','rimraf'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xaf0d,0x6d));var _0xdaf0=function(_0xccd572,_0x1f8bf0){_0xccd572=_0xccd572-0x0;var _0x462143=_0xaf0d[_0xccd572];return _0x462143;};'use strict';var _=require('lodash');var util=require(_0xdaf0('0x0'));var logger=require(_0xdaf0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf0('0x2'));var config=require(_0xdaf0('0x3'));var attributes=require(_0xdaf0('0x4'));module['exports']=function(_0x35fe4f,_0x14b19d){return _0x35fe4f['define']('OpenchannelTransferReport',attributes,{'tableName':_0xdaf0('0x5'),'paranoid':![],'indexes':[{'name':_0xdaf0('0x6'),'fields':[_0xdaf0('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 19ed3e1..f75f081 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 _0xc504=['http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c034a,_0x131fd6){var _0x176d53=function(_0x1d6a20){while(--_0x1d6a20){_0x5c034a['push'](_0x5c034a['shift']());}};_0x176d53(++_0x131fd6);}(_0xc504,0x16d));var _0x4c50=function(_0x5d10a5,_0x348356){_0x5d10a5=_0x5d10a5-0x0;var _0xf72ff6=_0xc504[_0x5d10a5];return _0xf72ff6;};'use strict';var _=require(_0x4c50('0x0'));var util=require(_0x4c50('0x1'));var moment=require('moment');var BPromise=require(_0x4c50('0x2'));var rs=require(_0x4c50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c50('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c50('0x5'))(_0x4c50('0x6'));var config=require(_0x4c50('0x7'));var jayson=require(_0x4c50('0x8'));var client=jayson['client'][_0x4c50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc2e89,_0x2b58e4,_0x2d644f){return new BPromise(function(_0x2ba43a,_0x8a442a){return client[_0x4c50('0xa')](_0xfc2e89,_0x2d644f)['then'](function(_0xe0ca97){logger[_0x4c50('0xb')](_0x4c50('0xc'),_0x2b58e4,_0x4c50('0xd'));logger[_0x4c50('0xe')](_0x4c50('0xf'),_0x2b58e4,'request\x20sent',JSON[_0x4c50('0x10')](_0xe0ca97));if(_0xe0ca97['error']){if(_0xe0ca97[_0x4c50('0x11')][_0x4c50('0x12')]===0x1f4){logger[_0x4c50('0x11')](_0x4c50('0xc'),_0x2b58e4,_0xe0ca97[_0x4c50('0x11')]['message']);return _0x8a442a(_0xe0ca97['error']['message']);}logger['error'](_0x4c50('0xc'),_0x2b58e4,_0xe0ca97[_0x4c50('0x11')][_0x4c50('0x13')]);return _0x2ba43a(_0xe0ca97['error']['message']);}else{logger[_0x4c50('0xb')](_0x4c50('0xc'),_0x2b58e4,_0x4c50('0xd'));_0x2ba43a(_0xe0ca97[_0x4c50('0x14')][_0x4c50('0x13')]);}})[_0x4c50('0x15')](function(_0x4978a0){logger[_0x4c50('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2b58e4,_0x4978a0);_0x8a442a(_0x4978a0);});});} \ No newline at end of file +var _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x317ae0,_0x300833){var _0x2b8334=function(_0x18db03){while(--_0x18db03){_0x317ae0['push'](_0x317ae0['shift']());}};_0x2b8334(++_0x300833);}(_0x5fd1,0x155));var _0x15fd=function(_0x358198,_0x453e86){_0x358198=_0x358198-0x0;var _0x55d9af=_0x5fd1[_0x358198];return _0x55d9af;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ba1bb56..8b4b506 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 _0x4b02=['get','/:id','create','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index'];(function(_0x3f5a76,_0x52928c){var _0x3dd362=function(_0x19e681){while(--_0x19e681){_0x3f5a76['push'](_0x3f5a76['shift']());}};_0x3dd362(++_0x52928c);}(_0x4b02,0x1f3));var _0x24b0=function(_0x231c6e,_0xf5f7f4){_0x231c6e=_0x231c6e-0x0;var _0x33ea9a=_0x4b02[_0x231c6e];return _0x33ea9a;};'use strict';var multer=require(_0x24b0('0x0'));var util=require(_0x24b0('0x1'));var path=require(_0x24b0('0x2'));var timeout=require(_0x24b0('0x3'));var express=require(_0x24b0('0x4'));var router=express['Router']();var auth=require(_0x24b0('0x5'));var interaction=require(_0x24b0('0x6'));var config=require(_0x24b0('0x7'));var controller=require(_0x24b0('0x8'));router['get']('/',auth[_0x24b0('0x9')](),controller[_0x24b0('0xa')]);router[_0x24b0('0xb')](_0x24b0('0xc'),auth[_0x24b0('0x9')](),controller['show']);router['post']('/',auth[_0x24b0('0x9')](),controller[_0x24b0('0xd')]);router[_0x24b0('0xe')](_0x24b0('0xc'),auth[_0x24b0('0x9')](),controller[_0x24b0('0xf')]);router['delete'](_0x24b0('0xc'),auth[_0x24b0('0x9')](),controller['destroy']);module[_0x24b0('0x10')]=router; \ No newline at end of file +var _0x0df6=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x2e0056,_0x161e50){var _0x3f0c26=function(_0x1b91f4){while(--_0x1b91f4){_0x2e0056['push'](_0x2e0056['shift']());}};_0x3f0c26(++_0x161e50);}(_0x0df6,0xc7));var _0x60df=function(_0xd917c5,_0x455da5){_0xd917c5=_0xd917c5-0x0;var _0x55ebde=_0x0df6[_0xd917c5];return _0x55ebde;};'use strict';var multer=require(_0x60df('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(_0x60df('0x1'));var interaction=require(_0x60df('0x2'));var config=require(_0x60df('0x3'));var controller=require(_0x60df('0x4'));router[_0x60df('0x5')]('/',auth[_0x60df('0x6')](),controller[_0x60df('0x7')]);router['get'](_0x60df('0x8'),auth[_0x60df('0x6')](),controller[_0x60df('0x9')]);router[_0x60df('0xa')]('/',auth[_0x60df('0x6')](),controller[_0x60df('0xb')]);router[_0x60df('0xc')]('/:id',auth[_0x60df('0x6')](),controller[_0x60df('0xd')]);router[_0x60df('0xe')](_0x60df('0x8'),auth['isAuthenticated'](),controller[_0x60df('0xf')]);module[_0x60df('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 020012c..87deaf5 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 _0xb72a=['name'];(function(_0x262ae9,_0x19d380){var _0x5414f2=function(_0x482612){while(--_0x482612){_0x262ae9['push'](_0x262ae9['shift']());}};_0x5414f2(++_0x19d380);}(_0xb72a,0x190));var _0xab72=function(_0x4035f5,_0x577df7){_0x4035f5=_0x4035f5-0x0;var _0x59fb43=_0xb72a[_0x4035f5];return _0x59fb43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xab72('0x0'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x31db=['STRING','name','sequelize','exports'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x31db,0x116));var _0xb31d=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x31db[_0x79b649];return _0x1af9b1;};'use strict';var Sequelize=require(_0xb31d('0x0'));module[_0xb31d('0x1')]={'name':{'type':Sequelize[_0xb31d('0x2')],'unique':_0xb31d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb31d('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index fa500b1..48aaaf8 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 _0x3dee=['count','offset','limit','set','json','apply','then','destroy','get','Pauses','error','stack','name','send','index','map','Pause','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x2bdb28,_0x140b07){var _0xec9a20=function(_0x12783c){while(--_0x12783c){_0x2bdb28['push'](_0x2bdb28['shift']());}};_0xec9a20(++_0x140b07);}(_0x3dee,0x1d0));var _0xe3de=function(_0x46dfe8,_0x7dfb25){_0x46dfe8=_0x46dfe8-0x0;var _0x3e7893=_0x3dee[_0x46dfe8];return _0x3e7893;};'use strict';var pdf=require(_0xe3de('0x0'));var emlformat=require(_0xe3de('0x1'));var rimraf=require(_0xe3de('0x2'));var zipdir=require(_0xe3de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3de('0x4'));var moment=require(_0xe3de('0x5'));var BPromise=require(_0xe3de('0x6'));var Mustache=require(_0xe3de('0x7'));var util=require(_0xe3de('0x8'));var path=require(_0xe3de('0x9'));var sox=require('sox');var csv=require(_0xe3de('0xa'));var ejs=require(_0xe3de('0xb'));var fs=require('fs');var _=require(_0xe3de('0xc'));var squel=require(_0xe3de('0xd'));var crypto=require(_0xe3de('0xe'));var jsforce=require(_0xe3de('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe3de('0xa'));var querystring=require(_0xe3de('0x10'));var Papa=require(_0xe3de('0x11'));var Redis=require('ioredis');var authService=require(_0xe3de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe3de('0x13'));var hardwareService=require(_0xe3de('0x14'));var logger=require('../../config/logger')(_0xe3de('0x15'));var utils=require(_0xe3de('0x16'));var config=require(_0xe3de('0x17'));var db=require(_0xe3de('0x18'))['db'];function respondWithStatusCode(_0x12ae2b,_0x5d39fc){_0x5d39fc=_0x5d39fc||0xcc;return function(_0xaa4f02){if(_0xaa4f02){return _0x12ae2b[_0xe3de('0x19')](_0x5d39fc);}return _0x12ae2b[_0xe3de('0x1a')](_0x5d39fc)[_0xe3de('0x1b')]();};}function respondWithResult(_0x2cbb6d,_0x4df5df){_0x4df5df=_0x4df5df||0xc8;return function(_0x267522){if(_0x267522){return _0x2cbb6d[_0xe3de('0x1a')](_0x4df5df)['json'](_0x267522);}};}function respondWithFilteredResult(_0x3a1ce2,_0x80da05){return function(_0x1d97e3){if(_0x1d97e3){var _0x44b9c8=_0x1d97e3[_0xe3de('0x1c')],_0x1a43f7=_0x80da05[_0xe3de('0x1d')],_0x4594d8=_0x80da05[_0xe3de('0x1d')]+_0x80da05[_0xe3de('0x1e')],_0x36ca18;if(_0x4594d8>=_0x44b9c8){_0x4594d8=_0x44b9c8;_0x36ca18=0xc8;}else{_0x36ca18=0xce;}_0x3a1ce2[_0xe3de('0x1a')](_0x36ca18);return _0x3a1ce2[_0xe3de('0x1f')]('Content-Range',_0x1a43f7+'-'+_0x4594d8+'/'+_0x44b9c8)[_0xe3de('0x20')](_0x1d97e3);}return null;};}function patchUpdates(_0x5312e7){return function(_0x17fdc2){try{jsonpatch[_0xe3de('0x21')](_0x17fdc2,_0x5312e7,!![]);}catch(_0x388d1c){return BPromise['reject'](_0x388d1c);}return _0x17fdc2['save']();};}function saveUpdates(_0x6b80fd,_0x329c78){return function(_0x95fcdc){if(_0x95fcdc){return _0x95fcdc['update'](_0x6b80fd)[_0xe3de('0x22')](function(_0x42df60){return _0x42df60;});}return null;};}function removeEntity(_0xa7548c,_0x5d0abb){return function(_0x54f552){if(_0x54f552){return _0x54f552[_0xe3de('0x23')]()[_0xe3de('0x22')](function(){var _0x213093=_0x54f552[_0xe3de('0x24')]({'plain':!![]});var _0x1d457b=_0xe3de('0x25');return db['UserProfileResource'][_0xe3de('0x23')]({'where':{'type':_0x1d457b,'resourceId':_0x213093['id']}})[_0xe3de('0x22')](function(){return _0x54f552;});})['then'](function(){_0xa7548c['status'](0xcc)[_0xe3de('0x1b')]();});}};}function handleEntityNotFound(_0x399582,_0x20b7b7){return function(_0x51f186){if(!_0x51f186){_0x399582['sendStatus'](0x194);}return _0x51f186;};}function handleError(_0x3bd006,_0x21eb81){_0x21eb81=_0x21eb81||0x1f4;return function(_0x2a876e){logger[_0xe3de('0x26')](_0x2a876e[_0xe3de('0x27')]);if(_0x2a876e[_0xe3de('0x28')]){delete _0x2a876e[_0xe3de('0x28')];}_0x3bd006[_0xe3de('0x1a')](_0x21eb81)[_0xe3de('0x29')](_0x2a876e);};}exports[_0xe3de('0x2a')]=function(_0x3fb597,_0x2fcbfb){var _0x546764={},_0x1028cb={},_0x1ce770={'count':0x0,'rows':[]};var _0x5056ea=_[_0xe3de('0x2b')](db[_0xe3de('0x2c')]['rawAttributes'],function(_0x3a3fd0){return{'name':_0x3a3fd0[_0xe3de('0x2d')],'type':_0x3a3fd0[_0xe3de('0x2e')][_0xe3de('0x2f')]};});_0x1028cb[_0xe3de('0x30')]=_[_0xe3de('0x2b')](_0x5056ea,_0xe3de('0x28'));_0x1028cb['query']=_[_0xe3de('0x31')](_0x3fb597['query']);_0x1028cb[_0xe3de('0x32')]=_[_0xe3de('0x33')](_0x1028cb[_0xe3de('0x30')],_0x1028cb[_0xe3de('0x34')]);_0x546764[_0xe3de('0x35')]=_['intersection'](_0x1028cb[_0xe3de('0x30')],qs[_0xe3de('0x36')](_0x3fb597[_0xe3de('0x34')][_0xe3de('0x36')]));_0x546764[_0xe3de('0x35')]=_0x546764['attributes']['length']?_0x546764[_0xe3de('0x35')]:_0x1028cb[_0xe3de('0x30')];if(!_0x3fb597[_0xe3de('0x34')][_0xe3de('0x37')](_0xe3de('0x38'))){_0x546764[_0xe3de('0x1e')]=qs['limit'](_0x3fb597['query'][_0xe3de('0x1e')]);_0x546764['offset']=qs[_0xe3de('0x1d')](_0x3fb597[_0xe3de('0x34')]['offset']);}_0x546764[_0xe3de('0x39')]=qs[_0xe3de('0x3a')](_0x3fb597[_0xe3de('0x34')][_0xe3de('0x3a')]);_0x546764[_0xe3de('0x3b')]=qs[_0xe3de('0x32')](_[_0xe3de('0x3c')](_0x3fb597['query'],_0x1028cb['filters']),_0x5056ea);if(_0x3fb597[_0xe3de('0x34')][_0xe3de('0x3d')]){_0x546764[_0xe3de('0x3b')]=_[_0xe3de('0x3e')](_0x546764[_0xe3de('0x3b')],{'$or':_['map'](_0x5056ea,function(_0x431cf5){if(_0x431cf5[_0xe3de('0x2e')]!=='VIRTUAL'){var _0x1a0ba4={};_0x1a0ba4[_0x431cf5[_0xe3de('0x28')]]={'$like':'%'+_0x3fb597['query'][_0xe3de('0x3d')]+'%'};return _0x1a0ba4;}})});}_0x546764=_[_0xe3de('0x3e')]({},_0x546764,_0x3fb597[_0xe3de('0x3f')]);var _0x2a492b={'where':_0x546764[_0xe3de('0x3b')]};return db[_0xe3de('0x2c')][_0xe3de('0x1c')](_0x2a492b)[_0xe3de('0x22')](function(_0x5accb3){_0x1ce770[_0xe3de('0x1c')]=_0x5accb3;if(_0x3fb597[_0xe3de('0x34')]['includeAll']){_0x546764['include']=[{'all':!![]}];}return db[_0xe3de('0x2c')][_0xe3de('0x40')](_0x546764);})[_0xe3de('0x22')](function(_0x385c9c){_0x1ce770[_0xe3de('0x41')]=_0x385c9c;return _0x1ce770;})['then'](respondWithFilteredResult(_0x2fcbfb,_0x546764))[_0xe3de('0x42')](handleError(_0x2fcbfb,null));};exports[_0xe3de('0x43')]=function(_0x1185d7,_0x3d8413){var _0x2520bf={'raw':!![],'where':{'id':_0x1185d7[_0xe3de('0x44')]['id']}},_0x40e1ba={};_0x40e1ba[_0xe3de('0x30')]=_['keys'](db[_0xe3de('0x2c')][_0xe3de('0x45')]);_0x40e1ba[_0xe3de('0x34')]=_[_0xe3de('0x31')](_0x1185d7[_0xe3de('0x34')]);_0x40e1ba[_0xe3de('0x32')]=_[_0xe3de('0x33')](_0x40e1ba[_0xe3de('0x30')],_0x40e1ba['query']);_0x2520bf[_0xe3de('0x35')]=_[_0xe3de('0x33')](_0x40e1ba[_0xe3de('0x30')],qs['fields'](_0x1185d7['query'][_0xe3de('0x36')]));_0x2520bf[_0xe3de('0x35')]=_0x2520bf[_0xe3de('0x35')]['length']?_0x2520bf[_0xe3de('0x35')]:_0x40e1ba[_0xe3de('0x30')];if(_0x1185d7[_0xe3de('0x34')][_0xe3de('0x46')]){_0x2520bf[_0xe3de('0x47')]=[{'all':!![]}];}_0x2520bf=_[_0xe3de('0x3e')]({},_0x2520bf,_0x1185d7[_0xe3de('0x3f')]);return db['Pause'][_0xe3de('0x48')](_0x2520bf)[_0xe3de('0x22')](handleEntityNotFound(_0x3d8413,null))[_0xe3de('0x22')](respondWithResult(_0x3d8413,null))[_0xe3de('0x42')](handleError(_0x3d8413,null));};exports[_0xe3de('0x49')]=function(_0x2871af,_0x5bb163){return db[_0xe3de('0x2c')][_0xe3de('0x49')](_0x2871af[_0xe3de('0x4a')],{})['then'](function(_0x474f15){var _0x4c305d=_0x2871af['user'][_0xe3de('0x24')]({'plain':!![]});if(!_0x4c305d)throw new Error(_0xe3de('0x4b'));if(_0x4c305d['role']==='user'){var _0x18c05f=_0x474f15[_0xe3de('0x24')]({'plain':!![]});var _0x48b609='Pauses';return db[_0xe3de('0x4c')]['find']({'where':{'name':_0x48b609,'userProfileId':_0x4c305d[_0xe3de('0x4d')]},'raw':!![]})['then'](function(_0x17eaee){if(_0x17eaee&&_0x17eaee[_0xe3de('0x4e')]===0x0){return db[_0xe3de('0x4f')][_0xe3de('0x49')]({'name':_0x18c05f[_0xe3de('0x28')],'resourceId':_0x18c05f['id'],'type':_0x17eaee[_0xe3de('0x28')],'sectionId':_0x17eaee['id']},{})[_0xe3de('0x22')](function(){return _0x474f15;});}else{return _0x474f15;}})[_0xe3de('0x42')](function(_0x38f84e){logger[_0xe3de('0x26')](_0xe3de('0x50'),_0x38f84e);throw _0x38f84e;});}return _0x474f15;})[_0xe3de('0x22')](respondWithResult(_0x5bb163,0xc9))[_0xe3de('0x42')](handleError(_0x5bb163,null));};exports[_0xe3de('0x51')]=function(_0x287ac7,_0x5a0e74){if(_0x287ac7[_0xe3de('0x4a')]['id']){delete _0x287ac7[_0xe3de('0x4a')]['id'];}return db[_0xe3de('0x2c')][_0xe3de('0x48')]({'where':{'id':_0x287ac7['params']['id']}})[_0xe3de('0x22')](handleEntityNotFound(_0x5a0e74,null))['then'](saveUpdates(_0x287ac7[_0xe3de('0x4a')],null))[_0xe3de('0x22')](respondWithResult(_0x5a0e74,null))[_0xe3de('0x42')](handleError(_0x5a0e74,null));};exports[_0xe3de('0x23')]=function(_0x1d28af,_0x3d7685){return db[_0xe3de('0x2c')]['find']({'where':{'id':_0x1d28af['params']['id']}})[_0xe3de('0x22')](handleEntityNotFound(_0x3d7685,null))[_0xe3de('0x22')](removeEntity(_0x3d7685,null))[_0xe3de('0x42')](handleError(_0x3d7685,null));}; \ No newline at end of file +var _0x523d=['bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','Pauses','end','error','stack','name','index','Pause','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4cb51b,_0x1d77a8){var _0x4d8b66=function(_0x2a4c89){while(--_0x2a4c89){_0x4cb51b['push'](_0x4cb51b['shift']());}};_0x4d8b66(++_0x1d77a8);}(_0x523d,0x19d));var _0xd523=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x523d[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xd523('0x0'));var emlformat=require(_0xd523('0x1'));var rimraf=require(_0xd523('0x2'));var zipdir=require(_0xd523('0x3'));var jsonpatch=require(_0xd523('0x4'));var rp=require(_0xd523('0x5'));var moment=require(_0xd523('0x6'));var BPromise=require(_0xd523('0x7'));var Mustache=require(_0xd523('0x8'));var util=require(_0xd523('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xd523('0xa'));var ejs=require(_0xd523('0xb'));var fs=require('fs');var _=require(_0xd523('0xc'));var squel=require(_0xd523('0xd'));var crypto=require(_0xd523('0xe'));var jsforce=require(_0xd523('0xf'));var deskjs=require(_0xd523('0x10'));var toCsv=require(_0xd523('0xa'));var querystring=require(_0xd523('0x11'));var Papa=require('papaparse');var Redis=require(_0xd523('0x12'));var authService=require(_0xd523('0x13'));var qs=require(_0xd523('0x14'));var as=require(_0xd523('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd523('0x16'))('api');var utils=require(_0xd523('0x17'));var config=require(_0xd523('0x18'));var db=require(_0xd523('0x19'))['db'];function respondWithStatusCode(_0x384d6e,_0x582fe7){_0x582fe7=_0x582fe7||0xcc;return function(_0x17e52a){if(_0x17e52a){return _0x384d6e[_0xd523('0x1a')](_0x582fe7);}return _0x384d6e[_0xd523('0x1b')](_0x582fe7)['end']();};}function respondWithResult(_0x20a04b,_0x5bd8ba){_0x5bd8ba=_0x5bd8ba||0xc8;return function(_0x120982){if(_0x120982){return _0x20a04b[_0xd523('0x1b')](_0x5bd8ba)[_0xd523('0x1c')](_0x120982);}};}function respondWithFilteredResult(_0x2720f2,_0x2b08e6){return function(_0xefdf71){if(_0xefdf71){var _0x2d561b=_0xefdf71[_0xd523('0x1d')],_0x329819=_0x2b08e6[_0xd523('0x1e')],_0x4116c9=_0x2b08e6['offset']+_0x2b08e6[_0xd523('0x1f')],_0x129481;if(_0x4116c9>=_0x2d561b){_0x4116c9=_0x2d561b;_0x129481=0xc8;}else{_0x129481=0xce;}_0x2720f2[_0xd523('0x1b')](_0x129481);return _0x2720f2[_0xd523('0x20')]('Content-Range',_0x329819+'-'+_0x4116c9+'/'+_0x2d561b)[_0xd523('0x1c')](_0xefdf71);}return null;};}function patchUpdates(_0x526d5c){return function(_0x31519d){try{jsonpatch[_0xd523('0x21')](_0x31519d,_0x526d5c,!![]);}catch(_0x27b515){return BPromise[_0xd523('0x22')](_0x27b515);}return _0x31519d['save']();};}function saveUpdates(_0x316bc8,_0x16c60a){return function(_0x5c9cf8){if(_0x5c9cf8){return _0x5c9cf8[_0xd523('0x23')](_0x316bc8)[_0xd523('0x24')](function(_0x3fcac7){return _0x3fcac7;});}return null;};}function removeEntity(_0x37a38c,_0x825456){return function(_0x569364){if(_0x569364){return _0x569364[_0xd523('0x25')]()[_0xd523('0x24')](function(){var _0x96ccc9=_0x569364['get']({'plain':!![]});var _0x21f416=_0xd523('0x26');return db['UserProfileResource'][_0xd523('0x25')]({'where':{'type':_0x21f416,'resourceId':_0x96ccc9['id']}})['then'](function(){return _0x569364;});})[_0xd523('0x24')](function(){_0x37a38c[_0xd523('0x1b')](0xcc)[_0xd523('0x27')]();});}};}function handleEntityNotFound(_0xe2d5f8,_0x166192){return function(_0x2d455b){if(!_0x2d455b){_0xe2d5f8[_0xd523('0x1a')](0x194);}return _0x2d455b;};}function handleError(_0xbc7c07,_0x39a7e5){_0x39a7e5=_0x39a7e5||0x1f4;return function(_0xd20b43){logger[_0xd523('0x28')](_0xd20b43[_0xd523('0x29')]);if(_0xd20b43[_0xd523('0x2a')]){delete _0xd20b43[_0xd523('0x2a')];}_0xbc7c07[_0xd523('0x1b')](_0x39a7e5)['send'](_0xd20b43);};}exports[_0xd523('0x2b')]=function(_0xe74381,_0x468ca1){var _0x20013f={},_0x35e3f8={},_0xcb7ea7={'count':0x0,'rows':[]};var _0x170c2f=_['map'](db[_0xd523('0x2c')]['rawAttributes'],function(_0x3d3f85){return{'name':_0x3d3f85[_0xd523('0x2d')],'type':_0x3d3f85['type']['key']};});_0x35e3f8[_0xd523('0x2e')]=_[_0xd523('0x2f')](_0x170c2f,_0xd523('0x2a'));_0x35e3f8[_0xd523('0x30')]=_['keys'](_0xe74381[_0xd523('0x30')]);_0x35e3f8[_0xd523('0x31')]=_[_0xd523('0x32')](_0x35e3f8['model'],_0x35e3f8[_0xd523('0x30')]);_0x20013f[_0xd523('0x33')]=_[_0xd523('0x32')](_0x35e3f8[_0xd523('0x2e')],qs['fields'](_0xe74381[_0xd523('0x30')][_0xd523('0x34')]));_0x20013f[_0xd523('0x33')]=_0x20013f[_0xd523('0x33')][_0xd523('0x35')]?_0x20013f['attributes']:_0x35e3f8[_0xd523('0x2e')];if(!_0xe74381[_0xd523('0x30')][_0xd523('0x36')](_0xd523('0x37'))){_0x20013f['limit']=qs[_0xd523('0x1f')](_0xe74381[_0xd523('0x30')]['limit']);_0x20013f['offset']=qs[_0xd523('0x1e')](_0xe74381['query'][_0xd523('0x1e')]);}_0x20013f[_0xd523('0x38')]=qs[_0xd523('0x39')](_0xe74381['query'][_0xd523('0x39')]);_0x20013f['where']=qs[_0xd523('0x31')](_[_0xd523('0x3a')](_0xe74381[_0xd523('0x30')],_0x35e3f8[_0xd523('0x31')]),_0x170c2f);if(_0xe74381[_0xd523('0x30')]['filter']){_0x20013f['where']=_[_0xd523('0x3b')](_0x20013f[_0xd523('0x3c')],{'$or':_[_0xd523('0x2f')](_0x170c2f,function(_0x195933){if(_0x195933[_0xd523('0x3d')]!==_0xd523('0x3e')){var _0x550452={};_0x550452[_0x195933[_0xd523('0x2a')]]={'$like':'%'+_0xe74381['query']['filter']+'%'};return _0x550452;}})});}_0x20013f=_[_0xd523('0x3b')]({},_0x20013f,_0xe74381[_0xd523('0x3f')]);var _0x5cc841={'where':_0x20013f[_0xd523('0x3c')]};return db['Pause'][_0xd523('0x1d')](_0x5cc841)['then'](function(_0x31d344){_0xcb7ea7['count']=_0x31d344;if(_0xe74381[_0xd523('0x30')][_0xd523('0x40')]){_0x20013f['include']=[{'all':!![]}];}return db['Pause'][_0xd523('0x41')](_0x20013f);})[_0xd523('0x24')](function(_0x1ee326){_0xcb7ea7[_0xd523('0x42')]=_0x1ee326;return _0xcb7ea7;})[_0xd523('0x24')](respondWithFilteredResult(_0x468ca1,_0x20013f))['catch'](handleError(_0x468ca1,null));};exports[_0xd523('0x43')]=function(_0x2ff5c0,_0x34fa8e){var _0xbc1445={'raw':!![],'where':{'id':_0x2ff5c0[_0xd523('0x44')]['id']}},_0x5edd62={};_0x5edd62[_0xd523('0x2e')]=_[_0xd523('0x45')](db[_0xd523('0x2c')][_0xd523('0x46')]);_0x5edd62[_0xd523('0x30')]=_[_0xd523('0x45')](_0x2ff5c0[_0xd523('0x30')]);_0x5edd62[_0xd523('0x31')]=_[_0xd523('0x32')](_0x5edd62[_0xd523('0x2e')],_0x5edd62[_0xd523('0x30')]);_0xbc1445[_0xd523('0x33')]=_['intersection'](_0x5edd62[_0xd523('0x2e')],qs[_0xd523('0x34')](_0x2ff5c0[_0xd523('0x30')][_0xd523('0x34')]));_0xbc1445[_0xd523('0x33')]=_0xbc1445[_0xd523('0x33')][_0xd523('0x35')]?_0xbc1445[_0xd523('0x33')]:_0x5edd62[_0xd523('0x2e')];if(_0x2ff5c0['query'][_0xd523('0x40')]){_0xbc1445[_0xd523('0x47')]=[{'all':!![]}];}_0xbc1445=_[_0xd523('0x3b')]({},_0xbc1445,_0x2ff5c0['options']);return db['Pause'][_0xd523('0x48')](_0xbc1445)['then'](handleEntityNotFound(_0x34fa8e,null))[_0xd523('0x24')](respondWithResult(_0x34fa8e,null))[_0xd523('0x49')](handleError(_0x34fa8e,null));};exports['create']=function(_0x59e0a4,_0x140b15){return db[_0xd523('0x2c')][_0xd523('0x4a')](_0x59e0a4['body'],{})['then'](function(_0x4b0e9e){var _0x56c334=_0x59e0a4[_0xd523('0x4b')][_0xd523('0x4c')]({'plain':!![]});if(!_0x56c334)throw new Error(_0xd523('0x4d'));if(_0x56c334[_0xd523('0x4e')]===_0xd523('0x4b')){var _0x48f7a2=_0x4b0e9e[_0xd523('0x4c')]({'plain':!![]});var _0x486dbe=_0xd523('0x26');return db[_0xd523('0x4f')][_0xd523('0x48')]({'where':{'name':_0x486dbe,'userProfileId':_0x56c334[_0xd523('0x50')]},'raw':!![]})[_0xd523('0x24')](function(_0x2e415e){if(_0x2e415e&&_0x2e415e[_0xd523('0x51')]===0x0){return db[_0xd523('0x52')][_0xd523('0x4a')]({'name':_0x48f7a2[_0xd523('0x2a')],'resourceId':_0x48f7a2['id'],'type':_0x2e415e['name'],'sectionId':_0x2e415e['id']},{})['then'](function(){return _0x4b0e9e;});}else{return _0x4b0e9e;}})[_0xd523('0x49')](function(_0x10b86e){logger[_0xd523('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10b86e);throw _0x10b86e;});}return _0x4b0e9e;})['then'](respondWithResult(_0x140b15,0xc9))[_0xd523('0x49')](handleError(_0x140b15,null));};exports[_0xd523('0x23')]=function(_0x2c995f,_0x23ad99){if(_0x2c995f[_0xd523('0x53')]['id']){delete _0x2c995f[_0xd523('0x53')]['id'];}return db['Pause']['find']({'where':{'id':_0x2c995f[_0xd523('0x44')]['id']}})['then'](handleEntityNotFound(_0x23ad99,null))[_0xd523('0x24')](saveUpdates(_0x2c995f[_0xd523('0x53')],null))[_0xd523('0x24')](respondWithResult(_0x23ad99,null))['catch'](handleError(_0x23ad99,null));};exports['destroy']=function(_0x1af5cb,_0x4a94b3){return db[_0xd523('0x2c')][_0xd523('0x48')]({'where':{'id':_0x1af5cb['params']['id']}})[_0xd523('0x24')](handleEntityNotFound(_0x4a94b3,null))[_0xd523('0x24')](removeEntity(_0x4a94b3,null))[_0xd523('0x49')](handleError(_0x4a94b3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2822be3..8112231 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 _0x53a2=['define','Pause','tools_pauses','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./pause.attributes','exports'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x53a2,0x92));var _0x253a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x53a2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x253a('0x0'));var util=require('util');var logger=require(_0x253a('0x1'))('api');var moment=require(_0x253a('0x2'));var BPromise=require(_0x253a('0x3'));var rp=require(_0x253a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x253a('0x5'));var config=require('../../config/environment');var attributes=require(_0x253a('0x6'));module[_0x253a('0x7')]=function(_0x2b19cf,_0x2493dc){return _0x2b19cf[_0x253a('0x8')](_0x253a('0x9'),attributes,{'tableName':_0x253a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2505=['rimraf','./pause.attributes','exports','define','Pause','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x2505,0x94));var _0x5250=function(_0x347c10,_0x5d9283){_0x347c10=_0x347c10-0x0;var _0x3dae01=_0x2505[_0x347c10];return _0x3dae01;};'use strict';var _=require(_0x5250('0x0'));var util=require(_0x5250('0x1'));var logger=require(_0x5250('0x2'))('api');var moment=require(_0x5250('0x3'));var BPromise=require(_0x5250('0x4'));var rp=require(_0x5250('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5250('0x6'));var config=require('../../config/environment');var attributes=require(_0x5250('0x7'));module[_0x5250('0x8')]=function(_0x2bbd8b,_0x288754){return _0x2bbd8b[_0x5250('0x9')](_0x5250('0xa'),attributes,{'tableName':'tools_pauses','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 eaa21d9..543fe4c 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 _0x0911=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowPause','Pause','find','options','raw','attributes','include','map','model','debug','stringify','lodash','util','moment','bluebird'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x0911,0x1a9));var _0x1091=function(_0x2d64fc,_0x42b2a7){_0x2d64fc=_0x2d64fc-0x0;var _0x2c8556=_0x0911[_0x2d64fc];return _0x2c8556;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var moment=require(_0x1091('0x2'));var BPromise=require(_0x1091('0x3'));var rs=require(_0x1091('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1091('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1091('0x6'))(_0x1091('0x7'));var config=require(_0x1091('0x8'));var jayson=require(_0x1091('0x9'));var client=jayson[_0x1091('0xa')][_0x1091('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ad19a,_0x2acbb4,_0x7b3a7d){return new BPromise(function(_0x457631,_0x4b2a13){return client[_0x1091('0xc')](_0x2ad19a,_0x7b3a7d)[_0x1091('0xd')](function(_0x33d6cd){logger[_0x1091('0xe')](_0x1091('0xf'),_0x2acbb4,_0x1091('0x10'));logger['debug'](_0x1091('0x11'),_0x2acbb4,_0x1091('0x10'),JSON['stringify'](_0x33d6cd));if(_0x33d6cd['error']){if(_0x33d6cd[_0x1091('0x12')]['code']===0x1f4){logger[_0x1091('0x12')]('Pause,\x20%s,\x20%s',_0x2acbb4,_0x33d6cd[_0x1091('0x12')][_0x1091('0x13')]);return _0x4b2a13(_0x33d6cd[_0x1091('0x12')][_0x1091('0x13')]);}logger['error'](_0x1091('0xf'),_0x2acbb4,_0x33d6cd[_0x1091('0x12')]['message']);return _0x457631(_0x33d6cd['error']['message']);}else{logger['info'](_0x1091('0xf'),_0x2acbb4,_0x1091('0x10'));_0x457631(_0x33d6cd[_0x1091('0x14')]['message']);}})[_0x1091('0x15')](function(_0xf69de4){logger[_0x1091('0x12')](_0x1091('0xf'),_0x2acbb4,_0xf69de4);_0x4b2a13(_0xf69de4);});});}exports[_0x1091('0x16')]=function(_0x5c01c3){var _0x841623=this;return new Promise(function(_0x46e3d5,_0x2b0fda){return db[_0x1091('0x17')][_0x1091('0x18')]({'raw':_0x5c01c3['options']?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c01c3['options']?_0x5c01c3['options']['where']||null:null,'attributes':_0x5c01c3[_0x1091('0x19')]?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1b')]||null:null,'include':_0x5c01c3[_0x1091('0x19')]?_0x5c01c3[_0x1091('0x19')][_0x1091('0x1c')]?_[_0x1091('0x1d')](_0x5c01c3[_0x1091('0x19')][_0x1091('0x1c')],function(_0x12691c){return{'model':db[_0x12691c[_0x1091('0x1e')]],'as':_0x12691c['as'],'attributes':_0x12691c[_0x1091('0x1b')],'include':_0x12691c[_0x1091('0x1c')]?_[_0x1091('0x1d')](_0x12691c[_0x1091('0x1c')],function(_0x371f83){return{'model':db[_0x371f83['model']],'as':_0x371f83['as'],'attributes':_0x371f83[_0x1091('0x1b')],'include':_0x371f83[_0x1091('0x1c')]?_[_0x1091('0x1d')](_0x371f83['include'],function(_0x2a74cc){return{'model':db[_0x2a74cc['model']],'as':_0x2a74cc['as'],'attributes':_0x2a74cc[_0x1091('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1091('0xd')](function(_0x15eb8d){logger[_0x1091('0xe')]('ShowPause',_0x5c01c3);logger[_0x1091('0x1f')](_0x1091('0x16'),_0x5c01c3,JSON[_0x1091('0x20')](_0x15eb8d));_0x46e3d5(_0x15eb8d);})[_0x1091('0x15')](function(_0x17e118){logger[_0x1091('0x12')]('ShowPause',_0x17e118[_0x1091('0x13')],_0x5c01c3);_0x2b0fda(_0x841623[_0x1091('0x12')](0x1f4,_0x17e118[_0x1091('0x13')]));});});}; \ No newline at end of file +var _0xdf71=['debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','catch','Pause','find','raw','options','where','include','map','attributes','model','ShowPause','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x2452eb,_0x175755){var _0x4a0472=function(_0x380b24){while(--_0x380b24){_0x2452eb['push'](_0x2452eb['shift']());}};_0x4a0472(++_0x175755);}(_0xdf71,0x1d2));var _0x1df7=function(_0x27f49f,_0x267fef){_0x27f49f=_0x27f49f-0x0;var _0x33fd6c=_0xdf71[_0x27f49f];return _0x33fd6c;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var moment=require(_0x1df7('0x1'));var BPromise=require(_0x1df7('0x2'));var rs=require(_0x1df7('0x3'));var fs=require('fs');var Redis=require(_0x1df7('0x4'));var db=require(_0x1df7('0x5'))['db'];var utils=require(_0x1df7('0x6'));var logger=require(_0x1df7('0x7'))('rpc');var config=require(_0x1df7('0x8'));var jayson=require(_0x1df7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa181be,_0x83a93e,_0x5efc98){return new BPromise(function(_0x1b4655,_0x542f22){return client[_0x1df7('0xa')](_0xa181be,_0x5efc98)[_0x1df7('0xb')](function(_0xb67a84){logger[_0x1df7('0xc')]('Pause,\x20%s,\x20%s',_0x83a93e,_0x1df7('0xd'));logger[_0x1df7('0xe')](_0x1df7('0xf'),_0x83a93e,_0x1df7('0xd'),JSON[_0x1df7('0x10')](_0xb67a84));if(_0xb67a84[_0x1df7('0x11')]){if(_0xb67a84['error'][_0x1df7('0x12')]===0x1f4){logger['error'](_0x1df7('0x13'),_0x83a93e,_0xb67a84[_0x1df7('0x11')][_0x1df7('0x14')]);return _0x542f22(_0xb67a84[_0x1df7('0x11')][_0x1df7('0x14')]);}logger['error'](_0x1df7('0x13'),_0x83a93e,_0xb67a84[_0x1df7('0x11')][_0x1df7('0x14')]);return _0x1b4655(_0xb67a84['error']['message']);}else{logger[_0x1df7('0xc')]('Pause,\x20%s,\x20%s',_0x83a93e,_0x1df7('0xd'));_0x1b4655(_0xb67a84['result'][_0x1df7('0x14')]);}})[_0x1df7('0x15')](function(_0x450253){logger[_0x1df7('0x11')](_0x1df7('0x13'),_0x83a93e,_0x450253);_0x542f22(_0x450253);});});}exports['ShowPause']=function(_0x3a3428){var _0x3535d6=this;return new Promise(function(_0xac4787,_0x15bfad){return db[_0x1df7('0x16')][_0x1df7('0x17')]({'raw':_0x3a3428['options']?_0x3a3428['options'][_0x1df7('0x18')]===undefined?!![]:![]:!![],'where':_0x3a3428[_0x1df7('0x19')]?_0x3a3428[_0x1df7('0x19')][_0x1df7('0x1a')]||null:null,'attributes':_0x3a3428[_0x1df7('0x19')]?_0x3a3428[_0x1df7('0x19')]['attributes']||null:null,'include':_0x3a3428[_0x1df7('0x19')]?_0x3a3428[_0x1df7('0x19')][_0x1df7('0x1b')]?_[_0x1df7('0x1c')](_0x3a3428[_0x1df7('0x19')][_0x1df7('0x1b')],function(_0x4945a2){return{'model':db[_0x4945a2['model']],'as':_0x4945a2['as'],'attributes':_0x4945a2[_0x1df7('0x1d')],'include':_0x4945a2[_0x1df7('0x1b')]?_[_0x1df7('0x1c')](_0x4945a2[_0x1df7('0x1b')],function(_0x1d3618){return{'model':db[_0x1d3618[_0x1df7('0x1e')]],'as':_0x1d3618['as'],'attributes':_0x1d3618['attributes'],'include':_0x1d3618[_0x1df7('0x1b')]?_[_0x1df7('0x1c')](_0x1d3618[_0x1df7('0x1b')],function(_0x25b739){return{'model':db[_0x25b739[_0x1df7('0x1e')]],'as':_0x25b739['as'],'attributes':_0x25b739[_0x1df7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1df7('0xb')](function(_0x4fa7bf){logger[_0x1df7('0xc')](_0x1df7('0x1f'),_0x3a3428);logger[_0x1df7('0xe')](_0x1df7('0x1f'),_0x3a3428,JSON[_0x1df7('0x10')](_0x4fa7bf));_0xac4787(_0x4fa7bf);})[_0x1df7('0x15')](function(_0x5d8884){logger['error'](_0x1df7('0x1f'),_0x5d8884['message'],_0x3a3428);_0x15bfad(_0x3535d6[_0x1df7('0x11')](0x1f4,_0x5d8884[_0x1df7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 7b655ad..d4c8788 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 _0x5003=['/:id','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','isAuthenticated','show','download','join','root','originalname','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','put'];(function(_0x25991d,_0x22642c){var _0xd9172b=function(_0x1b8f06){while(--_0x1b8f06){_0x25991d['push'](_0x25991d['shift']());}};_0xd9172b(++_0x22642c);}(_0x5003,0x1d3));var _0x3500=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5003[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3500('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3500('0x1'));var express=require(_0x3500('0x2'));var router=express[_0x3500('0x3')]();var auth=require(_0x3500('0x4'));var interaction=require(_0x3500('0x5'));var config=require(_0x3500('0x6'));var controller=require(_0x3500('0x7'));router[_0x3500('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3500('0x8')](_0x3500('0x9'),controller[_0x3500('0xa')]);router[_0x3500('0x8')]('/:id',auth[_0x3500('0xb')](),controller[_0x3500('0xc')]);router[_0x3500('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3500('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x741af0,_0x79ab41,_0x5b442f){_0x5b442f(null,path[_0x3500('0xe')](config[_0x3500('0xf')],'server/files/plugins'));},'filename':function(_0x411a69,_0x165a11,_0x25b7a0){_0x165a11[_0x3500('0x10')]=_0x165a11[_0x3500('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25b7a0(null,util['format'](_0x3500('0x11'),path[_0x3500('0x12')](_0x165a11[_0x3500('0x10')],path[_0x3500('0x13')](_0x165a11[_0x3500('0x10')])),Date[_0x3500('0x14')](),path[_0x3500('0x13')](_0x165a11[_0x3500('0x10')])));}})});router['post']('/',upload[_0x3500('0x15')](_0x3500('0x16')),controller[_0x3500('0x17')]);router['post'](_0x3500('0x9'),controller[_0x3500('0x18')]);router[_0x3500('0x19')](_0x3500('0x1a'),auth[_0x3500('0xb')](),controller[_0x3500('0x1b')]);router[_0x3500('0x1c')]('/:id',auth[_0x3500('0xb')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x87bd=['express','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','put','update','exports','util','path','connect-timeout'];(function(_0x114402,_0x70c491){var _0x3cd126=function(_0x33a46b){while(--_0x33a46b){_0x114402['push'](_0x114402['shift']());}};_0x3cd126(++_0x70c491);}(_0x87bd,0x19d));var _0xd87b=function(_0x63a69b,_0x296888){_0x63a69b=_0x63a69b-0x0;var _0x425fa1=_0x87bd[_0x63a69b];return _0x425fa1;};'use strict';var multer=require('multer');var util=require(_0xd87b('0x0'));var path=require(_0xd87b('0x1'));var timeout=require(_0xd87b('0x2'));var express=require(_0xd87b('0x3'));var router=express['Router']();var auth=require(_0xd87b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd87b('0x5'));var controller=require(_0xd87b('0x6'));router[_0xd87b('0x7')]('/',auth[_0xd87b('0x8')](),controller[_0xd87b('0x9')]);router[_0xd87b('0x7')](_0xd87b('0xa'),controller[_0xd87b('0xb')]);router[_0xd87b('0x7')](_0xd87b('0xc'),auth[_0xd87b('0x8')](),controller['show']);router[_0xd87b('0x7')](_0xd87b('0xd'),auth[_0xd87b('0x8')](),controller[_0xd87b('0xe')]);var upload=multer({'storage':multer[_0xd87b('0xf')]({'destination':function(_0xd4cc1d,_0xc22994,_0x350655){_0x350655(null,path[_0xd87b('0x10')](config[_0xd87b('0x11')],_0xd87b('0x12')));},'filename':function(_0x281ca8,_0x2eca13,_0x3b2763){_0x2eca13[_0xd87b('0x13')]=_0x2eca13[_0xd87b('0x13')][_0xd87b('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b2763(null,util[_0xd87b('0x15')]('%s-%s%s',path[_0xd87b('0x16')](_0x2eca13['originalname'],path[_0xd87b('0x17')](_0x2eca13[_0xd87b('0x13')])),Date[_0xd87b('0x18')](),path['extname'](_0x2eca13[_0xd87b('0x13')])));}})});router[_0xd87b('0x19')]('/',upload[_0xd87b('0x1a')](_0xd87b('0x1b')),controller[_0xd87b('0x1c')]);router['post'](_0xd87b('0xa'),controller['webhookPost']);router[_0xd87b('0x1d')]('/:id',auth[_0xd87b('0x8')](),controller[_0xd87b('0x1e')]);router['delete']('/:id',auth[_0xd87b('0x8')](),controller['delete']);module[_0xd87b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 3339b18..b95ca8a 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 _0x7ae9=['sequelize','STRING','ENUM','html','script','TEXT','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x328cf3,_0x26a71b){var _0xcec168=function(_0xb0b74c){while(--_0xb0b74c){_0x328cf3['push'](_0x328cf3['shift']());}};_0xcec168(++_0x26a71b);}(_0x7ae9,0x1b8));var _0x97ae=function(_0x4b4dbd,_0x2ba28a){_0x4b4dbd=_0x4b4dbd-0x0;var _0x591334=_0x7ae9[_0x4b4dbd];return _0x591334;};'use strict';var Sequelize=require(_0x97ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x97ae('0x1')]},'type':{'type':Sequelize[_0x97ae('0x2')](_0x97ae('0x3'),_0x97ae('0x4'))},'description':{'type':Sequelize[_0x97ae('0x5')]},'version':{'type':Sequelize[_0x97ae('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x97ae('0x2')](_0x97ae('0x6'),_0x97ae('0x7'),_0x97ae('0x8'),_0x97ae('0x9')),'defaultValue':_0x97ae('0x8'),'comment':_0x97ae('0xa')},'icon':{'type':Sequelize[_0x97ae('0x1')]},'adminUrl':{'type':Sequelize[_0x97ae('0x1')]},'agentUrl':{'type':Sequelize[_0x97ae('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x97ae('0x1')]}}; \ No newline at end of file +var _0x4364=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','exports','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x426b58,_0x11cf3d){var _0xc3c175=function(_0x39093a){while(--_0x39093a){_0x426b58['push'](_0x426b58['shift']());}};_0xc3c175(++_0x11cf3d);}(_0x4364,0xb1));var _0x4436=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4364[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x4436('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4436('0x1')](_0x4436('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4436('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x4436('0x4')},'active':{'type':Sequelize[_0x4436('0x5')],'defaultValue':0x0,'comment':_0x4436('0x6')},'sidebar':{'type':Sequelize[_0x4436('0x1')](_0x4436('0x7'),_0x4436('0x8'),_0x4436('0x9'),_0x4436('0xa')),'defaultValue':'always','comment':_0x4436('0xb')},'icon':{'type':Sequelize[_0x4436('0xc')]},'adminUrl':{'type':Sequelize[_0x4436('0xc')]},'agentUrl':{'type':Sequelize[_0x4436('0xc')]},'scriptName':{'type':Sequelize[_0x4436('0xc')]},'scriptPath':{'type':Sequelize[_0x4436('0xc')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f3129ae..76e69c2 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 _0x1ced=['offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','server/files/plugins','%s.zip','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','root','dirname','basename','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','json','encoding','%s%s','headers','content-length','content-type','endsWith','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','set','Content-Range','reject','then','destroy','get','UserProfileResource','name','index','map','Plugin','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x1c56c1,_0x41a264){var _0x4c0a3d=function(_0x1acaa4){while(--_0x1acaa4){_0x1c56c1['push'](_0x1c56c1['shift']());}};_0x4c0a3d(++_0x41a264);}(_0x1ced,0x1cf));var _0xd1ce=function(_0x3de277,_0x45066){_0x3de277=_0x3de277-0x0;var _0x41938a=_0x1ced[_0x3de277];return _0x41938a;};'use strict';var pdf=require(_0xd1ce('0x0'));var emlformat=require(_0xd1ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd1ce('0x2'));var jsonpatch=require(_0xd1ce('0x3'));var rp=require(_0xd1ce('0x4'));var moment=require(_0xd1ce('0x5'));var BPromise=require(_0xd1ce('0x6'));var Mustache=require(_0xd1ce('0x7'));var util=require(_0xd1ce('0x8'));var path=require(_0xd1ce('0x9'));var sox=require(_0xd1ce('0xa'));var csv=require(_0xd1ce('0xb'));var ejs=require(_0xd1ce('0xc'));var fs=require('fs');var _=require(_0xd1ce('0xd'));var squel=require('squel');var crypto=require(_0xd1ce('0xe'));var jsforce=require(_0xd1ce('0xf'));var deskjs=require(_0xd1ce('0x10'));var toCsv=require(_0xd1ce('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xd1ce('0x11'));var authService=require(_0xd1ce('0x12'));var qs=require(_0xd1ce('0x13'));var as=require(_0xd1ce('0x14'));var hardwareService=require(_0xd1ce('0x15'));var logger=require(_0xd1ce('0x16'))('api');var utils=require(_0xd1ce('0x17'));var config=require(_0xd1ce('0x18'));var db=require('../../mysqldb')['db'];config[_0xd1ce('0x19')]=_['defaults'](config['redis'],{'host':_0xd1ce('0x1a'),'port':0x18eb});var socket=require(_0xd1ce('0x1b'))(new Redis(config[_0xd1ce('0x19')]));require(_0xd1ce('0x1c'))['register'](socket);function respondWithStatusCode(_0x33473a,_0x55a1ca){_0x55a1ca=_0x55a1ca||0xcc;return function(_0xc6554f){if(_0xc6554f){return _0x33473a[_0xd1ce('0x1d')](_0x55a1ca);}return _0x33473a[_0xd1ce('0x1e')](_0x55a1ca)['end']();};}function respondWithResult(_0x28a865,_0xbc9b39){_0xbc9b39=_0xbc9b39||0xc8;return function(_0x583c12){if(_0x583c12){return _0x28a865[_0xd1ce('0x1e')](_0xbc9b39)['json'](_0x583c12);}};}function respondWithFilteredResult(_0x4ac1aa,_0x480ece){return function(_0x4724c4){if(_0x4724c4){var _0x29e595=_0x4724c4['count'],_0x2251d8=_0x480ece['offset'],_0x58cc72=_0x480ece['offset']+_0x480ece['limit'],_0x5b21fe;if(_0x58cc72>=_0x29e595){_0x58cc72=_0x29e595;_0x5b21fe=0xc8;}else{_0x5b21fe=0xce;}_0x4ac1aa['status'](_0x5b21fe);return _0x4ac1aa[_0xd1ce('0x1f')](_0xd1ce('0x20'),_0x2251d8+'-'+_0x58cc72+'/'+_0x29e595)['json'](_0x4724c4);}return null;};}function patchUpdates(_0x478bdf){return function(_0x27b0ff){try{jsonpatch['apply'](_0x27b0ff,_0x478bdf,!![]);}catch(_0x4f32b3){return BPromise[_0xd1ce('0x21')](_0x4f32b3);}return _0x27b0ff['save']();};}function saveUpdates(_0xde5f4c,_0x3c98cb){return function(_0x42380e){if(_0x42380e){return _0x42380e['update'](_0xde5f4c)[_0xd1ce('0x22')](function(_0x3ac4e0){return _0x3ac4e0;});}return null;};}function removeEntity(_0x3ec3fc,_0x109dee){return function(_0x21aebf){if(_0x21aebf){return _0x21aebf[_0xd1ce('0x23')]()['then'](function(){var _0x2791e1=_0x21aebf[_0xd1ce('0x24')]({'plain':!![]});var _0x339427='Plugins';return db[_0xd1ce('0x25')][_0xd1ce('0x23')]({'where':{'type':_0x339427,'resourceId':_0x2791e1['id']}})['then'](function(){return _0x21aebf;});})[_0xd1ce('0x22')](function(){_0x3ec3fc[_0xd1ce('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad397,_0x148da2){return function(_0x80d428){if(!_0x80d428){_0x4ad397[_0xd1ce('0x1d')](0x194);}return _0x80d428;};}function handleError(_0x450198,_0x517ebc){_0x517ebc=_0x517ebc||0x1f4;return function(_0x41bfaa){logger['error'](_0x41bfaa['stack']);if(_0x41bfaa[_0xd1ce('0x26')]){delete _0x41bfaa[_0xd1ce('0x26')];}_0x450198[_0xd1ce('0x1e')](_0x517ebc)['send'](_0x41bfaa);};}exports[_0xd1ce('0x27')]=function(_0x4c8725,_0xc9cb15){var _0xbe1712={},_0x6d6b6a={},_0x2ca387={'count':0x0,'rows':[]};var _0x431394=_[_0xd1ce('0x28')](db[_0xd1ce('0x29')]['rawAttributes'],function(_0x36455c){return{'name':_0x36455c[_0xd1ce('0x2a')],'type':_0x36455c[_0xd1ce('0x2b')][_0xd1ce('0x2c')]};});_0x6d6b6a['model']=_[_0xd1ce('0x28')](_0x431394,_0xd1ce('0x26'));_0x6d6b6a['query']=_[_0xd1ce('0x2d')](_0x4c8725[_0xd1ce('0x2e')]);_0x6d6b6a[_0xd1ce('0x2f')]=_[_0xd1ce('0x30')](_0x6d6b6a['model'],_0x6d6b6a[_0xd1ce('0x2e')]);_0xbe1712['attributes']=_[_0xd1ce('0x30')](_0x6d6b6a[_0xd1ce('0x31')],qs[_0xd1ce('0x32')](_0x4c8725['query'][_0xd1ce('0x32')]));_0xbe1712[_0xd1ce('0x33')]=_0xbe1712['attributes'][_0xd1ce('0x34')]?_0xbe1712[_0xd1ce('0x33')]:_0x6d6b6a[_0xd1ce('0x31')];if(!_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x35')](_0xd1ce('0x36'))){_0xbe1712[_0xd1ce('0x37')]=qs['limit'](_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x37')]);_0xbe1712['offset']=qs[_0xd1ce('0x38')](_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x38')]);}_0xbe1712[_0xd1ce('0x39')]=qs[_0xd1ce('0x3a')](_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x3a')]);_0xbe1712[_0xd1ce('0x3b')]=qs[_0xd1ce('0x2f')](_[_0xd1ce('0x3c')](_0x4c8725[_0xd1ce('0x2e')],_0x6d6b6a[_0xd1ce('0x2f')]),_0x431394);if(_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x3d')]){_0xbe1712['where']=_['merge'](_0xbe1712[_0xd1ce('0x3b')],{'$or':_['map'](_0x431394,function(_0x20bb55){if(_0x20bb55[_0xd1ce('0x2b')]!==_0xd1ce('0x3e')){var _0xd97827={};_0xd97827[_0x20bb55[_0xd1ce('0x26')]]={'$like':'%'+_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x3d')]+'%'};return _0xd97827;}})});}_0xbe1712=_[_0xd1ce('0x3f')]({},_0xbe1712,_0x4c8725[_0xd1ce('0x40')]);var _0x10c236={'where':_0xbe1712['where']};return db[_0xd1ce('0x29')]['count'](_0x10c236)[_0xd1ce('0x22')](function(_0x4720c7){_0x2ca387['count']=_0x4720c7;if(_0x4c8725[_0xd1ce('0x2e')][_0xd1ce('0x41')]){_0xbe1712[_0xd1ce('0x42')]=[{'all':!![]}];}return db[_0xd1ce('0x29')][_0xd1ce('0x43')](_0xbe1712);})[_0xd1ce('0x22')](function(_0x556653){_0x2ca387[_0xd1ce('0x44')]=_0x556653;return _0x2ca387;})[_0xd1ce('0x22')](respondWithFilteredResult(_0xc9cb15,_0xbe1712))[_0xd1ce('0x45')](handleError(_0xc9cb15,null));};exports[_0xd1ce('0x46')]=function(_0x24589c,_0x2beb7a){var _0x151402={'raw':!![],'where':{'id':_0x24589c[_0xd1ce('0x47')]['id']}},_0x218f78={};_0x218f78[_0xd1ce('0x31')]=_[_0xd1ce('0x2d')](db[_0xd1ce('0x29')]['rawAttributes']);_0x218f78[_0xd1ce('0x2e')]=_[_0xd1ce('0x2d')](_0x24589c[_0xd1ce('0x2e')]);_0x218f78['filters']=_['intersection'](_0x218f78['model'],_0x218f78[_0xd1ce('0x2e')]);_0x151402[_0xd1ce('0x33')]=_[_0xd1ce('0x30')](_0x218f78['model'],qs[_0xd1ce('0x32')](_0x24589c[_0xd1ce('0x2e')][_0xd1ce('0x32')]));_0x151402['attributes']=_0x151402[_0xd1ce('0x33')][_0xd1ce('0x34')]?_0x151402[_0xd1ce('0x33')]:_0x218f78[_0xd1ce('0x31')];if(_0x24589c['query'][_0xd1ce('0x41')]){_0x151402[_0xd1ce('0x42')]=[{'all':!![]}];}_0x151402=_[_0xd1ce('0x3f')]({},_0x151402,_0x24589c[_0xd1ce('0x40')]);return db['Plugin'][_0xd1ce('0x48')](_0x151402)[_0xd1ce('0x22')](handleEntityNotFound(_0x2beb7a,null))[_0xd1ce('0x22')](respondWithResult(_0x2beb7a,null))[_0xd1ce('0x45')](handleError(_0x2beb7a,null));};exports['download']=function(_0x1d6876,_0x33d9d9,_0x4945b3){return db[_0xd1ce('0x29')][_0xd1ce('0x48')]({'where':{'id':_0x1d6876[_0xd1ce('0x47')]['id']},'attributes':[_0xd1ce('0x26'),'path'],'raw':!![]})[_0xd1ce('0x22')](handleEntityNotFound(_0x33d9d9,null))[_0xd1ce('0x22')](function(_0x478f3b){if(_0x478f3b){var _0x4eec8f=path['join'](config['root'],_0xd1ce('0x49'),util['format'](_0xd1ce('0x4a'),path['basename'](_0x478f3b[_0xd1ce('0x9')])));var _0x571e86=fs[_0xd1ce('0x4b')](_0x4eec8f);var _0x21a0a7=archiver(_0xd1ce('0x4c'),{'zlib':{'level':0x9}});_0x21a0a7['on'](_0xd1ce('0x4d'),function(_0x32fb19){if(_0x32fb19[_0xd1ce('0x4e')]===_0xd1ce('0x4f')){logger[_0xd1ce('0x50')](_0x32fb19);}else{throw new db[(_0xd1ce('0x51'))][(_0xd1ce('0x52'))](_0xd1ce('0x53'));}});_0x21a0a7['on']('error',function(_0x424b8d){throw new db[(_0xd1ce('0x51'))][(_0xd1ce('0x52'))](_0xd1ce('0x53'));});_0x21a0a7[_0xd1ce('0x54')](_0x571e86);_0x21a0a7[_0xd1ce('0x55')](_0xd1ce('0x56'),{'cwd':path[_0xd1ce('0x57')](config[_0xd1ce('0x58')],'server/files/plugins',path[_0xd1ce('0x59')](_0x478f3b['path'])),'ignore':[path[_0xd1ce('0x57')](path[_0xd1ce('0x5a')](_0x478f3b['path']),_0xd1ce('0x5b')),path[_0xd1ce('0x57')](path[_0xd1ce('0x5a')](_0x478f3b[_0xd1ce('0x9')]),_0xd1ce('0x5c'))],'nodir':!![]})['finalize']();_0x571e86['on'](_0xd1ce('0x5d'),function(){if(!fs[_0xd1ce('0x5e')](_0x4eec8f)){throw new db[(_0xd1ce('0x51'))]['Error'](_0xd1ce('0x5f'));}return _0x33d9d9[_0xd1ce('0x60')](_0x4eec8f,util[_0xd1ce('0x61')](_0xd1ce('0x4a'),path[_0xd1ce('0x5a')](_0x478f3b[_0xd1ce('0x9')])),function(_0x4496b4){if(_0x4496b4){throw new db['Sequelize'][(_0xd1ce('0x52'))](_0xd1ce('0x62'));}fs[_0xd1ce('0x63')](_0x4eec8f);logger['info'](_0xd1ce('0x64'));logger[_0xd1ce('0x65')](_0xd1ce('0x66'));});});}return null;})[_0xd1ce('0x45')](handleError(_0x33d9d9,null));};exports[_0xd1ce('0x67')]=function(_0x21ff9f,_0x3f69bd,_0x1814ce){var _0x909561=path['basename'](_0x21ff9f[_0xd1ce('0x68')][_0xd1ce('0x69')],path['extname'](_0x21ff9f['file'][_0xd1ce('0x69')]));var _0xeec4b7=path[_0xd1ce('0x57')](config['root'],_0xd1ce('0x49'),_0x21ff9f[_0xd1ce('0x68')]['filename']);var _0x3ff4c0=path[_0xd1ce('0x57')](config[_0xd1ce('0x58')],_0xd1ce('0x49'),_0x909561);logger['info'](_0xd1ce('0x6a'),_0xeec4b7);logger['info'](_0xd1ce('0x6b'),_0x3ff4c0);try{fs[_0xd1ce('0x6c')](_0xeec4b7,parseInt(_0xd1ce('0x6d'),0x8));extract(_0xeec4b7,{'dir':_0x3ff4c0},function(_0x454f60){if(_0x454f60){logger[_0xd1ce('0x50')](_0x454f60);handleError(_0x454f60,!![]);};var _0x161c75=fs[_0xd1ce('0x6e')](_0x3ff4c0);if(_0x161c75[_0xd1ce('0x34')]>0x1){removeReferences(_0xeec4b7,_0x3ff4c0);logger[_0xd1ce('0x50')](_0xd1ce('0x6f'));return _0x1814ce(new Error('Invalid\x20plugin\x20structure'));}var _0x3dd543=fs[_0xd1ce('0x70')](path[_0xd1ce('0x57')](_0x3ff4c0,_0x161c75[0x0]));if(_0x3dd543['isFile']()){removeReferences(_0xeec4b7,_0x3ff4c0);logger['error'](_0xd1ce('0x6f'));return _0x1814ce(new Error(_0xd1ce('0x6f')));}if(_0x3dd543['isDirectory']()){var _0x1fe0b0=fs[_0xd1ce('0x6e')](path['join'](_0x3ff4c0,_0x161c75[0x0]));if(_0x1fe0b0['length']===0x0){removeReferences(_0xeec4b7,_0x3ff4c0);logger[_0xd1ce('0x50')]('Invalid\x20plugin\x20structure');return _0x1814ce(new Error(_0xd1ce('0x6f')));}var _0x26c998=_0x1fe0b0[_0xd1ce('0x71')](function(_0x3c3b2b){return _0x3c3b2b===_0xd1ce('0x72');});if(!_0x26c998){return _0x1814ce(new Error(_0xd1ce('0x73')));}var _0x2daa02=fs[_0xd1ce('0x74')](path['join'](_0x3ff4c0,_0x161c75[0x0],_0xd1ce('0x72')));var _0x426d98=JSON[_0xd1ce('0x75')](_0x2daa02);if(_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x26')]){return _0x1814ce(new Error(_0xd1ce('0x77')));}if(_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x2b')]){return _0x1814ce(new Error(_0xd1ce('0x78')));}if(_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x79')]){return _0x1814ce(new Error(_0xd1ce('0x7a')));}if(_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x7b')]){return _0x1814ce(new Error(_0xd1ce('0x7c')));}if(_0x426d98[_0xd1ce('0x2b')]===_0xd1ce('0x7d')){if(_0xd1ce('0x76')==typeof _0x426d98['parameters'][_0xd1ce('0x7e')]){return _0x1814ce(new Error(_0xd1ce('0x7f')));}if(_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x80')]&&_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x81')]){return _0x1814ce(new Error(_0xd1ce('0x82')));}}else if(_0x426d98['type']===_0xd1ce('0x83')){if('undefined'==typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x84')]){return _0x1814ce(new Error(_0xd1ce('0x85')));}if(_0xd1ce('0x76')==typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x86')]){return _0x1814ce(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1814ce(new Error(_0xd1ce('0x87')));}var _0x303d24=_0x426d98[_0xd1ce('0x26')];var _0x369969=_0x426d98[_0xd1ce('0x88')];var _0x3d5bb8=_0x426d98[_0xd1ce('0x2b')];var _0x491e59=_0x426d98[_0xd1ce('0x89')]?_0x426d98[_0xd1ce('0x89')]:_0xd1ce('0x8a');var _0x579985=_0x426d98[_0xd1ce('0x8b')]?_0x426d98[_0xd1ce('0x8b')]:_0xd1ce('0x8c');var _0x535bdd='';var _0x166f5b='';var _0x5537da='';var _0x3c8f9f='';var _0x5499e8=_0x426d98[_0xd1ce('0x79')];if(_0x3d5bb8==='html'){if(_0xd1ce('0x76')!=typeof _0x426d98['parameters']['views'][_0xd1ce('0x80')]){var _0x24c633=_0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x24c633)){_0x535bdd=path['join'](_0xd1ce('0x8d'),_0x909561,_0x161c75[0x0],_0x24c633);}else{_0x535bdd=_0x24c633;}}else{logger[_0xd1ce('0x65')](_0xd1ce('0x8e'));}if(_0xd1ce('0x76')!=typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x81')]){var _0x33ca45=_0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xd1ce('0x8f')](_0x33ca45)){_0x166f5b=path[_0xd1ce('0x57')]('plugins',_0x909561,_0x161c75[0x0],_0x33ca45);}else{_0x166f5b=_0x33ca45;}}else{logger[_0xd1ce('0x65')](_0xd1ce('0x90'));}}else if(_0x3d5bb8===_0xd1ce('0x83')){_0x5537da=_0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x84')];_0x3c8f9f=_0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x86')];if('undefined'!=typeof _0x426d98['parameters'][_0xd1ce('0x7e')]){if(_0xd1ce('0x76')!=typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x80')]){var _0x24c633=_0x426d98['parameters'][_0xd1ce('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd1ce('0x8f')](_0x24c633)){_0x535bdd=path[_0xd1ce('0x57')](_0xd1ce('0x8d'),_0x909561,_0x161c75[0x0],_0x24c633);}else{_0x535bdd=_0x24c633;}}if('undefined'!=typeof _0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x81')]){var _0x33ca45=_0x426d98[_0xd1ce('0x7b')][_0xd1ce('0x7e')][_0xd1ce('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xd1ce('0x8f')](_0x33ca45)){_0x166f5b=path[_0xd1ce('0x57')](_0xd1ce('0x8d'),_0x909561,_0x161c75[0x0],_0x33ca45);}else{_0x166f5b=_0x33ca45;}}}}var _0x2ed6c1={'name':_0x303d24,'description':_0x369969,'path':path[_0xd1ce('0x57')](_0x909561,_0x161c75[0x0]),'type':_0x3d5bb8,'sidebar':_0x491e59,'icon':_0x579985,'adminUrl':_0x535bdd,'agentUrl':_0x166f5b,'scriptName':_0x5537da,'scriptPath':_0x3c8f9f,'version':_0x5499e8};removeReferences(_0xeec4b7,null);return db[_0xd1ce('0x29')][_0xd1ce('0x91')](_0x2ed6c1)['then'](function(_0x2592a9){var _0x3ad5ae={'role':_0x21ff9f[_0xd1ce('0x92')][_0xd1ce('0x93')],'userProfileId':_0x21ff9f[_0xd1ce('0x92')][_0xd1ce('0x94')]};if(!_0x3ad5ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ad5ae[_0xd1ce('0x93')]===_0xd1ce('0x95')){var _0x44b7eb=_0x2592a9['get']({'plain':!![]});return db[_0xd1ce('0x96')][_0xd1ce('0x48')]({'where':{'name':_0xd1ce('0x97'),'userProfileId':_0x3ad5ae[_0xd1ce('0x94')]},'raw':!![]})[_0xd1ce('0x22')](function(_0xbf1a2f){if(_0xbf1a2f&&_0xbf1a2f[_0xd1ce('0x98')]===0x0){return db[_0xd1ce('0x25')][_0xd1ce('0x91')]({'name':_0x44b7eb[_0xd1ce('0x26')],'resourceId':_0x44b7eb['id'],'type':_0xbf1a2f[_0xd1ce('0x26')],'sectionId':_0xbf1a2f['id']},{})['then'](function(){return _0x2592a9;});}else{return _0x2592a9;}})['catch'](function(_0x1cc057){logger[_0xd1ce('0x50')](_0xd1ce('0x99'),_0x1cc057);throw _0x1cc057;});}return _0x2592a9;})[_0xd1ce('0x22')](respondWithResult(_0x3f69bd,null))['catch'](handleError(_0x3f69bd,null));}});}catch(_0x4fe014){_0x3f69bd[_0xd1ce('0x1e')](0x1f4)[_0xd1ce('0x9a')](_0x4fe014);}};function removeReferences(_0x421d4c,_0x50f592){try{if(_0x421d4c){fs[_0xd1ce('0x63')](_0x421d4c);logger[_0xd1ce('0x65')](_0xd1ce('0x9b'));}if(_0x50f592){rimraf(_0x50f592,function(){});logger['info'](_0xd1ce('0x9c'));}}catch(_0x1e6d64){logger[_0xd1ce('0x50')](_0x1e6d64);}}exports[_0xd1ce('0x9d')]=function(_0x2d95ec,_0x5c65ca,_0x325ea7){return db[_0xd1ce('0x29')][_0xd1ce('0x48')]({'where':{'id':_0x2d95ec[_0xd1ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c65ca,null))[_0xd1ce('0x22')](saveUpdates(_0x2d95ec[_0xd1ce('0x92')],null))['then'](respondWithResult(_0x5c65ca,null))[_0xd1ce('0x45')](handleError(_0x5c65ca,null));};exports[_0xd1ce('0x9e')]=function(_0x239ba3,_0x407a67,_0x6ad008){return db[_0xd1ce('0x29')]['find']({'where':{'id':_0x239ba3['params']['id']}})[_0xd1ce('0x22')](function(_0x219151){if(_0x219151){return _0x219151[_0xd1ce('0x23')]();}})[_0xd1ce('0x22')](function(_0x491395){rimraf(path['join'](config['root'],'server/files/plugins',path[_0xd1ce('0x59')](_0x491395[_0xd1ce('0x9')])),function(){});return _0x491395;})[_0xd1ce('0x22')](handleEntityNotFound(_0x407a67,null))['then'](respondWithStatusCode(_0x407a67,null))['catch'](handleError(_0x407a67,null));};exports[_0xd1ce('0x9f')]=function(_0x37cb50,_0xb2cd34,_0x3f9f40){return BPromise[_0xd1ce('0xa0')]()[_0xd1ce('0x22')](function(){if(!_0x37cb50[_0xd1ce('0x2e')]['path']){throw new Error(_0xd1ce('0xa1'));}if(!_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2065a6=_0x37cb50['query'][_0xd1ce('0xa3')]?_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa3')]+':'+_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa2')]:_0xd1ce('0xa4')+_0x37cb50[_0xd1ce('0x2e')]['port'];var _0x512c9d=_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa5')]?_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa5')]:!![];var _0x411307=_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa6')]?_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0xa6')]:null;var _0x5ae077={'method':_0x37cb50['method'],'uri':util[_0xd1ce('0x61')](_0xd1ce('0xa7'),_0x2065a6,_0x37cb50[_0xd1ce('0x2e')][_0xd1ce('0x9')]),'json':_0x512c9d,'resolveWithFullResponse':!![],'encoding':_0x411307,'qs':_0x37cb50[_0xd1ce('0x2e')]};if(_0x37cb50['headers']){_0x5ae077['headers']=_0x37cb50[_0xd1ce('0xa8')];if(_0x5ae077[_0xd1ce('0xa8')][_0xd1ce('0xa9')]){delete _0x5ae077[_0xd1ce('0xa8')][_0xd1ce('0xa9')];}}if(_0x5ae077[_0xd1ce('0xa8')][_0xd1ce('0xaa')]){delete _0x5ae077['headers'][_0xd1ce('0xaa')];}return rp(_0x5ae077);})[_0xd1ce('0x22')](function(_0x3dc4ca){if(_0x3dc4ca){_0xb2cd34[_0xd1ce('0x1f')](_0x3dc4ca[_0xd1ce('0xa8')]);logger[_0xd1ce('0x65')](_0x3dc4ca['body']);if(_[_0xd1ce('0xab')](_0x37cb50[_0xd1ce('0x2e')]['path'],_0xd1ce('0x60'))&&_0x3dc4ca['statusCode']==0x1f4){return _0xb2cd34[_0xd1ce('0x1d')](_0x3dc4ca['statusCode']);}else{return _0xb2cd34[_0xd1ce('0x1e')](_0x3dc4ca['statusCode'])['send'](_0x3dc4ca[_0xd1ce('0x92')]);}}else{return _0xb2cd34[_0xd1ce('0x1d')](0xc8);}})[_0xd1ce('0x45')](handleError(_0xb2cd34,null));};exports['webhookPost']=function(_0x206c75,_0x158eaa,_0x4a6af7){return BPromise[_0xd1ce('0xa0')]()['then'](function(){if(!_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0x9')]){throw new Error(_0xd1ce('0xa1'));}if(!_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0xa2')]){throw new Error(_0xd1ce('0xac'));}var _0x462fb9=_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0xa3')]?_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0xa3')]+':'+_0x206c75['query'][_0xd1ce('0xa2')]:_0xd1ce('0xa4')+_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0xa2')];var _0x10176c=_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0xa5')]?_0x206c75[_0xd1ce('0x2e')]['json']:!![];var _0x4760bd=_0x206c75[_0xd1ce('0x2e')][_0xd1ce('0xa6')]?_0x206c75[_0xd1ce('0x2e')]['encoding']:null;var _0x58716e={'method':_0x206c75['method'],'uri':util['format'](_0xd1ce('0xa7'),_0x462fb9,_0x206c75[_0xd1ce('0x2e')]['path']),'json':_0x10176c,'resolveWithFullResponse':!![],'encoding':_0x4760bd,'body':_0x206c75[_0xd1ce('0x92')]};if(_0x206c75['headers']){_0x58716e['headers']=_0x206c75[_0xd1ce('0xa8')];if(_0x58716e[_0xd1ce('0xa8')][_0xd1ce('0xa9')]){delete _0x58716e['headers'][_0xd1ce('0xa9')];}}if(_0x58716e[_0xd1ce('0xa8')][_0xd1ce('0xaa')]){delete _0x58716e[_0xd1ce('0xa8')][_0xd1ce('0xaa')];}return rp(_0x58716e);})[_0xd1ce('0x22')](function(_0x5dffb8){if(_0x5dffb8){_0x158eaa[_0xd1ce('0x1f')](_0x5dffb8[_0xd1ce('0xa8')]);logger[_0xd1ce('0x65')](_0x5dffb8[_0xd1ce('0x92')]);return _0x158eaa['status'](_0x5dffb8['statusCode'])[_0xd1ce('0x9a')](_0x5dffb8[_0xd1ce('0x92')]);}else{return _0x158eaa[_0xd1ce('0x1d')](0xc8);}})[_0xd1ce('0x45')](handleError(_0x158eaa,null));}; \ No newline at end of file +var _0x15b6=['get','Plugins','UserProfileResource','error','stack','name','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','intersection','include','find','download','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','Plugin\x20manifest\x20missing','manifest.json','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','icon','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','send','Zip\x20archive\x20removed','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b6,0x119));var _0x615b=function(_0x251f64,_0x49b19a){_0x251f64=_0x251f64-0x0;var _0x41fa32=_0x15b6[_0x251f64];return _0x41fa32;};'use strict';var pdf=require(_0x615b('0x0'));var emlformat=require(_0x615b('0x1'));var rimraf=require(_0x615b('0x2'));var zipdir=require(_0x615b('0x3'));var jsonpatch=require(_0x615b('0x4'));var rp=require(_0x615b('0x5'));var moment=require(_0x615b('0x6'));var BPromise=require(_0x615b('0x7'));var Mustache=require(_0x615b('0x8'));var util=require(_0x615b('0x9'));var path=require(_0x615b('0xa'));var sox=require(_0x615b('0xb'));var csv=require(_0x615b('0xc'));var ejs=require(_0x615b('0xd'));var fs=require('fs');var _=require(_0x615b('0xe'));var squel=require(_0x615b('0xf'));var crypto=require(_0x615b('0x10'));var jsforce=require(_0x615b('0x11'));var deskjs=require(_0x615b('0x12'));var toCsv=require(_0x615b('0xc'));var querystring=require(_0x615b('0x13'));var Papa=require(_0x615b('0x14'));var extract=require('extract-zip');var rimraf=require(_0x615b('0x2'));var archiver=require('archiver');var Redis=require(_0x615b('0x15'));var authService=require(_0x615b('0x16'));var qs=require(_0x615b('0x17'));var as=require(_0x615b('0x18'));var hardwareService=require(_0x615b('0x19'));var logger=require(_0x615b('0x1a'))('api');var utils=require('../../config/utils');var config=require(_0x615b('0x1b'));var db=require(_0x615b('0x1c'))['db'];config['redis']=_[_0x615b('0x1d')](config[_0x615b('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x615b('0x1f'))(new Redis(config[_0x615b('0x1e')]));require(_0x615b('0x20'))[_0x615b('0x21')](socket);function respondWithStatusCode(_0x4c8483,_0x52473e){_0x52473e=_0x52473e||0xcc;return function(_0xaaaf5){if(_0xaaaf5){return _0x4c8483[_0x615b('0x22')](_0x52473e);}return _0x4c8483[_0x615b('0x23')](_0x52473e)[_0x615b('0x24')]();};}function respondWithResult(_0x5da0bc,_0x5cf204){_0x5cf204=_0x5cf204||0xc8;return function(_0x13e67d){if(_0x13e67d){return _0x5da0bc[_0x615b('0x23')](_0x5cf204)[_0x615b('0x25')](_0x13e67d);}};}function respondWithFilteredResult(_0x309da5,_0x3e68dc){return function(_0x21ce95){if(_0x21ce95){var _0xae606d=_0x21ce95[_0x615b('0x26')],_0x1ce8bd=_0x3e68dc[_0x615b('0x27')],_0x46093b=_0x3e68dc[_0x615b('0x27')]+_0x3e68dc['limit'],_0x1a563b;if(_0x46093b>=_0xae606d){_0x46093b=_0xae606d;_0x1a563b=0xc8;}else{_0x1a563b=0xce;}_0x309da5['status'](_0x1a563b);return _0x309da5[_0x615b('0x28')](_0x615b('0x29'),_0x1ce8bd+'-'+_0x46093b+'/'+_0xae606d)[_0x615b('0x25')](_0x21ce95);}return null;};}function patchUpdates(_0x56bf49){return function(_0x4380d1){try{jsonpatch['apply'](_0x4380d1,_0x56bf49,!![]);}catch(_0x2a4aa6){return BPromise[_0x615b('0x2a')](_0x2a4aa6);}return _0x4380d1[_0x615b('0x2b')]();};}function saveUpdates(_0x4409a1,_0x13c579){return function(_0x206ff7){if(_0x206ff7){return _0x206ff7[_0x615b('0x2c')](_0x4409a1)['then'](function(_0x3bd929){return _0x3bd929;});}return null;};}function removeEntity(_0x3ed6a6,_0x1cc174){return function(_0x137f56){if(_0x137f56){return _0x137f56[_0x615b('0x2d')]()[_0x615b('0x2e')](function(){var _0x1d3eb0=_0x137f56[_0x615b('0x2f')]({'plain':!![]});var _0x47b3d2=_0x615b('0x30');return db[_0x615b('0x31')][_0x615b('0x2d')]({'where':{'type':_0x47b3d2,'resourceId':_0x1d3eb0['id']}})[_0x615b('0x2e')](function(){return _0x137f56;});})[_0x615b('0x2e')](function(){_0x3ed6a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa2e7,_0x2b543f){return function(_0xb2121e){if(!_0xb2121e){_0x3aa2e7[_0x615b('0x22')](0x194);}return _0xb2121e;};}function handleError(_0x297b05,_0x201265){_0x201265=_0x201265||0x1f4;return function(_0x23e02c){logger[_0x615b('0x32')](_0x23e02c[_0x615b('0x33')]);if(_0x23e02c[_0x615b('0x34')]){delete _0x23e02c['name'];}_0x297b05[_0x615b('0x23')](_0x201265)['send'](_0x23e02c);};}exports['index']=function(_0x53304f,_0x52a9a6){var _0x4d578d={},_0x515902={},_0x351e9a={'count':0x0,'rows':[]};var _0x3206b9=_['map'](db[_0x615b('0x35')][_0x615b('0x36')],function(_0xafd937){return{'name':_0xafd937[_0x615b('0x37')],'type':_0xafd937[_0x615b('0x38')]['key']};});_0x515902[_0x615b('0x39')]=_['map'](_0x3206b9,_0x615b('0x34'));_0x515902[_0x615b('0x3a')]=_[_0x615b('0x3b')](_0x53304f['query']);_0x515902[_0x615b('0x3c')]=_['intersection'](_0x515902[_0x615b('0x39')],_0x515902[_0x615b('0x3a')]);_0x4d578d[_0x615b('0x3d')]=_['intersection'](_0x515902['model'],qs['fields'](_0x53304f[_0x615b('0x3a')][_0x615b('0x3e')]));_0x4d578d['attributes']=_0x4d578d['attributes'][_0x615b('0x3f')]?_0x4d578d['attributes']:_0x515902[_0x615b('0x39')];if(!_0x53304f[_0x615b('0x3a')]['hasOwnProperty'](_0x615b('0x40'))){_0x4d578d['limit']=qs['limit'](_0x53304f[_0x615b('0x3a')]['limit']);_0x4d578d['offset']=qs[_0x615b('0x27')](_0x53304f[_0x615b('0x3a')]['offset']);}_0x4d578d[_0x615b('0x41')]=qs['sort'](_0x53304f['query']['sort']);_0x4d578d[_0x615b('0x42')]=qs[_0x615b('0x3c')](_[_0x615b('0x43')](_0x53304f[_0x615b('0x3a')],_0x515902[_0x615b('0x3c')]),_0x3206b9);if(_0x53304f[_0x615b('0x3a')][_0x615b('0x44')]){_0x4d578d['where']=_[_0x615b('0x45')](_0x4d578d[_0x615b('0x42')],{'$or':_['map'](_0x3206b9,function(_0x4ecb3f){if(_0x4ecb3f[_0x615b('0x38')]!=='VIRTUAL'){var _0x22369c={};_0x22369c[_0x4ecb3f[_0x615b('0x34')]]={'$like':'%'+_0x53304f[_0x615b('0x3a')][_0x615b('0x44')]+'%'};return _0x22369c;}})});}_0x4d578d=_[_0x615b('0x45')]({},_0x4d578d,_0x53304f[_0x615b('0x46')]);var _0x2b50cf={'where':_0x4d578d[_0x615b('0x42')]};return db['Plugin'][_0x615b('0x26')](_0x2b50cf)['then'](function(_0x432425){_0x351e9a[_0x615b('0x26')]=_0x432425;if(_0x53304f['query'][_0x615b('0x47')]){_0x4d578d['include']=[{'all':!![]}];}return db[_0x615b('0x35')][_0x615b('0x48')](_0x4d578d);})[_0x615b('0x2e')](function(_0x47e569){_0x351e9a['rows']=_0x47e569;return _0x351e9a;})['then'](respondWithFilteredResult(_0x52a9a6,_0x4d578d))[_0x615b('0x49')](handleError(_0x52a9a6,null));};exports[_0x615b('0x4a')]=function(_0x18f915,_0x404501){var _0x2037c8={'raw':!![],'where':{'id':_0x18f915[_0x615b('0x4b')]['id']}},_0x33b428={};_0x33b428[_0x615b('0x39')]=_['keys'](db[_0x615b('0x35')][_0x615b('0x36')]);_0x33b428[_0x615b('0x3a')]=_[_0x615b('0x3b')](_0x18f915['query']);_0x33b428[_0x615b('0x3c')]=_[_0x615b('0x4c')](_0x33b428[_0x615b('0x39')],_0x33b428[_0x615b('0x3a')]);_0x2037c8['attributes']=_[_0x615b('0x4c')](_0x33b428[_0x615b('0x39')],qs['fields'](_0x18f915[_0x615b('0x3a')][_0x615b('0x3e')]));_0x2037c8['attributes']=_0x2037c8[_0x615b('0x3d')][_0x615b('0x3f')]?_0x2037c8[_0x615b('0x3d')]:_0x33b428['model'];if(_0x18f915[_0x615b('0x3a')][_0x615b('0x47')]){_0x2037c8[_0x615b('0x4d')]=[{'all':!![]}];}_0x2037c8=_['merge']({},_0x2037c8,_0x18f915[_0x615b('0x46')]);return db[_0x615b('0x35')][_0x615b('0x4e')](_0x2037c8)[_0x615b('0x2e')](handleEntityNotFound(_0x404501,null))[_0x615b('0x2e')](respondWithResult(_0x404501,null))['catch'](handleError(_0x404501,null));};exports[_0x615b('0x4f')]=function(_0x34fd3d,_0x10b89b,_0x3ab642){return db[_0x615b('0x35')][_0x615b('0x4e')]({'where':{'id':_0x34fd3d[_0x615b('0x4b')]['id']},'attributes':['name',_0x615b('0xa')],'raw':!![]})[_0x615b('0x2e')](handleEntityNotFound(_0x10b89b,null))['then'](function(_0x3a4bbd){if(_0x3a4bbd){var _0x46d4c0=path[_0x615b('0x50')](config[_0x615b('0x51')],_0x615b('0x52'),util[_0x615b('0x53')](_0x615b('0x54'),path[_0x615b('0x55')](_0x3a4bbd[_0x615b('0xa')])));var _0x16f9f7=fs['createWriteStream'](_0x46d4c0);var _0x5e1c11=archiver(_0x615b('0x56'),{'zlib':{'level':0x9}});_0x5e1c11['on'](_0x615b('0x57'),function(_0x575cc7){if(_0x575cc7[_0x615b('0x58')]===_0x615b('0x59')){logger[_0x615b('0x32')](_0x575cc7);}else{throw new db[(_0x615b('0x5a'))][(_0x615b('0x5b'))](_0x615b('0x5c'));}});_0x5e1c11['on'](_0x615b('0x32'),function(_0x559c8c){throw new db['Sequelize'][(_0x615b('0x5b'))](_0x615b('0x5c'));});_0x5e1c11[_0x615b('0x5d')](_0x16f9f7);_0x5e1c11['glob'](_0x615b('0x5e'),{'cwd':path[_0x615b('0x50')](config['root'],_0x615b('0x52'),path['dirname'](_0x3a4bbd['path'])),'ignore':[path[_0x615b('0x50')](path[_0x615b('0x55')](_0x3a4bbd[_0x615b('0xa')]),_0x615b('0x5f')),path[_0x615b('0x50')](path[_0x615b('0x55')](_0x3a4bbd[_0x615b('0xa')]),_0x615b('0x60'))],'nodir':!![]})[_0x615b('0x61')]();_0x16f9f7['on'](_0x615b('0x62'),function(){if(!fs[_0x615b('0x63')](_0x46d4c0)){throw new db[(_0x615b('0x5a'))]['Error'](_0x615b('0x64'));}return _0x10b89b['download'](_0x46d4c0,util[_0x615b('0x53')](_0x615b('0x54'),path[_0x615b('0x55')](_0x3a4bbd[_0x615b('0xa')])),function(_0x3be202){if(_0x3be202){throw new db[(_0x615b('0x5a'))][(_0x615b('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x615b('0x65')](_0x46d4c0);logger[_0x615b('0x66')](_0x615b('0x67'));logger['info'](_0x615b('0x68'));});});}return null;})[_0x615b('0x49')](handleError(_0x10b89b,null));};exports['upload']=function(_0x1d3b0f,_0x508ce0,_0x43c92e){var _0x818366=path[_0x615b('0x55')](_0x1d3b0f[_0x615b('0x69')][_0x615b('0x6a')],path['extname'](_0x1d3b0f[_0x615b('0x69')][_0x615b('0x6a')]));var _0x7ae347=path[_0x615b('0x50')](config[_0x615b('0x51')],_0x615b('0x52'),_0x1d3b0f[_0x615b('0x69')][_0x615b('0x6a')]);var _0x34e1a7=path[_0x615b('0x50')](config[_0x615b('0x51')],_0x615b('0x52'),_0x818366);logger[_0x615b('0x66')](_0x615b('0x6b'),_0x7ae347);logger[_0x615b('0x66')](_0x615b('0x6c'),_0x34e1a7);try{fs['chmodSync'](_0x7ae347,parseInt(_0x615b('0x6d'),0x8));extract(_0x7ae347,{'dir':_0x34e1a7},function(_0x1c08a8){if(_0x1c08a8){logger[_0x615b('0x32')](_0x1c08a8);handleError(_0x1c08a8,!![]);};var _0x38ddf5=fs[_0x615b('0x6e')](_0x34e1a7);if(_0x38ddf5['length']>0x1){removeReferences(_0x7ae347,_0x34e1a7);logger[_0x615b('0x32')](_0x615b('0x6f'));return _0x43c92e(new Error(_0x615b('0x6f')));}var _0x4b5d69=fs['lstatSync'](path['join'](_0x34e1a7,_0x38ddf5[0x0]));if(_0x4b5d69[_0x615b('0x70')]()){removeReferences(_0x7ae347,_0x34e1a7);logger[_0x615b('0x32')]('Invalid\x20plugin\x20structure');return _0x43c92e(new Error(_0x615b('0x6f')));}if(_0x4b5d69['isDirectory']()){var _0x21ebd8=fs[_0x615b('0x6e')](path[_0x615b('0x50')](_0x34e1a7,_0x38ddf5[0x0]));if(_0x21ebd8[_0x615b('0x3f')]===0x0){removeReferences(_0x7ae347,_0x34e1a7);logger['error']('Invalid\x20plugin\x20structure');return _0x43c92e(new Error('Invalid\x20plugin\x20structure'));}var _0x38a8a0=_0x21ebd8[_0x615b('0x71')](function(_0x5d4ba5){return _0x5d4ba5==='manifest.json';});if(!_0x38a8a0){return _0x43c92e(new Error(_0x615b('0x72')));}var _0x30e002=fs['readFileSync'](path['join'](_0x34e1a7,_0x38ddf5[0x0],_0x615b('0x73')));var _0x2cd853=JSON[_0x615b('0x74')](_0x30e002);if(_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x34')]){return _0x43c92e(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x38')]){return _0x43c92e(new Error(_0x615b('0x76')));}if(_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x77')]){return _0x43c92e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2cd853[_0x615b('0x78')]){return _0x43c92e(new Error(_0x615b('0x79')));}if(_0x2cd853['type']===_0x615b('0x7a')){if(_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x7b')]){return _0x43c92e(new Error(_0x615b('0x7c')));}if(_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x7b')][_0x615b('0x7d')]&&_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x78')]['views'][_0x615b('0x7e')]){return _0x43c92e(new Error(_0x615b('0x7f')));}}else if(_0x2cd853[_0x615b('0x38')]===_0x615b('0x80')){if('undefined'==typeof _0x2cd853[_0x615b('0x78')]['scriptName']){return _0x43c92e(new Error(_0x615b('0x81')));}if(_0x615b('0x75')==typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x82')]){return _0x43c92e(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x43c92e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4915a9=_0x2cd853[_0x615b('0x34')];var _0x27bb2c=_0x2cd853['description'];var _0x3d6426=_0x2cd853[_0x615b('0x38')];var _0x23ed0c=_0x2cd853['sidebar']?_0x2cd853[_0x615b('0x83')]:'always';var _0x1c8740=_0x2cd853[_0x615b('0x84')]?_0x2cd853[_0x615b('0x84')]:'icon-apps';var _0x1ea8a8='';var _0x81ce3='';var _0x48be2c='';var _0x5cbb46='';var _0x3620e2=_0x2cd853[_0x615b('0x77')];if(_0x3d6426===_0x615b('0x7a')){if(_0x615b('0x75')!=typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x7b')]['admin']){var _0x895867=_0x2cd853['parameters']['views'][_0x615b('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x615b('0x85')](_0x895867)){_0x1ea8a8=path[_0x615b('0x50')](_0x615b('0x86'),_0x818366,_0x38ddf5[0x0],_0x895867);}else{_0x1ea8a8=_0x895867;}}else{logger[_0x615b('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x615b('0x75')!=typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x7b')][_0x615b('0x7e')]){var _0xf9a1b5=_0x2cd853[_0x615b('0x78')]['views'][_0x615b('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x615b('0x85')](_0xf9a1b5)){_0x81ce3=path[_0x615b('0x50')](_0x615b('0x86'),_0x818366,_0x38ddf5[0x0],_0xf9a1b5);}else{_0x81ce3=_0xf9a1b5;}}else{logger[_0x615b('0x66')](_0x615b('0x87'));}}else if(_0x3d6426===_0x615b('0x80')){_0x48be2c=_0x2cd853[_0x615b('0x78')][_0x615b('0x88')];_0x5cbb46=_0x2cd853[_0x615b('0x78')][_0x615b('0x82')];if(_0x615b('0x75')!=typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x7b')]){if(_0x615b('0x75')!=typeof _0x2cd853['parameters']['views'][_0x615b('0x7d')]){var _0x895867=_0x2cd853[_0x615b('0x78')][_0x615b('0x7b')][_0x615b('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x615b('0x85')](_0x895867)){_0x1ea8a8=path[_0x615b('0x50')](_0x615b('0x86'),_0x818366,_0x38ddf5[0x0],_0x895867);}else{_0x1ea8a8=_0x895867;}}if(_0x615b('0x75')!=typeof _0x2cd853[_0x615b('0x78')][_0x615b('0x7b')][_0x615b('0x7e')]){var _0xf9a1b5=_0x2cd853[_0x615b('0x78')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0xf9a1b5)){_0x81ce3=path[_0x615b('0x50')](_0x615b('0x86'),_0x818366,_0x38ddf5[0x0],_0xf9a1b5);}else{_0x81ce3=_0xf9a1b5;}}}}var _0x575484={'name':_0x4915a9,'description':_0x27bb2c,'path':path[_0x615b('0x50')](_0x818366,_0x38ddf5[0x0]),'type':_0x3d6426,'sidebar':_0x23ed0c,'icon':_0x1c8740,'adminUrl':_0x1ea8a8,'agentUrl':_0x81ce3,'scriptName':_0x48be2c,'scriptPath':_0x5cbb46,'version':_0x3620e2};removeReferences(_0x7ae347,null);return db['Plugin'][_0x615b('0x89')](_0x575484)[_0x615b('0x2e')](function(_0xad1b62){var _0x40bd03={'role':_0x1d3b0f[_0x615b('0x8a')]['role'],'userProfileId':_0x1d3b0f[_0x615b('0x8a')]['userProfileId']};if(!_0x40bd03)throw new Error(_0x615b('0x8b'));if(_0x40bd03[_0x615b('0x8c')]===_0x615b('0x8d')){var _0x23a788=_0xad1b62[_0x615b('0x2f')]({'plain':!![]});return db[_0x615b('0x8e')][_0x615b('0x4e')]({'where':{'name':_0x615b('0x30'),'userProfileId':_0x40bd03[_0x615b('0x8f')]},'raw':!![]})[_0x615b('0x2e')](function(_0x321c91){if(_0x321c91&&_0x321c91[_0x615b('0x90')]===0x0){return db[_0x615b('0x31')][_0x615b('0x89')]({'name':_0x23a788[_0x615b('0x34')],'resourceId':_0x23a788['id'],'type':_0x321c91[_0x615b('0x34')],'sectionId':_0x321c91['id']},{})[_0x615b('0x2e')](function(){return _0xad1b62;});}else{return _0xad1b62;}})[_0x615b('0x49')](function(_0x21ce5c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21ce5c);throw _0x21ce5c;});}return _0xad1b62;})[_0x615b('0x2e')](respondWithResult(_0x508ce0,null))[_0x615b('0x49')](handleError(_0x508ce0,null));}});}catch(_0x2971e3){_0x508ce0[_0x615b('0x23')](0x1f4)[_0x615b('0x91')](_0x2971e3);}};function removeReferences(_0x2893ac,_0x5b2691){try{if(_0x2893ac){fs[_0x615b('0x65')](_0x2893ac);logger['info'](_0x615b('0x92'));}if(_0x5b2691){rimraf(_0x5b2691,function(){});logger[_0x615b('0x66')]('Extracted\x20folder\x20removed');}}catch(_0x3cd59c){logger[_0x615b('0x32')](_0x3cd59c);}}exports[_0x615b('0x2c')]=function(_0x57cc07,_0x4c8cbf,_0x2e3cf7){return db[_0x615b('0x35')][_0x615b('0x4e')]({'where':{'id':_0x57cc07['params']['id']}})['then'](handleEntityNotFound(_0x4c8cbf,null))[_0x615b('0x2e')](saveUpdates(_0x57cc07[_0x615b('0x8a')],null))[_0x615b('0x2e')](respondWithResult(_0x4c8cbf,null))[_0x615b('0x49')](handleError(_0x4c8cbf,null));};exports[_0x615b('0x93')]=function(_0x36c788,_0x88c8b,_0x3c396b){return db[_0x615b('0x35')][_0x615b('0x4e')]({'where':{'id':_0x36c788[_0x615b('0x4b')]['id']}})['then'](function(_0x56f915){if(_0x56f915){return _0x56f915[_0x615b('0x2d')]();}})[_0x615b('0x2e')](function(_0x163e73){rimraf(path[_0x615b('0x50')](config[_0x615b('0x51')],'server/files/plugins',path[_0x615b('0x94')](_0x163e73[_0x615b('0xa')])),function(){});return _0x163e73;})[_0x615b('0x2e')](handleEntityNotFound(_0x88c8b,null))['then'](respondWithStatusCode(_0x88c8b,null))['catch'](handleError(_0x88c8b,null));};exports['webhookGet']=function(_0x4a885a,_0x23f559,_0x31e806){return BPromise[_0x615b('0x95')]()[_0x615b('0x2e')](function(){if(!_0x4a885a[_0x615b('0x3a')][_0x615b('0xa')]){throw new Error(_0x615b('0x96'));}if(!_0x4a885a[_0x615b('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1edb04=_0x4a885a[_0x615b('0x3a')][_0x615b('0x97')]?_0x4a885a[_0x615b('0x3a')][_0x615b('0x97')]+':'+_0x4a885a[_0x615b('0x3a')][_0x615b('0x98')]:_0x615b('0x99')+_0x4a885a[_0x615b('0x3a')][_0x615b('0x98')];var _0x125760=_0x4a885a['query'][_0x615b('0x25')]?_0x4a885a[_0x615b('0x3a')][_0x615b('0x25')]:!![];var _0x346659=_0x4a885a[_0x615b('0x3a')][_0x615b('0x9a')]?_0x4a885a[_0x615b('0x3a')][_0x615b('0x9a')]:null;var _0x165169={'method':_0x4a885a[_0x615b('0x9b')],'uri':util['format'](_0x615b('0x9c'),_0x1edb04,_0x4a885a[_0x615b('0x3a')][_0x615b('0xa')]),'json':_0x125760,'resolveWithFullResponse':!![],'encoding':_0x346659,'qs':_0x4a885a[_0x615b('0x3a')]};if(_0x4a885a[_0x615b('0x9d')]){_0x165169[_0x615b('0x9d')]=_0x4a885a[_0x615b('0x9d')];if(_0x165169[_0x615b('0x9d')][_0x615b('0x9e')]){delete _0x165169[_0x615b('0x9d')]['content-length'];}}if(_0x165169[_0x615b('0x9d')]['content-type']){delete _0x165169[_0x615b('0x9d')][_0x615b('0x9f')];}return rp(_0x165169);})[_0x615b('0x2e')](function(_0x2df5ec){if(_0x2df5ec){_0x23f559[_0x615b('0x28')](_0x2df5ec[_0x615b('0x9d')]);logger[_0x615b('0x66')](_0x2df5ec[_0x615b('0x8a')]);if(_[_0x615b('0xa0')](_0x4a885a[_0x615b('0x3a')][_0x615b('0xa')],_0x615b('0x4f'))&&_0x2df5ec['statusCode']==0x1f4){return _0x23f559[_0x615b('0x22')](_0x2df5ec['statusCode']);}else{return _0x23f559[_0x615b('0x23')](_0x2df5ec[_0x615b('0xa1')])[_0x615b('0x91')](_0x2df5ec[_0x615b('0x8a')]);}}else{return _0x23f559['sendStatus'](0xc8);}})[_0x615b('0x49')](handleError(_0x23f559,null));};exports[_0x615b('0xa2')]=function(_0x59e8ec,_0x23b4c4,_0xb37620){return BPromise['resolve']()[_0x615b('0x2e')](function(){if(!_0x59e8ec[_0x615b('0x3a')][_0x615b('0xa')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x59e8ec[_0x615b('0x3a')][_0x615b('0x98')]){throw new Error(_0x615b('0xa3'));}var _0xf4ba9f=_0x59e8ec['query'][_0x615b('0x97')]?_0x59e8ec[_0x615b('0x3a')][_0x615b('0x97')]+':'+_0x59e8ec[_0x615b('0x3a')][_0x615b('0x98')]:'http://localhost:'+_0x59e8ec[_0x615b('0x3a')][_0x615b('0x98')];var _0x55d4f2=_0x59e8ec[_0x615b('0x3a')][_0x615b('0x25')]?_0x59e8ec[_0x615b('0x3a')][_0x615b('0x25')]:!![];var _0x1f5987=_0x59e8ec[_0x615b('0x3a')][_0x615b('0x9a')]?_0x59e8ec['query'][_0x615b('0x9a')]:null;var _0x153f7c={'method':_0x59e8ec[_0x615b('0x9b')],'uri':util['format'](_0x615b('0x9c'),_0xf4ba9f,_0x59e8ec[_0x615b('0x3a')][_0x615b('0xa')]),'json':_0x55d4f2,'resolveWithFullResponse':!![],'encoding':_0x1f5987,'body':_0x59e8ec[_0x615b('0x8a')]};if(_0x59e8ec[_0x615b('0x9d')]){_0x153f7c[_0x615b('0x9d')]=_0x59e8ec[_0x615b('0x9d')];if(_0x153f7c['headers'][_0x615b('0x9e')]){delete _0x153f7c[_0x615b('0x9d')][_0x615b('0x9e')];}}if(_0x153f7c[_0x615b('0x9d')][_0x615b('0x9f')]){delete _0x153f7c[_0x615b('0x9d')][_0x615b('0x9f')];}return rp(_0x153f7c);})['then'](function(_0x38884b){if(_0x38884b){_0x23b4c4[_0x615b('0x28')](_0x38884b['headers']);logger[_0x615b('0x66')](_0x38884b['body']);return _0x23b4c4[_0x615b('0x23')](_0x38884b[_0x615b('0xa1')])[_0x615b('0x91')](_0x38884b[_0x615b('0x8a')]);}else{return _0x23b4c4[_0x615b('0x22')](0xc8);}})[_0x615b('0x49')](handleError(_0x23b4c4,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 693551b..f067555 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x5cc94b,_0x567450){var _0x182468=function(_0x3b7c92){while(--_0x3b7c92){_0x5cc94b['push'](_0x5cc94b['shift']());}};_0x182468(++_0x567450);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x65f6('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){PluginEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);PluginEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=PluginEvents; \ No newline at end of file +var _0x3d04=['Plugin','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x43d0('0x0'));var Plugin=require(_0x43d0('0x1'))['db'][_0x43d0('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x43d0('0x3')](0x0);var events={'afterCreate':_0x43d0('0x4'),'afterUpdate':_0x43d0('0x5'),'afterDestroy':_0x43d0('0x6')};function emitEvent(_0x1f80fd){return function(_0x5a9e1d,_0x2a4d4c,_0x1a75d4){PluginEvents[_0x43d0('0x7')](_0x1f80fd+':'+_0x5a9e1d['id'],_0x5a9e1d);PluginEvents[_0x43d0('0x7')](_0x1f80fd,_0x5a9e1d);_0x1a75d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 31d4fe8..d8a9a9d 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 _0x22a7=['Plugin','plugins','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x117f18,_0x43cb2b){var _0x2d04e6=function(_0x15f1f7){while(--_0x15f1f7){_0x117f18['push'](_0x117f18['shift']());}};_0x2d04e6(++_0x43cb2b);}(_0x22a7,0x18e));var _0x722a=function(_0x2d9273,_0x30a62e){_0x2d9273=_0x2d9273-0x0;var _0x3069f8=_0x22a7[_0x2d9273];return _0x3069f8;};'use strict';var _=require(_0x722a('0x0'));var util=require(_0x722a('0x1'));var logger=require('../../config/logger')(_0x722a('0x2'));var moment=require(_0x722a('0x3'));var BPromise=require(_0x722a('0x4'));var rp=require(_0x722a('0x5'));var fs=require('fs');var path=require(_0x722a('0x6'));var rimraf=require(_0x722a('0x7'));var config=require(_0x722a('0x8'));var attributes=require(_0x722a('0x9'));module['exports']=function(_0x3c610b,_0x32963f){return _0x3c610b['define'](_0x722a('0xa'),attributes,{'tableName':_0x722a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2d4=['path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x28c995,_0xebd1a0){var _0x252553=function(_0x3cc9f8){while(--_0x3cc9f8){_0x28c995['push'](_0x28c995['shift']());}};_0x252553(++_0xebd1a0);}(_0xc2d4,0x162));var _0x4c2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc2d4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4c2d('0x0'));var util=require(_0x4c2d('0x1'));var logger=require(_0x4c2d('0x2'))(_0x4c2d('0x3'));var moment=require(_0x4c2d('0x4'));var BPromise=require(_0x4c2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c2d('0x6'));var rimraf=require(_0x4c2d('0x7'));var config=require(_0x4c2d('0x8'));var attributes=require(_0x4c2d('0x9'));module[_0x4c2d('0xa')]=function(_0x15df56,_0x1a406b){return _0x15df56['define'](_0x4c2d('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 5f7c286..a42ce58 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 _0x7139=['options','raw','then','CreatePlugin','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','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','message','result','catch','create','body'];(function(_0x224e06,_0x5eab0f){var _0x125c60=function(_0x755ff){while(--_0x755ff){_0x224e06['push'](_0x224e06['shift']());}};_0x125c60(++_0x5eab0f);}(_0x7139,0xb4));var _0x9713=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7139[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9713('0x0'));var util=require(_0x9713('0x1'));var moment=require(_0x9713('0x2'));var BPromise=require(_0x9713('0x3'));var rs=require(_0x9713('0x4'));var fs=require('fs');var Redis=require(_0x9713('0x5'));var db=require(_0x9713('0x6'))['db'];var utils=require(_0x9713('0x7'));var logger=require(_0x9713('0x8'))('rpc');var config=require(_0x9713('0x9'));var jayson=require(_0x9713('0xa'));var client=jayson['client'][_0x9713('0xb')]({'port':0x232a});config[_0x9713('0xc')]=_[_0x9713('0xd')](config[_0x9713('0xc')],{'host':_0x9713('0xe'),'port':0x18eb});var socket=require(_0x9713('0xf'))(new Redis(config[_0x9713('0xc')]));require(_0x9713('0x10'))[_0x9713('0x11')](socket);function respondWithRpcPromise(_0x1a9b76,_0x4b47de,_0x4ef99b){return new BPromise(function(_0x46aa9b,_0x50a690){return client[_0x9713('0x12')](_0x1a9b76,_0x4ef99b)['then'](function(_0x274406){logger[_0x9713('0x13')](_0x9713('0x14'),_0x4b47de,_0x9713('0x15'));logger['debug'](_0x9713('0x16'),_0x4b47de,'request\x20sent',JSON[_0x9713('0x17')](_0x274406));if(_0x274406[_0x9713('0x18')]){if(_0x274406[_0x9713('0x18')]['code']===0x1f4){logger['error'](_0x9713('0x14'),_0x4b47de,_0x274406['error']['message']);return _0x50a690(_0x274406[_0x9713('0x18')][_0x9713('0x19')]);}logger['error'](_0x9713('0x14'),_0x4b47de,_0x274406[_0x9713('0x18')][_0x9713('0x19')]);return _0x46aa9b(_0x274406[_0x9713('0x18')][_0x9713('0x19')]);}else{logger[_0x9713('0x13')]('Plugin,\x20%s,\x20%s',_0x4b47de,_0x9713('0x15'));_0x46aa9b(_0x274406[_0x9713('0x1a')][_0x9713('0x19')]);}})[_0x9713('0x1b')](function(_0x2196a4){logger[_0x9713('0x18')](_0x9713('0x14'),_0x4b47de,_0x2196a4);_0x50a690(_0x2196a4);});});}exports['CreatePlugin']=function(_0x4bdbab){var _0x7e8ab5=this;return new Promise(function(_0x478b08,_0x2a6e3a){return db['Plugin'][_0x9713('0x1c')](_0x4bdbab[_0x9713('0x1d')],{'raw':_0x4bdbab[_0x9713('0x1e')]?_0x4bdbab[_0x9713('0x1e')][_0x9713('0x1f')]===undefined?!![]:![]:!![]})[_0x9713('0x20')](function(_0x41acd3){logger[_0x9713('0x13')](_0x9713('0x21'),_0x4bdbab);logger[_0x9713('0x22')](_0x9713('0x21'),_0x4bdbab,JSON[_0x9713('0x17')](_0x41acd3));_0x478b08(_0x41acd3);})['catch'](function(_0x3c704f){logger[_0x9713('0x18')](_0x9713('0x21'),_0x3c704f[_0x9713('0x19')],_0x4bdbab);_0x2a6e3a(_0x7e8ab5[_0x9713('0x18')](0x1f4,_0x3c704f[_0x9713('0x19')]));});});}; \ No newline at end of file +var _0x90ff=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x534f75,_0x2a1d63){var _0x13666a=function(_0x237a0e){while(--_0x237a0e){_0x534f75['push'](_0x534f75['shift']());}};_0x13666a(++_0x2a1d63);}(_0x90ff,0xfa));var _0xf90f=function(_0x2df6b5,_0x5337e5){_0x2df6b5=_0x2df6b5-0x0;var _0x49d098=_0x90ff[_0x2df6b5];return _0x49d098;};'use strict';var _=require(_0xf90f('0x0'));var util=require(_0xf90f('0x1'));var moment=require('moment');var BPromise=require(_0xf90f('0x2'));var rs=require(_0xf90f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf90f('0x4'))['db'];var utils=require(_0xf90f('0x5'));var logger=require(_0xf90f('0x6'))(_0xf90f('0x7'));var config=require(_0xf90f('0x8'));var jayson=require(_0xf90f('0x9'));var client=jayson[_0xf90f('0xa')][_0xf90f('0xb')]({'port':0x232a});config[_0xf90f('0xc')]=_[_0xf90f('0xd')](config[_0xf90f('0xc')],{'host':_0xf90f('0xe'),'port':0x18eb});var socket=require(_0xf90f('0xf'))(new Redis(config['redis']));require(_0xf90f('0x10'))[_0xf90f('0x11')](socket);function respondWithRpcPromise(_0x4540e1,_0x1b657f,_0x5e0a3f){return new BPromise(function(_0x1d6b1a,_0x1186aa){return client['request'](_0x4540e1,_0x5e0a3f)[_0xf90f('0x12')](function(_0x50b6d8){logger['info'](_0xf90f('0x13'),_0x1b657f,_0xf90f('0x14'));logger[_0xf90f('0x15')](_0xf90f('0x16'),_0x1b657f,_0xf90f('0x14'),JSON[_0xf90f('0x17')](_0x50b6d8));if(_0x50b6d8['error']){if(_0x50b6d8[_0xf90f('0x18')][_0xf90f('0x19')]===0x1f4){logger[_0xf90f('0x18')](_0xf90f('0x13'),_0x1b657f,_0x50b6d8[_0xf90f('0x18')][_0xf90f('0x1a')]);return _0x1186aa(_0x50b6d8[_0xf90f('0x18')]['message']);}logger[_0xf90f('0x18')]('Plugin,\x20%s,\x20%s',_0x1b657f,_0x50b6d8['error'][_0xf90f('0x1a')]);return _0x1d6b1a(_0x50b6d8['error'][_0xf90f('0x1a')]);}else{logger[_0xf90f('0x1b')](_0xf90f('0x13'),_0x1b657f,_0xf90f('0x14'));_0x1d6b1a(_0x50b6d8[_0xf90f('0x1c')][_0xf90f('0x1a')]);}})[_0xf90f('0x1d')](function(_0x4905dd){logger[_0xf90f('0x18')]('Plugin,\x20%s,\x20%s',_0x1b657f,_0x4905dd);_0x1186aa(_0x4905dd);});});}exports[_0xf90f('0x1e')]=function(_0x3c73ae){var _0x4ac66d=this;return new Promise(function(_0x122e44,_0x1c57f3){return db['Plugin'][_0xf90f('0x1f')](_0x3c73ae[_0xf90f('0x20')],{'raw':_0x3c73ae[_0xf90f('0x21')]?_0x3c73ae[_0xf90f('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xf90f('0x12')](function(_0x5531a6){logger[_0xf90f('0x1b')](_0xf90f('0x1e'),_0x3c73ae);logger[_0xf90f('0x15')](_0xf90f('0x1e'),_0x3c73ae,JSON[_0xf90f('0x17')](_0x5531a6));_0x122e44(_0x5531a6);})[_0xf90f('0x1d')](function(_0x3434a9){logger[_0xf90f('0x18')](_0xf90f('0x1e'),_0x3434a9['message'],_0x3c73ae);_0x1c57f3(_0x4ac66d[_0xf90f('0x18')](0x1f4,_0x3434a9['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7206f1e..4e67f2b 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 _0xc65a=['register','plugin:','./plugin.events','remove'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xc65a,0xfa));var _0xac65=function(_0x52c167,_0x38e54e){_0x52c167=_0x52c167-0x0;var _0x3bfcb5=_0xc65a[_0x52c167];return _0x3bfcb5;};'use strict';var PluginEvents=require(_0xac65('0x0'));var events=['save',_0xac65('0x1'),'update'];function createListener(_0x506792,_0x21320a){return function(_0x3dbca1){_0x21320a['emit'](_0x506792,_0x3dbca1);};}function removeListener(_0x3e3c74,_0x148b32){return function(){PluginEvents['removeListener'](_0x3e3c74,_0x148b32);};}exports[_0xac65('0x2')]=function(_0x201045){for(var _0x20a2f1=0x0,_0x13cbd6=events['length'];_0x20a2f1<_0x13cbd6;_0x20a2f1++){var _0x205a29=events[_0x20a2f1];var _0x3d9a4f=createListener(_0xac65('0x3')+_0x205a29,_0x201045);PluginEvents['on'](_0x205a29,_0x3d9a4f);}}; \ No newline at end of file +var _0xf739=['removeListener','register','plugin:','./plugin.events','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf739,0x81));var _0x9f73=function(_0x166eba,_0x1105b5){_0x166eba=_0x166eba-0x0;var _0x4158c3=_0xf739[_0x166eba];return _0x4158c3;};'use strict';var PluginEvents=require(_0x9f73('0x0'));var events=['save',_0x9f73('0x1'),_0x9f73('0x2')];function createListener(_0x5ca043,_0x1fe1b3){return function(_0x3f3146){_0x1fe1b3[_0x9f73('0x3')](_0x5ca043,_0x3f3146);};}function removeListener(_0x503b41,_0x439513){return function(){PluginEvents[_0x9f73('0x4')](_0x503b41,_0x439513);};}exports[_0x9f73('0x5')]=function(_0x10aec8){for(var _0x30d4df=0x0,_0x2ee314=events['length'];_0x30d4df<_0x2ee314;_0x30d4df++){var _0x1bb056=events[_0x30d4df];var _0x48c9d3=createListener(_0x9f73('0x6')+_0x1bb056,_0x10aec8);PluginEvents['on'](_0x1bb056,_0x48c9d3);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0ab08b7..4a0fe71 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 _0xdbde=['exports','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy'];(function(_0x86cf2,_0xf91042){var _0x47898d=function(_0x54d6fe){while(--_0x54d6fe){_0x86cf2['push'](_0x86cf2['shift']());}};_0x47898d(++_0xf91042);}(_0xdbde,0x153));var _0xedbd=function(_0x54ee10,_0x159325){_0x54ee10=_0x54ee10-0x0;var _0x4836cd=_0xdbde[_0x54ee10];return _0x4836cd;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xedbd('0x0'));var controller=require(_0xedbd('0x1'));router[_0xedbd('0x2')]('/',auth[_0xedbd('0x3')](),controller[_0xedbd('0x4')]);router[_0xedbd('0x2')]('/:id',auth[_0xedbd('0x3')](),controller[_0xedbd('0x5')]);router[_0xedbd('0x6')]('/',auth[_0xedbd('0x3')](),controller[_0xedbd('0x7')]);router[_0xedbd('0x8')](_0xedbd('0x9'),auth[_0xedbd('0x3')](),controller[_0xedbd('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xedbd('0xb')]);module[_0xedbd('0xc')]=router; \ No newline at end of file +var _0x62e6=['get','show','post','put','update','/:id','destroy','express','Router','../../components/auth/service','./pm2.controller','isAuthenticated','index'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x62e6,0x1db));var _0x662e=function(_0x51b169,_0x5efbc2){_0x51b169=_0x51b169-0x0;var _0x12605a=_0x62e6[_0x51b169];return _0x12605a;};'use strict';var express=require(_0x662e('0x0'));var router=express[_0x662e('0x1')]();var auth=require(_0x662e('0x2'));var controller=require(_0x662e('0x3'));router['get']('/',auth[_0x662e('0x4')](),controller[_0x662e('0x5')]);router[_0x662e('0x6')]('/:id',auth[_0x662e('0x4')](),controller[_0x662e('0x7')]);router[_0x662e('0x8')]('/',auth[_0x662e('0x4')](),controller['create']);router[_0x662e('0x9')]('/:id',auth[_0x662e('0x4')](),controller[_0x662e('0xa')]);router['delete'](_0x662e('0xb'),auth['isAuthenticated'](),controller[_0x662e('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index b3988f9..eddc0af 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 _0x22f2=['destroy','delete','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','reject','express','motion2','length','catch','body','join','../../files/plugins','script','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','params','Unknown\x20status'];(function(_0x5c0e58,_0x2bebae){var _0x3c3d85=function(_0x5b731b){while(--_0x5b731b){_0x5c0e58['push'](_0x5c0e58['shift']());}};_0x3c3d85(++_0x2bebae);}(_0x22f2,0x122));var _0x222f=function(_0x2331d3,_0x2995bd){_0x2331d3=_0x2331d3-0x0;var _0x24a661=_0x22f2[_0x2331d3];return _0x24a661;};'use strict';var _=require('lodash');var pm2=require(_0x222f('0x0'));var logger=require('../../config/logger')(_0x222f('0x1'));var path=require(_0x222f('0x2'));var exec=require(_0x222f('0x3'))[_0x222f('0x4')];var BPromise=require(_0x222f('0x5'));function handleEntityNotFound(_0x2fb5cb,_0x2b8156){return function(_0x4b7c27){if(!_0x4b7c27){_0x2fb5cb[_0x222f('0x6')](0x194);;}return _0x4b7c27;};}function respondWithResult(_0x3b19de,_0x50b200){_0x50b200=_0x50b200||0xc8;return function(_0x36bdf6){if(_0x36bdf6){return _0x3b19de['status'](_0x50b200)[_0x222f('0x7')](_0x36bdf6);}return null;};}function handleError(_0x2f84b0,_0x1cea3f){_0x1cea3f=_0x1cea3f||0x1f4;return function(_0x231b2a){logger[_0x222f('0x8')](_0x231b2a[_0x222f('0x9')]);if(_0x231b2a[_0x222f('0xa')]){delete _0x231b2a['name'];}_0x2f84b0[_0x222f('0xb')](_0x1cea3f)[_0x222f('0xc')](_0x231b2a);};}function execChildProcess(){return new BPromise(function(_0x3845af,_0x4275c9){exec('npm\x20install',function(_0x462f67,_0x4cc440,_0x395ff9){logger[_0x222f('0xd')](_0x4cc440);logger[_0x222f('0xd')](_0x395ff9);if(_0x462f67){logger[_0x222f('0x8')](_0x462f67);return _0x4275c9(_0x462f67);}return _0x3845af(_0x4cc440);});});}exports[_0x222f('0xe')]=function(_0x4f725c,_0x18a6b8){return pm2[_0x222f('0xf')]()[_0x222f('0x10')](function(_0x451d48){if(_0x451d48){var _0x138f5f=_[_0x222f('0x11')](_0x451d48,function(_0x804229){return _0x804229[_0x222f('0xa')]===_0x222f('0x12')||_0x804229[_0x222f('0xa')]===_0x222f('0x13');});return{'rows':_0x138f5f,'count':_0x138f5f[_0x222f('0x14')]};}return null;})[_0x222f('0x10')](respondWithResult(_0x18a6b8,null))['catch'](handleError(_0x18a6b8,null));};exports['show']=function(_0x1676c1,_0x1760dc){return pm2['describe'](_0x1676c1['params']['id'])['then'](respondWithResult(_0x1760dc,null))[_0x222f('0x10')](handleEntityNotFound(_0x1760dc,null))[_0x222f('0x15')](handleError(_0x1760dc,null));};exports['create']=function(_0x4c1677,_0x52173f){if(_0x4c1677[_0x222f('0x16')][_0x222f('0xa')]&&_0x4c1677['body']['script']){var _0x45dc1c=path[_0x222f('0x17')](__dirname,_0x222f('0x18'),_0x4c1677['body'][_0x222f('0x19')]);var _0x4e93a5=process[_0x222f('0x1a')]();process[_0x222f('0x1b')](path[_0x222f('0x1c')](_0x45dc1c));return execChildProcess()[_0x222f('0x10')](function(_0x4a198f){process['chdir'](_0x4e93a5);return pm2['start']({'name':_0x4c1677[_0x222f('0x16')][_0x222f('0xa')],'script':_0x45dc1c});})[_0x222f('0x10')](function(_0x154eea){pm2[_0x222f('0x1d')]();return _0x154eea[0x0];})[_0x222f('0x10')](respondWithResult(_0x52173f,0xc9))[_0x222f('0x15')](handleError(_0x52173f,null));}else{return _0x52173f['status'](0x1f4)['send']({'message':_0x222f('0x1e')});}};exports[_0x222f('0x1f')]=function(_0x1bb5ba,_0x2fab86){if(_0x1bb5ba[_0x222f('0x16')]['id']){delete _0x1bb5ba[_0x222f('0x16')]['id'];}var _0x616fe4={'online':'restart','stopped':'stop'};if(_0x616fe4['hasOwnProperty'](_0x1bb5ba['body'][_0x222f('0xb')])){return pm2[_0x616fe4[_0x1bb5ba[_0x222f('0x16')]['status']]](_0x1bb5ba[_0x222f('0x20')]['id'])[_0x222f('0x10')](respondWithResult(_0x2fab86,0xc8))[_0x222f('0x15')](handleError(_0x2fab86,null));}else{return _0x2fab86[_0x222f('0xb')](0x1f4)[_0x222f('0xc')]({'message':_0x222f('0x21')});}};exports[_0x222f('0x22')]=function(_0x52cebd,_0x113bee){if(_0x52cebd['body']['id']){delete _0x52cebd['body']['id'];}if(_0x52cebd[_0x222f('0x20')]['id']){return pm2[_0x222f('0x23')](_0x52cebd[_0x222f('0x20')]['id'])[_0x222f('0x10')](function(_0x588cc4){pm2[_0x222f('0x1d')]();return _0x588cc4[0x0];})[_0x222f('0x10')](respondWithResult(_0x113bee,null))[_0x222f('0x15')](handleError(_0x113bee,null));}else{return _0x113bee[_0x222f('0xb')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x7435=['../../config/logger','child_process','bluebird','stack','name','send','info','index','list','then','reject','express','length','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','status','Unknown\x20status','delete','Unknown\x20id','lodash'];(function(_0x55a91e,_0x2ba1a3){var _0x291346=function(_0xd1e71d){while(--_0xd1e71d){_0x55a91e['push'](_0x55a91e['shift']());}};_0x291346(++_0x2ba1a3);}(_0x7435,0x1c6));var _0x5743=function(_0x2ccc1f,_0x232d1b){_0x2ccc1f=_0x2ccc1f-0x0;var _0x360796=_0x7435[_0x2ccc1f];return _0x360796;};'use strict';var _=require(_0x5743('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x5743('0x1'))('api');var path=require('path');var exec=require(_0x5743('0x2'))['exec'];var BPromise=require(_0x5743('0x3'));function handleEntityNotFound(_0x14f151,_0x40dd5f){return function(_0x54191a){if(!_0x54191a){_0x14f151['sendStatus'](0x194);;}return _0x54191a;};}function respondWithResult(_0x40a536,_0x1c6dce){_0x1c6dce=_0x1c6dce||0xc8;return function(_0x525ef1){if(_0x525ef1){return _0x40a536['status'](_0x1c6dce)['json'](_0x525ef1);}return null;};}function handleError(_0x45162d,_0x3fc435){_0x3fc435=_0x3fc435||0x1f4;return function(_0x37c0c1){logger['error'](_0x37c0c1[_0x5743('0x4')]);if(_0x37c0c1[_0x5743('0x5')]){delete _0x37c0c1[_0x5743('0x5')];}_0x45162d['status'](_0x3fc435)[_0x5743('0x6')](_0x37c0c1);};}function execChildProcess(){return new BPromise(function(_0x162030,_0xc95708){exec('npm\x20install',function(_0x3500cb,_0x542a0e,_0x4bb2f2){logger[_0x5743('0x7')](_0x542a0e);logger[_0x5743('0x7')](_0x4bb2f2);if(_0x3500cb){logger['error'](_0x3500cb);return _0xc95708(_0x3500cb);}return _0x162030(_0x542a0e);});});}exports[_0x5743('0x8')]=function(_0x3da9cf,_0x2cadce){return pm2[_0x5743('0x9')]()[_0x5743('0xa')](function(_0x5d1b5e){if(_0x5d1b5e){var _0x314b44=_[_0x5743('0xb')](_0x5d1b5e,function(_0x1652fd){return _0x1652fd[_0x5743('0x5')]===_0x5743('0xc')||_0x1652fd[_0x5743('0x5')]==='motion2';});return{'rows':_0x314b44,'count':_0x314b44[_0x5743('0xd')]};}return null;})['then'](respondWithResult(_0x2cadce,null))[_0x5743('0xe')](handleError(_0x2cadce,null));};exports[_0x5743('0xf')]=function(_0x1477d6,_0x399ba7){return pm2[_0x5743('0x10')](_0x1477d6[_0x5743('0x11')]['id'])[_0x5743('0xa')](respondWithResult(_0x399ba7,null))[_0x5743('0xa')](handleEntityNotFound(_0x399ba7,null))['catch'](handleError(_0x399ba7,null));};exports[_0x5743('0x12')]=function(_0x9a4194,_0x463b49){if(_0x9a4194[_0x5743('0x13')][_0x5743('0x5')]&&_0x9a4194['body']['script']){var _0x1751e5=path[_0x5743('0x14')](__dirname,_0x5743('0x15'),_0x9a4194[_0x5743('0x13')][_0x5743('0x16')]);var _0x7d42fc=process[_0x5743('0x17')]();process[_0x5743('0x18')](path['dirname'](_0x1751e5));return execChildProcess()[_0x5743('0xa')](function(_0x36c182){process[_0x5743('0x18')](_0x7d42fc);return pm2['start']({'name':_0x9a4194[_0x5743('0x13')][_0x5743('0x5')],'script':_0x1751e5});})[_0x5743('0xa')](function(_0x1c105d){pm2[_0x5743('0x19')]();return _0x1c105d[0x0];})['then'](respondWithResult(_0x463b49,0xc9))[_0x5743('0xe')](handleError(_0x463b49,null));}else{return _0x463b49['status'](0x1f4)[_0x5743('0x6')]({'message':_0x5743('0x1a')});}};exports[_0x5743('0x1b')]=function(_0x5d8261,_0x57829f){if(_0x5d8261[_0x5743('0x13')]['id']){delete _0x5d8261[_0x5743('0x13')]['id'];}var _0x3a3bb8={'online':_0x5743('0x1c'),'stopped':_0x5743('0x1d')};if(_0x3a3bb8[_0x5743('0x1e')](_0x5d8261[_0x5743('0x13')]['status'])){return pm2[_0x3a3bb8[_0x5d8261[_0x5743('0x13')][_0x5743('0x1f')]]](_0x5d8261['params']['id'])['then'](respondWithResult(_0x57829f,0xc8))[_0x5743('0xe')](handleError(_0x57829f,null));}else{return _0x57829f[_0x5743('0x1f')](0x1f4)[_0x5743('0x6')]({'message':_0x5743('0x20')});}};exports['destroy']=function(_0x44b90b,_0x55e542){if(_0x44b90b[_0x5743('0x13')]['id']){delete _0x44b90b['body']['id'];}if(_0x44b90b[_0x5743('0x11')]['id']){return pm2[_0x5743('0x21')](_0x44b90b[_0x5743('0x11')]['id'])['then'](function(_0x3a772c){pm2['dump']();return _0x3a772c[0x0];})[_0x5743('0xa')](respondWithResult(_0x55e542,null))[_0x5743('0xe')](handleError(_0x55e542,null));}else{return _0x55e542[_0x5743('0x1f')](0x1f4)[_0x5743('0x6')]({'message':_0x5743('0x22')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 32ff3d0..bdc50b5 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 _0x6bcf=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout','express'];(function(_0x552843,_0x494e2f){var _0x296639=function(_0x10fe1f){while(--_0x10fe1f){_0x552843['push'](_0x552843['shift']());}};_0x296639(++_0x494e2f);}(_0x6bcf,0xb4));var _0xf6bc=function(_0x3b08c8,_0x4064f8){_0x3b08c8=_0x3b08c8-0x0;var _0x460c1a=_0x6bcf[_0x3b08c8];return _0x460c1a;};'use strict';var multer=require(_0xf6bc('0x0'));var util=require(_0xf6bc('0x1'));var path=require('path');var timeout=require(_0xf6bc('0x2'));var express=require(_0xf6bc('0x3'));var router=express[_0xf6bc('0x4')]();var auth=require(_0xf6bc('0x5'));var interaction=require(_0xf6bc('0x6'));var config=require('../../config/environment');module[_0xf6bc('0x7')]=router; \ No newline at end of file +var _0x1fb3=['../../config/environment','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x24a827,_0x3d9d39){var _0x79a50b=function(_0x3cb11){while(--_0x3cb11){_0x24a827['push'](_0x24a827['shift']());}};_0x79a50b(++_0x3d9d39);}(_0x1fb3,0x1d2));var _0x31fb=function(_0x707bd,_0xa35918){_0x707bd=_0x707bd-0x0;var _0x454003=_0x1fb3[_0x707bd];return _0x454003;};'use strict';var multer=require(_0x31fb('0x0'));var util=require(_0x31fb('0x1'));var path=require(_0x31fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x31fb('0x3'));var router=express[_0x31fb('0x4')]();var auth=require(_0x31fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31fb('0x6'));module[_0x31fb('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 671c9ca..589488e 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 _0xe1b5=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0x3fb052,_0x56f779){var _0x2c9f68=function(_0x12bcc4){while(--_0x12bcc4){_0x3fb052['push'](_0x3fb052['shift']());}};_0x2c9f68(++_0x56f779);}(_0xe1b5,0x15b));var _0x5e1b=function(_0x58a0f2,_0xda36f5){_0x58a0f2=_0x58a0f2-0x0;var _0x590bb=_0xe1b5[_0x58a0f2];return _0x590bb;};'use strict';var Sequelize=require(_0x5e1b('0x0'));module[_0x5e1b('0x1')]={'state':{'type':Sequelize[_0x5e1b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5e1b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5e1b('0x3')]},'responsetime':{'type':Sequelize[_0x5e1b('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5e1b('0x4')]},'campaigntype':{'type':Sequelize[_0x5e1b('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb951=['STRING','DATE','exports','INTEGER'];(function(_0x4d8aaf,_0x3416ff){var _0x259a5a=function(_0x3e1d46){while(--_0x3e1d46){_0x4d8aaf['push'](_0x4d8aaf['shift']());}};_0x259a5a(++_0x3416ff);}(_0xb951,0x1e2));var _0x1b95=function(_0x5801ca,_0x7a4caa){_0x5801ca=_0x5801ca-0x0;var _0x6301c3=_0xb951[_0x5801ca];return _0x6301c3;};'use strict';var Sequelize=require('sequelize');module[_0x1b95('0x0')]={'state':{'type':Sequelize[_0x1b95('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1b95('0x2')]},'scheduledat':{'type':Sequelize[_0x1b95('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1b95('0x3')]},'responsetime':{'type':Sequelize[_0x1b95('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1b95('0x2')]},'campaigntype':{'type':Sequelize[_0x1b95('0x2')]},'membername':{'type':Sequelize[_0x1b95('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fd04de5..ca0948b 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 _0x6f92=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports'];(function(_0x35717c,_0x39ffa0){var _0x11150c=function(_0x1a2f23){while(--_0x1a2f23){_0x35717c['push'](_0x35717c['shift']());}};_0x11150c(++_0x39ffa0);}(_0x6f92,0xf1));var _0x26f9=function(_0xd6bba3,_0x5640f5){_0xd6bba3=_0xd6bba3-0x0;var _0x3035c1=_0x6f92[_0xd6bba3];return _0x3035c1;};'use strict';var _=require(_0x26f9('0x0'));var util=require(_0x26f9('0x1'));var logger=require(_0x26f9('0x2'))(_0x26f9('0x3'));var moment=require(_0x26f9('0x4'));var BPromise=require(_0x26f9('0x5'));var rp=require(_0x26f9('0x6'));var fs=require('fs');var path=require(_0x26f9('0x7'));var rimraf=require(_0x26f9('0x8'));var config=require('../../config/environment');var attributes=require(_0x26f9('0x9'));module[_0x26f9('0xa')]=function(_0x5a2700,_0xc5e516){return _0x5a2700[_0x26f9('0xb')](_0x26f9('0xc'),attributes,{'tableName':_0x26f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x863b=['../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x863b,0xe9));var _0xb863=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x863b[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xb863('0x0'));var util=require(_0xb863('0x1'));var logger=require('../../config/logger')(_0xb863('0x2'));var moment=require(_0xb863('0x3'));var BPromise=require('bluebird');var rp=require(_0xb863('0x4'));var fs=require('fs');var path=require(_0xb863('0x5'));var rimraf=require(_0xb863('0x6'));var config=require(_0xb863('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0xb863('0x8')]=function(_0x143625,_0xe6cf5a){return _0x143625[_0xb863('0x9')](_0xb863('0xa'),attributes,{'tableName':_0xb863('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 9d04b18..c93b9c4 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 _0x1c05=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util','moment','randomstring'];(function(_0x5abbe3,_0x351493){var _0x1b6eec=function(_0x2e5e3c){while(--_0x2e5e3c){_0x5abbe3['push'](_0x5abbe3['shift']());}};_0x1b6eec(++_0x351493);}(_0x1c05,0x1cc));var _0x51c0=function(_0x4d78f9,_0x46ba25){_0x4d78f9=_0x4d78f9-0x0;var _0x1023d6=_0x1c05[_0x4d78f9];return _0x1023d6;};'use strict';var _=require(_0x51c0('0x0'));var util=require(_0x51c0('0x1'));var moment=require(_0x51c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x51c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51c0('0x4'))['db'];var utils=require(_0x51c0('0x5'));var logger=require(_0x51c0('0x6'))(_0x51c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x51c0('0x8'));var client=jayson[_0x51c0('0x9')][_0x51c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c2574,_0x583226,_0x5d90ad){return new BPromise(function(_0x55f286,_0x1a302e){return client[_0x51c0('0xb')](_0x1c2574,_0x5d90ad)[_0x51c0('0xc')](function(_0x2ed005){logger[_0x51c0('0xd')](_0x51c0('0xe'),_0x583226,_0x51c0('0xf'));logger[_0x51c0('0x10')](_0x51c0('0x11'),_0x583226,_0x51c0('0xf'),JSON[_0x51c0('0x12')](_0x2ed005));if(_0x2ed005[_0x51c0('0x13')]){if(_0x2ed005['error'][_0x51c0('0x14')]===0x1f4){logger[_0x51c0('0x13')](_0x51c0('0xe'),_0x583226,_0x2ed005[_0x51c0('0x13')][_0x51c0('0x15')]);return _0x1a302e(_0x2ed005[_0x51c0('0x13')][_0x51c0('0x15')]);}logger[_0x51c0('0x13')](_0x51c0('0xe'),_0x583226,_0x2ed005[_0x51c0('0x13')]['message']);return _0x55f286(_0x2ed005[_0x51c0('0x13')][_0x51c0('0x15')]);}else{logger[_0x51c0('0xd')](_0x51c0('0xe'),_0x583226,_0x51c0('0xf'));_0x55f286(_0x2ed005[_0x51c0('0x16')][_0x51c0('0x15')]);}})[_0x51c0('0x17')](function(_0x1769d9){logger[_0x51c0('0x13')](_0x51c0('0xe'),_0x583226,_0x1769d9);_0x1a302e(_0x1769d9);});});}exports[_0x51c0('0x18')]=function(_0x53fa99){var _0x15cb82=this;return new Promise(function(_0x2b05be,_0xce73a3){return db[_0x51c0('0x19')]['create'](_0x53fa99[_0x51c0('0x1a')],{'raw':_0x53fa99[_0x51c0('0x1b')]?_0x53fa99[_0x51c0('0x1b')][_0x51c0('0x1c')]===undefined?!![]:![]:!![]})[_0x51c0('0xc')](function(_0x3f8816){logger[_0x51c0('0xd')](_0x51c0('0x18'),_0x53fa99);logger['debug'](_0x51c0('0x18'),_0x53fa99,JSON[_0x51c0('0x12')](_0x3f8816));_0x2b05be(_0x3f8816);})[_0x51c0('0x17')](function(_0x431afa){logger['error'](_0x51c0('0x18'),_0x431afa[_0x51c0('0x15')],_0x53fa99);_0xce73a3(_0x15cb82[_0x51c0('0x13')](0x1f4,_0x431afa[_0x51c0('0x15')]));});});}; \ No newline at end of file +var _0x94b6=['raw','stringify','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body'];(function(_0x363b43,_0x5c3729){var _0x54f5b7=function(_0x3f8954){while(--_0x3f8954){_0x363b43['push'](_0x363b43['shift']());}};_0x54f5b7(++_0x5c3729);}(_0x94b6,0xb8));var _0x694b=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x94b6[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x694b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x694b('0x1'));var rs=require(_0x694b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x694b('0x3'));var logger=require(_0x694b('0x4'))(_0x694b('0x5'));var config=require(_0x694b('0x6'));var jayson=require(_0x694b('0x7'));var client=jayson[_0x694b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x963665,_0x2ed9a8,_0x1b4da9){return new BPromise(function(_0x3a2d78,_0x4a607c){return client[_0x694b('0x9')](_0x963665,_0x1b4da9)[_0x694b('0xa')](function(_0x5a428b){logger[_0x694b('0xb')](_0x694b('0xc'),_0x2ed9a8,_0x694b('0xd'));logger[_0x694b('0xe')](_0x694b('0xf'),_0x2ed9a8,_0x694b('0xd'),JSON['stringify'](_0x5a428b));if(_0x5a428b[_0x694b('0x10')]){if(_0x5a428b[_0x694b('0x10')][_0x694b('0x11')]===0x1f4){logger[_0x694b('0x10')](_0x694b('0xc'),_0x2ed9a8,_0x5a428b['error'][_0x694b('0x12')]);return _0x4a607c(_0x5a428b['error'][_0x694b('0x12')]);}logger[_0x694b('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2ed9a8,_0x5a428b['error']['message']);return _0x3a2d78(_0x5a428b[_0x694b('0x10')][_0x694b('0x12')]);}else{logger[_0x694b('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x2ed9a8,_0x694b('0xd'));_0x3a2d78(_0x5a428b[_0x694b('0x13')][_0x694b('0x12')]);}})[_0x694b('0x14')](function(_0x46976b){logger[_0x694b('0x10')](_0x694b('0xc'),_0x2ed9a8,_0x46976b);_0x4a607c(_0x46976b);});});}exports[_0x694b('0x15')]=function(_0x4820fe){var _0xee7530=this;return new Promise(function(_0x23ab1c,_0x433126){return db[_0x694b('0x16')]['create'](_0x4820fe[_0x694b('0x17')],{'raw':_0x4820fe['options']?_0x4820fe['options'][_0x694b('0x18')]===undefined?!![]:![]:!![]})[_0x694b('0xa')](function(_0x18a396){logger[_0x694b('0xb')](_0x694b('0x15'),_0x4820fe);logger['debug'](_0x694b('0x15'),_0x4820fe,JSON[_0x694b('0x19')](_0x18a396));_0x23ab1c(_0x18a396);})['catch'](function(_0x3a7222){logger['error'](_0x694b('0x15'),_0x3a7222[_0x694b('0x12')],_0x4820fe);_0x433126(_0xee7530['error'](0x1f4,_0x3a7222['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b219efb..cd4db36 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 _0xb861=['/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id','post','queueNotify','chat','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','path','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions'];(function(_0xf39af7,_0x34e316){var _0x319b82=function(_0x4c0e16){while(--_0x4c0e16){_0xf39af7['push'](_0xf39af7['shift']());}};_0x319b82(++_0x34e316);}(_0xb861,0x1d6));var _0x1b86=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0xb861[_0x4884a7];return _0x56b60e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b86('0x0'));var express=require('express');var router=express[_0x1b86('0x1')]();var auth=require(_0x1b86('0x2'));var controller=require('./rpc.controller');router[_0x1b86('0x3')](_0x1b86('0x4'),auth['isAuthenticated'](),controller[_0x1b86('0x5')]);router[_0x1b86('0x3')](_0x1b86('0x6'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x8')]);router[_0x1b86('0x3')](_0x1b86('0x9'),auth[_0x1b86('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x1b86('0x3')]('/voice/queues',auth['isAuthenticated'](),controller[_0x1b86('0xa')]);router[_0x1b86('0x3')](_0x1b86('0xb'),auth[_0x1b86('0x7')](),controller[_0x1b86('0xc')]);router[_0x1b86('0x3')](_0x1b86('0xd'),auth[_0x1b86('0x7')](),controller[_0x1b86('0xe')]);router[_0x1b86('0x3')](_0x1b86('0xf'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x10')]);router[_0x1b86('0x3')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x1b86('0x11')]);router[_0x1b86('0x3')](_0x1b86('0x12'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x13')]);router[_0x1b86('0x3')](_0x1b86('0x14'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x15')]);router[_0x1b86('0x3')](_0x1b86('0x16'),auth[_0x1b86('0x7')](),controller['faxQueues']);router[_0x1b86('0x3')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x1b86('0x3')](_0x1b86('0x17'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x1b86('0x3')]('/voice/queues/channels/:uniqueid',auth[_0x1b86('0x7')](),controller[_0x1b86('0x18')]);router[_0x1b86('0x3')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1b86('0x7')](),controller['voiceQueuesChannelHangup']);router['get'](_0x1b86('0x19'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x1a')]);router[_0x1b86('0x3')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x1b86('0x1b')]);router[_0x1b86('0x3')]('/outbound',auth[_0x1b86('0x7')](),controller[_0x1b86('0x1c')]);router['get']('/outbound/channels',auth[_0x1b86('0x7')](),controller[_0x1b86('0x1d')]);router[_0x1b86('0x3')](_0x1b86('0x1e'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x1f')]);router['put'](_0x1b86('0x20'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x21')]);router[_0x1b86('0x3')]('/telephones',auth[_0x1b86('0x7')](),controller['telephones']);router[_0x1b86('0x3')]('/trunks',auth[_0x1b86('0x7')](),controller[_0x1b86('0x22')]);router[_0x1b86('0x3')](_0x1b86('0x23'),auth['isAuthenticated'](),controller[_0x1b86('0x24')]);router['get'](_0x1b86('0x25'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x26')]);router[_0x1b86('0x3')](_0x1b86('0x27'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x28')]);router[_0x1b86('0x3')](_0x1b86('0x29'),auth[_0x1b86('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x1b86('0x3')]('/openchannel/queues/waitinginteractions',auth[_0x1b86('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1b86('0x3')](_0x1b86('0x2a'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1b86('0x2b')]);router['get'](_0x1b86('0x2c'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x2d')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('mail'));router[_0x1b86('0x3')](_0x1b86('0x2e'),auth[_0x1b86('0x7')](),controller['showMailQueues']);router[_0x1b86('0x2f')]('/chat/queues/:id/notify',auth[_0x1b86('0x7')](),controller[_0x1b86('0x30')](_0x1b86('0x31')));router[_0x1b86('0x3')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x1b86('0x2f')](_0x1b86('0x32'),auth[_0x1b86('0x7')](),controller['queueNotify']('fax'));router[_0x1b86('0x3')](_0x1b86('0x33'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x1b86('0x2f')](_0x1b86('0x34'),auth[_0x1b86('0x7')](),controller['queueNotify'](_0x1b86('0x35')));router['get'](_0x1b86('0x36'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x37')]);router[_0x1b86('0x2f')](_0x1b86('0x38'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x30')](_0x1b86('0x39')));router[_0x1b86('0x2f')]('/whatsapp/queues/:id/notify',auth[_0x1b86('0x7')](),controller[_0x1b86('0x30')](_0x1b86('0x3a')));router[_0x1b86('0x3')](_0x1b86('0x3b'),auth[_0x1b86('0x7')](),controller[_0x1b86('0x3c')]);router[_0x1b86('0x3')](_0x1b86('0x3d'),auth[_0x1b86('0x7')](),controller['showWhatsappQueues']);router[_0x1b86('0x2f')]('/agents/:id/notify',auth[_0x1b86('0x7')](),controller[_0x1b86('0x3e')]);module[_0x1b86('0x3f')]=router; \ No newline at end of file +var _0xaa6f=['telephones','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0xaa6f,0x6a));var _0xfaa6=function(_0x499d8b,_0x55c32a){_0x499d8b=_0x499d8b-0x0;var _0x4a3c1b=_0xaa6f[_0x499d8b];return _0x4a3c1b;};'use strict';var multer=require(_0xfaa6('0x0'));var util=require(_0xfaa6('0x1'));var path=require('path');var express=require(_0xfaa6('0x2'));var router=express[_0xfaa6('0x3')]();var auth=require(_0xfaa6('0x4'));var controller=require(_0xfaa6('0x5'));router[_0xfaa6('0x6')](_0xfaa6('0x7'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x9')]);router['get'](_0xfaa6('0xa'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0xfaa6('0xb'),auth[_0xfaa6('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xfaa6('0x6')](_0xfaa6('0xc'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0xd')]);router[_0xfaa6('0x6')](_0xfaa6('0xe'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0xf')]);router[_0xfaa6('0x6')]('/mail/queues',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x10')]);router[_0xfaa6('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xfaa6('0x11')]);router[_0xfaa6('0x6')](_0xfaa6('0x12'),auth['isAuthenticated'](),controller[_0xfaa6('0x13')]);router[_0xfaa6('0x6')](_0xfaa6('0x14'),auth[_0xfaa6('0x8')](),controller['smsQueues']);router[_0xfaa6('0x6')]('/whatsapp/queues',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x15')]);router[_0xfaa6('0x6')](_0xfaa6('0x16'),auth['isAuthenticated'](),controller[_0xfaa6('0x17')]);router['get'](_0xfaa6('0x18'),auth[_0xfaa6('0x8')](),controller['voiceQueuesPreview']);router[_0xfaa6('0x6')](_0xfaa6('0x19'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x1a')]);router[_0xfaa6('0x6')](_0xfaa6('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xfaa6('0x6')](_0xfaa6('0x1c'),auth[_0xfaa6('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xfaa6('0x6')](_0xfaa6('0x1d'),auth[_0xfaa6('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xfaa6('0x6')]('/voice/queues/:id',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x1e')]);router[_0xfaa6('0x6')](_0xfaa6('0x1f'),auth['isAuthenticated'](),controller[_0xfaa6('0x20')]);router[_0xfaa6('0x6')](_0xfaa6('0x21'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0xfaa6('0x6')](_0xfaa6('0x22'),auth['isAuthenticated'](),controller[_0xfaa6('0x23')]);router[_0xfaa6('0x24')](_0xfaa6('0x25'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x26')]);router[_0xfaa6('0x6')](_0xfaa6('0x27'),auth['isAuthenticated'](),controller[_0xfaa6('0x28')]);router[_0xfaa6('0x6')]('/trunks',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x29')]);router[_0xfaa6('0x6')](_0xfaa6('0x2a'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x2b')]);router[_0xfaa6('0x6')](_0xfaa6('0x2c'),auth[_0xfaa6('0x8')](),controller['faxAccounts']);router[_0xfaa6('0x6')](_0xfaa6('0x2d'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xfaa6('0x6')]('/mail/queues/waitinginteractions',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x2e')]);router['get'](_0xfaa6('0x2f'),auth[_0xfaa6('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xfaa6('0x6')](_0xfaa6('0x30'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x31')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x32')]);router[_0xfaa6('0x6')]('/fax/queues/waitinginteractions',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x33')]);router['post'](_0xfaa6('0x34'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x35')](_0xfaa6('0x36')));router['get']('/mail/queues/:id',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x37')]);router[_0xfaa6('0x38')]('/chat/queues/:id/notify',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x35')](_0xfaa6('0x39')));router['get']('/chat/queues/:id',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x3a')]);router[_0xfaa6('0x38')](_0xfaa6('0x3b'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x35')]('fax'));router[_0xfaa6('0x6')](_0xfaa6('0x3c'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x3d')]);router[_0xfaa6('0x38')](_0xfaa6('0x3e'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x35')](_0xfaa6('0x3f')));router[_0xfaa6('0x6')](_0xfaa6('0x40'),auth['isAuthenticated'](),controller[_0xfaa6('0x41')]);router[_0xfaa6('0x38')](_0xfaa6('0x42'),auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x35')](_0xfaa6('0x43')));router[_0xfaa6('0x38')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xfaa6('0x35')](_0xfaa6('0x44')));router[_0xfaa6('0x6')](_0xfaa6('0x45'),auth[_0xfaa6('0x8')](),controller['showSmsQueues']);router[_0xfaa6('0x6')]('/whatsapp/queues/:id',auth[_0xfaa6('0x8')](),controller[_0xfaa6('0x46')]);router[_0xfaa6('0x38')](_0xfaa6('0x47'),auth['isAuthenticated'](),controller[_0xfaa6('0x48')]);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 88fe3f4..d7d46b4 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 _0x04ab=['smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','Account','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','InteractionId','TransferReport','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','sendStatus','stack','name','status','send','isNil','rows','voiceChannels','VoiceChannels','catch','VoiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x04ab,0x1a0));var _0xb04a=function(_0x4f002f,_0x44598d){_0x4f002f=_0x4f002f-0x0;var _0x123519=_0x04ab[_0x4f002f];return _0x123519;};'use strict';var BPromise=require(_0xb04a('0x0'));var moment=require(_0xb04a('0x1'));var _=require(_0xb04a('0x2'));var util=require(_0xb04a('0x3'));var db=require(_0xb04a('0x4'))['db'];var logger=require(_0xb04a('0x5'))(_0xb04a('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xb04a('0x7')][_0xb04a('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xb04a('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0xb04a('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x39df69,_0x2345be,_0x13f114){return new BPromise(function(_0x22ebb5,_0x1c92ce){var _0x5c610b=_0x13f114?_0x13f114:amiClient;return _0x5c610b[_0xb04a('0x9')](_0x39df69,_0x2345be)[_0xb04a('0xa')](function(_0x531a81){if(_0x531a81[_0xb04a('0xb')]){if(_0x531a81[_0xb04a('0xb')][_0xb04a('0xc')]===0x1f4){return _0x1c92ce(_0x531a81[_0xb04a('0xb')][_0xb04a('0xd')]);}return _0x22ebb5(_0x531a81[_0xb04a('0xb')][_0xb04a('0xd')]);}else{_0x22ebb5(_0x531a81[_0xb04a('0xe')]);}})['catch'](function(_0x3a569b){_0x1c92ce(_0x3a569b);});});}function respondWithResult(_0x4f14f2,_0x22861a){_0x22861a=_0x22861a||0xc8;return function(_0xd5a1f7){if(_0xd5a1f7){return _0x4f14f2['status'](_0x22861a)['json'](_0xd5a1f7);}return _0x4f14f2[_0xb04a('0xf')](0x194);};}function handleError(_0x5b917e,_0x767952){_0x767952=_0x767952||0x1f4;return function(_0x23efae){logger['error'](_0x23efae[_0xb04a('0x10')]);if(_0x23efae[_0xb04a('0x11')]){delete _0x23efae[_0xb04a('0x11')];}_0x5b917e[_0xb04a('0x12')](_0x767952)[_0xb04a('0x13')](_0x23efae);};}function findById(_0x3ce49e){return function(_0x4d8972){if(!_['isNil'](_0x3ce49e)&&!_[_0xb04a('0x14')](_0x4d8972)&&!_[_0xb04a('0x14')](_0x4d8972['rows'])){return _['find'](_0x4d8972[_0xb04a('0x15')],function(_0x1cc4ca){return _0x1cc4ca['id']==_0x3ce49e;});}return null;};}exports[_0xb04a('0x16')]=function(_0x3e4f38,_0x5e39e7){return respondWithRpcPromise(_0xb04a('0x17'),_0x3e4f38['query'])['then'](respondWithResult(_0x5e39e7,null))[_0xb04a('0x18')](handleError(_0x5e39e7,null));};exports['voiceChannelMixMonitor']=function(_0xc94323,_0x15c772){return respondWithRpcPromise(_0xb04a('0x19'),_[_0xb04a('0x1a')](_0xc94323[_0xb04a('0x1b')],_0xc94323['params']))['then'](respondWithResult(_0x15c772,null))['catch'](handleError(_0x15c772,null));};exports[_0xb04a('0x1c')]=function(_0x59d47b,_0x1da23b){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x59d47b[_0xb04a('0x1b')],_0x59d47b[_0xb04a('0x1d')]))[_0xb04a('0xa')](respondWithResult(_0x1da23b,null))[_0xb04a('0x18')](handleError(_0x1da23b,null));};exports[_0xb04a('0x1e')]=function(_0x4fae0e,_0x3e9846){return respondWithRpcPromise('VoiceQueues',_0x4fae0e[_0xb04a('0x1b')])['then'](respondWithResult(_0x3e9846,null))['catch'](handleError(_0x3e9846,null));};exports[_0xb04a('0x1f')]=function(_0x1fd321,_0x4fd3d4){return respondWithRpcPromise('VoiceQueues',_0x1fd321[_0xb04a('0x1b')])[_0xb04a('0xa')](findById(_0x1fd321[_0xb04a('0x1d')]['id']))[_0xb04a('0xa')](respondWithResult(_0x4fd3d4,null))['catch'](handleError(_0x4fd3d4,null));};exports[_0xb04a('0x20')]=function(_0x559fde,_0x13c15f){return respondWithRpcPromise(_0xb04a('0x21'),_[_0xb04a('0x1a')](_0x559fde['query'],_0x559fde[_0xb04a('0x1d')]))[_0xb04a('0xa')](respondWithResult(_0x13c15f,null))[_0xb04a('0x18')](handleError(_0x13c15f,null));};exports[_0xb04a('0x22')]=function(_0x34c5bf,_0x46bdb5){return respondWithRpcPromise(_0xb04a('0x23'),_0x34c5bf['query'])[_0xb04a('0xa')](respondWithResult(_0x46bdb5,null))[_0xb04a('0x18')](handleError(_0x46bdb5,null));};exports['voiceQueuesChannel']=function(_0x3aebb1,_0x5dd6c2){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xb04a('0x1a')](_0x3aebb1[_0xb04a('0x1b')],_0x3aebb1[_0xb04a('0x1d')]))[_0xb04a('0xa')](respondWithResult(_0x5dd6c2,null))[_0xb04a('0x18')](handleError(_0x5dd6c2,null));};exports[_0xb04a('0x24')]=function(_0x58ca72,_0x52491f){return respondWithRpcPromise(_0xb04a('0x25'),_['merge'](_0x58ca72['query'],_0x58ca72[_0xb04a('0x1d')]))[_0xb04a('0xa')](respondWithResult(_0x52491f,null))[_0xb04a('0x18')](handleError(_0x52491f,null));};exports[_0xb04a('0x26')]=function(_0x201018,_0xf6668a){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xb04a('0x1a')](_0x201018[_0xb04a('0x1b')],_0x201018['params']))['then'](respondWithResult(_0xf6668a,null))[_0xb04a('0x18')](handleError(_0xf6668a,null));};exports['outbound']=function(_0x522d13,_0x436c8b){return respondWithRpcPromise('Outbound',_0x522d13[_0xb04a('0x1b')])[_0xb04a('0xa')](respondWithResult(_0x436c8b,null))[_0xb04a('0x18')](handleError(_0x436c8b,null));};exports[_0xb04a('0x27')]=function(_0x1b842a,_0xeca732){return respondWithRpcPromise(_0xb04a('0x28'),_0x1b842a['query'])['then'](respondWithResult(_0xeca732,null))[_0xb04a('0x18')](handleError(_0xeca732,null));};exports[_0xb04a('0x29')]=function(_0x20a4bf,_0x5a52e2){var _0x2241aa;return respondWithRpcPromise(_0xb04a('0x2a'),_0x20a4bf[_0xb04a('0x1b')])['then'](function(_0x1f546d){_0x2241aa=_0x1f546d;return respondWithRpcPromise(_0xb04a('0x2a'),_0x20a4bf[_0xb04a('0x1b')],routingClient);})[_0xb04a('0xa')](function(_0x352e28){return _[_0xb04a('0x1a')]({},_0x352e28,_0x2241aa);})[_0xb04a('0xa')](respondWithResult(_0x5a52e2,null))[_0xb04a('0x18')](handleError(_0x5a52e2,null));};exports[_0xb04a('0x2b')]=function(_0x38a919,_0x1f32c2){if(_0x38a919[_0xb04a('0x2c')]&&_0x38a919['body'][_0xb04a('0x2d')]&&_0x38a919[_0xb04a('0x2e')]&&_0x38a919[_0xb04a('0x2e')][_0xb04a('0x11')]){for(var _0x55a0c6 in _0x38a919[_0xb04a('0x2c')]['interaction']){if(_0x38a919[_0xb04a('0x2c')]['interaction'][_0xb04a('0x2f')](_0x55a0c6)){db[_0xb04a('0x30')]['findAll']({'where':{'channel':_0x55a0c6,'membername':_0x38a919[_0xb04a('0x2e')][_0xb04a('0x11')],'type':_0xb04a('0x31'),'exitAt':null,'uniqueid':_0x38a919[_0xb04a('0x2c')][_0xb04a('0x2d')][_0x55a0c6]&&_0x38a919['body'][_0xb04a('0x2d')][_0x55a0c6]['length']?{'$notIn':_0x38a919['body'][_0xb04a('0x2d')][_0x55a0c6]}:{'$ne':null}}})[_0xb04a('0xa')](function(_0x26d05c){var _0x2dfdca=moment()['format'](_0xb04a('0x32'));for(var _0x328c58=0x0,_0x16d109=_0x26d05c[_0xb04a('0x33')];_0x328c58<_0x16d109;_0x328c58+=0x1){_0x26d05c[_0x328c58][_0xb04a('0x34')]({'exitAt':_0x2dfdca});}});for(var _0xe7059e=0x0;_0xe7059e<_0x38a919[_0xb04a('0x2c')][_0xb04a('0x2d')][_0x55a0c6][_0xb04a('0x33')];_0xe7059e+=0x1){db[_0xb04a('0x30')][_0xb04a('0x35')]({'where':{'channel':_0x55a0c6,'membername':_0x38a919[_0xb04a('0x2e')][_0xb04a('0x11')],'type':'INTERACTION','uniqueid':_0x38a919[_0xb04a('0x2c')][_0xb04a('0x2d')][_0x55a0c6][_0xe7059e],'exitAt':null},'defaults':{'channel':_0x55a0c6,'membername':_0x38a919[_0xb04a('0x2e')][_0xb04a('0x11')],'interface':_[_0xb04a('0x14')](_0x38a919[_0xb04a('0x2e')][_0xb04a('0x36')])?util[_0xb04a('0x37')](_0xb04a('0x38'),_0x38a919[_0xb04a('0x2e')][_0xb04a('0x11')]):_0x38a919['user'][_0xb04a('0x36')],'type':_0xb04a('0x31'),'enterAt':moment()[_0xb04a('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xb04a('0x39'),'internal':_0x38a919[_0xb04a('0x2e')][_0xb04a('0x3a')],'uniqueid':_0x38a919[_0xb04a('0x2c')][_0xb04a('0x2d')][_0x55a0c6][_0xe7059e]}});}}}}return respondWithRpcPromise(_0xb04a('0x3b'),{'id':_0x38a919[_0xb04a('0x1d')]['id'],'capacity':_0x38a919[_0xb04a('0x2c')][_0xb04a('0x3c')]},routingClient)[_0xb04a('0xa')](respondWithResult(_0x1f32c2,null))[_0xb04a('0x18')](handleError(_0x1f32c2,null));};exports[_0xb04a('0x3d')]=function(_0x275c2f,_0x3b6df1){return respondWithRpcPromise(_0xb04a('0x3e'),_0x275c2f[_0xb04a('0x1b')])[_0xb04a('0xa')](respondWithResult(_0x3b6df1,null))['catch'](handleError(_0x3b6df1,null));};exports[_0xb04a('0x3f')]=function(_0x2ec5d7,_0x3e005d){return respondWithRpcPromise(_0xb04a('0x40'),_0x2ec5d7[_0xb04a('0x1b')])[_0xb04a('0xa')](respondWithResult(_0x3e005d,null))[_0xb04a('0x18')](handleError(_0x3e005d,null));};exports[_0xb04a('0x41')]=function(_0x83fd6d,_0x2cd17e){return respondWithRpcPromise(_0xb04a('0x42'),_0x83fd6d['query'])[_0xb04a('0xa')](respondWithResult(_0x2cd17e,null))[_0xb04a('0x18')](handleError(_0x2cd17e,null));};exports[_0xb04a('0x43')]=function(_0x560cc7,_0x27ee74){return respondWithRpcPromise(_0xb04a('0x44'),_0x560cc7[_0xb04a('0x1b')],routingClient)['then'](respondWithResult(_0x27ee74,null))[_0xb04a('0x18')](handleError(_0x27ee74,null));};exports[_0xb04a('0x45')]=function(_0xa1149,_0x32f43d){return respondWithRpcPromise('ChatQueues',_0xa1149[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](findById(_0xa1149[_0xb04a('0x1d')]['id']))['then'](respondWithResult(_0x32f43d,null))[_0xb04a('0x18')](handleError(_0x32f43d,null));};exports[_0xb04a('0x46')]=function(_0x37d051,_0x45ee89){return respondWithRpcPromise(_0xb04a('0x47'),_0x37d051[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](respondWithResult(_0x45ee89,null))['catch'](handleError(_0x45ee89,null));};exports[_0xb04a('0x48')]=function(_0x16aa7a,_0x5d0372){return respondWithRpcPromise(_0xb04a('0x47'),_0x16aa7a[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](findById(_0x16aa7a[_0xb04a('0x1d')]['id']))['then'](respondWithResult(_0x5d0372,null))['catch'](handleError(_0x5d0372,null));};exports['mailAccounts']=function(_0x130e0a,_0x4b9d00){return respondWithRpcPromise('MailAccounts',_0x130e0a[_0xb04a('0x1b')],mailClient)[_0xb04a('0xa')](respondWithResult(_0x4b9d00,null))[_0xb04a('0x18')](handleError(_0x4b9d00,null));};exports[_0xb04a('0x49')]=function(_0x503412,_0x961d4d){return respondWithRpcPromise(_0xb04a('0x4a'),_0x503412[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](respondWithResult(_0x961d4d,null))['catch'](handleError(_0x961d4d,null));};exports[_0xb04a('0x4b')]=function(_0xfe253b,_0x5acc50){return respondWithRpcPromise('OpenchannelQueues',_0xfe253b[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](findById(_0xfe253b[_0xb04a('0x1d')]['id']))['then'](respondWithResult(_0x5acc50,null))['catch'](handleError(_0x5acc50,null));};exports[_0xb04a('0x4c')]=function(_0x2b4489,_0x20f462){return respondWithRpcPromise(_0xb04a('0x4d'),_0x2b4489[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](respondWithResult(_0x20f462,null))['catch'](handleError(_0x20f462,null));};exports[_0xb04a('0x4e')]=function(_0x1c8ff0,_0x163fa8){return respondWithRpcPromise(_0xb04a('0x4d'),_0x1c8ff0['query'],routingClient)[_0xb04a('0xa')](findById(_0x1c8ff0[_0xb04a('0x1d')]['id']))[_0xb04a('0xa')](respondWithResult(_0x163fa8,null))[_0xb04a('0x18')](handleError(_0x163fa8,null));};exports[_0xb04a('0x4f')]=function(_0x473d45,_0x3bff62){return respondWithRpcPromise(_0xb04a('0x50'),_0x473d45['query'],routingClient)[_0xb04a('0xa')](respondWithResult(_0x3bff62,null))[_0xb04a('0x18')](handleError(_0x3bff62,null));};exports[_0xb04a('0x51')]=function(_0xc07fd6,_0x1cc1a2){return respondWithRpcPromise(_0xb04a('0x50'),_0xc07fd6['query'],routingClient)[_0xb04a('0xa')](findById(_0xc07fd6[_0xb04a('0x1d')]['id']))['then'](respondWithResult(_0x1cc1a2,null))[_0xb04a('0x18')](handleError(_0x1cc1a2,null));};exports[_0xb04a('0x52')]=function(_0x128ad6,_0x7fad4a){return respondWithRpcPromise('FaxQueues',_0x128ad6[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](respondWithResult(_0x7fad4a,null))[_0xb04a('0x18')](handleError(_0x7fad4a,null));};exports['showFaxQueues']=function(_0xa5538d,_0x20be32){return respondWithRpcPromise(_0xb04a('0x53'),_0xa5538d[_0xb04a('0x1b')],routingClient)['then'](findById(_0xa5538d[_0xb04a('0x1d')]['id']))['then'](respondWithResult(_0x20be32,null))[_0xb04a('0x18')](handleError(_0x20be32,null));};exports['faxAccounts']=function(_0x596fbf,_0x278395){return respondWithRpcPromise(_0xb04a('0x54'),_0x596fbf['query'])[_0xb04a('0xa')](respondWithResult(_0x278395,null))[_0xb04a('0x18')](handleError(_0x278395,null));};exports[_0xb04a('0x55')]=function(_0x6c27bd,_0x4d8b5e){return respondWithRpcPromise(_0xb04a('0x56'),_0x6c27bd['query'],routingClient)[_0xb04a('0xa')](respondWithResult(_0x4d8b5e,null))[_0xb04a('0x18')](handleError(_0x4d8b5e,null));};exports['mailQueuesWaitingInteractions']=function(_0x197561,_0x82f59d){return respondWithRpcPromise(_0xb04a('0x57'),_0x197561['query'],routingClient)[_0xb04a('0xa')](respondWithResult(_0x82f59d,null))['catch'](handleError(_0x82f59d,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x56ee46,_0xab0d39){return respondWithRpcPromise(_0xb04a('0x58'),_0x56ee46[_0xb04a('0x1b')],routingClient)['then'](respondWithResult(_0xab0d39,null))[_0xb04a('0x18')](handleError(_0xab0d39,null));};exports[_0xb04a('0x59')]=function(_0x22c932,_0x1b1011){return respondWithRpcPromise(_0xb04a('0x5a'),_0x22c932['query'],routingClient)[_0xb04a('0xa')](respondWithResult(_0x1b1011,null))['catch'](handleError(_0x1b1011,null));};exports[_0xb04a('0x5b')]=function(_0x2303d4,_0x29b1b7){return respondWithRpcPromise(_0xb04a('0x5c'),_0x2303d4['query'],routingClient)['then'](respondWithResult(_0x29b1b7,null))['catch'](handleError(_0x29b1b7,null));};exports[_0xb04a('0x5d')]=function(_0x1dc86f,_0x4466bc){return respondWithRpcPromise(_0xb04a('0x5e'),_0x1dc86f[_0xb04a('0x1b')],routingClient)[_0xb04a('0xa')](respondWithResult(_0x4466bc,null))['catch'](handleError(_0x4466bc,null));};exports[_0xb04a('0x5f')]=function(_0x8fedb7){return function(_0x57513b,_0x3571ac){var _0x2903c3,_0x2f15ac;var _0x56d073=_[_0xb04a('0x60')](_0x8fedb7);var _0x4ca5b3=_0x8fedb7===_0xb04a('0x61')?_0xb04a('0x62'):'Account';return db[_0x56d073+_0xb04a('0x63')][_0xb04a('0x64')]({'raw':!![],'where':{'id':_0x57513b[_0xb04a('0x1d')]['id']}})[_0xb04a('0xa')](function(_0x4360c4){if(_[_0xb04a('0x14')](_0x4360c4)){throw new Error(_0x56d073+_0xb04a('0x65'));}_0x2903c3=_0x4360c4;return db[_0x56d073+_0xb04a('0x66')][_0xb04a('0x64')]({'where':{'id':_0x57513b[_0xb04a('0x2c')][_0xb04a('0x67')]},'include':[{'model':db[_0x56d073+'Interaction'],'as':_0xb04a('0x68')},{'model':db[_0x56d073+_0x4ca5b3],'as':'Account'}]});})['then'](function(_0x530cfc){if(_['isNil'](_0x530cfc)){throw new Error(_0x56d073+_0xb04a('0x69'));}_0x2f15ac=_0x530cfc;return _0x530cfc[_0xb04a('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4ae7f7={'uniqueid':_0x8fedb7+'.'+_0x2f15ac['id']+'.'+_0x2f15ac['Interaction']['id'],'FromUserId':_0x57513b[_0xb04a('0x2e')]['id'],'type':_0xb04a('0x6b')};_0x4ae7f7[_0x56d073+_0xb04a('0x6c')]=_0x2f15ac['id'];_0x4ae7f7[_0x56d073+'InteractionId']=_0x2f15ac['Interaction']['id'];_0x4ae7f7[_0xb04a('0x6d')+_0x56d073+_0x4ca5b3+'Id']=_0x2f15ac[_0xb04a('0x6e')]['id'];_0x4ae7f7['To'+_0x56d073+_0xb04a('0x6f')]=_0x2903c3['id'];return db[_0x56d073+'TransferReport'][_0xb04a('0x70')](_0x4ae7f7);})[_0xb04a('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x8fedb7,'interaction':_0x2f15ac[_0xb04a('0x68')],'message':_0x2f15ac,'account':_0x2f15ac[_0xb04a('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb04a('0x6b'),'appdata':_0x2903c3[_0xb04a('0x11')]+','+(_0x2f15ac[_0xb04a('0x6e')][_0xb04a('0x71')]||0x12c),'interval':_0xb04a('0x72')}]},routingClient);})['then'](respondWithResult(_0x3571ac,null))[_0xb04a('0x18')](handleError(_0x3571ac,null));};};exports[_0xb04a('0x73')]=function(_0x57a940,_0xe097ff){var _0x2ad184,_0x204502;if(_['isNil'](_0x57a940[_0xb04a('0x2c')][_0xb04a('0x74')])){throw new Error(_0xb04a('0x75'));}var _0xa2707b=_0x57a940['body'][_0xb04a('0x74')];var _0x4fbc98=_[_0xb04a('0x60')](_0xa2707b);var _0x3bb28c=_0xa2707b===_0xb04a('0x61')?_0xb04a('0x62'):_0xb04a('0x6e');return db['User'][_0xb04a('0x64')]({'raw':!![],'where':{'id':_0x57a940[_0xb04a('0x1d')]['id'],'role':_0xb04a('0x39')}})[_0xb04a('0xa')](function(_0x32e283){if(_[_0xb04a('0x14')](_0x32e283)){throw new Error(_0xb04a('0x76'));}_0x2ad184=_0x32e283;return db[_0x4fbc98+'Message'][_0xb04a('0x64')]({'where':{'id':_0x57a940['body'][_0xb04a('0x67')]},'include':[{'model':db[_0x4fbc98+'Interaction'],'as':_0xb04a('0x68')},{'model':db[_0x4fbc98+_0x3bb28c],'as':_0xb04a('0x6e')}]});})[_0xb04a('0xa')](function(_0x131d93){if(_[_0xb04a('0x14')](_0x131d93)){throw new Error(_0x4fbc98+_0xb04a('0x69'));}_0x204502=_0x131d93;return _0x131d93[_0xb04a('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2bd72a={'uniqueid':_0xa2707b+'.'+_0x204502['id']+'.'+_0x204502[_0xb04a('0x68')]['id'],'FromUserId':_0x57a940[_0xb04a('0x2e')]['id'],'type':_0xb04a('0x6b'),'ToUserId':_0x2ad184['id']};_0x2bd72a[_0x4fbc98+'MessageId']=_0x204502['id'];_0x2bd72a[_0x4fbc98+_0xb04a('0x77')]=_0x204502[_0xb04a('0x68')]['id'];_0x2bd72a['From'+_0x4fbc98+_0x3bb28c+'Id']=_0x204502['Account']['id'];return db[_0x4fbc98+_0xb04a('0x78')][_0xb04a('0x70')](_0x2bd72a);})[_0xb04a('0xa')](function(){return respondWithRpcPromise(_0xb04a('0x79'),{'channel':_0xa2707b,'interaction':_0x204502[_0xb04a('0x68')],'message':_0x204502,'account':_0x204502[_0xb04a('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2ad184[_0xb04a('0x11')]+','+(_0x204502['Account'][_0xb04a('0x7a')]||0x12c),'interval':_0xb04a('0x72')}]},routingClient);})[_0xb04a('0xa')](respondWithResult(_0xe097ff,null))[_0xb04a('0x18')](handleError(_0xe097ff,null));}; \ No newline at end of file +var _0x2fbf=['user','name','hasOwnProperty','MemberReport','INTERACTION','length','format','updateAttributes','findOrCreate','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','messageId','InteractionId','create','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','error','code','message','result','stack','status','send','isNil','rows','find','voiceChannels','query','then','catch','VoiceChannelMixMonitor','merge','params','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction'];(function(_0x5e3a6c,_0x1423e0){var _0x346701=function(_0xc2343f){while(--_0xc2343f){_0x5e3a6c['push'](_0x5e3a6c['shift']());}};_0x346701(++_0x1423e0);}(_0x2fbf,0xbc));var _0xf2fb=function(_0x8a705b,_0x5b1263){_0x8a705b=_0x8a705b-0x0;var _0x4b9b20=_0x2fbf[_0x8a705b];return _0x4b9b20;};'use strict';var BPromise=require(_0xf2fb('0x0'));var moment=require(_0xf2fb('0x1'));var _=require(_0xf2fb('0x2'));var util=require('util');var db=require(_0xf2fb('0x3'))['db'];var logger=require(_0xf2fb('0x4'))(_0xf2fb('0x5'));var jayson=require(_0xf2fb('0x6'));var amiClient=jayson['client'][_0xf2fb('0x7')]({'port':0x232a});var mailClient=jayson[_0xf2fb('0x8')]['http']({'port':0x232b});var routingClient=jayson[_0xf2fb('0x8')][_0xf2fb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x403630,_0x5af2ad,_0x373256){return new BPromise(function(_0x42cf96,_0x191784){var _0x25461a=_0x373256?_0x373256:amiClient;return _0x25461a[_0xf2fb('0x9')](_0x403630,_0x5af2ad)['then'](function(_0x2ee0a1){if(_0x2ee0a1[_0xf2fb('0xa')]){if(_0x2ee0a1['error'][_0xf2fb('0xb')]===0x1f4){return _0x191784(_0x2ee0a1[_0xf2fb('0xa')]['message']);}return _0x42cf96(_0x2ee0a1['error'][_0xf2fb('0xc')]);}else{_0x42cf96(_0x2ee0a1[_0xf2fb('0xd')]);}})['catch'](function(_0x2a622d){_0x191784(_0x2a622d);});});}function respondWithResult(_0x96664b,_0x1059fb){_0x1059fb=_0x1059fb||0xc8;return function(_0x492a68){if(_0x492a68){return _0x96664b['status'](_0x1059fb)['json'](_0x492a68);}return _0x96664b['sendStatus'](0x194);};}function handleError(_0x19719c,_0x58a5d3){_0x58a5d3=_0x58a5d3||0x1f4;return function(_0x48e7f7){logger[_0xf2fb('0xa')](_0x48e7f7[_0xf2fb('0xe')]);if(_0x48e7f7['name']){delete _0x48e7f7['name'];}_0x19719c[_0xf2fb('0xf')](_0x58a5d3)[_0xf2fb('0x10')](_0x48e7f7);};}function findById(_0x1d805e){return function(_0xe66ee6){if(!_[_0xf2fb('0x11')](_0x1d805e)&&!_[_0xf2fb('0x11')](_0xe66ee6)&&!_[_0xf2fb('0x11')](_0xe66ee6[_0xf2fb('0x12')])){return _[_0xf2fb('0x13')](_0xe66ee6['rows'],function(_0xd61a06){return _0xd61a06['id']==_0x1d805e;});}return null;};}exports[_0xf2fb('0x14')]=function(_0x4e6eb4,_0x57970d){return respondWithRpcPromise('VoiceChannels',_0x4e6eb4[_0xf2fb('0x15')])[_0xf2fb('0x16')](respondWithResult(_0x57970d,null))[_0xf2fb('0x17')](handleError(_0x57970d,null));};exports['voiceChannelMixMonitor']=function(_0x444beb,_0x57fcf7){return respondWithRpcPromise(_0xf2fb('0x18'),_[_0xf2fb('0x19')](_0x444beb['query'],_0x444beb[_0xf2fb('0x1a')]))['then'](respondWithResult(_0x57fcf7,null))['catch'](handleError(_0x57fcf7,null));};exports['voiceChannelStopMixMonitor']=function(_0x108228,_0x4d4999){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xf2fb('0x19')](_0x108228[_0xf2fb('0x15')],_0x108228[_0xf2fb('0x1a')]))['then'](respondWithResult(_0x4d4999,null))['catch'](handleError(_0x4d4999,null));};exports[_0xf2fb('0x1b')]=function(_0x42e480,_0x5b22d1){return respondWithRpcPromise(_0xf2fb('0x1c'),_0x42e480[_0xf2fb('0x15')])[_0xf2fb('0x16')](respondWithResult(_0x5b22d1,null))['catch'](handleError(_0x5b22d1,null));};exports['showVoiceQueues']=function(_0x308c65,_0xeb1c75){return respondWithRpcPromise(_0xf2fb('0x1c'),_0x308c65[_0xf2fb('0x15')])[_0xf2fb('0x16')](findById(_0x308c65[_0xf2fb('0x1a')]['id']))['then'](respondWithResult(_0xeb1c75,null))[_0xf2fb('0x17')](handleError(_0xeb1c75,null));};exports[_0xf2fb('0x1d')]=function(_0x29996e,_0x1a331b){return respondWithRpcPromise(_0xf2fb('0x1e'),_[_0xf2fb('0x19')](_0x29996e[_0xf2fb('0x15')],_0x29996e[_0xf2fb('0x1a')]))[_0xf2fb('0x16')](respondWithResult(_0x1a331b,null))['catch'](handleError(_0x1a331b,null));};exports[_0xf2fb('0x1f')]=function(_0x546971,_0x39c4ee){return respondWithRpcPromise('VoiceQueuesChannels',_0x546971['query'])[_0xf2fb('0x16')](respondWithResult(_0x39c4ee,null))['catch'](handleError(_0x39c4ee,null));};exports[_0xf2fb('0x20')]=function(_0x5dff93,_0x53941d){return respondWithRpcPromise(_0xf2fb('0x21'),_[_0xf2fb('0x19')](_0x5dff93['query'],_0x5dff93[_0xf2fb('0x1a')]))[_0xf2fb('0x16')](respondWithResult(_0x53941d,null))['catch'](handleError(_0x53941d,null));};exports['voiceQueuesChannelHangup']=function(_0xc199aa,_0x483b5a){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0xc199aa[_0xf2fb('0x15')],_0xc199aa['params']))[_0xf2fb('0x16')](respondWithResult(_0x483b5a,null))[_0xf2fb('0x17')](handleError(_0x483b5a,null));};exports[_0xf2fb('0x22')]=function(_0x13312e,_0xd40a6a){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xf2fb('0x19')](_0x13312e[_0xf2fb('0x15')],_0x13312e[_0xf2fb('0x1a')]))[_0xf2fb('0x16')](respondWithResult(_0xd40a6a,null))[_0xf2fb('0x17')](handleError(_0xd40a6a,null));};exports[_0xf2fb('0x23')]=function(_0x3e7f7d,_0x499740){return respondWithRpcPromise('Outbound',_0x3e7f7d[_0xf2fb('0x15')])[_0xf2fb('0x16')](respondWithResult(_0x499740,null))['catch'](handleError(_0x499740,null));};exports[_0xf2fb('0x24')]=function(_0x4ef693,_0x1f79ed){return respondWithRpcPromise(_0xf2fb('0x25'),_0x4ef693[_0xf2fb('0x15')])[_0xf2fb('0x16')](respondWithResult(_0x1f79ed,null))[_0xf2fb('0x17')](handleError(_0x1f79ed,null));};exports[_0xf2fb('0x26')]=function(_0x2be05d,_0x3ef450){var _0x3910d6;return respondWithRpcPromise(_0xf2fb('0x27'),_0x2be05d[_0xf2fb('0x15')])[_0xf2fb('0x16')](function(_0x3328a2){_0x3910d6=_0x3328a2;return respondWithRpcPromise(_0xf2fb('0x27'),_0x2be05d[_0xf2fb('0x15')],routingClient);})[_0xf2fb('0x16')](function(_0x1ce6d6){return _['merge']({},_0x1ce6d6,_0x3910d6);})[_0xf2fb('0x16')](respondWithResult(_0x3ef450,null))[_0xf2fb('0x17')](handleError(_0x3ef450,null));};exports['agentCapacity']=function(_0x44d85e,_0x3f0f6b){if(_0x44d85e['body']&&_0x44d85e[_0xf2fb('0x28')][_0xf2fb('0x29')]&&_0x44d85e[_0xf2fb('0x2a')]&&_0x44d85e[_0xf2fb('0x2a')][_0xf2fb('0x2b')]){for(var _0x3fa71f in _0x44d85e[_0xf2fb('0x28')][_0xf2fb('0x29')]){if(_0x44d85e['body'][_0xf2fb('0x29')][_0xf2fb('0x2c')](_0x3fa71f)){db[_0xf2fb('0x2d')]['findAll']({'where':{'channel':_0x3fa71f,'membername':_0x44d85e['user'][_0xf2fb('0x2b')],'type':_0xf2fb('0x2e'),'exitAt':null,'uniqueid':_0x44d85e[_0xf2fb('0x28')]['interaction'][_0x3fa71f]&&_0x44d85e[_0xf2fb('0x28')][_0xf2fb('0x29')][_0x3fa71f][_0xf2fb('0x2f')]?{'$notIn':_0x44d85e[_0xf2fb('0x28')][_0xf2fb('0x29')][_0x3fa71f]}:{'$ne':null}}})[_0xf2fb('0x16')](function(_0x160791){var _0x4381f8=moment()[_0xf2fb('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4da7d1=0x0,_0x3a5b55=_0x160791[_0xf2fb('0x2f')];_0x4da7d1<_0x3a5b55;_0x4da7d1+=0x1){_0x160791[_0x4da7d1][_0xf2fb('0x31')]({'exitAt':_0x4381f8});}});for(var _0x2a155d=0x0;_0x2a155d<_0x44d85e[_0xf2fb('0x28')]['interaction'][_0x3fa71f][_0xf2fb('0x2f')];_0x2a155d+=0x1){db[_0xf2fb('0x2d')][_0xf2fb('0x32')]({'where':{'channel':_0x3fa71f,'membername':_0x44d85e[_0xf2fb('0x2a')][_0xf2fb('0x2b')],'type':_0xf2fb('0x2e'),'uniqueid':_0x44d85e['body']['interaction'][_0x3fa71f][_0x2a155d],'exitAt':null},'defaults':{'channel':_0x3fa71f,'membername':_0x44d85e[_0xf2fb('0x2a')]['name'],'interface':_[_0xf2fb('0x11')](_0x44d85e[_0xf2fb('0x2a')][_0xf2fb('0x33')])?util['format']('SIP/%s',_0x44d85e[_0xf2fb('0x2a')][_0xf2fb('0x2b')]):_0x44d85e[_0xf2fb('0x2a')][_0xf2fb('0x33')],'type':_0xf2fb('0x2e'),'enterAt':moment()[_0xf2fb('0x30')](_0xf2fb('0x34')),'role':_0xf2fb('0x35'),'internal':_0x44d85e['user'][_0xf2fb('0x36')],'uniqueid':_0x44d85e[_0xf2fb('0x28')]['interaction'][_0x3fa71f][_0x2a155d]}});}}}}return respondWithRpcPromise(_0xf2fb('0x37'),{'id':_0x44d85e[_0xf2fb('0x1a')]['id'],'capacity':_0x44d85e['body']['capacity']},routingClient)[_0xf2fb('0x16')](respondWithResult(_0x3f0f6b,null))['catch'](handleError(_0x3f0f6b,null));};exports[_0xf2fb('0x38')]=function(_0x5895d4,_0x42cf84){return respondWithRpcPromise('Telephones',_0x5895d4[_0xf2fb('0x15')])[_0xf2fb('0x16')](respondWithResult(_0x42cf84,null))['catch'](handleError(_0x42cf84,null));};exports[_0xf2fb('0x39')]=function(_0x32cf92,_0x175901){return respondWithRpcPromise(_0xf2fb('0x3a'),_0x32cf92['query'])[_0xf2fb('0x16')](respondWithResult(_0x175901,null))['catch'](handleError(_0x175901,null));};exports[_0xf2fb('0x3b')]=function(_0x41db6e,_0x244c00){return respondWithRpcPromise(_0xf2fb('0x3c'),_0x41db6e[_0xf2fb('0x15')])['then'](respondWithResult(_0x244c00,null))[_0xf2fb('0x17')](handleError(_0x244c00,null));};exports[_0xf2fb('0x3d')]=function(_0x5686c7,_0x4bb41c){return respondWithRpcPromise('ChatQueues',_0x5686c7['query'],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x4bb41c,null))[_0xf2fb('0x17')](handleError(_0x4bb41c,null));};exports[_0xf2fb('0x3e')]=function(_0x5cc0f3,_0x13bd1a){return respondWithRpcPromise('ChatQueues',_0x5cc0f3['query'],routingClient)['then'](findById(_0x5cc0f3['params']['id']))['then'](respondWithResult(_0x13bd1a,null))[_0xf2fb('0x17')](handleError(_0x13bd1a,null));};exports[_0xf2fb('0x3f')]=function(_0x3281c,_0x14fb62){return respondWithRpcPromise('MailQueues',_0x3281c[_0xf2fb('0x15')],routingClient)['then'](respondWithResult(_0x14fb62,null))[_0xf2fb('0x17')](handleError(_0x14fb62,null));};exports[_0xf2fb('0x40')]=function(_0x19f108,_0x3bfc8d){return respondWithRpcPromise(_0xf2fb('0x41'),_0x19f108[_0xf2fb('0x15')],routingClient)['then'](findById(_0x19f108[_0xf2fb('0x1a')]['id']))[_0xf2fb('0x16')](respondWithResult(_0x3bfc8d,null))[_0xf2fb('0x17')](handleError(_0x3bfc8d,null));};exports['mailAccounts']=function(_0x342c2f,_0x52b738){return respondWithRpcPromise(_0xf2fb('0x42'),_0x342c2f[_0xf2fb('0x15')],mailClient)[_0xf2fb('0x16')](respondWithResult(_0x52b738,null))[_0xf2fb('0x17')](handleError(_0x52b738,null));};exports[_0xf2fb('0x43')]=function(_0x29f142,_0xfbe0c3){return respondWithRpcPromise(_0xf2fb('0x44'),_0x29f142[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](respondWithResult(_0xfbe0c3,null))[_0xf2fb('0x17')](handleError(_0xfbe0c3,null));};exports[_0xf2fb('0x45')]=function(_0x25ecb0,_0x536b80){return respondWithRpcPromise(_0xf2fb('0x44'),_0x25ecb0[_0xf2fb('0x15')],routingClient)['then'](findById(_0x25ecb0['params']['id']))['then'](respondWithResult(_0x536b80,null))[_0xf2fb('0x17')](handleError(_0x536b80,null));};exports[_0xf2fb('0x46')]=function(_0x546d03,_0x4a1375){return respondWithRpcPromise(_0xf2fb('0x47'),_0x546d03['query'],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x4a1375,null))[_0xf2fb('0x17')](handleError(_0x4a1375,null));};exports[_0xf2fb('0x48')]=function(_0x4dbf21,_0x1aabd3){return respondWithRpcPromise('SmsQueues',_0x4dbf21[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](findById(_0x4dbf21[_0xf2fb('0x1a')]['id']))['then'](respondWithResult(_0x1aabd3,null))[_0xf2fb('0x17')](handleError(_0x1aabd3,null));};exports[_0xf2fb('0x49')]=function(_0x576a55,_0x4ca085){return respondWithRpcPromise('WhatsappQueues',_0x576a55[_0xf2fb('0x15')],routingClient)['then'](respondWithResult(_0x4ca085,null))[_0xf2fb('0x17')](handleError(_0x4ca085,null));};exports[_0xf2fb('0x4a')]=function(_0x28d3be,_0x2d5137){return respondWithRpcPromise(_0xf2fb('0x4b'),_0x28d3be['query'],routingClient)[_0xf2fb('0x16')](findById(_0x28d3be[_0xf2fb('0x1a')]['id']))['then'](respondWithResult(_0x2d5137,null))['catch'](handleError(_0x2d5137,null));};exports[_0xf2fb('0x4c')]=function(_0x267cac,_0x1a634b){return respondWithRpcPromise(_0xf2fb('0x4d'),_0x267cac[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x1a634b,null))[_0xf2fb('0x17')](handleError(_0x1a634b,null));};exports[_0xf2fb('0x4e')]=function(_0x120c0b,_0x186f3c){return respondWithRpcPromise(_0xf2fb('0x4d'),_0x120c0b[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](findById(_0x120c0b[_0xf2fb('0x1a')]['id']))[_0xf2fb('0x16')](respondWithResult(_0x186f3c,null))['catch'](handleError(_0x186f3c,null));};exports['faxAccounts']=function(_0x35e616,_0x396868){return respondWithRpcPromise(_0xf2fb('0x4f'),_0x35e616[_0xf2fb('0x15')])[_0xf2fb('0x16')](respondWithResult(_0x396868,null))[_0xf2fb('0x17')](handleError(_0x396868,null));};exports['chatQueuesWaitingInteractions']=function(_0x18db36,_0x388975){return respondWithRpcPromise(_0xf2fb('0x50'),_0x18db36[_0xf2fb('0x15')],routingClient)['then'](respondWithResult(_0x388975,null))['catch'](handleError(_0x388975,null));};exports['mailQueuesWaitingInteractions']=function(_0xf54721,_0x40286a){return respondWithRpcPromise(_0xf2fb('0x51'),_0xf54721[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x40286a,null))[_0xf2fb('0x17')](handleError(_0x40286a,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x57d3f0,_0x2daa3f){return respondWithRpcPromise(_0xf2fb('0x52'),_0x57d3f0[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x2daa3f,null))['catch'](handleError(_0x2daa3f,null));};exports[_0xf2fb('0x53')]=function(_0x42e93a,_0x2283d6){return respondWithRpcPromise(_0xf2fb('0x54'),_0x42e93a[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x2283d6,null))['catch'](handleError(_0x2283d6,null));};exports[_0xf2fb('0x55')]=function(_0x19bb5e,_0x5ee4c5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x19bb5e[_0xf2fb('0x15')],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x5ee4c5,null))['catch'](handleError(_0x5ee4c5,null));};exports[_0xf2fb('0x56')]=function(_0x1fada2,_0x3f2fbe){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x1fada2['query'],routingClient)[_0xf2fb('0x16')](respondWithResult(_0x3f2fbe,null))[_0xf2fb('0x17')](handleError(_0x3f2fbe,null));};exports[_0xf2fb('0x57')]=function(_0x3da05d){return function(_0x1fdca6,_0x3d9d05){var _0x277868,_0x46509c;var _0x422926=_[_0xf2fb('0x58')](_0x3da05d);var _0x5e56ac=_0x3da05d===_0xf2fb('0x59')?'Website':_0xf2fb('0x5a');return db[_0x422926+_0xf2fb('0x5b')][_0xf2fb('0x5c')]({'raw':!![],'where':{'id':_0x1fdca6[_0xf2fb('0x1a')]['id']}})[_0xf2fb('0x16')](function(_0x1ddab9){if(_['isNil'](_0x1ddab9)){throw new Error(_0x422926+_0xf2fb('0x5d'));}_0x277868=_0x1ddab9;return db[_0x422926+_0xf2fb('0x5e')][_0xf2fb('0x5c')]({'where':{'id':_0x1fdca6['body']['messageId']},'include':[{'model':db[_0x422926+'Interaction'],'as':_0xf2fb('0x5f')},{'model':db[_0x422926+_0x5e56ac],'as':'Account'}]});})['then'](function(_0x2f56ea){if(_[_0xf2fb('0x11')](_0x2f56ea)){throw new Error(_0x422926+_0xf2fb('0x60'));}_0x46509c=_0x2f56ea;return _0x2f56ea[_0xf2fb('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf2fb('0x16')](function(){var _0x16f99a={'uniqueid':_0x3da05d+'.'+_0x46509c['id']+'.'+_0x46509c[_0xf2fb('0x5f')]['id'],'FromUserId':_0x1fdca6[_0xf2fb('0x2a')]['id'],'type':'queue'};_0x16f99a[_0x422926+_0xf2fb('0x62')]=_0x46509c['id'];_0x16f99a[_0x422926+'InteractionId']=_0x46509c['Interaction']['id'];_0x16f99a[_0xf2fb('0x63')+_0x422926+_0x5e56ac+'Id']=_0x46509c[_0xf2fb('0x5a')]['id'];_0x16f99a['To'+_0x422926+_0xf2fb('0x64')]=_0x277868['id'];return db[_0x422926+_0xf2fb('0x65')]['create'](_0x16f99a);})['then'](function(){return respondWithRpcPromise(_0xf2fb('0x66'),{'channel':_0x3da05d,'interaction':_0x46509c[_0xf2fb('0x5f')],'message':_0x46509c,'account':_0x46509c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xf2fb('0x67'),'appdata':_0x277868[_0xf2fb('0x2b')]+','+(_0x46509c[_0xf2fb('0x5a')][_0xf2fb('0x68')]||0x12c),'interval':_0xf2fb('0x69')}]},routingClient);})['then'](respondWithResult(_0x3d9d05,null))[_0xf2fb('0x17')](handleError(_0x3d9d05,null));};};exports[_0xf2fb('0x6a')]=function(_0x939d7f,_0x42b594){var _0x338ba9,_0x4cb3b9;if(_[_0xf2fb('0x11')](_0x939d7f[_0xf2fb('0x28')][_0xf2fb('0x6b')])){throw new Error(_0xf2fb('0x6c'));}var _0x4d602c=_0x939d7f[_0xf2fb('0x28')][_0xf2fb('0x6b')];var _0x4af831=_[_0xf2fb('0x58')](_0x4d602c);var _0x20c479=_0x4d602c===_0xf2fb('0x59')?_0xf2fb('0x6d'):_0xf2fb('0x5a');return db[_0xf2fb('0x6e')][_0xf2fb('0x5c')]({'raw':!![],'where':{'id':_0x939d7f['params']['id'],'role':_0xf2fb('0x35')}})[_0xf2fb('0x16')](function(_0x31369a){if(_[_0xf2fb('0x11')](_0x31369a)){throw new Error('Agent\x20not\x20found');}_0x338ba9=_0x31369a;return db[_0x4af831+_0xf2fb('0x5e')][_0xf2fb('0x5c')]({'where':{'id':_0x939d7f[_0xf2fb('0x28')][_0xf2fb('0x6f')]},'include':[{'model':db[_0x4af831+_0xf2fb('0x5f')],'as':_0xf2fb('0x5f')},{'model':db[_0x4af831+_0x20c479],'as':_0xf2fb('0x5a')}]});})['then'](function(_0x7bfec7){if(_[_0xf2fb('0x11')](_0x7bfec7)){throw new Error(_0x4af831+_0xf2fb('0x60'));}_0x4cb3b9=_0x7bfec7;return _0x7bfec7[_0xf2fb('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf2fb('0x16')](function(){var _0x504b70={'uniqueid':_0x4d602c+'.'+_0x4cb3b9['id']+'.'+_0x4cb3b9[_0xf2fb('0x5f')]['id'],'FromUserId':_0x939d7f[_0xf2fb('0x2a')]['id'],'type':_0xf2fb('0x67'),'ToUserId':_0x338ba9['id']};_0x504b70[_0x4af831+_0xf2fb('0x62')]=_0x4cb3b9['id'];_0x504b70[_0x4af831+_0xf2fb('0x70')]=_0x4cb3b9[_0xf2fb('0x5f')]['id'];_0x504b70[_0xf2fb('0x63')+_0x4af831+_0x20c479+'Id']=_0x4cb3b9[_0xf2fb('0x5a')]['id'];return db[_0x4af831+_0xf2fb('0x65')][_0xf2fb('0x71')](_0x504b70);})[_0xf2fb('0x16')](function(){return respondWithRpcPromise(_0xf2fb('0x66'),{'channel':_0x4d602c,'interaction':_0x4cb3b9[_0xf2fb('0x5f')],'message':_0x4cb3b9,'account':_0x4cb3b9['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xf2fb('0x35'),'appdata':_0x338ba9[_0xf2fb('0x2b')]+','+(_0x4cb3b9['Account'][_0xf2fb('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xf2fb('0x16')](respondWithResult(_0x42b594,null))[_0xf2fb('0x17')](handleError(_0x42b594,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 877e899..650fcd1 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 _0x38f5=['destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','show','run','post','create','put'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x38f5,0x1b2));var _0x538f=function(_0x4261a4,_0x2c851b){_0x4261a4=_0x4261a4-0x0;var _0x5ddf4b=_0x38f5[_0x4261a4];return _0x5ddf4b;};'use strict';var multer=require(_0x538f('0x0'));var util=require(_0x538f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x538f('0x2'));var router=express[_0x538f('0x3')]();var auth=require(_0x538f('0x4'));var interaction=require(_0x538f('0x5'));var config=require(_0x538f('0x6'));var controller=require(_0x538f('0x7'));router['get']('/',auth[_0x538f('0x8')](),controller[_0x538f('0x9')]);router[_0x538f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x538f('0xb')]);router[_0x538f('0xa')]('/:id/run',auth[_0x538f('0x8')](),controller[_0x538f('0xc')]);router[_0x538f('0xd')]('/',auth[_0x538f('0x8')](),controller[_0x538f('0xe')]);router[_0x538f('0xf')]('/:id',auth[_0x538f('0x8')](),controller['update']);router['delete']('/:id',auth[_0x538f('0x8')](),controller[_0x538f('0x10')]);module[_0x538f('0x11')]=router; \ No newline at end of file +var _0xe418=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create'];(function(_0x3e51e9,_0x2d103e){var _0xaa2470=function(_0x17e24c){while(--_0x17e24c){_0x3e51e9['push'](_0x3e51e9['shift']());}};_0xaa2470(++_0x2d103e);}(_0xe418,0x107));var _0x8e41=function(_0x5e668f,_0x4a2f8d){_0x5e668f=_0x5e668f-0x0;var _0x23444c=_0xe418[_0x5e668f];return _0x23444c;};'use strict';var multer=require(_0x8e41('0x0'));var util=require(_0x8e41('0x1'));var path=require(_0x8e41('0x2'));var timeout=require(_0x8e41('0x3'));var express=require(_0x8e41('0x4'));var router=express['Router']();var auth=require(_0x8e41('0x5'));var interaction=require(_0x8e41('0x6'));var config=require(_0x8e41('0x7'));var controller=require(_0x8e41('0x8'));router[_0x8e41('0x9')]('/',auth[_0x8e41('0xa')](),controller[_0x8e41('0xb')]);router['get'](_0x8e41('0xc'),auth[_0x8e41('0xa')](),controller['show']);router['get'](_0x8e41('0xd'),auth[_0x8e41('0xa')](),controller[_0x8e41('0xe')]);router[_0x8e41('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e41('0x10')]);router['put'](_0x8e41('0xc'),auth[_0x8e41('0xa')](),controller[_0x8e41('0x11')]);router[_0x8e41('0x12')]('/:id',auth[_0x8e41('0xa')](),controller[_0x8e41('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 319269e..b2574fc 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 _0xafdd=['months','weeks','days','minutes','pdf','xlsx','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x5eb612,_0x5ac705){var _0x49c484=function(_0x2cac04){while(--_0x2cac04){_0x5eb612['push'](_0x5eb612['shift']());}};_0x49c484(++_0x5ac705);}(_0xafdd,0x19a));var _0xdafd=function(_0xa6b30e,_0x44d675){_0xa6b30e=_0xa6b30e-0x0;var _0x27a3c6=_0xafdd[_0xa6b30e];return _0x27a3c6;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'name':{'type':Sequelize[_0xdafd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdafd('0x2')]},'active':{'type':Sequelize[_0xdafd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdafd('0x2')],'allowNull':![],'defaultValue':_0xdafd('0x4')},'startAt':{'type':Sequelize[_0xdafd('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdafd('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdafd('0x7')](_0xdafd('0x8'),_0xdafd('0x9'),_0xdafd('0xa'),_0xdafd('0xb'),_0xdafd('0xc'),'hours',_0xdafd('0xd')),'allowNull':![],'defaultValue':_0xdafd('0xc')},'output':{'type':Sequelize[_0xdafd('0x7')]('csv',_0xdafd('0xe'),_0xdafd('0xf')),'allowNull':![],'defaultValue':_0xdafd('0x10')},'type':{'type':Sequelize[_0xdafd('0x7')]('custom',_0xdafd('0x11')),'allowNull':![],'defaultValue':_0xdafd('0x12')},'sendMail':{'type':Sequelize[_0xdafd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdafd('0x2')]},'cc':{'type':Sequelize[_0xdafd('0x13')]},'bcc':{'type':Sequelize[_0xdafd('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xed1c=['sequelize','exports','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','xlsx','default','custom','BOOLEAN','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1c,0xe4));var _0xced1=function(_0xb0dd48,_0x5159e0){_0xb0dd48=_0xb0dd48-0x0;var _0x46f703=_0xed1c[_0xb0dd48];return _0x46f703;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xced1('0x2')},'startAt':{'type':Sequelize[_0xced1('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xced1('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xced1('0x4')](_0xced1('0x5'),_0xced1('0x6'),_0xced1('0x7'),'weeks',_0xced1('0x8'),_0xced1('0x9'),_0xced1('0xa')),'allowNull':![],'defaultValue':_0xced1('0x8')},'output':{'type':Sequelize[_0xced1('0x4')](_0xced1('0xb'),_0xced1('0xc'),_0xced1('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xced1('0x4')]('custom',_0xced1('0xe')),'allowNull':![],'defaultValue':_0xced1('0xf')},'sendMail':{'type':Sequelize[_0xced1('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xced1('0x11')]},'cc':{'type':Sequelize[_0xced1('0x12')]},'bcc':{'type':Sequelize[_0xced1('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xced1('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f7f6c4f..34b669c 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 _0x9e2d=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','../../config/schedule','run','eml-format','zip-dir'];(function(_0x5148c8,_0x95b369){var _0xb2bafe=function(_0x187cb4){while(--_0x187cb4){_0x5148c8['push'](_0x5148c8['shift']());}};_0xb2bafe(++_0x95b369);}(_0x9e2d,0xfa));var _0xd9e2=function(_0x34cfdf,_0x26e72b){_0x34cfdf=_0x34cfdf-0x0;var _0x375364=_0x9e2d[_0x34cfdf];return _0x375364;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd9e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9e2('0x1'));var jsonpatch=require(_0xd9e2('0x2'));var rp=require(_0xd9e2('0x3'));var moment=require(_0xd9e2('0x4'));var BPromise=require(_0xd9e2('0x5'));var Mustache=require(_0xd9e2('0x6'));var util=require('util');var path=require(_0xd9e2('0x7'));var sox=require('sox');var csv=require(_0xd9e2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9e2('0x9'));var squel=require(_0xd9e2('0xa'));var crypto=require(_0xd9e2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd9e2('0xc'));var toCsv=require(_0xd9e2('0x8'));var querystring=require(_0xd9e2('0xd'));var Papa=require(_0xd9e2('0xe'));var Redis=require(_0xd9e2('0xf'));var authService=require(_0xd9e2('0x10'));var qs=require(_0xd9e2('0x11'));var as=require(_0xd9e2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd9e2('0x13'));var utils=require('../../config/utils');var config=require(_0xd9e2('0x14'));var db=require(_0xd9e2('0x15'))['db'];function respondWithStatusCode(_0x590381,_0x3872ff){_0x3872ff=_0x3872ff||0xcc;return function(_0x3ce037){if(_0x3ce037){return _0x590381['sendStatus'](_0x3872ff);}return _0x590381[_0xd9e2('0x16')](_0x3872ff)['end']();};}function respondWithResult(_0x1236fa,_0x2d57a2){_0x2d57a2=_0x2d57a2||0xc8;return function(_0x4e41c9){if(_0x4e41c9){return _0x1236fa['status'](_0x2d57a2)[_0xd9e2('0x17')](_0x4e41c9);}};}function respondWithFilteredResult(_0x3a6629,_0x3e893d){return function(_0x3444fa){if(_0x3444fa){var _0x55b09b=_0x3444fa[_0xd9e2('0x18')],_0x38a86a=_0x3e893d[_0xd9e2('0x19')],_0x24deff=_0x3e893d[_0xd9e2('0x19')]+_0x3e893d[_0xd9e2('0x1a')],_0x54b26d;if(_0x24deff>=_0x55b09b){_0x24deff=_0x55b09b;_0x54b26d=0xc8;}else{_0x54b26d=0xce;}_0x3a6629[_0xd9e2('0x16')](_0x54b26d);return _0x3a6629['set'](_0xd9e2('0x1b'),_0x38a86a+'-'+_0x24deff+'/'+_0x55b09b)[_0xd9e2('0x17')](_0x3444fa);}return null;};}function patchUpdates(_0x4343af){return function(_0x5c1289){try{jsonpatch[_0xd9e2('0x1c')](_0x5c1289,_0x4343af,!![]);}catch(_0x3576c5){return BPromise[_0xd9e2('0x1d')](_0x3576c5);}return _0x5c1289[_0xd9e2('0x1e')]();};}function saveUpdates(_0x156b29,_0x19c02d){return function(_0x20d79d){if(_0x20d79d){return _0x20d79d['update'](_0x156b29)[_0xd9e2('0x1f')](function(_0x32d339){return _0x32d339;});}return null;};}function removeEntity(_0x25f0fd,_0x57e379){return function(_0x48d4a6){if(_0x48d4a6){return _0x48d4a6[_0xd9e2('0x20')]()[_0xd9e2('0x1f')](function(){var _0x192164=_0x48d4a6[_0xd9e2('0x21')]({'plain':!![]});var _0x3e252e='Scheduler';return db[_0xd9e2('0x22')][_0xd9e2('0x20')]({'where':{'type':_0x3e252e,'resourceId':_0x192164['id']}})[_0xd9e2('0x1f')](function(){return _0x48d4a6;});})['then'](function(){_0x25f0fd[_0xd9e2('0x16')](0xcc)[_0xd9e2('0x23')]();});}};}function handleEntityNotFound(_0x1fbc96,_0x5bd10a){return function(_0xe88da4){if(!_0xe88da4){_0x1fbc96[_0xd9e2('0x24')](0x194);}return _0xe88da4;};}function handleError(_0x10029b,_0x1aa70f){_0x1aa70f=_0x1aa70f||0x1f4;return function(_0x18c8ea){logger[_0xd9e2('0x25')](_0x18c8ea[_0xd9e2('0x26')]);if(_0x18c8ea[_0xd9e2('0x27')]){delete _0x18c8ea['name'];}_0x10029b['status'](_0x1aa70f)[_0xd9e2('0x28')](_0x18c8ea);};}exports[_0xd9e2('0x29')]=function(_0x2cb3,_0x29e393){var _0x3ab4ad={},_0x1d3c61={},_0x37804f={'count':0x0,'rows':[]};var _0x22a3f2=_['map'](db[_0xd9e2('0x2a')][_0xd9e2('0x2b')],function(_0xf627ab){return{'name':_0xf627ab[_0xd9e2('0x2c')],'type':_0xf627ab[_0xd9e2('0x2d')][_0xd9e2('0x2e')]};});_0x1d3c61[_0xd9e2('0x2f')]=_['map'](_0x22a3f2,'name');_0x1d3c61['query']=_[_0xd9e2('0x30')](_0x2cb3[_0xd9e2('0x31')]);_0x1d3c61['filters']=_[_0xd9e2('0x32')](_0x1d3c61[_0xd9e2('0x2f')],_0x1d3c61[_0xd9e2('0x31')]);_0x3ab4ad[_0xd9e2('0x33')]=_[_0xd9e2('0x32')](_0x1d3c61[_0xd9e2('0x2f')],qs['fields'](_0x2cb3[_0xd9e2('0x31')][_0xd9e2('0x34')]));_0x3ab4ad[_0xd9e2('0x33')]=_0x3ab4ad[_0xd9e2('0x33')][_0xd9e2('0x35')]?_0x3ab4ad[_0xd9e2('0x33')]:_0x1d3c61[_0xd9e2('0x2f')];if(!_0x2cb3['query'][_0xd9e2('0x36')](_0xd9e2('0x37'))){_0x3ab4ad[_0xd9e2('0x1a')]=qs['limit'](_0x2cb3[_0xd9e2('0x31')]['limit']);_0x3ab4ad[_0xd9e2('0x19')]=qs[_0xd9e2('0x19')](_0x2cb3[_0xd9e2('0x31')][_0xd9e2('0x19')]);}_0x3ab4ad[_0xd9e2('0x38')]=qs[_0xd9e2('0x39')](_0x2cb3[_0xd9e2('0x31')]['sort']);_0x3ab4ad[_0xd9e2('0x3a')]=qs[_0xd9e2('0x3b')](_[_0xd9e2('0x3c')](_0x2cb3[_0xd9e2('0x31')],_0x1d3c61['filters']),_0x22a3f2);if(_0x2cb3[_0xd9e2('0x31')]['filter']){_0x3ab4ad[_0xd9e2('0x3a')]=_[_0xd9e2('0x3d')](_0x3ab4ad['where'],{'$or':_[_0xd9e2('0x3e')](_0x22a3f2,function(_0x2af5f9){if(_0x2af5f9[_0xd9e2('0x2d')]!=='VIRTUAL'){var _0x3a83c1={};_0x3a83c1[_0x2af5f9[_0xd9e2('0x27')]]={'$like':'%'+_0x2cb3['query']['filter']+'%'};return _0x3a83c1;}})});}_0x3ab4ad=_['merge']({},_0x3ab4ad,_0x2cb3[_0xd9e2('0x3f')]);var _0x473c71={'where':_0x3ab4ad['where']};return db['Schedule'][_0xd9e2('0x18')](_0x473c71)[_0xd9e2('0x1f')](function(_0x4a2910){_0x37804f['count']=_0x4a2910;if(_0x2cb3[_0xd9e2('0x31')][_0xd9e2('0x40')]){_0x3ab4ad[_0xd9e2('0x41')]=[{'all':!![]}];}return db[_0xd9e2('0x2a')][_0xd9e2('0x42')](_0x3ab4ad);})[_0xd9e2('0x1f')](function(_0x1b1008){_0x37804f[_0xd9e2('0x43')]=_0x1b1008;return _0x37804f;})['then'](respondWithFilteredResult(_0x29e393,_0x3ab4ad))[_0xd9e2('0x44')](handleError(_0x29e393,null));};exports[_0xd9e2('0x45')]=function(_0x48f645,_0x5efd92){var _0x80787b={'raw':![],'where':{'id':_0x48f645[_0xd9e2('0x46')]['id']}},_0x20ccb0={};_0x20ccb0[_0xd9e2('0x2f')]=_[_0xd9e2('0x30')](db['Schedule'][_0xd9e2('0x2b')]);_0x20ccb0[_0xd9e2('0x31')]=_[_0xd9e2('0x30')](_0x48f645[_0xd9e2('0x31')]);_0x20ccb0['filters']=_[_0xd9e2('0x32')](_0x20ccb0[_0xd9e2('0x2f')],_0x20ccb0[_0xd9e2('0x31')]);_0x80787b[_0xd9e2('0x33')]=_[_0xd9e2('0x32')](_0x20ccb0[_0xd9e2('0x2f')],qs[_0xd9e2('0x34')](_0x48f645[_0xd9e2('0x31')]['fields']));_0x80787b[_0xd9e2('0x33')]=_0x80787b[_0xd9e2('0x33')][_0xd9e2('0x35')]?_0x80787b[_0xd9e2('0x33')]:_0x20ccb0[_0xd9e2('0x2f')];if(_0x48f645[_0xd9e2('0x31')][_0xd9e2('0x40')]){_0x80787b[_0xd9e2('0x41')]=[{'all':!![]}];}_0x80787b=_[_0xd9e2('0x3d')]({},_0x80787b,_0x48f645[_0xd9e2('0x3f')]);return db[_0xd9e2('0x2a')][_0xd9e2('0x47')](_0x80787b)['then'](handleEntityNotFound(_0x5efd92,null))[_0xd9e2('0x1f')](respondWithResult(_0x5efd92,null))[_0xd9e2('0x44')](handleError(_0x5efd92,null));};exports[_0xd9e2('0x48')]=function(_0xbaec25,_0x2db233){return db[_0xd9e2('0x2a')]['create'](_0xbaec25['body'],{})[_0xd9e2('0x1f')](function(_0x23bec9){var _0x2bfc52=_0xbaec25[_0xd9e2('0x49')][_0xd9e2('0x21')]({'plain':!![]});if(!_0x2bfc52)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bfc52[_0xd9e2('0x4a')]===_0xd9e2('0x49')){var _0x2ed95e=_0x23bec9['get']({'plain':!![]});var _0x2a41bb=_0xd9e2('0x4b');return db[_0xd9e2('0x4c')]['find']({'where':{'name':_0x2a41bb,'userProfileId':_0x2bfc52[_0xd9e2('0x4d')]},'raw':!![]})[_0xd9e2('0x1f')](function(_0x587d70){if(_0x587d70&&_0x587d70[_0xd9e2('0x4e')]===0x0){return db[_0xd9e2('0x22')][_0xd9e2('0x48')]({'name':_0x2ed95e['name'],'resourceId':_0x2ed95e['id'],'type':_0x587d70[_0xd9e2('0x27')],'sectionId':_0x587d70['id']},{})[_0xd9e2('0x1f')](function(){return _0x23bec9;});}else{return _0x23bec9;}})[_0xd9e2('0x44')](function(_0x15e546){logger[_0xd9e2('0x25')](_0xd9e2('0x4f'),_0x15e546);throw _0x15e546;});}return _0x23bec9;})[_0xd9e2('0x1f')](respondWithResult(_0x2db233,0xc9))['catch'](handleError(_0x2db233,null));};exports[_0xd9e2('0x50')]=function(_0x67db0c,_0x49f294){if(_0x67db0c['body']['id']){delete _0x67db0c[_0xd9e2('0x51')]['id'];}return db[_0xd9e2('0x2a')][_0xd9e2('0x47')]({'where':{'id':_0x67db0c[_0xd9e2('0x46')]['id']}})[_0xd9e2('0x1f')](handleEntityNotFound(_0x49f294,null))[_0xd9e2('0x1f')](saveUpdates(_0x67db0c[_0xd9e2('0x51')],null))[_0xd9e2('0x1f')](respondWithResult(_0x49f294,null))[_0xd9e2('0x44')](handleError(_0x49f294,null));};exports['destroy']=function(_0x33b744,_0x234d42){return db[_0xd9e2('0x2a')][_0xd9e2('0x47')]({'where':{'id':_0x33b744['params']['id']}})['then'](handleEntityNotFound(_0x234d42,null))[_0xd9e2('0x1f')](removeEntity(_0x234d42,null))[_0xd9e2('0x44')](handleError(_0x234d42,null));};exports['run']=function(_0x3bd253,_0x18cc45,_0x172772){var _0x822737=require(_0xd9e2('0x52'));return db[_0xd9e2('0x2a')][_0xd9e2('0x47')]({'where':{'id':_0x3bd253['params']['id']},'raw':!![]})[_0xd9e2('0x1f')](handleEntityNotFound(_0x18cc45,null))[_0xd9e2('0x1f')](function(){_0x822737[_0xd9e2('0x53')](_0x3bd253[_0xd9e2('0x46')]['id']);})[_0xd9e2('0x1f')](respondWithStatusCode(_0x18cc45,null))[_0xd9e2('0x44')](handleError(_0x18cc45,null));}; \ No newline at end of file +var _0x3305=['filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','catch','create','body','get','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','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','json','apply','save','update','destroy','Scheduler','UserProfileResource','then','end','error','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x3305,0x16c));var _0x5330=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3305[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x5330('0x0'));var emlformat=require(_0x5330('0x1'));var rimraf=require(_0x5330('0x2'));var zipdir=require(_0x5330('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5330('0x4'));var moment=require(_0x5330('0x5'));var BPromise=require(_0x5330('0x6'));var Mustache=require(_0x5330('0x7'));var util=require(_0x5330('0x8'));var path=require(_0x5330('0x9'));var sox=require(_0x5330('0xa'));var csv=require(_0x5330('0xb'));var ejs=require(_0x5330('0xc'));var fs=require('fs');var _=require(_0x5330('0xd'));var squel=require(_0x5330('0xe'));var crypto=require(_0x5330('0xf'));var jsforce=require(_0x5330('0x10'));var deskjs=require(_0x5330('0x11'));var toCsv=require(_0x5330('0xb'));var querystring=require(_0x5330('0x12'));var Papa=require(_0x5330('0x13'));var Redis=require(_0x5330('0x14'));var authService=require(_0x5330('0x15'));var qs=require(_0x5330('0x16'));var as=require(_0x5330('0x17'));var hardwareService=require(_0x5330('0x18'));var logger=require(_0x5330('0x19'))(_0x5330('0x1a'));var utils=require(_0x5330('0x1b'));var config=require(_0x5330('0x1c'));var db=require(_0x5330('0x1d'))['db'];function respondWithStatusCode(_0x3979a9,_0x142b5c){_0x142b5c=_0x142b5c||0xcc;return function(_0x4f85c2){if(_0x4f85c2){return _0x3979a9[_0x5330('0x1e')](_0x142b5c);}return _0x3979a9['status'](_0x142b5c)['end']();};}function respondWithResult(_0x472c76,_0x34d64a){_0x34d64a=_0x34d64a||0xc8;return function(_0x12d53a){if(_0x12d53a){return _0x472c76[_0x5330('0x1f')](_0x34d64a)['json'](_0x12d53a);}};}function respondWithFilteredResult(_0x146ba4,_0x101be5){return function(_0x18ca81){if(_0x18ca81){var _0x4b55c1=_0x18ca81[_0x5330('0x20')],_0x571e63=_0x101be5[_0x5330('0x21')],_0x4b1b55=_0x101be5[_0x5330('0x21')]+_0x101be5[_0x5330('0x22')],_0x3053a7;if(_0x4b1b55>=_0x4b55c1){_0x4b1b55=_0x4b55c1;_0x3053a7=0xc8;}else{_0x3053a7=0xce;}_0x146ba4[_0x5330('0x1f')](_0x3053a7);return _0x146ba4[_0x5330('0x23')]('Content-Range',_0x571e63+'-'+_0x4b1b55+'/'+_0x4b55c1)[_0x5330('0x24')](_0x18ca81);}return null;};}function patchUpdates(_0x28e8ec){return function(_0xa30a22){try{jsonpatch[_0x5330('0x25')](_0xa30a22,_0x28e8ec,!![]);}catch(_0x30bcb4){return BPromise['reject'](_0x30bcb4);}return _0xa30a22[_0x5330('0x26')]();};}function saveUpdates(_0x252e9c,_0x18e20a){return function(_0x1a7f57){if(_0x1a7f57){return _0x1a7f57[_0x5330('0x27')](_0x252e9c)['then'](function(_0x42590d){return _0x42590d;});}return null;};}function removeEntity(_0x16fa0c,_0x3af28e){return function(_0x390fbd){if(_0x390fbd){return _0x390fbd[_0x5330('0x28')]()['then'](function(){var _0x4a29b2=_0x390fbd['get']({'plain':!![]});var _0x27fb7e=_0x5330('0x29');return db[_0x5330('0x2a')][_0x5330('0x28')]({'where':{'type':_0x27fb7e,'resourceId':_0x4a29b2['id']}})['then'](function(){return _0x390fbd;});})[_0x5330('0x2b')](function(){_0x16fa0c[_0x5330('0x1f')](0xcc)[_0x5330('0x2c')]();});}};}function handleEntityNotFound(_0x1c8803,_0x5605f5){return function(_0x46aeff){if(!_0x46aeff){_0x1c8803[_0x5330('0x1e')](0x194);}return _0x46aeff;};}function handleError(_0x234e0b,_0x36421c){_0x36421c=_0x36421c||0x1f4;return function(_0x34d414){logger[_0x5330('0x2d')](_0x34d414['stack']);if(_0x34d414[_0x5330('0x2e')]){delete _0x34d414['name'];}_0x234e0b[_0x5330('0x1f')](_0x36421c)[_0x5330('0x2f')](_0x34d414);};}exports[_0x5330('0x30')]=function(_0x9b2bb,_0x1b7581){var _0x2932bf={},_0x3df24e={},_0x27246f={'count':0x0,'rows':[]};var _0x393b31=_[_0x5330('0x31')](db[_0x5330('0x32')][_0x5330('0x33')],function(_0x5e7732){return{'name':_0x5e7732['fieldName'],'type':_0x5e7732[_0x5330('0x34')][_0x5330('0x35')]};});_0x3df24e[_0x5330('0x36')]=_['map'](_0x393b31,_0x5330('0x2e'));_0x3df24e[_0x5330('0x37')]=_[_0x5330('0x38')](_0x9b2bb[_0x5330('0x37')]);_0x3df24e[_0x5330('0x39')]=_[_0x5330('0x3a')](_0x3df24e[_0x5330('0x36')],_0x3df24e['query']);_0x2932bf['attributes']=_['intersection'](_0x3df24e[_0x5330('0x36')],qs[_0x5330('0x3b')](_0x9b2bb[_0x5330('0x37')][_0x5330('0x3b')]));_0x2932bf[_0x5330('0x3c')]=_0x2932bf['attributes'][_0x5330('0x3d')]?_0x2932bf[_0x5330('0x3c')]:_0x3df24e['model'];if(!_0x9b2bb[_0x5330('0x37')][_0x5330('0x3e')]('nolimit')){_0x2932bf[_0x5330('0x22')]=qs[_0x5330('0x22')](_0x9b2bb[_0x5330('0x37')]['limit']);_0x2932bf[_0x5330('0x21')]=qs[_0x5330('0x21')](_0x9b2bb[_0x5330('0x37')][_0x5330('0x21')]);}_0x2932bf[_0x5330('0x3f')]=qs['sort'](_0x9b2bb[_0x5330('0x37')]['sort']);_0x2932bf[_0x5330('0x40')]=qs[_0x5330('0x39')](_[_0x5330('0x41')](_0x9b2bb['query'],_0x3df24e[_0x5330('0x39')]),_0x393b31);if(_0x9b2bb[_0x5330('0x37')][_0x5330('0x42')]){_0x2932bf[_0x5330('0x40')]=_[_0x5330('0x43')](_0x2932bf[_0x5330('0x40')],{'$or':_[_0x5330('0x31')](_0x393b31,function(_0x2053cc){if(_0x2053cc['type']!==_0x5330('0x44')){var _0x81062a={};_0x81062a[_0x2053cc[_0x5330('0x2e')]]={'$like':'%'+_0x9b2bb[_0x5330('0x37')]['filter']+'%'};return _0x81062a;}})});}_0x2932bf=_[_0x5330('0x43')]({},_0x2932bf,_0x9b2bb[_0x5330('0x45')]);var _0x113017={'where':_0x2932bf[_0x5330('0x40')]};return db[_0x5330('0x32')]['count'](_0x113017)[_0x5330('0x2b')](function(_0x38e6e5){_0x27246f[_0x5330('0x20')]=_0x38e6e5;if(_0x9b2bb[_0x5330('0x37')]['includeAll']){_0x2932bf[_0x5330('0x46')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x2932bf);})[_0x5330('0x2b')](function(_0x5b80fc){_0x27246f[_0x5330('0x47')]=_0x5b80fc;return _0x27246f;})[_0x5330('0x2b')](respondWithFilteredResult(_0x1b7581,_0x2932bf))['catch'](handleError(_0x1b7581,null));};exports[_0x5330('0x48')]=function(_0x5f354e,_0x42ed1f){var _0x24a205={'raw':![],'where':{'id':_0x5f354e[_0x5330('0x49')]['id']}},_0x547d3b={};_0x547d3b[_0x5330('0x36')]=_[_0x5330('0x38')](db[_0x5330('0x32')]['rawAttributes']);_0x547d3b[_0x5330('0x37')]=_['keys'](_0x5f354e[_0x5330('0x37')]);_0x547d3b[_0x5330('0x39')]=_[_0x5330('0x3a')](_0x547d3b['model'],_0x547d3b['query']);_0x24a205[_0x5330('0x3c')]=_[_0x5330('0x3a')](_0x547d3b[_0x5330('0x36')],qs['fields'](_0x5f354e[_0x5330('0x37')][_0x5330('0x3b')]));_0x24a205['attributes']=_0x24a205[_0x5330('0x3c')]['length']?_0x24a205[_0x5330('0x3c')]:_0x547d3b[_0x5330('0x36')];if(_0x5f354e['query'][_0x5330('0x4a')]){_0x24a205[_0x5330('0x46')]=[{'all':!![]}];}_0x24a205=_[_0x5330('0x43')]({},_0x24a205,_0x5f354e[_0x5330('0x45')]);return db[_0x5330('0x32')]['find'](_0x24a205)[_0x5330('0x2b')](handleEntityNotFound(_0x42ed1f,null))[_0x5330('0x2b')](respondWithResult(_0x42ed1f,null))[_0x5330('0x4b')](handleError(_0x42ed1f,null));};exports['create']=function(_0x8a3877,_0x241d67){return db[_0x5330('0x32')][_0x5330('0x4c')](_0x8a3877[_0x5330('0x4d')],{})[_0x5330('0x2b')](function(_0x41f9bc){var _0x21787a=_0x8a3877['user'][_0x5330('0x4e')]({'plain':!![]});if(!_0x21787a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21787a['role']===_0x5330('0x4f')){var _0xa805fc=_0x41f9bc[_0x5330('0x4e')]({'plain':!![]});var _0x1e4034=_0x5330('0x29');return db[_0x5330('0x50')][_0x5330('0x51')]({'where':{'name':_0x1e4034,'userProfileId':_0x21787a['userProfileId']},'raw':!![]})[_0x5330('0x2b')](function(_0x28bda1){if(_0x28bda1&&_0x28bda1[_0x5330('0x52')]===0x0){return db['UserProfileResource'][_0x5330('0x4c')]({'name':_0xa805fc['name'],'resourceId':_0xa805fc['id'],'type':_0x28bda1[_0x5330('0x2e')],'sectionId':_0x28bda1['id']},{})['then'](function(){return _0x41f9bc;});}else{return _0x41f9bc;}})[_0x5330('0x4b')](function(_0x45552f){logger[_0x5330('0x2d')](_0x5330('0x53'),_0x45552f);throw _0x45552f;});}return _0x41f9bc;})['then'](respondWithResult(_0x241d67,0xc9))[_0x5330('0x4b')](handleError(_0x241d67,null));};exports['update']=function(_0x39e3ca,_0x25e366){if(_0x39e3ca[_0x5330('0x4d')]['id']){delete _0x39e3ca[_0x5330('0x4d')]['id'];}return db[_0x5330('0x32')][_0x5330('0x51')]({'where':{'id':_0x39e3ca['params']['id']}})['then'](handleEntityNotFound(_0x25e366,null))[_0x5330('0x2b')](saveUpdates(_0x39e3ca['body'],null))['then'](respondWithResult(_0x25e366,null))[_0x5330('0x4b')](handleError(_0x25e366,null));};exports['destroy']=function(_0x29cca1,_0x9c36d2){return db[_0x5330('0x32')][_0x5330('0x51')]({'where':{'id':_0x29cca1['params']['id']}})[_0x5330('0x2b')](handleEntityNotFound(_0x9c36d2,null))[_0x5330('0x2b')](removeEntity(_0x9c36d2,null))[_0x5330('0x4b')](handleError(_0x9c36d2,null));};exports['run']=function(_0xb4fa8,_0x5e371b,_0xc4b222){var _0x543513=require(_0x5330('0x54'));return db['Schedule'][_0x5330('0x51')]({'where':{'id':_0xb4fa8[_0x5330('0x49')]['id']},'raw':!![]})[_0x5330('0x2b')](handleEntityNotFound(_0x5e371b,null))[_0x5330('0x2b')](function(){_0x543513[_0x5330('0x55')](_0xb4fa8[_0x5330('0x49')]['id']);})[_0x5330('0x2b')](respondWithStatusCode(_0x5e371b,null))[_0x5330('0x4b')](handleError(_0x5e371b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 45290e6..11113c7 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 _0x2432=['moment','bluebird','request-promise','define','Schedule','tools_schedules','lodash','util','api'];(function(_0x23a13b,_0x340dc){var _0xc6735e=function(_0x1499e4){while(--_0x1499e4){_0x23a13b['push'](_0x23a13b['shift']());}};_0xc6735e(++_0x340dc);}(_0x2432,0x12f));var _0x2243=function(_0x4e19bc,_0x3aefd0){_0x4e19bc=_0x4e19bc-0x0;var _0x15f1ab=_0x2432[_0x4e19bc];return _0x15f1ab;};'use strict';var _=require(_0x2243('0x0'));var util=require(_0x2243('0x1'));var logger=require('../../config/logger')(_0x2243('0x2'));var moment=require(_0x2243('0x3'));var BPromise=require(_0x2243('0x4'));var rp=require(_0x2243('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0x100a9b,_0x14759c){return _0x100a9b[_0x2243('0x6')](_0x2243('0x7'),attributes,{'tableName':_0x2243('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e7=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules'];(function(_0x5d820d,_0x58083f){var _0x45abc3=function(_0x39dec0){while(--_0x39dec0){_0x5d820d['push'](_0x5d820d['shift']());}};_0x45abc3(++_0x58083f);}(_0xc1e7,0x12c));var _0x7c1e=function(_0xa80b46,_0x504e68){_0xa80b46=_0xa80b46-0x0;var _0x2a39ad=_0xc1e7[_0xa80b46];return _0x2a39ad;};'use strict';var _=require(_0x7c1e('0x0'));var util=require('util');var logger=require(_0x7c1e('0x1'))(_0x7c1e('0x2'));var moment=require('moment');var BPromise=require(_0x7c1e('0x3'));var rp=require(_0x7c1e('0x4'));var fs=require('fs');var path=require(_0x7c1e('0x5'));var rimraf=require(_0x7c1e('0x6'));var config=require(_0x7c1e('0x7'));var attributes=require('./schedule.attributes');module[_0x7c1e('0x8')]=function(_0x5b160e,_0x2f0c28){return _0x5b160e[_0x7c1e('0x9')](_0x7c1e('0xa'),attributes,{'tableName':_0x7c1e('0xb'),'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 a0607f2..645b730 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 _0x8e12=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x8e12,0x1ef));var _0x28e1=function(_0x155f80,_0x2352bc){_0x155f80=_0x155f80-0x0;var _0x55a837=_0x8e12[_0x155f80];return _0x55a837;};'use strict';var _=require(_0x28e1('0x0'));var util=require(_0x28e1('0x1'));var moment=require(_0x28e1('0x2'));var BPromise=require(_0x28e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28e1('0x4'));var db=require(_0x28e1('0x5'))['db'];var utils=require(_0x28e1('0x6'));var logger=require('../../config/logger')(_0x28e1('0x7'));var config=require(_0x28e1('0x8'));var jayson=require(_0x28e1('0x9'));var client=jayson['client'][_0x28e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eb5c5,_0x4cc8bb,_0x2b3865){return new BPromise(function(_0x254680,_0x1f6ee0){return client[_0x28e1('0xb')](_0x1eb5c5,_0x2b3865)[_0x28e1('0xc')](function(_0x11f861){logger[_0x28e1('0xd')](_0x28e1('0xe'),_0x4cc8bb,_0x28e1('0xf'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x4cc8bb,_0x28e1('0xf'),JSON[_0x28e1('0x10')](_0x11f861));if(_0x11f861['error']){if(_0x11f861[_0x28e1('0x11')][_0x28e1('0x12')]===0x1f4){logger[_0x28e1('0x11')](_0x28e1('0xe'),_0x4cc8bb,_0x11f861[_0x28e1('0x11')][_0x28e1('0x13')]);return _0x1f6ee0(_0x11f861[_0x28e1('0x11')]['message']);}logger[_0x28e1('0x11')](_0x28e1('0xe'),_0x4cc8bb,_0x11f861[_0x28e1('0x11')][_0x28e1('0x13')]);return _0x254680(_0x11f861[_0x28e1('0x11')]['message']);}else{logger[_0x28e1('0xd')](_0x28e1('0xe'),_0x4cc8bb,'request\x20sent');_0x254680(_0x11f861[_0x28e1('0x14')][_0x28e1('0x13')]);}})[_0x28e1('0x15')](function(_0x1bf681){logger['error']('Schedule,\x20%s,\x20%s',_0x4cc8bb,_0x1bf681);_0x1f6ee0(_0x1bf681);});});} \ No newline at end of file +var _0x8696=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0x8696,0x143));var _0x6869=function(_0x130645,_0x8c3a10){_0x130645=_0x130645-0x0;var _0x23ae28=_0x8696[_0x130645];return _0x23ae28;};'use strict';var _=require(_0x6869('0x0'));var util=require(_0x6869('0x1'));var moment=require('moment');var BPromise=require(_0x6869('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6869('0x3'));var db=require(_0x6869('0x4'))['db'];var utils=require(_0x6869('0x5'));var logger=require('../../config/logger')(_0x6869('0x6'));var config=require('../../config/environment');var jayson=require(_0x6869('0x7'));var client=jayson[_0x6869('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c8ad5,_0xa00fe5,_0x1e667d){return new BPromise(function(_0xa343ab,_0x3fff8a){return client[_0x6869('0x9')](_0x4c8ad5,_0x1e667d)[_0x6869('0xa')](function(_0x3c8486){logger['info'](_0x6869('0xb'),_0xa00fe5,_0x6869('0xc'));logger[_0x6869('0xd')](_0x6869('0xe'),_0xa00fe5,'request\x20sent',JSON['stringify'](_0x3c8486));if(_0x3c8486['error']){if(_0x3c8486[_0x6869('0xf')][_0x6869('0x10')]===0x1f4){logger[_0x6869('0xf')](_0x6869('0xb'),_0xa00fe5,_0x3c8486[_0x6869('0xf')]['message']);return _0x3fff8a(_0x3c8486[_0x6869('0xf')][_0x6869('0x11')]);}logger['error'](_0x6869('0xb'),_0xa00fe5,_0x3c8486[_0x6869('0xf')][_0x6869('0x11')]);return _0xa343ab(_0x3c8486['error'][_0x6869('0x11')]);}else{logger['info'](_0x6869('0xb'),_0xa00fe5,'request\x20sent');_0xa343ab(_0x3c8486[_0x6869('0x12')][_0x6869('0x11')]);}})[_0x6869('0x13')](function(_0x199a26){logger['error'](_0x6869('0xb'),_0xa00fe5,_0x199a26);_0x3fff8a(_0x199a26);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 11e85a0..46030d3 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 _0xda0e=['describe','/:id','show','/:id/download','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x2e3178,_0xa2da2e){var _0x81058d=function(_0x4f29ab){while(--_0x4f29ab){_0x2e3178['push'](_0x2e3178['shift']());}};_0x81058d(++_0xa2da2e);}(_0xda0e,0x184));var _0xeda0=function(_0x2f49ec,_0x20c1cb){_0x2f49ec=_0x2f49ec-0x0;var _0x1258e1=_0xda0e[_0x2f49ec];return _0x1258e1;};'use strict';var multer=require(_0xeda0('0x0'));var util=require(_0xeda0('0x1'));var path=require(_0xeda0('0x2'));var timeout=require(_0xeda0('0x3'));var express=require('express');var router=express[_0xeda0('0x4')]();var auth=require(_0xeda0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeda0('0x6'));var controller=require(_0xeda0('0x7'));router[_0xeda0('0x8')]('/',auth[_0xeda0('0x9')](),controller[_0xeda0('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xeda0('0xb')]);router[_0xeda0('0x8')](_0xeda0('0xc'),auth[_0xeda0('0x9')](),controller[_0xeda0('0xd')]);router['get'](_0xeda0('0xe'),auth[_0xeda0('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xeda0('0xf')]);router[_0xeda0('0x10')](_0xeda0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xeda0('0x11')](_0xeda0('0xc'),auth[_0xeda0('0x9')](),controller['destroy']);module[_0xeda0('0x12')]=router; \ No newline at end of file +var _0x4288=['isAuthenticated','index','/describe','describe','show','download','/:id','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get'];(function(_0x5f4075,_0x26b2f4){var _0x5e7361=function(_0x3b8b0f){while(--_0x3b8b0f){_0x5f4075['push'](_0x5f4075['shift']());}};_0x5e7361(++_0x26b2f4);}(_0x4288,0x1cd));var _0x8428=function(_0x53d3fd,_0x5d989c){_0x53d3fd=_0x53d3fd-0x0;var _0x5baf9a=_0x4288[_0x53d3fd];return _0x5baf9a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8428('0x0'));var express=require(_0x8428('0x1'));var router=express[_0x8428('0x2')]();var auth=require(_0x8428('0x3'));var interaction=require(_0x8428('0x4'));var config=require('../../config/environment');var controller=require(_0x8428('0x5'));router[_0x8428('0x6')]('/',auth[_0x8428('0x7')](),controller[_0x8428('0x8')]);router[_0x8428('0x6')](_0x8428('0x9'),auth[_0x8428('0x7')](),controller[_0x8428('0xa')]);router[_0x8428('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8428('0xb')]);router[_0x8428('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x8428('0xc')]);router['post']('/',auth[_0x8428('0x7')](),controller['create']);router['put'](_0x8428('0xd'),auth[_0x8428('0x7')](),controller[_0x8428('0xe')]);router[_0x8428('0xf')](_0x8428('0xd'),auth['isAuthenticated'](),controller[_0x8428('0x10')]);module[_0x8428('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 5b56920..e72b7e5 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 _0x17ba=['MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x246212,_0x1082bc){var _0x50de4d=function(_0x91e032){while(--_0x91e032){_0x246212['push'](_0x246212['shift']());}};_0x50de4d(++_0x1082bc);}(_0x17ba,0xab));var _0xa17b=function(_0x1045ff,_0x1878db){_0x1045ff=_0x1045ff-0x0;var _0x5c5a05=_0x17ba[_0x1045ff];return _0x5c5a05;};'use strict';var Sequelize=require(_0xa17b('0x0'));var moment=require(_0xa17b('0x1'));var path=require('path');var config=require(_0xa17b('0x2'));module[_0xa17b('0x3')]={'format':{'type':Sequelize[_0xa17b('0x4')],'get':function(){return this[_0xa17b('0x5')](_0xa17b('0x6'))?path[_0xa17b('0x7')](this[_0xa17b('0x5')](_0xa17b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa17b('0x8')]},'channel':{'type':Sequelize[_0xa17b('0x8')]},'value':{'type':Sequelize[_0xa17b('0x8')],'set':function(_0x2e3d43){var _0x1957be=_0x2e3d43[_0xa17b('0x9')](/\\/g,'/');this[_0xa17b('0xa')](_0xa17b('0x6'),_0x1957be);}},'rating':{'type':Sequelize[_0xa17b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa17b('0xb')],'set':function(_0x15bdfc){this['setDataValue'](_0xa17b('0xc'),moment()[_0xa17b('0xd')](_0x15bdfc,'ms'));this[_0xa17b('0xa')](_0xa17b('0xe'),moment());this[_0xa17b('0xa')](_0xa17b('0xf'),_0x15bdfc);}},'startedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this['getDataValue'](_0xa17b('0xc')))[_0xa17b('0x11')](_0xa17b('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0xe')))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa17b('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0x14')))['format'](_0xa17b('0x12'))[_0xa17b('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')]('updatedAt'))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x00bb=['exports','getDataValue','value','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path'];(function(_0xe1f293,_0x1f734d){var _0x15f92e=function(_0x1b144e){while(--_0x1b144e){_0xe1f293['push'](_0xe1f293['shift']());}};_0x15f92e(++_0x1f734d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x00bb[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xb00b('0x0'));var moment=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var config=require('../../config/environment');module[_0xb00b('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb00b('0x4')](_0xb00b('0x5'))?path['extname'](this[_0xb00b('0x4')](_0xb00b('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x36e363){var _0xf737d0=_0x36e363[_0xb00b('0x6')](/\\/g,'/');this[_0xb00b('0x7')](_0xb00b('0x5'),_0xf737d0);}},'rating':{'type':Sequelize[_0xb00b('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x51d12b){this[_0xb00b('0x7')](_0xb00b('0x9'),moment()[_0xb00b('0xa')](_0x51d12b,'ms'));this[_0xb00b('0x7')](_0xb00b('0xb'),moment());this['setDataValue'](_0xb00b('0xc'),_0x51d12b);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('startedAt'))[_0xb00b('0xd')](_0xb00b('0xe'))[_0xb00b('0xf')]();}},'closedAt':{'type':Sequelize[_0xb00b('0x10')],'get':function(){return moment(this[_0xb00b('0x4')](_0xb00b('0xb')))['format'](_0xb00b('0xe'))[_0xb00b('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb00b('0x4')](_0xb00b('0x11')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb00b('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb00b('0x12')))[_0xb00b('0xd')](_0xb00b('0xe'))[_0xb00b('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 055ad2c..f4cb4f0 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 _0x17f5=['send','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','type','VIRTUAL','filter','where','findAll','params','intersection','includeAll','include','find','catch','create','body','createdAt','closedAt','describe','uniqueid','value','join','root','%s.cypher','existsSync','decryptFile','server/files/screen_recordings','Sequelize','filename','download','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','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','update','destroy','then','stack','name'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x17f5,0xa1));var _0x517f=function(_0xa1fa4d,_0x68465){_0xa1fa4d=_0xa1fa4d-0x0;var _0x1c3304=_0x17f5[_0xa1fa4d];return _0x1c3304;};'use strict';var pdf=require(_0x517f('0x0'));var emlformat=require(_0x517f('0x1'));var rimraf=require(_0x517f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x517f('0x3'));var rp=require('request-promise');var moment=require(_0x517f('0x4'));var BPromise=require(_0x517f('0x5'));var Mustache=require(_0x517f('0x6'));var util=require(_0x517f('0x7'));var path=require(_0x517f('0x8'));var sox=require(_0x517f('0x9'));var csv=require(_0x517f('0xa'));var ejs=require(_0x517f('0xb'));var fs=require('fs');var _=require(_0x517f('0xc'));var squel=require(_0x517f('0xd'));var crypto=require(_0x517f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x517f('0xf'));var toCsv=require(_0x517f('0xa'));var querystring=require(_0x517f('0x10'));var Papa=require(_0x517f('0x11'));var Redis=require('ioredis');var authService=require(_0x517f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x517f('0x13'));var hardwareService=require(_0x517f('0x14'));var logger=require(_0x517f('0x15'))(_0x517f('0x16'));var utils=require(_0x517f('0x17'));var config=require(_0x517f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1337fd,_0x4e3565){_0x4e3565=_0x4e3565||0xcc;return function(_0x2a43c0){if(_0x2a43c0){return _0x1337fd[_0x517f('0x19')](_0x4e3565);}return _0x1337fd['status'](_0x4e3565)[_0x517f('0x1a')]();};}function respondWithResult(_0x23a0bf,_0x456d24){_0x456d24=_0x456d24||0xc8;return function(_0x3984f6){if(_0x3984f6){return _0x23a0bf['status'](_0x456d24)[_0x517f('0x1b')](_0x3984f6);}};}function respondWithFilteredResult(_0x493a3f,_0x2d6746){return function(_0x22e3d6){if(_0x22e3d6){var _0x55cc71=_0x22e3d6[_0x517f('0x1c')],_0x324c7a=_0x2d6746['offset'],_0x517e21=_0x2d6746[_0x517f('0x1d')]+_0x2d6746[_0x517f('0x1e')],_0x5d437d;if(_0x517e21>=_0x55cc71){_0x517e21=_0x55cc71;_0x5d437d=0xc8;}else{_0x5d437d=0xce;}_0x493a3f[_0x517f('0x1f')](_0x5d437d);return _0x493a3f[_0x517f('0x20')](_0x517f('0x21'),_0x324c7a+'-'+_0x517e21+'/'+_0x55cc71)[_0x517f('0x1b')](_0x22e3d6);}return null;};}function patchUpdates(_0x39bf56){return function(_0x3c1656){try{jsonpatch['apply'](_0x3c1656,_0x39bf56,!![]);}catch(_0x6b3293){return BPromise['reject'](_0x6b3293);}return _0x3c1656['save']();};}function saveUpdates(_0x52677d,_0x39dd8c){return function(_0x175c12){if(_0x175c12){return _0x175c12[_0x517f('0x22')](_0x52677d)['then'](function(_0x26353f){return _0x26353f;});}return null;};}function removeEntity(_0x11424a,_0x3f2781){return function(_0xa43c05){if(_0xa43c05){return _0xa43c05[_0x517f('0x23')]()[_0x517f('0x24')](function(){_0x11424a[_0x517f('0x1f')](0xcc)[_0x517f('0x1a')]();});}};}function handleEntityNotFound(_0x5718e8,_0x3ff35c){return function(_0x3f1ce2){if(!_0x3f1ce2){_0x5718e8['sendStatus'](0x194);}return _0x3f1ce2;};}function handleError(_0x43d065,_0x1c1ed1){_0x1c1ed1=_0x1c1ed1||0x1f4;return function(_0x58cd4a){logger['error'](_0x58cd4a[_0x517f('0x25')]);if(_0x58cd4a[_0x517f('0x26')]){delete _0x58cd4a[_0x517f('0x26')];}_0x43d065['status'](_0x1c1ed1)[_0x517f('0x27')](_0x58cd4a);};}exports[_0x517f('0x28')]=function(_0x5b842c,_0x1e0454){var _0x1554df={},_0x99ce82={},_0x50397e={'count':0x0,'rows':[]};var _0x586eed=_[_0x517f('0x29')](db[_0x517f('0x2a')][_0x517f('0x2b')],function(_0x1f7370){return{'name':_0x1f7370[_0x517f('0x2c')],'type':_0x1f7370['type'][_0x517f('0x2d')]};});_0x99ce82[_0x517f('0x2e')]=_[_0x517f('0x2f')](_[_0x517f('0x29')](_0x586eed,_0x517f('0x26')),[_0x517f('0x30')]);_0x99ce82[_0x517f('0x31')]=_[_0x517f('0x32')](_0x5b842c[_0x517f('0x31')]);_0x99ce82['filters']=_['intersection'](_0x99ce82[_0x517f('0x2e')],_0x99ce82[_0x517f('0x31')]);_0x1554df[_0x517f('0x33')]=_['intersection'](_0x99ce82['model'],qs[_0x517f('0x34')](_0x5b842c[_0x517f('0x31')][_0x517f('0x34')]));_0x1554df[_0x517f('0x33')]=_0x1554df['attributes'][_0x517f('0x35')]?_0x1554df['attributes']:_0x99ce82[_0x517f('0x2e')];if(!_0x5b842c[_0x517f('0x31')][_0x517f('0x36')](_0x517f('0x37'))){_0x1554df[_0x517f('0x1e')]=qs[_0x517f('0x1e')](_0x5b842c[_0x517f('0x31')][_0x517f('0x1e')]);_0x1554df[_0x517f('0x1d')]=qs[_0x517f('0x1d')](_0x5b842c[_0x517f('0x31')][_0x517f('0x1d')]);}_0x1554df[_0x517f('0x38')]=qs[_0x517f('0x39')](_0x5b842c[_0x517f('0x31')][_0x517f('0x39')]);_0x1554df['where']=qs[_0x517f('0x3a')](_[_0x517f('0x3b')](_0x5b842c[_0x517f('0x31')],_0x99ce82[_0x517f('0x3a')]),_0x586eed);if(_0x5b842c[_0x517f('0x31')]['filter']){_0x1554df['where']=_[_0x517f('0x3c')](_0x1554df['where'],{'$or':_[_0x517f('0x29')](_0x586eed,function(_0x2e06b6){if(_0x2e06b6[_0x517f('0x3d')]!==_0x517f('0x3e')){var _0xd5df75={};_0xd5df75[_0x2e06b6[_0x517f('0x26')]]={'$like':'%'+_0x5b842c[_0x517f('0x31')][_0x517f('0x3f')]+'%'};return _0xd5df75;}})});}_0x1554df=_[_0x517f('0x3c')]({},_0x1554df,_0x5b842c['options']);var _0x201370={'where':_0x1554df[_0x517f('0x40')]};return db[_0x517f('0x2a')]['count'](_0x201370)[_0x517f('0x24')](function(_0x5346e4){_0x50397e[_0x517f('0x1c')]=_0x5346e4;if(_0x5b842c['query']['includeAll']){_0x1554df['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x517f('0x41')](_0x1554df);})[_0x517f('0x24')](function(_0x5ebbcd){_0x50397e['rows']=_0x5ebbcd;return _0x50397e;})['then'](respondWithFilteredResult(_0x1e0454,_0x1554df))['catch'](handleError(_0x1e0454,null));};exports['show']=function(_0x3035c8,_0x2fb5f7){var _0xf70fbe={'raw':![],'where':{'id':_0x3035c8[_0x517f('0x42')]['id']}},_0x3c71e0={};_0x3c71e0['model']=_[_0x517f('0x32')](db[_0x517f('0x2a')][_0x517f('0x2b')]);_0x3c71e0['query']=_[_0x517f('0x32')](_0x3035c8[_0x517f('0x31')]);_0x3c71e0[_0x517f('0x3a')]=_[_0x517f('0x43')](_0x3c71e0['model'],_0x3c71e0[_0x517f('0x31')]);_0xf70fbe['attributes']=_[_0x517f('0x43')](_0x3c71e0[_0x517f('0x2e')],qs[_0x517f('0x34')](_0x3035c8[_0x517f('0x31')][_0x517f('0x34')]));_0xf70fbe[_0x517f('0x33')]=_0xf70fbe[_0x517f('0x33')]['length']?_0xf70fbe[_0x517f('0x33')]:_0x3c71e0[_0x517f('0x2e')];if(_0x3035c8[_0x517f('0x31')][_0x517f('0x44')]){_0xf70fbe[_0x517f('0x45')]=[{'all':!![]}];}_0xf70fbe=_[_0x517f('0x3c')]({},_0xf70fbe,_0x3035c8['options']);return db[_0x517f('0x2a')][_0x517f('0x46')](_0xf70fbe)[_0x517f('0x24')](handleEntityNotFound(_0x2fb5f7,null))[_0x517f('0x24')](respondWithResult(_0x2fb5f7,null))[_0x517f('0x47')](handleError(_0x2fb5f7,null));};exports[_0x517f('0x48')]=function(_0x44df7b,_0x51470c){return db['ScreenRecording'][_0x517f('0x48')](_0x44df7b['body'],{})[_0x517f('0x24')](respondWithResult(_0x51470c,0xc9))['catch'](handleError(_0x51470c,null));};exports[_0x517f('0x22')]=function(_0x309c14,_0x2e514f){if(_0x309c14[_0x517f('0x49')]['id']){delete _0x309c14[_0x517f('0x49')]['id'];}delete _0x309c14[_0x517f('0x49')]['duration'];delete _0x309c14['body'][_0x517f('0x4a')];delete _0x309c14[_0x517f('0x49')][_0x517f('0x4b')];delete _0x309c14[_0x517f('0x49')]['value'];return db[_0x517f('0x2a')]['find']({'where':{'id':_0x309c14['params']['id']}})[_0x517f('0x24')](handleEntityNotFound(_0x2e514f,null))[_0x517f('0x24')](saveUpdates(_0x309c14[_0x517f('0x49')],null))[_0x517f('0x24')](respondWithResult(_0x2e514f,null))['catch'](handleError(_0x2e514f,null));};exports['describe']=function(_0x315a4a,_0x1afd44){return db[_0x517f('0x2a')][_0x517f('0x4c')]()[_0x517f('0x24')](respondWithResult(_0x1afd44,null))['catch'](handleError(_0x1afd44,null));};exports['download']=function(_0x2c4e90,_0x48dfcc,_0x14a251){var _0x5abc11=require('../../components/encryptor');var _0x4cad2e=![];var _0x158ef5={};if(_0x2c4e90['query']['type']&&_0x2c4e90[_0x517f('0x31')]['type']===_0x517f('0x4d')){_0x158ef5[_0x517f('0x4d')]=_0x2c4e90[_0x517f('0x42')]['id'];}else{_0x158ef5['id']=_0x2c4e90[_0x517f('0x42')]['id'];}return db[_0x517f('0x2a')][_0x517f('0x46')]({'where':_0x158ef5,'attributes':['id',_0x517f('0x4e')],'raw':!![]})[_0x517f('0x24')](handleEntityNotFound(_0x48dfcc,null))[_0x517f('0x24')](function(_0x4790ce){if(_0x4790ce){var _0x37bd71=path[_0x517f('0x4f')](config[_0x517f('0x50')],'server/files/screen_recordings',_0x4790ce[_0x517f('0x4e')]);var _0x54c96f=util[_0x517f('0x30')](_0x517f('0x51'),_0x37bd71);if(fs[_0x517f('0x52')](_0x54c96f)){_0x4cad2e=!![];return _0x5abc11[_0x517f('0x53')](_0x54c96f,_0x37bd71,config['secrets']['recording'])[_0x517f('0x24')](function(){return _0x4790ce;});}return _0x4790ce;}})['then'](function(_0xe870e9){if(_0xe870e9){var _0x3341e3=path[_0x517f('0x4f')](config[_0x517f('0x50')],_0x517f('0x54'),_0xe870e9[_0x517f('0x4e')]);if(!fs[_0x517f('0x52')](_0x3341e3)){throw new db[(_0x517f('0x55'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0xe870e9[_0x517f('0x56')]){return _0x48dfcc[_0x517f('0x57')](_0x3341e3,_0xe870e9['filename']+path[_0x517f('0x58')](_0x3341e3),function(){if(_0x4cad2e){fs[_0x517f('0x59')](_0x3341e3);}});}else{return _0x48dfcc['download'](_0x3341e3,function(_0x1b219f){if(_0x4cad2e){fs['unlink'](_0x3341e3);}});}}})['catch'](function(_0x2a5737){if(_0x2a5737[_0x517f('0x5a')]==='ScreenRecording\x20not\x20found'){_0x48dfcc[_0x517f('0x1f')](0x194)[_0x517f('0x27')](_0x517f('0x5b'));}else{return handleError(_0x48dfcc,null);}});};exports[_0x517f('0x23')]=function(_0x3ed60c,_0x4706c8){return db[_0x517f('0x2a')][_0x517f('0x46')]({'where':{'id':_0x3ed60c['params']['id']}})[_0x517f('0x24')](function(_0x5ad213){if(!_0x5ad213)throw new ReferenceError(_0x517f('0x5c'));return _0x5ad213;})[_0x517f('0x24')](function(_0x31c263){var _0x737bd7=path[_0x517f('0x4f')](config[_0x517f('0x50')],_0x517f('0x54'),_0x31c263[_0x517f('0x4e')]);logger[_0x517f('0x5d')](_0x517f('0x5e'),_0x737bd7);if(!_[_0x517f('0x5f')](_0x31c263[_0x517f('0x4e')])&&fs[_0x517f('0x52')](_0x737bd7)){logger[_0x517f('0x5d')](_0x517f('0x60')+_0x737bd7+_0x517f('0x61'));fs['unlinkSync'](_0x737bd7);}_0x737bd7=_0x737bd7+_0x517f('0x62');if(!_[_0x517f('0x5f')](_0x31c263[_0x517f('0x4e')])&&fs[_0x517f('0x52')](_0x737bd7)){logger[_0x517f('0x5d')](_0x517f('0x60')+_0x737bd7+_0x517f('0x61'));fs[_0x517f('0x63')](_0x737bd7);}return _0x31c263;})[_0x517f('0x24')](function(_0x2b1cd7){if(!_0x2b1cd7)throw new InternalError();return _0x2b1cd7['destroy']();})[_0x517f('0x24')](function(){_0x4706c8[_0x517f('0x1f')](0xcc)['end']();})['catch'](handleError(_0x4706c8,null));}; \ No newline at end of file +var _0xfaf3=['apply','save','update','then','destroy','error','stack','name','index','map','fieldName','key','differenceBy','format','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','type','filter','count','includeAll','include','ScreenRecording','findAll','rows','catch','show','params','keys','options','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','root','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x5a872c,_0x30c88b){var _0x5df4c9=function(_0x2f1e2b){while(--_0x2f1e2b){_0x5a872c['push'](_0x5a872c['shift']());}};_0x5df4c9(++_0x30c88b);}(_0xfaf3,0x118));var _0x3faf=function(_0x17373d,_0x571b09){_0x17373d=_0x17373d-0x0;var _0x10266d=_0xfaf3[_0x17373d];return _0x10266d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3faf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3faf('0x1'));var moment=require(_0x3faf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3faf('0x3'));var util=require(_0x3faf('0x4'));var path=require(_0x3faf('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3faf('0x6'));var fs=require('fs');var _=require(_0x3faf('0x7'));var squel=require(_0x3faf('0x8'));var crypto=require(_0x3faf('0x9'));var jsforce=require(_0x3faf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3faf('0xb'));var Papa=require(_0x3faf('0xc'));var Redis=require(_0x3faf('0xd'));var authService=require(_0x3faf('0xe'));var qs=require(_0x3faf('0xf'));var as=require(_0x3faf('0x10'));var hardwareService=require(_0x3faf('0x11'));var logger=require(_0x3faf('0x12'))(_0x3faf('0x13'));var utils=require('../../config/utils');var config=require(_0x3faf('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44c8cf,_0x3a54d6){_0x3a54d6=_0x3a54d6||0xcc;return function(_0x5d4774){if(_0x5d4774){return _0x44c8cf[_0x3faf('0x15')](_0x3a54d6);}return _0x44c8cf[_0x3faf('0x16')](_0x3a54d6)[_0x3faf('0x17')]();};}function respondWithResult(_0x914c5b,_0xef1aa6){_0xef1aa6=_0xef1aa6||0xc8;return function(_0x4802a5){if(_0x4802a5){return _0x914c5b[_0x3faf('0x16')](_0xef1aa6)[_0x3faf('0x18')](_0x4802a5);}};}function respondWithFilteredResult(_0x7652ed,_0x43072e){return function(_0x3a3aef){if(_0x3a3aef){var _0x46eafa=_0x3a3aef['count'],_0x5aa9a2=_0x43072e['offset'],_0x2c602f=_0x43072e[_0x3faf('0x19')]+_0x43072e[_0x3faf('0x1a')],_0x15e5db;if(_0x2c602f>=_0x46eafa){_0x2c602f=_0x46eafa;_0x15e5db=0xc8;}else{_0x15e5db=0xce;}_0x7652ed['status'](_0x15e5db);return _0x7652ed[_0x3faf('0x1b')](_0x3faf('0x1c'),_0x5aa9a2+'-'+_0x2c602f+'/'+_0x46eafa)[_0x3faf('0x18')](_0x3a3aef);}return null;};}function patchUpdates(_0x49c023){return function(_0x4707bc){try{jsonpatch[_0x3faf('0x1d')](_0x4707bc,_0x49c023,!![]);}catch(_0xfbe7c5){return BPromise['reject'](_0xfbe7c5);}return _0x4707bc[_0x3faf('0x1e')]();};}function saveUpdates(_0x447390,_0x3e56c8){return function(_0x589aa9){if(_0x589aa9){return _0x589aa9[_0x3faf('0x1f')](_0x447390)[_0x3faf('0x20')](function(_0x1716a7){return _0x1716a7;});}return null;};}function removeEntity(_0x318d11,_0x2ec3c6){return function(_0x21e5ca){if(_0x21e5ca){return _0x21e5ca[_0x3faf('0x21')]()[_0x3faf('0x20')](function(){_0x318d11[_0x3faf('0x16')](0xcc)[_0x3faf('0x17')]();});}};}function handleEntityNotFound(_0x1e4bac,_0xe1b01c){return function(_0x1c72a7){if(!_0x1c72a7){_0x1e4bac['sendStatus'](0x194);}return _0x1c72a7;};}function handleError(_0x2bef97,_0x2ac941){_0x2ac941=_0x2ac941||0x1f4;return function(_0x5137ab){logger[_0x3faf('0x22')](_0x5137ab[_0x3faf('0x23')]);if(_0x5137ab[_0x3faf('0x24')]){delete _0x5137ab['name'];}_0x2bef97[_0x3faf('0x16')](_0x2ac941)['send'](_0x5137ab);};}exports[_0x3faf('0x25')]=function(_0x2777bf,_0x38158a){var _0x25c69d={},_0x24d5c7={},_0x2244ef={'count':0x0,'rows':[]};var _0x4e81cf=_[_0x3faf('0x26')](db['ScreenRecording']['rawAttributes'],function(_0x3f1640){return{'name':_0x3f1640[_0x3faf('0x27')],'type':_0x3f1640['type'][_0x3faf('0x28')]};});_0x24d5c7['model']=_[_0x3faf('0x29')](_[_0x3faf('0x26')](_0x4e81cf,_0x3faf('0x24')),[_0x3faf('0x2a')]);_0x24d5c7[_0x3faf('0x2b')]=_['keys'](_0x2777bf[_0x3faf('0x2b')]);_0x24d5c7[_0x3faf('0x2c')]=_[_0x3faf('0x2d')](_0x24d5c7['model'],_0x24d5c7['query']);_0x25c69d['attributes']=_[_0x3faf('0x2d')](_0x24d5c7[_0x3faf('0x2e')],qs['fields'](_0x2777bf[_0x3faf('0x2b')][_0x3faf('0x2f')]));_0x25c69d[_0x3faf('0x30')]=_0x25c69d[_0x3faf('0x30')]['length']?_0x25c69d[_0x3faf('0x30')]:_0x24d5c7['model'];if(!_0x2777bf[_0x3faf('0x2b')][_0x3faf('0x31')]('nolimit')){_0x25c69d[_0x3faf('0x1a')]=qs[_0x3faf('0x1a')](_0x2777bf['query']['limit']);_0x25c69d[_0x3faf('0x19')]=qs[_0x3faf('0x19')](_0x2777bf[_0x3faf('0x2b')][_0x3faf('0x19')]);}_0x25c69d[_0x3faf('0x32')]=qs[_0x3faf('0x33')](_0x2777bf[_0x3faf('0x2b')][_0x3faf('0x33')]);_0x25c69d[_0x3faf('0x34')]=qs[_0x3faf('0x2c')](_[_0x3faf('0x35')](_0x2777bf[_0x3faf('0x2b')],_0x24d5c7[_0x3faf('0x2c')]),_0x4e81cf);if(_0x2777bf[_0x3faf('0x2b')]['filter']){_0x25c69d[_0x3faf('0x34')]=_[_0x3faf('0x36')](_0x25c69d['where'],{'$or':_['map'](_0x4e81cf,function(_0x312547){if(_0x312547[_0x3faf('0x37')]!=='VIRTUAL'){var _0x2837b3={};_0x2837b3[_0x312547[_0x3faf('0x24')]]={'$like':'%'+_0x2777bf[_0x3faf('0x2b')][_0x3faf('0x38')]+'%'};return _0x2837b3;}})});}_0x25c69d=_[_0x3faf('0x36')]({},_0x25c69d,_0x2777bf['options']);var _0x2df276={'where':_0x25c69d[_0x3faf('0x34')]};return db['ScreenRecording'][_0x3faf('0x39')](_0x2df276)[_0x3faf('0x20')](function(_0x2f164b){_0x2244ef['count']=_0x2f164b;if(_0x2777bf['query'][_0x3faf('0x3a')]){_0x25c69d[_0x3faf('0x3b')]=[{'all':!![]}];}return db[_0x3faf('0x3c')][_0x3faf('0x3d')](_0x25c69d);})['then'](function(_0x3ad3da){_0x2244ef[_0x3faf('0x3e')]=_0x3ad3da;return _0x2244ef;})[_0x3faf('0x20')](respondWithFilteredResult(_0x38158a,_0x25c69d))[_0x3faf('0x3f')](handleError(_0x38158a,null));};exports[_0x3faf('0x40')]=function(_0x5f2872,_0x3212af){var _0x25312e={'raw':![],'where':{'id':_0x5f2872[_0x3faf('0x41')]['id']}},_0xbe8f8f={};_0xbe8f8f[_0x3faf('0x2e')]=_[_0x3faf('0x42')](db[_0x3faf('0x3c')]['rawAttributes']);_0xbe8f8f['query']=_[_0x3faf('0x42')](_0x5f2872[_0x3faf('0x2b')]);_0xbe8f8f['filters']=_[_0x3faf('0x2d')](_0xbe8f8f[_0x3faf('0x2e')],_0xbe8f8f[_0x3faf('0x2b')]);_0x25312e['attributes']=_[_0x3faf('0x2d')](_0xbe8f8f['model'],qs[_0x3faf('0x2f')](_0x5f2872[_0x3faf('0x2b')][_0x3faf('0x2f')]));_0x25312e[_0x3faf('0x30')]=_0x25312e[_0x3faf('0x30')]['length']?_0x25312e['attributes']:_0xbe8f8f[_0x3faf('0x2e')];if(_0x5f2872[_0x3faf('0x2b')][_0x3faf('0x3a')]){_0x25312e['include']=[{'all':!![]}];}_0x25312e=_[_0x3faf('0x36')]({},_0x25312e,_0x5f2872[_0x3faf('0x43')]);return db[_0x3faf('0x3c')][_0x3faf('0x44')](_0x25312e)[_0x3faf('0x20')](handleEntityNotFound(_0x3212af,null))[_0x3faf('0x20')](respondWithResult(_0x3212af,null))[_0x3faf('0x3f')](handleError(_0x3212af,null));};exports[_0x3faf('0x45')]=function(_0x406355,_0x309a8d){return db[_0x3faf('0x3c')]['create'](_0x406355[_0x3faf('0x46')],{})[_0x3faf('0x20')](respondWithResult(_0x309a8d,0xc9))[_0x3faf('0x3f')](handleError(_0x309a8d,null));};exports[_0x3faf('0x1f')]=function(_0x1d4023,_0x242ffb){if(_0x1d4023['body']['id']){delete _0x1d4023[_0x3faf('0x46')]['id'];}delete _0x1d4023[_0x3faf('0x46')][_0x3faf('0x47')];delete _0x1d4023[_0x3faf('0x46')][_0x3faf('0x48')];delete _0x1d4023[_0x3faf('0x46')][_0x3faf('0x49')];delete _0x1d4023[_0x3faf('0x46')]['value'];return db['ScreenRecording'][_0x3faf('0x44')]({'where':{'id':_0x1d4023['params']['id']}})[_0x3faf('0x20')](handleEntityNotFound(_0x242ffb,null))[_0x3faf('0x20')](saveUpdates(_0x1d4023[_0x3faf('0x46')],null))[_0x3faf('0x20')](respondWithResult(_0x242ffb,null))[_0x3faf('0x3f')](handleError(_0x242ffb,null));};exports[_0x3faf('0x4a')]=function(_0x40b735,_0x3dcbd2){return db[_0x3faf('0x3c')][_0x3faf('0x4a')]()['then'](respondWithResult(_0x3dcbd2,null))[_0x3faf('0x3f')](handleError(_0x3dcbd2,null));};exports[_0x3faf('0x4b')]=function(_0x1cac70,_0x5127d1,_0x39acc8){var _0xbd20e=require(_0x3faf('0x4c'));var _0x348d5a=![];var _0x81a3e0={};if(_0x1cac70[_0x3faf('0x2b')][_0x3faf('0x37')]&&_0x1cac70[_0x3faf('0x2b')][_0x3faf('0x37')]===_0x3faf('0x4d')){_0x81a3e0['uniqueid']=_0x1cac70[_0x3faf('0x41')]['id'];}else{_0x81a3e0['id']=_0x1cac70[_0x3faf('0x41')]['id'];}return db[_0x3faf('0x3c')]['find']({'where':_0x81a3e0,'attributes':['id',_0x3faf('0x4e')],'raw':!![]})[_0x3faf('0x20')](handleEntityNotFound(_0x5127d1,null))[_0x3faf('0x20')](function(_0x5b53cd){if(_0x5b53cd){var _0x51d870=path[_0x3faf('0x4f')](config['root'],_0x3faf('0x50'),_0x5b53cd[_0x3faf('0x4e')]);var _0x38f715=util[_0x3faf('0x2a')](_0x3faf('0x51'),_0x51d870);if(fs[_0x3faf('0x52')](_0x38f715)){_0x348d5a=!![];return _0xbd20e[_0x3faf('0x53')](_0x38f715,_0x51d870,config[_0x3faf('0x54')][_0x3faf('0x55')])[_0x3faf('0x20')](function(){return _0x5b53cd;});}return _0x5b53cd;}})['then'](function(_0x1bafeb){if(_0x1bafeb){var _0x5b942a=path['join'](config['root'],'server/files/screen_recordings',_0x1bafeb[_0x3faf('0x4e')]);if(!fs[_0x3faf('0x52')](_0x5b942a)){throw new db[(_0x3faf('0x56'))][(_0x3faf('0x57'))](_0x3faf('0x58'));}if(_0x1bafeb[_0x3faf('0x59')]){return _0x5127d1[_0x3faf('0x4b')](_0x5b942a,_0x1bafeb['filename']+path[_0x3faf('0x5a')](_0x5b942a),function(){if(_0x348d5a){fs[_0x3faf('0x5b')](_0x5b942a);}});}else{return _0x5127d1['download'](_0x5b942a,function(_0x452ca2){if(_0x348d5a){fs[_0x3faf('0x5b')](_0x5b942a);}});}}})[_0x3faf('0x3f')](function(_0x1c2fd5){if(_0x1c2fd5[_0x3faf('0x5c')]===_0x3faf('0x58')){_0x5127d1['status'](0x194)[_0x3faf('0x5d')](_0x3faf('0x5e'));}else{return handleError(_0x5127d1,null);}});};exports['destroy']=function(_0x350c2c,_0x378834){return db['ScreenRecording'][_0x3faf('0x44')]({'where':{'id':_0x350c2c[_0x3faf('0x41')]['id']}})[_0x3faf('0x20')](function(_0x13a752){if(!_0x13a752)throw new ReferenceError(_0x3faf('0x5f'));return _0x13a752;})['then'](function(_0x31068b){var _0x2c316a=path['join'](config[_0x3faf('0x60')],_0x3faf('0x50'),_0x31068b['value']);logger[_0x3faf('0x61')]('cancellazione\x20fisica\x20documento\x20%s',_0x2c316a);if(!_[_0x3faf('0x62')](_0x31068b[_0x3faf('0x4e')])&&fs[_0x3faf('0x52')](_0x2c316a)){logger[_0x3faf('0x61')](_0x3faf('0x63')+_0x2c316a+_0x3faf('0x64'));fs[_0x3faf('0x65')](_0x2c316a);}_0x2c316a=_0x2c316a+_0x3faf('0x66');if(!_[_0x3faf('0x62')](_0x31068b[_0x3faf('0x4e')])&&fs[_0x3faf('0x52')](_0x2c316a)){logger[_0x3faf('0x61')](_0x3faf('0x63')+_0x2c316a+_0x3faf('0x64'));fs[_0x3faf('0x65')](_0x2c316a);}return _0x31068b;})[_0x3faf('0x20')](function(_0x6a71d7){if(!_0x6a71d7)throw new InternalError();return _0x6a71d7[_0x3faf('0x21')]();})[_0x3faf('0x20')](function(){_0x378834[_0x3faf('0x16')](0xcc)[_0x3faf('0x17')]();})[_0x3faf('0x3f')](handleError(_0x378834,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3d3184f..f978f1a 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 _0x1b07=['request-promise','path','rimraf','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment'];(function(_0xb7c388,_0xaf2c1d){var _0x2b200e=function(_0x326338){while(--_0x326338){_0xb7c388['push'](_0xb7c388['shift']());}};_0x2b200e(++_0xaf2c1d);}(_0x1b07,0x1a0));var _0x71b0=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x1b07[_0x361d3f];return _0x320229;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var logger=require(_0x71b0('0x2'))('api');var moment=require(_0x71b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x71b0('0x4'));var fs=require('fs');var path=require(_0x71b0('0x5'));var rimraf=require(_0x71b0('0x6'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x3d34e1,_0x4b32db){return _0x3d34e1['define'](_0x71b0('0x7'),attributes,{'tableName':_0x71b0('0x8'),'paranoid':![],'indexes':[{'name':_0x71b0('0x9'),'fields':[_0x71b0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd866=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','moment','bluebird'];(function(_0x436919,_0xa46c27){var _0x340632=function(_0x18b1e6){while(--_0x18b1e6){_0x436919['push'](_0x436919['shift']());}};_0x340632(++_0xa46c27);}(_0xd866,0xbf));var _0x6d86=function(_0x2c3f37,_0x5a46b6){_0x2c3f37=_0x2c3f37-0x0;var _0x12a453=_0xd866[_0x2c3f37];return _0x12a453;};'use strict';var _=require(_0x6d86('0x0'));var util=require(_0x6d86('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6d86('0x2'));var BPromise=require(_0x6d86('0x3'));var rp=require(_0x6d86('0x4'));var fs=require('fs');var path=require(_0x6d86('0x5'));var rimraf=require(_0x6d86('0x6'));var config=require(_0x6d86('0x7'));var attributes=require(_0x6d86('0x8'));module['exports']=function(_0x51a5ee,_0x38d573){return _0x51a5ee[_0x6d86('0x9')](_0x6d86('0xa'),attributes,{'tableName':_0x6d86('0xb'),'paranoid':![],'indexes':[{'name':_0x6d86('0xc'),'fields':[_0x6d86('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 755e132..d30be08 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(_0x4276c4,_0x32b9fc){var _0x478275=function(_0x1a8c42){while(--_0x1a8c42){_0x4276c4['push'](_0x4276c4['shift']());}};_0x478275(++_0x32b9fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x2c4140,_0x134d89){var _0x5e52fc=function(_0x765537){while(--_0x765537){_0x2c4140['push'](_0x2c4140['shift']());}};_0x5e52fc(++_0x134d89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 361fbb0..da2f77a 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 _0x4811=['join','root','server/files/images/logos/','format','%s%s','logo','originalname','/:id/logo','single','addLogo','logologin','extname','post','/:id/logo_login','addLogoLogin','preferred','/:id/preferred','file','favicon','addFavicon','put','/:id','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','show','getLogo','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage'];(function(_0x214b2b,_0x27056d){var _0x3e98b9=function(_0x2751f2){while(--_0x2751f2){_0x214b2b['push'](_0x214b2b['shift']());}};_0x3e98b9(++_0x27056d);}(_0x4811,0x1e5));var _0x1481=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4811[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x1481('0x0'));var util=require(_0x1481('0x1'));var path=require(_0x1481('0x2'));var timeout=require(_0x1481('0x3'));var express=require('express');var router=express[_0x1481('0x4')]();var auth=require(_0x1481('0x5'));var interaction=require(_0x1481('0x6'));var config=require('../../config/environment');var controller=require(_0x1481('0x7'));router[_0x1481('0x8')]('/',auth[_0x1481('0x9')](),controller[_0x1481('0xa')]);router[_0x1481('0x8')]('/:id',controller[_0x1481('0xb')]);router[_0x1481('0x8')]('/:id/logo',controller[_0x1481('0xc')]);router[_0x1481('0x8')]('/:id/logo_login',controller[_0x1481('0xd')]);router[_0x1481('0x8')]('/:id/gdpr',controller[_0x1481('0xe')]);router[_0x1481('0x8')]('/:id/preferred',controller[_0x1481('0xf')]);router[_0x1481('0x8')](_0x1481('0x10'),controller[_0x1481('0x11')]);var upload=multer({'storage':multer[_0x1481('0x12')]({'destination':function(_0x389fe1,_0x563189,_0x563dc8){_0x563dc8(null,path[_0x1481('0x13')](config[_0x1481('0x14')],_0x1481('0x15')));},'filename':function(_0x3982f2,_0x4bb573,_0x3dee2f){_0x3dee2f(null,util[_0x1481('0x16')](_0x1481('0x17'),_0x1481('0x18'),path['extname'](_0x4bb573[_0x1481('0x19')])));}})});router['post'](_0x1481('0x1a'),upload[_0x1481('0x1b')]('file'),controller[_0x1481('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a07a0,_0x3c0702,_0x260506){_0x260506(null,path['join'](config[_0x1481('0x14')],_0x1481('0x15')));},'filename':function(_0x5bc8a3,_0x5b9014,_0x12744c){_0x12744c(null,util[_0x1481('0x16')]('%s%s',_0x1481('0x1d'),path[_0x1481('0x1e')](_0x5b9014[_0x1481('0x19')])));}})});router[_0x1481('0x1f')](_0x1481('0x20'),upload[_0x1481('0x1b')]('file'),controller[_0x1481('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x391bf5,_0x243e85,_0x12db7a){_0x12db7a(null,path[_0x1481('0x13')](config[_0x1481('0x14')],_0x1481('0x15')));},'filename':function(_0x5b58c7,_0x502d12,_0x5ef18e){_0x5ef18e(null,util[_0x1481('0x16')](_0x1481('0x17'),_0x1481('0x22'),path[_0x1481('0x1e')](_0x502d12['originalname'])));}})});router[_0x1481('0x1f')](_0x1481('0x23'),upload[_0x1481('0x1b')](_0x1481('0x24')),controller['addPreferred']);var upload=multer({'storage':multer[_0x1481('0x12')]({'destination':function(_0x2e0ac5,_0xb5804b,_0x466a24){_0x466a24(null,path[_0x1481('0x13')](config[_0x1481('0x14')],'server/files/images/logos/'));},'filename':function(_0x30330e,_0x31b079,_0x1efecb){_0x1efecb(null,util[_0x1481('0x16')]('%s%s',_0x1481('0x25'),path['extname'](_0x31b079[_0x1481('0x19')])));}})});router['post'](_0x1481('0x10'),upload[_0x1481('0x1b')](_0x1481('0x24')),controller[_0x1481('0x26')]);router[_0x1481('0x27')](_0x1481('0x28'),auth[_0x1481('0x9')](),controller[_0x1481('0x29')]);module['exports']=router; \ No newline at end of file +var _0xc6a5=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','logo','extname','originalname','post','/:id/logo','single','addLogo','format','%s%s','/:id/logo_login','file','addLogoLogin','server/files/images/logos/','preferred','favicon','isAuthenticated'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc6a5,0x96));var _0x5c6a=function(_0x1d9132,_0x6b6e57){_0x1d9132=_0x1d9132-0x0;var _0x178295=_0xc6a5[_0x1d9132];return _0x178295;};'use strict';var multer=require(_0x5c6a('0x0'));var util=require(_0x5c6a('0x1'));var path=require(_0x5c6a('0x2'));var timeout=require(_0x5c6a('0x3'));var express=require(_0x5c6a('0x4'));var router=express[_0x5c6a('0x5')]();var auth=require(_0x5c6a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x5c6a('0x7')]('/',auth['isAuthenticated'](),controller[_0x5c6a('0x8')]);router[_0x5c6a('0x7')](_0x5c6a('0x9'),controller['show']);router[_0x5c6a('0x7')]('/:id/logo',controller['getLogo']);router[_0x5c6a('0x7')]('/:id/logo_login',controller['getLogoLogin']);router[_0x5c6a('0x7')](_0x5c6a('0xa'),controller[_0x5c6a('0xb')]);router[_0x5c6a('0x7')](_0x5c6a('0xc'),controller[_0x5c6a('0xd')]);router[_0x5c6a('0x7')](_0x5c6a('0xe'),controller[_0x5c6a('0xf')]);var upload=multer({'storage':multer[_0x5c6a('0x10')]({'destination':function(_0x3f45e0,_0x55e694,_0x395322){_0x395322(null,path[_0x5c6a('0x11')](config[_0x5c6a('0x12')],'server/files/images/logos/'));},'filename':function(_0x4e0a94,_0x308cca,_0x364a4a){_0x364a4a(null,util['format']('%s%s',_0x5c6a('0x13'),path[_0x5c6a('0x14')](_0x308cca[_0x5c6a('0x15')])));}})});router[_0x5c6a('0x16')](_0x5c6a('0x17'),upload[_0x5c6a('0x18')]('file'),controller[_0x5c6a('0x19')]);var upload=multer({'storage':multer[_0x5c6a('0x10')]({'destination':function(_0x49206f,_0x229934,_0x3e9cce){_0x3e9cce(null,path[_0x5c6a('0x11')](config['root'],'server/files/images/logos/'));},'filename':function(_0x78dc54,_0xe10dbc,_0x14fd0b){_0x14fd0b(null,util[_0x5c6a('0x1a')](_0x5c6a('0x1b'),'logologin',path['extname'](_0xe10dbc[_0x5c6a('0x15')])));}})});router['post'](_0x5c6a('0x1c'),upload['single'](_0x5c6a('0x1d')),controller[_0x5c6a('0x1e')]);var upload=multer({'storage':multer[_0x5c6a('0x10')]({'destination':function(_0x5e782f,_0x4d54cb,_0x2edad1){_0x2edad1(null,path[_0x5c6a('0x11')](config[_0x5c6a('0x12')],_0x5c6a('0x1f')));},'filename':function(_0xcd7894,_0x25b937,_0x5ed456){_0x5ed456(null,util[_0x5c6a('0x1a')](_0x5c6a('0x1b'),_0x5c6a('0x20'),path[_0x5c6a('0x14')](_0x25b937[_0x5c6a('0x15')])));}})});router[_0x5c6a('0x16')]('/:id/preferred',upload['single'](_0x5c6a('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer[_0x5c6a('0x10')]({'destination':function(_0x5b2734,_0x81a89d,_0x378e5e){_0x378e5e(null,path[_0x5c6a('0x11')](config[_0x5c6a('0x12')],_0x5c6a('0x1f')));},'filename':function(_0x541b4b,_0x3f0067,_0xe80c06){_0xe80c06(null,util['format'](_0x5c6a('0x1b'),_0x5c6a('0x21'),path['extname'](_0x3f0067[_0x5c6a('0x15')])));}})});router[_0x5c6a('0x16')](_0x5c6a('0xe'),upload[_0x5c6a('0x18')]('file'),controller['addFavicon']);router['put'](_0x5c6a('0x9'),auth[_0x5c6a('0x22')](),controller[_0x5c6a('0x23')]);module[_0x5c6a('0x24')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1cf188b..c7c5440 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 _0xb388=['INTEGER','alternate','sequelize','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x5f555a,_0x23e1cd){var _0x400fef=function(_0x37ee3d){while(--_0x37ee3d){_0x5f555a['push'](_0x5f555a['shift']());}};_0x400fef(++_0x23e1cd);}(_0xb388,0x128));var _0x8b38=function(_0x44d113,_0xb0df39){_0x44d113=_0x44d113-0x0;var _0x1ac4fb=_0xb388[_0x44d113];return _0x1ac4fb;};'use strict';var Sequelize=require(_0x8b38('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8b38('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8b38('0x2')],'defaultValue':_0x8b38('0x3')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8b38('0x2')]},'defaultLoginLogo':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8b38('0x2')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x8b38('0x2')]},'turnpassword':{'type':Sequelize[_0x8b38('0x2')]},'pageTitle':{'type':Sequelize[_0x8b38('0x2')]},'defaultPageTitle':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8b38('0x5')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x8b38('0x2')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8b38('0x5')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8b38('0x2')],'defaultValue':_0x8b38('0x6')},'chatTimeout':{'type':Sequelize[_0x8b38('0x5')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8b38('0x2')]},'defaultPreferred':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8b38('0x2')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8b38('0x5')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x8b38('0x2')]},'defaultFavicon':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8b38('0x5')]},'transcribeRegion':{'type':Sequelize[_0x8b38('0x2')]},'sentiment':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8b38('0x5')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8b38('0x2')]},'bucket':{'type':Sequelize[_0x8b38('0x2')]},'googleSsoEnabled':{'type':Sequelize[_0x8b38('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1edb=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','STRING'];(function(_0x2b8f7e,_0x4d80c5){var _0x1e93b8=function(_0x5ba3db){while(--_0x5ba3db){_0x2b8f7e['push'](_0x2b8f7e['shift']());}};_0x1e93b8(++_0x4d80c5);}(_0x1edb,0xea));var _0xb1ed=function(_0x336387,_0x33a403){_0x336387=_0x336387-0x0;var _0xd54228=_0x1edb[_0x336387];return _0xd54228;};'use strict';var Sequelize=require(_0xb1ed('0x0'));module[_0xb1ed('0x1')]={'min_internal':{'type':Sequelize[_0xb1ed('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb1ed('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb1ed('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb1ed('0x3')],'defaultValue':_0xb1ed('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb1ed('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb1ed('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb1ed('0x3')]},'turnaddr':{'type':Sequelize[_0xb1ed('0x3')]},'turnusername':{'type':Sequelize[_0xb1ed('0x3')]},'turnpassword':{'type':Sequelize[_0xb1ed('0x3')]},'pageTitle':{'type':Sequelize[_0xb1ed('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb1ed('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb1ed('0x3')],'defaultValue':_0xb1ed('0x6')},'enableEmailPreview':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb1ed('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb1ed('0x3')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb1ed('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb1ed('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb1ed('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb1ed('0x2')]},'transcribeRegion':{'type':Sequelize[_0xb1ed('0x3')]},'sentiment':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb1ed('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb1ed('0x2')]},'sentimentRegion':{'type':Sequelize[_0xb1ed('0x3')]},'language':{'type':Sequelize[_0xb1ed('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xb1ed('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 bf87db4..5a50e1f 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 _0x1423=['status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','index','rawAttributes','type','query','keys','model','attributes','fields','length','sort','where','pick','filters','merge','map','VIRTUAL','options','Setting','count','includeAll','findAll','rows','params','intersection','include','find','body','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x1423,0x1b9));var _0x3142=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1423[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3142('0x0'));var emlformat=require(_0x3142('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3142('0x2'));var rp=require('request-promise');var moment=require(_0x3142('0x3'));var BPromise=require(_0x3142('0x4'));var Mustache=require(_0x3142('0x5'));var util=require(_0x3142('0x6'));var path=require(_0x3142('0x7'));var sox=require('sox');var csv=require(_0x3142('0x8'));var ejs=require(_0x3142('0x9'));var fs=require('fs');var _=require(_0x3142('0xa'));var squel=require(_0x3142('0xb'));var crypto=require(_0x3142('0xc'));var jsforce=require(_0x3142('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3142('0x8'));var querystring=require(_0x3142('0xe'));var Papa=require(_0x3142('0xf'));var Redis=require(_0x3142('0x10'));var authService=require(_0x3142('0x11'));var qs=require(_0x3142('0x12'));var as=require(_0x3142('0x13'));var hardwareService=require(_0x3142('0x14'));var logger=require(_0x3142('0x15'))(_0x3142('0x16'));var utils=require(_0x3142('0x17'));var config=require(_0x3142('0x18'));var db=require(_0x3142('0x19'))['db'];var jayson=require(_0x3142('0x1a'));var client=jayson[_0x3142('0x1b')][_0x3142('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x6e1b67,_0x4f9dd2,_0x2de194){if(_0x2de194){var _0x41236d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41236d[_0x3142('0x1d')](_0x4f9dd2)){return _0x6e1b67;}else{throw new db['Sequelize']['ValidationError'](_0x3142('0x1e'));}}else{return _0x6e1b67;}}function respondWithRpcPromise(_0xd51d5d,_0x25ed15,_0x243fec,_0x1085f3){return new BPromise(function(_0x196264,_0x4fe8bc){var _0x387ded=_0x1085f3||client;return _0x387ded['request'](_0xd51d5d,_0x243fec)['then'](function(_0x5af233){logger[_0x3142('0x1f')](_0x3142('0x20'),_0x25ed15,'request\x20sent');logger[_0x3142('0x21')](_0x3142('0x22'),_0x25ed15,_0x3142('0x23'),JSON[_0x3142('0x24')](_0x5af233));if(_0x5af233[_0x3142('0x25')]){if(_0x5af233[_0x3142('0x25')][_0x3142('0x26')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x25ed15,_0x5af233['error']['message']);return _0x4fe8bc(_0x5af233['error'][_0x3142('0x27')]);}logger[_0x3142('0x25')](_0x3142('0x20'),_0x25ed15,_0x5af233['error'][_0x3142('0x27')]);return _0x196264(_0x5af233[_0x3142('0x25')][_0x3142('0x27')]);}else{logger[_0x3142('0x1f')]('Setting,\x20%s,\x20%s',_0x25ed15,_0x3142('0x23'));_0x196264(_0x5af233[_0x3142('0x28')][_0x3142('0x27')]);}})[_0x3142('0x29')](function(_0x3fb6c1){logger[_0x3142('0x25')](_0x3142('0x20'),_0x25ed15,_0x3fb6c1);_0x4fe8bc(_0x3fb6c1);});});}function respondWithStatusCode(_0x99d1cc,_0x4388ea){_0x4388ea=_0x4388ea||0xcc;return function(_0x425934){if(_0x425934){return _0x99d1cc[_0x3142('0x2a')](_0x4388ea);}return _0x99d1cc[_0x3142('0x2b')](_0x4388ea)[_0x3142('0x2c')]();};}function respondWithResult(_0x221ac9,_0x35b3dd){_0x35b3dd=_0x35b3dd||0xc8;return function(_0x56274f){if(_0x56274f){return _0x221ac9['status'](_0x35b3dd)[_0x3142('0x2d')](_0x56274f);}};}function respondWithFilteredResult(_0x2dc573,_0x2ce71b){return function(_0x343333){if(_0x343333){var _0x47043b=_0x343333['count'],_0x663996=_0x2ce71b[_0x3142('0x2e')],_0x228ade=_0x2ce71b[_0x3142('0x2e')]+_0x2ce71b[_0x3142('0x2f')],_0x34d066;if(_0x228ade>=_0x47043b){_0x228ade=_0x47043b;_0x34d066=0xc8;}else{_0x34d066=0xce;}_0x2dc573[_0x3142('0x2b')](_0x34d066);return _0x2dc573[_0x3142('0x30')](_0x3142('0x31'),_0x663996+'-'+_0x228ade+'/'+_0x47043b)[_0x3142('0x2d')](_0x343333);}return null;};}function patchUpdates(_0x42fadc){return function(_0x55060c){try{jsonpatch['apply'](_0x55060c,_0x42fadc,!![]);}catch(_0x2e36ee){return BPromise[_0x3142('0x32')](_0x2e36ee);}return _0x55060c[_0x3142('0x33')]();};}function saveUpdates(_0x211324,_0xf67b96){return function(_0x4dd6b6){if(_0x4dd6b6){return _0x4dd6b6[_0x3142('0x34')](_0x211324)['then'](function(_0x4e364b){return _0x4e364b;});}return null;};}function removeEntity(_0x1b2c04,_0x3adb61){return function(_0x2172ef){if(_0x2172ef){return _0x2172ef[_0x3142('0x35')]()[_0x3142('0x36')](function(){_0x1b2c04[_0x3142('0x2b')](0xcc)[_0x3142('0x2c')]();});}};}function handleEntityNotFound(_0x450efb,_0x55528d){return function(_0x5e829c){if(!_0x5e829c){_0x450efb[_0x3142('0x2a')](0x194);}return _0x5e829c;};}function handleError(_0x96bb15,_0x55baf0){_0x55baf0=_0x55baf0||0x1f4;return function(_0x4bab4a){logger[_0x3142('0x25')](_0x4bab4a[_0x3142('0x37')]);if(_0x4bab4a[_0x3142('0x38')]){delete _0x4bab4a[_0x3142('0x38')];}_0x96bb15[_0x3142('0x2b')](_0x55baf0)['send'](_0x4bab4a);};}exports[_0x3142('0x39')]=function(_0x111b7c,_0x1a8a59){var _0x3e7c73={},_0x5d4a8b={},_0x1ab3c6={'count':0x0,'rows':[]};var _0x39f11a=_['map'](db['Setting'][_0x3142('0x3a')],function(_0x4ca0d2){return{'name':_0x4ca0d2['fieldName'],'type':_0x4ca0d2[_0x3142('0x3b')]['key']};});_0x5d4a8b['model']=_['map'](_0x39f11a,'name');_0x5d4a8b[_0x3142('0x3c')]=_[_0x3142('0x3d')](_0x111b7c['query']);_0x5d4a8b['filters']=_['intersection'](_0x5d4a8b[_0x3142('0x3e')],_0x5d4a8b[_0x3142('0x3c')]);_0x3e7c73[_0x3142('0x3f')]=_['intersection'](_0x5d4a8b[_0x3142('0x3e')],qs['fields'](_0x111b7c[_0x3142('0x3c')][_0x3142('0x40')]));_0x3e7c73[_0x3142('0x3f')]=_0x3e7c73[_0x3142('0x3f')][_0x3142('0x41')]?_0x3e7c73[_0x3142('0x3f')]:_0x5d4a8b['model'];if(!_0x111b7c[_0x3142('0x3c')]['hasOwnProperty']('nolimit')){_0x3e7c73[_0x3142('0x2f')]=qs[_0x3142('0x2f')](_0x111b7c[_0x3142('0x3c')]['limit']);_0x3e7c73[_0x3142('0x2e')]=qs[_0x3142('0x2e')](_0x111b7c[_0x3142('0x3c')][_0x3142('0x2e')]);}_0x3e7c73['order']=qs[_0x3142('0x42')](_0x111b7c[_0x3142('0x3c')][_0x3142('0x42')]);_0x3e7c73[_0x3142('0x43')]=qs['filters'](_[_0x3142('0x44')](_0x111b7c[_0x3142('0x3c')],_0x5d4a8b[_0x3142('0x45')]),_0x39f11a);if(_0x111b7c['query']['filter']){_0x3e7c73[_0x3142('0x43')]=_[_0x3142('0x46')](_0x3e7c73[_0x3142('0x43')],{'$or':_[_0x3142('0x47')](_0x39f11a,function(_0x59eb63){if(_0x59eb63['type']!==_0x3142('0x48')){var _0x359828={};_0x359828[_0x59eb63[_0x3142('0x38')]]={'$like':'%'+_0x111b7c['query']['filter']+'%'};return _0x359828;}})});}_0x3e7c73=_[_0x3142('0x46')]({},_0x3e7c73,_0x111b7c[_0x3142('0x49')]);var _0x65d4c0={'where':_0x3e7c73[_0x3142('0x43')]};return db[_0x3142('0x4a')][_0x3142('0x4b')](_0x65d4c0)[_0x3142('0x36')](function(_0x489641){_0x1ab3c6[_0x3142('0x4b')]=_0x489641;if(_0x111b7c[_0x3142('0x3c')][_0x3142('0x4c')]){_0x3e7c73['include']=[{'all':!![]}];}return db[_0x3142('0x4a')][_0x3142('0x4d')](_0x3e7c73);})[_0x3142('0x36')](function(_0xf2a36a){_0x1ab3c6[_0x3142('0x4e')]=_0xf2a36a;return _0x1ab3c6;})[_0x3142('0x36')](respondWithFilteredResult(_0x1a8a59,_0x3e7c73))[_0x3142('0x29')](handleError(_0x1a8a59,null));};exports['show']=function(_0x34bfa4,_0x56d2bc){var _0x28878d={'raw':![],'where':{'id':_0x34bfa4[_0x3142('0x4f')]['id']}},_0x2fc575={};_0x2fc575['model']=_[_0x3142('0x3d')](db['Setting'][_0x3142('0x3a')]);_0x2fc575[_0x3142('0x3c')]=_[_0x3142('0x3d')](_0x34bfa4[_0x3142('0x3c')]);_0x2fc575['filters']=_['intersection'](_0x2fc575['model'],_0x2fc575['query']);_0x28878d[_0x3142('0x3f')]=_[_0x3142('0x50')](_0x2fc575[_0x3142('0x3e')],qs[_0x3142('0x40')](_0x34bfa4[_0x3142('0x3c')][_0x3142('0x40')]));_0x28878d[_0x3142('0x3f')]=_0x28878d[_0x3142('0x3f')][_0x3142('0x41')]?_0x28878d[_0x3142('0x3f')]:_0x2fc575[_0x3142('0x3e')];if(_0x34bfa4[_0x3142('0x3c')][_0x3142('0x4c')]){_0x28878d[_0x3142('0x51')]=[{'all':!![]}];}_0x28878d=_['merge']({},_0x28878d,_0x34bfa4[_0x3142('0x49')]);return db[_0x3142('0x4a')][_0x3142('0x52')](_0x28878d)[_0x3142('0x36')](handleEntityNotFound(_0x56d2bc,null))[_0x3142('0x36')](respondWithResult(_0x56d2bc,null))[_0x3142('0x29')](handleError(_0x56d2bc,null));};exports[_0x3142('0x34')]=function(_0x46d70a,_0x73c742){if(_0x46d70a[_0x3142('0x53')]['id']){delete _0x46d70a[_0x3142('0x53')]['id'];}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x46d70a[_0x3142('0x4f')]['id']}})['then'](handleEntityNotFound(_0x73c742,null))[_0x3142('0x36')](saveUpdates(_0x46d70a['body'],null))[_0x3142('0x36')](respondWithResult(_0x73c742,null))[_0x3142('0x29')](handleError(_0x73c742,null));};exports['addLogo']=function(_0x391f1f,_0x1f9d41,_0x4581d6){if(_0x391f1f[_0x3142('0x54')]&&_0x391f1f[_0x3142('0x54')][_0x3142('0x55')]){_0x391f1f[_0x3142('0x53')][_0x3142('0x56')]=_0x391f1f['file'][_0x3142('0x55')];}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x391f1f[_0x3142('0x4f')]['id']}})[_0x3142('0x36')](handleEntityNotFound(_0x1f9d41,null))['then'](saveUpdates(_0x391f1f[_0x3142('0x53')],null))['then'](respondWithResult(_0x1f9d41,null))[_0x3142('0x29')](handleError(_0x1f9d41,null));};exports[_0x3142('0x57')]=function(_0x14bc95,_0x74150b,_0x188625){if(_0x14bc95[_0x3142('0x54')]&&_0x14bc95[_0x3142('0x54')][_0x3142('0x55')]){_0x14bc95[_0x3142('0x53')][_0x3142('0x58')]=_0x14bc95[_0x3142('0x54')][_0x3142('0x55')];}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x14bc95['params']['id']}})[_0x3142('0x36')](handleEntityNotFound(_0x74150b,null))[_0x3142('0x36')](saveUpdates(_0x14bc95[_0x3142('0x53')],null))[_0x3142('0x36')](respondWithResult(_0x74150b,null))['catch'](handleError(_0x74150b,null));};var utilLicense=require(_0x3142('0x59'));exports[_0x3142('0x5a')]=function(_0x3c372c,_0x24c9d0,_0x5a16c3){var _0x22d010='server/files/images/logos';var _0xd2fc8d={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xfc1bbb){if(_0xfc1bbb){_0xd2fc8d=_0xfc1bbb;}return db['Setting']['find']({'where':{'id':_0x3c372c['params']['id']},'attributes':[_0x3142('0x56'),_0x3142('0x58'),_0x3142('0x5b'),_0x3142('0x5c'),_0x3142('0x5d'),_0x3142('0x5e'),_0x3142('0x5f'),_0x3142('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x24c9d0,null))[_0x3142('0x36')](function(_0x29c08a){if(_0x29c08a){var _0x451a43=_0x29c08a[_0x3142('0x56')]&&fs[_0x3142('0x61')](path['join'](config[_0x3142('0x62')],_0x22d010,_[_0x3142('0x63')](_0x29c08a[_0x3142('0x56')])))?path[_0x3142('0x64')](config[_0x3142('0x62')],_0x22d010,_[_0x3142('0x63')](_0x29c08a[_0x3142('0x56')])):path[_0x3142('0x64')](config[_0x3142('0x62')],_0x22d010,_[_0x3142('0x63')](_0x3142('0x65')));var _0x33c19a=_0x3142('0x66')+_[_0x3142('0x67')]('logo');if(_0x29c08a[_0x33c19a]||!_0xd2fc8d[_0x3142('0x68')]){_0x451a43=path[_0x3142('0x64')](config[_0x3142('0x62')],_0x22d010,_[_0x3142('0x63')](_0x3142('0x65')));}if(!fs['existsSync'](_0x451a43)){throw new db[(_0x3142('0x69'))][(_0x3142('0x6a'))](_[_0x3142('0x67')]('logo')+_0x3142('0x6b'));}return _0x24c9d0[_0x3142('0x6c')](_0x451a43);}})[_0x3142('0x29')](handleError(_0x24c9d0,null));};var utilLicense=require(_0x3142('0x59'));exports[_0x3142('0x6d')]=function(_0x421712,_0xba467f,_0x30a7d6){var _0x51de04=_0x3142('0x6e');var _0x1eed98={'custom':![]};return utilLicense[_0x3142('0x6f')]()[_0x3142('0x36')](function(_0x3dd25e){if(_0x3dd25e){_0x1eed98=_0x3dd25e;}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x421712[_0x3142('0x4f')]['id']},'attributes':[_0x3142('0x56'),_0x3142('0x58'),_0x3142('0x5b'),'favicon',_0x3142('0x5d'),_0x3142('0x5e'),_0x3142('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x3142('0x36')](handleEntityNotFound(_0xba467f,null))['then'](function(_0x1b4978){if(_0x1b4978){var _0x5b1c0e=_0x1b4978[_0x3142('0x58')]&&fs['existsSync'](path[_0x3142('0x64')](config[_0x3142('0x62')],_0x51de04,_[_0x3142('0x63')](_0x1b4978[_0x3142('0x58')])))?path[_0x3142('0x64')](config[_0x3142('0x62')],_0x51de04,_[_0x3142('0x63')](_0x1b4978['loginLogo'])):path[_0x3142('0x64')](config[_0x3142('0x62')],_0x51de04,_[_0x3142('0x63')](_0x3142('0x70')));var _0x5ca2da=_0x3142('0x66')+_['upperFirst']('loginLogo');if(_0x1b4978[_0x5ca2da]||!_0x1eed98['custom']){_0x5b1c0e=path['join'](config[_0x3142('0x62')],_0x51de04,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x5b1c0e)){throw new db['Sequelize'][(_0x3142('0x6a'))](_[_0x3142('0x67')]('loginLogo')+_0x3142('0x6b'));}return _0xba467f['download'](_0x5b1c0e);}})[_0x3142('0x29')](handleError(_0xba467f,null));};exports[_0x3142('0x71')]=function(_0x19b3f6,_0x5bb4be){return db['Setting'][_0x3142('0x52')]({'where':{'id':_0x19b3f6[_0x3142('0x4f')]['id']},'attributes':[_0x3142('0x72')]})[_0x3142('0x36')](respondWithResult(_0x5bb4be,null))[_0x3142('0x29')](handleError(_0x5bb4be,null));};exports[_0x3142('0x73')]=function(_0x571cda,_0x2dd848,_0x285226){if(_0x571cda[_0x3142('0x54')]&&_0x571cda[_0x3142('0x54')][_0x3142('0x55')]){_0x571cda[_0x3142('0x53')][_0x3142('0x5b')]=_0x571cda[_0x3142('0x54')][_0x3142('0x55')];}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x571cda[_0x3142('0x4f')]['id']}})[_0x3142('0x36')](handleEntityNotFound(_0x2dd848,null))[_0x3142('0x36')](saveUpdates(_0x571cda[_0x3142('0x53')],null))[_0x3142('0x36')](respondWithResult(_0x2dd848,null))[_0x3142('0x29')](handleError(_0x2dd848,null));};var utilLicense=require(_0x3142('0x59'));exports[_0x3142('0x74')]=function(_0x41f262,_0x53d367,_0x56d497){var _0x57741d=_0x3142('0x6e');var _0x59a274={'custom':![]};return utilLicense[_0x3142('0x6f')]()[_0x3142('0x36')](function(_0x30fdf3){if(_0x30fdf3){_0x59a274=_0x30fdf3;}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x41f262[_0x3142('0x4f')]['id']},'attributes':[_0x3142('0x56'),'loginLogo',_0x3142('0x5b'),_0x3142('0x5c'),_0x3142('0x5d'),_0x3142('0x5e'),_0x3142('0x5f'),_0x3142('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x53d367,null))[_0x3142('0x36')](function(_0x4a231c){if(_0x4a231c){var _0x5f2133=_0x4a231c[_0x3142('0x5b')]&&fs[_0x3142('0x61')](path[_0x3142('0x64')](config[_0x3142('0x62')],_0x57741d,_['toLower'](_0x4a231c[_0x3142('0x5b')])))?path['join'](config[_0x3142('0x62')],_0x57741d,_['toLower'](_0x4a231c[_0x3142('0x5b')])):path[_0x3142('0x64')](config[_0x3142('0x62')],_0x57741d,_[_0x3142('0x63')](_0x3142('0x75')));var _0x11ba7f='default'+_[_0x3142('0x67')](_0x3142('0x5b'));if(_0x4a231c[_0x11ba7f]||!_0x59a274[_0x3142('0x68')]||!_0x59a274[_0x3142('0x5b')]){_0x5f2133=path[_0x3142('0x64')](config[_0x3142('0x62')],_0x57741d,_['toLower'](_0x3142('0x75')));}if(!fs[_0x3142('0x61')](_0x5f2133)){throw new db['Sequelize'][(_0x3142('0x6a'))](_[_0x3142('0x67')]('preferred')+_0x3142('0x6b'));}return _0x53d367['download'](_0x5f2133);}})['catch'](handleError(_0x53d367,null));};exports[_0x3142('0x76')]=function(_0x5d3e14,_0x329ef1,_0x52587a){if(_0x5d3e14[_0x3142('0x54')]&&_0x5d3e14[_0x3142('0x54')][_0x3142('0x55')]){_0x5d3e14[_0x3142('0x53')]['favicon']=_0x5d3e14[_0x3142('0x54')][_0x3142('0x55')];}return db[_0x3142('0x4a')][_0x3142('0x52')]({'where':{'id':_0x5d3e14['params']['id']}})['then'](handleEntityNotFound(_0x329ef1,null))[_0x3142('0x36')](saveUpdates(_0x5d3e14[_0x3142('0x53')],null))[_0x3142('0x36')](respondWithResult(_0x329ef1,null))[_0x3142('0x29')](handleError(_0x329ef1,null));};var utilLicense=require(_0x3142('0x59'));exports[_0x3142('0x77')]=function(_0x4a0e2e,_0xec153b,_0x108a6b){var _0x298c8a='server/files/images/logos';var _0x4ccd91={'custom':![]};return utilLicense['getLicense']()[_0x3142('0x36')](function(_0x20e908){if(_0x20e908){_0x4ccd91=_0x20e908;}return db['Setting'][_0x3142('0x52')]({'where':{'id':_0x4a0e2e[_0x3142('0x4f')]['id']},'attributes':[_0x3142('0x56'),'loginLogo','preferred','favicon',_0x3142('0x5d'),_0x3142('0x5e'),'defaultPreferred',_0x3142('0x60')],'raw':!![]});})[_0x3142('0x36')](handleEntityNotFound(_0xec153b,null))[_0x3142('0x36')](function(_0x10efb5){if(_0x10efb5){var _0x502d96=_0x10efb5[_0x3142('0x5c')]&&fs['existsSync'](path[_0x3142('0x64')](config[_0x3142('0x62')],_0x298c8a,_[_0x3142('0x63')](_0x10efb5[_0x3142('0x5c')])))?path[_0x3142('0x64')](config[_0x3142('0x62')],_0x298c8a,_['toLower'](_0x10efb5[_0x3142('0x5c')])):path['join'](config['root'],_0x298c8a,_[_0x3142('0x63')](_0x3142('0x78')));var _0x228cf7=_0x3142('0x66')+_[_0x3142('0x67')]('favicon');if(_0x10efb5[_0x228cf7]||!_0x4ccd91[_0x3142('0x68')]){_0x502d96=path['join'](config['root'],_0x298c8a,_[_0x3142('0x63')](_0x3142('0x78')));}if(!fs[_0x3142('0x61')](_0x502d96)){throw new db[(_0x3142('0x69'))][(_0x3142('0x6a'))](_[_0x3142('0x67')]('favicon')+'\x20not\x20found');}return _0xec153b[_0x3142('0x6c')](_0x502d96);}})[_0x3142('0x29')](handleError(_0xec153b,null));}; \ No newline at end of file +var _0xe4de=['includeAll','include','findAll','rows','catch','show','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','../../config/license/util','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','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~!@#$%^&-_=+[{]}.','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','map','Setting','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options'];(function(_0x5dad53,_0x58b3a3){var _0x20c847=function(_0x5b0400){while(--_0x5b0400){_0x5dad53['push'](_0x5dad53['shift']());}};_0x20c847(++_0x58b3a3);}(_0xe4de,0xa1));var _0xee4d=function(_0x17fdad,_0x368f25){_0x17fdad=_0x17fdad-0x0;var _0x20eb8c=_0xe4de[_0x17fdad];return _0x20eb8c;};'use strict';var pdf=require(_0xee4d('0x0'));var emlformat=require(_0xee4d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xee4d('0x2'));var jsonpatch=require(_0xee4d('0x3'));var rp=require(_0xee4d('0x4'));var moment=require('moment');var BPromise=require(_0xee4d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xee4d('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee4d('0x7'));var squel=require(_0xee4d('0x8'));var crypto=require(_0xee4d('0x9'));var jsforce=require(_0xee4d('0xa'));var deskjs=require(_0xee4d('0xb'));var toCsv=require(_0xee4d('0x6'));var querystring=require('querystring');var Papa=require(_0xee4d('0xc'));var Redis=require(_0xee4d('0xd'));var authService=require(_0xee4d('0xe'));var qs=require(_0xee4d('0xf'));var as=require(_0xee4d('0x10'));var hardwareService=require(_0xee4d('0x11'));var logger=require('../../config/logger')(_0xee4d('0x12'));var utils=require(_0xee4d('0x13'));var config=require(_0xee4d('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xee4d('0x15')][_0xee4d('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1a2879,_0xb3876,_0x3769cb){if(_0x3769cb){var _0x532825=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x532825['test'](_0xb3876)){return _0x1a2879;}else{throw new db['Sequelize'][(_0xee4d('0x17'))](_0xee4d('0x18'));}}else{return _0x1a2879;}}function respondWithRpcPromise(_0x31f77a,_0x15e7d2,_0x7c420a,_0x1dd24d){return new BPromise(function(_0x31ab12,_0x218ebd){var _0x3180ac=_0x1dd24d||client;return _0x3180ac['request'](_0x31f77a,_0x7c420a)[_0xee4d('0x19')](function(_0x38b753){logger['info'](_0xee4d('0x1a'),_0x15e7d2,_0xee4d('0x1b'));logger[_0xee4d('0x1c')](_0xee4d('0x1d'),_0x15e7d2,_0xee4d('0x1b'),JSON['stringify'](_0x38b753));if(_0x38b753[_0xee4d('0x1e')]){if(_0x38b753[_0xee4d('0x1e')]['code']===0x1f4){logger[_0xee4d('0x1e')]('Setting,\x20%s,\x20%s',_0x15e7d2,_0x38b753['error']['message']);return _0x218ebd(_0x38b753['error'][_0xee4d('0x1f')]);}logger[_0xee4d('0x1e')](_0xee4d('0x1a'),_0x15e7d2,_0x38b753[_0xee4d('0x1e')][_0xee4d('0x1f')]);return _0x31ab12(_0x38b753['error'][_0xee4d('0x1f')]);}else{logger[_0xee4d('0x20')](_0xee4d('0x1a'),_0x15e7d2,'request\x20sent');_0x31ab12(_0x38b753['result'][_0xee4d('0x1f')]);}})['catch'](function(_0x49e305){logger[_0xee4d('0x1e')](_0xee4d('0x1a'),_0x15e7d2,_0x49e305);_0x218ebd(_0x49e305);});});}function respondWithStatusCode(_0x5e546f,_0x4344d5){_0x4344d5=_0x4344d5||0xcc;return function(_0x51edef){if(_0x51edef){return _0x5e546f[_0xee4d('0x21')](_0x4344d5);}return _0x5e546f[_0xee4d('0x22')](_0x4344d5)[_0xee4d('0x23')]();};}function respondWithResult(_0x14a117,_0x515ff8){_0x515ff8=_0x515ff8||0xc8;return function(_0x4ad1ab){if(_0x4ad1ab){return _0x14a117[_0xee4d('0x22')](_0x515ff8)[_0xee4d('0x24')](_0x4ad1ab);}};}function respondWithFilteredResult(_0x10870d,_0x2bebaf){return function(_0x9790b9){if(_0x9790b9){var _0x247743=_0x9790b9[_0xee4d('0x25')],_0x3724bb=_0x2bebaf[_0xee4d('0x26')],_0x3c41e5=_0x2bebaf[_0xee4d('0x26')]+_0x2bebaf[_0xee4d('0x27')],_0x4b3c5d;if(_0x3c41e5>=_0x247743){_0x3c41e5=_0x247743;_0x4b3c5d=0xc8;}else{_0x4b3c5d=0xce;}_0x10870d['status'](_0x4b3c5d);return _0x10870d['set']('Content-Range',_0x3724bb+'-'+_0x3c41e5+'/'+_0x247743)[_0xee4d('0x24')](_0x9790b9);}return null;};}function patchUpdates(_0x4596a6){return function(_0x23af5b){try{jsonpatch[_0xee4d('0x28')](_0x23af5b,_0x4596a6,!![]);}catch(_0x597524){return BPromise[_0xee4d('0x29')](_0x597524);}return _0x23af5b[_0xee4d('0x2a')]();};}function saveUpdates(_0x148335,_0x1e2b16){return function(_0x2ad7e6){if(_0x2ad7e6){return _0x2ad7e6[_0xee4d('0x2b')](_0x148335)[_0xee4d('0x19')](function(_0x4fc1f3){return _0x4fc1f3;});}return null;};}function removeEntity(_0x4ebd7b,_0x4db185){return function(_0x2f7bd1){if(_0x2f7bd1){return _0x2f7bd1[_0xee4d('0x2c')]()['then'](function(){_0x4ebd7b[_0xee4d('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9853,_0x3e2954){return function(_0x3c0a9e){if(!_0x3c0a9e){_0x1b9853['sendStatus'](0x194);}return _0x3c0a9e;};}function handleError(_0x44cefa,_0x40f0ed){_0x40f0ed=_0x40f0ed||0x1f4;return function(_0xf0544e){logger[_0xee4d('0x1e')](_0xf0544e[_0xee4d('0x2d')]);if(_0xf0544e[_0xee4d('0x2e')]){delete _0xf0544e[_0xee4d('0x2e')];}_0x44cefa['status'](_0x40f0ed)['send'](_0xf0544e);};}exports['index']=function(_0x177ec5,_0x59d20b){var _0x34513b={},_0x383798={},_0x4102ca={'count':0x0,'rows':[]};var _0x2104ac=_[_0xee4d('0x2f')](db[_0xee4d('0x30')][_0xee4d('0x31')],function(_0xecb840){return{'name':_0xecb840['fieldName'],'type':_0xecb840[_0xee4d('0x32')][_0xee4d('0x33')]};});_0x383798[_0xee4d('0x34')]=_[_0xee4d('0x2f')](_0x2104ac,_0xee4d('0x2e'));_0x383798[_0xee4d('0x35')]=_['keys'](_0x177ec5[_0xee4d('0x35')]);_0x383798[_0xee4d('0x36')]=_[_0xee4d('0x37')](_0x383798[_0xee4d('0x34')],_0x383798[_0xee4d('0x35')]);_0x34513b[_0xee4d('0x38')]=_['intersection'](_0x383798[_0xee4d('0x34')],qs['fields'](_0x177ec5[_0xee4d('0x35')][_0xee4d('0x39')]));_0x34513b[_0xee4d('0x38')]=_0x34513b[_0xee4d('0x38')][_0xee4d('0x3a')]?_0x34513b['attributes']:_0x383798[_0xee4d('0x34')];if(!_0x177ec5[_0xee4d('0x35')][_0xee4d('0x3b')](_0xee4d('0x3c'))){_0x34513b[_0xee4d('0x27')]=qs['limit'](_0x177ec5[_0xee4d('0x35')][_0xee4d('0x27')]);_0x34513b[_0xee4d('0x26')]=qs[_0xee4d('0x26')](_0x177ec5[_0xee4d('0x35')]['offset']);}_0x34513b[_0xee4d('0x3d')]=qs[_0xee4d('0x3e')](_0x177ec5[_0xee4d('0x35')]['sort']);_0x34513b[_0xee4d('0x3f')]=qs[_0xee4d('0x36')](_[_0xee4d('0x40')](_0x177ec5[_0xee4d('0x35')],_0x383798[_0xee4d('0x36')]),_0x2104ac);if(_0x177ec5[_0xee4d('0x35')]['filter']){_0x34513b[_0xee4d('0x3f')]=_[_0xee4d('0x41')](_0x34513b[_0xee4d('0x3f')],{'$or':_[_0xee4d('0x2f')](_0x2104ac,function(_0x61f26a){if(_0x61f26a[_0xee4d('0x32')]!=='VIRTUAL'){var _0x35f284={};_0x35f284[_0x61f26a['name']]={'$like':'%'+_0x177ec5['query']['filter']+'%'};return _0x35f284;}})});}_0x34513b=_[_0xee4d('0x41')]({},_0x34513b,_0x177ec5[_0xee4d('0x42')]);var _0x24b7e4={'where':_0x34513b['where']};return db['Setting'][_0xee4d('0x25')](_0x24b7e4)[_0xee4d('0x19')](function(_0x471d2b){_0x4102ca[_0xee4d('0x25')]=_0x471d2b;if(_0x177ec5[_0xee4d('0x35')][_0xee4d('0x43')]){_0x34513b[_0xee4d('0x44')]=[{'all':!![]}];}return db['Setting'][_0xee4d('0x45')](_0x34513b);})['then'](function(_0x1f8443){_0x4102ca[_0xee4d('0x46')]=_0x1f8443;return _0x4102ca;})[_0xee4d('0x19')](respondWithFilteredResult(_0x59d20b,_0x34513b))[_0xee4d('0x47')](handleError(_0x59d20b,null));};exports[_0xee4d('0x48')]=function(_0x155fc0,_0x4e759e){var _0x150f04={'raw':![],'where':{'id':_0x155fc0[_0xee4d('0x49')]['id']}},_0x198812={};_0x198812[_0xee4d('0x34')]=_[_0xee4d('0x4a')](db[_0xee4d('0x30')][_0xee4d('0x31')]);_0x198812[_0xee4d('0x35')]=_['keys'](_0x155fc0['query']);_0x198812[_0xee4d('0x36')]=_[_0xee4d('0x37')](_0x198812['model'],_0x198812[_0xee4d('0x35')]);_0x150f04[_0xee4d('0x38')]=_['intersection'](_0x198812[_0xee4d('0x34')],qs[_0xee4d('0x39')](_0x155fc0['query'][_0xee4d('0x39')]));_0x150f04[_0xee4d('0x38')]=_0x150f04[_0xee4d('0x38')][_0xee4d('0x3a')]?_0x150f04[_0xee4d('0x38')]:_0x198812[_0xee4d('0x34')];if(_0x155fc0[_0xee4d('0x35')][_0xee4d('0x43')]){_0x150f04[_0xee4d('0x44')]=[{'all':!![]}];}_0x150f04=_[_0xee4d('0x41')]({},_0x150f04,_0x155fc0['options']);return db[_0xee4d('0x30')][_0xee4d('0x4b')](_0x150f04)[_0xee4d('0x19')](handleEntityNotFound(_0x4e759e,null))[_0xee4d('0x19')](respondWithResult(_0x4e759e,null))[_0xee4d('0x47')](handleError(_0x4e759e,null));};exports['update']=function(_0x32867b,_0xe9862a){if(_0x32867b['body']['id']){delete _0x32867b[_0xee4d('0x4c')]['id'];}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x32867b[_0xee4d('0x49')]['id']}})[_0xee4d('0x19')](handleEntityNotFound(_0xe9862a,null))[_0xee4d('0x19')](saveUpdates(_0x32867b[_0xee4d('0x4c')],null))[_0xee4d('0x19')](respondWithResult(_0xe9862a,null))[_0xee4d('0x47')](handleError(_0xe9862a,null));};exports[_0xee4d('0x4d')]=function(_0x3f2ade,_0x110cad,_0x118316){if(_0x3f2ade[_0xee4d('0x4e')]&&_0x3f2ade[_0xee4d('0x4e')][_0xee4d('0x4f')]){_0x3f2ade[_0xee4d('0x4c')][_0xee4d('0x50')]=_0x3f2ade[_0xee4d('0x4e')]['filename'];}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x3f2ade['params']['id']}})[_0xee4d('0x19')](handleEntityNotFound(_0x110cad,null))[_0xee4d('0x19')](saveUpdates(_0x3f2ade['body'],null))[_0xee4d('0x19')](respondWithResult(_0x110cad,null))[_0xee4d('0x47')](handleError(_0x110cad,null));};exports[_0xee4d('0x51')]=function(_0x478934,_0xcc035c,_0x41a0bc){if(_0x478934[_0xee4d('0x4e')]&&_0x478934['file']['filename']){_0x478934['body'][_0xee4d('0x52')]=_0x478934[_0xee4d('0x4e')][_0xee4d('0x4f')];}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x478934[_0xee4d('0x49')]['id']}})[_0xee4d('0x19')](handleEntityNotFound(_0xcc035c,null))[_0xee4d('0x19')](saveUpdates(_0x478934['body'],null))[_0xee4d('0x19')](respondWithResult(_0xcc035c,null))[_0xee4d('0x47')](handleError(_0xcc035c,null));};var utilLicense=require('../../config/license/util');exports[_0xee4d('0x53')]=function(_0x345f66,_0x23ac39,_0x376173){var _0x17cd3c=_0xee4d('0x54');var _0x4b457f={'custom':![]};return utilLicense[_0xee4d('0x55')]()[_0xee4d('0x19')](function(_0x508aa7){if(_0x508aa7){_0x4b457f=_0x508aa7;}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x345f66[_0xee4d('0x49')]['id']},'attributes':[_0xee4d('0x50'),_0xee4d('0x52'),_0xee4d('0x56'),_0xee4d('0x57'),_0xee4d('0x58'),'defaultLoginLogo',_0xee4d('0x59'),_0xee4d('0x5a')],'raw':!![]});})[_0xee4d('0x19')](handleEntityNotFound(_0x23ac39,null))['then'](function(_0x68b384){if(_0x68b384){var _0x17db18=_0x68b384[_0xee4d('0x50')]&&fs[_0xee4d('0x5b')](path[_0xee4d('0x5c')](config['root'],_0x17cd3c,_[_0xee4d('0x5d')](_0x68b384[_0xee4d('0x50')])))?path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x17cd3c,_[_0xee4d('0x5d')](_0x68b384[_0xee4d('0x50')])):path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x17cd3c,_[_0xee4d('0x5d')](_0xee4d('0x5f')));var _0x55279c=_0xee4d('0x60')+_[_0xee4d('0x61')](_0xee4d('0x50'));if(_0x68b384[_0x55279c]||!_0x4b457f[_0xee4d('0x62')]){_0x17db18=path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x17cd3c,_[_0xee4d('0x5d')]('default_logo.svg'));}if(!fs[_0xee4d('0x5b')](_0x17db18)){throw new db[(_0xee4d('0x63'))]['ValidationError'](_[_0xee4d('0x61')](_0xee4d('0x50'))+_0xee4d('0x64'));}return _0x23ac39[_0xee4d('0x65')](_0x17db18);}})['catch'](handleError(_0x23ac39,null));};var utilLicense=require(_0xee4d('0x66'));exports[_0xee4d('0x67')]=function(_0x1aa6d1,_0x21c035,_0x2a4207){var _0x1e3a47=_0xee4d('0x54');var _0x1f5546={'custom':![]};return utilLicense[_0xee4d('0x55')]()['then'](function(_0x201b13){if(_0x201b13){_0x1f5546=_0x201b13;}return db[_0xee4d('0x30')]['find']({'where':{'id':_0x1aa6d1['params']['id']},'attributes':['logo',_0xee4d('0x52'),_0xee4d('0x56'),_0xee4d('0x57'),_0xee4d('0x58'),_0xee4d('0x68'),_0xee4d('0x59'),_0xee4d('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x21c035,null))[_0xee4d('0x19')](function(_0x57d236){if(_0x57d236){var _0x4fc0d5=_0x57d236[_0xee4d('0x52')]&&fs[_0xee4d('0x5b')](path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x1e3a47,_[_0xee4d('0x5d')](_0x57d236[_0xee4d('0x52')])))?path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x1e3a47,_[_0xee4d('0x5d')](_0x57d236[_0xee4d('0x52')])):path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x1e3a47,_['toLower'](_0xee4d('0x69')));var _0x4d262a='default'+_['upperFirst'](_0xee4d('0x52'));if(_0x57d236[_0x4d262a]||!_0x1f5546[_0xee4d('0x62')]){_0x4fc0d5=path[_0xee4d('0x5c')](config['root'],_0x1e3a47,_['toLower'](_0xee4d('0x69')));}if(!fs[_0xee4d('0x5b')](_0x4fc0d5)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0xee4d('0x52'))+_0xee4d('0x64'));}return _0x21c035[_0xee4d('0x65')](_0x4fc0d5);}})[_0xee4d('0x47')](handleError(_0x21c035,null));};exports[_0xee4d('0x6a')]=function(_0x3800c0,_0x4721b0){return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x3800c0['params']['id']},'attributes':[_0xee4d('0x6b')]})[_0xee4d('0x19')](respondWithResult(_0x4721b0,null))[_0xee4d('0x47')](handleError(_0x4721b0,null));};exports[_0xee4d('0x6c')]=function(_0x5b071b,_0x168fc3,_0x13e642){if(_0x5b071b['file']&&_0x5b071b[_0xee4d('0x4e')][_0xee4d('0x4f')]){_0x5b071b[_0xee4d('0x4c')]['preferred']=_0x5b071b[_0xee4d('0x4e')][_0xee4d('0x4f')];}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x5b071b[_0xee4d('0x49')]['id']}})[_0xee4d('0x19')](handleEntityNotFound(_0x168fc3,null))[_0xee4d('0x19')](saveUpdates(_0x5b071b['body'],null))[_0xee4d('0x19')](respondWithResult(_0x168fc3,null))['catch'](handleError(_0x168fc3,null));};var utilLicense=require(_0xee4d('0x66'));exports[_0xee4d('0x6d')]=function(_0xae4b61,_0x3057a4,_0x595e10){var _0x4e5a11=_0xee4d('0x54');var _0x1dd5ae={'custom':![]};return utilLicense[_0xee4d('0x55')]()[_0xee4d('0x19')](function(_0x3aea89){if(_0x3aea89){_0x1dd5ae=_0x3aea89;}return db[_0xee4d('0x30')]['find']({'where':{'id':_0xae4b61[_0xee4d('0x49')]['id']},'attributes':[_0xee4d('0x50'),_0xee4d('0x52'),_0xee4d('0x56'),_0xee4d('0x57'),_0xee4d('0x58'),_0xee4d('0x68'),_0xee4d('0x59'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3057a4,null))[_0xee4d('0x19')](function(_0xe6e396){if(_0xe6e396){var _0x532630=_0xe6e396['preferred']&&fs['existsSync'](path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x4e5a11,_[_0xee4d('0x5d')](_0xe6e396[_0xee4d('0x56')])))?path['join'](config[_0xee4d('0x5e')],_0x4e5a11,_[_0xee4d('0x5d')](_0xe6e396[_0xee4d('0x56')])):path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x4e5a11,_[_0xee4d('0x5d')](_0xee4d('0x6e')));var _0x92a279=_0xee4d('0x60')+_[_0xee4d('0x61')](_0xee4d('0x56'));if(_0xe6e396[_0x92a279]||!_0x1dd5ae[_0xee4d('0x62')]||!_0x1dd5ae[_0xee4d('0x56')]){_0x532630=path[_0xee4d('0x5c')](config['root'],_0x4e5a11,_[_0xee4d('0x5d')](_0xee4d('0x6e')));}if(!fs[_0xee4d('0x5b')](_0x532630)){throw new db['Sequelize'][(_0xee4d('0x17'))](_[_0xee4d('0x61')](_0xee4d('0x56'))+_0xee4d('0x64'));}return _0x3057a4[_0xee4d('0x65')](_0x532630);}})[_0xee4d('0x47')](handleError(_0x3057a4,null));};exports[_0xee4d('0x6f')]=function(_0x578f47,_0x50ea11,_0x2aec68){if(_0x578f47['file']&&_0x578f47[_0xee4d('0x4e')][_0xee4d('0x4f')]){_0x578f47[_0xee4d('0x4c')][_0xee4d('0x57')]=_0x578f47[_0xee4d('0x4e')][_0xee4d('0x4f')];}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x578f47[_0xee4d('0x49')]['id']}})[_0xee4d('0x19')](handleEntityNotFound(_0x50ea11,null))[_0xee4d('0x19')](saveUpdates(_0x578f47['body'],null))[_0xee4d('0x19')](respondWithResult(_0x50ea11,null))[_0xee4d('0x47')](handleError(_0x50ea11,null));};var utilLicense=require('../../config/license/util');exports[_0xee4d('0x70')]=function(_0x1c31ba,_0x3c829b,_0x338396){var _0x3df31a=_0xee4d('0x54');var _0x581ca6={'custom':![]};return utilLicense['getLicense']()[_0xee4d('0x19')](function(_0x28fb41){if(_0x28fb41){_0x581ca6=_0x28fb41;}return db[_0xee4d('0x30')][_0xee4d('0x4b')]({'where':{'id':_0x1c31ba[_0xee4d('0x49')]['id']},'attributes':[_0xee4d('0x50'),_0xee4d('0x52'),'preferred',_0xee4d('0x57'),'defaultLogo','defaultLoginLogo',_0xee4d('0x59'),_0xee4d('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x3c829b,null))['then'](function(_0x18b739){if(_0x18b739){var _0x4d2af6=_0x18b739[_0xee4d('0x57')]&&fs[_0xee4d('0x5b')](path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x3df31a,_[_0xee4d('0x5d')](_0x18b739[_0xee4d('0x57')])))?path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x3df31a,_[_0xee4d('0x5d')](_0x18b739[_0xee4d('0x57')])):path['join'](config['root'],_0x3df31a,_[_0xee4d('0x5d')](_0xee4d('0x71')));var _0xc731c3=_0xee4d('0x60')+_[_0xee4d('0x61')](_0xee4d('0x57'));if(_0x18b739[_0xc731c3]||!_0x581ca6['custom']){_0x4d2af6=path[_0xee4d('0x5c')](config[_0xee4d('0x5e')],_0x3df31a,_[_0xee4d('0x5d')](_0xee4d('0x71')));}if(!fs[_0xee4d('0x5b')](_0x4d2af6)){throw new db[(_0xee4d('0x63'))][(_0xee4d('0x17'))](_[_0xee4d('0x61')](_0xee4d('0x57'))+'\x20not\x20found');}return _0x3c829b[_0xee4d('0x65')](_0x4d2af6);}})[_0xee4d('0x47')](handleError(_0x3c829b,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5507ce9..cb7b46e 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 _0x3f34=['./setting.attributes','exports','define','Setting','settings','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe72729,_0x503951){var _0x3f679b=function(_0x58939f){while(--_0x58939f){_0xe72729['push'](_0xe72729['shift']());}};_0x3f679b(++_0x503951);}(_0x3f34,0xe2));var _0x43f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x43f3('0x0'));var util=require(_0x43f3('0x1'));var logger=require('../../config/logger')(_0x43f3('0x2'));var moment=require(_0x43f3('0x3'));var BPromise=require('bluebird');var rp=require(_0x43f3('0x4'));var fs=require('fs');var path=require(_0x43f3('0x5'));var rimraf=require(_0x43f3('0x6'));var config=require(_0x43f3('0x7'));var attributes=require(_0x43f3('0x8'));module[_0x43f3('0x9')]=function(_0x551550,_0x54954f){return _0x551550[_0x43f3('0xa')](_0x43f3('0xb'),attributes,{'tableName':_0x43f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d1c=['exports','Setting','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x510de5,_0x1ac5d6){var _0x48df9e=function(_0x51b4a9){while(--_0x51b4a9){_0x510de5['push'](_0x510de5['shift']());}};_0x48df9e(++_0x1ac5d6);}(_0x3d1c,0x183));var _0xc3d1=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x3d1c[_0x277107];return _0x1da046;};'use strict';var _=require(_0xc3d1('0x0'));var util=require('util');var logger=require(_0xc3d1('0x1'))(_0xc3d1('0x2'));var moment=require(_0xc3d1('0x3'));var BPromise=require(_0xc3d1('0x4'));var rp=require(_0xc3d1('0x5'));var fs=require('fs');var path=require(_0xc3d1('0x6'));var rimraf=require(_0xc3d1('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3d1('0x8'));module[_0xc3d1('0x9')]=function(_0x31e697,_0x35f5c3){return _0x31e697['define'](_0xc3d1('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5e09b50..1bbbcf5 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 _0x6108=['info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xbe4ab0,_0x5237e8){var _0x5bb592=function(_0x11fa0d){while(--_0x11fa0d){_0xbe4ab0['push'](_0xbe4ab0['shift']());}};_0x5bb592(++_0x5237e8);}(_0x6108,0x183));var _0x8610=function(_0x1f3b9c,_0x5b60cd){_0x1f3b9c=_0x1f3b9c-0x0;var _0x20df90=_0x6108[_0x1f3b9c];return _0x20df90;};'use strict';var _=require('lodash');var util=require(_0x8610('0x0'));var moment=require('moment');var BPromise=require(_0x8610('0x1'));var rs=require(_0x8610('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8610('0x3'))['db'];var utils=require(_0x8610('0x4'));var logger=require(_0x8610('0x5'))(_0x8610('0x6'));var config=require(_0x8610('0x7'));var jayson=require(_0x8610('0x8'));var client=jayson[_0x8610('0x9')][_0x8610('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a0d34,_0x5c3dbf,_0x14b52d){return new BPromise(function(_0x2db290,_0x9f8aa9){return client[_0x8610('0xb')](_0x4a0d34,_0x14b52d)['then'](function(_0x44796f){logger[_0x8610('0xc')]('Setting,\x20%s,\x20%s',_0x5c3dbf,_0x8610('0xd'));logger[_0x8610('0xe')](_0x8610('0xf'),_0x5c3dbf,'request\x20sent',JSON[_0x8610('0x10')](_0x44796f));if(_0x44796f[_0x8610('0x11')]){if(_0x44796f[_0x8610('0x11')][_0x8610('0x12')]===0x1f4){logger[_0x8610('0x11')](_0x8610('0x13'),_0x5c3dbf,_0x44796f['error'][_0x8610('0x14')]);return _0x9f8aa9(_0x44796f[_0x8610('0x11')][_0x8610('0x14')]);}logger[_0x8610('0x11')](_0x8610('0x13'),_0x5c3dbf,_0x44796f[_0x8610('0x11')][_0x8610('0x14')]);return _0x2db290(_0x44796f[_0x8610('0x11')]['message']);}else{logger['info'](_0x8610('0x13'),_0x5c3dbf,_0x8610('0xd'));_0x2db290(_0x44796f['result'][_0x8610('0x14')]);}})['catch'](function(_0x10ec5f){logger[_0x8610('0x11')](_0x8610('0x13'),_0x5c3dbf,_0x10ec5f);_0x9f8aa9(_0x10ec5f);});});} \ No newline at end of file +var _0x0661=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2c4f39,_0x5f5b59){var _0x26f72d=function(_0x206991){while(--_0x206991){_0x2c4f39['push'](_0x2c4f39['shift']());}};_0x26f72d(++_0x5f5b59);}(_0x0661,0x140));var _0x1066=function(_0x11f1f4,_0x189cf3){_0x11f1f4=_0x11f1f4-0x0;var _0x6d3dec=_0x0661[_0x11f1f4];return _0x6d3dec;};'use strict';var _=require(_0x1066('0x0'));var util=require(_0x1066('0x1'));var moment=require(_0x1066('0x2'));var BPromise=require(_0x1066('0x3'));var rs=require(_0x1066('0x4'));var fs=require('fs');var Redis=require(_0x1066('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1066('0x6'));var logger=require(_0x1066('0x7'))(_0x1066('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1066('0x9')][_0x1066('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9a1784,_0x8c12a1,_0x219bb6){return new BPromise(function(_0x5085e6,_0x336226){return client[_0x1066('0xb')](_0x9a1784,_0x219bb6)[_0x1066('0xc')](function(_0x165e90){logger[_0x1066('0xd')](_0x1066('0xe'),_0x8c12a1,'request\x20sent');logger['debug'](_0x1066('0xf'),_0x8c12a1,_0x1066('0x10'),JSON[_0x1066('0x11')](_0x165e90));if(_0x165e90['error']){if(_0x165e90[_0x1066('0x12')][_0x1066('0x13')]===0x1f4){logger['error'](_0x1066('0xe'),_0x8c12a1,_0x165e90[_0x1066('0x12')][_0x1066('0x14')]);return _0x336226(_0x165e90['error'][_0x1066('0x14')]);}logger[_0x1066('0x12')](_0x1066('0xe'),_0x8c12a1,_0x165e90[_0x1066('0x12')]['message']);return _0x5085e6(_0x165e90['error'][_0x1066('0x14')]);}else{logger[_0x1066('0xd')](_0x1066('0xe'),_0x8c12a1,'request\x20sent');_0x5085e6(_0x165e90[_0x1066('0x15')][_0x1066('0x14')]);}})[_0x1066('0x16')](function(_0x590191){logger['error']('Setting,\x20%s,\x20%s',_0x8c12a1,_0x590191);_0x336226(_0x590191);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e9a3c43..1bf325c 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 _0xf109=['getAgents','post','create','/:id/dispositions','addDisposition','addApplications','send','status','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','statusGet'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf109,0x76));var _0x9f10=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf109[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0x9f10('0x0'));var util=require('util');var path=require(_0x9f10('0x1'));var timeout=require(_0x9f10('0x2'));var express=require(_0x9f10('0x3'));var router=express[_0x9f10('0x4')]();var auth=require(_0x9f10('0x5'));var interaction=require(_0x9f10('0x6'));var config=require('../../config/environment');var controller=require('./smsAccount.controller');router['get']('/',auth[_0x9f10('0x7')](),controller[_0x9f10('0x8')]);router['get']('/describe',auth[_0x9f10('0x7')](),controller['describe']);router[_0x9f10('0x9')](_0x9f10('0xa'),auth[_0x9f10('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0x9f10('0x7')](),controller['getDispositions']);router[_0x9f10('0x9')](_0x9f10('0xb'),auth[_0x9f10('0x7')](),controller[_0x9f10('0xc')]);router[_0x9f10('0x9')](_0x9f10('0xd'),auth['isAuthenticated'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router['get'](_0x9f10('0x10'),controller[_0x9f10('0x11')]);router[_0x9f10('0x9')]('/:id/users',auth[_0x9f10('0x7')](),controller[_0x9f10('0x12')]);router[_0x9f10('0x13')]('/',auth['isAuthenticated'](),controller[_0x9f10('0x14')]);router[_0x9f10('0x13')](_0x9f10('0x15'),auth['isAuthenticated'](),controller[_0x9f10('0x16')]);router[_0x9f10('0x13')]('/:id/canned_answers',auth[_0x9f10('0x7')](),controller['addAnswer']);router[_0x9f10('0x13')]('/:id/notify',controller['notify']);router['post'](_0x9f10('0xd'),auth[_0x9f10('0x7')](),controller[_0x9f10('0x17')]);router[_0x9f10('0x13')]('/:id/send',auth[_0x9f10('0x7')](),controller[_0x9f10('0x18')]);router[_0x9f10('0x13')](_0x9f10('0x10'),controller[_0x9f10('0x19')]);router[_0x9f10('0x13')](_0x9f10('0x1a'),auth[_0x9f10('0x7')](),controller[_0x9f10('0x1b')]);router[_0x9f10('0x1c')]('/:id',auth[_0x9f10('0x7')](),controller[_0x9f10('0x1d')]);router[_0x9f10('0x1e')](_0x9f10('0xa'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x9f10('0x7')](),controller[_0x9f10('0x1f')]);router[_0x9f10('0x1e')]('/:id/canned_answers',auth[_0x9f10('0x7')](),controller[_0x9f10('0x20')]);router[_0x9f10('0x1e')](_0x9f10('0x1a'),auth[_0x9f10('0x7')](),controller[_0x9f10('0x21')]);module['exports']=router; \ No newline at end of file +var _0x4469=['removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','destroy'];(function(_0x23b59f,_0x4c1c2e){var _0x44c32a=function(_0x3b9b2d){while(--_0x3b9b2d){_0x23b59f['push'](_0x23b59f['shift']());}};_0x44c32a(++_0x4c1c2e);}(_0x4469,0x9b));var _0x9446=function(_0x2d3966,_0x4caeaa){_0x2d3966=_0x2d3966-0x0;var _0x395455=_0x4469[_0x2d3966];return _0x395455;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9446('0x0'));var timeout=require(_0x9446('0x1'));var express=require(_0x9446('0x2'));var router=express[_0x9446('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9446('0x4'));var controller=require(_0x9446('0x5'));router[_0x9446('0x6')]('/',auth['isAuthenticated'](),controller[_0x9446('0x7')]);router['get'](_0x9446('0x8'),auth[_0x9446('0x9')](),controller[_0x9446('0xa')]);router['get'](_0x9446('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9446('0x6')](_0x9446('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x9446('0x9')](),controller[_0x9446('0xd')]);router[_0x9446('0x6')](_0x9446('0xe'),auth[_0x9446('0x9')](),controller[_0x9446('0xf')]);router[_0x9446('0x6')](_0x9446('0x10'),auth[_0x9446('0x9')](),controller[_0x9446('0x11')]);router[_0x9446('0x6')](_0x9446('0x12'),controller[_0x9446('0x13')]);router[_0x9446('0x6')](_0x9446('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9446('0x15')]('/',auth[_0x9446('0x9')](),controller[_0x9446('0x16')]);router[_0x9446('0x15')](_0x9446('0xc'),auth[_0x9446('0x9')](),controller['addDisposition']);router[_0x9446('0x15')](_0x9446('0x17'),auth[_0x9446('0x9')](),controller[_0x9446('0x18')]);router[_0x9446('0x15')](_0x9446('0x19'),controller[_0x9446('0x1a')]);router[_0x9446('0x15')](_0x9446('0xe'),auth[_0x9446('0x9')](),controller[_0x9446('0x1b')]);router[_0x9446('0x15')]('/:id/send',auth[_0x9446('0x9')](),controller[_0x9446('0x1c')]);router['post'](_0x9446('0x12'),controller[_0x9446('0x1d')]);router[_0x9446('0x15')](_0x9446('0x14'),auth['isAuthenticated'](),controller[_0x9446('0x1e')]);router[_0x9446('0x1f')](_0x9446('0xb'),auth[_0x9446('0x9')](),controller[_0x9446('0x20')]);router[_0x9446('0x21')](_0x9446('0xb'),auth[_0x9446('0x9')](),controller[_0x9446('0x22')]);router[_0x9446('0x21')](_0x9446('0xc'),auth[_0x9446('0x9')](),controller['removeDispositions']);router[_0x9446('0x21')](_0x9446('0x17'),auth[_0x9446('0x9')](),controller[_0x9446('0x23')]);router[_0x9446('0x21')](_0x9446('0x14'),auth[_0x9446('0x9')](),controller[_0x9446('0x24')]);module[_0x9446('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 589ec35..bd8679f 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 _0x0588=['generate','ENUM','clickatell','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name'];(function(_0x211513,_0xd3a632){var _0x72ff0=function(_0xe2094b){while(--_0xe2094b){_0x211513['push'](_0x211513['shift']());}};_0x72ff0(++_0xd3a632);}(_0x0588,0x15c));var _0x8058=function(_0x424583,_0x46152a){_0x424583=_0x424583-0x0;var _0x272727=_0x0588[_0x424583];return _0x272727;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8058('0x0'));module[_0x8058('0x1')]={'name':{'type':Sequelize[_0x8058('0x2')],'unique':_0x8058('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8058('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x8058('0x2')],'defaultValue':function(){return rs[_0x8058('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8058('0x5')]('twilio','skebby','connectel','clicksend','plivo',_0x8058('0x6'),'csc',_0x8058('0x7'),_0x8058('0x8'))},'accountSid':{'type':Sequelize[_0x8058('0x2')]},'authId':{'type':Sequelize[_0x8058('0x2')]},'authToken':{'type':Sequelize[_0x8058('0x2')]},'smsMethod':{'type':Sequelize[_0x8058('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8058('0x2')]},'apiKey':{'type':Sequelize[_0x8058('0x2')]},'senderString':{'type':Sequelize[_0x8058('0x2')]},'deliveryReport':{'type':Sequelize[_0x8058('0x9')],'defaultValue':![]},'description':{'type':Sequelize[_0x8058('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8058('0xa')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8058('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8058('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8058('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8058('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8058('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8058('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8058('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8058('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8058('0xc'),'set':function(_0x465df9){if(!_0x465df9)this[_0x8058('0xd')](_0x8058('0xe'),null);this['setDataValue'](_0x8058('0xf'),_0x465df9);}}}; \ No newline at end of file +var _0x6302=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x6302,0xb2));var _0x2630=function(_0x53ea3b,_0x10587b){_0x53ea3b=_0x53ea3b-0x0;var _0x16f4da=_0x6302[_0x53ea3b];return _0x16f4da;};'use strict';var Sequelize=require(_0x2630('0x0'));var rs=require(_0x2630('0x1'));module[_0x2630('0x2')]={'name':{'type':Sequelize[_0x2630('0x3')],'unique':_0x2630('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x2630('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2630('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2630('0x3')],'defaultValue':function(){return rs[_0x2630('0x5')]();}},'phone':{'type':Sequelize[_0x2630('0x3')]},'type':{'type':Sequelize[_0x2630('0x6')](_0x2630('0x7'),_0x2630('0x8'),_0x2630('0x9'),_0x2630('0xa'),_0x2630('0xb'),_0x2630('0xc'),_0x2630('0xd'),_0x2630('0xe'),_0x2630('0xf'))},'accountSid':{'type':Sequelize[_0x2630('0x3')]},'authId':{'type':Sequelize[_0x2630('0x3')]},'authToken':{'type':Sequelize[_0x2630('0x3')]},'smsMethod':{'type':Sequelize[_0x2630('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2630('0x3')]},'password':{'type':Sequelize[_0x2630('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x2630('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2630('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2630('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2630('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2630('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2630('0x12')],'comment':_0x2630('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x2630('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x58083a){if(!_0x58083a)this[_0x2630('0x14')](_0x2630('0x15'),null);this[_0x2630('0x14')]('mandatoryDisposition',_0x58083a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b61c2fc..3c2bd9d 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 _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','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','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x2bbce4,_0x5e636c){var _0x531652=function(_0x2f1805){while(--_0x2f1805){_0x2bbce4['push'](_0x2bbce4['shift']());}};_0x531652(++_0x5e636c);}(_0x7a54,0x106));var _0x47a5=function(_0x5b6128,_0x3f8fb5){_0x5b6128=_0x5b6128-0x0;var _0x5668fd=_0x7a54[_0x5b6128];return _0x5668fd;};'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);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('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 _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,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(_0x9d9d58,_0x7bf873){var _0x51d4d3=function(_0x3e7528){while(--_0x3e7528){_0x9d9d58['push'](_0x9d9d58['shift']());}};_0x51d4d3(++_0x7bf873);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var 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 4d68539..b4a63e6 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 _0x368b=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x2460d9,_0x15da87){var _0x4bc204=function(_0x40bbce){while(--_0x40bbce){_0x2460d9['push'](_0x2460d9['shift']());}};_0x4bc204(++_0x15da87);}(_0x368b,0x76));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb368('0x0'));var SmsAccount=require(_0xb368('0x1'))['db'][_0xb368('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb368('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb368('0x4'),'afterDestroy':'remove'};function emitEvent(_0x27325b){return function(_0x817de4,_0x40e455,_0x421969){SmsAccountEvents[_0xb368('0x5')](_0x27325b+':'+_0x817de4['id'],_0x817de4);SmsAccountEvents[_0xb368('0x5')](_0x27325b,_0x817de4);_0x421969(null);};}for(var e in events){if(events[_0xb368('0x6')](e)){var event=events[e];SmsAccount[_0xb368('0x7')](e,emitEvent(event));}}module[_0xb368('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xcacd=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0xcacd,0x7e));var _0xdcac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcacd[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xdcac('0x0'))['db'][_0xdcac('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdcac('0x2')](0x0);var events={'afterCreate':_0xdcac('0x3'),'afterUpdate':_0xdcac('0x4'),'afterDestroy':_0xdcac('0x5')};function emitEvent(_0x54be62){return function(_0x5db1c1,_0x5753dd,_0x4befb3){SmsAccountEvents[_0xdcac('0x6')](_0x54be62+':'+_0x5db1c1['id'],_0x5db1c1);SmsAccountEvents['emit'](_0x54be62,_0x5db1c1);_0x4befb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xdcac('0x7')](e,emitEvent(event));}}module[_0xdcac('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9addbae..a07866c 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 _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4d6c71,_0x12e144){var _0x230fe3=function(_0x49f122){while(--_0x49f122){_0x4d6c71['push'](_0x4d6c71['shift']());}};_0x230fe3(++_0x12e144);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xbec973,_0x48f134){var _0x5b2123=function(_0x5eb810){while(--_0x5eb810){_0xbec973['push'](_0xbec973['shift']());}};_0x5b2123(++_0x48f134);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'sms_accounts','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 a4cdd0e..f68590e 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 _0x11f2=['model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','find','options','attributes','include','map'];(function(_0x18a0e9,_0x25267a){var _0x9ca130=function(_0x30b79c){while(--_0x30b79c){_0x18a0e9['push'](_0x18a0e9['shift']());}};_0x9ca130(++_0x25267a);}(_0x11f2,0x146));var _0x211f=function(_0x30d78d,_0x332b58){_0x30d78d=_0x30d78d-0x0;var _0x2b8b7a=_0x11f2[_0x30d78d];return _0x2b8b7a;};'use strict';var _=require(_0x211f('0x0'));var util=require(_0x211f('0x1'));var moment=require(_0x211f('0x2'));var BPromise=require(_0x211f('0x3'));var rs=require(_0x211f('0x4'));var fs=require('fs');var Redis=require(_0x211f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x211f('0x6'));var logger=require('../../config/logger')(_0x211f('0x7'));var config=require(_0x211f('0x8'));var jayson=require(_0x211f('0x9'));var client=jayson['client'][_0x211f('0xa')]({'port':0x232a});config[_0x211f('0xb')]=_['defaults'](config[_0x211f('0xb')],{'host':_0x211f('0xc'),'port':0x18eb});var socket=require(_0x211f('0xd'))(new Redis(config[_0x211f('0xb')]));require(_0x211f('0xe'))[_0x211f('0xf')](socket);function respondWithRpcPromise(_0x5d083a,_0x397c12,_0x525319){return new BPromise(function(_0x37d566,_0x11d54c){return client[_0x211f('0x10')](_0x5d083a,_0x525319)[_0x211f('0x11')](function(_0x25a568){logger[_0x211f('0x12')](_0x211f('0x13'),_0x397c12,_0x211f('0x14'));logger[_0x211f('0x15')](_0x211f('0x16'),_0x397c12,_0x211f('0x14'),JSON[_0x211f('0x17')](_0x25a568));if(_0x25a568['error']){if(_0x25a568[_0x211f('0x18')][_0x211f('0x19')]===0x1f4){logger[_0x211f('0x18')](_0x211f('0x13'),_0x397c12,_0x25a568[_0x211f('0x18')]['message']);return _0x11d54c(_0x25a568[_0x211f('0x18')][_0x211f('0x1a')]);}logger[_0x211f('0x18')](_0x211f('0x13'),_0x397c12,_0x25a568['error']['message']);return _0x37d566(_0x25a568['error']['message']);}else{logger[_0x211f('0x12')](_0x211f('0x13'),_0x397c12,_0x211f('0x14'));_0x37d566(_0x25a568[_0x211f('0x1b')][_0x211f('0x1a')]);}})['catch'](function(_0x52c3a1){logger[_0x211f('0x18')]('SmsAccount,\x20%s,\x20%s',_0x397c12,_0x52c3a1);_0x11d54c(_0x52c3a1);});});}exports[_0x211f('0x1c')]=function(_0x1cd634){var _0x5f5954=this;return new Promise(function(_0x1b2ffc,_0x38e974){return db['SmsAccount'][_0x211f('0x1d')]({'raw':_0x1cd634[_0x211f('0x1e')]?_0x1cd634[_0x211f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1cd634['options']?_0x1cd634[_0x211f('0x1e')]['where']||null:null,'attributes':_0x1cd634[_0x211f('0x1e')]?_0x1cd634[_0x211f('0x1e')][_0x211f('0x1f')]||null:null,'include':_0x1cd634[_0x211f('0x1e')]?_0x1cd634[_0x211f('0x1e')][_0x211f('0x20')]?_[_0x211f('0x21')](_0x1cd634[_0x211f('0x1e')][_0x211f('0x20')],function(_0x5a6612){return{'model':db[_0x5a6612['model']],'as':_0x5a6612['as'],'attributes':_0x5a6612['attributes'],'include':_0x5a6612['include']?_[_0x211f('0x21')](_0x5a6612['include'],function(_0x35b6a1){return{'model':db[_0x35b6a1[_0x211f('0x22')]],'as':_0x35b6a1['as'],'attributes':_0x35b6a1['attributes'],'include':_0x35b6a1['include']?_[_0x211f('0x21')](_0x35b6a1[_0x211f('0x20')],function(_0x349f52){return{'model':db[_0x349f52['model']],'as':_0x349f52['as'],'attributes':_0x349f52['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ebf03){logger[_0x211f('0x12')]('ShowSmsAccount',_0x1cd634);logger[_0x211f('0x15')](_0x211f('0x1c'),_0x1cd634,JSON[_0x211f('0x17')](_0x3ebf03));_0x1b2ffc(_0x3ebf03);})[_0x211f('0x23')](function(_0x19ec0e){logger[_0x211f('0x18')]('ShowSmsAccount',_0x19ec0e[_0x211f('0x1a')],_0x1cd634);_0x38e974(_0x5f5954['error'](0x1f4,_0x19ec0e['message']));});});}; \ No newline at end of file +var _0x2f90=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','map','model','include','then','debug','util'];(function(_0x223e1c,_0xef8380){var _0x83d32f=function(_0x43e7dd){while(--_0x43e7dd){_0x223e1c['push'](_0x223e1c['shift']());}};_0x83d32f(++_0xef8380);}(_0x2f90,0x127));var _0x02f9=function(_0x2e4235,_0x4bd4a1){_0x2e4235=_0x2e4235-0x0;var _0x284b4c=_0x2f90[_0x2e4235];return _0x284b4c;};'use strict';var _=require('lodash');var util=require(_0x02f9('0x0'));var moment=require(_0x02f9('0x1'));var BPromise=require(_0x02f9('0x2'));var rs=require(_0x02f9('0x3'));var fs=require('fs');var Redis=require(_0x02f9('0x4'));var db=require(_0x02f9('0x5'))['db'];var utils=require(_0x02f9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x02f9('0x7'));var jayson=require(_0x02f9('0x8'));var client=jayson[_0x02f9('0x9')][_0x02f9('0xa')]({'port':0x232a});config[_0x02f9('0xb')]=_[_0x02f9('0xc')](config[_0x02f9('0xb')],{'host':_0x02f9('0xd'),'port':0x18eb});var socket=require(_0x02f9('0xe'))(new Redis(config[_0x02f9('0xb')]));require(_0x02f9('0xf'))['register'](socket);function respondWithRpcPromise(_0x855aed,_0x48b420,_0x186fec){return new BPromise(function(_0x24a046,_0x4b728e){return client['request'](_0x855aed,_0x186fec)['then'](function(_0x4d6a82){logger[_0x02f9('0x10')](_0x02f9('0x11'),_0x48b420,_0x02f9('0x12'));logger['debug'](_0x02f9('0x13'),_0x48b420,'request\x20sent',JSON[_0x02f9('0x14')](_0x4d6a82));if(_0x4d6a82[_0x02f9('0x15')]){if(_0x4d6a82[_0x02f9('0x15')][_0x02f9('0x16')]===0x1f4){logger[_0x02f9('0x15')]('SmsAccount,\x20%s,\x20%s',_0x48b420,_0x4d6a82['error']['message']);return _0x4b728e(_0x4d6a82[_0x02f9('0x15')][_0x02f9('0x17')]);}logger[_0x02f9('0x15')](_0x02f9('0x11'),_0x48b420,_0x4d6a82[_0x02f9('0x15')]['message']);return _0x24a046(_0x4d6a82['error'][_0x02f9('0x17')]);}else{logger[_0x02f9('0x10')]('SmsAccount,\x20%s,\x20%s',_0x48b420,_0x02f9('0x12'));_0x24a046(_0x4d6a82[_0x02f9('0x18')][_0x02f9('0x17')]);}})[_0x02f9('0x19')](function(_0x55e3a4){logger['error'](_0x02f9('0x11'),_0x48b420,_0x55e3a4);_0x4b728e(_0x55e3a4);});});}exports[_0x02f9('0x1a')]=function(_0x5b4632){var _0x4c4495=this;return new Promise(function(_0x1fa253,_0xfaf370){return db['SmsAccount'][_0x02f9('0x1b')]({'raw':_0x5b4632[_0x02f9('0x1c')]?_0x5b4632[_0x02f9('0x1c')][_0x02f9('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b4632['options']?_0x5b4632[_0x02f9('0x1c')][_0x02f9('0x1e')]||null:null,'attributes':_0x5b4632[_0x02f9('0x1c')]?_0x5b4632[_0x02f9('0x1c')][_0x02f9('0x1f')]||null:null,'include':_0x5b4632[_0x02f9('0x1c')]?_0x5b4632[_0x02f9('0x1c')]['include']?_[_0x02f9('0x20')](_0x5b4632[_0x02f9('0x1c')]['include'],function(_0x1dfb40){return{'model':db[_0x1dfb40[_0x02f9('0x21')]],'as':_0x1dfb40['as'],'attributes':_0x1dfb40[_0x02f9('0x1f')],'include':_0x1dfb40['include']?_[_0x02f9('0x20')](_0x1dfb40[_0x02f9('0x22')],function(_0x3b1ef5){return{'model':db[_0x3b1ef5[_0x02f9('0x21')]],'as':_0x3b1ef5['as'],'attributes':_0x3b1ef5['attributes'],'include':_0x3b1ef5[_0x02f9('0x22')]?_['map'](_0x3b1ef5[_0x02f9('0x22')],function(_0x24f820){return{'model':db[_0x24f820[_0x02f9('0x21')]],'as':_0x24f820['as'],'attributes':_0x24f820['attributes']};}):[]};}):[]};}):[]:[]})[_0x02f9('0x23')](function(_0x13fdea){logger[_0x02f9('0x10')](_0x02f9('0x1a'),_0x5b4632);logger[_0x02f9('0x24')](_0x02f9('0x1a'),_0x5b4632,JSON[_0x02f9('0x14')](_0x13fdea));_0x1fa253(_0x13fdea);})['catch'](function(_0xe3ec52){logger[_0x02f9('0x15')]('ShowSmsAccount',_0xe3ec52[_0x02f9('0x17')],_0x5b4632);_0xfaf370(_0x4c4495[_0x02f9('0x15')](0x1f4,_0xe3ec52[_0x02f9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 586fe43..75eeb25 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 _0xf725=['save','remove','update','removeListener','register','length','smsAccount:','./smsAccount.events'];(function(_0x58830f,_0x3ae94f){var _0x24656d=function(_0x51c4c0){while(--_0x51c4c0){_0x58830f['push'](_0x58830f['shift']());}};_0x24656d(++_0x3ae94f);}(_0xf725,0x14f));var _0x5f72=function(_0x28b56b,_0x85ec6a){_0x28b56b=_0x28b56b-0x0;var _0xe24eab=_0xf725[_0x28b56b];return _0xe24eab;};'use strict';var SmsAccountEvents=require(_0x5f72('0x0'));var events=[_0x5f72('0x1'),_0x5f72('0x2'),_0x5f72('0x3')];function createListener(_0x25c966,_0x116110){return function(_0x424ac6){_0x116110['emit'](_0x25c966,_0x424ac6);};}function removeListener(_0x1cf1e6,_0x4e579f){return function(){SmsAccountEvents[_0x5f72('0x4')](_0x1cf1e6,_0x4e579f);};}exports[_0x5f72('0x5')]=function(_0x363d71){for(var _0x344868=0x0,_0x533059=events[_0x5f72('0x6')];_0x344868<_0x533059;_0x344868++){var _0x4d73b3=events[_0x344868];var _0x1d2610=createListener(_0x5f72('0x7')+_0x4d73b3,_0x363d71);SmsAccountEvents['on'](_0x4d73b3,_0x1d2610);}}; \ No newline at end of file +var _0x347f=['save','remove','update','register','smsAccount:'];(function(_0x4182c9,_0x4cb37e){var _0x36ed74=function(_0x456ea7){while(--_0x456ea7){_0x4182c9['push'](_0x4182c9['shift']());}};_0x36ed74(++_0x4cb37e);}(_0x347f,0x1cc));var _0xf347=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x347f[_0x502c7d];return _0x30b7ed;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xf347('0x0'),_0xf347('0x1'),_0xf347('0x2')];function createListener(_0x417e04,_0x505105){return function(_0x536614){_0x505105['emit'](_0x417e04,_0x536614);};}function removeListener(_0x55dc55,_0x3a06ad){return function(){SmsAccountEvents['removeListener'](_0x55dc55,_0x3a06ad);};}exports[_0xf347('0x3')]=function(_0x5e7a03){for(var _0x297c14=0x0,_0xfbe434=events['length'];_0x297c14<_0xfbe434;_0x297c14++){var _0x22709c=events[_0x297c14];var _0xc358cc=createListener(_0xf347('0x4')+_0x22709c,_0x5e7a03);SmsAccountEvents['on'](_0x22709c,_0xc358cc);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 203f372..844de7a 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 _0xc26e=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x555a44,_0x4873fc){var _0x184ceb=function(_0xe0b616){while(--_0xe0b616){_0x555a44['push'](_0x555a44['shift']());}};_0x184ceb(++_0x4873fc);}(_0xc26e,0x17b));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xec26('0x0'));var path=require(_0xec26('0x1'));var timeout=require(_0xec26('0x2'));var express=require(_0xec26('0x3'));var router=express[_0xec26('0x4')]();var auth=require(_0xec26('0x5'));var interaction=require(_0xec26('0x6'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router[_0xec26('0x7')]('/',auth[_0xec26('0x8')](),controller[_0xec26('0x9')]);router[_0xec26('0x7')](_0xec26('0xa'),auth['isAuthenticated'](),controller[_0xec26('0xb')]);router[_0xec26('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xec26('0xd')](_0xec26('0xa'),auth[_0xec26('0x8')](),controller[_0xec26('0xe')]);router[_0xec26('0xf')](_0xec26('0xa'),auth['isAuthenticated'](),controller[_0xec26('0x10')]);module[_0xec26('0x11')]=router; \ No newline at end of file +var _0x698f=['connect-timeout','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x1386d5,_0xddd9b0){var _0xc6f184=function(_0x1f3506){while(--_0x1f3506){_0x1386d5['push'](_0x1386d5['shift']());}};_0xc6f184(++_0xddd9b0);}(_0x698f,0x129));var _0xf698=function(_0x5bfa38,_0x3edee4){_0x5bfa38=_0x5bfa38-0x0;var _0x12eddf=_0x698f[_0x5bfa38];return _0x12eddf;};'use strict';var multer=require(_0xf698('0x0'));var util=require(_0xf698('0x1'));var path=require(_0xf698('0x2'));var timeout=require(_0xf698('0x3'));var express=require('express');var router=express[_0xf698('0x4')]();var auth=require(_0xf698('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf698('0x6'));router[_0xf698('0x7')]('/',auth[_0xf698('0x8')](),controller['index']);router[_0xf698('0x7')]('/:id',auth[_0xf698('0x8')](),controller['show']);router['post']('/',auth[_0xf698('0x8')](),controller[_0xf698('0x9')]);router[_0xf698('0xa')](_0xf698('0xb'),auth[_0xf698('0x8')](),controller['update']);router[_0xf698('0xc')]('/:id',auth[_0xf698('0x8')](),controller[_0xf698('0xd')]);module[_0xf698('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 2c5da9b..d78dfcf 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 _0xaaeb=['*,*,*,*','sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x31f9ce,_0x55c913){var _0x2c2ea0=function(_0x484857){while(--_0x484857){_0x31f9ce['push'](_0x31f9ce['shift']());}};_0x2c2ea0(++_0x55c913);}(_0xaaeb,0x1a5));var _0xbaae=function(_0x290df5,_0x2cc0cb){_0x290df5=_0x290df5-0x0;var _0x27c215=_0xaaeb[_0x290df5];return _0x27c215;};'use strict';var Sequelize=require(_0xbaae('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbaae('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbaae('0x2')},'appdata':{'type':Sequelize[_0xbaae('0x3')]()},'description':{'type':Sequelize[_0xbaae('0x4')]},'interval':{'type':Sequelize[_0xbaae('0x4')],'defaultValue':_0xbaae('0x5')}}; \ No newline at end of file +var _0xa180=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x107a2a,_0x43a832){var _0x2d0759=function(_0x3294cc){while(--_0x3294cc){_0x107a2a['push'](_0x107a2a['shift']());}};_0x2d0759(++_0x43a832);}(_0xa180,0x13f));var _0x0a18=function(_0x5f45fc,_0x519b44){_0x5f45fc=_0x5f45fc-0x0;var _0x200325=_0xa180[_0x5f45fc];return _0x200325;};'use strict';var Sequelize=require(_0x0a18('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0a18('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0a18('0x2')],'allowNull':![],'defaultValue':_0x0a18('0x3')},'appdata':{'type':Sequelize[_0x0a18('0x4')]()},'description':{'type':Sequelize[_0x0a18('0x2')]},'interval':{'type':Sequelize[_0x0a18('0x2')],'defaultValue':_0x0a18('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5d49960..244d156 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 _0xe5af=['hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../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','apply','save','update','then','destroy','error','stack','name','send','index','SmsApplication','fieldName','type','filters','intersection','model','query','attributes','fields','length'];(function(_0x3250f7,_0x1c2afc){var _0xdb6ac4=function(_0x5a23f8){while(--_0x5a23f8){_0x3250f7['push'](_0x3250f7['shift']());}};_0xdb6ac4(++_0x1c2afc);}(_0xe5af,0x9c));var _0xfe5a=function(_0x5dea9c,_0x2b594f){_0x5dea9c=_0x5dea9c-0x0;var _0x2f0129=_0xe5af[_0x5dea9c];return _0x2f0129;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe5a('0x0'));var rimraf=require(_0xfe5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe5a('0x2'));var rp=require(_0xfe5a('0x3'));var moment=require(_0xfe5a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfe5a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xfe5a('0x6'));var csv=require(_0xfe5a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2086c7,_0x9d1f4f){_0x9d1f4f=_0x9d1f4f||0xcc;return function(_0x20b206){if(_0x20b206){return _0x2086c7[_0xfe5a('0x14')](_0x9d1f4f);}return _0x2086c7[_0xfe5a('0x15')](_0x9d1f4f)['end']();};}function respondWithResult(_0x33e574,_0x17bbbe){_0x17bbbe=_0x17bbbe||0xc8;return function(_0x42969b){if(_0x42969b){return _0x33e574[_0xfe5a('0x15')](_0x17bbbe)[_0xfe5a('0x16')](_0x42969b);}};}function respondWithFilteredResult(_0x217976,_0x375380){return function(_0xeb454){if(_0xeb454){var _0x111d4d=_0xeb454[_0xfe5a('0x17')],_0x18c57b=_0x375380[_0xfe5a('0x18')],_0x38f12e=_0x375380[_0xfe5a('0x18')]+_0x375380[_0xfe5a('0x19')],_0x2cb5c5;if(_0x38f12e>=_0x111d4d){_0x38f12e=_0x111d4d;_0x2cb5c5=0xc8;}else{_0x2cb5c5=0xce;}_0x217976['status'](_0x2cb5c5);return _0x217976[_0xfe5a('0x1a')](_0xfe5a('0x1b'),_0x18c57b+'-'+_0x38f12e+'/'+_0x111d4d)['json'](_0xeb454);}return null;};}function patchUpdates(_0x3b0101){return function(_0x329273){try{jsonpatch[_0xfe5a('0x1c')](_0x329273,_0x3b0101,!![]);}catch(_0x4bd05a){return BPromise['reject'](_0x4bd05a);}return _0x329273[_0xfe5a('0x1d')]();};}function saveUpdates(_0x1c6ba7,_0xded538){return function(_0x3b3022){if(_0x3b3022){return _0x3b3022[_0xfe5a('0x1e')](_0x1c6ba7)[_0xfe5a('0x1f')](function(_0x564c1d){return _0x564c1d;});}return null;};}function removeEntity(_0x4770bb,_0x592521){return function(_0x3dfa57){if(_0x3dfa57){return _0x3dfa57[_0xfe5a('0x20')]()[_0xfe5a('0x1f')](function(){_0x4770bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x247be4,_0x3e55fd){return function(_0x494df3){if(!_0x494df3){_0x247be4[_0xfe5a('0x14')](0x194);}return _0x494df3;};}function handleError(_0x26f744,_0x578d3e){_0x578d3e=_0x578d3e||0x1f4;return function(_0x1a57dd){logger[_0xfe5a('0x21')](_0x1a57dd[_0xfe5a('0x22')]);if(_0x1a57dd[_0xfe5a('0x23')]){delete _0x1a57dd['name'];}_0x26f744[_0xfe5a('0x15')](_0x578d3e)[_0xfe5a('0x24')](_0x1a57dd);};}exports[_0xfe5a('0x25')]=function(_0x1cd531,_0x36bf20){var _0x222490={},_0xdbf1e0={},_0x2374b9={'count':0x0,'rows':[]};var _0x55d89e=_['map'](db[_0xfe5a('0x26')]['rawAttributes'],function(_0xc53869){return{'name':_0xc53869[_0xfe5a('0x27')],'type':_0xc53869[_0xfe5a('0x28')]['key']};});_0xdbf1e0['model']=_['map'](_0x55d89e,_0xfe5a('0x23'));_0xdbf1e0['query']=_['keys'](_0x1cd531['query']);_0xdbf1e0[_0xfe5a('0x29')]=_[_0xfe5a('0x2a')](_0xdbf1e0[_0xfe5a('0x2b')],_0xdbf1e0[_0xfe5a('0x2c')]);_0x222490[_0xfe5a('0x2d')]=_[_0xfe5a('0x2a')](_0xdbf1e0[_0xfe5a('0x2b')],qs[_0xfe5a('0x2e')](_0x1cd531[_0xfe5a('0x2c')][_0xfe5a('0x2e')]));_0x222490[_0xfe5a('0x2d')]=_0x222490['attributes'][_0xfe5a('0x2f')]?_0x222490[_0xfe5a('0x2d')]:_0xdbf1e0['model'];if(!_0x1cd531[_0xfe5a('0x2c')][_0xfe5a('0x30')](_0xfe5a('0x31'))){_0x222490[_0xfe5a('0x19')]=qs[_0xfe5a('0x19')](_0x1cd531['query']['limit']);_0x222490[_0xfe5a('0x18')]=qs['offset'](_0x1cd531[_0xfe5a('0x2c')][_0xfe5a('0x18')]);}_0x222490[_0xfe5a('0x32')]=qs[_0xfe5a('0x33')](_0x1cd531['query'][_0xfe5a('0x33')]);_0x222490[_0xfe5a('0x34')]=qs[_0xfe5a('0x29')](_['pick'](_0x1cd531[_0xfe5a('0x2c')],_0xdbf1e0[_0xfe5a('0x29')]),_0x55d89e);if(_0x1cd531[_0xfe5a('0x2c')][_0xfe5a('0x35')]){_0x222490['where']=_[_0xfe5a('0x36')](_0x222490['where'],{'$or':_[_0xfe5a('0x37')](_0x55d89e,function(_0x6145a6){if(_0x6145a6['type']!==_0xfe5a('0x38')){var _0x45e31a={};_0x45e31a[_0x6145a6[_0xfe5a('0x23')]]={'$like':'%'+_0x1cd531[_0xfe5a('0x2c')]['filter']+'%'};return _0x45e31a;}})});}_0x222490=_[_0xfe5a('0x36')]({},_0x222490,_0x1cd531[_0xfe5a('0x39')]);var _0x188470={'where':_0x222490['where']};return db[_0xfe5a('0x26')][_0xfe5a('0x17')](_0x188470)[_0xfe5a('0x1f')](function(_0x254248){_0x2374b9[_0xfe5a('0x17')]=_0x254248;if(_0x1cd531[_0xfe5a('0x2c')][_0xfe5a('0x3a')]){_0x222490[_0xfe5a('0x3b')]=[{'all':!![]}];}return db[_0xfe5a('0x26')][_0xfe5a('0x3c')](_0x222490);})[_0xfe5a('0x1f')](function(_0x585752){_0x2374b9[_0xfe5a('0x3d')]=_0x585752;return _0x2374b9;})[_0xfe5a('0x1f')](respondWithFilteredResult(_0x36bf20,_0x222490))[_0xfe5a('0x3e')](handleError(_0x36bf20,null));};exports[_0xfe5a('0x3f')]=function(_0x3fd3a3,_0x8ae26a){var _0x3475fb={'raw':!![],'where':{'id':_0x3fd3a3[_0xfe5a('0x40')]['id']}},_0x5ce9ad={};_0x5ce9ad[_0xfe5a('0x2b')]=_['keys'](db['SmsApplication'][_0xfe5a('0x41')]);_0x5ce9ad['query']=_['keys'](_0x3fd3a3[_0xfe5a('0x2c')]);_0x5ce9ad[_0xfe5a('0x29')]=_['intersection'](_0x5ce9ad[_0xfe5a('0x2b')],_0x5ce9ad['query']);_0x3475fb[_0xfe5a('0x2d')]=_[_0xfe5a('0x2a')](_0x5ce9ad[_0xfe5a('0x2b')],qs[_0xfe5a('0x2e')](_0x3fd3a3[_0xfe5a('0x2c')][_0xfe5a('0x2e')]));_0x3475fb['attributes']=_0x3475fb[_0xfe5a('0x2d')][_0xfe5a('0x2f')]?_0x3475fb[_0xfe5a('0x2d')]:_0x5ce9ad[_0xfe5a('0x2b')];if(_0x3fd3a3[_0xfe5a('0x2c')][_0xfe5a('0x3a')]){_0x3475fb[_0xfe5a('0x3b')]=[{'all':!![]}];}_0x3475fb=_[_0xfe5a('0x36')]({},_0x3475fb,_0x3fd3a3[_0xfe5a('0x39')]);return db[_0xfe5a('0x26')][_0xfe5a('0x42')](_0x3475fb)[_0xfe5a('0x1f')](handleEntityNotFound(_0x8ae26a,null))[_0xfe5a('0x1f')](respondWithResult(_0x8ae26a,null))[_0xfe5a('0x3e')](handleError(_0x8ae26a,null));};exports['create']=function(_0x5bccae,_0x3df23){return db['SmsApplication']['create'](_0x5bccae[_0xfe5a('0x43')],{})[_0xfe5a('0x1f')](respondWithResult(_0x3df23,0xc9))[_0xfe5a('0x3e')](handleError(_0x3df23,null));};exports[_0xfe5a('0x1e')]=function(_0x3cf1b5,_0x42ec3b){if(_0x3cf1b5[_0xfe5a('0x43')]['id']){delete _0x3cf1b5['body']['id'];}return db[_0xfe5a('0x26')]['find']({'where':{'id':_0x3cf1b5[_0xfe5a('0x40')]['id']}})['then'](handleEntityNotFound(_0x42ec3b,null))[_0xfe5a('0x1f')](saveUpdates(_0x3cf1b5[_0xfe5a('0x43')],null))[_0xfe5a('0x1f')](respondWithResult(_0x42ec3b,null))[_0xfe5a('0x3e')](handleError(_0x42ec3b,null));};exports['destroy']=function(_0x394073,_0x3f8447){return db['SmsApplication'][_0xfe5a('0x42')]({'where':{'id':_0x394073['params']['id']}})['then'](handleEntityNotFound(_0x3f8447,null))[_0xfe5a('0x1f')](removeEntity(_0x3f8447,null))['catch'](handleError(_0x3f8447,null));}; \ No newline at end of file +var _0xe820=['html-pdf','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','SmsApplication','type','key','query','filters','model','attributes','intersection','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','fields','create','body','update','find'];(function(_0x10d175,_0x607659){var _0xe3375=function(_0x2ee9b7){while(--_0x2ee9b7){_0x10d175['push'](_0x10d175['shift']());}};_0xe3375(++_0x607659);}(_0xe820,0xd2));var _0x0e82=function(_0x3a4bdc,_0x32355e){_0x3a4bdc=_0x3a4bdc-0x0;var _0x50a091=_0xe820[_0x3a4bdc];return _0x50a091;};'use strict';var pdf=require(_0x0e82('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e82('0x2'));var moment=require(_0x0e82('0x3'));var BPromise=require(_0x0e82('0x4'));var Mustache=require('mustache');var util=require(_0x0e82('0x5'));var path=require('path');var sox=require(_0x0e82('0x6'));var csv=require(_0x0e82('0x7'));var ejs=require(_0x0e82('0x8'));var fs=require('fs');var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x7'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var db=require(_0x0e82('0x16'))['db'];function respondWithStatusCode(_0xb42f45,_0x21c40b){_0x21c40b=_0x21c40b||0xcc;return function(_0x1da28a){if(_0x1da28a){return _0xb42f45[_0x0e82('0x17')](_0x21c40b);}return _0xb42f45[_0x0e82('0x18')](_0x21c40b)['end']();};}function respondWithResult(_0x49751,_0x5c161c){_0x5c161c=_0x5c161c||0xc8;return function(_0x48d99b){if(_0x48d99b){return _0x49751[_0x0e82('0x18')](_0x5c161c)['json'](_0x48d99b);}};}function respondWithFilteredResult(_0x5b4ffd,_0x5a2d28){return function(_0x3298c7){if(_0x3298c7){var _0x4d1aa0=_0x3298c7[_0x0e82('0x19')],_0x585b9b=_0x5a2d28[_0x0e82('0x1a')],_0x1149b1=_0x5a2d28[_0x0e82('0x1a')]+_0x5a2d28[_0x0e82('0x1b')],_0x582f45;if(_0x1149b1>=_0x4d1aa0){_0x1149b1=_0x4d1aa0;_0x582f45=0xc8;}else{_0x582f45=0xce;}_0x5b4ffd['status'](_0x582f45);return _0x5b4ffd[_0x0e82('0x1c')](_0x0e82('0x1d'),_0x585b9b+'-'+_0x1149b1+'/'+_0x4d1aa0)[_0x0e82('0x1e')](_0x3298c7);}return null;};}function patchUpdates(_0xc3d043){return function(_0x3b9933){try{jsonpatch[_0x0e82('0x1f')](_0x3b9933,_0xc3d043,!![]);}catch(_0x278bcd){return BPromise[_0x0e82('0x20')](_0x278bcd);}return _0x3b9933[_0x0e82('0x21')]();};}function saveUpdates(_0x224455,_0x5903c){return function(_0x493280){if(_0x493280){return _0x493280['update'](_0x224455)[_0x0e82('0x22')](function(_0x2781de){return _0x2781de;});}return null;};}function removeEntity(_0x13e8f8,_0xb0a31){return function(_0xd48046){if(_0xd48046){return _0xd48046[_0x0e82('0x23')]()[_0x0e82('0x22')](function(){_0x13e8f8[_0x0e82('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(!_0x3d6c28){_0x1b71b4[_0x0e82('0x17')](0x194);}return _0x3d6c28;};}function handleError(_0x507f08,_0xee85dd){_0xee85dd=_0xee85dd||0x1f4;return function(_0x24e990){logger[_0x0e82('0x24')](_0x24e990[_0x0e82('0x25')]);if(_0x24e990['name']){delete _0x24e990[_0x0e82('0x26')];}_0x507f08['status'](_0xee85dd)['send'](_0x24e990);};}exports[_0x0e82('0x27')]=function(_0x168dbe,_0x4c5fc1){var _0x19b96d={},_0xe3c530={},_0x149e7e={'count':0x0,'rows':[]};var _0x5ca9e3=_[_0x0e82('0x28')](db[_0x0e82('0x29')]['rawAttributes'],function(_0xabc536){return{'name':_0xabc536['fieldName'],'type':_0xabc536[_0x0e82('0x2a')][_0x0e82('0x2b')]};});_0xe3c530['model']=_[_0x0e82('0x28')](_0x5ca9e3,_0x0e82('0x26'));_0xe3c530[_0x0e82('0x2c')]=_['keys'](_0x168dbe['query']);_0xe3c530[_0x0e82('0x2d')]=_['intersection'](_0xe3c530[_0x0e82('0x2e')],_0xe3c530['query']);_0x19b96d[_0x0e82('0x2f')]=_[_0x0e82('0x30')](_0xe3c530[_0x0e82('0x2e')],qs['fields'](_0x168dbe[_0x0e82('0x2c')]['fields']));_0x19b96d[_0x0e82('0x2f')]=_0x19b96d[_0x0e82('0x2f')][_0x0e82('0x31')]?_0x19b96d[_0x0e82('0x2f')]:_0xe3c530[_0x0e82('0x2e')];if(!_0x168dbe[_0x0e82('0x2c')]['hasOwnProperty'](_0x0e82('0x32'))){_0x19b96d[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x168dbe[_0x0e82('0x2c')][_0x0e82('0x1b')]);_0x19b96d[_0x0e82('0x1a')]=qs[_0x0e82('0x1a')](_0x168dbe[_0x0e82('0x2c')][_0x0e82('0x1a')]);}_0x19b96d[_0x0e82('0x33')]=qs[_0x0e82('0x34')](_0x168dbe[_0x0e82('0x2c')][_0x0e82('0x34')]);_0x19b96d[_0x0e82('0x35')]=qs[_0x0e82('0x2d')](_['pick'](_0x168dbe[_0x0e82('0x2c')],_0xe3c530[_0x0e82('0x2d')]),_0x5ca9e3);if(_0x168dbe[_0x0e82('0x2c')][_0x0e82('0x36')]){_0x19b96d['where']=_[_0x0e82('0x37')](_0x19b96d[_0x0e82('0x35')],{'$or':_['map'](_0x5ca9e3,function(_0xd7ad2f){if(_0xd7ad2f['type']!=='VIRTUAL'){var _0x166707={};_0x166707[_0xd7ad2f[_0x0e82('0x26')]]={'$like':'%'+_0x168dbe[_0x0e82('0x2c')][_0x0e82('0x36')]+'%'};return _0x166707;}})});}_0x19b96d=_[_0x0e82('0x37')]({},_0x19b96d,_0x168dbe[_0x0e82('0x38')]);var _0x33a152={'where':_0x19b96d['where']};return db['SmsApplication'][_0x0e82('0x19')](_0x33a152)[_0x0e82('0x22')](function(_0x17271f){_0x149e7e[_0x0e82('0x19')]=_0x17271f;if(_0x168dbe[_0x0e82('0x2c')][_0x0e82('0x39')]){_0x19b96d[_0x0e82('0x3a')]=[{'all':!![]}];}return db[_0x0e82('0x29')]['findAll'](_0x19b96d);})[_0x0e82('0x22')](function(_0x8229ab){_0x149e7e[_0x0e82('0x3b')]=_0x8229ab;return _0x149e7e;})[_0x0e82('0x22')](respondWithFilteredResult(_0x4c5fc1,_0x19b96d))[_0x0e82('0x3c')](handleError(_0x4c5fc1,null));};exports[_0x0e82('0x3d')]=function(_0x118e05,_0x53f221){var _0x311cb8={'raw':!![],'where':{'id':_0x118e05[_0x0e82('0x3e')]['id']}},_0x184e4c={};_0x184e4c[_0x0e82('0x2e')]=_[_0x0e82('0x3f')](db[_0x0e82('0x29')][_0x0e82('0x40')]);_0x184e4c['query']=_['keys'](_0x118e05['query']);_0x184e4c['filters']=_['intersection'](_0x184e4c['model'],_0x184e4c[_0x0e82('0x2c')]);_0x311cb8[_0x0e82('0x2f')]=_[_0x0e82('0x30')](_0x184e4c[_0x0e82('0x2e')],qs[_0x0e82('0x41')](_0x118e05[_0x0e82('0x2c')][_0x0e82('0x41')]));_0x311cb8[_0x0e82('0x2f')]=_0x311cb8['attributes']['length']?_0x311cb8[_0x0e82('0x2f')]:_0x184e4c[_0x0e82('0x2e')];if(_0x118e05[_0x0e82('0x2c')][_0x0e82('0x39')]){_0x311cb8[_0x0e82('0x3a')]=[{'all':!![]}];}_0x311cb8=_[_0x0e82('0x37')]({},_0x311cb8,_0x118e05[_0x0e82('0x38')]);return db[_0x0e82('0x29')]['find'](_0x311cb8)[_0x0e82('0x22')](handleEntityNotFound(_0x53f221,null))['then'](respondWithResult(_0x53f221,null))[_0x0e82('0x3c')](handleError(_0x53f221,null));};exports['create']=function(_0x411574,_0x4fd25d){return db[_0x0e82('0x29')][_0x0e82('0x42')](_0x411574[_0x0e82('0x43')],{})['then'](respondWithResult(_0x4fd25d,0xc9))['catch'](handleError(_0x4fd25d,null));};exports[_0x0e82('0x44')]=function(_0x132c45,_0x267070){if(_0x132c45['body']['id']){delete _0x132c45[_0x0e82('0x43')]['id'];}return db['SmsApplication'][_0x0e82('0x45')]({'where':{'id':_0x132c45[_0x0e82('0x3e')]['id']}})[_0x0e82('0x22')](handleEntityNotFound(_0x267070,null))[_0x0e82('0x22')](saveUpdates(_0x132c45[_0x0e82('0x43')],null))[_0x0e82('0x22')](respondWithResult(_0x267070,null))[_0x0e82('0x3c')](handleError(_0x267070,null));};exports[_0x0e82('0x23')]=function(_0x1bd904,_0x287abc){return db[_0x0e82('0x29')][_0x0e82('0x45')]({'where':{'id':_0x1bd904['params']['id']}})[_0x0e82('0x22')](handleEntityNotFound(_0x287abc,null))[_0x0e82('0x22')](removeEntity(_0x287abc,null))['catch'](handleError(_0x287abc,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7d725d7..2773c46 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 _0xbb7b=['define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports'];(function(_0x3aca67,_0x410392){var _0x2513e7=function(_0x5f2ade){while(--_0x5f2ade){_0x3aca67['push'](_0x3aca67['shift']());}};_0x2513e7(++_0x410392);}(_0xbb7b,0x10b));var _0xbbb7=function(_0x2e6e74,_0x1606f8){_0x2e6e74=_0x2e6e74-0x0;var _0x55791a=_0xbb7b[_0x2e6e74];return _0x55791a;};'use strict';var _=require(_0xbbb7('0x0'));var util=require('util');var logger=require(_0xbbb7('0x1'))(_0xbbb7('0x2'));var moment=require('moment');var BPromise=require(_0xbbb7('0x3'));var rp=require(_0xbbb7('0x4'));var fs=require('fs');var path=require(_0xbbb7('0x5'));var rimraf=require(_0xbbb7('0x6'));var config=require('../../config/environment');var attributes=require(_0xbbb7('0x7'));module[_0xbbb7('0x8')]=function(_0x47a199,_0x55ef09){return _0x47a199[_0xbbb7('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbbb7('0xa'),'collate':_0xbbb7('0xb')});}; \ No newline at end of file +var _0x0444=['../../config/environment','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2064c8,_0x168039){var _0x23af73=function(_0x2a2d10){while(--_0x2a2d10){_0x2064c8['push'](_0x2064c8['shift']());}};_0x23af73(++_0x168039);}(_0x0444,0x18c));var _0x4044=function(_0x1301cf,_0x3b5e79){_0x1301cf=_0x1301cf-0x0;var _0x564f12=_0x0444[_0x1301cf];return _0x564f12;};'use strict';var _=require(_0x4044('0x0'));var util=require(_0x4044('0x1'));var logger=require(_0x4044('0x2'))(_0x4044('0x3'));var moment=require(_0x4044('0x4'));var BPromise=require(_0x4044('0x5'));var rp=require(_0x4044('0x6'));var fs=require('fs');var path=require(_0x4044('0x7'));var rimraf=require(_0x4044('0x8'));var config=require(_0x4044('0x9'));var attributes=require('./smsApplication.attributes');module[_0x4044('0xa')]=function(_0x2094ea,_0x3f5b00){return _0x2094ea[_0x4044('0xb')]('SmsApplication',attributes,{'tableName':_0x4044('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4044('0xd'),'collate':_0x4044('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 42882a3..7ac7249 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 _0x692c=['../../config/environment','jayson/promise','client','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xe4404e,_0x31021d){var _0x13eb9c=function(_0x3640d7){while(--_0x3640d7){_0xe4404e['push'](_0xe4404e['shift']());}};_0x13eb9c(++_0x31021d);}(_0x692c,0x6a));var _0xc692=function(_0x4647c1,_0x4cb685){_0x4647c1=_0x4647c1-0x0;var _0x30514d=_0x692c[_0x4647c1];return _0x30514d;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var moment=require(_0xc692('0x2'));var BPromise=require(_0xc692('0x3'));var rs=require(_0xc692('0x4'));var fs=require('fs');var Redis=require(_0xc692('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc692('0x6'));var logger=require(_0xc692('0x7'))(_0xc692('0x8'));var config=require(_0xc692('0x9'));var jayson=require(_0xc692('0xa'));var client=jayson[_0xc692('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1229,_0x3a0bb4,_0x170b93){return new BPromise(function(_0x25e291,_0x38d716){return client[_0xc692('0xc')](_0x4c1229,_0x170b93)[_0xc692('0xd')](function(_0x2ad982){logger['info'](_0xc692('0xe'),_0x3a0bb4,_0xc692('0xf'));logger[_0xc692('0x10')](_0xc692('0x11'),_0x3a0bb4,_0xc692('0xf'),JSON['stringify'](_0x2ad982));if(_0x2ad982[_0xc692('0x12')]){if(_0x2ad982[_0xc692('0x12')][_0xc692('0x13')]===0x1f4){logger['error'](_0xc692('0xe'),_0x3a0bb4,_0x2ad982['error'][_0xc692('0x14')]);return _0x38d716(_0x2ad982[_0xc692('0x12')]['message']);}logger[_0xc692('0x12')](_0xc692('0xe'),_0x3a0bb4,_0x2ad982[_0xc692('0x12')][_0xc692('0x14')]);return _0x25e291(_0x2ad982[_0xc692('0x12')][_0xc692('0x14')]);}else{logger[_0xc692('0x15')](_0xc692('0xe'),_0x3a0bb4,_0xc692('0xf'));_0x25e291(_0x2ad982['result'][_0xc692('0x14')]);}})[_0xc692('0x16')](function(_0x523919){logger[_0xc692('0x12')](_0xc692('0xe'),_0x3a0bb4,_0x523919);_0x38d716(_0x523919);});});} \ No newline at end of file +var _0x7d9f=['../../config/environment','http','request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f24f0,_0x4808ff){var _0x20b6b0=function(_0x3ad82b){while(--_0x3ad82b){_0x3f24f0['push'](_0x3f24f0['shift']());}};_0x20b6b0(++_0x4808ff);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0x7d9f[_0x328ac9];return _0x2b3a0a;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var moment=require(_0xf7d9('0x2'));var BPromise=require(_0xf7d9('0x3'));var rs=require(_0xf7d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7d9('0x5'))['db'];var utils=require(_0xf7d9('0x6'));var logger=require(_0xf7d9('0x7'))(_0xf7d9('0x8'));var config=require(_0xf7d9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x250675,_0x5772b4,_0x21c654){return new BPromise(function(_0x1685a6,_0x5e4087){return client[_0xf7d9('0xb')](_0x250675,_0x21c654)['then'](function(_0x265548){logger[_0xf7d9('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5772b4,'request\x20sent');logger[_0xf7d9('0xd')](_0xf7d9('0xe'),_0x5772b4,_0xf7d9('0xf'),JSON['stringify'](_0x265548));if(_0x265548['error']){if(_0x265548[_0xf7d9('0x10')][_0xf7d9('0x11')]===0x1f4){logger[_0xf7d9('0x10')](_0xf7d9('0x12'),_0x5772b4,_0x265548['error'][_0xf7d9('0x13')]);return _0x5e4087(_0x265548[_0xf7d9('0x10')][_0xf7d9('0x13')]);}logger[_0xf7d9('0x10')]('SmsApplication,\x20%s,\x20%s',_0x5772b4,_0x265548[_0xf7d9('0x10')][_0xf7d9('0x13')]);return _0x1685a6(_0x265548[_0xf7d9('0x10')][_0xf7d9('0x13')]);}else{logger['info'](_0xf7d9('0x12'),_0x5772b4,_0xf7d9('0xf'));_0x1685a6(_0x265548[_0xf7d9('0x14')]['message']);}})['catch'](function(_0x35751e){logger[_0xf7d9('0x10')](_0xf7d9('0x12'),_0x5772b4,_0x35751e);_0x5e4087(_0x35751e);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c7fc034..e94663e 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 _0xb199=['sms','smsinteraction:addtags','addTags','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','tracked'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb199,0xdc));var _0x9b19=function(_0x2d2ccc,_0x3017d7){_0x2d2ccc=_0x2d2ccc-0x0;var _0x2ecdf7=_0xb199[_0x2d2ccc];return _0x2ecdf7;};'use strict';var multer=require('multer');var util=require(_0x9b19('0x0'));var path=require(_0x9b19('0x1'));var timeout=require(_0x9b19('0x2'));var express=require(_0x9b19('0x3'));var router=express['Router']();var auth=require(_0x9b19('0x4'));var interaction=require(_0x9b19('0x5'));var config=require(_0x9b19('0x6'));var controller=require(_0x9b19('0x7'));router[_0x9b19('0x8')]('/',auth[_0x9b19('0x9')](),controller[_0x9b19('0xa')]);router['get'](_0x9b19('0xb'),auth[_0x9b19('0x9')](),controller[_0x9b19('0xc')]);router[_0x9b19('0x8')](_0x9b19('0xd'),auth[_0x9b19('0x9')](),controller[_0x9b19('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x9b19('0xf')]);router['get']('/:id/download',auth[_0x9b19('0x9')](),controller[_0x9b19('0x10')]);router[_0x9b19('0x11')]('/',auth[_0x9b19('0x9')](),controller['create']);router[_0x9b19('0x11')](_0x9b19('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x9b19('0x11')]('/:id/tags',auth[_0x9b19('0x9')](),interaction[_0x9b19('0x13')](_0x9b19('0x14'),_0x9b19('0x15')),controller[_0x9b19('0x16')]);router['put']('/:id',auth[_0x9b19('0x9')](),interaction[_0x9b19('0x13')]('sms','smsinteraction:update'),controller[_0x9b19('0x17')]);router['delete'](_0x9b19('0xd'),auth['isAuthenticated'](),interaction[_0x9b19('0x13')](_0x9b19('0x14'),_0x9b19('0x18')),controller[_0x9b19('0x19')]);router[_0x9b19('0x1a')](_0x9b19('0x1b'),auth[_0x9b19('0x9')](),controller[_0x9b19('0x1c')]);module[_0x9b19('0x1d')]=router; \ No newline at end of file +var _0x2250=['./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x11cb12,_0x363aeb){var _0x33d570=function(_0x5975d1){while(--_0x5975d1){_0x11cb12['push'](_0x11cb12['shift']());}};_0x33d570(++_0x363aeb);}(_0x2250,0x178));var _0x0225=function(_0x3730b1,_0x28a04b){_0x3730b1=_0x3730b1-0x0;var _0x2a75db=_0x2250[_0x3730b1];return _0x2a75db;};'use strict';var multer=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var path=require(_0x0225('0x2'));var timeout=require(_0x0225('0x3'));var express=require(_0x0225('0x4'));var router=express[_0x0225('0x5')]();var auth=require(_0x0225('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0225('0x7'));var controller=require(_0x0225('0x8'));router[_0x0225('0x9')]('/',auth[_0x0225('0xa')](),controller[_0x0225('0xb')]);router[_0x0225('0x9')](_0x0225('0xc'),auth[_0x0225('0xa')](),controller['describe']);router[_0x0225('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0225('0xd')]);router[_0x0225('0x9')](_0x0225('0xe'),auth[_0x0225('0xa')](),controller[_0x0225('0xf')]);router['get'](_0x0225('0x10'),auth[_0x0225('0xa')](),controller[_0x0225('0x11')]);router[_0x0225('0x12')]('/',auth['isAuthenticated'](),controller[_0x0225('0x13')]);router['post'](_0x0225('0xe'),auth[_0x0225('0xa')](),controller['addMessage']);router[_0x0225('0x12')](_0x0225('0x14'),auth[_0x0225('0xa')](),interaction[_0x0225('0x15')](_0x0225('0x16'),_0x0225('0x17')),controller[_0x0225('0x18')]);router[_0x0225('0x19')](_0x0225('0x1a'),auth[_0x0225('0xa')](),interaction[_0x0225('0x15')]('sms',_0x0225('0x1b')),controller[_0x0225('0x1c')]);router['delete'](_0x0225('0x1a'),auth['isAuthenticated'](),interaction[_0x0225('0x15')](_0x0225('0x16'),_0x0225('0x1d')),controller[_0x0225('0x1e')]);router[_0x0225('0x1f')]('/:id/tags',auth[_0x0225('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index bc48d3c..7911679 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 _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb7e7=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x4eb959,_0x4134d4){var _0x1fa18a=function(_0x54f0b6){while(--_0x54f0b6){_0x4eb959['push'](_0x4eb959['shift']());}};_0x1fa18a(++_0x4134d4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b7e('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7b7e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7b7e('0x4')]('in',_0x7b7e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b7e('0x5')),'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 aec3121..88e8a29 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 _0x5db8=['fullname','Tags','TagIds','forEach','push','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','sort','where','field','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','split','length','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','text','start','Tag','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','SmsAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\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','isNumeric','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','Sequelize','QueryTypes','SELECT','clone','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','attributes','a.key','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','catch','params','includeAll','options','create','update','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','pick','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','findAll','color','emit','smsInteractionTags:save','removeTags','unix','join','server','tmp','root','attachments','User','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','40px','30px','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','Sms','YYYY-MM-DD','N.A.','closed','closedAt','disposition','out','System','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','Users','map'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5db8,0xbb));var _0x85db=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0x5db8[_0x2649e2];return _0x4797d4;};'use strict';var pdf=require(_0x85db('0x0'));var emlformat=require(_0x85db('0x1'));var rimraf=require(_0x85db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85db('0x3'));var rp=require(_0x85db('0x4'));var moment=require(_0x85db('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85db('0x6'));var path=require(_0x85db('0x7'));var sox=require(_0x85db('0x8'));var csv=require(_0x85db('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var Redis=require(_0x85db('0xf'));var authService=require(_0x85db('0x10'));var qs=require(_0x85db('0x11'));var as=require(_0x85db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85db('0x13'));var config=require(_0x85db('0x14'));var db=require('../../mysqldb')['db'];config[_0x85db('0x15')]=_['defaults'](config[_0x85db('0x15')],{'host':_0x85db('0x16'),'port':0x18eb});var socket=require(_0x85db('0x17'))(new Redis(config[_0x85db('0x15')]));require(_0x85db('0x18'))[_0x85db('0x19')](socket);function respondWithStatusCode(_0x2b7507,_0x25ec64){_0x25ec64=_0x25ec64||0xcc;return function(_0x3ca181){if(_0x3ca181){return _0x2b7507[_0x85db('0x1a')](_0x25ec64);}return _0x2b7507[_0x85db('0x1b')](_0x25ec64)[_0x85db('0x1c')]();};}function respondWithResult(_0x2be61d,_0x5ccfef){_0x5ccfef=_0x5ccfef||0xc8;return function(_0x27bd65){if(_0x27bd65){return _0x2be61d[_0x85db('0x1b')](_0x5ccfef)[_0x85db('0x1d')](_0x27bd65);}};}function respondWithFilteredResult(_0xc8fec5,_0x2ecd71){return function(_0x396afa){if(_0x396afa){var _0x3209b3=_0x396afa[_0x85db('0x1e')],_0x56d3b2=_0x2ecd71[_0x85db('0x1f')],_0x37ac04=_0x2ecd71[_0x85db('0x1f')]+_0x2ecd71[_0x85db('0x20')],_0xf89937;if(_0x37ac04>=_0x3209b3){_0x37ac04=_0x3209b3;_0xf89937=0xc8;}else{_0xf89937=0xce;}_0xc8fec5[_0x85db('0x1b')](_0xf89937);return _0xc8fec5[_0x85db('0x21')](_0x85db('0x22'),_0x56d3b2+'-'+_0x37ac04+'/'+_0x3209b3)[_0x85db('0x1d')](_0x396afa);}return null;};}function patchUpdates(_0x5c37d7){return function(_0x36a2af){try{jsonpatch[_0x85db('0x23')](_0x36a2af,_0x5c37d7,!![]);}catch(_0xc812d2){return BPromise[_0x85db('0x24')](_0xc812d2);}return _0x36a2af[_0x85db('0x25')]();};}function saveUpdates(_0x3842d7,_0x3a7148){return function(_0x3ba348){if(_0x3ba348){return _0x3ba348['update'](_0x3842d7)[_0x85db('0x26')](function(_0x2534bc){return _0x2534bc;});}return null;};}function removeEntity(_0x57fe5b,_0x3381ec){return function(_0x28f493){if(_0x28f493){return _0x28f493[_0x85db('0x27')]()['then'](function(){_0x57fe5b[_0x85db('0x1b')](0xcc)[_0x85db('0x1c')]();});}};}function handleEntityNotFound(_0x1b1980,_0x54ba03){return function(_0x5467ad){if(!_0x5467ad){_0x1b1980['sendStatus'](0x194);}return _0x5467ad;};}function handleError(_0x1e4ddb,_0x105bb9){_0x105bb9=_0x105bb9||0x1f4;return function(_0x33448e){logger['error'](_0x33448e[_0x85db('0x28')]);if(_0x33448e[_0x85db('0x29')]){delete _0x33448e[_0x85db('0x29')];}_0x1e4ddb['status'](_0x105bb9)['send'](_0x33448e);};}function getInteractionUsers(_0x299013,_0x137e42){return new BPromise(function(_0x18963a,_0x226540){try{if(_0x137e42[_0x299013['id']]){_0x299013[_0x85db('0x2a')]=_[_0x85db('0x2b')](_0x137e42[_0x299013['id']],function(_0x8af4a4){return{'id':_0x8af4a4['id'],'fullname':_0x8af4a4[_0x85db('0x2c')]};});}}catch(_0x6ee161){_0x226540(_0x6ee161);}_0x18963a(_0x299013);});}function getInteractionTags(_0x1edc8d,_0x580e90){return new BPromise(function(_0x4a15b9,_0x13ad98){try{if(_0x1edc8d['TagIds']){_0x1edc8d[_0x85db('0x2d')]=[];_0x1edc8d[_0x85db('0x2e')]['split'](',')[_0x85db('0x2f')](function(_0x26ca6f){_0x1edc8d[_0x85db('0x2d')][_0x85db('0x30')](_0x580e90[_0x26ca6f]);});}delete _0x1edc8d['TagIds'];}catch(_0x3079fc){_0x13ad98(_0x3079fc);}_0x4a15b9(_0x1edc8d);});}function updateSmsInteraction(_0x25f20f,_0x21a077,_0x41fe15){return new BPromise(function(_0x2ec392,_0x4808a4){return getInteractionUsers(_0x25f20f,_0x41fe15)[_0x85db('0x26')](function(_0x1b7325){return getInteractionTags(_0x1b7325,_0x21a077);})[_0x85db('0x26')](function(_0xd0d27){_0x2ec392(_0xd0d27);})['catch'](function(_0xfe3cd9){_0x4808a4(_0xfe3cd9);});});}exports[_0x85db('0x31')]=function(_0x2a07ee,_0x536398){var _0x550194={},_0x11d5b7={},_0x3639bc={'count':0x0,'rows':[]};var _0x4980b7=_[_0x85db('0x2b')](db[_0x85db('0x32')][_0x85db('0x33')],function(_0x240325){return{'name':_0x240325[_0x85db('0x34')],'type':_0x240325[_0x85db('0x35')][_0x85db('0x36')]};});_0x11d5b7[_0x85db('0x37')]=_[_0x85db('0x2b')](_0x4980b7,_0x85db('0x29'));_0x11d5b7[_0x85db('0x38')]=_[_0x85db('0x39')](_0x2a07ee['query']);_0x11d5b7[_0x85db('0x3a')]=_[_0x85db('0x3b')](_0x11d5b7[_0x85db('0x37')],_0x11d5b7[_0x85db('0x38')]);_0x550194['attributes']=_[_0x85db('0x3b')](_0x11d5b7[_0x85db('0x37')],qs[_0x85db('0x3c')](_0x2a07ee[_0x85db('0x38')]['fields']));_0x550194['attributes']=_0x550194['attributes']['length']?_0x550194['attributes']:_0x11d5b7[_0x85db('0x37')];if(!_0x2a07ee[_0x85db('0x38')][_0x85db('0x3d')](_0x85db('0x3e'))){_0x550194[_0x85db('0x20')]=qs['limit'](_0x2a07ee['query'][_0x85db('0x20')]);_0x550194['offset']=qs[_0x85db('0x1f')](_0x2a07ee[_0x85db('0x38')]['offset']);}_0x550194['order']=qs[_0x85db('0x3f')](_0x2a07ee[_0x85db('0x38')][_0x85db('0x3f')]);_0x550194[_0x85db('0x40')]=qs[_0x85db('0x3a')](_['pick'](_0x2a07ee[_0x85db('0x38')],_0x11d5b7[_0x85db('0x3a')]),_0x4980b7);var _0x115720=[];var _0x5be721=squel['select']()['field']('id')[_0x85db('0x41')](_0x85db('0x29'))[_0x85db('0x41')]('color')['from'](_0x85db('0x42'));var _0x48f3ae=squel[_0x85db('0x43')]()[_0x85db('0x41')](_0x85db('0x44'))['field'](_0x85db('0x45'))[_0x85db('0x41')](_0x85db('0x46'))[_0x85db('0x47')](_0x85db('0x48'),'ui')[_0x85db('0x49')](_0x85db('0x4a'),'u',_0x85db('0x4b'));var _0x15e79a=squel['select']()[_0x85db('0x47')](_0x85db('0x4c'),'i')[_0x85db('0x49')](_0x85db('0x4d'),'c',_0x85db('0x4e'))[_0x85db('0x49')]('users','o',_0x85db('0x4f'))[_0x85db('0x49')](_0x85db('0x50'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x85db('0x51'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x85db('0x49')](_0x85db('0x52'),'it',_0x85db('0x53'))[_0x85db('0x49')](_0x85db('0x42'),'t','t.id\x20=\x20it.TagId');var _0x5d44ef=squel[_0x85db('0x54')]();var _0x8a2d42=[];var _0x8d01f=squel[_0x85db('0x54')]();var _0x1b6157;if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x55')]){_0x1b6157=as[_0x85db('0x56')](_0x2a07ee[_0x85db('0x38')][_0x85db('0x55')]);var _0x5e0f2b=_0x1b6157[_0x85db('0x57')];for(var _0x2c4ae4=0x0;_0x2c4ae4<_0x1b6157['conditions']['length'];_0x2c4ae4++){var _0x8697f5=_0x1b6157[_0x85db('0x58')][_0x2c4ae4];var _0x47f8c2='i';var _0x58f674=_[_0x85db('0x59')](_0x4980b7,[_0x85db('0x29'),_0x8697f5['field']]);if(!_0x58f674){switch(_0x8697f5[_0x85db('0x41')]){case _0x85db('0x5a'):if(_0x8697f5[_0x85db('0x5b')]==0x1){_0x15e79a[_0x85db('0x5c')]('`'+_0x8697f5[_0x85db('0x41')]+_0x85db('0x5d'));}else{_0x15e79a[_0x85db('0x5c')]('`'+_0x8697f5[_0x85db('0x41')]+_0x85db('0x5e'));}break;case _0x85db('0x5f'):if(_0x8697f5['operator']==='$substring'){if(_0x8697f5[_0x85db('0x5b')][_0x85db('0x60')]('\x20')[_0x85db('0x61')]>0x1){_0x5d44ef[_0x5e0f2b](_0x85db('0x62'),qs[_0x85db('0x63')](_0x8697f5[_0x85db('0x5b')]),null);}else{var _0x745266='%'+_0x8697f5[_0x85db('0x5b')]+'%';_0x5d44ef[_0x5e0f2b](_0x85db('0x64'),_0x745266,_0x745266,_0x745266);}}else{_0x58f674=_[_0x85db('0x59')](_0x4980b7,[_0x85db('0x29'),_0x85db('0x65')]);_0x8697f5[_0x85db('0x41')]=_0x85db('0x65');_0x427250=as['buildExpression'](_0x47f8c2,_0x58f674[_0x85db('0x35')],_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250[_0x85db('0x66')],_0x427250['value'][_0x85db('0x67')],_0x427250[_0x85db('0x5b')][_0x85db('0x1c')]);}break;case _0x85db('0x68'):var _0x992a63=_0x8697f5[_0x85db('0x5b')][_0x85db('0x60')](',')['map'](function(_0x35760e){return Number(_0x35760e);});_0x992a63[_0x85db('0x2f')](function(_0x4d7e50){_0x8d01f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4d7e50+',%');});_0x8a2d42=_[_0x85db('0x69')](_0x8a2d42,_0x992a63);break;case'User':if(_0x8697f5[_0x85db('0x6a')]===_0x85db('0x6b')){_0x5d44ef[_0x5e0f2b](_0x85db('0x6c'),'%'+_0x8697f5[_0x85db('0x5b')]+'%',null);}else{_0x58f674=_['find'](_0x4980b7,[_0x85db('0x29'),'UserId']);_0x8697f5['field']='UserId';_0x427250=as[_0x85db('0x6d')](_0x47f8c2,_0x58f674[_0x85db('0x35')],_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250['text'],_0x427250[_0x85db('0x5b')][_0x85db('0x67')],_0x427250['value'][_0x85db('0x1c')]);}break;case _0x85db('0x6e'):_0x427250=as[_0x85db('0x6d')]('me',null,_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250[_0x85db('0x66')],_0x427250[_0x85db('0x5b')][_0x85db('0x67')],_0x427250['value'][_0x85db('0x1c')]);break;}}else{var _0x427250=as[_0x85db('0x6d')](_0x47f8c2,_0x58f674[_0x85db('0x35')],_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250[_0x85db('0x66')],_0x427250[_0x85db('0x5b')][_0x85db('0x67')],_0x427250[_0x85db('0x5b')]['end']);}}}else{var _0x4bf237=_(_0x2a07ee['query'])['keys']()[_0x85db('0x2b')](function(_0x38f37f){return _[_0x85db('0x6f')](_0x4980b7,[_0x85db('0x29'),_0x38f37f])?_0x38f37f:undefined;})[_0x85db('0x70')]()[_0x85db('0x5b')]();if(!_['isEmpty'](_0x4bf237)){_0x4bf237[_0x85db('0x2f')](function(_0x6e3240){if(_0x6e3240===_0x85db('0x71')){_0x15e79a[_0x85db('0x40')]('i.SmsAccountId\x20IN\x20?',[][_0x85db('0x72')](_0x2a07ee[_0x85db('0x38')][_0x6e3240]));}else if(_0x6e3240===_0x85db('0x73')){var _0x1aa93a=JSON[_0x85db('0x74')](_0x2a07ee[_0x85db('0x38')][_0x6e3240])[_0x85db('0x75')];var _0x2af26e=JSON[_0x85db('0x74')](_0x2a07ee[_0x85db('0x38')][_0x6e3240])['$lte'];_0x15e79a[_0x85db('0x40')](_0x85db('0x76'),_0x1aa93a,_0x2af26e);}else{if(_0x2a07ee[_0x85db('0x38')][_0x6e3240]===_0x85db('0x77')){_0x15e79a[_0x85db('0x40')]('i.'+_0x6e3240+'\x20IS\x20NULL');}else{_0x15e79a[_0x85db('0x40')]('i.'+_0x6e3240+_0x85db('0x78'),_0x2a07ee[_0x85db('0x38')][_0x6e3240]);}}});}if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x79')]){if(_0x2a07ee['query'][_0x85db('0x79')]==0x1){_0x15e79a[_0x85db('0x5c')](_0x85db('0x7a'));}else{_0x15e79a['having'](_0x85db('0x7b'));}}if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x7c')]){_0x8a2d42=_['isArray'](_0x2a07ee[_0x85db('0x38')][_0x85db('0x7c')])?_0x2a07ee['query'][_0x85db('0x7c')]:new Array(_0x2a07ee[_0x85db('0x38')][_0x85db('0x7c')]);_0x8a2d42[_0x85db('0x2f')](function(_0x1ee2eb){_0x8d01f['or'](_0x85db('0x7d'),'%,'+_0x1ee2eb+',%');});}if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x7e')]){var _0x22a37a=_0x2a07ee[_0x85db('0x38')][_0x85db('0x7e')][_0x85db('0x7f')]('\x5c','\x5c\x5c')[_0x85db('0x7f')]('\x27\x27',_0x85db('0x80'));if(qs[_0x85db('0x81')](_0x22a37a)){_0x5d44ef['or']('i.id\x20LIKE\x20?',_0x22a37a+'%')['or'](_0x85db('0x82'),_0x22a37a+'%');}else{_0x5d44ef['or'](_0x85db('0x83'),qs[_0x85db('0x63')](_0x22a37a))['or'](_0x85db('0x84'),_0x22a37a+'%');}}}_0x15e79a['where'](_0x5d44ef);_0x15e79a['group'](_0x85db('0x85'));var _0x522a4a={'type':db[_0x85db('0x86')][_0x85db('0x87')][_0x85db('0x88')],'raw':!![]};var _0x59bca4=_0x15e79a[_0x85db('0x89')]();_0x59bca4[_0x85db('0x41')](_0x85db('0x85'));_0x59bca4[_0x85db('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x85db('0x5a'));if(_0x550194['order']){_0x550194[_0x85db('0x8a')][_0x85db('0x2f')](function(_0x78a07c){_0x15e79a[_0x85db('0x8a')]('i.'+_0x78a07c[0x0],_0x78a07c[0x1]===_0x85db('0x8b')?![]:!![]);});}if(!_[_0x85db('0x8c')](_0x8a2d42)){_0x15e79a[_0x85db('0x5c')](_0x8d01f);_0x59bca4[_0x85db('0x40')](_0x85db('0x8d'),_0x8a2d42);}BPromise[_0x85db('0x8e')]()[_0x85db('0x26')](function(){if(!_0x1b6157){if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x71')]||_0x2a07ee['query'][_0x85db('0x8f')])return;_0x59bca4['where'](_0x85db('0x90'));_0x15e79a[_0x85db('0x40')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2a07ee[_0x85db('0x91')][_0x85db('0x92')]({'attributes':['id'],'raw':!![]})[_0x85db('0x26')](function(_0x502300){if(_[_0x85db('0x8c')](_0x502300)){_0x59bca4['where'](_0x85db('0x93'));_0x15e79a['where'](_0x85db('0x93'));}else{_0x59bca4[_0x85db('0x40')]('i.SmsAccountId\x20IN\x20?',_[_0x85db('0x2b')](_0x502300,'id'));_0x15e79a[_0x85db('0x40')](_0x85db('0x94'),_[_0x85db('0x2b')](_0x502300,'id'));}});})[_0x85db('0x26')](function(){db[_0x85db('0x95')]['query'](_0x59bca4[_0x85db('0x96')](),_0x522a4a)[_0x85db('0x26')](function(_0x3eb52c){_0x3639bc['count']=_0x3eb52c[_0x85db('0x61')];if(_0x3639bc[_0x85db('0x1e')]===0x0)return[];return db[_0x85db('0x95')][_0x85db('0x38')](_0x5be721[_0x85db('0x96')](),_0x522a4a)[_0x85db('0x26')](function(_0x13fd5){_0x115720=_[_0x85db('0x97')](_0x13fd5,'id');_0x522a4a=_[_0x85db('0x98')](_0x522a4a,{'model':db[_0x85db('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a07ee[_0x85db('0x38')]['fields']){_0x550194[_0x85db('0x99')][_0x85db('0x2f')](function(_0xdcb072){_0x15e79a['field']('i.'+_0xdcb072);});}else{_0x15e79a[_0x85db('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x85db('0x5a'));_0x15e79a['field'](_0x85db('0x9a'),'Account.key');_0x15e79a[_0x85db('0x41')]('a.mandatoryDisposition',_0x85db('0x9b'));_0x15e79a[_0x85db('0x41')]('i.*');_0x15e79a[_0x85db('0x41')]('c.firstName','Contact.firstName');_0x15e79a[_0x85db('0x41')](_0x85db('0x9c'),_0x85db('0x9d'));_0x15e79a[_0x85db('0x41')](_0x85db('0x9e'),_0x85db('0x9f'));_0x15e79a['field'](_0x85db('0xa0'),_0x85db('0xa1'));_0x15e79a[_0x85db('0x41')](_0x85db('0xa2'),_0x85db('0xa3'));_0x15e79a['field'](_0x85db('0xa4'),'Contact.fax');_0x15e79a[_0x85db('0x41')](_0x85db('0xa5'),_0x85db('0xa6'));_0x15e79a['field']('o.internal',_0x85db('0xa7'));_0x15e79a['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x550194[_0x85db('0x20')])_0x15e79a[_0x85db('0x20')](_0x550194[_0x85db('0x20')]);if(_0x550194[_0x85db('0x1f')])_0x15e79a[_0x85db('0x1f')](_0x550194[_0x85db('0x1f')]);return db[_0x85db('0x95')]['query'](_0x15e79a[_0x85db('0x96')](),_0x522a4a);})[_0x85db('0x26')](function(_0x43d786){_0x48f3ae[_0x85db('0x40')](_0x85db('0xa8'),_[_0x85db('0x2b')](_0x43d786,'id'));return db['sequelize'][_0x85db('0x38')](_0x48f3ae['toString'](),_0x522a4a)['then'](function(_0x15c530){var _0x332cab=_[_0x85db('0xa9')](_0x15c530,_0x85db('0xaa'));var _0x198415=[];_0x43d786[_0x85db('0x2f')](function(_0x8566c3){_0x198415[_0x85db('0x30')](updateSmsInteraction(_0x8566c3,_0x115720,_0x332cab));});return BPromise['all'](_0x198415);});});})[_0x85db('0x26')](function(_0x1d97b9){_0x3639bc[_0x85db('0xab')]=_0x1d97b9;return _0x3639bc;})[_0x85db('0x26')](respondWithFilteredResult(_0x536398,_0x550194));})[_0x85db('0xac')](handleError(_0x536398,null));};exports['show']=function(_0xf6fbf0,_0x392253){var _0x283c67={'raw':![],'where':{'id':_0xf6fbf0[_0x85db('0xad')]['id']}},_0x393ec2={};_0x393ec2['model']=_[_0x85db('0x39')](db[_0x85db('0x32')]['rawAttributes']);_0x393ec2[_0x85db('0x38')]=_[_0x85db('0x39')](_0xf6fbf0[_0x85db('0x38')]);_0x393ec2[_0x85db('0x3a')]=_['intersection'](_0x393ec2[_0x85db('0x37')],_0x393ec2['query']);_0x283c67[_0x85db('0x99')]=_[_0x85db('0x3b')](_0x393ec2[_0x85db('0x37')],qs['fields'](_0xf6fbf0[_0x85db('0x38')][_0x85db('0x3c')]));_0x283c67[_0x85db('0x99')]=_0x283c67[_0x85db('0x99')]['length']?_0x283c67[_0x85db('0x99')]:_0x393ec2['model'];if(_0xf6fbf0[_0x85db('0x38')][_0x85db('0xae')]){_0x283c67['include']=[{'all':!![]}];}_0x283c67=_['merge']({},_0x283c67,_0xf6fbf0[_0x85db('0xaf')]);return db['SmsInteraction'][_0x85db('0x59')](_0x283c67)[_0x85db('0x26')](handleEntityNotFound(_0x392253,null))['then'](respondWithResult(_0x392253,null))[_0x85db('0xac')](handleError(_0x392253,null));};exports[_0x85db('0xb0')]=function(_0xe6ec04,_0x593907){return db['SmsInteraction']['create'](_0xe6ec04[_0x85db('0x6e')],{})[_0x85db('0x26')](respondWithResult(_0x593907,0xc9))[_0x85db('0xac')](handleError(_0x593907,null));};exports[_0x85db('0xb1')]=function(_0x2750a7,_0x4177c9){if(_0x2750a7[_0x85db('0x6e')]['id']){delete _0x2750a7[_0x85db('0x6e')]['id'];}return db[_0x85db('0x32')][_0x85db('0x59')]({'where':{'id':_0x2750a7['params']['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x4177c9,null))[_0x85db('0x26')](saveUpdates(_0x2750a7[_0x85db('0x6e')],null))[_0x85db('0x26')](respondWithResult(_0x4177c9,null))[_0x85db('0xac')](handleError(_0x4177c9,null));};exports[_0x85db('0x27')]=function(_0x3598b7,_0x13aeed){return db['SmsInteraction'][_0x85db('0x59')]({'where':{'id':_0x3598b7[_0x85db('0xad')]['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x13aeed,null))[_0x85db('0x26')](removeEntity(_0x13aeed,null))[_0x85db('0xac')](handleError(_0x13aeed,null));};exports[_0x85db('0xb2')]=function(_0x4ae8c4,_0x836a34){return db[_0x85db('0x32')]['describe']()['then'](respondWithResult(_0x836a34,null))[_0x85db('0xac')](handleError(_0x836a34,null));};exports[_0x85db('0xb3')]=function(_0x19cfa9,_0x4f9d67,_0xb3a075){return db['SmsMessage'][_0x85db('0x59')]({'where':{'id':_0x19cfa9['params']['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x4f9d67,null))[_0x85db('0x26')](function(_0x37314a){if(_0x37314a){return _0x37314a[_0x85db('0xb3')](_0x19cfa9[_0x85db('0x6e')][_0x85db('0xb4')],_[_0x85db('0xb5')](_0x19cfa9[_0x85db('0x6e')],[_0x85db('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x4f9d67,null))[_0x85db('0xac')](handleError(_0x4f9d67,null));};exports[_0x85db('0xb6')]=function(_0x16cd11,_0x5532b0,_0x59ea88){var _0x409f9e={'raw':![],'where':{}};var _0x3c8346={};var _0x106542={'count':0x0,'rows':[]};return db[_0x85db('0x32')][_0x85db('0xb7')]({'where':{'id':_0x16cd11['params']['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x5532b0,null))[_0x85db('0x26')](function(_0x51385c){if(_0x51385c){_0x3c8346[_0x85db('0x37')]=_[_0x85db('0x39')](db[_0x85db('0xb8')][_0x85db('0x33')]);_0x3c8346[_0x85db('0x38')]=_[_0x85db('0x39')](_0x16cd11['query']);_0x3c8346['filters']=_[_0x85db('0x3b')](_0x3c8346[_0x85db('0x37')],_0x3c8346[_0x85db('0x38')]);_0x409f9e[_0x85db('0x99')]=_[_0x85db('0x3b')](_0x3c8346[_0x85db('0x37')],qs[_0x85db('0x3c')](_0x16cd11[_0x85db('0x38')]['fields']));_0x409f9e[_0x85db('0x99')]=_0x409f9e['attributes']['length']?_0x409f9e['attributes']:_0x3c8346['model'];if(!_0x16cd11[_0x85db('0x38')][_0x85db('0x3d')](_0x85db('0x3e'))){_0x409f9e['limit']=qs['limit'](_0x16cd11[_0x85db('0x38')][_0x85db('0x20')]);_0x409f9e[_0x85db('0x1f')]=qs['offset'](_0x16cd11[_0x85db('0x38')][_0x85db('0x1f')]);}_0x409f9e[_0x85db('0x8a')]=qs[_0x85db('0x3f')](_0x16cd11['query'][_0x85db('0x3f')]);_0x409f9e[_0x85db('0x40')]=qs['filters'](_[_0x85db('0xb9')](_0x16cd11[_0x85db('0x38')],_0x3c8346[_0x85db('0x3a')]));_0x409f9e[_0x85db('0x40')]['SmsInteractionId']=_0x51385c['id'];if(_0x16cd11[_0x85db('0x38')][_0x85db('0x7e')]){_0x409f9e[_0x85db('0x40')]=_[_0x85db('0x98')](_0x409f9e['where'],{'$or':_['map'](_0x409f9e['attributes'],function(_0x3f5cd2){var _0xa8f3c6={};_0xa8f3c6[_0x3f5cd2]={'$like':'%'+_0x16cd11[_0x85db('0x38')][_0x85db('0x7e')]+'%'};return _0xa8f3c6;})});}if(_0x16cd11[_0x85db('0x38')][_0x85db('0x75')]){var _0x164cdc=_0x16cd11[_0x85db('0x38')][_0x85db('0x75')]['split'](',');var _0xb82b7f={};_0xb82b7f[_0x164cdc[0x0]]={'$gte':moment(_0x164cdc[0x1])['format'](_0x85db('0xba'))};_0x409f9e[_0x85db('0x40')]=_[_0x85db('0x98')](_0x409f9e[_0x85db('0x40')],_0xb82b7f);}_0x409f9e=_[_0x85db('0x98')]({},_0x409f9e,_0x16cd11[_0x85db('0xaf')]);return db[_0x85db('0xb8')][_0x85db('0x1e')]({'where':_0x409f9e[_0x85db('0x40')]})[_0x85db('0x26')](function(_0x132f92){_0x106542['count']=_0x132f92;if(_0x16cd11['query'][_0x85db('0xae')]){_0x409f9e[_0x85db('0xbb')]=[{'all':!![]}];}return db[_0x85db('0xb8')]['findAll'](_0x409f9e);})[_0x85db('0x26')](function(_0x30e51c){_0x106542[_0x85db('0xab')]=_0x30e51c;return _0x106542;});}})[_0x85db('0x26')](respondWithFilteredResult(_0x5532b0,_0x409f9e))[_0x85db('0xac')](handleError(_0x5532b0,null));};exports[_0x85db('0xbc')]=function(_0x2472f0,_0x1b20a1,_0x2d1739){return db['SmsInteraction'][_0x85db('0x59')]({'where':{'id':_0x2472f0[_0x85db('0xad')]['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x1b20a1,null))[_0x85db('0x26')](function(_0x3fdecd){if(_0x3fdecd){return _0x3fdecd[_0x85db('0xbd')](_0x2472f0[_0x85db('0x6e')]['ids'],_[_0x85db('0xb5')](_0x2472f0[_0x85db('0x6e')],[_0x85db('0xb4'),'id'])||{})[_0x85db('0xbe')](function(){return db['Tag'][_0x85db('0xbf')]({'attributes':['id',_0x85db('0x29'),_0x85db('0xc0')],'where':{'id':_0x2472f0[_0x85db('0x6e')][_0x85db('0xb4')]}});})[_0x85db('0x26')](function(_0x45b430){socket[_0x85db('0xc1')](_0x85db('0xc2'),{'id':Number(_0x2472f0[_0x85db('0xad')]['id']),'tags':_0x45b430||[]});return{'id':Number(_0x2472f0['params']['id']),'tags':_0x45b430||[]};});}})[_0x85db('0x26')](respondWithResult(_0x1b20a1,null))[_0x85db('0xac')](handleError(_0x1b20a1,null));};exports['removeTags']=function(_0x125f6c,_0x91ce6c,_0x13a5a2){return db[_0x85db('0x32')][_0x85db('0x59')]({'where':{'id':_0x125f6c[_0x85db('0xad')]['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x91ce6c,null))[_0x85db('0x26')](function(_0x585bbe){if(_0x585bbe){return _0x585bbe[_0x85db('0xc3')](_0x125f6c[_0x85db('0x38')]['ids']);}})[_0x85db('0x26')](respondWithStatusCode(_0x91ce6c,null))['catch'](handleError(_0x91ce6c,null));};exports['download']=function(_0x45b004,_0x1b1018){var _0x2bd580=moment()[_0x85db('0xc4')]()[_0x85db('0x96')]();var _0x328e4c=path[_0x85db('0xc5')](config['root'],_0x85db('0xc6'),'files',_0x85db('0xc7'));var _0x723186=path[_0x85db('0xc5')](config[_0x85db('0xc8')],_0x85db('0xc6'),'files',_0x85db('0xc9'));var _0x467df0=path['join'](_0x328e4c,_0x2bd580);var _0x21e516=util['format']('transcript-%d-%s.zip',_0x45b004[_0x85db('0xad')]['id'],_0x2bd580);var _0x43c521=path['join'](_0x328e4c,_0x21e516);var _0x3c1c48=[];_0x3c1c48[_0x85db('0x30')]({'model':db[_0x85db('0xca')],'as':'User','attributes':['id',_0x85db('0x2c')],'raw':!![]});_0x3c1c48[_0x85db('0x30')]({'model':db[_0x85db('0xcb')],'as':'Contact','attributes':['id',_0x85db('0xcc'),_0x85db('0xcd')],'raw':!![]});var _0x8121ad=[{'model':db[_0x85db('0xb8')],'as':_0x85db('0xce'),'attributes':['id',_0x85db('0x6e'),_0x85db('0x73'),_0x85db('0xcf'),_0x85db('0xd0'),_0x85db('0x79')],'include':_0x3c1c48}];_0x8121ad[_0x85db('0x30')]({'model':db['SmsAccount'],'as':_0x85db('0xd1'),'attributes':['id','name']});_0x8121ad[_0x85db('0x30')]({'model':db['User'],'as':_0x85db('0xd2'),'attributes':['id',_0x85db('0x2c')]});return db[_0x85db('0x32')][_0x85db('0x59')]({'where':{'id':_0x45b004[_0x85db('0xad')]['id']},'include':_0x8121ad})[_0x85db('0x26')](handleEntityNotFound(_0x1b1018,null))[_0x85db('0x26')](function(_0x1c8b7b){if(_0x1c8b7b){var _0x5cf9f4=_0x1c8b7b[_0x85db('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x467df0);var _0xe94a7a={'format':'A4','border':'10px','header':{'height':_0x85db('0xd4'),'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':_0x85db('0xd5'),'contents':{'default':util[_0x85db('0xd6')](_0x85db('0xd7'),util[_0x85db('0xd6')]('%s\x20#%d',_0x85db('0xd8'),_0x5cf9f4['id']),moment()[_0x85db('0xd6')](_0x85db('0xd9'))[_0x85db('0x96')]())}}};var _0x51c81e={'channel':_0x85db('0xd8'),'account':_0x5cf9f4[_0x85db('0xd1')][_0x85db('0x29')],'agent':_0x5cf9f4[_0x85db('0xd2')]?_0x5cf9f4[_0x85db('0xd2')][_0x85db('0x2c')]:_0x85db('0xda'),'createdAt':moment(_0x5cf9f4[_0x85db('0x73')])['format'](_0x85db('0xba'))['toString'](),'closedAt':_0x5cf9f4[_0x85db('0xdb')]?moment(_0x5cf9f4[_0x85db('0xdc')])['format'](_0x85db('0xba'))[_0x85db('0x96')]():'','disposition':_0x5cf9f4[_0x85db('0xdd')],'messages':_(_0x5cf9f4[_0x85db('0xce')])[_0x85db('0x7e')]({'secret':![]})['map'](function(_0x729d78){return{'date':moment(_0x729d78[_0x85db('0x73')])['format'](_0x85db('0xba'))[_0x85db('0x96')](),'sender':_0x729d78[_0x85db('0xcf')]===_0x85db('0xde')?_0x729d78[_0x85db('0xca')]?_0x729d78[_0x85db('0xca')][_0x85db('0x2c')]:_0x85db('0xdf'):_0x729d78[_0x85db('0x5f')][_0x85db('0xcc')]+(_0x729d78[_0x85db('0x5f')][_0x85db('0xcd')]?'\x20'+_0x729d78[_0x85db('0x5f')][_0x85db('0xcd')]:''),'body':_0x729d78[_0x85db('0x6e')],'direction':_0x729d78[_0x85db('0xcf')]===_0x85db('0xde')?'A':'C','secret':_0x729d78['secret'],'read':_0x729d78['read']};})[_0x85db('0x5b')]()};return ejs[_0x85db('0xe0')](path['join'](config[_0x85db('0xc8')],_0x85db('0xc6'),'views',_0x85db('0xe1')),{'interaction':_0x51c81e})[_0x85db('0x26')](function(_0x478fba){return new BPromise(function(_0x4d08e6,_0x2d604f){pdf[_0x85db('0xb0')](_0x478fba,_0xe94a7a)['toFile'](path['join'](_0x467df0,_0x85db('0xe2')+_0x5cf9f4['id']+'-'+_0x2bd580+_0x85db('0xe3')),function(_0x2e0d08,_0x33d5f9){if(_0x2e0d08)return _0x2d604f(_0x2e0d08);_0x4d08e6(_0x33d5f9);});});})[_0x85db('0x26')](function(){return new BPromise(function(_0x227852,_0x454a34){zipdir(_0x467df0,{'saveTo':_0x43c521},function(_0x46dce1,_0x7fb59e){if(_0x46dce1)return _0x454a34(_0x46dce1);return _0x227852(_0x7fb59e);});})[_0x85db('0x26')](function(){return new BPromise(function(_0x1d3c49,_0x289dc9){rimraf(_0x467df0,function(_0x516d35){if(_0x516d35)_0x289dc9(_0x516d35);return _0x1d3c49();});});})['then'](function(){return _0x1b1018['download'](_0x43c521,_0x21e516,function(_0x57b26a){if(_0x57b26a){console[_0x85db('0xe4')](_0x85db('0xe5'),_0x57b26a);}else{fs[_0x85db('0xe6')](_0x43c521);}});});});}else{return _0x1b1018[_0x85db('0x1a')](0xc8);}})[_0x85db('0xac')](handleError(_0x1b1018,null));}; \ No newline at end of file +var _0xc368=['isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','params','fields','includeAll','include','options','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','rawAttributes','SmsInteractionId','format','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Messages','direction','Account','Owner','get','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','secret','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','name','Users','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','value','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','buildExpression','some','compact'];(function(_0x22959a,_0xaf4020){var _0xcd3554=function(_0x392627){while(--_0x392627){_0x22959a['push'](_0x22959a['shift']());}};_0xcd3554(++_0xaf4020);}(_0xc368,0x7b));var _0x8c36=function(_0x1127bc,_0x4d1a1a){_0x1127bc=_0x1127bc-0x0;var _0x2b4970=_0xc368[_0x1127bc];return _0x2b4970;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c36('0x1'));var jsonpatch=require(_0x8c36('0x2'));var rp=require(_0x8c36('0x3'));var moment=require(_0x8c36('0x4'));var BPromise=require(_0x8c36('0x5'));var Mustache=require('mustache');var util=require(_0x8c36('0x6'));var path=require(_0x8c36('0x7'));var sox=require(_0x8c36('0x8'));var csv=require(_0x8c36('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x9'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var db=require(_0x8c36('0x15'))['db'];config[_0x8c36('0x16')]=_[_0x8c36('0x17')](config[_0x8c36('0x16')],{'host':_0x8c36('0x18'),'port':0x18eb});var socket=require(_0x8c36('0x19'))(new Redis(config[_0x8c36('0x16')]));require(_0x8c36('0x1a'))[_0x8c36('0x1b')](socket);function respondWithStatusCode(_0x220f18,_0x5dfcd5){_0x5dfcd5=_0x5dfcd5||0xcc;return function(_0x31d8bf){if(_0x31d8bf){return _0x220f18['sendStatus'](_0x5dfcd5);}return _0x220f18[_0x8c36('0x1c')](_0x5dfcd5)[_0x8c36('0x1d')]();};}function respondWithResult(_0x29e791,_0x1fc68e){_0x1fc68e=_0x1fc68e||0xc8;return function(_0xcfdbf7){if(_0xcfdbf7){return _0x29e791[_0x8c36('0x1c')](_0x1fc68e)[_0x8c36('0x1e')](_0xcfdbf7);}};}function respondWithFilteredResult(_0x40cecf,_0x30229e){return function(_0x49cafe){if(_0x49cafe){var _0x2be9b0=_0x49cafe[_0x8c36('0x1f')],_0x46ae6e=_0x30229e['offset'],_0x47832a=_0x30229e[_0x8c36('0x20')]+_0x30229e[_0x8c36('0x21')],_0x2d5e5b;if(_0x47832a>=_0x2be9b0){_0x47832a=_0x2be9b0;_0x2d5e5b=0xc8;}else{_0x2d5e5b=0xce;}_0x40cecf[_0x8c36('0x1c')](_0x2d5e5b);return _0x40cecf[_0x8c36('0x22')](_0x8c36('0x23'),_0x46ae6e+'-'+_0x47832a+'/'+_0x2be9b0)[_0x8c36('0x1e')](_0x49cafe);}return null;};}function patchUpdates(_0xfb9763){return function(_0x399d73){try{jsonpatch[_0x8c36('0x24')](_0x399d73,_0xfb9763,!![]);}catch(_0x474c5d){return BPromise[_0x8c36('0x25')](_0x474c5d);}return _0x399d73[_0x8c36('0x26')]();};}function saveUpdates(_0x46645d,_0x51fd6c){return function(_0x5891ef){if(_0x5891ef){return _0x5891ef['update'](_0x46645d)['then'](function(_0x2269f5){return _0x2269f5;});}return null;};}function removeEntity(_0x7effb8,_0x2088aa){return function(_0x2c9e9a){if(_0x2c9e9a){return _0x2c9e9a[_0x8c36('0x27')]()[_0x8c36('0x28')](function(){_0x7effb8['status'](0xcc)[_0x8c36('0x1d')]();});}};}function handleEntityNotFound(_0x49f6f9,_0x40b66f){return function(_0x52b90c){if(!_0x52b90c){_0x49f6f9[_0x8c36('0x29')](0x194);}return _0x52b90c;};}function handleError(_0x1afee4,_0x271ec4){_0x271ec4=_0x271ec4||0x1f4;return function(_0x1010c8){logger['error'](_0x1010c8['stack']);if(_0x1010c8[_0x8c36('0x2a')]){delete _0x1010c8[_0x8c36('0x2a')];}_0x1afee4['status'](_0x271ec4)['send'](_0x1010c8);};}function getInteractionUsers(_0x418663,_0x2b5a8c){return new BPromise(function(_0x502fa3,_0x1280a1){try{if(_0x2b5a8c[_0x418663['id']]){_0x418663[_0x8c36('0x2b')]=_[_0x8c36('0x2c')](_0x2b5a8c[_0x418663['id']],function(_0x4bc057){return{'id':_0x4bc057['id'],'fullname':_0x4bc057['fullname']};});}}catch(_0x46b72f){_0x1280a1(_0x46b72f);}_0x502fa3(_0x418663);});}function getInteractionTags(_0x1531fc,_0x3d7056){return new BPromise(function(_0x192ce3,_0x3ae970){try{if(_0x1531fc[_0x8c36('0x2d')]){_0x1531fc[_0x8c36('0x2e')]=[];_0x1531fc[_0x8c36('0x2d')][_0x8c36('0x2f')](',')[_0x8c36('0x30')](function(_0x35a349){_0x1531fc[_0x8c36('0x2e')][_0x8c36('0x31')](_0x3d7056[_0x35a349]);});}delete _0x1531fc[_0x8c36('0x2d')];}catch(_0x103d26){_0x3ae970(_0x103d26);}_0x192ce3(_0x1531fc);});}function updateSmsInteraction(_0x239fa3,_0x2e6b95,_0x5eae0a){return new BPromise(function(_0x4e8d12,_0x5c110d){return getInteractionUsers(_0x239fa3,_0x5eae0a)[_0x8c36('0x28')](function(_0x2c9a8c){return getInteractionTags(_0x2c9a8c,_0x2e6b95);})[_0x8c36('0x28')](function(_0x2fedd6){_0x4e8d12(_0x2fedd6);})[_0x8c36('0x32')](function(_0x2de1e8){_0x5c110d(_0x2de1e8);});});}exports[_0x8c36('0x33')]=function(_0x5aaab6,_0x17b5e3){var _0x59a4e6={},_0x3def90={},_0x5c743b={'count':0x0,'rows':[]};var _0x43b465=_[_0x8c36('0x2c')](db[_0x8c36('0x34')]['rawAttributes'],function(_0x1f0f9a){return{'name':_0x1f0f9a[_0x8c36('0x35')],'type':_0x1f0f9a[_0x8c36('0x36')][_0x8c36('0x37')]};});_0x3def90[_0x8c36('0x38')]=_[_0x8c36('0x2c')](_0x43b465,_0x8c36('0x2a'));_0x3def90[_0x8c36('0x39')]=_[_0x8c36('0x3a')](_0x5aaab6[_0x8c36('0x39')]);_0x3def90[_0x8c36('0x3b')]=_[_0x8c36('0x3c')](_0x3def90[_0x8c36('0x38')],_0x3def90[_0x8c36('0x39')]);_0x59a4e6[_0x8c36('0x3d')]=_[_0x8c36('0x3c')](_0x3def90[_0x8c36('0x38')],qs['fields'](_0x5aaab6[_0x8c36('0x39')]['fields']));_0x59a4e6[_0x8c36('0x3d')]=_0x59a4e6[_0x8c36('0x3d')][_0x8c36('0x3e')]?_0x59a4e6[_0x8c36('0x3d')]:_0x3def90['model'];if(!_0x5aaab6['query'][_0x8c36('0x3f')](_0x8c36('0x40'))){_0x59a4e6[_0x8c36('0x21')]=qs['limit'](_0x5aaab6['query'][_0x8c36('0x21')]);_0x59a4e6['offset']=qs['offset'](_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x20')]);}_0x59a4e6[_0x8c36('0x41')]=qs[_0x8c36('0x42')](_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x42')]);_0x59a4e6[_0x8c36('0x43')]=qs[_0x8c36('0x3b')](_[_0x8c36('0x44')](_0x5aaab6[_0x8c36('0x39')],_0x3def90['filters']),_0x43b465);var _0x3543b0=[];var _0x24505c=squel[_0x8c36('0x45')]()[_0x8c36('0x46')]('id')[_0x8c36('0x46')]('name')[_0x8c36('0x46')](_0x8c36('0x47'))[_0x8c36('0x48')](_0x8c36('0x49'));var _0x62a72=squel[_0x8c36('0x45')]()['field'](_0x8c36('0x4a'))[_0x8c36('0x46')](_0x8c36('0x4b'))[_0x8c36('0x46')](_0x8c36('0x4c'))[_0x8c36('0x48')](_0x8c36('0x4d'),'ui')['left_join'](_0x8c36('0x4e'),'u',_0x8c36('0x4f'));var _0x9d2165=squel[_0x8c36('0x45')]()[_0x8c36('0x48')](_0x8c36('0x50'),'i')[_0x8c36('0x51')](_0x8c36('0x52'),'c',_0x8c36('0x53'))[_0x8c36('0x51')](_0x8c36('0x4e'),'o',_0x8c36('0x54'))['left_join']('sms_accounts','a',_0x8c36('0x55'))[_0x8c36('0x51')](_0x8c36('0x56'),'me',_0x8c36('0x57'))['left_join'](_0x8c36('0x58'),'it',_0x8c36('0x59'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0xb4ebae=squel[_0x8c36('0x5a')]();var _0x3297f1=[];var _0x197d11=squel[_0x8c36('0x5a')]();var _0x2778b3;if(_0x5aaab6['query'][_0x8c36('0x5b')]){_0x2778b3=as[_0x8c36('0x5c')](_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x5b')]);var _0x579bef=_0x2778b3['sqlOperator'];for(var _0x599116=0x0;_0x599116<_0x2778b3[_0x8c36('0x5d')][_0x8c36('0x3e')];_0x599116++){var _0x2fc48b=_0x2778b3[_0x8c36('0x5d')][_0x599116];var _0x24f3f9='i';var _0x3d5e0d=_[_0x8c36('0x5e')](_0x43b465,[_0x8c36('0x2a'),_0x2fc48b[_0x8c36('0x46')]]);if(!_0x3d5e0d){switch(_0x2fc48b['field']){case'unreadMessages':if(_0x2fc48b[_0x8c36('0x5f')]==0x1){_0x9d2165['having']('`'+_0x2fc48b['field']+_0x8c36('0x60'));}else{_0x9d2165['having']('`'+_0x2fc48b[_0x8c36('0x46')]+_0x8c36('0x61'));}break;case'Contact':if(_0x2fc48b[_0x8c36('0x62')]==='$substring'){if(_0x2fc48b[_0x8c36('0x5f')][_0x8c36('0x2f')]('\x20')[_0x8c36('0x3e')]>0x1){_0xb4ebae[_0x579bef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8c36('0x63')](_0x2fc48b[_0x8c36('0x5f')]),null);}else{var _0x2e1e03='%'+_0x2fc48b[_0x8c36('0x5f')]+'%';_0xb4ebae[_0x579bef](_0x8c36('0x64'),_0x2e1e03,_0x2e1e03,_0x2e1e03);}}else{_0x3d5e0d=_[_0x8c36('0x5e')](_0x43b465,[_0x8c36('0x2a'),_0x8c36('0x65')]);_0x2fc48b[_0x8c36('0x46')]='ContactId';_0xe59f9b=as['buildExpression'](_0x24f3f9,_0x3d5e0d['type'],_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b[_0x8c36('0x66')],_0xe59f9b['value']['start'],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x1d')]);}break;case _0x8c36('0x67'):var _0x444c36=_0x2fc48b[_0x8c36('0x5f')]['split'](',')['map'](function(_0x54c675){return Number(_0x54c675);});_0x444c36[_0x8c36('0x30')](function(_0x243c1a){_0x197d11['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x243c1a+',%');});_0x3297f1=_[_0x8c36('0x68')](_0x3297f1,_0x444c36);break;case _0x8c36('0x69'):if(_0x2fc48b[_0x8c36('0x62')]===_0x8c36('0x6a')){_0xb4ebae[_0x579bef](_0x8c36('0x6b'),'%'+_0x2fc48b[_0x8c36('0x5f')]+'%',null);}else{_0x3d5e0d=_[_0x8c36('0x5e')](_0x43b465,[_0x8c36('0x2a'),_0x8c36('0x6c')]);_0x2fc48b['field']='UserId';_0xe59f9b=as['buildExpression'](_0x24f3f9,_0x3d5e0d[_0x8c36('0x36')],_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b[_0x8c36('0x66')],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x6d')],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x1d')]);}break;case'body':_0xe59f9b=as[_0x8c36('0x6e')]('me',null,_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b['text'],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x6d')],_0xe59f9b[_0x8c36('0x5f')]['end']);break;}}else{var _0xe59f9b=as['buildExpression'](_0x24f3f9,_0x3d5e0d[_0x8c36('0x36')],_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b[_0x8c36('0x66')],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x6d')],_0xe59f9b[_0x8c36('0x5f')]['end']);}}}else{var _0x61b2b7=_(_0x5aaab6['query'])[_0x8c36('0x3a')]()[_0x8c36('0x2c')](function(_0x59cceb){return _[_0x8c36('0x6f')](_0x43b465,[_0x8c36('0x2a'),_0x59cceb])?_0x59cceb:undefined;})[_0x8c36('0x70')]()['value']();if(!_[_0x8c36('0x71')](_0x61b2b7)){_0x61b2b7[_0x8c36('0x30')](function(_0x43d4d3){if(_0x43d4d3===_0x8c36('0x72')){_0x9d2165['where'](_0x8c36('0x73'),[][_0x8c36('0x74')](_0x5aaab6['query'][_0x43d4d3]));}else if(_0x43d4d3===_0x8c36('0x75')){var _0x1bfe8c=JSON[_0x8c36('0x76')](_0x5aaab6['query'][_0x43d4d3])[_0x8c36('0x77')];var _0x115a51=JSON['parse'](_0x5aaab6[_0x8c36('0x39')][_0x43d4d3])[_0x8c36('0x78')];_0x9d2165[_0x8c36('0x43')](_0x8c36('0x79'),_0x1bfe8c,_0x115a51);}else{if(_0x5aaab6['query'][_0x43d4d3]===_0x8c36('0x7a')){_0x9d2165['where']('i.'+_0x43d4d3+_0x8c36('0x7b'));}else{_0x9d2165[_0x8c36('0x43')]('i.'+_0x43d4d3+'\x20=\x20?',_0x5aaab6[_0x8c36('0x39')][_0x43d4d3]);}}});}if(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7c')]){if(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7c')]==0x1){_0x9d2165[_0x8c36('0x7d')](_0x8c36('0x7e'));}else{_0x9d2165[_0x8c36('0x7d')]('`unreadMessages`\x20>\x200');}}if(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7f')]){_0x3297f1=_[_0x8c36('0x80')](_0x5aaab6['query'][_0x8c36('0x7f')])?_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7f')]:new Array(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7f')]);_0x3297f1['forEach'](function(_0x291a1f){_0x197d11['or'](_0x8c36('0x81'),'%,'+_0x291a1f+',%');});}if(_0x5aaab6[_0x8c36('0x39')]['filter']){var _0x29581d=_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x82')][_0x8c36('0x83')]('\x5c','\x5c\x5c')[_0x8c36('0x83')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x8c36('0x84')](_0x29581d)){_0xb4ebae['or'](_0x8c36('0x85'),_0x29581d+'%')['or'](_0x8c36('0x86'),_0x29581d+'%');}else{_0xb4ebae['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8c36('0x63')](_0x29581d))['or'](_0x8c36('0x87'),_0x29581d+'%');}}}_0x9d2165[_0x8c36('0x43')](_0xb4ebae);_0x9d2165[_0x8c36('0x88')](_0x8c36('0x89'));var _0x114dcc={'type':db[_0x8c36('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4b193f=_0x9d2165[_0x8c36('0x8b')]();_0x4b193f[_0x8c36('0x46')](_0x8c36('0x89'));_0x4b193f[_0x8c36('0x46')](_0x8c36('0x8c'),_0x8c36('0x8d'));if(_0x59a4e6[_0x8c36('0x41')]){_0x59a4e6[_0x8c36('0x41')][_0x8c36('0x30')](function(_0x26a80a){_0x9d2165[_0x8c36('0x41')]('i.'+_0x26a80a[0x0],_0x26a80a[0x1]===_0x8c36('0x8e')?![]:!![]);});}if(!_[_0x8c36('0x71')](_0x3297f1)){_0x9d2165[_0x8c36('0x7d')](_0x197d11);_0x4b193f[_0x8c36('0x43')](_0x8c36('0x8f'),_0x3297f1);}BPromise[_0x8c36('0x90')]()[_0x8c36('0x28')](function(){if(!_0x2778b3){if(_0x5aaab6['query'][_0x8c36('0x72')]||_0x5aaab6['query']['journey'])return;_0x4b193f[_0x8c36('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x9d2165[_0x8c36('0x43')](_0x8c36('0x91'));return;}return _0x5aaab6[_0x8c36('0x92')][_0x8c36('0x93')]({'attributes':['id'],'raw':!![]})[_0x8c36('0x28')](function(_0x438224){if(_[_0x8c36('0x71')](_0x438224)){_0x4b193f['where']('i.SmsAccountId\x20IS\x20NULL');_0x9d2165[_0x8c36('0x43')](_0x8c36('0x94'));}else{_0x4b193f['where'](_0x8c36('0x73'),_[_0x8c36('0x2c')](_0x438224,'id'));_0x9d2165[_0x8c36('0x43')](_0x8c36('0x73'),_['map'](_0x438224,'id'));}});})[_0x8c36('0x28')](function(){db[_0x8c36('0x95')][_0x8c36('0x39')](_0x4b193f[_0x8c36('0x96')](),_0x114dcc)[_0x8c36('0x28')](function(_0x431a8e){_0x5c743b['count']=_0x431a8e[_0x8c36('0x3e')];if(_0x5c743b[_0x8c36('0x1f')]===0x0)return[];return db[_0x8c36('0x95')][_0x8c36('0x39')](_0x24505c[_0x8c36('0x96')](),_0x114dcc)[_0x8c36('0x28')](function(_0x257c2a){_0x3543b0=_[_0x8c36('0x97')](_0x257c2a,'id');_0x114dcc=_[_0x8c36('0x98')](_0x114dcc,{'model':db[_0x8c36('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5aaab6['query']['fields']){_0x59a4e6[_0x8c36('0x3d')]['forEach'](function(_0x4dbf66){_0x9d2165[_0x8c36('0x46')]('i.'+_0x4dbf66);});}else{_0x9d2165[_0x8c36('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8c36('0x8d'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0x99'),_0x8c36('0x9a'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0x9b'),'Account.mandatoryDisposition');_0x9d2165['field'](_0x8c36('0x9c'));_0x9d2165[_0x8c36('0x46')]('c.firstName',_0x8c36('0x9d'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0x9e'),_0x8c36('0x9f'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa0'),'Contact.email');_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa1'),_0x8c36('0xa2'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa3'),_0x8c36('0xa4'));_0x9d2165['field']('c.fax',_0x8c36('0xa5'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa6'),_0x8c36('0xa7'));_0x9d2165[_0x8c36('0x46')]('o.internal','Owner.internal');_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa8'),_0x8c36('0x2d'));}if(_0x59a4e6['limit'])_0x9d2165[_0x8c36('0x21')](_0x59a4e6[_0x8c36('0x21')]);if(_0x59a4e6[_0x8c36('0x20')])_0x9d2165[_0x8c36('0x20')](_0x59a4e6[_0x8c36('0x20')]);return db[_0x8c36('0x95')][_0x8c36('0x39')](_0x9d2165[_0x8c36('0x96')](),_0x114dcc);})[_0x8c36('0x28')](function(_0x440eed){_0x62a72[_0x8c36('0x43')](_0x8c36('0xa9'),_['map'](_0x440eed,'id'));return db[_0x8c36('0x95')][_0x8c36('0x39')](_0x62a72['toString'](),_0x114dcc)['then'](function(_0xe69b4a){var _0x2b9027=_[_0x8c36('0xaa')](_0xe69b4a,'SmsInteractionId');var _0x7d675c=[];_0x440eed[_0x8c36('0x30')](function(_0x1743a4){_0x7d675c[_0x8c36('0x31')](updateSmsInteraction(_0x1743a4,_0x3543b0,_0x2b9027));});return BPromise['all'](_0x7d675c);});});})[_0x8c36('0x28')](function(_0x2a7321){_0x5c743b['rows']=_0x2a7321;return _0x5c743b;})[_0x8c36('0x28')](respondWithFilteredResult(_0x17b5e3,_0x59a4e6));})[_0x8c36('0x32')](handleError(_0x17b5e3,null));};exports['show']=function(_0x413519,_0x35ce4a){var _0x3f1102={'raw':![],'where':{'id':_0x413519[_0x8c36('0xab')]['id']}},_0x42fa00={};_0x42fa00[_0x8c36('0x38')]=_[_0x8c36('0x3a')](db['SmsInteraction']['rawAttributes']);_0x42fa00['query']=_[_0x8c36('0x3a')](_0x413519[_0x8c36('0x39')]);_0x42fa00[_0x8c36('0x3b')]=_[_0x8c36('0x3c')](_0x42fa00[_0x8c36('0x38')],_0x42fa00[_0x8c36('0x39')]);_0x3f1102['attributes']=_[_0x8c36('0x3c')](_0x42fa00[_0x8c36('0x38')],qs[_0x8c36('0xac')](_0x413519[_0x8c36('0x39')]['fields']));_0x3f1102['attributes']=_0x3f1102[_0x8c36('0x3d')][_0x8c36('0x3e')]?_0x3f1102[_0x8c36('0x3d')]:_0x42fa00['model'];if(_0x413519[_0x8c36('0x39')][_0x8c36('0xad')]){_0x3f1102[_0x8c36('0xae')]=[{'all':!![]}];}_0x3f1102=_['merge']({},_0x3f1102,_0x413519[_0x8c36('0xaf')]);return db['SmsInteraction'][_0x8c36('0x5e')](_0x3f1102)[_0x8c36('0x28')](handleEntityNotFound(_0x35ce4a,null))['then'](respondWithResult(_0x35ce4a,null))[_0x8c36('0x32')](handleError(_0x35ce4a,null));};exports[_0x8c36('0xb0')]=function(_0x363065,_0x312b13){return db[_0x8c36('0x34')][_0x8c36('0xb0')](_0x363065[_0x8c36('0xb1')],{})[_0x8c36('0x28')](respondWithResult(_0x312b13,0xc9))['catch'](handleError(_0x312b13,null));};exports['update']=function(_0x105057,_0x3a237b){if(_0x105057[_0x8c36('0xb1')]['id']){delete _0x105057['body']['id'];}return db[_0x8c36('0x34')][_0x8c36('0x5e')]({'where':{'id':_0x105057['params']['id']}})['then'](handleEntityNotFound(_0x3a237b,null))[_0x8c36('0x28')](saveUpdates(_0x105057[_0x8c36('0xb1')],null))['then'](respondWithResult(_0x3a237b,null))[_0x8c36('0x32')](handleError(_0x3a237b,null));};exports[_0x8c36('0x27')]=function(_0x216e87,_0x2e800a){return db['SmsInteraction'][_0x8c36('0x5e')]({'where':{'id':_0x216e87[_0x8c36('0xab')]['id']}})[_0x8c36('0x28')](handleEntityNotFound(_0x2e800a,null))[_0x8c36('0x28')](removeEntity(_0x2e800a,null))['catch'](handleError(_0x2e800a,null));};exports[_0x8c36('0xb2')]=function(_0x14e96b,_0x40a276){return db[_0x8c36('0x34')][_0x8c36('0xb2')]()['then'](respondWithResult(_0x40a276,null))[_0x8c36('0x32')](handleError(_0x40a276,null));};exports[_0x8c36('0xb3')]=function(_0x4423dc,_0x52ea62,_0x253db3){return db[_0x8c36('0xb4')][_0x8c36('0x5e')]({'where':{'id':_0x4423dc['params']['id']}})['then'](handleEntityNotFound(_0x52ea62,null))['then'](function(_0x5ba123){if(_0x5ba123){return _0x5ba123[_0x8c36('0xb3')](_0x4423dc['body']['ids'],_[_0x8c36('0xb5')](_0x4423dc['body'],[_0x8c36('0xb6'),'id'])||{});}})[_0x8c36('0x28')](respondWithResult(_0x52ea62,null))[_0x8c36('0x32')](handleError(_0x52ea62,null));};exports[_0x8c36('0xb7')]=function(_0x5887ec,_0x36b1c9,_0xe60a72){var _0x1d4988={'raw':![],'where':{}};var _0x4a308f={};var _0x397deb={'count':0x0,'rows':[]};return db[_0x8c36('0x34')][_0x8c36('0xb8')]({'where':{'id':_0x5887ec[_0x8c36('0xab')]['id']}})[_0x8c36('0x28')](handleEntityNotFound(_0x36b1c9,null))[_0x8c36('0x28')](function(_0x323618){if(_0x323618){_0x4a308f['model']=_[_0x8c36('0x3a')](db[_0x8c36('0xb4')][_0x8c36('0xb9')]);_0x4a308f[_0x8c36('0x39')]=_[_0x8c36('0x3a')](_0x5887ec[_0x8c36('0x39')]);_0x4a308f[_0x8c36('0x3b')]=_[_0x8c36('0x3c')](_0x4a308f[_0x8c36('0x38')],_0x4a308f[_0x8c36('0x39')]);_0x1d4988[_0x8c36('0x3d')]=_[_0x8c36('0x3c')](_0x4a308f['model'],qs['fields'](_0x5887ec[_0x8c36('0x39')][_0x8c36('0xac')]));_0x1d4988[_0x8c36('0x3d')]=_0x1d4988[_0x8c36('0x3d')][_0x8c36('0x3e')]?_0x1d4988[_0x8c36('0x3d')]:_0x4a308f[_0x8c36('0x38')];if(!_0x5887ec['query']['hasOwnProperty']('nolimit')){_0x1d4988[_0x8c36('0x21')]=qs[_0x8c36('0x21')](_0x5887ec[_0x8c36('0x39')][_0x8c36('0x21')]);_0x1d4988['offset']=qs[_0x8c36('0x20')](_0x5887ec[_0x8c36('0x39')][_0x8c36('0x20')]);}_0x1d4988[_0x8c36('0x41')]=qs[_0x8c36('0x42')](_0x5887ec[_0x8c36('0x39')][_0x8c36('0x42')]);_0x1d4988['where']=qs[_0x8c36('0x3b')](_[_0x8c36('0x44')](_0x5887ec[_0x8c36('0x39')],_0x4a308f[_0x8c36('0x3b')]));_0x1d4988[_0x8c36('0x43')][_0x8c36('0xba')]=_0x323618['id'];if(_0x5887ec[_0x8c36('0x39')][_0x8c36('0x82')]){_0x1d4988['where']=_[_0x8c36('0x98')](_0x1d4988[_0x8c36('0x43')],{'$or':_[_0x8c36('0x2c')](_0x1d4988[_0x8c36('0x3d')],function(_0xe1d9ab){var _0x511b31={};_0x511b31[_0xe1d9ab]={'$like':'%'+_0x5887ec[_0x8c36('0x39')][_0x8c36('0x82')]+'%'};return _0x511b31;})});}if(_0x5887ec[_0x8c36('0x39')][_0x8c36('0x77')]){var _0x416405=_0x5887ec[_0x8c36('0x39')][_0x8c36('0x77')][_0x8c36('0x2f')](',');var _0x56c11f={};_0x56c11f[_0x416405[0x0]]={'$gte':moment(_0x416405[0x1])[_0x8c36('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d4988['where']=_['merge'](_0x1d4988[_0x8c36('0x43')],_0x56c11f);}_0x1d4988=_[_0x8c36('0x98')]({},_0x1d4988,_0x5887ec[_0x8c36('0xaf')]);return db['SmsMessage'][_0x8c36('0x1f')]({'where':_0x1d4988[_0x8c36('0x43')]})[_0x8c36('0x28')](function(_0x53106c){_0x397deb['count']=_0x53106c;if(_0x5887ec[_0x8c36('0x39')]['includeAll']){_0x1d4988[_0x8c36('0xae')]=[{'all':!![]}];}return db[_0x8c36('0xb4')][_0x8c36('0xbc')](_0x1d4988);})['then'](function(_0xcb42e){_0x397deb[_0x8c36('0xbd')]=_0xcb42e;return _0x397deb;});}})[_0x8c36('0x28')](respondWithFilteredResult(_0x36b1c9,_0x1d4988))['catch'](handleError(_0x36b1c9,null));};exports[_0x8c36('0xbe')]=function(_0x6cb232,_0xb38f74,_0x2da99c){return db[_0x8c36('0x34')][_0x8c36('0x5e')]({'where':{'id':_0x6cb232['params']['id']}})[_0x8c36('0x28')](handleEntityNotFound(_0xb38f74,null))[_0x8c36('0x28')](function(_0x3a9951){if(_0x3a9951){return _0x3a9951[_0x8c36('0xbf')](_0x6cb232[_0x8c36('0xb1')]['ids'],_['omit'](_0x6cb232['body'],['ids','id'])||{})[_0x8c36('0xc0')](function(){return db['Tag'][_0x8c36('0xbc')]({'attributes':['id',_0x8c36('0x2a'),_0x8c36('0x47')],'where':{'id':_0x6cb232['body'][_0x8c36('0xb6')]}});})['then'](function(_0x21120c){socket[_0x8c36('0xc1')](_0x8c36('0xc2'),{'id':Number(_0x6cb232[_0x8c36('0xab')]['id']),'tags':_0x21120c||[]});return{'id':Number(_0x6cb232[_0x8c36('0xab')]['id']),'tags':_0x21120c||[]};});}})[_0x8c36('0x28')](respondWithResult(_0xb38f74,null))[_0x8c36('0x32')](handleError(_0xb38f74,null));};exports[_0x8c36('0xc3')]=function(_0x4de9c8,_0x47194d,_0x54967c){return db[_0x8c36('0x34')]['find']({'where':{'id':_0x4de9c8['params']['id']}})['then'](handleEntityNotFound(_0x47194d,null))[_0x8c36('0x28')](function(_0x4d322c){if(_0x4d322c){return _0x4d322c[_0x8c36('0xc3')](_0x4de9c8['query'][_0x8c36('0xb6')]);}})[_0x8c36('0x28')](respondWithStatusCode(_0x47194d,null))[_0x8c36('0x32')](handleError(_0x47194d,null));};exports[_0x8c36('0xc4')]=function(_0x2cc362,_0xd2a10e){var _0x222824=moment()['unix']()['toString']();var _0x376e64=path[_0x8c36('0xc5')](config[_0x8c36('0xc6')],_0x8c36('0xc7'),_0x8c36('0xc8'),'tmp');var _0x5466bc=path[_0x8c36('0xc5')](config['root'],_0x8c36('0xc7'),_0x8c36('0xc8'),_0x8c36('0xc9'));var _0x2c76f8=path['join'](_0x376e64,_0x222824);var _0x76be11=util[_0x8c36('0xbb')](_0x8c36('0xca'),_0x2cc362[_0x8c36('0xab')]['id'],_0x222824);var _0x3fa94a=path['join'](_0x376e64,_0x76be11);var _0x1e41d9=[];_0x1e41d9[_0x8c36('0x31')]({'model':db['User'],'as':_0x8c36('0x69'),'attributes':['id',_0x8c36('0xcb')],'raw':!![]});_0x1e41d9[_0x8c36('0x31')]({'model':db[_0x8c36('0xcc')],'as':_0x8c36('0xcd'),'attributes':['id',_0x8c36('0xce'),_0x8c36('0xcf')],'raw':!![]});var _0x44285d=[{'model':db[_0x8c36('0xb4')],'as':_0x8c36('0xd0'),'attributes':['id',_0x8c36('0xb1'),_0x8c36('0x75'),_0x8c36('0xd1'),'secret','read'],'include':_0x1e41d9}];_0x44285d['push']({'model':db['SmsAccount'],'as':_0x8c36('0xd2'),'attributes':['id',_0x8c36('0x2a')]});_0x44285d[_0x8c36('0x31')]({'model':db['User'],'as':_0x8c36('0xd3'),'attributes':['id',_0x8c36('0xcb')]});return db[_0x8c36('0x34')]['find']({'where':{'id':_0x2cc362[_0x8c36('0xab')]['id']},'include':_0x44285d})[_0x8c36('0x28')](handleEntityNotFound(_0xd2a10e,null))[_0x8c36('0x28')](function(_0x1f8f87){if(_0x1f8f87){var _0x2326d8=_0x1f8f87[_0x8c36('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x2c76f8);var _0x2adf71={'format':'A4','border':_0x8c36('0xd5'),'header':{'height':'40px','contents':{'first':_0x8c36('0xd6')}},'footer':{'height':_0x8c36('0xd7'),'contents':{'default':util[_0x8c36('0xbb')](_0x8c36('0xd8'),util[_0x8c36('0xbb')](_0x8c36('0xd9'),_0x8c36('0xda'),_0x2326d8['id']),moment()['format'](_0x8c36('0xdb'))[_0x8c36('0x96')]())}}};var _0x4b4060={'channel':_0x8c36('0xda'),'account':_0x2326d8['Account'][_0x8c36('0x2a')],'agent':_0x2326d8[_0x8c36('0xd3')]?_0x2326d8[_0x8c36('0xd3')][_0x8c36('0xcb')]:_0x8c36('0xdc'),'createdAt':moment(_0x2326d8[_0x8c36('0x75')])[_0x8c36('0xbb')](_0x8c36('0xdd'))[_0x8c36('0x96')](),'closedAt':_0x2326d8[_0x8c36('0xde')]?moment(_0x2326d8[_0x8c36('0xdf')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8c36('0x96')]():'','disposition':_0x2326d8[_0x8c36('0xe0')],'messages':_(_0x2326d8[_0x8c36('0xd0')])['filter']({'secret':![]})[_0x8c36('0x2c')](function(_0xd3dc5a){return{'date':moment(_0xd3dc5a['createdAt'])[_0x8c36('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8c36('0x96')](),'sender':_0xd3dc5a['direction']===_0x8c36('0xe1')?_0xd3dc5a[_0x8c36('0x69')]?_0xd3dc5a['User'][_0x8c36('0xcb')]:_0x8c36('0xe2'):_0xd3dc5a[_0x8c36('0xcd')][_0x8c36('0xce')]+(_0xd3dc5a[_0x8c36('0xcd')][_0x8c36('0xcf')]?'\x20'+_0xd3dc5a['Contact'][_0x8c36('0xcf')]:''),'body':_0xd3dc5a['body'],'direction':_0xd3dc5a[_0x8c36('0xd1')]==='out'?'A':'C','secret':_0xd3dc5a[_0x8c36('0xe3')],'read':_0xd3dc5a[_0x8c36('0x7c')]};})['value']()};return ejs[_0x8c36('0xe4')](path['join'](config[_0x8c36('0xc6')],_0x8c36('0xc7'),'views',_0x8c36('0xe5')),{'interaction':_0x4b4060})[_0x8c36('0x28')](function(_0x242409){return new BPromise(function(_0x101369,_0x31c8f8){pdf[_0x8c36('0xb0')](_0x242409,_0x2adf71)[_0x8c36('0xe6')](path[_0x8c36('0xc5')](_0x2c76f8,_0x8c36('0xe7')+_0x2326d8['id']+'-'+_0x222824+_0x8c36('0xe8')),function(_0x1e729c,_0x5148d9){if(_0x1e729c)return _0x31c8f8(_0x1e729c);_0x101369(_0x5148d9);});});})['then'](function(){return new BPromise(function(_0x3143b2,_0x2d6b7e){zipdir(_0x2c76f8,{'saveTo':_0x3fa94a},function(_0xecf066,_0x15ec96){if(_0xecf066)return _0x2d6b7e(_0xecf066);return _0x3143b2(_0x15ec96);});})['then'](function(){return new BPromise(function(_0x285a25,_0xbe4063){rimraf(_0x2c76f8,function(_0x484829){if(_0x484829)_0xbe4063(_0x484829);return _0x285a25();});});})[_0x8c36('0x28')](function(){return _0xd2a10e['download'](_0x3fa94a,_0x76be11,function(_0x441465){if(_0x441465){console[_0x8c36('0xe9')](_0x8c36('0xea'),_0x441465);}else{fs[_0x8c36('0xeb')](_0x3fa94a);}});});});}else{return _0xd2a10e['sendStatus'](0xc8);}})[_0x8c36('0x32')](handleError(_0xd2a10e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 2bf9a41..5fdec62 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 _0x46ed=['catch','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0xbbd664,_0x671b9f){var _0x5ab71b=function(_0x2155c7){while(--_0x2155c7){_0xbbd664['push'](_0xbbd664['shift']());}};_0x5ab71b(++_0x671b9f);}(_0x46ed,0x168));var _0xd46e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46ed[_0x36ed48];return _0x51c63a;};'use strict';var EventEmitter=require(_0xd46e('0x0'));var SmsInteraction=require(_0xd46e('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xd46e('0x1'))['db'][_0xd46e('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xd46e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd46e('0x4'),'afterDestroy':_0xd46e('0x5')};function emitEvent(_0x54ef98){return function(_0x15c96e,_0x1926d9,_0x160bcf){_0x15c96e[_0xd46e('0x6')]({'attributes':['id'],'raw':!![]})[_0xd46e('0x7')](function(_0x855f24){_0x15c96e[_0xd46e('0x8')](_0xd46e('0x9'),_0x855f24[_0xd46e('0xa')](function(_0x19e4f4){return{'id':_0x19e4f4['id']};}));return SmsMessage[_0xd46e('0xb')]({'where':{'SmsInteractionId':_0x15c96e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x7b2d69){_0x15c96e[_0xd46e('0x8')]('unreadMessages',_0x7b2d69[_0xd46e('0xc')]);SmsInteractionEvents[_0xd46e('0xd')](_0x54ef98+':'+_0x15c96e['id'],_0x15c96e);SmsInteractionEvents[_0xd46e('0xd')](_0x54ef98,_0x15c96e);_0x160bcf(null);})[_0xd46e('0xe')](_0x160bcf(null));};}for(var e in events){if(events[_0xd46e('0xf')](e)){var event=events[e];SmsInteraction[_0xd46e('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x85d0=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','SmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85d0,0x164));var _0x085d=function(_0x17f67e,_0x54a826){_0x17f67e=_0x17f67e-0x0;var _0xbddbe0=_0x85d0[_0x17f67e];return _0xbddbe0;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x085d('0x0')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x085d('0x1')](0x0);var events={'afterCreate':_0x085d('0x2'),'afterUpdate':_0x085d('0x3'),'afterDestroy':_0x085d('0x4')};function emitEvent(_0x19ae4c){return function(_0x4818c1,_0x2f37ca,_0x5c917f){_0x4818c1[_0x085d('0x5')]({'attributes':['id'],'raw':!![]})[_0x085d('0x6')](function(_0x2a6902){_0x4818c1['setDataValue'](_0x085d('0x7'),_0x2a6902[_0x085d('0x8')](function(_0x210aa0){return{'id':_0x210aa0['id']};}));return SmsMessage[_0x085d('0x9')]({'where':{'SmsInteractionId':_0x4818c1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x085d('0x6')](function(_0x6450ab){_0x4818c1[_0x085d('0xa')](_0x085d('0xb'),_0x6450ab[_0x085d('0xc')]);SmsInteractionEvents['emit'](_0x19ae4c+':'+_0x4818c1['id'],_0x4818c1);SmsInteractionEvents[_0x085d('0xd')](_0x19ae4c,_0x4818c1);_0x5c917f(null);})[_0x085d('0xe')](_0x5c917f(null));};}for(var e in events){if(events[_0x085d('0xf')](e)){var event=events[e];SmsInteraction[_0x085d('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index db54f7f..4fc8529 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 _0x502b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','lodash'];(function(_0x257679,_0x5a3bd8){var _0x490977=function(_0x19c85f){while(--_0x19c85f){_0x257679['push'](_0x257679['shift']());}};_0x490977(++_0x5a3bd8);}(_0x502b,0x137));var _0xb502=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x502b[_0x36bff5];return _0x80ade5;};'use strict';var _=require(_0xb502('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb502('0x1'));var BPromise=require(_0xb502('0x2'));var rp=require(_0xb502('0x3'));var fs=require('fs');var path=require(_0xb502('0x4'));var rimraf=require(_0xb502('0x5'));var config=require(_0xb502('0x6'));var attributes=require(_0xb502('0x7'));module[_0xb502('0x8')]=function(_0x3efee5,_0x10cfb4){return _0x3efee5[_0xb502('0x9')](_0xb502('0xa'),attributes,{'tableName':_0xb502('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x519d3f,_0x205a17,_0x52af46){if(_0x519d3f['changed'](_0xb502('0xc'))){_0x519d3f['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x52af46(null,_0x519d3f);}}});}; \ No newline at end of file +var _0x5147=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2e8477,_0x31163a){var _0x282d8f=function(_0x68cd0a){while(--_0x68cd0a){_0x2e8477['push'](_0x2e8477['shift']());}};_0x282d8f(++_0x31163a);}(_0x5147,0x11f));var _0x7514=function(_0x2c9f8c,_0x4bfbe1){_0x2c9f8c=_0x2c9f8c-0x0;var _0x2538ac=_0x5147[_0x2c9f8c];return _0x2538ac;};'use strict';var _=require('lodash');var util=require(_0x7514('0x0'));var logger=require(_0x7514('0x1'))(_0x7514('0x2'));var moment=require('moment');var BPromise=require(_0x7514('0x3'));var rp=require(_0x7514('0x4'));var fs=require('fs');var path=require(_0x7514('0x5'));var rimraf=require(_0x7514('0x6'));var config=require('../../config/environment');var attributes=require(_0x7514('0x7'));module[_0x7514('0x8')]=function(_0x5bd1a3,_0x137994){return _0x5bd1a3['define'](_0x7514('0x9'),attributes,{'tableName':_0x7514('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48ece2,_0x590cad,_0x427fc7){if(_0x48ece2[_0x7514('0xb')]('closed')){_0x48ece2[_0x7514('0xc')]=moment()['format'](_0x7514('0xd'));}_0x427fc7(null,_0x48ece2);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 516d79b..6e390de 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 _0x3ef0=['result','catch','UpdateSmsInteraction','update','body','options','raw','attributes','limit','SmsInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info'];(function(_0x588426,_0x2fd3fe){var _0x150796=function(_0x4feb93){while(--_0x4feb93){_0x588426['push'](_0x588426['shift']());}};_0x150796(++_0x2fd3fe);}(_0x3ef0,0x14b));var _0x03ef=function(_0x3bde0f,_0x1fe16c){_0x3bde0f=_0x3bde0f-0x0;var _0x381367=_0x3ef0[_0x3bde0f];return _0x381367;};'use strict';var _=require(_0x03ef('0x0'));var util=require(_0x03ef('0x1'));var moment=require(_0x03ef('0x2'));var BPromise=require(_0x03ef('0x3'));var rs=require(_0x03ef('0x4'));var fs=require('fs');var Redis=require(_0x03ef('0x5'));var db=require(_0x03ef('0x6'))['db'];var utils=require(_0x03ef('0x7'));var logger=require(_0x03ef('0x8'))(_0x03ef('0x9'));var config=require(_0x03ef('0xa'));var jayson=require(_0x03ef('0xb'));var client=jayson['client'][_0x03ef('0xc')]({'port':0x232a});config[_0x03ef('0xd')]=_[_0x03ef('0xe')](config[_0x03ef('0xd')],{'host':_0x03ef('0xf'),'port':0x18eb});var socket=require(_0x03ef('0x10'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x03ef('0x11')](socket);function respondWithRpcPromise(_0x1a5896,_0xbdc02d,_0x527fb0){return new BPromise(function(_0x40cea8,_0x31caef){return client[_0x03ef('0x12')](_0x1a5896,_0x527fb0)[_0x03ef('0x13')](function(_0x5c5ca1){logger['info']('SmsInteraction,\x20%s,\x20%s',_0xbdc02d,_0x03ef('0x14'));logger[_0x03ef('0x15')](_0x03ef('0x16'),_0xbdc02d,_0x03ef('0x14'),JSON[_0x03ef('0x17')](_0x5c5ca1));if(_0x5c5ca1[_0x03ef('0x18')]){if(_0x5c5ca1['error'][_0x03ef('0x19')]===0x1f4){logger[_0x03ef('0x18')](_0x03ef('0x1a'),_0xbdc02d,_0x5c5ca1['error'][_0x03ef('0x1b')]);return _0x31caef(_0x5c5ca1[_0x03ef('0x18')][_0x03ef('0x1b')]);}logger[_0x03ef('0x18')](_0x03ef('0x1a'),_0xbdc02d,_0x5c5ca1['error'][_0x03ef('0x1b')]);return _0x40cea8(_0x5c5ca1[_0x03ef('0x18')][_0x03ef('0x1b')]);}else{logger[_0x03ef('0x1c')](_0x03ef('0x1a'),_0xbdc02d,_0x03ef('0x14'));_0x40cea8(_0x5c5ca1[_0x03ef('0x1d')][_0x03ef('0x1b')]);}})[_0x03ef('0x1e')](function(_0x2e4f26){logger[_0x03ef('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xbdc02d,_0x2e4f26);_0x31caef(_0x2e4f26);});});}exports[_0x03ef('0x1f')]=function(_0x1f1726){var _0x52851f=this;return new Promise(function(_0x4f0a06,_0x3bc3fb){return db['SmsInteraction'][_0x03ef('0x20')](_0x1f1726[_0x03ef('0x21')],{'raw':_0x1f1726[_0x03ef('0x22')]?_0x1f1726['options'][_0x03ef('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f1726['options']?_0x1f1726[_0x03ef('0x22')]['where']||null:null,'attributes':_0x1f1726['options']?_0x1f1726[_0x03ef('0x22')][_0x03ef('0x24')]||null:null,'limit':_0x1f1726[_0x03ef('0x22')]?_0x1f1726[_0x03ef('0x22')][_0x03ef('0x25')]||null:null})[_0x03ef('0x13')](function(_0x4d178b){logger[_0x03ef('0x1c')]('UpdateSmsInteraction',_0x1f1726);logger[_0x03ef('0x15')](_0x03ef('0x1f'),_0x1f1726,JSON[_0x03ef('0x17')](_0x4d178b));_0x4f0a06(_0x4d178b);})[_0x03ef('0x1e')](function(_0x2bb3ea){logger['error']('UpdateSmsInteraction',_0x2bb3ea[_0x03ef('0x1b')],_0x1f1726);_0x3bc3fb(_0x52851f[_0x03ef('0x18')](0x1f4,_0x2bb3ea[_0x03ef('0x1b')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2fd8a6){return new Promise(function(_0x5a231d,_0x47c2cb){return db[_0x03ef('0x26')][_0x03ef('0x27')]({'where':_0x2fd8a6[_0x03ef('0x22')]?_0x2fd8a6[_0x03ef('0x22')][_0x03ef('0x28')]||null:null})['then'](function(_0x395a8b){if(_0x395a8b){return _0x395a8b['addTags'](_0x2fd8a6[_0x03ef('0x21')][_0x03ef('0x29')],_[_0x03ef('0x2a')](_0x2fd8a6['body'],['ids','id'])||{});}})[_0x03ef('0x2b')](function(_0x3b15fb){logger[_0x03ef('0x1c')](_0x03ef('0x2c'),_0x2fd8a6);logger['debug']('AddTags',_0x2fd8a6,JSON[_0x03ef('0x17')](_0x3b15fb));_0x5a231d(_0x3b15fb);})[_0x03ef('0x1e')](function(_0x1f42e2){logger[_0x03ef('0x18')](_0x03ef('0x2c'),_0x1f42e2[_0x03ef('0x1b')],_0x2fd8a6);_0x47c2cb(_this[_0x03ef('0x18')](0x1f4,_0x1f42e2['message']));});});}; \ No newline at end of file +var _0x3630=['spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SmsInteraction','update','options','limit','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','omit','body'];(function(_0x1df3d9,_0x6c14c8){var _0xd24c8b=function(_0x42071a){while(--_0x42071a){_0x1df3d9['push'](_0x1df3d9['shift']());}};_0xd24c8b(++_0x6c14c8);}(_0x3630,0x199));var _0x0363=function(_0x1bb9df,_0x355e28){_0x1bb9df=_0x1bb9df-0x0;var _0x1a35ab=_0x3630[_0x1bb9df];return _0x1a35ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0363('0x0'));var BPromise=require(_0x0363('0x1'));var rs=require(_0x0363('0x2'));var fs=require('fs');var Redis=require(_0x0363('0x3'));var db=require(_0x0363('0x4'))['db'];var utils=require(_0x0363('0x5'));var logger=require(_0x0363('0x6'))(_0x0363('0x7'));var config=require(_0x0363('0x8'));var jayson=require(_0x0363('0x9'));var client=jayson['client'][_0x0363('0xa')]({'port':0x232a});config[_0x0363('0xb')]=_[_0x0363('0xc')](config['redis'],{'host':_0x0363('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4d4d48,_0x470436,_0x3196c7){return new BPromise(function(_0x268ce8,_0x3c0976){return client['request'](_0x4d4d48,_0x3196c7)[_0x0363('0xe')](function(_0x4795c4){logger[_0x0363('0xf')](_0x0363('0x10'),_0x470436,'request\x20sent');logger[_0x0363('0x11')](_0x0363('0x12'),_0x470436,_0x0363('0x13'),JSON['stringify'](_0x4795c4));if(_0x4795c4[_0x0363('0x14')]){if(_0x4795c4[_0x0363('0x14')][_0x0363('0x15')]===0x1f4){logger['error'](_0x0363('0x10'),_0x470436,_0x4795c4[_0x0363('0x14')][_0x0363('0x16')]);return _0x3c0976(_0x4795c4['error'][_0x0363('0x16')]);}logger[_0x0363('0x14')](_0x0363('0x10'),_0x470436,_0x4795c4[_0x0363('0x14')][_0x0363('0x16')]);return _0x268ce8(_0x4795c4[_0x0363('0x14')][_0x0363('0x16')]);}else{logger[_0x0363('0xf')](_0x0363('0x10'),_0x470436,'request\x20sent');_0x268ce8(_0x4795c4[_0x0363('0x17')]['message']);}})[_0x0363('0x18')](function(_0x2ea345){logger[_0x0363('0x14')](_0x0363('0x10'),_0x470436,_0x2ea345);_0x3c0976(_0x2ea345);});});}exports['UpdateSmsInteraction']=function(_0x1930c2){var _0x45c54c=this;return new Promise(function(_0x426bb0,_0x2d26db){return db[_0x0363('0x19')][_0x0363('0x1a')](_0x1930c2['body'],{'raw':_0x1930c2[_0x0363('0x1b')]?_0x1930c2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1930c2[_0x0363('0x1b')]?_0x1930c2[_0x0363('0x1b')]['where']||null:null,'attributes':_0x1930c2[_0x0363('0x1b')]?_0x1930c2['options']['attributes']||null:null,'limit':_0x1930c2['options']?_0x1930c2['options'][_0x0363('0x1c')]||null:null})[_0x0363('0xe')](function(_0x22dbe5){logger['info']('UpdateSmsInteraction',_0x1930c2);logger['debug'](_0x0363('0x1d'),_0x1930c2,JSON[_0x0363('0x1e')](_0x22dbe5));_0x426bb0(_0x22dbe5);})[_0x0363('0x18')](function(_0x5ccb13){logger['error'](_0x0363('0x1d'),_0x5ccb13[_0x0363('0x16')],_0x1930c2);_0x2d26db(_0x45c54c[_0x0363('0x14')](0x1f4,_0x5ccb13[_0x0363('0x16')]));});});};exports[_0x0363('0x1f')]=function(_0x412f86){return new Promise(function(_0x51df85,_0x3561f3){return db[_0x0363('0x19')][_0x0363('0x20')]({'where':_0x412f86[_0x0363('0x1b')]?_0x412f86[_0x0363('0x1b')]['where']||null:null})[_0x0363('0xe')](function(_0x5ac622){if(_0x5ac622){return _0x5ac622['addTags'](_0x412f86['body']['ids'],_[_0x0363('0x21')](_0x412f86[_0x0363('0x22')],['ids','id'])||{});}})[_0x0363('0x23')](function(_0x4dfc63){logger['info']('AddTags',_0x412f86);logger['debug'](_0x0363('0x24'),_0x412f86,JSON['stringify'](_0x4dfc63));_0x51df85(_0x4dfc63);})[_0x0363('0x18')](function(_0x2de08b){logger['error'](_0x0363('0x24'),_0x2de08b[_0x0363('0x16')],_0x412f86);_0x3561f3(_this[_0x0363('0x14')](0x1f4,_0x2de08b[_0x0363('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index cdab3e2..49af561 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x350dc6,_0x36ab14){var _0x2e5887=function(_0x5370ad){while(--_0x5370ad){_0x350dc6['push'](_0x350dc6['shift']());}};_0x2e5887(++_0x36ab14);}(_0xb10b,0x12a));var _0xbb10=function(_0x35009a,_0x4c647b){_0x35009a=_0x35009a-0x0;var _0x41ae8a=_0xb10b[_0x35009a];return _0x41ae8a;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x1c0e55,_0x1d7edf){var _0x1a3572=function(_0x3ee4b4){while(--_0x3ee4b4){_0x1c0e55['push'](_0x1c0e55['shift']());}};_0x1a3572(++_0x1d7edf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f169d38..9cb5b38 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 _0xa587=['/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x2c3afa,_0x763a3b){var _0xd6e9cc=function(_0xe93ba7){while(--_0xe93ba7){_0x2c3afa['push'](_0x2c3afa['shift']());}};_0xd6e9cc(++_0x763a3b);}(_0xa587,0x16f));var _0x7a58=function(_0x3ad4cb,_0x58c9fe){_0x3ad4cb=_0x3ad4cb-0x0;var _0x331ac8=_0xa587[_0x3ad4cb];return _0x331ac8;};'use strict';var multer=require(_0x7a58('0x0'));var util=require(_0x7a58('0x1'));var path=require(_0x7a58('0x2'));var timeout=require(_0x7a58('0x3'));var express=require(_0x7a58('0x4'));var router=express[_0x7a58('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a58('0x6'));var config=require(_0x7a58('0x7'));var controller=require(_0x7a58('0x8'));router[_0x7a58('0x9')]('/',auth[_0x7a58('0xa')](),controller[_0x7a58('0xb')]);router[_0x7a58('0x9')](_0x7a58('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x7a58('0x9')](_0x7a58('0xd'),auth[_0x7a58('0xa')](),controller[_0x7a58('0xe')]);router[_0x7a58('0xf')]('/',auth[_0x7a58('0xa')](),interaction['tracked'](_0x7a58('0x10'),_0x7a58('0x11')),controller[_0x7a58('0x12')]);router['post'](_0x7a58('0x13'),controller[_0x7a58('0x14')]);router[_0x7a58('0x15')](_0x7a58('0xd'),auth[_0x7a58('0xa')](),controller[_0x7a58('0x16')]);router[_0x7a58('0x15')](_0x7a58('0x17'),auth[_0x7a58('0xa')](),controller[_0x7a58('0x18')]);router['put'](_0x7a58('0x19'),auth['isAuthenticated'](),controller[_0x7a58('0x1a')]);router['delete'](_0x7a58('0xd'),auth[_0x7a58('0xa')](),controller[_0x7a58('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa8fb=['/:id/accept','/:id/reject','reject','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put'];(function(_0x31a373,_0x5631aa){var _0x52ae82=function(_0x4bdec9){while(--_0x4bdec9){_0x31a373['push'](_0x31a373['shift']());}};_0x52ae82(++_0x5631aa);}(_0xa8fb,0x1be));var _0xba8f=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xa8fb[_0x45f951];return _0x24756c;};'use strict';var multer=require(_0xba8f('0x0'));var util=require(_0xba8f('0x1'));var path=require('path');var timeout=require(_0xba8f('0x2'));var express=require(_0xba8f('0x3'));var router=express[_0xba8f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xba8f('0x5'));var config=require(_0xba8f('0x6'));var controller=require(_0xba8f('0x7'));router[_0xba8f('0x8')]('/',auth['isAuthenticated'](),controller[_0xba8f('0x9')]);router[_0xba8f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xba8f('0xa')]);router[_0xba8f('0x8')](_0xba8f('0xb'),auth[_0xba8f('0xc')](),controller[_0xba8f('0xd')]);router[_0xba8f('0xe')]('/',auth['isAuthenticated'](),interaction[_0xba8f('0xf')](_0xba8f('0x10'),_0xba8f('0x11')),controller[_0xba8f('0x12')]);router['post'](_0xba8f('0x13'),controller[_0xba8f('0x14')]);router[_0xba8f('0x15')]('/:id',auth[_0xba8f('0xc')](),controller['update']);router[_0xba8f('0x15')](_0xba8f('0x16'),auth[_0xba8f('0xc')](),controller['accept']);router[_0xba8f('0x15')](_0xba8f('0x17'),auth[_0xba8f('0xc')](),controller[_0xba8f('0x18')]);router['delete'](_0xba8f('0xb'),auth[_0xba8f('0xc')](),controller['destroy']);module[_0xba8f('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d98e5b1..718f109 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 _0x27df=['exports','TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4fa984,_0x581b53){var _0x2bfdf4=function(_0x10cf02){while(--_0x10cf02){_0x4fa984['push'](_0x4fa984['shift']());}};_0x2bfdf4(++_0x581b53);}(_0x27df,0x15e));var _0xf27d=function(_0x1347ec,_0x55c75a){_0x1347ec=_0x1347ec-0x0;var _0x5b3182=_0x27df[_0x1347ec];return _0x5b3182;};'use strict';var Sequelize=require(_0xf27d('0x0'));module[_0xf27d('0x1')]={'body':{'type':Sequelize[_0xf27d('0x2')](_0xf27d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf27d('0x4')]('in',_0xf27d('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf27d('0x6')](0xbe)},'phone':{'type':Sequelize[_0xf27d('0x6')]},'readAt':{'type':Sequelize[_0xf27d('0x7')]},'secret':{'type':Sequelize[_0xf27d('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x08ce=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x366bf0,_0xf105){var _0xde6273=function(_0xe24b4c){while(--_0xe24b4c){_0x366bf0['push'](_0x366bf0['shift']());}};_0xde6273(++_0xf105);}(_0x08ce,0x86));var _0xe08c=function(_0x202c7a,_0x3dca8e){_0x202c7a=_0x202c7a-0x0;var _0x11d0d7=_0x08ce[_0x202c7a];return _0x11d0d7;};'use strict';var Sequelize=require(_0xe08c('0x0'));module[_0xe08c('0x1')]={'body':{'type':Sequelize[_0xe08c('0x2')](_0xe08c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe08c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe08c('0x5')]('in',_0xe08c('0x6')),'defaultValue':_0xe08c('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe08c('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe08c('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c3474ad..f4977dc 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 _0x6146=['catch','show','params','intersection','length','include','find','create','body','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','interface','channel','event','accept','EventManager','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','redis','localhost','socket.io-emitter','./smsMessage.socket','register','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~!@#$%^&-_=+[{]}.','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows'];(function(_0x88f8ca,_0x1e419a){var _0x46f4b1=function(_0x5a21a1){while(--_0x5a21a1){_0x88f8ca['push'](_0x88f8ca['shift']());}};_0x46f4b1(++_0x1e419a);}(_0x6146,0xba));var _0x6614=function(_0x1d0cc8,_0x446038){_0x1d0cc8=_0x1d0cc8-0x0;var _0x3a8bde=_0x6146[_0x1d0cc8];return _0x3a8bde;};'use strict';var pdf=require(_0x6614('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6614('0x1'));var zipdir=require(_0x6614('0x2'));var jsonpatch=require(_0x6614('0x3'));var rp=require(_0x6614('0x4'));var moment=require(_0x6614('0x5'));var BPromise=require(_0x6614('0x6'));var Mustache=require(_0x6614('0x7'));var util=require('util');var path=require(_0x6614('0x8'));var sox=require(_0x6614('0x9'));var csv=require(_0x6614('0xa'));var ejs=require(_0x6614('0xb'));var fs=require('fs');var _=require(_0x6614('0xc'));var squel=require(_0x6614('0xd'));var crypto=require(_0x6614('0xe'));var jsforce=require(_0x6614('0xf'));var deskjs=require(_0x6614('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6614('0x11'));var Papa=require(_0x6614('0x12'));var Redis=require(_0x6614('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6614('0x14'));var as=require(_0x6614('0x15'));var hardwareService=require(_0x6614('0x16'));var logger=require(_0x6614('0x17'))(_0x6614('0x18'));var utils=require(_0x6614('0x19'));var config=require(_0x6614('0x1a'));var db=require('../../mysqldb')['db'];config[_0x6614('0x1b')]=_['defaults'](config[_0x6614('0x1b')],{'host':_0x6614('0x1c'),'port':0x18eb});var socket=require(_0x6614('0x1d'))(new Redis(config[_0x6614('0x1b')]));require(_0x6614('0x1e'))[_0x6614('0x1f')](socket);var jayson=require(_0x6614('0x20'));var client=jayson[_0x6614('0x21')][_0x6614('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x219365,_0x40a008,_0x5e933f){if(_0x5e933f){var _0x15a983=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15a983[_0x6614('0x23')](_0x40a008)){return _0x219365;}else{throw new db[(_0x6614('0x24'))]['ValidationError'](_0x6614('0x25'));}}else{return _0x219365;}}function respondWithRpcPromise(_0x37fa8f,_0x449ec5,_0x5f1f8e,_0x53080d){return new BPromise(function(_0x2e843e,_0x207b15){var _0x35532c=_0x53080d||client;return _0x35532c[_0x6614('0x26')](_0x37fa8f,_0x5f1f8e)['then'](function(_0x251ccd){logger[_0x6614('0x27')](_0x6614('0x28'),_0x449ec5,_0x6614('0x29'));logger[_0x6614('0x2a')](_0x6614('0x2b'),_0x449ec5,_0x6614('0x29'),JSON[_0x6614('0x2c')](_0x251ccd));if(_0x251ccd[_0x6614('0x2d')]){if(_0x251ccd[_0x6614('0x2d')][_0x6614('0x2e')]===0x1f4){logger[_0x6614('0x2d')]('SmsMessage,\x20%s,\x20%s',_0x449ec5,_0x251ccd[_0x6614('0x2d')]['message']);return _0x207b15(_0x251ccd[_0x6614('0x2d')][_0x6614('0x2f')]);}logger[_0x6614('0x2d')]('SmsMessage,\x20%s,\x20%s',_0x449ec5,_0x251ccd['error'][_0x6614('0x2f')]);return _0x2e843e(_0x251ccd['error'][_0x6614('0x2f')]);}else{logger['info'](_0x6614('0x28'),_0x449ec5,_0x6614('0x29'));_0x2e843e(_0x251ccd['result'][_0x6614('0x2f')]);}})['catch'](function(_0x184857){logger[_0x6614('0x2d')](_0x6614('0x28'),_0x449ec5,_0x184857);_0x207b15(_0x184857);});});}function respondWithStatusCode(_0x48877b,_0x288bbc){_0x288bbc=_0x288bbc||0xcc;return function(_0x1aa259){if(_0x1aa259){return _0x48877b[_0x6614('0x30')](_0x288bbc);}return _0x48877b[_0x6614('0x31')](_0x288bbc)[_0x6614('0x32')]();};}function respondWithResult(_0x32ee73,_0x153b8e){_0x153b8e=_0x153b8e||0xc8;return function(_0x30811a){if(_0x30811a){return _0x32ee73[_0x6614('0x31')](_0x153b8e)['json'](_0x30811a);}};}function respondWithFilteredResult(_0x39e125,_0x3f7756){return function(_0x332661){if(_0x332661){var _0x13380e=_0x332661[_0x6614('0x33')],_0x3717e0=_0x3f7756['offset'],_0x338fb5=_0x3f7756[_0x6614('0x34')]+_0x3f7756[_0x6614('0x35')],_0x24a268;if(_0x338fb5>=_0x13380e){_0x338fb5=_0x13380e;_0x24a268=0xc8;}else{_0x24a268=0xce;}_0x39e125[_0x6614('0x31')](_0x24a268);return _0x39e125['set']('Content-Range',_0x3717e0+'-'+_0x338fb5+'/'+_0x13380e)[_0x6614('0x36')](_0x332661);}return null;};}function patchUpdates(_0x51a909){return function(_0x239b39){try{jsonpatch[_0x6614('0x37')](_0x239b39,_0x51a909,!![]);}catch(_0x552adf){return BPromise[_0x6614('0x38')](_0x552adf);}return _0x239b39[_0x6614('0x39')]();};}function saveUpdates(_0x45966b,_0x4920eb){return function(_0x40be55){if(_0x40be55){return _0x40be55[_0x6614('0x3a')](_0x45966b)[_0x6614('0x3b')](function(_0x635c7){return _0x635c7;});}return null;};}function removeEntity(_0x14cfa7,_0x3cc56c){return function(_0x71a887){if(_0x71a887){return _0x71a887[_0x6614('0x3c')]()[_0x6614('0x3b')](function(){_0x14cfa7[_0x6614('0x31')](0xcc)[_0x6614('0x32')]();});}};}function handleEntityNotFound(_0x3269ff,_0x1b1bf7){return function(_0x2d4f78){if(!_0x2d4f78){_0x3269ff[_0x6614('0x30')](0x194);}return _0x2d4f78;};}function handleError(_0x1898c4,_0x37c88d){_0x37c88d=_0x37c88d||0x1f4;return function(_0x2beec3){logger[_0x6614('0x2d')](_0x2beec3[_0x6614('0x3d')]);if(_0x2beec3['name']){delete _0x2beec3[_0x6614('0x3e')];}_0x1898c4[_0x6614('0x31')](_0x37c88d)[_0x6614('0x3f')](_0x2beec3);};}exports[_0x6614('0x40')]=function(_0x305ba1,_0xaa0541){var _0x3e3ca3={},_0x23422d={},_0x12fd32={'count':0x0,'rows':[]};var _0xc7bf21=_[_0x6614('0x41')](db[_0x6614('0x42')][_0x6614('0x43')],function(_0x3f87b5){return{'name':_0x3f87b5[_0x6614('0x44')],'type':_0x3f87b5[_0x6614('0x45')][_0x6614('0x46')]};});_0x23422d[_0x6614('0x47')]=_[_0x6614('0x41')](_0xc7bf21,'name');_0x23422d[_0x6614('0x48')]=_[_0x6614('0x49')](_0x305ba1[_0x6614('0x48')]);_0x23422d[_0x6614('0x4a')]=_['intersection'](_0x23422d['model'],_0x23422d[_0x6614('0x48')]);_0x3e3ca3[_0x6614('0x4b')]=_['intersection'](_0x23422d['model'],qs[_0x6614('0x4c')](_0x305ba1['query'][_0x6614('0x4c')]));_0x3e3ca3['attributes']=_0x3e3ca3[_0x6614('0x4b')]['length']?_0x3e3ca3[_0x6614('0x4b')]:_0x23422d[_0x6614('0x47')];if(!_0x305ba1[_0x6614('0x48')][_0x6614('0x4d')](_0x6614('0x4e'))){_0x3e3ca3['limit']=qs['limit'](_0x305ba1[_0x6614('0x48')][_0x6614('0x35')]);_0x3e3ca3[_0x6614('0x34')]=qs[_0x6614('0x34')](_0x305ba1[_0x6614('0x48')]['offset']);}_0x3e3ca3[_0x6614('0x4f')]=qs[_0x6614('0x50')](_0x305ba1[_0x6614('0x48')][_0x6614('0x50')]);_0x3e3ca3[_0x6614('0x51')]=qs[_0x6614('0x4a')](_['pick'](_0x305ba1[_0x6614('0x48')],_0x23422d['filters']),_0xc7bf21);if(_0x305ba1[_0x6614('0x48')]['filter']){_0x3e3ca3[_0x6614('0x51')]=_['merge'](_0x3e3ca3['where'],{'$or':_[_0x6614('0x41')](_0xc7bf21,function(_0x1e2d97){if(_0x1e2d97[_0x6614('0x45')]!=='VIRTUAL'){var _0x255a95={};_0x255a95[_0x1e2d97['name']]={'$like':'%'+_0x305ba1[_0x6614('0x48')][_0x6614('0x52')]+'%'};return _0x255a95;}})});}_0x3e3ca3=_[_0x6614('0x53')]({},_0x3e3ca3,_0x305ba1[_0x6614('0x54')]);var _0x15e3af={'where':_0x3e3ca3[_0x6614('0x51')]};return db['SmsMessage'][_0x6614('0x33')](_0x15e3af)[_0x6614('0x3b')](function(_0x5674b8){_0x12fd32[_0x6614('0x33')]=_0x5674b8;if(_0x305ba1[_0x6614('0x48')][_0x6614('0x55')]){_0x3e3ca3['include']=[{'all':!![]}];}return db[_0x6614('0x42')][_0x6614('0x56')](_0x3e3ca3);})[_0x6614('0x3b')](function(_0xf22707){_0x12fd32[_0x6614('0x57')]=_0xf22707;return _0x12fd32;})['then'](respondWithFilteredResult(_0xaa0541,_0x3e3ca3))[_0x6614('0x58')](handleError(_0xaa0541,null));};exports[_0x6614('0x59')]=function(_0x276933,_0x40c881){var _0x305868={'raw':!![],'where':{'id':_0x276933[_0x6614('0x5a')]['id']}},_0xa03dec={};_0xa03dec[_0x6614('0x47')]=_[_0x6614('0x49')](db['SmsMessage'][_0x6614('0x43')]);_0xa03dec[_0x6614('0x48')]=_[_0x6614('0x49')](_0x276933[_0x6614('0x48')]);_0xa03dec['filters']=_['intersection'](_0xa03dec[_0x6614('0x47')],_0xa03dec[_0x6614('0x48')]);_0x305868[_0x6614('0x4b')]=_[_0x6614('0x5b')](_0xa03dec[_0x6614('0x47')],qs[_0x6614('0x4c')](_0x276933['query'][_0x6614('0x4c')]));_0x305868[_0x6614('0x4b')]=_0x305868['attributes'][_0x6614('0x5c')]?_0x305868[_0x6614('0x4b')]:_0xa03dec['model'];if(_0x276933['query'][_0x6614('0x55')]){_0x305868[_0x6614('0x5d')]=[{'all':!![]}];}_0x305868=_[_0x6614('0x53')]({},_0x305868,_0x276933['options']);return db['SmsMessage'][_0x6614('0x5e')](_0x305868)[_0x6614('0x3b')](handleEntityNotFound(_0x40c881,null))[_0x6614('0x3b')](respondWithResult(_0x40c881,null))[_0x6614('0x58')](handleError(_0x40c881,null));};exports[_0x6614('0x5f')]=function(_0x483174,_0x2030ba){return db[_0x6614('0x42')][_0x6614('0x5f')](_0x483174[_0x6614('0x60')],{})[_0x6614('0x3b')](respondWithResult(_0x2030ba,0xc9))[_0x6614('0x58')](handleError(_0x2030ba,null));};exports[_0x6614('0x3a')]=function(_0x1d951e,_0x4c7c5f){if(_0x1d951e[_0x6614('0x60')]['id']){delete _0x1d951e[_0x6614('0x60')]['id'];}return db[_0x6614('0x42')][_0x6614('0x5e')]({'where':{'id':_0x1d951e['params']['id']}})['then'](handleEntityNotFound(_0x4c7c5f,null))[_0x6614('0x3b')](saveUpdates(_0x1d951e[_0x6614('0x60')],null))[_0x6614('0x3b')](respondWithResult(_0x4c7c5f,null))[_0x6614('0x58')](handleError(_0x4c7c5f,null));};exports[_0x6614('0x3c')]=function(_0x39238e,_0x24f13d){return db[_0x6614('0x42')][_0x6614('0x5e')]({'where':{'id':_0x39238e[_0x6614('0x5a')]['id']}})[_0x6614('0x3b')](handleEntityNotFound(_0x24f13d,null))[_0x6614('0x3b')](removeEntity(_0x24f13d,null))['catch'](handleError(_0x24f13d,null));};exports['describe']=function(_0x17807d,_0x2cdd04){return db[_0x6614('0x42')]['describe']()['then'](respondWithResult(_0x2cdd04,null))[_0x6614('0x58')](handleError(_0x2cdd04,null));};var interaction_log=require(_0x6614('0x17'))(_0x6614('0x61'));exports['accept']=function(_0x48948b,_0x38517c,_0x5dfea1){var _0x2865c2={'channel':_0x6614('0x62')};if(_0x48948b[_0x6614('0x60')]['id']){delete _0x48948b[_0x6614('0x60')]['id'];}_0x48948b[_0x6614('0x60')][_0x6614('0x63')]=!![];_0x48948b['body'][_0x6614('0x64')]=moment()['format'](_0x6614('0x65'));_0x48948b[_0x6614('0x60')][_0x6614('0x66')]=_0x48948b[_0x6614('0x60')][_0x6614('0x66')]||_0x48948b[_0x6614('0x67')]['id'];return db[_0x6614('0x42')][_0x6614('0x5e')]({'where':{'id':_0x48948b[_0x6614('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x6614('0x68')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x38517c,null))[_0x6614('0x3b')](saveUpdates(_0x48948b[_0x6614('0x60')],null))[_0x6614('0x3b')](function(_0x40dc6f){if(_0x40dc6f){_0x2865c2[_0x6614('0x2f')]=_0x40dc6f['get']({'plain':!![]});return db[_0x6614('0x69')][_0x6614('0x5e')]({'where':{'id':_0x40dc6f[_0x6614('0x6a')]}});}return null;})[_0x6614('0x3b')](handleEntityNotFound(_0x38517c,null))[_0x6614('0x3b')](function(_0x18ca6d){if(_0x18ca6d){return _0x18ca6d['update']({'UserId':_0x48948b[_0x6614('0x60')][_0x6614('0x66')],'read1stAt':_['isNil'](_0x18ca6d[_0x6614('0x6b')])?moment()[_0x6614('0x6c')](_0x6614('0x65')):undefined});}return null;})[_0x6614('0x3b')](function(_0x3b23c9){if(_0x3b23c9){_0x2865c2[_0x6614('0x6d')]=_0x3b23c9[_0x6614('0x6e')]({'plain':!![]});interaction_log[_0x6614('0x27')](_0x6614('0x6f'),_0x48948b[_0x6614('0x67')]['id'],_0x48948b['user'][_0x6614('0x3e')],_0x48948b[_0x6614('0x67')]['role'],_0x2865c2[_0x6614('0x6d')]['id'],_0x48948b[_0x6614('0x60')]?JSON[_0x6614('0x2c')](_0x48948b[_0x6614('0x60')]):_0x6614('0x70'));return respondWithRpcPromise(_0x6614('0x71'),_0x6614('0x72'),_0x2865c2);}return null;})[_0x6614('0x3b')](function(_0x261f05){if(_0x261f05){if(_0x48948b['body']['manual']){_0x2865c2[_0x6614('0x2f')][_0x6614('0x73')]=util['format']('SIP/%s',_0x48948b[_0x6614('0x67')]['name']);_0x2865c2[_0x6614('0x2f')][_0x6614('0x74')]=_0x2865c2[_0x6614('0x74')];_0x2865c2[_0x6614('0x2f')][_0x6614('0x75')]=_0x6614('0x76');return respondWithRpcPromise(_0x6614('0x77'),_0x6614('0x77'),{'event':'acceptmessage','message':_0x2865c2[_0x6614('0x2f')]},client9002)[_0x6614('0x3b')](function(){return _0x2865c2;});}return _0x2865c2;}return null;})[_0x6614('0x3b')](respondWithResult(_0x38517c,null))[_0x6614('0x58')](handleError(_0x38517c,null));};var interaction_log=require('../../config/logger')(_0x6614('0x61'));exports[_0x6614('0x38')]=function(_0x2a051e,_0x1aaa60,_0x42cce9){var _0x50eaad={'agent':{},'channel':_0x6614('0x62')};if(_0x2a051e[_0x6614('0x60')]['id']){delete _0x2a051e[_0x6614('0x60')]['id'];}_0x2a051e[_0x6614('0x60')][_0x6614('0x66')]=_0x2a051e['body'][_0x6614('0x66')]||_0x2a051e[_0x6614('0x67')]['id'];_0x50eaad[_0x6614('0x78')]['id']=_0x2a051e[_0x6614('0x60')][_0x6614('0x66')];return db[_0x6614('0x42')][_0x6614('0x5e')]({'where':{'id':_0x2a051e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1aaa60,null))[_0x6614('0x3b')](function(_0x16d72e){if(_0x16d72e){_0x50eaad[_0x6614('0x2f')]=_0x16d72e['get']({'plain':!![]});return db[_0x6614('0x69')][_0x6614('0x5e')]({'where':{'id':_0x16d72e['SmsInteractionId']}});}return null;})[_0x6614('0x3b')](handleEntityNotFound(_0x1aaa60,null))[_0x6614('0x3b')](function(_0x5d2d21){if(_0x5d2d21){_0x50eaad[_0x6614('0x6d')]=_0x5d2d21[_0x6614('0x6e')]({'plain':!![]});interaction_log[_0x6614('0x27')](_0x6614('0x79'),_0x2a051e[_0x6614('0x67')]['id'],_0x2a051e['user'][_0x6614('0x3e')],_0x2a051e[_0x6614('0x67')][_0x6614('0x7a')],_0x50eaad[_0x6614('0x6d')]['id'],_0x2a051e[_0x6614('0x60')]?JSON['stringify'](_0x2a051e[_0x6614('0x60')]):'null');return respondWithRpcPromise(_0x6614('0x7b'),'rejectMessage',_0x50eaad);}return null;})[_0x6614('0x3b')](function(_0x20434e){if(_0x20434e){_0x20434e[_0x6614('0x2f')][_0x6614('0x73')]=util[_0x6614('0x6c')](_0x6614('0x7c'),_0x2a051e[_0x6614('0x67')][_0x6614('0x3e')]);_0x20434e[_0x6614('0x2f')][_0x6614('0x74')]=_0x50eaad['channel'];_0x20434e[_0x6614('0x2f')]['event']=_0x6614('0x38');respondWithRpcPromise(_0x6614('0x77'),'EventManager',{'event':'rejectmessage','message':_0x20434e['message']},client9002);return _0x50eaad;}return null;})[_0x6614('0x3b')](respondWithResult(_0x1aaa60,null))[_0x6614('0x58')](handleError(_0x1aaa60,null));};exports['status']=function(_0x379791,_0x5c928d,_0x4876fb){if(_0x379791[_0x6614('0x60')]['id']){delete _0x379791[_0x6614('0x60')]['id'];}var _0x34c562;return db[_0x6614('0x42')][_0x6614('0x5e')]({'where':{'id':_0x379791[_0x6614('0x5a')]['id']}})[_0x6614('0x3b')](handleEntityNotFound(_0x5c928d,null))[_0x6614('0x3b')](function(_0x19f6bf){if(_0x19f6bf){_0x34c562=_0x19f6bf;return db['SmsAccount'][_0x6614('0x5e')]({'where':{'id':_0x19f6bf['SmsAccountId']}});}})[_0x6614('0x3b')](handleEntityNotFound(_0x5c928d,null))[_0x6614('0x3b')](function(_0x3c1cbd){if(_0x3c1cbd){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6614('0x31'),'received\x20delivery\x20report\x20from',_0x3c1cbd[_0x6614('0x45')],util[_0x6614('0x7d')](_0x379791[_0x6614('0x60')],{'showHidden':![],'depth':null}));switch(_0x3c1cbd[_0x6614('0x45')]){case _0x6614('0x7e'):if(_0x379791[_0x6614('0x60')][_0x6614('0x7f')]&&_0x379791[_0x6614('0x60')][_0x6614('0x7f')]===_0x34c562['messageId']){return _0x34c562[_0x6614('0x3a')]({'read':!![]});}else{logger[_0x6614('0x2d')](_0x6614('0x80'),_0x6614('0x31'),_0x6614('0x7e'),util[_0x6614('0x7d')](_0x379791[_0x6614('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6614('0x81'):if(_0x379791['body'][_0x6614('0x82')]&&_0x379791[_0x6614('0x60')][_0x6614('0x82')]===_0x34c562['messageId']&&_[_0x6614('0x83')]([_0x6614('0x84'),_0x6614('0x85')],_0x379791[_0x6614('0x60')]['Status'])>=0x0){return _0x34c562['update']({'read':!![]});}else{logger[_0x6614('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6614('0x31'),_0x6614('0x86'),util[_0x6614('0x7d')](_0x379791[_0x6614('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6614('0x87'):var _0x40fc70=_0x379791[_0x6614('0x60')][_0x6614('0x88')][0x0];if(_0x40fc70[_0x6614('0x31')]['groupName']==='DELIVERED'){return _0x34c562[_0x6614('0x3a')]({'read':!![]});}else{logger[_0x6614('0x2d')](_0x6614('0x80'),_0x6614('0x31'),_0x6614('0x87'),util[_0x6614('0x7d')](_0x379791[_0x6614('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x34c562;}})[_0x6614('0x3b')](respondWithResult(_0x5c928d,null))[_0x6614('0x58')](handleError(_0x5c928d,null));}; \ No newline at end of file +var _0x834d=['UserId','user','Contact','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','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','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','rows','show','params','filters','length','include','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','readAt','format'];(function(_0x49ac38,_0x27b11a){var _0x5429f0=function(_0x3b5257){while(--_0x3b5257){_0x49ac38['push'](_0x49ac38['shift']());}};_0x5429f0(++_0x27b11a);}(_0x834d,0x140));var _0xd834=function(_0x560214,_0x2ff954){_0x560214=_0x560214-0x0;var _0x4d9ddb=_0x834d[_0x560214];return _0x4d9ddb;};'use strict';var pdf=require(_0xd834('0x0'));var emlformat=require(_0xd834('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd834('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd834('0x3'));var BPromise=require(_0xd834('0x4'));var Mustache=require(_0xd834('0x5'));var util=require(_0xd834('0x6'));var path=require('path');var sox=require(_0xd834('0x7'));var csv=require(_0xd834('0x8'));var ejs=require(_0xd834('0x9'));var fs=require('fs');var _=require(_0xd834('0xa'));var squel=require(_0xd834('0xb'));var crypto=require(_0xd834('0xc'));var jsforce=require(_0xd834('0xd'));var deskjs=require(_0xd834('0xe'));var toCsv=require(_0xd834('0x8'));var querystring=require(_0xd834('0xf'));var Papa=require('papaparse');var Redis=require(_0xd834('0x10'));var authService=require(_0xd834('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd834('0x12'));var hardwareService=require(_0xd834('0x13'));var logger=require('../../config/logger')(_0xd834('0x14'));var utils=require(_0xd834('0x15'));var config=require(_0xd834('0x16'));var db=require(_0xd834('0x17'))['db'];config[_0xd834('0x18')]=_[_0xd834('0x19')](config[_0xd834('0x18')],{'host':_0xd834('0x1a'),'port':0x18eb});var socket=require(_0xd834('0x1b'))(new Redis(config[_0xd834('0x18')]));require(_0xd834('0x1c'))['register'](socket);var jayson=require(_0xd834('0x1d'));var client=jayson[_0xd834('0x1e')][_0xd834('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd834('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x30315a,_0x1aa77a,_0x3ddd9f){if(_0x3ddd9f){var _0x4f5198=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f5198[_0xd834('0x20')](_0x1aa77a)){return _0x30315a;}else{throw new db[(_0xd834('0x21'))][(_0xd834('0x22'))](_0xd834('0x23'));}}else{return _0x30315a;}}function respondWithRpcPromise(_0x4ab468,_0x21ce1a,_0x1aecf2,_0x530951){return new BPromise(function(_0xce0df0,_0x46d26a){var _0x12e676=_0x530951||client;return _0x12e676['request'](_0x4ab468,_0x1aecf2)[_0xd834('0x24')](function(_0x490cf4){logger[_0xd834('0x25')](_0xd834('0x26'),_0x21ce1a,'request\x20sent');logger[_0xd834('0x27')](_0xd834('0x28'),_0x21ce1a,_0xd834('0x29'),JSON[_0xd834('0x2a')](_0x490cf4));if(_0x490cf4[_0xd834('0x2b')]){if(_0x490cf4[_0xd834('0x2b')]['code']===0x1f4){logger[_0xd834('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x21ce1a,_0x490cf4[_0xd834('0x2b')]['message']);return _0x46d26a(_0x490cf4[_0xd834('0x2b')][_0xd834('0x2c')]);}logger[_0xd834('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x21ce1a,_0x490cf4['error']['message']);return _0xce0df0(_0x490cf4[_0xd834('0x2b')]['message']);}else{logger[_0xd834('0x25')]('SmsMessage,\x20%s,\x20%s',_0x21ce1a,_0xd834('0x29'));_0xce0df0(_0x490cf4['result'][_0xd834('0x2c')]);}})[_0xd834('0x2d')](function(_0x3a412a){logger[_0xd834('0x2b')](_0xd834('0x26'),_0x21ce1a,_0x3a412a);_0x46d26a(_0x3a412a);});});}function respondWithStatusCode(_0x570c95,_0x16fac4){_0x16fac4=_0x16fac4||0xcc;return function(_0x557f7e){if(_0x557f7e){return _0x570c95[_0xd834('0x2e')](_0x16fac4);}return _0x570c95[_0xd834('0x2f')](_0x16fac4)[_0xd834('0x30')]();};}function respondWithResult(_0xf8813d,_0x52dd66){_0x52dd66=_0x52dd66||0xc8;return function(_0x4cf1ef){if(_0x4cf1ef){return _0xf8813d[_0xd834('0x2f')](_0x52dd66)['json'](_0x4cf1ef);}};}function respondWithFilteredResult(_0x5bcbf1,_0x58fb78){return function(_0xc5b1a3){if(_0xc5b1a3){var _0x2737ac=_0xc5b1a3[_0xd834('0x31')],_0x3847c8=_0x58fb78[_0xd834('0x32')],_0x4f4602=_0x58fb78[_0xd834('0x32')]+_0x58fb78[_0xd834('0x33')],_0x562dee;if(_0x4f4602>=_0x2737ac){_0x4f4602=_0x2737ac;_0x562dee=0xc8;}else{_0x562dee=0xce;}_0x5bcbf1[_0xd834('0x2f')](_0x562dee);return _0x5bcbf1[_0xd834('0x34')](_0xd834('0x35'),_0x3847c8+'-'+_0x4f4602+'/'+_0x2737ac)[_0xd834('0x36')](_0xc5b1a3);}return null;};}function patchUpdates(_0x4b9695){return function(_0x1ddbf0){try{jsonpatch['apply'](_0x1ddbf0,_0x4b9695,!![]);}catch(_0x3a32bb){return BPromise[_0xd834('0x37')](_0x3a32bb);}return _0x1ddbf0['save']();};}function saveUpdates(_0xe18ff4,_0x3007fe){return function(_0x4a14c3){if(_0x4a14c3){return _0x4a14c3[_0xd834('0x38')](_0xe18ff4)['then'](function(_0x3be6a6){return _0x3be6a6;});}return null;};}function removeEntity(_0x26da61,_0x10ef55){return function(_0x4b7a64){if(_0x4b7a64){return _0x4b7a64[_0xd834('0x39')]()['then'](function(){_0x26da61[_0xd834('0x2f')](0xcc)[_0xd834('0x30')]();});}};}function handleEntityNotFound(_0x490369,_0xaa3988){return function(_0x38e12e){if(!_0x38e12e){_0x490369['sendStatus'](0x194);}return _0x38e12e;};}function handleError(_0x33b7b3,_0x26045c){_0x26045c=_0x26045c||0x1f4;return function(_0x10cbdd){logger['error'](_0x10cbdd[_0xd834('0x3a')]);if(_0x10cbdd['name']){delete _0x10cbdd[_0xd834('0x3b')];}_0x33b7b3['status'](_0x26045c)[_0xd834('0x3c')](_0x10cbdd);};}exports[_0xd834('0x3d')]=function(_0x441f28,_0x5a8761){var _0x1c6840={},_0x2e5e30={},_0x17afd8={'count':0x0,'rows':[]};var _0x1d7ea5=_[_0xd834('0x3e')](db[_0xd834('0x3f')][_0xd834('0x40')],function(_0x58d612){return{'name':_0x58d612[_0xd834('0x41')],'type':_0x58d612[_0xd834('0x42')][_0xd834('0x43')]};});_0x2e5e30[_0xd834('0x44')]=_[_0xd834('0x3e')](_0x1d7ea5,'name');_0x2e5e30[_0xd834('0x45')]=_[_0xd834('0x46')](_0x441f28[_0xd834('0x45')]);_0x2e5e30['filters']=_['intersection'](_0x2e5e30['model'],_0x2e5e30[_0xd834('0x45')]);_0x1c6840[_0xd834('0x47')]=_[_0xd834('0x48')](_0x2e5e30['model'],qs[_0xd834('0x49')](_0x441f28[_0xd834('0x45')][_0xd834('0x49')]));_0x1c6840[_0xd834('0x47')]=_0x1c6840[_0xd834('0x47')]['length']?_0x1c6840[_0xd834('0x47')]:_0x2e5e30[_0xd834('0x44')];if(!_0x441f28[_0xd834('0x45')][_0xd834('0x4a')](_0xd834('0x4b'))){_0x1c6840['limit']=qs['limit'](_0x441f28[_0xd834('0x45')][_0xd834('0x33')]);_0x1c6840[_0xd834('0x32')]=qs[_0xd834('0x32')](_0x441f28['query']['offset']);}_0x1c6840['order']=qs[_0xd834('0x4c')](_0x441f28['query'][_0xd834('0x4c')]);_0x1c6840['where']=qs['filters'](_[_0xd834('0x4d')](_0x441f28[_0xd834('0x45')],_0x2e5e30['filters']),_0x1d7ea5);if(_0x441f28['query'][_0xd834('0x4e')]){_0x1c6840['where']=_[_0xd834('0x4f')](_0x1c6840['where'],{'$or':_[_0xd834('0x3e')](_0x1d7ea5,function(_0x4fc90e){if(_0x4fc90e['type']!==_0xd834('0x50')){var _0x2fc3fa={};_0x2fc3fa[_0x4fc90e[_0xd834('0x3b')]]={'$like':'%'+_0x441f28[_0xd834('0x45')]['filter']+'%'};return _0x2fc3fa;}})});}_0x1c6840=_[_0xd834('0x4f')]({},_0x1c6840,_0x441f28[_0xd834('0x51')]);var _0x45cc71={'where':_0x1c6840[_0xd834('0x52')]};return db[_0xd834('0x3f')][_0xd834('0x31')](_0x45cc71)['then'](function(_0xf3e17a){_0x17afd8[_0xd834('0x31')]=_0xf3e17a;if(_0x441f28['query'][_0xd834('0x53')]){_0x1c6840['include']=[{'all':!![]}];}return db[_0xd834('0x3f')]['findAll'](_0x1c6840);})[_0xd834('0x24')](function(_0x50a0c2){_0x17afd8[_0xd834('0x54')]=_0x50a0c2;return _0x17afd8;})[_0xd834('0x24')](respondWithFilteredResult(_0x5a8761,_0x1c6840))['catch'](handleError(_0x5a8761,null));};exports[_0xd834('0x55')]=function(_0x2d7189,_0x52b049){var _0x58f011={'raw':!![],'where':{'id':_0x2d7189[_0xd834('0x56')]['id']}},_0x168427={};_0x168427[_0xd834('0x44')]=_['keys'](db[_0xd834('0x3f')][_0xd834('0x40')]);_0x168427[_0xd834('0x45')]=_[_0xd834('0x46')](_0x2d7189[_0xd834('0x45')]);_0x168427[_0xd834('0x57')]=_[_0xd834('0x48')](_0x168427[_0xd834('0x44')],_0x168427[_0xd834('0x45')]);_0x58f011[_0xd834('0x47')]=_['intersection'](_0x168427[_0xd834('0x44')],qs[_0xd834('0x49')](_0x2d7189['query'][_0xd834('0x49')]));_0x58f011[_0xd834('0x47')]=_0x58f011[_0xd834('0x47')][_0xd834('0x58')]?_0x58f011[_0xd834('0x47')]:_0x168427['model'];if(_0x2d7189[_0xd834('0x45')][_0xd834('0x53')]){_0x58f011[_0xd834('0x59')]=[{'all':!![]}];}_0x58f011=_[_0xd834('0x4f')]({},_0x58f011,_0x2d7189['options']);return db['SmsMessage'][_0xd834('0x5a')](_0x58f011)[_0xd834('0x24')](handleEntityNotFound(_0x52b049,null))[_0xd834('0x24')](respondWithResult(_0x52b049,null))[_0xd834('0x2d')](handleError(_0x52b049,null));};exports[_0xd834('0x5b')]=function(_0xbf81d1,_0x301f8c){return db['SmsMessage'][_0xd834('0x5b')](_0xbf81d1[_0xd834('0x5c')],{})[_0xd834('0x24')](respondWithResult(_0x301f8c,0xc9))[_0xd834('0x2d')](handleError(_0x301f8c,null));};exports[_0xd834('0x38')]=function(_0x3de389,_0x911686){if(_0x3de389[_0xd834('0x5c')]['id']){delete _0x3de389[_0xd834('0x5c')]['id'];}return db[_0xd834('0x3f')][_0xd834('0x5a')]({'where':{'id':_0x3de389[_0xd834('0x56')]['id']}})[_0xd834('0x24')](handleEntityNotFound(_0x911686,null))[_0xd834('0x24')](saveUpdates(_0x3de389[_0xd834('0x5c')],null))[_0xd834('0x24')](respondWithResult(_0x911686,null))[_0xd834('0x2d')](handleError(_0x911686,null));};exports['destroy']=function(_0x399913,_0x5ab367){return db[_0xd834('0x3f')][_0xd834('0x5a')]({'where':{'id':_0x399913[_0xd834('0x56')]['id']}})[_0xd834('0x24')](handleEntityNotFound(_0x5ab367,null))[_0xd834('0x24')](removeEntity(_0x5ab367,null))[_0xd834('0x2d')](handleError(_0x5ab367,null));};exports[_0xd834('0x5d')]=function(_0x460c0c,_0x2f2fd3){return db[_0xd834('0x3f')]['describe']()[_0xd834('0x24')](respondWithResult(_0x2f2fd3,null))[_0xd834('0x2d')](handleError(_0x2f2fd3,null));};var interaction_log=require(_0xd834('0x5e'))(_0xd834('0x5f'));exports[_0xd834('0x60')]=function(_0x303e67,_0x3c27b5,_0x55ad77){var _0x5c876={'channel':_0xd834('0x61')};if(_0x303e67[_0xd834('0x5c')]['id']){delete _0x303e67[_0xd834('0x5c')]['id'];}_0x303e67['body']['read']=!![];_0x303e67[_0xd834('0x5c')][_0xd834('0x62')]=moment()[_0xd834('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x303e67[_0xd834('0x5c')][_0xd834('0x64')]=_0x303e67[_0xd834('0x5c')][_0xd834('0x64')]||_0x303e67[_0xd834('0x65')]['id'];return db[_0xd834('0x3f')]['find']({'where':{'id':_0x303e67[_0xd834('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd834('0x66')}]})[_0xd834('0x24')](handleEntityNotFound(_0x3c27b5,null))[_0xd834('0x24')](saveUpdates(_0x303e67[_0xd834('0x5c')],null))['then'](function(_0x32c880){if(_0x32c880){_0x5c876['message']=_0x32c880[_0xd834('0x67')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x32c880[_0xd834('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3c27b5,null))[_0xd834('0x24')](function(_0x4236da){if(_0x4236da){return _0x4236da['update']({'UserId':_0x303e67[_0xd834('0x5c')]['UserId'],'read1stAt':_[_0xd834('0x69')](_0x4236da[_0xd834('0x6a')])?moment()[_0xd834('0x63')](_0xd834('0x6b')):undefined});}return null;})[_0xd834('0x24')](function(_0x2025cf){if(_0x2025cf){_0x5c876[_0xd834('0x6c')]=_0x2025cf[_0xd834('0x67')]({'plain':!![]});interaction_log[_0xd834('0x25')](_0xd834('0x6d'),_0x303e67[_0xd834('0x65')]['id'],_0x303e67[_0xd834('0x65')][_0xd834('0x3b')],_0x303e67[_0xd834('0x65')][_0xd834('0x6e')],_0x5c876[_0xd834('0x6c')]['id'],_0x303e67['body']?JSON['stringify'](_0x303e67['body']):_0xd834('0x6f'));return respondWithRpcPromise(_0xd834('0x70'),'acceptMessage',_0x5c876);}return null;})[_0xd834('0x24')](function(_0x26d3b9){if(_0x26d3b9){if(_0x303e67['body']['manual']){_0x5c876[_0xd834('0x2c')][_0xd834('0x71')]=util[_0xd834('0x63')](_0xd834('0x72'),_0x303e67[_0xd834('0x65')][_0xd834('0x3b')]);_0x5c876[_0xd834('0x2c')][_0xd834('0x73')]=_0x5c876['channel'];_0x5c876[_0xd834('0x2c')][_0xd834('0x74')]=_0xd834('0x60');return respondWithRpcPromise(_0xd834('0x75'),'EventManager',{'event':_0xd834('0x76'),'message':_0x5c876[_0xd834('0x2c')]},client9002)[_0xd834('0x24')](function(){return _0x5c876;});}return _0x5c876;}return null;})[_0xd834('0x24')](respondWithResult(_0x3c27b5,null))[_0xd834('0x2d')](handleError(_0x3c27b5,null));};var interaction_log=require(_0xd834('0x5e'))(_0xd834('0x5f'));exports[_0xd834('0x37')]=function(_0x190b88,_0x28abfb,_0x57942a){var _0x5cf49d={'agent':{},'channel':_0xd834('0x61')};if(_0x190b88[_0xd834('0x5c')]['id']){delete _0x190b88[_0xd834('0x5c')]['id'];}_0x190b88[_0xd834('0x5c')][_0xd834('0x64')]=_0x190b88['body']['UserId']||_0x190b88[_0xd834('0x65')]['id'];_0x5cf49d['agent']['id']=_0x190b88[_0xd834('0x5c')][_0xd834('0x64')];return db['SmsMessage'][_0xd834('0x5a')]({'where':{'id':_0x190b88[_0xd834('0x56')]['id'],'UserId':null}})[_0xd834('0x24')](handleEntityNotFound(_0x28abfb,null))['then'](function(_0x3951d9){if(_0x3951d9){_0x5cf49d[_0xd834('0x2c')]=_0x3951d9['get']({'plain':!![]});return db[_0xd834('0x77')][_0xd834('0x5a')]({'where':{'id':_0x3951d9[_0xd834('0x68')]}});}return null;})[_0xd834('0x24')](handleEntityNotFound(_0x28abfb,null))[_0xd834('0x24')](function(_0x4528a6){if(_0x4528a6){_0x5cf49d['interaction']=_0x4528a6[_0xd834('0x67')]({'plain':!![]});interaction_log[_0xd834('0x25')](_0xd834('0x78'),_0x190b88[_0xd834('0x65')]['id'],_0x190b88['user']['name'],_0x190b88['user'][_0xd834('0x6e')],_0x5cf49d['interaction']['id'],_0x190b88['body']?JSON[_0xd834('0x2a')](_0x190b88[_0xd834('0x5c')]):_0xd834('0x6f'));return respondWithRpcPromise(_0xd834('0x79'),_0xd834('0x7a'),_0x5cf49d);}return null;})[_0xd834('0x24')](function(_0x4e9ab9){if(_0x4e9ab9){_0x4e9ab9['message'][_0xd834('0x71')]=util[_0xd834('0x63')](_0xd834('0x72'),_0x190b88[_0xd834('0x65')]['name']);_0x4e9ab9[_0xd834('0x2c')][_0xd834('0x73')]=_0x5cf49d[_0xd834('0x73')];_0x4e9ab9[_0xd834('0x2c')]['event']=_0xd834('0x37');respondWithRpcPromise(_0xd834('0x75'),_0xd834('0x75'),{'event':_0xd834('0x7b'),'message':_0x4e9ab9[_0xd834('0x2c')]},client9002);return _0x5cf49d;}return null;})[_0xd834('0x24')](respondWithResult(_0x28abfb,null))[_0xd834('0x2d')](handleError(_0x28abfb,null));};exports['status']=function(_0x40e0fe,_0x52db25,_0x355f9d){if(_0x40e0fe[_0xd834('0x5c')]['id']){delete _0x40e0fe[_0xd834('0x5c')]['id'];}var _0x4d668a;return db[_0xd834('0x3f')]['find']({'where':{'id':_0x40e0fe[_0xd834('0x56')]['id']}})[_0xd834('0x24')](handleEntityNotFound(_0x52db25,null))[_0xd834('0x24')](function(_0x4e34af){if(_0x4e34af){_0x4d668a=_0x4e34af;return db[_0xd834('0x7c')][_0xd834('0x5a')]({'where':{'id':_0x4e34af[_0xd834('0x7d')]}});}})[_0xd834('0x24')](handleEntityNotFound(_0x52db25,null))[_0xd834('0x24')](function(_0x1f4457){if(_0x1f4457){logger[_0xd834('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd834('0x2f'),_0xd834('0x7e'),_0x1f4457['type'],util[_0xd834('0x7f')](_0x40e0fe[_0xd834('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1f4457['type']){case'twilio':if(_0x40e0fe[_0xd834('0x5c')]['MessageSid']&&_0x40e0fe[_0xd834('0x5c')]['MessageSid']===_0x4d668a[_0xd834('0x80')]){return _0x4d668a['update']({'read':!![]});}else{logger[_0xd834('0x2b')](_0xd834('0x81'),_0xd834('0x2f'),_0xd834('0x82'),util[_0xd834('0x7f')](_0x40e0fe[_0xd834('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xd834('0x83'):if(_0x40e0fe[_0xd834('0x5c')][_0xd834('0x84')]&&_0x40e0fe[_0xd834('0x5c')][_0xd834('0x84')]===_0x4d668a[_0xd834('0x80')]&&_[_0xd834('0x85')](['sent',_0xd834('0x86')],_0x40e0fe[_0xd834('0x5c')]['Status'])>=0x0){return _0x4d668a[_0xd834('0x38')]({'read':!![]});}else{logger['error'](_0xd834('0x81'),_0xd834('0x2f'),_0xd834('0x87'),util['inspect'](_0x40e0fe['body'],{'showHidden':![],'depth':null}));}break;case _0xd834('0x88'):var _0x24d197=_0x40e0fe['body'][_0xd834('0x89')][0x0];if(_0x24d197[_0xd834('0x2f')][_0xd834('0x8a')]===_0xd834('0x8b')){return _0x4d668a['update']({'read':!![]});}else{logger[_0xd834('0x2b')](_0xd834('0x81'),'status',_0xd834('0x88'),util[_0xd834('0x7f')](_0x40e0fe[_0xd834('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4d668a;}})[_0xd834('0x24')](respondWithResult(_0x52db25,null))[_0xd834('0x2d')](handleError(_0x52db25,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 728f647..4999478 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 _0xa091=['../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1cc57c,_0x1e803b){var _0x53d51e=function(_0x5d3410){while(--_0x5d3410){_0x1cc57c['push'](_0x1cc57c['shift']());}};_0x53d51e(++_0x1e803b);}(_0xa091,0x1e9));var _0x1a09=function(_0x44aaca,_0x1c493d){_0x44aaca=_0x44aaca-0x0;var _0x2c950c=_0xa091[_0x44aaca];return _0x2c950c;};'use strict';var EventEmitter=require(_0x1a09('0x0'));var SmsMessage=require(_0x1a09('0x1'))['db'][_0x1a09('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1a09('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a09('0x4'),'afterDestroy':_0x1a09('0x5')};function emitEvent(_0x797dc5){return function(_0x3da56c,_0x122b7e,_0x13fc3b){SmsMessageEvents[_0x1a09('0x6')](_0x797dc5+':'+_0x3da56c['id'],_0x3da56c);SmsMessageEvents[_0x1a09('0x6')](_0x797dc5,_0x3da56c);_0x13fc3b(null);};}for(var e in events){if(events[_0x1a09('0x7')](e)){var event=events[e];SmsMessage[_0x1a09('0x8')](e,emitEvent(event));}}module[_0x1a09('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xb1eb=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x363574,_0x3a2c91){var _0x11f63b=function(_0x4e3df){while(--_0x4e3df){_0x363574['push'](_0x363574['shift']());}};_0x11f63b(++_0x3a2c91);}(_0xb1eb,0x13b));var _0xbb1e=function(_0x3ee74e,_0x507b12){_0x3ee74e=_0x3ee74e-0x0;var _0x5c7607=_0xb1eb[_0x3ee74e];return _0x5c7607;};'use strict';var EventEmitter=require(_0xbb1e('0x0'));var SmsMessage=require(_0xbb1e('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbb1e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x74ddec){return function(_0x1b663d,_0x4c2560,_0x149fe7){SmsMessageEvents[_0xbb1e('0x3')](_0x74ddec+':'+_0x1b663d['id'],_0x1b663d);SmsMessageEvents['emit'](_0x74ddec,_0x1b663d);_0x149fe7(null);};}for(var e in events){if(events[_0xbb1e('0x4')](e)){var event=events[e];SmsMessage[_0xbb1e('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 59d17ff..fe8a570 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 _0xce54=['https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','read','clickSend','plivo','authId','format','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString'];(function(_0x46fe6a,_0x58ff06){var _0x58cb14=function(_0x217dc0){while(--_0x217dc0){_0x46fe6a['push'](_0x46fe6a['shift']());}};_0x58cb14(++_0x58ff06);}(_0xce54,0x131));var _0x4ce5=function(_0x599912,_0x155e1b){_0x599912=_0x599912-0x0;var _0x834598=_0xce54[_0x599912];return _0x834598;};'use strict';var _=require('lodash');var util=require(_0x4ce5('0x0'));var logger=require(_0x4ce5('0x1'))(_0x4ce5('0x2'));var moment=require(_0x4ce5('0x3'));var BPromise=require(_0x4ce5('0x4'));var rp=require(_0x4ce5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ce5('0x6'));var config=require(_0x4ce5('0x7'));var attributes=require(_0x4ce5('0x8'));module['exports']=function(_0x36dab4,_0x3231a5){return _0x36dab4[_0x4ce5('0x9')]('SmsMessage',attributes,{'tableName':_0x4ce5('0xa'),'paranoid':![],'indexes':[{'name':_0x4ce5('0xb'),'fields':[_0x4ce5('0xb')]},{'name':_0x4ce5('0xc'),'fields':['body'],'type':_0x4ce5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ded73,_0x46e3de,_0x17d22a){var _0x345dc4=_0x36dab4[_0x4ce5('0xe')];var _0x242206=_0x4ded73['get']({'plain':!![]});if(_0x242206[_0x4ce5('0xf')][_0x4ce5('0x10')]()==='in'||_0x242206[_0x4ce5('0xf')][_0x4ce5('0x10')]()==='out'&&!_0x242206[_0x4ce5('0x11')]&&!_[_0x4ce5('0x12')](_0x242206['UserId'])){_0x345dc4[_0x4ce5('0x13')][_0x4ce5('0x14')]({'where':{'id':_0x242206[_0x4ce5('0x15')]}})[_0x4ce5('0x16')](function(_0x51711c){if(_0x51711c){_0x51711c[_0x4ce5('0x17')]({'lastMsgAt':_0x242206[_0x4ce5('0x18')],'lastMsgDirection':_0x242206[_0x4ce5('0xf')][_0x4ce5('0x10')]()});}})['catch'](function(_0x24037f){console[_0x4ce5('0x19')](_0x24037f);});}if(_0x242206[_0x4ce5('0xf')]===_0x4ce5('0x1a')&&!_0x242206['secret']){var _0x6f69ac;_0x345dc4[_0x4ce5('0x1b')][_0x4ce5('0x1c')]({'where':{'id':_0x242206[_0x4ce5('0x1d')]},'raw':!![]})['then'](function(_0x560879){_0x6f69ac=_0x560879;if(_0x6f69ac&&_0x6f69ac['type']){switch(_0x6f69ac[_0x4ce5('0x1e')]){case _0x4ce5('0x1f'):var _0x423b5c=require(_0x4ce5('0x1f'));if(_0x6f69ac[_0x4ce5('0x20')]&&_0x6f69ac[_0x4ce5('0x21')]&&_0x6f69ac[_0x4ce5('0x22')]){var _0x237ec7=new _0x423b5c(_0x6f69ac[_0x4ce5('0x20')],_0x6f69ac['authToken']);_0x237ec7[_0x4ce5('0x23')][_0x4ce5('0x24')]({'body':_0x242206[_0x4ce5('0x25')],'to':_0x242206[_0x4ce5('0x22')],'from':_0x6f69ac[_0x4ce5('0x22')],'statusCallback':_0x6f69ac[_0x4ce5('0x26')]+_0x4ce5('0x27')+_0x242206['id']+_0x4ce5('0x28')+_0x6f69ac[_0x4ce5('0x29')]})[_0x4ce5('0x16')](function(_0x2259b4){if(_0x2259b4['sid']){return _0x4ded73['update']({'messageId':_0x2259b4[_0x4ce5('0x2a')]});}})['catch'](function(_0x32c7bd){logger['error'](_0x4ce5('0x2b'),_0x4ce5('0x2c'),'twilio',util[_0x4ce5('0x2d')](_0x32c7bd,{'showHidden':![],'depth':null}));});}else{logger[_0x4ce5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x1f'),_0x4ce5('0x2e'));}break;case _0x4ce5('0x2f'):var _0x2c9a8d=_0x4ce5('0x30');if(_0x6f69ac[_0x4ce5('0x31')]&&_0x6f69ac['password']){var _0x49c417={'recipient':[_0x242206['phone']],'message':_0x242206['body'],'message_type':_0x6f69ac[_0x4ce5('0x32')]};if(_0x6f69ac[_0x4ce5('0x32')]&&_0x6f69ac[_0x4ce5('0x32')]!=='SI'){_0x49c417[_0x4ce5('0x33')]=_0x6f69ac[_0x4ce5('0x22')];}var _0xa0622c={'url':_0x2c9a8d+'login?username='+_0x6f69ac[_0x4ce5('0x31')]+_0x4ce5('0x34')+_0x6f69ac['password'],'method':_0x4ce5('0x35')};rp(_0xa0622c)[_0x4ce5('0x16')](function(_0x4d313b){var _0x5e00ae=_0x4d313b['split'](';');var _0x3f5d90={'user_key':_0x5e00ae[0x0],'session_key':_0x5e00ae[0x1]};_0xa0622c={'url':_0x2c9a8d+_0x4ce5('0x36'),'method':_0x4ce5('0x37'),'headers':{'user_key':_0x3f5d90[_0x4ce5('0x38')],'Session_key':_0x3f5d90[_0x4ce5('0x39')]},'json':!![],'body':_0x49c417};return rp(_0xa0622c);})['then'](function(_0x4b21f1){if(_0x4b21f1[_0x4ce5('0x3a')]>=0x1){var _0x5bc78b={'messageId':_0x4b21f1['internal_order_id']};if(_0x6f69ac[_0x4ce5('0x32')]!=='GP'||!_0x6f69ac[_0x4ce5('0x3b')]){_0x5bc78b['read']=!![];}return _0x4ded73['update'](_0x5bc78b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4ce5('0x2f'),util[_0x4ce5('0x2d')](_0x4b21f1,{'showHidden':![],'depth':null}));}})[_0x4ce5('0x3c')](function(_0x4c0adc){return logger[_0x4ce5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x4ce5('0x2d')](_0x4c0adc,{'showHidden':![],'depth':null}));});}else{logger[_0x4ce5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x2f'),_0x4ce5('0x3d'));}break;case _0x4ce5('0x3e'):if(_0x6f69ac[_0x4ce5('0x21')]){var _0x5687bd={'recipient':_0x242206[_0x4ce5('0x22')],'message':_0x242206[_0x4ce5('0x25')],'sender':_0x6f69ac[_0x4ce5('0x3f')]||_0x6f69ac[_0x4ce5('0x22')],'authorization':_0x6f69ac[_0x4ce5('0x21')]};var _0x46e3de={'method':_0x4ce5('0x37'),'uri':_0x4ce5('0x40'),'body':_0x5687bd,'json':!![]};rp(_0x46e3de)[_0x4ce5('0x16')](function(_0x3e4757){var _0x115b80={'messageId':_0x3e4757[_0x4ce5('0x41')]};if(!_0x6f69ac[_0x4ce5('0x3b')]){_0x115b80['read']=!![];}return _0x4ded73[_0x4ce5('0x17')](_0x115b80);})[_0x4ce5('0x3c')](function(_0x416762){logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x3e'),util[_0x4ce5('0x2d')](_0x416762,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x3e'),_0x4ce5('0x42'));}break;case _0x4ce5('0x43'):if(_0x6f69ac[_0x4ce5('0x31')]&&_0x6f69ac[_0x4ce5('0x44')]){var _0x5687bd={'messages':[{'source':_0x4ce5('0x45'),'to':_0x242206['phone'],'body':_0x242206[_0x4ce5('0x25')],'from':_0x6f69ac[_0x4ce5('0x3f')]||_0x6f69ac[_0x4ce5('0x22')]}]};var _0x4d8516=util['format'](_0x4ce5('0x46'),_0x6f69ac[_0x4ce5('0x31')],_0x6f69ac[_0x4ce5('0x44')]);var _0x46e3de={'method':_0x4ce5('0x37'),'uri':_0x4ce5('0x47'),'body':_0x5687bd,'headers':{'Authorization':util['format'](_0x4ce5('0x48'),new Buffer(_0x4d8516)[_0x4ce5('0x49')](_0x4ce5('0x4a')))},'json':!![]};rp(_0x46e3de)[_0x4ce5('0x16')](function(_0x4d26f9){if(_0x4d26f9[_0x4ce5('0x4b')]>=0xc8&&_0x4d26f9[_0x4ce5('0x4b')]<=0xce){if(_0x4d26f9[_0x4ce5('0x4c')]&&_0x4d26f9[_0x4ce5('0x4c')]['queued_count']>0x0){var _0x2fc38b=_[_0x4ce5('0x4d')](_0x4d26f9[_0x4ce5('0x4c')][_0x4ce5('0x23')]);var _0x501f66={'messageId':_0x2fc38b[_0x4ce5('0x4e')]};if(!_0x6f69ac[_0x4ce5('0x3b')]){_0x501f66[_0x4ce5('0x4f')]=!![];}return _0x4ded73['update'](_0x501f66);}else{logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x50'),util['inspect'](_0x4d26f9,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x50'),util[_0x4ce5('0x2d')](_0x4d26f9,{'showHidden':![],'depth':null}));}})[_0x4ce5('0x3c')](function(_0x4d0116){logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x50'),util[_0x4ce5('0x2d')](_0x4d0116,{'showHidden':![],'depth':null}));});}else{logger[_0x4ce5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x50'),_0x4ce5('0x3d'));}break;case _0x4ce5('0x51'):if(_0x6f69ac[_0x4ce5('0x52')]&&_0x6f69ac[_0x4ce5('0x21')]){var _0x5687bd={'dst':_0x242206[_0x4ce5('0x22')],'text':_0x242206[_0x4ce5('0x25')],'src':_0x6f69ac[_0x4ce5('0x3f')]||_0x6f69ac[_0x4ce5('0x22')],'url':_0x6f69ac[_0x4ce5('0x26')]+'/api/sms/messages/'+_0x242206['id']+_0x4ce5('0x28')+_0x6f69ac[_0x4ce5('0x29')]};var _0x4d8516=util[_0x4ce5('0x53')]('%s:%s',_0x6f69ac[_0x4ce5('0x52')],_0x6f69ac[_0x4ce5('0x21')]);var _0x46e3de={'method':_0x4ce5('0x37'),'uri':util[_0x4ce5('0x53')](_0x4ce5('0x54'),_0x6f69ac[_0x4ce5('0x52')]),'body':_0x5687bd,'headers':{'Authorization':util[_0x4ce5('0x53')]('Basic\x20%s',new Buffer(_0x4d8516)[_0x4ce5('0x49')](_0x4ce5('0x4a')))},'json':!![]};rp(_0x46e3de)[_0x4ce5('0x16')](function(_0x3341ad){var _0x1f0aaf={'messageId':_0x3341ad['message_uuid'][0x0]};return _0x4ded73[_0x4ce5('0x17')](_0x1f0aaf);})[_0x4ce5('0x3c')](function(_0x380b12){logger[_0x4ce5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x51'),util[_0x4ce5('0x2d')](_0x380b12,{'showHidden':![],'depth':null}));});}else{logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),'plivo',_0x4ce5('0x55'));}break;case _0x4ce5('0x56'):if(_0x6f69ac['username']&&_0x6f69ac[_0x4ce5('0x44')]){if(_0x6f69ac[_0x4ce5('0x57')]){var _0x151c7a={'method':_0x4ce5('0x37'),'uri':_0x6f69ac[_0x4ce5('0x57')]+_0x4ce5('0x58'),'body':{'username':_0x6f69ac['username'],'password':_0x6f69ac[_0x4ce5('0x44')]},'json':!![]};return rp(_0x151c7a)[_0x4ce5('0x16')](function(_0x56d08b){var _0x30e41c={'method':_0x4ce5('0x37'),'uri':_0x6f69ac['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x6f69ac['phone'],'destinations':[{'to':_0x242206[_0x4ce5('0x22')]}],'text':_0x242206[_0x4ce5('0x25')],'notifyUrl':_0x6f69ac[_0x4ce5('0x26')]+'/api/sms/messages/'+_0x242206['id']+_0x4ce5('0x28')+_0x6f69ac['token'],'notifyContentType':_0x4ce5('0x59'),'callbackData':_0x6f69ac[_0x4ce5('0x22')]+';'+_0x242206[_0x4ce5('0x25')]}]},'headers':{'Authorization':_0x4ce5('0x5a')+_0x56d08b[_0x4ce5('0x29')]},'json':!![]};return rp(_0x30e41c)['then'](function(_0x54b9a8){if(_0x54b9a8[_0x4ce5('0x23')]){var _0x29d790={'messageId':_0x54b9a8['messages'][0x0][_0x4ce5('0xb')]};if(!_0x6f69ac['deliveryReport']){_0x29d790[_0x4ce5('0x4f')]=!![];}return _0x4ded73['update'](_0x29d790);}else{return logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),'infobip',util[_0x4ce5('0x2d')](_0x54b9a8,{'showHidden':![],'depth':null}));}});})[_0x4ce5('0x3c')](function(_0x57a18a){return logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),'afterCreate',_0x4ce5('0x56'),util['inspect'](_0x57a18a,{'showHidden':![],'depth':null}));});}else{logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x56'),_0x4ce5('0x3d'));}break;case _0x4ce5('0x5b'):var _0x35f39e=require(_0x4ce5('0x5c'));if(_0x6f69ac[_0x4ce5('0x5d')]){var _0xf5de5a={};_0xf5de5a[_0x4ce5('0x5e')]=_0x6f69ac[_0x4ce5('0x31')];_0xf5de5a['phone']=_0x242206['phone'];_0xf5de5a[_0x4ce5('0x33')]=_0x6f69ac['phone'];_0xf5de5a[_0x4ce5('0x5f')]=_0x242206[_0x4ce5('0x25')];_0xf5de5a[_0x4ce5('0x60')]=+new Date();var _0x28f8ed='';var _0x9e333='';var _0x4c4420=Object[_0x4ce5('0x61')](_0xf5de5a);_0x4c4420[_0x4ce5('0x62')]();for(var _0x1ceb7e=0x0;_0x1ceb7e<_0x4c4420[_0x4ce5('0x63')];_0x1ceb7e++){if(_0x28f8ed!=''){_0x28f8ed+='&';}_0x28f8ed+=_0x4c4420[_0x1ceb7e]+'='+encodeURIComponent(_0xf5de5a[_0x4c4420[_0x1ceb7e]]);_0x9e333+=_0xf5de5a[_0x4c4420[_0x1ceb7e]];}_0x9e333+=_0x6f69ac[_0x4ce5('0x5d')];_0x9e333=_0x35f39e['createHash'](_0x4ce5('0x64'))[_0x4ce5('0x17')](_0x9e333)[_0x4ce5('0x65')](_0x4ce5('0x66'));if(_0x28f8ed!==''){_0x28f8ed+='&';}_0x28f8ed+=_0x4ce5('0x67')+_0x9e333;var _0xa0622c={'method':_0x4ce5('0x35'),'uri':_0x6f69ac[_0x4ce5('0x57')]+_0x4ce5('0x68')+_0x28f8ed,'json':!![]};return rp(_0xa0622c)['then'](function(_0xae7f7a){var _0x56dd3c=Object['keys'](_0xae7f7a);if(_0xae7f7a[_0x56dd3c[0x0]]['error']&&parseInt(_0xae7f7a[_0x56dd3c[0x0]][_0x4ce5('0x19')])===0x0){var _0x45a628={'messageId':_0xae7f7a[_0x56dd3c[0x0]][_0x4ce5('0x69')]};if(!_0x6f69ac[_0x4ce5('0x3b')]){_0x45a628[_0x4ce5('0x4f')]=!![];}return _0x4ded73[_0x4ce5('0x17')](_0x45a628);}else{return logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x5b'),util['inspect'](_0xae7f7a['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x21143f){return logger['error'](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x5b'),util[_0x4ce5('0x2d')](_0x21143f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x5b'),_0x4ce5('0x6a'));}break;case _0x4ce5('0x6b'):if(_0x6f69ac['apiKey']){var _0x70a079={'method':_0x4ce5('0x37'),'uri':_0x4ce5('0x6c'),'headers':{'Authorization':_0x6f69ac[_0x4ce5('0x5d')]},'body':{'content':_0x242206[_0x4ce5('0x25')],'to':[_0x242206[_0x4ce5('0x22')]],'from':_0x6f69ac[_0x4ce5('0x22')],'binary':![],'clientMessageId':_0x4ce5('0x6d'),'charset':_0x4ce5('0x6e')},'json':!![]};rp(_0x70a079)[_0x4ce5('0x16')](function(_0x4dbb32){if(!_0x4dbb32[_0x4ce5('0x19')]){var _0x57598d={'messageId':_0x4dbb32[_0x4ce5('0x23')][0x0][_0x4ce5('0x6f')]};if(!_0x6f69ac[_0x4ce5('0x3b')]){_0x57598d['read']=!![];}return _0x4ded73[_0x4ce5('0x17')](_0x57598d);}else{return logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x6b'),util['inspect'](_0x4dbb32[_0x4ce5('0x19')],{'showHidden':![],'depth':null}));}})[_0x4ce5('0x3c')](function(_0x138068){return logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),'afterCreate','clickatell',util[_0x4ce5('0x2d')](_0x138068,{'showHidden':![],'depth':null}));});}else{logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x6b'),_0x4ce5('0x6a'));}break;case'intelepeer':if(_0x6f69ac[_0x4ce5('0x5d')]){var _0x5f2c24={};var _0xa0622c={'method':'POST','uri':_0x4ce5('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x6f69ac[_0x4ce5('0x5d')],'Content-Type':_0x4ce5('0x59')},'body':{'from':_0x6f69ac[_0x4ce5('0x22')],'to':_0x242206[_0x4ce5('0x22')],'text':_0x242206[_0x4ce5('0x25')]},'json':!![]};return rp(_0xa0622c)[_0x4ce5('0x16')](function(_0x41cd46){if(_0x41cd46[_0x4ce5('0x71')]==0xca){_0x5f2c24[_0x4ce5('0x72')]=_0x41cd46;var _0x191310={'method':_0x4ce5('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4ce5('0x73')+_0x6f69ac[_0x4ce5('0x5d')],'Content-Type':_0x4ce5('0x59')},'body':{'refid':_0x5f2c24[_0x4ce5('0x72')][_0x4ce5('0x74')]},'json':!![]};return rp(_0x191310)[_0x4ce5('0x16')](function(_0x56f4b0){_0x5f2c24[_0x4ce5('0x75')]=_0x56f4b0;var _0x523d02={'messageId':_0x5f2c24[_0x4ce5('0x72')][_0x4ce5('0x74')],'read':!![]};return _0x4ded73[_0x4ce5('0x17')](_0x523d02);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x76'),util['inspect'](_0x41cd46,{'showHidden':![],'depth':null}));}})['catch'](function(_0x325085){return logger[_0x4ce5('0x19')](_0x4ce5('0x2b'),_0x4ce5('0x2c'),_0x4ce5('0x76'),util[_0x4ce5('0x2d')](_0x325085,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ce5('0x2c'),_0x4ce5('0x76'),_0x4ce5('0x77'));}break;}}})[_0x4ce5('0x78')](function(){_0x17d22a();});}else{_0x17d22a();}}},'charset':_0x4ce5('0x79'),'collate':_0x4ce5('0x7a')});}; \ No newline at end of file +var _0xfe3e=['define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','SmsInteraction','findOne','then','createdAt','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','https://smsapi.connectel.se/api/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','messages','csc','crypto','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./smsMessage.attributes','exports'];(function(_0x5c6fed,_0x36438f){var _0x207c69=function(_0x21f633){while(--_0x21f633){_0x5c6fed['push'](_0x5c6fed['shift']());}};_0x207c69(++_0x36438f);}(_0xfe3e,0xeb));var _0xefe3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfe3e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xefe3('0x0'));var util=require(_0xefe3('0x1'));var logger=require(_0xefe3('0x2'))('api');var moment=require(_0xefe3('0x3'));var BPromise=require(_0xefe3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefe3('0x5'));var rimraf=require('rimraf');var config=require(_0xefe3('0x6'));var attributes=require(_0xefe3('0x7'));module[_0xefe3('0x8')]=function(_0x39ff9c,_0x3c7aab){return _0x39ff9c[_0xefe3('0x9')](_0xefe3('0xa'),attributes,{'tableName':_0xefe3('0xb'),'paranoid':![],'indexes':[{'name':_0xefe3('0xc'),'fields':[_0xefe3('0xc')]},{'name':_0xefe3('0xd'),'fields':[_0xefe3('0xe')],'type':_0xefe3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2db8a0,_0x5e0ae8,_0x4ac9d1){var _0x9cdd16=_0x39ff9c[_0xefe3('0x10')];var _0x517142=_0x2db8a0[_0xefe3('0x11')]({'plain':!![]});if(_0x517142[_0xefe3('0x12')][_0xefe3('0x13')]()==='in'||_0x517142[_0xefe3('0x12')][_0xefe3('0x13')]()==='out'&&!_0x517142['secret']&&!_[_0xefe3('0x14')](_0x517142[_0xefe3('0x15')])){_0x9cdd16[_0xefe3('0x16')][_0xefe3('0x17')]({'where':{'id':_0x517142['SmsInteractionId']}})[_0xefe3('0x18')](function(_0x3feded){if(_0x3feded){_0x3feded['update']({'lastMsgAt':_0x517142[_0xefe3('0x19')],'lastMsgDirection':_0x517142[_0xefe3('0x12')][_0xefe3('0x13')]()});}})['catch'](function(_0x369286){console[_0xefe3('0x1a')](_0x369286);});}if(_0x517142['direction']==='out'&&!_0x517142[_0xefe3('0x1b')]){var _0x13099e;_0x9cdd16['SmsAccount'][_0xefe3('0x1c')]({'where':{'id':_0x517142[_0xefe3('0x1d')]},'raw':!![]})[_0xefe3('0x18')](function(_0x207bd7){_0x13099e=_0x207bd7;if(_0x13099e&&_0x13099e['type']){switch(_0x13099e[_0xefe3('0x1e')]){case _0xefe3('0x1f'):var _0x502148=require(_0xefe3('0x1f'));if(_0x13099e[_0xefe3('0x20')]&&_0x13099e[_0xefe3('0x21')]&&_0x13099e[_0xefe3('0x22')]){var _0x5856e0=new _0x502148(_0x13099e[_0xefe3('0x20')],_0x13099e[_0xefe3('0x21')]);_0x5856e0['messages'][_0xefe3('0x23')]({'body':_0x517142['body'],'to':_0x517142['phone'],'from':_0x13099e['phone'],'statusCallback':_0x13099e[_0xefe3('0x24')]+_0xefe3('0x25')+_0x517142['id']+_0xefe3('0x26')+_0x13099e[_0xefe3('0x27')]})[_0xefe3('0x18')](function(_0x5ec8f1){if(_0x5ec8f1[_0xefe3('0x28')]){return _0x2db8a0[_0xefe3('0x29')]({'messageId':_0x5ec8f1[_0xefe3('0x28')]});}})[_0xefe3('0x2a')](function(_0x548dbe){logger['error'](_0xefe3('0x2b'),_0xefe3('0x2c'),'twilio',util[_0xefe3('0x2d')](_0x548dbe,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x1f'),_0xefe3('0x2e'));}break;case _0xefe3('0x2f'):var _0x23a991=_0xefe3('0x30');if(_0x13099e['username']&&_0x13099e['password']){var _0x1c9cea={'recipient':[_0x517142[_0xefe3('0x22')]],'message':_0x517142['body'],'message_type':_0x13099e[_0xefe3('0x31')]};if(_0x13099e['smsMethod']&&_0x13099e[_0xefe3('0x31')]!=='SI'){_0x1c9cea[_0xefe3('0x32')]=_0x13099e['phone'];}var _0x236ead={'url':_0x23a991+_0xefe3('0x33')+_0x13099e[_0xefe3('0x34')]+_0xefe3('0x35')+_0x13099e['password'],'method':_0xefe3('0x36')};rp(_0x236ead)[_0xefe3('0x18')](function(_0x3df398){var _0x3cfd94=_0x3df398['split'](';');var _0x16e7ae={'user_key':_0x3cfd94[0x0],'session_key':_0x3cfd94[0x1]};_0x236ead={'url':_0x23a991+_0xefe3('0x37'),'method':_0xefe3('0x38'),'headers':{'user_key':_0x16e7ae[_0xefe3('0x39')],'Session_key':_0x16e7ae[_0xefe3('0x3a')]},'json':!![],'body':_0x1c9cea};return rp(_0x236ead);})[_0xefe3('0x18')](function(_0x1e7969){if(_0x1e7969[_0xefe3('0x3b')]>=0x1){var _0x357e9f={'messageId':_0x1e7969[_0xefe3('0x3c')]};if(_0x13099e[_0xefe3('0x31')]!=='GP'||!_0x13099e[_0xefe3('0x3d')]){_0x357e9f[_0xefe3('0x3e')]=!![];}return _0x2db8a0[_0xefe3('0x29')](_0x357e9f);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefe3('0x2c'),'skebby',util[_0xefe3('0x2d')](_0x1e7969,{'showHidden':![],'depth':null}));}})[_0xefe3('0x2a')](function(_0x29b7a7){return logger[_0xefe3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xefe3('0x2f'),util[_0xefe3('0x2d')](_0x29b7a7,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),'afterCreate',_0xefe3('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x13099e['authToken']){var _0x545a08={'recipient':_0x517142[_0xefe3('0x22')],'message':_0x517142['body'],'sender':_0x13099e['senderString']||_0x13099e[_0xefe3('0x22')],'authorization':_0x13099e[_0xefe3('0x21')]};var _0x5e0ae8={'method':_0xefe3('0x38'),'uri':_0xefe3('0x3f'),'body':_0x545a08,'json':!![]};rp(_0x5e0ae8)[_0xefe3('0x18')](function(_0x14976c){var _0x4facc3={'messageId':_0x14976c['requestid']};if(!_0x13099e[_0xefe3('0x3d')]){_0x4facc3[_0xefe3('0x3e')]=!![];}return _0x2db8a0[_0xefe3('0x29')](_0x4facc3);})[_0xefe3('0x2a')](function(_0x1e6d63){logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x40'),util[_0xefe3('0x2d')](_0x1e6d63,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x40'),_0xefe3('0x41'));}break;case _0xefe3('0x42'):if(_0x13099e[_0xefe3('0x34')]&&_0x13099e[_0xefe3('0x43')]){var _0x545a08={'messages':[{'source':_0xefe3('0x44'),'to':_0x517142[_0xefe3('0x22')],'body':_0x517142[_0xefe3('0xe')],'from':_0x13099e[_0xefe3('0x45')]||_0x13099e['phone']}]};var _0x3e50a9=util['format'](_0xefe3('0x46'),_0x13099e[_0xefe3('0x34')],_0x13099e[_0xefe3('0x43')]);var _0x5e0ae8={'method':'POST','uri':_0xefe3('0x47'),'body':_0x545a08,'headers':{'Authorization':util[_0xefe3('0x48')](_0xefe3('0x49'),new Buffer(_0x3e50a9)['toString'](_0xefe3('0x4a')))},'json':!![]};rp(_0x5e0ae8)['then'](function(_0x288edb){if(_0x288edb[_0xefe3('0x4b')]>=0xc8&&_0x288edb[_0xefe3('0x4b')]<=0xce){if(_0x288edb[_0xefe3('0x4c')]&&_0x288edb['data']['queued_count']>0x0){var _0x258573=_['head'](_0x288edb['data']['messages']);var _0x341edb={'messageId':_0x258573[_0xefe3('0x4d')]};if(!_0x13099e['deliveryReport']){_0x341edb[_0xefe3('0x3e')]=!![];}return _0x2db8a0[_0xefe3('0x29')](_0x341edb);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xefe3('0x4e'),util['inspect'](_0x288edb,{'showHidden':![],'depth':null}));}}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),'afterCreate',_0xefe3('0x4e'),util[_0xefe3('0x2d')](_0x288edb,{'showHidden':![],'depth':null}));}})[_0xefe3('0x2a')](function(_0x3049e8){logger['error'](_0xefe3('0x2b'),_0xefe3('0x2c'),'clickSend',util[_0xefe3('0x2d')](_0x3049e8,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x4e'),_0xefe3('0x4f'));}break;case'plivo':if(_0x13099e[_0xefe3('0x50')]&&_0x13099e['authToken']){var _0x545a08={'dst':_0x517142[_0xefe3('0x22')],'text':_0x517142[_0xefe3('0xe')],'src':_0x13099e['senderString']||_0x13099e[_0xefe3('0x22')],'url':_0x13099e[_0xefe3('0x24')]+_0xefe3('0x25')+_0x517142['id']+'/status?token='+_0x13099e['token']};var _0x3e50a9=util['format'](_0xefe3('0x46'),_0x13099e[_0xefe3('0x50')],_0x13099e[_0xefe3('0x21')]);var _0x5e0ae8={'method':_0xefe3('0x38'),'uri':util[_0xefe3('0x48')](_0xefe3('0x51'),_0x13099e[_0xefe3('0x50')]),'body':_0x545a08,'headers':{'Authorization':util[_0xefe3('0x48')]('Basic\x20%s',new Buffer(_0x3e50a9)[_0xefe3('0x52')]('base64'))},'json':!![]};rp(_0x5e0ae8)[_0xefe3('0x18')](function(_0x23e0ef){var _0x45bd2c={'messageId':_0x23e0ef[_0xefe3('0x53')][0x0]};return _0x2db8a0[_0xefe3('0x29')](_0x45bd2c);})[_0xefe3('0x2a')](function(_0x37705c){logger[_0xefe3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xefe3('0x54'),util['inspect'](_0x37705c,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),'afterCreate','plivo',_0xefe3('0x55'));}break;case _0xefe3('0x56'):if(_0x13099e[_0xefe3('0x34')]&&_0x13099e[_0xefe3('0x43')]){if(_0x13099e[_0xefe3('0x57')]){var _0x4ab7c8={'method':_0xefe3('0x38'),'uri':_0x13099e['baseUrl']+_0xefe3('0x58'),'body':{'username':_0x13099e[_0xefe3('0x34')],'password':_0x13099e[_0xefe3('0x43')]},'json':!![]};return rp(_0x4ab7c8)[_0xefe3('0x18')](function(_0x3f198e){var _0x3f6904={'method':'POST','uri':_0x13099e[_0xefe3('0x57')]+_0xefe3('0x59'),'body':{'messages':[{'from':_0x13099e[_0xefe3('0x22')],'destinations':[{'to':_0x517142[_0xefe3('0x22')]}],'text':_0x517142[_0xefe3('0xe')],'notifyUrl':_0x13099e[_0xefe3('0x24')]+_0xefe3('0x25')+_0x517142['id']+_0xefe3('0x26')+_0x13099e[_0xefe3('0x27')],'notifyContentType':'application/json','callbackData':_0x13099e[_0xefe3('0x22')]+';'+_0x517142[_0xefe3('0xe')]}]},'headers':{'Authorization':_0xefe3('0x5a')+_0x3f198e[_0xefe3('0x27')]},'json':!![]};return rp(_0x3f6904)[_0xefe3('0x18')](function(_0x52b852){if(_0x52b852[_0xefe3('0x5b')]){var _0x3157d0={'messageId':_0x52b852[_0xefe3('0x5b')][0x0][_0xefe3('0xc')]};if(!_0x13099e[_0xefe3('0x3d')]){_0x3157d0[_0xefe3('0x3e')]=!![];}return _0x2db8a0[_0xefe3('0x29')](_0x3157d0);}else{return logger['error'](_0xefe3('0x2b'),'afterCreate',_0xefe3('0x56'),util['inspect'](_0x52b852,{'showHidden':![],'depth':null}));}});})[_0xefe3('0x2a')](function(_0x28c5fe){return logger[_0xefe3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefe3('0x2c'),'infobip',util['inspect'](_0x28c5fe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xefe3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefe3('0x2c'),_0xefe3('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xefe3('0x5c'):var _0x2e7bb6=require(_0xefe3('0x5d'));if(_0x13099e[_0xefe3('0x5e')]){var _0xf004be={};_0xf004be['login']=_0x13099e[_0xefe3('0x34')];_0xf004be[_0xefe3('0x22')]=_0x517142[_0xefe3('0x22')];_0xf004be[_0xefe3('0x32')]=_0x13099e[_0xefe3('0x22')];_0xf004be[_0xefe3('0x5f')]=_0x517142[_0xefe3('0xe')];_0xf004be[_0xefe3('0x60')]=+new Date();var _0x12b389='';var _0x5cdaca='';var _0x12696b=Object[_0xefe3('0x61')](_0xf004be);_0x12696b[_0xefe3('0x62')]();for(var _0x20d461=0x0;_0x20d461<_0x12696b[_0xefe3('0x63')];_0x20d461++){if(_0x12b389!=''){_0x12b389+='&';}_0x12b389+=_0x12696b[_0x20d461]+'='+encodeURIComponent(_0xf004be[_0x12696b[_0x20d461]]);_0x5cdaca+=_0xf004be[_0x12696b[_0x20d461]];}_0x5cdaca+=_0x13099e[_0xefe3('0x5e')];_0x5cdaca=_0x2e7bb6[_0xefe3('0x64')](_0xefe3('0x65'))[_0xefe3('0x29')](_0x5cdaca)[_0xefe3('0x66')](_0xefe3('0x67'));if(_0x12b389!==''){_0x12b389+='&';}_0x12b389+=_0xefe3('0x68')+_0x5cdaca;var _0x236ead={'method':_0xefe3('0x36'),'uri':_0x13099e['baseUrl']+_0xefe3('0x69')+_0x12b389,'json':!![]};return rp(_0x236ead)[_0xefe3('0x18')](function(_0xfdd224){var _0x1f55f0=Object[_0xefe3('0x61')](_0xfdd224);if(_0xfdd224[_0x1f55f0[0x0]][_0xefe3('0x1a')]&&parseInt(_0xfdd224[_0x1f55f0[0x0]][_0xefe3('0x1a')])===0x0){var _0xb4ad4f={'messageId':_0xfdd224[_0x1f55f0[0x0]]['id_sms']};if(!_0x13099e['deliveryReport']){_0xb4ad4f[_0xefe3('0x3e')]=!![];}return _0x2db8a0[_0xefe3('0x29')](_0xb4ad4f);}else{return logger[_0xefe3('0x1a')](_0xefe3('0x2b'),'afterCreate','csc',util[_0xefe3('0x2d')](_0xfdd224[_0xefe3('0x1a')],{'showHidden':![],'depth':null}));}})[_0xefe3('0x2a')](function(_0x1fc302){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefe3('0x2c'),_0xefe3('0x5c'),util['inspect'](_0x1fc302,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),'csc',_0xefe3('0x6a'));}break;case'clickatell':if(_0x13099e['apiKey']){var _0x594629={'method':'POST','uri':_0xefe3('0x6b'),'headers':{'Authorization':_0x13099e[_0xefe3('0x5e')]},'body':{'content':_0x517142[_0xefe3('0xe')],'to':[_0x517142['phone']],'from':_0x13099e[_0xefe3('0x22')],'binary':![],'clientMessageId':_0xefe3('0x6c'),'charset':_0xefe3('0x6d')},'json':!![]};rp(_0x594629)[_0xefe3('0x18')](function(_0x97f149){if(!_0x97f149[_0xefe3('0x1a')]){var _0x452fb9={'messageId':_0x97f149[_0xefe3('0x5b')][0x0]['apiMessageId']};if(!_0x13099e[_0xefe3('0x3d')]){_0x452fb9['read']=!![];}return _0x2db8a0[_0xefe3('0x29')](_0x452fb9);}else{return logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x6e'),util[_0xefe3('0x2d')](_0x97f149[_0xefe3('0x1a')],{'showHidden':![],'depth':null}));}})[_0xefe3('0x2a')](function(_0x533509){return logger[_0xefe3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefe3('0x2c'),'clickatell',util[_0xefe3('0x2d')](_0x533509,{'showHidden':![],'depth':null}));});}else{logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),'clickatell',_0xefe3('0x6a'));}break;case'intelepeer':if(_0x13099e['apiKey']){var _0x1c6763={};var _0x236ead={'method':_0xefe3('0x38'),'uri':_0xefe3('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x13099e[_0xefe3('0x5e')],'Content-Type':_0xefe3('0x70')},'body':{'from':_0x13099e['phone'],'to':_0x517142[_0xefe3('0x22')],'text':_0x517142[_0xefe3('0xe')]},'json':!![]};return rp(_0x236ead)[_0xefe3('0x18')](function(_0x75f752){if(_0x75f752[_0xefe3('0x71')]==0xca){_0x1c6763[_0xefe3('0x72')]=_0x75f752;var _0x13bb36={'method':_0xefe3('0x38'),'uri':_0xefe3('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x13099e[_0xefe3('0x5e')],'Content-Type':_0xefe3('0x70')},'body':{'refid':_0x1c6763[_0xefe3('0x72')][_0xefe3('0x74')]},'json':!![]};return rp(_0x13bb36)[_0xefe3('0x18')](function(_0x1bf380){_0x1c6763['status']=_0x1bf380;var _0x2b01d8={'messageId':_0x1c6763[_0xefe3('0x72')][_0xefe3('0x74')],'read':!![]};return _0x2db8a0[_0xefe3('0x29')](_0x2b01d8);});}else{return logger['error'](_0xefe3('0x2b'),_0xefe3('0x2c'),_0xefe3('0x75'),util[_0xefe3('0x2d')](_0x75f752,{'showHidden':![],'depth':null}));}})[_0xefe3('0x2a')](function(_0x39adaa){return logger[_0xefe3('0x1a')](_0xefe3('0x2b'),_0xefe3('0x2c'),'intelepeer',util[_0xefe3('0x2d')](_0x39adaa,{'showHidden':![],'depth':null}));});}else{return logger[_0xefe3('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefe3('0x2c'),_0xefe3('0x75'),_0xefe3('0x76'));}break;}}})[_0xefe3('0x77')](function(){_0x4ac9d1();});}else{_0x4ac9d1();}}},'charset':_0xefe3('0x78'),'collate':_0xefe3('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 8469285..0116f0c 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 _0x5f66=['stringify','error','code','message','info','result','SmsMessage','create','body','options','raw','CreateSmsMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x8cd6e2,_0x575253){var _0xa16e00=function(_0x3b75b9){while(--_0x3b75b9){_0x8cd6e2['push'](_0x8cd6e2['shift']());}};_0xa16e00(++_0x575253);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateSmsMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateSmsMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +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(_0x4209d8,_0x539217){var _0x11354a=function(_0x49c77e){while(--_0x49c77e){_0x4209d8['push'](_0x4209d8['shift']());}};_0x11354a(++_0x539217);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4254e7,_0x4fc342){_0x4254e7=_0x4254e7-0x0;var _0x5e0844=_0x0b0e[_0x4254e7];return _0x5e0844;};'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 diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c024c52..25edec6 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 _0x8be7=['register','smsMessage:','save','remove','removeListener'];(function(_0x1fdb7a,_0x546bae){var _0x3ef208=function(_0x3b8cad){while(--_0x3b8cad){_0x1fdb7a['push'](_0x1fdb7a['shift']());}};_0x3ef208(++_0x546bae);}(_0x8be7,0x1ba));var _0x78be=function(_0x2567f1,_0x16d4c1){_0x2567f1=_0x2567f1-0x0;var _0x8a4cda=_0x8be7[_0x2567f1];return _0x8a4cda;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x78be('0x0'),_0x78be('0x1'),'update'];function createListener(_0x72d445,_0x1c5965){return function(_0x246b36){_0x1c5965['emit'](_0x72d445,_0x246b36);};}function removeListener(_0x2e4b7f,_0x182069){return function(){SmsMessageEvents[_0x78be('0x2')](_0x2e4b7f,_0x182069);};}exports[_0x78be('0x3')]=function(_0x5cea29){for(var _0x5d78c1=0x0,_0x3ab758=events['length'];_0x5d78c1<_0x3ab758;_0x5d78c1++){var _0x4012ee=events[_0x5d78c1];var _0x5ff987=createListener(_0x78be('0x4')+_0x4012ee,_0x5cea29);SmsMessageEvents['on'](_0x4012ee,_0x5ff987);}}; \ No newline at end of file +var _0x1da9=['./smsMessage.events','save','remove','update','emit','removeListener','length','smsMessage:'];(function(_0x4f937b,_0x1a6289){var _0x1856ac=function(_0x101164){while(--_0x101164){_0x4f937b['push'](_0x4f937b['shift']());}};_0x1856ac(++_0x1a6289);}(_0x1da9,0x98));var _0x91da=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1da9[_0x311c35];return _0x5cc50c;};'use strict';var SmsMessageEvents=require(_0x91da('0x0'));var events=[_0x91da('0x1'),_0x91da('0x2'),_0x91da('0x3')];function createListener(_0x4ad51c,_0x14c423){return function(_0x1e7487){_0x14c423[_0x91da('0x4')](_0x4ad51c,_0x1e7487);};}function removeListener(_0x56899a,_0x23b813){return function(){SmsMessageEvents[_0x91da('0x5')](_0x56899a,_0x23b813);};}exports['register']=function(_0x512bb4){for(var _0x5a8ca7=0x0,_0x336b9f=events[_0x91da('0x6')];_0x5a8ca7<_0x336b9f;_0x5a8ca7++){var _0x40eff6=events[_0x5a8ca7];var _0x574aaa=createListener(_0x91da('0x7')+_0x40eff6,_0x512bb4);SmsMessageEvents['on'](_0x40eff6,_0x574aaa);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 1a7e21b..606a3ca 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 _0xdded=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports'];(function(_0x3f053e,_0x24f052){var _0x3ca0aa=function(_0x3e44a4){while(--_0x3e44a4){_0x3f053e['push'](_0x3f053e['shift']());}};_0x3ca0aa(++_0x24f052);}(_0xdded,0x17a));var _0xddde=function(_0x2074a3,_0x48312b){_0x2074a3=_0x2074a3-0x0;var _0x1620cc=_0xdded[_0x2074a3];return _0x1620cc;};'use strict';var multer=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var path=require(_0xddde('0x2'));var timeout=require(_0xddde('0x3'));var express=require(_0xddde('0x4'));var router=express[_0xddde('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xddde('0x6'));var config=require(_0xddde('0x7'));var controller=require(_0xddde('0x8'));router[_0xddde('0x9')]('/',auth[_0xddde('0xa')](),controller[_0xddde('0xb')]);router[_0xddde('0x9')](_0xddde('0xc'),auth[_0xddde('0xa')](),controller[_0xddde('0xd')]);router[_0xddde('0x9')]('/:id',auth[_0xddde('0xa')](),controller['show']);router['get']('/:id/members',auth[_0xddde('0xa')](),controller['getMembers']);router[_0xddde('0x9')]('/:id/teams',auth[_0xddde('0xa')](),controller[_0xddde('0xe')]);router[_0xddde('0x9')](_0xddde('0xf'),auth[_0xddde('0xa')](),controller[_0xddde('0x10')]);router[_0xddde('0x11')]('/',auth[_0xddde('0xa')](),controller['create']);router[_0xddde('0x11')](_0xddde('0x12'),auth[_0xddde('0xa')](),controller[_0xddde('0x13')]);router[_0xddde('0x11')](_0xddde('0xf'),auth['isAuthenticated'](),controller[_0xddde('0x14')]);router[_0xddde('0x15')](_0xddde('0x16'),auth['isAuthenticated'](),controller['update']);router[_0xddde('0x17')]('/:id',auth[_0xddde('0xa')](),controller[_0xddde('0x18')]);router[_0xddde('0x17')](_0xddde('0x12'),auth[_0xddde('0xa')](),controller['removeTeams']);router[_0xddde('0x17')](_0xddde('0xf'),auth['isAuthenticated'](),controller[_0xddde('0x19')]);module[_0xddde('0x1a')]=router; \ No newline at end of file +var _0x9d56=['removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','/:id/users'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x9d56,0x122));var _0x69d5=function(_0x5f564b,_0x208cfd){_0x5f564b=_0x5f564b-0x0;var _0xab0116=_0x9d56[_0x5f564b];return _0xab0116;};'use strict';var multer=require(_0x69d5('0x0'));var util=require(_0x69d5('0x1'));var path=require(_0x69d5('0x2'));var timeout=require(_0x69d5('0x3'));var express=require('express');var router=express[_0x69d5('0x4')]();var auth=require(_0x69d5('0x5'));var interaction=require(_0x69d5('0x6'));var config=require(_0x69d5('0x7'));var controller=require(_0x69d5('0x8'));router['get']('/',auth[_0x69d5('0x9')](),controller[_0x69d5('0xa')]);router[_0x69d5('0xb')](_0x69d5('0xc'),auth[_0x69d5('0x9')](),controller[_0x69d5('0xd')]);router[_0x69d5('0xb')](_0x69d5('0xe'),auth[_0x69d5('0x9')](),controller[_0x69d5('0xf')]);router[_0x69d5('0xb')](_0x69d5('0x10'),auth[_0x69d5('0x9')](),controller[_0x69d5('0x11')]);router[_0x69d5('0xb')](_0x69d5('0x12'),auth[_0x69d5('0x9')](),controller[_0x69d5('0x13')]);router[_0x69d5('0xb')]('/:id/users',auth[_0x69d5('0x9')](),controller[_0x69d5('0x14')]);router[_0x69d5('0x15')]('/',auth[_0x69d5('0x9')](),controller[_0x69d5('0x16')]);router['post'](_0x69d5('0x12'),auth[_0x69d5('0x9')](),controller[_0x69d5('0x17')]);router[_0x69d5('0x15')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x69d5('0x18')](_0x69d5('0xe'),auth[_0x69d5('0x9')](),controller[_0x69d5('0x19')]);router[_0x69d5('0x1a')]('/:id',auth[_0x69d5('0x9')](),controller[_0x69d5('0x1b')]);router[_0x69d5('0x1a')](_0x69d5('0x12'),auth[_0x69d5('0x9')](),controller[_0x69d5('0x1c')]);router[_0x69d5('0x1a')](_0x69d5('0x1d'),auth['isAuthenticated'](),controller[_0x69d5('0x1e')]);module[_0x69d5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index a8906b1..b33a989 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 _0x6eca=['exports','STRING','name','ENUM','rrmemory','sequelize'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x6eca,0x179));var _0xa6ec=function(_0x4b21e1,_0x569192){_0x4b21e1=_0x4b21e1-0x0;var _0x262b25=_0x6eca[_0x4b21e1];return _0x262b25;};'use strict';var Sequelize=require(_0xa6ec('0x0'));module[_0xa6ec('0x1')]={'name':{'type':Sequelize[_0xa6ec('0x2')],'unique':_0xa6ec('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6ec('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6ec('0x4')](_0xa6ec('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xe053=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x4ba676,_0x4eb201){var _0x3e0ce7=function(_0x21e5a4){while(--_0x21e5a4){_0x4ba676['push'](_0x4ba676['shift']());}};_0x3e0ce7(++_0x4eb201);}(_0xe053,0x1bb));var _0x3e05=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xe053[_0x5a2285];return _0x48f6ed;};'use strict';var Sequelize=require(_0x3e05('0x0'));module[_0x3e05('0x1')]={'name':{'type':Sequelize[_0x3e05('0x2')],'unique':_0x3e05('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e05('0x2')]},'timeout':{'type':Sequelize[_0x3e05('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3e05('0x5')]('rrmemory',_0x3e05('0x6'),_0x3e05('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3f8e9c3..35caf6c 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 _0x7025=['every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','count','limit','set','apply','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserSmsQueue','nolimit','SmsQueueId','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','findOne','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','SELECT'];(function(_0x5aae9d,_0x57afb4){var _0x467cb4=function(_0x12e9a8){while(--_0x12e9a8){_0x5aae9d['push'](_0x5aae9d['shift']());}};_0x467cb4(++_0x57afb4);}(_0x7025,0x132));var _0x5702=function(_0x3d0bff,_0x537839){_0x3d0bff=_0x3d0bff-0x0;var _0x42f49b=_0x7025[_0x3d0bff];return _0x42f49b;};'use strict';var pdf=require(_0x5702('0x0'));var emlformat=require(_0x5702('0x1'));var rimraf=require(_0x5702('0x2'));var zipdir=require(_0x5702('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5702('0x4'));var moment=require('moment');var BPromise=require(_0x5702('0x5'));var Mustache=require(_0x5702('0x6'));var util=require(_0x5702('0x7'));var path=require(_0x5702('0x8'));var sox=require(_0x5702('0x9'));var csv=require(_0x5702('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5702('0xb'));var crypto=require(_0x5702('0xc'));var jsforce=require(_0x5702('0xd'));var deskjs=require(_0x5702('0xe'));var toCsv=require(_0x5702('0xa'));var querystring=require(_0x5702('0xf'));var Papa=require(_0x5702('0x10'));var Redis=require(_0x5702('0x11'));var authService=require(_0x5702('0x12'));var qs=require(_0x5702('0x13'));var as=require(_0x5702('0x14'));var hardwareService=require(_0x5702('0x15'));var logger=require(_0x5702('0x16'))(_0x5702('0x17'));var utils=require(_0x5702('0x18'));var config=require(_0x5702('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5702('0x1a')](config[_0x5702('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x5702('0x1c'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x5702('0x1d')](socket);function respondWithStatusCode(_0x57454b,_0x2ed57d){_0x2ed57d=_0x2ed57d||0xcc;return function(_0x10ce9a){if(_0x10ce9a){return _0x57454b[_0x5702('0x1e')](_0x2ed57d);}return _0x57454b[_0x5702('0x1f')](_0x2ed57d)[_0x5702('0x20')]();};}function respondWithResult(_0x2a683d,_0xd48561){_0xd48561=_0xd48561||0xc8;return function(_0x46d5e8){if(_0x46d5e8){return _0x2a683d['status'](_0xd48561)[_0x5702('0x21')](_0x46d5e8);}};}function respondWithFilteredResult(_0xd35e9,_0x549922){return function(_0x488699){if(_0x488699){var _0xbd9442=_0x488699[_0x5702('0x22')],_0x3c1865=_0x549922['offset'],_0xfc6e6=_0x549922['offset']+_0x549922[_0x5702('0x23')],_0x180916;if(_0xfc6e6>=_0xbd9442){_0xfc6e6=_0xbd9442;_0x180916=0xc8;}else{_0x180916=0xce;}_0xd35e9[_0x5702('0x1f')](_0x180916);return _0xd35e9[_0x5702('0x24')]('Content-Range',_0x3c1865+'-'+_0xfc6e6+'/'+_0xbd9442)[_0x5702('0x21')](_0x488699);}return null;};}function patchUpdates(_0x2193b5){return function(_0x37cbde){try{jsonpatch[_0x5702('0x25')](_0x37cbde,_0x2193b5,!![]);}catch(_0x2b5f21){return BPromise['reject'](_0x2b5f21);}return _0x37cbde[_0x5702('0x26')]();};}function saveUpdates(_0x216cd9,_0x44839e){return function(_0x319a4a){if(_0x319a4a){return _0x319a4a[_0x5702('0x27')](_0x216cd9)[_0x5702('0x28')](function(_0x1eb37d){return _0x1eb37d;});}return null;};}function removeEntity(_0x395424,_0x7c6770){return function(_0x294bcc){if(_0x294bcc){return _0x294bcc[_0x5702('0x29')]()['then'](function(){var _0x5870ac=_0x294bcc[_0x5702('0x2a')]({'plain':!![]});var _0x26c5c6=_0x5702('0x2b');return db[_0x5702('0x2c')][_0x5702('0x29')]({'where':{'type':_0x26c5c6,'resourceId':_0x5870ac['id']}})[_0x5702('0x28')](function(){return _0x294bcc;});})[_0x5702('0x28')](function(){_0x395424[_0x5702('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368c57,_0x425f12){return function(_0x3dbbaa){if(!_0x3dbbaa){_0x368c57['sendStatus'](0x194);}return _0x3dbbaa;};}function handleError(_0x1e9034,_0x1b3b14){_0x1b3b14=_0x1b3b14||0x1f4;return function(_0x3b7a8b){logger[_0x5702('0x2d')](_0x3b7a8b[_0x5702('0x2e')]);if(_0x3b7a8b[_0x5702('0x2f')]){delete _0x3b7a8b[_0x5702('0x2f')];}_0x1e9034['status'](_0x1b3b14)[_0x5702('0x30')](_0x3b7a8b);};}exports['index']=function(_0x16eb4d,_0x56e392){var _0x106ed4={},_0x55a0ac={},_0x7831f={'count':0x0,'rows':[]};var _0x321b9f=_[_0x5702('0x31')](db[_0x5702('0x32')][_0x5702('0x33')],function(_0x32e737){return{'name':_0x32e737[_0x5702('0x34')],'type':_0x32e737['type'][_0x5702('0x35')]};});_0x55a0ac[_0x5702('0x36')]=_[_0x5702('0x31')](_0x321b9f,_0x5702('0x2f'));_0x55a0ac[_0x5702('0x37')]=_[_0x5702('0x38')](_0x16eb4d['query']);_0x55a0ac[_0x5702('0x39')]=_[_0x5702('0x3a')](_0x55a0ac[_0x5702('0x36')],_0x55a0ac[_0x5702('0x37')]);_0x106ed4[_0x5702('0x3b')]=_['intersection'](_0x55a0ac[_0x5702('0x36')],qs[_0x5702('0x3c')](_0x16eb4d[_0x5702('0x37')]['fields']));_0x106ed4[_0x5702('0x3b')]=_0x106ed4[_0x5702('0x3b')][_0x5702('0x3d')]?_0x106ed4[_0x5702('0x3b')]:_0x55a0ac[_0x5702('0x36')];if(!_0x16eb4d[_0x5702('0x37')]['hasOwnProperty']('nolimit')){_0x106ed4[_0x5702('0x23')]=qs['limit'](_0x16eb4d[_0x5702('0x37')][_0x5702('0x23')]);_0x106ed4[_0x5702('0x3e')]=qs[_0x5702('0x3e')](_0x16eb4d[_0x5702('0x37')][_0x5702('0x3e')]);}_0x106ed4[_0x5702('0x3f')]=qs[_0x5702('0x40')](_0x16eb4d[_0x5702('0x37')][_0x5702('0x40')]);_0x106ed4[_0x5702('0x41')]=qs[_0x5702('0x39')](_[_0x5702('0x42')](_0x16eb4d[_0x5702('0x37')],_0x55a0ac[_0x5702('0x39')]),_0x321b9f);if(_0x16eb4d['query']['filter']){_0x106ed4[_0x5702('0x41')]=_[_0x5702('0x43')](_0x106ed4[_0x5702('0x41')],{'$or':_[_0x5702('0x31')](_0x321b9f,function(_0x9b4a1d){if(_0x9b4a1d[_0x5702('0x44')]!==_0x5702('0x45')){var _0x1e04fb={};_0x1e04fb[_0x9b4a1d['name']]={'$like':'%'+_0x16eb4d[_0x5702('0x37')][_0x5702('0x46')]+'%'};return _0x1e04fb;}})});}_0x106ed4=_[_0x5702('0x43')]({},_0x106ed4,_0x16eb4d[_0x5702('0x47')]);var _0x1315cf={'where':_0x106ed4['where']};return db['SmsQueue']['count'](_0x1315cf)[_0x5702('0x28')](function(_0x5c85cd){_0x7831f[_0x5702('0x22')]=_0x5c85cd;if(_0x16eb4d['query'][_0x5702('0x48')]){_0x106ed4[_0x5702('0x49')]=[{'all':!![]}];}return db[_0x5702('0x32')][_0x5702('0x4a')](_0x106ed4);})[_0x5702('0x28')](function(_0x185dc5){_0x7831f['rows']=_0x185dc5;return _0x7831f;})[_0x5702('0x28')](respondWithFilteredResult(_0x56e392,_0x106ed4))['catch'](handleError(_0x56e392,null));};exports[_0x5702('0x4b')]=function(_0x59cfe8,_0x4dfe39){var _0x551280={'raw':!![],'where':{'id':_0x59cfe8[_0x5702('0x4c')]['id']}},_0x49596b={};_0x49596b[_0x5702('0x36')]=_[_0x5702('0x38')](db[_0x5702('0x32')][_0x5702('0x33')]);_0x49596b[_0x5702('0x37')]=_[_0x5702('0x38')](_0x59cfe8[_0x5702('0x37')]);_0x49596b[_0x5702('0x39')]=_[_0x5702('0x3a')](_0x49596b[_0x5702('0x36')],_0x49596b[_0x5702('0x37')]);_0x551280[_0x5702('0x3b')]=_[_0x5702('0x3a')](_0x49596b[_0x5702('0x36')],qs[_0x5702('0x3c')](_0x59cfe8[_0x5702('0x37')][_0x5702('0x3c')]));_0x551280[_0x5702('0x3b')]=_0x551280[_0x5702('0x3b')]['length']?_0x551280['attributes']:_0x49596b['model'];if(_0x59cfe8[_0x5702('0x37')]['includeAll']){_0x551280[_0x5702('0x49')]=[{'all':!![]}];}_0x551280=_[_0x5702('0x43')]({},_0x551280,_0x59cfe8[_0x5702('0x47')]);return db[_0x5702('0x32')][_0x5702('0x4d')](_0x551280)[_0x5702('0x28')](handleEntityNotFound(_0x4dfe39,null))[_0x5702('0x28')](respondWithResult(_0x4dfe39,null))[_0x5702('0x4e')](handleError(_0x4dfe39,null));};exports['create']=function(_0x3fe6cc,_0x22718c){return db[_0x5702('0x32')][_0x5702('0x4f')](_0x3fe6cc[_0x5702('0x50')],{})[_0x5702('0x28')](function(_0x500271){var _0x26ad80=_0x3fe6cc[_0x5702('0x51')][_0x5702('0x2a')]({'plain':!![]});if(!_0x26ad80)throw new Error(_0x5702('0x52'));if(_0x26ad80[_0x5702('0x53')]===_0x5702('0x51')){var _0x2efaee=_0x500271[_0x5702('0x2a')]({'plain':!![]});var _0x402b47=_0x5702('0x2b');return db[_0x5702('0x54')][_0x5702('0x4d')]({'where':{'name':_0x402b47,'userProfileId':_0x26ad80[_0x5702('0x55')]},'raw':!![]})[_0x5702('0x28')](function(_0x3aa328){if(_0x3aa328&&_0x3aa328[_0x5702('0x56')]===0x0){return db[_0x5702('0x2c')][_0x5702('0x4f')]({'name':_0x2efaee[_0x5702('0x2f')],'resourceId':_0x2efaee['id'],'type':_0x3aa328[_0x5702('0x2f')],'sectionId':_0x3aa328['id']},{})[_0x5702('0x28')](function(){return _0x500271;});}else{return _0x500271;}})[_0x5702('0x4e')](function(_0x2d66bd){logger['error'](_0x5702('0x57'),_0x2d66bd);throw _0x2d66bd;});}return _0x500271;})[_0x5702('0x28')](respondWithResult(_0x22718c,0xc9))['catch'](handleError(_0x22718c,null));};exports[_0x5702('0x27')]=function(_0x1adf59,_0x438ec9){if(_0x1adf59[_0x5702('0x50')]['id']){delete _0x1adf59[_0x5702('0x50')]['id'];}return db[_0x5702('0x32')][_0x5702('0x4d')]({'where':{'id':_0x1adf59[_0x5702('0x4c')]['id']}})['then'](handleEntityNotFound(_0x438ec9,null))[_0x5702('0x28')](saveUpdates(_0x1adf59[_0x5702('0x50')],null))[_0x5702('0x28')](respondWithResult(_0x438ec9,null))['catch'](handleError(_0x438ec9,null));};exports[_0x5702('0x29')]=function(_0x3500ab,_0x42d2d7){return db[_0x5702('0x32')][_0x5702('0x4d')]({'where':{'id':_0x3500ab[_0x5702('0x4c')]['id']}})[_0x5702('0x28')](handleEntityNotFound(_0x42d2d7,null))['then'](removeEntity(_0x42d2d7,null))['catch'](handleError(_0x42d2d7,null));};exports[_0x5702('0x58')]=function(_0x4e7f33,_0x3bb1a6){return db['SmsQueue'][_0x5702('0x58')]()[_0x5702('0x28')](respondWithResult(_0x3bb1a6,null))['catch'](handleError(_0x3bb1a6,null));};exports['getMembers']=function(_0x1d670c,_0x40c7c0,_0x12ef40){var _0x5ab802={'raw':!![],'where':{}},_0x2dd961={},_0x23712a;return db[_0x5702('0x32')]['findOne']({'where':{'id':_0x1d670c[_0x5702('0x4c')]['id']}})[_0x5702('0x28')](handleEntityNotFound(_0x40c7c0,null))[_0x5702('0x28')](function(_0xaaefec){if(_0xaaefec){_0x23712a=_0xaaefec[_0x5702('0x2a')]({'plain':!![]});_0x2dd961[_0x5702('0x36')]=_['keys'](db[_0x5702('0x59')][_0x5702('0x33')]);_0x2dd961['query']=_[_0x5702('0x38')](_0x1d670c[_0x5702('0x37')]);_0x2dd961[_0x5702('0x39')]=_['intersection'](_0x2dd961[_0x5702('0x36')],_0x2dd961[_0x5702('0x37')]);_0x5ab802[_0x5702('0x3b')]=_[_0x5702('0x3a')](_0x2dd961[_0x5702('0x36')],qs[_0x5702('0x3c')](_0x1d670c['query'][_0x5702('0x3c')]));_0x5ab802[_0x5702('0x3b')]=_0x5ab802['attributes'][_0x5702('0x3d')]?_0x5ab802[_0x5702('0x3b')]:_0x2dd961[_0x5702('0x36')];if(!_0x1d670c[_0x5702('0x37')]['hasOwnProperty'](_0x5702('0x5a'))){_0x5ab802[_0x5702('0x23')]=qs['limit'](_0x1d670c[_0x5702('0x37')]['limit']);_0x5ab802[_0x5702('0x3e')]=qs['offset'](_0x1d670c[_0x5702('0x37')][_0x5702('0x3e')]);}_0x5ab802[_0x5702('0x3f')]=qs['sort'](_0x1d670c['query'][_0x5702('0x40')]);_0x5ab802['where']=qs[_0x5702('0x39')](_['pick'](_0x1d670c[_0x5702('0x37')],_0x2dd961[_0x5702('0x39')]));_0x5ab802[_0x5702('0x41')][_0x5702('0x5b')]=_0xaaefec['id'];if(_0x1d670c[_0x5702('0x37')][_0x5702('0x46')]){_0x5ab802[_0x5702('0x41')]=_[_0x5702('0x43')](_0x5ab802[_0x5702('0x41')],{'$or':_[_0x5702('0x31')](_0x5ab802[_0x5702('0x3b')],function(_0x59c362){var _0x2a9c22={};_0x2a9c22[_0x59c362]={'$like':'%'+_0x1d670c['query'][_0x5702('0x46')]+'%'};return _0x2a9c22;})});}_0x5ab802=_['merge']({},_0x5ab802,_0x1d670c[_0x5702('0x47')]);return db[_0x5702('0x59')][_0x5702('0x4a')](_0x5ab802);}})[_0x5702('0x28')](function(_0x59ae52){if(_0x59ae52){return db[_0x5702('0x5c')][_0x5702('0x5d')]({'where':{'id':_[_0x5702('0x31')](_0x59ae52,'UserId'),'role':_0x5702('0x5e')},'attributes':['id',_0x5702('0x2f'),_0x5702('0x5f'),_0x5702('0x60'),_0x5702('0x61')]});}})[_0x5702('0x28')](function(_0x2759ed){if(_0x2759ed){return{'count':_0x2759ed['count'],'rows':_[_0x5702('0x31')](_0x2759ed[_0x5702('0x62')],function(_0x1fc1c5){return{'membername':_0x1fc1c5[_0x5702('0x2f')],'UserId':_0x1fc1c5['id'],'queue_name':_0x23712a[_0x5702('0x2f')],'SmsQueueId':_0x23712a['id'],'interface':util[_0x5702('0x63')](_0x5702('0x64'),_0x5702('0x65'),_0x1fc1c5[_0x5702('0x2f')]),'penalty':0x0,'paused':_0x1fc1c5[_0x5702('0x5f')],'createdAt':_0x1fc1c5['createdAt'],'updatedAt':_0x1fc1c5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5702('0x28')](respondWithFilteredResult(_0x40c7c0,_0x5ab802))['catch'](handleError(_0x40c7c0,null));};exports['getTeams']=function(_0x198db1,_0x152446,_0x1f2dfe){var _0x21eaa8={};var _0x4c0626={};var _0x481060;var _0x29ba2;return db[_0x5702('0x32')][_0x5702('0x66')]({'where':{'id':_0x198db1[_0x5702('0x4c')]['id']}})[_0x5702('0x28')](handleEntityNotFound(_0x152446,null))['then'](function(_0x21f2c3){if(_0x21f2c3){_0x481060=_0x21f2c3;_0x4c0626[_0x5702('0x36')]=_['keys'](db['Team'][_0x5702('0x33')]);_0x4c0626[_0x5702('0x37')]=_[_0x5702('0x38')](_0x198db1[_0x5702('0x37')]);_0x4c0626[_0x5702('0x39')]=_['intersection'](_0x4c0626[_0x5702('0x36')],_0x4c0626[_0x5702('0x37')]);_0x21eaa8[_0x5702('0x3b')]=_[_0x5702('0x3a')](_0x4c0626['model'],qs[_0x5702('0x3c')](_0x198db1[_0x5702('0x37')][_0x5702('0x3c')]));_0x21eaa8['attributes']=_0x21eaa8[_0x5702('0x3b')][_0x5702('0x3d')]?_0x21eaa8['attributes']:_0x4c0626[_0x5702('0x36')];_0x21eaa8[_0x5702('0x3f')]=qs['sort'](_0x198db1[_0x5702('0x37')][_0x5702('0x40')]);_0x21eaa8[_0x5702('0x41')]=qs[_0x5702('0x39')](_[_0x5702('0x42')](_0x198db1[_0x5702('0x37')],_0x4c0626[_0x5702('0x39')]));if(_0x198db1[_0x5702('0x37')][_0x5702('0x46')]){_0x21eaa8['where']=_[_0x5702('0x43')](_0x21eaa8['where'],{'$or':_[_0x5702('0x31')](_0x21eaa8[_0x5702('0x3b')],function(_0x2aaf30){var _0x333458={};_0x333458[_0x2aaf30]={'$like':'%'+_0x198db1[_0x5702('0x37')][_0x5702('0x46')]+'%'};return _0x333458;})});}_0x21eaa8=_['merge']({},_0x21eaa8,_0x198db1['options']);return _0x481060[_0x5702('0x67')](_0x21eaa8);}})['then'](function(_0x17566d){if(_0x17566d){_0x29ba2=_0x17566d['length'];if(!_0x198db1[_0x5702('0x37')][_0x5702('0x68')](_0x5702('0x5a'))){_0x21eaa8['limit']=qs[_0x5702('0x23')](_0x198db1['query']['limit']);_0x21eaa8[_0x5702('0x3e')]=qs[_0x5702('0x3e')](_0x198db1[_0x5702('0x37')][_0x5702('0x3e')]);}return _0x481060[_0x5702('0x67')](_0x21eaa8);}})['then'](function(_0x3004bc){if(_0x3004bc){return _0x3004bc?{'count':_0x29ba2,'rows':_0x3004bc}:null;}})[_0x5702('0x28')](respondWithResult(_0x152446,null))[_0x5702('0x4e')](handleError(_0x152446,null));};exports[_0x5702('0x69')]=function(_0x7c9225,_0x579732,_0x22414e){var _0x100453=_0x7c9225[_0x5702('0x50')][_0x5702('0x6a')];return db[_0x5702('0x6b')]['findAll']({'where':{'id':_0x100453},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5702('0x6c'),'attributes':['id','name',_0x5702('0x6d'),_0x5702('0x6e'),_0x5702('0x6f')],'raw':!![]}]})[_0x5702('0x28')](function(_0x18deb3){if(_0x18deb3){var _0x43b9c9=_[_0x5702('0x70')](_0x18deb3,function(_0x60a732){var _0x60e054=_0x60a732['get']({'plain':!![]});return _0x60e054[_0x5702('0x6c')];});return db[_0x5702('0x32')][_0x5702('0x4d')]({'where':{'id':_0x7c9225[_0x5702('0x4c')]['id']}})[_0x5702('0x28')](function(_0x764e59){return db[_0x5702('0x71')][_0x5702('0x72')](function(_0x2c2492){return _0x764e59['addTeams'](_0x100453,{'transaction':_0x2c2492})[_0x5702('0x28')](function(){return BPromise[_0x5702('0x73')](_0x43b9c9,function(_0x4ac861){return db[_0x5702('0x59')][_0x5702('0x74')]({'where':{'UserId':_0x4ac861['id'],'SmsQueueId':_0x7c9225[_0x5702('0x4c')]['id']},'transaction':_0x2c2492});});})[_0x5702('0x28')](function(){_0x43b9c9[_0x5702('0x75')](function(_0x412b5b){socket[_0x5702('0x76')](_0x5702('0x77'),{'UserId':_0x412b5b['id'],'SmsQueueId':_0x764e59['id']});});});});});}})[_0x5702('0x28')](respondWithStatusCode(_0x579732,null))['catch'](handleError(_0x579732,null));};exports[_0x5702('0x78')]=function(_0xa6e188,_0x5653cf,_0xac3d72){return db[_0x5702('0x6b')]['findAll']({'where':{'id':_0xa6e188[_0x5702('0x37')][_0x5702('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x5702('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5702('0x28')](handleEntityNotFound(_0x5653cf,null))[_0x5702('0x28')](function(_0x396f32){var _0x11f6e5=_[_0x5702('0x31')](_0x396f32,'id');var _0x545d59=[];var _0x4e49f9=[];var _0x5002d2=squel[_0x5702('0x79')]();_0x5002d2[_0x5702('0x7a')](_0x5702('0x7b'))[_0x5702('0x7c')](_0x5702('0x7d'),'tq')[_0x5702('0x7e')](_0x5702('0x7f'),'ut',_0x5702('0x80'))[_0x5702('0x41')](_0x5702('0x81'),_0xa6e188[_0x5702('0x4c')]['id']);for(var _0x9abac8=0x0;_0x9abac8<_0x396f32['length'];_0x9abac8+=0x1){let _0x4fcc06=_0x396f32[_0x9abac8];for(var _0x102c57=0x0;_0x102c57<_0x4fcc06[_0x5702('0x6c')][_0x5702('0x3d')];_0x102c57+=0x1){let _0x1ec38d=_0x4fcc06[_0x5702('0x6c')][_0x102c57];var _0x312a7c=_0x5002d2['clone']();_0x312a7c[_0x5702('0x41')]('ut.UserId\x20=\x20?',_0x1ec38d['id']);_0x4e49f9[_0x5702('0x82')](db['sequelize'][_0x5702('0x37')](_0x312a7c['toString'](),{'type':db[_0x5702('0x71')]['QueryTypes'][_0x5702('0x83')]})[_0x5702('0x28')](function(_0x5ee7c3){if(_0x5ee7c3[_0x5702('0x3d')]===0x1){return _0x1ec38d['id'];}else{var _0x33ed7b=_[_0x5702('0x84')](_['map'](_0x5ee7c3,_0x5702('0x85')),function(_0x308d60){return _[_0x5702('0x86')](_0x11f6e5,_0x308d60);});if(_0x33ed7b){return _0x1ec38d['id'];}}}));}}return BPromise[_0x5702('0x87')](_0x4e49f9)[_0x5702('0x28')](function(_0x1df8cc){_0x545d59=_(_0x545d59)[_0x5702('0x88')](_0x1df8cc)[_0x5702('0x89')]()[_0x5702('0x8a')]();return db['SmsQueue'][_0x5702('0x4d')]({'where':{'id':_0xa6e188['params']['id']}})['then'](function(_0x11acbe){return db[_0x5702('0x71')][_0x5702('0x72')](function(_0x4e22d6){return _0x11acbe[_0x5702('0x78')](_0xa6e188[_0x5702('0x37')][_0x5702('0x6a')],{'transaction':_0x4e22d6})[_0x5702('0x28')](function(){if(!_[_0x5702('0x8b')](_0x545d59)){return _0x11acbe[_0x5702('0x8c')](_0x545d59,{'transaction':_0x4e22d6});}})[_0x5702('0x28')](function(){_0x545d59[_0x5702('0x75')](function(_0x16902f){socket['emit'](_0x5702('0x8d'),{'UserId':_0x16902f,'SmsQueueId':_0x11acbe['id']});});});});});});})[_0x5702('0x28')](respondWithStatusCode(_0x5653cf,null))['catch'](handleError(_0x5653cf,null));};exports[_0x5702('0x8e')]=function(_0x3698a0,_0x1b130d,_0x2a13a6){return db[_0x5702('0x32')][_0x5702('0x4d')]({'where':{'id':_0x3698a0[_0x5702('0x4c')]['id']}})[_0x5702('0x28')](handleEntityNotFound(_0x1b130d,null))[_0x5702('0x28')](function(_0x3b7ac3){if(_0x3b7ac3){return _0x3b7ac3['addAgents'](_0x3698a0[_0x5702('0x50')]['ids'],_['omit'](_0x3698a0[_0x5702('0x50')],[_0x5702('0x6a'),'id'])||{})[_0x5702('0x8f')](function(_0x294fc8){for(var _0x17a111=0x0;_0x17a111<_0x3698a0[_0x5702('0x50')][_0x5702('0x6a')][_0x5702('0x3d')];_0x17a111+=0x1){socket[_0x5702('0x76')]('userSmsQueue:save',{'UserId':_0x3698a0[_0x5702('0x50')][_0x5702('0x6a')][_0x17a111],'SmsQueueId':_0x3698a0['params']['id']});}return _0x294fc8;});}})[_0x5702('0x28')](respondWithResult(_0x1b130d,null))[_0x5702('0x4e')](handleError(_0x1b130d,null));};exports[_0x5702('0x8c')]=function(_0xca3e9d,_0x245734,_0x11240e){return db[_0x5702('0x32')][_0x5702('0x4d')]({'where':{'id':_0xca3e9d['params']['id']}})[_0x5702('0x28')](handleEntityNotFound(_0x245734,null))[_0x5702('0x28')](function(_0x23a979){if(_0x23a979){return _0x23a979[_0x5702('0x8c')](_0xca3e9d[_0x5702('0x37')][_0x5702('0x6a')])[_0x5702('0x28')](function(){if(_[_0x5702('0x90')](_0xca3e9d[_0x5702('0x37')][_0x5702('0x6a')])){for(var _0x4220bf=0x0;_0x4220bf<_0xca3e9d['query']['ids'][_0x5702('0x3d')];_0x4220bf+=0x1){socket['emit'](_0x5702('0x8d'),{'UserId':Number(_0xca3e9d['query']['ids'][_0x4220bf]),'SmsQueueId':Number(_0xca3e9d[_0x5702('0x4c')]['id'])});}}else{socket[_0x5702('0x76')](_0x5702('0x8d'),{'UserId':Number(_0xca3e9d[_0x5702('0x37')][_0x5702('0x6a')]),'SmsQueueId':Number(_0xca3e9d[_0x5702('0x4c')]['id'])});}});}})[_0x5702('0x28')](respondWithStatusCode(_0x245734,null))[_0x5702('0x4e')](handleError(_0x245734,null));};exports['getAgents']=function(_0x56cad2,_0x2412af,_0x58da23){var _0x2ea11d={};var _0x27bb66={};var _0x25c8e6;var _0xf1b74c;return db[_0x5702('0x32')][_0x5702('0x66')]({'where':{'id':_0x56cad2['params']['id']}})[_0x5702('0x28')](handleEntityNotFound(_0x2412af,null))[_0x5702('0x28')](function(_0x8e0172){if(_0x8e0172){_0x25c8e6=_0x8e0172;_0x27bb66[_0x5702('0x36')]=_[_0x5702('0x38')](db['User'][_0x5702('0x33')]);_0x27bb66[_0x5702('0x37')]=_[_0x5702('0x38')](_0x56cad2['query']);_0x27bb66[_0x5702('0x39')]=_[_0x5702('0x3a')](_0x27bb66[_0x5702('0x36')],_0x27bb66['query']);_0x2ea11d[_0x5702('0x3b')]=_[_0x5702('0x3a')](_0x27bb66[_0x5702('0x36')],qs[_0x5702('0x3c')](_0x56cad2[_0x5702('0x37')]['fields']));_0x2ea11d[_0x5702('0x3b')]=_0x2ea11d[_0x5702('0x3b')][_0x5702('0x3d')]?_0x2ea11d[_0x5702('0x3b')]:_0x27bb66[_0x5702('0x36')];_0x2ea11d[_0x5702('0x3f')]=qs['sort'](_0x56cad2[_0x5702('0x37')][_0x5702('0x40')]);_0x2ea11d[_0x5702('0x41')]=qs[_0x5702('0x39')](_[_0x5702('0x42')](_0x56cad2[_0x5702('0x37')],_0x27bb66['filters']));if(_0x56cad2['query'][_0x5702('0x46')]){_0x2ea11d[_0x5702('0x41')]=_[_0x5702('0x43')](_0x2ea11d[_0x5702('0x41')],{'$or':_['map'](_0x2ea11d['attributes'],function(_0x50f4e8){var _0x296e88={};_0x296e88[_0x50f4e8]={'$like':'%'+_0x56cad2[_0x5702('0x37')][_0x5702('0x46')]+'%'};return _0x296e88;})});}_0x2ea11d=_[_0x5702('0x43')]({},_0x2ea11d,_0x56cad2['options']);return _0x25c8e6[_0x5702('0x91')](_0x2ea11d);}})[_0x5702('0x28')](function(_0x118d6){if(_0x118d6){_0xf1b74c=_0x118d6['length'];if(!_0x56cad2[_0x5702('0x37')][_0x5702('0x68')](_0x5702('0x5a'))){_0x2ea11d['limit']=qs['limit'](_0x56cad2['query'][_0x5702('0x23')]);_0x2ea11d[_0x5702('0x3e')]=qs[_0x5702('0x3e')](_0x56cad2[_0x5702('0x37')]['offset']);}return _0x25c8e6[_0x5702('0x91')](_0x2ea11d);}})[_0x5702('0x28')](function(_0x5c707e){if(_0x5c707e){return _0x5c707e?{'count':_0xf1b74c,'rows':_0x5c707e}:null;}})['then'](respondWithResult(_0x2412af,null))[_0x5702('0x4e')](handleError(_0x2412af,null));}; \ No newline at end of file +var _0x10ac=['nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','show','params','filters','options','catch','create','body','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','UserId','smsPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','destroy','name','index','map','SmsQueue','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length'];(function(_0x31520d,_0x50046a){var _0x4d0d26=function(_0x187fe0){while(--_0x187fe0){_0x31520d['push'](_0x31520d['shift']());}};_0x4d0d26(++_0x50046a);}(_0x10ac,0xd7));var _0xc10a=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x10ac[_0xcfeda9];return _0x4826c7;};'use strict';var pdf=require(_0xc10a('0x0'));var emlformat=require(_0xc10a('0x1'));var rimraf=require(_0xc10a('0x2'));var zipdir=require(_0xc10a('0x3'));var jsonpatch=require(_0xc10a('0x4'));var rp=require(_0xc10a('0x5'));var moment=require('moment');var BPromise=require(_0xc10a('0x6'));var Mustache=require(_0xc10a('0x7'));var util=require(_0xc10a('0x8'));var path=require('path');var sox=require(_0xc10a('0x9'));var csv=require('to-csv');var ejs=require(_0xc10a('0xa'));var fs=require('fs');var _=require(_0xc10a('0xb'));var squel=require(_0xc10a('0xc'));var crypto=require(_0xc10a('0xd'));var jsforce=require(_0xc10a('0xe'));var deskjs=require(_0xc10a('0xf'));var toCsv=require(_0xc10a('0x10'));var querystring=require(_0xc10a('0x11'));var Papa=require('papaparse');var Redis=require(_0xc10a('0x12'));var authService=require(_0xc10a('0x13'));var qs=require(_0xc10a('0x14'));var as=require(_0xc10a('0x15'));var hardwareService=require(_0xc10a('0x16'));var logger=require(_0xc10a('0x17'))('api');var utils=require(_0xc10a('0x18'));var config=require('../../config/environment');var db=require(_0xc10a('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc10a('0x1a'),'port':0x18eb});var socket=require(_0xc10a('0x1b'))(new Redis(config[_0xc10a('0x1c')]));require('./smsQueue.socket')[_0xc10a('0x1d')](socket);function respondWithStatusCode(_0x4125bc,_0x2f3828){_0x2f3828=_0x2f3828||0xcc;return function(_0x548d3f){if(_0x548d3f){return _0x4125bc[_0xc10a('0x1e')](_0x2f3828);}return _0x4125bc['status'](_0x2f3828)[_0xc10a('0x1f')]();};}function respondWithResult(_0x2516af,_0x5a707e){_0x5a707e=_0x5a707e||0xc8;return function(_0x5ef791){if(_0x5ef791){return _0x2516af['status'](_0x5a707e)[_0xc10a('0x20')](_0x5ef791);}};}function respondWithFilteredResult(_0x49d1bb,_0x3c4172){return function(_0x470a08){if(_0x470a08){var _0x47ab18=_0x470a08[_0xc10a('0x21')],_0x181936=_0x3c4172[_0xc10a('0x22')],_0x35f194=_0x3c4172[_0xc10a('0x22')]+_0x3c4172['limit'],_0x126c5e;if(_0x35f194>=_0x47ab18){_0x35f194=_0x47ab18;_0x126c5e=0xc8;}else{_0x126c5e=0xce;}_0x49d1bb[_0xc10a('0x23')](_0x126c5e);return _0x49d1bb[_0xc10a('0x24')](_0xc10a('0x25'),_0x181936+'-'+_0x35f194+'/'+_0x47ab18)['json'](_0x470a08);}return null;};}function patchUpdates(_0x54cd9c){return function(_0x1f5f22){try{jsonpatch[_0xc10a('0x26')](_0x1f5f22,_0x54cd9c,!![]);}catch(_0x26ce4e){return BPromise[_0xc10a('0x27')](_0x26ce4e);}return _0x1f5f22[_0xc10a('0x28')]();};}function saveUpdates(_0x2c6c90,_0x214e2f){return function(_0x20049b){if(_0x20049b){return _0x20049b[_0xc10a('0x29')](_0x2c6c90)[_0xc10a('0x2a')](function(_0x44646b){return _0x44646b;});}return null;};}function removeEntity(_0x23b55e,_0x237ff0){return function(_0xb702e1){if(_0xb702e1){return _0xb702e1['destroy']()[_0xc10a('0x2a')](function(){var _0xc25c3=_0xb702e1[_0xc10a('0x2b')]({'plain':!![]});var _0x2a56d3=_0xc10a('0x2c');return db['UserProfileResource'][_0xc10a('0x2d')]({'where':{'type':_0x2a56d3,'resourceId':_0xc25c3['id']}})['then'](function(){return _0xb702e1;});})['then'](function(){_0x23b55e['status'](0xcc)[_0xc10a('0x1f')]();});}};}function handleEntityNotFound(_0x1bc9b2,_0x523b32){return function(_0x3945bc){if(!_0x3945bc){_0x1bc9b2[_0xc10a('0x1e')](0x194);}return _0x3945bc;};}function handleError(_0x149ff7,_0x3b1e1c){_0x3b1e1c=_0x3b1e1c||0x1f4;return function(_0x399cd9){logger['error'](_0x399cd9['stack']);if(_0x399cd9[_0xc10a('0x2e')]){delete _0x399cd9['name'];}_0x149ff7[_0xc10a('0x23')](_0x3b1e1c)['send'](_0x399cd9);};}exports[_0xc10a('0x2f')]=function(_0x2016cb,_0x1e5774){var _0xded628={},_0x2097bc={},_0x3bd4f6={'count':0x0,'rows':[]};var _0x3f4479=_[_0xc10a('0x30')](db[_0xc10a('0x31')][_0xc10a('0x32')],function(_0xd8d792){return{'name':_0xd8d792[_0xc10a('0x33')],'type':_0xd8d792['type']['key']};});_0x2097bc[_0xc10a('0x34')]=_[_0xc10a('0x30')](_0x3f4479,_0xc10a('0x2e'));_0x2097bc[_0xc10a('0x35')]=_[_0xc10a('0x36')](_0x2016cb['query']);_0x2097bc['filters']=_[_0xc10a('0x37')](_0x2097bc['model'],_0x2097bc['query']);_0xded628['attributes']=_[_0xc10a('0x37')](_0x2097bc['model'],qs[_0xc10a('0x38')](_0x2016cb['query'][_0xc10a('0x38')]));_0xded628[_0xc10a('0x39')]=_0xded628['attributes'][_0xc10a('0x3a')]?_0xded628[_0xc10a('0x39')]:_0x2097bc[_0xc10a('0x34')];if(!_0x2016cb['query']['hasOwnProperty'](_0xc10a('0x3b'))){_0xded628[_0xc10a('0x3c')]=qs[_0xc10a('0x3c')](_0x2016cb['query'][_0xc10a('0x3c')]);_0xded628['offset']=qs[_0xc10a('0x22')](_0x2016cb[_0xc10a('0x35')]['offset']);}_0xded628[_0xc10a('0x3d')]=qs[_0xc10a('0x3e')](_0x2016cb['query']['sort']);_0xded628['where']=qs['filters'](_[_0xc10a('0x3f')](_0x2016cb['query'],_0x2097bc['filters']),_0x3f4479);if(_0x2016cb[_0xc10a('0x35')][_0xc10a('0x40')]){_0xded628['where']=_['merge'](_0xded628[_0xc10a('0x41')],{'$or':_['map'](_0x3f4479,function(_0x49770f){if(_0x49770f[_0xc10a('0x42')]!==_0xc10a('0x43')){var _0x247db0={};_0x247db0[_0x49770f[_0xc10a('0x2e')]]={'$like':'%'+_0x2016cb[_0xc10a('0x35')]['filter']+'%'};return _0x247db0;}})});}_0xded628=_[_0xc10a('0x44')]({},_0xded628,_0x2016cb['options']);var _0x3458cf={'where':_0xded628[_0xc10a('0x41')]};return db['SmsQueue'][_0xc10a('0x21')](_0x3458cf)[_0xc10a('0x2a')](function(_0x85fe36){_0x3bd4f6[_0xc10a('0x21')]=_0x85fe36;if(_0x2016cb[_0xc10a('0x35')][_0xc10a('0x45')]){_0xded628[_0xc10a('0x46')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0xded628);})['then'](function(_0x2a5c18){_0x3bd4f6[_0xc10a('0x47')]=_0x2a5c18;return _0x3bd4f6;})['then'](respondWithFilteredResult(_0x1e5774,_0xded628))['catch'](handleError(_0x1e5774,null));};exports[_0xc10a('0x48')]=function(_0x5093e6,_0x1cd6be){var _0x3615e8={'raw':!![],'where':{'id':_0x5093e6[_0xc10a('0x49')]['id']}},_0x19c008={};_0x19c008['model']=_['keys'](db['SmsQueue'][_0xc10a('0x32')]);_0x19c008[_0xc10a('0x35')]=_[_0xc10a('0x36')](_0x5093e6['query']);_0x19c008[_0xc10a('0x4a')]=_[_0xc10a('0x37')](_0x19c008['model'],_0x19c008[_0xc10a('0x35')]);_0x3615e8['attributes']=_[_0xc10a('0x37')](_0x19c008[_0xc10a('0x34')],qs[_0xc10a('0x38')](_0x5093e6[_0xc10a('0x35')]['fields']));_0x3615e8[_0xc10a('0x39')]=_0x3615e8[_0xc10a('0x39')][_0xc10a('0x3a')]?_0x3615e8[_0xc10a('0x39')]:_0x19c008[_0xc10a('0x34')];if(_0x5093e6[_0xc10a('0x35')][_0xc10a('0x45')]){_0x3615e8[_0xc10a('0x46')]=[{'all':!![]}];}_0x3615e8=_[_0xc10a('0x44')]({},_0x3615e8,_0x5093e6[_0xc10a('0x4b')]);return db[_0xc10a('0x31')]['find'](_0x3615e8)['then'](handleEntityNotFound(_0x1cd6be,null))[_0xc10a('0x2a')](respondWithResult(_0x1cd6be,null))[_0xc10a('0x4c')](handleError(_0x1cd6be,null));};exports[_0xc10a('0x4d')]=function(_0x148241,_0x444f3b){return db[_0xc10a('0x31')][_0xc10a('0x4d')](_0x148241[_0xc10a('0x4e')],{})[_0xc10a('0x2a')](function(_0x78b6f){var _0xe8b03d=_0x148241['user']['get']({'plain':!![]});if(!_0xe8b03d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe8b03d[_0xc10a('0x4f')]==='user'){var _0x4767fb=_0x78b6f['get']({'plain':!![]});var _0x1d6de8=_0xc10a('0x2c');return db[_0xc10a('0x50')][_0xc10a('0x51')]({'where':{'name':_0x1d6de8,'userProfileId':_0xe8b03d[_0xc10a('0x52')]},'raw':!![]})[_0xc10a('0x2a')](function(_0x392af5){if(_0x392af5&&_0x392af5[_0xc10a('0x53')]===0x0){return db[_0xc10a('0x54')][_0xc10a('0x4d')]({'name':_0x4767fb['name'],'resourceId':_0x4767fb['id'],'type':_0x392af5[_0xc10a('0x2e')],'sectionId':_0x392af5['id']},{})[_0xc10a('0x2a')](function(){return _0x78b6f;});}else{return _0x78b6f;}})[_0xc10a('0x4c')](function(_0x528210){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x528210);throw _0x528210;});}return _0x78b6f;})[_0xc10a('0x2a')](respondWithResult(_0x444f3b,0xc9))[_0xc10a('0x4c')](handleError(_0x444f3b,null));};exports['update']=function(_0x3e03ae,_0x2ed948){if(_0x3e03ae[_0xc10a('0x4e')]['id']){delete _0x3e03ae[_0xc10a('0x4e')]['id'];}return db[_0xc10a('0x31')][_0xc10a('0x51')]({'where':{'id':_0x3e03ae[_0xc10a('0x49')]['id']}})[_0xc10a('0x2a')](handleEntityNotFound(_0x2ed948,null))[_0xc10a('0x2a')](saveUpdates(_0x3e03ae[_0xc10a('0x4e')],null))[_0xc10a('0x2a')](respondWithResult(_0x2ed948,null))[_0xc10a('0x4c')](handleError(_0x2ed948,null));};exports[_0xc10a('0x2d')]=function(_0x2b357a,_0x4ef803){return db[_0xc10a('0x31')][_0xc10a('0x51')]({'where':{'id':_0x2b357a[_0xc10a('0x49')]['id']}})[_0xc10a('0x2a')](handleEntityNotFound(_0x4ef803,null))['then'](removeEntity(_0x4ef803,null))[_0xc10a('0x4c')](handleError(_0x4ef803,null));};exports['describe']=function(_0xd63249,_0x55b2b2){return db[_0xc10a('0x31')][_0xc10a('0x55')]()[_0xc10a('0x2a')](respondWithResult(_0x55b2b2,null))[_0xc10a('0x4c')](handleError(_0x55b2b2,null));};exports[_0xc10a('0x56')]=function(_0x5b6df5,_0x369a7b,_0x4e4238){var _0x5cd4e1={'raw':!![],'where':{}},_0x5471bc={},_0x5eb5a1;return db[_0xc10a('0x31')][_0xc10a('0x57')]({'where':{'id':_0x5b6df5['params']['id']}})[_0xc10a('0x2a')](handleEntityNotFound(_0x369a7b,null))[_0xc10a('0x2a')](function(_0x1f05fa){if(_0x1f05fa){_0x5eb5a1=_0x1f05fa[_0xc10a('0x2b')]({'plain':!![]});_0x5471bc[_0xc10a('0x34')]=_[_0xc10a('0x36')](db[_0xc10a('0x58')][_0xc10a('0x32')]);_0x5471bc[_0xc10a('0x35')]=_[_0xc10a('0x36')](_0x5b6df5['query']);_0x5471bc[_0xc10a('0x4a')]=_[_0xc10a('0x37')](_0x5471bc[_0xc10a('0x34')],_0x5471bc[_0xc10a('0x35')]);_0x5cd4e1[_0xc10a('0x39')]=_[_0xc10a('0x37')](_0x5471bc[_0xc10a('0x34')],qs[_0xc10a('0x38')](_0x5b6df5[_0xc10a('0x35')][_0xc10a('0x38')]));_0x5cd4e1[_0xc10a('0x39')]=_0x5cd4e1[_0xc10a('0x39')][_0xc10a('0x3a')]?_0x5cd4e1[_0xc10a('0x39')]:_0x5471bc[_0xc10a('0x34')];if(!_0x5b6df5[_0xc10a('0x35')]['hasOwnProperty'](_0xc10a('0x3b'))){_0x5cd4e1[_0xc10a('0x3c')]=qs[_0xc10a('0x3c')](_0x5b6df5[_0xc10a('0x35')]['limit']);_0x5cd4e1[_0xc10a('0x22')]=qs[_0xc10a('0x22')](_0x5b6df5[_0xc10a('0x35')]['offset']);}_0x5cd4e1[_0xc10a('0x3d')]=qs[_0xc10a('0x3e')](_0x5b6df5[_0xc10a('0x35')]['sort']);_0x5cd4e1[_0xc10a('0x41')]=qs[_0xc10a('0x4a')](_[_0xc10a('0x3f')](_0x5b6df5['query'],_0x5471bc[_0xc10a('0x4a')]));_0x5cd4e1[_0xc10a('0x41')][_0xc10a('0x59')]=_0x1f05fa['id'];if(_0x5b6df5[_0xc10a('0x35')]['filter']){_0x5cd4e1[_0xc10a('0x41')]=_[_0xc10a('0x44')](_0x5cd4e1[_0xc10a('0x41')],{'$or':_[_0xc10a('0x30')](_0x5cd4e1[_0xc10a('0x39')],function(_0x444351){var _0x59e5d6={};_0x59e5d6[_0x444351]={'$like':'%'+_0x5b6df5[_0xc10a('0x35')]['filter']+'%'};return _0x59e5d6;})});}_0x5cd4e1=_[_0xc10a('0x44')]({},_0x5cd4e1,_0x5b6df5[_0xc10a('0x4b')]);return db[_0xc10a('0x58')][_0xc10a('0x5a')](_0x5cd4e1);}})['then'](function(_0x21fee5){if(_0x21fee5){return db[_0xc10a('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x21fee5,_0xc10a('0x5c')),'role':'agent'},'attributes':['id','name',_0xc10a('0x5d'),_0xc10a('0x5e'),_0xc10a('0x5f')]});}})['then'](function(_0x71b77e){if(_0x71b77e){return{'count':_0x71b77e[_0xc10a('0x21')],'rows':_[_0xc10a('0x30')](_0x71b77e[_0xc10a('0x47')],function(_0x25b1fd){return{'membername':_0x25b1fd[_0xc10a('0x2e')],'UserId':_0x25b1fd['id'],'queue_name':_0x5eb5a1[_0xc10a('0x2e')],'SmsQueueId':_0x5eb5a1['id'],'interface':util[_0xc10a('0x60')](_0xc10a('0x61'),'SIP',_0x25b1fd[_0xc10a('0x2e')]),'penalty':0x0,'paused':_0x25b1fd[_0xc10a('0x5d')],'createdAt':_0x25b1fd[_0xc10a('0x5f')],'updatedAt':_0x25b1fd[_0xc10a('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x369a7b,_0x5cd4e1))[_0xc10a('0x4c')](handleError(_0x369a7b,null));};exports['getTeams']=function(_0x349329,_0x38da72,_0x1bd019){var _0xab4c0e={};var _0x304ea0={};var _0xd694e;var _0xe8fe97;return db[_0xc10a('0x31')][_0xc10a('0x57')]({'where':{'id':_0x349329[_0xc10a('0x49')]['id']}})['then'](handleEntityNotFound(_0x38da72,null))[_0xc10a('0x2a')](function(_0x431419){if(_0x431419){_0xd694e=_0x431419;_0x304ea0['model']=_[_0xc10a('0x36')](db[_0xc10a('0x62')][_0xc10a('0x32')]);_0x304ea0['query']=_[_0xc10a('0x36')](_0x349329['query']);_0x304ea0[_0xc10a('0x4a')]=_['intersection'](_0x304ea0[_0xc10a('0x34')],_0x304ea0[_0xc10a('0x35')]);_0xab4c0e[_0xc10a('0x39')]=_[_0xc10a('0x37')](_0x304ea0[_0xc10a('0x34')],qs[_0xc10a('0x38')](_0x349329[_0xc10a('0x35')]['fields']));_0xab4c0e[_0xc10a('0x39')]=_0xab4c0e[_0xc10a('0x39')][_0xc10a('0x3a')]?_0xab4c0e[_0xc10a('0x39')]:_0x304ea0[_0xc10a('0x34')];_0xab4c0e[_0xc10a('0x3d')]=qs[_0xc10a('0x3e')](_0x349329[_0xc10a('0x35')][_0xc10a('0x3e')]);_0xab4c0e[_0xc10a('0x41')]=qs['filters'](_[_0xc10a('0x3f')](_0x349329['query'],_0x304ea0[_0xc10a('0x4a')]));if(_0x349329[_0xc10a('0x35')][_0xc10a('0x40')]){_0xab4c0e[_0xc10a('0x41')]=_[_0xc10a('0x44')](_0xab4c0e[_0xc10a('0x41')],{'$or':_[_0xc10a('0x30')](_0xab4c0e[_0xc10a('0x39')],function(_0x3f2d26){var _0x24a019={};_0x24a019[_0x3f2d26]={'$like':'%'+_0x349329[_0xc10a('0x35')]['filter']+'%'};return _0x24a019;})});}_0xab4c0e=_['merge']({},_0xab4c0e,_0x349329[_0xc10a('0x4b')]);return _0xd694e[_0xc10a('0x63')](_0xab4c0e);}})[_0xc10a('0x2a')](function(_0x796188){if(_0x796188){_0xe8fe97=_0x796188[_0xc10a('0x3a')];if(!_0x349329[_0xc10a('0x35')][_0xc10a('0x64')](_0xc10a('0x3b'))){_0xab4c0e[_0xc10a('0x3c')]=qs[_0xc10a('0x3c')](_0x349329[_0xc10a('0x35')]['limit']);_0xab4c0e[_0xc10a('0x22')]=qs['offset'](_0x349329[_0xc10a('0x35')][_0xc10a('0x22')]);}return _0xd694e[_0xc10a('0x63')](_0xab4c0e);}})[_0xc10a('0x2a')](function(_0x207a94){if(_0x207a94){return _0x207a94?{'count':_0xe8fe97,'rows':_0x207a94}:null;}})[_0xc10a('0x2a')](respondWithResult(_0x38da72,null))[_0xc10a('0x4c')](handleError(_0x38da72,null));};exports[_0xc10a('0x65')]=function(_0x24766e,_0x5b9586,_0x50a5bf){var _0x5c2c38=_0x24766e[_0xc10a('0x4e')][_0xc10a('0x66')];return db['Team'][_0xc10a('0x5a')]({'where':{'id':_0x5c2c38},'attributes':['id'],'include':[{'model':db[_0xc10a('0x5b')],'as':_0xc10a('0x67'),'attributes':['id','name',_0xc10a('0x68'),'voicePause',_0xc10a('0x69')],'raw':!![]}]})[_0xc10a('0x2a')](function(_0x53929f){if(_0x53929f){var _0x1671e8=_[_0xc10a('0x6a')](_0x53929f,function(_0xd912df){var _0x484a39=_0xd912df[_0xc10a('0x2b')]({'plain':!![]});return _0x484a39[_0xc10a('0x67')];});return db['SmsQueue']['find']({'where':{'id':_0x24766e['params']['id']}})['then'](function(_0x6f7f45){return db['sequelize'][_0xc10a('0x6b')](function(_0x6fcaeb){return _0x6f7f45[_0xc10a('0x65')](_0x5c2c38,{'transaction':_0x6fcaeb})[_0xc10a('0x2a')](function(){return BPromise[_0xc10a('0x6c')](_0x1671e8,function(_0x53b77a){return db['UserSmsQueue'][_0xc10a('0x6d')]({'where':{'UserId':_0x53b77a['id'],'SmsQueueId':_0x24766e[_0xc10a('0x49')]['id']},'transaction':_0x6fcaeb});});})['then'](function(){_0x1671e8[_0xc10a('0x6e')](function(_0x5df26d){socket[_0xc10a('0x6f')](_0xc10a('0x70'),{'UserId':_0x5df26d['id'],'SmsQueueId':_0x6f7f45['id']});});});});});}})[_0xc10a('0x2a')](respondWithStatusCode(_0x5b9586,null))['catch'](handleError(_0x5b9586,null));};exports[_0xc10a('0x71')]=function(_0x5a8f1e,_0x467a50,_0x3be747){return db[_0xc10a('0x62')][_0xc10a('0x5a')]({'where':{'id':_0x5a8f1e[_0xc10a('0x35')][_0xc10a('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc10a('0x67'),'attributes':['id'],'raw':!![]}]})[_0xc10a('0x2a')](handleEntityNotFound(_0x467a50,null))[_0xc10a('0x2a')](function(_0x3596c9){var _0x196afd=_[_0xc10a('0x30')](_0x3596c9,'id');var _0x18f0a9=[];var _0x173190=[];var _0x5d5be1=squel[_0xc10a('0x72')]();_0x5d5be1['field'](_0xc10a('0x73'))['from'](_0xc10a('0x74'),'tq')['join'](_0xc10a('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc10a('0x76'),_0x5a8f1e[_0xc10a('0x49')]['id']);for(var _0x2e7185=0x0;_0x2e7185<_0x3596c9[_0xc10a('0x3a')];_0x2e7185+=0x1){let _0x309e7e=_0x3596c9[_0x2e7185];for(var _0x195a8c=0x0;_0x195a8c<_0x309e7e[_0xc10a('0x67')][_0xc10a('0x3a')];_0x195a8c+=0x1){let _0x162776=_0x309e7e['Agents'][_0x195a8c];var _0x339df4=_0x5d5be1[_0xc10a('0x77')]();_0x339df4[_0xc10a('0x41')](_0xc10a('0x78'),_0x162776['id']);_0x173190[_0xc10a('0x79')](db[_0xc10a('0x7a')][_0xc10a('0x35')](_0x339df4['toString'](),{'type':db['sequelize']['QueryTypes'][_0xc10a('0x7b')]})[_0xc10a('0x2a')](function(_0x8c9fd5){if(_0x8c9fd5[_0xc10a('0x3a')]===0x1){return _0x162776['id'];}else{var _0x195ce9=_[_0xc10a('0x7c')](_[_0xc10a('0x30')](_0x8c9fd5,_0xc10a('0x7d')),function(_0x55eb7c){return _['includes'](_0x196afd,_0x55eb7c);});if(_0x195ce9){return _0x162776['id'];}}}));}}return BPromise[_0xc10a('0x7e')](_0x173190)[_0xc10a('0x2a')](function(_0x9ec848){_0x18f0a9=_(_0x18f0a9)[_0xc10a('0x7f')](_0x9ec848)[_0xc10a('0x80')]()[_0xc10a('0x81')]();return db[_0xc10a('0x31')]['find']({'where':{'id':_0x5a8f1e['params']['id']}})[_0xc10a('0x2a')](function(_0x3c68b0){return db[_0xc10a('0x7a')]['transaction'](function(_0x3e02eb){return _0x3c68b0[_0xc10a('0x71')](_0x5a8f1e[_0xc10a('0x35')][_0xc10a('0x66')],{'transaction':_0x3e02eb})[_0xc10a('0x2a')](function(){if(!_[_0xc10a('0x82')](_0x18f0a9)){return _0x3c68b0[_0xc10a('0x83')](_0x18f0a9,{'transaction':_0x3e02eb});}})[_0xc10a('0x2a')](function(){_0x18f0a9[_0xc10a('0x6e')](function(_0x36fd5f){socket[_0xc10a('0x6f')](_0xc10a('0x84'),{'UserId':_0x36fd5f,'SmsQueueId':_0x3c68b0['id']});});});});});});})[_0xc10a('0x2a')](respondWithStatusCode(_0x467a50,null))[_0xc10a('0x4c')](handleError(_0x467a50,null));};exports[_0xc10a('0x85')]=function(_0x46edb5,_0x498fda,_0x5bc75f){return db['SmsQueue'][_0xc10a('0x51')]({'where':{'id':_0x46edb5[_0xc10a('0x49')]['id']}})[_0xc10a('0x2a')](handleEntityNotFound(_0x498fda,null))[_0xc10a('0x2a')](function(_0x38fde9){if(_0x38fde9){return _0x38fde9[_0xc10a('0x85')](_0x46edb5[_0xc10a('0x4e')]['ids'],_[_0xc10a('0x86')](_0x46edb5[_0xc10a('0x4e')],['ids','id'])||{})[_0xc10a('0x87')](function(_0x1104bc){for(var _0x220e09=0x0;_0x220e09<_0x46edb5['body'][_0xc10a('0x66')][_0xc10a('0x3a')];_0x220e09+=0x1){socket['emit'](_0xc10a('0x70'),{'UserId':_0x46edb5[_0xc10a('0x4e')]['ids'][_0x220e09],'SmsQueueId':_0x46edb5[_0xc10a('0x49')]['id']});}return _0x1104bc;});}})['then'](respondWithResult(_0x498fda,null))[_0xc10a('0x4c')](handleError(_0x498fda,null));};exports[_0xc10a('0x83')]=function(_0x4889ce,_0x4eb4d6,_0x397146){return db[_0xc10a('0x31')][_0xc10a('0x51')]({'where':{'id':_0x4889ce[_0xc10a('0x49')]['id']}})[_0xc10a('0x2a')](handleEntityNotFound(_0x4eb4d6,null))[_0xc10a('0x2a')](function(_0x2f0b3e){if(_0x2f0b3e){return _0x2f0b3e['removeAgents'](_0x4889ce[_0xc10a('0x35')][_0xc10a('0x66')])['then'](function(){if(_['isArray'](_0x4889ce[_0xc10a('0x35')]['ids'])){for(var _0x19a4e4=0x0;_0x19a4e4<_0x4889ce[_0xc10a('0x35')][_0xc10a('0x66')][_0xc10a('0x3a')];_0x19a4e4+=0x1){socket[_0xc10a('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x4889ce['query'][_0xc10a('0x66')][_0x19a4e4]),'SmsQueueId':Number(_0x4889ce[_0xc10a('0x49')]['id'])});}}else{socket[_0xc10a('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x4889ce[_0xc10a('0x35')][_0xc10a('0x66')]),'SmsQueueId':Number(_0x4889ce[_0xc10a('0x49')]['id'])});}});}})[_0xc10a('0x2a')](respondWithStatusCode(_0x4eb4d6,null))[_0xc10a('0x4c')](handleError(_0x4eb4d6,null));};exports[_0xc10a('0x88')]=function(_0x21f91b,_0x49d5e2,_0x578af3){var _0x142558={};var _0x5e22d8={};var _0x1fece0;var _0x2c7d7a;return db['SmsQueue'][_0xc10a('0x57')]({'where':{'id':_0x21f91b[_0xc10a('0x49')]['id']}})['then'](handleEntityNotFound(_0x49d5e2,null))['then'](function(_0xacb977){if(_0xacb977){_0x1fece0=_0xacb977;_0x5e22d8[_0xc10a('0x34')]=_['keys'](db['User']['rawAttributes']);_0x5e22d8[_0xc10a('0x35')]=_[_0xc10a('0x36')](_0x21f91b['query']);_0x5e22d8[_0xc10a('0x4a')]=_['intersection'](_0x5e22d8['model'],_0x5e22d8[_0xc10a('0x35')]);_0x142558[_0xc10a('0x39')]=_['intersection'](_0x5e22d8[_0xc10a('0x34')],qs[_0xc10a('0x38')](_0x21f91b[_0xc10a('0x35')][_0xc10a('0x38')]));_0x142558[_0xc10a('0x39')]=_0x142558[_0xc10a('0x39')][_0xc10a('0x3a')]?_0x142558['attributes']:_0x5e22d8[_0xc10a('0x34')];_0x142558[_0xc10a('0x3d')]=qs[_0xc10a('0x3e')](_0x21f91b[_0xc10a('0x35')]['sort']);_0x142558[_0xc10a('0x41')]=qs[_0xc10a('0x4a')](_[_0xc10a('0x3f')](_0x21f91b[_0xc10a('0x35')],_0x5e22d8[_0xc10a('0x4a')]));if(_0x21f91b[_0xc10a('0x35')][_0xc10a('0x40')]){_0x142558['where']=_[_0xc10a('0x44')](_0x142558[_0xc10a('0x41')],{'$or':_[_0xc10a('0x30')](_0x142558[_0xc10a('0x39')],function(_0x30f24d){var _0x25794e={};_0x25794e[_0x30f24d]={'$like':'%'+_0x21f91b[_0xc10a('0x35')]['filter']+'%'};return _0x25794e;})});}_0x142558=_[_0xc10a('0x44')]({},_0x142558,_0x21f91b[_0xc10a('0x4b')]);return _0x1fece0[_0xc10a('0x88')](_0x142558);}})[_0xc10a('0x2a')](function(_0x405cfd){if(_0x405cfd){_0x2c7d7a=_0x405cfd[_0xc10a('0x3a')];if(!_0x21f91b['query'][_0xc10a('0x64')]('nolimit')){_0x142558['limit']=qs[_0xc10a('0x3c')](_0x21f91b[_0xc10a('0x35')][_0xc10a('0x3c')]);_0x142558[_0xc10a('0x22')]=qs[_0xc10a('0x22')](_0x21f91b[_0xc10a('0x35')][_0xc10a('0x22')]);}return _0x1fece0[_0xc10a('0x88')](_0x142558);}})[_0xc10a('0x2a')](function(_0x184986){if(_0x184986){return _0x184986?{'count':_0x2c7d7a,'rows':_0x184986}:null;}})[_0xc10a('0x2a')](respondWithResult(_0x49d5e2,null))[_0xc10a('0x4c')](handleError(_0x49d5e2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 0e31f68..56a0715 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 _0x3c9c=['update','remove','hook','exports','../../mysqldb','SmsQueue','save'];(function(_0x451402,_0x561cb8){var _0x4ffb7f=function(_0x1c263a){while(--_0x1c263a){_0x451402['push'](_0x451402['shift']());}};_0x4ffb7f(++_0x561cb8);}(_0x3c9c,0x131));var _0xc3c9=function(_0x5a10e4,_0x1fed2a){_0x5a10e4=_0x5a10e4-0x0;var _0x3c1d34=_0x3c9c[_0x5a10e4];return _0x3c1d34;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xc3c9('0x0'))['db'][_0xc3c9('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3c9('0x2'),'afterUpdate':_0xc3c9('0x3'),'afterDestroy':_0xc3c9('0x4')};function emitEvent(_0x38a13e){return function(_0x1b839f,_0x2809ec,_0x41b4a4){SmsQueueEvents['emit'](_0x38a13e+':'+_0x1b839f['id'],_0x1b839f);SmsQueueEvents['emit'](_0x38a13e,_0x1b839f);_0x41b4a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc3c9('0x5')](e,emitEvent(event));}}module[_0xc3c9('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x451a=['hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20f1b4,_0x2477aa){var _0x233f03=function(_0x55f3d7){while(--_0x55f3d7){_0x20f1b4['push'](_0x20f1b4['shift']());}};_0x233f03(++_0x2477aa);}(_0x451a,0x1ba));var _0xa451=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x451a[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0xa451('0x0'));var SmsQueue=require(_0xa451('0x1'))['db'][_0xa451('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa451('0x3')](0x0);var events={'afterCreate':_0xa451('0x4'),'afterUpdate':_0xa451('0x5'),'afterDestroy':_0xa451('0x6')};function emitEvent(_0x21119f){return function(_0x2b61a6,_0x3f69a6,_0x2c9373){SmsQueueEvents['emit'](_0x21119f+':'+_0x2b61a6['id'],_0x2b61a6);SmsQueueEvents[_0xa451('0x7')](_0x21119f,_0x2b61a6);_0x2c9373(null);};}for(var e in events){if(events[_0xa451('0x8')](e)){var event=events[e];SmsQueue[_0xa451('0x9')](e,emitEvent(event));}}module[_0xa451('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 57ef231..a9a07dc 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 _0x43f3=['sms_queues','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0x43f3,0xab));var _0x343f=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x43f3[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x343f('0x0'));var logger=require(_0x343f('0x1'))('api');var moment=require(_0x343f('0x2'));var BPromise=require('bluebird');var rp=require(_0x343f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x343f('0x4'));var config=require(_0x343f('0x5'));var attributes=require(_0x343f('0x6'));module['exports']=function(_0x2ec994,_0x693775){return _0x2ec994[_0x343f('0x7')](_0x343f('0x8'),attributes,{'tableName':_0x343f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x149c=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash'];(function(_0xe2e6f1,_0x5d363f){var _0x18c4ea=function(_0x1542b7){while(--_0x1542b7){_0xe2e6f1['push'](_0xe2e6f1['shift']());}};_0x18c4ea(++_0x5d363f);}(_0x149c,0x143));var _0xc149=function(_0x4bc7d4,_0x4b5381){_0x4bc7d4=_0x4bc7d4-0x0;var _0x4fa72e=_0x149c[_0x4bc7d4];return _0x4fa72e;};'use strict';var _=require(_0xc149('0x0'));var util=require('util');var logger=require(_0xc149('0x1'))(_0xc149('0x2'));var moment=require(_0xc149('0x3'));var BPromise=require('bluebird');var rp=require(_0xc149('0x4'));var fs=require('fs');var path=require(_0xc149('0x5'));var rimraf=require(_0xc149('0x6'));var config=require(_0xc149('0x7'));var attributes=require(_0xc149('0x8'));module[_0xc149('0x9')]=function(_0x3b5e34,_0x5e9b5c){return _0x3b5e34['define'](_0xc149('0xa'),attributes,{'tableName':_0xc149('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index ae307e5..9eb44a6 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 _0x75be=['redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','info','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','debug','stringify','ShowSmsQueue','find','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x374fa4,_0xd25827){var _0x1c2bbd=function(_0x23a954){while(--_0x23a954){_0x374fa4['push'](_0x374fa4['shift']());}};_0x1c2bbd(++_0xd25827);}(_0x75be,0x108));var _0xe75b=function(_0x500ee8,_0xa6a8de){_0x500ee8=_0x500ee8-0x0;var _0x3e8c7f=_0x75be[_0x500ee8];return _0x3e8c7f;};'use strict';var _=require('lodash');var util=require(_0xe75b('0x0'));var moment=require(_0xe75b('0x1'));var BPromise=require('bluebird');var rs=require(_0xe75b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe75b('0x3'))['db'];var utils=require(_0xe75b('0x4'));var logger=require(_0xe75b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe75b('0x6'));var client=jayson[_0xe75b('0x7')][_0xe75b('0x8')]({'port':0x232a});config[_0xe75b('0x9')]=_[_0xe75b('0xa')](config[_0xe75b('0x9')],{'host':_0xe75b('0xb'),'port':0x18eb});var socket=require(_0xe75b('0xc'))(new Redis(config[_0xe75b('0x9')]));require(_0xe75b('0xd'))[_0xe75b('0xe')](socket);function respondWithRpcPromise(_0x47e2d2,_0x38adbf,_0x5d57a9){return new BPromise(function(_0x52ec03,_0x37fee2){return client[_0xe75b('0xf')](_0x47e2d2,_0x5d57a9)[_0xe75b('0x10')](function(_0x2d32b5){logger['info'](_0xe75b('0x11'),_0x38adbf,_0xe75b('0x12'));logger['debug'](_0xe75b('0x13'),_0x38adbf,_0xe75b('0x12'),JSON['stringify'](_0x2d32b5));if(_0x2d32b5[_0xe75b('0x14')]){if(_0x2d32b5['error']['code']===0x1f4){logger[_0xe75b('0x14')](_0xe75b('0x11'),_0x38adbf,_0x2d32b5[_0xe75b('0x14')][_0xe75b('0x15')]);return _0x37fee2(_0x2d32b5[_0xe75b('0x14')]['message']);}logger[_0xe75b('0x14')](_0xe75b('0x11'),_0x38adbf,_0x2d32b5[_0xe75b('0x14')]['message']);return _0x52ec03(_0x2d32b5[_0xe75b('0x14')]['message']);}else{logger[_0xe75b('0x16')]('SmsQueue,\x20%s,\x20%s',_0x38adbf,_0xe75b('0x12'));_0x52ec03(_0x2d32b5['result'][_0xe75b('0x15')]);}})[_0xe75b('0x17')](function(_0x3e1ba5){logger['error']('SmsQueue,\x20%s,\x20%s',_0x38adbf,_0x3e1ba5);_0x37fee2(_0x3e1ba5);});});}exports['GetSmsQueue']=function(_0x349dd4){var _0x3b312b=this;return new Promise(function(_0x5bf52f,_0x262494){return db[_0xe75b('0x18')][_0xe75b('0x19')]({'raw':_0x349dd4['options']?_0x349dd4[_0xe75b('0x1a')][_0xe75b('0x1b')]===undefined?!![]:![]:!![],'where':_0x349dd4[_0xe75b('0x1a')]?_0x349dd4[_0xe75b('0x1a')][_0xe75b('0x1c')]||null:null,'attributes':_0x349dd4['options']?_0x349dd4['options'][_0xe75b('0x1d')]||null:null,'limit':_0x349dd4[_0xe75b('0x1a')]?_0x349dd4[_0xe75b('0x1a')][_0xe75b('0x1e')]||null:null,'include':_0x349dd4[_0xe75b('0x1a')]?_0x349dd4['options'][_0xe75b('0x1f')]?_[_0xe75b('0x20')](_0x349dd4['options'][_0xe75b('0x1f')],function(_0x48d3c2){return{'model':db[_0x48d3c2['model']],'as':_0x48d3c2['as'],'attributes':_0x48d3c2['attributes'],'include':_0x48d3c2[_0xe75b('0x1f')]?_[_0xe75b('0x20')](_0x48d3c2[_0xe75b('0x1f')],function(_0xcc5d82){return{'model':db[_0xcc5d82[_0xe75b('0x21')]],'as':_0xcc5d82['as'],'attributes':_0xcc5d82[_0xe75b('0x1d')],'include':_0xcc5d82[_0xe75b('0x1f')]?_['map'](_0xcc5d82[_0xe75b('0x1f')],function(_0x7112a3){return{'model':db[_0x7112a3[_0xe75b('0x21')]],'as':_0x7112a3['as'],'attributes':_0x7112a3[_0xe75b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe75b('0x10')](function(_0x375fe3){logger[_0xe75b('0x16')](_0xe75b('0x22'),_0x349dd4);logger[_0xe75b('0x23')](_0xe75b('0x22'),_0x349dd4,JSON[_0xe75b('0x24')](_0x375fe3));_0x5bf52f(_0x375fe3);})['catch'](function(_0x5c92ef){logger[_0xe75b('0x14')](_0xe75b('0x22'),_0x5c92ef['message'],_0x349dd4);_0x262494(_0x3b312b[_0xe75b('0x14')](0x1f4,_0x5c92ef[_0xe75b('0x15')]));});});};exports[_0xe75b('0x25')]=function(_0x62439d){var _0x399768=this;return new Promise(function(_0x4d1659,_0x463aca){return db[_0xe75b('0x18')][_0xe75b('0x26')]({'raw':_0x62439d['options']?_0x62439d[_0xe75b('0x1a')][_0xe75b('0x1b')]===undefined?!![]:![]:!![],'where':_0x62439d[_0xe75b('0x1a')]?_0x62439d[_0xe75b('0x1a')][_0xe75b('0x1c')]||null:null,'attributes':_0x62439d['options']?_0x62439d[_0xe75b('0x1a')][_0xe75b('0x1d')]||null:null,'include':_0x62439d[_0xe75b('0x1a')]?_0x62439d[_0xe75b('0x1a')][_0xe75b('0x1f')]?_[_0xe75b('0x20')](_0x62439d[_0xe75b('0x1a')][_0xe75b('0x1f')],function(_0x16430a){return{'model':db[_0x16430a[_0xe75b('0x21')]],'as':_0x16430a['as'],'attributes':_0x16430a[_0xe75b('0x1d')],'include':_0x16430a[_0xe75b('0x1f')]?_[_0xe75b('0x20')](_0x16430a['include'],function(_0x318524){return{'model':db[_0x318524[_0xe75b('0x21')]],'as':_0x318524['as'],'attributes':_0x318524[_0xe75b('0x1d')],'include':_0x318524[_0xe75b('0x1f')]?_[_0xe75b('0x20')](_0x318524[_0xe75b('0x1f')],function(_0x5c5e20){return{'model':db[_0x5c5e20[_0xe75b('0x21')]],'as':_0x5c5e20['as'],'attributes':_0x5c5e20[_0xe75b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe75b('0x10')](function(_0x3a20cd){logger[_0xe75b('0x16')]('ShowSmsQueue',_0x62439d);logger[_0xe75b('0x23')](_0xe75b('0x25'),_0x62439d,JSON[_0xe75b('0x24')](_0x3a20cd));_0x4d1659(_0x3a20cd);})[_0xe75b('0x17')](function(_0x1a02a1){logger[_0xe75b('0x14')](_0xe75b('0x25'),_0x1a02a1[_0xe75b('0x15')],_0x62439d);_0x463aca(_0x399768[_0xe75b('0x14')](0x1f4,_0x1a02a1[_0xe75b('0x15')]));});});}; \ No newline at end of file +var _0xb9aa=['code','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','map','include','model','then','ShowSmsQueue','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','redis','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a6a40,_0x4dee07){var _0x431f37=function(_0x28231f){while(--_0x28231f){_0x1a6a40['push'](_0x1a6a40['shift']());}};_0x431f37(++_0x4dee07);}(_0xb9aa,0x86));var _0xab9a=function(_0x10746d,_0x706dc9){_0x10746d=_0x10746d-0x0;var _0x1e8902=_0xb9aa[_0x10746d];return _0x1e8902;};'use strict';var _=require(_0xab9a('0x0'));var util=require(_0xab9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab9a('0x2'));var fs=require('fs');var Redis=require(_0xab9a('0x3'));var db=require(_0xab9a('0x4'))['db'];var utils=require(_0xab9a('0x5'));var logger=require(_0xab9a('0x6'))(_0xab9a('0x7'));var config=require('../../config/environment');var jayson=require(_0xab9a('0x8'));var client=jayson[_0xab9a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xab9a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab9a('0xb'))(new Redis(config[_0xab9a('0xc')]));require(_0xab9a('0xd'))[_0xab9a('0xe')](socket);function respondWithRpcPromise(_0x256ad8,_0x5f46be,_0x4ca935){return new BPromise(function(_0x458eec,_0x58b220){return client[_0xab9a('0xf')](_0x256ad8,_0x4ca935)['then'](function(_0x1fd485){logger['info'](_0xab9a('0x10'),_0x5f46be,_0xab9a('0x11'));logger[_0xab9a('0x12')](_0xab9a('0x13'),_0x5f46be,_0xab9a('0x11'),JSON[_0xab9a('0x14')](_0x1fd485));if(_0x1fd485[_0xab9a('0x15')]){if(_0x1fd485[_0xab9a('0x15')][_0xab9a('0x16')]===0x1f4){logger['error'](_0xab9a('0x10'),_0x5f46be,_0x1fd485['error'][_0xab9a('0x17')]);return _0x58b220(_0x1fd485[_0xab9a('0x15')][_0xab9a('0x17')]);}logger[_0xab9a('0x15')](_0xab9a('0x10'),_0x5f46be,_0x1fd485[_0xab9a('0x15')]['message']);return _0x458eec(_0x1fd485[_0xab9a('0x15')][_0xab9a('0x17')]);}else{logger[_0xab9a('0x18')](_0xab9a('0x10'),_0x5f46be,_0xab9a('0x11'));_0x458eec(_0x1fd485[_0xab9a('0x19')][_0xab9a('0x17')]);}})[_0xab9a('0x1a')](function(_0x1287f7){logger[_0xab9a('0x15')]('SmsQueue,\x20%s,\x20%s',_0x5f46be,_0x1287f7);_0x58b220(_0x1287f7);});});}exports[_0xab9a('0x1b')]=function(_0x54d447){var _0x4c61cf=this;return new Promise(function(_0x36359f,_0x3dac10){return db[_0xab9a('0x1c')][_0xab9a('0x1d')]({'raw':_0x54d447[_0xab9a('0x1e')]?_0x54d447['options'][_0xab9a('0x1f')]===undefined?!![]:![]:!![],'where':_0x54d447[_0xab9a('0x1e')]?_0x54d447[_0xab9a('0x1e')]['where']||null:null,'attributes':_0x54d447[_0xab9a('0x1e')]?_0x54d447['options'][_0xab9a('0x20')]||null:null,'limit':_0x54d447[_0xab9a('0x1e')]?_0x54d447[_0xab9a('0x1e')]['limit']||null:null,'include':_0x54d447[_0xab9a('0x1e')]?_0x54d447[_0xab9a('0x1e')]['include']?_[_0xab9a('0x21')](_0x54d447[_0xab9a('0x1e')][_0xab9a('0x22')],function(_0x172a8a){return{'model':db[_0x172a8a['model']],'as':_0x172a8a['as'],'attributes':_0x172a8a[_0xab9a('0x20')],'include':_0x172a8a[_0xab9a('0x22')]?_[_0xab9a('0x21')](_0x172a8a[_0xab9a('0x22')],function(_0x3c7e2d){return{'model':db[_0x3c7e2d[_0xab9a('0x23')]],'as':_0x3c7e2d['as'],'attributes':_0x3c7e2d[_0xab9a('0x20')],'include':_0x3c7e2d[_0xab9a('0x22')]?_[_0xab9a('0x21')](_0x3c7e2d[_0xab9a('0x22')],function(_0x14a636){return{'model':db[_0x14a636['model']],'as':_0x14a636['as'],'attributes':_0x14a636[_0xab9a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xab9a('0x24')](function(_0x38f5cc){logger[_0xab9a('0x18')]('GetSmsQueue',_0x54d447);logger['debug'](_0xab9a('0x1b'),_0x54d447,JSON[_0xab9a('0x14')](_0x38f5cc));_0x36359f(_0x38f5cc);})[_0xab9a('0x1a')](function(_0x4c16ed){logger[_0xab9a('0x15')](_0xab9a('0x1b'),_0x4c16ed[_0xab9a('0x17')],_0x54d447);_0x3dac10(_0x4c61cf[_0xab9a('0x15')](0x1f4,_0x4c16ed[_0xab9a('0x17')]));});});};exports[_0xab9a('0x25')]=function(_0x5ce3d2){var _0x431d00=this;return new Promise(function(_0x3c2c03,_0x488b44){return db[_0xab9a('0x1c')]['find']({'raw':_0x5ce3d2[_0xab9a('0x1e')]?_0x5ce3d2[_0xab9a('0x1e')][_0xab9a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ce3d2[_0xab9a('0x1e')]?_0x5ce3d2[_0xab9a('0x1e')][_0xab9a('0x26')]||null:null,'attributes':_0x5ce3d2['options']?_0x5ce3d2['options'][_0xab9a('0x20')]||null:null,'include':_0x5ce3d2[_0xab9a('0x1e')]?_0x5ce3d2[_0xab9a('0x1e')][_0xab9a('0x22')]?_[_0xab9a('0x21')](_0x5ce3d2['options'][_0xab9a('0x22')],function(_0x456494){return{'model':db[_0x456494['model']],'as':_0x456494['as'],'attributes':_0x456494['attributes'],'include':_0x456494[_0xab9a('0x22')]?_[_0xab9a('0x21')](_0x456494[_0xab9a('0x22')],function(_0x2db9b8){return{'model':db[_0x2db9b8['model']],'as':_0x2db9b8['as'],'attributes':_0x2db9b8[_0xab9a('0x20')],'include':_0x2db9b8[_0xab9a('0x22')]?_[_0xab9a('0x21')](_0x2db9b8[_0xab9a('0x22')],function(_0x257f65){return{'model':db[_0x257f65[_0xab9a('0x23')]],'as':_0x257f65['as'],'attributes':_0x257f65[_0xab9a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xab9a('0x24')](function(_0xcbadc4){logger[_0xab9a('0x18')](_0xab9a('0x25'),_0x5ce3d2);logger[_0xab9a('0x12')](_0xab9a('0x25'),_0x5ce3d2,JSON[_0xab9a('0x14')](_0xcbadc4));_0x3c2c03(_0xcbadc4);})[_0xab9a('0x1a')](function(_0x1063ed){logger[_0xab9a('0x15')]('ShowSmsQueue',_0x1063ed[_0xab9a('0x17')],_0x5ce3d2);_0x488b44(_0x431d00[_0xab9a('0x15')](0x1f4,_0x1063ed[_0xab9a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9e5bb3a..a6513c6 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 _0x0022=['emit','register','smsQueue:'];(function(_0x40c198,_0x4f0e11){var _0x3e57d8=function(_0x1321a2){while(--_0x1321a2){_0x40c198['push'](_0x40c198['shift']());}};_0x3e57d8(++_0x4f0e11);}(_0x0022,0x198));var _0x2002=function(_0x27c657,_0x17f078){_0x27c657=_0x27c657-0x0;var _0x47ecbb=_0x0022[_0x27c657];return _0x47ecbb;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x1ae946,_0x16d9d3){return function(_0x845005){_0x16d9d3[_0x2002('0x0')](_0x1ae946,_0x845005);};}function removeListener(_0xdbda46,_0x5c7373){return function(){SmsQueueEvents['removeListener'](_0xdbda46,_0x5c7373);};}exports[_0x2002('0x1')]=function(_0x2effe6){for(var _0x1ca04b=0x0,_0x3c4170=events['length'];_0x1ca04b<_0x3c4170;_0x1ca04b++){var _0x59b3c2=events[_0x1ca04b];var _0x47d07b=createListener(_0x2002('0x2')+_0x59b3c2,_0x2effe6);SmsQueueEvents['on'](_0x59b3c2,_0x47d07b);}}; \ No newline at end of file +var _0x5e74=['emit','length','./smsQueue.events','save','remove'];(function(_0x35bda2,_0x3989f5){var _0x1037a6=function(_0x46c989){while(--_0x46c989){_0x35bda2['push'](_0x35bda2['shift']());}};_0x1037a6(++_0x3989f5);}(_0x5e74,0x17e));var _0x45e7=function(_0x460101,_0x514d66){_0x460101=_0x460101-0x0;var _0x362bfd=_0x5e74[_0x460101];return _0x362bfd;};'use strict';var SmsQueueEvents=require(_0x45e7('0x0'));var events=[_0x45e7('0x1'),_0x45e7('0x2'),'update'];function createListener(_0x19df5f,_0x4b0a02){return function(_0x2821bd){_0x4b0a02[_0x45e7('0x3')](_0x19df5f,_0x2821bd);};}function removeListener(_0x301a8a,_0x4eed4b){return function(){SmsQueueEvents['removeListener'](_0x301a8a,_0x4eed4b);};}exports['register']=function(_0xb37115){for(var _0x55d291=0x0,_0xec3f97=events[_0x45e7('0x4')];_0x55d291<_0xec3f97;_0x55d291++){var _0x2d4d21=events[_0x55d291];var _0x142ccb=createListener('smsQueue:'+_0x2d4d21,_0xb37115);SmsQueueEvents['on'](_0x2d4d21,_0x142ccb);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 29b1864..466a4b2 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 _0x5300=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x4729ae,_0x35a7c4){var _0x464880=function(_0x2e6d08){while(--_0x2e6d08){_0x4729ae['push'](_0x4729ae['shift']());}};_0x464880(++_0x35a7c4);}(_0x5300,0x94));var _0x0530=function(_0x130e40,_0xc71f1c){_0x130e40=_0x130e40-0x0;var _0x13ef54=_0x5300[_0x130e40];return _0x13ef54;};'use strict';var multer=require(_0x0530('0x0'));var util=require(_0x0530('0x1'));var path=require(_0x0530('0x2'));var timeout=require(_0x0530('0x3'));var express=require(_0x0530('0x4'));var router=express['Router']();var auth=require(_0x0530('0x5'));var interaction=require(_0x0530('0x6'));var config=require(_0x0530('0x7'));var controller=require(_0x0530('0x8'));router[_0x0530('0x9')]('/',auth['isAuthenticated'](),controller[_0x0530('0xa')]);router[_0x0530('0x9')](_0x0530('0xb'),auth['isAuthenticated'](),controller[_0x0530('0xc')]);router[_0x0530('0x9')](_0x0530('0xd'),auth[_0x0530('0xe')](),controller['show']);router[_0x0530('0xf')]('/',auth['isAuthenticated'](),controller[_0x0530('0x10')]);router[_0x0530('0x11')](_0x0530('0xd'),auth['isAuthenticated'](),controller[_0x0530('0x12')]);router[_0x0530('0x13')](_0x0530('0xd'),auth[_0x0530('0xe')](),controller['destroy']);module[_0x0530('0x14')]=router; \ No newline at end of file +var _0xf1bb=['create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x220720,_0x10d6b4){var _0x20f9a7=function(_0xfd086c){while(--_0xfd086c){_0x220720['push'](_0x220720['shift']());}};_0x20f9a7(++_0x10d6b4);}(_0xf1bb,0xb9));var _0xbf1b=function(_0xfcb287,_0x4dd517){_0xfcb287=_0xfcb287-0x0;var _0x5ecbf7=_0xf1bb[_0xfcb287];return _0x5ecbf7;};'use strict';var multer=require(_0xbf1b('0x0'));var util=require(_0xbf1b('0x1'));var path=require('path');var timeout=require(_0xbf1b('0x2'));var express=require(_0xbf1b('0x3'));var router=express[_0xbf1b('0x4')]();var auth=require(_0xbf1b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf1b('0x6'));var controller=require(_0xbf1b('0x7'));router['get']('/',auth[_0xbf1b('0x8')](),controller['index']);router[_0xbf1b('0x9')](_0xbf1b('0xa'),auth[_0xbf1b('0x8')](),controller[_0xbf1b('0xb')]);router[_0xbf1b('0x9')](_0xbf1b('0xc'),auth['isAuthenticated'](),controller[_0xbf1b('0xd')]);router[_0xbf1b('0xe')]('/',auth[_0xbf1b('0x8')](),controller[_0xbf1b('0xf')]);router[_0xbf1b('0x10')](_0xbf1b('0xc'),auth[_0xbf1b('0x8')](),controller[_0xbf1b('0x11')]);router[_0xbf1b('0x12')](_0xbf1b('0xc'),auth[_0xbf1b('0x8')](),controller['destroy']);module[_0xbf1b('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 33f971f..15827ef 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 _0x257a=['DATE','sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x257a,0x17d));var _0xa257=function(_0x4c60d5,_0x58b8d2){_0x4c60d5=_0x4c60d5-0x0;var _0x262319=_0x257a[_0x4c60d5];return _0x262319;};'use strict';var moment=require('moment');var Sequelize=require(_0xa257('0x0'));module[_0xa257('0x1')]={'uniqueid':{'type':Sequelize[_0xa257('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa257('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa257('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02da=['exports','STRING','DATE','moment','sequelize'];(function(_0x47a009,_0x141310){var _0x1bc744=function(_0x13424c){while(--_0x13424c){_0x47a009['push'](_0x47a009['shift']());}};_0x1bc744(++_0x141310);}(_0x02da,0x125));var _0xa02d=function(_0x43dd29,_0x50e6c1){_0x43dd29=_0x43dd29-0x0;var _0x27c362=_0x02da[_0x43dd29];return _0x27c362;};'use strict';var moment=require(_0xa02d('0x0'));var Sequelize=require(_0xa02d('0x1'));module[_0xa02d('0x2')]={'uniqueid':{'type':Sequelize[_0xa02d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa02d('0x3')]},'joinAt':{'type':Sequelize[_0xa02d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa02d('0x4')]},'exitAt':{'type':Sequelize[_0xa02d('0x4')]},'reason':{'type':Sequelize[_0xa02d('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ece1a02..3e4f48c 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(_0x134635,_0x501472){var _0x297980=function(_0x598f24){while(--_0x598f24){_0x134635['push'](_0x134635['shift']());}};_0x297980(++_0x501472);}(_0xe14b,0x93));var _0xbe14=function(_0x44bdc0,_0x362909){_0x44bdc0=_0x44bdc0-0x0;var _0x4d533c=_0xe14b[_0x44bdc0];return _0x4d533c;};'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 _0x3e74=['save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','count','offset','status','set','Content-Range','json','apply','reject'];(function(_0x5525cb,_0x1e19fb){var _0x582518=function(_0x5ba062){while(--_0x5ba062){_0x5525cb['push'](_0x5525cb['shift']());}};_0x582518(++_0x1e19fb);}(_0x3e74,0x175));var _0x43e7=function(_0x119f4d,_0x3df4c7){_0x119f4d=_0x119f4d-0x0;var _0x4350b7=_0x3e74[_0x119f4d];return _0x4350b7;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454359,_0x4eea52){return function(_0x4c9df3){if(!_0x4c9df3){_0x454359[_0x43e7('0x14')](0x194);}return _0x4c9df3;};}function handleError(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0x1f4;return function(_0x1f0673){logger['error'](_0x1f0673[_0x43e7('0x21')]);if(_0x1f0673['name']){delete _0x1f0673[_0x43e7('0x22')];}_0x43f4ff[_0x43e7('0x17')](_0x4b2b9f)[_0x43e7('0x23')](_0x1f0673);};}exports[_0x43e7('0x24')]=function(_0x51f4d7,_0x52b7b3){var _0x805b54={},_0x501551={},_0x2dd5f={'count':0x0,'rows':[]};var _0x40dc8f=_[_0x43e7('0x25')](db[_0x43e7('0x26')]['rawAttributes'],function(_0x33a1a5){return{'name':_0x33a1a5[_0x43e7('0x27')],'type':_0x33a1a5[_0x43e7('0x28')][_0x43e7('0x29')]};});_0x501551[_0x43e7('0x2a')]=_[_0x43e7('0x25')](_0x40dc8f,_0x43e7('0x22'));_0x501551[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x51f4d7[_0x43e7('0x2b')]);_0x501551[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],_0x501551[_0x43e7('0x2b')]);_0x805b54['attributes']=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x2f')]));_0x805b54['attributes']=_0x805b54[_0x43e7('0x30')][_0x43e7('0x31')]?_0x805b54[_0x43e7('0x30')]:_0x501551[_0x43e7('0x2a')];if(!_0x51f4d7['query']['hasOwnProperty']('nolimit')){_0x805b54[_0x43e7('0x32')]=qs[_0x43e7('0x32')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x32')]);_0x805b54[_0x43e7('0x16')]=qs[_0x43e7('0x16')](_0x51f4d7['query']['offset']);}_0x805b54['order']=qs['sort'](_0x51f4d7['query']['sort']);_0x805b54['where']=qs[_0x43e7('0x2d')](_['pick'](_0x51f4d7[_0x43e7('0x2b')],_0x501551[_0x43e7('0x2d')]),_0x40dc8f);if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]){_0x805b54[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x805b54[_0x43e7('0x34')],{'$or':_['map'](_0x40dc8f,function(_0x5332d9){if(_0x5332d9['type']!==_0x43e7('0x36')){var _0xfe70e9={};_0xfe70e9[_0x5332d9[_0x43e7('0x22')]]={'$like':'%'+_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]+'%'};return _0xfe70e9;}})});}_0x805b54=_[_0x43e7('0x35')]({},_0x805b54,_0x51f4d7[_0x43e7('0x37')]);var _0x2ffd43={'where':_0x805b54['where']};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ffd43)['then'](function(_0x2d54c1){_0x2dd5f['count']=_0x2d54c1;if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x38')]){_0x805b54[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x805b54);})[_0x43e7('0x1f')](function(_0x5e731b){_0x2dd5f['rows']=_0x5e731b;return _0x2dd5f;})[_0x43e7('0x1f')](respondWithFilteredResult(_0x52b7b3,_0x805b54))[_0x43e7('0x3b')](handleError(_0x52b7b3,null));};exports[_0x43e7('0x3c')]=function(_0xc8ffa5,_0x127d77){var _0x4a4a85={'raw':!![],'where':{'id':_0xc8ffa5[_0x43e7('0x3d')]['id']}},_0x32a451={};_0x32a451['model']=_[_0x43e7('0x2c')](db['SmsQueueReport'][_0x43e7('0x3e')]);_0x32a451['query']=_[_0x43e7('0x2c')](_0xc8ffa5[_0x43e7('0x2b')]);_0x32a451[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x32a451['model'],_0x32a451['query']);_0x4a4a85[_0x43e7('0x30')]=_[_0x43e7('0x2e')](_0x32a451[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0xc8ffa5['query']['fields']));_0x4a4a85['attributes']=_0x4a4a85[_0x43e7('0x30')]['length']?_0x4a4a85[_0x43e7('0x30')]:_0x32a451['model'];if(_0xc8ffa5['query'][_0x43e7('0x38')]){_0x4a4a85['include']=[{'all':!![]}];}_0x4a4a85=_[_0x43e7('0x35')]({},_0x4a4a85,_0xc8ffa5[_0x43e7('0x37')]);return db[_0x43e7('0x26')][_0x43e7('0x3f')](_0x4a4a85)['then'](handleEntityNotFound(_0x127d77,null))[_0x43e7('0x1f')](respondWithResult(_0x127d77,null))[_0x43e7('0x3b')](handleError(_0x127d77,null));};exports[_0x43e7('0x40')]=function(_0x1fd277,_0x296dc8){return db[_0x43e7('0x26')]['create'](_0x1fd277['body'],{})[_0x43e7('0x1f')](respondWithResult(_0x296dc8,0xc9))[_0x43e7('0x3b')](handleError(_0x296dc8,null));};exports[_0x43e7('0x1e')]=function(_0x4c00a8,_0x5c1c18){if(_0x4c00a8['body']['id']){delete _0x4c00a8[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x26')]['find']({'where':{'id':_0x4c00a8[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x5c1c18,null))[_0x43e7('0x1f')](saveUpdates(_0x4c00a8['body'],null))['then'](respondWithResult(_0x5c1c18,null))['catch'](handleError(_0x5c1c18,null));};exports['destroy']=function(_0x214e7e,_0xe955fc){return db['SmsQueueReport'][_0x43e7('0x3f')]({'where':{'id':_0x214e7e[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x1f')](removeEntity(_0xe955fc,null))['catch'](handleError(_0xe955fc,null));};exports[_0x43e7('0x42')]=function(_0x483f20,_0x4bebd4){return db[_0x43e7('0x26')][_0x43e7('0x42')]()[_0x43e7('0x1f')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x3b')](handleError(_0x4bebd4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1415e4d..8a1ad92 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 _0x6bdd=['report_sms_queue','uniqueid','../../config/logger','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define'];(function(_0xd13dac,_0x1c0efb){var _0x262c97=function(_0x4bd728){while(--_0x4bd728){_0xd13dac['push'](_0xd13dac['shift']());}};_0x262c97(++_0x1c0efb);}(_0x6bdd,0xf5));var _0xd6bd=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0x6bdd[_0x251d43];return _0x3d7759;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6bd('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd6bd('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd6bd('0x2'));var config=require(_0xd6bd('0x3'));var attributes=require(_0xd6bd('0x4'));module[_0xd6bd('0x5')]=function(_0x24bc3f,_0xad7641){return _0x24bc3f[_0xd6bd('0x6')]('SmsQueueReport',attributes,{'tableName':_0xd6bd('0x7'),'paranoid':![],'indexes':[{'name':_0xd6bd('0x8'),'fields':[_0xd6bd('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b07=['./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x9b07,0x1e7));var _0x79b0=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9b07[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x79b0('0x0'));var logger=require(_0x79b0('0x1'))(_0x79b0('0x2'));var moment=require(_0x79b0('0x3'));var BPromise=require(_0x79b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79b0('0x5'));var rimraf=require('rimraf');var config=require(_0x79b0('0x6'));var attributes=require(_0x79b0('0x7'));module[_0x79b0('0x8')]=function(_0x20cd3d,_0x4b3cb6){return _0x20cd3d[_0x79b0('0x9')](_0x79b0('0xa'),attributes,{'tableName':_0x79b0('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x79b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f9abf7e..a863d2a 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 _0x890a=['rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4927aa,_0x1d6602){var _0x302a51=function(_0x3d64eb){while(--_0x3d64eb){_0x4927aa['push'](_0x4927aa['shift']());}};_0x302a51(++_0x1d6602);}(_0x890a,0xbf));var _0xa890=function(_0x3a2c4a,_0x57fac8){_0x3a2c4a=_0x3a2c4a-0x0;var _0x39a1bb=_0x890a[_0x3a2c4a];return _0x39a1bb;};'use strict';var _=require(_0xa890('0x0'));var util=require(_0xa890('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa890('0x2'));var fs=require('fs');var Redis=require(_0xa890('0x3'));var db=require(_0xa890('0x4'))['db'];var utils=require(_0xa890('0x5'));var logger=require(_0xa890('0x6'))(_0xa890('0x7'));var config=require(_0xa890('0x8'));var jayson=require(_0xa890('0x9'));var client=jayson[_0xa890('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43c4d9,_0x421172,_0x331853){return new BPromise(function(_0x61b8e6,_0x27999a){return client[_0xa890('0xb')](_0x43c4d9,_0x331853)[_0xa890('0xc')](function(_0x2e0af4){logger[_0xa890('0xd')](_0xa890('0xe'),_0x421172,_0xa890('0xf'));logger[_0xa890('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x421172,_0xa890('0xf'),JSON[_0xa890('0x11')](_0x2e0af4));if(_0x2e0af4[_0xa890('0x12')]){if(_0x2e0af4['error'][_0xa890('0x13')]===0x1f4){logger[_0xa890('0x12')](_0xa890('0xe'),_0x421172,_0x2e0af4[_0xa890('0x12')][_0xa890('0x14')]);return _0x27999a(_0x2e0af4[_0xa890('0x12')][_0xa890('0x14')]);}logger[_0xa890('0x12')](_0xa890('0xe'),_0x421172,_0x2e0af4[_0xa890('0x12')][_0xa890('0x14')]);return _0x61b8e6(_0x2e0af4[_0xa890('0x12')][_0xa890('0x14')]);}else{logger['info'](_0xa890('0xe'),_0x421172,'request\x20sent');_0x61b8e6(_0x2e0af4[_0xa890('0x15')]['message']);}})[_0xa890('0x16')](function(_0x5b4932){logger[_0xa890('0x12')](_0xa890('0xe'),_0x421172,_0x5b4932);_0x27999a(_0x5b4932);});});}exports['CreateSmsQueueReport']=function(_0x24db97){var _0x197def=this;return new Promise(function(_0x2809f7,_0x4617c8){return db[_0xa890('0x17')][_0xa890('0x18')](_0x24db97[_0xa890('0x19')],{'raw':_0x24db97[_0xa890('0x1a')]?_0x24db97['options'][_0xa890('0x1b')]===undefined?!![]:![]:!![]})[_0xa890('0xc')](function(_0x5142e1){logger[_0xa890('0xd')](_0xa890('0x1c'),_0x24db97);logger['debug']('CreateSmsQueueReport',_0x24db97,JSON[_0xa890('0x11')](_0x5142e1));_0x2809f7(_0x5142e1);})[_0xa890('0x16')](function(_0x5cc76e){logger['error']('CreateSmsQueueReport',_0x5cc76e[_0xa890('0x14')],_0x24db97);_0x4617c8(_0x197def[_0xa890('0x12')](0x1f4,_0x5cc76e[_0xa890('0x14')]));});});};exports[_0xa890('0x1d')]=function(_0x5ea34f){var _0x3c936f=this;return new Promise(function(_0x2d3f37,_0x30592c){return db[_0xa890('0x17')][_0xa890('0x1e')](_0x5ea34f[_0xa890('0x19')],{'raw':_0x5ea34f['options']?_0x5ea34f[_0xa890('0x1a')][_0xa890('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ea34f[_0xa890('0x1a')]?_0x5ea34f['options'][_0xa890('0x1f')]||null:null,'attributes':_0x5ea34f['options']?_0x5ea34f['options'][_0xa890('0x20')]||null:null,'limit':_0x5ea34f[_0xa890('0x1a')]?_0x5ea34f[_0xa890('0x1a')]['limit']||null:null})[_0xa890('0xc')](function(_0x4c12ca){logger[_0xa890('0xd')](_0xa890('0x1d'),_0x5ea34f);logger['debug'](_0xa890('0x1d'),_0x5ea34f,JSON[_0xa890('0x11')](_0x4c12ca));_0x2d3f37(_0x4c12ca);})[_0xa890('0x16')](function(_0x11360d){logger[_0xa890('0x12')]('UpdateSmsQueueReport',_0x11360d[_0xa890('0x14')],_0x5ea34f);_0x30592c(_0x3c936f['error'](0x1f4,_0x11360d[_0xa890('0x14')]));});});}; \ No newline at end of file +var _0xef26=['info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateSmsQueueReport','body','options','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then'];(function(_0x479fca,_0x5466c5){var _0x5f0526=function(_0x295081){while(--_0x295081){_0x479fca['push'](_0x479fca['shift']());}};_0x5f0526(++_0x5466c5);}(_0xef26,0x6c));var _0x6ef2=function(_0xef39cb,_0x1a9eab){_0xef39cb=_0xef39cb-0x0;var _0x123f0e=_0xef26[_0xef39cb];return _0x123f0e;};'use strict';var _=require(_0x6ef2('0x0'));var util=require(_0x6ef2('0x1'));var moment=require(_0x6ef2('0x2'));var BPromise=require(_0x6ef2('0x3'));var rs=require(_0x6ef2('0x4'));var fs=require('fs');var Redis=require(_0x6ef2('0x5'));var db=require(_0x6ef2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ef2('0x7'))(_0x6ef2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ef2('0x9')][_0x6ef2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e6023,_0x1d4272,_0x2683bb){return new BPromise(function(_0x27be8a,_0x287bcb){return client['request'](_0x2e6023,_0x2683bb)[_0x6ef2('0xb')](function(_0xb7fc98){logger[_0x6ef2('0xc')](_0x6ef2('0xd'),_0x1d4272,'request\x20sent');logger[_0x6ef2('0xe')](_0x6ef2('0xf'),_0x1d4272,_0x6ef2('0x10'),JSON['stringify'](_0xb7fc98));if(_0xb7fc98[_0x6ef2('0x11')]){if(_0xb7fc98['error'][_0x6ef2('0x12')]===0x1f4){logger[_0x6ef2('0x11')](_0x6ef2('0xd'),_0x1d4272,_0xb7fc98[_0x6ef2('0x11')][_0x6ef2('0x13')]);return _0x287bcb(_0xb7fc98[_0x6ef2('0x11')][_0x6ef2('0x13')]);}logger[_0x6ef2('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1d4272,_0xb7fc98[_0x6ef2('0x11')]['message']);return _0x27be8a(_0xb7fc98['error'][_0x6ef2('0x13')]);}else{logger[_0x6ef2('0xc')](_0x6ef2('0xd'),_0x1d4272,'request\x20sent');_0x27be8a(_0xb7fc98['result']['message']);}})[_0x6ef2('0x14')](function(_0x56de5b){logger[_0x6ef2('0x11')](_0x6ef2('0xd'),_0x1d4272,_0x56de5b);_0x287bcb(_0x56de5b);});});}exports[_0x6ef2('0x15')]=function(_0x54074f){var _0x28d559=this;return new Promise(function(_0x1ee5e1,_0x2fa02c){return db['SmsQueueReport']['create'](_0x54074f[_0x6ef2('0x16')],{'raw':_0x54074f[_0x6ef2('0x17')]?_0x54074f['options']['raw']===undefined?!![]:![]:!![]})[_0x6ef2('0xb')](function(_0x2913b0){logger[_0x6ef2('0xc')](_0x6ef2('0x15'),_0x54074f);logger[_0x6ef2('0xe')](_0x6ef2('0x15'),_0x54074f,JSON['stringify'](_0x2913b0));_0x1ee5e1(_0x2913b0);})[_0x6ef2('0x14')](function(_0x4bb27b){logger[_0x6ef2('0x11')]('CreateSmsQueueReport',_0x4bb27b[_0x6ef2('0x13')],_0x54074f);_0x2fa02c(_0x28d559[_0x6ef2('0x11')](0x1f4,_0x4bb27b[_0x6ef2('0x13')]));});});};exports[_0x6ef2('0x18')]=function(_0x3471cd){var _0x359a23=this;return new Promise(function(_0x5f429a,_0xf0fd91){return db[_0x6ef2('0x19')][_0x6ef2('0x1a')](_0x3471cd[_0x6ef2('0x16')],{'raw':_0x3471cd[_0x6ef2('0x17')]?_0x3471cd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3471cd['options']?_0x3471cd[_0x6ef2('0x17')][_0x6ef2('0x1b')]||null:null,'attributes':_0x3471cd['options']?_0x3471cd[_0x6ef2('0x17')][_0x6ef2('0x1c')]||null:null,'limit':_0x3471cd[_0x6ef2('0x17')]?_0x3471cd[_0x6ef2('0x17')][_0x6ef2('0x1d')]||null:null})[_0x6ef2('0xb')](function(_0x277ea7){logger[_0x6ef2('0xc')](_0x6ef2('0x18'),_0x3471cd);logger[_0x6ef2('0xe')](_0x6ef2('0x18'),_0x3471cd,JSON['stringify'](_0x277ea7));_0x5f429a(_0x277ea7);})['catch'](function(_0x2d7a50){logger['error']('UpdateSmsQueueReport',_0x2d7a50[_0x6ef2('0x13')],_0x3471cd);_0xf0fd91(_0x359a23[_0x6ef2('0x11')](0x1f4,_0x2d7a50[_0x6ef2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ef0a770..c2bebd9 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 _0x9354=['Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','exports','util','path','express'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9354,0x96));var _0x4935=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x9354[_0x199b1f];return _0x267ac9;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var auth=require(_0x4935('0x4'));var interaction=require(_0x4935('0x5'));var config=require('../../config/environment');var controller=require(_0x4935('0x6'));router[_0x4935('0x7')]('/',auth[_0x4935('0x8')](),controller[_0x4935('0x9')]);router[_0x4935('0x7')](_0x4935('0xa'),auth[_0x4935('0x8')](),controller[_0x4935('0xb')]);router[_0x4935('0x7')]('/:id',auth[_0x4935('0x8')](),controller['show']);router[_0x4935('0xc')]('/',auth[_0x4935('0x8')](),controller[_0x4935('0xd')]);router[_0x4935('0xe')](_0x4935('0xf'),auth[_0x4935('0x8')](),controller['update']);router['delete'](_0x4935('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file +var _0x1775=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a0b92,_0x26a288){var _0x4fcbbb=function(_0x198d92){while(--_0x198d92){_0x3a0b92['push'](_0x3a0b92['shift']());}};_0x4fcbbb(++_0x26a288);}(_0x1775,0x1db));var _0x5177=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1775[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0x9')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')]('/',auth[_0x5177('0xa')](),controller['create']);router['put'](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);router[_0x5177('0x12')](_0x5177('0xe'),auth['isAuthenticated'](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4ea4b44..9b21086 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 _0x3a7e=['queue','NOW','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x61cdd2,_0xcc1d3){var _0x1681f0=function(_0x22a6de){while(--_0x22a6de){_0x61cdd2['push'](_0x61cdd2['shift']());}};_0x1681f0(++_0xcc1d3);}(_0x3a7e,0xec));var _0xe3a7=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x3a7e[_0x5f382f];return _0x3bb11b;};'use strict';var moment=require(_0xe3a7('0x0'));var Sequelize=require(_0xe3a7('0x1'));module[_0xe3a7('0x2')]={'uniqueid':{'type':Sequelize[_0xe3a7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe3a7('0x4')](_0xe3a7('0x5'),_0xe3a7('0x6'),_0xe3a7('0x7')),'allowNull':![],'defaultValue':_0xe3a7('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xe3a7('0x8')]}}; \ No newline at end of file +var _0x9b16=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x7ea9e0,_0x3e2a22){var _0x191073=function(_0x9e1df5){while(--_0x9e1df5){_0x7ea9e0['push'](_0x7ea9e0['shift']());}};_0x191073(++_0x3e2a22);}(_0x9b16,0x137));var _0x69b1=function(_0x6a3e29,_0x281702){_0x6a3e29=_0x6a3e29-0x0;var _0x4e2dba=_0x9b16[_0x6a3e29];return _0x4e2dba;};'use strict';var moment=require(_0x69b1('0x0'));var Sequelize=require(_0x69b1('0x1'));module[_0x69b1('0x2')]={'uniqueid':{'type':Sequelize[_0x69b1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x69b1('0x4')](_0x69b1('0x5'),_0x69b1('0x6'),_0x69b1('0x7')),'allowNull':![],'defaultValue':_0x69b1('0x7')},'transferredAt':{'type':Sequelize[_0x69b1('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x69b1('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 219f086..ecf620c 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 _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(_0x55cb21,_0x319093){var _0x313eaa=function(_0x205365){while(--_0x205365){_0x55cb21['push'](_0x55cb21['shift']());}};_0x313eaa(++_0x319093);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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 +var _0xedd9=['update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','SmsTransferReport','includeAll','catch','show','params','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject'];(function(_0x440847,_0x5233a9){var _0x4329ae=function(_0x2ee3c6){while(--_0x2ee3c6){_0x440847['push'](_0x440847['shift']());}};_0x4329ae(++_0x5233a9);}(_0xedd9,0xfc));var _0x9edd=function(_0x223d34,_0x3e5231){_0x223d34=_0x223d34-0x0;var _0x2a32eb=_0xedd9[_0x223d34];return _0x2a32eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={},_0x57a2cc={},_0x214d0a={'count':0x0,'rows':[]};var _0x257a26=_[_0x9edd('0x27')](db['SmsTransferReport'][_0x9edd('0x28')],function(_0x28cfae){return{'name':_0x28cfae[_0x9edd('0x29')],'type':_0x28cfae[_0x9edd('0x2a')]['key']};});_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x27')](_0x257a26,_0x9edd('0x2c'));_0x57a2cc[_0x9edd('0x2d')]=_[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2d')]);_0x57a2cc[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x57a2cc[_0x9edd('0x2b')],_0x57a2cc[_0x9edd('0x2d')]);_0x4fe471[_0x9edd('0x31')]=_[_0x9edd('0x30')](_0x57a2cc[_0x9edd('0x2b')],qs[_0x9edd('0x32')](_0x25e135[_0x9edd('0x2d')]['fields']));_0x4fe471[_0x9edd('0x31')]=_0x4fe471[_0x9edd('0x31')][_0x9edd('0x33')]?_0x4fe471['attributes']:_0x57a2cc[_0x9edd('0x2b')];if(!_0x25e135[_0x9edd('0x2d')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x4fe471[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x25e135[_0x9edd('0x2d')][_0x9edd('0x1d')]);_0x4fe471[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x25e135[_0x9edd('0x2d')][_0x9edd('0x1c')]);}_0x4fe471[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x25e135['query'][_0x9edd('0x37')]);_0x4fe471['where']=qs[_0x9edd('0x2f')](_[_0x9edd('0x38')](_0x25e135[_0x9edd('0x2d')],_0x57a2cc[_0x9edd('0x2f')]),_0x257a26);if(_0x25e135[_0x9edd('0x2d')]['filter']){_0x4fe471[_0x9edd('0x39')]=_[_0x9edd('0x3a')](_0x4fe471[_0x9edd('0x39')],{'$or':_[_0x9edd('0x27')](_0x257a26,function(_0x1be77f){if(_0x1be77f[_0x9edd('0x2a')]!==_0x9edd('0x3b')){var _0x1cbbac={};_0x1cbbac[_0x1be77f[_0x9edd('0x2c')]]={'$like':'%'+_0x25e135[_0x9edd('0x2d')]['filter']+'%'};return _0x1cbbac;}})});}_0x4fe471=_[_0x9edd('0x3a')]({},_0x4fe471,_0x25e135['options']);var _0x3ef1d5={'where':_0x4fe471['where']};return db[_0x9edd('0x3c')][_0x9edd('0x1b')](_0x3ef1d5)[_0x9edd('0x21')](function(_0x479661){_0x214d0a[_0x9edd('0x1b')]=_0x479661;if(_0x25e135[_0x9edd('0x2d')][_0x9edd('0x3d')]){_0x4fe471['include']=[{'all':!![]}];}return db[_0x9edd('0x3c')]['findAll'](_0x4fe471);})[_0x9edd('0x21')](function(_0xfbc492){_0x214d0a['rows']=_0xfbc492;return _0x214d0a;})[_0x9edd('0x21')](respondWithFilteredResult(_0x3c2227,_0x4fe471))[_0x9edd('0x3e')](handleError(_0x3c2227,null));};exports[_0x9edd('0x3f')]=function(_0x810331,_0x492900){var _0x449f01={'raw':!![],'where':{'id':_0x810331[_0x9edd('0x40')]['id']}},_0x5bbdf8={};_0x5bbdf8[_0x9edd('0x2b')]=_['keys'](db[_0x9edd('0x3c')]['rawAttributes']);_0x5bbdf8['query']=_[_0x9edd('0x2e')](_0x810331[_0x9edd('0x2d')]);_0x5bbdf8[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x5bbdf8[_0x9edd('0x2b')],_0x5bbdf8[_0x9edd('0x2d')]);_0x449f01[_0x9edd('0x31')]=_[_0x9edd('0x30')](_0x5bbdf8[_0x9edd('0x2b')],qs[_0x9edd('0x32')](_0x810331[_0x9edd('0x2d')][_0x9edd('0x32')]));_0x449f01[_0x9edd('0x31')]=_0x449f01[_0x9edd('0x31')][_0x9edd('0x33')]?_0x449f01['attributes']:_0x5bbdf8[_0x9edd('0x2b')];if(_0x810331[_0x9edd('0x2d')][_0x9edd('0x3d')]){_0x449f01[_0x9edd('0x41')]=[{'all':!![]}];}_0x449f01=_[_0x9edd('0x3a')]({},_0x449f01,_0x810331[_0x9edd('0x42')]);return db[_0x9edd('0x3c')]['find'](_0x449f01)['then'](handleEntityNotFound(_0x492900,null))['then'](respondWithResult(_0x492900,null))[_0x9edd('0x3e')](handleError(_0x492900,null));};exports['create']=function(_0x8b1fdb,_0x19b56b){return db[_0x9edd('0x3c')][_0x9edd('0x43')](_0x8b1fdb[_0x9edd('0x44')],{})['then'](respondWithResult(_0x19b56b,0xc9))[_0x9edd('0x3e')](handleError(_0x19b56b,null));};exports[_0x9edd('0x20')]=function(_0x40e33d,_0x4a89ae){if(_0x40e33d[_0x9edd('0x44')]['id']){delete _0x40e33d[_0x9edd('0x44')]['id'];}return db[_0x9edd('0x3c')][_0x9edd('0x45')]({'where':{'id':_0x40e33d[_0x9edd('0x40')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x4a89ae,null))['then'](saveUpdates(_0x40e33d[_0x9edd('0x44')],null))[_0x9edd('0x21')](respondWithResult(_0x4a89ae,null))['catch'](handleError(_0x4a89ae,null));};exports[_0x9edd('0x22')]=function(_0x8d8701,_0x4bb324){return db[_0x9edd('0x3c')][_0x9edd('0x45')]({'where':{'id':_0x8d8701[_0x9edd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4bb324,null))[_0x9edd('0x21')](removeEntity(_0x4bb324,null))[_0x9edd('0x3e')](handleError(_0x4bb324,null));};exports[_0x9edd('0x46')]=function(_0x28c7bd,_0x53f6e3){return db[_0x9edd('0x3c')][_0x9edd('0x46')]()[_0x9edd('0x21')](respondWithResult(_0x53f6e3,null))['catch'](handleError(_0x53f6e3,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 506c01a..13eefb1 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 _0x9387=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0x9387,0x1da));var _0x7938=function(_0x53203b,_0x195fa3){_0x53203b=_0x53203b-0x0;var _0x43c38a=_0x9387[_0x53203b];return _0x43c38a;};'use strict';var _=require(_0x7938('0x0'));var util=require(_0x7938('0x1'));var logger=require('../../config/logger')(_0x7938('0x2'));var moment=require(_0x7938('0x3'));var BPromise=require(_0x7938('0x4'));var rp=require(_0x7938('0x5'));var fs=require('fs');var path=require(_0x7938('0x6'));var rimraf=require(_0x7938('0x7'));var config=require(_0x7938('0x8'));var attributes=require(_0x7938('0x9'));module[_0x7938('0xa')]=function(_0x2a0a83,_0x228df7){return _0x2a0a83[_0x7938('0xb')](_0x7938('0xc'),attributes,{'tableName':_0x7938('0xd'),'paranoid':![],'indexes':[{'name':_0x7938('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3040=['report_sms_transfer','uniqueid','lodash','util','api','request-promise','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x3040,0x7a));var _0x0304=function(_0x3e00a0,_0x43cc41){_0x3e00a0=_0x3e00a0-0x0;var _0x583968=_0x3040[_0x3e00a0];return _0x583968;};'use strict';var _=require(_0x0304('0x0'));var util=require(_0x0304('0x1'));var logger=require('../../config/logger')(_0x0304('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0304('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0304('0x4'));var attributes=require(_0x0304('0x5'));module['exports']=function(_0x5b97fb,_0x1e1cab){return _0x5b97fb[_0x0304('0x6')](_0x0304('0x7'),attributes,{'tableName':_0x0304('0x8'),'paranoid':![],'indexes':[{'name':_0x0304('0x9'),'fields':[_0x0304('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e1428d2..beb3a5c 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 _0x5f55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment'];(function(_0x1953b0,_0x348783){var _0x10f867=function(_0x16bb0b){while(--_0x16bb0b){_0x1953b0['push'](_0x1953b0['shift']());}};_0x10f867(++_0x348783);}(_0x5f55,0x18d));var _0x55f5=function(_0xf64026,_0x43afd3){_0xf64026=_0xf64026-0x0;var _0x1050be=_0x5f55[_0xf64026];return _0x1050be;};'use strict';var _=require(_0x55f5('0x0'));var util=require('util');var moment=require(_0x55f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x55f5('0x2'));var fs=require('fs');var Redis=require(_0x55f5('0x3'));var db=require(_0x55f5('0x4'))['db'];var utils=require(_0x55f5('0x5'));var logger=require(_0x55f5('0x6'))('rpc');var config=require(_0x55f5('0x7'));var jayson=require(_0x55f5('0x8'));var client=jayson[_0x55f5('0x9')][_0x55f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350dd7,_0x103a4e,_0x435d21){return new BPromise(function(_0x5a4ac8,_0x110b0c){return client[_0x55f5('0xb')](_0x350dd7,_0x435d21)[_0x55f5('0xc')](function(_0x1ccb08){logger['info'](_0x55f5('0xd'),_0x103a4e,_0x55f5('0xe'));logger[_0x55f5('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x103a4e,_0x55f5('0xe'),JSON[_0x55f5('0x10')](_0x1ccb08));if(_0x1ccb08[_0x55f5('0x11')]){if(_0x1ccb08['error']['code']===0x1f4){logger[_0x55f5('0x11')](_0x55f5('0xd'),_0x103a4e,_0x1ccb08[_0x55f5('0x11')][_0x55f5('0x12')]);return _0x110b0c(_0x1ccb08[_0x55f5('0x11')][_0x55f5('0x12')]);}logger['error'](_0x55f5('0xd'),_0x103a4e,_0x1ccb08[_0x55f5('0x11')]['message']);return _0x5a4ac8(_0x1ccb08[_0x55f5('0x11')]['message']);}else{logger['info'](_0x55f5('0xd'),_0x103a4e,_0x55f5('0xe'));_0x5a4ac8(_0x1ccb08[_0x55f5('0x13')][_0x55f5('0x12')]);}})[_0x55f5('0x14')](function(_0x42b68a){logger['error'](_0x55f5('0xd'),_0x103a4e,_0x42b68a);_0x110b0c(_0x42b68a);});});} \ No newline at end of file +var _0x8fc5=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x521b64,_0x446cc3){var _0x35c759=function(_0x13d926){while(--_0x13d926){_0x521b64['push'](_0x521b64['shift']());}};_0x35c759(++_0x446cc3);}(_0x8fc5,0x1e9));var _0x58fc=function(_0x12fea3,_0x3dde48){_0x12fea3=_0x12fea3-0x0;var _0x2004b8=_0x8fc5[_0x12fea3];return _0x2004b8;};'use strict';var _=require(_0x58fc('0x0'));var util=require('util');var moment=require(_0x58fc('0x1'));var BPromise=require(_0x58fc('0x2'));var rs=require(_0x58fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58fc('0x4'))['db'];var utils=require(_0x58fc('0x5'));var logger=require(_0x58fc('0x6'))(_0x58fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x58fc('0x8'));var client=jayson[_0x58fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20df57,_0x53ea50,_0x73a5d2){return new BPromise(function(_0x46b992,_0x4f736e){return client['request'](_0x20df57,_0x73a5d2)[_0x58fc('0xa')](function(_0x3e0118){logger[_0x58fc('0xb')](_0x58fc('0xc'),_0x53ea50,_0x58fc('0xd'));logger['debug'](_0x58fc('0xe'),_0x53ea50,_0x58fc('0xd'),JSON[_0x58fc('0xf')](_0x3e0118));if(_0x3e0118[_0x58fc('0x10')]){if(_0x3e0118[_0x58fc('0x10')][_0x58fc('0x11')]===0x1f4){logger[_0x58fc('0x10')](_0x58fc('0xc'),_0x53ea50,_0x3e0118[_0x58fc('0x10')]['message']);return _0x4f736e(_0x3e0118['error'][_0x58fc('0x12')]);}logger[_0x58fc('0x10')](_0x58fc('0xc'),_0x53ea50,_0x3e0118[_0x58fc('0x10')]['message']);return _0x46b992(_0x3e0118['error'][_0x58fc('0x12')]);}else{logger[_0x58fc('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x53ea50,_0x58fc('0xd'));_0x46b992(_0x3e0118[_0x58fc('0x13')][_0x58fc('0x12')]);}})[_0x58fc('0x14')](function(_0x38a7f4){logger[_0x58fc('0x10')](_0x58fc('0xc'),_0x53ea50,_0x38a7f4);_0x4f736e(_0x38a7f4);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 50e1987..8f72373 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 _0xef6f=['create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xef6f,0xe5));var _0xfef6=function(_0xa2f721,_0x18d94b){_0xa2f721=_0xa2f721-0x0;var _0x35110e=_0xef6f[_0xa2f721];return _0x35110e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfef6('0x0'));var timeout=require(_0xfef6('0x1'));var express=require(_0xfef6('0x2'));var router=express[_0xfef6('0x3')]();var auth=require(_0xfef6('0x4'));var interaction=require(_0xfef6('0x5'));var config=require(_0xfef6('0x6'));var controller=require(_0xfef6('0x7'));router[_0xfef6('0x8')]('/',auth[_0xfef6('0x9')](),controller[_0xfef6('0xa')]);router['get'](_0xfef6('0xb'),auth[_0xfef6('0x9')](),controller[_0xfef6('0xc')]);router[_0xfef6('0x8')](_0xfef6('0xd'),auth[_0xfef6('0x9')](),controller[_0xfef6('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x38d086,_0x95e54f,_0x596534){_0x596534(null,path[_0xfef6('0xf')](config[_0xfef6('0x10')],_0xfef6('0x11')));},'filename':function(_0x2a1652,_0x2e37b2,_0x3e33e5){_0x2e37b2['originalname']=_0x2e37b2[_0xfef6('0x12')][_0xfef6('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e33e5(null,util[_0xfef6('0x14')](_0xfef6('0x15'),path[_0xfef6('0x16')](_0x2e37b2[_0xfef6('0x12')],path[_0xfef6('0x17')](_0x2e37b2[_0xfef6('0x12')])),Date[_0xfef6('0x18')](),path[_0xfef6('0x17')](_0x2e37b2[_0xfef6('0x12')])));}})});router[_0xfef6('0x19')]('/',upload[_0xfef6('0x1a')]('file'),controller[_0xfef6('0x1b')]);router[_0xfef6('0x1c')](_0xfef6('0xb'),auth[_0xfef6('0x9')](),controller[_0xfef6('0x1d')]);router[_0xfef6('0x1e')](_0xfef6('0xb'),auth[_0xfef6('0x9')](),controller['delete']);module[_0xfef6('0x1f')]=router; \ No newline at end of file +var _0xce8f=['put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create'];(function(_0x384532,_0x4a7a03){var _0x4fc3ae=function(_0x190480){while(--_0x190480){_0x384532['push'](_0x384532['shift']());}};_0x4fc3ae(++_0x4a7a03);}(_0xce8f,0x196));var _0xfce8=function(_0xfae262,_0x5210d3){_0xfae262=_0xfae262-0x0;var _0x5e4705=_0xce8f[_0xfae262];return _0x5e4705;};'use strict';var multer=require(_0xfce8('0x0'));var util=require('util');var path=require(_0xfce8('0x1'));var timeout=require(_0xfce8('0x2'));var express=require(_0xfce8('0x3'));var router=express[_0xfce8('0x4')]();var auth=require(_0xfce8('0x5'));var interaction=require(_0xfce8('0x6'));var config=require(_0xfce8('0x7'));var controller=require('./sound.controller');router[_0xfce8('0x8')]('/',auth[_0xfce8('0x9')](),controller[_0xfce8('0xa')]);router[_0xfce8('0x8')](_0xfce8('0xb'),auth[_0xfce8('0x9')](),controller['show']);router['get'](_0xfce8('0xc'),auth[_0xfce8('0x9')](),controller[_0xfce8('0xd')]);var upload=multer({'storage':multer[_0xfce8('0xe')]({'destination':function(_0x1eeaaa,_0x4064aa,_0x108ef6){_0x108ef6(null,path['join'](config[_0xfce8('0xf')],_0xfce8('0x10')));},'filename':function(_0x170e1c,_0x1ae06b,_0x432693){_0x1ae06b[_0xfce8('0x11')]=_0x1ae06b[_0xfce8('0x11')][_0xfce8('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x432693(null,util[_0xfce8('0x13')](_0xfce8('0x14'),path[_0xfce8('0x15')](_0x1ae06b[_0xfce8('0x11')],path[_0xfce8('0x16')](_0x1ae06b[_0xfce8('0x11')])),Date[_0xfce8('0x17')](),path[_0xfce8('0x16')](_0x1ae06b[_0xfce8('0x11')])));}})});router[_0xfce8('0x18')]('/',upload[_0xfce8('0x19')](_0xfce8('0x1a')),controller[_0xfce8('0x1b')]);router[_0xfce8('0x1c')](_0xfce8('0xb'),auth[_0xfce8('0x9')](),controller[_0xfce8('0x1d')]);router[_0xfce8('0x1e')](_0xfce8('0xb'),auth[_0xfce8('0x9')](),controller[_0xfce8('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6b8954f..e20e843 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 _0x96ad=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x36f89c,_0x1e2de7){var _0x5bcdab=function(_0x56d052){while(--_0x56d052){_0x36f89c['push'](_0x36f89c['shift']());}};_0x5bcdab(++_0x1e2de7);}(_0x96ad,0x173));var _0xd96a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x96ad[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xd96a('0x0'));module[_0xd96a('0x1')]={'name':{'type':Sequelize[_0xd96a('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xd96a('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd96a('0x2')]},'original_format':{'type':Sequelize[_0xd96a('0x2')]},'original_duration':{'type':Sequelize[_0xd96a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd96a('0x4')]},'original_channelCount':{'type':Sequelize[_0xd96a('0x5')]},'original_bitRate':{'type':Sequelize[_0xd96a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd96a('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd96a('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xd96a('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbfd2=['exports','STRING','name','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x425bca,_0x5d531a){var _0xb8a689=function(_0x565a23){while(--_0x565a23){_0x425bca['push'](_0x425bca['shift']());}};_0xb8a689(++_0x5d531a);}(_0xbfd2,0xdf));var _0x2bfd=function(_0x333627,_0x14121e){_0x333627=_0x333627-0x0;var _0x18e839=_0xbfd2[_0x333627];return _0x18e839;};'use strict';var Sequelize=require(_0x2bfd('0x0'));module[_0x2bfd('0x1')]={'name':{'type':Sequelize[_0x2bfd('0x2')],'unique':_0x2bfd('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2bfd('0x2')]},'display_name':{'type':Sequelize[_0x2bfd('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2bfd('0x2')]},'original_format':{'type':Sequelize[_0x2bfd('0x2')]},'original_duration':{'type':Sequelize[_0x2bfd('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x2bfd('0x5')]},'original_bitRate':{'type':Sequelize[_0x2bfd('0x6')]},'original_sampleRate':{'type':Sequelize[_0x2bfd('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x2bfd('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x2bfd('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a7bebec..cd5fa28 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 _0xcb0f=['error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','body','userProfileId','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','destroy','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','stack','name','send','index','Sound','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','options','find','params','save_name','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','download','server/files/sounds/converted','converted_format','format','%s.%s','catch','create','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20filepath:\x20%s'];(function(_0x3558af,_0x2b02aa){var _0x28978b=function(_0x273daa){while(--_0x273daa){_0x3558af['push'](_0x3558af['shift']());}};_0x28978b(++_0x2b02aa);}(_0xcb0f,0x111));var _0xfcb0=function(_0x133d40,_0x270622){_0x133d40=_0x133d40-0x0;var _0x3a6e8d=_0xcb0f[_0x133d40];return _0x3a6e8d;};'use strict';var pdf=require(_0xfcb0('0x0'));var emlformat=require(_0xfcb0('0x1'));var rimraf=require(_0xfcb0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfcb0('0x3'));var moment=require(_0xfcb0('0x4'));var BPromise=require(_0xfcb0('0x5'));var Mustache=require(_0xfcb0('0x6'));var util=require(_0xfcb0('0x7'));var path=require(_0xfcb0('0x8'));var sox=require('sox');var csv=require(_0xfcb0('0x9'));var ejs=require(_0xfcb0('0xa'));var fs=require('fs');var _=require(_0xfcb0('0xb'));var squel=require(_0xfcb0('0xc'));var crypto=require(_0xfcb0('0xd'));var jsforce=require(_0xfcb0('0xe'));var deskjs=require(_0xfcb0('0xf'));var toCsv=require(_0xfcb0('0x9'));var querystring=require(_0xfcb0('0x10'));var Papa=require(_0xfcb0('0x11'));var Redis=require(_0xfcb0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfcb0('0x13'));var as=require(_0xfcb0('0x14'));var hardwareService=require(_0xfcb0('0x15'));var logger=require(_0xfcb0('0x16'))(_0xfcb0('0x17'));var utils=require(_0xfcb0('0x18'));var config=require(_0xfcb0('0x19'));var db=require(_0xfcb0('0x1a'))['db'];function respondWithStatusCode(_0x52f020,_0x14d5f4){_0x14d5f4=_0x14d5f4||0xcc;return function(_0xab0755){if(_0xab0755){return _0x52f020[_0xfcb0('0x1b')](_0x14d5f4);}return _0x52f020[_0xfcb0('0x1c')](_0x14d5f4)[_0xfcb0('0x1d')]();};}function respondWithResult(_0x3e9381,_0x3c4d03){_0x3c4d03=_0x3c4d03||0xc8;return function(_0x512524){if(_0x512524){return _0x3e9381['status'](_0x3c4d03)[_0xfcb0('0x1e')](_0x512524);}};}function respondWithFilteredResult(_0x1f2675,_0x2bffb4){return function(_0x278b0e){if(_0x278b0e){var _0x9eb857=_0x278b0e[_0xfcb0('0x1f')],_0x4461eb=_0x2bffb4[_0xfcb0('0x20')],_0x1dc500=_0x2bffb4[_0xfcb0('0x20')]+_0x2bffb4['limit'],_0x3532b3;if(_0x1dc500>=_0x9eb857){_0x1dc500=_0x9eb857;_0x3532b3=0xc8;}else{_0x3532b3=0xce;}_0x1f2675[_0xfcb0('0x1c')](_0x3532b3);return _0x1f2675[_0xfcb0('0x21')](_0xfcb0('0x22'),_0x4461eb+'-'+_0x1dc500+'/'+_0x9eb857)[_0xfcb0('0x1e')](_0x278b0e);}return null;};}function patchUpdates(_0x4df3d3){return function(_0x33ed18){try{jsonpatch[_0xfcb0('0x23')](_0x33ed18,_0x4df3d3,!![]);}catch(_0x5a7eae){return BPromise[_0xfcb0('0x24')](_0x5a7eae);}return _0x33ed18[_0xfcb0('0x25')]();};}function saveUpdates(_0x3bf61b,_0x19e0f7){return function(_0x595588){if(_0x595588){return _0x595588[_0xfcb0('0x26')](_0x3bf61b)['then'](function(_0x51239e){return _0x51239e;});}return null;};}function removeEntity(_0x437d21,_0x30ebb5){return function(_0x15ff8c){if(_0x15ff8c){return _0x15ff8c['destroy']()[_0xfcb0('0x27')](function(){var _0x281308=_0x15ff8c[_0xfcb0('0x28')]({'plain':!![]});var _0x675cdf=_0xfcb0('0x29');return db[_0xfcb0('0x2a')]['destroy']({'where':{'type':_0x675cdf,'resourceId':_0x281308['id']}})[_0xfcb0('0x27')](function(){return _0x15ff8c;});})['then'](function(){_0x437d21[_0xfcb0('0x1c')](0xcc)[_0xfcb0('0x1d')]();});}};}function handleEntityNotFound(_0x588dac,_0x25fdeb){return function(_0x44662c){if(!_0x44662c){_0x588dac[_0xfcb0('0x1b')](0x194);}return _0x44662c;};}function handleError(_0x2ee029,_0x4e4c0a){_0x4e4c0a=_0x4e4c0a||0x1f4;return function(_0x1508b2){logger['error'](_0x1508b2[_0xfcb0('0x2b')]);if(_0x1508b2[_0xfcb0('0x2c')]){delete _0x1508b2['name'];}_0x2ee029[_0xfcb0('0x1c')](_0x4e4c0a)[_0xfcb0('0x2d')](_0x1508b2);};}exports[_0xfcb0('0x2e')]=function(_0x441f34,_0x5b134b){var _0x313b24={},_0x542316={},_0x1e91b0={'count':0x0,'rows':[]};var _0x5ee986=_['map'](db[_0xfcb0('0x2f')][_0xfcb0('0x30')],function(_0x1bda85){return{'name':_0x1bda85['fieldName'],'type':_0x1bda85[_0xfcb0('0x31')][_0xfcb0('0x32')]};});_0x542316[_0xfcb0('0x33')]=_[_0xfcb0('0x34')](_0x5ee986,'name');_0x542316[_0xfcb0('0x35')]=_[_0xfcb0('0x36')](_0x441f34[_0xfcb0('0x35')]);_0x542316[_0xfcb0('0x37')]=_[_0xfcb0('0x38')](_0x542316[_0xfcb0('0x33')],_0x542316[_0xfcb0('0x35')]);_0x313b24[_0xfcb0('0x39')]=_[_0xfcb0('0x38')](_0x542316['model'],qs[_0xfcb0('0x3a')](_0x441f34[_0xfcb0('0x35')][_0xfcb0('0x3a')]));_0x313b24[_0xfcb0('0x39')]=_0x313b24[_0xfcb0('0x39')][_0xfcb0('0x3b')]?_0x313b24[_0xfcb0('0x39')]:_0x542316['model'];if(!_0x441f34['query'][_0xfcb0('0x3c')]('nolimit')){_0x313b24[_0xfcb0('0x3d')]=qs['limit'](_0x441f34[_0xfcb0('0x35')]['limit']);_0x313b24['offset']=qs[_0xfcb0('0x20')](_0x441f34['query'][_0xfcb0('0x20')]);}_0x313b24[_0xfcb0('0x3e')]=qs[_0xfcb0('0x3f')](_0x441f34['query']['sort']);_0x313b24[_0xfcb0('0x40')]=qs[_0xfcb0('0x37')](_[_0xfcb0('0x41')](_0x441f34[_0xfcb0('0x35')],_0x542316[_0xfcb0('0x37')]),_0x5ee986);if(_0x441f34['query'][_0xfcb0('0x42')]){_0x313b24[_0xfcb0('0x40')]=_[_0xfcb0('0x43')](_0x313b24[_0xfcb0('0x40')],{'$or':_['map'](_0x5ee986,function(_0x1d5b7e){if(_0x1d5b7e[_0xfcb0('0x31')]!==_0xfcb0('0x44')){var _0x2818b5={};_0x2818b5[_0x1d5b7e[_0xfcb0('0x2c')]]={'$like':'%'+_0x441f34[_0xfcb0('0x35')][_0xfcb0('0x42')]+'%'};return _0x2818b5;}})});}_0x313b24=_[_0xfcb0('0x43')]({},_0x313b24,_0x441f34['options']);var _0x44491b={'where':_0x313b24[_0xfcb0('0x40')]};return db['Sound'][_0xfcb0('0x1f')](_0x44491b)[_0xfcb0('0x27')](function(_0x333721){_0x1e91b0[_0xfcb0('0x1f')]=_0x333721;if(_0x441f34[_0xfcb0('0x35')][_0xfcb0('0x45')]){_0x313b24['include']=[{'all':!![]}];}return db[_0xfcb0('0x2f')]['findAll'](_0x313b24);})[_0xfcb0('0x27')](function(_0x151a90){_0x1e91b0['rows']=_0x151a90;return _0x1e91b0;})['then'](respondWithFilteredResult(_0x5b134b,_0x313b24))['catch'](handleError(_0x5b134b,null));};exports['show']=function(_0x3cb5c2,_0x887ce){var _0xc6b49e={'raw':!![],'where':{'id':_0x3cb5c2['params']['id']}},_0xbd883d={};_0xbd883d[_0xfcb0('0x33')]=_['keys'](db[_0xfcb0('0x2f')][_0xfcb0('0x30')]);_0xbd883d['query']=_[_0xfcb0('0x36')](_0x3cb5c2[_0xfcb0('0x35')]);_0xbd883d['filters']=_[_0xfcb0('0x38')](_0xbd883d['model'],_0xbd883d[_0xfcb0('0x35')]);_0xc6b49e[_0xfcb0('0x39')]=_[_0xfcb0('0x38')](_0xbd883d[_0xfcb0('0x33')],qs[_0xfcb0('0x3a')](_0x3cb5c2[_0xfcb0('0x35')][_0xfcb0('0x3a')]));_0xc6b49e['attributes']=_0xc6b49e[_0xfcb0('0x39')][_0xfcb0('0x3b')]?_0xc6b49e['attributes']:_0xbd883d[_0xfcb0('0x33')];if(_0x3cb5c2['query'][_0xfcb0('0x45')]){_0xc6b49e[_0xfcb0('0x46')]=[{'all':!![]}];}_0xc6b49e=_[_0xfcb0('0x43')]({},_0xc6b49e,_0x3cb5c2[_0xfcb0('0x47')]);return db[_0xfcb0('0x2f')][_0xfcb0('0x48')](_0xc6b49e)[_0xfcb0('0x27')](handleEntityNotFound(_0x887ce,null))[_0xfcb0('0x27')](respondWithResult(_0x887ce,null))['catch'](handleError(_0x887ce,null));};exports['download']=function(_0x567e31,_0x4958e0,_0x3b1d7e){return db[_0xfcb0('0x2f')][_0xfcb0('0x48')]({'where':{'id':_0x567e31[_0xfcb0('0x49')]['id']},'attributes':[_0xfcb0('0x2c'),_0xfcb0('0x4a'),'converted_format'],'raw':!![]})[_0xfcb0('0x27')](handleEntityNotFound(_0x4958e0,null))['then'](function(_0x404a6b){if(_0x404a6b){if(!fs[_0xfcb0('0x4b')](path[_0xfcb0('0x4c')](config[_0xfcb0('0x4d')],'server/files/sounds/converted',_0x404a6b['save_name']+'.'+_0x404a6b['converted_format']))){throw new db[(_0xfcb0('0x4e'))][(_0xfcb0('0x4f'))](_0xfcb0('0x50'));}return _0x4958e0[_0xfcb0('0x51')](path[_0xfcb0('0x4c')](config['root'],_0xfcb0('0x52'),util['format']('%s.%s',_0x404a6b[_0xfcb0('0x4a')],_0x404a6b[_0xfcb0('0x53')])),util[_0xfcb0('0x54')](_0xfcb0('0x55'),_0x404a6b[_0xfcb0('0x2c')],_0x404a6b[_0xfcb0('0x53')]));}return null;})[_0xfcb0('0x56')](handleError(_0x4958e0,null));};exports[_0xfcb0('0x57')]=function(_0xb2cb32,_0x520bf5,_0x5ad8ac){var _0x48fc30={'name':path[_0xfcb0('0x58')](_0xb2cb32[_0xfcb0('0x59')][_0xfcb0('0x5a')],path[_0xfcb0('0x5b')](_0xb2cb32[_0xfcb0('0x59')][_0xfcb0('0x5a')])),'save_name':path[_0xfcb0('0x58')](_0xb2cb32[_0xfcb0('0x59')]['filename'],path[_0xfcb0('0x5b')](_0xb2cb32[_0xfcb0('0x59')][_0xfcb0('0x5c')])),'original_format':path[_0xfcb0('0x5b')](_0xb2cb32[_0xfcb0('0x59')][_0xfcb0('0x5a')])['substring'](0x1),'converted_format':_0xfcb0('0x5d')};var _0x5c0758=path['join'](config['root'],'server/files/sounds/original',_0xb2cb32[_0xfcb0('0x59')]['filename']);var _0x1688a5=path['join'](config[_0xfcb0('0x4d')],_0xfcb0('0x52'),util['format'](_0xfcb0('0x55'),path[_0xfcb0('0x58')](_0xb2cb32[_0xfcb0('0x59')]['filename'],path[_0xfcb0('0x5b')](_0xb2cb32[_0xfcb0('0x59')][_0xfcb0('0x5c')])),_0x48fc30[_0xfcb0('0x53')]));logger[_0xfcb0('0x5e')](_0xfcb0('0x5f'),_0x5c0758);logger[_0xfcb0('0x5e')]('Sound\x20upload\x20destination:\x20%s',_0x1688a5);try{fs['chmodSync'](_0x5c0758,parseInt('0777',0x8));var _0x17522a=sox['transcode'](_0x5c0758,_0x1688a5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x17522a['on'](_0xfcb0('0x60'),function(_0x510080){fs[_0xfcb0('0x61')](_0x5c0758);_0x520bf5[_0xfcb0('0x1c')](0x1f4)[_0xfcb0('0x2d')](_0x510080);});_0x17522a['on'](_0xfcb0('0x62'),function(_0x3cf7eb){_0x48fc30[_0xfcb0('0x63')]=isNaN(_0x3cf7eb[_0xfcb0('0x64')])?null:_0x3cf7eb[_0xfcb0('0x64')]*0x3e8;_0x48fc30[_0xfcb0('0x65')]=isNaN(_0x3cf7eb[_0xfcb0('0x66')])?null:_0x3cf7eb[_0xfcb0('0x66')];_0x48fc30['original_channelCount']=isNaN(_0x3cf7eb[_0xfcb0('0x67')])?null:_0x3cf7eb[_0xfcb0('0x67')];_0x48fc30[_0xfcb0('0x68')]=isNaN(_0x3cf7eb['bitRate'])?null:_0x3cf7eb[_0xfcb0('0x69')];_0x48fc30['original_sampleRate']=isNaN(_0x3cf7eb[_0xfcb0('0x6a')])?null:_0x3cf7eb['sampleRate'];});_0x17522a['on']('dest',function(_0x13fdc7){_0x48fc30[_0xfcb0('0x6b')]=isNaN(_0x13fdc7['duration'])?null:_0x13fdc7[_0xfcb0('0x64')]*0x3e8;_0x48fc30[_0xfcb0('0x6c')]=isNaN(_0x13fdc7['sampleCount'])?null:_0x13fdc7[_0xfcb0('0x66')];_0x48fc30['converted_channelCount']=isNaN(_0x13fdc7[_0xfcb0('0x67')])?null:_0x13fdc7[_0xfcb0('0x67')];_0x48fc30[_0xfcb0('0x6d')]=isNaN(_0x13fdc7['bitRate'])?null:_0x13fdc7[_0xfcb0('0x69')];_0x48fc30[_0xfcb0('0x6e')]=isNaN(_0x13fdc7['sampleRate'])?null:_0x13fdc7[_0xfcb0('0x6a')];});_0x17522a['on'](_0xfcb0('0x1d'),function(){fs['chmodSync'](_0x1688a5,parseInt(_0xfcb0('0x6f'),0x8));return db[_0xfcb0('0x2f')]['create'](_0x48fc30)[_0xfcb0('0x27')](function(_0x3771dc){var _0x595b53={'role':_0xb2cb32['body']['role'],'userProfileId':_0xb2cb32[_0xfcb0('0x70')][_0xfcb0('0x71')]};if(!_0x595b53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x595b53[_0xfcb0('0x72')]===_0xfcb0('0x73')){var _0x4b557f=_0x3771dc[_0xfcb0('0x28')]({'plain':!![]});return db[_0xfcb0('0x74')][_0xfcb0('0x48')]({'where':{'name':'Sounds','userProfileId':_0x595b53[_0xfcb0('0x71')]},'raw':!![]})['then'](function(_0x572e35){if(_0x572e35&&_0x572e35['autoAssociation']===0x0){return db['UserProfileResource'][_0xfcb0('0x57')]({'name':_0x4b557f[_0xfcb0('0x2c')],'resourceId':_0x4b557f['id'],'type':_0x572e35[_0xfcb0('0x2c')],'sectionId':_0x572e35['id']},{})[_0xfcb0('0x27')](function(){return _0x3771dc;});}else{return _0x3771dc;}})['catch'](function(_0x389a8a){logger[_0xfcb0('0x60')](_0xfcb0('0x75'),_0x389a8a);throw _0x389a8a;});}return _0x3771dc;})['then'](respondWithResult(_0x520bf5,null))[_0xfcb0('0x56')](handleError(_0x520bf5,null));});_0x17522a[_0xfcb0('0x76')]();}catch(_0x525c63){_0x520bf5['status'](0x1f4)[_0xfcb0('0x2d')](_0x525c63);}};exports[_0xfcb0('0x26')]=function(_0xa25a17,_0x308e43,_0x21c8f6){return db['Sound'][_0xfcb0('0x48')]({'where':{'id':_0xa25a17[_0xfcb0('0x49')]['id']}})[_0xfcb0('0x27')](handleEntityNotFound(_0x308e43,null))['then'](saveUpdates(_[_0xfcb0('0x41')](_0xa25a17[_0xfcb0('0x70')],['name',_0xfcb0('0x77')]),null))['then'](respondWithResult(_0x308e43,null))[_0xfcb0('0x56')](handleError(_0x308e43,null));};exports['delete']=function(_0x542104,_0x272a35,_0x519219){return db['Sound'][_0xfcb0('0x48')]({'where':{'id':_0x542104['params']['id']}})['then'](function(_0x40f1ef){if(_0x40f1ef){return _0x40f1ef[_0xfcb0('0x78')]();}})[_0xfcb0('0x27')](function(_0x5e22f4){var _0xae5975=path[_0xfcb0('0x4c')](config[_0xfcb0('0x4d')],_0xfcb0('0x79'),util[_0xfcb0('0x54')](_0xfcb0('0x55'),_0x5e22f4[_0xfcb0('0x4a')],_0x5e22f4[_0xfcb0('0x7a')]));var _0x55f68d=path[_0xfcb0('0x4c')](config['root'],'server/files/sounds/converted',util[_0xfcb0('0x54')](_0xfcb0('0x55'),_0x5e22f4[_0xfcb0('0x4a')],_0x5e22f4[_0xfcb0('0x53')]));fs[_0xfcb0('0x61')](_0xae5975);fs[_0xfcb0('0x61')](_0x55f68d);return _0x5e22f4;})[_0xfcb0('0x27')](function(_0xc0f907){if(_0xc0f907){return _0x272a35[_0xfcb0('0x1c')](0xcc)[_0xfcb0('0x1d')]();}})[_0xfcb0('0x27')](handleEntityNotFound(_0x272a35,null))[_0xfcb0('0x56')](handleError(_0x272a35,null));}; \ No newline at end of file +var _0x8064=['then','get','UserProfileResource','destroy','end','error','stack','name','send','Sound','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','file','originalname','extname','filename','wav','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','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','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x8064,0x1e3));var _0x4806=function(_0x1672a6,_0x3b4253){_0x1672a6=_0x1672a6-0x0;var _0x25861c=_0x8064[_0x1672a6];return _0x25861c;};'use strict';var pdf=require(_0x4806('0x0'));var emlformat=require(_0x4806('0x1'));var rimraf=require(_0x4806('0x2'));var zipdir=require(_0x4806('0x3'));var jsonpatch=require(_0x4806('0x4'));var rp=require(_0x4806('0x5'));var moment=require(_0x4806('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4806('0x7'));var util=require('util');var path=require(_0x4806('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4806('0x9'));var fs=require('fs');var _=require(_0x4806('0xa'));var squel=require(_0x4806('0xb'));var crypto=require(_0x4806('0xc'));var jsforce=require(_0x4806('0xd'));var deskjs=require(_0x4806('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4806('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4806('0x10'));var qs=require(_0x4806('0x11'));var as=require(_0x4806('0x12'));var hardwareService=require(_0x4806('0x13'));var logger=require(_0x4806('0x14'))(_0x4806('0x15'));var utils=require(_0x4806('0x16'));var config=require(_0x4806('0x17'));var db=require(_0x4806('0x18'))['db'];function respondWithStatusCode(_0x587c73,_0x35e22c){_0x35e22c=_0x35e22c||0xcc;return function(_0x483f57){if(_0x483f57){return _0x587c73[_0x4806('0x19')](_0x35e22c);}return _0x587c73[_0x4806('0x1a')](_0x35e22c)['end']();};}function respondWithResult(_0x4cdd8f,_0x3aaf89){_0x3aaf89=_0x3aaf89||0xc8;return function(_0x1f48cd){if(_0x1f48cd){return _0x4cdd8f[_0x4806('0x1a')](_0x3aaf89)[_0x4806('0x1b')](_0x1f48cd);}};}function respondWithFilteredResult(_0x228c74,_0xb037e7){return function(_0x53ad26){if(_0x53ad26){var _0x5d5142=_0x53ad26[_0x4806('0x1c')],_0x245b70=_0xb037e7[_0x4806('0x1d')],_0x347313=_0xb037e7[_0x4806('0x1d')]+_0xb037e7[_0x4806('0x1e')],_0xd223e6;if(_0x347313>=_0x5d5142){_0x347313=_0x5d5142;_0xd223e6=0xc8;}else{_0xd223e6=0xce;}_0x228c74['status'](_0xd223e6);return _0x228c74[_0x4806('0x1f')](_0x4806('0x20'),_0x245b70+'-'+_0x347313+'/'+_0x5d5142)[_0x4806('0x1b')](_0x53ad26);}return null;};}function patchUpdates(_0x4566a9){return function(_0x3e24c5){try{jsonpatch[_0x4806('0x21')](_0x3e24c5,_0x4566a9,!![]);}catch(_0x49c03f){return BPromise[_0x4806('0x22')](_0x49c03f);}return _0x3e24c5[_0x4806('0x23')]();};}function saveUpdates(_0x94d513,_0x4f1f76){return function(_0xd18525){if(_0xd18525){return _0xd18525[_0x4806('0x24')](_0x94d513)[_0x4806('0x25')](function(_0x4d9c69){return _0x4d9c69;});}return null;};}function removeEntity(_0x5083f0,_0x28f913){return function(_0x5d82a6){if(_0x5d82a6){return _0x5d82a6['destroy']()['then'](function(){var _0x1d0e56=_0x5d82a6[_0x4806('0x26')]({'plain':!![]});var _0x135dde='Sounds';return db[_0x4806('0x27')][_0x4806('0x28')]({'where':{'type':_0x135dde,'resourceId':_0x1d0e56['id']}})[_0x4806('0x25')](function(){return _0x5d82a6;});})[_0x4806('0x25')](function(){_0x5083f0[_0x4806('0x1a')](0xcc)[_0x4806('0x29')]();});}};}function handleEntityNotFound(_0x509acf,_0x20591e){return function(_0x590d75){if(!_0x590d75){_0x509acf[_0x4806('0x19')](0x194);}return _0x590d75;};}function handleError(_0x5d0d7c,_0x305751){_0x305751=_0x305751||0x1f4;return function(_0x101e1c){logger[_0x4806('0x2a')](_0x101e1c[_0x4806('0x2b')]);if(_0x101e1c[_0x4806('0x2c')]){delete _0x101e1c[_0x4806('0x2c')];}_0x5d0d7c[_0x4806('0x1a')](_0x305751)[_0x4806('0x2d')](_0x101e1c);};}exports['index']=function(_0x2efd35,_0x2d76c3){var _0x258b4f={},_0x3b1490={},_0x27f033={'count':0x0,'rows':[]};var _0x56c85c=_['map'](db[_0x4806('0x2e')][_0x4806('0x2f')],function(_0x59df0e){return{'name':_0x59df0e[_0x4806('0x30')],'type':_0x59df0e[_0x4806('0x31')][_0x4806('0x32')]};});_0x3b1490[_0x4806('0x33')]=_[_0x4806('0x34')](_0x56c85c,_0x4806('0x2c'));_0x3b1490['query']=_['keys'](_0x2efd35[_0x4806('0x35')]);_0x3b1490['filters']=_[_0x4806('0x36')](_0x3b1490[_0x4806('0x33')],_0x3b1490[_0x4806('0x35')]);_0x258b4f[_0x4806('0x37')]=_[_0x4806('0x36')](_0x3b1490[_0x4806('0x33')],qs[_0x4806('0x38')](_0x2efd35[_0x4806('0x35')][_0x4806('0x38')]));_0x258b4f[_0x4806('0x37')]=_0x258b4f[_0x4806('0x37')][_0x4806('0x39')]?_0x258b4f[_0x4806('0x37')]:_0x3b1490[_0x4806('0x33')];if(!_0x2efd35[_0x4806('0x35')][_0x4806('0x3a')](_0x4806('0x3b'))){_0x258b4f[_0x4806('0x1e')]=qs[_0x4806('0x1e')](_0x2efd35[_0x4806('0x35')][_0x4806('0x1e')]);_0x258b4f[_0x4806('0x1d')]=qs[_0x4806('0x1d')](_0x2efd35[_0x4806('0x35')][_0x4806('0x1d')]);}_0x258b4f[_0x4806('0x3c')]=qs['sort'](_0x2efd35[_0x4806('0x35')][_0x4806('0x3d')]);_0x258b4f[_0x4806('0x3e')]=qs[_0x4806('0x3f')](_[_0x4806('0x40')](_0x2efd35['query'],_0x3b1490[_0x4806('0x3f')]),_0x56c85c);if(_0x2efd35[_0x4806('0x35')][_0x4806('0x41')]){_0x258b4f[_0x4806('0x3e')]=_[_0x4806('0x42')](_0x258b4f[_0x4806('0x3e')],{'$or':_[_0x4806('0x34')](_0x56c85c,function(_0x38c8a3){if(_0x38c8a3['type']!==_0x4806('0x43')){var _0x2722ad={};_0x2722ad[_0x38c8a3[_0x4806('0x2c')]]={'$like':'%'+_0x2efd35[_0x4806('0x35')][_0x4806('0x41')]+'%'};return _0x2722ad;}})});}_0x258b4f=_['merge']({},_0x258b4f,_0x2efd35[_0x4806('0x44')]);var _0x4cd350={'where':_0x258b4f['where']};return db[_0x4806('0x2e')][_0x4806('0x1c')](_0x4cd350)[_0x4806('0x25')](function(_0x27d198){_0x27f033[_0x4806('0x1c')]=_0x27d198;if(_0x2efd35['query'][_0x4806('0x45')]){_0x258b4f[_0x4806('0x46')]=[{'all':!![]}];}return db[_0x4806('0x2e')][_0x4806('0x47')](_0x258b4f);})[_0x4806('0x25')](function(_0x5e36de){_0x27f033[_0x4806('0x48')]=_0x5e36de;return _0x27f033;})[_0x4806('0x25')](respondWithFilteredResult(_0x2d76c3,_0x258b4f))[_0x4806('0x49')](handleError(_0x2d76c3,null));};exports[_0x4806('0x4a')]=function(_0x3e92aa,_0x210792){var _0x567a0d={'raw':!![],'where':{'id':_0x3e92aa[_0x4806('0x4b')]['id']}},_0x39dff6={};_0x39dff6[_0x4806('0x33')]=_['keys'](db[_0x4806('0x2e')][_0x4806('0x2f')]);_0x39dff6[_0x4806('0x35')]=_[_0x4806('0x4c')](_0x3e92aa['query']);_0x39dff6[_0x4806('0x3f')]=_[_0x4806('0x36')](_0x39dff6[_0x4806('0x33')],_0x39dff6['query']);_0x567a0d[_0x4806('0x37')]=_[_0x4806('0x36')](_0x39dff6[_0x4806('0x33')],qs[_0x4806('0x38')](_0x3e92aa[_0x4806('0x35')][_0x4806('0x38')]));_0x567a0d[_0x4806('0x37')]=_0x567a0d[_0x4806('0x37')][_0x4806('0x39')]?_0x567a0d[_0x4806('0x37')]:_0x39dff6[_0x4806('0x33')];if(_0x3e92aa[_0x4806('0x35')][_0x4806('0x45')]){_0x567a0d['include']=[{'all':!![]}];}_0x567a0d=_[_0x4806('0x42')]({},_0x567a0d,_0x3e92aa[_0x4806('0x44')]);return db[_0x4806('0x2e')][_0x4806('0x4d')](_0x567a0d)['then'](handleEntityNotFound(_0x210792,null))[_0x4806('0x25')](respondWithResult(_0x210792,null))[_0x4806('0x49')](handleError(_0x210792,null));};exports[_0x4806('0x4e')]=function(_0x17ecc2,_0x51aa3e,_0x58582f){return db[_0x4806('0x2e')][_0x4806('0x4d')]({'where':{'id':_0x17ecc2['params']['id']},'attributes':[_0x4806('0x2c'),_0x4806('0x4f'),_0x4806('0x50')],'raw':!![]})[_0x4806('0x25')](handleEntityNotFound(_0x51aa3e,null))[_0x4806('0x25')](function(_0x181772){if(_0x181772){if(!fs[_0x4806('0x51')](path['join'](config[_0x4806('0x52')],_0x4806('0x53'),_0x181772['save_name']+'.'+_0x181772['converted_format']))){throw new db[(_0x4806('0x54'))][(_0x4806('0x55'))](_0x4806('0x56'));}return _0x51aa3e[_0x4806('0x4e')](path[_0x4806('0x57')](config[_0x4806('0x52')],_0x4806('0x53'),util[_0x4806('0x58')]('%s.%s',_0x181772[_0x4806('0x4f')],_0x181772[_0x4806('0x50')])),util[_0x4806('0x58')](_0x4806('0x59'),_0x181772[_0x4806('0x2c')],_0x181772[_0x4806('0x50')]));}return null;})[_0x4806('0x49')](handleError(_0x51aa3e,null));};exports[_0x4806('0x5a')]=function(_0x538b14,_0x5cad7c,_0x424fae){var _0x319692={'name':path[_0x4806('0x5b')](_0x538b14[_0x4806('0x5c')][_0x4806('0x5d')],path[_0x4806('0x5e')](_0x538b14[_0x4806('0x5c')][_0x4806('0x5d')])),'save_name':path[_0x4806('0x5b')](_0x538b14['file']['filename'],path['extname'](_0x538b14[_0x4806('0x5c')][_0x4806('0x5f')])),'original_format':path[_0x4806('0x5e')](_0x538b14[_0x4806('0x5c')][_0x4806('0x5d')])['substring'](0x1),'converted_format':_0x4806('0x60')};var _0x4ea200=path[_0x4806('0x57')](config[_0x4806('0x52')],'server/files/sounds/original',_0x538b14[_0x4806('0x5c')][_0x4806('0x5f')]);var _0x5f2484=path['join'](config['root'],_0x4806('0x53'),util[_0x4806('0x58')](_0x4806('0x59'),path[_0x4806('0x5b')](_0x538b14[_0x4806('0x5c')]['filename'],path[_0x4806('0x5e')](_0x538b14[_0x4806('0x5c')][_0x4806('0x5f')])),_0x319692[_0x4806('0x50')]));logger['info'](_0x4806('0x61'),_0x4ea200);logger[_0x4806('0x62')](_0x4806('0x63'),_0x5f2484);try{fs[_0x4806('0x64')](_0x4ea200,parseInt(_0x4806('0x65'),0x8));var _0x4b7671=sox[_0x4806('0x66')](_0x4ea200,_0x5f2484,{'sampleRate':0x1f40,'format':_0x4806('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b7671['on'](_0x4806('0x2a'),function(_0x5db261){fs['unlinkSync'](_0x4ea200);_0x5cad7c[_0x4806('0x1a')](0x1f4)[_0x4806('0x2d')](_0x5db261);});_0x4b7671['on'](_0x4806('0x67'),function(_0x7796d5){_0x319692[_0x4806('0x68')]=isNaN(_0x7796d5[_0x4806('0x69')])?null:_0x7796d5[_0x4806('0x69')]*0x3e8;_0x319692[_0x4806('0x6a')]=isNaN(_0x7796d5[_0x4806('0x6b')])?null:_0x7796d5[_0x4806('0x6b')];_0x319692[_0x4806('0x6c')]=isNaN(_0x7796d5['channelCount'])?null:_0x7796d5[_0x4806('0x6d')];_0x319692[_0x4806('0x6e')]=isNaN(_0x7796d5[_0x4806('0x6f')])?null:_0x7796d5[_0x4806('0x6f')];_0x319692[_0x4806('0x70')]=isNaN(_0x7796d5['sampleRate'])?null:_0x7796d5[_0x4806('0x71')];});_0x4b7671['on'](_0x4806('0x72'),function(_0xcb9508){_0x319692[_0x4806('0x73')]=isNaN(_0xcb9508[_0x4806('0x69')])?null:_0xcb9508[_0x4806('0x69')]*0x3e8;_0x319692[_0x4806('0x74')]=isNaN(_0xcb9508[_0x4806('0x6b')])?null:_0xcb9508['sampleCount'];_0x319692[_0x4806('0x75')]=isNaN(_0xcb9508[_0x4806('0x6d')])?null:_0xcb9508[_0x4806('0x6d')];_0x319692['converted_bitRate']=isNaN(_0xcb9508['bitRate'])?null:_0xcb9508[_0x4806('0x6f')];_0x319692['converted_sampleRate']=isNaN(_0xcb9508[_0x4806('0x71')])?null:_0xcb9508['sampleRate'];});_0x4b7671['on']('end',function(){fs['chmodSync'](_0x5f2484,parseInt(_0x4806('0x65'),0x8));return db[_0x4806('0x2e')]['create'](_0x319692)[_0x4806('0x25')](function(_0xa5a55c){var _0x525088={'role':_0x538b14['body'][_0x4806('0x76')],'userProfileId':_0x538b14[_0x4806('0x77')][_0x4806('0x78')]};if(!_0x525088)throw new Error(_0x4806('0x79'));if(_0x525088[_0x4806('0x76')]==='user'){var _0x5e88c0=_0xa5a55c[_0x4806('0x26')]({'plain':!![]});return db[_0x4806('0x7a')]['find']({'where':{'name':_0x4806('0x7b'),'userProfileId':_0x525088[_0x4806('0x78')]},'raw':!![]})[_0x4806('0x25')](function(_0x46b931){if(_0x46b931&&_0x46b931[_0x4806('0x7c')]===0x0){return db[_0x4806('0x27')][_0x4806('0x5a')]({'name':_0x5e88c0[_0x4806('0x2c')],'resourceId':_0x5e88c0['id'],'type':_0x46b931[_0x4806('0x2c')],'sectionId':_0x46b931['id']},{})[_0x4806('0x25')](function(){return _0xa5a55c;});}else{return _0xa5a55c;}})[_0x4806('0x49')](function(_0x150e77){logger[_0x4806('0x2a')](_0x4806('0x7d'),_0x150e77);throw _0x150e77;});}return _0xa5a55c;})[_0x4806('0x25')](respondWithResult(_0x5cad7c,null))[_0x4806('0x49')](handleError(_0x5cad7c,null));});_0x4b7671[_0x4806('0x7e')]();}catch(_0x3a803a){_0x5cad7c[_0x4806('0x1a')](0x1f4)[_0x4806('0x2d')](_0x3a803a);}};exports[_0x4806('0x24')]=function(_0x3c69a9,_0x48f292,_0x4cbc0f){return db[_0x4806('0x2e')][_0x4806('0x4d')]({'where':{'id':_0x3c69a9[_0x4806('0x4b')]['id']}})[_0x4806('0x25')](handleEntityNotFound(_0x48f292,null))['then'](saveUpdates(_[_0x4806('0x40')](_0x3c69a9[_0x4806('0x77')],[_0x4806('0x2c'),_0x4806('0x7f')]),null))['then'](respondWithResult(_0x48f292,null))[_0x4806('0x49')](handleError(_0x48f292,null));};exports['delete']=function(_0x244f6e,_0x12198f,_0x3be248){return db[_0x4806('0x2e')]['find']({'where':{'id':_0x244f6e[_0x4806('0x4b')]['id']}})[_0x4806('0x25')](function(_0x4ac45a){if(_0x4ac45a){return _0x4ac45a[_0x4806('0x28')]();}})[_0x4806('0x25')](function(_0x8df8ea){var _0x5552a4=path['join'](config[_0x4806('0x52')],_0x4806('0x80'),util[_0x4806('0x58')](_0x4806('0x59'),_0x8df8ea[_0x4806('0x4f')],_0x8df8ea[_0x4806('0x81')]));var _0x111b12=path[_0x4806('0x57')](config['root'],_0x4806('0x53'),util[_0x4806('0x58')](_0x4806('0x59'),_0x8df8ea[_0x4806('0x4f')],_0x8df8ea['converted_format']));fs['unlinkSync'](_0x5552a4);fs['unlinkSync'](_0x111b12);return _0x8df8ea;})[_0x4806('0x25')](function(_0x31d075){if(_0x31d075){return _0x12198f[_0x4806('0x1a')](0xcc)[_0x4806('0x29')]();}})['then'](handleEntityNotFound(_0x12198f,null))[_0x4806('0x49')](handleError(_0x12198f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 79cd998..28f7d96 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 _0x55da=['../../config/logger','moment','request-promise','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55da,0xe2));var _0xa55d=function(_0x27b1aa,_0x298ee9){_0x27b1aa=_0x27b1aa-0x0;var _0xa0883c=_0x55da[_0x27b1aa];return _0xa0883c;};'use strict';var _=require(_0xa55d('0x0'));var util=require(_0xa55d('0x1'));var logger=require(_0xa55d('0x2'))('api');var moment=require(_0xa55d('0x3'));var BPromise=require('bluebird');var rp=require(_0xa55d('0x4'));var fs=require('fs');var path=require(_0xa55d('0x5'));var rimraf=require(_0xa55d('0x6'));var config=require('../../config/environment');var attributes=require(_0xa55d('0x7'));module[_0xa55d('0x8')]=function(_0x139249,_0x37a213){return _0x139249[_0xa55d('0x9')](_0xa55d('0xa'),attributes,{'tableName':_0xa55d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f7d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x29d5fe,_0x327c8d){var _0xde5362=function(_0x5a61f4){while(--_0x5a61f4){_0x29d5fe['push'](_0x29d5fe['shift']());}};_0xde5362(++_0x327c8d);}(_0x7f7d,0x8f));var _0xd7f7=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x7f7d[_0x30faec];return _0x29484f;};'use strict';var _=require(_0xd7f7('0x0'));var util=require(_0xd7f7('0x1'));var logger=require(_0xd7f7('0x2'))(_0xd7f7('0x3'));var moment=require(_0xd7f7('0x4'));var BPromise=require(_0xd7f7('0x5'));var rp=require(_0xd7f7('0x6'));var fs=require('fs');var path=require(_0xd7f7('0x7'));var rimraf=require(_0xd7f7('0x8'));var config=require(_0xd7f7('0x9'));var attributes=require(_0xd7f7('0xa'));module[_0xd7f7('0xb')]=function(_0x55ed8b,_0x215545){return _0x55ed8b[_0xd7f7('0xc')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index f5e263a..0fa927d 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 _0xb565=['rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3fd3b3,_0x42a531){var _0x40a10f=function(_0x5e6904){while(--_0x5e6904){_0x3fd3b3['push'](_0x3fd3b3['shift']());}};_0x40a10f(++_0x42a531);}(_0xb565,0x14f));var _0x5b56=function(_0x3c66e5,_0xab5ea3){_0x3c66e5=_0x3c66e5-0x0;var _0x678a=_0xb565[_0x3c66e5];return _0x678a;};'use strict';var _=require('lodash');var util=require(_0x5b56('0x0'));var moment=require(_0x5b56('0x1'));var BPromise=require(_0x5b56('0x2'));var rs=require(_0x5b56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b56('0x4'))['db'];var utils=require(_0x5b56('0x5'));var logger=require('../../config/logger')(_0x5b56('0x6'));var config=require(_0x5b56('0x7'));var jayson=require(_0x5b56('0x8'));var client=jayson[_0x5b56('0x9')][_0x5b56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30978e,_0x332068,_0x30433e){return new BPromise(function(_0x5ade71,_0x9f310c){return client[_0x5b56('0xb')](_0x30978e,_0x30433e)[_0x5b56('0xc')](function(_0x1d40c8){logger['info'](_0x5b56('0xd'),_0x332068,_0x5b56('0xe'));logger['debug'](_0x5b56('0xf'),_0x332068,_0x5b56('0xe'),JSON['stringify'](_0x1d40c8));if(_0x1d40c8[_0x5b56('0x10')]){if(_0x1d40c8[_0x5b56('0x10')][_0x5b56('0x11')]===0x1f4){logger[_0x5b56('0x10')](_0x5b56('0xd'),_0x332068,_0x1d40c8[_0x5b56('0x10')][_0x5b56('0x12')]);return _0x9f310c(_0x1d40c8[_0x5b56('0x10')][_0x5b56('0x12')]);}logger[_0x5b56('0x10')](_0x5b56('0xd'),_0x332068,_0x1d40c8['error'][_0x5b56('0x12')]);return _0x5ade71(_0x1d40c8[_0x5b56('0x10')][_0x5b56('0x12')]);}else{logger[_0x5b56('0x13')](_0x5b56('0xd'),_0x332068,_0x5b56('0xe'));_0x5ade71(_0x1d40c8['result'][_0x5b56('0x12')]);}})[_0x5b56('0x14')](function(_0x3142c8){logger[_0x5b56('0x10')](_0x5b56('0xd'),_0x332068,_0x3142c8);_0x9f310c(_0x3142c8);});});}exports[_0x5b56('0x15')]=function(_0x177698){var _0x294124=this;return new Promise(function(_0x8f3024,_0x16e6e4){return db[_0x5b56('0x16')][_0x5b56('0x17')]({'raw':_0x177698[_0x5b56('0x18')]?_0x177698['options'][_0x5b56('0x19')]===undefined?!![]:![]:!![],'where':_0x177698[_0x5b56('0x18')]?_0x177698[_0x5b56('0x18')][_0x5b56('0x1a')]||null:null,'attributes':_0x177698[_0x5b56('0x18')]?_0x177698[_0x5b56('0x18')][_0x5b56('0x1b')]||null:null,'include':_0x177698['options']?_0x177698[_0x5b56('0x18')][_0x5b56('0x1c')]?_[_0x5b56('0x1d')](_0x177698[_0x5b56('0x18')]['include'],function(_0x2a2285){return{'model':db[_0x2a2285[_0x5b56('0x1e')]],'as':_0x2a2285['as'],'attributes':_0x2a2285['attributes'],'include':_0x2a2285[_0x5b56('0x1c')]?_[_0x5b56('0x1d')](_0x2a2285['include'],function(_0x556da3){return{'model':db[_0x556da3[_0x5b56('0x1e')]],'as':_0x556da3['as'],'attributes':_0x556da3[_0x5b56('0x1b')],'include':_0x556da3[_0x5b56('0x1c')]?_[_0x5b56('0x1d')](_0x556da3['include'],function(_0x25e139){return{'model':db[_0x25e139[_0x5b56('0x1e')]],'as':_0x25e139['as'],'attributes':_0x25e139[_0x5b56('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b56('0xc')](function(_0x5366b4){logger[_0x5b56('0x13')](_0x5b56('0x15'),_0x177698);logger['debug'](_0x5b56('0x15'),_0x177698,JSON['stringify'](_0x5366b4));_0x8f3024(_0x5366b4);})[_0x5b56('0x14')](function(_0x2f6e08){logger[_0x5b56('0x10')](_0x5b56('0x15'),_0x2f6e08[_0x5b56('0x12')],_0x177698);_0x16e6e4(_0x294124[_0x5b56('0x10')](0x1f4,_0x2f6e08[_0x5b56('0x12')]));});});}; \ No newline at end of file +var _0xe3cf=['Sound','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Sound,\x20%s,\x20%s','catch','ShowSound'];(function(_0x4bb056,_0x2ba43b){var _0x4812a7=function(_0x3a19cc){while(--_0x3a19cc){_0x4bb056['push'](_0x4bb056['shift']());}};_0x4812a7(++_0x2ba43b);}(_0xe3cf,0x78));var _0xfe3c=function(_0x3509e9,_0x1d202b){_0x3509e9=_0x3509e9-0x0;var _0x4f884e=_0xe3cf[_0x3509e9];return _0x4f884e;};'use strict';var _=require(_0xfe3c('0x0'));var util=require('util');var moment=require(_0xfe3c('0x1'));var BPromise=require(_0xfe3c('0x2'));var rs=require(_0xfe3c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe3c('0x4'));var logger=require(_0xfe3c('0x5'))('rpc');var config=require(_0xfe3c('0x6'));var jayson=require(_0xfe3c('0x7'));var client=jayson['client'][_0xfe3c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bc4df,_0x5b13e8,_0x558419){return new BPromise(function(_0x17934d,_0x2c039f){return client[_0xfe3c('0x9')](_0x5bc4df,_0x558419)[_0xfe3c('0xa')](function(_0x567558){logger[_0xfe3c('0xb')]('Sound,\x20%s,\x20%s',_0x5b13e8,'request\x20sent');logger[_0xfe3c('0xc')](_0xfe3c('0xd'),_0x5b13e8,_0xfe3c('0xe'),JSON['stringify'](_0x567558));if(_0x567558[_0xfe3c('0xf')]){if(_0x567558[_0xfe3c('0xf')]['code']===0x1f4){logger[_0xfe3c('0xf')]('Sound,\x20%s,\x20%s',_0x5b13e8,_0x567558[_0xfe3c('0xf')][_0xfe3c('0x10')]);return _0x2c039f(_0x567558[_0xfe3c('0xf')][_0xfe3c('0x10')]);}logger[_0xfe3c('0xf')](_0xfe3c('0x11'),_0x5b13e8,_0x567558[_0xfe3c('0xf')][_0xfe3c('0x10')]);return _0x17934d(_0x567558[_0xfe3c('0xf')][_0xfe3c('0x10')]);}else{logger[_0xfe3c('0xb')]('Sound,\x20%s,\x20%s',_0x5b13e8,'request\x20sent');_0x17934d(_0x567558['result'][_0xfe3c('0x10')]);}})[_0xfe3c('0x12')](function(_0x51d0f9){logger[_0xfe3c('0xf')](_0xfe3c('0x11'),_0x5b13e8,_0x51d0f9);_0x2c039f(_0x51d0f9);});});}exports[_0xfe3c('0x13')]=function(_0x4e6699){var _0x469e66=this;return new Promise(function(_0x566165,_0x2e10b5){return db[_0xfe3c('0x14')]['find']({'raw':_0x4e6699[_0xfe3c('0x15')]?_0x4e6699[_0xfe3c('0x15')][_0xfe3c('0x16')]===undefined?!![]:![]:!![],'where':_0x4e6699[_0xfe3c('0x15')]?_0x4e6699[_0xfe3c('0x15')][_0xfe3c('0x17')]||null:null,'attributes':_0x4e6699[_0xfe3c('0x15')]?_0x4e6699['options'][_0xfe3c('0x18')]||null:null,'include':_0x4e6699['options']?_0x4e6699[_0xfe3c('0x15')][_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x4e6699[_0xfe3c('0x15')][_0xfe3c('0x19')],function(_0x4b9d70){return{'model':db[_0x4b9d70[_0xfe3c('0x1b')]],'as':_0x4b9d70['as'],'attributes':_0x4b9d70[_0xfe3c('0x18')],'include':_0x4b9d70[_0xfe3c('0x19')]?_['map'](_0x4b9d70[_0xfe3c('0x19')],function(_0x2c33fd){return{'model':db[_0x2c33fd[_0xfe3c('0x1b')]],'as':_0x2c33fd['as'],'attributes':_0x2c33fd[_0xfe3c('0x18')],'include':_0x2c33fd[_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x2c33fd[_0xfe3c('0x19')],function(_0x4acf45){return{'model':db[_0x4acf45[_0xfe3c('0x1b')]],'as':_0x4acf45['as'],'attributes':_0x4acf45[_0xfe3c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x513b68){logger[_0xfe3c('0xb')](_0xfe3c('0x13'),_0x4e6699);logger[_0xfe3c('0xc')](_0xfe3c('0x13'),_0x4e6699,JSON['stringify'](_0x513b68));_0x566165(_0x513b68);})[_0xfe3c('0x12')](function(_0x92bed1){logger[_0xfe3c('0xf')](_0xfe3c('0x13'),_0x92bed1[_0xfe3c('0x10')],_0x4e6699);_0x2e10b5(_0x469e66[_0xfe3c('0xf')](0x1f4,_0x92bed1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b61b746..e827c46 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 _0x09d0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x197bf2,_0x15e8e2){var _0x194564=function(_0x1ffd54){while(--_0x1ffd54){_0x197bf2['push'](_0x197bf2['shift']());}};_0x194564(++_0x15e8e2);}(_0x09d0,0x106));var _0x009d=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x09d0[_0x120bc2];return _0x454a41;};'use strict';var multer=require(_0x009d('0x0'));var util=require(_0x009d('0x1'));var path=require(_0x009d('0x2'));var timeout=require(_0x009d('0x3'));var express=require(_0x009d('0x4'));var router=express[_0x009d('0x5')]();var auth=require(_0x009d('0x6'));var interaction=require(_0x009d('0x7'));var config=require(_0x009d('0x8'));var controller=require(_0x009d('0x9'));router[_0x009d('0xa')]('/',auth[_0x009d('0xb')](),controller[_0x009d('0xc')]);router[_0x009d('0xa')](_0x009d('0xd'),auth[_0x009d('0xb')](),controller[_0x009d('0xe')]);router[_0x009d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x009d('0x10')](_0x009d('0xd'),auth[_0x009d('0xb')](),controller[_0x009d('0x11')]);router['delete'](_0x009d('0xd'),auth[_0x009d('0xb')](),controller[_0x009d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0744=['update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x31e71b,_0x367441){var _0x14ce9e=function(_0x25dbd3){while(--_0x25dbd3){_0x31e71b['push'](_0x31e71b['shift']());}};_0x14ce9e(++_0x367441);}(_0x0744,0xa3));var _0x4074=function(_0x37a0ab,_0x34b900){_0x37a0ab=_0x37a0ab-0x0;var _0x13ca1d=_0x0744[_0x37a0ab];return _0x13ca1d;};'use strict';var multer=require('multer');var util=require(_0x4074('0x0'));var path=require('path');var timeout=require(_0x4074('0x1'));var express=require(_0x4074('0x2'));var router=express[_0x4074('0x3')]();var auth=require(_0x4074('0x4'));var interaction=require(_0x4074('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0x4074('0x6')]('/',auth[_0x4074('0x7')](),controller[_0x4074('0x8')]);router[_0x4074('0x6')](_0x4074('0x9'),auth[_0x4074('0x7')](),controller[_0x4074('0xa')]);router[_0x4074('0xb')]('/',auth[_0x4074('0x7')](),controller['create']);router[_0x4074('0xc')](_0x4074('0x9'),auth[_0x4074('0x7')](),controller[_0x4074('0xd')]);router['delete'](_0x4074('0x9'),auth[_0x4074('0x7')](),controller[_0x4074('0xe')]);module[_0x4074('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b6c0dea..bab9819 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 _0x4d17=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x58909b,_0x519a32){var _0x4af7b7=function(_0x171a36){while(--_0x171a36){_0x58909b['push'](_0x58909b['shift']());}};_0x4af7b7(++_0x519a32);}(_0x4d17,0x9c));var _0x74d1=function(_0x22df4d,_0xa4790a){_0x22df4d=_0x22df4d-0x0;var _0x6a2020=_0x4d17[_0x22df4d];return _0x6a2020;};'use strict';var Sequelize=require(_0x74d1('0x0'));module[_0x74d1('0x1')]={'uniqueid':{'type':Sequelize[_0x74d1('0x2')]},'body':{'type':Sequelize[_0x74d1('0x3')](_0x74d1('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x74d1('0x5')]('in',_0x74d1('0x6')),'defaultValue':_0x74d1('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xe259=['TEXT','medium','out','exports','STRING'];(function(_0x286064,_0x3ef626){var _0x373838=function(_0x3fd437){while(--_0x3fd437){_0x286064['push'](_0x286064['shift']());}};_0x373838(++_0x3ef626);}(_0xe259,0xad));var _0x9e25=function(_0xbd529b,_0x24bdd4){_0xbd529b=_0xbd529b-0x0;var _0x59b5d4=_0xe259[_0xbd529b];return _0x59b5d4;};'use strict';var Sequelize=require('sequelize');module[_0x9e25('0x0')]={'uniqueid':{'type':Sequelize[_0x9e25('0x1')]},'body':{'type':Sequelize[_0x9e25('0x2')](_0x9e25('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9e25('0x4')),'defaultValue':_0x9e25('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 924d174..3762bbb 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 _0x1cca=['sort','where','pick','filter','VIRTUAL','merge','options','count','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order'];(function(_0x4cd322,_0x37c06e){var _0x4615f7=function(_0x28b4a6){while(--_0x28b4a6){_0x4cd322['push'](_0x4cd322['shift']());}};_0x4615f7(++_0x37c06e);}(_0x1cca,0x1bf));var _0xa1cc=function(_0x13211c,_0x5e05a9){_0x13211c=_0x13211c-0x0;var _0x485ef8=_0x1cca[_0x13211c];return _0x485ef8;};'use strict';var pdf=require(_0xa1cc('0x0'));var emlformat=require(_0xa1cc('0x1'));var rimraf=require(_0xa1cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1cc('0x4'));var util=require(_0xa1cc('0x5'));var path=require(_0xa1cc('0x6'));var sox=require(_0xa1cc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa1cc('0x8'));var crypto=require(_0xa1cc('0x9'));var jsforce=require(_0xa1cc('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa1cc('0xb'));var Papa=require(_0xa1cc('0xc'));var Redis=require(_0xa1cc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa1cc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa1cc('0xf'));var utils=require(_0xa1cc('0x10'));var config=require(_0xa1cc('0x11'));var db=require(_0xa1cc('0x12'))['db'];function respondWithStatusCode(_0x54a46f,_0x54e2d4){_0x54e2d4=_0x54e2d4||0xcc;return function(_0x5b211b){if(_0x5b211b){return _0x54a46f[_0xa1cc('0x13')](_0x54e2d4);}return _0x54a46f[_0xa1cc('0x14')](_0x54e2d4)[_0xa1cc('0x15')]();};}function respondWithResult(_0x11b74a,_0x3d5578){_0x3d5578=_0x3d5578||0xc8;return function(_0x84aea4){if(_0x84aea4){return _0x11b74a[_0xa1cc('0x14')](_0x3d5578)[_0xa1cc('0x16')](_0x84aea4);}};}function respondWithFilteredResult(_0x3a8ad2,_0x4991c7){return function(_0x557a46){if(_0x557a46){var _0x46b857=_0x557a46['count'],_0x33ddf3=_0x4991c7[_0xa1cc('0x17')],_0x4afdd7=_0x4991c7[_0xa1cc('0x17')]+_0x4991c7['limit'],_0xd7b328;if(_0x4afdd7>=_0x46b857){_0x4afdd7=_0x46b857;_0xd7b328=0xc8;}else{_0xd7b328=0xce;}_0x3a8ad2[_0xa1cc('0x14')](_0xd7b328);return _0x3a8ad2[_0xa1cc('0x18')](_0xa1cc('0x19'),_0x33ddf3+'-'+_0x4afdd7+'/'+_0x46b857)['json'](_0x557a46);}return null;};}function patchUpdates(_0x37275d){return function(_0x3678fb){try{jsonpatch[_0xa1cc('0x1a')](_0x3678fb,_0x37275d,!![]);}catch(_0x337b20){return BPromise['reject'](_0x337b20);}return _0x3678fb[_0xa1cc('0x1b')]();};}function saveUpdates(_0x51e5c9,_0x28fbf4){return function(_0x591009){if(_0x591009){return _0x591009[_0xa1cc('0x1c')](_0x51e5c9)['then'](function(_0x18ac07){return _0x18ac07;});}return null;};}function removeEntity(_0x5d7c20,_0x4bad45){return function(_0x7056cd){if(_0x7056cd){return _0x7056cd[_0xa1cc('0x1d')]()['then'](function(){_0x5d7c20[_0xa1cc('0x14')](0xcc)[_0xa1cc('0x15')]();});}};}function handleEntityNotFound(_0x487e53,_0x43c02a){return function(_0x154a34){if(!_0x154a34){_0x487e53[_0xa1cc('0x13')](0x194);}return _0x154a34;};}function handleError(_0x122ab6,_0x1905fd){_0x1905fd=_0x1905fd||0x1f4;return function(_0x139aaa){logger[_0xa1cc('0x1e')](_0x139aaa[_0xa1cc('0x1f')]);if(_0x139aaa[_0xa1cc('0x20')]){delete _0x139aaa[_0xa1cc('0x20')];}_0x122ab6[_0xa1cc('0x14')](_0x1905fd)[_0xa1cc('0x21')](_0x139aaa);};}exports[_0xa1cc('0x22')]=function(_0x317b88,_0x45a651){var _0x13ad60={},_0x15cfca={},_0x34ae0b={'count':0x0,'rows':[]};var _0x87b01e=_[_0xa1cc('0x23')](db[_0xa1cc('0x24')]['rawAttributes'],function(_0x32353a){return{'name':_0x32353a[_0xa1cc('0x25')],'type':_0x32353a[_0xa1cc('0x26')][_0xa1cc('0x27')]};});_0x15cfca[_0xa1cc('0x28')]=_[_0xa1cc('0x23')](_0x87b01e,_0xa1cc('0x20'));_0x15cfca[_0xa1cc('0x29')]=_['keys'](_0x317b88[_0xa1cc('0x29')]);_0x15cfca[_0xa1cc('0x2a')]=_['intersection'](_0x15cfca[_0xa1cc('0x28')],_0x15cfca[_0xa1cc('0x29')]);_0x13ad60[_0xa1cc('0x2b')]=_[_0xa1cc('0x2c')](_0x15cfca[_0xa1cc('0x28')],qs[_0xa1cc('0x2d')](_0x317b88['query']['fields']));_0x13ad60[_0xa1cc('0x2b')]=_0x13ad60[_0xa1cc('0x2b')][_0xa1cc('0x2e')]?_0x13ad60['attributes']:_0x15cfca[_0xa1cc('0x28')];if(!_0x317b88[_0xa1cc('0x29')]['hasOwnProperty'](_0xa1cc('0x2f'))){_0x13ad60[_0xa1cc('0x30')]=qs[_0xa1cc('0x30')](_0x317b88[_0xa1cc('0x29')]['limit']);_0x13ad60[_0xa1cc('0x17')]=qs[_0xa1cc('0x17')](_0x317b88[_0xa1cc('0x29')][_0xa1cc('0x17')]);}_0x13ad60[_0xa1cc('0x31')]=qs[_0xa1cc('0x32')](_0x317b88[_0xa1cc('0x29')][_0xa1cc('0x32')]);_0x13ad60[_0xa1cc('0x33')]=qs[_0xa1cc('0x2a')](_[_0xa1cc('0x34')](_0x317b88['query'],_0x15cfca['filters']),_0x87b01e);if(_0x317b88[_0xa1cc('0x29')][_0xa1cc('0x35')]){_0x13ad60[_0xa1cc('0x33')]=_['merge'](_0x13ad60[_0xa1cc('0x33')],{'$or':_[_0xa1cc('0x23')](_0x87b01e,function(_0xc5570e){if(_0xc5570e[_0xa1cc('0x26')]!==_0xa1cc('0x36')){var _0x258eef={};_0x258eef[_0xc5570e[_0xa1cc('0x20')]]={'$like':'%'+_0x317b88[_0xa1cc('0x29')][_0xa1cc('0x35')]+'%'};return _0x258eef;}})});}_0x13ad60=_[_0xa1cc('0x37')]({},_0x13ad60,_0x317b88[_0xa1cc('0x38')]);var _0x13bd2b={'where':_0x13ad60[_0xa1cc('0x33')]};return db[_0xa1cc('0x24')][_0xa1cc('0x39')](_0x13bd2b)[_0xa1cc('0x3a')](function(_0x3c55ef){_0x34ae0b[_0xa1cc('0x39')]=_0x3c55ef;if(_0x317b88[_0xa1cc('0x29')][_0xa1cc('0x3b')]){_0x13ad60[_0xa1cc('0x3c')]=[{'all':!![]}];}return db[_0xa1cc('0x24')][_0xa1cc('0x3d')](_0x13ad60);})[_0xa1cc('0x3a')](function(_0x377599){_0x34ae0b[_0xa1cc('0x3e')]=_0x377599;return _0x34ae0b;})[_0xa1cc('0x3a')](respondWithFilteredResult(_0x45a651,_0x13ad60))[_0xa1cc('0x3f')](handleError(_0x45a651,null));};exports[_0xa1cc('0x40')]=function(_0x9d9fc,_0x53368a){var _0x283330={'raw':!![],'where':{'id':_0x9d9fc[_0xa1cc('0x41')]['id']}},_0x2eeecc={};_0x2eeecc[_0xa1cc('0x28')]=_[_0xa1cc('0x42')](db[_0xa1cc('0x24')][_0xa1cc('0x43')]);_0x2eeecc[_0xa1cc('0x29')]=_[_0xa1cc('0x42')](_0x9d9fc[_0xa1cc('0x29')]);_0x2eeecc[_0xa1cc('0x2a')]=_[_0xa1cc('0x2c')](_0x2eeecc[_0xa1cc('0x28')],_0x2eeecc[_0xa1cc('0x29')]);_0x283330[_0xa1cc('0x2b')]=_[_0xa1cc('0x2c')](_0x2eeecc[_0xa1cc('0x28')],qs[_0xa1cc('0x2d')](_0x9d9fc[_0xa1cc('0x29')][_0xa1cc('0x2d')]));_0x283330[_0xa1cc('0x2b')]=_0x283330[_0xa1cc('0x2b')][_0xa1cc('0x2e')]?_0x283330[_0xa1cc('0x2b')]:_0x2eeecc[_0xa1cc('0x28')];if(_0x9d9fc[_0xa1cc('0x29')][_0xa1cc('0x3b')]){_0x283330[_0xa1cc('0x3c')]=[{'all':!![]}];}_0x283330=_[_0xa1cc('0x37')]({},_0x283330,_0x9d9fc[_0xa1cc('0x38')]);return db[_0xa1cc('0x24')]['find'](_0x283330)[_0xa1cc('0x3a')](handleEntityNotFound(_0x53368a,null))[_0xa1cc('0x3a')](respondWithResult(_0x53368a,null))[_0xa1cc('0x3f')](handleError(_0x53368a,null));};exports[_0xa1cc('0x44')]=function(_0x4824cd,_0x55a657){return db[_0xa1cc('0x24')][_0xa1cc('0x44')](_0x4824cd[_0xa1cc('0x45')],{})[_0xa1cc('0x3a')](respondWithResult(_0x55a657,0xc9))['catch'](handleError(_0x55a657,null));};exports['update']=function(_0x23a60d,_0x3112a4){if(_0x23a60d['body']['id']){delete _0x23a60d['body']['id'];}return db['SquareMessage'][_0xa1cc('0x46')]({'where':{'id':_0x23a60d[_0xa1cc('0x41')]['id']}})['then'](handleEntityNotFound(_0x3112a4,null))[_0xa1cc('0x3a')](saveUpdates(_0x23a60d[_0xa1cc('0x45')],null))[_0xa1cc('0x3a')](respondWithResult(_0x3112a4,null))[_0xa1cc('0x3f')](handleError(_0x3112a4,null));};exports[_0xa1cc('0x1d')]=function(_0x5a220f,_0x6cd30e){return db[_0xa1cc('0x24')][_0xa1cc('0x46')]({'where':{'id':_0x5a220f['params']['id']}})[_0xa1cc('0x3a')](handleEntityNotFound(_0x6cd30e,null))[_0xa1cc('0x3a')](removeEntity(_0x6cd30e,null))[_0xa1cc('0x3f')](handleError(_0x6cd30e,null));}; \ No newline at end of file +var _0x1937=['length','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params'];(function(_0x5c6aae,_0x4f8d76){var _0x57c39c=function(_0x1fa114){while(--_0x1fa114){_0x5c6aae['push'](_0x5c6aae['shift']());}};_0x57c39c(++_0x4f8d76);}(_0x1937,0x96));var _0x7193=function(_0x58a213,_0x5abc0e){_0x58a213=_0x58a213-0x0;var _0xcb1c8b=_0x1937[_0x58a213];return _0xcb1c8b;};'use strict';var pdf=require(_0x7193('0x0'));var emlformat=require(_0x7193('0x1'));var rimraf=require(_0x7193('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7193('0x3'));var rp=require(_0x7193('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7193('0x5'));var util=require(_0x7193('0x6'));var path=require('path');var sox=require(_0x7193('0x7'));var csv=require(_0x7193('0x8'));var ejs=require(_0x7193('0x9'));var fs=require('fs');var _=require(_0x7193('0xa'));var squel=require(_0x7193('0xb'));var crypto=require(_0x7193('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7193('0xd'));var toCsv=require(_0x7193('0x8'));var querystring=require(_0x7193('0xe'));var Papa=require(_0x7193('0xf'));var Redis=require(_0x7193('0x10'));var authService=require(_0x7193('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7193('0x12'));var hardwareService=require(_0x7193('0x13'));var logger=require(_0x7193('0x14'))('api');var utils=require(_0x7193('0x15'));var config=require('../../config/environment');var db=require(_0x7193('0x16'))['db'];function respondWithStatusCode(_0x5a0949,_0x15af79){_0x15af79=_0x15af79||0xcc;return function(_0x53d73e){if(_0x53d73e){return _0x5a0949[_0x7193('0x17')](_0x15af79);}return _0x5a0949['status'](_0x15af79)['end']();};}function respondWithResult(_0x49068e,_0x5bf86e){_0x5bf86e=_0x5bf86e||0xc8;return function(_0x55c5f2){if(_0x55c5f2){return _0x49068e[_0x7193('0x18')](_0x5bf86e)[_0x7193('0x19')](_0x55c5f2);}};}function respondWithFilteredResult(_0x472fc1,_0x3bc9ab){return function(_0x41afc0){if(_0x41afc0){var _0x428494=_0x41afc0[_0x7193('0x1a')],_0xbfc1e2=_0x3bc9ab[_0x7193('0x1b')],_0x4bc79f=_0x3bc9ab[_0x7193('0x1b')]+_0x3bc9ab[_0x7193('0x1c')],_0x52d5bb;if(_0x4bc79f>=_0x428494){_0x4bc79f=_0x428494;_0x52d5bb=0xc8;}else{_0x52d5bb=0xce;}_0x472fc1[_0x7193('0x18')](_0x52d5bb);return _0x472fc1[_0x7193('0x1d')](_0x7193('0x1e'),_0xbfc1e2+'-'+_0x4bc79f+'/'+_0x428494)[_0x7193('0x19')](_0x41afc0);}return null;};}function patchUpdates(_0x2f1da2){return function(_0x1e2e55){try{jsonpatch[_0x7193('0x1f')](_0x1e2e55,_0x2f1da2,!![]);}catch(_0x266ac7){return BPromise['reject'](_0x266ac7);}return _0x1e2e55[_0x7193('0x20')]();};}function saveUpdates(_0x1d3264,_0x5c8232){return function(_0x14faef){if(_0x14faef){return _0x14faef[_0x7193('0x21')](_0x1d3264)[_0x7193('0x22')](function(_0x9ff71){return _0x9ff71;});}return null;};}function removeEntity(_0x194311,_0x5e29d3){return function(_0x345f89){if(_0x345f89){return _0x345f89[_0x7193('0x23')]()[_0x7193('0x22')](function(){_0x194311['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a488,_0x14e4a3){return function(_0x2e94f8){if(!_0x2e94f8){_0x41a488[_0x7193('0x17')](0x194);}return _0x2e94f8;};}function handleError(_0x385caa,_0x250447){_0x250447=_0x250447||0x1f4;return function(_0x28118c){logger[_0x7193('0x24')](_0x28118c[_0x7193('0x25')]);if(_0x28118c[_0x7193('0x26')]){delete _0x28118c[_0x7193('0x26')];}_0x385caa['status'](_0x250447)[_0x7193('0x27')](_0x28118c);};}exports[_0x7193('0x28')]=function(_0x409ec3,_0x3951ec){var _0x3c2e48={},_0x408fb5={},_0x322e38={'count':0x0,'rows':[]};var _0x4face4=_[_0x7193('0x29')](db['SquareMessage'][_0x7193('0x2a')],function(_0xfb1707){return{'name':_0xfb1707[_0x7193('0x2b')],'type':_0xfb1707[_0x7193('0x2c')][_0x7193('0x2d')]};});_0x408fb5['model']=_[_0x7193('0x29')](_0x4face4,_0x7193('0x26'));_0x408fb5[_0x7193('0x2e')]=_[_0x7193('0x2f')](_0x409ec3['query']);_0x408fb5[_0x7193('0x30')]=_[_0x7193('0x31')](_0x408fb5[_0x7193('0x32')],_0x408fb5[_0x7193('0x2e')]);_0x3c2e48[_0x7193('0x33')]=_['intersection'](_0x408fb5['model'],qs[_0x7193('0x34')](_0x409ec3['query']['fields']));_0x3c2e48[_0x7193('0x33')]=_0x3c2e48[_0x7193('0x33')]['length']?_0x3c2e48[_0x7193('0x33')]:_0x408fb5['model'];if(!_0x409ec3['query'][_0x7193('0x35')]('nolimit')){_0x3c2e48['limit']=qs['limit'](_0x409ec3[_0x7193('0x2e')][_0x7193('0x1c')]);_0x3c2e48[_0x7193('0x1b')]=qs['offset'](_0x409ec3[_0x7193('0x2e')]['offset']);}_0x3c2e48['order']=qs[_0x7193('0x36')](_0x409ec3[_0x7193('0x2e')][_0x7193('0x36')]);_0x3c2e48[_0x7193('0x37')]=qs[_0x7193('0x30')](_[_0x7193('0x38')](_0x409ec3[_0x7193('0x2e')],_0x408fb5[_0x7193('0x30')]),_0x4face4);if(_0x409ec3[_0x7193('0x2e')][_0x7193('0x39')]){_0x3c2e48[_0x7193('0x37')]=_[_0x7193('0x3a')](_0x3c2e48[_0x7193('0x37')],{'$or':_[_0x7193('0x29')](_0x4face4,function(_0x5b4f73){if(_0x5b4f73[_0x7193('0x2c')]!==_0x7193('0x3b')){var _0xdd2f60={};_0xdd2f60[_0x5b4f73[_0x7193('0x26')]]={'$like':'%'+_0x409ec3[_0x7193('0x2e')]['filter']+'%'};return _0xdd2f60;}})});}_0x3c2e48=_[_0x7193('0x3a')]({},_0x3c2e48,_0x409ec3[_0x7193('0x3c')]);var _0x5d9453={'where':_0x3c2e48[_0x7193('0x37')]};return db[_0x7193('0x3d')][_0x7193('0x1a')](_0x5d9453)['then'](function(_0x413597){_0x322e38[_0x7193('0x1a')]=_0x413597;if(_0x409ec3['query'][_0x7193('0x3e')]){_0x3c2e48[_0x7193('0x3f')]=[{'all':!![]}];}return db[_0x7193('0x3d')][_0x7193('0x40')](_0x3c2e48);})[_0x7193('0x22')](function(_0xf9170b){_0x322e38[_0x7193('0x41')]=_0xf9170b;return _0x322e38;})['then'](respondWithFilteredResult(_0x3951ec,_0x3c2e48))[_0x7193('0x42')](handleError(_0x3951ec,null));};exports[_0x7193('0x43')]=function(_0x5d175d,_0x300613){var _0x190801={'raw':!![],'where':{'id':_0x5d175d[_0x7193('0x44')]['id']}},_0x522505={};_0x522505[_0x7193('0x32')]=_[_0x7193('0x2f')](db['SquareMessage'][_0x7193('0x2a')]);_0x522505[_0x7193('0x2e')]=_['keys'](_0x5d175d[_0x7193('0x2e')]);_0x522505[_0x7193('0x30')]=_['intersection'](_0x522505[_0x7193('0x32')],_0x522505[_0x7193('0x2e')]);_0x190801['attributes']=_[_0x7193('0x31')](_0x522505[_0x7193('0x32')],qs[_0x7193('0x34')](_0x5d175d['query'][_0x7193('0x34')]));_0x190801[_0x7193('0x33')]=_0x190801[_0x7193('0x33')][_0x7193('0x45')]?_0x190801[_0x7193('0x33')]:_0x522505[_0x7193('0x32')];if(_0x5d175d[_0x7193('0x2e')][_0x7193('0x3e')]){_0x190801[_0x7193('0x3f')]=[{'all':!![]}];}_0x190801=_['merge']({},_0x190801,_0x5d175d[_0x7193('0x3c')]);return db[_0x7193('0x3d')]['find'](_0x190801)[_0x7193('0x22')](handleEntityNotFound(_0x300613,null))[_0x7193('0x22')](respondWithResult(_0x300613,null))[_0x7193('0x42')](handleError(_0x300613,null));};exports[_0x7193('0x46')]=function(_0x5eda95,_0x250356){return db[_0x7193('0x3d')][_0x7193('0x46')](_0x5eda95[_0x7193('0x47')],{})[_0x7193('0x22')](respondWithResult(_0x250356,0xc9))['catch'](handleError(_0x250356,null));};exports['update']=function(_0x380062,_0x55d58e){if(_0x380062[_0x7193('0x47')]['id']){delete _0x380062[_0x7193('0x47')]['id'];}return db[_0x7193('0x3d')][_0x7193('0x48')]({'where':{'id':_0x380062[_0x7193('0x44')]['id']}})[_0x7193('0x22')](handleEntityNotFound(_0x55d58e,null))[_0x7193('0x22')](saveUpdates(_0x380062[_0x7193('0x47')],null))[_0x7193('0x22')](respondWithResult(_0x55d58e,null))[_0x7193('0x42')](handleError(_0x55d58e,null));};exports[_0x7193('0x23')]=function(_0x175d40,_0x5e1ad6){return db[_0x7193('0x3d')][_0x7193('0x48')]({'where':{'id':_0x175d40[_0x7193('0x44')]['id']}})[_0x7193('0x22')](handleEntityNotFound(_0x5e1ad6,null))[_0x7193('0x22')](removeEntity(_0x5e1ad6,null))[_0x7193('0x42')](handleError(_0x5e1ad6,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index dcfb90e..380414c 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x9c3f9d,_0x271ee6){var _0x2b4696=function(_0x19586e){while(--_0x19586e){_0x9c3f9d['push'](_0x9c3f9d['shift']());}};_0x2b4696(++_0x271ee6);}(_0x0295,0x1f0));var _0x5029=function(_0x1ad68e,_0x16562f){_0x1ad68e=_0x1ad68e-0x0;var _0x82d21e=_0x0295[_0x1ad68e];return _0x82d21e;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('SquareMessage',attributes,{'tableName':'square_messages','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 9aa3c2f..99f0002 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 _0xbc48=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage','body','raw','lodash','util'];(function(_0x30c2d9,_0x7881e3){var _0x21472c=function(_0xf70e5e){while(--_0xf70e5e){_0x30c2d9['push'](_0x30c2d9['shift']());}};_0x21472c(++_0x7881e3);}(_0xbc48,0x111));var _0x8bc4=function(_0x4526d6,_0x2b9454){_0x4526d6=_0x4526d6-0x0;var _0x540ed6=_0xbc48[_0x4526d6];return _0x540ed6;};'use strict';var _=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var moment=require(_0x8bc4('0x2'));var BPromise=require(_0x8bc4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc4('0x4'));var db=require(_0x8bc4('0x5'))['db'];var utils=require(_0x8bc4('0x6'));var logger=require(_0x8bc4('0x7'))('rpc');var config=require(_0x8bc4('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaaff2d,_0x5708fe,_0x58df27){return new BPromise(function(_0x19c07e,_0x4bec6c){return client[_0x8bc4('0x9')](_0xaaff2d,_0x58df27)[_0x8bc4('0xa')](function(_0x20229d){logger[_0x8bc4('0xb')]('SquareMessage,\x20%s,\x20%s',_0x5708fe,_0x8bc4('0xc'));logger[_0x8bc4('0xd')](_0x8bc4('0xe'),_0x5708fe,_0x8bc4('0xc'),JSON[_0x8bc4('0xf')](_0x20229d));if(_0x20229d[_0x8bc4('0x10')]){if(_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x11')]===0x1f4){logger[_0x8bc4('0x10')](_0x8bc4('0x12'),_0x5708fe,_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);return _0x4bec6c(_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);}logger[_0x8bc4('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5708fe,_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);return _0x19c07e(_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);}else{logger[_0x8bc4('0xb')](_0x8bc4('0x12'),_0x5708fe,'request\x20sent');_0x19c07e(_0x20229d['result']['message']);}})[_0x8bc4('0x14')](function(_0x556cef){logger[_0x8bc4('0x10')](_0x8bc4('0x12'),_0x5708fe,_0x556cef);_0x4bec6c(_0x556cef);});});}exports[_0x8bc4('0x15')]=function(_0x5982e6){var _0x13348c=this;return new Promise(function(_0x968929,_0x51b3b2){return db[_0x8bc4('0x16')]['create'](_0x5982e6[_0x8bc4('0x17')],{'raw':_0x5982e6['options']?_0x5982e6['options'][_0x8bc4('0x18')]===undefined?!![]:![]:!![]})[_0x8bc4('0xa')](function(_0x415598){logger[_0x8bc4('0xb')](_0x8bc4('0x15'),_0x5982e6);logger[_0x8bc4('0xd')](_0x8bc4('0x15'),_0x5982e6,JSON[_0x8bc4('0xf')](_0x415598));_0x968929(_0x415598);})[_0x8bc4('0x14')](function(_0x3b402f){logger[_0x8bc4('0x10')]('CreateSquareMessage',_0x3b402f[_0x8bc4('0x13')],_0x5982e6);_0x51b3b2(_0x13348c[_0x8bc4('0x10')](0x1f4,_0x3b402f[_0x8bc4('0x13')]));});});}; \ No newline at end of file +var _0x723e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','stringify'];(function(_0xc177,_0x5bac47){var _0x1ad055=function(_0x4da002){while(--_0x4da002){_0xc177['push'](_0xc177['shift']());}};_0x1ad055(++_0x5bac47);}(_0x723e,0x179));var _0xe723=function(_0x3a8ec5,_0x378f44){_0x3a8ec5=_0x3a8ec5-0x0;var _0x483caf=_0x723e[_0x3a8ec5];return _0x483caf;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var BPromise=require(_0xe723('0x2'));var rs=require(_0xe723('0x3'));var fs=require('fs');var Redis=require(_0xe723('0x4'));var db=require(_0xe723('0x5'))['db'];var utils=require(_0xe723('0x6'));var logger=require(_0xe723('0x7'))(_0xe723('0x8'));var config=require(_0xe723('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe723('0xa')][_0xe723('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1335cd,_0x3bf082,_0x2aebbd){return new BPromise(function(_0xe50f7,_0x1b46e0){return client[_0xe723('0xc')](_0x1335cd,_0x2aebbd)['then'](function(_0x380444){logger[_0xe723('0xd')](_0xe723('0xe'),_0x3bf082,'request\x20sent');logger[_0xe723('0xf')](_0xe723('0x10'),_0x3bf082,_0xe723('0x11'),JSON['stringify'](_0x380444));if(_0x380444[_0xe723('0x12')]){if(_0x380444[_0xe723('0x12')][_0xe723('0x13')]===0x1f4){logger[_0xe723('0x12')](_0xe723('0xe'),_0x3bf082,_0x380444['error'][_0xe723('0x14')]);return _0x1b46e0(_0x380444['error']['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x3bf082,_0x380444[_0xe723('0x12')][_0xe723('0x14')]);return _0xe50f7(_0x380444[_0xe723('0x12')][_0xe723('0x14')]);}else{logger[_0xe723('0xd')]('SquareMessage,\x20%s,\x20%s',_0x3bf082,_0xe723('0x11'));_0xe50f7(_0x380444[_0xe723('0x15')][_0xe723('0x14')]);}})[_0xe723('0x16')](function(_0x347fa0){logger[_0xe723('0x12')](_0xe723('0xe'),_0x3bf082,_0x347fa0);_0x1b46e0(_0x347fa0);});});}exports[_0xe723('0x17')]=function(_0x17e2c1){var _0x3906ea=this;return new Promise(function(_0x2057d7,_0x3012cf){return db[_0xe723('0x18')][_0xe723('0x19')](_0x17e2c1['body'],{'raw':_0x17e2c1['options']?_0x17e2c1[_0xe723('0x1a')][_0xe723('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x28caca){logger[_0xe723('0xd')]('CreateSquareMessage',_0x17e2c1);logger[_0xe723('0xf')]('CreateSquareMessage',_0x17e2c1,JSON[_0xe723('0x1c')](_0x28caca));_0x2057d7(_0x28caca);})[_0xe723('0x16')](function(_0x3b82b2){logger[_0xe723('0x12')](_0xe723('0x17'),_0x3b82b2[_0xe723('0x14')],_0x17e2c1);_0x3012cf(_0x3906ea[_0xe723('0x12')](0x1f4,_0x3b82b2[_0xe723('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9b64b23..2ecf261 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 _0x113c=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','15s','test','post','put','delete'];(function(_0x46a092,_0x4fbc46){var _0x520fa1=function(_0x2e7a82){while(--_0x2e7a82){_0x46a092['push'](_0x46a092['shift']());}};_0x520fa1(++_0x4fbc46);}(_0x113c,0x80));var _0xc113=function(_0x695ff7,_0x2df3bd){_0x695ff7=_0x695ff7-0x0;var _0x232793=_0x113c[_0x695ff7];return _0x232793;};'use strict';var multer=require(_0xc113('0x0'));var util=require('util');var path=require(_0xc113('0x1'));var timeout=require(_0xc113('0x2'));var express=require(_0xc113('0x3'));var router=express[_0xc113('0x4')]();var auth=require(_0xc113('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc113('0x6'));router[_0xc113('0x7')]('/',auth[_0xc113('0x8')](),controller[_0xc113('0x9')]);router['get'](_0xc113('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/test',auth[_0xc113('0x8')](),timeout(_0xc113('0xb')),controller[_0xc113('0xc')]);router[_0xc113('0xd')]('/',auth[_0xc113('0x8')](),controller['create']);router[_0xc113('0xe')](_0xc113('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc113('0xf')](_0xc113('0xa'),auth[_0xc113('0x8')](),controller[_0xc113('0x10')]);module[_0xc113('0x11')]=router; \ No newline at end of file +var _0xaafc=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','create','put','delete','destroy','exports'];(function(_0x238837,_0xe5f1d9){var _0x33b3c0=function(_0x174583){while(--_0x174583){_0x238837['push'](_0x238837['shift']());}};_0x33b3c0(++_0xe5f1d9);}(_0xaafc,0x18f));var _0xcaaf=function(_0x4456e6,_0x52df63){_0x4456e6=_0x4456e6-0x0;var _0x26b51b=_0xaafc[_0x4456e6];return _0x26b51b;};'use strict';var multer=require(_0xcaaf('0x0'));var util=require('util');var path=require(_0xcaaf('0x1'));var timeout=require('connect-timeout');var express=require(_0xcaaf('0x2'));var router=express['Router']();var auth=require(_0xcaaf('0x3'));var interaction=require(_0xcaaf('0x4'));var config=require(_0xcaaf('0x5'));var controller=require(_0xcaaf('0x6'));router['get']('/',auth[_0xcaaf('0x7')](),controller[_0xcaaf('0x8')]);router[_0xcaaf('0x9')](_0xcaaf('0xa'),auth['isAuthenticated'](),controller[_0xcaaf('0xb')]);router[_0xcaaf('0x9')](_0xcaaf('0xc'),auth[_0xcaaf('0x7')](),timeout(_0xcaaf('0xd')),controller[_0xcaaf('0xe')]);router[_0xcaaf('0xf')]('/',auth['isAuthenticated'](),controller[_0xcaaf('0x10')]);router[_0xcaaf('0x11')](_0xcaaf('0xa'),auth[_0xcaaf('0x7')](),controller['update']);router[_0xcaaf('0x12')](_0xcaaf('0xa'),auth[_0xcaaf('0x7')](),controller[_0xcaaf('0x13')]);module[_0xcaaf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a570e81..ce30c9a 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 _0x70a0=['STRING','name','sequelize','exports'];(function(_0x1175f5,_0x17ca7e){var _0x2c3617=function(_0x5a2f82){while(--_0x5a2f82){_0x1175f5['push'](_0x1175f5['shift']());}};_0x2c3617(++_0x17ca7e);}(_0x70a0,0x176));var _0x070a=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x70a0[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x070a('0x0'));module[_0x070a('0x1')]={'name':{'type':Sequelize[_0x070a('0x2')],'unique':_0x070a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x070a('0x2')]},'description':{'type':Sequelize[_0x070a('0x2')]}}; \ No newline at end of file +var _0xee3a=['sequelize','exports','name','STRING'];(function(_0x390ef6,_0x1d401c){var _0x2fdaac=function(_0x692ab7){while(--_0x692ab7){_0x390ef6['push'](_0x390ef6['shift']());}};_0x2fdaac(++_0x1d401c);}(_0xee3a,0x1bc));var _0xaee3=function(_0x3966d7,_0x6887af){_0x3966d7=_0x3966d7-0x0;var _0x2dc1dc=_0xee3a[_0x3966d7];return _0x2dc1dc;};'use strict';var Sequelize=require(_0xaee3('0x0'));module[_0xaee3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaee3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xaee3('0x3')]},'description':{'type':Sequelize[_0xaee3('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e7bbef5..2926f47 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 _0x6f90=['request-promise','moment','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','index','map','SquareOdbc','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','rows','catch','fields','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','html-pdf','eml-format'];(function(_0x4672f6,_0x3f3c9c){var _0x1508e7=function(_0x12d9a7){while(--_0x12d9a7){_0x4672f6['push'](_0x4672f6['shift']());}};_0x1508e7(++_0x3f3c9c);}(_0x6f90,0xa0));var _0x06f9=function(_0x43d887,_0x56462c){_0x43d887=_0x43d887-0x0;var _0x5bbfb7=_0x6f90[_0x43d887];return _0x5bbfb7;};'use strict';var pdf=require(_0x06f9('0x0'));var emlformat=require(_0x06f9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x06f9('0x2'));var moment=require(_0x06f9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06f9('0x4'));var path=require(_0x06f9('0x5'));var sox=require('sox');var csv=require(_0x06f9('0x6'));var ejs=require(_0x06f9('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x06f9('0x8'));var jsforce=require(_0x06f9('0x9'));var deskjs=require(_0x06f9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x06f9('0xb'));var Papa=require(_0x06f9('0xc'));var Redis=require(_0x06f9('0xd'));var authService=require(_0x06f9('0xe'));var qs=require(_0x06f9('0xf'));var as=require(_0x06f9('0x10'));var hardwareService=require(_0x06f9('0x11'));var logger=require(_0x06f9('0x12'))(_0x06f9('0x13'));var utils=require(_0x06f9('0x14'));var config=require(_0x06f9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3edca3,_0x4cc1d4){_0x4cc1d4=_0x4cc1d4||0xcc;return function(_0x11506e){if(_0x11506e){return _0x3edca3[_0x06f9('0x16')](_0x4cc1d4);}return _0x3edca3[_0x06f9('0x17')](_0x4cc1d4)[_0x06f9('0x18')]();};}function respondWithResult(_0x41b81c,_0xff3d00){_0xff3d00=_0xff3d00||0xc8;return function(_0x276829){if(_0x276829){return _0x41b81c[_0x06f9('0x17')](_0xff3d00)[_0x06f9('0x19')](_0x276829);}};}function respondWithFilteredResult(_0x53a098,_0x12703a){return function(_0x2231fe){if(_0x2231fe){var _0x2ff1c2=_0x2231fe['count'],_0x32ac0e=_0x12703a['offset'],_0x100aed=_0x12703a[_0x06f9('0x1a')]+_0x12703a[_0x06f9('0x1b')],_0x3703ac;if(_0x100aed>=_0x2ff1c2){_0x100aed=_0x2ff1c2;_0x3703ac=0xc8;}else{_0x3703ac=0xce;}_0x53a098[_0x06f9('0x17')](_0x3703ac);return _0x53a098[_0x06f9('0x1c')]('Content-Range',_0x32ac0e+'-'+_0x100aed+'/'+_0x2ff1c2)[_0x06f9('0x19')](_0x2231fe);}return null;};}function patchUpdates(_0x4bea59){return function(_0x59c431){try{jsonpatch['apply'](_0x59c431,_0x4bea59,!![]);}catch(_0x5342e9){return BPromise['reject'](_0x5342e9);}return _0x59c431[_0x06f9('0x1d')]();};}function saveUpdates(_0x3687b3,_0x443a51){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x06f9('0x1e')](_0x3687b3)[_0x06f9('0x1f')](function(_0x52a52e){return _0x52a52e;});}return null;};}function removeEntity(_0x5af051,_0x4b2d43){return function(_0x20539c){if(_0x20539c){return _0x20539c['destroy']()[_0x06f9('0x1f')](function(){var _0x3b69e4=_0x20539c[_0x06f9('0x20')]({'plain':!![]});var _0x4be1e5=_0x06f9('0x21');return db[_0x06f9('0x22')][_0x06f9('0x23')]({'where':{'type':_0x4be1e5,'resourceId':_0x3b69e4['id']}})[_0x06f9('0x1f')](function(){return _0x20539c;});})[_0x06f9('0x1f')](function(){_0x5af051['status'](0xcc)[_0x06f9('0x18')]();});}};}function handleEntityNotFound(_0x51a148,_0x199d61){return function(_0x58d519){if(!_0x58d519){_0x51a148[_0x06f9('0x16')](0x194);}return _0x58d519;};}function handleError(_0xd52948,_0x3d19ca){_0x3d19ca=_0x3d19ca||0x1f4;return function(_0x2625fe){logger[_0x06f9('0x24')](_0x2625fe[_0x06f9('0x25')]);if(_0x2625fe[_0x06f9('0x26')]){delete _0x2625fe[_0x06f9('0x26')];}_0xd52948[_0x06f9('0x17')](_0x3d19ca)['send'](_0x2625fe);};}exports[_0x06f9('0x27')]=function(_0x4f186d,_0x23b63c){var _0xc74feb={},_0x4ed9d2={},_0x441bf8={'count':0x0,'rows':[]};var _0x4301a5=_[_0x06f9('0x28')](db[_0x06f9('0x29')][_0x06f9('0x2a')],function(_0x499dd3){return{'name':_0x499dd3['fieldName'],'type':_0x499dd3['type'][_0x06f9('0x2b')]};});_0x4ed9d2['model']=_['map'](_0x4301a5,_0x06f9('0x26'));_0x4ed9d2[_0x06f9('0x2c')]=_[_0x06f9('0x2d')](_0x4f186d[_0x06f9('0x2c')]);_0x4ed9d2[_0x06f9('0x2e')]=_[_0x06f9('0x2f')](_0x4ed9d2[_0x06f9('0x30')],_0x4ed9d2['query']);_0xc74feb[_0x06f9('0x31')]=_[_0x06f9('0x2f')](_0x4ed9d2[_0x06f9('0x30')],qs['fields'](_0x4f186d[_0x06f9('0x2c')]['fields']));_0xc74feb[_0x06f9('0x31')]=_0xc74feb['attributes'][_0x06f9('0x32')]?_0xc74feb[_0x06f9('0x31')]:_0x4ed9d2[_0x06f9('0x30')];if(!_0x4f186d[_0x06f9('0x2c')][_0x06f9('0x33')](_0x06f9('0x34'))){_0xc74feb[_0x06f9('0x1b')]=qs['limit'](_0x4f186d[_0x06f9('0x2c')][_0x06f9('0x1b')]);_0xc74feb[_0x06f9('0x1a')]=qs[_0x06f9('0x1a')](_0x4f186d[_0x06f9('0x2c')][_0x06f9('0x1a')]);}_0xc74feb['order']=qs[_0x06f9('0x35')](_0x4f186d[_0x06f9('0x2c')][_0x06f9('0x35')]);_0xc74feb[_0x06f9('0x36')]=qs[_0x06f9('0x2e')](_[_0x06f9('0x37')](_0x4f186d['query'],_0x4ed9d2[_0x06f9('0x2e')]),_0x4301a5);if(_0x4f186d['query'][_0x06f9('0x38')]){_0xc74feb['where']=_[_0x06f9('0x39')](_0xc74feb[_0x06f9('0x36')],{'$or':_[_0x06f9('0x28')](_0x4301a5,function(_0x5c4edb){if(_0x5c4edb[_0x06f9('0x3a')]!==_0x06f9('0x3b')){var _0x5b6bee={};_0x5b6bee[_0x5c4edb[_0x06f9('0x26')]]={'$like':'%'+_0x4f186d[_0x06f9('0x2c')][_0x06f9('0x38')]+'%'};return _0x5b6bee;}})});}_0xc74feb=_[_0x06f9('0x39')]({},_0xc74feb,_0x4f186d[_0x06f9('0x3c')]);var _0x2973f9={'where':_0xc74feb[_0x06f9('0x36')]};return db[_0x06f9('0x29')][_0x06f9('0x3d')](_0x2973f9)[_0x06f9('0x1f')](function(_0x1a077c){_0x441bf8[_0x06f9('0x3d')]=_0x1a077c;if(_0x4f186d[_0x06f9('0x2c')]['includeAll']){_0xc74feb[_0x06f9('0x3e')]=[{'all':!![]}];}return db[_0x06f9('0x29')]['findAll'](_0xc74feb);})[_0x06f9('0x1f')](function(_0x475ea1){_0x441bf8[_0x06f9('0x3f')]=_0x475ea1;return _0x441bf8;})[_0x06f9('0x1f')](respondWithFilteredResult(_0x23b63c,_0xc74feb))[_0x06f9('0x40')](handleError(_0x23b63c,null));};exports['show']=function(_0x329605,_0x3558b7){var _0x5c6c0a={'raw':!![],'where':{'id':_0x329605['params']['id']}},_0xaa58a1={};_0xaa58a1['model']=_[_0x06f9('0x2d')](db['SquareOdbc']['rawAttributes']);_0xaa58a1[_0x06f9('0x2c')]=_['keys'](_0x329605[_0x06f9('0x2c')]);_0xaa58a1[_0x06f9('0x2e')]=_[_0x06f9('0x2f')](_0xaa58a1[_0x06f9('0x30')],_0xaa58a1[_0x06f9('0x2c')]);_0x5c6c0a[_0x06f9('0x31')]=_[_0x06f9('0x2f')](_0xaa58a1[_0x06f9('0x30')],qs[_0x06f9('0x41')](_0x329605[_0x06f9('0x2c')]['fields']));_0x5c6c0a[_0x06f9('0x31')]=_0x5c6c0a[_0x06f9('0x31')][_0x06f9('0x32')]?_0x5c6c0a[_0x06f9('0x31')]:_0xaa58a1[_0x06f9('0x30')];if(_0x329605[_0x06f9('0x2c')][_0x06f9('0x42')]){_0x5c6c0a['include']=[{'all':!![]}];}_0x5c6c0a=_['merge']({},_0x5c6c0a,_0x329605['options']);return db[_0x06f9('0x29')][_0x06f9('0x43')](_0x5c6c0a)[_0x06f9('0x1f')](handleEntityNotFound(_0x3558b7,null))[_0x06f9('0x1f')](respondWithResult(_0x3558b7,null))['catch'](handleError(_0x3558b7,null));};exports[_0x06f9('0x44')]=function(_0x35a14c,_0x44f82e){return db[_0x06f9('0x29')][_0x06f9('0x44')](_0x35a14c[_0x06f9('0x45')],{})[_0x06f9('0x1f')](function(_0x1a3057){var _0x40cf78=_0x35a14c[_0x06f9('0x46')][_0x06f9('0x20')]({'plain':!![]});if(!_0x40cf78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40cf78[_0x06f9('0x47')]===_0x06f9('0x46')){var _0x39c166=_0x1a3057['get']({'plain':!![]});var _0x439859=_0x06f9('0x21');return db[_0x06f9('0x48')][_0x06f9('0x43')]({'where':{'name':_0x439859,'userProfileId':_0x40cf78[_0x06f9('0x49')]},'raw':!![]})['then'](function(_0x20fb30){if(_0x20fb30&&_0x20fb30[_0x06f9('0x4a')]===0x0){return db[_0x06f9('0x22')][_0x06f9('0x44')]({'name':_0x39c166[_0x06f9('0x26')],'resourceId':_0x39c166['id'],'type':_0x20fb30['name'],'sectionId':_0x20fb30['id']},{})[_0x06f9('0x1f')](function(){return _0x1a3057;});}else{return _0x1a3057;}})['catch'](function(_0x1db403){logger[_0x06f9('0x24')](_0x06f9('0x4b'),_0x1db403);throw _0x1db403;});}return _0x1a3057;})[_0x06f9('0x1f')](respondWithResult(_0x44f82e,0xc9))[_0x06f9('0x40')](handleError(_0x44f82e,null));};exports['update']=function(_0x12afa9,_0x48b7be){if(_0x12afa9[_0x06f9('0x45')]['id']){delete _0x12afa9[_0x06f9('0x45')]['id'];}return db[_0x06f9('0x29')][_0x06f9('0x43')]({'where':{'id':_0x12afa9['params']['id']}})[_0x06f9('0x1f')](handleEntityNotFound(_0x48b7be,null))[_0x06f9('0x1f')](saveUpdates(_0x12afa9[_0x06f9('0x45')],null))['then'](respondWithResult(_0x48b7be,null))['catch'](handleError(_0x48b7be,null));};exports[_0x06f9('0x23')]=function(_0x3eb3d3,_0x4da147){return db['SquareOdbc'][_0x06f9('0x43')]({'where':{'id':_0x3eb3d3[_0x06f9('0x4c')]['id']}})[_0x06f9('0x1f')](handleEntityNotFound(_0x4da147,null))[_0x06f9('0x1f')](removeEntity(_0x4da147,null))[_0x06f9('0x40')](handleError(_0x4da147,null));};exports['test']=function(_0x149282,_0x122504,_0x6d473c){var _0x53481d;return db[_0x06f9('0x29')][_0x06f9('0x43')]({'where':{'id':_0x149282[_0x06f9('0x4c')]['id']},'attributes':['id',_0x06f9('0x4d')]})['then'](handleEntityNotFound(_0x122504,null))[_0x06f9('0x1f')](function(_0x5d0d88){if(_0x5d0d88){var _0xb94ba8=require(_0x06f9('0x4e'))();_0xb94ba8[_0x06f9('0x4f')](_0x5d0d88[_0x06f9('0x4d')]);_0xb94ba8[_0x06f9('0x50')]();return _0x5d0d88;}})[_0x06f9('0x1f')](respondWithResult(_0x122504,null))[_0x06f9('0x40')](handleError(_0x122504,null));}; \ No newline at end of file +var _0x6cdf=['openSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','status','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','user','UserProfileSection','userProfileId','autoAssociation','create','body','test','dsn','odbc'];(function(_0x258a40,_0x19e206){var _0xee8e2=function(_0x152c0b){while(--_0x152c0b){_0x258a40['push'](_0x258a40['shift']());}};_0xee8e2(++_0x19e206);}(_0x6cdf,0x1ed));var _0xf6cd=function(_0x3dd531,_0xedaa84){_0x3dd531=_0x3dd531-0x0;var _0x299141=_0x6cdf[_0x3dd531];return _0x299141;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6cd('0x0'));var rimraf=require(_0xf6cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6cd('0x2'));var rp=require(_0xf6cd('0x3'));var moment=require('moment');var BPromise=require(_0xf6cd('0x4'));var Mustache=require(_0xf6cd('0x5'));var util=require('util');var path=require(_0xf6cd('0x6'));var sox=require(_0xf6cd('0x7'));var csv=require('to-csv');var ejs=require(_0xf6cd('0x8'));var fs=require('fs');var _=require(_0xf6cd('0x9'));var squel=require(_0xf6cd('0xa'));var crypto=require(_0xf6cd('0xb'));var jsforce=require(_0xf6cd('0xc'));var deskjs=require(_0xf6cd('0xd'));var toCsv=require(_0xf6cd('0xe'));var querystring=require('querystring');var Papa=require(_0xf6cd('0xf'));var Redis=require(_0xf6cd('0x10'));var authService=require(_0xf6cd('0x11'));var qs=require(_0xf6cd('0x12'));var as=require(_0xf6cd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6cd('0x14'))(_0xf6cd('0x15'));var utils=require(_0xf6cd('0x16'));var config=require('../../config/environment');var db=require(_0xf6cd('0x17'))['db'];function respondWithStatusCode(_0x47d13a,_0x3e7020){_0x3e7020=_0x3e7020||0xcc;return function(_0x41a0f8){if(_0x41a0f8){return _0x47d13a[_0xf6cd('0x18')](_0x3e7020);}return _0x47d13a['status'](_0x3e7020)[_0xf6cd('0x19')]();};}function respondWithResult(_0x365ea9,_0x15dbfc){_0x15dbfc=_0x15dbfc||0xc8;return function(_0x2c9724){if(_0x2c9724){return _0x365ea9['status'](_0x15dbfc)[_0xf6cd('0x1a')](_0x2c9724);}};}function respondWithFilteredResult(_0x573005,_0x2aa008){return function(_0x5e36b1){if(_0x5e36b1){var _0xcb199d=_0x5e36b1[_0xf6cd('0x1b')],_0x285792=_0x2aa008[_0xf6cd('0x1c')],_0x177225=_0x2aa008[_0xf6cd('0x1c')]+_0x2aa008[_0xf6cd('0x1d')],_0x52a82d;if(_0x177225>=_0xcb199d){_0x177225=_0xcb199d;_0x52a82d=0xc8;}else{_0x52a82d=0xce;}_0x573005['status'](_0x52a82d);return _0x573005['set'](_0xf6cd('0x1e'),_0x285792+'-'+_0x177225+'/'+_0xcb199d)['json'](_0x5e36b1);}return null;};}function patchUpdates(_0x410802){return function(_0x1d13c2){try{jsonpatch[_0xf6cd('0x1f')](_0x1d13c2,_0x410802,!![]);}catch(_0x2562ac){return BPromise[_0xf6cd('0x20')](_0x2562ac);}return _0x1d13c2[_0xf6cd('0x21')]();};}function saveUpdates(_0x40fc8d,_0x4e87eb){return function(_0x94f825){if(_0x94f825){return _0x94f825[_0xf6cd('0x22')](_0x40fc8d)[_0xf6cd('0x23')](function(_0x160e15){return _0x160e15;});}return null;};}function removeEntity(_0x2af81c,_0x580a89){return function(_0x34d82b){if(_0x34d82b){return _0x34d82b[_0xf6cd('0x24')]()[_0xf6cd('0x23')](function(){var _0x48c0af=_0x34d82b[_0xf6cd('0x25')]({'plain':!![]});var _0x186a41='ODBC';return db[_0xf6cd('0x26')][_0xf6cd('0x24')]({'where':{'type':_0x186a41,'resourceId':_0x48c0af['id']}})[_0xf6cd('0x23')](function(){return _0x34d82b;});})[_0xf6cd('0x23')](function(){_0x2af81c[_0xf6cd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238437,_0x49485b){return function(_0x2363c1){if(!_0x2363c1){_0x238437[_0xf6cd('0x18')](0x194);}return _0x2363c1;};}function handleError(_0x3afefd,_0xa206ee){_0xa206ee=_0xa206ee||0x1f4;return function(_0x2e2c6e){logger[_0xf6cd('0x28')](_0x2e2c6e[_0xf6cd('0x29')]);if(_0x2e2c6e[_0xf6cd('0x2a')]){delete _0x2e2c6e[_0xf6cd('0x2a')];}_0x3afefd[_0xf6cd('0x27')](_0xa206ee)[_0xf6cd('0x2b')](_0x2e2c6e);};}exports[_0xf6cd('0x2c')]=function(_0x427627,_0x2e718b){var _0x1379b1={},_0x52112b={},_0x595ced={'count':0x0,'rows':[]};var _0x18a9ab=_[_0xf6cd('0x2d')](db[_0xf6cd('0x2e')][_0xf6cd('0x2f')],function(_0x4d1cc5){return{'name':_0x4d1cc5['fieldName'],'type':_0x4d1cc5[_0xf6cd('0x30')]['key']};});_0x52112b[_0xf6cd('0x31')]=_[_0xf6cd('0x2d')](_0x18a9ab,'name');_0x52112b['query']=_[_0xf6cd('0x32')](_0x427627[_0xf6cd('0x33')]);_0x52112b[_0xf6cd('0x34')]=_[_0xf6cd('0x35')](_0x52112b[_0xf6cd('0x31')],_0x52112b[_0xf6cd('0x33')]);_0x1379b1['attributes']=_['intersection'](_0x52112b[_0xf6cd('0x31')],qs[_0xf6cd('0x36')](_0x427627[_0xf6cd('0x33')][_0xf6cd('0x36')]));_0x1379b1['attributes']=_0x1379b1['attributes'][_0xf6cd('0x37')]?_0x1379b1[_0xf6cd('0x38')]:_0x52112b['model'];if(!_0x427627[_0xf6cd('0x33')][_0xf6cd('0x39')](_0xf6cd('0x3a'))){_0x1379b1[_0xf6cd('0x1d')]=qs['limit'](_0x427627['query'][_0xf6cd('0x1d')]);_0x1379b1[_0xf6cd('0x1c')]=qs[_0xf6cd('0x1c')](_0x427627[_0xf6cd('0x33')][_0xf6cd('0x1c')]);}_0x1379b1['order']=qs[_0xf6cd('0x3b')](_0x427627[_0xf6cd('0x33')][_0xf6cd('0x3b')]);_0x1379b1[_0xf6cd('0x3c')]=qs[_0xf6cd('0x34')](_[_0xf6cd('0x3d')](_0x427627[_0xf6cd('0x33')],_0x52112b[_0xf6cd('0x34')]),_0x18a9ab);if(_0x427627['query'][_0xf6cd('0x3e')]){_0x1379b1[_0xf6cd('0x3c')]=_[_0xf6cd('0x3f')](_0x1379b1[_0xf6cd('0x3c')],{'$or':_['map'](_0x18a9ab,function(_0x16f1a5){if(_0x16f1a5[_0xf6cd('0x30')]!==_0xf6cd('0x40')){var _0x345522={};_0x345522[_0x16f1a5[_0xf6cd('0x2a')]]={'$like':'%'+_0x427627['query'][_0xf6cd('0x3e')]+'%'};return _0x345522;}})});}_0x1379b1=_[_0xf6cd('0x3f')]({},_0x1379b1,_0x427627[_0xf6cd('0x41')]);var _0x528bdf={'where':_0x1379b1[_0xf6cd('0x3c')]};return db['SquareOdbc'][_0xf6cd('0x1b')](_0x528bdf)['then'](function(_0x13da8c){_0x595ced[_0xf6cd('0x1b')]=_0x13da8c;if(_0x427627[_0xf6cd('0x33')][_0xf6cd('0x42')]){_0x1379b1[_0xf6cd('0x43')]=[{'all':!![]}];}return db[_0xf6cd('0x2e')][_0xf6cd('0x44')](_0x1379b1);})['then'](function(_0x3aa9c7){_0x595ced['rows']=_0x3aa9c7;return _0x595ced;})[_0xf6cd('0x23')](respondWithFilteredResult(_0x2e718b,_0x1379b1))[_0xf6cd('0x45')](handleError(_0x2e718b,null));};exports[_0xf6cd('0x46')]=function(_0x134f52,_0x354e6c){var _0x1a23fb={'raw':!![],'where':{'id':_0x134f52['params']['id']}},_0x457dc0={};_0x457dc0[_0xf6cd('0x31')]=_[_0xf6cd('0x32')](db['SquareOdbc'][_0xf6cd('0x2f')]);_0x457dc0[_0xf6cd('0x33')]=_[_0xf6cd('0x32')](_0x134f52[_0xf6cd('0x33')]);_0x457dc0[_0xf6cd('0x34')]=_[_0xf6cd('0x35')](_0x457dc0[_0xf6cd('0x31')],_0x457dc0['query']);_0x1a23fb[_0xf6cd('0x38')]=_[_0xf6cd('0x35')](_0x457dc0[_0xf6cd('0x31')],qs[_0xf6cd('0x36')](_0x134f52[_0xf6cd('0x33')][_0xf6cd('0x36')]));_0x1a23fb[_0xf6cd('0x38')]=_0x1a23fb['attributes'][_0xf6cd('0x37')]?_0x1a23fb[_0xf6cd('0x38')]:_0x457dc0[_0xf6cd('0x31')];if(_0x134f52[_0xf6cd('0x33')][_0xf6cd('0x42')]){_0x1a23fb[_0xf6cd('0x43')]=[{'all':!![]}];}_0x1a23fb=_['merge']({},_0x1a23fb,_0x134f52[_0xf6cd('0x41')]);return db[_0xf6cd('0x2e')][_0xf6cd('0x47')](_0x1a23fb)[_0xf6cd('0x23')](handleEntityNotFound(_0x354e6c,null))['then'](respondWithResult(_0x354e6c,null))[_0xf6cd('0x45')](handleError(_0x354e6c,null));};exports['create']=function(_0x57b99d,_0x5e73cb){return db[_0xf6cd('0x2e')]['create'](_0x57b99d['body'],{})['then'](function(_0x21aaba){var _0x4f21d9=_0x57b99d[_0xf6cd('0x48')][_0xf6cd('0x25')]({'plain':!![]});if(!_0x4f21d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f21d9['role']===_0xf6cd('0x48')){var _0x374b3c=_0x21aaba[_0xf6cd('0x25')]({'plain':!![]});var _0x2947e6='ODBC';return db[_0xf6cd('0x49')][_0xf6cd('0x47')]({'where':{'name':_0x2947e6,'userProfileId':_0x4f21d9[_0xf6cd('0x4a')]},'raw':!![]})[_0xf6cd('0x23')](function(_0x58a8d1){if(_0x58a8d1&&_0x58a8d1[_0xf6cd('0x4b')]===0x0){return db[_0xf6cd('0x26')][_0xf6cd('0x4c')]({'name':_0x374b3c[_0xf6cd('0x2a')],'resourceId':_0x374b3c['id'],'type':_0x58a8d1[_0xf6cd('0x2a')],'sectionId':_0x58a8d1['id']},{})['then'](function(){return _0x21aaba;});}else{return _0x21aaba;}})[_0xf6cd('0x45')](function(_0x37e227){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e227);throw _0x37e227;});}return _0x21aaba;})['then'](respondWithResult(_0x5e73cb,0xc9))[_0xf6cd('0x45')](handleError(_0x5e73cb,null));};exports['update']=function(_0x27894c,_0x3668e1){if(_0x27894c[_0xf6cd('0x4d')]['id']){delete _0x27894c[_0xf6cd('0x4d')]['id'];}return db[_0xf6cd('0x2e')][_0xf6cd('0x47')]({'where':{'id':_0x27894c['params']['id']}})['then'](handleEntityNotFound(_0x3668e1,null))[_0xf6cd('0x23')](saveUpdates(_0x27894c[_0xf6cd('0x4d')],null))[_0xf6cd('0x23')](respondWithResult(_0x3668e1,null))[_0xf6cd('0x45')](handleError(_0x3668e1,null));};exports[_0xf6cd('0x24')]=function(_0x402988,_0x385e34){return db[_0xf6cd('0x2e')][_0xf6cd('0x47')]({'where':{'id':_0x402988['params']['id']}})[_0xf6cd('0x23')](handleEntityNotFound(_0x385e34,null))[_0xf6cd('0x23')](removeEntity(_0x385e34,null))[_0xf6cd('0x45')](handleError(_0x385e34,null));};exports[_0xf6cd('0x4e')]=function(_0x8d1aff,_0x2ccc60,_0x1a2309){var _0x38bbcf;return db['SquareOdbc'][_0xf6cd('0x47')]({'where':{'id':_0x8d1aff['params']['id']},'attributes':['id',_0xf6cd('0x4f')]})['then'](handleEntityNotFound(_0x2ccc60,null))[_0xf6cd('0x23')](function(_0x5c40d6){if(_0x5c40d6){var _0x58cada=require(_0xf6cd('0x50'))();_0x58cada[_0xf6cd('0x51')](_0x5c40d6[_0xf6cd('0x4f')]);_0x58cada['closeSync']();return _0x5c40d6;}})[_0xf6cd('0x23')](respondWithResult(_0x2ccc60,null))['catch'](handleError(_0x2ccc60,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ab2044e..02baff4 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 _0x61a1=['moment','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api'];(function(_0x2504c8,_0xff8900){var _0x30ee80=function(_0x121191){while(--_0x121191){_0x2504c8['push'](_0x2504c8['shift']());}};_0x30ee80(++_0xff8900);}(_0x61a1,0x127));var _0x161a=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x61a1[_0x1428d9];return _0x438019;};'use strict';var _=require(_0x161a('0x0'));var util=require(_0x161a('0x1'));var logger=require(_0x161a('0x2'))(_0x161a('0x3'));var moment=require(_0x161a('0x4'));var BPromise=require('bluebird');var rp=require(_0x161a('0x5'));var fs=require('fs');var path=require(_0x161a('0x6'));var rimraf=require('rimraf');var config=require(_0x161a('0x7'));var attributes=require(_0x161a('0x8'));module[_0x161a('0x9')]=function(_0x1442cf,_0x1bb0ac){return _0x1442cf[_0x161a('0xa')](_0x161a('0xb'),attributes,{'tableName':_0x161a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64de=['square_odbc','lodash','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc'];(function(_0x18efc2,_0x35d1cb){var _0x2a92a7=function(_0x11b2ec){while(--_0x11b2ec){_0x18efc2['push'](_0x18efc2['shift']());}};_0x2a92a7(++_0x35d1cb);}(_0x64de,0x10f));var _0xe64d=function(_0x239a4b,_0x90265a){_0x239a4b=_0x239a4b-0x0;var _0xd6307e=_0x64de[_0x239a4b];return _0xd6307e;};'use strict';var _=require(_0xe64d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe64d('0x1'));var moment=require('moment');var BPromise=require(_0xe64d('0x2'));var rp=require(_0xe64d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe64d('0x4'));var config=require(_0xe64d('0x5'));var attributes=require(_0xe64d('0x6'));module['exports']=function(_0x9ac109,_0x12669c){return _0x9ac109[_0xe64d('0x7')](_0xe64d('0x8'),attributes,{'tableName':_0xe64d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 03e26e4..49cf1a9 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x1bd0c4,_0x2405e0){var _0x13a3af=function(_0xe18df9){while(--_0xe18df9){_0x1bd0c4['push'](_0x1bd0c4['shift']());}};_0x13a3af(++_0x2405e0);}(_0x55ca,0x126));var _0xa55c=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0x55ca[_0x4d05a0];return _0x4c999c;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0xfaddc9,_0x5c9ad2){var _0x579846=function(_0x44e4ea){while(--_0x44e4ea){_0xfaddc9['push'](_0xfaddc9['shift']());}};_0x579846(++_0x5c9ad2);}(_0x55ca,0x126));var _0xa55c=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x55ca[_0x3c2b2e];return _0x27a338;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 0665cb7..4d681ad 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 _0x3c81=['/:id','getUsers','post','create','/:id/users','addUsers','put','update','delete','destroy','removeUsers','multer','util','connect-timeout','express','./squareProject.controller','get','isAuthenticated','index'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0x3c81,0x102));var _0x13c8=function(_0x550b03,_0x4c8033){_0x550b03=_0x550b03-0x0;var _0x448883=_0x3c81[_0x550b03];return _0x448883;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('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(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0x7')]);router[_0x13c8('0x5')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller['show']);router[_0x13c8('0x5')]('/:id/users',auth[_0x13c8('0x6')](),controller[_0x13c8('0x9')]);router[_0x13c8('0xa')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0xb')]);router[_0x13c8('0xa')](_0x13c8('0xc'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xd')]);router[_0x13c8('0xe')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xf')]);router[_0x13c8('0x10')]('/:id',auth[_0x13c8('0x6')](),controller[_0x13c8('0x11')]);router[_0x13c8('0x10')](_0x13c8('0xc'),auth['isAuthenticated'](),controller[_0x13c8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4e81=['update','destroy','delete','removeUsers','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','addUsers','put'];(function(_0x396dc6,_0x529342){var _0x285078=function(_0x198a28){while(--_0x198a28){_0x396dc6['push'](_0x396dc6['shift']());}};_0x285078(++_0x529342);}(_0x4e81,0x1bc));var _0x14e8=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0x4e81[_0x497b1e];return _0x3f72e1;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x14e8('0x3'));var interaction=require(_0x14e8('0x4'));var config=require(_0x14e8('0x5'));var controller=require(_0x14e8('0x6'));router[_0x14e8('0x7')]('/',auth[_0x14e8('0x8')](),controller['index']);router['get'](_0x14e8('0x9'),auth[_0x14e8('0x8')](),controller[_0x14e8('0xa')]);router[_0x14e8('0x7')](_0x14e8('0xb'),auth[_0x14e8('0x8')](),controller[_0x14e8('0xc')]);router[_0x14e8('0xd')]('/',auth[_0x14e8('0x8')](),controller['create']);router[_0x14e8('0xd')](_0x14e8('0xb'),auth[_0x14e8('0x8')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')](_0x14e8('0x9'),auth[_0x14e8('0x8')](),controller[_0x14e8('0x10')]);router['delete'](_0x14e8('0x9'),auth['isAuthenticated'](),controller[_0x14e8('0x11')]);router[_0x14e8('0x12')](_0x14e8('0xb'),auth['isAuthenticated'](),controller[_0x14e8('0x13')]);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 db1effe..a9331ad 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 _0xe4fa=['toString','long','getDataValue','production','utf8','sequelize','exports','STRING','TEXT','BLOB','preproduction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe4fa,0x123));var _0xae4f=function(_0x462336,_0x5c8e8d){_0x462336=_0x462336-0x0;var _0x138277=_0xe4fa[_0x462336];return _0x138277;};'use strict';var Sequelize=require(_0xae4f('0x0'));module[_0xae4f('0x1')]={'name':{'type':Sequelize[_0xae4f('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xae4f('0x3')]},'preproduction':{'type':Sequelize[_0xae4f('0x4')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0xae4f('0x5'))[_0xae4f('0x6')]('utf8');}}},'production':{'type':Sequelize[_0xae4f('0x4')](_0xae4f('0x7')),'get':function(){if(this[_0xae4f('0x8')](_0xae4f('0x9'))){return this[_0xae4f('0x8')](_0xae4f('0x9'))['toString'](_0xae4f('0xa'));}}}}; \ No newline at end of file +var _0x9920=['exports','name','STRING','BLOB','preproduction','getDataValue','production','toString','utf8'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9920,0x17a));var _0x0992=function(_0x7f9b82,_0x23a4c9){_0x7f9b82=_0x7f9b82-0x0;var _0x551219=_0x9920[_0x7f9b82];return _0x551219;};'use strict';var Sequelize=require('sequelize');module[_0x0992('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0992('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x0992('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0992('0x3')]('long'),'get':function(){if(this['getDataValue'](_0x0992('0x4'))){return this[_0x0992('0x5')]('preproduction')['toString']('utf8');}}},'production':{'type':Sequelize[_0x0992('0x3')]('long'),'get':function(){if(this['getDataValue'](_0x0992('0x6'))){return this['getDataValue']('production')[_0x0992('0x7')](_0x0992('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 3863c81..d718ca1 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 _0x2bdd=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','get','SquareProjects','UserProfileResource','destroy','then','end','error','stack','name','send','index','map','SquareProject','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','user'];(function(_0x38eaf1,_0x131f82){var _0x3b8d96=function(_0x520135){while(--_0x520135){_0x38eaf1['push'](_0x38eaf1['shift']());}};_0x3b8d96(++_0x131f82);}(_0x2bdd,0x71));var _0xd2bd=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x2bdd[_0x235482];return _0x5f5bea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd2bd('0x0'));var rimraf=require(_0xd2bd('0x1'));var zipdir=require(_0xd2bd('0x2'));var jsonpatch=require(_0xd2bd('0x3'));var rp=require(_0xd2bd('0x4'));var moment=require(_0xd2bd('0x5'));var BPromise=require(_0xd2bd('0x6'));var Mustache=require('mustache');var util=require(_0xd2bd('0x7'));var path=require(_0xd2bd('0x8'));var sox=require('sox');var csv=require(_0xd2bd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd2bd('0xa'));var crypto=require(_0xd2bd('0xb'));var jsforce=require(_0xd2bd('0xc'));var deskjs=require(_0xd2bd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd2bd('0xe'));var Papa=require('papaparse');var Redis=require(_0xd2bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd2bd('0x10'));var as=require(_0xd2bd('0x11'));var hardwareService=require(_0xd2bd('0x12'));var logger=require(_0xd2bd('0x13'))(_0xd2bd('0x14'));var utils=require(_0xd2bd('0x15'));var config=require(_0xd2bd('0x16'));var db=require(_0xd2bd('0x17'))['db'];config['redis']=_[_0xd2bd('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd2bd('0x19'))(new Redis(config[_0xd2bd('0x1a')]));require('./squareProject.socket')[_0xd2bd('0x1b')](socket);function respondWithStatusCode(_0x1b331e,_0x325a08){_0x325a08=_0x325a08||0xcc;return function(_0x462247){if(_0x462247){return _0x1b331e[_0xd2bd('0x1c')](_0x325a08);}return _0x1b331e['status'](_0x325a08)['end']();};}function respondWithResult(_0x2fddf7,_0xcfb532){_0xcfb532=_0xcfb532||0xc8;return function(_0x2b08ae){if(_0x2b08ae){return _0x2fddf7[_0xd2bd('0x1d')](_0xcfb532)[_0xd2bd('0x1e')](_0x2b08ae);}};}function respondWithFilteredResult(_0x7861ea,_0x39fd41){return function(_0x56d2f9){if(_0x56d2f9){var _0x2cbfdf=_0x56d2f9['count'],_0x97f843=_0x39fd41['offset'],_0x1e4da7=_0x39fd41[_0xd2bd('0x1f')]+_0x39fd41['limit'],_0x50a5c5;if(_0x1e4da7>=_0x2cbfdf){_0x1e4da7=_0x2cbfdf;_0x50a5c5=0xc8;}else{_0x50a5c5=0xce;}_0x7861ea['status'](_0x50a5c5);return _0x7861ea[_0xd2bd('0x20')](_0xd2bd('0x21'),_0x97f843+'-'+_0x1e4da7+'/'+_0x2cbfdf)['json'](_0x56d2f9);}return null;};}function patchUpdates(_0x356721){return function(_0x13109c){try{jsonpatch[_0xd2bd('0x22')](_0x13109c,_0x356721,!![]);}catch(_0x423a86){return BPromise[_0xd2bd('0x23')](_0x423a86);}return _0x13109c[_0xd2bd('0x24')]();};}function saveUpdates(_0x4c3bd1,_0x330add){return function(_0x664518){if(_0x664518){return _0x664518[_0xd2bd('0x25')](_0x4c3bd1)['then'](function(_0x52d0e0){return _0x52d0e0;});}return null;};}function removeEntity(_0x27f42,_0xcafec4){return function(_0x100bcd){if(_0x100bcd){return _0x100bcd['destroy']()['then'](function(){var _0xfb0d47=_0x100bcd[_0xd2bd('0x26')]({'plain':!![]});var _0x3507dc=_0xd2bd('0x27');return db[_0xd2bd('0x28')][_0xd2bd('0x29')]({'where':{'type':_0x3507dc,'resourceId':_0xfb0d47['id']}})['then'](function(){return _0x100bcd;});})[_0xd2bd('0x2a')](function(){_0x27f42[_0xd2bd('0x1d')](0xcc)[_0xd2bd('0x2b')]();});}};}function handleEntityNotFound(_0x1468d8,_0x316d83){return function(_0x308174){if(!_0x308174){_0x1468d8[_0xd2bd('0x1c')](0x194);}return _0x308174;};}function handleError(_0xe0c436,_0x31eb18){_0x31eb18=_0x31eb18||0x1f4;return function(_0x544fd0){logger[_0xd2bd('0x2c')](_0x544fd0[_0xd2bd('0x2d')]);if(_0x544fd0[_0xd2bd('0x2e')]){delete _0x544fd0['name'];}_0xe0c436[_0xd2bd('0x1d')](_0x31eb18)[_0xd2bd('0x2f')](_0x544fd0);};}exports[_0xd2bd('0x30')]=function(_0x146053,_0x16bbf3){var _0x155228={},_0x3021a5={},_0x1dcfd2={'count':0x0,'rows':[]};var _0x111a56=_[_0xd2bd('0x31')](db[_0xd2bd('0x32')]['rawAttributes'],function(_0x302a4a){return{'name':_0x302a4a['fieldName'],'type':_0x302a4a['type'][_0xd2bd('0x33')]};});_0x3021a5['model']=_[_0xd2bd('0x31')](_0x111a56,_0xd2bd('0x2e'));_0x3021a5[_0xd2bd('0x34')]=_[_0xd2bd('0x35')](_0x146053[_0xd2bd('0x34')]);_0x3021a5[_0xd2bd('0x36')]=_['intersection'](_0x3021a5['model'],_0x3021a5[_0xd2bd('0x34')]);_0x155228[_0xd2bd('0x37')]=_['intersection'](_0x3021a5[_0xd2bd('0x38')],qs[_0xd2bd('0x39')](_0x146053[_0xd2bd('0x34')][_0xd2bd('0x39')]));_0x155228[_0xd2bd('0x37')]=_0x155228[_0xd2bd('0x37')][_0xd2bd('0x3a')]?_0x155228[_0xd2bd('0x37')]:_0x3021a5[_0xd2bd('0x38')];if(!_0x146053[_0xd2bd('0x34')][_0xd2bd('0x3b')](_0xd2bd('0x3c'))){_0x155228[_0xd2bd('0x3d')]=qs[_0xd2bd('0x3d')](_0x146053[_0xd2bd('0x34')][_0xd2bd('0x3d')]);_0x155228[_0xd2bd('0x1f')]=qs[_0xd2bd('0x1f')](_0x146053[_0xd2bd('0x34')][_0xd2bd('0x1f')]);}_0x155228[_0xd2bd('0x3e')]=qs['sort'](_0x146053[_0xd2bd('0x34')][_0xd2bd('0x3f')]);_0x155228[_0xd2bd('0x40')]=qs[_0xd2bd('0x36')](_[_0xd2bd('0x41')](_0x146053[_0xd2bd('0x34')],_0x3021a5[_0xd2bd('0x36')]),_0x111a56);if(_0x146053[_0xd2bd('0x34')]['filter']){_0x155228[_0xd2bd('0x40')]=_['merge'](_0x155228[_0xd2bd('0x40')],{'$or':_[_0xd2bd('0x31')](_0x111a56,function(_0x43e9e5){if(_0x43e9e5[_0xd2bd('0x42')]!==_0xd2bd('0x43')){var _0x6d67c0={};_0x6d67c0[_0x43e9e5['name']]={'$like':'%'+_0x146053[_0xd2bd('0x34')][_0xd2bd('0x44')]+'%'};return _0x6d67c0;}})});}_0x155228=_[_0xd2bd('0x45')]({},_0x155228,_0x146053[_0xd2bd('0x46')]);var _0x2e56e5={'where':_0x155228[_0xd2bd('0x40')]};return db[_0xd2bd('0x32')][_0xd2bd('0x47')](_0x2e56e5)[_0xd2bd('0x2a')](function(_0x2465ea){_0x1dcfd2[_0xd2bd('0x47')]=_0x2465ea;if(_0x146053[_0xd2bd('0x34')]['includeAll']){_0x155228[_0xd2bd('0x48')]=[{'all':!![]}];}return db[_0xd2bd('0x32')][_0xd2bd('0x49')](_0x155228);})['then'](function(_0x3b197c){_0x1dcfd2[_0xd2bd('0x4a')]=_0x3b197c;return _0x1dcfd2;})['then'](respondWithFilteredResult(_0x16bbf3,_0x155228))[_0xd2bd('0x4b')](handleError(_0x16bbf3,null));};exports[_0xd2bd('0x4c')]=function(_0x4377d3,_0x500a99){var _0x12a41e={'raw':![],'where':{'id':_0x4377d3[_0xd2bd('0x4d')]['id']}},_0x58ea9d={};_0x58ea9d[_0xd2bd('0x38')]=_['keys'](db['SquareProject'][_0xd2bd('0x4e')]);_0x58ea9d[_0xd2bd('0x34')]=_[_0xd2bd('0x35')](_0x4377d3[_0xd2bd('0x34')]);_0x58ea9d[_0xd2bd('0x36')]=_[_0xd2bd('0x4f')](_0x58ea9d['model'],_0x58ea9d['query']);_0x12a41e[_0xd2bd('0x37')]=_[_0xd2bd('0x4f')](_0x58ea9d[_0xd2bd('0x38')],qs[_0xd2bd('0x39')](_0x4377d3[_0xd2bd('0x34')][_0xd2bd('0x39')]));_0x12a41e[_0xd2bd('0x37')]=_0x12a41e[_0xd2bd('0x37')][_0xd2bd('0x3a')]?_0x12a41e[_0xd2bd('0x37')]:_0x58ea9d[_0xd2bd('0x38')];if(_0x4377d3[_0xd2bd('0x34')][_0xd2bd('0x50')]){_0x12a41e[_0xd2bd('0x48')]=[{'all':!![]}];}_0x12a41e=_[_0xd2bd('0x45')]({},_0x12a41e,_0x4377d3[_0xd2bd('0x46')]);return db[_0xd2bd('0x32')][_0xd2bd('0x51')](_0x12a41e)[_0xd2bd('0x2a')](handleEntityNotFound(_0x500a99,null))[_0xd2bd('0x2a')](respondWithResult(_0x500a99,null))[_0xd2bd('0x4b')](handleError(_0x500a99,null));};exports[_0xd2bd('0x52')]=function(_0x8138e3,_0x315811){return db[_0xd2bd('0x32')][_0xd2bd('0x52')](_0x8138e3[_0xd2bd('0x53')],{})['then'](function(_0x2c503a){var _0x3d9fac=_0x8138e3[_0xd2bd('0x54')][_0xd2bd('0x26')]({'plain':!![]});if(!_0x3d9fac)throw new Error(_0xd2bd('0x55'));if(_0x3d9fac[_0xd2bd('0x56')]===_0xd2bd('0x54')){var _0x8db9dd=_0x2c503a[_0xd2bd('0x26')]({'plain':!![]});var _0x493d4c=_0xd2bd('0x27');return db[_0xd2bd('0x57')][_0xd2bd('0x51')]({'where':{'name':_0x493d4c,'userProfileId':_0x3d9fac[_0xd2bd('0x58')]},'raw':!![]})[_0xd2bd('0x2a')](function(_0xf9064d){if(_0xf9064d&&_0xf9064d[_0xd2bd('0x59')]===0x0){return db['UserProfileResource'][_0xd2bd('0x52')]({'name':_0x8db9dd[_0xd2bd('0x2e')],'resourceId':_0x8db9dd['id'],'type':_0xf9064d[_0xd2bd('0x2e')],'sectionId':_0xf9064d['id']},{})['then'](function(){return _0x2c503a;});}else{return _0x2c503a;}})[_0xd2bd('0x4b')](function(_0x2a61e2){logger[_0xd2bd('0x2c')](_0xd2bd('0x5a'),_0x2a61e2);throw _0x2a61e2;});}return _0x2c503a;})[_0xd2bd('0x2a')](respondWithResult(_0x315811,0xc9))[_0xd2bd('0x4b')](handleError(_0x315811,null));};exports[_0xd2bd('0x25')]=function(_0x12ebd5,_0x563e64){if(_0x12ebd5[_0xd2bd('0x53')]['id']){delete _0x12ebd5['body']['id'];}return db[_0xd2bd('0x32')]['find']({'where':{'id':_0x12ebd5[_0xd2bd('0x4d')]['id']}})[_0xd2bd('0x2a')](handleEntityNotFound(_0x563e64,null))[_0xd2bd('0x2a')](saveUpdates(_0x12ebd5[_0xd2bd('0x53')],null))[_0xd2bd('0x2a')](respondWithResult(_0x563e64,null))['catch'](handleError(_0x563e64,null));};exports[_0xd2bd('0x29')]=function(_0x4c0418,_0x33a221){return db[_0xd2bd('0x32')][_0xd2bd('0x51')]({'where':{'id':_0x4c0418[_0xd2bd('0x4d')]['id']}})[_0xd2bd('0x2a')](handleEntityNotFound(_0x33a221,null))['then'](removeEntity(_0x33a221,null))[_0xd2bd('0x4b')](handleError(_0x33a221,null));};exports[_0xd2bd('0x5b')]=function(_0x34143b,_0x397242,_0x26d209){return db['SquareProject'][_0xd2bd('0x51')]({'where':{'id':_0x34143b[_0xd2bd('0x4d')]['id']}})[_0xd2bd('0x2a')](handleEntityNotFound(_0x397242,null))[_0xd2bd('0x2a')](function(_0x12d722){if(_0x12d722){return _0x12d722['addUsers'](_0x34143b[_0xd2bd('0x53')][_0xd2bd('0x5c')],_[_0xd2bd('0x5d')](_0x34143b[_0xd2bd('0x53')],[_0xd2bd('0x5c'),'id'])||{});}})[_0xd2bd('0x2a')](respondWithResult(_0x397242,null))[_0xd2bd('0x4b')](handleError(_0x397242,null));};exports[_0xd2bd('0x5e')]=function(_0x4f89e0,_0x5b29e4,_0xbcfde8){return db[_0xd2bd('0x32')]['find']({'where':{'id':_0x4f89e0[_0xd2bd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b29e4,null))[_0xd2bd('0x2a')](function(_0x2ef69a){if(_0x2ef69a){return _0x2ef69a['removeUsers'](_0x4f89e0[_0xd2bd('0x34')]['ids'])[_0xd2bd('0x2a')](function(){if(_[_0xd2bd('0x5f')](_0x4f89e0[_0xd2bd('0x34')][_0xd2bd('0x5c')])){for(var _0x210191=0x0;_0x210191<_0x4f89e0[_0xd2bd('0x34')]['ids'][_0xd2bd('0x3a')];_0x210191+=0x1){socket[_0xd2bd('0x60')](_0xd2bd('0x61'),{'UserId':Number(_0x4f89e0[_0xd2bd('0x34')]['ids'][_0x210191]),'SquareProjectId':Number(_0x4f89e0[_0xd2bd('0x4d')]['id'])});}}else{socket[_0xd2bd('0x60')]('userSquareProject:remove',{'UserId':Number(_0x4f89e0['query'][_0xd2bd('0x5c')]),'SquareProjectId':Number(_0x4f89e0[_0xd2bd('0x4d')]['id'])});}});}})[_0xd2bd('0x2a')](respondWithStatusCode(_0x5b29e4,null))[_0xd2bd('0x4b')](handleError(_0x5b29e4,null));};exports['getUsers']=function(_0x238d0a,_0x1351af,_0x3b468e){var _0x4b013d={};var _0x32c5c1={};var _0x36edf9;var _0x534f69;return db['SquareProject']['findOne']({'where':{'id':_0x238d0a[_0xd2bd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1351af,null))[_0xd2bd('0x2a')](function(_0x425c83){if(_0x425c83){_0x36edf9=_0x425c83;_0x32c5c1[_0xd2bd('0x38')]=_[_0xd2bd('0x35')](db['User'][_0xd2bd('0x4e')]);_0x32c5c1['query']=_[_0xd2bd('0x35')](_0x238d0a[_0xd2bd('0x34')]);_0x32c5c1['filters']=_[_0xd2bd('0x4f')](_0x32c5c1[_0xd2bd('0x38')],_0x32c5c1['query']);_0x4b013d[_0xd2bd('0x37')]=_[_0xd2bd('0x4f')](_0x32c5c1[_0xd2bd('0x38')],qs[_0xd2bd('0x39')](_0x238d0a[_0xd2bd('0x34')][_0xd2bd('0x39')]));_0x4b013d[_0xd2bd('0x37')]=_0x4b013d[_0xd2bd('0x37')][_0xd2bd('0x3a')]?_0x4b013d[_0xd2bd('0x37')]:_0x32c5c1[_0xd2bd('0x38')];_0x4b013d[_0xd2bd('0x3e')]=qs[_0xd2bd('0x3f')](_0x238d0a[_0xd2bd('0x34')][_0xd2bd('0x3f')]);_0x4b013d[_0xd2bd('0x40')]=qs[_0xd2bd('0x36')](_[_0xd2bd('0x41')](_0x238d0a[_0xd2bd('0x34')],_0x32c5c1[_0xd2bd('0x36')]));if(_0x238d0a[_0xd2bd('0x34')][_0xd2bd('0x44')]){_0x4b013d[_0xd2bd('0x40')]=_['merge'](_0x4b013d[_0xd2bd('0x40')],{'$or':_[_0xd2bd('0x31')](_0x4b013d[_0xd2bd('0x37')],function(_0x4d9539){var _0xba35b={};_0xba35b[_0x4d9539]={'$like':'%'+_0x238d0a['query'][_0xd2bd('0x44')]+'%'};return _0xba35b;})});}_0x4b013d=_['merge']({},_0x4b013d,_0x238d0a[_0xd2bd('0x46')]);return _0x36edf9[_0xd2bd('0x62')](_0x4b013d);}})[_0xd2bd('0x2a')](function(_0x3025ea){if(_0x3025ea){_0x534f69=_0x3025ea['length'];if(!_0x238d0a[_0xd2bd('0x34')][_0xd2bd('0x3b')](_0xd2bd('0x3c'))){_0x4b013d[_0xd2bd('0x3d')]=qs[_0xd2bd('0x3d')](_0x238d0a[_0xd2bd('0x34')][_0xd2bd('0x3d')]);_0x4b013d[_0xd2bd('0x1f')]=qs[_0xd2bd('0x1f')](_0x238d0a[_0xd2bd('0x34')]['offset']);}return _0x36edf9[_0xd2bd('0x62')](_0x4b013d);}})[_0xd2bd('0x2a')](function(_0x13f1f4){if(_0x13f1f4){return _0x13f1f4?{'count':_0x534f69,'rows':_0x13f1f4}:null;}})[_0xd2bd('0x2a')](respondWithResult(_0x1351af,null))['catch'](handleError(_0x1351af,null));}; \ No newline at end of file +var _0xa795=['sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','merge','hasOwnProperty','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','nolimit'];(function(_0x1d855d,_0x4d784d){var _0x3be1ab=function(_0x27c74a){while(--_0x27c74a){_0x1d855d['push'](_0x1d855d['shift']());}};_0x3be1ab(++_0x4d784d);}(_0xa795,0xe3));var _0x5a79=function(_0x237711,_0x397b33){_0x237711=_0x237711-0x0;var _0x3a1f7c=_0xa795[_0x237711];return _0x3a1f7c;};'use strict';var pdf=require(_0x5a79('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5a79('0x1'));var zipdir=require(_0x5a79('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a79('0x3'));var moment=require(_0x5a79('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5a79('0x5'));var util=require(_0x5a79('0x6'));var path=require(_0x5a79('0x7'));var sox=require(_0x5a79('0x8'));var csv=require(_0x5a79('0x9'));var ejs=require(_0x5a79('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a79('0xb'));var crypto=require(_0x5a79('0xc'));var jsforce=require(_0x5a79('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5a79('0x9'));var querystring=require(_0x5a79('0xe'));var Papa=require(_0x5a79('0xf'));var Redis=require(_0x5a79('0x10'));var authService=require(_0x5a79('0x11'));var qs=require(_0x5a79('0x12'));var as=require(_0x5a79('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a79('0x14'))(_0x5a79('0x15'));var utils=require(_0x5a79('0x16'));var config=require(_0x5a79('0x17'));var db=require('../../mysqldb')['db'];config[_0x5a79('0x18')]=_[_0x5a79('0x19')](config['redis'],{'host':_0x5a79('0x1a'),'port':0x18eb});var socket=require(_0x5a79('0x1b'))(new Redis(config['redis']));require(_0x5a79('0x1c'))[_0x5a79('0x1d')](socket);function respondWithStatusCode(_0x3285bc,_0x2d0dc9){_0x2d0dc9=_0x2d0dc9||0xcc;return function(_0xdcaf3f){if(_0xdcaf3f){return _0x3285bc[_0x5a79('0x1e')](_0x2d0dc9);}return _0x3285bc[_0x5a79('0x1f')](_0x2d0dc9)['end']();};}function respondWithResult(_0x39a257,_0x99c468){_0x99c468=_0x99c468||0xc8;return function(_0xe94b3f){if(_0xe94b3f){return _0x39a257['status'](_0x99c468)[_0x5a79('0x20')](_0xe94b3f);}};}function respondWithFilteredResult(_0x91fbd4,_0x5902e7){return function(_0x745566){if(_0x745566){var _0x3165c9=_0x745566[_0x5a79('0x21')],_0x3966e6=_0x5902e7['offset'],_0x5ce8f1=_0x5902e7[_0x5a79('0x22')]+_0x5902e7[_0x5a79('0x23')],_0xc6613a;if(_0x5ce8f1>=_0x3165c9){_0x5ce8f1=_0x3165c9;_0xc6613a=0xc8;}else{_0xc6613a=0xce;}_0x91fbd4[_0x5a79('0x1f')](_0xc6613a);return _0x91fbd4[_0x5a79('0x24')]('Content-Range',_0x3966e6+'-'+_0x5ce8f1+'/'+_0x3165c9)[_0x5a79('0x20')](_0x745566);}return null;};}function patchUpdates(_0x14d092){return function(_0x1c3a4e){try{jsonpatch[_0x5a79('0x25')](_0x1c3a4e,_0x14d092,!![]);}catch(_0xfc97af){return BPromise[_0x5a79('0x26')](_0xfc97af);}return _0x1c3a4e['save']();};}function saveUpdates(_0x57c595,_0x244220){return function(_0x53d287){if(_0x53d287){return _0x53d287[_0x5a79('0x27')](_0x57c595)[_0x5a79('0x28')](function(_0x3ebee0){return _0x3ebee0;});}return null;};}function removeEntity(_0x5ac607,_0x14601a){return function(_0x20d857){if(_0x20d857){return _0x20d857[_0x5a79('0x29')]()[_0x5a79('0x28')](function(){var _0x1bddf9=_0x20d857[_0x5a79('0x2a')]({'plain':!![]});var _0x24398c=_0x5a79('0x2b');return db[_0x5a79('0x2c')][_0x5a79('0x29')]({'where':{'type':_0x24398c,'resourceId':_0x1bddf9['id']}})[_0x5a79('0x28')](function(){return _0x20d857;});})[_0x5a79('0x28')](function(){_0x5ac607[_0x5a79('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f656d,_0x17f729){return function(_0x2b42a4){if(!_0x2b42a4){_0x1f656d[_0x5a79('0x1e')](0x194);}return _0x2b42a4;};}function handleError(_0x57b272,_0x12e6e9){_0x12e6e9=_0x12e6e9||0x1f4;return function(_0x545a9e){logger['error'](_0x545a9e['stack']);if(_0x545a9e['name']){delete _0x545a9e[_0x5a79('0x2d')];}_0x57b272[_0x5a79('0x1f')](_0x12e6e9)[_0x5a79('0x2e')](_0x545a9e);};}exports[_0x5a79('0x2f')]=function(_0x35adc7,_0x35c9a6){var _0x4476e1={},_0x4b5acd={},_0x23a68c={'count':0x0,'rows':[]};var _0x714821=_[_0x5a79('0x30')](db[_0x5a79('0x31')][_0x5a79('0x32')],function(_0x50d7c6){return{'name':_0x50d7c6[_0x5a79('0x33')],'type':_0x50d7c6[_0x5a79('0x34')][_0x5a79('0x35')]};});_0x4b5acd[_0x5a79('0x36')]=_[_0x5a79('0x30')](_0x714821,_0x5a79('0x2d'));_0x4b5acd['query']=_[_0x5a79('0x37')](_0x35adc7['query']);_0x4b5acd['filters']=_[_0x5a79('0x38')](_0x4b5acd[_0x5a79('0x36')],_0x4b5acd[_0x5a79('0x39')]);_0x4476e1[_0x5a79('0x3a')]=_[_0x5a79('0x38')](_0x4b5acd[_0x5a79('0x36')],qs[_0x5a79('0x3b')](_0x35adc7[_0x5a79('0x39')][_0x5a79('0x3b')]));_0x4476e1[_0x5a79('0x3a')]=_0x4476e1[_0x5a79('0x3a')]['length']?_0x4476e1[_0x5a79('0x3a')]:_0x4b5acd['model'];if(!_0x35adc7['query']['hasOwnProperty'](_0x5a79('0x3c'))){_0x4476e1['limit']=qs[_0x5a79('0x23')](_0x35adc7[_0x5a79('0x39')]['limit']);_0x4476e1['offset']=qs[_0x5a79('0x22')](_0x35adc7['query'][_0x5a79('0x22')]);}_0x4476e1['order']=qs[_0x5a79('0x3d')](_0x35adc7[_0x5a79('0x39')]['sort']);_0x4476e1[_0x5a79('0x3e')]=qs['filters'](_[_0x5a79('0x3f')](_0x35adc7['query'],_0x4b5acd[_0x5a79('0x40')]),_0x714821);if(_0x35adc7[_0x5a79('0x39')][_0x5a79('0x41')]){_0x4476e1[_0x5a79('0x3e')]=_['merge'](_0x4476e1[_0x5a79('0x3e')],{'$or':_[_0x5a79('0x30')](_0x714821,function(_0x1575b7){if(_0x1575b7[_0x5a79('0x34')]!=='VIRTUAL'){var _0x1dbc6a={};_0x1dbc6a[_0x1575b7['name']]={'$like':'%'+_0x35adc7[_0x5a79('0x39')][_0x5a79('0x41')]+'%'};return _0x1dbc6a;}})});}_0x4476e1=_['merge']({},_0x4476e1,_0x35adc7[_0x5a79('0x42')]);var _0x54707b={'where':_0x4476e1['where']};return db[_0x5a79('0x31')][_0x5a79('0x21')](_0x54707b)['then'](function(_0x3102d6){_0x23a68c[_0x5a79('0x21')]=_0x3102d6;if(_0x35adc7[_0x5a79('0x39')][_0x5a79('0x43')]){_0x4476e1[_0x5a79('0x44')]=[{'all':!![]}];}return db[_0x5a79('0x31')][_0x5a79('0x45')](_0x4476e1);})['then'](function(_0x289663){_0x23a68c[_0x5a79('0x46')]=_0x289663;return _0x23a68c;})[_0x5a79('0x28')](respondWithFilteredResult(_0x35c9a6,_0x4476e1))[_0x5a79('0x47')](handleError(_0x35c9a6,null));};exports['show']=function(_0x3289cb,_0x5b45bf){var _0x329a02={'raw':![],'where':{'id':_0x3289cb[_0x5a79('0x48')]['id']}},_0x30a8b4={};_0x30a8b4[_0x5a79('0x36')]=_['keys'](db[_0x5a79('0x31')]['rawAttributes']);_0x30a8b4[_0x5a79('0x39')]=_[_0x5a79('0x37')](_0x3289cb[_0x5a79('0x39')]);_0x30a8b4[_0x5a79('0x40')]=_[_0x5a79('0x38')](_0x30a8b4[_0x5a79('0x36')],_0x30a8b4['query']);_0x329a02['attributes']=_[_0x5a79('0x38')](_0x30a8b4['model'],qs[_0x5a79('0x3b')](_0x3289cb[_0x5a79('0x39')][_0x5a79('0x3b')]));_0x329a02[_0x5a79('0x3a')]=_0x329a02[_0x5a79('0x3a')][_0x5a79('0x49')]?_0x329a02[_0x5a79('0x3a')]:_0x30a8b4[_0x5a79('0x36')];if(_0x3289cb[_0x5a79('0x39')][_0x5a79('0x43')]){_0x329a02[_0x5a79('0x44')]=[{'all':!![]}];}_0x329a02=_['merge']({},_0x329a02,_0x3289cb['options']);return db[_0x5a79('0x31')][_0x5a79('0x4a')](_0x329a02)[_0x5a79('0x28')](handleEntityNotFound(_0x5b45bf,null))[_0x5a79('0x28')](respondWithResult(_0x5b45bf,null))[_0x5a79('0x47')](handleError(_0x5b45bf,null));};exports[_0x5a79('0x4b')]=function(_0x491f46,_0x2b7793){return db[_0x5a79('0x31')][_0x5a79('0x4b')](_0x491f46[_0x5a79('0x4c')],{})['then'](function(_0x31892f){var _0x5c7d1d=_0x491f46[_0x5a79('0x4d')][_0x5a79('0x2a')]({'plain':!![]});if(!_0x5c7d1d)throw new Error(_0x5a79('0x4e'));if(_0x5c7d1d[_0x5a79('0x4f')]===_0x5a79('0x4d')){var _0x4c4fe4=_0x31892f[_0x5a79('0x2a')]({'plain':!![]});var _0x26345d=_0x5a79('0x2b');return db[_0x5a79('0x50')][_0x5a79('0x4a')]({'where':{'name':_0x26345d,'userProfileId':_0x5c7d1d[_0x5a79('0x51')]},'raw':!![]})[_0x5a79('0x28')](function(_0x3cd4b1){if(_0x3cd4b1&&_0x3cd4b1[_0x5a79('0x52')]===0x0){return db[_0x5a79('0x2c')][_0x5a79('0x4b')]({'name':_0x4c4fe4[_0x5a79('0x2d')],'resourceId':_0x4c4fe4['id'],'type':_0x3cd4b1[_0x5a79('0x2d')],'sectionId':_0x3cd4b1['id']},{})[_0x5a79('0x28')](function(){return _0x31892f;});}else{return _0x31892f;}})['catch'](function(_0x37e2f5){logger[_0x5a79('0x53')](_0x5a79('0x54'),_0x37e2f5);throw _0x37e2f5;});}return _0x31892f;})['then'](respondWithResult(_0x2b7793,0xc9))[_0x5a79('0x47')](handleError(_0x2b7793,null));};exports[_0x5a79('0x27')]=function(_0x2167d3,_0x12690b){if(_0x2167d3[_0x5a79('0x4c')]['id']){delete _0x2167d3['body']['id'];}return db[_0x5a79('0x31')][_0x5a79('0x4a')]({'where':{'id':_0x2167d3[_0x5a79('0x48')]['id']}})['then'](handleEntityNotFound(_0x12690b,null))[_0x5a79('0x28')](saveUpdates(_0x2167d3['body'],null))[_0x5a79('0x28')](respondWithResult(_0x12690b,null))[_0x5a79('0x47')](handleError(_0x12690b,null));};exports[_0x5a79('0x29')]=function(_0x549607,_0x341b5d){return db['SquareProject']['find']({'where':{'id':_0x549607[_0x5a79('0x48')]['id']}})['then'](handleEntityNotFound(_0x341b5d,null))[_0x5a79('0x28')](removeEntity(_0x341b5d,null))['catch'](handleError(_0x341b5d,null));};exports['addUsers']=function(_0xba1bf7,_0x4e0afb,_0x265ab9){return db['SquareProject'][_0x5a79('0x4a')]({'where':{'id':_0xba1bf7['params']['id']}})[_0x5a79('0x28')](handleEntityNotFound(_0x4e0afb,null))[_0x5a79('0x28')](function(_0x5a7d5b){if(_0x5a7d5b){return _0x5a7d5b[_0x5a79('0x55')](_0xba1bf7[_0x5a79('0x4c')]['ids'],_[_0x5a79('0x56')](_0xba1bf7[_0x5a79('0x4c')],[_0x5a79('0x57'),'id'])||{});}})[_0x5a79('0x28')](respondWithResult(_0x4e0afb,null))[_0x5a79('0x47')](handleError(_0x4e0afb,null));};exports[_0x5a79('0x58')]=function(_0x4b0854,_0x436af7,_0x49243a){return db[_0x5a79('0x31')][_0x5a79('0x4a')]({'where':{'id':_0x4b0854[_0x5a79('0x48')]['id']}})[_0x5a79('0x28')](handleEntityNotFound(_0x436af7,null))[_0x5a79('0x28')](function(_0x42d33b){if(_0x42d33b){return _0x42d33b[_0x5a79('0x58')](_0x4b0854[_0x5a79('0x39')]['ids'])[_0x5a79('0x28')](function(){if(_[_0x5a79('0x59')](_0x4b0854[_0x5a79('0x39')][_0x5a79('0x57')])){for(var _0x4a81e3=0x0;_0x4a81e3<_0x4b0854[_0x5a79('0x39')][_0x5a79('0x57')][_0x5a79('0x49')];_0x4a81e3+=0x1){socket[_0x5a79('0x5a')](_0x5a79('0x5b'),{'UserId':Number(_0x4b0854[_0x5a79('0x39')][_0x5a79('0x57')][_0x4a81e3]),'SquareProjectId':Number(_0x4b0854[_0x5a79('0x48')]['id'])});}}else{socket[_0x5a79('0x5a')](_0x5a79('0x5b'),{'UserId':Number(_0x4b0854[_0x5a79('0x39')][_0x5a79('0x57')]),'SquareProjectId':Number(_0x4b0854['params']['id'])});}});}})[_0x5a79('0x28')](respondWithStatusCode(_0x436af7,null))['catch'](handleError(_0x436af7,null));};exports[_0x5a79('0x5c')]=function(_0x38608c,_0x23e701,_0x414c09){var _0x2eba32={};var _0xde91c3={};var _0x5df820;var _0x40d4e6;return db[_0x5a79('0x31')][_0x5a79('0x5d')]({'where':{'id':_0x38608c[_0x5a79('0x48')]['id']}})['then'](handleEntityNotFound(_0x23e701,null))[_0x5a79('0x28')](function(_0x43cd67){if(_0x43cd67){_0x5df820=_0x43cd67;_0xde91c3[_0x5a79('0x36')]=_[_0x5a79('0x37')](db['User'][_0x5a79('0x32')]);_0xde91c3[_0x5a79('0x39')]=_[_0x5a79('0x37')](_0x38608c[_0x5a79('0x39')]);_0xde91c3['filters']=_['intersection'](_0xde91c3[_0x5a79('0x36')],_0xde91c3[_0x5a79('0x39')]);_0x2eba32[_0x5a79('0x3a')]=_[_0x5a79('0x38')](_0xde91c3['model'],qs[_0x5a79('0x3b')](_0x38608c['query']['fields']));_0x2eba32[_0x5a79('0x3a')]=_0x2eba32[_0x5a79('0x3a')]['length']?_0x2eba32[_0x5a79('0x3a')]:_0xde91c3[_0x5a79('0x36')];_0x2eba32['order']=qs[_0x5a79('0x3d')](_0x38608c[_0x5a79('0x39')][_0x5a79('0x3d')]);_0x2eba32[_0x5a79('0x3e')]=qs[_0x5a79('0x40')](_[_0x5a79('0x3f')](_0x38608c[_0x5a79('0x39')],_0xde91c3[_0x5a79('0x40')]));if(_0x38608c[_0x5a79('0x39')][_0x5a79('0x41')]){_0x2eba32[_0x5a79('0x3e')]=_[_0x5a79('0x5e')](_0x2eba32[_0x5a79('0x3e')],{'$or':_[_0x5a79('0x30')](_0x2eba32['attributes'],function(_0x414846){var _0x2ee342={};_0x2ee342[_0x414846]={'$like':'%'+_0x38608c[_0x5a79('0x39')][_0x5a79('0x41')]+'%'};return _0x2ee342;})});}_0x2eba32=_[_0x5a79('0x5e')]({},_0x2eba32,_0x38608c[_0x5a79('0x42')]);return _0x5df820[_0x5a79('0x5c')](_0x2eba32);}})[_0x5a79('0x28')](function(_0x548d28){if(_0x548d28){_0x40d4e6=_0x548d28[_0x5a79('0x49')];if(!_0x38608c[_0x5a79('0x39')][_0x5a79('0x5f')](_0x5a79('0x3c'))){_0x2eba32[_0x5a79('0x23')]=qs[_0x5a79('0x23')](_0x38608c[_0x5a79('0x39')][_0x5a79('0x23')]);_0x2eba32[_0x5a79('0x22')]=qs['offset'](_0x38608c[_0x5a79('0x39')][_0x5a79('0x22')]);}return _0x5df820[_0x5a79('0x5c')](_0x2eba32);}})[_0x5a79('0x28')](function(_0x265508){if(_0x265508){return _0x265508?{'count':_0x40d4e6,'rows':_0x265508}:null;}})['then'](respondWithResult(_0x23e701,null))[_0x5a79('0x47')](handleError(_0x23e701,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d7ac594..864bdd8 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 _0x5f51=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x149fb9,_0x257326){var _0x36399a=function(_0x1169c4){while(--_0x1169c4){_0x149fb9['push'](_0x149fb9['shift']());}};_0x36399a(++_0x257326);}(_0x5f51,0x9d));var _0x15f5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5f51[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x15f5('0x0'));var SquareProject=require(_0x15f5('0x1'))['db'][_0x15f5('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x15f5('0x3')](0x0);var events={'afterCreate':_0x15f5('0x4'),'afterUpdate':_0x15f5('0x5'),'afterDestroy':_0x15f5('0x6')};function emitEvent(_0x3db49e){return function(_0x46557b,_0x357623,_0x2f5c2f){SquareProjectEvents[_0x15f5('0x7')](_0x3db49e+':'+_0x46557b['id'],_0x46557b);SquareProjectEvents[_0x15f5('0x7')](_0x3db49e,_0x46557b);_0x2f5c2f(null);};}for(var e in events){if(events[_0x15f5('0x8')](e)){var event=events[e];SquareProject[_0x15f5('0x9')](e,emitEvent(event));}}module[_0x15f5('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x46ba=['hasOwnProperty','events','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x46ba,0xd9));var _0xa46b=function(_0x5cd889,_0x180ed4){_0x5cd889=_0x5cd889-0x0;var _0x3f95dc=_0x46ba[_0x5cd889];return _0x3f95dc;};'use strict';var EventEmitter=require(_0xa46b('0x0'));var SquareProject=require(_0xa46b('0x1'))['db'][_0xa46b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa46b('0x3'),'afterUpdate':_0xa46b('0x4'),'afterDestroy':_0xa46b('0x5')};function emitEvent(_0x3b9851){return function(_0x591aa9,_0x27ef46,_0x5a366d){SquareProjectEvents[_0xa46b('0x6')](_0x3b9851+':'+_0x591aa9['id'],_0x591aa9);SquareProjectEvents[_0xa46b('0x6')](_0x3b9851,_0x591aa9);_0x5a366d(null);};}for(var e in events){if(events[_0xa46b('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3fe5adf..a3a7998 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 _0x2ef3=['exports','define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareProject.attributes'];(function(_0x5efe2f,_0x2e7e7e){var _0x15550a=function(_0x516cb3){while(--_0x516cb3){_0x5efe2f['push'](_0x5efe2f['shift']());}};_0x15550a(++_0x2e7e7e);}(_0x2ef3,0xba));var _0x32ef=function(_0x434aa3,_0x2585e8){_0x434aa3=_0x434aa3-0x0;var _0x1d4eef=_0x2ef3[_0x434aa3];return _0x1d4eef;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','SquareProject','square_projects','util','api','moment','bluebird'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./squareProject.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9c911b8..b1de774 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 _0x6883=['find','options','raw','attributes','include','model','map','ShowSquareProject','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareProject'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x6883,0x143));var _0x3688=function(_0x252cc2,_0x1d343f){_0x252cc2=_0x252cc2-0x0;var _0xc53f00=_0x6883[_0x252cc2];return _0xc53f00;};'use strict';var _=require('lodash');var util=require(_0x3688('0x0'));var moment=require(_0x3688('0x1'));var BPromise=require(_0x3688('0x2'));var rs=require(_0x3688('0x3'));var fs=require('fs');var Redis=require(_0x3688('0x4'));var db=require(_0x3688('0x5'))['db'];var utils=require(_0x3688('0x6'));var logger=require(_0x3688('0x7'))(_0x3688('0x8'));var config=require('../../config/environment');var jayson=require(_0x3688('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3688('0xa')]=_[_0x3688('0xb')](config['redis'],{'host':_0x3688('0xc'),'port':0x18eb});var socket=require(_0x3688('0xd'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x20044d,_0x4717e7,_0x3bbb0e){return new BPromise(function(_0xf67909,_0x55c91d){return client['request'](_0x20044d,_0x3bbb0e)[_0x3688('0xe')](function(_0x35085e){logger[_0x3688('0xf')](_0x3688('0x10'),_0x4717e7,_0x3688('0x11'));logger[_0x3688('0x12')](_0x3688('0x13'),_0x4717e7,_0x3688('0x11'),JSON[_0x3688('0x14')](_0x35085e));if(_0x35085e[_0x3688('0x15')]){if(_0x35085e[_0x3688('0x15')][_0x3688('0x16')]===0x1f4){logger[_0x3688('0x15')]('SquareProject,\x20%s,\x20%s',_0x4717e7,_0x35085e['error']['message']);return _0x55c91d(_0x35085e[_0x3688('0x15')][_0x3688('0x17')]);}logger['error'](_0x3688('0x10'),_0x4717e7,_0x35085e['error'][_0x3688('0x17')]);return _0xf67909(_0x35085e['error']['message']);}else{logger[_0x3688('0xf')](_0x3688('0x10'),_0x4717e7,_0x3688('0x11'));_0xf67909(_0x35085e[_0x3688('0x18')][_0x3688('0x17')]);}})[_0x3688('0x19')](function(_0x173f43){logger[_0x3688('0x15')]('SquareProject,\x20%s,\x20%s',_0x4717e7,_0x173f43);_0x55c91d(_0x173f43);});});}exports['ShowSquareProject']=function(_0x5f435f){var _0x409d2d=this;return new Promise(function(_0x20c1d5,_0xbaa322){return db[_0x3688('0x1a')][_0x3688('0x1b')]({'raw':_0x5f435f['options']?_0x5f435f[_0x3688('0x1c')][_0x3688('0x1d')]===undefined?!![]:![]:!![],'where':_0x5f435f[_0x3688('0x1c')]?_0x5f435f[_0x3688('0x1c')]['where']||null:null,'attributes':_0x5f435f[_0x3688('0x1c')]?_0x5f435f['options'][_0x3688('0x1e')]||null:null,'include':_0x5f435f[_0x3688('0x1c')]?_0x5f435f[_0x3688('0x1c')][_0x3688('0x1f')]?_['map'](_0x5f435f[_0x3688('0x1c')][_0x3688('0x1f')],function(_0x2dd222){return{'model':db[_0x2dd222[_0x3688('0x20')]],'as':_0x2dd222['as'],'attributes':_0x2dd222[_0x3688('0x1e')],'include':_0x2dd222[_0x3688('0x1f')]?_['map'](_0x2dd222['include'],function(_0x202279){return{'model':db[_0x202279[_0x3688('0x20')]],'as':_0x202279['as'],'attributes':_0x202279['attributes'],'include':_0x202279[_0x3688('0x1f')]?_[_0x3688('0x21')](_0x202279[_0x3688('0x1f')],function(_0xa767c2){return{'model':db[_0xa767c2['model']],'as':_0xa767c2['as'],'attributes':_0xa767c2[_0x3688('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3688('0xe')](function(_0x228e2d){logger[_0x3688('0xf')](_0x3688('0x22'),_0x5f435f);logger[_0x3688('0x12')](_0x3688('0x22'),_0x5f435f,JSON[_0x3688('0x14')](_0x228e2d));_0x20c1d5(_0x228e2d);})['catch'](function(_0x5efff0){logger[_0x3688('0x15')]('ShowSquareProject',_0x5efff0[_0x3688('0x17')],_0x5f435f);_0xbaa322(_0x409d2d[_0x3688('0x15')](0x1f4,_0x5efff0['message']));});});}; \ No newline at end of file +var _0x8f7e=['client','http','redis','defaults','socket.io-emitter','./squareProject.socket','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareProject','find','options','raw','where','include','model','attributes','map','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8f7e,0x12a));var _0xe8f7=function(_0x5b3ccf,_0x52a11a){_0x5b3ccf=_0x5b3ccf-0x0;var _0x197442=_0x8f7e[_0x5b3ccf];return _0x197442;};'use strict';var _=require(_0xe8f7('0x0'));var util=require(_0xe8f7('0x1'));var moment=require('moment');var BPromise=require(_0xe8f7('0x2'));var rs=require(_0xe8f7('0x3'));var fs=require('fs');var Redis=require(_0xe8f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8f7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe8f7('0x6'));var jayson=require(_0xe8f7('0x7'));var client=jayson[_0xe8f7('0x8')][_0xe8f7('0x9')]({'port':0x232a});config[_0xe8f7('0xa')]=_[_0xe8f7('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8f7('0xc'))(new Redis(config[_0xe8f7('0xa')]));require(_0xe8f7('0xd'))['register'](socket);function respondWithRpcPromise(_0xf8fd92,_0x11b09e,_0xd37ef){return new BPromise(function(_0x1efdd7,_0x1f72fd){return client['request'](_0xf8fd92,_0xd37ef)['then'](function(_0x387e24){logger[_0xe8f7('0xe')](_0xe8f7('0xf'),_0x11b09e,_0xe8f7('0x10'));logger[_0xe8f7('0x11')](_0xe8f7('0x12'),_0x11b09e,_0xe8f7('0x10'),JSON[_0xe8f7('0x13')](_0x387e24));if(_0x387e24['error']){if(_0x387e24[_0xe8f7('0x14')]['code']===0x1f4){logger[_0xe8f7('0x14')](_0xe8f7('0xf'),_0x11b09e,_0x387e24['error']['message']);return _0x1f72fd(_0x387e24[_0xe8f7('0x14')][_0xe8f7('0x15')]);}logger[_0xe8f7('0x14')](_0xe8f7('0xf'),_0x11b09e,_0x387e24['error'][_0xe8f7('0x15')]);return _0x1efdd7(_0x387e24[_0xe8f7('0x14')][_0xe8f7('0x15')]);}else{logger['info'](_0xe8f7('0xf'),_0x11b09e,_0xe8f7('0x10'));_0x1efdd7(_0x387e24[_0xe8f7('0x16')]['message']);}})[_0xe8f7('0x17')](function(_0xbf7f71){logger[_0xe8f7('0x14')]('SquareProject,\x20%s,\x20%s',_0x11b09e,_0xbf7f71);_0x1f72fd(_0xbf7f71);});});}exports[_0xe8f7('0x18')]=function(_0x58615b){var _0x10bc0e=this;return new Promise(function(_0x408a6c,_0x1850f8){return db['SquareProject'][_0xe8f7('0x19')]({'raw':_0x58615b[_0xe8f7('0x1a')]?_0x58615b[_0xe8f7('0x1a')][_0xe8f7('0x1b')]===undefined?!![]:![]:!![],'where':_0x58615b[_0xe8f7('0x1a')]?_0x58615b[_0xe8f7('0x1a')][_0xe8f7('0x1c')]||null:null,'attributes':_0x58615b[_0xe8f7('0x1a')]?_0x58615b[_0xe8f7('0x1a')]['attributes']||null:null,'include':_0x58615b[_0xe8f7('0x1a')]?_0x58615b[_0xe8f7('0x1a')][_0xe8f7('0x1d')]?_['map'](_0x58615b[_0xe8f7('0x1a')]['include'],function(_0xa59538){return{'model':db[_0xa59538[_0xe8f7('0x1e')]],'as':_0xa59538['as'],'attributes':_0xa59538[_0xe8f7('0x1f')],'include':_0xa59538[_0xe8f7('0x1d')]?_[_0xe8f7('0x20')](_0xa59538[_0xe8f7('0x1d')],function(_0x36cad3){return{'model':db[_0x36cad3['model']],'as':_0x36cad3['as'],'attributes':_0x36cad3[_0xe8f7('0x1f')],'include':_0x36cad3[_0xe8f7('0x1d')]?_[_0xe8f7('0x20')](_0x36cad3['include'],function(_0x5005e8){return{'model':db[_0x5005e8['model']],'as':_0x5005e8['as'],'attributes':_0x5005e8[_0xe8f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe8f7('0x21')](function(_0xfb83a){logger[_0xe8f7('0xe')](_0xe8f7('0x18'),_0x58615b);logger[_0xe8f7('0x11')](_0xe8f7('0x18'),_0x58615b,JSON[_0xe8f7('0x13')](_0xfb83a));_0x408a6c(_0xfb83a);})['catch'](function(_0x18aed5){logger[_0xe8f7('0x14')](_0xe8f7('0x18'),_0x18aed5['message'],_0x58615b);_0x1850f8(_0x10bc0e[_0xe8f7('0x14')](0x1f4,_0x18aed5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7e30e46..c0a890b 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['removeListener','length','squareProject:','./squareProject.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x5670c8,_0x4d973f){_0x5670c8=_0x5670c8-0x0;var _0x62808d=_0x1623[_0x5670c8];return _0x62808d;};'use strict';var SquareProjectEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){SquareProjectEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);SquareProjectEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x5d51cf,_0x2f67e3){var _0x38894b=function(_0x2f5634){while(--_0x2f5634){_0x5d51cf['push'](_0x5d51cf['shift']());}};_0x38894b(++_0x2f67e3);}(_0x7a54,0x106));var _0x47a5=function(_0x258990,_0x2b7497){_0x258990=_0x258990-0x0;var _0x56aea4=_0x7a54[_0x258990];return _0x56aea4;};'use strict';var SquareProjectEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){SquareProjectEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);SquareProjectEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4f2b7d9..978a1aa 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 _0xa4d2=['/:id/delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update','delete'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa4d2,0xb3));var _0x2a4d=function(_0x68ea14,_0x147312){_0x68ea14=_0x68ea14-0x0;var _0x587d59=_0xa4d2[_0x68ea14];return _0x587d59;};'use strict';var multer=require(_0x2a4d('0x0'));var util=require(_0x2a4d('0x1'));var path=require(_0x2a4d('0x2'));var timeout=require(_0x2a4d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2a4d('0x4'));var interaction=require(_0x2a4d('0x5'));var config=require(_0x2a4d('0x6'));var controller=require(_0x2a4d('0x7'));router[_0x2a4d('0x8')]('/',auth[_0x2a4d('0x9')](),controller[_0x2a4d('0xa')]);router[_0x2a4d('0x8')](_0x2a4d('0xb'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0xc')]);router['get']('/:id/download',auth[_0x2a4d('0x9')](),controller[_0x2a4d('0xd')]);router[_0x2a4d('0xe')]('/',auth['isAuthenticated'](),controller[_0x2a4d('0xf')]);router[_0x2a4d('0x10')](_0x2a4d('0xb'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x11')]);router[_0x2a4d('0x12')](_0x2a4d('0x13'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x14')]);module[_0x2a4d('0x15')]=router; \ No newline at end of file +var _0x153a=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','download','post','create','put','delete','/:id/delete'];(function(_0xa7eeed,_0x39d47c){var _0x5d2a44=function(_0x5e634d){while(--_0x5e634d){_0xa7eeed['push'](_0xa7eeed['shift']());}};_0x5d2a44(++_0x39d47c);}(_0x153a,0xa1));var _0xa153=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x153a[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0xa153('0x0'));var util=require(_0xa153('0x1'));var path=require('path');var timeout=require(_0xa153('0x2'));var express=require(_0xa153('0x3'));var router=express[_0xa153('0x4')]();var auth=require(_0xa153('0x5'));var interaction=require(_0xa153('0x6'));var config=require(_0xa153('0x7'));var controller=require(_0xa153('0x8'));router['get']('/',auth[_0xa153('0x9')](),controller['index']);router[_0xa153('0xa')](_0xa153('0xb'),auth[_0xa153('0x9')](),controller[_0xa153('0xc')]);router[_0xa153('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xa153('0xd')]);router[_0xa153('0xe')]('/',auth['isAuthenticated'](),controller[_0xa153('0xf')]);router[_0xa153('0x10')](_0xa153('0xb'),auth[_0xa153('0x9')](),controller['update']);router[_0xa153('0x11')](_0xa153('0x12'),auth[_0xa153('0x9')](),controller[_0xa153('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 36afc0e..3236d1f 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 _0xbf49=['sequelize','exports','STRING','getDataValue','savePath','substring','lastIndexOf'];(function(_0x562fbc,_0x55bf93){var _0x45fb83=function(_0x9dcc45){while(--_0x9dcc45){_0x562fbc['push'](_0x562fbc['shift']());}};_0x45fb83(++_0x55bf93);}(_0xbf49,0x11f));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9bf4('0x0'));module[_0x9bf4('0x1')]={'uniqueid':{'type':Sequelize[_0x9bf4('0x2')]},'callerid':{'type':Sequelize[_0x9bf4('0x2')]},'calleridname':{'type':Sequelize[_0x9bf4('0x2')]},'context':{'type':Sequelize[_0x9bf4('0x2')]},'extension':{'type':Sequelize[_0x9bf4('0x2')]},'priority':{'type':Sequelize[_0x9bf4('0x2')]},'accountcode':{'type':Sequelize[_0x9bf4('0x2')]},'dnid':{'type':Sequelize[_0x9bf4('0x2')]},'projectName':{'type':Sequelize[_0x9bf4('0x2')]},'saveName':{'type':Sequelize[_0x9bf4('0x2')]},'filename':{'type':Sequelize[_0x9bf4('0x2')]},'savePath':{'type':Sequelize[_0x9bf4('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xe19c99='';var _0x4935cb=this[_0x9bf4('0x3')](_0x9bf4('0x4'));if(_0x4935cb){_0xe19c99=_0x4935cb[_0x9bf4('0x5')](_0x4935cb[_0x9bf4('0x6')]('.'));}return _0xe19c99;}}}; \ No newline at end of file +var _0x6951=['lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x6951,0x9d));var _0x1695=function(_0x44ddbc,_0x507a2f){_0x44ddbc=_0x44ddbc-0x0;var _0x1997a9=_0x6951[_0x44ddbc];return _0x1997a9;};'use strict';var Sequelize=require('sequelize');module[_0x1695('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1695('0x1')]},'calleridname':{'type':Sequelize[_0x1695('0x1')]},'context':{'type':Sequelize[_0x1695('0x1')]},'extension':{'type':Sequelize[_0x1695('0x1')]},'priority':{'type':Sequelize[_0x1695('0x1')]},'accountcode':{'type':Sequelize[_0x1695('0x1')]},'dnid':{'type':Sequelize[_0x1695('0x1')]},'projectName':{'type':Sequelize[_0x1695('0x1')]},'saveName':{'type':Sequelize[_0x1695('0x1')]},'filename':{'type':Sequelize[_0x1695('0x1')]},'savePath':{'type':Sequelize[_0x1695('0x1')]},'format':{'type':Sequelize[_0x1695('0x2')],'get':function(){var _0x48836c='';var _0x35f6b9=this[_0x1695('0x3')](_0x1695('0x4'));if(_0x35f6b9){_0x48836c=_0x35f6b9['substring'](_0x35f6b9[_0x1695('0x5')]('.'));}return _0x48836c;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1e847c5..f4f8df7 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 _0xa16b=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','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','unlinkSync','.cypher','zip-dir','fast-json-patch','moment','mustache','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa16b,0x1b1));var _0xba16=function(_0x439577,_0x41059a){_0x439577=_0x439577-0x0;var _0x2f49fa=_0xa16b[_0x439577];return _0x2f49fa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba16('0x0'));var jsonpatch=require(_0xba16('0x1'));var rp=require('request-promise');var moment=require(_0xba16('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xba16('0x3'));var util=require('util');var path=require(_0xba16('0x4'));var sox=require(_0xba16('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xba16('0x6'));var crypto=require(_0xba16('0x7'));var jsforce=require(_0xba16('0x8'));var deskjs=require(_0xba16('0x9'));var toCsv=require('to-csv');var querystring=require(_0xba16('0xa'));var Papa=require(_0xba16('0xb'));var Redis=require(_0xba16('0xc'));var authService=require(_0xba16('0xd'));var qs=require(_0xba16('0xe'));var as=require(_0xba16('0xf'));var hardwareService=require(_0xba16('0x10'));var logger=require(_0xba16('0x11'))(_0xba16('0x12'));var utils=require(_0xba16('0x13'));var config=require(_0xba16('0x14'));var db=require(_0xba16('0x15'))['db'];function respondWithStatusCode(_0x5dc840,_0x309ae9){_0x309ae9=_0x309ae9||0xcc;return function(_0x36604b){if(_0x36604b){return _0x5dc840[_0xba16('0x16')](_0x309ae9);}return _0x5dc840[_0xba16('0x17')](_0x309ae9)[_0xba16('0x18')]();};}function respondWithResult(_0xc8a011,_0x3bc4a7){_0x3bc4a7=_0x3bc4a7||0xc8;return function(_0x37667c){if(_0x37667c){return _0xc8a011[_0xba16('0x17')](_0x3bc4a7)[_0xba16('0x19')](_0x37667c);}};}function respondWithFilteredResult(_0x26cb4a,_0x326684){return function(_0x270c24){if(_0x270c24){var _0x42c307=_0x270c24[_0xba16('0x1a')],_0x4d32b5=_0x326684[_0xba16('0x1b')],_0x1ac0ec=_0x326684['offset']+_0x326684[_0xba16('0x1c')],_0x280266;if(_0x1ac0ec>=_0x42c307){_0x1ac0ec=_0x42c307;_0x280266=0xc8;}else{_0x280266=0xce;}_0x26cb4a[_0xba16('0x17')](_0x280266);return _0x26cb4a[_0xba16('0x1d')](_0xba16('0x1e'),_0x4d32b5+'-'+_0x1ac0ec+'/'+_0x42c307)[_0xba16('0x19')](_0x270c24);}return null;};}function patchUpdates(_0x5cd4dc){return function(_0x564bcf){try{jsonpatch['apply'](_0x564bcf,_0x5cd4dc,!![]);}catch(_0x123e25){return BPromise['reject'](_0x123e25);}return _0x564bcf[_0xba16('0x1f')]();};}function saveUpdates(_0x58beff,_0x1b79a4){return function(_0x498d59){if(_0x498d59){return _0x498d59['update'](_0x58beff)[_0xba16('0x20')](function(_0x29e29c){return _0x29e29c;});}return null;};}function removeEntity(_0x4acd4e,_0x57d3dc){return function(_0x33e76c){if(_0x33e76c){return _0x33e76c[_0xba16('0x21')]()[_0xba16('0x20')](function(){_0x4acd4e[_0xba16('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582152,_0x1d0a91){return function(_0x40deca){if(!_0x40deca){_0x582152['sendStatus'](0x194);}return _0x40deca;};}function handleError(_0xe10558,_0x49dbf4){_0x49dbf4=_0x49dbf4||0x1f4;return function(_0x199bdf){logger[_0xba16('0x22')](_0x199bdf[_0xba16('0x23')]);if(_0x199bdf['name']){delete _0x199bdf[_0xba16('0x24')];}_0xe10558[_0xba16('0x17')](_0x49dbf4)[_0xba16('0x25')](_0x199bdf);};}exports[_0xba16('0x26')]=function(_0x58db12,_0x1ae17d){var _0x26c7d7={},_0x3f32c9={},_0x3b9d24={'count':0x0,'rows':[]};var _0x355ddc=_[_0xba16('0x27')](db['SquareRecording'][_0xba16('0x28')],function(_0xda6c21){return{'name':_0xda6c21[_0xba16('0x29')],'type':_0xda6c21[_0xba16('0x2a')][_0xba16('0x2b')]};});_0x3f32c9[_0xba16('0x2c')]=_['map'](_0x355ddc,_0xba16('0x24'));_0x3f32c9['query']=_[_0xba16('0x2d')](_0x58db12[_0xba16('0x2e')]);_0x3f32c9[_0xba16('0x2f')]=_[_0xba16('0x30')](_0x3f32c9[_0xba16('0x2c')],_0x3f32c9['query']);_0x26c7d7['attributes']=_[_0xba16('0x30')](_0x3f32c9[_0xba16('0x2c')],qs[_0xba16('0x31')](_0x58db12['query']['fields']));_0x26c7d7[_0xba16('0x32')]=_0x26c7d7[_0xba16('0x32')][_0xba16('0x33')]?_0x26c7d7[_0xba16('0x32')]:_0x3f32c9[_0xba16('0x2c')];if(!_0x58db12[_0xba16('0x2e')][_0xba16('0x34')](_0xba16('0x35'))){_0x26c7d7[_0xba16('0x1c')]=qs[_0xba16('0x1c')](_0x58db12['query']['limit']);_0x26c7d7[_0xba16('0x1b')]=qs[_0xba16('0x1b')](_0x58db12['query']['offset']);}_0x26c7d7[_0xba16('0x36')]=qs['sort'](_0x58db12[_0xba16('0x2e')][_0xba16('0x37')]);_0x26c7d7[_0xba16('0x38')]=qs[_0xba16('0x2f')](_['pick'](_0x58db12[_0xba16('0x2e')],_0x3f32c9[_0xba16('0x2f')]),_0x355ddc);if(_0x58db12[_0xba16('0x2e')][_0xba16('0x39')]){_0x26c7d7[_0xba16('0x38')]=_[_0xba16('0x3a')](_0x26c7d7[_0xba16('0x38')],{'$or':_['map'](_0x355ddc,function(_0x229754){if(_0x229754['type']!==_0xba16('0x3b')){var _0x268e22={};_0x268e22[_0x229754[_0xba16('0x24')]]={'$like':'%'+_0x58db12['query'][_0xba16('0x39')]+'%'};return _0x268e22;}})});}_0x26c7d7=_[_0xba16('0x3a')]({},_0x26c7d7,_0x58db12[_0xba16('0x3c')]);var _0x6cac6e={'where':_0x26c7d7[_0xba16('0x38')]};return db[_0xba16('0x3d')][_0xba16('0x1a')](_0x6cac6e)[_0xba16('0x20')](function(_0x848c24){_0x3b9d24[_0xba16('0x1a')]=_0x848c24;if(_0x58db12[_0xba16('0x2e')][_0xba16('0x3e')]){_0x26c7d7[_0xba16('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0xba16('0x40')](_0x26c7d7);})[_0xba16('0x20')](function(_0xbd3b0b){_0x3b9d24[_0xba16('0x41')]=_0xbd3b0b;return _0x3b9d24;})['then'](respondWithFilteredResult(_0x1ae17d,_0x26c7d7))[_0xba16('0x42')](handleError(_0x1ae17d,null));};exports[_0xba16('0x43')]=function(_0x4214bb,_0x26e8a6){var _0x215c57={'raw':!![],'where':{'id':_0x4214bb[_0xba16('0x44')]['id']}},_0x2d1dc6={};_0x2d1dc6['model']=_[_0xba16('0x2d')](db[_0xba16('0x3d')]['rawAttributes']);_0x2d1dc6['query']=_[_0xba16('0x2d')](_0x4214bb[_0xba16('0x2e')]);_0x2d1dc6[_0xba16('0x2f')]=_[_0xba16('0x30')](_0x2d1dc6['model'],_0x2d1dc6[_0xba16('0x2e')]);_0x215c57[_0xba16('0x32')]=_[_0xba16('0x30')](_0x2d1dc6['model'],qs[_0xba16('0x31')](_0x4214bb[_0xba16('0x2e')][_0xba16('0x31')]));_0x215c57[_0xba16('0x32')]=_0x215c57[_0xba16('0x32')]['length']?_0x215c57[_0xba16('0x32')]:_0x2d1dc6['model'];if(_0x4214bb[_0xba16('0x2e')][_0xba16('0x3e')]){_0x215c57[_0xba16('0x3f')]=[{'all':!![]}];}_0x215c57=_[_0xba16('0x3a')]({},_0x215c57,_0x4214bb[_0xba16('0x3c')]);return db['SquareRecording'][_0xba16('0x45')](_0x215c57)[_0xba16('0x20')](handleEntityNotFound(_0x26e8a6,null))[_0xba16('0x20')](respondWithResult(_0x26e8a6,null))[_0xba16('0x42')](handleError(_0x26e8a6,null));};exports[_0xba16('0x46')]=function(_0x1aefd3,_0x1a9aec){return db[_0xba16('0x3d')][_0xba16('0x46')](_0x1aefd3[_0xba16('0x47')],{})[_0xba16('0x20')](respondWithResult(_0x1a9aec,0xc9))[_0xba16('0x42')](handleError(_0x1a9aec,null));};exports[_0xba16('0x48')]=function(_0x17b8f6,_0x45c461){if(_0x17b8f6[_0xba16('0x47')]['id']){delete _0x17b8f6['body']['id'];}return db[_0xba16('0x3d')][_0xba16('0x45')]({'where':{'id':_0x17b8f6[_0xba16('0x44')]['id']}})[_0xba16('0x20')](handleEntityNotFound(_0x45c461,null))[_0xba16('0x20')](saveUpdates(_0x17b8f6[_0xba16('0x47')],null))['then'](respondWithResult(_0x45c461,null))['catch'](handleError(_0x45c461,null));};exports[_0xba16('0x49')]=function(_0x3608da,_0x467b18,_0x386a0b){var _0x6c2234=require('../../components/encryptor');var _0x5d23cd=![];var _0x2e141c={};if(_0x3608da[_0xba16('0x2e')][_0xba16('0x2a')]&&_0x3608da[_0xba16('0x2e')][_0xba16('0x2a')]==='uniqueid'){_0x2e141c[_0xba16('0x4a')]=_0x3608da[_0xba16('0x44')]['id'];}else{_0x2e141c['id']=_0x3608da['params']['id'];}return db[_0xba16('0x3d')]['find']({'where':_0x2e141c,'attributes':['id',_0xba16('0x4b'),_0xba16('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x467b18,null))[_0xba16('0x20')](function(_0x405d59){if(_0x405d59){var _0x5a0c4b=_0x405d59['savePath'];var _0x4a563c=util[_0xba16('0x4d')](_0xba16('0x4e'),_0x5a0c4b);if(fs[_0xba16('0x4f')](_0x4a563c)){_0x5d23cd=!![];return _0x6c2234[_0xba16('0x50')](_0x4a563c,_0x5a0c4b,config[_0xba16('0x51')]['recording'])['then'](function(){return _0x405d59;});}return _0x405d59;}})[_0xba16('0x20')](function(_0x70ecdb){if(_0x70ecdb){var _0x2ec196=_0x70ecdb[_0xba16('0x4b')];if(!fs['existsSync'](_0x2ec196)){throw new db[(_0xba16('0x52'))][(_0xba16('0x53'))](_0xba16('0x54'));}if(_0x70ecdb['filename']){return _0x467b18['download'](_0x2ec196,_0x70ecdb[_0xba16('0x4c')]+path[_0xba16('0x55')](_0x2ec196),function(){if(_0x5d23cd){fs[_0xba16('0x56')](_0x2ec196);}});}else{return _0x467b18[_0xba16('0x49')](_0x2ec196,function(_0x31cb16){if(_0x5d23cd){fs['unlink'](_0x2ec196);}});}}})['catch'](function(_0x46c6b1){if(_0x46c6b1[_0xba16('0x57')]===_0xba16('0x54')){_0x467b18['status'](0x194)['send'](_0xba16('0x58'));}else{return handleError(_0x467b18,null);}});};exports[_0xba16('0x21')]=function(_0xcae0fc,_0x3cfe6b){return db[_0xba16('0x3d')][_0xba16('0x45')]({'where':{'id':_0xcae0fc[_0xba16('0x44')]['id']}})[_0xba16('0x20')](function(_0x4081b5){if(!_0x4081b5)throw new ReferenceError(_0xba16('0x59'));return _0x4081b5;})[_0xba16('0x20')](function(_0x3c2d8f){var _0x253a95=_0x3c2d8f[_0xba16('0x4b')];logger[_0xba16('0x5a')](_0xba16('0x5b'),_0x253a95);if(!_[_0xba16('0x5c')](_0x3c2d8f[_0xba16('0x4b')])&&fs[_0xba16('0x4f')](_0x253a95)){logger[_0xba16('0x5a')](_0xba16('0x5d')+_0x253a95+_0xba16('0x5e'));fs[_0xba16('0x5f')](_0x253a95);}_0x253a95=_0x253a95+_0xba16('0x60');if(!_[_0xba16('0x5c')](_0x3c2d8f['savePath'])&&fs[_0xba16('0x4f')](_0x253a95)){logger['info']('File:\x20\x22'+_0x253a95+_0xba16('0x5e'));fs[_0xba16('0x5f')](_0x253a95);}return _0x3c2d8f;})[_0xba16('0x20')](function(_0x1b7b2a){if(!_0x1b7b2a)throw new InternalError();return _0x1b7b2a[_0xba16('0x21')]();})['then'](function(){_0x3cfe6b[_0xba16('0x17')](0xcc)['end']();})[_0xba16('0x42')](handleError(_0x3cfe6b,null));}; \ No newline at end of file +var _0x3403=['map','SquareRecording','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','rows','catch','include','options','find','create','body','params','download','../../components/encryptor','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x32fa7f,_0x502b4a){var _0x5f1386=function(_0x52f074){while(--_0x52f074){_0x32fa7f['push'](_0x32fa7f['shift']());}};_0x5f1386(++_0x502b4a);}(_0x3403,0x96));var _0x3340=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3403[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x3340('0x0'));var emlformat=require(_0x3340('0x1'));var rimraf=require(_0x3340('0x2'));var zipdir=require(_0x3340('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3340('0x4'));var BPromise=require(_0x3340('0x5'));var Mustache=require('mustache');var util=require(_0x3340('0x6'));var path=require(_0x3340('0x7'));var sox=require(_0x3340('0x8'));var csv=require(_0x3340('0x9'));var ejs=require(_0x3340('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3340('0xb'));var crypto=require(_0x3340('0xc'));var jsforce=require(_0x3340('0xd'));var deskjs=require(_0x3340('0xe'));var toCsv=require(_0x3340('0x9'));var querystring=require(_0x3340('0xf'));var Papa=require(_0x3340('0x10'));var Redis=require(_0x3340('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3340('0x12'));var as=require(_0x3340('0x13'));var hardwareService=require(_0x3340('0x14'));var logger=require(_0x3340('0x15'))('api');var utils=require(_0x3340('0x16'));var config=require(_0x3340('0x17'));var db=require(_0x3340('0x18'))['db'];function respondWithStatusCode(_0x2601b0,_0x2b025c){_0x2b025c=_0x2b025c||0xcc;return function(_0x2a01eb){if(_0x2a01eb){return _0x2601b0['sendStatus'](_0x2b025c);}return _0x2601b0[_0x3340('0x19')](_0x2b025c)[_0x3340('0x1a')]();};}function respondWithResult(_0x299d73,_0x2bd0f3){_0x2bd0f3=_0x2bd0f3||0xc8;return function(_0x1359e5){if(_0x1359e5){return _0x299d73[_0x3340('0x19')](_0x2bd0f3)[_0x3340('0x1b')](_0x1359e5);}};}function respondWithFilteredResult(_0x3e3d53,_0x2098e9){return function(_0x1b99a6){if(_0x1b99a6){var _0x43bc5b=_0x1b99a6[_0x3340('0x1c')],_0x9a3cd4=_0x2098e9[_0x3340('0x1d')],_0x215123=_0x2098e9[_0x3340('0x1d')]+_0x2098e9[_0x3340('0x1e')],_0x53b15c;if(_0x215123>=_0x43bc5b){_0x215123=_0x43bc5b;_0x53b15c=0xc8;}else{_0x53b15c=0xce;}_0x3e3d53[_0x3340('0x19')](_0x53b15c);return _0x3e3d53[_0x3340('0x1f')](_0x3340('0x20'),_0x9a3cd4+'-'+_0x215123+'/'+_0x43bc5b)['json'](_0x1b99a6);}return null;};}function patchUpdates(_0x59ea50){return function(_0x10c523){try{jsonpatch[_0x3340('0x21')](_0x10c523,_0x59ea50,!![]);}catch(_0x1ffb4e){return BPromise[_0x3340('0x22')](_0x1ffb4e);}return _0x10c523['save']();};}function saveUpdates(_0x5100d0,_0x1cea74){return function(_0x1d93c6){if(_0x1d93c6){return _0x1d93c6[_0x3340('0x23')](_0x5100d0)[_0x3340('0x24')](function(_0x49e1a4){return _0x49e1a4;});}return null;};}function removeEntity(_0x358d97,_0x502889){return function(_0x29ee90){if(_0x29ee90){return _0x29ee90[_0x3340('0x25')]()[_0x3340('0x24')](function(){_0x358d97[_0x3340('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e4f9,_0x2c67db){return function(_0x482c61){if(!_0x482c61){_0x18e4f9[_0x3340('0x26')](0x194);}return _0x482c61;};}function handleError(_0xb84f0,_0x19d8b0){_0x19d8b0=_0x19d8b0||0x1f4;return function(_0x417d4c){logger[_0x3340('0x27')](_0x417d4c[_0x3340('0x28')]);if(_0x417d4c[_0x3340('0x29')]){delete _0x417d4c[_0x3340('0x29')];}_0xb84f0[_0x3340('0x19')](_0x19d8b0)[_0x3340('0x2a')](_0x417d4c);};}exports[_0x3340('0x2b')]=function(_0x11d59f,_0x786965){var _0x1e9c07={},_0xf5f487={},_0x41f9ef={'count':0x0,'rows':[]};var _0x142bd2=_[_0x3340('0x2c')](db[_0x3340('0x2d')]['rawAttributes'],function(_0x3682cf){return{'name':_0x3682cf[_0x3340('0x2e')],'type':_0x3682cf[_0x3340('0x2f')][_0x3340('0x30')]};});_0xf5f487[_0x3340('0x31')]=_[_0x3340('0x2c')](_0x142bd2,_0x3340('0x29'));_0xf5f487[_0x3340('0x32')]=_[_0x3340('0x33')](_0x11d59f['query']);_0xf5f487['filters']=_['intersection'](_0xf5f487[_0x3340('0x31')],_0xf5f487[_0x3340('0x32')]);_0x1e9c07[_0x3340('0x34')]=_[_0x3340('0x35')](_0xf5f487['model'],qs[_0x3340('0x36')](_0x11d59f['query']['fields']));_0x1e9c07[_0x3340('0x34')]=_0x1e9c07[_0x3340('0x34')][_0x3340('0x37')]?_0x1e9c07['attributes']:_0xf5f487[_0x3340('0x31')];if(!_0x11d59f[_0x3340('0x32')][_0x3340('0x38')](_0x3340('0x39'))){_0x1e9c07['limit']=qs[_0x3340('0x1e')](_0x11d59f[_0x3340('0x32')][_0x3340('0x1e')]);_0x1e9c07[_0x3340('0x1d')]=qs[_0x3340('0x1d')](_0x11d59f['query'][_0x3340('0x1d')]);}_0x1e9c07[_0x3340('0x3a')]=qs[_0x3340('0x3b')](_0x11d59f[_0x3340('0x32')][_0x3340('0x3b')]);_0x1e9c07[_0x3340('0x3c')]=qs[_0x3340('0x3d')](_[_0x3340('0x3e')](_0x11d59f[_0x3340('0x32')],_0xf5f487['filters']),_0x142bd2);if(_0x11d59f[_0x3340('0x32')][_0x3340('0x3f')]){_0x1e9c07[_0x3340('0x3c')]=_['merge'](_0x1e9c07['where'],{'$or':_[_0x3340('0x2c')](_0x142bd2,function(_0x23eb1e){if(_0x23eb1e[_0x3340('0x2f')]!==_0x3340('0x40')){var _0x377a24={};_0x377a24[_0x23eb1e['name']]={'$like':'%'+_0x11d59f['query']['filter']+'%'};return _0x377a24;}})});}_0x1e9c07=_[_0x3340('0x41')]({},_0x1e9c07,_0x11d59f['options']);var _0x43bfa9={'where':_0x1e9c07['where']};return db[_0x3340('0x2d')]['count'](_0x43bfa9)[_0x3340('0x24')](function(_0x208376){_0x41f9ef[_0x3340('0x1c')]=_0x208376;if(_0x11d59f['query'][_0x3340('0x42')]){_0x1e9c07['include']=[{'all':!![]}];}return db[_0x3340('0x2d')]['findAll'](_0x1e9c07);})[_0x3340('0x24')](function(_0x1d6ba3){_0x41f9ef[_0x3340('0x43')]=_0x1d6ba3;return _0x41f9ef;})[_0x3340('0x24')](respondWithFilteredResult(_0x786965,_0x1e9c07))[_0x3340('0x44')](handleError(_0x786965,null));};exports['show']=function(_0x145389,_0x3e12ec){var _0x51ec2a={'raw':!![],'where':{'id':_0x145389['params']['id']}},_0x447d58={};_0x447d58[_0x3340('0x31')]=_[_0x3340('0x33')](db[_0x3340('0x2d')]['rawAttributes']);_0x447d58[_0x3340('0x32')]=_[_0x3340('0x33')](_0x145389[_0x3340('0x32')]);_0x447d58[_0x3340('0x3d')]=_[_0x3340('0x35')](_0x447d58[_0x3340('0x31')],_0x447d58[_0x3340('0x32')]);_0x51ec2a[_0x3340('0x34')]=_[_0x3340('0x35')](_0x447d58[_0x3340('0x31')],qs[_0x3340('0x36')](_0x145389[_0x3340('0x32')][_0x3340('0x36')]));_0x51ec2a[_0x3340('0x34')]=_0x51ec2a[_0x3340('0x34')]['length']?_0x51ec2a[_0x3340('0x34')]:_0x447d58[_0x3340('0x31')];if(_0x145389[_0x3340('0x32')]['includeAll']){_0x51ec2a[_0x3340('0x45')]=[{'all':!![]}];}_0x51ec2a=_[_0x3340('0x41')]({},_0x51ec2a,_0x145389[_0x3340('0x46')]);return db[_0x3340('0x2d')][_0x3340('0x47')](_0x51ec2a)[_0x3340('0x24')](handleEntityNotFound(_0x3e12ec,null))[_0x3340('0x24')](respondWithResult(_0x3e12ec,null))[_0x3340('0x44')](handleError(_0x3e12ec,null));};exports[_0x3340('0x48')]=function(_0x39d363,_0x23e196){return db[_0x3340('0x2d')][_0x3340('0x48')](_0x39d363[_0x3340('0x49')],{})['then'](respondWithResult(_0x23e196,0xc9))[_0x3340('0x44')](handleError(_0x23e196,null));};exports[_0x3340('0x23')]=function(_0x11c0e7,_0x199050){if(_0x11c0e7[_0x3340('0x49')]['id']){delete _0x11c0e7['body']['id'];}return db['SquareRecording'][_0x3340('0x47')]({'where':{'id':_0x11c0e7[_0x3340('0x4a')]['id']}})[_0x3340('0x24')](handleEntityNotFound(_0x199050,null))[_0x3340('0x24')](saveUpdates(_0x11c0e7[_0x3340('0x49')],null))[_0x3340('0x24')](respondWithResult(_0x199050,null))[_0x3340('0x44')](handleError(_0x199050,null));};exports[_0x3340('0x4b')]=function(_0xbcda81,_0x3974de,_0x191964){var _0x2418db=require(_0x3340('0x4c'));var _0x46bb53=![];var _0x52c8d4={};if(_0xbcda81[_0x3340('0x32')][_0x3340('0x2f')]&&_0xbcda81[_0x3340('0x32')][_0x3340('0x2f')]==='uniqueid'){_0x52c8d4['uniqueid']=_0xbcda81[_0x3340('0x4a')]['id'];}else{_0x52c8d4['id']=_0xbcda81[_0x3340('0x4a')]['id'];}return db[_0x3340('0x2d')]['find']({'where':_0x52c8d4,'attributes':['id',_0x3340('0x4d'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x3974de,null))['then'](function(_0x443b44){if(_0x443b44){var _0x169aa6=_0x443b44[_0x3340('0x4d')];var _0x48bad6=util[_0x3340('0x4e')]('%s.cypher',_0x169aa6);if(fs[_0x3340('0x4f')](_0x48bad6)){_0x46bb53=!![];return _0x2418db[_0x3340('0x50')](_0x48bad6,_0x169aa6,config[_0x3340('0x51')][_0x3340('0x52')])[_0x3340('0x24')](function(){return _0x443b44;});}return _0x443b44;}})[_0x3340('0x24')](function(_0x55eccf){if(_0x55eccf){var _0xa7b17e=_0x55eccf[_0x3340('0x4d')];if(!fs[_0x3340('0x4f')](_0xa7b17e)){throw new db[(_0x3340('0x53'))]['ValidationError'](_0x3340('0x54'));}if(_0x55eccf[_0x3340('0x55')]){return _0x3974de[_0x3340('0x4b')](_0xa7b17e,_0x55eccf[_0x3340('0x55')]+path[_0x3340('0x56')](_0xa7b17e),function(){if(_0x46bb53){fs[_0x3340('0x57')](_0xa7b17e);}});}else{return _0x3974de['download'](_0xa7b17e,function(_0x2a20db){if(_0x46bb53){fs[_0x3340('0x57')](_0xa7b17e);}});}}})[_0x3340('0x44')](function(_0x8fad1d){if(_0x8fad1d[_0x3340('0x58')]===_0x3340('0x54')){_0x3974de[_0x3340('0x19')](0x194)[_0x3340('0x2a')](_0x3340('0x59'));}else{return handleError(_0x3974de,null);}});};exports[_0x3340('0x25')]=function(_0x5817a8,_0x3e5ea7){return db[_0x3340('0x2d')]['find']({'where':{'id':_0x5817a8[_0x3340('0x4a')]['id']}})[_0x3340('0x24')](function(_0x5ef9f6){if(!_0x5ef9f6)throw new ReferenceError(_0x3340('0x5a'));return _0x5ef9f6;})['then'](function(_0x440b9a){var _0x438a76=_0x440b9a[_0x3340('0x4d')];logger['info'](_0x3340('0x5b'),_0x438a76);if(!_[_0x3340('0x5c')](_0x440b9a[_0x3340('0x4d')])&&fs[_0x3340('0x4f')](_0x438a76)){logger[_0x3340('0x5d')](_0x3340('0x5e')+_0x438a76+_0x3340('0x5f'));fs[_0x3340('0x60')](_0x438a76);}_0x438a76=_0x438a76+'.cypher';if(!_[_0x3340('0x5c')](_0x440b9a[_0x3340('0x4d')])&&fs[_0x3340('0x4f')](_0x438a76)){logger[_0x3340('0x5d')](_0x3340('0x5e')+_0x438a76+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3340('0x60')](_0x438a76);}return _0x440b9a;})['then'](function(_0x2d997d){if(!_0x2d997d)throw new InternalError();return _0x2d997d[_0x3340('0x25')]();})[_0x3340('0x24')](function(){_0x3e5ea7['status'](0xcc)[_0x3340('0x1a')]();})['catch'](handleError(_0x3e5ea7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e5a2f7c..0de7f1a 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 _0x05fe=['moment','bluebird','request-promise','rimraf','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api'];(function(_0x471322,_0x4d1b2a){var _0x15a954=function(_0x10f1d2){while(--_0x10f1d2){_0x471322['push'](_0x471322['shift']());}};_0x15a954(++_0x4d1b2a);}(_0x05fe,0x164));var _0xe05f=function(_0xee5d61,_0x4c71c3){_0xee5d61=_0xee5d61-0x0;var _0x3e1c5b=_0x05fe[_0xee5d61];return _0x3e1c5b;};'use strict';var _=require(_0xe05f('0x0'));var util=require(_0xe05f('0x1'));var logger=require(_0xe05f('0x2'))(_0xe05f('0x3'));var moment=require(_0xe05f('0x4'));var BPromise=require(_0xe05f('0x5'));var rp=require(_0xe05f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe05f('0x7'));var config=require('../../config/environment');var attributes=require(_0xe05f('0x8'));module[_0xe05f('0x9')]=function(_0x3cb77f,_0x37a648){return _0x3cb77f[_0xe05f('0xa')]('SquareRecording',attributes,{'tableName':_0xe05f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe22c=['path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','bluebird','request-promise'];(function(_0x283365,_0x704c4d){var _0x178caf=function(_0x165e54){while(--_0x165e54){_0x283365['push'](_0x283365['shift']());}};_0x178caf(++_0x704c4d);}(_0xe22c,0x1d5));var _0xce22=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe22c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xce22('0x0'));var util=require('util');var logger=require(_0xce22('0x1'))('api');var moment=require('moment');var BPromise=require(_0xce22('0x2'));var rp=require(_0xce22('0x3'));var fs=require('fs');var path=require(_0xce22('0x4'));var rimraf=require('rimraf');var config=require(_0xce22('0x5'));var attributes=require(_0xce22('0x6'));module[_0xce22('0x7')]=function(_0x1452dd,_0x4f5978){return _0x1452dd[_0xce22('0x8')](_0xce22('0x9'),attributes,{'tableName':_0xce22('0xa'),'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 c04656e..daafa00 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 _0x4ee5=['client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','debug','util','moment','rpc','../../config/environment'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x4ee5,0x14c));var _0x54ee=function(_0x1ea98b,_0x3fa24e){_0x1ea98b=_0x1ea98b-0x0;var _0x3228fc=_0x4ee5[_0x1ea98b];return _0x3228fc;};'use strict';var _=require('lodash');var util=require(_0x54ee('0x0'));var moment=require(_0x54ee('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('../../config/logger')(_0x54ee('0x2'));var config=require(_0x54ee('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x54ee('0x4')][_0x54ee('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x214768,_0x5403e0,_0x57c658){return new BPromise(function(_0x173ace,_0x142ed5){return client[_0x54ee('0x6')](_0x214768,_0x57c658)[_0x54ee('0x7')](function(_0x198788){logger[_0x54ee('0x8')](_0x54ee('0x9'),_0x5403e0,_0x54ee('0xa'));logger['debug'](_0x54ee('0xb'),_0x5403e0,'request\x20sent',JSON[_0x54ee('0xc')](_0x198788));if(_0x198788[_0x54ee('0xd')]){if(_0x198788[_0x54ee('0xd')][_0x54ee('0xe')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x5403e0,_0x198788['error']['message']);return _0x142ed5(_0x198788['error'][_0x54ee('0xf')]);}logger[_0x54ee('0xd')](_0x54ee('0x9'),_0x5403e0,_0x198788[_0x54ee('0xd')][_0x54ee('0xf')]);return _0x173ace(_0x198788[_0x54ee('0xd')][_0x54ee('0xf')]);}else{logger[_0x54ee('0x8')](_0x54ee('0x9'),_0x5403e0,'request\x20sent');_0x173ace(_0x198788[_0x54ee('0x10')][_0x54ee('0xf')]);}})[_0x54ee('0x11')](function(_0x47f9e5){logger[_0x54ee('0xd')](_0x54ee('0x9'),_0x5403e0,_0x47f9e5);_0x142ed5(_0x47f9e5);});});}exports[_0x54ee('0x12')]=function(_0x2ed977){var _0x1a2e0d=this;return new Promise(function(_0x563d9c,_0x2694b2){return db[_0x54ee('0x13')][_0x54ee('0x14')](_0x2ed977['body'],{'raw':_0x2ed977[_0x54ee('0x15')]?_0x2ed977['options'][_0x54ee('0x16')]===undefined?!![]:![]:!![]})[_0x54ee('0x7')](function(_0x417af9){logger[_0x54ee('0x8')]('CreateSquareRecording',_0x2ed977);logger[_0x54ee('0x17')](_0x54ee('0x12'),_0x2ed977,JSON[_0x54ee('0xc')](_0x417af9));_0x563d9c(_0x417af9);})['catch'](function(_0xaaf73b){logger[_0x54ee('0xd')](_0x54ee('0x12'),_0xaaf73b[_0x54ee('0xf')],_0x2ed977);_0x2694b2(_0x1a2e0d[_0x54ee('0xd')](0x1f4,_0xaaf73b['message']));});});}; \ No newline at end of file +var _0xa69c=['http','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','body','raw','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4ecb1d,_0x47782b){var _0x381290=function(_0x19cfb3){while(--_0x19cfb3){_0x4ecb1d['push'](_0x4ecb1d['shift']());}};_0x381290(++_0x47782b);}(_0xa69c,0x155));var _0xca69=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xa69c[_0x175e89];return _0x2ed996;};'use strict';var _=require(_0xca69('0x0'));var util=require(_0xca69('0x1'));var moment=require(_0xca69('0x2'));var BPromise=require(_0xca69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca69('0x4'));var db=require(_0xca69('0x5'))['db'];var utils=require(_0xca69('0x6'));var logger=require(_0xca69('0x7'))('rpc');var config=require(_0xca69('0x8'));var jayson=require(_0xca69('0x9'));var client=jayson['client'][_0xca69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bdeb0,_0x3f0f04,_0x4dfa8c){return new BPromise(function(_0x3624c9,_0x3827a6){return client['request'](_0x3bdeb0,_0x4dfa8c)['then'](function(_0xe9f5f0){logger[_0xca69('0xb')](_0xca69('0xc'),_0x3f0f04,'request\x20sent');logger['debug'](_0xca69('0xd'),_0x3f0f04,_0xca69('0xe'),JSON[_0xca69('0xf')](_0xe9f5f0));if(_0xe9f5f0[_0xca69('0x10')]){if(_0xe9f5f0[_0xca69('0x10')]['code']===0x1f4){logger[_0xca69('0x10')](_0xca69('0xc'),_0x3f0f04,_0xe9f5f0[_0xca69('0x10')][_0xca69('0x11')]);return _0x3827a6(_0xe9f5f0[_0xca69('0x10')][_0xca69('0x11')]);}logger[_0xca69('0x10')](_0xca69('0xc'),_0x3f0f04,_0xe9f5f0['error'][_0xca69('0x11')]);return _0x3624c9(_0xe9f5f0['error'][_0xca69('0x11')]);}else{logger[_0xca69('0xb')]('SquareRecording,\x20%s,\x20%s',_0x3f0f04,_0xca69('0xe'));_0x3624c9(_0xe9f5f0[_0xca69('0x12')][_0xca69('0x11')]);}})[_0xca69('0x13')](function(_0x269abb){logger['error'](_0xca69('0xc'),_0x3f0f04,_0x269abb);_0x3827a6(_0x269abb);});});}exports[_0xca69('0x14')]=function(_0x5b3300){var _0x3d92bb=this;return new Promise(function(_0x13ac7d,_0x13d692){return db[_0xca69('0x15')][_0xca69('0x16')](_0x5b3300[_0xca69('0x17')],{'raw':_0x5b3300['options']?_0x5b3300['options'][_0xca69('0x18')]===undefined?!![]:![]:!![]})[_0xca69('0x19')](function(_0x23b685){logger[_0xca69('0xb')](_0xca69('0x14'),_0x5b3300);logger[_0xca69('0x1a')](_0xca69('0x14'),_0x5b3300,JSON[_0xca69('0xf')](_0x23b685));_0x13ac7d(_0x23b685);})[_0xca69('0x13')](function(_0x55d48c){logger[_0xca69('0x10')]('CreateSquareRecording',_0x55d48c['message'],_0x5b3300);_0x13d692(_0x3d92bb[_0xca69('0x10')](0x1f4,_0x55d48c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6b9010d..a123987 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 _0x5bf0=['connect-timeout','express','Router','get','index','/describe','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x5bf0,0x95));var _0x05bf=function(_0x468a81,_0xd2262b){_0x468a81=_0x468a81-0x0;var _0xb1a278=_0x5bf0[_0x468a81];return _0xb1a278;};'use strict';var multer=require(_0x05bf('0x0'));var util=require(_0x05bf('0x1'));var path=require(_0x05bf('0x2'));var timeout=require(_0x05bf('0x3'));var express=require(_0x05bf('0x4'));var router=express[_0x05bf('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x05bf('0x6')]('/',auth['isAuthenticated'](),controller[_0x05bf('0x7')]);router['get'](_0x05bf('0x8'),auth[_0x05bf('0x9')](),controller[_0x05bf('0xa')]);router[_0x05bf('0x6')]('/:id',auth[_0x05bf('0x9')](),controller[_0x05bf('0xb')]);router['post']('/',auth[_0x05bf('0x9')](),controller[_0x05bf('0xc')]);router[_0x05bf('0xd')](_0x05bf('0xe'),auth[_0x05bf('0x9')](),controller[_0x05bf('0xf')]);router[_0x05bf('0x10')](_0x05bf('0xe'),auth['isAuthenticated'](),controller[_0x05bf('0x11')]);module[_0x05bf('0x12')]=router; \ No newline at end of file +var _0x11da=['delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','put','update'];(function(_0x34ace0,_0x2ee298){var _0x54b345=function(_0x2010fc){while(--_0x2010fc){_0x34ace0['push'](_0x34ace0['shift']());}};_0x54b345(++_0x2ee298);}(_0x11da,0x135));var _0xa11d=function(_0xbf3598,_0x28f612){_0xbf3598=_0xbf3598-0x0;var _0x2b7cca=_0x11da[_0xbf3598];return _0x2b7cca;};'use strict';var multer=require('multer');var util=require(_0xa11d('0x0'));var path=require(_0xa11d('0x1'));var timeout=require(_0xa11d('0x2'));var express=require(_0xa11d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa11d('0x4'));var config=require(_0xa11d('0x5'));var controller=require('./squareReport.controller');router[_0xa11d('0x6')]('/',auth[_0xa11d('0x7')](),controller['index']);router[_0xa11d('0x6')](_0xa11d('0x8'),auth[_0xa11d('0x7')](),controller[_0xa11d('0x9')]);router['get'](_0xa11d('0xa'),auth[_0xa11d('0x7')](),controller[_0xa11d('0xb')]);router[_0xa11d('0xc')]('/',auth[_0xa11d('0x7')](),controller['create']);router[_0xa11d('0xd')](_0xa11d('0xa'),auth[_0xa11d('0x7')](),controller[_0xa11d('0xe')]);router[_0xa11d('0xf')](_0xa11d('0xa'),auth[_0xa11d('0x7')](),controller[_0xa11d('0x10')]);module[_0xa11d('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a202aa8..71123fe 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 _0xd689=['exports','STRING','DATE','BOOLEAN'];(function(_0x36574a,_0x212573){var _0x5703f0=function(_0x181ebf){while(--_0x181ebf){_0x36574a['push'](_0x36574a['shift']());}};_0x5703f0(++_0x212573);}(_0xd689,0x174));var _0x9d68=function(_0x3af4e5,_0x3009b0){_0x3af4e5=_0x3af4e5-0x0;var _0x31d2be=_0xd689[_0x3af4e5];return _0x31d2be;};'use strict';var Sequelize=require('sequelize');module[_0x9d68('0x0')]={'network':{'type':Sequelize[_0x9d68('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x9d68('0x1')]},'channel':{'type':Sequelize[_0x9d68('0x1')]},'language':{'type':Sequelize[_0x9d68('0x1')]},'type':{'type':Sequelize[_0x9d68('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x9d68('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9d68('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9d68('0x1')]},'callington':{'type':Sequelize[_0x9d68('0x1')]},'callingtns':{'type':Sequelize[_0x9d68('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x9d68('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9d68('0x1')]},'priority':{'type':Sequelize[_0x9d68('0x1')]},'enhanced':{'type':Sequelize[_0x9d68('0x1')]},'accountcode':{'type':Sequelize[_0x9d68('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x9d68('0x1')]},'joinAt':{'type':Sequelize[_0x9d68('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x9d68('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd469=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x2f70d1,_0xfa3c44){var _0x53c138=function(_0x2008e7){while(--_0x2008e7){_0x2f70d1['push'](_0x2f70d1['shift']());}};_0x53c138(++_0xfa3c44);}(_0xd469,0xac));var _0x9d46=function(_0x2439be,_0xb9b051){_0x2439be=_0x2439be-0x0;var _0x2d68dc=_0xd469[_0x2439be];return _0x2d68dc;};'use strict';var Sequelize=require(_0x9d46('0x0'));module[_0x9d46('0x1')]={'network':{'type':Sequelize[_0x9d46('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x9d46('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9d46('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9d46('0x2')]},'version':{'type':Sequelize[_0x9d46('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9d46('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9d46('0x2')]},'callington':{'type':Sequelize[_0x9d46('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x9d46('0x2')]},'rdnis':{'type':Sequelize[_0x9d46('0x2')]},'context':{'type':Sequelize[_0x9d46('0x2')]},'extension':{'type':Sequelize[_0x9d46('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9d46('0x2')]},'threadid':{'type':Sequelize[_0x9d46('0x2')]},'project_name':{'type':Sequelize[_0x9d46('0x2')]},'joinAt':{'type':Sequelize[_0x9d46('0x3')]},'leaveAt':{'type':Sequelize[_0x9d46('0x3')]},'bot':{'type':Sequelize[_0x9d46('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 02ffe49..1974b66 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 _0xaec7=['VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','SquareReport','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','count','offset','set','Content-Range','json','save','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xaec7,0xe8));var _0x7aec=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xaec7[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x7aec('0x0'));var emlformat=require(_0x7aec('0x1'));var rimraf=require(_0x7aec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7aec('0x3'));var rp=require(_0x7aec('0x4'));var moment=require(_0x7aec('0x5'));var BPromise=require(_0x7aec('0x6'));var Mustache=require('mustache');var util=require(_0x7aec('0x7'));var path=require(_0x7aec('0x8'));var sox=require(_0x7aec('0x9'));var csv=require('to-csv');var ejs=require(_0x7aec('0xa'));var fs=require('fs');var _=require(_0x7aec('0xb'));var squel=require(_0x7aec('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7aec('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7aec('0xe'));var Papa=require(_0x7aec('0xf'));var Redis=require(_0x7aec('0x10'));var authService=require(_0x7aec('0x11'));var qs=require(_0x7aec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7aec('0x13'))(_0x7aec('0x14'));var utils=require('../../config/utils');var config=require(_0x7aec('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4374f2,_0x159498){_0x159498=_0x159498||0xcc;return function(_0x122c4b){if(_0x122c4b){return _0x4374f2['sendStatus'](_0x159498);}return _0x4374f2[_0x7aec('0x16')](_0x159498)[_0x7aec('0x17')]();};}function respondWithResult(_0x6313e0,_0x52c454){_0x52c454=_0x52c454||0xc8;return function(_0x1cfb89){if(_0x1cfb89){return _0x6313e0[_0x7aec('0x16')](_0x52c454)['json'](_0x1cfb89);}};}function respondWithFilteredResult(_0x55ae49,_0x10a7de){return function(_0x4cd06d){if(_0x4cd06d){var _0x278dd5=_0x4cd06d[_0x7aec('0x18')],_0x14afd6=_0x10a7de['offset'],_0x5a80c9=_0x10a7de[_0x7aec('0x19')]+_0x10a7de['limit'],_0x1e06bd;if(_0x5a80c9>=_0x278dd5){_0x5a80c9=_0x278dd5;_0x1e06bd=0xc8;}else{_0x1e06bd=0xce;}_0x55ae49[_0x7aec('0x16')](_0x1e06bd);return _0x55ae49[_0x7aec('0x1a')](_0x7aec('0x1b'),_0x14afd6+'-'+_0x5a80c9+'/'+_0x278dd5)[_0x7aec('0x1c')](_0x4cd06d);}return null;};}function patchUpdates(_0x36f3d0){return function(_0x11eb5d){try{jsonpatch['apply'](_0x11eb5d,_0x36f3d0,!![]);}catch(_0x51258e){return BPromise['reject'](_0x51258e);}return _0x11eb5d[_0x7aec('0x1d')]();};}function saveUpdates(_0x2c06c8,_0x123f16){return function(_0x3de882){if(_0x3de882){return _0x3de882['update'](_0x2c06c8)[_0x7aec('0x1e')](function(_0x3391a8){return _0x3391a8;});}return null;};}function removeEntity(_0x5d5439,_0x533e29){return function(_0x2964e0){if(_0x2964e0){return _0x2964e0[_0x7aec('0x1f')]()[_0x7aec('0x1e')](function(){_0x5d5439[_0x7aec('0x16')](0xcc)[_0x7aec('0x17')]();});}};}function handleEntityNotFound(_0x3ee503,_0x13cdc5){return function(_0x44095c){if(!_0x44095c){_0x3ee503[_0x7aec('0x20')](0x194);}return _0x44095c;};}function handleError(_0x523fd3,_0x3bcf1c){_0x3bcf1c=_0x3bcf1c||0x1f4;return function(_0x1bbd23){logger['error'](_0x1bbd23[_0x7aec('0x21')]);if(_0x1bbd23[_0x7aec('0x22')]){delete _0x1bbd23['name'];}_0x523fd3[_0x7aec('0x16')](_0x3bcf1c)[_0x7aec('0x23')](_0x1bbd23);};}exports[_0x7aec('0x24')]=function(_0x4c86d9,_0x1fd440){var _0x2f896d={},_0x974415={},_0x346f8d={'count':0x0,'rows':[]};var _0x41b02b=_[_0x7aec('0x25')](db['SquareReport']['rawAttributes'],function(_0x31a07f){return{'name':_0x31a07f[_0x7aec('0x26')],'type':_0x31a07f[_0x7aec('0x27')]['key']};});_0x974415[_0x7aec('0x28')]=_[_0x7aec('0x25')](_0x41b02b,'name');_0x974415[_0x7aec('0x29')]=_[_0x7aec('0x2a')](_0x4c86d9['query']);_0x974415['filters']=_[_0x7aec('0x2b')](_0x974415[_0x7aec('0x28')],_0x974415[_0x7aec('0x29')]);_0x2f896d[_0x7aec('0x2c')]=_[_0x7aec('0x2b')](_0x974415[_0x7aec('0x28')],qs[_0x7aec('0x2d')](_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x2d')]));_0x2f896d[_0x7aec('0x2c')]=_0x2f896d['attributes'][_0x7aec('0x2e')]?_0x2f896d[_0x7aec('0x2c')]:_0x974415[_0x7aec('0x28')];if(!_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x2f')](_0x7aec('0x30'))){_0x2f896d[_0x7aec('0x31')]=qs[_0x7aec('0x31')](_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x31')]);_0x2f896d[_0x7aec('0x19')]=qs[_0x7aec('0x19')](_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x19')]);}_0x2f896d[_0x7aec('0x32')]=qs[_0x7aec('0x33')](_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x33')]);_0x2f896d[_0x7aec('0x34')]=qs[_0x7aec('0x35')](_[_0x7aec('0x36')](_0x4c86d9[_0x7aec('0x29')],_0x974415[_0x7aec('0x35')]),_0x41b02b);if(_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x37')]){_0x2f896d[_0x7aec('0x34')]=_['merge'](_0x2f896d[_0x7aec('0x34')],{'$or':_[_0x7aec('0x25')](_0x41b02b,function(_0x253d00){if(_0x253d00['type']!==_0x7aec('0x38')){var _0x593eab={};_0x593eab[_0x253d00[_0x7aec('0x22')]]={'$like':'%'+_0x4c86d9['query'][_0x7aec('0x37')]+'%'};return _0x593eab;}})});}_0x2f896d=_[_0x7aec('0x39')]({},_0x2f896d,_0x4c86d9[_0x7aec('0x3a')]);var _0x22cb9f={'where':_0x2f896d[_0x7aec('0x34')]};return db['SquareReport']['count'](_0x22cb9f)[_0x7aec('0x1e')](function(_0x2ae999){_0x346f8d[_0x7aec('0x18')]=_0x2ae999;if(_0x4c86d9[_0x7aec('0x29')][_0x7aec('0x3b')]){_0x2f896d['include']=[{'all':!![]}];}return db['SquareReport'][_0x7aec('0x3c')](_0x2f896d);})[_0x7aec('0x1e')](function(_0x1e53fb){_0x346f8d[_0x7aec('0x3d')]=_0x1e53fb;return _0x346f8d;})[_0x7aec('0x1e')](respondWithFilteredResult(_0x1fd440,_0x2f896d))[_0x7aec('0x3e')](handleError(_0x1fd440,null));};exports[_0x7aec('0x3f')]=function(_0x8b4a71,_0x399228){var _0x515a66={'raw':!![],'where':{'id':_0x8b4a71[_0x7aec('0x40')]['id']}},_0x8433a4={};_0x8433a4[_0x7aec('0x28')]=_['keys'](db[_0x7aec('0x41')][_0x7aec('0x42')]);_0x8433a4['query']=_[_0x7aec('0x2a')](_0x8b4a71['query']);_0x8433a4['filters']=_[_0x7aec('0x2b')](_0x8433a4[_0x7aec('0x28')],_0x8433a4[_0x7aec('0x29')]);_0x515a66['attributes']=_[_0x7aec('0x2b')](_0x8433a4[_0x7aec('0x28')],qs[_0x7aec('0x2d')](_0x8b4a71[_0x7aec('0x29')][_0x7aec('0x2d')]));_0x515a66['attributes']=_0x515a66[_0x7aec('0x2c')][_0x7aec('0x2e')]?_0x515a66['attributes']:_0x8433a4[_0x7aec('0x28')];if(_0x8b4a71[_0x7aec('0x29')][_0x7aec('0x3b')]){_0x515a66['include']=[{'all':!![]}];}_0x515a66=_[_0x7aec('0x39')]({},_0x515a66,_0x8b4a71[_0x7aec('0x3a')]);return db[_0x7aec('0x41')][_0x7aec('0x43')](_0x515a66)[_0x7aec('0x1e')](handleEntityNotFound(_0x399228,null))[_0x7aec('0x1e')](respondWithResult(_0x399228,null))[_0x7aec('0x3e')](handleError(_0x399228,null));};exports[_0x7aec('0x44')]=function(_0x245ead,_0x8bc0c){return db[_0x7aec('0x41')][_0x7aec('0x44')](_0x245ead[_0x7aec('0x45')],{})[_0x7aec('0x1e')](respondWithResult(_0x8bc0c,0xc9))[_0x7aec('0x3e')](handleError(_0x8bc0c,null));};exports[_0x7aec('0x46')]=function(_0x1a9180,_0x53ed9d){if(_0x1a9180[_0x7aec('0x45')]['id']){delete _0x1a9180[_0x7aec('0x45')]['id'];}return db['SquareReport'][_0x7aec('0x43')]({'where':{'id':_0x1a9180[_0x7aec('0x40')]['id']}})[_0x7aec('0x1e')](handleEntityNotFound(_0x53ed9d,null))[_0x7aec('0x1e')](saveUpdates(_0x1a9180[_0x7aec('0x45')],null))[_0x7aec('0x1e')](respondWithResult(_0x53ed9d,null))[_0x7aec('0x3e')](handleError(_0x53ed9d,null));};exports[_0x7aec('0x1f')]=function(_0x4ccb5e,_0x55b755){return db[_0x7aec('0x41')][_0x7aec('0x43')]({'where':{'id':_0x4ccb5e[_0x7aec('0x40')]['id']}})[_0x7aec('0x1e')](handleEntityNotFound(_0x55b755,null))[_0x7aec('0x1e')](removeEntity(_0x55b755,null))['catch'](handleError(_0x55b755,null));};exports['describe']=function(_0x23efc6,_0x17a790){return db[_0x7aec('0x41')][_0x7aec('0x47')]()['then'](respondWithResult(_0x17a790,null))[_0x7aec('0x3e')](handleError(_0x17a790,null));}; \ No newline at end of file +var _0xceb4=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','limit','offset','order','sort','where','merge','VIRTUAL','count','include','findAll','rows','show','params','fields','includeAll','options','find','create','body','catch','update','describe','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','jsforce'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xceb4,0x106));var _0x4ceb=function(_0x2946ba,_0x3256a3){_0x2946ba=_0x2946ba-0x0;var _0x31458f=_0xceb4[_0x2946ba];return _0x31458f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ceb('0x0'));var jsonpatch=require(_0x4ceb('0x1'));var rp=require(_0x4ceb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ceb('0x3'));var util=require('util');var path=require(_0x4ceb('0x4'));var sox=require(_0x4ceb('0x5'));var csv=require(_0x4ceb('0x6'));var ejs=require(_0x4ceb('0x7'));var fs=require('fs');var _=require(_0x4ceb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ceb('0x9'));var deskjs=require(_0x4ceb('0xa'));var toCsv=require(_0x4ceb('0x6'));var querystring=require(_0x4ceb('0xb'));var Papa=require(_0x4ceb('0xc'));var Redis=require(_0x4ceb('0xd'));var authService=require(_0x4ceb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4ceb('0xf'));var hardwareService=require(_0x4ceb('0x10'));var logger=require(_0x4ceb('0x11'))(_0x4ceb('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x397b22,_0x234ea1){_0x234ea1=_0x234ea1||0xcc;return function(_0x45f4cf){if(_0x45f4cf){return _0x397b22['sendStatus'](_0x234ea1);}return _0x397b22['status'](_0x234ea1)[_0x4ceb('0x13')]();};}function respondWithResult(_0x9c5962,_0x119d71){_0x119d71=_0x119d71||0xc8;return function(_0x2b6cf7){if(_0x2b6cf7){return _0x9c5962[_0x4ceb('0x14')](_0x119d71)[_0x4ceb('0x15')](_0x2b6cf7);}};}function respondWithFilteredResult(_0x5840bc,_0x1cf779){return function(_0x34b197){if(_0x34b197){var _0x1feb62=_0x34b197['count'],_0x39f43b=_0x1cf779['offset'],_0xa36a15=_0x1cf779['offset']+_0x1cf779['limit'],_0x3ea60d;if(_0xa36a15>=_0x1feb62){_0xa36a15=_0x1feb62;_0x3ea60d=0xc8;}else{_0x3ea60d=0xce;}_0x5840bc['status'](_0x3ea60d);return _0x5840bc['set']('Content-Range',_0x39f43b+'-'+_0xa36a15+'/'+_0x1feb62)[_0x4ceb('0x15')](_0x34b197);}return null;};}function patchUpdates(_0x514e36){return function(_0x5a597a){try{jsonpatch[_0x4ceb('0x16')](_0x5a597a,_0x514e36,!![]);}catch(_0x326550){return BPromise[_0x4ceb('0x17')](_0x326550);}return _0x5a597a[_0x4ceb('0x18')]();};}function saveUpdates(_0x5a83b7,_0x579158){return function(_0x2d69fb){if(_0x2d69fb){return _0x2d69fb['update'](_0x5a83b7)[_0x4ceb('0x19')](function(_0xd4a5fd){return _0xd4a5fd;});}return null;};}function removeEntity(_0x55aaf5,_0x30f2ac){return function(_0x238ee6){if(_0x238ee6){return _0x238ee6[_0x4ceb('0x1a')]()[_0x4ceb('0x19')](function(){_0x55aaf5[_0x4ceb('0x14')](0xcc)[_0x4ceb('0x13')]();});}};}function handleEntityNotFound(_0x2a8161,_0x4b6af0){return function(_0x15a18b){if(!_0x15a18b){_0x2a8161[_0x4ceb('0x1b')](0x194);}return _0x15a18b;};}function handleError(_0x22b68,_0x1fb34c){_0x1fb34c=_0x1fb34c||0x1f4;return function(_0x1470c7){logger[_0x4ceb('0x1c')](_0x1470c7[_0x4ceb('0x1d')]);if(_0x1470c7[_0x4ceb('0x1e')]){delete _0x1470c7['name'];}_0x22b68[_0x4ceb('0x14')](_0x1fb34c)[_0x4ceb('0x1f')](_0x1470c7);};}exports[_0x4ceb('0x20')]=function(_0x267425,_0x23701f){var _0x4acc75={},_0x312702={},_0x22a359={'count':0x0,'rows':[]};var _0x406918=_[_0x4ceb('0x21')](db[_0x4ceb('0x22')][_0x4ceb('0x23')],function(_0x2cf9fa){return{'name':_0x2cf9fa[_0x4ceb('0x24')],'type':_0x2cf9fa[_0x4ceb('0x25')]['key']};});_0x312702['model']=_[_0x4ceb('0x21')](_0x406918,'name');_0x312702[_0x4ceb('0x26')]=_[_0x4ceb('0x27')](_0x267425[_0x4ceb('0x26')]);_0x312702[_0x4ceb('0x28')]=_[_0x4ceb('0x29')](_0x312702[_0x4ceb('0x2a')],_0x312702['query']);_0x4acc75[_0x4ceb('0x2b')]=_[_0x4ceb('0x29')](_0x312702[_0x4ceb('0x2a')],qs['fields'](_0x267425['query']['fields']));_0x4acc75[_0x4ceb('0x2b')]=_0x4acc75[_0x4ceb('0x2b')][_0x4ceb('0x2c')]?_0x4acc75[_0x4ceb('0x2b')]:_0x312702[_0x4ceb('0x2a')];if(!_0x267425[_0x4ceb('0x26')]['hasOwnProperty'](_0x4ceb('0x2d'))){_0x4acc75[_0x4ceb('0x2e')]=qs[_0x4ceb('0x2e')](_0x267425['query']['limit']);_0x4acc75[_0x4ceb('0x2f')]=qs['offset'](_0x267425[_0x4ceb('0x26')][_0x4ceb('0x2f')]);}_0x4acc75[_0x4ceb('0x30')]=qs[_0x4ceb('0x31')](_0x267425[_0x4ceb('0x26')]['sort']);_0x4acc75[_0x4ceb('0x32')]=qs['filters'](_['pick'](_0x267425[_0x4ceb('0x26')],_0x312702[_0x4ceb('0x28')]),_0x406918);if(_0x267425[_0x4ceb('0x26')]['filter']){_0x4acc75[_0x4ceb('0x32')]=_[_0x4ceb('0x33')](_0x4acc75[_0x4ceb('0x32')],{'$or':_[_0x4ceb('0x21')](_0x406918,function(_0x3b73b0){if(_0x3b73b0['type']!==_0x4ceb('0x34')){var _0x49cce2={};_0x49cce2[_0x3b73b0['name']]={'$like':'%'+_0x267425[_0x4ceb('0x26')]['filter']+'%'};return _0x49cce2;}})});}_0x4acc75=_['merge']({},_0x4acc75,_0x267425['options']);var _0x9ff0ad={'where':_0x4acc75[_0x4ceb('0x32')]};return db[_0x4ceb('0x22')][_0x4ceb('0x35')](_0x9ff0ad)['then'](function(_0x1c2e41){_0x22a359[_0x4ceb('0x35')]=_0x1c2e41;if(_0x267425[_0x4ceb('0x26')]['includeAll']){_0x4acc75[_0x4ceb('0x36')]=[{'all':!![]}];}return db[_0x4ceb('0x22')][_0x4ceb('0x37')](_0x4acc75);})[_0x4ceb('0x19')](function(_0x5a5737){_0x22a359[_0x4ceb('0x38')]=_0x5a5737;return _0x22a359;})[_0x4ceb('0x19')](respondWithFilteredResult(_0x23701f,_0x4acc75))['catch'](handleError(_0x23701f,null));};exports[_0x4ceb('0x39')]=function(_0x587a15,_0x5c3b6b){var _0x58f9a8={'raw':!![],'where':{'id':_0x587a15[_0x4ceb('0x3a')]['id']}},_0x541626={};_0x541626[_0x4ceb('0x2a')]=_[_0x4ceb('0x27')](db[_0x4ceb('0x22')][_0x4ceb('0x23')]);_0x541626[_0x4ceb('0x26')]=_[_0x4ceb('0x27')](_0x587a15[_0x4ceb('0x26')]);_0x541626['filters']=_['intersection'](_0x541626['model'],_0x541626[_0x4ceb('0x26')]);_0x58f9a8[_0x4ceb('0x2b')]=_[_0x4ceb('0x29')](_0x541626[_0x4ceb('0x2a')],qs['fields'](_0x587a15['query'][_0x4ceb('0x3b')]));_0x58f9a8['attributes']=_0x58f9a8['attributes']['length']?_0x58f9a8[_0x4ceb('0x2b')]:_0x541626['model'];if(_0x587a15[_0x4ceb('0x26')][_0x4ceb('0x3c')]){_0x58f9a8[_0x4ceb('0x36')]=[{'all':!![]}];}_0x58f9a8=_['merge']({},_0x58f9a8,_0x587a15[_0x4ceb('0x3d')]);return db[_0x4ceb('0x22')][_0x4ceb('0x3e')](_0x58f9a8)[_0x4ceb('0x19')](handleEntityNotFound(_0x5c3b6b,null))[_0x4ceb('0x19')](respondWithResult(_0x5c3b6b,null))['catch'](handleError(_0x5c3b6b,null));};exports[_0x4ceb('0x3f')]=function(_0x535a12,_0x38ef0f){return db[_0x4ceb('0x22')][_0x4ceb('0x3f')](_0x535a12[_0x4ceb('0x40')],{})[_0x4ceb('0x19')](respondWithResult(_0x38ef0f,0xc9))[_0x4ceb('0x41')](handleError(_0x38ef0f,null));};exports[_0x4ceb('0x42')]=function(_0xfc2251,_0x2963ca){if(_0xfc2251[_0x4ceb('0x40')]['id']){delete _0xfc2251[_0x4ceb('0x40')]['id'];}return db[_0x4ceb('0x22')][_0x4ceb('0x3e')]({'where':{'id':_0xfc2251[_0x4ceb('0x3a')]['id']}})[_0x4ceb('0x19')](handleEntityNotFound(_0x2963ca,null))['then'](saveUpdates(_0xfc2251[_0x4ceb('0x40')],null))[_0x4ceb('0x19')](respondWithResult(_0x2963ca,null))[_0x4ceb('0x41')](handleError(_0x2963ca,null));};exports[_0x4ceb('0x1a')]=function(_0x48d44c,_0x3dced4){return db[_0x4ceb('0x22')]['find']({'where':{'id':_0x48d44c['params']['id']}})[_0x4ceb('0x19')](handleEntityNotFound(_0x3dced4,null))[_0x4ceb('0x19')](removeEntity(_0x3dced4,null))[_0x4ceb('0x41')](handleError(_0x3dced4,null));};exports[_0x4ceb('0x43')]=function(_0x542e8d,_0x38d206){return db['SquareReport'][_0x4ceb('0x43')]()[_0x4ceb('0x19')](respondWithResult(_0x38d206,null))[_0x4ceb('0x41')](handleError(_0x38d206,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 8b3ce1b..f3bade1 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 _0x0534=['path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3335a2,_0x201923){var _0x34d604=function(_0x4567fb){while(--_0x4567fb){_0x3335a2['push'](_0x3335a2['shift']());}};_0x34d604(++_0x201923);}(_0x0534,0x149));var _0x4053=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0x0534[_0x1073ad];return _0x528474;};'use strict';var _=require(_0x4053('0x0'));var util=require(_0x4053('0x1'));var logger=require(_0x4053('0x2'))(_0x4053('0x3'));var moment=require(_0x4053('0x4'));var BPromise=require(_0x4053('0x5'));var rp=require(_0x4053('0x6'));var fs=require('fs');var path=require(_0x4053('0x7'));var rimraf=require(_0x4053('0x8'));var config=require(_0x4053('0x9'));var attributes=require(_0x4053('0xa'));module[_0x4053('0xb')]=function(_0x3ea7df,_0x105752){return _0x3ea7df[_0x4053('0xc')](_0x4053('0xd'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x4053('0xe'),'fields':['uniqueid','project_name']},{'name':_0x4053('0xf'),'fields':[_0x4053('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf7=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','request-promise','path','./squareReport.attributes','exports','define','uid_pname'];(function(_0x181063,_0x38b543){var _0x248efa=function(_0x13183d){while(--_0x13183d){_0x181063['push'](_0x181063['shift']());}};_0x248efa(++_0x38b543);}(_0xfaf7,0x1b3));var _0x7faf=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xfaf7[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x7faf('0x0'));var util=require(_0x7faf('0x1'));var logger=require(_0x7faf('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7faf('0x3'));var fs=require('fs');var path=require(_0x7faf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7faf('0x5'));module[_0x7faf('0x6')]=function(_0x2eea11,_0x30e1f4){return _0x2eea11[_0x7faf('0x7')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x7faf('0x8'),'fields':[_0x7faf('0x9'),_0x7faf('0xa')]},{'name':_0x7faf('0xb'),'fields':[_0x7faf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d75d492..fca2942 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 _0x41d9=['where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','info','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update'];(function(_0x380f64,_0x3f3b69){var _0x26bf6c=function(_0x1f3737){while(--_0x1f3737){_0x380f64['push'](_0x380f64['shift']());}};_0x26bf6c(++_0x3f3b69);}(_0x41d9,0x85));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var moment=require(_0x941d('0x2'));var BPromise=require(_0x941d('0x3'));var rs=require(_0x941d('0x4'));var fs=require('fs');var Redis=require(_0x941d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x941d('0x6'));var logger=require(_0x941d('0x7'))(_0x941d('0x8'));var config=require(_0x941d('0x9'));var jayson=require(_0x941d('0xa'));var client=jayson[_0x941d('0xb')][_0x941d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c844e,_0xcf6226,_0x287bf0){return new BPromise(function(_0x5a5fdc,_0xf114d1){return client[_0x941d('0xd')](_0x1c844e,_0x287bf0)[_0x941d('0xe')](function(_0x501aa1){logger['info']('SquareReport,\x20%s,\x20%s',_0xcf6226,_0x941d('0xf'));logger[_0x941d('0x10')](_0x941d('0x11'),_0xcf6226,_0x941d('0xf'),JSON[_0x941d('0x12')](_0x501aa1));if(_0x501aa1[_0x941d('0x13')]){if(_0x501aa1[_0x941d('0x13')]['code']===0x1f4){logger['error'](_0x941d('0x14'),_0xcf6226,_0x501aa1[_0x941d('0x13')]['message']);return _0xf114d1(_0x501aa1[_0x941d('0x13')][_0x941d('0x15')]);}logger[_0x941d('0x13')]('SquareReport,\x20%s,\x20%s',_0xcf6226,_0x501aa1['error'][_0x941d('0x15')]);return _0x5a5fdc(_0x501aa1[_0x941d('0x13')][_0x941d('0x15')]);}else{logger[_0x941d('0x16')](_0x941d('0x14'),_0xcf6226,_0x941d('0xf'));_0x5a5fdc(_0x501aa1['result'][_0x941d('0x15')]);}})[_0x941d('0x17')](function(_0x171415){logger[_0x941d('0x13')](_0x941d('0x14'),_0xcf6226,_0x171415);_0xf114d1(_0x171415);});});}exports[_0x941d('0x18')]=function(_0x3ce41c){var _0x2717af=this;return new Promise(function(_0x1e8c6a,_0x20fad1){return db[_0x941d('0x19')][_0x941d('0x1a')](_0x3ce41c[_0x941d('0x1b')],{'raw':_0x3ce41c[_0x941d('0x1c')]?_0x3ce41c[_0x941d('0x1c')][_0x941d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x371b18){logger[_0x941d('0x16')]('CreateSquareReport',_0x3ce41c);logger[_0x941d('0x10')](_0x941d('0x18'),_0x3ce41c,JSON[_0x941d('0x12')](_0x371b18));_0x1e8c6a(_0x371b18);})[_0x941d('0x17')](function(_0x342d79){logger[_0x941d('0x13')](_0x941d('0x18'),_0x342d79[_0x941d('0x15')],_0x3ce41c);_0x20fad1(_0x2717af[_0x941d('0x13')](0x1f4,_0x342d79[_0x941d('0x15')]));});});};exports[_0x941d('0x1e')]=function(_0x220d4c){var _0x5335d8=this;return new Promise(function(_0x388ff5,_0x227555){return db[_0x941d('0x19')][_0x941d('0x1f')](_0x220d4c[_0x941d('0x1b')],{'raw':_0x220d4c[_0x941d('0x1c')]?_0x220d4c[_0x941d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x220d4c[_0x941d('0x1c')]?_0x220d4c[_0x941d('0x1c')][_0x941d('0x20')]||null:null,'attributes':_0x220d4c[_0x941d('0x1c')]?_0x220d4c[_0x941d('0x1c')]['attributes']||null:null,'limit':_0x220d4c[_0x941d('0x1c')]?_0x220d4c['options']['limit']||null:null})['then'](function(_0x4f0234){logger['info'](_0x941d('0x1e'),_0x220d4c);logger['debug'](_0x941d('0x1e'),_0x220d4c,JSON[_0x941d('0x12')](_0x4f0234));_0x388ff5(_0x4f0234);})['catch'](function(_0x43ff12){logger['error'](_0x941d('0x1e'),_0x43ff12[_0x941d('0x15')],_0x220d4c);_0x227555(_0x5335d8['error'](0x1f4,_0x43ff12[_0x941d('0x15')]));});});}; \ No newline at end of file +var _0x4555=['options','raw','SquareReport','update','body','where','attributes','limit','UpdateSquareReport','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4555,0x18f));var _0x5455=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4555[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x5455('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5455('0x1'))['db'];var utils=require(_0x5455('0x2'));var logger=require(_0x5455('0x3'))(_0x5455('0x4'));var config=require('../../config/environment');var jayson=require(_0x5455('0x5'));var client=jayson[_0x5455('0x6')][_0x5455('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x58c343,_0x32e9e7,_0x37d9fc){return new BPromise(function(_0x4f13b3,_0x478c97){return client['request'](_0x58c343,_0x37d9fc)[_0x5455('0x8')](function(_0x3afe76){logger[_0x5455('0x9')]('SquareReport,\x20%s,\x20%s',_0x32e9e7,'request\x20sent');logger[_0x5455('0xa')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x32e9e7,_0x5455('0xb'),JSON[_0x5455('0xc')](_0x3afe76));if(_0x3afe76[_0x5455('0xd')]){if(_0x3afe76[_0x5455('0xd')][_0x5455('0xe')]===0x1f4){logger['error'](_0x5455('0xf'),_0x32e9e7,_0x3afe76[_0x5455('0xd')][_0x5455('0x10')]);return _0x478c97(_0x3afe76[_0x5455('0xd')][_0x5455('0x10')]);}logger[_0x5455('0xd')](_0x5455('0xf'),_0x32e9e7,_0x3afe76[_0x5455('0xd')]['message']);return _0x4f13b3(_0x3afe76[_0x5455('0xd')]['message']);}else{logger[_0x5455('0x9')](_0x5455('0xf'),_0x32e9e7,'request\x20sent');_0x4f13b3(_0x3afe76[_0x5455('0x11')]['message']);}})[_0x5455('0x12')](function(_0x551566){logger['error']('SquareReport,\x20%s,\x20%s',_0x32e9e7,_0x551566);_0x478c97(_0x551566);});});}exports[_0x5455('0x13')]=function(_0x129383){var _0x1c8e9d=this;return new Promise(function(_0x24f782,_0x2f6c25){return db['SquareReport'][_0x5455('0x14')](_0x129383['body'],{'raw':_0x129383['options']?_0x129383[_0x5455('0x15')][_0x5455('0x16')]===undefined?!![]:![]:!![]})[_0x5455('0x8')](function(_0x4e8c43){logger[_0x5455('0x9')](_0x5455('0x13'),_0x129383);logger[_0x5455('0xa')](_0x5455('0x13'),_0x129383,JSON[_0x5455('0xc')](_0x4e8c43));_0x24f782(_0x4e8c43);})['catch'](function(_0x540601){logger[_0x5455('0xd')]('CreateSquareReport',_0x540601[_0x5455('0x10')],_0x129383);_0x2f6c25(_0x1c8e9d[_0x5455('0xd')](0x1f4,_0x540601[_0x5455('0x10')]));});});};exports['UpdateSquareReport']=function(_0x5b2e96){var _0x56f5d8=this;return new Promise(function(_0x28739b,_0x5ba8a4){return db[_0x5455('0x17')][_0x5455('0x18')](_0x5b2e96[_0x5455('0x19')],{'raw':_0x5b2e96[_0x5455('0x15')]?_0x5b2e96[_0x5455('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2e96[_0x5455('0x15')]?_0x5b2e96[_0x5455('0x15')][_0x5455('0x1a')]||null:null,'attributes':_0x5b2e96['options']?_0x5b2e96[_0x5455('0x15')][_0x5455('0x1b')]||null:null,'limit':_0x5b2e96[_0x5455('0x15')]?_0x5b2e96[_0x5455('0x15')][_0x5455('0x1c')]||null:null})['then'](function(_0x35097e){logger[_0x5455('0x9')](_0x5455('0x1d'),_0x5b2e96);logger[_0x5455('0xa')](_0x5455('0x1d'),_0x5b2e96,JSON[_0x5455('0xc')](_0x35097e));_0x28739b(_0x35097e);})[_0x5455('0x12')](function(_0x332dab){logger['error'](_0x5455('0x1d'),_0x332dab[_0x5455('0x10')],_0x5b2e96);_0x5ba8a4(_0x56f5d8[_0x5455('0xd')](0x1f4,_0x332dab[_0x5455('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4b49e6d..f5ef853 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(_0x95ca43,_0x1bf375){var _0x1df59d=function(_0x437537){while(--_0x437537){_0x95ca43['push'](_0x95ca43['shift']());}};_0x1df59d(++_0x1bf375);}(_0x5f2f,0x73));var _0xf5f2=function(_0x85272,_0xc7199b){_0x85272=_0x85272-0x0;var _0xef1064=_0x5f2f[_0x85272];return _0xef1064;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x734265,_0xd40b65){var _0x412861=function(_0x5f1dfe){while(--_0x5f1dfe){_0x734265['push'](_0x734265['shift']());}};_0x412861(++_0xd40b65);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a71c3,_0x2e8608){_0x4a71c3=_0x4a71c3-0x0;var _0x250a7d=_0x5f2f[_0x4a71c3];return _0x250a7d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 919b37e..4925922 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 _0x35e5=['STRING','TEXT','sequelize','exports'];(function(_0x18ba2d,_0x406219){var _0x314b4e=function(_0x5a80b1){while(--_0x5a80b1){_0x18ba2d['push'](_0x18ba2d['shift']());}};_0x314b4e(++_0x406219);}(_0x35e5,0x1c2));var _0x535e=function(_0x3d7546,_0xfcb571){_0x3d7546=_0x3d7546-0x0;var _0x13898b=_0x35e5[_0x3d7546];return _0x13898b;};'use strict';var Sequelize=require(_0x535e('0x0'));module[_0x535e('0x1')]={'uniqueid':{'type':Sequelize[_0x535e('0x2')]},'node':{'type':Sequelize[_0x535e('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x535e('0x3')]},'project_name':{'type':Sequelize[_0x535e('0x2')]},'callerid':{'type':Sequelize[_0x535e('0x2')]}}; \ No newline at end of file +var _0x20a3=['sequelize','exports','STRING'];(function(_0x48ca0d,_0x3d31a4){var _0x19fe85=function(_0x2839b5){while(--_0x2839b5){_0x48ca0d['push'](_0x48ca0d['shift']());}};_0x19fe85(++_0x3d31a4);}(_0x20a3,0x16e));var _0x320a=function(_0x40b0b9,_0x59cd60){_0x40b0b9=_0x40b0b9-0x0;var _0x28e0e2=_0x20a3[_0x40b0b9];return _0x28e0e2;};'use strict';var Sequelize=require(_0x320a('0x0'));module[_0x320a('0x1')]={'uniqueid':{'type':Sequelize[_0x320a('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x320a('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x320a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b031492..66700e1 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 _0xf29a=['map','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','error','send','index'];(function(_0xe02448,_0x2971e5){var _0x5f48ad=function(_0x297739){while(--_0x297739){_0xe02448['push'](_0xe02448['shift']());}};_0x5f48ad(++_0x2971e5);}(_0xf29a,0x1d2));var _0xaf29=function(_0x3a7f91,_0x5058b6){_0x3a7f91=_0x3a7f91-0x0;var _0xcf5ac3=_0xf29a[_0x3a7f91];return _0xcf5ac3;};'use strict';var pdf=require(_0xaf29('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaf29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf29('0x2'));var rp=require(_0xaf29('0x3'));var moment=require('moment');var BPromise=require(_0xaf29('0x4'));var Mustache=require(_0xaf29('0x5'));var util=require('util');var path=require(_0xaf29('0x6'));var sox=require(_0xaf29('0x7'));var csv=require(_0xaf29('0x8'));var ejs=require(_0xaf29('0x9'));var fs=require('fs');var _=require(_0xaf29('0xa'));var squel=require(_0xaf29('0xb'));var crypto=require(_0xaf29('0xc'));var jsforce=require(_0xaf29('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaf29('0x8'));var querystring=require('querystring');var Papa=require(_0xaf29('0xe'));var Redis=require(_0xaf29('0xf'));var authService=require(_0xaf29('0x10'));var qs=require(_0xaf29('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf29('0x12'));var logger=require(_0xaf29('0x13'))(_0xaf29('0x14'));var utils=require(_0xaf29('0x15'));var config=require('../../config/environment');var db=require(_0xaf29('0x16'))['db'];function respondWithStatusCode(_0x37cf43,_0x326435){_0x326435=_0x326435||0xcc;return function(_0x1b1bf7){if(_0x1b1bf7){return _0x37cf43[_0xaf29('0x17')](_0x326435);}return _0x37cf43[_0xaf29('0x18')](_0x326435)[_0xaf29('0x19')]();};}function respondWithResult(_0x51371,_0x45a7f8){_0x45a7f8=_0x45a7f8||0xc8;return function(_0xa9398a){if(_0xa9398a){return _0x51371[_0xaf29('0x18')](_0x45a7f8)[_0xaf29('0x1a')](_0xa9398a);}};}function respondWithFilteredResult(_0x582580,_0x3b18b2){return function(_0xa80f2){if(_0xa80f2){var _0xe97ca8=_0xa80f2[_0xaf29('0x1b')],_0x2d7abf=_0x3b18b2[_0xaf29('0x1c')],_0x316897=_0x3b18b2['offset']+_0x3b18b2[_0xaf29('0x1d')],_0x29b080;if(_0x316897>=_0xe97ca8){_0x316897=_0xe97ca8;_0x29b080=0xc8;}else{_0x29b080=0xce;}_0x582580[_0xaf29('0x18')](_0x29b080);return _0x582580[_0xaf29('0x1e')](_0xaf29('0x1f'),_0x2d7abf+'-'+_0x316897+'/'+_0xe97ca8)[_0xaf29('0x1a')](_0xa80f2);}return null;};}function patchUpdates(_0x53424c){return function(_0x48a3c9){try{jsonpatch[_0xaf29('0x20')](_0x48a3c9,_0x53424c,!![]);}catch(_0x1dbb4e){return BPromise['reject'](_0x1dbb4e);}return _0x48a3c9[_0xaf29('0x21')]();};}function saveUpdates(_0x32dd75,_0x4efaca){return function(_0x1b39a7){if(_0x1b39a7){return _0x1b39a7['update'](_0x32dd75)[_0xaf29('0x22')](function(_0x3797fe){return _0x3797fe;});}return null;};}function removeEntity(_0xbaf45b,_0x1a01c1){return function(_0x28c216){if(_0x28c216){return _0x28c216['destroy']()[_0xaf29('0x22')](function(){_0xbaf45b[_0xaf29('0x18')](0xcc)[_0xaf29('0x19')]();});}};}function handleEntityNotFound(_0x3b8617,_0x2028c5){return function(_0x85ad5a){if(!_0x85ad5a){_0x3b8617[_0xaf29('0x17')](0x194);}return _0x85ad5a;};}function handleError(_0x506c99,_0x9f9800){_0x9f9800=_0x9f9800||0x1f4;return function(_0xbf688b){logger[_0xaf29('0x23')](_0xbf688b['stack']);if(_0xbf688b['name']){delete _0xbf688b['name'];}_0x506c99[_0xaf29('0x18')](_0x9f9800)[_0xaf29('0x24')](_0xbf688b);};}exports[_0xaf29('0x25')]=function(_0x21dad1,_0x5b2866){var _0x12a397={},_0x3a467a={},_0x494265={'count':0x0,'rows':[]};var _0x5581e0=_[_0xaf29('0x26')](db['SquareDetailsReport'][_0xaf29('0x27')],function(_0x4a9361){return{'name':_0x4a9361[_0xaf29('0x28')],'type':_0x4a9361[_0xaf29('0x29')][_0xaf29('0x2a')]};});_0x3a467a[_0xaf29('0x2b')]=_['map'](_0x5581e0,_0xaf29('0x2c'));_0x3a467a['query']=_[_0xaf29('0x2d')](_0x21dad1[_0xaf29('0x2e')]);_0x3a467a['filters']=_['intersection'](_0x3a467a[_0xaf29('0x2b')],_0x3a467a['query']);_0x12a397[_0xaf29('0x2f')]=_[_0xaf29('0x30')](_0x3a467a['model'],qs[_0xaf29('0x31')](_0x21dad1[_0xaf29('0x2e')][_0xaf29('0x31')]));_0x12a397[_0xaf29('0x2f')]=_0x12a397['attributes']['length']?_0x12a397[_0xaf29('0x2f')]:_0x3a467a[_0xaf29('0x2b')];if(!_0x21dad1[_0xaf29('0x2e')][_0xaf29('0x32')](_0xaf29('0x33'))){_0x12a397[_0xaf29('0x1d')]=qs[_0xaf29('0x1d')](_0x21dad1['query'][_0xaf29('0x1d')]);_0x12a397[_0xaf29('0x1c')]=qs['offset'](_0x21dad1[_0xaf29('0x2e')][_0xaf29('0x1c')]);}_0x12a397['order']=qs[_0xaf29('0x34')](_0x21dad1[_0xaf29('0x2e')][_0xaf29('0x34')]);_0x12a397[_0xaf29('0x35')]=qs[_0xaf29('0x36')](_[_0xaf29('0x37')](_0x21dad1[_0xaf29('0x2e')],_0x3a467a['filters']),_0x5581e0);if(_0x21dad1[_0xaf29('0x2e')][_0xaf29('0x38')]){_0x12a397['where']=_[_0xaf29('0x39')](_0x12a397['where'],{'$or':_[_0xaf29('0x26')](_0x5581e0,function(_0x570797){if(_0x570797['type']!==_0xaf29('0x3a')){var _0x26e4f={};_0x26e4f[_0x570797[_0xaf29('0x2c')]]={'$like':'%'+_0x21dad1[_0xaf29('0x2e')][_0xaf29('0x38')]+'%'};return _0x26e4f;}})});}_0x12a397=_[_0xaf29('0x39')]({},_0x12a397,_0x21dad1['options']);var _0x3991ab={'where':_0x12a397[_0xaf29('0x35')]};return db[_0xaf29('0x3b')][_0xaf29('0x1b')](_0x3991ab)[_0xaf29('0x22')](function(_0x5dd361){_0x494265[_0xaf29('0x1b')]=_0x5dd361;if(_0x21dad1['query'][_0xaf29('0x3c')]){_0x12a397[_0xaf29('0x3d')]=[{'all':!![]}];}return db[_0xaf29('0x3b')][_0xaf29('0x3e')](_0x12a397);})[_0xaf29('0x22')](function(_0x301220){_0x494265[_0xaf29('0x3f')]=_0x301220;return _0x494265;})['then'](respondWithFilteredResult(_0x5b2866,_0x12a397))[_0xaf29('0x40')](handleError(_0x5b2866,null));};exports['show']=function(_0x189a37,_0x5424e8){var _0x198dbc={'raw':!![],'where':{'id':_0x189a37[_0xaf29('0x41')]['id']}},_0x4529d5={};_0x4529d5['model']=_[_0xaf29('0x2d')](db[_0xaf29('0x3b')][_0xaf29('0x27')]);_0x4529d5[_0xaf29('0x2e')]=_[_0xaf29('0x2d')](_0x189a37['query']);_0x4529d5['filters']=_[_0xaf29('0x30')](_0x4529d5[_0xaf29('0x2b')],_0x4529d5['query']);_0x198dbc[_0xaf29('0x2f')]=_[_0xaf29('0x30')](_0x4529d5[_0xaf29('0x2b')],qs[_0xaf29('0x31')](_0x189a37['query'][_0xaf29('0x31')]));_0x198dbc[_0xaf29('0x2f')]=_0x198dbc[_0xaf29('0x2f')]['length']?_0x198dbc[_0xaf29('0x2f')]:_0x4529d5[_0xaf29('0x2b')];if(_0x189a37[_0xaf29('0x2e')][_0xaf29('0x3c')]){_0x198dbc[_0xaf29('0x3d')]=[{'all':!![]}];}_0x198dbc=_[_0xaf29('0x39')]({},_0x198dbc,_0x189a37['options']);return db['SquareDetailsReport'][_0xaf29('0x42')](_0x198dbc)['then'](handleEntityNotFound(_0x5424e8,null))[_0xaf29('0x22')](respondWithResult(_0x5424e8,null))['catch'](handleError(_0x5424e8,null));};exports[_0xaf29('0x43')]=function(_0x117011,_0x451a96){return db[_0xaf29('0x3b')][_0xaf29('0x43')](_0x117011[_0xaf29('0x44')],{})['then'](respondWithResult(_0x451a96,0xc9))['catch'](handleError(_0x451a96,null));};exports[_0xaf29('0x45')]=function(_0x28b7ee,_0x4cf2d0){if(_0x28b7ee[_0xaf29('0x44')]['id']){delete _0x28b7ee[_0xaf29('0x44')]['id'];}return db[_0xaf29('0x3b')]['find']({'where':{'id':_0x28b7ee[_0xaf29('0x41')]['id']}})[_0xaf29('0x22')](handleEntityNotFound(_0x4cf2d0,null))[_0xaf29('0x22')](saveUpdates(_0x28b7ee[_0xaf29('0x44')],null))[_0xaf29('0x22')](respondWithResult(_0x4cf2d0,null))[_0xaf29('0x40')](handleError(_0x4cf2d0,null));};exports[_0xaf29('0x46')]=function(_0x102ef9,_0x4f49e1){return db[_0xaf29('0x3b')]['find']({'where':{'id':_0x102ef9[_0xaf29('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f49e1,null))[_0xaf29('0x22')](removeEntity(_0x4f49e1,null))['catch'](handleError(_0x4f49e1,null));};exports[_0xaf29('0x47')]=function(_0x43b0f7,_0x434eab){return db[_0xaf29('0x3b')][_0xaf29('0x47')]()[_0xaf29('0x22')](respondWithResult(_0x434eab,null))[_0xaf29('0x40')](handleError(_0x434eab,null));}; \ No newline at end of file +var _0xb267=['status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','find','create','body','catch','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5d1547,_0x1d622d){var _0x5c2fe4=function(_0x3fee54){while(--_0x3fee54){_0x5d1547['push'](_0x5d1547['shift']());}};_0x5c2fe4(++_0x1d622d);}(_0xb267,0x10e));var _0x7b26=function(_0x421e3a,_0x203c33){_0x421e3a=_0x421e3a-0x0;var _0x10f44f=_0xb267[_0x421e3a];return _0x10f44f;};'use strict';var pdf=require(_0x7b26('0x0'));var emlformat=require(_0x7b26('0x1'));var rimraf=require(_0x7b26('0x2'));var zipdir=require(_0x7b26('0x3'));var jsonpatch=require(_0x7b26('0x4'));var rp=require('request-promise');var moment=require(_0x7b26('0x5'));var BPromise=require(_0x7b26('0x6'));var Mustache=require(_0x7b26('0x7'));var util=require(_0x7b26('0x8'));var path=require('path');var sox=require(_0x7b26('0x9'));var csv=require('to-csv');var ejs=require(_0x7b26('0xa'));var fs=require('fs');var _=require(_0x7b26('0xb'));var squel=require(_0x7b26('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b26('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7b26('0xe'));var querystring=require('querystring');var Papa=require(_0x7b26('0xf'));var Redis=require(_0x7b26('0x10'));var authService=require(_0x7b26('0x11'));var qs=require(_0x7b26('0x12'));var as=require(_0x7b26('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b26('0x14'))(_0x7b26('0x15'));var utils=require(_0x7b26('0x16'));var config=require(_0x7b26('0x17'));var db=require(_0x7b26('0x18'))['db'];function respondWithStatusCode(_0x12d92c,_0x5365a0){_0x5365a0=_0x5365a0||0xcc;return function(_0x32b316){if(_0x32b316){return _0x12d92c[_0x7b26('0x19')](_0x5365a0);}return _0x12d92c[_0x7b26('0x1a')](_0x5365a0)[_0x7b26('0x1b')]();};}function respondWithResult(_0x2ee948,_0x3c95fb){_0x3c95fb=_0x3c95fb||0xc8;return function(_0x4e45ab){if(_0x4e45ab){return _0x2ee948[_0x7b26('0x1a')](_0x3c95fb)[_0x7b26('0x1c')](_0x4e45ab);}};}function respondWithFilteredResult(_0x22cac7,_0x2b02c1){return function(_0x567276){if(_0x567276){var _0x3073ab=_0x567276[_0x7b26('0x1d')],_0x1a0864=_0x2b02c1[_0x7b26('0x1e')],_0x5b7822=_0x2b02c1['offset']+_0x2b02c1[_0x7b26('0x1f')],_0x19a3da;if(_0x5b7822>=_0x3073ab){_0x5b7822=_0x3073ab;_0x19a3da=0xc8;}else{_0x19a3da=0xce;}_0x22cac7[_0x7b26('0x1a')](_0x19a3da);return _0x22cac7[_0x7b26('0x20')](_0x7b26('0x21'),_0x1a0864+'-'+_0x5b7822+'/'+_0x3073ab)[_0x7b26('0x1c')](_0x567276);}return null;};}function patchUpdates(_0x3e5835){return function(_0x1eaafe){try{jsonpatch['apply'](_0x1eaafe,_0x3e5835,!![]);}catch(_0xb9939e){return BPromise[_0x7b26('0x22')](_0xb9939e);}return _0x1eaafe['save']();};}function saveUpdates(_0x48f8c2,_0x2fffc0){return function(_0x3b6b06){if(_0x3b6b06){return _0x3b6b06[_0x7b26('0x23')](_0x48f8c2)[_0x7b26('0x24')](function(_0x2e192a){return _0x2e192a;});}return null;};}function removeEntity(_0x2f4c4d,_0x345e07){return function(_0x1bc4b2){if(_0x1bc4b2){return _0x1bc4b2['destroy']()[_0x7b26('0x24')](function(){_0x2f4c4d[_0x7b26('0x1a')](0xcc)[_0x7b26('0x1b')]();});}};}function handleEntityNotFound(_0x3df1e5,_0x4aaacf){return function(_0x29b8e7){if(!_0x29b8e7){_0x3df1e5['sendStatus'](0x194);}return _0x29b8e7;};}function handleError(_0x416d7d,_0x8a3029){_0x8a3029=_0x8a3029||0x1f4;return function(_0x3b3a2e){logger[_0x7b26('0x25')](_0x3b3a2e['stack']);if(_0x3b3a2e[_0x7b26('0x26')]){delete _0x3b3a2e[_0x7b26('0x26')];}_0x416d7d['status'](_0x8a3029)['send'](_0x3b3a2e);};}exports[_0x7b26('0x27')]=function(_0x1cdb3e,_0x3f220e){var _0x51911c={},_0x55d57f={},_0x584f5d={'count':0x0,'rows':[]};var _0x4f1cbb=_[_0x7b26('0x28')](db[_0x7b26('0x29')][_0x7b26('0x2a')],function(_0x5dcf62){return{'name':_0x5dcf62[_0x7b26('0x2b')],'type':_0x5dcf62[_0x7b26('0x2c')][_0x7b26('0x2d')]};});_0x55d57f[_0x7b26('0x2e')]=_[_0x7b26('0x28')](_0x4f1cbb,_0x7b26('0x26'));_0x55d57f[_0x7b26('0x2f')]=_[_0x7b26('0x30')](_0x1cdb3e[_0x7b26('0x2f')]);_0x55d57f[_0x7b26('0x31')]=_[_0x7b26('0x32')](_0x55d57f[_0x7b26('0x2e')],_0x55d57f['query']);_0x51911c['attributes']=_[_0x7b26('0x32')](_0x55d57f[_0x7b26('0x2e')],qs[_0x7b26('0x33')](_0x1cdb3e[_0x7b26('0x2f')]['fields']));_0x51911c[_0x7b26('0x34')]=_0x51911c[_0x7b26('0x34')][_0x7b26('0x35')]?_0x51911c[_0x7b26('0x34')]:_0x55d57f[_0x7b26('0x2e')];if(!_0x1cdb3e[_0x7b26('0x2f')][_0x7b26('0x36')]('nolimit')){_0x51911c['limit']=qs[_0x7b26('0x1f')](_0x1cdb3e[_0x7b26('0x2f')][_0x7b26('0x1f')]);_0x51911c[_0x7b26('0x1e')]=qs[_0x7b26('0x1e')](_0x1cdb3e['query'][_0x7b26('0x1e')]);}_0x51911c[_0x7b26('0x37')]=qs[_0x7b26('0x38')](_0x1cdb3e[_0x7b26('0x2f')][_0x7b26('0x38')]);_0x51911c['where']=qs[_0x7b26('0x31')](_[_0x7b26('0x39')](_0x1cdb3e[_0x7b26('0x2f')],_0x55d57f[_0x7b26('0x31')]),_0x4f1cbb);if(_0x1cdb3e[_0x7b26('0x2f')][_0x7b26('0x3a')]){_0x51911c['where']=_['merge'](_0x51911c[_0x7b26('0x3b')],{'$or':_['map'](_0x4f1cbb,function(_0x363bfa){if(_0x363bfa['type']!==_0x7b26('0x3c')){var _0x20e582={};_0x20e582[_0x363bfa[_0x7b26('0x26')]]={'$like':'%'+_0x1cdb3e[_0x7b26('0x2f')]['filter']+'%'};return _0x20e582;}})});}_0x51911c=_[_0x7b26('0x3d')]({},_0x51911c,_0x1cdb3e[_0x7b26('0x3e')]);var _0x253889={'where':_0x51911c[_0x7b26('0x3b')]};return db['SquareDetailsReport'][_0x7b26('0x1d')](_0x253889)[_0x7b26('0x24')](function(_0x9c25e){_0x584f5d['count']=_0x9c25e;if(_0x1cdb3e['query']['includeAll']){_0x51911c[_0x7b26('0x3f')]=[{'all':!![]}];}return db[_0x7b26('0x29')][_0x7b26('0x40')](_0x51911c);})['then'](function(_0x23a126){_0x584f5d[_0x7b26('0x41')]=_0x23a126;return _0x584f5d;})['then'](respondWithFilteredResult(_0x3f220e,_0x51911c))['catch'](handleError(_0x3f220e,null));};exports[_0x7b26('0x42')]=function(_0x1a1b02,_0x4fedcf){var _0x13e695={'raw':!![],'where':{'id':_0x1a1b02[_0x7b26('0x43')]['id']}},_0x29efc5={};_0x29efc5[_0x7b26('0x2e')]=_[_0x7b26('0x30')](db[_0x7b26('0x29')][_0x7b26('0x2a')]);_0x29efc5[_0x7b26('0x2f')]=_['keys'](_0x1a1b02[_0x7b26('0x2f')]);_0x29efc5[_0x7b26('0x31')]=_[_0x7b26('0x32')](_0x29efc5[_0x7b26('0x2e')],_0x29efc5[_0x7b26('0x2f')]);_0x13e695[_0x7b26('0x34')]=_['intersection'](_0x29efc5[_0x7b26('0x2e')],qs[_0x7b26('0x33')](_0x1a1b02[_0x7b26('0x2f')]['fields']));_0x13e695['attributes']=_0x13e695[_0x7b26('0x34')][_0x7b26('0x35')]?_0x13e695[_0x7b26('0x34')]:_0x29efc5[_0x7b26('0x2e')];if(_0x1a1b02['query']['includeAll']){_0x13e695[_0x7b26('0x3f')]=[{'all':!![]}];}_0x13e695=_[_0x7b26('0x3d')]({},_0x13e695,_0x1a1b02['options']);return db['SquareDetailsReport'][_0x7b26('0x44')](_0x13e695)['then'](handleEntityNotFound(_0x4fedcf,null))[_0x7b26('0x24')](respondWithResult(_0x4fedcf,null))['catch'](handleError(_0x4fedcf,null));};exports[_0x7b26('0x45')]=function(_0x4bc7c1,_0x2a3345){return db[_0x7b26('0x29')][_0x7b26('0x45')](_0x4bc7c1[_0x7b26('0x46')],{})[_0x7b26('0x24')](respondWithResult(_0x2a3345,0xc9))[_0x7b26('0x47')](handleError(_0x2a3345,null));};exports[_0x7b26('0x23')]=function(_0xac50b1,_0x254e7d){if(_0xac50b1[_0x7b26('0x46')]['id']){delete _0xac50b1[_0x7b26('0x46')]['id'];}return db[_0x7b26('0x29')][_0x7b26('0x44')]({'where':{'id':_0xac50b1[_0x7b26('0x43')]['id']}})[_0x7b26('0x24')](handleEntityNotFound(_0x254e7d,null))[_0x7b26('0x24')](saveUpdates(_0xac50b1[_0x7b26('0x46')],null))['then'](respondWithResult(_0x254e7d,null))[_0x7b26('0x47')](handleError(_0x254e7d,null));};exports[_0x7b26('0x48')]=function(_0x9f83f2,_0x864a95){return db[_0x7b26('0x29')]['find']({'where':{'id':_0x9f83f2[_0x7b26('0x43')]['id']}})[_0x7b26('0x24')](handleEntityNotFound(_0x864a95,null))[_0x7b26('0x24')](removeEntity(_0x864a95,null))[_0x7b26('0x47')](handleError(_0x864a95,null));};exports[_0x7b26('0x49')]=function(_0x31ac45,_0x4efeb1){return db['SquareDetailsReport'][_0x7b26('0x49')]()['then'](respondWithResult(_0x4efeb1,null))[_0x7b26('0x47')](handleError(_0x4efeb1,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 265361a..a3619f3 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 _0x3952=['request-promise','rimraf','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54449b,_0x522df7){var _0x1eef5d=function(_0x4efd86){while(--_0x4efd86){_0x54449b['push'](_0x54449b['shift']());}};_0x1eef5d(++_0x522df7);}(_0x3952,0xc0));var _0x2395=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x3952[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x2395('0x0'));var util=require(_0x2395('0x1'));var logger=require(_0x2395('0x2'))(_0x2395('0x3'));var moment=require(_0x2395('0x4'));var BPromise=require(_0x2395('0x5'));var rp=require(_0x2395('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2395('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x2395('0x8')]=function(_0x55eefd,_0x4a668c){return _0x55eefd[_0x2395('0x9')](_0x2395('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0fa=['exports','define','SquareDetailsReport','report_square_details','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x1904d5,_0x3c9b12){var _0x83368e=function(_0x568fdd){while(--_0x568fdd){_0x1904d5['push'](_0x1904d5['shift']());}};_0x83368e(++_0x3c9b12);}(_0xc0fa,0x14e));var _0xac0f=function(_0x15df45,_0x2b7b4d){_0x15df45=_0x15df45-0x0;var _0x256bfd=_0xc0fa[_0x15df45];return _0x256bfd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac0f('0x0'))(_0xac0f('0x1'));var moment=require(_0xac0f('0x2'));var BPromise=require(_0xac0f('0x3'));var rp=require(_0xac0f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac0f('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0xac0f('0x6')]=function(_0x39ca5f,_0x4cda29){return _0x39ca5f[_0xac0f('0x7')](_0xac0f('0x8'),attributes,{'tableName':_0xac0f('0x9'),'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 9834273..14ef947 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 _0xd42f=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd42f,0x138));var _0xfd42=function(_0x5b266a,_0x1f2f73){_0x5b266a=_0x5b266a-0x0;var _0x3b4aea=_0xd42f[_0x5b266a];return _0x3b4aea;};'use strict';var _=require(_0xfd42('0x0'));var util=require('util');var moment=require(_0xfd42('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd42('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd42('0x3'))['db'];var utils=require(_0xfd42('0x4'));var logger=require(_0xfd42('0x5'))(_0xfd42('0x6'));var config=require(_0xfd42('0x7'));var jayson=require(_0xfd42('0x8'));var client=jayson[_0xfd42('0x9')][_0xfd42('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ad25,_0x11ae2d,_0x1e9947){return new BPromise(function(_0x397867,_0xc69d7b){return client['request'](_0x59ad25,_0x1e9947)[_0xfd42('0xb')](function(_0x413f5d){logger['info'](_0xfd42('0xc'),_0x11ae2d,_0xfd42('0xd'));logger[_0xfd42('0xe')](_0xfd42('0xf'),_0x11ae2d,'request\x20sent',JSON[_0xfd42('0x10')](_0x413f5d));if(_0x413f5d['error']){if(_0x413f5d[_0xfd42('0x11')][_0xfd42('0x12')]===0x1f4){logger[_0xfd42('0x11')](_0xfd42('0xc'),_0x11ae2d,_0x413f5d['error']['message']);return _0xc69d7b(_0x413f5d[_0xfd42('0x11')][_0xfd42('0x13')]);}logger['error'](_0xfd42('0xc'),_0x11ae2d,_0x413f5d[_0xfd42('0x11')]['message']);return _0x397867(_0x413f5d[_0xfd42('0x11')][_0xfd42('0x13')]);}else{logger[_0xfd42('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x11ae2d,'request\x20sent');_0x397867(_0x413f5d['result']['message']);}})[_0xfd42('0x15')](function(_0x51c6c1){logger['error'](_0xfd42('0xc'),_0x11ae2d,_0x51c6c1);_0xc69d7b(_0x51c6c1);});});}exports[_0xfd42('0x16')]=function(_0x51260a){var _0x75bed2=this;return new Promise(function(_0x24bec2,_0x2377ce){return db[_0xfd42('0x17')]['create'](_0x51260a[_0xfd42('0x18')],{'raw':_0x51260a[_0xfd42('0x19')]?_0x51260a[_0xfd42('0x19')][_0xfd42('0x1a')]===undefined?!![]:![]:!![]})[_0xfd42('0xb')](function(_0x4f8bb4){logger['info'](_0xfd42('0x16'),_0x51260a);logger[_0xfd42('0xe')](_0xfd42('0x16'),_0x51260a,JSON[_0xfd42('0x10')](_0x4f8bb4));_0x24bec2(_0x4f8bb4);})[_0xfd42('0x15')](function(_0x34806d){logger[_0xfd42('0x11')](_0xfd42('0x16'),_0x34806d['message'],_0x51260a);_0x2377ce(_0x75bed2[_0xfd42('0x11')](0x1f4,_0x34806d[_0xfd42('0x13')]));});});}; \ No newline at end of file +var _0xd013=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash'];(function(_0x36d9ac,_0x314606){var _0x281977=function(_0x200ae4){while(--_0x200ae4){_0x36d9ac['push'](_0x36d9ac['shift']());}};_0x281977(++_0x314606);}(_0xd013,0xad));var _0x3d01=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xd013[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0x3d01('0x0'));var util=require(_0x3d01('0x1'));var moment=require('moment');var BPromise=require(_0x3d01('0x2'));var rs=require(_0x3d01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d01('0x4'))['db'];var utils=require(_0x3d01('0x5'));var logger=require(_0x3d01('0x6'))(_0x3d01('0x7'));var config=require(_0x3d01('0x8'));var jayson=require(_0x3d01('0x9'));var client=jayson[_0x3d01('0xa')][_0x3d01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a02a8,_0x3906a8,_0x4a0283){return new BPromise(function(_0x37a098,_0x19ce27){return client[_0x3d01('0xc')](_0x1a02a8,_0x4a0283)[_0x3d01('0xd')](function(_0x1da89b){logger[_0x3d01('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x3906a8,_0x3d01('0xf'));logger[_0x3d01('0x10')](_0x3d01('0x11'),_0x3906a8,'request\x20sent',JSON[_0x3d01('0x12')](_0x1da89b));if(_0x1da89b[_0x3d01('0x13')]){if(_0x1da89b[_0x3d01('0x13')][_0x3d01('0x14')]===0x1f4){logger[_0x3d01('0x13')](_0x3d01('0x15'),_0x3906a8,_0x1da89b[_0x3d01('0x13')][_0x3d01('0x16')]);return _0x19ce27(_0x1da89b['error'][_0x3d01('0x16')]);}logger[_0x3d01('0x13')](_0x3d01('0x15'),_0x3906a8,_0x1da89b[_0x3d01('0x13')][_0x3d01('0x16')]);return _0x37a098(_0x1da89b[_0x3d01('0x13')][_0x3d01('0x16')]);}else{logger[_0x3d01('0xe')](_0x3d01('0x15'),_0x3906a8,_0x3d01('0xf'));_0x37a098(_0x1da89b[_0x3d01('0x17')][_0x3d01('0x16')]);}})['catch'](function(_0x2aebeb){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3906a8,_0x2aebeb);_0x19ce27(_0x2aebeb);});});}exports[_0x3d01('0x18')]=function(_0x4871dc){var _0x56dfc5=this;return new Promise(function(_0x145204,_0x102c8b){return db[_0x3d01('0x19')][_0x3d01('0x1a')](_0x4871dc[_0x3d01('0x1b')],{'raw':_0x4871dc[_0x3d01('0x1c')]?_0x4871dc['options']['raw']===undefined?!![]:![]:!![]})[_0x3d01('0xd')](function(_0x49c3a8){logger['info'](_0x3d01('0x18'),_0x4871dc);logger[_0x3d01('0x10')](_0x3d01('0x18'),_0x4871dc,JSON['stringify'](_0x49c3a8));_0x145204(_0x49c3a8);})['catch'](function(_0xa066be){logger[_0x3d01('0x13')]('CreateSquareDetailsReport',_0xa066be[_0x3d01('0x16')],_0x4871dc);_0x102c8b(_0x56dfc5[_0x3d01('0x13')](0x1f4,_0xa066be[_0x3d01('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a4524cb..2334fd5 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 _0x88c7=['/process/:pid/kill','killProcess','exports','express','./system.controller','get'];(function(_0x5b163b,_0x559103){var _0x71dddf=function(_0x20e204){while(--_0x20e204){_0x5b163b['push'](_0x5b163b['shift']());}};_0x71dddf(++_0x559103);}(_0x88c7,0x6f));var _0x788c=function(_0x84e61d,_0x5df876){_0x84e61d=_0x84e61d-0x0;var _0x54486a=_0x88c7[_0x84e61d];return _0x54486a;};'use strict';var express=require(_0x788c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x788c('0x1'));router[_0x788c('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0x788c('0x2')](_0x788c('0x3'),auth['isAuthenticated'](),controller[_0x788c('0x4')]);module[_0x788c('0x5')]=router; \ No newline at end of file +var _0xcbb3=['get','isAuthenticated','/process/:pid/kill','exports','../../components/auth/service'];(function(_0x499140,_0x4c602c){var _0x4db9ec=function(_0x13f314){while(--_0x13f314){_0x499140['push'](_0x499140['shift']());}};_0x4db9ec(++_0x4c602c);}(_0xcbb3,0x130));var _0x3cbb=function(_0x45aad4,_0x44fe22){_0x45aad4=_0x45aad4-0x0;var _0x5ce411=_0xcbb3[_0x45aad4];return _0x5ce411;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x3cbb('0x0'));var controller=require('./system.controller');router[_0x3cbb('0x1')]('/',auth[_0x3cbb('0x2')](),controller['index']);router[_0x3cbb('0x1')](_0x3cbb('0x3'),auth[_0x3cbb('0x2')](),controller['killProcess']);module[_0x3cbb('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index fe205d3..8253643 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 _0xdbd8=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','lodash','error','name','send','index','then','status','json','catch'];(function(_0x3f9819,_0x4c2e0b){var _0x2700c2=function(_0x59fd7d){while(--_0x59fd7d){_0x3f9819['push'](_0x3f9819['shift']());}};_0x2700c2(++_0x4c2e0b);}(_0xdbd8,0x1a3));var _0x8dbd=function(_0x9b22a4,_0x52162c){_0x9b22a4=_0x9b22a4-0x0;var _0xcad23b=_0xdbd8[_0x9b22a4];return _0xcad23b;};'use strict';var info=require(_0x8dbd('0x0'));var exec=require(_0x8dbd('0x1'))[_0x8dbd('0x2')];var logger=require('../../config/logger')(_0x8dbd('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x8dbd('0x4'));function handleError(_0x15e903,_0x4b9ec0,_0xa124dd){_0x4b9ec0=_0x4b9ec0||0x1f4;return function(_0xc295cf){logger[_0x8dbd('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0xa124dd,_0x4b9ec0,util['inspect'](_0xc295cf,{'showHidden':![],'depth':null}));delete _0xc295cf[_0x8dbd('0x6')];_0x15e903['status'](_0x4b9ec0)[_0x8dbd('0x7')](_0xc295cf);};}exports[_0x8dbd('0x8')]=function(_0x6966ad,_0x25c08d){return info['getAllData']()[_0x8dbd('0x9')](function(_0x5ae80a){return _0x25c08d[_0x8dbd('0xa')](0xc8)[_0x8dbd('0xb')](_0x5ae80a);})[_0x8dbd('0xc')](function(_0x593cce){return _0x25c08d['status'](0x1f4)[_0x8dbd('0xb')](_0x593cce);});};exports['killProcess']=function(_0x876f86,_0x3e0eff){var _0x3b68f5=[_0x8dbd('0xd')];return new BPromise(function(_0x39374a,_0x5c6c5f){return exec(util[_0x8dbd('0xe')](_0x8dbd('0xf'),_0x876f86[_0x8dbd('0x10')][_0x8dbd('0x11')]),function(_0x50d06b,_0x39ed66,_0x523c32){if(_0x50d06b){return _0x5c6c5f(_0x50d06b);}return _0x39374a(_0x39ed66);});})['then'](function(_0x4abab9){var _0x10592f=![];var _0x48254f=_0x4abab9[_0x8dbd('0x12')](/\n/);for(var _0x1ee373=0x0,_0x148232=_0x3b68f5[_0x8dbd('0x13')];_0x1ee373<_0x148232,_0x10592f===![];_0x1ee373+=0x1){if(_0x4abab9['indexOf'](_0x3b68f5[_0x1ee373])>=0x0){_0x10592f=!![];}}if(!_0x10592f){throw new Error(util['format'](_0x8dbd('0x14'),_0x876f86['params']['pid']));}process[_0x8dbd('0x15')](_0x876f86['params'][_0x8dbd('0x11')],_0x8dbd('0x16'));return _0x3e0eff[_0x8dbd('0xa')](0xc8)['json']({'message':util[_0x8dbd('0xe')](_0x8dbd('0x17'),_0x876f86[_0x8dbd('0x10')][_0x8dbd('0x11')])});})[_0x8dbd('0xc')](handleError(_0x3e0eff,null,'killProcess'));}; \ No newline at end of file +var _0x5167=['lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','api','util'];(function(_0x24bcb6,_0x3f4f54){var _0x5e1c30=function(_0x17d7ca){while(--_0x17d7ca){_0x24bcb6['push'](_0x24bcb6['shift']());}};_0x5e1c30(++_0x3f4f54);}(_0x5167,0xff));var _0x7516=function(_0x332634,_0x4060a0){_0x332634=_0x332634-0x0;var _0x30430c=_0x5167[_0x332634];return _0x30430c;};'use strict';var info=require(_0x7516('0x0'));var exec=require(_0x7516('0x1'))['exec'];var logger=require(_0x7516('0x2'))(_0x7516('0x3'));var util=require(_0x7516('0x4'));var BPromise=require('bluebird');var _=require(_0x7516('0x5'));function handleError(_0x2f3fa7,_0x3c6a35,_0x151861){_0x3c6a35=_0x3c6a35||0x1f4;return function(_0x1b3d6f){logger['error'](_0x7516('0x6'),_0x151861,_0x3c6a35,util[_0x7516('0x7')](_0x1b3d6f,{'showHidden':![],'depth':null}));delete _0x1b3d6f[_0x7516('0x8')];_0x2f3fa7[_0x7516('0x9')](_0x3c6a35)[_0x7516('0xa')](_0x1b3d6f);};}exports[_0x7516('0xb')]=function(_0x40effb,_0x31f4b4){return info['getAllData']()[_0x7516('0xc')](function(_0x39f6d9){return _0x31f4b4[_0x7516('0x9')](0xc8)[_0x7516('0xd')](_0x39f6d9);})[_0x7516('0xe')](function(_0x43cdfb){return _0x31f4b4[_0x7516('0x9')](0x1f4)[_0x7516('0xd')](_0x43cdfb);});};exports['killProcess']=function(_0x47b6b5,_0x4e18fc){var _0x42056d=[_0x7516('0xf')];return new BPromise(function(_0x502ea5,_0x434a3){return exec(util[_0x7516('0x10')](_0x7516('0x11'),_0x47b6b5[_0x7516('0x12')][_0x7516('0x13')]),function(_0x4ad7dc,_0x47cea6,_0x2628ea){if(_0x4ad7dc){return _0x434a3(_0x4ad7dc);}return _0x502ea5(_0x47cea6);});})[_0x7516('0xc')](function(_0x357043){var _0x35c91c=![];var _0xab7919=_0x357043[_0x7516('0x14')](/\n/);for(var _0x4007df=0x0,_0x413ea4=_0x42056d['length'];_0x4007df<_0x413ea4,_0x35c91c===![];_0x4007df+=0x1){if(_0x357043[_0x7516('0x15')](_0x42056d[_0x4007df])>=0x0){_0x35c91c=!![];}}if(!_0x35c91c){throw new Error(util[_0x7516('0x10')](_0x7516('0x16'),_0x47b6b5[_0x7516('0x12')]['pid']));}process['kill'](_0x47b6b5[_0x7516('0x12')]['pid'],_0x7516('0x17'));return _0x4e18fc['status'](0xc8)[_0x7516('0xd')]({'message':util['format'](_0x7516('0x18'),_0x47b6b5[_0x7516('0x12')]['pid'])});})[_0x7516('0xe')](handleError(_0x4e18fc,null,_0x7516('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 49a1ef0..0a246c3 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 _0xb821=['post','create','put','update','delete','destroy','exports','util','path','Router','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show'];(function(_0x28eedc,_0x176917){var _0x575e59=function(_0x40f58d){while(--_0x40f58d){_0x28eedc['push'](_0x28eedc['shift']());}};_0x575e59(++_0x176917);}(_0xb821,0xa7));var _0x1b82=function(_0x39401a,_0x27c69e){_0x39401a=_0x39401a-0x0;var _0x721ae5=_0xb821[_0x39401a];return _0x721ae5;};'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('0x9')]('/',auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')](_0x1b82('0x7'),auth['isAuthenticated'](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);module[_0x1b82('0xf')]=router; \ No newline at end of file +var _0x1be1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbaba6c,_0x134ff3){var _0x49c833=function(_0x7597ba){while(--_0x7597ba){_0xbaba6c['push'](_0xbaba6c['shift']());}};_0x49c833(++_0x134ff3);}(_0x1be1,0x192));var _0x11be=function(_0x5008e2,_0x40951b){_0x5008e2=_0x5008e2-0x0;var _0x6a8781=_0x1be1[_0x5008e2];return _0x6a8781;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var auth=require(_0x11be('0x3'));var interaction=require(_0x11be('0x4'));var config=require(_0x11be('0x5'));var controller=require('./tag.controller');router[_0x11be('0x6')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0x8')]);router['get'](_0x11be('0x9'),auth['isAuthenticated'](),controller[_0x11be('0xa')]);router[_0x11be('0xb')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/:id',auth[_0x11be('0x7')](),controller[_0x11be('0xe')]);router['delete'](_0x11be('0x9'),auth[_0x11be('0x7')](),controller[_0x11be('0xf')]);module[_0x11be('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b65388a..00a5d77 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 _0xe5b5=['exports','STRING','name','#0091EA','sequelize'];(function(_0x2b0188,_0x2e6f26){var _0x30489c=function(_0x18c912){while(--_0x18c912){_0x2b0188['push'](_0x2b0188['shift']());}};_0x30489c(++_0x2e6f26);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0xe5b5[_0x4653f7];return _0x5454da;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'name':{'type':Sequelize[_0x5e5b('0x2')],'unique':_0x5e5b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x4')},'description':{'type':Sequelize[_0x5e5b('0x2')]}}; \ No newline at end of file +var _0xac4a=['exports','STRING','name','#0091EA','sequelize'];(function(_0x5809c7,_0x1d780d){var _0x568f8e=function(_0x3b8374){while(--_0x3b8374){_0x5809c7['push'](_0x5809c7['shift']());}};_0x568f8e(++_0x1d780d);}(_0xac4a,0x13f));var _0xaac4=function(_0x3901be,_0x211fee){_0x3901be=_0x3901be-0x0;var _0x348de8=_0xac4a[_0x3901be];return _0x348de8;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'unique':_0xaac4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a8124a8..63b6efd 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 _0xaa93=['../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','end','sendStatus','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','Tag','include','findAll','catch','show','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa93,0xd9));var _0x3aa9=function(_0xddb66d,_0x2b174b){_0xddb66d=_0xddb66d-0x0;var _0x985a9f=_0xaa93[_0xddb66d];return _0x985a9f;};'use strict';var pdf=require(_0x3aa9('0x0'));var emlformat=require(_0x3aa9('0x1'));var rimraf=require(_0x3aa9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3aa9('0x3'));var rp=require('request-promise');var moment=require(_0x3aa9('0x4'));var BPromise=require(_0x3aa9('0x5'));var Mustache=require('mustache');var util=require(_0x3aa9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3aa9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3aa9('0x8'));var squel=require(_0x3aa9('0x9'));var crypto=require('crypto');var jsforce=require(_0x3aa9('0xa'));var deskjs=require(_0x3aa9('0xb'));var toCsv=require(_0x3aa9('0x7'));var querystring=require(_0x3aa9('0xc'));var Papa=require(_0x3aa9('0xd'));var Redis=require(_0x3aa9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3aa9('0xf'));var hardwareService=require(_0x3aa9('0x10'));var logger=require(_0x3aa9('0x11'))(_0x3aa9('0x12'));var utils=require(_0x3aa9('0x13'));var config=require(_0x3aa9('0x14'));var db=require(_0x3aa9('0x15'))['db'];function respondWithStatusCode(_0xf8ed45,_0x3316ec){_0x3316ec=_0x3316ec||0xcc;return function(_0x225c31){if(_0x225c31){return _0xf8ed45['sendStatus'](_0x3316ec);}return _0xf8ed45[_0x3aa9('0x16')](_0x3316ec)['end']();};}function respondWithResult(_0x7b0629,_0x644ffe){_0x644ffe=_0x644ffe||0xc8;return function(_0x29c00e){if(_0x29c00e){return _0x7b0629[_0x3aa9('0x16')](_0x644ffe)[_0x3aa9('0x17')](_0x29c00e);}};}function respondWithFilteredResult(_0x1db6dd,_0x383d4d){return function(_0x2f89f){if(_0x2f89f){var _0x1c8620=_0x2f89f[_0x3aa9('0x18')],_0x5c7e87=_0x383d4d['offset'],_0x4b5319=_0x383d4d[_0x3aa9('0x19')]+_0x383d4d[_0x3aa9('0x1a')],_0x57287e;if(_0x4b5319>=_0x1c8620){_0x4b5319=_0x1c8620;_0x57287e=0xc8;}else{_0x57287e=0xce;}_0x1db6dd['status'](_0x57287e);return _0x1db6dd[_0x3aa9('0x1b')](_0x3aa9('0x1c'),_0x5c7e87+'-'+_0x4b5319+'/'+_0x1c8620)[_0x3aa9('0x17')](_0x2f89f);}return null;};}function patchUpdates(_0x3235fb){return function(_0x3c625a){try{jsonpatch[_0x3aa9('0x1d')](_0x3c625a,_0x3235fb,!![]);}catch(_0x1356d4){return BPromise[_0x3aa9('0x1e')](_0x1356d4);}return _0x3c625a[_0x3aa9('0x1f')]();};}function saveUpdates(_0x47599c,_0x594c14){return function(_0x50e87c){if(_0x50e87c){return _0x50e87c[_0x3aa9('0x20')](_0x47599c)[_0x3aa9('0x21')](function(_0x35e2cf){return _0x35e2cf;});}return null;};}function removeEntity(_0x1c936b,_0x18dcc2){return function(_0x102039){if(_0x102039){return _0x102039[_0x3aa9('0x22')]()['then'](function(){var _0x3109d9=_0x102039[_0x3aa9('0x23')]({'plain':!![]});var _0x50b2ed=_0x3aa9('0x24');return db[_0x3aa9('0x25')][_0x3aa9('0x22')]({'where':{'type':_0x50b2ed,'resourceId':_0x3109d9['id']}})['then'](function(){return _0x102039;});})['then'](function(){_0x1c936b[_0x3aa9('0x16')](0xcc)[_0x3aa9('0x26')]();});}};}function handleEntityNotFound(_0x27fe49,_0x5d33bd){return function(_0x5a00da){if(!_0x5a00da){_0x27fe49[_0x3aa9('0x27')](0x194);}return _0x5a00da;};}function handleError(_0x5fa0bd,_0x4674fb){_0x4674fb=_0x4674fb||0x1f4;return function(_0x48d7d0){logger[_0x3aa9('0x28')](_0x48d7d0['stack']);if(_0x48d7d0['name']){delete _0x48d7d0[_0x3aa9('0x29')];}_0x5fa0bd[_0x3aa9('0x16')](_0x4674fb)['send'](_0x48d7d0);};}exports['index']=function(_0x436c5b,_0x3ce554){var _0x5ce2ce={},_0x1adba8={},_0x451057={'count':0x0,'rows':[]};var _0x3289d6=_[_0x3aa9('0x2a')](db['Tag'][_0x3aa9('0x2b')],function(_0x24338a){return{'name':_0x24338a[_0x3aa9('0x2c')],'type':_0x24338a[_0x3aa9('0x2d')][_0x3aa9('0x2e')]};});_0x1adba8[_0x3aa9('0x2f')]=_[_0x3aa9('0x2a')](_0x3289d6,'name');_0x1adba8[_0x3aa9('0x30')]=_[_0x3aa9('0x31')](_0x436c5b[_0x3aa9('0x30')]);_0x1adba8[_0x3aa9('0x32')]=_['intersection'](_0x1adba8['model'],_0x1adba8[_0x3aa9('0x30')]);_0x5ce2ce[_0x3aa9('0x33')]=_[_0x3aa9('0x34')](_0x1adba8[_0x3aa9('0x2f')],qs[_0x3aa9('0x35')](_0x436c5b[_0x3aa9('0x30')][_0x3aa9('0x35')]));_0x5ce2ce[_0x3aa9('0x33')]=_0x5ce2ce[_0x3aa9('0x33')][_0x3aa9('0x36')]?_0x5ce2ce[_0x3aa9('0x33')]:_0x1adba8[_0x3aa9('0x2f')];if(!_0x436c5b[_0x3aa9('0x30')][_0x3aa9('0x37')](_0x3aa9('0x38'))){_0x5ce2ce[_0x3aa9('0x1a')]=qs[_0x3aa9('0x1a')](_0x436c5b[_0x3aa9('0x30')][_0x3aa9('0x1a')]);_0x5ce2ce[_0x3aa9('0x19')]=qs[_0x3aa9('0x19')](_0x436c5b[_0x3aa9('0x30')][_0x3aa9('0x19')]);}_0x5ce2ce['order']=qs[_0x3aa9('0x39')](_0x436c5b[_0x3aa9('0x30')][_0x3aa9('0x39')]);_0x5ce2ce[_0x3aa9('0x3a')]=qs['filters'](_[_0x3aa9('0x3b')](_0x436c5b[_0x3aa9('0x30')],_0x1adba8[_0x3aa9('0x32')]),_0x3289d6);if(_0x436c5b[_0x3aa9('0x30')]['filter']){_0x5ce2ce[_0x3aa9('0x3a')]=_['merge'](_0x5ce2ce[_0x3aa9('0x3a')],{'$or':_[_0x3aa9('0x2a')](_0x3289d6,function(_0x422ac3){if(_0x422ac3[_0x3aa9('0x2d')]!==_0x3aa9('0x3c')){var _0x1b73ea={};_0x1b73ea[_0x422ac3[_0x3aa9('0x29')]]={'$like':'%'+_0x436c5b['query']['filter']+'%'};return _0x1b73ea;}})});}_0x5ce2ce=_[_0x3aa9('0x3d')]({},_0x5ce2ce,_0x436c5b['options']);var _0x73ee8a={'where':_0x5ce2ce[_0x3aa9('0x3a')]};return db[_0x3aa9('0x3e')][_0x3aa9('0x18')](_0x73ee8a)['then'](function(_0x3b24df){_0x451057[_0x3aa9('0x18')]=_0x3b24df;if(_0x436c5b['query']['includeAll']){_0x5ce2ce[_0x3aa9('0x3f')]=[{'all':!![]}];}return db[_0x3aa9('0x3e')][_0x3aa9('0x40')](_0x5ce2ce);})[_0x3aa9('0x21')](function(_0x3495e0){_0x451057['rows']=_0x3495e0;return _0x451057;})[_0x3aa9('0x21')](respondWithFilteredResult(_0x3ce554,_0x5ce2ce))[_0x3aa9('0x41')](handleError(_0x3ce554,null));};exports[_0x3aa9('0x42')]=function(_0x1aaa66,_0x224f5a){var _0x5e0005={'raw':!![],'where':{'id':_0x1aaa66[_0x3aa9('0x43')]['id']}},_0x2053f7={};_0x2053f7[_0x3aa9('0x2f')]=_[_0x3aa9('0x31')](db[_0x3aa9('0x3e')]['rawAttributes']);_0x2053f7[_0x3aa9('0x30')]=_[_0x3aa9('0x31')](_0x1aaa66[_0x3aa9('0x30')]);_0x2053f7[_0x3aa9('0x32')]=_[_0x3aa9('0x34')](_0x2053f7[_0x3aa9('0x2f')],_0x2053f7[_0x3aa9('0x30')]);_0x5e0005['attributes']=_[_0x3aa9('0x34')](_0x2053f7['model'],qs[_0x3aa9('0x35')](_0x1aaa66['query'][_0x3aa9('0x35')]));_0x5e0005['attributes']=_0x5e0005[_0x3aa9('0x33')][_0x3aa9('0x36')]?_0x5e0005[_0x3aa9('0x33')]:_0x2053f7[_0x3aa9('0x2f')];if(_0x1aaa66[_0x3aa9('0x30')][_0x3aa9('0x44')]){_0x5e0005[_0x3aa9('0x3f')]=[{'all':!![]}];}_0x5e0005=_['merge']({},_0x5e0005,_0x1aaa66[_0x3aa9('0x45')]);return db[_0x3aa9('0x3e')][_0x3aa9('0x46')](_0x5e0005)['then'](handleEntityNotFound(_0x224f5a,null))[_0x3aa9('0x21')](respondWithResult(_0x224f5a,null))['catch'](handleError(_0x224f5a,null));};exports[_0x3aa9('0x47')]=function(_0x570c60,_0x52b13e){return db['Tag']['create'](_0x570c60['body'],{})[_0x3aa9('0x21')](function(_0x31f241){var _0x4c406e=_0x570c60[_0x3aa9('0x48')]['get']({'plain':!![]});if(!_0x4c406e)throw new Error(_0x3aa9('0x49'));if(_0x4c406e[_0x3aa9('0x4a')]===_0x3aa9('0x48')){var _0x3edb34=_0x31f241[_0x3aa9('0x23')]({'plain':!![]});var _0x237792=_0x3aa9('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x237792,'userProfileId':_0x4c406e[_0x3aa9('0x4b')]},'raw':!![]})[_0x3aa9('0x21')](function(_0x21508a){if(_0x21508a&&_0x21508a[_0x3aa9('0x4c')]===0x0){return db['UserProfileResource'][_0x3aa9('0x47')]({'name':_0x3edb34[_0x3aa9('0x29')],'resourceId':_0x3edb34['id'],'type':_0x21508a[_0x3aa9('0x29')],'sectionId':_0x21508a['id']},{})['then'](function(){return _0x31f241;});}else{return _0x31f241;}})[_0x3aa9('0x41')](function(_0x154296){logger[_0x3aa9('0x28')](_0x3aa9('0x4d'),_0x154296);throw _0x154296;});}return _0x31f241;})['then'](respondWithResult(_0x52b13e,0xc9))[_0x3aa9('0x41')](handleError(_0x52b13e,null));};exports[_0x3aa9('0x20')]=function(_0x5c6e57,_0xc2916f){if(_0x5c6e57[_0x3aa9('0x4e')]['id']){delete _0x5c6e57[_0x3aa9('0x4e')]['id'];}return db['Tag'][_0x3aa9('0x46')]({'where':{'id':_0x5c6e57[_0x3aa9('0x43')]['id']}})[_0x3aa9('0x21')](handleEntityNotFound(_0xc2916f,null))[_0x3aa9('0x21')](saveUpdates(_0x5c6e57[_0x3aa9('0x4e')],null))['then'](respondWithResult(_0xc2916f,null))['catch'](handleError(_0xc2916f,null));};exports['destroy']=function(_0x4d41a8,_0xbaef90){return db[_0x3aa9('0x3e')][_0x3aa9('0x46')]({'where':{'id':_0x4d41a8[_0x3aa9('0x43')]['id']}})['then'](handleEntityNotFound(_0xbaef90,null))[_0x3aa9('0x21')](removeEntity(_0xbaef90,null))[_0x3aa9('0x41')](handleError(_0xbaef90,null));}; \ No newline at end of file +var _0x7271=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','apply','save','update','then','get','Tags','UserProfileResource','error','stack','send','index','map','Tag','rawAttributes','key','model','name','query','filters','intersection','attributes','length','nolimit','order','sort','pick','merge','where','filter','includeAll','rows','catch','show','keys','fields','include'];(function(_0x233a4c,_0x3ef6e1){var _0x51d977=function(_0x5f27f7){while(--_0x5f27f7){_0x233a4c['push'](_0x233a4c['shift']());}};_0x51d977(++_0x3ef6e1);}(_0x7271,0xa0));var _0x1727=function(_0x17fef0,_0x34f05b){_0x17fef0=_0x17fef0-0x0;var _0x545923=_0x7271[_0x17fef0];return _0x545923;};'use strict';var pdf=require(_0x1727('0x0'));var emlformat=require(_0x1727('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1727('0x2'));var moment=require(_0x1727('0x3'));var BPromise=require(_0x1727('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1727('0x5'));var sox=require(_0x1727('0x6'));var csv=require(_0x1727('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1727('0x8'));var squel=require(_0x1727('0x9'));var crypto=require(_0x1727('0xa'));var jsforce=require(_0x1727('0xb'));var deskjs=require(_0x1727('0xc'));var toCsv=require(_0x1727('0x7'));var querystring=require(_0x1727('0xd'));var Papa=require(_0x1727('0xe'));var Redis=require(_0x1727('0xf'));var authService=require(_0x1727('0x10'));var qs=require(_0x1727('0x11'));var as=require(_0x1727('0x12'));var hardwareService=require(_0x1727('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1727('0x14'));var config=require(_0x1727('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4549f1,_0x266c13){_0x266c13=_0x266c13||0xcc;return function(_0x277132){if(_0x277132){return _0x4549f1[_0x1727('0x16')](_0x266c13);}return _0x4549f1[_0x1727('0x17')](_0x266c13)[_0x1727('0x18')]();};}function respondWithResult(_0x4d0ad8,_0x4c5b32){_0x4c5b32=_0x4c5b32||0xc8;return function(_0x426a9e){if(_0x426a9e){return _0x4d0ad8[_0x1727('0x17')](_0x4c5b32)['json'](_0x426a9e);}};}function respondWithFilteredResult(_0x3793a4,_0x58fc8b){return function(_0x1a9d7a){if(_0x1a9d7a){var _0x32ee18=_0x1a9d7a[_0x1727('0x19')],_0x1162e2=_0x58fc8b[_0x1727('0x1a')],_0x436d1e=_0x58fc8b[_0x1727('0x1a')]+_0x58fc8b[_0x1727('0x1b')],_0x4a6512;if(_0x436d1e>=_0x32ee18){_0x436d1e=_0x32ee18;_0x4a6512=0xc8;}else{_0x4a6512=0xce;}_0x3793a4[_0x1727('0x17')](_0x4a6512);return _0x3793a4['set'](_0x1727('0x1c'),_0x1162e2+'-'+_0x436d1e+'/'+_0x32ee18)['json'](_0x1a9d7a);}return null;};}function patchUpdates(_0x1abe2b){return function(_0x4ff74b){try{jsonpatch[_0x1727('0x1d')](_0x4ff74b,_0x1abe2b,!![]);}catch(_0x4b664f){return BPromise['reject'](_0x4b664f);}return _0x4ff74b[_0x1727('0x1e')]();};}function saveUpdates(_0x250f4d,_0x5c9e14){return function(_0x3529b2){if(_0x3529b2){return _0x3529b2[_0x1727('0x1f')](_0x250f4d)[_0x1727('0x20')](function(_0x21c98f){return _0x21c98f;});}return null;};}function removeEntity(_0xdd17a2,_0x1af958){return function(_0x2d2dfc){if(_0x2d2dfc){return _0x2d2dfc['destroy']()[_0x1727('0x20')](function(){var _0x39240c=_0x2d2dfc[_0x1727('0x21')]({'plain':!![]});var _0x3e8313=_0x1727('0x22');return db[_0x1727('0x23')]['destroy']({'where':{'type':_0x3e8313,'resourceId':_0x39240c['id']}})[_0x1727('0x20')](function(){return _0x2d2dfc;});})[_0x1727('0x20')](function(){_0xdd17a2[_0x1727('0x17')](0xcc)[_0x1727('0x18')]();});}};}function handleEntityNotFound(_0x3076e5,_0x176c95){return function(_0x59e45b){if(!_0x59e45b){_0x3076e5[_0x1727('0x16')](0x194);}return _0x59e45b;};}function handleError(_0x358efb,_0x3af427){_0x3af427=_0x3af427||0x1f4;return function(_0x4b718d){logger[_0x1727('0x24')](_0x4b718d[_0x1727('0x25')]);if(_0x4b718d['name']){delete _0x4b718d['name'];}_0x358efb[_0x1727('0x17')](_0x3af427)[_0x1727('0x26')](_0x4b718d);};}exports[_0x1727('0x27')]=function(_0x4dace8,_0x56a6c8){var _0x1e5deb={},_0x176bf1={},_0x1e020a={'count':0x0,'rows':[]};var _0x249acd=_[_0x1727('0x28')](db[_0x1727('0x29')][_0x1727('0x2a')],function(_0x2d9d73){return{'name':_0x2d9d73['fieldName'],'type':_0x2d9d73['type'][_0x1727('0x2b')]};});_0x176bf1[_0x1727('0x2c')]=_[_0x1727('0x28')](_0x249acd,_0x1727('0x2d'));_0x176bf1[_0x1727('0x2e')]=_['keys'](_0x4dace8['query']);_0x176bf1[_0x1727('0x2f')]=_[_0x1727('0x30')](_0x176bf1[_0x1727('0x2c')],_0x176bf1[_0x1727('0x2e')]);_0x1e5deb[_0x1727('0x31')]=_[_0x1727('0x30')](_0x176bf1[_0x1727('0x2c')],qs['fields'](_0x4dace8[_0x1727('0x2e')]['fields']));_0x1e5deb[_0x1727('0x31')]=_0x1e5deb[_0x1727('0x31')][_0x1727('0x32')]?_0x1e5deb[_0x1727('0x31')]:_0x176bf1[_0x1727('0x2c')];if(!_0x4dace8['query']['hasOwnProperty'](_0x1727('0x33'))){_0x1e5deb[_0x1727('0x1b')]=qs[_0x1727('0x1b')](_0x4dace8[_0x1727('0x2e')][_0x1727('0x1b')]);_0x1e5deb[_0x1727('0x1a')]=qs[_0x1727('0x1a')](_0x4dace8[_0x1727('0x2e')]['offset']);}_0x1e5deb[_0x1727('0x34')]=qs[_0x1727('0x35')](_0x4dace8[_0x1727('0x2e')]['sort']);_0x1e5deb['where']=qs[_0x1727('0x2f')](_[_0x1727('0x36')](_0x4dace8[_0x1727('0x2e')],_0x176bf1[_0x1727('0x2f')]),_0x249acd);if(_0x4dace8[_0x1727('0x2e')]['filter']){_0x1e5deb['where']=_[_0x1727('0x37')](_0x1e5deb[_0x1727('0x38')],{'$or':_['map'](_0x249acd,function(_0x113abd){if(_0x113abd['type']!=='VIRTUAL'){var _0x1b1a88={};_0x1b1a88[_0x113abd['name']]={'$like':'%'+_0x4dace8[_0x1727('0x2e')][_0x1727('0x39')]+'%'};return _0x1b1a88;}})});}_0x1e5deb=_[_0x1727('0x37')]({},_0x1e5deb,_0x4dace8['options']);var _0x3542af={'where':_0x1e5deb[_0x1727('0x38')]};return db[_0x1727('0x29')][_0x1727('0x19')](_0x3542af)[_0x1727('0x20')](function(_0x2a8277){_0x1e020a[_0x1727('0x19')]=_0x2a8277;if(_0x4dace8[_0x1727('0x2e')][_0x1727('0x3a')]){_0x1e5deb['include']=[{'all':!![]}];}return db[_0x1727('0x29')]['findAll'](_0x1e5deb);})[_0x1727('0x20')](function(_0x4590ac){_0x1e020a[_0x1727('0x3b')]=_0x4590ac;return _0x1e020a;})[_0x1727('0x20')](respondWithFilteredResult(_0x56a6c8,_0x1e5deb))[_0x1727('0x3c')](handleError(_0x56a6c8,null));};exports[_0x1727('0x3d')]=function(_0x24e2d5,_0x2eb22a){var _0x4c09fb={'raw':!![],'where':{'id':_0x24e2d5['params']['id']}},_0x3a91a5={};_0x3a91a5[_0x1727('0x2c')]=_[_0x1727('0x3e')](db[_0x1727('0x29')][_0x1727('0x2a')]);_0x3a91a5[_0x1727('0x2e')]=_['keys'](_0x24e2d5[_0x1727('0x2e')]);_0x3a91a5[_0x1727('0x2f')]=_['intersection'](_0x3a91a5[_0x1727('0x2c')],_0x3a91a5['query']);_0x4c09fb[_0x1727('0x31')]=_[_0x1727('0x30')](_0x3a91a5['model'],qs[_0x1727('0x3f')](_0x24e2d5[_0x1727('0x2e')][_0x1727('0x3f')]));_0x4c09fb[_0x1727('0x31')]=_0x4c09fb[_0x1727('0x31')][_0x1727('0x32')]?_0x4c09fb[_0x1727('0x31')]:_0x3a91a5['model'];if(_0x24e2d5[_0x1727('0x2e')]['includeAll']){_0x4c09fb[_0x1727('0x40')]=[{'all':!![]}];}_0x4c09fb=_['merge']({},_0x4c09fb,_0x24e2d5['options']);return db['Tag']['find'](_0x4c09fb)[_0x1727('0x20')](handleEntityNotFound(_0x2eb22a,null))[_0x1727('0x20')](respondWithResult(_0x2eb22a,null))[_0x1727('0x3c')](handleError(_0x2eb22a,null));};exports[_0x1727('0x41')]=function(_0x2a1206,_0x19c659){return db[_0x1727('0x29')]['create'](_0x2a1206[_0x1727('0x42')],{})[_0x1727('0x20')](function(_0x30df08){var _0x1437c8=_0x2a1206[_0x1727('0x43')]['get']({'plain':!![]});if(!_0x1437c8)throw new Error(_0x1727('0x44'));if(_0x1437c8['role']==='user'){var _0x480ae8=_0x30df08[_0x1727('0x21')]({'plain':!![]});var _0x17086b=_0x1727('0x22');return db[_0x1727('0x45')][_0x1727('0x46')]({'where':{'name':_0x17086b,'userProfileId':_0x1437c8[_0x1727('0x47')]},'raw':!![]})[_0x1727('0x20')](function(_0x490dcd){if(_0x490dcd&&_0x490dcd[_0x1727('0x48')]===0x0){return db[_0x1727('0x23')][_0x1727('0x41')]({'name':_0x480ae8[_0x1727('0x2d')],'resourceId':_0x480ae8['id'],'type':_0x490dcd['name'],'sectionId':_0x490dcd['id']},{})[_0x1727('0x20')](function(){return _0x30df08;});}else{return _0x30df08;}})['catch'](function(_0x146c9d){logger[_0x1727('0x24')](_0x1727('0x49'),_0x146c9d);throw _0x146c9d;});}return _0x30df08;})[_0x1727('0x20')](respondWithResult(_0x19c659,0xc9))['catch'](handleError(_0x19c659,null));};exports[_0x1727('0x1f')]=function(_0x298dde,_0x128ade){if(_0x298dde[_0x1727('0x42')]['id']){delete _0x298dde[_0x1727('0x42')]['id'];}return db['Tag']['find']({'where':{'id':_0x298dde['params']['id']}})['then'](handleEntityNotFound(_0x128ade,null))[_0x1727('0x20')](saveUpdates(_0x298dde[_0x1727('0x42')],null))[_0x1727('0x20')](respondWithResult(_0x128ade,null))['catch'](handleError(_0x128ade,null));};exports['destroy']=function(_0x17ca05,_0xc3408d){return db[_0x1727('0x29')][_0x1727('0x46')]({'where':{'id':_0x17ca05[_0x1727('0x4a')]['id']}})[_0x1727('0x20')](handleEntityNotFound(_0xc3408d,null))[_0x1727('0x20')](removeEntity(_0xc3408d,null))[_0x1727('0x3c')](handleError(_0xc3408d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7c05bd8..b634c9d 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 _0x1068=['rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','moment','request-promise','path'];(function(_0x14e89f,_0x5f4b37){var _0x167836=function(_0x24846d){while(--_0x24846d){_0x14e89f['push'](_0x14e89f['shift']());}};_0x167836(++_0x5f4b37);}(_0x1068,0x1ea));var _0x8106=function(_0x4600ab,_0x5e7944){_0x4600ab=_0x4600ab-0x0;var _0x434be5=_0x1068[_0x4600ab];return _0x434be5;};'use strict';var _=require(_0x8106('0x0'));var util=require(_0x8106('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8106('0x2'));var BPromise=require('bluebird');var rp=require(_0x8106('0x3'));var fs=require('fs');var path=require(_0x8106('0x4'));var rimraf=require(_0x8106('0x5'));var config=require(_0x8106('0x6'));var attributes=require(_0x8106('0x7'));module['exports']=function(_0x1fa1ea,_0x448b8e){return _0x1fa1ea[_0x8106('0x8')](_0x8106('0x9'),attributes,{'tableName':_0x8106('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd08f=['../../config/environment','exports','define','Tag','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4594bd,_0x9d6e7d){var _0x2e0863=function(_0x276e23){while(--_0x276e23){_0x4594bd['push'](_0x4594bd['shift']());}};_0x2e0863(++_0x9d6e7d);}(_0xd08f,0xd6));var _0xfd08=function(_0x154a27,_0x8fee08){_0x154a27=_0x154a27-0x0;var _0x201b9c=_0xd08f[_0x154a27];return _0x201b9c;};'use strict';var _=require(_0xfd08('0x0'));var util=require(_0xfd08('0x1'));var logger=require(_0xfd08('0x2'))(_0xfd08('0x3'));var moment=require('moment');var BPromise=require(_0xfd08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd08('0x5'));var rimraf=require('rimraf');var config=require(_0xfd08('0x6'));var attributes=require('./tag.attributes');module[_0xfd08('0x7')]=function(_0x4f51f4,_0x4397a8){return _0x4f51f4[_0xfd08('0x8')](_0xfd08('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 0b56610..4560e37 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 _0x70e0=['code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a6262,_0x4dcb7e){var _0x54ad7b=function(_0xd56db1){while(--_0xd56db1){_0x1a6262['push'](_0x1a6262['shift']());}};_0x54ad7b(++_0x4dcb7e);}(_0x70e0,0x17b));var _0x070e=function(_0x48adf9,_0x145a2b){_0x48adf9=_0x48adf9-0x0;var _0xb2bce5=_0x70e0[_0x48adf9];return _0xb2bce5;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Tag,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Tag,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x4e498b,_0x422814){var _0x44b108=function(_0x32352e){while(--_0x32352e){_0x4e498b['push'](_0x4e498b['shift']());}};_0x44b108(++_0x422814);}(_0x2dae,0xc3));var _0xe2da=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x2dae[_0x687ddc];return _0x441991;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('Tag,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f22f696..dfbf2d9 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 _0xe8b7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','/:id','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','addAgents','put','update','delete','removeAgents','exports','util','path','express','Router'];(function(_0x525e3c,_0x3d17c7){var _0x310a85=function(_0x3bdeda){while(--_0x3bdeda){_0x525e3c['push'](_0x525e3c['shift']());}};_0x310a85(++_0x3d17c7);}(_0xe8b7,0x16c));var _0x7e8b=function(_0x1459ee,_0x1d50d9){_0x1459ee=_0x1459ee-0x0;var _0x4db75e=_0xe8b7[_0x1459ee];return _0x4db75e;};'use strict';var multer=require('multer');var util=require(_0x7e8b('0x0'));var path=require(_0x7e8b('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e8b('0x2'));var router=express[_0x7e8b('0x3')]();var auth=require(_0x7e8b('0x4'));var interaction=require(_0x7e8b('0x5'));var config=require(_0x7e8b('0x6'));var controller=require(_0x7e8b('0x7'));router[_0x7e8b('0x8')]('/',auth[_0x7e8b('0x9')](),controller['index']);router[_0x7e8b('0x8')](_0x7e8b('0xa'),auth[_0x7e8b('0x9')](),controller['show']);router[_0x7e8b('0x8')](_0x7e8b('0xb'),auth['isAuthenticated'](),controller[_0x7e8b('0xc')]);router[_0x7e8b('0x8')](_0x7e8b('0xd'),auth[_0x7e8b('0x9')](),controller[_0x7e8b('0xe')]);router[_0x7e8b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e8b('0xf')](_0x7e8b('0xb'),auth['isAuthenticated'](),controller[_0x7e8b('0x10')]);router[_0x7e8b('0xf')](_0x7e8b('0xd'),auth['isAuthenticated'](),controller[_0x7e8b('0x11')]);router[_0x7e8b('0x12')](_0x7e8b('0xa'),auth[_0x7e8b('0x9')](),controller[_0x7e8b('0x13')]);router[_0x7e8b('0x14')](_0x7e8b('0xa'),auth[_0x7e8b('0x9')](),controller['destroy']);router[_0x7e8b('0x14')](_0x7e8b('0xb'),auth[_0x7e8b('0x9')](),controller['removeQueues']);router[_0x7e8b('0x14')](_0x7e8b('0xd'),auth[_0x7e8b('0x9')](),controller[_0x7e8b('0x15')]);module[_0x7e8b('0x16')]=router; \ No newline at end of file +var _0x7ed8=['addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','index','get','/:id','show','isAuthenticated','getQueues','/:id/users','getAgents','create','post','/:id/queues'];(function(_0x4c50d8,_0x2e4dc2){var _0x388f77=function(_0x506d3d){while(--_0x506d3d){_0x4c50d8['push'](_0x4c50d8['shift']());}};_0x388f77(++_0x2e4dc2);}(_0x7ed8,0x183));var _0x87ed=function(_0x4e0e0a,_0x5d817e){_0x4e0e0a=_0x4e0e0a-0x0;var _0x184461=_0x7ed8[_0x4e0e0a];return _0x184461;};'use strict';var multer=require(_0x87ed('0x0'));var util=require(_0x87ed('0x1'));var path=require(_0x87ed('0x2'));var timeout=require(_0x87ed('0x3'));var express=require(_0x87ed('0x4'));var router=express['Router']();var auth=require(_0x87ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x87ed('0x6'));var controller=require('./team.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x87ed('0x7')]);router[_0x87ed('0x8')](_0x87ed('0x9'),auth['isAuthenticated'](),controller[_0x87ed('0xa')]);router[_0x87ed('0x8')]('/:id/queues',auth[_0x87ed('0xb')](),controller[_0x87ed('0xc')]);router[_0x87ed('0x8')](_0x87ed('0xd'),auth[_0x87ed('0xb')](),controller[_0x87ed('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x87ed('0xf')]);router[_0x87ed('0x10')](_0x87ed('0x11'),auth[_0x87ed('0xb')](),controller[_0x87ed('0x12')]);router[_0x87ed('0x10')](_0x87ed('0xd'),auth['isAuthenticated'](),controller[_0x87ed('0x13')]);router[_0x87ed('0x14')]('/:id',auth[_0x87ed('0xb')](),controller[_0x87ed('0x15')]);router[_0x87ed('0x16')](_0x87ed('0x9'),auth[_0x87ed('0xb')](),controller[_0x87ed('0x17')]);router[_0x87ed('0x16')](_0x87ed('0x11'),auth[_0x87ed('0xb')](),controller[_0x87ed('0x18')]);router[_0x87ed('0x16')](_0x87ed('0xd'),auth['isAuthenticated'](),controller[_0x87ed('0x19')]);module[_0x87ed('0x1a')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 40ddee7..e4f5149 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 _0x443b=['sequelize','STRING','name'];(function(_0x42dcbc,_0x308015){var _0x1d8569=function(_0xc4eb10){while(--_0xc4eb10){_0x42dcbc['push'](_0x42dcbc['shift']());}};_0x1d8569(++_0x308015);}(_0x443b,0x1bf));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb443('0x0'));module['exports']={'name':{'type':Sequelize[_0xb443('0x1')],'allowNull':![],'unique':_0xb443('0x2')},'description':{'type':Sequelize[_0xb443('0x1')]}}; \ No newline at end of file +var _0xb7e7=['name','STRING','sequelize'];(function(_0x71185f,_0x371d74){var _0x160ffe=function(_0x57feba){while(--_0x57feba){_0x71185f['push'](_0x71185f['shift']());}};_0x160ffe(++_0x371d74);}(_0xb7e7,0x137));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7b7e('0x1')},'description':{'type':Sequelize[_0x7b7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ef6a03a..84a1ccf 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 _0x0c54=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','Queue','length','pick','toLowerCase','Queues','Sequelize','ValidationError','capitalize','ids','addAgents','Sms','Fax','Whatsapp','each','Voice','User','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','mail','fax','openchannel','isArray','userTeam:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','get','Teams','UserProfileResource','sendStatus','error','stack','name','index','map','Team','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x0c54,0xb0));var _0x40c5=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x0c54[_0x425716];return _0x2d39af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x40c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40c5('0x1'));var jsonpatch=require(_0x40c5('0x2'));var rp=require(_0x40c5('0x3'));var moment=require(_0x40c5('0x4'));var BPromise=require(_0x40c5('0x5'));var Mustache=require(_0x40c5('0x6'));var util=require('util');var path=require(_0x40c5('0x7'));var sox=require(_0x40c5('0x8'));var csv=require(_0x40c5('0x9'));var ejs=require(_0x40c5('0xa'));var fs=require('fs');var _=require(_0x40c5('0xb'));var squel=require(_0x40c5('0xc'));var crypto=require(_0x40c5('0xd'));var jsforce=require(_0x40c5('0xe'));var deskjs=require(_0x40c5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x40c5('0x10'));var Redis=require('ioredis');var authService=require(_0x40c5('0x11'));var qs=require(_0x40c5('0x12'));var as=require(_0x40c5('0x13'));var hardwareService=require(_0x40c5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x40c5('0x15'));var config=require(_0x40c5('0x16'));var db=require(_0x40c5('0x17'))['db'];config[_0x40c5('0x18')]=_[_0x40c5('0x19')](config[_0x40c5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x40c5('0x1a'))(new Redis(config[_0x40c5('0x18')]));require('./team.socket')[_0x40c5('0x1b')](socket);function respondWithStatusCode(_0x39f9fd,_0x7e4f12){_0x7e4f12=_0x7e4f12||0xcc;return function(_0x20fab0){if(_0x20fab0){return _0x39f9fd['sendStatus'](_0x7e4f12);}return _0x39f9fd['status'](_0x7e4f12)[_0x40c5('0x1c')]();};}function respondWithResult(_0x28096b,_0x5a73bf){_0x5a73bf=_0x5a73bf||0xc8;return function(_0x4edcbd){if(_0x4edcbd){return _0x28096b['status'](_0x5a73bf)[_0x40c5('0x1d')](_0x4edcbd);}};}function respondWithFilteredResult(_0x48e009,_0x5491d6){return function(_0x1ae4fd){if(_0x1ae4fd){var _0x242c68=_0x1ae4fd[_0x40c5('0x1e')],_0x37c13c=_0x5491d6['offset'],_0x4649c2=_0x5491d6[_0x40c5('0x1f')]+_0x5491d6[_0x40c5('0x20')],_0x1c808d;if(_0x4649c2>=_0x242c68){_0x4649c2=_0x242c68;_0x1c808d=0xc8;}else{_0x1c808d=0xce;}_0x48e009[_0x40c5('0x21')](_0x1c808d);return _0x48e009[_0x40c5('0x22')](_0x40c5('0x23'),_0x37c13c+'-'+_0x4649c2+'/'+_0x242c68)[_0x40c5('0x1d')](_0x1ae4fd);}return null;};}function patchUpdates(_0xbed34e){return function(_0x28668c){try{jsonpatch[_0x40c5('0x24')](_0x28668c,_0xbed34e,!![]);}catch(_0x12c5b6){return BPromise[_0x40c5('0x25')](_0x12c5b6);}return _0x28668c['save']();};}function saveUpdates(_0x4de9e3,_0x4ef5b6){return function(_0x53bceb){if(_0x53bceb){return _0x53bceb[_0x40c5('0x26')](_0x4de9e3)[_0x40c5('0x27')](function(_0x28e56d){return _0x28e56d;});}return null;};}function removeEntity(_0x37b221,_0x497f8b){return function(_0x30d068){if(_0x30d068){return _0x30d068['destroy']()[_0x40c5('0x27')](function(){var _0x2fe295=_0x30d068[_0x40c5('0x28')]({'plain':!![]});var _0x231e31=_0x40c5('0x29');return db[_0x40c5('0x2a')]['destroy']({'where':{'type':_0x231e31,'resourceId':_0x2fe295['id']}})[_0x40c5('0x27')](function(){return _0x30d068;});})[_0x40c5('0x27')](function(){_0x37b221[_0x40c5('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d277,_0x3fa3ae){return function(_0x5d294a){if(!_0x5d294a){_0x57d277[_0x40c5('0x2b')](0x194);}return _0x5d294a;};}function handleError(_0xfed372,_0x4e8a1e){_0x4e8a1e=_0x4e8a1e||0x1f4;return function(_0x25dcbe){logger[_0x40c5('0x2c')](_0x25dcbe[_0x40c5('0x2d')]);if(_0x25dcbe[_0x40c5('0x2e')]){delete _0x25dcbe[_0x40c5('0x2e')];}_0xfed372['status'](_0x4e8a1e)['send'](_0x25dcbe);};}exports[_0x40c5('0x2f')]=function(_0x5c8f3e,_0x450246){var _0x102575={},_0x494e79={},_0xb34d9c={'count':0x0,'rows':[]};var _0x4b5011=_[_0x40c5('0x30')](db[_0x40c5('0x31')]['rawAttributes'],function(_0x264836){return{'name':_0x264836[_0x40c5('0x32')],'type':_0x264836[_0x40c5('0x33')]['key']};});_0x494e79['model']=_[_0x40c5('0x30')](_0x4b5011,'name');_0x494e79[_0x40c5('0x34')]=_[_0x40c5('0x35')](_0x5c8f3e['query']);_0x494e79[_0x40c5('0x36')]=_['intersection'](_0x494e79[_0x40c5('0x37')],_0x494e79[_0x40c5('0x34')]);_0x102575[_0x40c5('0x38')]=_[_0x40c5('0x39')](_0x494e79[_0x40c5('0x37')],qs[_0x40c5('0x3a')](_0x5c8f3e[_0x40c5('0x34')]['fields']));_0x102575['attributes']=_0x102575[_0x40c5('0x38')]['length']?_0x102575['attributes']:_0x494e79[_0x40c5('0x37')];if(!_0x5c8f3e['query'][_0x40c5('0x3b')](_0x40c5('0x3c'))){_0x102575[_0x40c5('0x20')]=qs[_0x40c5('0x20')](_0x5c8f3e[_0x40c5('0x34')][_0x40c5('0x20')]);_0x102575[_0x40c5('0x1f')]=qs[_0x40c5('0x1f')](_0x5c8f3e[_0x40c5('0x34')][_0x40c5('0x1f')]);}_0x102575[_0x40c5('0x3d')]=qs[_0x40c5('0x3e')](_0x5c8f3e[_0x40c5('0x34')]['sort']);_0x102575[_0x40c5('0x3f')]=qs[_0x40c5('0x36')](_['pick'](_0x5c8f3e[_0x40c5('0x34')],_0x494e79['filters']),_0x4b5011);if(_0x5c8f3e['query'][_0x40c5('0x40')]){_0x102575['where']=_[_0x40c5('0x41')](_0x102575['where'],{'$or':_[_0x40c5('0x30')](_0x4b5011,function(_0x2e012e){if(_0x2e012e['type']!==_0x40c5('0x42')){var _0x16a701={};_0x16a701[_0x2e012e[_0x40c5('0x2e')]]={'$like':'%'+_0x5c8f3e['query'][_0x40c5('0x40')]+'%'};return _0x16a701;}})});}_0x102575=_['merge']({},_0x102575,_0x5c8f3e[_0x40c5('0x43')]);var _0x37f90c={'where':_0x102575['where']};return db[_0x40c5('0x31')][_0x40c5('0x1e')](_0x37f90c)['then'](function(_0x304a4a){_0xb34d9c[_0x40c5('0x1e')]=_0x304a4a;if(_0x5c8f3e[_0x40c5('0x34')]['includeAll']){_0x102575['include']=[{'all':!![]}];}return db[_0x40c5('0x31')][_0x40c5('0x44')](_0x102575);})[_0x40c5('0x27')](function(_0x4bb63d){_0xb34d9c[_0x40c5('0x45')]=_0x4bb63d;return _0xb34d9c;})[_0x40c5('0x27')](respondWithFilteredResult(_0x450246,_0x102575))[_0x40c5('0x46')](handleError(_0x450246,null));};exports[_0x40c5('0x47')]=function(_0xd03d93,_0x4e814b){var _0x22a3b9={'raw':![],'where':{'id':_0xd03d93[_0x40c5('0x48')]['id']}},_0x34f550={};_0x34f550[_0x40c5('0x37')]=_[_0x40c5('0x35')](db['Team'][_0x40c5('0x49')]);_0x34f550['query']=_[_0x40c5('0x35')](_0xd03d93['query']);_0x34f550[_0x40c5('0x36')]=_[_0x40c5('0x39')](_0x34f550['model'],_0x34f550[_0x40c5('0x34')]);_0x22a3b9[_0x40c5('0x38')]=_[_0x40c5('0x39')](_0x34f550[_0x40c5('0x37')],qs['fields'](_0xd03d93[_0x40c5('0x34')][_0x40c5('0x3a')]));_0x22a3b9[_0x40c5('0x38')]=_0x22a3b9[_0x40c5('0x38')]['length']?_0x22a3b9[_0x40c5('0x38')]:_0x34f550[_0x40c5('0x37')];if(_0xd03d93[_0x40c5('0x34')][_0x40c5('0x4a')]){_0x22a3b9[_0x40c5('0x4b')]=[{'all':!![]}];}_0x22a3b9=_[_0x40c5('0x41')]({},_0x22a3b9,_0xd03d93['options']);return db[_0x40c5('0x31')][_0x40c5('0x4c')](_0x22a3b9)['then'](handleEntityNotFound(_0x4e814b,null))[_0x40c5('0x27')](respondWithResult(_0x4e814b,null))[_0x40c5('0x46')](handleError(_0x4e814b,null));};exports['create']=function(_0x3c3cca,_0xd22bd6){return db[_0x40c5('0x31')][_0x40c5('0x4d')](_0x3c3cca[_0x40c5('0x4e')],{})['then'](function(_0x2949cd){var _0x4f6e57=_0x3c3cca[_0x40c5('0x4f')][_0x40c5('0x28')]({'plain':!![]});if(!_0x4f6e57)throw new Error(_0x40c5('0x50'));if(_0x4f6e57[_0x40c5('0x51')]===_0x40c5('0x4f')){var _0x49ebae=_0x2949cd[_0x40c5('0x28')]({'plain':!![]});var _0x543ece=_0x40c5('0x29');return db[_0x40c5('0x52')]['find']({'where':{'name':_0x543ece,'userProfileId':_0x4f6e57[_0x40c5('0x53')]},'raw':!![]})[_0x40c5('0x27')](function(_0x4f4a37){if(_0x4f4a37&&_0x4f4a37[_0x40c5('0x54')]===0x0){return db[_0x40c5('0x2a')][_0x40c5('0x4d')]({'name':_0x49ebae[_0x40c5('0x2e')],'resourceId':_0x49ebae['id'],'type':_0x4f4a37[_0x40c5('0x2e')],'sectionId':_0x4f4a37['id']},{})[_0x40c5('0x27')](function(){return _0x2949cd;});}else{return _0x2949cd;}})[_0x40c5('0x46')](function(_0x2d5b3a){logger[_0x40c5('0x2c')](_0x40c5('0x55'),_0x2d5b3a);throw _0x2d5b3a;});}return _0x2949cd;})['then'](respondWithResult(_0xd22bd6,0xc9))[_0x40c5('0x46')](handleError(_0xd22bd6,null));};exports[_0x40c5('0x26')]=function(_0x14190c,_0x47667a){if(_0x14190c[_0x40c5('0x4e')]['id']){delete _0x14190c[_0x40c5('0x4e')]['id'];}return db[_0x40c5('0x31')]['find']({'where':{'id':_0x14190c[_0x40c5('0x48')]['id']}})['then'](handleEntityNotFound(_0x47667a,null))[_0x40c5('0x27')](saveUpdates(_0x14190c[_0x40c5('0x4e')],null))['then'](respondWithResult(_0x47667a,null))['catch'](handleError(_0x47667a,null));};exports[_0x40c5('0x56')]=function(_0x36e074,_0x3f4111){return db[_0x40c5('0x31')]['find']({'where':{'id':_0x36e074[_0x40c5('0x48')]['id']}})[_0x40c5('0x27')](handleEntityNotFound(_0x3f4111,null))[_0x40c5('0x27')](removeEntity(_0x3f4111,null))[_0x40c5('0x46')](handleError(_0x3f4111,null));};exports[_0x40c5('0x57')]=function(_0xe8ce6d,_0x5a1126,_0x5233ce){return db[_0x40c5('0x31')][_0x40c5('0x58')]({'where':{'id':_0xe8ce6d[_0x40c5('0x48')]['id']}})[_0x40c5('0x27')](handleEntityNotFound(_0x5a1126,null))[_0x40c5('0x27')](function(_0x150c7e){if(!_0xe8ce6d[_0x40c5('0x34')][_0x40c5('0x59')]||!utils[_0x40c5('0x5a')](_0xe8ce6d[_0x40c5('0x34')][_0x40c5('0x59')])){throw new db['Sequelize']['ValidationError'](_0x40c5('0x5b'));}var _0x3a392a={};var _0xf5eb33={};_0xf5eb33[_0x40c5('0x37')]=_[_0x40c5('0x35')](db[_['capitalize'](_0xe8ce6d[_0x40c5('0x34')][_0x40c5('0x59')]['toLowerCase']())+_0x40c5('0x5c')][_0x40c5('0x49')]);_0xf5eb33[_0x40c5('0x34')]=_[_0x40c5('0x35')](_0xe8ce6d[_0x40c5('0x34')]);_0xf5eb33[_0x40c5('0x36')]=_['intersection'](_0xf5eb33['model'],_0xf5eb33[_0x40c5('0x34')]);_0x3a392a[_0x40c5('0x38')]=_[_0x40c5('0x39')](_0xf5eb33[_0x40c5('0x37')],qs['fields'](_0xe8ce6d[_0x40c5('0x34')][_0x40c5('0x3a')]));_0x3a392a[_0x40c5('0x38')]=_0x3a392a[_0x40c5('0x38')][_0x40c5('0x5d')]?_0x3a392a[_0x40c5('0x38')]:_0xf5eb33[_0x40c5('0x37')];_0x3a392a[_0x40c5('0x20')]=qs['limit'](_0xe8ce6d[_0x40c5('0x34')][_0x40c5('0x20')]);_0x3a392a[_0x40c5('0x1f')]=qs[_0x40c5('0x1f')](_0xe8ce6d[_0x40c5('0x34')]['offset']);_0x3a392a['order']=qs[_0x40c5('0x3e')](_0xe8ce6d[_0x40c5('0x34')][_0x40c5('0x3e')]);_0x3a392a['where']=qs[_0x40c5('0x36')](_[_0x40c5('0x5e')](_0xe8ce6d['query'],_0xf5eb33['filters']));_0x3a392a=_[_0x40c5('0x41')]({},_0x3a392a,_0xe8ce6d[_0x40c5('0x43')]);return _0x150c7e['get'+_['capitalize'](_0xe8ce6d['query']['channel'][_0x40c5('0x5f')]())+_0x40c5('0x60')](_0x3a392a);})[_0x40c5('0x27')](respondWithResult(_0x5a1126,null))[_0x40c5('0x46')](handleError(_0x5a1126,null));};exports['addQueues']=function(_0x49bcb7,_0x53687e,_0x2fecee){return db[_0x40c5('0x31')][_0x40c5('0x58')]({'where':{'id':_0x49bcb7[_0x40c5('0x48')]['id']}})[_0x40c5('0x27')](function(_0x36d36a){if(_0x36d36a){if(!_0x49bcb7[_0x40c5('0x4e')][_0x40c5('0x59')]||!utils['isValidChannel'](_0x49bcb7[_0x40c5('0x4e')][_0x40c5('0x59')])){throw new db[(_0x40c5('0x61'))][(_0x40c5('0x62'))](_0x40c5('0x5b'));}return _0x36d36a['add'+_[_0x40c5('0x63')](_0x49bcb7['body'][_0x40c5('0x59')]['toLowerCase']())+_0x40c5('0x60')](_0x49bcb7['body']['ids']);}return null;})[_0x40c5('0x27')](handleEntityNotFound(_0x53687e,null))[_0x40c5('0x27')](respondWithStatusCode(_0x53687e,null))[_0x40c5('0x46')](handleError(_0x53687e,null));};exports['removeQueues']=function(_0x5964a6,_0x37e2e5,_0x30915b){return db[_0x40c5('0x31')][_0x40c5('0x58')]({'where':{'id':_0x5964a6['params']['id']}})['then'](function(_0x4ba9a0){if(_0x4ba9a0){if(!_0x5964a6[_0x40c5('0x34')][_0x40c5('0x59')]||!utils['isValidChannel'](_0x5964a6[_0x40c5('0x34')][_0x40c5('0x59')])){throw new db[(_0x40c5('0x61'))][(_0x40c5('0x62'))](_0x40c5('0x5b'));}return _0x4ba9a0['remove'+_[_0x40c5('0x63')](_0x5964a6[_0x40c5('0x34')]['channel'][_0x40c5('0x5f')]())+'Queues'](_0x5964a6[_0x40c5('0x34')][_0x40c5('0x64')]);}return null;})[_0x40c5('0x27')](handleEntityNotFound(_0x37e2e5,null))['then'](respondWithStatusCode(_0x37e2e5,null))['catch'](handleError(_0x37e2e5,null));};exports[_0x40c5('0x65')]=function(_0x37ee5e,_0x556021,_0x4aa8a3){return db[_0x40c5('0x31')]['find']({'where':{'id':_0x37ee5e[_0x40c5('0x48')]['id']}})[_0x40c5('0x27')](handleEntityNotFound(_0x556021,null))[_0x40c5('0x27')](function(_0x4981f7){if(_0x4981f7){var _0xc1ffee=['Voice','Chat','Mail',_0x40c5('0x66'),_0x40c5('0x67'),'Openchannel',_0x40c5('0x68')];return BPromise['each'](_0xc1ffee,function(_0x58650c){return _0x4981f7[_0x40c5('0x28')+_0x58650c+_0x40c5('0x60')]({'attributes':['id',_0x40c5('0x2e')]})[_0x40c5('0x27')](function(_0x24c41d){return BPromise[_0x40c5('0x69')](_0x24c41d,function(_0x1bba22){return _0x1bba22[_0x40c5('0x65')](_0x37ee5e[_0x40c5('0x4e')]['ids'])['then'](function(){if(_0x58650c===_0x40c5('0x6a')){return db[_0x40c5('0x6b')][_0x40c5('0x44')]({'where':{'id':_0x37ee5e[_0x40c5('0x4e')][_0x40c5('0x64')]},'attributes':['id','name',_0x40c5('0x6c'),_0x40c5('0x6d'),_0x40c5('0x6e')],'raw':!![]})[_0x40c5('0x27')](function(_0x329034){return BPromise[_0x40c5('0x69')](_[_0x40c5('0x40')](_0x329034,{'online':0x1}),function(_0x4a18d2){return db[_0x40c5('0x6f')][_0x40c5('0x70')]({'membername':_0x4a18d2['name'],'UserId':_0x4a18d2['id'],'queue_name':_0x1bba22[_0x40c5('0x2e')],'VoiceQueueId':_0x1bba22['id'],'interface':_['isNil'](_0x4a18d2[_0x40c5('0x6e')])?util[_0x40c5('0x71')](_0x40c5('0x72'),_0x4a18d2['name']):_0x4a18d2[_0x40c5('0x6e')],'paused':_0x4a18d2['voicePause']||![],'penalty':0x0});});});}});});})[_0x40c5('0x27')](function(){return _0x4981f7;});})[_0x40c5('0x27')](function(){return _0x4981f7;});}})['then'](function(_0x3ace2e){if(_0x3ace2e){return _0x3ace2e['addAgents'](_0x37ee5e['body'][_0x40c5('0x64')],_[_0x40c5('0x73')](_0x37ee5e[_0x40c5('0x4e')],[_0x40c5('0x64'),'id'])||{})[_0x40c5('0x74')](function(_0x37bc7a){for(var _0x337ec8=0x0;_0x337ec8<_0x37ee5e[_0x40c5('0x4e')][_0x40c5('0x64')][_0x40c5('0x5d')];_0x337ec8+=0x1){socket[_0x40c5('0x75')](_0x40c5('0x76'),{'UserId':_0x37ee5e[_0x40c5('0x4e')]['ids'][_0x337ec8],'TeamId':_0x37ee5e[_0x40c5('0x48')]['id']});}return _0x37bc7a;});}})[_0x40c5('0x27')](respondWithResult(_0x556021,null))[_0x40c5('0x46')](handleError(_0x556021,null));};exports[_0x40c5('0x77')]=function(_0x411521,_0x424e59,_0x14106c){return db[_0x40c5('0x31')][_0x40c5('0x4c')]({'where':{'id':_0x411521['params']['id']}})[_0x40c5('0x27')](handleEntityNotFound(_0x424e59,null))[_0x40c5('0x27')](function(_0x4a3e0e){if(_0x4a3e0e){return BPromise[_0x40c5('0x69')]([_0x40c5('0x78'),'chat',_0x40c5('0x79'),'sms',_0x40c5('0x7a'),_0x40c5('0x7b'),'whatsapp'],function(_0x44d9ff){return _0x4a3e0e['get'+_[_0x40c5('0x63')](_0x44d9ff)+_0x40c5('0x60')]({'attributes':['id','name']})[_0x40c5('0x27')](function(_0x264d58){return BPromise[_0x40c5('0x69')](_0x264d58,function(_0x41d047){return _0x41d047[_0x40c5('0x77')](_0x411521[_0x40c5('0x34')][_0x40c5('0x64')])['then'](function(){if(_0x44d9ff===_0x40c5('0x78')){return db[_0x40c5('0x6f')][_0x40c5('0x56')]({'where':{'VoiceQueueId':_0x41d047['id'],'UserId':_0x411521[_0x40c5('0x34')][_0x40c5('0x64')]}});}});});})[_0x40c5('0x27')](function(){return _0x4a3e0e;});})[_0x40c5('0x27')](function(){return _0x4a3e0e;});}})[_0x40c5('0x27')](function(_0x595c75){if(_0x595c75){return _0x595c75[_0x40c5('0x77')](_0x411521[_0x40c5('0x34')][_0x40c5('0x64')])['then'](function(){if(_[_0x40c5('0x7c')](_0x411521['query'][_0x40c5('0x64')])){for(var _0x2e04f6=0x0;_0x2e04f6<_0x411521[_0x40c5('0x34')]['ids'][_0x40c5('0x5d')];_0x2e04f6+=0x1){socket[_0x40c5('0x75')](_0x40c5('0x7d'),{'UserId':Number(_0x411521['query'][_0x40c5('0x64')][_0x2e04f6]),'TeamId':Number(_0x411521['params']['id'])});}}else{socket[_0x40c5('0x75')](_0x40c5('0x7d'),{'UserId':Number(_0x411521['query'][_0x40c5('0x64')]),'TeamId':Number(_0x411521['params']['id'])});}});}})['then'](respondWithStatusCode(_0x424e59,null))['catch'](handleError(_0x424e59,null));};exports['getAgents']=function(_0x1d6ac4,_0x56cc6f,_0x30f523){var _0x15de8a={};var _0x3a070b={};var _0x57333e;var _0x5ec10a;return db[_0x40c5('0x31')]['findOne']({'where':{'id':_0x1d6ac4['params']['id']}})[_0x40c5('0x27')](handleEntityNotFound(_0x56cc6f,null))[_0x40c5('0x27')](function(_0x467e5e){if(_0x467e5e){_0x57333e=_0x467e5e;_0x3a070b['model']=_[_0x40c5('0x35')](db[_0x40c5('0x6b')][_0x40c5('0x49')]);_0x3a070b[_0x40c5('0x34')]=_[_0x40c5('0x35')](_0x1d6ac4['query']);_0x3a070b[_0x40c5('0x36')]=_[_0x40c5('0x39')](_0x3a070b[_0x40c5('0x37')],_0x3a070b[_0x40c5('0x34')]);_0x15de8a[_0x40c5('0x38')]=_[_0x40c5('0x39')](_0x3a070b[_0x40c5('0x37')],qs['fields'](_0x1d6ac4[_0x40c5('0x34')][_0x40c5('0x3a')]));_0x15de8a[_0x40c5('0x38')]=_0x15de8a[_0x40c5('0x38')][_0x40c5('0x5d')]?_0x15de8a[_0x40c5('0x38')]:_0x3a070b['model'];_0x15de8a[_0x40c5('0x3d')]=qs['sort'](_0x1d6ac4[_0x40c5('0x34')][_0x40c5('0x3e')]);_0x15de8a[_0x40c5('0x3f')]=qs['filters'](_[_0x40c5('0x5e')](_0x1d6ac4['query'],_0x3a070b[_0x40c5('0x36')]));if(_0x1d6ac4[_0x40c5('0x34')]['filter']){_0x15de8a['where']=_[_0x40c5('0x41')](_0x15de8a['where'],{'$or':_['map'](_0x15de8a['attributes'],function(_0x525594){var _0x3f3d02={};_0x3f3d02[_0x525594]={'$like':'%'+_0x1d6ac4[_0x40c5('0x34')]['filter']+'%'};return _0x3f3d02;})});}_0x15de8a=_['merge']({},_0x15de8a,_0x1d6ac4[_0x40c5('0x43')]);return _0x57333e[_0x40c5('0x7e')](_0x15de8a);}})[_0x40c5('0x27')](function(_0xb93d95){if(_0xb93d95){_0x5ec10a=_0xb93d95['length'];if(!_0x1d6ac4[_0x40c5('0x34')][_0x40c5('0x3b')]('nolimit')){_0x15de8a[_0x40c5('0x20')]=qs['limit'](_0x1d6ac4[_0x40c5('0x34')][_0x40c5('0x20')]);_0x15de8a[_0x40c5('0x1f')]=qs[_0x40c5('0x1f')](_0x1d6ac4['query'][_0x40c5('0x1f')]);}return _0x57333e[_0x40c5('0x7e')](_0x15de8a);}})[_0x40c5('0x27')](function(_0x3a5318){if(_0x3a5318){return _0x3a5318?{'count':_0x5ec10a,'rows':_0x3a5318}:null;}})['then'](respondWithResult(_0x56cc6f,null))[_0x40c5('0x46')](handleError(_0x56cc6f,null));}; \ No newline at end of file +var _0xb8c8=['Queues','addQueues','ValidationError','Unknown\x20channel','add','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','filter','upsert','isNil','format','spread','emit','userTeam:save','removeAgents','voice','chat','mail','UserVoiceQueueRt','userTeam:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./team.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','options','Team','includeAll','findAll','rows','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','isValidChannel','Sequelize','capitalize','channel','Queue','rawAttributes','pick','toLowerCase'];(function(_0x50e7e5,_0x36bc84){var _0x16ae0a=function(_0x43179b){while(--_0x43179b){_0x50e7e5['push'](_0x50e7e5['shift']());}};_0x16ae0a(++_0x36bc84);}(_0xb8c8,0x11c));var _0x8b8c=function(_0x3ad639,_0x481857){_0x3ad639=_0x3ad639-0x0;var _0x45a337=_0xb8c8[_0x3ad639];return _0x45a337;};'use strict';var pdf=require(_0x8b8c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b8c('0x1'));var zipdir=require(_0x8b8c('0x2'));var jsonpatch=require(_0x8b8c('0x3'));var rp=require(_0x8b8c('0x4'));var moment=require(_0x8b8c('0x5'));var BPromise=require(_0x8b8c('0x6'));var Mustache=require(_0x8b8c('0x7'));var util=require(_0x8b8c('0x8'));var path=require(_0x8b8c('0x9'));var sox=require('sox');var csv=require(_0x8b8c('0xa'));var ejs=require(_0x8b8c('0xb'));var fs=require('fs');var _=require(_0x8b8c('0xc'));var squel=require(_0x8b8c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b8c('0xe'));var toCsv=require(_0x8b8c('0xa'));var querystring=require(_0x8b8c('0xf'));var Papa=require(_0x8b8c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8b8c('0x11'));var as=require(_0x8b8c('0x12'));var hardwareService=require(_0x8b8c('0x13'));var logger=require('../../config/logger')(_0x8b8c('0x14'));var utils=require(_0x8b8c('0x15'));var config=require(_0x8b8c('0x16'));var db=require(_0x8b8c('0x17'))['db'];config['redis']=_[_0x8b8c('0x18')](config[_0x8b8c('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b8c('0x19')]));require(_0x8b8c('0x1a'))[_0x8b8c('0x1b')](socket);function respondWithStatusCode(_0xf64320,_0x3c6d8a){_0x3c6d8a=_0x3c6d8a||0xcc;return function(_0x52f437){if(_0x52f437){return _0xf64320[_0x8b8c('0x1c')](_0x3c6d8a);}return _0xf64320[_0x8b8c('0x1d')](_0x3c6d8a)[_0x8b8c('0x1e')]();};}function respondWithResult(_0x173f72,_0x3e8739){_0x3e8739=_0x3e8739||0xc8;return function(_0x48c4da){if(_0x48c4da){return _0x173f72[_0x8b8c('0x1d')](_0x3e8739)['json'](_0x48c4da);}};}function respondWithFilteredResult(_0xccad6c,_0x423ae4){return function(_0x8f469a){if(_0x8f469a){var _0x16c41a=_0x8f469a[_0x8b8c('0x1f')],_0x3f615a=_0x423ae4[_0x8b8c('0x20')],_0x5b9f53=_0x423ae4[_0x8b8c('0x20')]+_0x423ae4[_0x8b8c('0x21')],_0x4a3e36;if(_0x5b9f53>=_0x16c41a){_0x5b9f53=_0x16c41a;_0x4a3e36=0xc8;}else{_0x4a3e36=0xce;}_0xccad6c['status'](_0x4a3e36);return _0xccad6c[_0x8b8c('0x22')](_0x8b8c('0x23'),_0x3f615a+'-'+_0x5b9f53+'/'+_0x16c41a)['json'](_0x8f469a);}return null;};}function patchUpdates(_0x3f650f){return function(_0x13f9f2){try{jsonpatch[_0x8b8c('0x24')](_0x13f9f2,_0x3f650f,!![]);}catch(_0x1a49be){return BPromise['reject'](_0x1a49be);}return _0x13f9f2['save']();};}function saveUpdates(_0x1b9177,_0x25f97e){return function(_0x58d306){if(_0x58d306){return _0x58d306[_0x8b8c('0x25')](_0x1b9177)[_0x8b8c('0x26')](function(_0x2bc68f){return _0x2bc68f;});}return null;};}function removeEntity(_0xa67127,_0x2d638a){return function(_0x58847d){if(_0x58847d){return _0x58847d[_0x8b8c('0x27')]()[_0x8b8c('0x26')](function(){var _0x463e70=_0x58847d[_0x8b8c('0x28')]({'plain':!![]});var _0x2371e3='Teams';return db[_0x8b8c('0x29')][_0x8b8c('0x27')]({'where':{'type':_0x2371e3,'resourceId':_0x463e70['id']}})[_0x8b8c('0x26')](function(){return _0x58847d;});})['then'](function(){_0xa67127['status'](0xcc)[_0x8b8c('0x1e')]();});}};}function handleEntityNotFound(_0x29fe37,_0x4d3081){return function(_0x3d8da1){if(!_0x3d8da1){_0x29fe37[_0x8b8c('0x1c')](0x194);}return _0x3d8da1;};}function handleError(_0x3697c2,_0x116d82){_0x116d82=_0x116d82||0x1f4;return function(_0x949232){logger[_0x8b8c('0x2a')](_0x949232[_0x8b8c('0x2b')]);if(_0x949232[_0x8b8c('0x2c')]){delete _0x949232['name'];}_0x3697c2[_0x8b8c('0x1d')](_0x116d82)[_0x8b8c('0x2d')](_0x949232);};}exports[_0x8b8c('0x2e')]=function(_0x276b44,_0x43e2c1){var _0xf0364a={},_0x396a98={},_0x4b042c={'count':0x0,'rows':[]};var _0x181d92=_[_0x8b8c('0x2f')](db['Team']['rawAttributes'],function(_0x126a08){return{'name':_0x126a08[_0x8b8c('0x30')],'type':_0x126a08[_0x8b8c('0x31')][_0x8b8c('0x32')]};});_0x396a98[_0x8b8c('0x33')]=_[_0x8b8c('0x2f')](_0x181d92,_0x8b8c('0x2c'));_0x396a98['query']=_[_0x8b8c('0x34')](_0x276b44[_0x8b8c('0x35')]);_0x396a98[_0x8b8c('0x36')]=_[_0x8b8c('0x37')](_0x396a98[_0x8b8c('0x33')],_0x396a98[_0x8b8c('0x35')]);_0xf0364a[_0x8b8c('0x38')]=_[_0x8b8c('0x37')](_0x396a98['model'],qs[_0x8b8c('0x39')](_0x276b44[_0x8b8c('0x35')][_0x8b8c('0x39')]));_0xf0364a['attributes']=_0xf0364a[_0x8b8c('0x38')][_0x8b8c('0x3a')]?_0xf0364a[_0x8b8c('0x38')]:_0x396a98[_0x8b8c('0x33')];if(!_0x276b44['query']['hasOwnProperty'](_0x8b8c('0x3b'))){_0xf0364a[_0x8b8c('0x21')]=qs[_0x8b8c('0x21')](_0x276b44[_0x8b8c('0x35')][_0x8b8c('0x21')]);_0xf0364a[_0x8b8c('0x20')]=qs[_0x8b8c('0x20')](_0x276b44[_0x8b8c('0x35')][_0x8b8c('0x20')]);}_0xf0364a[_0x8b8c('0x3c')]=qs[_0x8b8c('0x3d')](_0x276b44[_0x8b8c('0x35')][_0x8b8c('0x3d')]);_0xf0364a['where']=qs[_0x8b8c('0x36')](_['pick'](_0x276b44[_0x8b8c('0x35')],_0x396a98[_0x8b8c('0x36')]),_0x181d92);if(_0x276b44[_0x8b8c('0x35')]['filter']){_0xf0364a[_0x8b8c('0x3e')]=_[_0x8b8c('0x3f')](_0xf0364a['where'],{'$or':_['map'](_0x181d92,function(_0x556c16){if(_0x556c16['type']!=='VIRTUAL'){var _0x285f00={};_0x285f00[_0x556c16[_0x8b8c('0x2c')]]={'$like':'%'+_0x276b44[_0x8b8c('0x35')]['filter']+'%'};return _0x285f00;}})});}_0xf0364a=_[_0x8b8c('0x3f')]({},_0xf0364a,_0x276b44[_0x8b8c('0x40')]);var _0x24dbe9={'where':_0xf0364a[_0x8b8c('0x3e')]};return db[_0x8b8c('0x41')]['count'](_0x24dbe9)[_0x8b8c('0x26')](function(_0x339c28){_0x4b042c[_0x8b8c('0x1f')]=_0x339c28;if(_0x276b44[_0x8b8c('0x35')][_0x8b8c('0x42')]){_0xf0364a['include']=[{'all':!![]}];}return db['Team'][_0x8b8c('0x43')](_0xf0364a);})[_0x8b8c('0x26')](function(_0x5f129d){_0x4b042c[_0x8b8c('0x44')]=_0x5f129d;return _0x4b042c;})[_0x8b8c('0x26')](respondWithFilteredResult(_0x43e2c1,_0xf0364a))['catch'](handleError(_0x43e2c1,null));};exports['show']=function(_0x272ef1,_0x140469){var _0x1a45fa={'raw':![],'where':{'id':_0x272ef1[_0x8b8c('0x45')]['id']}},_0x126fe1={};_0x126fe1[_0x8b8c('0x33')]=_[_0x8b8c('0x34')](db['Team']['rawAttributes']);_0x126fe1[_0x8b8c('0x35')]=_[_0x8b8c('0x34')](_0x272ef1['query']);_0x126fe1[_0x8b8c('0x36')]=_['intersection'](_0x126fe1['model'],_0x126fe1[_0x8b8c('0x35')]);_0x1a45fa[_0x8b8c('0x38')]=_['intersection'](_0x126fe1[_0x8b8c('0x33')],qs['fields'](_0x272ef1['query'][_0x8b8c('0x39')]));_0x1a45fa['attributes']=_0x1a45fa['attributes'][_0x8b8c('0x3a')]?_0x1a45fa['attributes']:_0x126fe1[_0x8b8c('0x33')];if(_0x272ef1[_0x8b8c('0x35')][_0x8b8c('0x42')]){_0x1a45fa['include']=[{'all':!![]}];}_0x1a45fa=_['merge']({},_0x1a45fa,_0x272ef1[_0x8b8c('0x40')]);return db[_0x8b8c('0x41')]['find'](_0x1a45fa)['then'](handleEntityNotFound(_0x140469,null))[_0x8b8c('0x26')](respondWithResult(_0x140469,null))[_0x8b8c('0x46')](handleError(_0x140469,null));};exports['create']=function(_0x1476cf,_0x3f1d36){return db['Team'][_0x8b8c('0x47')](_0x1476cf['body'],{})['then'](function(_0x2fa1cd){var _0x364ebc=_0x1476cf[_0x8b8c('0x48')][_0x8b8c('0x28')]({'plain':!![]});if(!_0x364ebc)throw new Error(_0x8b8c('0x49'));if(_0x364ebc[_0x8b8c('0x4a')]===_0x8b8c('0x48')){var _0x14a4ec=_0x2fa1cd[_0x8b8c('0x28')]({'plain':!![]});var _0x1a4bae=_0x8b8c('0x4b');return db[_0x8b8c('0x4c')][_0x8b8c('0x4d')]({'where':{'name':_0x1a4bae,'userProfileId':_0x364ebc[_0x8b8c('0x4e')]},'raw':!![]})['then'](function(_0x24b0c4){if(_0x24b0c4&&_0x24b0c4['autoAssociation']===0x0){return db[_0x8b8c('0x29')][_0x8b8c('0x47')]({'name':_0x14a4ec[_0x8b8c('0x2c')],'resourceId':_0x14a4ec['id'],'type':_0x24b0c4['name'],'sectionId':_0x24b0c4['id']},{})[_0x8b8c('0x26')](function(){return _0x2fa1cd;});}else{return _0x2fa1cd;}})[_0x8b8c('0x46')](function(_0x3380c4){logger[_0x8b8c('0x2a')](_0x8b8c('0x4f'),_0x3380c4);throw _0x3380c4;});}return _0x2fa1cd;})[_0x8b8c('0x26')](respondWithResult(_0x3f1d36,0xc9))[_0x8b8c('0x46')](handleError(_0x3f1d36,null));};exports[_0x8b8c('0x25')]=function(_0x2b838b,_0x589c19){if(_0x2b838b['body']['id']){delete _0x2b838b[_0x8b8c('0x50')]['id'];}return db[_0x8b8c('0x41')][_0x8b8c('0x4d')]({'where':{'id':_0x2b838b[_0x8b8c('0x45')]['id']}})[_0x8b8c('0x26')](handleEntityNotFound(_0x589c19,null))[_0x8b8c('0x26')](saveUpdates(_0x2b838b[_0x8b8c('0x50')],null))[_0x8b8c('0x26')](respondWithResult(_0x589c19,null))[_0x8b8c('0x46')](handleError(_0x589c19,null));};exports[_0x8b8c('0x27')]=function(_0x3fed29,_0x269392){return db[_0x8b8c('0x41')]['find']({'where':{'id':_0x3fed29[_0x8b8c('0x45')]['id']}})[_0x8b8c('0x26')](handleEntityNotFound(_0x269392,null))[_0x8b8c('0x26')](removeEntity(_0x269392,null))[_0x8b8c('0x46')](handleError(_0x269392,null));};exports[_0x8b8c('0x51')]=function(_0x29622d,_0x5980de,_0x54c9f5){return db['Team'][_0x8b8c('0x52')]({'where':{'id':_0x29622d[_0x8b8c('0x45')]['id']}})[_0x8b8c('0x26')](handleEntityNotFound(_0x5980de,null))[_0x8b8c('0x26')](function(_0x48e2bb){if(!_0x29622d[_0x8b8c('0x35')]['channel']||!utils[_0x8b8c('0x53')](_0x29622d[_0x8b8c('0x35')]['channel'])){throw new db[(_0x8b8c('0x54'))]['ValidationError']('Unknown\x20channel');}var _0x40a5c3={};var _0x39f052={};_0x39f052[_0x8b8c('0x33')]=_[_0x8b8c('0x34')](db[_[_0x8b8c('0x55')](_0x29622d[_0x8b8c('0x35')][_0x8b8c('0x56')]['toLowerCase']())+_0x8b8c('0x57')][_0x8b8c('0x58')]);_0x39f052[_0x8b8c('0x35')]=_[_0x8b8c('0x34')](_0x29622d[_0x8b8c('0x35')]);_0x39f052['filters']=_[_0x8b8c('0x37')](_0x39f052[_0x8b8c('0x33')],_0x39f052[_0x8b8c('0x35')]);_0x40a5c3['attributes']=_['intersection'](_0x39f052[_0x8b8c('0x33')],qs['fields'](_0x29622d['query'][_0x8b8c('0x39')]));_0x40a5c3[_0x8b8c('0x38')]=_0x40a5c3['attributes'][_0x8b8c('0x3a')]?_0x40a5c3[_0x8b8c('0x38')]:_0x39f052[_0x8b8c('0x33')];_0x40a5c3[_0x8b8c('0x21')]=qs[_0x8b8c('0x21')](_0x29622d['query'][_0x8b8c('0x21')]);_0x40a5c3['offset']=qs['offset'](_0x29622d[_0x8b8c('0x35')][_0x8b8c('0x20')]);_0x40a5c3[_0x8b8c('0x3c')]=qs['sort'](_0x29622d[_0x8b8c('0x35')][_0x8b8c('0x3d')]);_0x40a5c3[_0x8b8c('0x3e')]=qs[_0x8b8c('0x36')](_[_0x8b8c('0x59')](_0x29622d[_0x8b8c('0x35')],_0x39f052['filters']));_0x40a5c3=_[_0x8b8c('0x3f')]({},_0x40a5c3,_0x29622d[_0x8b8c('0x40')]);return _0x48e2bb[_0x8b8c('0x28')+_['capitalize'](_0x29622d[_0x8b8c('0x35')][_0x8b8c('0x56')][_0x8b8c('0x5a')]())+_0x8b8c('0x5b')](_0x40a5c3);})['then'](respondWithResult(_0x5980de,null))[_0x8b8c('0x46')](handleError(_0x5980de,null));};exports[_0x8b8c('0x5c')]=function(_0x480aa9,_0x5ae799,_0xa41ed5){return db[_0x8b8c('0x41')]['findOne']({'where':{'id':_0x480aa9['params']['id']}})[_0x8b8c('0x26')](function(_0xac26d3){if(_0xac26d3){if(!_0x480aa9[_0x8b8c('0x50')]['channel']||!utils[_0x8b8c('0x53')](_0x480aa9[_0x8b8c('0x50')][_0x8b8c('0x56')])){throw new db[(_0x8b8c('0x54'))][(_0x8b8c('0x5d'))](_0x8b8c('0x5e'));}return _0xac26d3[_0x8b8c('0x5f')+_['capitalize'](_0x480aa9['body'][_0x8b8c('0x56')][_0x8b8c('0x5a')]())+_0x8b8c('0x5b')](_0x480aa9[_0x8b8c('0x50')][_0x8b8c('0x60')]);}return null;})[_0x8b8c('0x26')](handleEntityNotFound(_0x5ae799,null))[_0x8b8c('0x26')](respondWithStatusCode(_0x5ae799,null))[_0x8b8c('0x46')](handleError(_0x5ae799,null));};exports['removeQueues']=function(_0x1a9535,_0x38687a,_0x1d243d){return db[_0x8b8c('0x41')]['findOne']({'where':{'id':_0x1a9535[_0x8b8c('0x45')]['id']}})[_0x8b8c('0x26')](function(_0x28a8f3){if(_0x28a8f3){if(!_0x1a9535['query'][_0x8b8c('0x56')]||!utils[_0x8b8c('0x53')](_0x1a9535[_0x8b8c('0x35')][_0x8b8c('0x56')])){throw new db[(_0x8b8c('0x54'))][(_0x8b8c('0x5d'))](_0x8b8c('0x5e'));}return _0x28a8f3[_0x8b8c('0x61')+_[_0x8b8c('0x55')](_0x1a9535[_0x8b8c('0x35')][_0x8b8c('0x56')][_0x8b8c('0x5a')]())+_0x8b8c('0x5b')](_0x1a9535[_0x8b8c('0x35')]['ids']);}return null;})[_0x8b8c('0x26')](handleEntityNotFound(_0x38687a,null))[_0x8b8c('0x26')](respondWithStatusCode(_0x38687a,null))['catch'](handleError(_0x38687a,null));};exports[_0x8b8c('0x62')]=function(_0x4b37b7,_0x4cea90,_0x5e04ad){return db[_0x8b8c('0x41')][_0x8b8c('0x4d')]({'where':{'id':_0x4b37b7[_0x8b8c('0x45')]['id']}})[_0x8b8c('0x26')](handleEntityNotFound(_0x4cea90,null))[_0x8b8c('0x26')](function(_0x56dad3){if(_0x56dad3){var _0x5da15b=[_0x8b8c('0x63'),_0x8b8c('0x64'),_0x8b8c('0x65'),_0x8b8c('0x66'),_0x8b8c('0x67'),_0x8b8c('0x68'),_0x8b8c('0x69')];return BPromise[_0x8b8c('0x6a')](_0x5da15b,function(_0x238efd){return _0x56dad3['get'+_0x238efd+_0x8b8c('0x5b')]({'attributes':['id',_0x8b8c('0x2c')]})['then'](function(_0x569b77){return BPromise[_0x8b8c('0x6a')](_0x569b77,function(_0x35b462){return _0x35b462[_0x8b8c('0x62')](_0x4b37b7[_0x8b8c('0x50')][_0x8b8c('0x60')])[_0x8b8c('0x26')](function(){if(_0x238efd===_0x8b8c('0x63')){return db[_0x8b8c('0x6b')][_0x8b8c('0x43')]({'where':{'id':_0x4b37b7[_0x8b8c('0x50')]['ids']},'attributes':['id','name',_0x8b8c('0x6c'),_0x8b8c('0x6d'),_0x8b8c('0x6e')],'raw':!![]})[_0x8b8c('0x26')](function(_0x8282a){return BPromise[_0x8b8c('0x6a')](_[_0x8b8c('0x6f')](_0x8282a,{'online':0x1}),function(_0x2769cc){return db['UserVoiceQueueRt'][_0x8b8c('0x70')]({'membername':_0x2769cc[_0x8b8c('0x2c')],'UserId':_0x2769cc['id'],'queue_name':_0x35b462[_0x8b8c('0x2c')],'VoiceQueueId':_0x35b462['id'],'interface':_[_0x8b8c('0x71')](_0x2769cc[_0x8b8c('0x6e')])?util[_0x8b8c('0x72')]('SIP/%s',_0x2769cc['name']):_0x2769cc[_0x8b8c('0x6e')],'paused':_0x2769cc[_0x8b8c('0x6d')]||![],'penalty':0x0});});});}});});})[_0x8b8c('0x26')](function(){return _0x56dad3;});})[_0x8b8c('0x26')](function(){return _0x56dad3;});}})['then'](function(_0x182dbb){if(_0x182dbb){return _0x182dbb[_0x8b8c('0x62')](_0x4b37b7[_0x8b8c('0x50')][_0x8b8c('0x60')],_['omit'](_0x4b37b7['body'],[_0x8b8c('0x60'),'id'])||{})[_0x8b8c('0x73')](function(_0x426837){for(var _0x1ea954=0x0;_0x1ea954<_0x4b37b7[_0x8b8c('0x50')][_0x8b8c('0x60')][_0x8b8c('0x3a')];_0x1ea954+=0x1){socket[_0x8b8c('0x74')](_0x8b8c('0x75'),{'UserId':_0x4b37b7[_0x8b8c('0x50')][_0x8b8c('0x60')][_0x1ea954],'TeamId':_0x4b37b7[_0x8b8c('0x45')]['id']});}return _0x426837;});}})[_0x8b8c('0x26')](respondWithResult(_0x4cea90,null))[_0x8b8c('0x46')](handleError(_0x4cea90,null));};exports[_0x8b8c('0x76')]=function(_0x135e4d,_0x3a4e09,_0x53ea7f){return db['Team'][_0x8b8c('0x4d')]({'where':{'id':_0x135e4d[_0x8b8c('0x45')]['id']}})[_0x8b8c('0x26')](handleEntityNotFound(_0x3a4e09,null))['then'](function(_0x26cba7){if(_0x26cba7){return BPromise[_0x8b8c('0x6a')]([_0x8b8c('0x77'),_0x8b8c('0x78'),_0x8b8c('0x79'),'sms','fax','openchannel','whatsapp'],function(_0x36b491){return _0x26cba7['get'+_[_0x8b8c('0x55')](_0x36b491)+_0x8b8c('0x5b')]({'attributes':['id',_0x8b8c('0x2c')]})[_0x8b8c('0x26')](function(_0x248b6d){return BPromise['each'](_0x248b6d,function(_0x3fae70){return _0x3fae70[_0x8b8c('0x76')](_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')])[_0x8b8c('0x26')](function(){if(_0x36b491===_0x8b8c('0x77')){return db[_0x8b8c('0x7a')][_0x8b8c('0x27')]({'where':{'VoiceQueueId':_0x3fae70['id'],'UserId':_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')]}});}});});})['then'](function(){return _0x26cba7;});})[_0x8b8c('0x26')](function(){return _0x26cba7;});}})[_0x8b8c('0x26')](function(_0x1ed639){if(_0x1ed639){return _0x1ed639['removeAgents'](_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')])['then'](function(){if(_['isArray'](_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')])){for(var _0x4e337a=0x0;_0x4e337a<_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')][_0x8b8c('0x3a')];_0x4e337a+=0x1){socket[_0x8b8c('0x74')](_0x8b8c('0x7b'),{'UserId':Number(_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')][_0x4e337a]),'TeamId':Number(_0x135e4d[_0x8b8c('0x45')]['id'])});}}else{socket[_0x8b8c('0x74')]('userTeam:remove',{'UserId':Number(_0x135e4d[_0x8b8c('0x35')][_0x8b8c('0x60')]),'TeamId':Number(_0x135e4d[_0x8b8c('0x45')]['id'])});}});}})[_0x8b8c('0x26')](respondWithStatusCode(_0x3a4e09,null))[_0x8b8c('0x46')](handleError(_0x3a4e09,null));};exports[_0x8b8c('0x7c')]=function(_0x47dc5a,_0x3c19fa,_0x2a96b5){var _0x84a1b0={};var _0x10e0da={};var _0x585df7;var _0x15fa3f;return db[_0x8b8c('0x41')][_0x8b8c('0x52')]({'where':{'id':_0x47dc5a[_0x8b8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c19fa,null))[_0x8b8c('0x26')](function(_0x3649d8){if(_0x3649d8){_0x585df7=_0x3649d8;_0x10e0da[_0x8b8c('0x33')]=_[_0x8b8c('0x34')](db['User'][_0x8b8c('0x58')]);_0x10e0da[_0x8b8c('0x35')]=_[_0x8b8c('0x34')](_0x47dc5a[_0x8b8c('0x35')]);_0x10e0da[_0x8b8c('0x36')]=_['intersection'](_0x10e0da['model'],_0x10e0da[_0x8b8c('0x35')]);_0x84a1b0[_0x8b8c('0x38')]=_['intersection'](_0x10e0da[_0x8b8c('0x33')],qs[_0x8b8c('0x39')](_0x47dc5a[_0x8b8c('0x35')][_0x8b8c('0x39')]));_0x84a1b0[_0x8b8c('0x38')]=_0x84a1b0[_0x8b8c('0x38')][_0x8b8c('0x3a')]?_0x84a1b0[_0x8b8c('0x38')]:_0x10e0da[_0x8b8c('0x33')];_0x84a1b0['order']=qs['sort'](_0x47dc5a[_0x8b8c('0x35')][_0x8b8c('0x3d')]);_0x84a1b0[_0x8b8c('0x3e')]=qs[_0x8b8c('0x36')](_['pick'](_0x47dc5a[_0x8b8c('0x35')],_0x10e0da[_0x8b8c('0x36')]));if(_0x47dc5a[_0x8b8c('0x35')][_0x8b8c('0x6f')]){_0x84a1b0['where']=_[_0x8b8c('0x3f')](_0x84a1b0['where'],{'$or':_[_0x8b8c('0x2f')](_0x84a1b0[_0x8b8c('0x38')],function(_0x242b36){var _0x1cf4f7={};_0x1cf4f7[_0x242b36]={'$like':'%'+_0x47dc5a[_0x8b8c('0x35')][_0x8b8c('0x6f')]+'%'};return _0x1cf4f7;})});}_0x84a1b0=_['merge']({},_0x84a1b0,_0x47dc5a[_0x8b8c('0x40')]);return _0x585df7['getAgents'](_0x84a1b0);}})['then'](function(_0x5a1759){if(_0x5a1759){_0x15fa3f=_0x5a1759[_0x8b8c('0x3a')];if(!_0x47dc5a[_0x8b8c('0x35')]['hasOwnProperty'](_0x8b8c('0x3b'))){_0x84a1b0[_0x8b8c('0x21')]=qs[_0x8b8c('0x21')](_0x47dc5a[_0x8b8c('0x35')][_0x8b8c('0x21')]);_0x84a1b0[_0x8b8c('0x20')]=qs[_0x8b8c('0x20')](_0x47dc5a[_0x8b8c('0x35')]['offset']);}return _0x585df7[_0x8b8c('0x7c')](_0x84a1b0);}})[_0x8b8c('0x26')](function(_0x31f01b){if(_0x31f01b){return _0x31f01b?{'count':_0x15fa3f,'rows':_0x31f01b}:null;}})['then'](respondWithResult(_0x3c19fa,null))[_0x8b8c('0x46')](handleError(_0x3c19fa,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8e05cd1..90d1587 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 _0x9115=['emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners','save','update'];(function(_0x1f9126,_0x262ab){var _0x577b01=function(_0x5d98e5){while(--_0x5d98e5){_0x1f9126['push'](_0x1f9126['shift']());}};_0x577b01(++_0x262ab);}(_0x9115,0x1f3));var _0x5911=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x9115[_0x5c883f];return _0x4210cc;};'use strict';var EventEmitter=require(_0x5911('0x0'));var Team=require('../../mysqldb')['db'][_0x5911('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5911('0x2')](0x0);var events={'afterCreate':_0x5911('0x3'),'afterUpdate':_0x5911('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e7b87){return function(_0xc8d13b,_0x4282af,_0x20b4d5){TeamEvents[_0x5911('0x5')](_0x2e7b87+':'+_0xc8d13b['id'],_0xc8d13b);TeamEvents[_0x5911('0x5')](_0x2e7b87,_0xc8d13b);_0x20b4d5(null);};}for(var e in events){if(events[_0x5911('0x6')](e)){var event=events[e];Team[_0x5911('0x7')](e,emitEvent(event));}}module[_0x5911('0x8')]=TeamEvents; \ No newline at end of file +var _0xb7e2=['exports','events','Team','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xb7e2,0x1a8));var _0x2b7e=function(_0x418fc5,_0x5d0167){_0x418fc5=_0x418fc5-0x0;var _0x1a8db9=_0xb7e2[_0x418fc5];return _0x1a8db9;};'use strict';var EventEmitter=require(_0x2b7e('0x0'));var Team=require('../../mysqldb')['db'][_0x2b7e('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x2b7e('0x2')](0x0);var events={'afterCreate':_0x2b7e('0x3'),'afterUpdate':_0x2b7e('0x4'),'afterDestroy':_0x2b7e('0x5')};function emitEvent(_0x396bd3){return function(_0x166512,_0x2168d3,_0x281119){TeamEvents[_0x2b7e('0x6')](_0x396bd3+':'+_0x166512['id'],_0x166512);TeamEvents['emit'](_0x396bd3,_0x166512);_0x281119(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x2b7e('0x7')](e,emitEvent(event));}}module[_0x2b7e('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 e66abe6..9e238ff 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 _0xf824=['Team','teams','util','api','moment','bluebird','request-promise','path','../../config/environment','./team.attributes','exports','define'];(function(_0x1c786b,_0x23fd64){var _0x2907ab=function(_0x432c57){while(--_0x432c57){_0x1c786b['push'](_0x1c786b['shift']());}};_0x2907ab(++_0x23fd64);}(_0xf824,0x10a));var _0x4f82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf824[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x4f82('0x0'));var logger=require('../../config/logger')(_0x4f82('0x1'));var moment=require(_0x4f82('0x2'));var BPromise=require(_0x4f82('0x3'));var rp=require(_0x4f82('0x4'));var fs=require('fs');var path=require(_0x4f82('0x5'));var rimraf=require('rimraf');var config=require(_0x4f82('0x6'));var attributes=require(_0x4f82('0x7'));module[_0x4f82('0x8')]=function(_0x48859c,_0x82a6a4){return _0x48859c[_0x4f82('0x9')](_0x4f82('0xa'),attributes,{'tableName':_0x4f82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4b3=['request-promise','path','./team.attributes','exports','define','teams','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xf4b3,0x1da));var _0x3f4b=function(_0x4351ef,_0x178920){_0x4351ef=_0x4351ef-0x0;var _0x41a551=_0xf4b3[_0x4351ef];return _0x41a551;};'use strict';var _=require(_0x3f4b('0x0'));var util=require(_0x3f4b('0x1'));var logger=require(_0x3f4b('0x2'))(_0x3f4b('0x3'));var moment=require(_0x3f4b('0x4'));var BPromise=require(_0x3f4b('0x5'));var rp=require(_0x3f4b('0x6'));var fs=require('fs');var path=require(_0x3f4b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3f4b('0x8'));module[_0x3f4b('0x9')]=function(_0x478e87,_0x5c8678){return _0x478e87[_0x3f4b('0xa')]('Team',attributes,{'tableName':_0x3f4b('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 9a7f6a9..57d8e2e 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 _0x0bcc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6d91a,_0x3c06dc){var _0x405faf=function(_0x4b157a){while(--_0x4b157a){_0x6d91a['push'](_0x6d91a['shift']());}};_0x405faf(++_0x3c06dc);}(_0x0bcc,0x19a));var _0xc0bc=function(_0x1c6085,_0x53f5d9){_0x1c6085=_0x1c6085-0x0;var _0x2e9016=_0x0bcc[_0x1c6085];return _0x2e9016;};'use strict';var _=require(_0xc0bc('0x0'));var util=require(_0xc0bc('0x1'));var moment=require(_0xc0bc('0x2'));var BPromise=require(_0xc0bc('0x3'));var rs=require(_0xc0bc('0x4'));var fs=require('fs');var Redis=require(_0xc0bc('0x5'));var db=require(_0xc0bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0bc('0x7'))(_0xc0bc('0x8'));var config=require(_0xc0bc('0x9'));var jayson=require(_0xc0bc('0xa'));var client=jayson[_0xc0bc('0xb')][_0xc0bc('0xc')]({'port':0x232a});config[_0xc0bc('0xd')]=_['defaults'](config[_0xc0bc('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0bc('0xd')]));require(_0xc0bc('0xe'))['register'](socket);function respondWithRpcPromise(_0x2f4ae1,_0x54d156,_0xfabff6){return new BPromise(function(_0x11f373,_0x5d060f){return client[_0xc0bc('0xf')](_0x2f4ae1,_0xfabff6)[_0xc0bc('0x10')](function(_0xbe616c){logger[_0xc0bc('0x11')](_0xc0bc('0x12'),_0x54d156,'request\x20sent');logger[_0xc0bc('0x13')](_0xc0bc('0x14'),_0x54d156,_0xc0bc('0x15'),JSON[_0xc0bc('0x16')](_0xbe616c));if(_0xbe616c[_0xc0bc('0x17')]){if(_0xbe616c[_0xc0bc('0x17')]['code']===0x1f4){logger[_0xc0bc('0x17')]('Team,\x20%s,\x20%s',_0x54d156,_0xbe616c[_0xc0bc('0x17')][_0xc0bc('0x18')]);return _0x5d060f(_0xbe616c[_0xc0bc('0x17')][_0xc0bc('0x18')]);}logger['error'](_0xc0bc('0x12'),_0x54d156,_0xbe616c[_0xc0bc('0x17')][_0xc0bc('0x18')]);return _0x11f373(_0xbe616c[_0xc0bc('0x17')][_0xc0bc('0x18')]);}else{logger[_0xc0bc('0x11')](_0xc0bc('0x12'),_0x54d156,_0xc0bc('0x15'));_0x11f373(_0xbe616c['result'][_0xc0bc('0x18')]);}})[_0xc0bc('0x19')](function(_0x2a69f1){logger[_0xc0bc('0x17')]('Team,\x20%s,\x20%s',_0x54d156,_0x2a69f1);_0x5d060f(_0x2a69f1);});});} \ No newline at end of file +var _0x1938=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x402eff,_0x2525f2){var _0x2eb371=function(_0x15e9b3){while(--_0x15e9b3){_0x402eff['push'](_0x402eff['shift']());}};_0x2eb371(++_0x2525f2);}(_0x1938,0x1d7));var _0x8193=function(_0x5483a6,_0x2b7634){_0x5483a6=_0x5483a6-0x0;var _0x4f521f=_0x1938[_0x5483a6];return _0x4f521f;};'use strict';var _=require(_0x8193('0x0'));var util=require(_0x8193('0x1'));var moment=require(_0x8193('0x2'));var BPromise=require(_0x8193('0x3'));var rs=require(_0x8193('0x4'));var fs=require('fs');var Redis=require(_0x8193('0x5'));var db=require(_0x8193('0x6'))['db'];var utils=require(_0x8193('0x7'));var logger=require(_0x8193('0x8'))('rpc');var config=require(_0x8193('0x9'));var jayson=require(_0x8193('0xa'));var client=jayson[_0x8193('0xb')][_0x8193('0xc')]({'port':0x232a});config['redis']=_[_0x8193('0xd')](config[_0x8193('0xe')],{'host':_0x8193('0xf'),'port':0x18eb});var socket=require(_0x8193('0x10'))(new Redis(config[_0x8193('0xe')]));require(_0x8193('0x11'))[_0x8193('0x12')](socket);function respondWithRpcPromise(_0x296d9e,_0x1cade8,_0x244ac4){return new BPromise(function(_0x2d10de,_0xb12273){return client[_0x8193('0x13')](_0x296d9e,_0x244ac4)[_0x8193('0x14')](function(_0x213e9f){logger['info'](_0x8193('0x15'),_0x1cade8,_0x8193('0x16'));logger[_0x8193('0x17')](_0x8193('0x18'),_0x1cade8,_0x8193('0x16'),JSON[_0x8193('0x19')](_0x213e9f));if(_0x213e9f[_0x8193('0x1a')]){if(_0x213e9f[_0x8193('0x1a')][_0x8193('0x1b')]===0x1f4){logger[_0x8193('0x1a')](_0x8193('0x15'),_0x1cade8,_0x213e9f[_0x8193('0x1a')]['message']);return _0xb12273(_0x213e9f['error'][_0x8193('0x1c')]);}logger[_0x8193('0x1a')](_0x8193('0x15'),_0x1cade8,_0x213e9f[_0x8193('0x1a')]['message']);return _0x2d10de(_0x213e9f[_0x8193('0x1a')][_0x8193('0x1c')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x1cade8,_0x8193('0x16'));_0x2d10de(_0x213e9f[_0x8193('0x1d')][_0x8193('0x1c')]);}})['catch'](function(_0x15c1f6){logger['error'](_0x8193('0x15'),_0x1cade8,_0x15c1f6);_0xb12273(_0x15c1f6);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 64744d2..72f7393 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 _0xdbb1=['team:','./team.events','emit','removeListener','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbb1,0x105));var _0x1dbb=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xdbb1[_0xb0f7c3];return _0x28ea68;};'use strict';var TeamEvents=require(_0x1dbb('0x0'));var events=['save','remove','update'];function createListener(_0x26adf7,_0x51e55e){return function(_0x566098){_0x51e55e[_0x1dbb('0x1')](_0x26adf7,_0x566098);};}function removeListener(_0x483e15,_0xa1e321){return function(){TeamEvents[_0x1dbb('0x2')](_0x483e15,_0xa1e321);};}exports['register']=function(_0x55df0f){for(var _0xd43ce8=0x0,_0x38259d=events[_0x1dbb('0x3')];_0xd43ce8<_0x38259d;_0xd43ce8++){var _0x7c2269=events[_0xd43ce8];var _0x5e622c=createListener(_0x1dbb('0x4')+_0x7c2269,_0x55df0f);TeamEvents['on'](_0x7c2269,_0x5e622c);}}; \ No newline at end of file +var _0x15ef=['register','length','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15ef,0x80));var _0xf15e=function(_0xbba3de,_0x1b8f23){_0xbba3de=_0xbba3de-0x0;var _0x2a29dd=_0x15ef[_0xbba3de];return _0x2a29dd;};'use strict';var TeamEvents=require('./team.events');var events=[_0xf15e('0x0'),_0xf15e('0x1'),'update'];function createListener(_0x11a802,_0x1a3b9a){return function(_0x2eaa57){_0x1a3b9a[_0xf15e('0x2')](_0x11a802,_0x2eaa57);};}function removeListener(_0x4e7241,_0x5d456b){return function(){TeamEvents[_0xf15e('0x3')](_0x4e7241,_0x5d456b);};}exports[_0xf15e('0x4')]=function(_0x5e96b4){for(var _0x5ba863=0x0,_0x66708e=events[_0xf15e('0x5')];_0x5ba863<_0x66708e;_0x5ba863++){var _0x490097=events[_0x5ba863];var _0x2d6e94=createListener('team:'+_0x490097,_0x5e96b4);TeamEvents['on'](_0x490097,_0x2d6e94);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 6e1adef..0f66b5b 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 _0xa9bc=['./template.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9bc,0xca));var _0xca9b=function(_0x592be6,_0x135b82){_0x592be6=_0x592be6-0x0;var _0x12d3a8=_0xa9bc[_0x592be6];return _0x12d3a8;};'use strict';var multer=require('multer');var util=require(_0xca9b('0x0'));var path=require('path');var timeout=require(_0xca9b('0x1'));var express=require(_0xca9b('0x2'));var router=express[_0xca9b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xca9b('0x4'));var config=require(_0xca9b('0x5'));var controller=require(_0xca9b('0x6'));router[_0xca9b('0x7')]('/',auth[_0xca9b('0x8')](),controller[_0xca9b('0x9')]);router[_0xca9b('0x7')](_0xca9b('0xa'),auth[_0xca9b('0x8')](),controller['show']);router[_0xca9b('0xb')]('/',auth['isAuthenticated'](),controller[_0xca9b('0xc')]);router['put'](_0xca9b('0xa'),auth[_0xca9b('0x8')](),controller[_0xca9b('0xd')]);router[_0xca9b('0xe')](_0xca9b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xca9b('0xf')]=router; \ No newline at end of file +var _0x1aa6=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x43de36,_0x1aa678){var _0x360248=function(_0x454b31){while(--_0x454b31){_0x43de36['push'](_0x43de36['shift']());}};_0x360248(++_0x1aa678);}(_0x1aa6,0x1b6));var _0x61aa=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x1aa6[_0x3a2118];return _0x1d181d;};'use strict';var multer=require(_0x61aa('0x0'));var util=require(_0x61aa('0x1'));var path=require(_0x61aa('0x2'));var timeout=require(_0x61aa('0x3'));var express=require('express');var router=express[_0x61aa('0x4')]();var auth=require(_0x61aa('0x5'));var interaction=require(_0x61aa('0x6'));var config=require(_0x61aa('0x7'));var controller=require(_0x61aa('0x8'));router[_0x61aa('0x9')]('/',auth[_0x61aa('0xa')](),controller[_0x61aa('0xb')]);router[_0x61aa('0x9')]('/:id',auth[_0x61aa('0xa')](),controller[_0x61aa('0xc')]);router[_0x61aa('0xd')]('/',auth[_0x61aa('0xa')](),controller['create']);router[_0x61aa('0xe')](_0x61aa('0xf'),auth[_0x61aa('0xa')](),controller[_0x61aa('0x10')]);router[_0x61aa('0x11')](_0x61aa('0xf'),auth[_0x61aa('0xa')](),controller[_0x61aa('0x12')]);module[_0x61aa('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 f2350ef..373f8ba 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 _0x9b30=['TEXT','exports','STRING'];(function(_0x26afd3,_0x58b932){var _0x2ebe2e=function(_0x580030){while(--_0x580030){_0x26afd3['push'](_0x26afd3['shift']());}};_0x2ebe2e(++_0x58b932);}(_0x9b30,0x1ab));var _0x09b3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9b30[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module[_0x09b3('0x0')]={'name':{'type':Sequelize[_0x09b3('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x09b3('0x2')]}}; \ No newline at end of file +var _0xfbf1=['STRING','exports'];(function(_0x240c7c,_0xfcafac){var _0x5339b2=function(_0x4c335a){while(--_0x4c335a){_0x240c7c['push'](_0x240c7c['shift']());}};_0x5339b2(++_0xfcafac);}(_0xfbf1,0x10b));var _0x1fbf=function(_0x26e5b2,_0x5a5862){_0x26e5b2=_0x26e5b2-0x0;var _0x42abf9=_0xfbf1[_0x26e5b2];return _0x42abf9;};'use strict';var Sequelize=require('sequelize');module[_0x1fbf('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1fbf('0x1')]},'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 4229931..7a1b943 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 _0x093e=['desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','get','Templates','UserProfileResource','error','name','send','index','map','Template','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','jsforce'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x093e,0x12b));var _0xe093=function(_0x548ead,_0x4bbe36){_0x548ead=_0x548ead-0x0;var _0x51ff46=_0x093e[_0x548ead];return _0x51ff46;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe093('0x0'));var jsonpatch=require(_0xe093('0x1'));var rp=require(_0xe093('0x2'));var moment=require(_0xe093('0x3'));var BPromise=require(_0xe093('0x4'));var Mustache=require(_0xe093('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe093('0x6'));var csv=require('to-csv');var ejs=require(_0xe093('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe093('0x8'));var deskjs=require(_0xe093('0x9'));var toCsv=require(_0xe093('0xa'));var querystring=require(_0xe093('0xb'));var Papa=require('papaparse');var Redis=require(_0xe093('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe093('0xd'));var as=require(_0xe093('0xe'));var hardwareService=require(_0xe093('0xf'));var logger=require(_0xe093('0x10'))(_0xe093('0x11'));var utils=require(_0xe093('0x12'));var config=require(_0xe093('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14ad87,_0x4da5b0){_0x4da5b0=_0x4da5b0||0xcc;return function(_0x4e4587){if(_0x4e4587){return _0x14ad87[_0xe093('0x14')](_0x4da5b0);}return _0x14ad87[_0xe093('0x15')](_0x4da5b0)[_0xe093('0x16')]();};}function respondWithResult(_0x339b1d,_0x3cc8d0){_0x3cc8d0=_0x3cc8d0||0xc8;return function(_0x1e210a){if(_0x1e210a){return _0x339b1d[_0xe093('0x15')](_0x3cc8d0)[_0xe093('0x17')](_0x1e210a);}};}function respondWithFilteredResult(_0x17a904,_0x20bb4f){return function(_0x50c74f){if(_0x50c74f){var _0x4700fa=_0x50c74f[_0xe093('0x18')],_0x4b6a65=_0x20bb4f['offset'],_0x2d669c=_0x20bb4f[_0xe093('0x19')]+_0x20bb4f[_0xe093('0x1a')],_0x4cfe96;if(_0x2d669c>=_0x4700fa){_0x2d669c=_0x4700fa;_0x4cfe96=0xc8;}else{_0x4cfe96=0xce;}_0x17a904[_0xe093('0x15')](_0x4cfe96);return _0x17a904[_0xe093('0x1b')](_0xe093('0x1c'),_0x4b6a65+'-'+_0x2d669c+'/'+_0x4700fa)['json'](_0x50c74f);}return null;};}function patchUpdates(_0x1f3a92){return function(_0xb8b3b1){try{jsonpatch['apply'](_0xb8b3b1,_0x1f3a92,!![]);}catch(_0x4cf60e){return BPromise['reject'](_0x4cf60e);}return _0xb8b3b1['save']();};}function saveUpdates(_0x269d39,_0x58e9c0){return function(_0x5e351b){if(_0x5e351b){return _0x5e351b[_0xe093('0x1d')](_0x269d39)[_0xe093('0x1e')](function(_0x21361e){return _0x21361e;});}return null;};}function removeEntity(_0x2c8f1b,_0x5525d7){return function(_0x1e3672){if(_0x1e3672){return _0x1e3672[_0xe093('0x1f')]()[_0xe093('0x1e')](function(){var _0x531d6d=_0x1e3672[_0xe093('0x20')]({'plain':!![]});var _0x4b2554=_0xe093('0x21');return db[_0xe093('0x22')][_0xe093('0x1f')]({'where':{'type':_0x4b2554,'resourceId':_0x531d6d['id']}})['then'](function(){return _0x1e3672;});})[_0xe093('0x1e')](function(){_0x2c8f1b[_0xe093('0x15')](0xcc)[_0xe093('0x16')]();});}};}function handleEntityNotFound(_0x5c095d,_0x50b80f){return function(_0x4cb87d){if(!_0x4cb87d){_0x5c095d[_0xe093('0x14')](0x194);}return _0x4cb87d;};}function handleError(_0x54afa1,_0x4953e8){_0x4953e8=_0x4953e8||0x1f4;return function(_0x381cc0){logger[_0xe093('0x23')](_0x381cc0['stack']);if(_0x381cc0[_0xe093('0x24')]){delete _0x381cc0[_0xe093('0x24')];}_0x54afa1['status'](_0x4953e8)[_0xe093('0x25')](_0x381cc0);};}exports[_0xe093('0x26')]=function(_0x44c4c1,_0x38b76f){var _0x26b408={},_0x1dd9b4={},_0x2b44ad={'count':0x0,'rows':[]};var _0xf4e303=_[_0xe093('0x27')](db[_0xe093('0x28')]['rawAttributes'],function(_0x45b3a3){return{'name':_0x45b3a3[_0xe093('0x29')],'type':_0x45b3a3[_0xe093('0x2a')][_0xe093('0x2b')]};});_0x1dd9b4['model']=_['map'](_0xf4e303,_0xe093('0x24'));_0x1dd9b4[_0xe093('0x2c')]=_[_0xe093('0x2d')](_0x44c4c1[_0xe093('0x2c')]);_0x1dd9b4[_0xe093('0x2e')]=_[_0xe093('0x2f')](_0x1dd9b4[_0xe093('0x30')],_0x1dd9b4['query']);_0x26b408[_0xe093('0x31')]=_['intersection'](_0x1dd9b4[_0xe093('0x30')],qs['fields'](_0x44c4c1[_0xe093('0x2c')][_0xe093('0x32')]));_0x26b408[_0xe093('0x31')]=_0x26b408[_0xe093('0x31')][_0xe093('0x33')]?_0x26b408['attributes']:_0x1dd9b4[_0xe093('0x30')];if(!_0x44c4c1[_0xe093('0x2c')]['hasOwnProperty'](_0xe093('0x34'))){_0x26b408[_0xe093('0x1a')]=qs[_0xe093('0x1a')](_0x44c4c1['query'][_0xe093('0x1a')]);_0x26b408['offset']=qs[_0xe093('0x19')](_0x44c4c1[_0xe093('0x2c')][_0xe093('0x19')]);}_0x26b408[_0xe093('0x35')]=qs['sort'](_0x44c4c1[_0xe093('0x2c')][_0xe093('0x36')]);_0x26b408['where']=qs['filters'](_[_0xe093('0x37')](_0x44c4c1['query'],_0x1dd9b4[_0xe093('0x2e')]),_0xf4e303);if(_0x44c4c1['query']['filter']){_0x26b408[_0xe093('0x38')]=_['merge'](_0x26b408[_0xe093('0x38')],{'$or':_['map'](_0xf4e303,function(_0xa36c9a){if(_0xa36c9a['type']!==_0xe093('0x39')){var _0x3119b3={};_0x3119b3[_0xa36c9a[_0xe093('0x24')]]={'$like':'%'+_0x44c4c1[_0xe093('0x2c')][_0xe093('0x3a')]+'%'};return _0x3119b3;}})});}_0x26b408=_[_0xe093('0x3b')]({},_0x26b408,_0x44c4c1['options']);var _0x36031c={'where':_0x26b408['where']};return db[_0xe093('0x28')][_0xe093('0x18')](_0x36031c)['then'](function(_0x161eb3){_0x2b44ad[_0xe093('0x18')]=_0x161eb3;if(_0x44c4c1[_0xe093('0x2c')][_0xe093('0x3c')]){_0x26b408['include']=[{'all':!![]}];}return db[_0xe093('0x28')][_0xe093('0x3d')](_0x26b408);})[_0xe093('0x1e')](function(_0x2c7ce6){_0x2b44ad[_0xe093('0x3e')]=_0x2c7ce6;return _0x2b44ad;})[_0xe093('0x1e')](respondWithFilteredResult(_0x38b76f,_0x26b408))[_0xe093('0x3f')](handleError(_0x38b76f,null));};exports[_0xe093('0x40')]=function(_0x15c6ec,_0x5f484c){var _0x4f64b0={'raw':!![],'where':{'id':_0x15c6ec[_0xe093('0x41')]['id']}},_0x23264d={};_0x23264d[_0xe093('0x30')]=_[_0xe093('0x2d')](db['Template'][_0xe093('0x42')]);_0x23264d[_0xe093('0x2c')]=_[_0xe093('0x2d')](_0x15c6ec[_0xe093('0x2c')]);_0x23264d['filters']=_[_0xe093('0x2f')](_0x23264d[_0xe093('0x30')],_0x23264d[_0xe093('0x2c')]);_0x4f64b0[_0xe093('0x31')]=_[_0xe093('0x2f')](_0x23264d[_0xe093('0x30')],qs[_0xe093('0x32')](_0x15c6ec['query'][_0xe093('0x32')]));_0x4f64b0[_0xe093('0x31')]=_0x4f64b0[_0xe093('0x31')][_0xe093('0x33')]?_0x4f64b0['attributes']:_0x23264d[_0xe093('0x30')];if(_0x15c6ec[_0xe093('0x2c')][_0xe093('0x3c')]){_0x4f64b0['include']=[{'all':!![]}];}_0x4f64b0=_['merge']({},_0x4f64b0,_0x15c6ec[_0xe093('0x43')]);return db[_0xe093('0x28')][_0xe093('0x44')](_0x4f64b0)[_0xe093('0x1e')](handleEntityNotFound(_0x5f484c,null))[_0xe093('0x1e')](respondWithResult(_0x5f484c,null))['catch'](handleError(_0x5f484c,null));};exports[_0xe093('0x45')]=function(_0x1c8de1,_0x1b2a24){return db['Template'][_0xe093('0x45')](_0x1c8de1[_0xe093('0x46')],{})['then'](function(_0x1cc3e1){var _0x329b30=_0x1c8de1['user'][_0xe093('0x20')]({'plain':!![]});if(!_0x329b30)throw new Error(_0xe093('0x47'));if(_0x329b30[_0xe093('0x48')]===_0xe093('0x49')){var _0x2d5ad0=_0x1cc3e1['get']({'plain':!![]});var _0x37d962=_0xe093('0x21');return db['UserProfileSection'][_0xe093('0x44')]({'where':{'name':_0x37d962,'userProfileId':_0x329b30[_0xe093('0x4a')]},'raw':!![]})[_0xe093('0x1e')](function(_0x26c542){if(_0x26c542&&_0x26c542[_0xe093('0x4b')]===0x0){return db['UserProfileResource'][_0xe093('0x45')]({'name':_0x2d5ad0[_0xe093('0x24')],'resourceId':_0x2d5ad0['id'],'type':_0x26c542[_0xe093('0x24')],'sectionId':_0x26c542['id']},{})[_0xe093('0x1e')](function(){return _0x1cc3e1;});}else{return _0x1cc3e1;}})[_0xe093('0x3f')](function(_0x4a9c9f){logger[_0xe093('0x23')](_0xe093('0x4c'),_0x4a9c9f);throw _0x4a9c9f;});}return _0x1cc3e1;})[_0xe093('0x1e')](respondWithResult(_0x1b2a24,0xc9))[_0xe093('0x3f')](handleError(_0x1b2a24,null));};exports[_0xe093('0x1d')]=function(_0x4c724f,_0x1a266a){if(_0x4c724f['body']['id']){delete _0x4c724f['body']['id'];}return db[_0xe093('0x28')][_0xe093('0x44')]({'where':{'id':_0x4c724f[_0xe093('0x41')]['id']}})[_0xe093('0x1e')](handleEntityNotFound(_0x1a266a,null))[_0xe093('0x1e')](saveUpdates(_0x4c724f['body'],null))[_0xe093('0x1e')](respondWithResult(_0x1a266a,null))['catch'](handleError(_0x1a266a,null));};exports[_0xe093('0x1f')]=function(_0x3563aa,_0x2f6b17){return db['Template'][_0xe093('0x44')]({'where':{'id':_0x3563aa[_0xe093('0x41')]['id']}})[_0xe093('0x1e')](handleEntityNotFound(_0x2f6b17,null))[_0xe093('0x1e')](removeEntity(_0x2f6b17,null))[_0xe093('0x3f')](handleError(_0x2f6b17,null));}; \ No newline at end of file +var _0x57a3=['crypto','jsforce','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','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','Template','merge','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','userProfileId','autoAssociation','create','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x5cf3cb,_0x40835f){var _0x5a34ca=function(_0x2fbce2){while(--_0x2fbce2){_0x5cf3cb['push'](_0x5cf3cb['shift']());}};_0x5a34ca(++_0x40835f);}(_0x57a3,0xea));var _0x357a=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x57a3[_0x4bfac3];return _0x15f0f2;};'use strict';var pdf=require(_0x357a('0x0'));var emlformat=require(_0x357a('0x1'));var rimraf=require(_0x357a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x357a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x357a('0x4'));var Mustache=require(_0x357a('0x5'));var util=require(_0x357a('0x6'));var path=require(_0x357a('0x7'));var sox=require(_0x357a('0x8'));var csv=require(_0x357a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x357a('0xa'));var squel=require(_0x357a('0xb'));var crypto=require(_0x357a('0xc'));var jsforce=require(_0x357a('0xd'));var deskjs=require(_0x357a('0xe'));var toCsv=require(_0x357a('0x9'));var querystring=require('querystring');var Papa=require(_0x357a('0xf'));var Redis=require('ioredis');var authService=require(_0x357a('0x10'));var qs=require(_0x357a('0x11'));var as=require(_0x357a('0x12'));var hardwareService=require(_0x357a('0x13'));var logger=require(_0x357a('0x14'))(_0x357a('0x15'));var utils=require('../../config/utils');var config=require(_0x357a('0x16'));var db=require(_0x357a('0x17'))['db'];function respondWithStatusCode(_0x4b3e22,_0x4d6768){_0x4d6768=_0x4d6768||0xcc;return function(_0x13c2ef){if(_0x13c2ef){return _0x4b3e22[_0x357a('0x18')](_0x4d6768);}return _0x4b3e22[_0x357a('0x19')](_0x4d6768)[_0x357a('0x1a')]();};}function respondWithResult(_0x9bec96,_0x4dc249){_0x4dc249=_0x4dc249||0xc8;return function(_0x4003d3){if(_0x4003d3){return _0x9bec96[_0x357a('0x19')](_0x4dc249)[_0x357a('0x1b')](_0x4003d3);}};}function respondWithFilteredResult(_0x3a2fd6,_0x57eb11){return function(_0x5e73b6){if(_0x5e73b6){var _0x396958=_0x5e73b6[_0x357a('0x1c')],_0x398414=_0x57eb11[_0x357a('0x1d')],_0x436694=_0x57eb11[_0x357a('0x1d')]+_0x57eb11[_0x357a('0x1e')],_0x5dce04;if(_0x436694>=_0x396958){_0x436694=_0x396958;_0x5dce04=0xc8;}else{_0x5dce04=0xce;}_0x3a2fd6['status'](_0x5dce04);return _0x3a2fd6[_0x357a('0x1f')](_0x357a('0x20'),_0x398414+'-'+_0x436694+'/'+_0x396958)[_0x357a('0x1b')](_0x5e73b6);}return null;};}function patchUpdates(_0x158212){return function(_0x4c679d){try{jsonpatch[_0x357a('0x21')](_0x4c679d,_0x158212,!![]);}catch(_0x27c7be){return BPromise['reject'](_0x27c7be);}return _0x4c679d[_0x357a('0x22')]();};}function saveUpdates(_0x372d0d,_0x4bc984){return function(_0x36ecf0){if(_0x36ecf0){return _0x36ecf0[_0x357a('0x23')](_0x372d0d)[_0x357a('0x24')](function(_0x406977){return _0x406977;});}return null;};}function removeEntity(_0x4fbffe,_0x1d612c){return function(_0x127a53){if(_0x127a53){return _0x127a53[_0x357a('0x25')]()[_0x357a('0x24')](function(){var _0x415d49=_0x127a53[_0x357a('0x26')]({'plain':!![]});var _0x4e44fb='Templates';return db[_0x357a('0x27')][_0x357a('0x25')]({'where':{'type':_0x4e44fb,'resourceId':_0x415d49['id']}})[_0x357a('0x24')](function(){return _0x127a53;});})[_0x357a('0x24')](function(){_0x4fbffe[_0x357a('0x19')](0xcc)[_0x357a('0x1a')]();});}};}function handleEntityNotFound(_0x194275,_0x3546f5){return function(_0x202647){if(!_0x202647){_0x194275[_0x357a('0x18')](0x194);}return _0x202647;};}function handleError(_0x6b81ab,_0x18068b){_0x18068b=_0x18068b||0x1f4;return function(_0x12ebcd){logger[_0x357a('0x28')](_0x12ebcd[_0x357a('0x29')]);if(_0x12ebcd[_0x357a('0x2a')]){delete _0x12ebcd[_0x357a('0x2a')];}_0x6b81ab[_0x357a('0x19')](_0x18068b)[_0x357a('0x2b')](_0x12ebcd);};}exports[_0x357a('0x2c')]=function(_0x1cb079,_0x2e6569){var _0x43dc00={},_0x5938d9={},_0x1f6fb1={'count':0x0,'rows':[]};var _0x32f315=_[_0x357a('0x2d')](db['Template'][_0x357a('0x2e')],function(_0x55f473){return{'name':_0x55f473['fieldName'],'type':_0x55f473[_0x357a('0x2f')][_0x357a('0x30')]};});_0x5938d9[_0x357a('0x31')]=_[_0x357a('0x2d')](_0x32f315,_0x357a('0x2a'));_0x5938d9[_0x357a('0x32')]=_[_0x357a('0x33')](_0x1cb079[_0x357a('0x32')]);_0x5938d9[_0x357a('0x34')]=_[_0x357a('0x35')](_0x5938d9[_0x357a('0x31')],_0x5938d9[_0x357a('0x32')]);_0x43dc00[_0x357a('0x36')]=_[_0x357a('0x35')](_0x5938d9[_0x357a('0x31')],qs[_0x357a('0x37')](_0x1cb079['query']['fields']));_0x43dc00[_0x357a('0x36')]=_0x43dc00[_0x357a('0x36')][_0x357a('0x38')]?_0x43dc00[_0x357a('0x36')]:_0x5938d9[_0x357a('0x31')];if(!_0x1cb079[_0x357a('0x32')][_0x357a('0x39')](_0x357a('0x3a'))){_0x43dc00['limit']=qs[_0x357a('0x1e')](_0x1cb079[_0x357a('0x32')][_0x357a('0x1e')]);_0x43dc00[_0x357a('0x1d')]=qs[_0x357a('0x1d')](_0x1cb079[_0x357a('0x32')][_0x357a('0x1d')]);}_0x43dc00[_0x357a('0x3b')]=qs['sort'](_0x1cb079[_0x357a('0x32')][_0x357a('0x3c')]);_0x43dc00[_0x357a('0x3d')]=qs[_0x357a('0x34')](_[_0x357a('0x3e')](_0x1cb079[_0x357a('0x32')],_0x5938d9[_0x357a('0x34')]),_0x32f315);if(_0x1cb079['query']['filter']){_0x43dc00[_0x357a('0x3d')]=_['merge'](_0x43dc00['where'],{'$or':_[_0x357a('0x2d')](_0x32f315,function(_0x135e48){if(_0x135e48['type']!==_0x357a('0x3f')){var _0x5dcd38={};_0x5dcd38[_0x135e48[_0x357a('0x2a')]]={'$like':'%'+_0x1cb079[_0x357a('0x32')][_0x357a('0x40')]+'%'};return _0x5dcd38;}})});}_0x43dc00=_['merge']({},_0x43dc00,_0x1cb079['options']);var _0x35f130={'where':_0x43dc00[_0x357a('0x3d')]};return db['Template'][_0x357a('0x1c')](_0x35f130)['then'](function(_0x842850){_0x1f6fb1['count']=_0x842850;if(_0x1cb079[_0x357a('0x32')][_0x357a('0x41')]){_0x43dc00[_0x357a('0x42')]=[{'all':!![]}];}return db['Template'][_0x357a('0x43')](_0x43dc00);})[_0x357a('0x24')](function(_0x34de13){_0x1f6fb1[_0x357a('0x44')]=_0x34de13;return _0x1f6fb1;})['then'](respondWithFilteredResult(_0x2e6569,_0x43dc00))['catch'](handleError(_0x2e6569,null));};exports[_0x357a('0x45')]=function(_0x446755,_0x3e4df7){var _0x5dcd6d={'raw':!![],'where':{'id':_0x446755[_0x357a('0x46')]['id']}},_0x4bcdaa={};_0x4bcdaa[_0x357a('0x31')]=_[_0x357a('0x33')](db[_0x357a('0x47')][_0x357a('0x2e')]);_0x4bcdaa[_0x357a('0x32')]=_[_0x357a('0x33')](_0x446755[_0x357a('0x32')]);_0x4bcdaa['filters']=_[_0x357a('0x35')](_0x4bcdaa['model'],_0x4bcdaa[_0x357a('0x32')]);_0x5dcd6d[_0x357a('0x36')]=_[_0x357a('0x35')](_0x4bcdaa[_0x357a('0x31')],qs[_0x357a('0x37')](_0x446755[_0x357a('0x32')]['fields']));_0x5dcd6d[_0x357a('0x36')]=_0x5dcd6d[_0x357a('0x36')][_0x357a('0x38')]?_0x5dcd6d[_0x357a('0x36')]:_0x4bcdaa[_0x357a('0x31')];if(_0x446755[_0x357a('0x32')][_0x357a('0x41')]){_0x5dcd6d['include']=[{'all':!![]}];}_0x5dcd6d=_[_0x357a('0x48')]({},_0x5dcd6d,_0x446755['options']);return db[_0x357a('0x47')][_0x357a('0x49')](_0x5dcd6d)['then'](handleEntityNotFound(_0x3e4df7,null))['then'](respondWithResult(_0x3e4df7,null))[_0x357a('0x4a')](handleError(_0x3e4df7,null));};exports['create']=function(_0x79be84,_0xecc8e8){return db[_0x357a('0x47')]['create'](_0x79be84[_0x357a('0x4b')],{})[_0x357a('0x24')](function(_0x5ac451){var _0x4c7214=_0x79be84[_0x357a('0x4c')][_0x357a('0x26')]({'plain':!![]});if(!_0x4c7214)throw new Error(_0x357a('0x4d'));if(_0x4c7214['role']==='user'){var _0x376f7f=_0x5ac451[_0x357a('0x26')]({'plain':!![]});var _0x2a14a2=_0x357a('0x4e');return db['UserProfileSection'][_0x357a('0x49')]({'where':{'name':_0x2a14a2,'userProfileId':_0x4c7214[_0x357a('0x4f')]},'raw':!![]})['then'](function(_0x254fd2){if(_0x254fd2&&_0x254fd2[_0x357a('0x50')]===0x0){return db['UserProfileResource'][_0x357a('0x51')]({'name':_0x376f7f['name'],'resourceId':_0x376f7f['id'],'type':_0x254fd2[_0x357a('0x2a')],'sectionId':_0x254fd2['id']},{})['then'](function(){return _0x5ac451;});}else{return _0x5ac451;}})[_0x357a('0x4a')](function(_0x4a2aae){logger[_0x357a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a2aae);throw _0x4a2aae;});}return _0x5ac451;})['then'](respondWithResult(_0xecc8e8,0xc9))[_0x357a('0x4a')](handleError(_0xecc8e8,null));};exports[_0x357a('0x23')]=function(_0x3e64e4,_0x14520c){if(_0x3e64e4[_0x357a('0x4b')]['id']){delete _0x3e64e4[_0x357a('0x4b')]['id'];}return db['Template'][_0x357a('0x49')]({'where':{'id':_0x3e64e4[_0x357a('0x46')]['id']}})[_0x357a('0x24')](handleEntityNotFound(_0x14520c,null))[_0x357a('0x24')](saveUpdates(_0x3e64e4[_0x357a('0x4b')],null))['then'](respondWithResult(_0x14520c,null))['catch'](handleError(_0x14520c,null));};exports['destroy']=function(_0x3280de,_0x218445){return db['Template'][_0x357a('0x49')]({'where':{'id':_0x3280de[_0x357a('0x46')]['id']}})['then'](handleEntityNotFound(_0x218445,null))[_0x357a('0x24')](removeEntity(_0x218445,null))['catch'](handleError(_0x218445,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 83a5e6e..6bbe96e 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 _0x0d72=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x3fba22,_0x2cd77f){var _0x2a1f35=function(_0x477aa1){while(--_0x477aa1){_0x3fba22['push'](_0x3fba22['shift']());}};_0x2a1f35(++_0x2cd77f);}(_0x0d72,0x1ba));var _0x20d7=function(_0x5b8296,_0x3c54ae){_0x5b8296=_0x5b8296-0x0;var _0x1856af=_0x0d72[_0x5b8296];return _0x1856af;};'use strict';var _=require(_0x20d7('0x0'));var util=require(_0x20d7('0x1'));var logger=require(_0x20d7('0x2'))(_0x20d7('0x3'));var moment=require(_0x20d7('0x4'));var BPromise=require(_0x20d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20d7('0x6'));var rimraf=require('rimraf');var config=require(_0x20d7('0x7'));var attributes=require(_0x20d7('0x8'));module[_0x20d7('0x9')]=function(_0x230fd8,_0x587509){return _0x230fd8[_0x20d7('0xa')](_0x20d7('0xb'),attributes,{'tableName':_0x20d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_templates','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x4fa373,_0x5b20fe){var _0x58e1b9=function(_0x34f3db){while(--_0x34f3db){_0x4fa373['push'](_0x4fa373['shift']());}};_0x58e1b9(++_0x5b20fe);}(_0x326f,0xd1));var _0xf326=function(_0x1b9a39,_0x44008c){_0x1b9a39=_0x1b9a39-0x0;var _0x450c27=_0x326f[_0x1b9a39];return _0x450c27;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('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 47b6087..c8581b3 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 _0x71b5=['Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','GetTemplate','Template','options','where','limit','include','map','model','attributes','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1358ac,_0x14c554){var _0xfc8425=function(_0x57de8d){while(--_0x57de8d){_0x1358ac['push'](_0x1358ac['shift']());}};_0xfc8425(++_0x14c554);}(_0x71b5,0x133));var _0x571b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x571b('0x0'));var moment=require(_0x571b('0x1'));var BPromise=require(_0x571b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x571b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x571b('0x4'));var logger=require('../../config/logger')(_0x571b('0x5'));var config=require('../../config/environment');var jayson=require(_0x571b('0x6'));var client=jayson[_0x571b('0x7')][_0x571b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c0c7b,_0x4640fc,_0x35b087){return new BPromise(function(_0x56017c,_0x9ad43){return client[_0x571b('0x9')](_0x1c0c7b,_0x35b087)[_0x571b('0xa')](function(_0x389332){logger[_0x571b('0xb')](_0x571b('0xc'),_0x4640fc,_0x571b('0xd'));logger[_0x571b('0xe')](_0x571b('0xf'),_0x4640fc,'request\x20sent',JSON[_0x571b('0x10')](_0x389332));if(_0x389332[_0x571b('0x11')]){if(_0x389332[_0x571b('0x11')]['code']===0x1f4){logger['error'](_0x571b('0xc'),_0x4640fc,_0x389332[_0x571b('0x11')][_0x571b('0x12')]);return _0x9ad43(_0x389332[_0x571b('0x11')]['message']);}logger['error'](_0x571b('0xc'),_0x4640fc,_0x389332[_0x571b('0x11')][_0x571b('0x12')]);return _0x56017c(_0x389332['error'][_0x571b('0x12')]);}else{logger[_0x571b('0xb')](_0x571b('0xc'),_0x4640fc,_0x571b('0xd'));_0x56017c(_0x389332['result']['message']);}})['catch'](function(_0x958e75){logger[_0x571b('0x11')](_0x571b('0xc'),_0x4640fc,_0x958e75);_0x9ad43(_0x958e75);});});}exports[_0x571b('0x13')]=function(_0x4e289b){var _0xe92550=this;return new Promise(function(_0x5dcba3,_0x45055a){return db[_0x571b('0x14')]['findAll']({'raw':_0x4e289b[_0x571b('0x15')]?_0x4e289b[_0x571b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4e289b[_0x571b('0x15')]?_0x4e289b[_0x571b('0x15')][_0x571b('0x16')]||null:null,'attributes':_0x4e289b[_0x571b('0x15')]?_0x4e289b[_0x571b('0x15')]['attributes']||null:null,'limit':_0x4e289b[_0x571b('0x15')]?_0x4e289b[_0x571b('0x15')][_0x571b('0x17')]||null:null,'include':_0x4e289b[_0x571b('0x15')]?_0x4e289b[_0x571b('0x15')][_0x571b('0x18')]?_[_0x571b('0x19')](_0x4e289b[_0x571b('0x15')][_0x571b('0x18')],function(_0x35ec09){return{'model':db[_0x35ec09[_0x571b('0x1a')]],'as':_0x35ec09['as'],'attributes':_0x35ec09[_0x571b('0x1b')],'include':_0x35ec09[_0x571b('0x18')]?_[_0x571b('0x19')](_0x35ec09[_0x571b('0x18')],function(_0x3e64fe){return{'model':db[_0x3e64fe['model']],'as':_0x3e64fe['as'],'attributes':_0x3e64fe['attributes'],'include':_0x3e64fe[_0x571b('0x18')]?_[_0x571b('0x19')](_0x3e64fe[_0x571b('0x18')],function(_0x1c6b0a){return{'model':db[_0x1c6b0a['model']],'as':_0x1c6b0a['as'],'attributes':_0x1c6b0a[_0x571b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x571b('0xa')](function(_0xfe6db2){logger['info'](_0x571b('0x13'),_0x4e289b);logger['debug'](_0x571b('0x13'),_0x4e289b,JSON['stringify'](_0xfe6db2));_0x5dcba3(_0xfe6db2);})[_0x571b('0x1c')](function(_0x2a2f62){logger[_0x571b('0x11')](_0x571b('0x13'),_0x2a2f62[_0x571b('0x12')],_0x4e289b);_0x45055a(_0xe92550['error'](0x1f4,_0x2a2f62[_0x571b('0x12')]));});});}; \ No newline at end of file +var _0x5640=['request','then','info','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','map','model','include','GetTemplate','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x29857d,_0x2216d7){var _0xb53777=function(_0xff328){while(--_0xff328){_0x29857d['push'](_0x29857d['shift']());}};_0xb53777(++_0x2216d7);}(_0x5640,0x1b9));var _0x0564=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5640[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x0564('0x0'));var moment=require('moment');var BPromise=require(_0x0564('0x1'));var rs=require(_0x0564('0x2'));var fs=require('fs');var Redis=require(_0x0564('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0564('0x4'));var logger=require(_0x0564('0x5'))(_0x0564('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a078f,_0x44b08b,_0x1d2006){return new BPromise(function(_0x69532a,_0x58d616){return client[_0x0564('0x7')](_0x3a078f,_0x1d2006)[_0x0564('0x8')](function(_0x26b32b){logger[_0x0564('0x9')]('Template,\x20%s,\x20%s',_0x44b08b,'request\x20sent');logger[_0x0564('0xa')](_0x0564('0xb'),_0x44b08b,_0x0564('0xc'),JSON[_0x0564('0xd')](_0x26b32b));if(_0x26b32b[_0x0564('0xe')]){if(_0x26b32b[_0x0564('0xe')]['code']===0x1f4){logger[_0x0564('0xe')](_0x0564('0xf'),_0x44b08b,_0x26b32b[_0x0564('0xe')]['message']);return _0x58d616(_0x26b32b[_0x0564('0xe')][_0x0564('0x10')]);}logger['error']('Template,\x20%s,\x20%s',_0x44b08b,_0x26b32b[_0x0564('0xe')][_0x0564('0x10')]);return _0x69532a(_0x26b32b[_0x0564('0xe')][_0x0564('0x10')]);}else{logger[_0x0564('0x9')]('Template,\x20%s,\x20%s',_0x44b08b,'request\x20sent');_0x69532a(_0x26b32b[_0x0564('0x11')][_0x0564('0x10')]);}})['catch'](function(_0x40c281){logger[_0x0564('0xe')](_0x0564('0xf'),_0x44b08b,_0x40c281);_0x58d616(_0x40c281);});});}exports['GetTemplate']=function(_0x3cd99e){var _0x32c52e=this;return new Promise(function(_0x3636a6,_0x13d208){return db['Template'][_0x0564('0x12')]({'raw':_0x3cd99e[_0x0564('0x13')]?_0x3cd99e[_0x0564('0x13')][_0x0564('0x14')]===undefined?!![]:![]:!![],'where':_0x3cd99e[_0x0564('0x13')]?_0x3cd99e['options'][_0x0564('0x15')]||null:null,'attributes':_0x3cd99e['options']?_0x3cd99e['options'][_0x0564('0x16')]||null:null,'limit':_0x3cd99e[_0x0564('0x13')]?_0x3cd99e[_0x0564('0x13')][_0x0564('0x17')]||null:null,'include':_0x3cd99e['options']?_0x3cd99e[_0x0564('0x13')]['include']?_[_0x0564('0x18')](_0x3cd99e[_0x0564('0x13')]['include'],function(_0x24c1f0){return{'model':db[_0x24c1f0[_0x0564('0x19')]],'as':_0x24c1f0['as'],'attributes':_0x24c1f0[_0x0564('0x16')],'include':_0x24c1f0[_0x0564('0x1a')]?_[_0x0564('0x18')](_0x24c1f0[_0x0564('0x1a')],function(_0x26125c){return{'model':db[_0x26125c[_0x0564('0x19')]],'as':_0x26125c['as'],'attributes':_0x26125c[_0x0564('0x16')],'include':_0x26125c[_0x0564('0x1a')]?_[_0x0564('0x18')](_0x26125c['include'],function(_0x485750){return{'model':db[_0x485750[_0x0564('0x19')]],'as':_0x485750['as'],'attributes':_0x485750[_0x0564('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4628fd){logger['info'](_0x0564('0x1b'),_0x3cd99e);logger['debug'](_0x0564('0x1b'),_0x3cd99e,JSON[_0x0564('0xd')](_0x4628fd));_0x3636a6(_0x4628fd);})['catch'](function(_0x35c725){logger[_0x0564('0xe')]('GetTemplate',_0x35c725[_0x0564('0x10')],_0x3cd99e);_0x13d208(_0x32c52e[_0x0564('0xe')](0x1f4,_0x35c725[_0x0564('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 13cf7f3..da7af96 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 _0xb105=['destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','get','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','put','update','delete'];(function(_0x3ca14c,_0x2368c6){var _0x19cc35=function(_0x2dd5aa){while(--_0x2dd5aa){_0x3ca14c['push'](_0x3ca14c['shift']());}};_0x19cc35(++_0x2368c6);}(_0xb105,0x120));var _0x5b10=function(_0x3b6b26,_0x10c662){_0x3b6b26=_0x3b6b26-0x0;var _0x166398=_0xb105[_0x3b6b26];return _0x166398;};'use strict';var multer=require('multer');var util=require(_0x5b10('0x0'));var path=require(_0x5b10('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b10('0x2')]();var auth=require(_0x5b10('0x3'));var interaction=require(_0x5b10('0x4'));var config=require(_0x5b10('0x5'));var controller=require(_0x5b10('0x6'));router['get']('/',auth[_0x5b10('0x7')](),controller[_0x5b10('0x8')]);router['get'](_0x5b10('0x9'),auth[_0x5b10('0x7')](),controller[_0x5b10('0xa')]);router['get'](_0x5b10('0xb'),auth[_0x5b10('0x7')](),controller[_0x5b10('0xc')]);router[_0x5b10('0xd')](_0x5b10('0xe'),auth[_0x5b10('0x7')](),controller[_0x5b10('0xf')]);router['get'](_0x5b10('0x10'),auth[_0x5b10('0x7')](),controller[_0x5b10('0x11')]);router[_0x5b10('0x12')]('/',auth[_0x5b10('0x7')](),controller[_0x5b10('0x13')]);router[_0x5b10('0x12')](_0x5b10('0xb'),auth['isAuthenticated'](),controller[_0x5b10('0x14')]);router[_0x5b10('0x12')](_0x5b10('0xe'),auth[_0x5b10('0x7')](),controller['addAnyCondition']);router[_0x5b10('0x12')](_0x5b10('0x10'),auth[_0x5b10('0x7')](),controller['addAction']);router[_0x5b10('0x15')](_0x5b10('0x9'),auth[_0x5b10('0x7')](),controller[_0x5b10('0x16')]);router[_0x5b10('0x17')](_0x5b10('0x9'),auth[_0x5b10('0x7')](),controller[_0x5b10('0x18')]);module[_0x5b10('0x19')]=router; \ No newline at end of file +var _0x5734=['get','/:id','/:id/all_conditions','isAuthenticated','post','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./trigger.controller','index'];(function(_0x17b47d,_0x3136fb){var _0x3c643e=function(_0x5e029a){while(--_0x5e029a){_0x17b47d['push'](_0x17b47d['shift']());}};_0x3c643e(++_0x3136fb);}(_0x5734,0xbe));var _0x4573=function(_0x126121,_0x35e290){_0x126121=_0x126121-0x0;var _0x57d413=_0x5734[_0x126121];return _0x57d413;};'use strict';var multer=require('multer');var util=require(_0x4573('0x0'));var path=require(_0x4573('0x1'));var timeout=require(_0x4573('0x2'));var express=require('express');var router=express[_0x4573('0x3')]();var auth=require(_0x4573('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4573('0x5'));var controller=require(_0x4573('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4573('0x7')]);router[_0x4573('0x8')](_0x4573('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4573('0x8')](_0x4573('0xa'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x4573('0x8')]('/:id/any_conditions',auth[_0x4573('0xb')](),controller['getAnyConditions']);router[_0x4573('0x8')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x4573('0xb')](),controller['create']);router[_0x4573('0xc')](_0x4573('0xa'),auth[_0x4573('0xb')](),controller[_0x4573('0xd')]);router['post'](_0x4573('0xe'),auth[_0x4573('0xb')](),controller[_0x4573('0xf')]);router[_0x4573('0xc')]('/:id/actions',auth[_0x4573('0xb')](),controller[_0x4573('0x10')]);router[_0x4573('0x11')](_0x4573('0x9'),auth[_0x4573('0xb')](),controller[_0x4573('0x12')]);router[_0x4573('0x13')](_0x4573('0x9'),auth[_0x4573('0xb')](),controller[_0x4573('0x14')]);module[_0x4573('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ec96216..f50a181 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 _0x1167=['sequelize','STRING'];(function(_0xbbc5a8,_0x503c3a){var _0x2957d6=function(_0x3de5ce){while(--_0x3de5ce){_0xbbc5a8['push'](_0xbbc5a8['shift']());}};_0x2957d6(++_0x503c3a);}(_0x1167,0x144));var _0x7116=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1167[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x7116('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7116('0x1')]},'description':{'type':Sequelize[_0x7116('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xace2=['STRING'];(function(_0x104b47,_0x491eff){var _0x34a3f1=function(_0x467a15){while(--_0x467a15){_0x104b47['push'](_0x104b47['shift']());}};_0x34a3f1(++_0x491eff);}(_0xace2,0x12f));var _0x2ace=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0xace2[_0x7ad6cb];return _0x22a0ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2ace('0x0')]},'channel':{'type':Sequelize[_0x2ace('0x0')]},'description':{'type':Sequelize[_0x2ace('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3f5957c..5585a80 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 _0x9819=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','find','params','destroy','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','length','sort','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','filter','merge'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9819,0x18a));var _0x9981=function(_0x56226a,_0x4388df){_0x56226a=_0x56226a-0x0;var _0x2e2e3a=_0x9819[_0x56226a];return _0x2e2e3a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9981('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9981('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9981('0x2'));var moment=require(_0x9981('0x3'));var BPromise=require(_0x9981('0x4'));var Mustache=require(_0x9981('0x5'));var util=require(_0x9981('0x6'));var path=require(_0x9981('0x7'));var sox=require(_0x9981('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9981('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9981('0xa'));var querystring=require('querystring');var Papa=require(_0x9981('0xb'));var Redis=require(_0x9981('0xc'));var authService=require(_0x9981('0xd'));var qs=require(_0x9981('0xe'));var as=require(_0x9981('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9981('0x10'))(_0x9981('0x11'));var utils=require(_0x9981('0x12'));var config=require(_0x9981('0x13'));var db=require(_0x9981('0x14'))['db'];function respondWithStatusCode(_0x89e621,_0x437ec0){_0x437ec0=_0x437ec0||0xcc;return function(_0x41530a){if(_0x41530a){return _0x89e621[_0x9981('0x15')](_0x437ec0);}return _0x89e621[_0x9981('0x16')](_0x437ec0)[_0x9981('0x17')]();};}function respondWithResult(_0xc377c7,_0xbb7c7d){_0xbb7c7d=_0xbb7c7d||0xc8;return function(_0xbc68af){if(_0xbc68af){return _0xc377c7[_0x9981('0x16')](_0xbb7c7d)[_0x9981('0x18')](_0xbc68af);}};}function respondWithFilteredResult(_0x173ee0,_0x1cb0d0){return function(_0x39a49a){if(_0x39a49a){var _0x55f4e1=_0x39a49a[_0x9981('0x19')],_0x2bd8e1=_0x1cb0d0[_0x9981('0x1a')],_0x43d97a=_0x1cb0d0[_0x9981('0x1a')]+_0x1cb0d0[_0x9981('0x1b')],_0x1d9ea6;if(_0x43d97a>=_0x55f4e1){_0x43d97a=_0x55f4e1;_0x1d9ea6=0xc8;}else{_0x1d9ea6=0xce;}_0x173ee0['status'](_0x1d9ea6);return _0x173ee0[_0x9981('0x1c')](_0x9981('0x1d'),_0x2bd8e1+'-'+_0x43d97a+'/'+_0x55f4e1)[_0x9981('0x18')](_0x39a49a);}return null;};}function patchUpdates(_0x2444ba){return function(_0x4433c0){try{jsonpatch[_0x9981('0x1e')](_0x4433c0,_0x2444ba,!![]);}catch(_0x4a38f9){return BPromise[_0x9981('0x1f')](_0x4a38f9);}return _0x4433c0[_0x9981('0x20')]();};}function saveUpdates(_0x86d92f,_0x2bffde){return function(_0x24435e){if(_0x24435e){return _0x24435e[_0x9981('0x21')](_0x86d92f)[_0x9981('0x22')](function(_0x3efd9b){return _0x3efd9b;});}return null;};}function removeEntity(_0x1ba067,_0xc0ba35){return function(_0x223aec){if(_0x223aec){return _0x223aec['destroy']()['then'](function(){var _0x377cf9=_0x223aec[_0x9981('0x23')]({'plain':!![]});var _0x2604f2=_0x9981('0x24');return db[_0x9981('0x25')]['destroy']({'where':{'type':_0x2604f2,'resourceId':_0x377cf9['id']}})['then'](function(){return _0x223aec;});})['then'](function(){_0x1ba067['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ebe09,_0x15520b){return function(_0x5673f4){if(!_0x5673f4){_0x5ebe09[_0x9981('0x15')](0x194);}return _0x5673f4;};}function handleError(_0x19e78b,_0x1f0826){_0x1f0826=_0x1f0826||0x1f4;return function(_0x76f522){logger[_0x9981('0x26')](_0x76f522[_0x9981('0x27')]);if(_0x76f522[_0x9981('0x28')]){delete _0x76f522['name'];}_0x19e78b[_0x9981('0x16')](_0x1f0826)[_0x9981('0x29')](_0x76f522);};}exports[_0x9981('0x2a')]=function(_0x58172f,_0xbf9018){var _0x2d80de={},_0x1a7bbf={},_0xeb771d={'count':0x0,'rows':[]};var _0x12ac21=_[_0x9981('0x2b')](db[_0x9981('0x2c')][_0x9981('0x2d')],function(_0x2968ef){return{'name':_0x2968ef['fieldName'],'type':_0x2968ef[_0x9981('0x2e')][_0x9981('0x2f')]};});_0x1a7bbf[_0x9981('0x30')]=_[_0x9981('0x2b')](_0x12ac21,_0x9981('0x28'));_0x1a7bbf[_0x9981('0x31')]=_[_0x9981('0x32')](_0x58172f['query']);_0x1a7bbf['filters']=_['intersection'](_0x1a7bbf['model'],_0x1a7bbf[_0x9981('0x31')]);_0x2d80de[_0x9981('0x33')]=_[_0x9981('0x34')](_0x1a7bbf[_0x9981('0x30')],qs[_0x9981('0x35')](_0x58172f[_0x9981('0x31')][_0x9981('0x35')]));_0x2d80de[_0x9981('0x33')]=_0x2d80de[_0x9981('0x33')]['length']?_0x2d80de['attributes']:_0x1a7bbf[_0x9981('0x30')];if(!_0x58172f[_0x9981('0x31')][_0x9981('0x36')](_0x9981('0x37'))){_0x2d80de[_0x9981('0x1b')]=qs[_0x9981('0x1b')](_0x58172f[_0x9981('0x31')]['limit']);_0x2d80de[_0x9981('0x1a')]=qs['offset'](_0x58172f[_0x9981('0x31')]['offset']);}_0x2d80de[_0x9981('0x38')]=qs['sort'](_0x58172f[_0x9981('0x31')]['sort']);_0x2d80de[_0x9981('0x39')]=qs[_0x9981('0x3a')](_['pick'](_0x58172f[_0x9981('0x31')],_0x1a7bbf[_0x9981('0x3a')]),_0x12ac21);if(_0x58172f[_0x9981('0x31')][_0x9981('0x3b')]){_0x2d80de[_0x9981('0x39')]=_[_0x9981('0x3c')](_0x2d80de[_0x9981('0x39')],{'$or':_[_0x9981('0x2b')](_0x12ac21,function(_0x552e86){if(_0x552e86[_0x9981('0x2e')]!==_0x9981('0x3d')){var _0x24962d={};_0x24962d[_0x552e86[_0x9981('0x28')]]={'$like':'%'+_0x58172f['query'][_0x9981('0x3b')]+'%'};return _0x24962d;}})});}_0x2d80de=_[_0x9981('0x3c')]({},_0x2d80de,_0x58172f[_0x9981('0x3e')]);var _0x1298d3={'where':_0x2d80de[_0x9981('0x39')]};return db[_0x9981('0x2c')][_0x9981('0x19')](_0x1298d3)[_0x9981('0x22')](function(_0x3a7aa9){_0xeb771d[_0x9981('0x19')]=_0x3a7aa9;if(_0x58172f[_0x9981('0x31')][_0x9981('0x3f')]){_0x2d80de[_0x9981('0x40')]=[{'all':!![]}];}return db[_0x9981('0x2c')][_0x9981('0x41')](_0x2d80de);})[_0x9981('0x22')](function(_0x50824b){_0xeb771d[_0x9981('0x42')]=_0x50824b;return _0xeb771d;})[_0x9981('0x22')](respondWithFilteredResult(_0xbf9018,_0x2d80de))[_0x9981('0x43')](handleError(_0xbf9018,null));};exports[_0x9981('0x44')]=function(_0x580ed3,_0x45611f){var _0x2c301e={'raw':![],'where':{'id':_0x580ed3['params']['id']}},_0x2a2288={};_0x2a2288['model']=_['keys'](db[_0x9981('0x2c')][_0x9981('0x2d')]);_0x2a2288[_0x9981('0x31')]=_['keys'](_0x580ed3[_0x9981('0x31')]);_0x2a2288[_0x9981('0x3a')]=_[_0x9981('0x34')](_0x2a2288[_0x9981('0x30')],_0x2a2288[_0x9981('0x31')]);_0x2c301e[_0x9981('0x33')]=_[_0x9981('0x34')](_0x2a2288['model'],qs['fields'](_0x580ed3['query']['fields']));_0x2c301e[_0x9981('0x33')]=_0x2c301e[_0x9981('0x33')]['length']?_0x2c301e[_0x9981('0x33')]:_0x2a2288[_0x9981('0x30')];if(_0x580ed3['query'][_0x9981('0x3f')]){_0x2c301e[_0x9981('0x40')]=[{'all':!![]}];}_0x2c301e=_[_0x9981('0x3c')]({},_0x2c301e,_0x580ed3[_0x9981('0x3e')]);return db[_0x9981('0x2c')]['find'](_0x2c301e)[_0x9981('0x22')](handleEntityNotFound(_0x45611f,null))[_0x9981('0x22')](respondWithResult(_0x45611f,null))[_0x9981('0x43')](handleError(_0x45611f,null));};exports[_0x9981('0x45')]=function(_0x421d11,_0x461233){return db['Trigger'][_0x9981('0x45')](_0x421d11[_0x9981('0x46')],{})['then'](function(_0x58cc35){var _0x281d63=_0x421d11[_0x9981('0x47')][_0x9981('0x23')]({'plain':!![]});if(!_0x281d63)throw new Error(_0x9981('0x48'));if(_0x281d63[_0x9981('0x49')]==='user'){var _0x56e23e=_0x58cc35['get']({'plain':!![]});var _0x5853bc='Triggers';return db[_0x9981('0x4a')]['find']({'where':{'name':_0x5853bc,'userProfileId':_0x281d63[_0x9981('0x4b')]},'raw':!![]})[_0x9981('0x22')](function(_0x4da9a0){if(_0x4da9a0&&_0x4da9a0['autoAssociation']===0x0){return db[_0x9981('0x25')][_0x9981('0x45')]({'name':_0x56e23e[_0x9981('0x28')],'resourceId':_0x56e23e['id'],'type':_0x4da9a0[_0x9981('0x28')],'sectionId':_0x4da9a0['id']},{})[_0x9981('0x22')](function(){return _0x58cc35;});}else{return _0x58cc35;}})[_0x9981('0x43')](function(_0x110c78){logger[_0x9981('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x110c78);throw _0x110c78;});}return _0x58cc35;})[_0x9981('0x22')](respondWithResult(_0x461233,0xc9))[_0x9981('0x43')](handleError(_0x461233,null));};exports[_0x9981('0x21')]=function(_0xcf8619,_0x5d37fc){if(_0xcf8619[_0x9981('0x46')]['id']){delete _0xcf8619[_0x9981('0x46')]['id'];}return db[_0x9981('0x2c')][_0x9981('0x4c')]({'where':{'id':_0xcf8619[_0x9981('0x4d')]['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x5d37fc,null))[_0x9981('0x22')](saveUpdates(_0xcf8619[_0x9981('0x46')],null))[_0x9981('0x22')](respondWithResult(_0x5d37fc,null))[_0x9981('0x43')](handleError(_0x5d37fc,null));};exports[_0x9981('0x4e')]=function(_0x279f6f,_0x3b7852){return db['Trigger']['find']({'where':{'id':_0x279f6f[_0x9981('0x4d')]['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x3b7852,null))[_0x9981('0x22')](removeEntity(_0x3b7852,null))['catch'](handleError(_0x3b7852,null));};exports[_0x9981('0x4f')]=function(_0xfee9f3,_0x262088,_0x1f0dfb){if(_0xfee9f3[_0x9981('0x46')]['id']){delete _0xfee9f3[_0x9981('0x46')]['id'];}return db[_0x9981('0x2c')][_0x9981('0x4c')]({'where':{'id':_0xfee9f3[_0x9981('0x4d')]['id']}})['then'](handleEntityNotFound(_0x262088,null))['then'](function(_0x3ec80){if(_0x3ec80){_0xfee9f3['body']['TriggerAllId']=_0x3ec80['id'];return db[_0x9981('0x50')]['create'](_0xfee9f3[_0x9981('0x46')]);}})['then'](respondWithResult(_0x262088,null))[_0x9981('0x43')](handleError(_0x262088,null));};exports[_0x9981('0x51')]=function(_0x4a7532,_0x3edbce,_0x4148d2){if(_0x4a7532[_0x9981('0x46')]['id']){delete _0x4a7532['body']['id'];}return db[_0x9981('0x2c')]['find']({'where':{'id':_0x4a7532[_0x9981('0x4d')]['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x3edbce,null))[_0x9981('0x22')](function(_0x24ede1){if(_0x24ede1){_0x4a7532[_0x9981('0x46')]['TriggerAnyId']=_0x24ede1['id'];return db[_0x9981('0x50')][_0x9981('0x45')](_0x4a7532['body']);}})['then'](respondWithResult(_0x3edbce,null))[_0x9981('0x43')](handleError(_0x3edbce,null));};exports[_0x9981('0x52')]=function(_0x3b3421,_0x52e084,_0x14a8cd){var _0x4a40c3={};var _0x1933dd={};var _0x48b4ae;var _0xc16e7c;return db[_0x9981('0x2c')][_0x9981('0x53')]({'where':{'id':_0x3b3421[_0x9981('0x4d')]['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x52e084,null))[_0x9981('0x22')](function(_0x52a49e){if(_0x52a49e){_0x48b4ae=_0x52a49e;_0x1933dd['model']=_[_0x9981('0x32')](db[_0x9981('0x50')]['rawAttributes']);_0x1933dd[_0x9981('0x31')]=_[_0x9981('0x32')](_0x3b3421[_0x9981('0x31')]);_0x1933dd[_0x9981('0x3a')]=_[_0x9981('0x34')](_0x1933dd[_0x9981('0x30')],_0x1933dd[_0x9981('0x31')]);_0x4a40c3['attributes']=_[_0x9981('0x34')](_0x1933dd[_0x9981('0x30')],qs[_0x9981('0x35')](_0x3b3421[_0x9981('0x31')][_0x9981('0x35')]));_0x4a40c3[_0x9981('0x33')]=_0x4a40c3[_0x9981('0x33')][_0x9981('0x54')]?_0x4a40c3['attributes']:_0x1933dd[_0x9981('0x30')];_0x4a40c3[_0x9981('0x38')]=qs[_0x9981('0x55')](_0x3b3421[_0x9981('0x31')]['sort']);_0x4a40c3[_0x9981('0x39')]=qs[_0x9981('0x3a')](_[_0x9981('0x56')](_0x3b3421['query'],_0x1933dd[_0x9981('0x3a')]));if(_0x3b3421[_0x9981('0x31')][_0x9981('0x3b')]){_0x4a40c3[_0x9981('0x39')]=_[_0x9981('0x3c')](_0x4a40c3[_0x9981('0x39')],{'$or':_['map'](_0x4a40c3[_0x9981('0x33')],function(_0x144e4e){var _0x43bddb={};_0x43bddb[_0x144e4e]={'$like':'%'+_0x3b3421['query'][_0x9981('0x3b')]+'%'};return _0x43bddb;})});}_0x4a40c3=_[_0x9981('0x3c')]({},_0x4a40c3,_0x3b3421[_0x9981('0x3e')]);return _0x48b4ae[_0x9981('0x52')](_0x4a40c3);}})['then'](function(_0x2b2c6f){if(_0x2b2c6f){_0xc16e7c=_0x2b2c6f[_0x9981('0x54')];if(!_0x3b3421[_0x9981('0x31')][_0x9981('0x36')](_0x9981('0x37'))){_0x4a40c3['limit']=qs[_0x9981('0x1b')](_0x3b3421[_0x9981('0x31')][_0x9981('0x1b')]);_0x4a40c3[_0x9981('0x1a')]=qs[_0x9981('0x1a')](_0x3b3421['query'][_0x9981('0x1a')]);}return _0x48b4ae[_0x9981('0x52')](_0x4a40c3);}})[_0x9981('0x22')](function(_0x5877ef){if(_0x5877ef){return _0x5877ef?{'count':_0xc16e7c,'rows':_0x5877ef}:null;}})['then'](respondWithResult(_0x52e084,null))[_0x9981('0x43')](handleError(_0x52e084,null));};exports[_0x9981('0x57')]=function(_0xd53603,_0x3eca52,_0x279b71){var _0x5b8446={};var _0x4e9f04={};var _0x18326c;var _0x7b788e;return db['Trigger'][_0x9981('0x53')]({'where':{'id':_0xd53603[_0x9981('0x4d')]['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x3eca52,null))[_0x9981('0x22')](function(_0x2bb4e7){if(_0x2bb4e7){_0x18326c=_0x2bb4e7;_0x4e9f04[_0x9981('0x30')]=_['keys'](db[_0x9981('0x50')]['rawAttributes']);_0x4e9f04[_0x9981('0x31')]=_['keys'](_0xd53603['query']);_0x4e9f04[_0x9981('0x3a')]=_[_0x9981('0x34')](_0x4e9f04['model'],_0x4e9f04[_0x9981('0x31')]);_0x5b8446['attributes']=_[_0x9981('0x34')](_0x4e9f04[_0x9981('0x30')],qs[_0x9981('0x35')](_0xd53603[_0x9981('0x31')][_0x9981('0x35')]));_0x5b8446['attributes']=_0x5b8446['attributes'][_0x9981('0x54')]?_0x5b8446['attributes']:_0x4e9f04[_0x9981('0x30')];_0x5b8446[_0x9981('0x38')]=qs['sort'](_0xd53603[_0x9981('0x31')][_0x9981('0x55')]);_0x5b8446[_0x9981('0x39')]=qs[_0x9981('0x3a')](_[_0x9981('0x56')](_0xd53603[_0x9981('0x31')],_0x4e9f04[_0x9981('0x3a')]));if(_0xd53603[_0x9981('0x31')][_0x9981('0x3b')]){_0x5b8446['where']=_[_0x9981('0x3c')](_0x5b8446[_0x9981('0x39')],{'$or':_[_0x9981('0x2b')](_0x5b8446['attributes'],function(_0x47d6bc){var _0x466235={};_0x466235[_0x47d6bc]={'$like':'%'+_0xd53603[_0x9981('0x31')][_0x9981('0x3b')]+'%'};return _0x466235;})});}_0x5b8446=_[_0x9981('0x3c')]({},_0x5b8446,_0xd53603[_0x9981('0x3e')]);return _0x18326c[_0x9981('0x57')](_0x5b8446);}})[_0x9981('0x22')](function(_0x106ef4){if(_0x106ef4){_0x7b788e=_0x106ef4['length'];if(!_0xd53603[_0x9981('0x31')][_0x9981('0x36')]('nolimit')){_0x5b8446['limit']=qs['limit'](_0xd53603[_0x9981('0x31')][_0x9981('0x1b')]);_0x5b8446['offset']=qs[_0x9981('0x1a')](_0xd53603[_0x9981('0x31')][_0x9981('0x1a')]);}return _0x18326c[_0x9981('0x57')](_0x5b8446);}})['then'](function(_0x3dcd5d){if(_0x3dcd5d){return _0x3dcd5d?{'count':_0x7b788e,'rows':_0x3dcd5d}:null;}})[_0x9981('0x22')](respondWithResult(_0x3eca52,null))['catch'](handleError(_0x3eca52,null));};exports['addAction']=function(_0x19cce8,_0x1eb4a6,_0x47bb45){if(_0x19cce8[_0x9981('0x46')]['id']){delete _0x19cce8[_0x9981('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x19cce8[_0x9981('0x4d')]['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x1eb4a6,null))[_0x9981('0x22')](function(_0x367f00){if(_0x367f00){_0x19cce8['body'][_0x9981('0x58')]=_0x367f00['id'];return db[_0x9981('0x59')][_0x9981('0x45')](_0x19cce8[_0x9981('0x46')]);}})[_0x9981('0x22')](respondWithResult(_0x1eb4a6,null))[_0x9981('0x43')](handleError(_0x1eb4a6,null));};exports[_0x9981('0x5a')]=function(_0x858ce3,_0x1111ad,_0x2bca12){var _0x2ea6db={};var _0x494b75={};var _0x3b18c5;var _0x2a7055;return db[_0x9981('0x2c')][_0x9981('0x53')]({'where':{'id':_0x858ce3['params']['id']}})[_0x9981('0x22')](handleEntityNotFound(_0x1111ad,null))[_0x9981('0x22')](function(_0x3fbc8b){if(_0x3fbc8b){_0x3b18c5=_0x3fbc8b;_0x494b75[_0x9981('0x30')]=_[_0x9981('0x32')](db['Action'][_0x9981('0x2d')]);_0x494b75['query']=_[_0x9981('0x32')](_0x858ce3[_0x9981('0x31')]);_0x494b75[_0x9981('0x3a')]=_[_0x9981('0x34')](_0x494b75['model'],_0x494b75[_0x9981('0x31')]);_0x2ea6db[_0x9981('0x33')]=_['intersection'](_0x494b75[_0x9981('0x30')],qs[_0x9981('0x35')](_0x858ce3[_0x9981('0x31')][_0x9981('0x35')]));_0x2ea6db['attributes']=_0x2ea6db['attributes'][_0x9981('0x54')]?_0x2ea6db[_0x9981('0x33')]:_0x494b75[_0x9981('0x30')];_0x2ea6db[_0x9981('0x38')]=qs['sort'](_0x858ce3[_0x9981('0x31')][_0x9981('0x55')]);_0x2ea6db[_0x9981('0x39')]=qs[_0x9981('0x3a')](_[_0x9981('0x56')](_0x858ce3[_0x9981('0x31')],_0x494b75[_0x9981('0x3a')]));if(_0x858ce3['query'][_0x9981('0x3b')]){_0x2ea6db[_0x9981('0x39')]=_[_0x9981('0x3c')](_0x2ea6db[_0x9981('0x39')],{'$or':_[_0x9981('0x2b')](_0x2ea6db[_0x9981('0x33')],function(_0x3957df){var _0x881077={};_0x881077[_0x3957df]={'$like':'%'+_0x858ce3[_0x9981('0x31')][_0x9981('0x3b')]+'%'};return _0x881077;})});}_0x2ea6db=_[_0x9981('0x3c')]({},_0x2ea6db,_0x858ce3[_0x9981('0x3e')]);return _0x3b18c5[_0x9981('0x5a')](_0x2ea6db);}})[_0x9981('0x22')](function(_0x529719){if(_0x529719){_0x2a7055=_0x529719['length'];if(!_0x858ce3[_0x9981('0x31')][_0x9981('0x36')](_0x9981('0x37'))){_0x2ea6db[_0x9981('0x1b')]=qs['limit'](_0x858ce3[_0x9981('0x31')]['limit']);_0x2ea6db[_0x9981('0x1a')]=qs[_0x9981('0x1a')](_0x858ce3['query'][_0x9981('0x1a')]);}return _0x3b18c5[_0x9981('0x5a')](_0x2ea6db);}})[_0x9981('0x22')](function(_0x50ac93){if(_0x50ac93){return _0x50ac93?{'count':_0x2a7055,'rows':_0x50ac93}:null;}})[_0x9981('0x22')](respondWithResult(_0x1111ad,null))[_0x9981('0x43')](handleError(_0x1111ad,null));}; \ No newline at end of file +var _0x9cf4=['intersection','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','then','destroy','get','Triggers','error','name','send','index','map','Trigger','fieldName','model','query','keys','filters'];(function(_0x524dbe,_0x14bdb9){var _0x5c8a09=function(_0x141452){while(--_0x141452){_0x524dbe['push'](_0x524dbe['shift']());}};_0x5c8a09(++_0x14bdb9);}(_0x9cf4,0x1ae));var _0x49cf=function(_0x2c2598,_0x3ece9d){_0x2c2598=_0x2c2598-0x0;var _0x16ce73=_0x9cf4[_0x2c2598];return _0x16ce73;};'use strict';var pdf=require(_0x49cf('0x0'));var emlformat=require(_0x49cf('0x1'));var rimraf=require(_0x49cf('0x2'));var zipdir=require(_0x49cf('0x3'));var jsonpatch=require(_0x49cf('0x4'));var rp=require(_0x49cf('0x5'));var moment=require(_0x49cf('0x6'));var BPromise=require(_0x49cf('0x7'));var Mustache=require(_0x49cf('0x8'));var util=require('util');var path=require(_0x49cf('0x9'));var sox=require(_0x49cf('0xa'));var csv=require(_0x49cf('0xb'));var ejs=require(_0x49cf('0xc'));var fs=require('fs');var _=require(_0x49cf('0xd'));var squel=require(_0x49cf('0xe'));var crypto=require(_0x49cf('0xf'));var jsforce=require(_0x49cf('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49cf('0x11'));var Papa=require('papaparse');var Redis=require(_0x49cf('0x12'));var authService=require(_0x49cf('0x13'));var qs=require(_0x49cf('0x14'));var as=require(_0x49cf('0x15'));var hardwareService=require(_0x49cf('0x16'));var logger=require('../../config/logger')(_0x49cf('0x17'));var utils=require('../../config/utils');var config=require(_0x49cf('0x18'));var db=require(_0x49cf('0x19'))['db'];function respondWithStatusCode(_0x500b72,_0x59b947){_0x59b947=_0x59b947||0xcc;return function(_0x2e7cb3){if(_0x2e7cb3){return _0x500b72[_0x49cf('0x1a')](_0x59b947);}return _0x500b72[_0x49cf('0x1b')](_0x59b947)[_0x49cf('0x1c')]();};}function respondWithResult(_0x4fa14f,_0x1f2bbb){_0x1f2bbb=_0x1f2bbb||0xc8;return function(_0x2d8189){if(_0x2d8189){return _0x4fa14f['status'](_0x1f2bbb)['json'](_0x2d8189);}};}function respondWithFilteredResult(_0x56672c,_0x70050b){return function(_0x462660){if(_0x462660){var _0x264fc0=_0x462660[_0x49cf('0x1d')],_0xb5dbaf=_0x70050b['offset'],_0x6dc0f7=_0x70050b['offset']+_0x70050b[_0x49cf('0x1e')],_0xc8de7d;if(_0x6dc0f7>=_0x264fc0){_0x6dc0f7=_0x264fc0;_0xc8de7d=0xc8;}else{_0xc8de7d=0xce;}_0x56672c[_0x49cf('0x1b')](_0xc8de7d);return _0x56672c[_0x49cf('0x1f')](_0x49cf('0x20'),_0xb5dbaf+'-'+_0x6dc0f7+'/'+_0x264fc0)[_0x49cf('0x21')](_0x462660);}return null;};}function patchUpdates(_0x4d219c){return function(_0x17f345){try{jsonpatch[_0x49cf('0x22')](_0x17f345,_0x4d219c,!![]);}catch(_0x3ec02f){return BPromise['reject'](_0x3ec02f);}return _0x17f345['save']();};}function saveUpdates(_0xba00b6,_0xe489df){return function(_0x450fe3){if(_0x450fe3){return _0x450fe3['update'](_0xba00b6)[_0x49cf('0x23')](function(_0x36d987){return _0x36d987;});}return null;};}function removeEntity(_0x540612,_0x280320){return function(_0x4fa7c4){if(_0x4fa7c4){return _0x4fa7c4[_0x49cf('0x24')]()[_0x49cf('0x23')](function(){var _0x1c6133=_0x4fa7c4[_0x49cf('0x25')]({'plain':!![]});var _0x10bb68=_0x49cf('0x26');return db['UserProfileResource'][_0x49cf('0x24')]({'where':{'type':_0x10bb68,'resourceId':_0x1c6133['id']}})[_0x49cf('0x23')](function(){return _0x4fa7c4;});})[_0x49cf('0x23')](function(){_0x540612[_0x49cf('0x1b')](0xcc)[_0x49cf('0x1c')]();});}};}function handleEntityNotFound(_0x1e2924,_0x4d2973){return function(_0x516e47){if(!_0x516e47){_0x1e2924['sendStatus'](0x194);}return _0x516e47;};}function handleError(_0x5a0428,_0x176b8e){_0x176b8e=_0x176b8e||0x1f4;return function(_0x45964b){logger[_0x49cf('0x27')](_0x45964b['stack']);if(_0x45964b[_0x49cf('0x28')]){delete _0x45964b[_0x49cf('0x28')];}_0x5a0428[_0x49cf('0x1b')](_0x176b8e)[_0x49cf('0x29')](_0x45964b);};}exports[_0x49cf('0x2a')]=function(_0x10a4e0,_0x19aa9d){var _0x4d8c1b={},_0x21b72e={},_0x5a3ea2={'count':0x0,'rows':[]};var _0x433c72=_[_0x49cf('0x2b')](db[_0x49cf('0x2c')]['rawAttributes'],function(_0x417181){return{'name':_0x417181[_0x49cf('0x2d')],'type':_0x417181['type']['key']};});_0x21b72e[_0x49cf('0x2e')]=_[_0x49cf('0x2b')](_0x433c72,_0x49cf('0x28'));_0x21b72e[_0x49cf('0x2f')]=_[_0x49cf('0x30')](_0x10a4e0[_0x49cf('0x2f')]);_0x21b72e[_0x49cf('0x31')]=_[_0x49cf('0x32')](_0x21b72e[_0x49cf('0x2e')],_0x21b72e[_0x49cf('0x2f')]);_0x4d8c1b[_0x49cf('0x33')]=_[_0x49cf('0x32')](_0x21b72e[_0x49cf('0x2e')],qs['fields'](_0x10a4e0['query']['fields']));_0x4d8c1b[_0x49cf('0x33')]=_0x4d8c1b[_0x49cf('0x33')][_0x49cf('0x34')]?_0x4d8c1b[_0x49cf('0x33')]:_0x21b72e[_0x49cf('0x2e')];if(!_0x10a4e0['query']['hasOwnProperty'](_0x49cf('0x35'))){_0x4d8c1b[_0x49cf('0x1e')]=qs[_0x49cf('0x1e')](_0x10a4e0[_0x49cf('0x2f')][_0x49cf('0x1e')]);_0x4d8c1b['offset']=qs[_0x49cf('0x36')](_0x10a4e0[_0x49cf('0x2f')][_0x49cf('0x36')]);}_0x4d8c1b[_0x49cf('0x37')]=qs[_0x49cf('0x38')](_0x10a4e0[_0x49cf('0x2f')][_0x49cf('0x38')]);_0x4d8c1b[_0x49cf('0x39')]=qs[_0x49cf('0x31')](_[_0x49cf('0x3a')](_0x10a4e0[_0x49cf('0x2f')],_0x21b72e[_0x49cf('0x31')]),_0x433c72);if(_0x10a4e0[_0x49cf('0x2f')][_0x49cf('0x3b')]){_0x4d8c1b[_0x49cf('0x39')]=_[_0x49cf('0x3c')](_0x4d8c1b['where'],{'$or':_[_0x49cf('0x2b')](_0x433c72,function(_0x1a7dac){if(_0x1a7dac[_0x49cf('0x3d')]!==_0x49cf('0x3e')){var _0x588331={};_0x588331[_0x1a7dac[_0x49cf('0x28')]]={'$like':'%'+_0x10a4e0['query'][_0x49cf('0x3b')]+'%'};return _0x588331;}})});}_0x4d8c1b=_[_0x49cf('0x3c')]({},_0x4d8c1b,_0x10a4e0[_0x49cf('0x3f')]);var _0x251bd9={'where':_0x4d8c1b[_0x49cf('0x39')]};return db[_0x49cf('0x2c')][_0x49cf('0x1d')](_0x251bd9)[_0x49cf('0x23')](function(_0x38c125){_0x5a3ea2[_0x49cf('0x1d')]=_0x38c125;if(_0x10a4e0[_0x49cf('0x2f')][_0x49cf('0x40')]){_0x4d8c1b['include']=[{'all':!![]}];}return db[_0x49cf('0x2c')][_0x49cf('0x41')](_0x4d8c1b);})[_0x49cf('0x23')](function(_0x3e4190){_0x5a3ea2[_0x49cf('0x42')]=_0x3e4190;return _0x5a3ea2;})[_0x49cf('0x23')](respondWithFilteredResult(_0x19aa9d,_0x4d8c1b))[_0x49cf('0x43')](handleError(_0x19aa9d,null));};exports[_0x49cf('0x44')]=function(_0xf1610e,_0xc7948d){var _0x254921={'raw':![],'where':{'id':_0xf1610e[_0x49cf('0x45')]['id']}},_0x497efb={};_0x497efb[_0x49cf('0x2e')]=_[_0x49cf('0x30')](db[_0x49cf('0x2c')][_0x49cf('0x46')]);_0x497efb['query']=_['keys'](_0xf1610e[_0x49cf('0x2f')]);_0x497efb[_0x49cf('0x31')]=_[_0x49cf('0x32')](_0x497efb[_0x49cf('0x2e')],_0x497efb[_0x49cf('0x2f')]);_0x254921[_0x49cf('0x33')]=_[_0x49cf('0x32')](_0x497efb[_0x49cf('0x2e')],qs[_0x49cf('0x47')](_0xf1610e['query'][_0x49cf('0x47')]));_0x254921['attributes']=_0x254921['attributes'][_0x49cf('0x34')]?_0x254921[_0x49cf('0x33')]:_0x497efb[_0x49cf('0x2e')];if(_0xf1610e[_0x49cf('0x2f')][_0x49cf('0x40')]){_0x254921['include']=[{'all':!![]}];}_0x254921=_['merge']({},_0x254921,_0xf1610e['options']);return db['Trigger'][_0x49cf('0x48')](_0x254921)[_0x49cf('0x23')](handleEntityNotFound(_0xc7948d,null))[_0x49cf('0x23')](respondWithResult(_0xc7948d,null))[_0x49cf('0x43')](handleError(_0xc7948d,null));};exports[_0x49cf('0x49')]=function(_0x3b46ff,_0x474932){return db[_0x49cf('0x2c')]['create'](_0x3b46ff[_0x49cf('0x4a')],{})[_0x49cf('0x23')](function(_0x438446){var _0x24c9c3=_0x3b46ff[_0x49cf('0x4b')][_0x49cf('0x25')]({'plain':!![]});if(!_0x24c9c3)throw new Error(_0x49cf('0x4c'));if(_0x24c9c3[_0x49cf('0x4d')]===_0x49cf('0x4b')){var _0x350945=_0x438446[_0x49cf('0x25')]({'plain':!![]});var _0x2a6ea1='Triggers';return db[_0x49cf('0x4e')][_0x49cf('0x48')]({'where':{'name':_0x2a6ea1,'userProfileId':_0x24c9c3[_0x49cf('0x4f')]},'raw':!![]})[_0x49cf('0x23')](function(_0x3a4c4b){if(_0x3a4c4b&&_0x3a4c4b[_0x49cf('0x50')]===0x0){return db[_0x49cf('0x51')][_0x49cf('0x49')]({'name':_0x350945[_0x49cf('0x28')],'resourceId':_0x350945['id'],'type':_0x3a4c4b[_0x49cf('0x28')],'sectionId':_0x3a4c4b['id']},{})['then'](function(){return _0x438446;});}else{return _0x438446;}})['catch'](function(_0x1de0d0){logger[_0x49cf('0x27')](_0x49cf('0x52'),_0x1de0d0);throw _0x1de0d0;});}return _0x438446;})['then'](respondWithResult(_0x474932,0xc9))[_0x49cf('0x43')](handleError(_0x474932,null));};exports[_0x49cf('0x53')]=function(_0x3ec869,_0x4d77bf){if(_0x3ec869[_0x49cf('0x4a')]['id']){delete _0x3ec869[_0x49cf('0x4a')]['id'];}return db[_0x49cf('0x2c')][_0x49cf('0x48')]({'where':{'id':_0x3ec869['params']['id']}})['then'](handleEntityNotFound(_0x4d77bf,null))[_0x49cf('0x23')](saveUpdates(_0x3ec869[_0x49cf('0x4a')],null))[_0x49cf('0x23')](respondWithResult(_0x4d77bf,null))[_0x49cf('0x43')](handleError(_0x4d77bf,null));};exports['destroy']=function(_0x3b8302,_0x2efb20){return db['Trigger'][_0x49cf('0x48')]({'where':{'id':_0x3b8302[_0x49cf('0x45')]['id']}})[_0x49cf('0x23')](handleEntityNotFound(_0x2efb20,null))[_0x49cf('0x23')](removeEntity(_0x2efb20,null))['catch'](handleError(_0x2efb20,null));};exports['addAllCondition']=function(_0x4f77bc,_0x1ac2e2,_0x585b92){if(_0x4f77bc[_0x49cf('0x4a')]['id']){delete _0x4f77bc[_0x49cf('0x4a')]['id'];}return db[_0x49cf('0x2c')][_0x49cf('0x48')]({'where':{'id':_0x4f77bc[_0x49cf('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ac2e2,null))[_0x49cf('0x23')](function(_0x53ae66){if(_0x53ae66){_0x4f77bc[_0x49cf('0x4a')][_0x49cf('0x54')]=_0x53ae66['id'];return db[_0x49cf('0x55')][_0x49cf('0x49')](_0x4f77bc[_0x49cf('0x4a')]);}})[_0x49cf('0x23')](respondWithResult(_0x1ac2e2,null))[_0x49cf('0x43')](handleError(_0x1ac2e2,null));};exports[_0x49cf('0x56')]=function(_0x810ac4,_0x1a3ff1,_0x502f24){if(_0x810ac4['body']['id']){delete _0x810ac4[_0x49cf('0x4a')]['id'];}return db[_0x49cf('0x2c')][_0x49cf('0x48')]({'where':{'id':_0x810ac4['params']['id']}})[_0x49cf('0x23')](handleEntityNotFound(_0x1a3ff1,null))[_0x49cf('0x23')](function(_0x45ec1d){if(_0x45ec1d){_0x810ac4[_0x49cf('0x4a')][_0x49cf('0x57')]=_0x45ec1d['id'];return db[_0x49cf('0x55')][_0x49cf('0x49')](_0x810ac4['body']);}})['then'](respondWithResult(_0x1a3ff1,null))['catch'](handleError(_0x1a3ff1,null));};exports[_0x49cf('0x58')]=function(_0x430678,_0xe819c2,_0x851901){var _0x1cce85={};var _0x2c04c3={};var _0x50b18e;var _0x18b838;return db[_0x49cf('0x2c')][_0x49cf('0x59')]({'where':{'id':_0x430678[_0x49cf('0x45')]['id']}})[_0x49cf('0x23')](handleEntityNotFound(_0xe819c2,null))[_0x49cf('0x23')](function(_0xdc5c2f){if(_0xdc5c2f){_0x50b18e=_0xdc5c2f;_0x2c04c3[_0x49cf('0x2e')]=_[_0x49cf('0x30')](db[_0x49cf('0x55')]['rawAttributes']);_0x2c04c3[_0x49cf('0x2f')]=_['keys'](_0x430678[_0x49cf('0x2f')]);_0x2c04c3['filters']=_[_0x49cf('0x32')](_0x2c04c3[_0x49cf('0x2e')],_0x2c04c3[_0x49cf('0x2f')]);_0x1cce85[_0x49cf('0x33')]=_[_0x49cf('0x32')](_0x2c04c3[_0x49cf('0x2e')],qs[_0x49cf('0x47')](_0x430678['query'][_0x49cf('0x47')]));_0x1cce85['attributes']=_0x1cce85[_0x49cf('0x33')][_0x49cf('0x34')]?_0x1cce85[_0x49cf('0x33')]:_0x2c04c3['model'];_0x1cce85[_0x49cf('0x37')]=qs[_0x49cf('0x38')](_0x430678['query'][_0x49cf('0x38')]);_0x1cce85[_0x49cf('0x39')]=qs[_0x49cf('0x31')](_[_0x49cf('0x3a')](_0x430678['query'],_0x2c04c3['filters']));if(_0x430678[_0x49cf('0x2f')][_0x49cf('0x3b')]){_0x1cce85[_0x49cf('0x39')]=_[_0x49cf('0x3c')](_0x1cce85[_0x49cf('0x39')],{'$or':_[_0x49cf('0x2b')](_0x1cce85[_0x49cf('0x33')],function(_0x3b75b1){var _0xc1f11e={};_0xc1f11e[_0x3b75b1]={'$like':'%'+_0x430678[_0x49cf('0x2f')][_0x49cf('0x3b')]+'%'};return _0xc1f11e;})});}_0x1cce85=_[_0x49cf('0x3c')]({},_0x1cce85,_0x430678[_0x49cf('0x3f')]);return _0x50b18e['getAllConditions'](_0x1cce85);}})['then'](function(_0xca410c){if(_0xca410c){_0x18b838=_0xca410c[_0x49cf('0x34')];if(!_0x430678[_0x49cf('0x2f')][_0x49cf('0x5a')](_0x49cf('0x35'))){_0x1cce85[_0x49cf('0x1e')]=qs[_0x49cf('0x1e')](_0x430678[_0x49cf('0x2f')]['limit']);_0x1cce85[_0x49cf('0x36')]=qs[_0x49cf('0x36')](_0x430678[_0x49cf('0x2f')][_0x49cf('0x36')]);}return _0x50b18e['getAllConditions'](_0x1cce85);}})[_0x49cf('0x23')](function(_0x2cc62f){if(_0x2cc62f){return _0x2cc62f?{'count':_0x18b838,'rows':_0x2cc62f}:null;}})[_0x49cf('0x23')](respondWithResult(_0xe819c2,null))['catch'](handleError(_0xe819c2,null));};exports[_0x49cf('0x5b')]=function(_0xb62bd7,_0x3336e3,_0x13435e){var _0x12d008={};var _0x5d07f5={};var _0x3dc45d;var _0x47b418;return db[_0x49cf('0x2c')][_0x49cf('0x59')]({'where':{'id':_0xb62bd7[_0x49cf('0x45')]['id']}})[_0x49cf('0x23')](handleEntityNotFound(_0x3336e3,null))['then'](function(_0xdac323){if(_0xdac323){_0x3dc45d=_0xdac323;_0x5d07f5['model']=_[_0x49cf('0x30')](db[_0x49cf('0x55')][_0x49cf('0x46')]);_0x5d07f5[_0x49cf('0x2f')]=_['keys'](_0xb62bd7['query']);_0x5d07f5['filters']=_[_0x49cf('0x32')](_0x5d07f5['model'],_0x5d07f5[_0x49cf('0x2f')]);_0x12d008[_0x49cf('0x33')]=_[_0x49cf('0x32')](_0x5d07f5['model'],qs[_0x49cf('0x47')](_0xb62bd7[_0x49cf('0x2f')][_0x49cf('0x47')]));_0x12d008['attributes']=_0x12d008[_0x49cf('0x33')][_0x49cf('0x34')]?_0x12d008[_0x49cf('0x33')]:_0x5d07f5[_0x49cf('0x2e')];_0x12d008['order']=qs['sort'](_0xb62bd7[_0x49cf('0x2f')]['sort']);_0x12d008[_0x49cf('0x39')]=qs[_0x49cf('0x31')](_[_0x49cf('0x3a')](_0xb62bd7[_0x49cf('0x2f')],_0x5d07f5['filters']));if(_0xb62bd7[_0x49cf('0x2f')]['filter']){_0x12d008[_0x49cf('0x39')]=_['merge'](_0x12d008[_0x49cf('0x39')],{'$or':_[_0x49cf('0x2b')](_0x12d008[_0x49cf('0x33')],function(_0x87216a){var _0x71e970={};_0x71e970[_0x87216a]={'$like':'%'+_0xb62bd7[_0x49cf('0x2f')][_0x49cf('0x3b')]+'%'};return _0x71e970;})});}_0x12d008=_[_0x49cf('0x3c')]({},_0x12d008,_0xb62bd7[_0x49cf('0x3f')]);return _0x3dc45d[_0x49cf('0x5b')](_0x12d008);}})[_0x49cf('0x23')](function(_0x5c7bfe){if(_0x5c7bfe){_0x47b418=_0x5c7bfe[_0x49cf('0x34')];if(!_0xb62bd7[_0x49cf('0x2f')][_0x49cf('0x5a')](_0x49cf('0x35'))){_0x12d008[_0x49cf('0x1e')]=qs[_0x49cf('0x1e')](_0xb62bd7[_0x49cf('0x2f')]['limit']);_0x12d008[_0x49cf('0x36')]=qs[_0x49cf('0x36')](_0xb62bd7[_0x49cf('0x2f')][_0x49cf('0x36')]);}return _0x3dc45d['getAnyConditions'](_0x12d008);}})[_0x49cf('0x23')](function(_0x4a7b8f){if(_0x4a7b8f){return _0x4a7b8f?{'count':_0x47b418,'rows':_0x4a7b8f}:null;}})[_0x49cf('0x23')](respondWithResult(_0x3336e3,null))[_0x49cf('0x43')](handleError(_0x3336e3,null));};exports[_0x49cf('0x5c')]=function(_0x5a1bb7,_0x546098,_0x134b00){if(_0x5a1bb7['body']['id']){delete _0x5a1bb7[_0x49cf('0x4a')]['id'];}return db[_0x49cf('0x2c')]['find']({'where':{'id':_0x5a1bb7[_0x49cf('0x45')]['id']}})[_0x49cf('0x23')](handleEntityNotFound(_0x546098,null))['then'](function(_0x2a7081){if(_0x2a7081){_0x5a1bb7[_0x49cf('0x4a')][_0x49cf('0x5d')]=_0x2a7081['id'];return db[_0x49cf('0x5e')][_0x49cf('0x49')](_0x5a1bb7['body']);}})[_0x49cf('0x23')](respondWithResult(_0x546098,null))[_0x49cf('0x43')](handleError(_0x546098,null));};exports[_0x49cf('0x5f')]=function(_0x50f438,_0x152a0e,_0x1cee75){var _0xfb641b={};var _0x382b54={};var _0x51e73a;var _0x3573ce;return db[_0x49cf('0x2c')]['findOne']({'where':{'id':_0x50f438[_0x49cf('0x45')]['id']}})['then'](handleEntityNotFound(_0x152a0e,null))[_0x49cf('0x23')](function(_0x573e13){if(_0x573e13){_0x51e73a=_0x573e13;_0x382b54[_0x49cf('0x2e')]=_[_0x49cf('0x30')](db['Action'][_0x49cf('0x46')]);_0x382b54[_0x49cf('0x2f')]=_[_0x49cf('0x30')](_0x50f438['query']);_0x382b54[_0x49cf('0x31')]=_[_0x49cf('0x32')](_0x382b54[_0x49cf('0x2e')],_0x382b54[_0x49cf('0x2f')]);_0xfb641b[_0x49cf('0x33')]=_['intersection'](_0x382b54['model'],qs[_0x49cf('0x47')](_0x50f438[_0x49cf('0x2f')][_0x49cf('0x47')]));_0xfb641b[_0x49cf('0x33')]=_0xfb641b[_0x49cf('0x33')]['length']?_0xfb641b[_0x49cf('0x33')]:_0x382b54[_0x49cf('0x2e')];_0xfb641b[_0x49cf('0x37')]=qs[_0x49cf('0x38')](_0x50f438[_0x49cf('0x2f')][_0x49cf('0x38')]);_0xfb641b[_0x49cf('0x39')]=qs[_0x49cf('0x31')](_[_0x49cf('0x3a')](_0x50f438[_0x49cf('0x2f')],_0x382b54[_0x49cf('0x31')]));if(_0x50f438['query']['filter']){_0xfb641b[_0x49cf('0x39')]=_['merge'](_0xfb641b[_0x49cf('0x39')],{'$or':_[_0x49cf('0x2b')](_0xfb641b['attributes'],function(_0x38397f){var _0x27021f={};_0x27021f[_0x38397f]={'$like':'%'+_0x50f438[_0x49cf('0x2f')][_0x49cf('0x3b')]+'%'};return _0x27021f;})});}_0xfb641b=_['merge']({},_0xfb641b,_0x50f438[_0x49cf('0x3f')]);return _0x51e73a[_0x49cf('0x5f')](_0xfb641b);}})[_0x49cf('0x23')](function(_0x5f13cc){if(_0x5f13cc){_0x3573ce=_0x5f13cc[_0x49cf('0x34')];if(!_0x50f438[_0x49cf('0x2f')][_0x49cf('0x5a')]('nolimit')){_0xfb641b['limit']=qs[_0x49cf('0x1e')](_0x50f438[_0x49cf('0x2f')]['limit']);_0xfb641b[_0x49cf('0x36')]=qs['offset'](_0x50f438[_0x49cf('0x2f')][_0x49cf('0x36')]);}return _0x51e73a[_0x49cf('0x5f')](_0xfb641b);}})[_0x49cf('0x23')](function(_0x4d826f){if(_0x4d826f){return _0x4d826f?{'count':_0x3573ce,'rows':_0x4d826f}:null;}})[_0x49cf('0x23')](respondWithResult(_0x152a0e,null))['catch'](handleError(_0x152a0e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0699773..4cc3ee3 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 _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x1650bd,_0x1849ac){var _0x4a0381=function(_0x3a572a){while(--_0x3a572a){_0x1650bd['push'](_0x1650bd['shift']());}};_0x4a0381(++_0x1849ac);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d3e56,_0x4540cc){_0x5d3e56=_0x5d3e56-0x0;var _0x4ebf8d=_0x2ef3[_0x5d3e56];return _0x4ebf8d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index cbb001a..abc6cd1 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 _0x757a=['stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x52f5f5,_0x594a67){var _0x5e680a=function(_0x19af83){while(--_0x19af83){_0x52f5f5['push'](_0x52f5f5['shift']());}};_0x5e680a(++_0x594a67);}(_0x757a,0xde));var _0xa757=function(_0x2e5d2e,_0x530e85){_0x2e5d2e=_0x2e5d2e-0x0;var _0x3f1fbe=_0x757a[_0x2e5d2e];return _0x3f1fbe;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrigger',_0x4d9f58);logger['debug']('GetTrigger',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrigger',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xcf2f=['error','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ce231,_0x4b7673){var _0x574f8e=function(_0x241910){while(--_0x241910){_0x3ce231['push'](_0x3ce231['shift']());}};_0x574f8e(++_0x4b7673);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x33cbfe,_0x1d046f){_0x33cbfe=_0x33cbfe-0x0;var _0x2af792=_0xcf2f[_0x33cbfe];return _0x2af792;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d4bd,_0x157f48,_0x16b6b2){return new BPromise(function(_0x34f444,_0xb4c510){return client[_0xfcf2('0xd')](_0x41d4bd,_0x16b6b2)['then'](function(_0x575f33){logger['info'](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));logger['debug'](_0xfcf2('0x10'),_0x157f48,_0xfcf2('0xf'),JSON[_0xfcf2('0x11')](_0x575f33));if(_0x575f33[_0xfcf2('0x12')]){if(_0x575f33['error']['code']===0x1f4){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x575f33[_0xfcf2('0x12')][_0xfcf2('0x13')]);return _0xb4c510(_0x575f33['error'][_0xfcf2('0x13')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x157f48,_0x575f33['error'][_0xfcf2('0x13')]);return _0x34f444(_0x575f33['error'][_0xfcf2('0x13')]);}else{logger[_0xfcf2('0x14')](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));_0x34f444(_0x575f33[_0xfcf2('0x15')][_0xfcf2('0x13')]);}})[_0xfcf2('0x16')](function(_0x4d64ce){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x4d64ce);_0xb4c510(_0x4d64ce);});});}exports[_0xfcf2('0x17')]=function(_0x581d78){var _0xd87472=this;return new Promise(function(_0x1b3c89,_0x33eaa7){return db[_0xfcf2('0x18')][_0xfcf2('0x19')]({'raw':_0x581d78['options']?_0x581d78[_0xfcf2('0x1a')][_0xfcf2('0x1b')]===undefined?!![]:![]:!![],'where':_0x581d78['options']?_0x581d78[_0xfcf2('0x1a')][_0xfcf2('0x1c')]||null:null,'attributes':_0x581d78[_0xfcf2('0x1a')]?_0x581d78[_0xfcf2('0x1a')][_0xfcf2('0x1d')]||null:null,'limit':_0x581d78[_0xfcf2('0x1a')]?_0x581d78[_0xfcf2('0x1a')][_0xfcf2('0x1e')]||null:null,'include':_0x581d78[_0xfcf2('0x1a')]?_0x581d78['options'][_0xfcf2('0x1f')]?_[_0xfcf2('0x20')](_0x581d78[_0xfcf2('0x1a')]['include'],function(_0x26641a){return{'model':db[_0x26641a[_0xfcf2('0x21')]],'as':_0x26641a['as'],'attributes':_0x26641a['attributes'],'include':_0x26641a[_0xfcf2('0x1f')]?_[_0xfcf2('0x20')](_0x26641a['include'],function(_0x1e6f14){return{'model':db[_0x1e6f14[_0xfcf2('0x21')]],'as':_0x1e6f14['as'],'attributes':_0x1e6f14[_0xfcf2('0x1d')],'include':_0x1e6f14[_0xfcf2('0x1f')]?_['map'](_0x1e6f14[_0xfcf2('0x1f')],function(_0x448222){return{'model':db[_0x448222[_0xfcf2('0x21')]],'as':_0x448222['as'],'attributes':_0x448222[_0xfcf2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfcf2('0x22')](function(_0x2b1d60){logger[_0xfcf2('0x14')](_0xfcf2('0x17'),_0x581d78);logger[_0xfcf2('0x23')]('GetTrigger',_0x581d78,JSON['stringify'](_0x2b1d60));_0x1b3c89(_0x2b1d60);})[_0xfcf2('0x16')](function(_0x878504){logger[_0xfcf2('0x12')]('GetTrigger',_0x878504[_0xfcf2('0x13')],_0x581d78);_0x33eaa7(_0xd87472['error'](0x1f4,_0x878504[_0xfcf2('0x13')]));});});};exports[_0xfcf2('0x24')]=function(_0x40c1ae){var _0x1a4485=this;return new Promise(function(_0x313884,_0x3760ad){return db[_0xfcf2('0x18')]['find']({'raw':_0x40c1ae['options']?_0x40c1ae[_0xfcf2('0x1a')][_0xfcf2('0x1b')]===undefined?!![]:![]:!![],'where':_0x40c1ae[_0xfcf2('0x1a')]?_0x40c1ae[_0xfcf2('0x1a')]['where']||null:null,'attributes':_0x40c1ae['options']?_0x40c1ae[_0xfcf2('0x1a')]['attributes']||null:null,'include':_0x40c1ae[_0xfcf2('0x1a')]?_0x40c1ae[_0xfcf2('0x1a')]['include']?_[_0xfcf2('0x20')](_0x40c1ae[_0xfcf2('0x1a')][_0xfcf2('0x1f')],function(_0x4046c6){return{'model':db[_0x4046c6[_0xfcf2('0x21')]],'as':_0x4046c6['as'],'attributes':_0x4046c6[_0xfcf2('0x1d')],'include':_0x4046c6[_0xfcf2('0x1f')]?_['map'](_0x4046c6[_0xfcf2('0x1f')],function(_0x44ce2e){return{'model':db[_0x44ce2e['model']],'as':_0x44ce2e['as'],'attributes':_0x44ce2e[_0xfcf2('0x1d')],'include':_0x44ce2e[_0xfcf2('0x1f')]?_['map'](_0x44ce2e[_0xfcf2('0x1f')],function(_0x1a77a3){return{'model':db[_0x1a77a3['model']],'as':_0x1a77a3['as'],'attributes':_0x1a77a3[_0xfcf2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfcf2('0x22')](function(_0xf4f13c){logger[_0xfcf2('0x14')]('ShowTrigger',_0x40c1ae);logger[_0xfcf2('0x23')](_0xfcf2('0x24'),_0x40c1ae,JSON[_0xfcf2('0x11')](_0xf4f13c));_0x313884(_0xf4f13c);})[_0xfcf2('0x16')](function(_0x1a2f1f){logger['error'](_0xfcf2('0x24'),_0x1a2f1f[_0xfcf2('0x13')],_0x40c1ae);_0x3760ad(_0x1a4485[_0xfcf2('0x12')](0x1f4,_0x1a2f1f[_0xfcf2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dde70ad..9fc28bb 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 _0xa41a=['../../config/environment','./trunk.controller','get','index','show','post','isAuthenticated','clone','create','put','/:id','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b5c12,_0x1facce){var _0x24be96=function(_0x5914c8){while(--_0x5914c8){_0x4b5c12['push'](_0x4b5c12['shift']());}};_0x24be96(++_0x1facce);}(_0xa41a,0x6b));var _0xaa41=function(_0x371d92,_0x476b78){_0x371d92=_0x371d92-0x0;var _0x1dd590=_0xa41a[_0x371d92];return _0x1dd590;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0xc')]('/:id/clone',auth[_0xaa41('0xd')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xc')]('/',auth[_0xaa41('0xd')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')](_0xaa41('0x11'),auth[_0xaa41('0xd')](),controller[_0xaa41('0x12')]);router['delete'](_0xaa41('0x11'),auth[_0xaa41('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x00bb=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','/:id','isAuthenticated','show','post','/:id/clone','create','put','delete','exports','multer','util','path','express'];(function(_0x45f0a4,_0x4fb535){var _0x20bd09=function(_0x284da6){while(--_0x284da6){_0x45f0a4['push'](_0x45f0a4['shift']());}};_0x20bd09(++_0x4fb535);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0xb')](_0xb00b('0xc'),auth[_0xb00b('0x9')](),controller['clone']);router['post']('/',auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller['update']);router[_0xb00b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb00b('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c3fac5c..b5f7f08 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 _0x179e=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','sequelize','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x179e,0x177));var _0xe179=function(_0x2f40e1,_0x4ec5c1){_0x2f40e1=_0x2f40e1-0x0;var _0x55294a=_0x179e[_0x2f40e1];return _0x55294a;};'use strict';var Sequelize=require(_0xe179('0x0'));module[_0xe179('0x1')]={'name':{'type':Sequelize[_0xe179('0x2')],'allowNull':![],'unique':_0xe179('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xe179('0x4'),_0xe179('0x5'),'peer'),'allowNull':![],'defaultValue':_0xe179('0x4')},'context':{'type':Sequelize[_0xe179('0x2')],'allowNull':![],'defaultValue':_0xe179('0x6')},'callingpres':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x8'),_0xe179('0x9'),_0xe179('0xa'),'ALLOWED',_0xe179('0xb'),_0xe179('0xc'),_0xe179('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xe179('0x2')]},'permit':{'type':Sequelize[_0xe179('0x2')]},'secret':{'type':Sequelize[_0xe179('0x2')]},'md5secret':{'type':Sequelize[_0xe179('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xe179('0x2')],'defaultValue':'udp','set':function(_0x6801b7){this['setDataValue'](_0xe179('0xe'),_0x6801b7?_0x6801b7[_0xe179('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xe179('0xe'))?this[_0xe179('0x10')](_0xe179('0xe'))[_0xe179('0x11')](','):null;},'comment':_0xe179('0x12')},'dtmfmode':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x13'),_0xe179('0x14'),_0xe179('0x15'),_0xe179('0x16'),_0xe179('0x17')),'defaultValue':_0xe179('0x13')},'directmedia':{'type':Sequelize[_0xe179('0x7')]('yes','no',_0xe179('0x18'),'update',_0xe179('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe179('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe179('0x2')]},'directmediadeny':{'type':Sequelize[_0xe179('0x2')]},'nat':{'type':Sequelize[_0xe179('0x2')],'defaultValue':_0xe179('0x1a'),'set':function(_0x1d11e6){this[_0xe179('0x1b')](_0xe179('0x1c'),_0x1d11e6?_0x1d11e6[_0xe179('0xf')](','):null);},'get':function(){return this[_0xe179('0x10')](_0xe179('0x1c'))?this['getDataValue'](_0xe179('0x1c'))['split'](','):null;},'comment':_0xe179('0x1d')},'callgroup':{'type':Sequelize[_0xe179('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe179('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xe179('0x2')]},'language':{'type':Sequelize[_0xe179('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe179('0x2')],'defaultValue':_0xe179('0x1e')},'allow':{'type':Sequelize[_0xe179('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xaaa9f7){this[_0xe179('0x1b')](_0xe179('0x1f'),_0xaaa9f7?_0xaaa9f7[_0xe179('0xf')](';'):_0xe179('0x20'));},'get':function(){return this[_0xe179('0x10')](_0xe179('0x1f'))?this[_0xe179('0x10')](_0xe179('0x1f'))['split'](';'):null;},'comment':_0xe179('0x21')},'autoframing':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'insecure':{'type':Sequelize[_0xe179('0x2')],'defaultValue':'port,invite','set':function(_0x16c972){this[_0xe179('0x1b')](_0xe179('0x23'),_0x16c972?_0x16c972[_0xe179('0xf')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xe179('0x10')]('insecure')['split'](','):null;},'comment':_0xe179('0x24')},'trustrpid':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe179('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xe179('0x22'),'no')},'useclientcode':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'accountcode':{'type':Sequelize[_0xe179('0x25')](0xb)},'setvar':{'type':Sequelize[_0xe179('0x2')]},'callerid':{'type':Sequelize[_0xe179('0x2')],'defaultValue':_0xe179('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no'),'defaultValue':_0xe179('0x22')},'busylevel':{'type':Sequelize[_0xe179('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'allowsubscribe':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'allowtransfer':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'subscribecontext':{'type':Sequelize[_0xe179('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xe179('0x7')]('yes','no',_0xe179('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe179('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'mailbox':{'type':Sequelize[_0xe179('0x2')]},'session_timers':{'type':Sequelize[_0xe179('0x7')]('accept',_0xe179('0x28'),_0xe179('0x29'))},'session_expires':{'type':Sequelize[_0xe179('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xe179('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xe179('0x7')]('uac','uas'),'defaultValue':_0xe179('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xe179('0x2')]},'regexten':{'type':Sequelize[_0xe179('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no'),'defaultValue':_0xe179('0x22')},'keepalive':{'type':Sequelize[_0xe179('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xe179('0x2')]},'defaultuser':{'type':Sequelize[_0xe179('0x2')]},'rtptimeout':{'type':Sequelize[_0xe179('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe179('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xe179('0x22'),'no',_0xe179('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe179('0x2')]},'callbackextension':{'type':Sequelize[_0xe179('0x2')]},'timert1':{'type':Sequelize[_0xe179('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xe179('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xe179('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xe179('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe179('0x2')]},'maxforwards':{'type':Sequelize[_0xe179('0x25')](0xb)},'encryption':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'force_avp':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'icesupport':{'type':Sequelize[_0xe179('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xe179('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xe179('0x2c'),_0xe179('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xe179('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xe179('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xe179('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe179('0x2')]},'dtlscapath':{'type':Sequelize[_0xe179('0x2')]},'dtlssetup':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x2e'),_0xe179('0x2f'),_0xe179('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe179('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xe179('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe179('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no')},'vmexten':{'type':Sequelize[_0xe179('0x2')]},'mohinterpret':{'type':Sequelize[_0xe179('0x2')]},'mohsuggest':{'type':Sequelize[_0xe179('0x2')]},'parkinglot':{'type':Sequelize[_0xe179('0x2')]},'description':{'type':Sequelize[_0xe179('0x2')]},'host':{'type':Sequelize[_0xe179('0x2')],'defaultValue':_0xe179('0x31')},'canreinvite':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x22'),'no',_0xe179('0x18'),_0xe179('0x32'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe179('0x2')]},'otherFields':{'type':Sequelize[_0xe179('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe179('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe81c=['split','rfc2833','info','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','originate','uac','uas','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','setDataValue','transport','join','getDataValue'];(function(_0x5cdc6e,_0x94a130){var _0x3e6aef=function(_0x1d8ecd){while(--_0x1d8ecd){_0x5cdc6e['push'](_0x5cdc6e['shift']());}};_0x3e6aef(++_0x94a130);}(_0xe81c,0xd8));var _0xce81=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xe81c[_0x277721];return _0x286051;};'use strict';var Sequelize=require(_0xce81('0x0'));module[_0xce81('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xce81('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xce81('0x3')]('friend',_0xce81('0x4'),_0xce81('0x5')),'allowNull':![],'defaultValue':_0xce81('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xce81('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xce81('0x8'),_0xce81('0x9'),_0xce81('0xa'),'PROHIB_NOT_SCREENED',_0xce81('0xb'),_0xce81('0xc'),_0xce81('0xd'))},'deny':{'type':Sequelize[_0xce81('0xe')]},'permit':{'type':Sequelize[_0xce81('0xe')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xce81('0xe')]},'remotesecret':{'type':Sequelize[_0xce81('0xe')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x9ed7a7){this[_0xce81('0xf')](_0xce81('0x10'),_0x9ed7a7?_0x9ed7a7[_0xce81('0x11')](','):null);},'get':function(){return this[_0xce81('0x12')](_0xce81('0x10'))?this[_0xce81('0x12')](_0xce81('0x10'))[_0xce81('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x14'),_0xce81('0x15'),'shortinfo',_0xce81('0x16'),'auto'),'defaultValue':_0xce81('0x14')},'directmedia':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no',_0xce81('0x18'),_0xce81('0x19'),_0xce81('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xce81('0xe')]},'nat':{'type':Sequelize[_0xce81('0xe')],'defaultValue':_0xce81('0x1b'),'set':function(_0x4eeb9c){this[_0xce81('0xf')](_0xce81('0x1c'),_0x4eeb9c?_0x4eeb9c[_0xce81('0x11')](','):null);},'get':function(){return this[_0xce81('0x12')](_0xce81('0x1c'))?this[_0xce81('0x12')](_0xce81('0x1c'))[_0xce81('0x13')](','):null;},'comment':_0xce81('0x1d')},'callgroup':{'type':Sequelize[_0xce81('0xe')]},'namedcallgroup':{'type':Sequelize[_0xce81('0xe')]},'pickupgroup':{'type':Sequelize[_0xce81('0xe')]},'namedpickupgroup':{'type':Sequelize[_0xce81('0xe')]},'language':{'type':Sequelize[_0xce81('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xce81('0xe')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xce81('0xe')],'defaultValue':_0xce81('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xce81('0x1f'),'set':function(_0x407d68){this[_0xce81('0xf')](_0xce81('0x20'),_0x407d68?_0x407d68[_0xce81('0x11')](';'):_0xce81('0x1f'));},'get':function(){return this[_0xce81('0x12')](_0xce81('0x20'))?this['getDataValue'](_0xce81('0x20'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xce81('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0xce81('0xe')],'defaultValue':'port,invite','set':function(_0x31300c){this['setDataValue'](_0xce81('0x21'),_0x31300c?_0x31300c[_0xce81('0x11')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xce81('0x12')](_0xce81('0x21'))['split'](','):null;},'comment':_0xce81('0x22')},'trustrpid':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xce81('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no',_0xce81('0x23'))},'promiscredir':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xce81('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xce81('0x24')](0xb)},'setvar':{'type':Sequelize[_0xce81('0xe')]},'callerid':{'type':Sequelize[_0xce81('0xe')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xce81('0xe')]},'callcounter':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no'),'defaultValue':_0xce81('0x17')},'busylevel':{'type':Sequelize[_0xce81('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xce81('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xce81('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xce81('0xe')]},'template':{'type':Sequelize[_0xce81('0xe')]},'videosupport':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no',_0xce81('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xce81('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'mailbox':{'type':Sequelize[_0xce81('0xe')]},'session_timers':{'type':Sequelize['ENUM'](_0xce81('0x26'),'refuse',_0xce81('0x27'))},'session_expires':{'type':Sequelize[_0xce81('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xce81('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x28'),'uas'),'defaultValue':_0xce81('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xce81('0xe')]},'regexten':{'type':Sequelize[_0xce81('0xe')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xce81('0xe')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no'),'defaultValue':_0xce81('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xce81('0xe')]},'defaultuser':{'type':Sequelize[_0xce81('0xe')]},'rtptimeout':{'type':Sequelize[_0xce81('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xce81('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xce81('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xce81('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xce81('0xe')]},'callbackextension':{'type':Sequelize[_0xce81('0xe')]},'timert1':{'type':Sequelize[_0xce81('0x24')](0xb)},'timerb':{'type':Sequelize[_0xce81('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xce81('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xce81('0xe')]},'contactdeny':{'type':Sequelize[_0xce81('0xe')]},'contactacl':{'type':Sequelize[_0xce81('0xe')]},'unsolicited_mailbox':{'type':Sequelize[_0xce81('0xe')]},'use_q850_reason':{'type':Sequelize[_0xce81('0xe')]},'maxforwards':{'type':Sequelize[_0xce81('0x24')](0xb)},'encryption':{'type':Sequelize[_0xce81('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'force_avp':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'icesupport':{'type':Sequelize[_0xce81('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no','fingerprint',_0xce81('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xce81('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xce81('0xe')]},'dtlscipher':{'type':Sequelize[_0xce81('0xe')]},'dtlscafile':{'type':Sequelize[_0xce81('0xe')]},'dtlscapath':{'type':Sequelize[_0xce81('0xe')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xce81('0x2b'),_0xce81('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xce81('0xe')]},'usereqphone':{'type':Sequelize[_0xce81('0x3')](_0xce81('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xce81('0xe')]},'recordofffeature':{'type':Sequelize[_0xce81('0xe')]},'call_limit':{'type':Sequelize[_0xce81('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xce81('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xce81('0x17'),'no')},'vmexten':{'type':Sequelize[_0xce81('0xe')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xce81('0xe')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce81('0xe')]},'host':{'type':Sequelize[_0xce81('0xe')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xce81('0x17'),'no',_0xce81('0x18'),'update',_0xce81('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xce81('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xce81('0xe')],'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 21ae4fe..d778ff4 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 _0x3c66=['rows','show','params','rawAttributes','find','include','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join','utf8','render','registry','writeFileSync','Reload','chan_sip.so','userProfileId','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','destroy','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','test','Sequelize','ValidationError','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','status','json','count','offset','limit','Content-Range','update','get','Trunks','sendStatus','stack','name','send','index','Trunk','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','type','VIRTUAL','options','includeAll','findAll'];(function(_0x7eadd1,_0x48a71b){var _0x51d796=function(_0x11c6af){while(--_0x11c6af){_0x7eadd1['push'](_0x7eadd1['shift']());}};_0x51d796(++_0x48a71b);}(_0x3c66,0x8b));var _0x63c6=function(_0x31711c,_0x3f23f8){_0x31711c=_0x31711c-0x0;var _0x3f8153=_0x3c66[_0x31711c];return _0x3f8153;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63c6('0x0'));var jsonpatch=require(_0x63c6('0x1'));var rp=require(_0x63c6('0x2'));var moment=require(_0x63c6('0x3'));var BPromise=require(_0x63c6('0x4'));var Mustache=require(_0x63c6('0x5'));var util=require(_0x63c6('0x6'));var path=require(_0x63c6('0x7'));var sox=require(_0x63c6('0x8'));var csv=require(_0x63c6('0x9'));var ejs=require(_0x63c6('0xa'));var fs=require('fs');var _=require(_0x63c6('0xb'));var squel=require('squel');var crypto=require(_0x63c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63c6('0xd'));var toCsv=require(_0x63c6('0x9'));var querystring=require('querystring');var Papa=require(_0x63c6('0xe'));var Redis=require(_0x63c6('0xf'));var authService=require(_0x63c6('0x10'));var qs=require(_0x63c6('0x11'));var as=require(_0x63c6('0x12'));var hardwareService=require(_0x63c6('0x13'));var logger=require('../../config/logger')(_0x63c6('0x14'));var utils=require(_0x63c6('0x15'));var config=require(_0x63c6('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x59373e,_0x482547,_0x332c5e){if(_0x332c5e){var _0x69911c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x69911c[_0x63c6('0x17')](_0x482547)){return _0x59373e;}else{throw new db[(_0x63c6('0x18'))][(_0x63c6('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 _0x59373e;}}function respondWithRpcPromise(_0x286eb8,_0x19fbb3,_0x58ce24,_0x2b835a){return new BPromise(function(_0x4b1964,_0x50b819){var _0x1abfbd=_0x2b835a||client;return _0x1abfbd['request'](_0x286eb8,_0x58ce24)[_0x63c6('0x1a')](function(_0x2877b1){logger['info'](_0x63c6('0x1b'),_0x19fbb3,_0x63c6('0x1c'));logger[_0x63c6('0x1d')](_0x63c6('0x1e'),_0x19fbb3,_0x63c6('0x1c'),JSON['stringify'](_0x2877b1));if(_0x2877b1['error']){if(_0x2877b1['error'][_0x63c6('0x1f')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x19fbb3,_0x2877b1[_0x63c6('0x20')][_0x63c6('0x21')]);return _0x50b819(_0x2877b1['error'][_0x63c6('0x21')]);}logger[_0x63c6('0x20')](_0x63c6('0x1b'),_0x19fbb3,_0x2877b1[_0x63c6('0x20')][_0x63c6('0x21')]);return _0x4b1964(_0x2877b1['error'][_0x63c6('0x21')]);}else{logger[_0x63c6('0x22')](_0x63c6('0x1b'),_0x19fbb3,_0x63c6('0x1c'));_0x4b1964(_0x2877b1[_0x63c6('0x23')][_0x63c6('0x21')]);}})[_0x63c6('0x24')](function(_0x2e3580){logger['error'](_0x63c6('0x1b'),_0x19fbb3,_0x2e3580);_0x50b819(_0x2e3580);});});}function respondWithStatusCode(_0x121527,_0xee6da9){_0xee6da9=_0xee6da9||0xcc;return function(_0x59cd9f){if(_0x59cd9f){return _0x121527['sendStatus'](_0xee6da9);}return _0x121527[_0x63c6('0x25')](_0xee6da9)['end']();};}function respondWithResult(_0x2a0ccf,_0x4c23e8){_0x4c23e8=_0x4c23e8||0xc8;return function(_0x4c0bed){if(_0x4c0bed){return _0x2a0ccf[_0x63c6('0x25')](_0x4c23e8)[_0x63c6('0x26')](_0x4c0bed);}};}function respondWithFilteredResult(_0x147c50,_0x594d1c){return function(_0x1e0876){if(_0x1e0876){var _0x5d4867=_0x1e0876[_0x63c6('0x27')],_0x1c6a20=_0x594d1c[_0x63c6('0x28')],_0x6c39e4=_0x594d1c[_0x63c6('0x28')]+_0x594d1c[_0x63c6('0x29')],_0x393424;if(_0x6c39e4>=_0x5d4867){_0x6c39e4=_0x5d4867;_0x393424=0xc8;}else{_0x393424=0xce;}_0x147c50[_0x63c6('0x25')](_0x393424);return _0x147c50['set'](_0x63c6('0x2a'),_0x1c6a20+'-'+_0x6c39e4+'/'+_0x5d4867)[_0x63c6('0x26')](_0x1e0876);}return null;};}function patchUpdates(_0x1eee6b){return function(_0x1a5bb6){try{jsonpatch['apply'](_0x1a5bb6,_0x1eee6b,!![]);}catch(_0xff8be4){return BPromise['reject'](_0xff8be4);}return _0x1a5bb6['save']();};}function saveUpdates(_0x35733d,_0x477527){return function(_0x26285f){if(_0x26285f){return _0x26285f[_0x63c6('0x2b')](_0x35733d)[_0x63c6('0x1a')](function(_0x3a522e){return _0x3a522e;});}return null;};}function removeEntity(_0x389050,_0x54a5e7){return function(_0x32d2b7){if(_0x32d2b7){return _0x32d2b7['destroy']()[_0x63c6('0x1a')](function(){var _0x49632a=_0x32d2b7[_0x63c6('0x2c')]({'plain':!![]});var _0x49f11b=_0x63c6('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x49f11b,'resourceId':_0x49632a['id']}})[_0x63c6('0x1a')](function(){return _0x32d2b7;});})[_0x63c6('0x1a')](function(){_0x389050[_0x63c6('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37faf2,_0x1d438f){return function(_0x3861d6){if(!_0x3861d6){_0x37faf2[_0x63c6('0x2e')](0x194);}return _0x3861d6;};}function handleError(_0x4930fc,_0x24c813){_0x24c813=_0x24c813||0x1f4;return function(_0x258f32){logger['error'](_0x258f32[_0x63c6('0x2f')]);if(_0x258f32[_0x63c6('0x30')]){delete _0x258f32[_0x63c6('0x30')];}_0x4930fc[_0x63c6('0x25')](_0x24c813)[_0x63c6('0x31')](_0x258f32);};}exports[_0x63c6('0x32')]=function(_0x186cb5,_0x21017e){var _0x430eac={},_0x27273f={},_0x1ae025={'count':0x0,'rows':[]};var _0x437b7f=_['map'](db[_0x63c6('0x33')]['rawAttributes'],function(_0x19ea35){return{'name':_0x19ea35[_0x63c6('0x34')],'type':_0x19ea35['type']['key']};});_0x27273f[_0x63c6('0x35')]=_[_0x63c6('0x36')](_0x437b7f,_0x63c6('0x30'));_0x27273f[_0x63c6('0x37')]=_[_0x63c6('0x38')](_0x186cb5['query']);_0x27273f[_0x63c6('0x39')]=_['intersection'](_0x27273f['model'],_0x27273f[_0x63c6('0x37')]);_0x430eac[_0x63c6('0x3a')]=_[_0x63c6('0x3b')](_0x27273f[_0x63c6('0x35')],qs[_0x63c6('0x3c')](_0x186cb5[_0x63c6('0x37')][_0x63c6('0x3c')]));_0x430eac[_0x63c6('0x3a')]=_0x430eac[_0x63c6('0x3a')][_0x63c6('0x3d')]?_0x430eac[_0x63c6('0x3a')]:_0x27273f[_0x63c6('0x35')];if(!_0x186cb5[_0x63c6('0x37')][_0x63c6('0x3e')](_0x63c6('0x3f'))){_0x430eac[_0x63c6('0x29')]=qs[_0x63c6('0x29')](_0x186cb5[_0x63c6('0x37')][_0x63c6('0x29')]);_0x430eac['offset']=qs[_0x63c6('0x28')](_0x186cb5['query']['offset']);}_0x430eac['order']=qs['sort'](_0x186cb5[_0x63c6('0x37')][_0x63c6('0x40')]);_0x430eac['where']=qs[_0x63c6('0x39')](_['pick'](_0x186cb5[_0x63c6('0x37')],_0x27273f[_0x63c6('0x39')]),_0x437b7f);if(_0x186cb5[_0x63c6('0x37')][_0x63c6('0x41')]){_0x430eac['where']=_[_0x63c6('0x42')](_0x430eac[_0x63c6('0x43')],{'$or':_[_0x63c6('0x36')](_0x437b7f,function(_0x22bc84){if(_0x22bc84[_0x63c6('0x44')]!==_0x63c6('0x45')){var _0x33d70e={};_0x33d70e[_0x22bc84[_0x63c6('0x30')]]={'$like':'%'+_0x186cb5['query'][_0x63c6('0x41')]+'%'};return _0x33d70e;}})});}_0x430eac=_[_0x63c6('0x42')]({},_0x430eac,_0x186cb5[_0x63c6('0x46')]);var _0x52e0ef={'where':_0x430eac[_0x63c6('0x43')]};return db[_0x63c6('0x33')][_0x63c6('0x27')](_0x52e0ef)[_0x63c6('0x1a')](function(_0x41b4b0){_0x1ae025['count']=_0x41b4b0;if(_0x186cb5[_0x63c6('0x37')][_0x63c6('0x47')]){_0x430eac['include']=[{'all':!![]}];}return db[_0x63c6('0x33')][_0x63c6('0x48')](_0x430eac);})[_0x63c6('0x1a')](function(_0x1bd464){_0x1ae025[_0x63c6('0x49')]=_0x1bd464;return _0x1ae025;})[_0x63c6('0x1a')](respondWithFilteredResult(_0x21017e,_0x430eac))['catch'](handleError(_0x21017e,null));};exports[_0x63c6('0x4a')]=function(_0xfc2918,_0x224f27){var _0xdf4f43={'raw':![],'where':{'id':_0xfc2918[_0x63c6('0x4b')]['id']}},_0x5c8fc9={};_0x5c8fc9[_0x63c6('0x35')]=_['keys'](db[_0x63c6('0x33')][_0x63c6('0x4c')]);_0x5c8fc9['query']=_['keys'](_0xfc2918[_0x63c6('0x37')]);_0x5c8fc9[_0x63c6('0x39')]=_[_0x63c6('0x3b')](_0x5c8fc9[_0x63c6('0x35')],_0x5c8fc9['query']);_0xdf4f43['attributes']=_[_0x63c6('0x3b')](_0x5c8fc9['model'],qs[_0x63c6('0x3c')](_0xfc2918[_0x63c6('0x37')][_0x63c6('0x3c')]));_0xdf4f43[_0x63c6('0x3a')]=_0xdf4f43[_0x63c6('0x3a')]['length']?_0xdf4f43[_0x63c6('0x3a')]:_0x5c8fc9[_0x63c6('0x35')];if(_0xfc2918[_0x63c6('0x37')]['includeAll']){_0xdf4f43['include']=[{'all':!![]}];}_0xdf4f43=_[_0x63c6('0x42')]({},_0xdf4f43,_0xfc2918[_0x63c6('0x46')]);return db[_0x63c6('0x33')][_0x63c6('0x4d')](_0xdf4f43)[_0x63c6('0x1a')](handleEntityNotFound(_0x224f27,null))[_0x63c6('0x1a')](respondWithResult(_0x224f27,null))[_0x63c6('0x24')](handleError(_0x224f27,null));};exports['clone']=function(_0x257821,_0x407d36){var _0xf93bac={'where':{'id':_0x257821[_0x63c6('0x4b')]['id']}},_0x109a67={};_0x109a67[_0x63c6('0x35')]=_[_0x63c6('0x38')](db['Trunk']['rawAttributes']);_0xf93bac[_0x63c6('0x3a')]=_[_0x63c6('0x3b')](_0x109a67[_0x63c6('0x35')],qs['fields'](_0x257821[_0x63c6('0x37')][_0x63c6('0x3c')]));_0xf93bac[_0x63c6('0x3a')]=_0xf93bac[_0x63c6('0x3a')][_0x63c6('0x3d')]?_0xf93bac[_0x63c6('0x3a')]:_0x109a67[_0x63c6('0x35')];if(_0x257821[_0x63c6('0x37')][_0x63c6('0x47')]){_0xf93bac[_0x63c6('0x4e')]=[{'all':!![]}];}_0xf93bac=_['merge']({},_0xf93bac,_0x257821[_0x63c6('0x46')]);return db['Trunk']['find'](_0xf93bac)[_0x63c6('0x1a')](handleEntityNotFound(_0x407d36,null))['then'](function(_0x201e2e){if(_0x201e2e){var _0x162fbf=_0x201e2e[_0x63c6('0x2c')]({'plain':!![]});_0x162fbf=qs[_0x63c6('0x4f')](_0x162fbf,['id','createdAt',_0x63c6('0x50')]);_0x257821[_0x63c6('0x51')]=_['omit'](_0x257821[_0x63c6('0x51')],['id',_0x63c6('0x52'),'updatedAt']);return db[_0x63c6('0x33')][_0x63c6('0x53')](_['merge'](_0x162fbf,_0x257821['body']),{'include':_0x257821[_0x63c6('0x37')][_0x63c6('0x47')]?[{'all':!![]}]:undefined})[_0x63c6('0x1a')](function(_0x5681fe){var _0x45372a=_0x257821['user'][_0x63c6('0x2c')]({'plain':!![]});if(!_0x45372a)throw new Error(_0x63c6('0x54'));if(_0x45372a[_0x63c6('0x55')]===_0x63c6('0x56')){var _0x288516=_0x5681fe[_0x63c6('0x2c')]({'plain':!![]});var _0x56636d='Trunks';return db[_0x63c6('0x57')][_0x63c6('0x4d')]({'where':{'name':_0x56636d,'userProfileId':_0x45372a['userProfileId']},'raw':!![]})[_0x63c6('0x1a')](function(_0x4f62e8){if(_0x4f62e8&&_0x4f62e8[_0x63c6('0x58')]===0x0){return db[_0x63c6('0x59')][_0x63c6('0x53')]({'name':_0x288516[_0x63c6('0x30')],'resourceId':_0x288516['id'],'type':_0x4f62e8[_0x63c6('0x30')],'sectionId':_0x4f62e8['id']},{})['then'](function(){return _0x5681fe;});}else{return _0x5681fe;}})[_0x63c6('0x24')](function(_0x176f41){logger['error'](_0x63c6('0x5a'),_0x176f41);throw _0x176f41;});}return _0x5681fe;});}})[_0x63c6('0x1a')](respondWithResult(_0x407d36,0xc9))[_0x63c6('0x24')](handleError(_0x407d36,null));};exports[_0x63c6('0x53')]=function(_0x4e6353,_0x91e1f,_0x48c116){var _0x277879;return db[_0x63c6('0x33')][_0x63c6('0x53')](_0x4e6353[_0x63c6('0x51')],{'raw':!![]})[_0x63c6('0x1a')](function(_0x39249f){_0x277879=_0x39249f;return db[_0x63c6('0x33')][_0x63c6('0x48')]({'raw':!![]});})[_0x63c6('0x1a')](function(_0x280788){var _0x35d07f=fs[_0x63c6('0x5b')](path['join'](config[_0x63c6('0x5c')],_0x63c6('0x5d')),'utf8');var _0xccc05d=fs[_0x63c6('0x5b')](path[_0x63c6('0x5e')](config[_0x63c6('0x5c')],'server/files/templates/registry.ejs'),_0x63c6('0x5f'));var _0x36f60c=ejs[_0x63c6('0x60')](_0x35d07f,{'trunks':_0x280788||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x36f60c);if(_0x277879[_0x63c6('0x61')]){var _0x4f0585=ejs[_0x63c6('0x60')](_0xccc05d,{'trunks':_0x280788||[]});fs[_0x63c6('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x4f0585);}})['then'](function(){return respondWithRpcPromise(_0x63c6('0x63'),_0x63c6('0x53'),{'module':_0x63c6('0x64')});})[_0x63c6('0x1a')](function(){var _0x11ddb2=_0x4e6353[_0x63c6('0x56')]['get']({'plain':!![]});if(!_0x11ddb2)throw new Error(_0x63c6('0x54'));if(_0x11ddb2[_0x63c6('0x55')]===_0x63c6('0x56')){var _0xf4cae0=_0x277879['get']({'plain':!![]});return db[_0x63c6('0x57')][_0x63c6('0x4d')]({'where':{'name':'Trunks','userProfileId':_0x11ddb2[_0x63c6('0x65')]},'raw':!![]})[_0x63c6('0x1a')](function(_0x3ec2d4){if(_0x3ec2d4&&_0x3ec2d4[_0x63c6('0x58')]===0x0){return db[_0x63c6('0x59')]['create']({'name':_0xf4cae0[_0x63c6('0x30')],'resourceId':_0xf4cae0['id'],'type':_0x3ec2d4[_0x63c6('0x30')],'sectionId':_0x3ec2d4['id']},{})[_0x63c6('0x1a')](function(){return _0x277879;});}else{return _0x277879;}})['catch'](function(_0xe82035){logger['error'](_0x63c6('0x5a'),_0xe82035);throw _0xe82035;});}return _0x277879;})[_0x63c6('0x1a')](respondWithResult(_0x91e1f,0xc9))[_0x63c6('0x24')](handleError(_0x91e1f,null));};exports[_0x63c6('0x2b')]=function(_0x593acd,_0x7d9e8d,_0x5692c9){var _0x2531cb;return db[_0x63c6('0x33')][_0x63c6('0x4d')]({'where':{'id':_0x593acd[_0x63c6('0x4b')]['id']}})[_0x63c6('0x1a')](handleEntityNotFound(_0x7d9e8d,null))[_0x63c6('0x1a')](saveUpdates(_0x593acd[_0x63c6('0x51')],null))[_0x63c6('0x1a')](function(_0x271ce1){if(_0x271ce1){_0x2531cb=_0x271ce1;return db[_0x63c6('0x33')][_0x63c6('0x48')]({'raw':!![]});}})[_0x63c6('0x1a')](function(_0x3608e2){if(_0x3608e2){var _0x251ea8=fs[_0x63c6('0x5b')](path[_0x63c6('0x5e')](config[_0x63c6('0x5c')],_0x63c6('0x5d')),_0x63c6('0x5f'));var _0x4c6bd6=fs['readFileSync'](path[_0x63c6('0x5e')](config[_0x63c6('0x5c')],_0x63c6('0x66')),_0x63c6('0x5f'));var _0x2437b6=ejs[_0x63c6('0x60')](_0x251ea8,{'trunks':_0x3608e2||[]});fs[_0x63c6('0x62')](_0x63c6('0x67'),_0x2437b6);var _0xe43ee=ejs[_0x63c6('0x60')](_0x4c6bd6,{'trunks':_0x3608e2||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xe43ee);return respondWithRpcPromise(_0x63c6('0x63'),_0x63c6('0x2b'),{'module':_0x63c6('0x64')});}return null;})[_0x63c6('0x1a')](function(_0x40d7c3){if(_0x40d7c3){return _0x2531cb;}})[_0x63c6('0x1a')](respondWithResult(_0x7d9e8d,null))[_0x63c6('0x24')](handleError(_0x7d9e8d,null));};exports[_0x63c6('0x68')]=function(_0x1c1fa7,_0x392d49,_0x299bda){var _0x222f56;return db['Trunk'][_0x63c6('0x4d')]({'where':{'id':_0x1c1fa7[_0x63c6('0x4b')]['id']}})[_0x63c6('0x1a')](handleEntityNotFound(_0x392d49,null))[_0x63c6('0x1a')](removeEntity(_0x392d49,null))[_0x63c6('0x1a')](function(){return db[_0x63c6('0x33')][_0x63c6('0x48')]({'raw':!![]});})[_0x63c6('0x1a')](function(_0x178ba0){var _0x2e7ba3=fs[_0x63c6('0x5b')](path[_0x63c6('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x12846d=fs[_0x63c6('0x5b')](path[_0x63c6('0x5e')](config[_0x63c6('0x5c')],_0x63c6('0x66')),_0x63c6('0x5f'));var _0x194ec8=ejs[_0x63c6('0x60')](_0x2e7ba3,{'trunks':_0x178ba0});var _0x4482d6=ejs[_0x63c6('0x60')](_0x12846d,{'trunks':_0x178ba0});fs[_0x63c6('0x62')](_0x63c6('0x67'),_0x194ec8);fs[_0x63c6('0x62')](_0x63c6('0x69'),_0x4482d6);return respondWithRpcPromise(_0x63c6('0x63'),_0x63c6('0x68'),{'module':_0x63c6('0x64')});})[_0x63c6('0x24')](handleError(_0x392d49,null));}; \ No newline at end of file +var _0x6017=['get','UserProfileResource','end','sendStatus','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','params','keys','options','find','clone','include','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','root','readFileSync','join','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','utf8','Reload','server/files/templates/trunk.ejs','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../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','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','status','count','offset','limit','json','apply','update','destroy'];(function(_0x44b838,_0x1192c5){var _0x20f32e=function(_0x41126c){while(--_0x41126c){_0x44b838['push'](_0x44b838['shift']());}};_0x20f32e(++_0x1192c5);}(_0x6017,0xae));var _0x7601=function(_0x1308a4,_0x3e40ab){_0x1308a4=_0x1308a4-0x0;var _0x304bfb=_0x6017[_0x1308a4];return _0x304bfb;};'use strict';var pdf=require(_0x7601('0x0'));var emlformat=require(_0x7601('0x1'));var rimraf=require(_0x7601('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7601('0x3'));var rp=require(_0x7601('0x4'));var moment=require('moment');var BPromise=require(_0x7601('0x5'));var Mustache=require('mustache');var util=require(_0x7601('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7601('0x7'));var ejs=require(_0x7601('0x8'));var fs=require('fs');var _=require(_0x7601('0x9'));var squel=require(_0x7601('0xa'));var crypto=require(_0x7601('0xb'));var jsforce=require(_0x7601('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7601('0x7'));var querystring=require(_0x7601('0xd'));var Papa=require(_0x7601('0xe'));var Redis=require('ioredis');var authService=require(_0x7601('0xf'));var qs=require(_0x7601('0x10'));var as=require(_0x7601('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7601('0x12'))(_0x7601('0x13'));var utils=require(_0x7601('0x14'));var config=require(_0x7601('0x15'));var db=require(_0x7601('0x16'))['db'];var jayson=require(_0x7601('0x17'));var client=jayson[_0x7601('0x18')][_0x7601('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2f5dbf,_0x40fc89,_0x5a4799){if(_0x5a4799){var _0x36d776=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36d776['test'](_0x40fc89)){return _0x2f5dbf;}else{throw new db[(_0x7601('0x1a'))][(_0x7601('0x1b'))](_0x7601('0x1c'));}}else{return _0x2f5dbf;}}function respondWithRpcPromise(_0x263314,_0x33452d,_0x30b86d,_0x3a1706){return new BPromise(function(_0xdd9b16,_0xdfb58a){var _0x5e99b9=_0x3a1706||client;return _0x5e99b9[_0x7601('0x1d')](_0x263314,_0x30b86d)[_0x7601('0x1e')](function(_0x5329e6){logger[_0x7601('0x1f')]('Trunk,\x20%s,\x20%s',_0x33452d,'request\x20sent');logger[_0x7601('0x20')](_0x7601('0x21'),_0x33452d,_0x7601('0x22'),JSON[_0x7601('0x23')](_0x5329e6));if(_0x5329e6[_0x7601('0x24')]){if(_0x5329e6[_0x7601('0x24')][_0x7601('0x25')]===0x1f4){logger['error'](_0x7601('0x26'),_0x33452d,_0x5329e6[_0x7601('0x24')]['message']);return _0xdfb58a(_0x5329e6[_0x7601('0x24')][_0x7601('0x27')]);}logger[_0x7601('0x24')](_0x7601('0x26'),_0x33452d,_0x5329e6[_0x7601('0x24')][_0x7601('0x27')]);return _0xdd9b16(_0x5329e6['error'][_0x7601('0x27')]);}else{logger[_0x7601('0x1f')](_0x7601('0x26'),_0x33452d,_0x7601('0x22'));_0xdd9b16(_0x5329e6['result'][_0x7601('0x27')]);}})['catch'](function(_0x44944f){logger['error']('Trunk,\x20%s,\x20%s',_0x33452d,_0x44944f);_0xdfb58a(_0x44944f);});});}function respondWithStatusCode(_0x326f8f,_0x1eb68c){_0x1eb68c=_0x1eb68c||0xcc;return function(_0x5277d0){if(_0x5277d0){return _0x326f8f['sendStatus'](_0x1eb68c);}return _0x326f8f[_0x7601('0x28')](_0x1eb68c)['end']();};}function respondWithResult(_0x57f6e9,_0x33f5ef){_0x33f5ef=_0x33f5ef||0xc8;return function(_0x3501ec){if(_0x3501ec){return _0x57f6e9[_0x7601('0x28')](_0x33f5ef)['json'](_0x3501ec);}};}function respondWithFilteredResult(_0xfcc562,_0x4a2321){return function(_0x3f49b2){if(_0x3f49b2){var _0xa05dda=_0x3f49b2[_0x7601('0x29')],_0x58fd92=_0x4a2321[_0x7601('0x2a')],_0x4ab32d=_0x4a2321[_0x7601('0x2a')]+_0x4a2321[_0x7601('0x2b')],_0x44d765;if(_0x4ab32d>=_0xa05dda){_0x4ab32d=_0xa05dda;_0x44d765=0xc8;}else{_0x44d765=0xce;}_0xfcc562[_0x7601('0x28')](_0x44d765);return _0xfcc562['set']('Content-Range',_0x58fd92+'-'+_0x4ab32d+'/'+_0xa05dda)[_0x7601('0x2c')](_0x3f49b2);}return null;};}function patchUpdates(_0x170d27){return function(_0xa483c4){try{jsonpatch[_0x7601('0x2d')](_0xa483c4,_0x170d27,!![]);}catch(_0x1b3ec1){return BPromise['reject'](_0x1b3ec1);}return _0xa483c4['save']();};}function saveUpdates(_0xfdb5e3,_0x27862b){return function(_0x473481){if(_0x473481){return _0x473481[_0x7601('0x2e')](_0xfdb5e3)[_0x7601('0x1e')](function(_0x58cd75){return _0x58cd75;});}return null;};}function removeEntity(_0x22b9c9,_0xc1e02c){return function(_0x5552a1){if(_0x5552a1){return _0x5552a1[_0x7601('0x2f')]()[_0x7601('0x1e')](function(){var _0x246aaf=_0x5552a1[_0x7601('0x30')]({'plain':!![]});var _0x1f9d17='Trunks';return db[_0x7601('0x31')][_0x7601('0x2f')]({'where':{'type':_0x1f9d17,'resourceId':_0x246aaf['id']}})[_0x7601('0x1e')](function(){return _0x5552a1;});})[_0x7601('0x1e')](function(){_0x22b9c9['status'](0xcc)[_0x7601('0x32')]();});}};}function handleEntityNotFound(_0x48e00f,_0x56b9df){return function(_0x928b6d){if(!_0x928b6d){_0x48e00f[_0x7601('0x33')](0x194);}return _0x928b6d;};}function handleError(_0x46d013,_0x1281c1){_0x1281c1=_0x1281c1||0x1f4;return function(_0x206bab){logger[_0x7601('0x24')](_0x206bab[_0x7601('0x34')]);if(_0x206bab[_0x7601('0x35')]){delete _0x206bab[_0x7601('0x35')];}_0x46d013[_0x7601('0x28')](_0x1281c1)[_0x7601('0x36')](_0x206bab);};}exports[_0x7601('0x37')]=function(_0x16207e,_0x30c3cc){var _0x555862={},_0x438f2c={},_0x372193={'count':0x0,'rows':[]};var _0x4298d0=_[_0x7601('0x38')](db[_0x7601('0x39')][_0x7601('0x3a')],function(_0x4fb8f7){return{'name':_0x4fb8f7[_0x7601('0x3b')],'type':_0x4fb8f7[_0x7601('0x3c')]['key']};});_0x438f2c[_0x7601('0x3d')]=_['map'](_0x4298d0,_0x7601('0x35'));_0x438f2c['query']=_['keys'](_0x16207e['query']);_0x438f2c[_0x7601('0x3e')]=_[_0x7601('0x3f')](_0x438f2c[_0x7601('0x3d')],_0x438f2c[_0x7601('0x40')]);_0x555862['attributes']=_[_0x7601('0x3f')](_0x438f2c['model'],qs[_0x7601('0x41')](_0x16207e[_0x7601('0x40')][_0x7601('0x41')]));_0x555862[_0x7601('0x42')]=_0x555862[_0x7601('0x42')][_0x7601('0x43')]?_0x555862['attributes']:_0x438f2c[_0x7601('0x3d')];if(!_0x16207e['query'][_0x7601('0x44')](_0x7601('0x45'))){_0x555862['limit']=qs['limit'](_0x16207e['query']['limit']);_0x555862[_0x7601('0x2a')]=qs[_0x7601('0x2a')](_0x16207e[_0x7601('0x40')][_0x7601('0x2a')]);}_0x555862[_0x7601('0x46')]=qs[_0x7601('0x47')](_0x16207e[_0x7601('0x40')][_0x7601('0x47')]);_0x555862[_0x7601('0x48')]=qs[_0x7601('0x3e')](_[_0x7601('0x49')](_0x16207e[_0x7601('0x40')],_0x438f2c[_0x7601('0x3e')]),_0x4298d0);if(_0x16207e[_0x7601('0x40')][_0x7601('0x4a')]){_0x555862[_0x7601('0x48')]=_['merge'](_0x555862[_0x7601('0x48')],{'$or':_[_0x7601('0x38')](_0x4298d0,function(_0x740a4d){if(_0x740a4d[_0x7601('0x3c')]!==_0x7601('0x4b')){var _0x53afce={};_0x53afce[_0x740a4d[_0x7601('0x35')]]={'$like':'%'+_0x16207e['query'][_0x7601('0x4a')]+'%'};return _0x53afce;}})});}_0x555862=_[_0x7601('0x4c')]({},_0x555862,_0x16207e['options']);var _0x515153={'where':_0x555862[_0x7601('0x48')]};return db[_0x7601('0x39')][_0x7601('0x29')](_0x515153)[_0x7601('0x1e')](function(_0x3e05df){_0x372193[_0x7601('0x29')]=_0x3e05df;if(_0x16207e['query'][_0x7601('0x4d')]){_0x555862['include']=[{'all':!![]}];}return db['Trunk'][_0x7601('0x4e')](_0x555862);})[_0x7601('0x1e')](function(_0xe7c6a4){_0x372193['rows']=_0xe7c6a4;return _0x372193;})[_0x7601('0x1e')](respondWithFilteredResult(_0x30c3cc,_0x555862))[_0x7601('0x4f')](handleError(_0x30c3cc,null));};exports['show']=function(_0x3a5046,_0x21c366){var _0x390b44={'raw':![],'where':{'id':_0x3a5046[_0x7601('0x50')]['id']}},_0x24c28a={};_0x24c28a[_0x7601('0x3d')]=_[_0x7601('0x51')](db['Trunk'][_0x7601('0x3a')]);_0x24c28a[_0x7601('0x40')]=_[_0x7601('0x51')](_0x3a5046['query']);_0x24c28a[_0x7601('0x3e')]=_[_0x7601('0x3f')](_0x24c28a[_0x7601('0x3d')],_0x24c28a[_0x7601('0x40')]);_0x390b44[_0x7601('0x42')]=_['intersection'](_0x24c28a[_0x7601('0x3d')],qs[_0x7601('0x41')](_0x3a5046[_0x7601('0x40')][_0x7601('0x41')]));_0x390b44[_0x7601('0x42')]=_0x390b44[_0x7601('0x42')]['length']?_0x390b44[_0x7601('0x42')]:_0x24c28a[_0x7601('0x3d')];if(_0x3a5046[_0x7601('0x40')][_0x7601('0x4d')]){_0x390b44['include']=[{'all':!![]}];}_0x390b44=_[_0x7601('0x4c')]({},_0x390b44,_0x3a5046[_0x7601('0x52')]);return db[_0x7601('0x39')][_0x7601('0x53')](_0x390b44)[_0x7601('0x1e')](handleEntityNotFound(_0x21c366,null))[_0x7601('0x1e')](respondWithResult(_0x21c366,null))[_0x7601('0x4f')](handleError(_0x21c366,null));};exports[_0x7601('0x54')]=function(_0x1d05e5,_0xb77fc5){var _0x46cb6b={'where':{'id':_0x1d05e5[_0x7601('0x50')]['id']}},_0x337b47={};_0x337b47['model']=_[_0x7601('0x51')](db['Trunk']['rawAttributes']);_0x46cb6b[_0x7601('0x42')]=_[_0x7601('0x3f')](_0x337b47[_0x7601('0x3d')],qs[_0x7601('0x41')](_0x1d05e5[_0x7601('0x40')][_0x7601('0x41')]));_0x46cb6b[_0x7601('0x42')]=_0x46cb6b[_0x7601('0x42')]['length']?_0x46cb6b[_0x7601('0x42')]:_0x337b47[_0x7601('0x3d')];if(_0x1d05e5[_0x7601('0x40')][_0x7601('0x4d')]){_0x46cb6b[_0x7601('0x55')]=[{'all':!![]}];}_0x46cb6b=_[_0x7601('0x4c')]({},_0x46cb6b,_0x1d05e5[_0x7601('0x52')]);return db['Trunk'][_0x7601('0x53')](_0x46cb6b)['then'](handleEntityNotFound(_0xb77fc5,null))[_0x7601('0x1e')](function(_0x5d4815){if(_0x5d4815){var _0x3fec3f=_0x5d4815[_0x7601('0x30')]({'plain':!![]});_0x3fec3f=qs[_0x7601('0x56')](_0x3fec3f,['id',_0x7601('0x57'),_0x7601('0x58')]);_0x1d05e5[_0x7601('0x59')]=_[_0x7601('0x56')](_0x1d05e5[_0x7601('0x59')],['id',_0x7601('0x57'),_0x7601('0x58')]);return db['Trunk'][_0x7601('0x5a')](_[_0x7601('0x4c')](_0x3fec3f,_0x1d05e5[_0x7601('0x59')]),{'include':_0x1d05e5[_0x7601('0x40')][_0x7601('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x2076c7){var _0x2d68bb=_0x1d05e5[_0x7601('0x5b')][_0x7601('0x30')]({'plain':!![]});if(!_0x2d68bb)throw new Error(_0x7601('0x5c'));if(_0x2d68bb[_0x7601('0x5d')]===_0x7601('0x5b')){var _0x24edfc=_0x2076c7[_0x7601('0x30')]({'plain':!![]});var _0x8ced2d=_0x7601('0x5e');return db[_0x7601('0x5f')][_0x7601('0x53')]({'where':{'name':_0x8ced2d,'userProfileId':_0x2d68bb[_0x7601('0x60')]},'raw':!![]})[_0x7601('0x1e')](function(_0x55833b){if(_0x55833b&&_0x55833b[_0x7601('0x61')]===0x0){return db['UserProfileResource'][_0x7601('0x5a')]({'name':_0x24edfc[_0x7601('0x35')],'resourceId':_0x24edfc['id'],'type':_0x55833b[_0x7601('0x35')],'sectionId':_0x55833b['id']},{})[_0x7601('0x1e')](function(){return _0x2076c7;});}else{return _0x2076c7;}})[_0x7601('0x4f')](function(_0x45d51e){logger[_0x7601('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45d51e);throw _0x45d51e;});}return _0x2076c7;});}})[_0x7601('0x1e')](respondWithResult(_0xb77fc5,0xc9))[_0x7601('0x4f')](handleError(_0xb77fc5,null));};exports[_0x7601('0x5a')]=function(_0x4b6561,_0x2b5f6d,_0x4e9ee8){var _0x5ec33a;return db[_0x7601('0x39')][_0x7601('0x5a')](_0x4b6561['body'],{'raw':!![]})[_0x7601('0x1e')](function(_0x5e631f){_0x5ec33a=_0x5e631f;return db['Trunk'][_0x7601('0x4e')]({'raw':!![]});})[_0x7601('0x1e')](function(_0x543767){var _0x274d49=fs['readFileSync'](path['join'](config[_0x7601('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x87b0d8=fs[_0x7601('0x63')](path[_0x7601('0x64')](config[_0x7601('0x62')],_0x7601('0x65')),'utf8');var _0x669f16=ejs['render'](_0x274d49,{'trunks':_0x543767||[]});fs[_0x7601('0x66')](_0x7601('0x67'),_0x669f16);if(_0x5ec33a[_0x7601('0x68')]){var _0x357fed=ejs[_0x7601('0x69')](_0x87b0d8,{'trunks':_0x543767||[]});fs['writeFileSync'](_0x7601('0x6a'),_0x357fed);}})[_0x7601('0x1e')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x7601('0x6b')});})[_0x7601('0x1e')](function(){var _0x3ee6a9=_0x4b6561[_0x7601('0x5b')][_0x7601('0x30')]({'plain':!![]});if(!_0x3ee6a9)throw new Error(_0x7601('0x5c'));if(_0x3ee6a9['role']==='user'){var _0xebd556=_0x5ec33a['get']({'plain':!![]});return db[_0x7601('0x5f')][_0x7601('0x53')]({'where':{'name':_0x7601('0x5e'),'userProfileId':_0x3ee6a9[_0x7601('0x60')]},'raw':!![]})[_0x7601('0x1e')](function(_0x3854fe){if(_0x3854fe&&_0x3854fe[_0x7601('0x61')]===0x0){return db[_0x7601('0x31')]['create']({'name':_0xebd556[_0x7601('0x35')],'resourceId':_0xebd556['id'],'type':_0x3854fe[_0x7601('0x35')],'sectionId':_0x3854fe['id']},{})[_0x7601('0x1e')](function(){return _0x5ec33a;});}else{return _0x5ec33a;}})[_0x7601('0x4f')](function(_0x416b87){logger[_0x7601('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x416b87);throw _0x416b87;});}return _0x5ec33a;})['then'](respondWithResult(_0x2b5f6d,0xc9))[_0x7601('0x4f')](handleError(_0x2b5f6d,null));};exports[_0x7601('0x2e')]=function(_0x3f9f71,_0x187bf4,_0x4878ff){var _0x2fffe8;return db[_0x7601('0x39')]['find']({'where':{'id':_0x3f9f71[_0x7601('0x50')]['id']}})['then'](handleEntityNotFound(_0x187bf4,null))[_0x7601('0x1e')](saveUpdates(_0x3f9f71[_0x7601('0x59')],null))[_0x7601('0x1e')](function(_0x3e808f){if(_0x3e808f){_0x2fffe8=_0x3e808f;return db[_0x7601('0x39')][_0x7601('0x4e')]({'raw':!![]});}})[_0x7601('0x1e')](function(_0x846ad7){if(_0x846ad7){var _0x37d4d7=fs[_0x7601('0x63')](path['join'](config[_0x7601('0x62')],'server/files/templates/trunk.ejs'),_0x7601('0x6c'));var _0x2df919=fs[_0x7601('0x63')](path['join'](config[_0x7601('0x62')],_0x7601('0x65')),_0x7601('0x6c'));var _0x1dc9e2=ejs[_0x7601('0x69')](_0x37d4d7,{'trunks':_0x846ad7||[]});fs[_0x7601('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1dc9e2);var _0x571633=ejs[_0x7601('0x69')](_0x2df919,{'trunks':_0x846ad7||[]});fs['writeFileSync'](_0x7601('0x6a'),_0x571633);return respondWithRpcPromise(_0x7601('0x6d'),_0x7601('0x2e'),{'module':_0x7601('0x6b')});}return null;})[_0x7601('0x1e')](function(_0x32af44){if(_0x32af44){return _0x2fffe8;}})['then'](respondWithResult(_0x187bf4,null))['catch'](handleError(_0x187bf4,null));};exports[_0x7601('0x2f')]=function(_0x4f736d,_0x12e007,_0x57826d){var _0x3f08fa;return db[_0x7601('0x39')][_0x7601('0x53')]({'where':{'id':_0x4f736d[_0x7601('0x50')]['id']}})['then'](handleEntityNotFound(_0x12e007,null))['then'](removeEntity(_0x12e007,null))['then'](function(){return db[_0x7601('0x39')][_0x7601('0x4e')]({'raw':!![]});})[_0x7601('0x1e')](function(_0x3b9db2){var _0x4ef015=fs[_0x7601('0x63')](path[_0x7601('0x64')](config['root'],_0x7601('0x6e')),'utf8');var _0x444507=fs['readFileSync'](path[_0x7601('0x64')](config[_0x7601('0x62')],_0x7601('0x65')),_0x7601('0x6c'));var _0x5dcc61=ejs['render'](_0x4ef015,{'trunks':_0x3b9db2});var _0x5bbb34=ejs[_0x7601('0x69')](_0x444507,{'trunks':_0x3b9db2});fs[_0x7601('0x66')](_0x7601('0x67'),_0x5dcc61);fs[_0x7601('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x5bbb34);return respondWithRpcPromise(_0x7601('0x6d'),_0x7601('0x2f'),{'module':_0x7601('0x6b')});})[_0x7601('0x4f')](handleError(_0x12e007,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 05791d0..f2d370e 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 _0x94f2=['exports','define','util','api','bluebird','request-promise','./trunk.attributes'];(function(_0x494a42,_0x1f2103){var _0x254792=function(_0x5f1c1d){while(--_0x5f1c1d){_0x494a42['push'](_0x494a42['shift']());}};_0x254792(++_0x1f2103);}(_0x94f2,0x1c9));var _0x294f=function(_0x8029b0,_0x21246b){_0x8029b0=_0x8029b0-0x0;var _0x28421b=_0x94f2[_0x8029b0];return _0x28421b;};'use strict';var _=require('lodash');var util=require(_0x294f('0x0'));var logger=require('../../config/logger')(_0x294f('0x1'));var moment=require('moment');var BPromise=require(_0x294f('0x2'));var rp=require(_0x294f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x294f('0x4'));module[_0x294f('0x5')]=function(_0x3526ad,_0x4cefc8){return _0x3526ad[_0x294f('0x6')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x738f=['tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Trunk'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x738f,0x109));var _0xf738=function(_0x462729,_0x226b5a){_0x462729=_0x462729-0x0;var _0x107767=_0x738f[_0x462729];return _0x107767;};'use strict';var _=require(_0xf738('0x0'));var util=require(_0xf738('0x1'));var logger=require(_0xf738('0x2'))(_0xf738('0x3'));var moment=require(_0xf738('0x4'));var BPromise=require('bluebird');var rp=require(_0xf738('0x5'));var fs=require('fs');var path=require(_0xf738('0x6'));var rimraf=require(_0xf738('0x7'));var config=require(_0xf738('0x8'));var attributes=require('./trunk.attributes');module[_0xf738('0x9')]=function(_0x157e6b,_0x44939a){return _0x157e6b['define'](_0xf738('0xa'),attributes,{'tableName':_0xf738('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index cf6444d..e6fac3e 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 _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0xb32732,_0x14994a){var _0x2a6eb6=function(_0x426f26){while(--_0x426f26){_0xb32732['push'](_0xb32732['shift']());}};_0x2a6eb6(++_0x14994a);}(_0x14a0,0x8e));var _0x014a=function(_0x1f30c5,_0x327099){_0x1f30c5=_0x1f30c5-0x0;var _0x5c18ff=_0x14a0[_0x1f30c5];return _0x5c18ff;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file +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(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x1a85,0x178));var _0x51a8=function(_0x2acd35,_0x2b21df){_0x2acd35=_0x2acd35-0x0;var _0x272693=_0x1a85[_0x2acd35];return _0x272693;};'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 diff --git a/server/api/user/index.js b/server/api/user/index.js index e49ecb9..f1f7e9b 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 _0xa932=['format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','/:id/avatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','getLists','/:id/agents','getAgents','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','root','server/files/images/'];(function(_0x27714d,_0x457b53){var _0x18e2fb=function(_0x28f1d9){while(--_0x28f1d9){_0x27714d['push'](_0x27714d['shift']());}};_0x18e2fb(++_0x457b53);}(_0xa932,0x112));var _0x2a93=function(_0x25483f,_0x43852f){_0x25483f=_0x25483f-0x0;var _0x220d13=_0xa932[_0x25483f];return _0x220d13;};'use strict';var multer=require(_0x2a93('0x0'));var util=require(_0x2a93('0x1'));var path=require(_0x2a93('0x2'));var timeout=require(_0x2a93('0x3'));var express=require(_0x2a93('0x4'));var router=express[_0x2a93('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2a93('0x6'));var config=require(_0x2a93('0x7'));var controller=require(_0x2a93('0x8'));router[_0x2a93('0x9')]('/',auth[_0x2a93('0xa')](),controller[_0x2a93('0xb')]);router[_0x2a93('0x9')](_0x2a93('0xc'),auth[_0x2a93('0xa')](),controller['describe']);router[_0x2a93('0x9')](_0x2a93('0xd'),auth['isAuthenticated'](),controller[_0x2a93('0xe')]);router[_0x2a93('0x9')](_0x2a93('0xf'),auth['isAuthenticated'](),controller[_0x2a93('0x10')]);router[_0x2a93('0x9')](_0x2a93('0x11'),controller['getAvatar']);router[_0x2a93('0x9')](_0x2a93('0x12'),auth[_0x2a93('0xa')](),controller['getContacts']);router[_0x2a93('0x9')](_0x2a93('0x13'),auth['isAuthenticated'](),controller[_0x2a93('0x14')]);router['get'](_0x2a93('0x15'),auth[_0x2a93('0xa')](),controller['getVoiceQueuesRt']);router[_0x2a93('0x9')](_0x2a93('0x16'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x17')]);router['get'](_0x2a93('0x18'),auth[_0x2a93('0xa')](),controller['getRecordings']);router['get'](_0x2a93('0x19'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x1a')]);router[_0x2a93('0x9')](_0x2a93('0x1b'),auth['isAuthenticated'](),controller[_0x2a93('0x1c')]);router['get'](_0x2a93('0x1d'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x1e')]);router[_0x2a93('0x9')](_0x2a93('0x1f'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x20')]);router[_0x2a93('0x9')]('/:id/sms/interactions',auth[_0x2a93('0xa')](),controller[_0x2a93('0x21')]);router['get'](_0x2a93('0x22'),auth['isAuthenticated'](),controller[_0x2a93('0x23')]);router[_0x2a93('0x9')](_0x2a93('0x24'),auth[_0x2a93('0xa')](),controller['getWhatsappInteractions']);router[_0x2a93('0x9')]('/:id/teams',auth[_0x2a93('0xa')](),controller[_0x2a93('0x25')]);router[_0x2a93('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2a93('0x26')]);router[_0x2a93('0x9')](_0x2a93('0x27'),auth['isAuthenticated'](),controller[_0x2a93('0x28')]);router['get']('/:id/prefixes',auth[_0x2a93('0xa')](),controller['getVoicePrefixes']);router[_0x2a93('0x9')](_0x2a93('0x29'),auth[_0x2a93('0xa')](),controller['getFaxAccounts']);router[_0x2a93('0x9')](_0x2a93('0x2a'),auth[_0x2a93('0xa')](),controller['getMailAccounts']);router['get'](_0x2a93('0x2b'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x2a93('0x9')](_0x2a93('0x2c'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x2d')]);router[_0x2a93('0x9')](_0x2a93('0x2e'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x2f')]);router[_0x2a93('0x9')](_0x2a93('0x30'),auth[_0x2a93('0xa')](),controller['getWhatsappAccounts']);router['get'](_0x2a93('0x31'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x32')]);router[_0x2a93('0x9')](_0x2a93('0x33'),auth['isAuthenticated'](),controller[_0x2a93('0x34')]);router[_0x2a93('0x9')]('/:id/api_key',auth[_0x2a93('0xa')](),controller['getApiKey']);router[_0x2a93('0x35')](_0x2a93('0x36'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x37')]);router['post']('/:id/contacts',auth[_0x2a93('0xa')](),controller[_0x2a93('0x38')]);router['post']('/',auth[_0x2a93('0xa')](),controller[_0x2a93('0x39')]);router[_0x2a93('0x35')](_0x2a93('0x13'),auth['isAuthenticated'](),controller[_0x2a93('0x3a')]);var upload=multer({'storage':multer[_0x2a93('0x3b')]({'destination':function(_0x51d037,_0x31247f,_0x32d908){_0x32d908(null,path['join'](config[_0x2a93('0x3c')],_0x2a93('0x3d')));},'filename':function(_0xbd9b6d,_0x4722d0,_0x367bf6){_0x367bf6(null,util[_0x2a93('0x3e')](_0x2a93('0x3f'),Date[_0x2a93('0x40')](),_0x4722d0[_0x2a93('0x41')]));}})});router['post'](_0x2a93('0x11'),upload[_0x2a93('0x42')]('file'),controller[_0x2a93('0x43')]);router[_0x2a93('0x35')](_0x2a93('0x44'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x45')]);router[_0x2a93('0x35')](_0x2a93('0x46'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x47')]);router[_0x2a93('0x35')](_0x2a93('0x48'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x49')]);router[_0x2a93('0x35')]('/:id/unpause',auth[_0x2a93('0xa')](),controller[_0x2a93('0x4a')]);router['post'](_0x2a93('0x4b'),auth[_0x2a93('0xa')](),controller['addTeams']);router[_0x2a93('0x35')](_0x2a93('0x4c'),auth['isAuthenticated'](),controller[_0x2a93('0x4d')]);router[_0x2a93('0x35')](_0x2a93('0x4e'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x4f')]);router[_0x2a93('0x35')](_0x2a93('0x50'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x51')]);router[_0x2a93('0x35')](_0x2a93('0x52'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x53')]);router[_0x2a93('0x35')]('/:id/openchannel_interactions',auth[_0x2a93('0xa')](),controller[_0x2a93('0x54')]);router[_0x2a93('0x35')](_0x2a93('0x55'),auth[_0x2a93('0xa')](),controller['addWhatsappInteractions']);router[_0x2a93('0x35')](_0x2a93('0x29'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x56')]);router[_0x2a93('0x35')](_0x2a93('0x2a'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x57')]);router[_0x2a93('0x35')](_0x2a93('0x2b'),auth[_0x2a93('0xa')](),controller['addOpenchannelAccounts']);router[_0x2a93('0x35')](_0x2a93('0x2c'),auth['isAuthenticated'](),controller[_0x2a93('0x58')]);router[_0x2a93('0x35')](_0x2a93('0x2e'),auth[_0x2a93('0xa')](),controller['addChatWebsites']);router[_0x2a93('0x35')]('/:id/whatsapp_accounts',auth[_0x2a93('0xa')](),controller[_0x2a93('0x59')]);router[_0x2a93('0x35')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x2a93('0x5a')]);router[_0x2a93('0x35')](_0x2a93('0x5b'),auth['isAuthenticated'](),controller[_0x2a93('0x5c')]);router['put'](_0x2a93('0xf'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x5d')]);router[_0x2a93('0x5e')](_0x2a93('0x5f'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x60')]);router[_0x2a93('0x61')]('/:id/queues',auth[_0x2a93('0xa')](),controller[_0x2a93('0x62')]);router['delete'](_0x2a93('0x4b'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x63')]);router[_0x2a93('0x61')]('/:id',auth['isAuthenticated'](),controller[_0x2a93('0x64')]);router[_0x2a93('0x61')](_0x2a93('0x4c'),auth[_0x2a93('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x2a93('0xa')](),controller[_0x2a93('0x65')]);router[_0x2a93('0x61')](_0x2a93('0x50'),auth[_0x2a93('0xa')](),controller['removeFaxInteractions']);router[_0x2a93('0x61')](_0x2a93('0x52'),auth[_0x2a93('0xa')](),controller['removeSmsInteractions']);router[_0x2a93('0x61')](_0x2a93('0x66'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x67')]);router[_0x2a93('0x61')]('/:id/whatsapp_interactions',auth[_0x2a93('0xa')](),controller[_0x2a93('0x68')]);router[_0x2a93('0x61')](_0x2a93('0x29'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x69')]);router['delete']('/:id/mail_accounts',auth[_0x2a93('0xa')](),controller[_0x2a93('0x6a')]);router['delete'](_0x2a93('0x2b'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x6b')]);router['delete'](_0x2a93('0x2c'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x6c')]);router['delete'](_0x2a93('0x2e'),auth[_0x2a93('0xa')](),controller['removeChatWebsites']);router[_0x2a93('0x61')](_0x2a93('0x30'),auth['isAuthenticated'](),controller[_0x2a93('0x6d')]);router['delete'](_0x2a93('0x31'),auth[_0x2a93('0xa')](),controller[_0x2a93('0x6e')]);router[_0x2a93('0x61')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x2a93('0x6f')]);module['exports']=router; \ No newline at end of file +var _0x0a62=['single','addAvatar','/:id/login','/:id/pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','/:id/contacts','addQueues','diskStorage','join','root','format','%s-%s','originalname'];(function(_0x61044e,_0x19a2ff){var _0x5b8824=function(_0x1ec9cf){while(--_0x1ec9cf){_0x61044e['push'](_0x61044e['shift']());}};_0x5b8824(++_0x19a2ff);}(_0x0a62,0x1bc));var _0x20a6=function(_0x47fb54,_0x28698c){_0x47fb54=_0x47fb54-0x0;var _0x1139a7=_0x0a62[_0x47fb54];return _0x1139a7;};'use strict';var multer=require('multer');var util=require(_0x20a6('0x0'));var path=require('path');var timeout=require(_0x20a6('0x1'));var express=require(_0x20a6('0x2'));var router=express[_0x20a6('0x3')]();var auth=require(_0x20a6('0x4'));var interaction=require(_0x20a6('0x5'));var config=require('../../config/environment');var controller=require(_0x20a6('0x6'));router[_0x20a6('0x7')]('/',auth[_0x20a6('0x8')](),controller[_0x20a6('0x9')]);router[_0x20a6('0x7')](_0x20a6('0xa'),auth[_0x20a6('0x8')](),controller[_0x20a6('0xb')]);router[_0x20a6('0x7')](_0x20a6('0xc'),auth[_0x20a6('0x8')](),controller[_0x20a6('0xd')]);router['get'](_0x20a6('0xe'),auth['isAuthenticated'](),controller[_0x20a6('0xf')]);router[_0x20a6('0x7')](_0x20a6('0x10'),controller[_0x20a6('0x11')]);router[_0x20a6('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x20a6('0x7')](_0x20a6('0x12'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x13')]);router[_0x20a6('0x7')](_0x20a6('0x14'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x15')]);router[_0x20a6('0x7')](_0x20a6('0x16'),auth['isAuthenticated'](),controller['getGroups']);router[_0x20a6('0x7')]('/:id/recordings',auth[_0x20a6('0x8')](),controller[_0x20a6('0x17')]);router['get']('/:id/screen_recordings',auth[_0x20a6('0x8')](),controller['getScreenRecordings']);router[_0x20a6('0x7')](_0x20a6('0x18'),auth['isAuthenticated'](),controller[_0x20a6('0x19')]);router[_0x20a6('0x7')]('/:id/openchannel/interactions',auth[_0x20a6('0x8')](),controller[_0x20a6('0x1a')]);router[_0x20a6('0x7')]('/:id/mail/interactions',auth[_0x20a6('0x8')](),controller[_0x20a6('0x1b')]);router['get'](_0x20a6('0x1c'),auth[_0x20a6('0x8')](),controller['getSmsInteractions']);router['get'](_0x20a6('0x1d'),auth['isAuthenticated'](),controller[_0x20a6('0x1e')]);router['get'](_0x20a6('0x1f'),auth[_0x20a6('0x8')](),controller['getWhatsappInteractions']);router[_0x20a6('0x7')](_0x20a6('0x20'),auth['isAuthenticated'](),controller['getTeams']);router[_0x20a6('0x7')]('/:id/lists',auth[_0x20a6('0x8')](),controller['getLists']);router[_0x20a6('0x7')](_0x20a6('0x21'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x22')]);router[_0x20a6('0x7')]('/:id/prefixes',auth[_0x20a6('0x8')](),controller[_0x20a6('0x23')]);router[_0x20a6('0x7')](_0x20a6('0x24'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x25')]);router[_0x20a6('0x7')](_0x20a6('0x26'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x20a6('0x7')]('/:id/openchannel_accounts',auth[_0x20a6('0x8')](),controller[_0x20a6('0x27')]);router[_0x20a6('0x7')](_0x20a6('0x28'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x29')]);router[_0x20a6('0x7')](_0x20a6('0x2a'),auth[_0x20a6('0x8')](),controller['getChatWebsites']);router[_0x20a6('0x7')]('/:id/whatsapp_accounts',auth[_0x20a6('0x8')](),controller[_0x20a6('0x2b')]);router[_0x20a6('0x7')](_0x20a6('0x2c'),auth['isAuthenticated'](),controller[_0x20a6('0x2d')]);router[_0x20a6('0x7')](_0x20a6('0x2e'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x2f')]);router[_0x20a6('0x7')](_0x20a6('0x30'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x31')]);router[_0x20a6('0x32')](_0x20a6('0x33'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x34')]);router[_0x20a6('0x32')](_0x20a6('0x35'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x20a6('0x8')](),controller['create']);router[_0x20a6('0x32')](_0x20a6('0x12'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x36')]);var upload=multer({'storage':multer[_0x20a6('0x37')]({'destination':function(_0x3fc5e8,_0x119e53,_0x3382e3){_0x3382e3(null,path[_0x20a6('0x38')](config[_0x20a6('0x39')],'server/files/images/'));},'filename':function(_0x343fdb,_0x180189,_0x1c7395){_0x1c7395(null,util[_0x20a6('0x3a')](_0x20a6('0x3b'),Date['now'](),_0x180189[_0x20a6('0x3c')]));}})});router['post'](_0x20a6('0x10'),upload[_0x20a6('0x3d')]('file'),controller[_0x20a6('0x3e')]);router[_0x20a6('0x32')](_0x20a6('0x3f'),auth[_0x20a6('0x8')](),controller['login']);router['post']('/:id/logout',auth[_0x20a6('0x8')](),controller['logout']);router['post'](_0x20a6('0x40'),auth[_0x20a6('0x8')](),controller['pause']);router[_0x20a6('0x32')](_0x20a6('0x41'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x42')]);router[_0x20a6('0x32')](_0x20a6('0x20'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x43')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x20a6('0x44')]);router[_0x20a6('0x32')]('/:id/mail_interactions',auth[_0x20a6('0x8')](),controller['addMailInteractions']);router[_0x20a6('0x32')](_0x20a6('0x45'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x46')]);router[_0x20a6('0x32')](_0x20a6('0x47'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x48')]);router[_0x20a6('0x32')](_0x20a6('0x49'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x4a')]);router[_0x20a6('0x32')](_0x20a6('0x4b'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x4c')]);router[_0x20a6('0x32')](_0x20a6('0x24'),auth[_0x20a6('0x8')](),controller['addFaxAccounts']);router[_0x20a6('0x32')](_0x20a6('0x26'),auth['isAuthenticated'](),controller[_0x20a6('0x4d')]);router[_0x20a6('0x32')](_0x20a6('0x4e'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x4f')]);router[_0x20a6('0x32')](_0x20a6('0x28'),auth[_0x20a6('0x8')](),controller['addSmsAccounts']);router[_0x20a6('0x32')](_0x20a6('0x2a'),auth[_0x20a6('0x8')](),controller['addChatWebsites']);router[_0x20a6('0x32')](_0x20a6('0x50'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x51')]);router[_0x20a6('0x32')](_0x20a6('0x2c'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x52')]);router[_0x20a6('0x32')]('/:id/api_key',auth[_0x20a6('0x8')](),controller[_0x20a6('0x53')]);router['put'](_0x20a6('0xe'),auth[_0x20a6('0x8')](),controller['update']);router[_0x20a6('0x54')](_0x20a6('0x55'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x56')]);router[_0x20a6('0x57')](_0x20a6('0x12'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x58')]);router[_0x20a6('0x57')](_0x20a6('0x20'),auth[_0x20a6('0x8')](),controller['removeTeams']);router[_0x20a6('0x57')](_0x20a6('0xe'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x59')]);router[_0x20a6('0x57')](_0x20a6('0x5a'),auth[_0x20a6('0x8')](),controller['removeChatInteractions']);router['delete'](_0x20a6('0x5b'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x5c')]);router[_0x20a6('0x57')](_0x20a6('0x45'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x20a6('0x57')](_0x20a6('0x47'),auth['isAuthenticated'](),controller[_0x20a6('0x5d')]);router[_0x20a6('0x57')](_0x20a6('0x49'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x5e')]);router['delete'](_0x20a6('0x4b'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x5f')]);router[_0x20a6('0x57')](_0x20a6('0x24'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x60')]);router[_0x20a6('0x57')](_0x20a6('0x26'),auth[_0x20a6('0x8')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x20a6('0x8')](),controller['removeOpenchannelAccounts']);router[_0x20a6('0x57')](_0x20a6('0x28'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0x20a6('0x2a'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x61')]);router['delete']('/:id/whatsapp_accounts',auth[_0x20a6('0x8')](),controller['removeWhatsappAccounts']);router[_0x20a6('0x57')](_0x20a6('0x2c'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x62')]);router[_0x20a6('0x57')](_0x20a6('0x30'),auth[_0x20a6('0x8')](),controller[_0x20a6('0x63')]);module[_0x20a6('0x64')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b5f243a..8ff6463 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 _0xa934=['/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','accountcode','format','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','force_avp','dtlssetup'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xa934,0x1d4));var _0x4a93=function(_0xac9c5a,_0xbdd528){_0xac9c5a=_0xac9c5a-0x0;var _0x4aed87=_0xa934[_0xac9c5a];return _0x4aed87;};'use strict';var Sequelize=require(_0x4a93('0x0'));var moment=require(_0x4a93('0x1'));var util=require(_0x4a93('0x2'));var _=require(_0x4a93('0x3'));module[_0x4a93('0x4')]={'name':{'type':Sequelize[_0x4a93('0x5')],'allowNull':![],'unique':_0x4a93('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x235ee9){this[_0x4a93('0x7')]('name',_0x235ee9);this[_0x4a93('0x7')](_0x4a93('0x8'),_0x235ee9);},'comment':_0x4a93('0x9')},'fullname':{'type':Sequelize[_0x4a93('0x5')],'allowNull':![],'set':function(_0x12180a){this[_0x4a93('0x7')](_0x4a93('0xa'),_0x12180a);this[_0x4a93('0x7')](_0x4a93('0xb'),util['format'](_0x4a93('0xc'),_0x12180a,this[_0x4a93('0xd')](_0x4a93('0xe'))));}},'alias':{'type':Sequelize[_0x4a93('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4a93('0xf'),'validate':{'isEmail':!![]},'set':function(_0x15c56b){if(_0x15c56b){this[_0x4a93('0x7')](_0x4a93('0xf'),_0x15c56b[_0x4a93('0x10')]());}}},'role':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x12'),_0x4a93('0x13'),'agent',_0x4a93('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x4a93('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4a93('0x5')],'defaultValue':_0x4a93('0x15')},'internal':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4f4b35){this[_0x4a93('0x7')](_0x4a93('0xe'),_0x4f4b35);this[_0x4a93('0x7')](_0x4a93('0x17'),_0x4f4b35);this[_0x4a93('0x7')](_0x4a93('0xb'),util[_0x4a93('0x18')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0x4a93('0xa')),_0x4f4b35));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x4a93('0x5')]},'address':{'type':Sequelize[_0x4a93('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x4a93('0x5')]},'city':{'type':Sequelize[_0x4a93('0x5')]},'country':{'type':Sequelize[_0x4a93('0x5')]},'online':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4a93('0x1a')]},'voicePause':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4a93('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x4a93('0x1a')]},'chatCapacity':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4a93('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![],'defaultValue':_0x4a93('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x4a93('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x4a93('0x1c'),_0x4a93('0x13'),_0x4a93('0x1d')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![],'defaultValue':_0x4a93('0x1e')},'callingpres':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x1f'),_0x4a93('0x20'),_0x4a93('0x21'),_0x4a93('0x22'),_0x4a93('0x23'),'PROHIB_PASSED_SCREEN',_0x4a93('0x24'),_0x4a93('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x667bd6){this['setDataValue'](_0x4a93('0x26'),_0x667bd6?_0x667bd6[_0x4a93('0x27')](','):null);},'get':function(){return this[_0x4a93('0xd')](_0x4a93('0x26'))?this[_0x4a93('0xd')](_0x4a93('0x26'))[_0x4a93('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x29'),_0x4a93('0x2a'),_0x4a93('0x2b'),'inband',_0x4a93('0x2c')),'allowNull':!![],'defaultValue':_0x4a93('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x4a93('0x2d'),'no',_0x4a93('0x2e'),_0x4a93('0x2f'),_0x4a93('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![],'defaultValue':_0x4a93('0x31'),'set':function(_0x3e2ff4){this[_0x4a93('0x7')](_0x4a93('0x32'),_0x3e2ff4?_0x3e2ff4['join'](','):null);},'get':function(){return this[_0x4a93('0xd')](_0x4a93('0x32'))?this['getDataValue']('nat')[_0x4a93('0x28')](','):null;},'comment':_0x4a93('0x33')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x4a93('0x5')]},'pickupgroup':{'type':Sequelize[_0x4a93('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4a93('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a93('0x34')},'allow':{'type':Sequelize[_0x4a93('0x5')],'allowNull':![],'defaultValue':_0x4a93('0x35'),'set':function(_0x30a966){this[_0x4a93('0x7')](_0x4a93('0x36'),_0x30a966?_0x30a966[_0x4a93('0x27')](';'):_0x4a93('0x35'));},'get':function(){return this[_0x4a93('0xd')](_0x4a93('0x36'))?this['getDataValue'](_0x4a93('0x36'))['split'](';'):null;},'comment':_0x4a93('0x37')},'autoframing':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![],'set':function(_0x386c77){this['setDataValue'](_0x4a93('0x38'),_0x386c77?_0x386c77['join'](','):null);},'get':function(){return this[_0x4a93('0xd')](_0x4a93('0x38'))?this[_0x4a93('0xd')](_0x4a93('0x38'))['split'](','):null;},'comment':_0x4a93('0x39')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4a93('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no',_0x4a93('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![],'defaultValue':_0x4a93('0x3b')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4a93('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x4a93('0x2d')},'busylevel':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4a93('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4a93('0x11')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x3c'),'refuse',_0x4a93('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x3e'),_0x4a93('0x3f')),'allowNull':!![],'defaultValue':_0x4a93('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x4a93('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no',_0x4a93('0x40'),_0x4a93('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x42'),_0x4a93('0x43'),_0x4a93('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x4a93('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4a93('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x4a93('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x4a93('0x2d'),'no',_0x4a93('0x2e'),_0x4a93('0x2f'),_0x4a93('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4a93('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x4a93('0x1a')]},'showWebBar':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0,'set':function(_0x3e20ff){this[_0x4a93('0x7')](_0x4a93('0x46'),_0x3e20ff);var _0x49a133=this[_0x4a93('0x47')]({'plain':!![]});switch(_0x3e20ff){case 0x0:case 0x1:var _0x345ef3=_0x49a133[_0x4a93('0x26')]?_[_0x4a93('0x48')](_0x49a133[_0x4a93('0x26')])?_0x49a133[_0x4a93('0x26')]['join']():_0x49a133[_0x4a93('0x26')]:_0x4a93('0x49');if(_0x345ef3===_0x4a93('0x4a')){_0x345ef3=_0x4a93('0x49');}this[_0x4a93('0x7')](_0x4a93('0x26'),_0x345ef3);this[_0x4a93('0x7')](_0x4a93('0x4b'),'no');this[_0x4a93('0x7')](_0x4a93('0x4c'),null);this[_0x4a93('0x7')]('force_avp',null);this[_0x4a93('0x7')](_0x4a93('0x4d'),null);this[_0x4a93('0x7')](_0x4a93('0x4e'),null);this['setDataValue'](_0x4a93('0x4f'),null);this[_0x4a93('0x7')]('dtlssetup',null);this[_0x4a93('0x7')](_0x4a93('0x50'),null);this[_0x4a93('0x7')]('dtlsprivatekey',null);this['setDataValue'](_0x4a93('0x51'),'no');break;case 0x2:this[_0x4a93('0x7')]('transport',_0x4a93('0x4a'));this[_0x4a93('0x7')](_0x4a93('0x4b'),_0x4a93('0x2d'));this['setDataValue'](_0x4a93('0x4c'),'yes');this[_0x4a93('0x7')](_0x4a93('0x52'),'yes');this[_0x4a93('0x7')](_0x4a93('0x4d'),_0x4a93('0x2d'));this['setDataValue'](_0x4a93('0x4e'),_0x4a93('0x2d'));this[_0x4a93('0x7')](_0x4a93('0x4f'),'no');this['setDataValue'](_0x4a93('0x53'),'actpass');this[_0x4a93('0x7')](_0x4a93('0x50'),_0x49a133[_0x4a93('0x50')]||'/etc/pki/tls/certs/motion.crt');this[_0x4a93('0x7')]('dtlsprivatekey',_0x49a133['dtlsprivatekey']||_0x4a93('0x54'));this[_0x4a93('0x7')](_0x4a93('0x51'),_0x4a93('0x2d'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xce4fc1){this[_0x4a93('0x7')](_0x4a93('0x55'),_0xce4fc1?_0xce4fc1[_0x4a93('0x27')](','):[]);},'get':function(){return this[_0x4a93('0xd')](_0x4a93('0x55'))?_['map'](this[_0x4a93('0xd')](_0x4a93('0x55'))['split'](','),function(_0x40360f){return parseInt(_0x40360f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4a93('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4a93('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x4a93('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4a93('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4a93('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4a93('0x11')](_0x4a93('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4a93('0x5')]},'passwordResetAt':{'type':Sequelize[_0x4a93('0x1a')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4a93('0xd')](_0x4a93('0x56'))?this[_0x4a93('0xd')](_0x4a93('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4a93('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3090e5){if(typeof _0x3090e5===_0x4a93('0x57')){var _0x161e22=_0x3090e5==='1'?!![]:_0x3090e5==='0'?![]:_0x3090e5===_0x4a93('0x58')?!![]:_0x3090e5==='false'?![]:![];this[_0x4a93('0x7')](_0x4a93('0x59'),_0x161e22);}else{this[_0x4a93('0x7')](_0x4a93('0x59'),_0x3090e5);}}},'blocked':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![],'set':function(_0x191d97){this[_0x4a93('0x7')](_0x4a93('0x5a'),_0x191d97);if(_0x191d97===!![]){this['setDataValue']('blockedAt',moment());this[_0x4a93('0x7')]('loginAttempts',0x0);}else{this['setDataValue'](_0x4a93('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x4a93('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4a93('0x19')],'defaultValue':![]}}; \ No newline at end of file +var _0x5dbf=['uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','encryption','icesupport','/etc/pki/tls/certs/motion.crt','rtcp_mux','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','setDataValue','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5dbf,0x7c));var _0xf5db=function(_0x33091d,_0x240ba3){_0x33091d=_0x33091d-0x0;var _0x326499=_0x5dbf[_0x33091d];return _0x326499;};'use strict';var Sequelize=require(_0xf5db('0x0'));var moment=require(_0xf5db('0x1'));var util=require('util');var _=require(_0xf5db('0x2'));module[_0xf5db('0x3')]={'name':{'type':Sequelize[_0xf5db('0x4')],'allowNull':![],'unique':_0xf5db('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2e1eb7){this['setDataValue']('name',_0x2e1eb7);this['setDataValue'](_0xf5db('0x6'),_0x2e1eb7);},'comment':_0xf5db('0x7')},'fullname':{'type':Sequelize[_0xf5db('0x4')],'allowNull':![],'set':function(_0x2b799b){this[_0xf5db('0x8')]('fullname',_0x2b799b);this[_0xf5db('0x8')](_0xf5db('0x9'),util[_0xf5db('0xa')]('\x22%s\x22\x20<%s>',_0x2b799b,this[_0xf5db('0xb')](_0xf5db('0xc'))));}},'alias':{'type':Sequelize[_0xf5db('0x4')]},'email':{'type':Sequelize[_0xf5db('0x4')],'allowNull':![],'unique':_0xf5db('0xd'),'validate':{'isEmail':!![]},'set':function(_0x5ee73a){if(_0x5ee73a){this['setDataValue']('email',_0x5ee73a[_0xf5db('0xe')]());}}},'role':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x10'),_0xf5db('0x11'),_0xf5db('0x12'),_0xf5db('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xf5db('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xf5db('0x14')},'internal':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':![],'unique':_0xf5db('0xc'),'set':function(_0x4a344b){this[_0xf5db('0x8')](_0xf5db('0xc'),_0x4a344b);this['setDataValue'](_0xf5db('0x16'),_0x4a344b);this['setDataValue'](_0xf5db('0x9'),util[_0xf5db('0xa')](_0xf5db('0x17'),this[_0xf5db('0xb')](_0xf5db('0x18')),_0x4a344b));}},'salt':{'type':Sequelize[_0xf5db('0x4')]},'phone':{'type':Sequelize[_0xf5db('0x4')]},'mobile':{'type':Sequelize[_0xf5db('0x4')]},'address':{'type':Sequelize[_0xf5db('0x4')]},'zipcode':{'type':Sequelize[_0xf5db('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xf5db('0x4')]},'online':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf5db('0x1a')]},'voicePause':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf5db('0x4')],'defaultValue':_0xf5db('0x1b')},'lastPauseAt':{'type':Sequelize[_0xf5db('0x1a')]},'chatCapacity':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf5db('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf5db('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf5db('0x1c')},'ipaddr':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xf5db('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x1d'),'user',_0xf5db('0x1e')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![],'defaultValue':_0xf5db('0x1f')},'callingpres':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x20'),'ALLOWED_PASSED_SCREEN',_0xf5db('0x21'),_0xf5db('0x22'),'PROHIB_NOT_SCREENED',_0xf5db('0x23'),_0xf5db('0x24'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![],'defaultValue':_0xf5db('0x25'),'set':function(_0x1b1117){this[_0xf5db('0x8')](_0xf5db('0x26'),_0x1b1117?_0x1b1117[_0xf5db('0x27')](','):null);},'get':function(){return this[_0xf5db('0xb')](_0xf5db('0x26'))?this[_0xf5db('0xb')]('transport')[_0xf5db('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x29'),'info','shortinfo','inband','auto'),'allowNull':!![],'defaultValue':_0xf5db('0x29')},'directmedia':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no',_0xf5db('0x2b'),_0xf5db('0x2c'),_0xf5db('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3f117b){this['setDataValue'](_0xf5db('0x2e'),_0x3f117b?_0x3f117b[_0xf5db('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xf5db('0xb')](_0xf5db('0x2e'))[_0xf5db('0x28')](','):null;},'comment':_0xf5db('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf5db('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf5db('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf5db('0x4')]},'disallow':{'type':Sequelize[_0xf5db('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf5db('0x4')],'allowNull':![],'defaultValue':_0xf5db('0x30'),'set':function(_0x32911d){this[_0xf5db('0x8')](_0xf5db('0x31'),_0x32911d?_0x32911d['join'](';'):_0xf5db('0x30'));},'get':function(){return this[_0xf5db('0xb')](_0xf5db('0x31'))?this['getDataValue'](_0xf5db('0x31'))[_0xf5db('0x28')](';'):null;},'comment':_0xf5db('0x32')},'autoframing':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![],'set':function(_0x562be8){this['setDataValue'](_0xf5db('0x33'),_0x562be8?_0x562be8[_0xf5db('0x27')](','):null);},'get':function(){return this[_0xf5db('0xb')](_0xf5db('0x33'))?this[_0xf5db('0xb')](_0xf5db('0x33'))['split'](','):null;},'comment':_0xf5db('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no',_0xf5db('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf5db('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xf5db('0x2a')},'busylevel':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf5db('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xf5db('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x37'),_0xf5db('0x38'),_0xf5db('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x3a'),_0xf5db('0x3b')),'allowNull':!![],'defaultValue':_0xf5db('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xf5db('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf5db('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf5db('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no',_0xf5db('0x3c'),_0xf5db('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x3e'),_0xf5db('0x3f'),_0xf5db('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf5db('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf5db('0xf')](_0xf5db('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xf5db('0x2a'),'no',_0xf5db('0x2b'),_0xf5db('0x2c'),_0xf5db('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf5db('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0,'set':function(_0x27f023){this[_0xf5db('0x8')](_0xf5db('0x42'),_0x27f023);var _0x2f0d4a=this[_0xf5db('0x43')]({'plain':!![]});switch(_0x27f023){case 0x0:case 0x1:var _0x31d84a=_0x2f0d4a[_0xf5db('0x26')]?_[_0xf5db('0x44')](_0x2f0d4a[_0xf5db('0x26')])?_0x2f0d4a['transport']['join']():_0x2f0d4a['transport']:_0xf5db('0x25');if(_0x31d84a===_0xf5db('0x45')){_0x31d84a=_0xf5db('0x25');}this[_0xf5db('0x8')](_0xf5db('0x26'),_0x31d84a);this[_0xf5db('0x8')]('encryption','no');this[_0xf5db('0x8')](_0xf5db('0x46'),null);this[_0xf5db('0x8')](_0xf5db('0x47'),null);this[_0xf5db('0x8')]('icesupport',null);this['setDataValue'](_0xf5db('0x48'),null);this['setDataValue'](_0xf5db('0x49'),null);this[_0xf5db('0x8')]('dtlssetup',null);this[_0xf5db('0x8')](_0xf5db('0x4a'),null);this['setDataValue'](_0xf5db('0x4b'),null);this[_0xf5db('0x8')]('rtcp_mux','no');break;case 0x2:this[_0xf5db('0x8')](_0xf5db('0x26'),_0xf5db('0x45'));this[_0xf5db('0x8')](_0xf5db('0x4c'),_0xf5db('0x2a'));this[_0xf5db('0x8')]('avpf',_0xf5db('0x2a'));this[_0xf5db('0x8')](_0xf5db('0x47'),_0xf5db('0x2a'));this[_0xf5db('0x8')](_0xf5db('0x4d'),'yes');this[_0xf5db('0x8')]('dtlsenable','yes');this[_0xf5db('0x8')](_0xf5db('0x49'),'no');this[_0xf5db('0x8')]('dtlssetup',_0xf5db('0x40'));this[_0xf5db('0x8')](_0xf5db('0x4a'),_0x2f0d4a[_0xf5db('0x4a')]||_0xf5db('0x4e'));this[_0xf5db('0x8')](_0xf5db('0x4b'),_0x2f0d4a['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xf5db('0x8')](_0xf5db('0x4f'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xf5db('0x50')],'set':function(_0x502f6f){this[_0xf5db('0x8')](_0xf5db('0x51'),_0x502f6f?_0x502f6f['join'](','):[]);},'get':function(){return this['getDataValue'](_0xf5db('0x51'))?_['map'](this[_0xf5db('0xb')](_0xf5db('0x51'))[_0xf5db('0x28')](','),function(_0x127678){return parseInt(_0x127678,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf5db('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xf5db('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf5db('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf5db('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0xf5db('0x1a')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf5db('0x52')],'get':function(){return this[_0xf5db('0xb')](_0xf5db('0x53'))?this[_0xf5db('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf5db('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf5db('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![],'set':function(_0x2ad8b7){if(typeof _0x2ad8b7===_0xf5db('0x54')){var _0x48c9c5=_0x2ad8b7==='1'?!![]:_0x2ad8b7==='0'?![]:_0x2ad8b7===_0xf5db('0x55')?!![]:_0x2ad8b7===_0xf5db('0x56')?![]:![];this['setDataValue'](_0xf5db('0x57'),_0x48c9c5);}else{this[_0xf5db('0x8')]('screenrecording',_0x2ad8b7);}}},'blocked':{'type':Sequelize[_0xf5db('0x19')],'defaultValue':![],'set':function(_0x1aebf0){this[_0xf5db('0x8')](_0xf5db('0x58'),_0x1aebf0);if(_0x1aebf0===!![]){this[_0xf5db('0x8')](_0xf5db('0x59'),moment());this['setDataValue'](_0xf5db('0x5a'),0x0);}else{this[_0xf5db('0x8')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xf5db('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf5db('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 818702c..18600f7 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 _0x6a21=['Queues','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getContacts','CmContact','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','push','UserVoiceQueue.penalty','each','MemberReport','YYYY-MM-DD\x20HH:mm:ss','all','device','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','getChannels','DEFAULT\x20PAUSE','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','mail','chat','fax','sms','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','getVoiceQueues','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Openchannel','flatten','addAgent','getDataValue','getChatQueues','Fax','getOpenchannelQueues','removeAgent','getLists','getAgents','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','CmHopper','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','client','http','test','ValidationError','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','destroy','get','Users','telephone','filter','ignore','map','value','includes','role','name','UserProfileResource','send','index','rawAttributes','fieldName','type','key','model','differenceBy','password','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','lower','sequelize','merge','User','includeAll','include','findAll','rows','show','params','salt','length','options','find','bulkCreate','body','describe','addContacts','ids','agent','agent\x20role','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','internal','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','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','104','105','106','108','109','111','114','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','Telephones','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','Setting','findOne','securePassword','oldPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','penalty','spread','emit','Queue:save','VoiceQueue','voice','UserVoiceQueueRt','upsert','removeQueues','remove','capitalize'];(function(_0x577991,_0x164101){var _0x3b6760=function(_0x101b55){while(--_0x101b55){_0x577991['push'](_0x577991['shift']());}};_0x3b6760(++_0x164101);}(_0x6a21,0xcc));var _0x16a2=function(_0x572b57,_0x5b1c18){_0x572b57=_0x572b57-0x0;var _0x2fd8b6=_0x6a21[_0x572b57];return _0x2fd8b6;};'use strict';var pdf=require(_0x16a2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16a2('0x1'));var zipdir=require(_0x16a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x16a2('0x3'));var BPromise=require(_0x16a2('0x4'));var Mustache=require(_0x16a2('0x5'));var util=require('util');var path=require(_0x16a2('0x6'));var sox=require(_0x16a2('0x7'));var csv=require(_0x16a2('0x8'));var ejs=require(_0x16a2('0x9'));var fs=require('fs');var _=require(_0x16a2('0xa'));var squel=require(_0x16a2('0xb'));var crypto=require(_0x16a2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16a2('0x8'));var querystring=require(_0x16a2('0xd'));var Papa=require('papaparse');var Redis=require(_0x16a2('0xe'));var authService=require(_0x16a2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16a2('0x10'));var hardwareService=require(_0x16a2('0x11'));var logger=require('../../config/logger')(_0x16a2('0x12'));var utils=require('../../config/utils');var config=require(_0x16a2('0x13'));var db=require('../../mysqldb')['db'];config[_0x16a2('0x14')]=_['defaults'](config[_0x16a2('0x14')],{'host':_0x16a2('0x15'),'port':0x18eb});var socket=require(_0x16a2('0x16'))(new Redis(config[_0x16a2('0x14')]));require(_0x16a2('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x16a2('0x18')][_0x16a2('0x19')]({'port':0x232a});function checkPasswordPattern(_0x897a60,_0x2cd278,_0x391249){if(_0x391249){var _0xbac95e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbac95e[_0x16a2('0x1a')](_0x2cd278)){return _0x897a60;}else{throw new db['Sequelize'][(_0x16a2('0x1b'))]('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 _0x897a60;}}function respondWithRpcPromise(_0x195391,_0x5a9941,_0x84a7fe,_0x2fb62a){return new BPromise(function(_0x23afda,_0x54ea2e){var _0x3ddfa3=_0x2fb62a||client;return _0x3ddfa3[_0x16a2('0x1c')](_0x195391,_0x84a7fe)[_0x16a2('0x1d')](function(_0x37746d){logger[_0x16a2('0x1e')](_0x16a2('0x1f'),_0x5a9941,_0x16a2('0x20'));logger['debug'](_0x16a2('0x21'),_0x5a9941,'request\x20sent',JSON[_0x16a2('0x22')](_0x37746d));if(_0x37746d[_0x16a2('0x23')]){if(_0x37746d[_0x16a2('0x23')]['code']===0x1f4){logger[_0x16a2('0x23')]('User,\x20%s,\x20%s',_0x5a9941,_0x37746d[_0x16a2('0x23')][_0x16a2('0x24')]);return _0x54ea2e(_0x37746d[_0x16a2('0x23')][_0x16a2('0x24')]);}logger['error'](_0x16a2('0x1f'),_0x5a9941,_0x37746d[_0x16a2('0x23')]['message']);return _0x23afda(_0x37746d['error']['message']);}else{logger['info'](_0x16a2('0x1f'),_0x5a9941,_0x16a2('0x20'));_0x23afda(_0x37746d['result']['message']);}})[_0x16a2('0x25')](function(_0x366f02){logger[_0x16a2('0x23')](_0x16a2('0x1f'),_0x5a9941,_0x366f02);_0x54ea2e(_0x366f02);});});}function respondWithStatusCode(_0x356b45,_0x44cd33){_0x44cd33=_0x44cd33||0xcc;return function(_0x242e2c){if(_0x242e2c){return _0x356b45[_0x16a2('0x26')](_0x44cd33);}return _0x356b45[_0x16a2('0x27')](_0x44cd33)[_0x16a2('0x28')]();};}function respondWithResult(_0x5e06fe,_0x5d2f13){_0x5d2f13=_0x5d2f13||0xc8;return function(_0x51cf99){if(_0x51cf99){return _0x5e06fe[_0x16a2('0x27')](_0x5d2f13)[_0x16a2('0x29')](_0x51cf99);}};}function respondWithFilteredResult(_0x1e0909,_0x53de09){return function(_0x1790fc){if(_0x1790fc){var _0x63a952=_0x1790fc[_0x16a2('0x2a')],_0x2bf30d=_0x53de09[_0x16a2('0x2b')],_0x1e05f7=_0x53de09[_0x16a2('0x2b')]+_0x53de09['limit'],_0x478e6a;if(_0x1e05f7>=_0x63a952){_0x1e05f7=_0x63a952;_0x478e6a=0xc8;}else{_0x478e6a=0xce;}_0x1e0909['status'](_0x478e6a);return _0x1e0909[_0x16a2('0x2c')](_0x16a2('0x2d'),_0x2bf30d+'-'+_0x1e05f7+'/'+_0x63a952)['json'](_0x1790fc);}return null;};}function patchUpdates(_0x3e4eae){return function(_0x8ee2fa){try{jsonpatch['apply'](_0x8ee2fa,_0x3e4eae,!![]);}catch(_0x434492){return BPromise[_0x16a2('0x2e')](_0x434492);}return _0x8ee2fa['save']();};}function saveUpdates(_0x4cb057,_0x46d9f3){return function(_0x2c3bbd){if(_0x2c3bbd){return _0x2c3bbd[_0x16a2('0x2f')](_0x4cb057)['then'](function(_0xecb056){return _0xecb056;});}return null;};}function removeEntity(_0x2eec16,_0x123736){return function(_0x56659c){if(_0x56659c){return _0x56659c[_0x16a2('0x30')]()[_0x16a2('0x1d')](function(){var _0x447deb=_0x56659c[_0x16a2('0x31')]({'plain':!![]});var _0x1f94d3=[{'name':_0x16a2('0x32'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':_0x16a2('0x33'),'ignore':![]}];var _0x52aea7=_(_0x1f94d3)[_0x16a2('0x34')](_0x16a2('0x35'))[_0x16a2('0x36')](_0x16a2('0x37'))[_0x16a2('0x37')]();if(_[_0x16a2('0x38')](_0x52aea7,_0x447deb['role'])){return;}var _0x3df9f5=_['find'](_0x1f94d3,[_0x16a2('0x37'),_0x447deb[_0x16a2('0x39')]])[_0x16a2('0x3a')];return db[_0x16a2('0x3b')][_0x16a2('0x30')]({'where':{'type':_0x3df9f5,'resourceId':_0x447deb['id']}})['then'](function(){return _0x56659c;});})[_0x16a2('0x1d')](function(){_0x2eec16[_0x16a2('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe3effc,_0x1a513){return function(_0x595507){if(!_0x595507){_0xe3effc['sendStatus'](0x194);}return _0x595507;};}function handleError(_0x49cd23,_0x37e355){_0x37e355=_0x37e355||0x1f4;return function(_0x351c47){logger[_0x16a2('0x23')](_0x351c47['stack']);if(_0x351c47[_0x16a2('0x3a')]){delete _0x351c47[_0x16a2('0x3a')];}_0x49cd23[_0x16a2('0x27')](_0x37e355)[_0x16a2('0x3c')](_0x351c47);};}exports[_0x16a2('0x3d')]=function(_0x2a3557,_0x3730db){var _0x17910d={},_0x205169={},_0x506a34={'count':0x0,'rows':[]};var _0x1d7cc6=_[_0x16a2('0x36')](db['User'][_0x16a2('0x3e')],function(_0x55416c){return{'name':_0x55416c[_0x16a2('0x3f')],'type':_0x55416c[_0x16a2('0x40')][_0x16a2('0x41')]};});_0x205169[_0x16a2('0x42')]=_[_0x16a2('0x43')](_[_0x16a2('0x36')](_0x1d7cc6,_0x16a2('0x3a')),[_0x16a2('0x44'),'salt']);_0x205169[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x2a3557[_0x16a2('0x45')]);_0x205169[_0x16a2('0x47')]=_['intersection'](_0x205169[_0x16a2('0x42')],_0x205169[_0x16a2('0x45')]);_0x17910d[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x205169[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x2a3557['query'][_0x16a2('0x4a')]));_0x17910d[_0x16a2('0x48')]=_0x17910d[_0x16a2('0x48')]['length']?_0x17910d[_0x16a2('0x48')]:_0x205169[_0x16a2('0x42')];if(!_0x2a3557[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x17910d['limit']=qs[_0x16a2('0x4d')](_0x2a3557['query'][_0x16a2('0x4d')]);_0x17910d[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x2a3557[_0x16a2('0x45')][_0x16a2('0x2b')]);}_0x17910d[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x2a3557[_0x16a2('0x45')][_0x16a2('0x4f')]);_0x17910d[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x2a3557[_0x16a2('0x45')],_0x205169['filters']),_0x1d7cc6);if(_0x2a3557[_0x16a2('0x45')][_0x16a2('0x34')]){_0x17910d[_0x16a2('0x50')]=_['merge'](_0x17910d[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x1d7cc6,function(_0x4725a6){if(_0x4725a6[_0x16a2('0x40')]!==_0x16a2('0x52')){return db['sequelize'][_0x16a2('0x50')](db['sequelize']['fn'](_0x16a2('0x53'),db[_0x16a2('0x54')]['col'](_0x4725a6[_0x16a2('0x3a')])),{'$like':db[_0x16a2('0x54')]['fn']('lower','%'+_0x2a3557[_0x16a2('0x45')][_0x16a2('0x34')]+'%')});}})});}_0x17910d=_[_0x16a2('0x55')]({},_0x17910d,_0x2a3557['options']);var _0x3c3465={'where':_0x17910d['where']};return db[_0x16a2('0x56')][_0x16a2('0x2a')](_0x3c3465)['then'](function(_0x27af80){_0x506a34[_0x16a2('0x2a')]=_0x27af80;if(_0x2a3557[_0x16a2('0x45')][_0x16a2('0x57')]){_0x17910d[_0x16a2('0x58')]=[{'all':!![]}];}return db[_0x16a2('0x56')][_0x16a2('0x59')](_0x17910d);})[_0x16a2('0x1d')](function(_0x3d789f){_0x506a34[_0x16a2('0x5a')]=_0x3d789f;return _0x506a34;})[_0x16a2('0x1d')](respondWithFilteredResult(_0x3730db,_0x17910d))['catch'](handleError(_0x3730db,null));};exports[_0x16a2('0x5b')]=function(_0x11a665,_0x409db7){var _0x517151={'raw':![],'where':{'id':_0x11a665[_0x16a2('0x5c')]['id']}},_0x1dca22={};_0x1dca22[_0x16a2('0x42')]=_['differenceBy'](_['keys'](db[_0x16a2('0x56')]['rawAttributes']),['password',_0x16a2('0x5d')]);_0x1dca22[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x11a665[_0x16a2('0x45')]);_0x1dca22[_0x16a2('0x47')]=_['intersection'](_0x1dca22[_0x16a2('0x42')],_0x1dca22[_0x16a2('0x45')]);_0x517151['attributes']=_[_0x16a2('0x49')](_0x1dca22[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x11a665['query'][_0x16a2('0x4a')]));_0x517151[_0x16a2('0x48')]=_0x517151[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x517151['attributes']:_0x1dca22['model'];if(_0x11a665[_0x16a2('0x45')][_0x16a2('0x57')]){_0x517151[_0x16a2('0x58')]=[{'all':!![]}];}_0x517151=_['merge']({},_0x517151,_0x11a665[_0x16a2('0x5f')]);return db[_0x16a2('0x56')][_0x16a2('0x60')](_0x517151)[_0x16a2('0x1d')](handleEntityNotFound(_0x409db7,null))[_0x16a2('0x1d')](respondWithResult(_0x409db7,null))[_0x16a2('0x25')](handleError(_0x409db7,null));};exports[_0x16a2('0x61')]=function(_0x2fd076,_0x19fa2f){return db[_0x16a2('0x56')]['bulkCreate'](_0x2fd076[_0x16a2('0x62')],{'raw':![],'individualHooks':!![]})[_0x16a2('0x1d')](respondWithResult(_0x19fa2f,0xc9))[_0x16a2('0x25')](handleError(_0x19fa2f,null));};exports['update']=function(_0x2ad759,_0x37b76f){if(_0x2ad759['body']['id']){delete _0x2ad759[_0x16a2('0x62')]['id'];}delete _0x2ad759[_0x16a2('0x62')]['role'];return db['User'][_0x16a2('0x60')]({'where':{'id':_0x2ad759[_0x16a2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x37b76f,null))[_0x16a2('0x1d')](saveUpdates(_0x2ad759[_0x16a2('0x62')],null))['then'](respondWithResult(_0x37b76f,null))[_0x16a2('0x25')](handleError(_0x37b76f,null));};exports[_0x16a2('0x63')]=function(_0x23c727,_0x4bb456){return db[_0x16a2('0x56')][_0x16a2('0x63')]()['then'](respondWithResult(_0x4bb456,null))['catch'](handleError(_0x4bb456,null));};exports[_0x16a2('0x64')]=function(_0x44f886,_0x53d5ca,_0x3ca84a){return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x44f886[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x53d5ca,null))[_0x16a2('0x1d')](function(_0x534d0d){if(_0x534d0d){return _0x534d0d[_0x16a2('0x64')](_0x44f886[_0x16a2('0x62')][_0x16a2('0x65')],_['omit'](_0x44f886[_0x16a2('0x62')],[_0x16a2('0x65'),'id'])||{});}})[_0x16a2('0x1d')](respondWithResult(_0x53d5ca,null))[_0x16a2('0x25')](handleError(_0x53d5ca,null));};var getLicense=function(_0x4bcf40){return new BPromise(function(_0x47ac4e,_0x3d4605){var _0x2f9973=0x0;_0x4bcf40[_0x16a2('0x62')][_0x16a2('0x39')]===_0x16a2('0x66')&&_0x47ac4e(_0x16a2('0x67'));return db['User'][_0x16a2('0x2a')]({'where':{'$or':[{'role':_0x4bcf40[_0x16a2('0x62')]['role']===_0x16a2('0x33')?'telephone':[_0x16a2('0x68'),'user']}]}})[_0x16a2('0x1d')](function(_0x262a70){_0x2f9973=_0x262a70;return require(_0x16a2('0x69'))[_0x16a2('0x6a')]();})[_0x16a2('0x1d')](function(_0x11eb2b){var _0x4b34dc=_0x4bcf40[_0x16a2('0x62')]['role']===_0x16a2('0x33')?_0x16a2('0x6b'):_0x16a2('0x6c');if(!_[_0x16a2('0x6d')](_0x11eb2b[_0x4b34dc])&&_0x2f9973>=_0x11eb2b[_0x4b34dc]){return _0x3d4605({'message':_0x16a2('0x6e')});}return _0x47ac4e(util[_0x16a2('0x6f')](_0x16a2('0x70'),_0x4b34dc,_0x2f9973));})[_0x16a2('0x25')](function(_0x27e1ab){return _0x3d4605(_0x27e1ab);});});};exports['create']=function(_0x2072dd,_0x16ef38){return getLicense(_0x2072dd)[_0x16a2('0x1d')](function(_0x260eb0){if(!_0x2072dd['body'][_0x16a2('0x71')]){var _0x3a8646;return db['Setting']['findById'](0x1)[_0x16a2('0x1d')](function(_0x1ca3e4){return checkPasswordPattern(_0x1ca3e4,_0x2072dd[_0x16a2('0x62')][_0x16a2('0x44')],_0x1ca3e4['securePassword']);})['then'](function(_0x1efc10){_0x3a8646=_0x1efc10[_0x16a2('0x72')];return db[_0x16a2('0x56')][_0x16a2('0x73')](_0x16a2('0x71'));})['then'](function(_0x51a8e2){if(_['isNil'](_0x51a8e2)){if(_0x3a8646){_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')]=_0x3a8646;}else{_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')]=0x1;}}else{if(_[_0x16a2('0x6d')](_0x3a8646)||_0x3a8646==_0x51a8e2){_0x2072dd['body'][_0x16a2('0x71')]=_0x51a8e2+0x1;}else if(_0x3a8646>_0x51a8e2){_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')]=_0x3a8646;}else{return db[_0x16a2('0x54')][_0x16a2('0x45')](_0x16a2('0x74'),{'type':db['sequelize'][_0x16a2('0x75')][_0x16a2('0x76')]})['then'](function(_0x463c60){if(_0x463c60&&_0x463c60[_0x16a2('0x5e')]){for(var _0x4f2a6f=0x0,_0x1bdac3=_0x463c60[_0x16a2('0x5e')];_0x4f2a6f<_0x1bdac3&&_[_0x16a2('0x6d')](_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')]);_0x4f2a6f++){if(_0x3a8646<=_0x463c60[_0x4f2a6f][_0x16a2('0x77')]){_0x2072dd['body'][_0x16a2('0x71')]=_0x463c60[_0x4f2a6f][_0x16a2('0x77')];}else if(_0x3a8646>_0x463c60[_0x4f2a6f][_0x16a2('0x77')]&&_0x3a8646<=_0x463c60[_0x4f2a6f]['to']){_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')]=_0x3a8646;}}}if(_[_0x16a2('0x6d')](_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')])){_0x2072dd['body'][_0x16a2('0x71')]=_0x51a8e2+0x1;}});}}});}})['then'](function(){if(_0x2072dd[_0x16a2('0x62')][_0x16a2('0x78')]){_0x2072dd[_0x16a2('0x62')][_0x16a2('0x79')]=_0x2072dd[_0x16a2('0x62')][_0x16a2('0x71')];_0x2072dd['body'][_0x16a2('0x7a')]={'mailbox':_0x2072dd[_0x16a2('0x62')]['internal'],'password':_0x2072dd['body'][_0x16a2('0x44')],'fullname':_0x2072dd[_0x16a2('0x62')]['fullname'],'email':_0x2072dd[_0x16a2('0x62')][_0x16a2('0x7b')]};}if(_0x2072dd[_0x16a2('0x62')]&&_0x2072dd[_0x16a2('0x62')][_0x16a2('0x39')]===_0x16a2('0x66')){if(!_0x2072dd[_0x16a2('0x62')][_0x16a2('0x7c')]){_0x2072dd[_0x16a2('0x62')][_0x16a2('0x7c')]=[_0x16a2('0x7d'),_0x16a2('0x7e'),_0x16a2('0x7f'),_0x16a2('0x80'),_0x16a2('0x81'),_0x16a2('0x82'),_0x16a2('0x83'),_0x16a2('0x84'),'107',_0x16a2('0x85'),_0x16a2('0x86'),'100',_0x16a2('0x87'),_0x16a2('0x88')];}}return db[_0x16a2('0x56')]['create'](_0x2072dd['body'],{'include':[{'model':db['VoiceMail'],'as':_0x16a2('0x7a')}]});})[_0x16a2('0x1d')](function(_0x5de75e){if(_0x2072dd['body'][_0x16a2('0x39')]===_0x16a2('0x89'))return _0x5de75e;var _0x59e295=_0x2072dd['user']['get']({'plain':!![]});if(!_0x59e295)throw new Error(_0x16a2('0x8a'));if(_0x59e295[_0x16a2('0x39')]===_0x16a2('0x89')){var _0x2570ba=_0x5de75e[_0x16a2('0x31')]({'plain':!![]});var _0x4df9c7=[{'name':_0x16a2('0x8b'),'value':_0x16a2('0x66')},{'name':_0x16a2('0x8c'),'value':'telephone'}];var _0x5b1509=_[_0x16a2('0x60')](_0x4df9c7,[_0x16a2('0x37'),_0x2570ba['role']])[_0x16a2('0x3a')];return db[_0x16a2('0x8d')]['find']({'where':{'name':_0x5b1509,'userProfileId':_0x59e295[_0x16a2('0x8e')]},'raw':!![]})[_0x16a2('0x1d')](function(_0x58c8d4){if(_0x58c8d4&&_0x58c8d4[_0x16a2('0x8f')]===0x0){return db[_0x16a2('0x3b')][_0x16a2('0x90')]({'name':_0x2570ba[_0x16a2('0x3a')],'resourceId':_0x2570ba['id'],'type':_0x58c8d4[_0x16a2('0x3a')],'sectionId':_0x58c8d4['id']},{})[_0x16a2('0x1d')](function(){return _0x5de75e;});}else{return _0x5de75e;}})['catch'](function(_0x39f4b9){logger[_0x16a2('0x23')](_0x16a2('0x91'),_0x39f4b9);throw _0x39f4b9;});}return _0x5de75e;})[_0x16a2('0x1d')](respondWithResult(_0x16ef38,0xc9))['catch'](handleError(_0x16ef38,null));};exports[_0x16a2('0x92')]=function(_0x13a0fe,_0x7d6a67,_0x5efc82){var _0x6c5cfc=![];if(_0x13a0fe[_0x16a2('0x62')]['id']){delete _0x13a0fe[_0x16a2('0x62')]['id'];}return db[_0x16a2('0x93')][_0x16a2('0x94')]({'attributes':['id','securePassword']})[_0x16a2('0x1d')](function(_0x2aaed6){_0x6c5cfc=_0x2aaed6[_0x16a2('0x95')];return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x13a0fe[_0x16a2('0x5c')]['id']}});})[_0x16a2('0x1d')](function(_0x41d6f4){if(_0x41d6f4){if(_0x41d6f4['id']==_0x13a0fe[_0x16a2('0x89')]['id']){if(!_0x13a0fe[_0x16a2('0x62')][_0x16a2('0x96')]||!_0x13a0fe[_0x16a2('0x62')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x16a2('0x97'));}if(!_0x41d6f4[_0x16a2('0x98')](_0x13a0fe['body'][_0x16a2('0x96')])){throw new db['Sequelize'][(_0x16a2('0x1b'))](_0x16a2('0x99'));}if(_0x13a0fe[_0x16a2('0x62')]['oldPassword']==_0x13a0fe[_0x16a2('0x62')][_0x16a2('0x9a')]){throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0x9c'));}return _0x41d6f4;}else if(_0x13a0fe['user'][_0x16a2('0x39')]=='admin'){if(!_0x13a0fe[_0x16a2('0x62')]['newPassword']){throw new db[(_0x16a2('0x9b'))]['ValidationError'](_0x16a2('0x9d'));}return _0x41d6f4;}else if(_0x13a0fe[_0x16a2('0x89')][_0x16a2('0x39')]==_0x16a2('0x89')){if(!_0x13a0fe[_0x16a2('0x62')][_0x16a2('0x9a')]){throw new db['Sequelize'][(_0x16a2('0x1b'))](_0x16a2('0x9d'));}if(_0x41d6f4[_0x16a2('0x39')]!=_0x16a2('0x66')){throw new db['Sequelize'][(_0x16a2('0x1b'))](_0x16a2('0x9e'));}return _0x41d6f4;}else{throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0x9e'));}}return null;})[_0x16a2('0x1d')](handleEntityNotFound(_0x7d6a67,null))[_0x16a2('0x1d')](function(_0xe9d81a){return checkPasswordPattern(_0xe9d81a,_0x13a0fe[_0x16a2('0x62')][_0x16a2('0x9a')],_0x6c5cfc);})[_0x16a2('0x1d')](saveUpdates({'password':_0x13a0fe[_0x16a2('0x62')]['newPassword'],'passwordResetAt':_0x13a0fe[_0x16a2('0x89')]['id']==_0x13a0fe['params']['id']?moment():null},null))[_0x16a2('0x1d')](respondWithResult(_0x7d6a67,null))[_0x16a2('0x25')](handleError(_0x7d6a67,null));};exports[_0x16a2('0x9f')]=function(_0x4a40c3,_0x16ab58,_0x1c8042){var _0x19998a=_0x4a40c3[_0x16a2('0x62')][_0x16a2('0xa0')];return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x4a40c3[_0x16a2('0x5c')]['id']},'attributes':['id','name',_0x16a2('0x39'),_0x16a2('0xa1'),_0x16a2('0xa2'),'voicePause',_0x16a2('0xa3')]})[_0x16a2('0x1d')](handleEntityNotFound(_0x16ab58,null))['then'](function(_0x4d6add){if(_0x4d6add){if(!utils[_0x16a2('0xa4')](_0x19998a)){throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0xa5'));}return _0x4d6add[_0x16a2('0xa6')+_['capitalize'](_0x19998a[_0x16a2('0xa7')]())+'Queues'](_0x4a40c3[_0x16a2('0x62')][_0x16a2('0x65')],{'penalty':_0x4a40c3[_0x16a2('0x62')][_0x16a2('0xa8')]||0x0})[_0x16a2('0xa9')](function(_0x4aacaf){for(var _0x2818bd=0x0;_0x2818bd<_0x4a40c3['body']['ids'][_0x16a2('0x5e')];_0x2818bd+=0x1){var _0x20f463={'UserId':_0x4a40c3[_0x16a2('0x5c')]['id']};_0x20f463[_['capitalize'](_0x19998a['toLowerCase']())+'QueueId']=_0x4a40c3[_0x16a2('0x62')][_0x16a2('0x65')][_0x2818bd];socket[_0x16a2('0xaa')](_0x16a2('0x89')+_['capitalize'](_0x19998a[_0x16a2('0xa7')]())+_0x16a2('0xab'),_0x20f463);}return _0x4aacaf;})['then'](function(){if(_0x19998a==='voice'){return db[_0x16a2('0xac')][_0x16a2('0x59')]({'where':{'id':_0x4a40c3['body'][_0x16a2('0x65')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x16a2('0x1d')](function(_0x324d11){var _0x2ee10e=_0x4d6add['get']({'plain':!![]});var _0x4eabfb=[];if(_0x19998a===_0x16a2('0xad')&&_0x2ee10e[_0x16a2('0x39')]==='agent'&&_0x2ee10e['online']){for(var _0x250be4=0x0;_0x250be4<_0x324d11[_0x16a2('0x5e')];_0x250be4+=0x1){_0x4eabfb['push']({'membername':_0x2ee10e[_0x16a2('0x3a')],'UserId':_0x2ee10e['id'],'queue_name':_0x324d11[_0x250be4][_0x16a2('0x3a')],'VoiceQueueId':_0x324d11[_0x250be4]['id'],'interface':_['isNil'](_0x2ee10e['interface'])?util[_0x16a2('0x6f')]('SIP/%s',_0x2ee10e[_0x16a2('0x3a')]):_0x2ee10e[_0x16a2('0xa3')],'paused':_0x2ee10e['voicePause']||![],'penalty':_0x4a40c3['body'][_0x16a2('0xa8')]||0x0});}return BPromise['each'](_0x4eabfb,function(_0x4790b9){return db[_0x16a2('0xae')][_0x16a2('0xaf')](_0x4790b9);});}return _0x4d6add;});}})[_0x16a2('0x1d')](respondWithStatusCode(_0x16ab58,null))[_0x16a2('0x25')](handleError(_0x16ab58,null));};exports[_0x16a2('0xb0')]=function(_0x38cd6f,_0x211641,_0x3815fd){var _0x32b61f;return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x38cd6f['params']['id']},'attributes':['id',_0x16a2('0x3a'),'role']})[_0x16a2('0x1d')](handleEntityNotFound(_0x211641,null))[_0x16a2('0x1d')](function(_0x235ec2){if(_0x235ec2){_0x32b61f=_0x235ec2;if(!_0x38cd6f[_0x16a2('0x45')][_0x16a2('0xa0')]||!utils[_0x16a2('0xa4')](_0x38cd6f['query'][_0x16a2('0xa0')])){throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0xa5'));}return _0x235ec2[_0x16a2('0xb1')+_[_0x16a2('0xb2')](_0x38cd6f[_0x16a2('0x45')][_0x16a2('0xa0')][_0x16a2('0xa7')]())+_0x16a2('0xb3')](_0x38cd6f['query'][_0x16a2('0x65')]);}})[_0x16a2('0x1d')](function(_0x3ee008){for(var _0x4f4b1c=0x0;_0x4f4b1c<_0x38cd6f['query'][_0x16a2('0x65')][_0x16a2('0x5e')];_0x4f4b1c+=0x1){var _0x4619b7={'UserId':_0x38cd6f[_0x16a2('0x5c')]['id']};_0x4619b7[_[_0x16a2('0xb2')](_0x38cd6f['query'][_0x16a2('0xa0')][_0x16a2('0xa7')]())+_0x16a2('0xb4')]=_0x38cd6f[_0x16a2('0x45')][_0x16a2('0x65')][_0x4f4b1c];socket[_0x16a2('0xaa')](_0x16a2('0x89')+_[_0x16a2('0xb2')](_0x38cd6f['query'][_0x16a2('0xa0')][_0x16a2('0xa7')]())+_0x16a2('0xb5'),_0x4619b7);}return _0x3ee008;})['then'](function(){if(_0x38cd6f[_0x16a2('0x45')]['channel']===_0x16a2('0xad')){return db[_0x16a2('0xae')][_0x16a2('0x30')]({'where':{'UserId':_0x38cd6f['params']['id'],'VoiceQueueId':_0x38cd6f[_0x16a2('0x45')][_0x16a2('0x65')]},'individualHooks':!![]})['then'](function(){return _0x32b61f;});}return _0x32b61f;})[_0x16a2('0x1d')](respondWithStatusCode(_0x211641,null))[_0x16a2('0x25')](handleError(_0x211641,null));};exports[_0x16a2('0xb6')]=function(_0x2b3d56,_0x28d76c,_0x3afc36){_0x2b3d56[_0x16a2('0x62')][_0x16a2('0xb7')]=_0x2b3d56[_0x16a2('0xb8')][_0x16a2('0xb9')];return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x2b3d56[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x28d76c,null))[_0x16a2('0x1d')](saveUpdates(_0x2b3d56[_0x16a2('0x62')],null))['then'](respondWithResult(_0x28d76c,null))[_0x16a2('0x25')](handleError(_0x28d76c,null));};exports[_0x16a2('0xba')]=function(_0x3f21d0,_0x2e34e4,_0x12629b){var _0x4eea21=path[_0x16a2('0xbb')](config[_0x16a2('0xbc')],'server/files/images/logos/default_profile.png');return db[_0x16a2('0x56')]['find']({'where':{'id':_0x3f21d0[_0x16a2('0x5c')]['id']},'attributes':['id',_0x16a2('0xb7')],'raw':!![]})[_0x16a2('0x1d')](handleEntityNotFound(_0x2e34e4,null))[_0x16a2('0x1d')](function(_0x4138c0){if(_0x4138c0){if(_['isNil'](_0x4138c0[_0x16a2('0xb7')])){return _0x2e34e4[_0x16a2('0xbd')](_0x4eea21);}else{if(!fs[_0x16a2('0xbe')](path['join'](config['root'],_0x16a2('0xbf'),_0x4138c0[_0x16a2('0xb7')]))){return _0x2e34e4[_0x16a2('0xbd')](_0x4eea21);}return _0x2e34e4['download'](path[_0x16a2('0xbb')](config[_0x16a2('0xbc')],_0x16a2('0xbf'),_0x4138c0[_0x16a2('0xb7')]));}}})[_0x16a2('0x25')](handleError(_0x2e34e4,null));};exports[_0x16a2('0xc0')]=function(_0x1a1616,_0x53fae9,_0x419aa0){var _0x445799={};var _0x1a9aa2={};var _0x3ae509;var _0x4aeec6;return db[_0x16a2('0x56')][_0x16a2('0x94')]({'where':{'id':_0x1a1616[_0x16a2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53fae9,null))[_0x16a2('0x1d')](function(_0x28d444){if(_0x28d444){_0x3ae509=_0x28d444;_0x1a9aa2[_0x16a2('0x42')]=_[_0x16a2('0x46')](db[_0x16a2('0xc1')][_0x16a2('0x3e')]);_0x1a9aa2[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x1a1616[_0x16a2('0x45')]);_0x1a9aa2[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x1a9aa2[_0x16a2('0x42')],_0x1a9aa2[_0x16a2('0x45')]);_0x445799['attributes']=_[_0x16a2('0x49')](_0x1a9aa2['model'],qs['fields'](_0x1a1616['query'][_0x16a2('0x4a')]));_0x445799[_0x16a2('0x48')]=_0x445799[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x445799['attributes']:_0x1a9aa2[_0x16a2('0x42')];_0x445799['order']=qs['sort'](_0x1a1616['query']['sort']);_0x445799[_0x16a2('0x50')]=qs['filters'](_[_0x16a2('0x51')](_0x1a1616['query'],_0x1a9aa2[_0x16a2('0x47')]));if(_0x1a1616[_0x16a2('0x45')][_0x16a2('0x34')]){_0x445799[_0x16a2('0x50')]=_['merge'](_0x445799['where'],{'$or':_[_0x16a2('0x36')](_0x445799[_0x16a2('0x48')],function(_0x3e146d){var _0x27ffa6={};_0x27ffa6[_0x3e146d]={'$like':'%'+_0x1a1616[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x27ffa6;})});}_0x445799=_[_0x16a2('0x55')]({},_0x445799,_0x1a1616[_0x16a2('0x5f')]);return _0x3ae509['getContacts'](_0x445799);}})[_0x16a2('0x1d')](function(_0x21820a){if(_0x21820a){_0x4aeec6=_0x21820a[_0x16a2('0x5e')];if(_0x1a1616[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x57'))){_0x445799[_0x16a2('0x58')]=[{'model':db[_0x16a2('0xc2')],'as':_0x16a2('0xc3'),'required':![]},{'model':db[_0x16a2('0xc4')],'as':_0x16a2('0xc5'),'attributes':['id',_0x16a2('0x3a'),_0x16a2('0xc6')],'where':_0x1a1616[_0x16a2('0x45')][_0x16a2('0xc7')]?{'id':_0x1a1616[_0x16a2('0x45')][_0x16a2('0xc7')]}:undefined,'required':_0x1a1616['query'][_0x16a2('0xc7')]?!![]:![]}];}if(!_0x1a1616['query']['hasOwnProperty'](_0x16a2('0x4c'))){_0x445799[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x1a1616[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x445799[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x1a1616[_0x16a2('0x45')][_0x16a2('0x2b')]);}return _0x3ae509[_0x16a2('0xc0')](_0x445799);}})[_0x16a2('0x1d')](function(_0x292550){if(_0x292550){return _0x292550?{'count':_0x4aeec6,'rows':_0x292550}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x53fae9,null))[_0x16a2('0x25')](handleError(_0x53fae9,null));};exports[_0x16a2('0xc8')]=function(_0x271d22,_0x257850,_0x390581){var _0x46ef19;var _0x189bd7;var _0x4e2b7a={};var _0x49a4cc;return db['User'][_0x16a2('0x94')]({'where':{'id':_0x271d22[_0x16a2('0x5c')]['id']},'attributes':['id',_0x16a2('0x3a'),'role']})['then'](handleEntityNotFound(_0x257850,null))[_0x16a2('0x1d')](function(_0xcce2c3){if(!utils['isValidChannel'](_0x271d22[_0x16a2('0x45')][_0x16a2('0xa0')])){throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0xa5'));}_0x46ef19=_0xcce2c3;var _0x781ab9={};_0x781ab9[_0x16a2('0x42')]=_[_0x16a2('0x46')](db[_[_0x16a2('0xb2')](_0x271d22['query']['channel'])+_0x16a2('0xc9')][_0x16a2('0x3e')]);_0x781ab9[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x271d22[_0x16a2('0x45')]);_0x781ab9[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x781ab9[_0x16a2('0x42')],_0x781ab9['query']);_0x4e2b7a[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x781ab9[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x271d22['query'][_0x16a2('0x4a')]));_0x4e2b7a[_0x16a2('0x48')]=_0x4e2b7a[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x4e2b7a[_0x16a2('0x48')]:_0x781ab9[_0x16a2('0x42')];_0x4e2b7a[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x271d22['query'][_0x16a2('0x4f')]);_0x4e2b7a[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x271d22[_0x16a2('0x45')],_0x781ab9[_0x16a2('0x47')]));if(_0x271d22[_0x16a2('0x45')][_0x16a2('0x34')]){_0x4e2b7a[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x4e2b7a['where'],{'$or':_[_0x16a2('0x36')](_0x4e2b7a[_0x16a2('0x48')],function(_0x2eeedf){var _0x3b9d05={};_0x3b9d05[_0x2eeedf]={'$like':'%'+_0x271d22[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x3b9d05;})});}_0x4e2b7a=_[_0x16a2('0x55')]({},_0x4e2b7a,_0x271d22[_0x16a2('0x5f')]);switch(_0x46ef19[_0x16a2('0x39')]){case _0x16a2('0x68'):return db[_[_0x16a2('0xb2')](_0x271d22['query'][_0x16a2('0xa0')])+_0x16a2('0xc9')]['findAll'](_0x4e2b7a);case _0x16a2('0x89'):case _0x16a2('0x66'):return _0x46ef19['get'+_[_0x16a2('0xb2')](_0x271d22[_0x16a2('0x45')]['channel'])+_0x16a2('0xb3')](_0x4e2b7a);default:throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0xca'));}})[_0x16a2('0x1d')](function(_0xd8354){_0x49a4cc=_0xd8354[_0x16a2('0x5e')];if(!_0x271d22[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x4e2b7a[_0x16a2('0x4d')]=qs['limit'](_0x271d22[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x4e2b7a[_0x16a2('0x2b')]=qs['offset'](_0x271d22[_0x16a2('0x45')]['offset']);}switch(_0x46ef19['role']){case _0x16a2('0x68'):return db[_[_0x16a2('0xb2')](_0x271d22['query'][_0x16a2('0xa0')])+_0x16a2('0xc9')][_0x16a2('0x59')](_0x4e2b7a);case _0x16a2('0x89'):case _0x16a2('0x66'):return _0x46ef19[_0x16a2('0x31')+_[_0x16a2('0xb2')](_0x271d22[_0x16a2('0x45')][_0x16a2('0xa0')])+_0x16a2('0xb3')](_0x4e2b7a);}})[_0x16a2('0x1d')](function(_0x274860){return{'count':_0x49a4cc,'rows':_0x274860};})[_0x16a2('0x1d')](respondWithResult(_0x257850,null))[_0x16a2('0x25')](handleError(_0x257850,null));};exports[_0x16a2('0xcb')]=function(_0x241c19,_0x57a5b5,_0x4a11da){var _0x20c32f={};var _0x5b953b={};var _0x2d66ee;var _0x48d109;return db[_0x16a2('0x56')]['findOne']({'where':{'id':_0x241c19[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x57a5b5,null))['then'](function(_0x5a3915){if(_0x5a3915){_0x2d66ee=_0x5a3915;_0x5b953b[_0x16a2('0x42')]=_[_0x16a2('0x46')](db[_0x16a2('0xae')]['rawAttributes']);_0x5b953b['query']=_['keys'](_0x241c19[_0x16a2('0x45')]);_0x5b953b[_0x16a2('0x47')]=_['intersection'](_0x5b953b[_0x16a2('0x42')],_0x5b953b['query']);_0x20c32f[_0x16a2('0x48')]=_['intersection'](_0x5b953b[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x241c19['query'][_0x16a2('0x4a')]));_0x20c32f[_0x16a2('0x48')]=_0x20c32f['attributes']['length']?_0x20c32f[_0x16a2('0x48')]:_0x5b953b[_0x16a2('0x42')];_0x20c32f['order']=qs[_0x16a2('0x4f')](_0x241c19[_0x16a2('0x45')][_0x16a2('0x4f')]);_0x20c32f[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_['pick'](_0x241c19[_0x16a2('0x45')],_0x5b953b['filters']));if(_0x241c19[_0x16a2('0x45')][_0x16a2('0x34')]){_0x20c32f[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x20c32f[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x20c32f[_0x16a2('0x48')],function(_0x552993){var _0x1b71a0={};_0x1b71a0[_0x552993]={'$like':'%'+_0x241c19[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x1b71a0;})});}_0x20c32f=_[_0x16a2('0x55')]({},_0x20c32f,_0x241c19['options']);return _0x2d66ee['getVoiceQueuesRt'](_0x20c32f);}})[_0x16a2('0x1d')](function(_0x46833b){if(_0x46833b){_0x48d109=_0x46833b['length'];if(!_0x241c19[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x20c32f[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x241c19['query']['limit']);_0x20c32f[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x241c19[_0x16a2('0x45')][_0x16a2('0x2b')]);}return _0x2d66ee[_0x16a2('0xcb')](_0x20c32f);}})['then'](function(_0x417801){if(_0x417801){return _0x417801?{'count':_0x48d109,'rows':_0x417801}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x57a5b5,null))[_0x16a2('0x25')](handleError(_0x57a5b5,null));};exports[_0x16a2('0xcc')]=function(_0x3a47ed,_0x2b212d,_0x588a3d){var _0x4cc87f={};var _0x54938c={};var _0x1a62eb;var _0x546b4a;return db[_0x16a2('0x56')][_0x16a2('0x94')]({'where':{'id':_0x3a47ed[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x2b212d,null))['then'](function(_0x595e94){if(_0x595e94){_0x1a62eb=_0x595e94;_0x54938c[_0x16a2('0x42')]=_[_0x16a2('0x46')](db['ChatGroup'][_0x16a2('0x3e')]);_0x54938c[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x3a47ed[_0x16a2('0x45')]);_0x54938c[_0x16a2('0x47')]=_['intersection'](_0x54938c[_0x16a2('0x42')],_0x54938c['query']);_0x4cc87f[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x54938c[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x3a47ed[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x4cc87f[_0x16a2('0x48')]=_0x4cc87f[_0x16a2('0x48')]['length']?_0x4cc87f[_0x16a2('0x48')]:_0x54938c['model'];_0x4cc87f['order']=qs[_0x16a2('0x4f')](_0x3a47ed[_0x16a2('0x45')]['sort']);_0x4cc87f['where']=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x3a47ed[_0x16a2('0x45')],_0x54938c[_0x16a2('0x47')]));if(_0x3a47ed[_0x16a2('0x45')][_0x16a2('0x34')]){_0x4cc87f[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x4cc87f[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x4cc87f[_0x16a2('0x48')],function(_0x3de80e){var _0x307480={};_0x307480[_0x3de80e]={'$like':'%'+_0x3a47ed[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x307480;})});}_0x4cc87f=_[_0x16a2('0x55')]({},_0x4cc87f,_0x3a47ed[_0x16a2('0x5f')]);return _0x1a62eb[_0x16a2('0xcc')](_0x4cc87f);}})[_0x16a2('0x1d')](function(_0x4563a8){if(_0x4563a8){_0x546b4a=_0x4563a8[_0x16a2('0x5e')];if(!_0x3a47ed[_0x16a2('0x45')][_0x16a2('0x4b')]('nolimit')){_0x4cc87f['limit']=qs[_0x16a2('0x4d')](_0x3a47ed[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x4cc87f[_0x16a2('0x2b')]=qs['offset'](_0x3a47ed[_0x16a2('0x45')][_0x16a2('0x2b')]);}return _0x1a62eb['getGroups'](_0x4cc87f);}})[_0x16a2('0x1d')](function(_0x13937d){if(_0x13937d){return _0x13937d?{'count':_0x546b4a,'rows':_0x13937d}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x2b212d,null))['catch'](handleError(_0x2b212d,null));};exports[_0x16a2('0xcd')]=function(_0x4120d8,_0x196b77,_0x3849ab){var _0x595214={'raw':!![],'where':{}};var _0x320f5a={};var _0xdbe6e0={'count':0x0,'rows':[]};return db['User'][_0x16a2('0x94')]({'where':{'id':_0x4120d8['params']['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x196b77,null))[_0x16a2('0x1d')](function(_0x31d603){if(_0x31d603){_0x320f5a['model']=_[_0x16a2('0x46')](db[_0x16a2('0xce')][_0x16a2('0x3e')]);_0x320f5a[_0x16a2('0x45')]=_['keys'](_0x4120d8[_0x16a2('0x45')]);_0x320f5a['filters']=_[_0x16a2('0x49')](_0x320f5a['model'],_0x320f5a[_0x16a2('0x45')]);_0x595214['attributes']=_[_0x16a2('0x49')](_0x320f5a[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x4120d8['query']['fields']));_0x595214['attributes']=_0x595214['attributes']['length']?_0x595214[_0x16a2('0x48')]:_0x320f5a[_0x16a2('0x42')];if(!_0x4120d8[_0x16a2('0x45')][_0x16a2('0x4b')]('nolimit')){_0x595214[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x4120d8[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x595214[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x4120d8[_0x16a2('0x45')][_0x16a2('0x2b')]);}_0x595214[_0x16a2('0x4e')]=qs['sort'](_0x4120d8[_0x16a2('0x45')]['sort']);_0x595214[_0x16a2('0x50')]=qs['filters'](_[_0x16a2('0x51')](_0x4120d8['query'],_0x320f5a[_0x16a2('0x47')]));_0x595214[_0x16a2('0x50')][_0x16a2('0xcf')]=_0x31d603['id'];if(_0x4120d8[_0x16a2('0x45')]['filter']){_0x595214['where']=_[_0x16a2('0x55')](_0x595214[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x595214['attributes'],function(_0x1d35a1){var _0x55603b={};_0x55603b[_0x1d35a1]={'$like':'%'+_0x4120d8[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x55603b;})});}_0x595214=_['merge']({},_0x595214,_0x4120d8[_0x16a2('0x5f')]);return db[_0x16a2('0xce')][_0x16a2('0x2a')]({'where':_0x595214[_0x16a2('0x50')]})[_0x16a2('0x1d')](function(_0x2a3600){_0xdbe6e0[_0x16a2('0x2a')]=_0x2a3600;if(_0x4120d8[_0x16a2('0x45')][_0x16a2('0x57')]){_0x595214[_0x16a2('0x58')]=[{'all':!![]}];}return db[_0x16a2('0xce')][_0x16a2('0x59')](_0x595214);})[_0x16a2('0x1d')](function(_0x35172b){_0xdbe6e0[_0x16a2('0x5a')]=_0x35172b;return _0xdbe6e0;});}})[_0x16a2('0x1d')](respondWithFilteredResult(_0x196b77,_0x595214))[_0x16a2('0x25')](handleError(_0x196b77,null));};exports[_0x16a2('0xd0')]=function(_0x1134f9,_0x47628f,_0x258df7){var _0x376470={'raw':!![],'where':{}};var _0x505c2e={};var _0x3f88f9={'count':0x0,'rows':[]};return db[_0x16a2('0x56')][_0x16a2('0x94')]({'where':{'id':_0x1134f9[_0x16a2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47628f,null))[_0x16a2('0x1d')](function(_0x56bc86){if(_0x56bc86){_0x505c2e[_0x16a2('0x42')]=_[_0x16a2('0x46')](db[_0x16a2('0xd1')]['rawAttributes']);_0x505c2e[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x1134f9[_0x16a2('0x45')]);_0x505c2e[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x505c2e[_0x16a2('0x42')],_0x505c2e['query']);_0x376470[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x505c2e[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x1134f9[_0x16a2('0x45')]['fields']));_0x376470[_0x16a2('0x48')]=_0x376470['attributes']['length']?_0x376470['attributes']:_0x505c2e[_0x16a2('0x42')];if(!_0x1134f9['query'][_0x16a2('0x4b')]('nolimit')){_0x376470['limit']=qs[_0x16a2('0x4d')](_0x1134f9[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x376470[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x1134f9[_0x16a2('0x45')][_0x16a2('0x2b')]);}_0x376470[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x1134f9['query'][_0x16a2('0x4f')]);_0x376470[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x1134f9[_0x16a2('0x45')],_0x505c2e[_0x16a2('0x47')]));_0x376470['where'][_0x16a2('0xcf')]=_0x56bc86['id'];if(_0x1134f9[_0x16a2('0x45')][_0x16a2('0x34')]){_0x376470[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x376470[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x376470[_0x16a2('0x48')],function(_0x15125b){var _0x59d8d0={};_0x59d8d0[_0x15125b]={'$like':'%'+_0x1134f9[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x59d8d0;})});}_0x376470=_[_0x16a2('0x55')]({},_0x376470,_0x1134f9[_0x16a2('0x5f')]);return db[_0x16a2('0xd1')][_0x16a2('0x2a')]({'where':_0x376470[_0x16a2('0x50')]})[_0x16a2('0x1d')](function(_0xcd08cb){_0x3f88f9[_0x16a2('0x2a')]=_0xcd08cb;if(_0x1134f9[_0x16a2('0x45')][_0x16a2('0x57')]){_0x376470[_0x16a2('0x58')]=[{'all':!![]}];}return db[_0x16a2('0xd1')][_0x16a2('0x59')](_0x376470);})['then'](function(_0x2473f9){_0x3f88f9[_0x16a2('0x5a')]=_0x2473f9;return _0x3f88f9;});}})[_0x16a2('0x1d')](respondWithFilteredResult(_0x47628f,_0x376470))[_0x16a2('0x25')](handleError(_0x47628f,null));};exports[_0x16a2('0xd2')]=function(_0x1079e8,_0x5de377,_0x3361bd){var _0x50cf64={};var _0x4e38a9={};var _0x283bf9;var _0x580b74;return db[_0x16a2('0x56')][_0x16a2('0x94')]({'where':{'id':_0x1079e8['params']['id']}})['then'](handleEntityNotFound(_0x5de377,null))[_0x16a2('0x1d')](function(_0x41a7c5){if(_0x41a7c5){_0x283bf9=_0x41a7c5;_0x4e38a9[_0x16a2('0x42')]=_['keys'](db[_0x16a2('0xd3')]['rawAttributes']);_0x4e38a9[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x1079e8[_0x16a2('0x45')]);_0x4e38a9[_0x16a2('0x47')]=_['intersection'](_0x4e38a9[_0x16a2('0x42')],_0x4e38a9[_0x16a2('0x45')]);_0x50cf64[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x4e38a9[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x1079e8[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x50cf64[_0x16a2('0x48')]=_0x50cf64[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x50cf64['attributes']:_0x4e38a9[_0x16a2('0x42')];_0x50cf64['order']=qs[_0x16a2('0x4f')](_0x1079e8[_0x16a2('0x45')][_0x16a2('0x4f')]);_0x50cf64['where']=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x1079e8[_0x16a2('0x45')],_0x4e38a9[_0x16a2('0x47')]));if(_0x1079e8[_0x16a2('0x45')]['filter']){_0x50cf64[_0x16a2('0x50')]=_['merge'](_0x50cf64[_0x16a2('0x50')],{'$or':_['map'](_0x50cf64['attributes'],function(_0x5452e6){var _0x34fbf9={};_0x34fbf9[_0x5452e6]={'$like':'%'+_0x1079e8[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x34fbf9;})});}_0x50cf64=_[_0x16a2('0x55')]({},_0x50cf64,_0x1079e8[_0x16a2('0x5f')]);return _0x283bf9[_0x16a2('0xd2')](_0x50cf64);}})[_0x16a2('0x1d')](function(_0x4f798a){if(_0x4f798a){_0x580b74=_0x4f798a[_0x16a2('0x5e')];if(!_0x1079e8[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x50cf64['limit']=qs['limit'](_0x1079e8[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x50cf64[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x1079e8['query'][_0x16a2('0x2b')]);}return _0x283bf9[_0x16a2('0xd2')](_0x50cf64);}})[_0x16a2('0x1d')](function(_0x3022a4){if(_0x3022a4){return _0x3022a4?{'count':_0x580b74,'rows':_0x3022a4}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x5de377,null))[_0x16a2('0x25')](handleError(_0x5de377,null));};exports[_0x16a2('0xd4')]=function(_0x3a2016,_0x38eb67,_0x44d277){var _0x16829f={};var _0x127c7f={};var _0x17b5af;var _0x5a1d07;return db['User']['findOne']({'where':{'id':_0x3a2016[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x38eb67,null))['then'](function(_0x5eface){if(_0x5eface){_0x17b5af=_0x5eface;_0x127c7f[_0x16a2('0x42')]=_['keys'](db[_0x16a2('0xd5')]['rawAttributes']);_0x127c7f[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x3a2016[_0x16a2('0x45')]);_0x127c7f['filters']=_['intersection'](_0x127c7f[_0x16a2('0x42')],_0x127c7f[_0x16a2('0x45')]);_0x16829f[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x127c7f[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x3a2016['query'][_0x16a2('0x4a')]));_0x16829f[_0x16a2('0x48')]=_0x16829f[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x16829f[_0x16a2('0x48')]:_0x127c7f['model'];_0x16829f['order']=qs[_0x16a2('0x4f')](_0x3a2016[_0x16a2('0x45')][_0x16a2('0x4f')]);_0x16829f[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x3a2016[_0x16a2('0x45')],_0x127c7f['filters']));if(_0x3a2016[_0x16a2('0x45')]['filter']){_0x16829f[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x16829f[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x16829f[_0x16a2('0x48')],function(_0x5b8c35){var _0xabcd49={};_0xabcd49[_0x5b8c35]={'$like':'%'+_0x3a2016[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0xabcd49;})});}_0x16829f=_['merge']({},_0x16829f,_0x3a2016[_0x16a2('0x5f')]);return _0x17b5af[_0x16a2('0xd4')](_0x16829f);}})['then'](function(_0x1bd6e6){if(_0x1bd6e6){_0x5a1d07=_0x1bd6e6[_0x16a2('0x5e')];if(!_0x3a2016[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x16829f[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x3a2016[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x16829f['offset']=qs[_0x16a2('0x2b')](_0x3a2016[_0x16a2('0x45')]['offset']);}return _0x17b5af[_0x16a2('0xd4')](_0x16829f);}})[_0x16a2('0x1d')](function(_0xe905bb){if(_0xe905bb){return _0xe905bb?{'count':_0x5a1d07,'rows':_0xe905bb}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x38eb67,null))['catch'](handleError(_0x38eb67,null));};exports[_0x16a2('0xd6')]=function(_0x3b5d29,_0x448414,_0xea850a){var _0x5a6fab={'raw':!![],'where':{}};var _0x10d1db={};var _0x3915d0={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3b5d29[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x448414,null))[_0x16a2('0x1d')](function(_0x4672d1){if(_0x4672d1){_0x10d1db[_0x16a2('0x42')]=_['keys'](db[_0x16a2('0xd7')]['rawAttributes']);_0x10d1db[_0x16a2('0x45')]=_['keys'](_0x3b5d29[_0x16a2('0x45')]);_0x10d1db[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x10d1db['model'],_0x10d1db[_0x16a2('0x45')]);_0x5a6fab['attributes']=_['intersection'](_0x10d1db[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x3b5d29[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x5a6fab['attributes']=_0x5a6fab[_0x16a2('0x48')]['length']?_0x5a6fab['attributes']:_0x10d1db['model'];if(!_0x3b5d29[_0x16a2('0x45')][_0x16a2('0x4b')]('nolimit')){_0x5a6fab[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x3b5d29[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x5a6fab[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x3b5d29[_0x16a2('0x45')][_0x16a2('0x2b')]);}_0x5a6fab[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x3b5d29['query'][_0x16a2('0x4f')]);_0x5a6fab[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x3b5d29[_0x16a2('0x45')],_0x10d1db[_0x16a2('0x47')]));_0x5a6fab[_0x16a2('0x50')]['UserId']=_0x4672d1['id'];if(_0x3b5d29[_0x16a2('0x45')]['filter']){_0x5a6fab['where']=_[_0x16a2('0x55')](_0x5a6fab[_0x16a2('0x50')],{'$or':_['map'](_0x5a6fab['attributes'],function(_0x4c67f6){var _0x57a519={};_0x57a519[_0x4c67f6]={'$like':'%'+_0x3b5d29[_0x16a2('0x45')]['filter']+'%'};return _0x57a519;})});}_0x5a6fab=_[_0x16a2('0x55')]({},_0x5a6fab,_0x3b5d29[_0x16a2('0x5f')]);return db[_0x16a2('0xd7')][_0x16a2('0x2a')]({'where':_0x5a6fab[_0x16a2('0x50')]})[_0x16a2('0x1d')](function(_0x5c4997){_0x3915d0['count']=_0x5c4997;if(_0x3b5d29['query'][_0x16a2('0x57')]){_0x5a6fab[_0x16a2('0x58')]=[{'all':!![]}];}return db[_0x16a2('0xd7')][_0x16a2('0x59')](_0x5a6fab);})[_0x16a2('0x1d')](function(_0x6d6c18){_0x3915d0[_0x16a2('0x5a')]=_0x6d6c18;return _0x3915d0;});}})[_0x16a2('0x1d')](respondWithFilteredResult(_0x448414,_0x5a6fab))[_0x16a2('0x25')](handleError(_0x448414,null));};exports[_0x16a2('0xd8')]=function(_0x306fd3,_0x369c65,_0x411e94){var _0x5b6ea7={};var _0x340964={};var _0x3833c0;var _0x4a7456;return db['User'][_0x16a2('0x94')]({'where':{'id':_0x306fd3['params']['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x369c65,null))[_0x16a2('0x1d')](function(_0x3ebc80){if(_0x3ebc80){_0x3833c0=_0x3ebc80;_0x340964['model']=_[_0x16a2('0x46')](db[_0x16a2('0xd9')][_0x16a2('0x3e')]);_0x340964[_0x16a2('0x45')]=_['keys'](_0x306fd3[_0x16a2('0x45')]);_0x340964[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x340964[_0x16a2('0x42')],_0x340964[_0x16a2('0x45')]);_0x5b6ea7[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x340964['model'],qs[_0x16a2('0x4a')](_0x306fd3[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x5b6ea7['attributes']=_0x5b6ea7[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x5b6ea7[_0x16a2('0x48')]:_0x340964[_0x16a2('0x42')];_0x5b6ea7[_0x16a2('0x4e')]=qs['sort'](_0x306fd3['query'][_0x16a2('0x4f')]);_0x5b6ea7['where']=qs[_0x16a2('0x47')](_['pick'](_0x306fd3[_0x16a2('0x45')],_0x340964[_0x16a2('0x47')]));if(_0x306fd3[_0x16a2('0x45')][_0x16a2('0x34')]){_0x5b6ea7[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x5b6ea7['where'],{'$or':_[_0x16a2('0x36')](_0x5b6ea7[_0x16a2('0x48')],function(_0x446513){var _0x291135={};_0x291135[_0x446513]={'$like':'%'+_0x306fd3['query']['filter']+'%'};return _0x291135;})});}_0x5b6ea7=_[_0x16a2('0x55')]({},_0x5b6ea7,_0x306fd3[_0x16a2('0x5f')]);return _0x3833c0['getSmsInteractions'](_0x5b6ea7);}})[_0x16a2('0x1d')](function(_0x333f8e){if(_0x333f8e){_0x4a7456=_0x333f8e[_0x16a2('0x5e')];if(!_0x306fd3[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x5b6ea7[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x306fd3[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x5b6ea7[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x306fd3[_0x16a2('0x45')]['offset']);}return _0x3833c0['getSmsInteractions'](_0x5b6ea7);}})[_0x16a2('0x1d')](function(_0x1b178d){if(_0x1b178d){return _0x1b178d?{'count':_0x4a7456,'rows':_0x1b178d}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x369c65,null))['catch'](handleError(_0x369c65,null));};exports['getFaxInteractions']=function(_0x493f85,_0x39bfb9,_0x167063){var _0x32c1d2={};var _0x1376f1={};var _0x965d49;var _0x3b922f;return db['User']['findOne']({'where':{'id':_0x493f85[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x39bfb9,null))[_0x16a2('0x1d')](function(_0x34fda8){if(_0x34fda8){_0x965d49=_0x34fda8;_0x1376f1['model']=_[_0x16a2('0x46')](db[_0x16a2('0xda')][_0x16a2('0x3e')]);_0x1376f1[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x493f85[_0x16a2('0x45')]);_0x1376f1[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x1376f1['model'],_0x1376f1[_0x16a2('0x45')]);_0x32c1d2[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x1376f1[_0x16a2('0x42')],qs[_0x16a2('0x4a')](_0x493f85[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x32c1d2[_0x16a2('0x48')]=_0x32c1d2[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x32c1d2[_0x16a2('0x48')]:_0x1376f1[_0x16a2('0x42')];_0x32c1d2[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x493f85[_0x16a2('0x45')][_0x16a2('0x4f')]);_0x32c1d2[_0x16a2('0x50')]=qs['filters'](_['pick'](_0x493f85[_0x16a2('0x45')],_0x1376f1[_0x16a2('0x47')]));if(_0x493f85[_0x16a2('0x45')]['filter']){_0x32c1d2[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x32c1d2[_0x16a2('0x50')],{'$or':_['map'](_0x32c1d2['attributes'],function(_0x27ea2f){var _0x42bc32={};_0x42bc32[_0x27ea2f]={'$like':'%'+_0x493f85[_0x16a2('0x45')]['filter']+'%'};return _0x42bc32;})});}_0x32c1d2=_['merge']({},_0x32c1d2,_0x493f85[_0x16a2('0x5f')]);return _0x965d49[_0x16a2('0xdb')](_0x32c1d2);}})[_0x16a2('0x1d')](function(_0x1f91f8){if(_0x1f91f8){_0x3b922f=_0x1f91f8['length'];if(!_0x493f85[_0x16a2('0x45')][_0x16a2('0x4b')]('nolimit')){_0x32c1d2[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x493f85[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x32c1d2['offset']=qs[_0x16a2('0x2b')](_0x493f85[_0x16a2('0x45')]['offset']);}return _0x965d49[_0x16a2('0xdb')](_0x32c1d2);}})[_0x16a2('0x1d')](function(_0xae89a2){if(_0xae89a2){return _0xae89a2?{'count':_0x3b922f,'rows':_0xae89a2}:null;}})['then'](respondWithResult(_0x39bfb9,null))['catch'](handleError(_0x39bfb9,null));};exports[_0x16a2('0xdc')]=function(_0x2456e5,_0x31de17,_0x4972aa){var _0x5dd303={};var _0x3194da={};var _0x2151f2;var _0x28e7d4;return db[_0x16a2('0x56')][_0x16a2('0x94')]({'where':{'id':_0x2456e5[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x31de17,null))[_0x16a2('0x1d')](function(_0x9900f9){if(_0x9900f9){_0x2151f2=_0x9900f9;_0x3194da[_0x16a2('0x42')]=_[_0x16a2('0x46')](db[_0x16a2('0xdd')][_0x16a2('0x3e')]);_0x3194da[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x2456e5[_0x16a2('0x45')]);_0x3194da[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x3194da[_0x16a2('0x42')],_0x3194da[_0x16a2('0x45')]);_0x5dd303['attributes']=_[_0x16a2('0x49')](_0x3194da['model'],qs['fields'](_0x2456e5[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x5dd303[_0x16a2('0x48')]=_0x5dd303[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x5dd303[_0x16a2('0x48')]:_0x3194da[_0x16a2('0x42')];_0x5dd303['order']=qs[_0x16a2('0x4f')](_0x2456e5[_0x16a2('0x45')]['sort']);_0x5dd303[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_['pick'](_0x2456e5[_0x16a2('0x45')],_0x3194da[_0x16a2('0x47')]));if(_0x2456e5[_0x16a2('0x45')][_0x16a2('0x34')]){_0x5dd303[_0x16a2('0x50')]=_['merge'](_0x5dd303[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x5dd303['attributes'],function(_0x5afde7){var _0x5761c1={};_0x5761c1[_0x5afde7]={'$like':'%'+_0x2456e5['query'][_0x16a2('0x34')]+'%'};return _0x5761c1;})});}_0x5dd303=_[_0x16a2('0x55')]({},_0x5dd303,_0x2456e5['options']);return _0x2151f2['getWhatsappInteractions'](_0x5dd303);}})[_0x16a2('0x1d')](function(_0xb385eb){if(_0xb385eb){_0x28e7d4=_0xb385eb[_0x16a2('0x5e')];if(!_0x2456e5[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x5dd303[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x2456e5['query']['limit']);_0x5dd303[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x2456e5['query'][_0x16a2('0x2b')]);}return _0x2151f2[_0x16a2('0xdc')](_0x5dd303);}})[_0x16a2('0x1d')](function(_0x3cdca6){if(_0x3cdca6){return _0x3cdca6?{'count':_0x28e7d4,'rows':_0x3cdca6}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x31de17,null))[_0x16a2('0x25')](handleError(_0x31de17,null));};exports['login']=function(_0x378d6d,_0x48d085,_0x591809){var _0x3525f3;var _0x44494d;var _0x2d6c8d;var _0x1fdf17=!_['isNil'](_0x378d6d[_0x16a2('0x5c')]['id'])?_0x378d6d[_0x16a2('0x5c')]['id']:!_[_0x16a2('0x6d')](_0x378d6d[_0x16a2('0x89')]['id'])?_0x378d6d[_0x16a2('0x89')]['id']:null;return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x1fdf17,'role':{'$or':[_0x16a2('0x68'),'user','agent']}},'attributes':['id','name',_0x16a2('0xde'),_0x16a2('0xdf'),_0x16a2('0x39'),_0x16a2('0x71'),_0x16a2('0xa2')]})['then'](function(_0x5bc9b2){if(_0x5bc9b2){if(_0x5bc9b2[_0x16a2('0x39')]===_0x16a2('0x66')){_0x3525f3=_0x5bc9b2;if(_0x378d6d[_0x16a2('0x62')][_0x16a2('0xa3')]){_0x2d6c8d=util['format'](_0x16a2('0xe0'),_0x3525f3[_0x378d6d['body'][_0x16a2('0xa3')]]);}else if(_0x378d6d[_0x16a2('0x62')][_0x16a2('0xe1')]){_0x2d6c8d=util['format'](_0x16a2('0xe2'),_0x378d6d['body'][_0x16a2('0xe1')]);}else{_0x2d6c8d=util[_0x16a2('0x6f')](_0x16a2('0xe2'),_0x3525f3[_0x16a2('0x3a')]);}socket['to'](util['format'](_0x16a2('0xe3'),_0x3525f3[_0x16a2('0x3a')]))[_0x16a2('0xaa')](_0x16a2('0xe4'),{'ip':_0x378d6d[_0x16a2('0xe5')][_0x16a2('0xe6')]||_0x378d6d[_0x16a2('0xe7')]['remoteAddress']||_0x378d6d['socket'][_0x16a2('0xe8')]||_0x378d6d[_0x16a2('0xe7')][_0x16a2('0xe9')][_0x16a2('0xe8')]});return db[_0x16a2('0xae')][_0x16a2('0x30')]({'where':{'membername':_0x3525f3[_0x16a2('0x3a')]},'individualHooks':!![]});}}else{throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0xea'));}})[_0x16a2('0x1d')](function(){if(_0x3525f3){return _0x3525f3['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x26051e){if(_0x3525f3){var _0x4c90c3=[];if(_0x26051e){_0x44494d=_0x26051e;if(_0x44494d[_0x16a2('0x5e')]){for(var _0x5a4597=0x0;_0x5a4597<_0x44494d[_0x16a2('0x5e')];_0x5a4597++){_0x4c90c3[_0x16a2('0xeb')]({'membername':_0x3525f3[_0x16a2('0x3a')],'UserId':_0x3525f3['id'],'queue_name':_0x44494d[_0x5a4597][_0x16a2('0x3a')],'VoiceQueueId':_0x44494d[_0x5a4597]['id'],'interface':_0x2d6c8d,'paused':_0x3525f3[_0x16a2('0xa2')]||![],'penalty':_0x44494d[_0x5a4597][_0x16a2('0xec')]||0x0});}return BPromise[_0x16a2('0xed')](_0x4c90c3,function(_0x1d5c6a){return db[_0x16a2('0xae')][_0x16a2('0xaf')](_0x1d5c6a);});}}}})['then'](function(){if(_0x3525f3){return db[_0x16a2('0xee')][_0x16a2('0x59')]({'where':{'membername':_0x3525f3[_0x16a2('0x3a')],'exitAt':null}});}})[_0x16a2('0x1d')](function(_0x47c108){if(_0x3525f3){var _0x1ab159=[];_0x47c108['forEach'](function(_0xdb0e84){_0x1ab159[_0x16a2('0xeb')](_0xdb0e84[_0x16a2('0x2f')]({'exitAt':moment()[_0x16a2('0x6f')](_0x16a2('0xef'))}));});return BPromise[_0x16a2('0xf0')](_0x1ab159);}})[_0x16a2('0x1d')](function(){if(_0x3525f3){var _0x18b918=[];var _0x42e93b=[];var _0x6701b4=utils['getChannels']();var _0x24118b={'membername':_0x3525f3[_0x16a2('0x3a')],'interface':_0x2d6c8d,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3525f3[_0x16a2('0x39')],'internal':_0x3525f3['internal']};_0x6701b4['forEach'](function(_0x440b45){_0x18b918['push'](_[_0x16a2('0x55')]({'channel':_0x440b45,'type':'LOGIN','data1':_0x378d6d['body'][_0x16a2('0xf1')],'data2':_0x2d6c8d},_0x24118b));if(_0x3525f3[_0x16a2('0xa2')]){_0x42e93b[_0x16a2('0xeb')](_['merge']({'channel':_0x440b45,'type':'PAUSE','data1':_0x16a2('0xf2')},_0x24118b));}});return db[_0x16a2('0xee')][_0x16a2('0x61')](_0x18b918[_0x16a2('0xf3')](_0x42e93b),{'individualHooks':!![]});}})[_0x16a2('0x1d')](function(){if(_0x3525f3){return _0x3525f3[_0x16a2('0x2f')]({'online':!![],'lastLoginAt':moment()['format'](_0x16a2('0xef')),'voicePause':_0x3525f3[_0x16a2('0xa2')]||![],'mailPause':_0x3525f3['loginInPause']||![],'chatPause':_0x3525f3[_0x16a2('0xa2')]||![],'faxPause':_0x3525f3[_0x16a2('0xa2')]||![],'smsPause':_0x3525f3[_0x16a2('0xa2')]||![],'openchannelPause':_0x3525f3[_0x16a2('0xa2')]||![],'whatsappPause':_0x3525f3[_0x16a2('0xa2')]||![],'pauseType':_0x3525f3[_0x16a2('0xa2')]?'LOGININPAUSE':null,'interface':_0x2d6c8d,'lastPauseAt':moment()[_0x16a2('0x6f')](_0x16a2('0xef'))});}})[_0x16a2('0x1d')](function(_0x238764){if(_0x378d6d[_0x16a2('0xf4')]){return _0x591809();}else{return BPromise[_0x16a2('0xf5')](_0x238764)[_0x16a2('0x1d')](respondWithResult(_0x48d085,null));}})[_0x16a2('0x25')](handleError(_0x48d085,null));};exports[_0x16a2('0xf6')]=function(_0x2118d3,_0x478d87,_0x3d4b41){var _0x4e101e;return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x2118d3[_0x16a2('0x5c')]['id'],'role':_0x16a2('0x66')},'attributes':['id',_0x16a2('0x3a'),_0x16a2('0x39')]})['then'](handleEntityNotFound(_0x478d87,null))[_0x16a2('0x1d')](function(_0x2c975f){if(_0x2c975f){_0x4e101e=_0x2c975f;return db[_0x16a2('0xae')][_0x16a2('0x30')]({'where':{'membername':_0x4e101e[_0x16a2('0x3a')]},'individualHooks':!![]});}})[_0x16a2('0x1d')](function(){return db[_0x16a2('0xee')][_0x16a2('0x59')]({'where':{'membername':_0x4e101e[_0x16a2('0x3a')],'exitAt':null}});})[_0x16a2('0x1d')](function(_0x57b777){var _0x2ecc57=[];_0x57b777['forEach'](function(_0x47318e){_0x2ecc57[_0x16a2('0xeb')](_0x47318e[_0x16a2('0x2f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x16a2('0xf0')](_0x2ecc57);})[_0x16a2('0x1d')](function(){return _0x4e101e[_0x16a2('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x478d87,null))[_0x16a2('0x25')](handleError(_0x478d87,null));};exports[_0x16a2('0xf7')]=function(_0x1e9a12,_0x181038,_0xc18295){var _0x12330b;return db[_0x16a2('0xae')][_0x16a2('0x2f')]({'paused':0x1},{'where':{'UserId':_0x1e9a12[_0x16a2('0x5c')]['id']},'individualHooks':!![]})[_0x16a2('0x1d')](function(){return db[_0x16a2('0x56')]['find']({'where':{'id':_0x1e9a12[_0x16a2('0x5c')]['id'],'role':_0x16a2('0x66')},'attributes':['id',_0x16a2('0x3a'),'role',_0x16a2('0x71'),'interface']});})[_0x16a2('0x1d')](handleEntityNotFound(_0x181038,null))[_0x16a2('0x1d')](function(_0x338124){if(_0x338124){_0x12330b=_0x338124;return respondWithRpcPromise(_0x16a2('0xf8'),_0x16a2('0xf7'),{'id':_0x12330b['id'],'name':_0x12330b[_0x16a2('0x3a')],'pause':!![]});}})['then'](function(){if(_0x12330b){return db[_0x16a2('0xee')][_0x16a2('0x59')]({'where':{'membername':_0x12330b[_0x16a2('0x3a')],'type':_0x16a2('0xf9'),'exitAt':null}});}})[_0x16a2('0x1d')](function(_0x444c0e){if(_0x444c0e[_0x16a2('0x5e')]){var _0x42312c=moment()[_0x16a2('0x6f')](_0x16a2('0xef'));for(var _0x176af4=0x0,_0x55043b=_0x444c0e[_0x16a2('0x5e')];_0x176af4<_0x55043b;_0x176af4++){_0x444c0e[_0x176af4]['updateAttributes']({'exitAt':_0x42312c});}}})[_0x16a2('0x1d')](function(){var _0x3b2ea6=[];var _0x589aa4=utils[_0x16a2('0xfa')]();_0x589aa4['forEach'](function(_0x518935){_0x3b2ea6['push']({'channel':_0x518935,'membername':_0x12330b['name'],'interface':_[_0x16a2('0x6d')](_0x12330b[_0x16a2('0xa3')])?util['format'](_0x16a2('0xe2'),_0x12330b[_0x16a2('0x3a')]):_0x12330b['interface'],'type':_0x16a2('0xf9'),'enterAt':moment()['format'](_0x16a2('0xef')),'data1':_0x1e9a12[_0x16a2('0x62')][_0x16a2('0x40')]||_0x16a2('0xfb'),'role':_0x12330b[_0x16a2('0x39')],'internal':_0x12330b[_0x16a2('0x71')]});});return db[_0x16a2('0xee')]['bulkCreate'](_0x3b2ea6,{'individualHooks':!![]});})[_0x16a2('0x1d')](function(){return _0x12330b[_0x16a2('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1e9a12[_0x16a2('0x62')]['type']||_0x16a2('0xfb'),'lastPauseAt':moment()[_0x16a2('0x6f')](_0x16a2('0xef'))});})['then'](respondWithResult(_0x181038,null))[_0x16a2('0x25')](handleError(_0x181038,null));};exports['unpause']=function(_0x4c4fea,_0x9ae49a,_0x33a7cd){var _0x5d290b;return db[_0x16a2('0x56')]['find']({'where':{'id':_0x4c4fea[_0x16a2('0x5c')]['id']},'attributes':['id',_0x16a2('0x3a'),'role',_0x16a2('0xfc'),_0x16a2('0xfd'),_0x16a2('0xfe'),_0x16a2('0xff'),_0x16a2('0x100'),_0x16a2('0x101'),_0x16a2('0x102'),_0x16a2('0x103'),_0x16a2('0x104')]})['then'](handleEntityNotFound(_0x9ae49a,null))['then'](function(_0x2df934){if(_0x2df934){_0x5d290b=_0x2df934;if(_0x4c4fea[_0x16a2('0x62')][_0x16a2('0xa0')]&&!utils[_0x16a2('0xa4')](_0x4c4fea[_0x16a2('0x62')]['channel'])){throw new db[(_0x16a2('0x9b'))][(_0x16a2('0x1b'))](_0x16a2('0xa5'));}switch(_0x4c4fea[_0x16a2('0x62')][_0x16a2('0xa0')]){case _0x16a2('0xad'):return respondWithRpcPromise(_0x16a2('0xf8'),_0x16a2('0x105'),{'id':_0x5d290b['id'],'name':_0x5d290b['name'],'pause':![]})[_0x16a2('0x1d')](function(){return db[_0x16a2('0xae')]['update']({'paused':0x0},{'where':{'UserId':_0x5d290b['id']},'individualHooks':!![]});})['then'](function(){return db[_0x16a2('0xee')]['find']({'where':{'channel':_0x4c4fea[_0x16a2('0x62')]['channel'],'membername':_0x5d290b[_0x16a2('0x3a')],'type':_0x16a2('0xf9'),'exitAt':null}});})['then'](function(_0x47aedc){if(_0x47aedc){return _0x47aedc[_0x16a2('0x2f')]({'exitAt':moment()[_0x16a2('0x6f')](_0x16a2('0xef')),'data2':_0x16a2('0x106')},{'individualHooks':!![]});}return null;})[_0x16a2('0x1d')](function(){return _0x5d290b[_0x16a2('0x2f')]({'voicePause':![]});});case _0x16a2('0x107'):case _0x16a2('0x108'):case _0x16a2('0x109'):case _0x16a2('0x10a'):case _0x16a2('0x10b'):case _0x16a2('0x10c'):return db[_0x16a2('0xee')][_0x16a2('0x60')]({'where':{'channel':_0x4c4fea[_0x16a2('0x62')][_0x16a2('0xa0')],'membername':_0x5d290b[_0x16a2('0x3a')],'type':_0x16a2('0xf9'),'exitAt':null}})[_0x16a2('0x1d')](function(_0x1c8f04){if(_0x1c8f04){return _0x1c8f04[_0x16a2('0x2f')]({'exitAt':moment()[_0x16a2('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x16a2('0x106')},{'individualHooks':!![]});}return null;})[_0x16a2('0x1d')](function(){var _0x56579d={};_[_0x16a2('0x2c')](_0x56579d,util[_0x16a2('0x6f')](_0x16a2('0x10d'),_0x4c4fea[_0x16a2('0x62')][_0x16a2('0xa0')],_0x16a2('0x10e')),![]);return _0x5d290b[_0x16a2('0x2f')](_0x56579d);});default:return respondWithRpcPromise('QueuePause',_0x16a2('0x105'),{'id':_0x5d290b['id'],'name':_0x5d290b[_0x16a2('0x3a')],'pause':![]})['then'](function(){return db[_0x16a2('0xae')][_0x16a2('0x2f')]({'paused':0x0},{'where':{'UserId':_0x5d290b['id']}});})[_0x16a2('0x1d')](function(){return db[_0x16a2('0xee')][_0x16a2('0x59')]({'where':{'membername':_0x5d290b[_0x16a2('0x3a')],'type':_0x16a2('0xf9'),'exitAt':null}});})[_0x16a2('0x1d')](function(_0x41c864){var _0x226b56=[];_0x41c864['forEach'](function(_0x35a706){_0x226b56[_0x16a2('0xeb')](_0x35a706[_0x16a2('0x2f')]({'exitAt':moment()['format'](_0x16a2('0xef')),'data2':_0x16a2('0x106')}));});return BPromise[_0x16a2('0xf0')](_0x226b56);})[_0x16a2('0x1d')](function(){return _0x5d290b['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x16a2('0x1d')](respondWithResult(_0x9ae49a,null))[_0x16a2('0x25')](handleError(_0x9ae49a,null));};exports[_0x16a2('0x10f')]=function(_0x2e92fb,_0x291862,_0x2ad66c){var _0x2ce0d3={};var _0x39a108={};var _0x817855;var _0x31ed40;return db['User'][_0x16a2('0x94')]({'where':{'id':_0x2e92fb['params']['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x291862,null))['then'](function(_0x46054d){if(_0x46054d){_0x817855=_0x46054d;_0x39a108[_0x16a2('0x42')]=_['keys'](db[_0x16a2('0x110')][_0x16a2('0x3e')]);_0x39a108['query']=_[_0x16a2('0x46')](_0x2e92fb[_0x16a2('0x45')]);_0x39a108[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x39a108[_0x16a2('0x42')],_0x39a108['query']);_0x2ce0d3[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x39a108['model'],qs[_0x16a2('0x4a')](_0x2e92fb[_0x16a2('0x45')]['fields']));_0x2ce0d3[_0x16a2('0x48')]=_0x2ce0d3[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x2ce0d3['attributes']:_0x39a108[_0x16a2('0x42')];_0x2ce0d3[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x2e92fb['query'][_0x16a2('0x4f')]);_0x2ce0d3[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x2e92fb['query'],_0x39a108[_0x16a2('0x47')]));if(_0x2e92fb['query'][_0x16a2('0x34')]){_0x2ce0d3[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0x2ce0d3[_0x16a2('0x50')],{'$or':_['map'](_0x2ce0d3[_0x16a2('0x48')],function(_0x20b34c){var _0x117640={};_0x117640[_0x20b34c]={'$like':'%'+_0x2e92fb['query'][_0x16a2('0x34')]+'%'};return _0x117640;})});}_0x2ce0d3=_[_0x16a2('0x55')]({},_0x2ce0d3,_0x2e92fb[_0x16a2('0x5f')]);return _0x817855[_0x16a2('0x10f')](_0x2ce0d3);}})[_0x16a2('0x1d')](function(_0x1538bf){if(_0x1538bf){_0x31ed40=_0x1538bf[_0x16a2('0x5e')];if(!_0x2e92fb[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x2ce0d3[_0x16a2('0x4d')]=qs[_0x16a2('0x4d')](_0x2e92fb[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x2ce0d3[_0x16a2('0x2b')]=qs['offset'](_0x2e92fb[_0x16a2('0x45')][_0x16a2('0x2b')]);}return _0x817855[_0x16a2('0x10f')](_0x2ce0d3);}})['then'](function(_0x17ee38){if(_0x17ee38){return _0x17ee38?{'count':_0x31ed40,'rows':_0x17ee38}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x291862,null))['catch'](handleError(_0x291862,null));};exports['addTeams']=function(_0x2f722f,_0x4d6d07){return db[_0x16a2('0x56')][_0x16a2('0x60')]({'where':{'id':_0x2f722f[_0x16a2('0x5c')]['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x4d6d07,null))['then'](function(_0x59f510){if(_0x59f510){var _0xfa5724=_0x59f510[_0x16a2('0x31')]({'plain':!![]});return _0x59f510[_0x16a2('0x111')](_0x2f722f[_0x16a2('0x62')][_0x16a2('0x65')],_['omit'](_0x2f722f[_0x16a2('0x62')],['ids','id'])||{})[_0x16a2('0x1d')](function(){for(var _0x512257=0x0;_0x512257<_0x2f722f[_0x16a2('0x62')][_0x16a2('0x65')][_0x16a2('0x5e')];_0x512257++){var _0x47fb87=[];db['Team'][_0x16a2('0x94')]({'where':{'id':_0x2f722f['body'][_0x16a2('0x65')][_0x512257]}})[_0x16a2('0x1d')](function(_0x169c51){_0x47fb87[_0x16a2('0xeb')](_0x169c51[_0x16a2('0x112')]()[_0x16a2('0x1d')](function(_0x21ad2c){for(var _0x5aeb31=0x0;_0x5aeb31<_0x21ad2c[_0x16a2('0x5e')];_0x5aeb31++){_0x21ad2c[_0x5aeb31][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x114'));}return _0x21ad2c;}));_0x47fb87[_0x16a2('0xeb')](_0x169c51['getChatQueues']()[_0x16a2('0x1d')](function(_0xa8f821){for(var _0x4a306f=0x0;_0x4a306f<_0xa8f821[_0x16a2('0x5e')];_0x4a306f++){_0xa8f821[_0x4a306f][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x115'));}return _0xa8f821;}));_0x47fb87[_0x16a2('0xeb')](_0x169c51[_0x16a2('0x116')]()[_0x16a2('0x1d')](function(_0x46f585){for(var _0x8ac943=0x0;_0x8ac943<_0x46f585[_0x16a2('0x5e')];_0x8ac943++){_0x46f585[_0x8ac943][_0x16a2('0x113')]('channel',_0x16a2('0x117'));}return _0x46f585;}));_0x47fb87[_0x16a2('0xeb')](_0x169c51[_0x16a2('0x118')]()['then'](function(_0x35b3b8){for(var _0x251c57=0x0;_0x251c57<_0x35b3b8[_0x16a2('0x5e')];_0x251c57++){_0x35b3b8[_0x251c57][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x119'));}return _0x35b3b8;}));_0x47fb87[_0x16a2('0xeb')](_0x169c51[_0x16a2('0x11a')]()[_0x16a2('0x1d')](function(_0x5ef13a){for(var _0x2d9db5=0x0;_0x2d9db5<_0x5ef13a[_0x16a2('0x5e')];_0x2d9db5++){_0x5ef13a[_0x2d9db5][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x11b'));}return _0x5ef13a;}));_0x47fb87[_0x16a2('0xeb')](_0x169c51[_0x16a2('0x11c')]()['then'](function(_0xd41ace){for(var _0x281c31=0x0;_0x281c31<_0xd41ace[_0x16a2('0x5e')];_0x281c31++){_0xd41ace[_0x281c31]['setDataValue'](_0x16a2('0xa0'),'Fax');}return _0xd41ace;}));_0x47fb87[_0x16a2('0xeb')](_0x169c51['getOpenchannelQueues']()[_0x16a2('0x1d')](function(_0x6726e){for(var _0x2fe2bd=0x0;_0x2fe2bd<_0x6726e[_0x16a2('0x5e')];_0x2fe2bd++){_0x6726e[_0x2fe2bd][_0x16a2('0x113')]('channel',_0x16a2('0x11d'));}return _0x6726e;}));return BPromise['all'](_0x47fb87);})['then'](function(_0x3a43e4){var _0x420168=_[_0x16a2('0x11e')](_0x3a43e4);_0x47fb87=[];return db[_0x16a2('0x54')]['transaction'](function(_0x459726){for(var _0x541730=0x0;_0x541730<_0x420168[_0x16a2('0x5e')];_0x541730++){_0x47fb87[_0x16a2('0xeb')](_0x420168[_0x541730][_0x16a2('0x11f')](_0xfa5724['id']),{'transaction':_0x459726});}return BPromise['all'](_0x47fb87)[_0x16a2('0x1d')](function(){if(_0xfa5724['online']){return BPromise[_0x16a2('0xed')](_['filter'](_0x420168,function(_0x452bf9){return _0x452bf9[_0x16a2('0x120')]('channel')===_0x16a2('0x114');}),function(_0x35b9c2){return db[_0x16a2('0xae')][_0x16a2('0xaf')]({'membername':_0xfa5724[_0x16a2('0x3a')],'UserId':_0xfa5724['id'],'queue_name':_0x35b9c2[_0x16a2('0x3a')],'VoiceQueueId':_0x35b9c2['id'],'interface':_[_0x16a2('0x6d')](_0xfa5724[_0x16a2('0xa3')])?util[_0x16a2('0x6f')](_0x16a2('0xe2'),_0xfa5724[_0x16a2('0x3a')]):_0xfa5724[_0x16a2('0xa3')],'paused':_0xfa5724['voicePause']||![],'penalty':_0xfa5724['penalty']},{'transaction':_0x459726});});}else{return;}})[_0x16a2('0x1d')](function(){for(var _0x3a1026=0x0;_0x3a1026<_0x420168['length'];_0x3a1026++){var _0x512cc3=_0x420168[_0x3a1026]['getDataValue'](_0x16a2('0xa0'));var _0x1dd2f4=_0x512cc3+_0x16a2('0xb4');socket[_0x16a2('0xaa')](_0x16a2('0x89')+_0x512cc3+_0x16a2('0xab'),{'UserId':_0xfa5724['id'],['queueField']:_0x420168[_0x3a1026]['id']});}});});});}});}})[_0x16a2('0x1d')](respondWithStatusCode(_0x4d6d07,null))[_0x16a2('0x25')](handleError(_0x4d6d07,null));};exports['removeTeams']=function(_0x232c8b,_0x974c06){return db['User'][_0x16a2('0x94')]({'where':{'id':_0x232c8b['params']['id']}})['then'](handleEntityNotFound(_0x974c06,null))[_0x16a2('0x1d')](function(_0x82ed28){if(_0x82ed28){var _0x5e8240=_0x82ed28[_0x16a2('0x31')]({'plain':!![]});var _0x21b6d9=_0x232c8b['query'][_0x16a2('0x65')];return _0x82ed28['removeTeams'](_0x21b6d9)[_0x16a2('0x1d')](function(){for(var _0x533ab7=0x0;_0x533ab7<_0x21b6d9[_0x16a2('0x5e')];_0x533ab7++){var _0x689846=[];db[_0x16a2('0x110')][_0x16a2('0x94')]({'where':{'id':_0x21b6d9[_0x533ab7]}})[_0x16a2('0x1d')](function(_0x111ce8){_0x689846['push'](_0x111ce8[_0x16a2('0x112')]()[_0x16a2('0x1d')](function(_0xe0b720){for(var _0x250451=0x0;_0x250451<_0xe0b720['length'];_0x250451++){_0xe0b720[_0x250451]['setDataValue'](_0x16a2('0xa0'),_0x16a2('0x114'));}return _0xe0b720;}));_0x689846[_0x16a2('0xeb')](_0x111ce8[_0x16a2('0x121')]()[_0x16a2('0x1d')](function(_0x1bb4bc){for(var _0x541212=0x0;_0x541212<_0x1bb4bc[_0x16a2('0x5e')];_0x541212++){_0x1bb4bc[_0x541212][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x115'));}return _0x1bb4bc;}));_0x689846[_0x16a2('0xeb')](_0x111ce8[_0x16a2('0x116')]()['then'](function(_0x485604){for(var _0x4f8bde=0x0;_0x4f8bde<_0x485604['length'];_0x4f8bde++){_0x485604[_0x4f8bde][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x117'));}return _0x485604;}));_0x689846['push'](_0x111ce8[_0x16a2('0x118')]()[_0x16a2('0x1d')](function(_0x311f50){for(var _0x231237=0x0;_0x231237<_0x311f50[_0x16a2('0x5e')];_0x231237++){_0x311f50[_0x231237][_0x16a2('0x113')]('channel',_0x16a2('0x119'));}return _0x311f50;}));_0x689846['push'](_0x111ce8[_0x16a2('0x11a')]()['then'](function(_0x5a143e){for(var _0x400c0e=0x0;_0x400c0e<_0x5a143e['length'];_0x400c0e++){_0x5a143e[_0x400c0e][_0x16a2('0x113')]('channel',_0x16a2('0x11b'));}return _0x5a143e;}));_0x689846['push'](_0x111ce8[_0x16a2('0x11c')]()[_0x16a2('0x1d')](function(_0x25f972){for(var _0x50e12c=0x0;_0x50e12c<_0x25f972['length'];_0x50e12c++){_0x25f972[_0x50e12c][_0x16a2('0x113')](_0x16a2('0xa0'),_0x16a2('0x122'));}return _0x25f972;}));_0x689846['push'](_0x111ce8[_0x16a2('0x123')]()['then'](function(_0x387033){for(var _0x514178=0x0;_0x514178<_0x387033['length'];_0x514178++){_0x387033[_0x514178][_0x16a2('0x113')]('channel',_0x16a2('0x11d'));}return _0x387033;}));return BPromise['all'](_0x689846);})['then'](function(_0x1851d){var _0x3e6513=_[_0x16a2('0x11e')](_0x1851d);_0x689846=[];return db['sequelize']['transaction'](function(_0x15a898){for(var _0x1050a1=0x0;_0x1050a1<_0x3e6513[_0x16a2('0x5e')];_0x1050a1++){_0x689846[_0x16a2('0xeb')](_0x3e6513[_0x1050a1][_0x16a2('0x124')](_0x5e8240['id']),{'transaction':_0x15a898});}return BPromise['all'](_0x689846)[_0x16a2('0x1d')](function(){if(_0x5e8240[_0x16a2('0xa1')]){return BPromise[_0x16a2('0xed')](_['filter'](_0x3e6513,function(_0x171e40){return _0x171e40[_0x16a2('0x120')](_0x16a2('0xa0'))===_0x16a2('0x114');}),function(_0x5ea729){return db['UserVoiceQueueRt'][_0x16a2('0x30')]({'where':{'VoiceQueueId':_0x5ea729['id'],'UserId':_0x5e8240['id']},'transaction':_0x15a898});});}else{return;}})['then'](function(){for(var _0x376d88=0x0;_0x376d88<_0x3e6513[_0x16a2('0x5e')];_0x376d88++){var _0x1e5128=_0x3e6513[_0x376d88]['getDataValue'](_0x16a2('0xa0'));var _0x5a5d8e=_0x1e5128+'QueueId';socket[_0x16a2('0xaa')](_0x16a2('0x89')+_0x1e5128+_0x16a2('0xb5'),{'UserId':_0x5e8240['id'],['queueField']:_0x3e6513[_0x376d88]['id']});}});});});}});}})[_0x16a2('0x1d')](respondWithStatusCode(_0x974c06,null))[_0x16a2('0x25')](handleError(_0x974c06,null));};exports[_0x16a2('0x125')]=function(_0x3f619c,_0x226b99,_0x4542ec){var _0x35e73e={};var _0x277a7f={};var _0x44ac80;var _0x1989d1;return db[_0x16a2('0x56')][_0x16a2('0x94')]({'where':{'id':_0x3f619c['params']['id']}})[_0x16a2('0x1d')](handleEntityNotFound(_0x226b99,null))[_0x16a2('0x1d')](function(_0x1f728a){if(_0x1f728a){_0x44ac80=_0x1f728a;_0x277a7f['model']=_['keys'](db['CmList'][_0x16a2('0x3e')]);_0x277a7f[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x3f619c['query']);_0x277a7f[_0x16a2('0x47')]=_['intersection'](_0x277a7f[_0x16a2('0x42')],_0x277a7f['query']);_0x35e73e[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x277a7f['model'],qs[_0x16a2('0x4a')](_0x3f619c[_0x16a2('0x45')][_0x16a2('0x4a')]));_0x35e73e[_0x16a2('0x48')]=_0x35e73e[_0x16a2('0x48')][_0x16a2('0x5e')]?_0x35e73e[_0x16a2('0x48')]:_0x277a7f[_0x16a2('0x42')];_0x35e73e[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x3f619c['query'][_0x16a2('0x4f')]);_0x35e73e['where']=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x3f619c[_0x16a2('0x45')],_0x277a7f[_0x16a2('0x47')]));if(_0x3f619c['query'][_0x16a2('0x34')]){_0x35e73e[_0x16a2('0x50')]=_['merge'](_0x35e73e[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0x35e73e[_0x16a2('0x48')],function(_0x382616){var _0x21cf23={};_0x21cf23[_0x382616]={'$like':'%'+_0x3f619c[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x21cf23;})});}_0x35e73e=_[_0x16a2('0x55')]({},_0x35e73e,_0x3f619c[_0x16a2('0x5f')]);return _0x44ac80['getLists'](_0x35e73e);}})[_0x16a2('0x1d')](function(_0x78a1cd){if(_0x78a1cd){_0x1989d1=_0x78a1cd[_0x16a2('0x5e')];if(!_0x3f619c[_0x16a2('0x45')][_0x16a2('0x4b')](_0x16a2('0x4c'))){_0x35e73e['limit']=qs[_0x16a2('0x4d')](_0x3f619c[_0x16a2('0x45')][_0x16a2('0x4d')]);_0x35e73e[_0x16a2('0x2b')]=qs[_0x16a2('0x2b')](_0x3f619c[_0x16a2('0x45')]['offset']);}return _0x44ac80['getLists'](_0x35e73e);}})[_0x16a2('0x1d')](function(_0x25d3aa){if(_0x25d3aa){return _0x25d3aa?{'count':_0x1989d1,'rows':_0x25d3aa}:null;}})[_0x16a2('0x1d')](respondWithResult(_0x226b99,null))[_0x16a2('0x25')](handleError(_0x226b99,null));};exports[_0x16a2('0x126')]=function(_0x4191e1,_0x509622,_0x38db02){var _0xa5ef0f={};var _0x1c4a65={};var _0x6d89ec;var _0x1cf0c2;return db['User'][_0x16a2('0x94')]({'where':{'id':_0x4191e1[_0x16a2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x509622,null))[_0x16a2('0x1d')](function(_0x41c433){if(_0x41c433){_0x6d89ec=_0x41c433;_0x1c4a65['model']=_[_0x16a2('0x46')](db[_0x16a2('0x56')][_0x16a2('0x3e')]);_0x1c4a65[_0x16a2('0x45')]=_[_0x16a2('0x46')](_0x4191e1[_0x16a2('0x45')]);_0x1c4a65[_0x16a2('0x47')]=_[_0x16a2('0x49')](_0x1c4a65[_0x16a2('0x42')],_0x1c4a65[_0x16a2('0x45')]);_0xa5ef0f[_0x16a2('0x48')]=_[_0x16a2('0x49')](_0x1c4a65[_0x16a2('0x42')],qs['fields'](_0x4191e1[_0x16a2('0x45')][_0x16a2('0x4a')]));_0xa5ef0f[_0x16a2('0x48')]=_0xa5ef0f[_0x16a2('0x48')][_0x16a2('0x5e')]?_0xa5ef0f[_0x16a2('0x48')]:_0x1c4a65['model'];_0xa5ef0f[_0x16a2('0x4e')]=qs[_0x16a2('0x4f')](_0x4191e1[_0x16a2('0x45')][_0x16a2('0x4f')]);_0xa5ef0f[_0x16a2('0x50')]=qs[_0x16a2('0x47')](_[_0x16a2('0x51')](_0x4191e1['query'],_0x1c4a65[_0x16a2('0x47')]));if(_0x4191e1[_0x16a2('0x45')][_0x16a2('0x34')]){_0xa5ef0f[_0x16a2('0x50')]=_[_0x16a2('0x55')](_0xa5ef0f[_0x16a2('0x50')],{'$or':_[_0x16a2('0x36')](_0xa5ef0f[_0x16a2('0x48')],function(_0x246ad0){var _0x98d7f0={};_0x98d7f0[_0x246ad0]={'$like':'%'+_0x4191e1[_0x16a2('0x45')][_0x16a2('0x34')]+'%'};return _0x98d7f0;})});}_0xa5ef0f[_0x16a2('0x42')]=db[_0x16a2('0x56')];_0xa5ef0f['as']=_0x16a2('0x8b');_0xa5ef0f=_[_0x16a2('0x55')]({},_0xa5ef0f,_0x4191e1[_0x16a2('0x5f')]);return _0x6d89ec[_0x16a2('0x112')]({'include':[_0xa5ef0f]});}})[_0x16a2('0x1d')](function(_0x1a692c){if(_0x1a692c){var _0x3576ba={},_0x44695e=[],_0x35c889=0x0;for(var _0x8aeae3=0x0;_0x8aeae3<_0x1a692c['length'];_0x8aeae3+=0x1){for(var _0x5cbe85=0x0,_0x31f351;_0x5cbe85<_0x1a692c[_0x8aeae3][_0x16a2('0x8b')][_0x16a2('0x5e')];_0x5cbe85+=0x1){_0x31f351=_0x1a692c[_0x8aeae3][_0x16a2('0x8b')][_0x5cbe85][_0x16a2('0x31')]({'plain':!![]});_0x3576ba[_0x31f351['id']]=_0x31f351;}}_0x3576ba=_['values'](_0x3576ba);for(var _0x417b41=qs['offset'](_0x4191e1[_0x16a2('0x45')]['offset']);_0x417b41<_0x3576ba[_0x16a2('0x5e')]&&_0x44695e['length']=_0x5871e0){_0x59d042=_0x5871e0;_0x286126=0xc8;}else{_0x286126=0xce;}_0xe1f9a4[_0x6fa8('0x30')](_0x286126);return _0xe1f9a4[_0x6fa8('0x35')](_0x6fa8('0x36'),_0x3f92f0+'-'+_0x59d042+'/'+_0x5871e0)[_0x6fa8('0x32')](_0x2ead01);}return null;};}function patchUpdates(_0x5cb50a){return function(_0x3d1fd3){try{jsonpatch[_0x6fa8('0x37')](_0x3d1fd3,_0x5cb50a,!![]);}catch(_0x51b806){return BPromise[_0x6fa8('0x38')](_0x51b806);}return _0x3d1fd3[_0x6fa8('0x39')]();};}function saveUpdates(_0x4a0d90,_0x140c56){return function(_0x109ff7){if(_0x109ff7){return _0x109ff7[_0x6fa8('0x3a')](_0x4a0d90)[_0x6fa8('0x24')](function(_0x3a2ba5){return _0x3a2ba5;});}return null;};}function removeEntity(_0x3182a1,_0x41edca){return function(_0x2bc60d){if(_0x2bc60d){return _0x2bc60d[_0x6fa8('0x3b')]()[_0x6fa8('0x24')](function(){var _0x2dc198=_0x2bc60d[_0x6fa8('0x3c')]({'plain':!![]});var _0x3dd9c6=[{'name':_0x6fa8('0x3d'),'value':_0x6fa8('0x3e'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x6fa8('0x3f'),'value':_0x6fa8('0x40'),'ignore':![]}];var _0x2767ee=_(_0x3dd9c6)['filter'](_0x6fa8('0x41'))[_0x6fa8('0x42')](_0x6fa8('0x43'))['value']();if(_[_0x6fa8('0x44')](_0x2767ee,_0x2dc198[_0x6fa8('0x45')])){return;}var _0x193677=_[_0x6fa8('0x46')](_0x3dd9c6,['value',_0x2dc198[_0x6fa8('0x45')]])[_0x6fa8('0x47')];return db[_0x6fa8('0x48')]['destroy']({'where':{'type':_0x193677,'resourceId':_0x2dc198['id']}})[_0x6fa8('0x24')](function(){return _0x2bc60d;});})[_0x6fa8('0x24')](function(){_0x3182a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d7a2,_0x3f8b43){return function(_0x39947d){if(!_0x39947d){_0x51d7a2[_0x6fa8('0x2f')](0x194);}return _0x39947d;};}function handleError(_0x1510f1,_0x1ae654){_0x1ae654=_0x1ae654||0x1f4;return function(_0x4aed00){logger[_0x6fa8('0x29')](_0x4aed00[_0x6fa8('0x49')]);if(_0x4aed00[_0x6fa8('0x47')]){delete _0x4aed00[_0x6fa8('0x47')];}_0x1510f1['status'](_0x1ae654)[_0x6fa8('0x4a')](_0x4aed00);};}exports[_0x6fa8('0x4b')]=function(_0x56886d,_0xc97458){var _0x3c067d={},_0x40985c={},_0x42cae0={'count':0x0,'rows':[]};var _0x29b698=_[_0x6fa8('0x42')](db[_0x6fa8('0x4c')][_0x6fa8('0x4d')],function(_0x4142e6){return{'name':_0x4142e6['fieldName'],'type':_0x4142e6[_0x6fa8('0x4e')]['key']};});_0x40985c['model']=_[_0x6fa8('0x4f')](_['map'](_0x29b698,_0x6fa8('0x47')),[_0x6fa8('0x50'),'salt']);_0x40985c[_0x6fa8('0x51')]=_['keys'](_0x56886d[_0x6fa8('0x51')]);_0x40985c[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x40985c[_0x6fa8('0x54')],_0x40985c[_0x6fa8('0x51')]);_0x3c067d[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x40985c['model'],qs[_0x6fa8('0x56')](_0x56886d[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x3c067d[_0x6fa8('0x55')]=_0x3c067d['attributes'][_0x6fa8('0x57')]?_0x3c067d['attributes']:_0x40985c['model'];if(!_0x56886d['query'][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x3c067d[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x56886d['query'][_0x6fa8('0x5a')]);_0x3c067d[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x56886d[_0x6fa8('0x51')][_0x6fa8('0x34')]);}_0x3c067d['order']=qs[_0x6fa8('0x5b')](_0x56886d[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x3c067d[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x56886d['query'],_0x40985c['filters']),_0x29b698);if(_0x56886d['query'][_0x6fa8('0x5e')]){_0x3c067d[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0x3c067d['where'],{'$or':_[_0x6fa8('0x42')](_0x29b698,function(_0x2f164b){if(_0x2f164b['type']!==_0x6fa8('0x60')){return db[_0x6fa8('0x61')][_0x6fa8('0x5c')](db[_0x6fa8('0x61')]['fn']('lower',db['sequelize'][_0x6fa8('0x62')](_0x2f164b[_0x6fa8('0x47')])),{'$like':db[_0x6fa8('0x61')]['fn'](_0x6fa8('0x63'),'%'+_0x56886d[_0x6fa8('0x51')]['filter']+'%')});}})});}_0x3c067d=_[_0x6fa8('0x5f')]({},_0x3c067d,_0x56886d['options']);var _0x4454a1={'where':_0x3c067d[_0x6fa8('0x5c')]};return db[_0x6fa8('0x4c')][_0x6fa8('0x33')](_0x4454a1)['then'](function(_0x13d929){_0x42cae0[_0x6fa8('0x33')]=_0x13d929;if(_0x56886d[_0x6fa8('0x51')]['includeAll']){_0x3c067d[_0x6fa8('0x64')]=[{'all':!![]}];}return db[_0x6fa8('0x4c')][_0x6fa8('0x65')](_0x3c067d);})['then'](function(_0x48c483){_0x42cae0[_0x6fa8('0x66')]=_0x48c483;return _0x42cae0;})[_0x6fa8('0x24')](respondWithFilteredResult(_0xc97458,_0x3c067d))[_0x6fa8('0x2e')](handleError(_0xc97458,null));};exports['show']=function(_0x154073,_0x5d9f24){var _0x282b3e={'raw':![],'where':{'id':_0x154073['params']['id']}},_0x36fff9={};_0x36fff9[_0x6fa8('0x54')]=_['differenceBy'](_[_0x6fa8('0x67')](db[_0x6fa8('0x4c')][_0x6fa8('0x4d')]),['password',_0x6fa8('0x68')]);_0x36fff9[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x154073['query']);_0x36fff9[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x36fff9['model'],_0x36fff9[_0x6fa8('0x51')]);_0x282b3e[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x36fff9[_0x6fa8('0x54')],qs['fields'](_0x154073[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x282b3e[_0x6fa8('0x55')]=_0x282b3e['attributes']['length']?_0x282b3e['attributes']:_0x36fff9['model'];if(_0x154073[_0x6fa8('0x51')]['includeAll']){_0x282b3e['include']=[{'all':!![]}];}_0x282b3e=_[_0x6fa8('0x5f')]({},_0x282b3e,_0x154073[_0x6fa8('0x69')]);return db[_0x6fa8('0x4c')]['find'](_0x282b3e)['then'](handleEntityNotFound(_0x5d9f24,null))[_0x6fa8('0x24')](respondWithResult(_0x5d9f24,null))[_0x6fa8('0x2e')](handleError(_0x5d9f24,null));};exports['bulkCreate']=function(_0x327a79,_0x1fdde9){return db[_0x6fa8('0x4c')][_0x6fa8('0x6a')](_0x327a79[_0x6fa8('0x6b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1fdde9,0xc9))[_0x6fa8('0x2e')](handleError(_0x1fdde9,null));};exports[_0x6fa8('0x3a')]=function(_0x3dabfc,_0x28f2a7){if(_0x3dabfc[_0x6fa8('0x6b')]['id']){delete _0x3dabfc[_0x6fa8('0x6b')]['id'];}delete _0x3dabfc[_0x6fa8('0x6b')][_0x6fa8('0x45')];return db[_0x6fa8('0x4c')][_0x6fa8('0x46')]({'where':{'id':_0x3dabfc[_0x6fa8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x28f2a7,null))['then'](saveUpdates(_0x3dabfc[_0x6fa8('0x6b')],null))[_0x6fa8('0x24')](respondWithResult(_0x28f2a7,null))[_0x6fa8('0x2e')](handleError(_0x28f2a7,null));};exports[_0x6fa8('0x6d')]=function(_0x3446f7,_0x338e5c){return db[_0x6fa8('0x4c')][_0x6fa8('0x6d')]()[_0x6fa8('0x24')](respondWithResult(_0x338e5c,null))[_0x6fa8('0x2e')](handleError(_0x338e5c,null));};exports[_0x6fa8('0x6e')]=function(_0x7d2244,_0x398ccc,_0x4748ef){return db[_0x6fa8('0x4c')]['find']({'where':{'id':_0x7d2244[_0x6fa8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x398ccc,null))[_0x6fa8('0x24')](function(_0x235c72){if(_0x235c72){return _0x235c72[_0x6fa8('0x6e')](_0x7d2244[_0x6fa8('0x6b')]['ids'],_['omit'](_0x7d2244[_0x6fa8('0x6b')],[_0x6fa8('0x6f'),'id'])||{});}})[_0x6fa8('0x24')](respondWithResult(_0x398ccc,null))[_0x6fa8('0x2e')](handleError(_0x398ccc,null));};var getLicense=function(_0x24199d){return new BPromise(function(_0x49e8e3,_0x2b4755){var _0x1a9757=0x0;_0x24199d['body'][_0x6fa8('0x45')]==='agent'&&_0x49e8e3('agent\x20role');return db[_0x6fa8('0x4c')]['count']({'where':{'$or':[{'role':_0x24199d[_0x6fa8('0x6b')][_0x6fa8('0x45')]===_0x6fa8('0x40')?_0x6fa8('0x40'):[_0x6fa8('0x70'),_0x6fa8('0x3e')]}]}})['then'](function(_0x364403){_0x1a9757=_0x364403;return require(_0x6fa8('0x71'))[_0x6fa8('0x72')]();})['then'](function(_0x270e94){var _0x37c360=_0x24199d[_0x6fa8('0x6b')][_0x6fa8('0x45')]===_0x6fa8('0x40')?_0x6fa8('0x73'):_0x6fa8('0x74');if(!_[_0x6fa8('0x75')](_0x270e94[_0x37c360])&&_0x1a9757>=_0x270e94[_0x37c360]){return _0x2b4755({'message':_0x6fa8('0x76')});}return _0x49e8e3(util[_0x6fa8('0x77')](_0x6fa8('0x78'),_0x37c360,_0x1a9757));})[_0x6fa8('0x2e')](function(_0x2ca56b){return _0x2b4755(_0x2ca56b);});});};exports['create']=function(_0x23532c,_0x58a635){return getLicense(_0x23532c)[_0x6fa8('0x24')](function(_0xecaa29){if(!_0x23532c['body'][_0x6fa8('0x79')]){var _0x3f6b84;return db['Setting'][_0x6fa8('0x7a')](0x1)[_0x6fa8('0x24')](function(_0x189e6a){return checkPasswordPattern(_0x189e6a,_0x23532c[_0x6fa8('0x6b')]['password'],_0x189e6a[_0x6fa8('0x7b')]);})[_0x6fa8('0x24')](function(_0x42f44e){_0x3f6b84=_0x42f44e[_0x6fa8('0x7c')];return db[_0x6fa8('0x4c')][_0x6fa8('0x7d')](_0x6fa8('0x79'));})[_0x6fa8('0x24')](function(_0x3b4d36){if(_['isNil'](_0x3b4d36)){if(_0x3f6b84){_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')]=_0x3f6b84;}else{_0x23532c['body'][_0x6fa8('0x79')]=0x1;}}else{if(_[_0x6fa8('0x75')](_0x3f6b84)||_0x3f6b84==_0x3b4d36){_0x23532c['body']['internal']=_0x3b4d36+0x1;}else if(_0x3f6b84>_0x3b4d36){_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')]=_0x3f6b84;}else{return db['sequelize'][_0x6fa8('0x51')]('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['sequelize'][_0x6fa8('0x7e')]['SELECT']})[_0x6fa8('0x24')](function(_0x366afe){if(_0x366afe&&_0x366afe['length']){for(var _0x11476c=0x0,_0x3cef8=_0x366afe[_0x6fa8('0x57')];_0x11476c<_0x3cef8&&_[_0x6fa8('0x75')](_0x23532c['body'][_0x6fa8('0x79')]);_0x11476c++){if(_0x3f6b84<=_0x366afe[_0x11476c]['from']){_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')]=_0x366afe[_0x11476c][_0x6fa8('0x7f')];}else if(_0x3f6b84>_0x366afe[_0x11476c][_0x6fa8('0x7f')]&&_0x3f6b84<=_0x366afe[_0x11476c]['to']){_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')]=_0x3f6b84;}}}if(_['isNil'](_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')])){_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')]=_0x3b4d36+0x1;}});}}});}})[_0x6fa8('0x24')](function(){if(_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x80')]){_0x23532c['body']['mailbox']=_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x79')];_0x23532c['body']['VoiceMail']={'mailbox':_0x23532c[_0x6fa8('0x6b')]['internal'],'password':_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x50')],'fullname':_0x23532c[_0x6fa8('0x6b')]['fullname'],'email':_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x81')]};}if(_0x23532c[_0x6fa8('0x6b')]&&_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x45')]===_0x6fa8('0x82')){if(!_0x23532c[_0x6fa8('0x6b')][_0x6fa8('0x83')]){_0x23532c[_0x6fa8('0x6b')]['permissions']=[_0x6fa8('0x84'),_0x6fa8('0x85'),_0x6fa8('0x86'),_0x6fa8('0x87'),_0x6fa8('0x88'),_0x6fa8('0x89'),'105',_0x6fa8('0x8a'),_0x6fa8('0x8b'),'108',_0x6fa8('0x8c'),_0x6fa8('0x8d'),'111',_0x6fa8('0x8e')];}}return db['User']['create'](_0x23532c[_0x6fa8('0x6b')],{'include':[{'model':db[_0x6fa8('0x8f')],'as':'VoiceMail'}]});})['then'](function(_0xc7ba62){if(_0x23532c['body'][_0x6fa8('0x45')]===_0x6fa8('0x3e'))return _0xc7ba62;var _0x5eb3b9=_0x23532c[_0x6fa8('0x3e')][_0x6fa8('0x3c')]({'plain':!![]});if(!_0x5eb3b9)throw new Error(_0x6fa8('0x90'));if(_0x5eb3b9[_0x6fa8('0x45')]==='user'){var _0x4d6b80=_0xc7ba62[_0x6fa8('0x3c')]({'plain':!![]});var _0x4043ac=[{'name':_0x6fa8('0x91'),'value':'agent'},{'name':_0x6fa8('0x3f'),'value':'telephone'}];var _0x59e25d=_[_0x6fa8('0x46')](_0x4043ac,[_0x6fa8('0x43'),_0x4d6b80[_0x6fa8('0x45')]])[_0x6fa8('0x47')];return db[_0x6fa8('0x92')][_0x6fa8('0x46')]({'where':{'name':_0x59e25d,'userProfileId':_0x5eb3b9[_0x6fa8('0x93')]},'raw':!![]})[_0x6fa8('0x24')](function(_0x98714){if(_0x98714&&_0x98714[_0x6fa8('0x94')]===0x0){return db['UserProfileResource'][_0x6fa8('0x95')]({'name':_0x4d6b80[_0x6fa8('0x47')],'resourceId':_0x4d6b80['id'],'type':_0x98714[_0x6fa8('0x47')],'sectionId':_0x98714['id']},{})['then'](function(){return _0xc7ba62;});}else{return _0xc7ba62;}})[_0x6fa8('0x2e')](function(_0x97cfa){logger[_0x6fa8('0x29')](_0x6fa8('0x96'),_0x97cfa);throw _0x97cfa;});}return _0xc7ba62;})['then'](respondWithResult(_0x58a635,0xc9))[_0x6fa8('0x2e')](handleError(_0x58a635,null));};exports[_0x6fa8('0x97')]=function(_0x13cc14,_0x4a50d8,_0x5466b8){var _0xbe2cb0=![];if(_0x13cc14['body']['id']){delete _0x13cc14[_0x6fa8('0x6b')]['id'];}return db['Setting'][_0x6fa8('0x98')]({'attributes':['id',_0x6fa8('0x7b')]})[_0x6fa8('0x24')](function(_0x3adad8){_0xbe2cb0=_0x3adad8[_0x6fa8('0x7b')];return db[_0x6fa8('0x4c')][_0x6fa8('0x46')]({'where':{'id':_0x13cc14[_0x6fa8('0x6c')]['id']}});})[_0x6fa8('0x24')](function(_0x18d6ef){if(_0x18d6ef){if(_0x18d6ef['id']==_0x13cc14[_0x6fa8('0x3e')]['id']){if(!_0x13cc14[_0x6fa8('0x6b')][_0x6fa8('0x99')]||!_0x13cc14['body'][_0x6fa8('0x9a')]){throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0x9c'));}if(!_0x18d6ef['authenticate'](_0x13cc14[_0x6fa8('0x6b')]['oldPassword'])){throw new db[(_0x6fa8('0x9b'))]['ValidationError']('Wrong\x20credentials');}if(_0x13cc14[_0x6fa8('0x6b')][_0x6fa8('0x99')]==_0x13cc14[_0x6fa8('0x6b')][_0x6fa8('0x9a')]){throw new db['Sequelize'][(_0x6fa8('0x21'))](_0x6fa8('0x9d'));}return _0x18d6ef;}else if(_0x13cc14[_0x6fa8('0x3e')][_0x6fa8('0x45')]==_0x6fa8('0x70')){if(!_0x13cc14[_0x6fa8('0x6b')]['newPassword']){throw new db['Sequelize'][(_0x6fa8('0x21'))](_0x6fa8('0x9e'));}return _0x18d6ef;}else if(_0x13cc14[_0x6fa8('0x3e')]['role']==_0x6fa8('0x3e')){if(!_0x13cc14['body'][_0x6fa8('0x9a')]){throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0x9e'));}if(_0x18d6ef[_0x6fa8('0x45')]!=_0x6fa8('0x82')){throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0x9f'));}return _0x18d6ef;}else{throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0x9f'));}}return null;})[_0x6fa8('0x24')](handleEntityNotFound(_0x4a50d8,null))['then'](function(_0x5373e3){return checkPasswordPattern(_0x5373e3,_0x13cc14[_0x6fa8('0x6b')][_0x6fa8('0x9a')],_0xbe2cb0);})['then'](saveUpdates({'password':_0x13cc14[_0x6fa8('0x6b')][_0x6fa8('0x9a')],'passwordResetAt':_0x13cc14[_0x6fa8('0x3e')]['id']==_0x13cc14[_0x6fa8('0x6c')]['id']?moment():null},null))[_0x6fa8('0x24')](respondWithResult(_0x4a50d8,null))[_0x6fa8('0x2e')](handleError(_0x4a50d8,null));};exports[_0x6fa8('0xa0')]=function(_0x603460,_0x7765df,_0x4b2d87){var _0x3a20f7=_0x603460['body'][_0x6fa8('0xa1')];return db[_0x6fa8('0x4c')]['find']({'where':{'id':_0x603460[_0x6fa8('0x6c')]['id']},'attributes':['id','name',_0x6fa8('0x45'),_0x6fa8('0xa2'),_0x6fa8('0xa3'),'voicePause',_0x6fa8('0xa4')]})[_0x6fa8('0x24')](handleEntityNotFound(_0x7765df,null))[_0x6fa8('0x24')](function(_0x4ba230){if(_0x4ba230){if(!utils[_0x6fa8('0xa5')](_0x3a20f7)){throw new db['Sequelize'][(_0x6fa8('0x21'))](_0x6fa8('0xa6'));}return _0x4ba230['add'+_['capitalize'](_0x3a20f7['toLowerCase']())+'Queues'](_0x603460[_0x6fa8('0x6b')][_0x6fa8('0x6f')],{'penalty':_0x603460[_0x6fa8('0x6b')][_0x6fa8('0xa7')]||0x0})['spread'](function(_0x5e8a53){for(var _0x3bac62=0x0;_0x3bac62<_0x603460['body']['ids'][_0x6fa8('0x57')];_0x3bac62+=0x1){var _0x5bc8cf={'UserId':_0x603460[_0x6fa8('0x6c')]['id']};_0x5bc8cf[_[_0x6fa8('0xa8')](_0x3a20f7['toLowerCase']())+'QueueId']=_0x603460[_0x6fa8('0x6b')][_0x6fa8('0x6f')][_0x3bac62];socket[_0x6fa8('0xa9')]('user'+_[_0x6fa8('0xa8')](_0x3a20f7[_0x6fa8('0xaa')]())+_0x6fa8('0xab'),_0x5bc8cf);}return _0x5e8a53;})[_0x6fa8('0x24')](function(){if(_0x3a20f7===_0x6fa8('0xac')){return db[_0x6fa8('0xad')][_0x6fa8('0x65')]({'where':{'id':_0x603460['body'][_0x6fa8('0x6f')]||[]},'raw':!![],'attributes':['id',_0x6fa8('0x47')]});}})['then'](function(_0x2212c2){var _0x20d7d4=_0x4ba230[_0x6fa8('0x3c')]({'plain':!![]});var _0x8a0395=[];if(_0x3a20f7==='voice'&&_0x20d7d4[_0x6fa8('0x45')]===_0x6fa8('0x82')&&_0x20d7d4['online']){for(var _0x2fee34=0x0;_0x2fee34<_0x2212c2[_0x6fa8('0x57')];_0x2fee34+=0x1){_0x8a0395[_0x6fa8('0xae')]({'membername':_0x20d7d4[_0x6fa8('0x47')],'UserId':_0x20d7d4['id'],'queue_name':_0x2212c2[_0x2fee34][_0x6fa8('0x47')],'VoiceQueueId':_0x2212c2[_0x2fee34]['id'],'interface':_[_0x6fa8('0x75')](_0x20d7d4['interface'])?util['format'](_0x6fa8('0xaf'),_0x20d7d4[_0x6fa8('0x47')]):_0x20d7d4[_0x6fa8('0xa4')],'paused':_0x20d7d4[_0x6fa8('0xb0')]||![],'penalty':_0x603460['body'][_0x6fa8('0xa7')]||0x0});}return BPromise[_0x6fa8('0xb1')](_0x8a0395,function(_0x550fe5){return db[_0x6fa8('0xb2')]['upsert'](_0x550fe5);});}return _0x4ba230;});}})['then'](respondWithStatusCode(_0x7765df,null))['catch'](handleError(_0x7765df,null));};exports[_0x6fa8('0xb3')]=function(_0x1f3131,_0x556fcc,_0x3896cc){var _0x50b9cd;return db['User']['find']({'where':{'id':_0x1f3131[_0x6fa8('0x6c')]['id']},'attributes':['id','name',_0x6fa8('0x45')]})['then'](handleEntityNotFound(_0x556fcc,null))[_0x6fa8('0x24')](function(_0x59ba7a){if(_0x59ba7a){_0x50b9cd=_0x59ba7a;if(!_0x1f3131['query'][_0x6fa8('0xa1')]||!utils[_0x6fa8('0xa5')](_0x1f3131[_0x6fa8('0x51')]['channel'])){throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0xa6'));}return _0x59ba7a[_0x6fa8('0xb4')+_[_0x6fa8('0xa8')](_0x1f3131[_0x6fa8('0x51')]['channel'][_0x6fa8('0xaa')]())+'Queues'](_0x1f3131[_0x6fa8('0x51')][_0x6fa8('0x6f')]);}})['then'](function(_0x7c2434){for(var _0x455dc4=0x0;_0x455dc4<_0x1f3131[_0x6fa8('0x51')][_0x6fa8('0x6f')][_0x6fa8('0x57')];_0x455dc4+=0x1){var _0x4eb929={'UserId':_0x1f3131[_0x6fa8('0x6c')]['id']};_0x4eb929[_[_0x6fa8('0xa8')](_0x1f3131[_0x6fa8('0x51')]['channel'][_0x6fa8('0xaa')]())+_0x6fa8('0xb5')]=_0x1f3131[_0x6fa8('0x51')]['ids'][_0x455dc4];socket[_0x6fa8('0xa9')](_0x6fa8('0x3e')+_['capitalize'](_0x1f3131[_0x6fa8('0x51')][_0x6fa8('0xa1')][_0x6fa8('0xaa')]())+_0x6fa8('0xb6'),_0x4eb929);}return _0x7c2434;})[_0x6fa8('0x24')](function(){if(_0x1f3131[_0x6fa8('0x51')]['channel']===_0x6fa8('0xac')){return db[_0x6fa8('0xb2')][_0x6fa8('0x3b')]({'where':{'UserId':_0x1f3131[_0x6fa8('0x6c')]['id'],'VoiceQueueId':_0x1f3131[_0x6fa8('0x51')][_0x6fa8('0x6f')]},'individualHooks':!![]})[_0x6fa8('0x24')](function(){return _0x50b9cd;});}return _0x50b9cd;})[_0x6fa8('0x24')](respondWithStatusCode(_0x556fcc,null))[_0x6fa8('0x2e')](handleError(_0x556fcc,null));};exports[_0x6fa8('0xb7')]=function(_0x37b3d5,_0x5f8ae1,_0x5c8eb5){_0x37b3d5['body'][_0x6fa8('0xb8')]=_0x37b3d5[_0x6fa8('0xb9')][_0x6fa8('0xba')];return db[_0x6fa8('0x4c')][_0x6fa8('0x46')]({'where':{'id':_0x37b3d5['params']['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x5f8ae1,null))[_0x6fa8('0x24')](saveUpdates(_0x37b3d5[_0x6fa8('0x6b')],null))[_0x6fa8('0x24')](respondWithResult(_0x5f8ae1,null))[_0x6fa8('0x2e')](handleError(_0x5f8ae1,null));};exports[_0x6fa8('0xbb')]=function(_0x5579d1,_0x59c57b,_0x25d18d){var _0xa3f952=path[_0x6fa8('0xbc')](config[_0x6fa8('0xbd')],'server/files/images/logos/default_profile.png');return db['User'][_0x6fa8('0x46')]({'where':{'id':_0x5579d1[_0x6fa8('0x6c')]['id']},'attributes':['id',_0x6fa8('0xb8')],'raw':!![]})[_0x6fa8('0x24')](handleEntityNotFound(_0x59c57b,null))[_0x6fa8('0x24')](function(_0x1aaad6){if(_0x1aaad6){if(_[_0x6fa8('0x75')](_0x1aaad6[_0x6fa8('0xb8')])){return _0x59c57b['download'](_0xa3f952);}else{if(!fs[_0x6fa8('0xbe')](path[_0x6fa8('0xbc')](config[_0x6fa8('0xbd')],_0x6fa8('0xbf'),_0x1aaad6[_0x6fa8('0xb8')]))){return _0x59c57b['download'](_0xa3f952);}return _0x59c57b[_0x6fa8('0xc0')](path['join'](config[_0x6fa8('0xbd')],_0x6fa8('0xbf'),_0x1aaad6[_0x6fa8('0xb8')]));}}})[_0x6fa8('0x2e')](handleError(_0x59c57b,null));};exports[_0x6fa8('0xc1')]=function(_0xda8f26,_0x39a3a2,_0x48626a){var _0x3fa178={};var _0x43019a={};var _0x3c5416;var _0x3e276e;return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0xda8f26[_0x6fa8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x39a3a2,null))[_0x6fa8('0x24')](function(_0x1452dc){if(_0x1452dc){_0x3c5416=_0x1452dc;_0x43019a[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0xc2')][_0x6fa8('0x4d')]);_0x43019a[_0x6fa8('0x51')]=_['keys'](_0xda8f26[_0x6fa8('0x51')]);_0x43019a[_0x6fa8('0x52')]=_['intersection'](_0x43019a['model'],_0x43019a['query']);_0x3fa178[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x43019a[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0xda8f26[_0x6fa8('0x51')]['fields']));_0x3fa178['attributes']=_0x3fa178[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x3fa178[_0x6fa8('0x55')]:_0x43019a[_0x6fa8('0x54')];_0x3fa178[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0xda8f26[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x3fa178[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0xda8f26[_0x6fa8('0x51')],_0x43019a[_0x6fa8('0x52')]));if(_0xda8f26['query'][_0x6fa8('0x5e')]){_0x3fa178[_0x6fa8('0x5c')]=_['merge'](_0x3fa178[_0x6fa8('0x5c')],{'$or':_['map'](_0x3fa178[_0x6fa8('0x55')],function(_0x3741f3){var _0x2478f0={};_0x2478f0[_0x3741f3]={'$like':'%'+_0xda8f26[_0x6fa8('0x51')][_0x6fa8('0x5e')]+'%'};return _0x2478f0;})});}_0x3fa178=_['merge']({},_0x3fa178,_0xda8f26[_0x6fa8('0x69')]);return _0x3c5416[_0x6fa8('0xc1')](_0x3fa178);}})[_0x6fa8('0x24')](function(_0x1f3df9){if(_0x1f3df9){_0x3e276e=_0x1f3df9[_0x6fa8('0x57')];if(_0xda8f26[_0x6fa8('0x51')][_0x6fa8('0x58')]('includeAll')){_0x3fa178[_0x6fa8('0x64')]=[{'model':db['CmList'],'as':_0x6fa8('0xc4'),'required':![]},{'model':db[_0x6fa8('0xc5')],'as':_0x6fa8('0xc6'),'attributes':['id',_0x6fa8('0x47'),_0x6fa8('0xc7')],'where':_0xda8f26['query'][_0x6fa8('0xc8')]?{'id':_0xda8f26[_0x6fa8('0x51')]['tag']}:undefined,'required':_0xda8f26[_0x6fa8('0x51')]['tag']?!![]:![]}];}if(!_0xda8f26[_0x6fa8('0x51')]['hasOwnProperty'](_0x6fa8('0x59'))){_0x3fa178[_0x6fa8('0x5a')]=qs['limit'](_0xda8f26[_0x6fa8('0x51')]['limit']);_0x3fa178[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0xda8f26[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x3c5416['getContacts'](_0x3fa178);}})['then'](function(_0x1aae3b){if(_0x1aae3b){return _0x1aae3b?{'count':_0x3e276e,'rows':_0x1aae3b}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x39a3a2,null))[_0x6fa8('0x2e')](handleError(_0x39a3a2,null));};exports[_0x6fa8('0xc9')]=function(_0x4835ca,_0xaff96a,_0x2efa18){var _0x191ac7;var _0x464cc3;var _0x28e858={};var _0x4ec422;return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x4835ca['params']['id']},'attributes':['id',_0x6fa8('0x47'),'role']})[_0x6fa8('0x24')](handleEntityNotFound(_0xaff96a,null))[_0x6fa8('0x24')](function(_0x216829){if(!utils[_0x6fa8('0xa5')](_0x4835ca['query'][_0x6fa8('0xa1')])){throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0xa6'));}_0x191ac7=_0x216829;var _0x2d1334={};_0x2d1334[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_[_0x6fa8('0xa8')](_0x4835ca[_0x6fa8('0x51')]['channel'])+'Queue'][_0x6fa8('0x4d')]);_0x2d1334[_0x6fa8('0x51')]=_['keys'](_0x4835ca[_0x6fa8('0x51')]);_0x2d1334[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x2d1334['model'],_0x2d1334[_0x6fa8('0x51')]);_0x28e858[_0x6fa8('0x55')]=_['intersection'](_0x2d1334[_0x6fa8('0x54')],qs['fields'](_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x28e858[_0x6fa8('0x55')]=_0x28e858[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x28e858['attributes']:_0x2d1334[_0x6fa8('0x54')];_0x28e858[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x28e858[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_['pick'](_0x4835ca['query'],_0x2d1334['filters']));if(_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x28e858[_0x6fa8('0x5c')]=_['merge'](_0x28e858[_0x6fa8('0x5c')],{'$or':_['map'](_0x28e858[_0x6fa8('0x55')],function(_0x971238){var _0x5f5ad3={};_0x5f5ad3[_0x971238]={'$like':'%'+_0x4835ca['query'][_0x6fa8('0x5e')]+'%'};return _0x5f5ad3;})});}_0x28e858=_['merge']({},_0x28e858,_0x4835ca['options']);switch(_0x191ac7[_0x6fa8('0x45')]){case _0x6fa8('0x70'):return db[_[_0x6fa8('0xa8')](_0x4835ca[_0x6fa8('0x51')]['channel'])+_0x6fa8('0xca')][_0x6fa8('0x65')](_0x28e858);case _0x6fa8('0x3e'):case'agent':return _0x191ac7['get'+_[_0x6fa8('0xa8')](_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0xa1')])+_0x6fa8('0xcb')](_0x28e858);default:throw new db[(_0x6fa8('0x9b'))]['ValidationError']('Unknown\x20role');}})[_0x6fa8('0x24')](function(_0x6fdf6d){_0x4ec422=_0x6fdf6d[_0x6fa8('0x57')];if(!_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x28e858[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x28e858[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0x34')]);}switch(_0x191ac7[_0x6fa8('0x45')]){case'admin':return db[_[_0x6fa8('0xa8')](_0x4835ca[_0x6fa8('0x51')][_0x6fa8('0xa1')])+_0x6fa8('0xca')][_0x6fa8('0x65')](_0x28e858);case _0x6fa8('0x3e'):case'agent':return _0x191ac7[_0x6fa8('0x3c')+_[_0x6fa8('0xa8')](_0x4835ca[_0x6fa8('0x51')]['channel'])+'Queues'](_0x28e858);}})[_0x6fa8('0x24')](function(_0x52cc3e){return{'count':_0x4ec422,'rows':_0x52cc3e};})[_0x6fa8('0x24')](respondWithResult(_0xaff96a,null))['catch'](handleError(_0xaff96a,null));};exports[_0x6fa8('0xcc')]=function(_0x2a05d8,_0x780083,_0x2591d8){var _0x403f32={};var _0xdd6809={};var _0x13aa75;var _0x1e1426;return db['User']['findOne']({'where':{'id':_0x2a05d8[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x780083,null))[_0x6fa8('0x24')](function(_0x43e0cd){if(_0x43e0cd){_0x13aa75=_0x43e0cd;_0xdd6809[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0xb2')]['rawAttributes']);_0xdd6809[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x2a05d8['query']);_0xdd6809[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0xdd6809[_0x6fa8('0x54')],_0xdd6809[_0x6fa8('0x51')]);_0x403f32[_0x6fa8('0x55')]=_['intersection'](_0xdd6809[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0x2a05d8[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x403f32[_0x6fa8('0x55')]=_0x403f32[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x403f32['attributes']:_0xdd6809['model'];_0x403f32[_0x6fa8('0xc3')]=qs['sort'](_0x2a05d8[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x403f32[_0x6fa8('0x5c')]=qs['filters'](_['pick'](_0x2a05d8[_0x6fa8('0x51')],_0xdd6809[_0x6fa8('0x52')]));if(_0x2a05d8['query']['filter']){_0x403f32[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0x403f32[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x403f32[_0x6fa8('0x55')],function(_0xf62227){var _0xca7559={};_0xca7559[_0xf62227]={'$like':'%'+_0x2a05d8[_0x6fa8('0x51')]['filter']+'%'};return _0xca7559;})});}_0x403f32=_[_0x6fa8('0x5f')]({},_0x403f32,_0x2a05d8[_0x6fa8('0x69')]);return _0x13aa75[_0x6fa8('0xcc')](_0x403f32);}})[_0x6fa8('0x24')](function(_0x42b09c){if(_0x42b09c){_0x1e1426=_0x42b09c[_0x6fa8('0x57')];if(!_0x2a05d8[_0x6fa8('0x51')][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x403f32[_0x6fa8('0x5a')]=qs['limit'](_0x2a05d8[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x403f32['offset']=qs[_0x6fa8('0x34')](_0x2a05d8['query']['offset']);}return _0x13aa75[_0x6fa8('0xcc')](_0x403f32);}})[_0x6fa8('0x24')](function(_0x531a59){if(_0x531a59){return _0x531a59?{'count':_0x1e1426,'rows':_0x531a59}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x780083,null))[_0x6fa8('0x2e')](handleError(_0x780083,null));};exports[_0x6fa8('0xcd')]=function(_0x1687dc,_0x2fb871,_0x50bfe7){var _0x3ae992={};var _0x59f238={};var _0x2a2bba;var _0x4b374b;return db[_0x6fa8('0x4c')]['findOne']({'where':{'id':_0x1687dc[_0x6fa8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x2fb871,null))[_0x6fa8('0x24')](function(_0x123f01){if(_0x123f01){_0x2a2bba=_0x123f01;_0x59f238['model']=_[_0x6fa8('0x67')](db['ChatGroup'][_0x6fa8('0x4d')]);_0x59f238[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x1687dc['query']);_0x59f238[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x59f238[_0x6fa8('0x54')],_0x59f238[_0x6fa8('0x51')]);_0x3ae992[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x59f238[_0x6fa8('0x54')],qs['fields'](_0x1687dc[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x3ae992['attributes']=_0x3ae992[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x3ae992[_0x6fa8('0x55')]:_0x59f238[_0x6fa8('0x54')];_0x3ae992[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x1687dc['query'][_0x6fa8('0x5b')]);_0x3ae992['where']=qs['filters'](_[_0x6fa8('0x5d')](_0x1687dc['query'],_0x59f238[_0x6fa8('0x52')]));if(_0x1687dc[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x3ae992['where']=_['merge'](_0x3ae992[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x3ae992[_0x6fa8('0x55')],function(_0x3a931a){var _0x4525d2={};_0x4525d2[_0x3a931a]={'$like':'%'+_0x1687dc['query']['filter']+'%'};return _0x4525d2;})});}_0x3ae992=_[_0x6fa8('0x5f')]({},_0x3ae992,_0x1687dc[_0x6fa8('0x69')]);return _0x2a2bba[_0x6fa8('0xcd')](_0x3ae992);}})[_0x6fa8('0x24')](function(_0x181cfd){if(_0x181cfd){_0x4b374b=_0x181cfd['length'];if(!_0x1687dc[_0x6fa8('0x51')]['hasOwnProperty'](_0x6fa8('0x59'))){_0x3ae992['limit']=qs['limit'](_0x1687dc['query']['limit']);_0x3ae992[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x1687dc[_0x6fa8('0x51')]['offset']);}return _0x2a2bba['getGroups'](_0x3ae992);}})['then'](function(_0x184460){if(_0x184460){return _0x184460?{'count':_0x4b374b,'rows':_0x184460}:null;}})['then'](respondWithResult(_0x2fb871,null))[_0x6fa8('0x2e')](handleError(_0x2fb871,null));};exports[_0x6fa8('0xce')]=function(_0x124aa2,_0x71c38a,_0x3b6044){var _0x203c57={'raw':!![],'where':{}};var _0x48f057={};var _0x531f4a={'count':0x0,'rows':[]};return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x124aa2['params']['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x71c38a,null))[_0x6fa8('0x24')](function(_0x3b132c){if(_0x3b132c){_0x48f057[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0xcf')][_0x6fa8('0x4d')]);_0x48f057[_0x6fa8('0x51')]=_['keys'](_0x124aa2[_0x6fa8('0x51')]);_0x48f057[_0x6fa8('0x52')]=_['intersection'](_0x48f057[_0x6fa8('0x54')],_0x48f057[_0x6fa8('0x51')]);_0x203c57[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x48f057['model'],qs[_0x6fa8('0x56')](_0x124aa2[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x203c57['attributes']=_0x203c57['attributes'][_0x6fa8('0x57')]?_0x203c57['attributes']:_0x48f057[_0x6fa8('0x54')];if(!_0x124aa2[_0x6fa8('0x51')]['hasOwnProperty']('nolimit')){_0x203c57['limit']=qs[_0x6fa8('0x5a')](_0x124aa2[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x203c57['offset']=qs[_0x6fa8('0x34')](_0x124aa2[_0x6fa8('0x51')]['offset']);}_0x203c57[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x124aa2['query']['sort']);_0x203c57[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x124aa2[_0x6fa8('0x51')],_0x48f057[_0x6fa8('0x52')]));_0x203c57['where'][_0x6fa8('0xd0')]=_0x3b132c['id'];if(_0x124aa2['query']['filter']){_0x203c57['where']=_[_0x6fa8('0x5f')](_0x203c57['where'],{'$or':_[_0x6fa8('0x42')](_0x203c57['attributes'],function(_0x3f2c29){var _0x44cf5b={};_0x44cf5b[_0x3f2c29]={'$like':'%'+_0x124aa2['query'][_0x6fa8('0x5e')]+'%'};return _0x44cf5b;})});}_0x203c57=_[_0x6fa8('0x5f')]({},_0x203c57,_0x124aa2[_0x6fa8('0x69')]);return db[_0x6fa8('0xcf')][_0x6fa8('0x33')]({'where':_0x203c57['where']})[_0x6fa8('0x24')](function(_0x36b45e){_0x531f4a[_0x6fa8('0x33')]=_0x36b45e;if(_0x124aa2[_0x6fa8('0x51')][_0x6fa8('0xd1')]){_0x203c57[_0x6fa8('0x64')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6fa8('0x65')](_0x203c57);})[_0x6fa8('0x24')](function(_0x3cab1a){_0x531f4a['rows']=_0x3cab1a;return _0x531f4a;});}})[_0x6fa8('0x24')](respondWithFilteredResult(_0x71c38a,_0x203c57))[_0x6fa8('0x2e')](handleError(_0x71c38a,null));};exports[_0x6fa8('0xd2')]=function(_0x1eaa57,_0x570060,_0xed96d3){var _0x2c38d4={'raw':!![],'where':{}};var _0x535c3f={};var _0x16fc41={'count':0x0,'rows':[]};return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x1eaa57['params']['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x570060,null))[_0x6fa8('0x24')](function(_0xd2cd7){if(_0xd2cd7){_0x535c3f[_0x6fa8('0x54')]=_['keys'](db[_0x6fa8('0xd3')][_0x6fa8('0x4d')]);_0x535c3f['query']=_[_0x6fa8('0x67')](_0x1eaa57[_0x6fa8('0x51')]);_0x535c3f[_0x6fa8('0x52')]=_['intersection'](_0x535c3f[_0x6fa8('0x54')],_0x535c3f['query']);_0x2c38d4['attributes']=_['intersection'](_0x535c3f['model'],qs[_0x6fa8('0x56')](_0x1eaa57['query'][_0x6fa8('0x56')]));_0x2c38d4[_0x6fa8('0x55')]=_0x2c38d4[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x2c38d4[_0x6fa8('0x55')]:_0x535c3f[_0x6fa8('0x54')];if(!_0x1eaa57[_0x6fa8('0x51')][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x2c38d4[_0x6fa8('0x5a')]=qs['limit'](_0x1eaa57['query'][_0x6fa8('0x5a')]);_0x2c38d4[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x1eaa57['query'][_0x6fa8('0x34')]);}_0x2c38d4['order']=qs[_0x6fa8('0x5b')](_0x1eaa57[_0x6fa8('0x51')]['sort']);_0x2c38d4[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x1eaa57[_0x6fa8('0x51')],_0x535c3f[_0x6fa8('0x52')]));_0x2c38d4[_0x6fa8('0x5c')]['UserId']=_0xd2cd7['id'];if(_0x1eaa57['query'][_0x6fa8('0x5e')]){_0x2c38d4[_0x6fa8('0x5c')]=_['merge'](_0x2c38d4[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x2c38d4[_0x6fa8('0x55')],function(_0x5c5ab4){var _0x1a0948={};_0x1a0948[_0x5c5ab4]={'$like':'%'+_0x1eaa57['query'][_0x6fa8('0x5e')]+'%'};return _0x1a0948;})});}_0x2c38d4=_['merge']({},_0x2c38d4,_0x1eaa57[_0x6fa8('0x69')]);return db[_0x6fa8('0xd3')][_0x6fa8('0x33')]({'where':_0x2c38d4[_0x6fa8('0x5c')]})[_0x6fa8('0x24')](function(_0x54e4d0){_0x16fc41[_0x6fa8('0x33')]=_0x54e4d0;if(_0x1eaa57[_0x6fa8('0x51')]['includeAll']){_0x2c38d4[_0x6fa8('0x64')]=[{'all':!![]}];}return db[_0x6fa8('0xd3')][_0x6fa8('0x65')](_0x2c38d4);})[_0x6fa8('0x24')](function(_0x2bca97){_0x16fc41[_0x6fa8('0x66')]=_0x2bca97;return _0x16fc41;});}})['then'](respondWithFilteredResult(_0x570060,_0x2c38d4))[_0x6fa8('0x2e')](handleError(_0x570060,null));};exports['getChatInteractions']=function(_0x472228,_0x4a2303,_0x58a786){var _0xfdd8d8={};var _0xed745a={};var _0x5e7750;var _0x333b5c;return db['User'][_0x6fa8('0x98')]({'where':{'id':_0x472228[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x4a2303,null))[_0x6fa8('0x24')](function(_0x31b5c){if(_0x31b5c){_0x5e7750=_0x31b5c;_0xed745a[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0xd4')][_0x6fa8('0x4d')]);_0xed745a[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x472228[_0x6fa8('0x51')]);_0xed745a[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0xed745a['model'],_0xed745a['query']);_0xfdd8d8[_0x6fa8('0x55')]=_['intersection'](_0xed745a['model'],qs[_0x6fa8('0x56')](_0x472228[_0x6fa8('0x51')]['fields']));_0xfdd8d8[_0x6fa8('0x55')]=_0xfdd8d8['attributes'][_0x6fa8('0x57')]?_0xfdd8d8[_0x6fa8('0x55')]:_0xed745a['model'];_0xfdd8d8[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x472228[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0xfdd8d8['where']=qs['filters'](_[_0x6fa8('0x5d')](_0x472228[_0x6fa8('0x51')],_0xed745a[_0x6fa8('0x52')]));if(_0x472228['query']['filter']){_0xfdd8d8[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0xfdd8d8['where'],{'$or':_[_0x6fa8('0x42')](_0xfdd8d8[_0x6fa8('0x55')],function(_0x224a59){var _0x403cc0={};_0x403cc0[_0x224a59]={'$like':'%'+_0x472228['query'][_0x6fa8('0x5e')]+'%'};return _0x403cc0;})});}_0xfdd8d8=_[_0x6fa8('0x5f')]({},_0xfdd8d8,_0x472228[_0x6fa8('0x69')]);return _0x5e7750[_0x6fa8('0xd5')](_0xfdd8d8);}})[_0x6fa8('0x24')](function(_0x420013){if(_0x420013){_0x333b5c=_0x420013[_0x6fa8('0x57')];if(!_0x472228['query'][_0x6fa8('0x58')]('nolimit')){_0xfdd8d8[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x472228[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0xfdd8d8[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x472228[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x5e7750[_0x6fa8('0xd5')](_0xfdd8d8);}})[_0x6fa8('0x24')](function(_0x5d4cea){if(_0x5d4cea){return _0x5d4cea?{'count':_0x333b5c,'rows':_0x5d4cea}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x4a2303,null))[_0x6fa8('0x2e')](handleError(_0x4a2303,null));};exports['getOpenchannelInteractions']=function(_0x483d69,_0x5a47ca,_0x53b848){var _0x5a00ba={};var _0x12c47b={};var _0x530302;var _0x35f155;return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x483d69['params']['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x5a47ca,null))['then'](function(_0xb4324b){if(_0xb4324b){_0x530302=_0xb4324b;_0x12c47b['model']=_[_0x6fa8('0x67')](db[_0x6fa8('0xd6')]['rawAttributes']);_0x12c47b['query']=_['keys'](_0x483d69['query']);_0x12c47b['filters']=_[_0x6fa8('0x53')](_0x12c47b[_0x6fa8('0x54')],_0x12c47b['query']);_0x5a00ba['attributes']=_['intersection'](_0x12c47b[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0x483d69[_0x6fa8('0x51')]['fields']));_0x5a00ba[_0x6fa8('0x55')]=_0x5a00ba['attributes']['length']?_0x5a00ba[_0x6fa8('0x55')]:_0x12c47b[_0x6fa8('0x54')];_0x5a00ba[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x483d69[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x5a00ba['where']=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x483d69['query'],_0x12c47b[_0x6fa8('0x52')]));if(_0x483d69[_0x6fa8('0x51')]['filter']){_0x5a00ba[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0x5a00ba['where'],{'$or':_[_0x6fa8('0x42')](_0x5a00ba[_0x6fa8('0x55')],function(_0x3505fd){var _0x25a91b={};_0x25a91b[_0x3505fd]={'$like':'%'+_0x483d69[_0x6fa8('0x51')][_0x6fa8('0x5e')]+'%'};return _0x25a91b;})});}_0x5a00ba=_[_0x6fa8('0x5f')]({},_0x5a00ba,_0x483d69['options']);return _0x530302['getOpenchannelInteractions'](_0x5a00ba);}})[_0x6fa8('0x24')](function(_0xcc8600){if(_0xcc8600){_0x35f155=_0xcc8600[_0x6fa8('0x57')];if(!_0x483d69['query'][_0x6fa8('0x58')]('nolimit')){_0x5a00ba[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x483d69[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x5a00ba[_0x6fa8('0x34')]=qs['offset'](_0x483d69[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x530302['getOpenchannelInteractions'](_0x5a00ba);}})[_0x6fa8('0x24')](function(_0xdfc6a4){if(_0xdfc6a4){return _0xdfc6a4?{'count':_0x35f155,'rows':_0xdfc6a4}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x5a47ca,null))['catch'](handleError(_0x5a47ca,null));};exports[_0x6fa8('0xd7')]=function(_0x1eb33f,_0x48a857,_0x3d0b57){var _0x2c884b={'raw':!![],'where':{}};var _0x105215={};var _0x4038b={'count':0x0,'rows':[]};return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x1eb33f[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x48a857,null))[_0x6fa8('0x24')](function(_0x542c02){if(_0x542c02){_0x105215[_0x6fa8('0x54')]=_['keys'](db[_0x6fa8('0xd8')][_0x6fa8('0x4d')]);_0x105215[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x1eb33f['query']);_0x105215['filters']=_[_0x6fa8('0x53')](_0x105215[_0x6fa8('0x54')],_0x105215[_0x6fa8('0x51')]);_0x2c884b[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x105215[_0x6fa8('0x54')],qs['fields'](_0x1eb33f['query']['fields']));_0x2c884b['attributes']=_0x2c884b[_0x6fa8('0x55')]['length']?_0x2c884b[_0x6fa8('0x55')]:_0x105215['model'];if(!_0x1eb33f['query'][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x2c884b[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x1eb33f[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x2c884b['offset']=qs['offset'](_0x1eb33f[_0x6fa8('0x51')][_0x6fa8('0x34')]);}_0x2c884b[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x1eb33f[_0x6fa8('0x51')]['sort']);_0x2c884b[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x1eb33f[_0x6fa8('0x51')],_0x105215[_0x6fa8('0x52')]));_0x2c884b[_0x6fa8('0x5c')][_0x6fa8('0xd0')]=_0x542c02['id'];if(_0x1eb33f[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x2c884b[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0x2c884b[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x2c884b[_0x6fa8('0x55')],function(_0x159e4e){var _0x3c940a={};_0x3c940a[_0x159e4e]={'$like':'%'+_0x1eb33f[_0x6fa8('0x51')]['filter']+'%'};return _0x3c940a;})});}_0x2c884b=_[_0x6fa8('0x5f')]({},_0x2c884b,_0x1eb33f[_0x6fa8('0x69')]);return db[_0x6fa8('0xd8')]['count']({'where':_0x2c884b[_0x6fa8('0x5c')]})[_0x6fa8('0x24')](function(_0x4f8bd1){_0x4038b[_0x6fa8('0x33')]=_0x4f8bd1;if(_0x1eb33f[_0x6fa8('0x51')][_0x6fa8('0xd1')]){_0x2c884b[_0x6fa8('0x64')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x2c884b);})['then'](function(_0x164731){_0x4038b[_0x6fa8('0x66')]=_0x164731;return _0x4038b;});}})['then'](respondWithFilteredResult(_0x48a857,_0x2c884b))['catch'](handleError(_0x48a857,null));};exports['getSmsInteractions']=function(_0xb86a1d,_0x21084c,_0x12033e){var _0xcf552b={};var _0x1a0443={};var _0x1e78f3;var _0x13fde6;return db[_0x6fa8('0x4c')]['findOne']({'where':{'id':_0xb86a1d[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x21084c,null))[_0x6fa8('0x24')](function(_0x15f7f2){if(_0x15f7f2){_0x1e78f3=_0x15f7f2;_0x1a0443[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0xd9')][_0x6fa8('0x4d')]);_0x1a0443['query']=_[_0x6fa8('0x67')](_0xb86a1d[_0x6fa8('0x51')]);_0x1a0443[_0x6fa8('0x52')]=_['intersection'](_0x1a0443['model'],_0x1a0443[_0x6fa8('0x51')]);_0xcf552b[_0x6fa8('0x55')]=_['intersection'](_0x1a0443['model'],qs[_0x6fa8('0x56')](_0xb86a1d[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0xcf552b[_0x6fa8('0x55')]=_0xcf552b[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0xcf552b[_0x6fa8('0x55')]:_0x1a0443[_0x6fa8('0x54')];_0xcf552b[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0xb86a1d[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0xcf552b[_0x6fa8('0x5c')]=qs['filters'](_[_0x6fa8('0x5d')](_0xb86a1d['query'],_0x1a0443[_0x6fa8('0x52')]));if(_0xb86a1d[_0x6fa8('0x51')]['filter']){_0xcf552b[_0x6fa8('0x5c')]=_['merge'](_0xcf552b[_0x6fa8('0x5c')],{'$or':_['map'](_0xcf552b[_0x6fa8('0x55')],function(_0x1ef18d){var _0x2d411c={};_0x2d411c[_0x1ef18d]={'$like':'%'+_0xb86a1d[_0x6fa8('0x51')]['filter']+'%'};return _0x2d411c;})});}_0xcf552b=_['merge']({},_0xcf552b,_0xb86a1d[_0x6fa8('0x69')]);return _0x1e78f3[_0x6fa8('0xda')](_0xcf552b);}})[_0x6fa8('0x24')](function(_0x2cd608){if(_0x2cd608){_0x13fde6=_0x2cd608[_0x6fa8('0x57')];if(!_0xb86a1d[_0x6fa8('0x51')]['hasOwnProperty'](_0x6fa8('0x59'))){_0xcf552b['limit']=qs[_0x6fa8('0x5a')](_0xb86a1d[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0xcf552b[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0xb86a1d[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x1e78f3[_0x6fa8('0xda')](_0xcf552b);}})[_0x6fa8('0x24')](function(_0x82ae88){if(_0x82ae88){return _0x82ae88?{'count':_0x13fde6,'rows':_0x82ae88}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x21084c,null))[_0x6fa8('0x2e')](handleError(_0x21084c,null));};exports['getFaxInteractions']=function(_0x1aa47c,_0x120a2c,_0x1bf0c2){var _0x3cf100={};var _0x307885={};var _0x4ad008;var _0x599308;return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x1aa47c['params']['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x120a2c,null))[_0x6fa8('0x24')](function(_0x2c6a83){if(_0x2c6a83){_0x4ad008=_0x2c6a83;_0x307885[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0xdb')][_0x6fa8('0x4d')]);_0x307885[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x1aa47c[_0x6fa8('0x51')]);_0x307885[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x307885[_0x6fa8('0x54')],_0x307885['query']);_0x3cf100['attributes']=_['intersection'](_0x307885[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0x1aa47c[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x3cf100[_0x6fa8('0x55')]=_0x3cf100[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x3cf100[_0x6fa8('0x55')]:_0x307885['model'];_0x3cf100[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x1aa47c['query'][_0x6fa8('0x5b')]);_0x3cf100[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_['pick'](_0x1aa47c[_0x6fa8('0x51')],_0x307885['filters']));if(_0x1aa47c[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x3cf100['where']=_[_0x6fa8('0x5f')](_0x3cf100[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x3cf100[_0x6fa8('0x55')],function(_0x1c2156){var _0x34e190={};_0x34e190[_0x1c2156]={'$like':'%'+_0x1aa47c[_0x6fa8('0x51')][_0x6fa8('0x5e')]+'%'};return _0x34e190;})});}_0x3cf100=_[_0x6fa8('0x5f')]({},_0x3cf100,_0x1aa47c[_0x6fa8('0x69')]);return _0x4ad008[_0x6fa8('0xdc')](_0x3cf100);}})[_0x6fa8('0x24')](function(_0x46ee27){if(_0x46ee27){_0x599308=_0x46ee27['length'];if(!_0x1aa47c['query']['hasOwnProperty'](_0x6fa8('0x59'))){_0x3cf100[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x1aa47c[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x3cf100[_0x6fa8('0x34')]=qs['offset'](_0x1aa47c[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x4ad008['getFaxInteractions'](_0x3cf100);}})[_0x6fa8('0x24')](function(_0x6bf2c9){if(_0x6bf2c9){return _0x6bf2c9?{'count':_0x599308,'rows':_0x6bf2c9}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x120a2c,null))[_0x6fa8('0x2e')](handleError(_0x120a2c,null));};exports[_0x6fa8('0xdd')]=function(_0x22815b,_0x3c65cb,_0xbf4f9a){var _0x5d288e={};var _0x428036={};var _0x58279d;var _0x5bac81;return db['User']['findOne']({'where':{'id':_0x22815b[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x3c65cb,null))[_0x6fa8('0x24')](function(_0x5f32d0){if(_0x5f32d0){_0x58279d=_0x5f32d0;_0x428036[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db['WhatsappInteraction'][_0x6fa8('0x4d')]);_0x428036['query']=_[_0x6fa8('0x67')](_0x22815b[_0x6fa8('0x51')]);_0x428036[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x428036[_0x6fa8('0x54')],_0x428036[_0x6fa8('0x51')]);_0x5d288e[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x428036[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0x22815b['query'][_0x6fa8('0x56')]));_0x5d288e[_0x6fa8('0x55')]=_0x5d288e[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x5d288e[_0x6fa8('0x55')]:_0x428036['model'];_0x5d288e['order']=qs[_0x6fa8('0x5b')](_0x22815b['query']['sort']);_0x5d288e[_0x6fa8('0x5c')]=qs['filters'](_[_0x6fa8('0x5d')](_0x22815b[_0x6fa8('0x51')],_0x428036['filters']));if(_0x22815b[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x5d288e[_0x6fa8('0x5c')]=_['merge'](_0x5d288e['where'],{'$or':_['map'](_0x5d288e[_0x6fa8('0x55')],function(_0x45af20){var _0x453e34={};_0x453e34[_0x45af20]={'$like':'%'+_0x22815b[_0x6fa8('0x51')]['filter']+'%'};return _0x453e34;})});}_0x5d288e=_[_0x6fa8('0x5f')]({},_0x5d288e,_0x22815b[_0x6fa8('0x69')]);return _0x58279d[_0x6fa8('0xdd')](_0x5d288e);}})[_0x6fa8('0x24')](function(_0x5cb447){if(_0x5cb447){_0x5bac81=_0x5cb447['length'];if(!_0x22815b[_0x6fa8('0x51')][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x5d288e['limit']=qs['limit'](_0x22815b[_0x6fa8('0x51')]['limit']);_0x5d288e[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x22815b[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x58279d[_0x6fa8('0xdd')](_0x5d288e);}})[_0x6fa8('0x24')](function(_0x33d89b){if(_0x33d89b){return _0x33d89b?{'count':_0x5bac81,'rows':_0x33d89b}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x3c65cb,null))[_0x6fa8('0x2e')](handleError(_0x3c65cb,null));};exports[_0x6fa8('0xde')]=function(_0x1f6cd5,_0x11fca5,_0x3bf733){var _0x986c4a;var _0x3ee09a;var _0x2eec7b;var _0x2e24f5=!_[_0x6fa8('0x75')](_0x1f6cd5[_0x6fa8('0x6c')]['id'])?_0x1f6cd5[_0x6fa8('0x6c')]['id']:!_[_0x6fa8('0x75')](_0x1f6cd5[_0x6fa8('0x3e')]['id'])?_0x1f6cd5[_0x6fa8('0x3e')]['id']:null;return db[_0x6fa8('0x4c')][_0x6fa8('0x46')]({'where':{'id':_0x2e24f5,'role':{'$or':['admin',_0x6fa8('0x3e'),'agent']}},'attributes':['id',_0x6fa8('0x47'),'phone',_0x6fa8('0xdf'),_0x6fa8('0x45'),_0x6fa8('0x79'),_0x6fa8('0xa3')]})[_0x6fa8('0x24')](function(_0x425f21){if(_0x425f21){if(_0x425f21[_0x6fa8('0x45')]===_0x6fa8('0x82')){_0x986c4a=_0x425f21;if(_0x1f6cd5['body'][_0x6fa8('0xa4')]){_0x2eec7b=util[_0x6fa8('0x77')](_0x6fa8('0xe0'),_0x986c4a[_0x1f6cd5[_0x6fa8('0x6b')][_0x6fa8('0xa4')]]);}else if(_0x1f6cd5['body'][_0x6fa8('0xe1')]){_0x2eec7b=util[_0x6fa8('0x77')]('SIP/%s',_0x1f6cd5[_0x6fa8('0x6b')]['intrf']);}else{_0x2eec7b=util[_0x6fa8('0x77')](_0x6fa8('0xaf'),_0x986c4a[_0x6fa8('0x47')]);}socket['to'](util[_0x6fa8('0x77')](_0x6fa8('0xe2'),_0x986c4a['name']))[_0x6fa8('0xa9')](_0x6fa8('0xe3'),{'ip':_0x1f6cd5['headers'][_0x6fa8('0xe4')]||_0x1f6cd5[_0x6fa8('0xe5')][_0x6fa8('0xe6')]||_0x1f6cd5[_0x6fa8('0xe7')][_0x6fa8('0xe6')]||_0x1f6cd5['connection'][_0x6fa8('0xe7')][_0x6fa8('0xe6')]});return db[_0x6fa8('0xb2')][_0x6fa8('0x3b')]({'where':{'membername':_0x986c4a[_0x6fa8('0x47')]},'individualHooks':!![]});}}else{throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x6fa8('0x24')](function(){if(_0x986c4a){return _0x986c4a['getVoiceQueues']({'raw':!![]});}})[_0x6fa8('0x24')](function(_0x33b5f2){if(_0x986c4a){var _0x43757c=[];if(_0x33b5f2){_0x3ee09a=_0x33b5f2;if(_0x3ee09a[_0x6fa8('0x57')]){for(var _0x2bcfc6=0x0;_0x2bcfc6<_0x3ee09a[_0x6fa8('0x57')];_0x2bcfc6++){_0x43757c[_0x6fa8('0xae')]({'membername':_0x986c4a[_0x6fa8('0x47')],'UserId':_0x986c4a['id'],'queue_name':_0x3ee09a[_0x2bcfc6]['name'],'VoiceQueueId':_0x3ee09a[_0x2bcfc6]['id'],'interface':_0x2eec7b,'paused':_0x986c4a[_0x6fa8('0xa3')]||![],'penalty':_0x3ee09a[_0x2bcfc6]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x6fa8('0xb1')](_0x43757c,function(_0x52d385){return db[_0x6fa8('0xb2')][_0x6fa8('0xe8')](_0x52d385);});}}}})['then'](function(){if(_0x986c4a){return db[_0x6fa8('0xe9')]['findAll']({'where':{'membername':_0x986c4a[_0x6fa8('0x47')],'exitAt':null}});}})[_0x6fa8('0x24')](function(_0x32547c){if(_0x986c4a){var _0x22faf0=[];_0x32547c[_0x6fa8('0xea')](function(_0x8e9c9e){_0x22faf0[_0x6fa8('0xae')](_0x8e9c9e['update']({'exitAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb'))}));});return BPromise[_0x6fa8('0xec')](_0x22faf0);}})['then'](function(){if(_0x986c4a){var _0xf51a97=[];var _0x59d3f7=[];var _0x3eb392=utils['getChannels']();var _0x3ef107={'membername':_0x986c4a['name'],'interface':_0x2eec7b,'enterAt':moment()['format'](_0x6fa8('0xeb')),'role':_0x986c4a[_0x6fa8('0x45')],'internal':_0x986c4a[_0x6fa8('0x79')]};_0x3eb392[_0x6fa8('0xea')](function(_0x4d7359){_0xf51a97[_0x6fa8('0xae')](_[_0x6fa8('0x5f')]({'channel':_0x4d7359,'type':_0x6fa8('0xed'),'data1':_0x1f6cd5[_0x6fa8('0x6b')]['device'],'data2':_0x2eec7b},_0x3ef107));if(_0x986c4a[_0x6fa8('0xa3')]){_0x59d3f7[_0x6fa8('0xae')](_[_0x6fa8('0x5f')]({'channel':_0x4d7359,'type':'PAUSE','data1':_0x6fa8('0xee')},_0x3ef107));}});return db[_0x6fa8('0xe9')][_0x6fa8('0x6a')](_0xf51a97[_0x6fa8('0xef')](_0x59d3f7),{'individualHooks':!![]});}})[_0x6fa8('0x24')](function(){if(_0x986c4a){return _0x986c4a[_0x6fa8('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb')),'voicePause':_0x986c4a['loginInPause']||![],'mailPause':_0x986c4a['loginInPause']||![],'chatPause':_0x986c4a[_0x6fa8('0xa3')]||![],'faxPause':_0x986c4a[_0x6fa8('0xa3')]||![],'smsPause':_0x986c4a['loginInPause']||![],'openchannelPause':_0x986c4a[_0x6fa8('0xa3')]||![],'whatsappPause':_0x986c4a[_0x6fa8('0xa3')]||![],'pauseType':_0x986c4a[_0x6fa8('0xa3')]?_0x6fa8('0xee'):null,'interface':_0x2eec7b,'lastPauseAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb'))});}})[_0x6fa8('0x24')](function(_0x4b7659){if(_0x1f6cd5[_0x6fa8('0xf0')]){return _0x3bf733();}else{return BPromise[_0x6fa8('0xf1')](_0x4b7659)[_0x6fa8('0x24')](respondWithResult(_0x11fca5,null));}})['catch'](handleError(_0x11fca5,null));};exports[_0x6fa8('0xf2')]=function(_0x39f882,_0x538610,_0x3343b0){var _0x16f4cb;return db[_0x6fa8('0x4c')]['find']({'where':{'id':_0x39f882[_0x6fa8('0x6c')]['id'],'role':_0x6fa8('0x82')},'attributes':['id',_0x6fa8('0x47'),'role']})[_0x6fa8('0x24')](handleEntityNotFound(_0x538610,null))[_0x6fa8('0x24')](function(_0x47af1d){if(_0x47af1d){_0x16f4cb=_0x47af1d;return db['UserVoiceQueueRt'][_0x6fa8('0x3b')]({'where':{'membername':_0x16f4cb['name']},'individualHooks':!![]});}})[_0x6fa8('0x24')](function(){return db[_0x6fa8('0xe9')]['findAll']({'where':{'membername':_0x16f4cb[_0x6fa8('0x47')],'exitAt':null}});})[_0x6fa8('0x24')](function(_0x4a23d8){var _0x15e3c0=[];_0x4a23d8[_0x6fa8('0xea')](function(_0x3a4109){_0x15e3c0['push'](_0x3a4109[_0x6fa8('0x3a')]({'exitAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb'))}));});return BPromise['all'](_0x15e3c0);})[_0x6fa8('0x24')](function(){return _0x16f4cb['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6fa8('0x24')](respondWithResult(_0x538610,null))[_0x6fa8('0x2e')](handleError(_0x538610,null));};exports['pause']=function(_0x47d3c4,_0x24531f,_0x4d088b){var _0x46e570;return db['UserVoiceQueueRt'][_0x6fa8('0x3a')]({'paused':0x1},{'where':{'UserId':_0x47d3c4['params']['id']},'individualHooks':!![]})[_0x6fa8('0x24')](function(){return db[_0x6fa8('0x4c')]['find']({'where':{'id':_0x47d3c4[_0x6fa8('0x6c')]['id'],'role':_0x6fa8('0x82')},'attributes':['id',_0x6fa8('0x47'),'role','internal',_0x6fa8('0xa4')]});})['then'](handleEntityNotFound(_0x24531f,null))['then'](function(_0x28d24e){if(_0x28d24e){_0x46e570=_0x28d24e;return respondWithRpcPromise(_0x6fa8('0xf3'),_0x6fa8('0xf4'),{'id':_0x46e570['id'],'name':_0x46e570[_0x6fa8('0x47')],'pause':!![]});}})[_0x6fa8('0x24')](function(){if(_0x46e570){return db[_0x6fa8('0xe9')][_0x6fa8('0x65')]({'where':{'membername':_0x46e570[_0x6fa8('0x47')],'type':_0x6fa8('0xf5'),'exitAt':null}});}})['then'](function(_0x2872c7){if(_0x2872c7[_0x6fa8('0x57')]){var _0x12288e=moment()[_0x6fa8('0x77')](_0x6fa8('0xeb'));for(var _0x447a6d=0x0,_0xd11a21=_0x2872c7[_0x6fa8('0x57')];_0x447a6d<_0xd11a21;_0x447a6d++){_0x2872c7[_0x447a6d]['updateAttributes']({'exitAt':_0x12288e});}}})[_0x6fa8('0x24')](function(){var _0xdf8be1=[];var _0x234832=utils['getChannels']();_0x234832[_0x6fa8('0xea')](function(_0x4e2a11){_0xdf8be1[_0x6fa8('0xae')]({'channel':_0x4e2a11,'membername':_0x46e570[_0x6fa8('0x47')],'interface':_['isNil'](_0x46e570['interface'])?util[_0x6fa8('0x77')]('SIP/%s',_0x46e570['name']):_0x46e570[_0x6fa8('0xa4')],'type':_0x6fa8('0xf5'),'enterAt':moment()['format'](_0x6fa8('0xeb')),'data1':_0x47d3c4[_0x6fa8('0x6b')]['type']||_0x6fa8('0xf6'),'role':_0x46e570[_0x6fa8('0x45')],'internal':_0x46e570[_0x6fa8('0x79')]});});return db[_0x6fa8('0xe9')][_0x6fa8('0x6a')](_0xdf8be1,{'individualHooks':!![]});})[_0x6fa8('0x24')](function(){return _0x46e570[_0x6fa8('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x47d3c4[_0x6fa8('0x6b')][_0x6fa8('0x4e')]||_0x6fa8('0xf6'),'lastPauseAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb'))});})[_0x6fa8('0x24')](respondWithResult(_0x24531f,null))[_0x6fa8('0x2e')](handleError(_0x24531f,null));};exports['unpause']=function(_0x4b5f2a,_0x5a05a0,_0x20a84a){var _0x5b016c;return db[_0x6fa8('0x4c')][_0x6fa8('0x46')]({'where':{'id':_0x4b5f2a[_0x6fa8('0x6c')]['id']},'attributes':['id',_0x6fa8('0x47'),_0x6fa8('0x45'),_0x6fa8('0xb0'),_0x6fa8('0xf7'),'chatPause','faxPause',_0x6fa8('0xf8'),'smsPause','whatsapppause',_0x6fa8('0xf9'),_0x6fa8('0xfa')]})[_0x6fa8('0x24')](handleEntityNotFound(_0x5a05a0,null))[_0x6fa8('0x24')](function(_0x6a569e){if(_0x6a569e){_0x5b016c=_0x6a569e;if(_0x4b5f2a['body'][_0x6fa8('0xa1')]&&!utils[_0x6fa8('0xa5')](_0x4b5f2a[_0x6fa8('0x6b')][_0x6fa8('0xa1')])){throw new db[(_0x6fa8('0x9b'))][(_0x6fa8('0x21'))](_0x6fa8('0xa6'));}switch(_0x4b5f2a[_0x6fa8('0x6b')][_0x6fa8('0xa1')]){case _0x6fa8('0xac'):return respondWithRpcPromise(_0x6fa8('0xf3'),_0x6fa8('0xfb'),{'id':_0x5b016c['id'],'name':_0x5b016c['name'],'pause':![]})[_0x6fa8('0x24')](function(){return db[_0x6fa8('0xb2')]['update']({'paused':0x0},{'where':{'UserId':_0x5b016c['id']},'individualHooks':!![]});})['then'](function(){return db[_0x6fa8('0xe9')][_0x6fa8('0x46')]({'where':{'channel':_0x4b5f2a[_0x6fa8('0x6b')][_0x6fa8('0xa1')],'membername':_0x5b016c['name'],'type':_0x6fa8('0xf5'),'exitAt':null}});})[_0x6fa8('0x24')](function(_0x4a2892){if(_0x4a2892){return _0x4a2892[_0x6fa8('0x3a')]({'exitAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb')),'data2':_0x6fa8('0xfc')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x5b016c[_0x6fa8('0x3a')]({'voicePause':![]});});case _0x6fa8('0xfd'):case _0x6fa8('0xfe'):case'fax':case _0x6fa8('0xff'):case _0x6fa8('0x100'):case _0x6fa8('0x101'):return db[_0x6fa8('0xe9')][_0x6fa8('0x46')]({'where':{'channel':_0x4b5f2a['body'][_0x6fa8('0xa1')],'membername':_0x5b016c[_0x6fa8('0x47')],'type':_0x6fa8('0xf5'),'exitAt':null}})[_0x6fa8('0x24')](function(_0x3f3ce6){if(_0x3f3ce6){return _0x3f3ce6[_0x6fa8('0x3a')]({'exitAt':moment()[_0x6fa8('0x77')](_0x6fa8('0xeb')),'data2':_0x6fa8('0xfc')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x51a363={};_['set'](_0x51a363,util['format'](_0x6fa8('0x102'),_0x4b5f2a[_0x6fa8('0x6b')]['channel'],_0x6fa8('0x103')),![]);return _0x5b016c[_0x6fa8('0x3a')](_0x51a363);});default:return respondWithRpcPromise(_0x6fa8('0xf3'),_0x6fa8('0xfb'),{'id':_0x5b016c['id'],'name':_0x5b016c[_0x6fa8('0x47')],'pause':![]})[_0x6fa8('0x24')](function(){return db['UserVoiceQueueRt'][_0x6fa8('0x3a')]({'paused':0x0},{'where':{'UserId':_0x5b016c['id']}});})[_0x6fa8('0x24')](function(){return db[_0x6fa8('0xe9')][_0x6fa8('0x65')]({'where':{'membername':_0x5b016c[_0x6fa8('0x47')],'type':_0x6fa8('0xf5'),'exitAt':null}});})[_0x6fa8('0x24')](function(_0x3a09b0){var _0x5e9cf4=[];_0x3a09b0[_0x6fa8('0xea')](function(_0x509a50){_0x5e9cf4['push'](_0x509a50[_0x6fa8('0x3a')]({'exitAt':moment()[_0x6fa8('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6fa8('0xfc')}));});return BPromise[_0x6fa8('0xec')](_0x5e9cf4);})[_0x6fa8('0x24')](function(){return _0x5b016c[_0x6fa8('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6fa8('0x24')](respondWithResult(_0x5a05a0,null))[_0x6fa8('0x2e')](handleError(_0x5a05a0,null));};exports[_0x6fa8('0x104')]=function(_0x32fe66,_0x4e1bb7,_0x5186c6){var _0x47e4a3={};var _0x4b68d0={};var _0x118f2c;var _0x27a20e;return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x32fe66[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x4e1bb7,null))[_0x6fa8('0x24')](function(_0x3cebbd){if(_0x3cebbd){_0x118f2c=_0x3cebbd;_0x4b68d0[_0x6fa8('0x54')]=_[_0x6fa8('0x67')](db[_0x6fa8('0x105')][_0x6fa8('0x4d')]);_0x4b68d0['query']=_[_0x6fa8('0x67')](_0x32fe66[_0x6fa8('0x51')]);_0x4b68d0['filters']=_['intersection'](_0x4b68d0['model'],_0x4b68d0[_0x6fa8('0x51')]);_0x47e4a3[_0x6fa8('0x55')]=_[_0x6fa8('0x53')](_0x4b68d0[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0x32fe66[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x47e4a3[_0x6fa8('0x55')]=_0x47e4a3[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x47e4a3[_0x6fa8('0x55')]:_0x4b68d0[_0x6fa8('0x54')];_0x47e4a3[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x32fe66['query'][_0x6fa8('0x5b')]);_0x47e4a3[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x32fe66['query'],_0x4b68d0['filters']));if(_0x32fe66[_0x6fa8('0x51')]['filter']){_0x47e4a3[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0x47e4a3[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x47e4a3['attributes'],function(_0x14e033){var _0x1356bd={};_0x1356bd[_0x14e033]={'$like':'%'+_0x32fe66[_0x6fa8('0x51')][_0x6fa8('0x5e')]+'%'};return _0x1356bd;})});}_0x47e4a3=_[_0x6fa8('0x5f')]({},_0x47e4a3,_0x32fe66[_0x6fa8('0x69')]);return _0x118f2c[_0x6fa8('0x104')](_0x47e4a3);}})[_0x6fa8('0x24')](function(_0xf3497a){if(_0xf3497a){_0x27a20e=_0xf3497a[_0x6fa8('0x57')];if(!_0x32fe66['query'][_0x6fa8('0x58')](_0x6fa8('0x59'))){_0x47e4a3[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x32fe66[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x47e4a3[_0x6fa8('0x34')]=qs[_0x6fa8('0x34')](_0x32fe66['query'][_0x6fa8('0x34')]);}return _0x118f2c[_0x6fa8('0x104')](_0x47e4a3);}})[_0x6fa8('0x24')](function(_0x28b8bc){if(_0x28b8bc){return _0x28b8bc?{'count':_0x27a20e,'rows':_0x28b8bc}:null;}})[_0x6fa8('0x24')](respondWithResult(_0x4e1bb7,null))[_0x6fa8('0x2e')](handleError(_0x4e1bb7,null));};exports[_0x6fa8('0x106')]=function(_0x464f27,_0x4c0a32){return db[_0x6fa8('0x4c')][_0x6fa8('0x46')]({'where':{'id':_0x464f27[_0x6fa8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x4c0a32,null))['then'](function(_0x2791b2){if(_0x2791b2){var _0x26ca6c=_0x2791b2[_0x6fa8('0x3c')]({'plain':!![]});return _0x2791b2['addTeams'](_0x464f27['body'][_0x6fa8('0x6f')],_[_0x6fa8('0x107')](_0x464f27[_0x6fa8('0x6b')],[_0x6fa8('0x6f'),'id'])||{})[_0x6fa8('0x24')](function(){for(var _0x38f904=0x0;_0x38f904<_0x464f27['body'][_0x6fa8('0x6f')][_0x6fa8('0x57')];_0x38f904++){var _0x562985=[];db[_0x6fa8('0x105')][_0x6fa8('0x98')]({'where':{'id':_0x464f27['body'][_0x6fa8('0x6f')][_0x38f904]}})[_0x6fa8('0x24')](function(_0x51f4a1){_0x562985['push'](_0x51f4a1[_0x6fa8('0x108')]()[_0x6fa8('0x24')](function(_0xd3c73f){for(var _0x1d659c=0x0;_0x1d659c<_0xd3c73f[_0x6fa8('0x57')];_0x1d659c++){_0xd3c73f[_0x1d659c][_0x6fa8('0x109')](_0x6fa8('0xa1'),'Voice');}return _0xd3c73f;}));_0x562985[_0x6fa8('0xae')](_0x51f4a1[_0x6fa8('0x10a')]()[_0x6fa8('0x24')](function(_0x1fabc1){for(var _0x212ecf=0x0;_0x212ecf<_0x1fabc1['length'];_0x212ecf++){_0x1fabc1[_0x212ecf][_0x6fa8('0x109')](_0x6fa8('0xa1'),_0x6fa8('0x10b'));}return _0x1fabc1;}));_0x562985['push'](_0x51f4a1['getMailQueues']()[_0x6fa8('0x24')](function(_0x4e8cff){for(var _0x1779b7=0x0;_0x1779b7<_0x4e8cff['length'];_0x1779b7++){_0x4e8cff[_0x1779b7][_0x6fa8('0x109')](_0x6fa8('0xa1'),_0x6fa8('0x10c'));}return _0x4e8cff;}));_0x562985[_0x6fa8('0xae')](_0x51f4a1['getSmsQueues']()['then'](function(_0x4e4127){for(var _0x1d4183=0x0;_0x1d4183<_0x4e4127['length'];_0x1d4183++){_0x4e4127[_0x1d4183][_0x6fa8('0x109')](_0x6fa8('0xa1'),_0x6fa8('0x10d'));}return _0x4e4127;}));_0x562985[_0x6fa8('0xae')](_0x51f4a1['getWhatsappQueues']()[_0x6fa8('0x24')](function(_0x561367){for(var _0x483bc0=0x0;_0x483bc0<_0x561367[_0x6fa8('0x57')];_0x483bc0++){_0x561367[_0x483bc0][_0x6fa8('0x109')](_0x6fa8('0xa1'),_0x6fa8('0x10e'));}return _0x561367;}));_0x562985[_0x6fa8('0xae')](_0x51f4a1[_0x6fa8('0x10f')]()['then'](function(_0xd6a5f8){for(var _0x619824=0x0;_0x619824<_0xd6a5f8[_0x6fa8('0x57')];_0x619824++){_0xd6a5f8[_0x619824][_0x6fa8('0x109')]('channel',_0x6fa8('0x110'));}return _0xd6a5f8;}));_0x562985[_0x6fa8('0xae')](_0x51f4a1[_0x6fa8('0x111')]()[_0x6fa8('0x24')](function(_0x43f2cf){for(var _0x59fcb3=0x0;_0x59fcb3<_0x43f2cf[_0x6fa8('0x57')];_0x59fcb3++){_0x43f2cf[_0x59fcb3][_0x6fa8('0x109')](_0x6fa8('0xa1'),_0x6fa8('0x112'));}return _0x43f2cf;}));return BPromise[_0x6fa8('0xec')](_0x562985);})[_0x6fa8('0x24')](function(_0x23c50e){var _0x5b4550=_[_0x6fa8('0x113')](_0x23c50e);_0x562985=[];return db[_0x6fa8('0x61')]['transaction'](function(_0x33c1bc){for(var _0x44bc00=0x0;_0x44bc00<_0x5b4550['length'];_0x44bc00++){_0x562985[_0x6fa8('0xae')](_0x5b4550[_0x44bc00]['addAgent'](_0x26ca6c['id']),{'transaction':_0x33c1bc});}return BPromise['all'](_0x562985)['then'](function(){if(_0x26ca6c[_0x6fa8('0xa2')]){return BPromise[_0x6fa8('0xb1')](_[_0x6fa8('0x5e')](_0x5b4550,function(_0xc46fb1){return _0xc46fb1[_0x6fa8('0x114')](_0x6fa8('0xa1'))===_0x6fa8('0x115');}),function(_0xbfeea4){return db[_0x6fa8('0xb2')]['upsert']({'membername':_0x26ca6c[_0x6fa8('0x47')],'UserId':_0x26ca6c['id'],'queue_name':_0xbfeea4[_0x6fa8('0x47')],'VoiceQueueId':_0xbfeea4['id'],'interface':_[_0x6fa8('0x75')](_0x26ca6c[_0x6fa8('0xa4')])?util[_0x6fa8('0x77')]('SIP/%s',_0x26ca6c[_0x6fa8('0x47')]):_0x26ca6c[_0x6fa8('0xa4')],'paused':_0x26ca6c[_0x6fa8('0xb0')]||![],'penalty':_0x26ca6c['penalty']},{'transaction':_0x33c1bc});});}else{return;}})[_0x6fa8('0x24')](function(){for(var _0x5491e6=0x0;_0x5491e6<_0x5b4550[_0x6fa8('0x57')];_0x5491e6++){var _0x221bae=_0x5b4550[_0x5491e6][_0x6fa8('0x114')](_0x6fa8('0xa1'));var _0x266110=_0x221bae+'QueueId';socket[_0x6fa8('0xa9')](_0x6fa8('0x3e')+_0x221bae+_0x6fa8('0xab'),{'UserId':_0x26ca6c['id'],['queueField']:_0x5b4550[_0x5491e6]['id']});}});});});}});}})[_0x6fa8('0x24')](respondWithStatusCode(_0x4c0a32,null))[_0x6fa8('0x2e')](handleError(_0x4c0a32,null));};exports['removeTeams']=function(_0x570a1,_0x4438b2){return db[_0x6fa8('0x4c')][_0x6fa8('0x98')]({'where':{'id':_0x570a1[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x4438b2,null))[_0x6fa8('0x24')](function(_0x12abea){if(_0x12abea){var _0x12b2dc=_0x12abea['get']({'plain':!![]});var _0x1db83c=_0x570a1[_0x6fa8('0x51')]['ids'];return _0x12abea['removeTeams'](_0x1db83c)['then'](function(){for(var _0xa95b46=0x0;_0xa95b46<_0x1db83c[_0x6fa8('0x57')];_0xa95b46++){var _0x55da6a=[];db[_0x6fa8('0x105')][_0x6fa8('0x98')]({'where':{'id':_0x1db83c[_0xa95b46]}})['then'](function(_0x4a6578){_0x55da6a['push'](_0x4a6578[_0x6fa8('0x108')]()[_0x6fa8('0x24')](function(_0x47a6c1){for(var _0x2a4712=0x0;_0x2a4712<_0x47a6c1[_0x6fa8('0x57')];_0x2a4712++){_0x47a6c1[_0x2a4712][_0x6fa8('0x109')](_0x6fa8('0xa1'),'Voice');}return _0x47a6c1;}));_0x55da6a['push'](_0x4a6578[_0x6fa8('0x10a')]()[_0x6fa8('0x24')](function(_0x32d751){for(var _0x24104b=0x0;_0x24104b<_0x32d751['length'];_0x24104b++){_0x32d751[_0x24104b]['setDataValue']('channel',_0x6fa8('0x10b'));}return _0x32d751;}));_0x55da6a[_0x6fa8('0xae')](_0x4a6578[_0x6fa8('0x116')]()[_0x6fa8('0x24')](function(_0x3cb0c7){for(var _0x170b8f=0x0;_0x170b8f<_0x3cb0c7[_0x6fa8('0x57')];_0x170b8f++){_0x3cb0c7[_0x170b8f][_0x6fa8('0x109')](_0x6fa8('0xa1'),_0x6fa8('0x10c'));}return _0x3cb0c7;}));_0x55da6a['push'](_0x4a6578[_0x6fa8('0x117')]()['then'](function(_0x587f59){for(var _0x59713d=0x0;_0x59713d<_0x587f59[_0x6fa8('0x57')];_0x59713d++){_0x587f59[_0x59713d][_0x6fa8('0x109')]('channel','Sms');}return _0x587f59;}));_0x55da6a[_0x6fa8('0xae')](_0x4a6578[_0x6fa8('0x118')]()['then'](function(_0x34446d){for(var _0x3b1395=0x0;_0x3b1395<_0x34446d[_0x6fa8('0x57')];_0x3b1395++){_0x34446d[_0x3b1395]['setDataValue']('channel',_0x6fa8('0x10e'));}return _0x34446d;}));_0x55da6a['push'](_0x4a6578[_0x6fa8('0x10f')]()[_0x6fa8('0x24')](function(_0x195f56){for(var _0x2d6100=0x0;_0x2d6100<_0x195f56[_0x6fa8('0x57')];_0x2d6100++){_0x195f56[_0x2d6100][_0x6fa8('0x109')]('channel',_0x6fa8('0x110'));}return _0x195f56;}));_0x55da6a[_0x6fa8('0xae')](_0x4a6578[_0x6fa8('0x111')]()[_0x6fa8('0x24')](function(_0x4b42fa){for(var _0x22903d=0x0;_0x22903d<_0x4b42fa[_0x6fa8('0x57')];_0x22903d++){_0x4b42fa[_0x22903d]['setDataValue'](_0x6fa8('0xa1'),_0x6fa8('0x112'));}return _0x4b42fa;}));return BPromise['all'](_0x55da6a);})[_0x6fa8('0x24')](function(_0x42f969){var _0x30a9b9=_[_0x6fa8('0x113')](_0x42f969);_0x55da6a=[];return db['sequelize']['transaction'](function(_0x4aff8e){for(var _0x202cda=0x0;_0x202cda<_0x30a9b9[_0x6fa8('0x57')];_0x202cda++){_0x55da6a['push'](_0x30a9b9[_0x202cda]['removeAgent'](_0x12b2dc['id']),{'transaction':_0x4aff8e});}return BPromise[_0x6fa8('0xec')](_0x55da6a)[_0x6fa8('0x24')](function(){if(_0x12b2dc['online']){return BPromise[_0x6fa8('0xb1')](_[_0x6fa8('0x5e')](_0x30a9b9,function(_0x4716d6){return _0x4716d6[_0x6fa8('0x114')](_0x6fa8('0xa1'))==='Voice';}),function(_0x2827ce){return db[_0x6fa8('0xb2')]['destroy']({'where':{'VoiceQueueId':_0x2827ce['id'],'UserId':_0x12b2dc['id']},'transaction':_0x4aff8e});});}else{return;}})[_0x6fa8('0x24')](function(){for(var _0x52fa36=0x0;_0x52fa36<_0x30a9b9[_0x6fa8('0x57')];_0x52fa36++){var _0xf6abe4=_0x30a9b9[_0x52fa36][_0x6fa8('0x114')](_0x6fa8('0xa1'));var _0x285467=_0xf6abe4+'QueueId';socket['emit'](_0x6fa8('0x3e')+_0xf6abe4+_0x6fa8('0xb6'),{'UserId':_0x12b2dc['id'],['queueField']:_0x30a9b9[_0x52fa36]['id']});}});});});}});}})[_0x6fa8('0x24')](respondWithStatusCode(_0x4438b2,null))[_0x6fa8('0x2e')](handleError(_0x4438b2,null));};exports['getLists']=function(_0x349b42,_0x13d117,_0xa0a030){var _0x44ac8e={};var _0x5d145={};var _0x2e6fdb;var _0x523ce9;return db['User'][_0x6fa8('0x98')]({'where':{'id':_0x349b42[_0x6fa8('0x6c')]['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x13d117,null))[_0x6fa8('0x24')](function(_0xa54a56){if(_0xa54a56){_0x2e6fdb=_0xa54a56;_0x5d145['model']=_[_0x6fa8('0x67')](db['CmList']['rawAttributes']);_0x5d145[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x349b42[_0x6fa8('0x51')]);_0x5d145['filters']=_['intersection'](_0x5d145[_0x6fa8('0x54')],_0x5d145['query']);_0x44ac8e['attributes']=_['intersection'](_0x5d145[_0x6fa8('0x54')],qs['fields'](_0x349b42[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x44ac8e[_0x6fa8('0x55')]=_0x44ac8e[_0x6fa8('0x55')][_0x6fa8('0x57')]?_0x44ac8e[_0x6fa8('0x55')]:_0x5d145[_0x6fa8('0x54')];_0x44ac8e[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x349b42[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x44ac8e[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x349b42[_0x6fa8('0x51')],_0x5d145['filters']));if(_0x349b42[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x44ac8e[_0x6fa8('0x5c')]=_['merge'](_0x44ac8e[_0x6fa8('0x5c')],{'$or':_[_0x6fa8('0x42')](_0x44ac8e[_0x6fa8('0x55')],function(_0x343691){var _0xd6c3a7={};_0xd6c3a7[_0x343691]={'$like':'%'+_0x349b42[_0x6fa8('0x51')][_0x6fa8('0x5e')]+'%'};return _0xd6c3a7;})});}_0x44ac8e=_[_0x6fa8('0x5f')]({},_0x44ac8e,_0x349b42[_0x6fa8('0x69')]);return _0x2e6fdb['getLists'](_0x44ac8e);}})[_0x6fa8('0x24')](function(_0x49817a){if(_0x49817a){_0x523ce9=_0x49817a[_0x6fa8('0x57')];if(!_0x349b42[_0x6fa8('0x51')]['hasOwnProperty'](_0x6fa8('0x59'))){_0x44ac8e[_0x6fa8('0x5a')]=qs[_0x6fa8('0x5a')](_0x349b42[_0x6fa8('0x51')][_0x6fa8('0x5a')]);_0x44ac8e['offset']=qs[_0x6fa8('0x34')](_0x349b42[_0x6fa8('0x51')][_0x6fa8('0x34')]);}return _0x2e6fdb[_0x6fa8('0x119')](_0x44ac8e);}})[_0x6fa8('0x24')](function(_0x3381f5){if(_0x3381f5){return _0x3381f5?{'count':_0x523ce9,'rows':_0x3381f5}:null;}})['then'](respondWithResult(_0x13d117,null))[_0x6fa8('0x2e')](handleError(_0x13d117,null));};exports[_0x6fa8('0x11a')]=function(_0x42c4e0,_0x39f85b,_0x4107af){var _0x4f08a7={};var _0x49da92={};var _0x64d04d;var _0x44d8d7;return db[_0x6fa8('0x4c')]['findOne']({'where':{'id':_0x42c4e0['params']['id']}})[_0x6fa8('0x24')](handleEntityNotFound(_0x39f85b,null))['then'](function(_0x3d2c41){if(_0x3d2c41){_0x64d04d=_0x3d2c41;_0x49da92['model']=_['keys'](db[_0x6fa8('0x4c')]['rawAttributes']);_0x49da92[_0x6fa8('0x51')]=_[_0x6fa8('0x67')](_0x42c4e0['query']);_0x49da92[_0x6fa8('0x52')]=_[_0x6fa8('0x53')](_0x49da92[_0x6fa8('0x54')],_0x49da92[_0x6fa8('0x51')]);_0x4f08a7[_0x6fa8('0x55')]=_['intersection'](_0x49da92[_0x6fa8('0x54')],qs[_0x6fa8('0x56')](_0x42c4e0[_0x6fa8('0x51')][_0x6fa8('0x56')]));_0x4f08a7['attributes']=_0x4f08a7['attributes'][_0x6fa8('0x57')]?_0x4f08a7['attributes']:_0x49da92[_0x6fa8('0x54')];_0x4f08a7[_0x6fa8('0xc3')]=qs[_0x6fa8('0x5b')](_0x42c4e0[_0x6fa8('0x51')][_0x6fa8('0x5b')]);_0x4f08a7[_0x6fa8('0x5c')]=qs[_0x6fa8('0x52')](_[_0x6fa8('0x5d')](_0x42c4e0[_0x6fa8('0x51')],_0x49da92['filters']));if(_0x42c4e0[_0x6fa8('0x51')][_0x6fa8('0x5e')]){_0x4f08a7[_0x6fa8('0x5c')]=_[_0x6fa8('0x5f')](_0x4f08a7[_0x6fa8('0x5c')],{'$or':_['map'](_0x4f08a7[_0x6fa8('0x55')],function(_0x2d1966){var _0x3dc195={};_0x3dc195[_0x2d1966]={'$like':'%'+_0x42c4e0[_0x6fa8('0x51')][_0x6fa8('0x5e')]+'%'};return _0x3dc195;})});}_0x4f08a7[_0x6fa8('0x54')]=db[_0x6fa8('0x4c')];_0x4f08a7['as']=_0x6fa8('0x91');_0x4f08a7=_['merge']({},_0x4f08a7,_0x42c4e0[_0x6fa8('0x69')]);return _0x64d04d['getVoiceQueues']({'include':[_0x4f08a7]});}})[_0x6fa8('0x24')](function(_0x4e3d98){if(_0x4e3d98){var _0x144fd4={},_0x5a72e0=[],_0x12e096=0x0;for(var _0x549ef4=0x0;_0x549ef4<_0x4e3d98['length'];_0x549ef4+=0x1){for(var _0x570e52=0x0,_0x11dd29;_0x570e52<_0x4e3d98[_0x549ef4][_0x6fa8('0x91')][_0x6fa8('0x57')];_0x570e52+=0x1){_0x11dd29=_0x4e3d98[_0x549ef4]['Agents'][_0x570e52][_0x6fa8('0x3c')]({'plain':!![]});_0x144fd4[_0x11dd29['id']]=_0x11dd29;}}_0x144fd4=_['values'](_0x144fd4);for(var _0x5532b6=qs[_0x6fa8('0x34')](_0x42c4e0[_0x6fa8('0x51')][_0x6fa8('0x34')]);_0x5532b6<_0x144fd4[_0x6fa8('0x57')]&&_0x5a72e0[_0x6fa8('0x57')]=_0x26fbb4['agents']){throw new Error(_0x793d('0x4d'));}})['then'](function(){if(_0x41ba63){return db[_0x793d('0x3d')][_0x793d('0x44')]({'where':{'membername':_0x41ba63[_0x793d('0x2b')]},'individualHooks':!![]});}})['then'](function(){if(_0x41ba63){return _0x41ba63[_0x793d('0x4e')]({'raw':!![]});}})[_0x793d('0xf')](function(_0x1ca5a6){if(_0x41ba63){if(_0x1ca5a6){var _0x381c56=[];_0xfb7e90=_0x1ca5a6;if(_0xfb7e90['length']){for(var _0x216fa5=0x0;_0x216fa5<_0xfb7e90[_0x793d('0x2d')];_0x216fa5++){_0x381c56['push'](db[_0x793d('0x3d')][_0x793d('0x4f')]({'membername':_0x41ba63[_0x793d('0x2b')],'UserId':_0x41ba63['id'],'queue_name':_0xfb7e90[_0x216fa5][_0x793d('0x2b')],'VoiceQueueId':_0xfb7e90[_0x216fa5]['id'],'interface':_0x3a1c87,'paused':_0x41ba63['loginInPause']||![],'penalty':_0xfb7e90[_0x216fa5][_0x793d('0x50')]||0x0}));}return BPromise[_0x793d('0x43')](_0x381c56);}}}})['then'](function(){if(_0x41ba63){return db[_0x793d('0x2a')][_0x793d('0x1b')]({'where':{'membername':_0x41ba63[_0x793d('0x2b')],'exitAt':null}});}})['then'](function(_0x29b573){if(_0x41ba63){if(_0x29b573&&_0x29b573[_0x793d('0x2d')]){var _0x2b60e3=[];_0x29b573['forEach'](function(_0x1c3ef1){_0x2b60e3[_0x793d('0x32')](_0x1c3ef1[_0x793d('0x29')]({'exitAt':moment()['format'](_0x793d('0x2f'))}));});return BPromise['all'](_0x2b60e3);}}})['then'](function(_0x54ae0c){if(_0x41ba63){var _0x1acf91=[];var _0x4f1b75=[];var _0x106398=utils[_0x793d('0x30')]();var _0x2a6853={'membername':_0x41ba63[_0x793d('0x2b')],'interface':_0x3a1c87,'enterAt':moment()[_0x793d('0x2e')](_0x793d('0x2f')),'role':_0x41ba63[_0x793d('0x26')],'internal':_0x41ba63[_0x793d('0x27')]};_0x106398['forEach'](function(_0x242973){_0x1acf91[_0x793d('0x32')](_[_0x793d('0x51')]({'channel':_0x242973,'type':_0x793d('0x52'),'data1':_0x793d('0x53'),'data2':_0x3a1c87},_0x2a6853));if(_0x41ba63[_0x793d('0x49')]){_0x4f1b75[_0x793d('0x32')](_[_0x793d('0x51')]({'channel':_0x242973,'type':_0x793d('0x2c'),'data1':_0x793d('0x54')},_0x2a6853));}});return db[_0x793d('0x2a')]['bulkCreate'](_0x1acf91['concat'](_0x4f1b75),{'individualHooks':!![]});}})['then'](function(){if(_0x41ba63){return _0x41ba63[_0x793d('0x29')]({'online':!![],'lastLoginAt':moment()[_0x793d('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x41ba63[_0x793d('0x49')]||![],'mailPause':_0x41ba63[_0x793d('0x49')]||![],'chatPause':_0x41ba63[_0x793d('0x49')]||![],'faxPause':_0x41ba63[_0x793d('0x49')]||![],'smsPause':_0x41ba63[_0x793d('0x49')]||![],'openchannelPause':_0x41ba63[_0x793d('0x49')]||![],'pauseType':_0x41ba63[_0x793d('0x49')]?_0x793d('0x54'):null,'lastPauseAt':moment()[_0x793d('0x2e')](_0x793d('0x2f')),'interface':_0x3a1c87});}})[_0x793d('0xf')](function(_0x2e3b54){_0x39726b(_0x2e3b54);})[_0x793d('0x18')](function(_0x5e7d56){_0x2ad616(_0x51eb30[_0x793d('0x14')](0x1f4,_0x5e7d56[_0x793d('0x16')]));});});}; \ No newline at end of file +var _0x3382=['count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','include','map','model','then','ShowUser','find','PauseUser','name','role','internal','interface','update','MemberReport','PAUSE','length','format','updateAttributes','forEach','push','isNil','SIP/%s','body','uniqueid','bulkCreate','type','DEFAULT\x20PAUSE','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','chat','fax','sms','openchannel','set','%s%s','UserVoiceQueueRt','LogoutUser','all','LoginUser','mobile','loginInPause'];(function(_0x45bc3f,_0x234416){var _0x530329=function(_0x4c2442){while(--_0x4c2442){_0x45bc3f['push'](_0x45bc3f['shift']());}};_0x530329(++_0x234416);}(_0x3382,0x123));var _0x2338=function(_0x2db588,_0x915f86){_0x2db588=_0x2db588-0x0;var _0x2235d0=_0x3382[_0x2db588];return _0x2235d0;};'use strict';var _=require('lodash');var util=require(_0x2338('0x0'));var moment=require(_0x2338('0x1'));var BPromise=require(_0x2338('0x2'));var rs=require(_0x2338('0x3'));var fs=require('fs');var Redis=require(_0x2338('0x4'));var db=require(_0x2338('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2338('0x6'))(_0x2338('0x7'));var config=require('../../config/environment');var jayson=require(_0x2338('0x8'));var client=jayson['client'][_0x2338('0x9')]({'port':0x232a});config[_0x2338('0xa')]=_[_0x2338('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2338('0xc'))(new Redis(config[_0x2338('0xa')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x5c8d1a,_0x23c5b9,_0x553cb3){return new BPromise(function(_0x354a5d,_0x1066d8){return client['request'](_0x5c8d1a,_0x553cb3)['then'](function(_0x198c69){logger[_0x2338('0xd')](_0x2338('0xe'),_0x23c5b9,_0x2338('0xf'));logger[_0x2338('0x10')](_0x2338('0x11'),_0x23c5b9,'request\x20sent',JSON[_0x2338('0x12')](_0x198c69));if(_0x198c69[_0x2338('0x13')]){if(_0x198c69[_0x2338('0x13')][_0x2338('0x14')]===0x1f4){logger['error'](_0x2338('0xe'),_0x23c5b9,_0x198c69['error'][_0x2338('0x15')]);return _0x1066d8(_0x198c69['error']['message']);}logger['error'](_0x2338('0xe'),_0x23c5b9,_0x198c69[_0x2338('0x13')][_0x2338('0x15')]);return _0x354a5d(_0x198c69[_0x2338('0x13')][_0x2338('0x15')]);}else{logger[_0x2338('0xd')]('User,\x20%s,\x20%s',_0x23c5b9,'request\x20sent');_0x354a5d(_0x198c69[_0x2338('0x16')][_0x2338('0x15')]);}})[_0x2338('0x17')](function(_0x3f0691){logger[_0x2338('0x13')]('User,\x20%s,\x20%s',_0x23c5b9,_0x3f0691);_0x1066d8(_0x3f0691);});});}exports[_0x2338('0x18')]=function(_0x565e25){var _0x50d960=this;return new Promise(function(_0xadf2a2,_0x32a2c4){return db[_0x2338('0x19')][_0x2338('0x1a')]({'raw':_0x565e25[_0x2338('0x1b')]?_0x565e25[_0x2338('0x1b')][_0x2338('0x1c')]===undefined?!![]:![]:!![],'where':_0x565e25['options']?_0x565e25[_0x2338('0x1b')][_0x2338('0x1d')]||null:null,'attributes':_0x565e25[_0x2338('0x1b')]?_0x565e25[_0x2338('0x1b')][_0x2338('0x1e')]||null:null,'limit':_0x565e25[_0x2338('0x1b')]?_0x565e25[_0x2338('0x1b')]['limit']||null:null,'include':_0x565e25[_0x2338('0x1b')]?_0x565e25['options'][_0x2338('0x1f')]?_[_0x2338('0x20')](_0x565e25['options'][_0x2338('0x1f')],function(_0x49ad3b){return{'model':db[_0x49ad3b[_0x2338('0x21')]],'as':_0x49ad3b['as'],'attributes':_0x49ad3b[_0x2338('0x1e')],'include':_0x49ad3b['include']?_[_0x2338('0x20')](_0x49ad3b[_0x2338('0x1f')],function(_0x404df6){return{'model':db[_0x404df6['model']],'as':_0x404df6['as'],'attributes':_0x404df6[_0x2338('0x1e')],'include':_0x404df6[_0x2338('0x1f')]?_[_0x2338('0x20')](_0x404df6[_0x2338('0x1f')],function(_0x2dfdff){return{'model':db[_0x2dfdff[_0x2338('0x21')]],'as':_0x2dfdff['as'],'attributes':_0x2dfdff['attributes']};}):[]};}):[]};}):[]:[]})[_0x2338('0x22')](function(_0x80e588){logger['info'](_0x2338('0x18'),_0x565e25);logger[_0x2338('0x10')](_0x2338('0x18'),_0x565e25,JSON[_0x2338('0x12')](_0x80e588));_0xadf2a2(_0x80e588);})['catch'](function(_0x1246a3){logger[_0x2338('0x13')](_0x2338('0x18'),_0x1246a3[_0x2338('0x15')],_0x565e25);_0x32a2c4(_0x50d960[_0x2338('0x13')](0x1f4,_0x1246a3[_0x2338('0x15')]));});});};exports[_0x2338('0x23')]=function(_0x580592){var _0x3aef12=this;return new Promise(function(_0x2f9de1,_0x704527){return db[_0x2338('0x19')][_0x2338('0x24')]({'raw':_0x580592[_0x2338('0x1b')]?_0x580592[_0x2338('0x1b')][_0x2338('0x1c')]===undefined?!![]:![]:!![],'where':_0x580592[_0x2338('0x1b')]?_0x580592['options']['where']||null:null,'attributes':_0x580592[_0x2338('0x1b')]?_0x580592[_0x2338('0x1b')]['attributes']||null:null,'include':_0x580592[_0x2338('0x1b')]?_0x580592[_0x2338('0x1b')][_0x2338('0x1f')]?_['map'](_0x580592[_0x2338('0x1b')][_0x2338('0x1f')],function(_0x149699){return{'model':db[_0x149699['model']],'as':_0x149699['as'],'attributes':_0x149699[_0x2338('0x1e')],'include':_0x149699[_0x2338('0x1f')]?_[_0x2338('0x20')](_0x149699[_0x2338('0x1f')],function(_0x1d6bde){return{'model':db[_0x1d6bde[_0x2338('0x21')]],'as':_0x1d6bde['as'],'attributes':_0x1d6bde[_0x2338('0x1e')],'include':_0x1d6bde[_0x2338('0x1f')]?_[_0x2338('0x20')](_0x1d6bde[_0x2338('0x1f')],function(_0x3af303){return{'model':db[_0x3af303[_0x2338('0x21')]],'as':_0x3af303['as'],'attributes':_0x3af303[_0x2338('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x328094){logger[_0x2338('0xd')](_0x2338('0x23'),_0x580592);logger[_0x2338('0x10')]('ShowUser',_0x580592,JSON[_0x2338('0x12')](_0x328094));_0x2f9de1(_0x328094);})[_0x2338('0x17')](function(_0x35565e){logger[_0x2338('0x13')]('ShowUser',_0x35565e[_0x2338('0x15')],_0x580592);_0x704527(_0x3aef12[_0x2338('0x13')](0x1f4,_0x35565e['message']));});});};exports[_0x2338('0x25')]=function(_0x12f22b){var _0x4aef03=this;return new Promise(function(_0x561362,_0x3672ef){var _0x401717;return db[_0x2338('0x19')]['find']({'where':_0x12f22b['options']['where']||{},'attributes':['id',_0x2338('0x26'),_0x2338('0x27'),_0x2338('0x28'),_0x2338('0x29')]})[_0x2338('0x22')](function(_0x2c2596){if(_0x2c2596){_0x401717=_0x2c2596;return db['UserVoiceQueueRt'][_0x2338('0x2a')]({'paused':0x1},{'where':{'UserId':_0x401717['id']},'individualHooks':!![]});}})['then'](function(){if(_0x401717){return db[_0x2338('0x2b')]['findAll']({'where':{'membername':_0x401717[_0x2338('0x26')],'type':_0x2338('0x2c'),'exitAt':null}});}})[_0x2338('0x22')](function(_0x617f12){if(_0x401717){if(_0x617f12&&_0x617f12[_0x2338('0x2d')]){var _0x3a7c79=moment()[_0x2338('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xc3ba1a=0x0,_0x4b34a4=_0x617f12['length'];_0xc3ba1a<_0x4b34a4;_0xc3ba1a++){_0x617f12[_0xc3ba1a][_0x2338('0x2f')]({'exitAt':_0x3a7c79});}}}})['then'](function(){if(_0x401717){var _0x1d3b17=[];var _0x15f995=utils['getChannels']();_0x15f995[_0x2338('0x30')](function(_0x1343d1){_0x1d3b17[_0x2338('0x31')]({'channel':_0x1343d1,'membername':_0x401717[_0x2338('0x26')],'interface':_[_0x2338('0x32')](_0x401717[_0x2338('0x29')])?util[_0x2338('0x2e')](_0x2338('0x33'),_0x401717[_0x2338('0x26')]):_0x401717[_0x2338('0x29')],'type':_0x2338('0x2c'),'enterAt':moment()[_0x2338('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x12f22b[_0x2338('0x34')]['type']||'DEFAULT\x20PAUSE','role':_0x401717[_0x2338('0x27')],'internal':_0x401717[_0x2338('0x28')],'uniqueid':_0x12f22b[_0x2338('0x34')][_0x2338('0x35')]||null});});return db[_0x2338('0x2b')][_0x2338('0x36')](_0x1d3b17,{'individualHooks':!![]});}})[_0x2338('0x22')](function(){if(_0x401717){return _0x401717[_0x2338('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x12f22b[_0x2338('0x34')][_0x2338('0x37')]||_0x2338('0x38'),'lastPauseAt':moment()['format'](_0x2338('0x39'))});}})[_0x2338('0x22')](function(_0x5f5621){_0x561362(_0x5f5621);})['catch'](function(_0x37e037){_0x3672ef(_0x4aef03[_0x2338('0x13')](0x1f4,_0x37e037[_0x2338('0x15')]));});});};exports[_0x2338('0x3a')]=function(_0x3b8b5a){var _0xef4a3e=this;return new Promise(function(_0x36a3d8,_0x430453){var _0x437d86;return db[_0x2338('0x19')][_0x2338('0x3b')]({'where':_0x3b8b5a[_0x2338('0x1b')]['where']||{},'attributes':['id',_0x2338('0x26')]})['then'](function(_0x38c5de){if(_0x38c5de){_0x437d86=_0x38c5de;if(_0x3b8b5a['body'][_0x2338('0x3c')]&&!utils[_0x2338('0x3d')](_0x3b8b5a['body'][_0x2338('0x3c')])){throw new Error(_0x2338('0x3e'));}switch(_0x3b8b5a[_0x2338('0x34')]['channel']){case _0x2338('0x3f'):return db['UserVoiceQueueRt'][_0x2338('0x2a')]({'paused':0x0},{'where':{'UserId':_0x437d86['id']}})[_0x2338('0x22')](function(){return db[_0x2338('0x2b')]['find']({'where':{'channel':_0x3b8b5a['body'][_0x2338('0x3c')],'membername':_0x437d86[_0x2338('0x26')],'type':_0x2338('0x2c'),'exitAt':null}});})[_0x2338('0x22')](function(_0x13ebba){if(_0x13ebba){return _0x13ebba['update']({'exitAt':moment()[_0x2338('0x2e')](_0x2338('0x39')),'data2':_0x2338('0x40')},{'individualHooks':!![]});}return null;})[_0x2338('0x22')](function(){return _0x437d86[_0x2338('0x2a')]({'voicePause':![]});});case'mail':case _0x2338('0x41'):case _0x2338('0x42'):case _0x2338('0x43'):case _0x2338('0x44'):return db[_0x2338('0x2b')][_0x2338('0x24')]({'where':{'channel':_0x3b8b5a[_0x2338('0x34')]['channel'],'membername':_0x437d86[_0x2338('0x26')],'type':_0x2338('0x2c'),'exitAt':null}})[_0x2338('0x22')](function(_0x4d0784){return _0x4d0784['update']({'exitAt':moment()[_0x2338('0x2e')](_0x2338('0x39')),'data2':'system'},{'individualHooks':!![]});})[_0x2338('0x22')](function(){var _0x39ce2f={};_[_0x2338('0x45')](_0x39ce2f,util['format'](_0x2338('0x46'),_0x3b8b5a[_0x2338('0x34')][_0x2338('0x3c')],'Pause'),![]);return _0x437d86[_0x2338('0x2a')](_0x39ce2f);});default:return db[_0x2338('0x47')][_0x2338('0x2a')]({'paused':0x0},{'where':{'UserId':_0x437d86['id']}})[_0x2338('0x22')](function(){return db[_0x2338('0x2b')][_0x2338('0x1a')]({'where':{'membername':_0x437d86[_0x2338('0x26')],'type':_0x2338('0x2c'),'exitAt':null}});})[_0x2338('0x22')](function(_0x4fa77b){var _0x26f408=[];_0x4fa77b[_0x2338('0x30')](function(_0x25db82){_0x26f408[_0x2338('0x31')](_0x25db82['update']({'exitAt':moment()[_0x2338('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2338('0x40')}));});return BPromise['all'](_0x26f408);})[_0x2338('0x22')](function(){return _0x437d86['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x2338('0x22')](function(_0x1fcda8){_0x36a3d8(_0x1fcda8);})['catch'](function(_0x4fc4ac){_0x430453(_0xef4a3e[_0x2338('0x13')](0x1f4,_0x4fc4ac['message']));});});};exports[_0x2338('0x48')]=function(_0x581529){var _0x46856f=this;return new Promise(function(_0xebcda,_0x45e47d){var _0x6dd36f;return db['User'][_0x2338('0x3b')]({'where':_0x581529[_0x2338('0x1b')][_0x2338('0x1d')]||{},'attributes':['id','name']})[_0x2338('0x22')](function(_0x287d15){if(_0x287d15){_0x6dd36f=_0x287d15;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x6dd36f[_0x2338('0x26')]},'individualHooks':!![]});}})[_0x2338('0x22')](function(){if(_0x6dd36f){return db['MemberReport'][_0x2338('0x1a')]({'where':{'membername':_0x6dd36f[_0x2338('0x26')],'exitAt':null}});}})['then'](function(_0x407252){if(_0x6dd36f){if(_0x407252&&_0x407252[_0x2338('0x2d')]){var _0x13ee83=[];_0x407252['forEach'](function(_0x3fc659){_0x13ee83[_0x2338('0x31')](_0x3fc659[_0x2338('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2338('0x49')](_0x13ee83);}}})['then'](function(){if(_0x6dd36f){return _0x6dd36f[_0x2338('0x2a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2338('0x22')](function(_0x3d331f){_0xebcda(_0x3d331f);})['catch'](function(_0x182614){_0x45e47d(_0x46856f[_0x2338('0x13')](0x1f4,_0x182614[_0x2338('0x15')]));});});};exports[_0x2338('0x4a')]=function(_0x40646c){var _0xd2a47e=this;return new Promise(function(_0x5b6c78,_0x4f9b6b){var _0xc03f44;var _0x3ab5ec;var _0x3a23ca;var _0x8b54f2;return db[_0x2338('0x19')]['findOne']({'where':_0x40646c[_0x2338('0x1b')][_0x2338('0x1d')]||{},'attributes':['id',_0x2338('0x26'),_0x2338('0x27'),_0x2338('0x4b'),'phone','internal',_0x2338('0x4c'),_0x2338('0x29')]})[_0x2338('0x22')](function(_0xd7932c){if(_0xd7932c){_0xc03f44=_0xd7932c;_0x8b54f2=_0x40646c[_0x2338('0x34')][_0x2338('0x29')]?_0x40646c[_0x2338('0x34')][_0x2338('0x29')]:util[_0x2338('0x2e')](_0x2338('0x33'),_0xc03f44[_0x2338('0x26')]);return db[_0x2338('0x19')][_0x2338('0x4d')]({'where':{'role':_0x2338('0x4e'),'online':!![],'id':{'$ne':_0xc03f44['id']}}});}})[_0x2338('0x22')](function(_0xf47090){if(_0xf47090){_0x3a23ca=_0xf47090;return require(_0x2338('0x4f'))[_0x2338('0x50')]();}})[_0x2338('0x22')](function(_0x2a1317){if(_0x2a1317&&_0x2a1317[_0x2338('0x51')]&&_0x3a23ca>=_0x2a1317['agents']){throw new Error(_0x2338('0x52'));}})[_0x2338('0x22')](function(){if(_0xc03f44){return db[_0x2338('0x47')][_0x2338('0x53')]({'where':{'membername':_0xc03f44[_0x2338('0x26')]},'individualHooks':!![]});}})[_0x2338('0x22')](function(){if(_0xc03f44){return _0xc03f44[_0x2338('0x54')]({'raw':!![]});}})[_0x2338('0x22')](function(_0x271942){if(_0xc03f44){if(_0x271942){var _0x5c144d=[];_0x3ab5ec=_0x271942;if(_0x3ab5ec[_0x2338('0x2d')]){for(var _0x3cd5fc=0x0;_0x3cd5fc<_0x3ab5ec[_0x2338('0x2d')];_0x3cd5fc++){_0x5c144d[_0x2338('0x31')](db[_0x2338('0x47')][_0x2338('0x55')]({'membername':_0xc03f44[_0x2338('0x26')],'UserId':_0xc03f44['id'],'queue_name':_0x3ab5ec[_0x3cd5fc]['name'],'VoiceQueueId':_0x3ab5ec[_0x3cd5fc]['id'],'interface':_0x8b54f2,'paused':_0xc03f44[_0x2338('0x4c')]||![],'penalty':_0x3ab5ec[_0x3cd5fc][_0x2338('0x56')]||0x0}));}return BPromise[_0x2338('0x49')](_0x5c144d);}}}})['then'](function(){if(_0xc03f44){return db[_0x2338('0x2b')][_0x2338('0x1a')]({'where':{'membername':_0xc03f44[_0x2338('0x26')],'exitAt':null}});}})[_0x2338('0x22')](function(_0x4aa270){if(_0xc03f44){if(_0x4aa270&&_0x4aa270[_0x2338('0x2d')]){var _0x321dde=[];_0x4aa270[_0x2338('0x30')](function(_0x596a50){_0x321dde[_0x2338('0x31')](_0x596a50[_0x2338('0x2a')]({'exitAt':moment()[_0x2338('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x321dde);}}})['then'](function(_0xd34959){if(_0xc03f44){var _0x4bdf5f=[];var _0x498ba2=[];var _0x19ba65=utils[_0x2338('0x57')]();var _0x147832={'membername':_0xc03f44[_0x2338('0x26')],'interface':_0x8b54f2,'enterAt':moment()[_0x2338('0x2e')](_0x2338('0x39')),'role':_0xc03f44[_0x2338('0x27')],'internal':_0xc03f44[_0x2338('0x28')]};_0x19ba65[_0x2338('0x30')](function(_0xc6fb65){_0x4bdf5f[_0x2338('0x31')](_[_0x2338('0x58')]({'channel':_0xc6fb65,'type':_0x2338('0x59'),'data1':_0x2338('0x5a'),'data2':_0x8b54f2},_0x147832));if(_0xc03f44[_0x2338('0x4c')]){_0x498ba2[_0x2338('0x31')](_[_0x2338('0x58')]({'channel':_0xc6fb65,'type':_0x2338('0x2c'),'data1':_0x2338('0x5b')},_0x147832));}});return db[_0x2338('0x2b')][_0x2338('0x36')](_0x4bdf5f['concat'](_0x498ba2),{'individualHooks':!![]});}})[_0x2338('0x22')](function(){if(_0xc03f44){return _0xc03f44[_0x2338('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x2338('0x39')),'voicePause':_0xc03f44[_0x2338('0x4c')]||![],'mailPause':_0xc03f44[_0x2338('0x4c')]||![],'chatPause':_0xc03f44['loginInPause']||![],'faxPause':_0xc03f44[_0x2338('0x4c')]||![],'smsPause':_0xc03f44[_0x2338('0x4c')]||![],'openchannelPause':_0xc03f44['loginInPause']||![],'pauseType':_0xc03f44[_0x2338('0x4c')]?_0x2338('0x5b'):null,'lastPauseAt':moment()[_0x2338('0x2e')](_0x2338('0x39')),'interface':_0x8b54f2});}})['then'](function(_0x4fcbeb){_0x5b6c78(_0x4fcbeb);})[_0x2338('0x17')](function(_0x28acde){_0x4f9b6b(_0xd2a47e[_0x2338('0x13')](0x1f4,_0x28acde[_0x2338('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e101cab..c7904d8 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 _0xbc57=['user:','save','remove','update','emit','removeListener','register'];(function(_0x389a61,_0x1249d7){var _0x26995a=function(_0x2091c5){while(--_0x2091c5){_0x389a61['push'](_0x389a61['shift']());}};_0x26995a(++_0x1249d7);}(_0xbc57,0x112));var _0x7bc5=function(_0x1db6e1,_0x79416c){_0x1db6e1=_0x1db6e1-0x0;var _0x262d7c=_0xbc57[_0x1db6e1];return _0x262d7c;};'use strict';var UserEvents=require('./user.events');var events=[_0x7bc5('0x0'),_0x7bc5('0x1'),_0x7bc5('0x2')];function createListener(_0x50423d,_0x391780){return function(_0x5e3567){_0x391780[_0x7bc5('0x3')](_0x50423d,_0x5e3567);};}function removeListener(_0x2ef148,_0x175c52){return function(){UserEvents[_0x7bc5('0x4')](_0x2ef148,_0x175c52);};}exports[_0x7bc5('0x5')]=function(_0x5e00f4){for(var _0x18e202=0x0,_0x4ca047=events['length'];_0x18e202<_0x4ca047;_0x18e202++){var _0x311cd4=events[_0x18e202];var _0x4572d8=createListener(_0x7bc5('0x6')+_0x311cd4,_0x5e00f4);UserEvents['on'](_0x311cd4,_0x4572d8);}}; \ No newline at end of file +var _0x19c2=['remove','update','removeListener','register','length','user:','./user.events','save'];(function(_0x4b76fe,_0x42045b){var _0x305149=function(_0x2f8de3){while(--_0x2f8de3){_0x4b76fe['push'](_0x4b76fe['shift']());}};_0x305149(++_0x42045b);}(_0x19c2,0x196));var _0x219c=function(_0x197115,_0x14d69a){_0x197115=_0x197115-0x0;var _0x19d830=_0x19c2[_0x197115];return _0x19d830;};'use strict';var UserEvents=require(_0x219c('0x0'));var events=[_0x219c('0x1'),_0x219c('0x2'),_0x219c('0x3')];function createListener(_0x23b6af,_0x388c0a){return function(_0x1cf166){_0x388c0a['emit'](_0x23b6af,_0x1cf166);};}function removeListener(_0x525356,_0x1d0803){return function(){UserEvents[_0x219c('0x4')](_0x525356,_0x1d0803);};}exports[_0x219c('0x5')]=function(_0x5e4631){for(var _0x241a4c=0x0,_0x2d2924=events[_0x219c('0x6')];_0x241a4c<_0x2d2924;_0x241a4c++){var _0x59e260=events[_0x241a4c];var _0x35a962=createListener(_0x219c('0x7')+_0x59e260,_0x5e4631);UserEvents['on'](_0x59e260,_0x35a962);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2f23919..2ce46e1 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 _0xda1e=['exports','multer','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);}(_0xda1e,0xeb));var _0xeda1=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0xda1e[_0x15b380];return _0x232c5c;};'use strict';var multer=require(_0xeda1('0x0'));var util=require('util');var path=require(_0xeda1('0x1'));var timeout=require(_0xeda1('0x2'));var express=require(_0xeda1('0x3'));var router=express[_0xeda1('0x4')]();var auth=require(_0xeda1('0x5'));var interaction=require(_0xeda1('0x6'));var config=require(_0xeda1('0x7'));module[_0xeda1('0x8')]=router; \ No newline at end of file +var _0x6bfd=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x3cadc3,_0x342f8e){var _0xa50836=function(_0x4be68e){while(--_0x4be68e){_0x3cadc3['push'](_0x3cadc3['shift']());}};_0xa50836(++_0x342f8e);}(_0x6bfd,0xd0));var _0xd6bf=function(_0x1ddb21,_0x2c3404){_0x1ddb21=_0x1ddb21-0x0;var _0x547a7a=_0x6bfd[_0x1ddb21];return _0x547a7a;};'use strict';var multer=require(_0xd6bf('0x0'));var util=require(_0xd6bf('0x1'));var path=require(_0xd6bf('0x2'));var timeout=require('connect-timeout');var express=require(_0xd6bf('0x3'));var router=express[_0xd6bf('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd6bf('0x5'));var config=require(_0xd6bf('0x6'));module[_0xd6bf('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 04cc4cc..9ed083e 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x329808,_0x343255){var _0x1bbad0=function(_0x458c5b){while(--_0x458c5b){_0x329808['push'](_0x329808['shift']());}};_0x1bbad0(++_0x343255);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2a165c,_0x51ef64){var _0x2f12e8=function(_0x477b58){while(--_0x477b58){_0x2a165c['push'](_0x2a165c['shift']());}};_0x2f12e8(++_0x51ef64);}(_0xe706,0xa3));var _0x6e70=function(_0x372590,_0x1ebb65){_0x372590=_0x372590-0x0;var _0x21abe6=_0xe706[_0x372590];return _0x21abe6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 4a6f1c8..3ac1ff4 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 _0x1de4=['UserChatQueue','user_has_chat_queues','lodash','util','moment','request-promise','rimraf','./userChatQueue.attributes','exports','define'];(function(_0x18dcca,_0x3b827f){var _0x4db861=function(_0x679aaa){while(--_0x679aaa){_0x18dcca['push'](_0x18dcca['shift']());}};_0x4db861(++_0x3b827f);}(_0x1de4,0x174));var _0x41de=function(_0x534e9c,_0x521703){_0x534e9c=_0x534e9c-0x0;var _0x53192f=_0x1de4[_0x534e9c];return _0x53192f;};'use strict';var _=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x41de('0x2'));var BPromise=require('bluebird');var rp=require(_0x41de('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41de('0x4'));var config=require('../../config/environment');var attributes=require(_0x41de('0x5'));module[_0x41de('0x6')]=function(_0x172dff,_0x282ed7){return _0x172dff[_0x41de('0x7')](_0x41de('0x8'),attributes,{'tableName':_0x41de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb582=['../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x5b9f73,_0x1acbca){var _0x514731=function(_0x2673e3){while(--_0x2673e3){_0x5b9f73['push'](_0x5b9f73['shift']());}};_0x514731(++_0x1acbca);}(_0xb582,0xe1));var _0x2b58=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb582[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x2b58('0x0'));var util=require(_0x2b58('0x1'));var logger=require(_0x2b58('0x2'))(_0x2b58('0x3'));var moment=require('moment');var BPromise=require(_0x2b58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b58('0x5'));var attributes=require(_0x2b58('0x6'));module['exports']=function(_0xb15b59,_0x449724){return _0xb15b59[_0x2b58('0x7')](_0x2b58('0x8'),attributes,{'tableName':_0x2b58('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 299e651..d21d968 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 _0x8921=['debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2d64fc,_0x42b2a7){var _0x2c8556=function(_0x4b29da){while(--_0x4b29da){_0x2d64fc['push'](_0x2d64fc['shift']());}};_0x2c8556(++_0x42b2a7);}(_0x8921,0x7f));var _0x1892=function(_0x11fb2f,_0x497eb9){_0x11fb2f=_0x11fb2f-0x0;var _0x1f4f17=_0x8921[_0x11fb2f];return _0x1f4f17;};'use strict';var _=require(_0x1892('0x0'));var util=require(_0x1892('0x1'));var moment=require(_0x1892('0x2'));var BPromise=require(_0x1892('0x3'));var rs=require(_0x1892('0x4'));var fs=require('fs');var Redis=require(_0x1892('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1892('0x6'));var logger=require(_0x1892('0x7'))(_0x1892('0x8'));var config=require(_0x1892('0x9'));var jayson=require(_0x1892('0xa'));var client=jayson[_0x1892('0xb')][_0x1892('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x526423,_0x316bb2,_0x3d995a){return new BPromise(function(_0x233afc,_0x384980){return client[_0x1892('0xd')](_0x526423,_0x3d995a)[_0x1892('0xe')](function(_0x18e9bc){logger['info'](_0x1892('0xf'),_0x316bb2,_0x1892('0x10'));logger[_0x1892('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x316bb2,'request\x20sent',JSON[_0x1892('0x12')](_0x18e9bc));if(_0x18e9bc[_0x1892('0x13')]){if(_0x18e9bc[_0x1892('0x13')]['code']===0x1f4){logger[_0x1892('0x13')](_0x1892('0xf'),_0x316bb2,_0x18e9bc[_0x1892('0x13')]['message']);return _0x384980(_0x18e9bc[_0x1892('0x13')][_0x1892('0x14')]);}logger[_0x1892('0x13')](_0x1892('0xf'),_0x316bb2,_0x18e9bc[_0x1892('0x13')]['message']);return _0x233afc(_0x18e9bc[_0x1892('0x13')][_0x1892('0x14')]);}else{logger[_0x1892('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x316bb2,'request\x20sent');_0x233afc(_0x18e9bc[_0x1892('0x16')][_0x1892('0x14')]);}})[_0x1892('0x17')](function(_0x3cf800){logger[_0x1892('0x13')](_0x1892('0xf'),_0x316bb2,_0x3cf800);_0x384980(_0x3cf800);});});} \ No newline at end of file +var _0xaacc=['../../config/logger','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5ee1ab,_0x2ea883){var _0x35106a=function(_0x3f3e57){while(--_0x3f3e57){_0x5ee1ab['push'](_0x5ee1ab['shift']());}};_0x35106a(++_0x2ea883);}(_0xaacc,0x1ef));var _0xcaac=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xaacc[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0xcaac('0x0'));var moment=require(_0xcaac('0x1'));var BPromise=require(_0xcaac('0x2'));var rs=require(_0xcaac('0x3'));var fs=require('fs');var Redis=require(_0xcaac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcaac('0x5'))('rpc');var config=require(_0xcaac('0x6'));var jayson=require(_0xcaac('0x7'));var client=jayson[_0xcaac('0x8')][_0xcaac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37b2f3,_0x3de43f,_0x105746){return new BPromise(function(_0x363628,_0x4ad687){return client['request'](_0x37b2f3,_0x105746)['then'](function(_0x133a9d){logger[_0xcaac('0xa')](_0xcaac('0xb'),_0x3de43f,'request\x20sent');logger[_0xcaac('0xc')](_0xcaac('0xd'),_0x3de43f,_0xcaac('0xe'),JSON[_0xcaac('0xf')](_0x133a9d));if(_0x133a9d[_0xcaac('0x10')]){if(_0x133a9d[_0xcaac('0x10')]['code']===0x1f4){logger['error'](_0xcaac('0xb'),_0x3de43f,_0x133a9d[_0xcaac('0x10')][_0xcaac('0x11')]);return _0x4ad687(_0x133a9d['error']['message']);}logger[_0xcaac('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x3de43f,_0x133a9d['error'][_0xcaac('0x11')]);return _0x363628(_0x133a9d[_0xcaac('0x10')][_0xcaac('0x11')]);}else{logger['info'](_0xcaac('0xb'),_0x3de43f,_0xcaac('0xe'));_0x363628(_0x133a9d[_0xcaac('0x12')][_0xcaac('0x11')]);}})[_0xcaac('0x13')](function(_0x1e9e10){logger[_0xcaac('0x10')](_0xcaac('0xb'),_0x3de43f,_0x1e9e10);_0x4ad687(_0x1e9e10);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0fed70d..0fc1593 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 _0x5245=['Router','../../components/auth/service','../../components/interaction/service','exports','path','express'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5245,0x100));var _0x5524=function(_0x33c98e,_0x4eb3d0){_0x33c98e=_0x33c98e-0x0;var _0x39a756=_0x5245[_0x33c98e];return _0x39a756;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5524('0x0'));var timeout=require('connect-timeout');var express=require(_0x5524('0x1'));var router=express[_0x5524('0x2')]();var auth=require(_0x5524('0x3'));var interaction=require(_0x5524('0x4'));var config=require('../../config/environment');module[_0x5524('0x5')]=router; \ No newline at end of file +var _0x32d2=['connect-timeout','../../components/auth/service','../../config/environment','util','path'];(function(_0x4a9b1f,_0x247a1f){var _0x349bd7=function(_0x333c88){while(--_0x333c88){_0x4a9b1f['push'](_0x4a9b1f['shift']());}};_0x349bd7(++_0x247a1f);}(_0x32d2,0x175));var _0x232d=function(_0x36cc69,_0x281b82){_0x36cc69=_0x36cc69-0x0;var _0x25f50b=_0x32d2[_0x36cc69];return _0x25f50b;};'use strict';var multer=require('multer');var util=require(_0x232d('0x0'));var path=require(_0x232d('0x1'));var timeout=require(_0x232d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x232d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x232d('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b394d53..d7d9f95 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 _0xa571=['exports','INTEGER','sequelize'];(function(_0x37e058,_0x3ca20c){var _0x2ebe49=function(_0x1f3aa5){while(--_0x1f3aa5){_0x37e058['push'](_0x37e058['shift']());}};_0x2ebe49(++_0x3ca20c);}(_0xa571,0x107));var _0x1a57=function(_0x13458d,_0x1c2ac4){_0x13458d=_0x13458d-0x0;var _0x1bf802=_0xa571[_0x13458d];return _0x1bf802;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'penalty':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3266=['INTEGER','STRING','sequelize','exports'];(function(_0x2892ff,_0x48991f){var _0x1d7a49=function(_0x5a1dc5){while(--_0x5a1dc5){_0x2892ff['push'](_0x2892ff['shift']());}};_0x1d7a49(++_0x48991f);}(_0x3266,0x6a));var _0x6326=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x3266[_0x57d13b];return _0x467696;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'penalty':{'type':Sequelize[_0x6326('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6326('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6326('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4ef12af..80e88cf 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xb10b[_0x1fd9e7];return _0x1781f2;};'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')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1254c8,_0x34e836){_0x1254c8=_0x1254c8-0x0;var _0x4c2496=_0xb10b[_0x1254c8];return _0x4c2496;};'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')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index af6b59a..5aef860 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 _0x8d59=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d59,0x109));var _0x98d5=function(_0xb4dbeb,_0x2fe3d5){_0xb4dbeb=_0xb4dbeb-0x0;var _0x4de24f=_0x8d59[_0xb4dbeb];return _0x4de24f;};'use strict';var _=require(_0x98d5('0x0'));var util=require(_0x98d5('0x1'));var moment=require(_0x98d5('0x2'));var BPromise=require(_0x98d5('0x3'));var rs=require(_0x98d5('0x4'));var fs=require('fs');var Redis=require(_0x98d5('0x5'));var db=require(_0x98d5('0x6'))['db'];var utils=require(_0x98d5('0x7'));var logger=require(_0x98d5('0x8'))(_0x98d5('0x9'));var config=require(_0x98d5('0xa'));var jayson=require(_0x98d5('0xb'));var client=jayson[_0x98d5('0xc')][_0x98d5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x381764,_0x181547,_0x48bc4c){return new BPromise(function(_0x290bee,_0x57a61a){return client[_0x98d5('0xe')](_0x381764,_0x48bc4c)[_0x98d5('0xf')](function(_0x3ce5fd){logger['info'](_0x98d5('0x10'),_0x181547,_0x98d5('0x11'));logger['debug'](_0x98d5('0x12'),_0x181547,'request\x20sent',JSON[_0x98d5('0x13')](_0x3ce5fd));if(_0x3ce5fd[_0x98d5('0x14')]){if(_0x3ce5fd['error'][_0x98d5('0x15')]===0x1f4){logger[_0x98d5('0x14')](_0x98d5('0x10'),_0x181547,_0x3ce5fd[_0x98d5('0x14')][_0x98d5('0x16')]);return _0x57a61a(_0x3ce5fd[_0x98d5('0x14')][_0x98d5('0x16')]);}logger[_0x98d5('0x14')](_0x98d5('0x10'),_0x181547,_0x3ce5fd[_0x98d5('0x14')][_0x98d5('0x16')]);return _0x290bee(_0x3ce5fd[_0x98d5('0x14')][_0x98d5('0x16')]);}else{logger[_0x98d5('0x17')]('UserFaxQueue,\x20%s,\x20%s',_0x181547,_0x98d5('0x11'));_0x290bee(_0x3ce5fd[_0x98d5('0x18')][_0x98d5('0x16')]);}})[_0x98d5('0x19')](function(_0x28f549){logger[_0x98d5('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x181547,_0x28f549);_0x57a61a(_0x28f549);});});} \ No newline at end of file +var _0x9551=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x9551,0x11e));var _0x1955=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0x9551[_0x4cb231];return _0x4d5063;};'use strict';var _=require(_0x1955('0x0'));var util=require('util');var moment=require(_0x1955('0x1'));var BPromise=require(_0x1955('0x2'));var rs=require(_0x1955('0x3'));var fs=require('fs');var Redis=require(_0x1955('0x4'));var db=require(_0x1955('0x5'))['db'];var utils=require(_0x1955('0x6'));var logger=require(_0x1955('0x7'))(_0x1955('0x8'));var config=require('../../config/environment');var jayson=require(_0x1955('0x9'));var client=jayson[_0x1955('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd58a63,_0x193fa8,_0x24c4a2){return new BPromise(function(_0x193f3e,_0xc8c8b9){return client['request'](_0xd58a63,_0x24c4a2)[_0x1955('0xb')](function(_0x5cea4e){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x193fa8,_0x1955('0xc'));logger[_0x1955('0xd')](_0x1955('0xe'),_0x193fa8,'request\x20sent',JSON['stringify'](_0x5cea4e));if(_0x5cea4e[_0x1955('0xf')]){if(_0x5cea4e[_0x1955('0xf')][_0x1955('0x10')]===0x1f4){logger['error'](_0x1955('0x11'),_0x193fa8,_0x5cea4e[_0x1955('0xf')][_0x1955('0x12')]);return _0xc8c8b9(_0x5cea4e[_0x1955('0xf')]['message']);}logger[_0x1955('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x193fa8,_0x5cea4e[_0x1955('0xf')][_0x1955('0x12')]);return _0x193f3e(_0x5cea4e[_0x1955('0xf')][_0x1955('0x12')]);}else{logger[_0x1955('0x13')](_0x1955('0x11'),_0x193fa8,'request\x20sent');_0x193f3e(_0x5cea4e[_0x1955('0x14')]['message']);}})[_0x1955('0x15')](function(_0xd5a5db){logger[_0x1955('0xf')](_0x1955('0x11'),_0x193fa8,_0xd5a5db);_0xc8c8b9(_0xd5a5db);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 764276d..259c79e 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 _0x5e83=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x38bb2d,_0x348020){var _0x572fd6=function(_0x77a70d){while(--_0x77a70d){_0x38bb2d['push'](_0x38bb2d['shift']());}};_0x572fd6(++_0x348020);}(_0x5e83,0x111));var _0x35e8=function(_0x180e11,_0x24bfb8){_0x180e11=_0x180e11-0x0;var _0x330930=_0x5e83[_0x180e11];return _0x330930;};'use strict';var multer=require(_0x35e8('0x0'));var util=require(_0x35e8('0x1'));var path=require(_0x35e8('0x2'));var timeout=require(_0x35e8('0x3'));var express=require(_0x35e8('0x4'));var router=express[_0x35e8('0x5')]();var auth=require(_0x35e8('0x6'));var interaction=require(_0x35e8('0x7'));var config=require(_0x35e8('0x8'));module[_0x35e8('0x9')]=router; \ No newline at end of file +var _0x0263=['connect-timeout','express','../../components/auth/service','../../config/environment','exports','util','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0263,0x75));var _0x3026=function(_0x90f2f7,_0x2524eb){_0x90f2f7=_0x90f2f7-0x0;var _0x5d5a61=_0x0263[_0x90f2f7];return _0x5d5a61;};'use strict';var multer=require('multer');var util=require(_0x3026('0x0'));var path=require(_0x3026('0x1'));var timeout=require(_0x3026('0x2'));var express=require(_0x3026('0x3'));var router=express['Router']();var auth=require(_0x3026('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3026('0x5'));module[_0x3026('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 61800b1..c5ef296 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(_0x492d9d,_0x2928ea){var _0x3dfdb5=function(_0xefd437){while(--_0xefd437){_0x492d9d['push'](_0x492d9d['shift']());}};_0x3dfdb5(++_0x2928ea);}(_0xe706,0xa3));var _0x6e70=function(_0x402dfe,_0x143d24){_0x402dfe=_0x402dfe-0x0;var _0x521b9a=_0xe706[_0x402dfe];return _0x521b9a;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 344dda3..59fd138 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 _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5f1558,_0x25f5b1){var _0x4ea4a3=function(_0x4146bc){while(--_0x4146bc){_0x5f1558['push'](_0x5f1558['shift']());}};_0x4ea4a3(++_0x25f5b1);}(_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 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':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2ce040,_0x24dbc4){var _0x4b95e2=function(_0x4f020d){while(--_0x4f020d){_0x2ce040['push'](_0x2ce040['shift']());}};_0x4b95e2(++_0x24dbc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 0d08eb0..257bd0b 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 _0xd9ef=['UserMailQueue,\x20%s,\x20%s','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd9ef,0x95));var _0xfd9e=function(_0x5be16a,_0x145a69){_0x5be16a=_0x5be16a-0x0;var _0x5eb46e=_0xd9ef[_0x5be16a];return _0x5eb46e;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var moment=require('moment');var BPromise=require(_0xfd9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfd9e('0x3'));var logger=require(_0xfd9e('0x4'))(_0xfd9e('0x5'));var config=require(_0xfd9e('0x6'));var jayson=require(_0xfd9e('0x7'));var client=jayson[_0xfd9e('0x8')][_0xfd9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3dec,_0x261826,_0x302795){return new BPromise(function(_0xb61585,_0x1f35c7){return client[_0xfd9e('0xa')](_0x3c3dec,_0x302795)['then'](function(_0xd8d6bc){logger[_0xfd9e('0xb')]('UserMailQueue,\x20%s,\x20%s',_0x261826,_0xfd9e('0xc'));logger[_0xfd9e('0xd')](_0xfd9e('0xe'),_0x261826,'request\x20sent',JSON[_0xfd9e('0xf')](_0xd8d6bc));if(_0xd8d6bc[_0xfd9e('0x10')]){if(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x11')]===0x1f4){logger[_0xfd9e('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x261826,_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);return _0x1f35c7(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);}logger[_0xfd9e('0x10')](_0xfd9e('0x13'),_0x261826,_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);return _0xb61585(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);}else{logger['info'](_0xfd9e('0x13'),_0x261826,'request\x20sent');_0xb61585(_0xd8d6bc['result'][_0xfd9e('0x12')]);}})[_0xfd9e('0x14')](function(_0x144372){logger['error'](_0xfd9e('0x13'),_0x261826,_0x144372);_0x1f35c7(_0x144372);});});} \ No newline at end of file +var _0x83b3=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x83b3,0x147));var _0x383b=function(_0x17edd1,_0xd37b1f){_0x17edd1=_0x17edd1-0x0;var _0x20d982=_0x83b3[_0x17edd1];return _0x20d982;};'use strict';var _=require(_0x383b('0x0'));var util=require(_0x383b('0x1'));var moment=require(_0x383b('0x2'));var BPromise=require(_0x383b('0x3'));var rs=require(_0x383b('0x4'));var fs=require('fs');var Redis=require(_0x383b('0x5'));var db=require(_0x383b('0x6'))['db'];var utils=require(_0x383b('0x7'));var logger=require(_0x383b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x383b('0x9'));var client=jayson[_0x383b('0xa')][_0x383b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369aac,_0x310d35,_0x2e7aff){return new BPromise(function(_0x3f557f,_0x392a26){return client[_0x383b('0xc')](_0x369aac,_0x2e7aff)[_0x383b('0xd')](function(_0x43017c){logger['info'](_0x383b('0xe'),_0x310d35,_0x383b('0xf'));logger[_0x383b('0x10')](_0x383b('0x11'),_0x310d35,_0x383b('0xf'),JSON['stringify'](_0x43017c));if(_0x43017c[_0x383b('0x12')]){if(_0x43017c['error'][_0x383b('0x13')]===0x1f4){logger['error'](_0x383b('0xe'),_0x310d35,_0x43017c[_0x383b('0x12')][_0x383b('0x14')]);return _0x392a26(_0x43017c[_0x383b('0x12')][_0x383b('0x14')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x310d35,_0x43017c[_0x383b('0x12')][_0x383b('0x14')]);return _0x3f557f(_0x43017c[_0x383b('0x12')][_0x383b('0x14')]);}else{logger['info'](_0x383b('0xe'),_0x310d35,_0x383b('0xf'));_0x3f557f(_0x43017c[_0x383b('0x15')][_0x383b('0x14')]);}})[_0x383b('0x16')](function(_0x17c1c4){logger[_0x383b('0x12')](_0x383b('0xe'),_0x310d35,_0x17c1c4);_0x392a26(_0x17c1c4);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7a32304..47c7664 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 _0xa3bc=['../../config/environment','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x30815c,_0x3c54e0){var _0x21f2c2=function(_0x484e0d){while(--_0x484e0d){_0x30815c['push'](_0x30815c['shift']());}};_0x21f2c2(++_0x3c54e0);}(_0xa3bc,0xfe));var _0xca3b=function(_0xfc3383,_0x14343f){_0xfc3383=_0xfc3383-0x0;var _0x5ed56d=_0xa3bc[_0xfc3383];return _0x5ed56d;};'use strict';var multer=require(_0xca3b('0x0'));var util=require(_0xca3b('0x1'));var path=require(_0xca3b('0x2'));var timeout=require('connect-timeout');var express=require(_0xca3b('0x3'));var router=express[_0xca3b('0x4')]();var auth=require(_0xca3b('0x5'));var interaction=require(_0xca3b('0x6'));var config=require(_0xca3b('0x7'));module[_0xca3b('0x8')]=router; \ No newline at end of file +var _0xf112=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x36d196,_0x5cb00e){var _0x6f721e=function(_0xa356e3){while(--_0xa356e3){_0x36d196['push'](_0x36d196['shift']());}};_0x6f721e(++_0x5cb00e);}(_0xf112,0xe8));var _0x2f11=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0xf112[_0x225f50];return _0x19d003;};'use strict';var multer=require(_0x2f11('0x0'));var util=require('util');var path=require(_0x2f11('0x1'));var timeout=require(_0x2f11('0x2'));var express=require(_0x2f11('0x3'));var router=express[_0x2f11('0x4')]();var auth=require(_0x2f11('0x5'));var interaction=require(_0x2f11('0x6'));var config=require(_0x2f11('0x7'));module[_0x2f11('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index cd485a4..2a89009 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 _0xb10b=['sequelize','INTEGER'];(function(_0x388d4e,_0x14418c){var _0x4f8fee=function(_0x2ad760){while(--_0x2ad760){_0x388d4e['push'](_0x388d4e['shift']());}};_0x4f8fee(++_0x14418c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a54df,_0x45ea17){_0x2a54df=_0x2a54df-0x0;var _0x1d5f05=_0xb10b[_0x2a54df];return _0x1d5f05;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0xbb2e77,_0x39a7f2){var _0x5d7713=function(_0x39d45f){while(--_0x39d45f){_0xbb2e77['push'](_0xbb2e77['shift']());}};_0x5d7713(++_0x39a7f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index bfbbc9c..d4fad5c 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 _0xb4f8=['rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise','path'];(function(_0x38d830,_0x23bb3f){var _0x3072bb=function(_0x5e53fe){while(--_0x5e53fe){_0x38d830['push'](_0x38d830['shift']());}};_0x3072bb(++_0x23bb3f);}(_0xb4f8,0x17b));var _0x8b4f=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xb4f8[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x8b4f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8b4f('0x1'));var moment=require(_0x8b4f('0x2'));var BPromise=require(_0x8b4f('0x3'));var rp=require(_0x8b4f('0x4'));var fs=require('fs');var path=require(_0x8b4f('0x5'));var rimraf=require(_0x8b4f('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b4f('0x7'));module['exports']=function(_0x1549d3,_0x4c9c62){return _0x1549d3[_0x8b4f('0x8')](_0x8b4f('0x9'),attributes,{'tableName':_0x8b4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe186=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports','define'];(function(_0x149041,_0x24cb2e){var _0x487786=function(_0x21b6ed){while(--_0x21b6ed){_0x149041['push'](_0x149041['shift']());}};_0x487786(++_0x24cb2e);}(_0xe186,0x1db));var _0x6e18=function(_0x2d3ed1,_0xd507b0){_0x2d3ed1=_0x2d3ed1-0x0;var _0x16474a=_0xe186[_0x2d3ed1];return _0x16474a;};'use strict';var _=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var logger=require(_0x6e18('0x2'))(_0x6e18('0x3'));var moment=require(_0x6e18('0x4'));var BPromise=require(_0x6e18('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6e18('0x6'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x6e18('0x7')]=function(_0x824b2,_0x564cca){return _0x824b2[_0x6e18('0x8')](_0x6e18('0x9'),attributes,{'tableName':_0x6e18('0xa'),'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 37b8eb8..8089b2f 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 _0x5861=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x27338a,_0x1f5748){var _0x2ae841=function(_0x3a06e6){while(--_0x3a06e6){_0x27338a['push'](_0x27338a['shift']());}};_0x2ae841(++_0x1f5748);}(_0x5861,0xaf));var _0x1586=function(_0x328a5d,_0x283dd3){_0x328a5d=_0x328a5d-0x0;var _0x1f9865=_0x5861[_0x328a5d];return _0x1f9865;};'use strict';var _=require(_0x1586('0x0'));var util=require(_0x1586('0x1'));var moment=require(_0x1586('0x2'));var BPromise=require(_0x1586('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1586('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1586('0x5'))(_0x1586('0x6'));var config=require(_0x1586('0x7'));var jayson=require(_0x1586('0x8'));var client=jayson[_0x1586('0x9')][_0x1586('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fa234,_0x4e5623,_0x4932a4){return new BPromise(function(_0x3a9817,_0x14b6b1){return client[_0x1586('0xb')](_0x4fa234,_0x4932a4)['then'](function(_0x1dd901){logger[_0x1586('0xc')](_0x1586('0xd'),_0x4e5623,'request\x20sent');logger['debug'](_0x1586('0xe'),_0x4e5623,_0x1586('0xf'),JSON[_0x1586('0x10')](_0x1dd901));if(_0x1dd901[_0x1586('0x11')]){if(_0x1dd901[_0x1586('0x11')][_0x1586('0x12')]===0x1f4){logger[_0x1586('0x11')](_0x1586('0xd'),_0x4e5623,_0x1dd901[_0x1586('0x11')][_0x1586('0x13')]);return _0x14b6b1(_0x1dd901[_0x1586('0x11')][_0x1586('0x13')]);}logger[_0x1586('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e5623,_0x1dd901[_0x1586('0x11')][_0x1586('0x13')]);return _0x3a9817(_0x1dd901[_0x1586('0x11')]['message']);}else{logger[_0x1586('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e5623,_0x1586('0xf'));_0x3a9817(_0x1dd901[_0x1586('0x14')][_0x1586('0x13')]);}})[_0x1586('0x15')](function(_0x21b3b1){logger[_0x1586('0x11')](_0x1586('0xd'),_0x4e5623,_0x21b3b1);_0x14b6b1(_0x21b3b1);});});} \ No newline at end of file +var _0xe81d=['rpc','../../config/environment','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xe81d,0x1bf));var _0xde81=function(_0x1d6f71,_0x39cee8){_0x1d6f71=_0x1d6f71-0x0;var _0x4316d5=_0xe81d[_0x1d6f71];return _0x4316d5;};'use strict';var _=require(_0xde81('0x0'));var util=require(_0xde81('0x1'));var moment=require(_0xde81('0x2'));var BPromise=require(_0xde81('0x3'));var rs=require(_0xde81('0x4'));var fs=require('fs');var Redis=require(_0xde81('0x5'));var db=require(_0xde81('0x6'))['db'];var utils=require(_0xde81('0x7'));var logger=require(_0xde81('0x8'))(_0xde81('0x9'));var config=require(_0xde81('0xa'));var jayson=require(_0xde81('0xb'));var client=jayson['client'][_0xde81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1afe9f,_0x127de4,_0x38113d){return new BPromise(function(_0x323fc8,_0x50690e){return client['request'](_0x1afe9f,_0x38113d)[_0xde81('0xd')](function(_0x1ac8df){logger[_0xde81('0xe')](_0xde81('0xf'),_0x127de4,_0xde81('0x10'));logger[_0xde81('0x11')](_0xde81('0x12'),_0x127de4,_0xde81('0x10'),JSON[_0xde81('0x13')](_0x1ac8df));if(_0x1ac8df[_0xde81('0x14')]){if(_0x1ac8df[_0xde81('0x14')][_0xde81('0x15')]===0x1f4){logger[_0xde81('0x14')](_0xde81('0xf'),_0x127de4,_0x1ac8df[_0xde81('0x14')]['message']);return _0x50690e(_0x1ac8df['error'][_0xde81('0x16')]);}logger[_0xde81('0x14')](_0xde81('0xf'),_0x127de4,_0x1ac8df[_0xde81('0x14')][_0xde81('0x16')]);return _0x323fc8(_0x1ac8df[_0xde81('0x14')][_0xde81('0x16')]);}else{logger[_0xde81('0xe')](_0xde81('0xf'),_0x127de4,_0xde81('0x10'));_0x323fc8(_0x1ac8df[_0xde81('0x17')][_0xde81('0x16')]);}})['catch'](function(_0x5479e2){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x127de4,_0x5479e2);_0x50690e(_0x5479e2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1e4bb9e..6222322 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 _0x0af9=['/:id/resources','addResources','put','/:id','update','destroy','delete','removeSections','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','/:id/sections','getResources','post','/:id/clone','clone'];(function(_0x294aef,_0x378f98){var _0x4d235d=function(_0x105d6c){while(--_0x105d6c){_0x294aef['push'](_0x294aef['shift']());}};_0x4d235d(++_0x378f98);}(_0x0af9,0xc9));var _0x90af=function(_0x5a8bbb,_0x28e82b){_0x5a8bbb=_0x5a8bbb-0x0;var _0x33c23b=_0x0af9[_0x5a8bbb];return _0x33c23b;};'use strict';var multer=require(_0x90af('0x0'));var util=require(_0x90af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90af('0x2'));var router=express[_0x90af('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x90af('0x4'));var config=require(_0x90af('0x5'));var controller=require(_0x90af('0x6'));router[_0x90af('0x7')]('/',auth[_0x90af('0x8')](),controller['index']);router['get']('/describe',auth[_0x90af('0x8')](),controller[_0x90af('0x9')]);router[_0x90af('0x7')]('/:id',auth[_0x90af('0x8')](),controller['show']);router[_0x90af('0x7')](_0x90af('0xa'),auth[_0x90af('0x8')](),controller['getSections']);router['get']('/:id/resources',auth[_0x90af('0x8')](),controller[_0x90af('0xb')]);router[_0x90af('0xc')]('/',auth[_0x90af('0x8')](),controller['create']);router[_0x90af('0xc')](_0x90af('0xd'),auth['isAuthenticated'](),controller[_0x90af('0xe')]);router['post'](_0x90af('0xa'),auth[_0x90af('0x8')](),controller['addSections']);router[_0x90af('0xc')](_0x90af('0xf'),auth[_0x90af('0x8')](),controller[_0x90af('0x10')]);router[_0x90af('0x11')](_0x90af('0x12'),auth['isAuthenticated'](),controller[_0x90af('0x13')]);router['delete'](_0x90af('0x12'),auth['isAuthenticated'](),controller[_0x90af('0x14')]);router[_0x90af('0x15')](_0x90af('0xa'),auth['isAuthenticated'](),controller[_0x90af('0x16')]);router[_0x90af('0x15')](_0x90af('0xf'),auth[_0x90af('0x8')](),controller['removeResources']);module[_0x90af('0x17')]=router; \ No newline at end of file +var _0x6eb8=['/describe','describe','/:id','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','destroy','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x569853,_0x2d6100){var _0x127635=function(_0x433db0){while(--_0x433db0){_0x569853['push'](_0x569853['shift']());}};_0x127635(++_0x2d6100);}(_0x6eb8,0x104));var _0x86eb=function(_0x28725e,_0x9e023b){_0x28725e=_0x28725e-0x0;var _0x7b76bf=_0x6eb8[_0x28725e];return _0x7b76bf;};'use strict';var multer=require(_0x86eb('0x0'));var util=require(_0x86eb('0x1'));var path=require(_0x86eb('0x2'));var timeout=require(_0x86eb('0x3'));var express=require(_0x86eb('0x4'));var router=express[_0x86eb('0x5')]();var auth=require(_0x86eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x86eb('0x7'));var controller=require('./userProfile.controller');router[_0x86eb('0x8')]('/',auth[_0x86eb('0x9')](),controller['index']);router[_0x86eb('0x8')](_0x86eb('0xa'),auth[_0x86eb('0x9')](),controller[_0x86eb('0xb')]);router[_0x86eb('0x8')](_0x86eb('0xc'),auth[_0x86eb('0x9')](),controller[_0x86eb('0xd')]);router[_0x86eb('0x8')]('/:id/sections',auth[_0x86eb('0x9')](),controller[_0x86eb('0xe')]);router[_0x86eb('0x8')](_0x86eb('0xf'),auth[_0x86eb('0x9')](),controller[_0x86eb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86eb('0x11')]);router[_0x86eb('0x12')](_0x86eb('0x13'),auth['isAuthenticated'](),controller[_0x86eb('0x14')]);router[_0x86eb('0x12')](_0x86eb('0x15'),auth['isAuthenticated'](),controller[_0x86eb('0x16')]);router['post'](_0x86eb('0xf'),auth[_0x86eb('0x9')](),controller[_0x86eb('0x17')]);router[_0x86eb('0x18')]('/:id',auth[_0x86eb('0x9')](),controller[_0x86eb('0x19')]);router[_0x86eb('0x1a')](_0x86eb('0xc'),auth[_0x86eb('0x9')](),controller[_0x86eb('0x1b')]);router['delete'](_0x86eb('0x15'),auth[_0x86eb('0x9')](),controller['removeSections']);router['delete'](_0x86eb('0xf'),auth[_0x86eb('0x9')](),controller[_0x86eb('0x1c')]);module[_0x86eb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f5ca11e..5a18c93 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 _0x8b13=['exports','STRING','join','crudPermissions','getDataValue'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x8b13,0x1ef));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x38b1('0x0')]={'name':{'type':Sequelize[_0x38b1('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x38b1('0x1')],'set':function(_0x563a4e){this['setDataValue']('crudPermissions',_0x563a4e?_0x563a4e[_0x38b1('0x2')](''):[]);},'get':function(){return this['getDataValue'](_0x38b1('0x3'))?this[_0x38b1('0x4')](_0x38b1('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x38b1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5a69=['sequelize','exports','name','setDataValue','crudPermissions','getDataValue','split','STRING'];(function(_0x5c7231,_0xe98242){var _0x16f78b=function(_0x42034f){while(--_0x42034f){_0x5c7231['push'](_0x5c7231['shift']());}};_0x16f78b(++_0xe98242);}(_0x5a69,0x1c0));var _0x95a6=function(_0x598db6,_0x338e9d){_0x598db6=_0x598db6-0x0;var _0x1959bc=_0x5a69[_0x598db6];return _0x1959bc;};'use strict';var Sequelize=require(_0x95a6('0x0'));module[_0x95a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x95a6('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x48f21b){this[_0x95a6('0x3')](_0x95a6('0x4'),_0x48f21b?_0x48f21b['join'](''):[]);},'get':function(){return this['getDataValue'](_0x95a6('0x4'))?this[_0x95a6('0x5')](_0x95a6('0x4'))[_0x95a6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x95a6('0x7')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a79ad1a..5d3b457 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 _0x3243=['forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','all','ignore','union','rawAttributes','nolimit','order','pick','VIRTUAL','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','color','tag','Tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','Lists','ListId','lists','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','Schedule','sounds','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','merge','filter','include','findAll','rows','show','params','UserProfile','fields','includeAll','options','find','catch','create','clone','get','createdAt','crudPermissions','body','updatedAt','sequelize','transaction','autoAssociation','UserProfileResource','omit','sectionId','Resources','UserProfileSection','describe','userProfileId','each','push','removeSections','ids','enabled','isEmpty','includes','subsections','findOne','Dashboard'];(function(_0x5980eb,_0x1636b4){var _0x4daba3=function(_0x2d2100){while(--_0x2d2100){_0x5980eb['push'](_0x5980eb['shift']());}};_0x4daba3(++_0x1636b4);}(_0x3243,0x90));var _0x3324=function(_0x15e0b2,_0x3a3d17){_0x15e0b2=_0x15e0b2-0x0;var _0x1031a8=_0x3243[_0x15e0b2];return _0x1031a8;};'use strict';var pdf=require(_0x3324('0x0'));var emlformat=require(_0x3324('0x1'));var rimraf=require(_0x3324('0x2'));var zipdir=require(_0x3324('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3324('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3324('0x5'));var util=require('util');var path=require(_0x3324('0x6'));var sox=require(_0x3324('0x7'));var csv=require(_0x3324('0x8'));var ejs=require(_0x3324('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3324('0xa'));var crypto=require(_0x3324('0xb'));var jsforce=require(_0x3324('0xc'));var deskjs=require(_0x3324('0xd'));var toCsv=require(_0x3324('0x8'));var querystring=require('querystring');var Papa=require(_0x3324('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3324('0xf'));var as=require(_0x3324('0x10'));var hardwareService=require(_0x3324('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3324('0x12'));var config=require(_0x3324('0x13'));var db=require(_0x3324('0x14'))['db'];config[_0x3324('0x15')]=_[_0x3324('0x16')](config[_0x3324('0x15')],{'host':_0x3324('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3324('0x15')]));require('./userProfile.socket')[_0x3324('0x18')](socket);function respondWithStatusCode(_0x4aeb83,_0x46ae5e){_0x46ae5e=_0x46ae5e||0xcc;return function(_0x3195ab){if(_0x3195ab){return _0x4aeb83['sendStatus'](_0x46ae5e);}return _0x4aeb83[_0x3324('0x19')](_0x46ae5e)['end']();};}function respondWithResult(_0x521c24,_0x22dd6c){_0x22dd6c=_0x22dd6c||0xc8;return function(_0x4da4fd){if(_0x4da4fd){return _0x521c24[_0x3324('0x19')](_0x22dd6c)[_0x3324('0x1a')](_0x4da4fd);}};}function respondWithFilteredResult(_0x353bf5,_0x19c540){return function(_0x267bf0){if(_0x267bf0){var _0x28a0f2=_0x267bf0[_0x3324('0x1b')],_0x2db6dd=_0x19c540[_0x3324('0x1c')],_0x4b2cd3=_0x19c540[_0x3324('0x1c')]+_0x19c540[_0x3324('0x1d')],_0x2c9825;if(_0x4b2cd3>=_0x28a0f2){_0x4b2cd3=_0x28a0f2;_0x2c9825=0xc8;}else{_0x2c9825=0xce;}_0x353bf5[_0x3324('0x19')](_0x2c9825);return _0x353bf5['set']('Content-Range',_0x2db6dd+'-'+_0x4b2cd3+'/'+_0x28a0f2)['json'](_0x267bf0);}return null;};}function patchUpdates(_0x556e39){return function(_0x56770c){try{jsonpatch[_0x3324('0x1e')](_0x56770c,_0x556e39,!![]);}catch(_0x2c81d8){return BPromise[_0x3324('0x1f')](_0x2c81d8);}return _0x56770c[_0x3324('0x20')]();};}function saveUpdates(_0x17c298,_0x1e0004){return function(_0x46a2e8){if(_0x46a2e8){return _0x46a2e8[_0x3324('0x21')](_0x17c298)[_0x3324('0x22')](function(_0xa0d9b8){return _0xa0d9b8;});}return null;};}function removeEntity(_0x4051a3,_0x4460ca){return function(_0x29016b){if(_0x29016b){return _0x29016b[_0x3324('0x23')]()[_0x3324('0x22')](function(){_0x4051a3['status'](0xcc)[_0x3324('0x24')]();});}};}function handleEntityNotFound(_0x58d7be,_0x10d9ee){return function(_0x196ae1){if(!_0x196ae1){_0x58d7be[_0x3324('0x25')](0x194);}return _0x196ae1;};}function handleError(_0x608280,_0x43c15f){_0x43c15f=_0x43c15f||0x1f4;return function(_0x533761){logger['error'](_0x533761[_0x3324('0x26')]);if(_0x533761[_0x3324('0x27')]){delete _0x533761[_0x3324('0x27')];}_0x608280['status'](_0x43c15f)[_0x3324('0x28')](_0x533761);};}exports[_0x3324('0x29')]=function(_0x4a9361,_0x53718b){var _0x24eab4={},_0x2f99e5={},_0x17c64d={'count':0x0,'rows':[]};var _0x4cfddf=_[_0x3324('0x2a')](db['UserProfile']['rawAttributes'],function(_0x668a71){return{'name':_0x668a71[_0x3324('0x2b')],'type':_0x668a71[_0x3324('0x2c')][_0x3324('0x2d')]};});_0x2f99e5[_0x3324('0x2e')]=_['map'](_0x4cfddf,_0x3324('0x27'));_0x2f99e5[_0x3324('0x2f')]=_[_0x3324('0x30')](_0x4a9361[_0x3324('0x2f')]);_0x2f99e5[_0x3324('0x31')]=_[_0x3324('0x32')](_0x2f99e5[_0x3324('0x2e')],_0x2f99e5[_0x3324('0x2f')]);_0x24eab4[_0x3324('0x33')]=_[_0x3324('0x32')](_0x2f99e5[_0x3324('0x2e')],qs['fields'](_0x4a9361[_0x3324('0x2f')]['fields']));_0x24eab4['attributes']=_0x24eab4['attributes'][_0x3324('0x34')]?_0x24eab4[_0x3324('0x33')]:_0x2f99e5[_0x3324('0x2e')];if(!_0x4a9361[_0x3324('0x2f')][_0x3324('0x35')]('nolimit')){_0x24eab4['limit']=qs['limit'](_0x4a9361['query'][_0x3324('0x1d')]);_0x24eab4[_0x3324('0x1c')]=qs[_0x3324('0x1c')](_0x4a9361[_0x3324('0x2f')]['offset']);}_0x24eab4['order']=qs[_0x3324('0x36')](_0x4a9361['query'][_0x3324('0x36')]);_0x24eab4[_0x3324('0x37')]=qs[_0x3324('0x31')](_['pick'](_0x4a9361['query'],_0x2f99e5['filters']),_0x4cfddf);if(_0x4a9361[_0x3324('0x2f')]['filter']){_0x24eab4['where']=_[_0x3324('0x38')](_0x24eab4[_0x3324('0x37')],{'$or':_[_0x3324('0x2a')](_0x4cfddf,function(_0x1a6b18){if(_0x1a6b18[_0x3324('0x2c')]!=='VIRTUAL'){var _0x2ecb28={};_0x2ecb28[_0x1a6b18[_0x3324('0x27')]]={'$like':'%'+_0x4a9361['query'][_0x3324('0x39')]+'%'};return _0x2ecb28;}})});}_0x24eab4=_[_0x3324('0x38')]({},_0x24eab4,_0x4a9361['options']);var _0x47a80a={'where':_0x24eab4[_0x3324('0x37')]};return db['UserProfile']['count'](_0x47a80a)[_0x3324('0x22')](function(_0x7ee0cd){_0x17c64d['count']=_0x7ee0cd;if(_0x4a9361[_0x3324('0x2f')]['includeAll']){_0x24eab4[_0x3324('0x3a')]=[{'all':!![]}];}return db['UserProfile'][_0x3324('0x3b')](_0x24eab4);})[_0x3324('0x22')](function(_0x29bbc9){_0x17c64d[_0x3324('0x3c')]=_0x29bbc9;return _0x17c64d;})[_0x3324('0x22')](respondWithFilteredResult(_0x53718b,_0x24eab4))['catch'](handleError(_0x53718b,null));};exports[_0x3324('0x3d')]=function(_0x3387d4,_0x10668a){var _0x4d3025={'raw':![],'where':{'id':_0x3387d4[_0x3324('0x3e')]['id']}},_0x565184={};_0x565184[_0x3324('0x2e')]=_[_0x3324('0x30')](db[_0x3324('0x3f')]['rawAttributes']);_0x565184[_0x3324('0x2f')]=_[_0x3324('0x30')](_0x3387d4[_0x3324('0x2f')]);_0x565184[_0x3324('0x31')]=_[_0x3324('0x32')](_0x565184[_0x3324('0x2e')],_0x565184[_0x3324('0x2f')]);_0x4d3025[_0x3324('0x33')]=_[_0x3324('0x32')](_0x565184['model'],qs[_0x3324('0x40')](_0x3387d4[_0x3324('0x2f')][_0x3324('0x40')]));_0x4d3025[_0x3324('0x33')]=_0x4d3025[_0x3324('0x33')][_0x3324('0x34')]?_0x4d3025[_0x3324('0x33')]:_0x565184['model'];if(_0x3387d4[_0x3324('0x2f')][_0x3324('0x41')]){_0x4d3025['include']=[{'all':!![]}];}_0x4d3025=_['merge']({},_0x4d3025,_0x3387d4[_0x3324('0x42')]);return db[_0x3324('0x3f')][_0x3324('0x43')](_0x4d3025)[_0x3324('0x22')](handleEntityNotFound(_0x10668a,null))[_0x3324('0x22')](respondWithResult(_0x10668a,null))[_0x3324('0x44')](handleError(_0x10668a,null));};exports['create']=function(_0x43e420,_0x486a72){return db['UserProfile'][_0x3324('0x45')](_0x43e420['body'],{})[_0x3324('0x22')](respondWithResult(_0x486a72,0xc9))['catch'](handleError(_0x486a72,null));};exports[_0x3324('0x46')]=function(_0x2f663b,_0x2046d2){var _0x1e18f5={'where':{'id':_0x2f663b[_0x3324('0x3e')]['id']}},_0x32a48d={};_0x32a48d['model']=_[_0x3324('0x30')](db['UserProfile']['rawAttributes']);_0x1e18f5['attributes']=_[_0x3324('0x32')](_0x32a48d[_0x3324('0x2e')],qs[_0x3324('0x40')](_0x2f663b[_0x3324('0x2f')][_0x3324('0x40')]));_0x1e18f5[_0x3324('0x33')]=_0x1e18f5['attributes'][_0x3324('0x34')]?_0x1e18f5[_0x3324('0x33')]:_0x32a48d['model'];if(_0x2f663b['query'][_0x3324('0x41')]){_0x1e18f5[_0x3324('0x3a')]=[{'all':!![]}];}_0x1e18f5=_[_0x3324('0x38')]({},_0x1e18f5,_0x2f663b[_0x3324('0x42')]);return db[_0x3324('0x3f')][_0x3324('0x43')](_0x1e18f5)['then'](handleEntityNotFound(_0x2046d2,null))[_0x3324('0x22')](function(_0x5706f1){if(_0x5706f1){var _0x30426c=_0x5706f1[_0x3324('0x47')]({'plain':!![]});_0x30426c=qs['omit'](_0x30426c,['id',_0x3324('0x48'),'updatedAt',_0x3324('0x49')]);_0x2f663b[_0x3324('0x4a')]=_['omit'](_0x2f663b[_0x3324('0x4a')],['id',_0x3324('0x48'),_0x3324('0x4b')]);return db[_0x3324('0x4c')][_0x3324('0x4d')](function(_0x2f17f6){return db[_0x3324('0x3f')][_0x3324('0x45')](_[_0x3324('0x38')](_0x30426c,_0x2f663b[_0x3324('0x4a')]),{'include':_0x2f663b[_0x3324('0x2f')][_0x3324('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x2f17f6})[_0x3324('0x22')](function(_0x344a57){var _0x479c6c=_0x344a57['get']({'plain':!![]});return db['UserProfileSection'][_0x3324('0x3b')]({'where':{'userProfileId':_0x2f663b[_0x3324('0x3e')]['id']},'raw':!![]})[_0x3324('0x22')](function(_0x2f2cad){if(_0x2f2cad){return BPromise['each'](_0x2f2cad,function(_0x22956f){return new BPromise(function(_0x11adb4,_0xb147f0){if(_0x22956f[_0x3324('0x4e')]===null||_0x22956f[_0x3324('0x4e')]===0x1)_0x11adb4(null);return db[_0x3324('0x4f')][_0x3324('0x3b')]({'where':{'sectionId':_0x22956f['id']},'raw':!![]})[_0x3324('0x22')](function(_0xa7f9e3){var _0x29cce6=_['map'](_0xa7f9e3,function(_0x287da5){return qs[_0x3324('0x50')](_0x287da5,['id',_0x3324('0x48'),_0x3324('0x4b'),_0x3324('0x51')]);});_0x11adb4(_0x29cce6);})[_0x3324('0x44')](function(_0x464982){_0xb147f0(_0x464982);});})[_0x3324('0x22')](function(_0x58655e){var _0x4b9b3c=qs[_0x3324('0x50')](_0x22956f,['id',_0x3324('0x48'),_0x3324('0x4b')]);_0x4b9b3c['userProfileId']=_0x479c6c['id'];if(_0x58655e)_0x4b9b3c[_0x3324('0x52')]=_0x58655e;return _0x4b9b3c;})['then'](function(_0xdaa2c){return db[_0x3324('0x53')][_0x3324('0x45')](_0xdaa2c,{'include':[{'model':db[_0x3324('0x4f')],'as':_0x3324('0x52')}],'raw':!![],'transaction':_0x2f17f6});});})[_0x3324('0x22')](function(){return _0x479c6c;});}});});});}})['then'](respondWithResult(_0x2046d2,0xc9))['catch'](handleError(_0x2046d2,null));};exports[_0x3324('0x21')]=function(_0x3cdd63,_0x557772){if(_0x3cdd63['body']['id']){delete _0x3cdd63[_0x3324('0x4a')]['id'];}return db[_0x3324('0x3f')][_0x3324('0x43')]({'where':{'id':_0x3cdd63[_0x3324('0x3e')]['id']}})[_0x3324('0x22')](handleEntityNotFound(_0x557772,null))['then'](saveUpdates(_0x3cdd63[_0x3324('0x4a')],null))[_0x3324('0x22')](respondWithResult(_0x557772,null))[_0x3324('0x44')](handleError(_0x557772,null));};exports[_0x3324('0x23')]=function(_0x13bda3,_0x3a7d06){return db[_0x3324('0x3f')]['find']({'where':{'id':_0x13bda3[_0x3324('0x3e')]['id']}})[_0x3324('0x22')](handleEntityNotFound(_0x3a7d06,null))['then'](removeEntity(_0x3a7d06,null))[_0x3324('0x44')](handleError(_0x3a7d06,null));};exports[_0x3324('0x54')]=function(_0x27f3e9,_0xf25579){return db[_0x3324('0x3f')][_0x3324('0x54')]()[_0x3324('0x22')](respondWithResult(_0xf25579,null))[_0x3324('0x44')](handleError(_0xf25579,null));};exports['addSections']=function(_0x1673c8,_0x3abd88){var _0x352579=_0x1673c8['body'];return db[_0x3324('0x3f')][_0x3324('0x43')]({'where':{'id':_0x1673c8[_0x3324('0x3e')]['id']}})[_0x3324('0x22')](handleEntityNotFound(_0x3abd88,null))[_0x3324('0x22')](function(_0x4e6726){if(_0x4e6726){return db['sequelize'][_0x3324('0x4d')](function(_0x13307d){return db['UserProfileSection'][_0x3324('0x23')]({'where':{'userProfileId':_0x1673c8[_0x3324('0x3e')]['id'],'sectionId':_[_0x3324('0x2a')](_0x352579,function(_0x8d305c){return _0x8d305c[_0x3324('0x51')];})},'transaction':_0x13307d})[_0x3324('0x22')](function(){var _0x1e6187=_[_0x3324('0x2a')](_0x352579,function(_0x4eeee7){_0x4eeee7[_0x3324('0x55')]=_0x1673c8[_0x3324('0x3e')]['id'];return _0x4eeee7;});var _0xd6a22e=[];return BPromise[_0x3324('0x56')](_0x1e6187,function(_0x260206){return db[_0x3324('0x53')][_0x3324('0x45')](_0x260206,{'include':[{'model':db['UserProfileResource'],'as':_0x3324('0x52')}],'raw':!![],'transaction':_0x13307d})[_0x3324('0x22')](function(_0x41b30f){_0xd6a22e[_0x3324('0x57')](_0x41b30f[_0x3324('0x47')]({'plain':!![]}));});})['then'](function(){return _0xd6a22e;});});});}})['then'](function(_0x243e86){return _0x243e86;})[_0x3324('0x22')](respondWithResult(_0x3abd88,null))['catch'](handleError(_0x3abd88,null));};exports[_0x3324('0x58')]=function(_0x4440f1,_0x358157){var _0x3a01ef;return db[_0x3324('0x3f')][_0x3324('0x43')]({'where':{'id':_0x4440f1['params']['id']},'attributes':['id',_0x3324('0x27')]})[_0x3324('0x22')](handleEntityNotFound(_0x358157,null))[_0x3324('0x22')](function(_0x246b6b){if(_0x246b6b){_0x3a01ef=_0x246b6b;return db[_0x3324('0x53')][_0x3324('0x23')]({'where':{'userProfileId':_0x4440f1['params']['id'],'sectionId':_0x4440f1[_0x3324('0x2f')][_0x3324('0x59')]}});}})[_0x3324('0x22')](function(){return _0x3a01ef;})[_0x3324('0x22')](respondWithStatusCode(_0x358157,null))['catch'](handleError(_0x358157,null));};exports['getSections']=function(_0x3b4325,_0x158274){var _0x278784=[];var _0x24cb26=[];return db[_0x3324('0x53')][_0x3324('0x3b')]({'where':{'userProfileId':_0x3b4325[_0x3324('0x3e')]['id']},'raw':!![]})[_0x3324('0x22')](function(_0x3fa28f){_0x278784=_['filter'](_0x3fa28f,function(_0x533288){return _0x533288[_0x3324('0x5a')]===0x1||_['includes']([0x3eb,0x709],_0x533288['sectionId']);});if(!_[_0x3324('0x5b')](_0x278784)){return _[_0x3324('0x2a')](_0x278784,function(_0x2d2e96){return _0x2d2e96[_0x3324('0x51')];});}else{return;}})[_0x3324('0x22')](function(_0x26f303){if(_0x26f303)_0x24cb26=_0x26f303;if(_[_0x3324('0x5c')](_0x24cb26,0x64)){var _0x55b610=_[_0x3324('0x43')](_0x278784,{'sectionId':0x64});return hasDefaultDashboard(_0x55b610)[_0x3324('0x22')](function(_0x3dca4c){return _['map'](_0x278784,function(_0x3e4637){if(_0x3e4637['sectionId']===0x64){_0x3e4637[_0x3324('0x5d')]=_0x3dca4c;}return _0x3e4637;});});}else{return;}})[_0x3324('0x22')](function(_0x2c9e62){if(_0x2c9e62)_0x278784=_0x2c9e62;if(_[_0x3324('0x5c')](_0x24cb26,0x3eb)){var _0x34c6e1=_[_0x3324('0x43')](_0x278784,{'sectionId':0x3eb});return getCustomDashboards(_0x34c6e1)[_0x3324('0x22')](function(_0x5afd59){return _['map'](_0x278784,function(_0x19791c){if(_0x34c6e1['enabled']){if(_0x19791c['sectionId']===0x3eb){_0x19791c[_0x3324('0x5d')]=_0x5afd59;}}else{if(_0x19791c[_0x3324('0x51')]===0x64){_0x19791c[_0x3324('0x5d')]=_0x5afd59;}}return _0x19791c;});});}else{return;}})['then'](function(_0x2a5354){if(_0x2a5354)_0x278784=_0x2a5354;if(_['includes'](_0x24cb26,0x709)){var _0x3c53e4=_[_0x3324('0x43')](_0x278784,{'sectionId':0x709});return getPlugins(_0x3c53e4)[_0x3324('0x22')](function(_0x9e50d9){if(_0x3c53e4[_0x3324('0x5a')]){return _['map'](_0x278784,function(_0x21a622){if(_0x21a622[_0x3324('0x51')]===0x709){_0x21a622[_0x3324('0x5d')]=_0x9e50d9;}return _0x21a622;});}else{var _0xcb794b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9e50d9};var _0x4fa57d=_['map'](_0x278784);_0x4fa57d['push'](_0xcb794b);return _0x4fa57d;}});}else{return;}})['then'](function(_0x5f2432){if(_0x5f2432)_0x278784=_0x5f2432;return _[_0x3324('0x39')](_0x278784,[_0x3324('0x5a'),0x1]);})[_0x3324('0x22')](respondWithResult(_0x158274,null))[_0x3324('0x44')](handleError(_0x158274,null));};function hasDefaultDashboard(_0x157d4a){var _0x3b9e45=[0x65];return new BPromise(function(_0x1e2e2a,_0x3d29bc){try{if(_0x157d4a[_0x3324('0x4e')]){_0x1e2e2a(_0x3b9e45);}else{return db[_0x3324('0x4f')][_0x3324('0x5e')]({'where':{'sectionId':_0x157d4a['id']},'raw':!![]})['then'](function(_0x7cbd65){_0x7cbd65?_0x1e2e2a(_0x3b9e45):_0x1e2e2a();});}}catch(_0x3fb737){_0x3d29bc(_0x3fb737);}});}function getCustomDashboards(_0x298065){var _0x35a762=[];return new BPromise(function(_0x37d28d,_0xad5832){try{if(_0x298065['autoAssociation']){return db[_0x3324('0x5f')][_0x3324('0x3b')]({'raw':!![]})[_0x3324('0x22')](function(_0x1e33c7){_0x1e33c7[_0x3324('0x60')](function(_0x98df35){_0x35a762[_0x3324('0x57')](_0x98df35['id']+0x1869f);});_0x37d28d(_0x35a762);});}else{return db[_0x3324('0x4f')]['findAll']({'where':{'sectionId':_0x298065['id']},'raw':!![]})[_0x3324('0x22')](function(_0x2ceb3e){_0x2ceb3e[_0x3324('0x60')](function(_0x2c18f1){_0x35a762[_0x3324('0x57')](_0x2c18f1['resourceId']+0x1869f);});_0x37d28d(_0x35a762);});}}catch(_0x20586e){_0xad5832(_0x20586e);}});}function getPlugins(_0x5aff64){var _0x546896=[];return new BPromise(function(_0x1c1d4c,_0x5471c8){try{if(_0x5aff64[_0x3324('0x4e')]){return db[_0x3324('0x61')]['findAll']({'raw':!![]})['then'](function(_0x375bbf){_0x375bbf[_0x3324('0x60')](function(_0x594875){_0x546896[_0x3324('0x57')](_0x594875['id']+0x15b38);});_0x1c1d4c(_0x546896);});}else{return db[_0x3324('0x4f')][_0x3324('0x3b')]({'where':{'sectionId':_0x5aff64['id']},'raw':!![]})[_0x3324('0x22')](function(_0x190260){_0x190260[_0x3324('0x60')](function(_0x26a6f2){_0x546896[_0x3324('0x57')](_0x26a6f2[_0x3324('0x62')]+0x15b38);});_0x1c1d4c(_0x546896);});}}catch(_0x126dbd){_0x5471c8(_0x126dbd);}});}exports[_0x3324('0x63')]=function(_0x3083dd,_0xba35fd){return db[_0x3324('0x3f')][_0x3324('0x43')]({'where':{'id':_0x3083dd[_0x3324('0x3e')]['id']}})[_0x3324('0x22')](handleEntityNotFound(_0xba35fd,null))['then'](function(_0x3748a7){if(_0x3748a7){return db[_0x3324('0x4c')]['transaction'](function(_0x384c23){return db[_0x3324('0x53')][_0x3324('0x3b')]({'where':{'userProfileId':_0x3083dd[_0x3324('0x3e')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x502b20){if(_0x502b20){return db[_0x3324('0x53')]['destroy']({'where':{'userProfileId':_0x3083dd[_0x3324('0x3e')]['id'],'id':_[_0x3324('0x2a')](_0x502b20,function(_0x462419){return _0x462419['id'];})},'transaction':_0x384c23});}})[_0x3324('0x22')](function(_0x7256d6){var _0x3dea9a=_[_0x3324('0x2a')](_0x3083dd[_0x3324('0x4a')],function(_0x474d30){_0x474d30[_0x3324('0x55')]=_0x3083dd[_0x3324('0x3e')]['id'];return _0x474d30;});return db[_0x3324('0x53')][_0x3324('0x64')](_0x3dea9a,{'raw':!![],'transaction':_0x384c23});})['then'](function(_0x236a21){var _0x3a27a5=_['filter'](_['map'](_0x236a21,function(_0x69fcdd){return _0x69fcdd[_0x3324('0x47')]({'plain':!![]});}),{'includeAll':![]});if(_0x3a27a5){return db[_0x3324('0x53')][_0x3324('0x3b')]({'where':{'userProfileId':_0x3083dd[_0x3324('0x3e')]['id'],'sectionId':_[_0x3324('0x2a')](_0x3a27a5,function(_0x53eb55){return _0x53eb55['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x3324('0x22')](function(_0x5ccaf7){var _0x3b943b=_[_0x3324('0x2a')](_0x3083dd['body'],function(_0x5c4e74){_0x5c4e74[_0x3324('0x55')]=_0x3083dd[_0x3324('0x3e')]['id'];return _0x5c4e74;});return db[_0x3324('0x4f')][_0x3324('0x64')](_0x3b943b,{'raw':!![],'transaction':_0x384c23});});}})[_0x3324('0x44')](handleError(_0xba35fd,null));});}})[_0x3324('0x22')](function(_0x5d5ec0){var _0x33dfa4=_[_0x3324('0x2a')](_0x5d5ec0,function(_0x143d79){return _0x143d79[_0x3324('0x47')]({'plain':!![]});});})[_0x3324('0x22')](respondWithResult(_0xba35fd,null))[_0x3324('0x44')](handleError(_0xba35fd,null));};exports['removeResources']=function(_0x5c01ff,_0x9578bb,_0xe31781){return db['UserProfile'][_0x3324('0x43')]({'where':{'id':_0x5c01ff['params']['id']}})['then'](handleEntityNotFound(_0x9578bb,null))[_0x3324('0x22')](function(_0x515f62){if(_0x515f62){return _0x515f62[_0x3324('0x65')](_0x5c01ff[_0x3324('0x2f')][_0x3324('0x59')]);}})[_0x3324('0x22')](respondWithStatusCode(_0x9578bb,null))[_0x3324('0x44')](handleError(_0x9578bb,null));};exports['getResources']=function(_0x2abcd2,_0x2eb64b){var _0x2d75c1={'raw':![],'where':{}};var _0x3bb764={};var _0x56f2c9={'count':0x0,'rows':[]};var _0x444027=_0x2abcd2[_0x3324('0x2f')][_0x3324('0x66')];if(typeof _0x444027==='undefined'){throw new db[(_0x3324('0x67'))][(_0x3324('0x68'))](_0x3324('0x69'));}var _0x1fc88f=_0x2abcd2[_0x3324('0x2f')][_0x3324('0x6a')]||![];var _0x3c0c22=getQueryModels(_0x444027,_0x1fc88f);if(typeof _0x3c0c22[_0x3324('0x6b')]===_0x3324('0x6c')){throw new db[(_0x3324('0x67'))][(_0x3324('0x68'))](_0x3324('0x6d')+_0x444027+'\x27');}var _0x40142b=[];if(!_[_0x3324('0x5b')](_0x3c0c22[_0x3324('0x6e')])){_0x40142b=_0x3c0c22[_0x3324('0x6e')];}else{_0x40142b=[{'name':_0x444027}];}return db[_0x3324('0x3f')][_0x3324('0x5e')]({'where':{'id':_0x2abcd2[_0x3324('0x3e')]['id']}})[_0x3324('0x22')](handleEntityNotFound(_0x2eb64b,null))[_0x3324('0x22')](function(_0x4914e9){if(_0x4914e9){var _0x22ba6b=[];for(var _0x32d0a9=0x0;_0x32d0a9<_0x40142b[_0x3324('0x34')];_0x32d0a9++){_0x22ba6b['push'](db[_0x3324('0x53')]['findOne']({'where':{'userProfileId':_0x4914e9['id'],'name':_0x40142b[_0x32d0a9][_0x3324('0x27')]},'raw':!![]}));}return BPromise[_0x3324('0x6f')](_0x22ba6b);}})[_0x3324('0x22')](function(_0x315ac8){var _0x4cff49=_[_0x3324('0x39')](_0x315ac8,function(_0x41d69f){return _0x41d69f?_0x41d69f:undefined;});var _0x1802de=_[_0x3324('0x39')](_0x40142b,[_0x3324('0x70'),!![]]);var _0x4f0691=_[_0x3324('0x5b')](_0x4cff49)&&_[_0x3324('0x5b')](_0x1802de)?null:_[_0x3324('0x71')](_0x1802de,_0x4cff49);if(_0x4f0691){var _0x48a098=[];for(var _0x2a25b0=0x0;_0x2a25b0<_0x4f0691[_0x3324('0x34')];_0x2a25b0++){var _0x1491f9=_[_0x3324('0x43')](_0x40142b,function(_0x27cd08){return _0x4f0691[_0x2a25b0]?_0x27cd08[_0x3324('0x27')]===_0x4f0691[_0x2a25b0][_0x3324('0x27')]:null;});if(_0x1491f9){if(_0x4f0691[_0x2a25b0]['ignore']){_0x48a098['push'](getAllResources(_0x3c0c22['childModel'],_0x4f0691[_0x2a25b0]));}else{if(!_0x4f0691[_0x2a25b0]['autoAssociation']){_0x48a098[_0x3324('0x57')](getAllowedResources(_0x1491f9,_0x4f0691[_0x2a25b0],_0x3c0c22['childModel']));}else{if(_0x1491f9[_0x3324('0x2e')]){_0x48a098['push'](getAllFilteredResources(_0x1491f9,_0x4f0691[_0x2a25b0]));}}}}}return BPromise['all'](_0x48a098);}else{return null;}})[_0x3324('0x22')](function(_0x58b3df){var _0x251bbe=_0x58b3df;var _0x584907=null;if(_0x251bbe){_0x584907=_0x251bbe[_0x3324('0x34')]===0x1?_0x251bbe[0x0]:null;}if(_0x584907||_0x251bbe){var _0x351a76=db[_0x3c0c22[_0x3324('0x6b')]][_0x3324('0x72')];_0x3bb764[_0x3324('0x2e')]=_[_0x3324('0x30')](_0x351a76);_0x3bb764[_0x3324('0x2f')]=_[_0x3324('0x30')](_0x2abcd2[_0x3324('0x2f')]);_0x3bb764[_0x3324('0x31')]=_[_0x3324('0x32')](_0x3bb764[_0x3324('0x2e')],_0x3bb764[_0x3324('0x2f')]);_0x2d75c1[_0x3324('0x33')]=_[_0x3324('0x32')](_0x3bb764[_0x3324('0x2e')],qs[_0x3324('0x40')](_0x2abcd2[_0x3324('0x2f')][_0x3324('0x40')]));_0x2d75c1[_0x3324('0x33')]=_0x2d75c1[_0x3324('0x33')][_0x3324('0x34')]?_0x2d75c1[_0x3324('0x33')]:_0x3bb764[_0x3324('0x2e')];if(!_0x2abcd2['query'][_0x3324('0x35')](_0x3324('0x73'))){_0x2d75c1['limit']=qs[_0x3324('0x1d')](_0x2abcd2[_0x3324('0x2f')]['limit']);_0x2d75c1[_0x3324('0x1c')]=qs[_0x3324('0x1c')](_0x2abcd2[_0x3324('0x2f')][_0x3324('0x1c')]);}_0x2d75c1[_0x3324('0x74')]=qs[_0x3324('0x36')](_0x2abcd2[_0x3324('0x2f')]['sort']);_0x2d75c1['where']=qs['filters'](_[_0x3324('0x75')](_0x2abcd2[_0x3324('0x2f')],_0x3bb764[_0x3324('0x31')]));if(_0x2abcd2[_0x3324('0x2f')]['filter']){_0x2d75c1[_0x3324('0x37')]=_[_0x3324('0x38')](_0x2d75c1[_0x3324('0x37')],{'$or':_[_0x3324('0x2a')](_0x351a76,function(_0x44b3e3){if(_0x44b3e3[_0x3324('0x2c')][_0x3324('0x2d')]!==_0x3324('0x76')){var _0x4b372a={};_0x4b372a[_0x44b3e3[_0x3324('0x77')]]={'$like':'%'+_0x2abcd2[_0x3324('0x2f')][_0x3324('0x39')]+'%'};return _0x4b372a;}})});}var _0x209db6=[];if(_0x584907){var _0x56f816=_[_0x3324('0x43')](_0x40142b,[_0x3324('0x27'),_0x584907[_0x3324('0x27')]]);if(_0x56f816[_0x3324('0x77')]){var _0x4f1c22={};if(_0x3c0c22[_0x3324('0x6b')]==='AnalyticExtractedReport'){_0x4f1c22[_0x56f816[_0x3324('0x78')]]=_['map'](_0x584907[_0x3324('0x79')],'id');}else{_0x4f1c22[_0x56f816[_0x3324('0x78')]]=_0x584907['associatedResources'];}_0x209db6['push'](_0x4f1c22);}else{_0x2d75c1[_0x3324('0x37')]['id']=_0x584907[_0x3324('0x79')];}}else{for(var _0xb67f33=0x0;_0xb67f33<_0x251bbe['length'];_0xb67f33++){var _0x56f816=_[_0x3324('0x43')](_0x40142b,[_0x3324('0x27'),_0x251bbe[_0xb67f33][_0x3324('0x27')]]);if(_0x56f816[_0x3324('0x77')]){var _0x4f1c22={};_0x4f1c22[_0x56f816['foreignKey']]=_0x251bbe[_0xb67f33][_0x3324('0x79')];_0x209db6[_0x3324('0x57')](_0x4f1c22);}else{if(!_0x2d75c1[_0x3324('0x37')]['id'])_0x2d75c1[_0x3324('0x37')]['id']=[];_0x251bbe[_0xb67f33][_0x3324('0x79')][_0x3324('0x60')](function(_0xe9ecf0){_0x2d75c1['where']['id'][_0x3324('0x57')](_0xe9ecf0);});}}}if(!_['isEmpty'](_0x209db6)){_0x2d75c1[_0x3324('0x37')]=_[_0x3324('0x38')](_0x2d75c1['where'],{'$and':{'$or':_0x209db6}});}_0x2d75c1=_[_0x3324('0x38')]({},_0x2d75c1,_0x2abcd2[_0x3324('0x42')]);if(_0x584907&&!_0x584907[_0x3324('0x4e')]&&_0x3c0c22[_0x3324('0x6b')]===_0x3324('0x7a')){if(_0x2abcd2['query'][_0x3324('0x41')]){_0x2d75c1[_0x3324('0x3a')]=[{'all':!![]}];}return db[_0x3c0c22[_0x3324('0x6b')]][_0x3324('0x3b')](_0x2d75c1)['then'](function(_0x59e4a2){var _0x221f5a=[];_0x59e4a2[_0x3324('0x60')](function(_0x7f0cc8){var _0x1c6025;switch(_0x7f0cc8[_0x3324('0x7b')]){case _0x3324('0x7c'):_0x1c6025=_['find'](_0x584907[_0x3324('0x79')],function(_0x309733){return _0x309733['id']===_0x7f0cc8[_0x3324('0x7d')]&&_0x309733[_0x3324('0x2c')]===_0x3324('0x7e');});break;case _0x3324('0x7f'):_0x1c6025=_[_0x3324('0x43')](_0x584907[_0x3324('0x79')],function(_0x346037){return _0x346037['id']===_0x7f0cc8[_0x3324('0x7d')]&&_0x346037[_0x3324('0x2c')]===_0x3324('0x80');});break;}if(_0x1c6025)_0x221f5a[_0x3324('0x57')](_0x7f0cc8);});_0x56f2c9[_0x3324('0x1b')]=_0x221f5a[_0x3324('0x34')];_0x56f2c9[_0x3324('0x3c')]=_0x221f5a;return _0x56f2c9;});}else{return db[_0x3c0c22[_0x3324('0x6b')]][_0x3324('0x1b')]({'where':_0x2d75c1[_0x3324('0x37')]})[_0x3324('0x22')](function(_0xd819d8){_0x56f2c9[_0x3324('0x1b')]=_0xd819d8;if(_0x2abcd2['query'][_0x3324('0x41')]){if(_0x3c0c22['childModel']===_0x3324('0x81')){_0x2d75c1[_0x3324('0x3a')]=[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x3324('0x27'),_0x3324('0x82')],'required':_0x2abcd2[_0x3324('0x2f')][_0x3324('0x83')]?!![]:![]},{'model':db[_0x3324('0x84')],'as':_0x3324('0x85'),'attributes':['id',_0x3324('0x27'),'color'],'through':_0x2abcd2[_0x3324('0x2f')][_0x3324('0x83')]?{'attributes':[],'where':{'TagId':_0x2abcd2[_0x3324('0x2f')][_0x3324('0x83')]||undefined}}:{},'required':_0x2abcd2[_0x3324('0x2f')][_0x3324('0x83')]?!![]:![]}];}else{_0x2d75c1['include']=[{'all':!![]}];}}return db[_0x3c0c22[_0x3324('0x6b')]][_0x3324('0x3b')](_0x2d75c1);})[_0x3324('0x22')](function(_0x152fbb){_0x56f2c9[_0x3324('0x3c')]=_0x152fbb;return _0x56f2c9;});}}else{return _0x56f2c9;}})[_0x3324('0x22')](respondWithFilteredResult(_0x2eb64b,_0x2d75c1))[_0x3324('0x44')](handleError(_0x2eb64b,null));};function getAllResources(_0x490e08,_0x57f306){return new BPromise(function(_0x488b71,_0x2fc394){if(_0x57f306){var _0x2cc6ab=_0x57f306[_0x3324('0x39')]?{[_0x57f306['filter'][_0x3324('0x77')]]:_0x57f306['filter'][_0x3324('0x86')]}:undefined;return db[_0x490e08][_0x3324('0x3b')]({'where':_0x2cc6ab,'raw':!![]})[_0x3324('0x22')](function(_0x2e1cab){_0x57f306[_0x3324('0x79')]=_[_0x3324('0x2a')](_0x2e1cab,'id');_0x488b71(_0x57f306);})['catch'](function(_0x2a6761){_0x2fc394(_0x2a6761);});}else{_0x488b71(null);}});}function getAllFilteredResources(_0x70ab0,_0x272017){return new BPromise(function(_0x173992,_0x59374f){var _0x36c608=_0x70ab0[_0x3324('0x39')]?{[_0x70ab0[_0x3324('0x39')][_0x3324('0x77')]]:_0x70ab0[_0x3324('0x39')][_0x3324('0x86')]}:undefined;return db[_0x70ab0[_0x3324('0x2e')]][_0x3324('0x3b')]({'where':_0x36c608,'raw':!![]})[_0x3324('0x22')](function(_0x5d4837){_0x272017[_0x3324('0x79')]=_[_0x3324('0x2a')](_0x5d4837,function(_0x69573a){return _0x69573a[_0x3324('0x27')];});_0x173992(_0x272017);})[_0x3324('0x44')](function(_0x593ddd){_0x59374f(_0x593ddd);});});}function getAllowedResources(_0x48ea60,_0x595e76,_0x2ba6a8){return new BPromise(function(_0xcc1e84,_0x40cfde){if(_0x595e76){return db[_0x3324('0x4f')][_0x3324('0x3b')]({'where':{'sectionId':_0x595e76['id']},'raw':!![]})[_0x3324('0x22')](function(_0xcac74b){if(_0x48ea60[_0x3324('0x77')]&&_0x48ea60['field']!=='id'){_0x595e76['associatedResources']=_[_0x3324('0x2a')](_0xcac74b,function(_0x483d79){return _0x483d79[_0x48ea60[_0x3324('0x77')]];});}else{if(_0x2ba6a8===_0x3324('0x7a')){_0x595e76['associatedResources']=_[_0x3324('0x2a')](_0xcac74b,function(_0x334b23){return{'id':_0x334b23[_0x3324('0x62')],'type':_0x334b23[_0x3324('0x2c')]};});}else{_0x595e76[_0x3324('0x79')]=_[_0x3324('0x2a')](_0xcac74b,function(_0x3d3f2e){return _0x3d3f2e['resourceId'];});}}_0xcc1e84(_0x595e76);})['catch'](function(_0x482904){_0x40cfde(_0x482904);});}else{_0xcc1e84(null);}});}function getQueryModels(_0x27d553,_0x54ce48){var _0x3e5aa7=_0x27d553[_0x3324('0x87')]();var _0x199c9a={'childModel':undefined,'parentSections':[]};switch(_0x3e5aa7){case _0x3324('0x88'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x89');break;case _0x3324('0x8a'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x8b');break;case _0x3324('0x8c'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x8d');_0x199c9a['parentSections']=[{'name':'SquareProjects','field':_0x3324('0x27'),'foreignKey':_0x3324('0x8e')}];break;case _0x3324('0x8f'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x90');break;case'contacts':_0x199c9a[_0x3324('0x6b')]='CmContact';_0x199c9a['parentSections']=[{'name':_0x3324('0x91'),'field':'id','foreignKey':_0x3324('0x92')}];break;case _0x3324('0x93'):_0x199c9a[_0x3324('0x6b')]='CmList';break;case'companies':_0x199c9a[_0x3324('0x6b')]='CmCompany';break;case _0x3324('0x94'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x95');break;case _0x3324('0x96'):_0x199c9a['childModel']=_0x3324('0x97');break;case _0x3324('0x98'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x99');break;case _0x3324('0x9a'):_0x199c9a['childModel']='FaxQueue';break;case _0x3324('0x9b'):_0x199c9a[_0x3324('0x6b')]='FaxAccount';break;case _0x3324('0x9c'):case _0x3324('0x9d'):case'outboundroutes':_0x199c9a[_0x3324('0x6b')]=_0x3324('0x9e');break;case _0x3324('0x9f'):_0x199c9a['childModel']='VoiceContext';break;case _0x3324('0xa0'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xa1');break;case _0x3324('0xa2'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xa3');_0x199c9a[_0x3324('0x6e')]=[{'name':_0x3324('0xa4'),'field':'name','foreignKey':_0x3324('0xa5'),'model':_0x3324('0xa6'),'filter':{'field':_0x3324('0xa7'),'value':[_0x3324('0xa8')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0x3324('0xa6'),'filter':{'field':_0x3324('0xa7'),'value':[_0x3324('0xa9')]}},{'name':'VoiceQueues','field':_0x3324('0x27'),'foreignKey':_0x3324('0xaa'),'model':'VoiceQueue','filter':{'field':_0x3324('0x2c'),'value':[_0x3324('0xab')]}},{'name':_0x3324('0xac'),'field':_0x3324('0x27'),'foreignKey':'queue','model':_0x3324('0xad'),'filter':{'field':'type','value':[_0x3324('0xae')]}}];break;case _0x3324('0xaf'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xb0');break;case _0x3324('0xb1'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xb2');break;case'voiceprefixes':_0x199c9a[_0x3324('0x6b')]=_0x3324('0xb3');break;case _0x3324('0xb4'):_0x199c9a[_0x3324('0x6b')]='Campaign';break;case _0x3324('0xb5'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xb6');break;case _0x3324('0xb7'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xb8');break;case _0x3324('0xb9'):_0x199c9a[_0x3324('0x6b')]='MailSubstatus';break;case _0x3324('0xba'):_0x199c9a[_0x3324('0x6b')]='OpenchannelQueue';break;case'openchannelaccounts':_0x199c9a[_0x3324('0x6b')]=_0x3324('0xbb');break;case _0x3324('0xbc'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xbd');break;case _0x3324('0xbe'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xbf');break;case _0x3324('0xc0'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xc1');break;case _0x3324('0xc2'):_0x199c9a['childModel']=_0x3324('0xc3');break;case _0x3324('0xc4'):_0x199c9a['childModel']=_0x3324('0xc5');break;case _0x3324('0xc6'):case _0x3324('0xc7'):_0x199c9a[_0x3324('0x6b')]='VoiceQueue';if(_0x54ce48){_0x199c9a['parentSections']=[{'name':_0x3324('0xc8')},{'name':_0x3324('0xac')}];}break;case _0x3324('0xc9'):case _0x3324('0xca'):case'telephones':_0x199c9a[_0x3324('0x6b')]=_0x3324('0xa6');if(_0x54ce48){_0x199c9a[_0x3324('0x6e')]=[{'name':_0x3324('0xcb'),'filter':{'field':_0x3324('0xa7'),'value':['admin',_0x3324('0xcc')]},'ignore':!![]},{'name':_0x3324('0xa4')},{'name':_0x3324('0xcd')}];}break;case _0x3324('0xce'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xcf');break;case _0x3324('0xd0'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xd1');break;case _0x3324('0xd2'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xd3');break;case _0x3324('0xd4'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xd5');break;case _0x3324('0xd6'):_0x199c9a['childModel']='DeskAccount';break;case _0x3324('0xd7'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xd8');break;case _0x3324('0xd9'):_0x199c9a['childModel']=_0x3324('0xa6');break;case _0x3324('0xda'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xdb');break;case'dispositions':_0x199c9a[_0x3324('0x6b')]=_0x3324('0xdc');break;case _0x3324('0xdd'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x5f');break;case _0x3324('0xde'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xdf');break;case _0x3324('0xe0'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xe1');break;case'scheduler':_0x199c9a[_0x3324('0x6b')]=_0x3324('0xe2');break;case _0x3324('0xe3'):_0x199c9a[_0x3324('0x6b')]='Sound';break;case _0x3324('0xe4'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x84');break;case _0x3324('0xe5'):_0x199c9a[_0x3324('0x6b')]='Template';break;case _0x3324('0xe6'):_0x199c9a['childModel']=_0x3324('0xe7');break;case _0x3324('0xe8'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xe9');break;case _0x3324('0xea'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xeb');break;case _0x3324('0xec'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x61');break;case _0x3324('0xed'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0x7a');_0x199c9a[_0x3324('0x6e')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x3324('0xee'):_0x199c9a[_0x3324('0x6b')]=_0x3324('0xef');break;case _0x3324('0xc2'):_0x199c9a['childModel']=_0x3324('0xc3');break;default:return _0x199c9a;}return _0x199c9a;} \ No newline at end of file +var _0x291a=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','params','length','includeAll','include','find','catch','create','body','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','each','push','ids','enabled','includes','sectionId','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','mergeResources','childModel','undefined','ValidationError','parentSections','all','ignore','field','associatedResources','foreignKey','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','metrics','AnalyticMetric','whatsappaccounts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','count','offset','limit','status','set','json','reject','save','update','then','destroy','error','stack','name','map','UserProfile','rawAttributes','key'];(function(_0x258bb7,_0xb70b7f){var _0x57495f=function(_0x4ba6ab){while(--_0x4ba6ab){_0x258bb7['push'](_0x258bb7['shift']());}};_0x57495f(++_0xb70b7f);}(_0x291a,0xbf));var _0xa291=function(_0x252493,_0x33cfc3){_0x252493=_0x252493-0x0;var _0x3371ff=_0x291a[_0x252493];return _0x3371ff;};'use strict';var pdf=require(_0xa291('0x0'));var emlformat=require(_0xa291('0x1'));var rimraf=require(_0xa291('0x2'));var zipdir=require(_0xa291('0x3'));var jsonpatch=require(_0xa291('0x4'));var rp=require(_0xa291('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa291('0x6'));var path=require(_0xa291('0x7'));var sox=require('sox');var csv=require(_0xa291('0x8'));var ejs=require(_0xa291('0x9'));var fs=require('fs');var _=require(_0xa291('0xa'));var squel=require('squel');var crypto=require(_0xa291('0xb'));var jsforce=require(_0xa291('0xc'));var deskjs=require(_0xa291('0xd'));var toCsv=require(_0xa291('0x8'));var querystring=require(_0xa291('0xe'));var Papa=require(_0xa291('0xf'));var Redis=require('ioredis');var authService=require(_0xa291('0x10'));var qs=require(_0xa291('0x11'));var as=require(_0xa291('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa291('0x13'))(_0xa291('0x14'));var utils=require(_0xa291('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa291('0x16')]=_[_0xa291('0x17')](config[_0xa291('0x16')],{'host':_0xa291('0x18'),'port':0x18eb});var socket=require(_0xa291('0x19'))(new Redis(config[_0xa291('0x16')]));require('./userProfile.socket')[_0xa291('0x1a')](socket);function respondWithStatusCode(_0x494f74,_0x181c7e){_0x181c7e=_0x181c7e||0xcc;return function(_0x57c79c){if(_0x57c79c){return _0x494f74[_0xa291('0x1b')](_0x181c7e);}return _0x494f74['status'](_0x181c7e)[_0xa291('0x1c')]();};}function respondWithResult(_0x57bb2d,_0x4e0c0b){_0x4e0c0b=_0x4e0c0b||0xc8;return function(_0x5a874e){if(_0x5a874e){return _0x57bb2d['status'](_0x4e0c0b)['json'](_0x5a874e);}};}function respondWithFilteredResult(_0x1c01d7,_0x5098b3){return function(_0x312f52){if(_0x312f52){var _0xba6497=_0x312f52[_0xa291('0x1d')],_0x364b77=_0x5098b3[_0xa291('0x1e')],_0x28e1f8=_0x5098b3['offset']+_0x5098b3[_0xa291('0x1f')],_0x575f0e;if(_0x28e1f8>=_0xba6497){_0x28e1f8=_0xba6497;_0x575f0e=0xc8;}else{_0x575f0e=0xce;}_0x1c01d7[_0xa291('0x20')](_0x575f0e);return _0x1c01d7[_0xa291('0x21')]('Content-Range',_0x364b77+'-'+_0x28e1f8+'/'+_0xba6497)[_0xa291('0x22')](_0x312f52);}return null;};}function patchUpdates(_0x10c74b){return function(_0x468aa2){try{jsonpatch['apply'](_0x468aa2,_0x10c74b,!![]);}catch(_0x158139){return BPromise[_0xa291('0x23')](_0x158139);}return _0x468aa2[_0xa291('0x24')]();};}function saveUpdates(_0x463ded,_0x5ae89b){return function(_0x48567a){if(_0x48567a){return _0x48567a[_0xa291('0x25')](_0x463ded)[_0xa291('0x26')](function(_0x3640c1){return _0x3640c1;});}return null;};}function removeEntity(_0x389fbe,_0x192f7a){return function(_0x3cd17b){if(_0x3cd17b){return _0x3cd17b[_0xa291('0x27')]()[_0xa291('0x26')](function(){_0x389fbe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdac167,_0x3f89b7){return function(_0x1f9a3c){if(!_0x1f9a3c){_0xdac167[_0xa291('0x1b')](0x194);}return _0x1f9a3c;};}function handleError(_0x49d644,_0xa37962){_0xa37962=_0xa37962||0x1f4;return function(_0x9a54d1){logger[_0xa291('0x28')](_0x9a54d1[_0xa291('0x29')]);if(_0x9a54d1[_0xa291('0x2a')]){delete _0x9a54d1['name'];}_0x49d644['status'](_0xa37962)['send'](_0x9a54d1);};}exports['index']=function(_0x51da73,_0x5ae469){var _0x2c73bd={},_0x5ca5b7={},_0x101bcd={'count':0x0,'rows':[]};var _0x296ab2=_[_0xa291('0x2b')](db[_0xa291('0x2c')][_0xa291('0x2d')],function(_0x5d8e5f){return{'name':_0x5d8e5f['fieldName'],'type':_0x5d8e5f['type'][_0xa291('0x2e')]};});_0x5ca5b7[_0xa291('0x2f')]=_[_0xa291('0x2b')](_0x296ab2,'name');_0x5ca5b7[_0xa291('0x30')]=_[_0xa291('0x31')](_0x51da73[_0xa291('0x30')]);_0x5ca5b7['filters']=_[_0xa291('0x32')](_0x5ca5b7[_0xa291('0x2f')],_0x5ca5b7[_0xa291('0x30')]);_0x2c73bd[_0xa291('0x33')]=_[_0xa291('0x32')](_0x5ca5b7[_0xa291('0x2f')],qs[_0xa291('0x34')](_0x51da73[_0xa291('0x30')][_0xa291('0x34')]));_0x2c73bd[_0xa291('0x33')]=_0x2c73bd[_0xa291('0x33')]['length']?_0x2c73bd[_0xa291('0x33')]:_0x5ca5b7[_0xa291('0x2f')];if(!_0x51da73[_0xa291('0x30')][_0xa291('0x35')](_0xa291('0x36'))){_0x2c73bd['limit']=qs[_0xa291('0x1f')](_0x51da73[_0xa291('0x30')][_0xa291('0x1f')]);_0x2c73bd[_0xa291('0x1e')]=qs[_0xa291('0x1e')](_0x51da73[_0xa291('0x30')][_0xa291('0x1e')]);}_0x2c73bd[_0xa291('0x37')]=qs[_0xa291('0x38')](_0x51da73[_0xa291('0x30')][_0xa291('0x38')]);_0x2c73bd[_0xa291('0x39')]=qs[_0xa291('0x3a')](_[_0xa291('0x3b')](_0x51da73[_0xa291('0x30')],_0x5ca5b7[_0xa291('0x3a')]),_0x296ab2);if(_0x51da73[_0xa291('0x30')][_0xa291('0x3c')]){_0x2c73bd['where']=_[_0xa291('0x3d')](_0x2c73bd[_0xa291('0x39')],{'$or':_['map'](_0x296ab2,function(_0x39ef2c){if(_0x39ef2c[_0xa291('0x3e')]!==_0xa291('0x3f')){var _0x34be72={};_0x34be72[_0x39ef2c[_0xa291('0x2a')]]={'$like':'%'+_0x51da73[_0xa291('0x30')]['filter']+'%'};return _0x34be72;}})});}_0x2c73bd=_[_0xa291('0x3d')]({},_0x2c73bd,_0x51da73[_0xa291('0x40')]);var _0x7e9cb4={'where':_0x2c73bd[_0xa291('0x39')]};return db[_0xa291('0x2c')][_0xa291('0x1d')](_0x7e9cb4)[_0xa291('0x26')](function(_0x3f67d3){_0x101bcd['count']=_0x3f67d3;if(_0x51da73[_0xa291('0x30')]['includeAll']){_0x2c73bd['include']=[{'all':!![]}];}return db['UserProfile'][_0xa291('0x41')](_0x2c73bd);})['then'](function(_0x54eedb){_0x101bcd[_0xa291('0x42')]=_0x54eedb;return _0x101bcd;})['then'](respondWithFilteredResult(_0x5ae469,_0x2c73bd))['catch'](handleError(_0x5ae469,null));};exports['show']=function(_0x14c0aa,_0x5d4400){var _0x4b2458={'raw':![],'where':{'id':_0x14c0aa[_0xa291('0x43')]['id']}},_0x40d64e={};_0x40d64e['model']=_['keys'](db['UserProfile'][_0xa291('0x2d')]);_0x40d64e['query']=_[_0xa291('0x31')](_0x14c0aa[_0xa291('0x30')]);_0x40d64e['filters']=_['intersection'](_0x40d64e[_0xa291('0x2f')],_0x40d64e['query']);_0x4b2458['attributes']=_[_0xa291('0x32')](_0x40d64e['model'],qs['fields'](_0x14c0aa['query'][_0xa291('0x34')]));_0x4b2458[_0xa291('0x33')]=_0x4b2458['attributes'][_0xa291('0x44')]?_0x4b2458[_0xa291('0x33')]:_0x40d64e[_0xa291('0x2f')];if(_0x14c0aa[_0xa291('0x30')][_0xa291('0x45')]){_0x4b2458[_0xa291('0x46')]=[{'all':!![]}];}_0x4b2458=_[_0xa291('0x3d')]({},_0x4b2458,_0x14c0aa[_0xa291('0x40')]);return db['UserProfile'][_0xa291('0x47')](_0x4b2458)['then'](handleEntityNotFound(_0x5d4400,null))[_0xa291('0x26')](respondWithResult(_0x5d4400,null))[_0xa291('0x48')](handleError(_0x5d4400,null));};exports[_0xa291('0x49')]=function(_0x10db1c,_0x31ebb0){return db[_0xa291('0x2c')]['create'](_0x10db1c[_0xa291('0x4a')],{})[_0xa291('0x26')](respondWithResult(_0x31ebb0,0xc9))[_0xa291('0x48')](handleError(_0x31ebb0,null));};exports['clone']=function(_0x478a12,_0x578853){var _0x44dce8={'where':{'id':_0x478a12['params']['id']}},_0x1781cf={};_0x1781cf[_0xa291('0x2f')]=_[_0xa291('0x31')](db[_0xa291('0x2c')][_0xa291('0x2d')]);_0x44dce8['attributes']=_['intersection'](_0x1781cf[_0xa291('0x2f')],qs[_0xa291('0x34')](_0x478a12[_0xa291('0x30')][_0xa291('0x34')]));_0x44dce8['attributes']=_0x44dce8[_0xa291('0x33')]['length']?_0x44dce8[_0xa291('0x33')]:_0x1781cf[_0xa291('0x2f')];if(_0x478a12[_0xa291('0x30')][_0xa291('0x45')]){_0x44dce8[_0xa291('0x46')]=[{'all':!![]}];}_0x44dce8=_[_0xa291('0x3d')]({},_0x44dce8,_0x478a12[_0xa291('0x40')]);return db[_0xa291('0x2c')]['find'](_0x44dce8)[_0xa291('0x26')](handleEntityNotFound(_0x578853,null))[_0xa291('0x26')](function(_0x2f8312){if(_0x2f8312){var _0x16fce1=_0x2f8312[_0xa291('0x4b')]({'plain':!![]});_0x16fce1=qs[_0xa291('0x4c')](_0x16fce1,['id','createdAt',_0xa291('0x4d'),_0xa291('0x4e')]);_0x478a12[_0xa291('0x4a')]=_[_0xa291('0x4c')](_0x478a12[_0xa291('0x4a')],['id',_0xa291('0x4f'),_0xa291('0x4d')]);return db[_0xa291('0x50')][_0xa291('0x51')](function(_0xb62eab){return db[_0xa291('0x2c')][_0xa291('0x49')](_['merge'](_0x16fce1,_0x478a12[_0xa291('0x4a')]),{'include':_0x478a12[_0xa291('0x30')][_0xa291('0x45')]?[{'all':!![]}]:undefined,'transaction':_0xb62eab})[_0xa291('0x26')](function(_0x7bc7b6){var _0x240e44=_0x7bc7b6[_0xa291('0x4b')]({'plain':!![]});return db[_0xa291('0x52')][_0xa291('0x41')]({'where':{'userProfileId':_0x478a12[_0xa291('0x43')]['id']},'raw':!![]})['then'](function(_0x452579){if(_0x452579){return BPromise['each'](_0x452579,function(_0x22d7a3){return new BPromise(function(_0x418b2e,_0x8f9f3){if(_0x22d7a3[_0xa291('0x53')]===null||_0x22d7a3[_0xa291('0x53')]===0x1)_0x418b2e(null);return db[_0xa291('0x54')]['findAll']({'where':{'sectionId':_0x22d7a3['id']},'raw':!![]})['then'](function(_0x10b872){var _0xc20353=_[_0xa291('0x2b')](_0x10b872,function(_0x381030){return qs[_0xa291('0x4c')](_0x381030,['id','createdAt',_0xa291('0x4d'),'sectionId']);});_0x418b2e(_0xc20353);})[_0xa291('0x48')](function(_0x466ac1){_0x8f9f3(_0x466ac1);});})['then'](function(_0x213d90){var _0x8a91a1=qs[_0xa291('0x4c')](_0x22d7a3,['id',_0xa291('0x4f'),_0xa291('0x4d')]);_0x8a91a1[_0xa291('0x55')]=_0x240e44['id'];if(_0x213d90)_0x8a91a1[_0xa291('0x56')]=_0x213d90;return _0x8a91a1;})[_0xa291('0x26')](function(_0xfde5fd){return db[_0xa291('0x52')][_0xa291('0x49')](_0xfde5fd,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0xb62eab});});})[_0xa291('0x26')](function(){return _0x240e44;});}});});});}})[_0xa291('0x26')](respondWithResult(_0x578853,0xc9))['catch'](handleError(_0x578853,null));};exports[_0xa291('0x25')]=function(_0x1d81f7,_0x5a8c84){if(_0x1d81f7[_0xa291('0x4a')]['id']){delete _0x1d81f7['body']['id'];}return db[_0xa291('0x2c')][_0xa291('0x47')]({'where':{'id':_0x1d81f7['params']['id']}})[_0xa291('0x26')](handleEntityNotFound(_0x5a8c84,null))['then'](saveUpdates(_0x1d81f7['body'],null))[_0xa291('0x26')](respondWithResult(_0x5a8c84,null))[_0xa291('0x48')](handleError(_0x5a8c84,null));};exports[_0xa291('0x27')]=function(_0x2e2097,_0x341d16){return db['UserProfile'][_0xa291('0x47')]({'where':{'id':_0x2e2097[_0xa291('0x43')]['id']}})[_0xa291('0x26')](handleEntityNotFound(_0x341d16,null))[_0xa291('0x26')](removeEntity(_0x341d16,null))[_0xa291('0x48')](handleError(_0x341d16,null));};exports['describe']=function(_0x348fbd,_0x42aa5a){return db[_0xa291('0x2c')][_0xa291('0x57')]()[_0xa291('0x26')](respondWithResult(_0x42aa5a,null))['catch'](handleError(_0x42aa5a,null));};exports[_0xa291('0x58')]=function(_0x4f4dd5,_0x1dda83){var _0x2f75d2=_0x4f4dd5[_0xa291('0x4a')];return db[_0xa291('0x2c')][_0xa291('0x47')]({'where':{'id':_0x4f4dd5['params']['id']}})['then'](handleEntityNotFound(_0x1dda83,null))['then'](function(_0x11c284){if(_0x11c284){return db[_0xa291('0x50')]['transaction'](function(_0x5be2ab){return db[_0xa291('0x52')][_0xa291('0x27')]({'where':{'userProfileId':_0x4f4dd5[_0xa291('0x43')]['id'],'sectionId':_['map'](_0x2f75d2,function(_0xde978b){return _0xde978b['sectionId'];})},'transaction':_0x5be2ab})['then'](function(){var _0x108577=_['map'](_0x2f75d2,function(_0x3b244d){_0x3b244d['userProfileId']=_0x4f4dd5[_0xa291('0x43')]['id'];return _0x3b244d;});var _0x26cdc2=[];return BPromise[_0xa291('0x59')](_0x108577,function(_0x29a2fb){return db[_0xa291('0x52')][_0xa291('0x49')](_0x29a2fb,{'include':[{'model':db[_0xa291('0x54')],'as':_0xa291('0x56')}],'raw':!![],'transaction':_0x5be2ab})[_0xa291('0x26')](function(_0x442f7b){_0x26cdc2[_0xa291('0x5a')](_0x442f7b[_0xa291('0x4b')]({'plain':!![]}));});})['then'](function(){return _0x26cdc2;});});});}})[_0xa291('0x26')](function(_0x166cc6){return _0x166cc6;})[_0xa291('0x26')](respondWithResult(_0x1dda83,null))[_0xa291('0x48')](handleError(_0x1dda83,null));};exports['removeSections']=function(_0x41d4df,_0x86ff1){var _0x370d56;return db[_0xa291('0x2c')][_0xa291('0x47')]({'where':{'id':_0x41d4df['params']['id']},'attributes':['id',_0xa291('0x2a')]})[_0xa291('0x26')](handleEntityNotFound(_0x86ff1,null))[_0xa291('0x26')](function(_0x23db11){if(_0x23db11){_0x370d56=_0x23db11;return db[_0xa291('0x52')]['destroy']({'where':{'userProfileId':_0x41d4df[_0xa291('0x43')]['id'],'sectionId':_0x41d4df[_0xa291('0x30')][_0xa291('0x5b')]}});}})[_0xa291('0x26')](function(){return _0x370d56;})[_0xa291('0x26')](respondWithStatusCode(_0x86ff1,null))[_0xa291('0x48')](handleError(_0x86ff1,null));};exports['getSections']=function(_0x4621e6,_0x51b698){var _0x74dd07=[];var _0x53809a=[];return db[_0xa291('0x52')]['findAll']({'where':{'userProfileId':_0x4621e6[_0xa291('0x43')]['id']},'raw':!![]})['then'](function(_0x1c65c4){_0x74dd07=_[_0xa291('0x3c')](_0x1c65c4,function(_0x3c85b8){return _0x3c85b8[_0xa291('0x5c')]===0x1||_[_0xa291('0x5d')]([0x3eb,0x709],_0x3c85b8[_0xa291('0x5e')]);});if(!_[_0xa291('0x5f')](_0x74dd07)){return _[_0xa291('0x2b')](_0x74dd07,function(_0x2cc21c){return _0x2cc21c[_0xa291('0x5e')];});}else{return;}})[_0xa291('0x26')](function(_0x35251c){if(_0x35251c)_0x53809a=_0x35251c;if(_[_0xa291('0x5d')](_0x53809a,0x64)){var _0x23521b=_[_0xa291('0x47')](_0x74dd07,{'sectionId':0x64});return hasDefaultDashboard(_0x23521b)['then'](function(_0x5a803e){return _['map'](_0x74dd07,function(_0x2dfc84){if(_0x2dfc84[_0xa291('0x5e')]===0x64){_0x2dfc84['subsections']=_0x5a803e;}return _0x2dfc84;});});}else{return;}})[_0xa291('0x26')](function(_0x19f30a){if(_0x19f30a)_0x74dd07=_0x19f30a;if(_[_0xa291('0x5d')](_0x53809a,0x3eb)){var _0x430dbb=_[_0xa291('0x47')](_0x74dd07,{'sectionId':0x3eb});return getCustomDashboards(_0x430dbb)[_0xa291('0x26')](function(_0x282c03){return _[_0xa291('0x2b')](_0x74dd07,function(_0x3f161d){if(_0x430dbb['enabled']){if(_0x3f161d[_0xa291('0x5e')]===0x3eb){_0x3f161d[_0xa291('0x60')]=_0x282c03;}}else{if(_0x3f161d[_0xa291('0x5e')]===0x64){_0x3f161d['subsections']=_0x282c03;}}return _0x3f161d;});});}else{return;}})[_0xa291('0x26')](function(_0x236e2d){if(_0x236e2d)_0x74dd07=_0x236e2d;if(_['includes'](_0x53809a,0x709)){var _0x1b7966=_[_0xa291('0x47')](_0x74dd07,{'sectionId':0x709});return getPlugins(_0x1b7966)[_0xa291('0x26')](function(_0x13cfad){if(_0x1b7966[_0xa291('0x5c')]){return _[_0xa291('0x2b')](_0x74dd07,function(_0x40d499){if(_0x40d499[_0xa291('0x5e')]===0x709){_0x40d499[_0xa291('0x60')]=_0x13cfad;}return _0x40d499;});}else{var _0x458e98={'sectionId':0x76c,'enabled':0x1,'subsections':_0x13cfad};var _0x172222=_[_0xa291('0x2b')](_0x74dd07);_0x172222[_0xa291('0x5a')](_0x458e98);return _0x172222;}});}else{return;}})[_0xa291('0x26')](function(_0xe589c6){if(_0xe589c6)_0x74dd07=_0xe589c6;return _[_0xa291('0x3c')](_0x74dd07,[_0xa291('0x5c'),0x1]);})[_0xa291('0x26')](respondWithResult(_0x51b698,null))[_0xa291('0x48')](handleError(_0x51b698,null));};function hasDefaultDashboard(_0x5c9406){var _0x248f38=[0x65];return new BPromise(function(_0x3b873b,_0x16cc7d){try{if(_0x5c9406[_0xa291('0x53')]){_0x3b873b(_0x248f38);}else{return db['UserProfileResource'][_0xa291('0x61')]({'where':{'sectionId':_0x5c9406['id']},'raw':!![]})[_0xa291('0x26')](function(_0x27c14d){_0x27c14d?_0x3b873b(_0x248f38):_0x3b873b();});}}catch(_0x2ac9e6){_0x16cc7d(_0x2ac9e6);}});}function getCustomDashboards(_0x99bc9){var _0x5c3c1d=[];return new BPromise(function(_0xe3dd5f,_0x2a3896){try{if(_0x99bc9[_0xa291('0x53')]){return db[_0xa291('0x62')][_0xa291('0x41')]({'raw':!![]})[_0xa291('0x26')](function(_0x5c3862){_0x5c3862[_0xa291('0x63')](function(_0x45335d){_0x5c3c1d[_0xa291('0x5a')](_0x45335d['id']+0x1869f);});_0xe3dd5f(_0x5c3c1d);});}else{return db[_0xa291('0x54')][_0xa291('0x41')]({'where':{'sectionId':_0x99bc9['id']},'raw':!![]})[_0xa291('0x26')](function(_0x46ed95){_0x46ed95[_0xa291('0x63')](function(_0x577948){_0x5c3c1d[_0xa291('0x5a')](_0x577948[_0xa291('0x64')]+0x1869f);});_0xe3dd5f(_0x5c3c1d);});}}catch(_0xefef89){_0x2a3896(_0xefef89);}});}function getPlugins(_0x5950e1){var _0x510c7b=[];return new BPromise(function(_0x498dec,_0x5d5916){try{if(_0x5950e1['autoAssociation']){return db[_0xa291('0x65')][_0xa291('0x41')]({'raw':!![]})[_0xa291('0x26')](function(_0x41b518){_0x41b518[_0xa291('0x63')](function(_0x1ad1a0){_0x510c7b[_0xa291('0x5a')](_0x1ad1a0['id']+0x15b38);});_0x498dec(_0x510c7b);});}else{return db[_0xa291('0x54')][_0xa291('0x41')]({'where':{'sectionId':_0x5950e1['id']},'raw':!![]})[_0xa291('0x26')](function(_0x4193bb){_0x4193bb['forEach'](function(_0x183e4d){_0x510c7b[_0xa291('0x5a')](_0x183e4d['resourceId']+0x15b38);});_0x498dec(_0x510c7b);});}}catch(_0x1ef075){_0x5d5916(_0x1ef075);}});}exports[_0xa291('0x66')]=function(_0x403d02,_0x5eb287){return db[_0xa291('0x2c')][_0xa291('0x47')]({'where':{'id':_0x403d02[_0xa291('0x43')]['id']}})[_0xa291('0x26')](handleEntityNotFound(_0x5eb287,null))[_0xa291('0x26')](function(_0x26f626){if(_0x26f626){return db[_0xa291('0x50')][_0xa291('0x51')](function(_0x523b4a){return db[_0xa291('0x52')][_0xa291('0x41')]({'where':{'userProfileId':_0x403d02[_0xa291('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0xa291('0x26')](function(_0x1a39df){if(_0x1a39df){return db[_0xa291('0x52')][_0xa291('0x27')]({'where':{'userProfileId':_0x403d02['params']['id'],'id':_[_0xa291('0x2b')](_0x1a39df,function(_0x3498b3){return _0x3498b3['id'];})},'transaction':_0x523b4a});}})[_0xa291('0x26')](function(_0x2bdda3){var _0x34d7f3=_[_0xa291('0x2b')](_0x403d02[_0xa291('0x4a')],function(_0x178b0f){_0x178b0f[_0xa291('0x55')]=_0x403d02[_0xa291('0x43')]['id'];return _0x178b0f;});return db[_0xa291('0x52')][_0xa291('0x67')](_0x34d7f3,{'raw':!![],'transaction':_0x523b4a});})[_0xa291('0x26')](function(_0x59e1ba){var _0x2f9913=_[_0xa291('0x3c')](_[_0xa291('0x2b')](_0x59e1ba,function(_0x2682d4){return _0x2682d4[_0xa291('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x2f9913){return db[_0xa291('0x52')][_0xa291('0x41')]({'where':{'userProfileId':_0x403d02[_0xa291('0x43')]['id'],'sectionId':_[_0xa291('0x2b')](_0x2f9913,function(_0x520765){return _0x520765[_0xa291('0x5e')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x48af98){var _0x311548=_[_0xa291('0x2b')](_0x403d02[_0xa291('0x4a')],function(_0x422bab){_0x422bab[_0xa291('0x55')]=_0x403d02[_0xa291('0x43')]['id'];return _0x422bab;});return db[_0xa291('0x54')][_0xa291('0x67')](_0x311548,{'raw':!![],'transaction':_0x523b4a});});}})['catch'](handleError(_0x5eb287,null));});}})[_0xa291('0x26')](function(_0x357c5b){var _0x1ccdcd=_[_0xa291('0x2b')](_0x357c5b,function(_0x20bdd7){return _0x20bdd7[_0xa291('0x4b')]({'plain':!![]});});})['then'](respondWithResult(_0x5eb287,null))[_0xa291('0x48')](handleError(_0x5eb287,null));};exports['removeResources']=function(_0xfc8055,_0x3bf0aa,_0x5a273e){return db['UserProfile']['find']({'where':{'id':_0xfc8055[_0xa291('0x43')]['id']}})[_0xa291('0x26')](handleEntityNotFound(_0x3bf0aa,null))[_0xa291('0x26')](function(_0x236dbf){if(_0x236dbf){return _0x236dbf[_0xa291('0x68')](_0xfc8055['query'][_0xa291('0x5b')]);}})[_0xa291('0x26')](respondWithStatusCode(_0x3bf0aa,null))[_0xa291('0x48')](handleError(_0x3bf0aa,null));};exports[_0xa291('0x69')]=function(_0x50ccce,_0x392a94){var _0xe63538={'raw':![],'where':{}};var _0x40ad51={};var _0x4183b9={'count':0x0,'rows':[]};var _0x57e902=_0x50ccce['query'][_0xa291('0x6a')];if(typeof _0x57e902==='undefined'){throw new db[(_0xa291('0x6b'))]['ValidationError']('Unknown\x20section');}var _0xa986c4=_0x50ccce[_0xa291('0x30')][_0xa291('0x6c')]||![];var _0x15183e=getQueryModels(_0x57e902,_0xa986c4);if(typeof _0x15183e[_0xa291('0x6d')]===_0xa291('0x6e')){throw new db[(_0xa291('0x6b'))][(_0xa291('0x6f'))]('Invalid\x20section\x20\x27'+_0x57e902+'\x27');}var _0x3fd768=[];if(!_[_0xa291('0x5f')](_0x15183e['parentSections'])){_0x3fd768=_0x15183e[_0xa291('0x70')];}else{_0x3fd768=[{'name':_0x57e902}];}return db['UserProfile'][_0xa291('0x61')]({'where':{'id':_0x50ccce[_0xa291('0x43')]['id']}})['then'](handleEntityNotFound(_0x392a94,null))[_0xa291('0x26')](function(_0x48a188){if(_0x48a188){var _0x176804=[];for(var _0x31e146=0x0;_0x31e146<_0x3fd768[_0xa291('0x44')];_0x31e146++){_0x176804[_0xa291('0x5a')](db[_0xa291('0x52')][_0xa291('0x61')]({'where':{'userProfileId':_0x48a188['id'],'name':_0x3fd768[_0x31e146][_0xa291('0x2a')]},'raw':!![]}));}return BPromise[_0xa291('0x71')](_0x176804);}})[_0xa291('0x26')](function(_0x35b1c9){var _0x599aed=_[_0xa291('0x3c')](_0x35b1c9,function(_0x55a432){return _0x55a432?_0x55a432:undefined;});var _0x1ff315=_[_0xa291('0x3c')](_0x3fd768,[_0xa291('0x72'),!![]]);var _0x3f7053=_[_0xa291('0x5f')](_0x599aed)&&_[_0xa291('0x5f')](_0x1ff315)?null:_['union'](_0x1ff315,_0x599aed);if(_0x3f7053){var _0x3fcb90=[];for(var _0x5c211d=0x0;_0x5c211d<_0x3f7053['length'];_0x5c211d++){var _0x22415f=_['find'](_0x3fd768,function(_0x2746c9){return _0x3f7053[_0x5c211d]?_0x2746c9[_0xa291('0x2a')]===_0x3f7053[_0x5c211d][_0xa291('0x2a')]:null;});if(_0x22415f){if(_0x3f7053[_0x5c211d][_0xa291('0x72')]){_0x3fcb90[_0xa291('0x5a')](getAllResources(_0x15183e[_0xa291('0x6d')],_0x3f7053[_0x5c211d]));}else{if(!_0x3f7053[_0x5c211d][_0xa291('0x53')]){_0x3fcb90[_0xa291('0x5a')](getAllowedResources(_0x22415f,_0x3f7053[_0x5c211d],_0x15183e['childModel']));}else{if(_0x22415f['model']){_0x3fcb90['push'](getAllFilteredResources(_0x22415f,_0x3f7053[_0x5c211d]));}}}}}return BPromise[_0xa291('0x71')](_0x3fcb90);}else{return null;}})[_0xa291('0x26')](function(_0x579535){var _0x403f74=_0x579535;var _0x493650=null;if(_0x403f74){_0x493650=_0x403f74['length']===0x1?_0x403f74[0x0]:null;}if(_0x493650||_0x403f74){var _0x3535b8=db[_0x15183e['childModel']]['rawAttributes'];_0x40ad51[_0xa291('0x2f')]=_['keys'](_0x3535b8);_0x40ad51[_0xa291('0x30')]=_[_0xa291('0x31')](_0x50ccce[_0xa291('0x30')]);_0x40ad51['filters']=_['intersection'](_0x40ad51[_0xa291('0x2f')],_0x40ad51['query']);_0xe63538[_0xa291('0x33')]=_['intersection'](_0x40ad51['model'],qs[_0xa291('0x34')](_0x50ccce[_0xa291('0x30')]['fields']));_0xe63538[_0xa291('0x33')]=_0xe63538[_0xa291('0x33')][_0xa291('0x44')]?_0xe63538[_0xa291('0x33')]:_0x40ad51[_0xa291('0x2f')];if(!_0x50ccce['query']['hasOwnProperty'](_0xa291('0x36'))){_0xe63538[_0xa291('0x1f')]=qs[_0xa291('0x1f')](_0x50ccce[_0xa291('0x30')][_0xa291('0x1f')]);_0xe63538['offset']=qs[_0xa291('0x1e')](_0x50ccce['query'][_0xa291('0x1e')]);}_0xe63538[_0xa291('0x37')]=qs['sort'](_0x50ccce[_0xa291('0x30')][_0xa291('0x38')]);_0xe63538['where']=qs[_0xa291('0x3a')](_['pick'](_0x50ccce[_0xa291('0x30')],_0x40ad51[_0xa291('0x3a')]));if(_0x50ccce['query']['filter']){_0xe63538[_0xa291('0x39')]=_[_0xa291('0x3d')](_0xe63538[_0xa291('0x39')],{'$or':_[_0xa291('0x2b')](_0x3535b8,function(_0x5d4426){if(_0x5d4426['type'][_0xa291('0x2e')]!==_0xa291('0x3f')){var _0x220918={};_0x220918[_0x5d4426[_0xa291('0x73')]]={'$like':'%'+_0x50ccce[_0xa291('0x30')][_0xa291('0x3c')]+'%'};return _0x220918;}})});}var _0x281088=[];if(_0x493650){var _0x302c87=_[_0xa291('0x47')](_0x3fd768,[_0xa291('0x2a'),_0x493650[_0xa291('0x2a')]]);if(_0x302c87[_0xa291('0x73')]){var _0x52cfc7={};if(_0x15183e[_0xa291('0x6d')]==='AnalyticExtractedReport'){_0x52cfc7[_0x302c87['foreignKey']]=_[_0xa291('0x2b')](_0x493650[_0xa291('0x74')],'id');}else{_0x52cfc7[_0x302c87[_0xa291('0x75')]]=_0x493650[_0xa291('0x74')];}_0x281088[_0xa291('0x5a')](_0x52cfc7);}else{_0xe63538[_0xa291('0x39')]['id']=_0x493650[_0xa291('0x74')];}}else{for(var _0x51595d=0x0;_0x51595d<_0x403f74[_0xa291('0x44')];_0x51595d++){var _0x302c87=_[_0xa291('0x47')](_0x3fd768,[_0xa291('0x2a'),_0x403f74[_0x51595d]['name']]);if(_0x302c87[_0xa291('0x73')]){var _0x52cfc7={};_0x52cfc7[_0x302c87[_0xa291('0x75')]]=_0x403f74[_0x51595d][_0xa291('0x74')];_0x281088[_0xa291('0x5a')](_0x52cfc7);}else{if(!_0xe63538[_0xa291('0x39')]['id'])_0xe63538[_0xa291('0x39')]['id']=[];_0x403f74[_0x51595d]['associatedResources'][_0xa291('0x63')](function(_0x2fb5a2){_0xe63538[_0xa291('0x39')]['id']['push'](_0x2fb5a2);});}}}if(!_['isEmpty'](_0x281088)){_0xe63538[_0xa291('0x39')]=_[_0xa291('0x3d')](_0xe63538[_0xa291('0x39')],{'$and':{'$or':_0x281088}});}_0xe63538=_[_0xa291('0x3d')]({},_0xe63538,_0x50ccce[_0xa291('0x40')]);if(_0x493650&&!_0x493650[_0xa291('0x53')]&&_0x15183e[_0xa291('0x6d')]===_0xa291('0x76')){if(_0x50ccce[_0xa291('0x30')][_0xa291('0x45')]){_0xe63538[_0xa291('0x46')]=[{'all':!![]}];}return db[_0x15183e[_0xa291('0x6d')]]['findAll'](_0xe63538)['then'](function(_0x40c61f){var _0x4f7319=[];_0x40c61f[_0xa291('0x63')](function(_0x439272){var _0x1ae65a;switch(_0x439272[_0xa291('0x77')]){case _0xa291('0x78'):_0x1ae65a=_[_0xa291('0x47')](_0x493650[_0xa291('0x74')],function(_0x2239a6){return _0x2239a6['id']===_0x439272[_0xa291('0x79')]&&_0x2239a6['type']===_0xa291('0x7a');});break;case _0xa291('0x7b'):_0x1ae65a=_['find'](_0x493650[_0xa291('0x74')],function(_0xf567fd){return _0xf567fd['id']===_0x439272[_0xa291('0x79')]&&_0xf567fd[_0xa291('0x3e')]===_0xa291('0x7c');});break;}if(_0x1ae65a)_0x4f7319[_0xa291('0x5a')](_0x439272);});_0x4183b9[_0xa291('0x1d')]=_0x4f7319[_0xa291('0x44')];_0x4183b9[_0xa291('0x42')]=_0x4f7319;return _0x4183b9;});}else{return db[_0x15183e[_0xa291('0x6d')]][_0xa291('0x1d')]({'where':_0xe63538[_0xa291('0x39')]})['then'](function(_0x262d1d){_0x4183b9[_0xa291('0x1d')]=_0x262d1d;if(_0x50ccce['query']['includeAll']){if(_0x15183e[_0xa291('0x6d')]===_0xa291('0x7d')){_0xe63538['include']=[{'model':db[_0xa291('0x7e')],'as':_0xa291('0x7f'),'attributes':['id',_0xa291('0x2a'),_0xa291('0x80')],'required':_0x50ccce[_0xa291('0x30')]['tag']?!![]:![]},{'model':db[_0xa291('0x7e')],'as':_0xa291('0x81'),'attributes':['id',_0xa291('0x2a'),'color'],'through':_0x50ccce[_0xa291('0x30')][_0xa291('0x82')]?{'attributes':[],'where':{'TagId':_0x50ccce['query'][_0xa291('0x82')]||undefined}}:{},'required':_0x50ccce[_0xa291('0x30')][_0xa291('0x82')]?!![]:![]}];}else{_0xe63538[_0xa291('0x46')]=[{'all':!![]}];}}return db[_0x15183e[_0xa291('0x6d')]][_0xa291('0x41')](_0xe63538);})[_0xa291('0x26')](function(_0x38ce06){_0x4183b9['rows']=_0x38ce06;return _0x4183b9;});}}else{return _0x4183b9;}})[_0xa291('0x26')](respondWithFilteredResult(_0x392a94,_0xe63538))[_0xa291('0x48')](handleError(_0x392a94,null));};function getAllResources(_0x41493c,_0x4b959d){return new BPromise(function(_0x394a52,_0x4170b3){if(_0x4b959d){var _0x10fc01=_0x4b959d[_0xa291('0x3c')]?{[_0x4b959d[_0xa291('0x3c')]['field']]:_0x4b959d['filter'][_0xa291('0x83')]}:undefined;return db[_0x41493c][_0xa291('0x41')]({'where':_0x10fc01,'raw':!![]})[_0xa291('0x26')](function(_0x29f8c3){_0x4b959d['associatedResources']=_[_0xa291('0x2b')](_0x29f8c3,'id');_0x394a52(_0x4b959d);})[_0xa291('0x48')](function(_0x1659e0){_0x4170b3(_0x1659e0);});}else{_0x394a52(null);}});}function getAllFilteredResources(_0x5d1dc7,_0x4dec3d){return new BPromise(function(_0x89b970,_0x49a3b1){var _0x4b3c52=_0x5d1dc7[_0xa291('0x3c')]?{[_0x5d1dc7[_0xa291('0x3c')][_0xa291('0x73')]]:_0x5d1dc7[_0xa291('0x3c')][_0xa291('0x83')]}:undefined;return db[_0x5d1dc7[_0xa291('0x2f')]][_0xa291('0x41')]({'where':_0x4b3c52,'raw':!![]})[_0xa291('0x26')](function(_0x633df1){_0x4dec3d['associatedResources']=_[_0xa291('0x2b')](_0x633df1,function(_0x2c7149){return _0x2c7149[_0xa291('0x2a')];});_0x89b970(_0x4dec3d);})[_0xa291('0x48')](function(_0x3a5eba){_0x49a3b1(_0x3a5eba);});});}function getAllowedResources(_0x3c9fc8,_0x406dd0,_0x369859){return new BPromise(function(_0x5e9a7a,_0x48dbe2){if(_0x406dd0){return db[_0xa291('0x54')][_0xa291('0x41')]({'where':{'sectionId':_0x406dd0['id']},'raw':!![]})[_0xa291('0x26')](function(_0x384cb8){if(_0x3c9fc8['field']&&_0x3c9fc8['field']!=='id'){_0x406dd0[_0xa291('0x74')]=_[_0xa291('0x2b')](_0x384cb8,function(_0x5e1d4f){return _0x5e1d4f[_0x3c9fc8['field']];});}else{if(_0x369859===_0xa291('0x76')){_0x406dd0['associatedResources']=_[_0xa291('0x2b')](_0x384cb8,function(_0x223fd3){return{'id':_0x223fd3[_0xa291('0x64')],'type':_0x223fd3[_0xa291('0x3e')]};});}else{_0x406dd0['associatedResources']=_['map'](_0x384cb8,function(_0x5595d0){return _0x5595d0[_0xa291('0x64')];});}}_0x5e9a7a(_0x406dd0);})[_0xa291('0x48')](function(_0x106c59){_0x48dbe2(_0x106c59);});}else{_0x5e9a7a(null);}});}function getQueryModels(_0xe5663c,_0xfc425e){var _0x22a386=_0xe5663c['toLowerCase']();var _0x42e89e={'childModel':undefined,'parentSections':[]};switch(_0x22a386){case _0xa291('0x84'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x85');break;case _0xa291('0x86'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x87');break;case _0xa291('0x88'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x89');_0x42e89e[_0xa291('0x70')]=[{'name':_0xa291('0x8a'),'field':'name','foreignKey':_0xa291('0x8b')}];break;case _0xa291('0x8c'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x8d');break;case _0xa291('0x8e'):_0x42e89e['childModel']=_0xa291('0x7d');_0x42e89e[_0xa291('0x70')]=[{'name':'Lists','field':'id','foreignKey':_0xa291('0x8f')}];break;case _0xa291('0x90'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x91');break;case _0xa291('0x92'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x93');break;case _0xa291('0x94'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x95');break;case _0xa291('0x96'):_0x42e89e[_0xa291('0x6d')]='ChatQueue';break;case _0xa291('0x97'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x98');break;case _0xa291('0x99'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x9a');break;case'faxaccounts':_0x42e89e[_0xa291('0x6d')]='FaxAccount';break;case _0xa291('0x9b'):case _0xa291('0x9c'):case _0xa291('0x9d'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0x9e');break;case _0xa291('0x9f'):_0x42e89e['childModel']='VoiceContext';break;case _0xa291('0xa0'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xa1');break;case _0xa291('0xa2'):_0x42e89e['childModel']=_0xa291('0xa3');_0x42e89e[_0xa291('0x70')]=[{'name':_0xa291('0xa4'),'field':_0xa291('0x2a'),'foreignKey':_0xa291('0xa5'),'model':'User','filter':{'field':_0xa291('0xa6'),'value':['agent']}},{'name':_0xa291('0xa7'),'field':_0xa291('0x2a'),'foreignKey':_0xa291('0xa5'),'model':'User','filter':{'field':_0xa291('0xa6'),'value':[_0xa291('0xa8')]}},{'name':_0xa291('0xa9'),'field':'name','foreignKey':'queue','model':_0xa291('0xaa'),'filter':{'field':_0xa291('0x3e'),'value':[_0xa291('0xab')]}},{'name':'QueueCampaigns','field':_0xa291('0x2a'),'foreignKey':_0xa291('0xac'),'model':_0xa291('0xaa'),'filter':{'field':_0xa291('0x3e'),'value':[_0xa291('0xad')]}}];break;case _0xa291('0xae'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xaf');break;case _0xa291('0xb0'):_0x42e89e['childModel']=_0xa291('0xb1');break;case _0xa291('0xb2'):_0x42e89e['childModel']='VoicePrefix';break;case _0xa291('0xb3'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xb4');break;case _0xa291('0xb5'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xb6');break;case _0xa291('0xb7'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xb8');break;case _0xa291('0xb9'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xba');break;case _0xa291('0xbb'):_0x42e89e[_0xa291('0x6d')]='OpenchannelQueue';break;case _0xa291('0xbc'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xbd');break;case _0xa291('0xbe'):_0x42e89e['childModel']=_0xa291('0xbf');break;case _0xa291('0xc0'):_0x42e89e[_0xa291('0x6d')]='SmsAccount';break;case _0xa291('0xc1'):_0x42e89e[_0xa291('0x6d')]='WhatsappQueue';break;case'whatsappaccounts':_0x42e89e[_0xa291('0x6d')]=_0xa291('0xc2');break;case _0xa291('0xc3'):_0x42e89e['childModel']=_0xa291('0xc4');break;case _0xa291('0xc5'):case _0xa291('0xc6'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xaa');if(_0xfc425e){_0x42e89e[_0xa291('0x70')]=[{'name':'VoiceQueues'},{'name':_0xa291('0xc7')}];}break;case'users':case _0xa291('0xc8'):case _0xa291('0xc9'):_0x42e89e['childModel']='User';if(_0xfc425e){_0x42e89e[_0xa291('0x70')]=[{'name':_0xa291('0xca'),'filter':{'field':_0xa291('0xa6'),'value':[_0xa291('0xcb'),_0xa291('0xcc')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0xa291('0xcd'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xce');break;case _0xa291('0xcf'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xd0');break;case _0xa291('0xd1'):_0x42e89e['childModel']='FreshdeskAccount';break;case _0xa291('0xd2'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xd3');break;case _0xa291('0xd4'):_0x42e89e['childModel']=_0xa291('0xd5');break;case _0xa291('0xd6'):_0x42e89e['childModel']=_0xa291('0xd7');break;case _0xa291('0xd8'):_0x42e89e['childModel']='User';break;case'cannedanswers':_0x42e89e[_0xa291('0x6d')]='CannedAnswer';break;case _0xa291('0xd9'):_0x42e89e['childModel']=_0xa291('0xda');break;case _0xa291('0xdb'):_0x42e89e['childModel']=_0xa291('0x62');break;case _0xa291('0xdc'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xdd');break;case _0xa291('0xde'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xdf');break;case _0xa291('0xe0'):_0x42e89e['childModel']='Schedule';break;case _0xa291('0xe1'):_0x42e89e['childModel']=_0xa291('0xe2');break;case _0xa291('0xe3'):_0x42e89e[_0xa291('0x6d')]='Tag';break;case'templates':_0x42e89e[_0xa291('0x6d')]=_0xa291('0xe4');break;case _0xa291('0xe5'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xe6');break;case _0xa291('0xe7'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xe8');break;case'variables':_0x42e89e[_0xa291('0x6d')]=_0xa291('0xe9');break;case _0xa291('0xea'):_0x42e89e['childModel']=_0xa291('0x65');break;case'extractedreports':_0x42e89e[_0xa291('0x6d')]=_0xa291('0x76');_0x42e89e[_0xa291('0x70')]=[{'name':'Reports','field':'id','foreignKey':_0xa291('0x79')}];break;case _0xa291('0xeb'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xec');break;case _0xa291('0xed'):_0x42e89e[_0xa291('0x6d')]=_0xa291('0xc2');break;default:return _0x42e89e;}return _0x42e89e;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 05d5fa5..3d27ffb 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 _0x7bcf=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x345b70,_0x4dc245){var _0x23068c=function(_0x2ed4c7){while(--_0x2ed4c7){_0x345b70['push'](_0x345b70['shift']());}};_0x23068c(++_0x4dc245);}(_0x7bcf,0x11c));var _0xf7bc=function(_0x281259,_0x30fc35){_0x281259=_0x281259-0x0;var _0x46d882=_0x7bcf[_0x281259];return _0x46d882;};'use strict';var EventEmitter=require(_0xf7bc('0x0'));var UserProfile=require(_0xf7bc('0x1'))['db'][_0xf7bc('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf7bc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7bc('0x4'),'afterDestroy':_0xf7bc('0x5')};function emitEvent(_0x1066a8){return function(_0xe42037,_0x470169,_0x22933c){UserProfileEvents[_0xf7bc('0x6')](_0x1066a8+':'+_0xe42037['id'],_0xe42037);UserProfileEvents[_0xf7bc('0x6')](_0x1066a8,_0xe42037);_0x22933c(null);};}for(var e in events){if(events[_0xf7bc('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xf7bc('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x22c2=['hook','exports','events','../../mysqldb','UserProfile','save','update','remove','emit','hasOwnProperty'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0x22c2,0x1c4));var _0x222c=function(_0x50f9e6,_0x6f2199){_0x50f9e6=_0x50f9e6-0x0;var _0x424509=_0x22c2[_0x50f9e6];return _0x424509;};'use strict';var EventEmitter=require(_0x222c('0x0'));var UserProfile=require(_0x222c('0x1'))['db'][_0x222c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x222c('0x3'),'afterUpdate':_0x222c('0x4'),'afterDestroy':_0x222c('0x5')};function emitEvent(_0x3738c7){return function(_0x26f958,_0x44df29,_0x1c1093){UserProfileEvents[_0x222c('0x6')](_0x3738c7+':'+_0x26f958['id'],_0x26f958);UserProfileEvents['emit'](_0x3738c7,_0x26f958);_0x1c1093(null);};}for(var e in events){if(events[_0x222c('0x7')](e)){var event=events[e];UserProfile[_0x222c('0x8')](e,emitEvent(event));}}module[_0x222c('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 616b4f2..841d180 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 _0xe049=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe049,0x1ba));var _0x9e04=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe049[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x9e04('0x0'));var util=require(_0x9e04('0x1'));var logger=require(_0x9e04('0x2'))('api');var moment=require(_0x9e04('0x3'));var BPromise=require(_0x9e04('0x4'));var rp=require(_0x9e04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e04('0x6'));var attributes=require(_0x9e04('0x7'));module[_0x9e04('0x8')]=function(_0x206559,_0x5839d1){return _0x206559[_0x9e04('0x9')](_0x9e04('0xa'),attributes,{'tableName':_0x9e04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf410=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','UserProfile'];(function(_0x2a5ba6,_0x5a118f){var _0x4960a8=function(_0x3f5405){while(--_0x3f5405){_0x2a5ba6['push'](_0x2a5ba6['shift']());}};_0x4960a8(++_0x5a118f);}(_0xf410,0x190));var _0x0f41=function(_0x5701f6,_0x5c2f07){_0x5701f6=_0x5701f6-0x0;var _0x37ca9a=_0xf410[_0x5701f6];return _0x37ca9a;};'use strict';var _=require(_0x0f41('0x0'));var util=require(_0x0f41('0x1'));var logger=require(_0x0f41('0x2'))(_0x0f41('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f41('0x4'));var fs=require('fs');var path=require(_0x0f41('0x5'));var rimraf=require(_0x0f41('0x6'));var config=require(_0x0f41('0x7'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x2c61e4,_0x3c71e7){return _0x2c61e4[_0x0f41('0x8')](_0x0f41('0x9'),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 b160706..768f5c5 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 _0x4819=['defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x7977a0,_0x1546f7){var _0x516542=function(_0x11d020){while(--_0x11d020){_0x7977a0['push'](_0x7977a0['shift']());}};_0x516542(++_0x1546f7);}(_0x4819,0xcd));var _0x9481=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x4819[_0x51b0dc];return _0x13fa89;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9481('0xb')](config[_0x9481('0xc')],{'host':_0x9481('0xd'),'port':0x18eb});var socket=require(_0x9481('0xe'))(new Redis(config[_0x9481('0xc')]));require('./userProfile.socket')[_0x9481('0xf')](socket);function respondWithRpcPromise(_0x521d18,_0x2fabf1,_0x564d5b){return new BPromise(function(_0x411d24,_0x2d5d0f){return client[_0x9481('0x10')](_0x521d18,_0x564d5b)[_0x9481('0x11')](function(_0xe84f77){logger[_0x9481('0x12')](_0x9481('0x13'),_0x2fabf1,_0x9481('0x14'));logger[_0x9481('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2fabf1,'request\x20sent',JSON[_0x9481('0x16')](_0xe84f77));if(_0xe84f77[_0x9481('0x17')]){if(_0xe84f77[_0x9481('0x17')][_0x9481('0x18')]===0x1f4){logger[_0x9481('0x17')](_0x9481('0x13'),_0x2fabf1,_0xe84f77[_0x9481('0x17')]['message']);return _0x2d5d0f(_0xe84f77[_0x9481('0x17')][_0x9481('0x19')]);}logger['error'](_0x9481('0x13'),_0x2fabf1,_0xe84f77['error'][_0x9481('0x19')]);return _0x411d24(_0xe84f77[_0x9481('0x17')][_0x9481('0x19')]);}else{logger[_0x9481('0x12')]('UserProfile,\x20%s,\x20%s',_0x2fabf1,'request\x20sent');_0x411d24(_0xe84f77[_0x9481('0x1a')]['message']);}})['catch'](function(_0x26671c){logger[_0x9481('0x17')](_0x9481('0x13'),_0x2fabf1,_0x26671c);_0x2d5d0f(_0x26671c);});});} \ No newline at end of file +var _0x1883=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x378bfb,_0x3331ab){var _0x2b14c1=function(_0x29108a){while(--_0x29108a){_0x378bfb['push'](_0x378bfb['shift']());}};_0x2b14c1(++_0x3331ab);}(_0x1883,0xab));var _0x3188=function(_0xdaf70d,_0x2c4984){_0xdaf70d=_0xdaf70d-0x0;var _0x2dd9a5=_0x1883[_0xdaf70d];return _0x2dd9a5;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});config[_0x3188('0xe')]=_[_0x3188('0xf')](config[_0x3188('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3188('0x10'))(new Redis(config[_0x3188('0xe')]));require('./userProfile.socket')[_0x3188('0x11')](socket);function respondWithRpcPromise(_0x5b7f47,_0xc6040,_0x34fc82){return new BPromise(function(_0x209e31,_0x43b69){return client['request'](_0x5b7f47,_0x34fc82)[_0x3188('0x12')](function(_0x2cdcb2){logger['info']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x3188('0x13'));logger[_0x3188('0x14')](_0x3188('0x15'),_0xc6040,_0x3188('0x13'),JSON[_0x3188('0x16')](_0x2cdcb2));if(_0x2cdcb2[_0x3188('0x17')]){if(_0x2cdcb2['error'][_0x3188('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x2cdcb2[_0x3188('0x17')]['message']);return _0x43b69(_0x2cdcb2['error'][_0x3188('0x19')]);}logger[_0x3188('0x17')](_0x3188('0x1a'),_0xc6040,_0x2cdcb2[_0x3188('0x17')][_0x3188('0x19')]);return _0x209e31(_0x2cdcb2[_0x3188('0x17')]['message']);}else{logger[_0x3188('0x1b')](_0x3188('0x1a'),_0xc6040,_0x3188('0x13'));_0x209e31(_0x2cdcb2[_0x3188('0x1c')][_0x3188('0x19')]);}})[_0x3188('0x1d')](function(_0xac7f48){logger[_0x3188('0x17')]('UserProfile,\x20%s,\x20%s',_0xc6040,_0xac7f48);_0x43b69(_0xac7f48);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b280b90..7d89ad4 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 _0xa8e7=['./userProfile.events','save','remove','update','removeListener','register','length','userProfile:'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa8e7,0x120));var _0x7a8e=function(_0xe3f0b0,_0x43edc9){_0xe3f0b0=_0xe3f0b0-0x0;var _0x3a839e=_0xa8e7[_0xe3f0b0];return _0x3a839e;};'use strict';var UserProfileEvents=require(_0x7a8e('0x0'));var events=[_0x7a8e('0x1'),_0x7a8e('0x2'),_0x7a8e('0x3')];function createListener(_0x1ad18a,_0x39b23f){return function(_0x9a5f4b){_0x39b23f['emit'](_0x1ad18a,_0x9a5f4b);};}function removeListener(_0x403848,_0x4b9aff){return function(){UserProfileEvents[_0x7a8e('0x4')](_0x403848,_0x4b9aff);};}exports[_0x7a8e('0x5')]=function(_0x1e6d5f){for(var _0x130bb0=0x0,_0x5e2a56=events[_0x7a8e('0x6')];_0x130bb0<_0x5e2a56;_0x130bb0++){var _0x4e33e3=events[_0x130bb0];var _0x440898=createListener(_0x7a8e('0x7')+_0x4e33e3,_0x1e6d5f);UserProfileEvents['on'](_0x4e33e3,_0x440898);}}; \ No newline at end of file +var _0xa69e=['save','remove','update','emit','userProfile:','./userProfile.events'];(function(_0x32b0c5,_0x5b3124){var _0x33a903=function(_0x11a9aa){while(--_0x11a9aa){_0x32b0c5['push'](_0x32b0c5['shift']());}};_0x33a903(++_0x5b3124);}(_0xa69e,0x1df));var _0xea69=function(_0x395c99,_0x139077){_0x395c99=_0x395c99-0x0;var _0x3298b8=_0xa69e[_0x395c99];return _0x3298b8;};'use strict';var UserProfileEvents=require(_0xea69('0x0'));var events=[_0xea69('0x1'),_0xea69('0x2'),_0xea69('0x3')];function createListener(_0x586e07,_0x4367dc){return function(_0x3dbc22){_0x4367dc[_0xea69('0x4')](_0x586e07,_0x3dbc22);};}function removeListener(_0x269bd3,_0x59588c){return function(){UserProfileEvents['removeListener'](_0x269bd3,_0x59588c);};}exports['register']=function(_0x5d16ee){for(var _0x32cdc7=0x0,_0x2d672d=events['length'];_0x32cdc7<_0x2d672d;_0x32cdc7++){var _0x32da98=events[_0x32cdc7];var _0x298fa4=createListener(_0xea69('0x5')+_0x32da98,_0x5d16ee);UserProfileEvents['on'](_0x32da98,_0x298fa4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3106eb6..5667414 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 _0x57ef=['describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe'];(function(_0x292102,_0x427efa){var _0x54c775=function(_0x27a4b6){while(--_0x27a4b6){_0x292102['push'](_0x292102['shift']());}};_0x54c775(++_0x427efa);}(_0x57ef,0xdb));var _0xf57e=function(_0x5472aa,_0x4c5797){_0x5472aa=_0x5472aa-0x0;var _0x5d18f7=_0x57ef[_0x5472aa];return _0x5d18f7;};'use strict';var multer=require('multer');var util=require(_0xf57e('0x0'));var path=require(_0xf57e('0x1'));var timeout=require(_0xf57e('0x2'));var express=require(_0xf57e('0x3'));var router=express[_0xf57e('0x4')]();var auth=require(_0xf57e('0x5'));var interaction=require(_0xf57e('0x6'));var config=require('../../config/environment');var controller=require(_0xf57e('0x7'));router[_0xf57e('0x8')]('/',auth[_0xf57e('0x9')](),controller[_0xf57e('0xa')]);router[_0xf57e('0x8')](_0xf57e('0xb'),auth[_0xf57e('0x9')](),controller[_0xf57e('0xc')]);router['get'](_0xf57e('0xd'),auth[_0xf57e('0x9')](),controller[_0xf57e('0xe')]);router[_0xf57e('0xf')]('/',auth[_0xf57e('0x9')](),controller['create']);router[_0xf57e('0x10')](_0xf57e('0xd'),auth['isAuthenticated'](),controller[_0xf57e('0x11')]);router[_0xf57e('0x12')](_0xf57e('0xd'),auth[_0xf57e('0x9')](),controller[_0xf57e('0x13')]);module[_0xf57e('0x14')]=router; \ No newline at end of file +var _0xb0dc=['./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb0dc,0x150));var _0xcb0d=function(_0x2d6e0d,_0x5908fa){_0x2d6e0d=_0x2d6e0d-0x0;var _0x5b8e42=_0xb0dc[_0x2d6e0d];return _0x5b8e42;};'use strict';var multer=require(_0xcb0d('0x0'));var util=require(_0xcb0d('0x1'));var path=require(_0xcb0d('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb0d('0x3'));var router=express['Router']();var auth=require(_0xcb0d('0x4'));var interaction=require(_0xcb0d('0x5'));var config=require('../../config/environment');var controller=require(_0xcb0d('0x6'));router[_0xcb0d('0x7')]('/',auth[_0xcb0d('0x8')](),controller['index']);router[_0xcb0d('0x7')](_0xcb0d('0x9'),auth[_0xcb0d('0x8')](),controller[_0xcb0d('0xa')]);router[_0xcb0d('0x7')](_0xcb0d('0xb'),auth[_0xcb0d('0x8')](),controller['show']);router['post']('/',auth[_0xcb0d('0x8')](),controller[_0xcb0d('0xc')]);router[_0xcb0d('0xd')]('/:id',auth[_0xcb0d('0x8')](),controller[_0xcb0d('0xe')]);router[_0xcb0d('0xf')]('/:id',auth[_0xcb0d('0x8')](),controller[_0xcb0d('0x10')]);module[_0xcb0d('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 0b027d9..d7d0e4e 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 _0x7157=['exports','STRING','INTEGER','sequelize'];(function(_0x5e6cd5,_0x1e1868){var _0x1595ab=function(_0x391fe8){while(--_0x391fe8){_0x5e6cd5['push'](_0x5e6cd5['shift']());}};_0x1595ab(++_0x1e1868);}(_0x7157,0xd3));var _0x7715=function(_0x36029c,_0x392087){_0x36029c=_0x36029c-0x0;var _0xd82b6=_0x7157[_0x36029c];return _0xd82b6;};'use strict';var Sequelize=require(_0x7715('0x0'));module[_0x7715('0x1')]={'name':{'type':Sequelize[_0x7715('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7715('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7715('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd22b=['exports','STRING','sequelize'];(function(_0x6266e6,_0x1cfc62){var _0xa813d3=function(_0x33dc1c){while(--_0x33dc1c){_0x6266e6['push'](_0x6266e6['shift']());}};_0xa813d3(++_0x1cfc62);}(_0xd22b,0x11f));var _0xbd22=function(_0x172432,_0x59a3fd){_0x172432=_0x172432-0x0;var _0x1d9e40=_0xd22b[_0x172432];return _0x1d9e40;};'use strict';var Sequelize=require(_0xbd22('0x0'));module[_0xbd22('0x1')]={'name':{'type':Sequelize[_0xbd22('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xbd22('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 e9c003c..665012b 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 _0x5089=['include','findAll','rows','show','params','find','catch','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','then','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x1e7708,_0x280ed4){var _0x20f21a=function(_0x3d3b4f){while(--_0x3d3b4f){_0x1e7708['push'](_0x1e7708['shift']());}};_0x20f21a(++_0x280ed4);}(_0x5089,0x1bb));var _0x9508=function(_0x2e1906,_0xa281e9){_0x2e1906=_0x2e1906-0x0;var _0x3ea10e=_0x5089[_0x2e1906];return _0x3ea10e;};'use strict';var pdf=require(_0x9508('0x0'));var emlformat=require(_0x9508('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9508('0x2'));var jsonpatch=require(_0x9508('0x3'));var rp=require(_0x9508('0x4'));var moment=require(_0x9508('0x5'));var BPromise=require(_0x9508('0x6'));var Mustache=require('mustache');var util=require(_0x9508('0x7'));var path=require('path');var sox=require(_0x9508('0x8'));var csv=require(_0x9508('0x9'));var ejs=require(_0x9508('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9508('0xb'));var crypto=require(_0x9508('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9508('0xd'));var toCsv=require(_0x9508('0x9'));var querystring=require('querystring');var Papa=require(_0x9508('0xe'));var Redis=require('ioredis');var authService=require(_0x9508('0xf'));var qs=require(_0x9508('0x10'));var as=require(_0x9508('0x11'));var hardwareService=require(_0x9508('0x12'));var logger=require(_0x9508('0x13'))(_0x9508('0x14'));var utils=require('../../config/utils');var config=require(_0x9508('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c4fd9,_0x396896){_0x396896=_0x396896||0xcc;return function(_0x554c90){if(_0x554c90){return _0x2c4fd9[_0x9508('0x16')](_0x396896);}return _0x2c4fd9[_0x9508('0x17')](_0x396896)[_0x9508('0x18')]();};}function respondWithResult(_0x4701de,_0x51ef92){_0x51ef92=_0x51ef92||0xc8;return function(_0x440709){if(_0x440709){return _0x4701de[_0x9508('0x17')](_0x51ef92)['json'](_0x440709);}};}function respondWithFilteredResult(_0x2a281d,_0x539746){return function(_0x25d4d6){if(_0x25d4d6){var _0x418889=_0x25d4d6[_0x9508('0x19')],_0x374c03=_0x539746[_0x9508('0x1a')],_0x255a03=_0x539746[_0x9508('0x1a')]+_0x539746['limit'],_0x127340;if(_0x255a03>=_0x418889){_0x255a03=_0x418889;_0x127340=0xc8;}else{_0x127340=0xce;}_0x2a281d[_0x9508('0x17')](_0x127340);return _0x2a281d[_0x9508('0x1b')](_0x9508('0x1c'),_0x374c03+'-'+_0x255a03+'/'+_0x418889)[_0x9508('0x1d')](_0x25d4d6);}return null;};}function patchUpdates(_0x23c30e){return function(_0x22a9fe){try{jsonpatch['apply'](_0x22a9fe,_0x23c30e,!![]);}catch(_0x4cbf6a){return BPromise[_0x9508('0x1e')](_0x4cbf6a);}return _0x22a9fe['save']();};}function saveUpdates(_0x2272e2,_0x4e9e9f){return function(_0x3ba927){if(_0x3ba927){return _0x3ba927[_0x9508('0x1f')](_0x2272e2)[_0x9508('0x20')](function(_0x1dfc6c){return _0x1dfc6c;});}return null;};}function removeEntity(_0x1edf1b,_0x2f8106){return function(_0x20eb53){if(_0x20eb53){return _0x20eb53['destroy']()['then'](function(){_0x1edf1b[_0x9508('0x17')](0xcc)[_0x9508('0x18')]();});}};}function handleEntityNotFound(_0x39e6b0,_0xf70830){return function(_0x16c54f){if(!_0x16c54f){_0x39e6b0[_0x9508('0x16')](0x194);}return _0x16c54f;};}function handleError(_0x4b68e9,_0x5e9a80){_0x5e9a80=_0x5e9a80||0x1f4;return function(_0x46d23f){logger['error'](_0x46d23f['stack']);if(_0x46d23f[_0x9508('0x21')]){delete _0x46d23f['name'];}_0x4b68e9['status'](_0x5e9a80)[_0x9508('0x22')](_0x46d23f);};}exports[_0x9508('0x23')]=function(_0x57c7ae,_0x49246b){var _0x32b0dd={},_0x22b2e2={},_0x4529a8={'count':0x0,'rows':[]};var _0x1f7755=_[_0x9508('0x24')](db[_0x9508('0x25')][_0x9508('0x26')],function(_0x414534){return{'name':_0x414534[_0x9508('0x27')],'type':_0x414534[_0x9508('0x28')]['key']};});_0x22b2e2[_0x9508('0x29')]=_[_0x9508('0x24')](_0x1f7755,_0x9508('0x21'));_0x22b2e2['query']=_[_0x9508('0x2a')](_0x57c7ae[_0x9508('0x2b')]);_0x22b2e2['filters']=_[_0x9508('0x2c')](_0x22b2e2[_0x9508('0x29')],_0x22b2e2['query']);_0x32b0dd[_0x9508('0x2d')]=_[_0x9508('0x2c')](_0x22b2e2[_0x9508('0x29')],qs[_0x9508('0x2e')](_0x57c7ae['query']['fields']));_0x32b0dd[_0x9508('0x2d')]=_0x32b0dd[_0x9508('0x2d')][_0x9508('0x2f')]?_0x32b0dd['attributes']:_0x22b2e2['model'];if(!_0x57c7ae[_0x9508('0x2b')][_0x9508('0x30')](_0x9508('0x31'))){_0x32b0dd[_0x9508('0x32')]=qs[_0x9508('0x32')](_0x57c7ae[_0x9508('0x2b')][_0x9508('0x32')]);_0x32b0dd[_0x9508('0x1a')]=qs[_0x9508('0x1a')](_0x57c7ae[_0x9508('0x2b')]['offset']);}_0x32b0dd[_0x9508('0x33')]=qs[_0x9508('0x34')](_0x57c7ae['query'][_0x9508('0x34')]);_0x32b0dd[_0x9508('0x35')]=qs[_0x9508('0x36')](_[_0x9508('0x37')](_0x57c7ae[_0x9508('0x2b')],_0x22b2e2[_0x9508('0x36')]),_0x1f7755);if(_0x57c7ae[_0x9508('0x2b')][_0x9508('0x38')]){_0x32b0dd[_0x9508('0x35')]=_[_0x9508('0x39')](_0x32b0dd[_0x9508('0x35')],{'$or':_['map'](_0x1f7755,function(_0x125c8f){if(_0x125c8f['type']!==_0x9508('0x3a')){var _0x1dd6c9={};_0x1dd6c9[_0x125c8f[_0x9508('0x21')]]={'$like':'%'+_0x57c7ae['query']['filter']+'%'};return _0x1dd6c9;}})});}_0x32b0dd=_[_0x9508('0x39')]({},_0x32b0dd,_0x57c7ae[_0x9508('0x3b')]);var _0x1277b1={'where':_0x32b0dd[_0x9508('0x35')]};return db['UserProfileResource'][_0x9508('0x19')](_0x1277b1)['then'](function(_0x37b8a2){_0x4529a8[_0x9508('0x19')]=_0x37b8a2;if(_0x57c7ae['query'][_0x9508('0x3c')]){_0x32b0dd[_0x9508('0x3d')]=[{'all':!![]}];}return db['UserProfileResource'][_0x9508('0x3e')](_0x32b0dd);})[_0x9508('0x20')](function(_0x5b601d){_0x4529a8[_0x9508('0x3f')]=_0x5b601d;return _0x4529a8;})['then'](respondWithFilteredResult(_0x49246b,_0x32b0dd))['catch'](handleError(_0x49246b,null));};exports[_0x9508('0x40')]=function(_0x4ff354,_0x254e7f){var _0x22c135={'raw':![],'where':{'id':_0x4ff354[_0x9508('0x41')]['id']}},_0x10e8f5={};_0x10e8f5['model']=_['keys'](db['UserProfileResource'][_0x9508('0x26')]);_0x10e8f5['query']=_[_0x9508('0x2a')](_0x4ff354['query']);_0x10e8f5[_0x9508('0x36')]=_[_0x9508('0x2c')](_0x10e8f5[_0x9508('0x29')],_0x10e8f5[_0x9508('0x2b')]);_0x22c135['attributes']=_[_0x9508('0x2c')](_0x10e8f5[_0x9508('0x29')],qs[_0x9508('0x2e')](_0x4ff354['query'][_0x9508('0x2e')]));_0x22c135[_0x9508('0x2d')]=_0x22c135['attributes'][_0x9508('0x2f')]?_0x22c135['attributes']:_0x10e8f5[_0x9508('0x29')];if(_0x4ff354['query']['includeAll']){_0x22c135[_0x9508('0x3d')]=[{'all':!![]}];}_0x22c135=_[_0x9508('0x39')]({},_0x22c135,_0x4ff354[_0x9508('0x3b')]);return db[_0x9508('0x25')][_0x9508('0x42')](_0x22c135)[_0x9508('0x20')](handleEntityNotFound(_0x254e7f,null))['then'](respondWithResult(_0x254e7f,null))[_0x9508('0x43')](handleError(_0x254e7f,null));};exports[_0x9508('0x44')]=function(_0x11dac3,_0x4c860a){return db[_0x9508('0x25')][_0x9508('0x44')](_0x11dac3[_0x9508('0x45')],{})[_0x9508('0x20')](respondWithResult(_0x4c860a,0xc9))['catch'](handleError(_0x4c860a,null));};exports[_0x9508('0x1f')]=function(_0x552d10,_0x155928){if(_0x552d10[_0x9508('0x45')]['id']){delete _0x552d10['body']['id'];}return db[_0x9508('0x25')][_0x9508('0x42')]({'where':{'id':_0x552d10['params']['id']}})[_0x9508('0x20')](handleEntityNotFound(_0x155928,null))[_0x9508('0x20')](saveUpdates(_0x552d10['body'],null))[_0x9508('0x20')](respondWithResult(_0x155928,null))['catch'](handleError(_0x155928,null));};exports[_0x9508('0x46')]=function(_0x50df5e,_0x1e6c8c){return db['UserProfileResource']['find']({'where':{'id':_0x50df5e['params']['id']}})['then'](handleEntityNotFound(_0x1e6c8c,null))[_0x9508('0x20')](removeEntity(_0x1e6c8c,null))[_0x9508('0x43')](handleError(_0x1e6c8c,null));};exports[_0x9508('0x47')]=function(_0x2eead6,_0x40e385){return db[_0x9508('0x25')][_0x9508('0x47')]()[_0x9508('0x20')](respondWithResult(_0x40e385,null))[_0x9508('0x43')](handleError(_0x40e385,null));}; \ No newline at end of file +var _0xac9d=['destroy','error','name','send','map','UserProfileResource','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','apply','save','then'];(function(_0x54dd9e,_0x792865){var _0x3abe70=function(_0x1717f1){while(--_0x1717f1){_0x54dd9e['push'](_0x54dd9e['shift']());}};_0x3abe70(++_0x792865);}(_0xac9d,0x14d));var _0xdac9=function(_0x350277,_0x25d306){_0x350277=_0x350277-0x0;var _0x5e418b=_0xac9d[_0x350277];return _0x5e418b;};'use strict';var pdf=require(_0xdac9('0x0'));var emlformat=require(_0xdac9('0x1'));var rimraf=require(_0xdac9('0x2'));var zipdir=require(_0xdac9('0x3'));var jsonpatch=require(_0xdac9('0x4'));var rp=require(_0xdac9('0x5'));var moment=require(_0xdac9('0x6'));var BPromise=require(_0xdac9('0x7'));var Mustache=require('mustache');var util=require(_0xdac9('0x8'));var path=require('path');var sox=require(_0xdac9('0x9'));var csv=require(_0xdac9('0xa'));var ejs=require(_0xdac9('0xb'));var fs=require('fs');var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var db=require(_0xdac9('0x1a'))['db'];function respondWithStatusCode(_0x5a9bde,_0x3d8e97){_0x3d8e97=_0x3d8e97||0xcc;return function(_0xeddbc1){if(_0xeddbc1){return _0x5a9bde[_0xdac9('0x1b')](_0x3d8e97);}return _0x5a9bde['status'](_0x3d8e97)[_0xdac9('0x1c')]();};}function respondWithResult(_0x33ba20,_0x9e1bf6){_0x9e1bf6=_0x9e1bf6||0xc8;return function(_0x5f0bbd){if(_0x5f0bbd){return _0x33ba20['status'](_0x9e1bf6)[_0xdac9('0x1d')](_0x5f0bbd);}};}function respondWithFilteredResult(_0x3d9fcf,_0x50f9fe){return function(_0x76af7a){if(_0x76af7a){var _0x36cbe4=_0x76af7a[_0xdac9('0x1e')],_0x152ea5=_0x50f9fe[_0xdac9('0x1f')],_0x5b2f1b=_0x50f9fe[_0xdac9('0x1f')]+_0x50f9fe['limit'],_0x2221f8;if(_0x5b2f1b>=_0x36cbe4){_0x5b2f1b=_0x36cbe4;_0x2221f8=0xc8;}else{_0x2221f8=0xce;}_0x3d9fcf[_0xdac9('0x20')](_0x2221f8);return _0x3d9fcf[_0xdac9('0x21')]('Content-Range',_0x152ea5+'-'+_0x5b2f1b+'/'+_0x36cbe4)[_0xdac9('0x1d')](_0x76af7a);}return null;};}function patchUpdates(_0xa57f2d){return function(_0x171df1){try{jsonpatch[_0xdac9('0x22')](_0x171df1,_0xa57f2d,!![]);}catch(_0x522dc3){return BPromise['reject'](_0x522dc3);}return _0x171df1[_0xdac9('0x23')]();};}function saveUpdates(_0x20ece3,_0x2b9d91){return function(_0x395ec7){if(_0x395ec7){return _0x395ec7['update'](_0x20ece3)[_0xdac9('0x24')](function(_0x33cb7d){return _0x33cb7d;});}return null;};}function removeEntity(_0x27f473,_0xae680a){return function(_0xe7bd10){if(_0xe7bd10){return _0xe7bd10[_0xdac9('0x25')]()[_0xdac9('0x24')](function(){_0x27f473[_0xdac9('0x20')](0xcc)[_0xdac9('0x1c')]();});}};}function handleEntityNotFound(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(!_0x2943f5){_0x33de5c[_0xdac9('0x1b')](0x194);}return _0x2943f5;};}function handleError(_0x3c942c,_0x34a255){_0x34a255=_0x34a255||0x1f4;return function(_0x5ca076){logger[_0xdac9('0x26')](_0x5ca076['stack']);if(_0x5ca076[_0xdac9('0x27')]){delete _0x5ca076[_0xdac9('0x27')];}_0x3c942c['status'](_0x34a255)[_0xdac9('0x28')](_0x5ca076);};}exports['index']=function(_0x450f91,_0x3743f7){var _0xeff4b2={},_0xfe4468={},_0x57d76a={'count':0x0,'rows':[]};var _0x4b87bc=_[_0xdac9('0x29')](db[_0xdac9('0x2a')]['rawAttributes'],function(_0x4c4e21){return{'name':_0x4c4e21[_0xdac9('0x2b')],'type':_0x4c4e21[_0xdac9('0x2c')][_0xdac9('0x2d')]};});_0xfe4468[_0xdac9('0x2e')]=_[_0xdac9('0x29')](_0x4b87bc,_0xdac9('0x27'));_0xfe4468[_0xdac9('0x2f')]=_[_0xdac9('0x30')](_0x450f91[_0xdac9('0x2f')]);_0xfe4468[_0xdac9('0x31')]=_[_0xdac9('0x32')](_0xfe4468[_0xdac9('0x2e')],_0xfe4468[_0xdac9('0x2f')]);_0xeff4b2[_0xdac9('0x33')]=_[_0xdac9('0x32')](_0xfe4468[_0xdac9('0x2e')],qs[_0xdac9('0x34')](_0x450f91[_0xdac9('0x2f')][_0xdac9('0x34')]));_0xeff4b2[_0xdac9('0x33')]=_0xeff4b2[_0xdac9('0x33')]['length']?_0xeff4b2['attributes']:_0xfe4468[_0xdac9('0x2e')];if(!_0x450f91[_0xdac9('0x2f')][_0xdac9('0x35')](_0xdac9('0x36'))){_0xeff4b2[_0xdac9('0x37')]=qs['limit'](_0x450f91[_0xdac9('0x2f')]['limit']);_0xeff4b2[_0xdac9('0x1f')]=qs[_0xdac9('0x1f')](_0x450f91['query'][_0xdac9('0x1f')]);}_0xeff4b2['order']=qs['sort'](_0x450f91[_0xdac9('0x2f')][_0xdac9('0x38')]);_0xeff4b2[_0xdac9('0x39')]=qs[_0xdac9('0x31')](_[_0xdac9('0x3a')](_0x450f91[_0xdac9('0x2f')],_0xfe4468['filters']),_0x4b87bc);if(_0x450f91[_0xdac9('0x2f')][_0xdac9('0x3b')]){_0xeff4b2['where']=_[_0xdac9('0x3c')](_0xeff4b2[_0xdac9('0x39')],{'$or':_[_0xdac9('0x29')](_0x4b87bc,function(_0x27bdfb){if(_0x27bdfb[_0xdac9('0x2c')]!==_0xdac9('0x3d')){var _0x3ac9ae={};_0x3ac9ae[_0x27bdfb['name']]={'$like':'%'+_0x450f91[_0xdac9('0x2f')][_0xdac9('0x3b')]+'%'};return _0x3ac9ae;}})});}_0xeff4b2=_[_0xdac9('0x3c')]({},_0xeff4b2,_0x450f91['options']);var _0x9c732e={'where':_0xeff4b2[_0xdac9('0x39')]};return db[_0xdac9('0x2a')][_0xdac9('0x1e')](_0x9c732e)['then'](function(_0x58fd14){_0x57d76a[_0xdac9('0x1e')]=_0x58fd14;if(_0x450f91[_0xdac9('0x2f')][_0xdac9('0x3e')]){_0xeff4b2[_0xdac9('0x3f')]=[{'all':!![]}];}return db[_0xdac9('0x2a')]['findAll'](_0xeff4b2);})[_0xdac9('0x24')](function(_0x482f4a){_0x57d76a[_0xdac9('0x40')]=_0x482f4a;return _0x57d76a;})[_0xdac9('0x24')](respondWithFilteredResult(_0x3743f7,_0xeff4b2))[_0xdac9('0x41')](handleError(_0x3743f7,null));};exports[_0xdac9('0x42')]=function(_0x2a50f0,_0x386b74){var _0x413fb1={'raw':![],'where':{'id':_0x2a50f0[_0xdac9('0x43')]['id']}},_0xb176e0={};_0xb176e0[_0xdac9('0x2e')]=_[_0xdac9('0x30')](db[_0xdac9('0x2a')][_0xdac9('0x44')]);_0xb176e0[_0xdac9('0x2f')]=_['keys'](_0x2a50f0[_0xdac9('0x2f')]);_0xb176e0[_0xdac9('0x31')]=_['intersection'](_0xb176e0[_0xdac9('0x2e')],_0xb176e0[_0xdac9('0x2f')]);_0x413fb1[_0xdac9('0x33')]=_[_0xdac9('0x32')](_0xb176e0[_0xdac9('0x2e')],qs[_0xdac9('0x34')](_0x2a50f0['query'][_0xdac9('0x34')]));_0x413fb1['attributes']=_0x413fb1[_0xdac9('0x33')][_0xdac9('0x45')]?_0x413fb1[_0xdac9('0x33')]:_0xb176e0[_0xdac9('0x2e')];if(_0x2a50f0['query']['includeAll']){_0x413fb1['include']=[{'all':!![]}];}_0x413fb1=_[_0xdac9('0x3c')]({},_0x413fb1,_0x2a50f0['options']);return db['UserProfileResource'][_0xdac9('0x46')](_0x413fb1)[_0xdac9('0x24')](handleEntityNotFound(_0x386b74,null))['then'](respondWithResult(_0x386b74,null))['catch'](handleError(_0x386b74,null));};exports[_0xdac9('0x47')]=function(_0x24f045,_0x2a31e8){return db[_0xdac9('0x2a')][_0xdac9('0x47')](_0x24f045[_0xdac9('0x48')],{})[_0xdac9('0x24')](respondWithResult(_0x2a31e8,0xc9))[_0xdac9('0x41')](handleError(_0x2a31e8,null));};exports['update']=function(_0x621cf,_0x3bd946){if(_0x621cf[_0xdac9('0x48')]['id']){delete _0x621cf[_0xdac9('0x48')]['id'];}return db[_0xdac9('0x2a')][_0xdac9('0x46')]({'where':{'id':_0x621cf[_0xdac9('0x43')]['id']}})[_0xdac9('0x24')](handleEntityNotFound(_0x3bd946,null))[_0xdac9('0x24')](saveUpdates(_0x621cf[_0xdac9('0x48')],null))[_0xdac9('0x24')](respondWithResult(_0x3bd946,null))[_0xdac9('0x41')](handleError(_0x3bd946,null));};exports[_0xdac9('0x25')]=function(_0x3f092d,_0x53b349){return db['UserProfileResource']['find']({'where':{'id':_0x3f092d[_0xdac9('0x43')]['id']}})[_0xdac9('0x24')](handleEntityNotFound(_0x53b349,null))['then'](removeEntity(_0x53b349,null))[_0xdac9('0x41')](handleError(_0x53b349,null));};exports[_0xdac9('0x49')]=function(_0x45c869,_0x4df45b){return db[_0xdac9('0x2a')][_0xdac9('0x49')]()['then'](respondWithResult(_0x4df45b,null))['catch'](handleError(_0x4df45b,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d450aee..6d0a84c 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 _0xac4a=['bluebird','rimraf','../../config/environment','./userProfileResource.attributes','define','user_profile_has_resources','compositeIndex','lodash','util','../../config/logger','api','moment'];(function(_0xd413a4,_0x3120fe){var _0x9170f4=function(_0x5aa567){while(--_0x5aa567){_0xd413a4['push'](_0xd413a4['shift']());}};_0x9170f4(++_0x3120fe);}(_0xac4a,0x13f));var _0xaac4=function(_0x5ba5f4,_0x4c6e43){_0x5ba5f4=_0x5ba5f4-0x0;var _0x14941f=_0xac4a[_0x5ba5f4];return _0x14941f;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('UserProfileResource',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[{'name':_0xaac4('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2547=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x2547,0x1cd));var _0x7254=function(_0x5875be,_0x1f2f2e){_0x5875be=_0x5875be-0x0;var _0x3d9fa8=_0x2547[_0x5875be];return _0x3d9fa8;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[{'name':_0x7254('0xc'),'fields':['resourceId',_0x7254('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 2c60afa..ff2de01 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 _0x0b33=['../../config/utils','../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2c3bef,_0x2f0e57){var _0x18234d=function(_0x479e67){while(--_0x479e67){_0x2c3bef['push'](_0x2c3bef['shift']());}};_0x18234d(++_0x2f0e57);}(_0x0b33,0x1c6));var _0x30b3=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x0b33[_0x3df871];return _0x570f7b;};'use strict';var _=require(_0x30b3('0x0'));var util=require(_0x30b3('0x1'));var moment=require(_0x30b3('0x2'));var BPromise=require(_0x30b3('0x3'));var rs=require(_0x30b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30b3('0x5'))['db'];var utils=require(_0x30b3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x30b3('0x7'));var jayson=require(_0x30b3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b6927,_0x62e7b,_0x508d81){return new BPromise(function(_0x3fb215,_0x5387c7){return client[_0x30b3('0x9')](_0x4b6927,_0x508d81)[_0x30b3('0xa')](function(_0x52f363){logger[_0x30b3('0xb')](_0x30b3('0xc'),_0x62e7b,_0x30b3('0xd'));logger['debug'](_0x30b3('0xe'),_0x62e7b,_0x30b3('0xd'),JSON[_0x30b3('0xf')](_0x52f363));if(_0x52f363['error']){if(_0x52f363['error'][_0x30b3('0x10')]===0x1f4){logger[_0x30b3('0x11')](_0x30b3('0xc'),_0x62e7b,_0x52f363['error'][_0x30b3('0x12')]);return _0x5387c7(_0x52f363[_0x30b3('0x11')][_0x30b3('0x12')]);}logger[_0x30b3('0x11')](_0x30b3('0xc'),_0x62e7b,_0x52f363[_0x30b3('0x11')][_0x30b3('0x12')]);return _0x3fb215(_0x52f363[_0x30b3('0x11')][_0x30b3('0x12')]);}else{logger[_0x30b3('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x62e7b,'request\x20sent');_0x3fb215(_0x52f363[_0x30b3('0x13')][_0x30b3('0x12')]);}})['catch'](function(_0xcbe487){logger[_0x30b3('0x11')](_0x30b3('0xc'),_0x62e7b,_0xcbe487);_0x5387c7(_0xcbe487);});});} \ No newline at end of file +var _0x0e5f=['../../config/environment','jayson/promise','client','http','request','then','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0e5f,0x101));var _0xf0e5=function(_0x1b653f,_0x3f2484){_0x1b653f=_0x1b653f-0x0;var _0x3fc7e9=_0x0e5f[_0x1b653f];return _0x3fc7e9;};'use strict';var _=require(_0xf0e5('0x0'));var util=require(_0xf0e5('0x1'));var moment=require('moment');var BPromise=require(_0xf0e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0e5('0x3'));var db=require(_0xf0e5('0x4'))['db'];var utils=require(_0xf0e5('0x5'));var logger=require(_0xf0e5('0x6'))('rpc');var config=require(_0xf0e5('0x7'));var jayson=require(_0xf0e5('0x8'));var client=jayson[_0xf0e5('0x9')][_0xf0e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5deee3,_0x5dfd89,_0x491ae5){return new BPromise(function(_0x32f1bc,_0xe6a30b){return client[_0xf0e5('0xb')](_0x5deee3,_0x491ae5)[_0xf0e5('0xc')](function(_0x3f7c47){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x5dfd89,'request\x20sent');logger[_0xf0e5('0xd')](_0xf0e5('0xe'),_0x5dfd89,_0xf0e5('0xf'),JSON[_0xf0e5('0x10')](_0x3f7c47));if(_0x3f7c47[_0xf0e5('0x11')]){if(_0x3f7c47[_0xf0e5('0x11')][_0xf0e5('0x12')]===0x1f4){logger[_0xf0e5('0x11')](_0xf0e5('0x13'),_0x5dfd89,_0x3f7c47['error'][_0xf0e5('0x14')]);return _0xe6a30b(_0x3f7c47['error'][_0xf0e5('0x14')]);}logger[_0xf0e5('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5dfd89,_0x3f7c47[_0xf0e5('0x11')][_0xf0e5('0x14')]);return _0x32f1bc(_0x3f7c47[_0xf0e5('0x11')][_0xf0e5('0x14')]);}else{logger[_0xf0e5('0x15')](_0xf0e5('0x13'),_0x5dfd89,'request\x20sent');_0x32f1bc(_0x3f7c47[_0xf0e5('0x16')]['message']);}})[_0xf0e5('0x17')](function(_0x24245b){logger[_0xf0e5('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5dfd89,_0x24245b);_0xe6a30b(_0x24245b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 50d2fa7..66b4f18 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 _0x2029=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy'];(function(_0x50e762,_0x2b4568){var _0xbf0034=function(_0x2e1552){while(--_0x2e1552){_0x50e762['push'](_0x50e762['shift']());}};_0xbf0034(++_0x2b4568);}(_0x2029,0xb5));var _0x9202=function(_0x41b7fe,_0xcde65c){_0x41b7fe=_0x41b7fe-0x0;var _0x5e6731=_0x2029[_0x41b7fe];return _0x5e6731;};'use strict';var multer=require('multer');var util=require(_0x9202('0x0'));var path=require('path');var timeout=require(_0x9202('0x1'));var express=require(_0x9202('0x2'));var router=express[_0x9202('0x3')]();var auth=require(_0x9202('0x4'));var interaction=require(_0x9202('0x5'));var config=require(_0x9202('0x6'));var controller=require('./userProfileSection.controller');router[_0x9202('0x7')]('/',auth[_0x9202('0x8')](),controller['index']);router['get'](_0x9202('0x9'),auth[_0x9202('0x8')](),controller[_0x9202('0xa')]);router[_0x9202('0x7')](_0x9202('0xb'),auth[_0x9202('0x8')](),controller[_0x9202('0xc')]);router[_0x9202('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9202('0xe')](_0x9202('0xb'),auth[_0x9202('0x8')](),controller[_0x9202('0xf')]);router['delete'](_0x9202('0xb'),auth[_0x9202('0x8')](),controller[_0x9202('0x10')]);module[_0x9202('0x11')]=router; \ No newline at end of file +var _0x51d3=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','delete','destroy','exports','multer','util'];(function(_0x4d4180,_0xb3e355){var _0x44733d=function(_0x4b0ba9){while(--_0x4b0ba9){_0x4d4180['push'](_0x4d4180['shift']());}};_0x44733d(++_0xb3e355);}(_0x51d3,0xa9));var _0x351d=function(_0x1356c9,_0x3a479c){_0x1356c9=_0x1356c9-0x0;var _0x4d633e=_0x51d3[_0x1356c9];return _0x4d633e;};'use strict';var multer=require(_0x351d('0x0'));var util=require(_0x351d('0x1'));var path=require(_0x351d('0x2'));var timeout=require(_0x351d('0x3'));var express=require(_0x351d('0x4'));var router=express['Router']();var auth=require(_0x351d('0x5'));var interaction=require(_0x351d('0x6'));var config=require('../../config/environment');var controller=require(_0x351d('0x7'));router[_0x351d('0x8')]('/',auth['isAuthenticated'](),controller[_0x351d('0x9')]);router['get'](_0x351d('0xa'),auth[_0x351d('0xb')](),controller[_0x351d('0xc')]);router[_0x351d('0x8')](_0x351d('0xd'),auth[_0x351d('0xb')](),controller['show']);router[_0x351d('0xe')]('/',auth[_0x351d('0xb')](),controller[_0x351d('0xf')]);router['put'](_0x351d('0xd'),auth[_0x351d('0xb')](),controller['update']);router[_0x351d('0x10')](_0x351d('0xd'),auth[_0x351d('0xb')](),controller[_0x351d('0x11')]);module[_0x351d('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b409eb4..f2a0105 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 _0xa8a8=['getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x2562df,_0x628e2d){var _0xeb12c6=function(_0x849a55){while(--_0x849a55){_0x2562df['push'](_0x2562df['shift']());}};_0xeb12c6(++_0x628e2d);}(_0xa8a8,0xec));var _0x8a8a=function(_0xb56e2,_0x58929f){_0xb56e2=_0xb56e2-0x0;var _0x577f1e=_0xa8a8[_0xb56e2];return _0x577f1e;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x8a8a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8a8a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8a8a('0x2')],'set':function(_0x3ed1de){this[_0x8a8a('0x4')](_0x8a8a('0x5'),_0x3ed1de?_0x3ed1de[_0x8a8a('0x6')](''):[]);},'get':function(){return this[_0x8a8a('0x7')](_0x8a8a('0x5'))?this[_0x8a8a('0x7')](_0x8a8a('0x5'))[_0x8a8a('0x8')](''):[];}}}; \ No newline at end of file +var _0x933b=['BOOLEAN','STRING','join','getDataValue','crudPermissions','split','sequelize','exports','INTEGER'];(function(_0x9a0a8e,_0x3c411c){var _0x2a1889=function(_0x4b6fe3){while(--_0x4b6fe3){_0x9a0a8e['push'](_0x9a0a8e['shift']());}};_0x2a1889(++_0x3c411c);}(_0x933b,0x16e));var _0xb933=function(_0x2b9957,_0x44035f){_0x2b9957=_0x2b9957-0x0;var _0x26201f=_0x933b[_0x2b9957];return _0x26201f;};'use strict';var Sequelize=require(_0xb933('0x0'));module[_0xb933('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb933('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb933('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb933('0x4')],'set':function(_0xf0a9c7){this['setDataValue']('crudPermissions',_0xf0a9c7?_0xf0a9c7[_0xb933('0x5')](''):[]);},'get':function(){return this[_0xb933('0x6')](_0xb933('0x7'))?this[_0xb933('0x6')]('crudPermissions')[_0xb933('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 819c327..df9c9c1 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 _0x63c4=['body','update','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','then','end','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','fields','options','create'];(function(_0x4e9861,_0x25fe5f){var _0x49802f=function(_0x76932){while(--_0x76932){_0x4e9861['push'](_0x4e9861['shift']());}};_0x49802f(++_0x25fe5f);}(_0x63c4,0x1c6));var _0x463c=function(_0x49ae19,_0x7dc905){_0x49ae19=_0x49ae19-0x0;var _0x5d9c50=_0x63c4[_0x49ae19];return _0x5d9c50;};'use strict';var pdf=require(_0x463c('0x0'));var emlformat=require(_0x463c('0x1'));var rimraf=require(_0x463c('0x2'));var zipdir=require(_0x463c('0x3'));var jsonpatch=require(_0x463c('0x4'));var rp=require(_0x463c('0x5'));var moment=require(_0x463c('0x6'));var BPromise=require(_0x463c('0x7'));var Mustache=require(_0x463c('0x8'));var util=require('util');var path=require(_0x463c('0x9'));var sox=require(_0x463c('0xa'));var csv=require(_0x463c('0xb'));var ejs=require(_0x463c('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x463c('0xd'));var crypto=require(_0x463c('0xe'));var jsforce=require(_0x463c('0xf'));var deskjs=require(_0x463c('0x10'));var toCsv=require(_0x463c('0xb'));var querystring=require('querystring');var Papa=require(_0x463c('0x11'));var Redis=require(_0x463c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x463c('0x13'));var as=require(_0x463c('0x14'));var hardwareService=require(_0x463c('0x15'));var logger=require(_0x463c('0x16'))(_0x463c('0x17'));var utils=require('../../config/utils');var config=require(_0x463c('0x18'));var db=require(_0x463c('0x19'))['db'];function respondWithStatusCode(_0x4d3d11,_0x59a631){_0x59a631=_0x59a631||0xcc;return function(_0x484c2f){if(_0x484c2f){return _0x4d3d11[_0x463c('0x1a')](_0x59a631);}return _0x4d3d11[_0x463c('0x1b')](_0x59a631)['end']();};}function respondWithResult(_0x76c843,_0x2b249d){_0x2b249d=_0x2b249d||0xc8;return function(_0x58d40c){if(_0x58d40c){return _0x76c843['status'](_0x2b249d)['json'](_0x58d40c);}};}function respondWithFilteredResult(_0x3aa78d,_0x87e15f){return function(_0xf49a35){if(_0xf49a35){var _0x4be9b9=_0xf49a35[_0x463c('0x1c')],_0x4d984e=_0x87e15f[_0x463c('0x1d')],_0x1ea556=_0x87e15f[_0x463c('0x1d')]+_0x87e15f[_0x463c('0x1e')],_0x27caea;if(_0x1ea556>=_0x4be9b9){_0x1ea556=_0x4be9b9;_0x27caea=0xc8;}else{_0x27caea=0xce;}_0x3aa78d[_0x463c('0x1b')](_0x27caea);return _0x3aa78d[_0x463c('0x1f')](_0x463c('0x20'),_0x4d984e+'-'+_0x1ea556+'/'+_0x4be9b9)['json'](_0xf49a35);}return null;};}function patchUpdates(_0x589990){return function(_0x3c5bb9){try{jsonpatch['apply'](_0x3c5bb9,_0x589990,!![]);}catch(_0x51d824){return BPromise[_0x463c('0x21')](_0x51d824);}return _0x3c5bb9[_0x463c('0x22')]();};}function saveUpdates(_0x44ab38,_0xbb54b6){return function(_0x599d42){if(_0x599d42){return _0x599d42['update'](_0x44ab38)[_0x463c('0x23')](function(_0x47b248){return _0x47b248;});}return null;};}function removeEntity(_0x3c0fe6,_0x49c866){return function(_0x1a9763){if(_0x1a9763){return _0x1a9763['destroy']()['then'](function(){_0x3c0fe6[_0x463c('0x1b')](0xcc)[_0x463c('0x24')]();});}};}function handleEntityNotFound(_0x34f8d5,_0x540ed7){return function(_0x3cbf18){if(!_0x3cbf18){_0x34f8d5[_0x463c('0x1a')](0x194);}return _0x3cbf18;};}function handleError(_0x16d055,_0x4a17ac){_0x4a17ac=_0x4a17ac||0x1f4;return function(_0x153a2b){logger[_0x463c('0x25')](_0x153a2b['stack']);if(_0x153a2b[_0x463c('0x26')]){delete _0x153a2b['name'];}_0x16d055[_0x463c('0x1b')](_0x4a17ac)[_0x463c('0x27')](_0x153a2b);};}exports[_0x463c('0x28')]=function(_0x47ede9,_0x13e1ef){var _0x3f5762={},_0x5b24e9={},_0x561703={'count':0x0,'rows':[]};var _0x34e663=_[_0x463c('0x29')](db[_0x463c('0x2a')][_0x463c('0x2b')],function(_0x426660){return{'name':_0x426660[_0x463c('0x2c')],'type':_0x426660['type'][_0x463c('0x2d')]};});_0x5b24e9[_0x463c('0x2e')]=_['map'](_0x34e663,'name');_0x5b24e9[_0x463c('0x2f')]=_[_0x463c('0x30')](_0x47ede9['query']);_0x5b24e9['filters']=_[_0x463c('0x31')](_0x5b24e9['model'],_0x5b24e9['query']);_0x3f5762['attributes']=_[_0x463c('0x31')](_0x5b24e9[_0x463c('0x2e')],qs['fields'](_0x47ede9['query']['fields']));_0x3f5762[_0x463c('0x32')]=_0x3f5762[_0x463c('0x32')][_0x463c('0x33')]?_0x3f5762[_0x463c('0x32')]:_0x5b24e9[_0x463c('0x2e')];if(!_0x47ede9[_0x463c('0x2f')][_0x463c('0x34')](_0x463c('0x35'))){_0x3f5762[_0x463c('0x1e')]=qs['limit'](_0x47ede9[_0x463c('0x2f')][_0x463c('0x1e')]);_0x3f5762[_0x463c('0x1d')]=qs[_0x463c('0x1d')](_0x47ede9['query']['offset']);}_0x3f5762[_0x463c('0x36')]=qs[_0x463c('0x37')](_0x47ede9[_0x463c('0x2f')][_0x463c('0x37')]);_0x3f5762[_0x463c('0x38')]=qs[_0x463c('0x39')](_['pick'](_0x47ede9[_0x463c('0x2f')],_0x5b24e9[_0x463c('0x39')]),_0x34e663);if(_0x47ede9[_0x463c('0x2f')]['filter']){_0x3f5762[_0x463c('0x38')]=_[_0x463c('0x3a')](_0x3f5762['where'],{'$or':_[_0x463c('0x29')](_0x34e663,function(_0x4515b8){if(_0x4515b8[_0x463c('0x3b')]!==_0x463c('0x3c')){var _0x3d2a2a={};_0x3d2a2a[_0x4515b8[_0x463c('0x26')]]={'$like':'%'+_0x47ede9['query'][_0x463c('0x3d')]+'%'};return _0x3d2a2a;}})});}_0x3f5762=_[_0x463c('0x3a')]({},_0x3f5762,_0x47ede9['options']);var _0x3dd5ea={'where':_0x3f5762[_0x463c('0x38')]};return db['UserProfileSection']['count'](_0x3dd5ea)[_0x463c('0x23')](function(_0x396569){_0x561703[_0x463c('0x1c')]=_0x396569;if(_0x47ede9[_0x463c('0x2f')][_0x463c('0x3e')]){_0x3f5762[_0x463c('0x3f')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x3f5762);})[_0x463c('0x23')](function(_0x34475f){_0x561703[_0x463c('0x40')]=_0x34475f;return _0x561703;})[_0x463c('0x23')](respondWithFilteredResult(_0x13e1ef,_0x3f5762))[_0x463c('0x41')](handleError(_0x13e1ef,null));};exports[_0x463c('0x42')]=function(_0x49c6ba,_0x5e9182){var _0x51e3f3={'raw':![],'where':{'id':_0x49c6ba[_0x463c('0x43')]['id']}},_0x3a37ae={};_0x3a37ae[_0x463c('0x2e')]=_[_0x463c('0x30')](db['UserProfileSection'][_0x463c('0x2b')]);_0x3a37ae[_0x463c('0x2f')]=_[_0x463c('0x30')](_0x49c6ba['query']);_0x3a37ae[_0x463c('0x39')]=_[_0x463c('0x31')](_0x3a37ae[_0x463c('0x2e')],_0x3a37ae[_0x463c('0x2f')]);_0x51e3f3['attributes']=_[_0x463c('0x31')](_0x3a37ae[_0x463c('0x2e')],qs[_0x463c('0x44')](_0x49c6ba[_0x463c('0x2f')][_0x463c('0x44')]));_0x51e3f3[_0x463c('0x32')]=_0x51e3f3[_0x463c('0x32')][_0x463c('0x33')]?_0x51e3f3[_0x463c('0x32')]:_0x3a37ae[_0x463c('0x2e')];if(_0x49c6ba[_0x463c('0x2f')][_0x463c('0x3e')]){_0x51e3f3['include']=[{'all':!![]}];}_0x51e3f3=_[_0x463c('0x3a')]({},_0x51e3f3,_0x49c6ba[_0x463c('0x45')]);return db[_0x463c('0x2a')]['find'](_0x51e3f3)[_0x463c('0x23')](handleEntityNotFound(_0x5e9182,null))[_0x463c('0x23')](respondWithResult(_0x5e9182,null))['catch'](handleError(_0x5e9182,null));};exports[_0x463c('0x46')]=function(_0x4f48ee,_0x424d8a){return db['UserProfileSection'][_0x463c('0x46')](_0x4f48ee[_0x463c('0x47')],{})['then'](respondWithResult(_0x424d8a,0xc9))[_0x463c('0x41')](handleError(_0x424d8a,null));};exports[_0x463c('0x48')]=function(_0x3a6b3a,_0x5804cb){if(_0x3a6b3a[_0x463c('0x47')]['id']){delete _0x3a6b3a['body']['id'];}return db[_0x463c('0x2a')][_0x463c('0x49')]({'where':{'id':_0x3a6b3a['params']['id']}})[_0x463c('0x23')](handleEntityNotFound(_0x5804cb,null))[_0x463c('0x23')](saveUpdates(_0x3a6b3a[_0x463c('0x47')],null))['then'](respondWithResult(_0x5804cb,null))[_0x463c('0x41')](handleError(_0x5804cb,null));};exports[_0x463c('0x4a')]=function(_0x5dd6c8,_0x30cf70){return db[_0x463c('0x2a')]['find']({'where':{'id':_0x5dd6c8['params']['id']}})[_0x463c('0x23')](handleEntityNotFound(_0x30cf70,null))[_0x463c('0x23')](removeEntity(_0x30cf70,null))[_0x463c('0x41')](handleError(_0x30cf70,null));};exports['describe']=function(_0x5af560,_0x5f3e87){return db[_0x463c('0x2a')]['describe']()[_0x463c('0x23')](respondWithResult(_0x5f3e87,null))[_0x463c('0x41')](handleError(_0x5f3e87,null));}; \ No newline at end of file +var _0x4829=['sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','name','map','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4829,0xcd));var _0x9482=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4829[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9482('0x0'));var rimraf=require(_0x9482('0x1'));var zipdir=require(_0x9482('0x2'));var jsonpatch=require(_0x9482('0x3'));var rp=require(_0x9482('0x4'));var moment=require(_0x9482('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9482('0x6'));var util=require(_0x9482('0x7'));var path=require('path');var sox=require(_0x9482('0x8'));var csv=require('to-csv');var ejs=require(_0x9482('0x9'));var fs=require('fs');var _=require(_0x9482('0xa'));var squel=require(_0x9482('0xb'));var crypto=require(_0x9482('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9482('0xd'));var toCsv=require(_0x9482('0xe'));var querystring=require('querystring');var Papa=require(_0x9482('0xf'));var Redis=require('ioredis');var authService=require(_0x9482('0x10'));var qs=require(_0x9482('0x11'));var as=require(_0x9482('0x12'));var hardwareService=require(_0x9482('0x13'));var logger=require(_0x9482('0x14'))(_0x9482('0x15'));var utils=require(_0x9482('0x16'));var config=require(_0x9482('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21097e,_0x16bc73){_0x16bc73=_0x16bc73||0xcc;return function(_0x494f3f){if(_0x494f3f){return _0x21097e[_0x9482('0x18')](_0x16bc73);}return _0x21097e[_0x9482('0x19')](_0x16bc73)['end']();};}function respondWithResult(_0xd214de,_0x3f93bc){_0x3f93bc=_0x3f93bc||0xc8;return function(_0x12e34c){if(_0x12e34c){return _0xd214de[_0x9482('0x19')](_0x3f93bc)[_0x9482('0x1a')](_0x12e34c);}};}function respondWithFilteredResult(_0x132dc1,_0x23cf94){return function(_0xf48a39){if(_0xf48a39){var _0x57aec0=_0xf48a39[_0x9482('0x1b')],_0x29d190=_0x23cf94[_0x9482('0x1c')],_0x39017d=_0x23cf94[_0x9482('0x1c')]+_0x23cf94[_0x9482('0x1d')],_0x2bf870;if(_0x39017d>=_0x57aec0){_0x39017d=_0x57aec0;_0x2bf870=0xc8;}else{_0x2bf870=0xce;}_0x132dc1[_0x9482('0x19')](_0x2bf870);return _0x132dc1[_0x9482('0x1e')](_0x9482('0x1f'),_0x29d190+'-'+_0x39017d+'/'+_0x57aec0)[_0x9482('0x1a')](_0xf48a39);}return null;};}function patchUpdates(_0x29dd9e){return function(_0x34d4c7){try{jsonpatch['apply'](_0x34d4c7,_0x29dd9e,!![]);}catch(_0x4493b3){return BPromise['reject'](_0x4493b3);}return _0x34d4c7[_0x9482('0x20')]();};}function saveUpdates(_0x5a7287,_0x255259){return function(_0x234dcb){if(_0x234dcb){return _0x234dcb[_0x9482('0x21')](_0x5a7287)[_0x9482('0x22')](function(_0x44b9db){return _0x44b9db;});}return null;};}function removeEntity(_0x4e5535,_0x13210b){return function(_0x4d6cfe){if(_0x4d6cfe){return _0x4d6cfe[_0x9482('0x23')]()['then'](function(){_0x4e5535[_0x9482('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453f22,_0x1bb5a7){return function(_0x4b7eb9){if(!_0x4b7eb9){_0x453f22[_0x9482('0x18')](0x194);}return _0x4b7eb9;};}function handleError(_0x58180f,_0x46b4a1){_0x46b4a1=_0x46b4a1||0x1f4;return function(_0x18198e){logger[_0x9482('0x24')](_0x18198e['stack']);if(_0x18198e['name']){delete _0x18198e[_0x9482('0x25')];}_0x58180f[_0x9482('0x19')](_0x46b4a1)['send'](_0x18198e);};}exports['index']=function(_0x18775d,_0x2c501c){var _0x44eace={},_0x482ea0={},_0x148cc8={'count':0x0,'rows':[]};var _0x1cc986=_[_0x9482('0x26')](db[_0x9482('0x27')][_0x9482('0x28')],function(_0x546247){return{'name':_0x546247[_0x9482('0x29')],'type':_0x546247[_0x9482('0x2a')]['key']};});_0x482ea0[_0x9482('0x2b')]=_['map'](_0x1cc986,_0x9482('0x25'));_0x482ea0[_0x9482('0x2c')]=_['keys'](_0x18775d['query']);_0x482ea0[_0x9482('0x2d')]=_['intersection'](_0x482ea0[_0x9482('0x2b')],_0x482ea0[_0x9482('0x2c')]);_0x44eace[_0x9482('0x2e')]=_[_0x9482('0x2f')](_0x482ea0['model'],qs[_0x9482('0x30')](_0x18775d[_0x9482('0x2c')][_0x9482('0x30')]));_0x44eace[_0x9482('0x2e')]=_0x44eace[_0x9482('0x2e')][_0x9482('0x31')]?_0x44eace[_0x9482('0x2e')]:_0x482ea0['model'];if(!_0x18775d[_0x9482('0x2c')][_0x9482('0x32')](_0x9482('0x33'))){_0x44eace['limit']=qs['limit'](_0x18775d[_0x9482('0x2c')][_0x9482('0x1d')]);_0x44eace[_0x9482('0x1c')]=qs[_0x9482('0x1c')](_0x18775d[_0x9482('0x2c')]['offset']);}_0x44eace[_0x9482('0x34')]=qs[_0x9482('0x35')](_0x18775d['query'][_0x9482('0x35')]);_0x44eace[_0x9482('0x36')]=qs[_0x9482('0x2d')](_[_0x9482('0x37')](_0x18775d['query'],_0x482ea0[_0x9482('0x2d')]),_0x1cc986);if(_0x18775d[_0x9482('0x2c')][_0x9482('0x38')]){_0x44eace['where']=_[_0x9482('0x39')](_0x44eace['where'],{'$or':_[_0x9482('0x26')](_0x1cc986,function(_0x15aaac){if(_0x15aaac[_0x9482('0x2a')]!==_0x9482('0x3a')){var _0xda4920={};_0xda4920[_0x15aaac['name']]={'$like':'%'+_0x18775d[_0x9482('0x2c')][_0x9482('0x38')]+'%'};return _0xda4920;}})});}_0x44eace=_['merge']({},_0x44eace,_0x18775d[_0x9482('0x3b')]);var _0x5bb071={'where':_0x44eace[_0x9482('0x36')]};return db[_0x9482('0x27')][_0x9482('0x1b')](_0x5bb071)[_0x9482('0x22')](function(_0x129371){_0x148cc8['count']=_0x129371;if(_0x18775d[_0x9482('0x2c')][_0x9482('0x3c')]){_0x44eace[_0x9482('0x3d')]=[{'all':!![]}];}return db[_0x9482('0x27')]['findAll'](_0x44eace);})[_0x9482('0x22')](function(_0xfd7c59){_0x148cc8[_0x9482('0x3e')]=_0xfd7c59;return _0x148cc8;})[_0x9482('0x22')](respondWithFilteredResult(_0x2c501c,_0x44eace))[_0x9482('0x3f')](handleError(_0x2c501c,null));};exports[_0x9482('0x40')]=function(_0x12dcd4,_0x5ef9c3){var _0x3be0fc={'raw':![],'where':{'id':_0x12dcd4['params']['id']}},_0x574c0f={};_0x574c0f[_0x9482('0x2b')]=_[_0x9482('0x41')](db['UserProfileSection'][_0x9482('0x28')]);_0x574c0f['query']=_[_0x9482('0x41')](_0x12dcd4[_0x9482('0x2c')]);_0x574c0f['filters']=_[_0x9482('0x2f')](_0x574c0f[_0x9482('0x2b')],_0x574c0f[_0x9482('0x2c')]);_0x3be0fc[_0x9482('0x2e')]=_[_0x9482('0x2f')](_0x574c0f[_0x9482('0x2b')],qs[_0x9482('0x30')](_0x12dcd4[_0x9482('0x2c')]['fields']));_0x3be0fc['attributes']=_0x3be0fc[_0x9482('0x2e')][_0x9482('0x31')]?_0x3be0fc[_0x9482('0x2e')]:_0x574c0f[_0x9482('0x2b')];if(_0x12dcd4['query'][_0x9482('0x3c')]){_0x3be0fc[_0x9482('0x3d')]=[{'all':!![]}];}_0x3be0fc=_[_0x9482('0x39')]({},_0x3be0fc,_0x12dcd4[_0x9482('0x3b')]);return db['UserProfileSection'][_0x9482('0x42')](_0x3be0fc)['then'](handleEntityNotFound(_0x5ef9c3,null))[_0x9482('0x22')](respondWithResult(_0x5ef9c3,null))[_0x9482('0x3f')](handleError(_0x5ef9c3,null));};exports[_0x9482('0x43')]=function(_0x3ae817,_0x5c7472){return db[_0x9482('0x27')][_0x9482('0x43')](_0x3ae817[_0x9482('0x44')],{})[_0x9482('0x22')](respondWithResult(_0x5c7472,0xc9))[_0x9482('0x3f')](handleError(_0x5c7472,null));};exports['update']=function(_0x435344,_0x486e96){if(_0x435344[_0x9482('0x44')]['id']){delete _0x435344[_0x9482('0x44')]['id'];}return db[_0x9482('0x27')][_0x9482('0x42')]({'where':{'id':_0x435344[_0x9482('0x45')]['id']}})[_0x9482('0x22')](handleEntityNotFound(_0x486e96,null))['then'](saveUpdates(_0x435344[_0x9482('0x44')],null))['then'](respondWithResult(_0x486e96,null))[_0x9482('0x3f')](handleError(_0x486e96,null));};exports[_0x9482('0x23')]=function(_0x1ee8d7,_0x3e5790){return db[_0x9482('0x27')][_0x9482('0x42')]({'where':{'id':_0x1ee8d7[_0x9482('0x45')]['id']}})[_0x9482('0x22')](handleEntityNotFound(_0x3e5790,null))[_0x9482('0x22')](removeEntity(_0x3e5790,null))['catch'](handleError(_0x3e5790,null));};exports[_0x9482('0x46')]=function(_0x1881ef,_0x410e68){return db['UserProfileSection'][_0x9482('0x46')]()[_0x9482('0x22')](respondWithResult(_0x410e68,null))[_0x9482('0x3f')](handleError(_0x410e68,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c6cdf46..2f6d491 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 _0xa0b2=['request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','bluebird'];(function(_0x242ae2,_0x566846){var _0x3520ca=function(_0x40dcef){while(--_0x40dcef){_0x242ae2['push'](_0x242ae2['shift']());}};_0x3520ca(++_0x566846);}(_0xa0b2,0xcf));var _0x2a0b=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xa0b2[_0x1399d6];return _0x4a9db4;};'use strict';var _=require(_0x2a0b('0x0'));var util=require(_0x2a0b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a0b('0x2'));var rp=require(_0x2a0b('0x3'));var fs=require('fs');var path=require(_0x2a0b('0x4'));var rimraf=require(_0x2a0b('0x5'));var config=require(_0x2a0b('0x6'));var attributes=require(_0x2a0b('0x7'));module[_0x2a0b('0x8')]=function(_0x41838d,_0x46d4ba){return _0x41838d[_0x2a0b('0x9')](_0x2a0b('0xa'),attributes,{'tableName':_0x2a0b('0xb'),'paranoid':![],'indexes':[{'name':_0x2a0b('0xc'),'fields':[_0x2a0b('0xd'),_0x2a0b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf6a=['api','moment','path','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','userProfileId','lodash','util','../../config/logger'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xdf6a,0x1aa));var _0xadf6=function(_0x568782,_0x3ed5fc){_0x568782=_0x568782-0x0;var _0x21b69e=_0xdf6a[_0x568782];return _0x21b69e;};'use strict';var _=require(_0xadf6('0x0'));var util=require(_0xadf6('0x1'));var logger=require(_0xadf6('0x2'))(_0xadf6('0x3'));var moment=require(_0xadf6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xadf6('0x5'));var rimraf=require(_0xadf6('0x6'));var config=require(_0xadf6('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xadf6('0x8')]=function(_0x2b7441,_0x47f715){return _0x2b7441[_0xadf6('0x9')](_0xadf6('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xadf6('0xb'),'fields':['sectionId',_0xadf6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d07cdb3..a6077df 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 _0xe524=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xe524,0x106));var _0x4e52=function(_0x36a0ec,_0x4cde29){_0x36a0ec=_0x36a0ec-0x0;var _0x1df46b=_0xe524[_0x36a0ec];return _0x1df46b;};'use strict';var _=require(_0x4e52('0x0'));var util=require('util');var moment=require(_0x4e52('0x1'));var BPromise=require(_0x4e52('0x2'));var rs=require(_0x4e52('0x3'));var fs=require('fs');var Redis=require(_0x4e52('0x4'));var db=require(_0x4e52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e52('0x6'))(_0x4e52('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e52('0x8'));var client=jayson[_0x4e52('0x9')][_0x4e52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10525c,_0x26d1b7,_0x1e102e){return new BPromise(function(_0xf2f130,_0x5da3b5){return client['request'](_0x10525c,_0x1e102e)[_0x4e52('0xb')](function(_0x174d0d){logger[_0x4e52('0xc')](_0x4e52('0xd'),_0x26d1b7,_0x4e52('0xe'));logger[_0x4e52('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x26d1b7,'request\x20sent',JSON[_0x4e52('0x10')](_0x174d0d));if(_0x174d0d[_0x4e52('0x11')]){if(_0x174d0d[_0x4e52('0x11')]['code']===0x1f4){logger[_0x4e52('0x11')](_0x4e52('0xd'),_0x26d1b7,_0x174d0d[_0x4e52('0x11')]['message']);return _0x5da3b5(_0x174d0d[_0x4e52('0x11')][_0x4e52('0x12')]);}logger[_0x4e52('0x11')](_0x4e52('0xd'),_0x26d1b7,_0x174d0d[_0x4e52('0x11')]['message']);return _0xf2f130(_0x174d0d[_0x4e52('0x11')][_0x4e52('0x12')]);}else{logger[_0x4e52('0xc')](_0x4e52('0xd'),_0x26d1b7,_0x4e52('0xe'));_0xf2f130(_0x174d0d[_0x4e52('0x13')][_0x4e52('0x12')]);}})[_0x4e52('0x14')](function(_0x13fb91){logger['error'](_0x4e52('0xd'),_0x26d1b7,_0x13fb91);_0x5da3b5(_0x13fb91);});});} \ No newline at end of file +var _0xa129=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x230639,_0x20f428){var _0x5248d7=function(_0x61b79b){while(--_0x61b79b){_0x230639['push'](_0x230639['shift']());}};_0x5248d7(++_0x20f428);}(_0xa129,0x7c));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var moment=require(_0x9a12('0x2'));var BPromise=require(_0x9a12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a12('0x4'))['db'];var utils=require(_0x9a12('0x5'));var logger=require(_0x9a12('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a12('0x7')][_0x9a12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37098e,_0x457896,_0x9e7635){return new BPromise(function(_0x5ac2fe,_0x59c127){return client[_0x9a12('0x9')](_0x37098e,_0x9e7635)[_0x9a12('0xa')](function(_0x5730ae){logger[_0x9a12('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x457896,_0x9a12('0xc'));logger[_0x9a12('0xd')](_0x9a12('0xe'),_0x457896,_0x9a12('0xc'),JSON['stringify'](_0x5730ae));if(_0x5730ae[_0x9a12('0xf')]){if(_0x5730ae[_0x9a12('0xf')][_0x9a12('0x10')]===0x1f4){logger[_0x9a12('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x457896,_0x5730ae[_0x9a12('0xf')][_0x9a12('0x11')]);return _0x59c127(_0x5730ae[_0x9a12('0xf')][_0x9a12('0x11')]);}logger[_0x9a12('0xf')](_0x9a12('0x12'),_0x457896,_0x5730ae[_0x9a12('0xf')][_0x9a12('0x11')]);return _0x5ac2fe(_0x5730ae[_0x9a12('0xf')][_0x9a12('0x11')]);}else{logger['info'](_0x9a12('0x12'),_0x457896,_0x9a12('0xc'));_0x5ac2fe(_0x5730ae[_0x9a12('0x13')]['message']);}})[_0x9a12('0x14')](function(_0x5b4b21){logger[_0x9a12('0xf')](_0x9a12('0x12'),_0x457896,_0x5b4b21);_0x59c127(_0x5b4b21);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e26507a..b553208 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 _0xfd3f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x2de8f6,_0x9aa60a){var _0x3f820f=function(_0x5757f1){while(--_0x5757f1){_0x2de8f6['push'](_0x2de8f6['shift']());}};_0x3f820f(++_0x9aa60a);}(_0xfd3f,0x152));var _0xffd3=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xfd3f[_0x37c8ef];return _0x5eaee9;};'use strict';var multer=require(_0xffd3('0x0'));var util=require(_0xffd3('0x1'));var path=require(_0xffd3('0x2'));var timeout=require(_0xffd3('0x3'));var express=require(_0xffd3('0x4'));var router=express[_0xffd3('0x5')]();var auth=require(_0xffd3('0x6'));var interaction=require(_0xffd3('0x7'));var config=require(_0xffd3('0x8'));module[_0xffd3('0x9')]=router; \ No newline at end of file +var _0x96e8=['Router','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x96e8,0x15b));var _0x896e=function(_0xce5632,_0x1f781b){_0xce5632=_0xce5632-0x0;var _0x31b279=_0x96e8[_0xce5632];return _0x31b279;};'use strict';var multer=require(_0x896e('0x0'));var util=require(_0x896e('0x1'));var path=require(_0x896e('0x2'));var timeout=require(_0x896e('0x3'));var express=require(_0x896e('0x4'));var router=express[_0x896e('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x896e('0x6'));module[_0x896e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 0c255d1..210c645 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x37993f,_0x5833f1){var _0x107850=function(_0x238ac2){while(--_0x238ac2){_0x37993f['push'](_0x37993f['shift']());}};_0x107850(++_0x5833f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1c0d46,_0x3d3b52){var _0x96beb0=function(_0x4e0523){while(--_0x4e0523){_0x1c0d46['push'](_0x1c0d46['shift']());}};_0x96beb0(++_0x3d3b52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0315707..8da36c8 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 _0x6a55=['UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x3682b1,_0x4f48ea){var _0x337579=function(_0x1b4622){while(--_0x1b4622){_0x3682b1['push'](_0x3682b1['shift']());}};_0x337579(++_0x4f48ea);}(_0x6a55,0x154));var _0x56a5=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x6a55[_0x3f6e26];return _0x474345;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require(_0x56a5('0x1'))(_0x56a5('0x2'));var moment=require('moment');var BPromise=require(_0x56a5('0x3'));var rp=require(_0x56a5('0x4'));var fs=require('fs');var path=require(_0x56a5('0x5'));var rimraf=require(_0x56a5('0x6'));var config=require(_0x56a5('0x7'));var attributes=require(_0x56a5('0x8'));module[_0x56a5('0x9')]=function(_0x204659,_0x3b6d73){return _0x204659[_0x56a5('0xa')](_0x56a5('0xb'),attributes,{'tableName':_0x56a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13f6=['request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','lodash','util','moment','bluebird'];(function(_0x42468e,_0x1d9e86){var _0x42b709=function(_0x1bea3e){while(--_0x1bea3e){_0x42468e['push'](_0x42468e['shift']());}};_0x42b709(++_0x1d9e86);}(_0x13f6,0x124));var _0x613f=function(_0x459439,_0x51f289){_0x459439=_0x459439-0x0;var _0x103251=_0x13f6[_0x459439];return _0x103251;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x613f('0x2'));var BPromise=require(_0x613f('0x3'));var rp=require(_0x613f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var attributes=require(_0x613f('0x7'));module['exports']=function(_0x3f3525,_0x2367b3){return _0x3f3525['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','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 4338711..f5ce0f9 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 _0xec65=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserSmsQueue,\x20%s,\x20%s','info','result'];(function(_0x346cdb,_0x15e067){var _0x359b6c=function(_0x17c0b0){while(--_0x17c0b0){_0x346cdb['push'](_0x346cdb['shift']());}};_0x359b6c(++_0x15e067);}(_0xec65,0x18f));var _0x5ec6=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0xec65[_0x4e170e];return _0x338291;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ec6('0x0'));var BPromise=require(_0x5ec6('0x1'));var rs=require(_0x5ec6('0x2'));var fs=require('fs');var Redis=require(_0x5ec6('0x3'));var db=require(_0x5ec6('0x4'))['db'];var utils=require(_0x5ec6('0x5'));var logger=require(_0x5ec6('0x6'))('rpc');var config=require(_0x5ec6('0x7'));var jayson=require(_0x5ec6('0x8'));var client=jayson[_0x5ec6('0x9')][_0x5ec6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x295ebf,_0x4287ea,_0x12aead){return new BPromise(function(_0x161695,_0x1b9e68){return client[_0x5ec6('0xb')](_0x295ebf,_0x12aead)['then'](function(_0xb86d5){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4287ea,_0x5ec6('0xc'));logger[_0x5ec6('0xd')](_0x5ec6('0xe'),_0x4287ea,_0x5ec6('0xc'),JSON['stringify'](_0xb86d5));if(_0xb86d5[_0x5ec6('0xf')]){if(_0xb86d5[_0x5ec6('0xf')][_0x5ec6('0x10')]===0x1f4){logger[_0x5ec6('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x4287ea,_0xb86d5[_0x5ec6('0xf')]['message']);return _0x1b9e68(_0xb86d5[_0x5ec6('0xf')][_0x5ec6('0x11')]);}logger[_0x5ec6('0xf')](_0x5ec6('0x12'),_0x4287ea,_0xb86d5[_0x5ec6('0xf')][_0x5ec6('0x11')]);return _0x161695(_0xb86d5[_0x5ec6('0xf')]['message']);}else{logger[_0x5ec6('0x13')](_0x5ec6('0x12'),_0x4287ea,_0x5ec6('0xc'));_0x161695(_0xb86d5[_0x5ec6('0x14')][_0x5ec6('0x11')]);}})['catch'](function(_0x30328d){logger[_0x5ec6('0xf')](_0x5ec6('0x12'),_0x4287ea,_0x30328d);_0x1b9e68(_0x30328d);});});} \ No newline at end of file +var _0xdfc8=['request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0xdfc8,0xb1));var _0x8dfc=function(_0x5c1f18,_0x53d570){_0x5c1f18=_0x5c1f18-0x0;var _0xa58746=_0xdfc8[_0x5c1f18];return _0xa58746;};'use strict';var _=require(_0x8dfc('0x0'));var util=require('util');var moment=require(_0x8dfc('0x1'));var BPromise=require(_0x8dfc('0x2'));var rs=require(_0x8dfc('0x3'));var fs=require('fs');var Redis=require(_0x8dfc('0x4'));var db=require(_0x8dfc('0x5'))['db'];var utils=require(_0x8dfc('0x6'));var logger=require('../../config/logger')(_0x8dfc('0x7'));var config=require(_0x8dfc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8dfc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eea5c,_0x363632,_0x1da9f8){return new BPromise(function(_0x491af9,_0x3502e0){return client[_0x8dfc('0xa')](_0x4eea5c,_0x1da9f8)['then'](function(_0x137de0){logger[_0x8dfc('0xb')](_0x8dfc('0xc'),_0x363632,_0x8dfc('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x363632,'request\x20sent',JSON[_0x8dfc('0xe')](_0x137de0));if(_0x137de0['error']){if(_0x137de0[_0x8dfc('0xf')]['code']===0x1f4){logger['error'](_0x8dfc('0xc'),_0x363632,_0x137de0[_0x8dfc('0xf')][_0x8dfc('0x10')]);return _0x3502e0(_0x137de0[_0x8dfc('0xf')]['message']);}logger[_0x8dfc('0xf')](_0x8dfc('0xc'),_0x363632,_0x137de0['error'][_0x8dfc('0x10')]);return _0x491af9(_0x137de0[_0x8dfc('0xf')][_0x8dfc('0x10')]);}else{logger[_0x8dfc('0xb')](_0x8dfc('0xc'),_0x363632,_0x8dfc('0xd'));_0x491af9(_0x137de0[_0x8dfc('0x11')][_0x8dfc('0x10')]);}})[_0x8dfc('0x12')](function(_0x302f2e){logger['error'](_0x8dfc('0xc'),_0x363632,_0x302f2e);_0x3502e0(_0x302f2e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 236f727..d317d43 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 _0xbb2f=['../../config/environment','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x337581,_0x5bf307){var _0x4df69a=function(_0x1fd1ad){while(--_0x1fd1ad){_0x337581['push'](_0x337581['shift']());}};_0x4df69a(++_0x5bf307);}(_0xbb2f,0x1da));var _0xfbb2=function(_0x277f48,_0x42f9de){_0x277f48=_0x277f48-0x0;var _0x1e263d=_0xbb2f[_0x277f48];return _0x1e263d;};'use strict';var multer=require(_0xfbb2('0x0'));var util=require(_0xfbb2('0x1'));var path=require(_0xfbb2('0x2'));var timeout=require(_0xfbb2('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xfbb2('0x4'));var interaction=require(_0xfbb2('0x5'));var config=require(_0xfbb2('0x6'));module[_0xfbb2('0x7')]=router; \ No newline at end of file +var _0x9fba=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express'];(function(_0x2ec47c,_0x4eb785){var _0x437417=function(_0x564508){while(--_0x564508){_0x2ec47c['push'](_0x2ec47c['shift']());}};_0x437417(++_0x4eb785);}(_0x9fba,0x11b));var _0xa9fb=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x9fba[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0xa9fb('0x0'));var util=require(_0xa9fb('0x1'));var path=require(_0xa9fb('0x2'));var timeout=require(_0xa9fb('0x3'));var express=require(_0xa9fb('0x4'));var router=express['Router']();var auth=require(_0xa9fb('0x5'));var interaction=require(_0xa9fb('0x6'));var config=require('../../config/environment');module[_0xa9fb('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f343b30..8792460 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x2aef5a,_0x3abece){var _0x228919=function(_0x6aa429){while(--_0x6aa429){_0x2aef5a['push'](_0x2aef5a['shift']());}};_0x228919(++_0x3abece);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1c2925,_0x153feb){var _0x5c875b=function(_0x23a594){while(--_0x23a594){_0x1c2925['push'](_0x1c2925['shift']());}};_0x5c875b(++_0x153feb);}(_0xe706,0xa3));var _0x6e70=function(_0x42a791,_0x1f32c7){_0x42a791=_0x42a791-0x0;var _0x1732b1=_0xe706[_0x42a791];return _0x1732b1;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 9e75a4d..1308fbd 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 _0x752b=['api','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x752b,0xd9));var _0xb752=function(_0x382846,_0x13fd87){_0x382846=_0x382846-0x0;var _0x2858b7=_0x752b[_0x382846];return _0x2858b7;};'use strict';var _=require(_0xb752('0x0'));var util=require(_0xb752('0x1'));var logger=require(_0xb752('0x2'))(_0xb752('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb752('0x4'));var rimraf=require(_0xb752('0x5'));var config=require('../../config/environment');var attributes=require(_0xb752('0x6'));module[_0xb752('0x7')]=function(_0x51cf99,_0x57ea0b){return _0x51cf99[_0xb752('0x8')](_0xb752('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb31=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x41ded7,_0x4578e7){var _0x31c7eb=function(_0xfabde4){while(--_0xfabde4){_0x41ded7['push'](_0x41ded7['shift']());}};_0x31c7eb(++_0x4578e7);}(_0xbb31,0xcb));var _0x1bb3=function(_0xb97277,_0x57352b){_0xb97277=_0xb97277-0x0;var _0x575e02=_0xbb31[_0xb97277];return _0x575e02;};'use strict';var _=require(_0x1bb3('0x0'));var util=require(_0x1bb3('0x1'));var logger=require(_0x1bb3('0x2'))('api');var moment=require(_0x1bb3('0x3'));var BPromise=require('bluebird');var rp=require(_0x1bb3('0x4'));var fs=require('fs');var path=require(_0x1bb3('0x5'));var rimraf=require(_0x1bb3('0x6'));var config=require(_0x1bb3('0x7'));var attributes=require(_0x1bb3('0x8'));module[_0x1bb3('0x9')]=function(_0x5ecd5d,_0x21c95b){return _0x5ecd5d[_0x1bb3('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index b834ddd..d4f4efb 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 _0x1584=['message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xdf972,_0x32033f){var _0x5fcd15=function(_0x982053){while(--_0x982053){_0xdf972['push'](_0xdf972['shift']());}};_0x5fcd15(++_0x32033f);}(_0x1584,0x193));var _0x4158=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x1584[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x4158('0x0'));var util=require(_0x4158('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4158('0x2'));var fs=require('fs');var Redis=require(_0x4158('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4158('0x4'));var logger=require(_0x4158('0x5'))(_0x4158('0x6'));var config=require('../../config/environment');var jayson=require(_0x4158('0x7'));var client=jayson['client'][_0x4158('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c54ef,_0x13b99b,_0x60ce9e){return new BPromise(function(_0x4a117b,_0x451b2d){return client['request'](_0x4c54ef,_0x60ce9e)['then'](function(_0x314a75){logger[_0x4158('0x9')](_0x4158('0xa'),_0x13b99b,'request\x20sent');logger[_0x4158('0xb')](_0x4158('0xc'),_0x13b99b,_0x4158('0xd'),JSON[_0x4158('0xe')](_0x314a75));if(_0x314a75[_0x4158('0xf')]){if(_0x314a75['error'][_0x4158('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x13b99b,_0x314a75['error'][_0x4158('0x11')]);return _0x451b2d(_0x314a75[_0x4158('0xf')][_0x4158('0x11')]);}logger[_0x4158('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x13b99b,_0x314a75[_0x4158('0xf')]['message']);return _0x4a117b(_0x314a75[_0x4158('0xf')][_0x4158('0x11')]);}else{logger[_0x4158('0x9')](_0x4158('0xa'),_0x13b99b,_0x4158('0xd'));_0x4a117b(_0x314a75[_0x4158('0x12')][_0x4158('0x11')]);}})[_0x4158('0x13')](function(_0xabd5f9){logger[_0x4158('0xf')](_0x4158('0xa'),_0x13b99b,_0xabd5f9);_0x451b2d(_0xabd5f9);});});} \ No newline at end of file +var _0x7fb1=['stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3d5e72,_0x3ab167){var _0x2230e4=function(_0x4ede86){while(--_0x4ede86){_0x3d5e72['push'](_0x3d5e72['shift']());}};_0x2230e4(++_0x3ab167);}(_0x7fb1,0x1ce));var _0x17fb=function(_0x16d777,_0x5dc623){_0x16d777=_0x16d777-0x0;var _0x5b388c=_0x7fb1[_0x16d777];return _0x5b388c;};'use strict';var _=require(_0x17fb('0x0'));var util=require(_0x17fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17fb('0x2'))['db'];var utils=require(_0x17fb('0x3'));var logger=require(_0x17fb('0x4'))(_0x17fb('0x5'));var config=require(_0x17fb('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5becf2,_0x40e1c8,_0x2b56cb){return new BPromise(function(_0x16df52,_0x3b5ebc){return client[_0x17fb('0x7')](_0x5becf2,_0x2b56cb)[_0x17fb('0x8')](function(_0x5f1f5b){logger[_0x17fb('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x40e1c8,_0x17fb('0xa'));logger[_0x17fb('0xb')](_0x17fb('0xc'),_0x40e1c8,_0x17fb('0xa'),JSON[_0x17fb('0xd')](_0x5f1f5b));if(_0x5f1f5b['error']){if(_0x5f1f5b[_0x17fb('0xe')]['code']===0x1f4){logger['error'](_0x17fb('0xf'),_0x40e1c8,_0x5f1f5b['error']['message']);return _0x3b5ebc(_0x5f1f5b[_0x17fb('0xe')][_0x17fb('0x10')]);}logger[_0x17fb('0xe')](_0x17fb('0xf'),_0x40e1c8,_0x5f1f5b[_0x17fb('0xe')][_0x17fb('0x10')]);return _0x16df52(_0x5f1f5b[_0x17fb('0xe')][_0x17fb('0x10')]);}else{logger[_0x17fb('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x40e1c8,_0x17fb('0xa'));_0x16df52(_0x5f1f5b[_0x17fb('0x11')]['message']);}})[_0x17fb('0x12')](function(_0x3c0a7c){logger['error'](_0x17fb('0xf'),_0x40e1c8,_0x3c0a7c);_0x3b5ebc(_0x3c0a7c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0b041af..1003787 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 _0xedcc=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xedcc,0x168));var _0xcedc=function(_0x1a1450,_0x3f00f2){_0x1a1450=_0x1a1450-0x0;var _0x52bd0f=_0xedcc[_0x1a1450];return _0x52bd0f;};'use strict';var multer=require(_0xcedc('0x0'));var util=require('util');var path=require(_0xcedc('0x1'));var timeout=require(_0xcedc('0x2'));var express=require(_0xcedc('0x3'));var router=express[_0xcedc('0x4')]();var auth=require(_0xcedc('0x5'));var interaction=require(_0xcedc('0x6'));var config=require('../../config/environment');module[_0xcedc('0x7')]=router; \ No newline at end of file +var _0x8f31=['../../components/auth/service','../../config/environment','exports','util','path','connect-timeout','express','Router'];(function(_0x4df6ba,_0x477c3e){var _0x472acf=function(_0x248987){while(--_0x248987){_0x4df6ba['push'](_0x4df6ba['shift']());}};_0x472acf(++_0x477c3e);}(_0x8f31,0x11b));var _0x18f3=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0x8f31[_0x46d87a];return _0x115296;};'use strict';var multer=require('multer');var util=require(_0x18f3('0x0'));var path=require(_0x18f3('0x1'));var timeout=require(_0x18f3('0x2'));var express=require(_0x18f3('0x3'));var router=express[_0x18f3('0x4')]();var auth=require(_0x18f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x18f3('0x6'));module[_0x18f3('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a337937..e025d11 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 _0x43f0=['STRING','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2b0e50,_0x33acb4){var _0x1ada01=function(_0x1dd4b1){while(--_0x1dd4b1){_0x2b0e50['push'](_0x2b0e50['shift']());}};_0x1ada01(++_0x33acb4);}(_0x43f0,0x74));var _0x043f=function(_0x4da3e6,_0x12ae94){_0x4da3e6=_0x4da3e6-0x0;var _0x13c79b=_0x43f0[_0x4da3e6];return _0x13c79b;};'use strict';var Sequelize=require(_0x043f('0x0'));module[_0x043f('0x1')]={'uniqueid':{'type':Sequelize[_0x043f('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x043f('0x3')},'membername':{'type':Sequelize[_0x043f('0x4')],'allowNull':![],'comment':_0x043f('0x3')},'UserId':{'type':Sequelize[_0x043f('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x043f('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x043f('0x3')},'VoiceQueueId':{'type':Sequelize[_0x043f('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x043f('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x043f('0x3')},'penalty':{'type':Sequelize[_0x043f('0x2')](0xb),'defaultValue':0x0,'comment':_0x043f('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x043f('0x3')}}; \ No newline at end of file +var _0x6ee8=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x482d8a,_0x17f7ba){var _0x3fd018=function(_0x6b4437){while(--_0x6b4437){_0x482d8a['push'](_0x482d8a['shift']());}};_0x3fd018(++_0x17f7ba);}(_0x6ee8,0x140));var _0x86ee=function(_0x279bf9,_0x14707d){_0x279bf9=_0x279bf9-0x0;var _0x1ba46d=_0x6ee8[_0x279bf9];return _0x1ba46d;};'use strict';var Sequelize=require('sequelize');module[_0x86ee('0x0')]={'uniqueid':{'type':Sequelize[_0x86ee('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x86ee('0x2')},'membername':{'type':Sequelize[_0x86ee('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x86ee('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x86ee('0x3')],'allowNull':![],'unique':_0x86ee('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x86ee('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x86ee('0x3')],'allowNull':![],'unique':_0x86ee('0x4'),'comment':_0x86ee('0x2')},'penalty':{'type':Sequelize[_0x86ee('0x1')](0xb),'defaultValue':0x0,'comment':_0x86ee('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x86ee('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 432ea3a..dc3b919 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 _0x903e=['remove','emit','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x2cd8e4,_0x1af474){var _0x565e8b=function(_0x586601){while(--_0x586601){_0x2cd8e4['push'](_0x2cd8e4['shift']());}};_0x565e8b(++_0x1af474);}(_0x903e,0xb8));var _0xe903=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0x903e[_0x31b31b];return _0x2c8fc2;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe903('0x0'))['db'][_0xe903('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe903('0x2')](0x0);var events={'afterCreate':_0xe903('0x3'),'afterUpdate':_0xe903('0x4'),'afterDestroy':_0xe903('0x5')};function emitEvent(_0x10611c){return function(_0xe91e2c,_0x497962,_0xfea05b){UserVoiceQueueRtEvents[_0xe903('0x6')](_0x10611c+':'+_0xe91e2c['id'],_0xe91e2c);UserVoiceQueueRtEvents['emit'](_0x10611c,_0xe91e2c);_0xfea05b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe903('0x7')](e,emitEvent(event));}}module[_0xe903('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5eb8=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x5eb8,0x185));var _0x85eb=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x5eb8[_0x7c0074];return _0x13e95b;};'use strict';var EventEmitter=require(_0x85eb('0x0'));var UserVoiceQueueRt=require(_0x85eb('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x85eb('0x2')](0x0);var events={'afterCreate':_0x85eb('0x3'),'afterUpdate':_0x85eb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1a6404){return function(_0x386f44,_0x3c878e,_0x114a92){UserVoiceQueueRtEvents['emit'](_0x1a6404+':'+_0x386f44['id'],_0x386f44);UserVoiceQueueRtEvents[_0x85eb('0x5')](_0x1a6404,_0x386f44);_0x114a92(null);};}for(var e in events){if(events[_0x85eb('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x85eb('0x7')](e,emitEvent(event));}}module[_0x85eb('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7cc0664..166a6be 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 _0xa817=['api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x49cb54,_0x1b8835){var _0x32c7e0=function(_0x31f723){while(--_0x31f723){_0x49cb54['push'](_0x49cb54['shift']());}};_0x32c7e0(++_0x1b8835);}(_0xa817,0xf4));var _0x7a81=function(_0x2b02b8,_0x1df504){_0x2b02b8=_0x2b02b8-0x0;var _0x472552=_0xa817[_0x2b02b8];return _0x472552;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var logger=require(_0x7a81('0x2'))(_0x7a81('0x3'));var moment=require(_0x7a81('0x4'));var BPromise=require(_0x7a81('0x5'));var rp=require(_0x7a81('0x6'));var fs=require('fs');var path=require(_0x7a81('0x7'));var rimraf=require(_0x7a81('0x8'));var config=require('../../config/environment');var attributes=require(_0x7a81('0x9'));module[_0x7a81('0xa')]=function(_0x5d92af,_0x52e605){return _0x5d92af['define'](_0x7a81('0xb'),attributes,{'tableName':_0x7a81('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef47=['request-promise','path','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xef47,0xdf));var _0x7ef4=function(_0x23f8a7,_0x5813f4){_0x23f8a7=_0x23f8a7-0x0;var _0x183868=_0xef47[_0x23f8a7];return _0x183868;};'use strict';var _=require(_0x7ef4('0x0'));var util=require(_0x7ef4('0x1'));var logger=require(_0x7ef4('0x2'))(_0x7ef4('0x3'));var moment=require(_0x7ef4('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ef4('0x5'));var fs=require('fs');var path=require(_0x7ef4('0x6'));var rimraf=require(_0x7ef4('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x7ef4('0x8')]=function(_0x1dca35,_0x1d9b9c){return _0x1dca35[_0x7ef4('0x9')](_0x7ef4('0xa'),attributes,{'tableName':_0x7ef4('0xb'),'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 502033f..d527458 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 _0xd925=['../../config/utils','rpc','client','http','redis','defaults','./userVoiceQueueRt.socket','register','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','info','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x12f54f,_0x28b55f){var _0x45b7a7=function(_0x3c5ddd){while(--_0x3c5ddd){_0x12f54f['push'](_0x12f54f['shift']());}};_0x45b7a7(++_0x28b55f);}(_0xd925,0x1ca));var _0x5d92=function(_0x303a3b,_0x5b2289){_0x303a3b=_0x303a3b-0x0;var _0x7d90c0=_0xd925[_0x303a3b];return _0x7d90c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d92('0x0'));var BPromise=require(_0x5d92('0x1'));var rs=require(_0x5d92('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d92('0x3'))['db'];var utils=require(_0x5d92('0x4'));var logger=require('../../config/logger')(_0x5d92('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d92('0x6')][_0x5d92('0x7')]({'port':0x232a});config[_0x5d92('0x8')]=_[_0x5d92('0x9')](config[_0x5d92('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d92('0xa'))[_0x5d92('0xb')](socket);function respondWithRpcPromise(_0x3a13bb,_0x388a9d,_0x17f3f8){return new BPromise(function(_0x24c647,_0x27e86f){return client['request'](_0x3a13bb,_0x17f3f8)['then'](function(_0x31b444){logger['info'](_0x5d92('0xc'),_0x388a9d,_0x5d92('0xd'));logger[_0x5d92('0xe')](_0x5d92('0xf'),_0x388a9d,_0x5d92('0xd'),JSON[_0x5d92('0x10')](_0x31b444));if(_0x31b444[_0x5d92('0x11')]){if(_0x31b444['error']['code']===0x1f4){logger['error'](_0x5d92('0xc'),_0x388a9d,_0x31b444['error'][_0x5d92('0x12')]);return _0x27e86f(_0x31b444[_0x5d92('0x11')][_0x5d92('0x12')]);}logger[_0x5d92('0x11')](_0x5d92('0xc'),_0x388a9d,_0x31b444[_0x5d92('0x11')][_0x5d92('0x12')]);return _0x24c647(_0x31b444['error'][_0x5d92('0x12')]);}else{logger['info'](_0x5d92('0xc'),_0x388a9d,'request\x20sent');_0x24c647(_0x31b444[_0x5d92('0x13')][_0x5d92('0x12')]);}})['catch'](function(_0x38b659){logger[_0x5d92('0x11')](_0x5d92('0xc'),_0x388a9d,_0x38b659);_0x27e86f(_0x38b659);});});}exports[_0x5d92('0x14')]=function(_0x5efba1){var _0x2d8650=this;return new Promise(function(_0x34194f,_0xf75836){return db[_0x5d92('0x15')][_0x5d92('0x16')]({'raw':_0x5efba1[_0x5d92('0x17')]?_0x5efba1[_0x5d92('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5efba1['options']?_0x5efba1[_0x5d92('0x17')][_0x5d92('0x18')]||null:null,'attributes':[[db[_0x5d92('0x19')]['fn'](_0x5d92('0x1a'),db[_0x5d92('0x19')]['fn']('IF',db[_0x5d92('0x19')][_0x5d92('0x1b')](_0x5d92('0x1c')))),_0x5d92('0x1d')]]})[_0x5d92('0x1e')](function(_0x2e793d){logger[_0x5d92('0x1f')](_0x5d92('0x14'),_0x5efba1);logger[_0x5d92('0xe')]('GetVoiceQueueRtPauses',_0x5efba1,JSON['stringify'](_0x2e793d));_0x34194f(_0x2e793d);})[_0x5d92('0x20')](function(_0x1b6ce7){logger[_0x5d92('0x11')](_0x5d92('0x14'),_0x1b6ce7[_0x5d92('0x12')],_0x5efba1);_0xf75836(_0x2d8650[_0x5d92('0x11')](0x1f4,_0x1b6ce7[_0x5d92('0x12')]));});});}; \ No newline at end of file +var _0x7b4c=['UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b4c,0x196));var _0xc7b4=function(_0x16353a,_0x33d969){_0x16353a=_0x16353a-0x0;var _0x1b732b=_0x7b4c[_0x16353a];return _0x1b732b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7b4('0x0'));var BPromise=require(_0xc7b4('0x1'));var rs=require(_0xc7b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7b4('0x3'))['db'];var utils=require(_0xc7b4('0x4'));var logger=require('../../config/logger')(_0xc7b4('0x5'));var config=require('../../config/environment');var jayson=require(_0xc7b4('0x6'));var client=jayson[_0xc7b4('0x7')][_0xc7b4('0x8')]({'port':0x232a});config[_0xc7b4('0x9')]=_[_0xc7b4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc7b4('0xb'))(new Redis(config[_0xc7b4('0x9')]));require(_0xc7b4('0xc'))[_0xc7b4('0xd')](socket);function respondWithRpcPromise(_0x461079,_0x4e8ec9,_0x1bb8f5){return new BPromise(function(_0x38e289,_0x3fdee4){return client[_0xc7b4('0xe')](_0x461079,_0x1bb8f5)[_0xc7b4('0xf')](function(_0x258873){logger[_0xc7b4('0x10')](_0xc7b4('0x11'),_0x4e8ec9,_0xc7b4('0x12'));logger[_0xc7b4('0x13')](_0xc7b4('0x14'),_0x4e8ec9,'request\x20sent',JSON[_0xc7b4('0x15')](_0x258873));if(_0x258873['error']){if(_0x258873['error'][_0xc7b4('0x16')]===0x1f4){logger['error'](_0xc7b4('0x11'),_0x4e8ec9,_0x258873[_0xc7b4('0x17')][_0xc7b4('0x18')]);return _0x3fdee4(_0x258873[_0xc7b4('0x17')][_0xc7b4('0x18')]);}logger[_0xc7b4('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4e8ec9,_0x258873[_0xc7b4('0x17')][_0xc7b4('0x18')]);return _0x38e289(_0x258873[_0xc7b4('0x17')]['message']);}else{logger['info'](_0xc7b4('0x11'),_0x4e8ec9,'request\x20sent');_0x38e289(_0x258873[_0xc7b4('0x19')]['message']);}})['catch'](function(_0x56de53){logger[_0xc7b4('0x17')](_0xc7b4('0x11'),_0x4e8ec9,_0x56de53);_0x3fdee4(_0x56de53);});});}exports['GetVoiceQueueRtPauses']=function(_0x29f4b1){var _0x79aba5=this;return new Promise(function(_0x383a7c,_0x39bf3b){return db[_0xc7b4('0x1a')][_0xc7b4('0x1b')]({'raw':_0x29f4b1['options']?_0x29f4b1[_0xc7b4('0x1c')][_0xc7b4('0x1d')]===undefined?!![]:![]:!![],'where':_0x29f4b1['options']?_0x29f4b1[_0xc7b4('0x1c')]['where']||null:null,'attributes':[[db[_0xc7b4('0x1e')]['fn'](_0xc7b4('0x1f'),db[_0xc7b4('0x1e')]['fn']('IF',db[_0xc7b4('0x1e')]['literal'](_0xc7b4('0x20')))),_0xc7b4('0x21')]]})[_0xc7b4('0xf')](function(_0x31d917){logger[_0xc7b4('0x10')](_0xc7b4('0x22'),_0x29f4b1);logger[_0xc7b4('0x13')]('GetVoiceQueueRtPauses',_0x29f4b1,JSON[_0xc7b4('0x15')](_0x31d917));_0x383a7c(_0x31d917);})[_0xc7b4('0x23')](function(_0x383c17){logger[_0xc7b4('0x17')]('GetVoiceQueueRtPauses',_0x383c17['message'],_0x29f4b1);_0x39bf3b(_0x79aba5['error'](0x1f4,_0x383c17[_0xc7b4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8921ac6..19b9bb5 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 _0x0a01=['emit','register','length','./userVoiceQueueRt.events','save','update'];(function(_0xbf6589,_0x2f5284){var _0x3ed43a=function(_0xe6091a){while(--_0xe6091a){_0xbf6589['push'](_0xbf6589['shift']());}};_0x3ed43a(++_0x2f5284);}(_0x0a01,0x1cb));var _0x10a0=function(_0x1532b4,_0x57bc45){_0x1532b4=_0x1532b4-0x0;var _0x204406=_0x0a01[_0x1532b4];return _0x204406;};'use strict';var UserVoiceQueueRtEvents=require(_0x10a0('0x0'));var events=[_0x10a0('0x1'),'remove',_0x10a0('0x2')];function createListener(_0x2facc1,_0x9e17f3){return function(_0x3b9a52){_0x9e17f3[_0x10a0('0x3')](_0x2facc1,_0x3b9a52);};}function removeListener(_0x2aa3ab,_0x421add){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2aa3ab,_0x421add);};}exports[_0x10a0('0x4')]=function(_0x4cdc5b){for(var _0x195b79=0x0,_0x18d351=events[_0x10a0('0x5')];_0x195b79<_0x18d351;_0x195b79++){var _0x4a4c66=events[_0x195b79];var _0x389336=createListener('userVoiceQueueRt:'+_0x4a4c66,_0x4cdc5b);UserVoiceQueueRtEvents['on'](_0x4a4c66,_0x389336);}}; \ No newline at end of file +var _0x6eef=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener','register'];(function(_0xb81152,_0x12bc1f){var _0x5791e5=function(_0x2c8f93){while(--_0x2c8f93){_0xb81152['push'](_0xb81152['shift']());}};_0x5791e5(++_0x12bc1f);}(_0x6eef,0x1f2));var _0xf6ee=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x6eef[_0x26f702];return _0x11417d;};'use strict';var UserVoiceQueueRtEvents=require(_0xf6ee('0x0'));var events=['save',_0xf6ee('0x1'),_0xf6ee('0x2')];function createListener(_0x4800b0,_0x4aa30e){return function(_0x118eec){_0x4aa30e[_0xf6ee('0x3')](_0x4800b0,_0x118eec);};}function removeListener(_0x48709f,_0x20aad9){return function(){UserVoiceQueueRtEvents[_0xf6ee('0x4')](_0x48709f,_0x20aad9);};}exports[_0xf6ee('0x5')]=function(_0x9f5894){for(var _0x217ec2=0x0,_0x2bffc5=events[_0xf6ee('0x6')];_0x217ec2<_0x2bffc5;_0x217ec2++){var _0x1b3dd9=events[_0x217ec2];var _0x2622cb=createListener(_0xf6ee('0x7')+_0x1b3dd9,_0x9f5894);UserVoiceQueueRtEvents['on'](_0x1b3dd9,_0x2622cb);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4b166c9..ba5c019 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 _0x6772=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6772,0xdb));var _0x2677=function(_0xf3a138,_0x5c9e3a){_0xf3a138=_0xf3a138-0x0;var _0x2c0055=_0x6772[_0xf3a138];return _0x2c0055;};'use strict';var multer=require(_0x2677('0x0'));var util=require(_0x2677('0x1'));var path=require(_0x2677('0x2'));var timeout=require(_0x2677('0x3'));var express=require(_0x2677('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2677('0x5'));var config=require(_0x2677('0x6'));module[_0x2677('0x7')]=router; \ No newline at end of file +var _0xd9c9=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3c8a27,_0x3f6186){var _0x3e438d=function(_0x890417){while(--_0x890417){_0x3c8a27['push'](_0x3c8a27['shift']());}};_0x3e438d(++_0x3f6186);}(_0xd9c9,0x1c0));var _0x9d9c=function(_0x6d7060,_0x119c08){_0x6d7060=_0x6d7060-0x0;var _0x195046=_0xd9c9[_0x6d7060];return _0x195046;};'use strict';var multer=require(_0x9d9c('0x0'));var util=require(_0x9d9c('0x1'));var path=require(_0x9d9c('0x2'));var timeout=require(_0x9d9c('0x3'));var express=require(_0x9d9c('0x4'));var router=express[_0x9d9c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d9c('0x6'));var config=require(_0x9d9c('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 4484d40..a044380 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 _0xbaf0=['exports','INTEGER'];(function(_0x2376d1,_0x38eec4){var _0x443759=function(_0x73c733){while(--_0x73c733){_0x2376d1['push'](_0x2376d1['shift']());}};_0x443759(++_0x38eec4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d66d428..de6de00 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 _0x3630=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3630,0xda));var _0x0363=function(_0x77238f,_0xbe4c59){_0x77238f=_0x77238f-0x0;var _0x3d809e=_0x3630[_0x77238f];return _0x3d809e;};'use strict';var _=require('lodash');var util=require(_0x0363('0x0'));var logger=require(_0x0363('0x1'))(_0x0363('0x2'));var moment=require(_0x0363('0x3'));var BPromise=require(_0x0363('0x4'));var rp=require(_0x0363('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0363('0x6'));var config=require(_0x0363('0x7'));var attributes=require(_0x0363('0x8'));module[_0x0363('0x9')]=function(_0x3a2b1f,_0x3ef87e){return _0x3a2b1f['define'](_0x0363('0xa'),attributes,{'tableName':_0x0363('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a24=['define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x4aa115,_0x548fbc){var _0x4d0e80=function(_0x5073de){while(--_0x5073de){_0x4aa115['push'](_0x4aa115['shift']());}};_0x4d0e80(++_0x548fbc);}(_0x6a24,0x86));var _0x46a2=function(_0x21c1e9,_0x284814){_0x21c1e9=_0x21c1e9-0x0;var _0x4c2399=_0x6a24[_0x21c1e9];return _0x4c2399;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var logger=require(_0x46a2('0x2'))(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x46a2('0x5'));var fs=require('fs');var path=require(_0x46a2('0x6'));var rimraf=require('rimraf');var config=require(_0x46a2('0x7'));var attributes=require(_0x46a2('0x8'));module[_0x46a2('0x9')]=function(_0x23e7f5,_0x48b2df){return _0x23e7f5[_0x46a2('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x46a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a3d797e..3a62102 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(_0x4e3295,_0x40a0d4){var _0x3a494c=function(_0x297748){while(--_0x297748){_0x4e3295['push'](_0x4e3295['shift']());}};_0x3a494c(++_0x40a0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x137eae,_0x4a0140){var _0x174d09=function(_0x41edca){while(--_0x41edca){_0x137eae['push'](_0x137eae['shift']());}};_0x174d09(++_0x4a0140);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 d67f4ae..5df2b6d 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 _0x6850=['index','/:id','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./variable.controller','get','isAuthenticated'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x6850,0x1e3));var _0x0685=function(_0x42fd8b,_0x4341c1){_0x42fd8b=_0x42fd8b-0x0;var _0x1f6c52=_0x6850[_0x42fd8b];return _0x1f6c52;};'use strict';var multer=require(_0x0685('0x0'));var util=require(_0x0685('0x1'));var path=require(_0x0685('0x2'));var timeout=require(_0x0685('0x3'));var express=require(_0x0685('0x4'));var router=express[_0x0685('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0685('0x6'));var config=require('../../config/environment');var controller=require(_0x0685('0x7'));router[_0x0685('0x8')]('/',auth[_0x0685('0x9')](),controller[_0x0685('0xa')]);router[_0x0685('0x8')](_0x0685('0xb'),auth[_0x0685('0x9')](),controller['show']);router['post']('/',auth[_0x0685('0x9')](),controller[_0x0685('0xc')]);router['put'](_0x0685('0xb'),auth['isAuthenticated'](),controller[_0x0685('0xd')]);router[_0x0685('0xe')](_0x0685('0xb'),auth[_0x0685('0x9')](),controller[_0x0685('0xf')]);module[_0x0685('0x10')]=router; \ No newline at end of file +var _0x32f3=['exports','multer','util','path','connect-timeout','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x4b10a1,_0x5dba53){var _0x25f2c5=function(_0x5791c8){while(--_0x5791c8){_0x4b10a1['push'](_0x4b10a1['shift']());}};_0x25f2c5(++_0x5dba53);}(_0x32f3,0x81));var _0x332f=function(_0xa1e982,_0x53bdfa){_0xa1e982=_0xa1e982-0x0;var _0x4e3ab8=_0x32f3[_0xa1e982];return _0x4e3ab8;};'use strict';var multer=require(_0x332f('0x0'));var util=require(_0x332f('0x1'));var path=require(_0x332f('0x2'));var timeout=require(_0x332f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x332f('0x4'));var controller=require(_0x332f('0x5'));router[_0x332f('0x6')]('/',auth['isAuthenticated'](),controller[_0x332f('0x7')]);router[_0x332f('0x6')](_0x332f('0x8'),auth[_0x332f('0x9')](),controller[_0x332f('0xa')]);router[_0x332f('0xb')]('/',auth[_0x332f('0x9')](),controller['create']);router[_0x332f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x332f('0xd')]);router[_0x332f('0xe')](_0x332f('0x8'),auth[_0x332f('0x9')](),controller['destroy']);module[_0x332f('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 68a7c62..608f435 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 _0x547c=['STRING','name','sequelize','exports'];(function(_0x7e0c0a,_0x395d83){var _0x9ff99e=function(_0x259eee){while(--_0x259eee){_0x7e0c0a['push'](_0x7e0c0a['shift']());}};_0x9ff99e(++_0x395d83);}(_0x547c,0x156));var _0xc547=function(_0x56a6f4,_0x5cee43){_0x56a6f4=_0x56a6f4-0x0;var _0x4554c2=_0x547c[_0x56a6f4];return _0x4554c2;};'use strict';var Sequelize=require(_0xc547('0x0'));module[_0xc547('0x1')]={'name':{'type':Sequelize[_0xc547('0x2')],'unique':_0xc547('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc547('0x2')]}}; \ No newline at end of file +var _0x2e2e=['exports','STRING','name','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2e2e,0x73));var _0xe2e2=function(_0x19f132,_0x4f35ff){_0x19f132=_0x19f132-0x0;var _0x9cbf00=_0x2e2e[_0x19f132];return _0x9cbf00;};'use strict';var Sequelize=require(_0xe2e2('0x0'));module[_0xe2e2('0x1')]={'name':{'type':Sequelize[_0xe2e2('0x2')],'unique':_0xe2e2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c3694b0..65af4de 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 _0x2fa6=['find','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','get','Variables','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x26d823,_0x3f2031){var _0x5c24b1=function(_0x205a09){while(--_0x205a09){_0x26d823['push'](_0x26d823['shift']());}};_0x5c24b1(++_0x3f2031);}(_0x2fa6,0x1e9));var _0x62fa=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x2fa6[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x62fa('0x0'));var emlformat=require(_0x62fa('0x1'));var rimraf=require(_0x62fa('0x2'));var zipdir=require(_0x62fa('0x3'));var jsonpatch=require(_0x62fa('0x4'));var rp=require(_0x62fa('0x5'));var moment=require(_0x62fa('0x6'));var BPromise=require(_0x62fa('0x7'));var Mustache=require(_0x62fa('0x8'));var util=require(_0x62fa('0x9'));var path=require(_0x62fa('0xa'));var sox=require(_0x62fa('0xb'));var csv=require(_0x62fa('0xc'));var ejs=require(_0x62fa('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x62fa('0xe'));var jsforce=require(_0x62fa('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x62fa('0xc'));var querystring=require(_0x62fa('0x10'));var Papa=require(_0x62fa('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x62fa('0x12'));var as=require(_0x62fa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62fa('0x14'))(_0x62fa('0x15'));var utils=require(_0x62fa('0x16'));var config=require('../../config/environment');var db=require(_0x62fa('0x17'))['db'];function respondWithStatusCode(_0x5cb98b,_0x543717){_0x543717=_0x543717||0xcc;return function(_0x42b604){if(_0x42b604){return _0x5cb98b['sendStatus'](_0x543717);}return _0x5cb98b[_0x62fa('0x18')](_0x543717)[_0x62fa('0x19')]();};}function respondWithResult(_0x15d9cb,_0x22fb6a){_0x22fb6a=_0x22fb6a||0xc8;return function(_0x55b6f4){if(_0x55b6f4){return _0x15d9cb['status'](_0x22fb6a)[_0x62fa('0x1a')](_0x55b6f4);}};}function respondWithFilteredResult(_0x30c172,_0x19464d){return function(_0x202ef7){if(_0x202ef7){var _0x430adc=_0x202ef7['count'],_0x5c3cc5=_0x19464d['offset'],_0xc44db3=_0x19464d[_0x62fa('0x1b')]+_0x19464d[_0x62fa('0x1c')],_0x5de9ec;if(_0xc44db3>=_0x430adc){_0xc44db3=_0x430adc;_0x5de9ec=0xc8;}else{_0x5de9ec=0xce;}_0x30c172['status'](_0x5de9ec);return _0x30c172['set'](_0x62fa('0x1d'),_0x5c3cc5+'-'+_0xc44db3+'/'+_0x430adc)[_0x62fa('0x1a')](_0x202ef7);}return null;};}function patchUpdates(_0x8cc592){return function(_0x2af58f){try{jsonpatch['apply'](_0x2af58f,_0x8cc592,!![]);}catch(_0x33939d){return BPromise[_0x62fa('0x1e')](_0x33939d);}return _0x2af58f[_0x62fa('0x1f')]();};}function saveUpdates(_0x534e04,_0x565e71){return function(_0x5e9b8d){if(_0x5e9b8d){return _0x5e9b8d[_0x62fa('0x20')](_0x534e04)['then'](function(_0x4fc5cd){return _0x4fc5cd;});}return null;};}function removeEntity(_0x3e7455,_0x11ee38){return function(_0xca9786){if(_0xca9786){return _0xca9786[_0x62fa('0x21')]()['then'](function(){var _0x5e76a3=_0xca9786[_0x62fa('0x22')]({'plain':!![]});var _0x491e6f=_0x62fa('0x23');return db[_0x62fa('0x24')]['destroy']({'where':{'type':_0x491e6f,'resourceId':_0x5e76a3['id']}})['then'](function(){return _0xca9786;});})[_0x62fa('0x25')](function(){_0x3e7455[_0x62fa('0x18')](0xcc)[_0x62fa('0x19')]();});}};}function handleEntityNotFound(_0x451592,_0x48ebe1){return function(_0x461396){if(!_0x461396){_0x451592[_0x62fa('0x26')](0x194);}return _0x461396;};}function handleError(_0x276a02,_0x209da5){_0x209da5=_0x209da5||0x1f4;return function(_0x2b1e19){logger[_0x62fa('0x27')](_0x2b1e19[_0x62fa('0x28')]);if(_0x2b1e19[_0x62fa('0x29')]){delete _0x2b1e19[_0x62fa('0x29')];}_0x276a02[_0x62fa('0x18')](_0x209da5)[_0x62fa('0x2a')](_0x2b1e19);};}exports[_0x62fa('0x2b')]=function(_0x1b2408,_0x104e63){var _0x5f2d4d={},_0x9b413d={},_0x53a258={'count':0x0,'rows':[]};var _0x191d40=_[_0x62fa('0x2c')](db[_0x62fa('0x2d')]['rawAttributes'],function(_0x5c9ddd){return{'name':_0x5c9ddd[_0x62fa('0x2e')],'type':_0x5c9ddd[_0x62fa('0x2f')][_0x62fa('0x30')]};});_0x9b413d[_0x62fa('0x31')]=_[_0x62fa('0x2c')](_0x191d40,_0x62fa('0x29'));_0x9b413d[_0x62fa('0x32')]=_[_0x62fa('0x33')](_0x1b2408[_0x62fa('0x32')]);_0x9b413d[_0x62fa('0x34')]=_[_0x62fa('0x35')](_0x9b413d[_0x62fa('0x31')],_0x9b413d[_0x62fa('0x32')]);_0x5f2d4d[_0x62fa('0x36')]=_['intersection'](_0x9b413d['model'],qs[_0x62fa('0x37')](_0x1b2408[_0x62fa('0x32')]['fields']));_0x5f2d4d[_0x62fa('0x36')]=_0x5f2d4d['attributes']['length']?_0x5f2d4d[_0x62fa('0x36')]:_0x9b413d[_0x62fa('0x31')];if(!_0x1b2408[_0x62fa('0x32')]['hasOwnProperty'](_0x62fa('0x38'))){_0x5f2d4d['limit']=qs[_0x62fa('0x1c')](_0x1b2408[_0x62fa('0x32')][_0x62fa('0x1c')]);_0x5f2d4d['offset']=qs['offset'](_0x1b2408[_0x62fa('0x32')]['offset']);}_0x5f2d4d[_0x62fa('0x39')]=qs[_0x62fa('0x3a')](_0x1b2408[_0x62fa('0x32')][_0x62fa('0x3a')]);_0x5f2d4d['where']=qs[_0x62fa('0x34')](_['pick'](_0x1b2408['query'],_0x9b413d[_0x62fa('0x34')]),_0x191d40);if(_0x1b2408[_0x62fa('0x32')]['filter']){_0x5f2d4d[_0x62fa('0x3b')]=_['merge'](_0x5f2d4d[_0x62fa('0x3b')],{'$or':_[_0x62fa('0x2c')](_0x191d40,function(_0x49050a){if(_0x49050a['type']!==_0x62fa('0x3c')){var _0x33884c={};_0x33884c[_0x49050a[_0x62fa('0x29')]]={'$like':'%'+_0x1b2408['query'][_0x62fa('0x3d')]+'%'};return _0x33884c;}})});}_0x5f2d4d=_[_0x62fa('0x3e')]({},_0x5f2d4d,_0x1b2408[_0x62fa('0x3f')]);var _0x118b69={'where':_0x5f2d4d[_0x62fa('0x3b')]};return db[_0x62fa('0x2d')][_0x62fa('0x40')](_0x118b69)[_0x62fa('0x25')](function(_0x4d38a5){_0x53a258[_0x62fa('0x40')]=_0x4d38a5;if(_0x1b2408[_0x62fa('0x32')][_0x62fa('0x41')]){_0x5f2d4d[_0x62fa('0x42')]=[{'all':!![]}];}return db[_0x62fa('0x2d')][_0x62fa('0x43')](_0x5f2d4d);})['then'](function(_0x39d676){_0x53a258[_0x62fa('0x44')]=_0x39d676;return _0x53a258;})['then'](respondWithFilteredResult(_0x104e63,_0x5f2d4d))[_0x62fa('0x45')](handleError(_0x104e63,null));};exports[_0x62fa('0x46')]=function(_0x3fd55d,_0x320201){var _0x26ba50={'raw':!![],'where':{'id':_0x3fd55d[_0x62fa('0x47')]['id']}},_0x42d716={};_0x42d716[_0x62fa('0x31')]=_['keys'](db[_0x62fa('0x2d')]['rawAttributes']);_0x42d716['query']=_['keys'](_0x3fd55d[_0x62fa('0x32')]);_0x42d716[_0x62fa('0x34')]=_[_0x62fa('0x35')](_0x42d716[_0x62fa('0x31')],_0x42d716[_0x62fa('0x32')]);_0x26ba50['attributes']=_[_0x62fa('0x35')](_0x42d716[_0x62fa('0x31')],qs[_0x62fa('0x37')](_0x3fd55d[_0x62fa('0x32')][_0x62fa('0x37')]));_0x26ba50[_0x62fa('0x36')]=_0x26ba50[_0x62fa('0x36')][_0x62fa('0x48')]?_0x26ba50[_0x62fa('0x36')]:_0x42d716[_0x62fa('0x31')];if(_0x3fd55d[_0x62fa('0x32')][_0x62fa('0x41')]){_0x26ba50[_0x62fa('0x42')]=[{'all':!![]}];}_0x26ba50=_[_0x62fa('0x3e')]({},_0x26ba50,_0x3fd55d[_0x62fa('0x3f')]);return db[_0x62fa('0x2d')]['find'](_0x26ba50)[_0x62fa('0x25')](handleEntityNotFound(_0x320201,null))[_0x62fa('0x25')](respondWithResult(_0x320201,null))['catch'](handleError(_0x320201,null));};exports[_0x62fa('0x49')]=function(_0x321387,_0x518189){return db['Variable'][_0x62fa('0x49')](_0x321387[_0x62fa('0x4a')],{})[_0x62fa('0x25')](function(_0x3fb678){var _0x2a3dcb=_0x321387['user'][_0x62fa('0x22')]({'plain':!![]});if(!_0x2a3dcb)throw new Error(_0x62fa('0x4b'));if(_0x2a3dcb[_0x62fa('0x4c')]===_0x62fa('0x4d')){var _0xfc82e4=_0x3fb678[_0x62fa('0x22')]({'plain':!![]});var _0x2b9321=_0x62fa('0x23');return db['UserProfileSection'][_0x62fa('0x4e')]({'where':{'name':_0x2b9321,'userProfileId':_0x2a3dcb[_0x62fa('0x4f')]},'raw':!![]})[_0x62fa('0x25')](function(_0xa63d78){if(_0xa63d78&&_0xa63d78[_0x62fa('0x50')]===0x0){return db['UserProfileResource'][_0x62fa('0x49')]({'name':_0xfc82e4[_0x62fa('0x29')],'resourceId':_0xfc82e4['id'],'type':_0xa63d78['name'],'sectionId':_0xa63d78['id']},{})[_0x62fa('0x25')](function(){return _0x3fb678;});}else{return _0x3fb678;}})[_0x62fa('0x45')](function(_0x3b31bf){logger[_0x62fa('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b31bf);throw _0x3b31bf;});}return _0x3fb678;})['then'](respondWithResult(_0x518189,0xc9))[_0x62fa('0x45')](handleError(_0x518189,null));};exports[_0x62fa('0x20')]=function(_0x28b304,_0x133d76){if(_0x28b304[_0x62fa('0x4a')]['id']){delete _0x28b304['body']['id'];}return db['Variable'][_0x62fa('0x4e')]({'where':{'id':_0x28b304[_0x62fa('0x47')]['id']}})['then'](handleEntityNotFound(_0x133d76,null))[_0x62fa('0x25')](saveUpdates(_0x28b304[_0x62fa('0x4a')],null))[_0x62fa('0x25')](respondWithResult(_0x133d76,null))['catch'](handleError(_0x133d76,null));};exports[_0x62fa('0x21')]=function(_0x340149,_0x454bed){return db[_0x62fa('0x2d')][_0x62fa('0x4e')]({'where':{'id':_0x340149[_0x62fa('0x47')]['id']}})[_0x62fa('0x25')](handleEntityNotFound(_0x454bed,null))['then'](removeEntity(_0x454bed,null))[_0x62fa('0x45')](handleError(_0x454bed,null));}; \ No newline at end of file +var _0x6e2d=['rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','Variables','UserProfileResource','sendStatus','stack','send','index','map','key','name','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','Variable','findAll','rows','catch','show','params'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x6e2d,0x158));var _0xd6e2=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x6e2d[_0x3c6ae2];return _0x4edda;};'use strict';var pdf=require(_0xd6e2('0x0'));var emlformat=require(_0xd6e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd6e2('0x2'));var jsonpatch=require(_0xd6e2('0x3'));var rp=require(_0xd6e2('0x4'));var moment=require(_0xd6e2('0x5'));var BPromise=require(_0xd6e2('0x6'));var Mustache=require('mustache');var util=require(_0xd6e2('0x7'));var path=require(_0xd6e2('0x8'));var sox=require(_0xd6e2('0x9'));var csv=require('to-csv');var ejs=require(_0xd6e2('0xa'));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(_0xd6e2('0xf'));var querystring=require(_0xd6e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xd6e2('0x11'));var authService=require(_0xd6e2('0x12'));var qs=require(_0xd6e2('0x13'));var as=require(_0xd6e2('0x14'));var hardwareService=require(_0xd6e2('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd6e2('0x16'));var db=require(_0xd6e2('0x17'))['db'];function respondWithStatusCode(_0x1d52d3,_0x142165){_0x142165=_0x142165||0xcc;return function(_0x10a7a8){if(_0x10a7a8){return _0x1d52d3['sendStatus'](_0x142165);}return _0x1d52d3[_0xd6e2('0x18')](_0x142165)[_0xd6e2('0x19')]();};}function respondWithResult(_0x4ca99d,_0x1a99c0){_0x1a99c0=_0x1a99c0||0xc8;return function(_0xc30872){if(_0xc30872){return _0x4ca99d[_0xd6e2('0x18')](_0x1a99c0)[_0xd6e2('0x1a')](_0xc30872);}};}function respondWithFilteredResult(_0x480675,_0x28f552){return function(_0x3d913a){if(_0x3d913a){var _0x32f700=_0x3d913a[_0xd6e2('0x1b')],_0x2ca923=_0x28f552[_0xd6e2('0x1c')],_0x162062=_0x28f552[_0xd6e2('0x1c')]+_0x28f552[_0xd6e2('0x1d')],_0x10dc1e;if(_0x162062>=_0x32f700){_0x162062=_0x32f700;_0x10dc1e=0xc8;}else{_0x10dc1e=0xce;}_0x480675[_0xd6e2('0x18')](_0x10dc1e);return _0x480675['set']('Content-Range',_0x2ca923+'-'+_0x162062+'/'+_0x32f700)[_0xd6e2('0x1a')](_0x3d913a);}return null;};}function patchUpdates(_0x314da2){return function(_0x486e1b){try{jsonpatch[_0xd6e2('0x1e')](_0x486e1b,_0x314da2,!![]);}catch(_0x2a9196){return BPromise[_0xd6e2('0x1f')](_0x2a9196);}return _0x486e1b[_0xd6e2('0x20')]();};}function saveUpdates(_0x240cd7,_0x80258b){return function(_0x49f030){if(_0x49f030){return _0x49f030[_0xd6e2('0x21')](_0x240cd7)[_0xd6e2('0x22')](function(_0x24237e){return _0x24237e;});}return null;};}function removeEntity(_0x4fa4b3,_0x436d7c){return function(_0x39b1fc){if(_0x39b1fc){return _0x39b1fc[_0xd6e2('0x23')]()['then'](function(){var _0x47c235=_0x39b1fc['get']({'plain':!![]});var _0x14093b=_0xd6e2('0x24');return db[_0xd6e2('0x25')][_0xd6e2('0x23')]({'where':{'type':_0x14093b,'resourceId':_0x47c235['id']}})[_0xd6e2('0x22')](function(){return _0x39b1fc;});})['then'](function(){_0x4fa4b3[_0xd6e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1538c8,_0x15ed11){return function(_0x905a97){if(!_0x905a97){_0x1538c8[_0xd6e2('0x26')](0x194);}return _0x905a97;};}function handleError(_0x237bd,_0x167bf6){_0x167bf6=_0x167bf6||0x1f4;return function(_0x508395){logger['error'](_0x508395[_0xd6e2('0x27')]);if(_0x508395['name']){delete _0x508395['name'];}_0x237bd[_0xd6e2('0x18')](_0x167bf6)[_0xd6e2('0x28')](_0x508395);};}exports[_0xd6e2('0x29')]=function(_0x432d3a,_0x54c076){var _0x432d75={},_0xfd767c={},_0x55529a={'count':0x0,'rows':[]};var _0x139e4f=_[_0xd6e2('0x2a')](db['Variable']['rawAttributes'],function(_0x37a7c4){return{'name':_0x37a7c4['fieldName'],'type':_0x37a7c4['type'][_0xd6e2('0x2b')]};});_0xfd767c['model']=_[_0xd6e2('0x2a')](_0x139e4f,_0xd6e2('0x2c'));_0xfd767c[_0xd6e2('0x2d')]=_[_0xd6e2('0x2e')](_0x432d3a[_0xd6e2('0x2d')]);_0xfd767c['filters']=_['intersection'](_0xfd767c[_0xd6e2('0x2f')],_0xfd767c[_0xd6e2('0x2d')]);_0x432d75[_0xd6e2('0x30')]=_[_0xd6e2('0x31')](_0xfd767c[_0xd6e2('0x2f')],qs[_0xd6e2('0x32')](_0x432d3a[_0xd6e2('0x2d')][_0xd6e2('0x32')]));_0x432d75[_0xd6e2('0x30')]=_0x432d75['attributes'][_0xd6e2('0x33')]?_0x432d75[_0xd6e2('0x30')]:_0xfd767c[_0xd6e2('0x2f')];if(!_0x432d3a[_0xd6e2('0x2d')][_0xd6e2('0x34')]('nolimit')){_0x432d75['limit']=qs[_0xd6e2('0x1d')](_0x432d3a[_0xd6e2('0x2d')][_0xd6e2('0x1d')]);_0x432d75['offset']=qs['offset'](_0x432d3a[_0xd6e2('0x2d')][_0xd6e2('0x1c')]);}_0x432d75[_0xd6e2('0x35')]=qs[_0xd6e2('0x36')](_0x432d3a[_0xd6e2('0x2d')][_0xd6e2('0x36')]);_0x432d75[_0xd6e2('0x37')]=qs[_0xd6e2('0x38')](_[_0xd6e2('0x39')](_0x432d3a[_0xd6e2('0x2d')],_0xfd767c[_0xd6e2('0x38')]),_0x139e4f);if(_0x432d3a[_0xd6e2('0x2d')]['filter']){_0x432d75[_0xd6e2('0x37')]=_[_0xd6e2('0x3a')](_0x432d75[_0xd6e2('0x37')],{'$or':_['map'](_0x139e4f,function(_0x755ba8){if(_0x755ba8[_0xd6e2('0x3b')]!==_0xd6e2('0x3c')){var _0x31ad82={};_0x31ad82[_0x755ba8['name']]={'$like':'%'+_0x432d3a['query'][_0xd6e2('0x3d')]+'%'};return _0x31ad82;}})});}_0x432d75=_[_0xd6e2('0x3a')]({},_0x432d75,_0x432d3a[_0xd6e2('0x3e')]);var _0x3949b0={'where':_0x432d75[_0xd6e2('0x37')]};return db['Variable']['count'](_0x3949b0)['then'](function(_0x50c9fd){_0x55529a[_0xd6e2('0x1b')]=_0x50c9fd;if(_0x432d3a[_0xd6e2('0x2d')][_0xd6e2('0x3f')]){_0x432d75[_0xd6e2('0x40')]=[{'all':!![]}];}return db[_0xd6e2('0x41')][_0xd6e2('0x42')](_0x432d75);})[_0xd6e2('0x22')](function(_0x124219){_0x55529a[_0xd6e2('0x43')]=_0x124219;return _0x55529a;})[_0xd6e2('0x22')](respondWithFilteredResult(_0x54c076,_0x432d75))[_0xd6e2('0x44')](handleError(_0x54c076,null));};exports[_0xd6e2('0x45')]=function(_0x461858,_0xc1d539){var _0x16292e={'raw':!![],'where':{'id':_0x461858[_0xd6e2('0x46')]['id']}},_0x2ffb3c={};_0x2ffb3c[_0xd6e2('0x2f')]=_[_0xd6e2('0x2e')](db[_0xd6e2('0x41')][_0xd6e2('0x47')]);_0x2ffb3c[_0xd6e2('0x2d')]=_['keys'](_0x461858[_0xd6e2('0x2d')]);_0x2ffb3c['filters']=_[_0xd6e2('0x31')](_0x2ffb3c['model'],_0x2ffb3c['query']);_0x16292e[_0xd6e2('0x30')]=_[_0xd6e2('0x31')](_0x2ffb3c['model'],qs[_0xd6e2('0x32')](_0x461858[_0xd6e2('0x2d')]['fields']));_0x16292e['attributes']=_0x16292e[_0xd6e2('0x30')][_0xd6e2('0x33')]?_0x16292e['attributes']:_0x2ffb3c[_0xd6e2('0x2f')];if(_0x461858['query'][_0xd6e2('0x3f')]){_0x16292e[_0xd6e2('0x40')]=[{'all':!![]}];}_0x16292e=_[_0xd6e2('0x3a')]({},_0x16292e,_0x461858['options']);return db[_0xd6e2('0x41')][_0xd6e2('0x48')](_0x16292e)[_0xd6e2('0x22')](handleEntityNotFound(_0xc1d539,null))[_0xd6e2('0x22')](respondWithResult(_0xc1d539,null))[_0xd6e2('0x44')](handleError(_0xc1d539,null));};exports[_0xd6e2('0x49')]=function(_0x3969f8,_0x2adab6){return db['Variable'][_0xd6e2('0x49')](_0x3969f8['body'],{})['then'](function(_0x483add){var _0xf9c2bc=_0x3969f8[_0xd6e2('0x4a')]['get']({'plain':!![]});if(!_0xf9c2bc)throw new Error(_0xd6e2('0x4b'));if(_0xf9c2bc[_0xd6e2('0x4c')]===_0xd6e2('0x4a')){var _0x5b887f=_0x483add[_0xd6e2('0x4d')]({'plain':!![]});var _0x1c1156=_0xd6e2('0x24');return db[_0xd6e2('0x4e')][_0xd6e2('0x48')]({'where':{'name':_0x1c1156,'userProfileId':_0xf9c2bc[_0xd6e2('0x4f')]},'raw':!![]})[_0xd6e2('0x22')](function(_0x445289){if(_0x445289&&_0x445289[_0xd6e2('0x50')]===0x0){return db[_0xd6e2('0x25')][_0xd6e2('0x49')]({'name':_0x5b887f[_0xd6e2('0x2c')],'resourceId':_0x5b887f['id'],'type':_0x445289[_0xd6e2('0x2c')],'sectionId':_0x445289['id']},{})[_0xd6e2('0x22')](function(){return _0x483add;});}else{return _0x483add;}})[_0xd6e2('0x44')](function(_0x1f8fc5){logger[_0xd6e2('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f8fc5);throw _0x1f8fc5;});}return _0x483add;})['then'](respondWithResult(_0x2adab6,0xc9))['catch'](handleError(_0x2adab6,null));};exports['update']=function(_0x433915,_0x18b72d){if(_0x433915[_0xd6e2('0x52')]['id']){delete _0x433915[_0xd6e2('0x52')]['id'];}return db[_0xd6e2('0x41')]['find']({'where':{'id':_0x433915[_0xd6e2('0x46')]['id']}})['then'](handleEntityNotFound(_0x18b72d,null))[_0xd6e2('0x22')](saveUpdates(_0x433915[_0xd6e2('0x52')],null))[_0xd6e2('0x22')](respondWithResult(_0x18b72d,null))[_0xd6e2('0x44')](handleError(_0x18b72d,null));};exports[_0xd6e2('0x23')]=function(_0x46e703,_0x31c37e){return db[_0xd6e2('0x41')][_0xd6e2('0x48')]({'where':{'id':_0x46e703[_0xd6e2('0x46')]['id']}})[_0xd6e2('0x22')](handleEntityNotFound(_0x31c37e,null))[_0xd6e2('0x22')](removeEntity(_0x31c37e,null))['catch'](handleError(_0x31c37e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index f1a8e6b..6380156 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 _0x4cf2=['Variable','tools_variables','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x2b338b,_0x4a06ba){var _0x256f66=function(_0x13c9c4){while(--_0x13c9c4){_0x2b338b['push'](_0x2b338b['shift']());}};_0x256f66(++_0x4a06ba);}(_0x4cf2,0xbd));var _0x24cf=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x4cf2[_0x25d386];return _0x857f4a;};'use strict';var _=require('lodash');var util=require(_0x24cf('0x0'));var logger=require(_0x24cf('0x1'))(_0x24cf('0x2'));var moment=require(_0x24cf('0x3'));var BPromise=require(_0x24cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x24cf('0x5'));var config=require(_0x24cf('0x6'));var attributes=require(_0x24cf('0x7'));module[_0x24cf('0x8')]=function(_0x319c8c,_0x1f4c4d){return _0x319c8c['define'](_0x24cf('0x9'),attributes,{'tableName':_0x24cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb42a=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash'];(function(_0x4834d8,_0x126875){var _0x3ec6e6=function(_0x23ac77){while(--_0x23ac77){_0x4834d8['push'](_0x4834d8['shift']());}};_0x3ec6e6(++_0x126875);}(_0xb42a,0x1a3));var _0xab42=function(_0x356481,_0x12dad0){_0x356481=_0x356481-0x0;var _0x2966e3=_0xb42a[_0x356481];return _0x2966e3;};'use strict';var _=require(_0xab42('0x0'));var util=require(_0xab42('0x1'));var logger=require(_0xab42('0x2'))(_0xab42('0x3'));var moment=require(_0xab42('0x4'));var BPromise=require(_0xab42('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab42('0x6'));var rimraf=require('rimraf');var config=require(_0xab42('0x7'));var attributes=require(_0xab42('0x8'));module[_0xab42('0x9')]=function(_0x190fec,_0x4da6b0){return _0x190fec[_0xab42('0xa')]('Variable',attributes,{'tableName':_0xab42('0xb'),'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 bb6519e..0c8d58b 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 _0x9d55=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Variable','find','options','raw','where','map','include','model','attributes','ShowVariable','debug','util','bluebird','ioredis','../../mysqldb'];(function(_0x201482,_0x30b896){var _0x408074=function(_0x1a9db8){while(--_0x1a9db8){_0x201482['push'](_0x201482['shift']());}};_0x408074(++_0x30b896);}(_0x9d55,0x164));var _0x59d5=function(_0x5a7627,_0x492acd){_0x5a7627=_0x5a7627-0x0;var _0x327bfd=_0x9d55[_0x5a7627];return _0x327bfd;};'use strict';var _=require('lodash');var util=require(_0x59d5('0x0'));var moment=require('moment');var BPromise=require(_0x59d5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59d5('0x2'));var db=require(_0x59d5('0x3'))['db'];var utils=require(_0x59d5('0x4'));var logger=require(_0x59d5('0x5'))(_0x59d5('0x6'));var config=require('../../config/environment');var jayson=require(_0x59d5('0x7'));var client=jayson[_0x59d5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7830cd,_0x32e9e9,_0x362c8a){return new BPromise(function(_0x11dc26,_0x2dd23a){return client[_0x59d5('0x9')](_0x7830cd,_0x362c8a)[_0x59d5('0xa')](function(_0x45736c){logger[_0x59d5('0xb')](_0x59d5('0xc'),_0x32e9e9,_0x59d5('0xd'));logger['debug'](_0x59d5('0xe'),_0x32e9e9,_0x59d5('0xd'),JSON[_0x59d5('0xf')](_0x45736c));if(_0x45736c[_0x59d5('0x10')]){if(_0x45736c[_0x59d5('0x10')]['code']===0x1f4){logger[_0x59d5('0x10')](_0x59d5('0xc'),_0x32e9e9,_0x45736c[_0x59d5('0x10')][_0x59d5('0x11')]);return _0x2dd23a(_0x45736c[_0x59d5('0x10')][_0x59d5('0x11')]);}logger['error'](_0x59d5('0xc'),_0x32e9e9,_0x45736c[_0x59d5('0x10')]['message']);return _0x11dc26(_0x45736c[_0x59d5('0x10')][_0x59d5('0x11')]);}else{logger['info'](_0x59d5('0xc'),_0x32e9e9,_0x59d5('0xd'));_0x11dc26(_0x45736c['result'][_0x59d5('0x11')]);}})[_0x59d5('0x12')](function(_0x217343){logger['error'](_0x59d5('0xc'),_0x32e9e9,_0x217343);_0x2dd23a(_0x217343);});});}exports['ShowVariable']=function(_0x12ad8b){var _0x28eedc=this;return new Promise(function(_0x28cf69,_0x1645dc){return db[_0x59d5('0x13')][_0x59d5('0x14')]({'raw':_0x12ad8b[_0x59d5('0x15')]?_0x12ad8b[_0x59d5('0x15')][_0x59d5('0x16')]===undefined?!![]:![]:!![],'where':_0x12ad8b[_0x59d5('0x15')]?_0x12ad8b[_0x59d5('0x15')][_0x59d5('0x17')]||null:null,'attributes':_0x12ad8b['options']?_0x12ad8b[_0x59d5('0x15')]['attributes']||null:null,'include':_0x12ad8b[_0x59d5('0x15')]?_0x12ad8b['options']['include']?_[_0x59d5('0x18')](_0x12ad8b[_0x59d5('0x15')][_0x59d5('0x19')],function(_0x319f53){return{'model':db[_0x319f53[_0x59d5('0x1a')]],'as':_0x319f53['as'],'attributes':_0x319f53['attributes'],'include':_0x319f53['include']?_['map'](_0x319f53['include'],function(_0x463b3f){return{'model':db[_0x463b3f[_0x59d5('0x1a')]],'as':_0x463b3f['as'],'attributes':_0x463b3f[_0x59d5('0x1b')],'include':_0x463b3f[_0x59d5('0x19')]?_[_0x59d5('0x18')](_0x463b3f[_0x59d5('0x19')],function(_0x5845b1){return{'model':db[_0x5845b1['model']],'as':_0x5845b1['as'],'attributes':_0x5845b1[_0x59d5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x59d5('0xa')](function(_0x26f641){logger[_0x59d5('0xb')](_0x59d5('0x1c'),_0x12ad8b);logger[_0x59d5('0x1d')](_0x59d5('0x1c'),_0x12ad8b,JSON['stringify'](_0x26f641));_0x28cf69(_0x26f641);})['catch'](function(_0x2c3b71){logger[_0x59d5('0x10')](_0x59d5('0x1c'),_0x2c3b71[_0x59d5('0x11')],_0x12ad8b);_0x1645dc(_0x28eedc['error'](0x1f4,_0x2c3b71[_0x59d5('0x11')]));});});}; \ No newline at end of file +var _0xefc3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','Variable','options','where','attributes','include','map','model','info','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefc3,0x1ee));var _0x3efc=function(_0x20a6d5,_0x5413f2){_0x20a6d5=_0x20a6d5-0x0;var _0x47d833=_0xefc3[_0x20a6d5];return _0x47d833;};'use strict';var _=require('lodash');var util=require(_0x3efc('0x0'));var moment=require(_0x3efc('0x1'));var BPromise=require(_0x3efc('0x2'));var rs=require(_0x3efc('0x3'));var fs=require('fs');var Redis=require(_0x3efc('0x4'));var db=require(_0x3efc('0x5'))['db'];var utils=require(_0x3efc('0x6'));var logger=require(_0x3efc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3efc('0x8'));var client=jayson[_0x3efc('0x9')][_0x3efc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x408c17,_0x668a91,_0xa45eb8){return new BPromise(function(_0x3f5d83,_0x4171aa){return client[_0x3efc('0xb')](_0x408c17,_0xa45eb8)[_0x3efc('0xc')](function(_0x52ba32){logger['info']('Variable,\x20%s,\x20%s',_0x668a91,'request\x20sent');logger[_0x3efc('0xd')]('Variable,\x20%s,\x20%s,\x20%s',_0x668a91,_0x3efc('0xe'),JSON[_0x3efc('0xf')](_0x52ba32));if(_0x52ba32[_0x3efc('0x10')]){if(_0x52ba32['error'][_0x3efc('0x11')]===0x1f4){logger[_0x3efc('0x10')](_0x3efc('0x12'),_0x668a91,_0x52ba32[_0x3efc('0x10')]['message']);return _0x4171aa(_0x52ba32[_0x3efc('0x10')][_0x3efc('0x13')]);}logger[_0x3efc('0x10')](_0x3efc('0x12'),_0x668a91,_0x52ba32[_0x3efc('0x10')][_0x3efc('0x13')]);return _0x3f5d83(_0x52ba32['error'][_0x3efc('0x13')]);}else{logger['info'](_0x3efc('0x12'),_0x668a91,'request\x20sent');_0x3f5d83(_0x52ba32[_0x3efc('0x14')]['message']);}})[_0x3efc('0x15')](function(_0x1b465f){logger[_0x3efc('0x10')](_0x3efc('0x12'),_0x668a91,_0x1b465f);_0x4171aa(_0x1b465f);});});}exports[_0x3efc('0x16')]=function(_0x294a7e){var _0x47f82d=this;return new Promise(function(_0x41d15f,_0x3a0366){return db[_0x3efc('0x17')]['find']({'raw':_0x294a7e[_0x3efc('0x18')]?_0x294a7e[_0x3efc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x294a7e[_0x3efc('0x18')]?_0x294a7e[_0x3efc('0x18')][_0x3efc('0x19')]||null:null,'attributes':_0x294a7e[_0x3efc('0x18')]?_0x294a7e['options'][_0x3efc('0x1a')]||null:null,'include':_0x294a7e[_0x3efc('0x18')]?_0x294a7e['options'][_0x3efc('0x1b')]?_[_0x3efc('0x1c')](_0x294a7e[_0x3efc('0x18')][_0x3efc('0x1b')],function(_0x1e2db0){return{'model':db[_0x1e2db0[_0x3efc('0x1d')]],'as':_0x1e2db0['as'],'attributes':_0x1e2db0[_0x3efc('0x1a')],'include':_0x1e2db0[_0x3efc('0x1b')]?_[_0x3efc('0x1c')](_0x1e2db0[_0x3efc('0x1b')],function(_0x1726d0){return{'model':db[_0x1726d0['model']],'as':_0x1726d0['as'],'attributes':_0x1726d0['attributes'],'include':_0x1726d0['include']?_['map'](_0x1726d0[_0x3efc('0x1b')],function(_0x565a3d){return{'model':db[_0x565a3d[_0x3efc('0x1d')]],'as':_0x565a3d['as'],'attributes':_0x565a3d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3efc('0xc')](function(_0x51a4b7){logger[_0x3efc('0x1e')](_0x3efc('0x16'),_0x294a7e);logger[_0x3efc('0xd')](_0x3efc('0x16'),_0x294a7e,JSON[_0x3efc('0xf')](_0x51a4b7));_0x41d15f(_0x51a4b7);})[_0x3efc('0x15')](function(_0x2c6b42){logger[_0x3efc('0x10')]('ShowVariable',_0x2c6b42[_0x3efc('0x13')],_0x294a7e);_0x3a0366(_0x47f82d['error'](0x1f4,_0x2c6b42[_0x3efc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f5715f9..90124c4 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 _0x6a42=['reset','/pull','pull','/restart','restart','express','Router','../../components/auth/service','./version.controller','index','get','canUpdate','fetch','/reset','isAuthenticated'];(function(_0x1b9b64,_0x4e95d6){var _0x1e19b0=function(_0xf40b2a){while(--_0xf40b2a){_0x1b9b64['push'](_0x1b9b64['shift']());}};_0x1e19b0(++_0x4e95d6);}(_0x6a42,0x122));var _0x26a4=function(_0x534674,_0xff48a0){_0x534674=_0x534674-0x0;var _0x2c6999=_0x6a42[_0x534674];return _0x2c6999;};'use strict';var express=require(_0x26a4('0x0'));var router=express[_0x26a4('0x1')]();var auth=require(_0x26a4('0x2'));var controller=require(_0x26a4('0x3'));router['get']('/',controller[_0x26a4('0x4')]);router[_0x26a4('0x5')]('/fetch',auth['isAuthenticated'](),auth[_0x26a4('0x6')](),controller[_0x26a4('0x7')]);router[_0x26a4('0x5')](_0x26a4('0x8'),auth[_0x26a4('0x9')](),auth['canUpdate'](),controller[_0x26a4('0xa')]);router['get'](_0x26a4('0xb'),auth[_0x26a4('0x9')](),auth[_0x26a4('0x6')](),controller[_0x26a4('0xc')]);router[_0x26a4('0x5')](_0x26a4('0xd'),auth['isAuthenticated'](),controller[_0x26a4('0xe')]);router[_0x26a4('0x5')]('/migrations',controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x05da=['/restart','/migrations','migrations','exports','express','Router','./version.controller','index','/fetch','isAuthenticated','canUpdate','fetch','get','reset','/pull','pull'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0x05da,0x94));var _0xa05d=function(_0xe21b5b,_0x4c914c){_0xe21b5b=_0xe21b5b-0x0;var _0x24384e=_0x05da[_0xe21b5b];return _0x24384e;};'use strict';var express=require(_0xa05d('0x0'));var router=express[_0xa05d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa05d('0x2'));router['get']('/',controller[_0xa05d('0x3')]);router['get'](_0xa05d('0x4'),auth[_0xa05d('0x5')](),auth[_0xa05d('0x6')](),controller[_0xa05d('0x7')]);router[_0xa05d('0x8')]('/reset',auth[_0xa05d('0x5')](),auth['canUpdate'](),controller[_0xa05d('0x9')]);router[_0xa05d('0x8')](_0xa05d('0xa'),auth[_0xa05d('0x5')](),auth['canUpdate'](),controller[_0xa05d('0xb')]);router[_0xa05d('0x8')](_0xa05d('0xc'),auth[_0xa05d('0x5')](),controller['restart']);router[_0xa05d('0x8')](_0xa05d('0xd'),controller[_0xa05d('0xe')]);module[_0xa05d('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3e20335..e0b66cd 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 _0x3d2f=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','migrations','readdirSync','join','replace','.js','length','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','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','json','status','origin','master','info'];(function(_0x514095,_0x1a95a3){var _0x36c1ef=function(_0xe2b013){while(--_0xe2b013){_0x514095['push'](_0x514095['shift']());}};_0x36c1ef(++_0x1a95a3);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x1ee86c,_0x43cbce){_0x1ee86c=_0x1ee86c-0x0;var _0x60e92e=_0x3d2f[_0x1ee86c];return _0x60e92e;};'use strict';var Umzug=require(_0xf3d2('0x0'));var path=require(_0xf3d2('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xf3d2('0x2'))(module,_0xf3d2('0x3'));var compareVersions=require(_0xf3d2('0x4'));var exec=require(_0xf3d2('0x5'))[_0xf3d2('0x6')];var db=require(_0xf3d2('0x7'))['db'];var config=require(_0xf3d2('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xf3d2('0x9'))(_0xf3d2('0xa'));var git=require(_0xf3d2('0xb'))(config[_0xf3d2('0xc')]);exports[_0xf3d2('0xd')]=function(_0x57f94b,_0x26f330){var _0x3f86f6={'current':module['exports'][_0xf3d2('0x3')],'phonebar':0x2};if(_0x57f94b['query']&&_0x57f94b[_0xf3d2('0xe')][_0xf3d2('0xf')]){return git[_0xf3d2('0x10')]()[_0xf3d2('0x11')](function(_0x3169f5,_0x820c61){_0x3f86f6['latest']=(_0x3169f5?module[_0xf3d2('0x12')][_0xf3d2('0x3')]:_0x820c61['latest'])||_0xf3d2('0x13');return _0x26f330['status'](0xc8)[_0xf3d2('0x14')](_0x3f86f6);});}else{return _0x26f330[_0xf3d2('0x15')](0xc8)[_0xf3d2('0x14')](_0x3f86f6);}};exports['fetch']=function(_0x1f8589,_0x31d380){return git[_0xf3d2('0x10')]([_0xf3d2('0x16'),_0xf3d2('0x17')],function(_0x4483d7){if(_0x4483d7){logger['error'](_0x4483d7);return _0x31d380[_0xf3d2('0x15')](0x1f4)[_0xf3d2('0x14')](_0x4483d7);}logger[_0xf3d2('0x18')](_0xf3d2('0x19'));return _0x31d380[_0xf3d2('0x15')](0xc8)[_0xf3d2('0x14')]({'output':_0xf3d2('0x1a')});});};exports[_0xf3d2('0x1b')]=function(_0x457933,_0x5a4afd){return git[_0xf3d2('0x1b')]([_0xf3d2('0x1c'),'FETCH_HEAD'],function(_0x1dfc9f){if(_0x1dfc9f){logger[_0xf3d2('0x1d')](_0x1dfc9f);return _0x5a4afd[_0xf3d2('0x15')](0x1f4)['json'](_0x1dfc9f);}logger[_0xf3d2('0x18')](_0xf3d2('0x1e'));return _0x5a4afd[_0xf3d2('0x15')](0xc8)[_0xf3d2('0x14')]({'output':_0xf3d2('0x1f')});});};exports[_0xf3d2('0x20')]=function(_0x2009bf,_0x2a1820){exec(_0xf3d2('0x21'),function(_0x232e80,_0x5584ac,_0x12e0be){logger[_0xf3d2('0x18')](_0x5584ac);logger[_0xf3d2('0x18')](_0x12e0be);if(_0x232e80){logger[_0xf3d2('0x1d')](_0x232e80);return _0x2a1820[_0xf3d2('0x15')](0x1f4)[_0xf3d2('0x14')](_0x232e80);}return _0x2a1820[_0xf3d2('0x15')](0xc8)[_0xf3d2('0x14')]({'output':_0x5584ac});});};exports[_0xf3d2('0x22')]=function(_0x5eadd6,_0x140092){return pm2[_0xf3d2('0x22')]('motion2')[_0xf3d2('0x23')](function(_0x5e3509){logger[_0xf3d2('0x18')]('pm2\x20restart\x20motion\x20%s',_0x5e3509);return _0x140092[_0xf3d2('0x15')](0xc8)[_0xf3d2('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x3ea85d){logger[_0xf3d2('0x1d')](_0x3ea85d);return _0x140092[_0xf3d2('0x15')](0x1f4)['json'](_0x3ea85d);});};exports[_0xf3d2('0x24')]=function(_0x3cdb21,_0x39e846){var _0x5c866d=fs[_0xf3d2('0x25')](path[_0xf3d2('0x26')](config['root'],'server',_0xf3d2('0x24')));var _0x203847=[];for(var _0x374583=0x0;_0x374583<_0x5c866d['length'];_0x374583++){var _0x357e2f=_0x5c866d[_0x374583][_0xf3d2('0x27')](_0xf3d2('0x28'),'');if(compareVersions(module[_0xf3d2('0x12')]['version'],_0x357e2f)===-0x1){_0x203847['push'](_0x357e2f);}}if(_0x203847[_0xf3d2('0x29')]){var _0x2e4c0d=_0x203847['sort'](compareVersions);var _0x4cfa13=new Umzug({'storage':_0xf3d2('0x2a'),'storageOptions':{'model':db[_0xf3d2('0x2b')],'modelName':_0xf3d2('0x2b'),'columnName':_0xf3d2('0x3')},'migrations':{'params':[db[_0xf3d2('0x2a')][_0xf3d2('0x2c')](),db[_0xf3d2('0x2a')][_0xf3d2('0x2d')],function(){throw new Error(_0xf3d2('0x2e'));}],'path':path[_0xf3d2('0x26')](config[_0xf3d2('0xc')],'server','migrations'),'pattern':/\.js$/}});_0x4cfa13['up']({'migrations':_[_0xf3d2('0x2f')](_0x2e4c0d,function(_0x4981b){return _0x4981b+_0xf3d2('0x28');})})[_0xf3d2('0x23')](function(){return _0x39e846['status'](0xc8)[_0xf3d2('0x14')]({'output':_0xf3d2('0x30')+module[_0xf3d2('0x12')][_0xf3d2('0x3')]+_0xf3d2('0x31')+_[_0xf3d2('0x32')](_0x2e4c0d),'migrations':_[_0xf3d2('0x26')](_0x2e4c0d)});})['catch'](function(_0x28085f){if(_0x28085f instanceof db[_0xf3d2('0x2a')][_0xf3d2('0x33')]){return _0x39e846['status'](0xc8)[_0xf3d2('0x14')]({'output':_0xf3d2('0x34')});}else{return _0x39e846['status'](0x1f4)['json'](_0x28085f);}});}else{return _0x39e846[_0xf3d2('0x15')](0xc8)[_0xf3d2('0x14')]({'output':_0xf3d2('0x34')});}}; \ No newline at end of file +var _0xd47f=['child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','query','latest','fetch','tags','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd47f,0x1bd));var _0xfd47=function(_0x2aae31,_0x1014a2){_0x2aae31=_0x2aae31-0x0;var _0x379006=_0xd47f[_0x2aae31];return _0x379006;};'use strict';var Umzug=require(_0xfd47('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xfd47('0x1'));var pkginfo=require(_0xfd47('0x2'))(module,_0xfd47('0x3'));var compareVersions=require(_0xfd47('0x4'));var exec=require(_0xfd47('0x5'))[_0xfd47('0x6')];var db=require(_0xfd47('0x7'))['db'];var config=require(_0xfd47('0x8'));var pm2=require(_0xfd47('0x9'));var logger=require(_0xfd47('0xa'))(_0xfd47('0xb'));var git=require(_0xfd47('0xc'))(config['root']);exports['index']=function(_0x2a69b5,_0x5859f6){var _0x5cfba2={'current':module['exports'][_0xfd47('0x3')],'phonebar':0x2};if(_0x2a69b5[_0xfd47('0xd')]&&_0x2a69b5[_0xfd47('0xd')][_0xfd47('0xe')]){return git[_0xfd47('0xf')]()[_0xfd47('0x10')](function(_0x5a6644,_0x506d4e){_0x5cfba2[_0xfd47('0xe')]=(_0x5a6644?module['exports']['version']:_0x506d4e[_0xfd47('0xe')])||'2.0.0';return _0x5859f6['status'](0xc8)['json'](_0x5cfba2);});}else{return _0x5859f6[_0xfd47('0x11')](0xc8)['json'](_0x5cfba2);}};exports[_0xfd47('0xf')]=function(_0x44144b,_0x3ada2a){return git['fetch']([_0xfd47('0x12'),_0xfd47('0x13')],function(_0x6e24f5){if(_0x6e24f5){logger[_0xfd47('0x14')](_0x6e24f5);return _0x3ada2a['status'](0x1f4)[_0xfd47('0x15')](_0x6e24f5);}logger[_0xfd47('0x16')](_0xfd47('0x17'));return _0x3ada2a['status'](0xc8)['json']({'output':_0xfd47('0x18')});});};exports[_0xfd47('0x19')]=function(_0x413fa3,_0xf1bbb){return git[_0xfd47('0x19')](['--hard',_0xfd47('0x1a')],function(_0x471472){if(_0x471472){logger[_0xfd47('0x14')](_0x471472);return _0xf1bbb[_0xfd47('0x11')](0x1f4)[_0xfd47('0x15')](_0x471472);}logger[_0xfd47('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xf1bbb[_0xfd47('0x11')](0xc8)['json']({'output':_0xfd47('0x1b')});});};exports[_0xfd47('0x1c')]=function(_0x4153f6,_0x9e3ccd){exec('npm\x20install\x20--production',function(_0x45e681,_0x29a2dd,_0x943c8a){logger[_0xfd47('0x16')](_0x29a2dd);logger['info'](_0x943c8a);if(_0x45e681){logger['error'](_0x45e681);return _0x9e3ccd[_0xfd47('0x11')](0x1f4)[_0xfd47('0x15')](_0x45e681);}return _0x9e3ccd[_0xfd47('0x11')](0xc8)[_0xfd47('0x15')]({'output':_0x29a2dd});});};exports[_0xfd47('0x1d')]=function(_0x545eb9,_0x348f90){return pm2['restart'](_0xfd47('0x1e'))[_0xfd47('0x1f')](function(_0x1071e6){logger[_0xfd47('0x16')](_0xfd47('0x20'),_0x1071e6);return _0x348f90[_0xfd47('0x11')](0xc8)[_0xfd47('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xfd47('0x21')](function(_0x33072e){logger[_0xfd47('0x14')](_0x33072e);return _0x348f90[_0xfd47('0x11')](0x1f4)[_0xfd47('0x15')](_0x33072e);});};exports[_0xfd47('0x22')]=function(_0x120c38,_0x46c3f8){var _0x3dfd47=fs[_0xfd47('0x23')](path[_0xfd47('0x24')](config[_0xfd47('0x25')],'server',_0xfd47('0x22')));var _0x3d415b=[];for(var _0x148b9f=0x0;_0x148b9f<_0x3dfd47['length'];_0x148b9f++){var _0x2e40fa=_0x3dfd47[_0x148b9f]['replace'](_0xfd47('0x26'),'');if(compareVersions(module['exports'][_0xfd47('0x3')],_0x2e40fa)===-0x1){_0x3d415b[_0xfd47('0x27')](_0x2e40fa);}}if(_0x3d415b['length']){var _0x25fee4=_0x3d415b[_0xfd47('0x28')](compareVersions);var _0x3d95bc=new Umzug({'storage':_0xfd47('0x29'),'storageOptions':{'model':db[_0xfd47('0x2a')],'modelName':_0xfd47('0x2a'),'columnName':_0xfd47('0x3')},'migrations':{'params':[db['sequelize'][_0xfd47('0x2b')](),db[_0xfd47('0x29')]['constructor'],function(){throw new Error(_0xfd47('0x2c'));}],'path':path[_0xfd47('0x24')](config[_0xfd47('0x25')],'server',_0xfd47('0x22')),'pattern':/\.js$/}});_0x3d95bc['up']({'migrations':_['map'](_0x25fee4,function(_0x179e41){return _0x179e41+_0xfd47('0x26');})})['then'](function(){return _0x46c3f8[_0xfd47('0x11')](0xc8)[_0xfd47('0x15')]({'output':_0xfd47('0x2d')+module['exports'][_0xfd47('0x3')]+_0xfd47('0x2e')+_[_0xfd47('0x2f')](_0x25fee4),'migrations':_['join'](_0x25fee4)});})[_0xfd47('0x21')](function(_0x3b3548){if(_0x3b3548 instanceof db['sequelize'][_0xfd47('0x30')]){return _0x46c3f8[_0xfd47('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x46c3f8[_0xfd47('0x11')](0x1f4)['json'](_0x3b3548);}});}else{return _0x46c3f8[_0xfd47('0x11')](0xc8)['json']({'output':_0xfd47('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7efb86a..b9969a5 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 _0x77fe=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','update'];(function(_0x2f89c0,_0x455702){var _0x164223=function(_0x11a234){while(--_0x11a234){_0x2f89c0['push'](_0x2f89c0['shift']());}};_0x164223(++_0x455702);}(_0x77fe,0xae));var _0xe77f=function(_0x285f82,_0x31eda5){_0x285f82=_0x285f82-0x0;var _0x4d5a03=_0x77fe[_0x285f82];return _0x4d5a03;};'use strict';var multer=require(_0xe77f('0x0'));var util=require(_0xe77f('0x1'));var path=require('path');var timeout=require(_0xe77f('0x2'));var express=require(_0xe77f('0x3'));var router=express[_0xe77f('0x4')]();var auth=require(_0xe77f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe77f('0x6'));var controller=require(_0xe77f('0x7'));router[_0xe77f('0x8')]('/',auth[_0xe77f('0x9')](),controller[_0xe77f('0xa')]);router['get'](_0xe77f('0xb'),auth[_0xe77f('0x9')](),controller['describe']);router['get'](_0xe77f('0xc'),auth[_0xe77f('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe77f('0xd')]);router[_0xe77f('0xe')](_0xe77f('0xc'),auth[_0xe77f('0x9')](),controller[_0xe77f('0xf')]);router[_0xe77f('0x10')]('/:id',auth[_0xe77f('0x9')](),controller[_0xe77f('0x11')]);module[_0xe77f('0x12')]=router; \ No newline at end of file +var _0x27d3=['multer','util','Router','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','destroy','exports'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x27d3,0x177));var _0x327d=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x27d3[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0x327d('0x0'));var util=require(_0x327d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x327d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x327d('0x3'));var config=require('../../config/environment');var controller=require(_0x327d('0x4'));router[_0x327d('0x5')]('/',auth[_0x327d('0x6')](),controller[_0x327d('0x7')]);router[_0x327d('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x327d('0x8')]);router[_0x327d('0x5')](_0x327d('0x9'),auth[_0x327d('0x6')](),controller['show']);router[_0x327d('0xa')]('/',auth[_0x327d('0x6')](),controller[_0x327d('0xb')]);router['put'](_0x327d('0x9'),auth[_0x327d('0x6')](),controller[_0x327d('0xc')]);router['delete']('/:id',auth[_0x327d('0x6')](),controller[_0x327d('0xd')]);module[_0x327d('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 83ac9bd..63cdbe5 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 _0x7dfd=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4d9a6d,_0x118f60){var _0x7e88c6=function(_0x46d08c){while(--_0x46d08c){_0x4d9a6d['push'](_0x4d9a6d['shift']());}};_0x7e88c6(++_0x118f60);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'type':{'type':Sequelize[_0xd7df('0x2')]},'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'calleridnum':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'queue':{'type':Sequelize[_0xd7df('0x2')]},'interface':{'type':Sequelize[_0xd7df('0x2')]},'membername':{'type':Sequelize[_0xd7df('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd7df('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd7df('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd7df('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd7df('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd7df('0x3')]},'holdtime':{'type':Sequelize[_0xd7df('0x4')]},'agentcomplete':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd7df('0x4')]},'agentacw':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd7df('0x4')]},'reason':{'type':Sequelize[_0xd7df('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd7df('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd7df('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd7df('0x2')]},'language':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'exten':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'destchannel':{'type':Sequelize[_0xd7df('0x2')]},'destchannelstate':{'type':Sequelize[_0xd7df('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd7df('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd7df('0x2')]},'destcalleridname':{'type':Sequelize[_0xd7df('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd7df('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd7df('0x2')]},'destlanguage':{'type':Sequelize[_0xd7df('0x2')]},'destaccountcode':{'type':Sequelize[_0xd7df('0x2')]},'destcontext':{'type':Sequelize[_0xd7df('0x2')]},'destexten':{'type':Sequelize[_0xd7df('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd7df('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd7df('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'agententerreason':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x53ec=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x5c4d9f,_0xae989e){var _0x40c6db=function(_0x290e0b){while(--_0x290e0b){_0x5c4d9f['push'](_0x5c4d9f['shift']());}};_0x40c6db(++_0xae989e);}(_0x53ec,0x192));var _0xc53e=function(_0x328f97,_0x1d5876){_0x328f97=_0x328f97-0x0;var _0x4b27bc=_0x53ec[_0x328f97];return _0x4b27bc;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'type':{'type':Sequelize[_0xc53e('0x2')]},'uniqueid':{'type':Sequelize[_0xc53e('0x2')]},'calleridnum':{'type':Sequelize[_0xc53e('0x2')]},'calleridname':{'type':Sequelize[_0xc53e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc53e('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc53e('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc53e('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc53e('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xc53e('0x4')]},'agentcomplete':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc53e('0x4')]},'agentacw':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc53e('0x4')]},'reason':{'type':Sequelize[_0xc53e('0x2')]},'lastevent':{'type':Sequelize[_0xc53e('0x2')]},'channel':{'type':Sequelize[_0xc53e('0x2')]},'channelstate':{'type':Sequelize[_0xc53e('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc53e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc53e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc53e('0x2')]},'priority':{'type':Sequelize[_0xc53e('0x2')]},'destchannel':{'type':Sequelize[_0xc53e('0x2')]},'destchannelstate':{'type':Sequelize[_0xc53e('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc53e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc53e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc53e('0x2')]},'destlanguage':{'type':Sequelize[_0xc53e('0x2')]},'destaccountcode':{'type':Sequelize[_0xc53e('0x2')]},'destcontext':{'type':Sequelize[_0xc53e('0x2')]},'destexten':{'type':Sequelize[_0xc53e('0x2')]},'destpriority':{'type':Sequelize[_0xc53e('0x2')]},'destuniqueid':{'type':Sequelize[_0xc53e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc53e('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc53e('0x2')],'comment':_0xc53e('0x6')},'transferexten':{'type':Sequelize[_0xc53e('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc53e('0x2')]},'agententerreason':{'type':Sequelize[_0xc53e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 770106c..ff388c2 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 _0xc1c5=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VoiceAgentReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x13fc5a,_0x5dd717){var _0x567caf=function(_0x590e1c){while(--_0x590e1c){_0x13fc5a['push'](_0x13fc5a['shift']());}};_0x567caf(++_0x5dd717);}(_0xc1c5,0x167));var _0x5c1c=function(_0x577810,_0x5b6d49){_0x577810=_0x577810-0x0;var _0x28a8c5=_0xc1c5[_0x577810];return _0x28a8c5;};'use strict';var pdf=require(_0x5c1c('0x0'));var emlformat=require(_0x5c1c('0x1'));var rimraf=require(_0x5c1c('0x2'));var zipdir=require(_0x5c1c('0x3'));var jsonpatch=require(_0x5c1c('0x4'));var rp=require(_0x5c1c('0x5'));var moment=require(_0x5c1c('0x6'));var BPromise=require(_0x5c1c('0x7'));var Mustache=require(_0x5c1c('0x8'));var util=require(_0x5c1c('0x9'));var path=require(_0x5c1c('0xa'));var sox=require(_0x5c1c('0xb'));var csv=require(_0x5c1c('0xc'));var ejs=require(_0x5c1c('0xd'));var fs=require('fs');var _=require(_0x5c1c('0xe'));var squel=require(_0x5c1c('0xf'));var crypto=require(_0x5c1c('0x10'));var jsforce=require(_0x5c1c('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5c1c('0x12'));var Papa=require(_0x5c1c('0x13'));var Redis=require(_0x5c1c('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5c1c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c1c('0x16'))('api');var utils=require(_0x5c1c('0x17'));var config=require(_0x5c1c('0x18'));var db=require(_0x5c1c('0x19'))['db'];function respondWithStatusCode(_0x35fa29,_0x15d562){_0x15d562=_0x15d562||0xcc;return function(_0x5a7ccb){if(_0x5a7ccb){return _0x35fa29[_0x5c1c('0x1a')](_0x15d562);}return _0x35fa29[_0x5c1c('0x1b')](_0x15d562)[_0x5c1c('0x1c')]();};}function respondWithResult(_0x1b4b0e,_0x4f0a49){_0x4f0a49=_0x4f0a49||0xc8;return function(_0x41b890){if(_0x41b890){return _0x1b4b0e[_0x5c1c('0x1b')](_0x4f0a49)[_0x5c1c('0x1d')](_0x41b890);}};}function respondWithFilteredResult(_0x27e337,_0x4d4979){return function(_0x4b3387){if(_0x4b3387){var _0x362d5a=_0x4b3387['count'],_0xd7bda4=_0x4d4979['offset'],_0x55e3d5=_0x4d4979[_0x5c1c('0x1e')]+_0x4d4979[_0x5c1c('0x1f')],_0x4b1cce;if(_0x55e3d5>=_0x362d5a){_0x55e3d5=_0x362d5a;_0x4b1cce=0xc8;}else{_0x4b1cce=0xce;}_0x27e337[_0x5c1c('0x1b')](_0x4b1cce);return _0x27e337[_0x5c1c('0x20')](_0x5c1c('0x21'),_0xd7bda4+'-'+_0x55e3d5+'/'+_0x362d5a)[_0x5c1c('0x1d')](_0x4b3387);}return null;};}function patchUpdates(_0x469a0e){return function(_0x19d0d6){try{jsonpatch[_0x5c1c('0x22')](_0x19d0d6,_0x469a0e,!![]);}catch(_0x92ecd5){return BPromise[_0x5c1c('0x23')](_0x92ecd5);}return _0x19d0d6['save']();};}function saveUpdates(_0x438fce,_0x1b457c){return function(_0x2ac9a3){if(_0x2ac9a3){return _0x2ac9a3[_0x5c1c('0x24')](_0x438fce)[_0x5c1c('0x25')](function(_0x359b41){return _0x359b41;});}return null;};}function removeEntity(_0x135b12,_0xf1862e){return function(_0x324ad9){if(_0x324ad9){return _0x324ad9['destroy']()[_0x5c1c('0x25')](function(){_0x135b12[_0x5c1c('0x1b')](0xcc)[_0x5c1c('0x1c')]();});}};}function handleEntityNotFound(_0x3972e2,_0x4d506f){return function(_0x2aa6fd){if(!_0x2aa6fd){_0x3972e2['sendStatus'](0x194);}return _0x2aa6fd;};}function handleError(_0x81d9d3,_0x4dbf50){_0x4dbf50=_0x4dbf50||0x1f4;return function(_0x36c508){logger[_0x5c1c('0x26')](_0x36c508[_0x5c1c('0x27')]);if(_0x36c508['name']){delete _0x36c508[_0x5c1c('0x28')];}_0x81d9d3[_0x5c1c('0x1b')](_0x4dbf50)[_0x5c1c('0x29')](_0x36c508);};}exports[_0x5c1c('0x2a')]=function(_0x3bb0a6,_0x25e189){var _0x1758bb={},_0x2abf1f={},_0x513980={'count':0x0,'rows':[]};var _0x38df51=_[_0x5c1c('0x2b')](db[_0x5c1c('0x2c')]['rawAttributes'],function(_0x58092e){return{'name':_0x58092e[_0x5c1c('0x2d')],'type':_0x58092e['type'][_0x5c1c('0x2e')]};});_0x2abf1f[_0x5c1c('0x2f')]=_[_0x5c1c('0x2b')](_0x38df51,_0x5c1c('0x28'));_0x2abf1f[_0x5c1c('0x30')]=_[_0x5c1c('0x31')](_0x3bb0a6['query']);_0x2abf1f[_0x5c1c('0x32')]=_[_0x5c1c('0x33')](_0x2abf1f[_0x5c1c('0x2f')],_0x2abf1f[_0x5c1c('0x30')]);_0x1758bb['attributes']=_[_0x5c1c('0x33')](_0x2abf1f['model'],qs[_0x5c1c('0x34')](_0x3bb0a6[_0x5c1c('0x30')][_0x5c1c('0x34')]));_0x1758bb[_0x5c1c('0x35')]=_0x1758bb[_0x5c1c('0x35')][_0x5c1c('0x36')]?_0x1758bb[_0x5c1c('0x35')]:_0x2abf1f['model'];if(!_0x3bb0a6[_0x5c1c('0x30')][_0x5c1c('0x37')](_0x5c1c('0x38'))){_0x1758bb[_0x5c1c('0x1f')]=qs['limit'](_0x3bb0a6['query'][_0x5c1c('0x1f')]);_0x1758bb[_0x5c1c('0x1e')]=qs['offset'](_0x3bb0a6['query'][_0x5c1c('0x1e')]);}_0x1758bb['order']=qs[_0x5c1c('0x39')](_0x3bb0a6[_0x5c1c('0x30')][_0x5c1c('0x39')]);_0x1758bb[_0x5c1c('0x3a')]=qs[_0x5c1c('0x32')](_[_0x5c1c('0x3b')](_0x3bb0a6[_0x5c1c('0x30')],_0x2abf1f['filters']),_0x38df51);if(_0x3bb0a6[_0x5c1c('0x30')][_0x5c1c('0x3c')]){_0x1758bb[_0x5c1c('0x3a')]=_['merge'](_0x1758bb[_0x5c1c('0x3a')],{'$or':_[_0x5c1c('0x2b')](_0x38df51,function(_0x30e1ac){if(_0x30e1ac[_0x5c1c('0x3d')]!=='VIRTUAL'){var _0x831b00={};_0x831b00[_0x30e1ac[_0x5c1c('0x28')]]={'$like':'%'+_0x3bb0a6['query']['filter']+'%'};return _0x831b00;}})});}_0x1758bb=_[_0x5c1c('0x3e')]({},_0x1758bb,_0x3bb0a6['options']);var _0x87c4c0={'where':_0x1758bb[_0x5c1c('0x3a')]};return db['VoiceAgentReport'][_0x5c1c('0x3f')](_0x87c4c0)[_0x5c1c('0x25')](function(_0x215073){_0x513980['count']=_0x215073;if(_0x3bb0a6[_0x5c1c('0x30')][_0x5c1c('0x40')]){_0x1758bb[_0x5c1c('0x41')]=[{'all':!![]}];}return db[_0x5c1c('0x2c')]['findAll'](_0x1758bb);})['then'](function(_0x2ea324){_0x513980[_0x5c1c('0x42')]=_0x2ea324;return _0x513980;})[_0x5c1c('0x25')](respondWithFilteredResult(_0x25e189,_0x1758bb))[_0x5c1c('0x43')](handleError(_0x25e189,null));};exports[_0x5c1c('0x44')]=function(_0x5cff08,_0x2320c7){var _0x43aec3={'raw':![],'where':{'id':_0x5cff08[_0x5c1c('0x45')]['id']}},_0x5c53f7={};_0x5c53f7[_0x5c1c('0x2f')]=_[_0x5c1c('0x31')](db['VoiceAgentReport'][_0x5c1c('0x46')]);_0x5c53f7[_0x5c1c('0x30')]=_[_0x5c1c('0x31')](_0x5cff08['query']);_0x5c53f7[_0x5c1c('0x32')]=_['intersection'](_0x5c53f7['model'],_0x5c53f7['query']);_0x43aec3['attributes']=_[_0x5c1c('0x33')](_0x5c53f7['model'],qs[_0x5c1c('0x34')](_0x5cff08[_0x5c1c('0x30')][_0x5c1c('0x34')]));_0x43aec3['attributes']=_0x43aec3[_0x5c1c('0x35')][_0x5c1c('0x36')]?_0x43aec3[_0x5c1c('0x35')]:_0x5c53f7[_0x5c1c('0x2f')];if(_0x5cff08['query'][_0x5c1c('0x40')]){_0x43aec3[_0x5c1c('0x41')]=[{'all':!![]}];}_0x43aec3=_['merge']({},_0x43aec3,_0x5cff08['options']);return db[_0x5c1c('0x2c')]['find'](_0x43aec3)['then'](handleEntityNotFound(_0x2320c7,null))[_0x5c1c('0x25')](respondWithResult(_0x2320c7,null))[_0x5c1c('0x43')](handleError(_0x2320c7,null));};exports[_0x5c1c('0x47')]=function(_0x525e77,_0x3972b4){return db[_0x5c1c('0x2c')][_0x5c1c('0x47')](_0x525e77[_0x5c1c('0x48')],{})[_0x5c1c('0x25')](respondWithResult(_0x3972b4,0xc9))['catch'](handleError(_0x3972b4,null));};exports[_0x5c1c('0x24')]=function(_0x12ae45,_0x21518d){if(_0x12ae45[_0x5c1c('0x48')]['id']){delete _0x12ae45[_0x5c1c('0x48')]['id'];}return db[_0x5c1c('0x2c')][_0x5c1c('0x49')]({'where':{'id':_0x12ae45['params']['id']}})[_0x5c1c('0x25')](handleEntityNotFound(_0x21518d,null))[_0x5c1c('0x25')](saveUpdates(_0x12ae45[_0x5c1c('0x48')],null))[_0x5c1c('0x25')](respondWithResult(_0x21518d,null))['catch'](handleError(_0x21518d,null));};exports['destroy']=function(_0x407874,_0x412eec){return db['VoiceAgentReport']['find']({'where':{'id':_0x407874['params']['id']}})[_0x5c1c('0x25')](handleEntityNotFound(_0x412eec,null))[_0x5c1c('0x25')](removeEntity(_0x412eec,null))[_0x5c1c('0x43')](handleError(_0x412eec,null));};exports['describe']=function(_0x35351a,_0x315d78){return db[_0x5c1c('0x2c')][_0x5c1c('0x4a')]()[_0x5c1c('0x25')](respondWithResult(_0x315d78,null))[_0x5c1c('0x43')](handleError(_0x315d78,null));}; \ No newline at end of file +var _0xd554=['update','then','destroy','sendStatus','error','stack','name','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0x305528,_0x263ca6){var _0x2531f0=function(_0x4b379a){while(--_0x4b379a){_0x305528['push'](_0x305528['shift']());}};_0x2531f0(++_0x263ca6);}(_0xd554,0x1f3));var _0x4d55=function(_0xdf899,_0x2b152f){_0xdf899=_0xdf899-0x0;var _0x2dd082=_0xd554[_0xdf899];return _0x2dd082;};'use strict';var pdf=require(_0x4d55('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4d55('0x1'));var zipdir=require(_0x4d55('0x2'));var jsonpatch=require(_0x4d55('0x3'));var rp=require(_0x4d55('0x4'));var moment=require(_0x4d55('0x5'));var BPromise=require(_0x4d55('0x6'));var Mustache=require('mustache');var util=require(_0x4d55('0x7'));var path=require('path');var sox=require(_0x4d55('0x8'));var csv=require('to-csv');var ejs=require(_0x4d55('0x9'));var fs=require('fs');var _=require(_0x4d55('0xa'));var squel=require('squel');var crypto=require(_0x4d55('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4d55('0xc'));var toCsv=require(_0x4d55('0xd'));var querystring=require(_0x4d55('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d55('0xf'));var authService=require(_0x4d55('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4d55('0x11'));var hardwareService=require(_0x4d55('0x12'));var logger=require(_0x4d55('0x13'))(_0x4d55('0x14'));var utils=require(_0x4d55('0x15'));var config=require('../../config/environment');var db=require(_0x4d55('0x16'))['db'];function respondWithStatusCode(_0x4d9781,_0x14c653){_0x14c653=_0x14c653||0xcc;return function(_0x361508){if(_0x361508){return _0x4d9781['sendStatus'](_0x14c653);}return _0x4d9781[_0x4d55('0x17')](_0x14c653)[_0x4d55('0x18')]();};}function respondWithResult(_0x5aa261,_0x45c1e5){_0x45c1e5=_0x45c1e5||0xc8;return function(_0x207389){if(_0x207389){return _0x5aa261[_0x4d55('0x17')](_0x45c1e5)['json'](_0x207389);}};}function respondWithFilteredResult(_0x36a184,_0x44ac85){return function(_0xfb1ef8){if(_0xfb1ef8){var _0x5af607=_0xfb1ef8[_0x4d55('0x19')],_0x105bed=_0x44ac85[_0x4d55('0x1a')],_0x4076f0=_0x44ac85['offset']+_0x44ac85[_0x4d55('0x1b')],_0x144d11;if(_0x4076f0>=_0x5af607){_0x4076f0=_0x5af607;_0x144d11=0xc8;}else{_0x144d11=0xce;}_0x36a184[_0x4d55('0x17')](_0x144d11);return _0x36a184[_0x4d55('0x1c')](_0x4d55('0x1d'),_0x105bed+'-'+_0x4076f0+'/'+_0x5af607)[_0x4d55('0x1e')](_0xfb1ef8);}return null;};}function patchUpdates(_0x34c350){return function(_0x39bc71){try{jsonpatch[_0x4d55('0x1f')](_0x39bc71,_0x34c350,!![]);}catch(_0xae735f){return BPromise[_0x4d55('0x20')](_0xae735f);}return _0x39bc71['save']();};}function saveUpdates(_0x3528c2,_0x36a58a){return function(_0x431a9e){if(_0x431a9e){return _0x431a9e[_0x4d55('0x21')](_0x3528c2)[_0x4d55('0x22')](function(_0x34ea44){return _0x34ea44;});}return null;};}function removeEntity(_0x2f37ad,_0x16dca1){return function(_0x3e438d){if(_0x3e438d){return _0x3e438d[_0x4d55('0x23')]()[_0x4d55('0x22')](function(){_0x2f37ad[_0x4d55('0x17')](0xcc)[_0x4d55('0x18')]();});}};}function handleEntityNotFound(_0x3f1a3c,_0x2b8466){return function(_0x49e547){if(!_0x49e547){_0x3f1a3c[_0x4d55('0x24')](0x194);}return _0x49e547;};}function handleError(_0x219ec0,_0x57a267){_0x57a267=_0x57a267||0x1f4;return function(_0x271845){logger[_0x4d55('0x25')](_0x271845[_0x4d55('0x26')]);if(_0x271845[_0x4d55('0x27')]){delete _0x271845['name'];}_0x219ec0[_0x4d55('0x17')](_0x57a267)['send'](_0x271845);};}exports[_0x4d55('0x28')]=function(_0x242c85,_0x3ba685){var _0x575808={},_0x568454={},_0x397ae6={'count':0x0,'rows':[]};var _0xab1f51=_[_0x4d55('0x29')](db[_0x4d55('0x2a')][_0x4d55('0x2b')],function(_0x47cb43){return{'name':_0x47cb43[_0x4d55('0x2c')],'type':_0x47cb43[_0x4d55('0x2d')][_0x4d55('0x2e')]};});_0x568454[_0x4d55('0x2f')]=_['map'](_0xab1f51,_0x4d55('0x27'));_0x568454[_0x4d55('0x30')]=_[_0x4d55('0x31')](_0x242c85[_0x4d55('0x30')]);_0x568454[_0x4d55('0x32')]=_[_0x4d55('0x33')](_0x568454[_0x4d55('0x2f')],_0x568454['query']);_0x575808[_0x4d55('0x34')]=_['intersection'](_0x568454[_0x4d55('0x2f')],qs[_0x4d55('0x35')](_0x242c85[_0x4d55('0x30')][_0x4d55('0x35')]));_0x575808[_0x4d55('0x34')]=_0x575808[_0x4d55('0x34')][_0x4d55('0x36')]?_0x575808['attributes']:_0x568454[_0x4d55('0x2f')];if(!_0x242c85[_0x4d55('0x30')][_0x4d55('0x37')](_0x4d55('0x38'))){_0x575808['limit']=qs[_0x4d55('0x1b')](_0x242c85[_0x4d55('0x30')]['limit']);_0x575808[_0x4d55('0x1a')]=qs[_0x4d55('0x1a')](_0x242c85[_0x4d55('0x30')]['offset']);}_0x575808[_0x4d55('0x39')]=qs[_0x4d55('0x3a')](_0x242c85[_0x4d55('0x30')]['sort']);_0x575808['where']=qs['filters'](_[_0x4d55('0x3b')](_0x242c85[_0x4d55('0x30')],_0x568454[_0x4d55('0x32')]),_0xab1f51);if(_0x242c85[_0x4d55('0x30')][_0x4d55('0x3c')]){_0x575808[_0x4d55('0x3d')]=_[_0x4d55('0x3e')](_0x575808[_0x4d55('0x3d')],{'$or':_[_0x4d55('0x29')](_0xab1f51,function(_0x220d47){if(_0x220d47[_0x4d55('0x2d')]!==_0x4d55('0x3f')){var _0x35d0be={};_0x35d0be[_0x220d47[_0x4d55('0x27')]]={'$like':'%'+_0x242c85[_0x4d55('0x30')][_0x4d55('0x3c')]+'%'};return _0x35d0be;}})});}_0x575808=_['merge']({},_0x575808,_0x242c85[_0x4d55('0x40')]);var _0x54719d={'where':_0x575808[_0x4d55('0x3d')]};return db[_0x4d55('0x2a')][_0x4d55('0x19')](_0x54719d)['then'](function(_0x3acc70){_0x397ae6[_0x4d55('0x19')]=_0x3acc70;if(_0x242c85[_0x4d55('0x30')][_0x4d55('0x41')]){_0x575808[_0x4d55('0x42')]=[{'all':!![]}];}return db[_0x4d55('0x2a')][_0x4d55('0x43')](_0x575808);})[_0x4d55('0x22')](function(_0x5ddc4f){_0x397ae6[_0x4d55('0x44')]=_0x5ddc4f;return _0x397ae6;})[_0x4d55('0x22')](respondWithFilteredResult(_0x3ba685,_0x575808))[_0x4d55('0x45')](handleError(_0x3ba685,null));};exports[_0x4d55('0x46')]=function(_0x5ab3b8,_0x153c81){var _0x518d84={'raw':![],'where':{'id':_0x5ab3b8[_0x4d55('0x47')]['id']}},_0x30eb58={};_0x30eb58[_0x4d55('0x2f')]=_['keys'](db['VoiceAgentReport']['rawAttributes']);_0x30eb58['query']=_[_0x4d55('0x31')](_0x5ab3b8[_0x4d55('0x30')]);_0x30eb58[_0x4d55('0x32')]=_[_0x4d55('0x33')](_0x30eb58[_0x4d55('0x2f')],_0x30eb58['query']);_0x518d84[_0x4d55('0x34')]=_[_0x4d55('0x33')](_0x30eb58[_0x4d55('0x2f')],qs['fields'](_0x5ab3b8['query'][_0x4d55('0x35')]));_0x518d84[_0x4d55('0x34')]=_0x518d84[_0x4d55('0x34')][_0x4d55('0x36')]?_0x518d84[_0x4d55('0x34')]:_0x30eb58[_0x4d55('0x2f')];if(_0x5ab3b8['query'][_0x4d55('0x41')]){_0x518d84[_0x4d55('0x42')]=[{'all':!![]}];}_0x518d84=_['merge']({},_0x518d84,_0x5ab3b8[_0x4d55('0x40')]);return db['VoiceAgentReport'][_0x4d55('0x48')](_0x518d84)[_0x4d55('0x22')](handleEntityNotFound(_0x153c81,null))[_0x4d55('0x22')](respondWithResult(_0x153c81,null))[_0x4d55('0x45')](handleError(_0x153c81,null));};exports[_0x4d55('0x49')]=function(_0x50fcf7,_0x5db343){return db[_0x4d55('0x2a')][_0x4d55('0x49')](_0x50fcf7[_0x4d55('0x4a')],{})['then'](respondWithResult(_0x5db343,0xc9))[_0x4d55('0x45')](handleError(_0x5db343,null));};exports['update']=function(_0x2c07fa,_0x3b0dce){if(_0x2c07fa[_0x4d55('0x4a')]['id']){delete _0x2c07fa[_0x4d55('0x4a')]['id'];}return db['VoiceAgentReport'][_0x4d55('0x48')]({'where':{'id':_0x2c07fa[_0x4d55('0x47')]['id']}})[_0x4d55('0x22')](handleEntityNotFound(_0x3b0dce,null))[_0x4d55('0x22')](saveUpdates(_0x2c07fa['body'],null))[_0x4d55('0x22')](respondWithResult(_0x3b0dce,null))[_0x4d55('0x45')](handleError(_0x3b0dce,null));};exports[_0x4d55('0x23')]=function(_0x10d688,_0x2f405e){return db[_0x4d55('0x2a')][_0x4d55('0x48')]({'where':{'id':_0x10d688['params']['id']}})[_0x4d55('0x22')](handleEntityNotFound(_0x2f405e,null))[_0x4d55('0x22')](removeEntity(_0x2f405e,null))['catch'](handleError(_0x2f405e,null));};exports[_0x4d55('0x4b')]=function(_0x17d4b6,_0x54deaa){return db['VoiceAgentReport'][_0x4d55('0x4b')]()['then'](respondWithResult(_0x54deaa,null))[_0x4d55('0x45')](handleError(_0x54deaa,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 95bee4f..ae6e200 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 _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x34e8,0x12c));var _0x834e=function(_0x15a74f,_0x5cd3f5){_0x15a74f=_0x15a74f-0x0;var _0x47ce93=_0x34e8[_0x15a74f];return _0x47ce93;};'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':[{'fields':[_0x834e('0xd'),_0x834e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1e6636,_0x3f1c5e){var _0x4b6320=function(_0x4f1f04){while(--_0x4f1f04){_0x1e6636['push'](_0x1e6636['shift']());}};_0x4b6320(++_0x3f1c5e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xcb91[_0x3b231a];return _0x18d67a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ed874c7..8e1920a 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 _0x57ae=['raw','stringify','UpdateVoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options'];(function(_0x55e059,_0x2df2c5){var _0x1e6bb7=function(_0x15799b){while(--_0x15799b){_0x55e059['push'](_0x55e059['shift']());}};_0x1e6bb7(++_0x2df2c5);}(_0x57ae,0x66));var _0xe57a=function(_0x18eb92,_0x4d4a60){_0x18eb92=_0x18eb92-0x0;var _0x283f94=_0x57ae[_0x18eb92];return _0x283f94;};'use strict';var _=require(_0xe57a('0x0'));var util=require(_0xe57a('0x1'));var moment=require(_0xe57a('0x2'));var BPromise=require(_0xe57a('0x3'));var rs=require(_0xe57a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe57a('0x5'))['db'];var utils=require(_0xe57a('0x6'));var logger=require(_0xe57a('0x7'))(_0xe57a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe57a('0x9'));var client=jayson['client'][_0xe57a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58795d,_0x17c6f5,_0x7fefc0){return new BPromise(function(_0x5482fd,_0xf20ff8){return client[_0xe57a('0xb')](_0x58795d,_0x7fefc0)[_0xe57a('0xc')](function(_0x3133eb){logger[_0xe57a('0xd')](_0xe57a('0xe'),_0x17c6f5,'request\x20sent');logger[_0xe57a('0xf')](_0xe57a('0x10'),_0x17c6f5,'request\x20sent',JSON['stringify'](_0x3133eb));if(_0x3133eb[_0xe57a('0x11')]){if(_0x3133eb['error'][_0xe57a('0x12')]===0x1f4){logger[_0xe57a('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x17c6f5,_0x3133eb[_0xe57a('0x11')][_0xe57a('0x13')]);return _0xf20ff8(_0x3133eb['error']['message']);}logger['error'](_0xe57a('0xe'),_0x17c6f5,_0x3133eb[_0xe57a('0x11')]['message']);return _0x5482fd(_0x3133eb['error'][_0xe57a('0x13')]);}else{logger['info'](_0xe57a('0xe'),_0x17c6f5,'request\x20sent');_0x5482fd(_0x3133eb[_0xe57a('0x14')]['message']);}})[_0xe57a('0x15')](function(_0x4a2ee7){logger[_0xe57a('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x17c6f5,_0x4a2ee7);_0xf20ff8(_0x4a2ee7);});});}exports[_0xe57a('0x16')]=function(_0x1929fd){var _0x173ad6=this;return new Promise(function(_0x2f7692,_0x401a47){return db[_0xe57a('0x17')]['create'](_0x1929fd[_0xe57a('0x18')],{'raw':_0x1929fd[_0xe57a('0x19')]?_0x1929fd[_0xe57a('0x19')][_0xe57a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x592d3f){logger[_0xe57a('0xd')](_0xe57a('0x16'),_0x1929fd);logger['debug']('CreateVoiceAgentReport',_0x1929fd,JSON[_0xe57a('0x1b')](_0x592d3f));_0x2f7692(_0x592d3f);})[_0xe57a('0x15')](function(_0x410fca){logger['error']('CreateVoiceAgentReport',_0x410fca['message'],_0x1929fd);_0x401a47(_0x173ad6[_0xe57a('0x11')](0x1f4,_0x410fca[_0xe57a('0x13')]));});});};exports[_0xe57a('0x1c')]=function(_0xab262c){var _0x430118=this;return new Promise(function(_0x25d3c3,_0x55733c){return db[_0xe57a('0x17')][_0xe57a('0x1d')](_0xab262c[_0xe57a('0x18')],{'raw':_0xab262c[_0xe57a('0x19')]?_0xab262c[_0xe57a('0x19')][_0xe57a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xab262c['options']?_0xab262c[_0xe57a('0x19')][_0xe57a('0x1e')]||null:null,'attributes':_0xab262c[_0xe57a('0x19')]?_0xab262c[_0xe57a('0x19')][_0xe57a('0x1f')]||null:null,'limit':_0xab262c['options']?_0xab262c['options']['limit']||null:null})[_0xe57a('0xc')](function(_0x737cbb){logger[_0xe57a('0xd')](_0xe57a('0x1c'),_0xab262c);logger[_0xe57a('0xf')](_0xe57a('0x1c'),_0xab262c,JSON[_0xe57a('0x1b')](_0x737cbb));_0x25d3c3(_0x737cbb);})[_0xe57a('0x15')](function(_0x307f42){logger['error'](_0xe57a('0x1c'),_0x307f42[_0xe57a('0x13')],_0xab262c);_0x55733c(_0x430118[_0xe57a('0x11')](0x1f4,_0x307f42[_0xe57a('0x13')]));});});}; \ No newline at end of file +var _0xa71a=['VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport'];(function(_0x75bbac,_0x4f8cd9){var _0x204bc5=function(_0xb89b3){while(--_0xb89b3){_0x75bbac['push'](_0x75bbac['shift']());}};_0x204bc5(++_0x4f8cd9);}(_0xa71a,0x64));var _0xaa71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa71a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa71('0x0'));var BPromise=require(_0xaa71('0x1'));var rs=require(_0xaa71('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa71('0x3'))['db'];var utils=require(_0xaa71('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa71('0x5'));var jayson=require(_0xaa71('0x6'));var client=jayson[_0xaa71('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8c3920,_0xc0282a,_0x278a8a){return new BPromise(function(_0x7bb4ce,_0x2dcc5e){return client['request'](_0x8c3920,_0x278a8a)['then'](function(_0xe74147){logger[_0xaa71('0x8')](_0xaa71('0x9'),_0xc0282a,_0xaa71('0xa'));logger[_0xaa71('0xb')](_0xaa71('0xc'),_0xc0282a,_0xaa71('0xa'),JSON[_0xaa71('0xd')](_0xe74147));if(_0xe74147['error']){if(_0xe74147[_0xaa71('0xe')][_0xaa71('0xf')]===0x1f4){logger[_0xaa71('0xe')](_0xaa71('0x9'),_0xc0282a,_0xe74147[_0xaa71('0xe')]['message']);return _0x2dcc5e(_0xe74147[_0xaa71('0xe')][_0xaa71('0x10')]);}logger[_0xaa71('0xe')](_0xaa71('0x9'),_0xc0282a,_0xe74147[_0xaa71('0xe')][_0xaa71('0x10')]);return _0x7bb4ce(_0xe74147[_0xaa71('0xe')][_0xaa71('0x10')]);}else{logger[_0xaa71('0x8')](_0xaa71('0x9'),_0xc0282a,_0xaa71('0xa'));_0x7bb4ce(_0xe74147[_0xaa71('0x11')][_0xaa71('0x10')]);}})[_0xaa71('0x12')](function(_0x3cc749){logger[_0xaa71('0xe')](_0xaa71('0x9'),_0xc0282a,_0x3cc749);_0x2dcc5e(_0x3cc749);});});}exports[_0xaa71('0x13')]=function(_0x362f56){var _0x4f4b8b=this;return new Promise(function(_0x6fb064,_0x40acd5){return db[_0xaa71('0x14')][_0xaa71('0x15')](_0x362f56[_0xaa71('0x16')],{'raw':_0x362f56['options']?_0x362f56[_0xaa71('0x17')][_0xaa71('0x18')]===undefined?!![]:![]:!![]})[_0xaa71('0x19')](function(_0x50f31e){logger[_0xaa71('0x8')]('CreateVoiceAgentReport',_0x362f56);logger[_0xaa71('0xb')](_0xaa71('0x13'),_0x362f56,JSON['stringify'](_0x50f31e));_0x6fb064(_0x50f31e);})['catch'](function(_0x386f63){logger['error'](_0xaa71('0x13'),_0x386f63[_0xaa71('0x10')],_0x362f56);_0x40acd5(_0x4f4b8b['error'](0x1f4,_0x386f63['message']));});});};exports[_0xaa71('0x1a')]=function(_0x2a5ad0){var _0x1ac9ed=this;return new Promise(function(_0x323861,_0x20c575){return db[_0xaa71('0x14')][_0xaa71('0x1b')](_0x2a5ad0[_0xaa71('0x16')],{'raw':_0x2a5ad0[_0xaa71('0x17')]?_0x2a5ad0[_0xaa71('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a5ad0[_0xaa71('0x17')]?_0x2a5ad0[_0xaa71('0x17')][_0xaa71('0x1c')]||null:null,'attributes':_0x2a5ad0[_0xaa71('0x17')]?_0x2a5ad0[_0xaa71('0x17')][_0xaa71('0x1d')]||null:null,'limit':_0x2a5ad0[_0xaa71('0x17')]?_0x2a5ad0[_0xaa71('0x17')]['limit']||null:null})['then'](function(_0x112edd){logger[_0xaa71('0x8')](_0xaa71('0x1a'),_0x2a5ad0);logger[_0xaa71('0xb')](_0xaa71('0x1a'),_0x2a5ad0,JSON[_0xaa71('0xd')](_0x112edd));_0x323861(_0x112edd);})[_0xaa71('0x12')](function(_0x3ea9fc){logger[_0xaa71('0xe')](_0xaa71('0x1a'),_0x3ea9fc[_0xaa71('0x10')],_0x2a5ad0);_0x20c575(_0x1ac9ed[_0xaa71('0xe')](0x1f4,_0x3ea9fc[_0xaa71('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1861b25..794c3b6 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 _0x99b6=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x10ae08,_0x112f73){var _0x511b74=function(_0x1a8d2d){while(--_0x1a8d2d){_0x10ae08['push'](_0x10ae08['shift']());}};_0x511b74(++_0x112f73);}(_0x99b6,0x140));var _0x699b=function(_0x58c83d,_0x1e9695){_0x58c83d=_0x58c83d-0x0;var _0x7a0e74=_0x99b6[_0x58c83d];return _0x7a0e74;};'use strict';var multer=require(_0x699b('0x0'));var util=require(_0x699b('0x1'));var path=require(_0x699b('0x2'));var timeout=require('connect-timeout');var express=require(_0x699b('0x3'));var router=express[_0x699b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x699b('0x5'));var config=require(_0x699b('0x6'));var controller=require(_0x699b('0x7'));router[_0x699b('0x8')]('/',auth[_0x699b('0x9')](),controller[_0x699b('0xa')]);router[_0x699b('0x8')](_0x699b('0xb'),auth[_0x699b('0x9')](),controller['describe']);router[_0x699b('0x8')](_0x699b('0xc'),auth['isAuthenticated'](),controller[_0x699b('0xd')]);router[_0x699b('0xe')]('/',auth[_0x699b('0x9')](),controller[_0x699b('0xf')]);router[_0x699b('0x10')](_0x699b('0xc'),auth['isAuthenticated'](),controller[_0x699b('0x11')]);router['delete']('/:id',auth[_0x699b('0x9')](),controller[_0x699b('0x12')]);module[_0x699b('0x13')]=router; \ No newline at end of file +var _0x0bc1=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0x0bc1,0x1ae));var _0x10bc=function(_0x338fff,_0x308289){_0x338fff=_0x338fff-0x0;var _0x18c00a=_0x0bc1[_0x338fff];return _0x18c00a;};'use strict';var multer=require(_0x10bc('0x0'));var util=require(_0x10bc('0x1'));var path=require(_0x10bc('0x2'));var timeout=require(_0x10bc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x10bc('0x4'));var interaction=require(_0x10bc('0x5'));var config=require(_0x10bc('0x6'));var controller=require(_0x10bc('0x7'));router[_0x10bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x10bc('0x9')]);router[_0x10bc('0x8')](_0x10bc('0xa'),auth[_0x10bc('0xb')](),controller[_0x10bc('0xc')]);router[_0x10bc('0x8')](_0x10bc('0xd'),auth[_0x10bc('0xb')](),controller['show']);router[_0x10bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x10bc('0xf')](_0x10bc('0xd'),auth['isAuthenticated'](),controller[_0x10bc('0x10')]);router[_0x10bc('0x11')](_0x10bc('0xd'),auth['isAuthenticated'](),controller[_0x10bc('0x12')]);module[_0x10bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 493aeaa..c87ea6b 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 _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x30066f,_0x5891c9){var _0x1ad673=function(_0x296b6c){while(--_0x296b6c){_0x30066f['push'](_0x30066f['shift']());}};_0x1ad673(++_0x5891c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x34ce26,_0x16daab){var _0x11a16c=function(_0x15a995){while(--_0x15a995){_0x34ce26['push'](_0x34ce26['shift']());}};_0x11a16c(++_0x16daab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 6070b92..a847e11 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 _0xeffb=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','error','stack','send','index','map','VoiceCallReport','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','includeAll','include','fullname','alias','User','rows','params','rawAttributes','options','find','catch','create','body','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5f06d4,_0x23d55e){var _0x219a1d=function(_0x403af1){while(--_0x403af1){_0x5f06d4['push'](_0x5f06d4['shift']());}};_0x219a1d(++_0x23d55e);}(_0xeffb,0x11c));var _0xbeff=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xeffb[_0x55821d];return _0x58ea8a;};'use strict';var pdf=require(_0xbeff('0x0'));var emlformat=require(_0xbeff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbeff('0x2'));var jsonpatch=require(_0xbeff('0x3'));var rp=require(_0xbeff('0x4'));var moment=require('moment');var BPromise=require(_0xbeff('0x5'));var Mustache=require(_0xbeff('0x6'));var util=require(_0xbeff('0x7'));var path=require(_0xbeff('0x8'));var sox=require(_0xbeff('0x9'));var csv=require(_0xbeff('0xa'));var ejs=require(_0xbeff('0xb'));var fs=require('fs');var _=require(_0xbeff('0xc'));var squel=require(_0xbeff('0xd'));var crypto=require(_0xbeff('0xe'));var jsforce=require(_0xbeff('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbeff('0x10'));var Redis=require(_0xbeff('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbeff('0x12'));var hardwareService=require(_0xbeff('0x13'));var logger=require(_0xbeff('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbeff('0x15'))['db'];function respondWithStatusCode(_0x4dc930,_0x4edf11){_0x4edf11=_0x4edf11||0xcc;return function(_0xd17d9c){if(_0xd17d9c){return _0x4dc930[_0xbeff('0x16')](_0x4edf11);}return _0x4dc930[_0xbeff('0x17')](_0x4edf11)[_0xbeff('0x18')]();};}function respondWithResult(_0x4e6283,_0x2994b3){_0x2994b3=_0x2994b3||0xc8;return function(_0x262404){if(_0x262404){return _0x4e6283[_0xbeff('0x17')](_0x2994b3)[_0xbeff('0x19')](_0x262404);}};}function respondWithFilteredResult(_0x32250f,_0x367531){return function(_0xe0c239){if(_0xe0c239){var _0x17dba4=_0xe0c239[_0xbeff('0x1a')],_0x48ce70=_0x367531[_0xbeff('0x1b')],_0x477a5d=_0x367531[_0xbeff('0x1b')]+_0x367531[_0xbeff('0x1c')],_0x393e76;if(_0x477a5d>=_0x17dba4){_0x477a5d=_0x17dba4;_0x393e76=0xc8;}else{_0x393e76=0xce;}_0x32250f[_0xbeff('0x17')](_0x393e76);return _0x32250f[_0xbeff('0x1d')]('Content-Range',_0x48ce70+'-'+_0x477a5d+'/'+_0x17dba4)['json'](_0xe0c239);}return null;};}function patchUpdates(_0x39bec2){return function(_0x517f64){try{jsonpatch[_0xbeff('0x1e')](_0x517f64,_0x39bec2,!![]);}catch(_0x25e419){return BPromise[_0xbeff('0x1f')](_0x25e419);}return _0x517f64['save']();};}function saveUpdates(_0x5d5ac5,_0x5822f8){return function(_0x4b3057){if(_0x4b3057){return _0x4b3057['update'](_0x5d5ac5)[_0xbeff('0x20')](function(_0x1831b4){return _0x1831b4;});}return null;};}function removeEntity(_0x18d450,_0x59668b){return function(_0x1fb2c9){if(_0x1fb2c9){return _0x1fb2c9[_0xbeff('0x21')]()['then'](function(){_0x18d450[_0xbeff('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7a90,_0xb2b854){return function(_0x49c596){if(!_0x49c596){_0x4c7a90['sendStatus'](0x194);}return _0x49c596;};}function handleError(_0x275339,_0x2a0534){_0x2a0534=_0x2a0534||0x1f4;return function(_0x448095){logger[_0xbeff('0x22')](_0x448095[_0xbeff('0x23')]);if(_0x448095['name']){delete _0x448095['name'];}_0x275339[_0xbeff('0x17')](_0x2a0534)[_0xbeff('0x24')](_0x448095);};}exports[_0xbeff('0x25')]=function(_0x53c7ce,_0x406de5){var _0x362e80={},_0xc2ef0c={},_0x2fd5e6={'count':0x0,'rows':[]};var _0x5716bb=_[_0xbeff('0x26')](db[_0xbeff('0x27')]['rawAttributes'],function(_0x3ca050){return{'name':_0x3ca050['fieldName'],'type':_0x3ca050['type'][_0xbeff('0x28')]};});_0xc2ef0c[_0xbeff('0x29')]=_[_0xbeff('0x26')](_0x5716bb,'name');_0xc2ef0c[_0xbeff('0x2a')]=_[_0xbeff('0x2b')](_0x53c7ce['query']);_0xc2ef0c[_0xbeff('0x2c')]=_['intersection'](_0xc2ef0c['model'],_0xc2ef0c[_0xbeff('0x2a')]);_0x362e80['attributes']=_[_0xbeff('0x2d')](_0xc2ef0c[_0xbeff('0x29')],qs[_0xbeff('0x2e')](_0x53c7ce[_0xbeff('0x2a')][_0xbeff('0x2e')]));_0x362e80['attributes']=_0x362e80[_0xbeff('0x2f')][_0xbeff('0x30')]?_0x362e80[_0xbeff('0x2f')]:_0xc2ef0c['model'];if(!_0x53c7ce[_0xbeff('0x2a')][_0xbeff('0x31')](_0xbeff('0x32'))){_0x362e80[_0xbeff('0x1c')]=qs[_0xbeff('0x1c')](_0x53c7ce['query'][_0xbeff('0x1c')]);_0x362e80[_0xbeff('0x1b')]=qs[_0xbeff('0x1b')](_0x53c7ce['query']['offset']);}_0x362e80[_0xbeff('0x33')]=qs[_0xbeff('0x34')](_0x53c7ce[_0xbeff('0x2a')][_0xbeff('0x34')]);_0x362e80[_0xbeff('0x35')]=qs[_0xbeff('0x2c')](_[_0xbeff('0x36')](_0x53c7ce[_0xbeff('0x2a')],_0xc2ef0c[_0xbeff('0x2c')]),_0x5716bb);if(_0x53c7ce[_0xbeff('0x2a')][_0xbeff('0x37')]){_0x362e80['where']=_[_0xbeff('0x38')](_0x362e80['where'],{'$or':_[_0xbeff('0x26')](_0x5716bb,function(_0x1b0a4a){if(_0x1b0a4a[_0xbeff('0x39')]!==_0xbeff('0x3a')){var _0x436e0c={};_0x436e0c[_0x1b0a4a[_0xbeff('0x3b')]]={'$like':'%'+_0x53c7ce[_0xbeff('0x2a')][_0xbeff('0x37')]+'%'};return _0x436e0c;}})});}_0x362e80=_['merge']({},_0x362e80,_0x53c7ce['options']);var _0xf29977={'where':_0x362e80[_0xbeff('0x35')]};return db[_0xbeff('0x27')][_0xbeff('0x1a')](_0xf29977)[_0xbeff('0x20')](function(_0x1b4912){_0x2fd5e6['count']=_0x1b4912;if(_0x53c7ce[_0xbeff('0x2a')][_0xbeff('0x3c')]){_0x362e80[_0xbeff('0x3d')]=[{'attributes':['id','name',_0xbeff('0x3e'),_0xbeff('0x3f')],'model':db[_0xbeff('0x40')],'as':'User'}];}return db['VoiceCallReport']['findAll'](_0x362e80);})[_0xbeff('0x20')](function(_0x2845ba){_0x2fd5e6[_0xbeff('0x41')]=_0x2845ba;return _0x2fd5e6;})['then'](respondWithFilteredResult(_0x406de5,_0x362e80))['catch'](handleError(_0x406de5,null));};exports['show']=function(_0x5aa514,_0x568d62){var _0x23d83a={'raw':!![],'where':{'id':_0x5aa514[_0xbeff('0x42')]['id']}},_0x398c16={};_0x398c16[_0xbeff('0x29')]=_['keys'](db[_0xbeff('0x27')][_0xbeff('0x43')]);_0x398c16[_0xbeff('0x2a')]=_['keys'](_0x5aa514[_0xbeff('0x2a')]);_0x398c16[_0xbeff('0x2c')]=_[_0xbeff('0x2d')](_0x398c16[_0xbeff('0x29')],_0x398c16[_0xbeff('0x2a')]);_0x23d83a[_0xbeff('0x2f')]=_['intersection'](_0x398c16[_0xbeff('0x29')],qs['fields'](_0x5aa514['query'][_0xbeff('0x2e')]));_0x23d83a[_0xbeff('0x2f')]=_0x23d83a[_0xbeff('0x2f')][_0xbeff('0x30')]?_0x23d83a[_0xbeff('0x2f')]:_0x398c16['model'];if(_0x5aa514[_0xbeff('0x2a')]['includeAll']){_0x23d83a['include']=[{'all':!![]}];}_0x23d83a=_[_0xbeff('0x38')]({},_0x23d83a,_0x5aa514[_0xbeff('0x44')]);return db[_0xbeff('0x27')][_0xbeff('0x45')](_0x23d83a)[_0xbeff('0x20')](handleEntityNotFound(_0x568d62,null))[_0xbeff('0x20')](respondWithResult(_0x568d62,null))[_0xbeff('0x46')](handleError(_0x568d62,null));};exports[_0xbeff('0x47')]=function(_0x46fd2f,_0x10a21a){return db[_0xbeff('0x27')][_0xbeff('0x47')](_0x46fd2f[_0xbeff('0x48')],{})[_0xbeff('0x20')](respondWithResult(_0x10a21a,0xc9))['catch'](handleError(_0x10a21a,null));};exports[_0xbeff('0x21')]=function(_0x57d702,_0x435b8c){return db[_0xbeff('0x27')][_0xbeff('0x45')]({'where':{'id':_0x57d702[_0xbeff('0x42')]['id']}})[_0xbeff('0x20')](handleEntityNotFound(_0x435b8c,null))[_0xbeff('0x20')](removeEntity(_0x435b8c,null))[_0xbeff('0x46')](handleError(_0x435b8c,null));};exports[_0xbeff('0x49')]=function(_0x1c297d,_0x585a54){return db['VoiceCallReport'][_0xbeff('0x49')]()[_0xbeff('0x20')](respondWithResult(_0x585a54,null))[_0xbeff('0x46')](handleError(_0x585a54,null));};exports['update']=function(_0x4a8069,_0x502e57){if(_0x4a8069[_0xbeff('0x48')][_0xbeff('0x4a')]){delete _0x4a8069[_0xbeff('0x48')][_0xbeff('0x4a')];}return db[_0xbeff('0x27')][_0xbeff('0x45')]({'where':{'uniqueid':_0x4a8069[_0xbeff('0x42')]['id'],'UserId':{'$or':[null,_0x4a8069['user']['id']]}}})[_0xbeff('0x20')](handleEntityNotFound(_0x502e57,null))['then'](saveUpdates(_0x4a8069[_0xbeff('0x48')],null))[_0xbeff('0x20')](respondWithResult(_0x502e57,null))[_0xbeff('0x46')](handleError(_0x502e57,null));}; \ No newline at end of file +var _0xac62=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','update','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','include','fullname','alias','User','findAll','rows','show','params','options','find','catch','create','describe','body','uniqueid','user','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse'];(function(_0xaa9204,_0x163a47){var _0x1e39f8=function(_0x4737eb){while(--_0x4737eb){_0xaa9204['push'](_0xaa9204['shift']());}};_0x1e39f8(++_0x163a47);}(_0xac62,0x8f));var _0x2ac6=function(_0x32ecca,_0xc50e5e){_0x32ecca=_0x32ecca-0x0;var _0x28d753=_0xac62[_0x32ecca];return _0x28d753;};'use strict';var pdf=require(_0x2ac6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2ac6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ac6('0x2'));var rp=require(_0x2ac6('0x3'));var moment=require(_0x2ac6('0x4'));var BPromise=require(_0x2ac6('0x5'));var Mustache=require(_0x2ac6('0x6'));var util=require(_0x2ac6('0x7'));var path=require(_0x2ac6('0x8'));var sox=require('sox');var csv=require(_0x2ac6('0x9'));var ejs=require(_0x2ac6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ac6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2ac6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2ac6('0xd'));var Papa=require(_0x2ac6('0xe'));var Redis=require(_0x2ac6('0xf'));var authService=require(_0x2ac6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2ac6('0x11'));var hardwareService=require(_0x2ac6('0x12'));var logger=require(_0x2ac6('0x13'))('api');var utils=require(_0x2ac6('0x14'));var config=require(_0x2ac6('0x15'));var db=require(_0x2ac6('0x16'))['db'];function respondWithStatusCode(_0x52e4d8,_0xefda7a){_0xefda7a=_0xefda7a||0xcc;return function(_0x3f9aac){if(_0x3f9aac){return _0x52e4d8[_0x2ac6('0x17')](_0xefda7a);}return _0x52e4d8[_0x2ac6('0x18')](_0xefda7a)[_0x2ac6('0x19')]();};}function respondWithResult(_0x4e7312,_0x2727b4){_0x2727b4=_0x2727b4||0xc8;return function(_0xef84fc){if(_0xef84fc){return _0x4e7312[_0x2ac6('0x18')](_0x2727b4)['json'](_0xef84fc);}};}function respondWithFilteredResult(_0x26fdb7,_0x593c4a){return function(_0x2b6f1f){if(_0x2b6f1f){var _0x31b233=_0x2b6f1f['count'],_0x120852=_0x593c4a[_0x2ac6('0x1a')],_0x5f2e25=_0x593c4a['offset']+_0x593c4a[_0x2ac6('0x1b')],_0xc03987;if(_0x5f2e25>=_0x31b233){_0x5f2e25=_0x31b233;_0xc03987=0xc8;}else{_0xc03987=0xce;}_0x26fdb7[_0x2ac6('0x18')](_0xc03987);return _0x26fdb7[_0x2ac6('0x1c')]('Content-Range',_0x120852+'-'+_0x5f2e25+'/'+_0x31b233)[_0x2ac6('0x1d')](_0x2b6f1f);}return null;};}function patchUpdates(_0x547673){return function(_0x515aa2){try{jsonpatch[_0x2ac6('0x1e')](_0x515aa2,_0x547673,!![]);}catch(_0x2f4fec){return BPromise[_0x2ac6('0x1f')](_0x2f4fec);}return _0x515aa2['save']();};}function saveUpdates(_0x4ae9bb,_0x8c5af1){return function(_0x3525be){if(_0x3525be){return _0x3525be[_0x2ac6('0x20')](_0x4ae9bb)['then'](function(_0x327ee7){return _0x327ee7;});}return null;};}function removeEntity(_0x2558b5,_0x344269){return function(_0x35288e){if(_0x35288e){return _0x35288e[_0x2ac6('0x21')]()[_0x2ac6('0x22')](function(){_0x2558b5[_0x2ac6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59dd39,_0x4857b9){return function(_0x2de72a){if(!_0x2de72a){_0x59dd39[_0x2ac6('0x17')](0x194);}return _0x2de72a;};}function handleError(_0x439327,_0x40bd58){_0x40bd58=_0x40bd58||0x1f4;return function(_0x50ae34){logger[_0x2ac6('0x23')](_0x50ae34['stack']);if(_0x50ae34[_0x2ac6('0x24')]){delete _0x50ae34[_0x2ac6('0x24')];}_0x439327['status'](_0x40bd58)[_0x2ac6('0x25')](_0x50ae34);};}exports[_0x2ac6('0x26')]=function(_0x55f62f,_0x416501){var _0x33ac82={},_0x46a7c8={},_0x105462={'count':0x0,'rows':[]};var _0x3b0e1e=_[_0x2ac6('0x27')](db[_0x2ac6('0x28')][_0x2ac6('0x29')],function(_0x468406){return{'name':_0x468406[_0x2ac6('0x2a')],'type':_0x468406[_0x2ac6('0x2b')][_0x2ac6('0x2c')]};});_0x46a7c8[_0x2ac6('0x2d')]=_['map'](_0x3b0e1e,_0x2ac6('0x24'));_0x46a7c8[_0x2ac6('0x2e')]=_[_0x2ac6('0x2f')](_0x55f62f[_0x2ac6('0x2e')]);_0x46a7c8[_0x2ac6('0x30')]=_[_0x2ac6('0x31')](_0x46a7c8[_0x2ac6('0x2d')],_0x46a7c8[_0x2ac6('0x2e')]);_0x33ac82[_0x2ac6('0x32')]=_[_0x2ac6('0x31')](_0x46a7c8['model'],qs[_0x2ac6('0x33')](_0x55f62f[_0x2ac6('0x2e')][_0x2ac6('0x33')]));_0x33ac82[_0x2ac6('0x32')]=_0x33ac82[_0x2ac6('0x32')][_0x2ac6('0x34')]?_0x33ac82['attributes']:_0x46a7c8[_0x2ac6('0x2d')];if(!_0x55f62f['query'][_0x2ac6('0x35')](_0x2ac6('0x36'))){_0x33ac82[_0x2ac6('0x1b')]=qs[_0x2ac6('0x1b')](_0x55f62f[_0x2ac6('0x2e')][_0x2ac6('0x1b')]);_0x33ac82[_0x2ac6('0x1a')]=qs['offset'](_0x55f62f[_0x2ac6('0x2e')]['offset']);}_0x33ac82[_0x2ac6('0x37')]=qs['sort'](_0x55f62f['query'][_0x2ac6('0x38')]);_0x33ac82[_0x2ac6('0x39')]=qs['filters'](_[_0x2ac6('0x3a')](_0x55f62f[_0x2ac6('0x2e')],_0x46a7c8[_0x2ac6('0x30')]),_0x3b0e1e);if(_0x55f62f[_0x2ac6('0x2e')]['filter']){_0x33ac82['where']=_[_0x2ac6('0x3b')](_0x33ac82[_0x2ac6('0x39')],{'$or':_[_0x2ac6('0x27')](_0x3b0e1e,function(_0x80e05a){if(_0x80e05a[_0x2ac6('0x2b')]!==_0x2ac6('0x3c')){var _0x2e188b={};_0x2e188b[_0x80e05a['name']]={'$like':'%'+_0x55f62f['query'][_0x2ac6('0x3d')]+'%'};return _0x2e188b;}})});}_0x33ac82=_[_0x2ac6('0x3b')]({},_0x33ac82,_0x55f62f['options']);var _0x57e9b2={'where':_0x33ac82['where']};return db[_0x2ac6('0x28')][_0x2ac6('0x3e')](_0x57e9b2)['then'](function(_0x1a74a3){_0x105462[_0x2ac6('0x3e')]=_0x1a74a3;if(_0x55f62f[_0x2ac6('0x2e')]['includeAll']){_0x33ac82[_0x2ac6('0x3f')]=[{'attributes':['id',_0x2ac6('0x24'),_0x2ac6('0x40'),_0x2ac6('0x41')],'model':db[_0x2ac6('0x42')],'as':'User'}];}return db[_0x2ac6('0x28')][_0x2ac6('0x43')](_0x33ac82);})['then'](function(_0x99271a){_0x105462[_0x2ac6('0x44')]=_0x99271a;return _0x105462;})['then'](respondWithFilteredResult(_0x416501,_0x33ac82))['catch'](handleError(_0x416501,null));};exports[_0x2ac6('0x45')]=function(_0x536e45,_0x1ddd29){var _0x1ac0b2={'raw':!![],'where':{'id':_0x536e45[_0x2ac6('0x46')]['id']}},_0x47aeae={};_0x47aeae['model']=_[_0x2ac6('0x2f')](db[_0x2ac6('0x28')][_0x2ac6('0x29')]);_0x47aeae[_0x2ac6('0x2e')]=_[_0x2ac6('0x2f')](_0x536e45['query']);_0x47aeae['filters']=_[_0x2ac6('0x31')](_0x47aeae['model'],_0x47aeae[_0x2ac6('0x2e')]);_0x1ac0b2[_0x2ac6('0x32')]=_['intersection'](_0x47aeae[_0x2ac6('0x2d')],qs[_0x2ac6('0x33')](_0x536e45[_0x2ac6('0x2e')]['fields']));_0x1ac0b2['attributes']=_0x1ac0b2[_0x2ac6('0x32')]['length']?_0x1ac0b2[_0x2ac6('0x32')]:_0x47aeae[_0x2ac6('0x2d')];if(_0x536e45['query']['includeAll']){_0x1ac0b2[_0x2ac6('0x3f')]=[{'all':!![]}];}_0x1ac0b2=_['merge']({},_0x1ac0b2,_0x536e45[_0x2ac6('0x47')]);return db[_0x2ac6('0x28')][_0x2ac6('0x48')](_0x1ac0b2)[_0x2ac6('0x22')](handleEntityNotFound(_0x1ddd29,null))[_0x2ac6('0x22')](respondWithResult(_0x1ddd29,null))[_0x2ac6('0x49')](handleError(_0x1ddd29,null));};exports[_0x2ac6('0x4a')]=function(_0x20522e,_0x226114){return db[_0x2ac6('0x28')]['create'](_0x20522e['body'],{})['then'](respondWithResult(_0x226114,0xc9))[_0x2ac6('0x49')](handleError(_0x226114,null));};exports[_0x2ac6('0x21')]=function(_0x5c6a1e,_0x44f647){return db[_0x2ac6('0x28')][_0x2ac6('0x48')]({'where':{'id':_0x5c6a1e['params']['id']}})['then'](handleEntityNotFound(_0x44f647,null))[_0x2ac6('0x22')](removeEntity(_0x44f647,null))[_0x2ac6('0x49')](handleError(_0x44f647,null));};exports[_0x2ac6('0x4b')]=function(_0x233301,_0x21aeed){return db[_0x2ac6('0x28')][_0x2ac6('0x4b')]()[_0x2ac6('0x22')](respondWithResult(_0x21aeed,null))[_0x2ac6('0x49')](handleError(_0x21aeed,null));};exports['update']=function(_0x421954,_0x2ef7fa){if(_0x421954[_0x2ac6('0x4c')][_0x2ac6('0x4d')]){delete _0x421954['body'][_0x2ac6('0x4d')];}return db[_0x2ac6('0x28')][_0x2ac6('0x48')]({'where':{'uniqueid':_0x421954['params']['id'],'UserId':{'$or':[null,_0x421954[_0x2ac6('0x4e')]['id']]}}})[_0x2ac6('0x22')](handleEntityNotFound(_0x2ef7fa,null))['then'](saveUpdates(_0x421954[_0x2ac6('0x4c')],null))[_0x2ac6('0x22')](respondWithResult(_0x2ef7fa,null))[_0x2ac6('0x49')](handleError(_0x2ef7fa,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index fa622fc..2db2c0f 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 _0x2612=['exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2612,0x12f));var _0x2261=function(_0x5ef694,_0x2823a3){_0x5ef694=_0x5ef694-0x0;var _0x2ce7a6=_0x2612[_0x5ef694];return _0x2ce7a6;};'use strict';var _=require(_0x2261('0x0'));var util=require(_0x2261('0x1'));var logger=require(_0x2261('0x2'))(_0x2261('0x3'));var moment=require('moment');var BPromise=require(_0x2261('0x4'));var rp=require(_0x2261('0x5'));var fs=require('fs');var path=require(_0x2261('0x6'));var rimraf=require('rimraf');var config=require(_0x2261('0x7'));var attributes=require(_0x2261('0x8'));module[_0x2261('0x9')]=function(_0x7f553c,_0xc5bec7){return _0x7f553c[_0x2261('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x2261('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4919=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util'];(function(_0x2dace4,_0x446652){var _0x26d70c=function(_0xc2d24c){while(--_0xc2d24c){_0x2dace4['push'](_0x2dace4['shift']());}};_0x26d70c(++_0x446652);}(_0x4919,0x94));var _0x9491=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x4919[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x9491('0x0'));var util=require(_0x9491('0x1'));var logger=require(_0x9491('0x2'))(_0x9491('0x3'));var moment=require('moment');var BPromise=require(_0x9491('0x4'));var rp=require(_0x9491('0x5'));var fs=require('fs');var path=require(_0x9491('0x6'));var rimraf=require(_0x9491('0x7'));var config=require(_0x9491('0x8'));var attributes=require(_0x9491('0x9'));module[_0x9491('0xa')]=function(_0x3a74e3,_0x578a44){return _0x3a74e3[_0x9491('0xb')](_0x9491('0xc'),attributes,{'tableName':_0x9491('0xd'),'paranoid':![],'indexes':[{'fields':[_0x9491('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 0fedf25..b9344cc 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 _0x7967=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','stringify','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x239fb0,_0xf9ce4f){var _0x2d2ad7=function(_0x559fe8){while(--_0x559fe8){_0x239fb0['push'](_0x239fb0['shift']());}};_0x2d2ad7(++_0xf9ce4f);}(_0x7967,0x175));var _0x7796=function(_0x17467b,_0x5e9b47){_0x17467b=_0x17467b-0x0;var _0x3a3108=_0x7967[_0x17467b];return _0x3a3108;};'use strict';var _=require(_0x7796('0x0'));var util=require(_0x7796('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7796('0x2'));var fs=require('fs');var Redis=require(_0x7796('0x3'));var db=require(_0x7796('0x4'))['db'];var utils=require(_0x7796('0x5'));var logger=require(_0x7796('0x6'))(_0x7796('0x7'));var config=require(_0x7796('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7796('0x9')][_0x7796('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb2ef01,_0xe4d0ed,_0xbd18fa){return new BPromise(function(_0xf30810,_0x413871){return client[_0x7796('0xb')](_0xb2ef01,_0xbd18fa)[_0x7796('0xc')](function(_0x527896){logger[_0x7796('0xd')](_0x7796('0xe'),_0xe4d0ed,_0x7796('0xf'));logger[_0x7796('0x10')](_0x7796('0x11'),_0xe4d0ed,_0x7796('0xf'),JSON['stringify'](_0x527896));if(_0x527896[_0x7796('0x12')]){if(_0x527896[_0x7796('0x12')][_0x7796('0x13')]===0x1f4){logger['error'](_0x7796('0xe'),_0xe4d0ed,_0x527896[_0x7796('0x12')][_0x7796('0x14')]);return _0x413871(_0x527896[_0x7796('0x12')][_0x7796('0x14')]);}logger[_0x7796('0x12')](_0x7796('0xe'),_0xe4d0ed,_0x527896[_0x7796('0x12')][_0x7796('0x14')]);return _0xf30810(_0x527896['error'][_0x7796('0x14')]);}else{logger[_0x7796('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0xe4d0ed,_0x7796('0xf'));_0xf30810(_0x527896[_0x7796('0x15')][_0x7796('0x14')]);}})[_0x7796('0x16')](function(_0x37f055){logger[_0x7796('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0xe4d0ed,_0x37f055);_0x413871(_0x37f055);});});}exports[_0x7796('0x17')]=function(_0x5de994){var _0x2a7ecc=this;return new Promise(function(_0x2efc53,_0x36496c){return db[_0x7796('0x18')][_0x7796('0x19')]({'raw':_0x5de994['options']?_0x5de994[_0x7796('0x1a')][_0x7796('0x1b')]===undefined?!![]:![]:!![],'where':_0x5de994['options']?_0x5de994['options']['where']||null:null,'attributes':_0x5de994[_0x7796('0x1a')]?_0x5de994[_0x7796('0x1a')][_0x7796('0x1c')]||null:null,'limit':_0x5de994[_0x7796('0x1a')]?_0x5de994[_0x7796('0x1a')][_0x7796('0x1d')]||null:null,'include':_0x5de994[_0x7796('0x1a')]?_0x5de994['options'][_0x7796('0x1e')]?_[_0x7796('0x1f')](_0x5de994[_0x7796('0x1a')][_0x7796('0x1e')],function(_0x4293fd){return{'model':db[_0x4293fd[_0x7796('0x20')]],'as':_0x4293fd['as'],'attributes':_0x4293fd[_0x7796('0x1c')],'include':_0x4293fd[_0x7796('0x1e')]?_[_0x7796('0x1f')](_0x4293fd[_0x7796('0x1e')],function(_0xc2354e){return{'model':db[_0xc2354e['model']],'as':_0xc2354e['as'],'attributes':_0xc2354e[_0x7796('0x1c')],'include':_0xc2354e['include']?_[_0x7796('0x1f')](_0xc2354e['include'],function(_0x35a709){return{'model':db[_0x35a709[_0x7796('0x20')]],'as':_0x35a709['as'],'attributes':_0x35a709['attributes']};}):[]};}):[]};}):[]:[]})[_0x7796('0xc')](function(_0x11404f){logger[_0x7796('0xd')](_0x7796('0x17'),_0x5de994);logger[_0x7796('0x10')](_0x7796('0x17'),_0x5de994,JSON[_0x7796('0x21')](_0x11404f));_0x2efc53(_0x11404f);})[_0x7796('0x16')](function(_0xa5fecc){logger[_0x7796('0x12')](_0x7796('0x17'),_0xa5fecc['message'],_0x5de994);_0x36496c(_0x2a7ecc[_0x7796('0x12')](0x1f4,_0xa5fecc[_0x7796('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x1bdf6c){var _0x20b042=this;return new Promise(function(_0x4c1ce4,_0x92c2ba){return db[_0x7796('0x18')][_0x7796('0x22')](_0x1bdf6c[_0x7796('0x23')],{'raw':_0x1bdf6c['options']?_0x1bdf6c[_0x7796('0x1a')][_0x7796('0x1b')]===undefined?!![]:![]:!![]})[_0x7796('0xc')](function(_0x591892){logger[_0x7796('0xd')](_0x7796('0x24'),_0x1bdf6c);logger[_0x7796('0x10')](_0x7796('0x24'),_0x1bdf6c,JSON[_0x7796('0x21')](_0x591892));_0x4c1ce4(_0x591892);})['catch'](function(_0x1f479a){logger[_0x7796('0x12')]('CreateVoiceCallReport',_0x1f479a['message'],_0x1bdf6c);_0x92c2ba(_0x20b042[_0x7796('0x12')](0x1f4,_0x1f479a[_0x7796('0x14')]));});});};exports[_0x7796('0x25')]=function(_0x3e7caf){var _0x49e068=this;return new Promise(function(_0x4e7dfb,_0x228dbc){return db[_0x7796('0x18')]['update'](_0x3e7caf[_0x7796('0x23')],{'raw':_0x3e7caf['options']?_0x3e7caf[_0x7796('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e7caf[_0x7796('0x1a')]?_0x3e7caf['options'][_0x7796('0x26')]||null:null,'attributes':_0x3e7caf[_0x7796('0x1a')]?_0x3e7caf[_0x7796('0x1a')][_0x7796('0x1c')]||null:null,'limit':_0x3e7caf[_0x7796('0x1a')]?_0x3e7caf[_0x7796('0x1a')]['limit']||null:null})[_0x7796('0xc')](function(_0x3e07e0){logger[_0x7796('0xd')]('UpdateVoiceCallReport',_0x3e7caf);logger[_0x7796('0x10')](_0x7796('0x25'),_0x3e7caf,JSON[_0x7796('0x21')](_0x3e07e0));_0x4e7dfb(_0x3e07e0);})['catch'](function(_0x45c759){logger['error'](_0x7796('0x25'),_0x45c759[_0x7796('0x14')],_0x3e7caf);_0x228dbc(_0x49e068['error'](0x1f4,_0x45c759[_0x7796('0x14')]));});});}; \ No newline at end of file +var _0x75b3=['limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','map','model','include','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where'];(function(_0x283fa5,_0x36998e){var _0x47b68e=function(_0xb02552){while(--_0xb02552){_0x283fa5['push'](_0x283fa5['shift']());}};_0x47b68e(++_0x36998e);}(_0x75b3,0x112));var _0x375b=function(_0xee3bc5,_0x3f4cab){_0xee3bc5=_0xee3bc5-0x0;var _0x1d9df3=_0x75b3[_0xee3bc5];return _0x1d9df3;};'use strict';var _=require(_0x375b('0x0'));var util=require('util');var moment=require(_0x375b('0x1'));var BPromise=require(_0x375b('0x2'));var rs=require(_0x375b('0x3'));var fs=require('fs');var Redis=require(_0x375b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x375b('0x5'));var logger=require(_0x375b('0x6'))(_0x375b('0x7'));var config=require(_0x375b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x375b('0x9')][_0x375b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44e275,_0x53d804,_0x2bd867){return new BPromise(function(_0x178376,_0x5d6c10){return client[_0x375b('0xb')](_0x44e275,_0x2bd867)[_0x375b('0xc')](function(_0x1b9769){logger[_0x375b('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x53d804,_0x375b('0xe'));logger[_0x375b('0xf')](_0x375b('0x10'),_0x53d804,'request\x20sent',JSON['stringify'](_0x1b9769));if(_0x1b9769['error']){if(_0x1b9769[_0x375b('0x11')]['code']===0x1f4){logger[_0x375b('0x11')](_0x375b('0x12'),_0x53d804,_0x1b9769[_0x375b('0x11')][_0x375b('0x13')]);return _0x5d6c10(_0x1b9769[_0x375b('0x11')][_0x375b('0x13')]);}logger[_0x375b('0x11')](_0x375b('0x12'),_0x53d804,_0x1b9769[_0x375b('0x11')][_0x375b('0x13')]);return _0x178376(_0x1b9769[_0x375b('0x11')]['message']);}else{logger[_0x375b('0xd')](_0x375b('0x12'),_0x53d804,'request\x20sent');_0x178376(_0x1b9769[_0x375b('0x14')][_0x375b('0x13')]);}})[_0x375b('0x15')](function(_0x358482){logger['error'](_0x375b('0x12'),_0x53d804,_0x358482);_0x5d6c10(_0x358482);});});}exports[_0x375b('0x16')]=function(_0x496f9f){var _0x5b9932=this;return new Promise(function(_0x4ce8f8,_0x682da4){return db[_0x375b('0x17')][_0x375b('0x18')]({'raw':_0x496f9f['options']?_0x496f9f[_0x375b('0x19')][_0x375b('0x1a')]===undefined?!![]:![]:!![],'where':_0x496f9f[_0x375b('0x19')]?_0x496f9f[_0x375b('0x19')]['where']||null:null,'attributes':_0x496f9f[_0x375b('0x19')]?_0x496f9f[_0x375b('0x19')][_0x375b('0x1b')]||null:null,'limit':_0x496f9f[_0x375b('0x19')]?_0x496f9f[_0x375b('0x19')]['limit']||null:null,'include':_0x496f9f['options']?_0x496f9f[_0x375b('0x19')]['include']?_[_0x375b('0x1c')](_0x496f9f[_0x375b('0x19')]['include'],function(_0x3bc6e7){return{'model':db[_0x3bc6e7[_0x375b('0x1d')]],'as':_0x3bc6e7['as'],'attributes':_0x3bc6e7[_0x375b('0x1b')],'include':_0x3bc6e7[_0x375b('0x1e')]?_[_0x375b('0x1c')](_0x3bc6e7['include'],function(_0x221568){return{'model':db[_0x221568[_0x375b('0x1d')]],'as':_0x221568['as'],'attributes':_0x221568['attributes'],'include':_0x221568[_0x375b('0x1e')]?_[_0x375b('0x1c')](_0x221568['include'],function(_0x20f74b){return{'model':db[_0x20f74b['model']],'as':_0x20f74b['as'],'attributes':_0x20f74b[_0x375b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x375b('0xc')](function(_0x15f0c7){logger[_0x375b('0xd')](_0x375b('0x16'),_0x496f9f);logger['debug'](_0x375b('0x16'),_0x496f9f,JSON[_0x375b('0x1f')](_0x15f0c7));_0x4ce8f8(_0x15f0c7);})[_0x375b('0x15')](function(_0x49dc91){logger[_0x375b('0x11')](_0x375b('0x16'),_0x49dc91['message'],_0x496f9f);_0x682da4(_0x5b9932[_0x375b('0x11')](0x1f4,_0x49dc91['message']));});});};exports[_0x375b('0x20')]=function(_0x243d89){var _0xa3d6fe=this;return new Promise(function(_0x2f4304,_0x2c1a06){return db['VoiceCallReport'][_0x375b('0x21')](_0x243d89[_0x375b('0x22')],{'raw':_0x243d89[_0x375b('0x19')]?_0x243d89[_0x375b('0x19')][_0x375b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a0ec3){logger[_0x375b('0xd')](_0x375b('0x20'),_0x243d89);logger['debug'](_0x375b('0x20'),_0x243d89,JSON[_0x375b('0x1f')](_0x4a0ec3));_0x2f4304(_0x4a0ec3);})['catch'](function(_0x1f21c4){logger[_0x375b('0x11')](_0x375b('0x20'),_0x1f21c4[_0x375b('0x13')],_0x243d89);_0x2c1a06(_0xa3d6fe[_0x375b('0x11')](0x1f4,_0x1f21c4[_0x375b('0x13')]));});});};exports[_0x375b('0x23')]=function(_0x584217){var _0x942768=this;return new Promise(function(_0x569fe2,_0x2b89f4){return db[_0x375b('0x17')][_0x375b('0x24')](_0x584217['body'],{'raw':_0x584217[_0x375b('0x19')]?_0x584217[_0x375b('0x19')][_0x375b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x584217['options']?_0x584217[_0x375b('0x19')][_0x375b('0x25')]||null:null,'attributes':_0x584217['options']?_0x584217[_0x375b('0x19')][_0x375b('0x1b')]||null:null,'limit':_0x584217[_0x375b('0x19')]?_0x584217[_0x375b('0x19')][_0x375b('0x26')]||null:null})[_0x375b('0xc')](function(_0x53335a){logger[_0x375b('0xd')](_0x375b('0x23'),_0x584217);logger[_0x375b('0xf')](_0x375b('0x23'),_0x584217,JSON[_0x375b('0x1f')](_0x53335a));_0x569fe2(_0x53335a);})[_0x375b('0x15')](function(_0x34e03d){logger[_0x375b('0x11')](_0x375b('0x23'),_0x34e03d[_0x375b('0x13')],_0x584217);_0x2b89f4(_0x942768[_0x375b('0x11')](0x1f4,_0x34e03d[_0x375b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0e886e6..bdce9ff 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 _0xcdcb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','update','delete','exports','multer','util','path'];(function(_0x218376,_0x4db958){var _0x428b8f=function(_0x4390b7){while(--_0x4390b7){_0x218376['push'](_0x218376['shift']());}};_0x428b8f(++_0x4db958);}(_0xcdcb,0xfd));var _0xbcdc=function(_0x39bad4,_0x4e849e){_0x39bad4=_0x39bad4-0x0;var _0xdb8684=_0xcdcb[_0x39bad4];return _0xdb8684;};'use strict';var multer=require(_0xbcdc('0x0'));var util=require(_0xbcdc('0x1'));var path=require(_0xbcdc('0x2'));var timeout=require(_0xbcdc('0x3'));var express=require('express');var router=express[_0xbcdc('0x4')]();var auth=require(_0xbcdc('0x5'));var interaction=require(_0xbcdc('0x6'));var config=require('../../config/environment');var controller=require(_0xbcdc('0x7'));router[_0xbcdc('0x8')]('/',auth[_0xbcdc('0x9')](),controller[_0xbcdc('0xa')]);router[_0xbcdc('0x8')](_0xbcdc('0xb'),auth[_0xbcdc('0x9')](),controller['show']);router[_0xbcdc('0xc')]('/',auth[_0xbcdc('0x9')](),controller['create']);router['put'](_0xbcdc('0xb'),auth[_0xbcdc('0x9')](),controller[_0xbcdc('0xd')]);router[_0xbcdc('0xe')](_0xbcdc('0xb'),auth[_0xbcdc('0x9')](),controller['destroy']);module[_0xbcdc('0xf')]=router; \ No newline at end of file +var _0x15ff=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x7a95d9,_0x102898){var _0x350273=function(_0x882ce7){while(--_0x882ce7){_0x7a95d9['push'](_0x7a95d9['shift']());}};_0x350273(++_0x102898);}(_0x15ff,0x74));var _0xf15f=function(_0x2a0733,_0x290d2b){_0x2a0733=_0x2a0733-0x0;var _0x15dc3b=_0x15ff[_0x2a0733];return _0x15dc3b;};'use strict';var multer=require(_0xf15f('0x0'));var util=require(_0xf15f('0x1'));var path=require('path');var timeout=require(_0xf15f('0x2'));var express=require('express');var router=express[_0xf15f('0x3')]();var auth=require(_0xf15f('0x4'));var interaction=require(_0xf15f('0x5'));var config=require(_0xf15f('0x6'));var controller=require(_0xf15f('0x7'));router[_0xf15f('0x8')]('/',auth['isAuthenticated'](),controller[_0xf15f('0x9')]);router['get'](_0xf15f('0xa'),auth[_0xf15f('0xb')](),controller[_0xf15f('0xc')]);router[_0xf15f('0xd')]('/',auth['isAuthenticated'](),controller[_0xf15f('0xe')]);router[_0xf15f('0xf')](_0xf15f('0xa'),auth['isAuthenticated'](),controller[_0xf15f('0x10')]);router[_0xf15f('0x11')]('/:id',auth[_0xf15f('0xb')](),controller[_0xf15f('0x12')]);module[_0xf15f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 16dc69b..be17740 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 _0x6208=['sequelize','exports','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x51ecf4,_0x36ca46){var _0x407d99=function(_0x9c20b4){while(--_0x9c20b4){_0x51ecf4['push'](_0x51ecf4['shift']());}};_0x407d99(++_0x36ca46);}(_0x6208,0xbd));var _0x8620=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x6208[_0x5ad190];return _0x518ed3;};'use strict';var Sequelize=require(_0x8620('0x0'));module[_0x8620('0x1')]={'name':{'type':Sequelize[_0x8620('0x2')]},'prefix':{'type':Sequelize[_0x8620('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x8620('0x2')],'set':function(_0x17cd75){this[_0x8620('0x3')](_0x8620('0x4'),_0x17cd75?_0x17cd75[_0x8620('0x5')](''):[]);},'get':function(){return this[_0x8620('0x6')](_0x8620('0x4'))?this[_0x8620('0x6')](_0x8620('0x4'))[_0x8620('0x7')](''):[];}},'auth':{'type':Sequelize[_0x8620('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x8620('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8620('0x2')]},'description':{'type':Sequelize[_0x8620('0x2')]}}; \ No newline at end of file +var _0xb318=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb318,0x64));var _0x8b31=function(_0x18dbd4,_0x41c749){_0x18dbd4=_0x18dbd4-0x0;var _0x67e874=_0xb318[_0x18dbd4];return _0x67e874;};'use strict';var Sequelize=require(_0x8b31('0x0'));module[_0x8b31('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x8b31('0x2')],'unique':_0x8b31('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x4a7ed1){this['setDataValue'](_0x8b31('0x4'),_0x4a7ed1?_0x4a7ed1['join'](''):[]);},'get':function(){return this['getDataValue'](_0x8b31('0x4'))?this[_0x8b31('0x5')]('options')[_0x8b31('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8b31('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x8b31('0x2')]},'record':{'type':Sequelize[_0x8b31('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8b31('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9ffb4a8..9b56f03 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 _0x476d=['attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','VoiceChanSpy','includeAll','include','rows','catch','show','params','keys','length','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','save','update','then','destroy','ChanSpies','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x476d,0xfa));var _0xd476=function(_0x3d635b,_0x1707bf){_0x3d635b=_0x3d635b-0x0;var _0x425917=_0x476d[_0x3d635b];return _0x425917;};'use strict';var pdf=require(_0xd476('0x0'));var emlformat=require(_0xd476('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd476('0x2'));var jsonpatch=require(_0xd476('0x3'));var rp=require('request-promise');var moment=require(_0xd476('0x4'));var BPromise=require(_0xd476('0x5'));var Mustache=require(_0xd476('0x6'));var util=require(_0xd476('0x7'));var path=require('path');var sox=require(_0xd476('0x8'));var csv=require(_0xd476('0x9'));var ejs=require(_0xd476('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd476('0xb'));var jsforce=require(_0xd476('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd476('0x9'));var querystring=require(_0xd476('0xd'));var Papa=require(_0xd476('0xe'));var Redis=require(_0xd476('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd476('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd476('0x11'));var logger=require(_0xd476('0x12'))('api');var utils=require(_0xd476('0x13'));var config=require(_0xd476('0x14'));var db=require(_0xd476('0x15'))['db'];function respondWithStatusCode(_0x51b397,_0x560fdf){_0x560fdf=_0x560fdf||0xcc;return function(_0x29c903){if(_0x29c903){return _0x51b397[_0xd476('0x16')](_0x560fdf);}return _0x51b397[_0xd476('0x17')](_0x560fdf)['end']();};}function respondWithResult(_0x305293,_0x4319bc){_0x4319bc=_0x4319bc||0xc8;return function(_0x3d58fb){if(_0x3d58fb){return _0x305293[_0xd476('0x17')](_0x4319bc)['json'](_0x3d58fb);}};}function respondWithFilteredResult(_0x256e64,_0x4e21d2){return function(_0x336232){if(_0x336232){var _0x5a89f0=_0x336232[_0xd476('0x18')],_0x6fcc18=_0x4e21d2['offset'],_0x5b60f0=_0x4e21d2[_0xd476('0x19')]+_0x4e21d2[_0xd476('0x1a')],_0x4b2afe;if(_0x5b60f0>=_0x5a89f0){_0x5b60f0=_0x5a89f0;_0x4b2afe=0xc8;}else{_0x4b2afe=0xce;}_0x256e64[_0xd476('0x17')](_0x4b2afe);return _0x256e64[_0xd476('0x1b')](_0xd476('0x1c'),_0x6fcc18+'-'+_0x5b60f0+'/'+_0x5a89f0)['json'](_0x336232);}return null;};}function patchUpdates(_0x530c76){return function(_0x1da1ea){try{jsonpatch['apply'](_0x1da1ea,_0x530c76,!![]);}catch(_0x340e89){return BPromise['reject'](_0x340e89);}return _0x1da1ea[_0xd476('0x1d')]();};}function saveUpdates(_0x14004f,_0x1e940c){return function(_0x208e63){if(_0x208e63){return _0x208e63[_0xd476('0x1e')](_0x14004f)[_0xd476('0x1f')](function(_0x101ebe){return _0x101ebe;});}return null;};}function removeEntity(_0xacf1ee,_0x4a0cc1){return function(_0xb534a7){if(_0xb534a7){return _0xb534a7[_0xd476('0x20')]()['then'](function(){var _0xb6531=_0xb534a7['get']({'plain':!![]});var _0x58c09e=_0xd476('0x21');return db[_0xd476('0x22')][_0xd476('0x20')]({'where':{'type':_0x58c09e,'resourceId':_0xb6531['id']}})[_0xd476('0x1f')](function(){return _0xb534a7;});})[_0xd476('0x1f')](function(){_0xacf1ee[_0xd476('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3beac9,_0x38fc4f){return function(_0x4f8852){if(!_0x4f8852){_0x3beac9[_0xd476('0x16')](0x194);}return _0x4f8852;};}function handleError(_0x2b657f,_0x57f0d9){_0x57f0d9=_0x57f0d9||0x1f4;return function(_0x47f626){logger[_0xd476('0x23')](_0x47f626['stack']);if(_0x47f626['name']){delete _0x47f626[_0xd476('0x24')];}_0x2b657f[_0xd476('0x17')](_0x57f0d9)['send'](_0x47f626);};}exports[_0xd476('0x25')]=function(_0xd4ed53,_0xc3a365){var _0x3e9a1e={},_0x1d4cf3={},_0x1c67ca={'count':0x0,'rows':[]};var _0x1197a5=_[_0xd476('0x26')](db['VoiceChanSpy'][_0xd476('0x27')],function(_0x43a3cc){return{'name':_0x43a3cc[_0xd476('0x28')],'type':_0x43a3cc[_0xd476('0x29')]['key']};});_0x1d4cf3[_0xd476('0x2a')]=_[_0xd476('0x26')](_0x1197a5,_0xd476('0x24'));_0x1d4cf3[_0xd476('0x2b')]=_['keys'](_0xd4ed53[_0xd476('0x2b')]);_0x1d4cf3[_0xd476('0x2c')]=_[_0xd476('0x2d')](_0x1d4cf3[_0xd476('0x2a')],_0x1d4cf3[_0xd476('0x2b')]);_0x3e9a1e[_0xd476('0x2e')]=_[_0xd476('0x2d')](_0x1d4cf3[_0xd476('0x2a')],qs[_0xd476('0x2f')](_0xd4ed53['query']['fields']));_0x3e9a1e['attributes']=_0x3e9a1e[_0xd476('0x2e')]['length']?_0x3e9a1e['attributes']:_0x1d4cf3['model'];if(!_0xd4ed53[_0xd476('0x2b')]['hasOwnProperty']('nolimit')){_0x3e9a1e[_0xd476('0x1a')]=qs[_0xd476('0x1a')](_0xd4ed53[_0xd476('0x2b')][_0xd476('0x1a')]);_0x3e9a1e['offset']=qs['offset'](_0xd4ed53['query']['offset']);}_0x3e9a1e[_0xd476('0x30')]=qs[_0xd476('0x31')](_0xd4ed53[_0xd476('0x2b')]['sort']);_0x3e9a1e[_0xd476('0x32')]=qs[_0xd476('0x2c')](_[_0xd476('0x33')](_0xd4ed53[_0xd476('0x2b')],_0x1d4cf3[_0xd476('0x2c')]),_0x1197a5);if(_0xd4ed53[_0xd476('0x2b')][_0xd476('0x34')]){_0x3e9a1e[_0xd476('0x32')]=_[_0xd476('0x35')](_0x3e9a1e[_0xd476('0x32')],{'$or':_[_0xd476('0x26')](_0x1197a5,function(_0xb276ff){if(_0xb276ff['type']!==_0xd476('0x36')){var _0x4e0b15={};_0x4e0b15[_0xb276ff['name']]={'$like':'%'+_0xd4ed53[_0xd476('0x2b')][_0xd476('0x34')]+'%'};return _0x4e0b15;}})});}_0x3e9a1e=_['merge']({},_0x3e9a1e,_0xd4ed53['options']);var _0x1ea560={'where':_0x3e9a1e[_0xd476('0x32')]};return db[_0xd476('0x37')][_0xd476('0x18')](_0x1ea560)[_0xd476('0x1f')](function(_0x11a483){_0x1c67ca['count']=_0x11a483;if(_0xd4ed53[_0xd476('0x2b')][_0xd476('0x38')]){_0x3e9a1e[_0xd476('0x39')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3e9a1e);})[_0xd476('0x1f')](function(_0x171e34){_0x1c67ca[_0xd476('0x3a')]=_0x171e34;return _0x1c67ca;})[_0xd476('0x1f')](respondWithFilteredResult(_0xc3a365,_0x3e9a1e))[_0xd476('0x3b')](handleError(_0xc3a365,null));};exports[_0xd476('0x3c')]=function(_0x1c384d,_0x176bfc){var _0x26cf06={'raw':![],'where':{'id':_0x1c384d[_0xd476('0x3d')]['id']}},_0x33287b={};_0x33287b[_0xd476('0x2a')]=_[_0xd476('0x3e')](db[_0xd476('0x37')]['rawAttributes']);_0x33287b[_0xd476('0x2b')]=_[_0xd476('0x3e')](_0x1c384d[_0xd476('0x2b')]);_0x33287b[_0xd476('0x2c')]=_[_0xd476('0x2d')](_0x33287b[_0xd476('0x2a')],_0x33287b['query']);_0x26cf06[_0xd476('0x2e')]=_[_0xd476('0x2d')](_0x33287b[_0xd476('0x2a')],qs[_0xd476('0x2f')](_0x1c384d['query']['fields']));_0x26cf06[_0xd476('0x2e')]=_0x26cf06['attributes'][_0xd476('0x3f')]?_0x26cf06[_0xd476('0x2e')]:_0x33287b[_0xd476('0x2a')];if(_0x1c384d['query'][_0xd476('0x38')]){_0x26cf06[_0xd476('0x39')]=[{'all':!![]}];}_0x26cf06=_[_0xd476('0x35')]({},_0x26cf06,_0x1c384d[_0xd476('0x40')]);return db['VoiceChanSpy']['find'](_0x26cf06)[_0xd476('0x1f')](handleEntityNotFound(_0x176bfc,null))[_0xd476('0x1f')](respondWithResult(_0x176bfc,null))[_0xd476('0x3b')](handleError(_0x176bfc,null));};exports[_0xd476('0x41')]=function(_0x3f7be5,_0x262362){return db[_0xd476('0x37')][_0xd476('0x41')](_0x3f7be5[_0xd476('0x42')],{})[_0xd476('0x1f')](function(_0x5b469a){var _0x4ecb73=_0x3f7be5[_0xd476('0x43')]['get']({'plain':!![]});if(!_0x4ecb73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ecb73[_0xd476('0x44')]==='user'){var _0xf49f=_0x5b469a['get']({'plain':!![]});var _0x782412=_0xd476('0x21');return db[_0xd476('0x45')][_0xd476('0x46')]({'where':{'name':_0x782412,'userProfileId':_0x4ecb73[_0xd476('0x47')]},'raw':!![]})[_0xd476('0x1f')](function(_0x1a465c){if(_0x1a465c&&_0x1a465c[_0xd476('0x48')]===0x0){return db['UserProfileResource'][_0xd476('0x41')]({'name':_0xf49f[_0xd476('0x24')],'resourceId':_0xf49f['id'],'type':_0x1a465c['name'],'sectionId':_0x1a465c['id']},{})['then'](function(){return _0x5b469a;});}else{return _0x5b469a;}})['catch'](function(_0x4553c5){logger[_0xd476('0x23')](_0xd476('0x49'),_0x4553c5);throw _0x4553c5;});}return _0x5b469a;})['then'](respondWithResult(_0x262362,0xc9))['catch'](handleError(_0x262362,null));};exports[_0xd476('0x1e')]=function(_0x1fb642,_0x51f8d1){if(_0x1fb642[_0xd476('0x42')]['id']){delete _0x1fb642['body']['id'];}return db[_0xd476('0x37')]['find']({'where':{'id':_0x1fb642[_0xd476('0x3d')]['id']}})[_0xd476('0x1f')](handleEntityNotFound(_0x51f8d1,null))['then'](saveUpdates(_0x1fb642[_0xd476('0x42')],null))[_0xd476('0x1f')](respondWithResult(_0x51f8d1,null))[_0xd476('0x3b')](handleError(_0x51f8d1,null));};exports[_0xd476('0x20')]=function(_0x49df3e,_0x20ea5e){return db[_0xd476('0x37')][_0xd476('0x46')]({'where':{'id':_0x49df3e[_0xd476('0x3d')]['id']}})[_0xd476('0x1f')](handleEntityNotFound(_0x20ea5e,null))[_0xd476('0x1f')](removeEntity(_0x20ea5e,null))[_0xd476('0x3b')](handleError(_0x20ea5e,null));}; \ No newline at end of file +var _0x5a1c=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','include','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','VoiceChanSpy','fieldName','type','model','map','query','keys'];(function(_0x4455a2,_0x1e25d6){var _0x394da1=function(_0x1cdfdf){while(--_0x1cdfdf){_0x4455a2['push'](_0x4455a2['shift']());}};_0x394da1(++_0x1e25d6);}(_0x5a1c,0x1ac));var _0xc5a1=function(_0x1410f7,_0x882704){_0x1410f7=_0x1410f7-0x0;var _0xe66e17=_0x5a1c[_0x1410f7];return _0xe66e17;};'use strict';var pdf=require(_0xc5a1('0x0'));var emlformat=require(_0xc5a1('0x1'));var rimraf=require(_0xc5a1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a1('0x3'));var rp=require(_0xc5a1('0x4'));var moment=require(_0xc5a1('0x5'));var BPromise=require(_0xc5a1('0x6'));var Mustache=require(_0xc5a1('0x7'));var util=require(_0xc5a1('0x8'));var path=require(_0xc5a1('0x9'));var sox=require('sox');var csv=require(_0xc5a1('0xa'));var ejs=require(_0xc5a1('0xb'));var fs=require('fs');var _=require(_0xc5a1('0xc'));var squel=require(_0xc5a1('0xd'));var crypto=require(_0xc5a1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc5a1('0xf'));var toCsv=require(_0xc5a1('0xa'));var querystring=require(_0xc5a1('0x10'));var Papa=require(_0xc5a1('0x11'));var Redis=require(_0xc5a1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5a1('0x14'))(_0xc5a1('0x15'));var utils=require(_0xc5a1('0x16'));var config=require(_0xc5a1('0x17'));var db=require(_0xc5a1('0x18'))['db'];function respondWithStatusCode(_0x3ab9c8,_0xe8e701){_0xe8e701=_0xe8e701||0xcc;return function(_0x3ec927){if(_0x3ec927){return _0x3ab9c8[_0xc5a1('0x19')](_0xe8e701);}return _0x3ab9c8[_0xc5a1('0x1a')](_0xe8e701)['end']();};}function respondWithResult(_0x555d99,_0x5a5070){_0x5a5070=_0x5a5070||0xc8;return function(_0x29a5d5){if(_0x29a5d5){return _0x555d99[_0xc5a1('0x1a')](_0x5a5070)[_0xc5a1('0x1b')](_0x29a5d5);}};}function respondWithFilteredResult(_0x28ebc5,_0x128284){return function(_0x118dcc){if(_0x118dcc){var _0x628387=_0x118dcc[_0xc5a1('0x1c')],_0x4911bf=_0x128284[_0xc5a1('0x1d')],_0x42d76b=_0x128284['offset']+_0x128284[_0xc5a1('0x1e')],_0x163e59;if(_0x42d76b>=_0x628387){_0x42d76b=_0x628387;_0x163e59=0xc8;}else{_0x163e59=0xce;}_0x28ebc5[_0xc5a1('0x1a')](_0x163e59);return _0x28ebc5[_0xc5a1('0x1f')]('Content-Range',_0x4911bf+'-'+_0x42d76b+'/'+_0x628387)[_0xc5a1('0x1b')](_0x118dcc);}return null;};}function patchUpdates(_0x4b3531){return function(_0xe3c133){try{jsonpatch[_0xc5a1('0x20')](_0xe3c133,_0x4b3531,!![]);}catch(_0xd676e5){return BPromise[_0xc5a1('0x21')](_0xd676e5);}return _0xe3c133[_0xc5a1('0x22')]();};}function saveUpdates(_0xad9d59,_0x2c0cc2){return function(_0x1173b0){if(_0x1173b0){return _0x1173b0[_0xc5a1('0x23')](_0xad9d59)[_0xc5a1('0x24')](function(_0x41d09c){return _0x41d09c;});}return null;};}function removeEntity(_0x3866be,_0x38d650){return function(_0x17e215){if(_0x17e215){return _0x17e215['destroy']()['then'](function(){var _0x4f0299=_0x17e215[_0xc5a1('0x25')]({'plain':!![]});var _0x4333bd='ChanSpies';return db[_0xc5a1('0x26')][_0xc5a1('0x27')]({'where':{'type':_0x4333bd,'resourceId':_0x4f0299['id']}})[_0xc5a1('0x24')](function(){return _0x17e215;});})[_0xc5a1('0x24')](function(){_0x3866be[_0xc5a1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587ab5,_0x40be71){return function(_0x4ac0a0){if(!_0x4ac0a0){_0x587ab5['sendStatus'](0x194);}return _0x4ac0a0;};}function handleError(_0x236c50,_0x4b3580){_0x4b3580=_0x4b3580||0x1f4;return function(_0x176ab0){logger[_0xc5a1('0x28')](_0x176ab0[_0xc5a1('0x29')]);if(_0x176ab0[_0xc5a1('0x2a')]){delete _0x176ab0[_0xc5a1('0x2a')];}_0x236c50[_0xc5a1('0x1a')](_0x4b3580)[_0xc5a1('0x2b')](_0x176ab0);};}exports[_0xc5a1('0x2c')]=function(_0x4d34ed,_0x46426c){var _0xd66657={},_0x4b40c3={},_0x163df5={'count':0x0,'rows':[]};var _0x50a5a1=_['map'](db[_0xc5a1('0x2d')]['rawAttributes'],function(_0x5e78f5){return{'name':_0x5e78f5[_0xc5a1('0x2e')],'type':_0x5e78f5[_0xc5a1('0x2f')]['key']};});_0x4b40c3[_0xc5a1('0x30')]=_[_0xc5a1('0x31')](_0x50a5a1,_0xc5a1('0x2a'));_0x4b40c3[_0xc5a1('0x32')]=_[_0xc5a1('0x33')](_0x4d34ed[_0xc5a1('0x32')]);_0x4b40c3['filters']=_[_0xc5a1('0x34')](_0x4b40c3[_0xc5a1('0x30')],_0x4b40c3[_0xc5a1('0x32')]);_0xd66657['attributes']=_[_0xc5a1('0x34')](_0x4b40c3['model'],qs[_0xc5a1('0x35')](_0x4d34ed[_0xc5a1('0x32')][_0xc5a1('0x35')]));_0xd66657[_0xc5a1('0x36')]=_0xd66657[_0xc5a1('0x36')][_0xc5a1('0x37')]?_0xd66657[_0xc5a1('0x36')]:_0x4b40c3[_0xc5a1('0x30')];if(!_0x4d34ed[_0xc5a1('0x32')][_0xc5a1('0x38')]('nolimit')){_0xd66657[_0xc5a1('0x1e')]=qs[_0xc5a1('0x1e')](_0x4d34ed[_0xc5a1('0x32')]['limit']);_0xd66657[_0xc5a1('0x1d')]=qs['offset'](_0x4d34ed[_0xc5a1('0x32')][_0xc5a1('0x1d')]);}_0xd66657[_0xc5a1('0x39')]=qs['sort'](_0x4d34ed[_0xc5a1('0x32')][_0xc5a1('0x3a')]);_0xd66657[_0xc5a1('0x3b')]=qs['filters'](_['pick'](_0x4d34ed[_0xc5a1('0x32')],_0x4b40c3[_0xc5a1('0x3c')]),_0x50a5a1);if(_0x4d34ed[_0xc5a1('0x32')][_0xc5a1('0x3d')]){_0xd66657[_0xc5a1('0x3b')]=_[_0xc5a1('0x3e')](_0xd66657[_0xc5a1('0x3b')],{'$or':_['map'](_0x50a5a1,function(_0x176096){if(_0x176096[_0xc5a1('0x2f')]!=='VIRTUAL'){var _0x4b7308={};_0x4b7308[_0x176096['name']]={'$like':'%'+_0x4d34ed[_0xc5a1('0x32')]['filter']+'%'};return _0x4b7308;}})});}_0xd66657=_['merge']({},_0xd66657,_0x4d34ed['options']);var _0x4ac7ea={'where':_0xd66657[_0xc5a1('0x3b')]};return db['VoiceChanSpy'][_0xc5a1('0x1c')](_0x4ac7ea)['then'](function(_0x10078f){_0x163df5[_0xc5a1('0x1c')]=_0x10078f;if(_0x4d34ed[_0xc5a1('0x32')]['includeAll']){_0xd66657[_0xc5a1('0x3f')]=[{'all':!![]}];}return db[_0xc5a1('0x2d')]['findAll'](_0xd66657);})[_0xc5a1('0x24')](function(_0x3b7160){_0x163df5[_0xc5a1('0x40')]=_0x3b7160;return _0x163df5;})[_0xc5a1('0x24')](respondWithFilteredResult(_0x46426c,_0xd66657))['catch'](handleError(_0x46426c,null));};exports[_0xc5a1('0x41')]=function(_0x19f5d4,_0x48f1df){var _0x1411f4={'raw':![],'where':{'id':_0x19f5d4[_0xc5a1('0x42')]['id']}},_0x2d72b9={};_0x2d72b9[_0xc5a1('0x30')]=_[_0xc5a1('0x33')](db['VoiceChanSpy'][_0xc5a1('0x43')]);_0x2d72b9['query']=_[_0xc5a1('0x33')](_0x19f5d4[_0xc5a1('0x32')]);_0x2d72b9[_0xc5a1('0x3c')]=_[_0xc5a1('0x34')](_0x2d72b9[_0xc5a1('0x30')],_0x2d72b9[_0xc5a1('0x32')]);_0x1411f4[_0xc5a1('0x36')]=_[_0xc5a1('0x34')](_0x2d72b9[_0xc5a1('0x30')],qs['fields'](_0x19f5d4['query'][_0xc5a1('0x35')]));_0x1411f4[_0xc5a1('0x36')]=_0x1411f4[_0xc5a1('0x36')]['length']?_0x1411f4[_0xc5a1('0x36')]:_0x2d72b9[_0xc5a1('0x30')];if(_0x19f5d4[_0xc5a1('0x32')]['includeAll']){_0x1411f4[_0xc5a1('0x3f')]=[{'all':!![]}];}_0x1411f4=_[_0xc5a1('0x3e')]({},_0x1411f4,_0x19f5d4['options']);return db[_0xc5a1('0x2d')][_0xc5a1('0x44')](_0x1411f4)[_0xc5a1('0x24')](handleEntityNotFound(_0x48f1df,null))[_0xc5a1('0x24')](respondWithResult(_0x48f1df,null))['catch'](handleError(_0x48f1df,null));};exports[_0xc5a1('0x45')]=function(_0x1a7ca7,_0xea4bf7){return db['VoiceChanSpy']['create'](_0x1a7ca7[_0xc5a1('0x46')],{})[_0xc5a1('0x24')](function(_0x2af933){var _0x433d05=_0x1a7ca7[_0xc5a1('0x47')]['get']({'plain':!![]});if(!_0x433d05)throw new Error(_0xc5a1('0x48'));if(_0x433d05[_0xc5a1('0x49')]==='user'){var _0x45144e=_0x2af933[_0xc5a1('0x25')]({'plain':!![]});var _0x133daf=_0xc5a1('0x4a');return db[_0xc5a1('0x4b')][_0xc5a1('0x44')]({'where':{'name':_0x133daf,'userProfileId':_0x433d05[_0xc5a1('0x4c')]},'raw':!![]})[_0xc5a1('0x24')](function(_0x277a0f){if(_0x277a0f&&_0x277a0f[_0xc5a1('0x4d')]===0x0){return db[_0xc5a1('0x26')]['create']({'name':_0x45144e[_0xc5a1('0x2a')],'resourceId':_0x45144e['id'],'type':_0x277a0f[_0xc5a1('0x2a')],'sectionId':_0x277a0f['id']},{})['then'](function(){return _0x2af933;});}else{return _0x2af933;}})[_0xc5a1('0x4e')](function(_0x45c5e3){logger['error'](_0xc5a1('0x4f'),_0x45c5e3);throw _0x45c5e3;});}return _0x2af933;})[_0xc5a1('0x24')](respondWithResult(_0xea4bf7,0xc9))[_0xc5a1('0x4e')](handleError(_0xea4bf7,null));};exports[_0xc5a1('0x23')]=function(_0x640c,_0x274977){if(_0x640c[_0xc5a1('0x46')]['id']){delete _0x640c['body']['id'];}return db[_0xc5a1('0x2d')][_0xc5a1('0x44')]({'where':{'id':_0x640c[_0xc5a1('0x42')]['id']}})[_0xc5a1('0x24')](handleEntityNotFound(_0x274977,null))['then'](saveUpdates(_0x640c[_0xc5a1('0x46')],null))['then'](respondWithResult(_0x274977,null))[_0xc5a1('0x4e')](handleError(_0x274977,null));};exports[_0xc5a1('0x27')]=function(_0x4afcdc,_0x12f910){return db[_0xc5a1('0x2d')]['find']({'where':{'id':_0x4afcdc['params']['id']}})[_0xc5a1('0x24')](handleEntityNotFound(_0x12f910,null))[_0xc5a1('0x24')](removeEntity(_0x12f910,null))['catch'](handleError(_0x12f910,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e709ff9..279f28e 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 _0xf681=['CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','agent','catch','exports','models','define','VoiceChanSpy','then','VoiceExtension','destroy','bulkCreate','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','push','merge','Set'];(function(_0x4d19b0,_0x37eb76){var _0x3e896b=function(_0x3f1a6f){while(--_0x3f1a6f){_0x4d19b0['push'](_0x4d19b0['shift']());}};_0x3e896b(++_0x37eb76);}(_0xf681,0xc9));var _0x1f68=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf681[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1f68('0x0'));var BPromise=require(_0x1f68('0x1'));var attributes=require(_0x1f68('0x2'));var getUserApplications=function(_0x2cb4fb,_0x56d4f7,_0x3f265a){var _0x4b0db4=0x1;var _0x8bf4eb=[];var _0xdea373={'context':_0x56d4f7['context']||_0x1f68('0x3'),'exten':util[_0x1f68('0x4')](_0x1f68('0x5'),_0x2cb4fb['prefix'],_0x3f265a),'type':'system','isApp':![],'ChanSpyId':_0x2cb4fb['id'],'UserId':_0x56d4f7['id']};_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0x8'),'appdata':util['format'](_0x1f68('0x9'),_0x1f68('0xa')),'priority':_0x4b0db4++},_0xdea373));if(_0x2cb4fb[_0x1f68('0xb')]){_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0xc'),'appdata':util[_0x1f68('0x4')](_0x1f68('0xd'),_0x2cb4fb['recordingFormat']),'priority':_0x4b0db4++},_0xdea373));}if(_0x2cb4fb[_0x1f68('0xe')]){_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0xf'),'appdata':_0x2cb4fb[_0x1f68('0x10')],'priority':_0x4b0db4++},_0xdea373));}_0x8bf4eb['push'](_[_0x1f68('0x7')]({'app':_0x1f68('0x11'),'appdata':util[_0x1f68('0x4')](_0x1f68('0x12'),_0x56d4f7[_0x1f68('0x13')],_0x2cb4fb[_0x1f68('0x14')]?_0x2cb4fb[_0x1f68('0x14')][_0x1f68('0x15')](''):''),'priority':_0x4b0db4++},_0xdea373));if(_0x2cb4fb[_0x1f68('0xb')]){_0x8bf4eb[_0x1f68('0x6')](_['merge']({'app':'StopMixMonitor','priority':_0x4b0db4++},_0xdea373));}return _0x8bf4eb;};var getChanSpyApplications=function(_0x1c8ba1,_0x30a60e){var _0x65c1f7=[];for(var _0x708c7c=0x0,_0x2a0b61=0x1;_0x708c7c<_0x30a60e[_0x1f68('0x16')];_0x708c7c++,_0x2a0b61=0x1){_0x65c1f7=_0x65c1f7[_0x1f68('0x17')](getUserApplications(_0x1c8ba1,_0x30a60e[_0x708c7c],_0x30a60e[_0x708c7c]['internal']));if(_0x30a60e[_0x708c7c]['internal']!=_0x30a60e[_0x708c7c][_0x1f68('0x13')]){_0x65c1f7=_0x65c1f7[_0x1f68('0x17')](getUserApplications(_0x1c8ba1,_0x30a60e[_0x708c7c],_0x30a60e[_0x708c7c]['name']));}}return _0x65c1f7;};var getChanSpyPromise=function(_0x5ecac4,_0x5e3979){return new BPromise(function(_0x597731,_0x24d5e8){return _0x5ecac4['User']['findAll']({'attributes':['id',_0x1f68('0x13'),_0x1f68('0x18')],'where':{'role':_0x1f68('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x35b8ea){if(_0x35b8ea){return _0x597731(getChanSpyApplications(_0x5e3979,_0x35b8ea));}return _0x597731([]);})[_0x1f68('0x1a')](function(_0x94d000){_0x24d5e8(_0x94d000);});});};module[_0x1f68('0x1b')]=function(_0x16d895,_0x182a35){var _0x5d888d=_0x16d895[_0x1f68('0x1c')];return _0x16d895[_0x1f68('0x1d')](_0x1f68('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31dba6,_0x5e9c12,_0x59b461){return getChanSpyPromise(_0x5d888d,_0x31dba6)[_0x1f68('0x1f')](function(_0xdb5be5){if(_0xdb5be5&&_0xdb5be5['length']){return _0x5d888d[_0x1f68('0x20')]['bulkCreate'](_0xdb5be5);}})[_0x1f68('0x1f')](function(){_0x59b461();})['catch'](function(_0x57bf30){_0x59b461(_0x57bf30);});},'afterUpdate':function(_0x13cdce,_0xde6430,_0x2ce93f){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x21')]({'where':{'ChanSpyId':_0x13cdce['id']}})['then'](function(){return getChanSpyPromise(_0x5d888d,_0x13cdce);})[_0x1f68('0x1f')](function(_0x2b5e22){if(_0x2b5e22&&_0x2b5e22[_0x1f68('0x16')]){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x22')](_0x2b5e22);}})['then'](function(){_0x2ce93f();})['catch'](function(_0x37534f){_0x2ce93f(_0x37534f);});},'afterDestroy':function(_0x403109,_0x3ad261,_0x4ad1f3){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x21')]({'where':{'ChanSpyId':_0x403109['id']}})[_0x1f68('0x1f')](function(){_0x4ad1f3();})[_0x1f68('0x1a')](function(_0x18f895){_0x4ad1f3(_0x18f895);});}}});}; \ No newline at end of file +var _0x5530=['format','CDR(type)=%s','chanspy','record','merge','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','length','concat','internal','findAll','agent','exports','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','catch','lodash','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push'];(function(_0x97674e,_0x562219){var _0x43fafb=function(_0x4d3366){while(--_0x4d3366){_0x97674e['push'](_0x97674e['shift']());}};_0x43fafb(++_0x562219);}(_0x5530,0xa7));var _0x0553=function(_0x15200e,_0x51b25e){_0x15200e=_0x15200e-0x0;var _0x4e70aa=_0x5530[_0x15200e];return _0x4e70aa;};'use strict';var _=require(_0x0553('0x0'));var util=require('util');var BPromise=require(_0x0553('0x1'));var attributes=require(_0x0553('0x2'));var getUserApplications=function(_0x19a5f3,_0x46b9db,_0x4e3aec){var _0x2c289e=0x1;var _0x5a6597=[];var _0x2368c3={'context':_0x46b9db['context']||_0x0553('0x3'),'exten':util['format'](_0x0553('0x4'),_0x19a5f3[_0x0553('0x5')],_0x4e3aec),'type':_0x0553('0x6'),'isApp':![],'ChanSpyId':_0x19a5f3['id'],'UserId':_0x46b9db['id']};_0x5a6597[_0x0553('0x7')](_['merge']({'app':'Set','appdata':util[_0x0553('0x8')](_0x0553('0x9'),_0x0553('0xa')),'priority':_0x2c289e++},_0x2368c3));if(_0x19a5f3[_0x0553('0xb')]){_0x5a6597[_0x0553('0x7')](_[_0x0553('0xc')]({'app':_0x0553('0xd'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x19a5f3[_0x0553('0xe')]),'priority':_0x2c289e++},_0x2368c3));}if(_0x19a5f3[_0x0553('0xf')]){_0x5a6597[_0x0553('0x7')](_[_0x0553('0xc')]({'app':_0x0553('0x10'),'appdata':_0x19a5f3[_0x0553('0x11')],'priority':_0x2c289e++},_0x2368c3));}_0x5a6597[_0x0553('0x7')](_[_0x0553('0xc')]({'app':_0x0553('0x12'),'appdata':util[_0x0553('0x8')]('SIP/%s,%s',_0x46b9db[_0x0553('0x13')],_0x19a5f3['options']?_0x19a5f3[_0x0553('0x14')][_0x0553('0x15')](''):''),'priority':_0x2c289e++},_0x2368c3));if(_0x19a5f3[_0x0553('0xb')]){_0x5a6597['push'](_[_0x0553('0xc')]({'app':'StopMixMonitor','priority':_0x2c289e++},_0x2368c3));}return _0x5a6597;};var getChanSpyApplications=function(_0x4a8506,_0x1a3863){var _0x46d6ba=[];for(var _0xce8d83=0x0,_0x268b98=0x1;_0xce8d83<_0x1a3863[_0x0553('0x16')];_0xce8d83++,_0x268b98=0x1){_0x46d6ba=_0x46d6ba[_0x0553('0x17')](getUserApplications(_0x4a8506,_0x1a3863[_0xce8d83],_0x1a3863[_0xce8d83][_0x0553('0x18')]));if(_0x1a3863[_0xce8d83]['internal']!=_0x1a3863[_0xce8d83][_0x0553('0x13')]){_0x46d6ba=_0x46d6ba['concat'](getUserApplications(_0x4a8506,_0x1a3863[_0xce8d83],_0x1a3863[_0xce8d83][_0x0553('0x13')]));}}return _0x46d6ba;};var getChanSpyPromise=function(_0x2cc90d,_0x34db96){return new BPromise(function(_0x224498,_0x494e34){return _0x2cc90d['User'][_0x0553('0x19')]({'attributes':['id',_0x0553('0x13'),_0x0553('0x18')],'where':{'role':_0x0553('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2e1a90){if(_0x2e1a90){return _0x224498(getChanSpyApplications(_0x34db96,_0x2e1a90));}return _0x224498([]);})['catch'](function(_0x3bde80){_0x494e34(_0x3bde80);});});};module[_0x0553('0x1b')]=function(_0x5f58e0,_0x1d89cb){var _0x22cc5f=_0x5f58e0[_0x0553('0x1c')];return _0x5f58e0['define'](_0x0553('0x1d'),attributes,{'tableName':_0x0553('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bc9fd,_0x3fd6ae,_0x1e9fc2){return getChanSpyPromise(_0x22cc5f,_0x3bc9fd)[_0x0553('0x1f')](function(_0x1b68dc){if(_0x1b68dc&&_0x1b68dc[_0x0553('0x16')]){return _0x22cc5f[_0x0553('0x20')][_0x0553('0x21')](_0x1b68dc);}})[_0x0553('0x1f')](function(){_0x1e9fc2();})[_0x0553('0x22')](function(_0x58975b){_0x1e9fc2(_0x58975b);});},'afterUpdate':function(_0x30d5a5,_0xf40d1b,_0x3bbdcf){return _0x22cc5f[_0x0553('0x20')]['destroy']({'where':{'ChanSpyId':_0x30d5a5['id']}})['then'](function(){return getChanSpyPromise(_0x22cc5f,_0x30d5a5);})['then'](function(_0x14f389){if(_0x14f389&&_0x14f389['length']){return _0x22cc5f['VoiceExtension']['bulkCreate'](_0x14f389);}})[_0x0553('0x1f')](function(){_0x3bbdcf();})[_0x0553('0x22')](function(_0x122f8e){_0x3bbdcf(_0x122f8e);});},'afterDestroy':function(_0x838e88,_0x353dde,_0x33f4c9){return _0x22cc5f['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x838e88['id']}})[_0x0553('0x1f')](function(){_0x33f4c9();})[_0x0553('0x22')](function(_0x2c0cc9){_0x33f4c9(_0x2c0cc9);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7598d91..5a8e8cd 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 _0x546e=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x648351,_0x20d87d){var _0x24e207=function(_0x1686a7){while(--_0x1686a7){_0x648351['push'](_0x648351['shift']());}};_0x24e207(++_0x20d87d);}(_0x546e,0x79));var _0xe546=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x546e[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0xe546('0x0'));var util=require(_0xe546('0x1'));var moment=require('moment');var BPromise=require(_0xe546('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe546('0x3'))['db'];var utils=require(_0xe546('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe546('0x5'));var jayson=require(_0xe546('0x6'));var client=jayson[_0xe546('0x7')][_0xe546('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x353828,_0x408dbc,_0x42c4cd){return new BPromise(function(_0x30e5b3,_0x5af767){return client[_0xe546('0x9')](_0x353828,_0x42c4cd)[_0xe546('0xa')](function(_0x55fbfe){logger[_0xe546('0xb')](_0xe546('0xc'),_0x408dbc,_0xe546('0xd'));logger[_0xe546('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x408dbc,_0xe546('0xd'),JSON[_0xe546('0xf')](_0x55fbfe));if(_0x55fbfe['error']){if(_0x55fbfe[_0xe546('0x10')][_0xe546('0x11')]===0x1f4){logger[_0xe546('0x10')](_0xe546('0xc'),_0x408dbc,_0x55fbfe[_0xe546('0x10')][_0xe546('0x12')]);return _0x5af767(_0x55fbfe[_0xe546('0x10')]['message']);}logger[_0xe546('0x10')](_0xe546('0xc'),_0x408dbc,_0x55fbfe[_0xe546('0x10')][_0xe546('0x12')]);return _0x30e5b3(_0x55fbfe[_0xe546('0x10')]['message']);}else{logger[_0xe546('0xb')](_0xe546('0xc'),_0x408dbc,'request\x20sent');_0x30e5b3(_0x55fbfe[_0xe546('0x13')][_0xe546('0x12')]);}})[_0xe546('0x14')](function(_0x282c4b){logger['error'](_0xe546('0xc'),_0x408dbc,_0x282c4b);_0x5af767(_0x282c4b);});});} \ No newline at end of file +var _0xac0c=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xac0c,0xcf));var _0xcac0=function(_0x46cd89,_0x4a23e4){_0x46cd89=_0x46cd89-0x0;var _0xb080e8=_0xac0c[_0x46cd89];return _0xb080e8;};'use strict';var _=require(_0xcac0('0x0'));var util=require('util');var moment=require(_0xcac0('0x1'));var BPromise=require(_0xcac0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcac0('0x4'));var logger=require(_0xcac0('0x5'))(_0xcac0('0x6'));var config=require(_0xcac0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcac0('0x8')][_0xcac0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19fabe,_0x59276a,_0x4181b5){return new BPromise(function(_0x357868,_0x4a80ba){return client[_0xcac0('0xa')](_0x19fabe,_0x4181b5)[_0xcac0('0xb')](function(_0x5038f3){logger[_0xcac0('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x59276a,'request\x20sent');logger[_0xcac0('0xd')](_0xcac0('0xe'),_0x59276a,'request\x20sent',JSON[_0xcac0('0xf')](_0x5038f3));if(_0x5038f3[_0xcac0('0x10')]){if(_0x5038f3['error']['code']===0x1f4){logger[_0xcac0('0x10')](_0xcac0('0x11'),_0x59276a,_0x5038f3[_0xcac0('0x10')][_0xcac0('0x12')]);return _0x4a80ba(_0x5038f3[_0xcac0('0x10')]['message']);}logger['error'](_0xcac0('0x11'),_0x59276a,_0x5038f3[_0xcac0('0x10')][_0xcac0('0x12')]);return _0x357868(_0x5038f3[_0xcac0('0x10')][_0xcac0('0x12')]);}else{logger[_0xcac0('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x59276a,_0xcac0('0x13'));_0x357868(_0x5038f3[_0xcac0('0x14')][_0xcac0('0x12')]);}})[_0xcac0('0x15')](function(_0x5befa1){logger[_0xcac0('0x10')](_0xcac0('0x11'),_0x59276a,_0x5befa1);_0x4a80ba(_0x5befa1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 72d34e3..ae1f1f5 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 _0xdbbf=['/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceContext.controller','get','isAuthenticated','index'];(function(_0xc79ec1,_0x1ac92f){var _0x1ea29c=function(_0x391922){while(--_0x391922){_0xc79ec1['push'](_0xc79ec1['shift']());}};_0x1ea29c(++_0x1ac92f);}(_0xdbbf,0x7d));var _0xfdbb=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xdbbf[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xfdbb('0x0'));var util=require(_0xfdbb('0x1'));var path=require(_0xfdbb('0x2'));var timeout=require(_0xfdbb('0x3'));var express=require(_0xfdbb('0x4'));var router=express[_0xfdbb('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfdbb('0x6'));var controller=require(_0xfdbb('0x7'));router[_0xfdbb('0x8')]('/',auth[_0xfdbb('0x9')](),controller[_0xfdbb('0xa')]);router['get'](_0xfdbb('0xb'),auth[_0xfdbb('0x9')](),controller['show']);router['post']('/',auth[_0xfdbb('0x9')](),controller[_0xfdbb('0xc')]);router[_0xfdbb('0xd')]('/:id',auth[_0xfdbb('0x9')](),controller[_0xfdbb('0xe')]);router[_0xfdbb('0xf')](_0xfdbb('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xfdbb('0x10')]=router; \ No newline at end of file +var _0xf1d6=['get','isAuthenticated','index','/:id','put','update','delete','destroy','exports','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x580383,_0x446e32){var _0x28aa5a=function(_0x3bd966){while(--_0x3bd966){_0x580383['push'](_0x580383['shift']());}};_0x28aa5a(++_0x446e32);}(_0xf1d6,0x100));var _0x6f1d=function(_0x46f9da,_0x11afed){_0x46f9da=_0x46f9da-0x0;var _0x2a87d4=_0xf1d6[_0x46f9da];return _0x2a87d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f1d('0x0'));var timeout=require(_0x6f1d('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6f1d('0x2'));var config=require(_0x6f1d('0x3'));var controller=require('./voiceContext.controller');router[_0x6f1d('0x4')]('/',auth[_0x6f1d('0x5')](),controller[_0x6f1d('0x6')]);router[_0x6f1d('0x4')](_0x6f1d('0x7'),auth[_0x6f1d('0x5')](),controller['show']);router['post']('/',auth[_0x6f1d('0x5')](),controller['create']);router[_0x6f1d('0x8')](_0x6f1d('0x7'),auth['isAuthenticated'](),controller[_0x6f1d('0x9')]);router[_0x6f1d('0xa')](_0x6f1d('0x7'),auth['isAuthenticated'](),controller[_0x6f1d('0xb')]);module[_0x6f1d('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c6794de..2e22f2f 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x374299,_0x158450){var _0x19e1e4=function(_0x50dae1){while(--_0x50dae1){_0x374299['push'](_0x374299['shift']());}};_0x19e1e4(++_0x158450);}(_0x34e8,0x12c));var _0x834e=function(_0x26b92b,_0x5aff17){_0x26b92b=_0x26b92b-0x0;var _0x3993f6=_0x34e8[_0x26b92b];return _0x3993f6;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['BOOLEAN','STRING','name'];(function(_0x2fbd47,_0x399227){var _0xd69b12=function(_0x2fca10){while(--_0x2fca10){_0x2fbd47['push'](_0x2fbd47['shift']());}};_0xd69b12(++_0x399227);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'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 c62e9fd..cecd371 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 _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(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'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 +var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','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','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~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_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'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3d94a51..d4ecb9d 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 _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x501fd0,_0x555e0f){var _0x3a7c05=function(_0x12d2dd){while(--_0x12d2dd){_0x501fd0['push'](_0x501fd0['shift']());}};_0x3a7c05(++_0x555e0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 09e2f0c..69eaff8 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 _0x58a3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../config/utils'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x58a3,0xac));var _0x358a=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x58a3[_0x242a98];return _0x580999;};'use strict';var _=require('lodash');var util=require(_0x358a('0x0'));var moment=require('moment');var BPromise=require(_0x358a('0x1'));var rs=require(_0x358a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x358a('0x3'));var logger=require(_0x358a('0x4'))(_0x358a('0x5'));var config=require(_0x358a('0x6'));var jayson=require(_0x358a('0x7'));var client=jayson[_0x358a('0x8')][_0x358a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ec159,_0x555495,_0x3a8532){return new BPromise(function(_0x35cb72,_0x262ff6){return client['request'](_0x5ec159,_0x3a8532)[_0x358a('0xa')](function(_0x3bd7f9){logger[_0x358a('0xb')](_0x358a('0xc'),_0x555495,_0x358a('0xd'));logger[_0x358a('0xe')](_0x358a('0xf'),_0x555495,_0x358a('0xd'),JSON[_0x358a('0x10')](_0x3bd7f9));if(_0x3bd7f9[_0x358a('0x11')]){if(_0x3bd7f9['error'][_0x358a('0x12')]===0x1f4){logger[_0x358a('0x11')](_0x358a('0xc'),_0x555495,_0x3bd7f9[_0x358a('0x11')]['message']);return _0x262ff6(_0x3bd7f9[_0x358a('0x11')][_0x358a('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x555495,_0x3bd7f9[_0x358a('0x11')][_0x358a('0x13')]);return _0x35cb72(_0x3bd7f9[_0x358a('0x11')][_0x358a('0x13')]);}else{logger[_0x358a('0xb')](_0x358a('0xc'),_0x555495,_0x358a('0xd'));_0x35cb72(_0x3bd7f9[_0x358a('0x14')]['message']);}})[_0x358a('0x15')](function(_0x483b32){logger[_0x358a('0x11')](_0x358a('0xc'),_0x555495,_0x483b32);_0x262ff6(_0x483b32);});});} \ No newline at end of file +var _0x4e0a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e0a,0xd3));var _0xa4e0=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x4e0a[_0x17c8cc];return _0x3db4eb;};'use strict';var _=require(_0xa4e0('0x0'));var util=require(_0xa4e0('0x1'));var moment=require(_0xa4e0('0x2'));var BPromise=require(_0xa4e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4e0('0x4'))['db'];var utils=require(_0xa4e0('0x5'));var logger=require(_0xa4e0('0x6'))('rpc');var config=require(_0xa4e0('0x7'));var jayson=require(_0xa4e0('0x8'));var client=jayson[_0xa4e0('0x9')][_0xa4e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48f5ed,_0x295546,_0x50c98b){return new BPromise(function(_0x3d0447,_0x3a6e2a){return client[_0xa4e0('0xb')](_0x48f5ed,_0x50c98b)[_0xa4e0('0xc')](function(_0x18939a){logger['info'](_0xa4e0('0xd'),_0x295546,_0xa4e0('0xe'));logger[_0xa4e0('0xf')](_0xa4e0('0x10'),_0x295546,_0xa4e0('0xe'),JSON[_0xa4e0('0x11')](_0x18939a));if(_0x18939a[_0xa4e0('0x12')]){if(_0x18939a['error'][_0xa4e0('0x13')]===0x1f4){logger[_0xa4e0('0x12')](_0xa4e0('0xd'),_0x295546,_0x18939a[_0xa4e0('0x12')][_0xa4e0('0x14')]);return _0x3a6e2a(_0x18939a[_0xa4e0('0x12')][_0xa4e0('0x14')]);}logger[_0xa4e0('0x12')]('VoiceContext,\x20%s,\x20%s',_0x295546,_0x18939a[_0xa4e0('0x12')][_0xa4e0('0x14')]);return _0x3d0447(_0x18939a[_0xa4e0('0x12')]['message']);}else{logger[_0xa4e0('0x15')](_0xa4e0('0xd'),_0x295546,_0xa4e0('0xe'));_0x3d0447(_0x18939a[_0xa4e0('0x16')][_0xa4e0('0x14')]);}})[_0xa4e0('0x17')](function(_0x36bc88){logger['error']('VoiceContext,\x20%s,\x20%s',_0x295546,_0x36bc88);_0x3a6e2a(_0x36bc88);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b4d83e7..7609522 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 _0x9e6b=['show','post','create','put','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x9e6b,0x137));var _0xb9e6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9e6b[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9e6('0x2'));var router=express[_0xb9e6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9e6('0x4'));var config=require(_0xb9e6('0x5'));var controller=require(_0xb9e6('0x6'));router[_0xb9e6('0x7')]('/',auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x9')]);router['get']('/describe',auth[_0xb9e6('0x8')](),controller[_0xb9e6('0xa')]);router[_0xb9e6('0x7')](_0xb9e6('0xb'),auth['isAuthenticated'](),controller[_0xb9e6('0xc')]);router[_0xb9e6('0xd')]('/',auth[_0xb9e6('0x8')](),controller[_0xb9e6('0xe')]);router[_0xb9e6('0xf')](_0xb9e6('0xb'),auth[_0xb9e6('0x8')](),controller['update']);router[_0xb9e6('0x10')]('/:id',auth[_0xb9e6('0x8')](),controller[_0xb9e6('0x11')]);module[_0xb9e6('0x12')]=router; \ No newline at end of file +var _0x7b0a=['/:id','show','post','create','put','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5deb44,_0xff4616){var _0x49df28=function(_0x2b904e){while(--_0x2b904e){_0x5deb44['push'](_0x5deb44['shift']());}};_0x49df28(++_0xff4616);}(_0x7b0a,0x1e7));var _0xa7b0=function(_0x429038,_0x1848a3){_0x429038=_0x429038-0x0;var _0x29b3ff=_0x7b0a[_0x429038];return _0x29b3ff;};'use strict';var multer=require(_0xa7b0('0x0'));var util=require(_0xa7b0('0x1'));var path=require(_0xa7b0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7b0('0x3'));var router=express[_0xa7b0('0x4')]();var auth=require(_0xa7b0('0x5'));var interaction=require(_0xa7b0('0x6'));var config=require(_0xa7b0('0x7'));var controller=require(_0xa7b0('0x8'));router[_0xa7b0('0x9')]('/',auth[_0xa7b0('0xa')](),controller[_0xa7b0('0xb')]);router[_0xa7b0('0x9')](_0xa7b0('0xc'),auth[_0xa7b0('0xa')](),controller['describe']);router[_0xa7b0('0x9')](_0xa7b0('0xd'),auth[_0xa7b0('0xa')](),controller[_0xa7b0('0xe')]);router[_0xa7b0('0xf')]('/',auth[_0xa7b0('0xa')](),controller[_0xa7b0('0x10')]);router[_0xa7b0('0x11')](_0xa7b0('0xd'),auth[_0xa7b0('0xa')](),controller['update']);router[_0xa7b0('0x12')](_0xa7b0('0xd'),auth[_0xa7b0('0xa')](),controller['destroy']);module[_0xa7b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b168399..64a8d19 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 _0xac13=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xac13,0x14b));var _0x3ac1=function(_0x1a3875,_0x593b5b){_0x1a3875=_0x1a3875-0x0;var _0x2de814=_0xac13[_0x1a3875];return _0x2de814;};'use strict';var Sequelize=require(_0x3ac1('0x0'));module[_0x3ac1('0x1')]={'privilege':{'type':Sequelize[_0x3ac1('0x2')]},'channel':{'type':Sequelize[_0x3ac1('0x2')]},'channelstate':{'type':Sequelize[_0x3ac1('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3ac1('0x2')]},'calleridname':{'type':Sequelize[_0x3ac1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3ac1('0x2')]},'language':{'type':Sequelize[_0x3ac1('0x2')]},'accountcode':{'type':Sequelize[_0x3ac1('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x3ac1('0x2')]},'linkedid':{'type':Sequelize[_0x3ac1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3ac1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3ac1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x3ac1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3ac1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x3ac1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3ac1('0x2')]},'destexten':{'type':Sequelize[_0x3ac1('0x2')]},'destpriority':{'type':Sequelize[_0x3ac1('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x3ac1('0x2')]},'starttime':{'type':Sequelize[_0x3ac1('0x4')]},'answertime':{'type':Sequelize[_0x3ac1('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x3ac1('0x2')],'comment':_0x3ac1('0x5')},'routeId':{'type':Sequelize[_0x3ac1('0x3')]},'duration':{'type':Sequelize[_0x3ac1('0x3')]},'holdtime':{'type':Sequelize[_0x3ac1('0x3')]},'billableseconds':{'type':Sequelize[_0x3ac1('0x3')]}}; \ No newline at end of file +var _0x440f=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x245f3d,_0x3d5fda){var _0x1dbe4f=function(_0x5e2d0a){while(--_0x5e2d0a){_0x245f3d['push'](_0x245f3d['shift']());}};_0x1dbe4f(++_0x3d5fda);}(_0x440f,0x1ab));var _0xf440=function(_0x23bcbf,_0x33361a){_0x23bcbf=_0x23bcbf-0x0;var _0x29af38=_0x440f[_0x23bcbf];return _0x29af38;};'use strict';var Sequelize=require(_0xf440('0x0'));module[_0xf440('0x1')]={'privilege':{'type':Sequelize[_0xf440('0x2')]},'channel':{'type':Sequelize[_0xf440('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf440('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf440('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf440('0x2')]},'connectedlinename':{'type':Sequelize[_0xf440('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf440('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xf440('0x2')]},'linkedid':{'type':Sequelize[_0xf440('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf440('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf440('0x2')]},'destcalleridname':{'type':Sequelize[_0xf440('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf440('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf440('0x2')]},'destlanguage':{'type':Sequelize[_0xf440('0x2')]},'destaccountcode':{'type':Sequelize[_0xf440('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf440('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xf440('0x2')]},'destlinkedid':{'type':Sequelize[_0xf440('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf440('0x2')]},'starttime':{'type':Sequelize[_0xf440('0x4')]},'answertime':{'type':Sequelize[_0xf440('0x4')]},'endtime':{'type':Sequelize[_0xf440('0x4')]},'lastevent':{'type':Sequelize[_0xf440('0x2')],'comment':_0xf440('0x5')},'routeId':{'type':Sequelize[_0xf440('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf440('0x3')]},'billableseconds':{'type':Sequelize[_0xf440('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 98d8669..c1d7363 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 _0x14f6=['type','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','merge'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x14f6,0x170));var _0x614f=function(_0x13e54d,_0x36893f){_0x13e54d=_0x13e54d-0x0;var _0x63a92c=_0x14f6[_0x13e54d];return _0x63a92c;};'use strict';var pdf=require(_0x614f('0x0'));var emlformat=require(_0x614f('0x1'));var rimraf=require(_0x614f('0x2'));var zipdir=require(_0x614f('0x3'));var jsonpatch=require(_0x614f('0x4'));var rp=require(_0x614f('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x614f('0x6'));var util=require(_0x614f('0x7'));var path=require(_0x614f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x614f('0x9'));var fs=require('fs');var _=require(_0x614f('0xa'));var squel=require('squel');var crypto=require(_0x614f('0xb'));var jsforce=require(_0x614f('0xc'));var deskjs=require(_0x614f('0xd'));var toCsv=require(_0x614f('0xe'));var querystring=require(_0x614f('0xf'));var Papa=require(_0x614f('0x10'));var Redis=require(_0x614f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x614f('0x12'));var hardwareService=require(_0x614f('0x13'));var logger=require(_0x614f('0x14'))(_0x614f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x614f('0x16'))['db'];function respondWithStatusCode(_0x37d9cc,_0x125753){_0x125753=_0x125753||0xcc;return function(_0x5919d3){if(_0x5919d3){return _0x37d9cc[_0x614f('0x17')](_0x125753);}return _0x37d9cc[_0x614f('0x18')](_0x125753)[_0x614f('0x19')]();};}function respondWithResult(_0x2c860c,_0x479d29){_0x479d29=_0x479d29||0xc8;return function(_0x2d8c74){if(_0x2d8c74){return _0x2c860c[_0x614f('0x18')](_0x479d29)[_0x614f('0x1a')](_0x2d8c74);}};}function respondWithFilteredResult(_0x56e586,_0x386130){return function(_0x3065b9){if(_0x3065b9){var _0xfc2c73=_0x3065b9[_0x614f('0x1b')],_0xabfef5=_0x386130['offset'],_0x30a144=_0x386130[_0x614f('0x1c')]+_0x386130['limit'],_0x6d69a5;if(_0x30a144>=_0xfc2c73){_0x30a144=_0xfc2c73;_0x6d69a5=0xc8;}else{_0x6d69a5=0xce;}_0x56e586['status'](_0x6d69a5);return _0x56e586['set'](_0x614f('0x1d'),_0xabfef5+'-'+_0x30a144+'/'+_0xfc2c73)['json'](_0x3065b9);}return null;};}function patchUpdates(_0x2bba76){return function(_0x168de4){try{jsonpatch['apply'](_0x168de4,_0x2bba76,!![]);}catch(_0x28cb83){return BPromise[_0x614f('0x1e')](_0x28cb83);}return _0x168de4[_0x614f('0x1f')]();};}function saveUpdates(_0x208c69,_0x5a4469){return function(_0x2cc80e){if(_0x2cc80e){return _0x2cc80e[_0x614f('0x20')](_0x208c69)[_0x614f('0x21')](function(_0x3e1ee5){return _0x3e1ee5;});}return null;};}function removeEntity(_0x3f0828,_0x4957c6){return function(_0xd47d28){if(_0xd47d28){return _0xd47d28[_0x614f('0x22')]()[_0x614f('0x21')](function(){_0x3f0828[_0x614f('0x18')](0xcc)[_0x614f('0x19')]();});}};}function handleEntityNotFound(_0x2b32ff,_0xae6e6c){return function(_0x77bc63){if(!_0x77bc63){_0x2b32ff[_0x614f('0x17')](0x194);}return _0x77bc63;};}function handleError(_0x4fd96c,_0x40c0cf){_0x40c0cf=_0x40c0cf||0x1f4;return function(_0x2a9952){logger[_0x614f('0x23')](_0x2a9952[_0x614f('0x24')]);if(_0x2a9952['name']){delete _0x2a9952[_0x614f('0x25')];}_0x4fd96c[_0x614f('0x18')](_0x40c0cf)[_0x614f('0x26')](_0x2a9952);};}exports[_0x614f('0x27')]=function(_0x3e7bc3,_0xad1b55){var _0x5c4fcc={},_0x353539={},_0x46ec45={'count':0x0,'rows':[]};var _0x2299dd=_[_0x614f('0x28')](db[_0x614f('0x29')][_0x614f('0x2a')],function(_0x544c09){return{'name':_0x544c09[_0x614f('0x2b')],'type':_0x544c09['type']['key']};});_0x353539[_0x614f('0x2c')]=_[_0x614f('0x28')](_0x2299dd,_0x614f('0x25'));_0x353539[_0x614f('0x2d')]=_[_0x614f('0x2e')](_0x3e7bc3[_0x614f('0x2d')]);_0x353539[_0x614f('0x2f')]=_[_0x614f('0x30')](_0x353539[_0x614f('0x2c')],_0x353539[_0x614f('0x2d')]);_0x5c4fcc['attributes']=_[_0x614f('0x30')](_0x353539['model'],qs[_0x614f('0x31')](_0x3e7bc3['query'][_0x614f('0x31')]));_0x5c4fcc[_0x614f('0x32')]=_0x5c4fcc['attributes']['length']?_0x5c4fcc[_0x614f('0x32')]:_0x353539[_0x614f('0x2c')];if(!_0x3e7bc3['query'][_0x614f('0x33')](_0x614f('0x34'))){_0x5c4fcc[_0x614f('0x35')]=qs['limit'](_0x3e7bc3['query'][_0x614f('0x35')]);_0x5c4fcc[_0x614f('0x1c')]=qs[_0x614f('0x1c')](_0x3e7bc3[_0x614f('0x2d')][_0x614f('0x1c')]);}_0x5c4fcc[_0x614f('0x36')]=qs[_0x614f('0x37')](_0x3e7bc3['query'][_0x614f('0x37')]);_0x5c4fcc['where']=qs[_0x614f('0x2f')](_['pick'](_0x3e7bc3['query'],_0x353539[_0x614f('0x2f')]),_0x2299dd);if(_0x3e7bc3[_0x614f('0x2d')]['filter']){_0x5c4fcc[_0x614f('0x38')]=_[_0x614f('0x39')](_0x5c4fcc[_0x614f('0x38')],{'$or':_[_0x614f('0x28')](_0x2299dd,function(_0x3d7bbc){if(_0x3d7bbc[_0x614f('0x3a')]!==_0x614f('0x3b')){var _0x394988={};_0x394988[_0x3d7bbc['name']]={'$like':'%'+_0x3e7bc3[_0x614f('0x2d')]['filter']+'%'};return _0x394988;}})});}_0x5c4fcc=_[_0x614f('0x39')]({},_0x5c4fcc,_0x3e7bc3[_0x614f('0x3c')]);var _0x3dfb47={'where':_0x5c4fcc[_0x614f('0x38')]};return db[_0x614f('0x29')][_0x614f('0x1b')](_0x3dfb47)[_0x614f('0x21')](function(_0x4fd778){_0x46ec45[_0x614f('0x1b')]=_0x4fd778;if(_0x3e7bc3[_0x614f('0x2d')][_0x614f('0x3d')]){_0x5c4fcc[_0x614f('0x3e')]=[{'all':!![]}];}return db[_0x614f('0x29')]['findAll'](_0x5c4fcc);})['then'](function(_0x450cc0){_0x46ec45[_0x614f('0x3f')]=_0x450cc0;return _0x46ec45;})[_0x614f('0x21')](respondWithFilteredResult(_0xad1b55,_0x5c4fcc))[_0x614f('0x40')](handleError(_0xad1b55,null));};exports['show']=function(_0x3f7cc0,_0xc55f7b){var _0xe46544={'raw':!![],'where':{'id':_0x3f7cc0[_0x614f('0x41')]['id']}},_0x2cc780={};_0x2cc780[_0x614f('0x2c')]=_['keys'](db[_0x614f('0x29')][_0x614f('0x2a')]);_0x2cc780[_0x614f('0x2d')]=_[_0x614f('0x2e')](_0x3f7cc0['query']);_0x2cc780['filters']=_[_0x614f('0x30')](_0x2cc780[_0x614f('0x2c')],_0x2cc780[_0x614f('0x2d')]);_0xe46544[_0x614f('0x32')]=_[_0x614f('0x30')](_0x2cc780[_0x614f('0x2c')],qs['fields'](_0x3f7cc0[_0x614f('0x2d')][_0x614f('0x31')]));_0xe46544[_0x614f('0x32')]=_0xe46544[_0x614f('0x32')][_0x614f('0x42')]?_0xe46544[_0x614f('0x32')]:_0x2cc780[_0x614f('0x2c')];if(_0x3f7cc0[_0x614f('0x2d')][_0x614f('0x3d')]){_0xe46544[_0x614f('0x3e')]=[{'all':!![]}];}_0xe46544=_[_0x614f('0x39')]({},_0xe46544,_0x3f7cc0[_0x614f('0x3c')]);return db[_0x614f('0x29')][_0x614f('0x43')](_0xe46544)[_0x614f('0x21')](handleEntityNotFound(_0xc55f7b,null))['then'](respondWithResult(_0xc55f7b,null))[_0x614f('0x40')](handleError(_0xc55f7b,null));};exports[_0x614f('0x44')]=function(_0xfc629c,_0x2b614f){return db['VoiceDialReport']['create'](_0xfc629c[_0x614f('0x45')],{})[_0x614f('0x21')](respondWithResult(_0x2b614f,0xc9))[_0x614f('0x40')](handleError(_0x2b614f,null));};exports['update']=function(_0x5c48d3,_0x23c4f6){if(_0x5c48d3[_0x614f('0x45')]['id']){delete _0x5c48d3[_0x614f('0x45')]['id'];}return db[_0x614f('0x29')][_0x614f('0x43')]({'where':{'id':_0x5c48d3[_0x614f('0x41')]['id']}})['then'](handleEntityNotFound(_0x23c4f6,null))[_0x614f('0x21')](saveUpdates(_0x5c48d3[_0x614f('0x45')],null))['then'](respondWithResult(_0x23c4f6,null))['catch'](handleError(_0x23c4f6,null));};exports[_0x614f('0x22')]=function(_0x6df66f,_0x4aba29){return db[_0x614f('0x29')]['find']({'where':{'id':_0x6df66f[_0x614f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4aba29,null))[_0x614f('0x21')](removeEntity(_0x4aba29,null))['catch'](handleError(_0x4aba29,null));};exports[_0x614f('0x46')]=function(_0x41e926,_0x3a0e4b){return db[_0x614f('0x29')][_0x614f('0x46')]()[_0x614f('0x21')](respondWithResult(_0x3a0e4b,null))['catch'](handleError(_0x3a0e4b,null));}; \ No newline at end of file +var _0x9dc3=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','error','stack','name','map','VoiceDialReport','rawAttributes','fieldName','type','key'];(function(_0x3bbf1b,_0x57f10a){var _0x4da9ef=function(_0x3d825d){while(--_0x3d825d){_0x3bbf1b['push'](_0x3bbf1b['shift']());}};_0x4da9ef(++_0x57f10a);}(_0x9dc3,0xa5));var _0x39dc=function(_0x2d913d,_0x5f42dd){_0x2d913d=_0x2d913d-0x0;var _0x3991be=_0x9dc3[_0x2d913d];return _0x3991be;};'use strict';var pdf=require(_0x39dc('0x0'));var emlformat=require(_0x39dc('0x1'));var rimraf=require(_0x39dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39dc('0x3'));var moment=require(_0x39dc('0x4'));var BPromise=require(_0x39dc('0x5'));var Mustache=require(_0x39dc('0x6'));var util=require(_0x39dc('0x7'));var path=require(_0x39dc('0x8'));var sox=require('sox');var csv=require(_0x39dc('0x9'));var ejs=require(_0x39dc('0xa'));var fs=require('fs');var _=require(_0x39dc('0xb'));var squel=require(_0x39dc('0xc'));var crypto=require(_0x39dc('0xd'));var jsforce=require(_0x39dc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39dc('0xf'));var Redis=require(_0x39dc('0x10'));var authService=require(_0x39dc('0x11'));var qs=require(_0x39dc('0x12'));var as=require(_0x39dc('0x13'));var hardwareService=require(_0x39dc('0x14'));var logger=require(_0x39dc('0x15'))(_0x39dc('0x16'));var utils=require('../../config/utils');var config=require(_0x39dc('0x17'));var db=require(_0x39dc('0x18'))['db'];function respondWithStatusCode(_0x45a956,_0x3e06e8){_0x3e06e8=_0x3e06e8||0xcc;return function(_0x563407){if(_0x563407){return _0x45a956[_0x39dc('0x19')](_0x3e06e8);}return _0x45a956[_0x39dc('0x1a')](_0x3e06e8)[_0x39dc('0x1b')]();};}function respondWithResult(_0x4f6ded,_0x3ded19){_0x3ded19=_0x3ded19||0xc8;return function(_0x2ca172){if(_0x2ca172){return _0x4f6ded[_0x39dc('0x1a')](_0x3ded19)[_0x39dc('0x1c')](_0x2ca172);}};}function respondWithFilteredResult(_0x21a64a,_0x4bcc35){return function(_0x3f2265){if(_0x3f2265){var _0x286350=_0x3f2265[_0x39dc('0x1d')],_0x258601=_0x4bcc35[_0x39dc('0x1e')],_0xc60a99=_0x4bcc35['offset']+_0x4bcc35[_0x39dc('0x1f')],_0xb6f64e;if(_0xc60a99>=_0x286350){_0xc60a99=_0x286350;_0xb6f64e=0xc8;}else{_0xb6f64e=0xce;}_0x21a64a[_0x39dc('0x1a')](_0xb6f64e);return _0x21a64a['set']('Content-Range',_0x258601+'-'+_0xc60a99+'/'+_0x286350)[_0x39dc('0x1c')](_0x3f2265);}return null;};}function patchUpdates(_0x11fb9b){return function(_0x364e97){try{jsonpatch[_0x39dc('0x20')](_0x364e97,_0x11fb9b,!![]);}catch(_0x4d64dd){return BPromise[_0x39dc('0x21')](_0x4d64dd);}return _0x364e97['save']();};}function saveUpdates(_0x51cd11,_0x25c951){return function(_0x1acf94){if(_0x1acf94){return _0x1acf94[_0x39dc('0x22')](_0x51cd11)[_0x39dc('0x23')](function(_0x40ec77){return _0x40ec77;});}return null;};}function removeEntity(_0xaebd68,_0x43920e){return function(_0x301470){if(_0x301470){return _0x301470['destroy']()[_0x39dc('0x23')](function(){_0xaebd68['status'](0xcc)[_0x39dc('0x1b')]();});}};}function handleEntityNotFound(_0x44b1f7,_0x5c124c){return function(_0x20e065){if(!_0x20e065){_0x44b1f7[_0x39dc('0x19')](0x194);}return _0x20e065;};}function handleError(_0x44cbdb,_0x6c94e5){_0x6c94e5=_0x6c94e5||0x1f4;return function(_0x38de48){logger[_0x39dc('0x24')](_0x38de48[_0x39dc('0x25')]);if(_0x38de48[_0x39dc('0x26')]){delete _0x38de48['name'];}_0x44cbdb['status'](_0x6c94e5)['send'](_0x38de48);};}exports['index']=function(_0x2e5b37,_0x51adc9){var _0x4246c4={},_0x1fb03b={},_0x975413={'count':0x0,'rows':[]};var _0x2941c9=_[_0x39dc('0x27')](db[_0x39dc('0x28')][_0x39dc('0x29')],function(_0x880d29){return{'name':_0x880d29[_0x39dc('0x2a')],'type':_0x880d29[_0x39dc('0x2b')][_0x39dc('0x2c')]};});_0x1fb03b['model']=_[_0x39dc('0x27')](_0x2941c9,'name');_0x1fb03b[_0x39dc('0x2d')]=_[_0x39dc('0x2e')](_0x2e5b37[_0x39dc('0x2d')]);_0x1fb03b[_0x39dc('0x2f')]=_[_0x39dc('0x30')](_0x1fb03b[_0x39dc('0x31')],_0x1fb03b['query']);_0x4246c4[_0x39dc('0x32')]=_[_0x39dc('0x30')](_0x1fb03b[_0x39dc('0x31')],qs[_0x39dc('0x33')](_0x2e5b37[_0x39dc('0x2d')][_0x39dc('0x33')]));_0x4246c4[_0x39dc('0x32')]=_0x4246c4[_0x39dc('0x32')][_0x39dc('0x34')]?_0x4246c4['attributes']:_0x1fb03b[_0x39dc('0x31')];if(!_0x2e5b37[_0x39dc('0x2d')][_0x39dc('0x35')]('nolimit')){_0x4246c4[_0x39dc('0x1f')]=qs[_0x39dc('0x1f')](_0x2e5b37['query'][_0x39dc('0x1f')]);_0x4246c4[_0x39dc('0x1e')]=qs[_0x39dc('0x1e')](_0x2e5b37[_0x39dc('0x2d')][_0x39dc('0x1e')]);}_0x4246c4['order']=qs[_0x39dc('0x36')](_0x2e5b37['query'][_0x39dc('0x36')]);_0x4246c4[_0x39dc('0x37')]=qs[_0x39dc('0x2f')](_['pick'](_0x2e5b37[_0x39dc('0x2d')],_0x1fb03b[_0x39dc('0x2f')]),_0x2941c9);if(_0x2e5b37['query'][_0x39dc('0x38')]){_0x4246c4['where']=_[_0x39dc('0x39')](_0x4246c4[_0x39dc('0x37')],{'$or':_['map'](_0x2941c9,function(_0x100f0d){if(_0x100f0d[_0x39dc('0x2b')]!==_0x39dc('0x3a')){var _0x36e02c={};_0x36e02c[_0x100f0d['name']]={'$like':'%'+_0x2e5b37[_0x39dc('0x2d')][_0x39dc('0x38')]+'%'};return _0x36e02c;}})});}_0x4246c4=_[_0x39dc('0x39')]({},_0x4246c4,_0x2e5b37['options']);var _0x19b535={'where':_0x4246c4['where']};return db['VoiceDialReport']['count'](_0x19b535)[_0x39dc('0x23')](function(_0x32d003){_0x975413[_0x39dc('0x1d')]=_0x32d003;if(_0x2e5b37['query'][_0x39dc('0x3b')]){_0x4246c4[_0x39dc('0x3c')]=[{'all':!![]}];}return db[_0x39dc('0x28')][_0x39dc('0x3d')](_0x4246c4);})[_0x39dc('0x23')](function(_0x35266c){_0x975413['rows']=_0x35266c;return _0x975413;})['then'](respondWithFilteredResult(_0x51adc9,_0x4246c4))[_0x39dc('0x3e')](handleError(_0x51adc9,null));};exports['show']=function(_0x484dbe,_0x48266e){var _0x16843a={'raw':!![],'where':{'id':_0x484dbe[_0x39dc('0x3f')]['id']}},_0x1895fc={};_0x1895fc[_0x39dc('0x31')]=_[_0x39dc('0x2e')](db[_0x39dc('0x28')][_0x39dc('0x29')]);_0x1895fc[_0x39dc('0x2d')]=_[_0x39dc('0x2e')](_0x484dbe[_0x39dc('0x2d')]);_0x1895fc[_0x39dc('0x2f')]=_[_0x39dc('0x30')](_0x1895fc['model'],_0x1895fc[_0x39dc('0x2d')]);_0x16843a[_0x39dc('0x32')]=_['intersection'](_0x1895fc['model'],qs['fields'](_0x484dbe[_0x39dc('0x2d')]['fields']));_0x16843a['attributes']=_0x16843a[_0x39dc('0x32')][_0x39dc('0x34')]?_0x16843a[_0x39dc('0x32')]:_0x1895fc['model'];if(_0x484dbe[_0x39dc('0x2d')][_0x39dc('0x3b')]){_0x16843a[_0x39dc('0x3c')]=[{'all':!![]}];}_0x16843a=_['merge']({},_0x16843a,_0x484dbe[_0x39dc('0x40')]);return db[_0x39dc('0x28')][_0x39dc('0x41')](_0x16843a)[_0x39dc('0x23')](handleEntityNotFound(_0x48266e,null))[_0x39dc('0x23')](respondWithResult(_0x48266e,null))['catch'](handleError(_0x48266e,null));};exports[_0x39dc('0x42')]=function(_0x1d0e6f,_0x5f0554){return db[_0x39dc('0x28')][_0x39dc('0x42')](_0x1d0e6f[_0x39dc('0x43')],{})[_0x39dc('0x23')](respondWithResult(_0x5f0554,0xc9))[_0x39dc('0x3e')](handleError(_0x5f0554,null));};exports['update']=function(_0x4e1af8,_0x34ce33){if(_0x4e1af8[_0x39dc('0x43')]['id']){delete _0x4e1af8[_0x39dc('0x43')]['id'];}return db[_0x39dc('0x28')][_0x39dc('0x41')]({'where':{'id':_0x4e1af8['params']['id']}})['then'](handleEntityNotFound(_0x34ce33,null))[_0x39dc('0x23')](saveUpdates(_0x4e1af8[_0x39dc('0x43')],null))[_0x39dc('0x23')](respondWithResult(_0x34ce33,null))[_0x39dc('0x3e')](handleError(_0x34ce33,null));};exports[_0x39dc('0x44')]=function(_0x18c2f2,_0x3801a8){return db[_0x39dc('0x28')]['find']({'where':{'id':_0x18c2f2[_0x39dc('0x3f')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x3801a8,null))['then'](removeEntity(_0x3801a8,null))[_0x39dc('0x3e')](handleError(_0x3801a8,null));};exports[_0x39dc('0x45')]=function(_0x2738fd,_0x1138f2){return db['VoiceDialReport'][_0x39dc('0x45')]()['then'](respondWithResult(_0x1138f2,null))['catch'](handleError(_0x1138f2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f68f6d4..9dcc198 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 _0xd704=['api','moment','bluebird','path','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','lodash','../../config/logger'];(function(_0x40c0dd,_0x171ea5){var _0x2d4984=function(_0x28088a){while(--_0x28088a){_0x40c0dd['push'](_0x40c0dd['shift']());}};_0x2d4984(++_0x171ea5);}(_0xd704,0x82));var _0x4d70=function(_0x267af9,_0x2fa2b2){_0x267af9=_0x267af9-0x0;var _0x4e59a5=_0xd704[_0x267af9];return _0x4e59a5;};'use strict';var _=require(_0x4d70('0x0'));var util=require('util');var logger=require(_0x4d70('0x1'))(_0x4d70('0x2'));var moment=require(_0x4d70('0x3'));var BPromise=require(_0x4d70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d70('0x5'));var rimraf=require('rimraf');var config=require(_0x4d70('0x6'));var attributes=require(_0x4d70('0x7'));module[_0x4d70('0x8')]=function(_0x305cd9,_0x46fc42){return _0x305cd9['define'](_0x4d70('0x9'),attributes,{'tableName':_0x4d70('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c69=['report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','define','VoiceDialReport'];(function(_0x448774,_0x45ddc7){var _0x46b2f6=function(_0x1dee94){while(--_0x1dee94){_0x448774['push'](_0x448774['shift']());}};_0x46b2f6(++_0x45ddc7);}(_0x1c69,0x1b4));var _0x91c6=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x1c69[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x91c6('0x0'));var util=require(_0x91c6('0x1'));var logger=require(_0x91c6('0x2'))(_0x91c6('0x3'));var moment=require(_0x91c6('0x4'));var BPromise=require(_0x91c6('0x5'));var rp=require(_0x91c6('0x6'));var fs=require('fs');var path=require(_0x91c6('0x7'));var rimraf=require(_0x91c6('0x8'));var config=require('../../config/environment');var attributes=require(_0x91c6('0x9'));module['exports']=function(_0x46de9d,_0x268867){return _0x46de9d[_0x91c6('0xa')](_0x91c6('0xb'),attributes,{'tableName':_0x91c6('0xc'),'paranoid':![],'indexes':[{'fields':[_0x91c6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0b0fd47..551a2bb 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 _0x0884=['error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','update','raw','where','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var moment=require(_0x4088('0x2'));var BPromise=require(_0x4088('0x3'));var rs=require(_0x4088('0x4'));var fs=require('fs');var Redis=require(_0x4088('0x5'));var db=require(_0x4088('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4088('0x7'))(_0x4088('0x8'));var config=require(_0x4088('0x9'));var jayson=require(_0x4088('0xa'));var client=jayson[_0x4088('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d68aa,_0x42b2c3,_0x52baff){return new BPromise(function(_0x680227,_0x8f007c){return client[_0x4088('0xc')](_0x4d68aa,_0x52baff)[_0x4088('0xd')](function(_0x32fbb6){logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));logger[_0x4088('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x42b2c3,_0x4088('0x10'),JSON[_0x4088('0x12')](_0x32fbb6));if(_0x32fbb6[_0x4088('0x13')]){if(_0x32fbb6['error'][_0x4088('0x14')]===0x1f4){logger[_0x4088('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x8f007c(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}logger[_0x4088('0x13')](_0x4088('0xf'),_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x680227(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}else{logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));_0x680227(_0x32fbb6[_0x4088('0x16')][_0x4088('0x15')]);}})[_0x4088('0x17')](function(_0x38c6d6){logger[_0x4088('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42b2c3,_0x38c6d6);_0x8f007c(_0x38c6d6);});});}exports[_0x4088('0x18')]=function(_0x24fe84){var _0xc7fc8e=this;return new Promise(function(_0xf21ee7,_0x40bea5){return db[_0x4088('0x19')][_0x4088('0x1a')](_0x24fe84[_0x4088('0x1b')],{'raw':_0x24fe84[_0x4088('0x1c')]?_0x24fe84[_0x4088('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4088('0xd')](function(_0x4b887e){logger['info']('CreateVoiceDialReport',_0x24fe84);logger['debug'](_0x4088('0x18'),_0x24fe84,JSON[_0x4088('0x12')](_0x4b887e));_0xf21ee7(_0x4b887e);})[_0x4088('0x17')](function(_0x31f333){logger['error'](_0x4088('0x18'),_0x31f333[_0x4088('0x15')],_0x24fe84);_0x40bea5(_0xc7fc8e[_0x4088('0x13')](0x1f4,_0x31f333['message']));});});};exports['UpdateVoiceDialReport']=function(_0x27ee8e){var _0xdca2c0=this;return new Promise(function(_0x3ae908,_0x159158){return db[_0x4088('0x19')][_0x4088('0x1d')](_0x27ee8e['body'],{'raw':_0x27ee8e['options']?_0x27ee8e[_0x4088('0x1c')][_0x4088('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e[_0x4088('0x1c')][_0x4088('0x1f')]||null:null,'attributes':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e[_0x4088('0x1c')]['attributes']||null:null,'limit':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e['options']['limit']||null:null})[_0x4088('0xd')](function(_0x5b8137){logger[_0x4088('0xe')]('UpdateVoiceDialReport',_0x27ee8e);logger[_0x4088('0x11')](_0x4088('0x20'),_0x27ee8e,JSON[_0x4088('0x12')](_0x5b8137));_0x3ae908(_0x5b8137);})['catch'](function(_0x3338fa){logger['error']('UpdateVoiceDialReport',_0x3338fa[_0x4088('0x15')],_0x27ee8e);_0x159158(_0xdca2c0[_0x4088('0x13')](0x1f4,_0x3338fa['message']));});});}; \ No newline at end of file +var _0xc68d=['where','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceDialReport','VoiceDialReport','create','body','then','debug','catch','UpdateVoiceDialReport','update','options'];(function(_0x4b49b5,_0x4243c6){var _0x219ff9=function(_0x43e397){while(--_0x43e397){_0x4b49b5['push'](_0x4b49b5['shift']());}};_0x219ff9(++_0x4243c6);}(_0xc68d,0x17a));var _0xdc68=function(_0x5d59d9,_0x118efa){_0x5d59d9=_0x5d59d9-0x0;var _0x4c375e=_0xc68d[_0x5d59d9];return _0x4c375e;};'use strict';var _=require('lodash');var util=require(_0xdc68('0x0'));var moment=require(_0xdc68('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc68('0x2'));var db=require(_0xdc68('0x3'))['db'];var utils=require(_0xdc68('0x4'));var logger=require(_0xdc68('0x5'))(_0xdc68('0x6'));var config=require(_0xdc68('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdc68('0x8')][_0xdc68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9507b2,_0x5204af,_0x214161){return new BPromise(function(_0x40e8eb,_0x6d2fb0){return client['request'](_0x9507b2,_0x214161)['then'](function(_0x1abb86){logger[_0xdc68('0xa')](_0xdc68('0xb'),_0x5204af,_0xdc68('0xc'));logger['debug'](_0xdc68('0xd'),_0x5204af,_0xdc68('0xc'),JSON[_0xdc68('0xe')](_0x1abb86));if(_0x1abb86[_0xdc68('0xf')]){if(_0x1abb86['error'][_0xdc68('0x10')]===0x1f4){logger[_0xdc68('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x5204af,_0x1abb86[_0xdc68('0xf')][_0xdc68('0x11')]);return _0x6d2fb0(_0x1abb86[_0xdc68('0xf')]['message']);}logger[_0xdc68('0xf')](_0xdc68('0xb'),_0x5204af,_0x1abb86[_0xdc68('0xf')][_0xdc68('0x11')]);return _0x40e8eb(_0x1abb86[_0xdc68('0xf')][_0xdc68('0x11')]);}else{logger[_0xdc68('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x5204af,_0xdc68('0xc'));_0x40e8eb(_0x1abb86['result'][_0xdc68('0x11')]);}})['catch'](function(_0x126668){logger[_0xdc68('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x5204af,_0x126668);_0x6d2fb0(_0x126668);});});}exports[_0xdc68('0x12')]=function(_0x3afa9a){var _0x4255e4=this;return new Promise(function(_0x59896b,_0x107336){return db[_0xdc68('0x13')][_0xdc68('0x14')](_0x3afa9a[_0xdc68('0x15')],{'raw':_0x3afa9a['options']?_0x3afa9a['options']['raw']===undefined?!![]:![]:!![]})[_0xdc68('0x16')](function(_0x15f955){logger[_0xdc68('0xa')](_0xdc68('0x12'),_0x3afa9a);logger[_0xdc68('0x17')]('CreateVoiceDialReport',_0x3afa9a,JSON[_0xdc68('0xe')](_0x15f955));_0x59896b(_0x15f955);})[_0xdc68('0x18')](function(_0x3199d8){logger[_0xdc68('0xf')](_0xdc68('0x12'),_0x3199d8[_0xdc68('0x11')],_0x3afa9a);_0x107336(_0x4255e4['error'](0x1f4,_0x3199d8[_0xdc68('0x11')]));});});};exports[_0xdc68('0x19')]=function(_0x5685ed){var _0xc61db8=this;return new Promise(function(_0x5b0842,_0x43d8eb){return db[_0xdc68('0x13')][_0xdc68('0x1a')](_0x5685ed[_0xdc68('0x15')],{'raw':_0x5685ed['options']?_0x5685ed[_0xdc68('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5685ed[_0xdc68('0x1b')]?_0x5685ed[_0xdc68('0x1b')][_0xdc68('0x1c')]||null:null,'attributes':_0x5685ed[_0xdc68('0x1b')]?_0x5685ed[_0xdc68('0x1b')]['attributes']||null:null,'limit':_0x5685ed['options']?_0x5685ed['options']['limit']||null:null})[_0xdc68('0x16')](function(_0x11418b){logger[_0xdc68('0xa')](_0xdc68('0x19'),_0x5685ed);logger[_0xdc68('0x17')](_0xdc68('0x19'),_0x5685ed,JSON[_0xdc68('0xe')](_0x11418b));_0x5b0842(_0x11418b);})[_0xdc68('0x18')](function(_0x440598){logger[_0xdc68('0xf')](_0xdc68('0x19'),_0x440598['message'],_0x5685ed);_0x43d8eb(_0xc61db8[_0xdc68('0xf')](0x1f4,_0x440598[_0xdc68('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index db93b57..3fd42db 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 _0x1d23=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1d23,0x14e));var _0x31d2=function(_0x196192,_0x58189a){_0x196192=_0x196192-0x0;var _0x3fdb0f=_0x1d23[_0x196192];return _0x3fdb0f;};'use strict';var multer=require('multer');var util=require(_0x31d2('0x0'));var path=require(_0x31d2('0x1'));var timeout=require(_0x31d2('0x2'));var express=require(_0x31d2('0x3'));var router=express[_0x31d2('0x4')]();var auth=require(_0x31d2('0x5'));var interaction=require(_0x31d2('0x6'));var config=require(_0x31d2('0x7'));var controller=require(_0x31d2('0x8'));router['get']('/',auth[_0x31d2('0x9')](),controller[_0x31d2('0xa')]);router['get'](_0x31d2('0xb'),auth['isAuthenticated'](),controller[_0x31d2('0xc')]);router[_0x31d2('0xd')]('/',auth[_0x31d2('0x9')](),controller['create']);router['post'](_0x31d2('0xe'),auth[_0x31d2('0x9')](),controller[_0x31d2('0xf')]);router[_0x31d2('0x10')](_0x31d2('0xb'),auth[_0x31d2('0x9')](),controller[_0x31d2('0x11')]);router[_0x31d2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x31d2('0x13')]);module[_0x31d2('0x14')]=router; \ No newline at end of file +var _0x5344=['../../config/environment','get','index','isAuthenticated','show','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48c998,_0x37d255){var _0x59c2a2=function(_0x40eaa2){while(--_0x40eaa2){_0x48c998['push'](_0x48c998['shift']());}};_0x59c2a2(++_0x37d255);}(_0x5344,0x1b0));var _0x4534=function(_0x5beb58,_0x1fdc14){_0x5beb58=_0x5beb58-0x0;var _0xfe5a15=_0x5344[_0x5beb58];return _0xfe5a15;};'use strict';var multer=require(_0x4534('0x0'));var util=require(_0x4534('0x1'));var path=require(_0x4534('0x2'));var timeout=require(_0x4534('0x3'));var express=require(_0x4534('0x4'));var router=express[_0x4534('0x5')]();var auth=require(_0x4534('0x6'));var interaction=require(_0x4534('0x7'));var config=require(_0x4534('0x8'));var controller=require('./voiceExtension.controller');router[_0x4534('0x9')]('/',auth['isAuthenticated'](),controller[_0x4534('0xa')]);router[_0x4534('0x9')]('/:id',auth[_0x4534('0xb')](),controller[_0x4534('0xc')]);router['post']('/',auth[_0x4534('0xb')](),controller[_0x4534('0xd')]);router['post'](_0x4534('0xe'),auth[_0x4534('0xb')](),controller[_0x4534('0xf')]);router[_0x4534('0x10')]('/:id',auth[_0x4534('0xb')](),controller['update']);router[_0x4534('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4534('0x12')]);module[_0x4534('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cf72e8c..f32ff0d 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(_0x44d542,_0x281279){var _0x47e667=function(_0x54ded0){while(--_0x54ded0){_0x44d542['push'](_0x44d542['shift']());}};_0x47e667(++_0x281279);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x274282,_0xbecdc){var _0x3ff7ce=function(_0x39520e){while(--_0x39520e){_0x274282['push'](_0x274282['shift']());}};_0x3ff7ce(++_0xbecdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 2745124..b37fdfd 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 _0x7880=['OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceExtension','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','length','catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','end','offset','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x3517d2,_0x7c36be){var _0x1e1171=function(_0x424bd4){while(--_0x424bd4){_0x3517d2['push'](_0x3517d2['shift']());}};_0x1e1171(++_0x7c36be);}(_0x7880,0x1f4));var _0x0788=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0x7880[_0x11ec6c];return _0xb59506;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var db=require(_0x0788('0x18'))['db'];config[_0x0788('0x19')]=_[_0x0788('0x1a')](config[_0x0788('0x19')],{'host':_0x0788('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0x19')]));require(_0x0788('0x1c'))[_0x0788('0x1d')](socket);function respondWithStatusCode(_0x13cf07,_0x51e5d3){_0x51e5d3=_0x51e5d3||0xcc;return function(_0x43ca01){if(_0x43ca01){return _0x13cf07['sendStatus'](_0x51e5d3);}return _0x13cf07[_0x0788('0x1e')](_0x51e5d3)[_0x0788('0x1f')]();};}function respondWithResult(_0x3fd1e4,_0xb406fb){_0xb406fb=_0xb406fb||0xc8;return function(_0x2ddd1a){if(_0x2ddd1a){return _0x3fd1e4[_0x0788('0x1e')](_0xb406fb)['json'](_0x2ddd1a);}};}function respondWithFilteredResult(_0x573822,_0x17d805){return function(_0x461d9d){if(_0x461d9d){var _0x5b2bdc=_0x461d9d['count'],_0x654e4b=_0x17d805[_0x0788('0x20')],_0x415f19=_0x17d805[_0x0788('0x20')]+_0x17d805['limit'],_0x17ae59;if(_0x415f19>=_0x5b2bdc){_0x415f19=_0x5b2bdc;_0x17ae59=0xc8;}else{_0x17ae59=0xce;}_0x573822[_0x0788('0x1e')](_0x17ae59);return _0x573822['set'](_0x0788('0x21'),_0x654e4b+'-'+_0x415f19+'/'+_0x5b2bdc)['json'](_0x461d9d);}return null;};}function patchUpdates(_0x17cca3){return function(_0x3c37ca){try{jsonpatch[_0x0788('0x22')](_0x3c37ca,_0x17cca3,!![]);}catch(_0x3cd197){return BPromise[_0x0788('0x23')](_0x3cd197);}return _0x3c37ca['save']();};}function saveUpdates(_0x48ec43,_0x2270d4){return function(_0x2a1460){if(_0x2a1460){return _0x2a1460[_0x0788('0x24')](_0x48ec43)[_0x0788('0x25')](function(_0x5ba1da){return _0x5ba1da;});}return null;};}function removeEntity(_0x4d5c93,_0x79204e){return function(_0x18cc33){if(_0x18cc33){return _0x18cc33[_0x0788('0x26')]()['then'](function(){var _0x4b2693=_0x18cc33[_0x0788('0x27')]({'plain':!![]});var _0xa1f7dc=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x0788('0x28'),'value':_0x0788('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x0788('0x2a'),'ignore':![]}];var _0x40e7a6=_(_0xa1f7dc)[_0x0788('0x2b')](_0x0788('0x2c'))[_0x0788('0x2d')](_0x0788('0x2e'))[_0x0788('0x2e')]();if(_[_0x0788('0x2f')](_0x40e7a6,_0x4b2693['type'])){return;}var _0x5a5178=_[_0x0788('0x30')](_0xa1f7dc,[_0x0788('0x2e'),_0x4b2693['type']])['name'];return db[_0x0788('0x31')][_0x0788('0x26')]({'where':{'type':_0x5a5178,'resourceId':_0x4b2693['id']}})[_0x0788('0x25')](function(){return _0x18cc33;});})[_0x0788('0x25')](function(){_0x4d5c93[_0x0788('0x1e')](0xcc)[_0x0788('0x1f')]();});}};}function handleEntityNotFound(_0x327d67,_0x36e077){return function(_0x28a50a){if(!_0x28a50a){_0x327d67[_0x0788('0x32')](0x194);}return _0x28a50a;};}function handleError(_0x5ec0ed,_0x2a08b7){_0x2a08b7=_0x2a08b7||0x1f4;return function(_0x1aab6a){logger[_0x0788('0x33')](_0x1aab6a[_0x0788('0x34')]);if(_0x1aab6a[_0x0788('0x35')]){delete _0x1aab6a[_0x0788('0x35')];}_0x5ec0ed[_0x0788('0x1e')](_0x2a08b7)[_0x0788('0x36')](_0x1aab6a);};}exports[_0x0788('0x37')]=function(_0xaed27e,_0x4fa055){var _0x4ae132={},_0x5947d3={},_0x5633da={'count':0x0,'rows':[]};var _0x516cce=_['map'](db[_0x0788('0x38')][_0x0788('0x39')],function(_0x2130e3){return{'name':_0x2130e3['fieldName'],'type':_0x2130e3[_0x0788('0x3a')][_0x0788('0x3b')]};});_0x5947d3[_0x0788('0x3c')]=_[_0x0788('0x2d')](_0x516cce,'name');_0x5947d3[_0x0788('0x3d')]=_['keys'](_0xaed27e[_0x0788('0x3d')]);_0x5947d3['filters']=_[_0x0788('0x3e')](_0x5947d3[_0x0788('0x3c')],_0x5947d3['query']);_0x4ae132[_0x0788('0x3f')]=_[_0x0788('0x3e')](_0x5947d3['model'],qs[_0x0788('0x40')](_0xaed27e['query'][_0x0788('0x40')]));_0x4ae132['attributes']=_0x4ae132[_0x0788('0x3f')]['length']?_0x4ae132[_0x0788('0x3f')]:_0x5947d3['model'];if(!_0xaed27e['query'][_0x0788('0x41')](_0x0788('0x42'))){_0x4ae132[_0x0788('0x43')]=qs[_0x0788('0x43')](_0xaed27e[_0x0788('0x3d')]['limit']);_0x4ae132['offset']=qs['offset'](_0xaed27e['query'][_0x0788('0x20')]);}_0x4ae132[_0x0788('0x44')]=qs[_0x0788('0x45')](_0xaed27e[_0x0788('0x3d')][_0x0788('0x45')]);_0x4ae132['where']=qs['filters'](_[_0x0788('0x46')](_0xaed27e[_0x0788('0x3d')],_0x5947d3[_0x0788('0x47')]),_0x516cce);if(_0xaed27e[_0x0788('0x3d')][_0x0788('0x2b')]){_0x4ae132[_0x0788('0x48')]=_[_0x0788('0x49')](_0x4ae132[_0x0788('0x48')],{'$or':_[_0x0788('0x2d')](_0x516cce,function(_0x50e8f5){if(_0x50e8f5['type']!==_0x0788('0x4a')){var _0x1d579d={};_0x1d579d[_0x50e8f5[_0x0788('0x35')]]={'$like':'%'+_0xaed27e['query']['filter']+'%'};return _0x1d579d;}})});}_0x4ae132=_['merge']({},_0x4ae132,_0xaed27e[_0x0788('0x4b')]);var _0x150c1e={'where':_0x4ae132[_0x0788('0x48')]};return db[_0x0788('0x38')][_0x0788('0x4c')](_0x150c1e)[_0x0788('0x25')](function(_0x1ab634){_0x5633da[_0x0788('0x4c')]=_0x1ab634;if(_0xaed27e['query'][_0x0788('0x4d')]){_0x4ae132[_0x0788('0x4e')]=[{'all':!![]}];}return db[_0x0788('0x38')][_0x0788('0x4f')](_0x4ae132);})['then'](function(_0x6aa745){_0x5633da[_0x0788('0x50')]=_0x6aa745;return _0x5633da;})['then'](respondWithFilteredResult(_0x4fa055,_0x4ae132))['catch'](handleError(_0x4fa055,null));};exports['show']=function(_0xad94dc,_0x5e010a){var _0x474027={'raw':![],'where':{'id':_0xad94dc[_0x0788('0x51')]['id']}},_0x2c5e0a={};_0x2c5e0a[_0x0788('0x3c')]=_[_0x0788('0x52')](db[_0x0788('0x38')][_0x0788('0x39')]);_0x2c5e0a[_0x0788('0x3d')]=_['keys'](_0xad94dc['query']);_0x2c5e0a[_0x0788('0x47')]=_[_0x0788('0x3e')](_0x2c5e0a[_0x0788('0x3c')],_0x2c5e0a['query']);_0x474027[_0x0788('0x3f')]=_[_0x0788('0x3e')](_0x2c5e0a[_0x0788('0x3c')],qs[_0x0788('0x40')](_0xad94dc[_0x0788('0x3d')]['fields']));_0x474027['attributes']=_0x474027[_0x0788('0x3f')][_0x0788('0x53')]?_0x474027['attributes']:_0x2c5e0a[_0x0788('0x3c')];if(_0xad94dc['query'][_0x0788('0x4d')]){_0x474027[_0x0788('0x4e')]=[{'all':!![]}];}_0x474027=_[_0x0788('0x49')]({},_0x474027,_0xad94dc[_0x0788('0x4b')]);return db[_0x0788('0x38')][_0x0788('0x30')](_0x474027)[_0x0788('0x25')](handleEntityNotFound(_0x5e010a,null))[_0x0788('0x25')](respondWithResult(_0x5e010a,null))['catch'](handleError(_0x5e010a,null));};exports[_0x0788('0x26')]=function(_0x363ab9,_0x3f2f1b){return db['VoiceExtension'][_0x0788('0x30')]({'where':{'id':_0x363ab9[_0x0788('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f2f1b,null))[_0x0788('0x25')](removeEntity(_0x3f2f1b,null))[_0x0788('0x54')](handleError(_0x3f2f1b,null));};exports[_0x0788('0x55')]=function(_0x1192b4,_0x137e24){if(_0x1192b4[_0x0788('0x56')]['type']==='outbound'&&!_[_0x0788('0x57')](_0x1192b4[_0x0788('0x56')]['exten'],'_')){_0x1192b4[_0x0788('0x56')][_0x0788('0x58')]='_'[_0x0788('0x59')](_0x1192b4[_0x0788('0x56')][_0x0788('0x58')]);}return db[_0x0788('0x38')][_0x0788('0x55')](_0x1192b4[_0x0788('0x56')],{'raw':![]})[_0x0788('0x25')](function(_0x395398){var _0x25b44a=_0x1192b4[_0x0788('0x5a')]['get']({'plain':!![]});if(!_0x25b44a)throw new Error(_0x0788('0x5b'));if(_0x25b44a[_0x0788('0x5c')]===_0x0788('0x5a')){var _0x5ba197=_0x395398[_0x0788('0x27')]({'plain':!![]});var _0x329d44=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x0788('0x28'),'value':_0x0788('0x29')},{'name':_0x0788('0x5d'),'value':_0x0788('0x2a')}];var _0x2c0bcc=_[_0x0788('0x30')](_0x329d44,['value',_0x5ba197[_0x0788('0x3a')]])[_0x0788('0x35')];return db[_0x0788('0x5e')]['find']({'where':{'name':_0x2c0bcc,'userProfileId':_0x25b44a['userProfileId']},'raw':!![]})[_0x0788('0x25')](function(_0x5419d9){if(_0x5419d9&&_0x5419d9[_0x0788('0x5f')]===0x0){return db[_0x0788('0x31')][_0x0788('0x55')]({'name':_0x5ba197[_0x0788('0x35')],'resourceId':_0x5ba197['id'],'type':_0x5419d9[_0x0788('0x35')],'sectionId':_0x5419d9['id']},{})[_0x0788('0x25')](function(){return _0x395398;});}else{return _0x395398;}})[_0x0788('0x54')](function(_0x29c912){logger[_0x0788('0x33')](_0x0788('0x60'),_0x29c912);throw _0x29c912;});}return _0x395398;})['then'](respondWithResult(_0x137e24,0xc9))[_0x0788('0x54')](handleError(_0x137e24,null));};exports[_0x0788('0x24')]=function(_0x602e3b,_0x2822aa){if(_0x602e3b['body']['id']){delete _0x602e3b[_0x0788('0x56')]['id'];}return db[_0x0788('0x38')][_0x0788('0x30')]({'where':{'id':_0x602e3b[_0x0788('0x51')]['id']}})[_0x0788('0x25')](handleEntityNotFound(_0x2822aa,null))['then'](function(_0xf2031){if(_0xf2031){return db['VoiceExtension'][_0x0788('0x24')](_[_0x0788('0x46')](_0x602e3b[_0x0788('0x56')],[_0x0788('0x58'),_0x0788('0x61'),_0x0788('0x62'),_0x0788('0x63'),_0x0788('0x64'),_0x0788('0x65')]),{'where':{'context':_0xf2031['context'],'exten':_0xf2031[_0x0788('0x58')]},'individualHooks':!![]})[_0x0788('0x25')](function(_0x60e880){return _0x60e880;});}return null;})['then'](respondWithStatusCode(_0x2822aa,null))['catch'](handleError(_0x2822aa,null));};exports[_0x0788('0x66')]=function(_0x1bb234,_0x31ed44,_0x51baa4){return db[_0x0788('0x38')][_0x0788('0x67')]({'where':{'id':_0x1bb234[_0x0788('0x51')]['id']}})[_0x0788('0x25')](handleEntityNotFound(_0x31ed44,null))['then'](function(_0x5c2feb){if(_0x5c2feb){return db['sequelize'][_0x0788('0x68')](function(_0x2a55f2){return db[_0x0788('0x38')]['destroy']({'where':{'VoiceExtensionId':_0x1bb234['params']['id']},'transaction':_0x2a55f2})[_0x0788('0x25')](function(_0x56c4bc){var _0x955bfa=_[_0x0788('0x2d')](_0x1bb234[_0x0788('0x56')],function(_0x12ed24){_0x12ed24[_0x0788('0x69')]=_0x1bb234[_0x0788('0x51')]['id'];return _0x12ed24;});return db[_0x0788('0x38')][_0x0788('0x6a')](_0x955bfa,{'transaction':_0x2a55f2});});})[_0x0788('0x25')](function(){return db[_0x0788('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1bb234[_0x0788('0x51')]['id']},'order':_0x0788('0x6b')});});}})['then'](respondWithResult(_0x31ed44,null))['catch'](handleError(_0x31ed44,null));}; \ No newline at end of file +var _0x4975=['rows','catch','show','body','startsWith','exten','concat','user','get','role','userProfileId','autoAssociation','error','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','params','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','includes','find','value','type','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x4975,0x86));var _0x5497=function(_0xd3f88c,_0x825fb1){_0xd3f88c=_0xd3f88c-0x0;var _0x249864=_0x4975[_0xd3f88c];return _0x249864;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5497('0x18')]=_[_0x5497('0x19')](config[_0x5497('0x18')],{'host':_0x5497('0x1a'),'port':0x18eb});var socket=require(_0x5497('0x1b'))(new Redis(config[_0x5497('0x18')]));require(_0x5497('0x1c'))[_0x5497('0x1d')](socket);function respondWithStatusCode(_0x363a5b,_0x1a4c74){_0x1a4c74=_0x1a4c74||0xcc;return function(_0x55f590){if(_0x55f590){return _0x363a5b[_0x5497('0x1e')](_0x1a4c74);}return _0x363a5b['status'](_0x1a4c74)[_0x5497('0x1f')]();};}function respondWithResult(_0x2bfd8a,_0x19e5f3){_0x19e5f3=_0x19e5f3||0xc8;return function(_0x3ce50b){if(_0x3ce50b){return _0x2bfd8a[_0x5497('0x20')](_0x19e5f3)[_0x5497('0x21')](_0x3ce50b);}};}function respondWithFilteredResult(_0x2f2997,_0x575f6b){return function(_0x56a788){if(_0x56a788){var _0x3f4d20=_0x56a788[_0x5497('0x22')],_0x1bf442=_0x575f6b[_0x5497('0x23')],_0x3a47fd=_0x575f6b[_0x5497('0x23')]+_0x575f6b[_0x5497('0x24')],_0x5d9e24;if(_0x3a47fd>=_0x3f4d20){_0x3a47fd=_0x3f4d20;_0x5d9e24=0xc8;}else{_0x5d9e24=0xce;}_0x2f2997[_0x5497('0x20')](_0x5d9e24);return _0x2f2997[_0x5497('0x25')](_0x5497('0x26'),_0x1bf442+'-'+_0x3a47fd+'/'+_0x3f4d20)[_0x5497('0x21')](_0x56a788);}return null;};}function patchUpdates(_0x2e3960){return function(_0x3f54ef){try{jsonpatch[_0x5497('0x27')](_0x3f54ef,_0x2e3960,!![]);}catch(_0x52c049){return BPromise[_0x5497('0x28')](_0x52c049);}return _0x3f54ef['save']();};}function saveUpdates(_0x19200a,_0xd0868d){return function(_0x44265c){if(_0x44265c){return _0x44265c[_0x5497('0x29')](_0x19200a)[_0x5497('0x2a')](function(_0x3b2fbc){return _0x3b2fbc;});}return null;};}function removeEntity(_0x5018fa,_0x54043a){return function(_0x1eefce){if(_0x1eefce){return _0x1eefce[_0x5497('0x2b')]()[_0x5497('0x2a')](function(){var _0x281155=_0x1eefce['get']({'plain':!![]});var _0x13b7a4=[{'name':'InboundRoutes','value':_0x5497('0x2c'),'ignore':![]},{'name':_0x5497('0x2d'),'value':_0x5497('0x2e'),'ignore':![]},{'name':_0x5497('0x2f'),'value':_0x5497('0x30'),'ignore':![]}];var _0x31cd01=_(_0x13b7a4)['filter'](_0x5497('0x31'))['map']('value')['value']();if(_[_0x5497('0x32')](_0x31cd01,_0x281155['type'])){return;}var _0x5e9356=_[_0x5497('0x33')](_0x13b7a4,[_0x5497('0x34'),_0x281155[_0x5497('0x35')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x5e9356,'resourceId':_0x281155['id']}})[_0x5497('0x2a')](function(){return _0x1eefce;});})[_0x5497('0x2a')](function(){_0x5018fa[_0x5497('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x489f71,_0x594866){return function(_0xa28dd8){if(!_0xa28dd8){_0x489f71['sendStatus'](0x194);}return _0xa28dd8;};}function handleError(_0x438ee4,_0x258c2d){_0x258c2d=_0x258c2d||0x1f4;return function(_0x77c575){logger['error'](_0x77c575[_0x5497('0x36')]);if(_0x77c575[_0x5497('0x37')]){delete _0x77c575['name'];}_0x438ee4[_0x5497('0x20')](_0x258c2d)[_0x5497('0x38')](_0x77c575);};}exports[_0x5497('0x39')]=function(_0x489fbd,_0x3395f6){var _0x2fe1f2={},_0x125d51={},_0x362b96={'count':0x0,'rows':[]};var _0x412f5b=_['map'](db[_0x5497('0x3a')][_0x5497('0x3b')],function(_0x558a70){return{'name':_0x558a70[_0x5497('0x3c')],'type':_0x558a70[_0x5497('0x35')][_0x5497('0x3d')]};});_0x125d51[_0x5497('0x3e')]=_[_0x5497('0x3f')](_0x412f5b,_0x5497('0x37'));_0x125d51['query']=_[_0x5497('0x40')](_0x489fbd['query']);_0x125d51[_0x5497('0x41')]=_[_0x5497('0x42')](_0x125d51[_0x5497('0x3e')],_0x125d51['query']);_0x2fe1f2['attributes']=_[_0x5497('0x42')](_0x125d51[_0x5497('0x3e')],qs[_0x5497('0x43')](_0x489fbd[_0x5497('0x44')][_0x5497('0x43')]));_0x2fe1f2[_0x5497('0x45')]=_0x2fe1f2['attributes'][_0x5497('0x46')]?_0x2fe1f2[_0x5497('0x45')]:_0x125d51[_0x5497('0x3e')];if(!_0x489fbd[_0x5497('0x44')][_0x5497('0x47')](_0x5497('0x48'))){_0x2fe1f2[_0x5497('0x24')]=qs[_0x5497('0x24')](_0x489fbd[_0x5497('0x44')]['limit']);_0x2fe1f2[_0x5497('0x23')]=qs[_0x5497('0x23')](_0x489fbd[_0x5497('0x44')][_0x5497('0x23')]);}_0x2fe1f2[_0x5497('0x49')]=qs[_0x5497('0x4a')](_0x489fbd[_0x5497('0x44')]['sort']);_0x2fe1f2[_0x5497('0x4b')]=qs[_0x5497('0x41')](_[_0x5497('0x4c')](_0x489fbd[_0x5497('0x44')],_0x125d51[_0x5497('0x41')]),_0x412f5b);if(_0x489fbd[_0x5497('0x44')][_0x5497('0x4d')]){_0x2fe1f2['where']=_[_0x5497('0x4e')](_0x2fe1f2[_0x5497('0x4b')],{'$or':_[_0x5497('0x3f')](_0x412f5b,function(_0x1e6389){if(_0x1e6389[_0x5497('0x35')]!==_0x5497('0x4f')){var _0xc1a999={};_0xc1a999[_0x1e6389[_0x5497('0x37')]]={'$like':'%'+_0x489fbd[_0x5497('0x44')][_0x5497('0x4d')]+'%'};return _0xc1a999;}})});}_0x2fe1f2=_['merge']({},_0x2fe1f2,_0x489fbd[_0x5497('0x50')]);var _0x4a9fd7={'where':_0x2fe1f2[_0x5497('0x4b')]};return db[_0x5497('0x3a')][_0x5497('0x22')](_0x4a9fd7)[_0x5497('0x2a')](function(_0x133746){_0x362b96['count']=_0x133746;if(_0x489fbd[_0x5497('0x44')][_0x5497('0x51')]){_0x2fe1f2['include']=[{'all':!![]}];}return db[_0x5497('0x3a')]['findAll'](_0x2fe1f2);})[_0x5497('0x2a')](function(_0x4aa6b8){_0x362b96[_0x5497('0x52')]=_0x4aa6b8;return _0x362b96;})[_0x5497('0x2a')](respondWithFilteredResult(_0x3395f6,_0x2fe1f2))[_0x5497('0x53')](handleError(_0x3395f6,null));};exports[_0x5497('0x54')]=function(_0xbf2f0,_0x5bf06d){var _0x495068={'raw':![],'where':{'id':_0xbf2f0['params']['id']}},_0x498de5={};_0x498de5[_0x5497('0x3e')]=_[_0x5497('0x40')](db[_0x5497('0x3a')][_0x5497('0x3b')]);_0x498de5[_0x5497('0x44')]=_[_0x5497('0x40')](_0xbf2f0[_0x5497('0x44')]);_0x498de5[_0x5497('0x41')]=_[_0x5497('0x42')](_0x498de5['model'],_0x498de5[_0x5497('0x44')]);_0x495068[_0x5497('0x45')]=_[_0x5497('0x42')](_0x498de5['model'],qs[_0x5497('0x43')](_0xbf2f0['query'][_0x5497('0x43')]));_0x495068[_0x5497('0x45')]=_0x495068[_0x5497('0x45')]['length']?_0x495068[_0x5497('0x45')]:_0x498de5[_0x5497('0x3e')];if(_0xbf2f0['query'][_0x5497('0x51')]){_0x495068['include']=[{'all':!![]}];}_0x495068=_[_0x5497('0x4e')]({},_0x495068,_0xbf2f0['options']);return db[_0x5497('0x3a')][_0x5497('0x33')](_0x495068)[_0x5497('0x2a')](handleEntityNotFound(_0x5bf06d,null))[_0x5497('0x2a')](respondWithResult(_0x5bf06d,null))[_0x5497('0x53')](handleError(_0x5bf06d,null));};exports[_0x5497('0x2b')]=function(_0x6583f1,_0x2a6e4d){return db['VoiceExtension'][_0x5497('0x33')]({'where':{'id':_0x6583f1['params']['id']}})['then'](handleEntityNotFound(_0x2a6e4d,null))[_0x5497('0x2a')](removeEntity(_0x2a6e4d,null))[_0x5497('0x53')](handleError(_0x2a6e4d,null));};exports['create']=function(_0x2ddccd,_0x3df816){if(_0x2ddccd[_0x5497('0x55')][_0x5497('0x35')]==='outbound'&&!_[_0x5497('0x56')](_0x2ddccd['body']['exten'],'_')){_0x2ddccd[_0x5497('0x55')][_0x5497('0x57')]='_'[_0x5497('0x58')](_0x2ddccd['body']['exten']);}return db[_0x5497('0x3a')]['create'](_0x2ddccd[_0x5497('0x55')],{'raw':![]})['then'](function(_0x3f50ae){var _0x5b9e57=_0x2ddccd[_0x5497('0x59')][_0x5497('0x5a')]({'plain':!![]});if(!_0x5b9e57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b9e57[_0x5497('0x5b')]==='user'){var _0x506d69=_0x3f50ae[_0x5497('0x5a')]({'plain':!![]});var _0x5541b4=[{'name':'InboundRoutes','value':_0x5497('0x2c')},{'name':_0x5497('0x2d'),'value':_0x5497('0x2e')},{'name':_0x5497('0x2f'),'value':_0x5497('0x30')}];var _0x25c75e=_['find'](_0x5541b4,[_0x5497('0x34'),_0x506d69['type']])['name'];return db['UserProfileSection'][_0x5497('0x33')]({'where':{'name':_0x25c75e,'userProfileId':_0x5b9e57[_0x5497('0x5c')]},'raw':!![]})[_0x5497('0x2a')](function(_0x544085){if(_0x544085&&_0x544085[_0x5497('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x506d69[_0x5497('0x37')],'resourceId':_0x506d69['id'],'type':_0x544085[_0x5497('0x37')],'sectionId':_0x544085['id']},{})[_0x5497('0x2a')](function(){return _0x3f50ae;});}else{return _0x3f50ae;}})[_0x5497('0x53')](function(_0x3afcf8){logger[_0x5497('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3afcf8);throw _0x3afcf8;});}return _0x3f50ae;})[_0x5497('0x2a')](respondWithResult(_0x3df816,0xc9))[_0x5497('0x53')](handleError(_0x3df816,null));};exports[_0x5497('0x29')]=function(_0xc783ce,_0x4b86a8){if(_0xc783ce[_0x5497('0x55')]['id']){delete _0xc783ce[_0x5497('0x55')]['id'];}return db[_0x5497('0x3a')][_0x5497('0x33')]({'where':{'id':_0xc783ce['params']['id']}})[_0x5497('0x2a')](handleEntityNotFound(_0x4b86a8,null))[_0x5497('0x2a')](function(_0x1516c8){if(_0x1516c8){return db['VoiceExtension'][_0x5497('0x29')](_['pick'](_0xc783ce['body'],['exten',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61'),'cutdigits',_0x5497('0x62')]),{'where':{'context':_0x1516c8[_0x5497('0x5f')],'exten':_0x1516c8[_0x5497('0x57')]},'individualHooks':!![]})[_0x5497('0x2a')](function(_0x4fec68){return _0x4fec68;});}return null;})[_0x5497('0x2a')](respondWithStatusCode(_0x4b86a8,null))[_0x5497('0x53')](handleError(_0x4b86a8,null));};exports[_0x5497('0x63')]=function(_0x49617c,_0x164de1,_0x465bed){return db[_0x5497('0x3a')][_0x5497('0x64')]({'where':{'id':_0x49617c[_0x5497('0x65')]['id']}})[_0x5497('0x2a')](handleEntityNotFound(_0x164de1,null))[_0x5497('0x2a')](function(_0x4b4cfe){if(_0x4b4cfe){return db[_0x5497('0x66')][_0x5497('0x67')](function(_0x32a5bf){return db[_0x5497('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x49617c['params']['id']},'transaction':_0x32a5bf})['then'](function(_0x305d5b){var _0x1d1405=_[_0x5497('0x3f')](_0x49617c['body'],function(_0xc7fa29){_0xc7fa29[_0x5497('0x68')]=_0x49617c[_0x5497('0x65')]['id'];return _0xc7fa29;});return db[_0x5497('0x3a')][_0x5497('0x69')](_0x1d1405,{'transaction':_0x32a5bf});});})[_0x5497('0x2a')](function(){return db[_0x5497('0x3a')][_0x5497('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x49617c[_0x5497('0x65')]['id']},'order':_0x5497('0x6b')});});}})[_0x5497('0x2a')](respondWithResult(_0x164de1,null))['catch'](handleError(_0x164de1,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0953e8f..9c9e95b 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 _0xb067=['hasOwnProperty','exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x241eb9,_0x5ccc3f){var _0x4f916b=function(_0x412d98){while(--_0x412d98){_0x241eb9['push'](_0x241eb9['shift']());}};_0x4f916b(++_0x5ccc3f);}(_0xb067,0x13d));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7b06('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x7b06('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7b06('0x2')](0x0);var events={'afterCreate':_0x7b06('0x3'),'afterUpdate':_0x7b06('0x4'),'afterDestroy':_0x7b06('0x5')};function emitEvent(_0x178cc4){return function(_0x24603f,_0x85516e,_0x3a2353){VoiceExtensionEvents[_0x7b06('0x6')](_0x178cc4+':'+_0x24603f['id'],_0x24603f);VoiceExtensionEvents[_0x7b06('0x6')](_0x178cc4,_0x24603f);_0x3a2353(null);};}for(var e in events){if(events[_0x7b06('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x7b06('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x21b3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3a72af,_0x8945ab){var _0x277713=function(_0x3a8680){while(--_0x3a8680){_0x3a72af['push'](_0x3a72af['shift']());}};_0x277713(++_0x8945ab);}(_0x21b3,0x130));var _0x321b=function(_0x1c8368,_0x6c0a9d){_0x1c8368=_0x1c8368-0x0;var _0x90ee9=_0x21b3[_0x1c8368];return _0x90ee9;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x321b('0x0')](0x0);var events={'afterCreate':_0x321b('0x1'),'afterUpdate':_0x321b('0x2'),'afterDestroy':_0x321b('0x3')};function emitEvent(_0x16224d){return function(_0x36981f,_0x5dc753,_0xe68ee){VoiceExtensionEvents[_0x321b('0x4')](_0x16224d+':'+_0x36981f['id'],_0x36981f);VoiceExtensionEvents[_0x321b('0x4')](_0x16224d,_0x36981f);_0xe68ee(null);};}for(var e in events){if(events[_0x321b('0x5')](e)){var event=events[e];VoiceExtension[_0x321b('0x6')](e,emitEvent(event));}}module[_0x321b('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 458babc..f78948c 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x1ac5b9,_0x10b4bb){var _0x13a80d=function(_0xbffe00){while(--_0xbffe00){_0x1ac5b9['push'](_0x1ac5b9['shift']());}};_0x13a80d(++_0x10b4bb);}(_0x7a54,0x106));var _0x47a5=function(_0x1cd5e5,_0x39d2b2){_0x1cd5e5=_0x1cd5e5-0x0;var _0x46e91c=_0x7a54[_0x1cd5e5];return _0x46e91c;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['path','rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0x1967,0x173));var _0x7196=function(_0x59a373,_0x2bb752){_0x59a373=_0x59a373-0x0;var _0x1879de=_0x1967[_0x59a373];return _0x1879de;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'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 0cab98d..2fe5e82 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 _0x564c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','findAll','options','raw','include','model','attributes','map','GetVoiceExtension'];(function(_0x283152,_0x468a35){var _0x6cb80d=function(_0x17598a){while(--_0x17598a){_0x283152['push'](_0x283152['shift']());}};_0x6cb80d(++_0x468a35);}(_0x564c,0xc0));var _0xc564=function(_0xbcea1,_0x469f9f){_0xbcea1=_0xbcea1-0x0;var _0x17fb47=_0x564c[_0xbcea1];return _0x17fb47;};'use strict';var _=require(_0xc564('0x0'));var util=require(_0xc564('0x1'));var moment=require(_0xc564('0x2'));var BPromise=require(_0xc564('0x3'));var rs=require(_0xc564('0x4'));var fs=require('fs');var Redis=require(_0xc564('0x5'));var db=require(_0xc564('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc564('0x7'))(_0xc564('0x8'));var config=require(_0xc564('0x9'));var jayson=require(_0xc564('0xa'));var client=jayson[_0xc564('0xb')][_0xc564('0xc')]({'port':0x232a});config[_0xc564('0xd')]=_['defaults'](config[_0xc564('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc564('0xd')]));require(_0xc564('0xe'))[_0xc564('0xf')](socket);function respondWithRpcPromise(_0x3e7b8d,_0x2b2111,_0x52884e){return new BPromise(function(_0x214c5d,_0x7bb23f){return client['request'](_0x3e7b8d,_0x52884e)[_0xc564('0x10')](function(_0x51e129){logger[_0xc564('0x11')](_0xc564('0x12'),_0x2b2111,_0xc564('0x13'));logger[_0xc564('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2b2111,_0xc564('0x13'),JSON[_0xc564('0x15')](_0x51e129));if(_0x51e129[_0xc564('0x16')]){if(_0x51e129[_0xc564('0x16')]['code']===0x1f4){logger[_0xc564('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x2b2111,_0x51e129[_0xc564('0x16')][_0xc564('0x17')]);return _0x7bb23f(_0x51e129[_0xc564('0x16')]['message']);}logger[_0xc564('0x16')](_0xc564('0x12'),_0x2b2111,_0x51e129[_0xc564('0x16')]['message']);return _0x214c5d(_0x51e129['error']['message']);}else{logger[_0xc564('0x11')](_0xc564('0x12'),_0x2b2111,'request\x20sent');_0x214c5d(_0x51e129['result'][_0xc564('0x17')]);}})['catch'](function(_0x3404a8){logger[_0xc564('0x16')](_0xc564('0x12'),_0x2b2111,_0x3404a8);_0x7bb23f(_0x3404a8);});});}exports['GetVoiceExtension']=function(_0xce12d){var _0x2727a6=this;return new Promise(function(_0x2e6a8f,_0x49d524){return db['VoiceExtension'][_0xc564('0x18')]({'raw':_0xce12d['options']?_0xce12d[_0xc564('0x19')][_0xc564('0x1a')]===undefined?!![]:![]:!![],'where':_0xce12d[_0xc564('0x19')]?_0xce12d[_0xc564('0x19')]['where']||null:null,'attributes':_0xce12d[_0xc564('0x19')]?_0xce12d[_0xc564('0x19')]['attributes']||null:null,'limit':_0xce12d['options']?_0xce12d[_0xc564('0x19')]['limit']||null:null,'include':_0xce12d[_0xc564('0x19')]?_0xce12d[_0xc564('0x19')]['include']?_['map'](_0xce12d[_0xc564('0x19')][_0xc564('0x1b')],function(_0x19e9d2){return{'model':db[_0x19e9d2[_0xc564('0x1c')]],'as':_0x19e9d2['as'],'attributes':_0x19e9d2[_0xc564('0x1d')],'include':_0x19e9d2[_0xc564('0x1b')]?_[_0xc564('0x1e')](_0x19e9d2['include'],function(_0x38243d){return{'model':db[_0x38243d['model']],'as':_0x38243d['as'],'attributes':_0x38243d[_0xc564('0x1d')],'include':_0x38243d[_0xc564('0x1b')]?_[_0xc564('0x1e')](_0x38243d[_0xc564('0x1b')],function(_0xad5d){return{'model':db[_0xad5d[_0xc564('0x1c')]],'as':_0xad5d['as'],'attributes':_0xad5d[_0xc564('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc564('0x10')](function(_0x20d293){logger[_0xc564('0x11')](_0xc564('0x1f'),_0xce12d);logger[_0xc564('0x14')](_0xc564('0x1f'),_0xce12d,JSON[_0xc564('0x15')](_0x20d293));_0x2e6a8f(_0x20d293);})['catch'](function(_0x3ecde3){logger[_0xc564('0x16')](_0xc564('0x1f'),_0x3ecde3[_0xc564('0x17')],_0xce12d);_0x49d524(_0x2727a6[_0xc564('0x16')](0x1f4,_0x3ecde3[_0xc564('0x17')]));});});}; \ No newline at end of file +var _0x80f8=['VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug'];(function(_0x7750c9,_0x205ccc){var _0x57f2c0=function(_0x2bfc70){while(--_0x2bfc70){_0x7750c9['push'](_0x7750c9['shift']());}};_0x57f2c0(++_0x205ccc);}(_0x80f8,0x101));var _0x880f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x80f8[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x880f('0x0'));var util=require('util');var moment=require(_0x880f('0x1'));var BPromise=require(_0x880f('0x2'));var rs=require(_0x880f('0x3'));var fs=require('fs');var Redis=require(_0x880f('0x4'));var db=require(_0x880f('0x5'))['db'];var utils=require(_0x880f('0x6'));var logger=require(_0x880f('0x7'))(_0x880f('0x8'));var config=require(_0x880f('0x9'));var jayson=require(_0x880f('0xa'));var client=jayson[_0x880f('0xb')][_0x880f('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x880f('0xd')],{'host':_0x880f('0xe'),'port':0x18eb});var socket=require(_0x880f('0xf'))(new Redis(config[_0x880f('0xd')]));require(_0x880f('0x10'))[_0x880f('0x11')](socket);function respondWithRpcPromise(_0x59b77a,_0x11c54f,_0x3bff8f){return new BPromise(function(_0x4d5bf8,_0x18655d){return client[_0x880f('0x12')](_0x59b77a,_0x3bff8f)[_0x880f('0x13')](function(_0x4f5396){logger[_0x880f('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x11c54f,_0x880f('0x15'));logger[_0x880f('0x16')](_0x880f('0x17'),_0x11c54f,_0x880f('0x15'),JSON[_0x880f('0x18')](_0x4f5396));if(_0x4f5396[_0x880f('0x19')]){if(_0x4f5396['error'][_0x880f('0x1a')]===0x1f4){logger[_0x880f('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x11c54f,_0x4f5396[_0x880f('0x19')][_0x880f('0x1b')]);return _0x18655d(_0x4f5396[_0x880f('0x19')][_0x880f('0x1b')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x11c54f,_0x4f5396['error'][_0x880f('0x1b')]);return _0x4d5bf8(_0x4f5396['error'][_0x880f('0x1b')]);}else{logger[_0x880f('0x14')](_0x880f('0x1c'),_0x11c54f,_0x880f('0x15'));_0x4d5bf8(_0x4f5396[_0x880f('0x1d')][_0x880f('0x1b')]);}})[_0x880f('0x1e')](function(_0x150b69){logger[_0x880f('0x19')](_0x880f('0x1c'),_0x11c54f,_0x150b69);_0x18655d(_0x150b69);});});}exports[_0x880f('0x1f')]=function(_0x160f4a){var _0xd9d303=this;return new Promise(function(_0x4c79a4,_0x7f6fa0){return db[_0x880f('0x20')][_0x880f('0x21')]({'raw':_0x160f4a[_0x880f('0x22')]?_0x160f4a[_0x880f('0x22')][_0x880f('0x23')]===undefined?!![]:![]:!![],'where':_0x160f4a[_0x880f('0x22')]?_0x160f4a[_0x880f('0x22')]['where']||null:null,'attributes':_0x160f4a['options']?_0x160f4a[_0x880f('0x22')]['attributes']||null:null,'limit':_0x160f4a['options']?_0x160f4a[_0x880f('0x22')]['limit']||null:null,'include':_0x160f4a[_0x880f('0x22')]?_0x160f4a['options'][_0x880f('0x24')]?_[_0x880f('0x25')](_0x160f4a[_0x880f('0x22')][_0x880f('0x24')],function(_0x1488bf){return{'model':db[_0x1488bf[_0x880f('0x26')]],'as':_0x1488bf['as'],'attributes':_0x1488bf[_0x880f('0x27')],'include':_0x1488bf[_0x880f('0x24')]?_[_0x880f('0x25')](_0x1488bf[_0x880f('0x24')],function(_0x4d4517){return{'model':db[_0x4d4517[_0x880f('0x26')]],'as':_0x4d4517['as'],'attributes':_0x4d4517[_0x880f('0x27')],'include':_0x4d4517[_0x880f('0x24')]?_[_0x880f('0x25')](_0x4d4517[_0x880f('0x24')],function(_0x6ca7cb){return{'model':db[_0x6ca7cb['model']],'as':_0x6ca7cb['as'],'attributes':_0x6ca7cb[_0x880f('0x27')]};}):[]};}):[]};}):[]:[]})[_0x880f('0x13')](function(_0x2253bc){logger[_0x880f('0x14')]('GetVoiceExtension',_0x160f4a);logger[_0x880f('0x16')](_0x880f('0x1f'),_0x160f4a,JSON[_0x880f('0x18')](_0x2253bc));_0x4c79a4(_0x2253bc);})[_0x880f('0x1e')](function(_0x4bc005){logger['error'](_0x880f('0x1f'),_0x4bc005[_0x880f('0x1b')],_0x160f4a);_0x7f6fa0(_0xd9d303[_0x880f('0x19')](0x1f4,_0x4bc005[_0x880f('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 916ddb8..b8df2fb 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 _0xfee7=['voiceExtension:','./voiceExtension.events','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfee7,0x104));var _0x7fee=function(_0x448388,_0x15697d){_0x448388=_0x448388-0x0;var _0x2902ed=_0xfee7[_0x448388];return _0x2902ed;};'use strict';var VoiceExtensionEvents=require(_0x7fee('0x0'));var events=['save',_0x7fee('0x1'),'update'];function createListener(_0x158334,_0x20b9e7){return function(_0x2b10bf){_0x20b9e7[_0x7fee('0x2')](_0x158334,_0x2b10bf);};}function removeListener(_0x224336,_0x1ebb55){return function(){VoiceExtensionEvents[_0x7fee('0x3')](_0x224336,_0x1ebb55);};}exports[_0x7fee('0x4')]=function(_0xd638c1){for(var _0x4a4dfe=0x0,_0x5a144e=events[_0x7fee('0x5')];_0x4a4dfe<_0x5a144e;_0x4a4dfe++){var _0x33d92e=events[_0x4a4dfe];var _0x19a50d=createListener(_0x7fee('0x6')+_0x33d92e,_0xd638c1);VoiceExtensionEvents['on'](_0x33d92e,_0x19a50d);}}; \ No newline at end of file +var _0x9cd6=['voiceExtension:','save','update','removeListener','length'];(function(_0xd77110,_0x2523a9){var _0x423bf6=function(_0x1d857f){while(--_0x1d857f){_0xd77110['push'](_0xd77110['shift']());}};_0x423bf6(++_0x2523a9);}(_0x9cd6,0x187));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x69cd('0x0'),'remove',_0x69cd('0x1')];function createListener(_0x22d178,_0x495497){return function(_0x5a7a5b){_0x495497['emit'](_0x22d178,_0x5a7a5b);};}function removeListener(_0x55cd39,_0x330908){return function(){VoiceExtensionEvents[_0x69cd('0x2')](_0x55cd39,_0x330908);};}exports['register']=function(_0x243d60){for(var _0x37bddc=0x0,_0x52aadd=events[_0x69cd('0x3')];_0x37bddc<_0x52aadd;_0x37bddc++){var _0x114f2c=events[_0x37bddc];var _0x454085=createListener(_0x69cd('0x4')+_0x114f2c,_0x243d60);VoiceExtensionEvents['on'](_0x114f2c,_0x454085);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index e9cab5b..f8d116d 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 _0x48a3=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','getMessages','post','create','put','/:id','update','exports','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x48a3,0x1ed));var _0x348a=function(_0x533ffd,_0x547e7b){_0x533ffd=_0x533ffd-0x0;var _0x1069f5=_0x48a3[_0x533ffd];return _0x1069f5;};'use strict';var multer=require(_0x348a('0x0'));var util=require(_0x348a('0x1'));var path=require('path');var timeout=require(_0x348a('0x2'));var express=require(_0x348a('0x3'));var router=express['Router']();var auth=require(_0x348a('0x4'));var interaction=require(_0x348a('0x5'));var config=require(_0x348a('0x6'));var controller=require(_0x348a('0x7'));router['get']('/',auth[_0x348a('0x8')](),controller[_0x348a('0x9')]);router[_0x348a('0xa')]('/:id',auth[_0x348a('0x8')](),controller[_0x348a('0xb')]);router[_0x348a('0xa')]('/:id/messages',auth[_0x348a('0x8')](),controller[_0x348a('0xc')]);router[_0x348a('0xd')]('/',auth['isAuthenticated'](),controller[_0x348a('0xe')]);router[_0x348a('0xf')](_0x348a('0x10'),auth[_0x348a('0x8')](),controller[_0x348a('0x11')]);router['delete'](_0x348a('0x10'),auth[_0x348a('0x8')](),controller['destroy']);module[_0x348a('0x12')]=router; \ No newline at end of file +var _0xf26b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1976a8,_0xefb081){var _0x106bb3=function(_0x56102b){while(--_0x56102b){_0x1976a8['push'](_0x1976a8['shift']());}};_0x106bb3(++_0xefb081);}(_0xf26b,0x15d));var _0xbf26=function(_0x484a28,_0x1ff815){_0x484a28=_0x484a28-0x0;var _0x4a1c1e=_0xf26b[_0x484a28];return _0x4a1c1e;};'use strict';var multer=require(_0xbf26('0x0'));var util=require(_0xbf26('0x1'));var path=require('path');var timeout=require(_0xbf26('0x2'));var express=require(_0xbf26('0x3'));var router=express[_0xbf26('0x4')]();var auth=require(_0xbf26('0x5'));var interaction=require(_0xbf26('0x6'));var config=require(_0xbf26('0x7'));var controller=require(_0xbf26('0x8'));router[_0xbf26('0x9')]('/',auth[_0xbf26('0xa')](),controller[_0xbf26('0xb')]);router[_0xbf26('0x9')](_0xbf26('0xc'),auth[_0xbf26('0xa')](),controller[_0xbf26('0xd')]);router['get'](_0xbf26('0xe'),auth['isAuthenticated'](),controller[_0xbf26('0xf')]);router[_0xbf26('0x10')]('/',auth['isAuthenticated'](),controller[_0xbf26('0x11')]);router[_0xbf26('0x12')](_0xbf26('0xc'),auth[_0xbf26('0xa')](),controller[_0xbf26('0x13')]);router[_0xbf26('0x14')](_0xbf26('0xc'),auth[_0xbf26('0xa')](),controller[_0xbf26('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 063abb4..5a8bf1f 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 _0xb7e7=['sequelize','STRING','from-voicemail','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x2c04ee,_0x56e253){var _0x11fbe9=function(_0x95d6da){while(--_0x95d6da){_0x2c04ee['push'](_0x2c04ee['shift']());}};_0x11fbe9(++_0x56e253);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7b7e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x7b7e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7b7e('0x1')]},'fullname':{'type':Sequelize[_0x7b7e('0x1')]},'email':{'type':Sequelize[_0x7b7e('0x1')],'validate':{'isEmail':!![]},'set':function(_0x52047f){this['setDataValue'](_0x7b7e('0x3'),typeof _0x52047f===_0x7b7e('0x4')&&_0x52047f[_0x7b7e('0x5')]()?_0x52047f['trim']():null);}},'pager':{'type':Sequelize[_0x7b7e('0x1')]},'tz':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x6')},'attach':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7b7e('0x7')]('yes','no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7b7e('0x1')]},'callback':{'type':Sequelize[_0x7b7e('0x1')]},'review':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7b7e('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'stamp':{'type':_0x7b7e('0xa')},'emailsubject':{'type':Sequelize[_0x7b7e('0x1')]},'emailbody':{'type':Sequelize[_0x7b7e('0x1')]},'maxsecs':{'type':Sequelize[_0x7b7e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7b7e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7b7e('0xc')],'get':function(){return this[_0x7b7e('0xd')](_0x7b7e('0xe'))+_0x7b7e('0xf')+this[_0x7b7e('0xd')](_0x7b7e('0x10'));}}}; \ No newline at end of file +var _0x8603=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0xf8aecd,_0x4631e1){var _0x41b3a1=function(_0x110ddb){while(--_0x110ddb){_0xf8aecd['push'](_0xf8aecd['shift']());}};_0x41b3a1(++_0x4631e1);}(_0x8603,0x190));var _0x3860=function(_0x48bbd8,_0x1514d8){_0x48bbd8=_0x48bbd8-0x0;var _0x372eae=_0x8603[_0x48bbd8];return _0x372eae;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'customer_id':{'type':Sequelize[_0x3860('0x1')]},'context':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3860('0x2')},'password':{'type':Sequelize[_0x3860('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3860('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56f8c5){this[_0x3860('0x3')](_0x3860('0x4'),typeof _0x56f8c5===_0x3860('0x5')&&_0x56f8c5[_0x3860('0x6')]()?_0x56f8c5[_0x3860('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3860('0x1')]},'callback':{'type':Sequelize[_0x3860('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3860('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'stamp':{'type':_0x3860('0xa')},'emailsubject':{'type':Sequelize[_0x3860('0x1')]},'emailbody':{'type':Sequelize[_0x3860('0x1')]},'maxsecs':{'type':Sequelize[_0x3860('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0xc')](_0x3860('0xd'))+_0x3860('0xe')+this['getDataValue'](_0x3860('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3d30950..ceeff57 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 _0x4320=['sort','where','pick','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','hasOwnProperty','order','filter','mailbox','options','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit'];(function(_0x43a223,_0x14b116){var _0x7c7f5d=function(_0x1961b5){while(--_0x1961b5){_0x43a223['push'](_0x43a223['shift']());}};_0x7c7f5d(++_0x14b116);}(_0x4320,0xdd));var _0x0432=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x4320[_0x28aea5];return _0x6a55f9;};'use strict';var pdf=require(_0x0432('0x0'));var emlformat=require(_0x0432('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0432('0x2'));var jsonpatch=require(_0x0432('0x3'));var rp=require(_0x0432('0x4'));var moment=require(_0x0432('0x5'));var BPromise=require(_0x0432('0x6'));var Mustache=require(_0x0432('0x7'));var util=require(_0x0432('0x8'));var path=require(_0x0432('0x9'));var sox=require(_0x0432('0xa'));var csv=require(_0x0432('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0432('0xc'));var crypto=require(_0x0432('0xd'));var jsforce=require(_0x0432('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0432('0xf'));var Papa=require(_0x0432('0x10'));var Redis=require(_0x0432('0x11'));var authService=require(_0x0432('0x12'));var qs=require(_0x0432('0x13'));var as=require(_0x0432('0x14'));var hardwareService=require(_0x0432('0x15'));var logger=require(_0x0432('0x16'))(_0x0432('0x17'));var utils=require(_0x0432('0x18'));var config=require('../../config/environment');var db=require(_0x0432('0x19'))['db'];function respondWithStatusCode(_0x15d9ea,_0x3dbfb5){_0x3dbfb5=_0x3dbfb5||0xcc;return function(_0x2df095){if(_0x2df095){return _0x15d9ea['sendStatus'](_0x3dbfb5);}return _0x15d9ea[_0x0432('0x1a')](_0x3dbfb5)['end']();};}function respondWithResult(_0x2d9ec2,_0x202679){_0x202679=_0x202679||0xc8;return function(_0x1800e0){if(_0x1800e0){return _0x2d9ec2[_0x0432('0x1a')](_0x202679)['json'](_0x1800e0);}};}function respondWithFilteredResult(_0x267987,_0x37dc2f){return function(_0xd0e56d){if(_0xd0e56d){var _0x333a54=_0xd0e56d[_0x0432('0x1b')],_0x46cbc7=_0x37dc2f[_0x0432('0x1c')],_0x28fe84=_0x37dc2f[_0x0432('0x1c')]+_0x37dc2f[_0x0432('0x1d')],_0x43e9a2;if(_0x28fe84>=_0x333a54){_0x28fe84=_0x333a54;_0x43e9a2=0xc8;}else{_0x43e9a2=0xce;}_0x267987[_0x0432('0x1a')](_0x43e9a2);return _0x267987[_0x0432('0x1e')](_0x0432('0x1f'),_0x46cbc7+'-'+_0x28fe84+'/'+_0x333a54)[_0x0432('0x20')](_0xd0e56d);}return null;};}function patchUpdates(_0x28bc34){return function(_0x676c53){try{jsonpatch[_0x0432('0x21')](_0x676c53,_0x28bc34,!![]);}catch(_0x364a6d){return BPromise[_0x0432('0x22')](_0x364a6d);}return _0x676c53['save']();};}function saveUpdates(_0x47b95f,_0x41016d){return function(_0x3a771b){if(_0x3a771b){return _0x3a771b['update'](_0x47b95f)[_0x0432('0x23')](function(_0x4ce217){return _0x4ce217;});}return null;};}function removeEntity(_0x469c19,_0x9e9d49){return function(_0xddb8ad){if(_0xddb8ad){return _0xddb8ad[_0x0432('0x24')]()['then'](function(){var _0x2f65e0=_0xddb8ad[_0x0432('0x25')]({'plain':!![]});var _0x4ff154=_0x0432('0x26');return db[_0x0432('0x27')][_0x0432('0x24')]({'where':{'type':_0x4ff154,'resourceId':_0x2f65e0['id']}})[_0x0432('0x23')](function(){return _0xddb8ad;});})[_0x0432('0x23')](function(){_0x469c19[_0x0432('0x1a')](0xcc)[_0x0432('0x28')]();});}};}function handleEntityNotFound(_0x383ea3,_0x26a218){return function(_0x18369d){if(!_0x18369d){_0x383ea3[_0x0432('0x29')](0x194);}return _0x18369d;};}function handleError(_0x30014d,_0x5ee6af){_0x5ee6af=_0x5ee6af||0x1f4;return function(_0x512365){logger[_0x0432('0x2a')](_0x512365[_0x0432('0x2b')]);if(_0x512365['name']){delete _0x512365[_0x0432('0x2c')];}_0x30014d[_0x0432('0x1a')](_0x5ee6af)[_0x0432('0x2d')](_0x512365);};}exports[_0x0432('0x2e')]=function(_0x193d95,_0x280d23){var _0x7d5e53={},_0x1308d5={},_0x271fa2={'count':0x0,'rows':[]};var _0xadab86=_[_0x0432('0x2f')](db[_0x0432('0x30')][_0x0432('0x31')],function(_0x18bff9){return{'name':_0x18bff9[_0x0432('0x32')],'type':_0x18bff9[_0x0432('0x33')][_0x0432('0x34')]};});_0x1308d5[_0x0432('0x35')]=_['map'](_0xadab86,_0x0432('0x2c'));_0x1308d5[_0x0432('0x36')]=_[_0x0432('0x37')](_0x193d95[_0x0432('0x36')]);_0x1308d5[_0x0432('0x38')]=_[_0x0432('0x39')](_0x1308d5['model'],_0x1308d5[_0x0432('0x36')]);_0x7d5e53[_0x0432('0x3a')]=_[_0x0432('0x39')](_0x1308d5[_0x0432('0x35')],qs[_0x0432('0x3b')](_0x193d95[_0x0432('0x36')][_0x0432('0x3b')]));_0x7d5e53['attributes']=_0x7d5e53['attributes']['length']?_0x7d5e53[_0x0432('0x3a')]:_0x1308d5['model'];if(!_0x193d95[_0x0432('0x36')]['hasOwnProperty'](_0x0432('0x3c'))){_0x7d5e53[_0x0432('0x1d')]=qs[_0x0432('0x1d')](_0x193d95[_0x0432('0x36')][_0x0432('0x1d')]);_0x7d5e53[_0x0432('0x1c')]=qs[_0x0432('0x1c')](_0x193d95[_0x0432('0x36')][_0x0432('0x1c')]);}_0x7d5e53['order']=qs['sort'](_0x193d95[_0x0432('0x36')][_0x0432('0x3d')]);_0x7d5e53[_0x0432('0x3e')]=qs[_0x0432('0x38')](_[_0x0432('0x3f')](_0x193d95[_0x0432('0x36')],_0x1308d5[_0x0432('0x38')]),_0xadab86);if(_0x193d95[_0x0432('0x36')]['filter']){_0x7d5e53[_0x0432('0x3e')]=_['merge'](_0x7d5e53[_0x0432('0x3e')],{'$or':_['map'](_0xadab86,function(_0x5c4328){if(_0x5c4328[_0x0432('0x33')]!==_0x0432('0x40')){var _0x12197e={};_0x12197e[_0x5c4328['name']]={'$like':'%'+_0x193d95[_0x0432('0x36')]['filter']+'%'};return _0x12197e;}})});}_0x7d5e53=_[_0x0432('0x41')]({},_0x7d5e53,_0x193d95['options']);var _0x49a928={'where':_0x7d5e53['where']};return db[_0x0432('0x30')][_0x0432('0x1b')](_0x49a928)['then'](function(_0x285b62){_0x271fa2[_0x0432('0x1b')]=_0x285b62;if(_0x193d95[_0x0432('0x36')]['includeAll']){_0x7d5e53[_0x0432('0x42')]=[{'all':!![]}];}return db['VoiceMail'][_0x0432('0x43')](_0x7d5e53);})[_0x0432('0x23')](function(_0x4b13a4){_0x271fa2[_0x0432('0x44')]=_0x4b13a4;return _0x271fa2;})[_0x0432('0x23')](respondWithFilteredResult(_0x280d23,_0x7d5e53))[_0x0432('0x45')](handleError(_0x280d23,null));};exports[_0x0432('0x46')]=function(_0x123dbd,_0x573c1f){var _0x16068f={'raw':!![],'where':{'id':_0x123dbd[_0x0432('0x47')]['id']}},_0x578b27={};_0x578b27[_0x0432('0x35')]=_[_0x0432('0x37')](db[_0x0432('0x30')]['rawAttributes']);_0x578b27[_0x0432('0x36')]=_[_0x0432('0x37')](_0x123dbd[_0x0432('0x36')]);_0x578b27['filters']=_['intersection'](_0x578b27['model'],_0x578b27[_0x0432('0x36')]);_0x16068f[_0x0432('0x3a')]=_[_0x0432('0x39')](_0x578b27[_0x0432('0x35')],qs[_0x0432('0x3b')](_0x123dbd[_0x0432('0x36')][_0x0432('0x3b')]));_0x16068f[_0x0432('0x3a')]=_0x16068f[_0x0432('0x3a')][_0x0432('0x48')]?_0x16068f[_0x0432('0x3a')]:_0x578b27[_0x0432('0x35')];if(_0x123dbd['query'][_0x0432('0x49')]){_0x16068f[_0x0432('0x42')]=[{'all':!![]}];}_0x16068f=_[_0x0432('0x41')]({},_0x16068f,_0x123dbd['options']);return db[_0x0432('0x30')][_0x0432('0x4a')](_0x16068f)['then'](handleEntityNotFound(_0x573c1f,null))[_0x0432('0x23')](respondWithResult(_0x573c1f,null))[_0x0432('0x45')](handleError(_0x573c1f,null));};exports[_0x0432('0x4b')]=function(_0x930526,_0x5de522){return db[_0x0432('0x30')][_0x0432('0x4b')](_0x930526[_0x0432('0x4c')],{})['then'](function(_0x51c139){var _0x72eaba=_0x930526[_0x0432('0x4d')][_0x0432('0x25')]({'plain':!![]});if(!_0x72eaba)throw new Error(_0x0432('0x4e'));if(_0x72eaba[_0x0432('0x4f')]===_0x0432('0x4d')){var _0x12068e=_0x51c139[_0x0432('0x25')]({'plain':!![]});var _0x3f7f8b=_0x0432('0x26');return db[_0x0432('0x50')][_0x0432('0x4a')]({'where':{'name':_0x3f7f8b,'userProfileId':_0x72eaba[_0x0432('0x51')]},'raw':!![]})['then'](function(_0x27ae93){if(_0x27ae93&&_0x27ae93[_0x0432('0x52')]===0x0){return db[_0x0432('0x27')][_0x0432('0x4b')]({'name':_0x12068e['name'],'resourceId':_0x12068e['id'],'type':_0x27ae93[_0x0432('0x2c')],'sectionId':_0x27ae93['id']},{})['then'](function(){return _0x51c139;});}else{return _0x51c139;}})[_0x0432('0x45')](function(_0x24ee25){logger[_0x0432('0x2a')](_0x0432('0x53'),_0x24ee25);throw _0x24ee25;});}return _0x51c139;})[_0x0432('0x23')](respondWithResult(_0x5de522,0xc9))[_0x0432('0x45')](handleError(_0x5de522,null));};exports[_0x0432('0x54')]=function(_0x202ecf,_0x24046e){if(_0x202ecf['body']['id']){delete _0x202ecf[_0x0432('0x4c')]['id'];}return db[_0x0432('0x30')][_0x0432('0x4a')]({'where':{'id':_0x202ecf[_0x0432('0x47')]['id']}})[_0x0432('0x23')](handleEntityNotFound(_0x24046e,null))['then'](saveUpdates(_0x202ecf[_0x0432('0x4c')],null))[_0x0432('0x23')](respondWithResult(_0x24046e,null))[_0x0432('0x45')](handleError(_0x24046e,null));};exports[_0x0432('0x24')]=function(_0x20bc46,_0x103825){return db[_0x0432('0x30')][_0x0432('0x4a')]({'where':{'id':_0x20bc46[_0x0432('0x47')]['id']}})[_0x0432('0x23')](handleEntityNotFound(_0x103825,null))[_0x0432('0x23')](removeEntity(_0x103825,null))[_0x0432('0x45')](handleError(_0x103825,null));};exports[_0x0432('0x55')]=function(_0x6125d6,_0x209a11,_0x3f2dd0){return db[_0x0432('0x30')][_0x0432('0x56')]({'where':{'id':_0x6125d6[_0x0432('0x47')]['id']}})[_0x0432('0x23')](handleEntityNotFound(_0x209a11,null))[_0x0432('0x23')](function(_0x642bc0){var _0x42414e;var _0xb1ee6d={},_0x93136={};_0x93136['model']=_[_0x0432('0x37')](db['VoiceMailMessage'][_0x0432('0x31')]);_0x93136[_0x0432('0x36')]=_[_0x0432('0x37')](_0x6125d6['query']);_0x93136[_0x0432('0x38')]=_[_0x0432('0x39')](_0x93136[_0x0432('0x35')],_0x93136[_0x0432('0x36')]);_0xb1ee6d['attributes']=_[_0x0432('0x39')](_0x93136['model'],qs['fields'](_0x6125d6[_0x0432('0x36')][_0x0432('0x3b')]));_0xb1ee6d['attributes']=_0xb1ee6d['attributes']['length']?_0xb1ee6d[_0x0432('0x3a')]:_0x93136['model'];if(!_0x6125d6[_0x0432('0x36')][_0x0432('0x57')]('nolimit')){_0xb1ee6d[_0x0432('0x1d')]=qs['limit'](_0x6125d6[_0x0432('0x36')]['limit']);_0xb1ee6d[_0x0432('0x1c')]=qs[_0x0432('0x1c')](_0x6125d6[_0x0432('0x36')]['offset']);}_0xb1ee6d[_0x0432('0x58')]=qs[_0x0432('0x3d')](_0x6125d6['query']['sort']);_0xb1ee6d[_0x0432('0x3e')]=qs[_0x0432('0x38')](_[_0x0432('0x3f')](_0x6125d6['query'],_0x93136['filters']));if(_0x6125d6[_0x0432('0x36')][_0x0432('0x59')]){_0xb1ee6d[_0x0432('0x3e')]=_['merge'](_0xb1ee6d['where'],{'$or':_[_0x0432('0x2f')](_0xb1ee6d['attributes'],function(_0x4af963){var _0x2d38ec={};_0x2d38ec[_0x4af963]={'$like':'%'+_0x6125d6[_0x0432('0x36')][_0x0432('0x59')]+'%'};return _0x2d38ec;})});}_0xb1ee6d[_0x0432('0x3e')]=_[_0x0432('0x41')](_0xb1ee6d['where'],{'mailboxuser':_0x642bc0[_0x0432('0x5a')]});_0xb1ee6d=_['merge']({},_0xb1ee6d,_0x6125d6[_0x0432('0x5b')]);return db[_0x0432('0x5c')][_0x0432('0x5d')](_0xb1ee6d)[_0x0432('0x23')](respondWithFilteredResult(_0x209a11,_0xb1ee6d));})[_0x0432('0x45')](handleError(_0x209a11,null));}; \ No newline at end of file +var _0xa6a2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','VoiceMail','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xa6a2,0xfd));var _0x2a6a=function(_0x2d8ad6,_0x57f071){_0x2d8ad6=_0x2d8ad6-0x0;var _0x5cc21d=_0xa6a2[_0x2d8ad6];return _0x5cc21d;};'use strict';var pdf=require(_0x2a6a('0x0'));var emlformat=require(_0x2a6a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a6a('0x2'));var rp=require(_0x2a6a('0x3'));var moment=require('moment');var BPromise=require(_0x2a6a('0x4'));var Mustache=require(_0x2a6a('0x5'));var util=require(_0x2a6a('0x6'));var path=require(_0x2a6a('0x7'));var sox=require(_0x2a6a('0x8'));var csv=require(_0x2a6a('0x9'));var ejs=require(_0x2a6a('0xa'));var fs=require('fs');var _=require(_0x2a6a('0xb'));var squel=require('squel');var crypto=require(_0x2a6a('0xc'));var jsforce=require(_0x2a6a('0xd'));var deskjs=require(_0x2a6a('0xe'));var toCsv=require(_0x2a6a('0x9'));var querystring=require(_0x2a6a('0xf'));var Papa=require(_0x2a6a('0x10'));var Redis=require(_0x2a6a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a6a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a6a('0x13'))(_0x2a6a('0x14'));var utils=require(_0x2a6a('0x15'));var config=require(_0x2a6a('0x16'));var db=require(_0x2a6a('0x17'))['db'];function respondWithStatusCode(_0x2c86e1,_0x45879d){_0x45879d=_0x45879d||0xcc;return function(_0x4e323c){if(_0x4e323c){return _0x2c86e1[_0x2a6a('0x18')](_0x45879d);}return _0x2c86e1[_0x2a6a('0x19')](_0x45879d)[_0x2a6a('0x1a')]();};}function respondWithResult(_0x10e213,_0x2fe8c5){_0x2fe8c5=_0x2fe8c5||0xc8;return function(_0x3e1567){if(_0x3e1567){return _0x10e213['status'](_0x2fe8c5)[_0x2a6a('0x1b')](_0x3e1567);}};}function respondWithFilteredResult(_0x2c2e35,_0x71810b){return function(_0x7b6f70){if(_0x7b6f70){var _0xc7ab74=_0x7b6f70[_0x2a6a('0x1c')],_0x5904f2=_0x71810b[_0x2a6a('0x1d')],_0xc3463a=_0x71810b['offset']+_0x71810b[_0x2a6a('0x1e')],_0x2431ae;if(_0xc3463a>=_0xc7ab74){_0xc3463a=_0xc7ab74;_0x2431ae=0xc8;}else{_0x2431ae=0xce;}_0x2c2e35[_0x2a6a('0x19')](_0x2431ae);return _0x2c2e35[_0x2a6a('0x1f')](_0x2a6a('0x20'),_0x5904f2+'-'+_0xc3463a+'/'+_0xc7ab74)['json'](_0x7b6f70);}return null;};}function patchUpdates(_0x52bb0d){return function(_0x286c97){try{jsonpatch[_0x2a6a('0x21')](_0x286c97,_0x52bb0d,!![]);}catch(_0x1d44fa){return BPromise[_0x2a6a('0x22')](_0x1d44fa);}return _0x286c97[_0x2a6a('0x23')]();};}function saveUpdates(_0x426e03,_0x3057c2){return function(_0x222a47){if(_0x222a47){return _0x222a47['update'](_0x426e03)[_0x2a6a('0x24')](function(_0x56b21b){return _0x56b21b;});}return null;};}function removeEntity(_0x1ba023,_0x65aff7){return function(_0x1acaa6){if(_0x1acaa6){return _0x1acaa6[_0x2a6a('0x25')]()['then'](function(){var _0x259509=_0x1acaa6[_0x2a6a('0x26')]({'plain':!![]});var _0x2d0940=_0x2a6a('0x27');return db[_0x2a6a('0x28')][_0x2a6a('0x25')]({'where':{'type':_0x2d0940,'resourceId':_0x259509['id']}})[_0x2a6a('0x24')](function(){return _0x1acaa6;});})['then'](function(){_0x1ba023[_0x2a6a('0x19')](0xcc)[_0x2a6a('0x1a')]();});}};}function handleEntityNotFound(_0x3635ae,_0x156e32){return function(_0x298bad){if(!_0x298bad){_0x3635ae[_0x2a6a('0x18')](0x194);}return _0x298bad;};}function handleError(_0x3e483f,_0xcd8dc5){_0xcd8dc5=_0xcd8dc5||0x1f4;return function(_0x8f0c54){logger[_0x2a6a('0x29')](_0x8f0c54[_0x2a6a('0x2a')]);if(_0x8f0c54[_0x2a6a('0x2b')]){delete _0x8f0c54[_0x2a6a('0x2b')];}_0x3e483f[_0x2a6a('0x19')](_0xcd8dc5)['send'](_0x8f0c54);};}exports[_0x2a6a('0x2c')]=function(_0x27eac3,_0xd91f2f){var _0x5bcdb1={},_0xd2d7c5={},_0x4b821e={'count':0x0,'rows':[]};var _0x3637af=_[_0x2a6a('0x2d')](db[_0x2a6a('0x2e')]['rawAttributes'],function(_0xd74d4){return{'name':_0xd74d4[_0x2a6a('0x2f')],'type':_0xd74d4['type']['key']};});_0xd2d7c5[_0x2a6a('0x30')]=_[_0x2a6a('0x2d')](_0x3637af,_0x2a6a('0x2b'));_0xd2d7c5[_0x2a6a('0x31')]=_[_0x2a6a('0x32')](_0x27eac3[_0x2a6a('0x31')]);_0xd2d7c5[_0x2a6a('0x33')]=_['intersection'](_0xd2d7c5[_0x2a6a('0x30')],_0xd2d7c5[_0x2a6a('0x31')]);_0x5bcdb1[_0x2a6a('0x34')]=_['intersection'](_0xd2d7c5[_0x2a6a('0x30')],qs[_0x2a6a('0x35')](_0x27eac3['query'][_0x2a6a('0x35')]));_0x5bcdb1['attributes']=_0x5bcdb1['attributes'][_0x2a6a('0x36')]?_0x5bcdb1[_0x2a6a('0x34')]:_0xd2d7c5[_0x2a6a('0x30')];if(!_0x27eac3[_0x2a6a('0x31')][_0x2a6a('0x37')](_0x2a6a('0x38'))){_0x5bcdb1['limit']=qs[_0x2a6a('0x1e')](_0x27eac3[_0x2a6a('0x31')][_0x2a6a('0x1e')]);_0x5bcdb1[_0x2a6a('0x1d')]=qs[_0x2a6a('0x1d')](_0x27eac3['query'][_0x2a6a('0x1d')]);}_0x5bcdb1['order']=qs[_0x2a6a('0x39')](_0x27eac3[_0x2a6a('0x31')][_0x2a6a('0x39')]);_0x5bcdb1[_0x2a6a('0x3a')]=qs['filters'](_['pick'](_0x27eac3[_0x2a6a('0x31')],_0xd2d7c5[_0x2a6a('0x33')]),_0x3637af);if(_0x27eac3[_0x2a6a('0x31')][_0x2a6a('0x3b')]){_0x5bcdb1[_0x2a6a('0x3a')]=_[_0x2a6a('0x3c')](_0x5bcdb1[_0x2a6a('0x3a')],{'$or':_['map'](_0x3637af,function(_0x217e6e){if(_0x217e6e[_0x2a6a('0x3d')]!==_0x2a6a('0x3e')){var _0xa9d2b6={};_0xa9d2b6[_0x217e6e[_0x2a6a('0x2b')]]={'$like':'%'+_0x27eac3[_0x2a6a('0x31')][_0x2a6a('0x3b')]+'%'};return _0xa9d2b6;}})});}_0x5bcdb1=_[_0x2a6a('0x3c')]({},_0x5bcdb1,_0x27eac3[_0x2a6a('0x3f')]);var _0x1bac9c={'where':_0x5bcdb1[_0x2a6a('0x3a')]};return db[_0x2a6a('0x2e')][_0x2a6a('0x1c')](_0x1bac9c)[_0x2a6a('0x24')](function(_0x27e95d){_0x4b821e[_0x2a6a('0x1c')]=_0x27e95d;if(_0x27eac3[_0x2a6a('0x31')][_0x2a6a('0x40')]){_0x5bcdb1[_0x2a6a('0x41')]=[{'all':!![]}];}return db[_0x2a6a('0x2e')][_0x2a6a('0x42')](_0x5bcdb1);})[_0x2a6a('0x24')](function(_0x12554c){_0x4b821e[_0x2a6a('0x43')]=_0x12554c;return _0x4b821e;})[_0x2a6a('0x24')](respondWithFilteredResult(_0xd91f2f,_0x5bcdb1))['catch'](handleError(_0xd91f2f,null));};exports[_0x2a6a('0x44')]=function(_0x2c2fb8,_0x23bab5){var _0x38ab7b={'raw':!![],'where':{'id':_0x2c2fb8[_0x2a6a('0x45')]['id']}},_0x30f1c9={};_0x30f1c9['model']=_[_0x2a6a('0x32')](db[_0x2a6a('0x2e')][_0x2a6a('0x46')]);_0x30f1c9['query']=_[_0x2a6a('0x32')](_0x2c2fb8[_0x2a6a('0x31')]);_0x30f1c9['filters']=_[_0x2a6a('0x47')](_0x30f1c9[_0x2a6a('0x30')],_0x30f1c9['query']);_0x38ab7b[_0x2a6a('0x34')]=_[_0x2a6a('0x47')](_0x30f1c9['model'],qs[_0x2a6a('0x35')](_0x2c2fb8[_0x2a6a('0x31')][_0x2a6a('0x35')]));_0x38ab7b[_0x2a6a('0x34')]=_0x38ab7b[_0x2a6a('0x34')][_0x2a6a('0x36')]?_0x38ab7b[_0x2a6a('0x34')]:_0x30f1c9[_0x2a6a('0x30')];if(_0x2c2fb8[_0x2a6a('0x31')][_0x2a6a('0x40')]){_0x38ab7b[_0x2a6a('0x41')]=[{'all':!![]}];}_0x38ab7b=_[_0x2a6a('0x3c')]({},_0x38ab7b,_0x2c2fb8[_0x2a6a('0x3f')]);return db[_0x2a6a('0x2e')]['find'](_0x38ab7b)[_0x2a6a('0x24')](handleEntityNotFound(_0x23bab5,null))[_0x2a6a('0x24')](respondWithResult(_0x23bab5,null))[_0x2a6a('0x48')](handleError(_0x23bab5,null));};exports[_0x2a6a('0x49')]=function(_0x25335a,_0x5d65bd){return db['VoiceMail'][_0x2a6a('0x49')](_0x25335a[_0x2a6a('0x4a')],{})[_0x2a6a('0x24')](function(_0x23a2b2){var _0x24d60e=_0x25335a['user'][_0x2a6a('0x26')]({'plain':!![]});if(!_0x24d60e)throw new Error(_0x2a6a('0x4b'));if(_0x24d60e[_0x2a6a('0x4c')]==='user'){var _0x190220=_0x23a2b2[_0x2a6a('0x26')]({'plain':!![]});var _0x5bdc97=_0x2a6a('0x27');return db[_0x2a6a('0x4d')][_0x2a6a('0x4e')]({'where':{'name':_0x5bdc97,'userProfileId':_0x24d60e[_0x2a6a('0x4f')]},'raw':!![]})[_0x2a6a('0x24')](function(_0x809610){if(_0x809610&&_0x809610[_0x2a6a('0x50')]===0x0){return db[_0x2a6a('0x28')][_0x2a6a('0x49')]({'name':_0x190220[_0x2a6a('0x2b')],'resourceId':_0x190220['id'],'type':_0x809610[_0x2a6a('0x2b')],'sectionId':_0x809610['id']},{})[_0x2a6a('0x24')](function(){return _0x23a2b2;});}else{return _0x23a2b2;}})[_0x2a6a('0x48')](function(_0x2ccbe1){logger['error'](_0x2a6a('0x51'),_0x2ccbe1);throw _0x2ccbe1;});}return _0x23a2b2;})[_0x2a6a('0x24')](respondWithResult(_0x5d65bd,0xc9))[_0x2a6a('0x48')](handleError(_0x5d65bd,null));};exports[_0x2a6a('0x52')]=function(_0x1dd9df,_0xbd3b24){if(_0x1dd9df[_0x2a6a('0x4a')]['id']){delete _0x1dd9df[_0x2a6a('0x4a')]['id'];}return db[_0x2a6a('0x2e')][_0x2a6a('0x4e')]({'where':{'id':_0x1dd9df[_0x2a6a('0x45')]['id']}})[_0x2a6a('0x24')](handleEntityNotFound(_0xbd3b24,null))[_0x2a6a('0x24')](saveUpdates(_0x1dd9df[_0x2a6a('0x4a')],null))[_0x2a6a('0x24')](respondWithResult(_0xbd3b24,null))[_0x2a6a('0x48')](handleError(_0xbd3b24,null));};exports[_0x2a6a('0x25')]=function(_0x4f37f6,_0x5f4b3c){return db[_0x2a6a('0x2e')][_0x2a6a('0x4e')]({'where':{'id':_0x4f37f6[_0x2a6a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5f4b3c,null))[_0x2a6a('0x24')](removeEntity(_0x5f4b3c,null))[_0x2a6a('0x48')](handleError(_0x5f4b3c,null));};exports[_0x2a6a('0x53')]=function(_0x305352,_0x502943,_0x5092bc){return db['VoiceMail'][_0x2a6a('0x54')]({'where':{'id':_0x305352[_0x2a6a('0x45')]['id']}})['then'](handleEntityNotFound(_0x502943,null))[_0x2a6a('0x24')](function(_0x2a9e72){var _0x156522;var _0x30239d={},_0x376b71={};_0x376b71[_0x2a6a('0x30')]=_[_0x2a6a('0x32')](db[_0x2a6a('0x55')][_0x2a6a('0x46')]);_0x376b71['query']=_[_0x2a6a('0x32')](_0x305352[_0x2a6a('0x31')]);_0x376b71['filters']=_[_0x2a6a('0x47')](_0x376b71['model'],_0x376b71['query']);_0x30239d[_0x2a6a('0x34')]=_[_0x2a6a('0x47')](_0x376b71[_0x2a6a('0x30')],qs['fields'](_0x305352[_0x2a6a('0x31')][_0x2a6a('0x35')]));_0x30239d[_0x2a6a('0x34')]=_0x30239d['attributes'][_0x2a6a('0x36')]?_0x30239d['attributes']:_0x376b71['model'];if(!_0x305352[_0x2a6a('0x31')][_0x2a6a('0x37')](_0x2a6a('0x38'))){_0x30239d['limit']=qs[_0x2a6a('0x1e')](_0x305352['query']['limit']);_0x30239d[_0x2a6a('0x1d')]=qs[_0x2a6a('0x1d')](_0x305352[_0x2a6a('0x31')][_0x2a6a('0x1d')]);}_0x30239d['order']=qs[_0x2a6a('0x39')](_0x305352[_0x2a6a('0x31')]['sort']);_0x30239d['where']=qs[_0x2a6a('0x33')](_[_0x2a6a('0x56')](_0x305352[_0x2a6a('0x31')],_0x376b71[_0x2a6a('0x33')]));if(_0x305352[_0x2a6a('0x31')][_0x2a6a('0x3b')]){_0x30239d[_0x2a6a('0x3a')]=_['merge'](_0x30239d[_0x2a6a('0x3a')],{'$or':_[_0x2a6a('0x2d')](_0x30239d[_0x2a6a('0x34')],function(_0x4ee55c){var _0x1b3563={};_0x1b3563[_0x4ee55c]={'$like':'%'+_0x305352['query'][_0x2a6a('0x3b')]+'%'};return _0x1b3563;})});}_0x30239d[_0x2a6a('0x3a')]=_[_0x2a6a('0x3c')](_0x30239d[_0x2a6a('0x3a')],{'mailboxuser':_0x2a9e72[_0x2a6a('0x57')]});_0x30239d=_[_0x2a6a('0x3c')]({},_0x30239d,_0x305352[_0x2a6a('0x3f')]);return db[_0x2a6a('0x55')][_0x2a6a('0x58')](_0x30239d)['then'](respondWithFilteredResult(_0x502943,_0x30239d));})[_0x2a6a('0x48')](handleError(_0x502943,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f5b1e72..c70e34c 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 _0x8e8e=['VoiceMail','voice_voicemail','mailbox_context','context','lodash','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes'];(function(_0x4695e2,_0x169dd2){var _0x5df97a=function(_0x15d4b9){while(--_0x15d4b9){_0x4695e2['push'](_0x4695e2['shift']());}};_0x5df97a(++_0x169dd2);}(_0x8e8e,0x178));var _0xe8e8=function(_0x28eaab,_0x404155){_0x28eaab=_0x28eaab-0x0;var _0x5ef04a=_0x8e8e[_0x28eaab];return _0x5ef04a;};'use strict';var _=require(_0xe8e8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe8e8('0x1'));var moment=require(_0xe8e8('0x2'));var BPromise=require(_0xe8e8('0x3'));var rp=require(_0xe8e8('0x4'));var fs=require('fs');var path=require(_0xe8e8('0x5'));var rimraf=require(_0xe8e8('0x6'));var config=require('../../config/environment');var attributes=require(_0xe8e8('0x7'));module['exports']=function(_0x36a703,_0x53a3bf){return _0x36a703['define'](_0xe8e8('0x8'),attributes,{'tableName':_0xe8e8('0x9'),'paranoid':![],'indexes':[{'name':_0xe8e8('0xa'),'fields':['mailbox',_0xe8e8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5724=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x298966,_0x5513d1){var _0x2d6b08=function(_0x15b25d){while(--_0x15b25d){_0x298966['push'](_0x298966['shift']());}};_0x2d6b08(++_0x5513d1);}(_0x5724,0x18b));var _0x4572=function(_0x23b1c8,_0x3a36fb){_0x23b1c8=_0x23b1c8-0x0;var _0x5ccaae=_0x5724[_0x23b1c8];return _0x5ccaae;};'use strict';var _=require(_0x4572('0x0'));var util=require(_0x4572('0x1'));var logger=require(_0x4572('0x2'))(_0x4572('0x3'));var moment=require(_0x4572('0x4'));var BPromise=require(_0x4572('0x5'));var rp=require(_0x4572('0x6'));var fs=require('fs');var path=require(_0x4572('0x7'));var rimraf=require('rimraf');var config=require(_0x4572('0x8'));var attributes=require(_0x4572('0x9'));module[_0x4572('0xa')]=function(_0x2ba270,_0x2b1ff6){return _0x2ba270[_0x4572('0xb')](_0x4572('0xc'),attributes,{'tableName':_0x4572('0xd'),'paranoid':![],'indexes':[{'name':_0x4572('0xe'),'fields':[_0x4572('0xf'),_0x4572('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 64721fd..79ef4d2 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 _0xb2c8=['info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x57a75a,_0x19c9c3){var _0x501768=function(_0x49c77f){while(--_0x49c77f){_0x57a75a['push'](_0x57a75a['shift']());}};_0x501768(++_0x19c9c3);}(_0xb2c8,0x10c));var _0x8b2c=function(_0x10dc4d,_0x5ba9f1){_0x10dc4d=_0x10dc4d-0x0;var _0x55307c=_0xb2c8[_0x10dc4d];return _0x55307c;};'use strict';var _=require(_0x8b2c('0x0'));var util=require('util');var moment=require(_0x8b2c('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b2c('0x2'));var fs=require('fs');var Redis=require(_0x8b2c('0x3'));var db=require(_0x8b2c('0x4'))['db'];var utils=require(_0x8b2c('0x5'));var logger=require(_0x8b2c('0x6'))('rpc');var config=require(_0x8b2c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b2c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3133d0,_0x56f5ba,_0x450bfd){return new BPromise(function(_0x45c287,_0x311f7b){return client[_0x8b2c('0x9')](_0x3133d0,_0x450bfd)['then'](function(_0x46bb43){logger['info'](_0x8b2c('0xa'),_0x56f5ba,_0x8b2c('0xb'));logger[_0x8b2c('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x56f5ba,_0x8b2c('0xb'),JSON[_0x8b2c('0xd')](_0x46bb43));if(_0x46bb43['error']){if(_0x46bb43[_0x8b2c('0xe')][_0x8b2c('0xf')]===0x1f4){logger[_0x8b2c('0xe')](_0x8b2c('0xa'),_0x56f5ba,_0x46bb43[_0x8b2c('0xe')][_0x8b2c('0x10')]);return _0x311f7b(_0x46bb43[_0x8b2c('0xe')][_0x8b2c('0x10')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x56f5ba,_0x46bb43[_0x8b2c('0xe')][_0x8b2c('0x10')]);return _0x45c287(_0x46bb43[_0x8b2c('0xe')][_0x8b2c('0x10')]);}else{logger[_0x8b2c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x56f5ba,_0x8b2c('0xb'));_0x45c287(_0x46bb43['result']['message']);}})[_0x8b2c('0x12')](function(_0x348c97){logger[_0x8b2c('0xe')](_0x8b2c('0xa'),_0x56f5ba,_0x348c97);_0x311f7b(_0x348c97);});});} \ No newline at end of file +var _0xc1db=['../../config/logger','rpc','../../config/environment','client','request','then','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0xc1db,0x16f));var _0xbc1d=function(_0x1b3f21,_0x7c30f4){_0x1b3f21=_0x1b3f21-0x0;var _0x5334de=_0xc1db[_0x1b3f21];return _0x5334de;};'use strict';var _=require(_0xbc1d('0x0'));var util=require(_0xbc1d('0x1'));var moment=require(_0xbc1d('0x2'));var BPromise=require(_0xbc1d('0x3'));var rs=require(_0xbc1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc1d('0x5'))['db'];var utils=require(_0xbc1d('0x6'));var logger=require(_0xbc1d('0x7'))(_0xbc1d('0x8'));var config=require(_0xbc1d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc1d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482581,_0x103790,_0x4d6d9c){return new BPromise(function(_0x438822,_0x2499d8){return client[_0xbc1d('0xb')](_0x482581,_0x4d6d9c)[_0xbc1d('0xc')](function(_0x4d367f){logger['info']('VoiceMail,\x20%s,\x20%s',_0x103790,'request\x20sent');logger[_0xbc1d('0xd')](_0xbc1d('0xe'),_0x103790,_0xbc1d('0xf'),JSON['stringify'](_0x4d367f));if(_0x4d367f[_0xbc1d('0x10')]){if(_0x4d367f[_0xbc1d('0x10')][_0xbc1d('0x11')]===0x1f4){logger['error'](_0xbc1d('0x12'),_0x103790,_0x4d367f[_0xbc1d('0x10')][_0xbc1d('0x13')]);return _0x2499d8(_0x4d367f['error']['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x103790,_0x4d367f[_0xbc1d('0x10')][_0xbc1d('0x13')]);return _0x438822(_0x4d367f[_0xbc1d('0x10')]['message']);}else{logger[_0xbc1d('0x14')](_0xbc1d('0x12'),_0x103790,'request\x20sent');_0x438822(_0x4d367f[_0xbc1d('0x15')][_0xbc1d('0x13')]);}})['catch'](function(_0x11d6aa){logger[_0xbc1d('0x10')](_0xbc1d('0x12'),_0x103790,_0x11d6aa);_0x2499d8(_0x11d6aa);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 617426a..cac39b6 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 _0x187d=['../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x3b2be5,_0x9c01ae){var _0x14cd8=function(_0x5262be){while(--_0x5262be){_0x3b2be5['push'](_0x3b2be5['shift']());}};_0x14cd8(++_0x9c01ae);}(_0x187d,0x93));var _0xd187=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x187d[_0x37bd26];return _0xe83dc4;};'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('0x8')](_0xd187('0xd'),auth[_0xd187('0xb')](),controller['download']);router[_0xd187('0xe')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['update']);router[_0xd187('0x11')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x12')]=router; \ No newline at end of file +var _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0xb468fc,_0x348a61){var _0x553cb6=function(_0x105f4a){while(--_0x105f4a){_0xb468fc['push'](_0xb468fc['shift']());}};_0x553cb6(++_0x348a61);}(_0x4819,0xcd));var _0x9481=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x4819[_0x3d6db1];return _0x5e1cc3;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 27c7100..bef0a22 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 _0x4c04=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports'];(function(_0x168883,_0x145b19){var _0x29d947=function(_0x1039b4){while(--_0x1039b4){_0x168883['push'](_0x168883['shift']());}};_0x29d947(++_0x145b19);}(_0x4c04,0xd6));var _0x44c0=function(_0x3920fe,_0xe12271){_0x3920fe=_0x3920fe-0x0;var _0x31f98e=_0x4c04[_0x3920fe];return _0x31f98e;};'use strict';var Sequelize=require(_0x44c0('0x0'));module[_0x44c0('0x1')]={'name':{'type':Sequelize[_0x44c0('0x2')],'get':function(_0x8fbe15){return this[_0x44c0('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x44c0('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x44c0('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x44c0('0x6')](_0x44c0('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x44c0('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x64fb=['long','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0xbc42b0,_0x582b80){var _0x4d18a1=function(_0x16c691){while(--_0x16c691){_0xbc42b0['push'](_0xbc42b0['shift']());}};_0x4d18a1(++_0x582b80);}(_0x64fb,0x119));var _0xb64f=function(_0x19c80f,_0x45d4c4){_0x19c80f=_0x19c80f-0x0;var _0x129797=_0x64fb[_0x19c80f];return _0x129797;};'use strict';var Sequelize=require('sequelize');module[_0xb64f('0x0')]={'name':{'type':Sequelize[_0xb64f('0x1')],'get':function(_0x5c91f4){return this[_0xb64f('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xb64f('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xb64f('0x5')](_0xb64f('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xb64f('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4a10ce5..19e3d1c 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 _0x9354=['ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','body','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','set','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0x9354,0x96));var _0x4935=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x9354[_0x341e0f];return _0x59555a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f6eef,_0x32916f){_0x32916f=_0x32916f||0xcc;return function(_0x3bb388){if(_0x3bb388){return _0x3f6eef[_0x4935('0x16')](_0x32916f);}return _0x3f6eef[_0x4935('0x17')](_0x32916f)[_0x4935('0x18')]();};}function respondWithResult(_0x102c63,_0x3a7c30){_0x3a7c30=_0x3a7c30||0xc8;return function(_0x57549f){if(_0x57549f){return _0x102c63[_0x4935('0x17')](_0x3a7c30)[_0x4935('0x19')](_0x57549f);}};}function respondWithFilteredResult(_0x1799e4,_0xa41961){return function(_0x3652c4){if(_0x3652c4){var _0x24cc99=_0x3652c4[_0x4935('0x1a')],_0x395a43=_0xa41961[_0x4935('0x1b')],_0x57d7ed=_0xa41961[_0x4935('0x1b')]+_0xa41961[_0x4935('0x1c')],_0x3079e7;if(_0x57d7ed>=_0x24cc99){_0x57d7ed=_0x24cc99;_0x3079e7=0xc8;}else{_0x3079e7=0xce;}_0x1799e4[_0x4935('0x17')](_0x3079e7);return _0x1799e4['set'](_0x4935('0x1d'),_0x395a43+'-'+_0x57d7ed+'/'+_0x24cc99)[_0x4935('0x19')](_0x3652c4);}return null;};}function patchUpdates(_0x4fe356){return function(_0x288eff){try{jsonpatch[_0x4935('0x1e')](_0x288eff,_0x4fe356,!![]);}catch(_0x1e7e38){return BPromise['reject'](_0x1e7e38);}return _0x288eff['save']();};}function saveUpdates(_0x125688,_0x6b849f){return function(_0x1ae059){if(_0x1ae059){return _0x1ae059[_0x4935('0x1f')](_0x125688)[_0x4935('0x20')](function(_0x16ab7c){return _0x16ab7c;});}return null;};}function removeEntity(_0x7a50ab,_0xe482a5){return function(_0x58b2f3){if(_0x58b2f3){return _0x58b2f3[_0x4935('0x21')]()[_0x4935('0x20')](function(){_0x7a50ab[_0x4935('0x17')](0xcc)[_0x4935('0x18')]();});}};}function handleEntityNotFound(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(!_0x4dc1f5){_0x52c65a[_0x4935('0x16')](0x194);}return _0x4dc1f5;};}function handleError(_0x142fdf,_0x3786ff){_0x3786ff=_0x3786ff||0x1f4;return function(_0x472b93){logger[_0x4935('0x22')](_0x472b93[_0x4935('0x23')]);if(_0x472b93[_0x4935('0x24')]){delete _0x472b93[_0x4935('0x24')];}_0x142fdf[_0x4935('0x17')](_0x3786ff)[_0x4935('0x25')](_0x472b93);};}exports[_0x4935('0x26')]=function(_0x39d07b,_0x2c47ab){var _0xbb00d6={},_0x359522={},_0x55616e={'count':0x0,'rows':[]};var _0x5c3aaa=_['map'](db[_0x4935('0x27')][_0x4935('0x28')],function(_0x4f1163){return{'name':_0x4f1163[_0x4935('0x29')],'type':_0x4f1163[_0x4935('0x2a')][_0x4935('0x2b')]};});_0x359522[_0x4935('0x2c')]=_[_0x4935('0x2d')](_[_0x4935('0x2e')](_0x5c3aaa,_0x4935('0x24')),[_0x4935('0x24')]);_0x359522['query']=_[_0x4935('0x2f')](_0x39d07b[_0x4935('0x30')]);_0x359522['filters']=_['intersection'](_0x359522[_0x4935('0x2c')],_0x359522['query']);_0xbb00d6[_0x4935('0x31')]=_[_0x4935('0x32')](_0x359522[_0x4935('0x2c')],qs['fields'](_0x39d07b['query'][_0x4935('0x33')]));_0xbb00d6[_0x4935('0x31')]=_0xbb00d6['attributes'][_0x4935('0x34')]?_0xbb00d6[_0x4935('0x31')]:_0x359522[_0x4935('0x2c')];if(!_0x39d07b[_0x4935('0x30')][_0x4935('0x35')]('nolimit')){_0xbb00d6['limit']=qs[_0x4935('0x1c')](_0x39d07b[_0x4935('0x30')]['limit']);_0xbb00d6['offset']=qs[_0x4935('0x1b')](_0x39d07b['query'][_0x4935('0x1b')]);}_0xbb00d6[_0x4935('0x36')]=qs[_0x4935('0x37')](_0x39d07b[_0x4935('0x30')][_0x4935('0x37')]);_0xbb00d6[_0x4935('0x38')]=qs['filters'](_[_0x4935('0x39')](_0x39d07b['query'],_0x359522[_0x4935('0x3a')]),_0x5c3aaa);if(_0x39d07b['query'][_0x4935('0x3b')]){_0xbb00d6['where']=_[_0x4935('0x3c')](_0xbb00d6[_0x4935('0x38')],{'$or':_[_0x4935('0x2e')](_0x5c3aaa,function(_0xc5e3aa){if(_0xc5e3aa[_0x4935('0x2a')]!==_0x4935('0x3d')){var _0x441332={};_0x441332[_0xc5e3aa['name']]={'$like':'%'+_0x39d07b['query'][_0x4935('0x3b')]+'%'};return _0x441332;}})});}_0xbb00d6=_['merge']({},_0xbb00d6,_0x39d07b['options']);var _0x1552b2={'where':_0xbb00d6['where']};return db[_0x4935('0x27')][_0x4935('0x1a')](_0x1552b2)[_0x4935('0x20')](function(_0x99b7c5){_0x55616e[_0x4935('0x1a')]=_0x99b7c5;if(_0x39d07b['query']['includeAll']){_0xbb00d6[_0x4935('0x3e')]=[{'all':!![]}];}return db[_0x4935('0x27')][_0x4935('0x3f')](_0xbb00d6);})[_0x4935('0x20')](function(_0x4d9436){_0x55616e[_0x4935('0x40')]=_0x4d9436;return _0x55616e;})[_0x4935('0x20')](respondWithFilteredResult(_0x2c47ab,_0xbb00d6))[_0x4935('0x41')](handleError(_0x2c47ab,null));};exports['show']=function(_0x4e94f6,_0x213230){var _0xe7f002={'raw':!![],'where':{'id':_0x4e94f6[_0x4935('0x42')]['id']}},_0x493588={};_0x493588[_0x4935('0x2c')]=_[_0x4935('0x2f')](db[_0x4935('0x27')]['rawAttributes']);_0x493588['query']=_[_0x4935('0x2f')](_0x4e94f6[_0x4935('0x30')]);_0x493588['filters']=_[_0x4935('0x32')](_0x493588[_0x4935('0x2c')],_0x493588[_0x4935('0x30')]);_0xe7f002['attributes']=_[_0x4935('0x32')](_0x493588[_0x4935('0x2c')],qs[_0x4935('0x33')](_0x4e94f6[_0x4935('0x30')][_0x4935('0x33')]));_0xe7f002[_0x4935('0x31')]=_0xe7f002[_0x4935('0x31')][_0x4935('0x34')]?_0xe7f002[_0x4935('0x31')]:_0x493588[_0x4935('0x2c')];if(_0x4e94f6[_0x4935('0x30')][_0x4935('0x43')]){_0xe7f002[_0x4935('0x3e')]=[{'all':!![]}];}_0xe7f002=_[_0x4935('0x3c')]({},_0xe7f002,_0x4e94f6[_0x4935('0x44')]);return db[_0x4935('0x27')][_0x4935('0x45')](_0xe7f002)[_0x4935('0x20')](handleEntityNotFound(_0x213230,null))['then'](respondWithResult(_0x213230,null))[_0x4935('0x41')](handleError(_0x213230,null));};exports['create']=function(_0x13d78c,_0x144ac5){return db[_0x4935('0x27')][_0x4935('0x46')](_0x13d78c['body'],{})[_0x4935('0x20')](respondWithResult(_0x144ac5,0xc9))[_0x4935('0x41')](handleError(_0x144ac5,null));};exports[_0x4935('0x1f')]=function(_0xa55ce1,_0x28ff14){if(_0xa55ce1[_0x4935('0x47')]['id']){delete _0xa55ce1[_0x4935('0x47')]['id'];}return db[_0x4935('0x27')][_0x4935('0x45')]({'where':{'id':_0xa55ce1[_0x4935('0x42')]['id']}})['then'](handleEntityNotFound(_0x28ff14,null))[_0x4935('0x20')](saveUpdates(_0xa55ce1[_0x4935('0x47')],null))['then'](respondWithResult(_0x28ff14,null))[_0x4935('0x41')](handleError(_0x28ff14,null));};exports[_0x4935('0x21')]=function(_0x697a3c,_0x3585de){return db[_0x4935('0x27')][_0x4935('0x45')]({'where':{'id':_0x697a3c[_0x4935('0x42')]['id']}})[_0x4935('0x20')](handleEntityNotFound(_0x3585de,null))['then'](removeEntity(_0x3585de,null))[_0x4935('0x41')](handleError(_0x3585de,null));};exports['download']=function(_0x561fa3,_0x15ce51,_0x189071){return db[_0x4935('0x27')][_0x4935('0x45')]({'where':{'id':_0x561fa3[_0x4935('0x42')]['id']},'attributes':['id','recording',_0x4935('0x48')]})[_0x4935('0x20')](handleEntityNotFound(_0x15ce51,null))[_0x4935('0x20')](function(_0x345454){if(_0x345454){if(!_0x345454[_0x4935('0x49')]){throw new db[(_0x4935('0x4a'))][(_0x4935('0x4b'))](_0x4935('0x4c'));}var _0x2465e1={'Content-Type':_0x4935('0x4d'),'Content-Disposition':'attachment'};if(_0x345454[_0x4935('0x48')]){_0x2465e1['Content-Disposition']=_0x4935('0x4e')+_0x345454[_0x4935('0x48')]+'.wav\x22';}_0x15ce51[_0x4935('0x4f')](_0x2465e1);return _0x15ce51['send'](new Buffer(_0x345454['recording']));}})['catch'](handleError(_0x15ce51,null));}; \ No newline at end of file +var _0x6599=['find','create','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','type','key','differenceBy','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','findAll','rows','catch','show','length','include'];(function(_0x58b6fe,_0x1b20c4){var _0x12d78e=function(_0x1aefe7){while(--_0x1aefe7){_0x58b6fe['push'](_0x58b6fe['shift']());}};_0x12d78e(++_0x1b20c4);}(_0x6599,0xb0));var _0x9659=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x6599[_0x271060];return _0x40540b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9659('0x0'));var rimraf=require(_0x9659('0x1'));var zipdir=require(_0x9659('0x2'));var jsonpatch=require(_0x9659('0x3'));var rp=require(_0x9659('0x4'));var moment=require('moment');var BPromise=require(_0x9659('0x5'));var Mustache=require('mustache');var util=require(_0x9659('0x6'));var path=require('path');var sox=require(_0x9659('0x7'));var csv=require(_0x9659('0x8'));var ejs=require(_0x9659('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9659('0xa'));var jsforce=require(_0x9659('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9659('0x8'));var querystring=require('querystring');var Papa=require(_0x9659('0xc'));var Redis=require(_0x9659('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9659('0xe'));var as=require(_0x9659('0xf'));var hardwareService=require(_0x9659('0x10'));var logger=require('../../config/logger')(_0x9659('0x11'));var utils=require('../../config/utils');var config=require(_0x9659('0x12'));var db=require(_0x9659('0x13'))['db'];function respondWithStatusCode(_0x3f4afa,_0x567463){_0x567463=_0x567463||0xcc;return function(_0x1f4884){if(_0x1f4884){return _0x3f4afa[_0x9659('0x14')](_0x567463);}return _0x3f4afa[_0x9659('0x15')](_0x567463)[_0x9659('0x16')]();};}function respondWithResult(_0x34617b,_0x38a89e){_0x38a89e=_0x38a89e||0xc8;return function(_0x805d8c){if(_0x805d8c){return _0x34617b[_0x9659('0x15')](_0x38a89e)[_0x9659('0x17')](_0x805d8c);}};}function respondWithFilteredResult(_0x103825,_0x323c10){return function(_0x122fe4){if(_0x122fe4){var _0x23e514=_0x122fe4[_0x9659('0x18')],_0x23098d=_0x323c10[_0x9659('0x19')],_0x575f53=_0x323c10[_0x9659('0x19')]+_0x323c10[_0x9659('0x1a')],_0x281df8;if(_0x575f53>=_0x23e514){_0x575f53=_0x23e514;_0x281df8=0xc8;}else{_0x281df8=0xce;}_0x103825[_0x9659('0x15')](_0x281df8);return _0x103825[_0x9659('0x1b')](_0x9659('0x1c'),_0x23098d+'-'+_0x575f53+'/'+_0x23e514)[_0x9659('0x17')](_0x122fe4);}return null;};}function patchUpdates(_0x525d27){return function(_0xe3e9d4){try{jsonpatch[_0x9659('0x1d')](_0xe3e9d4,_0x525d27,!![]);}catch(_0x110904){return BPromise['reject'](_0x110904);}return _0xe3e9d4[_0x9659('0x1e')]();};}function saveUpdates(_0x52b880,_0x301c36){return function(_0x3c4a1e){if(_0x3c4a1e){return _0x3c4a1e[_0x9659('0x1f')](_0x52b880)[_0x9659('0x20')](function(_0x3cef15){return _0x3cef15;});}return null;};}function removeEntity(_0x231f78,_0x5d4eb5){return function(_0x31a3c9){if(_0x31a3c9){return _0x31a3c9[_0x9659('0x21')]()['then'](function(){_0x231f78[_0x9659('0x15')](0xcc)[_0x9659('0x16')]();});}};}function handleEntityNotFound(_0x170837,_0x54a727){return function(_0x34cff7){if(!_0x34cff7){_0x170837[_0x9659('0x14')](0x194);}return _0x34cff7;};}function handleError(_0x1186ab,_0x46f3c6){_0x46f3c6=_0x46f3c6||0x1f4;return function(_0xa51c7f){logger['error'](_0xa51c7f[_0x9659('0x22')]);if(_0xa51c7f[_0x9659('0x23')]){delete _0xa51c7f[_0x9659('0x23')];}_0x1186ab[_0x9659('0x15')](_0x46f3c6)['send'](_0xa51c7f);};}exports[_0x9659('0x24')]=function(_0x45861f,_0x46ca50){var _0x12093a={},_0x49389b={},_0x191388={'count':0x0,'rows':[]};var _0x4795d1=_[_0x9659('0x25')](db['VoiceMailMessage'][_0x9659('0x26')],function(_0x5aa112){return{'name':_0x5aa112['fieldName'],'type':_0x5aa112[_0x9659('0x27')][_0x9659('0x28')]};});_0x49389b['model']=_[_0x9659('0x29')](_['map'](_0x4795d1,_0x9659('0x23')),[_0x9659('0x23')]);_0x49389b[_0x9659('0x2a')]=_[_0x9659('0x2b')](_0x45861f[_0x9659('0x2a')]);_0x49389b[_0x9659('0x2c')]=_[_0x9659('0x2d')](_0x49389b['model'],_0x49389b[_0x9659('0x2a')]);_0x12093a[_0x9659('0x2e')]=_[_0x9659('0x2d')](_0x49389b['model'],qs[_0x9659('0x2f')](_0x45861f[_0x9659('0x2a')]['fields']));_0x12093a[_0x9659('0x2e')]=_0x12093a[_0x9659('0x2e')]['length']?_0x12093a[_0x9659('0x2e')]:_0x49389b[_0x9659('0x30')];if(!_0x45861f['query'][_0x9659('0x31')](_0x9659('0x32'))){_0x12093a[_0x9659('0x1a')]=qs[_0x9659('0x1a')](_0x45861f[_0x9659('0x2a')][_0x9659('0x1a')]);_0x12093a[_0x9659('0x19')]=qs[_0x9659('0x19')](_0x45861f[_0x9659('0x2a')][_0x9659('0x19')]);}_0x12093a[_0x9659('0x33')]=qs[_0x9659('0x34')](_0x45861f[_0x9659('0x2a')][_0x9659('0x34')]);_0x12093a[_0x9659('0x35')]=qs['filters'](_[_0x9659('0x36')](_0x45861f[_0x9659('0x2a')],_0x49389b['filters']),_0x4795d1);if(_0x45861f[_0x9659('0x2a')][_0x9659('0x37')]){_0x12093a[_0x9659('0x35')]=_[_0x9659('0x38')](_0x12093a[_0x9659('0x35')],{'$or':_[_0x9659('0x25')](_0x4795d1,function(_0x23b934){if(_0x23b934[_0x9659('0x27')]!==_0x9659('0x39')){var _0x2bcdfa={};_0x2bcdfa[_0x23b934['name']]={'$like':'%'+_0x45861f[_0x9659('0x2a')][_0x9659('0x37')]+'%'};return _0x2bcdfa;}})});}_0x12093a=_[_0x9659('0x38')]({},_0x12093a,_0x45861f[_0x9659('0x3a')]);var _0x161133={'where':_0x12093a[_0x9659('0x35')]};return db[_0x9659('0x3b')][_0x9659('0x18')](_0x161133)[_0x9659('0x20')](function(_0x4103eb){_0x191388[_0x9659('0x18')]=_0x4103eb;if(_0x45861f[_0x9659('0x2a')][_0x9659('0x3c')]){_0x12093a['include']=[{'all':!![]}];}return db[_0x9659('0x3b')][_0x9659('0x3d')](_0x12093a);})[_0x9659('0x20')](function(_0x579515){_0x191388[_0x9659('0x3e')]=_0x579515;return _0x191388;})[_0x9659('0x20')](respondWithFilteredResult(_0x46ca50,_0x12093a))[_0x9659('0x3f')](handleError(_0x46ca50,null));};exports[_0x9659('0x40')]=function(_0x260ecc,_0x252f90){var _0x27ea04={'raw':!![],'where':{'id':_0x260ecc['params']['id']}},_0x3c8127={};_0x3c8127[_0x9659('0x30')]=_[_0x9659('0x2b')](db[_0x9659('0x3b')]['rawAttributes']);_0x3c8127[_0x9659('0x2a')]=_[_0x9659('0x2b')](_0x260ecc[_0x9659('0x2a')]);_0x3c8127[_0x9659('0x2c')]=_[_0x9659('0x2d')](_0x3c8127[_0x9659('0x30')],_0x3c8127[_0x9659('0x2a')]);_0x27ea04[_0x9659('0x2e')]=_[_0x9659('0x2d')](_0x3c8127['model'],qs[_0x9659('0x2f')](_0x260ecc[_0x9659('0x2a')][_0x9659('0x2f')]));_0x27ea04[_0x9659('0x2e')]=_0x27ea04[_0x9659('0x2e')][_0x9659('0x41')]?_0x27ea04[_0x9659('0x2e')]:_0x3c8127[_0x9659('0x30')];if(_0x260ecc['query'][_0x9659('0x3c')]){_0x27ea04[_0x9659('0x42')]=[{'all':!![]}];}_0x27ea04=_['merge']({},_0x27ea04,_0x260ecc['options']);return db[_0x9659('0x3b')][_0x9659('0x43')](_0x27ea04)['then'](handleEntityNotFound(_0x252f90,null))['then'](respondWithResult(_0x252f90,null))['catch'](handleError(_0x252f90,null));};exports[_0x9659('0x44')]=function(_0x2ddade,_0x33bb15){return db['VoiceMailMessage']['create'](_0x2ddade[_0x9659('0x45')],{})[_0x9659('0x20')](respondWithResult(_0x33bb15,0xc9))[_0x9659('0x3f')](handleError(_0x33bb15,null));};exports[_0x9659('0x1f')]=function(_0x5e1073,_0xe1110e){if(_0x5e1073[_0x9659('0x45')]['id']){delete _0x5e1073[_0x9659('0x45')]['id'];}return db['VoiceMailMessage'][_0x9659('0x43')]({'where':{'id':_0x5e1073[_0x9659('0x46')]['id']}})[_0x9659('0x20')](handleEntityNotFound(_0xe1110e,null))[_0x9659('0x20')](saveUpdates(_0x5e1073[_0x9659('0x45')],null))[_0x9659('0x20')](respondWithResult(_0xe1110e,null))[_0x9659('0x3f')](handleError(_0xe1110e,null));};exports['destroy']=function(_0xed2437,_0x29d660){return db[_0x9659('0x3b')][_0x9659('0x43')]({'where':{'id':_0xed2437[_0x9659('0x46')]['id']}})[_0x9659('0x20')](handleEntityNotFound(_0x29d660,null))[_0x9659('0x20')](removeEntity(_0x29d660,null))[_0x9659('0x3f')](handleError(_0x29d660,null));};exports[_0x9659('0x47')]=function(_0x5abf7f,_0x160549,_0x3427fe){return db['VoiceMailMessage'][_0x9659('0x43')]({'where':{'id':_0x5abf7f[_0x9659('0x46')]['id']},'attributes':['id',_0x9659('0x48'),_0x9659('0x49')]})[_0x9659('0x20')](handleEntityNotFound(_0x160549,null))[_0x9659('0x20')](function(_0x182107){if(_0x182107){if(!_0x182107[_0x9659('0x48')]){throw new db[(_0x9659('0x4a'))]['ValidationError'](_0x9659('0x4b'));}var _0x8aaf68={'Content-Type':_0x9659('0x4c'),'Content-Disposition':_0x9659('0x4d')};if(_0x182107[_0x9659('0x49')]){_0x8aaf68[_0x9659('0x4e')]='attachment;\x20filename=\x22'+_0x182107[_0x9659('0x49')]+_0x9659('0x4f');}_0x160549[_0x9659('0x1b')](_0x8aaf68);return _0x160549[_0x9659('0x50')](new Buffer(_0x182107[_0x9659('0x48')]));}})[_0x9659('0x3f')](handleError(_0x160549,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e5d4e1e..fc7d0e8 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 _0xc900=['define','voice_voicemail_messages','dir','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xc900,0xb3));var _0x0c90=function(_0x199755,_0x571f46){_0x199755=_0x199755-0x0;var _0xf1669b=_0xc900[_0x199755];return _0xf1669b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[{'name':_0x0c90('0xa'),'fields':[_0x0c90('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x20d6=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3e0772,_0x56d14e){var _0x4aa399=function(_0x44ab29){while(--_0x44ab29){_0x3e0772['push'](_0x3e0772['shift']());}};_0x4aa399(++_0x56d14e);}(_0x20d6,0x1b8));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var logger=require(_0x620d('0x2'))(_0x620d('0x3'));var moment=require('moment');var BPromise=require(_0x620d('0x4'));var rp=require(_0x620d('0x5'));var fs=require('fs');var path=require(_0x620d('0x6'));var rimraf=require(_0x620d('0x7'));var config=require(_0x620d('0x8'));var attributes=require(_0x620d('0x9'));module[_0x620d('0xa')]=function(_0x46fc14,_0x28e29a){return _0x46fc14[_0x620d('0xb')](_0x620d('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x620d('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index cdcc509..78fc622 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x551d19,_0x419b36){var _0x367873=function(_0x2bb375){while(--_0x2bb375){_0x551d19['push'](_0x551d19['shift']());}};_0x367873(++_0x419b36);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _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(_0x392731,_0x5035f){var _0x3c0e67=function(_0x690148){while(--_0x690148){_0x392731['push'](_0x392731['shift']());}};_0x3c0e67(++_0x5035f);}(_0x0295,0x1f0));var _0x5029=function(_0x44532f,_0x2dac86){_0x44532f=_0x44532f-0x0;var _0x11e878=_0x0295[_0x44532f];return _0x11e878;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4fa27c9..8883e57 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 _0xc087=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc087,0x1dd));var _0x7c08=function(_0x35d06a,_0x81abc0){_0x35d06a=_0x35d06a-0x0;var _0x3cf8a5=_0xc087[_0x35d06a];return _0x3cf8a5;};'use strict';var multer=require(_0x7c08('0x0'));var util=require(_0x7c08('0x1'));var path=require(_0x7c08('0x2'));var timeout=require(_0x7c08('0x3'));var express=require(_0x7c08('0x4'));var router=express[_0x7c08('0x5')]();var auth=require(_0x7c08('0x6'));var interaction=require(_0x7c08('0x7'));var config=require(_0x7c08('0x8'));var controller=require(_0x7c08('0x9'));router[_0x7c08('0xa')]('/',auth[_0x7c08('0xb')](),controller[_0x7c08('0xc')]);router[_0x7c08('0xa')](_0x7c08('0xd'),auth['isAuthenticated'](),controller[_0x7c08('0xe')]);router[_0x7c08('0xa')]('/:id/sounds',auth['isAuthenticated'](),controller['getSounds']);router[_0x7c08('0xf')]('/',auth[_0x7c08('0xb')](),controller[_0x7c08('0x10')]);router[_0x7c08('0xf')]('/:id/sounds',auth[_0x7c08('0xb')](),controller['addSound']);router[_0x7c08('0x11')](_0x7c08('0xd'),auth[_0x7c08('0xb')](),controller[_0x7c08('0x12')]);router['delete'](_0x7c08('0xd'),auth['isAuthenticated'](),controller[_0x7c08('0x13')]);router[_0x7c08('0x14')](_0x7c08('0x15'),auth[_0x7c08('0xb')](),controller[_0x7c08('0x16')]);module[_0x7c08('0x17')]=router; \ No newline at end of file +var _0xb846=['destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','express','Router','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','create','post','/:id','update','delete'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xb846,0x1d0));var _0x6b84=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb846[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x6b84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b84('0x1'));var express=require(_0x6b84('0x2'));var router=express[_0x6b84('0x3')]();var auth=require(_0x6b84('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b84('0x5'));router[_0x6b84('0x6')]('/',auth[_0x6b84('0x7')](),controller[_0x6b84('0x8')]);router[_0x6b84('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6b84('0x9')]);router['get'](_0x6b84('0xa'),auth[_0x6b84('0x7')](),controller['getSounds']);router['post']('/',auth['isAuthenticated'](),controller[_0x6b84('0xb')]);router[_0x6b84('0xc')](_0x6b84('0xa'),auth['isAuthenticated'](),controller['addSound']);router['put'](_0x6b84('0xd'),auth[_0x6b84('0x7')](),controller[_0x6b84('0xe')]);router[_0x6b84('0xf')](_0x6b84('0xd'),auth[_0x6b84('0x7')](),controller[_0x6b84('0x10')]);router[_0x6b84('0xf')](_0x6b84('0x11'),auth[_0x6b84('0x7')](),controller[_0x6b84('0x12')]);module[_0x6b84('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e3a8929..8bf76e1 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 _0x88f1=['quietmp3','files','alpha','TIMESTAMP','sequelize','STRING','ENUM','custom','quietmp3nb'];(function(_0x46add2,_0x4346d4){var _0x226d64=function(_0x11ae18){while(--_0x11ae18){_0x46add2['push'](_0x46add2['shift']());}};_0x226d64(++_0x4346d4);}(_0x88f1,0x1c6));var _0x188f=function(_0x2e7dad,_0x2715ee){_0x2e7dad=_0x2e7dad-0x0;var _0xad1821=_0x88f1[_0x2e7dad];return _0xad1821;};'use strict';var Sequelize=require(_0x188f('0x0'));module['exports']={'name':{'type':Sequelize[_0x188f('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x188f('0x2')](_0x188f('0x3'),'files','mp3nb',_0x188f('0x4'),_0x188f('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0x188f('0x6')},'directory':{'type':Sequelize[_0x188f('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x188f('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x188f('0x1')],'allowNull':!![],'defaultValue':_0x188f('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x188f('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc06=['exports','STRING','name','custom','mp3nb','quietmp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc06,0x154));var _0x6bc0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc06[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6bc0('0x0'));module[_0x6bc0('0x1')]={'name':{'type':Sequelize[_0x6bc0('0x2')],'allowNull':![],'unique':_0x6bc0('0x3')},'mode':{'type':Sequelize['ENUM'](_0x6bc0('0x4'),'files',_0x6bc0('0x5'),'quietmp3nb',_0x6bc0('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x6bc0('0x7')},'directory':{'type':Sequelize[_0x6bc0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6bc0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6bc0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6bc0('0x2')],'allowNull':!![],'defaultValue':_0x6bc0('0x8')},'format':{'type':Sequelize[_0x6bc0('0x2')],'allowNull':!![]},'stamp':{'type':_0x6bc0('0x9')},'defaultEntry':{'type':Sequelize[_0x6bc0('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index d6aa6df..0f9264c 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(_0x5cb547,_0x54247d){var _0x4e15d0=function(_0x1bc675){while(--_0x1bc675){_0x5cb547['push'](_0x5cb547['shift']());}};_0x4e15d0(++_0x54247d);}(_0xb10b,0x12a));var _0xbb10=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0xb10b[_0x687ce7];return _0x8bb835;};'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(_0x1c08e9,_0x562147){var _0x44e390=function(_0x2b8688){while(--_0x2b8688){_0x1c08e9['push'](_0x1c08e9['shift']());}};_0x44e390(++_0x562147);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a08cf,_0x186382){_0x1a08cf=_0x1a08cf-0x0;var _0x4174b7=_0xb10b[_0x1a08cf];return _0x4174b7;};'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 ac72c86..c484669 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 _0xe85f=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0xe85f,0x1d0));var _0xfe85=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xe85f[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0xfe85('0x0'));var logger=require(_0xfe85('0x1'))(_0xfe85('0x2'));var moment=require(_0xfe85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe85('0x4'));var rimraf=require(_0xfe85('0x5'));var config=require(_0xfe85('0x6'));var attributes=require(_0xfe85('0x7'));module[_0xfe85('0x8')]=function(_0x3bee18,_0x397380){return _0x3bee18[_0xfe85('0x9')](_0xfe85('0xa'),attributes,{'tableName':_0xfe85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed15=['bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment'];(function(_0x18ac44,_0x5e525e){var _0x521d09=function(_0x512ee4){while(--_0x512ee4){_0x18ac44['push'](_0x18ac44['shift']());}};_0x521d09(++_0x5e525e);}(_0xed15,0xcc));var _0x5ed1=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xed15[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x5ed1('0x0'));var util=require(_0x5ed1('0x1'));var logger=require('../../config/logger')(_0x5ed1('0x2'));var moment=require(_0x5ed1('0x3'));var BPromise=require(_0x5ed1('0x4'));var rp=require(_0x5ed1('0x5'));var fs=require('fs');var path=require(_0x5ed1('0x6'));var rimraf=require(_0x5ed1('0x7'));var config=require('../../config/environment');var attributes=require(_0x5ed1('0x8'));module[_0x5ed1('0x9')]=function(_0x47d557,_0x3d97fe){return _0x47d557[_0x5ed1('0xa')](_0x5ed1('0xb'),attributes,{'tableName':_0x5ed1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 784b899..2083657 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 _0xc807=['../../config/environment','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0xfb2df,_0xfb7253){var _0xbb10aa=function(_0x56e9b3){while(--_0x56e9b3){_0xfb2df['push'](_0xfb2df['shift']());}};_0xbb10aa(++_0xfb7253);}(_0xc807,0x9a));var _0x7c80=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xc807[_0x16d10f];return _0x50c823;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c80('0x0'));var BPromise=require(_0x7c80('0x1'));var rs=require(_0x7c80('0x2'));var fs=require('fs');var Redis=require(_0x7c80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c80('0x4'));var logger=require('../../config/logger')(_0x7c80('0x5'));var config=require(_0x7c80('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7c80('0x7')][_0x7c80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c983f,_0x51ee3b,_0x3bee00){return new BPromise(function(_0x3ccc7d,_0x1d3582){return client[_0x7c80('0x9')](_0x2c983f,_0x3bee00)[_0x7c80('0xa')](function(_0x5cfc6a){logger[_0x7c80('0xb')](_0x7c80('0xc'),_0x51ee3b,_0x7c80('0xd'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x51ee3b,_0x7c80('0xd'),JSON[_0x7c80('0xe')](_0x5cfc6a));if(_0x5cfc6a[_0x7c80('0xf')]){if(_0x5cfc6a[_0x7c80('0xf')][_0x7c80('0x10')]===0x1f4){logger[_0x7c80('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x51ee3b,_0x5cfc6a[_0x7c80('0xf')][_0x7c80('0x11')]);return _0x1d3582(_0x5cfc6a['error'][_0x7c80('0x11')]);}logger[_0x7c80('0xf')](_0x7c80('0xc'),_0x51ee3b,_0x5cfc6a[_0x7c80('0xf')][_0x7c80('0x11')]);return _0x3ccc7d(_0x5cfc6a[_0x7c80('0xf')][_0x7c80('0x11')]);}else{logger[_0x7c80('0xb')](_0x7c80('0xc'),_0x51ee3b,_0x7c80('0xd'));_0x3ccc7d(_0x5cfc6a[_0x7c80('0x12')][_0x7c80('0x11')]);}})[_0x7c80('0x13')](function(_0x1e0630){logger['error'](_0x7c80('0xc'),_0x51ee3b,_0x1e0630);_0x1d3582(_0x1e0630);});});} \ No newline at end of file +var _0xf342=['info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x3dc73c,_0x2a4784){var _0x40e5fc=function(_0x643425){while(--_0x643425){_0x3dc73c['push'](_0x3dc73c['shift']());}};_0x40e5fc(++_0x2a4784);}(_0xf342,0xf0));var _0x2f34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf342[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2f34('0x0'));var util=require(_0x2f34('0x1'));var moment=require(_0x2f34('0x2'));var BPromise=require(_0x2f34('0x3'));var rs=require(_0x2f34('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f34('0x5'))['db'];var utils=require(_0x2f34('0x6'));var logger=require(_0x2f34('0x7'))(_0x2f34('0x8'));var config=require(_0x2f34('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28dd8a,_0x52af96,_0x1ea265){return new BPromise(function(_0x234e7b,_0x1569cc){return client[_0x2f34('0xb')](_0x28dd8a,_0x1ea265)[_0x2f34('0xc')](function(_0x440a4a){logger[_0x2f34('0xd')](_0x2f34('0xe'),_0x52af96,'request\x20sent');logger[_0x2f34('0xf')](_0x2f34('0x10'),_0x52af96,'request\x20sent',JSON['stringify'](_0x440a4a));if(_0x440a4a[_0x2f34('0x11')]){if(_0x440a4a[_0x2f34('0x11')][_0x2f34('0x12')]===0x1f4){logger['error'](_0x2f34('0xe'),_0x52af96,_0x440a4a[_0x2f34('0x11')][_0x2f34('0x13')]);return _0x1569cc(_0x440a4a[_0x2f34('0x11')][_0x2f34('0x13')]);}logger['error'](_0x2f34('0xe'),_0x52af96,_0x440a4a[_0x2f34('0x11')][_0x2f34('0x13')]);return _0x234e7b(_0x440a4a[_0x2f34('0x11')][_0x2f34('0x13')]);}else{logger[_0x2f34('0xd')](_0x2f34('0xe'),_0x52af96,_0x2f34('0x14'));_0x234e7b(_0x440a4a[_0x2f34('0x15')][_0x2f34('0x13')]);}})[_0x2f34('0x16')](function(_0x153906){logger[_0x2f34('0x11')](_0x2f34('0xe'),_0x52af96,_0x153906);_0x1569cc(_0x153906);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b548857..d279e79 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 _0x09bb=['put','update','destroy','delete','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','/:id','/:id/users','getAgents','post','create','addAgents'];(function(_0x1f832d,_0x336ecb){var _0x5d6465=function(_0x5f0891){while(--_0x5f0891){_0x1f832d['push'](_0x1f832d['shift']());}};_0x5d6465(++_0x336ecb);}(_0x09bb,0x130));var _0xb09b=function(_0x245f0e,_0x57fcf9){_0x245f0e=_0x245f0e-0x0;var _0x4a6aef=_0x09bb[_0x245f0e];return _0x4a6aef;};'use strict';var multer=require(_0xb09b('0x0'));var util=require(_0xb09b('0x1'));var path=require(_0xb09b('0x2'));var timeout=require(_0xb09b('0x3'));var express=require('express');var router=express[_0xb09b('0x4')]();var auth=require(_0xb09b('0x5'));var interaction=require(_0xb09b('0x6'));var config=require('../../config/environment');var controller=require(_0xb09b('0x7'));router['get']('/',auth[_0xb09b('0x8')](),controller[_0xb09b('0x9')]);router[_0xb09b('0xa')](_0xb09b('0xb'),auth[_0xb09b('0x8')](),controller['describe']);router['get'](_0xb09b('0xc'),auth[_0xb09b('0x8')](),controller['show']);router[_0xb09b('0xa')](_0xb09b('0xd'),auth[_0xb09b('0x8')](),controller[_0xb09b('0xe')]);router[_0xb09b('0xf')]('/',auth[_0xb09b('0x8')](),controller[_0xb09b('0x10')]);router[_0xb09b('0xf')](_0xb09b('0xd'),auth[_0xb09b('0x8')](),controller[_0xb09b('0x11')]);router[_0xb09b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb09b('0x13')]);router['delete'](_0xb09b('0xc'),auth['isAuthenticated'](),controller[_0xb09b('0x14')]);router[_0xb09b('0x15')](_0xb09b('0xd'),auth[_0xb09b('0x8')](),controller[_0xb09b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x71ea=['show','/:id/users','getAgents','post','create','addAgents','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x71ea,0xe1));var _0xa71e=function(_0x1874dd,_0x37cfdd){_0x1874dd=_0x1874dd-0x0;var _0x2b44a5=_0x71ea[_0x1874dd];return _0x2b44a5;};'use strict';var multer=require(_0xa71e('0x0'));var util=require('util');var path=require(_0xa71e('0x1'));var timeout=require(_0xa71e('0x2'));var express=require(_0xa71e('0x3'));var router=express[_0xa71e('0x4')]();var auth=require(_0xa71e('0x5'));var interaction=require(_0xa71e('0x6'));var config=require(_0xa71e('0x7'));var controller=require(_0xa71e('0x8'));router[_0xa71e('0x9')]('/',auth[_0xa71e('0xa')](),controller[_0xa71e('0xb')]);router[_0xa71e('0x9')](_0xa71e('0xc'),auth['isAuthenticated'](),controller[_0xa71e('0xd')]);router['get'](_0xa71e('0xe'),auth[_0xa71e('0xa')](),controller[_0xa71e('0xf')]);router[_0xa71e('0x9')](_0xa71e('0x10'),auth[_0xa71e('0xa')](),controller[_0xa71e('0x11')]);router[_0xa71e('0x12')]('/',auth[_0xa71e('0xa')](),controller[_0xa71e('0x13')]);router[_0xa71e('0x12')](_0xa71e('0x10'),auth[_0xa71e('0xa')](),controller[_0xa71e('0x14')]);router['put'](_0xa71e('0xe'),auth['isAuthenticated'](),controller[_0xa71e('0x15')]);router['delete'](_0xa71e('0xe'),auth[_0xa71e('0xa')](),controller['destroy']);router[_0xa71e('0x16')](_0xa71e('0x10'),auth[_0xa71e('0xa')](),controller['removeAgents']);module[_0xa71e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 747a80e..484bee4 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 _0x3b20=['VIRTUAL','system-','INTEGER','sequelize','exports','STRING','name'];(function(_0x3cde2e,_0x1d3514){var _0x39cae4=function(_0x405ff2){while(--_0x405ff2){_0x3cde2e['push'](_0x3cde2e['shift']());}};_0x39cae4(++_0x1d3514);}(_0x3b20,0x11b));var _0x03b2=function(_0x20ff1a,_0x3b6b15){_0x20ff1a=_0x20ff1a-0x0;var _0x34efdb=_0x3b20[_0x20ff1a];return _0x34efdb;};'use strict';var Sequelize=require(_0x03b2('0x0'));module[_0x03b2('0x1')]={'name':{'type':Sequelize[_0x03b2('0x2')],'allowNull':![],'unique':_0x03b2('0x3')},'prefix':{'type':Sequelize[_0x03b2('0x4')],'get':function(_0x1500c5){return _0x03b2('0x5')+this['getDataValue'](_0x03b2('0x3'))+'-';}},'description':{'type':Sequelize[_0x03b2('0x2')]},'callerIdAll':{'type':Sequelize[_0x03b2('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x03b2('0x6')]}}; \ No newline at end of file +var _0xd2b4=['system-','getDataValue','name','STRING','sequelize','VIRTUAL'];(function(_0x5227ab,_0x514da4){var _0x3dc702=function(_0x592b15){while(--_0x592b15){_0x5227ab['push'](_0x5227ab['shift']());}};_0x3dc702(++_0x514da4);}(_0xd2b4,0x70));var _0x4d2b=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xd2b4[_0x336ca2];return _0xda59a6;};'use strict';var Sequelize=require(_0x4d2b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x4d2b('0x1')],'get':function(_0x4aa35f){return _0x4d2b('0x2')+this[_0x4d2b('0x3')](_0x4d2b('0x4'))+'-';}},'description':{'type':Sequelize[_0x4d2b('0x5')]},'callerIdAll':{'type':Sequelize[_0x4d2b('0x5')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0126864..1cb88d8 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 _0x26ca=['options','count','includeAll','include','findAll','rows','show','params','fields','find','catch','describe','transaction','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','Voice\x20Prefix','VoicePrefixId','get','VoiceExtensionId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','charAt','update','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','rawAttributes','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','Content-Range','json','reject','then','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','model','length','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge'];(function(_0x2d2ab7,_0x331a02){var _0x158eb1=function(_0x433f42){while(--_0x433f42){_0x2d2ab7['push'](_0x2d2ab7['shift']());}};_0x158eb1(++_0x331a02);}(_0x26ca,0xb5));var _0xa26c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x26ca[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa26c('0x0'));var rimraf=require(_0xa26c('0x1'));var zipdir=require(_0xa26c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa26c('0x3'));var BPromise=require(_0xa26c('0x4'));var Mustache=require(_0xa26c('0x5'));var util=require('util');var path=require(_0xa26c('0x6'));var sox=require(_0xa26c('0x7'));var csv=require(_0xa26c('0x8'));var ejs=require(_0xa26c('0x9'));var fs=require('fs');var _=require(_0xa26c('0xa'));var squel=require(_0xa26c('0xb'));var crypto=require(_0xa26c('0xc'));var jsforce=require(_0xa26c('0xd'));var deskjs=require(_0xa26c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa26c('0xf'));var Papa=require('papaparse');var Redis=require(_0xa26c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa26c('0x11'));var hardwareService=require(_0xa26c('0x12'));var logger=require('../../config/logger')(_0xa26c('0x13'));var utils=require(_0xa26c('0x14'));var config=require(_0xa26c('0x15'));var db=require(_0xa26c('0x16'))['db'];config[_0xa26c('0x17')]=_[_0xa26c('0x18')](config[_0xa26c('0x17')],{'host':_0xa26c('0x19'),'port':0x18eb});var socket=require(_0xa26c('0x1a'))(new Redis(config[_0xa26c('0x17')]));require('./voicePrefix.socket')[_0xa26c('0x1b')](socket);function respondWithStatusCode(_0x3d343a,_0x418a21){_0x418a21=_0x418a21||0xcc;return function(_0x139b76){if(_0x139b76){return _0x3d343a[_0xa26c('0x1c')](_0x418a21);}return _0x3d343a['status'](_0x418a21)[_0xa26c('0x1d')]();};}function respondWithResult(_0x351913,_0x125a94){_0x125a94=_0x125a94||0xc8;return function(_0x48e5e1){if(_0x48e5e1){return _0x351913[_0xa26c('0x1e')](_0x125a94)['json'](_0x48e5e1);}};}function respondWithFilteredResult(_0x24993c,_0x733ac4){return function(_0x5a899){if(_0x5a899){var _0x25419c=_0x5a899['count'],_0x2f2c65=_0x733ac4[_0xa26c('0x1f')],_0x364563=_0x733ac4[_0xa26c('0x1f')]+_0x733ac4['limit'],_0x43db29;if(_0x364563>=_0x25419c){_0x364563=_0x25419c;_0x43db29=0xc8;}else{_0x43db29=0xce;}_0x24993c[_0xa26c('0x1e')](_0x43db29);return _0x24993c['set'](_0xa26c('0x20'),_0x2f2c65+'-'+_0x364563+'/'+_0x25419c)[_0xa26c('0x21')](_0x5a899);}return null;};}function patchUpdates(_0x42beed){return function(_0xc97b71){try{jsonpatch['apply'](_0xc97b71,_0x42beed,!![]);}catch(_0x1039de){return BPromise[_0xa26c('0x22')](_0x1039de);}return _0xc97b71['save']();};}function saveUpdates(_0x1d80dd,_0x33d7e1){return function(_0x978bcb){if(_0x978bcb){return _0x978bcb['update'](_0x1d80dd)[_0xa26c('0x23')](function(_0x433a5d){return _0x433a5d;});}return null;};}function removeEntity(_0x16465c,_0x482467){return function(_0x411972){if(_0x411972){return _0x411972['destroy']()[_0xa26c('0x23')](function(){var _0x2eb04e=_0x411972['get']({'plain':!![]});var _0xcec545=_0xa26c('0x24');return db[_0xa26c('0x25')][_0xa26c('0x26')]({'where':{'type':_0xcec545,'resourceId':_0x2eb04e['id']}})[_0xa26c('0x23')](function(){return _0x411972;});})[_0xa26c('0x23')](function(){_0x16465c[_0xa26c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45592e,_0x7d0968){return function(_0x3f4d81){if(!_0x3f4d81){_0x45592e[_0xa26c('0x1c')](0x194);}return _0x3f4d81;};}function handleError(_0x30270c,_0x4ab778){_0x4ab778=_0x4ab778||0x1f4;return function(_0x1794b0){logger[_0xa26c('0x27')](_0x1794b0[_0xa26c('0x28')]);if(_0x1794b0[_0xa26c('0x29')]){delete _0x1794b0[_0xa26c('0x29')];}_0x30270c[_0xa26c('0x1e')](_0x4ab778)[_0xa26c('0x2a')](_0x1794b0);};}exports[_0xa26c('0x2b')]=function(_0x1adb4e,_0x59bc50){var _0x130907={},_0xe80c46={},_0x2f7249={'count':0x0,'rows':[]};var _0x29416d=_[_0xa26c('0x2c')](db[_0xa26c('0x2d')]['rawAttributes'],function(_0x1e3b62){return{'name':_0x1e3b62[_0xa26c('0x2e')],'type':_0x1e3b62[_0xa26c('0x2f')][_0xa26c('0x30')]};});_0xe80c46['model']=_[_0xa26c('0x2c')](_0x29416d,_0xa26c('0x29'));_0xe80c46[_0xa26c('0x31')]=_[_0xa26c('0x32')](_0x1adb4e[_0xa26c('0x31')]);_0xe80c46[_0xa26c('0x33')]=_[_0xa26c('0x34')](_0xe80c46[_0xa26c('0x35')],_0xe80c46[_0xa26c('0x31')]);_0x130907['attributes']=_[_0xa26c('0x34')](_0xe80c46[_0xa26c('0x35')],qs['fields'](_0x1adb4e['query']['fields']));_0x130907['attributes']=_0x130907['attributes'][_0xa26c('0x36')]?_0x130907[_0xa26c('0x37')]:_0xe80c46[_0xa26c('0x35')];if(!_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x38')](_0xa26c('0x39'))){_0x130907[_0xa26c('0x3a')]=qs[_0xa26c('0x3a')](_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x3a')]);_0x130907[_0xa26c('0x1f')]=qs['offset'](_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x1f')]);}_0x130907[_0xa26c('0x3b')]=qs[_0xa26c('0x3c')](_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x3c')]);_0x130907['where']=qs[_0xa26c('0x33')](_[_0xa26c('0x3d')](_0x1adb4e['query'],_0xe80c46['filters']),_0x29416d);if(_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x3e')]){_0x130907[_0xa26c('0x3f')]=_['merge'](_0x130907[_0xa26c('0x3f')],{'$or':_['map'](_0x29416d,function(_0x2a9311){if(_0x2a9311['type']!=='VIRTUAL'){var _0x2200ba={};_0x2200ba[_0x2a9311[_0xa26c('0x29')]]={'$like':'%'+_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x3e')]+'%'};return _0x2200ba;}})});}_0x130907=_[_0xa26c('0x40')]({},_0x130907,_0x1adb4e[_0xa26c('0x41')]);var _0x17bc61={'where':_0x130907[_0xa26c('0x3f')]};return db[_0xa26c('0x2d')][_0xa26c('0x42')](_0x17bc61)[_0xa26c('0x23')](function(_0x45bf52){_0x2f7249[_0xa26c('0x42')]=_0x45bf52;if(_0x1adb4e[_0xa26c('0x31')][_0xa26c('0x43')]){_0x130907[_0xa26c('0x44')]=[{'all':!![]}];}return db[_0xa26c('0x2d')][_0xa26c('0x45')](_0x130907);})['then'](function(_0x31786a){_0x2f7249[_0xa26c('0x46')]=_0x31786a;return _0x2f7249;})[_0xa26c('0x23')](respondWithFilteredResult(_0x59bc50,_0x130907))['catch'](handleError(_0x59bc50,null));};exports[_0xa26c('0x47')]=function(_0x3125b0,_0x13f6ee){var _0xe7ecaf={'raw':![],'where':{'id':_0x3125b0[_0xa26c('0x48')]['id']}},_0x5f288f={};_0x5f288f[_0xa26c('0x35')]=_[_0xa26c('0x32')](db[_0xa26c('0x2d')]['rawAttributes']);_0x5f288f['query']=_[_0xa26c('0x32')](_0x3125b0[_0xa26c('0x31')]);_0x5f288f[_0xa26c('0x33')]=_['intersection'](_0x5f288f[_0xa26c('0x35')],_0x5f288f[_0xa26c('0x31')]);_0xe7ecaf[_0xa26c('0x37')]=_[_0xa26c('0x34')](_0x5f288f[_0xa26c('0x35')],qs[_0xa26c('0x49')](_0x3125b0['query'][_0xa26c('0x49')]));_0xe7ecaf[_0xa26c('0x37')]=_0xe7ecaf[_0xa26c('0x37')]['length']?_0xe7ecaf[_0xa26c('0x37')]:_0x5f288f[_0xa26c('0x35')];if(_0x3125b0[_0xa26c('0x31')][_0xa26c('0x43')]){_0xe7ecaf[_0xa26c('0x44')]=[{'all':!![]}];}_0xe7ecaf=_[_0xa26c('0x40')]({},_0xe7ecaf,_0x3125b0[_0xa26c('0x41')]);return db['VoicePrefix'][_0xa26c('0x4a')](_0xe7ecaf)[_0xa26c('0x23')](handleEntityNotFound(_0x13f6ee,null))[_0xa26c('0x23')](respondWithResult(_0x13f6ee,null))[_0xa26c('0x4b')](handleError(_0x13f6ee,null));};exports[_0xa26c('0x26')]=function(_0x9acdf9,_0x5e955d){return db[_0xa26c('0x2d')]['find']({'where':{'id':_0x9acdf9[_0xa26c('0x48')]['id']}})[_0xa26c('0x23')](handleEntityNotFound(_0x5e955d,null))[_0xa26c('0x23')](removeEntity(_0x5e955d,null))[_0xa26c('0x4b')](handleError(_0x5e955d,null));};exports[_0xa26c('0x4c')]=function(_0x6108be,_0x5db3bb){return db[_0xa26c('0x2d')][_0xa26c('0x4c')]()['then'](respondWithResult(_0x5db3bb,null))[_0xa26c('0x4b')](handleError(_0x5db3bb,null));};exports['create']=function(_0x200b8f,_0x10f09d){var _0x906e2e;return db['sequelize'][_0xa26c('0x4d')](function(_0x21cbdf){return db[_0xa26c('0x2d')][_0xa26c('0x4e')](_0x200b8f[_0xa26c('0x4f')],{'transaction':_0x21cbdf})[_0xa26c('0x23')](function(_0x1eadf6){_0x906e2e=_0x1eadf6['get']({'plain':!![]});return db['VoiceExtension'][_0xa26c('0x4a')]({'where':{'id':_0x906e2e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x5e07c8){return createVoicePrefixExtensions(_0x906e2e,_0x5e07c8,_0x21cbdf);});});})[_0xa26c('0x23')](function(){var _0x48ca74=_0x200b8f[_0xa26c('0x50')]['get']({'plain':!![]});if(!_0x48ca74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48ca74[_0xa26c('0x51')]===_0xa26c('0x50')){var _0x1ede2=_0x906e2e;return db[_0xa26c('0x52')][_0xa26c('0x4a')]({'where':{'name':_0xa26c('0x24'),'userProfileId':_0x48ca74[_0xa26c('0x53')]},'raw':!![]})[_0xa26c('0x23')](function(_0x552424){if(_0x552424&&_0x552424[_0xa26c('0x54')]===0x0){return db['UserProfileResource'][_0xa26c('0x4e')]({'name':_0x1ede2[_0xa26c('0x29')],'resourceId':_0x1ede2['id'],'type':_0x552424[_0xa26c('0x29')],'sectionId':_0x552424['id']},{})[_0xa26c('0x23')](function(){return _0x906e2e;});}else{return _0x906e2e;}})[_0xa26c('0x4b')](function(_0x481215){logger['error'](_0xa26c('0x55'),_0x481215);throw _0x481215;});}return _0x906e2e;})[_0xa26c('0x23')](respondWithResult(_0x10f09d,null))[_0xa26c('0x4b')](handleError(_0x10f09d,null));};function Extension(_0x26e2ac,_0x48e7ee,_0x4023cf,_0x3e4c90){this[_0xa26c('0x56')]=_0xa26c('0x57');this[_0xa26c('0x58')]=_0x26e2ac;this[_0xa26c('0x59')]=_0x4023cf;this[_0xa26c('0x2f')]='system';this[_0xa26c('0x5a')]=_0xa26c('0x5b');this[_0xa26c('0x5c')]=_0x48e7ee;this['appdata']=_0x3e4c90;}function createVoicePrefixExtensions(_0x281cba,_0x128621,_0x22fb25){return new BPromise(function(_0x599071,_0x33a126){var _0x86b228=new Extension(formatPrefixName(_0x281cba['prefix']),0x1,'NoOp',_0xa26c('0x5d'));_0x86b228[_0xa26c('0x5e')]=_0x281cba['id'];return db['VoiceExtension']['create'](_0x86b228,{'transaction':_0x22fb25})[_0xa26c('0x23')](function(_0x2165ca){var _0x4e1973=_0x2165ca[_0xa26c('0x5f')]({'plain':!![]});var _0x51e9bf=_[_0xa26c('0x2c')](addVoicePrefixExtensions(_0x281cba,_0x128621),function(_0x512c7d){_0x512c7d[_0xa26c('0x60')]=_0x4e1973['id'];_0x512c7d[_0xa26c('0x5e')]=_0x281cba['id'];return _0x512c7d;});return db[_0xa26c('0x61')][_0xa26c('0x62')](_0x51e9bf,{'transaction':_0x22fb25})['then'](function(_0x16508d){if(!_0x16508d){return _0x33a126(_0xa26c('0x63'));}else{return _0x599071(_0x16508d);}})[_0xa26c('0x4b')](function(_0x526eaa){return _0x33a126(_0x526eaa);});});;});};function addVoicePrefixExtensions(_0x4730cf,_0x2e89b4){var _0xf019f5=[];var _0x200f7a=formatPrefixName(_0x4730cf[_0xa26c('0x64')]);_0xf019f5['push'](new Extension(_0x200f7a,0x2,_0xa26c('0x65'),_0xa26c('0x66')+_0x4730cf[_0xa26c('0x29')]));if(_0x4730cf[_0xa26c('0x67')]){_0xf019f5[_0xa26c('0x68')](new Extension(_0x200f7a,0x3,_0xa26c('0x65'),_0xa26c('0x69')+_0x4730cf[_0xa26c('0x67')]));}else{_0xf019f5[_0xa26c('0x68')](new Extension(_0x200f7a,0x3,'NoOp','No\x20callerid\x20available'));}_0xf019f5['push'](new Extension(_0x200f7a,0x4,_0xa26c('0x6a'),_0x2e89b4['context']+','+'${EXTEN:'+(0x8+_0x4730cf[_0xa26c('0x29')][_0xa26c('0x36')])+'}'+','+0x1));return _0xf019f5;}function formatPrefixName(_0x193ab2){var _0x255005='_';for(var _0x3764de=0x0;_0x3764de<_0x193ab2[_0xa26c('0x36')];_0x3764de++){if(_0x193ab2[_0xa26c('0x6b')](_0x3764de)=='-'){_0x255005+=_0x193ab2[_0xa26c('0x6b')](_0x3764de);}else{_0x255005+='['+_0x193ab2['charAt'](_0x3764de)+']';}}_0x255005+='.';return _0x255005;}exports[_0xa26c('0x6c')]=function(_0x37ae32,_0x211a81,_0x139470){var _0x300305=_0x37ae32['body'];_0x300305[_0xa26c('0x64')]=_0xa26c('0x6d')+_0x300305['name']+'-';return db['sequelize'][_0xa26c('0x4d')](function(_0x308ba4){return db[_0xa26c('0x2d')]['update'](_0x300305,{'where':{'id':_0x300305['id']},'transaction':_0x308ba4})[_0xa26c('0x23')](function(){return db[_0xa26c('0x61')][_0xa26c('0x26')]({'where':{'VoicePrefixId':_0x300305['id']},'transaction':_0x308ba4})['then'](function(){return db[_0xa26c('0x61')][_0xa26c('0x4a')]({'where':{'id':_0x300305[_0xa26c('0x60')]},'raw':!![]})['then'](function(_0x2cbdee){return createVoicePrefixExtensions(_0x300305,_0x2cbdee,_0x308ba4);});});});})[_0xa26c('0x23')](function(){return db[_0xa26c('0x2d')][_0xa26c('0x6e')](_0x300305['id']);})[_0xa26c('0x23')](respondWithResult(_0x211a81,null))[_0xa26c('0x4b')](handleError(_0x211a81,null));};exports[_0xa26c('0x6f')]=function(_0x21d6fb,_0x37403c,_0x5efb87){return db[_0xa26c('0x2d')][_0xa26c('0x4a')]({'where':{'id':_0x21d6fb['params']['id']}})[_0xa26c('0x23')](handleEntityNotFound(_0x37403c,null))[_0xa26c('0x23')](function(_0x33968b){if(_0x33968b){return _0x33968b[_0xa26c('0x6f')](_0x21d6fb[_0xa26c('0x4f')]['ids'],_['omit'](_0x21d6fb['body'],[_0xa26c('0x70'),'id'])||{})[_0xa26c('0x71')](function(_0xcbe3cb){for(var _0x425dbd=0x0;_0x425dbd<_0x21d6fb['body'][_0xa26c('0x70')][_0xa26c('0x36')];_0x425dbd+=0x1){socket[_0xa26c('0x72')](_0xa26c('0x73'),{'UserId':_0x21d6fb[_0xa26c('0x4f')][_0xa26c('0x70')][_0x425dbd],'VoicePrefixId':_0x21d6fb[_0xa26c('0x48')]['id']});}return _0xcbe3cb;});}})['then'](respondWithResult(_0x37403c,null))['catch'](handleError(_0x37403c,null));};exports[_0xa26c('0x74')]=function(_0x239fc6,_0x2c1069,_0x53069b){return db['VoicePrefix'][_0xa26c('0x4a')]({'where':{'id':_0x239fc6['params']['id']}})[_0xa26c('0x23')](handleEntityNotFound(_0x2c1069,null))['then'](function(_0x4dcd56){if(_0x4dcd56){return _0x4dcd56[_0xa26c('0x74')](_0x239fc6[_0xa26c('0x31')][_0xa26c('0x70')])[_0xa26c('0x23')](function(){if(_[_0xa26c('0x75')](_0x239fc6[_0xa26c('0x31')][_0xa26c('0x70')])){for(var _0x1b0be3=0x0;_0x1b0be3<_0x239fc6[_0xa26c('0x31')][_0xa26c('0x70')][_0xa26c('0x36')];_0x1b0be3+=0x1){socket[_0xa26c('0x72')](_0xa26c('0x76'),{'UserId':Number(_0x239fc6[_0xa26c('0x31')][_0xa26c('0x70')][_0x1b0be3]),'VoicePrefixId':Number(_0x239fc6[_0xa26c('0x48')]['id'])});}}else{socket[_0xa26c('0x72')](_0xa26c('0x76'),{'UserId':Number(_0x239fc6[_0xa26c('0x31')]['ids']),'VoicePrefixId':Number(_0x239fc6[_0xa26c('0x48')]['id'])});}});}})[_0xa26c('0x23')](respondWithStatusCode(_0x2c1069,null))['catch'](handleError(_0x2c1069,null));};exports['getAgents']=function(_0x141f12,_0x52c876,_0x4a056f){var _0x1235fd={};var _0x5d0245={};var _0x217516;var _0xc74c9f;return db[_0xa26c('0x2d')][_0xa26c('0x77')]({'where':{'id':_0x141f12[_0xa26c('0x48')]['id']}})[_0xa26c('0x23')](handleEntityNotFound(_0x52c876,null))[_0xa26c('0x23')](function(_0x25ce44){if(_0x25ce44){_0x217516=_0x25ce44;_0x5d0245['model']=_[_0xa26c('0x32')](db[_0xa26c('0x78')][_0xa26c('0x79')]);_0x5d0245[_0xa26c('0x31')]=_[_0xa26c('0x32')](_0x141f12[_0xa26c('0x31')]);_0x5d0245['filters']=_['intersection'](_0x5d0245[_0xa26c('0x35')],_0x5d0245[_0xa26c('0x31')]);_0x1235fd[_0xa26c('0x37')]=_[_0xa26c('0x34')](_0x5d0245[_0xa26c('0x35')],qs[_0xa26c('0x49')](_0x141f12[_0xa26c('0x31')][_0xa26c('0x49')]));_0x1235fd[_0xa26c('0x37')]=_0x1235fd[_0xa26c('0x37')]['length']?_0x1235fd[_0xa26c('0x37')]:_0x5d0245[_0xa26c('0x35')];_0x1235fd[_0xa26c('0x3b')]=qs[_0xa26c('0x3c')](_0x141f12['query'][_0xa26c('0x3c')]);_0x1235fd[_0xa26c('0x3f')]=qs[_0xa26c('0x33')](_[_0xa26c('0x3d')](_0x141f12[_0xa26c('0x31')],_0x5d0245['filters']));if(_0x141f12['query'][_0xa26c('0x3e')]){_0x1235fd['where']=_['merge'](_0x1235fd[_0xa26c('0x3f')],{'$or':_[_0xa26c('0x2c')](_0x1235fd[_0xa26c('0x37')],function(_0x4ab356){var _0x8877b9={};_0x8877b9[_0x4ab356]={'$like':'%'+_0x141f12[_0xa26c('0x31')][_0xa26c('0x3e')]+'%'};return _0x8877b9;})});}_0x1235fd=_['merge']({},_0x1235fd,_0x141f12[_0xa26c('0x41')]);return _0x217516['getAgents'](_0x1235fd);}})['then'](function(_0x118195){if(_0x118195){_0xc74c9f=_0x118195[_0xa26c('0x36')];if(!_0x141f12['query']['hasOwnProperty'](_0xa26c('0x39'))){_0x1235fd[_0xa26c('0x3a')]=qs[_0xa26c('0x3a')](_0x141f12[_0xa26c('0x31')][_0xa26c('0x3a')]);_0x1235fd[_0xa26c('0x1f')]=qs[_0xa26c('0x1f')](_0x141f12[_0xa26c('0x31')][_0xa26c('0x1f')]);}return _0x217516[_0xa26c('0x7a')](_0x1235fd);}})[_0xa26c('0x23')](function(_0x2c6459){if(_0x2c6459){return _0x2c6459?{'count':_0xc74c9f,'rows':_0x2c6459}:null;}})[_0xa26c('0x23')](respondWithResult(_0x52c876,null))['catch'](handleError(_0x52c876,null));}; \ No newline at end of file +var _0xbb14=['Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','callerIdAll','goto','${EXTEN:','length','charAt','prefix','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','VoicePrefixes','UserProfileResource','error','stack','name','index','map','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VoicePrefix','includeAll','include','rows','show','params','catch','describe','sequelize','transaction','create','body','get','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb14,0x110));var _0x4bb1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbb14[_0x6131cd];return _0x47e916;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4bb1('0x0'));var rimraf=require(_0x4bb1('0x1'));var zipdir=require(_0x4bb1('0x2'));var jsonpatch=require(_0x4bb1('0x3'));var rp=require(_0x4bb1('0x4'));var moment=require('moment');var BPromise=require(_0x4bb1('0x5'));var Mustache=require('mustache');var util=require(_0x4bb1('0x6'));var path=require(_0x4bb1('0x7'));var sox=require(_0x4bb1('0x8'));var csv=require(_0x4bb1('0x9'));var ejs=require(_0x4bb1('0xa'));var fs=require('fs');var _=require(_0x4bb1('0xb'));var squel=require(_0x4bb1('0xc'));var crypto=require(_0x4bb1('0xd'));var jsforce=require(_0x4bb1('0xe'));var deskjs=require(_0x4bb1('0xf'));var toCsv=require(_0x4bb1('0x9'));var querystring=require('querystring');var Papa=require(_0x4bb1('0x10'));var Redis=require(_0x4bb1('0x11'));var authService=require(_0x4bb1('0x12'));var qs=require(_0x4bb1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bb1('0x14'));var logger=require(_0x4bb1('0x15'))('api');var utils=require(_0x4bb1('0x16'));var config=require('../../config/environment');var db=require(_0x4bb1('0x17'))['db'];config[_0x4bb1('0x18')]=_['defaults'](config['redis'],{'host':_0x4bb1('0x19'),'port':0x18eb});var socket=require(_0x4bb1('0x1a'))(new Redis(config[_0x4bb1('0x18')]));require(_0x4bb1('0x1b'))['register'](socket);function respondWithStatusCode(_0x12b870,_0x29e4aa){_0x29e4aa=_0x29e4aa||0xcc;return function(_0x2ba7c8){if(_0x2ba7c8){return _0x12b870[_0x4bb1('0x1c')](_0x29e4aa);}return _0x12b870[_0x4bb1('0x1d')](_0x29e4aa)[_0x4bb1('0x1e')]();};}function respondWithResult(_0x4ea589,_0xf453d3){_0xf453d3=_0xf453d3||0xc8;return function(_0x5671f4){if(_0x5671f4){return _0x4ea589[_0x4bb1('0x1d')](_0xf453d3)[_0x4bb1('0x1f')](_0x5671f4);}};}function respondWithFilteredResult(_0xcdbf3e,_0x4336b7){return function(_0x208389){if(_0x208389){var _0x4d490b=_0x208389[_0x4bb1('0x20')],_0xff9683=_0x4336b7['offset'],_0x3074d5=_0x4336b7[_0x4bb1('0x21')]+_0x4336b7[_0x4bb1('0x22')],_0xd0e6da;if(_0x3074d5>=_0x4d490b){_0x3074d5=_0x4d490b;_0xd0e6da=0xc8;}else{_0xd0e6da=0xce;}_0xcdbf3e[_0x4bb1('0x1d')](_0xd0e6da);return _0xcdbf3e['set'](_0x4bb1('0x23'),_0xff9683+'-'+_0x3074d5+'/'+_0x4d490b)[_0x4bb1('0x1f')](_0x208389);}return null;};}function patchUpdates(_0x4c2911){return function(_0x489725){try{jsonpatch[_0x4bb1('0x24')](_0x489725,_0x4c2911,!![]);}catch(_0x59c436){return BPromise[_0x4bb1('0x25')](_0x59c436);}return _0x489725['save']();};}function saveUpdates(_0x20730f,_0x598c47){return function(_0x252043){if(_0x252043){return _0x252043[_0x4bb1('0x26')](_0x20730f)['then'](function(_0x3653dd){return _0x3653dd;});}return null;};}function removeEntity(_0x393064,_0x120af2){return function(_0x2ded18){if(_0x2ded18){return _0x2ded18[_0x4bb1('0x27')]()[_0x4bb1('0x28')](function(){var _0x46e4e3=_0x2ded18['get']({'plain':!![]});var _0x3774c6=_0x4bb1('0x29');return db[_0x4bb1('0x2a')][_0x4bb1('0x27')]({'where':{'type':_0x3774c6,'resourceId':_0x46e4e3['id']}})[_0x4bb1('0x28')](function(){return _0x2ded18;});})['then'](function(){_0x393064['status'](0xcc)[_0x4bb1('0x1e')]();});}};}function handleEntityNotFound(_0x2f6ceb,_0x20fbd1){return function(_0x3f0894){if(!_0x3f0894){_0x2f6ceb['sendStatus'](0x194);}return _0x3f0894;};}function handleError(_0x1821e5,_0x1c2130){_0x1c2130=_0x1c2130||0x1f4;return function(_0x309fc4){logger[_0x4bb1('0x2b')](_0x309fc4[_0x4bb1('0x2c')]);if(_0x309fc4[_0x4bb1('0x2d')]){delete _0x309fc4['name'];}_0x1821e5['status'](_0x1c2130)['send'](_0x309fc4);};}exports[_0x4bb1('0x2e')]=function(_0x3650b8,_0x4e38bc){var _0x352ec7={},_0x215290={},_0x124f00={'count':0x0,'rows':[]};var _0x4025e9=_[_0x4bb1('0x2f')](db['VoicePrefix']['rawAttributes'],function(_0x2ad8b0){return{'name':_0x2ad8b0[_0x4bb1('0x30')],'type':_0x2ad8b0['type']['key']};});_0x215290[_0x4bb1('0x31')]=_[_0x4bb1('0x2f')](_0x4025e9,'name');_0x215290[_0x4bb1('0x32')]=_[_0x4bb1('0x33')](_0x3650b8[_0x4bb1('0x32')]);_0x215290[_0x4bb1('0x34')]=_['intersection'](_0x215290[_0x4bb1('0x31')],_0x215290[_0x4bb1('0x32')]);_0x352ec7['attributes']=_[_0x4bb1('0x35')](_0x215290['model'],qs[_0x4bb1('0x36')](_0x3650b8['query'][_0x4bb1('0x36')]));_0x352ec7['attributes']=_0x352ec7[_0x4bb1('0x37')]['length']?_0x352ec7['attributes']:_0x215290[_0x4bb1('0x31')];if(!_0x3650b8[_0x4bb1('0x32')]['hasOwnProperty'](_0x4bb1('0x38'))){_0x352ec7['limit']=qs[_0x4bb1('0x22')](_0x3650b8[_0x4bb1('0x32')][_0x4bb1('0x22')]);_0x352ec7[_0x4bb1('0x21')]=qs[_0x4bb1('0x21')](_0x3650b8['query']['offset']);}_0x352ec7[_0x4bb1('0x39')]=qs[_0x4bb1('0x3a')](_0x3650b8[_0x4bb1('0x32')][_0x4bb1('0x3a')]);_0x352ec7[_0x4bb1('0x3b')]=qs['filters'](_[_0x4bb1('0x3c')](_0x3650b8['query'],_0x215290[_0x4bb1('0x34')]),_0x4025e9);if(_0x3650b8[_0x4bb1('0x32')][_0x4bb1('0x3d')]){_0x352ec7[_0x4bb1('0x3b')]=_['merge'](_0x352ec7[_0x4bb1('0x3b')],{'$or':_[_0x4bb1('0x2f')](_0x4025e9,function(_0x35abb1){if(_0x35abb1[_0x4bb1('0x3e')]!==_0x4bb1('0x3f')){var _0x4e63fb={};_0x4e63fb[_0x35abb1[_0x4bb1('0x2d')]]={'$like':'%'+_0x3650b8[_0x4bb1('0x32')]['filter']+'%'};return _0x4e63fb;}})});}_0x352ec7=_[_0x4bb1('0x40')]({},_0x352ec7,_0x3650b8[_0x4bb1('0x41')]);var _0x224b1a={'where':_0x352ec7[_0x4bb1('0x3b')]};return db[_0x4bb1('0x42')][_0x4bb1('0x20')](_0x224b1a)[_0x4bb1('0x28')](function(_0x2400d7){_0x124f00[_0x4bb1('0x20')]=_0x2400d7;if(_0x3650b8[_0x4bb1('0x32')][_0x4bb1('0x43')]){_0x352ec7[_0x4bb1('0x44')]=[{'all':!![]}];}return db[_0x4bb1('0x42')]['findAll'](_0x352ec7);})[_0x4bb1('0x28')](function(_0xa3cb74){_0x124f00[_0x4bb1('0x45')]=_0xa3cb74;return _0x124f00;})[_0x4bb1('0x28')](respondWithFilteredResult(_0x4e38bc,_0x352ec7))['catch'](handleError(_0x4e38bc,null));};exports[_0x4bb1('0x46')]=function(_0x59ae15,_0x48e55e){var _0x489084={'raw':![],'where':{'id':_0x59ae15[_0x4bb1('0x47')]['id']}},_0x52b90f={};_0x52b90f[_0x4bb1('0x31')]=_[_0x4bb1('0x33')](db[_0x4bb1('0x42')]['rawAttributes']);_0x52b90f['query']=_[_0x4bb1('0x33')](_0x59ae15['query']);_0x52b90f['filters']=_[_0x4bb1('0x35')](_0x52b90f[_0x4bb1('0x31')],_0x52b90f['query']);_0x489084['attributes']=_[_0x4bb1('0x35')](_0x52b90f[_0x4bb1('0x31')],qs[_0x4bb1('0x36')](_0x59ae15[_0x4bb1('0x32')][_0x4bb1('0x36')]));_0x489084[_0x4bb1('0x37')]=_0x489084['attributes']['length']?_0x489084[_0x4bb1('0x37')]:_0x52b90f[_0x4bb1('0x31')];if(_0x59ae15[_0x4bb1('0x32')][_0x4bb1('0x43')]){_0x489084['include']=[{'all':!![]}];}_0x489084=_[_0x4bb1('0x40')]({},_0x489084,_0x59ae15['options']);return db['VoicePrefix']['find'](_0x489084)['then'](handleEntityNotFound(_0x48e55e,null))[_0x4bb1('0x28')](respondWithResult(_0x48e55e,null))[_0x4bb1('0x48')](handleError(_0x48e55e,null));};exports[_0x4bb1('0x27')]=function(_0x43c5c6,_0x1ff97d){return db[_0x4bb1('0x42')]['find']({'where':{'id':_0x43c5c6[_0x4bb1('0x47')]['id']}})[_0x4bb1('0x28')](handleEntityNotFound(_0x1ff97d,null))[_0x4bb1('0x28')](removeEntity(_0x1ff97d,null))[_0x4bb1('0x48')](handleError(_0x1ff97d,null));};exports[_0x4bb1('0x49')]=function(_0x12df79,_0x3002a6){return db[_0x4bb1('0x42')][_0x4bb1('0x49')]()[_0x4bb1('0x28')](respondWithResult(_0x3002a6,null))[_0x4bb1('0x48')](handleError(_0x3002a6,null));};exports['create']=function(_0x47118a,_0x16cd43){var _0x568a53;return db[_0x4bb1('0x4a')][_0x4bb1('0x4b')](function(_0x450b61){return db['VoicePrefix'][_0x4bb1('0x4c')](_0x47118a[_0x4bb1('0x4d')],{'transaction':_0x450b61})['then'](function(_0x551baa){_0x568a53=_0x551baa[_0x4bb1('0x4e')]({'plain':!![]});return db[_0x4bb1('0x4f')][_0x4bb1('0x50')]({'where':{'id':_0x568a53[_0x4bb1('0x51')]},'raw':!![]})[_0x4bb1('0x28')](function(_0x50f5ea){return createVoicePrefixExtensions(_0x568a53,_0x50f5ea,_0x450b61);});});})[_0x4bb1('0x28')](function(){var _0x10ebc3=_0x47118a[_0x4bb1('0x52')][_0x4bb1('0x4e')]({'plain':!![]});if(!_0x10ebc3)throw new Error(_0x4bb1('0x53'));if(_0x10ebc3[_0x4bb1('0x54')]==='user'){var _0x5aaf46=_0x568a53;return db['UserProfileSection'][_0x4bb1('0x50')]({'where':{'name':_0x4bb1('0x29'),'userProfileId':_0x10ebc3[_0x4bb1('0x55')]},'raw':!![]})[_0x4bb1('0x28')](function(_0x5b3c8f){if(_0x5b3c8f&&_0x5b3c8f[_0x4bb1('0x56')]===0x0){return db[_0x4bb1('0x2a')]['create']({'name':_0x5aaf46[_0x4bb1('0x2d')],'resourceId':_0x5aaf46['id'],'type':_0x5b3c8f['name'],'sectionId':_0x5b3c8f['id']},{})[_0x4bb1('0x28')](function(){return _0x568a53;});}else{return _0x568a53;}})[_0x4bb1('0x48')](function(_0x44e344){logger[_0x4bb1('0x2b')](_0x4bb1('0x57'),_0x44e344);throw _0x44e344;});}return _0x568a53;})[_0x4bb1('0x28')](respondWithResult(_0x16cd43,null))[_0x4bb1('0x48')](handleError(_0x16cd43,null));};function Extension(_0x25c39f,_0xbb64b0,_0x1e1cad,_0x25ba2b){this[_0x4bb1('0x58')]=_0x4bb1('0x59');this[_0x4bb1('0x5a')]=_0x25c39f;this[_0x4bb1('0x5b')]=_0x1e1cad;this[_0x4bb1('0x3e')]=_0x4bb1('0x5c');this[_0x4bb1('0x5d')]=_0x4bb1('0x5e');this[_0x4bb1('0x5f')]=_0xbb64b0;this['appdata']=_0x25ba2b;}function createVoicePrefixExtensions(_0x18a37a,_0x28c6d3,_0x4dda1e){return new BPromise(function(_0x597fc5,_0x448ad1){var _0x15d0fd=new Extension(formatPrefixName(_0x18a37a['prefix']),0x1,_0x4bb1('0x60'),_0x4bb1('0x61'));_0x15d0fd[_0x4bb1('0x62')]=_0x18a37a['id'];return db['VoiceExtension'][_0x4bb1('0x4c')](_0x15d0fd,{'transaction':_0x4dda1e})[_0x4bb1('0x28')](function(_0x4351b5){var _0x22a1f9=_0x4351b5['get']({'plain':!![]});var _0x5f18b9=_[_0x4bb1('0x2f')](addVoicePrefixExtensions(_0x18a37a,_0x28c6d3),function(_0x1b1e00){_0x1b1e00[_0x4bb1('0x51')]=_0x22a1f9['id'];_0x1b1e00['VoicePrefixId']=_0x18a37a['id'];return _0x1b1e00;});return db[_0x4bb1('0x4f')]['bulkCreate'](_0x5f18b9,{'transaction':_0x4dda1e})[_0x4bb1('0x28')](function(_0x35510a){if(!_0x35510a){return _0x448ad1(_0x4bb1('0x63'));}else{return _0x597fc5(_0x35510a);}})[_0x4bb1('0x48')](function(_0x1d09b9){return _0x448ad1(_0x1d09b9);});});;});};function addVoicePrefixExtensions(_0x4ec243,_0x5e7a9f){var _0x38ec40=[];var _0x466d67=formatPrefixName(_0x4ec243['prefix']);_0x38ec40[_0x4bb1('0x64')](new Extension(_0x466d67,0x2,'Set','CDR(prefix)='+_0x4ec243[_0x4bb1('0x2d')]));if(_0x4ec243['callerIdAll']){_0x38ec40[_0x4bb1('0x64')](new Extension(_0x466d67,0x3,_0x4bb1('0x65'),_0x4bb1('0x66')+_0x4ec243[_0x4bb1('0x67')]));}else{_0x38ec40[_0x4bb1('0x64')](new Extension(_0x466d67,0x3,'NoOp','No\x20callerid\x20available'));}_0x38ec40[_0x4bb1('0x64')](new Extension(_0x466d67,0x4,_0x4bb1('0x68'),_0x5e7a9f[_0x4bb1('0x58')]+','+_0x4bb1('0x69')+(0x8+_0x4ec243['name'][_0x4bb1('0x6a')])+'}'+','+0x1));return _0x38ec40;}function formatPrefixName(_0x326da2){var _0xfb3941='_';for(var _0x33a13e=0x0;_0x33a13e<_0x326da2[_0x4bb1('0x6a')];_0x33a13e++){if(_0x326da2[_0x4bb1('0x6b')](_0x33a13e)=='-'){_0xfb3941+=_0x326da2[_0x4bb1('0x6b')](_0x33a13e);}else{_0xfb3941+='['+_0x326da2['charAt'](_0x33a13e)+']';}}_0xfb3941+='.';return _0xfb3941;}exports[_0x4bb1('0x26')]=function(_0x4da890,_0x3c3387,_0x4b8719){var _0x3095ec=_0x4da890[_0x4bb1('0x4d')];_0x3095ec[_0x4bb1('0x6c')]=_0x4bb1('0x6d')+_0x3095ec[_0x4bb1('0x2d')]+'-';return db['sequelize'][_0x4bb1('0x4b')](function(_0x3795de){return db[_0x4bb1('0x42')][_0x4bb1('0x26')](_0x3095ec,{'where':{'id':_0x3095ec['id']},'transaction':_0x3795de})[_0x4bb1('0x28')](function(){return db[_0x4bb1('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x3095ec['id']},'transaction':_0x3795de})['then'](function(){return db[_0x4bb1('0x4f')][_0x4bb1('0x50')]({'where':{'id':_0x3095ec[_0x4bb1('0x51')]},'raw':!![]})[_0x4bb1('0x28')](function(_0x350fa7){return createVoicePrefixExtensions(_0x3095ec,_0x350fa7,_0x3795de);});});});})[_0x4bb1('0x28')](function(){return db[_0x4bb1('0x42')][_0x4bb1('0x6e')](_0x3095ec['id']);})[_0x4bb1('0x28')](respondWithResult(_0x3c3387,null))[_0x4bb1('0x48')](handleError(_0x3c3387,null));};exports[_0x4bb1('0x6f')]=function(_0x1b776c,_0x2195c8,_0xf4d5c7){return db[_0x4bb1('0x42')][_0x4bb1('0x50')]({'where':{'id':_0x1b776c[_0x4bb1('0x47')]['id']}})['then'](handleEntityNotFound(_0x2195c8,null))['then'](function(_0x21f5be){if(_0x21f5be){return _0x21f5be[_0x4bb1('0x6f')](_0x1b776c[_0x4bb1('0x4d')]['ids'],_['omit'](_0x1b776c[_0x4bb1('0x4d')],[_0x4bb1('0x70'),'id'])||{})[_0x4bb1('0x71')](function(_0xd25fcd){for(var _0x28f429=0x0;_0x28f429<_0x1b776c[_0x4bb1('0x4d')]['ids'][_0x4bb1('0x6a')];_0x28f429+=0x1){socket[_0x4bb1('0x72')](_0x4bb1('0x73'),{'UserId':_0x1b776c[_0x4bb1('0x4d')][_0x4bb1('0x70')][_0x28f429],'VoicePrefixId':_0x1b776c[_0x4bb1('0x47')]['id']});}return _0xd25fcd;});}})[_0x4bb1('0x28')](respondWithResult(_0x2195c8,null))[_0x4bb1('0x48')](handleError(_0x2195c8,null));};exports[_0x4bb1('0x74')]=function(_0x11e6c6,_0x33381a,_0x1bffdc){return db[_0x4bb1('0x42')][_0x4bb1('0x50')]({'where':{'id':_0x11e6c6[_0x4bb1('0x47')]['id']}})[_0x4bb1('0x28')](handleEntityNotFound(_0x33381a,null))[_0x4bb1('0x28')](function(_0x16c513){if(_0x16c513){return _0x16c513['removeAgents'](_0x11e6c6[_0x4bb1('0x32')]['ids'])[_0x4bb1('0x28')](function(){if(_[_0x4bb1('0x75')](_0x11e6c6[_0x4bb1('0x32')][_0x4bb1('0x70')])){for(var _0x5eb791=0x0;_0x5eb791<_0x11e6c6['query'][_0x4bb1('0x70')][_0x4bb1('0x6a')];_0x5eb791+=0x1){socket['emit'](_0x4bb1('0x76'),{'UserId':Number(_0x11e6c6[_0x4bb1('0x32')]['ids'][_0x5eb791]),'VoicePrefixId':Number(_0x11e6c6[_0x4bb1('0x47')]['id'])});}}else{socket[_0x4bb1('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x11e6c6[_0x4bb1('0x32')][_0x4bb1('0x70')]),'VoicePrefixId':Number(_0x11e6c6[_0x4bb1('0x47')]['id'])});}});}})[_0x4bb1('0x28')](respondWithStatusCode(_0x33381a,null))['catch'](handleError(_0x33381a,null));};exports[_0x4bb1('0x77')]=function(_0x2197d0,_0x36d39f,_0x5d6957){var _0x397a53={};var _0x31581e={};var _0x583c71;var _0x4b2c5b;return db['VoicePrefix'][_0x4bb1('0x78')]({'where':{'id':_0x2197d0[_0x4bb1('0x47')]['id']}})[_0x4bb1('0x28')](handleEntityNotFound(_0x36d39f,null))['then'](function(_0x591ee4){if(_0x591ee4){_0x583c71=_0x591ee4;_0x31581e['model']=_['keys'](db[_0x4bb1('0x79')]['rawAttributes']);_0x31581e[_0x4bb1('0x32')]=_[_0x4bb1('0x33')](_0x2197d0[_0x4bb1('0x32')]);_0x31581e[_0x4bb1('0x34')]=_[_0x4bb1('0x35')](_0x31581e['model'],_0x31581e['query']);_0x397a53['attributes']=_[_0x4bb1('0x35')](_0x31581e[_0x4bb1('0x31')],qs[_0x4bb1('0x36')](_0x2197d0['query']['fields']));_0x397a53[_0x4bb1('0x37')]=_0x397a53[_0x4bb1('0x37')][_0x4bb1('0x6a')]?_0x397a53['attributes']:_0x31581e['model'];_0x397a53[_0x4bb1('0x39')]=qs[_0x4bb1('0x3a')](_0x2197d0['query'][_0x4bb1('0x3a')]);_0x397a53['where']=qs['filters'](_[_0x4bb1('0x3c')](_0x2197d0[_0x4bb1('0x32')],_0x31581e['filters']));if(_0x2197d0[_0x4bb1('0x32')][_0x4bb1('0x3d')]){_0x397a53[_0x4bb1('0x3b')]=_[_0x4bb1('0x40')](_0x397a53[_0x4bb1('0x3b')],{'$or':_[_0x4bb1('0x2f')](_0x397a53[_0x4bb1('0x37')],function(_0x5e341b){var _0x9ce46={};_0x9ce46[_0x5e341b]={'$like':'%'+_0x2197d0['query'][_0x4bb1('0x3d')]+'%'};return _0x9ce46;})});}_0x397a53=_['merge']({},_0x397a53,_0x2197d0[_0x4bb1('0x41')]);return _0x583c71['getAgents'](_0x397a53);}})[_0x4bb1('0x28')](function(_0x327c84){if(_0x327c84){_0x4b2c5b=_0x327c84['length'];if(!_0x2197d0[_0x4bb1('0x32')][_0x4bb1('0x7a')](_0x4bb1('0x38'))){_0x397a53['limit']=qs[_0x4bb1('0x22')](_0x2197d0[_0x4bb1('0x32')][_0x4bb1('0x22')]);_0x397a53[_0x4bb1('0x21')]=qs[_0x4bb1('0x21')](_0x2197d0[_0x4bb1('0x32')][_0x4bb1('0x21')]);}return _0x583c71['getAgents'](_0x397a53);}})[_0x4bb1('0x28')](function(_0x20b154){if(_0x20b154){return _0x20b154?{'count':_0x4b2c5b,'rows':_0x20b154}:null;}})['then'](respondWithResult(_0x36d39f,null))[_0x4bb1('0x48')](handleError(_0x36d39f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8fcf2b7..c9962b0 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x25177d,_0x2327ae){var _0xb53b63=function(_0xcb6454){while(--_0xcb6454){_0x25177d['push'](_0x25177d['shift']());}};_0xb53b63(++_0x2327ae);}(_0x70e0,0x17b));var _0x070e=function(_0x43aa75,_0x403733){_0x43aa75=_0x43aa75-0x0;var _0x18a9ed=_0x70e0[_0x43aa75];return _0x18a9ed;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xedd9,0xfc));var _0x9edd=function(_0x55b68c,_0x57986d){_0x55b68c=_0x55b68c-0x0;var _0x161810=_0xedd9[_0x55b68c];return _0x161810;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 462a236..0967729 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 _0xf999=['voice_prefixes','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix'];(function(_0x4b5380,_0x2c552a){var _0x5263b1=function(_0x208426){while(--_0x208426){_0x4b5380['push'](_0x4b5380['shift']());}};_0x5263b1(++_0x2c552a);}(_0xf999,0x1a5));var _0x9f99=function(_0x365e50,_0x516832){_0x365e50=_0x365e50-0x0;var _0x11f323=_0xf999[_0x365e50];return _0x11f323;};'use strict';var _=require(_0x9f99('0x0'));var util=require(_0x9f99('0x1'));var logger=require(_0x9f99('0x2'))(_0x9f99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f99('0x4'));var fs=require('fs');var path=require(_0x9f99('0x5'));var rimraf=require(_0x9f99('0x6'));var config=require(_0x9f99('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x9f99('0x8')]=function(_0x360bd2,_0x21dce0){return _0x360bd2[_0x9f99('0x9')](_0x9f99('0xa'),attributes,{'tableName':_0x9f99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x223a=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x223a,0x6d));var _0xa223=function(_0x7c0036,_0x21f238){_0x7c0036=_0x7c0036-0x0;var _0x126f6e=_0x223a[_0x7c0036];return _0x126f6e;};'use strict';var _=require(_0xa223('0x0'));var util=require(_0xa223('0x1'));var logger=require(_0xa223('0x2'))(_0xa223('0x3'));var moment=require(_0xa223('0x4'));var BPromise=require(_0xa223('0x5'));var rp=require(_0xa223('0x6'));var fs=require('fs');var path=require(_0xa223('0x7'));var rimraf=require('rimraf');var config=require(_0xa223('0x8'));var attributes=require(_0xa223('0x9'));module['exports']=function(_0x2dddc1,_0x224fb1){return _0x2dddc1[_0xa223('0xa')](_0xa223('0xb'),attributes,{'tableName':_0xa223('0xc'),'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 b55a485..268398e 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 _0xc591=['socket.io-emitter','./voicePrefix.socket','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4ece58,_0x50922a){var _0x20d209=function(_0x3de5f6){while(--_0x3de5f6){_0x4ece58['push'](_0x4ece58['shift']());}};_0x20d209(++_0x50922a);}(_0xc591,0xe0));var _0x1c59=function(_0x1af71a,_0x1d18ee){_0x1af71a=_0x1af71a-0x0;var _0x3acd6a=_0xc591[_0x1af71a];return _0x3acd6a;};'use strict';var _=require(_0x1c59('0x0'));var util=require(_0x1c59('0x1'));var moment=require(_0x1c59('0x2'));var BPromise=require(_0x1c59('0x3'));var rs=require(_0x1c59('0x4'));var fs=require('fs');var Redis=require(_0x1c59('0x5'));var db=require(_0x1c59('0x6'))['db'];var utils=require(_0x1c59('0x7'));var logger=require(_0x1c59('0x8'))('rpc');var config=require(_0x1c59('0x9'));var jayson=require(_0x1c59('0xa'));var client=jayson[_0x1c59('0xb')][_0x1c59('0xc')]({'port':0x232a});config[_0x1c59('0xd')]=_[_0x1c59('0xe')](config[_0x1c59('0xd')],{'host':_0x1c59('0xf'),'port':0x18eb});var socket=require(_0x1c59('0x10'))(new Redis(config['redis']));require(_0x1c59('0x11'))['register'](socket);function respondWithRpcPromise(_0x38452f,_0x3c9b0d,_0x290e90){return new BPromise(function(_0x5608fb,_0xc942a6){return client[_0x1c59('0x12')](_0x38452f,_0x290e90)[_0x1c59('0x13')](function(_0x44a6c4){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x3c9b0d,_0x1c59('0x14'));logger[_0x1c59('0x15')](_0x1c59('0x16'),_0x3c9b0d,'request\x20sent',JSON[_0x1c59('0x17')](_0x44a6c4));if(_0x44a6c4[_0x1c59('0x18')]){if(_0x44a6c4[_0x1c59('0x18')][_0x1c59('0x19')]===0x1f4){logger[_0x1c59('0x18')](_0x1c59('0x1a'),_0x3c9b0d,_0x44a6c4[_0x1c59('0x18')][_0x1c59('0x1b')]);return _0xc942a6(_0x44a6c4[_0x1c59('0x18')][_0x1c59('0x1b')]);}logger[_0x1c59('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x3c9b0d,_0x44a6c4[_0x1c59('0x18')]['message']);return _0x5608fb(_0x44a6c4[_0x1c59('0x18')][_0x1c59('0x1b')]);}else{logger[_0x1c59('0x1c')](_0x1c59('0x1a'),_0x3c9b0d,_0x1c59('0x14'));_0x5608fb(_0x44a6c4['result'][_0x1c59('0x1b')]);}})[_0x1c59('0x1d')](function(_0x4df3f9){logger[_0x1c59('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x3c9b0d,_0x4df3f9);_0xc942a6(_0x4df3f9);});});} \ No newline at end of file +var _0x2c04=['message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2c04,0x13b));var _0x42c0=function(_0x52ce00,_0x297964){_0x52ce00=_0x52ce00-0x0;var _0x11d9b0=_0x2c04[_0x52ce00];return _0x11d9b0;};'use strict';var _=require('lodash');var util=require(_0x42c0('0x0'));var moment=require(_0x42c0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42c0('0x2'));var db=require(_0x42c0('0x3'))['db'];var utils=require(_0x42c0('0x4'));var logger=require('../../config/logger')(_0x42c0('0x5'));var config=require(_0x42c0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x42c0('0x7')][_0x42c0('0x8')]({'port':0x232a});config[_0x42c0('0x9')]=_[_0x42c0('0xa')](config[_0x42c0('0x9')],{'host':_0x42c0('0xb'),'port':0x18eb});var socket=require(_0x42c0('0xc'))(new Redis(config[_0x42c0('0x9')]));require(_0x42c0('0xd'))[_0x42c0('0xe')](socket);function respondWithRpcPromise(_0x20435e,_0x4771c8,_0x4d3991){return new BPromise(function(_0x218e53,_0x5e37b4){return client['request'](_0x20435e,_0x4d3991)[_0x42c0('0xf')](function(_0x46c0d9){logger[_0x42c0('0x10')](_0x42c0('0x11'),_0x4771c8,_0x42c0('0x12'));logger['debug'](_0x42c0('0x13'),_0x4771c8,_0x42c0('0x12'),JSON[_0x42c0('0x14')](_0x46c0d9));if(_0x46c0d9[_0x42c0('0x15')]){if(_0x46c0d9[_0x42c0('0x15')][_0x42c0('0x16')]===0x1f4){logger[_0x42c0('0x15')](_0x42c0('0x11'),_0x4771c8,_0x46c0d9[_0x42c0('0x15')]['message']);return _0x5e37b4(_0x46c0d9[_0x42c0('0x15')][_0x42c0('0x17')]);}logger['error'](_0x42c0('0x11'),_0x4771c8,_0x46c0d9[_0x42c0('0x15')][_0x42c0('0x17')]);return _0x218e53(_0x46c0d9[_0x42c0('0x15')][_0x42c0('0x17')]);}else{logger['info'](_0x42c0('0x11'),_0x4771c8,_0x42c0('0x12'));_0x218e53(_0x46c0d9[_0x42c0('0x18')][_0x42c0('0x17')]);}})[_0x42c0('0x19')](function(_0x312358){logger[_0x42c0('0x15')](_0x42c0('0x11'),_0x4771c8,_0x312358);_0x5e37b4(_0x312358);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 70e0930..0102c9e 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 _0xa92b=['update','emit','removeListener','register','length','remove'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa92b,0x9b));var _0xba92=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xa92b[_0xac151d];return _0x111dba;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xba92('0x0'),_0xba92('0x1')];function createListener(_0x939b58,_0x4cbfb2){return function(_0x2f4b3c){_0x4cbfb2[_0xba92('0x2')](_0x939b58,_0x2f4b3c);};}function removeListener(_0x1bbefb,_0x5defc1){return function(){VoicePrefixEvents[_0xba92('0x3')](_0x1bbefb,_0x5defc1);};}exports[_0xba92('0x4')]=function(_0x2d7948){for(var _0x3e4d6f=0x0,_0x401305=events[_0xba92('0x5')];_0x3e4d6f<_0x401305;_0x3e4d6f++){var _0xcd24c5=events[_0x3e4d6f];var _0x225aa8=createListener('voicePrefix:'+_0xcd24c5,_0x2d7948);VoicePrefixEvents['on'](_0xcd24c5,_0x225aa8);}}; \ No newline at end of file +var _0x63b6=['save','remove','update','emit','register','length','./voicePrefix.events'];(function(_0x215026,_0x237d3e){var _0x579cfe=function(_0x36d225){while(--_0x36d225){_0x215026['push'](_0x215026['shift']());}};_0x579cfe(++_0x237d3e);}(_0x63b6,0xb5));var _0x663b=function(_0x930f73,_0xfe73ea){_0x930f73=_0x930f73-0x0;var _0x47762f=_0x63b6[_0x930f73];return _0x47762f;};'use strict';var VoicePrefixEvents=require(_0x663b('0x0'));var events=[_0x663b('0x1'),_0x663b('0x2'),_0x663b('0x3')];function createListener(_0x518136,_0x95c6db){return function(_0x2f625c){_0x95c6db[_0x663b('0x4')](_0x518136,_0x2f625c);};}function removeListener(_0x4ac2ff,_0x21abcd){return function(){VoicePrefixEvents['removeListener'](_0x4ac2ff,_0x21abcd);};}exports[_0x663b('0x5')]=function(_0x229cdc){for(var _0x333e97=0x0,_0x5c216d=events[_0x663b('0x6')];_0x333e97<_0x5c216d;_0x333e97++){var _0x4141c5=events[_0x333e97];var _0x24beed=createListener('voicePrefix:'+_0x4141c5,_0x229cdc);VoicePrefixEvents['on'](_0x4141c5,_0x24beed);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 23d40fc..3f08b56 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 _0xa85c=['/:id/clone','clone','addTeams','addLists','addBlackLists','/:id','update','delete','destroy','removeTeams','removeLists','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa85c,0x154));var _0xca85=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0xa85c[_0x10aa73];return _0x3496d9;};'use strict';var multer=require(_0xca85('0x0'));var util=require(_0xca85('0x1'));var path=require('path');var timeout=require(_0xca85('0x2'));var express=require(_0xca85('0x3'));var router=express['Router']();var auth=require(_0xca85('0x4'));var interaction=require(_0xca85('0x5'));var config=require(_0xca85('0x6'));var controller=require(_0xca85('0x7'));router['get']('/',auth[_0xca85('0x8')](),controller['index']);router['get']('/:id',auth[_0xca85('0x8')](),controller[_0xca85('0x9')]);router[_0xca85('0xa')](_0xca85('0xb'),auth[_0xca85('0x8')](),controller[_0xca85('0xc')]);router['get'](_0xca85('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0xca85('0xe'),auth[_0xca85('0x8')](),controller[_0xca85('0xf')]);router['get'](_0xca85('0x10'),auth[_0xca85('0x8')](),controller[_0xca85('0x11')]);router[_0xca85('0xa')](_0xca85('0x12'),auth[_0xca85('0x8')](),controller[_0xca85('0x13')]);router['get'](_0xca85('0x14'),auth['isAuthenticated'](),controller[_0xca85('0x15')]);router[_0xca85('0xa')](_0xca85('0x16'),auth[_0xca85('0x8')](),controller['getMembers']);router[_0xca85('0xa')](_0xca85('0x17'),auth['isAuthenticated'](),controller[_0xca85('0x18')]);router[_0xca85('0xa')](_0xca85('0x19'),auth[_0xca85('0x8')](),controller[_0xca85('0x1a')]);router['post']('/',auth[_0xca85('0x8')](),controller[_0xca85('0x1b')]);router[_0xca85('0x1c')](_0xca85('0x1d'),auth[_0xca85('0x8')](),controller[_0xca85('0x1e')]);router[_0xca85('0x1c')](_0xca85('0x12'),auth[_0xca85('0x8')](),controller[_0xca85('0x1f')]);router[_0xca85('0x1c')]('/:id/users',auth[_0xca85('0x8')](),controller['addAgents']);router[_0xca85('0x1c')](_0xca85('0x17'),auth['isAuthenticated'](),controller[_0xca85('0x20')]);router[_0xca85('0x1c')](_0xca85('0x19'),auth['isAuthenticated'](),controller[_0xca85('0x21')]);router['put'](_0xca85('0x22'),auth[_0xca85('0x8')](),controller[_0xca85('0x23')]);router[_0xca85('0x24')](_0xca85('0x22'),auth[_0xca85('0x8')](),controller[_0xca85('0x25')]);router[_0xca85('0x24')](_0xca85('0x12'),auth[_0xca85('0x8')](),controller[_0xca85('0x26')]);router[_0xca85('0x24')](_0xca85('0x14'),auth[_0xca85('0x8')](),controller['removeAgents']);router['delete'](_0xca85('0x17'),auth[_0xca85('0x8')](),controller[_0xca85('0x27')]);router[_0xca85('0x24')](_0xca85('0x19'),auth[_0xca85('0x8')](),controller['removeBlackLists']);module[_0xca85('0x28')]=router; \ No newline at end of file +var _0x2bae=['/:id/users','addAgents','addBlackLists','put','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','/:id','get','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','create','post','clone','addTeams'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x2bae,0xfb));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe2ba('0x0'));var path=require(_0xe2ba('0x1'));var timeout=require(_0xe2ba('0x2'));var express=require(_0xe2ba('0x3'));var router=express[_0xe2ba('0x4')]();var auth=require(_0xe2ba('0x5'));var interaction=require(_0xe2ba('0x6'));var config=require(_0xe2ba('0x7'));var controller=require(_0xe2ba('0x8'));router['get']('/',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0xa')]);router['get'](_0xe2ba('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe2ba('0xc')](_0xe2ba('0xd'),auth[_0xe2ba('0x9')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0xe')]);router['get'](_0xe2ba('0xf'),auth['isAuthenticated'](),controller[_0xe2ba('0x10')]);router[_0xe2ba('0xc')]('/:id/hopper_black',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x11')]);router[_0xe2ba('0xc')](_0xe2ba('0x12'),auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x13')]);router[_0xe2ba('0xc')]('/:id/users',auth[_0xe2ba('0x9')](),controller['getAgents']);router[_0xe2ba('0xc')](_0xe2ba('0x14'),auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x15')]);router['get'](_0xe2ba('0x16'),auth[_0xe2ba('0x9')](),controller['getLists']);router[_0xe2ba('0xc')](_0xe2ba('0x17'),auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x18')]);router['post']('/',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x19')]);router[_0xe2ba('0x1a')]('/:id/clone',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x1b')]);router[_0xe2ba('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe2ba('0x1c')]);router[_0xe2ba('0x1a')](_0xe2ba('0x1d'),auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x1e')]);router[_0xe2ba('0x1a')](_0xe2ba('0x16'),auth[_0xe2ba('0x9')](),controller['addLists']);router[_0xe2ba('0x1a')](_0xe2ba('0x17'),auth['isAuthenticated'](),controller[_0xe2ba('0x1f')]);router[_0xe2ba('0x20')](_0xe2ba('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe2ba('0x21')](_0xe2ba('0xb'),auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x22')]);router[_0xe2ba('0x21')](_0xe2ba('0x12'),auth['isAuthenticated'](),controller[_0xe2ba('0x23')]);router[_0xe2ba('0x21')]('/:id/users',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x24')]);router[_0xe2ba('0x21')]('/:id/lists',auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x25')]);router[_0xe2ba('0x21')](_0xe2ba('0x17'),auth[_0xe2ba('0x9')](),controller[_0xe2ba('0x26')]);module[_0xe2ba('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d35d813..405ef9c 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(_0x38136b,_0x35c34e){var _0x3b10b9=function(_0x27fdfe){while(--_0x27fdfe){_0x38136b['push'](_0x38136b['shift']());}};_0x3b10b9(++_0x35c34e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x2f4ee6,_0x24a540){var _0x28f20e=function(_0x239715){while(--_0x239715){_0x2f4ee6['push'](_0x2f4ee6['shift']());}};_0x28f20e(++_0x24a540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 878607e..8fd5211 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 _0x5b21=['Agents','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','all','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','updatedAt','NOW()','scheduledAt','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','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/utils','../../mysqldb','defaults','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','includes','type','find','name','UserProfileResource','end','stack','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','VoiceQueue','includeAll','include','findAll','show','params','options','catch','create','user','get','role','value','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','flatMap'];(function(_0x58d2f0,_0x29527b){var _0x3559ae=function(_0x413010){while(--_0x413010){_0x58d2f0['push'](_0x58d2f0['shift']());}};_0x3559ae(++_0x29527b);}(_0x5b21,0x1bf));var _0x15b2=function(_0x2d68ae,_0x1de2d7){_0x2d68ae=_0x2d68ae-0x0;var _0x530d63=_0x5b21[_0x2d68ae];return _0x530d63;};'use strict';var pdf=require(_0x15b2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15b2('0x1'));var zipdir=require(_0x15b2('0x2'));var jsonpatch=require(_0x15b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x15b2('0x4'));var Mustache=require(_0x15b2('0x5'));var util=require('util');var path=require(_0x15b2('0x6'));var sox=require('sox');var csv=require(_0x15b2('0x7'));var ejs=require(_0x15b2('0x8'));var fs=require('fs');var _=require(_0x15b2('0x9'));var squel=require(_0x15b2('0xa'));var crypto=require('crypto');var jsforce=require(_0x15b2('0xb'));var deskjs=require(_0x15b2('0xc'));var toCsv=require(_0x15b2('0x7'));var querystring=require('querystring');var Papa=require(_0x15b2('0xd'));var Redis=require(_0x15b2('0xe'));var authService=require(_0x15b2('0xf'));var qs=require(_0x15b2('0x10'));var as=require(_0x15b2('0x11'));var hardwareService=require(_0x15b2('0x12'));var logger=require(_0x15b2('0x13'))(_0x15b2('0x14'));var utils=require(_0x15b2('0x15'));var config=require('../../config/environment');var db=require(_0x15b2('0x16'))['db'];config['redis']=_[_0x15b2('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x15b2('0x18'))(new Redis(config[_0x15b2('0x19')]));require(_0x15b2('0x1a'))[_0x15b2('0x1b')](socket);function respondWithStatusCode(_0x5a200a,_0x226cc6){_0x226cc6=_0x226cc6||0xcc;return function(_0x1c7dde){if(_0x1c7dde){return _0x5a200a[_0x15b2('0x1c')](_0x226cc6);}return _0x5a200a['status'](_0x226cc6)['end']();};}function respondWithResult(_0x2eaae5,_0x59d1c0){_0x59d1c0=_0x59d1c0||0xc8;return function(_0x1e4513){if(_0x1e4513){return _0x2eaae5[_0x15b2('0x1d')](_0x59d1c0)[_0x15b2('0x1e')](_0x1e4513);}};}function respondWithFilteredResult(_0x578b83,_0x111904){return function(_0x31c4f4){if(_0x31c4f4){var _0x13a6b6=_0x31c4f4[_0x15b2('0x1f')],_0x2171b6=_0x111904[_0x15b2('0x20')],_0x44011d=_0x111904[_0x15b2('0x20')]+_0x111904[_0x15b2('0x21')],_0x35a924;if(_0x44011d>=_0x13a6b6){_0x44011d=_0x13a6b6;_0x35a924=0xc8;}else{_0x35a924=0xce;}_0x578b83[_0x15b2('0x1d')](_0x35a924);return _0x578b83['set'](_0x15b2('0x22'),_0x2171b6+'-'+_0x44011d+'/'+_0x13a6b6)[_0x15b2('0x1e')](_0x31c4f4);}return null;};}function patchUpdates(_0x400f7b){return function(_0x5e0222){try{jsonpatch['apply'](_0x5e0222,_0x400f7b,!![]);}catch(_0x38bc41){return BPromise[_0x15b2('0x23')](_0x38bc41);}return _0x5e0222[_0x15b2('0x24')]();};}function saveUpdates(_0x3cbd6e,_0x1e1df2){return function(_0x23b5f0){if(_0x23b5f0){return _0x23b5f0['update'](_0x3cbd6e)[_0x15b2('0x25')](function(_0x309c9d){return _0x309c9d;});}return null;};}function removeEntity(_0x3f8737,_0x169f8b){return function(_0x1375f0){if(_0x1375f0){return _0x1375f0[_0x15b2('0x26')]()[_0x15b2('0x25')](function(){var _0xb5cbce=_0x1375f0['get']({'plain':!![]});var _0x4ceb5c=[{'name':_0x15b2('0x27'),'value':_0x15b2('0x28'),'ignore':![]},{'name':_0x15b2('0x29'),'value':_0x15b2('0x2a'),'ignore':![]}];var _0x5f2e02=_(_0x4ceb5c)[_0x15b2('0x2b')](_0x15b2('0x2c'))[_0x15b2('0x2d')]('value')['value']();if(_[_0x15b2('0x2e')](_0x5f2e02,_0xb5cbce[_0x15b2('0x2f')])){return;}var _0x48647a=_[_0x15b2('0x30')](_0x4ceb5c,['value',_0xb5cbce[_0x15b2('0x2f')]])[_0x15b2('0x31')];return db[_0x15b2('0x32')]['destroy']({'where':{'type':_0x48647a,'resourceId':_0xb5cbce['id']}})[_0x15b2('0x25')](function(){return _0x1375f0;});})[_0x15b2('0x25')](function(){_0x3f8737[_0x15b2('0x1d')](0xcc)[_0x15b2('0x33')]();});}};}function handleEntityNotFound(_0x1e8945,_0x11f104){return function(_0x5705a3){if(!_0x5705a3){_0x1e8945['sendStatus'](0x194);}return _0x5705a3;};}function handleError(_0x54e0f1,_0x3cbec4){_0x3cbec4=_0x3cbec4||0x1f4;return function(_0x29ab4c){logger['error'](_0x29ab4c[_0x15b2('0x34')]);if(_0x29ab4c['name']){delete _0x29ab4c['name'];}_0x54e0f1[_0x15b2('0x1d')](_0x3cbec4)[_0x15b2('0x35')](_0x29ab4c);};}exports[_0x15b2('0x36')]=function(_0x58af8b,_0x1c2124){var _0x494bb0={},_0x4e73ab={},_0x465811={'count':0x0,'rows':[]};var _0x4c8e28=_[_0x15b2('0x2d')](db['VoiceQueue'][_0x15b2('0x37')],function(_0x4aea23){return{'name':_0x4aea23['fieldName'],'type':_0x4aea23[_0x15b2('0x2f')]['key']};});_0x4e73ab[_0x15b2('0x38')]=_[_0x15b2('0x2d')](_0x4c8e28,_0x15b2('0x31'));_0x4e73ab[_0x15b2('0x39')]=_[_0x15b2('0x3a')](_0x58af8b['query']);_0x4e73ab[_0x15b2('0x3b')]=_[_0x15b2('0x3c')](_0x4e73ab['model'],_0x4e73ab[_0x15b2('0x39')]);_0x494bb0[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x4e73ab['model'],qs['fields'](_0x58af8b[_0x15b2('0x39')][_0x15b2('0x3e')]));_0x494bb0[_0x15b2('0x3d')]=_0x494bb0[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x494bb0[_0x15b2('0x3d')]:_0x4e73ab['model'];if(!_0x58af8b[_0x15b2('0x39')][_0x15b2('0x40')](_0x15b2('0x41'))){_0x494bb0[_0x15b2('0x21')]=qs[_0x15b2('0x21')](_0x58af8b[_0x15b2('0x39')][_0x15b2('0x21')]);_0x494bb0['offset']=qs['offset'](_0x58af8b[_0x15b2('0x39')][_0x15b2('0x20')]);}_0x494bb0[_0x15b2('0x42')]=qs[_0x15b2('0x43')](_0x58af8b[_0x15b2('0x39')][_0x15b2('0x43')]);_0x494bb0[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_[_0x15b2('0x45')](_0x58af8b[_0x15b2('0x39')],_0x4e73ab[_0x15b2('0x3b')]),_0x4c8e28);if(_0x58af8b['query'][_0x15b2('0x2b')]){_0x494bb0['where']=_[_0x15b2('0x46')](_0x494bb0[_0x15b2('0x44')],{'$or':_[_0x15b2('0x2d')](_0x4c8e28,function(_0x3fcaab){if(_0x3fcaab[_0x15b2('0x2f')]!==_0x15b2('0x47')){var _0x1f4d30={};_0x1f4d30[_0x3fcaab[_0x15b2('0x31')]]={'$like':'%'+_0x58af8b[_0x15b2('0x39')][_0x15b2('0x2b')]+'%'};return _0x1f4d30;}})});}_0x494bb0=_[_0x15b2('0x46')]({},_0x494bb0,_0x58af8b['options']);var _0x36537b={'where':_0x494bb0[_0x15b2('0x44')]};return db[_0x15b2('0x48')][_0x15b2('0x1f')](_0x36537b)['then'](function(_0x3416e6){_0x465811['count']=_0x3416e6;if(_0x58af8b[_0x15b2('0x39')][_0x15b2('0x49')]){_0x494bb0[_0x15b2('0x4a')]=[{'all':!![]}];}return db[_0x15b2('0x48')][_0x15b2('0x4b')](_0x494bb0);})[_0x15b2('0x25')](function(_0x65c7fa){_0x465811['rows']=_0x65c7fa;return _0x465811;})[_0x15b2('0x25')](respondWithFilteredResult(_0x1c2124,_0x494bb0))['catch'](handleError(_0x1c2124,null));};exports[_0x15b2('0x4c')]=function(_0x3f6b5c,_0x49b316){var _0x1cb747={'raw':![],'where':{'id':_0x3f6b5c[_0x15b2('0x4d')]['id']}},_0x4d5d65={};_0x4d5d65[_0x15b2('0x38')]=_[_0x15b2('0x3a')](db[_0x15b2('0x48')][_0x15b2('0x37')]);_0x4d5d65[_0x15b2('0x39')]=_['keys'](_0x3f6b5c[_0x15b2('0x39')]);_0x4d5d65['filters']=_[_0x15b2('0x3c')](_0x4d5d65[_0x15b2('0x38')],_0x4d5d65['query']);_0x1cb747['attributes']=_[_0x15b2('0x3c')](_0x4d5d65[_0x15b2('0x38')],qs['fields'](_0x3f6b5c['query'][_0x15b2('0x3e')]));_0x1cb747[_0x15b2('0x3d')]=_0x1cb747[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x1cb747['attributes']:_0x4d5d65[_0x15b2('0x38')];if(_0x3f6b5c[_0x15b2('0x39')][_0x15b2('0x49')]){_0x1cb747[_0x15b2('0x4a')]=[{'all':!![]}];}_0x1cb747=_[_0x15b2('0x46')]({},_0x1cb747,_0x3f6b5c[_0x15b2('0x4e')]);return db[_0x15b2('0x48')][_0x15b2('0x30')](_0x1cb747)['then'](handleEntityNotFound(_0x49b316,null))['then'](respondWithResult(_0x49b316,null))[_0x15b2('0x4f')](handleError(_0x49b316,null));};exports[_0x15b2('0x50')]=function(_0x2b588c,_0x236d01){return db[_0x15b2('0x48')]['create'](_0x2b588c['body'],{})[_0x15b2('0x25')](function(_0x2179a4){var _0x4164b2=_0x2b588c[_0x15b2('0x51')][_0x15b2('0x52')]({'plain':!![]});if(!_0x4164b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4164b2[_0x15b2('0x53')]===_0x15b2('0x51')){var _0x546f24=_0x2179a4[_0x15b2('0x52')]({'plain':!![]});var _0x5f41f9=[{'name':_0x15b2('0x27'),'value':_0x15b2('0x28')},{'name':_0x15b2('0x29'),'value':'outbound'}];var _0xf58725=_[_0x15b2('0x30')](_0x5f41f9,[_0x15b2('0x54'),_0x546f24['type']])['name'];return db['UserProfileSection'][_0x15b2('0x30')]({'where':{'name':_0xf58725,'userProfileId':_0x4164b2[_0x15b2('0x55')]},'raw':!![]})[_0x15b2('0x25')](function(_0x3d2251){if(_0x3d2251&&_0x3d2251['autoAssociation']===0x0){return db[_0x15b2('0x32')][_0x15b2('0x50')]({'name':_0x546f24['name'],'resourceId':_0x546f24['id'],'type':_0x3d2251['name'],'sectionId':_0x3d2251['id']},{})[_0x15b2('0x25')](function(){return _0x2179a4;});}else{return _0x2179a4;}})[_0x15b2('0x4f')](function(_0x5e0dbf){logger[_0x15b2('0x56')](_0x15b2('0x57'),_0x5e0dbf);throw _0x5e0dbf;});}return _0x2179a4;})[_0x15b2('0x25')](respondWithResult(_0x236d01,0xc9))[_0x15b2('0x4f')](handleError(_0x236d01,null));};exports[_0x15b2('0x58')]=function(_0x5be869,_0x2ad8de){var _0x10eefb={'where':{'id':_0x5be869['params']['id']}},_0x453514={};_0x453514[_0x15b2('0x38')]=_['keys'](db['VoiceQueue'][_0x15b2('0x37')]);_0x10eefb[_0x15b2('0x3d')]=_['intersection'](_0x453514['model'],qs['fields'](_0x5be869[_0x15b2('0x39')][_0x15b2('0x3e')]));_0x10eefb[_0x15b2('0x3d')]=_0x10eefb[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x10eefb[_0x15b2('0x3d')]:_0x453514[_0x15b2('0x38')];if(_0x5be869['query'][_0x15b2('0x49')]){_0x10eefb['include']=[{'all':!![]}];}_0x10eefb=_[_0x15b2('0x46')]({},_0x10eefb,_0x5be869['options']);return db[_0x15b2('0x48')][_0x15b2('0x30')](_0x10eefb)[_0x15b2('0x25')](handleEntityNotFound(_0x2ad8de,null))[_0x15b2('0x25')](function(_0x261311){if(_0x261311){var _0x2555ce=_0x261311['get']({'plain':!![]});_0x2555ce=qs[_0x15b2('0x59')](_0x2555ce,['id',_0x15b2('0x5a'),'updatedAt']);_0x5be869[_0x15b2('0x5b')]=_[_0x15b2('0x59')](_0x5be869[_0x15b2('0x5b')],['id','createdAt','updatedAt']);return db[_0x15b2('0x48')][_0x15b2('0x50')](_[_0x15b2('0x46')](_0x2555ce,_0x5be869[_0x15b2('0x5b')]),{'include':_0x5be869[_0x15b2('0x39')][_0x15b2('0x49')]?[{'all':!![]}]:undefined})[_0x15b2('0x25')](function(_0x23a8cf){var _0x353c9b=_0x5be869['user']['get']({'plain':!![]});if(!_0x353c9b)throw new Error(_0x15b2('0x5c'));if(_0x353c9b[_0x15b2('0x53')]==='user'){var _0x9e1af8=_0x23a8cf[_0x15b2('0x52')]({'plain':!![]});var _0x112ba1=[{'name':_0x15b2('0x27'),'value':_0x15b2('0x28')},{'name':_0x15b2('0x29'),'value':_0x15b2('0x2a')}];var _0x449174=_['find'](_0x112ba1,[_0x15b2('0x54'),_0x9e1af8[_0x15b2('0x2f')]])[_0x15b2('0x31')];return db[_0x15b2('0x5d')][_0x15b2('0x30')]({'where':{'name':_0x449174,'userProfileId':_0x353c9b['userProfileId']},'raw':!![]})['then'](function(_0x54fd5a){if(_0x54fd5a&&_0x54fd5a[_0x15b2('0x5e')]===0x0){return db[_0x15b2('0x32')][_0x15b2('0x50')]({'name':_0x9e1af8[_0x15b2('0x31')],'resourceId':_0x9e1af8['id'],'type':_0x54fd5a['name'],'sectionId':_0x54fd5a['id']},{})[_0x15b2('0x25')](function(){return _0x23a8cf;});}else{return _0x23a8cf;}})['catch'](function(_0x37e4cb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e4cb);throw _0x37e4cb;});}return _0x23a8cf;});}})['then'](respondWithResult(_0x2ad8de,0xc9))[_0x15b2('0x4f')](handleError(_0x2ad8de,null));};exports[_0x15b2('0x5f')]=function(_0x2414ab,_0x4d80c1){if(_0x2414ab[_0x15b2('0x5b')]['id']){delete _0x2414ab[_0x15b2('0x5b')]['id'];}return db['VoiceQueue'][_0x15b2('0x30')]({'where':{'id':_0x2414ab['params']['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x4d80c1,null))[_0x15b2('0x25')](saveUpdates(_0x2414ab['body'],null))[_0x15b2('0x25')](respondWithResult(_0x4d80c1,null))[_0x15b2('0x4f')](handleError(_0x4d80c1,null));};exports[_0x15b2('0x26')]=function(_0x54fa39,_0x1963ba){return db['VoiceQueue'][_0x15b2('0x30')]({'where':{'id':_0x54fa39['params']['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x1963ba,null))[_0x15b2('0x25')](removeEntity(_0x1963ba,null))['catch'](handleError(_0x1963ba,null));};exports[_0x15b2('0x60')]=function(_0x303f5e,_0x3bca0e,_0x244986){var _0xda8cb7={'raw':![],'where':{}};var _0x3db58a={};var _0x46eb87={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x15b2('0x61')]({'where':{'id':_0x303f5e['params']['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x3bca0e,null))[_0x15b2('0x25')](function(_0x2c12aa){if(_0x2c12aa){_0x3db58a[_0x15b2('0x38')]=_[_0x15b2('0x3a')](db[_0x15b2('0x62')][_0x15b2('0x37')]);_0x3db58a[_0x15b2('0x39')]=_[_0x15b2('0x3a')](_0x303f5e[_0x15b2('0x39')]);_0x3db58a[_0x15b2('0x3b')]=_[_0x15b2('0x3c')](_0x3db58a[_0x15b2('0x38')],_0x3db58a['query']);_0xda8cb7[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x3db58a['model'],qs['fields'](_0x303f5e[_0x15b2('0x39')][_0x15b2('0x3e')]));_0xda8cb7['attributes']=_0xda8cb7[_0x15b2('0x3d')]['length']?_0xda8cb7[_0x15b2('0x3d')]:_0x3db58a['model'];if(!_0x303f5e['query'][_0x15b2('0x40')](_0x15b2('0x41'))){_0xda8cb7[_0x15b2('0x21')]=qs[_0x15b2('0x21')](_0x303f5e[_0x15b2('0x39')][_0x15b2('0x21')]);_0xda8cb7[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0x303f5e[_0x15b2('0x39')]['offset']);}_0xda8cb7['order']=qs[_0x15b2('0x43')](_0x303f5e[_0x15b2('0x39')][_0x15b2('0x43')]);_0xda8cb7[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_[_0x15b2('0x45')](_0x303f5e[_0x15b2('0x39')],_0x3db58a[_0x15b2('0x3b')]));_0xda8cb7['where'][_0x15b2('0x63')]=_0x2c12aa['id'];if(_0x303f5e[_0x15b2('0x39')][_0x15b2('0x2b')]){_0xda8cb7['where']=_[_0x15b2('0x46')](_0xda8cb7[_0x15b2('0x44')],{'$or':_['map'](_0xda8cb7[_0x15b2('0x3d')],function(_0x3857d3){var _0x4cb8b7={};_0x4cb8b7[_0x3857d3]={'$like':'%'+_0x303f5e['query'][_0x15b2('0x2b')]+'%'};return _0x4cb8b7;})});}_0xda8cb7=_['merge']({},_0xda8cb7,_0x303f5e[_0x15b2('0x4e')]);return db[_0x15b2('0x62')][_0x15b2('0x1f')]({'where':_0xda8cb7[_0x15b2('0x44')]})[_0x15b2('0x25')](function(_0x483068){_0x46eb87[_0x15b2('0x1f')]=_0x483068;if(_0x303f5e[_0x15b2('0x39')][_0x15b2('0x49')]){_0xda8cb7[_0x15b2('0x4a')]=[{'all':!![]}];}return db['CmHopper'][_0x15b2('0x4b')](_0xda8cb7);})[_0x15b2('0x25')](function(_0x5b47f6){_0x46eb87[_0x15b2('0x64')]=_0x5b47f6;return _0x46eb87;});}})[_0x15b2('0x25')](respondWithFilteredResult(_0x3bca0e,_0xda8cb7))[_0x15b2('0x4f')](handleError(_0x3bca0e,null));};exports[_0x15b2('0x65')]=function(_0x21bf5b,_0x7080f8,_0xbeb14a){var _0x15c406={'raw':!![],'where':{}};var _0x416887={};var _0x3b9a39={'count':0x0,'rows':[]};return db[_0x15b2('0x48')][_0x15b2('0x61')]({'where':{'id':_0x21bf5b[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x7080f8,null))[_0x15b2('0x25')](function(_0x1e9500){if(_0x1e9500){_0x416887['model']=_[_0x15b2('0x3a')](db[_0x15b2('0x66')][_0x15b2('0x37')]);_0x416887[_0x15b2('0x39')]=_[_0x15b2('0x3a')](_0x21bf5b['query']);_0x416887['filters']=_[_0x15b2('0x3c')](_0x416887[_0x15b2('0x38')],_0x416887[_0x15b2('0x39')]);_0x15c406[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x416887[_0x15b2('0x38')],qs[_0x15b2('0x3e')](_0x21bf5b[_0x15b2('0x39')]['fields']));_0x15c406['attributes']=_0x15c406[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x15c406[_0x15b2('0x3d')]:_0x416887[_0x15b2('0x38')];if(!_0x21bf5b[_0x15b2('0x39')]['hasOwnProperty'](_0x15b2('0x41'))){_0x15c406[_0x15b2('0x21')]=qs[_0x15b2('0x21')](_0x21bf5b[_0x15b2('0x39')][_0x15b2('0x21')]);_0x15c406[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0x21bf5b['query'][_0x15b2('0x20')]);}_0x15c406[_0x15b2('0x42')]=qs[_0x15b2('0x43')](_0x21bf5b[_0x15b2('0x39')]['sort']);_0x15c406['where']=qs[_0x15b2('0x3b')](_['pick'](_0x21bf5b[_0x15b2('0x39')],_0x416887[_0x15b2('0x3b')]));_0x15c406[_0x15b2('0x44')][_0x15b2('0x63')]=_0x1e9500['id'];if(_0x21bf5b[_0x15b2('0x39')][_0x15b2('0x2b')]){_0x15c406['where']=_[_0x15b2('0x46')](_0x15c406[_0x15b2('0x44')],{'$or':_[_0x15b2('0x2d')](_0x15c406[_0x15b2('0x3d')],function(_0xe35ca3){var _0x49bf2f={};_0x49bf2f[_0xe35ca3]={'$like':'%'+_0x21bf5b[_0x15b2('0x39')]['filter']+'%'};return _0x49bf2f;})});}_0x15c406=_[_0x15b2('0x46')]({},_0x15c406,_0x21bf5b[_0x15b2('0x4e')]);return db['CmHopperHistory'][_0x15b2('0x1f')]({'where':_0x15c406[_0x15b2('0x44')]})[_0x15b2('0x25')](function(_0x2a0e52){_0x3b9a39[_0x15b2('0x1f')]=_0x2a0e52;if(_0x21bf5b[_0x15b2('0x39')]['includeAll']){_0x15c406[_0x15b2('0x4a')]=[{'all':!![]}];}return db[_0x15b2('0x66')][_0x15b2('0x4b')](_0x15c406);})[_0x15b2('0x25')](function(_0x14cf5c){_0x3b9a39[_0x15b2('0x64')]=_0x14cf5c;return _0x3b9a39;});}})[_0x15b2('0x25')](respondWithFilteredResult(_0x7080f8,_0x15c406))[_0x15b2('0x4f')](handleError(_0x7080f8,null));};exports['getHopperFinals']=function(_0x385885,_0x255902,_0x3c6b59){var _0x39fdc2={'raw':!![],'where':{}};var _0xda9156={};var _0x541e9a={'count':0x0,'rows':[]};return db[_0x15b2('0x48')][_0x15b2('0x61')]({'where':{'id':_0x385885[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x255902,null))[_0x15b2('0x25')](function(_0x490635){if(_0x490635){_0xda9156[_0x15b2('0x38')]=_[_0x15b2('0x3a')](db[_0x15b2('0x67')][_0x15b2('0x37')]);_0xda9156['query']=_['keys'](_0x385885[_0x15b2('0x39')]);_0xda9156['filters']=_[_0x15b2('0x3c')](_0xda9156[_0x15b2('0x38')],_0xda9156[_0x15b2('0x39')]);_0x39fdc2['attributes']=_[_0x15b2('0x3c')](_0xda9156['model'],qs[_0x15b2('0x3e')](_0x385885['query'][_0x15b2('0x3e')]));_0x39fdc2[_0x15b2('0x3d')]=_0x39fdc2[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x39fdc2[_0x15b2('0x3d')]:_0xda9156[_0x15b2('0x38')];if(!_0x385885[_0x15b2('0x39')][_0x15b2('0x40')](_0x15b2('0x41'))){_0x39fdc2[_0x15b2('0x21')]=qs[_0x15b2('0x21')](_0x385885[_0x15b2('0x39')][_0x15b2('0x21')]);_0x39fdc2[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0x385885[_0x15b2('0x39')][_0x15b2('0x20')]);}_0x39fdc2['order']=qs['sort'](_0x385885[_0x15b2('0x39')]['sort']);_0x39fdc2[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_['pick'](_0x385885[_0x15b2('0x39')],_0xda9156[_0x15b2('0x3b')]));_0x39fdc2[_0x15b2('0x44')][_0x15b2('0x63')]=_0x490635['id'];if(_0x385885[_0x15b2('0x39')][_0x15b2('0x2b')]){_0x39fdc2[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x39fdc2[_0x15b2('0x44')],{'$or':_['map'](_0x39fdc2[_0x15b2('0x3d')],function(_0x21658e){var _0x20bbfe={};_0x20bbfe[_0x21658e]={'$like':'%'+_0x385885['query'][_0x15b2('0x2b')]+'%'};return _0x20bbfe;})});}_0x39fdc2=_[_0x15b2('0x46')]({},_0x39fdc2,_0x385885[_0x15b2('0x4e')]);return db['CmHopperFinal'][_0x15b2('0x1f')]({'where':_0x39fdc2[_0x15b2('0x44')]})[_0x15b2('0x25')](function(_0x895f4c){_0x541e9a[_0x15b2('0x1f')]=_0x895f4c;if(_0x385885[_0x15b2('0x39')]['includeAll']){_0x39fdc2[_0x15b2('0x4a')]=[{'all':!![]}];}return db[_0x15b2('0x67')][_0x15b2('0x4b')](_0x39fdc2);})['then'](function(_0x5215cc){_0x541e9a[_0x15b2('0x64')]=_0x5215cc;return _0x541e9a;});}})[_0x15b2('0x25')](respondWithFilteredResult(_0x255902,_0x39fdc2))[_0x15b2('0x4f')](handleError(_0x255902,null));};exports[_0x15b2('0x68')]=function(_0xf7d3e2,_0x439bf1,_0x2c1a06){var _0x37e4cf={'raw':!![],'where':{}};var _0x20c23a={};var _0x28cb80={'count':0x0,'rows':[]};return db[_0x15b2('0x48')][_0x15b2('0x61')]({'where':{'id':_0xf7d3e2[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x439bf1,null))[_0x15b2('0x25')](function(_0x254acb){if(_0x254acb){_0x20c23a[_0x15b2('0x38')]=_[_0x15b2('0x3a')](db[_0x15b2('0x69')][_0x15b2('0x37')]);_0x20c23a[_0x15b2('0x39')]=_['keys'](_0xf7d3e2['query']);_0x20c23a[_0x15b2('0x3b')]=_[_0x15b2('0x3c')](_0x20c23a[_0x15b2('0x38')],_0x20c23a['query']);_0x37e4cf[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x20c23a[_0x15b2('0x38')],qs[_0x15b2('0x3e')](_0xf7d3e2[_0x15b2('0x39')]['fields']));_0x37e4cf[_0x15b2('0x3d')]=_0x37e4cf['attributes'][_0x15b2('0x3f')]?_0x37e4cf[_0x15b2('0x3d')]:_0x20c23a[_0x15b2('0x38')];if(!_0xf7d3e2[_0x15b2('0x39')][_0x15b2('0x40')]('nolimit')){_0x37e4cf[_0x15b2('0x21')]=qs[_0x15b2('0x21')](_0xf7d3e2[_0x15b2('0x39')][_0x15b2('0x21')]);_0x37e4cf[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0xf7d3e2[_0x15b2('0x39')][_0x15b2('0x20')]);}_0x37e4cf[_0x15b2('0x42')]=qs[_0x15b2('0x43')](_0xf7d3e2[_0x15b2('0x39')]['sort']);_0x37e4cf[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_[_0x15b2('0x45')](_0xf7d3e2[_0x15b2('0x39')],_0x20c23a['filters']));_0x37e4cf[_0x15b2('0x44')]['VoiceQueueId']=_0x254acb['id'];if(_0xf7d3e2['query'][_0x15b2('0x2b')]){_0x37e4cf[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x37e4cf[_0x15b2('0x44')],{'$or':_['map'](_0x37e4cf[_0x15b2('0x3d')],function(_0x68697d){var _0x556d7c={};_0x556d7c[_0x68697d]={'$like':'%'+_0xf7d3e2[_0x15b2('0x39')][_0x15b2('0x2b')]+'%'};return _0x556d7c;})});}_0x37e4cf=_['merge']({},_0x37e4cf,_0xf7d3e2[_0x15b2('0x4e')]);return db[_0x15b2('0x69')][_0x15b2('0x1f')]({'where':_0x37e4cf['where']})[_0x15b2('0x25')](function(_0x24af2f){_0x28cb80[_0x15b2('0x1f')]=_0x24af2f;if(_0xf7d3e2['query'][_0x15b2('0x49')]){_0x37e4cf[_0x15b2('0x4a')]=[{'all':!![]}];}return db[_0x15b2('0x69')]['findAll'](_0x37e4cf);})[_0x15b2('0x25')](function(_0x44f33a){_0x28cb80[_0x15b2('0x64')]=_0x44f33a;return _0x28cb80;});}})[_0x15b2('0x25')](respondWithFilteredResult(_0x439bf1,_0x37e4cf))[_0x15b2('0x4f')](handleError(_0x439bf1,null));};exports[_0x15b2('0x6a')]=function(_0x1997e4,_0x565ce9,_0x4e47a9){var _0x4a5f9b={};var _0x13050c={};var _0x12e292;var _0x2dd03b;return db[_0x15b2('0x48')][_0x15b2('0x61')]({'where':{'id':_0x1997e4[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x565ce9,null))[_0x15b2('0x25')](function(_0x2bf1a3){if(_0x2bf1a3){_0x12e292=_0x2bf1a3;_0x13050c['model']=_['keys'](db[_0x15b2('0x6b')][_0x15b2('0x37')]);_0x13050c['query']=_[_0x15b2('0x3a')](_0x1997e4[_0x15b2('0x39')]);_0x13050c[_0x15b2('0x3b')]=_[_0x15b2('0x3c')](_0x13050c[_0x15b2('0x38')],_0x13050c[_0x15b2('0x39')]);_0x4a5f9b['attributes']=_[_0x15b2('0x3c')](_0x13050c['model'],qs[_0x15b2('0x3e')](_0x1997e4[_0x15b2('0x39')]['fields']));_0x4a5f9b[_0x15b2('0x3d')]=_0x4a5f9b[_0x15b2('0x3d')]['length']?_0x4a5f9b[_0x15b2('0x3d')]:_0x13050c[_0x15b2('0x38')];_0x4a5f9b['order']=qs[_0x15b2('0x43')](_0x1997e4['query'][_0x15b2('0x43')]);_0x4a5f9b[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_[_0x15b2('0x45')](_0x1997e4[_0x15b2('0x39')],_0x13050c['filters']));if(_0x1997e4[_0x15b2('0x39')]['filter']){_0x4a5f9b[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x4a5f9b[_0x15b2('0x44')],{'$or':_[_0x15b2('0x2d')](_0x4a5f9b[_0x15b2('0x3d')],function(_0x15c800){var _0x103b93={};_0x103b93[_0x15c800]={'$like':'%'+_0x1997e4['query'][_0x15b2('0x2b')]+'%'};return _0x103b93;})});}_0x4a5f9b=_[_0x15b2('0x46')]({},_0x4a5f9b,_0x1997e4[_0x15b2('0x4e')]);return _0x12e292[_0x15b2('0x6a')](_0x4a5f9b);}})[_0x15b2('0x25')](function(_0x7b32b6){if(_0x7b32b6){_0x2dd03b=_0x7b32b6[_0x15b2('0x3f')];if(!_0x1997e4[_0x15b2('0x39')][_0x15b2('0x40')]('nolimit')){_0x4a5f9b['limit']=qs['limit'](_0x1997e4[_0x15b2('0x39')][_0x15b2('0x21')]);_0x4a5f9b[_0x15b2('0x20')]=qs['offset'](_0x1997e4[_0x15b2('0x39')][_0x15b2('0x20')]);}return _0x12e292[_0x15b2('0x6a')](_0x4a5f9b);}})[_0x15b2('0x25')](function(_0x5d27b3){if(_0x5d27b3){return _0x5d27b3?{'count':_0x2dd03b,'rows':_0x5d27b3}:null;}})[_0x15b2('0x25')](respondWithResult(_0x565ce9,null))[_0x15b2('0x4f')](handleError(_0x565ce9,null));};exports[_0x15b2('0x6c')]=function(_0xca4fb4,_0x18f21d,_0x5a985a){var _0x4a988e=_0xca4fb4[_0x15b2('0x5b')][_0x15b2('0x6d')];var _0x2b8b97=_['map'](_0x4a988e,'id');return db['Team']['findAll']({'where':{'id':_0x2b8b97},'attributes':['id'],'include':[{'model':db[_0x15b2('0x6e')],'as':'Agents','attributes':['id',_0x15b2('0x31'),_0x15b2('0x6f'),'voicePause',_0x15b2('0x70')],'raw':!![]}]})[_0x15b2('0x25')](function(_0x29615a){if(_0x29615a){var _0x4c6f94=_[_0x15b2('0x71')](_0x29615a,function(_0xc8e8a3){var _0x180e5d=_0xc8e8a3['get']({'plain':!![]});_0x180e5d[_0x15b2('0x72')][_0x15b2('0x73')](function(_0x139ba0){_0x139ba0[_0x15b2('0x74')]=_[_0x15b2('0x30')](_0x4a988e,{'id':_0x180e5d['id']})['penalty'];});return _0x180e5d[_0x15b2('0x72')];});return db[_0x15b2('0x48')][_0x15b2('0x30')]({'where':{'id':_0xca4fb4['params']['id']}})[_0x15b2('0x25')](function(_0x334988){return db[_0x15b2('0x75')][_0x15b2('0x76')](function(_0x217a74){return _0x334988[_0x15b2('0x6c')](_0x2b8b97,{'transaction':_0x217a74})[_0x15b2('0x25')](function(){return BPromise[_0x15b2('0x77')](_0x4c6f94,function(_0x6119ad){return db[_0x15b2('0x78')][_0x15b2('0x79')]({'where':{'UserId':_0x6119ad['id'],'VoiceQueueId':_0xca4fb4[_0x15b2('0x4d')]['id']},'defaults':{'penalty':_0x6119ad[_0x15b2('0x74')]},'transaction':_0x217a74});});})['then'](function(){return BPromise[_0x15b2('0x77')](_['filter'](_0x4c6f94,{'online':!![]}),function(_0x4d9f63){return db['UserVoiceQueueRt'][_0x15b2('0x7a')]({'membername':_0x4d9f63[_0x15b2('0x31')],'UserId':_0x4d9f63['id'],'queue_name':_0x334988[_0x15b2('0x31')],'VoiceQueueId':_0x334988['id'],'interface':_[_0x15b2('0x7b')](_0x4d9f63[_0x15b2('0x70')])?util[_0x15b2('0x7c')](_0x15b2('0x7d'),_0x4d9f63[_0x15b2('0x31')]):_0x4d9f63[_0x15b2('0x70')],'paused':_0x4d9f63[_0x15b2('0x7e')]||![],'penalty':_0x4d9f63[_0x15b2('0x74')]},{'transaction':_0x217a74});});})['then'](function(){_0x4c6f94['forEach'](function(_0x30cdd4){socket[_0x15b2('0x7f')](_0x15b2('0x80'),{'UserId':_0x30cdd4['id'],'VoiceQueueId':_0x334988['id']});});});});});}})[_0x15b2('0x25')](respondWithStatusCode(_0x18f21d,null))['catch'](handleError(_0x18f21d,null));};exports[_0x15b2('0x81')]=function(_0x4cadd2,_0x49f90e,_0x8814f1){return db[_0x15b2('0x6b')][_0x15b2('0x4b')]({'where':{'id':_0x4cadd2[_0x15b2('0x39')][_0x15b2('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x15b2('0x72'),'attributes':['id'],'raw':!![]}]})[_0x15b2('0x25')](handleEntityNotFound(_0x49f90e,null))[_0x15b2('0x25')](function(_0x24a21a){var _0x64dd2f=_[_0x15b2('0x2d')](_0x24a21a,'id');var _0x213158=[];var _0x32d429=[];var _0x5270e2=squel[_0x15b2('0x83')]();_0x5270e2[_0x15b2('0x84')](_0x15b2('0x85'))['from'](_0x15b2('0x86'),'tq')[_0x15b2('0x87')](_0x15b2('0x88'),'ut',_0x15b2('0x89'))[_0x15b2('0x44')](_0x15b2('0x8a'),_0x4cadd2['params']['id']);for(var _0xab005e=0x0;_0xab005e<_0x24a21a[_0x15b2('0x3f')];_0xab005e+=0x1){let _0x4f72d0=_0x24a21a[_0xab005e];for(var _0x5514d1=0x0;_0x5514d1<_0x4f72d0['Agents']['length'];_0x5514d1+=0x1){let _0x397f3f=_0x4f72d0['Agents'][_0x5514d1];var _0x11bc19=_0x5270e2[_0x15b2('0x58')]();_0x11bc19[_0x15b2('0x44')]('ut.UserId\x20=\x20?',_0x397f3f['id']);_0x32d429[_0x15b2('0x8b')](db[_0x15b2('0x75')]['query'](_0x11bc19['toString'](),{'type':db['sequelize'][_0x15b2('0x8c')][_0x15b2('0x8d')]})[_0x15b2('0x25')](function(_0x231da7){if(_0x231da7['length']===0x1){return _0x397f3f['id'];}else{var _0x5f57a2=_[_0x15b2('0x8e')](_[_0x15b2('0x2d')](_0x231da7,_0x15b2('0x8f')),function(_0x1b2b13){return _[_0x15b2('0x2e')](_0x64dd2f,_0x1b2b13);});if(_0x5f57a2){return _0x397f3f['id'];}}}));}}return BPromise['all'](_0x32d429)[_0x15b2('0x25')](function(_0x553fd1){_0x213158=_(_0x213158)['union'](_0x553fd1)[_0x15b2('0x90')]()['value']();return db[_0x15b2('0x48')]['find']({'where':{'id':_0x4cadd2['params']['id']}})[_0x15b2('0x25')](function(_0x3993f0){return db[_0x15b2('0x75')][_0x15b2('0x76')](function(_0x41af09){return _0x3993f0[_0x15b2('0x81')](_0x4cadd2[_0x15b2('0x39')][_0x15b2('0x82')],{'transaction':_0x41af09})[_0x15b2('0x25')](function(){if(!_[_0x15b2('0x91')](_0x213158)){return _0x3993f0[_0x15b2('0x92')](_0x213158,{'transaction':_0x41af09})['then'](function(){return db[_0x15b2('0x93')]['destroy']({'where':{'VoiceQueueId':_0x4cadd2[_0x15b2('0x4d')]['id'],'UserId':_0x213158},'transaction':_0x41af09});});}})['then'](function(){_0x213158[_0x15b2('0x73')](function(_0x161c36){socket[_0x15b2('0x7f')](_0x15b2('0x94'),{'UserId':_0x161c36,'VoiceQueueId':_0x3993f0['id']});});});});});});})[_0x15b2('0x25')](respondWithStatusCode(_0x49f90e,null))[_0x15b2('0x4f')](handleError(_0x49f90e,null));};exports[_0x15b2('0x95')]=function(_0x3da791,_0x39c43f,_0x539e70){var _0x543bc3,_0x32dee6;return db[_0x15b2('0x48')][_0x15b2('0x30')]({'where':{'id':_0x3da791[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x39c43f,null))[_0x15b2('0x25')](function(_0x38080c){if(_0x38080c){_0x32dee6=_0x38080c;return _0x38080c[_0x15b2('0x95')](_0x3da791['body'][_0x15b2('0x82')],_[_0x15b2('0x59')](_0x3da791[_0x15b2('0x5b')],['ids','id'])||{})[_0x15b2('0x96')](function(_0x5329a3){for(var _0x173cd5=0x0;_0x173cd5<_0x3da791[_0x15b2('0x5b')]['ids'][_0x15b2('0x3f')];_0x173cd5+=0x1){socket[_0x15b2('0x7f')](_0x15b2('0x80'),{'UserId':_0x3da791[_0x15b2('0x5b')][_0x15b2('0x82')][_0x173cd5],'VoiceQueueId':_0x3da791[_0x15b2('0x4d')]['id']});}return _0x5329a3;});}})[_0x15b2('0x25')](function(_0x574c43){_0x543bc3=_0x574c43||[];if(_0x32dee6){return db[_0x15b2('0x6e')]['findAll']({'where':{'id':_0x3da791[_0x15b2('0x5b')][_0x15b2('0x82')]},'attributes':['id','name',_0x15b2('0x6f'),_0x15b2('0x7e'),_0x15b2('0x70')],'raw':!![]});}})['then'](function(_0x1d2ab3){if(!_[_0x15b2('0x91')](_0x1d2ab3)){var _0x47446a=[];for(var _0x7cd2fa=0x0;_0x7cd2fa<_0x1d2ab3[_0x15b2('0x3f')];_0x7cd2fa++){if(_0x1d2ab3[_0x7cd2fa][_0x15b2('0x6f')]){_0x47446a[_0x15b2('0x8b')](db[_0x15b2('0x93')][_0x15b2('0x7a')]({'membername':_0x1d2ab3[_0x7cd2fa][_0x15b2('0x31')],'UserId':_0x1d2ab3[_0x7cd2fa]['id'],'queue_name':_0x32dee6[_0x15b2('0x31')],'VoiceQueueId':_0x32dee6['id'],'interface':_[_0x15b2('0x7b')](_0x1d2ab3[_0x7cd2fa]['interface'])?util[_0x15b2('0x7c')](_0x15b2('0x7d'),_0x1d2ab3[_0x7cd2fa][_0x15b2('0x31')]):_0x1d2ab3[_0x7cd2fa][_0x15b2('0x70')],'paused':_0x1d2ab3[_0x7cd2fa][_0x15b2('0x7e')]||![],'penalty':_0x3da791[_0x15b2('0x5b')][_0x15b2('0x74')]||0x0}));}}return BPromise[_0x15b2('0x97')](_0x47446a);}})[_0x15b2('0x25')](function(){return _0x543bc3;})[_0x15b2('0x25')](respondWithResult(_0x39c43f,null))[_0x15b2('0x4f')](handleError(_0x39c43f,null));};exports[_0x15b2('0x92')]=function(_0x2a9f94,_0x690f44,_0x4c0c7d){return db[_0x15b2('0x48')][_0x15b2('0x30')]({'where':{'id':_0x2a9f94[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x690f44,null))[_0x15b2('0x25')](function(_0x2cd531){if(_0x2cd531){return _0x2cd531[_0x15b2('0x92')](_0x2a9f94['query'][_0x15b2('0x82')])[_0x15b2('0x25')](function(){if(_[_0x15b2('0x98')](_0x2a9f94[_0x15b2('0x39')][_0x15b2('0x82')])){for(var _0x26270a=0x0;_0x26270a<_0x2a9f94[_0x15b2('0x39')][_0x15b2('0x82')][_0x15b2('0x3f')];_0x26270a+=0x1){socket[_0x15b2('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x2a9f94['query'][_0x15b2('0x82')][_0x26270a]),'VoiceQueueId':Number(_0x2a9f94['params']['id'])});}}else{socket['emit'](_0x15b2('0x94'),{'UserId':Number(_0x2a9f94[_0x15b2('0x39')][_0x15b2('0x82')]),'VoiceQueueId':Number(_0x2a9f94[_0x15b2('0x4d')]['id'])});}});}})[_0x15b2('0x25')](function(_0x576f6a){return db[_0x15b2('0x93')][_0x15b2('0x26')]({'where':{'VoiceQueueId':_0x2a9f94[_0x15b2('0x4d')]['id'],'UserId':_0x2a9f94['query'][_0x15b2('0x82')]}})[_0x15b2('0x25')](function(){return _0x576f6a;});})[_0x15b2('0x25')](respondWithStatusCode(_0x690f44,null))['catch'](handleError(_0x690f44,null));};exports[_0x15b2('0x99')]=function(_0x2b8705,_0x2599ea,_0x537900){var _0x5674a1={};var _0x47a912={};var _0x12822c;var _0x386027;return db['VoiceQueue'][_0x15b2('0x61')]({'where':{'id':_0x2b8705[_0x15b2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2599ea,null))['then'](function(_0x335ba9){if(_0x335ba9){_0x12822c=_0x335ba9;_0x47a912[_0x15b2('0x38')]=_['keys'](db[_0x15b2('0x6e')][_0x15b2('0x37')]);_0x47a912['query']=_[_0x15b2('0x3a')](_0x2b8705['query']);_0x47a912['filters']=_[_0x15b2('0x3c')](_0x47a912[_0x15b2('0x38')],_0x47a912['query']);_0x5674a1[_0x15b2('0x3d')]=_['intersection'](_0x47a912[_0x15b2('0x38')],qs[_0x15b2('0x3e')](_0x2b8705['query'][_0x15b2('0x3e')]));_0x5674a1[_0x15b2('0x3d')]=_0x5674a1[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x5674a1['attributes']:_0x47a912[_0x15b2('0x38')];_0x5674a1[_0x15b2('0x42')]=qs['sort'](_0x2b8705[_0x15b2('0x39')][_0x15b2('0x43')]);_0x5674a1[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_['pick'](_0x2b8705[_0x15b2('0x39')],_0x47a912[_0x15b2('0x3b')]));if(_0x2b8705['query']['filter']){_0x5674a1[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x5674a1['where'],{'$or':_['map'](_0x5674a1[_0x15b2('0x3d')],function(_0x4b1b8e){var _0x16ef92={};_0x16ef92[_0x4b1b8e]={'$like':'%'+_0x2b8705[_0x15b2('0x39')][_0x15b2('0x2b')]+'%'};return _0x16ef92;})});}_0x5674a1=_[_0x15b2('0x46')]({},_0x5674a1,_0x2b8705[_0x15b2('0x4e')]);return _0x12822c['getAgents'](_0x5674a1);}})[_0x15b2('0x25')](function(_0x2edc4e){if(_0x2edc4e){_0x386027=_0x2edc4e[_0x15b2('0x3f')];if(!_0x2b8705[_0x15b2('0x39')]['hasOwnProperty'](_0x15b2('0x41'))){_0x5674a1[_0x15b2('0x21')]=qs['limit'](_0x2b8705[_0x15b2('0x39')]['limit']);_0x5674a1[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0x2b8705[_0x15b2('0x39')][_0x15b2('0x20')]);}return _0x12822c[_0x15b2('0x99')](_0x5674a1);}})[_0x15b2('0x25')](function(_0x3c9ebd){if(_0x3c9ebd){return _0x3c9ebd?{'count':_0x386027,'rows':_0x3c9ebd}:null;}})[_0x15b2('0x25')](respondWithResult(_0x2599ea,null))[_0x15b2('0x4f')](handleError(_0x2599ea,null));};exports[_0x15b2('0x9a')]=function(_0x342539,_0x474213,_0x351cce){var _0x20a93c={};var _0x311eec={};var _0x4b793f;var _0x18109a;return db[_0x15b2('0x48')][_0x15b2('0x61')]({'where':{'id':_0x342539[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x474213,null))[_0x15b2('0x25')](function(_0x23b7a4){if(_0x23b7a4){_0x4b793f=_0x23b7a4;_0x311eec[_0x15b2('0x38')]=_[_0x15b2('0x3a')](db[_0x15b2('0x93')][_0x15b2('0x37')]);_0x311eec[_0x15b2('0x39')]=_[_0x15b2('0x3a')](_0x342539[_0x15b2('0x39')]);_0x311eec[_0x15b2('0x3b')]=_[_0x15b2('0x3c')](_0x311eec[_0x15b2('0x38')],_0x311eec[_0x15b2('0x39')]);_0x20a93c[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x311eec[_0x15b2('0x38')],qs[_0x15b2('0x3e')](_0x342539[_0x15b2('0x39')]['fields']));_0x20a93c[_0x15b2('0x3d')]=_0x20a93c['attributes'][_0x15b2('0x3f')]?_0x20a93c[_0x15b2('0x3d')]:_0x311eec[_0x15b2('0x38')];_0x20a93c[_0x15b2('0x42')]=qs[_0x15b2('0x43')](_0x342539[_0x15b2('0x39')]['sort']);_0x20a93c['where']=qs[_0x15b2('0x3b')](_['pick'](_0x342539[_0x15b2('0x39')],_0x311eec[_0x15b2('0x3b')]));if(_0x342539[_0x15b2('0x39')][_0x15b2('0x2b')]){_0x20a93c[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x20a93c[_0x15b2('0x44')],{'$or':_['map'](_0x20a93c['attributes'],function(_0x151354){var _0x5d410c={};_0x5d410c[_0x151354]={'$like':'%'+_0x342539[_0x15b2('0x39')]['filter']+'%'};return _0x5d410c;})});}_0x20a93c=_['merge']({},_0x20a93c,_0x342539[_0x15b2('0x4e')]);return _0x4b793f[_0x15b2('0x9a')](_0x20a93c);}})['then'](function(_0x1cf65f){if(_0x1cf65f){_0x18109a=_0x1cf65f[_0x15b2('0x3f')];if(!_0x342539[_0x15b2('0x39')]['hasOwnProperty'](_0x15b2('0x41'))){_0x20a93c['limit']=qs[_0x15b2('0x21')](_0x342539[_0x15b2('0x39')]['limit']);_0x20a93c[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0x342539[_0x15b2('0x39')][_0x15b2('0x20')]);}return _0x4b793f[_0x15b2('0x9a')](_0x20a93c);}})['then'](function(_0x4cc72c){return _0x4cc72c?{'count':_0x18109a,'rows':_0x4cc72c}:null;})[_0x15b2('0x25')](respondWithResult(_0x474213,null))['catch'](handleError(_0x474213,null));};exports['getLists']=function(_0x542f7e,_0x4b8d02,_0xb3a0e7){var _0x198496={};var _0x2bed68={};var _0x2ecd3a;var _0x16a9e8;return db['VoiceQueue']['findOne']({'where':{'id':_0x542f7e[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x4b8d02,null))['then'](function(_0x400707){if(_0x400707){_0x2ecd3a=_0x400707;_0x2bed68[_0x15b2('0x38')]=_[_0x15b2('0x3a')](db['CmList'][_0x15b2('0x37')]);_0x2bed68[_0x15b2('0x39')]=_[_0x15b2('0x3a')](_0x542f7e[_0x15b2('0x39')]);_0x2bed68[_0x15b2('0x3b')]=_[_0x15b2('0x3c')](_0x2bed68[_0x15b2('0x38')],_0x2bed68[_0x15b2('0x39')]);_0x198496[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x2bed68[_0x15b2('0x38')],qs[_0x15b2('0x3e')](_0x542f7e[_0x15b2('0x39')][_0x15b2('0x3e')]));_0x198496[_0x15b2('0x3d')]=_0x198496[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x198496[_0x15b2('0x3d')]:_0x2bed68[_0x15b2('0x38')];_0x198496['order']=qs[_0x15b2('0x43')](_0x542f7e['query'][_0x15b2('0x43')]);_0x198496['where']=qs[_0x15b2('0x3b')](_[_0x15b2('0x45')](_0x542f7e[_0x15b2('0x39')],_0x2bed68['filters']));if(_0x542f7e[_0x15b2('0x39')][_0x15b2('0x2b')]){_0x198496[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x198496['where'],{'$or':_['map'](_0x198496[_0x15b2('0x3d')],function(_0x26ff5f){var _0x28e6a4={};_0x28e6a4[_0x26ff5f]={'$like':'%'+_0x542f7e[_0x15b2('0x39')][_0x15b2('0x2b')]+'%'};return _0x28e6a4;})});}_0x198496=_[_0x15b2('0x46')]({},_0x198496,_0x542f7e[_0x15b2('0x4e')]);return _0x2ecd3a['getLists'](_0x198496);}})[_0x15b2('0x25')](function(_0x2afc26){if(_0x2afc26){_0x16a9e8=_0x2afc26[_0x15b2('0x3f')];if(!_0x542f7e[_0x15b2('0x39')][_0x15b2('0x40')](_0x15b2('0x41'))){_0x198496['limit']=qs[_0x15b2('0x21')](_0x542f7e['query']['limit']);_0x198496[_0x15b2('0x20')]=qs[_0x15b2('0x20')](_0x542f7e['query'][_0x15b2('0x20')]);}return _0x2ecd3a[_0x15b2('0x9b')](_0x198496);}})[_0x15b2('0x25')](function(_0x5e5bd2){if(_0x5e5bd2){return _0x5e5bd2?{'count':_0x16a9e8,'rows':_0x5e5bd2}:null;}})[_0x15b2('0x25')](respondWithResult(_0x4b8d02,null))[_0x15b2('0x4f')](handleError(_0x4b8d02,null));};exports[_0x15b2('0x9c')]=function(_0x3ca6c9,_0x504158,_0x4a2129){var _0x53ef8f,_0x291ea7;return db[_0x15b2('0x48')]['find']({'where':{'id':_0x3ca6c9[_0x15b2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x504158,null))['then'](function(_0x237a97){if(_0x237a97){_0x291ea7=_0x237a97;return _0x237a97[_0x15b2('0x9c')](_0x3ca6c9[_0x15b2('0x5b')]['ids'],_[_0x15b2('0x59')](_0x3ca6c9[_0x15b2('0x5b')],[_0x15b2('0x82'),'id'])||{});}return null;})[_0x15b2('0x96')](function(_0x228132){var _0x39eaed;_0x53ef8f=_0x228132||[];var _0xba3a30=[];if(_0x228132){for(var _0x4e2a2d=0x0;_0x4e2a2d<_0x228132[_0x15b2('0x3f')];_0x4e2a2d+=0x1){var _0x317ed3=_0x228132[_0x4e2a2d]['get']({'plain':!![]});_0x291ea7[_0x15b2('0x9d')]=_0x3ca6c9['body'][_0x15b2('0x9d')]?_0x3ca6c9[_0x15b2('0x5b')][_0x15b2('0x9d')]:_0x291ea7[_0x15b2('0x9d')];switch(_0x291ea7[_0x15b2('0x9d')]){case _0x15b2('0x9e'):_0x39eaed=squel['insert']()[_0x15b2('0x9f')](_0x15b2('0xa0'))[_0x15b2('0xa1')]([_0x15b2('0xa2'),'scheduledAt',_0x15b2('0xa3'),_0x15b2('0xa4'),_0x15b2('0x63'),_0x15b2('0x5a'),_0x15b2('0xa5')],squel[_0x15b2('0x83')]()['field'](_0x15b2('0xa2'),_0x15b2('0xa2'))[_0x15b2('0x84')](_0x15b2('0xa6'),_0x15b2('0xa7'))[_0x15b2('0x84')]('id','ContactId')[_0x15b2('0x84')](_0x317ed3[_0x15b2('0xa8')][_0x15b2('0xa9')](),'ListId')['field'](_0x3ca6c9[_0x15b2('0x4d')]['id']['toString'](),_0x15b2('0x63'))[_0x15b2('0x84')](_0x15b2('0xa6'),_0x15b2('0x5a'))[_0x15b2('0x84')](_0x15b2('0xa6'),_0x15b2('0xa5'))['from'](_0x15b2('0xaa'))[_0x15b2('0x44')]('deletedAt\x20IS\x20NULL')[_0x15b2('0x44')](_0x15b2('0xab'),_0x317ed3['CmListId'][_0x15b2('0xa9')]())[_0x15b2('0x44')](_0x15b2('0xac'))['where'](_0x15b2('0xad'),squel[_0x15b2('0x83')]()[_0x15b2('0x84')](_0x15b2('0xae'))['from'](_0x15b2('0xaf'))['where'](_0x15b2('0x8a'),_0x3ca6c9['params']['id'][_0x15b2('0xa9')]()))[_0x15b2('0x44')](_0x15b2('0xad'),squel[_0x15b2('0x83')]()[_0x15b2('0x84')](_0x15b2('0xb0'))[_0x15b2('0xb1')]('cm_hopper')[_0x15b2('0x44')](_0x15b2('0x8a'),_0x3ca6c9[_0x15b2('0x4d')]['id'][_0x15b2('0xa9')]())))[_0x15b2('0xa9')]();break;case _0x15b2('0xb2'):_0x39eaed=squel[_0x15b2('0xb3')]()['into']('cm_hopper')['fromQuery'](['phone',_0x15b2('0xa7'),_0x15b2('0xa3'),_0x15b2('0xa4'),_0x15b2('0x63'),_0x15b2('0x5a'),_0x15b2('0xa5')],squel[_0x15b2('0x83')]()[_0x15b2('0x84')](_0x15b2('0xa2'),'phone')[_0x15b2('0x84')](_0x15b2('0xa6'),'scheduledAt')[_0x15b2('0x84')]('id',_0x15b2('0xa3'))[_0x15b2('0x84')](_0x317ed3[_0x15b2('0xa8')][_0x15b2('0xa9')](),_0x15b2('0xa4'))[_0x15b2('0x84')](_0x3ca6c9[_0x15b2('0x4d')]['id']['toString'](),_0x15b2('0x63'))['field']('NOW()',_0x15b2('0x5a'))[_0x15b2('0x84')](_0x15b2('0xa6'),'updatedAt')[_0x15b2('0xb1')](_0x15b2('0xaa'))[_0x15b2('0x44')](_0x15b2('0xb4'))[_0x15b2('0x44')]('ListId\x20=\x20?',_0x317ed3[_0x15b2('0xa8')]['toString']())[_0x15b2('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x15b2('0xad'),squel[_0x15b2('0x83')]()[_0x15b2('0x84')](_0x15b2('0xb0'))[_0x15b2('0xb1')](_0x15b2('0xa0'))[_0x15b2('0x44')](_0x15b2('0x8a'),_0x3ca6c9[_0x15b2('0x4d')]['id'][_0x15b2('0xa9')]())))[_0x15b2('0xa9')]();break;default:_0x39eaed=squel[_0x15b2('0xb3')]()[_0x15b2('0x9f')](_0x15b2('0xa0'))[_0x15b2('0xa1')]([_0x15b2('0xa2'),_0x15b2('0xa7'),'ContactId',_0x15b2('0xa4'),_0x15b2('0x63'),_0x15b2('0x5a'),'updatedAt'],squel[_0x15b2('0x83')]()['field'](_0x15b2('0xa2'),_0x15b2('0xa2'))[_0x15b2('0x84')](_0x15b2('0xa6'),_0x15b2('0xa7'))['field']('id',_0x15b2('0xa3'))['field'](_0x317ed3['CmListId'][_0x15b2('0xa9')](),_0x15b2('0xa4'))[_0x15b2('0x84')](_0x3ca6c9[_0x15b2('0x4d')]['id'][_0x15b2('0xa9')](),'VoiceQueueId')[_0x15b2('0x84')](_0x15b2('0xa6'),_0x15b2('0x5a'))[_0x15b2('0x84')](_0x15b2('0xa6'),_0x15b2('0xa5'))[_0x15b2('0xb1')]('cm_contacts')[_0x15b2('0x44')](_0x15b2('0xb4'))[_0x15b2('0x44')](_0x15b2('0xab'),_0x317ed3[_0x15b2('0xa8')][_0x15b2('0xa9')]())[_0x15b2('0x44')](_0x15b2('0xac')))['toString']();}_0xba3a30[_0x15b2('0x8b')](db[_0x15b2('0x75')][_0x15b2('0x39')](_0x39eaed));}return BPromise[_0x15b2('0x97')](_0xba3a30);}})[_0x15b2('0x25')](function(){return _0x53ef8f;})[_0x15b2('0x25')](respondWithResult(_0x504158,null))['catch'](handleError(_0x504158,null));};exports[_0x15b2('0xb5')]=function(_0x91f245,_0x4d3d07,_0x4ba62d){return db[_0x15b2('0x48')][_0x15b2('0x30')]({'where':{'id':_0x91f245['params']['id']}})['then'](handleEntityNotFound(_0x4d3d07,null))[_0x15b2('0x25')](function(_0x1524f0){if(_0x1524f0){return _0x1524f0[_0x15b2('0xb5')](_0x91f245['query']['ids']);}})[_0x15b2('0x25')](function(_0x52aad1){if(_0x52aad1){return db[_0x15b2('0x62')][_0x15b2('0x26')]({'where':{'ListId':_0x91f245['query']['ids'],'VoiceQueueId':_0x91f245['params']['id']}})[_0x15b2('0x25')](function(){return _0x52aad1;});}})[_0x15b2('0x25')](respondWithStatusCode(_0x4d3d07,null))[_0x15b2('0x4f')](handleError(_0x4d3d07,null));};exports[_0x15b2('0xb6')]=function(_0x24f7bc,_0x35b732,_0xba5018){var _0x3fbc59={};var _0x269258={};var _0x33b9bb;var _0x269cd2;return db[_0x15b2('0x48')]['findOne']({'where':{'id':_0x24f7bc[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x35b732,null))[_0x15b2('0x25')](function(_0x16e546){if(_0x16e546){_0x33b9bb=_0x16e546;_0x269258['model']=_[_0x15b2('0x3a')](db[_0x15b2('0xb7')][_0x15b2('0x37')]);_0x269258['query']=_[_0x15b2('0x3a')](_0x24f7bc[_0x15b2('0x39')]);_0x269258[_0x15b2('0x3b')]=_['intersection'](_0x269258[_0x15b2('0x38')],_0x269258[_0x15b2('0x39')]);_0x3fbc59[_0x15b2('0x3d')]=_[_0x15b2('0x3c')](_0x269258[_0x15b2('0x38')],qs['fields'](_0x24f7bc[_0x15b2('0x39')][_0x15b2('0x3e')]));_0x3fbc59['attributes']=_0x3fbc59[_0x15b2('0x3d')][_0x15b2('0x3f')]?_0x3fbc59[_0x15b2('0x3d')]:_0x269258[_0x15b2('0x38')];_0x3fbc59[_0x15b2('0x42')]=qs['sort'](_0x24f7bc['query'][_0x15b2('0x43')]);_0x3fbc59[_0x15b2('0x44')]=qs[_0x15b2('0x3b')](_[_0x15b2('0x45')](_0x24f7bc[_0x15b2('0x39')],_0x269258['filters']));if(_0x24f7bc[_0x15b2('0x39')][_0x15b2('0x2b')]){_0x3fbc59[_0x15b2('0x44')]=_[_0x15b2('0x46')](_0x3fbc59[_0x15b2('0x44')],{'$or':_['map'](_0x3fbc59[_0x15b2('0x3d')],function(_0x288594){var _0x362846={};_0x362846[_0x288594]={'$like':'%'+_0x24f7bc['query'][_0x15b2('0x2b')]+'%'};return _0x362846;})});}_0x3fbc59=_['merge']({},_0x3fbc59,_0x24f7bc[_0x15b2('0x4e')]);return _0x33b9bb[_0x15b2('0xb6')](_0x3fbc59);}})[_0x15b2('0x25')](function(_0x529a0b){if(_0x529a0b){_0x269cd2=_0x529a0b['length'];if(!_0x24f7bc[_0x15b2('0x39')][_0x15b2('0x40')](_0x15b2('0x41'))){_0x3fbc59[_0x15b2('0x21')]=qs[_0x15b2('0x21')](_0x24f7bc[_0x15b2('0x39')][_0x15b2('0x21')]);_0x3fbc59['offset']=qs['offset'](_0x24f7bc[_0x15b2('0x39')][_0x15b2('0x20')]);}return _0x33b9bb[_0x15b2('0xb6')](_0x3fbc59);}})[_0x15b2('0x25')](function(_0x30eb80){if(_0x30eb80){return _0x30eb80?{'count':_0x269cd2,'rows':_0x30eb80}:null;}})[_0x15b2('0x25')](respondWithResult(_0x35b732,null))[_0x15b2('0x4f')](handleError(_0x35b732,null));};exports[_0x15b2('0xb8')]=function(_0x52bbe2,_0x5f3de4,_0x58c909){var _0x295cf7,_0xa11750;return db[_0x15b2('0x48')][_0x15b2('0x30')]({'where':{'id':_0x52bbe2[_0x15b2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f3de4,null))['then'](function(_0x11e494){if(_0x11e494){_0xa11750=_0x11e494;return _0x11e494['addBlackLists'](_0x52bbe2[_0x15b2('0x5b')][_0x15b2('0x82')],_['omit'](_0x52bbe2['body'],['ids','id'])||{});}return null;})[_0x15b2('0x96')](function(_0x241e15){var _0xd44089;_0x295cf7=_0x241e15||[];var _0x160ac3=[];if(_0x241e15){for(var _0x161eca=0x0;_0x161eca<_0x241e15[_0x15b2('0x3f')];_0x161eca+=0x1){var _0x5a2814=_0x241e15[_0x161eca]['get']({'plain':!![]});_0xd44089=squel[_0x15b2('0xb3')]()[_0x15b2('0x9f')](_0x15b2('0xb9'))['fromQuery'](['phone',_0x15b2('0xa3'),_0x15b2('0xa4'),_0x15b2('0x63'),'createdAt',_0x15b2('0xa5')],squel[_0x15b2('0x83')]()['field'](_0x15b2('0xa2'),_0x15b2('0xa2'))[_0x15b2('0x84')]('id','ContactId')[_0x15b2('0x84')](_0x5a2814[_0x15b2('0xa8')][_0x15b2('0xa9')](),_0x15b2('0xa4'))[_0x15b2('0x84')](_0x52bbe2[_0x15b2('0x4d')]['id'][_0x15b2('0xa9')](),_0x15b2('0x63'))[_0x15b2('0x84')](_0x15b2('0xa6'),'createdAt')['field'](_0x15b2('0xa6'),_0x15b2('0xa5'))[_0x15b2('0xb1')]('cm_contacts')[_0x15b2('0x44')]('deletedAt\x20IS\x20NULL')[_0x15b2('0x44')](_0x15b2('0xab'),_0x5a2814['CmListId'][_0x15b2('0xa9')]())[_0x15b2('0x44')](_0x15b2('0xac')))[_0x15b2('0xa9')]();_0x160ac3[_0x15b2('0x8b')](db[_0x15b2('0x75')][_0x15b2('0x39')](_0xd44089));}return BPromise[_0x15b2('0x97')](_0x160ac3);}})['then'](function(){return _0x295cf7;})[_0x15b2('0x25')](respondWithResult(_0x5f3de4,null))[_0x15b2('0x4f')](handleError(_0x5f3de4,null));};exports[_0x15b2('0xba')]=function(_0x48a63b,_0x306f3d,_0x4ceea1){return db[_0x15b2('0x48')]['find']({'where':{'id':_0x48a63b['params']['id']}})[_0x15b2('0x25')](handleEntityNotFound(_0x306f3d,null))[_0x15b2('0x25')](function(_0xbed306){if(_0xbed306){return _0xbed306['removeBlackLists'](_0x48a63b[_0x15b2('0x39')][_0x15b2('0x82')]);}})[_0x15b2('0x25')](function(_0x4c100b){if(_0x4c100b){return db[_0x15b2('0x69')]['destroy']({'where':{'ListId':_0x48a63b['query'][_0x15b2('0x82')],'VoiceQueueId':_0x48a63b[_0x15b2('0x4d')]['id']}})[_0x15b2('0x25')](function(){return _0x4c100b;});}})['then'](respondWithStatusCode(_0x306f3d,null))[_0x15b2('0x4f')](handleError(_0x306f3d,null));}; \ No newline at end of file +var _0xcc56=['from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','NOW()','scheduledAt','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','CmListId','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','ignore','map','value','includes','name','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','outbound','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','nolimit','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId'];(function(_0x5cca60,_0x562f45){var _0xc36653=function(_0x3778ce){while(--_0x3778ce){_0x5cca60['push'](_0x5cca60['shift']());}};_0xc36653(++_0x562f45);}(_0xcc56,0x1a5));var _0x6cc5=function(_0x40ca11,_0x28a4be){_0x40ca11=_0x40ca11-0x0;var _0x1e1544=_0xcc56[_0x40ca11];return _0x1e1544;};'use strict';var pdf=require(_0x6cc5('0x0'));var emlformat=require(_0x6cc5('0x1'));var rimraf=require(_0x6cc5('0x2'));var zipdir=require(_0x6cc5('0x3'));var jsonpatch=require(_0x6cc5('0x4'));var rp=require(_0x6cc5('0x5'));var moment=require('moment');var BPromise=require(_0x6cc5('0x6'));var Mustache=require(_0x6cc5('0x7'));var util=require(_0x6cc5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6cc5('0x9'));var ejs=require(_0x6cc5('0xa'));var fs=require('fs');var _=require(_0x6cc5('0xb'));var squel=require('squel');var crypto=require(_0x6cc5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6cc5('0xd'));var toCsv=require(_0x6cc5('0x9'));var querystring=require(_0x6cc5('0xe'));var Papa=require(_0x6cc5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cc5('0x10'));var as=require(_0x6cc5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6cc5('0x12'))(_0x6cc5('0x13'));var utils=require(_0x6cc5('0x14'));var config=require(_0x6cc5('0x15'));var db=require(_0x6cc5('0x16'))['db'];config['redis']=_[_0x6cc5('0x17')](config[_0x6cc5('0x18')],{'host':_0x6cc5('0x19'),'port':0x18eb});var socket=require(_0x6cc5('0x1a'))(new Redis(config[_0x6cc5('0x18')]));require(_0x6cc5('0x1b'))['register'](socket);function respondWithStatusCode(_0x330ae4,_0x496a63){_0x496a63=_0x496a63||0xcc;return function(_0x59d5f7){if(_0x59d5f7){return _0x330ae4[_0x6cc5('0x1c')](_0x496a63);}return _0x330ae4[_0x6cc5('0x1d')](_0x496a63)[_0x6cc5('0x1e')]();};}function respondWithResult(_0x3998ad,_0x181a46){_0x181a46=_0x181a46||0xc8;return function(_0x2701b4){if(_0x2701b4){return _0x3998ad[_0x6cc5('0x1d')](_0x181a46)[_0x6cc5('0x1f')](_0x2701b4);}};}function respondWithFilteredResult(_0x30058f,_0x58f7a0){return function(_0x16218c){if(_0x16218c){var _0x9de1b1=_0x16218c[_0x6cc5('0x20')],_0xb4ef61=_0x58f7a0[_0x6cc5('0x21')],_0x5e312e=_0x58f7a0[_0x6cc5('0x21')]+_0x58f7a0[_0x6cc5('0x22')],_0x4fa2ad;if(_0x5e312e>=_0x9de1b1){_0x5e312e=_0x9de1b1;_0x4fa2ad=0xc8;}else{_0x4fa2ad=0xce;}_0x30058f[_0x6cc5('0x1d')](_0x4fa2ad);return _0x30058f['set'](_0x6cc5('0x23'),_0xb4ef61+'-'+_0x5e312e+'/'+_0x9de1b1)[_0x6cc5('0x1f')](_0x16218c);}return null;};}function patchUpdates(_0x48f043){return function(_0x13b011){try{jsonpatch[_0x6cc5('0x24')](_0x13b011,_0x48f043,!![]);}catch(_0x7bdde4){return BPromise[_0x6cc5('0x25')](_0x7bdde4);}return _0x13b011[_0x6cc5('0x26')]();};}function saveUpdates(_0x5878d7,_0x43b943){return function(_0x91e29e){if(_0x91e29e){return _0x91e29e[_0x6cc5('0x27')](_0x5878d7)[_0x6cc5('0x28')](function(_0x360739){return _0x360739;});}return null;};}function removeEntity(_0x21008b,_0xd8414a){return function(_0x13d4a2){if(_0x13d4a2){return _0x13d4a2[_0x6cc5('0x29')]()[_0x6cc5('0x28')](function(){var _0x40fb0b=_0x13d4a2['get']({'plain':!![]});var _0x5ed91d=[{'name':_0x6cc5('0x2a'),'value':_0x6cc5('0x2b'),'ignore':![]},{'name':_0x6cc5('0x2c'),'value':'outbound','ignore':![]}];var _0x2b1905=_(_0x5ed91d)['filter'](_0x6cc5('0x2d'))[_0x6cc5('0x2e')]('value')[_0x6cc5('0x2f')]();if(_[_0x6cc5('0x30')](_0x2b1905,_0x40fb0b['type'])){return;}var _0x433ce1=_['find'](_0x5ed91d,[_0x6cc5('0x2f'),_0x40fb0b['type']])[_0x6cc5('0x31')];return db['UserProfileResource'][_0x6cc5('0x29')]({'where':{'type':_0x433ce1,'resourceId':_0x40fb0b['id']}})[_0x6cc5('0x28')](function(){return _0x13d4a2;});})[_0x6cc5('0x28')](function(){_0x21008b[_0x6cc5('0x1d')](0xcc)[_0x6cc5('0x1e')]();});}};}function handleEntityNotFound(_0x162ba5,_0x5091b6){return function(_0x556e13){if(!_0x556e13){_0x162ba5['sendStatus'](0x194);}return _0x556e13;};}function handleError(_0x65dedf,_0x46fdd9){_0x46fdd9=_0x46fdd9||0x1f4;return function(_0x1c886b){logger[_0x6cc5('0x32')](_0x1c886b[_0x6cc5('0x33')]);if(_0x1c886b[_0x6cc5('0x31')]){delete _0x1c886b[_0x6cc5('0x31')];}_0x65dedf[_0x6cc5('0x1d')](_0x46fdd9)[_0x6cc5('0x34')](_0x1c886b);};}exports[_0x6cc5('0x35')]=function(_0x50e717,_0x342e3d){var _0x20953f={},_0x58e000={},_0x2881b4={'count':0x0,'rows':[]};var _0x54daff=_[_0x6cc5('0x2e')](db[_0x6cc5('0x36')][_0x6cc5('0x37')],function(_0xbc0630){return{'name':_0xbc0630[_0x6cc5('0x38')],'type':_0xbc0630[_0x6cc5('0x39')][_0x6cc5('0x3a')]};});_0x58e000['model']=_[_0x6cc5('0x2e')](_0x54daff,_0x6cc5('0x31'));_0x58e000[_0x6cc5('0x3b')]=_[_0x6cc5('0x3c')](_0x50e717[_0x6cc5('0x3b')]);_0x58e000[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x58e000[_0x6cc5('0x3f')],_0x58e000[_0x6cc5('0x3b')]);_0x20953f['attributes']=_['intersection'](_0x58e000[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0x50e717[_0x6cc5('0x3b')][_0x6cc5('0x40')]));_0x20953f[_0x6cc5('0x41')]=_0x20953f['attributes'][_0x6cc5('0x42')]?_0x20953f[_0x6cc5('0x41')]:_0x58e000['model'];if(!_0x50e717[_0x6cc5('0x3b')][_0x6cc5('0x43')]('nolimit')){_0x20953f['limit']=qs[_0x6cc5('0x22')](_0x50e717[_0x6cc5('0x3b')][_0x6cc5('0x22')]);_0x20953f[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x50e717[_0x6cc5('0x3b')][_0x6cc5('0x21')]);}_0x20953f[_0x6cc5('0x44')]=qs[_0x6cc5('0x45')](_0x50e717['query']['sort']);_0x20953f[_0x6cc5('0x46')]=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0x50e717[_0x6cc5('0x3b')],_0x58e000[_0x6cc5('0x3d')]),_0x54daff);if(_0x50e717[_0x6cc5('0x3b')][_0x6cc5('0x48')]){_0x20953f[_0x6cc5('0x46')]=_[_0x6cc5('0x49')](_0x20953f[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x54daff,function(_0x1ec1d6){if(_0x1ec1d6[_0x6cc5('0x39')]!=='VIRTUAL'){var _0x44820c={};_0x44820c[_0x1ec1d6['name']]={'$like':'%'+_0x50e717[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0x44820c;}})});}_0x20953f=_['merge']({},_0x20953f,_0x50e717[_0x6cc5('0x4a')]);var _0x1441f9={'where':_0x20953f['where']};return db['VoiceQueue'][_0x6cc5('0x20')](_0x1441f9)[_0x6cc5('0x28')](function(_0x472767){_0x2881b4['count']=_0x472767;if(_0x50e717[_0x6cc5('0x3b')]['includeAll']){_0x20953f[_0x6cc5('0x4b')]=[{'all':!![]}];}return db[_0x6cc5('0x36')][_0x6cc5('0x4c')](_0x20953f);})[_0x6cc5('0x28')](function(_0x10e242){_0x2881b4[_0x6cc5('0x4d')]=_0x10e242;return _0x2881b4;})[_0x6cc5('0x28')](respondWithFilteredResult(_0x342e3d,_0x20953f))[_0x6cc5('0x4e')](handleError(_0x342e3d,null));};exports[_0x6cc5('0x4f')]=function(_0xbdcf11,_0x5abe9e){var _0x56000e={'raw':![],'where':{'id':_0xbdcf11[_0x6cc5('0x50')]['id']}},_0x13e5a5={};_0x13e5a5[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db['VoiceQueue'][_0x6cc5('0x37')]);_0x13e5a5[_0x6cc5('0x3b')]=_[_0x6cc5('0x3c')](_0xbdcf11[_0x6cc5('0x3b')]);_0x13e5a5[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x13e5a5[_0x6cc5('0x3f')],_0x13e5a5[_0x6cc5('0x3b')]);_0x56000e[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0x13e5a5[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0xbdcf11[_0x6cc5('0x3b')][_0x6cc5('0x40')]));_0x56000e[_0x6cc5('0x41')]=_0x56000e[_0x6cc5('0x41')][_0x6cc5('0x42')]?_0x56000e['attributes']:_0x13e5a5[_0x6cc5('0x3f')];if(_0xbdcf11[_0x6cc5('0x3b')]['includeAll']){_0x56000e['include']=[{'all':!![]}];}_0x56000e=_[_0x6cc5('0x49')]({},_0x56000e,_0xbdcf11[_0x6cc5('0x4a')]);return db[_0x6cc5('0x36')]['find'](_0x56000e)[_0x6cc5('0x28')](handleEntityNotFound(_0x5abe9e,null))[_0x6cc5('0x28')](respondWithResult(_0x5abe9e,null))[_0x6cc5('0x4e')](handleError(_0x5abe9e,null));};exports['create']=function(_0x23d2bc,_0x5a5ff4){return db['VoiceQueue'][_0x6cc5('0x51')](_0x23d2bc[_0x6cc5('0x52')],{})[_0x6cc5('0x28')](function(_0x19c5e6){var _0x374f74=_0x23d2bc['user'][_0x6cc5('0x53')]({'plain':!![]});if(!_0x374f74)throw new Error(_0x6cc5('0x54'));if(_0x374f74[_0x6cc5('0x55')]===_0x6cc5('0x56')){var _0x4e5b80=_0x19c5e6[_0x6cc5('0x53')]({'plain':!![]});var _0x53142f=[{'name':_0x6cc5('0x2a'),'value':_0x6cc5('0x2b')},{'name':'QueueCampaigns','value':_0x6cc5('0x57')}];var _0x4c73cf=_['find'](_0x53142f,['value',_0x4e5b80[_0x6cc5('0x39')]])['name'];return db[_0x6cc5('0x58')][_0x6cc5('0x59')]({'where':{'name':_0x4c73cf,'userProfileId':_0x374f74[_0x6cc5('0x5a')]},'raw':!![]})[_0x6cc5('0x28')](function(_0x51934c){if(_0x51934c&&_0x51934c['autoAssociation']===0x0){return db[_0x6cc5('0x5b')][_0x6cc5('0x51')]({'name':_0x4e5b80['name'],'resourceId':_0x4e5b80['id'],'type':_0x51934c['name'],'sectionId':_0x51934c['id']},{})['then'](function(){return _0x19c5e6;});}else{return _0x19c5e6;}})[_0x6cc5('0x4e')](function(_0x33b013){logger['error'](_0x6cc5('0x5c'),_0x33b013);throw _0x33b013;});}return _0x19c5e6;})[_0x6cc5('0x28')](respondWithResult(_0x5a5ff4,0xc9))[_0x6cc5('0x4e')](handleError(_0x5a5ff4,null));};exports[_0x6cc5('0x5d')]=function(_0x135e44,_0x52ad39){var _0x121ad0={'where':{'id':_0x135e44[_0x6cc5('0x50')]['id']}},_0x33ded6={};_0x33ded6[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db[_0x6cc5('0x36')][_0x6cc5('0x37')]);_0x121ad0[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0x33ded6['model'],qs[_0x6cc5('0x40')](_0x135e44[_0x6cc5('0x3b')]['fields']));_0x121ad0[_0x6cc5('0x41')]=_0x121ad0[_0x6cc5('0x41')][_0x6cc5('0x42')]?_0x121ad0[_0x6cc5('0x41')]:_0x33ded6[_0x6cc5('0x3f')];if(_0x135e44[_0x6cc5('0x3b')][_0x6cc5('0x5e')]){_0x121ad0[_0x6cc5('0x4b')]=[{'all':!![]}];}_0x121ad0=_[_0x6cc5('0x49')]({},_0x121ad0,_0x135e44['options']);return db[_0x6cc5('0x36')][_0x6cc5('0x59')](_0x121ad0)[_0x6cc5('0x28')](handleEntityNotFound(_0x52ad39,null))[_0x6cc5('0x28')](function(_0x83c73){if(_0x83c73){var _0x51b872=_0x83c73[_0x6cc5('0x53')]({'plain':!![]});_0x51b872=qs[_0x6cc5('0x5f')](_0x51b872,['id',_0x6cc5('0x60'),_0x6cc5('0x61')]);_0x135e44['body']=_['omit'](_0x135e44[_0x6cc5('0x52')],['id','createdAt',_0x6cc5('0x61')]);return db[_0x6cc5('0x36')]['create'](_[_0x6cc5('0x49')](_0x51b872,_0x135e44['body']),{'include':_0x135e44[_0x6cc5('0x3b')][_0x6cc5('0x5e')]?[{'all':!![]}]:undefined})[_0x6cc5('0x28')](function(_0x5352dc){var _0x27ba3e=_0x135e44[_0x6cc5('0x56')]['get']({'plain':!![]});if(!_0x27ba3e)throw new Error(_0x6cc5('0x54'));if(_0x27ba3e[_0x6cc5('0x55')]===_0x6cc5('0x56')){var _0x4b6af2=_0x5352dc[_0x6cc5('0x53')]({'plain':!![]});var _0x45946e=[{'name':_0x6cc5('0x2a'),'value':_0x6cc5('0x2b')},{'name':_0x6cc5('0x2c'),'value':_0x6cc5('0x57')}];var _0x539d24=_['find'](_0x45946e,[_0x6cc5('0x2f'),_0x4b6af2[_0x6cc5('0x39')]])[_0x6cc5('0x31')];return db[_0x6cc5('0x58')][_0x6cc5('0x59')]({'where':{'name':_0x539d24,'userProfileId':_0x27ba3e[_0x6cc5('0x5a')]},'raw':!![]})[_0x6cc5('0x28')](function(_0x1c504c){if(_0x1c504c&&_0x1c504c[_0x6cc5('0x62')]===0x0){return db[_0x6cc5('0x5b')][_0x6cc5('0x51')]({'name':_0x4b6af2['name'],'resourceId':_0x4b6af2['id'],'type':_0x1c504c[_0x6cc5('0x31')],'sectionId':_0x1c504c['id']},{})[_0x6cc5('0x28')](function(){return _0x5352dc;});}else{return _0x5352dc;}})['catch'](function(_0x31404b){logger[_0x6cc5('0x32')](_0x6cc5('0x5c'),_0x31404b);throw _0x31404b;});}return _0x5352dc;});}})[_0x6cc5('0x28')](respondWithResult(_0x52ad39,0xc9))[_0x6cc5('0x4e')](handleError(_0x52ad39,null));};exports[_0x6cc5('0x27')]=function(_0x18cf41,_0x202674){if(_0x18cf41[_0x6cc5('0x52')]['id']){delete _0x18cf41[_0x6cc5('0x52')]['id'];}return db[_0x6cc5('0x36')]['find']({'where':{'id':_0x18cf41[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x202674,null))['then'](saveUpdates(_0x18cf41[_0x6cc5('0x52')],null))[_0x6cc5('0x28')](respondWithResult(_0x202674,null))[_0x6cc5('0x4e')](handleError(_0x202674,null));};exports[_0x6cc5('0x29')]=function(_0x2143e7,_0x26c5e4){return db[_0x6cc5('0x36')][_0x6cc5('0x59')]({'where':{'id':_0x2143e7[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x26c5e4,null))[_0x6cc5('0x28')](removeEntity(_0x26c5e4,null))['catch'](handleError(_0x26c5e4,null));};exports[_0x6cc5('0x63')]=function(_0x4fbd39,_0x1277bb,_0x223b78){var _0x596893={'raw':![],'where':{}};var _0x28127f={};var _0x1eed64={'count':0x0,'rows':[]};return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x4fbd39[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x1277bb,null))['then'](function(_0x46b288){if(_0x46b288){_0x28127f[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db[_0x6cc5('0x65')]['rawAttributes']);_0x28127f[_0x6cc5('0x3b')]=_[_0x6cc5('0x3c')](_0x4fbd39[_0x6cc5('0x3b')]);_0x28127f['filters']=_['intersection'](_0x28127f[_0x6cc5('0x3f')],_0x28127f[_0x6cc5('0x3b')]);_0x596893[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0x28127f['model'],qs[_0x6cc5('0x40')](_0x4fbd39[_0x6cc5('0x3b')][_0x6cc5('0x40')]));_0x596893[_0x6cc5('0x41')]=_0x596893['attributes']['length']?_0x596893[_0x6cc5('0x41')]:_0x28127f[_0x6cc5('0x3f')];if(!_0x4fbd39['query'][_0x6cc5('0x43')]('nolimit')){_0x596893['limit']=qs[_0x6cc5('0x22')](_0x4fbd39[_0x6cc5('0x3b')]['limit']);_0x596893[_0x6cc5('0x21')]=qs['offset'](_0x4fbd39[_0x6cc5('0x3b')]['offset']);}_0x596893[_0x6cc5('0x44')]=qs[_0x6cc5('0x45')](_0x4fbd39[_0x6cc5('0x3b')][_0x6cc5('0x45')]);_0x596893[_0x6cc5('0x46')]=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0x4fbd39[_0x6cc5('0x3b')],_0x28127f[_0x6cc5('0x3d')]));_0x596893[_0x6cc5('0x46')]['VoiceQueueId']=_0x46b288['id'];if(_0x4fbd39['query'][_0x6cc5('0x48')]){_0x596893[_0x6cc5('0x46')]=_[_0x6cc5('0x49')](_0x596893[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x596893[_0x6cc5('0x41')],function(_0x4e27c8){var _0x2626f0={};_0x2626f0[_0x4e27c8]={'$like':'%'+_0x4fbd39['query'][_0x6cc5('0x48')]+'%'};return _0x2626f0;})});}_0x596893=_[_0x6cc5('0x49')]({},_0x596893,_0x4fbd39['options']);return db['CmHopper'][_0x6cc5('0x20')]({'where':_0x596893[_0x6cc5('0x46')]})[_0x6cc5('0x28')](function(_0x5a428d){_0x1eed64[_0x6cc5('0x20')]=_0x5a428d;if(_0x4fbd39[_0x6cc5('0x3b')]['includeAll']){_0x596893[_0x6cc5('0x4b')]=[{'all':!![]}];}return db[_0x6cc5('0x65')][_0x6cc5('0x4c')](_0x596893);})[_0x6cc5('0x28')](function(_0x20a0b0){_0x1eed64[_0x6cc5('0x4d')]=_0x20a0b0;return _0x1eed64;});}})[_0x6cc5('0x28')](respondWithFilteredResult(_0x1277bb,_0x596893))[_0x6cc5('0x4e')](handleError(_0x1277bb,null));};exports[_0x6cc5('0x66')]=function(_0x2cbf4c,_0x41f95c,_0x1adb01){var _0x29b5c7={'raw':!![],'where':{}};var _0x2dca37={};var _0x234768={'count':0x0,'rows':[]};return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x2cbf4c[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x41f95c,null))[_0x6cc5('0x28')](function(_0x443b01){if(_0x443b01){_0x2dca37['model']=_[_0x6cc5('0x3c')](db[_0x6cc5('0x67')][_0x6cc5('0x37')]);_0x2dca37[_0x6cc5('0x3b')]=_[_0x6cc5('0x3c')](_0x2cbf4c[_0x6cc5('0x3b')]);_0x2dca37[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x2dca37[_0x6cc5('0x3f')],_0x2dca37[_0x6cc5('0x3b')]);_0x29b5c7['attributes']=_[_0x6cc5('0x3e')](_0x2dca37[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0x2cbf4c['query']['fields']));_0x29b5c7['attributes']=_0x29b5c7['attributes'][_0x6cc5('0x42')]?_0x29b5c7[_0x6cc5('0x41')]:_0x2dca37['model'];if(!_0x2cbf4c[_0x6cc5('0x3b')][_0x6cc5('0x43')]('nolimit')){_0x29b5c7[_0x6cc5('0x22')]=qs[_0x6cc5('0x22')](_0x2cbf4c[_0x6cc5('0x3b')]['limit']);_0x29b5c7[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x2cbf4c['query'][_0x6cc5('0x21')]);}_0x29b5c7[_0x6cc5('0x44')]=qs[_0x6cc5('0x45')](_0x2cbf4c['query'][_0x6cc5('0x45')]);_0x29b5c7['where']=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0x2cbf4c[_0x6cc5('0x3b')],_0x2dca37[_0x6cc5('0x3d')]));_0x29b5c7['where'][_0x6cc5('0x68')]=_0x443b01['id'];if(_0x2cbf4c[_0x6cc5('0x3b')][_0x6cc5('0x48')]){_0x29b5c7['where']=_['merge'](_0x29b5c7[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x29b5c7[_0x6cc5('0x41')],function(_0x4e4980){var _0x58818b={};_0x58818b[_0x4e4980]={'$like':'%'+_0x2cbf4c[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0x58818b;})});}_0x29b5c7=_['merge']({},_0x29b5c7,_0x2cbf4c['options']);return db[_0x6cc5('0x67')]['count']({'where':_0x29b5c7[_0x6cc5('0x46')]})[_0x6cc5('0x28')](function(_0x1ae7ce){_0x234768[_0x6cc5('0x20')]=_0x1ae7ce;if(_0x2cbf4c[_0x6cc5('0x3b')][_0x6cc5('0x5e')]){_0x29b5c7[_0x6cc5('0x4b')]=[{'all':!![]}];}return db[_0x6cc5('0x67')]['findAll'](_0x29b5c7);})['then'](function(_0x131960){_0x234768[_0x6cc5('0x4d')]=_0x131960;return _0x234768;});}})[_0x6cc5('0x28')](respondWithFilteredResult(_0x41f95c,_0x29b5c7))[_0x6cc5('0x4e')](handleError(_0x41f95c,null));};exports[_0x6cc5('0x69')]=function(_0xcb2a33,_0x315914,_0x4b0d56){var _0x14edde={'raw':!![],'where':{}};var _0x33fad3={};var _0x36efab={'count':0x0,'rows':[]};return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0xcb2a33[_0x6cc5('0x50')]['id']}})['then'](handleEntityNotFound(_0x315914,null))[_0x6cc5('0x28')](function(_0x22cae0){if(_0x22cae0){_0x33fad3[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db['CmHopperFinal']['rawAttributes']);_0x33fad3['query']=_['keys'](_0xcb2a33[_0x6cc5('0x3b')]);_0x33fad3[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x33fad3['model'],_0x33fad3[_0x6cc5('0x3b')]);_0x14edde['attributes']=_[_0x6cc5('0x3e')](_0x33fad3[_0x6cc5('0x3f')],qs['fields'](_0xcb2a33[_0x6cc5('0x3b')][_0x6cc5('0x40')]));_0x14edde[_0x6cc5('0x41')]=_0x14edde[_0x6cc5('0x41')]['length']?_0x14edde['attributes']:_0x33fad3['model'];if(!_0xcb2a33[_0x6cc5('0x3b')][_0x6cc5('0x43')](_0x6cc5('0x6a'))){_0x14edde['limit']=qs['limit'](_0xcb2a33[_0x6cc5('0x3b')][_0x6cc5('0x22')]);_0x14edde['offset']=qs[_0x6cc5('0x21')](_0xcb2a33[_0x6cc5('0x3b')]['offset']);}_0x14edde[_0x6cc5('0x44')]=qs['sort'](_0xcb2a33[_0x6cc5('0x3b')][_0x6cc5('0x45')]);_0x14edde[_0x6cc5('0x46')]=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0xcb2a33[_0x6cc5('0x3b')],_0x33fad3[_0x6cc5('0x3d')]));_0x14edde[_0x6cc5('0x46')]['VoiceQueueId']=_0x22cae0['id'];if(_0xcb2a33[_0x6cc5('0x3b')]['filter']){_0x14edde['where']=_[_0x6cc5('0x49')](_0x14edde[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x14edde[_0x6cc5('0x41')],function(_0x446c03){var _0xfd149a={};_0xfd149a[_0x446c03]={'$like':'%'+_0xcb2a33[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0xfd149a;})});}_0x14edde=_[_0x6cc5('0x49')]({},_0x14edde,_0xcb2a33[_0x6cc5('0x4a')]);return db['CmHopperFinal'][_0x6cc5('0x20')]({'where':_0x14edde[_0x6cc5('0x46')]})[_0x6cc5('0x28')](function(_0x3372c3){_0x36efab[_0x6cc5('0x20')]=_0x3372c3;if(_0xcb2a33[_0x6cc5('0x3b')][_0x6cc5('0x5e')]){_0x14edde[_0x6cc5('0x4b')]=[{'all':!![]}];}return db[_0x6cc5('0x6b')][_0x6cc5('0x4c')](_0x14edde);})[_0x6cc5('0x28')](function(_0x3372a0){_0x36efab[_0x6cc5('0x4d')]=_0x3372a0;return _0x36efab;});}})['then'](respondWithFilteredResult(_0x315914,_0x14edde))['catch'](handleError(_0x315914,null));};exports[_0x6cc5('0x6c')]=function(_0x39c2bc,_0x22564b,_0x123628){var _0x23227e={'raw':!![],'where':{}};var _0x28174d={};var _0x5aea9e={'count':0x0,'rows':[]};return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x39c2bc[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x22564b,null))[_0x6cc5('0x28')](function(_0x35024e){if(_0x35024e){_0x28174d[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db[_0x6cc5('0x6d')][_0x6cc5('0x37')]);_0x28174d[_0x6cc5('0x3b')]=_[_0x6cc5('0x3c')](_0x39c2bc[_0x6cc5('0x3b')]);_0x28174d[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x28174d[_0x6cc5('0x3f')],_0x28174d[_0x6cc5('0x3b')]);_0x23227e[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0x28174d[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x40')]));_0x23227e[_0x6cc5('0x41')]=_0x23227e['attributes'][_0x6cc5('0x42')]?_0x23227e[_0x6cc5('0x41')]:_0x28174d[_0x6cc5('0x3f')];if(!_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x43')](_0x6cc5('0x6a'))){_0x23227e[_0x6cc5('0x22')]=qs['limit'](_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x22')]);_0x23227e[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x21')]);}_0x23227e[_0x6cc5('0x44')]=qs[_0x6cc5('0x45')](_0x39c2bc[_0x6cc5('0x3b')]['sort']);_0x23227e[_0x6cc5('0x46')]=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0x39c2bc[_0x6cc5('0x3b')],_0x28174d[_0x6cc5('0x3d')]));_0x23227e['where'][_0x6cc5('0x68')]=_0x35024e['id'];if(_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x48')]){_0x23227e['where']=_[_0x6cc5('0x49')](_0x23227e[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x23227e['attributes'],function(_0x1dfa7c){var _0x301811={};_0x301811[_0x1dfa7c]={'$like':'%'+_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0x301811;})});}_0x23227e=_['merge']({},_0x23227e,_0x39c2bc[_0x6cc5('0x4a')]);return db[_0x6cc5('0x6d')]['count']({'where':_0x23227e[_0x6cc5('0x46')]})[_0x6cc5('0x28')](function(_0xac10ad){_0x5aea9e['count']=_0xac10ad;if(_0x39c2bc[_0x6cc5('0x3b')][_0x6cc5('0x5e')]){_0x23227e[_0x6cc5('0x4b')]=[{'all':!![]}];}return db[_0x6cc5('0x6d')][_0x6cc5('0x4c')](_0x23227e);})[_0x6cc5('0x28')](function(_0x2b6d4d){_0x5aea9e['rows']=_0x2b6d4d;return _0x5aea9e;});}})[_0x6cc5('0x28')](respondWithFilteredResult(_0x22564b,_0x23227e))[_0x6cc5('0x4e')](handleError(_0x22564b,null));};exports[_0x6cc5('0x6e')]=function(_0x35b00f,_0xd25bd2,_0x50533f){var _0x5e613a={};var _0xed99d0={};var _0x55a96f;var _0x2a6ba8;return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x35b00f[_0x6cc5('0x50')]['id']}})['then'](handleEntityNotFound(_0xd25bd2,null))[_0x6cc5('0x28')](function(_0x215a3c){if(_0x215a3c){_0x55a96f=_0x215a3c;_0xed99d0[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db[_0x6cc5('0x6f')][_0x6cc5('0x37')]);_0xed99d0[_0x6cc5('0x3b')]=_['keys'](_0x35b00f[_0x6cc5('0x3b')]);_0xed99d0['filters']=_['intersection'](_0xed99d0[_0x6cc5('0x3f')],_0xed99d0[_0x6cc5('0x3b')]);_0x5e613a[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0xed99d0[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0x35b00f[_0x6cc5('0x3b')][_0x6cc5('0x40')]));_0x5e613a[_0x6cc5('0x41')]=_0x5e613a[_0x6cc5('0x41')][_0x6cc5('0x42')]?_0x5e613a['attributes']:_0xed99d0[_0x6cc5('0x3f')];_0x5e613a[_0x6cc5('0x44')]=qs['sort'](_0x35b00f[_0x6cc5('0x3b')][_0x6cc5('0x45')]);_0x5e613a[_0x6cc5('0x46')]=qs['filters'](_[_0x6cc5('0x47')](_0x35b00f[_0x6cc5('0x3b')],_0xed99d0['filters']));if(_0x35b00f[_0x6cc5('0x3b')]['filter']){_0x5e613a['where']=_['merge'](_0x5e613a[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x5e613a[_0x6cc5('0x41')],function(_0x4b7f5d){var _0x365631={};_0x365631[_0x4b7f5d]={'$like':'%'+_0x35b00f[_0x6cc5('0x3b')]['filter']+'%'};return _0x365631;})});}_0x5e613a=_['merge']({},_0x5e613a,_0x35b00f['options']);return _0x55a96f[_0x6cc5('0x6e')](_0x5e613a);}})[_0x6cc5('0x28')](function(_0xcb9e7f){if(_0xcb9e7f){_0x2a6ba8=_0xcb9e7f['length'];if(!_0x35b00f['query'][_0x6cc5('0x43')](_0x6cc5('0x6a'))){_0x5e613a['limit']=qs[_0x6cc5('0x22')](_0x35b00f[_0x6cc5('0x3b')]['limit']);_0x5e613a[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x35b00f['query']['offset']);}return _0x55a96f[_0x6cc5('0x6e')](_0x5e613a);}})[_0x6cc5('0x28')](function(_0xebc8f6){if(_0xebc8f6){return _0xebc8f6?{'count':_0x2a6ba8,'rows':_0xebc8f6}:null;}})[_0x6cc5('0x28')](respondWithResult(_0xd25bd2,null))[_0x6cc5('0x4e')](handleError(_0xd25bd2,null));};exports[_0x6cc5('0x70')]=function(_0x2f1459,_0x46208e,_0x164f3a){var _0x41974e=_0x2f1459[_0x6cc5('0x52')][_0x6cc5('0x71')];var _0x42068c=_[_0x6cc5('0x2e')](_0x41974e,'id');return db[_0x6cc5('0x6f')][_0x6cc5('0x4c')]({'where':{'id':_0x42068c},'attributes':['id'],'include':[{'model':db[_0x6cc5('0x72')],'as':_0x6cc5('0x73'),'attributes':['id',_0x6cc5('0x31'),_0x6cc5('0x74'),_0x6cc5('0x75'),_0x6cc5('0x76')],'raw':!![]}]})['then'](function(_0x3ed641){if(_0x3ed641){var _0x35b341=_[_0x6cc5('0x77')](_0x3ed641,function(_0x245c89){var _0x77e91a=_0x245c89['get']({'plain':!![]});_0x77e91a['Agents'][_0x6cc5('0x78')](function(_0x1e7841){_0x1e7841[_0x6cc5('0x79')]=_[_0x6cc5('0x59')](_0x41974e,{'id':_0x77e91a['id']})[_0x6cc5('0x79')];});return _0x77e91a[_0x6cc5('0x73')];});return db[_0x6cc5('0x36')]['find']({'where':{'id':_0x2f1459[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](function(_0x4d928f){return db[_0x6cc5('0x7a')][_0x6cc5('0x7b')](function(_0x379f87){return _0x4d928f[_0x6cc5('0x70')](_0x42068c,{'transaction':_0x379f87})[_0x6cc5('0x28')](function(){return BPromise[_0x6cc5('0x7c')](_0x35b341,function(_0x39f36b){return db[_0x6cc5('0x7d')][_0x6cc5('0x7e')]({'where':{'UserId':_0x39f36b['id'],'VoiceQueueId':_0x2f1459[_0x6cc5('0x50')]['id']},'defaults':{'penalty':_0x39f36b[_0x6cc5('0x79')]},'transaction':_0x379f87});});})[_0x6cc5('0x28')](function(){return BPromise[_0x6cc5('0x7c')](_[_0x6cc5('0x48')](_0x35b341,{'online':!![]}),function(_0x273b5a){return db['UserVoiceQueueRt']['upsert']({'membername':_0x273b5a[_0x6cc5('0x31')],'UserId':_0x273b5a['id'],'queue_name':_0x4d928f['name'],'VoiceQueueId':_0x4d928f['id'],'interface':_[_0x6cc5('0x7f')](_0x273b5a[_0x6cc5('0x76')])?util[_0x6cc5('0x80')](_0x6cc5('0x81'),_0x273b5a['name']):_0x273b5a[_0x6cc5('0x76')],'paused':_0x273b5a[_0x6cc5('0x75')]||![],'penalty':_0x273b5a[_0x6cc5('0x79')]},{'transaction':_0x379f87});});})['then'](function(){_0x35b341[_0x6cc5('0x78')](function(_0x4b4e11){socket[_0x6cc5('0x82')](_0x6cc5('0x83'),{'UserId':_0x4b4e11['id'],'VoiceQueueId':_0x4d928f['id']});});});});});}})[_0x6cc5('0x28')](respondWithStatusCode(_0x46208e,null))[_0x6cc5('0x4e')](handleError(_0x46208e,null));};exports[_0x6cc5('0x84')]=function(_0x4b04e4,_0x2fca6b,_0x54eda7){return db[_0x6cc5('0x6f')]['findAll']({'where':{'id':_0x4b04e4[_0x6cc5('0x3b')][_0x6cc5('0x85')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6cc5('0x73'),'attributes':['id'],'raw':!![]}]})[_0x6cc5('0x28')](handleEntityNotFound(_0x2fca6b,null))[_0x6cc5('0x28')](function(_0x4e8440){var _0x43082d=_[_0x6cc5('0x2e')](_0x4e8440,'id');var _0x2c9ddf=[];var _0x15d8e8=[];var _0x560b0f=squel[_0x6cc5('0x86')]();_0x560b0f[_0x6cc5('0x87')](_0x6cc5('0x88'))[_0x6cc5('0x89')]('team_has_voice_queues','tq')[_0x6cc5('0x8a')](_0x6cc5('0x8b'),'ut',_0x6cc5('0x8c'))[_0x6cc5('0x46')]('VoiceQueueId\x20=\x20?',_0x4b04e4['params']['id']);for(var _0x55b916=0x0;_0x55b916<_0x4e8440['length'];_0x55b916+=0x1){let _0x456968=_0x4e8440[_0x55b916];for(var _0x37dcb0=0x0;_0x37dcb0<_0x456968[_0x6cc5('0x73')][_0x6cc5('0x42')];_0x37dcb0+=0x1){let _0xe9da10=_0x456968[_0x6cc5('0x73')][_0x37dcb0];var _0x5b8897=_0x560b0f[_0x6cc5('0x5d')]();_0x5b8897[_0x6cc5('0x46')](_0x6cc5('0x8d'),_0xe9da10['id']);_0x15d8e8[_0x6cc5('0x8e')](db[_0x6cc5('0x7a')][_0x6cc5('0x3b')](_0x5b8897['toString'](),{'type':db[_0x6cc5('0x7a')][_0x6cc5('0x8f')][_0x6cc5('0x90')]})[_0x6cc5('0x28')](function(_0x50754c){if(_0x50754c[_0x6cc5('0x42')]===0x1){return _0xe9da10['id'];}else{var _0x5aa275=_[_0x6cc5('0x91')](_[_0x6cc5('0x2e')](_0x50754c,_0x6cc5('0x92')),function(_0xfddf17){return _[_0x6cc5('0x30')](_0x43082d,_0xfddf17);});if(_0x5aa275){return _0xe9da10['id'];}}}));}}return BPromise[_0x6cc5('0x93')](_0x15d8e8)[_0x6cc5('0x28')](function(_0x3fe767){_0x2c9ddf=_(_0x2c9ddf)[_0x6cc5('0x94')](_0x3fe767)[_0x6cc5('0x95')]()[_0x6cc5('0x2f')]();return db[_0x6cc5('0x36')]['find']({'where':{'id':_0x4b04e4[_0x6cc5('0x50')]['id']}})['then'](function(_0x4c1bbd){return db[_0x6cc5('0x7a')]['transaction'](function(_0x581e17){return _0x4c1bbd[_0x6cc5('0x84')](_0x4b04e4[_0x6cc5('0x3b')][_0x6cc5('0x85')],{'transaction':_0x581e17})[_0x6cc5('0x28')](function(){if(!_[_0x6cc5('0x96')](_0x2c9ddf)){return _0x4c1bbd[_0x6cc5('0x97')](_0x2c9ddf,{'transaction':_0x581e17})[_0x6cc5('0x28')](function(){return db[_0x6cc5('0x98')][_0x6cc5('0x29')]({'where':{'VoiceQueueId':_0x4b04e4[_0x6cc5('0x50')]['id'],'UserId':_0x2c9ddf},'transaction':_0x581e17});});}})[_0x6cc5('0x28')](function(){_0x2c9ddf['forEach'](function(_0x1393c5){socket[_0x6cc5('0x82')](_0x6cc5('0x99'),{'UserId':_0x1393c5,'VoiceQueueId':_0x4c1bbd['id']});});});});});});})['then'](respondWithStatusCode(_0x2fca6b,null))[_0x6cc5('0x4e')](handleError(_0x2fca6b,null));};exports['addAgents']=function(_0x16fd66,_0x39e284,_0x2b5509){var _0x11c1e3,_0x15538d;return db['VoiceQueue'][_0x6cc5('0x59')]({'where':{'id':_0x16fd66[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x39e284,null))[_0x6cc5('0x28')](function(_0x1e96e3){if(_0x1e96e3){_0x15538d=_0x1e96e3;return _0x1e96e3[_0x6cc5('0x9a')](_0x16fd66['body'][_0x6cc5('0x85')],_[_0x6cc5('0x5f')](_0x16fd66['body'],[_0x6cc5('0x85'),'id'])||{})[_0x6cc5('0x9b')](function(_0x25af88){for(var _0x163492=0x0;_0x163492<_0x16fd66[_0x6cc5('0x52')][_0x6cc5('0x85')][_0x6cc5('0x42')];_0x163492+=0x1){socket[_0x6cc5('0x82')](_0x6cc5('0x83'),{'UserId':_0x16fd66[_0x6cc5('0x52')][_0x6cc5('0x85')][_0x163492],'VoiceQueueId':_0x16fd66['params']['id']});}return _0x25af88;});}})['then'](function(_0x43707d){_0x11c1e3=_0x43707d||[];if(_0x15538d){return db[_0x6cc5('0x72')][_0x6cc5('0x4c')]({'where':{'id':_0x16fd66['body'][_0x6cc5('0x85')]},'attributes':['id','name',_0x6cc5('0x74'),_0x6cc5('0x75'),_0x6cc5('0x76')],'raw':!![]});}})[_0x6cc5('0x28')](function(_0xd1527a){if(!_[_0x6cc5('0x96')](_0xd1527a)){var _0x1a8a6f=[];for(var _0x15eaa7=0x0;_0x15eaa7<_0xd1527a['length'];_0x15eaa7++){if(_0xd1527a[_0x15eaa7]['online']){_0x1a8a6f['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xd1527a[_0x15eaa7]['name'],'UserId':_0xd1527a[_0x15eaa7]['id'],'queue_name':_0x15538d['name'],'VoiceQueueId':_0x15538d['id'],'interface':_[_0x6cc5('0x7f')](_0xd1527a[_0x15eaa7][_0x6cc5('0x76')])?util[_0x6cc5('0x80')]('SIP/%s',_0xd1527a[_0x15eaa7][_0x6cc5('0x31')]):_0xd1527a[_0x15eaa7]['interface'],'paused':_0xd1527a[_0x15eaa7][_0x6cc5('0x75')]||![],'penalty':_0x16fd66['body']['penalty']||0x0}));}}return BPromise[_0x6cc5('0x93')](_0x1a8a6f);}})[_0x6cc5('0x28')](function(){return _0x11c1e3;})[_0x6cc5('0x28')](respondWithResult(_0x39e284,null))['catch'](handleError(_0x39e284,null));};exports[_0x6cc5('0x97')]=function(_0x522c65,_0x497490,_0x3d5b7c){return db[_0x6cc5('0x36')][_0x6cc5('0x59')]({'where':{'id':_0x522c65[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x497490,null))[_0x6cc5('0x28')](function(_0x56a9f2){if(_0x56a9f2){return _0x56a9f2[_0x6cc5('0x97')](_0x522c65[_0x6cc5('0x3b')][_0x6cc5('0x85')])[_0x6cc5('0x28')](function(){if(_['isArray'](_0x522c65['query'][_0x6cc5('0x85')])){for(var _0x1d270f=0x0;_0x1d270f<_0x522c65[_0x6cc5('0x3b')][_0x6cc5('0x85')][_0x6cc5('0x42')];_0x1d270f+=0x1){socket[_0x6cc5('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0x522c65['query'][_0x6cc5('0x85')][_0x1d270f]),'VoiceQueueId':Number(_0x522c65[_0x6cc5('0x50')]['id'])});}}else{socket['emit'](_0x6cc5('0x99'),{'UserId':Number(_0x522c65['query'][_0x6cc5('0x85')]),'VoiceQueueId':Number(_0x522c65[_0x6cc5('0x50')]['id'])});}});}})[_0x6cc5('0x28')](function(_0x420290){return db[_0x6cc5('0x98')][_0x6cc5('0x29')]({'where':{'VoiceQueueId':_0x522c65[_0x6cc5('0x50')]['id'],'UserId':_0x522c65[_0x6cc5('0x3b')][_0x6cc5('0x85')]}})['then'](function(){return _0x420290;});})[_0x6cc5('0x28')](respondWithStatusCode(_0x497490,null))['catch'](handleError(_0x497490,null));};exports[_0x6cc5('0x9c')]=function(_0x44b9cd,_0x2cbd11,_0x5b90e7){var _0x2ff3d1={};var _0x41ac65={};var _0x4c232c;var _0x40b753;return db[_0x6cc5('0x36')]['findOne']({'where':{'id':_0x44b9cd[_0x6cc5('0x50')]['id']}})['then'](handleEntityNotFound(_0x2cbd11,null))[_0x6cc5('0x28')](function(_0x3a7c22){if(_0x3a7c22){_0x4c232c=_0x3a7c22;_0x41ac65[_0x6cc5('0x3f')]=_['keys'](db['User'][_0x6cc5('0x37')]);_0x41ac65['query']=_[_0x6cc5('0x3c')](_0x44b9cd[_0x6cc5('0x3b')]);_0x41ac65[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x41ac65[_0x6cc5('0x3f')],_0x41ac65[_0x6cc5('0x3b')]);_0x2ff3d1[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0x41ac65[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0x44b9cd['query']['fields']));_0x2ff3d1[_0x6cc5('0x41')]=_0x2ff3d1[_0x6cc5('0x41')][_0x6cc5('0x42')]?_0x2ff3d1['attributes']:_0x41ac65[_0x6cc5('0x3f')];_0x2ff3d1['order']=qs[_0x6cc5('0x45')](_0x44b9cd[_0x6cc5('0x3b')]['sort']);_0x2ff3d1[_0x6cc5('0x46')]=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0x44b9cd[_0x6cc5('0x3b')],_0x41ac65['filters']));if(_0x44b9cd['query'][_0x6cc5('0x48')]){_0x2ff3d1[_0x6cc5('0x46')]=_[_0x6cc5('0x49')](_0x2ff3d1['where'],{'$or':_[_0x6cc5('0x2e')](_0x2ff3d1[_0x6cc5('0x41')],function(_0x30abab){var _0x1a0c8b={};_0x1a0c8b[_0x30abab]={'$like':'%'+_0x44b9cd[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0x1a0c8b;})});}_0x2ff3d1=_[_0x6cc5('0x49')]({},_0x2ff3d1,_0x44b9cd['options']);return _0x4c232c[_0x6cc5('0x9c')](_0x2ff3d1);}})[_0x6cc5('0x28')](function(_0x78417b){if(_0x78417b){_0x40b753=_0x78417b[_0x6cc5('0x42')];if(!_0x44b9cd[_0x6cc5('0x3b')][_0x6cc5('0x43')](_0x6cc5('0x6a'))){_0x2ff3d1[_0x6cc5('0x22')]=qs['limit'](_0x44b9cd[_0x6cc5('0x3b')]['limit']);_0x2ff3d1[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x44b9cd[_0x6cc5('0x3b')][_0x6cc5('0x21')]);}return _0x4c232c[_0x6cc5('0x9c')](_0x2ff3d1);}})[_0x6cc5('0x28')](function(_0x3de68c){if(_0x3de68c){return _0x3de68c?{'count':_0x40b753,'rows':_0x3de68c}:null;}})['then'](respondWithResult(_0x2cbd11,null))[_0x6cc5('0x4e')](handleError(_0x2cbd11,null));};exports[_0x6cc5('0x9d')]=function(_0x108f3a,_0x9ee269,_0x2180bf){var _0x286619={};var _0x4932ea={};var _0x447363;var _0x449be9;return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x108f3a[_0x6cc5('0x50')]['id']}})['then'](handleEntityNotFound(_0x9ee269,null))[_0x6cc5('0x28')](function(_0x2dcd8e){if(_0x2dcd8e){_0x447363=_0x2dcd8e;_0x4932ea['model']=_[_0x6cc5('0x3c')](db[_0x6cc5('0x98')][_0x6cc5('0x37')]);_0x4932ea[_0x6cc5('0x3b')]=_['keys'](_0x108f3a[_0x6cc5('0x3b')]);_0x4932ea[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x4932ea[_0x6cc5('0x3f')],_0x4932ea[_0x6cc5('0x3b')]);_0x286619['attributes']=_[_0x6cc5('0x3e')](_0x4932ea[_0x6cc5('0x3f')],qs['fields'](_0x108f3a['query']['fields']));_0x286619[_0x6cc5('0x41')]=_0x286619[_0x6cc5('0x41')][_0x6cc5('0x42')]?_0x286619[_0x6cc5('0x41')]:_0x4932ea[_0x6cc5('0x3f')];_0x286619[_0x6cc5('0x44')]=qs['sort'](_0x108f3a[_0x6cc5('0x3b')]['sort']);_0x286619[_0x6cc5('0x46')]=qs[_0x6cc5('0x3d')](_['pick'](_0x108f3a['query'],_0x4932ea[_0x6cc5('0x3d')]));if(_0x108f3a['query'][_0x6cc5('0x48')]){_0x286619[_0x6cc5('0x46')]=_[_0x6cc5('0x49')](_0x286619[_0x6cc5('0x46')],{'$or':_[_0x6cc5('0x2e')](_0x286619['attributes'],function(_0x588874){var _0x3f2a36={};_0x3f2a36[_0x588874]={'$like':'%'+_0x108f3a[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0x3f2a36;})});}_0x286619=_[_0x6cc5('0x49')]({},_0x286619,_0x108f3a['options']);return _0x447363[_0x6cc5('0x9d')](_0x286619);}})[_0x6cc5('0x28')](function(_0x2f680f){if(_0x2f680f){_0x449be9=_0x2f680f[_0x6cc5('0x42')];if(!_0x108f3a['query'][_0x6cc5('0x43')]('nolimit')){_0x286619[_0x6cc5('0x22')]=qs[_0x6cc5('0x22')](_0x108f3a['query'][_0x6cc5('0x22')]);_0x286619[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x108f3a[_0x6cc5('0x3b')]['offset']);}return _0x447363[_0x6cc5('0x9d')](_0x286619);}})[_0x6cc5('0x28')](function(_0x3c3907){return _0x3c3907?{'count':_0x449be9,'rows':_0x3c3907}:null;})[_0x6cc5('0x28')](respondWithResult(_0x9ee269,null))['catch'](handleError(_0x9ee269,null));};exports[_0x6cc5('0x9e')]=function(_0x480c0b,_0x4acd2f,_0x42e921){var _0x1996b0={};var _0x5e1ac9={};var _0x11d65f;var _0x4a94c2;return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x480c0b['params']['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x4acd2f,null))['then'](function(_0x2d3e7){if(_0x2d3e7){_0x11d65f=_0x2d3e7;_0x5e1ac9[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db[_0x6cc5('0x9f')][_0x6cc5('0x37')]);_0x5e1ac9['query']=_[_0x6cc5('0x3c')](_0x480c0b[_0x6cc5('0x3b')]);_0x5e1ac9[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x5e1ac9[_0x6cc5('0x3f')],_0x5e1ac9['query']);_0x1996b0[_0x6cc5('0x41')]=_['intersection'](_0x5e1ac9[_0x6cc5('0x3f')],qs[_0x6cc5('0x40')](_0x480c0b['query'][_0x6cc5('0x40')]));_0x1996b0[_0x6cc5('0x41')]=_0x1996b0[_0x6cc5('0x41')]['length']?_0x1996b0['attributes']:_0x5e1ac9[_0x6cc5('0x3f')];_0x1996b0[_0x6cc5('0x44')]=qs[_0x6cc5('0x45')](_0x480c0b[_0x6cc5('0x3b')][_0x6cc5('0x45')]);_0x1996b0['where']=qs[_0x6cc5('0x3d')](_[_0x6cc5('0x47')](_0x480c0b[_0x6cc5('0x3b')],_0x5e1ac9['filters']));if(_0x480c0b[_0x6cc5('0x3b')][_0x6cc5('0x48')]){_0x1996b0['where']=_[_0x6cc5('0x49')](_0x1996b0['where'],{'$or':_['map'](_0x1996b0['attributes'],function(_0x34f7d7){var _0x37a781={};_0x37a781[_0x34f7d7]={'$like':'%'+_0x480c0b['query'][_0x6cc5('0x48')]+'%'};return _0x37a781;})});}_0x1996b0=_['merge']({},_0x1996b0,_0x480c0b[_0x6cc5('0x4a')]);return _0x11d65f[_0x6cc5('0x9e')](_0x1996b0);}})[_0x6cc5('0x28')](function(_0x138ec9){if(_0x138ec9){_0x4a94c2=_0x138ec9[_0x6cc5('0x42')];if(!_0x480c0b[_0x6cc5('0x3b')][_0x6cc5('0x43')](_0x6cc5('0x6a'))){_0x1996b0[_0x6cc5('0x22')]=qs[_0x6cc5('0x22')](_0x480c0b[_0x6cc5('0x3b')][_0x6cc5('0x22')]);_0x1996b0[_0x6cc5('0x21')]=qs[_0x6cc5('0x21')](_0x480c0b[_0x6cc5('0x3b')][_0x6cc5('0x21')]);}return _0x11d65f[_0x6cc5('0x9e')](_0x1996b0);}})[_0x6cc5('0x28')](function(_0x4d966b){if(_0x4d966b){return _0x4d966b?{'count':_0x4a94c2,'rows':_0x4d966b}:null;}})[_0x6cc5('0x28')](respondWithResult(_0x4acd2f,null))['catch'](handleError(_0x4acd2f,null));};exports[_0x6cc5('0xa0')]=function(_0x33099e,_0x4ecc75,_0x3f17b4){var _0x101575,_0x48707e;return db[_0x6cc5('0x36')][_0x6cc5('0x59')]({'where':{'id':_0x33099e[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x4ecc75,null))[_0x6cc5('0x28')](function(_0x114a56){if(_0x114a56){_0x48707e=_0x114a56;return _0x114a56['addLists'](_0x33099e[_0x6cc5('0x52')][_0x6cc5('0x85')],_['omit'](_0x33099e[_0x6cc5('0x52')],[_0x6cc5('0x85'),'id'])||{});}return null;})[_0x6cc5('0x9b')](function(_0xf32d18){var _0x4300eb;_0x101575=_0xf32d18||[];var _0x1173f8=[];if(_0xf32d18){for(var _0x3ddafe=0x0;_0x3ddafe<_0xf32d18[_0x6cc5('0x42')];_0x3ddafe+=0x1){var _0xf1f688=_0xf32d18[_0x3ddafe][_0x6cc5('0x53')]({'plain':!![]});_0x48707e[_0x6cc5('0xa1')]=_0x33099e[_0x6cc5('0x52')][_0x6cc5('0xa1')]?_0x33099e[_0x6cc5('0x52')]['dialCheckDuplicateType']:_0x48707e[_0x6cc5('0xa1')];switch(_0x48707e[_0x6cc5('0xa1')]){case _0x6cc5('0xa2'):_0x4300eb=squel[_0x6cc5('0xa3')]()[_0x6cc5('0xa4')](_0x6cc5('0xa5'))[_0x6cc5('0xa6')]([_0x6cc5('0xa7'),'scheduledAt','ContactId',_0x6cc5('0xa8'),'VoiceQueueId',_0x6cc5('0x60'),_0x6cc5('0x61')],squel[_0x6cc5('0x86')]()[_0x6cc5('0x87')](_0x6cc5('0xa7'),'phone')[_0x6cc5('0x87')](_0x6cc5('0xa9'),_0x6cc5('0xaa'))[_0x6cc5('0x87')]('id',_0x6cc5('0xab'))[_0x6cc5('0x87')](_0xf1f688['CmListId'][_0x6cc5('0xac')](),_0x6cc5('0xa8'))[_0x6cc5('0x87')](_0x33099e[_0x6cc5('0x50')]['id']['toString'](),_0x6cc5('0x68'))[_0x6cc5('0x87')](_0x6cc5('0xa9'),'createdAt')[_0x6cc5('0x87')]('NOW()',_0x6cc5('0x61'))[_0x6cc5('0x89')](_0x6cc5('0xad'))['where'](_0x6cc5('0xae'))[_0x6cc5('0x46')](_0x6cc5('0xaf'),_0xf1f688['CmListId'][_0x6cc5('0xac')]())[_0x6cc5('0x46')](_0x6cc5('0xb0'))['where'](_0x6cc5('0xb1'),squel[_0x6cc5('0x86')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x6cc5('0xb2'))[_0x6cc5('0x46')](_0x6cc5('0xb3'),_0x33099e[_0x6cc5('0x50')]['id'][_0x6cc5('0xac')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6cc5('0x86')]()[_0x6cc5('0x87')](_0x6cc5('0xb4'))[_0x6cc5('0x89')](_0x6cc5('0xa5'))[_0x6cc5('0x46')](_0x6cc5('0xb3'),_0x33099e[_0x6cc5('0x50')]['id']['toString']())))[_0x6cc5('0xac')]();break;case'onlyIfOpen':_0x4300eb=squel[_0x6cc5('0xa3')]()[_0x6cc5('0xa4')](_0x6cc5('0xa5'))[_0x6cc5('0xa6')]([_0x6cc5('0xa7'),_0x6cc5('0xaa'),_0x6cc5('0xab'),_0x6cc5('0xa8'),'VoiceQueueId','createdAt',_0x6cc5('0x61')],squel[_0x6cc5('0x86')]()[_0x6cc5('0x87')](_0x6cc5('0xa7'),_0x6cc5('0xa7'))[_0x6cc5('0x87')]('NOW()','scheduledAt')[_0x6cc5('0x87')]('id','ContactId')[_0x6cc5('0x87')](_0xf1f688[_0x6cc5('0xb5')]['toString'](),_0x6cc5('0xa8'))[_0x6cc5('0x87')](_0x33099e[_0x6cc5('0x50')]['id']['toString'](),_0x6cc5('0x68'))[_0x6cc5('0x87')](_0x6cc5('0xa9'),_0x6cc5('0x60'))[_0x6cc5('0x87')]('NOW()',_0x6cc5('0x61'))[_0x6cc5('0x89')]('cm_contacts')[_0x6cc5('0x46')](_0x6cc5('0xae'))[_0x6cc5('0x46')](_0x6cc5('0xaf'),_0xf1f688[_0x6cc5('0xb5')][_0x6cc5('0xac')]())[_0x6cc5('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x6cc5('0x46')](_0x6cc5('0xb1'),squel[_0x6cc5('0x86')]()[_0x6cc5('0x87')](_0x6cc5('0xb4'))['from']('cm_hopper')[_0x6cc5('0x46')](_0x6cc5('0xb3'),_0x33099e[_0x6cc5('0x50')]['id'][_0x6cc5('0xac')]())))[_0x6cc5('0xac')]();break;default:_0x4300eb=squel['insert']()[_0x6cc5('0xa4')](_0x6cc5('0xa5'))['fromQuery']([_0x6cc5('0xa7'),_0x6cc5('0xaa'),'ContactId',_0x6cc5('0xa8'),'VoiceQueueId',_0x6cc5('0x60'),_0x6cc5('0x61')],squel[_0x6cc5('0x86')]()['field'](_0x6cc5('0xa7'),_0x6cc5('0xa7'))[_0x6cc5('0x87')](_0x6cc5('0xa9'),_0x6cc5('0xaa'))[_0x6cc5('0x87')]('id','ContactId')[_0x6cc5('0x87')](_0xf1f688[_0x6cc5('0xb5')][_0x6cc5('0xac')](),'ListId')[_0x6cc5('0x87')](_0x33099e[_0x6cc5('0x50')]['id']['toString'](),_0x6cc5('0x68'))[_0x6cc5('0x87')](_0x6cc5('0xa9'),_0x6cc5('0x60'))[_0x6cc5('0x87')](_0x6cc5('0xa9'),_0x6cc5('0x61'))[_0x6cc5('0x89')]('cm_contacts')[_0x6cc5('0x46')](_0x6cc5('0xae'))[_0x6cc5('0x46')](_0x6cc5('0xaf'),_0xf1f688['CmListId'][_0x6cc5('0xac')]())[_0x6cc5('0x46')](_0x6cc5('0xb0')))[_0x6cc5('0xac')]();}_0x1173f8['push'](db[_0x6cc5('0x7a')][_0x6cc5('0x3b')](_0x4300eb));}return BPromise[_0x6cc5('0x93')](_0x1173f8);}})[_0x6cc5('0x28')](function(){return _0x101575;})[_0x6cc5('0x28')](respondWithResult(_0x4ecc75,null))['catch'](handleError(_0x4ecc75,null));};exports['removeLists']=function(_0x2620a0,_0x948a31,_0x3898a6){return db['VoiceQueue'][_0x6cc5('0x59')]({'where':{'id':_0x2620a0[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x948a31,null))[_0x6cc5('0x28')](function(_0x55779e){if(_0x55779e){return _0x55779e[_0x6cc5('0xb6')](_0x2620a0[_0x6cc5('0x3b')][_0x6cc5('0x85')]);}})['then'](function(_0x4b042c){if(_0x4b042c){return db[_0x6cc5('0x65')][_0x6cc5('0x29')]({'where':{'ListId':_0x2620a0[_0x6cc5('0x3b')][_0x6cc5('0x85')],'VoiceQueueId':_0x2620a0['params']['id']}})[_0x6cc5('0x28')](function(){return _0x4b042c;});}})[_0x6cc5('0x28')](respondWithStatusCode(_0x948a31,null))[_0x6cc5('0x4e')](handleError(_0x948a31,null));};exports[_0x6cc5('0xb7')]=function(_0x1bb318,_0x243b23,_0x12f290){var _0x24527e={};var _0x57e31b={};var _0x1836b9;var _0x1d7cdc;return db[_0x6cc5('0x36')][_0x6cc5('0x64')]({'where':{'id':_0x1bb318[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x243b23,null))[_0x6cc5('0x28')](function(_0x14b2ed){if(_0x14b2ed){_0x1836b9=_0x14b2ed;_0x57e31b[_0x6cc5('0x3f')]=_[_0x6cc5('0x3c')](db[_0x6cc5('0x9f')]['rawAttributes']);_0x57e31b[_0x6cc5('0x3b')]=_['keys'](_0x1bb318[_0x6cc5('0x3b')]);_0x57e31b[_0x6cc5('0x3d')]=_[_0x6cc5('0x3e')](_0x57e31b[_0x6cc5('0x3f')],_0x57e31b[_0x6cc5('0x3b')]);_0x24527e[_0x6cc5('0x41')]=_[_0x6cc5('0x3e')](_0x57e31b['model'],qs[_0x6cc5('0x40')](_0x1bb318[_0x6cc5('0x3b')]['fields']));_0x24527e[_0x6cc5('0x41')]=_0x24527e[_0x6cc5('0x41')][_0x6cc5('0x42')]?_0x24527e[_0x6cc5('0x41')]:_0x57e31b['model'];_0x24527e[_0x6cc5('0x44')]=qs[_0x6cc5('0x45')](_0x1bb318[_0x6cc5('0x3b')][_0x6cc5('0x45')]);_0x24527e['where']=qs['filters'](_['pick'](_0x1bb318[_0x6cc5('0x3b')],_0x57e31b[_0x6cc5('0x3d')]));if(_0x1bb318['query'][_0x6cc5('0x48')]){_0x24527e[_0x6cc5('0x46')]=_['merge'](_0x24527e['where'],{'$or':_[_0x6cc5('0x2e')](_0x24527e['attributes'],function(_0x416dc3){var _0x4e5856={};_0x4e5856[_0x416dc3]={'$like':'%'+_0x1bb318[_0x6cc5('0x3b')][_0x6cc5('0x48')]+'%'};return _0x4e5856;})});}_0x24527e=_[_0x6cc5('0x49')]({},_0x24527e,_0x1bb318['options']);return _0x1836b9[_0x6cc5('0xb7')](_0x24527e);}})['then'](function(_0x300f0f){if(_0x300f0f){_0x1d7cdc=_0x300f0f[_0x6cc5('0x42')];if(!_0x1bb318['query'][_0x6cc5('0x43')](_0x6cc5('0x6a'))){_0x24527e['limit']=qs['limit'](_0x1bb318['query'][_0x6cc5('0x22')]);_0x24527e['offset']=qs[_0x6cc5('0x21')](_0x1bb318[_0x6cc5('0x3b')][_0x6cc5('0x21')]);}return _0x1836b9[_0x6cc5('0xb7')](_0x24527e);}})[_0x6cc5('0x28')](function(_0x3909f6){if(_0x3909f6){return _0x3909f6?{'count':_0x1d7cdc,'rows':_0x3909f6}:null;}})[_0x6cc5('0x28')](respondWithResult(_0x243b23,null))[_0x6cc5('0x4e')](handleError(_0x243b23,null));};exports[_0x6cc5('0xb8')]=function(_0x45f40a,_0x173026,_0x1bea5d){var _0x32471b,_0x122eb3;return db['VoiceQueue'][_0x6cc5('0x59')]({'where':{'id':_0x45f40a[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x173026,null))[_0x6cc5('0x28')](function(_0x5ea682){if(_0x5ea682){_0x122eb3=_0x5ea682;return _0x5ea682[_0x6cc5('0xb8')](_0x45f40a[_0x6cc5('0x52')][_0x6cc5('0x85')],_[_0x6cc5('0x5f')](_0x45f40a[_0x6cc5('0x52')],[_0x6cc5('0x85'),'id'])||{});}return null;})['spread'](function(_0x4e7511){var _0x3228e2;_0x32471b=_0x4e7511||[];var _0x2729b7=[];if(_0x4e7511){for(var _0x504098=0x0;_0x504098<_0x4e7511[_0x6cc5('0x42')];_0x504098+=0x1){var _0x59cebe=_0x4e7511[_0x504098]['get']({'plain':!![]});_0x3228e2=squel['insert']()[_0x6cc5('0xa4')]('cm_hopper_black')[_0x6cc5('0xa6')]([_0x6cc5('0xa7'),_0x6cc5('0xab'),_0x6cc5('0xa8'),_0x6cc5('0x68'),_0x6cc5('0x60'),_0x6cc5('0x61')],squel['select']()[_0x6cc5('0x87')](_0x6cc5('0xa7'),_0x6cc5('0xa7'))[_0x6cc5('0x87')]('id',_0x6cc5('0xab'))[_0x6cc5('0x87')](_0x59cebe['CmListId'][_0x6cc5('0xac')](),_0x6cc5('0xa8'))['field'](_0x45f40a['params']['id'][_0x6cc5('0xac')](),_0x6cc5('0x68'))['field']('NOW()',_0x6cc5('0x60'))[_0x6cc5('0x87')](_0x6cc5('0xa9'),_0x6cc5('0x61'))[_0x6cc5('0x89')]('cm_contacts')[_0x6cc5('0x46')]('deletedAt\x20IS\x20NULL')[_0x6cc5('0x46')](_0x6cc5('0xaf'),_0x59cebe[_0x6cc5('0xb5')][_0x6cc5('0xac')]())[_0x6cc5('0x46')](_0x6cc5('0xb0')))[_0x6cc5('0xac')]();_0x2729b7[_0x6cc5('0x8e')](db[_0x6cc5('0x7a')][_0x6cc5('0x3b')](_0x3228e2));}return BPromise[_0x6cc5('0x93')](_0x2729b7);}})[_0x6cc5('0x28')](function(){return _0x32471b;})[_0x6cc5('0x28')](respondWithResult(_0x173026,null))[_0x6cc5('0x4e')](handleError(_0x173026,null));};exports['removeBlackLists']=function(_0xf60129,_0x8a197b,_0x443ab6){return db[_0x6cc5('0x36')][_0x6cc5('0x59')]({'where':{'id':_0xf60129[_0x6cc5('0x50')]['id']}})[_0x6cc5('0x28')](handleEntityNotFound(_0x8a197b,null))[_0x6cc5('0x28')](function(_0x519dcf){if(_0x519dcf){return _0x519dcf[_0x6cc5('0xb9')](_0xf60129['query']['ids']);}})['then'](function(_0x2c79a8){if(_0x2c79a8){return db['CmHopperBlack'][_0x6cc5('0x29')]({'where':{'ListId':_0xf60129['query']['ids'],'VoiceQueueId':_0xf60129['params']['id']}})['then'](function(){return _0x2c79a8;});}})[_0x6cc5('0x28')](respondWithStatusCode(_0x8a197b,null))[_0x6cc5('0x4e')](handleError(_0x8a197b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 11cdfe3..24fc7e1 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 _0x980a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','save','update','remove'];(function(_0x459a07,_0x42f4dc){var _0x476a72=function(_0xf3c01d){while(--_0xf3c01d){_0x459a07['push'](_0x459a07['shift']());}};_0x476a72(++_0x42f4dc);}(_0x980a,0x108));var _0xa980=function(_0x22ef03,_0x40b443){_0x22ef03=_0x22ef03-0x0;var _0x1f6c1b=_0x980a[_0x22ef03];return _0x1f6c1b;};'use strict';var EventEmitter=require(_0xa980('0x0'));var VoiceQueue=require(_0xa980('0x1'))['db'][_0xa980('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa980('0x3'),'afterUpdate':_0xa980('0x4'),'afterDestroy':_0xa980('0x5')};function emitEvent(_0x3c9cac){return function(_0x2862c2,_0x34d23e,_0x2f6bd8){VoiceQueueEvents['emit'](_0x3c9cac+':'+_0x2862c2['id'],_0x2862c2);VoiceQueueEvents[_0xa980('0x6')](_0x3c9cac,_0x2862c2);_0x2f6bd8(null);};}for(var e in events){if(events[_0xa980('0x7')](e)){var event=events[e];VoiceQueue[_0xa980('0x8')](e,emitEvent(event));}}module[_0xa980('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xac60=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac60,0x144));var _0x0ac6=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xac60[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x0ac6('0x0'));var VoiceQueue=require(_0x0ac6('0x1'))['db'][_0x0ac6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0ac6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ac6('0x4'),'afterDestroy':_0x0ac6('0x5')};function emitEvent(_0x5650a5){return function(_0x1688e8,_0x226195,_0x37d470){VoiceQueueEvents[_0x0ac6('0x6')](_0x5650a5+':'+_0x1688e8['id'],_0x1688e8);VoiceQueueEvents[_0x0ac6('0x6')](_0x5650a5,_0x1688e8);_0x37d470(null);};}for(var e in events){if(events[_0x0ac6('0x7')](e)){var event=events[e];VoiceQueue[_0x0ac6('0x8')](e,emitEvent(event));}}module[_0x0ac6('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7be3f71..6132e29 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 _0xea5c=['voice_queues','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voiceQueue.attributes','define','VoiceQueue'];(function(_0x29c37d,_0x31a4ed){var _0x3b2e19=function(_0x172fad){while(--_0x172fad){_0x29c37d['push'](_0x29c37d['shift']());}};_0x3b2e19(++_0x31a4ed);}(_0xea5c,0xf3));var _0xcea5=function(_0x43ee22,_0x2f57b9){_0x43ee22=_0x43ee22-0x0;var _0x1c3a20=_0xea5c[_0x43ee22];return _0x1c3a20;};'use strict';var _=require(_0xcea5('0x0'));var util=require(_0xcea5('0x1'));var logger=require(_0xcea5('0x2'))(_0xcea5('0x3'));var moment=require(_0xcea5('0x4'));var BPromise=require('bluebird');var rp=require(_0xcea5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcea5('0x6'));var attributes=require(_0xcea5('0x7'));module['exports']=function(_0x26500e,_0x9f55c9){return _0x26500e[_0xcea5('0x8')](_0xcea5('0x9'),attributes,{'tableName':_0xcea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1938=['./voiceQueue.attributes','define','voice_queues','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xe87cf3,_0x488228){var _0x54442a=function(_0x30da85){while(--_0x30da85){_0xe87cf3['push'](_0xe87cf3['shift']());}};_0x54442a(++_0x488228);}(_0x1938,0xc1));var _0x8193=function(_0x1d02f0,_0x1e0dd8){_0x1d02f0=_0x1d02f0-0x0;var _0x21490d=_0x1938[_0x1d02f0];return _0x21490d;};'use strict';var _=require(_0x8193('0x0'));var util=require(_0x8193('0x1'));var logger=require(_0x8193('0x2'))('api');var moment=require(_0x8193('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8193('0x4'));var rimraf=require(_0x8193('0x5'));var config=require(_0x8193('0x6'));var attributes=require(_0x8193('0x7'));module['exports']=function(_0x86c8e0,_0x1c5127){return _0x86c8e0[_0x8193('0x8')]('VoiceQueue',attributes,{'tableName':_0x8193('0x9'),'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 ca1d267..d229a39 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 _0x44b1=['attributes','ShowVoiceQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','limit','map','include','model'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x44b1,0x1bb));var _0x144b=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x44b1[_0x543084];return _0x306a57;};'use strict';var _=require(_0x144b('0x0'));var util=require(_0x144b('0x1'));var moment=require(_0x144b('0x2'));var BPromise=require('bluebird');var rs=require(_0x144b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x144b('0x4'))['db'];var utils=require(_0x144b('0x5'));var logger=require(_0x144b('0x6'))('rpc');var config=require(_0x144b('0x7'));var jayson=require(_0x144b('0x8'));var client=jayson[_0x144b('0x9')]['http']({'port':0x232a});config[_0x144b('0xa')]=_[_0x144b('0xb')](config[_0x144b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x144b('0xc'))(new Redis(config[_0x144b('0xa')]));require(_0x144b('0xd'))[_0x144b('0xe')](socket);function respondWithRpcPromise(_0x5d5bb4,_0x4e33bf,_0xa95a77){return new BPromise(function(_0x37d041,_0x2b1440){return client[_0x144b('0xf')](_0x5d5bb4,_0xa95a77)[_0x144b('0x10')](function(_0x2ae03c){logger[_0x144b('0x11')](_0x144b('0x12'),_0x4e33bf,'request\x20sent');logger[_0x144b('0x13')](_0x144b('0x14'),_0x4e33bf,_0x144b('0x15'),JSON[_0x144b('0x16')](_0x2ae03c));if(_0x2ae03c[_0x144b('0x17')]){if(_0x2ae03c[_0x144b('0x17')][_0x144b('0x18')]===0x1f4){logger[_0x144b('0x17')](_0x144b('0x12'),_0x4e33bf,_0x2ae03c[_0x144b('0x17')]['message']);return _0x2b1440(_0x2ae03c[_0x144b('0x17')][_0x144b('0x19')]);}logger[_0x144b('0x17')](_0x144b('0x12'),_0x4e33bf,_0x2ae03c[_0x144b('0x17')][_0x144b('0x19')]);return _0x37d041(_0x2ae03c[_0x144b('0x17')][_0x144b('0x19')]);}else{logger[_0x144b('0x11')](_0x144b('0x12'),_0x4e33bf,_0x144b('0x15'));_0x37d041(_0x2ae03c[_0x144b('0x1a')][_0x144b('0x19')]);}})[_0x144b('0x1b')](function(_0x2faa70){logger[_0x144b('0x17')](_0x144b('0x12'),_0x4e33bf,_0x2faa70);_0x2b1440(_0x2faa70);});});}exports[_0x144b('0x1c')]=function(_0x25da6b){var _0x181a4f=this;return new Promise(function(_0x36680f,_0x33598a){return db[_0x144b('0x1d')]['findAll']({'raw':_0x25da6b[_0x144b('0x1e')]?_0x25da6b['options'][_0x144b('0x1f')]===undefined?!![]:![]:!![],'where':_0x25da6b['options']?_0x25da6b['options'][_0x144b('0x20')]||null:null,'attributes':_0x25da6b['options']?_0x25da6b[_0x144b('0x1e')]['attributes']||null:null,'limit':_0x25da6b['options']?_0x25da6b[_0x144b('0x1e')][_0x144b('0x21')]||null:null,'include':_0x25da6b[_0x144b('0x1e')]?_0x25da6b[_0x144b('0x1e')]['include']?_[_0x144b('0x22')](_0x25da6b[_0x144b('0x1e')][_0x144b('0x23')],function(_0x5e1680){return{'model':db[_0x5e1680[_0x144b('0x24')]],'as':_0x5e1680['as'],'attributes':_0x5e1680[_0x144b('0x25')],'include':_0x5e1680['include']?_['map'](_0x5e1680[_0x144b('0x23')],function(_0x375870){return{'model':db[_0x375870[_0x144b('0x24')]],'as':_0x375870['as'],'attributes':_0x375870[_0x144b('0x25')],'include':_0x375870['include']?_[_0x144b('0x22')](_0x375870['include'],function(_0x477894){return{'model':db[_0x477894['model']],'as':_0x477894['as'],'attributes':_0x477894['attributes']};}):[]};}):[]};}):[]:[]})[_0x144b('0x10')](function(_0x5d9874){logger[_0x144b('0x11')]('GetVoiceQueue',_0x25da6b);logger[_0x144b('0x13')](_0x144b('0x1c'),_0x25da6b,JSON[_0x144b('0x16')](_0x5d9874));_0x36680f(_0x5d9874);})['catch'](function(_0x1c2583){logger[_0x144b('0x17')](_0x144b('0x1c'),_0x1c2583[_0x144b('0x19')],_0x25da6b);_0x33598a(_0x181a4f[_0x144b('0x17')](0x1f4,_0x1c2583['message']));});});};exports[_0x144b('0x26')]=function(_0x645780){var _0x44d50f=this;return new Promise(function(_0x14481e,_0x3eefa8){return db[_0x144b('0x1d')][_0x144b('0x27')]({'raw':_0x645780[_0x144b('0x1e')]?_0x645780['options'][_0x144b('0x1f')]===undefined?!![]:![]:!![],'where':_0x645780['options']?_0x645780[_0x144b('0x1e')]['where']||null:null,'attributes':_0x645780['options']?_0x645780['options']['attributes']||null:null,'include':_0x645780[_0x144b('0x1e')]?_0x645780[_0x144b('0x1e')]['include']?_[_0x144b('0x22')](_0x645780['options'][_0x144b('0x23')],function(_0x3f8d31){return{'model':db[_0x3f8d31[_0x144b('0x24')]],'as':_0x3f8d31['as'],'attributes':_0x3f8d31['attributes'],'include':_0x3f8d31[_0x144b('0x23')]?_['map'](_0x3f8d31['include'],function(_0x3c5ef0){return{'model':db[_0x3c5ef0[_0x144b('0x24')]],'as':_0x3c5ef0['as'],'attributes':_0x3c5ef0[_0x144b('0x25')],'include':_0x3c5ef0[_0x144b('0x23')]?_[_0x144b('0x22')](_0x3c5ef0[_0x144b('0x23')],function(_0x551c74){return{'model':db[_0x551c74[_0x144b('0x24')]],'as':_0x551c74['as'],'attributes':_0x551c74[_0x144b('0x25')]};}):[]};}):[]};}):[]:[]})[_0x144b('0x10')](function(_0x22c5d4){logger[_0x144b('0x11')]('ShowVoiceQueue',_0x645780);logger[_0x144b('0x13')](_0x144b('0x26'),_0x645780,JSON[_0x144b('0x16')](_0x22c5d4));_0x14481e(_0x22c5d4);})[_0x144b('0x1b')](function(_0x2f9263){logger['error'](_0x144b('0x26'),_0x2f9263[_0x144b('0x19')],_0x645780);_0x3eefa8(_0x44d50f[_0x144b('0x17')](0x1f4,_0x2f9263[_0x144b('0x19')]));});});}; \ No newline at end of file +var _0x11f3=['then','debug','GetVoiceQueue','ShowVoiceQueue','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VoiceQueue','findAll','options','raw','attributes','limit','include','model','map'];(function(_0x31791a,_0x32a553){var _0x18c25a=function(_0x3882f8){while(--_0x3882f8){_0x31791a['push'](_0x31791a['shift']());}};_0x18c25a(++_0x32a553);}(_0x11f3,0x9d));var _0x311f=function(_0x278f93,_0x5d74c6){_0x278f93=_0x278f93-0x0;var _0x47d224=_0x11f3[_0x278f93];return _0x47d224;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x311f('0x0'));var BPromise=require(_0x311f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311f('0x2'));var db=require(_0x311f('0x3'))['db'];var utils=require(_0x311f('0x4'));var logger=require(_0x311f('0x5'))(_0x311f('0x6'));var config=require('../../config/environment');var jayson=require(_0x311f('0x7'));var client=jayson[_0x311f('0x8')][_0x311f('0x9')]({'port':0x232a});config[_0x311f('0xa')]=_[_0x311f('0xb')](config[_0x311f('0xa')],{'host':_0x311f('0xc'),'port':0x18eb});var socket=require(_0x311f('0xd'))(new Redis(config[_0x311f('0xa')]));require(_0x311f('0xe'))['register'](socket);function respondWithRpcPromise(_0x47aac0,_0x146809,_0xf4a0a0){return new BPromise(function(_0x1ddb67,_0x55408b){return client[_0x311f('0xf')](_0x47aac0,_0xf4a0a0)['then'](function(_0x2d1512){logger[_0x311f('0x10')](_0x311f('0x11'),_0x146809,_0x311f('0x12'));logger['debug'](_0x311f('0x13'),_0x146809,_0x311f('0x12'),JSON[_0x311f('0x14')](_0x2d1512));if(_0x2d1512['error']){if(_0x2d1512[_0x311f('0x15')]['code']===0x1f4){logger[_0x311f('0x15')](_0x311f('0x11'),_0x146809,_0x2d1512[_0x311f('0x15')][_0x311f('0x16')]);return _0x55408b(_0x2d1512[_0x311f('0x15')]['message']);}logger['error'](_0x311f('0x11'),_0x146809,_0x2d1512['error'][_0x311f('0x16')]);return _0x1ddb67(_0x2d1512['error'][_0x311f('0x16')]);}else{logger[_0x311f('0x10')](_0x311f('0x11'),_0x146809,'request\x20sent');_0x1ddb67(_0x2d1512['result'][_0x311f('0x16')]);}})[_0x311f('0x17')](function(_0x43010c){logger['error'](_0x311f('0x11'),_0x146809,_0x43010c);_0x55408b(_0x43010c);});});}exports['GetVoiceQueue']=function(_0x13dba4){var _0x22a1fe=this;return new Promise(function(_0x3c00e1,_0x11f6c1){return db[_0x311f('0x18')][_0x311f('0x19')]({'raw':_0x13dba4['options']?_0x13dba4[_0x311f('0x1a')][_0x311f('0x1b')]===undefined?!![]:![]:!![],'where':_0x13dba4[_0x311f('0x1a')]?_0x13dba4[_0x311f('0x1a')]['where']||null:null,'attributes':_0x13dba4[_0x311f('0x1a')]?_0x13dba4['options'][_0x311f('0x1c')]||null:null,'limit':_0x13dba4[_0x311f('0x1a')]?_0x13dba4[_0x311f('0x1a')][_0x311f('0x1d')]||null:null,'include':_0x13dba4[_0x311f('0x1a')]?_0x13dba4['options']['include']?_['map'](_0x13dba4['options'][_0x311f('0x1e')],function(_0x3d495f){return{'model':db[_0x3d495f[_0x311f('0x1f')]],'as':_0x3d495f['as'],'attributes':_0x3d495f[_0x311f('0x1c')],'include':_0x3d495f[_0x311f('0x1e')]?_[_0x311f('0x20')](_0x3d495f[_0x311f('0x1e')],function(_0x2b8e8b){return{'model':db[_0x2b8e8b[_0x311f('0x1f')]],'as':_0x2b8e8b['as'],'attributes':_0x2b8e8b[_0x311f('0x1c')],'include':_0x2b8e8b[_0x311f('0x1e')]?_[_0x311f('0x20')](_0x2b8e8b[_0x311f('0x1e')],function(_0x1c3fd0){return{'model':db[_0x1c3fd0[_0x311f('0x1f')]],'as':_0x1c3fd0['as'],'attributes':_0x1c3fd0[_0x311f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x311f('0x21')](function(_0x33f9d4){logger['info']('GetVoiceQueue',_0x13dba4);logger[_0x311f('0x22')](_0x311f('0x23'),_0x13dba4,JSON[_0x311f('0x14')](_0x33f9d4));_0x3c00e1(_0x33f9d4);})[_0x311f('0x17')](function(_0xb4fd89){logger[_0x311f('0x15')](_0x311f('0x23'),_0xb4fd89[_0x311f('0x16')],_0x13dba4);_0x11f6c1(_0x22a1fe['error'](0x1f4,_0xb4fd89[_0x311f('0x16')]));});});};exports[_0x311f('0x24')]=function(_0x144392){var _0x54eb12=this;return new Promise(function(_0x36cf93,_0x2b334d){return db[_0x311f('0x18')][_0x311f('0x25')]({'raw':_0x144392['options']?_0x144392[_0x311f('0x1a')][_0x311f('0x1b')]===undefined?!![]:![]:!![],'where':_0x144392[_0x311f('0x1a')]?_0x144392['options']['where']||null:null,'attributes':_0x144392['options']?_0x144392['options'][_0x311f('0x1c')]||null:null,'include':_0x144392[_0x311f('0x1a')]?_0x144392[_0x311f('0x1a')][_0x311f('0x1e')]?_[_0x311f('0x20')](_0x144392[_0x311f('0x1a')][_0x311f('0x1e')],function(_0xab40f4){return{'model':db[_0xab40f4[_0x311f('0x1f')]],'as':_0xab40f4['as'],'attributes':_0xab40f4['attributes'],'include':_0xab40f4[_0x311f('0x1e')]?_[_0x311f('0x20')](_0xab40f4[_0x311f('0x1e')],function(_0x14c297){return{'model':db[_0x14c297[_0x311f('0x1f')]],'as':_0x14c297['as'],'attributes':_0x14c297[_0x311f('0x1c')],'include':_0x14c297[_0x311f('0x1e')]?_['map'](_0x14c297[_0x311f('0x1e')],function(_0x307a3e){return{'model':db[_0x307a3e['model']],'as':_0x307a3e['as'],'attributes':_0x307a3e[_0x311f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9fd1){logger[_0x311f('0x10')]('ShowVoiceQueue',_0x144392);logger[_0x311f('0x22')](_0x311f('0x24'),_0x144392,JSON[_0x311f('0x14')](_0x3c9fd1));_0x36cf93(_0x3c9fd1);})['catch'](function(_0x1bef30){logger[_0x311f('0x15')](_0x311f('0x24'),_0x1bef30[_0x311f('0x16')],_0x144392);_0x2b334d(_0x54eb12[_0x311f('0x15')](0x1f4,_0x1bef30[_0x311f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d5ddd28..ba631bd 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 _0x198a=['./voiceQueue.events','save','remove','removeListener','register','length','voiceQueue:'];(function(_0xc5d591,_0x1cae4e){var _0x5dd68b=function(_0x20e09c){while(--_0x20e09c){_0xc5d591['push'](_0xc5d591['shift']());}};_0x5dd68b(++_0x1cae4e);}(_0x198a,0x19d));var _0xa198=function(_0x782edd,_0x31c6d2){_0x782edd=_0x782edd-0x0;var _0x4df3ba=_0x198a[_0x782edd];return _0x4df3ba;};'use strict';var VoiceQueueEvents=require(_0xa198('0x0'));var events=[_0xa198('0x1'),_0xa198('0x2'),'update'];function createListener(_0xa3b76a,_0x8a1a47){return function(_0x53a0e5){_0x8a1a47['emit'](_0xa3b76a,_0x53a0e5);};}function removeListener(_0x46ed16,_0x3c8d87){return function(){VoiceQueueEvents[_0xa198('0x3')](_0x46ed16,_0x3c8d87);};}exports[_0xa198('0x4')]=function(_0x34892f){for(var _0x58b352=0x0,_0x45526b=events[_0xa198('0x5')];_0x58b352<_0x45526b;_0x58b352++){var _0xf2682d=events[_0x58b352];var _0x4dbdfd=createListener(_0xa198('0x6')+_0xf2682d,_0x34892f);VoiceQueueEvents['on'](_0xf2682d,_0x4dbdfd);}}; \ No newline at end of file +var _0x9181=['voiceQueue:','save','remove','update','removeListener','register','length'];(function(_0x586810,_0x3dea82){var _0x1abff9=function(_0x31476c){while(--_0x31476c){_0x586810['push'](_0x586810['shift']());}};_0x1abff9(++_0x3dea82);}(_0x9181,0x166));var _0x1918=function(_0x1dae6d,_0x3a6eb5){_0x1dae6d=_0x1dae6d-0x0;var _0x2b39f5=_0x9181[_0x1dae6d];return _0x2b39f5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x1918('0x0'),_0x1918('0x1'),_0x1918('0x2')];function createListener(_0x30c93e,_0x21ae16){return function(_0x19e9ed){_0x21ae16['emit'](_0x30c93e,_0x19e9ed);};}function removeListener(_0x1a4d46,_0x4aba2f){return function(){VoiceQueueEvents[_0x1918('0x3')](_0x1a4d46,_0x4aba2f);};}exports[_0x1918('0x4')]=function(_0x520ee7){for(var _0x58bf5e=0x0,_0x7c158c=events[_0x1918('0x5')];_0x58bf5e<_0x7c158c;_0x58bf5e++){var _0x535f93=events[_0x58bf5e];var _0x3aaecd=createListener(_0x1918('0x6')+_0x535f93,_0x520ee7);VoiceQueueEvents['on'](_0x535f93,_0x3aaecd);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 4e61774..2a3041c 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 _0x2d72=['show','post','create','put','update','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2d72,0xa8));var _0x22d7=function(_0x3f4082,_0x26795b){_0x3f4082=_0x3f4082-0x0;var _0x3eff25=_0x2d72[_0x3f4082];return _0x3eff25;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var auth=require(_0x22d7('0x6'));var interaction=require(_0x22d7('0x7'));var config=require(_0x22d7('0x8'));var controller=require(_0x22d7('0x9'));router[_0x22d7('0xa')]('/',auth[_0x22d7('0xb')](),controller[_0x22d7('0xc')]);router[_0x22d7('0xa')]('/describe',auth[_0x22d7('0xb')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xb')](),controller[_0x22d7('0xf')]);router[_0x22d7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x22d7('0x10')]);router[_0x22d7('0x11')]('/',auth[_0x22d7('0xb')](),controller[_0x22d7('0x12')]);router[_0x22d7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x22d7('0x14')]);router['delete'](_0x22d7('0x15'),auth[_0x22d7('0xb')](),controller['destroy']);module[_0x22d7('0x16')]=router; \ No newline at end of file +var _0x8ace=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x23cf36,_0x373e56){var _0x12e158=function(_0x823337){while(--_0x823337){_0x23cf36['push'](_0x23cf36['shift']());}};_0x12e158(++_0x373e56);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x290fc9,_0x3069fe){_0x290fc9=_0x290fc9-0x0;var _0x31c8bd=_0x8ace[_0x290fc9];return _0x31c8bd;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var auth=require(_0xe8ac('0x6'));var interaction=require(_0xe8ac('0x7'));var config=require(_0xe8ac('0x8'));var controller=require(_0xe8ac('0x9'));router[_0xe8ac('0xa')]('/',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xc')]);router[_0xe8ac('0xa')]('/describe',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['get']('/index',auth[_0xe8ac('0xb')](),controller['getVoiceQueuesReport']);router[_0xe8ac('0xa')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xf')]);router[_0xe8ac('0x10')]('/',auth[_0xe8ac('0xb')](),controller['create']);router[_0xe8ac('0x11')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller['update']);router[_0xe8ac('0x12')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x13')]);module[_0xe8ac('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 87ad0bc..3f4d183 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 _0x5952=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING'];(function(_0x3f7816,_0x372dc){var _0x28dd20=function(_0x262702){while(--_0x262702){_0x3f7816['push'](_0x3f7816['shift']());}};_0x28dd20(++_0x372dc);}(_0x5952,0x10d));var _0x2595=function(_0x1404b2,_0x458925){_0x1404b2=_0x1404b2-0x0;var _0xf76044=_0x5952[_0x1404b2];return _0xf76044;};'use strict';var Sequelize=require(_0x2595('0x0'));var moment=require(_0x2595('0x1'));module['exports']={'type':{'type':Sequelize[_0x2595('0x2')]},'uniqueid':{'type':Sequelize[_0x2595('0x2')]},'calleridnum':{'type':Sequelize[_0x2595('0x2')]},'calleridname':{'type':Sequelize[_0x2595('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x2595('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x2595('0x3')],'set':function(_0x2cb619){var _0x2f972e=moment(_0x2cb619);var _0x13e636=moment(this[_0x2595('0x4')](_0x2595('0x5')))[_0x2595('0x6')](_0x2595('0x7'));var _0x766e1b=_0x2f972e[_0x2595('0x8')](_0x13e636,_0x2595('0x9'));this[_0x2595('0xa')](_0x2595('0xb'),_0x2cb619);this[_0x2595('0xa')]('holdtime',_0x766e1b||null);}},'position':{'type':Sequelize[_0x2595('0xc')]},'count':{'type':Sequelize[_0x2595('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x2595('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2595('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2595('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2595('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2595('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x2595('0x2')],'comment':_0x2595('0xe')},'originalposition':{'type':Sequelize[_0x2595('0xc')]},'channel':{'type':Sequelize[_0x2595('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2595('0x2')]},'connectedlinename':{'type':Sequelize[_0x2595('0x2')]},'accountcode':{'type':Sequelize[_0x2595('0x2')]},'context':{'type':Sequelize[_0x2595('0x2')]},'exten':{'type':Sequelize[_0x2595('0x2')]},'priority':{'type':Sequelize[_0x2595('0x2')]},'holdtime':{'type':Sequelize[_0x2595('0xc')]},'mohtime':{'type':Sequelize[_0x2595('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2595('0x2')]},'transfer':{'type':Sequelize[_0x2595('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2595('0x2')],'comment':_0x2595('0xf')},'transferexten':{'type':Sequelize[_0x2595('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2595('0x2')]},'disposition':{'type':Sequelize[_0x2595('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2595('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe625=['exports','STRING','DATE','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x257dba,_0x1afc9c){var _0x3dc3d9=function(_0x43cd42){while(--_0x43cd42){_0x257dba['push'](_0x257dba['shift']());}};_0x3dc3d9(++_0x1afc9c);}(_0xe625,0x12a));var _0x5e62=function(_0x5f098f,_0x575486){_0x5f098f=_0x5f098f-0x0;var _0x3873c5=_0xe625[_0x5f098f];return _0x3873c5;};'use strict';var Sequelize=require(_0x5e62('0x0'));var moment=require(_0x5e62('0x1'));module[_0x5e62('0x2')]={'type':{'type':Sequelize[_0x5e62('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5e62('0x3')]},'calleridname':{'type':Sequelize[_0x5e62('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5e62('0x4')],'set':function(_0x208b03){var _0x420d79=moment(_0x208b03);var _0x403b33=moment(this['getDataValue'](_0x5e62('0x5')))[_0x5e62('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x41aa73=_0x420d79[_0x5e62('0x7')](_0x403b33,_0x5e62('0x8'));this[_0x5e62('0x9')](_0x5e62('0xa'),_0x208b03);this['setDataValue']('holdtime',_0x41aa73||null);}},'position':{'type':Sequelize[_0x5e62('0xb')]},'count':{'type':Sequelize[_0x5e62('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5e62('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5e62('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5e62('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5e62('0x3')],'comment':_0x5e62('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x5e62('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5e62('0x3')]},'connectedlinename':{'type':Sequelize[_0x5e62('0x3')]},'accountcode':{'type':Sequelize[_0x5e62('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5e62('0x3')]},'priority':{'type':Sequelize[_0x5e62('0x3')]},'holdtime':{'type':Sequelize[_0x5e62('0xb')]},'mohtime':{'type':Sequelize[_0x5e62('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5e62('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5e62('0x3')]},'transfer':{'type':Sequelize[_0x5e62('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5e62('0x3')],'comment':_0x5e62('0xe')},'transferexten':{'type':Sequelize[_0x5e62('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5e62('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ecf008b..67427ea 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(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','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','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x7a54,0x106));var _0x47a5=function(_0x4bbcaf,_0x371647){_0x4bbcaf=_0x4bbcaf-0x0;var _0x448e85=_0x7a54[_0x4bbcaf];return _0x448e85;};'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);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0f1fb1e..3fbfd8b 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 _0x0f7c=['hook','exports','events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f7c,0x1ba));var _0xc0f7=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0f7c[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0xc0f7('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xc0f7('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc0f7('0x2')](0x0);var events={'afterCreate':_0xc0f7('0x3'),'afterUpdate':_0xc0f7('0x4'),'afterDestroy':_0xc0f7('0x5')};function emitEvent(_0x9dd501){return function(_0x1f13f2,_0x42576f,_0x44d5f8){VoiceQueueReportEvents[_0xc0f7('0x6')](_0x9dd501+':'+_0x1f13f2['id'],_0x1f13f2);VoiceQueueReportEvents['emit'](_0x9dd501,_0x1f13f2);_0x44d5f8(null);};}for(var e in events){if(events[_0xc0f7('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc0f7('0x8')](e,emitEvent(event));}}module[_0xc0f7('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xfbd9=['../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5b581a,_0x40af0c){var _0x42bc47=function(_0x584e0e){while(--_0x584e0e){_0x5b581a['push'](_0x5b581a['shift']());}};_0x42bc47(++_0x40af0c);}(_0xfbd9,0x185));var _0x9fbd=function(_0x16b727,_0xe24058){_0x16b727=_0x16b727-0x0;var _0x333545=_0xfbd9[_0x16b727];return _0x333545;};'use strict';var EventEmitter=require(_0x9fbd('0x0'));var VoiceQueueReport=require(_0x9fbd('0x1'))['db'][_0x9fbd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9fbd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9fbd('0x4'),'afterDestroy':_0x9fbd('0x5')};function emitEvent(_0x96cddd){return function(_0x36109d,_0x46d59b,_0x21e876){VoiceQueueReportEvents['emit'](_0x96cddd+':'+_0x36109d['id'],_0x36109d);VoiceQueueReportEvents[_0x9fbd('0x6')](_0x96cddd,_0x36109d);_0x21e876(null);};}for(var e in events){if(events[_0x9fbd('0x7')](e)){var event=events[e];VoiceQueueReport[_0x9fbd('0x8')](e,emitEvent(event));}}module[_0x9fbd('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 2f94aa1..7365f52 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 _0xdf2d=['util','moment','bluebird','path','../../config/environment','exports','define','VoiceQueueReport','uniqueid'];(function(_0x50a6c8,_0x444218){var _0x504b14=function(_0x42b247){while(--_0x42b247){_0x50a6c8['push'](_0x50a6c8['shift']());}};_0x504b14(++_0x444218);}(_0xdf2d,0x1cb));var _0xddf2=function(_0x5bc5ed,_0x57c35e){_0x5bc5ed=_0x5bc5ed-0x0;var _0x57fa2a=_0xdf2d[_0x5bc5ed];return _0x57fa2a;};'use strict';var _=require('lodash');var util=require(_0xddf2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xddf2('0x1'));var BPromise=require(_0xddf2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddf2('0x3'));var rimraf=require('rimraf');var config=require(_0xddf2('0x4'));var attributes=require('./voiceQueueReport.attributes');module[_0xddf2('0x5')]=function(_0x4cebf0,_0x2c5af9){return _0x4cebf0[_0xddf2('0x6')](_0xddf2('0x7'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xddf2('0x8')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5722=['VoiceQueueReport','report_queue','calleridnum','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x1d26cc,_0x3863bf){var _0x1eee39=function(_0x2a5040){while(--_0x2a5040){_0x1d26cc['push'](_0x1d26cc['shift']());}};_0x1eee39(++_0x3863bf);}(_0x5722,0x1f1));var _0x2572=function(_0x2b54c0,_0x5edd9d){_0x2b54c0=_0x2b54c0-0x0;var _0x500c63=_0x5722[_0x2b54c0];return _0x500c63;};'use strict';var _=require('lodash');var util=require(_0x2572('0x0'));var logger=require('../../config/logger')(_0x2572('0x1'));var moment=require(_0x2572('0x2'));var BPromise=require(_0x2572('0x3'));var rp=require(_0x2572('0x4'));var fs=require('fs');var path=require(_0x2572('0x5'));var rimraf=require('rimraf');var config=require(_0x2572('0x6'));var attributes=require(_0x2572('0x7'));module[_0x2572('0x8')]=function(_0x4b07f5,_0x22c48e){return _0x4b07f5[_0x2572('0x9')](_0x2572('0xa'),attributes,{'tableName':_0x2572('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x2572('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 58373f5..bd09bc6 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 _0x7f52=['info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','attributes','include','map','model','debug','stringify','body','raw','CreateVoiceQueueReport','update','where','limit','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./voiceQueueReport.socket','request','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message'];(function(_0x587517,_0x403aaa){var _0x548955=function(_0x1a4c3d){while(--_0x1a4c3d){_0x587517['push'](_0x587517['shift']());}};_0x548955(++_0x403aaa);}(_0x7f52,0x95));var _0x27f5=function(_0x67c742,_0x24d70d){_0x67c742=_0x67c742-0x0;var _0x2b36c6=_0x7f52[_0x67c742];return _0x2b36c6;};'use strict';var _=require('lodash');var util=require(_0x27f5('0x0'));var moment=require(_0x27f5('0x1'));var BPromise=require(_0x27f5('0x2'));var rs=require(_0x27f5('0x3'));var fs=require('fs');var Redis=require(_0x27f5('0x4'));var db=require(_0x27f5('0x5'))['db'];var utils=require(_0x27f5('0x6'));var logger=require(_0x27f5('0x7'))(_0x27f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x27f5('0x9'));var client=jayson[_0x27f5('0xa')][_0x27f5('0xb')]({'port':0x232a});config['redis']=_[_0x27f5('0xc')](config[_0x27f5('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27f5('0xd')]));require(_0x27f5('0xe'))['register'](socket);function respondWithRpcPromise(_0x51ca86,_0x4a6187,_0x353baa){return new BPromise(function(_0x4b699d,_0x3f0858){return client[_0x27f5('0xf')](_0x51ca86,_0x353baa)[_0x27f5('0x10')](function(_0x642af7){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x4a6187,_0x27f5('0x11'));logger['debug'](_0x27f5('0x12'),_0x4a6187,_0x27f5('0x11'),JSON['stringify'](_0x642af7));if(_0x642af7[_0x27f5('0x13')]){if(_0x642af7[_0x27f5('0x13')][_0x27f5('0x14')]===0x1f4){logger[_0x27f5('0x13')](_0x27f5('0x15'),_0x4a6187,_0x642af7[_0x27f5('0x13')]['message']);return _0x3f0858(_0x642af7['error'][_0x27f5('0x16')]);}logger[_0x27f5('0x13')](_0x27f5('0x15'),_0x4a6187,_0x642af7[_0x27f5('0x13')][_0x27f5('0x16')]);return _0x4b699d(_0x642af7[_0x27f5('0x13')][_0x27f5('0x16')]);}else{logger[_0x27f5('0x17')](_0x27f5('0x15'),_0x4a6187,_0x27f5('0x11'));_0x4b699d(_0x642af7[_0x27f5('0x18')][_0x27f5('0x16')]);}})[_0x27f5('0x19')](function(_0x959296){logger['error'](_0x27f5('0x15'),_0x4a6187,_0x959296);_0x3f0858(_0x959296);});});}exports[_0x27f5('0x1a')]=function(_0x48b457){var _0x474e33=this;return new Promise(function(_0x52c50b,_0x33fa22){return db[_0x27f5('0x1b')][_0x27f5('0x1c')]({'raw':_0x48b457[_0x27f5('0x1d')]?_0x48b457[_0x27f5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x48b457[_0x27f5('0x1d')]?_0x48b457[_0x27f5('0x1d')]['where']||null:null,'attributes':_0x48b457[_0x27f5('0x1d')]?_0x48b457[_0x27f5('0x1d')][_0x27f5('0x1e')]||null:null,'limit':_0x48b457[_0x27f5('0x1d')]?_0x48b457[_0x27f5('0x1d')]['limit']||null:null,'include':_0x48b457[_0x27f5('0x1d')]?_0x48b457[_0x27f5('0x1d')][_0x27f5('0x1f')]?_[_0x27f5('0x20')](_0x48b457[_0x27f5('0x1d')][_0x27f5('0x1f')],function(_0x54f90b){return{'model':db[_0x54f90b[_0x27f5('0x21')]],'as':_0x54f90b['as'],'attributes':_0x54f90b[_0x27f5('0x1e')],'include':_0x54f90b[_0x27f5('0x1f')]?_[_0x27f5('0x20')](_0x54f90b[_0x27f5('0x1f')],function(_0x1f5613){return{'model':db[_0x1f5613[_0x27f5('0x21')]],'as':_0x1f5613['as'],'attributes':_0x1f5613[_0x27f5('0x1e')],'include':_0x1f5613[_0x27f5('0x1f')]?_['map'](_0x1f5613[_0x27f5('0x1f')],function(_0x2f0252){return{'model':db[_0x2f0252[_0x27f5('0x21')]],'as':_0x2f0252['as'],'attributes':_0x2f0252[_0x27f5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57f5c2){logger[_0x27f5('0x17')](_0x27f5('0x1a'),_0x48b457);logger[_0x27f5('0x22')]('GetVoiceQueueReport',_0x48b457,JSON[_0x27f5('0x23')](_0x57f5c2));_0x52c50b(_0x57f5c2);})['catch'](function(_0x99a4cd){logger[_0x27f5('0x13')](_0x27f5('0x1a'),_0x99a4cd['message'],_0x48b457);_0x33fa22(_0x474e33[_0x27f5('0x13')](0x1f4,_0x99a4cd[_0x27f5('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x4a4c1e){var _0x2c11dd=this;return new Promise(function(_0x59c5f3,_0x41ed27){return db[_0x27f5('0x1b')]['create'](_0x4a4c1e[_0x27f5('0x24')],{'raw':_0x4a4c1e[_0x27f5('0x1d')]?_0x4a4c1e[_0x27f5('0x1d')][_0x27f5('0x25')]===undefined?!![]:![]:!![]})[_0x27f5('0x10')](function(_0x2bd128){logger['info'](_0x27f5('0x26'),_0x4a4c1e);logger[_0x27f5('0x22')]('CreateVoiceQueueReport',_0x4a4c1e,JSON[_0x27f5('0x23')](_0x2bd128));_0x59c5f3(_0x2bd128);})['catch'](function(_0x23b142){logger[_0x27f5('0x13')](_0x27f5('0x26'),_0x23b142[_0x27f5('0x16')],_0x4a4c1e);_0x41ed27(_0x2c11dd[_0x27f5('0x13')](0x1f4,_0x23b142[_0x27f5('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x16bc14){var _0x2babc0=this;return new Promise(function(_0x11d74d,_0x3b7cc0){return db['VoiceQueueReport'][_0x27f5('0x27')](_0x16bc14[_0x27f5('0x24')],{'raw':_0x16bc14[_0x27f5('0x1d')]?_0x16bc14[_0x27f5('0x1d')][_0x27f5('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bc14[_0x27f5('0x1d')]?_0x16bc14[_0x27f5('0x1d')][_0x27f5('0x28')]||null:null,'attributes':_0x16bc14[_0x27f5('0x1d')]?_0x16bc14[_0x27f5('0x1d')][_0x27f5('0x1e')]||null:null,'limit':_0x16bc14[_0x27f5('0x1d')]?_0x16bc14[_0x27f5('0x1d')][_0x27f5('0x29')]||null:null})[_0x27f5('0x10')](function(_0x284b03){logger[_0x27f5('0x17')](_0x27f5('0x2a'),_0x16bc14);logger['debug']('UpdateVoiceQueueReport',_0x16bc14,JSON['stringify'](_0x284b03));_0x11d74d(_0x284b03);})[_0x27f5('0x19')](function(_0x17e08e){logger[_0x27f5('0x13')]('UpdateVoiceQueueReport',_0x17e08e[_0x27f5('0x16')],_0x16bc14);_0x3b7cc0(_0x2babc0[_0x27f5('0x13')](0x1f4,_0x17e08e[_0x27f5('0x16')]));});});}; \ No newline at end of file +var _0xbfc3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','info','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3d5bdf,_0x198772){var _0x41f93e=function(_0x4dc594){while(--_0x4dc594){_0x3d5bdf['push'](_0x3d5bdf['shift']());}};_0x41f93e(++_0x198772);}(_0xbfc3,0x13d));var _0x3bfc=function(_0x31c34c,_0x388df2){_0x31c34c=_0x31c34c-0x0;var _0x42c5d9=_0xbfc3[_0x31c34c];return _0x42c5d9;};'use strict';var _=require(_0x3bfc('0x0'));var util=require('util');var moment=require(_0x3bfc('0x1'));var BPromise=require(_0x3bfc('0x2'));var rs=require(_0x3bfc('0x3'));var fs=require('fs');var Redis=require(_0x3bfc('0x4'));var db=require(_0x3bfc('0x5'))['db'];var utils=require(_0x3bfc('0x6'));var logger=require(_0x3bfc('0x7'))(_0x3bfc('0x8'));var config=require(_0x3bfc('0x9'));var jayson=require(_0x3bfc('0xa'));var client=jayson['client'][_0x3bfc('0xb')]({'port':0x232a});config[_0x3bfc('0xc')]=_[_0x3bfc('0xd')](config[_0x3bfc('0xc')],{'host':_0x3bfc('0xe'),'port':0x18eb});var socket=require(_0x3bfc('0xf'))(new Redis(config[_0x3bfc('0xc')]));require(_0x3bfc('0x10'))[_0x3bfc('0x11')](socket);function respondWithRpcPromise(_0x5053fa,_0x24f5fe,_0x120353){return new BPromise(function(_0xacacbe,_0x147e6b){return client[_0x3bfc('0x12')](_0x5053fa,_0x120353)[_0x3bfc('0x13')](function(_0x2e8b37){logger['info'](_0x3bfc('0x14'),_0x24f5fe,_0x3bfc('0x15'));logger[_0x3bfc('0x16')](_0x3bfc('0x17'),_0x24f5fe,_0x3bfc('0x15'),JSON[_0x3bfc('0x18')](_0x2e8b37));if(_0x2e8b37[_0x3bfc('0x19')]){if(_0x2e8b37['error'][_0x3bfc('0x1a')]===0x1f4){logger[_0x3bfc('0x19')](_0x3bfc('0x14'),_0x24f5fe,_0x2e8b37[_0x3bfc('0x19')][_0x3bfc('0x1b')]);return _0x147e6b(_0x2e8b37[_0x3bfc('0x19')][_0x3bfc('0x1b')]);}logger[_0x3bfc('0x19')](_0x3bfc('0x14'),_0x24f5fe,_0x2e8b37['error'][_0x3bfc('0x1b')]);return _0xacacbe(_0x2e8b37[_0x3bfc('0x19')][_0x3bfc('0x1b')]);}else{logger['info'](_0x3bfc('0x14'),_0x24f5fe,'request\x20sent');_0xacacbe(_0x2e8b37[_0x3bfc('0x1c')][_0x3bfc('0x1b')]);}})[_0x3bfc('0x1d')](function(_0x1cdd6b){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x24f5fe,_0x1cdd6b);_0x147e6b(_0x1cdd6b);});});}exports[_0x3bfc('0x1e')]=function(_0xe3eb3a){var _0x229228=this;return new Promise(function(_0x436c7c,_0xf3737d){return db[_0x3bfc('0x1f')][_0x3bfc('0x20')]({'raw':_0xe3eb3a[_0x3bfc('0x21')]?_0xe3eb3a['options'][_0x3bfc('0x22')]===undefined?!![]:![]:!![],'where':_0xe3eb3a[_0x3bfc('0x21')]?_0xe3eb3a[_0x3bfc('0x21')][_0x3bfc('0x23')]||null:null,'attributes':_0xe3eb3a[_0x3bfc('0x21')]?_0xe3eb3a[_0x3bfc('0x21')][_0x3bfc('0x24')]||null:null,'limit':_0xe3eb3a[_0x3bfc('0x21')]?_0xe3eb3a[_0x3bfc('0x21')][_0x3bfc('0x25')]||null:null,'include':_0xe3eb3a['options']?_0xe3eb3a[_0x3bfc('0x21')][_0x3bfc('0x26')]?_['map'](_0xe3eb3a[_0x3bfc('0x21')]['include'],function(_0x1eec93){return{'model':db[_0x1eec93[_0x3bfc('0x27')]],'as':_0x1eec93['as'],'attributes':_0x1eec93[_0x3bfc('0x24')],'include':_0x1eec93[_0x3bfc('0x26')]?_['map'](_0x1eec93[_0x3bfc('0x26')],function(_0x55bdff){return{'model':db[_0x55bdff['model']],'as':_0x55bdff['as'],'attributes':_0x55bdff[_0x3bfc('0x24')],'include':_0x55bdff[_0x3bfc('0x26')]?_[_0x3bfc('0x28')](_0x55bdff['include'],function(_0x23ccb2){return{'model':db[_0x23ccb2['model']],'as':_0x23ccb2['as'],'attributes':_0x23ccb2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bfc('0x13')](function(_0x3cf0f0){logger[_0x3bfc('0x29')]('GetVoiceQueueReport',_0xe3eb3a);logger[_0x3bfc('0x16')]('GetVoiceQueueReport',_0xe3eb3a,JSON[_0x3bfc('0x18')](_0x3cf0f0));_0x436c7c(_0x3cf0f0);})[_0x3bfc('0x1d')](function(_0x19b0a2){logger[_0x3bfc('0x19')](_0x3bfc('0x1e'),_0x19b0a2['message'],_0xe3eb3a);_0xf3737d(_0x229228[_0x3bfc('0x19')](0x1f4,_0x19b0a2[_0x3bfc('0x1b')]));});});};exports[_0x3bfc('0x2a')]=function(_0x49f7d8){var _0x44bf0e=this;return new Promise(function(_0x4c813d,_0x173357){return db['VoiceQueueReport'][_0x3bfc('0x2b')](_0x49f7d8[_0x3bfc('0x2c')],{'raw':_0x49f7d8[_0x3bfc('0x21')]?_0x49f7d8['options'][_0x3bfc('0x22')]===undefined?!![]:![]:!![]})[_0x3bfc('0x13')](function(_0x3a42c8){logger[_0x3bfc('0x29')](_0x3bfc('0x2a'),_0x49f7d8);logger['debug'](_0x3bfc('0x2a'),_0x49f7d8,JSON['stringify'](_0x3a42c8));_0x4c813d(_0x3a42c8);})['catch'](function(_0x3cd6af){logger['error'](_0x3bfc('0x2a'),_0x3cd6af[_0x3bfc('0x1b')],_0x49f7d8);_0x173357(_0x44bf0e[_0x3bfc('0x19')](0x1f4,_0x3cd6af[_0x3bfc('0x1b')]));});});};exports[_0x3bfc('0x2d')]=function(_0x40b73c){var _0x44f937=this;return new Promise(function(_0x13f6b3,_0x36fdd8){return db['VoiceQueueReport']['update'](_0x40b73c[_0x3bfc('0x2c')],{'raw':_0x40b73c[_0x3bfc('0x21')]?_0x40b73c['options'][_0x3bfc('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b73c['options']?_0x40b73c[_0x3bfc('0x21')][_0x3bfc('0x23')]||null:null,'attributes':_0x40b73c['options']?_0x40b73c[_0x3bfc('0x21')]['attributes']||null:null,'limit':_0x40b73c[_0x3bfc('0x21')]?_0x40b73c['options']['limit']||null:null})[_0x3bfc('0x13')](function(_0x17186f){logger['info'](_0x3bfc('0x2d'),_0x40b73c);logger[_0x3bfc('0x16')](_0x3bfc('0x2d'),_0x40b73c,JSON[_0x3bfc('0x18')](_0x17186f));_0x13f6b3(_0x17186f);})[_0x3bfc('0x1d')](function(_0x528ec4){logger['error']('UpdateVoiceQueueReport',_0x528ec4[_0x3bfc('0x1b')],_0x40b73c);_0x36fdd8(_0x44f937[_0x3bfc('0x19')](0x1f4,_0x528ec4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index bf87567..fa5b451 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 _0x2d73=['voiceQueueReport:','save','update','removeListener','length'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x2d73,0x191));var _0x32d7=function(_0x2ddb6d,_0x25d45b){_0x2ddb6d=_0x2ddb6d-0x0;var _0x56c103=_0x2d73[_0x2ddb6d];return _0x56c103;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x32d7('0x0'),'remove',_0x32d7('0x1')];function createListener(_0x178551,_0x19ed6c){return function(_0x59a4a5){_0x19ed6c['emit'](_0x178551,_0x59a4a5);};}function removeListener(_0x5b2186,_0xda189e){return function(){VoiceQueueReportEvents[_0x32d7('0x2')](_0x5b2186,_0xda189e);};}exports['register']=function(_0x332d99){for(var _0x3d25c3=0x0,_0x4d8d60=events[_0x32d7('0x3')];_0x3d25c3<_0x4d8d60;_0x3d25c3++){var _0x387d8e=events[_0x3d25c3];var _0x30ae89=createListener(_0x32d7('0x4')+_0x387d8e,_0x332d99);VoiceQueueReportEvents['on'](_0x387d8e,_0x30ae89);}}; \ No newline at end of file +var _0x2a01=['emit','removeListener','register','length','voiceQueueReport:','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a01,0x186));var _0x12a0=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x2a01[_0x1203f];return _0x365f0a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x12a0('0x0'),'remove',_0x12a0('0x1')];function createListener(_0x3a771f,_0x2f07d6){return function(_0x49a2b5){_0x2f07d6[_0x12a0('0x2')](_0x3a771f,_0x49a2b5);};}function removeListener(_0x3b6732,_0xbb1ed8){return function(){VoiceQueueReportEvents[_0x12a0('0x3')](_0x3b6732,_0xbb1ed8);};}exports[_0x12a0('0x4')]=function(_0x5eab55){for(var _0x2b28c3=0x0,_0xd4f01a=events[_0x12a0('0x5')];_0x2b28c3<_0xd4f01a;_0x2b28c3++){var _0x30b2ba=events[_0x2b28c3];var _0xd9d9ec=createListener(_0x12a0('0x6')+_0x30b2ba,_0x5eab55);VoiceQueueReportEvents['on'](_0x30b2ba,_0xd9d9ec);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 826a2b9..9176ebc 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 _0xff2e=['show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x4dbeaa,_0x3fb85d){var _0x889e79=function(_0x737998){while(--_0x737998){_0x4dbeaa['push'](_0x4dbeaa['shift']());}};_0x889e79(++_0x3fb85d);}(_0xff2e,0xf6));var _0xeff2=function(_0x3a91b9,_0x503d63){_0x3a91b9=_0x3a91b9-0x0;var _0x1da130=_0xff2e[_0x3a91b9];return _0x1da130;};'use strict';var multer=require(_0xeff2('0x0'));var util=require(_0xeff2('0x1'));var path=require(_0xeff2('0x2'));var timeout=require(_0xeff2('0x3'));var express=require(_0xeff2('0x4'));var router=express[_0xeff2('0x5')]();var auth=require(_0xeff2('0x6'));var interaction=require(_0xeff2('0x7'));var config=require(_0xeff2('0x8'));var controller=require(_0xeff2('0x9'));router[_0xeff2('0xa')]('/',auth[_0xeff2('0xb')](),controller[_0xeff2('0xc')]);router[_0xeff2('0xa')](_0xeff2('0xd'),auth['isAuthenticated'](),controller[_0xeff2('0xe')]);router[_0xeff2('0xf')]('/',auth['isAuthenticated'](),controller[_0xeff2('0x10')]);router[_0xeff2('0x11')]('/:id',auth[_0xeff2('0xb')](),controller['update']);router['delete']('/:id',auth[_0xeff2('0xb')](),controller[_0xeff2('0x12')]);module[_0xeff2('0x13')]=router; \ No newline at end of file +var _0xa615=['./voiceQueuesLog.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x32fc27,_0x159d96){var _0x30727e=function(_0x2eb6e7){while(--_0x2eb6e7){_0x32fc27['push'](_0x32fc27['shift']());}};_0x30727e(++_0x159d96);}(_0xa615,0x186));var _0x5a61=function(_0x11556b,_0x26dfd8){_0x11556b=_0x11556b-0x0;var _0x42d652=_0xa615[_0x11556b];return _0x42d652;};'use strict';var multer=require(_0x5a61('0x0'));var util=require(_0x5a61('0x1'));var path=require('path');var timeout=require(_0x5a61('0x2'));var express=require(_0x5a61('0x3'));var router=express['Router']();var auth=require(_0x5a61('0x4'));var interaction=require(_0x5a61('0x5'));var config=require('../../config/environment');var controller=require(_0x5a61('0x6'));router['get']('/',auth[_0x5a61('0x7')](),controller[_0x5a61('0x8')]);router['get']('/:id',auth[_0x5a61('0x7')](),controller[_0x5a61('0x9')]);router[_0x5a61('0xa')]('/',auth[_0x5a61('0x7')](),controller[_0x5a61('0xb')]);router[_0x5a61('0xc')](_0x5a61('0xd'),auth[_0x5a61('0x7')](),controller[_0x5a61('0xe')]);router[_0x5a61('0xf')](_0x5a61('0xd'),auth['isAuthenticated'](),controller[_0x5a61('0x10')]);module[_0x5a61('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 81e0a6b..2e21189 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 _0x2fdb=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x234d3b,_0x19991c){var _0x58016c=function(_0x17ef3e){while(--_0x17ef3e){_0x234d3b['push'](_0x234d3b['shift']());}};_0x58016c(++_0x19991c);}(_0x2fdb,0x1b9));var _0xb2fd=function(_0x480f23,_0x390707){_0x480f23=_0x480f23-0x0;var _0x3662a3=_0x2fdb[_0x480f23];return _0x3662a3;};'use strict';var Sequelize=require(_0xb2fd('0x0'));var moment=require(_0xb2fd('0x1'));module[_0xb2fd('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xb2fd('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb2fd('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb2fd('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb2fd('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb2fd('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb2fd('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb2fd('0x4')],'allowNull':![],'defaultValue':moment()[_0xb2fd('0x5')](_0xb2fd('0x6'))}}; \ No newline at end of file +var _0x4312=['moment','STRING','format','sequelize'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4312,0x1bb));var _0x2431=function(_0x2c1483,_0x8cb4cb){_0x2c1483=_0x2c1483-0x0;var _0xcf67d7=_0x4312[_0x2c1483];return _0xcf67d7;};'use strict';var Sequelize=require(_0x2431('0x0'));var moment=require(_0x2431('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2431('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x2431('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f45b6c3..b96d1f6 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(_0x59c765,_0x1b14cb){var _0x731b6d=function(_0x358491){while(--_0x358491){_0x59c765['push'](_0x59c765['shift']());}};_0x731b6d(++_0x1b14cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x12607c,_0x3b557a){var _0x3679a7=function(_0x28589d){while(--_0x28589d){_0x12607c['push'](_0x12607c['shift']());}};_0x3679a7(++_0x3b557a);}(_0xb10b,0x12a));var _0xbb10=function(_0x39b7d8,_0xa44989){_0x39b7d8=_0x39b7d8-0x0;var _0x42d6dd=_0xb10b[_0x39b7d8];return _0x42d6dd;};'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 bb1189f..b7f744f 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 _0x2ef3=['path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf3a72e,_0x29058f){var _0x44a7df=function(_0x509201){while(--_0x509201){_0xf3a72e['push'](_0xf3a72e['shift']());}};_0x44a7df(++_0x29058f);}(_0x2ef3,0xba));var _0x32ef=function(_0x3b147f,_0x5ef7f0){_0x3b147f=_0x3b147f-0x0;var _0x1c5283=_0x2ef3[_0x3b147f];return _0x1c5283;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xe'),_0x32ef('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x27a0=['../../config/logger','api','moment','bluebird','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x27a0,0xbf));var _0x027a=function(_0x15744f,_0x28b6eb){_0x15744f=_0x15744f-0x0;var _0x3530e8=_0x27a0[_0x15744f];return _0x3530e8;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x027a('0x9'),'fields':[_0x027a('0xa'),_0x027a('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7494a6a..5642ab9 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 _0x4cf8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0x1a5281,_0x2a464b){var _0x32c969=function(_0x16fa83){while(--_0x16fa83){_0x1a5281['push'](_0x1a5281['shift']());}};_0x32c969(++_0x2a464b);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x4cf8[_0x1b3a5c];return _0x2ae8cb;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xe5b5[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 005f534..25b34e9 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(_0x1178a1,_0x1b9ac8){var _0x4f6545=function(_0x229f71){while(--_0x229f71){_0x1178a1['push'](_0x1178a1['shift']());}};_0x4f6545(++_0x1b9ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x25ee92,_0x2610cc){var _0x2c3454=function(_0x389dcc){while(--_0x389dcc){_0x25ee92['push'](_0x25ee92['shift']());}};_0x2c3454(++_0x2610cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 37d84cd..c49efd4 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 _0x35fe=['channel','setDataValue','membername','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','exports','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x7e2dfa,_0x38ed0e){var _0x2fd6d0=function(_0x333316){while(--_0x333316){_0x7e2dfa['push'](_0x7e2dfa['shift']());}};_0x2fd6d0(++_0x38ed0e);}(_0x35fe,0xfe));var _0xe35f=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x35fe[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');module[_0xe35f('0x0')]={'format':{'type':Sequelize[_0xe35f('0x1')],'get':function(){return this[_0xe35f('0x2')](_0xe35f('0x3'))?path[_0xe35f('0x4')](this[_0xe35f('0x2')](_0xe35f('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xe35f('0x5')]},'channel':{'type':Sequelize[_0xe35f('0x5')],'set':function(_0x37d1bf){if(_0x37d1bf){this['setDataValue'](_0xe35f('0x6'),_0x37d1bf);this[_0xe35f('0x7')](_0xe35f('0x8'),_0x37d1bf['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe35f('0x5')]},'connectedlinenum':{'type':Sequelize[_0xe35f('0x5')]},'connectedlinename':{'type':Sequelize[_0xe35f('0x5')]},'accountcode':{'type':Sequelize[_0xe35f('0x5')]},'context':{'type':Sequelize[_0xe35f('0x5')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe35f('0x5')]},'rating':{'type':Sequelize[_0xe35f('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe35f('0x5')]},'userDisposition':{'type':Sequelize[_0xe35f('0x5')]},'location':{'type':Sequelize[_0xe35f('0xa')]},'transcribeName':{'type':Sequelize[_0xe35f('0x5')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xe35f('0xb')},'fileUri':{'type':Sequelize[_0xe35f('0xa')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xe35f('0xa')]},'sentiment':{'type':Sequelize[_0xe35f('0x5')]},'sPositive':{'type':Sequelize[_0xe35f('0xc')]},'sNegative':{'type':Sequelize[_0xe35f('0xc')]},'sNeutral':{'type':Sequelize[_0xe35f('0xc')]},'sMixed':{'type':Sequelize[_0xe35f('0xc')]},'tempSentiment':{'type':Sequelize[_0xe35f('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xe35f('0xe')],'get':function(){return moment(this[_0xe35f('0x2')](_0xe35f('0xf')))['format'](_0xe35f('0x10'))[_0xe35f('0x11')]();}},'updatedAt':{'type':Sequelize[_0xe35f('0xe')],'get':function(){return moment(this[_0xe35f('0x2')](_0xe35f('0x12')))[_0xe35f('0x13')](_0xe35f('0x10'))[_0xe35f('0x11')]();}}}; \ No newline at end of file +var _0xe206=['getDataValue','value','extname','STRING','channel','setDataValue','membername','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','format','moment','path'];(function(_0x5c22f9,_0x20e9fa){var _0x3447ae=function(_0x3a0180){while(--_0x3a0180){_0x5c22f9['push'](_0x5c22f9['shift']());}};_0x3447ae(++_0x20e9fa);}(_0xe206,0x1e4));var _0x6e20=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xe206[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6e20('0x0'));var path=require(_0x6e20('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6e20('0x2')](_0x6e20('0x3'))?path[_0x6e20('0x4')](this['getDataValue'](_0x6e20('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6e20('0x5')]},'channel':{'type':Sequelize[_0x6e20('0x5')],'set':function(_0x56d46b){if(_0x56d46b){this['setDataValue'](_0x6e20('0x6'),_0x56d46b);this[_0x6e20('0x7')](_0x6e20('0x8'),_0x56d46b['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6e20('0x5')]},'connectedlinenum':{'type':Sequelize[_0x6e20('0x5')]},'connectedlinename':{'type':Sequelize[_0x6e20('0x5')]},'accountcode':{'type':Sequelize[_0x6e20('0x5')]},'context':{'type':Sequelize[_0x6e20('0x5')]},'exten':{'type':Sequelize[_0x6e20('0x5')]},'value':{'type':Sequelize[_0x6e20('0x5')]},'type':{'type':Sequelize[_0x6e20('0x5')]},'rating':{'type':Sequelize[_0x6e20('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6e20('0x5')]},'userDisposition':{'type':Sequelize[_0x6e20('0x5')]},'location':{'type':Sequelize[_0x6e20('0xa')]},'transcribeName':{'type':Sequelize[_0x6e20('0x5')]},'transcribeStatus':{'type':Sequelize[_0x6e20('0x5')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x6e20('0xa')]},'failureReason':{'type':Sequelize[_0x6e20('0xa')]},'sentiment':{'type':Sequelize[_0x6e20('0x5')]},'sPositive':{'type':Sequelize[_0x6e20('0xb')]},'sNegative':{'type':Sequelize[_0x6e20('0xb')]},'sNeutral':{'type':Sequelize[_0x6e20('0xb')]},'sMixed':{'type':Sequelize[_0x6e20('0xb')]},'tempSentiment':{'type':Sequelize[_0x6e20('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x6e20('0xd')],'get':function(){return moment(this['getDataValue'](_0x6e20('0xe')))['format'](_0x6e20('0xf'))[_0x6e20('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6e20('0x2')]('updatedAt'))[_0x6e20('0x11')](_0x6e20('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f9f6669..78ad1bd 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 _0x0ea7=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','token','push','$and','extname','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','recording','Voice\x20Recording\x20not\x20found','transcribe','language','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','type','key','model','differenceBy','format','query'];(function(_0x3fcd97,_0x477632){var _0x47f5f1=function(_0x32213f){while(--_0x32213f){_0x3fcd97['push'](_0x3fcd97['shift']());}};_0x47f5f1(++_0x477632);}(_0x0ea7,0xfb));var _0x70ea=function(_0x21d09a,_0x20bf0d){_0x21d09a=_0x21d09a-0x0;var _0x1848c9=_0x0ea7[_0x21d09a];return _0x1848c9;};'use strict';var pdf=require(_0x70ea('0x0'));var emlformat=require(_0x70ea('0x1'));var rimraf=require(_0x70ea('0x2'));var zipdir=require(_0x70ea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70ea('0x4'));var moment=require(_0x70ea('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x70ea('0x6'));var util=require(_0x70ea('0x7'));var path=require(_0x70ea('0x8'));var sox=require(_0x70ea('0x9'));var csv=require(_0x70ea('0xa'));var ejs=require(_0x70ea('0xb'));var fs=require('fs');var _=require(_0x70ea('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x70ea('0xd'));var deskjs=require(_0x70ea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x70ea('0xf'));var Papa=require(_0x70ea('0x10'));var AWS=require(_0x70ea('0x11'));var uuidv4=require(_0x70ea('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70ea('0x13'));var hardwareService=require(_0x70ea('0x14'));var logger=require(_0x70ea('0x15'))(_0x70ea('0x16'));var utils=require(_0x70ea('0x17'));var config=require(_0x70ea('0x18'));var db=require(_0x70ea('0x19'))['db'];function respondWithStatusCode(_0x410447,_0x4c9c4b){_0x4c9c4b=_0x4c9c4b||0xcc;return function(_0x1c8754){if(_0x1c8754){return _0x410447[_0x70ea('0x1a')](_0x4c9c4b);}return _0x410447[_0x70ea('0x1b')](_0x4c9c4b)[_0x70ea('0x1c')]();};}function respondWithResult(_0x5d2610,_0x577ce9){_0x577ce9=_0x577ce9||0xc8;return function(_0x5ef413){if(_0x5ef413){return _0x5d2610[_0x70ea('0x1b')](_0x577ce9)[_0x70ea('0x1d')](_0x5ef413);}};}function respondWithFilteredResult(_0x302791,_0x4c9bc2){return function(_0x1cfdef){if(_0x1cfdef){var _0x2642b6=_0x1cfdef[_0x70ea('0x1e')],_0x39f37e=_0x4c9bc2[_0x70ea('0x1f')],_0x276816=_0x4c9bc2[_0x70ea('0x1f')]+_0x4c9bc2[_0x70ea('0x20')],_0x4b6bd7;if(_0x276816>=_0x2642b6){_0x276816=_0x2642b6;_0x4b6bd7=0xc8;}else{_0x4b6bd7=0xce;}_0x302791[_0x70ea('0x1b')](_0x4b6bd7);return _0x302791[_0x70ea('0x21')](_0x70ea('0x22'),_0x39f37e+'-'+_0x276816+'/'+_0x2642b6)['json'](_0x1cfdef);}return null;};}function patchUpdates(_0x2105ce){return function(_0x3c38c2){try{jsonpatch[_0x70ea('0x23')](_0x3c38c2,_0x2105ce,!![]);}catch(_0x2c422){return BPromise[_0x70ea('0x24')](_0x2c422);}return _0x3c38c2[_0x70ea('0x25')]();};}function saveUpdates(_0x5b9541,_0x10b6ad){return function(_0x1ca6ab){if(_0x1ca6ab){return _0x1ca6ab[_0x70ea('0x26')](_0x5b9541)[_0x70ea('0x27')](function(_0x4da433){return _0x4da433;});}return null;};}function removeEntity(_0x3a1c94,_0x312cf8){return function(_0x35e5fe){if(_0x35e5fe){return _0x35e5fe[_0x70ea('0x28')]()['then'](function(){_0x3a1c94[_0x70ea('0x1b')](0xcc)[_0x70ea('0x1c')]();});}};}function handleEntityNotFound(_0x5e1728,_0x12ee5a){return function(_0x43b424){if(!_0x43b424){_0x5e1728[_0x70ea('0x1a')](0x194);}return _0x43b424;};}function handleError(_0xa31c3a,_0x4d4d5b){_0x4d4d5b=_0x4d4d5b||0x1f4;return function(_0x224f30){logger['error'](_0x224f30[_0x70ea('0x29')]);if(_0x224f30[_0x70ea('0x2a')]){delete _0x224f30[_0x70ea('0x2a')];}_0xa31c3a[_0x70ea('0x1b')](_0x4d4d5b)[_0x70ea('0x2b')](_0x224f30);};}exports[_0x70ea('0x2c')]=function(_0xda706c,_0x378ded){var _0x57cd95={},_0x3132e3={},_0x3cbf62={'count':0x0,'rows':[]};var _0x21b273=_[_0x70ea('0x2d')](db['VoiceRecording']['rawAttributes'],function(_0x5c513e){return{'name':_0x5c513e[_0x70ea('0x2e')],'type':_0x5c513e[_0x70ea('0x2f')][_0x70ea('0x30')]};});_0x3132e3[_0x70ea('0x31')]=_[_0x70ea('0x32')](_[_0x70ea('0x2d')](_0x21b273,_0x70ea('0x2a')),[_0x70ea('0x33')]);_0x3132e3[_0x70ea('0x34')]=_[_0x70ea('0x35')](_0xda706c[_0x70ea('0x34')]);_0x3132e3[_0x70ea('0x36')]=_[_0x70ea('0x37')](_0x3132e3[_0x70ea('0x31')],_0x3132e3[_0x70ea('0x34')]);_0x57cd95[_0x70ea('0x38')]=_['intersection'](_0x3132e3[_0x70ea('0x31')],qs[_0x70ea('0x39')](_0xda706c[_0x70ea('0x34')]['fields']));_0x57cd95['attributes']=_0x57cd95[_0x70ea('0x38')][_0x70ea('0x3a')]?_0x57cd95['attributes']:_0x3132e3['model'];if(!_0xda706c['query'][_0x70ea('0x3b')](_0x70ea('0x3c'))){_0x57cd95['limit']=qs['limit'](_0xda706c['query'][_0x70ea('0x20')]);_0x57cd95['offset']=qs[_0x70ea('0x1f')](_0xda706c[_0x70ea('0x34')][_0x70ea('0x1f')]);}_0x57cd95[_0x70ea('0x3d')]=qs['sort'](_0xda706c[_0x70ea('0x34')]['sort']);_0x57cd95[_0x70ea('0x3e')]=qs[_0x70ea('0x36')](_[_0x70ea('0x3f')](_0xda706c[_0x70ea('0x34')],_0x3132e3[_0x70ea('0x36')]),_0x21b273);if(_0xda706c['query'][_0x70ea('0x40')]){_0x57cd95[_0x70ea('0x3e')]=_[_0x70ea('0x41')](_0x57cd95['where'],{'$or':_[_0x70ea('0x2d')](_0x21b273,function(_0x24fcbd){if(_0x24fcbd[_0x70ea('0x2f')]!==_0x70ea('0x42')){var _0x1ce4f1={};_0x1ce4f1[_0x24fcbd['name']]={'$like':'%'+_0xda706c['query']['filter']+'%'};return _0x1ce4f1;}})});}_0x57cd95=_[_0x70ea('0x41')]({},_0x57cd95,_0xda706c[_0x70ea('0x43')]);var _0xf1b462={'where':_0x57cd95[_0x70ea('0x3e')]};return db[_0x70ea('0x44')][_0x70ea('0x1e')](_0xf1b462)[_0x70ea('0x27')](function(_0x210377){_0x3cbf62[_0x70ea('0x1e')]=_0x210377;if(_0xda706c[_0x70ea('0x34')][_0x70ea('0x45')]){_0x57cd95[_0x70ea('0x46')]=[{'all':!![]}];}return db[_0x70ea('0x44')]['findAll'](_0x57cd95);})['then'](function(_0x59352b){_0x3cbf62[_0x70ea('0x47')]=_0x59352b;return _0x3cbf62;})['then'](respondWithFilteredResult(_0x378ded,_0x57cd95))['catch'](handleError(_0x378ded,null));};exports[_0x70ea('0x48')]=function(_0x5235f2,_0x55c3eb){var _0x4fa114={'raw':![],'where':{'id':_0x5235f2[_0x70ea('0x49')]['id']}},_0x52ac5b={};_0x52ac5b[_0x70ea('0x31')]=_[_0x70ea('0x35')](db[_0x70ea('0x44')][_0x70ea('0x4a')]);_0x52ac5b[_0x70ea('0x34')]=_['keys'](_0x5235f2[_0x70ea('0x34')]);_0x52ac5b[_0x70ea('0x36')]=_[_0x70ea('0x37')](_0x52ac5b[_0x70ea('0x31')],_0x52ac5b[_0x70ea('0x34')]);_0x4fa114[_0x70ea('0x38')]=_['intersection'](_0x52ac5b[_0x70ea('0x31')],qs[_0x70ea('0x39')](_0x5235f2[_0x70ea('0x34')][_0x70ea('0x39')]));_0x4fa114[_0x70ea('0x38')]=_0x4fa114['attributes'][_0x70ea('0x3a')]?_0x4fa114['attributes']:_0x52ac5b[_0x70ea('0x31')];if(_0x5235f2[_0x70ea('0x34')][_0x70ea('0x45')]){_0x4fa114[_0x70ea('0x46')]=[{'all':!![]}];}_0x4fa114=_[_0x70ea('0x41')]({},_0x4fa114,_0x5235f2['options']);return db['VoiceRecording'][_0x70ea('0x4b')](_0x4fa114)['then'](handleEntityNotFound(_0x55c3eb,null))['then'](respondWithResult(_0x55c3eb,null))[_0x70ea('0x4c')](handleError(_0x55c3eb,null));};exports[_0x70ea('0x4d')]=function(_0xd7e6df,_0x82879b){return db['VoiceRecording'][_0x70ea('0x4d')](_0xd7e6df[_0x70ea('0x4e')],{})[_0x70ea('0x27')](respondWithResult(_0x82879b,0xc9))[_0x70ea('0x4c')](handleError(_0x82879b,null));};exports['update']=function(_0x141f54,_0x7a4950){if(_0x141f54[_0x70ea('0x4e')]['id']){delete _0x141f54[_0x70ea('0x4e')]['id'];}return db[_0x70ea('0x44')]['find']({'where':{'id':_0x141f54[_0x70ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x7a4950,null))[_0x70ea('0x27')](saveUpdates(_0x141f54[_0x70ea('0x4e')],null))[_0x70ea('0x27')](respondWithResult(_0x7a4950,null))[_0x70ea('0x4c')](handleError(_0x7a4950,null));};exports[_0x70ea('0x4f')]=function(_0x8d8376,_0x264137){return db[_0x70ea('0x44')][_0x70ea('0x4f')]()[_0x70ea('0x27')](respondWithResult(_0x264137,null))[_0x70ea('0x4c')](handleError(_0x264137,null));};exports[_0x70ea('0x50')]=function(_0x168bb1,_0x38bac3,_0x49c328){var _0x544585=require('../../components/encryptor');var _0x21e6a4=![];var _0x17ed56={};if(_0x168bb1[_0x70ea('0x34')][_0x70ea('0x2f')]&&_0x168bb1['query'][_0x70ea('0x2f')]===_0x70ea('0x51')){_0x17ed56[_0x70ea('0x51')]=_0x168bb1[_0x70ea('0x49')]['id'];}else{_0x17ed56['id']=_0x168bb1[_0x70ea('0x49')]['id'];}return db[_0x70ea('0x44')][_0x70ea('0x4b')]({'where':_0x17ed56,'attributes':['id','value'],'raw':!![]})[_0x70ea('0x27')](handleEntityNotFound(_0x38bac3,null))[_0x70ea('0x27')](function(_0x219541){if(_0x219541){var _0x348259=_0x219541[_0x70ea('0x52')];var _0x54ed1b=util[_0x70ea('0x33')](_0x70ea('0x53'),_0x348259);if(fs['existsSync'](_0x54ed1b)){_0x21e6a4=!![];return _0x544585[_0x70ea('0x54')](_0x54ed1b,_0x348259,config[_0x70ea('0x55')]['recording'])[_0x70ea('0x27')](function(){return _0x219541;});}return _0x219541;}})['then'](function(_0x67ce35){if(_0x67ce35){var _0x4f5eed=_0x67ce35[_0x70ea('0x52')];if(!fs[_0x70ea('0x56')](_0x4f5eed)){throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x67ce35[_0x70ea('0x59')]){return _0x38bac3['download'](_0x4f5eed,_0x67ce35['filename']+path['extname'](_0x4f5eed),function(){if(_0x21e6a4){fs[_0x70ea('0x5a')](_0x4f5eed);}});}else{return _0x38bac3[_0x70ea('0x50')](_0x4f5eed,function(_0x20ac49){if(_0x21e6a4){fs[_0x70ea('0x5a')](_0x4f5eed);}});}}})[_0x70ea('0x4c')](function(_0xe5a3dd){if(_0xe5a3dd[_0x70ea('0x5b')]===_0x70ea('0x5c')){_0x38bac3['status'](0x194)[_0x70ea('0x2b')]('Not\x20found');}else{return handleError(_0x38bac3,null);}});};exports[_0x70ea('0x5d')]=function(_0x5856f7,_0x533284,_0x3c9fc9){var _0x5d25dc=require('../../components/encryptor');var _0x1cb5a1=![];var _0x5be348={'$and':[db[_0x70ea('0x5e')][_0x70ea('0x3e')](db[_0x70ea('0x5e')]['fn'](_0x70ea('0x5f'),db['sequelize'][_0x70ea('0x60')](_0x70ea('0x51'))),_0x5856f7[_0x70ea('0x34')][_0x70ea('0x61')])]};if(_0x5856f7[_0x70ea('0x34')]['type']&&_0x5856f7[_0x70ea('0x34')]['type']===_0x70ea('0x51')){_0x5be348['$and'][_0x70ea('0x62')]({'uniqueid':_0x5856f7[_0x70ea('0x49')]['id']});}else{_0x5be348[_0x70ea('0x63')][_0x70ea('0x62')]({'id':_0x5856f7[_0x70ea('0x49')]['id']});}return db['VoiceRecording']['find']({'where':_0x5be348,'attributes':['id',_0x70ea('0x52')],'raw':!![]})[_0x70ea('0x27')](handleEntityNotFound(_0x533284,null))[_0x70ea('0x27')](function(_0x172d2b){if(_0x172d2b){var _0x14306b=util[_0x70ea('0x33')](_0x70ea('0x53'),_0x172d2b[_0x70ea('0x52')]);if(fs[_0x70ea('0x56')](_0x14306b)){_0x1cb5a1=!![];return _0x5d25dc[_0x70ea('0x54')](_0x14306b,_0x172d2b['value'],config[_0x70ea('0x55')]['recording'])['then'](function(){return _0x172d2b;});}return _0x172d2b;}})[_0x70ea('0x27')](function(_0x2ff734){if(_0x2ff734){if(!fs['existsSync'](_0x2ff734[_0x70ea('0x52')])){throw new db[(_0x70ea('0x57'))]['ValidationError'](_0x70ea('0x5c'));}if(_0x2ff734[_0x70ea('0x59')]){return _0x533284['download'](_0x2ff734[_0x70ea('0x52')],_0x2ff734['filename']+path[_0x70ea('0x64')](_0x2ff734[_0x70ea('0x52')]),function(){if(_0x1cb5a1){fs['unlink'](_0x2ff734[_0x70ea('0x52')]);}});}else{return _0x533284[_0x70ea('0x50')](_0x2ff734[_0x70ea('0x52')],function(_0x118ee0){if(_0x1cb5a1){fs[_0x70ea('0x5a')](_0x2ff734[_0x70ea('0x52')]);}});}}})['catch'](handleError(_0x533284,null));};exports[_0x70ea('0x28')]=function(_0x5e70af,_0x7f8ff5){return db[_0x70ea('0x44')]['find']({'where':{'id':_0x5e70af['params']['id']}})[_0x70ea('0x27')](function(_0x1a530b){if(!_0x1a530b)throw new ReferenceError('Entity\x20not\x20found');return _0x1a530b;})[_0x70ea('0x27')](function(_0x2c758a){var _0x387d50=_0x2c758a[_0x70ea('0x52')];logger[_0x70ea('0x65')](_0x70ea('0x66'),_0x387d50);if(!_['isNil'](_0x2c758a[_0x70ea('0x52')])&&fs['existsSync'](_0x387d50)){logger[_0x70ea('0x65')]('File:\x20\x22'+_0x387d50+_0x70ea('0x67'));fs[_0x70ea('0x68')](_0x387d50);}_0x387d50=_0x387d50+_0x70ea('0x69');if(!_['isNil'](_0x2c758a['value'])&&fs[_0x70ea('0x56')](_0x387d50)){logger[_0x70ea('0x65')](_0x70ea('0x6a')+_0x387d50+_0x70ea('0x67'));fs['unlinkSync'](_0x387d50);}return _0x2c758a;})[_0x70ea('0x27')](function(_0x21684c){if(!_0x21684c)throw new InternalError();return _0x21684c['destroy']();})['then'](function(){_0x7f8ff5['status'](0xcc)[_0x70ea('0x1c')]();})[_0x70ea('0x4c')](handleError(_0x7f8ff5,null));};function getBucketslist(_0x4f2641,_0x4f8b89,_0x3202f4){return new Promise(function(_0x3fdb95,_0x1aa4c9){var _0x478a5e=new AWS['S3']({'accessKeyId':_0x4f8b89,'secretAccessKey':_0x4f2641,'region':_0x3202f4});_0x478a5e[_0x70ea('0x6b')]({},function(_0x2a1340,_0x22e4cb){if(_0x2a1340){return _0x1aa4c9(_0x2a1340);}else{return _0x3fdb95(_0x22e4cb);}});});}function createBucket(_0x5aa5f5,_0x23d481,_0x4c6ab1,_0x225812){return new Promise(function(_0x38ee47,_0x1da1fd){var _0x336854=new AWS['S3']({'accessKeyId':_0x23d481,'secretAccessKey':_0x5aa5f5,'region':_0x4c6ab1});_0x336854[_0x70ea('0x6c')]({'Bucket':_0x225812},function(_0x22e682,_0x7ec70e){if(_0x22e682){return _0x1da1fd(_0x22e682);}else{return _0x38ee47(_0x7ec70e);}});});}function uploadFile(_0x18d97d,_0x4f7543,_0x534bf7,_0x1857b9,_0x423211,_0x4348fb){return new Promise(function(_0xf49b67,_0x402d9c){var _0x4ecffe=new AWS['S3']({'accessKeyId':_0x4f7543,'secretAccessKey':_0x18d97d,'region':_0x534bf7});_0x4ecffe[_0x70ea('0x6d')]({'Bucket':_0x1857b9,'Key':_0x423211,'Body':_0x4348fb},function(_0x21e63d,_0x24cbe9){if(_0x21e63d){return _0x402d9c(_0x21e63d);}else{return _0xf49b67(_0x24cbe9);}});});}function startTranscribe(_0xca188c,_0x305f57,_0x1e5ce5,_0x3f25d8,_0x429eb7,_0xd19457){return new Promise(function(_0x190f75,_0x4895f2){var _0x731f41=new AWS['TranscribeService']({'accessKeyId':_0x305f57,'secretAccessKey':_0xca188c,'region':_0x1e5ce5});_0x731f41[_0x70ea('0x6e')]({'TranscriptionJobName':_0x3f25d8,'LanguageCode':_0x429eb7,'Media':{'MediaFileUri':_0xd19457}},function(_0x31f026,_0x2203a3){if(_0x31f026){return _0x4895f2(_0x31f026);}else{return _0x190f75(_0x2203a3);}});});}function transcribe(_0x2e1693,_0x4d93a,_0x5887ff,_0x521df3,_0x4a269c,_0x16786b,_0x76ec40){return new Promise(function(_0x1a59a1,_0x364418){var _0x36e987={};logger[_0x70ea('0x65')](util[_0x70ea('0x33')](_0x70ea('0x6f'),_0x2e1693,_0x4a269c));return uploadFile(_0x4d93a,_0x5887ff,_0x521df3,_0x4a269c,path['basename'](_0x16786b),fs[_0x70ea('0x70')](_0x16786b))[_0x70ea('0x27')](function(_0xf55b1d){logger[_0x70ea('0x65')](util[_0x70ea('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2e1693,_0x4a269c,_0xf55b1d[_0x70ea('0x71')]));_0x36e987[_0x70ea('0x72')]=_0xf55b1d[_0x70ea('0x73')];_0x36e987[_0x70ea('0x74')]=_0xf55b1d[_0x70ea('0x71')];logger[_0x70ea('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2e1693));return startTranscribe(_0x4d93a,_0x5887ff,_0x521df3,uuidv4(),_0x76ec40,_0xf55b1d[_0x70ea('0x71')]);})[_0x70ea('0x27')](function(_0x230489){logger['info'](util['format'](_0x70ea('0x75'),_0x2e1693,_0x230489['TranscriptionJob'][_0x70ea('0x76')]));_0x36e987[_0x70ea('0x77')]=_0x230489['TranscriptionJob'][_0x70ea('0x76')];_0x36e987[_0x70ea('0x78')]=_0x230489['TranscriptionJob'][_0x70ea('0x79')];return _0x1a59a1(_0x36e987);})['catch'](function(_0x2b3ebe){return _0x364418(_0x2b3ebe);});});}exports[_0x70ea('0x7a')]=function(_0x444108,_0xcd091c,_0x401b17){var _0x5f4a41;var _0x27292a;var _0x548038;var _0x5aa7c9=require(_0x70ea('0x7b'));return db[_0x70ea('0x44')][_0x70ea('0x7c')]({'where':{'id':_0x444108['params']['id']}})['then'](function(_0x4be23a){if(_0x4be23a){var _0x2c3893=util['format'](_0x70ea('0x53'),_0x4be23a[_0x70ea('0x52')]);if(fs[_0x70ea('0x56')](_0x2c3893)){cypher=!![];return _0x5aa7c9[_0x70ea('0x54')](_0x2c3893,_0x4be23a[_0x70ea('0x52')],config[_0x70ea('0x55')][_0x70ea('0x7d')])['then'](function(){return _0x4be23a;});}return _0x4be23a;}})['then'](function(_0x3655e7){if(!_0x3655e7){throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))](_0x70ea('0x7e'));}_0x27292a=_0x3655e7;return db['Setting'][_0x70ea('0x7c')]({'where':{'id':0x1}});})[_0x70ea('0x27')](handleEntityNotFound(_0xcd091c,null))['then'](function(_0x578bef){if(_0x578bef){_0x5f4a41=_0x578bef;if(!_0x5f4a41[_0x70ea('0x7f')]||!_0x5f4a41['transcribeAccountId']||!_0x5f4a41['transcribeRegion']||!_0x5f4a41[_0x70ea('0x80')]||!_0x5f4a41[_0x70ea('0x72')]){throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))]('Transcribe\x20not\x20configured');}if(_0x444108[_0x70ea('0x4e')]['runSentiment']&&(!_0x5f4a41[_0x70ea('0x81')]||!_0x5f4a41[_0x70ea('0x82')]||!_0x5f4a41[_0x70ea('0x83')]||!_0x5f4a41[_0x70ea('0x80')]||!_0x5f4a41[_0x70ea('0x72')])){throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))](_0x70ea('0x84'));}return db[_0x70ea('0x85')]['findOne']({'where':{'id':_0x5f4a41['transcribeAccountId']}});}})[_0x70ea('0x27')](function(_0x5d9ad8){if(!_0x5d9ad8){throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))](_0x70ea('0x86'));}if(!_0x5d9ad8[_0x70ea('0x87')]||!_0x5d9ad8['data2']){throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))](_0x70ea('0x88'));}_0x548038=_0x5d9ad8;return getBucketslist(_0x548038[_0x70ea('0x87')],_0x548038[_0x70ea('0x89')],_0x5f4a41['transcribeRegion']);})[_0x70ea('0x27')](function(_0x293530){if(_0x293530&&_0x293530[_0x70ea('0x8a')]){var _0x2a0811=_[_0x70ea('0x4b')](_0x293530[_0x70ea('0x8a')],function(_0x437d6f){return _0x437d6f['Name']===_0x5f4a41['bucket'];});if(!_0x2a0811){logger['info'](util[_0x70ea('0x33')](_0x70ea('0x8b'),_0x444108[_0x70ea('0x49')]['id'],_0x5f4a41['bucket']));return createBucket(_0x548038[_0x70ea('0x87')],_0x548038['data2'],_0x5f4a41[_0x70ea('0x8c')],_0x5f4a41[_0x70ea('0x72')]);}logger[_0x70ea('0x65')](util[_0x70ea('0x33')](_0x70ea('0x8d'),_0x444108[_0x70ea('0x49')]['id'],_0x5f4a41[_0x70ea('0x72')]));return;}})[_0x70ea('0x27')](function(_0x56d322){if(_0x27292a['transcribeStatus']===_0x70ea('0x8e')){return transcribe(_0x444108['params']['id'],_0x548038[_0x70ea('0x87')],_0x548038[_0x70ea('0x89')],_0x5f4a41['transcribeRegion'],_0x5f4a41['bucket'],_0x27292a[_0x70ea('0x52')],_0x5f4a41[_0x70ea('0x80')]);}else{logger[_0x70ea('0x65')](util[_0x70ea('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x444108[_0x70ea('0x49')]['id']));return{'transcribeStatus':_0x70ea('0x8f')};}})[_0x70ea('0x27')](function(_0x40b529){if(_0x40b529){_0x40b529['tempSentiment']=_0x444108[_0x70ea('0x4e')][_0x70ea('0x90')];return _0x27292a[_0x70ea('0x91')](_0x40b529);}})[_0x70ea('0x27')](respondWithResult(_0xcd091c,null))[_0x70ea('0x4c')](handleError(_0xcd091c,null));};function writeFile(_0x52bff5,_0x466dc0){return new Promise(function(_0xde07ad,_0x48c104){fs[_0x70ea('0x92')](_0x466dc0,_0x52bff5,function(_0x2f98d4,_0x1fe27a){if(_0x2f98d4){return _0x48c104(_0x2f98d4);}else{return _0xde07ad(_0x1fe27a);}});});}exports[_0x70ea('0x93')]=function(_0x167dc4,_0x471816,_0xa45ac){return db['VoiceRecording']['findOne']({'where':{'id':_0x167dc4[_0x70ea('0x49')]['id']}})[_0x70ea('0x27')](handleEntityNotFound(_0x471816))[_0x70ea('0x27')](function(_0x1d77b1){if(_0x1d77b1&&_0x1d77b1[_0x70ea('0x94')]){var _0xf8e6d2=_0x1d77b1[_0x70ea('0x94')];var _0xe8d65f=config[_0x70ea('0x95')]+_0x70ea('0x96')+_0x1d77b1['id']+'.txt';if(fs[_0x70ea('0x56')](_0xe8d65f)){return _0xe8d65f;}return writeFile(_0xf8e6d2,_0xe8d65f)[_0x70ea('0x27')](function(){return _0xe8d65f;});}else{throw new db[(_0x70ea('0x57'))][(_0x70ea('0x58'))](_0x70ea('0x97'));}})['then'](function(_0x3af933){return _0x471816['download'](_0x3af933);})['catch'](handleError(_0x471816));}; \ No newline at end of file +var _0xad5a=['language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','VoiceRecording','include','findAll','rows','catch','show','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','sequelize','MD5','$and','push','Sequelize','params','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentiment','sentimentAccountId','sentimentRegion'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xad5a,0x13f));var _0xaad5=function(_0x5d21a7,_0x421d02){_0x5d21a7=_0x5d21a7-0x0;var _0x1d8b86=_0xad5a[_0x5d21a7];return _0x1d8b86;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaad5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaad5('0x1'));var rp=require(_0xaad5('0x2'));var moment=require('moment');var BPromise=require(_0xaad5('0x3'));var Mustache=require(_0xaad5('0x4'));var util=require(_0xaad5('0x5'));var path=require(_0xaad5('0x6'));var sox=require(_0xaad5('0x7'));var csv=require('to-csv');var ejs=require(_0xaad5('0x8'));var fs=require('fs');var _=require(_0xaad5('0x9'));var squel=require(_0xaad5('0xa'));var crypto=require(_0xaad5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaad5('0xc'));var toCsv=require(_0xaad5('0xd'));var querystring=require(_0xaad5('0xe'));var Papa=require(_0xaad5('0xf'));var AWS=require(_0xaad5('0x10'));var uuidv4=require(_0xaad5('0x11'));var Redis=require(_0xaad5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaad5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaad5('0x14'))('api');var utils=require(_0xaad5('0x15'));var config=require(_0xaad5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108f51,_0x1862e5){_0x1862e5=_0x1862e5||0xcc;return function(_0x31b860){if(_0x31b860){return _0x108f51['sendStatus'](_0x1862e5);}return _0x108f51[_0xaad5('0x17')](_0x1862e5)[_0xaad5('0x18')]();};}function respondWithResult(_0x40d4a1,_0x4d2628){_0x4d2628=_0x4d2628||0xc8;return function(_0x5d2be0){if(_0x5d2be0){return _0x40d4a1[_0xaad5('0x17')](_0x4d2628)[_0xaad5('0x19')](_0x5d2be0);}};}function respondWithFilteredResult(_0x53214c,_0xb8c267){return function(_0x497108){if(_0x497108){var _0xde25b2=_0x497108[_0xaad5('0x1a')],_0x4f1f0a=_0xb8c267['offset'],_0x1a3c8d=_0xb8c267[_0xaad5('0x1b')]+_0xb8c267[_0xaad5('0x1c')],_0x247602;if(_0x1a3c8d>=_0xde25b2){_0x1a3c8d=_0xde25b2;_0x247602=0xc8;}else{_0x247602=0xce;}_0x53214c[_0xaad5('0x17')](_0x247602);return _0x53214c[_0xaad5('0x1d')]('Content-Range',_0x4f1f0a+'-'+_0x1a3c8d+'/'+_0xde25b2)[_0xaad5('0x19')](_0x497108);}return null;};}function patchUpdates(_0x9bae8){return function(_0x354d55){try{jsonpatch[_0xaad5('0x1e')](_0x354d55,_0x9bae8,!![]);}catch(_0xc688f4){return BPromise['reject'](_0xc688f4);}return _0x354d55[_0xaad5('0x1f')]();};}function saveUpdates(_0x5f0b51,_0x244ae9){return function(_0x525d3e){if(_0x525d3e){return _0x525d3e[_0xaad5('0x20')](_0x5f0b51)[_0xaad5('0x21')](function(_0x520ae9){return _0x520ae9;});}return null;};}function removeEntity(_0x646f55,_0x23885c){return function(_0x39a09b){if(_0x39a09b){return _0x39a09b[_0xaad5('0x22')]()[_0xaad5('0x21')](function(){_0x646f55['status'](0xcc)[_0xaad5('0x18')]();});}};}function handleEntityNotFound(_0x53d006,_0x3d653d){return function(_0x2c189f){if(!_0x2c189f){_0x53d006[_0xaad5('0x23')](0x194);}return _0x2c189f;};}function handleError(_0x4efe51,_0x3de35e){_0x3de35e=_0x3de35e||0x1f4;return function(_0x41c502){logger[_0xaad5('0x24')](_0x41c502[_0xaad5('0x25')]);if(_0x41c502[_0xaad5('0x26')]){delete _0x41c502[_0xaad5('0x26')];}_0x4efe51[_0xaad5('0x17')](_0x3de35e)[_0xaad5('0x27')](_0x41c502);};}exports[_0xaad5('0x28')]=function(_0x3bd60e,_0x2b99aa){var _0x60bc07={},_0x47c7ce={},_0x38bbbc={'count':0x0,'rows':[]};var _0x1aa3cb=_[_0xaad5('0x29')](db['VoiceRecording'][_0xaad5('0x2a')],function(_0x236c1d){return{'name':_0x236c1d[_0xaad5('0x2b')],'type':_0x236c1d[_0xaad5('0x2c')][_0xaad5('0x2d')]};});_0x47c7ce[_0xaad5('0x2e')]=_[_0xaad5('0x2f')](_[_0xaad5('0x29')](_0x1aa3cb,_0xaad5('0x26')),[_0xaad5('0x30')]);_0x47c7ce[_0xaad5('0x31')]=_[_0xaad5('0x32')](_0x3bd60e[_0xaad5('0x31')]);_0x47c7ce[_0xaad5('0x33')]=_[_0xaad5('0x34')](_0x47c7ce[_0xaad5('0x2e')],_0x47c7ce['query']);_0x60bc07[_0xaad5('0x35')]=_[_0xaad5('0x34')](_0x47c7ce[_0xaad5('0x2e')],qs[_0xaad5('0x36')](_0x3bd60e['query'][_0xaad5('0x36')]));_0x60bc07[_0xaad5('0x35')]=_0x60bc07[_0xaad5('0x35')][_0xaad5('0x37')]?_0x60bc07[_0xaad5('0x35')]:_0x47c7ce[_0xaad5('0x2e')];if(!_0x3bd60e[_0xaad5('0x31')][_0xaad5('0x38')](_0xaad5('0x39'))){_0x60bc07[_0xaad5('0x1c')]=qs[_0xaad5('0x1c')](_0x3bd60e[_0xaad5('0x31')]['limit']);_0x60bc07['offset']=qs['offset'](_0x3bd60e[_0xaad5('0x31')][_0xaad5('0x1b')]);}_0x60bc07[_0xaad5('0x3a')]=qs[_0xaad5('0x3b')](_0x3bd60e[_0xaad5('0x31')]['sort']);_0x60bc07['where']=qs['filters'](_['pick'](_0x3bd60e[_0xaad5('0x31')],_0x47c7ce[_0xaad5('0x33')]),_0x1aa3cb);if(_0x3bd60e[_0xaad5('0x31')][_0xaad5('0x3c')]){_0x60bc07[_0xaad5('0x3d')]=_['merge'](_0x60bc07[_0xaad5('0x3d')],{'$or':_[_0xaad5('0x29')](_0x1aa3cb,function(_0x5453a6){if(_0x5453a6['type']!==_0xaad5('0x3e')){var _0x1c514c={};_0x1c514c[_0x5453a6['name']]={'$like':'%'+_0x3bd60e[_0xaad5('0x31')][_0xaad5('0x3c')]+'%'};return _0x1c514c;}})});}_0x60bc07=_[_0xaad5('0x3f')]({},_0x60bc07,_0x3bd60e[_0xaad5('0x40')]);var _0x2f2c1f={'where':_0x60bc07[_0xaad5('0x3d')]};return db[_0xaad5('0x41')][_0xaad5('0x1a')](_0x2f2c1f)['then'](function(_0x3a154c){_0x38bbbc['count']=_0x3a154c;if(_0x3bd60e[_0xaad5('0x31')]['includeAll']){_0x60bc07[_0xaad5('0x42')]=[{'all':!![]}];}return db[_0xaad5('0x41')][_0xaad5('0x43')](_0x60bc07);})[_0xaad5('0x21')](function(_0x2eeaf3){_0x38bbbc[_0xaad5('0x44')]=_0x2eeaf3;return _0x38bbbc;})[_0xaad5('0x21')](respondWithFilteredResult(_0x2b99aa,_0x60bc07))[_0xaad5('0x45')](handleError(_0x2b99aa,null));};exports[_0xaad5('0x46')]=function(_0x447192,_0xe9b2ae){var _0x28a4c4={'raw':![],'where':{'id':_0x447192['params']['id']}},_0xb718ba={};_0xb718ba[_0xaad5('0x2e')]=_[_0xaad5('0x32')](db['VoiceRecording'][_0xaad5('0x2a')]);_0xb718ba[_0xaad5('0x31')]=_['keys'](_0x447192[_0xaad5('0x31')]);_0xb718ba[_0xaad5('0x33')]=_[_0xaad5('0x34')](_0xb718ba[_0xaad5('0x2e')],_0xb718ba[_0xaad5('0x31')]);_0x28a4c4[_0xaad5('0x35')]=_[_0xaad5('0x34')](_0xb718ba[_0xaad5('0x2e')],qs['fields'](_0x447192['query'][_0xaad5('0x36')]));_0x28a4c4['attributes']=_0x28a4c4['attributes'][_0xaad5('0x37')]?_0x28a4c4[_0xaad5('0x35')]:_0xb718ba['model'];if(_0x447192[_0xaad5('0x31')]['includeAll']){_0x28a4c4['include']=[{'all':!![]}];}_0x28a4c4=_[_0xaad5('0x3f')]({},_0x28a4c4,_0x447192[_0xaad5('0x40')]);return db[_0xaad5('0x41')][_0xaad5('0x47')](_0x28a4c4)[_0xaad5('0x21')](handleEntityNotFound(_0xe9b2ae,null))['then'](respondWithResult(_0xe9b2ae,null))[_0xaad5('0x45')](handleError(_0xe9b2ae,null));};exports[_0xaad5('0x48')]=function(_0x327eee,_0x3fcc94){return db[_0xaad5('0x41')][_0xaad5('0x48')](_0x327eee['body'],{})['then'](respondWithResult(_0x3fcc94,0xc9))[_0xaad5('0x45')](handleError(_0x3fcc94,null));};exports[_0xaad5('0x20')]=function(_0x59d81a,_0xf1bbdb){if(_0x59d81a['body']['id']){delete _0x59d81a[_0xaad5('0x49')]['id'];}return db[_0xaad5('0x41')][_0xaad5('0x47')]({'where':{'id':_0x59d81a['params']['id']}})[_0xaad5('0x21')](handleEntityNotFound(_0xf1bbdb,null))['then'](saveUpdates(_0x59d81a[_0xaad5('0x49')],null))[_0xaad5('0x21')](respondWithResult(_0xf1bbdb,null))[_0xaad5('0x45')](handleError(_0xf1bbdb,null));};exports[_0xaad5('0x4a')]=function(_0x3edcb2,_0x12754f){return db[_0xaad5('0x41')][_0xaad5('0x4a')]()[_0xaad5('0x21')](respondWithResult(_0x12754f,null))[_0xaad5('0x45')](handleError(_0x12754f,null));};exports['download']=function(_0x38de20,_0x991bd8,_0x160e4c){var _0x435a7c=require(_0xaad5('0x4b'));var _0x1f1a13=![];var _0x84e5d0={};if(_0x38de20[_0xaad5('0x31')]['type']&&_0x38de20['query'][_0xaad5('0x2c')]==='uniqueid'){_0x84e5d0[_0xaad5('0x4c')]=_0x38de20['params']['id'];}else{_0x84e5d0['id']=_0x38de20['params']['id'];}return db['VoiceRecording']['find']({'where':_0x84e5d0,'attributes':['id',_0xaad5('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x991bd8,null))[_0xaad5('0x21')](function(_0x3e1733){if(_0x3e1733){var _0x4a72b0=_0x3e1733[_0xaad5('0x4d')];var _0x290ea9=util[_0xaad5('0x30')](_0xaad5('0x4e'),_0x4a72b0);if(fs[_0xaad5('0x4f')](_0x290ea9)){_0x1f1a13=!![];return _0x435a7c[_0xaad5('0x50')](_0x290ea9,_0x4a72b0,config[_0xaad5('0x51')][_0xaad5('0x52')])[_0xaad5('0x21')](function(){return _0x3e1733;});}return _0x3e1733;}})['then'](function(_0x320a51){if(_0x320a51){var _0x495a29=_0x320a51[_0xaad5('0x4d')];if(!fs[_0xaad5('0x4f')](_0x495a29)){throw new db['Sequelize'][(_0xaad5('0x53'))](_0xaad5('0x54'));}if(_0x320a51[_0xaad5('0x55')]){return _0x991bd8[_0xaad5('0x56')](_0x495a29,_0x320a51[_0xaad5('0x55')]+path[_0xaad5('0x57')](_0x495a29),function(){if(_0x1f1a13){fs[_0xaad5('0x58')](_0x495a29);}});}else{return _0x991bd8['download'](_0x495a29,function(_0x1943e5){if(_0x1f1a13){fs[_0xaad5('0x58')](_0x495a29);}});}}})[_0xaad5('0x45')](function(_0x63d791){if(_0x63d791[_0xaad5('0x59')]===_0xaad5('0x54')){_0x991bd8[_0xaad5('0x17')](0x194)[_0xaad5('0x27')](_0xaad5('0x5a'));}else{return handleError(_0x991bd8,null);}});};exports['downloads']=function(_0x3b44c3,_0x164f83,_0x428d76){var _0xa0f1e1=require('../../components/encryptor');var _0x1fd4bd=![];var _0x195f9d={'$and':[db[_0xaad5('0x5b')][_0xaad5('0x3d')](db['sequelize']['fn'](_0xaad5('0x5c'),db[_0xaad5('0x5b')]['col'](_0xaad5('0x4c'))),_0x3b44c3[_0xaad5('0x31')]['token'])]};if(_0x3b44c3['query'][_0xaad5('0x2c')]&&_0x3b44c3['query']['type']===_0xaad5('0x4c')){_0x195f9d[_0xaad5('0x5d')][_0xaad5('0x5e')]({'uniqueid':_0x3b44c3['params']['id']});}else{_0x195f9d[_0xaad5('0x5d')][_0xaad5('0x5e')]({'id':_0x3b44c3['params']['id']});}return db[_0xaad5('0x41')][_0xaad5('0x47')]({'where':_0x195f9d,'attributes':['id',_0xaad5('0x4d')],'raw':!![]})[_0xaad5('0x21')](handleEntityNotFound(_0x164f83,null))[_0xaad5('0x21')](function(_0x4cfaa5){if(_0x4cfaa5){var _0x32809c=util[_0xaad5('0x30')](_0xaad5('0x4e'),_0x4cfaa5[_0xaad5('0x4d')]);if(fs[_0xaad5('0x4f')](_0x32809c)){_0x1fd4bd=!![];return _0xa0f1e1[_0xaad5('0x50')](_0x32809c,_0x4cfaa5['value'],config[_0xaad5('0x51')]['recording'])[_0xaad5('0x21')](function(){return _0x4cfaa5;});}return _0x4cfaa5;}})[_0xaad5('0x21')](function(_0x3b879b){if(_0x3b879b){if(!fs[_0xaad5('0x4f')](_0x3b879b[_0xaad5('0x4d')])){throw new db[(_0xaad5('0x5f'))]['ValidationError'](_0xaad5('0x54'));}if(_0x3b879b[_0xaad5('0x55')]){return _0x164f83[_0xaad5('0x56')](_0x3b879b[_0xaad5('0x4d')],_0x3b879b[_0xaad5('0x55')]+path['extname'](_0x3b879b[_0xaad5('0x4d')]),function(){if(_0x1fd4bd){fs[_0xaad5('0x58')](_0x3b879b[_0xaad5('0x4d')]);}});}else{return _0x164f83[_0xaad5('0x56')](_0x3b879b[_0xaad5('0x4d')],function(_0x80ef99){if(_0x1fd4bd){fs[_0xaad5('0x58')](_0x3b879b['value']);}});}}})['catch'](handleError(_0x164f83,null));};exports[_0xaad5('0x22')]=function(_0x5cef6b,_0x3636a4){return db[_0xaad5('0x41')][_0xaad5('0x47')]({'where':{'id':_0x5cef6b[_0xaad5('0x60')]['id']}})[_0xaad5('0x21')](function(_0x3288a2){if(!_0x3288a2)throw new ReferenceError('Entity\x20not\x20found');return _0x3288a2;})[_0xaad5('0x21')](function(_0x425420){var _0x1ed76f=_0x425420[_0xaad5('0x4d')];logger[_0xaad5('0x61')](_0xaad5('0x62'),_0x1ed76f);if(!_['isNil'](_0x425420[_0xaad5('0x4d')])&&fs[_0xaad5('0x4f')](_0x1ed76f)){logger[_0xaad5('0x61')]('File:\x20\x22'+_0x1ed76f+_0xaad5('0x63'));fs[_0xaad5('0x64')](_0x1ed76f);}_0x1ed76f=_0x1ed76f+'.cypher';if(!_[_0xaad5('0x65')](_0x425420[_0xaad5('0x4d')])&&fs['existsSync'](_0x1ed76f)){logger['info'](_0xaad5('0x66')+_0x1ed76f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xaad5('0x64')](_0x1ed76f);}return _0x425420;})[_0xaad5('0x21')](function(_0xf89d77){if(!_0xf89d77)throw new InternalError();return _0xf89d77[_0xaad5('0x22')]();})[_0xaad5('0x21')](function(){_0x3636a4[_0xaad5('0x17')](0xcc)[_0xaad5('0x18')]();})['catch'](handleError(_0x3636a4,null));};function getBucketslist(_0xe734c4,_0x56c477,_0x18db92){return new Promise(function(_0x1bf4be,_0x864d75){var _0x2c0368=new AWS['S3']({'accessKeyId':_0x56c477,'secretAccessKey':_0xe734c4,'region':_0x18db92});_0x2c0368[_0xaad5('0x67')]({},function(_0x2b4362,_0x4232c8){if(_0x2b4362){return _0x864d75(_0x2b4362);}else{return _0x1bf4be(_0x4232c8);}});});}function createBucket(_0xc36600,_0x4b22c8,_0x26790d,_0x24e585){return new Promise(function(_0x1d442a,_0x5bc547){var _0x13816c=new AWS['S3']({'accessKeyId':_0x4b22c8,'secretAccessKey':_0xc36600,'region':_0x26790d});_0x13816c[_0xaad5('0x68')]({'Bucket':_0x24e585},function(_0x3c523e,_0x1c313c){if(_0x3c523e){return _0x5bc547(_0x3c523e);}else{return _0x1d442a(_0x1c313c);}});});}function uploadFile(_0x34980f,_0x461090,_0x13bf42,_0x57a5a9,_0x264a49,_0x439e60){return new Promise(function(_0x552172,_0x155de3){var _0x3c7993=new AWS['S3']({'accessKeyId':_0x461090,'secretAccessKey':_0x34980f,'region':_0x13bf42});_0x3c7993['upload']({'Bucket':_0x57a5a9,'Key':_0x264a49,'Body':_0x439e60},function(_0x1e026a,_0x412299){if(_0x1e026a){return _0x155de3(_0x1e026a);}else{return _0x552172(_0x412299);}});});}function startTranscribe(_0x3be383,_0x183f98,_0x2debe3,_0x244ff3,_0x5567fa,_0x51213c){return new Promise(function(_0x57a79c,_0x271380){var _0x54e93c=new AWS[(_0xaad5('0x69'))]({'accessKeyId':_0x183f98,'secretAccessKey':_0x3be383,'region':_0x2debe3});_0x54e93c[_0xaad5('0x6a')]({'TranscriptionJobName':_0x244ff3,'LanguageCode':_0x5567fa,'Media':{'MediaFileUri':_0x51213c}},function(_0x3c28b9,_0x4ab47f){if(_0x3c28b9){return _0x271380(_0x3c28b9);}else{return _0x57a79c(_0x4ab47f);}});});}function transcribe(_0x226e06,_0x2c623d,_0x22513f,_0x5f3693,_0x7085f3,_0x132f1a,_0x1e9353){return new Promise(function(_0x5d2e0d,_0x464d6b){var _0x48f843={};logger[_0xaad5('0x61')](util['format'](_0xaad5('0x6b'),_0x226e06,_0x7085f3));return uploadFile(_0x2c623d,_0x22513f,_0x5f3693,_0x7085f3,path[_0xaad5('0x6c')](_0x132f1a),fs[_0xaad5('0x6d')](_0x132f1a))[_0xaad5('0x21')](function(_0x3f8bd9){logger[_0xaad5('0x61')](util[_0xaad5('0x30')](_0xaad5('0x6e'),_0x226e06,_0x7085f3,_0x3f8bd9['Location']));_0x48f843[_0xaad5('0x6f')]=_0x3f8bd9[_0xaad5('0x70')];_0x48f843['location']=_0x3f8bd9[_0xaad5('0x71')];logger[_0xaad5('0x61')](util['format'](_0xaad5('0x72'),_0x226e06));return startTranscribe(_0x2c623d,_0x22513f,_0x5f3693,uuidv4(),_0x1e9353,_0x3f8bd9[_0xaad5('0x71')]);})[_0xaad5('0x21')](function(_0x749426){logger['info'](util[_0xaad5('0x30')](_0xaad5('0x73'),_0x226e06,_0x749426[_0xaad5('0x74')][_0xaad5('0x75')]));_0x48f843[_0xaad5('0x76')]=_0x749426[_0xaad5('0x74')][_0xaad5('0x75')];_0x48f843[_0xaad5('0x77')]=_0x749426['TranscriptionJob'][_0xaad5('0x78')];return _0x5d2e0d(_0x48f843);})[_0xaad5('0x45')](function(_0x403dfb){return _0x464d6b(_0x403dfb);});});}exports['runTranscribe']=function(_0x47289f,_0x43e86c,_0x403058){var _0x194b01;var _0x31ed46;var _0x18de45;var _0x42e6c9=require(_0xaad5('0x4b'));return db[_0xaad5('0x41')][_0xaad5('0x79')]({'where':{'id':_0x47289f['params']['id']}})[_0xaad5('0x21')](function(_0x331249){if(_0x331249){var _0x473ccc=util[_0xaad5('0x30')]('%s.cypher',_0x331249[_0xaad5('0x4d')]);if(fs[_0xaad5('0x4f')](_0x473ccc)){cypher=!![];return _0x42e6c9[_0xaad5('0x50')](_0x473ccc,_0x331249[_0xaad5('0x4d')],config[_0xaad5('0x51')][_0xaad5('0x52')])[_0xaad5('0x21')](function(){return _0x331249;});}return _0x331249;}})[_0xaad5('0x21')](function(_0x9b87cd){if(!_0x9b87cd){throw new db[(_0xaad5('0x5f'))][(_0xaad5('0x53'))](_0xaad5('0x7a'));}_0x31ed46=_0x9b87cd;return db[_0xaad5('0x7b')][_0xaad5('0x79')]({'where':{'id':0x1}});})[_0xaad5('0x21')](handleEntityNotFound(_0x43e86c,null))['then'](function(_0x356dc9){if(_0x356dc9){_0x194b01=_0x356dc9;if(!_0x194b01[_0xaad5('0x7c')]||!_0x194b01[_0xaad5('0x7d')]||!_0x194b01[_0xaad5('0x7e')]||!_0x194b01['language']||!_0x194b01[_0xaad5('0x6f')]){throw new db[(_0xaad5('0x5f'))][(_0xaad5('0x53'))]('Transcribe\x20not\x20configured');}if(_0x47289f[_0xaad5('0x49')][_0xaad5('0x7f')]&&(!_0x194b01[_0xaad5('0x80')]||!_0x194b01[_0xaad5('0x81')]||!_0x194b01[_0xaad5('0x82')]||!_0x194b01[_0xaad5('0x83')]||!_0x194b01[_0xaad5('0x6f')])){throw new db[(_0xaad5('0x5f'))][(_0xaad5('0x53'))](_0xaad5('0x84'));}return db[_0xaad5('0x85')]['findOne']({'where':{'id':_0x194b01['transcribeAccountId']}});}})[_0xaad5('0x21')](function(_0x1dd6f0){if(!_0x1dd6f0){throw new db[(_0xaad5('0x5f'))][(_0xaad5('0x53'))](_0xaad5('0x86'));}if(!_0x1dd6f0[_0xaad5('0x87')]||!_0x1dd6f0[_0xaad5('0x88')]){throw new db[(_0xaad5('0x5f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x18de45=_0x1dd6f0;return getBucketslist(_0x18de45[_0xaad5('0x87')],_0x18de45[_0xaad5('0x88')],_0x194b01[_0xaad5('0x7e')]);})['then'](function(_0x428f8f){if(_0x428f8f&&_0x428f8f['Buckets']){var _0x53c95a=_[_0xaad5('0x47')](_0x428f8f[_0xaad5('0x89')],function(_0x15e761){return _0x15e761[_0xaad5('0x8a')]===_0x194b01[_0xaad5('0x6f')];});if(!_0x53c95a){logger[_0xaad5('0x61')](util[_0xaad5('0x30')](_0xaad5('0x8b'),_0x47289f[_0xaad5('0x60')]['id'],_0x194b01[_0xaad5('0x6f')]));return createBucket(_0x18de45['data1'],_0x18de45[_0xaad5('0x88')],_0x194b01[_0xaad5('0x7e')],_0x194b01[_0xaad5('0x6f')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x47289f[_0xaad5('0x60')]['id'],_0x194b01['bucket']));return;}})[_0xaad5('0x21')](function(_0x113922){if(_0x31ed46[_0xaad5('0x77')]===_0xaad5('0x8c')){return transcribe(_0x47289f[_0xaad5('0x60')]['id'],_0x18de45['data1'],_0x18de45[_0xaad5('0x88')],_0x194b01['transcribeRegion'],_0x194b01['bucket'],_0x31ed46['value'],_0x194b01['language']);}else{logger['info'](util['format'](_0xaad5('0x8d'),_0x47289f[_0xaad5('0x60')]['id']));return{'transcribeStatus':_0xaad5('0x8e')};}})[_0xaad5('0x21')](function(_0x371e97){if(_0x371e97){_0x371e97[_0xaad5('0x8f')]=_0x47289f[_0xaad5('0x49')][_0xaad5('0x7f')];return _0x31ed46[_0xaad5('0x90')](_0x371e97);}})[_0xaad5('0x21')](respondWithResult(_0x43e86c,null))[_0xaad5('0x45')](handleError(_0x43e86c,null));};function writeFile(_0x3eee72,_0x5c9300){return new Promise(function(_0x1aa5db,_0x559db6){fs[_0xaad5('0x91')](_0x5c9300,_0x3eee72,function(_0x56a7d5,_0x2f9993){if(_0x56a7d5){return _0x559db6(_0x56a7d5);}else{return _0x1aa5db(_0x2f9993);}});});}exports[_0xaad5('0x92')]=function(_0x4cdde2,_0x52baa3,_0x5b94d5){return db[_0xaad5('0x41')][_0xaad5('0x79')]({'where':{'id':_0x4cdde2[_0xaad5('0x60')]['id']}})[_0xaad5('0x21')](handleEntityNotFound(_0x52baa3))[_0xaad5('0x21')](function(_0x40fe40){if(_0x40fe40&&_0x40fe40[_0xaad5('0x93')]){var _0x39397b=_0x40fe40[_0xaad5('0x93')];var _0x714505=config['root']+_0xaad5('0x94')+_0x40fe40['id']+'.txt';if(fs[_0xaad5('0x4f')](_0x714505)){return _0x714505;}return writeFile(_0x39397b,_0x714505)[_0xaad5('0x21')](function(){return _0x714505;});}else{throw new db[(_0xaad5('0x5f'))][(_0xaad5('0x53'))](_0xaad5('0x95'));}})[_0xaad5('0x21')](function(_0x148f55){return _0x52baa3[_0xaad5('0x56')](_0x148f55);})['catch'](handleError(_0x52baa3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ee9d5f5..6e4a891 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 _0x41d0=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d0,0x1c6));var _0x041d=function(_0x3db94a,_0x117062){_0x3db94a=_0x3db94a-0x0;var _0x5df368=_0x41d0[_0x3db94a];return _0x5df368;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var logger=require(_0x041d('0x2'))(_0x041d('0x3'));var moment=require('moment');var BPromise=require(_0x041d('0x4'));var rp=require(_0x041d('0x5'));var fs=require('fs');var path=require(_0x041d('0x6'));var rimraf=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var attributes=require(_0x041d('0x9'));module[_0x041d('0xa')]=function(_0x14907f,_0x196419){return _0x14907f['define'](_0x041d('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x041d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe451=['../../config/environment','exports','VoiceRecording','voice_recordings','../../config/logger','request-promise','path','rimraf'];(function(_0x32ab1b,_0x34ceb7){var _0x1885a0=function(_0x58b142){while(--_0x58b142){_0x32ab1b['push'](_0x32ab1b['shift']());}};_0x1885a0(++_0x34ceb7);}(_0xe451,0xec));var _0x1e45=function(_0x29abee,_0x1cd41b){_0x29abee=_0x29abee-0x0;var _0x1a5967=_0xe451[_0x29abee];return _0x1a5967;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e45('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e45('0x1'));var fs=require('fs');var path=require(_0x1e45('0x2'));var rimraf=require(_0x1e45('0x3'));var config=require(_0x1e45('0x4'));var attributes=require('./voiceRecording.attributes');module[_0x1e45('0x5')]=function(_0x1a163c,_0x115f88){return _0x1a163c['define'](_0x1e45('0x6'),attributes,{'tableName':_0x1e45('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 3bbfc43..cd0dc09 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(_0x3216f5,_0xe32e8a){var _0x17035a=function(_0x5f28cd){while(--_0x5f28cd){_0x3216f5['push'](_0x3216f5['shift']());}};_0x17035a(++_0xe32e8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x19fa95,_0x1cca0a){var _0x58a835=function(_0x3e1957){while(--_0x3e1957){_0x19fa95['push'](_0x19fa95['shift']());}};_0x58a835(++_0x1cca0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 58adb80..6703158 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 _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x2be6d9,_0xd31df5){var _0x45e38b=function(_0x1237b0){while(--_0x1237b0){_0x2be6d9['push'](_0x2be6d9['shift']());}};_0x45e38b(++_0xd31df5);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x155506,_0x202f81){_0x155506=_0x155506-0x0;var _0x14b973=_0x3f8a[_0x155506];return _0x14b973;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x71ab=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x4bbe7b,_0x154a75){var _0x50dd58=function(_0x37ed86){while(--_0x37ed86){_0x4bbe7b['push'](_0x4bbe7b['shift']());}};_0x50dd58(++_0x154a75);}(_0x71ab,0x64));var _0xb71a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x71ab[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var auth=require(_0xb71a('0x3'));var interaction=require(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var controller=require(_0xb71a('0x6'));router[_0xb71a('0x7')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x9')]);router[_0xb71a('0x7')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller['update']);router[_0xb71a('0xf')]('/:id',auth[_0xb71a('0x8')](),controller[_0xb71a('0x10')]);module[_0xb71a('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 2190333..644bcd5 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 _0x525a=['Yes','sequelize','exports','blind','attended','STRING','ENUM'];(function(_0x5112f2,_0x51c6b7){var _0x358370=function(_0x45815a){while(--_0x45815a){_0x5112f2['push'](_0x5112f2['shift']());}};_0x358370(++_0x51c6b7);}(_0x525a,0xe8));var _0xa525=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x525a[_0x2c0ded];return _0x4473e5;};'use strict';var Sequelize=require(_0xa525('0x0'));var moment=require('moment');module[_0xa525('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa525('0x2'),_0xa525('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa525('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xa525('0x4')]},'transferercalleridname':{'type':Sequelize[_0xa525('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa525('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa525('0x4')]},'transfererexten':{'type':Sequelize[_0xa525('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xa525('0x4')]},'transfereechannel':{'type':Sequelize[_0xa525('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xa525('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xa525('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa525('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xa525('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xa525('0x4')]},'isexternal':{'type':Sequelize[_0xa525('0x5')](_0xa525('0x6'),'No')},'context':{'type':Sequelize[_0xa525('0x4')]},'extension':{'type':Sequelize[_0xa525('0x4')]}}; \ No newline at end of file +var _0x219f=['sequelize','moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x4fc8dd,_0x44239a){var _0xfa6052=function(_0x199dff){while(--_0x199dff){_0x4fc8dd['push'](_0x4fc8dd['shift']());}};_0xfa6052(++_0x44239a);}(_0x219f,0xd0));var _0xf219=function(_0x56b2fa,_0x597224){_0x56b2fa=_0x56b2fa-0x0;var _0x28ee9c=_0x219f[_0x56b2fa];return _0x28ee9c;};'use strict';var Sequelize=require(_0xf219('0x0'));var moment=require(_0xf219('0x1'));module[_0xf219('0x2')]={'type':{'type':Sequelize[_0xf219('0x3')](_0xf219('0x4'),_0xf219('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf219('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xf219('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xf219('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xf219('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xf219('0x6')]},'transferercontext':{'type':Sequelize[_0xf219('0x6')]},'transfererexten':{'type':Sequelize[_0xf219('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xf219('0x6')]},'transfereechannel':{'type':Sequelize[_0xf219('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xf219('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xf219('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf219('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf219('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xf219('0x6')]},'transfereeexten':{'type':Sequelize[_0xf219('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xf219('0x7'),'No')},'context':{'type':Sequelize[_0xf219('0x6')]},'extension':{'type':Sequelize[_0xf219('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7d8aa8e..c65c6f8 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 _0x5460=['json','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x30a780,_0x20a911){var _0x31c9c9=function(_0xda3de9){while(--_0xda3de9){_0x30a780['push'](_0x30a780['shift']());}};_0x31c9c9(++_0x20a911);}(_0x5460,0x1a1));var _0x0546=function(_0x19aa54,_0x39115f){_0x19aa54=_0x19aa54-0x0;var _0x4ba9a3=_0x5460[_0x19aa54];return _0x4ba9a3;};'use strict';var pdf=require(_0x0546('0x0'));var emlformat=require(_0x0546('0x1'));var rimraf=require(_0x0546('0x2'));var zipdir=require(_0x0546('0x3'));var jsonpatch=require(_0x0546('0x4'));var rp=require(_0x0546('0x5'));var moment=require(_0x0546('0x6'));var BPromise=require(_0x0546('0x7'));var Mustache=require(_0x0546('0x8'));var util=require(_0x0546('0x9'));var path=require(_0x0546('0xa'));var sox=require(_0x0546('0xb'));var csv=require(_0x0546('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0546('0xd'));var squel=require('squel');var crypto=require(_0x0546('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0546('0xf'));var toCsv=require(_0x0546('0xc'));var querystring=require('querystring');var Papa=require(_0x0546('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0546('0x11'));var as=require(_0x0546('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0546('0x13'))(_0x0546('0x14'));var utils=require(_0x0546('0x15'));var config=require(_0x0546('0x16'));var db=require(_0x0546('0x17'))['db'];function respondWithStatusCode(_0x5655c4,_0x2b8142){_0x2b8142=_0x2b8142||0xcc;return function(_0x4b3ccf){if(_0x4b3ccf){return _0x5655c4[_0x0546('0x18')](_0x2b8142);}return _0x5655c4[_0x0546('0x19')](_0x2b8142)[_0x0546('0x1a')]();};}function respondWithResult(_0x2ebcdb,_0x1a8476){_0x1a8476=_0x1a8476||0xc8;return function(_0x2d0129){if(_0x2d0129){return _0x2ebcdb[_0x0546('0x19')](_0x1a8476)[_0x0546('0x1b')](_0x2d0129);}};}function respondWithFilteredResult(_0x393d48,_0x46eb5a){return function(_0x102d80){if(_0x102d80){var _0x41733d=_0x102d80['count'],_0x59ea2e=_0x46eb5a[_0x0546('0x1c')],_0x3cc7a0=_0x46eb5a[_0x0546('0x1c')]+_0x46eb5a[_0x0546('0x1d')],_0x24d161;if(_0x3cc7a0>=_0x41733d){_0x3cc7a0=_0x41733d;_0x24d161=0xc8;}else{_0x24d161=0xce;}_0x393d48[_0x0546('0x19')](_0x24d161);return _0x393d48[_0x0546('0x1e')](_0x0546('0x1f'),_0x59ea2e+'-'+_0x3cc7a0+'/'+_0x41733d)['json'](_0x102d80);}return null;};}function patchUpdates(_0x40960e){return function(_0x586ece){try{jsonpatch['apply'](_0x586ece,_0x40960e,!![]);}catch(_0x151da6){return BPromise[_0x0546('0x20')](_0x151da6);}return _0x586ece[_0x0546('0x21')]();};}function saveUpdates(_0x510a84,_0x1efc45){return function(_0x20d90f){if(_0x20d90f){return _0x20d90f[_0x0546('0x22')](_0x510a84)['then'](function(_0x1b0fbd){return _0x1b0fbd;});}return null;};}function removeEntity(_0x456c4f,_0xac2bdf){return function(_0x189b95){if(_0x189b95){return _0x189b95[_0x0546('0x23')]()[_0x0546('0x24')](function(){_0x456c4f[_0x0546('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c978,_0x426e25){return function(_0x374952){if(!_0x374952){_0x27c978[_0x0546('0x18')](0x194);}return _0x374952;};}function handleError(_0x4bc9ac,_0x198eea){_0x198eea=_0x198eea||0x1f4;return function(_0x35433b){logger[_0x0546('0x25')](_0x35433b[_0x0546('0x26')]);if(_0x35433b[_0x0546('0x27')]){delete _0x35433b[_0x0546('0x27')];}_0x4bc9ac[_0x0546('0x19')](_0x198eea)['send'](_0x35433b);};}exports[_0x0546('0x28')]=function(_0x3efba3,_0x2f7236){var _0x532f67={},_0x1d6704={},_0x2014cf={'count':0x0,'rows':[]};var _0x21682f=_[_0x0546('0x29')](db[_0x0546('0x2a')][_0x0546('0x2b')],function(_0x19e10d){return{'name':_0x19e10d[_0x0546('0x2c')],'type':_0x19e10d[_0x0546('0x2d')][_0x0546('0x2e')]};});_0x1d6704[_0x0546('0x2f')]=_[_0x0546('0x29')](_0x21682f,_0x0546('0x27'));_0x1d6704[_0x0546('0x30')]=_[_0x0546('0x31')](_0x3efba3[_0x0546('0x30')]);_0x1d6704[_0x0546('0x32')]=_[_0x0546('0x33')](_0x1d6704[_0x0546('0x2f')],_0x1d6704['query']);_0x532f67['attributes']=_[_0x0546('0x33')](_0x1d6704['model'],qs['fields'](_0x3efba3['query'][_0x0546('0x34')]));_0x532f67['attributes']=_0x532f67[_0x0546('0x35')][_0x0546('0x36')]?_0x532f67[_0x0546('0x35')]:_0x1d6704[_0x0546('0x2f')];if(!_0x3efba3[_0x0546('0x30')][_0x0546('0x37')](_0x0546('0x38'))){_0x532f67[_0x0546('0x1d')]=qs[_0x0546('0x1d')](_0x3efba3[_0x0546('0x30')]['limit']);_0x532f67[_0x0546('0x1c')]=qs[_0x0546('0x1c')](_0x3efba3[_0x0546('0x30')][_0x0546('0x1c')]);}_0x532f67['order']=qs[_0x0546('0x39')](_0x3efba3[_0x0546('0x30')][_0x0546('0x39')]);_0x532f67['where']=qs[_0x0546('0x32')](_[_0x0546('0x3a')](_0x3efba3[_0x0546('0x30')],_0x1d6704[_0x0546('0x32')]),_0x21682f);if(_0x3efba3[_0x0546('0x30')][_0x0546('0x3b')]){_0x532f67['where']=_[_0x0546('0x3c')](_0x532f67[_0x0546('0x3d')],{'$or':_[_0x0546('0x29')](_0x21682f,function(_0x45785f){if(_0x45785f[_0x0546('0x2d')]!=='VIRTUAL'){var _0x2095ec={};_0x2095ec[_0x45785f[_0x0546('0x27')]]={'$like':'%'+_0x3efba3[_0x0546('0x30')][_0x0546('0x3b')]+'%'};return _0x2095ec;}})});}_0x532f67=_[_0x0546('0x3c')]({},_0x532f67,_0x3efba3[_0x0546('0x3e')]);var _0x42f044={'where':_0x532f67[_0x0546('0x3d')]};return db['VoiceTransferReport'][_0x0546('0x3f')](_0x42f044)['then'](function(_0x227ebe){_0x2014cf['count']=_0x227ebe;if(_0x3efba3[_0x0546('0x30')][_0x0546('0x40')]){_0x532f67[_0x0546('0x41')]=[{'all':!![]}];}return db[_0x0546('0x2a')][_0x0546('0x42')](_0x532f67);})['then'](function(_0x3b9b14){_0x2014cf[_0x0546('0x43')]=_0x3b9b14;return _0x2014cf;})[_0x0546('0x24')](respondWithFilteredResult(_0x2f7236,_0x532f67))['catch'](handleError(_0x2f7236,null));};exports[_0x0546('0x44')]=function(_0x1bfc96,_0x2f94e3){var _0x510b46={'raw':!![],'where':{'id':_0x1bfc96[_0x0546('0x45')]['id']}},_0xb8c4cb={};_0xb8c4cb['model']=_[_0x0546('0x31')](db[_0x0546('0x2a')][_0x0546('0x2b')]);_0xb8c4cb[_0x0546('0x30')]=_[_0x0546('0x31')](_0x1bfc96[_0x0546('0x30')]);_0xb8c4cb[_0x0546('0x32')]=_[_0x0546('0x33')](_0xb8c4cb[_0x0546('0x2f')],_0xb8c4cb['query']);_0x510b46[_0x0546('0x35')]=_[_0x0546('0x33')](_0xb8c4cb[_0x0546('0x2f')],qs[_0x0546('0x34')](_0x1bfc96[_0x0546('0x30')][_0x0546('0x34')]));_0x510b46['attributes']=_0x510b46[_0x0546('0x35')][_0x0546('0x36')]?_0x510b46[_0x0546('0x35')]:_0xb8c4cb[_0x0546('0x2f')];if(_0x1bfc96[_0x0546('0x30')][_0x0546('0x40')]){_0x510b46[_0x0546('0x41')]=[{'all':!![]}];}_0x510b46=_[_0x0546('0x3c')]({},_0x510b46,_0x1bfc96[_0x0546('0x3e')]);return db[_0x0546('0x2a')]['find'](_0x510b46)['then'](handleEntityNotFound(_0x2f94e3,null))[_0x0546('0x24')](respondWithResult(_0x2f94e3,null))[_0x0546('0x46')](handleError(_0x2f94e3,null));};exports[_0x0546('0x47')]=function(_0x112f40,_0x193f90){return db[_0x0546('0x2a')][_0x0546('0x47')](_0x112f40[_0x0546('0x48')],{})[_0x0546('0x24')](respondWithResult(_0x193f90,0xc9))[_0x0546('0x46')](handleError(_0x193f90,null));};exports[_0x0546('0x22')]=function(_0x5f2ed7,_0x4668a9){if(_0x5f2ed7['body']['id']){delete _0x5f2ed7[_0x0546('0x48')]['id'];}return db[_0x0546('0x2a')][_0x0546('0x49')]({'where':{'id':_0x5f2ed7[_0x0546('0x45')]['id']}})[_0x0546('0x24')](handleEntityNotFound(_0x4668a9,null))['then'](saveUpdates(_0x5f2ed7[_0x0546('0x48')],null))[_0x0546('0x24')](respondWithResult(_0x4668a9,null))[_0x0546('0x46')](handleError(_0x4668a9,null));};exports['destroy']=function(_0x156c67,_0x483457){return db[_0x0546('0x2a')][_0x0546('0x49')]({'where':{'id':_0x156c67['params']['id']}})['then'](handleEntityNotFound(_0x483457,null))[_0x0546('0x24')](removeEntity(_0x483457,null))['catch'](handleError(_0x483457,null));}; \ No newline at end of file +var _0xf728=['../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','length','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x32edac,_0x33d1d1){var _0x5b012e=function(_0x3abe3e){while(--_0x3abe3e){_0x32edac['push'](_0x32edac['shift']());}};_0x5b012e(++_0x33d1d1);}(_0xf728,0x7f));var _0x8f72=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xf728[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x8f72('0x0'));var emlformat=require(_0x8f72('0x1'));var rimraf=require(_0x8f72('0x2'));var zipdir=require(_0x8f72('0x3'));var jsonpatch=require(_0x8f72('0x4'));var rp=require(_0x8f72('0x5'));var moment=require(_0x8f72('0x6'));var BPromise=require(_0x8f72('0x7'));var Mustache=require(_0x8f72('0x8'));var util=require(_0x8f72('0x9'));var path=require(_0x8f72('0xa'));var sox=require(_0x8f72('0xb'));var csv=require(_0x8f72('0xc'));var ejs=require(_0x8f72('0xd'));var fs=require('fs');var _=require(_0x8f72('0xe'));var squel=require(_0x8f72('0xf'));var crypto=require('crypto');var jsforce=require(_0x8f72('0x10'));var deskjs=require(_0x8f72('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8f72('0x12'));var Papa=require('papaparse');var Redis=require(_0x8f72('0x13'));var authService=require(_0x8f72('0x14'));var qs=require(_0x8f72('0x15'));var as=require(_0x8f72('0x16'));var hardwareService=require(_0x8f72('0x17'));var logger=require(_0x8f72('0x18'))('api');var utils=require(_0x8f72('0x19'));var config=require('../../config/environment');var db=require(_0x8f72('0x1a'))['db'];function respondWithStatusCode(_0x3c926f,_0x1b205e){_0x1b205e=_0x1b205e||0xcc;return function(_0x59b409){if(_0x59b409){return _0x3c926f[_0x8f72('0x1b')](_0x1b205e);}return _0x3c926f[_0x8f72('0x1c')](_0x1b205e)[_0x8f72('0x1d')]();};}function respondWithResult(_0x45f8b1,_0x59660c){_0x59660c=_0x59660c||0xc8;return function(_0x51770c){if(_0x51770c){return _0x45f8b1[_0x8f72('0x1c')](_0x59660c)[_0x8f72('0x1e')](_0x51770c);}};}function respondWithFilteredResult(_0x2e8772,_0x1d5135){return function(_0x4a6b9e){if(_0x4a6b9e){var _0x3365f1=_0x4a6b9e[_0x8f72('0x1f')],_0x24c482=_0x1d5135[_0x8f72('0x20')],_0x477b94=_0x1d5135[_0x8f72('0x20')]+_0x1d5135[_0x8f72('0x21')],_0x5546ed;if(_0x477b94>=_0x3365f1){_0x477b94=_0x3365f1;_0x5546ed=0xc8;}else{_0x5546ed=0xce;}_0x2e8772['status'](_0x5546ed);return _0x2e8772[_0x8f72('0x22')](_0x8f72('0x23'),_0x24c482+'-'+_0x477b94+'/'+_0x3365f1)['json'](_0x4a6b9e);}return null;};}function patchUpdates(_0x249d76){return function(_0x377532){try{jsonpatch[_0x8f72('0x24')](_0x377532,_0x249d76,!![]);}catch(_0x1dc96){return BPromise[_0x8f72('0x25')](_0x1dc96);}return _0x377532[_0x8f72('0x26')]();};}function saveUpdates(_0x2c2df9,_0x9f8477){return function(_0x2ac37c){if(_0x2ac37c){return _0x2ac37c[_0x8f72('0x27')](_0x2c2df9)[_0x8f72('0x28')](function(_0x101064){return _0x101064;});}return null;};}function removeEntity(_0x46b8f3,_0x462754){return function(_0x43f1f9){if(_0x43f1f9){return _0x43f1f9[_0x8f72('0x29')]()[_0x8f72('0x28')](function(){_0x46b8f3[_0x8f72('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4196,_0x9bfcf1){return function(_0x24a200){if(!_0x24a200){_0x4e4196[_0x8f72('0x1b')](0x194);}return _0x24a200;};}function handleError(_0x7d1a75,_0x5b11f6){_0x5b11f6=_0x5b11f6||0x1f4;return function(_0x8283ea){logger[_0x8f72('0x2a')](_0x8283ea[_0x8f72('0x2b')]);if(_0x8283ea[_0x8f72('0x2c')]){delete _0x8283ea[_0x8f72('0x2c')];}_0x7d1a75[_0x8f72('0x1c')](_0x5b11f6)[_0x8f72('0x2d')](_0x8283ea);};}exports['index']=function(_0x248e34,_0x19cc0c){var _0x5242cd={},_0x2f56a1={},_0x392dae={'count':0x0,'rows':[]};var _0x475a6f=_[_0x8f72('0x2e')](db['VoiceTransferReport'][_0x8f72('0x2f')],function(_0x3153ce){return{'name':_0x3153ce['fieldName'],'type':_0x3153ce[_0x8f72('0x30')][_0x8f72('0x31')]};});_0x2f56a1[_0x8f72('0x32')]=_[_0x8f72('0x2e')](_0x475a6f,_0x8f72('0x2c'));_0x2f56a1['query']=_[_0x8f72('0x33')](_0x248e34['query']);_0x2f56a1[_0x8f72('0x34')]=_[_0x8f72('0x35')](_0x2f56a1[_0x8f72('0x32')],_0x2f56a1['query']);_0x5242cd[_0x8f72('0x36')]=_[_0x8f72('0x35')](_0x2f56a1[_0x8f72('0x32')],qs[_0x8f72('0x37')](_0x248e34[_0x8f72('0x38')]['fields']));_0x5242cd[_0x8f72('0x36')]=_0x5242cd[_0x8f72('0x36')][_0x8f72('0x39')]?_0x5242cd[_0x8f72('0x36')]:_0x2f56a1[_0x8f72('0x32')];if(!_0x248e34[_0x8f72('0x38')]['hasOwnProperty']('nolimit')){_0x5242cd[_0x8f72('0x21')]=qs[_0x8f72('0x21')](_0x248e34['query']['limit']);_0x5242cd[_0x8f72('0x20')]=qs['offset'](_0x248e34[_0x8f72('0x38')]['offset']);}_0x5242cd['order']=qs[_0x8f72('0x3a')](_0x248e34['query'][_0x8f72('0x3a')]);_0x5242cd[_0x8f72('0x3b')]=qs[_0x8f72('0x34')](_[_0x8f72('0x3c')](_0x248e34['query'],_0x2f56a1[_0x8f72('0x34')]),_0x475a6f);if(_0x248e34[_0x8f72('0x38')][_0x8f72('0x3d')]){_0x5242cd[_0x8f72('0x3b')]=_[_0x8f72('0x3e')](_0x5242cd[_0x8f72('0x3b')],{'$or':_[_0x8f72('0x2e')](_0x475a6f,function(_0x57d0f6){if(_0x57d0f6['type']!==_0x8f72('0x3f')){var _0x4636e1={};_0x4636e1[_0x57d0f6['name']]={'$like':'%'+_0x248e34[_0x8f72('0x38')][_0x8f72('0x3d')]+'%'};return _0x4636e1;}})});}_0x5242cd=_[_0x8f72('0x3e')]({},_0x5242cd,_0x248e34[_0x8f72('0x40')]);var _0x54bf97={'where':_0x5242cd[_0x8f72('0x3b')]};return db[_0x8f72('0x41')]['count'](_0x54bf97)[_0x8f72('0x28')](function(_0x45a657){_0x392dae[_0x8f72('0x1f')]=_0x45a657;if(_0x248e34[_0x8f72('0x38')][_0x8f72('0x42')]){_0x5242cd[_0x8f72('0x43')]=[{'all':!![]}];}return db[_0x8f72('0x41')][_0x8f72('0x44')](_0x5242cd);})['then'](function(_0x536eb0){_0x392dae[_0x8f72('0x45')]=_0x536eb0;return _0x392dae;})[_0x8f72('0x28')](respondWithFilteredResult(_0x19cc0c,_0x5242cd))['catch'](handleError(_0x19cc0c,null));};exports['show']=function(_0x543251,_0x9c8e25){var _0x54527c={'raw':!![],'where':{'id':_0x543251[_0x8f72('0x46')]['id']}},_0x85e3ea={};_0x85e3ea[_0x8f72('0x32')]=_[_0x8f72('0x33')](db[_0x8f72('0x41')]['rawAttributes']);_0x85e3ea[_0x8f72('0x38')]=_['keys'](_0x543251[_0x8f72('0x38')]);_0x85e3ea[_0x8f72('0x34')]=_[_0x8f72('0x35')](_0x85e3ea[_0x8f72('0x32')],_0x85e3ea[_0x8f72('0x38')]);_0x54527c[_0x8f72('0x36')]=_[_0x8f72('0x35')](_0x85e3ea[_0x8f72('0x32')],qs[_0x8f72('0x37')](_0x543251['query']['fields']));_0x54527c['attributes']=_0x54527c['attributes'][_0x8f72('0x39')]?_0x54527c[_0x8f72('0x36')]:_0x85e3ea[_0x8f72('0x32')];if(_0x543251[_0x8f72('0x38')][_0x8f72('0x42')]){_0x54527c[_0x8f72('0x43')]=[{'all':!![]}];}_0x54527c=_[_0x8f72('0x3e')]({},_0x54527c,_0x543251[_0x8f72('0x40')]);return db[_0x8f72('0x41')][_0x8f72('0x47')](_0x54527c)[_0x8f72('0x28')](handleEntityNotFound(_0x9c8e25,null))['then'](respondWithResult(_0x9c8e25,null))[_0x8f72('0x48')](handleError(_0x9c8e25,null));};exports[_0x8f72('0x49')]=function(_0x3ab325,_0x2193a1){return db[_0x8f72('0x41')][_0x8f72('0x49')](_0x3ab325['body'],{})[_0x8f72('0x28')](respondWithResult(_0x2193a1,0xc9))[_0x8f72('0x48')](handleError(_0x2193a1,null));};exports[_0x8f72('0x27')]=function(_0x27d404,_0x3cfa1b){if(_0x27d404[_0x8f72('0x4a')]['id']){delete _0x27d404[_0x8f72('0x4a')]['id'];}return db[_0x8f72('0x41')][_0x8f72('0x47')]({'where':{'id':_0x27d404[_0x8f72('0x46')]['id']}})[_0x8f72('0x28')](handleEntityNotFound(_0x3cfa1b,null))[_0x8f72('0x28')](saveUpdates(_0x27d404['body'],null))['then'](respondWithResult(_0x3cfa1b,null))['catch'](handleError(_0x3cfa1b,null));};exports[_0x8f72('0x29')]=function(_0x58f851,_0x202429){return db['VoiceTransferReport'][_0x8f72('0x47')]({'where':{'id':_0x58f851['params']['id']}})['then'](handleEntityNotFound(_0x202429,null))[_0x8f72('0x28')](removeEntity(_0x202429,null))[_0x8f72('0x48')](handleError(_0x202429,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 32c5b74..81eceb2 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 _0x1a7e=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x1a7e,0x97));var _0xe1a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1a7('0x0'));var util=require(_0xe1a7('0x1'));var logger=require(_0xe1a7('0x2'))('api');var moment=require(_0xe1a7('0x3'));var BPromise=require(_0xe1a7('0x4'));var rp=require(_0xe1a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1a7('0x6'));var config=require(_0xe1a7('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xe1a7('0x8')]=function(_0x34d22a,_0x34ff8f){return _0x34d22a['define'](_0xe1a7('0x9'),attributes,{'tableName':_0xe1a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x498b=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x2df521,_0x2a1a8a){var _0x217b35=function(_0x577813){while(--_0x577813){_0x2df521['push'](_0x2df521['shift']());}};_0x217b35(++_0x2a1a8a);}(_0x498b,0x168));var _0xb498=function(_0x5d66d4,_0x1678e4){_0x5d66d4=_0x5d66d4-0x0;var _0x4946bd=_0x498b[_0x5d66d4];return _0x4946bd;};'use strict';var _=require('lodash');var util=require(_0xb498('0x0'));var logger=require(_0xb498('0x1'))('api');var moment=require(_0xb498('0x2'));var BPromise=require(_0xb498('0x3'));var rp=require(_0xb498('0x4'));var fs=require('fs');var path=require(_0xb498('0x5'));var rimraf=require('rimraf');var config=require(_0xb498('0x6'));var attributes=require(_0xb498('0x7'));module[_0xb498('0x8')]=function(_0x2ed1e1,_0x2c62de){return _0x2ed1e1[_0xb498('0x9')](_0xb498('0xa'),attributes,{'tableName':_0xb498('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 5b9ee5d..1ef1354 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 _0xa707=['catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message'];(function(_0x50b750,_0xe5817b){var _0x1b60a8=function(_0x23a6e8){while(--_0x23a6e8){_0x50b750['push'](_0x50b750['shift']());}};_0x1b60a8(++_0xe5817b);}(_0xa707,0x103));var _0x7a70=function(_0x38c49d,_0x47184f){_0x38c49d=_0x38c49d-0x0;var _0x5263fc=_0xa707[_0x38c49d];return _0x5263fc;};'use strict';var _=require(_0x7a70('0x0'));var util=require(_0x7a70('0x1'));var moment=require(_0x7a70('0x2'));var BPromise=require(_0x7a70('0x3'));var rs=require(_0x7a70('0x4'));var fs=require('fs');var Redis=require(_0x7a70('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a70('0x6'));var logger=require(_0x7a70('0x7'))(_0x7a70('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a70('0x9'));var client=jayson[_0x7a70('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cac7b,_0x42d36b,_0x3e3dc2){return new BPromise(function(_0x19237a,_0x5a90aa){return client[_0x7a70('0xb')](_0x4cac7b,_0x3e3dc2)[_0x7a70('0xc')](function(_0x5372c2){logger[_0x7a70('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x42d36b,'request\x20sent');logger[_0x7a70('0xe')](_0x7a70('0xf'),_0x42d36b,_0x7a70('0x10'),JSON[_0x7a70('0x11')](_0x5372c2));if(_0x5372c2[_0x7a70('0x12')]){if(_0x5372c2[_0x7a70('0x12')]['code']===0x1f4){logger[_0x7a70('0x12')](_0x7a70('0x13'),_0x42d36b,_0x5372c2[_0x7a70('0x12')][_0x7a70('0x14')]);return _0x5a90aa(_0x5372c2[_0x7a70('0x12')]['message']);}logger[_0x7a70('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x42d36b,_0x5372c2[_0x7a70('0x12')]['message']);return _0x19237a(_0x5372c2['error'][_0x7a70('0x14')]);}else{logger[_0x7a70('0xd')](_0x7a70('0x13'),_0x42d36b,_0x7a70('0x10'));_0x19237a(_0x5372c2['result'][_0x7a70('0x14')]);}})[_0x7a70('0x15')](function(_0x932102){logger['error'](_0x7a70('0x13'),_0x42d36b,_0x932102);_0x5a90aa(_0x932102);});});}exports[_0x7a70('0x16')]=function(_0x150f20){var _0x31b6a5=this;return new Promise(function(_0x1f3222,_0x54dfde){return db[_0x7a70('0x17')][_0x7a70('0x18')](_0x150f20[_0x7a70('0x19')],{'raw':_0x150f20['options']?_0x150f20[_0x7a70('0x1a')][_0x7a70('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x248fd6){logger[_0x7a70('0xd')](_0x7a70('0x16'),_0x150f20);logger['debug'](_0x7a70('0x16'),_0x150f20,JSON[_0x7a70('0x11')](_0x248fd6));_0x1f3222(_0x248fd6);})[_0x7a70('0x15')](function(_0x1872cd){logger[_0x7a70('0x12')]('CreateVoiceTransferReport',_0x1872cd[_0x7a70('0x14')],_0x150f20);_0x54dfde(_0x31b6a5['error'](0x1f4,_0x1872cd[_0x7a70('0x14')]));});});}; \ No newline at end of file +var _0xa110=['body','options','raw','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x24b123,_0x48dbf5){var _0x445be1=function(_0x5ceea2){while(--_0x5ceea2){_0x24b123['push'](_0x24b123['shift']());}};_0x445be1(++_0x48dbf5);}(_0xa110,0x121));var _0x0a11=function(_0x11df70,_0x4cb784){_0x11df70=_0x11df70-0x0;var _0x42942d=_0xa110[_0x11df70];return _0x42942d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a11('0x0'));var BPromise=require('bluebird');var rs=require(_0x0a11('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a11('0x2'))['db'];var utils=require(_0x0a11('0x3'));var logger=require('../../config/logger')(_0x0a11('0x4'));var config=require(_0x0a11('0x5'));var jayson=require(_0x0a11('0x6'));var client=jayson[_0x0a11('0x7')][_0x0a11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x519096,_0x263fbb,_0x2618d0){return new BPromise(function(_0xd29888,_0x4951f0){return client[_0x0a11('0x9')](_0x519096,_0x2618d0)[_0x0a11('0xa')](function(_0x26b9fd){logger[_0x0a11('0xb')](_0x0a11('0xc'),_0x263fbb,'request\x20sent');logger[_0x0a11('0xd')](_0x0a11('0xe'),_0x263fbb,_0x0a11('0xf'),JSON[_0x0a11('0x10')](_0x26b9fd));if(_0x26b9fd[_0x0a11('0x11')]){if(_0x26b9fd[_0x0a11('0x11')]['code']===0x1f4){logger[_0x0a11('0x11')](_0x0a11('0xc'),_0x263fbb,_0x26b9fd[_0x0a11('0x11')][_0x0a11('0x12')]);return _0x4951f0(_0x26b9fd[_0x0a11('0x11')]['message']);}logger['error'](_0x0a11('0xc'),_0x263fbb,_0x26b9fd[_0x0a11('0x11')]['message']);return _0xd29888(_0x26b9fd[_0x0a11('0x11')][_0x0a11('0x12')]);}else{logger[_0x0a11('0xb')](_0x0a11('0xc'),_0x263fbb,'request\x20sent');_0xd29888(_0x26b9fd['result']['message']);}})[_0x0a11('0x13')](function(_0x1e1ccb){logger[_0x0a11('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x263fbb,_0x1e1ccb);_0x4951f0(_0x1e1ccb);});});}exports[_0x0a11('0x14')]=function(_0x447636){var _0x135255=this;return new Promise(function(_0x495eff,_0x16e0c4){return db[_0x0a11('0x15')][_0x0a11('0x16')](_0x447636[_0x0a11('0x17')],{'raw':_0x447636[_0x0a11('0x18')]?_0x447636[_0x0a11('0x18')][_0x0a11('0x19')]===undefined?!![]:![]:!![]})[_0x0a11('0xa')](function(_0x45d4f1){logger['info'](_0x0a11('0x14'),_0x447636);logger['debug'](_0x0a11('0x14'),_0x447636,JSON[_0x0a11('0x10')](_0x45d4f1));_0x495eff(_0x45d4f1);})['catch'](function(_0x56fcdb){logger[_0x0a11('0x11')](_0x0a11('0x14'),_0x56fcdb[_0x0a11('0x12')],_0x447636);_0x16e0c4(_0x135255['error'](0x1f4,_0x56fcdb[_0x0a11('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 798b350..1166dd5 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 _0x5640=['originate','/hangup','hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate'];(function(_0x3fc139,_0x28e5ac){var _0x35323b=function(_0x323126){while(--_0x323126){_0x3fc139['push'](_0x3fc139['shift']());}};_0x35323b(++_0x28e5ac);}(_0x5640,0x111));var _0x0564=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5640[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x0564('0x0'));var router=express['Router']();var auth=require(_0x0564('0x1'));var controller=require(_0x0564('0x2'));router[_0x0564('0x3')](_0x0564('0x4'),auth[_0x0564('0x5')](),auth[_0x0564('0x6')](),controller[_0x0564('0x7')]);router[_0x0564('0x3')](_0x0564('0x8'),auth[_0x0564('0x5')](),auth[_0x0564('0x6')](),controller[_0x0564('0x9')]);router[_0x0564('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x0564('0x6')](),controller[_0x0564('0xa')]);router[_0x0564('0x3')](_0x0564('0xb'),auth['isAuthenticated'](),auth[_0x0564('0x6')](),controller[_0x0564('0xc')]);router['post'](_0x0564('0xd'),auth[_0x0564('0x5')](),auth['canUpdate'](),controller[_0x0564('0xe')]);router[_0x0564('0x3')](_0x0564('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x0564('0x10')]);router['post'](_0x0564('0x11'),auth[_0x0564('0x5')](),auth[_0x0564('0x6')](),controller[_0x0564('0x12')]);module[_0x0564('0x13')]=router; \ No newline at end of file +var _0x9221=['post','/originate','canUpdate','originate','/hangup','isAuthenticated','hangup','/answer','hold','/unhold','unhold','/calls','calls','transfer','exports','Router','../../components/auth/service'];(function(_0x336889,_0x5a9874){var _0x435969=function(_0x5debbe){while(--_0x5debbe){_0x336889['push'](_0x336889['shift']());}};_0x435969(++_0x5a9874);}(_0x9221,0x64));var _0x1922=function(_0x13a913,_0x400d93){_0x13a913=_0x13a913-0x0;var _0xbf71de=_0x9221[_0x13a913];return _0xbf71de;};'use strict';var express=require('express');var router=express[_0x1922('0x0')]();var auth=require(_0x1922('0x1'));var controller=require('./webbar.controller');router[_0x1922('0x2')](_0x1922('0x3'),auth['isAuthenticated'](),auth[_0x1922('0x4')](),controller[_0x1922('0x5')]);router[_0x1922('0x2')](_0x1922('0x6'),auth[_0x1922('0x7')](),auth[_0x1922('0x4')](),controller[_0x1922('0x8')]);router['post'](_0x1922('0x9'),auth[_0x1922('0x7')](),auth[_0x1922('0x4')](),controller['answer']);router[_0x1922('0x2')]('/hold',auth[_0x1922('0x7')](),auth[_0x1922('0x4')](),controller[_0x1922('0xa')]);router['post'](_0x1922('0xb'),auth[_0x1922('0x7')](),auth['canUpdate'](),controller[_0x1922('0xc')]);router['post'](_0x1922('0xd'),auth['isAuthenticated'](),auth[_0x1922('0x4')](),controller[_0x1922('0xe')]);router[_0x1922('0x2')]('/transfer',auth['isAuthenticated'](),auth[_0x1922('0x4')](),controller[_0x1922('0xf')]);module[_0x1922('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2778513..ea7880a 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 _0x5f90=['hangup\x20executed!','answer\x20fired:','validate','entityFound:','webbar:answer','answer\x20executed!','hold','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','path','../../mysqldb','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','webbar:originate','originate\x20executed!','hangup\x20fired:','format','user:%s','webbar:hangup'];(function(_0x2593c8,_0x2d3713){var _0x21ce96=function(_0x59062e){while(--_0x59062e){_0x2593c8['push'](_0x2593c8['shift']());}};_0x21ce96(++_0x2d3713);}(_0x5f90,0xae));var _0x05f9=function(_0x489888,_0x184bcc){_0x489888=_0x489888-0x0;var _0x3a876c=_0x5f90[_0x489888];return _0x3a876c;};'use strict';var path=require(_0x05f9('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x05f9('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x05f9('0x2'));var BPromise=require('bluebird');var jayson=require(_0x05f9('0x3'));var amiClient=jayson[_0x05f9('0x4')][_0x05f9('0x5')]({'port':0x232a});var logger=require(_0x05f9('0x6'))(_0x05f9('0x7'));var Redis=require('ioredis');config[_0x05f9('0x8')]=_[_0x05f9('0x9')](config[_0x05f9('0x8')],{'host':_0x05f9('0xa'),'port':0x18eb});var io=require(_0x05f9('0xb'))(new Redis(config[_0x05f9('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x05f9('0xc')]},'callNumber':{'type':_0x05f9('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x05f9('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x05f9('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x05f9('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x05f9('0xd'),'required':[!![],_0x05f9('0xf')]},'transferNumber':{'type':_0x05f9('0xd'),'required':[!![],_0x05f9('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x05f9('0xe'),'required':[!![],_0x05f9('0xc')]},'sessionId':{'type':_0x05f9('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x05f9('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x05f9('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x05f9('0xe'),'required':[!![],_0x05f9('0xc')]}});function emit(_0x548233,_0x39054a,_0x523fa4){logger[_0x05f9('0x11')](_0x548233,_0x39054a,JSON[_0x05f9('0x12')](_0x523fa4));io['to'](_0x548233)[_0x05f9('0x13')](_0x39054a,_0x523fa4);}function handleError(_0x4c9d62){return function(_0x565175){console[_0x05f9('0x14')](_0x05f9('0x15'),_0x565175,_0x565175 instanceof RangeError);logger[_0x05f9('0x16')](_0x565175[_0x05f9('0x17')]);if(_0x565175 instanceof RangeError){if(_0x565175['name']){delete _0x565175[_0x05f9('0x18')];}_0x4c9d62[_0x05f9('0x19')](0x194)[_0x05f9('0x1a')](_0x565175);}else{if(_0x565175[_0x05f9('0x18')]){delete _0x565175[_0x05f9('0x18')];}_0x4c9d62[_0x05f9('0x19')](0x1f4)[_0x05f9('0x1a')](_0x565175);}};}function checkError(){return function(_0x4e3630){if(!_0x4e3630){throw new RangeError(_0x05f9('0x1b'));}return _0x4e3630;};}function respondWithRpcPromise(_0x83ea8d,_0x1a991c){return new BPromise(function(_0x368aaa,_0x1e86b6){var _0x14c12e=amiClient;return _0x14c12e[_0x05f9('0x1c')](_0x83ea8d,_0x1a991c)['then'](function(_0xcd5bbe){if(_0xcd5bbe['error']){if(_0xcd5bbe[_0x05f9('0x16')][_0x05f9('0x1d')]===0x1f4){return _0x1e86b6(_0xcd5bbe[_0x05f9('0x16')][_0x05f9('0x1e')]);}return _0x368aaa(_0xcd5bbe[_0x05f9('0x16')][_0x05f9('0x1e')]);}else{_0x368aaa(_0xcd5bbe[_0x05f9('0x1f')]);}})[_0x05f9('0x20')](function(_0x31dd0a){_0x1e86b6(_0x31dd0a);});});}function getAgent(_0x2f69ff){return db[_0x05f9('0x21')][_0x05f9('0x22')]({'where':{'id':_0x2f69ff,'role':_0x05f9('0x23')}})[_0x05f9('0x24')](checkError());}function getAgentCheckSession(_0x4321da,_0x522dfa){return new BPromise(function(_0x25d465,_0x3201e3){var _0x57a033=respondWithRpcPromise(_0x05f9('0x25'));var _0xe316ef=getAgent(_0x4321da);Promise[_0x05f9('0x26')]([_0x57a033,_0xe316ef])[_0x05f9('0x24')](function(_0x71e2dc){var _0x3ec0fa=_0x71e2dc[0x0];var _0x2ef8e3=_0x71e2dc[0x1];var _0x216870=_['filter'](_0x3ec0fa[_0x05f9('0x27')],function(_0x373ef5){return _0x373ef5['UserId']==_0x2ef8e3['id']&&_0x373ef5[_0x05f9('0x28')]==_0x522dfa;});if(_0x216870[_0x05f9('0x29')]==0x1){_0x25d465(_0x2ef8e3);}else{_0x3201e3(new RangeError(_0x05f9('0x2a')+_0x522dfa+_0x05f9('0x2b')));}});});}exports[_0x05f9('0x2c')]=function(_0x51b3bc,_0x5128d3){logger[_0x05f9('0x11')](_0x05f9('0x2d'),_0x51b3bc[_0x05f9('0x2e')]);var _0x45a928=originateValidation['validate'](_0x51b3bc[_0x05f9('0x2e')]);if(_0x45a928[_0x05f9('0x29')]>0x0){return _0x5128d3[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0x45a928);}var _0x42b82d=_0x51b3bc[_0x05f9('0x2e')][_0x05f9('0x30')];var _0x2afb7e=_0x51b3bc[_0x05f9('0x2e')][_0x05f9('0x31')];var _0x413754=_0x51b3bc[_0x05f9('0x2e')][_0x05f9('0x32')];var _0x103631=_0x51b3bc[_0x05f9('0x2e')]['callbackUrl'];return getAgent(_0x42b82d)[_0x05f9('0x24')](function(_0x46479f){logger[_0x05f9('0x11')]('entityFound:',_0x46479f[_0x05f9('0x18')]);emit(util['format']('user:%s',_0x46479f['name']),_0x05f9('0x33'),{'callNumber':_0x2afb7e,'callerId':_0x413754,'callbackUrl':_0x103631});return _0x5128d3['status'](0xc8)['json']({'error':![],'message':_0x05f9('0x34')});})[_0x05f9('0x20')](handleError(_0x5128d3));};exports['hangup']=function(_0x12948e,_0x249725){logger[_0x05f9('0x11')](_0x05f9('0x35'),_0x12948e['body']);var _0x557a10=hangupValidation['validate'](_0x12948e[_0x05f9('0x2e')]);if(_0x557a10['length']>0x0){return _0x249725[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0x557a10);}var _0x45c64c=_0x12948e[_0x05f9('0x2e')][_0x05f9('0x30')];var _0x33cf47=_0x12948e[_0x05f9('0x2e')]['sessionId'];return getAgent(_0x45c64c)['then'](function(_0x356cce){logger[_0x05f9('0x11')]('entityFound:',_0x356cce[_0x05f9('0x18')]);emit(util[_0x05f9('0x36')](_0x05f9('0x37'),_0x356cce['name']),_0x05f9('0x38'),{'sessionId':_0x33cf47});return _0x249725[_0x05f9('0x19')](0xc8)['json']({'error':![],'message':_0x05f9('0x39')});})[_0x05f9('0x20')](handleError(_0x249725));};exports['answer']=function(_0x25c9e2,_0x83965a){logger[_0x05f9('0x11')](_0x05f9('0x3a'),_0x25c9e2['body']);var _0x3b9e61=answerValidation[_0x05f9('0x3b')](_0x25c9e2[_0x05f9('0x2e')]);if(_0x3b9e61[_0x05f9('0x29')]>0x0){return _0x83965a[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0x3b9e61);}var _0x529830=_0x25c9e2[_0x05f9('0x2e')][_0x05f9('0x30')];var _0x10dd49=_0x25c9e2[_0x05f9('0x2e')][_0x05f9('0x28')];return getAgent(_0x529830)[_0x05f9('0x24')](function(_0x1ce936){logger['info'](_0x05f9('0x3c'),_0x1ce936['name']);emit(util['format']('user:%s',_0x1ce936['name']),_0x05f9('0x3d'),{'sessionId':_0x10dd49});return _0x83965a[_0x05f9('0x19')](0xc8)[_0x05f9('0x2f')]({'error':![],'message':_0x05f9('0x3e')});})[_0x05f9('0x20')](handleError(_0x83965a));};exports[_0x05f9('0x3f')]=function(_0x50ad7c,_0x3c024b){logger[_0x05f9('0x11')]('hold\x20fired:',_0x50ad7c[_0x05f9('0x2e')]);var _0x3871b0=holdValidation[_0x05f9('0x3b')](_0x50ad7c[_0x05f9('0x2e')]);if(_0x3871b0[_0x05f9('0x29')]>0x0){return _0x3c024b[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0x3871b0);}var _0x366451=_0x50ad7c['body'][_0x05f9('0x30')];var _0x3ce330=_0x50ad7c[_0x05f9('0x2e')]['sessionId'];return getAgent(_0x366451)['then'](function(_0x454816){logger['info'](_0x05f9('0x3c'),_0x454816['name']);emit(util['format']('user:%s',_0x454816[_0x05f9('0x18')]),'webbar:hold',{'sessionId':_0x3ce330});return _0x3c024b[_0x05f9('0x19')](0xc8)[_0x05f9('0x2f')]({'error':![],'message':'hold\x20executed!'});})[_0x05f9('0x20')](handleError(_0x3c024b));};exports[_0x05f9('0x40')]=function(_0x2b13d2,_0x48bb16){logger[_0x05f9('0x11')](_0x05f9('0x41'),_0x2b13d2[_0x05f9('0x2e')]);var _0x575a46=unholdValidation['validate'](_0x2b13d2[_0x05f9('0x2e')]);if(_0x575a46[_0x05f9('0x29')]>0x0){return _0x48bb16[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0x575a46);}var _0x3a0706=_0x2b13d2['body'][_0x05f9('0x30')];var _0x2e19f1=_0x2b13d2['body'][_0x05f9('0x28')];return getAgent(_0x3a0706)[_0x05f9('0x24')](function(_0x921b0c){logger[_0x05f9('0x11')](_0x05f9('0x3c'),_0x921b0c['name']);emit(util[_0x05f9('0x36')](_0x05f9('0x37'),_0x921b0c[_0x05f9('0x18')]),_0x05f9('0x42'),{'sessionId':_0x2e19f1});return _0x48bb16[_0x05f9('0x19')](0xc8)[_0x05f9('0x2f')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x48bb16));};exports[_0x05f9('0x43')]=function(_0x45fdcb,_0x3497ef){logger['info'](_0x05f9('0x44'),_0x3497ef[_0x05f9('0x2e')]);var _0xaa0d4d=callsValidation['validate'](_0x45fdcb[_0x05f9('0x2e')]);if(_0xaa0d4d[_0x05f9('0x29')]>0x0){return _0x3497ef[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0xaa0d4d);}var _0x15c547=_0x45fdcb[_0x05f9('0x2e')][_0x05f9('0x30')];var _0x5d956d=respondWithRpcPromise(_0x05f9('0x25'));var _0x49a1b4=getAgent(_0x15c547);return Promise[_0x05f9('0x26')]([_0x5d956d,_0x49a1b4])['then'](function(_0x2c63a0){var _0x22d1d2=_0x2c63a0[0x0];var _0x6d8eff=_0x2c63a0[0x1];var _0x1e44d2=_[_0x05f9('0x45')](_0x22d1d2[_0x05f9('0x27')],function(_0x119543){return _0x119543[_0x05f9('0x46')]==_0x6d8eff['id'];});return _0x3497ef[_0x05f9('0x19')](0xc8)['json']({'count':_0x1e44d2[_0x05f9('0x29')],'rows':_0x1e44d2});})[_0x05f9('0x20')](handleError(_0x3497ef));};exports[_0x05f9('0x47')]=function(_0x2e6060,_0x91e7d7){logger['info'](_0x05f9('0x48'),_0x2e6060[_0x05f9('0x2e')]);var _0x467545=conferenceValidation[_0x05f9('0x3b')](_0x2e6060[_0x05f9('0x2e')]);if(_0x467545[_0x05f9('0x29')]>0x0){return _0x91e7d7[_0x05f9('0x19')](0x190)[_0x05f9('0x2f')](_0x467545);}var _0x2c7b9b=_0x2e6060['body'][_0x05f9('0x30')];return getAgent(_0x2c7b9b)[_0x05f9('0x24')](function(_0x1e9bdc){logger[_0x05f9('0x11')](_0x05f9('0x3c'),_0x1e9bdc['name']);emit(util[_0x05f9('0x36')](_0x05f9('0x37'),_0x1e9bdc[_0x05f9('0x18')]),_0x05f9('0x49'));return _0x91e7d7[_0x05f9('0x19')](0xc8)[_0x05f9('0x2f')]({'error':![],'message':'conference\x20executed!'});})[_0x05f9('0x20')](handleError(_0x91e7d7));};exports[_0x05f9('0x4a')]=function(_0xb3b0c0,_0x39b482){logger[_0x05f9('0x11')](_0x05f9('0x4b'),_0xb3b0c0[_0x05f9('0x2e')]);var _0x3c0fa1=transferValidation['validate'](_0xb3b0c0[_0x05f9('0x2e')]);if(_0x3c0fa1[_0x05f9('0x29')]>0x0){return _0x39b482['status'](0x190)['json'](_0x3c0fa1);}var _0xfc81d2=_0xb3b0c0[_0x05f9('0x2e')][_0x05f9('0x30')];var _0x58cac2=_0xb3b0c0[_0x05f9('0x2e')][_0x05f9('0x28')];var _0x1dea67=_0xb3b0c0[_0x05f9('0x2e')][_0x05f9('0x4c')];return getAgent(_0xfc81d2)[_0x05f9('0x24')](function(_0x597ea0){logger[_0x05f9('0x11')](_0x05f9('0x3c'),_0x597ea0[_0x05f9('0x18')]);emit(util[_0x05f9('0x36')]('user:%s',_0x597ea0[_0x05f9('0x18')]),'webbar:transfer',{'sessionId':_0x58cac2,'transferNumber':_0x1dea67});return _0x39b482[_0x05f9('0x19')](0xc8)[_0x05f9('0x2f')]({'error':![],'message':'transfer\x20executed!'});})[_0x05f9('0x20')](handleError(_0x39b482));}; \ No newline at end of file +var _0xcb3c=['originate\x20fired:','validate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','string','number','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','name','status','send','NotFound','then','error','message','catch','User','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!'];(function(_0xa8d025,_0x3a5cbe){var _0x29e44e=function(_0x57a178){while(--_0x57a178){_0xa8d025['push'](_0xa8d025['shift']());}};_0x29e44e(++_0x3a5cbe);}(_0xcb3c,0x150));var _0xccb3=function(_0x2e986c,_0x90e194){_0x2e986c=_0x2e986c-0x0;var _0x165169=_0xcb3c[_0x2e986c];return _0x165169;};'use strict';var path=require(_0xccb3('0x0'));var fs=require('fs');var _=require(_0xccb3('0x1'));var db=require(_0xccb3('0x2'))['db'];var config=require(_0xccb3('0x3'));var util=require('util');var BPromise=require(_0xccb3('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xccb3('0x5')]['http']({'port':0x232a});var logger=require(_0xccb3('0x6'))(_0xccb3('0x7'));var Redis=require(_0xccb3('0x8'));config[_0xccb3('0x9')]=_[_0xccb3('0xa')](config[_0xccb3('0x9')],{'host':_0xccb3('0xb'),'port':0x18eb});var io=require(_0xccb3('0xc'))(new Redis(config[_0xccb3('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xccb3('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xccb3('0xd')},'callbackUrl':{'type':_0xccb3('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':_0xccb3('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':_0xccb3('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xccb3('0xd'),'required':[!![],_0xccb3('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':_0xccb3('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xccb3('0xe'),'required':[!![],_0xccb3('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xccb3('0xf')]}});function emit(_0x5a4037,_0x548a6f,_0x14ced5){logger[_0xccb3('0x11')](_0x5a4037,_0x548a6f,JSON[_0xccb3('0x12')](_0x14ced5));io['to'](_0x5a4037)[_0xccb3('0x13')](_0x548a6f,_0x14ced5);}function handleError(_0x44cc58){return function(_0xbb35ce){console[_0xccb3('0x14')](_0xccb3('0x15'),_0xbb35ce,_0xbb35ce instanceof RangeError);logger['error'](_0xbb35ce['stack']);if(_0xbb35ce instanceof RangeError){if(_0xbb35ce[_0xccb3('0x16')]){delete _0xbb35ce['name'];}_0x44cc58[_0xccb3('0x17')](0x194)[_0xccb3('0x18')](_0xbb35ce);}else{if(_0xbb35ce[_0xccb3('0x16')]){delete _0xbb35ce[_0xccb3('0x16')];}_0x44cc58[_0xccb3('0x17')](0x1f4)['send'](_0xbb35ce);}};}function checkError(){return function(_0x169839){if(!_0x169839){throw new RangeError(_0xccb3('0x19'));}return _0x169839;};}function respondWithRpcPromise(_0x26b8d5,_0x93f1b8){return new BPromise(function(_0x525fbd,_0x155cb6){var _0x3dab30=amiClient;return _0x3dab30['request'](_0x26b8d5,_0x93f1b8)[_0xccb3('0x1a')](function(_0xc6ec88){if(_0xc6ec88[_0xccb3('0x1b')]){if(_0xc6ec88[_0xccb3('0x1b')]['code']===0x1f4){return _0x155cb6(_0xc6ec88[_0xccb3('0x1b')]['message']);}return _0x525fbd(_0xc6ec88['error'][_0xccb3('0x1c')]);}else{_0x525fbd(_0xc6ec88['result']);}})[_0xccb3('0x1d')](function(_0x43b1fa){_0x155cb6(_0x43b1fa);});});}function getAgent(_0xa15d98){return db[_0xccb3('0x1e')]['findOne']({'where':{'id':_0xa15d98,'role':'agent'}})[_0xccb3('0x1a')](checkError());}function getAgentCheckSession(_0x4a34e5,_0x55f628){return new BPromise(function(_0x39edc8,_0x3c804e){var _0x37ecbb=respondWithRpcPromise(_0xccb3('0x1f'));var _0x2d1aab=getAgent(_0x4a34e5);Promise[_0xccb3('0x20')]([_0x37ecbb,_0x2d1aab])[_0xccb3('0x1a')](function(_0x2dbf7f){var _0x574d40=_0x2dbf7f[0x0];var _0x571bb7=_0x2dbf7f[0x1];var _0x5eba6f=_['filter'](_0x574d40[_0xccb3('0x21')],function(_0x400b1d){return _0x400b1d[_0xccb3('0x22')]==_0x571bb7['id']&&_0x400b1d[_0xccb3('0x23')]==_0x55f628;});if(_0x5eba6f[_0xccb3('0x24')]==0x1){_0x39edc8(_0x571bb7);}else{_0x3c804e(new RangeError(_0xccb3('0x25')+_0x55f628+_0xccb3('0x26')));}});});}exports['originate']=function(_0x57b695,_0x1ee87a){logger[_0xccb3('0x11')](_0xccb3('0x27'),_0x57b695['body']);var _0x4d715c=originateValidation[_0xccb3('0x28')](_0x57b695[_0xccb3('0x29')]);if(_0x4d715c[_0xccb3('0x24')]>0x0){return _0x1ee87a[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0x4d715c);}var _0x501e1d=_0x57b695[_0xccb3('0x29')][_0xccb3('0x2b')];var _0x241a41=_0x57b695['body'][_0xccb3('0x2c')];var _0x5620ce=_0x57b695['body'][_0xccb3('0x2d')];var _0x235100=_0x57b695[_0xccb3('0x29')][_0xccb3('0x2e')];return getAgent(_0x501e1d)[_0xccb3('0x1a')](function(_0x48a28d){logger[_0xccb3('0x11')](_0xccb3('0x2f'),_0x48a28d[_0xccb3('0x16')]);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x48a28d['name']),'webbar:originate',{'callNumber':_0x241a41,'callerId':_0x5620ce,'callbackUrl':_0x235100});return _0x1ee87a[_0xccb3('0x17')](0xc8)['json']({'error':![],'message':_0xccb3('0x32')});})['catch'](handleError(_0x1ee87a));};exports[_0xccb3('0x33')]=function(_0xeb53d,_0x1f9d9e){logger[_0xccb3('0x11')](_0xccb3('0x34'),_0xeb53d['body']);var _0xda6fb3=hangupValidation['validate'](_0xeb53d[_0xccb3('0x29')]);if(_0xda6fb3[_0xccb3('0x24')]>0x0){return _0x1f9d9e[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0xda6fb3);}var _0x1e30b6=_0xeb53d[_0xccb3('0x29')]['userId'];var _0x4a7934=_0xeb53d[_0xccb3('0x29')][_0xccb3('0x23')];return getAgent(_0x1e30b6)[_0xccb3('0x1a')](function(_0x217af4){logger[_0xccb3('0x11')]('entityFound:',_0x217af4['name']);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x217af4[_0xccb3('0x16')]),_0xccb3('0x35'),{'sessionId':_0x4a7934});return _0x1f9d9e[_0xccb3('0x17')](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x36')});})[_0xccb3('0x1d')](handleError(_0x1f9d9e));};exports[_0xccb3('0x37')]=function(_0x111722,_0x1de2fb){logger[_0xccb3('0x11')]('answer\x20fired:',_0x111722[_0xccb3('0x29')]);var _0x5681e4=answerValidation[_0xccb3('0x28')](_0x111722[_0xccb3('0x29')]);if(_0x5681e4[_0xccb3('0x24')]>0x0){return _0x1de2fb[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0x5681e4);}var _0x5d5ea4=_0x111722[_0xccb3('0x29')]['userId'];var _0x5c6fb3=_0x111722[_0xccb3('0x29')][_0xccb3('0x23')];return getAgent(_0x5d5ea4)[_0xccb3('0x1a')](function(_0x3ba550){logger[_0xccb3('0x11')](_0xccb3('0x2f'),_0x3ba550[_0xccb3('0x16')]);emit(util[_0xccb3('0x30')]('user:%s',_0x3ba550[_0xccb3('0x16')]),_0xccb3('0x38'),{'sessionId':_0x5c6fb3});return _0x1de2fb[_0xccb3('0x17')](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x39')});})[_0xccb3('0x1d')](handleError(_0x1de2fb));};exports[_0xccb3('0x3a')]=function(_0x28f656,_0x44ad45){logger[_0xccb3('0x11')](_0xccb3('0x3b'),_0x28f656[_0xccb3('0x29')]);var _0x1f1aea=holdValidation[_0xccb3('0x28')](_0x28f656[_0xccb3('0x29')]);if(_0x1f1aea[_0xccb3('0x24')]>0x0){return _0x44ad45[_0xccb3('0x17')](0x190)[_0xccb3('0x2a')](_0x1f1aea);}var _0x2ac2ce=_0x28f656['body'][_0xccb3('0x2b')];var _0xdddf5a=_0x28f656[_0xccb3('0x29')][_0xccb3('0x23')];return getAgent(_0x2ac2ce)['then'](function(_0x2bfadd){logger[_0xccb3('0x11')]('entityFound:',_0x2bfadd['name']);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x2bfadd[_0xccb3('0x16')]),'webbar:hold',{'sessionId':_0xdddf5a});return _0x44ad45['status'](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x3c')});})['catch'](handleError(_0x44ad45));};exports[_0xccb3('0x3d')]=function(_0x7de72e,_0xb08f7b){logger['info']('unhold\x20fired:',_0x7de72e[_0xccb3('0x29')]);var _0x19645f=unholdValidation[_0xccb3('0x28')](_0x7de72e[_0xccb3('0x29')]);if(_0x19645f['length']>0x0){return _0xb08f7b[_0xccb3('0x17')](0x190)['json'](_0x19645f);}var _0x3e5c34=_0x7de72e[_0xccb3('0x29')][_0xccb3('0x2b')];var _0x3e3606=_0x7de72e['body'][_0xccb3('0x23')];return getAgent(_0x3e5c34)[_0xccb3('0x1a')](function(_0x21ec3b){logger['info'](_0xccb3('0x2f'),_0x21ec3b[_0xccb3('0x16')]);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x21ec3b['name']),_0xccb3('0x3e'),{'sessionId':_0x3e3606});return _0xb08f7b['status'](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x3f')});})['catch'](handleError(_0xb08f7b));};exports[_0xccb3('0x40')]=function(_0x5a354f,_0x15d50c){logger[_0xccb3('0x11')](_0xccb3('0x41'),_0x15d50c[_0xccb3('0x29')]);var _0x19e97d=callsValidation['validate'](_0x5a354f[_0xccb3('0x29')]);if(_0x19e97d[_0xccb3('0x24')]>0x0){return _0x15d50c['status'](0x190)[_0xccb3('0x2a')](_0x19e97d);}var _0xdc8be7=_0x5a354f[_0xccb3('0x29')][_0xccb3('0x2b')];var _0x3b3b10=respondWithRpcPromise('VoiceChannels');var _0xacc6bd=getAgent(_0xdc8be7);return Promise[_0xccb3('0x20')]([_0x3b3b10,_0xacc6bd])[_0xccb3('0x1a')](function(_0x1d7470){var _0x141b01=_0x1d7470[0x0];var _0x5ef484=_0x1d7470[0x1];var _0x4e85fe=_[_0xccb3('0x42')](_0x141b01['rows'],function(_0x407239){return _0x407239['UserId']==_0x5ef484['id'];});return _0x15d50c['status'](0xc8)[_0xccb3('0x2a')]({'count':_0x4e85fe[_0xccb3('0x24')],'rows':_0x4e85fe});})['catch'](handleError(_0x15d50c));};exports[_0xccb3('0x43')]=function(_0x380a4c,_0x1cda59){logger[_0xccb3('0x11')]('conference\x20fired:',_0x380a4c['body']);var _0x3b7a6c=conferenceValidation[_0xccb3('0x28')](_0x380a4c[_0xccb3('0x29')]);if(_0x3b7a6c[_0xccb3('0x24')]>0x0){return _0x1cda59[_0xccb3('0x17')](0x190)['json'](_0x3b7a6c);}var _0x3d9f52=_0x380a4c[_0xccb3('0x29')][_0xccb3('0x2b')];return getAgent(_0x3d9f52)[_0xccb3('0x1a')](function(_0x50026d){logger['info'](_0xccb3('0x2f'),_0x50026d[_0xccb3('0x16')]);emit(util['format'](_0xccb3('0x31'),_0x50026d[_0xccb3('0x16')]),_0xccb3('0x44'));return _0x1cda59[_0xccb3('0x17')](0xc8)['json']({'error':![],'message':_0xccb3('0x45')});})[_0xccb3('0x1d')](handleError(_0x1cda59));};exports[_0xccb3('0x46')]=function(_0x5086da,_0x8d14ce){logger[_0xccb3('0x11')](_0xccb3('0x47'),_0x5086da['body']);var _0x298e1e=transferValidation[_0xccb3('0x28')](_0x5086da[_0xccb3('0x29')]);if(_0x298e1e[_0xccb3('0x24')]>0x0){return _0x8d14ce['status'](0x190)[_0xccb3('0x2a')](_0x298e1e);}var _0xe15b41=_0x5086da[_0xccb3('0x29')]['userId'];var _0xe0c1e1=_0x5086da['body'][_0xccb3('0x23')];var _0x277d23=_0x5086da[_0xccb3('0x29')][_0xccb3('0x48')];return getAgent(_0xe15b41)[_0xccb3('0x1a')](function(_0x338493){logger[_0xccb3('0x11')]('entityFound:',_0x338493['name']);emit(util[_0xccb3('0x30')](_0xccb3('0x31'),_0x338493[_0xccb3('0x16')]),_0xccb3('0x49'),{'sessionId':_0xe0c1e1,'transferNumber':_0x277d23});return _0x8d14ce[_0xccb3('0x17')](0xc8)[_0xccb3('0x2a')]({'error':![],'message':_0xccb3('0x4a')});})[_0xccb3('0x1d')](handleError(_0x8d14ce));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 0fba14a..64d352e 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 _0x0115=['addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','create','addAnswer','post','addAgents'];(function(_0x155367,_0x19f57f){var _0x5d6552=function(_0x2bf4ae){while(--_0x2bf4ae){_0x155367['push'](_0x155367['shift']());}};_0x5d6552(++_0x19f57f);}(_0x0115,0x7e));var _0x5011=function(_0x23e40f,_0x32c5d5){_0x23e40f=_0x23e40f-0x0;var _0x4d7adb=_0x0115[_0x23e40f];return _0x4d7adb;};'use strict';var multer=require(_0x5011('0x0'));var util=require(_0x5011('0x1'));var path=require(_0x5011('0x2'));var timeout=require(_0x5011('0x3'));var express=require('express');var router=express[_0x5011('0x4')]();var auth=require(_0x5011('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5011('0x6'));var controller=require(_0x5011('0x7'));router[_0x5011('0x8')]('/',auth[_0x5011('0x9')](),controller[_0x5011('0xa')]);router['get'](_0x5011('0xb'),auth[_0x5011('0x9')](),controller[_0x5011('0xc')]);router[_0x5011('0x8')](_0x5011('0xd'),auth[_0x5011('0x9')](),controller[_0x5011('0xe')]);router['get'](_0x5011('0xf'),auth[_0x5011('0x9')](),controller[_0x5011('0x10')]);router['get'](_0x5011('0x11'),auth[_0x5011('0x9')](),controller[_0x5011('0x12')]);router[_0x5011('0x8')](_0x5011('0x13'),auth[_0x5011('0x9')](),controller['getAgents']);router[_0x5011('0x8')](_0x5011('0x14'),auth[_0x5011('0x9')](),controller[_0x5011('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5011('0x16')]);router['post'](_0x5011('0xf'),auth[_0x5011('0x9')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x5011('0x9')](),controller[_0x5011('0x17')]);router[_0x5011('0x18')](_0x5011('0x13'),auth[_0x5011('0x9')](),controller[_0x5011('0x19')]);router['post'](_0x5011('0x14'),auth[_0x5011('0x9')](),controller[_0x5011('0x1a')]);router[_0x5011('0x18')](_0x5011('0x1b'),controller[_0x5011('0x1c')]);router[_0x5011('0x18')](_0x5011('0x1d'),auth['isAuthenticated'](),controller[_0x5011('0x1e')]);router[_0x5011('0x1f')](_0x5011('0xd'),auth[_0x5011('0x9')](),controller[_0x5011('0x20')]);router[_0x5011('0x21')]('/:id',auth[_0x5011('0x9')](),controller[_0x5011('0x22')]);router[_0x5011('0x21')](_0x5011('0xf'),auth[_0x5011('0x9')](),controller['removeDispositions']);router[_0x5011('0x21')](_0x5011('0x11'),auth[_0x5011('0x9')](),controller[_0x5011('0x23')]);router[_0x5011('0x21')](_0x5011('0x13'),auth[_0x5011('0x9')](),controller[_0x5011('0x24')]);module[_0x5011('0x25')]=router; \ No newline at end of file +var _0xa5a6=['/:id/send','send','destroy','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','create','post','addDisposition','addAnswer','/:id/users','addAgents','/:id/notify'];(function(_0xe15ccb,_0x486e17){var _0x58e666=function(_0x1d3404){while(--_0x1d3404){_0xe15ccb['push'](_0xe15ccb['shift']());}};_0x58e666(++_0x486e17);}(_0xa5a6,0x187));var _0x6a5a=function(_0x4287fe,_0x14ad49){_0x4287fe=_0x4287fe-0x0;var _0x329a39=_0xa5a6[_0x4287fe];return _0x329a39;};'use strict';var multer=require('multer');var util=require(_0x6a5a('0x0'));var path=require(_0x6a5a('0x1'));var timeout=require(_0x6a5a('0x2'));var express=require('express');var router=express[_0x6a5a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a5a('0x4'));var config=require(_0x6a5a('0x5'));var controller=require(_0x6a5a('0x6'));router[_0x6a5a('0x7')]('/',auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x9')]);router['get'](_0x6a5a('0xa'),auth[_0x6a5a('0x8')](),controller['describe']);router[_0x6a5a('0x7')](_0x6a5a('0xb'),auth[_0x6a5a('0x8')](),controller[_0x6a5a('0xc')]);router[_0x6a5a('0x7')](_0x6a5a('0xd'),auth[_0x6a5a('0x8')](),controller[_0x6a5a('0xe')]);router[_0x6a5a('0x7')](_0x6a5a('0xf'),auth[_0x6a5a('0x8')](),controller['getAnswers']);router[_0x6a5a('0x7')]('/:id/users',auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x10')]);router[_0x6a5a('0x7')](_0x6a5a('0x11'),auth[_0x6a5a('0x8')](),controller['getApplications']);router['post']('/',auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x12')]);router[_0x6a5a('0x13')](_0x6a5a('0xd'),auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x14')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6a5a('0x15')]);router['post'](_0x6a5a('0x16'),auth['isAuthenticated'](),controller[_0x6a5a('0x17')]);router[_0x6a5a('0x13')](_0x6a5a('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6a5a('0x13')](_0x6a5a('0x18'),controller['notify']);router[_0x6a5a('0x13')](_0x6a5a('0x19'),auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x1a')]);router['put'](_0x6a5a('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6a5a('0xb'),auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x1b')]);router[_0x6a5a('0x1c')](_0x6a5a('0xd'),auth['isAuthenticated'](),controller[_0x6a5a('0x1d')]);router[_0x6a5a('0x1c')]('/:id/canned_answers',auth[_0x6a5a('0x8')](),controller[_0x6a5a('0x1e')]);router[_0x6a5a('0x1c')]('/:id/users',auth[_0x6a5a('0x8')](),controller['removeAgents']);module[_0x6a5a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 481aee5..ff5a7fb 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 _0x64f6=['randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition'];(function(_0x5633b6,_0x2a93b3){var _0x2316be=function(_0x3bd882){while(--_0x3bd882){_0x5633b6['push'](_0x5633b6['shift']());}};_0x2316be(++_0x2a93b3);}(_0x64f6,0x15c));var _0x664f=function(_0x3b5f66,_0x1dbfc5){_0x3b5f66=_0x3b5f66-0x0;var _0x4aa1a8=_0x64f6[_0x3b5f66];return _0x4aa1a8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x664f('0x0'));module[_0x664f('0x1')]={'name':{'type':Sequelize[_0x664f('0x2')],'unique':_0x664f('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x664f('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x664f('0x2')],'defaultValue':function(){return rs[_0x664f('0x4')]();}},'phone':{'type':Sequelize[_0x664f('0x2')]},'type':{'type':Sequelize[_0x664f('0x5')](_0x664f('0x6'))},'accountSid':{'type':Sequelize[_0x664f('0x2')]},'authToken':{'type':Sequelize[_0x664f('0x2')]},'notificationTemplate':{'type':Sequelize[_0x664f('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x664f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x664f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x664f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x664f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x664f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x664f('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x664f('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x306714){if(!_0x306714){this[_0x664f('0xa')]('mandatoryDispositionPauseId',null);}this[_0x664f('0xa')](_0x664f('0xb'),_0x306714);}},'description':{'type':Sequelize[_0x664f('0x2')]}}; \ No newline at end of file +var _0xecdd=['twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM'];(function(_0x271caa,_0x485e70){var _0x18a8fa=function(_0x205826){while(--_0x205826){_0x271caa['push'](_0x271caa['shift']());}};_0x18a8fa(++_0x485e70);}(_0xecdd,0xbd));var _0xdecd=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xecdd[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xdecd('0x0'));module[_0xdecd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdecd('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdecd('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdecd('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdecd('0x4')]();}},'phone':{'type':Sequelize[_0xdecd('0x3')]},'type':{'type':Sequelize[_0xdecd('0x5')](_0xdecd('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdecd('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdecd('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdecd('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdecd('0x9')],'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[_0xdecd('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdecd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdecd('0x9')],'comment':_0xdecd('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xdecd('0x8')],'defaultValue':![],'comment':_0xdecd('0xb'),'set':function(_0x2d317c){if(!_0x2d317c){this[_0xdecd('0xc')](_0xdecd('0xd'),null);}this[_0xdecd('0xc')](_0xdecd('0xe'),_0x2d317c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 90f8c94..31a0b4b 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 _0xcea2=['../../mysqldb','redis','localhost','./whatsappAccount.socket','register','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','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','get','UserProfileResource','destroy','end','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','hasOwnProperty','CannedAnswer','removeAnswers','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','createdAt','difference','updatedAt','ListId','mobile','twilio','replace','whatsapp:','messageId','isNil','from','from\x20is\x20mandatory','mapKey','CmList','Contacts','DESC','list','defaults','interaction','created','autoclose','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappInteraction','out','spread','dataValues','Messages','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x86c7b1,_0x2960a0){var _0x23e989=function(_0x17fed0){while(--_0x17fed0){_0x86c7b1['push'](_0x86c7b1['shift']());}};_0x23e989(++_0x2960a0);}(_0xcea2,0x15a));var _0x2cea=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcea2[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x2cea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2cea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cea('0x2'));var rp=require(_0x2cea('0x3'));var moment=require(_0x2cea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cea('0x5'));var util=require(_0x2cea('0x6'));var path=require(_0x2cea('0x7'));var sox=require('sox');var csv=require(_0x2cea('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0x8'));var querystring=require('querystring');var Papa=require(_0x2cea('0xe'));var Redis=require(_0x2cea('0xf'));var authService=require(_0x2cea('0x10'));var qs=require(_0x2cea('0x11'));var as=require(_0x2cea('0x12'));var hardwareService=require(_0x2cea('0x13'));var logger=require(_0x2cea('0x14'))(_0x2cea('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2cea('0x16'))['db'];config[_0x2cea('0x17')]=_['defaults'](config['redis'],{'host':_0x2cea('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cea('0x17')]));require(_0x2cea('0x19'))[_0x2cea('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function checkPasswordPattern(_0x369c72,_0x586ad5,_0x3c7130){if(_0x3c7130){var _0x338669=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x338669[_0x2cea('0x1b')](_0x586ad5)){return _0x369c72;}else{throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))](_0x2cea('0x1e'));}}else{return _0x369c72;}}function respondWithRpcPromise(_0x3530d7,_0x1ead4c,_0x5eee09,_0x19927a){return new BPromise(function(_0x464f7d,_0x20c46c){var _0x43ae15=_0x19927a||client;return _0x43ae15[_0x2cea('0x1f')](_0x3530d7,_0x5eee09)[_0x2cea('0x20')](function(_0x5d75c4){logger[_0x2cea('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x1ead4c,_0x2cea('0x22'));logger[_0x2cea('0x23')](_0x2cea('0x24'),_0x1ead4c,'request\x20sent',JSON[_0x2cea('0x25')](_0x5d75c4));if(_0x5d75c4[_0x2cea('0x26')]){if(_0x5d75c4[_0x2cea('0x26')][_0x2cea('0x27')]===0x1f4){logger[_0x2cea('0x26')](_0x2cea('0x28'),_0x1ead4c,_0x5d75c4[_0x2cea('0x26')]['message']);return _0x20c46c(_0x5d75c4[_0x2cea('0x26')]['message']);}logger[_0x2cea('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1ead4c,_0x5d75c4[_0x2cea('0x26')][_0x2cea('0x29')]);return _0x464f7d(_0x5d75c4['error'][_0x2cea('0x29')]);}else{logger[_0x2cea('0x21')](_0x2cea('0x28'),_0x1ead4c,_0x2cea('0x22'));_0x464f7d(_0x5d75c4[_0x2cea('0x2a')][_0x2cea('0x29')]);}})['catch'](function(_0x4ec9b3){logger[_0x2cea('0x26')](_0x2cea('0x28'),_0x1ead4c,_0x4ec9b3);_0x20c46c(_0x4ec9b3);});});}function respondWithStatusCode(_0x32af98,_0x46ef5a){_0x46ef5a=_0x46ef5a||0xcc;return function(_0x3ea40c){if(_0x3ea40c){return _0x32af98[_0x2cea('0x2b')](_0x46ef5a);}return _0x32af98[_0x2cea('0x2c')](_0x46ef5a)['end']();};}function respondWithResult(_0xff69ad,_0x128863){_0x128863=_0x128863||0xc8;return function(_0x5f3fb4){if(_0x5f3fb4){return _0xff69ad[_0x2cea('0x2c')](_0x128863)[_0x2cea('0x2d')](_0x5f3fb4);}};}function respondWithFilteredResult(_0x271b2f,_0x16cf9f){return function(_0x5e0519){if(_0x5e0519){var _0x3c0066=_0x5e0519[_0x2cea('0x2e')],_0x128934=_0x16cf9f[_0x2cea('0x2f')],_0x4a51e5=_0x16cf9f[_0x2cea('0x2f')]+_0x16cf9f[_0x2cea('0x30')],_0x2bf4e9;if(_0x4a51e5>=_0x3c0066){_0x4a51e5=_0x3c0066;_0x2bf4e9=0xc8;}else{_0x2bf4e9=0xce;}_0x271b2f[_0x2cea('0x2c')](_0x2bf4e9);return _0x271b2f[_0x2cea('0x31')](_0x2cea('0x32'),_0x128934+'-'+_0x4a51e5+'/'+_0x3c0066)[_0x2cea('0x2d')](_0x5e0519);}return null;};}function patchUpdates(_0x1e721b){return function(_0x107472){try{jsonpatch['apply'](_0x107472,_0x1e721b,!![]);}catch(_0x260a0f){return BPromise[_0x2cea('0x33')](_0x260a0f);}return _0x107472[_0x2cea('0x34')]();};}function saveUpdates(_0x1bd2a5,_0x5a0061){return function(_0x4dbbcd){if(_0x4dbbcd){return _0x4dbbcd[_0x2cea('0x35')](_0x1bd2a5)[_0x2cea('0x20')](function(_0x5eefbf){return _0x5eefbf;});}return null;};}function removeEntity(_0x381ad7,_0x49d851){return function(_0x3332db){if(_0x3332db){return _0x3332db['destroy']()[_0x2cea('0x20')](function(){var _0x5bd36b=_0x3332db[_0x2cea('0x36')]({'plain':!![]});var _0x4518eb='WhatsappAccounts';return db[_0x2cea('0x37')][_0x2cea('0x38')]({'where':{'type':_0x4518eb,'resourceId':_0x5bd36b['id']}})['then'](function(){return _0x3332db;});})[_0x2cea('0x20')](function(){_0x381ad7[_0x2cea('0x2c')](0xcc)[_0x2cea('0x39')]();});}};}function handleEntityNotFound(_0x3c9f6e,_0x1c6d58){return function(_0x551cc6){if(!_0x551cc6){_0x3c9f6e[_0x2cea('0x2b')](0x194);}return _0x551cc6;};}function handleError(_0x69e6e8,_0x57037f){_0x57037f=_0x57037f||0x1f4;return function(_0x53c088){logger[_0x2cea('0x26')](_0x53c088['stack']);if(_0x53c088['name']){delete _0x53c088['name'];}_0x69e6e8['status'](_0x57037f)[_0x2cea('0x3a')](_0x53c088);};}exports[_0x2cea('0x3b')]=function(_0x53d597,_0x219560){var _0x3e0683={'include':[{'model':db[_0x2cea('0x3c')],'as':_0x2cea('0x3d')}]},_0x249aaa={},_0x51fae6={'count':0x0,'rows':[]};var _0x352f60=_[_0x2cea('0x3e')](db[_0x2cea('0x3f')][_0x2cea('0x40')],function(_0x3afee0){return{'name':_0x3afee0[_0x2cea('0x41')],'type':_0x3afee0[_0x2cea('0x42')][_0x2cea('0x43')]};});_0x249aaa[_0x2cea('0x44')]=_[_0x2cea('0x3e')](_0x352f60,_0x2cea('0x45'));_0x249aaa[_0x2cea('0x46')]=_[_0x2cea('0x47')](_0x53d597[_0x2cea('0x46')]);_0x249aaa[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x249aaa['model'],_0x249aaa[_0x2cea('0x46')]);_0x3e0683['attributes']=_[_0x2cea('0x49')](_0x249aaa[_0x2cea('0x44')],qs[_0x2cea('0x4a')](_0x53d597[_0x2cea('0x46')][_0x2cea('0x4a')]));_0x3e0683[_0x2cea('0x4b')]=_0x3e0683[_0x2cea('0x4b')][_0x2cea('0x4c')]?_0x3e0683[_0x2cea('0x4b')]:_0x249aaa[_0x2cea('0x44')];if(!_0x53d597['query']['hasOwnProperty'](_0x2cea('0x4d'))){_0x3e0683[_0x2cea('0x30')]=qs['limit'](_0x53d597[_0x2cea('0x46')]['limit']);_0x3e0683[_0x2cea('0x2f')]=qs['offset'](_0x53d597[_0x2cea('0x46')][_0x2cea('0x2f')]);}_0x3e0683[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x53d597[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x3e0683[_0x2cea('0x50')]=qs[_0x2cea('0x48')](_[_0x2cea('0x51')](_0x53d597[_0x2cea('0x46')],_0x249aaa['filters']),_0x352f60);if(_0x53d597[_0x2cea('0x46')][_0x2cea('0x52')]){_0x3e0683[_0x2cea('0x50')]=_[_0x2cea('0x53')](_0x3e0683['where'],{'$or':_['map'](_0x352f60,function(_0x41f86c){if(_0x41f86c[_0x2cea('0x42')]!==_0x2cea('0x54')){var _0x510e0f={};_0x510e0f[_0x41f86c[_0x2cea('0x45')]]={'$like':'%'+_0x53d597[_0x2cea('0x46')][_0x2cea('0x52')]+'%'};return _0x510e0f;}})});}_0x3e0683=_[_0x2cea('0x53')]({},_0x3e0683,_0x53d597['options']);var _0x3554cb={'where':_0x3e0683['where']};return db['WhatsappAccount'][_0x2cea('0x2e')](_0x3554cb)[_0x2cea('0x20')](function(_0x320396){_0x51fae6[_0x2cea('0x2e')]=_0x320396;if(_0x53d597['query']['includeAll']){_0x3e0683[_0x2cea('0x55')]=[{'all':!![]}];}return db[_0x2cea('0x3f')][_0x2cea('0x56')](_0x3e0683);})[_0x2cea('0x20')](function(_0x4e755c){_0x51fae6['rows']=_0x4e755c;return _0x51fae6;})['then'](respondWithFilteredResult(_0x219560,_0x3e0683))[_0x2cea('0x57')](handleError(_0x219560,null));};exports[_0x2cea('0x58')]=function(_0x127069,_0x25dc12){var _0x1e9937={'raw':![],'where':{'id':_0x127069[_0x2cea('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x2cea('0x3d')}]},_0x193e0c={};_0x193e0c[_0x2cea('0x44')]=_[_0x2cea('0x47')](db['WhatsappAccount'][_0x2cea('0x40')]);_0x193e0c['query']=_[_0x2cea('0x47')](_0x127069[_0x2cea('0x46')]);_0x193e0c[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x193e0c[_0x2cea('0x44')],_0x193e0c[_0x2cea('0x46')]);_0x1e9937[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x193e0c['model'],qs[_0x2cea('0x4a')](_0x127069['query'][_0x2cea('0x4a')]));_0x1e9937[_0x2cea('0x4b')]=_0x1e9937[_0x2cea('0x4b')]['length']?_0x1e9937[_0x2cea('0x4b')]:_0x193e0c['model'];if(_0x127069['query'][_0x2cea('0x5a')]){_0x1e9937[_0x2cea('0x55')]=[{'all':!![]}];}_0x1e9937=_[_0x2cea('0x53')]({},_0x1e9937,_0x127069[_0x2cea('0x5b')]);return db[_0x2cea('0x3f')]['find'](_0x1e9937)['then'](handleEntityNotFound(_0x25dc12,null))[_0x2cea('0x20')](respondWithResult(_0x25dc12,null))[_0x2cea('0x57')](handleError(_0x25dc12,null));};exports[_0x2cea('0x5c')]=function(_0xacbf7a,_0x526269){return db[_0x2cea('0x3f')]['create'](_0xacbf7a[_0x2cea('0x5d')],{})[_0x2cea('0x20')](function(_0x35d64b){var _0x3f06d1=_0xacbf7a[_0x2cea('0x5e')]['get']({'plain':!![]});if(!_0x3f06d1)throw new Error(_0x2cea('0x5f'));if(_0x3f06d1[_0x2cea('0x60')]===_0x2cea('0x5e')){var _0x16b6ee=_0x35d64b[_0x2cea('0x36')]({'plain':!![]});var _0x4b25e0=_0x2cea('0x61');return db[_0x2cea('0x62')]['find']({'where':{'name':_0x4b25e0,'userProfileId':_0x3f06d1[_0x2cea('0x63')]},'raw':!![]})[_0x2cea('0x20')](function(_0x12b07a){if(_0x12b07a&&_0x12b07a[_0x2cea('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x16b6ee[_0x2cea('0x45')],'resourceId':_0x16b6ee['id'],'type':_0x12b07a[_0x2cea('0x45')],'sectionId':_0x12b07a['id']},{})['then'](function(){return _0x35d64b;});}else{return _0x35d64b;}})[_0x2cea('0x57')](function(_0x11178d){logger['error'](_0x2cea('0x65'),_0x11178d);throw _0x11178d;});}return _0x35d64b;})[_0x2cea('0x20')](respondWithResult(_0x526269,0xc9))[_0x2cea('0x57')](handleError(_0x526269,null));};exports[_0x2cea('0x35')]=function(_0x14daae,_0x54ade9){if(_0x14daae[_0x2cea('0x5d')]['id']){delete _0x14daae[_0x2cea('0x5d')]['id'];}return db['WhatsappAccount'][_0x2cea('0x66')]({'where':{'id':_0x14daae[_0x2cea('0x59')]['id']},'include':[{'model':db[_0x2cea('0x3c')],'as':_0x2cea('0x3d')}]})[_0x2cea('0x20')](handleEntityNotFound(_0x54ade9,null))[_0x2cea('0x20')](saveUpdates(_0x14daae[_0x2cea('0x5d')],null))[_0x2cea('0x20')](respondWithResult(_0x54ade9,null))[_0x2cea('0x57')](handleError(_0x54ade9,null));};exports[_0x2cea('0x38')]=function(_0x45e266,_0x175d9a){return db[_0x2cea('0x3f')]['find']({'where':{'id':_0x45e266['params']['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x175d9a,null))[_0x2cea('0x20')](removeEntity(_0x175d9a,null))[_0x2cea('0x57')](handleError(_0x175d9a,null));};exports[_0x2cea('0x67')]=function(_0x3c51e8,_0x3bb026){return db[_0x2cea('0x3f')]['describe']()['then'](respondWithResult(_0x3bb026,null))[_0x2cea('0x57')](handleError(_0x3bb026,null));};exports[_0x2cea('0x68')]=function(_0x316b28,_0x53ca15,_0x4e00b6){if(_0x316b28['body']['id']){delete _0x316b28[_0x2cea('0x5d')]['id'];}return db[_0x2cea('0x3f')]['find']({'where':{'id':_0x316b28['params']['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x53ca15,null))[_0x2cea('0x20')](function(_0x77f341){if(_0x77f341){_0x316b28[_0x2cea('0x5d')][_0x2cea('0x69')]=_0x77f341['id'];return db[_0x2cea('0x6a')][_0x2cea('0x5c')](_0x316b28[_0x2cea('0x5d')]);}})['then'](respondWithResult(_0x53ca15,null))[_0x2cea('0x57')](handleError(_0x53ca15,null));};exports[_0x2cea('0x6b')]=function(_0x236bf0,_0x2527e8,_0x2eca29){var _0x554659={'raw':![],'where':{}};var _0x122bc9={};var _0x242d94={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2cea('0x6c')]({'where':{'id':_0x236bf0[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x2527e8,null))[_0x2cea('0x20')](function(_0x5bcd33){if(_0x5bcd33){_0x122bc9[_0x2cea('0x44')]=_[_0x2cea('0x47')](db[_0x2cea('0x6a')]['rawAttributes']);_0x122bc9[_0x2cea('0x46')]=_[_0x2cea('0x47')](_0x236bf0[_0x2cea('0x46')]);_0x122bc9[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x122bc9[_0x2cea('0x44')],_0x122bc9[_0x2cea('0x46')]);_0x554659[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x122bc9['model'],qs[_0x2cea('0x4a')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x4a')]));_0x554659[_0x2cea('0x4b')]=_0x554659['attributes'][_0x2cea('0x4c')]?_0x554659[_0x2cea('0x4b')]:_0x122bc9[_0x2cea('0x44')];if(!_0x236bf0[_0x2cea('0x46')]['hasOwnProperty'](_0x2cea('0x4d'))){_0x554659[_0x2cea('0x30')]=qs[_0x2cea('0x30')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x30')]);_0x554659[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x2f')]);}_0x554659[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x236bf0[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x554659[_0x2cea('0x50')]=qs['filters'](_[_0x2cea('0x51')](_0x236bf0['query'],_0x122bc9[_0x2cea('0x48')]));_0x554659[_0x2cea('0x50')][_0x2cea('0x69')]=_0x5bcd33['id'];if(_0x236bf0[_0x2cea('0x46')][_0x2cea('0x52')]){_0x554659['where']=_[_0x2cea('0x53')](_0x554659['where'],{'$or':_['map'](_0x554659[_0x2cea('0x4b')],function(_0x453474){var _0x1da2f1={};_0x1da2f1[_0x453474]={'$like':'%'+_0x236bf0['query'][_0x2cea('0x52')]+'%'};return _0x1da2f1;})});}_0x554659=_[_0x2cea('0x53')]({},_0x554659,_0x236bf0[_0x2cea('0x5b')]);return db[_0x2cea('0x6a')]['count']({'where':_0x554659[_0x2cea('0x50')]})[_0x2cea('0x20')](function(_0x47e16f){_0x242d94[_0x2cea('0x2e')]=_0x47e16f;if(_0x236bf0[_0x2cea('0x46')][_0x2cea('0x5a')]){_0x554659[_0x2cea('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x2cea('0x56')](_0x554659);})['then'](function(_0x1ab9cd){_0x242d94[_0x2cea('0x6d')]=_0x1ab9cd;return _0x242d94;});}})[_0x2cea('0x20')](respondWithFilteredResult(_0x2527e8,_0x554659))[_0x2cea('0x57')](handleError(_0x2527e8,null));};exports[_0x2cea('0x6e')]=function(_0x3b3905,_0x257b0c,_0x1453fb){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x3b3905[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x257b0c,null))[_0x2cea('0x20')](function(_0x2f3993){if(_0x2f3993){return _0x2f3993[_0x2cea('0x6e')](_0x3b3905[_0x2cea('0x46')][_0x2cea('0x6f')]);}})[_0x2cea('0x20')](respondWithStatusCode(_0x257b0c,null))[_0x2cea('0x57')](handleError(_0x257b0c,null));};exports[_0x2cea('0x70')]=function(_0x3ee973,_0x4a3127,_0x3d94e2){if(_0x3ee973[_0x2cea('0x5d')]['id']){delete _0x3ee973[_0x2cea('0x5d')]['id'];}return db['WhatsappAccount'][_0x2cea('0x66')]({'where':{'id':_0x3ee973[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x4a3127,null))[_0x2cea('0x20')](function(_0x1e2b88){if(_0x1e2b88){_0x3ee973['body']['WhatsappAccountId']=_0x1e2b88['id'];return db['CannedAnswer']['create'](_0x3ee973[_0x2cea('0x5d')]);}})['then'](respondWithResult(_0x4a3127,null))[_0x2cea('0x57')](handleError(_0x4a3127,null));};exports['getAnswers']=function(_0x364312,_0x1abeeb,_0x77794){var _0x14d7bb={'raw':![],'where':{}};var _0x5e9c7e={};var _0x40a827={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2cea('0x6c')]({'where':{'id':_0x364312[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x1abeeb,null))[_0x2cea('0x20')](function(_0x3721a0){if(_0x3721a0){_0x5e9c7e['model']=_[_0x2cea('0x47')](db['CannedAnswer'][_0x2cea('0x40')]);_0x5e9c7e['query']=_[_0x2cea('0x47')](_0x364312['query']);_0x5e9c7e[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x5e9c7e[_0x2cea('0x44')],_0x5e9c7e[_0x2cea('0x46')]);_0x14d7bb[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x5e9c7e[_0x2cea('0x44')],qs[_0x2cea('0x4a')](_0x364312['query'][_0x2cea('0x4a')]));_0x14d7bb['attributes']=_0x14d7bb[_0x2cea('0x4b')]['length']?_0x14d7bb[_0x2cea('0x4b')]:_0x5e9c7e[_0x2cea('0x44')];if(!_0x364312['query'][_0x2cea('0x71')](_0x2cea('0x4d'))){_0x14d7bb[_0x2cea('0x30')]=qs[_0x2cea('0x30')](_0x364312[_0x2cea('0x46')][_0x2cea('0x30')]);_0x14d7bb[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x364312[_0x2cea('0x46')][_0x2cea('0x2f')]);}_0x14d7bb[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x364312[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x14d7bb['where']=qs['filters'](_[_0x2cea('0x51')](_0x364312[_0x2cea('0x46')],_0x5e9c7e[_0x2cea('0x48')]));_0x14d7bb[_0x2cea('0x50')][_0x2cea('0x69')]=_0x3721a0['id'];if(_0x364312['query']['filter']){_0x14d7bb[_0x2cea('0x50')]=_[_0x2cea('0x53')](_0x14d7bb[_0x2cea('0x50')],{'$or':_[_0x2cea('0x3e')](_0x14d7bb['attributes'],function(_0x1c15e4){var _0x29878a={};_0x29878a[_0x1c15e4]={'$like':'%'+_0x364312[_0x2cea('0x46')]['filter']+'%'};return _0x29878a;})});}_0x14d7bb=_[_0x2cea('0x53')]({},_0x14d7bb,_0x364312[_0x2cea('0x5b')]);return db[_0x2cea('0x72')][_0x2cea('0x2e')]({'where':_0x14d7bb[_0x2cea('0x50')]})[_0x2cea('0x20')](function(_0x5f050c){_0x40a827[_0x2cea('0x2e')]=_0x5f050c;if(_0x364312[_0x2cea('0x46')]['includeAll']){_0x14d7bb[_0x2cea('0x55')]=[{'all':!![]}];}return db[_0x2cea('0x72')][_0x2cea('0x56')](_0x14d7bb);})['then'](function(_0x4abfbe){_0x40a827[_0x2cea('0x6d')]=_0x4abfbe;return _0x40a827;});}})[_0x2cea('0x20')](respondWithFilteredResult(_0x1abeeb,_0x14d7bb))[_0x2cea('0x57')](handleError(_0x1abeeb,null));};exports[_0x2cea('0x73')]=function(_0x44af15,_0x29b46a,_0x3f4f4a){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x44af15[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x29b46a,null))[_0x2cea('0x20')](function(_0x59ce34){if(_0x59ce34){return _0x59ce34[_0x2cea('0x73')](_0x44af15['query'][_0x2cea('0x6f')]);}})[_0x2cea('0x20')](respondWithStatusCode(_0x29b46a,null))[_0x2cea('0x57')](handleError(_0x29b46a,null));};exports['addAgents']=function(_0x672c,_0x542c68,_0x2c865b){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x672c[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x542c68,null))[_0x2cea('0x20')](function(_0x42102c){if(_0x42102c){return _0x42102c['addAgents'](_0x672c[_0x2cea('0x5d')][_0x2cea('0x6f')],_[_0x2cea('0x74')](_0x672c['body'],[_0x2cea('0x6f'),'id'])||{})['spread'](function(_0x4d0eea){for(var _0x274170=0x0;_0x274170<_0x672c[_0x2cea('0x5d')][_0x2cea('0x6f')]['length'];_0x274170+=0x1){socket[_0x2cea('0x75')]('userWhatsappAccount:save',{'UserId':_0x672c['body'][_0x2cea('0x6f')][_0x274170],'WhatsappAccountId':_0x672c['params']['id']});}return _0x4d0eea;});}})[_0x2cea('0x20')](respondWithResult(_0x542c68,null))[_0x2cea('0x57')](handleError(_0x542c68,null));};exports[_0x2cea('0x76')]=function(_0x4d1fab,_0x511109,_0x173359){return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x4d1fab[_0x2cea('0x59')]['id']}})['then'](handleEntityNotFound(_0x511109,null))['then'](function(_0x42130c){if(_0x42130c){return _0x42130c[_0x2cea('0x76')](_0x4d1fab[_0x2cea('0x46')][_0x2cea('0x6f')])[_0x2cea('0x20')](function(){if(_[_0x2cea('0x77')](_0x4d1fab[_0x2cea('0x46')][_0x2cea('0x6f')])){for(var _0x3a6e0c=0x0;_0x3a6e0c<_0x4d1fab['query'][_0x2cea('0x6f')][_0x2cea('0x4c')];_0x3a6e0c+=0x1){socket[_0x2cea('0x75')](_0x2cea('0x78'),{'UserId':Number(_0x4d1fab['query']['ids'][_0x3a6e0c]),'WhatsappAccountId':Number(_0x4d1fab[_0x2cea('0x59')]['id'])});}}else{socket['emit'](_0x2cea('0x78'),{'UserId':Number(_0x4d1fab[_0x2cea('0x46')][_0x2cea('0x6f')]),'WhatsappAccountId':Number(_0x4d1fab[_0x2cea('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x511109,null))[_0x2cea('0x57')](handleError(_0x511109,null));};exports[_0x2cea('0x79')]=function(_0x40d395,_0x1ab80a,_0x1962df){var _0x1a7350={};var _0x416db2={};var _0x56819f;var _0x7d3f87;return db[_0x2cea('0x3f')][_0x2cea('0x6c')]({'where':{'id':_0x40d395[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x1ab80a,null))[_0x2cea('0x20')](function(_0x5b8162){if(_0x5b8162){_0x56819f=_0x5b8162;_0x416db2[_0x2cea('0x44')]=_[_0x2cea('0x47')](db[_0x2cea('0x7a')][_0x2cea('0x40')]);_0x416db2['query']=_[_0x2cea('0x47')](_0x40d395[_0x2cea('0x46')]);_0x416db2[_0x2cea('0x48')]=_['intersection'](_0x416db2[_0x2cea('0x44')],_0x416db2['query']);_0x1a7350[_0x2cea('0x4b')]=_[_0x2cea('0x49')](_0x416db2[_0x2cea('0x44')],qs['fields'](_0x40d395[_0x2cea('0x46')][_0x2cea('0x4a')]));_0x1a7350['attributes']=_0x1a7350[_0x2cea('0x4b')]['length']?_0x1a7350[_0x2cea('0x4b')]:_0x416db2[_0x2cea('0x44')];_0x1a7350[_0x2cea('0x4e')]=qs['sort'](_0x40d395['query'][_0x2cea('0x4f')]);_0x1a7350[_0x2cea('0x50')]=qs[_0x2cea('0x48')](_['pick'](_0x40d395[_0x2cea('0x46')],_0x416db2[_0x2cea('0x48')]));if(_0x40d395[_0x2cea('0x46')][_0x2cea('0x52')]){_0x1a7350[_0x2cea('0x50')]=_['merge'](_0x1a7350[_0x2cea('0x50')],{'$or':_['map'](_0x1a7350[_0x2cea('0x4b')],function(_0x50a48e){var _0x4d2aea={};_0x4d2aea[_0x50a48e]={'$like':'%'+_0x40d395[_0x2cea('0x46')][_0x2cea('0x52')]+'%'};return _0x4d2aea;})});}_0x1a7350=_[_0x2cea('0x53')]({},_0x1a7350,_0x40d395['options']);return _0x56819f['getAgents'](_0x1a7350);}})[_0x2cea('0x20')](function(_0x206116){if(_0x206116){_0x7d3f87=_0x206116[_0x2cea('0x4c')];if(!_0x40d395[_0x2cea('0x46')][_0x2cea('0x71')](_0x2cea('0x4d'))){_0x1a7350['limit']=qs[_0x2cea('0x30')](_0x40d395[_0x2cea('0x46')][_0x2cea('0x30')]);_0x1a7350[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x40d395[_0x2cea('0x46')][_0x2cea('0x2f')]);}return _0x56819f[_0x2cea('0x79')](_0x1a7350);}})[_0x2cea('0x20')](function(_0x53f40c){if(_0x53f40c){return _0x53f40c?{'count':_0x7d3f87,'rows':_0x53f40c}:null;}})[_0x2cea('0x20')](respondWithResult(_0x1ab80a,null))['catch'](handleError(_0x1ab80a,null));};exports[_0x2cea('0x7b')]=function(_0x5a55ba,_0x130dae,_0x3ae10d){return db[_0x2cea('0x3f')][_0x2cea('0x6c')]({'where':{'id':_0x5a55ba[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x130dae,null))['then'](function(_0x1cb121){if(_0x1cb121){return db[_0x2cea('0x7c')][_0x2cea('0x7d')](function(_0x341b3a){return db['WhatsappApplication'][_0x2cea('0x38')]({'where':{'WhatsappAccountId':_0x5a55ba['params']['id']},'transaction':_0x341b3a})[_0x2cea('0x20')](function(_0x890180){var _0x2943b7=_[_0x2cea('0x3e')](_0x5a55ba[_0x2cea('0x5d')],function(_0x4559c1){_0x4559c1['WhatsappAccountId']=_0x5a55ba[_0x2cea('0x59')]['id'];return _0x4559c1;});return db[_0x2cea('0x7e')][_0x2cea('0x7f')](_0x2943b7,{'transaction':_0x341b3a});});})['then'](function(){return db[_0x2cea('0x7e')][_0x2cea('0x80')]({'where':{'WhatsappAccountId':_0x5a55ba[_0x2cea('0x59')]['id']},'order':_0x2cea('0x81')});});}})[_0x2cea('0x20')](respondWithResult(_0x130dae,null))[_0x2cea('0x57')](handleError(_0x130dae,null));};exports[_0x2cea('0x82')]=function(_0x58329d,_0x2fc390,_0x3f034e){var _0x4b6511={};var _0x1b5784={};var _0x5d220f;var _0x329cd0;return db[_0x2cea('0x3f')][_0x2cea('0x6c')]({'where':{'id':_0x58329d[_0x2cea('0x59')]['id']}})[_0x2cea('0x20')](handleEntityNotFound(_0x2fc390,null))[_0x2cea('0x20')](function(_0x1d5b52){if(_0x1d5b52){_0x5d220f=_0x1d5b52;_0x1b5784[_0x2cea('0x44')]=_['keys'](db[_0x2cea('0x7e')][_0x2cea('0x40')]);_0x1b5784[_0x2cea('0x46')]=_[_0x2cea('0x47')](_0x58329d[_0x2cea('0x46')]);_0x1b5784[_0x2cea('0x48')]=_[_0x2cea('0x49')](_0x1b5784[_0x2cea('0x44')],_0x1b5784[_0x2cea('0x46')]);_0x4b6511['attributes']=_[_0x2cea('0x49')](_0x1b5784['model'],qs[_0x2cea('0x4a')](_0x58329d['query'][_0x2cea('0x4a')]));_0x4b6511[_0x2cea('0x4b')]=_0x4b6511[_0x2cea('0x4b')][_0x2cea('0x4c')]?_0x4b6511[_0x2cea('0x4b')]:_0x1b5784[_0x2cea('0x44')];_0x4b6511[_0x2cea('0x4e')]=qs[_0x2cea('0x4f')](_0x58329d[_0x2cea('0x46')][_0x2cea('0x4f')]);_0x4b6511[_0x2cea('0x50')]=qs['filters'](_[_0x2cea('0x51')](_0x58329d[_0x2cea('0x46')],_0x1b5784[_0x2cea('0x48')]));if(_0x58329d['query']['filter']){_0x4b6511[_0x2cea('0x50')]=_[_0x2cea('0x53')](_0x4b6511[_0x2cea('0x50')],{'$or':_['map'](_0x4b6511[_0x2cea('0x4b')],function(_0x3a0d50){var _0x1e5f04={};_0x1e5f04[_0x3a0d50]={'$like':'%'+_0x58329d[_0x2cea('0x46')][_0x2cea('0x52')]+'%'};return _0x1e5f04;})});}_0x4b6511=_[_0x2cea('0x53')]({},_0x4b6511,_0x58329d[_0x2cea('0x5b')]);return _0x5d220f[_0x2cea('0x82')](_0x4b6511);}})[_0x2cea('0x20')](function(_0x10a9b9){if(_0x10a9b9){_0x329cd0=_0x10a9b9['length'];if(!_0x58329d[_0x2cea('0x46')]['hasOwnProperty'](_0x2cea('0x4d'))){_0x4b6511[_0x2cea('0x30')]=qs['limit'](_0x58329d[_0x2cea('0x46')][_0x2cea('0x30')]);_0x4b6511[_0x2cea('0x2f')]=qs[_0x2cea('0x2f')](_0x58329d['query'][_0x2cea('0x2f')]);}return _0x5d220f['getApplications'](_0x4b6511);}})[_0x2cea('0x20')](function(_0x485914){if(_0x485914){return _0x485914?{'count':_0x329cd0,'rows':_0x485914}:null;}})[_0x2cea('0x20')](respondWithResult(_0x2fc390,null))[_0x2cea('0x57')](handleError(_0x2fc390,null));};exports[_0x2cea('0x83')]=function(_0x17fe9e,_0x54c153,_0x5fc9d){var _0x458743={'channel':_0x2cea('0x84')};var _0x4c59c4=[];var _0x32bf00=[];var _0x1ea68c={};return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x17fe9e['params']['id']},'include':[{'model':db[_0x2cea('0x7e')],'as':_0x2cea('0x85')}]})[_0x2cea('0x20')](handleEntityNotFound(_0x54c153,null))[_0x2cea('0x20')](function(_0x45ee41){_0x458743[_0x2cea('0x86')]=_0x45ee41;_0x458743[_0x2cea('0x87')]=_[_0x2cea('0x88')](_0x45ee41[_0x2cea('0x85')],[_0x2cea('0x81')],[_0x2cea('0x89')]);if(_0x458743[_0x2cea('0x86')][_0x2cea('0x85')]){delete _0x458743[_0x2cea('0x86')][_0x2cea('0x85')];}return db[_0x2cea('0x8a')][_0x2cea('0x67')]();})[_0x2cea('0x20')](function(_0xc6abe7){if(!_0xc6abe7){throw new db[(_0x2cea('0x1c'))]['ValidationError']('no\x20available\x20attributes');}_0x4c59c4=_['difference'](_[_0x2cea('0x47')](_0xc6abe7),[_0x2cea('0x8b'),'updatedAt']);_0x32bf00=_[_0x2cea('0x8c')](_[_0x2cea('0x47')](_0xc6abe7),['createdAt',_0x2cea('0x8d'),'CompanyId',_0x2cea('0x8e')]);_0x458743[_0x2cea('0x5d')]={'mapKey':_0x2cea('0x8f')};if(_0x458743[_0x2cea('0x86')]['type']&&_0x458743['account']['type']===_0x2cea('0x90')){_0x458743['body']['from']=_0x17fe9e[_0x2cea('0x5d')]['From'][_0x2cea('0x91')](_0x2cea('0x92'),'');_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')]=_0x17fe9e[_0x2cea('0x5d')]['Body'];_0x458743[_0x2cea('0x5d')][_0x2cea('0x93')]=_0x17fe9e[_0x2cea('0x5d')]['MessageSid'];}if(_0x458743[_0x2cea('0x5d')]['id']){delete _0x458743[_0x2cea('0x5d')]['id'];}if(_[_0x2cea('0x94')](_0x458743[_0x2cea('0x5d')][_0x2cea('0x95')])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))](_0x2cea('0x96'));}if(_['isNil'](_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')])||_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')]===''){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2cea('0x94')](_0x458743[_0x2cea('0x5d')][_0x2cea('0x97')])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32bf00);}if(!_['includes'](_0x32bf00,_0x458743[_0x2cea('0x5d')]['mapKey'])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32bf00);}_0x1ea68c[_0x458743['body'][_0x2cea('0x97')]]=_0x458743[_0x2cea('0x5d')][_0x2cea('0x95')];return db[_0x2cea('0x98')][_0x2cea('0x66')]({'where':{'id':_0x458743[_0x2cea('0x86')]['ListId']},'include':[{'model':db[_0x2cea('0x8a')],'as':_0x2cea('0x99'),'where':_0x1ea68c,'limit':0x1,'order':[[_0x2cea('0x8d'),_0x2cea('0x9a')]]}]});})[_0x2cea('0x20')](handleEntityNotFound(_0x54c153,null))['then'](function(_0x4974db){if(_0x4974db){_0x458743[_0x2cea('0x9b')]=_[_0x2cea('0x74')](_0x4974db,[_0x2cea('0x99')]);if(_0x4974db[_0x2cea('0x99')][_0x2cea('0x4c')]){return _0x4974db[_0x2cea('0x99')][0x0];}var _0x11a46c=_[_0x2cea('0x9c')](_0x458743[_0x2cea('0x5d')],{'firstName':_0x458743[_0x2cea('0x5d')]['from'],'ListId':_0x4974db['id']});_0x11a46c[_0x458743[_0x2cea('0x5d')][_0x2cea('0x97')]]=_0x458743[_0x2cea('0x5d')]['from'];return db[_0x2cea('0x8a')][_0x2cea('0x5c')](_0x11a46c,{'fields':_0x4c59c4,'raw':!![]});}})['then'](handleEntityNotFound(_0x54c153,null))[_0x2cea('0x20')](function(_0x8203fd){if(_0x8203fd){_0x458743['contact']=_0x8203fd;var _0x55c253={'ContactId':_0x8203fd['id'],'phone':_0x458743['body']['from'],'WhatsappAccountId':_0x17fe9e[_0x2cea('0x59')]['id']};var _0x41d753={'ContactId':_0x8203fd['id'],'WhatsappAccountId':_0x17fe9e[_0x2cea('0x59')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x2cea('0x66')]({'where':_0x41d753})[_0x2cea('0x20')](function(_0x38c203){if(_0x38c203){return[_0x38c203,![]];}return db['WhatsappInteraction'][_0x2cea('0x5c')](_0x55c253)[_0x2cea('0x20')](function(_0x4916a7){return[_0x4916a7,!![]];});});}})['spread'](function(_0x21742e,_0x2c902e){_0x458743['interaction']=_0x21742e[_0x2cea('0x36')]({'plain':!![]});_0x458743[_0x2cea('0x9d')][_0x2cea('0x9e')]=![];if(_0x2c902e){if(_0x458743[_0x2cea('0x86')][_0x2cea('0x9f')]){_0x458743[_0x2cea('0x87')][_0x2cea('0xa0')]({'id':0x0,'priority':_0x458743[_0x2cea('0x87')][_0x2cea('0x4c')]+0x1,'app':_0x2cea('0xa1'),'appdata':_0x2cea('0xa2'),'interval':'*,*,*,*'});}_0x458743[_0x2cea('0x9d')]['created']=!![];}return db[_0x2cea('0xa3')]['create']({'phone':_0x458743['body'][_0x2cea('0x95')],'messageId':_0x458743['body']['messageId'],'body':_0x458743[_0x2cea('0x5d')][_0x2cea('0x5d')],'WhatsappAccountId':_0x17fe9e[_0x2cea('0x59')]['id'],'WhatsappInteractionId':_0x21742e['id'],'direction':'in','ContactId':_0x21742e[_0x2cea('0xa4')],'AttachmentId':_0x458743['body'][_0x2cea('0xa5')]});})[_0x2cea('0x20')](function(_0x3fa5ca){_0x458743[_0x2cea('0x29')]=_0x3fa5ca;if(_0x458743['interaction']['UserId']){return db[_0x2cea('0x7a')][_0x2cea('0x66')]({'attributes':['id',_0x2cea('0x45')],'where':{'id':_0x458743[_0x2cea('0x9d')][_0x2cea('0xa6')]}})[_0x2cea('0x20')](function(_0x2f45b3){if(_0x2f45b3){_0x458743[_0x2cea('0x87')][_0x2cea('0xa7')]({'id':0x0,'priority':0x0,'app':_0x2cea('0xa8'),'appdata':_0x2f45b3[_0x2cea('0x45')]+','+(_0x458743[_0x2cea('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x2cea('0xa9')});}return respondWithRpcPromise(_0x2cea('0xaa'),_0x2cea('0xab'),_0x458743);});}return respondWithRpcPromise('Start',_0x2cea('0xab'),_0x458743);})['then'](function(_0x200530){if(_0x200530){var _0x5b6c42=0xc8;var _0x466b70=_0x2cea('0xac');logger[_0x2cea('0x21')](_0x2cea('0x24'),_0x466b70,_0x5b6c42,_0x2cea('0xad'));logger[_0x2cea('0x23')](_0x2cea('0xae'),_0x466b70,_0x5b6c42,_0x2cea('0xad'),JSON[_0x2cea('0x25')](_0x200530));if(_0x458743[_0x2cea('0x86')][_0x2cea('0x42')]==='twilio'){return _0x54c153[_0x2cea('0x2c')](_0x5b6c42)[_0x2cea('0x31')](_0x2cea('0xaf'),_0x2cea('0xb0'))[_0x2cea('0x3a')]('\x0a');}else{return _0x54c153[_0x2cea('0x2c')](_0x5b6c42)[_0x2cea('0x2d')](_0x200530);}}})['catch'](handleError(_0x54c153,null));};exports['send']=function(_0x1bd88c,_0x3219c5,_0x550eda){var _0x26d520,_0x25e5eb,_0x150b47;if(_[_0x2cea('0x94')](_0x1bd88c[_0x2cea('0x5d')]['body'])||_0x1bd88c[_0x2cea('0x5d')][_0x2cea('0x5d')]===''){throw new db['Sequelize'][(_0x2cea('0x1d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2cea('0x94')](_0x1bd88c[_0x2cea('0x5d')]['to'])){throw new db[(_0x2cea('0x1c'))][(_0x2cea('0x1d'))](_0x2cea('0xb1'));}_0x26d520=_0x1bd88c[_0x2cea('0x5d')]['to'];return db[_0x2cea('0x3f')][_0x2cea('0x66')]({'where':{'id':_0x1bd88c[_0x2cea('0x59')]['id']},'include':[{'model':db[_0x2cea('0x98')],'as':_0x2cea('0xb2'),'include':[{'model':db[_0x2cea('0x8a')],'as':_0x2cea('0x99'),'where':{'mobile':_0x26d520},'limit':0x1,'order':[['updatedAt',_0x2cea('0x9a')]]}]}]})[_0x2cea('0x20')](handleEntityNotFound(_0x3219c5,null))[_0x2cea('0x20')](function(_0x438d2b){if(_0x438d2b&&_0x438d2b[_0x2cea('0xb2')]){_0x25e5eb=_0x438d2b[_0x2cea('0x36')]({'plain':!![]});if(_0x25e5eb[_0x2cea('0xb2')]&&_0x25e5eb[_0x2cea('0xb2')][_0x2cea('0x99')][_0x2cea('0x4c')]){return _0x25e5eb[_0x2cea('0xb2')][_0x2cea('0x99')][0x0];}return db['CmContact'][_0x2cea('0x5c')](_[_0x2cea('0x9c')](_0x1bd88c[_0x2cea('0x5d')],{'firstName':_0x26d520,'mobile':_0x26d520,'phone':_0x26d520,'ListId':_0x25e5eb[_0x2cea('0x8e')]}));}})[_0x2cea('0x20')](handleEntityNotFound(_0x3219c5,null))['then'](function(_0x2a0e94){if(_0x2a0e94){_0x150b47=_0x2a0e94;return db[_0x2cea('0xb3')][_0x2cea('0x66')]({'where':{'ContactId':_0x150b47['id'],'closed':![],'WhatsappAccountId':_0x25e5eb['id']}})[_0x2cea('0x20')](function(_0x48b36b){if(_0x48b36b){return[_0x48b36b,![]];}return db[_0x2cea('0xb3')][_0x2cea('0x5c')]({'UserId':_0x1bd88c[_0x2cea('0x5e')]['id'],'ContactId':_0x150b47['id'],'WhatsappAccountId':_0x25e5eb['id'],'phone':_0x26d520,'firstMsgDirection':_0x2cea('0xb4'),'Messages':[_[_0x2cea('0x53')](_0x1bd88c[_0x2cea('0x5d')],{'read':![],'body':_0x1bd88c['body'][_0x2cea('0x5d')],'phone':_0x26d520,'WhatsappAccountId':_0x25e5eb['id'],'UserId':_0x1bd88c[_0x2cea('0x5e')]['id'],'ContactId':_0x150b47['id']})]},{'include':[{'model':db[_0x2cea('0xa3')],'as':'Messages'}]})[_0x2cea('0x20')](function(_0x404241){return[_0x404241,!![]];});});}})[_0x2cea('0xb5')](function(_0x21a68d,_0x2f011f){if(_0x2f011f){return _0x21a68d;}return db['WhatsappMessage'][_0x2cea('0x5c')](_[_0x2cea('0x53')](_0x1bd88c[_0x2cea('0x5d')],{'read':![],'body':_0x1bd88c['body'][_0x2cea('0x5d')],'phone':_0x26d520,'WhatsappAccountId':_0x25e5eb['id'],'WhatsappInteractionId':_0x21a68d['id'],'UserId':_0x1bd88c['user']['id'],'ContactId':_0x150b47['id']}))[_0x2cea('0x20')](function(_0x89e95){_0x21a68d[_0x2cea('0xb6')][_0x2cea('0xb7')]=[];_0x21a68d[_0x2cea('0xb6')][_0x2cea('0xb7')][_0x2cea('0xa0')](_0x89e95[_0x2cea('0xb6')]);return _0x21a68d;});})['then'](respondWithResult(_0x3219c5,null))[_0x2cea('0x57')](handleError(_0x3219c5,null));}; \ No newline at end of file +var _0x5ec6=['destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','includeAll','include','findAll','rows','show','params','keys','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','describe','addDisposition','getDispositions','WhatsappAccountId','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','account','orderBy','priority','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','applications','push','*,*,*,*','WhatsappMessage','ContactId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource'];(function(_0x420d1a,_0x40389d){var _0x2e045d=function(_0x53ed9b){while(--_0x53ed9b){_0x420d1a['push'](_0x420d1a['shift']());}};_0x2e045d(++_0x40389d);}(_0x5ec6,0x7f));var _0x65ec=function(_0x464bba,_0x2c3b19){_0x464bba=_0x464bba-0x0;var _0x9e1475=_0x5ec6[_0x464bba];return _0x9e1475;};'use strict';var pdf=require(_0x65ec('0x0'));var emlformat=require(_0x65ec('0x1'));var rimraf=require(_0x65ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65ec('0x3'));var rp=require('request-promise');var moment=require(_0x65ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65ec('0x5'));var util=require('util');var path=require(_0x65ec('0x6'));var sox=require('sox');var csv=require(_0x65ec('0x7'));var ejs=require(_0x65ec('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0x7'));var querystring=require(_0x65ec('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xe'));var hardwareService=require(_0x65ec('0xf'));var logger=require('../../config/logger')(_0x65ec('0x10'));var utils=require(_0x65ec('0x11'));var config=require('../../config/environment');var db=require(_0x65ec('0x12'))['db'];config[_0x65ec('0x13')]=_['defaults'](config[_0x65ec('0x13')],{'host':_0x65ec('0x14'),'port':0x18eb});var socket=require(_0x65ec('0x15'))(new Redis(config[_0x65ec('0x13')]));require(_0x65ec('0x16'))[_0x65ec('0x17')](socket);var jayson=require(_0x65ec('0x18'));var client=jayson[_0x65ec('0x19')]['http']({'port':0x232c});function checkPasswordPattern(_0x28be8b,_0x3ed6f7,_0x35d06b){if(_0x35d06b){var _0x4bbe88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bbe88['test'](_0x3ed6f7)){return _0x28be8b;}else{throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x1c'));}}else{return _0x28be8b;}}function respondWithRpcPromise(_0x4f2c63,_0x25dae7,_0x286eac,_0x1254f8){return new BPromise(function(_0xb4ed90,_0x29ebc4){var _0xd81ed3=_0x1254f8||client;return _0xd81ed3[_0x65ec('0x1d')](_0x4f2c63,_0x286eac)[_0x65ec('0x1e')](function(_0x2127e2){logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));logger[_0x65ec('0x22')](_0x65ec('0x23'),_0x25dae7,_0x65ec('0x21'),JSON[_0x65ec('0x24')](_0x2127e2));if(_0x2127e2[_0x65ec('0x25')]){if(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x26')]===0x1f4){logger['error'](_0x65ec('0x20'),_0x25dae7,_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);return _0x29ebc4(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x2127e2['error'][_0x65ec('0x27')]);return _0xb4ed90(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}else{logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));_0xb4ed90(_0x2127e2[_0x65ec('0x28')][_0x65ec('0x27')]);}})[_0x65ec('0x29')](function(_0x4c846b){logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x4c846b);_0x29ebc4(_0x4c846b);});});}function respondWithStatusCode(_0x251831,_0x23b1a3){_0x23b1a3=_0x23b1a3||0xcc;return function(_0x4de451){if(_0x4de451){return _0x251831[_0x65ec('0x2a')](_0x23b1a3);}return _0x251831['status'](_0x23b1a3)[_0x65ec('0x2b')]();};}function respondWithResult(_0x1ada47,_0x1d0b5c){_0x1d0b5c=_0x1d0b5c||0xc8;return function(_0x30366c){if(_0x30366c){return _0x1ada47[_0x65ec('0x2c')](_0x1d0b5c)[_0x65ec('0x2d')](_0x30366c);}};}function respondWithFilteredResult(_0x46bf66,_0x39410f){return function(_0x984a82){if(_0x984a82){var _0xeec5d4=_0x984a82[_0x65ec('0x2e')],_0x3c97e2=_0x39410f['offset'],_0x4b435c=_0x39410f[_0x65ec('0x2f')]+_0x39410f[_0x65ec('0x30')],_0x50d81f;if(_0x4b435c>=_0xeec5d4){_0x4b435c=_0xeec5d4;_0x50d81f=0xc8;}else{_0x50d81f=0xce;}_0x46bf66['status'](_0x50d81f);return _0x46bf66[_0x65ec('0x31')](_0x65ec('0x32'),_0x3c97e2+'-'+_0x4b435c+'/'+_0xeec5d4)[_0x65ec('0x2d')](_0x984a82);}return null;};}function patchUpdates(_0x3c8dd7){return function(_0x491dc6){try{jsonpatch[_0x65ec('0x33')](_0x491dc6,_0x3c8dd7,!![]);}catch(_0x3b9dcb){return BPromise[_0x65ec('0x34')](_0x3b9dcb);}return _0x491dc6[_0x65ec('0x35')]();};}function saveUpdates(_0x3e4f4f,_0x3826fa){return function(_0x38dea3){if(_0x38dea3){return _0x38dea3[_0x65ec('0x36')](_0x3e4f4f)[_0x65ec('0x1e')](function(_0xff3f3c){return _0xff3f3c;});}return null;};}function removeEntity(_0x50db17,_0x6a5861){return function(_0x1e20c4){if(_0x1e20c4){return _0x1e20c4['destroy']()[_0x65ec('0x1e')](function(){var _0x24a242=_0x1e20c4[_0x65ec('0x37')]({'plain':!![]});var _0x2b8aca=_0x65ec('0x38');return db[_0x65ec('0x39')][_0x65ec('0x3a')]({'where':{'type':_0x2b8aca,'resourceId':_0x24a242['id']}})['then'](function(){return _0x1e20c4;});})[_0x65ec('0x1e')](function(){_0x50db17[_0x65ec('0x2c')](0xcc)[_0x65ec('0x2b')]();});}};}function handleEntityNotFound(_0x185447,_0x5028e3){return function(_0x5d8458){if(!_0x5d8458){_0x185447[_0x65ec('0x2a')](0x194);}return _0x5d8458;};}function handleError(_0x398edd,_0x940f13){_0x940f13=_0x940f13||0x1f4;return function(_0x55ac61){logger['error'](_0x55ac61[_0x65ec('0x3b')]);if(_0x55ac61['name']){delete _0x55ac61[_0x65ec('0x3c')];}_0x398edd[_0x65ec('0x2c')](_0x940f13)['send'](_0x55ac61);};}exports[_0x65ec('0x3d')]=function(_0x1fbc2b,_0x13aa56){var _0x5357bf={'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]},_0x3cffbf={},_0x3b72cf={'count':0x0,'rows':[]};var _0x470bb3=_[_0x65ec('0x40')](db[_0x65ec('0x41')]['rawAttributes'],function(_0x28653a){return{'name':_0x28653a['fieldName'],'type':_0x28653a[_0x65ec('0x42')][_0x65ec('0x43')]};});_0x3cffbf[_0x65ec('0x44')]=_[_0x65ec('0x40')](_0x470bb3,_0x65ec('0x3c'));_0x3cffbf[_0x65ec('0x45')]=_['keys'](_0x1fbc2b[_0x65ec('0x45')]);_0x3cffbf['filters']=_['intersection'](_0x3cffbf[_0x65ec('0x44')],_0x3cffbf[_0x65ec('0x45')]);_0x5357bf[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x3cffbf[_0x65ec('0x44')],qs['fields'](_0x1fbc2b['query'][_0x65ec('0x48')]));_0x5357bf[_0x65ec('0x46')]=_0x5357bf[_0x65ec('0x46')][_0x65ec('0x49')]?_0x5357bf[_0x65ec('0x46')]:_0x3cffbf['model'];if(!_0x1fbc2b['query'][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x5357bf[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x30')]);_0x5357bf[_0x65ec('0x2f')]=qs['offset'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0x5357bf[_0x65ec('0x4c')]=qs['sort'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x5357bf['where']=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x1fbc2b[_0x65ec('0x45')],_0x3cffbf[_0x65ec('0x4e')]),_0x470bb3);if(_0x1fbc2b[_0x65ec('0x45')]['filter']){_0x5357bf[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x5357bf[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x470bb3,function(_0x59c182){if(_0x59c182[_0x65ec('0x42')]!=='VIRTUAL'){var _0x1ed0f9={};_0x1ed0f9[_0x59c182[_0x65ec('0x3c')]]={'$like':'%'+_0x1fbc2b[_0x65ec('0x45')]['filter']+'%'};return _0x1ed0f9;}})});}_0x5357bf=_['merge']({},_0x5357bf,_0x1fbc2b[_0x65ec('0x52')]);var _0x45d2bc={'where':_0x5357bf[_0x65ec('0x50')]};return db[_0x65ec('0x41')][_0x65ec('0x2e')](_0x45d2bc)[_0x65ec('0x1e')](function(_0x1c546c){_0x3b72cf[_0x65ec('0x2e')]=_0x1c546c;if(_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x53')]){_0x5357bf[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x41')][_0x65ec('0x55')](_0x5357bf);})[_0x65ec('0x1e')](function(_0x11d2d6){_0x3b72cf[_0x65ec('0x56')]=_0x11d2d6;return _0x3b72cf;})[_0x65ec('0x1e')](respondWithFilteredResult(_0x13aa56,_0x5357bf))['catch'](handleError(_0x13aa56,null));};exports[_0x65ec('0x57')]=function(_0x2814f3,_0x4e0da8){var _0x3a474c={'raw':![],'where':{'id':_0x2814f3[_0x65ec('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x65ec('0x3f')}]},_0x7add40={};_0x7add40[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['WhatsappAccount'][_0x65ec('0x5a')]);_0x7add40['query']=_['keys'](_0x2814f3[_0x65ec('0x45')]);_0x7add40[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x7add40['model'],_0x7add40[_0x65ec('0x45')]);_0x3a474c[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x7add40[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x2814f3[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3a474c[_0x65ec('0x46')]=_0x3a474c[_0x65ec('0x46')]['length']?_0x3a474c['attributes']:_0x7add40[_0x65ec('0x44')];if(_0x2814f3['query'][_0x65ec('0x53')]){_0x3a474c['include']=[{'all':!![]}];}_0x3a474c=_[_0x65ec('0x51')]({},_0x3a474c,_0x2814f3[_0x65ec('0x52')]);return db[_0x65ec('0x41')][_0x65ec('0x5b')](_0x3a474c)[_0x65ec('0x1e')](handleEntityNotFound(_0x4e0da8,null))[_0x65ec('0x1e')](respondWithResult(_0x4e0da8,null))[_0x65ec('0x29')](handleError(_0x4e0da8,null));};exports['create']=function(_0x2c7657,_0x474bc0){return db[_0x65ec('0x41')][_0x65ec('0x5c')](_0x2c7657[_0x65ec('0x5d')],{})['then'](function(_0x20f60f){var _0x318be3=_0x2c7657[_0x65ec('0x5e')][_0x65ec('0x37')]({'plain':!![]});if(!_0x318be3)throw new Error(_0x65ec('0x5f'));if(_0x318be3[_0x65ec('0x60')]===_0x65ec('0x5e')){var _0x2e81ea=_0x20f60f['get']({'plain':!![]});var _0x311e78=_0x65ec('0x38');return db[_0x65ec('0x61')][_0x65ec('0x5b')]({'where':{'name':_0x311e78,'userProfileId':_0x318be3[_0x65ec('0x62')]},'raw':!![]})[_0x65ec('0x1e')](function(_0x192055){if(_0x192055&&_0x192055['autoAssociation']===0x0){return db['UserProfileResource'][_0x65ec('0x5c')]({'name':_0x2e81ea['name'],'resourceId':_0x2e81ea['id'],'type':_0x192055[_0x65ec('0x3c')],'sectionId':_0x192055['id']},{})[_0x65ec('0x1e')](function(){return _0x20f60f;});}else{return _0x20f60f;}})['catch'](function(_0x1baa17){logger[_0x65ec('0x25')](_0x65ec('0x63'),_0x1baa17);throw _0x1baa17;});}return _0x20f60f;})[_0x65ec('0x1e')](respondWithResult(_0x474bc0,0xc9))[_0x65ec('0x29')](handleError(_0x474bc0,null));};exports[_0x65ec('0x36')]=function(_0x2279ff,_0x5df65c){if(_0x2279ff['body']['id']){delete _0x2279ff[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2279ff['params']['id']},'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5df65c,null))[_0x65ec('0x1e')](saveUpdates(_0x2279ff[_0x65ec('0x5d')],null))[_0x65ec('0x1e')](respondWithResult(_0x5df65c,null))[_0x65ec('0x29')](handleError(_0x5df65c,null));};exports['destroy']=function(_0x464f67,_0x1e2731){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x464f67[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1e2731,null))[_0x65ec('0x1e')](removeEntity(_0x1e2731,null))[_0x65ec('0x29')](handleError(_0x1e2731,null));};exports[_0x65ec('0x64')]=function(_0x584811,_0x59a690){return db[_0x65ec('0x41')]['describe']()['then'](respondWithResult(_0x59a690,null))[_0x65ec('0x29')](handleError(_0x59a690,null));};exports[_0x65ec('0x65')]=function(_0x39d0ce,_0x547057,_0x501775){if(_0x39d0ce[_0x65ec('0x5d')]['id']){delete _0x39d0ce['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x39d0ce[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0x547057,null))[_0x65ec('0x1e')](function(_0x1e101c){if(_0x1e101c){_0x39d0ce[_0x65ec('0x5d')]['WhatsappAccountId']=_0x1e101c['id'];return db['Disposition'][_0x65ec('0x5c')](_0x39d0ce['body']);}})[_0x65ec('0x1e')](respondWithResult(_0x547057,null))[_0x65ec('0x29')](handleError(_0x547057,null));};exports[_0x65ec('0x66')]=function(_0x290c68,_0xc47b30,_0x2874ea){var _0xefa74d={'raw':![],'where':{}};var _0x572b15={};var _0x275a42={'count':0x0,'rows':[]};return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x290c68[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0xc47b30,null))[_0x65ec('0x1e')](function(_0xf4dbce){if(_0xf4dbce){_0x572b15[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['Disposition'][_0x65ec('0x5a')]);_0x572b15['query']=_[_0x65ec('0x59')](_0x290c68[_0x65ec('0x45')]);_0x572b15[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x572b15['model'],_0x572b15['query']);_0xefa74d['attributes']=_[_0x65ec('0x47')](_0x572b15[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x48')]));_0xefa74d[_0x65ec('0x46')]=_0xefa74d[_0x65ec('0x46')][_0x65ec('0x49')]?_0xefa74d[_0x65ec('0x46')]:_0x572b15[_0x65ec('0x44')];if(!_0x290c68[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0xefa74d['limit']=qs[_0x65ec('0x30')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x30')]);_0xefa74d[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0xefa74d[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x290c68[_0x65ec('0x45')]['sort']);_0xefa74d[_0x65ec('0x50')]=qs['filters'](_['pick'](_0x290c68[_0x65ec('0x45')],_0x572b15[_0x65ec('0x4e')]));_0xefa74d[_0x65ec('0x50')][_0x65ec('0x67')]=_0xf4dbce['id'];if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x68')]){_0xefa74d[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0xefa74d['where'],{'$or':_[_0x65ec('0x40')](_0xefa74d['attributes'],function(_0x3850fd){var _0x1cad36={};_0x1cad36[_0x3850fd]={'$like':'%'+_0x290c68[_0x65ec('0x45')]['filter']+'%'};return _0x1cad36;})});}_0xefa74d=_[_0x65ec('0x51')]({},_0xefa74d,_0x290c68[_0x65ec('0x52')]);return db[_0x65ec('0x69')][_0x65ec('0x2e')]({'where':_0xefa74d[_0x65ec('0x50')]})[_0x65ec('0x1e')](function(_0x1172f3){_0x275a42['count']=_0x1172f3;if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x53')]){_0xefa74d[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x69')]['findAll'](_0xefa74d);})['then'](function(_0x419e33){_0x275a42[_0x65ec('0x56')]=_0x419e33;return _0x275a42;});}})[_0x65ec('0x1e')](respondWithFilteredResult(_0xc47b30,_0xefa74d))[_0x65ec('0x29')](handleError(_0xc47b30,null));};exports[_0x65ec('0x6a')]=function(_0x277499,_0x5a171c,_0x3b0318){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x277499[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5a171c,null))[_0x65ec('0x1e')](function(_0x44b4e6){if(_0x44b4e6){return _0x44b4e6[_0x65ec('0x6a')](_0x277499['query'][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5a171c,null))['catch'](handleError(_0x5a171c,null));};exports[_0x65ec('0x6c')]=function(_0x2ca85,_0x28731c,_0x2606ea){if(_0x2ca85[_0x65ec('0x5d')]['id']){delete _0x2ca85[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2ca85[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x28731c,null))['then'](function(_0x5030f6){if(_0x5030f6){_0x2ca85[_0x65ec('0x5d')][_0x65ec('0x67')]=_0x5030f6['id'];return db[_0x65ec('0x6d')]['create'](_0x2ca85[_0x65ec('0x5d')]);}})[_0x65ec('0x1e')](respondWithResult(_0x28731c,null))[_0x65ec('0x29')](handleError(_0x28731c,null));};exports[_0x65ec('0x6e')]=function(_0x3d79a8,_0x386eba,_0x1ff60f){var _0x3f9105={'raw':![],'where':{}};var _0x27d5d5={};var _0x4f5e10={'count':0x0,'rows':[]};return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x3d79a8[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x386eba,null))[_0x65ec('0x1e')](function(_0xba5894){if(_0xba5894){_0x27d5d5['model']=_[_0x65ec('0x59')](db[_0x65ec('0x6d')][_0x65ec('0x5a')]);_0x27d5d5[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3d79a8['query']);_0x27d5d5['filters']=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],_0x27d5d5[_0x65ec('0x45')]);_0x3f9105[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3f9105[_0x65ec('0x46')]=_0x3f9105[_0x65ec('0x46')]['length']?_0x3f9105[_0x65ec('0x46')]:_0x27d5d5['model'];if(!_0x3d79a8['query'][_0x65ec('0x4a')]('nolimit')){_0x3f9105[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3d79a8['query']['limit']);_0x3f9105[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x3d79a8['query'][_0x65ec('0x2f')]);}_0x3f9105[_0x65ec('0x4c')]=qs['sort'](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x3f9105[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3d79a8[_0x65ec('0x45')],_0x27d5d5[_0x65ec('0x4e')]));_0x3f9105['where'][_0x65ec('0x67')]=_0xba5894['id'];if(_0x3d79a8['query'][_0x65ec('0x68')]){_0x3f9105[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x3f9105['where'],{'$or':_['map'](_0x3f9105[_0x65ec('0x46')],function(_0x5b26b3){var _0x460044={};_0x460044[_0x5b26b3]={'$like':'%'+_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x460044;})});}_0x3f9105=_['merge']({},_0x3f9105,_0x3d79a8[_0x65ec('0x52')]);return db['CannedAnswer']['count']({'where':_0x3f9105[_0x65ec('0x50')]})['then'](function(_0x102e66){_0x4f5e10[_0x65ec('0x2e')]=_0x102e66;if(_0x3d79a8['query']['includeAll']){_0x3f9105['include']=[{'all':!![]}];}return db[_0x65ec('0x6d')][_0x65ec('0x55')](_0x3f9105);})[_0x65ec('0x1e')](function(_0x596f1c){_0x4f5e10['rows']=_0x596f1c;return _0x4f5e10;});}})['then'](respondWithFilteredResult(_0x386eba,_0x3f9105))[_0x65ec('0x29')](handleError(_0x386eba,null));};exports[_0x65ec('0x70')]=function(_0xc908a7,_0x1c8cd1,_0x1df337){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0xc908a7[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1c8cd1,null))[_0x65ec('0x1e')](function(_0x309341){if(_0x309341){return _0x309341['removeAnswers'](_0xc908a7[_0x65ec('0x45')][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x1c8cd1,null))[_0x65ec('0x29')](handleError(_0x1c8cd1,null));};exports[_0x65ec('0x71')]=function(_0x47cf0c,_0x5c6a76,_0x44d1a7){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x47cf0c['params']['id']}})['then'](handleEntityNotFound(_0x5c6a76,null))[_0x65ec('0x1e')](function(_0x3ccb0f){if(_0x3ccb0f){return _0x3ccb0f[_0x65ec('0x71')](_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')],_[_0x65ec('0x72')](_0x47cf0c[_0x65ec('0x5d')],[_0x65ec('0x6b'),'id'])||{})['spread'](function(_0x6c71a){for(var _0x2d78f4=0x0;_0x2d78f4<_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')][_0x65ec('0x49')];_0x2d78f4+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x47cf0c['body'][_0x65ec('0x6b')][_0x2d78f4],'WhatsappAccountId':_0x47cf0c[_0x65ec('0x58')]['id']});}return _0x6c71a;});}})[_0x65ec('0x1e')](respondWithResult(_0x5c6a76,null))[_0x65ec('0x29')](handleError(_0x5c6a76,null));};exports[_0x65ec('0x73')]=function(_0x2a065e,_0x5ef5b8,_0x20481e){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2a065e['params']['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ef5b8,null))[_0x65ec('0x1e')](function(_0x172697){if(_0x172697){return _0x172697[_0x65ec('0x73')](_0x2a065e['query'][_0x65ec('0x6b')])[_0x65ec('0x1e')](function(){if(_[_0x65ec('0x74')](_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')])){for(var _0x11e8fe=0x0;_0x11e8fe<_0x2a065e['query'][_0x65ec('0x6b')][_0x65ec('0x49')];_0x11e8fe+=0x1){socket[_0x65ec('0x75')](_0x65ec('0x76'),{'UserId':Number(_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')][_0x11e8fe]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}}else{socket[_0x65ec('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2a065e['query'][_0x65ec('0x6b')]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}});}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5ef5b8,null))['catch'](handleError(_0x5ef5b8,null));};exports[_0x65ec('0x77')]=function(_0x152af1,_0x41daf9,_0x50953a){var _0x437d98={};var _0x2e4efe={};var _0x49a6a2;var _0x4848cc;return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x152af1[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x41daf9,null))[_0x65ec('0x1e')](function(_0x4587ea){if(_0x4587ea){_0x49a6a2=_0x4587ea;_0x2e4efe[_0x65ec('0x44')]=_['keys'](db['User'][_0x65ec('0x5a')]);_0x2e4efe[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x152af1[_0x65ec('0x45')]);_0x2e4efe[_0x65ec('0x4e')]=_['intersection'](_0x2e4efe['model'],_0x2e4efe['query']);_0x437d98[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x2e4efe[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x152af1['query'][_0x65ec('0x48')]));_0x437d98[_0x65ec('0x46')]=_0x437d98[_0x65ec('0x46')][_0x65ec('0x49')]?_0x437d98[_0x65ec('0x46')]:_0x2e4efe[_0x65ec('0x44')];_0x437d98['order']=qs[_0x65ec('0x4d')](_0x152af1[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x437d98[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x152af1[_0x65ec('0x45')],_0x2e4efe['filters']));if(_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]){_0x437d98[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x437d98[_0x65ec('0x50')],{'$or':_['map'](_0x437d98[_0x65ec('0x46')],function(_0x561a3d){var _0x36af99={};_0x36af99[_0x561a3d]={'$like':'%'+_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x36af99;})});}_0x437d98=_[_0x65ec('0x51')]({},_0x437d98,_0x152af1[_0x65ec('0x52')]);return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23878c){if(_0x23878c){_0x4848cc=_0x23878c[_0x65ec('0x49')];if(!_0x152af1[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x437d98[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x152af1['query'][_0x65ec('0x30')]);_0x437d98[_0x65ec('0x2f')]=qs['offset'](_0x152af1['query'][_0x65ec('0x2f')]);}return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23afc6){if(_0x23afc6){return _0x23afc6?{'count':_0x4848cc,'rows':_0x23afc6}:null;}})[_0x65ec('0x1e')](respondWithResult(_0x41daf9,null))['catch'](handleError(_0x41daf9,null));};exports[_0x65ec('0x78')]=function(_0x297db5,_0x4786be,_0x2203a6){return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x297db5[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x4786be,null))[_0x65ec('0x1e')](function(_0x586546){if(_0x586546){return db[_0x65ec('0x79')]['transaction'](function(_0x30c1d3){return db[_0x65ec('0x7a')][_0x65ec('0x3a')]({'where':{'WhatsappAccountId':_0x297db5['params']['id']},'transaction':_0x30c1d3})['then'](function(_0x361aa1){var _0x50407d=_['map'](_0x297db5['body'],function(_0x43c177){_0x43c177['WhatsappAccountId']=_0x297db5[_0x65ec('0x58')]['id'];return _0x43c177;});return db[_0x65ec('0x7a')][_0x65ec('0x7b')](_0x50407d,{'transaction':_0x30c1d3});});})[_0x65ec('0x1e')](function(){return db['WhatsappApplication'][_0x65ec('0x7c')]({'where':{'WhatsappAccountId':_0x297db5[_0x65ec('0x58')]['id']},'order':'priority'});});}})[_0x65ec('0x1e')](respondWithResult(_0x4786be,null))['catch'](handleError(_0x4786be,null));};exports[_0x65ec('0x7d')]=function(_0x3bb9df,_0x211085,_0xd1f1d1){var _0x2f3855={};var _0x39e285={};var _0x2f70c3;var _0x39ddfa;return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x3bb9df[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x211085,null))[_0x65ec('0x1e')](function(_0x7bfdae){if(_0x7bfdae){_0x2f70c3=_0x7bfdae;_0x39e285['model']=_[_0x65ec('0x59')](db[_0x65ec('0x7a')][_0x65ec('0x5a')]);_0x39e285[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3bb9df[_0x65ec('0x45')]);_0x39e285[_0x65ec('0x4e')]=_['intersection'](_0x39e285['model'],_0x39e285[_0x65ec('0x45')]);_0x2f3855[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x39e285[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x48')]));_0x2f3855[_0x65ec('0x46')]=_0x2f3855[_0x65ec('0x46')]['length']?_0x2f3855[_0x65ec('0x46')]:_0x39e285[_0x65ec('0x44')];_0x2f3855[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x2f3855[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3bb9df[_0x65ec('0x45')],_0x39e285['filters']));if(_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]){_0x2f3855[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x2f3855[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x2f3855[_0x65ec('0x46')],function(_0x1aa45c){var _0x133d19={};_0x133d19[_0x1aa45c]={'$like':'%'+_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x133d19;})});}_0x2f3855=_[_0x65ec('0x51')]({},_0x2f3855,_0x3bb9df[_0x65ec('0x52')]);return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xed5827){if(_0xed5827){_0x39ddfa=_0xed5827[_0x65ec('0x49')];if(!_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x2f3855[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x30')]);_0x2f3855['offset']=qs[_0x65ec('0x2f')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x2f')]);}return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xc2ad21){if(_0xc2ad21){return _0xc2ad21?{'count':_0x39ddfa,'rows':_0xc2ad21}:null;}})['then'](respondWithResult(_0x211085,null))[_0x65ec('0x29')](handleError(_0x211085,null));};exports[_0x65ec('0x7e')]=function(_0x2577d2,_0x5cb76d,_0x1b2340){var _0x120933={'channel':_0x65ec('0x7f')};var _0x4e5a41=[];var _0x1cdddf=[];var _0x326cc7={};return db[_0x65ec('0x41')]['find']({'where':{'id':_0x2577d2[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x7a')],'as':'Applications'}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x25ecfc){_0x120933[_0x65ec('0x80')]=_0x25ecfc;_0x120933['applications']=_[_0x65ec('0x81')](_0x25ecfc['Applications'],[_0x65ec('0x82')],[_0x65ec('0x83')]);if(_0x120933[_0x65ec('0x80')][_0x65ec('0x84')]){delete _0x120933[_0x65ec('0x80')]['Applications'];}return db[_0x65ec('0x85')][_0x65ec('0x64')]();})[_0x65ec('0x1e')](function(_0x2f60cb){if(!_0x2f60cb){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x86'));}_0x4e5a41=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89')]);_0x1cdddf=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89'),_0x65ec('0x8a'),'ListId']);_0x120933['body']={'mapKey':'mobile'};if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]&&_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){_0x120933['body'][_0x65ec('0x8c')]=_0x2577d2['body'][_0x65ec('0x8d')]['replace'](_0x65ec('0x8e'),'');_0x120933['body'][_0x65ec('0x5d')]=_0x2577d2['body'][_0x65ec('0x8f')];_0x120933['body'][_0x65ec('0x90')]=_0x2577d2[_0x65ec('0x5d')]['MessageSid'];}if(_0x120933[_0x65ec('0x5d')]['id']){delete _0x120933[_0x65ec('0x5d')]['id'];}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x92'));}if(_[_0x65ec('0x91')](_0x120933['body'][_0x65ec('0x5d')])||_0x120933[_0x65ec('0x5d')]['body']===''){throw new db['Sequelize'][(_0x65ec('0x1b'))](_0x65ec('0x93'));}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')]['mapKey'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x94')+_0x1cdddf);}if(!_[_0x65ec('0x95')](_0x1cdddf,_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x97')+_0x1cdddf);}_0x326cc7[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933['body'][_0x65ec('0x8c')];return db[_0x65ec('0x98')][_0x65ec('0x5b')]({'where':{'id':_0x120933[_0x65ec('0x80')][_0x65ec('0x99')]},'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':_0x326cc7,'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]});})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x18991a){if(_0x18991a){_0x120933[_0x65ec('0x9c')]=_[_0x65ec('0x72')](_0x18991a,['Contacts']);if(_0x18991a[_0x65ec('0x9a')][_0x65ec('0x49')]){return _0x18991a[_0x65ec('0x9a')][0x0];}var _0x36cbef=_['defaults'](_0x120933['body'],{'firstName':_0x120933['body']['from'],'ListId':_0x18991a['id']});_0x36cbef[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')];return db['CmContact'][_0x65ec('0x5c')](_0x36cbef,{'fields':_0x4e5a41,'raw':!![]});}})['then'](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x4c7cbb){if(_0x4c7cbb){_0x120933[_0x65ec('0x9d')]=_0x4c7cbb;var _0x4da116={'ContactId':_0x4c7cbb['id'],'phone':_0x120933['body']['from'],'WhatsappAccountId':_0x2577d2['params']['id']};var _0x58bf37={'ContactId':_0x4c7cbb['id'],'WhatsappAccountId':_0x2577d2['params']['id'],'closed':![]};return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':_0x58bf37})[_0x65ec('0x1e')](function(_0x569650){if(_0x569650){return[_0x569650,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')](_0x4da116)['then'](function(_0x285b77){return[_0x285b77,!![]];});});}})[_0x65ec('0x9f')](function(_0x56b3e4,_0x5a1b64){_0x120933[_0x65ec('0xa0')]=_0x56b3e4[_0x65ec('0x37')]({'plain':!![]});_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=![];if(_0x5a1b64){if(_0x120933[_0x65ec('0x80')]['autoclose']){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa3')]({'id':0x0,'priority':_0x120933['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x65ec('0xa4')});}_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=!![];}return db[_0x65ec('0xa5')][_0x65ec('0x5c')]({'phone':_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')],'messageId':_0x120933[_0x65ec('0x5d')][_0x65ec('0x90')],'body':_0x120933[_0x65ec('0x5d')][_0x65ec('0x5d')],'WhatsappAccountId':_0x2577d2[_0x65ec('0x58')]['id'],'WhatsappInteractionId':_0x56b3e4['id'],'direction':'in','ContactId':_0x56b3e4[_0x65ec('0xa6')],'AttachmentId':_0x120933[_0x65ec('0x5d')]['AttachmentId']});})[_0x65ec('0x1e')](function(_0x1e3b53){_0x120933[_0x65ec('0x27')]=_0x1e3b53;if(_0x120933[_0x65ec('0xa0')]['UserId']){return db[_0x65ec('0xa7')][_0x65ec('0x5b')]({'attributes':['id','name'],'where':{'id':_0x120933['interaction']['UserId']}})[_0x65ec('0x1e')](function(_0x27c361){if(_0x27c361){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa8')]({'id':0x0,'priority':0x0,'app':_0x65ec('0xa9'),'appdata':_0x27c361['name']+','+(_0x120933[_0x65ec('0x80')][_0x65ec('0xaa')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);})['then'](function(_0x886c4e){if(_0x886c4e){var _0x235157=0xc8;var _0x1ba87c=_0x65ec('0xad');logger[_0x65ec('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1ba87c,_0x235157,_0x65ec('0xae'));logger['debug'](_0x65ec('0xaf'),_0x1ba87c,_0x235157,_0x65ec('0xae'),JSON[_0x65ec('0x24')](_0x886c4e));if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x31')](_0x65ec('0xb0'),'text/xml')[_0x65ec('0xb1')](_0x65ec('0xb2'));}else{return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x2d')](_0x886c4e);}}})[_0x65ec('0x29')](handleError(_0x5cb76d,null));};exports['send']=function(_0x36381a,_0x5ac2b0,_0x2fa462){var _0x22528e,_0x1929c7,_0x3af098;if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')])||_0x36381a['body'][_0x65ec('0x5d')]===''){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')]['to'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0xb3'));}_0x22528e=_0x36381a['body']['to'];return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x36381a[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x98')],'as':_0x65ec('0xb4'),'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':{'mobile':_0x22528e},'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))['then'](function(_0x4998a){if(_0x4998a&&_0x4998a[_0x65ec('0xb4')]){_0x1929c7=_0x4998a[_0x65ec('0x37')]({'plain':!![]});if(_0x1929c7[_0x65ec('0xb4')]&&_0x1929c7[_0x65ec('0xb4')][_0x65ec('0x9a')]['length']){return _0x1929c7[_0x65ec('0xb4')]['Contacts'][0x0];}return db[_0x65ec('0x85')][_0x65ec('0x5c')](_[_0x65ec('0xb5')](_0x36381a[_0x65ec('0x5d')],{'firstName':_0x22528e,'mobile':_0x22528e,'phone':_0x22528e,'ListId':_0x1929c7[_0x65ec('0x99')]}));}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))[_0x65ec('0x1e')](function(_0x205916){if(_0x205916){_0x3af098=_0x205916;return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':{'ContactId':_0x3af098['id'],'closed':![],'WhatsappAccountId':_0x1929c7['id']}})['then'](function(_0x1cb25d){if(_0x1cb25d){return[_0x1cb25d,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')]({'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id'],'WhatsappAccountId':_0x1929c7['id'],'phone':_0x22528e,'firstMsgDirection':_0x65ec('0xb6'),'Messages':[_['merge'](_0x36381a[_0x65ec('0x5d')],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']})]},{'include':[{'model':db[_0x65ec('0xa5')],'as':_0x65ec('0xb7')}]})[_0x65ec('0x1e')](function(_0x422bd2){return[_0x422bd2,!![]];});});}})[_0x65ec('0x9f')](function(_0x506ccf,_0x16eded){if(_0x16eded){return _0x506ccf;}return db[_0x65ec('0xa5')]['create'](_[_0x65ec('0x51')](_0x36381a['body'],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'WhatsappInteractionId':_0x506ccf['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']}))[_0x65ec('0x1e')](function(_0x566320){_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]=[];_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]['push'](_0x566320['dataValues']);return _0x506ccf;});})[_0x65ec('0x1e')](respondWithResult(_0x5ac2b0,null))['catch'](handleError(_0x5ac2b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 91940ec..fbe3c2a 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 _0xdf55=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x335278,_0x512801){var _0x1354a8=function(_0x3904c8){while(--_0x3904c8){_0x335278['push'](_0x335278['shift']());}};_0x1354a8(++_0x512801);}(_0xdf55,0x83));var _0x5df5=function(_0x223a7c,_0x11ebdc){_0x223a7c=_0x223a7c-0x0;var _0x22e78a=_0xdf55[_0x223a7c];return _0x22e78a;};'use strict';var EventEmitter=require(_0x5df5('0x0'));var WhatsappAccount=require(_0x5df5('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5df5('0x2')](0x0);var events={'afterCreate':_0x5df5('0x3'),'afterUpdate':'update','afterDestroy':_0x5df5('0x4')};function emitEvent(_0x773e15){return function(_0x381a4c,_0x521007,_0x289af4){WhatsappAccountEvents[_0x5df5('0x5')](_0x773e15+':'+_0x381a4c['id'],_0x381a4c);WhatsappAccountEvents[_0x5df5('0x5')](_0x773e15,_0x381a4c);_0x289af4(null);};}for(var e in events){if(events[_0x5df5('0x6')](e)){var event=events[e];WhatsappAccount[_0x5df5('0x7')](e,emitEvent(event));}}module[_0x5df5('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x81c6=['exports','../../mysqldb','update','remove','emit','hook'];(function(_0x2f3278,_0x44d03b){var _0x35ec32=function(_0x3d881b){while(--_0x3d881b){_0x2f3278['push'](_0x2f3278['shift']());}};_0x35ec32(++_0x44d03b);}(_0x81c6,0x1d5));var _0x681c=function(_0xe506a9,_0x3105d4){_0xe506a9=_0xe506a9-0x0;var _0x12ca6f=_0x81c6[_0xe506a9];return _0x12ca6f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x681c('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x681c('0x1'),'afterDestroy':_0x681c('0x2')};function emitEvent(_0x7a556b){return function(_0x5566e5,_0x44c18e,_0x2aff9d){WhatsappAccountEvents[_0x681c('0x3')](_0x7a556b+':'+_0x5566e5['id'],_0x5566e5);WhatsappAccountEvents[_0x681c('0x3')](_0x7a556b,_0x5566e5);_0x2aff9d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x681c('0x4')](e,emitEvent(event));}}module[_0x681c('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 010887c..ce1c6b6 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 _0x029e=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x029e,0x7b));var _0xe029=function(_0x38b36d,_0x221191){_0x38b36d=_0x38b36d-0x0;var _0x5a6f00=_0x029e[_0x38b36d];return _0x5a6f00;};'use strict';var _=require(_0xe029('0x0'));var util=require(_0xe029('0x1'));var logger=require(_0xe029('0x2'))(_0xe029('0x3'));var moment=require('moment');var BPromise=require(_0xe029('0x4'));var rp=require(_0xe029('0x5'));var fs=require('fs');var path=require(_0xe029('0x6'));var rimraf=require('rimraf');var config=require(_0xe029('0x7'));var attributes=require(_0xe029('0x8'));module['exports']=function(_0x30dd49,_0x15f289){return _0x30dd49[_0xe029('0x9')](_0xe029('0xa'),attributes,{'tableName':_0xe029('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9728=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0xcd8691,_0x1a3a5e){var _0x568fbb=function(_0x254c6e){while(--_0x254c6e){_0xcd8691['push'](_0xcd8691['shift']());}};_0x568fbb(++_0x1a3a5e);}(_0x9728,0x137));var _0x8972=function(_0x4a82c4,_0x20e706){_0x4a82c4=_0x4a82c4-0x0;var _0x51c198=_0x9728[_0x4a82c4];return _0x51c198;};'use strict';var _=require(_0x8972('0x0'));var util=require(_0x8972('0x1'));var logger=require(_0x8972('0x2'))(_0x8972('0x3'));var moment=require(_0x8972('0x4'));var BPromise=require(_0x8972('0x5'));var rp=require(_0x8972('0x6'));var fs=require('fs');var path=require(_0x8972('0x7'));var rimraf=require('rimraf');var config=require(_0x8972('0x8'));var attributes=require(_0x8972('0x9'));module['exports']=function(_0x1333ba,_0x15b038){return _0x1333ba[_0x8972('0xa')](_0x8972('0xb'),attributes,{'tableName':_0x8972('0xc'),'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 1264674..cf5e9de 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 _0xc1aa=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./whatsappAccount.socket','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','then','lodash'];(function(_0x67724b,_0x452789){var _0x4c6de1=function(_0x7ddf39){while(--_0x7ddf39){_0x67724b['push'](_0x67724b['shift']());}};_0x4c6de1(++_0x452789);}(_0xc1aa,0xa9));var _0xac1a=function(_0x23a651,_0x4c776c){_0x23a651=_0x23a651-0x0;var _0x36f526=_0xc1aa[_0x23a651];return _0x36f526;};'use strict';var _=require(_0xac1a('0x0'));var util=require('util');var moment=require(_0xac1a('0x1'));var BPromise=require(_0xac1a('0x2'));var rs=require(_0xac1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac1a('0x4'))['db'];var utils=require(_0xac1a('0x5'));var logger=require('../../config/logger')(_0xac1a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xac1a('0x7')]({'port':0x232a});config[_0xac1a('0x8')]=_[_0xac1a('0x9')](config[_0xac1a('0x8')],{'host':_0xac1a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xac1a('0xb'))['register'](socket);function respondWithRpcPromise(_0x330545,_0x209577,_0x4535c6){return new BPromise(function(_0x6d12ba,_0x6defc7){return client[_0xac1a('0xc')](_0x330545,_0x4535c6)['then'](function(_0x46201c){logger[_0xac1a('0xd')]('WhatsappAccount,\x20%s,\x20%s',_0x209577,_0xac1a('0xe'));logger[_0xac1a('0xf')](_0xac1a('0x10'),_0x209577,'request\x20sent',JSON[_0xac1a('0x11')](_0x46201c));if(_0x46201c['error']){if(_0x46201c[_0xac1a('0x12')][_0xac1a('0x13')]===0x1f4){logger[_0xac1a('0x12')](_0xac1a('0x14'),_0x209577,_0x46201c[_0xac1a('0x12')][_0xac1a('0x15')]);return _0x6defc7(_0x46201c['error'][_0xac1a('0x15')]);}logger[_0xac1a('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x209577,_0x46201c[_0xac1a('0x12')]['message']);return _0x6d12ba(_0x46201c[_0xac1a('0x12')][_0xac1a('0x15')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x209577,'request\x20sent');_0x6d12ba(_0x46201c['result'][_0xac1a('0x15')]);}})[_0xac1a('0x16')](function(_0x3ac392){logger[_0xac1a('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x209577,_0x3ac392);_0x6defc7(_0x3ac392);});});}exports[_0xac1a('0x17')]=function(_0x4c66ad){var _0x4f45fc=this;return new Promise(function(_0x3a3916,_0x368093){return db[_0xac1a('0x18')][_0xac1a('0x19')]({'raw':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad['options'][_0xac1a('0x1c')]||null:null,'attributes':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad['options'][_0xac1a('0x1d')]||null:null,'include':_0x4c66ad['options']?_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1e')]?_['map'](_0x4c66ad['options'][_0xac1a('0x1e')],function(_0x1c7675){return{'model':db[_0x1c7675[_0xac1a('0x1f')]],'as':_0x1c7675['as'],'attributes':_0x1c7675[_0xac1a('0x1d')],'include':_0x1c7675[_0xac1a('0x1e')]?_[_0xac1a('0x20')](_0x1c7675[_0xac1a('0x1e')],function(_0x440efc){return{'model':db[_0x440efc['model']],'as':_0x440efc['as'],'attributes':_0x440efc[_0xac1a('0x1d')],'include':_0x440efc['include']?_[_0xac1a('0x20')](_0x440efc[_0xac1a('0x1e')],function(_0x3f028b){return{'model':db[_0x3f028b['model']],'as':_0x3f028b['as'],'attributes':_0x3f028b[_0xac1a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac1a('0x21')](function(_0x24a2ae){logger[_0xac1a('0xd')](_0xac1a('0x17'),_0x4c66ad);logger[_0xac1a('0xf')](_0xac1a('0x17'),_0x4c66ad,JSON[_0xac1a('0x11')](_0x24a2ae));_0x3a3916(_0x24a2ae);})[_0xac1a('0x16')](function(_0x89ae55){logger[_0xac1a('0x12')](_0xac1a('0x17'),_0x89ae55['message'],_0x4c66ad);_0x368093(_0x4f45fc[_0xac1a('0x12')](0x1f4,_0x89ae55[_0xac1a('0x15')]));});});}; \ No newline at end of file +var _0x093b=['../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','localhost','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','WhatsappAccount','find','options','raw','attributes','include','map','model','ShowWhatsappAccount','util','moment','bluebird','randomstring'];(function(_0x5dfbc4,_0x324f2f){var _0x4a8c1e=function(_0xa0ddd5){while(--_0xa0ddd5){_0x5dfbc4['push'](_0x5dfbc4['shift']());}};_0x4a8c1e(++_0x324f2f);}(_0x093b,0x80));var _0xb093=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x093b[_0x186376];return _0x2dbdd9;};'use strict';var _=require('lodash');var util=require(_0xb093('0x0'));var moment=require(_0xb093('0x1'));var BPromise=require(_0xb093('0x2'));var rs=require(_0xb093('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb093('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb093('0x5'));var config=require('../../config/environment');var jayson=require(_0xb093('0x6'));var client=jayson[_0xb093('0x7')][_0xb093('0x8')]({'port':0x232a});config['redis']=_[_0xb093('0x9')](config[_0xb093('0xa')],{'host':_0xb093('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb093('0xa')]));require(_0xb093('0xc'))[_0xb093('0xd')](socket);function respondWithRpcPromise(_0x460353,_0x47d43c,_0x4714d1){return new BPromise(function(_0x87ab10,_0x1c618f){return client['request'](_0x460353,_0x4714d1)[_0xb093('0xe')](function(_0x3dfc7c){logger[_0xb093('0xf')](_0xb093('0x10'),_0x47d43c,'request\x20sent');logger[_0xb093('0x11')](_0xb093('0x12'),_0x47d43c,_0xb093('0x13'),JSON[_0xb093('0x14')](_0x3dfc7c));if(_0x3dfc7c['error']){if(_0x3dfc7c[_0xb093('0x15')]['code']===0x1f4){logger[_0xb093('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x47d43c,_0x3dfc7c[_0xb093('0x15')][_0xb093('0x16')]);return _0x1c618f(_0x3dfc7c[_0xb093('0x15')]['message']);}logger[_0xb093('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x47d43c,_0x3dfc7c[_0xb093('0x15')]['message']);return _0x87ab10(_0x3dfc7c[_0xb093('0x15')][_0xb093('0x16')]);}else{logger['info'](_0xb093('0x10'),_0x47d43c,_0xb093('0x13'));_0x87ab10(_0x3dfc7c['result'][_0xb093('0x16')]);}})[_0xb093('0x17')](function(_0x4557da){logger[_0xb093('0x15')](_0xb093('0x10'),_0x47d43c,_0x4557da);_0x1c618f(_0x4557da);});});}exports['ShowWhatsappAccount']=function(_0xf6cfbe){var _0x5eb620=this;return new Promise(function(_0x579819,_0x55ff11){return db[_0xb093('0x18')][_0xb093('0x19')]({'raw':_0xf6cfbe[_0xb093('0x1a')]?_0xf6cfbe[_0xb093('0x1a')][_0xb093('0x1b')]===undefined?!![]:![]:!![],'where':_0xf6cfbe[_0xb093('0x1a')]?_0xf6cfbe[_0xb093('0x1a')]['where']||null:null,'attributes':_0xf6cfbe[_0xb093('0x1a')]?_0xf6cfbe[_0xb093('0x1a')][_0xb093('0x1c')]||null:null,'include':_0xf6cfbe[_0xb093('0x1a')]?_0xf6cfbe[_0xb093('0x1a')][_0xb093('0x1d')]?_['map'](_0xf6cfbe[_0xb093('0x1a')][_0xb093('0x1d')],function(_0x5a07d1){return{'model':db[_0x5a07d1['model']],'as':_0x5a07d1['as'],'attributes':_0x5a07d1[_0xb093('0x1c')],'include':_0x5a07d1['include']?_[_0xb093('0x1e')](_0x5a07d1[_0xb093('0x1d')],function(_0x3e7dd5){return{'model':db[_0x3e7dd5[_0xb093('0x1f')]],'as':_0x3e7dd5['as'],'attributes':_0x3e7dd5[_0xb093('0x1c')],'include':_0x3e7dd5[_0xb093('0x1d')]?_[_0xb093('0x1e')](_0x3e7dd5['include'],function(_0x23041e){return{'model':db[_0x23041e[_0xb093('0x1f')]],'as':_0x23041e['as'],'attributes':_0x23041e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3d7b0){logger['info']('ShowWhatsappAccount',_0xf6cfbe);logger[_0xb093('0x11')](_0xb093('0x20'),_0xf6cfbe,JSON[_0xb093('0x14')](_0xc3d7b0));_0x579819(_0xc3d7b0);})[_0xb093('0x17')](function(_0x3bdb17){logger['error'](_0xb093('0x20'),_0x3bdb17[_0xb093('0x16')],_0xf6cfbe);_0x55ff11(_0x5eb620[_0xb093('0x15')](0x1f4,_0x3bdb17[_0xb093('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8d28076..d4337ab 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 _0x525c=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x525c,0xc1));var _0xc525=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x525c[_0x16d10f];return _0x50c823;};'use strict';var WhatsappAccountEvents=require(_0xc525('0x0'));var events=[_0xc525('0x1'),_0xc525('0x2'),_0xc525('0x3')];function createListener(_0x592302,_0x54469d){return function(_0x52a75c){_0x54469d[_0xc525('0x4')](_0x592302,_0x52a75c);};}function removeListener(_0x48e191,_0x63f828){return function(){WhatsappAccountEvents[_0xc525('0x5')](_0x48e191,_0x63f828);};}exports[_0xc525('0x6')]=function(_0x50c9d5){for(var _0x307e42=0x0,_0x57f2b4=events['length'];_0x307e42<_0x57f2b4;_0x307e42++){var _0x4c368e=events[_0x307e42];var _0x171f4e=createListener(_0xc525('0x7')+_0x4c368e,_0x50c9d5);WhatsappAccountEvents['on'](_0x4c368e,_0x171f4e);}}; \ No newline at end of file +var _0xe308=['save','remove','update','removeListener','length','whatsappAccount:'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xe308,0x90));var _0x8e30=function(_0x3d7f85,_0x338be4){_0x3d7f85=_0x3d7f85-0x0;var _0x197f86=_0xe308[_0x3d7f85];return _0x197f86;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x8e30('0x0'),_0x8e30('0x1'),_0x8e30('0x2')];function createListener(_0x2a163f,_0x5e2f55){return function(_0x4c3338){_0x5e2f55['emit'](_0x2a163f,_0x4c3338);};}function removeListener(_0xeda5ac,_0x2854f3){return function(){WhatsappAccountEvents[_0x8e30('0x3')](_0xeda5ac,_0x2854f3);};}exports['register']=function(_0x1b21ea){for(var _0x22c394=0x0,_0x19e55e=events[_0x8e30('0x4')];_0x22c394<_0x19e55e;_0x22c394++){var _0x5ee209=events[_0x22c394];var _0x1998c6=createListener(_0x8e30('0x5')+_0x5ee209,_0x1b21ea);WhatsappAccountEvents['on'](_0x5ee209,_0x1998c6);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1780720..bb2e1b2 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 _0x63bd=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x339648,_0x30b550){var _0x499170=function(_0x15e5cf){while(--_0x15e5cf){_0x339648['push'](_0x339648['shift']());}};_0x499170(++_0x30b550);}(_0x63bd,0x1e9));var _0xd63b=function(_0x494849,_0x3a016d){_0x494849=_0x494849-0x0;var _0xf57a28=_0x63bd[_0x494849];return _0xf57a28;};'use strict';var multer=require(_0xd63b('0x0'));var util=require(_0xd63b('0x1'));var path=require(_0xd63b('0x2'));var timeout=require(_0xd63b('0x3'));var express=require(_0xd63b('0x4'));var router=express[_0xd63b('0x5')]();var auth=require(_0xd63b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd63b('0x7'));var controller=require(_0xd63b('0x8'));router[_0xd63b('0x9')]('/',auth[_0xd63b('0xa')](),controller[_0xd63b('0xb')]);router['get'](_0xd63b('0xc'),auth[_0xd63b('0xa')](),controller[_0xd63b('0xd')]);router[_0xd63b('0xe')]('/',auth['isAuthenticated'](),controller[_0xd63b('0xf')]);router[_0xd63b('0x10')]('/:id',auth[_0xd63b('0xa')](),controller['update']);router[_0xd63b('0x11')]('/:id',auth[_0xd63b('0xa')](),controller[_0xd63b('0x12')]);module[_0xd63b('0x13')]=router; \ No newline at end of file +var _0xbd3d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util'];(function(_0x1c7991,_0x4dbcaa){var _0x11c0d3=function(_0x27efbf){while(--_0x27efbf){_0x1c7991['push'](_0x1c7991['shift']());}};_0x11c0d3(++_0x4dbcaa);}(_0xbd3d,0xd0));var _0xdbd3=function(_0x5d5036,_0x597190){_0x5d5036=_0x5d5036-0x0;var _0x62c2b8=_0xbd3d[_0x5d5036];return _0x62c2b8;};'use strict';var multer=require('multer');var util=require(_0xdbd3('0x0'));var path=require(_0xdbd3('0x1'));var timeout=require(_0xdbd3('0x2'));var express=require(_0xdbd3('0x3'));var router=express[_0xdbd3('0x4')]();var auth=require(_0xdbd3('0x5'));var interaction=require(_0xdbd3('0x6'));var config=require(_0xdbd3('0x7'));var controller=require('./whatsappApplication.controller');router[_0xdbd3('0x8')]('/',auth[_0xdbd3('0x9')](),controller[_0xdbd3('0xa')]);router['get'](_0xdbd3('0xb'),auth[_0xdbd3('0x9')](),controller[_0xdbd3('0xc')]);router[_0xdbd3('0xd')]('/',auth[_0xdbd3('0x9')](),controller[_0xdbd3('0xe')]);router[_0xdbd3('0xf')](_0xdbd3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xdbd3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdbd3('0x11')]);module[_0xdbd3('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 88946a9..0e72b24 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 _0x4d05=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x160030,_0x55a30b){var _0x4297a7=function(_0x472add){while(--_0x472add){_0x160030['push'](_0x160030['shift']());}};_0x4297a7(++_0x55a30b);}(_0x4d05,0xee));var _0x54d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d05[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x54d0('0x0'));module[_0x54d0('0x1')]={'priority':{'type':Sequelize[_0x54d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x54d0('0x3')],'allowNull':![],'defaultValue':_0x54d0('0x4')},'appdata':{'type':Sequelize[_0x54d0('0x5')]()},'description':{'type':Sequelize[_0x54d0('0x3')]},'interval':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':_0x54d0('0x6')}}; \ No newline at end of file +var _0x7c0c=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x56bd49,_0x3c2556){var _0x5a72ad=function(_0x288c15){while(--_0x288c15){_0x56bd49['push'](_0x56bd49['shift']());}};_0x5a72ad(++_0x3c2556);}(_0x7c0c,0xdf));var _0xc7c0=function(_0x15c056,_0x5bf32d){_0x15c056=_0x15c056-0x0;var _0x3838c3=_0x7c0c[_0x15c056];return _0x3838c3;};'use strict';var Sequelize=require(_0xc7c0('0x0'));module[_0xc7c0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc7c0('0x2')],'allowNull':![],'defaultValue':_0xc7c0('0x3')},'appdata':{'type':Sequelize[_0xc7c0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc7c0('0x2')],'defaultValue':_0xc7c0('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index eb432c2..5ee7e24 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 _0x3d5f=['save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','catch','show','includeAll','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','apply','reject'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3d5f,0x19f));var _0xf3d5=function(_0x165fc3,_0x4aebb9){_0x165fc3=_0x165fc3-0x0;var _0x5a5257=_0x3d5f[_0x165fc3];return _0x5a5257;};'use strict';var pdf=require(_0xf3d5('0x0'));var emlformat=require(_0xf3d5('0x1'));var rimraf=require(_0xf3d5('0x2'));var zipdir=require(_0xf3d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf3d5('0x4'));var BPromise=require(_0xf3d5('0x5'));var Mustache=require(_0xf3d5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf3d5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf3d5('0x8'));var squel=require('squel');var crypto=require(_0xf3d5('0x9'));var jsforce=require(_0xf3d5('0xa'));var deskjs=require(_0xf3d5('0xb'));var toCsv=require(_0xf3d5('0xc'));var querystring=require(_0xf3d5('0xd'));var Papa=require('papaparse');var Redis=require(_0xf3d5('0xe'));var authService=require(_0xf3d5('0xf'));var qs=require(_0xf3d5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3d5('0x11'));var logger=require('../../config/logger')(_0xf3d5('0x12'));var utils=require(_0xf3d5('0x13'));var config=require(_0xf3d5('0x14'));var db=require(_0xf3d5('0x15'))['db'];function respondWithStatusCode(_0x4d637e,_0x468b97){_0x468b97=_0x468b97||0xcc;return function(_0x309d13){if(_0x309d13){return _0x4d637e['sendStatus'](_0x468b97);}return _0x4d637e['status'](_0x468b97)['end']();};}function respondWithResult(_0x910e38,_0x38a024){_0x38a024=_0x38a024||0xc8;return function(_0x50196f){if(_0x50196f){return _0x910e38[_0xf3d5('0x16')](_0x38a024)[_0xf3d5('0x17')](_0x50196f);}};}function respondWithFilteredResult(_0x23dddb,_0xd4f11c){return function(_0xa73ae8){if(_0xa73ae8){var _0x28b009=_0xa73ae8['count'],_0xd76a11=_0xd4f11c[_0xf3d5('0x18')],_0x52bc3e=_0xd4f11c['offset']+_0xd4f11c['limit'],_0x178d5f;if(_0x52bc3e>=_0x28b009){_0x52bc3e=_0x28b009;_0x178d5f=0xc8;}else{_0x178d5f=0xce;}_0x23dddb[_0xf3d5('0x16')](_0x178d5f);return _0x23dddb[_0xf3d5('0x19')](_0xf3d5('0x1a'),_0xd76a11+'-'+_0x52bc3e+'/'+_0x28b009)['json'](_0xa73ae8);}return null;};}function patchUpdates(_0x49f5b4){return function(_0x2ea63d){try{jsonpatch[_0xf3d5('0x1b')](_0x2ea63d,_0x49f5b4,!![]);}catch(_0x5477a9){return BPromise[_0xf3d5('0x1c')](_0x5477a9);}return _0x2ea63d[_0xf3d5('0x1d')]();};}function saveUpdates(_0x526bb2,_0x1fc99a){return function(_0x36c8b8){if(_0x36c8b8){return _0x36c8b8[_0xf3d5('0x1e')](_0x526bb2)[_0xf3d5('0x1f')](function(_0x3f8b5a){return _0x3f8b5a;});}return null;};}function removeEntity(_0x4c5005,_0x591d30){return function(_0x31186d){if(_0x31186d){return _0x31186d[_0xf3d5('0x20')]()[_0xf3d5('0x1f')](function(){_0x4c5005[_0xf3d5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x399d2b,_0x1ed153){return function(_0xa53d4e){if(!_0xa53d4e){_0x399d2b['sendStatus'](0x194);}return _0xa53d4e;};}function handleError(_0x5843fb,_0x4241d2){_0x4241d2=_0x4241d2||0x1f4;return function(_0x5d2978){logger[_0xf3d5('0x21')](_0x5d2978[_0xf3d5('0x22')]);if(_0x5d2978['name']){delete _0x5d2978[_0xf3d5('0x23')];}_0x5843fb['status'](_0x4241d2)[_0xf3d5('0x24')](_0x5d2978);};}exports[_0xf3d5('0x25')]=function(_0x553849,_0x385d3a){var _0xe52898={},_0x3fe035={},_0xc6c248={'count':0x0,'rows':[]};var _0x3a59cb=_['map'](db[_0xf3d5('0x26')][_0xf3d5('0x27')],function(_0x45d65d){return{'name':_0x45d65d[_0xf3d5('0x28')],'type':_0x45d65d[_0xf3d5('0x29')][_0xf3d5('0x2a')]};});_0x3fe035[_0xf3d5('0x2b')]=_[_0xf3d5('0x2c')](_0x3a59cb,'name');_0x3fe035[_0xf3d5('0x2d')]=_[_0xf3d5('0x2e')](_0x553849[_0xf3d5('0x2d')]);_0x3fe035[_0xf3d5('0x2f')]=_[_0xf3d5('0x30')](_0x3fe035[_0xf3d5('0x2b')],_0x3fe035[_0xf3d5('0x2d')]);_0xe52898[_0xf3d5('0x31')]=_[_0xf3d5('0x30')](_0x3fe035[_0xf3d5('0x2b')],qs[_0xf3d5('0x32')](_0x553849[_0xf3d5('0x2d')]['fields']));_0xe52898[_0xf3d5('0x31')]=_0xe52898[_0xf3d5('0x31')][_0xf3d5('0x33')]?_0xe52898[_0xf3d5('0x31')]:_0x3fe035[_0xf3d5('0x2b')];if(!_0x553849[_0xf3d5('0x2d')][_0xf3d5('0x34')](_0xf3d5('0x35'))){_0xe52898[_0xf3d5('0x36')]=qs[_0xf3d5('0x36')](_0x553849[_0xf3d5('0x2d')]['limit']);_0xe52898[_0xf3d5('0x18')]=qs[_0xf3d5('0x18')](_0x553849['query'][_0xf3d5('0x18')]);}_0xe52898[_0xf3d5('0x37')]=qs[_0xf3d5('0x38')](_0x553849[_0xf3d5('0x2d')][_0xf3d5('0x38')]);_0xe52898[_0xf3d5('0x39')]=qs[_0xf3d5('0x2f')](_[_0xf3d5('0x3a')](_0x553849[_0xf3d5('0x2d')],_0x3fe035[_0xf3d5('0x2f')]),_0x3a59cb);if(_0x553849[_0xf3d5('0x2d')]['filter']){_0xe52898[_0xf3d5('0x39')]=_[_0xf3d5('0x3b')](_0xe52898[_0xf3d5('0x39')],{'$or':_[_0xf3d5('0x2c')](_0x3a59cb,function(_0x4d6481){if(_0x4d6481[_0xf3d5('0x29')]!==_0xf3d5('0x3c')){var _0x18fb75={};_0x18fb75[_0x4d6481[_0xf3d5('0x23')]]={'$like':'%'+_0x553849[_0xf3d5('0x2d')][_0xf3d5('0x3d')]+'%'};return _0x18fb75;}})});}_0xe52898=_['merge']({},_0xe52898,_0x553849[_0xf3d5('0x3e')]);var _0x2a3444={'where':_0xe52898[_0xf3d5('0x39')]};return db[_0xf3d5('0x26')][_0xf3d5('0x3f')](_0x2a3444)['then'](function(_0x3c81e2){_0xc6c248[_0xf3d5('0x3f')]=_0x3c81e2;if(_0x553849['query']['includeAll']){_0xe52898['include']=[{'all':!![]}];}return db[_0xf3d5('0x26')][_0xf3d5('0x40')](_0xe52898);})[_0xf3d5('0x1f')](function(_0x400eb5){_0xc6c248[_0xf3d5('0x41')]=_0x400eb5;return _0xc6c248;})['then'](respondWithFilteredResult(_0x385d3a,_0xe52898))[_0xf3d5('0x42')](handleError(_0x385d3a,null));};exports[_0xf3d5('0x43')]=function(_0x32b99c,_0x5edbc3){var _0x532485={'raw':!![],'where':{'id':_0x32b99c['params']['id']}},_0x36fa68={};_0x36fa68[_0xf3d5('0x2b')]=_[_0xf3d5('0x2e')](db[_0xf3d5('0x26')][_0xf3d5('0x27')]);_0x36fa68[_0xf3d5('0x2d')]=_[_0xf3d5('0x2e')](_0x32b99c[_0xf3d5('0x2d')]);_0x36fa68['filters']=_[_0xf3d5('0x30')](_0x36fa68[_0xf3d5('0x2b')],_0x36fa68[_0xf3d5('0x2d')]);_0x532485['attributes']=_[_0xf3d5('0x30')](_0x36fa68['model'],qs[_0xf3d5('0x32')](_0x32b99c[_0xf3d5('0x2d')][_0xf3d5('0x32')]));_0x532485[_0xf3d5('0x31')]=_0x532485[_0xf3d5('0x31')]['length']?_0x532485[_0xf3d5('0x31')]:_0x36fa68[_0xf3d5('0x2b')];if(_0x32b99c[_0xf3d5('0x2d')][_0xf3d5('0x44')]){_0x532485[_0xf3d5('0x45')]=[{'all':!![]}];}_0x532485=_['merge']({},_0x532485,_0x32b99c[_0xf3d5('0x3e')]);return db[_0xf3d5('0x26')][_0xf3d5('0x46')](_0x532485)['then'](handleEntityNotFound(_0x5edbc3,null))['then'](respondWithResult(_0x5edbc3,null))['catch'](handleError(_0x5edbc3,null));};exports[_0xf3d5('0x47')]=function(_0x1ef883,_0x4be096){return db['WhatsappApplication'][_0xf3d5('0x47')](_0x1ef883['body'],{})[_0xf3d5('0x1f')](respondWithResult(_0x4be096,0xc9))[_0xf3d5('0x42')](handleError(_0x4be096,null));};exports['update']=function(_0x379da8,_0x449411){if(_0x379da8[_0xf3d5('0x48')]['id']){delete _0x379da8[_0xf3d5('0x48')]['id'];}return db['WhatsappApplication'][_0xf3d5('0x46')]({'where':{'id':_0x379da8[_0xf3d5('0x49')]['id']}})['then'](handleEntityNotFound(_0x449411,null))[_0xf3d5('0x1f')](saveUpdates(_0x379da8[_0xf3d5('0x48')],null))[_0xf3d5('0x1f')](respondWithResult(_0x449411,null))[_0xf3d5('0x42')](handleError(_0x449411,null));};exports[_0xf3d5('0x20')]=function(_0x51d513,_0x43dea2){return db[_0xf3d5('0x26')][_0xf3d5('0x46')]({'where':{'id':_0x51d513[_0xf3d5('0x49')]['id']}})[_0xf3d5('0x1f')](handleEntityNotFound(_0x43dea2,null))[_0xf3d5('0x1f')](removeEntity(_0x43dea2,null))[_0xf3d5('0x42')](handleError(_0x43dea2,null));}; \ No newline at end of file +var _0x3e2e=['set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','WhatsappApplication','count','includeAll','include','rows','catch','show','params','options','find','create','body','update','html-pdf','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3e2e,0x1e2));var _0xe3e2=function(_0x2ed632,_0x5cc598){_0x2ed632=_0x2ed632-0x0;var _0x353cab=_0x3e2e[_0x2ed632];return _0x353cab;};'use strict';var pdf=require(_0xe3e2('0x0'));var emlformat=require(_0xe3e2('0x1'));var rimraf=require(_0xe3e2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3e2('0x3'));var Mustache=require(_0xe3e2('0x4'));var util=require(_0xe3e2('0x5'));var path=require(_0xe3e2('0x6'));var sox=require(_0xe3e2('0x7'));var csv=require(_0xe3e2('0x8'));var ejs=require(_0xe3e2('0x9'));var fs=require('fs');var _=require(_0xe3e2('0xa'));var squel=require(_0xe3e2('0xb'));var crypto=require(_0xe3e2('0xc'));var jsforce=require(_0xe3e2('0xd'));var deskjs=require(_0xe3e2('0xe'));var toCsv=require(_0xe3e2('0x8'));var querystring=require(_0xe3e2('0xf'));var Papa=require(_0xe3e2('0x10'));var Redis=require(_0xe3e2('0x11'));var authService=require(_0xe3e2('0x12'));var qs=require(_0xe3e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3e2('0x14'))('api');var utils=require(_0xe3e2('0x15'));var config=require('../../config/environment');var db=require(_0xe3e2('0x16'))['db'];function respondWithStatusCode(_0x3c1d8f,_0x477d41){_0x477d41=_0x477d41||0xcc;return function(_0x159cb5){if(_0x159cb5){return _0x3c1d8f[_0xe3e2('0x17')](_0x477d41);}return _0x3c1d8f[_0xe3e2('0x18')](_0x477d41)[_0xe3e2('0x19')]();};}function respondWithResult(_0x466711,_0x5c7340){_0x5c7340=_0x5c7340||0xc8;return function(_0x1df509){if(_0x1df509){return _0x466711[_0xe3e2('0x18')](_0x5c7340)[_0xe3e2('0x1a')](_0x1df509);}};}function respondWithFilteredResult(_0x579e9e,_0x1501de){return function(_0xa2583f){if(_0xa2583f){var _0x4b9e10=_0xa2583f['count'],_0x50a49c=_0x1501de[_0xe3e2('0x1b')],_0x16f334=_0x1501de[_0xe3e2('0x1b')]+_0x1501de[_0xe3e2('0x1c')],_0x14bd47;if(_0x16f334>=_0x4b9e10){_0x16f334=_0x4b9e10;_0x14bd47=0xc8;}else{_0x14bd47=0xce;}_0x579e9e[_0xe3e2('0x18')](_0x14bd47);return _0x579e9e[_0xe3e2('0x1d')](_0xe3e2('0x1e'),_0x50a49c+'-'+_0x16f334+'/'+_0x4b9e10)['json'](_0xa2583f);}return null;};}function patchUpdates(_0x339e56){return function(_0x5b357a){try{jsonpatch[_0xe3e2('0x1f')](_0x5b357a,_0x339e56,!![]);}catch(_0x2ec524){return BPromise['reject'](_0x2ec524);}return _0x5b357a[_0xe3e2('0x20')]();};}function saveUpdates(_0x1115b8,_0x2eacd0){return function(_0x782330){if(_0x782330){return _0x782330['update'](_0x1115b8)[_0xe3e2('0x21')](function(_0xf8a27d){return _0xf8a27d;});}return null;};}function removeEntity(_0x153caf,_0x5e7509){return function(_0x5b1c16){if(_0x5b1c16){return _0x5b1c16[_0xe3e2('0x22')]()[_0xe3e2('0x21')](function(){_0x153caf[_0xe3e2('0x18')](0xcc)[_0xe3e2('0x19')]();});}};}function handleEntityNotFound(_0x16452a,_0x1720e6){return function(_0x4b5069){if(!_0x4b5069){_0x16452a['sendStatus'](0x194);}return _0x4b5069;};}function handleError(_0x4d844c,_0x55ddf4){_0x55ddf4=_0x55ddf4||0x1f4;return function(_0xf7456b){logger[_0xe3e2('0x23')](_0xf7456b[_0xe3e2('0x24')]);if(_0xf7456b[_0xe3e2('0x25')]){delete _0xf7456b[_0xe3e2('0x25')];}_0x4d844c['status'](_0x55ddf4)[_0xe3e2('0x26')](_0xf7456b);};}exports[_0xe3e2('0x27')]=function(_0x2ef8bf,_0x38db2b){var _0x4b5c1c={},_0x391e33={},_0xef5798={'count':0x0,'rows':[]};var _0x596a84=_[_0xe3e2('0x28')](db['WhatsappApplication'][_0xe3e2('0x29')],function(_0x18f5ba){return{'name':_0x18f5ba['fieldName'],'type':_0x18f5ba[_0xe3e2('0x2a')][_0xe3e2('0x2b')]};});_0x391e33[_0xe3e2('0x2c')]=_[_0xe3e2('0x28')](_0x596a84,_0xe3e2('0x25'));_0x391e33[_0xe3e2('0x2d')]=_[_0xe3e2('0x2e')](_0x2ef8bf[_0xe3e2('0x2d')]);_0x391e33[_0xe3e2('0x2f')]=_[_0xe3e2('0x30')](_0x391e33[_0xe3e2('0x2c')],_0x391e33[_0xe3e2('0x2d')]);_0x4b5c1c[_0xe3e2('0x31')]=_[_0xe3e2('0x30')](_0x391e33[_0xe3e2('0x2c')],qs[_0xe3e2('0x32')](_0x2ef8bf[_0xe3e2('0x2d')][_0xe3e2('0x32')]));_0x4b5c1c[_0xe3e2('0x31')]=_0x4b5c1c[_0xe3e2('0x31')][_0xe3e2('0x33')]?_0x4b5c1c['attributes']:_0x391e33[_0xe3e2('0x2c')];if(!_0x2ef8bf[_0xe3e2('0x2d')][_0xe3e2('0x34')](_0xe3e2('0x35'))){_0x4b5c1c[_0xe3e2('0x1c')]=qs[_0xe3e2('0x1c')](_0x2ef8bf[_0xe3e2('0x2d')]['limit']);_0x4b5c1c[_0xe3e2('0x1b')]=qs[_0xe3e2('0x1b')](_0x2ef8bf[_0xe3e2('0x2d')][_0xe3e2('0x1b')]);}_0x4b5c1c['order']=qs[_0xe3e2('0x36')](_0x2ef8bf['query']['sort']);_0x4b5c1c['where']=qs[_0xe3e2('0x2f')](_[_0xe3e2('0x37')](_0x2ef8bf[_0xe3e2('0x2d')],_0x391e33[_0xe3e2('0x2f')]),_0x596a84);if(_0x2ef8bf[_0xe3e2('0x2d')]['filter']){_0x4b5c1c[_0xe3e2('0x38')]=_[_0xe3e2('0x39')](_0x4b5c1c[_0xe3e2('0x38')],{'$or':_['map'](_0x596a84,function(_0x20da9f){if(_0x20da9f[_0xe3e2('0x2a')]!==_0xe3e2('0x3a')){var _0x4353d1={};_0x4353d1[_0x20da9f[_0xe3e2('0x25')]]={'$like':'%'+_0x2ef8bf[_0xe3e2('0x2d')][_0xe3e2('0x3b')]+'%'};return _0x4353d1;}})});}_0x4b5c1c=_[_0xe3e2('0x39')]({},_0x4b5c1c,_0x2ef8bf['options']);var _0x2750b8={'where':_0x4b5c1c[_0xe3e2('0x38')]};return db[_0xe3e2('0x3c')][_0xe3e2('0x3d')](_0x2750b8)[_0xe3e2('0x21')](function(_0x44aa37){_0xef5798['count']=_0x44aa37;if(_0x2ef8bf['query'][_0xe3e2('0x3e')]){_0x4b5c1c[_0xe3e2('0x3f')]=[{'all':!![]}];}return db[_0xe3e2('0x3c')]['findAll'](_0x4b5c1c);})[_0xe3e2('0x21')](function(_0x5e2107){_0xef5798[_0xe3e2('0x40')]=_0x5e2107;return _0xef5798;})[_0xe3e2('0x21')](respondWithFilteredResult(_0x38db2b,_0x4b5c1c))[_0xe3e2('0x41')](handleError(_0x38db2b,null));};exports[_0xe3e2('0x42')]=function(_0x2f6dd0,_0xd3df93){var _0x1ce7aa={'raw':!![],'where':{'id':_0x2f6dd0[_0xe3e2('0x43')]['id']}},_0x2b1e9b={};_0x2b1e9b[_0xe3e2('0x2c')]=_[_0xe3e2('0x2e')](db[_0xe3e2('0x3c')]['rawAttributes']);_0x2b1e9b['query']=_['keys'](_0x2f6dd0[_0xe3e2('0x2d')]);_0x2b1e9b[_0xe3e2('0x2f')]=_['intersection'](_0x2b1e9b[_0xe3e2('0x2c')],_0x2b1e9b[_0xe3e2('0x2d')]);_0x1ce7aa[_0xe3e2('0x31')]=_['intersection'](_0x2b1e9b[_0xe3e2('0x2c')],qs['fields'](_0x2f6dd0['query'][_0xe3e2('0x32')]));_0x1ce7aa[_0xe3e2('0x31')]=_0x1ce7aa[_0xe3e2('0x31')][_0xe3e2('0x33')]?_0x1ce7aa['attributes']:_0x2b1e9b[_0xe3e2('0x2c')];if(_0x2f6dd0[_0xe3e2('0x2d')][_0xe3e2('0x3e')]){_0x1ce7aa[_0xe3e2('0x3f')]=[{'all':!![]}];}_0x1ce7aa=_[_0xe3e2('0x39')]({},_0x1ce7aa,_0x2f6dd0[_0xe3e2('0x44')]);return db[_0xe3e2('0x3c')][_0xe3e2('0x45')](_0x1ce7aa)['then'](handleEntityNotFound(_0xd3df93,null))['then'](respondWithResult(_0xd3df93,null))[_0xe3e2('0x41')](handleError(_0xd3df93,null));};exports[_0xe3e2('0x46')]=function(_0x17aaeb,_0x27ae41){return db['WhatsappApplication'][_0xe3e2('0x46')](_0x17aaeb[_0xe3e2('0x47')],{})[_0xe3e2('0x21')](respondWithResult(_0x27ae41,0xc9))[_0xe3e2('0x41')](handleError(_0x27ae41,null));};exports[_0xe3e2('0x48')]=function(_0x406585,_0x4fe94e){if(_0x406585['body']['id']){delete _0x406585['body']['id'];}return db[_0xe3e2('0x3c')][_0xe3e2('0x45')]({'where':{'id':_0x406585[_0xe3e2('0x43')]['id']}})[_0xe3e2('0x21')](handleEntityNotFound(_0x4fe94e,null))[_0xe3e2('0x21')](saveUpdates(_0x406585[_0xe3e2('0x47')],null))[_0xe3e2('0x21')](respondWithResult(_0x4fe94e,null))[_0xe3e2('0x41')](handleError(_0x4fe94e,null));};exports[_0xe3e2('0x22')]=function(_0x103fdc,_0x1d8da0){return db[_0xe3e2('0x3c')]['find']({'where':{'id':_0x103fdc[_0xe3e2('0x43')]['id']}})[_0xe3e2('0x21')](handleEntityNotFound(_0x1d8da0,null))[_0xe3e2('0x21')](removeEntity(_0x1d8da0,null))[_0xe3e2('0x41')](handleError(_0x1d8da0,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7e88522..c381899 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 _0x5987=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x579a2f,_0x2a815a){var _0x5c9e93=function(_0x3e6fc9){while(--_0x3e6fc9){_0x579a2f['push'](_0x579a2f['shift']());}};_0x5c9e93(++_0x2a815a);}(_0x5987,0x128));var _0x7598=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5987[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7598('0x0'));var util=require(_0x7598('0x1'));var logger=require(_0x7598('0x2'))(_0x7598('0x3'));var moment=require('moment');var BPromise=require(_0x7598('0x4'));var rp=require(_0x7598('0x5'));var fs=require('fs');var path=require(_0x7598('0x6'));var rimraf=require(_0x7598('0x7'));var config=require(_0x7598('0x8'));var attributes=require(_0x7598('0x9'));module[_0x7598('0xa')]=function(_0x56cc44,_0x1c78e){return _0x56cc44['define'](_0x7598('0xb'),attributes,{'tableName':_0x7598('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7598('0xd'),'collate':_0x7598('0xe')});}; \ No newline at end of file +var _0x2fe3=['./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','moment','request-promise','../../config/environment'];(function(_0x3a8467,_0x70cc70){var _0xed14de=function(_0x27f28e){while(--_0x27f28e){_0x3a8467['push'](_0x3a8467['shift']());}};_0xed14de(++_0x70cc70);}(_0x2fe3,0x87));var _0x32fe=function(_0x38572a,_0x396c63){_0x38572a=_0x38572a-0x0;var _0xfb0483=_0x2fe3[_0x38572a];return _0xfb0483;};'use strict';var _=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x32fe('0x2'));var BPromise=require('bluebird');var rp=require(_0x32fe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32fe('0x4'));var attributes=require(_0x32fe('0x5'));module['exports']=function(_0x6605ec,_0x89aed1){return _0x6605ec[_0x32fe('0x6')](_0x32fe('0x7'),attributes,{'tableName':_0x32fe('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32fe('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c14afdf..43bbd58 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 _0x1261=['then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0xee94f0,_0xe7ed0c){var _0x5dc768=function(_0x1d6f7d){while(--_0x1d6f7d){_0xee94f0['push'](_0xee94f0['shift']());}};_0x5dc768(++_0xe7ed0c);}(_0x1261,0x144));var _0x1126=function(_0xe3f360,_0x203484){_0xe3f360=_0xe3f360-0x0;var _0x4b6d3d=_0x1261[_0xe3f360];return _0x4b6d3d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xc359=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc359,0x1d9));var _0x9c35=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc359[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var moment=require('moment');var BPromise=require(_0x9c35('0x1'));var rs=require(_0x9c35('0x2'));var fs=require('fs');var Redis=require(_0x9c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c35('0x4'));var logger=require('../../config/logger')(_0x9c35('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d9d7,_0x4b61d6,_0x279ba9){return new BPromise(function(_0x2993da,_0x1ab745){return client[_0x9c35('0x7')](_0x53d9d7,_0x279ba9)[_0x9c35('0x8')](function(_0x2efae8){logger['info'](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4b61d6,'request\x20sent',JSON[_0x9c35('0xb')](_0x2efae8));if(_0x2efae8['error']){if(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xd')]===0x1f4){logger[_0x9c35('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x1ab745(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}logger[_0x9c35('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x2993da(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}else{logger[_0x9c35('0xf')](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));_0x2993da(_0x2efae8[_0x9c35('0x10')][_0x9c35('0xe')]);}})[_0x9c35('0x11')](function(_0x387dd7){logger[_0x9c35('0xc')](_0x9c35('0x9'),_0x4b61d6,_0x387dd7);_0x1ab745(_0x387dd7);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 5ace3a1..a45ebf5 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 _0x5267=['/:id/download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','tracked','whatsappinteraction:update','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id/messages','getMessages'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0x5267,0x1f0));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7526('0x0'));var util=require('util');var path=require(_0x7526('0x1'));var timeout=require(_0x7526('0x2'));var express=require(_0x7526('0x3'));var router=express['Router']();var auth=require(_0x7526('0x4'));var interaction=require(_0x7526('0x5'));var config=require('../../config/environment');var controller=require(_0x7526('0x6'));router[_0x7526('0x7')]('/',auth['isAuthenticated'](),controller[_0x7526('0x8')]);router[_0x7526('0x7')](_0x7526('0x9'),auth[_0x7526('0xa')](),controller[_0x7526('0xb')]);router[_0x7526('0x7')]('/:id',auth[_0x7526('0xa')](),controller['show']);router[_0x7526('0x7')](_0x7526('0xc'),auth[_0x7526('0xa')](),controller[_0x7526('0xd')]);router[_0x7526('0x7')](_0x7526('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x7526('0xf')]('/',auth[_0x7526('0xa')](),controller[_0x7526('0x10')]);router[_0x7526('0xf')](_0x7526('0xc'),auth['isAuthenticated'](),controller[_0x7526('0x11')]);router['post'](_0x7526('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x7526('0x13'),_0x7526('0x14')),controller[_0x7526('0x15')]);router[_0x7526('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x7526('0x17')]('whatsapp',_0x7526('0x18')),controller[_0x7526('0x19')]);router[_0x7526('0x1a')](_0x7526('0x1b'),auth[_0x7526('0xa')](),interaction[_0x7526('0x17')](_0x7526('0x13'),'whatsappinteraction:destroy'),controller[_0x7526('0x1c')]);router[_0x7526('0x1a')](_0x7526('0x12'),auth[_0x7526('0xa')](),controller['removeTags']);module[_0x7526('0x1d')]=router; \ No newline at end of file +var _0xd877=['express','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','delete','/:id/tags','removeTags','exports','path'];(function(_0x403575,_0x2e06e0){var _0x54db13=function(_0x1ed32a){while(--_0x1ed32a){_0x403575['push'](_0x403575['shift']());}};_0x54db13(++_0x2e06e0);}(_0xd877,0xcf));var _0x7d87=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xd877[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7d87('0x0'));var timeout=require('connect-timeout');var express=require(_0x7d87('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7d87('0x2'));var config=require(_0x7d87('0x3'));var controller=require(_0x7d87('0x4'));router[_0x7d87('0x5')]('/',auth[_0x7d87('0x6')](),controller['index']);router[_0x7d87('0x5')](_0x7d87('0x7'),auth[_0x7d87('0x6')](),controller[_0x7d87('0x8')]);router[_0x7d87('0x5')]('/:id',auth[_0x7d87('0x6')](),controller[_0x7d87('0x9')]);router['get'](_0x7d87('0xa'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7d87('0x5')](_0x7d87('0xb'),auth[_0x7d87('0x6')](),controller[_0x7d87('0xc')]);router[_0x7d87('0xd')]('/',auth[_0x7d87('0x6')](),controller[_0x7d87('0xe')]);router[_0x7d87('0xd')](_0x7d87('0xa'),auth[_0x7d87('0x6')](),controller[_0x7d87('0xf')]);router[_0x7d87('0xd')]('/:id/tags',auth[_0x7d87('0x6')](),interaction[_0x7d87('0x10')](_0x7d87('0x11'),_0x7d87('0x12')),controller[_0x7d87('0x13')]);router['put'](_0x7d87('0x14'),auth[_0x7d87('0x6')](),interaction['tracked'](_0x7d87('0x11'),_0x7d87('0x15')),controller['update']);router['delete'](_0x7d87('0x14'),auth[_0x7d87('0x6')](),interaction[_0x7d87('0x10')](_0x7d87('0x11'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x7d87('0x16')](_0x7d87('0x17'),auth[_0x7d87('0x6')](),controller[_0x7d87('0x18')]);module[_0x7d87('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 097f94a..07bbfe1 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 _0xf6f8=['STRING','ENUM','out','DATE','sequelize','moment'];(function(_0x2951a9,_0x3a8e51){var _0x2c291f=function(_0x19e978){while(--_0x19e978){_0x2951a9['push'](_0x2951a9['shift']());}};_0x2c291f(++_0x3a8e51);}(_0xf6f8,0xbe));var _0x8f6f=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf6f8[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require(_0x8f6f('0x0'));var moment=require(_0x8f6f('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8f6f('0x2')]},'note':{'type':Sequelize[_0x8f6f('0x2')]},'phone':{'type':Sequelize[_0x8f6f('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8f6f('0x3')]('in',_0x8f6f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8f6f('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8f6f('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa351=['DATE','ENUM','sequelize','moment','BOOLEAN','STRING','out'];(function(_0x31d3f5,_0x932e8e){var _0xf0e240=function(_0x45b3cf){while(--_0x45b3cf){_0x31d3f5['push'](_0x31d3f5['shift']());}};_0xf0e240(++_0x932e8e);}(_0xa351,0x1de));var _0x1a35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa351[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1a35('0x0'));var moment=require(_0x1a35('0x1'));module['exports']={'closed':{'type':Sequelize[_0x1a35('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1a35('0x3')]},'note':{'type':Sequelize[_0x1a35('0x3')]},'phone':{'type':Sequelize[_0x1a35('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1a35('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1a35('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x1a35('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ec20f79..25319be 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 _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','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','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x4e7ca1,_0x1fe506){var _0x230280=function(_0x59677c){while(--_0x59677c){_0x4e7ca1['push'](_0x4e7ca1['shift']());}};_0x230280(++_0x1fe506);}(_0xadb5,0xad));var _0x5adb=function(_0x1965ab,_0x2ae89f){_0x1965ab=_0x1965ab-0x0;var _0x1b5cf9=_0xadb5[_0x1965ab];return _0x1b5cf9;};'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'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'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':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,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(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x7a54,0x106));var _0x47a5=function(_0x5d1767,_0x4ac98a){_0x5d1767=_0x5d1767-0x0;var _0x5813be=_0x7a54[_0x5d1767];return _0x5813be;};'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 22b4d6d..c1eb88e 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 _0x081a=['length','emit','catch','hasOwnProperty','events','WhatsappInteraction','remove','getUsers','then','Users','setDataValue'];(function(_0x2f6e39,_0x2f8bee){var _0x3cb67e=function(_0x101b74){while(--_0x101b74){_0x2f6e39['push'](_0x2f6e39['shift']());}};_0x3cb67e(++_0x2f8bee);}(_0x081a,0xeb));var _0xa081=function(_0xb065e3,_0x2d01cf){_0xb065e3=_0xb065e3-0x0;var _0x1db262=_0x081a[_0xb065e3];return _0x1db262;};'use strict';var EventEmitter=require(_0xa081('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xa081('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa081('0x2')};function emitEvent(_0x2d9da3){return function(_0x144bb1,_0x389505,_0x40bd14){_0x144bb1[_0xa081('0x3')]({'attributes':['id'],'raw':!![]})[_0xa081('0x4')](function(_0x393cc7){_0x144bb1['setDataValue'](_0xa081('0x5'),_0x393cc7['map'](function(_0x41e0bd){return{'id':_0x41e0bd['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x144bb1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa081('0x4')](function(_0x1b15c5){_0x144bb1[_0xa081('0x6')]('unreadMessages',_0x1b15c5[_0xa081('0x7')]);WhatsappInteractionEvents['emit'](_0x2d9da3+':'+_0x144bb1['id'],_0x144bb1);WhatsappInteractionEvents[_0xa081('0x8')](_0x2d9da3,_0x144bb1);_0x40bd14(null);})[_0xa081('0x9')](_0x40bd14(null));};}for(var e in events){if(events[_0xa081('0xa')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x3067=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','update','remove','getUsers','then','Users','findAll','unreadMessages'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x3067,0xf4));var _0x7306=function(_0x3c7fa0,_0x13f5ba){_0x3c7fa0=_0x3c7fa0-0x0;var _0x137abb=_0x3067[_0x3c7fa0];return _0x137abb;};'use strict';var EventEmitter=require(_0x7306('0x0'));var WhatsappInteraction=require(_0x7306('0x1'))['db'][_0x7306('0x2')];var WhatsappMessage=require(_0x7306('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7306('0x3'),'afterUpdate':_0x7306('0x4'),'afterDestroy':_0x7306('0x5')};function emitEvent(_0xf411d4){return function(_0x5d905f,_0x467774,_0x48d488){_0x5d905f[_0x7306('0x6')]({'attributes':['id'],'raw':!![]})[_0x7306('0x7')](function(_0xc3e0e8){_0x5d905f['setDataValue'](_0x7306('0x8'),_0xc3e0e8['map'](function(_0x1c88e0){return{'id':_0x1c88e0['id']};}));return WhatsappMessage[_0x7306('0x9')]({'where':{'WhatsappInteractionId':_0x5d905f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7306('0x7')](function(_0x7b9a33){_0x5d905f['setDataValue'](_0x7306('0xa'),_0x7b9a33[_0x7306('0xb')]);WhatsappInteractionEvents['emit'](_0xf411d4+':'+_0x5d905f['id'],_0x5d905f);WhatsappInteractionEvents[_0x7306('0xc')](_0xf411d4,_0x5d905f);_0x48d488(null);})[_0x7306('0xd')](_0x48d488(null));};}for(var e in events){if(events[_0x7306('0xe')](e)){var event=events[e];WhatsappInteraction[_0x7306('0xf')](e,emitEvent(event));}}module[_0x7306('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 26b24fc..ce696af 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 _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x5134d4,_0x4faf72){var _0x3481b5=function(_0x3bd4a8){while(--_0x3bd4a8){_0x5134d4['push'](_0x5134d4['shift']());}};_0x3481b5(++_0x4faf72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x53b293,_0x350e38){var _0x343975=function(_0x14fd81){while(--_0x14fd81){_0x53b293['push'](_0x53b293['shift']());}};_0x343975(++_0x350e38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8081eb7..fe6ad23 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 _0x5f71=['message','info','catch','UpdateWhatsappInteraction','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','WhatsappInteraction','find','ids','omit','debug','AddTags','stringify','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x5f71,0x1d9));var _0x15f7=function(_0x4376a2,_0x2c750f){_0x4376a2=_0x4376a2-0x0;var _0x2a9f9b=_0x5f71[_0x4376a2];return _0x2a9f9b;};'use strict';var _=require(_0x15f7('0x0'));var util=require(_0x15f7('0x1'));var moment=require('moment');var BPromise=require(_0x15f7('0x2'));var rs=require(_0x15f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15f7('0x4'));var logger=require(_0x15f7('0x5'))(_0x15f7('0x6'));var config=require(_0x15f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x15f7('0x8')]['http']({'port':0x232a});config[_0x15f7('0x9')]=_[_0x15f7('0xa')](config[_0x15f7('0x9')],{'host':_0x15f7('0xb'),'port':0x18eb});var socket=require(_0x15f7('0xc'))(new Redis(config[_0x15f7('0x9')]));require(_0x15f7('0xd'))[_0x15f7('0xe')](socket);function respondWithRpcPromise(_0x310bde,_0x2ac512,_0xbc5ba7){return new BPromise(function(_0x126224,_0x51c37d){return client[_0x15f7('0xf')](_0x310bde,_0xbc5ba7)[_0x15f7('0x10')](function(_0x26fbfc){logger['info'](_0x15f7('0x11'),_0x2ac512,_0x15f7('0x12'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2ac512,_0x15f7('0x12'),JSON['stringify'](_0x26fbfc));if(_0x26fbfc[_0x15f7('0x13')]){if(_0x26fbfc[_0x15f7('0x13')][_0x15f7('0x14')]===0x1f4){logger[_0x15f7('0x13')](_0x15f7('0x11'),_0x2ac512,_0x26fbfc[_0x15f7('0x13')][_0x15f7('0x15')]);return _0x51c37d(_0x26fbfc['error'][_0x15f7('0x15')]);}logger[_0x15f7('0x13')](_0x15f7('0x11'),_0x2ac512,_0x26fbfc['error'][_0x15f7('0x15')]);return _0x126224(_0x26fbfc['error'][_0x15f7('0x15')]);}else{logger[_0x15f7('0x16')](_0x15f7('0x11'),_0x2ac512,_0x15f7('0x12'));_0x126224(_0x26fbfc['result'][_0x15f7('0x15')]);}})[_0x15f7('0x17')](function(_0x3d4e76){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2ac512,_0x3d4e76);_0x51c37d(_0x3d4e76);});});}exports[_0x15f7('0x18')]=function(_0x15cd86){var _0x39f98d=this;return new Promise(function(_0xa09a24,_0x47c636){return db['WhatsappInteraction']['update'](_0x15cd86[_0x15f7('0x19')],{'raw':_0x15cd86[_0x15f7('0x1a')]?_0x15cd86[_0x15f7('0x1a')][_0x15f7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15cd86[_0x15f7('0x1a')]?_0x15cd86[_0x15f7('0x1a')][_0x15f7('0x1c')]||null:null,'attributes':_0x15cd86[_0x15f7('0x1a')]?_0x15cd86['options'][_0x15f7('0x1d')]||null:null,'limit':_0x15cd86['options']?_0x15cd86[_0x15f7('0x1a')]['limit']||null:null})[_0x15f7('0x10')](function(_0x4b3687){logger[_0x15f7('0x16')]('UpdateWhatsappInteraction',_0x15cd86);logger['debug'](_0x15f7('0x18'),_0x15cd86,JSON['stringify'](_0x4b3687));_0xa09a24(_0x4b3687);})['catch'](function(_0x5d1281){logger[_0x15f7('0x13')]('UpdateWhatsappInteraction',_0x5d1281[_0x15f7('0x15')],_0x15cd86);_0x47c636(_0x39f98d['error'](0x1f4,_0x5d1281['message']));});});};exports[_0x15f7('0x1e')]=function(_0x59c258){return new Promise(function(_0x44f2ed,_0x40d53d){return db[_0x15f7('0x1f')][_0x15f7('0x20')]({'where':_0x59c258['options']?_0x59c258[_0x15f7('0x1a')][_0x15f7('0x1c')]||null:null})[_0x15f7('0x10')](function(_0x20e474){if(_0x20e474){return _0x20e474['addTags'](_0x59c258['body'][_0x15f7('0x21')],_[_0x15f7('0x22')](_0x59c258['body'],[_0x15f7('0x21'),'id'])||{});}})['spread'](function(_0x2a70a1){logger['info']('AddTags',_0x59c258);logger[_0x15f7('0x23')](_0x15f7('0x24'),_0x59c258,JSON[_0x15f7('0x25')](_0x2a70a1));_0x44f2ed(_0x2a70a1);})[_0x15f7('0x17')](function(_0x57d53c){logger[_0x15f7('0x13')]('AddTags',_0x57d53c[_0x15f7('0x15')],_0x59c258);_0x40d53d(_this[_0x15f7('0x13')](0x1f4,_0x57d53c[_0x15f7('0x15')]));});});}; \ No newline at end of file +var _0x0fe3=['jayson/promise','client','redis','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','catch','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x303947,_0x1269da){var _0x8b6578=function(_0x24593e){while(--_0x24593e){_0x303947['push'](_0x303947['shift']());}};_0x8b6578(++_0x1269da);}(_0x0fe3,0xc1));var _0x30fe=function(_0x3699c4,_0x52fbf8){_0x3699c4=_0x3699c4-0x0;var _0x4b59ab=_0x0fe3[_0x3699c4];return _0x4b59ab;};'use strict';var _=require('lodash');var util=require(_0x30fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30fe('0x1'));var db=require(_0x30fe('0x2'))['db'];var utils=require(_0x30fe('0x3'));var logger=require(_0x30fe('0x4'))(_0x30fe('0x5'));var config=require(_0x30fe('0x6'));var jayson=require(_0x30fe('0x7'));var client=jayson[_0x30fe('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x30fe('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x30fe('0xa'))(new Redis(config[_0x30fe('0x9')]));require('./whatsappInteraction.socket')[_0x30fe('0xb')](socket);function respondWithRpcPromise(_0x27a106,_0x15429b,_0xc69476){return new BPromise(function(_0x11c475,_0x2fc09d){return client[_0x30fe('0xc')](_0x27a106,_0xc69476)[_0x30fe('0xd')](function(_0x32d828){logger[_0x30fe('0xe')](_0x30fe('0xf'),_0x15429b,_0x30fe('0x10'));logger[_0x30fe('0x11')](_0x30fe('0x12'),_0x15429b,_0x30fe('0x10'),JSON[_0x30fe('0x13')](_0x32d828));if(_0x32d828[_0x30fe('0x14')]){if(_0x32d828[_0x30fe('0x14')][_0x30fe('0x15')]===0x1f4){logger[_0x30fe('0x14')](_0x30fe('0xf'),_0x15429b,_0x32d828[_0x30fe('0x14')][_0x30fe('0x16')]);return _0x2fc09d(_0x32d828[_0x30fe('0x14')][_0x30fe('0x16')]);}logger[_0x30fe('0x14')](_0x30fe('0xf'),_0x15429b,_0x32d828[_0x30fe('0x14')]['message']);return _0x11c475(_0x32d828[_0x30fe('0x14')][_0x30fe('0x16')]);}else{logger[_0x30fe('0xe')](_0x30fe('0xf'),_0x15429b,_0x30fe('0x10'));_0x11c475(_0x32d828[_0x30fe('0x17')]['message']);}})['catch'](function(_0x1c82e7){logger[_0x30fe('0x14')](_0x30fe('0xf'),_0x15429b,_0x1c82e7);_0x2fc09d(_0x1c82e7);});});}exports['UpdateWhatsappInteraction']=function(_0x4dff77){var _0x1948d6=this;return new Promise(function(_0x3a3788,_0x1d1957){return db[_0x30fe('0x18')]['update'](_0x4dff77[_0x30fe('0x19')],{'raw':_0x4dff77['options']?_0x4dff77[_0x30fe('0x1a')][_0x30fe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dff77['options']?_0x4dff77[_0x30fe('0x1a')][_0x30fe('0x1c')]||null:null,'attributes':_0x4dff77[_0x30fe('0x1a')]?_0x4dff77[_0x30fe('0x1a')][_0x30fe('0x1d')]||null:null,'limit':_0x4dff77[_0x30fe('0x1a')]?_0x4dff77[_0x30fe('0x1a')][_0x30fe('0x1e')]||null:null})[_0x30fe('0xd')](function(_0x284d6f){logger[_0x30fe('0xe')](_0x30fe('0x1f'),_0x4dff77);logger[_0x30fe('0x11')]('UpdateWhatsappInteraction',_0x4dff77,JSON['stringify'](_0x284d6f));_0x3a3788(_0x284d6f);})[_0x30fe('0x20')](function(_0x1bd916){logger[_0x30fe('0x14')](_0x30fe('0x1f'),_0x1bd916[_0x30fe('0x16')],_0x4dff77);_0x1d1957(_0x1948d6[_0x30fe('0x14')](0x1f4,_0x1bd916[_0x30fe('0x16')]));});});};exports[_0x30fe('0x21')]=function(_0x36c602){return new Promise(function(_0x597014,_0x3b1aed){return db[_0x30fe('0x18')][_0x30fe('0x22')]({'where':_0x36c602[_0x30fe('0x1a')]?_0x36c602['options'][_0x30fe('0x1c')]||null:null})[_0x30fe('0xd')](function(_0x2a85e8){if(_0x2a85e8){return _0x2a85e8[_0x30fe('0x23')](_0x36c602[_0x30fe('0x19')]['ids'],_[_0x30fe('0x24')](_0x36c602['body'],[_0x30fe('0x25'),'id'])||{});}})[_0x30fe('0x26')](function(_0x5f27db){logger[_0x30fe('0xe')](_0x30fe('0x27'),_0x36c602);logger[_0x30fe('0x11')](_0x30fe('0x27'),_0x36c602,JSON[_0x30fe('0x13')](_0x5f27db));_0x597014(_0x5f27db);})[_0x30fe('0x20')](function(_0x48ef62){logger['error'](_0x30fe('0x27'),_0x48ef62['message'],_0x36c602);_0x3b1aed(_this[_0x30fe('0x14')](0x1f4,_0x48ef62[_0x30fe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b7dbdbf..9b0c84f 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 _0x75b6=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x59b533,_0x59fdcc){var _0x2beced=function(_0xd3aaf3){while(--_0xd3aaf3){_0x59b533['push'](_0x59b533['shift']());}};_0x2beced(++_0x59fdcc);}(_0x75b6,0xb0));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x675b('0x0'));var events=[_0x675b('0x1'),_0x675b('0x2'),_0x675b('0x3')];function createListener(_0x1f9bb9,_0x4708ba){return function(_0x574dd0){_0x4708ba[_0x675b('0x4')](_0x1f9bb9,_0x574dd0);};}function removeListener(_0x23c8e4,_0x5dcca2){return function(){WhatsappInteractionEvents[_0x675b('0x5')](_0x23c8e4,_0x5dcca2);};}exports['register']=function(_0x55b96b){for(var _0x282234=0x0,_0x580e9a=events['length'];_0x282234<_0x580e9a;_0x282234++){var _0x51926b=events[_0x282234];var _0x3dc5da=createListener(_0x675b('0x6')+_0x51926b,_0x55b96b);WhatsappInteractionEvents['on'](_0x51926b,_0x3dc5da);}}; \ No newline at end of file +var _0x2094=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','update','removeListener'];(function(_0x14e9fc,_0x396121){var _0x1c3893=function(_0x3bbe89){while(--_0x3bbe89){_0x14e9fc['push'](_0x14e9fc['shift']());}};_0x1c3893(++_0x396121);}(_0x2094,0x153));var _0x4209=function(_0x185f6b,_0xb7ae23){_0x185f6b=_0x185f6b-0x0;var _0x4da5d6=_0x2094[_0x185f6b];return _0x4da5d6;};'use strict';var WhatsappInteractionEvents=require(_0x4209('0x0'));var events=[_0x4209('0x1'),'remove',_0x4209('0x2')];function createListener(_0x454bb7,_0x5c3e77){return function(_0x37f2e2){_0x5c3e77['emit'](_0x454bb7,_0x37f2e2);};}function removeListener(_0x2eb908,_0x30b953){return function(){WhatsappInteractionEvents[_0x4209('0x3')](_0x2eb908,_0x30b953);};}exports[_0x4209('0x4')]=function(_0x311050){for(var _0x352430=0x0,_0x356527=events[_0x4209('0x5')];_0x352430<_0x356527;_0x352430++){var _0x150fb5=events[_0x352430];var _0x1f7953=createListener(_0x4209('0x6')+_0x150fb5,_0x311050);WhatsappInteractionEvents['on'](_0x150fb5,_0x1f7953);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8c5384e..c0fb1c8 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 _0x8ade=['isAuthenticated','/describe','describe','/:id','post','tracked','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get'];(function(_0x2f0fde,_0x4a2600){var _0x3db999=function(_0x2108b0){while(--_0x2108b0){_0x2f0fde['push'](_0x2f0fde['shift']());}};_0x3db999(++_0x4a2600);}(_0x8ade,0x67));var _0xe8ad=function(_0x1c6be6,_0x2ee9f1){_0x1c6be6=_0x1c6be6-0x0;var _0x6e6b6c=_0x8ade[_0x1c6be6];return _0x6e6b6c;};'use strict';var multer=require(_0xe8ad('0x0'));var util=require('util');var path=require(_0xe8ad('0x1'));var timeout=require(_0xe8ad('0x2'));var express=require(_0xe8ad('0x3'));var router=express[_0xe8ad('0x4')]();var auth=require(_0xe8ad('0x5'));var interaction=require(_0xe8ad('0x6'));var config=require('../../config/environment');var controller=require(_0xe8ad('0x7'));router[_0xe8ad('0x8')]('/',auth[_0xe8ad('0x9')](),controller['index']);router[_0xe8ad('0x8')](_0xe8ad('0xa'),auth[_0xe8ad('0x9')](),controller[_0xe8ad('0xb')]);router['get'](_0xe8ad('0xc'),auth[_0xe8ad('0x9')](),controller['show']);router[_0xe8ad('0xd')]('/',auth[_0xe8ad('0x9')](),interaction[_0xe8ad('0xe')]('whatsapp',_0xe8ad('0xf')),controller[_0xe8ad('0x10')]);router[_0xe8ad('0xd')](_0xe8ad('0x11'),controller[_0xe8ad('0x12')]);router[_0xe8ad('0x13')](_0xe8ad('0xc'),auth[_0xe8ad('0x9')](),controller[_0xe8ad('0x14')]);router[_0xe8ad('0x13')](_0xe8ad('0x15'),auth[_0xe8ad('0x9')](),controller[_0xe8ad('0x16')]);router[_0xe8ad('0x13')](_0xe8ad('0x17'),auth['isAuthenticated'](),controller[_0xe8ad('0x18')]);router[_0xe8ad('0x19')]('/:id',auth[_0xe8ad('0x9')](),controller[_0xe8ad('0x1a')]);module[_0xe8ad('0x1b')]=router; \ No newline at end of file +var _0x993c=['delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x2dc529,_0x479d6f){var _0x355aaf=function(_0x15c35e){while(--_0x15c35e){_0x2dc529['push'](_0x2dc529['shift']());}};_0x355aaf(++_0x479d6f);}(_0x993c,0xa5));var _0xc993=function(_0xd0236e,_0x590c73){_0xd0236e=_0xd0236e-0x0;var _0x23ca37=_0x993c[_0xd0236e];return _0x23ca37;};'use strict';var multer=require('multer');var util=require(_0xc993('0x0'));var path=require(_0xc993('0x1'));var timeout=require('connect-timeout');var express=require(_0xc993('0x2'));var router=express[_0xc993('0x3')]();var auth=require(_0xc993('0x4'));var interaction=require(_0xc993('0x5'));var config=require(_0xc993('0x6'));var controller=require(_0xc993('0x7'));router['get']('/',auth[_0xc993('0x8')](),controller['index']);router['get'](_0xc993('0x9'),auth['isAuthenticated'](),controller[_0xc993('0xa')]);router[_0xc993('0xb')](_0xc993('0xc'),auth[_0xc993('0x8')](),controller[_0xc993('0xd')]);router[_0xc993('0xe')]('/',auth[_0xc993('0x8')](),interaction[_0xc993('0xf')](_0xc993('0x10'),'whatsappmessage:create'),controller[_0xc993('0x11')]);router['post'](_0xc993('0x12'),controller[_0xc993('0x13')]);router[_0xc993('0x14')](_0xc993('0xc'),auth[_0xc993('0x8')](),controller[_0xc993('0x15')]);router[_0xc993('0x14')](_0xc993('0x16'),auth['isAuthenticated'](),controller[_0xc993('0x17')]);router[_0xc993('0x14')]('/:id/reject',auth[_0xc993('0x8')](),controller['reject']);router[_0xc993('0x18')]('/:id',auth[_0xc993('0x8')](),controller[_0xc993('0x19')]);module[_0xc993('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index de4080c..4d9bc7b 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 _0xc975=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3cb36a,_0x5ec5ba){var _0x4711e9=function(_0xe88fdf){while(--_0xe88fdf){_0x3cb36a['push'](_0x3cb36a['shift']());}};_0x4711e9(++_0x5ec5ba);}(_0xc975,0x1ce));var _0x5c97=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc975[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x5c97('0x0'));module[_0x5c97('0x1')]={'body':{'type':Sequelize[_0x5c97('0x2')](_0x5c97('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5c97('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5c97('0x5')]('in','out'),'defaultValue':_0x5c97('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c97('0x7')](0xbe)},'phone':{'type':Sequelize[_0x5c97('0x7')]},'readAt':{'type':Sequelize[_0x5c97('0x8')]},'secret':{'type':Sequelize[_0x5c97('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x12d4=['TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5989e9,_0xef6905){var _0xac49f2=function(_0xa5ab7c){while(--_0xa5ab7c){_0x5989e9['push'](_0x5989e9['shift']());}};_0xac49f2(++_0xef6905);}(_0x12d4,0x1e0));var _0x412d=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x12d4[_0x24679e];return _0x291f21;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x412d('0x0')](_0x412d('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x412d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x412d('0x3')]('in','out'),'defaultValue':_0x412d('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x412d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ace1feb..52cae3a 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 _0xdf4a=['Sequelize','ValidationError','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','describe','whatsapp-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','read','inspect','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','test'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0xdf4a,0x15c));var _0xadf4=function(_0x4ad4ab,_0x160736){_0x4ad4ab=_0x4ad4ab-0x0;var _0x148833=_0xdf4a[_0x4ad4ab];return _0x148833;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xadf4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xadf4('0x1'));var rp=require(_0xadf4('0x2'));var moment=require(_0xadf4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xadf4('0x4'));var util=require(_0xadf4('0x5'));var path=require(_0xadf4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xadf4('0x7'));var fs=require('fs');var _=require(_0xadf4('0x8'));var squel=require(_0xadf4('0x9'));var crypto=require(_0xadf4('0xa'));var jsforce=require(_0xadf4('0xb'));var deskjs=require(_0xadf4('0xc'));var toCsv=require(_0xadf4('0xd'));var querystring=require(_0xadf4('0xe'));var Papa=require('papaparse');var Redis=require(_0xadf4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xadf4('0x10'));var hardwareService=require(_0xadf4('0x11'));var logger=require(_0xadf4('0x12'))(_0xadf4('0x13'));var utils=require(_0xadf4('0x14'));var config=require('../../config/environment');var db=require(_0xadf4('0x15'))['db'];config[_0xadf4('0x16')]=_[_0xadf4('0x17')](config[_0xadf4('0x16')],{'host':_0xadf4('0x18'),'port':0x18eb});var socket=require(_0xadf4('0x19'))(new Redis(config[_0xadf4('0x16')]));require('./whatsappMessage.socket')[_0xadf4('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xadf4('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xadf4('0x1b')][_0xadf4('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x926a42,_0x37476e,_0x36577d){if(_0x36577d){var _0x2c50de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c50de[_0xadf4('0x1d')](_0x37476e)){return _0x926a42;}else{throw new db[(_0xadf4('0x1e'))][(_0xadf4('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 _0x926a42;}}function respondWithRpcPromise(_0x1aebae,_0x4e8b64,_0x44f512,_0x12f92c){return new BPromise(function(_0x55f503,_0x44b68f){var _0xf057a=_0x12f92c||client;return _0xf057a['request'](_0x1aebae,_0x44f512)[_0xadf4('0x20')](function(_0x3a62c4){logger[_0xadf4('0x21')](_0xadf4('0x22'),_0x4e8b64,'request\x20sent');logger[_0xadf4('0x23')](_0xadf4('0x24'),_0x4e8b64,_0xadf4('0x25'),JSON[_0xadf4('0x26')](_0x3a62c4));if(_0x3a62c4[_0xadf4('0x27')]){if(_0x3a62c4['error'][_0xadf4('0x28')]===0x1f4){logger['error'](_0xadf4('0x22'),_0x4e8b64,_0x3a62c4[_0xadf4('0x27')]['message']);return _0x44b68f(_0x3a62c4[_0xadf4('0x27')][_0xadf4('0x29')]);}logger[_0xadf4('0x27')](_0xadf4('0x22'),_0x4e8b64,_0x3a62c4[_0xadf4('0x27')][_0xadf4('0x29')]);return _0x55f503(_0x3a62c4[_0xadf4('0x27')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4e8b64,_0xadf4('0x25'));_0x55f503(_0x3a62c4[_0xadf4('0x2a')][_0xadf4('0x29')]);}})[_0xadf4('0x2b')](function(_0x4fa2ed){logger[_0xadf4('0x27')](_0xadf4('0x22'),_0x4e8b64,_0x4fa2ed);_0x44b68f(_0x4fa2ed);});});}function respondWithStatusCode(_0x40c6bf,_0x342c17){_0x342c17=_0x342c17||0xcc;return function(_0x335a52){if(_0x335a52){return _0x40c6bf[_0xadf4('0x2c')](_0x342c17);}return _0x40c6bf['status'](_0x342c17)[_0xadf4('0x2d')]();};}function respondWithResult(_0xe9da0e,_0x124b94){_0x124b94=_0x124b94||0xc8;return function(_0x3e7f1a){if(_0x3e7f1a){return _0xe9da0e[_0xadf4('0x2e')](_0x124b94)[_0xadf4('0x2f')](_0x3e7f1a);}};}function respondWithFilteredResult(_0x19612f,_0x3ccb26){return function(_0x40526f){if(_0x40526f){var _0x591204=_0x40526f[_0xadf4('0x30')],_0x13b972=_0x3ccb26[_0xadf4('0x31')],_0x1c81fc=_0x3ccb26[_0xadf4('0x31')]+_0x3ccb26[_0xadf4('0x32')],_0x50beae;if(_0x1c81fc>=_0x591204){_0x1c81fc=_0x591204;_0x50beae=0xc8;}else{_0x50beae=0xce;}_0x19612f[_0xadf4('0x2e')](_0x50beae);return _0x19612f[_0xadf4('0x33')](_0xadf4('0x34'),_0x13b972+'-'+_0x1c81fc+'/'+_0x591204)[_0xadf4('0x2f')](_0x40526f);}return null;};}function patchUpdates(_0x29e263){return function(_0x19140f){try{jsonpatch[_0xadf4('0x35')](_0x19140f,_0x29e263,!![]);}catch(_0x37cee1){return BPromise[_0xadf4('0x36')](_0x37cee1);}return _0x19140f[_0xadf4('0x37')]();};}function saveUpdates(_0x5ae482,_0xc14af){return function(_0x4ed364){if(_0x4ed364){return _0x4ed364[_0xadf4('0x38')](_0x5ae482)[_0xadf4('0x20')](function(_0xaf7d6){return _0xaf7d6;});}return null;};}function removeEntity(_0x104878,_0x3d1de3){return function(_0x129b19){if(_0x129b19){return _0x129b19[_0xadf4('0x39')]()['then'](function(){_0x104878[_0xadf4('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1c0a,_0x526b1c){return function(_0x1769f9){if(!_0x1769f9){_0x1f1c0a[_0xadf4('0x2c')](0x194);}return _0x1769f9;};}function handleError(_0x115ac4,_0x14521c){_0x14521c=_0x14521c||0x1f4;return function(_0x3ae6dc){logger[_0xadf4('0x27')](_0x3ae6dc['stack']);if(_0x3ae6dc['name']){delete _0x3ae6dc[_0xadf4('0x3a')];}_0x115ac4['status'](_0x14521c)[_0xadf4('0x3b')](_0x3ae6dc);};}exports['index']=function(_0x58af0d,_0x1d6acf){var _0x2988b9={},_0x3b41c1={},_0x1c481d={'count':0x0,'rows':[]};var _0x48a5c6=_[_0xadf4('0x3c')](db[_0xadf4('0x3d')]['rawAttributes'],function(_0x391a62){return{'name':_0x391a62[_0xadf4('0x3e')],'type':_0x391a62[_0xadf4('0x3f')][_0xadf4('0x40')]};});_0x3b41c1[_0xadf4('0x41')]=_[_0xadf4('0x3c')](_0x48a5c6,'name');_0x3b41c1[_0xadf4('0x42')]=_[_0xadf4('0x43')](_0x58af0d['query']);_0x3b41c1[_0xadf4('0x44')]=_[_0xadf4('0x45')](_0x3b41c1[_0xadf4('0x41')],_0x3b41c1[_0xadf4('0x42')]);_0x2988b9[_0xadf4('0x46')]=_[_0xadf4('0x45')](_0x3b41c1['model'],qs[_0xadf4('0x47')](_0x58af0d['query']['fields']));_0x2988b9[_0xadf4('0x46')]=_0x2988b9['attributes'][_0xadf4('0x48')]?_0x2988b9[_0xadf4('0x46')]:_0x3b41c1[_0xadf4('0x41')];if(!_0x58af0d[_0xadf4('0x42')][_0xadf4('0x49')](_0xadf4('0x4a'))){_0x2988b9[_0xadf4('0x32')]=qs[_0xadf4('0x32')](_0x58af0d[_0xadf4('0x42')][_0xadf4('0x32')]);_0x2988b9[_0xadf4('0x31')]=qs['offset'](_0x58af0d[_0xadf4('0x42')][_0xadf4('0x31')]);}_0x2988b9[_0xadf4('0x4b')]=qs[_0xadf4('0x4c')](_0x58af0d[_0xadf4('0x42')]['sort']);_0x2988b9['where']=qs[_0xadf4('0x44')](_['pick'](_0x58af0d[_0xadf4('0x42')],_0x3b41c1[_0xadf4('0x44')]),_0x48a5c6);if(_0x58af0d[_0xadf4('0x42')][_0xadf4('0x4d')]){_0x2988b9[_0xadf4('0x4e')]=_[_0xadf4('0x4f')](_0x2988b9[_0xadf4('0x4e')],{'$or':_[_0xadf4('0x3c')](_0x48a5c6,function(_0x3a2830){if(_0x3a2830[_0xadf4('0x3f')]!==_0xadf4('0x50')){var _0xca3a95={};_0xca3a95[_0x3a2830['name']]={'$like':'%'+_0x58af0d['query'][_0xadf4('0x4d')]+'%'};return _0xca3a95;}})});}_0x2988b9=_[_0xadf4('0x4f')]({},_0x2988b9,_0x58af0d[_0xadf4('0x51')]);var _0x129ad1={'where':_0x2988b9['where']};return db[_0xadf4('0x3d')][_0xadf4('0x30')](_0x129ad1)[_0xadf4('0x20')](function(_0x167887){_0x1c481d[_0xadf4('0x30')]=_0x167887;if(_0x58af0d[_0xadf4('0x42')][_0xadf4('0x52')]){_0x2988b9['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x2988b9);})[_0xadf4('0x20')](function(_0x36b5a3){_0x1c481d[_0xadf4('0x53')]=_0x36b5a3;return _0x1c481d;})['then'](respondWithFilteredResult(_0x1d6acf,_0x2988b9))[_0xadf4('0x2b')](handleError(_0x1d6acf,null));};exports[_0xadf4('0x54')]=function(_0x3dcfc1,_0x3f4c41){var _0x5aad00={'raw':!![],'where':{'id':_0x3dcfc1[_0xadf4('0x55')]['id']}},_0x23438a={};_0x23438a[_0xadf4('0x41')]=_['keys'](db[_0xadf4('0x3d')]['rawAttributes']);_0x23438a['query']=_[_0xadf4('0x43')](_0x3dcfc1['query']);_0x23438a[_0xadf4('0x44')]=_[_0xadf4('0x45')](_0x23438a[_0xadf4('0x41')],_0x23438a[_0xadf4('0x42')]);_0x5aad00[_0xadf4('0x46')]=_[_0xadf4('0x45')](_0x23438a[_0xadf4('0x41')],qs[_0xadf4('0x47')](_0x3dcfc1[_0xadf4('0x42')][_0xadf4('0x47')]));_0x5aad00['attributes']=_0x5aad00['attributes'][_0xadf4('0x48')]?_0x5aad00[_0xadf4('0x46')]:_0x23438a[_0xadf4('0x41')];if(_0x3dcfc1[_0xadf4('0x42')]['includeAll']){_0x5aad00[_0xadf4('0x56')]=[{'all':!![]}];}_0x5aad00=_[_0xadf4('0x4f')]({},_0x5aad00,_0x3dcfc1[_0xadf4('0x51')]);return db[_0xadf4('0x3d')][_0xadf4('0x57')](_0x5aad00)[_0xadf4('0x20')](handleEntityNotFound(_0x3f4c41,null))[_0xadf4('0x20')](respondWithResult(_0x3f4c41,null))['catch'](handleError(_0x3f4c41,null));};exports[_0xadf4('0x58')]=function(_0x4c30ff,_0x409ebf){return db[_0xadf4('0x3d')][_0xadf4('0x58')](_0x4c30ff[_0xadf4('0x59')],{})[_0xadf4('0x20')](respondWithResult(_0x409ebf,0xc9))[_0xadf4('0x2b')](handleError(_0x409ebf,null));};exports[_0xadf4('0x38')]=function(_0x118356,_0xe3c7ac){if(_0x118356['body']['id']){delete _0x118356[_0xadf4('0x59')]['id'];}return db[_0xadf4('0x3d')][_0xadf4('0x57')]({'where':{'id':_0x118356[_0xadf4('0x55')]['id']}})[_0xadf4('0x20')](handleEntityNotFound(_0xe3c7ac,null))[_0xadf4('0x20')](saveUpdates(_0x118356[_0xadf4('0x59')],null))[_0xadf4('0x20')](respondWithResult(_0xe3c7ac,null))[_0xadf4('0x2b')](handleError(_0xe3c7ac,null));};exports[_0xadf4('0x39')]=function(_0x5c1f76,_0x2409df){return db['WhatsappMessage'][_0xadf4('0x57')]({'where':{'id':_0x5c1f76[_0xadf4('0x55')]['id']}})[_0xadf4('0x20')](handleEntityNotFound(_0x2409df,null))[_0xadf4('0x20')](removeEntity(_0x2409df,null))[_0xadf4('0x2b')](handleError(_0x2409df,null));};exports[_0xadf4('0x5a')]=function(_0x48b103,_0x22733e){return db[_0xadf4('0x3d')]['describe']()[_0xadf4('0x20')](respondWithResult(_0x22733e,null))[_0xadf4('0x2b')](handleError(_0x22733e,null));};var interaction_log=require(_0xadf4('0x12'))(_0xadf4('0x5b'));exports['accept']=function(_0x77e117,_0x3498da,_0x4bc337){var _0x4d2bad={'channel':'whatsapp'};if(_0x77e117['body']['id']){delete _0x77e117[_0xadf4('0x59')]['id'];}_0x77e117[_0xadf4('0x59')]['read']=!![];_0x77e117['body'][_0xadf4('0x5c')]=moment()[_0xadf4('0x5d')](_0xadf4('0x5e'));_0x77e117[_0xadf4('0x59')][_0xadf4('0x5f')]=_0x77e117[_0xadf4('0x59')][_0xadf4('0x5f')]||_0x77e117[_0xadf4('0x60')]['id'];return db['WhatsappMessage'][_0xadf4('0x57')]({'where':{'id':_0x77e117[_0xadf4('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xadf4('0x20')](handleEntityNotFound(_0x3498da,null))[_0xadf4('0x20')](saveUpdates(_0x77e117[_0xadf4('0x59')],null))[_0xadf4('0x20')](function(_0xe83f91){if(_0xe83f91){_0x4d2bad[_0xadf4('0x29')]=_0xe83f91[_0xadf4('0x61')]({'plain':!![]});return db[_0xadf4('0x62')]['find']({'where':{'id':_0xe83f91[_0xadf4('0x63')]}});}return null;})[_0xadf4('0x20')](handleEntityNotFound(_0x3498da,null))['then'](function(_0x56323a){if(_0x56323a){return _0x56323a[_0xadf4('0x38')]({'UserId':_0x77e117[_0xadf4('0x59')][_0xadf4('0x5f')],'read1stAt':_[_0xadf4('0x64')](_0x56323a[_0xadf4('0x65')])?moment()['format'](_0xadf4('0x5e')):undefined});}return null;})[_0xadf4('0x20')](function(_0x25e7bc){if(_0x25e7bc){_0x4d2bad['interaction']=_0x25e7bc[_0xadf4('0x61')]({'plain':!![]});interaction_log[_0xadf4('0x21')](_0xadf4('0x66'),_0x77e117[_0xadf4('0x60')]['id'],_0x77e117[_0xadf4('0x60')][_0xadf4('0x3a')],_0x77e117['user'][_0xadf4('0x67')],_0x4d2bad[_0xadf4('0x68')]['id'],_0x77e117[_0xadf4('0x59')]?JSON[_0xadf4('0x26')](_0x77e117[_0xadf4('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xadf4('0x69'),_0x4d2bad);}return null;})[_0xadf4('0x20')](function(_0x2191c5){if(_0x2191c5){if(_0x77e117[_0xadf4('0x59')]['manual']){_0x4d2bad[_0xadf4('0x29')][_0xadf4('0x6a')]=util['format'](_0xadf4('0x6b'),_0x77e117[_0xadf4('0x60')]['name']);_0x4d2bad[_0xadf4('0x29')][_0xadf4('0x6c')]=_0x4d2bad[_0xadf4('0x6c')];_0x4d2bad[_0xadf4('0x29')][_0xadf4('0x6d')]='accept';return respondWithRpcPromise(_0xadf4('0x6e'),_0xadf4('0x6e'),{'event':_0xadf4('0x6f'),'message':_0x4d2bad['message']},client9002)[_0xadf4('0x20')](function(){return _0x4d2bad;});}return _0x4d2bad;}return null;})['then'](respondWithResult(_0x3498da,null))[_0xadf4('0x2b')](handleError(_0x3498da,null));};var interaction_log=require(_0xadf4('0x12'))('whatsapp-interactions');exports[_0xadf4('0x36')]=function(_0x49fc28,_0x38ca3c,_0x1ae7a2){var _0x2cdcc1={'agent':{},'channel':_0xadf4('0x70')};if(_0x49fc28[_0xadf4('0x59')]['id']){delete _0x49fc28[_0xadf4('0x59')]['id'];}_0x49fc28[_0xadf4('0x59')]['UserId']=_0x49fc28['body'][_0xadf4('0x5f')]||_0x49fc28[_0xadf4('0x60')]['id'];_0x2cdcc1[_0xadf4('0x71')]['id']=_0x49fc28[_0xadf4('0x59')][_0xadf4('0x5f')];return db[_0xadf4('0x3d')][_0xadf4('0x57')]({'where':{'id':_0x49fc28[_0xadf4('0x55')]['id'],'UserId':null}})[_0xadf4('0x20')](handleEntityNotFound(_0x38ca3c,null))['then'](function(_0x110c61){if(_0x110c61){_0x2cdcc1['message']=_0x110c61[_0xadf4('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0xadf4('0x57')]({'where':{'id':_0x110c61[_0xadf4('0x63')]}});}return null;})[_0xadf4('0x20')](handleEntityNotFound(_0x38ca3c,null))[_0xadf4('0x20')](function(_0x9cdcfb){if(_0x9cdcfb){_0x2cdcc1[_0xadf4('0x68')]=_0x9cdcfb[_0xadf4('0x61')]({'plain':!![]});interaction_log['info'](_0xadf4('0x72'),_0x49fc28[_0xadf4('0x60')]['id'],_0x49fc28[_0xadf4('0x60')]['name'],_0x49fc28[_0xadf4('0x60')][_0xadf4('0x67')],_0x2cdcc1[_0xadf4('0x68')]['id'],_0x49fc28[_0xadf4('0x59')]?JSON[_0xadf4('0x26')](_0x49fc28[_0xadf4('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0xadf4('0x73'),_0x2cdcc1);}return null;})[_0xadf4('0x20')](function(_0x1287cd){if(_0x1287cd){_0x1287cd['message'][_0xadf4('0x6a')]=util[_0xadf4('0x5d')](_0xadf4('0x6b'),_0x49fc28[_0xadf4('0x60')][_0xadf4('0x3a')]);_0x1287cd[_0xadf4('0x29')][_0xadf4('0x6c')]=_0x2cdcc1['channel'];_0x1287cd[_0xadf4('0x29')][_0xadf4('0x6d')]=_0xadf4('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xadf4('0x74'),'message':_0x1287cd[_0xadf4('0x29')]},client9002);return _0x2cdcc1;}return null;})[_0xadf4('0x20')](respondWithResult(_0x38ca3c,null))[_0xadf4('0x2b')](handleError(_0x38ca3c,null));};exports[_0xadf4('0x2e')]=function(_0x2fe963,_0x34b6c2,_0x3502da){if(_0x2fe963[_0xadf4('0x59')]['id']){delete _0x2fe963[_0xadf4('0x59')]['id'];}var _0x382d20;return db[_0xadf4('0x3d')][_0xadf4('0x57')]({'where':{'id':_0x2fe963['params']['id']}})[_0xadf4('0x20')](handleEntityNotFound(_0x34b6c2,null))['then'](function(_0x8bae8d){if(_0x8bae8d){_0x382d20=_0x8bae8d;return db[_0xadf4('0x75')]['find']({'where':{'id':_0x8bae8d['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x34b6c2,null))[_0xadf4('0x20')](function(_0x2447ee){if(_0x2447ee){logger['debug'](_0xadf4('0x76'),_0xadf4('0x2e'),_0xadf4('0x77'),_0x2447ee[_0xadf4('0x3f')],util['inspect'](_0x2fe963[_0xadf4('0x59')],{'showHidden':![],'depth':null}));switch(_0x2447ee['type']){case _0xadf4('0x78'):if(_0x2fe963[_0xadf4('0x59')][_0xadf4('0x79')]&&_0x2fe963[_0xadf4('0x59')][_0xadf4('0x79')]===_0x382d20[_0xadf4('0x7a')]&&_0x2fe963['body'][_0xadf4('0x7b')]&&_0x2fe963[_0xadf4('0x59')][_0xadf4('0x7b')]===_0xadf4('0x7c')){return _0x382d20[_0xadf4('0x38')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xadf4('0x2e'),_0xadf4('0x78'),util[_0xadf4('0x7d')](_0x2fe963['body'],{'showHidden':![],'depth':null}));}break;}return _0x382d20;}})['then'](respondWithResult(_0x34b6c2,null))[_0xadf4('0x2b')](handleError(_0x34b6c2,null));}; \ No newline at end of file +var _0x872f=['SIP/%s','channel','event','EventManager','acceptmessage','reject','whatsapp','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','test','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','include','create','body','find','destroy','describe','../../config/logger','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','user','role','null','acceptMessage','manual','interface'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0x872f,0x99));var _0xf872=function(_0x20b504,_0x330c27){_0x20b504=_0x20b504-0x0;var _0x237692=_0x872f[_0x20b504];return _0x237692;};'use strict';var pdf=require(_0xf872('0x0'));var emlformat=require(_0xf872('0x1'));var rimraf=require(_0xf872('0x2'));var zipdir=require(_0xf872('0x3'));var jsonpatch=require(_0xf872('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf872('0x5'));var Mustache=require('mustache');var util=require(_0xf872('0x6'));var path=require(_0xf872('0x7'));var sox=require(_0xf872('0x8'));var csv=require(_0xf872('0x9'));var ejs=require(_0xf872('0xa'));var fs=require('fs');var _=require(_0xf872('0xb'));var squel=require(_0xf872('0xc'));var crypto=require(_0xf872('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf872('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf872('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf872('0x10'));var qs=require(_0xf872('0x11'));var as=require(_0xf872('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf872('0x13'));var utils=require(_0xf872('0x14'));var config=require(_0xf872('0x15'));var db=require(_0xf872('0x16'))['db'];config[_0xf872('0x17')]=_['defaults'](config[_0xf872('0x17')],{'host':_0xf872('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf872('0x17')]));require(_0xf872('0x19'))[_0xf872('0x1a')](socket);var jayson=require(_0xf872('0x1b'));var client=jayson[_0xf872('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf872('0x1c')][_0xf872('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x410653,_0x2fc4dd,_0x43eb75){if(_0x43eb75){var _0x3f3452=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f3452[_0xf872('0x1e')](_0x2fc4dd)){return _0x410653;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x410653;}}function respondWithRpcPromise(_0x1d3bd2,_0x3ee5e9,_0x34225f,_0x2f4020){return new BPromise(function(_0x4c3216,_0x241c67){var _0x3408fa=_0x2f4020||client;return _0x3408fa[_0xf872('0x1f')](_0x1d3bd2,_0x34225f)[_0xf872('0x20')](function(_0x458e5c){logger[_0xf872('0x21')](_0xf872('0x22'),_0x3ee5e9,_0xf872('0x23'));logger[_0xf872('0x24')](_0xf872('0x25'),_0x3ee5e9,_0xf872('0x23'),JSON[_0xf872('0x26')](_0x458e5c));if(_0x458e5c['error']){if(_0x458e5c['error']['code']===0x1f4){logger[_0xf872('0x27')](_0xf872('0x22'),_0x3ee5e9,_0x458e5c[_0xf872('0x27')][_0xf872('0x28')]);return _0x241c67(_0x458e5c[_0xf872('0x27')][_0xf872('0x28')]);}logger[_0xf872('0x27')](_0xf872('0x22'),_0x3ee5e9,_0x458e5c['error']['message']);return _0x4c3216(_0x458e5c['error']['message']);}else{logger[_0xf872('0x21')](_0xf872('0x22'),_0x3ee5e9,_0xf872('0x23'));_0x4c3216(_0x458e5c[_0xf872('0x29')][_0xf872('0x28')]);}})[_0xf872('0x2a')](function(_0x4dd420){logger[_0xf872('0x27')](_0xf872('0x22'),_0x3ee5e9,_0x4dd420);_0x241c67(_0x4dd420);});});}function respondWithStatusCode(_0x24a2d1,_0x59dd16){_0x59dd16=_0x59dd16||0xcc;return function(_0x2c4fb3){if(_0x2c4fb3){return _0x24a2d1[_0xf872('0x2b')](_0x59dd16);}return _0x24a2d1[_0xf872('0x2c')](_0x59dd16)[_0xf872('0x2d')]();};}function respondWithResult(_0x1dfcc6,_0x45e9ec){_0x45e9ec=_0x45e9ec||0xc8;return function(_0x439e9f){if(_0x439e9f){return _0x1dfcc6[_0xf872('0x2c')](_0x45e9ec)[_0xf872('0x2e')](_0x439e9f);}};}function respondWithFilteredResult(_0x51ff4e,_0x56b50b){return function(_0x1b70a7){if(_0x1b70a7){var _0x1eb554=_0x1b70a7[_0xf872('0x2f')],_0xbc901e=_0x56b50b[_0xf872('0x30')],_0x1c286f=_0x56b50b[_0xf872('0x30')]+_0x56b50b[_0xf872('0x31')],_0x5941ad;if(_0x1c286f>=_0x1eb554){_0x1c286f=_0x1eb554;_0x5941ad=0xc8;}else{_0x5941ad=0xce;}_0x51ff4e['status'](_0x5941ad);return _0x51ff4e[_0xf872('0x32')](_0xf872('0x33'),_0xbc901e+'-'+_0x1c286f+'/'+_0x1eb554)[_0xf872('0x2e')](_0x1b70a7);}return null;};}function patchUpdates(_0x1ad3bf){return function(_0x5c5d8c){try{jsonpatch[_0xf872('0x34')](_0x5c5d8c,_0x1ad3bf,!![]);}catch(_0x513875){return BPromise['reject'](_0x513875);}return _0x5c5d8c['save']();};}function saveUpdates(_0x11d6ed,_0x3a41c7){return function(_0x3d3e14){if(_0x3d3e14){return _0x3d3e14[_0xf872('0x35')](_0x11d6ed)['then'](function(_0xc6c06c){return _0xc6c06c;});}return null;};}function removeEntity(_0x39cae9,_0xaf0137){return function(_0x49c38d){if(_0x49c38d){return _0x49c38d['destroy']()[_0xf872('0x20')](function(){_0x39cae9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x752345,_0xe89d38){return function(_0x174e80){if(!_0x174e80){_0x752345['sendStatus'](0x194);}return _0x174e80;};}function handleError(_0x4653af,_0x207b89){_0x207b89=_0x207b89||0x1f4;return function(_0x2f07c6){logger[_0xf872('0x27')](_0x2f07c6[_0xf872('0x36')]);if(_0x2f07c6['name']){delete _0x2f07c6[_0xf872('0x37')];}_0x4653af['status'](_0x207b89)[_0xf872('0x38')](_0x2f07c6);};}exports[_0xf872('0x39')]=function(_0x3981dd,_0x505af2){var _0x1afb20={},_0x5068ef={},_0x7694d6={'count':0x0,'rows':[]};var _0x3d50ea=_['map'](db[_0xf872('0x3a')][_0xf872('0x3b')],function(_0x4d65e2){return{'name':_0x4d65e2[_0xf872('0x3c')],'type':_0x4d65e2[_0xf872('0x3d')]['key']};});_0x5068ef['model']=_[_0xf872('0x3e')](_0x3d50ea,_0xf872('0x37'));_0x5068ef['query']=_[_0xf872('0x3f')](_0x3981dd[_0xf872('0x40')]);_0x5068ef[_0xf872('0x41')]=_[_0xf872('0x42')](_0x5068ef[_0xf872('0x43')],_0x5068ef[_0xf872('0x40')]);_0x1afb20[_0xf872('0x44')]=_[_0xf872('0x42')](_0x5068ef[_0xf872('0x43')],qs['fields'](_0x3981dd['query'][_0xf872('0x45')]));_0x1afb20[_0xf872('0x44')]=_0x1afb20['attributes'][_0xf872('0x46')]?_0x1afb20[_0xf872('0x44')]:_0x5068ef[_0xf872('0x43')];if(!_0x3981dd[_0xf872('0x40')][_0xf872('0x47')](_0xf872('0x48'))){_0x1afb20['limit']=qs[_0xf872('0x31')](_0x3981dd[_0xf872('0x40')][_0xf872('0x31')]);_0x1afb20[_0xf872('0x30')]=qs[_0xf872('0x30')](_0x3981dd[_0xf872('0x40')][_0xf872('0x30')]);}_0x1afb20[_0xf872('0x49')]=qs['sort'](_0x3981dd[_0xf872('0x40')][_0xf872('0x4a')]);_0x1afb20['where']=qs[_0xf872('0x41')](_['pick'](_0x3981dd[_0xf872('0x40')],_0x5068ef[_0xf872('0x41')]),_0x3d50ea);if(_0x3981dd[_0xf872('0x40')][_0xf872('0x4b')]){_0x1afb20['where']=_[_0xf872('0x4c')](_0x1afb20[_0xf872('0x4d')],{'$or':_[_0xf872('0x3e')](_0x3d50ea,function(_0x4a0162){if(_0x4a0162['type']!==_0xf872('0x4e')){var _0x40e214={};_0x40e214[_0x4a0162[_0xf872('0x37')]]={'$like':'%'+_0x3981dd[_0xf872('0x40')][_0xf872('0x4b')]+'%'};return _0x40e214;}})});}_0x1afb20=_['merge']({},_0x1afb20,_0x3981dd[_0xf872('0x4f')]);var _0x414de9={'where':_0x1afb20[_0xf872('0x4d')]};return db['WhatsappMessage']['count'](_0x414de9)[_0xf872('0x20')](function(_0x3c5aff){_0x7694d6[_0xf872('0x2f')]=_0x3c5aff;if(_0x3981dd[_0xf872('0x40')][_0xf872('0x50')]){_0x1afb20['include']=[{'all':!![]}];}return db[_0xf872('0x3a')][_0xf872('0x51')](_0x1afb20);})[_0xf872('0x20')](function(_0x6c7618){_0x7694d6[_0xf872('0x52')]=_0x6c7618;return _0x7694d6;})[_0xf872('0x20')](respondWithFilteredResult(_0x505af2,_0x1afb20))[_0xf872('0x2a')](handleError(_0x505af2,null));};exports[_0xf872('0x53')]=function(_0x116b1e,_0x357bc5){var _0x421f0d={'raw':!![],'where':{'id':_0x116b1e[_0xf872('0x54')]['id']}},_0x2ab420={};_0x2ab420[_0xf872('0x43')]=_[_0xf872('0x3f')](db[_0xf872('0x3a')]['rawAttributes']);_0x2ab420[_0xf872('0x40')]=_['keys'](_0x116b1e['query']);_0x2ab420[_0xf872('0x41')]=_['intersection'](_0x2ab420[_0xf872('0x43')],_0x2ab420[_0xf872('0x40')]);_0x421f0d[_0xf872('0x44')]=_[_0xf872('0x42')](_0x2ab420['model'],qs[_0xf872('0x45')](_0x116b1e[_0xf872('0x40')][_0xf872('0x45')]));_0x421f0d['attributes']=_0x421f0d[_0xf872('0x44')]['length']?_0x421f0d[_0xf872('0x44')]:_0x2ab420[_0xf872('0x43')];if(_0x116b1e[_0xf872('0x40')][_0xf872('0x50')]){_0x421f0d[_0xf872('0x55')]=[{'all':!![]}];}_0x421f0d=_[_0xf872('0x4c')]({},_0x421f0d,_0x116b1e[_0xf872('0x4f')]);return db[_0xf872('0x3a')]['find'](_0x421f0d)[_0xf872('0x20')](handleEntityNotFound(_0x357bc5,null))[_0xf872('0x20')](respondWithResult(_0x357bc5,null))[_0xf872('0x2a')](handleError(_0x357bc5,null));};exports['create']=function(_0x5727fd,_0x513e11){return db['WhatsappMessage'][_0xf872('0x56')](_0x5727fd[_0xf872('0x57')],{})[_0xf872('0x20')](respondWithResult(_0x513e11,0xc9))[_0xf872('0x2a')](handleError(_0x513e11,null));};exports['update']=function(_0x52f696,_0x3fd043){if(_0x52f696[_0xf872('0x57')]['id']){delete _0x52f696[_0xf872('0x57')]['id'];}return db['WhatsappMessage'][_0xf872('0x58')]({'where':{'id':_0x52f696[_0xf872('0x54')]['id']}})[_0xf872('0x20')](handleEntityNotFound(_0x3fd043,null))[_0xf872('0x20')](saveUpdates(_0x52f696[_0xf872('0x57')],null))[_0xf872('0x20')](respondWithResult(_0x3fd043,null))['catch'](handleError(_0x3fd043,null));};exports[_0xf872('0x59')]=function(_0x19c378,_0x15b9dc){return db[_0xf872('0x3a')][_0xf872('0x58')]({'where':{'id':_0x19c378[_0xf872('0x54')]['id']}})[_0xf872('0x20')](handleEntityNotFound(_0x15b9dc,null))['then'](removeEntity(_0x15b9dc,null))[_0xf872('0x2a')](handleError(_0x15b9dc,null));};exports[_0xf872('0x5a')]=function(_0x1a5ffe,_0x2728e5){return db['WhatsappMessage'][_0xf872('0x5a')]()['then'](respondWithResult(_0x2728e5,null))[_0xf872('0x2a')](handleError(_0x2728e5,null));};var interaction_log=require(_0xf872('0x5b'))(_0xf872('0x5c'));exports[_0xf872('0x5d')]=function(_0x4e2601,_0x339202,_0x589c03){var _0x30da60={'channel':'whatsapp'};if(_0x4e2601[_0xf872('0x57')]['id']){delete _0x4e2601['body']['id'];}_0x4e2601[_0xf872('0x57')][_0xf872('0x5e')]=!![];_0x4e2601['body'][_0xf872('0x5f')]=moment()[_0xf872('0x60')](_0xf872('0x61'));_0x4e2601[_0xf872('0x57')][_0xf872('0x62')]=_0x4e2601['body'][_0xf872('0x62')]||_0x4e2601['user']['id'];return db[_0xf872('0x3a')][_0xf872('0x58')]({'where':{'id':_0x4e2601[_0xf872('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xf872('0x63')],'as':_0xf872('0x64')}]})[_0xf872('0x20')](handleEntityNotFound(_0x339202,null))['then'](saveUpdates(_0x4e2601[_0xf872('0x57')],null))[_0xf872('0x20')](function(_0x1e2113){if(_0x1e2113){_0x30da60[_0xf872('0x28')]=_0x1e2113[_0xf872('0x65')]({'plain':!![]});return db[_0xf872('0x66')][_0xf872('0x58')]({'where':{'id':_0x1e2113[_0xf872('0x67')]}});}return null;})[_0xf872('0x20')](handleEntityNotFound(_0x339202,null))['then'](function(_0x98fdb5){if(_0x98fdb5){return _0x98fdb5['update']({'UserId':_0x4e2601[_0xf872('0x57')][_0xf872('0x62')],'read1stAt':_[_0xf872('0x68')](_0x98fdb5[_0xf872('0x69')])?moment()['format'](_0xf872('0x61')):undefined});}return null;})[_0xf872('0x20')](function(_0x5b1a6a){if(_0x5b1a6a){_0x30da60[_0xf872('0x6a')]=_0x5b1a6a['get']({'plain':!![]});interaction_log[_0xf872('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e2601[_0xf872('0x6b')]['id'],_0x4e2601['user'][_0xf872('0x37')],_0x4e2601[_0xf872('0x6b')][_0xf872('0x6c')],_0x30da60['interaction']['id'],_0x4e2601[_0xf872('0x57')]?JSON[_0xf872('0x26')](_0x4e2601[_0xf872('0x57')]):_0xf872('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xf872('0x6e'),_0x30da60);}return null;})[_0xf872('0x20')](function(_0x54b750){if(_0x54b750){if(_0x4e2601[_0xf872('0x57')][_0xf872('0x6f')]){_0x30da60[_0xf872('0x28')][_0xf872('0x70')]=util['format'](_0xf872('0x71'),_0x4e2601['user'][_0xf872('0x37')]);_0x30da60['message'][_0xf872('0x72')]=_0x30da60[_0xf872('0x72')];_0x30da60[_0xf872('0x28')][_0xf872('0x73')]=_0xf872('0x5d');return respondWithRpcPromise(_0xf872('0x74'),_0xf872('0x74'),{'event':_0xf872('0x75'),'message':_0x30da60[_0xf872('0x28')]},client9002)[_0xf872('0x20')](function(){return _0x30da60;});}return _0x30da60;}return null;})[_0xf872('0x20')](respondWithResult(_0x339202,null))['catch'](handleError(_0x339202,null));};var interaction_log=require(_0xf872('0x5b'))('whatsapp-interactions');exports[_0xf872('0x76')]=function(_0x52a639,_0x5be67d,_0x513232){var _0x3f87bb={'agent':{},'channel':_0xf872('0x77')};if(_0x52a639[_0xf872('0x57')]['id']){delete _0x52a639['body']['id'];}_0x52a639[_0xf872('0x57')][_0xf872('0x62')]=_0x52a639[_0xf872('0x57')][_0xf872('0x62')]||_0x52a639[_0xf872('0x6b')]['id'];_0x3f87bb[_0xf872('0x78')]['id']=_0x52a639[_0xf872('0x57')][_0xf872('0x62')];return db['WhatsappMessage'][_0xf872('0x58')]({'where':{'id':_0x52a639['params']['id'],'UserId':null}})[_0xf872('0x20')](handleEntityNotFound(_0x5be67d,null))[_0xf872('0x20')](function(_0x215c92){if(_0x215c92){_0x3f87bb[_0xf872('0x28')]=_0x215c92['get']({'plain':!![]});return db[_0xf872('0x66')][_0xf872('0x58')]({'where':{'id':_0x215c92[_0xf872('0x67')]}});}return null;})[_0xf872('0x20')](handleEntityNotFound(_0x5be67d,null))[_0xf872('0x20')](function(_0x40aa4d){if(_0x40aa4d){_0x3f87bb[_0xf872('0x6a')]=_0x40aa4d[_0xf872('0x65')]({'plain':!![]});interaction_log[_0xf872('0x21')](_0xf872('0x79'),_0x52a639['user']['id'],_0x52a639['user'][_0xf872('0x37')],_0x52a639[_0xf872('0x6b')]['role'],_0x3f87bb[_0xf872('0x6a')]['id'],_0x52a639['body']?JSON['stringify'](_0x52a639[_0xf872('0x57')]):_0xf872('0x6d'));return respondWithRpcPromise('RejectMessage',_0xf872('0x7a'),_0x3f87bb);}return null;})['then'](function(_0x4734cb){if(_0x4734cb){_0x4734cb[_0xf872('0x28')][_0xf872('0x70')]=util['format'](_0xf872('0x71'),_0x52a639['user'][_0xf872('0x37')]);_0x4734cb['message'][_0xf872('0x72')]=_0x3f87bb[_0xf872('0x72')];_0x4734cb[_0xf872('0x28')][_0xf872('0x73')]=_0xf872('0x76');respondWithRpcPromise('EventManager',_0xf872('0x74'),{'event':_0xf872('0x7b'),'message':_0x4734cb[_0xf872('0x28')]},client9002);return _0x3f87bb;}return null;})[_0xf872('0x20')](respondWithResult(_0x5be67d,null))[_0xf872('0x2a')](handleError(_0x5be67d,null));};exports[_0xf872('0x2c')]=function(_0x44845f,_0x51ba77,_0x5184d9){if(_0x44845f[_0xf872('0x57')]['id']){delete _0x44845f[_0xf872('0x57')]['id'];}var _0x1e23c7;return db[_0xf872('0x3a')][_0xf872('0x58')]({'where':{'id':_0x44845f[_0xf872('0x54')]['id']}})[_0xf872('0x20')](handleEntityNotFound(_0x51ba77,null))['then'](function(_0x368c04){if(_0x368c04){_0x1e23c7=_0x368c04;return db['WhatsappAccount'][_0xf872('0x58')]({'where':{'id':_0x368c04[_0xf872('0x7c')]}});}})[_0xf872('0x20')](handleEntityNotFound(_0x51ba77,null))['then'](function(_0x1d2a70){if(_0x1d2a70){logger[_0xf872('0x24')](_0xf872('0x7d'),'status',_0xf872('0x7e'),_0x1d2a70[_0xf872('0x3d')],util[_0xf872('0x7f')](_0x44845f[_0xf872('0x57')],{'showHidden':![],'depth':null}));switch(_0x1d2a70[_0xf872('0x3d')]){case _0xf872('0x80'):if(_0x44845f[_0xf872('0x57')]['MessageSid']&&_0x44845f[_0xf872('0x57')][_0xf872('0x81')]===_0x1e23c7[_0xf872('0x82')]&&_0x44845f['body'][_0xf872('0x83')]&&_0x44845f[_0xf872('0x57')][_0xf872('0x83')]===_0xf872('0x5e')){return _0x1e23c7[_0xf872('0x35')]({'read':!![]});}else{logger[_0xf872('0x27')](_0xf872('0x84'),_0xf872('0x2c'),'twilio',util['inspect'](_0x44845f['body'],{'showHidden':![],'depth':null}));}break;}return _0x1e23c7;}})[_0xf872('0x20')](respondWithResult(_0x51ba77,null))[_0xf872('0x2a')](handleError(_0x51ba77,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 52078b5..63a8b19 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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2a9403,_0x162c53){var _0x3be981=function(_0x2c0812){while(--_0x2c0812){_0x2a9403['push'](_0x2a9403['shift']());}};_0x3be981(++_0x162c53);}(_0x7a54,0x106));var _0x47a5=function(_0x2f0a0f,_0x19070f){_0x2f0a0f=_0x2f0a0f-0x0;var _0x3e726c=_0x7a54[_0x2f0a0f];return _0x3e726c;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x264bf5,_0x9ac19e){var _0x469356=function(_0x4e0a9d){while(--_0x4e0a9d){_0x264bf5['push'](_0x264bf5['shift']());}};_0x469356(++_0x9ac19e);}(_0xb10b,0x12a));var _0xbb10=function(_0xe1770a,_0x4fc5d6){_0xe1770a=_0xe1770a-0x0;var _0x3e6274=_0xb10b[_0xe1770a];return _0x3e6274;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 4477944..78d7d86 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 _0x1513=['out','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','whatsapp:','phone','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','models','get','direction','toLowerCase'];(function(_0x1fe9b6,_0x275e42){var _0xd72ed7=function(_0x544cd5){while(--_0x544cd5){_0x1fe9b6['push'](_0x1fe9b6['shift']());}};_0xd72ed7(++_0x275e42);}(_0x1513,0xe3));var _0x3151=function(_0x16b36d,_0x302510){_0x16b36d=_0x16b36d-0x0;var _0xab0fb8=_0x1513[_0x16b36d];return _0xab0fb8;};'use strict';var _=require(_0x3151('0x0'));var util=require(_0x3151('0x1'));var logger=require(_0x3151('0x2'))(_0x3151('0x3'));var moment=require(_0x3151('0x4'));var BPromise=require('bluebird');var rp=require(_0x3151('0x5'));var fs=require('fs');var path=require(_0x3151('0x6'));var rimraf=require(_0x3151('0x7'));var config=require(_0x3151('0x8'));var attributes=require(_0x3151('0x9'));module[_0x3151('0xa')]=function(_0x1bc6f4,_0x2900d5){return _0x1bc6f4[_0x3151('0xb')]('WhatsappMessage',attributes,{'tableName':_0x3151('0xc'),'paranoid':![],'indexes':[{'name':_0x3151('0xd'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1baa02,_0x574538,_0x4a9b2){var _0x1e8162=_0x1bc6f4[_0x3151('0xe')];var _0x48b6b0=_0x1baa02[_0x3151('0xf')]({'plain':!![]});if(_0x48b6b0[_0x3151('0x10')][_0x3151('0x11')]()==='in'||_0x48b6b0[_0x3151('0x10')][_0x3151('0x11')]()===_0x3151('0x12')&&!_0x48b6b0['secret']&&!_[_0x3151('0x13')](_0x48b6b0[_0x3151('0x14')])){_0x1e8162[_0x3151('0x15')][_0x3151('0x16')]({'where':{'id':_0x48b6b0['WhatsappInteractionId']}})[_0x3151('0x17')](function(_0x342693){if(_0x342693){_0x342693[_0x3151('0x18')]({'lastMsgAt':_0x48b6b0[_0x3151('0x19')],'lastMsgDirection':_0x48b6b0[_0x3151('0x10')][_0x3151('0x11')]()});}})[_0x3151('0x1a')](function(_0x4a137e){console['error'](_0x4a137e);});}if(_0x48b6b0[_0x3151('0x10')]===_0x3151('0x12')&&!_0x48b6b0[_0x3151('0x1b')]){var _0x2221da;_0x1e8162[_0x3151('0x1c')][_0x3151('0x1d')]({'where':{'id':_0x48b6b0[_0x3151('0x1e')]},'raw':!![]})['then'](function(_0x4003b7){_0x2221da=_0x4003b7;if(_0x2221da&&_0x2221da[_0x3151('0x1f')]){switch(_0x2221da[_0x3151('0x1f')]){case _0x3151('0x20'):var _0x923a78=require('twilio');if(_0x2221da[_0x3151('0x21')]&&_0x2221da[_0x3151('0x22')]&&_0x2221da['phone']){var _0x1cccc2=new _0x923a78(_0x2221da[_0x3151('0x21')],_0x2221da[_0x3151('0x22')]);_0x1cccc2[_0x3151('0x23')]['create']({'body':_0x48b6b0['body'],'to':_0x3151('0x24')+_0x48b6b0[_0x3151('0x25')],'from':_0x3151('0x24')+_0x2221da[_0x3151('0x25')],'statusCallback':_0x2221da[_0x3151('0x26')]+'/api/whatsapp/messages/'+_0x48b6b0['id']+_0x3151('0x27')+_0x2221da[_0x3151('0x28')]})[_0x3151('0x17')](function(_0x219e46){if(_0x219e46['sid']){return _0x1baa02[_0x3151('0x18')]({'messageId':_0x219e46[_0x3151('0x29')]});}})[_0x3151('0x1a')](function(_0x1b7ac1){logger['error'](_0x3151('0x2a'),_0x3151('0x2b'),_0x3151('0x20'),util[_0x3151('0x2c')](_0x1b7ac1,{'showHidden':![],'depth':null}));});}else{logger[_0x3151('0x2d')](_0x3151('0x2a'),_0x3151('0x2b'),_0x3151('0x20'),_0x3151('0x2e'));}break;}}})[_0x3151('0x2f')](function(){_0x4a9b2();});}else{_0x4a9b2();}}},'charset':'utf8mb4','collate':_0x3151('0x30')});}; \ No newline at end of file +var _0xf833=['update','catch','error','find','type','twilio','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','WhatsappInteraction','findOne','then'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf833,0x1d8));var _0x3f83=function(_0x3133b6,_0x15ca13){_0x3133b6=_0x3133b6-0x0;var _0x1a3f93=_0xf833[_0x3133b6];return _0x1a3f93;};'use strict';var _=require('lodash');var util=require(_0x3f83('0x0'));var logger=require(_0x3f83('0x1'))(_0x3f83('0x2'));var moment=require(_0x3f83('0x3'));var BPromise=require(_0x3f83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f83('0x5'));var config=require(_0x3f83('0x6'));var attributes=require(_0x3f83('0x7'));module['exports']=function(_0x40ea1c,_0x945273){return _0x40ea1c[_0x3f83('0x8')](_0x3f83('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x3f83('0xa')]},{'name':_0x3f83('0xb'),'fields':[_0x3f83('0xc')],'type':_0x3f83('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25efe8,_0x3343cc,_0x32e96b){var _0x301d4b=_0x40ea1c[_0x3f83('0xe')];var _0x4438f1=_0x25efe8[_0x3f83('0xf')]({'plain':!![]});if(_0x4438f1[_0x3f83('0x10')][_0x3f83('0x11')]()==='in'||_0x4438f1['direction'][_0x3f83('0x11')]()===_0x3f83('0x12')&&!_0x4438f1[_0x3f83('0x13')]&&!_['isNil'](_0x4438f1['UserId'])){_0x301d4b[_0x3f83('0x14')][_0x3f83('0x15')]({'where':{'id':_0x4438f1['WhatsappInteractionId']}})[_0x3f83('0x16')](function(_0x97fe37){if(_0x97fe37){_0x97fe37[_0x3f83('0x17')]({'lastMsgAt':_0x4438f1['createdAt'],'lastMsgDirection':_0x4438f1[_0x3f83('0x10')]['toLowerCase']()});}})[_0x3f83('0x18')](function(_0x562cbc){console[_0x3f83('0x19')](_0x562cbc);});}if(_0x4438f1[_0x3f83('0x10')]==='out'&&!_0x4438f1[_0x3f83('0x13')]){var _0x658044;_0x301d4b['WhatsappAccount'][_0x3f83('0x1a')]({'where':{'id':_0x4438f1['WhatsappAccountId']},'raw':!![]})['then'](function(_0x319715){_0x658044=_0x319715;if(_0x658044&&_0x658044[_0x3f83('0x1b')]){switch(_0x658044['type']){case'twilio':var _0x5d585a=require(_0x3f83('0x1c'));if(_0x658044['accountSid']&&_0x658044['authToken']&&_0x658044[_0x3f83('0x1d')]){var _0x2ac716=new _0x5d585a(_0x658044['accountSid'],_0x658044[_0x3f83('0x1e')]);_0x2ac716[_0x3f83('0x1f')][_0x3f83('0x20')]({'body':_0x4438f1[_0x3f83('0xc')],'to':_0x3f83('0x21')+_0x4438f1[_0x3f83('0x1d')],'from':_0x3f83('0x21')+_0x658044[_0x3f83('0x1d')],'statusCallback':_0x658044[_0x3f83('0x22')]+_0x3f83('0x23')+_0x4438f1['id']+_0x3f83('0x24')+_0x658044[_0x3f83('0x25')]})[_0x3f83('0x16')](function(_0x11c602){if(_0x11c602[_0x3f83('0x26')]){return _0x25efe8['update']({'messageId':_0x11c602['sid']});}})[_0x3f83('0x18')](function(_0x5d0829){logger[_0x3f83('0x19')](_0x3f83('0x27'),_0x3f83('0x28'),'twilio',util['inspect'](_0x5d0829,{'showHidden':![],'depth':null}));});}else{logger[_0x3f83('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3f83('0x28'),'twilio',_0x3f83('0x29'));}break;}}})[_0x3f83('0x2a')](function(){_0x32e96b();});}else{_0x32e96b();}}},'charset':_0x3f83('0x2b'),'collate':_0x3f83('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cbb6e91..920f1a2 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 _0x2253=['CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2253,0x145));var _0x3225=function(_0x597a9e,_0x5a8346){_0x597a9e=_0x597a9e-0x0;var _0x12ef70=_0x2253[_0x597a9e];return _0x12ef70;};'use strict';var _=require(_0x3225('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3225('0x1'));var rs=require(_0x3225('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3225('0x3'))['db'];var utils=require(_0x3225('0x4'));var logger=require(_0x3225('0x5'))(_0x3225('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3225('0x7')]({'port':0x232a});config[_0x3225('0x8')]=_[_0x3225('0x9')](config[_0x3225('0x8')],{'host':_0x3225('0xa'),'port':0x18eb});var socket=require(_0x3225('0xb'))(new Redis(config[_0x3225('0x8')]));require(_0x3225('0xc'))['register'](socket);function respondWithRpcPromise(_0x4e1852,_0x22af13,_0x13bfde){return new BPromise(function(_0x4b0215,_0x4e7b65){return client['request'](_0x4e1852,_0x13bfde)[_0x3225('0xd')](function(_0x18835a){logger[_0x3225('0xe')](_0x3225('0xf'),_0x22af13,_0x3225('0x10'));logger[_0x3225('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x22af13,'request\x20sent',JSON[_0x3225('0x12')](_0x18835a));if(_0x18835a[_0x3225('0x13')]){if(_0x18835a[_0x3225('0x13')]['code']===0x1f4){logger[_0x3225('0x13')](_0x3225('0xf'),_0x22af13,_0x18835a[_0x3225('0x13')][_0x3225('0x14')]);return _0x4e7b65(_0x18835a[_0x3225('0x13')][_0x3225('0x14')]);}logger[_0x3225('0x13')](_0x3225('0xf'),_0x22af13,_0x18835a[_0x3225('0x13')][_0x3225('0x14')]);return _0x4b0215(_0x18835a[_0x3225('0x13')][_0x3225('0x14')]);}else{logger[_0x3225('0xe')](_0x3225('0xf'),_0x22af13,_0x3225('0x10'));_0x4b0215(_0x18835a[_0x3225('0x15')]['message']);}})[_0x3225('0x16')](function(_0x13b0e8){logger[_0x3225('0x13')](_0x3225('0xf'),_0x22af13,_0x13b0e8);_0x4e7b65(_0x13b0e8);});});}exports[_0x3225('0x17')]=function(_0x1c389e){var _0x27d61d=this;return new Promise(function(_0x317a08,_0x2eeac6){return db[_0x3225('0x18')][_0x3225('0x19')](_0x1c389e[_0x3225('0x1a')],{'raw':_0x1c389e[_0x3225('0x1b')]?_0x1c389e[_0x3225('0x1b')][_0x3225('0x1c')]===undefined?!![]:![]:!![]})[_0x3225('0xd')](function(_0x4cf8bc){logger[_0x3225('0xe')](_0x3225('0x17'),_0x1c389e);logger['debug'](_0x3225('0x17'),_0x1c389e,JSON['stringify'](_0x4cf8bc));_0x317a08(_0x4cf8bc);})[_0x3225('0x16')](function(_0x195987){logger[_0x3225('0x13')]('CreateWhatsappMessage',_0x195987[_0x3225('0x14')],_0x1c389e);_0x2eeac6(_0x27d61d['error'](0x1f4,_0x195987['message']));});});}; \ No newline at end of file +var _0xce35=['request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x169708,_0x5621bb){var _0x49882d=function(_0x2f62b9){while(--_0x2f62b9){_0x169708['push'](_0x169708['shift']());}};_0x49882d(++_0x5621bb);}(_0xce35,0xab));var _0x5ce3=function(_0x511992,_0x13221f){_0x511992=_0x511992-0x0;var _0x39fcb0=_0xce35[_0x511992];return _0x39fcb0;};'use strict';var _=require(_0x5ce3('0x0'));var util=require(_0x5ce3('0x1'));var moment=require(_0x5ce3('0x2'));var BPromise=require(_0x5ce3('0x3'));var rs=require(_0x5ce3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ce3('0x6'))('rpc');var config=require(_0x5ce3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ce3('0x8')]['http']({'port':0x232a});config[_0x5ce3('0x9')]=_[_0x5ce3('0xa')](config[_0x5ce3('0x9')],{'host':_0x5ce3('0xb'),'port':0x18eb});var socket=require(_0x5ce3('0xc'))(new Redis(config['redis']));require(_0x5ce3('0xd'))[_0x5ce3('0xe')](socket);function respondWithRpcPromise(_0x2a07a6,_0x47d4b3,_0x52df89){return new BPromise(function(_0xe8af94,_0x210797){return client[_0x5ce3('0xf')](_0x2a07a6,_0x52df89)[_0x5ce3('0x10')](function(_0x43f81a){logger['info'](_0x5ce3('0x11'),_0x47d4b3,_0x5ce3('0x12'));logger[_0x5ce3('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x47d4b3,_0x5ce3('0x12'),JSON[_0x5ce3('0x14')](_0x43f81a));if(_0x43f81a['error']){if(_0x43f81a['error'][_0x5ce3('0x15')]===0x1f4){logger[_0x5ce3('0x16')](_0x5ce3('0x11'),_0x47d4b3,_0x43f81a[_0x5ce3('0x16')]['message']);return _0x210797(_0x43f81a[_0x5ce3('0x16')][_0x5ce3('0x17')]);}logger[_0x5ce3('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x47d4b3,_0x43f81a['error']['message']);return _0xe8af94(_0x43f81a[_0x5ce3('0x16')][_0x5ce3('0x17')]);}else{logger[_0x5ce3('0x18')](_0x5ce3('0x11'),_0x47d4b3,'request\x20sent');_0xe8af94(_0x43f81a[_0x5ce3('0x19')][_0x5ce3('0x17')]);}})['catch'](function(_0x4f531b){logger[_0x5ce3('0x16')](_0x5ce3('0x11'),_0x47d4b3,_0x4f531b);_0x210797(_0x4f531b);});});}exports[_0x5ce3('0x1a')]=function(_0x3b1fac){var _0x428d3c=this;return new Promise(function(_0x1c7e97,_0x157020){return db[_0x5ce3('0x1b')][_0x5ce3('0x1c')](_0x3b1fac['body'],{'raw':_0x3b1fac[_0x5ce3('0x1d')]?_0x3b1fac[_0x5ce3('0x1d')][_0x5ce3('0x1e')]===undefined?!![]:![]:!![]})[_0x5ce3('0x10')](function(_0x12b8d7){logger['info'](_0x5ce3('0x1a'),_0x3b1fac);logger[_0x5ce3('0x13')](_0x5ce3('0x1a'),_0x3b1fac,JSON[_0x5ce3('0x14')](_0x12b8d7));_0x1c7e97(_0x12b8d7);})['catch'](function(_0x2d1a5d){logger[_0x5ce3('0x16')](_0x5ce3('0x1a'),_0x2d1a5d[_0x5ce3('0x17')],_0x3b1fac);_0x157020(_0x428d3c['error'](0x1f4,_0x2d1a5d[_0x5ce3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 669b5ef..c214153 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 _0xe6be=['save','update','register','./whatsappMessage.events'];(function(_0xbcf4e3,_0x2f491d){var _0x127f98=function(_0x3b9695){while(--_0x3b9695){_0xbcf4e3['push'](_0xbcf4e3['shift']());}};_0x127f98(++_0x2f491d);}(_0xe6be,0x153));var _0xee6b=function(_0x4f81cd,_0xa518c6){_0x4f81cd=_0x4f81cd-0x0;var _0x5e0733=_0xe6be[_0x4f81cd];return _0x5e0733;};'use strict';var WhatsappMessageEvents=require(_0xee6b('0x0'));var events=[_0xee6b('0x1'),'remove',_0xee6b('0x2')];function createListener(_0x42310f,_0x3619d3){return function(_0x232c11){_0x3619d3['emit'](_0x42310f,_0x232c11);};}function removeListener(_0x10d2e3,_0x43fea7){return function(){WhatsappMessageEvents['removeListener'](_0x10d2e3,_0x43fea7);};}exports[_0xee6b('0x3')]=function(_0xb326af){for(var _0x554b65=0x0,_0x40a53a=events['length'];_0x554b65<_0x40a53a;_0x554b65++){var _0x174234=events[_0x554b65];var _0x57d0a0=createListener('whatsappMessage:'+_0x174234,_0xb326af);WhatsappMessageEvents['on'](_0x174234,_0x57d0a0);}}; \ No newline at end of file +var _0xc55d=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x1a2635,_0x2a33a8){var _0x2ccd92=function(_0x3874cc){while(--_0x3874cc){_0x1a2635['push'](_0x1a2635['shift']());}};_0x2ccd92(++_0x2a33a8);}(_0xc55d,0x1d9));var _0xdc55=function(_0x562990,_0x253156){_0x562990=_0x562990-0x0;var _0x36bb88=_0xc55d[_0x562990];return _0x36bb88;};'use strict';var WhatsappMessageEvents=require(_0xdc55('0x0'));var events=[_0xdc55('0x1'),_0xdc55('0x2'),_0xdc55('0x3')];function createListener(_0x596855,_0x14d966){return function(_0x492b44){_0x14d966[_0xdc55('0x4')](_0x596855,_0x492b44);};}function removeListener(_0x2bd660,_0x270450){return function(){WhatsappMessageEvents[_0xdc55('0x5')](_0x2bd660,_0x270450);};}exports[_0xdc55('0x6')]=function(_0x29809d){for(var _0x19df86=0x0,_0x456903=events['length'];_0x19df86<_0x456903;_0x19df86++){var _0x42c02a=events[_0x19df86];var _0x27c1c8=createListener(_0xdc55('0x7')+_0x42c02a,_0x29809d);WhatsappMessageEvents['on'](_0x42c02a,_0x27c1c8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index da28b58..b7a135c 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 _0xacd6=['update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','/:id'];(function(_0x54fd6c,_0x421fc1){var _0x10be12=function(_0x236936){while(--_0x236936){_0x54fd6c['push'](_0x54fd6c['shift']());}};_0x10be12(++_0x421fc1);}(_0xacd6,0x1c7));var _0x6acd=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0xacd6[_0x4de877];return _0xb2cfeb;};'use strict';var multer=require(_0x6acd('0x0'));var util=require(_0x6acd('0x1'));var path=require('path');var timeout=require(_0x6acd('0x2'));var express=require(_0x6acd('0x3'));var router=express[_0x6acd('0x4')]();var auth=require(_0x6acd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6acd('0x6'));var controller=require(_0x6acd('0x7'));router[_0x6acd('0x8')]('/',auth[_0x6acd('0x9')](),controller[_0x6acd('0xa')]);router['get'](_0x6acd('0xb'),auth['isAuthenticated'](),controller[_0x6acd('0xc')]);router[_0x6acd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6acd('0xd')]);router[_0x6acd('0x8')](_0x6acd('0xe'),auth['isAuthenticated'](),controller[_0x6acd('0xf')]);router['get'](_0x6acd('0x10'),auth[_0x6acd('0x9')](),controller[_0x6acd('0x11')]);router[_0x6acd('0x8')](_0x6acd('0x12'),auth[_0x6acd('0x9')](),controller[_0x6acd('0x13')]);router[_0x6acd('0x14')]('/',auth[_0x6acd('0x9')](),controller[_0x6acd('0x15')]);router[_0x6acd('0x14')]('/:id/teams',auth[_0x6acd('0x9')](),controller[_0x6acd('0x16')]);router[_0x6acd('0x14')]('/:id/users',auth[_0x6acd('0x9')](),controller['addAgents']);router[_0x6acd('0x17')](_0x6acd('0x18'),auth[_0x6acd('0x9')](),controller[_0x6acd('0x19')]);router[_0x6acd('0x1a')](_0x6acd('0x18'),auth[_0x6acd('0x9')](),controller[_0x6acd('0x1b')]);router[_0x6acd('0x1a')](_0x6acd('0x10'),auth[_0x6acd('0x9')](),controller[_0x6acd('0x1c')]);router[_0x6acd('0x1a')](_0x6acd('0x12'),auth[_0x6acd('0x9')](),controller['removeAgents']);module[_0x6acd('0x1d')]=router; \ No newline at end of file +var _0x1ca6=['/describe','describe','/:id','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1ca6,0x11e));var _0x61ca=function(_0x1e8d7a,_0x58ca61){_0x1e8d7a=_0x1e8d7a-0x0;var _0x5865d3=_0x1ca6[_0x1e8d7a];return _0x5865d3;};'use strict';var multer=require(_0x61ca('0x0'));var util=require(_0x61ca('0x1'));var path=require(_0x61ca('0x2'));var timeout=require(_0x61ca('0x3'));var express=require(_0x61ca('0x4'));var router=express[_0x61ca('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x61ca('0x6'));var config=require(_0x61ca('0x7'));var controller=require('./whatsappQueue.controller');router[_0x61ca('0x8')]('/',auth[_0x61ca('0x9')](),controller[_0x61ca('0xa')]);router[_0x61ca('0x8')](_0x61ca('0xb'),auth[_0x61ca('0x9')](),controller[_0x61ca('0xc')]);router[_0x61ca('0x8')](_0x61ca('0xd'),auth[_0x61ca('0x9')](),controller['show']);router[_0x61ca('0x8')]('/:id/members',auth[_0x61ca('0x9')](),controller[_0x61ca('0xe')]);router[_0x61ca('0x8')](_0x61ca('0xf'),auth[_0x61ca('0x9')](),controller['getTeams']);router[_0x61ca('0x8')](_0x61ca('0x10'),auth[_0x61ca('0x9')](),controller[_0x61ca('0x11')]);router[_0x61ca('0x12')]('/',auth[_0x61ca('0x9')](),controller[_0x61ca('0x13')]);router[_0x61ca('0x12')](_0x61ca('0xf'),auth[_0x61ca('0x9')](),controller[_0x61ca('0x14')]);router['post'](_0x61ca('0x10'),auth[_0x61ca('0x9')](),controller[_0x61ca('0x15')]);router[_0x61ca('0x16')](_0x61ca('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x61ca('0x17')]);router[_0x61ca('0x18')](_0x61ca('0xf'),auth[_0x61ca('0x9')](),controller[_0x61ca('0x19')]);router[_0x61ca('0x18')]('/:id/users',auth[_0x61ca('0x9')](),controller[_0x61ca('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f223c38..303df3d 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 _0x0da6=['STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x5646f8,_0x8af9e9){var _0x26404b=function(_0x3f0e85){while(--_0x3f0e85){_0x5646f8['push'](_0x5646f8['shift']());}};_0x26404b(++_0x8af9e9);}(_0x0da6,0x71));var _0x60da=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0x0da6[_0x35e75a];return _0xb23c7f;};'use strict';var Sequelize=require('sequelize');module[_0x60da('0x0')]={'name':{'type':Sequelize[_0x60da('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x60da('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x60da('0x3'),_0x60da('0x4'),_0x60da('0x5'))},'description':{'type':Sequelize[_0x60da('0x1')]}}; \ No newline at end of file +var _0xb490=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x22c965,_0x2297e7){var _0x8cf3a9=function(_0x1a816b){while(--_0x1a816b){_0x22c965['push'](_0x22c965['shift']());}};_0x8cf3a9(++_0x2297e7);}(_0xb490,0xc8));var _0x0b49=function(_0x13d614,_0xac6960){_0x13d614=_0x13d614-0x0;var _0x34b07f=_0xb490[_0x13d614];return _0x34b07f;};'use strict';var Sequelize=require(_0x0b49('0x0'));module[_0x0b49('0x1')]={'name':{'type':Sequelize[_0x0b49('0x2')],'unique':_0x0b49('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0b49('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0b49('0x5'),_0x0b49('0x6'),_0x0b49('0x7'))},'description':{'type':Sequelize[_0x0b49('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 630c7a5..87a3ac8 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 _0x1ae2=['UserProfileResource','then','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','map','keys','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','params','UserWhatsappQueue','length','pick','WhatsappQueueId','User','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','includes','all','value','removeAgents','addAgents','omit','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get'];(function(_0x3223ab,_0x4c5e5e){var _0x71ea40=function(_0x588876){while(--_0x588876){_0x3223ab['push'](_0x3223ab['shift']());}};_0x71ea40(++_0x4c5e5e);}(_0x1ae2,0x1e0));var _0x21ae=function(_0x4140bc,_0x2fdaf1){_0x4140bc=_0x4140bc-0x0;var _0x5f425d=_0x1ae2[_0x4140bc];return _0x5f425d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21ae('0x0'));var rimraf=require(_0x21ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21ae('0x2'));var rp=require(_0x21ae('0x3'));var moment=require(_0x21ae('0x4'));var BPromise=require(_0x21ae('0x5'));var Mustache=require(_0x21ae('0x6'));var util=require(_0x21ae('0x7'));var path=require(_0x21ae('0x8'));var sox=require('sox');var csv=require(_0x21ae('0x9'));var ejs=require(_0x21ae('0xa'));var fs=require('fs');var _=require(_0x21ae('0xb'));var squel=require(_0x21ae('0xc'));var crypto=require(_0x21ae('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x21ae('0x9'));var querystring=require(_0x21ae('0xe'));var Papa=require(_0x21ae('0xf'));var Redis=require(_0x21ae('0x10'));var authService=require(_0x21ae('0x11'));var qs=require(_0x21ae('0x12'));var as=require(_0x21ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21ae('0x14'))('api');var utils=require(_0x21ae('0x15'));var config=require('../../config/environment');var db=require(_0x21ae('0x16'))['db'];config['redis']=_['defaults'](config[_0x21ae('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x21ae('0x18'))(new Redis(config[_0x21ae('0x17')]));require(_0x21ae('0x19'))[_0x21ae('0x1a')](socket);function respondWithStatusCode(_0x3f0dc6,_0x2711fc){_0x2711fc=_0x2711fc||0xcc;return function(_0x3fce32){if(_0x3fce32){return _0x3f0dc6[_0x21ae('0x1b')](_0x2711fc);}return _0x3f0dc6[_0x21ae('0x1c')](_0x2711fc)[_0x21ae('0x1d')]();};}function respondWithResult(_0x378124,_0x41b353){_0x41b353=_0x41b353||0xc8;return function(_0x3dfcbf){if(_0x3dfcbf){return _0x378124[_0x21ae('0x1c')](_0x41b353)['json'](_0x3dfcbf);}};}function respondWithFilteredResult(_0x85bbf3,_0x54db79){return function(_0x183038){if(_0x183038){var _0x27a510=_0x183038['count'],_0x38f03b=_0x54db79[_0x21ae('0x1e')],_0x44fd75=_0x54db79[_0x21ae('0x1e')]+_0x54db79[_0x21ae('0x1f')],_0x4131aa;if(_0x44fd75>=_0x27a510){_0x44fd75=_0x27a510;_0x4131aa=0xc8;}else{_0x4131aa=0xce;}_0x85bbf3[_0x21ae('0x1c')](_0x4131aa);return _0x85bbf3['set'](_0x21ae('0x20'),_0x38f03b+'-'+_0x44fd75+'/'+_0x27a510)[_0x21ae('0x21')](_0x183038);}return null;};}function patchUpdates(_0x3e5903){return function(_0x1b2d75){try{jsonpatch[_0x21ae('0x22')](_0x1b2d75,_0x3e5903,!![]);}catch(_0x6c3945){return BPromise[_0x21ae('0x23')](_0x6c3945);}return _0x1b2d75[_0x21ae('0x24')]();};}function saveUpdates(_0x32b386,_0x4856f6){return function(_0x4284f2){if(_0x4284f2){return _0x4284f2[_0x21ae('0x25')](_0x32b386)['then'](function(_0x53827c){return _0x53827c;});}return null;};}function removeEntity(_0x5a7a6b,_0x38ea11){return function(_0x5415dc){if(_0x5415dc){return _0x5415dc[_0x21ae('0x26')]()['then'](function(){var _0x1ef8cb=_0x5415dc[_0x21ae('0x27')]({'plain':!![]});var _0x8bbc22='WhatsappQueues';return db[_0x21ae('0x28')]['destroy']({'where':{'type':_0x8bbc22,'resourceId':_0x1ef8cb['id']}})[_0x21ae('0x29')](function(){return _0x5415dc;});})['then'](function(){_0x5a7a6b[_0x21ae('0x1c')](0xcc)[_0x21ae('0x1d')]();});}};}function handleEntityNotFound(_0x4c412e,_0x33e193){return function(_0x58425d){if(!_0x58425d){_0x4c412e[_0x21ae('0x1b')](0x194);}return _0x58425d;};}function handleError(_0xd273fb,_0x46a9a8){_0x46a9a8=_0x46a9a8||0x1f4;return function(_0x46ea77){logger[_0x21ae('0x2a')](_0x46ea77['stack']);if(_0x46ea77['name']){delete _0x46ea77[_0x21ae('0x2b')];}_0xd273fb[_0x21ae('0x1c')](_0x46a9a8)[_0x21ae('0x2c')](_0x46ea77);};}exports[_0x21ae('0x2d')]=function(_0x5db8a0,_0x1b4d0e){var _0x1f65e8={},_0x24b27f={},_0x8451ee={'count':0x0,'rows':[]};var _0x31b29c=_['map'](db[_0x21ae('0x2e')][_0x21ae('0x2f')],function(_0x1f9c85){return{'name':_0x1f9c85[_0x21ae('0x30')],'type':_0x1f9c85['type']['key']};});_0x24b27f['model']=_[_0x21ae('0x31')](_0x31b29c,'name');_0x24b27f['query']=_[_0x21ae('0x32')](_0x5db8a0[_0x21ae('0x33')]);_0x24b27f['filters']=_['intersection'](_0x24b27f[_0x21ae('0x34')],_0x24b27f[_0x21ae('0x33')]);_0x1f65e8[_0x21ae('0x35')]=_[_0x21ae('0x36')](_0x24b27f[_0x21ae('0x34')],qs[_0x21ae('0x37')](_0x5db8a0[_0x21ae('0x33')][_0x21ae('0x37')]));_0x1f65e8[_0x21ae('0x35')]=_0x1f65e8[_0x21ae('0x35')]['length']?_0x1f65e8[_0x21ae('0x35')]:_0x24b27f[_0x21ae('0x34')];if(!_0x5db8a0[_0x21ae('0x33')][_0x21ae('0x38')](_0x21ae('0x39'))){_0x1f65e8['limit']=qs['limit'](_0x5db8a0[_0x21ae('0x33')][_0x21ae('0x1f')]);_0x1f65e8[_0x21ae('0x1e')]=qs[_0x21ae('0x1e')](_0x5db8a0['query'][_0x21ae('0x1e')]);}_0x1f65e8[_0x21ae('0x3a')]=qs[_0x21ae('0x3b')](_0x5db8a0['query'][_0x21ae('0x3b')]);_0x1f65e8[_0x21ae('0x3c')]=qs['filters'](_['pick'](_0x5db8a0[_0x21ae('0x33')],_0x24b27f[_0x21ae('0x3d')]),_0x31b29c);if(_0x5db8a0[_0x21ae('0x33')][_0x21ae('0x3e')]){_0x1f65e8['where']=_[_0x21ae('0x3f')](_0x1f65e8[_0x21ae('0x3c')],{'$or':_[_0x21ae('0x31')](_0x31b29c,function(_0x445e82){if(_0x445e82[_0x21ae('0x40')]!==_0x21ae('0x41')){var _0x6b7a92={};_0x6b7a92[_0x445e82[_0x21ae('0x2b')]]={'$like':'%'+_0x5db8a0[_0x21ae('0x33')][_0x21ae('0x3e')]+'%'};return _0x6b7a92;}})});}_0x1f65e8=_['merge']({},_0x1f65e8,_0x5db8a0[_0x21ae('0x42')]);var _0xd5b5bd={'where':_0x1f65e8[_0x21ae('0x3c')]};return db['WhatsappQueue']['count'](_0xd5b5bd)[_0x21ae('0x29')](function(_0x2ff4e8){_0x8451ee[_0x21ae('0x43')]=_0x2ff4e8;if(_0x5db8a0[_0x21ae('0x33')][_0x21ae('0x44')]){_0x1f65e8[_0x21ae('0x45')]=[{'all':!![]}];}return db[_0x21ae('0x2e')][_0x21ae('0x46')](_0x1f65e8);})[_0x21ae('0x29')](function(_0xece6a1){_0x8451ee[_0x21ae('0x47')]=_0xece6a1;return _0x8451ee;})[_0x21ae('0x29')](respondWithFilteredResult(_0x1b4d0e,_0x1f65e8))[_0x21ae('0x48')](handleError(_0x1b4d0e,null));};exports[_0x21ae('0x49')]=function(_0x40f633,_0x1abdc7){var _0x143670={'raw':!![],'where':{'id':_0x40f633['params']['id']}},_0x6f9b84={};_0x6f9b84[_0x21ae('0x34')]=_[_0x21ae('0x32')](db[_0x21ae('0x2e')][_0x21ae('0x2f')]);_0x6f9b84[_0x21ae('0x33')]=_['keys'](_0x40f633[_0x21ae('0x33')]);_0x6f9b84[_0x21ae('0x3d')]=_[_0x21ae('0x36')](_0x6f9b84[_0x21ae('0x34')],_0x6f9b84['query']);_0x143670['attributes']=_[_0x21ae('0x36')](_0x6f9b84[_0x21ae('0x34')],qs[_0x21ae('0x37')](_0x40f633[_0x21ae('0x33')][_0x21ae('0x37')]));_0x143670[_0x21ae('0x35')]=_0x143670[_0x21ae('0x35')]['length']?_0x143670['attributes']:_0x6f9b84[_0x21ae('0x34')];if(_0x40f633[_0x21ae('0x33')]['includeAll']){_0x143670[_0x21ae('0x45')]=[{'all':!![]}];}_0x143670=_[_0x21ae('0x3f')]({},_0x143670,_0x40f633[_0x21ae('0x42')]);return db[_0x21ae('0x2e')][_0x21ae('0x4a')](_0x143670)[_0x21ae('0x29')](handleEntityNotFound(_0x1abdc7,null))[_0x21ae('0x29')](respondWithResult(_0x1abdc7,null))['catch'](handleError(_0x1abdc7,null));};exports[_0x21ae('0x4b')]=function(_0x4a46d2,_0x1921b5){return db[_0x21ae('0x2e')][_0x21ae('0x4b')](_0x4a46d2[_0x21ae('0x4c')],{})[_0x21ae('0x29')](function(_0x3f6d5b){var _0x255a0d=_0x4a46d2[_0x21ae('0x4d')][_0x21ae('0x27')]({'plain':!![]});if(!_0x255a0d)throw new Error(_0x21ae('0x4e'));if(_0x255a0d['role']===_0x21ae('0x4d')){var _0x3d24ad=_0x3f6d5b['get']({'plain':!![]});var _0x2d457c=_0x21ae('0x4f');return db[_0x21ae('0x50')][_0x21ae('0x4a')]({'where':{'name':_0x2d457c,'userProfileId':_0x255a0d[_0x21ae('0x51')]},'raw':!![]})['then'](function(_0x13a203){if(_0x13a203&&_0x13a203[_0x21ae('0x52')]===0x0){return db['UserProfileResource'][_0x21ae('0x4b')]({'name':_0x3d24ad[_0x21ae('0x2b')],'resourceId':_0x3d24ad['id'],'type':_0x13a203[_0x21ae('0x2b')],'sectionId':_0x13a203['id']},{})[_0x21ae('0x29')](function(){return _0x3f6d5b;});}else{return _0x3f6d5b;}})[_0x21ae('0x48')](function(_0x4b7bde){logger[_0x21ae('0x2a')](_0x21ae('0x53'),_0x4b7bde);throw _0x4b7bde;});}return _0x3f6d5b;})[_0x21ae('0x29')](respondWithResult(_0x1921b5,0xc9))['catch'](handleError(_0x1921b5,null));};exports['update']=function(_0x52b244,_0x2c096a){if(_0x52b244[_0x21ae('0x4c')]['id']){delete _0x52b244['body']['id'];}return db[_0x21ae('0x2e')][_0x21ae('0x4a')]({'where':{'id':_0x52b244['params']['id']}})[_0x21ae('0x29')](handleEntityNotFound(_0x2c096a,null))['then'](saveUpdates(_0x52b244['body'],null))[_0x21ae('0x29')](respondWithResult(_0x2c096a,null))[_0x21ae('0x48')](handleError(_0x2c096a,null));};exports[_0x21ae('0x26')]=function(_0x1d85f6,_0x859589){return db[_0x21ae('0x2e')][_0x21ae('0x4a')]({'where':{'id':_0x1d85f6['params']['id']}})[_0x21ae('0x29')](handleEntityNotFound(_0x859589,null))[_0x21ae('0x29')](removeEntity(_0x859589,null))[_0x21ae('0x48')](handleError(_0x859589,null));};exports['describe']=function(_0x2cf471,_0x3d11e9){return db['WhatsappQueue'][_0x21ae('0x54')]()[_0x21ae('0x29')](respondWithResult(_0x3d11e9,null))[_0x21ae('0x48')](handleError(_0x3d11e9,null));};exports['getMembers']=function(_0x2fec8d,_0x16afb0,_0x4a3f21){var _0x4964aa={'raw':!![],'where':{}},_0x14ed8e={},_0x552689;return db[_0x21ae('0x2e')][_0x21ae('0x55')]({'where':{'id':_0x2fec8d[_0x21ae('0x56')]['id']}})[_0x21ae('0x29')](handleEntityNotFound(_0x16afb0,null))[_0x21ae('0x29')](function(_0x2ffed0){if(_0x2ffed0){_0x552689=_0x2ffed0[_0x21ae('0x27')]({'plain':!![]});_0x14ed8e[_0x21ae('0x34')]=_[_0x21ae('0x32')](db[_0x21ae('0x57')]['rawAttributes']);_0x14ed8e[_0x21ae('0x33')]=_[_0x21ae('0x32')](_0x2fec8d['query']);_0x14ed8e[_0x21ae('0x3d')]=_[_0x21ae('0x36')](_0x14ed8e[_0x21ae('0x34')],_0x14ed8e[_0x21ae('0x33')]);_0x4964aa[_0x21ae('0x35')]=_['intersection'](_0x14ed8e['model'],qs['fields'](_0x2fec8d[_0x21ae('0x33')][_0x21ae('0x37')]));_0x4964aa[_0x21ae('0x35')]=_0x4964aa[_0x21ae('0x35')][_0x21ae('0x58')]?_0x4964aa[_0x21ae('0x35')]:_0x14ed8e[_0x21ae('0x34')];if(!_0x2fec8d[_0x21ae('0x33')][_0x21ae('0x38')](_0x21ae('0x39'))){_0x4964aa['limit']=qs[_0x21ae('0x1f')](_0x2fec8d[_0x21ae('0x33')][_0x21ae('0x1f')]);_0x4964aa[_0x21ae('0x1e')]=qs[_0x21ae('0x1e')](_0x2fec8d[_0x21ae('0x33')][_0x21ae('0x1e')]);}_0x4964aa[_0x21ae('0x3a')]=qs[_0x21ae('0x3b')](_0x2fec8d[_0x21ae('0x33')]['sort']);_0x4964aa[_0x21ae('0x3c')]=qs[_0x21ae('0x3d')](_[_0x21ae('0x59')](_0x2fec8d[_0x21ae('0x33')],_0x14ed8e['filters']));_0x4964aa[_0x21ae('0x3c')][_0x21ae('0x5a')]=_0x2ffed0['id'];if(_0x2fec8d[_0x21ae('0x33')][_0x21ae('0x3e')]){_0x4964aa[_0x21ae('0x3c')]=_[_0x21ae('0x3f')](_0x4964aa[_0x21ae('0x3c')],{'$or':_[_0x21ae('0x31')](_0x4964aa['attributes'],function(_0xb71a94){var _0x2b219b={};_0x2b219b[_0xb71a94]={'$like':'%'+_0x2fec8d[_0x21ae('0x33')][_0x21ae('0x3e')]+'%'};return _0x2b219b;})});}_0x4964aa=_[_0x21ae('0x3f')]({},_0x4964aa,_0x2fec8d[_0x21ae('0x42')]);return db[_0x21ae('0x57')][_0x21ae('0x46')](_0x4964aa);}})[_0x21ae('0x29')](function(_0x52a34b){if(_0x52a34b){return db[_0x21ae('0x5b')]['findAndCountAll']({'where':{'id':_[_0x21ae('0x31')](_0x52a34b,'UserId'),'role':'agent'},'attributes':['id','name',_0x21ae('0x5c'),_0x21ae('0x5d'),_0x21ae('0x5e')]});}})[_0x21ae('0x29')](function(_0x4a7739){if(_0x4a7739){return{'count':_0x4a7739['count'],'rows':_['map'](_0x4a7739[_0x21ae('0x47')],function(_0x592289){return{'membername':_0x592289[_0x21ae('0x2b')],'UserId':_0x592289['id'],'queue_name':_0x552689[_0x21ae('0x2b')],'WhatsappQueueId':_0x552689['id'],'interface':util[_0x21ae('0x5f')](_0x21ae('0x60'),_0x21ae('0x61'),_0x592289['name']),'penalty':0x0,'paused':_0x592289[_0x21ae('0x5c')],'createdAt':_0x592289[_0x21ae('0x5e')],'updatedAt':_0x592289[_0x21ae('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x21ae('0x29')](respondWithFilteredResult(_0x16afb0,_0x4964aa))[_0x21ae('0x48')](handleError(_0x16afb0,null));};exports[_0x21ae('0x62')]=function(_0x346e2a,_0x11a19d,_0x42b485){var _0x4dd6c5={};var _0x1b8744={};var _0x2c9c11;var _0x31aeaf;return db[_0x21ae('0x2e')][_0x21ae('0x55')]({'where':{'id':_0x346e2a[_0x21ae('0x56')]['id']}})[_0x21ae('0x29')](handleEntityNotFound(_0x11a19d,null))[_0x21ae('0x29')](function(_0x2688d3){if(_0x2688d3){_0x2c9c11=_0x2688d3;_0x1b8744[_0x21ae('0x34')]=_[_0x21ae('0x32')](db['Team'][_0x21ae('0x2f')]);_0x1b8744[_0x21ae('0x33')]=_[_0x21ae('0x32')](_0x346e2a[_0x21ae('0x33')]);_0x1b8744[_0x21ae('0x3d')]=_[_0x21ae('0x36')](_0x1b8744[_0x21ae('0x34')],_0x1b8744['query']);_0x4dd6c5[_0x21ae('0x35')]=_[_0x21ae('0x36')](_0x1b8744['model'],qs[_0x21ae('0x37')](_0x346e2a[_0x21ae('0x33')]['fields']));_0x4dd6c5[_0x21ae('0x35')]=_0x4dd6c5['attributes'][_0x21ae('0x58')]?_0x4dd6c5[_0x21ae('0x35')]:_0x1b8744[_0x21ae('0x34')];_0x4dd6c5[_0x21ae('0x3a')]=qs['sort'](_0x346e2a['query'][_0x21ae('0x3b')]);_0x4dd6c5[_0x21ae('0x3c')]=qs[_0x21ae('0x3d')](_[_0x21ae('0x59')](_0x346e2a['query'],_0x1b8744[_0x21ae('0x3d')]));if(_0x346e2a[_0x21ae('0x33')]['filter']){_0x4dd6c5['where']=_[_0x21ae('0x3f')](_0x4dd6c5[_0x21ae('0x3c')],{'$or':_[_0x21ae('0x31')](_0x4dd6c5[_0x21ae('0x35')],function(_0xc5dc4c){var _0x2c0217={};_0x2c0217[_0xc5dc4c]={'$like':'%'+_0x346e2a[_0x21ae('0x33')][_0x21ae('0x3e')]+'%'};return _0x2c0217;})});}_0x4dd6c5=_[_0x21ae('0x3f')]({},_0x4dd6c5,_0x346e2a[_0x21ae('0x42')]);return _0x2c9c11[_0x21ae('0x62')](_0x4dd6c5);}})['then'](function(_0x4ee541){if(_0x4ee541){_0x31aeaf=_0x4ee541[_0x21ae('0x58')];if(!_0x346e2a[_0x21ae('0x33')][_0x21ae('0x38')]('nolimit')){_0x4dd6c5[_0x21ae('0x1f')]=qs[_0x21ae('0x1f')](_0x346e2a[_0x21ae('0x33')][_0x21ae('0x1f')]);_0x4dd6c5[_0x21ae('0x1e')]=qs[_0x21ae('0x1e')](_0x346e2a[_0x21ae('0x33')]['offset']);}return _0x2c9c11[_0x21ae('0x62')](_0x4dd6c5);}})[_0x21ae('0x29')](function(_0x1567d2){if(_0x1567d2){return _0x1567d2?{'count':_0x31aeaf,'rows':_0x1567d2}:null;}})[_0x21ae('0x29')](respondWithResult(_0x11a19d,null))['catch'](handleError(_0x11a19d,null));};exports[_0x21ae('0x63')]=function(_0xf72be4,_0x5aaef3,_0xde47dc){var _0xb3feea=_0xf72be4[_0x21ae('0x4c')][_0x21ae('0x64')];return db['Team'][_0x21ae('0x46')]({'where':{'id':_0xb3feea},'attributes':['id'],'include':[{'model':db[_0x21ae('0x5b')],'as':_0x21ae('0x65'),'attributes':['id',_0x21ae('0x2b'),_0x21ae('0x66'),_0x21ae('0x67'),'interface'],'raw':!![]}]})[_0x21ae('0x29')](function(_0x26b4b4){if(_0x26b4b4){var _0x29d090=_['flatMap'](_0x26b4b4,function(_0x9ebdfb){var _0xe41481=_0x9ebdfb[_0x21ae('0x27')]({'plain':!![]});return _0xe41481[_0x21ae('0x65')];});return db['WhatsappQueue']['find']({'where':{'id':_0xf72be4['params']['id']}})[_0x21ae('0x29')](function(_0x3a3d7a){return db[_0x21ae('0x68')][_0x21ae('0x69')](function(_0x2073a5){return _0x3a3d7a[_0x21ae('0x63')](_0xb3feea,{'transaction':_0x2073a5})[_0x21ae('0x29')](function(){return BPromise['each'](_0x29d090,function(_0x56d286){return db[_0x21ae('0x57')][_0x21ae('0x6a')]({'where':{'UserId':_0x56d286['id'],'WhatsappQueueId':_0xf72be4[_0x21ae('0x56')]['id']},'transaction':_0x2073a5});});})[_0x21ae('0x29')](function(){_0x29d090[_0x21ae('0x6b')](function(_0x18c269){socket[_0x21ae('0x6c')](_0x21ae('0x6d'),{'UserId':_0x18c269['id'],'WhatsappQueueId':_0x3a3d7a['id']});});});});});}})['then'](respondWithStatusCode(_0x5aaef3,null))[_0x21ae('0x48')](handleError(_0x5aaef3,null));};exports[_0x21ae('0x6e')]=function(_0x3b6966,_0x366504,_0x4cb792){return db[_0x21ae('0x6f')]['findAll']({'where':{'id':_0x3b6966[_0x21ae('0x33')][_0x21ae('0x64')]},'attributes':['id'],'include':[{'model':db[_0x21ae('0x5b')],'as':_0x21ae('0x65'),'attributes':['id'],'raw':!![]}]})[_0x21ae('0x29')](handleEntityNotFound(_0x366504,null))[_0x21ae('0x29')](function(_0x21d70e){var _0x112fff=_[_0x21ae('0x31')](_0x21d70e,'id');var _0x4b52de=[];var _0x2fed23=[];var _0x55ac4a=squel['select']();_0x55ac4a[_0x21ae('0x70')](_0x21ae('0x71'))[_0x21ae('0x72')](_0x21ae('0x73'),'tq')['join'](_0x21ae('0x74'),'ut',_0x21ae('0x75'))['where'](_0x21ae('0x76'),_0x3b6966[_0x21ae('0x56')]['id']);for(var _0xb8e78=0x0;_0xb8e78<_0x21d70e['length'];_0xb8e78+=0x1){let _0x32e66e=_0x21d70e[_0xb8e78];for(var _0x550813=0x0;_0x550813<_0x32e66e['Agents'][_0x21ae('0x58')];_0x550813+=0x1){let _0x4a60e4=_0x32e66e[_0x21ae('0x65')][_0x550813];var _0x4c6fa7=_0x55ac4a['clone']();_0x4c6fa7[_0x21ae('0x3c')](_0x21ae('0x77'),_0x4a60e4['id']);_0x2fed23['push'](db['sequelize'][_0x21ae('0x33')](_0x4c6fa7[_0x21ae('0x78')](),{'type':db[_0x21ae('0x68')]['QueryTypes'][_0x21ae('0x79')]})[_0x21ae('0x29')](function(_0x26bf99){if(_0x26bf99[_0x21ae('0x58')]===0x1){return _0x4a60e4['id'];}else{var _0x366d48=_['every'](_[_0x21ae('0x31')](_0x26bf99,'TeamId'),function(_0x4ee6c3){return _[_0x21ae('0x7a')](_0x112fff,_0x4ee6c3);});if(_0x366d48){return _0x4a60e4['id'];}}}));}}return BPromise[_0x21ae('0x7b')](_0x2fed23)[_0x21ae('0x29')](function(_0x36cfe6){_0x4b52de=_(_0x4b52de)['union'](_0x36cfe6)['compact']()[_0x21ae('0x7c')]();return db['WhatsappQueue'][_0x21ae('0x4a')]({'where':{'id':_0x3b6966['params']['id']}})[_0x21ae('0x29')](function(_0x4cf286){return db[_0x21ae('0x68')][_0x21ae('0x69')](function(_0x43f909){return _0x4cf286[_0x21ae('0x6e')](_0x3b6966[_0x21ae('0x33')][_0x21ae('0x64')],{'transaction':_0x43f909})[_0x21ae('0x29')](function(){if(!_['isEmpty'](_0x4b52de)){return _0x4cf286[_0x21ae('0x7d')](_0x4b52de,{'transaction':_0x43f909});}})['then'](function(){_0x4b52de[_0x21ae('0x6b')](function(_0x16aeff){socket[_0x21ae('0x6c')]('userWhatsappQueue:remove',{'UserId':_0x16aeff,'WhatsappQueueId':_0x4cf286['id']});});});});});});})[_0x21ae('0x29')](respondWithStatusCode(_0x366504,null))[_0x21ae('0x48')](handleError(_0x366504,null));};exports[_0x21ae('0x7e')]=function(_0x1b3092,_0xedb0e6,_0x46de90){return db[_0x21ae('0x2e')][_0x21ae('0x4a')]({'where':{'id':_0x1b3092[_0x21ae('0x56')]['id']}})[_0x21ae('0x29')](handleEntityNotFound(_0xedb0e6,null))[_0x21ae('0x29')](function(_0x5ab1d1){if(_0x5ab1d1){return _0x5ab1d1['addAgents'](_0x1b3092[_0x21ae('0x4c')][_0x21ae('0x64')],_[_0x21ae('0x7f')](_0x1b3092['body'],[_0x21ae('0x64'),'id'])||{})['spread'](function(_0x3cc247){for(var _0x5489d4=0x0;_0x5489d4<_0x1b3092['body'][_0x21ae('0x64')]['length'];_0x5489d4+=0x1){socket['emit'](_0x21ae('0x6d'),{'UserId':_0x1b3092[_0x21ae('0x4c')]['ids'][_0x5489d4],'WhatsappQueueId':_0x1b3092['params']['id']});}return _0x3cc247;});}})[_0x21ae('0x29')](respondWithResult(_0xedb0e6,null))[_0x21ae('0x48')](handleError(_0xedb0e6,null));};exports[_0x21ae('0x7d')]=function(_0x1530a9,_0x981bc9,_0x2f9fb4){return db[_0x21ae('0x2e')][_0x21ae('0x4a')]({'where':{'id':_0x1530a9[_0x21ae('0x56')]['id']}})['then'](handleEntityNotFound(_0x981bc9,null))[_0x21ae('0x29')](function(_0x330089){if(_0x330089){return _0x330089[_0x21ae('0x7d')](_0x1530a9[_0x21ae('0x33')][_0x21ae('0x64')])[_0x21ae('0x29')](function(){if(_['isArray'](_0x1530a9['query'][_0x21ae('0x64')])){for(var _0x5c175e=0x0;_0x5c175e<_0x1530a9[_0x21ae('0x33')][_0x21ae('0x64')][_0x21ae('0x58')];_0x5c175e+=0x1){socket[_0x21ae('0x6c')](_0x21ae('0x80'),{'UserId':Number(_0x1530a9[_0x21ae('0x33')][_0x21ae('0x64')][_0x5c175e]),'WhatsappQueueId':Number(_0x1530a9[_0x21ae('0x56')]['id'])});}}else{socket[_0x21ae('0x6c')](_0x21ae('0x80'),{'UserId':Number(_0x1530a9['query']['ids']),'WhatsappQueueId':Number(_0x1530a9[_0x21ae('0x56')]['id'])});}});}})[_0x21ae('0x29')](respondWithStatusCode(_0x981bc9,null))[_0x21ae('0x48')](handleError(_0x981bc9,null));};exports[_0x21ae('0x81')]=function(_0x272e2f,_0x29c2f8,_0x37a677){var _0x1166df={};var _0x30f162={};var _0x2684b1;var _0x31656e;return db[_0x21ae('0x2e')]['findOne']({'where':{'id':_0x272e2f[_0x21ae('0x56')]['id']}})[_0x21ae('0x29')](handleEntityNotFound(_0x29c2f8,null))['then'](function(_0x17131e){if(_0x17131e){_0x2684b1=_0x17131e;_0x30f162[_0x21ae('0x34')]=_['keys'](db[_0x21ae('0x5b')][_0x21ae('0x2f')]);_0x30f162[_0x21ae('0x33')]=_['keys'](_0x272e2f['query']);_0x30f162[_0x21ae('0x3d')]=_[_0x21ae('0x36')](_0x30f162['model'],_0x30f162[_0x21ae('0x33')]);_0x1166df[_0x21ae('0x35')]=_[_0x21ae('0x36')](_0x30f162[_0x21ae('0x34')],qs[_0x21ae('0x37')](_0x272e2f[_0x21ae('0x33')][_0x21ae('0x37')]));_0x1166df[_0x21ae('0x35')]=_0x1166df[_0x21ae('0x35')][_0x21ae('0x58')]?_0x1166df['attributes']:_0x30f162[_0x21ae('0x34')];_0x1166df[_0x21ae('0x3a')]=qs['sort'](_0x272e2f['query']['sort']);_0x1166df[_0x21ae('0x3c')]=qs[_0x21ae('0x3d')](_['pick'](_0x272e2f[_0x21ae('0x33')],_0x30f162[_0x21ae('0x3d')]));if(_0x272e2f[_0x21ae('0x33')][_0x21ae('0x3e')]){_0x1166df[_0x21ae('0x3c')]=_[_0x21ae('0x3f')](_0x1166df[_0x21ae('0x3c')],{'$or':_['map'](_0x1166df['attributes'],function(_0x1efb6d){var _0x5d8ef0={};_0x5d8ef0[_0x1efb6d]={'$like':'%'+_0x272e2f['query'][_0x21ae('0x3e')]+'%'};return _0x5d8ef0;})});}_0x1166df=_[_0x21ae('0x3f')]({},_0x1166df,_0x272e2f['options']);return _0x2684b1[_0x21ae('0x81')](_0x1166df);}})[_0x21ae('0x29')](function(_0x3ea22f){if(_0x3ea22f){_0x31656e=_0x3ea22f[_0x21ae('0x58')];if(!_0x272e2f[_0x21ae('0x33')][_0x21ae('0x38')](_0x21ae('0x39'))){_0x1166df[_0x21ae('0x1f')]=qs[_0x21ae('0x1f')](_0x272e2f[_0x21ae('0x33')]['limit']);_0x1166df[_0x21ae('0x1e')]=qs[_0x21ae('0x1e')](_0x272e2f[_0x21ae('0x33')][_0x21ae('0x1e')]);}return _0x2684b1[_0x21ae('0x81')](_0x1166df);}})[_0x21ae('0x29')](function(_0x1e8835){if(_0x1e8835){return _0x1e8835?{'count':_0x31656e,'rows':_0x1e8835}:null;}})[_0x21ae('0x29')](respondWithResult(_0x29c2f8,null))['catch'](handleError(_0x29c2f8,null));}; \ No newline at end of file +var _0x20a8=['findOne','pick','WhatsappQueueId','UserWhatsappQueue','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','ids','voicePause','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','compact','value','transaction','removeAgents','userWhatsappQueue:remove','omit','userWhatsappQueue:save','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers'];(function(_0x5892fe,_0x3d513d){var _0x45be5e=function(_0x23a03d){while(--_0x23a03d){_0x5892fe['push'](_0x5892fe['shift']());}};_0x45be5e(++_0x3d513d);}(_0x20a8,0xb7));var _0x820a=function(_0x434feb,_0x60b45c){_0x434feb=_0x434feb-0x0;var _0x40a567=_0x20a8[_0x434feb];return _0x40a567;};'use strict';var pdf=require(_0x820a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x820a('0x1'));var jsonpatch=require(_0x820a('0x2'));var rp=require('request-promise');var moment=require(_0x820a('0x3'));var BPromise=require(_0x820a('0x4'));var Mustache=require(_0x820a('0x5'));var util=require(_0x820a('0x6'));var path=require(_0x820a('0x7'));var sox=require('sox');var csv=require(_0x820a('0x8'));var ejs=require(_0x820a('0x9'));var fs=require('fs');var _=require(_0x820a('0xa'));var squel=require(_0x820a('0xb'));var crypto=require(_0x820a('0xc'));var jsforce=require(_0x820a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x820a('0xe'));var Papa=require('papaparse');var Redis=require(_0x820a('0xf'));var authService=require(_0x820a('0x10'));var qs=require(_0x820a('0x11'));var as=require(_0x820a('0x12'));var hardwareService=require(_0x820a('0x13'));var logger=require('../../config/logger')(_0x820a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x820a('0x15'))['db'];config[_0x820a('0x16')]=_['defaults'](config['redis'],{'host':_0x820a('0x17'),'port':0x18eb});var socket=require(_0x820a('0x18'))(new Redis(config[_0x820a('0x16')]));require('./whatsappQueue.socket')[_0x820a('0x19')](socket);function respondWithStatusCode(_0x445289,_0x55544f){_0x55544f=_0x55544f||0xcc;return function(_0x20f3b2){if(_0x20f3b2){return _0x445289[_0x820a('0x1a')](_0x55544f);}return _0x445289[_0x820a('0x1b')](_0x55544f)[_0x820a('0x1c')]();};}function respondWithResult(_0x37b59c,_0x3d5e2c){_0x3d5e2c=_0x3d5e2c||0xc8;return function(_0x346f58){if(_0x346f58){return _0x37b59c[_0x820a('0x1b')](_0x3d5e2c)[_0x820a('0x1d')](_0x346f58);}};}function respondWithFilteredResult(_0x288194,_0x10b01f){return function(_0x33efcb){if(_0x33efcb){var _0x4dbd7c=_0x33efcb[_0x820a('0x1e')],_0x444dff=_0x10b01f[_0x820a('0x1f')],_0x8abc28=_0x10b01f['offset']+_0x10b01f['limit'],_0x3347df;if(_0x8abc28>=_0x4dbd7c){_0x8abc28=_0x4dbd7c;_0x3347df=0xc8;}else{_0x3347df=0xce;}_0x288194[_0x820a('0x1b')](_0x3347df);return _0x288194[_0x820a('0x20')](_0x820a('0x21'),_0x444dff+'-'+_0x8abc28+'/'+_0x4dbd7c)[_0x820a('0x1d')](_0x33efcb);}return null;};}function patchUpdates(_0x4be55b){return function(_0x167fc6){try{jsonpatch[_0x820a('0x22')](_0x167fc6,_0x4be55b,!![]);}catch(_0x34b3ee){return BPromise[_0x820a('0x23')](_0x34b3ee);}return _0x167fc6[_0x820a('0x24')]();};}function saveUpdates(_0x304f6c,_0x5754ef){return function(_0x48c67b){if(_0x48c67b){return _0x48c67b[_0x820a('0x25')](_0x304f6c)[_0x820a('0x26')](function(_0x4a9e42){return _0x4a9e42;});}return null;};}function removeEntity(_0x33c5d3,_0x2d1b87){return function(_0x2a61a5){if(_0x2a61a5){return _0x2a61a5['destroy']()[_0x820a('0x26')](function(){var _0x24bbd2=_0x2a61a5[_0x820a('0x27')]({'plain':!![]});var _0x5b48de=_0x820a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5b48de,'resourceId':_0x24bbd2['id']}})['then'](function(){return _0x2a61a5;});})[_0x820a('0x26')](function(){_0x33c5d3[_0x820a('0x1b')](0xcc)[_0x820a('0x1c')]();});}};}function handleEntityNotFound(_0x434c72,_0x3c6439){return function(_0x2e84f7){if(!_0x2e84f7){_0x434c72[_0x820a('0x1a')](0x194);}return _0x2e84f7;};}function handleError(_0x53dcb1,_0x393af7){_0x393af7=_0x393af7||0x1f4;return function(_0x43d40f){logger[_0x820a('0x29')](_0x43d40f[_0x820a('0x2a')]);if(_0x43d40f[_0x820a('0x2b')]){delete _0x43d40f[_0x820a('0x2b')];}_0x53dcb1['status'](_0x393af7)[_0x820a('0x2c')](_0x43d40f);};}exports[_0x820a('0x2d')]=function(_0x4c587a,_0x62a74a){var _0x203875={},_0x5a0f93={},_0x325df9={'count':0x0,'rows':[]};var _0x55a9be=_[_0x820a('0x2e')](db[_0x820a('0x2f')][_0x820a('0x30')],function(_0x59c3d4){return{'name':_0x59c3d4[_0x820a('0x31')],'type':_0x59c3d4[_0x820a('0x32')]['key']};});_0x5a0f93[_0x820a('0x33')]=_[_0x820a('0x2e')](_0x55a9be,_0x820a('0x2b'));_0x5a0f93['query']=_[_0x820a('0x34')](_0x4c587a['query']);_0x5a0f93[_0x820a('0x35')]=_[_0x820a('0x36')](_0x5a0f93[_0x820a('0x33')],_0x5a0f93[_0x820a('0x37')]);_0x203875['attributes']=_[_0x820a('0x36')](_0x5a0f93[_0x820a('0x33')],qs['fields'](_0x4c587a[_0x820a('0x37')]['fields']));_0x203875[_0x820a('0x38')]=_0x203875[_0x820a('0x38')][_0x820a('0x39')]?_0x203875[_0x820a('0x38')]:_0x5a0f93[_0x820a('0x33')];if(!_0x4c587a[_0x820a('0x37')][_0x820a('0x3a')](_0x820a('0x3b'))){_0x203875['limit']=qs[_0x820a('0x3c')](_0x4c587a['query'][_0x820a('0x3c')]);_0x203875[_0x820a('0x1f')]=qs[_0x820a('0x1f')](_0x4c587a[_0x820a('0x37')][_0x820a('0x1f')]);}_0x203875[_0x820a('0x3d')]=qs[_0x820a('0x3e')](_0x4c587a[_0x820a('0x37')][_0x820a('0x3e')]);_0x203875['where']=qs['filters'](_['pick'](_0x4c587a[_0x820a('0x37')],_0x5a0f93['filters']),_0x55a9be);if(_0x4c587a[_0x820a('0x37')][_0x820a('0x3f')]){_0x203875['where']=_[_0x820a('0x40')](_0x203875[_0x820a('0x41')],{'$or':_[_0x820a('0x2e')](_0x55a9be,function(_0x4a7209){if(_0x4a7209[_0x820a('0x32')]!==_0x820a('0x42')){var _0x39f202={};_0x39f202[_0x4a7209['name']]={'$like':'%'+_0x4c587a[_0x820a('0x37')][_0x820a('0x3f')]+'%'};return _0x39f202;}})});}_0x203875=_[_0x820a('0x40')]({},_0x203875,_0x4c587a[_0x820a('0x43')]);var _0x4cf9ad={'where':_0x203875[_0x820a('0x41')]};return db[_0x820a('0x2f')][_0x820a('0x1e')](_0x4cf9ad)['then'](function(_0x412d05){_0x325df9['count']=_0x412d05;if(_0x4c587a[_0x820a('0x37')][_0x820a('0x44')]){_0x203875['include']=[{'all':!![]}];}return db[_0x820a('0x2f')][_0x820a('0x45')](_0x203875);})['then'](function(_0x5cb95e){_0x325df9[_0x820a('0x46')]=_0x5cb95e;return _0x325df9;})[_0x820a('0x26')](respondWithFilteredResult(_0x62a74a,_0x203875))[_0x820a('0x47')](handleError(_0x62a74a,null));};exports[_0x820a('0x48')]=function(_0x403321,_0x10d900){var _0x5615d2={'raw':!![],'where':{'id':_0x403321[_0x820a('0x49')]['id']}},_0x28832c={};_0x28832c['model']=_['keys'](db[_0x820a('0x2f')]['rawAttributes']);_0x28832c[_0x820a('0x37')]=_[_0x820a('0x34')](_0x403321[_0x820a('0x37')]);_0x28832c[_0x820a('0x35')]=_[_0x820a('0x36')](_0x28832c[_0x820a('0x33')],_0x28832c[_0x820a('0x37')]);_0x5615d2[_0x820a('0x38')]=_[_0x820a('0x36')](_0x28832c['model'],qs[_0x820a('0x4a')](_0x403321[_0x820a('0x37')]['fields']));_0x5615d2[_0x820a('0x38')]=_0x5615d2[_0x820a('0x38')][_0x820a('0x39')]?_0x5615d2[_0x820a('0x38')]:_0x28832c['model'];if(_0x403321[_0x820a('0x37')][_0x820a('0x44')]){_0x5615d2[_0x820a('0x4b')]=[{'all':!![]}];}_0x5615d2=_[_0x820a('0x40')]({},_0x5615d2,_0x403321[_0x820a('0x43')]);return db['WhatsappQueue'][_0x820a('0x4c')](_0x5615d2)['then'](handleEntityNotFound(_0x10d900,null))[_0x820a('0x26')](respondWithResult(_0x10d900,null))[_0x820a('0x47')](handleError(_0x10d900,null));};exports[_0x820a('0x4d')]=function(_0x385856,_0x83f769){return db[_0x820a('0x2f')][_0x820a('0x4d')](_0x385856[_0x820a('0x4e')],{})[_0x820a('0x26')](function(_0x480561){var _0x3c0d0b=_0x385856[_0x820a('0x4f')]['get']({'plain':!![]});if(!_0x3c0d0b)throw new Error(_0x820a('0x50'));if(_0x3c0d0b['role']===_0x820a('0x4f')){var _0x38969b=_0x480561[_0x820a('0x27')]({'plain':!![]});var _0x55075d=_0x820a('0x28');return db[_0x820a('0x51')][_0x820a('0x4c')]({'where':{'name':_0x55075d,'userProfileId':_0x3c0d0b[_0x820a('0x52')]},'raw':!![]})['then'](function(_0x133fca){if(_0x133fca&&_0x133fca[_0x820a('0x53')]===0x0){return db[_0x820a('0x54')][_0x820a('0x4d')]({'name':_0x38969b['name'],'resourceId':_0x38969b['id'],'type':_0x133fca[_0x820a('0x2b')],'sectionId':_0x133fca['id']},{})[_0x820a('0x26')](function(){return _0x480561;});}else{return _0x480561;}})[_0x820a('0x47')](function(_0x553ae3){logger[_0x820a('0x29')](_0x820a('0x55'),_0x553ae3);throw _0x553ae3;});}return _0x480561;})[_0x820a('0x26')](respondWithResult(_0x83f769,0xc9))[_0x820a('0x47')](handleError(_0x83f769,null));};exports['update']=function(_0x14cd1e,_0x5b5265){if(_0x14cd1e[_0x820a('0x4e')]['id']){delete _0x14cd1e[_0x820a('0x4e')]['id'];}return db[_0x820a('0x2f')][_0x820a('0x4c')]({'where':{'id':_0x14cd1e[_0x820a('0x49')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x5b5265,null))['then'](saveUpdates(_0x14cd1e[_0x820a('0x4e')],null))[_0x820a('0x26')](respondWithResult(_0x5b5265,null))['catch'](handleError(_0x5b5265,null));};exports[_0x820a('0x56')]=function(_0x302599,_0x52f8b6){return db[_0x820a('0x2f')]['find']({'where':{'id':_0x302599[_0x820a('0x49')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x52f8b6,null))[_0x820a('0x26')](removeEntity(_0x52f8b6,null))[_0x820a('0x47')](handleError(_0x52f8b6,null));};exports[_0x820a('0x57')]=function(_0x22ec7d,_0x525ee1){return db[_0x820a('0x2f')][_0x820a('0x57')]()[_0x820a('0x26')](respondWithResult(_0x525ee1,null))[_0x820a('0x47')](handleError(_0x525ee1,null));};exports[_0x820a('0x58')]=function(_0x2a7799,_0x5da899,_0x24e77f){var _0x4d4576={'raw':!![],'where':{}},_0x16b857={},_0x56bf31;return db[_0x820a('0x2f')][_0x820a('0x59')]({'where':{'id':_0x2a7799['params']['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x5da899,null))['then'](function(_0x2b02c4){if(_0x2b02c4){_0x56bf31=_0x2b02c4['get']({'plain':!![]});_0x16b857[_0x820a('0x33')]=_['keys'](db['UserWhatsappQueue'][_0x820a('0x30')]);_0x16b857[_0x820a('0x37')]=_['keys'](_0x2a7799[_0x820a('0x37')]);_0x16b857[_0x820a('0x35')]=_[_0x820a('0x36')](_0x16b857[_0x820a('0x33')],_0x16b857[_0x820a('0x37')]);_0x4d4576[_0x820a('0x38')]=_['intersection'](_0x16b857[_0x820a('0x33')],qs['fields'](_0x2a7799['query'][_0x820a('0x4a')]));_0x4d4576['attributes']=_0x4d4576[_0x820a('0x38')][_0x820a('0x39')]?_0x4d4576[_0x820a('0x38')]:_0x16b857['model'];if(!_0x2a7799[_0x820a('0x37')][_0x820a('0x3a')](_0x820a('0x3b'))){_0x4d4576[_0x820a('0x3c')]=qs[_0x820a('0x3c')](_0x2a7799[_0x820a('0x37')][_0x820a('0x3c')]);_0x4d4576[_0x820a('0x1f')]=qs['offset'](_0x2a7799[_0x820a('0x37')]['offset']);}_0x4d4576[_0x820a('0x3d')]=qs['sort'](_0x2a7799[_0x820a('0x37')][_0x820a('0x3e')]);_0x4d4576[_0x820a('0x41')]=qs[_0x820a('0x35')](_[_0x820a('0x5a')](_0x2a7799['query'],_0x16b857[_0x820a('0x35')]));_0x4d4576[_0x820a('0x41')][_0x820a('0x5b')]=_0x2b02c4['id'];if(_0x2a7799['query']['filter']){_0x4d4576[_0x820a('0x41')]=_[_0x820a('0x40')](_0x4d4576[_0x820a('0x41')],{'$or':_[_0x820a('0x2e')](_0x4d4576['attributes'],function(_0x3ff5e0){var _0x228a3a={};_0x228a3a[_0x3ff5e0]={'$like':'%'+_0x2a7799['query'][_0x820a('0x3f')]+'%'};return _0x228a3a;})});}_0x4d4576=_[_0x820a('0x40')]({},_0x4d4576,_0x2a7799['options']);return db[_0x820a('0x5c')]['findAll'](_0x4d4576);}})[_0x820a('0x26')](function(_0x19dd8f){if(_0x19dd8f){return db[_0x820a('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x19dd8f,_0x820a('0x5e')),'role':_0x820a('0x5f')},'attributes':['id',_0x820a('0x2b'),_0x820a('0x60'),_0x820a('0x61'),_0x820a('0x62')]});}})[_0x820a('0x26')](function(_0x33ca2a){if(_0x33ca2a){return{'count':_0x33ca2a['count'],'rows':_[_0x820a('0x2e')](_0x33ca2a['rows'],function(_0x409638){return{'membername':_0x409638['name'],'UserId':_0x409638['id'],'queue_name':_0x56bf31[_0x820a('0x2b')],'WhatsappQueueId':_0x56bf31['id'],'interface':util[_0x820a('0x63')]('%s/%s',_0x820a('0x64'),_0x409638[_0x820a('0x2b')]),'penalty':0x0,'paused':_0x409638[_0x820a('0x60')],'createdAt':_0x409638[_0x820a('0x62')],'updatedAt':_0x409638['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x820a('0x26')](respondWithFilteredResult(_0x5da899,_0x4d4576))['catch'](handleError(_0x5da899,null));};exports[_0x820a('0x65')]=function(_0x235713,_0x153768,_0x5e7e97){var _0x13a8da={};var _0x44d78a={};var _0x13d1c4;var _0x49ba9b;return db[_0x820a('0x2f')]['findOne']({'where':{'id':_0x235713['params']['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x153768,null))[_0x820a('0x26')](function(_0x56f4f5){if(_0x56f4f5){_0x13d1c4=_0x56f4f5;_0x44d78a[_0x820a('0x33')]=_[_0x820a('0x34')](db['Team'][_0x820a('0x30')]);_0x44d78a['query']=_[_0x820a('0x34')](_0x235713[_0x820a('0x37')]);_0x44d78a[_0x820a('0x35')]=_['intersection'](_0x44d78a[_0x820a('0x33')],_0x44d78a[_0x820a('0x37')]);_0x13a8da['attributes']=_[_0x820a('0x36')](_0x44d78a[_0x820a('0x33')],qs['fields'](_0x235713['query']['fields']));_0x13a8da['attributes']=_0x13a8da[_0x820a('0x38')][_0x820a('0x39')]?_0x13a8da[_0x820a('0x38')]:_0x44d78a[_0x820a('0x33')];_0x13a8da[_0x820a('0x3d')]=qs[_0x820a('0x3e')](_0x235713[_0x820a('0x37')]['sort']);_0x13a8da[_0x820a('0x41')]=qs['filters'](_[_0x820a('0x5a')](_0x235713[_0x820a('0x37')],_0x44d78a[_0x820a('0x35')]));if(_0x235713[_0x820a('0x37')][_0x820a('0x3f')]){_0x13a8da[_0x820a('0x41')]=_[_0x820a('0x40')](_0x13a8da[_0x820a('0x41')],{'$or':_[_0x820a('0x2e')](_0x13a8da[_0x820a('0x38')],function(_0x4e9b57){var _0x1fb841={};_0x1fb841[_0x4e9b57]={'$like':'%'+_0x235713[_0x820a('0x37')][_0x820a('0x3f')]+'%'};return _0x1fb841;})});}_0x13a8da=_[_0x820a('0x40')]({},_0x13a8da,_0x235713['options']);return _0x13d1c4[_0x820a('0x65')](_0x13a8da);}})[_0x820a('0x26')](function(_0xdc050){if(_0xdc050){_0x49ba9b=_0xdc050[_0x820a('0x39')];if(!_0x235713[_0x820a('0x37')][_0x820a('0x3a')](_0x820a('0x3b'))){_0x13a8da[_0x820a('0x3c')]=qs[_0x820a('0x3c')](_0x235713['query']['limit']);_0x13a8da['offset']=qs[_0x820a('0x1f')](_0x235713[_0x820a('0x37')][_0x820a('0x1f')]);}return _0x13d1c4['getTeams'](_0x13a8da);}})['then'](function(_0x4b8423){if(_0x4b8423){return _0x4b8423?{'count':_0x49ba9b,'rows':_0x4b8423}:null;}})['then'](respondWithResult(_0x153768,null))[_0x820a('0x47')](handleError(_0x153768,null));};exports['addTeams']=function(_0x5af083,_0x582eeb,_0x594882){var _0x3ea649=_0x5af083[_0x820a('0x4e')][_0x820a('0x66')];return db['Team']['findAll']({'where':{'id':_0x3ea649},'attributes':['id'],'include':[{'model':db[_0x820a('0x5d')],'as':'Agents','attributes':['id',_0x820a('0x2b'),'online',_0x820a('0x67'),'interface'],'raw':!![]}]})[_0x820a('0x26')](function(_0x4cb0d8){if(_0x4cb0d8){var _0x221853=_['flatMap'](_0x4cb0d8,function(_0x39f1fa){var _0x1692bf=_0x39f1fa[_0x820a('0x27')]({'plain':!![]});return _0x1692bf['Agents'];});return db[_0x820a('0x2f')][_0x820a('0x4c')]({'where':{'id':_0x5af083[_0x820a('0x49')]['id']}})[_0x820a('0x26')](function(_0x27d1a2){return db[_0x820a('0x68')]['transaction'](function(_0x210c68){return _0x27d1a2[_0x820a('0x69')](_0x3ea649,{'transaction':_0x210c68})[_0x820a('0x26')](function(){return BPromise[_0x820a('0x6a')](_0x221853,function(_0x3967ca){return db['UserWhatsappQueue'][_0x820a('0x6b')]({'where':{'UserId':_0x3967ca['id'],'WhatsappQueueId':_0x5af083[_0x820a('0x49')]['id']},'transaction':_0x210c68});});})[_0x820a('0x26')](function(){_0x221853[_0x820a('0x6c')](function(_0x4f8d4c){socket[_0x820a('0x6d')]('userWhatsappQueue:save',{'UserId':_0x4f8d4c['id'],'WhatsappQueueId':_0x27d1a2['id']});});});});});}})[_0x820a('0x26')](respondWithStatusCode(_0x582eeb,null))[_0x820a('0x47')](handleError(_0x582eeb,null));};exports[_0x820a('0x6e')]=function(_0x35ac92,_0x29c0a4,_0x413eab){return db['Team'][_0x820a('0x45')]({'where':{'id':_0x35ac92['query'][_0x820a('0x66')]},'attributes':['id'],'include':[{'model':db[_0x820a('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x820a('0x26')](handleEntityNotFound(_0x29c0a4,null))[_0x820a('0x26')](function(_0x49832f){var _0x249dae=_[_0x820a('0x2e')](_0x49832f,'id');var _0x490dd2=[];var _0x43368b=[];var _0x34fe96=squel[_0x820a('0x6f')]();_0x34fe96[_0x820a('0x70')](_0x820a('0x71'))[_0x820a('0x72')](_0x820a('0x73'),'tq')['join'](_0x820a('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x820a('0x41')](_0x820a('0x75'),_0x35ac92[_0x820a('0x49')]['id']);for(var _0xcb79e1=0x0;_0xcb79e1<_0x49832f[_0x820a('0x39')];_0xcb79e1+=0x1){let _0x623c22=_0x49832f[_0xcb79e1];for(var _0x408ce3=0x0;_0x408ce3<_0x623c22[_0x820a('0x76')][_0x820a('0x39')];_0x408ce3+=0x1){let _0xb6f382=_0x623c22[_0x820a('0x76')][_0x408ce3];var _0x4a9ea0=_0x34fe96[_0x820a('0x77')]();_0x4a9ea0[_0x820a('0x41')](_0x820a('0x78'),_0xb6f382['id']);_0x43368b[_0x820a('0x79')](db[_0x820a('0x68')][_0x820a('0x37')](_0x4a9ea0[_0x820a('0x7a')](),{'type':db[_0x820a('0x68')]['QueryTypes'][_0x820a('0x7b')]})['then'](function(_0x1652f5){if(_0x1652f5[_0x820a('0x39')]===0x1){return _0xb6f382['id'];}else{var _0xc9042d=_[_0x820a('0x7c')](_[_0x820a('0x2e')](_0x1652f5,_0x820a('0x7d')),function(_0x5ee178){return _[_0x820a('0x7e')](_0x249dae,_0x5ee178);});if(_0xc9042d){return _0xb6f382['id'];}}}));}}return BPromise['all'](_0x43368b)[_0x820a('0x26')](function(_0x5241ec){_0x490dd2=_(_0x490dd2)['union'](_0x5241ec)[_0x820a('0x7f')]()[_0x820a('0x80')]();return db[_0x820a('0x2f')][_0x820a('0x4c')]({'where':{'id':_0x35ac92[_0x820a('0x49')]['id']}})[_0x820a('0x26')](function(_0x46b9a2){return db[_0x820a('0x68')][_0x820a('0x81')](function(_0x7ff525){return _0x46b9a2[_0x820a('0x6e')](_0x35ac92[_0x820a('0x37')][_0x820a('0x66')],{'transaction':_0x7ff525})[_0x820a('0x26')](function(){if(!_['isEmpty'](_0x490dd2)){return _0x46b9a2[_0x820a('0x82')](_0x490dd2,{'transaction':_0x7ff525});}})[_0x820a('0x26')](function(){_0x490dd2[_0x820a('0x6c')](function(_0x37d436){socket[_0x820a('0x6d')](_0x820a('0x83'),{'UserId':_0x37d436,'WhatsappQueueId':_0x46b9a2['id']});});});});});});})[_0x820a('0x26')](respondWithStatusCode(_0x29c0a4,null))[_0x820a('0x47')](handleError(_0x29c0a4,null));};exports['addAgents']=function(_0x54cc32,_0x5ef703,_0x3c9985){return db[_0x820a('0x2f')][_0x820a('0x4c')]({'where':{'id':_0x54cc32[_0x820a('0x49')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x5ef703,null))[_0x820a('0x26')](function(_0x4da563){if(_0x4da563){return _0x4da563['addAgents'](_0x54cc32[_0x820a('0x4e')][_0x820a('0x66')],_[_0x820a('0x84')](_0x54cc32[_0x820a('0x4e')],[_0x820a('0x66'),'id'])||{})['spread'](function(_0xfa28e5){for(var _0x61ffcf=0x0;_0x61ffcf<_0x54cc32[_0x820a('0x4e')]['ids'][_0x820a('0x39')];_0x61ffcf+=0x1){socket[_0x820a('0x6d')](_0x820a('0x85'),{'UserId':_0x54cc32['body']['ids'][_0x61ffcf],'WhatsappQueueId':_0x54cc32[_0x820a('0x49')]['id']});}return _0xfa28e5;});}})[_0x820a('0x26')](respondWithResult(_0x5ef703,null))[_0x820a('0x47')](handleError(_0x5ef703,null));};exports[_0x820a('0x82')]=function(_0x4dd2e5,_0x28d3e0,_0x131894){return db[_0x820a('0x2f')]['find']({'where':{'id':_0x4dd2e5[_0x820a('0x49')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x28d3e0,null))[_0x820a('0x26')](function(_0x3c1879){if(_0x3c1879){return _0x3c1879[_0x820a('0x82')](_0x4dd2e5[_0x820a('0x37')]['ids'])[_0x820a('0x26')](function(){if(_[_0x820a('0x86')](_0x4dd2e5[_0x820a('0x37')][_0x820a('0x66')])){for(var _0x851f6=0x0;_0x851f6<_0x4dd2e5[_0x820a('0x37')][_0x820a('0x66')][_0x820a('0x39')];_0x851f6+=0x1){socket[_0x820a('0x6d')]('userWhatsappQueue:remove',{'UserId':Number(_0x4dd2e5[_0x820a('0x37')][_0x820a('0x66')][_0x851f6]),'WhatsappQueueId':Number(_0x4dd2e5[_0x820a('0x49')]['id'])});}}else{socket[_0x820a('0x6d')](_0x820a('0x83'),{'UserId':Number(_0x4dd2e5['query'][_0x820a('0x66')]),'WhatsappQueueId':Number(_0x4dd2e5[_0x820a('0x49')]['id'])});}});}})[_0x820a('0x26')](respondWithStatusCode(_0x28d3e0,null))[_0x820a('0x47')](handleError(_0x28d3e0,null));};exports[_0x820a('0x87')]=function(_0x566ab0,_0x48d4ab,_0x5044eb){var _0x382b87={};var _0x48ac7={};var _0x3c0307;var _0x4b665f;return db[_0x820a('0x2f')][_0x820a('0x59')]({'where':{'id':_0x566ab0[_0x820a('0x49')]['id']}})[_0x820a('0x26')](handleEntityNotFound(_0x48d4ab,null))['then'](function(_0x3ecb11){if(_0x3ecb11){_0x3c0307=_0x3ecb11;_0x48ac7['model']=_['keys'](db[_0x820a('0x5d')][_0x820a('0x30')]);_0x48ac7[_0x820a('0x37')]=_['keys'](_0x566ab0[_0x820a('0x37')]);_0x48ac7[_0x820a('0x35')]=_[_0x820a('0x36')](_0x48ac7['model'],_0x48ac7[_0x820a('0x37')]);_0x382b87['attributes']=_[_0x820a('0x36')](_0x48ac7[_0x820a('0x33')],qs[_0x820a('0x4a')](_0x566ab0[_0x820a('0x37')][_0x820a('0x4a')]));_0x382b87[_0x820a('0x38')]=_0x382b87[_0x820a('0x38')][_0x820a('0x39')]?_0x382b87[_0x820a('0x38')]:_0x48ac7[_0x820a('0x33')];_0x382b87['order']=qs['sort'](_0x566ab0['query'][_0x820a('0x3e')]);_0x382b87[_0x820a('0x41')]=qs[_0x820a('0x35')](_[_0x820a('0x5a')](_0x566ab0[_0x820a('0x37')],_0x48ac7['filters']));if(_0x566ab0[_0x820a('0x37')][_0x820a('0x3f')]){_0x382b87[_0x820a('0x41')]=_['merge'](_0x382b87[_0x820a('0x41')],{'$or':_[_0x820a('0x2e')](_0x382b87[_0x820a('0x38')],function(_0x4c80c9){var _0x19a570={};_0x19a570[_0x4c80c9]={'$like':'%'+_0x566ab0[_0x820a('0x37')][_0x820a('0x3f')]+'%'};return _0x19a570;})});}_0x382b87=_['merge']({},_0x382b87,_0x566ab0[_0x820a('0x43')]);return _0x3c0307['getAgents'](_0x382b87);}})[_0x820a('0x26')](function(_0x42a89a){if(_0x42a89a){_0x4b665f=_0x42a89a['length'];if(!_0x566ab0[_0x820a('0x37')][_0x820a('0x3a')](_0x820a('0x3b'))){_0x382b87[_0x820a('0x3c')]=qs[_0x820a('0x3c')](_0x566ab0['query'][_0x820a('0x3c')]);_0x382b87[_0x820a('0x1f')]=qs[_0x820a('0x1f')](_0x566ab0['query'][_0x820a('0x1f')]);}return _0x3c0307[_0x820a('0x87')](_0x382b87);}})[_0x820a('0x26')](function(_0x5f52c7){if(_0x5f52c7){return _0x5f52c7?{'count':_0x4b665f,'rows':_0x5f52c7}:null;}})[_0x820a('0x26')](respondWithResult(_0x48d4ab,null))[_0x820a('0x47')](handleError(_0x48d4ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0a47d3f..17d09f1 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 _0xfaca=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x58989c,_0x5a5a6a){var _0x269407=function(_0x132e39){while(--_0x132e39){_0x58989c['push'](_0x58989c['shift']());}};_0x269407(++_0x5a5a6a);}(_0xfaca,0xbc));var _0xafac=function(_0x40fe04,_0x37d302){_0x40fe04=_0x40fe04-0x0;var _0x3e3844=_0xfaca[_0x40fe04];return _0x3e3844;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xafac('0x0'))['db'][_0xafac('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xafac('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xafac('0x3'),'afterDestroy':_0xafac('0x4')};function emitEvent(_0xeacfb1){return function(_0x32b0a5,_0x1803ad,_0x4f9e18){WhatsappQueueEvents[_0xafac('0x5')](_0xeacfb1+':'+_0x32b0a5['id'],_0x32b0a5);WhatsappQueueEvents[_0xafac('0x5')](_0xeacfb1,_0x32b0a5);_0x4f9e18(null);};}for(var e in events){if(events[_0xafac('0x6')](e)){var event=events[e];WhatsappQueue[_0xafac('0x7')](e,emitEvent(event));}}module[_0xafac('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x1a73=['exports','events','../../mysqldb','WhatsappQueue','save','update','emit','hook'];(function(_0x37c598,_0x5126bb){var _0x26761b=function(_0x5e148d){while(--_0x5e148d){_0x37c598['push'](_0x37c598['shift']());}};_0x26761b(++_0x5126bb);}(_0x1a73,0x161));var _0x31a7=function(_0x559e4a,_0x5f25d6){_0x559e4a=_0x559e4a-0x0;var _0x4ba5f9=_0x1a73[_0x559e4a];return _0x4ba5f9;};'use strict';var EventEmitter=require(_0x31a7('0x0'));var WhatsappQueue=require(_0x31a7('0x1'))['db'][_0x31a7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31a7('0x3'),'afterUpdate':_0x31a7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x542e94){return function(_0x4beac3,_0x25b640,_0xf14e3f){WhatsappQueueEvents[_0x31a7('0x5')](_0x542e94+':'+_0x4beac3['id'],_0x4beac3);WhatsappQueueEvents[_0x31a7('0x5')](_0x542e94,_0x4beac3);_0xf14e3f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x31a7('0x6')](e,emitEvent(event));}}module[_0x31a7('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 87f5a50..130f0bf 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 _0x1bfb=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x4f2489,_0x25059e){var _0x2263bc=function(_0x390cac){while(--_0x390cac){_0x4f2489['push'](_0x4f2489['shift']());}};_0x2263bc(++_0x25059e);}(_0x1bfb,0x15c));var _0xb1bf=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x1bfb[_0x422be2];return _0x1b820e;};'use strict';var _=require(_0xb1bf('0x0'));var util=require(_0xb1bf('0x1'));var logger=require(_0xb1bf('0x2'))(_0xb1bf('0x3'));var moment=require(_0xb1bf('0x4'));var BPromise=require('bluebird');var rp=require(_0xb1bf('0x5'));var fs=require('fs');var path=require(_0xb1bf('0x6'));var rimraf=require(_0xb1bf('0x7'));var config=require('../../config/environment');var attributes=require(_0xb1bf('0x8'));module[_0xb1bf('0x9')]=function(_0x7979bf,_0x393e1c){return _0x7979bf[_0xb1bf('0xa')](_0xb1bf('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c48=['define','WhatsappQueue','whatsapp_queues','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x3c48,0x11a));var _0x83c4=function(_0x3e08c5,_0x39c7e0){_0x3e08c5=_0x3e08c5-0x0;var _0x2c4001=_0x3c48[_0x3e08c5];return _0x2c4001;};'use strict';var _=require('lodash');var util=require(_0x83c4('0x0'));var logger=require(_0x83c4('0x1'))('api');var moment=require(_0x83c4('0x2'));var BPromise=require('bluebird');var rp=require(_0x83c4('0x3'));var fs=require('fs');var path=require(_0x83c4('0x4'));var rimraf=require('rimraf');var config=require(_0x83c4('0x5'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x578da7,_0x2265e4){return _0x578da7[_0x83c4('0x6')](_0x83c4('0x7'),attributes,{'tableName':_0x83c4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 6909f0b..7ff0d43 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 _0x0897=['WhatsappQueue','findAll','options','raw','where','limit','include','map','attributes','model','stringify','ShowWhatsappQueue','find','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetWhatsappQueue'];(function(_0x491794,_0x4b1d3e){var _0x360698=function(_0x1cd218){while(--_0x1cd218){_0x491794['push'](_0x491794['shift']());}};_0x360698(++_0x4b1d3e);}(_0x0897,0x19d));var _0x7089=function(_0x42b33e,_0x55a2b8){_0x42b33e=_0x42b33e-0x0;var _0x114ab9=_0x0897[_0x42b33e];return _0x114ab9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7089('0x0'));var BPromise=require(_0x7089('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7089('0x2'));var db=require(_0x7089('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7089('0x4'));var jayson=require(_0x7089('0x5'));var client=jayson[_0x7089('0x6')][_0x7089('0x7')]({'port':0x232a});config[_0x7089('0x8')]=_[_0x7089('0x9')](config[_0x7089('0x8')],{'host':_0x7089('0xa'),'port':0x18eb});var socket=require(_0x7089('0xb'))(new Redis(config[_0x7089('0x8')]));require(_0x7089('0xc'))[_0x7089('0xd')](socket);function respondWithRpcPromise(_0x20ad48,_0x270a09,_0x4976b0){return new BPromise(function(_0x3ea187,_0x52508a){return client[_0x7089('0xe')](_0x20ad48,_0x4976b0)[_0x7089('0xf')](function(_0x27c3bf){logger[_0x7089('0x10')](_0x7089('0x11'),_0x270a09,_0x7089('0x12'));logger[_0x7089('0x13')](_0x7089('0x14'),_0x270a09,_0x7089('0x12'),JSON['stringify'](_0x27c3bf));if(_0x27c3bf['error']){if(_0x27c3bf['error'][_0x7089('0x15')]===0x1f4){logger[_0x7089('0x16')](_0x7089('0x11'),_0x270a09,_0x27c3bf[_0x7089('0x16')][_0x7089('0x17')]);return _0x52508a(_0x27c3bf[_0x7089('0x16')][_0x7089('0x17')]);}logger[_0x7089('0x16')](_0x7089('0x11'),_0x270a09,_0x27c3bf[_0x7089('0x16')][_0x7089('0x17')]);return _0x3ea187(_0x27c3bf[_0x7089('0x16')][_0x7089('0x17')]);}else{logger[_0x7089('0x10')](_0x7089('0x11'),_0x270a09,'request\x20sent');_0x3ea187(_0x27c3bf[_0x7089('0x18')][_0x7089('0x17')]);}})[_0x7089('0x19')](function(_0x1c551a){logger[_0x7089('0x16')](_0x7089('0x11'),_0x270a09,_0x1c551a);_0x52508a(_0x1c551a);});});}exports[_0x7089('0x1a')]=function(_0x2a383c){var _0x5b493f=this;return new Promise(function(_0x264e29,_0x384deb){return db[_0x7089('0x1b')][_0x7089('0x1c')]({'raw':_0x2a383c[_0x7089('0x1d')]?_0x2a383c[_0x7089('0x1d')][_0x7089('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a383c['options']?_0x2a383c['options'][_0x7089('0x1f')]||null:null,'attributes':_0x2a383c[_0x7089('0x1d')]?_0x2a383c[_0x7089('0x1d')]['attributes']||null:null,'limit':_0x2a383c[_0x7089('0x1d')]?_0x2a383c[_0x7089('0x1d')][_0x7089('0x20')]||null:null,'include':_0x2a383c[_0x7089('0x1d')]?_0x2a383c[_0x7089('0x1d')][_0x7089('0x21')]?_[_0x7089('0x22')](_0x2a383c[_0x7089('0x1d')][_0x7089('0x21')],function(_0x2e72f8){return{'model':db[_0x2e72f8['model']],'as':_0x2e72f8['as'],'attributes':_0x2e72f8[_0x7089('0x23')],'include':_0x2e72f8[_0x7089('0x21')]?_[_0x7089('0x22')](_0x2e72f8[_0x7089('0x21')],function(_0x476c00){return{'model':db[_0x476c00[_0x7089('0x24')]],'as':_0x476c00['as'],'attributes':_0x476c00[_0x7089('0x23')],'include':_0x476c00[_0x7089('0x21')]?_[_0x7089('0x22')](_0x476c00['include'],function(_0x5308f0){return{'model':db[_0x5308f0[_0x7089('0x24')]],'as':_0x5308f0['as'],'attributes':_0x5308f0[_0x7089('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a55ea){logger[_0x7089('0x10')](_0x7089('0x1a'),_0x2a383c);logger[_0x7089('0x13')]('GetWhatsappQueue',_0x2a383c,JSON[_0x7089('0x25')](_0x2a55ea));_0x264e29(_0x2a55ea);})[_0x7089('0x19')](function(_0x27642d){logger[_0x7089('0x16')](_0x7089('0x1a'),_0x27642d[_0x7089('0x17')],_0x2a383c);_0x384deb(_0x5b493f[_0x7089('0x16')](0x1f4,_0x27642d[_0x7089('0x17')]));});});};exports[_0x7089('0x26')]=function(_0x2d6825){var _0x5e894d=this;return new Promise(function(_0x9a17f7,_0x39c482){return db[_0x7089('0x1b')][_0x7089('0x27')]({'raw':_0x2d6825[_0x7089('0x1d')]?_0x2d6825[_0x7089('0x1d')][_0x7089('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d6825[_0x7089('0x1d')]?_0x2d6825[_0x7089('0x1d')][_0x7089('0x1f')]||null:null,'attributes':_0x2d6825[_0x7089('0x1d')]?_0x2d6825['options']['attributes']||null:null,'include':_0x2d6825[_0x7089('0x1d')]?_0x2d6825[_0x7089('0x1d')][_0x7089('0x21')]?_[_0x7089('0x22')](_0x2d6825[_0x7089('0x1d')]['include'],function(_0x180550){return{'model':db[_0x180550[_0x7089('0x24')]],'as':_0x180550['as'],'attributes':_0x180550[_0x7089('0x23')],'include':_0x180550[_0x7089('0x21')]?_['map'](_0x180550['include'],function(_0x2d065b){return{'model':db[_0x2d065b[_0x7089('0x24')]],'as':_0x2d065b['as'],'attributes':_0x2d065b[_0x7089('0x23')],'include':_0x2d065b[_0x7089('0x21')]?_[_0x7089('0x22')](_0x2d065b[_0x7089('0x21')],function(_0x3ef2c4){return{'model':db[_0x3ef2c4['model']],'as':_0x3ef2c4['as'],'attributes':_0x3ef2c4[_0x7089('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7089('0xf')](function(_0x1ba70e){logger['info']('ShowWhatsappQueue',_0x2d6825);logger[_0x7089('0x13')](_0x7089('0x26'),_0x2d6825,JSON['stringify'](_0x1ba70e));_0x9a17f7(_0x1ba70e);})[_0x7089('0x19')](function(_0x953df0){logger[_0x7089('0x16')](_0x7089('0x26'),_0x953df0[_0x7089('0x17')],_0x2d6825);_0x39c482(_0x5e894d[_0x7089('0x16')](0x1f4,_0x953df0[_0x7089('0x17')]));});});}; \ No newline at end of file +var _0x9a24=['../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','request','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','then','GetWhatsappQueue','stringify','ShowWhatsappQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9a3072,_0x36bbed){var _0x1543b9=function(_0x2e7027){while(--_0x2e7027){_0x9a3072['push'](_0x9a3072['shift']());}};_0x1543b9(++_0x36bbed);}(_0x9a24,0x102));var _0x49a2=function(_0x1abcee,_0x2dc4f6){_0x1abcee=_0x1abcee-0x0;var _0xabec16=_0x9a24[_0x1abcee];return _0xabec16;};'use strict';var _=require(_0x49a2('0x0'));var util=require('util');var moment=require(_0x49a2('0x1'));var BPromise=require(_0x49a2('0x2'));var rs=require(_0x49a2('0x3'));var fs=require('fs');var Redis=require(_0x49a2('0x4'));var db=require(_0x49a2('0x5'))['db'];var utils=require(_0x49a2('0x6'));var logger=require(_0x49a2('0x7'))('rpc');var config=require(_0x49a2('0x8'));var jayson=require(_0x49a2('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x49a2('0xa')]=_['defaults'](config[_0x49a2('0xa')],{'host':_0x49a2('0xb'),'port':0x18eb});var socket=require(_0x49a2('0xc'))(new Redis(config[_0x49a2('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2eec4d,_0x2dc550,_0x219f8d){return new BPromise(function(_0x34360d,_0x387ba0){return client[_0x49a2('0xd')](_0x2eec4d,_0x219f8d)['then'](function(_0x4beb50){logger['info'](_0x49a2('0xe'),_0x2dc550,'request\x20sent');logger[_0x49a2('0xf')](_0x49a2('0x10'),_0x2dc550,_0x49a2('0x11'),JSON['stringify'](_0x4beb50));if(_0x4beb50[_0x49a2('0x12')]){if(_0x4beb50[_0x49a2('0x12')][_0x49a2('0x13')]===0x1f4){logger[_0x49a2('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2dc550,_0x4beb50[_0x49a2('0x12')][_0x49a2('0x14')]);return _0x387ba0(_0x4beb50[_0x49a2('0x12')][_0x49a2('0x14')]);}logger[_0x49a2('0x12')](_0x49a2('0xe'),_0x2dc550,_0x4beb50[_0x49a2('0x12')]['message']);return _0x34360d(_0x4beb50[_0x49a2('0x12')][_0x49a2('0x14')]);}else{logger[_0x49a2('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2dc550,_0x49a2('0x11'));_0x34360d(_0x4beb50[_0x49a2('0x16')][_0x49a2('0x14')]);}})[_0x49a2('0x17')](function(_0x3b2e57){logger[_0x49a2('0x12')](_0x49a2('0xe'),_0x2dc550,_0x3b2e57);_0x387ba0(_0x3b2e57);});});}exports['GetWhatsappQueue']=function(_0x1a7062){var _0x5e7f76=this;return new Promise(function(_0x2eb694,_0x236f88){return db[_0x49a2('0x18')][_0x49a2('0x19')]({'raw':_0x1a7062[_0x49a2('0x1a')]?_0x1a7062['options'][_0x49a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a7062['options']?_0x1a7062[_0x49a2('0x1a')]['where']||null:null,'attributes':_0x1a7062[_0x49a2('0x1a')]?_0x1a7062['options'][_0x49a2('0x1c')]||null:null,'limit':_0x1a7062['options']?_0x1a7062[_0x49a2('0x1a')][_0x49a2('0x1d')]||null:null,'include':_0x1a7062[_0x49a2('0x1a')]?_0x1a7062['options'][_0x49a2('0x1e')]?_['map'](_0x1a7062['options']['include'],function(_0x4f8af8){return{'model':db[_0x4f8af8[_0x49a2('0x1f')]],'as':_0x4f8af8['as'],'attributes':_0x4f8af8[_0x49a2('0x1c')],'include':_0x4f8af8[_0x49a2('0x1e')]?_[_0x49a2('0x20')](_0x4f8af8[_0x49a2('0x1e')],function(_0x21cf94){return{'model':db[_0x21cf94[_0x49a2('0x1f')]],'as':_0x21cf94['as'],'attributes':_0x21cf94[_0x49a2('0x1c')],'include':_0x21cf94[_0x49a2('0x1e')]?_[_0x49a2('0x20')](_0x21cf94[_0x49a2('0x1e')],function(_0x5a28db){return{'model':db[_0x5a28db['model']],'as':_0x5a28db['as'],'attributes':_0x5a28db[_0x49a2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x49a2('0x21')](function(_0x1afde4){logger['info'](_0x49a2('0x22'),_0x1a7062);logger[_0x49a2('0xf')](_0x49a2('0x22'),_0x1a7062,JSON[_0x49a2('0x23')](_0x1afde4));_0x2eb694(_0x1afde4);})[_0x49a2('0x17')](function(_0x3b4f54){logger[_0x49a2('0x12')]('GetWhatsappQueue',_0x3b4f54[_0x49a2('0x14')],_0x1a7062);_0x236f88(_0x5e7f76['error'](0x1f4,_0x3b4f54['message']));});});};exports[_0x49a2('0x24')]=function(_0x491dc1){var _0x5ebcda=this;return new Promise(function(_0x3d6581,_0x266599){return db[_0x49a2('0x18')]['find']({'raw':_0x491dc1['options']?_0x491dc1[_0x49a2('0x1a')][_0x49a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x491dc1[_0x49a2('0x1a')]?_0x491dc1[_0x49a2('0x1a')][_0x49a2('0x25')]||null:null,'attributes':_0x491dc1['options']?_0x491dc1[_0x49a2('0x1a')][_0x49a2('0x1c')]||null:null,'include':_0x491dc1['options']?_0x491dc1['options'][_0x49a2('0x1e')]?_[_0x49a2('0x20')](_0x491dc1['options'][_0x49a2('0x1e')],function(_0x13fc90){return{'model':db[_0x13fc90['model']],'as':_0x13fc90['as'],'attributes':_0x13fc90[_0x49a2('0x1c')],'include':_0x13fc90[_0x49a2('0x1e')]?_[_0x49a2('0x20')](_0x13fc90[_0x49a2('0x1e')],function(_0x27469a){return{'model':db[_0x27469a[_0x49a2('0x1f')]],'as':_0x27469a['as'],'attributes':_0x27469a[_0x49a2('0x1c')],'include':_0x27469a['include']?_['map'](_0x27469a[_0x49a2('0x1e')],function(_0x5bb062){return{'model':db[_0x5bb062[_0x49a2('0x1f')]],'as':_0x5bb062['as'],'attributes':_0x5bb062[_0x49a2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x49a2('0x21')](function(_0x3c9a7a){logger[_0x49a2('0x15')]('ShowWhatsappQueue',_0x491dc1);logger['debug'](_0x49a2('0x24'),_0x491dc1,JSON[_0x49a2('0x23')](_0x3c9a7a));_0x3d6581(_0x3c9a7a);})[_0x49a2('0x17')](function(_0x148231){logger[_0x49a2('0x12')](_0x49a2('0x24'),_0x148231['message'],_0x491dc1);_0x266599(_0x5ebcda[_0x49a2('0x12')](0x1f4,_0x148231['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3116a86..0703dc3 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 _0xacb6=['whatsappQueue:','save','update','emit','removeListener','register','length'];(function(_0x27bf55,_0xcf5fc9){var _0x5b23ee=function(_0x1c70d2){while(--_0x1c70d2){_0x27bf55['push'](_0x27bf55['shift']());}};_0x5b23ee(++_0xcf5fc9);}(_0xacb6,0xa2));var _0x6acb=function(_0x5861e2,_0x3e2dcf){_0x5861e2=_0x5861e2-0x0;var _0x13b630=_0xacb6[_0x5861e2];return _0x13b630;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6acb('0x0'),'remove',_0x6acb('0x1')];function createListener(_0x46daed,_0x1823b9){return function(_0x4dac84){_0x1823b9[_0x6acb('0x2')](_0x46daed,_0x4dac84);};}function removeListener(_0x5bcbcd,_0x4fbb7a){return function(){WhatsappQueueEvents[_0x6acb('0x3')](_0x5bcbcd,_0x4fbb7a);};}exports[_0x6acb('0x4')]=function(_0x2a69c4){for(var _0x1d5539=0x0,_0x4e3156=events[_0x6acb('0x5')];_0x1d5539<_0x4e3156;_0x1d5539++){var _0x126087=events[_0x1d5539];var _0x1733c9=createListener(_0x6acb('0x6')+_0x126087,_0x2a69c4);WhatsappQueueEvents['on'](_0x126087,_0x1733c9);}}; \ No newline at end of file +var _0xdafd=['register','./whatsappQueue.events','save','remove','emit'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xdafd,0x146));var _0xddaf=function(_0x484ced,_0x37adda){_0x484ced=_0x484ced-0x0;var _0x3560b8=_0xdafd[_0x484ced];return _0x3560b8;};'use strict';var WhatsappQueueEvents=require(_0xddaf('0x0'));var events=[_0xddaf('0x1'),_0xddaf('0x2'),'update'];function createListener(_0x1b0137,_0xbe0114){return function(_0x598fb9){_0xbe0114[_0xddaf('0x3')](_0x1b0137,_0x598fb9);};}function removeListener(_0x573d55,_0x1cd63a){return function(){WhatsappQueueEvents['removeListener'](_0x573d55,_0x1cd63a);};}exports[_0xddaf('0x4')]=function(_0x1cbe9c){for(var _0x33cadd=0x0,_0x5963ca=events['length'];_0x33cadd<_0x5963ca;_0x33cadd++){var _0x4cf5e4=events[_0x33cadd];var _0x44d19c=createListener('whatsappQueue:'+_0x4cf5e4,_0x1cbe9c);WhatsappQueueEvents['on'](_0x4cf5e4,_0x44d19c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 305615e..25ff91a 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 _0xdade=['show','post','create','put','/:id','update','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0xcb0368,_0x50bde1){var _0x3f13f8=function(_0x4b69bd){while(--_0x4b69bd){_0xcb0368['push'](_0xcb0368['shift']());}};_0x3f13f8(++_0x50bde1);}(_0xdade,0x13a));var _0xedad=function(_0x42cf3b,_0x3bb5d7){_0x42cf3b=_0x42cf3b-0x0;var _0x416c2d=_0xdade[_0x42cf3b];return _0x416c2d;};'use strict';var multer=require('multer');var util=require(_0xedad('0x0'));var path=require(_0xedad('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xedad('0x2')]();var auth=require(_0xedad('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xedad('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0xedad('0x5')]('/',auth[_0xedad('0x6')](),controller[_0xedad('0x7')]);router['get'](_0xedad('0x8'),auth[_0xedad('0x6')](),controller[_0xedad('0x9')]);router[_0xedad('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xedad('0xa')]);router[_0xedad('0xb')]('/',auth[_0xedad('0x6')](),controller[_0xedad('0xc')]);router[_0xedad('0xd')](_0xedad('0xe'),auth['isAuthenticated'](),controller[_0xedad('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xedad('0x10')]);module[_0xedad('0x11')]=router; \ No newline at end of file +var _0x6746=['/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index'];(function(_0x56e686,_0x15ce41){var _0x374dd6=function(_0xc7c1d3){while(--_0xc7c1d3){_0x56e686['push'](_0x56e686['shift']());}};_0x374dd6(++_0x15ce41);}(_0x6746,0xa9));var _0x6674=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x6746[_0x5db313];return _0x36d503;};'use strict';var multer=require(_0x6674('0x0'));var util=require(_0x6674('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6674('0x2'));var router=express[_0x6674('0x3')]();var auth=require(_0x6674('0x4'));var interaction=require(_0x6674('0x5'));var config=require(_0x6674('0x6'));var controller=require(_0x6674('0x7'));router[_0x6674('0x8')]('/',auth[_0x6674('0x9')](),controller[_0x6674('0xa')]);router[_0x6674('0x8')](_0x6674('0xb'),auth[_0x6674('0x9')](),controller['describe']);router['get'](_0x6674('0xc'),auth[_0x6674('0x9')](),controller[_0x6674('0xd')]);router['post']('/',auth[_0x6674('0x9')](),controller[_0x6674('0xe')]);router[_0x6674('0xf')](_0x6674('0xc'),auth[_0x6674('0x9')](),controller[_0x6674('0x10')]);router[_0x6674('0x11')](_0x6674('0xc'),auth[_0x6674('0x9')](),controller[_0x6674('0x12')]);module[_0x6674('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 16946ce..888feae 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 _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x443835,_0x3c8d16){var _0x5da5d9=function(_0x51a2fe){while(--_0x51a2fe){_0x443835['push'](_0x443835['shift']());}};_0x5da5d9(++_0x3c8d16);}(_0x4b84,0x1cc));var _0x44b8=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x4b84[_0x334651];return _0x29657c;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3f352e,_0x2d8fa3){var _0x22299f=function(_0x4e7f4b){while(--_0x4e7f4b){_0x3f352e['push'](_0x3f352e['shift']());}};_0x22299f(++_0x2d8fa3);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index b5ce03a..34db815 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 _0x3ece=['end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','name','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','merge','options','count','include','rows','catch','show','keys','includeAll','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','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','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x5a9c3c,_0x2cc344){var _0x2a56aa=function(_0x14cecd){while(--_0x14cecd){_0x5a9c3c['push'](_0x5a9c3c['shift']());}};_0x2a56aa(++_0x2cc344);}(_0x3ece,0x10e));var _0xe3ec=function(_0x951ddd,_0x5ee08e){_0x951ddd=_0x951ddd-0x0;var _0x20bcfa=_0x3ece[_0x951ddd];return _0x20bcfa;};'use strict';var pdf=require(_0xe3ec('0x0'));var emlformat=require(_0xe3ec('0x1'));var rimraf=require(_0xe3ec('0x2'));var zipdir=require(_0xe3ec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3ec('0x4'));var moment=require('moment');var BPromise=require(_0xe3ec('0x5'));var Mustache=require(_0xe3ec('0x6'));var util=require('util');var path=require(_0xe3ec('0x7'));var sox=require('sox');var csv=require(_0xe3ec('0x8'));var ejs=require(_0xe3ec('0x9'));var fs=require('fs');var _=require(_0xe3ec('0xa'));var squel=require('squel');var crypto=require(_0xe3ec('0xb'));var jsforce=require(_0xe3ec('0xc'));var deskjs=require(_0xe3ec('0xd'));var toCsv=require(_0xe3ec('0x8'));var querystring=require(_0xe3ec('0xe'));var Papa=require(_0xe3ec('0xf'));var Redis=require(_0xe3ec('0x10'));var authService=require(_0xe3ec('0x11'));var qs=require(_0xe3ec('0x12'));var as=require(_0xe3ec('0x13'));var hardwareService=require(_0xe3ec('0x14'));var logger=require('../../config/logger')(_0xe3ec('0x15'));var utils=require(_0xe3ec('0x16'));var config=require(_0xe3ec('0x17'));var db=require(_0xe3ec('0x18'))['db'];function respondWithStatusCode(_0x9ba2e2,_0x3b6d16){_0x3b6d16=_0x3b6d16||0xcc;return function(_0x179eff){if(_0x179eff){return _0x9ba2e2['sendStatus'](_0x3b6d16);}return _0x9ba2e2[_0xe3ec('0x19')](_0x3b6d16)[_0xe3ec('0x1a')]();};}function respondWithResult(_0x4e5eb8,_0x46fd4c){_0x46fd4c=_0x46fd4c||0xc8;return function(_0x412e77){if(_0x412e77){return _0x4e5eb8[_0xe3ec('0x19')](_0x46fd4c)[_0xe3ec('0x1b')](_0x412e77);}};}function respondWithFilteredResult(_0x5f1481,_0xd722c8){return function(_0x4acaa8){if(_0x4acaa8){var _0x2186f1=_0x4acaa8['count'],_0x227c98=_0xd722c8[_0xe3ec('0x1c')],_0x43dbac=_0xd722c8[_0xe3ec('0x1c')]+_0xd722c8[_0xe3ec('0x1d')],_0x31919a;if(_0x43dbac>=_0x2186f1){_0x43dbac=_0x2186f1;_0x31919a=0xc8;}else{_0x31919a=0xce;}_0x5f1481[_0xe3ec('0x19')](_0x31919a);return _0x5f1481['set'](_0xe3ec('0x1e'),_0x227c98+'-'+_0x43dbac+'/'+_0x2186f1)[_0xe3ec('0x1b')](_0x4acaa8);}return null;};}function patchUpdates(_0x6a889b){return function(_0x4f42a3){try{jsonpatch[_0xe3ec('0x1f')](_0x4f42a3,_0x6a889b,!![]);}catch(_0x5b2c91){return BPromise[_0xe3ec('0x20')](_0x5b2c91);}return _0x4f42a3[_0xe3ec('0x21')]();};}function saveUpdates(_0x4ec3e8,_0x29089b){return function(_0x10e7bf){if(_0x10e7bf){return _0x10e7bf[_0xe3ec('0x22')](_0x4ec3e8)[_0xe3ec('0x23')](function(_0x1bf7b0){return _0x1bf7b0;});}return null;};}function removeEntity(_0x24e8cf,_0x470186){return function(_0x51030a){if(_0x51030a){return _0x51030a[_0xe3ec('0x24')]()[_0xe3ec('0x23')](function(){_0x24e8cf[_0xe3ec('0x19')](0xcc)[_0xe3ec('0x1a')]();});}};}function handleEntityNotFound(_0x336240,_0x25ecd7){return function(_0x269dfe){if(!_0x269dfe){_0x336240['sendStatus'](0x194);}return _0x269dfe;};}function handleError(_0x5535d9,_0x500dd9){_0x500dd9=_0x500dd9||0x1f4;return function(_0x57519a){logger['error'](_0x57519a[_0xe3ec('0x25')]);if(_0x57519a['name']){delete _0x57519a['name'];}_0x5535d9[_0xe3ec('0x19')](_0x500dd9)[_0xe3ec('0x26')](_0x57519a);};}exports[_0xe3ec('0x27')]=function(_0x12609a,_0x3414d2){var _0x5e86e6={},_0x5e62ca={},_0x1234e4={'count':0x0,'rows':[]};var _0x614a1c=_[_0xe3ec('0x28')](db[_0xe3ec('0x29')][_0xe3ec('0x2a')],function(_0x1548d9){return{'name':_0x1548d9[_0xe3ec('0x2b')],'type':_0x1548d9[_0xe3ec('0x2c')][_0xe3ec('0x2d')]};});_0x5e62ca['model']=_[_0xe3ec('0x28')](_0x614a1c,_0xe3ec('0x2e'));_0x5e62ca['query']=_['keys'](_0x12609a['query']);_0x5e62ca[_0xe3ec('0x2f')]=_[_0xe3ec('0x30')](_0x5e62ca[_0xe3ec('0x31')],_0x5e62ca[_0xe3ec('0x32')]);_0x5e86e6[_0xe3ec('0x33')]=_[_0xe3ec('0x30')](_0x5e62ca[_0xe3ec('0x31')],qs['fields'](_0x12609a['query'][_0xe3ec('0x34')]));_0x5e86e6[_0xe3ec('0x33')]=_0x5e86e6['attributes'][_0xe3ec('0x35')]?_0x5e86e6[_0xe3ec('0x33')]:_0x5e62ca[_0xe3ec('0x31')];if(!_0x12609a[_0xe3ec('0x32')][_0xe3ec('0x36')]('nolimit')){_0x5e86e6['limit']=qs[_0xe3ec('0x1d')](_0x12609a[_0xe3ec('0x32')][_0xe3ec('0x1d')]);_0x5e86e6[_0xe3ec('0x1c')]=qs['offset'](_0x12609a['query'][_0xe3ec('0x1c')]);}_0x5e86e6[_0xe3ec('0x37')]=qs[_0xe3ec('0x38')](_0x12609a['query'][_0xe3ec('0x38')]);_0x5e86e6['where']=qs['filters'](_[_0xe3ec('0x39')](_0x12609a[_0xe3ec('0x32')],_0x5e62ca['filters']),_0x614a1c);if(_0x12609a[_0xe3ec('0x32')]['filter']){_0x5e86e6[_0xe3ec('0x3a')]=_['merge'](_0x5e86e6['where'],{'$or':_['map'](_0x614a1c,function(_0xb6c9fc){if(_0xb6c9fc[_0xe3ec('0x2c')]!=='VIRTUAL'){var _0x2822ff={};_0x2822ff[_0xb6c9fc[_0xe3ec('0x2e')]]={'$like':'%'+_0x12609a[_0xe3ec('0x32')][_0xe3ec('0x3b')]+'%'};return _0x2822ff;}})});}_0x5e86e6=_[_0xe3ec('0x3c')]({},_0x5e86e6,_0x12609a[_0xe3ec('0x3d')]);var _0x249ef7={'where':_0x5e86e6['where']};return db[_0xe3ec('0x29')][_0xe3ec('0x3e')](_0x249ef7)[_0xe3ec('0x23')](function(_0x27168c){_0x1234e4[_0xe3ec('0x3e')]=_0x27168c;if(_0x12609a[_0xe3ec('0x32')]['includeAll']){_0x5e86e6[_0xe3ec('0x3f')]=[{'all':!![]}];}return db[_0xe3ec('0x29')]['findAll'](_0x5e86e6);})[_0xe3ec('0x23')](function(_0x51225f){_0x1234e4[_0xe3ec('0x40')]=_0x51225f;return _0x1234e4;})[_0xe3ec('0x23')](respondWithFilteredResult(_0x3414d2,_0x5e86e6))[_0xe3ec('0x41')](handleError(_0x3414d2,null));};exports[_0xe3ec('0x42')]=function(_0x466d63,_0xdd340a){var _0xca92a={'raw':!![],'where':{'id':_0x466d63['params']['id']}},_0x4dd9d1={};_0x4dd9d1[_0xe3ec('0x31')]=_[_0xe3ec('0x43')](db[_0xe3ec('0x29')][_0xe3ec('0x2a')]);_0x4dd9d1[_0xe3ec('0x32')]=_[_0xe3ec('0x43')](_0x466d63[_0xe3ec('0x32')]);_0x4dd9d1[_0xe3ec('0x2f')]=_['intersection'](_0x4dd9d1['model'],_0x4dd9d1[_0xe3ec('0x32')]);_0xca92a[_0xe3ec('0x33')]=_[_0xe3ec('0x30')](_0x4dd9d1[_0xe3ec('0x31')],qs[_0xe3ec('0x34')](_0x466d63[_0xe3ec('0x32')][_0xe3ec('0x34')]));_0xca92a['attributes']=_0xca92a[_0xe3ec('0x33')]['length']?_0xca92a[_0xe3ec('0x33')]:_0x4dd9d1[_0xe3ec('0x31')];if(_0x466d63['query'][_0xe3ec('0x44')]){_0xca92a[_0xe3ec('0x3f')]=[{'all':!![]}];}_0xca92a=_['merge']({},_0xca92a,_0x466d63[_0xe3ec('0x3d')]);return db[_0xe3ec('0x29')][_0xe3ec('0x45')](_0xca92a)['then'](handleEntityNotFound(_0xdd340a,null))[_0xe3ec('0x23')](respondWithResult(_0xdd340a,null))['catch'](handleError(_0xdd340a,null));};exports[_0xe3ec('0x46')]=function(_0x57f9b3,_0x198d25){return db['WhatsappQueueReport'][_0xe3ec('0x46')](_0x57f9b3[_0xe3ec('0x47')],{})[_0xe3ec('0x23')](respondWithResult(_0x198d25,0xc9))[_0xe3ec('0x41')](handleError(_0x198d25,null));};exports[_0xe3ec('0x22')]=function(_0x226ebb,_0x32d4e9){if(_0x226ebb[_0xe3ec('0x47')]['id']){delete _0x226ebb[_0xe3ec('0x47')]['id'];}return db[_0xe3ec('0x29')][_0xe3ec('0x45')]({'where':{'id':_0x226ebb[_0xe3ec('0x48')]['id']}})[_0xe3ec('0x23')](handleEntityNotFound(_0x32d4e9,null))[_0xe3ec('0x23')](saveUpdates(_0x226ebb['body'],null))[_0xe3ec('0x23')](respondWithResult(_0x32d4e9,null))['catch'](handleError(_0x32d4e9,null));};exports[_0xe3ec('0x24')]=function(_0x47e620,_0x9e5438){return db[_0xe3ec('0x29')]['find']({'where':{'id':_0x47e620['params']['id']}})[_0xe3ec('0x23')](handleEntityNotFound(_0x9e5438,null))[_0xe3ec('0x23')](removeEntity(_0x9e5438,null))['catch'](handleError(_0x9e5438,null));};exports['describe']=function(_0x899f0f,_0x5d10c1){return db[_0xe3ec('0x29')][_0xe3ec('0x49')]()[_0xe3ec('0x23')](respondWithResult(_0x5d10c1,null))[_0xe3ec('0x41')](handleError(_0x5d10c1,null));}; \ No newline at end of file +var _0xc247=['destroy','error','stack','name','send','index','map','fieldName','type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappQueueReport','includeAll','findAll','show','params','keys','intersection','include','options','catch','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then'];(function(_0x27339f,_0x4e28bd){var _0xbda8ec=function(_0x1d046d){while(--_0x1d046d){_0x27339f['push'](_0x27339f['shift']());}};_0xbda8ec(++_0x4e28bd);}(_0xc247,0xfe));var _0x7c24=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xc247[_0x2ec2bf];return _0x2c279c;};'use strict';var pdf=require(_0x7c24('0x0'));var emlformat=require(_0x7c24('0x1'));var rimraf=require(_0x7c24('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c24('0x3'));var rp=require(_0x7c24('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7c24('0x5'));var util=require(_0x7c24('0x6'));var path=require(_0x7c24('0x7'));var sox=require(_0x7c24('0x8'));var csv=require(_0x7c24('0x9'));var ejs=require(_0x7c24('0xa'));var fs=require('fs');var _=require(_0x7c24('0xb'));var squel=require(_0x7c24('0xc'));var crypto=require(_0x7c24('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7c24('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7c24('0xf'));var Redis=require(_0x7c24('0x10'));var authService=require(_0x7c24('0x11'));var qs=require(_0x7c24('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c24('0x13'));var logger=require('../../config/logger')(_0x7c24('0x14'));var utils=require(_0x7c24('0x15'));var config=require(_0x7c24('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed08e1,_0x408a69){_0x408a69=_0x408a69||0xcc;return function(_0x3ccb55){if(_0x3ccb55){return _0xed08e1[_0x7c24('0x17')](_0x408a69);}return _0xed08e1['status'](_0x408a69)['end']();};}function respondWithResult(_0x444183,_0x45ac03){_0x45ac03=_0x45ac03||0xc8;return function(_0x3184d0){if(_0x3184d0){return _0x444183[_0x7c24('0x18')](_0x45ac03)[_0x7c24('0x19')](_0x3184d0);}};}function respondWithFilteredResult(_0x5b92bd,_0x5b5cf1){return function(_0x1fbd5a){if(_0x1fbd5a){var _0x188656=_0x1fbd5a[_0x7c24('0x1a')],_0x53474f=_0x5b5cf1[_0x7c24('0x1b')],_0x18459a=_0x5b5cf1['offset']+_0x5b5cf1[_0x7c24('0x1c')],_0x28febe;if(_0x18459a>=_0x188656){_0x18459a=_0x188656;_0x28febe=0xc8;}else{_0x28febe=0xce;}_0x5b92bd[_0x7c24('0x18')](_0x28febe);return _0x5b92bd[_0x7c24('0x1d')](_0x7c24('0x1e'),_0x53474f+'-'+_0x18459a+'/'+_0x188656)[_0x7c24('0x19')](_0x1fbd5a);}return null;};}function patchUpdates(_0x567630){return function(_0x477f06){try{jsonpatch['apply'](_0x477f06,_0x567630,!![]);}catch(_0x26f5aa){return BPromise[_0x7c24('0x1f')](_0x26f5aa);}return _0x477f06['save']();};}function saveUpdates(_0x5c8386,_0x3caec9){return function(_0x217b32){if(_0x217b32){return _0x217b32[_0x7c24('0x20')](_0x5c8386)[_0x7c24('0x21')](function(_0x4bcf7e){return _0x4bcf7e;});}return null;};}function removeEntity(_0x221d8e,_0x425ee7){return function(_0x3b98a6){if(_0x3b98a6){return _0x3b98a6[_0x7c24('0x22')]()[_0x7c24('0x21')](function(){_0x221d8e[_0x7c24('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4a2f,_0x216909){return function(_0x26e627){if(!_0x26e627){_0x2f4a2f[_0x7c24('0x17')](0x194);}return _0x26e627;};}function handleError(_0x4198ca,_0x149a49){_0x149a49=_0x149a49||0x1f4;return function(_0xe1b5f9){logger[_0x7c24('0x23')](_0xe1b5f9[_0x7c24('0x24')]);if(_0xe1b5f9[_0x7c24('0x25')]){delete _0xe1b5f9[_0x7c24('0x25')];}_0x4198ca[_0x7c24('0x18')](_0x149a49)[_0x7c24('0x26')](_0xe1b5f9);};}exports[_0x7c24('0x27')]=function(_0x27e078,_0x38fde7){var _0xdcd9b9={},_0x527972={},_0x39a101={'count':0x0,'rows':[]};var _0x370f72=_[_0x7c24('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x10a814){return{'name':_0x10a814[_0x7c24('0x29')],'type':_0x10a814[_0x7c24('0x2a')]['key']};});_0x527972['model']=_[_0x7c24('0x28')](_0x370f72,_0x7c24('0x25'));_0x527972['query']=_['keys'](_0x27e078[_0x7c24('0x2b')]);_0x527972[_0x7c24('0x2c')]=_['intersection'](_0x527972[_0x7c24('0x2d')],_0x527972[_0x7c24('0x2b')]);_0xdcd9b9['attributes']=_['intersection'](_0x527972['model'],qs[_0x7c24('0x2e')](_0x27e078[_0x7c24('0x2b')][_0x7c24('0x2e')]));_0xdcd9b9[_0x7c24('0x2f')]=_0xdcd9b9[_0x7c24('0x2f')][_0x7c24('0x30')]?_0xdcd9b9[_0x7c24('0x2f')]:_0x527972['model'];if(!_0x27e078['query'][_0x7c24('0x31')](_0x7c24('0x32'))){_0xdcd9b9['limit']=qs[_0x7c24('0x1c')](_0x27e078[_0x7c24('0x2b')][_0x7c24('0x1c')]);_0xdcd9b9[_0x7c24('0x1b')]=qs['offset'](_0x27e078[_0x7c24('0x2b')]['offset']);}_0xdcd9b9[_0x7c24('0x33')]=qs[_0x7c24('0x34')](_0x27e078[_0x7c24('0x2b')][_0x7c24('0x34')]);_0xdcd9b9[_0x7c24('0x35')]=qs[_0x7c24('0x2c')](_[_0x7c24('0x36')](_0x27e078['query'],_0x527972[_0x7c24('0x2c')]),_0x370f72);if(_0x27e078[_0x7c24('0x2b')][_0x7c24('0x37')]){_0xdcd9b9[_0x7c24('0x35')]=_[_0x7c24('0x38')](_0xdcd9b9[_0x7c24('0x35')],{'$or':_['map'](_0x370f72,function(_0x1245c3){if(_0x1245c3[_0x7c24('0x2a')]!==_0x7c24('0x39')){var _0x594ca9={};_0x594ca9[_0x1245c3[_0x7c24('0x25')]]={'$like':'%'+_0x27e078[_0x7c24('0x2b')][_0x7c24('0x37')]+'%'};return _0x594ca9;}})});}_0xdcd9b9=_['merge']({},_0xdcd9b9,_0x27e078['options']);var _0x267d03={'where':_0xdcd9b9[_0x7c24('0x35')]};return db[_0x7c24('0x3a')]['count'](_0x267d03)[_0x7c24('0x21')](function(_0x1707a3){_0x39a101['count']=_0x1707a3;if(_0x27e078[_0x7c24('0x2b')][_0x7c24('0x3b')]){_0xdcd9b9['include']=[{'all':!![]}];}return db[_0x7c24('0x3a')][_0x7c24('0x3c')](_0xdcd9b9);})['then'](function(_0x3a1f78){_0x39a101['rows']=_0x3a1f78;return _0x39a101;})['then'](respondWithFilteredResult(_0x38fde7,_0xdcd9b9))['catch'](handleError(_0x38fde7,null));};exports[_0x7c24('0x3d')]=function(_0x138d11,_0x3cbeff){var _0x4bca36={'raw':!![],'where':{'id':_0x138d11[_0x7c24('0x3e')]['id']}},_0x4481c7={};_0x4481c7[_0x7c24('0x2d')]=_[_0x7c24('0x3f')](db[_0x7c24('0x3a')]['rawAttributes']);_0x4481c7[_0x7c24('0x2b')]=_[_0x7c24('0x3f')](_0x138d11[_0x7c24('0x2b')]);_0x4481c7['filters']=_['intersection'](_0x4481c7[_0x7c24('0x2d')],_0x4481c7[_0x7c24('0x2b')]);_0x4bca36[_0x7c24('0x2f')]=_[_0x7c24('0x40')](_0x4481c7[_0x7c24('0x2d')],qs[_0x7c24('0x2e')](_0x138d11[_0x7c24('0x2b')][_0x7c24('0x2e')]));_0x4bca36[_0x7c24('0x2f')]=_0x4bca36[_0x7c24('0x2f')][_0x7c24('0x30')]?_0x4bca36[_0x7c24('0x2f')]:_0x4481c7[_0x7c24('0x2d')];if(_0x138d11[_0x7c24('0x2b')]['includeAll']){_0x4bca36[_0x7c24('0x41')]=[{'all':!![]}];}_0x4bca36=_[_0x7c24('0x38')]({},_0x4bca36,_0x138d11[_0x7c24('0x42')]);return db['WhatsappQueueReport']['find'](_0x4bca36)[_0x7c24('0x21')](handleEntityNotFound(_0x3cbeff,null))[_0x7c24('0x21')](respondWithResult(_0x3cbeff,null))[_0x7c24('0x43')](handleError(_0x3cbeff,null));};exports[_0x7c24('0x44')]=function(_0x574e63,_0x155aa0){return db[_0x7c24('0x3a')][_0x7c24('0x44')](_0x574e63[_0x7c24('0x45')],{})[_0x7c24('0x21')](respondWithResult(_0x155aa0,0xc9))[_0x7c24('0x43')](handleError(_0x155aa0,null));};exports[_0x7c24('0x20')]=function(_0x2cfee5,_0x2128bb){if(_0x2cfee5['body']['id']){delete _0x2cfee5[_0x7c24('0x45')]['id'];}return db[_0x7c24('0x3a')][_0x7c24('0x46')]({'where':{'id':_0x2cfee5[_0x7c24('0x3e')]['id']}})[_0x7c24('0x21')](handleEntityNotFound(_0x2128bb,null))[_0x7c24('0x21')](saveUpdates(_0x2cfee5[_0x7c24('0x45')],null))[_0x7c24('0x21')](respondWithResult(_0x2128bb,null))[_0x7c24('0x43')](handleError(_0x2128bb,null));};exports['destroy']=function(_0x358d90,_0x25e74b){return db[_0x7c24('0x3a')]['find']({'where':{'id':_0x358d90['params']['id']}})['then'](handleEntityNotFound(_0x25e74b,null))[_0x7c24('0x21')](removeEntity(_0x25e74b,null))['catch'](handleError(_0x25e74b,null));};exports[_0x7c24('0x47')]=function(_0x4732e9,_0x415c49){return db['WhatsappQueueReport'][_0x7c24('0x47')]()[_0x7c24('0x21')](respondWithResult(_0x415c49,null))[_0x7c24('0x43')](handleError(_0x415c49,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index b84f29d..64a075f 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 _0xb75e=['./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x5d2ac7,_0x39b78d){var _0x56646f=function(_0x5d7110){while(--_0x5d7110){_0x5d2ac7['push'](_0x5d2ac7['shift']());}};_0x56646f(++_0x39b78d);}(_0xb75e,0x161));var _0xeb75=function(_0x4090b2,_0x48c96b){_0x4090b2=_0x4090b2-0x0;var _0x20d94b=_0xb75e[_0x4090b2];return _0x20d94b;};'use strict';var _=require(_0xeb75('0x0'));var util=require(_0xeb75('0x1'));var logger=require(_0xeb75('0x2'))(_0xeb75('0x3'));var moment=require('moment');var BPromise=require(_0xeb75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb75('0x5'));var rimraf=require('rimraf');var config=require(_0xeb75('0x6'));var attributes=require(_0xeb75('0x7'));module[_0xeb75('0x8')]=function(_0x1b30a8,_0x51f626){return _0x1b30a8['define'](_0xeb75('0x9'),attributes,{'tableName':_0xeb75('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeb75('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7aaa=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','uniqueid'];(function(_0x14b9a2,_0x4a8ff1){var _0xba63=function(_0x261183){while(--_0x261183){_0x14b9a2['push'](_0x14b9a2['shift']());}};_0xba63(++_0x4a8ff1);}(_0x7aaa,0x181));var _0xa7aa=function(_0xa76900,_0x505859){_0xa76900=_0xa76900-0x0;var _0x32e47a=_0x7aaa[_0xa76900];return _0x32e47a;};'use strict';var _=require(_0xa7aa('0x0'));var util=require(_0xa7aa('0x1'));var logger=require(_0xa7aa('0x2'))(_0xa7aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa7aa('0x4'));var fs=require('fs');var path=require(_0xa7aa('0x5'));var rimraf=require(_0xa7aa('0x6'));var config=require('../../config/environment');var attributes=require(_0xa7aa('0x7'));module[_0xa7aa('0x8')]=function(_0x114c88,_0x1451a1){return _0x114c88[_0xa7aa('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa7aa('0xa'),'fields':[_0xa7aa('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 1e88d94..54e1f49 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 _0xb604=['catch','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport'];(function(_0x2a5a49,_0x424720){var _0x199c37=function(_0x1134b2){while(--_0x1134b2){_0x2a5a49['push'](_0x2a5a49['shift']());}};_0x199c37(++_0x424720);}(_0xb604,0xe5));var _0x4b60=function(_0x42611d,_0x83e9c9){_0x42611d=_0x42611d-0x0;var _0xae917a=_0xb604[_0x42611d];return _0xae917a;};'use strict';var _=require(_0x4b60('0x0'));var util=require(_0x4b60('0x1'));var moment=require(_0x4b60('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b60('0x3'));var fs=require('fs');var Redis=require(_0x4b60('0x4'));var db=require(_0x4b60('0x5'))['db'];var utils=require(_0x4b60('0x6'));var logger=require(_0x4b60('0x7'))(_0x4b60('0x8'));var config=require(_0x4b60('0x9'));var jayson=require(_0x4b60('0xa'));var client=jayson[_0x4b60('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249768,_0x47f5f0,_0x488c18){return new BPromise(function(_0x3beca4,_0x39e794){return client[_0x4b60('0xc')](_0x249768,_0x488c18)[_0x4b60('0xd')](function(_0x2f47c2){logger[_0x4b60('0xe')](_0x4b60('0xf'),_0x47f5f0,'request\x20sent');logger[_0x4b60('0x10')](_0x4b60('0x11'),_0x47f5f0,_0x4b60('0x12'),JSON[_0x4b60('0x13')](_0x2f47c2));if(_0x2f47c2['error']){if(_0x2f47c2[_0x4b60('0x14')]['code']===0x1f4){logger[_0x4b60('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x47f5f0,_0x2f47c2[_0x4b60('0x14')]['message']);return _0x39e794(_0x2f47c2[_0x4b60('0x14')]['message']);}logger[_0x4b60('0x14')](_0x4b60('0xf'),_0x47f5f0,_0x2f47c2[_0x4b60('0x14')]['message']);return _0x3beca4(_0x2f47c2[_0x4b60('0x14')][_0x4b60('0x15')]);}else{logger[_0x4b60('0xe')](_0x4b60('0xf'),_0x47f5f0,_0x4b60('0x12'));_0x3beca4(_0x2f47c2['result'][_0x4b60('0x15')]);}})['catch'](function(_0x37026f){logger[_0x4b60('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x47f5f0,_0x37026f);_0x39e794(_0x37026f);});});}exports['CreateWhatsappQueueReport']=function(_0xee81a4){var _0x29e1b8=this;return new Promise(function(_0x3531f6,_0x5d63bb){return db[_0x4b60('0x16')]['create'](_0xee81a4[_0x4b60('0x17')],{'raw':_0xee81a4[_0x4b60('0x18')]?_0xee81a4['options'][_0x4b60('0x19')]===undefined?!![]:![]:!![]})[_0x4b60('0xd')](function(_0x5f30ff){logger[_0x4b60('0xe')]('CreateWhatsappQueueReport',_0xee81a4);logger['debug'](_0x4b60('0x1a'),_0xee81a4,JSON[_0x4b60('0x13')](_0x5f30ff));_0x3531f6(_0x5f30ff);})[_0x4b60('0x1b')](function(_0x1a130d){logger[_0x4b60('0x14')](_0x4b60('0x1a'),_0x1a130d[_0x4b60('0x15')],_0xee81a4);_0x5d63bb(_0x29e1b8[_0x4b60('0x14')](0x1f4,_0x1a130d[_0x4b60('0x15')]));});});};exports[_0x4b60('0x1c')]=function(_0x1a9446){var _0x375588=this;return new Promise(function(_0x4d5154,_0x57ee79){return db[_0x4b60('0x16')]['update'](_0x1a9446['body'],{'raw':_0x1a9446['options']?_0x1a9446['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a9446['options']?_0x1a9446[_0x4b60('0x18')][_0x4b60('0x1d')]||null:null,'attributes':_0x1a9446[_0x4b60('0x18')]?_0x1a9446[_0x4b60('0x18')][_0x4b60('0x1e')]||null:null,'limit':_0x1a9446['options']?_0x1a9446[_0x4b60('0x18')][_0x4b60('0x1f')]||null:null})[_0x4b60('0xd')](function(_0x5a73e6){logger[_0x4b60('0xe')](_0x4b60('0x1c'),_0x1a9446);logger['debug']('UpdateWhatsappQueueReport',_0x1a9446,JSON[_0x4b60('0x13')](_0x5a73e6));_0x4d5154(_0x5a73e6);})['catch'](function(_0x28e839){logger['error'](_0x4b60('0x1c'),_0x28e839['message'],_0x1a9446);_0x57ee79(_0x375588[_0x4b60('0x14')](0x1f4,_0x28e839['message']));});});}; \ No newline at end of file +var _0x87f9=['WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','catch','UpdateWhatsappQueueReport','raw','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x87f9,0x113));var _0x987f=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x87f9[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x987f('0x0'));var util=require(_0x987f('0x1'));var moment=require(_0x987f('0x2'));var BPromise=require(_0x987f('0x3'));var rs=require(_0x987f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x987f('0x5'))['db'];var utils=require(_0x987f('0x6'));var logger=require('../../config/logger')(_0x987f('0x7'));var config=require(_0x987f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x987f('0x9')][_0x987f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2763c5,_0x509c5c,_0xeaf7f){return new BPromise(function(_0x62ca0d,_0x513c33){return client['request'](_0x2763c5,_0xeaf7f)[_0x987f('0xb')](function(_0x362a06){logger[_0x987f('0xc')](_0x987f('0xd'),_0x509c5c,'request\x20sent');logger[_0x987f('0xe')](_0x987f('0xf'),_0x509c5c,'request\x20sent',JSON['stringify'](_0x362a06));if(_0x362a06[_0x987f('0x10')]){if(_0x362a06[_0x987f('0x10')][_0x987f('0x11')]===0x1f4){logger[_0x987f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x509c5c,_0x362a06['error']['message']);return _0x513c33(_0x362a06[_0x987f('0x10')][_0x987f('0x12')]);}logger[_0x987f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x509c5c,_0x362a06['error'][_0x987f('0x12')]);return _0x62ca0d(_0x362a06[_0x987f('0x10')][_0x987f('0x12')]);}else{logger[_0x987f('0xc')](_0x987f('0xd'),_0x509c5c,_0x987f('0x13'));_0x62ca0d(_0x362a06[_0x987f('0x14')][_0x987f('0x12')]);}})['catch'](function(_0x122cca){logger[_0x987f('0x10')](_0x987f('0xd'),_0x509c5c,_0x122cca);_0x513c33(_0x122cca);});});}exports[_0x987f('0x15')]=function(_0xbf671b){var _0x367fa7=this;return new Promise(function(_0x17c249,_0x370ed8){return db[_0x987f('0x16')][_0x987f('0x17')](_0xbf671b[_0x987f('0x18')],{'raw':_0xbf671b[_0x987f('0x19')]?_0xbf671b[_0x987f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x987f('0xb')](function(_0x989fa8){logger[_0x987f('0xc')]('CreateWhatsappQueueReport',_0xbf671b);logger[_0x987f('0xe')](_0x987f('0x15'),_0xbf671b,JSON['stringify'](_0x989fa8));_0x17c249(_0x989fa8);})[_0x987f('0x1a')](function(_0x291b3d){logger[_0x987f('0x10')](_0x987f('0x15'),_0x291b3d[_0x987f('0x12')],_0xbf671b);_0x370ed8(_0x367fa7[_0x987f('0x10')](0x1f4,_0x291b3d['message']));});});};exports[_0x987f('0x1b')]=function(_0x1eac31){var _0x4ad4db=this;return new Promise(function(_0x30a98a,_0x2e5d16){return db[_0x987f('0x16')]['update'](_0x1eac31[_0x987f('0x18')],{'raw':_0x1eac31[_0x987f('0x19')]?_0x1eac31[_0x987f('0x19')][_0x987f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eac31[_0x987f('0x19')]?_0x1eac31[_0x987f('0x19')][_0x987f('0x1d')]||null:null,'attributes':_0x1eac31[_0x987f('0x19')]?_0x1eac31['options'][_0x987f('0x1e')]||null:null,'limit':_0x1eac31[_0x987f('0x19')]?_0x1eac31[_0x987f('0x19')]['limit']||null:null})['then'](function(_0x4a0e13){logger[_0x987f('0xc')](_0x987f('0x1b'),_0x1eac31);logger[_0x987f('0xe')](_0x987f('0x1b'),_0x1eac31,JSON[_0x987f('0x1f')](_0x4a0e13));_0x30a98a(_0x4a0e13);})[_0x987f('0x1a')](function(_0x265276){logger[_0x987f('0x10')](_0x987f('0x1b'),_0x265276['message'],_0x1eac31);_0x2e5d16(_0x4ad4db[_0x987f('0x10')](0x1f4,_0x265276[_0x987f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5c2695d..b8267a7 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 _0x3a91=['get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a91,0x1bc));var _0x13a9=function(_0x4f517f,_0x15e66f){_0x4f517f=_0x4f517f-0x0;var _0x48bc81=_0x3a91[_0x4f517f];return _0x48bc81;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x13a9('0x0'));var express=require(_0x13a9('0x1'));var router=express[_0x13a9('0x2')]();var auth=require(_0x13a9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x13a9('0x4'));var controller=require(_0x13a9('0x5'));router[_0x13a9('0x6')]('/',auth[_0x13a9('0x7')](),controller[_0x13a9('0x8')]);router[_0x13a9('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x13a9('0x9')]);router[_0x13a9('0x6')](_0x13a9('0xa'),auth['isAuthenticated'](),controller[_0x13a9('0xb')]);router[_0x13a9('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x13a9('0xd')]('/:id',auth[_0x13a9('0x7')](),controller[_0x13a9('0xe')]);router[_0x13a9('0xf')]('/:id',auth[_0x13a9('0x7')](),controller[_0x13a9('0x10')]);module[_0x13a9('0x11')]=router; \ No newline at end of file +var _0xcc8d=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports'];(function(_0x364ca6,_0x543e9a){var _0x1182b9=function(_0xb39fd0){while(--_0xb39fd0){_0x364ca6['push'](_0x364ca6['shift']());}};_0x1182b9(++_0x543e9a);}(_0xcc8d,0xfc));var _0xdcc8=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xcc8d[_0x4aa4e6];return _0x322588;};'use strict';var multer=require(_0xdcc8('0x0'));var util=require(_0xdcc8('0x1'));var path=require('path');var timeout=require(_0xdcc8('0x2'));var express=require('express');var router=express[_0xdcc8('0x3')]();var auth=require(_0xdcc8('0x4'));var interaction=require(_0xdcc8('0x5'));var config=require(_0xdcc8('0x6'));var controller=require(_0xdcc8('0x7'));router['get']('/',auth[_0xdcc8('0x8')](),controller[_0xdcc8('0x9')]);router['get'](_0xdcc8('0xa'),auth[_0xdcc8('0x8')](),controller[_0xdcc8('0xb')]);router['get'](_0xdcc8('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdcc8('0xd')](_0xdcc8('0xc'),auth[_0xdcc8('0x8')](),controller[_0xdcc8('0xe')]);router[_0xdcc8('0xf')](_0xdcc8('0xc'),auth[_0xdcc8('0x8')](),controller[_0xdcc8('0x10')]);module[_0xdcc8('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 6be0470..1efeeec 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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0xcc8b21,_0x364f93){var _0x417e34=function(_0xae7dc6){while(--_0xae7dc6){_0xcc8b21['push'](_0xcc8b21['shift']());}};_0x417e34(++_0x364f93);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x2a1cc8,_0x5e41f8){var _0xd70685=function(_0x304945){while(--_0x304945){_0x2a1cc8['push'](_0x2a1cc8['shift']());}};_0xd70685(++_0x5e41f8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2bce16,_0x547a73){_0x2bce16=_0x2bce16-0x0;var _0xa54349=_0x5f2f[_0x2bce16];return _0xa54349;};'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 a07875a..5c5b58c 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 _0xa886=['end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','WhatsappTransferReport','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x51c1fd,_0x4d84aa){var _0x4080d9=function(_0x38a032){while(--_0x38a032){_0x51c1fd['push'](_0x51c1fd['shift']());}};_0x4080d9(++_0x4d84aa);}(_0xa886,0x1ac));var _0x6a88=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa886[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x6a88('0x0'));var emlformat=require(_0x6a88('0x1'));var rimraf=require(_0x6a88('0x2'));var zipdir=require(_0x6a88('0x3'));var jsonpatch=require(_0x6a88('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6a88('0x5'));var Mustache=require(_0x6a88('0x6'));var util=require('util');var path=require(_0x6a88('0x7'));var sox=require(_0x6a88('0x8'));var csv=require(_0x6a88('0x9'));var ejs=require(_0x6a88('0xa'));var fs=require('fs');var _=require(_0x6a88('0xb'));var squel=require('squel');var crypto=require(_0x6a88('0xc'));var jsforce=require(_0x6a88('0xd'));var deskjs=require(_0x6a88('0xe'));var toCsv=require(_0x6a88('0x9'));var querystring=require(_0x6a88('0xf'));var Papa=require(_0x6a88('0x10'));var Redis=require(_0x6a88('0x11'));var authService=require(_0x6a88('0x12'));var qs=require(_0x6a88('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a88('0x14'));var logger=require(_0x6a88('0x15'))(_0x6a88('0x16'));var utils=require(_0x6a88('0x17'));var config=require(_0x6a88('0x18'));var db=require(_0x6a88('0x19'))['db'];function respondWithStatusCode(_0x9ddffd,_0x3b57e9){_0x3b57e9=_0x3b57e9||0xcc;return function(_0x1f4efc){if(_0x1f4efc){return _0x9ddffd[_0x6a88('0x1a')](_0x3b57e9);}return _0x9ddffd[_0x6a88('0x1b')](_0x3b57e9)[_0x6a88('0x1c')]();};}function respondWithResult(_0x1cc345,_0x4c4dee){_0x4c4dee=_0x4c4dee||0xc8;return function(_0x54d332){if(_0x54d332){return _0x1cc345[_0x6a88('0x1b')](_0x4c4dee)[_0x6a88('0x1d')](_0x54d332);}};}function respondWithFilteredResult(_0x91354f,_0x47bf1d){return function(_0x200cf9){if(_0x200cf9){var _0xb66b62=_0x200cf9['count'],_0x4f6521=_0x47bf1d[_0x6a88('0x1e')],_0x4138f2=_0x47bf1d[_0x6a88('0x1e')]+_0x47bf1d[_0x6a88('0x1f')],_0x3b5baf;if(_0x4138f2>=_0xb66b62){_0x4138f2=_0xb66b62;_0x3b5baf=0xc8;}else{_0x3b5baf=0xce;}_0x91354f['status'](_0x3b5baf);return _0x91354f[_0x6a88('0x20')]('Content-Range',_0x4f6521+'-'+_0x4138f2+'/'+_0xb66b62)[_0x6a88('0x1d')](_0x200cf9);}return null;};}function patchUpdates(_0x431117){return function(_0xbc7656){try{jsonpatch[_0x6a88('0x21')](_0xbc7656,_0x431117,!![]);}catch(_0x37cd42){return BPromise[_0x6a88('0x22')](_0x37cd42);}return _0xbc7656[_0x6a88('0x23')]();};}function saveUpdates(_0xc75b65,_0x288245){return function(_0x5ea3ce){if(_0x5ea3ce){return _0x5ea3ce[_0x6a88('0x24')](_0xc75b65)[_0x6a88('0x25')](function(_0x55995b){return _0x55995b;});}return null;};}function removeEntity(_0x4e992c,_0x3b1c11){return function(_0x5ce154){if(_0x5ce154){return _0x5ce154[_0x6a88('0x26')]()[_0x6a88('0x25')](function(){_0x4e992c[_0x6a88('0x1b')](0xcc)[_0x6a88('0x1c')]();});}};}function handleEntityNotFound(_0x34d4af,_0x215cf5){return function(_0x3a8b8c){if(!_0x3a8b8c){_0x34d4af['sendStatus'](0x194);}return _0x3a8b8c;};}function handleError(_0x3019af,_0x16f4ca){_0x16f4ca=_0x16f4ca||0x1f4;return function(_0x2a5409){logger[_0x6a88('0x27')](_0x2a5409[_0x6a88('0x28')]);if(_0x2a5409['name']){delete _0x2a5409[_0x6a88('0x29')];}_0x3019af[_0x6a88('0x1b')](_0x16f4ca)['send'](_0x2a5409);};}exports[_0x6a88('0x2a')]=function(_0x57aaf4,_0xb0e869){var _0x5004be={},_0x1b87ff={},_0x58bb00={'count':0x0,'rows':[]};var _0x47a97c=_['map'](db[_0x6a88('0x2b')]['rawAttributes'],function(_0x1542fb){return{'name':_0x1542fb[_0x6a88('0x2c')],'type':_0x1542fb['type'][_0x6a88('0x2d')]};});_0x1b87ff[_0x6a88('0x2e')]=_[_0x6a88('0x2f')](_0x47a97c,'name');_0x1b87ff[_0x6a88('0x30')]=_[_0x6a88('0x31')](_0x57aaf4[_0x6a88('0x30')]);_0x1b87ff['filters']=_['intersection'](_0x1b87ff['model'],_0x1b87ff[_0x6a88('0x30')]);_0x5004be[_0x6a88('0x32')]=_[_0x6a88('0x33')](_0x1b87ff['model'],qs['fields'](_0x57aaf4[_0x6a88('0x30')][_0x6a88('0x34')]));_0x5004be[_0x6a88('0x32')]=_0x5004be[_0x6a88('0x32')]['length']?_0x5004be[_0x6a88('0x32')]:_0x1b87ff[_0x6a88('0x2e')];if(!_0x57aaf4[_0x6a88('0x30')][_0x6a88('0x35')](_0x6a88('0x36'))){_0x5004be[_0x6a88('0x1f')]=qs['limit'](_0x57aaf4['query']['limit']);_0x5004be[_0x6a88('0x1e')]=qs[_0x6a88('0x1e')](_0x57aaf4[_0x6a88('0x30')][_0x6a88('0x1e')]);}_0x5004be['order']=qs[_0x6a88('0x37')](_0x57aaf4[_0x6a88('0x30')][_0x6a88('0x37')]);_0x5004be[_0x6a88('0x38')]=qs[_0x6a88('0x39')](_['pick'](_0x57aaf4[_0x6a88('0x30')],_0x1b87ff['filters']),_0x47a97c);if(_0x57aaf4['query'][_0x6a88('0x3a')]){_0x5004be[_0x6a88('0x38')]=_[_0x6a88('0x3b')](_0x5004be['where'],{'$or':_['map'](_0x47a97c,function(_0x10ae8d){if(_0x10ae8d[_0x6a88('0x3c')]!==_0x6a88('0x3d')){var _0x34c4e6={};_0x34c4e6[_0x10ae8d[_0x6a88('0x29')]]={'$like':'%'+_0x57aaf4[_0x6a88('0x30')][_0x6a88('0x3a')]+'%'};return _0x34c4e6;}})});}_0x5004be=_[_0x6a88('0x3b')]({},_0x5004be,_0x57aaf4[_0x6a88('0x3e')]);var _0x3194ff={'where':_0x5004be['where']};return db[_0x6a88('0x2b')][_0x6a88('0x3f')](_0x3194ff)['then'](function(_0x4657fb){_0x58bb00[_0x6a88('0x3f')]=_0x4657fb;if(_0x57aaf4['query'][_0x6a88('0x40')]){_0x5004be[_0x6a88('0x41')]=[{'all':!![]}];}return db[_0x6a88('0x2b')][_0x6a88('0x42')](_0x5004be);})['then'](function(_0x1afa16){_0x58bb00[_0x6a88('0x43')]=_0x1afa16;return _0x58bb00;})[_0x6a88('0x25')](respondWithFilteredResult(_0xb0e869,_0x5004be))[_0x6a88('0x44')](handleError(_0xb0e869,null));};exports[_0x6a88('0x45')]=function(_0x473685,_0x2ac82c){var _0x1bf92f={'raw':!![],'where':{'id':_0x473685[_0x6a88('0x46')]['id']}},_0x26da7b={};_0x26da7b['model']=_[_0x6a88('0x31')](db[_0x6a88('0x2b')]['rawAttributes']);_0x26da7b['query']=_['keys'](_0x473685[_0x6a88('0x30')]);_0x26da7b[_0x6a88('0x39')]=_['intersection'](_0x26da7b[_0x6a88('0x2e')],_0x26da7b['query']);_0x1bf92f[_0x6a88('0x32')]=_['intersection'](_0x26da7b[_0x6a88('0x2e')],qs[_0x6a88('0x34')](_0x473685[_0x6a88('0x30')][_0x6a88('0x34')]));_0x1bf92f['attributes']=_0x1bf92f[_0x6a88('0x32')][_0x6a88('0x47')]?_0x1bf92f[_0x6a88('0x32')]:_0x26da7b[_0x6a88('0x2e')];if(_0x473685[_0x6a88('0x30')][_0x6a88('0x40')]){_0x1bf92f['include']=[{'all':!![]}];}_0x1bf92f=_[_0x6a88('0x3b')]({},_0x1bf92f,_0x473685[_0x6a88('0x3e')]);return db['WhatsappTransferReport']['find'](_0x1bf92f)['then'](handleEntityNotFound(_0x2ac82c,null))['then'](respondWithResult(_0x2ac82c,null))[_0x6a88('0x44')](handleError(_0x2ac82c,null));};exports[_0x6a88('0x48')]=function(_0x137b25,_0x2a4de8){return db[_0x6a88('0x2b')][_0x6a88('0x48')](_0x137b25[_0x6a88('0x49')],{})[_0x6a88('0x25')](respondWithResult(_0x2a4de8,0xc9))[_0x6a88('0x44')](handleError(_0x2a4de8,null));};exports[_0x6a88('0x24')]=function(_0x5a4eb2,_0x2e4958){if(_0x5a4eb2[_0x6a88('0x49')]['id']){delete _0x5a4eb2[_0x6a88('0x49')]['id'];}return db[_0x6a88('0x2b')][_0x6a88('0x4a')]({'where':{'id':_0x5a4eb2['params']['id']}})[_0x6a88('0x25')](handleEntityNotFound(_0x2e4958,null))['then'](saveUpdates(_0x5a4eb2['body'],null))[_0x6a88('0x25')](respondWithResult(_0x2e4958,null))[_0x6a88('0x44')](handleError(_0x2e4958,null));};exports['destroy']=function(_0x4404f6,_0x5a24fa){return db[_0x6a88('0x2b')][_0x6a88('0x4a')]({'where':{'id':_0x4404f6[_0x6a88('0x46')]['id']}})[_0x6a88('0x25')](handleEntityNotFound(_0x5a24fa,null))[_0x6a88('0x25')](removeEntity(_0x5a24fa,null))['catch'](handleError(_0x5a24fa,null));};exports[_0x6a88('0x4b')]=function(_0x1d1a09,_0x49311e){return db[_0x6a88('0x2b')][_0x6a88('0x4b')]()[_0x6a88('0x25')](respondWithResult(_0x49311e,null))[_0x6a88('0x44')](handleError(_0x49311e,null));}; \ No newline at end of file +var _0x84b1=['body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','then','error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','fields','find','create'];(function(_0x4b7af6,_0x2bb0cd){var _0x4215b5=function(_0x3572cc){while(--_0x3572cc){_0x4b7af6['push'](_0x4b7af6['shift']());}};_0x4215b5(++_0x2bb0cd);}(_0x84b1,0x175));var _0x184b=function(_0x553a80,_0x236521){_0x553a80=_0x553a80-0x0;var _0x31fb9f=_0x84b1[_0x553a80];return _0x31fb9f;};'use strict';var pdf=require(_0x184b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x184b('0x1'));var zipdir=require(_0x184b('0x2'));var jsonpatch=require(_0x184b('0x3'));var rp=require(_0x184b('0x4'));var moment=require(_0x184b('0x5'));var BPromise=require(_0x184b('0x6'));var Mustache=require('mustache');var util=require(_0x184b('0x7'));var path=require(_0x184b('0x8'));var sox=require(_0x184b('0x9'));var csv=require(_0x184b('0xa'));var ejs=require(_0x184b('0xb'));var fs=require('fs');var _=require(_0x184b('0xc'));var squel=require(_0x184b('0xd'));var crypto=require(_0x184b('0xe'));var jsforce=require(_0x184b('0xf'));var deskjs=require(_0x184b('0x10'));var toCsv=require(_0x184b('0xa'));var querystring=require('querystring');var Papa=require(_0x184b('0x11'));var Redis=require('ioredis');var authService=require(_0x184b('0x12'));var qs=require(_0x184b('0x13'));var as=require(_0x184b('0x14'));var hardwareService=require(_0x184b('0x15'));var logger=require(_0x184b('0x16'))(_0x184b('0x17'));var utils=require(_0x184b('0x18'));var config=require('../../config/environment');var db=require(_0x184b('0x19'))['db'];function respondWithStatusCode(_0x47d415,_0x7a57de){_0x7a57de=_0x7a57de||0xcc;return function(_0x4a1317){if(_0x4a1317){return _0x47d415[_0x184b('0x1a')](_0x7a57de);}return _0x47d415[_0x184b('0x1b')](_0x7a57de)[_0x184b('0x1c')]();};}function respondWithResult(_0x6cb3db,_0x27b851){_0x27b851=_0x27b851||0xc8;return function(_0x4532f5){if(_0x4532f5){return _0x6cb3db[_0x184b('0x1b')](_0x27b851)[_0x184b('0x1d')](_0x4532f5);}};}function respondWithFilteredResult(_0x2578e7,_0x108842){return function(_0x4f7fc8){if(_0x4f7fc8){var _0x1b024b=_0x4f7fc8[_0x184b('0x1e')],_0x3b7f9b=_0x108842[_0x184b('0x1f')],_0x44014f=_0x108842[_0x184b('0x1f')]+_0x108842['limit'],_0x2cc16f;if(_0x44014f>=_0x1b024b){_0x44014f=_0x1b024b;_0x2cc16f=0xc8;}else{_0x2cc16f=0xce;}_0x2578e7[_0x184b('0x1b')](_0x2cc16f);return _0x2578e7[_0x184b('0x20')](_0x184b('0x21'),_0x3b7f9b+'-'+_0x44014f+'/'+_0x1b024b)[_0x184b('0x1d')](_0x4f7fc8);}return null;};}function patchUpdates(_0x132a0c){return function(_0xfd01ff){try{jsonpatch[_0x184b('0x22')](_0xfd01ff,_0x132a0c,!![]);}catch(_0x42597c){return BPromise['reject'](_0x42597c);}return _0xfd01ff['save']();};}function saveUpdates(_0x201a15,_0x3dc1b2){return function(_0x1daf01){if(_0x1daf01){return _0x1daf01['update'](_0x201a15)[_0x184b('0x23')](function(_0x4e58d5){return _0x4e58d5;});}return null;};}function removeEntity(_0x13631b,_0x3164b4){return function(_0x3c7e40){if(_0x3c7e40){return _0x3c7e40['destroy']()[_0x184b('0x23')](function(){_0x13631b['status'](0xcc)[_0x184b('0x1c')]();});}};}function handleEntityNotFound(_0x1285f7,_0x2df2af){return function(_0x1e3d32){if(!_0x1e3d32){_0x1285f7[_0x184b('0x1a')](0x194);}return _0x1e3d32;};}function handleError(_0x355175,_0x4ee600){_0x4ee600=_0x4ee600||0x1f4;return function(_0x52fdb0){logger[_0x184b('0x24')](_0x52fdb0['stack']);if(_0x52fdb0[_0x184b('0x25')]){delete _0x52fdb0['name'];}_0x355175[_0x184b('0x1b')](_0x4ee600)[_0x184b('0x26')](_0x52fdb0);};}exports['index']=function(_0x8e0ef3,_0x51c296){var _0x3a1562={},_0x135d94={},_0x3b8e8d={'count':0x0,'rows':[]};var _0x34b3e6=_[_0x184b('0x27')](db[_0x184b('0x28')][_0x184b('0x29')],function(_0x33165b){return{'name':_0x33165b[_0x184b('0x2a')],'type':_0x33165b['type'][_0x184b('0x2b')]};});_0x135d94[_0x184b('0x2c')]=_['map'](_0x34b3e6,_0x184b('0x25'));_0x135d94[_0x184b('0x2d')]=_['keys'](_0x8e0ef3[_0x184b('0x2d')]);_0x135d94[_0x184b('0x2e')]=_[_0x184b('0x2f')](_0x135d94[_0x184b('0x2c')],_0x135d94['query']);_0x3a1562[_0x184b('0x30')]=_[_0x184b('0x2f')](_0x135d94[_0x184b('0x2c')],qs['fields'](_0x8e0ef3[_0x184b('0x2d')]['fields']));_0x3a1562[_0x184b('0x30')]=_0x3a1562['attributes'][_0x184b('0x31')]?_0x3a1562[_0x184b('0x30')]:_0x135d94[_0x184b('0x2c')];if(!_0x8e0ef3[_0x184b('0x2d')][_0x184b('0x32')](_0x184b('0x33'))){_0x3a1562[_0x184b('0x34')]=qs[_0x184b('0x34')](_0x8e0ef3['query'][_0x184b('0x34')]);_0x3a1562['offset']=qs[_0x184b('0x1f')](_0x8e0ef3['query'][_0x184b('0x1f')]);}_0x3a1562[_0x184b('0x35')]=qs[_0x184b('0x36')](_0x8e0ef3['query'][_0x184b('0x36')]);_0x3a1562['where']=qs[_0x184b('0x2e')](_[_0x184b('0x37')](_0x8e0ef3['query'],_0x135d94['filters']),_0x34b3e6);if(_0x8e0ef3['query'][_0x184b('0x38')]){_0x3a1562[_0x184b('0x39')]=_['merge'](_0x3a1562[_0x184b('0x39')],{'$or':_[_0x184b('0x27')](_0x34b3e6,function(_0x1d5120){if(_0x1d5120[_0x184b('0x3a')]!==_0x184b('0x3b')){var _0x24ffd6={};_0x24ffd6[_0x1d5120['name']]={'$like':'%'+_0x8e0ef3[_0x184b('0x2d')][_0x184b('0x38')]+'%'};return _0x24ffd6;}})});}_0x3a1562=_[_0x184b('0x3c')]({},_0x3a1562,_0x8e0ef3[_0x184b('0x3d')]);var _0x4c5d36={'where':_0x3a1562['where']};return db['WhatsappTransferReport'][_0x184b('0x1e')](_0x4c5d36)[_0x184b('0x23')](function(_0x5a4812){_0x3b8e8d[_0x184b('0x1e')]=_0x5a4812;if(_0x8e0ef3[_0x184b('0x2d')][_0x184b('0x3e')]){_0x3a1562[_0x184b('0x3f')]=[{'all':!![]}];}return db[_0x184b('0x28')][_0x184b('0x40')](_0x3a1562);})[_0x184b('0x23')](function(_0x288cb3){_0x3b8e8d['rows']=_0x288cb3;return _0x3b8e8d;})[_0x184b('0x23')](respondWithFilteredResult(_0x51c296,_0x3a1562))[_0x184b('0x41')](handleError(_0x51c296,null));};exports[_0x184b('0x42')]=function(_0x5294f0,_0x4632b3){var _0x48bea8={'raw':!![],'where':{'id':_0x5294f0[_0x184b('0x43')]['id']}},_0x5a59bb={};_0x5a59bb[_0x184b('0x2c')]=_['keys'](db[_0x184b('0x28')][_0x184b('0x29')]);_0x5a59bb[_0x184b('0x2d')]=_['keys'](_0x5294f0[_0x184b('0x2d')]);_0x5a59bb[_0x184b('0x2e')]=_['intersection'](_0x5a59bb['model'],_0x5a59bb[_0x184b('0x2d')]);_0x48bea8[_0x184b('0x30')]=_[_0x184b('0x2f')](_0x5a59bb[_0x184b('0x2c')],qs[_0x184b('0x44')](_0x5294f0[_0x184b('0x2d')][_0x184b('0x44')]));_0x48bea8[_0x184b('0x30')]=_0x48bea8[_0x184b('0x30')][_0x184b('0x31')]?_0x48bea8[_0x184b('0x30')]:_0x5a59bb['model'];if(_0x5294f0[_0x184b('0x2d')]['includeAll']){_0x48bea8[_0x184b('0x3f')]=[{'all':!![]}];}_0x48bea8=_['merge']({},_0x48bea8,_0x5294f0[_0x184b('0x3d')]);return db[_0x184b('0x28')][_0x184b('0x45')](_0x48bea8)[_0x184b('0x23')](handleEntityNotFound(_0x4632b3,null))[_0x184b('0x23')](respondWithResult(_0x4632b3,null))[_0x184b('0x41')](handleError(_0x4632b3,null));};exports[_0x184b('0x46')]=function(_0x102007,_0x2e3fc2){return db['WhatsappTransferReport'][_0x184b('0x46')](_0x102007[_0x184b('0x47')],{})['then'](respondWithResult(_0x2e3fc2,0xc9))[_0x184b('0x41')](handleError(_0x2e3fc2,null));};exports['update']=function(_0x2ba8df,_0x558495){if(_0x2ba8df[_0x184b('0x47')]['id']){delete _0x2ba8df[_0x184b('0x47')]['id'];}return db[_0x184b('0x28')][_0x184b('0x45')]({'where':{'id':_0x2ba8df[_0x184b('0x43')]['id']}})['then'](handleEntityNotFound(_0x558495,null))['then'](saveUpdates(_0x2ba8df[_0x184b('0x47')],null))[_0x184b('0x23')](respondWithResult(_0x558495,null))[_0x184b('0x41')](handleError(_0x558495,null));};exports[_0x184b('0x48')]=function(_0x2caa9,_0x3b52f6){return db['WhatsappTransferReport'][_0x184b('0x45')]({'where':{'id':_0x2caa9[_0x184b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b52f6,null))[_0x184b('0x23')](removeEntity(_0x3b52f6,null))[_0x184b('0x41')](handleError(_0x3b52f6,null));};exports['describe']=function(_0x4f387c,_0x196f41){return db[_0x184b('0x28')][_0x184b('0x49')]()[_0x184b('0x23')](respondWithResult(_0x196f41,null))[_0x184b('0x41')](handleError(_0x196f41,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 241d0fd..9412093 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 _0xc990=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x2ec589,_0x3e9afa){var _0x3c203c=function(_0x1d207b){while(--_0x1d207b){_0x2ec589['push'](_0x2ec589['shift']());}};_0x3c203c(++_0x3e9afa);}(_0xc990,0x1ef));var _0x0c99=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc990[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x0c99('0x0'));var util=require('util');var logger=require(_0x0c99('0x1'))('api');var moment=require(_0x0c99('0x2'));var BPromise=require(_0x0c99('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c99('0x4'));var rimraf=require(_0x0c99('0x5'));var config=require(_0x0c99('0x6'));var attributes=require(_0x0c99('0x7'));module[_0x0c99('0x8')]=function(_0x3f3304,_0x37ffc1){return _0x3f3304['define'](_0x0c99('0x9'),attributes,{'tableName':_0x0c99('0xa'),'paranoid':![],'indexes':[{'name':_0x0c99('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x52a9=['report_whatsapp_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','WhatsappTransferReport'];(function(_0x17e0f1,_0x3e789b){var _0x59f804=function(_0xf9a62f){while(--_0xf9a62f){_0x17e0f1['push'](_0x17e0f1['shift']());}};_0x59f804(++_0x3e789b);}(_0x52a9,0xa7));var _0x952a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x52a9[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x952a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x952a('0x1'));var moment=require(_0x952a('0x2'));var BPromise=require(_0x952a('0x3'));var rp=require(_0x952a('0x4'));var fs=require('fs');var path=require(_0x952a('0x5'));var rimraf=require(_0x952a('0x6'));var config=require('../../config/environment');var attributes=require(_0x952a('0x7'));module['exports']=function(_0x41b2ff,_0x257a6f){return _0x41b2ff['define'](_0x952a('0x8'),attributes,{'tableName':_0x952a('0x9'),'paranoid':![],'indexes':[{'name':_0x952a('0xa'),'fields':[_0x952a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 686ce0c..cc3a98e 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(_0x32e129,_0x27a6d0){var _0x4b74fd=function(_0x595f57){while(--_0x595f57){_0x32e129['push'](_0x32e129['shift']());}};_0x4b74fd(++_0x27a6d0);}(_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 +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(_0xa8630c,_0x433a76){var _0x5e0071=function(_0x31a468){while(--_0x31a468){_0xa8630c['push'](_0xa8630c['shift']());}};_0x5e0071(++_0x433a76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 637ca7a..f28d712 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2291=['start','map','filter','name','join','Offline\x20apps:','status','online','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info'];(function(_0xbcea1,_0x469f9f){var _0x17fb47=function(_0x48f5e7){while(--_0x48f5e7){_0xbcea1['push'](_0xbcea1['shift']());}};_0x17fb47(++_0x469f9f);}(_0x2291,0xee));var _0x1229=function(_0x346caa,_0x46888d){_0x346caa=_0x346caa-0x0;var _0x1f4548=_0x2291[_0x346caa];return _0x1f4548;};'use strict';var _=require(_0x1229('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x1229('0x1'));var config=require('./config/environment');var logger=require('./config/logger')(_0x1229('0x2'));var pm2=require(_0x1229('0x3'));var pm2Config=require(_0x1229('0x4'));var schedule=require('./config/schedule');var chat=require(_0x1229('0x5'));var transcribe=require(_0x1229('0x6'));function main(){return mysqldb['db'][_0x1229('0x7')][_0x1229('0x8')]()[_0x1229('0x9')](function(){return rpc[_0x1229('0xa')]();})['then'](function(_0x910ca4){logger[_0x1229('0xb')](_0x910ca4);return chat[_0x1229('0xc')]();})['then'](function(){return schedule[_0x1229('0xc')]();})[_0x1229('0x9')](function(){return transcribe[_0x1229('0xc')]();})[_0x1229('0x9')](function(_0x33995c){logger[_0x1229('0xb')](_0x33995c);return pm2['start'](pm2Config);})[_0x1229('0x9')](function(_0x70dae8){logger[_0x1229('0xb')]('Online\x20apps:',_[_0x1229('0xd')](_[_0x1229('0xe')](_0x70dae8,{'status':'online'}),_0x1229('0xf'))[_0x1229('0x10')]());logger['info'](_0x1229('0x11'),_['map'](_['filter'](_0x70dae8,function(_0x2dcc22){return _0x2dcc22[_0x1229('0x12')]!==_0x1229('0x13');}),_0x1229('0xf'))[_0x1229('0x10')]()||'None');config[_0x1229('0x14')]&&require(_0x1229('0x15'))[_0x1229('0x16')]();require(_0x1229('0x17'))[_0x1229('0x16')]();})['catch'](function(_0x4d9996){logger['error'](_0x1229('0x18'),_0x4d9996);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xd4ba=['listen','start','info','Online\x20apps:','filter','online','name','join','Offline\x20apps:','status','None','seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','then'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xd4ba,0x1a7));var _0xad4b=function(_0x31e5b6,_0x41fe1f){_0x31e5b6=_0x31e5b6-0x0;var _0x3e41bd=_0xd4ba[_0x31e5b6];return _0x3e41bd;};'use strict';var _=require(_0xad4b('0x0'));var mysqldb=require(_0xad4b('0x1'));var rpc=require(_0xad4b('0x2'));var config=require(_0xad4b('0x3'));var logger=require(_0xad4b('0x4'))(_0xad4b('0x5'));var pm2=require(_0xad4b('0x6'));var pm2Config=require(_0xad4b('0x7'));var schedule=require(_0xad4b('0x8'));var chat=require(_0xad4b('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xad4b('0xa')]['sync']()[_0xad4b('0xb')](function(){return rpc[_0xad4b('0xc')]();})[_0xad4b('0xb')](function(_0x421c1d){logger['info'](_0x421c1d);return chat[_0xad4b('0xd')]();})[_0xad4b('0xb')](function(){return schedule[_0xad4b('0xd')]();})['then'](function(){return transcribe[_0xad4b('0xd')]();})['then'](function(_0x548cef){logger[_0xad4b('0xe')](_0x548cef);return pm2[_0xad4b('0xd')](pm2Config);})['then'](function(_0x47dc51){logger[_0xad4b('0xe')](_0xad4b('0xf'),_['map'](_[_0xad4b('0x10')](_0x47dc51,{'status':_0xad4b('0x11')}),_0xad4b('0x12'))[_0xad4b('0x13')]());logger['info'](_0xad4b('0x14'),_['map'](_[_0xad4b('0x10')](_0x47dc51,function(_0x18170c){return _0x18170c[_0xad4b('0x15')]!=='online';}),'name')[_0xad4b('0x13')]()||_0xad4b('0x16'));config[_0xad4b('0x17')]&&require('./config/seedDB')[_0xad4b('0x18')]();require(_0xad4b('0x19'))[_0xad4b('0x18')]();})[_0xad4b('0x1a')](function(_0x3af9dc){logger[_0xad4b('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3af9dc);process[_0xad4b('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8fda04a..9c1632a 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 _0x02c8=['userpic','permissions','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','authorization','find','name','then','authenticate','pass','Wrong\x20credentials.','headers','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','../../config/license/util','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','internal','email'];(function(_0x521236,_0x124287){var _0x3dbf7a=function(_0x11957e){while(--_0x11957e){_0x521236['push'](_0x521236['shift']());}};_0x3dbf7a(++_0x124287);}(_0x02c8,0x16d));var _0x802c=function(_0x17908f,_0xf4a348){_0x17908f=_0x17908f-0x0;var _0x4e5d82=_0x02c8[_0x17908f];return _0x4e5d82;};'use strict';var db=require(_0x802c('0x0'))['db'];var config=require(_0x802c('0x1'));var hardwareConf=require(_0x802c('0x2'));var _=require(_0x802c('0x3'));var jwt=require(_0x802c('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x802c('0x5'));var basicAuth=require(_0x802c('0x6'));var crypto=require(_0x802c('0x7'));var BPromise=require(_0x802c('0x8'));var validateJwt=expressJwt({'secret':config[_0x802c('0x9')][_0x802c('0xa')]});var userAttributes=['id',_0x802c('0xb'),_0x802c('0xc'),'name',_0x802c('0xd'),_0x802c('0xe'),_0x802c('0xf'),_0x802c('0x10'),'md5secret','voicePause',_0x802c('0x11'),_0x802c('0x12'),_0x802c('0x13'),_0x802c('0x14'),'openchannelPause','pauseType',_0x802c('0x15'),_0x802c('0x16'),'lastPauseAt',_0x802c('0x17'),_0x802c('0x18'),_0x802c('0x19'),'alias',_0x802c('0x1a'),_0x802c('0x1b'),_0x802c('0x1c'),_0x802c('0x1d'),_0x802c('0x1e'),'phoneBarEnableSettings',_0x802c('0x1f'),_0x802c('0x20'),_0x802c('0x21'),_0x802c('0x22'),_0x802c('0x23'),_0x802c('0x24'),'userProfileId'];exports[_0x802c('0x25')]=function(){return this[_0x802c('0x26')](!![])[_0x802c('0x27')](function(_0x3c39ff,_0x522dc8,_0x1b2d93){if(_0x3c39ff[_0x802c('0x28')]){_0x1b2d93();}else{return db[_0x802c('0x29')][_0x802c('0x2a')]({'where':{'id':_0x3c39ff[_0x802c('0x2b')]['id']},'attributes':['id',_0x802c('0x2c'),_0x802c('0x2d')],'raw':!![]})['then'](function(_0x1d8fe5){if(_0x1d8fe5&&_0x1d8fe5['closed']){return _0x522dc8[_0x802c('0x2e')](_0x1d8fe5[_0x802c('0x2d')]===_0x802c('0x2f')?0x195:0x193)[_0x802c('0x30')]({'message':_0x1d8fe5[_0x802c('0x2d')]===_0x802c('0x2f')?_0x802c('0x31'):_0x802c('0x32')});}else{_0x1b2d93();}})[_0x802c('0x33')](function(_0x310330){_0x1b2d93(_0x310330);});}});};exports[_0x802c('0x26')]=function isAuthenticated(_0x1e2a5f){return compose()[_0x802c('0x27')](function(_0x104ef6,_0x205c88,_0x59e091){if(_0x104ef6['headers']['authorization']){if(_[_0x802c('0x34')](_0x104ef6['headers'][_0x802c('0x35')],'Basic')){var _0x47c2f1=basicAuth(_0x104ef6);db['User'][_0x802c('0x36')]({'where':{'name':_0x47c2f1[_0x802c('0x37')]}})[_0x802c('0x38')](function(_0x3a6507){if(!_0x3a6507||!_0x3a6507[_0x802c('0x39')](_0x47c2f1[_0x802c('0x3a')])){return _0x205c88[_0x802c('0x2e')](0x191)[_0x802c('0x30')]({'message':_0x802c('0x3b')});}_0x104ef6[_0x802c('0x28')]={'id':_0x3a6507['id']};_0x59e091();})['catch'](function(_0x15f728){_0x59e091(_0x15f728);});}else if(_[_0x802c('0x34')](_0x104ef6[_0x802c('0x3c')][_0x802c('0x35')],_0x802c('0x3d'))){validateJwt(_0x104ef6,_0x205c88,_0x59e091);}else{if(_0x1e2a5f){_0x59e091();}else{return _0x205c88[_0x802c('0x2e')](0x193)[_0x802c('0x30')]({'message':_0x802c('0x3e')});}}}else if(_0x104ef6[_0x802c('0x3f')][_0x802c('0x40')]){try{var _0x5a4671={'audience':hardwareConf[_0x802c('0x41')](),'issuer':hardwareConf[_0x802c('0x41')]()};verifyJwt(_0x104ef6[_0x802c('0x3f')][_0x802c('0x40')],_0x5a4671)[_0x802c('0x38')](function(_0xe6ffa5){return db[_0x802c('0x42')][_0x802c('0x36')]({'where':{'id':_0xe6ffa5['sub']}})[_0x802c('0x38')](function(_0xd63c37){if(!_0xd63c37||!_['isEqual'](_0xd63c37[_0x802c('0x43')],_0xe6ffa5['nonce'])){return _0x205c88[_0x802c('0x2e')](0x191)[_0x802c('0x30')]({'message':_0x802c('0x44')});}_0x104ef6[_0x802c('0x28')]={'id':_0xd63c37['id']};_0x59e091();});})['catch'](function(){return _0x205c88[_0x802c('0x2e')](0x191)[_0x802c('0x30')]({'message':_0x802c('0x45')});});}catch(_0x1a99c5){_0x59e091(_0x1a99c5);}}else if(_0x1e2a5f){_0x59e091();}else{return _0x205c88['status'](0x193)[_0x802c('0x30')]({'message':_0x802c('0x3e')});}})[_0x802c('0x27')](function(_0x35eeab,_0x3b68ed,_0x2636a0){if(_0x35eeab[_0x802c('0x28')]){db['User'][_0x802c('0x36')]({'where':{'id':_0x35eeab[_0x802c('0x28')]['id']},'attributes':userAttributes})['then'](function(_0xe36ef8){if(!_0xe36ef8){return _0x3b68ed[_0x802c('0x2e')](0x194)[_0x802c('0x30')]({'message':'User\x20not\x20found.'});}_0x35eeab[_0x802c('0x28')]=_0xe36ef8;_0x2636a0();})[_0x802c('0x33')](function(_0x3d8c17){_0x2636a0(_0x3d8c17);});}else if(_0x1e2a5f){_0x2636a0();}else{return _0x3b68ed[_0x802c('0x2e')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x802c('0x27')](function(_0x3192ec,_0x180646,_0x158ce4){return require(_0x802c('0x46'))['getLicense']()[_0x802c('0x38')](function(_0x2bb923){if(_0x2bb923[_0x802c('0x47')]){_0x158ce4();}else{return _0x180646[_0x802c('0x2e')](0x193)[_0x802c('0x30')]({'message':_0x802c('0x48')});}})['catch'](function(_0x451e35){_0x158ce4(_0x451e35);});});};exports['isMiddleware']=function(_0x48fc1e,_0x5000eb,_0x95ceb1){_0x48fc1e[_0x802c('0x49')]=!![];return _0x95ceb1();};exports[_0x802c('0x4a')]=function signToken(_0x47bbb8){return signJwt(_0x47bbb8);};exports['setTokenCookie']=function(_0x39921a,_0x4470c9){if(!_0x39921a['user']){return _0x4470c9[_0x802c('0x2e')](0x194)[_0x802c('0x30')]({'message':_0x802c('0x4b')});}var _0x1b5c72={'payload':{'id':_0x39921a[_0x802c('0x28')]['id'],'role':_0x39921a['user'][_0x802c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1b5c72)[_0x802c('0x38')](function(_0x3232c4){_0x4470c9['cookie'](_0x802c('0x4c'),_0x3232c4);_0x4470c9[_0x802c('0x4d')]('/dashboards/general');})[_0x802c('0x33')](function(_0x5ec462){return _0x4470c9['status'](0x1f4)[_0x802c('0x4e')](_0x5ec462);});};exports[_0x802c('0x4f')]=function(_0x507e5a){if(_['isNil'](_0x507e5a[_0x802c('0x43')])||_[_0x802c('0x50')](_0x507e5a[_0x802c('0x51')])){return null;}else{return createJwt(_0x507e5a);}};exports[_0x802c('0x52')]=function(_0x5c81f2){_0x5c81f2[_0x802c('0x43')]=generateNonce();_0x5c81f2[_0x802c('0x51')]=generateIssuedAt();return createJwt(_0x5c81f2);};exports[_0x802c('0x53')]=function(_0x202268,_0x1747b0){var _0x1d19eb=_0x202268[_0x802c('0x3f')][_0x802c('0x40')];if(_0x1d19eb){var _0x3ab2e6={'nonce':_0x1747b0[_0x802c('0x43')],'iat':_0x1747b0['apiKeyIat'],'audience':hardwareConf[_0x802c('0x41')](),'issuer':hardwareConf[_0x802c('0x41')]()};return verifyJwt(_0x1d19eb,_0x3ab2e6)[_0x802c('0x38')](function(){return generateApiKey(_0x1747b0);});}else{throw{'message':_0x802c('0x54')};}};function signJwt(_0x4f923b){var _0x1ea994=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x38ef86=_0x4f923b[_0x802c('0x55')]||config['secrets'][_0x802c('0xa')];return new BPromise(function(_0x3ab19e,_0xf53d45){_0x1ea994(_0x4f923b[_0x802c('0x56')],_0x38ef86,_0x4f923b[_0x802c('0x57')])[_0x802c('0x38')](function(_0x5f306b){_0x3ab19e(_0x5f306b);})['catch'](function(_0xb2738f){_0xf53d45(_0xb2738f);});});}function verifyJwt(_0x20d56a,_0x571705,_0x25db95){var _0x232f3d=BPromise['promisify'](jwt[_0x802c('0x58')],{'context':jwt});var _0x35469a=_0x25db95||config[_0x802c('0x9')][_0x802c('0xa')];return new BPromise(function(_0x1e7bbe,_0xd289d1){_0x232f3d(_0x20d56a,_0x35469a,_0x571705)[_0x802c('0x38')](function(_0x3a99c2){_0x1e7bbe(_0x3a99c2);})[_0x802c('0x33')](function(_0x111afc){_0xd289d1(_0x111afc);});});}function generateNonce(){return crypto[_0x802c('0x59')](0x10)[_0x802c('0x5a')](_0x802c('0x5b'));}function generateIssuedAt(){return Math[_0x802c('0x5c')](Date[_0x802c('0x5d')]()/0x3e8)['toString']();}function createJwt(_0x1f1fd9){var _0x10bd7c={'payload':{'iat':_0x1f1fd9['apiKeyIat'],'nonce':_0x1f1fd9['apiKeyNonce']},'options':{'algorithm':_0x802c('0x5e'),'subject':_0x1f1fd9['id'][_0x802c('0x5a')](),'issuer':hardwareConf[_0x802c('0x41')](),'audience':hardwareConf[_0x802c('0x41')]()}};return signJwt(_0x10bd7c)[_0x802c('0x38')](function(_0x568a3f){return{'iat':_0x1f1fd9[_0x802c('0x51')],'nonce':_0x1f1fd9['apiKeyNonce'],'token':_0x568a3f};});} \ No newline at end of file +var _0x8048=['apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','options','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','basic-auth','crypto','secrets','session','role','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','isAuthenticated','use','user','ChatInteraction','params','disposition','closed','status','unmanaged','json','startsWith','name','then','authenticate','pass','Wrong\x20credentials.','catch','authorization','Bearer','query','apikey','getUuid','User','find','sub'];(function(_0x2a92f6,_0x56fd62){var _0x66b923=function(_0x49bc92){while(--_0x49bc92){_0x2a92f6['push'](_0x2a92f6['shift']());}};_0x66b923(++_0x56fd62);}(_0x8048,0x199));var _0x8804=function(_0x526997,_0x38c441){_0x526997=_0x526997-0x0;var _0x454b68=_0x8048[_0x526997];return _0x454b68;};'use strict';var db=require(_0x8804('0x0'))['db'];var config=require(_0x8804('0x1'));var hardwareConf=require(_0x8804('0x2'));var _=require(_0x8804('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x8804('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x8804('0x5'));var crypto=require(_0x8804('0x6'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0x8804('0x7')][_0x8804('0x8')]});var userAttributes=['id',_0x8804('0x9'),'fullname','name',_0x8804('0xa'),_0x8804('0xb'),_0x8804('0xc'),'permissions',_0x8804('0xd'),_0x8804('0xe'),_0x8804('0xf'),_0x8804('0x10'),'faxPause',_0x8804('0x11'),_0x8804('0x12'),_0x8804('0x13'),_0x8804('0x14'),_0x8804('0x15'),_0x8804('0x16'),'crudPermissions',_0x8804('0x17'),_0x8804('0x18'),'alias',_0x8804('0x19'),_0x8804('0x1a'),_0x8804('0x1b'),_0x8804('0x1c'),_0x8804('0x1d'),_0x8804('0x1e'),_0x8804('0x1f'),_0x8804('0x20'),_0x8804('0x21'),'phoneBarRemoteControlPort',_0x8804('0x22'),'interface',_0x8804('0x23')];exports['isChatInteractionAuthorized']=function(){return this[_0x8804('0x24')](!![])[_0x8804('0x25')](function(_0x2e6266,_0x439222,_0x578912){if(_0x2e6266[_0x8804('0x26')]){_0x578912();}else{return db[_0x8804('0x27')]['findOne']({'where':{'id':_0x2e6266[_0x8804('0x28')]['id']},'attributes':['id','closed',_0x8804('0x29')],'raw':!![]})['then'](function(_0x4c0a3b){if(_0x4c0a3b&&_0x4c0a3b[_0x8804('0x2a')]){return _0x439222[_0x8804('0x2b')](_0x4c0a3b[_0x8804('0x29')]===_0x8804('0x2c')?0x195:0x193)[_0x8804('0x2d')]({'message':_0x4c0a3b[_0x8804('0x29')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x578912();}})['catch'](function(_0x53f520){_0x578912(_0x53f520);});}});};exports[_0x8804('0x24')]=function isAuthenticated(_0x2b915){return compose()['use'](function(_0x1e097f,_0x6e721b,_0x4b9c4a){if(_0x1e097f['headers']['authorization']){if(_[_0x8804('0x2e')](_0x1e097f['headers']['authorization'],'Basic')){var _0x1e013e=basicAuth(_0x1e097f);db['User']['find']({'where':{'name':_0x1e013e[_0x8804('0x2f')]}})[_0x8804('0x30')](function(_0x1edb69){if(!_0x1edb69||!_0x1edb69[_0x8804('0x31')](_0x1e013e[_0x8804('0x32')])){return _0x6e721b[_0x8804('0x2b')](0x191)[_0x8804('0x2d')]({'message':_0x8804('0x33')});}_0x1e097f[_0x8804('0x26')]={'id':_0x1edb69['id']};_0x4b9c4a();})[_0x8804('0x34')](function(_0x15c6e5){_0x4b9c4a(_0x15c6e5);});}else if(_[_0x8804('0x2e')](_0x1e097f['headers'][_0x8804('0x35')],_0x8804('0x36'))){validateJwt(_0x1e097f,_0x6e721b,_0x4b9c4a);}else{if(_0x2b915){_0x4b9c4a();}else{return _0x6e721b['status'](0x193)[_0x8804('0x2d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1e097f[_0x8804('0x37')][_0x8804('0x38')]){try{var _0x4d71e2={'audience':hardwareConf[_0x8804('0x39')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1e097f[_0x8804('0x37')][_0x8804('0x38')],_0x4d71e2)['then'](function(_0x1ed4ad){return db[_0x8804('0x3a')][_0x8804('0x3b')]({'where':{'id':_0x1ed4ad[_0x8804('0x3c')]}})[_0x8804('0x30')](function(_0x30cd6e){if(!_0x30cd6e||!_['isEqual'](_0x30cd6e[_0x8804('0x3d')],_0x1ed4ad[_0x8804('0x3e')])){return _0x6e721b[_0x8804('0x2b')](0x191)[_0x8804('0x2d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x1e097f[_0x8804('0x26')]={'id':_0x30cd6e['id']};_0x4b9c4a();});})[_0x8804('0x34')](function(){return _0x6e721b[_0x8804('0x2b')](0x191)[_0x8804('0x2d')]({'message':_0x8804('0x3f')});});}catch(_0x41aefe){_0x4b9c4a(_0x41aefe);}}else if(_0x2b915){_0x4b9c4a();}else{return _0x6e721b['status'](0x193)[_0x8804('0x2d')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x2e9b83,_0x20ae19,_0x31b6fd){if(_0x2e9b83[_0x8804('0x26')]){db[_0x8804('0x3a')][_0x8804('0x3b')]({'where':{'id':_0x2e9b83[_0x8804('0x26')]['id']},'attributes':userAttributes})[_0x8804('0x30')](function(_0x4cda83){if(!_0x4cda83){return _0x20ae19[_0x8804('0x2b')](0x194)['json']({'message':_0x8804('0x40')});}_0x2e9b83[_0x8804('0x26')]=_0x4cda83;_0x31b6fd();})['catch'](function(_0x281821){_0x31b6fd(_0x281821);});}else if(_0x2b915){_0x31b6fd();}else{return _0x20ae19[_0x8804('0x2b')](0x194)[_0x8804('0x2d')]({'message':_0x8804('0x41')});}});};exports[_0x8804('0x42')]=function canUpdate(){return compose()[_0x8804('0x25')](function(_0x585fee,_0x24442f,_0x2364b9){return require(_0x8804('0x43'))[_0x8804('0x44')]()[_0x8804('0x30')](function(_0x574059){if(_0x574059[_0x8804('0x45')]){_0x2364b9();}else{return _0x24442f[_0x8804('0x2b')](0x193)[_0x8804('0x2d')]({'message':_0x8804('0x46')});}})['catch'](function(_0x4bd383){_0x2364b9(_0x4bd383);});});};exports['isMiddleware']=function(_0x328395,_0x472ad6,_0x52458d){_0x328395[_0x8804('0x47')]=!![];return _0x52458d();};exports['signToken']=function signToken(_0x3f8fa0){return signJwt(_0x3f8fa0);};exports[_0x8804('0x48')]=function(_0x3e4bdb,_0xa50c13){if(!_0x3e4bdb[_0x8804('0x26')]){return _0xa50c13[_0x8804('0x2b')](0x194)[_0x8804('0x2d')]({'message':_0x8804('0x49')});}var _0xdd35fc={'payload':{'id':_0x3e4bdb[_0x8804('0x26')]['id'],'role':_0x3e4bdb[_0x8804('0x26')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xdd35fc)[_0x8804('0x30')](function(_0x2989d9){_0xa50c13[_0x8804('0x4a')](_0x8804('0x4b'),_0x2989d9);_0xa50c13['redirect'](_0x8804('0x4c'));})[_0x8804('0x34')](function(_0x220a87){return _0xa50c13[_0x8804('0x2b')](0x1f4)[_0x8804('0x4d')](_0x220a87);});};exports[_0x8804('0x4e')]=function(_0x43109c){if(_[_0x8804('0x4f')](_0x43109c['apiKeyNonce'])||_[_0x8804('0x4f')](_0x43109c[_0x8804('0x50')])){return null;}else{return createJwt(_0x43109c);}};exports[_0x8804('0x51')]=function(_0x13b01f){_0x13b01f[_0x8804('0x3d')]=generateNonce();_0x13b01f['apiKeyIat']=generateIssuedAt();return createJwt(_0x13b01f);};exports[_0x8804('0x52')]=function(_0x2fd87e,_0x19f476){var _0x34e704=_0x2fd87e[_0x8804('0x37')]['apikey'];if(_0x34e704){var _0x423f19={'nonce':_0x19f476['apiKeyNonce'],'iat':_0x19f476['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x8804('0x39')]()};return verifyJwt(_0x34e704,_0x423f19)['then'](function(){return generateApiKey(_0x19f476);});}else{throw{'message':_0x8804('0x53')};}};function signJwt(_0x3ca55b){var _0x6c7f32=BPromise[_0x8804('0x54')](jwt[_0x8804('0x55')],{'context':jwt});var _0x1e8a26=_0x3ca55b[_0x8804('0x56')]||config['secrets'][_0x8804('0x8')];return new BPromise(function(_0x28e486,_0x43a025){_0x6c7f32(_0x3ca55b['payload'],_0x1e8a26,_0x3ca55b[_0x8804('0x57')])['then'](function(_0x3f01b3){_0x28e486(_0x3f01b3);})[_0x8804('0x34')](function(_0x1173a8){_0x43a025(_0x1173a8);});});}function verifyJwt(_0x490d9a,_0x47760d,_0x4442c5){var _0x14257b=BPromise['promisify'](jwt[_0x8804('0x58')],{'context':jwt});var _0x1daad6=_0x4442c5||config[_0x8804('0x7')][_0x8804('0x8')];return new BPromise(function(_0x2e9fcd,_0x5ed689){_0x14257b(_0x490d9a,_0x1daad6,_0x47760d)['then'](function(_0x301d88){_0x2e9fcd(_0x301d88);})[_0x8804('0x34')](function(_0x5480a5){_0x5ed689(_0x5480a5);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x8804('0x59')](_0x8804('0x5a'));}function generateIssuedAt(){return Math[_0x8804('0x5b')](Date[_0x8804('0x5c')]()/0x3e8)[_0x8804('0x59')]();}function createJwt(_0x93665c){var _0xe2a1c5={'payload':{'iat':_0x93665c[_0x8804('0x50')],'nonce':_0x93665c[_0x8804('0x3d')]},'options':{'algorithm':_0x8804('0x5d'),'subject':_0x93665c['id'][_0x8804('0x59')](),'issuer':hardwareConf[_0x8804('0x39')](),'audience':hardwareConf[_0x8804('0x39')]()}};return signJwt(_0xe2a1c5)['then'](function(_0x407577){return{'iat':_0x93665c['apiKeyIat'],'nonce':_0x93665c[_0x8804('0x3d')],'token':_0x407577};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b36ffce..fa396e4 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 _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x2ae413,_0x1baaa9){var _0x620320=function(_0xedaadc){while(--_0xedaadc){_0x2ae413['push'](_0x2ae413['shift']());}};_0x620320(++_0x1baaa9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file +var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x118e16,_0x2a6f97){var _0x9f7b89=function(_0xd8909a){while(--_0xd8909a){_0x118e16['push'](_0x118e16['shift']());}};_0x9f7b89(++_0x2a6f97);}(_0xe706,0xa3));var _0x6e70=function(_0x5a9130,_0x1a32f3){_0x5a9130=_0x5a9130-0x0;var _0x53580d=_0xe706[_0x5a9130];return _0x53580d;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a93ae66..9ec9fb5 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 _0x6f0d=['rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','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','Failed','path','lodash','to-csv','bluebird'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2fecc7,_0x42c2c9){_0x2fecc7=_0x2fecc7-0x0;var _0x39efb5=_0x6f0d[_0x2fecc7];return _0x39efb5;};'use strict';var util=require('util');var path=require(_0xd6f0('0x0'));var _=require(_0xd6f0('0x1'));var csv=require(_0xd6f0('0x2'));var fs=require('fs');var BPromise=require(_0xd6f0('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var dbH=require(_0xd6f0('0x5'))[_0xd6f0('0x6')];var logger=require(_0xd6f0('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd6f0('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd6f0('0x8')][0x4];function analyticExtractedReport(_0x1af29c,_0x8b89a9){var _0x1a48a0={'status':_0x1af29c};var _0x4c4916={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8b89a9){_0x1a48a0['savename']=_0x8b89a9;}return db[_0xd6f0('0x9')][_0xd6f0('0xa')](_0x1a48a0,_0x4c4916);}function main(){var _0x2854cd=0x1388;var _0x382a2e;logger[_0xd6f0('0xb')](util['format'](_0xd6f0('0xc'),EXTRACTED_REPORT_ID,_0xd6f0('0xd')));return db[_0xd6f0('0xe')][_0xd6f0('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd6f0('0x10')]})[_0xd6f0('0x11')](function(_0x306aad){if(_0x306aad){_0x382a2e=_0x306aad;_0x2854cd=_0x382a2e[_0xd6f0('0x10')]||0x1388;}})[_0xd6f0('0x11')](function(){return dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](util[_0xd6f0('0x14')](_0xd6f0('0x15'),QUERY),{'type':dbH['sequelize'][_0xd6f0('0x16')][_0xd6f0('0x17')]});})['then'](function(_0x419b7e){if(!_0x419b7e[0x0]['num']){return analyticExtractedReport(_0xd6f0('0x18'));}var _0x154e3e=[];var _0x41bd99=0x0;var _0x472156=!![];if(_0x419b7e&&_0x419b7e[_0xd6f0('0x19')]){var _0x61defb=_0x419b7e[0x0][_0xd6f0('0x1a')]%(_0x41bd99+_0x2854cd);if(_0x382a2e[_0xd6f0('0x1b')]){for(;_0x472156;_0x41bd99+=_0x2854cd,_0x61defb=_0x419b7e[0x0][_0xd6f0('0x1a')]%(_0x41bd99+_0x2854cd)){if(_0x61defb==0x0||_0x61defb==_0x419b7e[0x0][_0xd6f0('0x1a')]){_0x472156=![];}_0x154e3e[_0xd6f0('0x1c')](dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](util[_0xd6f0('0x14')](_0xd6f0('0x1d'),QUERY,_0x2854cd,_0x41bd99),{'type':dbH[_0xd6f0('0x12')]['QueryTypes']['SELECT']}));}}else{_0x154e3e[_0xd6f0('0x1c')](dbH[_0xd6f0('0x12')][_0xd6f0('0x13')](QUERY,{'type':dbH['sequelize'][_0xd6f0('0x16')][_0xd6f0('0x17')]}));}}var _0x557c9b=path[_0xd6f0('0x1e')](PATH);var _0x515687=path[_0xd6f0('0x1f')](PATH,_0xd6f0('0x20'));var _0x5dbe1c=_0x382a2e[_0xd6f0('0x1b')]&&_0x154e3e[_0xd6f0('0x19')]>0x1;var _0x5ea2dd=[];if(!fs[_0xd6f0('0x21')](path[_0xd6f0('0x22')](_0x557c9b,_0x515687))&&_0x5dbe1c){fs[_0xd6f0('0x23')](path['join'](_0x557c9b,_0x515687));}return BPromise[_0xd6f0('0x24')](_0x154e3e,function(_0x3dc166){_0x5ea2dd['push'](_0x3dc166);})[_0xd6f0('0x11')](function(){for(var _0x551be8=0x0;_0x551be8<_0x5ea2dd[_0xd6f0('0x19')];_0x551be8+=0x1){var _0x3fb5c3;var _0x1630dc=_0x5ea2dd[_0x551be8];if(_0x5dbe1c){_0x3fb5c3=path[_0xd6f0('0x22')](_0x557c9b,_0x515687,util[_0xd6f0('0x14')](_0xd6f0('0x25'),_0x515687,_0x551be8,_0xd6f0('0x26')));}else{_0x3fb5c3=path[_0xd6f0('0x22')](_0x557c9b,util['format'](_0xd6f0('0x27'),_0x515687,_0xd6f0('0x26')));}fs['writeFileSync'](_0x3fb5c3,csv(_0x1630dc));}})[_0xd6f0('0x11')](function(){if(_0x5dbe1c){zipdir(path[_0xd6f0('0x22')](_0x557c9b,_0x515687),{'saveTo':path[_0xd6f0('0x22')](_0x557c9b,util[_0xd6f0('0x14')](_0xd6f0('0x27'),_0x515687,_0xd6f0('0x28')))},function(_0x351fda,_0x3151f8){});rimraf(path[_0xd6f0('0x22')](_0x557c9b,_0x515687),function(){});}})[_0xd6f0('0x11')](function(){logger[_0xd6f0('0xb')](util[_0xd6f0('0x14')](_0xd6f0('0x29'),EXTRACTED_REPORT_ID,_0xd6f0('0xd')));return analyticExtractedReport(_0xd6f0('0x2a'),_0x5dbe1c?util[_0xd6f0('0x14')](_0xd6f0('0x27'),_0x515687,_0x5dbe1c?_0xd6f0('0x28'):_0xd6f0('0x26')):null);});})[_0xd6f0('0x2b')](function(_0x3906ca){logger[_0xd6f0('0xb')](util['format'](_0xd6f0('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x3906ca,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xd6f0('0x2d'));});}main(); \ No newline at end of file +var _0x2dae=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2dae,0xc3));var _0xe2da=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x2dae[_0x2b7764];return _0x848dcb;};'use strict';var util=require(_0xe2da('0x0'));var path=require('path');var _=require(_0xe2da('0x1'));var csv=require(_0xe2da('0x2'));var fs=require('fs');var BPromise=require(_0xe2da('0x3'));var zipdir=require(_0xe2da('0x4'));var rimraf=require(_0xe2da('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe2da('0x6'))[_0xe2da('0x7')];var logger=require(_0xe2da('0x8'))(_0xe2da('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe2da('0xa')][0x3];var PATH=process[_0xe2da('0xa')][0x4];function analyticExtractedReport(_0x34cc98,_0x2efbd8){var _0x238da3={'status':_0x34cc98};var _0x1c71ea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2efbd8){_0x238da3[_0xe2da('0xb')]=_0x2efbd8;}return db[_0xe2da('0xc')][_0xe2da('0xd')](_0x238da3,_0x1c71ea);}function main(){var _0x5a2fc5=0x1388;var _0x52e650;logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x10'),EXTRACTED_REPORT_ID,_0xe2da('0x11')));return db[_0xe2da('0x12')][_0xe2da('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe2da('0x14'),'splitSizeCsv']})[_0xe2da('0x15')](function(_0x5200b1){if(_0x5200b1){_0x52e650=_0x5200b1;_0x5a2fc5=_0x52e650[_0xe2da('0x16')]||0x1388;}})[_0xe2da('0x15')](function(){return dbH[_0xe2da('0x17')][_0xe2da('0x18')](util[_0xe2da('0xf')](_0xe2da('0x19'),QUERY),{'type':dbH[_0xe2da('0x17')]['QueryTypes'][_0xe2da('0x1a')]});})['then'](function(_0x586b27){if(!_0x586b27[0x0][_0xe2da('0x1b')]){return analyticExtractedReport(_0xe2da('0x1c'));}var _0x33f919=[];var _0x4dc58b=0x0;var _0x25d4fa=!![];if(_0x586b27&&_0x586b27[_0xe2da('0x1d')]){var _0x2ea60e=_0x586b27[0x0][_0xe2da('0x1b')]%(_0x4dc58b+_0x5a2fc5);if(_0x52e650['split']){for(;_0x25d4fa;_0x4dc58b+=_0x5a2fc5,_0x2ea60e=_0x586b27[0x0][_0xe2da('0x1b')]%(_0x4dc58b+_0x5a2fc5)){if(_0x2ea60e==0x0||_0x2ea60e==_0x586b27[0x0][_0xe2da('0x1b')]){_0x25d4fa=![];}_0x33f919[_0xe2da('0x1e')](dbH[_0xe2da('0x17')][_0xe2da('0x18')](util['format'](_0xe2da('0x1f'),QUERY,_0x5a2fc5,_0x4dc58b),{'type':dbH[_0xe2da('0x17')]['QueryTypes'][_0xe2da('0x1a')]}));}}else{_0x33f919[_0xe2da('0x1e')](dbH[_0xe2da('0x17')][_0xe2da('0x18')](QUERY,{'type':dbH[_0xe2da('0x17')][_0xe2da('0x20')]['SELECT']}));}}var _0x467cd6=path['dirname'](PATH);var _0x30efdc=path[_0xe2da('0x21')](PATH,_0xe2da('0x22'));var _0x28f1d3=_0x52e650[_0xe2da('0x14')]&&_0x33f919[_0xe2da('0x1d')]>0x1;var _0x38f2c4=[];if(!fs[_0xe2da('0x23')](path['join'](_0x467cd6,_0x30efdc))&&_0x28f1d3){fs[_0xe2da('0x24')](path[_0xe2da('0x25')](_0x467cd6,_0x30efdc));}return BPromise[_0xe2da('0x26')](_0x33f919,function(_0x14704d){_0x38f2c4[_0xe2da('0x1e')](_0x14704d);})[_0xe2da('0x15')](function(){for(var _0x124d93=0x0;_0x124d93<_0x38f2c4['length'];_0x124d93+=0x1){var _0x2adc49;var _0x3e23d7=_0x38f2c4[_0x124d93];if(_0x28f1d3){_0x2adc49=path[_0xe2da('0x25')](_0x467cd6,_0x30efdc,util[_0xe2da('0xf')](_0xe2da('0x27'),_0x30efdc,_0x124d93,_0xe2da('0x28')));}else{_0x2adc49=path[_0xe2da('0x25')](_0x467cd6,util[_0xe2da('0xf')]('%s.%s',_0x30efdc,'csv'));}fs['writeFileSync'](_0x2adc49,csv(_0x3e23d7));}})[_0xe2da('0x15')](function(){if(_0x28f1d3){zipdir(path[_0xe2da('0x25')](_0x467cd6,_0x30efdc),{'saveTo':path[_0xe2da('0x25')](_0x467cd6,util[_0xe2da('0xf')]('%s.%s',_0x30efdc,'zip'))},function(_0x356ab4,_0x1ec8ca){});rimraf(path[_0xe2da('0x25')](_0x467cd6,_0x30efdc),function(){});}})[_0xe2da('0x15')](function(){logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x29'),EXTRACTED_REPORT_ID,_0xe2da('0x11')));return analyticExtractedReport(_0xe2da('0x2a'),_0x28f1d3?util['format']('%s.%s',_0x30efdc,_0x28f1d3?_0xe2da('0x2b'):_0xe2da('0x28')):null);});})[_0xe2da('0x2c')](function(_0x34f5fe){logger[_0xe2da('0xe')](util[_0xe2da('0xf')](_0xe2da('0x2d'),EXTRACTED_REPORT_ID,_0xe2da('0x11')),util[_0xe2da('0x2e')](_0x34f5fe,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe2da('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9231e0e..9762f78 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x3ff4fb,_0x3347f3){var _0x45d901=function(_0x2f7dfa){while(--_0x2f7dfa){_0x3ff4fb['push'](_0x3ff4fb['shift']());}};_0x45d901(++_0x3347f3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x2a5e1e,_0x19f151){var _0x4fe725=function(_0x5002b2){while(--_0x5002b2){_0x2a5e1e['push'](_0x2a5e1e['shift']());}};_0x4fe725(++_0x19f151);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0d955ad..a5ea139 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 _0x430b=['analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','split','existsSync','join','%s%d.%s','xlsx','%s.%s','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x4a1222,_0x323c00){var _0x2c9c94=function(_0x343a92){while(--_0x343a92){_0x4a1222['push'](_0x4a1222['shift']());}};_0x2c9c94(++_0x323c00);}(_0x430b,0x1b0));var _0xb430=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x430b[_0x8ba19a];return _0x2bd8b4;};'use strict';var util=require(_0xb430('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xb430('0x1'));var BPromise=require(_0xb430('0x2'));var zipdir=require(_0xb430('0x3'));var rimraf=require(_0xb430('0x4'));var db=require(_0xb430('0x5'))['db'];var dbH=require(_0xb430('0x5'))[_0xb430('0x6')];var logger=require(_0xb430('0x7'))(_0xb430('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb430('0x9')][0x2]);var QUERY=process[_0xb430('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xb5dd27,_0x17f0bf){var _0x3364d0={'status':_0xb5dd27};var _0x338d3d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17f0bf){_0x3364d0[_0xb430('0xa')]=_0x17f0bf;}return db[_0xb430('0xb')][_0xb430('0xc')](_0x3364d0,_0x338d3d);}function main(){var _0x2c2250=0x1388;var _0x47fc71;logger[_0xb430('0xd')](util[_0xb430('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb430('0xf')));return db[_0xb430('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb430('0x11')]})['then'](function(_0x29401a){if(_0x29401a){_0x47fc71=_0x29401a;_0x2c2250=_0x47fc71[_0xb430('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xb430('0x12')](util[_0xb430('0xe')](_0xb430('0x13'),QUERY),{'type':dbH[_0xb430('0x14')][_0xb430('0x15')][_0xb430('0x16')]});})[_0xb430('0x17')](function(_0x70240d){if(!_0x70240d[0x0]['num']){return analyticExtractedReport('Empty');}var _0x48943d=[];var _0x185a92=0x0;var _0x2d2b1e=!![];if(_0x47fc71['split']){if(_0x70240d&&_0x70240d[_0xb430('0x18')]){var _0x17b9bb=_0x70240d[0x0][_0xb430('0x19')]%(_0x185a92+_0x2c2250);for(;_0x2d2b1e;_0x185a92+=_0x2c2250,_0x17b9bb=_0x70240d[0x0]['num']%(_0x185a92+_0x2c2250)){if(_0x17b9bb==0x0||_0x17b9bb==_0x70240d[0x0][_0xb430('0x19')]){_0x2d2b1e=![];}_0x48943d[_0xb430('0x1a')](dbH[_0xb430('0x14')]['query'](util['format'](_0xb430('0x1b'),QUERY,_0x2c2250,_0x185a92),{'type':dbH['sequelize'][_0xb430('0x15')][_0xb430('0x16')]}));}}}else{_0x48943d[_0xb430('0x1a')](dbH[_0xb430('0x14')][_0xb430('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb430('0x16')]}));}var _0x3cb34c=path[_0xb430('0x1c')](PATH);var _0x248bfc=path[_0xb430('0x1d')](PATH,_0xb430('0x1e'));var _0x3163ec=_0x47fc71[_0xb430('0x1f')]&&_0x48943d[_0xb430('0x18')]>0x1;var _0x1b86bb=[];if(!fs[_0xb430('0x20')](path[_0xb430('0x21')](_0x3cb34c,_0x248bfc))&&_0x3163ec){fs['mkdirSync'](path[_0xb430('0x21')](_0x3cb34c,_0x248bfc));}return BPromise['each'](_0x48943d,function(_0x182de9){_0x1b86bb[_0xb430('0x1a')](_0x182de9);})[_0xb430('0x17')](function(){for(var _0x2fc4f8=0x0;_0x2fc4f8<_0x1b86bb[_0xb430('0x18')];_0x2fc4f8+=0x1){var _0x3bc637;var _0x429b94=_0x1b86bb[_0x2fc4f8];if(_0x3163ec){_0x3bc637=path[_0xb430('0x21')](_0x3cb34c,_0x248bfc,util['format'](_0xb430('0x22'),_0x248bfc,_0x2fc4f8,_0xb430('0x23')));}else{_0x3bc637=path[_0xb430('0x21')](_0x3cb34c,util[_0xb430('0xe')](_0xb430('0x24'),_0x248bfc,_0xb430('0x23')));}fs['writeFileSync'](_0x3bc637,json2xls(_0x429b94),_0xb430('0x25'));}})[_0xb430('0x17')](function(){if(_0x3163ec){zipdir(path[_0xb430('0x21')](_0x3cb34c,_0x248bfc),{'saveTo':path[_0xb430('0x21')](_0x3cb34c,util[_0xb430('0xe')](_0xb430('0x24'),_0x248bfc,'zip'))},function(_0x504bf4,_0x4d6701){});rimraf(path[_0xb430('0x21')](_0x3cb34c,_0x248bfc),function(){});}})['then'](function(){logger['info'](util[_0xb430('0xe')](_0xb430('0x26'),EXTRACTED_REPORT_ID,_0xb430('0xf')));return analyticExtractedReport(_0xb430('0x27'),_0x3163ec?util[_0xb430('0xe')]('%s.%s',_0x248bfc,_0x3163ec?_0xb430('0x28'):_0xb430('0x23')):null);});})[_0xb430('0x29')](function(_0x16ad49){logger[_0xb430('0xd')](util[_0xb430('0xe')](_0xb430('0x2a'),EXTRACTED_REPORT_ID,_0xb430('0xf')),util[_0xb430('0x2b')](_0x16ad49,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xd9bc=['dirname','basename','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','num','Empty','length','push','query','QueryTypes','SELECT'];(function(_0x45c9fa,_0x352bdf){var _0x57baed=function(_0x4f8116){while(--_0x4f8116){_0x45c9fa['push'](_0x45c9fa['shift']());}};_0x57baed(++_0x352bdf);}(_0xd9bc,0xc7));var _0xcd9b=function(_0x205cb3,_0x5f15ec){_0x205cb3=_0x205cb3-0x0;var _0x41792b=_0xd9bc[_0x205cb3];return _0x41792b;};'use strict';var util=require(_0xcd9b('0x0'));var path=require(_0xcd9b('0x1'));var _=require(_0xcd9b('0x2'));var fs=require('fs');var json2xls=require(_0xcd9b('0x3'));var BPromise=require(_0xcd9b('0x4'));var zipdir=require(_0xcd9b('0x5'));var rimraf=require(_0xcd9b('0x6'));var db=require(_0xcd9b('0x7'))['db'];var dbH=require(_0xcd9b('0x7'))['dbH'];var logger=require(_0xcd9b('0x8'))(_0xcd9b('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xcd9b('0xa')][0x2]);var QUERY=process[_0xcd9b('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x3b1224,_0x257744){var _0xbab251={'status':_0x3b1224};var _0x5131cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x257744){_0xbab251[_0xcd9b('0xb')]=_0x257744;}return db[_0xcd9b('0xc')][_0xcd9b('0xd')](_0xbab251,_0x5131cb);}function main(){var _0x1bfd42=0x1388;var _0x9e4d2a;logger[_0xcd9b('0xe')](util[_0xcd9b('0xf')](_0xcd9b('0x10'),EXTRACTED_REPORT_ID,_0xcd9b('0x11')));return db[_0xcd9b('0x12')][_0xcd9b('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcd9b('0x14'),_0xcd9b('0x15')]})[_0xcd9b('0x16')](function(_0x105b8d){if(_0x105b8d){_0x9e4d2a=_0x105b8d;_0x1bfd42=_0x9e4d2a[_0xcd9b('0x15')]||0x1388;}})[_0xcd9b('0x16')](function(){return dbH[_0xcd9b('0x17')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xcd9b('0x16')](function(_0x36a2fb){if(!_0x36a2fb[0x0][_0xcd9b('0x18')]){return analyticExtractedReport(_0xcd9b('0x19'));}var _0x1e8b40=[];var _0x1ac868=0x0;var _0x19e66b=!![];if(_0x9e4d2a['split']){if(_0x36a2fb&&_0x36a2fb[_0xcd9b('0x1a')]){var _0x425029=_0x36a2fb[0x0][_0xcd9b('0x18')]%(_0x1ac868+_0x1bfd42);for(;_0x19e66b;_0x1ac868+=_0x1bfd42,_0x425029=_0x36a2fb[0x0][_0xcd9b('0x18')]%(_0x1ac868+_0x1bfd42)){if(_0x425029==0x0||_0x425029==_0x36a2fb[0x0]['num']){_0x19e66b=![];}_0x1e8b40[_0xcd9b('0x1b')](dbH['sequelize'][_0xcd9b('0x1c')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1bfd42,_0x1ac868),{'type':dbH[_0xcd9b('0x17')][_0xcd9b('0x1d')][_0xcd9b('0x1e')]}));}}}else{_0x1e8b40[_0xcd9b('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xcd9b('0x17')][_0xcd9b('0x1d')][_0xcd9b('0x1e')]}));}var _0x20e1d6=path[_0xcd9b('0x1f')](PATH);var _0x44a9fe=path[_0xcd9b('0x20')](PATH,'.xlsx');var _0x1946bb=_0x9e4d2a['split']&&_0x1e8b40['length']>0x1;var _0x1f7abd=[];if(!fs[_0xcd9b('0x21')](path[_0xcd9b('0x22')](_0x20e1d6,_0x44a9fe))&&_0x1946bb){fs[_0xcd9b('0x23')](path[_0xcd9b('0x22')](_0x20e1d6,_0x44a9fe));}return BPromise['each'](_0x1e8b40,function(_0x37ece0){_0x1f7abd[_0xcd9b('0x1b')](_0x37ece0);})['then'](function(){for(var _0x490e6a=0x0;_0x490e6a<_0x1f7abd['length'];_0x490e6a+=0x1){var _0x49cffd;var _0x4553dc=_0x1f7abd[_0x490e6a];if(_0x1946bb){_0x49cffd=path[_0xcd9b('0x22')](_0x20e1d6,_0x44a9fe,util[_0xcd9b('0xf')](_0xcd9b('0x24'),_0x44a9fe,_0x490e6a,'xlsx'));}else{_0x49cffd=path[_0xcd9b('0x22')](_0x20e1d6,util[_0xcd9b('0xf')](_0xcd9b('0x25'),_0x44a9fe,_0xcd9b('0x26')));}fs[_0xcd9b('0x27')](_0x49cffd,json2xls(_0x4553dc),_0xcd9b('0x28'));}})[_0xcd9b('0x16')](function(){if(_0x1946bb){zipdir(path[_0xcd9b('0x22')](_0x20e1d6,_0x44a9fe),{'saveTo':path[_0xcd9b('0x22')](_0x20e1d6,util[_0xcd9b('0xf')]('%s.%s',_0x44a9fe,_0xcd9b('0x29')))},function(_0x36b8d1,_0x405be9){});rimraf(path[_0xcd9b('0x22')](_0x20e1d6,_0x44a9fe),function(){});}})[_0xcd9b('0x16')](function(){logger[_0xcd9b('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xcd9b('0x11')));return analyticExtractedReport(_0xcd9b('0x2a'),_0x1946bb?util['format'](_0xcd9b('0x25'),_0x44a9fe,_0x1946bb?_0xcd9b('0x29'):_0xcd9b('0x26')):null);});})['catch'](function(_0x19755f){logger[_0xcd9b('0xe')](util[_0xcd9b('0xf')](_0xcd9b('0x2b'),EXTRACTED_REPORT_ID,_0xcd9b('0x11')),util[_0xcd9b('0x2c')](_0x19755f,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xcd9b('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index ad25cc6..3fa62e0 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 _0x175e=['MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','sortBy','catch','error','rewrite','lodash','util','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','filter','exten','playback','hasOwnProperty','extensions','extension','find','push','type','format','CDR(type)=%s','priority','VoiceExtensionId','outbound','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x175e,0xe6));var _0xe175=function(_0x3194b6,_0x4d04af){_0x3194b6=_0x3194b6-0x0;var _0x7534f6=_0x175e[_0x3194b6];return _0x7534f6;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));function rewrite(_0x62e89,_0x1c64ef){var _0x449d97=this;return _0x62e89['models']['Interval'][_0xe175('0x2')]({'raw':!![]})[_0xe175('0x3')](function(_0x3fd951){_0x449d97[_0xe175('0x4')]=_0x3fd951;return _0x62e89[_0xe175('0x5')][_0xe175('0x6')][_0xe175('0x2')]({'where':{'IntervalId':_0x1c64ef[_0xe175('0x7')]},'raw':!![]});})[_0xe175('0x3')](function(_0x2e1356){return _0x62e89[_0xe175('0x5')][_0xe175('0x6')][_0xe175('0x2')]({'where':{'exten':{'$in':_[_0xe175('0x8')](_[_0xe175('0x9')](_0x2e1356,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xe175('0x3')](function(_0x591ec3){var _0x19493b=_[_0xe175('0xa')](_0x591ec3,{'priority':'1'});var _0x2cc353=_[_0xe175('0xa')](_0x591ec3,{'isApp':0x1});var _0x48a978=_['groupBy'](_0x2cc353,_0xe175('0xb'));var _0x4d7c59=['queue',_0xe175('0xc')];var _0x336aa1=[];var _0xf92dec=[];for(var _0x36ee94 in _0x48a978){if(_0x48a978[_0xe175('0xd')](_0x36ee94)){_0x449d97['priority']=0x2;_0x449d97[_0xe175('0xe')]=[];_0x449d97[_0xe175('0xf')]=_[_0xe175('0x10')](_0x19493b,{'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')]});_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':'Set','appdata':util[_0xe175('0x13')](_0xe175('0x14'),_0x48a978[_0x36ee94][0x0][_0xe175('0x12')]),'context':_0x48a978[_0x36ee94][0x0]['context'],'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});if(_0x48a978[_0x36ee94][0x0][_0xe175('0x12')]===_0xe175('0x17')){if(_0x449d97[_0xe175('0xf')]){_0x449d97['extensions'][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':_0xe175('0x18'),'appdata':_0xe175('0x19')+(_0x449d97['extension'][_0xe175('0x1a')]?_0xe175('0x1b')+_0x449d97[_0xe175('0xf')]['cutdigits']+'}':_0xe175('0x1c')),'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0]['exten'],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0]['VoiceExtensionId']});}_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':_0xe175('0x18'),'appdata':_0xe175('0x1e')+_0x48a978[_0x36ee94][0x0][_0xe175('0x16')],'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0]['VoiceExtensionId']});var _0x5c54dd=_0x449d97[_0xe175('0x15')]++;_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':_0xe175('0x1f'),'appdata':_0xe175('0x20')+(_0x5c54dd+0x2)+_0xe175('0x21')+(_0x5c54dd+0x1)+')','context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'priority':_0x5c54dd,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});if(_0x449d97[_0xe175('0xf')]){_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':'Set','appdata':_0x449d97['extension'][_0xe175('0x1a')]?_0xe175('0x22')+_0x449d97[_0xe175('0xf')][_0xe175('0x1a')]+'}':_0xe175('0x23'),'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'priority':_0x449d97['priority']++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});}_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':_0xe175('0x18'),'appdata':_0xe175('0x24')+_0x48a978[_0x36ee94][0x0][_0xe175('0x16')],'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0]['exten'],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});if(_0x449d97[_0xe175('0xf')]&&_0x449d97[_0xe175('0xf')]['hasOwnProperty'](_0xe175('0x25'))&&_0x449d97[_0xe175('0xf')]['recordingFormat']!=='none'){_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':'Set','appdata':_0xe175('0x26'),'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':_0xe175('0x18'),'appdata':_0xe175('0x27')+_0x449d97[_0xe175('0xf')][_0xe175('0x25')]||_0xe175('0x28'),'context':_0x48a978[_0x36ee94][0x0]['context'],'exten':_0x48a978[_0x36ee94][0x0]['exten'],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0]['VoiceExtensionId']});}}_0x449d97[_0xe175('0xe')]['push']({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':_0xe175('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0]['exten'],'priority':_0x449d97[_0xe175('0x15')]++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});_0x449d97['extensions'][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0]['type'],'app':_0xe175('0x18'),'appdata':_0xe175('0x29'),'context':_0x48a978[_0x36ee94][0x0]['context'],'exten':_0x48a978[_0x36ee94][0x0]['exten'],'priority':_0x449d97['priority']++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0]['VoiceExtensionId']});_0x449d97['extensions']['push']({'type':_0x48a978[_0x36ee94][0x0]['type'],'app':_0xe175('0x18'),'appdata':_0xe175('0x2a'),'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'priority':_0x449d97['priority']++,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0]['VoiceExtensionId']});for(var _0x11f4e9=0x0,_0x28a5e8=0x0;_0x11f4e9<_0x48a978[_0x36ee94][_0xe175('0x2b')];_0x11f4e9+=0x1,_0x28a5e8=0x0){var _0x5093a6=_0x48a978[_0x36ee94][_0x11f4e9];if(_0x5093a6[_0xe175('0x12')]){_0x5093a6[_0xe175('0x12')]=_0x5093a6['type'][_0xe175('0x2c')]();}var _0x5626c1=[];var _0x3b1ddb=[];delete _0x5093a6['id'];delete _0x5093a6[_0xe175('0x2d')];delete _0x5093a6[_0xe175('0x2e')];var _0x5c0951=_0x5093a6[_0xe175('0x2f')]!==_0xe175('0x30')?[_0x5093a6[_0xe175('0x2f')]]:_0x5093a6[_0xe175('0x7')]?_[_0xe175('0x9')](_[_0xe175('0xa')](_0x449d97['intervals'],{'IntervalId':_0x5093a6[_0xe175('0x7')]}),_0xe175('0x2f')):[];if(_0x5093a6[_0xe175('0xd')]('tag')){if(_0x5093a6['tag']&&_0x5093a6[_0xe175('0x31')]!=='--'){_0x5626c1[_0xe175('0x11')]({'type':_0x5093a6['type'],'app':'Set','appdata':'CDR(tag)='+_0x5093a6['tag'],'context':_0x5093a6[_0xe175('0x1d')],'exten':_0x5093a6[_0xe175('0xb')],'priority':_0x5c0951[_0xe175('0x2b')]+_0x449d97[_0xe175('0x15')]+_0x28a5e8++,'VoiceExtensionId':_0x5093a6[_0xe175('0x16')]});}}if(_0x5093a6[_0xe175('0x12')]===_0xe175('0x17')&&_0x5093a6[_0xe175('0xd')](_0xe175('0x32'))){if(_0x5093a6[_0xe175('0x32')]){_0x5626c1['push']({'type':_0x5093a6[_0xe175('0x12')],'app':_0xe175('0x1f'),'appdata':_0xe175('0x33')+_0x5093a6['callerID']+')','context':_0x5093a6[_0xe175('0x1d')],'exten':_0x5093a6[_0xe175('0xb')],'priority':_0x5c0951[_0xe175('0x2b')]+_0x449d97['priority']+_0x28a5e8++,'VoiceExtensionId':_0x5093a6['VoiceExtensionId']});}else{_0x5626c1[_0xe175('0x11')]({'type':_0x5093a6[_0xe175('0x12')],'app':'ExecIf','appdata':_0xe175('0x34'),'context':_0x5093a6[_0xe175('0x1d')],'exten':_0x5093a6[_0xe175('0xb')],'priority':_0x5c0951['length']+_0x449d97[_0xe175('0x15')]+_0x28a5e8++,'VoiceExtensionId':_0x5093a6['VoiceExtensionId']});}}if(_0x5093a6[_0xe175('0xd')](_0xe175('0x35'))){if(_0x4d7c59[_0xe175('0x36')](_0x5093a6[_0xe175('0x37')][_0xe175('0x2c')]())>=0x0&&_0x5093a6['appType']!==_0xe175('0x38')){if(_0x5093a6[_0xe175('0x35')]){_0x5626c1[_0xe175('0x11')]({'type':_0x5093a6[_0xe175('0x12')],'app':_0xe175('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5093a6[_0xe175('0x1d')],'exten':_0x5093a6[_0xe175('0xb')],'priority':_0x5c0951[_0xe175('0x2b')]+_0x449d97[_0xe175('0x15')]+_0x28a5e8++,'VoiceExtensionId':_0x5093a6[_0xe175('0x16')]});_0x5626c1[_0xe175('0x11')]({'type':_0x5093a6['type'],'app':_0xe175('0x18'),'appdata':_0xe175('0x39'),'context':_0x5093a6['context'],'exten':_0x5093a6[_0xe175('0xb')],'priority':_0x5c0951[_0xe175('0x2b')]+_0x449d97[_0xe175('0x15')]+_0x28a5e8++,'VoiceExtensionId':_0x5093a6[_0xe175('0x16')]});}else{_0x5626c1[_0xe175('0x11')]({'type':_0x5093a6[_0xe175('0x12')],'app':_0xe175('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5093a6['context'],'exten':_0x5093a6['exten'],'priority':_0x5c0951[_0xe175('0x2b')]+_0x449d97[_0xe175('0x15')]+_0x28a5e8++,'VoiceExtensionId':_0x5093a6[_0xe175('0x16')]});_0x5626c1[_0xe175('0x11')]({'type':_0x5093a6[_0xe175('0x12')],'app':_0xe175('0x18'),'appdata':_0xe175('0x3a'),'context':_0x5093a6[_0xe175('0x1d')],'exten':_0x5093a6['exten'],'priority':_0x5c0951[_0xe175('0x2b')]+_0x449d97[_0xe175('0x15')]+_0x28a5e8++,'VoiceExtensionId':_0x5093a6['VoiceExtensionId']});}}}for(var _0x13202c=0x0;_0x13202c<_0x5c0951[_0xe175('0x2b')];_0x13202c+=0x1){var _0x1114dd=_0x449d97[_0xe175('0x15')]+_0x5c0951[_0xe175('0x2b')];var _0x5cf8fc=_0x13202c===_0x5c0951['length']-0x1?_0x449d97[_0xe175('0x15')]+_0x5626c1[_0xe175('0x2b')]+_0x3b1ddb[_0xe175('0x2b')]+0x2:_0x449d97[_0xe175('0x15')]+_0x13202c+0x1;_0x5626c1[_0xe175('0x3b')](_0x13202c,0x0,{'type':_0x5093a6[_0xe175('0x12')],'app':_0xe175('0x3c'),'appdata':_0x5c0951[_0x13202c]+'?'+_0x5093a6[_0xe175('0x1d')]+_0xe175('0x3d')+_0x1114dd+':'+_0x5093a6['context']+',${EXTEN},'+_0x5cf8fc,'exten':_0x5093a6[_0xe175('0xb')],'context':_0x5093a6['context'],'priority':_0x449d97[_0xe175('0x15')]+_0x13202c,'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});}_0x5093a6['priority']=_0x5626c1[_0xe175('0x2b')]?_[_0xe175('0x3e')](_0x5626c1)[_0xe175('0x15')]+0x1:_0x449d97['priority'];_0x449d97['priority']=(_0x3b1ddb[_0xe175('0x2b')]?_[_0xe175('0x3e')](_0x3b1ddb)[_0xe175('0x15')]:_0x5093a6[_0xe175('0x15')])+0x1;_0x449d97[_0xe175('0xe')]=_[_0xe175('0x3f')](_0x449d97[_0xe175('0xe')],_0x5626c1,[_0x5093a6],_0x3b1ddb);}_0x449d97[_0xe175('0xe')][_0xe175('0x11')]({'type':_0x48a978[_0x36ee94][0x0][_0xe175('0x12')],'app':'Hangup','exten':_0x48a978[_0x36ee94][0x0][_0xe175('0xb')],'context':_0x48a978[_0x36ee94][0x0][_0xe175('0x1d')],'priority':_0x449d97[_0xe175('0x15')],'VoiceExtensionId':_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]});_0x336aa1[_0xe175('0x11')](_0x48a978[_0x36ee94][0x0][_0xe175('0x16')]);_0xf92dec=_[_0xe175('0x3f')](_0xf92dec,_0x449d97[_0xe175('0xe')]);}}return _0x62e89['transaction'](function(_0x13fada){return _0x62e89['models'][_0xe175('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x336aa1}},'transaction':_0x13fada})[_0xe175('0x3')](function(_0x334cc4){return _0x62e89[_0xe175('0x5')][_0xe175('0x6')]['bulkCreate'](_[_0xe175('0x40')](_0xf92dec,_0xe175('0x15')),{'transaction':_0x13fada});});});})[_0xe175('0x41')](function(_0x22d010){console[_0xe175('0x42')](_0x22d010);});}exports[_0xe175('0x43')]=rewrite; \ No newline at end of file +var _0x153f=['filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','CDR(type)=%s','context','priority','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0xcd384d,_0x2672cb){var _0x49c0c0=function(_0x15d033){while(--_0x15d033){_0xcd384d['push'](_0xcd384d['shift']());}};_0x49c0c0(++_0x2672cb);}(_0x153f,0x15b));var _0xf153=function(_0x5dffc5,_0x6e84e6){_0x5dffc5=_0x5dffc5-0x0;var _0x206712=_0x153f[_0x5dffc5];return _0x206712;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));function rewrite(_0xde7eae,_0x44cea3){var _0x2afb9a=this;return _0xde7eae[_0xf153('0x2')][_0xf153('0x3')]['findAll']({'raw':!![]})[_0xf153('0x4')](function(_0x5c49c7){_0x2afb9a[_0xf153('0x5')]=_0x5c49c7;return _0xde7eae[_0xf153('0x2')][_0xf153('0x6')][_0xf153('0x7')]({'where':{'IntervalId':_0x44cea3[_0xf153('0x8')]},'raw':!![]});})['then'](function(_0x17ba96){return _0xde7eae[_0xf153('0x2')][_0xf153('0x6')][_0xf153('0x7')]({'where':{'exten':{'$in':_[_0xf153('0x9')](_[_0xf153('0xa')](_0x17ba96,_0xf153('0xb')))}},'order':[{'raw':_0xf153('0xc')}],'raw':!![]});})[_0xf153('0x4')](function(_0xeaccb0){var _0x5c8ae9=_[_0xf153('0xd')](_0xeaccb0,{'priority':'1'});var _0x1c8de7=_[_0xf153('0xd')](_0xeaccb0,{'isApp':0x1});var _0x493324=_[_0xf153('0xe')](_0x1c8de7,_0xf153('0xb'));var _0x65756d=[_0xf153('0xf'),_0xf153('0x10')];var _0x107d31=[];var _0x3f915c=[];for(var _0x1d54c4 in _0x493324){if(_0x493324[_0xf153('0x11')](_0x1d54c4)){_0x2afb9a['priority']=0x2;_0x2afb9a[_0xf153('0x12')]=[];_0x2afb9a[_0xf153('0x13')]=_[_0xf153('0x14')](_0x5c8ae9,{'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')]});_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':util['format'](_0xf153('0x18'),_0x493324[_0x1d54c4][0x0]['type']),'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a[_0xf153('0x1a')]++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});if(_0x493324[_0x1d54c4][0x0]['type']===_0xf153('0x1c')){if(_0x2afb9a[_0xf153('0x13')]){_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0xf153('0x1d')+(_0x2afb9a[_0xf153('0x13')][_0xf153('0x1e')]?_0xf153('0x1f')+_0x2afb9a[_0xf153('0x13')][_0xf153('0x1e')]+'}':'${EXTEN}'),'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a[_0xf153('0x1a')]++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});}_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0xf153('0x20')+_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')],'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a[_0xf153('0x1a')]++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});var _0xe490f8=_0x2afb9a[_0xf153('0x1a')]++;_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xe490f8+0x2)+_0xf153('0x22')+(_0xe490f8+0x1)+')','context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0]['exten'],'priority':_0xe490f8,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});if(_0x2afb9a[_0xf153('0x13')]){_0x2afb9a['extensions'][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0x2afb9a[_0xf153('0x13')][_0xf153('0x1e')]?_0xf153('0x23')+_0x2afb9a[_0xf153('0x13')][_0xf153('0x1e')]+'}':_0xf153('0x24'),'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a[_0xf153('0x1a')]++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0]['VoiceExtensionId']});}_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':'outboundrouteid='+_0x493324[_0x1d54c4][0x0]['VoiceExtensionId'],'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0]['exten'],'priority':_0x2afb9a['priority']++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});if(_0x2afb9a['extension']&&_0x2afb9a[_0xf153('0x13')]['hasOwnProperty'](_0xf153('0x25'))&&_0x2afb9a[_0xf153('0x13')]['recordingFormat']!==_0xf153('0x26')){_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0xf153('0x27'),'context':_0x493324[_0x1d54c4][0x0]['context'],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a['priority']++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0xf153('0x28')+_0x2afb9a['extension'][_0xf153('0x25')]||_0xf153('0x29'),'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0]['exten'],'priority':_0x2afb9a[_0xf153('0x1a')]++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});}}_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a['priority']++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0xf153('0x2a'),'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'exten':_0x493324[_0x1d54c4][0x0]['exten'],'priority':_0x2afb9a[_0xf153('0x1a')]++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});_0x2afb9a[_0xf153('0x12')][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0x493324[_0x1d54c4][0x0]['context'],'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'priority':_0x2afb9a['priority']++,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});for(var _0x36c456=0x0,_0x31ec0f=0x0;_0x36c456<_0x493324[_0x1d54c4][_0xf153('0x2b')];_0x36c456+=0x1,_0x31ec0f=0x0){var _0xd516d0=_0x493324[_0x1d54c4][_0x36c456];if(_0xd516d0[_0xf153('0x16')]){_0xd516d0['type']=_0xd516d0['type'][_0xf153('0x2c')]();}var _0x25960d=[];var _0x4a7712=[];delete _0xd516d0['id'];delete _0xd516d0[_0xf153('0x2d')];delete _0xd516d0[_0xf153('0x2e')];var _0x1edf65=_0xd516d0[_0xf153('0x2f')]!==_0xf153('0x30')?[_0xd516d0[_0xf153('0x2f')]]:_0xd516d0[_0xf153('0x8')]?_[_0xf153('0xa')](_[_0xf153('0xd')](_0x2afb9a[_0xf153('0x5')],{'IntervalId':_0xd516d0[_0xf153('0x8')]}),_0xf153('0x2f')):[];if(_0xd516d0['hasOwnProperty'](_0xf153('0x31'))){if(_0xd516d0[_0xf153('0x31')]&&_0xd516d0[_0xf153('0x31')]!=='--'){_0x25960d['push']({'type':_0xd516d0[_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':'CDR(tag)='+_0xd516d0[_0xf153('0x31')],'context':_0xd516d0['context'],'exten':_0xd516d0[_0xf153('0xb')],'priority':_0x1edf65[_0xf153('0x2b')]+_0x2afb9a[_0xf153('0x1a')]+_0x31ec0f++,'VoiceExtensionId':_0xd516d0['VoiceExtensionId']});}}if(_0xd516d0[_0xf153('0x16')]===_0xf153('0x1c')&&_0xd516d0[_0xf153('0x11')](_0xf153('0x32'))){if(_0xd516d0[_0xf153('0x32')]){_0x25960d['push']({'type':_0xd516d0[_0xf153('0x16')],'app':_0xf153('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xd516d0[_0xf153('0x32')]+')','context':_0xd516d0[_0xf153('0x19')],'exten':_0xd516d0[_0xf153('0xb')],'priority':_0x1edf65['length']+_0x2afb9a[_0xf153('0x1a')]+_0x31ec0f++,'VoiceExtensionId':_0xd516d0[_0xf153('0x1b')]});}else{_0x25960d[_0xf153('0x15')]({'type':_0xd516d0[_0xf153('0x16')],'app':_0xf153('0x21'),'appdata':_0xf153('0x33'),'context':_0xd516d0[_0xf153('0x19')],'exten':_0xd516d0[_0xf153('0xb')],'priority':_0x1edf65[_0xf153('0x2b')]+_0x2afb9a['priority']+_0x31ec0f++,'VoiceExtensionId':_0xd516d0[_0xf153('0x1b')]});}}if(_0xd516d0['hasOwnProperty']('answer')){if(_0x65756d['indexOf'](_0xd516d0[_0xf153('0x34')][_0xf153('0x2c')]())>=0x0&&_0xd516d0['appType']!==_0xf153('0x35')){if(_0xd516d0[_0xf153('0x36')]){_0x25960d['push']({'type':_0xd516d0[_0xf153('0x16')],'app':_0xf153('0x21'),'appdata':_0xf153('0x37'),'context':_0xd516d0[_0xf153('0x19')],'exten':_0xd516d0[_0xf153('0xb')],'priority':_0x1edf65[_0xf153('0x2b')]+_0x2afb9a['priority']+_0x31ec0f++,'VoiceExtensionId':_0xd516d0[_0xf153('0x1b')]});_0x25960d[_0xf153('0x15')]({'type':_0xd516d0['type'],'app':'Set','appdata':_0xf153('0x38'),'context':_0xd516d0[_0xf153('0x19')],'exten':_0xd516d0[_0xf153('0xb')],'priority':_0x1edf65[_0xf153('0x2b')]+_0x2afb9a[_0xf153('0x1a')]+_0x31ec0f++,'VoiceExtensionId':_0xd516d0[_0xf153('0x1b')]});}else{_0x25960d['push']({'type':_0xd516d0[_0xf153('0x16')],'app':'ExecIf','appdata':_0xf153('0x39'),'context':_0xd516d0[_0xf153('0x19')],'exten':_0xd516d0[_0xf153('0xb')],'priority':_0x1edf65['length']+_0x2afb9a[_0xf153('0x1a')]+_0x31ec0f++,'VoiceExtensionId':_0xd516d0[_0xf153('0x1b')]});_0x25960d[_0xf153('0x15')]({'type':_0xd516d0[_0xf153('0x16')],'app':_0xf153('0x17'),'appdata':_0xf153('0x3a'),'context':_0xd516d0[_0xf153('0x19')],'exten':_0xd516d0['exten'],'priority':_0x1edf65[_0xf153('0x2b')]+_0x2afb9a[_0xf153('0x1a')]+_0x31ec0f++,'VoiceExtensionId':_0xd516d0[_0xf153('0x1b')]});}}}for(var _0x5673f5=0x0;_0x5673f5<_0x1edf65[_0xf153('0x2b')];_0x5673f5+=0x1){var _0x87af73=_0x2afb9a[_0xf153('0x1a')]+_0x1edf65[_0xf153('0x2b')];var _0x368ac1=_0x5673f5===_0x1edf65[_0xf153('0x2b')]-0x1?_0x2afb9a[_0xf153('0x1a')]+_0x25960d[_0xf153('0x2b')]+_0x4a7712['length']+0x2:_0x2afb9a[_0xf153('0x1a')]+_0x5673f5+0x1;_0x25960d[_0xf153('0x3b')](_0x5673f5,0x0,{'type':_0xd516d0['type'],'app':_0xf153('0x3c'),'appdata':_0x1edf65[_0x5673f5]+'?'+_0xd516d0[_0xf153('0x19')]+_0xf153('0x3d')+_0x87af73+':'+_0xd516d0[_0xf153('0x19')]+_0xf153('0x3d')+_0x368ac1,'exten':_0xd516d0[_0xf153('0xb')],'context':_0xd516d0[_0xf153('0x19')],'priority':_0x2afb9a[_0xf153('0x1a')]+_0x5673f5,'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});}_0xd516d0[_0xf153('0x1a')]=_0x25960d[_0xf153('0x2b')]?_['last'](_0x25960d)[_0xf153('0x1a')]+0x1:_0x2afb9a[_0xf153('0x1a')];_0x2afb9a['priority']=(_0x4a7712[_0xf153('0x2b')]?_[_0xf153('0x3e')](_0x4a7712)[_0xf153('0x1a')]:_0xd516d0[_0xf153('0x1a')])+0x1;_0x2afb9a[_0xf153('0x12')]=_[_0xf153('0x3f')](_0x2afb9a[_0xf153('0x12')],_0x25960d,[_0xd516d0],_0x4a7712);}_0x2afb9a['extensions'][_0xf153('0x15')]({'type':_0x493324[_0x1d54c4][0x0][_0xf153('0x16')],'app':_0xf153('0x40'),'exten':_0x493324[_0x1d54c4][0x0][_0xf153('0xb')],'context':_0x493324[_0x1d54c4][0x0][_0xf153('0x19')],'priority':_0x2afb9a[_0xf153('0x1a')],'VoiceExtensionId':_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]});_0x107d31[_0xf153('0x15')](_0x493324[_0x1d54c4][0x0][_0xf153('0x1b')]);_0x3f915c=_['concat'](_0x3f915c,_0x2afb9a[_0xf153('0x12')]);}}return _0xde7eae[_0xf153('0x41')](function(_0x4afdc4){return _0xde7eae[_0xf153('0x2')]['VoiceExtension'][_0xf153('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x107d31}},'transaction':_0x4afdc4})[_0xf153('0x4')](function(_0x4ec6ad){return _0xde7eae[_0xf153('0x2')]['VoiceExtension'][_0xf153('0x43')](_[_0xf153('0x44')](_0x3f915c,_0xf153('0x1a')),{'transaction':_0x4afdc4});});});})[_0xf153('0x45')](function(_0x4ad773){console[_0xf153('0x46')](_0x4ad773);});}exports[_0xf153('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f6d5585..0079fbd 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x26b374,_0x1f4fab){var _0x5e9bde=function(_0x2f3e6b){while(--_0x2f3e6b){_0x26b374['push'](_0x26b374['shift']());}};_0x5e9bde(++_0x1f4fab);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1d843fa..8f8d546 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 _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x418584,_0x3e2c3c){var _0x4a7737=function(_0x4577a2){while(--_0x4577a2){_0x418584['push'](_0x418584['shift']());}};_0x4a7737(++_0x3e2c3c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){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))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x416f33,_0x253697){var _0x3b6b4e=function(_0x48ce55){while(--_0x48ce55){_0x416f33['push'](_0x416f33['shift']());}};_0x3b6b4e(++_0x253697);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){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))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index d385f63..646d540 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12ee=['insert','into','cm_hopper','fromQuery','scheduledat','createdAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','ContactId','updatedAt','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','sequelize','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','name','header','writeFileSync','parse','createReadStream','rows','find','hasOwnProperty','data','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contactId','contactTypeId','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','path','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','push','then','catch','error','message','AdditionalPhones','isNil','split','all','filter','findOne','updated','CmContactHasItem','create','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x12ee,0x65));var _0xe12e=function(_0x5b31aa,_0x29ef3b){_0x5b31aa=_0x5b31aa-0x0;var _0x23ccd7=_0x12ee[_0x5b31aa];return _0x23ccd7;};'use strict';var fs=require('fs');var path=require(_0xe12e('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xe12e('0x1'));var BPromise=require(_0xe12e('0x2'));var moment=require(_0xe12e('0x3'));var squel=require('squel');var Redis=require(_0xe12e('0x4'));var db=require(_0xe12e('0x5'))['db'];var config=require(_0xe12e('0x6'));var logger=require(_0xe12e('0x7'))('import');config['redis']=_[_0xe12e('0x8')](config[_0xe12e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe12e('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe12e('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xe12e('0xc')+moment()[_0xe12e('0xb')](_0xe12e('0xd'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x598fc0){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))*$/[_0xe12e('0xe')](_0x598fc0);}function selectNotIn(_0x480ba5,_0x47276b,_0x31ac40,_0x45470f,_0x3919ff){return squel[_0xe12e('0xf')]()[_0xe12e('0x10')](_0xe12e('0x11'))['from'](_0x45470f)[_0xe12e('0x12')](_0x47276b,null,_0x47276b+_0xe12e('0x13')+_0x45470f+'.'+_0x31ac40)[_0xe12e('0x14')](_0x45470f+'.'+_0x31ac40+_0xe12e('0x15')+_0x480ba5+'.'+_0x31ac40)[_0xe12e('0x14')](_0x47276b+_0xe12e('0x16')+_0x3919ff['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xdd3e17,_0x1bd27e){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xe12e('0x17')](_0xe12e('0x18')+tempTableName)[_0xe12e('0x19')](function(_0x29ab29){if(_0x29ab29!==null){var _0xea360=[];for(var _0x21a41b=0x0;_0x21a41b<_0x29ab29[_0xe12e('0x1a')];_0x21a41b++){var _0x13c954=_0x29ab29[_0x21a41b];if(!_['isNil'](_0x13c954['phone'])){if(!_['isNil'](_0x13c954['AdditionalPhones']))_0xea360[_0xe12e('0x1b')](insertAdditionalPhones(_0x13c954));promisesContact['push']({'contact':_0x13c954});}}}Promise['all'](_0xea360)[_0xe12e('0x1c')](function(){_0xdd3e17({'val':0x1});});})[_0xe12e('0x1d')](function(_0x520c95){logger[_0xe12e('0x1e')](_0x520c95[_0xe12e('0x1f')]);});});}function insertAdditionalPhones(_0x384d3b){return new Promise(function(_0x229bd5,_0x4d7905){var _0x793834=_0x384d3b[_0xe12e('0x20')];if(_[_0xe12e('0x21')](_0x793834))_0x4d7905({'val':0x0});else{var _0x1374eb=_0x793834[_0xe12e('0x22')](';');var _0x2611a2=[];orderBy=0x0;for(var _0x912b1d=0x0;_0x912b1d<_0x1374eb[_0xe12e('0x1a')];_0x912b1d++){_0x2611a2[_0xe12e('0x1b')](splitAdditionalPhone(_0x384d3b['id'],_0x1374eb[_0x912b1d]));}Promise[_0xe12e('0x23')](_0x2611a2)['then'](function(){_0x229bd5({'val':_0x1374eb[_0xe12e('0x1a')]});});}});}function splitAdditionalPhone(_0x455426,_0x206d05){return new Promise(function(_0x4cc8b1,_0x75bc4e){var _0x34e5f5=_0x206d05[_0xe12e('0x22')](':');var _0x3930ae=_0x34e5f5[0x0];var _0x39386d=_0x34e5f5[0x1];if(_0x39386d!==''){var _0x293ccc=_0x39386d[_0xe12e('0x22')]('|');var _0x6a0ab0=[];for(var _0xfded78=0x0;_0xfded78<_0x293ccc[_0xe12e('0x1a')];_0xfded78++){if(_0x293ccc[_0xfded78]!==''){var _0x3b5b9f=_[_0xe12e('0x24')](promisesAdditionalPhones,{'contactId':_0x455426,'phone':_0x293ccc[_0xfded78]});if(_0x3b5b9f[_0xe12e('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x455426,'contactTypeId':_0x3930ae,'phone':_0x293ccc[_0xfded78],'orderBy':orderBy});}}}_0x4cc8b1({'ok':0x1});}else _0x4cc8b1({'res':0x0});});}function createAdditionalPhone(_0x18fd71,_0xa75317,_0x43d029,_0x46efe9){return new Promise(function(_0x371fd6,_0x570aaa){return db['CmContactHasItem'][_0xe12e('0x25')]({'where':{'CmContactId':_0x18fd71,'item':_0x43d029}})[_0xe12e('0x1c')](function(_0x22ef62){if(_0x22ef62){return db['CmContactHasItem']['update']({'ItemTypeId':_0xa75317,'OrderBy':_0x46efe9},{'where':{'CmContactId':_0x18fd71,'item':_0x43d029}})[_0xe12e('0x1c')](function(_0x59565f){_0x371fd6({'res':_0xe12e('0x26')});});}else{return db[_0xe12e('0x27')][_0xe12e('0x28')]({'CmContactId':_0x18fd71,'item':_0x43d029,'ItemTypeId':_0xa75317,'OrderBy':_0x46efe9,'ItemClass':'PHONE'})[_0xe12e('0x1c')](function(_0x562113){_0x371fd6({'res':_0xe12e('0x29')});});}});});}function updateContact(_0x21b1c2){return new Promise(function(_0x1bcb7f,_0x18ed92){var _0x233b52=_0x21b1c2['id'];delete _0x21b1c2['id'];return db[_0xe12e('0x2a')][_0xe12e('0x2b')](_0x21b1c2,{'where':{'id':_0x233b52}})[_0xe12e('0x1c')](function(_0x1f5367){updatedRows+=0x1;return db[_0xe12e('0x2c')][_0xe12e('0x2b')]({'phone':_0x21b1c2[_0xe12e('0x11')]},{'where':{'ContactId':_0x233b52}})[_0xe12e('0x1c')](function(_0x506745){_0x1bcb7f({'ret':'OK'});});});});}function insertCmHopper(_0x1fd3c0,_0x2dd78a,_0xc64d27,_0x5df8ea,_0x347566){var _0x5738be=[_0xe12e('0x2d'),'cm_contacts.scheduledat',_0xe12e('0x2e'),_0xe12e('0x2f'),_0x2dd78a+'.'+_0x5df8ea,_0xe12e('0x30'),_0xe12e('0x31'),'cm_contacts.priority',_0xe12e('0x32'),'\x22'+_0x347566+'\x22'];return squel[_0xe12e('0x33')]()[_0xe12e('0x34')](_0xe12e('0x35'))[_0xe12e('0x36')]([_0xe12e('0x11'),_0xe12e('0x37'),'ContactId','ListId',_0x5df8ea,_0xe12e('0x38'),'updatedAt',_0xe12e('0x39'),_0xe12e('0x3a'),_0xe12e('0x3b')],squel[_0xe12e('0xf')]()[_0xe12e('0x3c')](_0x5738be)[_0xe12e('0x3d')](_0x2dd78a)[_0xe12e('0x12')](_0xe12e('0x3e'),null,_0xe12e('0x3f')+_0x2dd78a+_0xe12e('0x40'))[_0xe12e('0x12')](_0xc64d27,null,_0xc64d27+_0xe12e('0x13')+_0x2dd78a+'.'+_0x5df8ea)[_0xe12e('0x14')](_0x2dd78a+_0xe12e('0x41'),_0x1fd3c0)[_0xe12e('0x14')](_0xe12e('0x42'),NOW)[_0xe12e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2dd78a,_0xc64d27,_0x5df8ea,_0xe12e('0x35'),[_0xe12e('0x43'),_0xe12e('0x44')]))[_0xe12e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2dd78a,_0xc64d27,_0x5df8ea,_0xe12e('0x35'),[_0xe12e('0x43')])))[_0xe12e('0x45')]();}function insertCmHopperBlack(_0x15a634,_0x41316c,_0x4bf97c,_0x450289){var _0x385aac=['cm_contacts.phone',_0xe12e('0x2e'),_0xe12e('0x2f'),_0x41316c+'.'+_0x450289,'cm_contacts.createdAt',_0xe12e('0x31')];return squel[_0xe12e('0x33')]()[_0xe12e('0x34')]('cm_hopper_black')[_0xe12e('0x36')]([_0xe12e('0x11'),_0xe12e('0x46'),'ListId',_0x450289,'createdAt',_0xe12e('0x47')],squel['select']()['fields'](_0x385aac)[_0xe12e('0x3d')](_0x41316c)[_0xe12e('0x12')](_0xe12e('0x3e'),null,_0xe12e('0x3f')+_0x41316c+_0xe12e('0x40'))[_0xe12e('0x12')](_0x4bf97c,null,_0x4bf97c+_0xe12e('0x13')+_0x41316c+'.'+_0x450289)[_0xe12e('0x14')](_0x41316c+_0xe12e('0x41'),_0x15a634)['where'](_0xe12e('0x42'),NOW)[_0xe12e('0x14')](_0xe12e('0x48'),squel[_0xe12e('0xf')]()[_0xe12e('0x10')](_0xe12e('0x11'))[_0xe12e('0x3d')](_0xe12e('0x49'))[_0xe12e('0x14')](_0xe12e('0x4a'),_0x15a634)[_0xe12e('0x14')](_0x450289+'\x20=\x20?',_0x41316c+'.'+_0x450289)))[_0xe12e('0x45')]();}function insertCmHopperAdditionalPhones(_0x3ecf5b){var _0x544339=['cm_hopper.id',_0xe12e('0x4b'),_0xe12e('0x4c'),'cm_contact_has_items.createdAt',_0xe12e('0x4d')];return squel[_0xe12e('0x33')]()[_0xe12e('0x34')]('cm_hopper_additional_phones')[_0xe12e('0x36')]([_0xe12e('0x4e'),_0xe12e('0x11'),_0xe12e('0x4f'),_0xe12e('0x38'),'updatedAt'],squel[_0xe12e('0xf')]()[_0xe12e('0x3c')](_0x544339)['from']('cm_hopper')['join'](_0xe12e('0x3e'),null,_0xe12e('0x50'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe12e('0x14')]('cm_hopper.ListId\x20=\x20?',_0x3ecf5b)[_0xe12e('0x14')](_0xe12e('0x42'),NOW))[_0xe12e('0x45')]();}function insertCmContact(_0x41ff5a,_0x531524,_0x57ec83,_0x13ee48){var _0x8900ec=_[_0xe12e('0x51')](_[_0xe12e('0x52')](_0x13ee48),[_0xe12e('0x53'),_0xe12e('0x54'),'createdAt',_0xe12e('0x47')]);return squel['insert']()[_0xe12e('0x34')]('cm_contacts')[_0xe12e('0x36')](_0x8900ec,squel[_0xe12e('0xf')]()[_0xe12e('0x3c')](_0x8900ec)[_0xe12e('0x3d')](_0x531524)[_0xe12e('0x14')]('('+_0x57ec83[_0xe12e('0x12')](',')+_0xe12e('0x55'),squel['select']()['fields'](_0x57ec83)[_0xe12e('0x3d')](_0xe12e('0x3e'))[_0xe12e('0x14')](_0xe12e('0x4a'),_0x41ff5a))['where'](_0xe12e('0x56'),squel[_0xe12e('0xf')]()[_0xe12e('0x10')](_0xe12e('0x57'),_0xe12e('0x58'))['from'](_0x531524)[_0xe12e('0x59')](_0x57ec83[_0xe12e('0x12')](','))))[_0xe12e('0x45')]();}function handleStop(){logger[_0xe12e('0x5a')](_0xe12e('0x5b'));stopped=!![];}function handleUncaughtException(_0x1d64fd){logger[_0xe12e('0x1e')](_0x1d64fd[_0xe12e('0x1f')]);process[_0xe12e('0x5c')](0x1);}function handleError(_0x5dbbb5,_0x41bd3b){stats[_0xe12e('0x5d')][_0xe12e('0x1b')]({'name':_0x41bd3b[_0xe12e('0x5e')],'message':_0x41bd3b[_0xe12e('0x1f')],'row':_0x5dbbb5});}function handleQuery(_0x5cf4dd){logger[_0xe12e('0x5a')](_0x5cf4dd);return db[_0xe12e('0x5f')][_0xe12e('0x17')](_0x5cf4dd)['spread'](function(_0x480071){results['push'](_0x480071);})[_0xe12e('0x1d')](function(_0x4a6b62){logger['error'](_0x4a6b62['message']);});}function main(_0x540209,_0x24af86,_0x1a4e02,_0x5f2c70){logger[_0xe12e('0x5a')](_0xe12e('0x60'),_0x540209,JSON[_0xe12e('0x61')](_0x24af86));process[_0xe12e('0x62')](_0xe12e('0x63'));var _0x4f03d0=_0x24af86[_0xe12e('0x64')];var _0xfce16b=_[_0xe12e('0x65')](_0x4f03d0);var _0x39ce24=_0x24af86[_0xe12e('0x66')];var _0x405a8e=path[_0xe12e('0x12')](config[_0xe12e('0x67')],_0xe12e('0x68'),_0x39ce24+_0xe12e('0x69'));logger[_0xe12e('0x5a')]('body',_0x24af86);db[_0xe12e('0x6a')]['findAll']({'raw':!![],'attributes':['id',_0xe12e('0x6b')]})[_0xe12e('0x1c')](function(_0xf09293){for(var _0x2110d2=0x0;_0x2110d2<_0xf09293[_0xe12e('0x1a')];_0x2110d2++){if(_0xf09293[_0x2110d2]['name']in _0x4f03d0){contactItemTypes[_0xe12e('0x1b')](_0xf09293[_0x2110d2]);delete _0xfce16b[_0xf09293[_0x2110d2]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0xfce16b['AdditionalPhones']='';var _0x512d49=_[_0xe12e('0x52')](_0xfce16b)['join']();logger[_0xe12e('0x5a')](_0xe12e('0x6c'),_0x512d49);fs[_0xe12e('0x6d')](_0x405a8e,_0x512d49+'\x0a');Papa[_0xe12e('0x6e')](fs[_0xe12e('0x6f')](_0x540209),{'header':!![],'skipEmptyLines':!![],'step':function(_0x57adbc,_0x2d90e6){try{for(var _0x1b673e=0x0,_0x52b738=[];_0x1b673e<_0x57adbc['data'][_0xe12e('0x1a')];_0x1b673e++){stats[_0xe12e('0x70')]+=0x1;if(_0x57adbc[_0xe12e('0x5d')][_0x1b673e]){handleError(_0x57adbc['data'][_0x1b673e],_0x57adbc[_0xe12e('0x5d')][_0x1b673e]);}else{var _0x30601c=[];var _0x1cf568=[];for(var _0x3549a7 in _0x4f03d0){let _0x34823c=contactItemTypes[_0xe12e('0x71')](_0x563013=>_0x563013[_0xe12e('0x6b')]===_0x3549a7);if(_[_0xe12e('0x21')](_0x34823c)){if(_0x4f03d0[_0xe12e('0x72')](_0x3549a7)){if(_0x57adbc[_0xe12e('0x73')][_0x1b673e][_0x4f03d0[_0x3549a7]]){var _0x376bd5=_[_0xe12e('0x74')](_0x57adbc[_0xe12e('0x73')][_0x1b673e][_0x4f03d0[_0x3549a7]][_0xe12e('0x75')](/"/g,'\x27'));switch(_0x3549a7){case'scheduledat':var _0x20fad0=moment(_0x376bd5,_0xe12e('0x76'),!![]);if(_0x20fad0[_0xe12e('0x77')]()){_0x52b738[_0xe12e('0x1b')]('\x22'+_0x376bd5+'\x22');}else{_0x30601c[_0xe12e('0x1b')](_0xe12e('0x78'));}break;case'priority':var _0x4acff3=parseInt(_0x376bd5);_0x376bd5=_['isNaN'](_0x4acff3)||_0x4acff3<0x0||_0x4acff3>0x4?_0x5f2c70?0x3:0x2:_0x4acff3;_0x52b738[_0xe12e('0x1b')]('\x22'+_0x376bd5+'\x22');break;case _0xe12e('0x3a'):var _0x24a33d=parseInt(_0x376bd5);if(_[_0xe12e('0x79')](_0x24a33d)&&_['includes'](_0x1a4e02,_0x24a33d)){_0x52b738['push']('\x22'+_0x24a33d+'\x22');}else{_0x30601c['push']('agent\x20not\x20exists');}break;case _0xe12e('0x7a'):if(isEmail(_0x376bd5)){_0x52b738[_0xe12e('0x1b')]('\x22'+_0x376bd5+'\x22');}else{_0x30601c[_0xe12e('0x1b')](_0xe12e('0x7b'));}break;case'dateOfBirth':var _0x4149dc=moment(_0x376bd5,'YYYY-MM-DD',!![]);if(_0x4149dc[_0xe12e('0x77')]()){_0x52b738[_0xe12e('0x1b')]('\x22'+_0x376bd5+'\x22');}else{_0x30601c['push'](_0xe12e('0x7c'));}break;default:_0x52b738['push']('\x22'+_0x376bd5+'\x22');}}else{switch(_0x3549a7){case'firstName':case _0xe12e('0x11'):_0x30601c['push'](_0x3549a7+'\x20not\x20specified');break;default:_0x52b738[_0xe12e('0x1b')]('\x22\x22');}}}}else{var _0x3bfba2='';for(var _0x147a3b=0x0;_0x147a3b<_0x4f03d0[_0x3549a7][_0xe12e('0x1a')];_0x147a3b++){var _0x376bd5=_['trim'](_0x57adbc[_0xe12e('0x73')][_0x1b673e][_0x4f03d0[_0x3549a7][_0x147a3b]][_0xe12e('0x75')](/"/g,'\x27'));if(_0x3bfba2=='')_0x3bfba2=_0x376bd5;else _0x3bfba2+='|'+_0x376bd5;}_0x1cf568['push'](_0x34823c['id']+':'+_0x3bfba2);}}if(hasAdditionalPhones){_0x52b738[_0xe12e('0x1b')]('\x22'+_0x1cf568[_0xe12e('0x12')](';')+'\x22');}if(_0x30601c[_0xe12e('0x1a')]){handleError(_0x57adbc[_0xe12e('0x73')][_0x1b673e],{'code':_0xe12e('0x7d'),'message':_0x30601c[_0xe12e('0x12')]()});}else{fs[_0xe12e('0x7e')](_0x405a8e,_0x52b738['join']()+'\x0a');}_0x52b738=[];}if(!(stats[_0xe12e('0x70')]%0xc8)){socket[_0xe12e('0x7f')](_0xe12e('0x80')+_0x39ce24,stats);stats['errors']=[];}}if(stopped){logger[_0xe12e('0x5a')](_0xe12e('0x81'));_0x2d90e6[_0xe12e('0x82')]();}}catch(_0x146c38){handleError(_0x57adbc[_0xe12e('0x73')][_0x1b673e],{'code':_0xe12e('0x83'),'message':_0x146c38[_0xe12e('0x1f')]});logger[_0xe12e('0x1e')](_0xe12e('0x84'),_0x146c38[_0xe12e('0x1f')]);}},'complete':function(){try{var _0x13f8f4=[];var _0x1f3703=tempTableName;_0x13f8f4[_0xe12e('0x1b')](_0xe12e('0x85')+_0x1f3703+_0xe12e('0x86'));logger[_0xe12e('0x5a')](_0xe12e('0x87'),contactItemTypes[_0xe12e('0x1a')]);var _0x38c340=util[_0xe12e('0xb')](_0xe12e('0x88'),_0x405a8e,_0x1f3703,_0x512d49,_0x24af86[_0xe12e('0x53')],_0x24af86[_0xe12e('0x54')]||null,NOW,NOW);if(_[_0xe12e('0x21')](_0x4f03d0[_0xe12e('0x37')])){_0x38c340+=',\x20scheduledAt\x20=\x20NOW()';}_0x13f8f4[_0xe12e('0x1b')](_0x38c340);BPromise[_0xe12e('0x89')](_0x13f8f4,handleQuery)['then'](function(_0x10c0a2){BPromise['all']([handleAdditionalPhones()])[_0xe12e('0x1c')](function(){_0x13f8f4=[];for(var _0x2657bd=0x0;_0x2657bd\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','CmContactHasItem','update','updated','PHONE','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_hopper_black','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','cm_hopper.ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','code','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','findAll','name','keys','header','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','isValid','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xa8e6,0x147));var _0x6a8e=function(_0x241bac,_0x2fef81){_0x241bac=_0x241bac-0x0;var _0x2ac7e7=_0xa8e6[_0x241bac];return _0x2ac7e7;};'use strict';var fs=require('fs');var path=require(_0x6a8e('0x0'));var _=require(_0x6a8e('0x1'));var Papa=require(_0x6a8e('0x2'));var util=require(_0x6a8e('0x3'));var BPromise=require('bluebird');var moment=require(_0x6a8e('0x4'));var squel=require('squel');var Redis=require(_0x6a8e('0x5'));var db=require(_0x6a8e('0x6'))['db'];var config=require(_0x6a8e('0x7'));var logger=require('../../../config/logger')(_0x6a8e('0x8'));config[_0x6a8e('0x9')]=_['defaults'](config[_0x6a8e('0x9')],{'host':_0x6a8e('0xa'),'port':0x18eb});var socket=require(_0x6a8e('0xb'))(new Redis(config[_0x6a8e('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6a8e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x6a8e('0xd')+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x13be44){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))*$/[_0x6a8e('0xe')](_0x13be44);}function selectNotIn(_0x42e330,_0x499eac,_0x5d7398,_0x50e8b1,_0x51548d){return squel[_0x6a8e('0xf')]()[_0x6a8e('0x10')](_0x6a8e('0x11'))[_0x6a8e('0x12')](_0x50e8b1)['join'](_0x499eac,null,_0x499eac+_0x6a8e('0x13')+_0x50e8b1+'.'+_0x5d7398)[_0x6a8e('0x14')](_0x50e8b1+'.'+_0x5d7398+_0x6a8e('0x15')+_0x42e330+'.'+_0x5d7398)[_0x6a8e('0x14')](_0x499eac+'.dialCheckDuplicateType\x20IN\x20('+_0x51548d[_0x6a8e('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3c815f,_0x301317){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6a8e('0x17')][_0x6a8e('0x18')](_0x6a8e('0x19')+tempTableName)[_0x6a8e('0x1a')](function(_0x592055){if(_0x592055!==null){var _0x98b945=[];for(var _0x159030=0x0;_0x159030<_0x592055[_0x6a8e('0x1b')];_0x159030++){var _0x4e43c6=_0x592055[_0x159030];if(!_[_0x6a8e('0x1c')](_0x4e43c6[_0x6a8e('0x11')])){if(!_[_0x6a8e('0x1c')](_0x4e43c6['AdditionalPhones']))_0x98b945['push'](insertAdditionalPhones(_0x4e43c6));promisesContact[_0x6a8e('0x1d')]({'contact':_0x4e43c6});}}}Promise[_0x6a8e('0x1e')](_0x98b945)[_0x6a8e('0x1f')](function(){_0x3c815f({'val':0x1});});})[_0x6a8e('0x20')](function(_0xc248ed){logger[_0x6a8e('0x21')](_0xc248ed[_0x6a8e('0x22')]);});});}function insertAdditionalPhones(_0x4556a7){return new Promise(function(_0x49472d,_0x16f329){var _0x2cd6ed=_0x4556a7[_0x6a8e('0x23')];if(_[_0x6a8e('0x1c')](_0x2cd6ed))_0x16f329({'val':0x0});else{var _0x5bb6b4=_0x2cd6ed[_0x6a8e('0x24')](';');var _0xbc1c4a=[];orderBy=0x0;for(var _0x243c96=0x0;_0x243c96<_0x5bb6b4[_0x6a8e('0x1b')];_0x243c96++){_0xbc1c4a[_0x6a8e('0x1d')](splitAdditionalPhone(_0x4556a7['id'],_0x5bb6b4[_0x243c96]));}Promise[_0x6a8e('0x1e')](_0xbc1c4a)[_0x6a8e('0x1f')](function(){_0x49472d({'val':_0x5bb6b4['length']});});}});}function splitAdditionalPhone(_0x1004ef,_0x115d65){return new Promise(function(_0x4a0837,_0x47e458){var _0x590b26=_0x115d65[_0x6a8e('0x24')](':');var _0x5a8311=_0x590b26[0x0];var _0x3f0f16=_0x590b26[0x1];if(_0x3f0f16!==''){var _0x337046=_0x3f0f16[_0x6a8e('0x24')]('|');var _0x243682=[];for(var _0x54135f=0x0;_0x54135f<_0x337046[_0x6a8e('0x1b')];_0x54135f++){if(_0x337046[_0x54135f]!==''){var _0x2c1d0=_[_0x6a8e('0x25')](promisesAdditionalPhones,{'contactId':_0x1004ef,'phone':_0x337046[_0x54135f]});if(_0x2c1d0['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1004ef,'contactTypeId':_0x5a8311,'phone':_0x337046[_0x54135f],'orderBy':orderBy});}}}_0x4a0837({'ok':0x1});}else _0x4a0837({'res':0x0});});}function createAdditionalPhone(_0x945a11,_0x5e2067,_0x1e3520,_0x4efb17){return new Promise(function(_0x28da07,_0x2b49ae){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x945a11,'item':_0x1e3520}})[_0x6a8e('0x1f')](function(_0x43e69f){if(_0x43e69f){return db[_0x6a8e('0x26')][_0x6a8e('0x27')]({'ItemTypeId':_0x5e2067,'OrderBy':_0x4efb17},{'where':{'CmContactId':_0x945a11,'item':_0x1e3520}})['then'](function(_0x15dbc4){_0x28da07({'res':_0x6a8e('0x28')});});}else{return db[_0x6a8e('0x26')]['create']({'CmContactId':_0x945a11,'item':_0x1e3520,'ItemTypeId':_0x5e2067,'OrderBy':_0x4efb17,'ItemClass':_0x6a8e('0x29')})[_0x6a8e('0x1f')](function(_0x3014a3){_0x28da07({'res':'inserted'});});}});});}function updateContact(_0x28db7d){return new Promise(function(_0xf095de,_0x487f9c){var _0x2cba02=_0x28db7d['id'];delete _0x28db7d['id'];return db['CmContact'][_0x6a8e('0x27')](_0x28db7d,{'where':{'id':_0x2cba02}})[_0x6a8e('0x1f')](function(_0x41fa2b){updatedRows+=0x1;return db[_0x6a8e('0x2a')]['update']({'phone':_0x28db7d[_0x6a8e('0x11')]},{'where':{'ContactId':_0x2cba02}})[_0x6a8e('0x1f')](function(_0x363cf7){_0xf095de({'ret':'OK'});});});});}function insertCmHopper(_0x38f204,_0x4d758b,_0xe8b4f5,_0x3fcb10,_0x32d501){var _0x23dfed=[_0x6a8e('0x2b'),_0x6a8e('0x2c'),'cm_contacts.id','cm_contacts.ListId',_0x4d758b+'.'+_0x3fcb10,_0x6a8e('0x2d'),_0x6a8e('0x2e'),_0x6a8e('0x2f'),_0x6a8e('0x30'),'\x22'+_0x32d501+'\x22'];return squel[_0x6a8e('0x31')]()[_0x6a8e('0x32')](_0x6a8e('0x33'))[_0x6a8e('0x34')]([_0x6a8e('0x11'),_0x6a8e('0x35'),_0x6a8e('0x36'),_0x6a8e('0x37'),_0x3fcb10,_0x6a8e('0x38'),_0x6a8e('0x39'),_0x6a8e('0x3a'),_0x6a8e('0x3b'),_0x6a8e('0x3c')],squel['select']()[_0x6a8e('0x3d')](_0x23dfed)[_0x6a8e('0x12')](_0x4d758b)['join'](_0x6a8e('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x4d758b+_0x6a8e('0x3f'))[_0x6a8e('0x16')](_0xe8b4f5,null,_0xe8b4f5+_0x6a8e('0x13')+_0x4d758b+'.'+_0x3fcb10)['where'](_0x4d758b+_0x6a8e('0x40'),_0x38f204)[_0x6a8e('0x14')](_0x6a8e('0x41'),NOW)['where'](_0x6a8e('0x42'),selectNotIn(_0x4d758b,_0xe8b4f5,_0x3fcb10,_0x6a8e('0x33'),['\x22always\x22',_0x6a8e('0x43')]))[_0x6a8e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4d758b,_0xe8b4f5,_0x3fcb10,_0x6a8e('0x33'),[_0x6a8e('0x44')])))[_0x6a8e('0x45')]();}function insertCmHopperBlack(_0x45fe3d,_0x177dba,_0x1e08bc,_0x206a10){var _0x8a723f=[_0x6a8e('0x2b'),_0x6a8e('0x46'),_0x6a8e('0x47'),_0x177dba+'.'+_0x206a10,_0x6a8e('0x2d'),'cm_contacts.updatedAt'];return squel[_0x6a8e('0x31')]()[_0x6a8e('0x32')](_0x6a8e('0x48'))['fromQuery'](['phone','ContactId',_0x6a8e('0x37'),_0x206a10,'createdAt','updatedAt'],squel[_0x6a8e('0xf')]()[_0x6a8e('0x3d')](_0x8a723f)['from'](_0x177dba)[_0x6a8e('0x16')](_0x6a8e('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x177dba+_0x6a8e('0x3f'))[_0x6a8e('0x16')](_0x1e08bc,null,_0x1e08bc+_0x6a8e('0x13')+_0x177dba+'.'+_0x206a10)[_0x6a8e('0x14')](_0x177dba+_0x6a8e('0x40'),_0x45fe3d)[_0x6a8e('0x14')](_0x6a8e('0x41'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6a8e('0x10')]('phone')[_0x6a8e('0x12')](_0x6a8e('0x48'))[_0x6a8e('0x14')]('ListId\x20=\x20?',_0x45fe3d)[_0x6a8e('0x14')](_0x206a10+_0x6a8e('0x49'),_0x177dba+'.'+_0x206a10)))[_0x6a8e('0x45')]();}function insertCmHopperAdditionalPhones(_0x2d7040){var _0x20b82f=[_0x6a8e('0x4a'),_0x6a8e('0x4b'),_0x6a8e('0x4c'),_0x6a8e('0x4d'),_0x6a8e('0x4e')];return squel[_0x6a8e('0x31')]()[_0x6a8e('0x32')]('cm_hopper_additional_phones')[_0x6a8e('0x34')]([_0x6a8e('0x4f'),_0x6a8e('0x11'),'OrderBy',_0x6a8e('0x38'),'updatedAt'],squel[_0x6a8e('0xf')]()[_0x6a8e('0x3d')](_0x20b82f)['from']('cm_hopper')[_0x6a8e('0x16')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6a8e('0x14')](_0x6a8e('0x50'),_0x2d7040)[_0x6a8e('0x14')](_0x6a8e('0x41'),NOW))[_0x6a8e('0x45')]();}function insertCmContact(_0x45d441,_0x25b9d2,_0x23333c,_0x4c26d1){var _0x456ba1=_[_0x6a8e('0x51')](_['keys'](_0x4c26d1),[_0x6a8e('0x37'),'CompanyId','createdAt',_0x6a8e('0x39')]);return squel['insert']()[_0x6a8e('0x32')](_0x6a8e('0x3e'))[_0x6a8e('0x34')](_0x456ba1,squel[_0x6a8e('0xf')]()[_0x6a8e('0x3d')](_0x456ba1)['from'](_0x25b9d2)[_0x6a8e('0x14')]('('+_0x23333c[_0x6a8e('0x16')](',')+_0x6a8e('0x52'),squel['select']()[_0x6a8e('0x3d')](_0x23333c)[_0x6a8e('0x12')](_0x6a8e('0x3e'))['where'](_0x6a8e('0x53'),_0x45d441))[_0x6a8e('0x14')]('id\x20IN\x20?',squel[_0x6a8e('0xf')]()[_0x6a8e('0x10')](_0x6a8e('0x54'),_0x6a8e('0x55'))['from'](_0x25b9d2)[_0x6a8e('0x56')](_0x23333c['join'](','))))[_0x6a8e('0x45')]();}function handleStop(){logger[_0x6a8e('0x57')](_0x6a8e('0x58'));stopped=!![];}function handleUncaughtException(_0x3e0ce5){logger['error'](_0x3e0ce5['message']);process[_0x6a8e('0x59')](0x1);}function handleError(_0x55e4f1,_0x2c506e){stats['errors']['push']({'name':_0x2c506e[_0x6a8e('0x5a')],'message':_0x2c506e[_0x6a8e('0x22')],'row':_0x55e4f1});}function handleQuery(_0x5d549e){logger[_0x6a8e('0x57')](_0x5d549e);return db['sequelize'][_0x6a8e('0x18')](_0x5d549e)[_0x6a8e('0x1a')](function(_0x3f8d0a){results[_0x6a8e('0x1d')](_0x3f8d0a);})[_0x6a8e('0x20')](function(_0x2f8e2a){logger['error'](_0x2f8e2a[_0x6a8e('0x22')]);});}function main(_0x5b4fc9,_0x246aae,_0x49d2fa,_0x5243b5){logger[_0x6a8e('0x57')](_0x6a8e('0x5b'),_0x5b4fc9,JSON[_0x6a8e('0x5c')](_0x246aae));process[_0x6a8e('0x5d')](_0x6a8e('0x5e'));var _0x59a72f=_0x246aae[_0x6a8e('0x5f')];var _0x1ac636=_[_0x6a8e('0x60')](_0x59a72f);var _0x57db75=_0x246aae[_0x6a8e('0x61')];var _0x23ac88=path['join'](config['root'],_0x6a8e('0x62'),_0x57db75+_0x6a8e('0x63'));logger[_0x6a8e('0x57')](_0x6a8e('0x64'),_0x246aae);db[_0x6a8e('0x65')][_0x6a8e('0x66')]({'raw':!![],'attributes':['id',_0x6a8e('0x67')]})['then'](function(_0x32c303){for(var _0x54e25b=0x0;_0x54e25b<_0x32c303[_0x6a8e('0x1b')];_0x54e25b++){if(_0x32c303[_0x54e25b][_0x6a8e('0x67')]in _0x59a72f){contactItemTypes[_0x6a8e('0x1d')](_0x32c303[_0x54e25b]);delete _0x1ac636[_0x32c303[_0x54e25b][_0x6a8e('0x67')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x1ac636[_0x6a8e('0x23')]='';var _0x4d8437=_[_0x6a8e('0x68')](_0x1ac636)[_0x6a8e('0x16')]();logger[_0x6a8e('0x57')](_0x6a8e('0x69'),_0x4d8437);fs['writeFileSync'](_0x23ac88,_0x4d8437+'\x0a');Papa[_0x6a8e('0x6a')](fs[_0x6a8e('0x6b')](_0x5b4fc9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3cc601,_0x4b0e03){try{for(var _0x530757=0x0,_0x3b15ee=[];_0x530757<_0x3cc601[_0x6a8e('0x6c')]['length'];_0x530757++){stats[_0x6a8e('0x6d')]+=0x1;if(_0x3cc601[_0x6a8e('0x6e')][_0x530757]){handleError(_0x3cc601['data'][_0x530757],_0x3cc601[_0x6a8e('0x6e')][_0x530757]);}else{var _0x3af372=[];var _0xd9043e=[];for(var _0x4302d5 in _0x59a72f){let _0xba6e7=contactItemTypes['find'](_0x3593f5=>_0x3593f5[_0x6a8e('0x67')]===_0x4302d5);if(_[_0x6a8e('0x1c')](_0xba6e7)){if(_0x59a72f[_0x6a8e('0x6f')](_0x4302d5)){if(_0x3cc601[_0x6a8e('0x6c')][_0x530757][_0x59a72f[_0x4302d5]]){var _0x1668f9=_[_0x6a8e('0x70')](_0x3cc601['data'][_0x530757][_0x59a72f[_0x4302d5]][_0x6a8e('0x71')](/"/g,'\x27'));switch(_0x4302d5){case _0x6a8e('0x35'):var _0x188978=moment(_0x1668f9,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x188978[_0x6a8e('0x72')]()){_0x3b15ee[_0x6a8e('0x1d')]('\x22'+_0x1668f9+'\x22');}else{_0x3af372[_0x6a8e('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x6a8e('0x3a'):var _0x54e985=parseInt(_0x1668f9);_0x1668f9=_['isNaN'](_0x54e985)||_0x54e985<0x0||_0x54e985>0x4?_0x5243b5?0x3:0x2:_0x54e985;_0x3b15ee['push']('\x22'+_0x1668f9+'\x22');break;case _0x6a8e('0x3b'):var _0x323295=parseInt(_0x1668f9);if(_[_0x6a8e('0x73')](_0x323295)&&_[_0x6a8e('0x74')](_0x49d2fa,_0x323295)){_0x3b15ee[_0x6a8e('0x1d')]('\x22'+_0x323295+'\x22');}else{_0x3af372[_0x6a8e('0x1d')](_0x6a8e('0x75'));}break;case'email':if(isEmail(_0x1668f9)){_0x3b15ee[_0x6a8e('0x1d')]('\x22'+_0x1668f9+'\x22');}else{_0x3af372[_0x6a8e('0x1d')](_0x6a8e('0x76'));}break;case _0x6a8e('0x77'):var _0x269e25=moment(_0x1668f9,_0x6a8e('0x78'),!![]);if(_0x269e25[_0x6a8e('0x72')]()){_0x3b15ee[_0x6a8e('0x1d')]('\x22'+_0x1668f9+'\x22');}else{_0x3af372[_0x6a8e('0x1d')](_0x6a8e('0x79'));}break;default:_0x3b15ee[_0x6a8e('0x1d')]('\x22'+_0x1668f9+'\x22');}}else{switch(_0x4302d5){case'firstName':case'phone':_0x3af372['push'](_0x4302d5+_0x6a8e('0x7a'));break;default:_0x3b15ee[_0x6a8e('0x1d')]('\x22\x22');}}}}else{var _0x41855f='';for(var _0x5496b9=0x0;_0x5496b9<_0x59a72f[_0x4302d5][_0x6a8e('0x1b')];_0x5496b9++){var _0x1668f9=_[_0x6a8e('0x70')](_0x3cc601[_0x6a8e('0x6c')][_0x530757][_0x59a72f[_0x4302d5][_0x5496b9]][_0x6a8e('0x71')](/"/g,'\x27'));if(_0x41855f=='')_0x41855f=_0x1668f9;else _0x41855f+='|'+_0x1668f9;}_0xd9043e[_0x6a8e('0x1d')](_0xba6e7['id']+':'+_0x41855f);}}if(hasAdditionalPhones){_0x3b15ee[_0x6a8e('0x1d')]('\x22'+_0xd9043e[_0x6a8e('0x16')](';')+'\x22');}if(_0x3af372['length']){handleError(_0x3cc601[_0x6a8e('0x6c')][_0x530757],{'code':_0x6a8e('0x7b'),'message':_0x3af372['join']()});}else{fs[_0x6a8e('0x7c')](_0x23ac88,_0x3b15ee['join']()+'\x0a');}_0x3b15ee=[];}if(!(stats[_0x6a8e('0x6d')]%0xc8)){socket[_0x6a8e('0x7d')](_0x6a8e('0x7e')+_0x57db75,stats);stats[_0x6a8e('0x6e')]=[];}}if(stopped){logger['info'](_0x6a8e('0x7f'));_0x4b0e03[_0x6a8e('0x80')]();}}catch(_0x31cc4e){handleError(_0x3cc601[_0x6a8e('0x6c')][_0x530757],{'code':_0x6a8e('0x81'),'message':_0x31cc4e[_0x6a8e('0x22')]});logger[_0x6a8e('0x21')](_0x6a8e('0x82'),_0x31cc4e[_0x6a8e('0x22')]);}},'complete':function(){try{var _0x176dba=[];var _0x27dfe7=tempTableName;_0x176dba[_0x6a8e('0x1d')](_0x6a8e('0x83')+_0x27dfe7+_0x6a8e('0x84'));logger[_0x6a8e('0x57')]('CIS\x20len',contactItemTypes['length']);var _0x8d63d0=util['format'](_0x6a8e('0x85'),_0x23ac88,_0x27dfe7,_0x4d8437,_0x246aae[_0x6a8e('0x37')],_0x246aae['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x59a72f[_0x6a8e('0x35')])){_0x8d63d0+=_0x6a8e('0x86');}_0x176dba[_0x6a8e('0x1d')](_0x8d63d0);BPromise[_0x6a8e('0x87')](_0x176dba,handleQuery)[_0x6a8e('0x1f')](function(_0x4622de){BPromise[_0x6a8e('0x1e')]([handleAdditionalPhones()])[_0x6a8e('0x1f')](function(){_0x176dba=[];for(var _0x48ce2b=0x0;_0x48ce2b=_0x130620){return _0x1172da['status'](0x193)[_0xfb12('0x11')]({'message':util[_0xfb12('0x12')](_0xfb12('0x13'),_0x42406c)});}_0x5c169d();})[_0xfb12('0x14')](function(_0xf7f5a4){_0x5c169d(_0xf7f5a4);});});}function isUserLimit(){return isLimit(_0xfb12('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xfb12('0x16')},{'role':_0xfb12('0x17')}]}});}exports[_0xfb12('0x18')]=isUserLimit; \ No newline at end of file +var _0x3976=['format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','composable-middleware','../../config/environment','data1','split','createDecipher','aes-256-ctr'];(function(_0x2d007d,_0x1eee74){var _0x4f7430=function(_0x1bdee3){while(--_0x1bdee3){_0x2d007d['push'](_0x2d007d['shift']());}};_0x4f7430(++_0x1eee74);}(_0x3976,0x1c6));var _0x6397=function(_0x2445c0,_0x28d78e){_0x2445c0=_0x2445c0-0x0;var _0x4e8e3c=_0x3976[_0x2445c0];return _0x4e8e3c;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x6397('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x6397('0x1'));function getValueFromLicense(_0x17f7e6,_0x221ccd){if(_0x17f7e6&&_0x221ccd){if(_0x221ccd[_0x6397('0x2')]&&_0x221ccd['license']){var _0x1bdee7=_0x221ccd['data1'];var _0x29e906=_0x221ccd['license'];var _0x300a7f=_0x1bdee7[_0x6397('0x3')]('-')[0x4];var _0x4a27b1=_0x1bdee7[_0x6397('0x3')]('-')[0x0];var _0x10a0b3=crypto[_0x6397('0x4')](_0x6397('0x5'),util[_0x6397('0x6')](_0x6397('0x7'),_0x300a7f,_0x1bdee7,_0x4a27b1));var _0x3a6372=_0x10a0b3[_0x6397('0x8')](_0x29e906,_0x6397('0x9'),_0x6397('0xa'));_0x3a6372+=_0x10a0b3[_0x6397('0xb')](_0x6397('0xa'));var _0x13ea07=JSON[_0x6397('0xc')](_0x3a6372);return _0x13ea07[_0x6397('0xd')](_0x17f7e6)?_0x13ea07[_0x17f7e6]:null;}}return null;}function isLimit(_0x4d42f8,_0x3dbd8e,_0x22e979,_0x1e8406){var _0x36cce2=_0x3dbd8e;return compose()[_0x6397('0xe')](function(_0x54cfaf,_0x25d42f,_0x43cdbd){return db['License'][_0x6397('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x6397('0x10')](function(_0x5b791a){var _0x3a9616=getValueFromLicense(_0x4d42f8,_0x5b791a);return _0x3a9616?_0x3a9616:_0x36cce2;})[_0x6397('0x10')](function(_0x3cb64d){_0x36cce2=_0x3cb64d;return _0x22e979[_0x6397('0x11')](_0x1e8406);})['then'](function(_0x35403f){if(_0x35403f>=_0x36cce2){return _0x25d42f['status'](0x193)[_0x6397('0x12')]({'message':util[_0x6397('0x6')](_0x6397('0x13'),_0x4d42f8)});}_0x43cdbd();})[_0x6397('0x14')](function(_0xb39c34){_0x43cdbd(_0xb39c34);});});}function isUserLimit(){return isLimit(_0x6397('0x15'),0x1,db[_0x6397('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 3d1166b..15ee3f3 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 _0x6db6=['hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','match','filter','indexOf','map','push','buildExpression','$eq','operator','$between','value','includes','$gt','$lte','add','format','castTo','text','CAST(','\x20AS\x20','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','shift','pop','DATE'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x6db6,0x120));var _0x66db=function(_0x512d49,_0x907617){_0x512d49=_0x512d49-0x0;var _0x348d3f=_0x6db6[_0x512d49];return _0x348d3f;};'use strict';var _=require(_0x66db('0x0'));var moment=require(_0x66db('0x1'));exports['parseSearch']=function(_0x30cb73){var _0x56420b={'conditions':[]};_0x56420b[_0x66db('0x2')]=_[_0x66db('0x3')](_0x30cb73,_0x66db('0x4'))?'or':_0x66db('0x5');var _0x23bd04=_0x30cb73[_0x66db('0x6')](_0x66db('0x7'),'')[_0x66db('0x6')](_0x66db('0x4'),'')[_0x66db('0x8')]('||');for(var _0xaafc95=0x0;_0xaafc95<_0x23bd04[_0x66db('0x9')];_0xaafc95++){var _0xe83980=_0x23bd04[_0xaafc95]['split'](':=');var _0x227d48=_0xe83980[0x0];var _0x54e780=_0xe83980['slice'](0x1);_0x54e780['forEach'](function(_0x15219d){var _0xd7752a=_0x15219d[_0x66db('0x8')]('[')['shift']();var _0x467f94=_0x15219d[_0x66db('0xa')](/\[(.*?)\]/g);_0x467f94['forEach'](function(_0x4773a3){var _0x26fff8=_0x4773a3[_0x66db('0x8')]('[')[_0x66db('0xb')](function(_0x233689){return _0x233689[_0x66db('0xc')](']')>-0x1;})[_0x66db('0xd')](function(_0x59de76){return _0x59de76[_0x66db('0x8')](']')[0x0];})[0x0];_0x56420b['conditions'][_0x66db('0xe')]({'field':_0x227d48,'operator':_0xd7752a,'value':_0x26fff8});});});}return _0x56420b;};exports[_0x66db('0xf')]=function(_0x47eaf7,_0x4bcc84,_0x9f9803){var _0x55c445={};if(_0x4bcc84==='DATE'){if(_0x9f9803['operator']===_0x66db('0x10')){_0x9f9803[_0x66db('0x11')]=_0x66db('0x12');_0x9f9803['value']+=','+_0x9f9803[_0x66db('0x13')];}else if(_[_0x66db('0x14')]([_0x66db('0x15'),_0x66db('0x16')],_0x9f9803['operator'])){_0x9f9803[_0x66db('0x13')]=moment(_0x9f9803['value'])[_0x66db('0x17')](0x1,'days')[_0x66db('0x18')]('YYYY-MM-DD');}}if(_0x9f9803[_0x66db('0x19')]){_0x4bcc84=_0x9f9803[_0x66db('0x19')];_0x55c445[_0x66db('0x1a')]=_0x66db('0x1b')+_0x47eaf7+'.'+_0x9f9803['field']+_0x66db('0x1c')+_0x9f9803[_0x66db('0x19')]+')\x20'+parseOperator(_0x9f9803[_0x66db('0x11')]);}else{_0x55c445[_0x66db('0x1a')]=_0x47eaf7+'.'+_0x9f9803['field']+'\x20'+parseOperator(_0x9f9803[_0x66db('0x11')]);}if(_[_0x66db('0x14')](['$ne',_0x66db('0x1d')],_0x9f9803[_0x66db('0x11')]))_0x55c445['text']='('+_0x55c445[_0x66db('0x1a')]+_0x66db('0x1e')+_0x47eaf7+'.'+_0x9f9803[_0x66db('0x1f')]+_0x66db('0x20');_0x55c445[_0x66db('0x13')]=parseValue(_0x4bcc84,_0x9f9803[_0x66db('0x11')],_0x9f9803[_0x66db('0x13')]);return _0x55c445;};function parseOperator(_0x502b9e){var _0x4a9a4a;switch(_0x502b9e){case'$in':_0x4a9a4a=_0x66db('0x21');break;case _0x66db('0x1d'):_0x4a9a4a=_0x66db('0x22');break;case'$eq':_0x4a9a4a=_0x66db('0x23');break;case _0x66db('0x24'):_0x4a9a4a=_0x66db('0x25');break;case _0x66db('0x26'):case'$startsWith':case _0x66db('0x27'):_0x4a9a4a=_0x66db('0x28');break;case _0x66db('0x29'):_0x4a9a4a=_0x66db('0x2a');break;case _0x66db('0x15'):_0x4a9a4a=_0x66db('0x2b');break;case _0x66db('0x16'):_0x4a9a4a=_0x66db('0x2c');break;case _0x66db('0x2d'):_0x4a9a4a=_0x66db('0x2e');break;case _0x66db('0x12'):_0x4a9a4a=_0x66db('0x2f');break;}return _0x4a9a4a;}function parseValue(_0x289e7d,_0x58f916,_0x4992d0){var _0x562988={'start':undefined,'end':undefined};switch(_0x58f916){case _0x66db('0x30'):case _0x66db('0x1d'):_0x562988['start']=_0x4992d0[_0x66db('0x8')](',');break;case _0x66db('0x26'):_0x562988[_0x66db('0x31')]='%'+_0x4992d0+'%';break;case _0x66db('0x32'):_0x562988['start']=_0x4992d0+'%';break;case'$endsWith':_0x562988[_0x66db('0x31')]='%'+_0x4992d0;break;case _0x66db('0x12'):var _0x431f8d=_0x4992d0['split'](',');var _0x4992d0=_0x431f8d[_0x66db('0x33')]();var _0x250e61=_0x431f8d[_0x66db('0x34')]();if(_0x289e7d===_0x66db('0x35')){_0x4992d0=moment(_0x4992d0)['utcOffset'](0x0,!![])[_0x66db('0x18')]();_0x250e61=moment(_0x250e61)['utcOffset'](0x0,!![])[_0x66db('0x17')](0x17,_0x66db('0x36'))[_0x66db('0x17')](0x3b,_0x66db('0x37'))[_0x66db('0x17')](0x3b,_0x66db('0x38'))[_0x66db('0x18')]();}_0x562988={'start':_0x4992d0,'end':_0x250e61};break;default:_0x562988[_0x66db('0x31')]=_0x4992d0;break;}return _0x562988;} \ No newline at end of file +var _0xf735=['format','YYYY-MM-DD','castTo','CAST(','field','text','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','$ne','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','minutes','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','push','operator','$between','value','includes','$gt','$lte','add','days'];(function(_0x1c4abe,_0x472bef){var _0x2b54fa=function(_0x222ba0){while(--_0x222ba0){_0x1c4abe['push'](_0x1c4abe['shift']());}};_0x2b54fa(++_0x472bef);}(_0xf735,0x1a6));var _0x5f73=function(_0x5ecd10,_0x1183eb){_0x5ecd10=_0x5ecd10-0x0;var _0x49eaf1=_0xf735[_0x5ecd10];return _0x49eaf1;};'use strict';var _=require('lodash');var moment=require(_0x5f73('0x0'));exports[_0x5f73('0x1')]=function(_0x395f57){var _0x5374ca={'conditions':[]};_0x5374ca[_0x5f73('0x2')]=_[_0x5f73('0x3')](_0x395f57,_0x5f73('0x4'))?'or':_0x5f73('0x5');var _0xfc4c34=_0x395f57[_0x5f73('0x6')](_0x5f73('0x7'),'')[_0x5f73('0x6')](_0x5f73('0x4'),'')[_0x5f73('0x8')]('||');for(var _0x542269=0x0;_0x542269<_0xfc4c34[_0x5f73('0x9')];_0x542269++){var _0x556d22=_0xfc4c34[_0x542269][_0x5f73('0x8')](':=');var _0x296a05=_0x556d22[0x0];var _0x1387c1=_0x556d22[_0x5f73('0xa')](0x1);_0x1387c1[_0x5f73('0xb')](function(_0x3f90a9){var _0x3c1e1b=_0x3f90a9[_0x5f73('0x8')]('[')[_0x5f73('0xc')]();var _0x381b74=_0x3f90a9[_0x5f73('0xd')](/\[(.*?)\]/g);_0x381b74[_0x5f73('0xb')](function(_0x5cd80b){var _0xe154eb=_0x5cd80b[_0x5f73('0x8')]('[')[_0x5f73('0xe')](function(_0x4ea337){return _0x4ea337[_0x5f73('0xf')](']')>-0x1;})[_0x5f73('0x10')](function(_0xedfece){return _0xedfece[_0x5f73('0x8')](']')[0x0];})[0x0];_0x5374ca['conditions'][_0x5f73('0x11')]({'field':_0x296a05,'operator':_0x3c1e1b,'value':_0xe154eb});});});}return _0x5374ca;};exports['buildExpression']=function(_0x5d9b38,_0x4dd8a3,_0x2c4176){var _0x14a7e8={};if(_0x4dd8a3==='DATE'){if(_0x2c4176[_0x5f73('0x12')]==='$eq'){_0x2c4176[_0x5f73('0x12')]=_0x5f73('0x13');_0x2c4176[_0x5f73('0x14')]+=','+_0x2c4176[_0x5f73('0x14')];}else if(_[_0x5f73('0x15')]([_0x5f73('0x16'),_0x5f73('0x17')],_0x2c4176[_0x5f73('0x12')])){_0x2c4176[_0x5f73('0x14')]=moment(_0x2c4176[_0x5f73('0x14')])[_0x5f73('0x18')](0x1,_0x5f73('0x19'))[_0x5f73('0x1a')](_0x5f73('0x1b'));}}if(_0x2c4176[_0x5f73('0x1c')]){_0x4dd8a3=_0x2c4176[_0x5f73('0x1c')];_0x14a7e8['text']=_0x5f73('0x1d')+_0x5d9b38+'.'+_0x2c4176[_0x5f73('0x1e')]+'\x20AS\x20'+_0x2c4176['castTo']+')\x20'+parseOperator(_0x2c4176[_0x5f73('0x12')]);}else{_0x14a7e8[_0x5f73('0x1f')]=_0x5d9b38+'.'+_0x2c4176[_0x5f73('0x1e')]+'\x20'+parseOperator(_0x2c4176[_0x5f73('0x12')]);}if(_[_0x5f73('0x15')](['$ne',_0x5f73('0x20')],_0x2c4176['operator']))_0x14a7e8[_0x5f73('0x1f')]='('+_0x14a7e8[_0x5f73('0x1f')]+_0x5f73('0x21')+_0x5d9b38+'.'+_0x2c4176['field']+_0x5f73('0x22');_0x14a7e8[_0x5f73('0x14')]=parseValue(_0x4dd8a3,_0x2c4176[_0x5f73('0x12')],_0x2c4176[_0x5f73('0x14')]);return _0x14a7e8;};function parseOperator(_0x1a26d9){var _0x2e7dab;switch(_0x1a26d9){case _0x5f73('0x23'):_0x2e7dab=_0x5f73('0x24');break;case _0x5f73('0x20'):_0x2e7dab=_0x5f73('0x25');break;case _0x5f73('0x26'):_0x2e7dab='=\x20?';break;case _0x5f73('0x27'):_0x2e7dab='<>\x20?';break;case _0x5f73('0x28'):case _0x5f73('0x29'):case'$endsWith':_0x2e7dab=_0x5f73('0x2a');break;case _0x5f73('0x2b'):_0x2e7dab=_0x5f73('0x2c');break;case _0x5f73('0x16'):_0x2e7dab=_0x5f73('0x2d');break;case _0x5f73('0x17'):_0x2e7dab=_0x5f73('0x2e');break;case _0x5f73('0x2f'):_0x2e7dab=_0x5f73('0x30');break;case _0x5f73('0x13'):_0x2e7dab=_0x5f73('0x31');break;}return _0x2e7dab;}function parseValue(_0xeb9b26,_0x584b94,_0x2431fc){var _0x34b0d4={'start':undefined,'end':undefined};switch(_0x584b94){case _0x5f73('0x23'):case _0x5f73('0x20'):_0x34b0d4[_0x5f73('0x32')]=_0x2431fc['split'](',');break;case'$substring':_0x34b0d4[_0x5f73('0x32')]='%'+_0x2431fc+'%';break;case _0x5f73('0x29'):_0x34b0d4[_0x5f73('0x32')]=_0x2431fc+'%';break;case _0x5f73('0x33'):_0x34b0d4[_0x5f73('0x32')]='%'+_0x2431fc;break;case _0x5f73('0x13'):var _0xc35beb=_0x2431fc[_0x5f73('0x8')](',');var _0x2431fc=_0xc35beb[_0x5f73('0xc')]();var _0x3854b8=_0xc35beb[_0x5f73('0x34')]();if(_0xeb9b26===_0x5f73('0x35')){_0x2431fc=moment(_0x2431fc)[_0x5f73('0x36')](0x0,!![])[_0x5f73('0x1a')]();_0x3854b8=moment(_0x3854b8)[_0x5f73('0x36')](0x0,!![])[_0x5f73('0x18')](0x17,'hours')[_0x5f73('0x18')](0x3b,_0x5f73('0x37'))['add'](0x3b,'seconds')['format']();}_0x34b0d4={'start':_0x2431fc,'end':_0x3854b8};break;default:_0x34b0d4[_0x5f73('0x32')]=_0x2431fc;break;}return _0x34b0d4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8632645..ddb56df 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 _0x9632=['format','$lte','subtract','isArray','parse','limit','indexOf','priority','cast','unsigned','substr','DESC','col','ASC','omit','isEmpty','length','isObject','isString','unset','isNumeric','match','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','moment','fields','split','filters','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc'];(function(_0x48fdbb,_0x3239bd){var _0x198205=function(_0x1dd8c6){while(--_0x1dd8c6){_0x48fdbb['push'](_0x48fdbb['shift']());}};_0x198205(++_0x3239bd);}(_0x9632,0x1b6));var _0x2963=function(_0x5b5047,_0x4fde8e){_0x5b5047=_0x5b5047-0x0;var _0x17a267=_0x9632[_0x5b5047];return _0x17a267;};'use strict';var _=require(_0x2963('0x0'));var sequelize=require(_0x2963('0x1'));var moment=require(_0x2963('0x2'));var LIMIT_VALUE=0xfa;exports[_0x2963('0x3')]=function(_0x5d4e92){var _0x580a8c=null;if(_0x5d4e92){_0x580a8c=_0x5d4e92[_0x2963('0x4')](',');}return _0x580a8c;};exports[_0x2963('0x5')]=function(_0x19500d,_0x3f9725){var _0x3f79af={};if(!_['isEmpty'](_0x19500d)){_[_0x2963('0x6')](_0x19500d,function(_0xaf7422,_0xaf1a6){try{if(_0x3f9725){var _0x10ec35=_[_0x2963('0x7')](_0x3f9725,{'name':_0xaf1a6})||{};if(_0x10ec35[_0x2963('0x8')]==='DATE'&&_[_0x2963('0x9')](_0xaf7422)){var _0x42f702=JSON['parse'](_0xaf7422);var _0x6468a7={'$gte':moment(moment(_0x42f702[_0x2963('0xa')])['format'](_0x2963('0xb')))[_0x2963('0xc')]()[_0x2963('0xd')](),'$lte':moment(moment(_0x42f702[_0x2963('0xe')])[_0x2963('0xd')]('YYYY-MM-DD'))[_0x2963('0xc')]()[_0x2963('0xf')](0x1,'s')['format']()};_0x3f79af[_0xaf1a6]=_0x6468a7;}else{_0x3f79af[_0xaf1a6]=_[_0x2963('0x10')](_0xaf7422)?_0xaf7422:JSON['parse'](_0xaf7422);}}else{_0x3f79af[_0xaf1a6]=_[_0x2963('0x10')](_0xaf7422)?_0xaf7422:JSON[_0x2963('0x11')](_0xaf7422);}}catch(_0x4b1685){_0x3f79af[_0xaf1a6]=_0xaf7422[_0x2963('0x4')](',');}});}return _0x3f79af;};exports[_0x2963('0x12')]=function(_0x5f1912){_0x5f1912=parseInt(_0x5f1912,0xa);if(!_0x5f1912||_0x5f1912<0x0){_0x5f1912=LIMIT_VALUE;}return _0x5f1912;};exports['offset']=function(_0x2812d5){_0x2812d5=parseInt(_0x2812d5,0xa);if(!_0x2812d5||_0x2812d5<0x0){_0x2812d5=0x0;}return _0x2812d5;};exports['sort']=function(_0x55c089){var _0x1cb496,_0x4c44b6=null;if(_0x55c089){_0x1cb496=_0x55c089[_0x2963('0x4')](',');_0x4c44b6=_['map'](_0x1cb496,function(_0x41f0d7){if(_0x41f0d7[_0x2963('0x13')]('-')===0x0){return[_0x41f0d7===_0x2963('0x14')?sequelize[_0x2963('0x15')](sequelize['col'](_0x2963('0x14')),_0x2963('0x16')):_0x41f0d7[_0x2963('0x17')](0x1),_0x2963('0x18')];}else{return[_0x41f0d7==='priority'?sequelize[_0x2963('0x15')](sequelize[_0x2963('0x19')](_0x2963('0x14')),_0x2963('0x16')):_0x41f0d7,_0x2963('0x1a')];}});}return _0x4c44b6;};exports[_0x2963('0x1b')]=function(_0x5f5bb8,_0x306f33){if(_[_0x2963('0x1c')](_0x5f5bb8)){return _0x5f5bb8;}if(_[_0x2963('0x10')](_0x5f5bb8)){for(var _0x2a6f87=0x0;_0x2a6f87<_0x5f5bb8[_0x2963('0x1d')];_0x2a6f87+=0x1){_0x5f5bb8[_0x2a6f87]=this[_0x2963('0x1b')](_0x5f5bb8[_0x2a6f87],_0x306f33);}return _0x5f5bb8;}if(!_[_0x2963('0x1e')](_0x5f5bb8)){return _0x5f5bb8;}if(_[_0x2963('0x1f')](_0x306f33)){_0x306f33=[_0x306f33];}if(!_[_0x2963('0x10')](_0x306f33)){return _0x5f5bb8;}for(var _0x4ed37f=0x0;_0x4ed37f<_0x306f33[_0x2963('0x1d')];_0x4ed37f+=0x1){_[_0x2963('0x20')](_0x5f5bb8,_0x306f33[_0x4ed37f]);}for(var _0x580e7f in _0x5f5bb8){if(_0x5f5bb8['hasOwnProperty'](_0x580e7f)){_0x5f5bb8[_0x580e7f]=this[_0x2963('0x1b')](_0x5f5bb8[_0x580e7f],_0x306f33);}}return _0x5f5bb8;};exports[_0x2963('0x21')]=function(_0x12c532){return _0x12c532[_0x2963('0x22')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x2963('0x23')]=function(_0x2bbd39){return _0x2bbd39[_0x2963('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x2963('0x24')]=function(_0x4bbadb){var _0x2e98c6=[];_0x4bbadb[_0x2963('0x4')]('\x20')[_0x2963('0x25')](function(_0x198987){_0x2e98c6[_0x2963('0x26')]('+'+_0x198987[_0x2963('0x27')]()+'*');});return _0x2e98c6[_0x2963('0x28')]('\x20');}; \ No newline at end of file +var _0x23c9=['$lte','YYYY-MM-DD','subtract','isArray','limit','offset','map','indexOf','priority','substr','DESC','cast','col','unsigned','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','utc'];(function(_0x2e8943,_0x462fae){var _0x2fd6e0=function(_0x177111){while(--_0x177111){_0x2e8943['push'](_0x2e8943['shift']());}};_0x2fd6e0(++_0x462fae);}(_0x23c9,0x1b7));var _0x923c=function(_0x2bdb15,_0x5a0ad7){_0x2bdb15=_0x2bdb15-0x0;var _0x22c7d0=_0x23c9[_0x2bdb15];return _0x22c7d0;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x923c('0x0')]=function(_0x1bba3d){var _0x4fd3d4=null;if(_0x1bba3d){_0x4fd3d4=_0x1bba3d[_0x923c('0x1')](',');}return _0x4fd3d4;};exports['filters']=function(_0x1b6642,_0x10b58a){var _0x308ace={};if(!_[_0x923c('0x2')](_0x1b6642)){_[_0x923c('0x3')](_0x1b6642,function(_0x18f236,_0x7c161a){try{if(_0x10b58a){var _0x4f4e3f=_[_0x923c('0x4')](_0x10b58a,{'name':_0x7c161a})||{};if(_0x4f4e3f[_0x923c('0x5')]===_0x923c('0x6')&&_[_0x923c('0x7')](_0x18f236)){var _0x193063=JSON[_0x923c('0x8')](_0x18f236);var _0x496a2d={'$gte':moment(moment(_0x193063[_0x923c('0x9')])[_0x923c('0xa')]('YYYY-MM-DD'))[_0x923c('0xb')]()[_0x923c('0xa')](),'$lte':moment(moment(_0x193063[_0x923c('0xc')])[_0x923c('0xa')](_0x923c('0xd')))[_0x923c('0xb')]()[_0x923c('0xe')](0x1,'s')[_0x923c('0xa')]()};_0x308ace[_0x7c161a]=_0x496a2d;}else{_0x308ace[_0x7c161a]=_[_0x923c('0xf')](_0x18f236)?_0x18f236:JSON[_0x923c('0x8')](_0x18f236);}}else{_0x308ace[_0x7c161a]=_[_0x923c('0xf')](_0x18f236)?_0x18f236:JSON[_0x923c('0x8')](_0x18f236);}}catch(_0x39c970){_0x308ace[_0x7c161a]=_0x18f236[_0x923c('0x1')](',');}});}return _0x308ace;};exports[_0x923c('0x10')]=function(_0x4f258b){_0x4f258b=parseInt(_0x4f258b,0xa);if(!_0x4f258b||_0x4f258b<0x0){_0x4f258b=LIMIT_VALUE;}return _0x4f258b;};exports[_0x923c('0x11')]=function(_0x51b84d){_0x51b84d=parseInt(_0x51b84d,0xa);if(!_0x51b84d||_0x51b84d<0x0){_0x51b84d=0x0;}return _0x51b84d;};exports['sort']=function(_0x4db69f){var _0x34f1be,_0x335f68=null;if(_0x4db69f){_0x34f1be=_0x4db69f[_0x923c('0x1')](',');_0x335f68=_[_0x923c('0x12')](_0x34f1be,function(_0x54a293){if(_0x54a293[_0x923c('0x13')]('-')===0x0){return[_0x54a293===_0x923c('0x14')?sequelize['cast'](sequelize['col']('priority'),'unsigned'):_0x54a293[_0x923c('0x15')](0x1),_0x923c('0x16')];}else{return[_0x54a293===_0x923c('0x14')?sequelize[_0x923c('0x17')](sequelize[_0x923c('0x18')](_0x923c('0x14')),_0x923c('0x19')):_0x54a293,'ASC'];}});}return _0x335f68;};exports[_0x923c('0x1a')]=function(_0x4ce981,_0x1f4327){if(_[_0x923c('0x2')](_0x4ce981)){return _0x4ce981;}if(_[_0x923c('0xf')](_0x4ce981)){for(var _0x43fa95=0x0;_0x43fa95<_0x4ce981[_0x923c('0x1b')];_0x43fa95+=0x1){_0x4ce981[_0x43fa95]=this[_0x923c('0x1a')](_0x4ce981[_0x43fa95],_0x1f4327);}return _0x4ce981;}if(!_[_0x923c('0x1c')](_0x4ce981)){return _0x4ce981;}if(_[_0x923c('0x1d')](_0x1f4327)){_0x1f4327=[_0x1f4327];}if(!_['isArray'](_0x1f4327)){return _0x4ce981;}for(var _0x93c5e4=0x0;_0x93c5e4<_0x1f4327[_0x923c('0x1b')];_0x93c5e4+=0x1){_[_0x923c('0x1e')](_0x4ce981,_0x1f4327[_0x93c5e4]);}for(var _0xe25c67 in _0x4ce981){if(_0x4ce981[_0x923c('0x1f')](_0xe25c67)){_0x4ce981[_0xe25c67]=this['omit'](_0x4ce981[_0xe25c67],_0x1f4327);}}return _0x4ce981;};exports[_0x923c('0x20')]=function(_0x47269c){return _0x47269c[_0x923c('0x21')](RegExp(_0x923c('0x22')))?!![]:![];};exports[_0x923c('0x23')]=function(_0x35bfbf){return _0x35bfbf[_0x923c('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x923c('0x24')]=function(_0xe2215e){var _0x2e597c=[];_0xe2215e[_0x923c('0x1')]('\x20')[_0x923c('0x25')](function(_0x24c14a){_0x2e597c[_0x923c('0x26')]('+'+_0x24c14a[_0x923c('0x27')]()+'*');});return _0x2e597c[_0x923c('0x28')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a12514f..515c628 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48dc=['appPath','root','public','development','test','set','client','use','toISOString','split','get','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','errorhandler','passport','cors','moment','../mysqldb','env'];(function(_0x56b471,_0x28b08d){var _0x39e7a1=function(_0x4e3b3d){while(--_0x4e3b3d){_0x56b471['push'](_0x56b471['shift']());}};_0x39e7a1(++_0x28b08d);}(_0x48dc,0xb0));var _0xc48d=function(_0x2d5aca,_0x19beca){_0x2d5aca=_0x2d5aca-0x0;var _0x24ae42=_0x48dc[_0x2d5aca];return _0x24ae42;};'use strict';var express=require(_0xc48d('0x0'));var favicon=require(_0xc48d('0x1'));var bodyParser=require(_0xc48d('0x2'));var methodOverride=require(_0xc48d('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xc48d('0x4'));var path=require('path');var passport=require(_0xc48d('0x5'));var cors=require(_0xc48d('0x6'));var moment=require(_0xc48d('0x7'));var config=require('./environment');var db=require(_0xc48d('0x8'))['db'];exports['default']=function(_0x40d067){var _0x17fd0c=_0x40d067['get'](_0xc48d('0x9'));if(_0x17fd0c==='production'){_0x40d067['set'](_0xc48d('0xa'),path['join'](config[_0xc48d('0xb')],_0xc48d('0xc')));}if(_0x17fd0c===_0xc48d('0xd')||_0x17fd0c===_0xc48d('0xe')){_0x40d067[_0xc48d('0xf')]('appPath',path['join'](config[_0xc48d('0xb')],_0xc48d('0x10')));_0x40d067[_0xc48d('0x11')](errorHandler());}_0x40d067[_0xc48d('0xf')]('json\x20replacer',function(_0x5d10fe,_0x412dbf){if(this[_0x5d10fe]instanceof Date){_0x412dbf=this[_0x5d10fe][_0xc48d('0x12')]()[_0xc48d('0x13')]('.')[0x0]+'Z';}return _0x412dbf;});_0x40d067['use'](express['static'](_0x40d067[_0xc48d('0x14')]('appPath')));_0x40d067[_0xc48d('0xf')](_0xc48d('0x15'),config[_0xc48d('0xb')]+_0xc48d('0x16'));_0x40d067[_0xc48d('0x17')](_0xc48d('0x18'),require(_0xc48d('0x19'))[_0xc48d('0x1a')]);_0x40d067[_0xc48d('0xf')](_0xc48d('0x1b'),_0xc48d('0x18'));_0x40d067[_0xc48d('0x11')](bodyParser[_0xc48d('0x1c')]({'limit':_0xc48d('0x1d'),'extended':!![]}));_0x40d067[_0xc48d('0x11')](bodyParser[_0xc48d('0x1e')]({'limit':'50mb'}));_0x40d067[_0xc48d('0x11')](cors());_0x40d067['use'](methodOverride());_0x40d067[_0xc48d('0x11')](cookieParser());_0x40d067[_0xc48d('0x11')](passport['initialize']());}; \ No newline at end of file +var _0x78bc=['json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','get','production','join','root','development','test','set','client','use','json\x20replacer','toISOString','split','appPath','/server/views','engine','html','renderFile','urlencoded','50mb'];(function(_0x22c4d7,_0x519ab3){var _0x2345ec=function(_0x320a08){while(--_0x320a08){_0x22c4d7['push'](_0x22c4d7['shift']());}};_0x2345ec(++_0x519ab3);}(_0x78bc,0x162));var _0xc78b=function(_0x2dc49b,_0x559045){_0x2dc49b=_0x2dc49b-0x0;var _0x5de36c=_0x78bc[_0x2dc49b];return _0x5de36c;};'use strict';var express=require(_0xc78b('0x0'));var favicon=require(_0xc78b('0x1'));var bodyParser=require(_0xc78b('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0xc78b('0x3'));var errorHandler=require(_0xc78b('0x4'));var path=require(_0xc78b('0x5'));var passport=require(_0xc78b('0x6'));var cors=require(_0xc78b('0x7'));var moment=require(_0xc78b('0x8'));var config=require(_0xc78b('0x9'));var db=require(_0xc78b('0xa'))['db'];exports['default']=function(_0x45dd6f){var _0x228584=_0x45dd6f[_0xc78b('0xb')]('env');if(_0x228584===_0xc78b('0xc')){_0x45dd6f['set']('appPath',path[_0xc78b('0xd')](config[_0xc78b('0xe')],'public'));}if(_0x228584===_0xc78b('0xf')||_0x228584===_0xc78b('0x10')){_0x45dd6f[_0xc78b('0x11')]('appPath',path[_0xc78b('0xd')](config[_0xc78b('0xe')],_0xc78b('0x12')));_0x45dd6f[_0xc78b('0x13')](errorHandler());}_0x45dd6f[_0xc78b('0x11')](_0xc78b('0x14'),function(_0x4abd4c,_0x5e7477){if(this[_0x4abd4c]instanceof Date){_0x5e7477=this[_0x4abd4c][_0xc78b('0x15')]()[_0xc78b('0x16')]('.')[0x0]+'Z';}return _0x5e7477;});_0x45dd6f[_0xc78b('0x13')](express['static'](_0x45dd6f[_0xc78b('0xb')](_0xc78b('0x17'))));_0x45dd6f[_0xc78b('0x11')]('views',config[_0xc78b('0xe')]+_0xc78b('0x18'));_0x45dd6f[_0xc78b('0x19')](_0xc78b('0x1a'),require('ejs')[_0xc78b('0x1b')]);_0x45dd6f[_0xc78b('0x11')]('view\x20engine',_0xc78b('0x1a'));_0x45dd6f[_0xc78b('0x13')](bodyParser[_0xc78b('0x1c')]({'limit':_0xc78b('0x1d'),'extended':!![]}));_0x45dd6f['use'](bodyParser[_0xc78b('0x1e')]({'limit':_0xc78b('0x1d')}));_0x45dd6f[_0xc78b('0x13')](cors());_0x45dd6f[_0xc78b('0x13')](methodOverride());_0x45dd6f[_0xc78b('0x13')](cookieParser());_0x45dd6f[_0xc78b('0x13')](passport[_0xc78b('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a69d52e..9577543 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 _0x46ed=['execSync','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','mac','address','127.0.0.1','getFirstInterface','orderBy','map','join','createHash','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','update','substring','lodash','crypto','child_process'];(function(_0x5890ed,_0x5eec7c){var _0x49ef9b=function(_0x3d68eb){while(--_0x3d68eb){_0x5890ed['push'](_0x5890ed['shift']());}};_0x49ef9b(++_0x5eec7c);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd46e('0x0'));var os=require('os');var crypto=require(_0xd46e('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xd46e('0x2'))[_0xd46e('0x3')];function getInterfaces(){var _0x1f15e7=[];var _0x537ad5=os[_0xd46e('0x4')]();var _0x4518b8=_['orderBy'](_[_0xd46e('0x5')](_0x537ad5));for(var _0x1926d9=0x0;_0x1926d9<_0x4518b8[_0xd46e('0x6')];_0x1926d9++){var _0x25cf78=_0x537ad5[_0x4518b8[_0x1926d9]][_0xd46e('0x7')](function(_0x855f24){return _0x855f24[_0xd46e('0x8')]===_0xd46e('0x9')&&_0x855f24[_0xd46e('0xa')]===![];});_0x1f15e7=_0x1f15e7[_0xd46e('0xb')](_0x25cf78);}return _0x1f15e7;}function getFirstInterface(){var _0x3af67d=_['head'](getInterfaces());return{'macAddress':_0x3af67d&&_0x3af67d[_0xd46e('0xc')]?_0x3af67d[_0xd46e('0xc')]:'00:00:00:00:00:00','ipAddress':_0x3af67d&&_0x3af67d[_0xd46e('0xd')]?_0x3af67d[_0xd46e('0xd')]:_0xd46e('0xe')};}exports[_0xd46e('0xf')]=getFirstInterface;function getCPUhash(){var _0x1ad723=_[_0xd46e('0x10')](os['cpus']()[_0xd46e('0x11')](function(_0x5bc1da){return _0x5bc1da['model'];}))[_0xd46e('0x12')](':');return crypto[_0xd46e('0x13')]('md5')['update'](_0x1ad723)[_0xd46e('0x14')](_0xd46e('0x15'));}exports[_0xd46e('0x16')]=function(){switch(os[_0xd46e('0x17')]()){case'win32':return exec(_0xd46e('0x18'),{'encoding':_0xd46e('0x19')})[_0xd46e('0x1a')]('\x0d\x0a','');default:var _0x3d72ce=getFirstInterface();var _0x36a317=getCPUhash();var _0x47fa8f=_0x36a317+'|'+os[_0xd46e('0x1b')]()+'|'+_0x3d72ce[_0xd46e('0x1c')]+'|'+_0x3d72ce[_0xd46e('0x1d')];var _0x551358=crypto['createHash'](_0xd46e('0x1e'))[_0xd46e('0x1f')](_0x47fa8f)['digest']('hex');return _0x551358[_0xd46e('0x20')](0x0,0x8)+'-'+_0x551358[_0xd46e('0x20')](0x8,0xc)+'-'+_0x551358[_0xd46e('0x20')](0xc,0x10)+'-'+_0x551358[_0xd46e('0x20')](0x10,0x14)+'-'+_0x551358[_0xd46e('0x20')](0x14);}}; \ No newline at end of file +var _0x972c=['getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','bimedia-machine-uuid','child_process','orderBy','keys','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','digest','hex'];(function(_0xf32cb8,_0x5363d2){var _0xab6426=function(_0x525646){while(--_0x525646){_0xf32cb8['push'](_0xf32cb8['shift']());}};_0xab6426(++_0x5363d2);}(_0x972c,0xf2));var _0xc972=function(_0x552e9d,_0x5e5be4){_0x552e9d=_0x552e9d-0x0;var _0x5525a4=_0x972c[_0x552e9d];return _0x5525a4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xc972('0x0'));var exec=require(_0xc972('0x1'))['execSync'];function getInterfaces(){var _0x3c04a5=[];var _0x1a41f9=os['networkInterfaces']();var _0x511ad4=_[_0xc972('0x2')](_[_0xc972('0x3')](_0x1a41f9));for(var _0x29b5d1=0x0;_0x29b5d1<_0x511ad4['length'];_0x29b5d1++){var _0xd70261=_0x1a41f9[_0x511ad4[_0x29b5d1]]['filter'](function(_0x1c1a16){return _0x1c1a16[_0xc972('0x4')]===_0xc972('0x5')&&_0x1c1a16['internal']===![];});_0x3c04a5=_0x3c04a5['concat'](_0xd70261);}return _0x3c04a5;}function getFirstInterface(){var _0x48fe12=_[_0xc972('0x6')](getInterfaces());return{'macAddress':_0x48fe12&&_0x48fe12['mac']?_0x48fe12[_0xc972('0x7')]:_0xc972('0x8'),'ipAddress':_0x48fe12&&_0x48fe12[_0xc972('0x9')]?_0x48fe12[_0xc972('0x9')]:_0xc972('0xa')};}exports[_0xc972('0xb')]=getFirstInterface;function getCPUhash(){var _0x233d36=_['orderBy'](os[_0xc972('0xc')]()[_0xc972('0xd')](function(_0x27851c){return _0x27851c['model'];}))[_0xc972('0xe')](':');return crypto[_0xc972('0xf')](_0xc972('0x10'))['update'](_0x233d36)[_0xc972('0x11')](_0xc972('0x12'));}exports[_0xc972('0x13')]=function(){switch(os[_0xc972('0x14')]()){case'win32':return exec(_0xc972('0x15'),{'encoding':_0xc972('0x16')})[_0xc972('0x17')]('\x0d\x0a','');default:var _0x341564=getFirstInterface();var _0x40217e=getCPUhash();var _0x268f04=_0x40217e+'|'+os[_0xc972('0x18')]()+'|'+_0x341564[_0xc972('0x19')]+'|'+_0x341564[_0xc972('0x1a')];var _0x9c986f=crypto[_0xc972('0xf')](_0xc972('0x10'))[_0xc972('0x1b')](_0x268f04)[_0xc972('0x11')](_0xc972('0x12'));return _0x9c986f[_0xc972('0x1c')](0x0,0x8)+'-'+_0x9c986f['substring'](0x8,0xc)+'-'+_0x9c986f[_0xc972('0x1c')](0xc,0x10)+'-'+_0x9c986f[_0xc972('0x1c')](0x10,0x14)+'-'+_0x9c986f[_0xc972('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c8d4e99..347c63f 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(_0x5005ba,_0x423ed1){var _0x21278c=function(_0x49799b){while(--_0x49799b){_0x5005ba['push'](_0x5005ba['shift']());}};_0x21278c(++_0x423ed1);}(_0xaf5a,0x116));var _0xaaf5=function(_0x2c5d4e,_0x6d5975){_0x2c5d4e=_0x2c5d4e-0x0;var _0xe27290=_0xaf5a[_0x2c5d4e];return _0xe27290;};'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 _0xa3fe=['fullname','email','then','|uuid|','|machineUuid|','|email|','ipAddress','openIssue','MOTLICENSE','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','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','catch','session','utf8','base64','createDecipher','aes-256-ctr','secrets','update','final','||FIELD||VALUE||\x0a','findOne','admin'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0xa3fe,0xd8));var _0xea3f=function(_0x18906a,_0x20647d){_0x18906a=_0x18906a-0x0;var _0x283407=_0xa3fe[_0x18906a];return _0x283407;};'use strict';var util=require(_0xea3f('0x0'));var crypto=require('crypto');var moment=require(_0xea3f('0x1'));var rp=require(_0xea3f('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xea3f('0x3'))(module,_0xea3f('0x4'));var db=require(_0xea3f('0x5'))['db'];var config=require('../environment');var hardware=require(_0xea3f('0x6'));var logger=require('../logger')(_0xea3f('0x7'));var jira=require(_0xea3f('0x8'));var HOST=_0xea3f('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x49e494){return new BPromise(function(_0x56abd6,_0x187ce0){var _0x35ba50=util[_0xea3f('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x49e494,module['exports'][_0xea3f('0x4')]);if(oldToken){_0x35ba50=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x49e494,module[_0xea3f('0xb')][_0xea3f('0x4')],oldToken);}var _0x414ddb={'uri':_0x35ba50,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x414ddb)['then'](function(_0x5c8cd3){_0x56abd6(_0x5c8cd3);})[_0xea3f('0xc')](function(_0x14d764){_0x187ce0(_0x14d764);});});}function encryptDate(_0x426577){var _0x363046=crypto['createCipher']('aes-256-ctr',config['secrets'][_0xea3f('0xd')]);var _0x347578=_0x363046['update'](_0x426577,_0xea3f('0xe'),_0xea3f('0xf'));_0x347578+=_0x363046['final'](_0xea3f('0xf'));return _0x347578;}function decryptDate(_0x307409){var _0x153f0e=crypto[_0xea3f('0x10')](_0xea3f('0x11'),config[_0xea3f('0x12')][_0xea3f('0xd')]);var _0x2585f1=_0x153f0e[_0xea3f('0x13')](_0x307409,_0xea3f('0xf'),_0xea3f('0xe'));_0x2585f1+=_0x153f0e[_0xea3f('0x14')](_0xea3f('0xe'));return _0x2585f1;}function sendJiraAlert(_0x116d13,_0x35798d,_0xc199e4){var _0x24d3b5=_0xea3f('0x15');return db['User'][_0xea3f('0x16')]({'where':{'role':_0xea3f('0x17')},'attributes':[_0xea3f('0x18'),_0xea3f('0x19')],'raw':!![]})[_0xea3f('0x1a')](function(_0x4884fa){ADMIN=_0x4884fa;_0x24d3b5+='|reason|'+_0xc199e4+'|\x0a';_0x24d3b5+=_0xea3f('0x1b')+_0x116d13+'|\x0a';_0x24d3b5+=_0xea3f('0x1c')+_0x35798d+'|\x0a';_0x24d3b5+='|name|'+ADMIN[_0xea3f('0x18')]+'|\x0a';_0x24d3b5+=_0xea3f('0x1d')+ADMIN[_0xea3f('0x19')]+'|\x0a';return _0x24d3b5;})[_0xea3f('0x1a')](function(_0x5f452b){var _0x5bd381=hardware['getFirstInterface']()[_0xea3f('0x1e')];return jira[_0xea3f('0x1f')]({'key':_0xea3f('0x20'),'summary':_0xea3f('0x21'),'description':_0x5f452b,'issuetype':_0xea3f('0x22'),'oldToken':_0x116d13,'newToken':_0x35798d,'email':ADMIN[_0xea3f('0x19')],'name':ADMIN[_0xea3f('0x18')],'reason':GRAY_PERIOD_REASON,'ip':_0x5bd381});});}function manageLicense(_0x55a32d,_0x28f846){var _0x4a111b=_0x28f846[_0xea3f('0x23')]({'plain':!![]});httpRequest(_0x55a32d)[_0xea3f('0x1a')](function(_0x1f66b3){if(oldToken){oldToken=undefined;}if(_0x1f66b3[_0xea3f('0x24')]){if(!_0x4a111b[_0xea3f('0x7')]&&_0x4a111b['license']!=_0x1f66b3[_0xea3f('0x7')]||_0x4a111b['license']&&_0x4a111b[_0xea3f('0x25')]){logger[_0xea3f('0x26')](_0xea3f('0x27'));}if(_0x4a111b['license']&&!_0x4a111b[_0xea3f('0x25')]&&_0x4a111b[_0xea3f('0x7')]!=_0x1f66b3['license']){logger[_0xea3f('0x26')](_0xea3f('0x28'));}if(_0x4a111b[_0xea3f('0x7')]&&!_0x4a111b[_0xea3f('0x25')]&&_0x4a111b[_0xea3f('0x7')]==_0x1f66b3[_0xea3f('0x7')]){return _0x28f846;}return _0x28f846[_0xea3f('0x13')]({'data1':_0x55a32d,'data2':null,'license':_0x1f66b3[_0xea3f('0x7')]});}else{if(_0x1f66b3[_0xea3f('0x7')]||_0x4a111b[_0xea3f('0x7')]){if(!_0x4a111b[_0xea3f('0x25')]){if(_0x4a111b[_0xea3f('0x29')]==_0x55a32d){GRAY_PERIOD_REASON=_0xea3f('0x2a');logger[_0xea3f('0x26')](_0xea3f('0x2b'));}else{GRAY_PERIOD_REASON=_0xea3f('0x2c');oldToken=_0x4a111b[_0xea3f('0x29')];logger[_0xea3f('0x26')](_0xea3f('0x2d'),_0x4a111b['data1'],_0x55a32d);}sendJiraAlert(_0x4a111b[_0xea3f('0x29')],_0x1f66b3[_0xea3f('0x2e')],GRAY_PERIOD_REASON);logger[_0xea3f('0x26')](_0xea3f('0x2f'),GRAY_PERIOD_REASON[_0xea3f('0x30')](),moment()[_0xea3f('0xa')](_0xea3f('0x31')));return _0x28f846[_0xea3f('0x13')]({'data2':encryptDate(moment()[_0xea3f('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xea3f('0x32')](decryptDate(_0x4a111b[_0xea3f('0x25')]),_0xea3f('0x33'))>DAYS){logger[_0xea3f('0x26')](_0xea3f('0x34'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x28f846[_0xea3f('0x13')]({'data1':_0x55a32d,'data2':null,'license':null});}}}else{if(_0x4a111b['data1']!=_0x55a32d){logger[_0xea3f('0x26')](_0xea3f('0x2d'),_0x4a111b[_0xea3f('0x29')],_0x55a32d);return _0x28f846[_0xea3f('0x13')]({'data1':_0x55a32d,'data2':null,'license':null});}}}return _0x28f846;})[_0xea3f('0x1a')](function(_0x443d4e){_0x28f846=_0x443d4e;})['catch'](function(_0x3d9260){logger['error'](_0x3d9260['message']);})[_0xea3f('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0xea3f('0x36')](),_0x28f846);},TIME);});}function defaultLicense(){var _0xd41581=hardware[_0xea3f('0x36')]();if(_0xd41581){return db[_0xea3f('0x37')][_0xea3f('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0xd41581}})[_0xea3f('0x39')](function(_0x2d07ef,_0x365033){logger[_0xea3f('0x26')](_0xea3f('0x3a'),_0xd41581);manageLicense(_0xd41581,_0x2d07ef);})[_0xea3f('0xc')](function(_0x2adbb0){logger['error'](_0x2adbb0[_0xea3f('0x3b')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c18b71d..e23579e 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 _0xf804=['format','%s:%s:%s','update','base64','final','uuid','machineUuid','aes-256-ctr','secrets','session','utf8','gray','deadline','add','days','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getUuid','License','find','defaults','then','checkLicense','crypto','util','lodash','../environment','../../mysqldb','license','isEmpty','data1','split','createDecipher'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf804,0x13a));var _0x4f80=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf804[_0x122ef9];return _0x42fba0;};'use strict';var crypto=require(_0x4f80('0x0'));var util=require(_0x4f80('0x1'));var _=require(_0x4f80('0x2'));var moment=require('moment');var hardware=require('./hardware');var config=require(_0x4f80('0x3'));var db=require(_0x4f80('0x4'))['db'];function checkLicense(_0x1aca12,_0x240684){if(_0x1aca12){try{var _0x19baed=_0x240684||_0x1aca12[_0x4f80('0x5')];if(_[_0x4f80('0x6')](_0x19baed)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1eeb1c=_0x1aca12[_0x4f80('0x7')];var _0xd34cbe=_0x1aca12['data2'];var _0x551a5c=_0x1eeb1c['split']('-')[0x4];var _0x1308ab=_0x1eeb1c[_0x4f80('0x8')]('-')[0x0];var _0x2559b8=crypto[_0x4f80('0x9')]('aes-256-ctr',util[_0x4f80('0xa')](_0x4f80('0xb'),_0x551a5c,_0x1eeb1c,_0x1308ab));var _0x55bc6a=_0x2559b8[_0x4f80('0xc')](_0x19baed,_0x4f80('0xd'),'utf8');_0x55bc6a+=_0x2559b8[_0x4f80('0xe')]('utf8');var _0x234911=JSON['parse'](_0x55bc6a);_0x234911['demo']=![];_0x234911[_0x4f80('0xf')]=_0x1eeb1c;_0x234911[_0x4f80('0x10')]=hardware['getUuid']();if(_0xd34cbe){var _0x2d1724=crypto[_0x4f80('0x9')](_0x4f80('0x11'),config[_0x4f80('0x12')][_0x4f80('0x13')]);var _0x3a8473=_0x2d1724[_0x4f80('0xc')](_0xd34cbe,_0x4f80('0xd'),'utf8');_0x3a8473+=_0x2d1724[_0x4f80('0xe')](_0x4f80('0x14'));_0x234911[_0x4f80('0x15')]=_0x3a8473;_0x234911[_0x4f80('0x16')]=moment(_0x3a8473)[_0x4f80('0x17')](0x7,_0x4f80('0x18'))[_0x4f80('0xa')]();_0x234911['grayReason']=_0x234911['uuid']!=_0x234911['machineUuid']?_0x4f80('0x19'):_0x4f80('0x1a');}return _0x234911;}catch(_0x1d0f7f){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4f80('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4f80('0x1c'),'uuid':_0x1aca12[_0x4f80('0x7')],'machineUuid':hardware['getUuid'](),'message':_0x1d0f7f[_0x4f80('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4f80('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x1aca12[_0x4f80('0x7')],'machineUuid':hardware[_0x4f80('0x1e')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x207921){return db[_0x4f80('0x1f')][_0x4f80('0x20')](_[_0x4f80('0x21')](_0x207921,{'raw':!![],'where':{'id':0x1}}))[_0x4f80('0x22')](function(_0x5dc3f6){return checkLicense(_0x5dc3f6,null);});};exports[_0x4f80('0x23')]=checkLicense; \ No newline at end of file +var _0xafa5=['gray','add','days','grayReason','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','License','find','then','checkLicense','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','data1','data2','split','format','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid','machineUuid','getUuid','aes-256-ctr','secrets','session'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xafa5,0x1af));var _0x5afa=function(_0x1a9ce7,_0x424689){_0x1a9ce7=_0x1a9ce7-0x0;var _0xd8f85e=_0xafa5[_0x1a9ce7];return _0xd8f85e;};'use strict';var crypto=require('crypto');var util=require(_0x5afa('0x0'));var _=require(_0x5afa('0x1'));var moment=require(_0x5afa('0x2'));var hardware=require(_0x5afa('0x3'));var config=require(_0x5afa('0x4'));var db=require(_0x5afa('0x5'))['db'];function checkLicense(_0x14535b,_0x21b649){if(_0x14535b){try{var _0xac7ca5=_0x21b649||_0x14535b[_0x5afa('0x6')];if(_[_0x5afa('0x7')](_0xac7ca5)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x166388=_0x14535b[_0x5afa('0x8')];var _0x129da7=_0x14535b[_0x5afa('0x9')];var _0xa85da8=_0x166388[_0x5afa('0xa')]('-')[0x4];var _0x4251b7=_0x166388[_0x5afa('0xa')]('-')[0x0];var _0x2bfaff=crypto['createDecipher']('aes-256-ctr',util[_0x5afa('0xb')](_0x5afa('0xc'),_0xa85da8,_0x166388,_0x4251b7));var _0x6d7ebf=_0x2bfaff[_0x5afa('0xd')](_0xac7ca5,_0x5afa('0xe'),_0x5afa('0xf'));_0x6d7ebf+=_0x2bfaff[_0x5afa('0x10')](_0x5afa('0xf'));var _0x57fd0f=JSON[_0x5afa('0x11')](_0x6d7ebf);_0x57fd0f[_0x5afa('0x12')]=![];_0x57fd0f[_0x5afa('0x13')]=_0x166388;_0x57fd0f[_0x5afa('0x14')]=hardware[_0x5afa('0x15')]();if(_0x129da7){var _0x31ab67=crypto['createDecipher'](_0x5afa('0x16'),config[_0x5afa('0x17')][_0x5afa('0x18')]);var _0x39bc19=_0x31ab67[_0x5afa('0xd')](_0x129da7,_0x5afa('0xe'),_0x5afa('0xf'));_0x39bc19+=_0x31ab67['final'](_0x5afa('0xf'));_0x57fd0f[_0x5afa('0x19')]=_0x39bc19;_0x57fd0f['deadline']=moment(_0x39bc19)[_0x5afa('0x1a')](0x7,_0x5afa('0x1b'))[_0x5afa('0xb')]();_0x57fd0f[_0x5afa('0x1c')]=_0x57fd0f[_0x5afa('0x13')]!=_0x57fd0f[_0x5afa('0x14')]?_0x5afa('0x1d'):'disabled';}return _0x57fd0f;}catch(_0x276787){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5afa('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5afa('0x1f'),'uuid':_0x14535b[_0x5afa('0x8')],'machineUuid':hardware[_0x5afa('0x15')](),'message':_0x276787[_0x5afa('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5afa('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5afa('0x21'),'uuid':_0x14535b[_0x5afa('0x8')],'machineUuid':hardware[_0x5afa('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x1510ef){return db[_0x5afa('0x22')][_0x5afa('0x23')](_['defaults'](_0x1510ef,{'raw':!![],'where':{'id':0x1}}))[_0x5afa('0x24')](function(_0x1aeb29){return checkLicense(_0x1aeb29,null);});};exports[_0x5afa('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 95f2caa..51daeb4 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 _0x05d0=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05d0,0x85));var _0x005d=function(_0x1a4578,_0x5f1447){_0x1a4578=_0x1a4578-0x0;var _0x4bb277=_0x05d0[_0x1a4578];return _0x4bb277;};'use strict';module[_0x005d('0x0')]={'DOMAIN':_0x005d('0x1'),'SESSION_SECRET':_0x005d('0x2'),'GOOGLE_ID':_0x005d('0x3'),'GOOGLE_SECRET':_0x005d('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x9c2c=['exports','http://localhost:9000'];(function(_0x3364dc,_0xcf9063){var _0x38713e=function(_0x41ba54){while(--_0x41ba54){_0x3364dc['push'](_0x3364dc['shift']());}};_0x38713e(++_0xcf9063);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xc9c2('0x0')]={'DOMAIN':_0xc9c2('0x1'),'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 39104e3..2ef8b2e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd800=['transports','File','%s-%s','error','info','Console','env','debugLevel','winston','util','path','join','/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','exports','Logger'];(function(_0x1abcb1,_0x19123d){var _0x301004=function(_0x1a2367){while(--_0x1a2367){_0x1abcb1['push'](_0x1abcb1['shift']());}};_0x301004(++_0x19123d);}(_0xd800,0xb8));var _0x0d80=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd800[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require('moment');var winston=require(_0x0d80('0x0'));var util=require(_0x0d80('0x1'));var path=require(_0x0d80('0x2'));var debugLevel='INFO';function filename(_0x4417c5,_0x34ae5a){return path[_0x0d80('0x3')](_0x0d80('0x4'),_0x0d80('0x5'),_0x0d80('0x6'),util[_0x0d80('0x7')]('%s-%s.log',_0x4417c5,_0x34ae5a));}function formatter(_0x205b03,_0x3e0f3b){return util[_0x0d80('0x7')](_0x0d80('0x8'),moment()[_0x0d80('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3e0f3b[_0x0d80('0x9')][_0x0d80('0xa')](),_0x205b03,_0x3e0f3b[_0x0d80('0xb')]);}module[_0x0d80('0xc')]=function(_0x564d0f){return new winston[(_0x0d80('0xd'))]({'transports':[new winston[(_0x0d80('0xe'))][(_0x0d80('0xf'))]({'name':util[_0x0d80('0x7')](_0x0d80('0x10'),_0x564d0f,_0x0d80('0x11')),'filename':filename(_0x564d0f,_0x0d80('0x11')),'level':_0x0d80('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28a5c0){return formatter(_0x564d0f,_0x28a5c0);}}),new winston[(_0x0d80('0xe'))][(_0x0d80('0xf'))]({'name':util['format'](_0x0d80('0x10'),_0x564d0f,_0x0d80('0x12')),'filename':filename(_0x564d0f,_0x0d80('0x12')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4519fd){return formatter(_0x564d0f,_0x4519fd);}}),new winston[(_0x0d80('0xe'))][(_0x0d80('0x13'))]({'level':process[_0x0d80('0x14')][_0x0d80('0x15')]||debugLevel,'json':![],'formatter':function(_0x349f96){return formatter(_0x564d0f,_0x349f96);}})]});}; \ No newline at end of file +var _0x18a7=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','File','%s-%s','error','transports','info','Console','debugLevel','moment','util','path','join','log','xcally','format','%s-%s.log'];(function(_0x371e8c,_0x2e9047){var _0x39ab4b=function(_0xe2100b){while(--_0xe2100b){_0x371e8c['push'](_0x371e8c['shift']());}};_0x39ab4b(++_0x2e9047);}(_0x18a7,0x12c));var _0x718a=function(_0x1a6281,_0x262b9d){_0x1a6281=_0x1a6281-0x0;var _0x20ef6e=_0x18a7[_0x1a6281];return _0x20ef6e;};'use strict';var moment=require(_0x718a('0x0'));var winston=require('winston');var util=require(_0x718a('0x1'));var path=require(_0x718a('0x2'));var debugLevel='INFO';function filename(_0x59270a,_0x3f2860){return path[_0x718a('0x3')]('/var',_0x718a('0x4'),_0x718a('0x5'),util[_0x718a('0x6')](_0x718a('0x7'),_0x59270a,_0x3f2860));}function formatter(_0x4e2b62,_0x19e3eb){return util[_0x718a('0x6')](_0x718a('0x8'),moment()[_0x718a('0x6')](_0x718a('0x9')),_0x19e3eb[_0x718a('0xa')][_0x718a('0xb')](),_0x4e2b62,_0x19e3eb[_0x718a('0xc')]);}module[_0x718a('0xd')]=function(_0x19f82d){return new winston[(_0x718a('0xe'))]({'transports':[new winston['transports'][(_0x718a('0xf'))]({'name':util[_0x718a('0x6')](_0x718a('0x10'),_0x19f82d,_0x718a('0x11')),'filename':filename(_0x19f82d,_0x718a('0x11')),'level':_0x718a('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x57e029){return formatter(_0x19f82d,_0x57e029);}}),new winston[(_0x718a('0x12'))]['File']({'name':util[_0x718a('0x6')](_0x718a('0x10'),_0x19f82d,'info'),'filename':filename(_0x19f82d,_0x718a('0x13')),'level':_0x718a('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x15db24){return formatter(_0x19f82d,_0x15db24);}}),new winston[(_0x718a('0x12'))][(_0x718a('0x14'))]({'level':process['env'][_0x718a('0x15')]||debugLevel,'json':![],'formatter':function(_0x1e5060){return formatter(_0x19f82d,_0x1e5060);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 1155760..5f9c9f0 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 _0x3dcd=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x1b132d,_0x3372e3){var _0x59139e=function(_0x55b624){while(--_0x55b624){_0x1b132d['push'](_0x1b132d['shift']());}};_0x59139e(++_0x3372e3);}(_0x3dcd,0xc5));var _0xd3dc=function(_0x138208,_0x140722){_0x138208=_0x138208-0x0;var _0x4f93b5=_0x3dcd[_0x138208];return _0x4f93b5;};'use strict';var path=require(_0xd3dc('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x2'))},{'name':_0xd3dc('0x3'),'script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x4'))},{'name':_0xd3dc('0x5'),'script':path['join'](__dirname,_0xd3dc('0x6'))},{'name':'email','script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x7'))},{'name':_0xd3dc('0x8'),'script':path[_0xd3dc('0x1')](__dirname,_0xd3dc('0x9'))},{'name':_0xd3dc('0xa'),'script':path[_0xd3dc('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xd3dc('0xb')]=config; \ No newline at end of file +var _0x96f3=['email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/agi/index.js'];(function(_0x421d02,_0x202799){var _0x168921=function(_0x40ce6d){while(--_0x40ce6d){_0x421d02['push'](_0x421d02['shift']());}};_0x168921(++_0x202799);}(_0x96f3,0xf7));var _0x396f=function(_0x4f31d1,_0x3fc999){_0x4f31d1=_0x4f31d1-0x0;var _0x3ff9fb=_0x96f3[_0x4f31d1];return _0x3ff9fb;};'use strict';var path=require(_0x396f('0x0'));var os=require('os');var config={'apps':[{'name':_0x396f('0x1'),'script':path[_0x396f('0x2')](__dirname,_0x396f('0x3'))},{'name':_0x396f('0x4'),'script':path[_0x396f('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x396f('0x2')](__dirname,_0x396f('0x5'))},{'name':_0x396f('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x396f('0x7'),'script':path[_0x396f('0x2')](__dirname,_0x396f('0x8'))},{'name':_0x396f('0x9'),'script':path[_0x396f('0x2')](__dirname,_0x396f('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 62e4379..25aa3c1 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 _0xb5bb=['pm2','bluebird','./config','connect','start','disconnect','stop','then','restart','list','describe','delete','dump'];(function(_0x1b2255,_0x34c3c9){var _0x4cccf0=function(_0x459a31){while(--_0x459a31){_0x1b2255['push'](_0x1b2255['shift']());}};_0x4cccf0(++_0x34c3c9);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x353488,_0x1a9447){_0x353488=_0x353488-0x0;var _0x581e76=_0xb5bb[_0x353488];return _0x581e76;};'use strict';var pm2=require(_0xbb5b('0x0'));var BPromise=require(_0xbb5b('0x1'));var config=require(_0xbb5b('0x2'));function connect(){return new BPromise(function(_0x53d43f,_0x32e297){return pm2[_0xbb5b('0x3')](function(_0x5cc451){if(_0x5cc451){return _0x32e297(_0x5cc451);}return _0x53d43f('connected');});});};exports['start']=function(_0x5dfa85){return connect()['then'](function(){return new BPromise(function(_0x4bf6e7,_0x1c9622){return pm2[_0xbb5b('0x4')](_0x5dfa85,function(_0x5b03cd,_0x1d8453){if(_0x5b03cd){return _0x1c9622(_0x5b03cd);}pm2[_0xbb5b('0x5')]();return _0x4bf6e7(_0x1d8453);});});});};exports[_0xbb5b('0x6')]=function(_0x11cc7e){return connect()[_0xbb5b('0x7')](function(){return new BPromise(function(_0x1783b2,_0x1b90ec){return pm2[_0xbb5b('0x6')](_0x11cc7e,function(_0x3e497a,_0x218eca){if(_0x3e497a){return _0x1b90ec(_0x3e497a);}pm2[_0xbb5b('0x5')]();return _0x1783b2(_0x218eca);});});});};exports[_0xbb5b('0x8')]=function(_0x6d71ad){return connect()[_0xbb5b('0x7')](function(){return new BPromise(function(_0x10411c,_0x15e47d){return pm2[_0xbb5b('0x8')](_0x6d71ad,function(_0xbd6621,_0x143cca){if(_0xbd6621){return _0x15e47d(_0xbd6621);}pm2[_0xbb5b('0x5')]();return _0x10411c(_0x143cca);});});});};exports['list']=function(){return connect()[_0xbb5b('0x7')](function(){return new BPromise(function(_0x5f5aa5,_0xe964d4){return pm2[_0xbb5b('0x9')](function(_0x8f9833,_0x85ef08){if(_0x8f9833){return _0xe964d4(_0x8f9833);}pm2['disconnect']();return _0x5f5aa5(_0x85ef08);});});});};exports[_0xbb5b('0xa')]=function(_0x117f6d){return connect()[_0xbb5b('0x7')](function(){return new BPromise(function(_0x60f86d,_0x3b2edb){return pm2['describe'](_0x117f6d,function(_0x43f396,_0x380044){if(_0x43f396){return _0x3b2edb(_0x43f396);}pm2[_0xbb5b('0x5')]();return _0x60f86d(_0x380044);});});});};exports['delete']=function(_0x3db4ae){return connect()[_0xbb5b('0x7')](function(){return new BPromise(function(_0x1addec,_0x1e84fc){return pm2[_0xbb5b('0xb')](_0x3db4ae,function(_0x31bb85,_0x575447){if(_0x31bb85){return _0x1e84fc(_0x31bb85);}pm2[_0xbb5b('0x5')]();return _0x1addec(_0x575447);});});});};exports[_0xbb5b('0xc')]=function(){return connect()[_0xbb5b('0x7')](function(){return new BPromise(function(_0x4be277,_0x5920d8){return pm2[_0xbb5b('0xc')](function(_0x388fba){if(_0x388fba){return _0x5920d8(_0x388fba);}return _0x4be277('saved');});});});}; \ No newline at end of file +var _0x5fc3=['bluebird','connect','connected','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x3e07e0,_0x345e47){var _0x14a1d3=function(_0x2cb0ee){while(--_0x2cb0ee){_0x3e07e0['push'](_0x3e07e0['shift']());}};_0x14a1d3(++_0x345e47);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x5fc3[_0x1d3577];return _0x277d9a;};'use strict';var pm2=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x253d6e,_0x2ac6da){return pm2[_0x35fc('0x2')](function(_0x91d024){if(_0x91d024){return _0x2ac6da(_0x91d024);}return _0x253d6e(_0x35fc('0x3'));});});};exports['start']=function(_0x2d1404){return connect()[_0x35fc('0x4')](function(){return new BPromise(function(_0x186a06,_0x5b85ad){return pm2['start'](_0x2d1404,function(_0x19a0d1,_0x508b32){if(_0x19a0d1){return _0x5b85ad(_0x19a0d1);}pm2[_0x35fc('0x5')]();return _0x186a06(_0x508b32);});});});};exports[_0x35fc('0x6')]=function(_0xc72d93){return connect()[_0x35fc('0x4')](function(){return new BPromise(function(_0x34ff19,_0xf9d3a6){return pm2[_0x35fc('0x6')](_0xc72d93,function(_0x565f95,_0x1083a9){if(_0x565f95){return _0xf9d3a6(_0x565f95);}pm2[_0x35fc('0x5')]();return _0x34ff19(_0x1083a9);});});});};exports['restart']=function(_0x471549){return connect()[_0x35fc('0x4')](function(){return new BPromise(function(_0x5021d4,_0xda83fb){return pm2[_0x35fc('0x7')](_0x471549,function(_0x5469f5,_0x4cbe74){if(_0x5469f5){return _0xda83fb(_0x5469f5);}pm2[_0x35fc('0x5')]();return _0x5021d4(_0x4cbe74);});});});};exports['list']=function(){return connect()[_0x35fc('0x4')](function(){return new BPromise(function(_0x22055e,_0x2a6ad2){return pm2[_0x35fc('0x8')](function(_0x38d9f2,_0x5cfe94){if(_0x38d9f2){return _0x2a6ad2(_0x38d9f2);}pm2['disconnect']();return _0x22055e(_0x5cfe94);});});});};exports['describe']=function(_0x558364){return connect()[_0x35fc('0x4')](function(){return new BPromise(function(_0x229d56,_0x53b898){return pm2[_0x35fc('0x9')](_0x558364,function(_0x227a49,_0x1121fa){if(_0x227a49){return _0x53b898(_0x227a49);}pm2['disconnect']();return _0x229d56(_0x1121fa);});});});};exports[_0x35fc('0xa')]=function(_0x45c8b7){return connect()['then'](function(){return new BPromise(function(_0x41e165,_0x363e47){return pm2[_0x35fc('0xa')](_0x45c8b7,function(_0x5f56c6,_0x1a86e9){if(_0x5f56c6){return _0x363e47(_0x5f56c6);}pm2[_0x35fc('0x5')]();return _0x41e165(_0x1a86e9);});});});};exports[_0x35fc('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x402cff,_0x350a27){return pm2[_0x35fc('0xb')](function(_0x251a1f){if(_0x251a1f){return _0x350a27(_0x251a1f);}return _0x402cff(_0x35fc('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5aab247..d7ab588 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 _0x43a1=['ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','error','start','lodash','moment'];(function(_0x1648d7,_0x3a1b81){var _0xa17ecb=function(_0x2efac0){while(--_0x2efac0){_0x1648d7['push'](_0x1648d7['shift']());}};_0xa17ecb(++_0x3a1b81);}(_0x43a1,0x1b8));var _0x143a=function(_0x6b6893,_0x5b502d){_0x6b6893=_0x6b6893-0x0;var _0x1e45c9=_0x43a1[_0x6b6893];return _0x1e45c9;};'use strict';var _=require(_0x143a('0x0'));var moment=require(_0x143a('0x1'));var Redis=require(_0x143a('0x2'));var db=require(_0x143a('0x3'))['db'];var config=require(_0x143a('0x4'));config['redis']=_[_0x143a('0x5')](config[_0x143a('0x6')],{'host':_0x143a('0x7'),'port':0x18eb});var io=require(_0x143a('0x8'))(new Redis(config[_0x143a('0x6')]));function closeInteractions(){var _0x488847=0x0;var _0x351fd0=[];return db['Setting'][_0x143a('0x9')]({'raw':!![],'attributes':['id',_0x143a('0xa')],'where':{'id':0x1}})['then'](function(_0x281e74){_0x488847=_0x281e74[_0x143a('0xa')];if(_0x488847){return db[_0x143a('0xb')][_0x143a('0xc')]({'raw':!![],'attributes':['id',_0x143a('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x143a('0xe')](_0x281e74[_0x143a('0xa')],_0x143a('0xf'))}}});}else{return[];}})[_0x143a('0x10')](function(_0x275ebe){_0x351fd0=_0x275ebe;if(_0x488847){return db[_0x143a('0xb')]['update']({'closeReason':_0x143a('0x11'),'disposition':_0x143a('0x12'),'closed':!![],'closedAt':moment()[_0x143a('0x13')](_0x143a('0x14'))},{'where':{'id':_['map'](_0x351fd0||[],'id')}});}})[_0x143a('0x10')](function(_0x1dc163){for(var _0x38295d=0x0;_0x38295d<_0x351fd0[_0x143a('0x15')];_0x38295d++){io[_0x143a('0x16')](_0x143a('0x17'),{'id':_0x351fd0[_0x38295d]['id'],'closed':!![]});}})['catch'](function(_0x57b18d){console[_0x143a('0x18')](_0x57b18d);});}exports[_0x143a('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1dc0=['lodash','moment','ioredis','../../mysqldb','../../config/environment','defaults','localhost','redis','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','error','start'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x1dc0,0x90));var _0x01dc=function(_0x453042,_0xad587c){_0x453042=_0x453042-0x0;var _0x1568bb=_0x1dc0[_0x453042];return _0x1568bb;};'use strict';var _=require(_0x01dc('0x0'));var moment=require(_0x01dc('0x1'));var Redis=require(_0x01dc('0x2'));var db=require(_0x01dc('0x3'))['db'];var config=require(_0x01dc('0x4'));config['redis']=_[_0x01dc('0x5')](config['redis'],{'host':_0x01dc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x01dc('0x7')]));function closeInteractions(){var _0x578f06=0x0;var _0x45afcb=[];return db[_0x01dc('0x8')][_0x01dc('0x9')]({'raw':!![],'attributes':['id',_0x01dc('0xa')],'where':{'id':0x1}})[_0x01dc('0xb')](function(_0x150fa5){_0x578f06=_0x150fa5[_0x01dc('0xa')];if(_0x578f06){return db[_0x01dc('0xc')][_0x01dc('0xd')]({'raw':!![],'attributes':['id',_0x01dc('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x01dc('0xf')](_0x150fa5[_0x01dc('0xa')],_0x01dc('0x10'))}}});}else{return[];}})[_0x01dc('0xb')](function(_0x35f3f6){_0x45afcb=_0x35f3f6;if(_0x578f06){return db[_0x01dc('0xc')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x01dc('0x11')](_0x01dc('0x12'))},{'where':{'id':_[_0x01dc('0x13')](_0x45afcb||[],'id')}});}})[_0x01dc('0xb')](function(_0x4e7113){for(var _0x3e7dfc=0x0;_0x3e7dfc<_0x45afcb[_0x01dc('0x14')];_0x3e7dfc++){io[_0x01dc('0x15')]('chatInteraction:update',{'id':_0x45afcb[_0x3e7dfc]['id'],'closed':!![]});}})['catch'](function(_0x416de6){console[_0x01dc('0x16')](_0x416de6);});}exports[_0x01dc('0x17')]=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 25fe6b0..37761a1 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 _0xbb97=['error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','start','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','format','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','existsSync','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error'];(function(_0x3c7751,_0x58a201){var _0x46e2b0=function(_0xa682e1){while(--_0xa682e1){_0x3c7751['push'](_0x3c7751['shift']());}};_0x46e2b0(++_0x58a201);}(_0xbb97,0x199));var _0x7bb9=function(_0x491e27,_0x264f24){_0x491e27=_0x491e27-0x0;var _0x282c21=_0xbb97[_0x491e27];return _0x282c21;};'use strict';var fs=require('fs');var util=require(_0x7bb9('0x0'));var path=require(_0x7bb9('0x1'));var _=require(_0x7bb9('0x2'));var moment=require('moment');var CronJobManager=require(_0x7bb9('0x3'));var jayson=require(_0x7bb9('0x4'));var BPromise=require(_0x7bb9('0x5'));var logger=require(_0x7bb9('0x6'))('schedule');var db=require(_0x7bb9('0x7'))['db'];var analyticCustomReportController=require(_0x7bb9('0x8'));var analyticDefaultReportController=require(_0x7bb9('0x9'));var client=jayson[_0x7bb9('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x586cfd,_0x490784){return function(){logger[_0x7bb9('0xb')](_0x7bb9('0xc'),_0x586cfd[_0x7bb9('0xd')]);var _0x4afb4c=!![];var _0x40c091={'tls':{'rejectUnauthorized':![]}};if(_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0xf')][_0x7bb9('0x10')]){_0x40c091['service']=_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0xf')][_0x7bb9('0x10')];}else{_0x40c091['host']=_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0xf')][_0x7bb9('0x11')];_0x40c091[_0x7bb9('0x12')]=_0x586cfd['MailAccount'][_0x7bb9('0xf')][_0x7bb9('0x12')];_0x40c091[_0x7bb9('0x13')]=_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0xf')][_0x7bb9('0x13')];}if(_0x586cfd[_0x7bb9('0xe')]['Smtp'][_0x7bb9('0x14')]){_0x40c091[_0x7bb9('0x15')]={'user':_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0xf')][_0x7bb9('0x16')],'pass':_0x586cfd['MailAccount'][_0x7bb9('0xf')][_0x7bb9('0x17')]};}var _0x55c424={'account':_0x40c091,'message':{'from':util['format'](_0x7bb9('0x18'),_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0x19')],_0x586cfd['MailAccount']['email']||_0x586cfd[_0x7bb9('0xe')][_0x7bb9('0xf')][_0x7bb9('0x16')]),'to':_0x586cfd[_0x7bb9('0xd')],'cc':_0x586cfd['cc'],'bcc':_0x586cfd['bcc'],'subject':util[_0x7bb9('0x1a')]('Report\x20%s\x20last\x20%s\x20%s',_0x490784[_0x7bb9('0x19')],_0x586cfd[_0x7bb9('0x1b')],_0x586cfd[_0x7bb9('0x1c')])}};var _0x41af13=path['join'](__dirname,'../../files/reports');var _0x1b5d8c=_0x490784['savename'];var _0x42543d=util[_0x7bb9('0x1a')](_0x7bb9('0x1d'),path[_0x7bb9('0x1e')](_0x490784[_0x7bb9('0x1f')],path[_0x7bb9('0x20')](_0x490784[_0x7bb9('0x1f')])),_0x7bb9('0x21'));var _0x171a64=path['join'](_0x41af13,_0x1b5d8c);var _0x40b4ef=path['join'](_0x41af13,_0x42543d);if(fs['existsSync'](_0x171a64)){_0x490784[_0x7bb9('0x22')]='Sent';_0x55c424[_0x7bb9('0x23')][_0x7bb9('0x24')]=[{'filename':_0x1b5d8c,'path':_0x171a64}];_0x55c424[_0x7bb9('0x23')]['text']=util['format'](_0x7bb9('0x25'),JSON['stringify'](_0x490784,null,0x2));}else if(fs[_0x7bb9('0x26')](_0x40b4ef)){_0x490784['status']='Sent';_0x55c424[_0x7bb9('0x23')][_0x7bb9('0x24')]=[{'filename':_0x42543d,'path':_0x40b4ef}];}else{_0x55c424['message'][_0x7bb9('0x27')]=_0x7bb9('0x28');if(!_0x586cfd[_0x7bb9('0x29')]){_0x4afb4c=![];logger[_0x7bb9('0xb')](_0x7bb9('0x2a'));}}if(_0x4afb4c){return client[_0x7bb9('0x2b')](_0x7bb9('0x2c'),_0x55c424)['then'](function(_0x2e2804){if(_0x2e2804[_0x7bb9('0x2d')]){return logger[_0x7bb9('0x2d')](_0x7bb9('0x2e'),JSON[_0x7bb9('0x2f')](_0x2e2804));}return logger[_0x7bb9('0xb')](_0x7bb9('0x30'));})[_0x7bb9('0x31')](function(_0x13d643){return logger[_0x7bb9('0x2d')]('error\x20mail',JSON['stringify'](_0x13d643));});}};}function handleError(){return function(_0x3716f8){return logger[_0x7bb9('0x2d')](JSON[_0x7bb9('0x2f')](_0x3716f8));};}function handleResult(_0x1e9edd){return function(_0x2d17e0){logger[_0x7bb9('0xb')](_0x7bb9('0x32'),JSON[_0x7bb9('0x2f')](_0x2d17e0));if(_0x1e9edd[_0x7bb9('0xe')]&&_0x1e9edd[_0x7bb9('0xe')][_0x7bb9('0xf')]&&!_[_0x7bb9('0x33')](_0x1e9edd['email'])){setTimeout(handleSendEmail(_0x1e9edd,_0x2d17e0),0x3c*0x3e8);}};}function handleJob(_0x2f8d14){return function(){try{if(_['isNil'](_0x2f8d14['subtractNumber'])){return logger['info'](_0x7bb9('0x34'));}if(_[_0x7bb9('0x33')](_0x2f8d14[_0x7bb9('0x1c')])){return logger['info'](_0x7bb9('0x35'));}var _0x286354={'startDate':moment()[_0x7bb9('0x36')](_0x2f8d14[_0x7bb9('0x1b')],_0x2f8d14['subtractUnit'])[_0x7bb9('0x1a')](_0x7bb9('0x37')),'endDate':moment()[_0x7bb9('0x1a')](_0x7bb9('0x37')),'type':_0x7bb9('0x38'),'output':_0x2f8d14[_0x7bb9('0x39')],'name':_0x2f8d14[_0x7bb9('0x19')]};if(!_['isNil'](_0x2f8d14[_0x7bb9('0x3a')])){logger[_0x7bb9('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x2f8d14['DefaultReportId']);return analyticDefaultReportController[_0x7bb9('0x3b')]({'id':_0x2f8d14['DefaultReportId']},_0x286354)[_0x7bb9('0x3c')](handleResult(_0x2f8d14))[_0x7bb9('0x31')](handleError());}if(!_['isNil'](_0x2f8d14[_0x7bb9('0x3d')])){logger[_0x7bb9('0xb')](_0x7bb9('0x3e'),_0x2f8d14[_0x7bb9('0x3d')]);return analyticCustomReportController['runReport']({'id':_0x2f8d14['CustomReportId']},_0x286354)[_0x7bb9('0x3c')](handleResult(_0x2f8d14))[_0x7bb9('0x31')](handleError());}}catch(_0x427828){logger[_0x7bb9('0x2d')](JSON[_0x7bb9('0x2f')](_0x427828));}return logger[_0x7bb9('0xb')](_0x7bb9('0x3f'));};}function getJobs(_0x1573fe){var _0x37113f={};if(_0x1573fe){_0x37113f['id']=_0x1573fe;}return db[_0x7bb9('0x40')][_0x7bb9('0x41')]({'where':_0x37113f,'include':[{'model':db[_0x7bb9('0xe')],'attributes':['id',_0x7bb9('0x19'),_0x7bb9('0xd')],'include':[{'model':db[_0x7bb9('0x42')],'as':_0x7bb9('0xf')}]}]})['then'](function(_0x563f1a){var _0x53d6a8=_[_0x7bb9('0x43')](manager['jobs']);var _0x53dd00=_[_0x7bb9('0x44')](_0x563f1a,function(_0x500dc6){return _0x500dc6['id'][_0x7bb9('0x45')]();});var _0x352359=_[_0x7bb9('0x46')](_0x563f1a,function(_0x44c17b){return _0x44c17b['id'][_0x7bb9('0x45')]();});var _0x450a00=_0x1573fe?_0x53dd00:_['difference'](_0x53dd00,_0x53d6a8);var _0x1b6a01=_['intersection'](_0x53dd00,_0x53d6a8);var _0x33bcdc=_['difference'](_0x53d6a8,_0x53dd00);var _0x38aaca;var _0x2bc5de;for(_0x38aaca=0x0;_0x38aaca<_0x33bcdc[_0x7bb9('0x47')]&&!_0x1573fe;_0x38aaca+=0x1){_0x2bc5de=_0x33bcdc[_0x38aaca]['toString']();if(manager[_0x7bb9('0x48')](_0x2bc5de)){manager[_0x7bb9('0x49')](_0x2bc5de);manager[_0x7bb9('0x4a')](_0x2bc5de);logger[_0x7bb9('0xb')](_0x7bb9('0x4b'),_0x2bc5de);}}logger['info']('toRun',JSON['stringify'](_0x450a00));for(_0x38aaca=0x0;_0x38aaca<_0x450a00[_0x7bb9('0x47')];_0x38aaca+=0x1){_0x2bc5de=_0x450a00[_0x38aaca][_0x7bb9('0x45')]();logger[_0x7bb9('0xb')](_0x7bb9('0x4c'),_0x2bc5de);if(_0x1573fe){logger[_0x7bb9('0xb')](_0x7bb9('0x4d'),_0x1573fe);logger[_0x7bb9('0xb')](JSON['stringify'](_0x352359[_0x2bc5de]));BPromise[_0x7bb9('0x4e')]()['then'](handleJob(_0x352359[_0x2bc5de]));logger['info'](_0x7bb9('0x4f'),_0x352359[_0x2bc5de][_0x7bb9('0x19')],_0x352359[_0x2bc5de][_0x7bb9('0x50')]);}else if(_0x352359[_0x2bc5de][_0x7bb9('0x50')]&&_0x352359[_0x2bc5de][_0x7bb9('0x51')]&&moment()[_0x7bb9('0x52')](_0x352359[_0x2bc5de][_0x7bb9('0x53')],_0x352359[_0x2bc5de][_0x7bb9('0x54')])){manager[_0x7bb9('0x55')](_0x2bc5de,_0x352359[_0x2bc5de][_0x7bb9('0x50')],handleJob(_0x352359[_0x2bc5de]));manager['start'](_0x2bc5de);logger['info'](_0x7bb9('0x56'),_0x352359[_0x2bc5de][_0x7bb9('0x19')],_0x352359[_0x2bc5de]['cron']);}else if(manager['exists'](_0x2bc5de)){manager[_0x7bb9('0x49')](_0x2bc5de);manager['deleteJob'](_0x2bc5de);logger[_0x7bb9('0xb')](_0x7bb9('0x57'),_0x352359[_0x2bc5de]['name'],_0x352359[_0x2bc5de][_0x7bb9('0x50')]);}}for(_0x38aaca=0x0,_0x2bc5de;_0x38aaca<_0x1b6a01['length']&&!_0x1573fe;_0x38aaca+=0x1){_0x2bc5de=_0x1b6a01[_0x38aaca][_0x7bb9('0x45')]();if(manager[_0x7bb9('0x48')](_0x2bc5de)){if(_0x352359[_0x2bc5de][_0x7bb9('0x50')]&&_0x352359[_0x2bc5de][_0x7bb9('0x51')]&&moment()[_0x7bb9('0x52')](_0x352359[_0x2bc5de][_0x7bb9('0x53')],_0x352359[_0x2bc5de][_0x7bb9('0x54')])){manager[_0x7bb9('0x58')](_0x2bc5de,_0x352359[_0x2bc5de][_0x7bb9('0x50')],handleJob(_0x352359[_0x2bc5de]));logger['info'](_0x7bb9('0x59'),_0x352359[_0x2bc5de][_0x7bb9('0x19')],_0x352359[_0x2bc5de][_0x7bb9('0x50')]);}else{manager[_0x7bb9('0x49')](_0x2bc5de);manager[_0x7bb9('0x4a')](_0x2bc5de);logger[_0x7bb9('0xb')]('stop\x20cron',_0x352359[_0x2bc5de][_0x7bb9('0x19')],_0x352359[_0x2bc5de][_0x7bb9('0x50')]);}}}})['catch'](function(_0x1378b9){logger[_0x7bb9('0x2d')](JSON[_0x7bb9('0x2f')](_0x1378b9));});}exports['run']=function(_0x360f7f){return getJobs(_0x360f7f);};exports[_0x7bb9('0x5a')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa775=['info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','MailServerOut','keys','jobs','map','toString','keyBy','difference','exists','deleteJob','delete\x20cron','length','index','my\x20id','resolve','run\x20job','active','isBetween','endAt','cron','start','stop\x20cron','update','update\x20cron','stop','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x211ca7,_0x1f6529){var _0x499b83=function(_0x2a96cb){while(--_0x2a96cb){_0x211ca7['push'](_0x211ca7['shift']());}};_0x499b83(++_0x1f6529);}(_0xa775,0x108));var _0x5a77=function(_0x170970,_0x3626b8){_0x170970=_0x170970-0x0;var _0x95ba56=_0xa775[_0x170970];return _0x95ba56;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x5a77('0x0'));var _=require(_0x5a77('0x1'));var moment=require(_0x5a77('0x2'));var CronJobManager=require(_0x5a77('0x3'));var jayson=require(_0x5a77('0x4'));var BPromise=require(_0x5a77('0x5'));var logger=require(_0x5a77('0x6'))(_0x5a77('0x7'));var db=require(_0x5a77('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x5a77('0x9'));var client=jayson[_0x5a77('0xa')][_0x5a77('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x6f9bb1,_0xfd0156){return function(){logger[_0x5a77('0xc')](_0x5a77('0xd'),_0x6f9bb1[_0x5a77('0xe')]);var _0x1376c1=!![];var _0x46382c={'tls':{'rejectUnauthorized':![]}};if(_0x6f9bb1[_0x5a77('0xf')][_0x5a77('0x10')][_0x5a77('0x11')]){_0x46382c['service']=_0x6f9bb1[_0x5a77('0xf')]['Smtp'][_0x5a77('0x11')];}else{_0x46382c[_0x5a77('0x12')]=_0x6f9bb1[_0x5a77('0xf')][_0x5a77('0x10')][_0x5a77('0x12')];_0x46382c[_0x5a77('0x13')]=_0x6f9bb1[_0x5a77('0xf')][_0x5a77('0x10')][_0x5a77('0x13')];_0x46382c[_0x5a77('0x14')]=_0x6f9bb1[_0x5a77('0xf')]['Smtp'][_0x5a77('0x14')];}if(_0x6f9bb1['MailAccount']['Smtp'][_0x5a77('0x15')]){_0x46382c['auth']={'user':_0x6f9bb1[_0x5a77('0xf')]['Smtp'][_0x5a77('0x16')],'pass':_0x6f9bb1[_0x5a77('0xf')][_0x5a77('0x10')][_0x5a77('0x17')]};}var _0x426a73={'account':_0x46382c,'message':{'from':util[_0x5a77('0x18')](_0x5a77('0x19'),_0x6f9bb1[_0x5a77('0xf')]['name'],_0x6f9bb1[_0x5a77('0xf')][_0x5a77('0xe')]||_0x6f9bb1[_0x5a77('0xf')][_0x5a77('0x10')]['user']),'to':_0x6f9bb1[_0x5a77('0xe')],'cc':_0x6f9bb1['cc'],'bcc':_0x6f9bb1[_0x5a77('0x1a')],'subject':util[_0x5a77('0x18')](_0x5a77('0x1b'),_0xfd0156[_0x5a77('0x1c')],_0x6f9bb1[_0x5a77('0x1d')],_0x6f9bb1['subtractUnit'])}};var _0x53d073=path[_0x5a77('0x1e')](__dirname,_0x5a77('0x1f'));var _0x530684=_0xfd0156[_0x5a77('0x20')];var _0x19421d=util[_0x5a77('0x18')](_0x5a77('0x21'),path['basename'](_0xfd0156[_0x5a77('0x20')],path[_0x5a77('0x22')](_0xfd0156[_0x5a77('0x20')])),_0x5a77('0x23'));var _0x1c7734=path[_0x5a77('0x1e')](_0x53d073,_0x530684);var _0x14f427=path['join'](_0x53d073,_0x19421d);if(fs['existsSync'](_0x1c7734)){_0xfd0156[_0x5a77('0x24')]=_0x5a77('0x25');_0x426a73[_0x5a77('0x26')][_0x5a77('0x27')]=[{'filename':_0x530684,'path':_0x1c7734}];_0x426a73[_0x5a77('0x26')][_0x5a77('0x28')]=util[_0x5a77('0x18')](_0x5a77('0x29'),JSON[_0x5a77('0x2a')](_0xfd0156,null,0x2));}else if(fs[_0x5a77('0x2b')](_0x14f427)){_0xfd0156[_0x5a77('0x24')]='Sent';_0x426a73['message'][_0x5a77('0x27')]=[{'filename':_0x19421d,'path':_0x14f427}];}else{_0x426a73['message'][_0x5a77('0x28')]=_0x5a77('0x2c');if(!_0x6f9bb1[_0x5a77('0x2d')]){_0x1376c1=![];logger[_0x5a77('0xc')](_0x5a77('0x2e'));}}if(_0x1376c1){return client[_0x5a77('0x2f')](_0x5a77('0x30'),_0x426a73)['then'](function(_0x670b6c){if(_0x670b6c[_0x5a77('0x31')]){return logger[_0x5a77('0x31')](_0x5a77('0x32'),JSON[_0x5a77('0x2a')](_0x670b6c));}return logger['info'](_0x5a77('0x33'));})[_0x5a77('0x34')](function(_0x2528f8){return logger['error']('error\x20mail',JSON[_0x5a77('0x2a')](_0x2528f8));});}};}function handleError(){return function(_0x5b5cf9){return logger['error'](JSON['stringify'](_0x5b5cf9));};}function handleResult(_0x409181){return function(_0x59e4b4){logger[_0x5a77('0xc')](_0x5a77('0x35'),JSON[_0x5a77('0x2a')](_0x59e4b4));if(_0x409181[_0x5a77('0xf')]&&_0x409181[_0x5a77('0xf')][_0x5a77('0x10')]&&!_['isNil'](_0x409181[_0x5a77('0xe')])){setTimeout(handleSendEmail(_0x409181,_0x59e4b4),0x3c*0x3e8);}};}function handleJob(_0x24aca4){return function(){try{if(_[_0x5a77('0x36')](_0x24aca4[_0x5a77('0x1d')])){return logger['info'](_0x5a77('0x37'));}if(_[_0x5a77('0x36')](_0x24aca4[_0x5a77('0x38')])){return logger[_0x5a77('0xc')](_0x5a77('0x39'));}var _0x532c31={'startDate':moment()['subtract'](_0x24aca4[_0x5a77('0x1d')],_0x24aca4[_0x5a77('0x38')])[_0x5a77('0x18')](_0x5a77('0x3a')),'endDate':moment()[_0x5a77('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x5a77('0x3b'),'output':_0x24aca4['output'],'name':_0x24aca4[_0x5a77('0x1c')]};if(!_[_0x5a77('0x36')](_0x24aca4[_0x5a77('0x3c')])){logger[_0x5a77('0xc')](_0x5a77('0x3d'),_0x24aca4[_0x5a77('0x3c')]);return analyticDefaultReportController[_0x5a77('0x3e')]({'id':_0x24aca4[_0x5a77('0x3c')]},_0x532c31)[_0x5a77('0x3f')](handleResult(_0x24aca4))[_0x5a77('0x34')](handleError());}if(!_[_0x5a77('0x36')](_0x24aca4['CustomReportId'])){logger['info'](_0x5a77('0x40'),_0x24aca4[_0x5a77('0x41')]);return analyticCustomReportController[_0x5a77('0x3e')]({'id':_0x24aca4[_0x5a77('0x41')]},_0x532c31)['then'](handleResult(_0x24aca4))[_0x5a77('0x34')](handleError());}}catch(_0x3893ab){logger[_0x5a77('0x31')](JSON[_0x5a77('0x2a')](_0x3893ab));}return logger[_0x5a77('0xc')](_0x5a77('0x42'));};}function getJobs(_0x5cf5d1){var _0x3dace6={};if(_0x5cf5d1){_0x3dace6['id']=_0x5cf5d1;}return db['Schedule']['findAll']({'where':_0x3dace6,'include':[{'model':db[_0x5a77('0xf')],'attributes':['id','name',_0x5a77('0xe')],'include':[{'model':db[_0x5a77('0x43')],'as':_0x5a77('0x10')}]}]})['then'](function(_0x5e8f3c){var _0xd2d71=_[_0x5a77('0x44')](manager[_0x5a77('0x45')]);var _0xb1a510=_[_0x5a77('0x46')](_0x5e8f3c,function(_0x2eaff2){return _0x2eaff2['id'][_0x5a77('0x47')]();});var _0x177c37=_[_0x5a77('0x48')](_0x5e8f3c,function(_0x5ba147){return _0x5ba147['id'][_0x5a77('0x47')]();});var _0x389994=_0x5cf5d1?_0xb1a510:_[_0x5a77('0x49')](_0xb1a510,_0xd2d71);var _0x432a11=_['intersection'](_0xb1a510,_0xd2d71);var _0x111ef1=_[_0x5a77('0x49')](_0xd2d71,_0xb1a510);var _0x3aeac1;var _0x46c41d;for(_0x3aeac1=0x0;_0x3aeac1<_0x111ef1['length']&&!_0x5cf5d1;_0x3aeac1+=0x1){_0x46c41d=_0x111ef1[_0x3aeac1][_0x5a77('0x47')]();if(manager[_0x5a77('0x4a')](_0x46c41d)){manager['stop'](_0x46c41d);manager[_0x5a77('0x4b')](_0x46c41d);logger[_0x5a77('0xc')](_0x5a77('0x4c'),_0x46c41d);}}logger[_0x5a77('0xc')]('toRun',JSON[_0x5a77('0x2a')](_0x389994));for(_0x3aeac1=0x0;_0x3aeac1<_0x389994[_0x5a77('0x4d')];_0x3aeac1+=0x1){_0x46c41d=_0x389994[_0x3aeac1][_0x5a77('0x47')]();logger[_0x5a77('0xc')](_0x5a77('0x4e'),_0x46c41d);if(_0x5cf5d1){logger[_0x5a77('0xc')](_0x5a77('0x4f'),_0x5cf5d1);logger[_0x5a77('0xc')](JSON['stringify'](_0x177c37[_0x46c41d]));BPromise[_0x5a77('0x50')]()[_0x5a77('0x3f')](handleJob(_0x177c37[_0x46c41d]));logger['info'](_0x5a77('0x51'),_0x177c37[_0x46c41d][_0x5a77('0x1c')],_0x177c37[_0x46c41d]['cron']);}else if(_0x177c37[_0x46c41d]['cron']&&_0x177c37[_0x46c41d][_0x5a77('0x52')]&&moment()[_0x5a77('0x53')](_0x177c37[_0x46c41d]['startAt'],_0x177c37[_0x46c41d][_0x5a77('0x54')])){manager['add'](_0x46c41d,_0x177c37[_0x46c41d][_0x5a77('0x55')],handleJob(_0x177c37[_0x46c41d]));manager[_0x5a77('0x56')](_0x46c41d);logger['info']('add\x20cron',_0x177c37[_0x46c41d][_0x5a77('0x1c')],_0x177c37[_0x46c41d]['cron']);}else if(manager[_0x5a77('0x4a')](_0x46c41d)){manager['stop'](_0x46c41d);manager['deleteJob'](_0x46c41d);logger[_0x5a77('0xc')](_0x5a77('0x57'),_0x177c37[_0x46c41d]['name'],_0x177c37[_0x46c41d][_0x5a77('0x55')]);}}for(_0x3aeac1=0x0,_0x46c41d;_0x3aeac1<_0x432a11[_0x5a77('0x4d')]&&!_0x5cf5d1;_0x3aeac1+=0x1){_0x46c41d=_0x432a11[_0x3aeac1][_0x5a77('0x47')]();if(manager['exists'](_0x46c41d)){if(_0x177c37[_0x46c41d]['cron']&&_0x177c37[_0x46c41d][_0x5a77('0x52')]&&moment()[_0x5a77('0x53')](_0x177c37[_0x46c41d]['startAt'],_0x177c37[_0x46c41d][_0x5a77('0x54')])){manager[_0x5a77('0x58')](_0x46c41d,_0x177c37[_0x46c41d]['cron'],handleJob(_0x177c37[_0x46c41d]));logger[_0x5a77('0xc')](_0x5a77('0x59'),_0x177c37[_0x46c41d][_0x5a77('0x1c')],_0x177c37[_0x46c41d][_0x5a77('0x55')]);}else{manager[_0x5a77('0x5a')](_0x46c41d);manager[_0x5a77('0x4b')](_0x46c41d);logger[_0x5a77('0xc')]('stop\x20cron',_0x177c37[_0x46c41d][_0x5a77('0x1c')],_0x177c37[_0x46c41d][_0x5a77('0x55')]);}}}})[_0x5a77('0x34')](function(_0x4a77ff){logger[_0x5a77('0x31')](JSON['stringify'](_0x4a77ff));});}exports[_0x5a77('0x5b')]=function(_0x51a8d4){return getJobs(_0x51a8d4);};exports[_0x5a77('0x56')]=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 f26e51b..70f1b6c 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 _0x276c=['data1','data2','transcribeRegion','then','transcribeName','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','catch','SequelizeValidationError','error','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','name','inspect','start','request-promise','util','bluebird','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x276c,0x1c6));var _0xc276=function(_0x120c96,_0x3434b9){_0x120c96=_0x120c96-0x0;var _0x173922=_0x276c[_0x120c96];return _0x173922;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xc276('0x0'));var util=require(_0xc276('0x1'));var BPromise=require(_0xc276('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x3ffb43,_0xd06f2d,_0x5a61a4,_0x2deb3d){return new Promise(function(_0x4be9b0,_0x39782e){var _0x48b335=new AWS['TranscribeService']({'accessKeyId':_0xd06f2d,'secretAccessKey':_0x3ffb43,'region':_0x5a61a4});_0x48b335[_0xc276('0x3')]({'TranscriptionJobName':_0x2deb3d},function(_0x101737,_0x3b99ed){if(_0x101737){return _0x39782e(_0x101737);}else{return _0x4be9b0(_0x3b99ed);}});});}function sentiment(_0x10f26e,_0x2a14ec,_0x4e7771,_0x12c765,_0x29d903){return new Promise(function(_0x50cc23,_0x5f2c7c){var _0x2e2748=new AWS['Comprehend']({'accessKeyId':_0x2a14ec,'secretAccessKey':_0x10f26e,'region':_0x4e7771});_0x2e2748['detectSentiment']({'Text':_0x12c765,'LanguageCode':_0x29d903[_0xc276('0x4')](0x0,0x2)},function(_0x5097d6,_0x24176c){if(_0x5097d6){return _0x5f2c7c(_0x5097d6);}else{return _0x50cc23(_0x24176c);}});});}function checkTranscribeJob(_0x1384bf,_0x1e94fd,_0x2336f9){var _0x55c9d4;return new BPromise(function(_0x19c1f9,_0x598a91){logger[_0xc276('0x5')](util[_0xc276('0x6')](_0xc276('0x7'),_0x1384bf['id'],_0x1384bf['transcribeName']));return getTranscriptionJob(_0x2336f9[_0xc276('0x8')],_0x2336f9[_0xc276('0x9')],_0x1e94fd[_0xc276('0xa')],_0x1384bf['transcribeName'])[_0xc276('0xb')](function(_0x21752e){logger[_0xc276('0x5')](util[_0xc276('0x6')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1384bf['id'],_0x1384bf[_0xc276('0xc')],_0x21752e[_0xc276('0xd')][_0xc276('0xe')]));if(!_0x1384bf['fileText']){switch(_0x21752e[_0xc276('0xd')][_0xc276('0xe')]){case _0xc276('0xf'):var _0x5dcfa0={'transcribeStatus':_0x21752e[_0xc276('0xd')][_0xc276('0xe')],'fileUri':_0x21752e[_0xc276('0xd')]['Transcript'][_0xc276('0x10')]};logger[_0xc276('0x5')](util['format'](_0xc276('0x11'),_0x1384bf['id']));return rp({'uri':_0x21752e[_0xc276('0xd')][_0xc276('0x12')]['TranscriptFileUri'],'json':!![]})[_0xc276('0xb')](function(_0x4fa826){logger[_0xc276('0x5')](util[_0xc276('0x6')](_0xc276('0x13'),_0x1384bf['id']));if(_0x4fa826&&_0x4fa826[_0xc276('0x14')]&&_0x4fa826['results']['transcripts']&&_0x4fa826[_0xc276('0x14')][_0xc276('0x15')][_0xc276('0x16')]){_0x5dcfa0[_0xc276('0x17')]='';for(var _0x37f713=0x0;_0x37f713<_0x4fa826['results'][_0xc276('0x15')]['length'];_0x37f713++){_0x5dcfa0[_0xc276('0x17')]+=_0x4fa826['results'][_0xc276('0x15')][_0x37f713][_0xc276('0x18')]+'';}}return _0x1384bf[_0xc276('0x19')](_0x5dcfa0);})[_0xc276('0xb')](function(){logger[_0xc276('0x5')](util[_0xc276('0x6')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1384bf['id']));if(!_0x1384bf[_0xc276('0x1a')]){throw new db['Sequelize'][(_0xc276('0x1b'))](_0xc276('0x1c'));}if(!_0x1e94fd[_0xc276('0x1d')]||!_0x1e94fd[_0xc276('0x1e')]||!_0x1e94fd['sentimentRegion']||!_0x1e94fd[_0xc276('0x1f')]||!_0x1e94fd[_0xc276('0x20')]){throw new db[(_0xc276('0x21'))][(_0xc276('0x1b'))](_0xc276('0x22'));}if(!_0x5dcfa0[_0xc276('0x17')]){throw new Error(_0xc276('0x23'));}if(_0x1e94fd[_0xc276('0x1e')]===_0x2336f9['id']){return _0x2336f9;}else{return db[_0xc276('0x24')][_0xc276('0x25')]({'where':{'id':_settings[_0xc276('0x1e')]}});}})['then'](function(_0x50fa88){if(!_0x50fa88){throw new db[(_0xc276('0x21'))]['ValidationError'](_0xc276('0x26'));}if(!_0x50fa88[_0xc276('0x8')]||!_0x50fa88[_0xc276('0x9')]){throw new db['Sequelize'][(_0xc276('0x1b'))](_0xc276('0x27'));}_0x55c9d4=_0x50fa88;logger[_0xc276('0x5')](util['format'](_0xc276('0x28'),_0x1384bf['id']));return sentiment(_0x55c9d4[_0xc276('0x8')],_0x55c9d4['data2'],_0x1e94fd[_0xc276('0x29')],_0x5dcfa0[_0xc276('0x17')],_0x1e94fd[_0xc276('0x1f')]);})[_0xc276('0xb')](function(_0x61b53f){logger[_0xc276('0x5')](util['format'](_0xc276('0x2a'),_0x1384bf['id']));return _0x1384bf[_0xc276('0x19')]({'sentiment':_0x61b53f[_0xc276('0x2b')],'sPositive':_0x61b53f[_0xc276('0x2c')][_0xc276('0x2d')],'sNegative':_0x61b53f[_0xc276('0x2c')][_0xc276('0x2e')],'sMixed':_0x61b53f[_0xc276('0x2c')][_0xc276('0x2f')],'sNeutral':_0x61b53f[_0xc276('0x2c')][_0xc276('0x30')]});})[_0xc276('0xb')](function(){logger['info'](util[_0xc276('0x6')](_0xc276('0x31'),_0x1384bf['id']));_0x19c1f9();});case _0xc276('0x32'):return _0x1384bf[_0xc276('0x19')]({'transcribeStatus':_0xc276('0x32'),'failureReason':_0x21752e[_0xc276('0xd')][_0xc276('0x33')]})[_0xc276('0xb')](function(){logger[_0xc276('0x5')](util[_0xc276('0x6')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1384bf['id']));_0x19c1f9();});default:logger[_0xc276('0x5')](util[_0xc276('0x6')](_0xc276('0x34'),_0x1384bf['id']));break;}}else{return BPromise['resolve']()[_0xc276('0xb')](function(){if(!_0x1384bf[_0xc276('0x1a')]){throw new db[(_0xc276('0x21'))]['ValidationError'](_0xc276('0x1c'));}if(!_0x1e94fd[_0xc276('0x1d')]||!_0x1e94fd['sentimentAccountId']||!_0x1e94fd['sentimentRegion']||!_0x1e94fd[_0xc276('0x1f')]||!_0x1e94fd[_0xc276('0x20')]){throw new db['Sequelize'][(_0xc276('0x1b'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1384bf[_0xc276('0x17')]){throw new Error(_0xc276('0x23'));}if(_0x1e94fd[_0xc276('0x1e')]===_0x2336f9['id']){return _0x2336f9;}else{return db[_0xc276('0x24')][_0xc276('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc276('0xb')](function(_0xd356e3){if(!_0xd356e3){throw new db[(_0xc276('0x21'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xd356e3['data1']||!_0xd356e3[_0xc276('0x9')]){throw new db['Sequelize']['ValidationError'](_0xc276('0x27'));}_0x55c9d4=_0xd356e3;logger[_0xc276('0x5')](util['format'](_0xc276('0x28'),_0x1384bf['id']));return sentiment(_0x55c9d4['data1'],_0x55c9d4[_0xc276('0x9')],_0x1e94fd[_0xc276('0x29')],_0x1384bf[_0xc276('0x17')],_0x1e94fd[_0xc276('0x1f')]);})['then'](function(_0x320b47){logger['info'](util[_0xc276('0x6')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1384bf['id']));return _0x1384bf[_0xc276('0x19')]({'sentiment':_0x320b47[_0xc276('0x2b')],'sPositive':_0x320b47[_0xc276('0x2c')][_0xc276('0x2d')],'sNegative':_0x320b47[_0xc276('0x2c')][_0xc276('0x2e')],'sMixed':_0x320b47['SentimentScore'][_0xc276('0x2f')],'sNeutral':_0x320b47[_0xc276('0x2c')]['Neutral'],'transcribeStatus':_0xc276('0xf')});})[_0xc276('0xb')](function(){logger[_0xc276('0x5')](util[_0xc276('0x6')](_0xc276('0x31'),_0x1384bf['id']));_0x19c1f9();});}})[_0xc276('0x35')](function(_0x4f30af){if(_0x4f30af){if(!_0x4f30af['name']||_0x4f30af['name']!==_0xc276('0x36')){logger[_0xc276('0x37')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x1384bf['id']),util['inspect'](_0x4f30af,{'showHidden':![],'depth':null}));}}_0x19c1f9();});});}function checkTranscribe(){var _0x495a1b;var _0x30c36f;var _0x1da595;return db[_0xc276('0x38')][_0xc276('0x39')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xc276('0xb')](function(_0x51a0db){if(!_0x51a0db||!_0x51a0db[_0xc276('0x16')]){throw new db[(_0xc276('0x21'))][(_0xc276('0x1b'))](_0xc276('0x3a'));}_0x495a1b=_0x51a0db;return db[_0xc276('0x3b')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x12667c){if(!_0x12667c){throw new db['Sequelize'][(_0xc276('0x1b'))](_0xc276('0x3c'));}_0x30c36f=_0x12667c;if(!_0x30c36f['transcribe']||!_0x30c36f['transcribeAccountId']||!_0x30c36f[_0xc276('0xa')]||!_0x30c36f[_0xc276('0x1f')]||!_0x30c36f[_0xc276('0x20')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xc276('0x24')][_0xc276('0x25')]({'where':{'id':_0x30c36f[_0xc276('0x3d')]}});})[_0xc276('0xb')](function(_0xf232f0){if(!_0xf232f0){throw new db['Sequelize'][(_0xc276('0x1b'))](_0xc276('0x26'));}if(!_0xf232f0[_0xc276('0x8')]||!_0xf232f0['data2']){throw new db['Sequelize'][(_0xc276('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x1da595=_0xf232f0;var _0x3263c3=[];_0x495a1b[_0xc276('0x3e')](function(_0xa43ac8){_0x3263c3['push'](checkTranscribeJob(_0xa43ac8,_0x30c36f,_0x1da595));});return BPromise['all'](_0x3263c3);})[_0xc276('0x35')](function(_0x5d8490){if(_0x5d8490){if(!_0x5d8490[_0xc276('0x3f')]||_0x5d8490[_0xc276('0x3f')]!==_0xc276('0x36')){logger[_0xc276('0x37')](util[_0xc276('0x40')](_0x5d8490,{'showHidden':![],'depth':null}));}}});}exports[_0xc276('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1657=['transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1657,0x1f0));var _0x7165=function(_0x1091a0,_0x11f4cd){_0x1091a0=_0x1091a0-0x0;var _0x5d33f6=_0x1657[_0x1091a0];return _0x5d33f6;};var _=require(_0x7165('0x0'));var AWS=require('aws-sdk');var rp=require(_0x7165('0x1'));var util=require(_0x7165('0x2'));var BPromise=require(_0x7165('0x3'));var db=require(_0x7165('0x4'))['db'];var logger=require(_0x7165('0x5'))(_0x7165('0x6'));function getTranscriptionJob(_0x1cff38,_0x1411c6,_0x51685a,_0x35406d){return new Promise(function(_0xf828b6,_0x5d2072){var _0x43f1cd=new AWS[(_0x7165('0x7'))]({'accessKeyId':_0x1411c6,'secretAccessKey':_0x1cff38,'region':_0x51685a});_0x43f1cd[_0x7165('0x8')]({'TranscriptionJobName':_0x35406d},function(_0x3f0957,_0xa910f5){if(_0x3f0957){return _0x5d2072(_0x3f0957);}else{return _0xf828b6(_0xa910f5);}});});}function sentiment(_0x1601cb,_0x4e1925,_0x211755,_0x6ec1b3,_0x314590){return new Promise(function(_0x293402,_0xe6b494){var _0x53cb6f=new AWS[(_0x7165('0x9'))]({'accessKeyId':_0x4e1925,'secretAccessKey':_0x1601cb,'region':_0x211755});_0x53cb6f[_0x7165('0xa')]({'Text':_0x6ec1b3,'LanguageCode':_0x314590[_0x7165('0xb')](0x0,0x2)},function(_0x2753f9,_0x335973){if(_0x2753f9){return _0xe6b494(_0x2753f9);}else{return _0x293402(_0x335973);}});});}function checkTranscribeJob(_0x34137f,_0x5daee4,_0x552af8){var _0x2f5061;return new BPromise(function(_0x4feb19,_0x5dc6ff){logger[_0x7165('0xc')](util[_0x7165('0xd')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x34137f['id'],_0x34137f[_0x7165('0xe')]));return getTranscriptionJob(_0x552af8[_0x7165('0xf')],_0x552af8[_0x7165('0x10')],_0x5daee4[_0x7165('0x11')],_0x34137f[_0x7165('0xe')])['then'](function(_0x2ae0ef){logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x12'),_0x34137f['id'],_0x34137f[_0x7165('0xe')],_0x2ae0ef[_0x7165('0x13')][_0x7165('0x14')]));if(!_0x34137f[_0x7165('0x15')]){switch(_0x2ae0ef[_0x7165('0x13')]['TranscriptionJobStatus']){case'COMPLETED':var _0x2cb74d={'transcribeStatus':_0x2ae0ef[_0x7165('0x13')]['TranscriptionJobStatus'],'fileUri':_0x2ae0ef[_0x7165('0x13')][_0x7165('0x16')][_0x7165('0x17')]};logger[_0x7165('0xc')](util[_0x7165('0xd')]('[RECORDING:%d]\x20Get\x20transcript',_0x34137f['id']));return rp({'uri':_0x2ae0ef[_0x7165('0x13')]['Transcript'][_0x7165('0x17')],'json':!![]})[_0x7165('0x18')](function(_0x3d472c){logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x19'),_0x34137f['id']));if(_0x3d472c&&_0x3d472c['results']&&_0x3d472c[_0x7165('0x1a')][_0x7165('0x1b')]&&_0x3d472c['results']['transcripts']['length']){_0x2cb74d[_0x7165('0x15')]='';for(var _0x4b11d6=0x0;_0x4b11d6<_0x3d472c[_0x7165('0x1a')][_0x7165('0x1b')][_0x7165('0x1c')];_0x4b11d6++){_0x2cb74d[_0x7165('0x15')]+=_0x3d472c[_0x7165('0x1a')][_0x7165('0x1b')][_0x4b11d6][_0x7165('0x1d')]+'';}}return _0x34137f[_0x7165('0x1e')](_0x2cb74d);})[_0x7165('0x18')](function(){logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x1f'),_0x34137f['id']));if(!_0x34137f[_0x7165('0x20')]){throw new db['Sequelize'][(_0x7165('0x21'))](_0x7165('0x22'));}if(!_0x5daee4['sentiment']||!_0x5daee4[_0x7165('0x23')]||!_0x5daee4[_0x7165('0x24')]||!_0x5daee4[_0x7165('0x25')]||!_0x5daee4[_0x7165('0x26')]){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2cb74d[_0x7165('0x15')]){throw new Error(_0x7165('0x28'));}if(_0x5daee4[_0x7165('0x23')]===_0x552af8['id']){return _0x552af8;}else{return db[_0x7165('0x29')][_0x7165('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7165('0x18')](function(_0x59c603){if(!_0x59c603){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))](_0x7165('0x2b'));}if(!_0x59c603[_0x7165('0xf')]||!_0x59c603[_0x7165('0x10')]){throw new db['Sequelize'][(_0x7165('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x2f5061=_0x59c603;logger[_0x7165('0xc')](util['format'](_0x7165('0x2c'),_0x34137f['id']));return sentiment(_0x2f5061[_0x7165('0xf')],_0x2f5061['data2'],_0x5daee4[_0x7165('0x24')],_0x2cb74d[_0x7165('0x15')],_0x5daee4['language']);})['then'](function(_0x2833b9){logger[_0x7165('0xc')](util[_0x7165('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x34137f['id']));return _0x34137f[_0x7165('0x1e')]({'sentiment':_0x2833b9[_0x7165('0x2d')],'sPositive':_0x2833b9[_0x7165('0x2e')]['Positive'],'sNegative':_0x2833b9[_0x7165('0x2e')][_0x7165('0x2f')],'sMixed':_0x2833b9[_0x7165('0x2e')][_0x7165('0x30')],'sNeutral':_0x2833b9[_0x7165('0x2e')][_0x7165('0x31')]});})[_0x7165('0x18')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x34137f['id']));_0x4feb19();});case _0x7165('0x32'):return _0x34137f[_0x7165('0x1e')]({'transcribeStatus':'FAILED','failureReason':_0x2ae0ef[_0x7165('0x13')][_0x7165('0x33')]})[_0x7165('0x18')](function(){logger[_0x7165('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x34137f['id']));_0x4feb19();});default:logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x34'),_0x34137f['id']));break;}}else{return BPromise[_0x7165('0x35')]()['then'](function(){if(!_0x34137f[_0x7165('0x20')]){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5daee4[_0x7165('0x36')]||!_0x5daee4[_0x7165('0x23')]||!_0x5daee4[_0x7165('0x24')]||!_0x5daee4['language']||!_0x5daee4[_0x7165('0x26')]){throw new db['Sequelize']['ValidationError'](_0x7165('0x37'));}if(!_0x34137f[_0x7165('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x5daee4['sentimentAccountId']===_0x552af8['id']){return _0x552af8;}else{return db[_0x7165('0x29')][_0x7165('0x2a')]({'where':{'id':_settings[_0x7165('0x23')]}});}})['then'](function(_0x4611ea){if(!_0x4611ea){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))](_0x7165('0x2b'));}if(!_0x4611ea[_0x7165('0xf')]||!_0x4611ea[_0x7165('0x10')]){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))](_0x7165('0x38'));}_0x2f5061=_0x4611ea;logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x2c'),_0x34137f['id']));return sentiment(_0x2f5061[_0x7165('0xf')],_0x2f5061[_0x7165('0x10')],_0x5daee4['sentimentRegion'],_0x34137f[_0x7165('0x15')],_0x5daee4[_0x7165('0x25')]);})['then'](function(_0x63da8f){logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x39'),_0x34137f['id']));return _0x34137f['update']({'sentiment':_0x63da8f[_0x7165('0x2d')],'sPositive':_0x63da8f[_0x7165('0x2e')][_0x7165('0x3a')],'sNegative':_0x63da8f['SentimentScore'][_0x7165('0x2f')],'sMixed':_0x63da8f[_0x7165('0x2e')][_0x7165('0x30')],'sNeutral':_0x63da8f[_0x7165('0x2e')][_0x7165('0x31')],'transcribeStatus':_0x7165('0x3b')});})[_0x7165('0x18')](function(){logger[_0x7165('0xc')](util[_0x7165('0xd')](_0x7165('0x1f'),_0x34137f['id']));_0x4feb19();});}})[_0x7165('0x3c')](function(_0x419a12){if(_0x419a12){if(!_0x419a12[_0x7165('0x3d')]||_0x419a12[_0x7165('0x3d')]!==_0x7165('0x3e')){logger[_0x7165('0x3f')](util[_0x7165('0xd')](_0x7165('0x40'),_0x34137f['id']),util[_0x7165('0x41')](_0x419a12,{'showHidden':![],'depth':null}));}}_0x4feb19();});});}function checkTranscribe(){var _0x348bfc;var _0x2b50b5;var _0x55f089;return db[_0x7165('0x42')][_0x7165('0x43')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7165('0x18')](function(_0x44e23b){if(!_0x44e23b||!_0x44e23b['length']){throw new db['Sequelize']['ValidationError'](_0x7165('0x44'));}_0x348bfc=_0x44e23b;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x7165('0x18')](function(_0x9af7ac){if(!_0x9af7ac){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))](_0x7165('0x45'));}_0x2b50b5=_0x9af7ac;if(!_0x2b50b5['transcribe']||!_0x2b50b5[_0x7165('0x46')]||!_0x2b50b5[_0x7165('0x11')]||!_0x2b50b5['language']||!_0x2b50b5[_0x7165('0x26')]){throw new db['Sequelize'][(_0x7165('0x21'))](_0x7165('0x47'));}return db[_0x7165('0x29')]['findOne']({'where':{'id':_0x2b50b5[_0x7165('0x46')]}});})[_0x7165('0x18')](function(_0x217567){if(!_0x217567){throw new db['Sequelize'][(_0x7165('0x21'))](_0x7165('0x2b'));}if(!_0x217567[_0x7165('0xf')]||!_0x217567['data2']){throw new db[(_0x7165('0x27'))][(_0x7165('0x21'))](_0x7165('0x38'));}_0x55f089=_0x217567;var _0x12897c=[];_0x348bfc[_0x7165('0x48')](function(_0x4c3a6d){_0x12897c['push'](checkTranscribeJob(_0x4c3a6d,_0x2b50b5,_0x55f089));});return BPromise[_0x7165('0x49')](_0x12897c);})['catch'](function(_0x5ee3a6){if(_0x5ee3a6){if(!_0x5ee3a6['name']||_0x5ee3a6['name']!==_0x7165('0x3e')){logger[_0x7165('0x3f')](util['inspect'](_0x5ee3a6,{'showHidden':![],'depth':null}));}}});}exports[_0x7165('0x4a')]=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 a10dfc0..84eee7d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20c3=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','contacts2','log','hopper2','push'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x20c3,0x7f));var _0x320c=function(_0x38fed2,_0x53fbae){_0x38fed2=_0x38fed2-0x0;var _0x336254=_0x20c3[_0x38fed2];return _0x336254;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x320c('0x0')]({'id':i,'firstName':_0x320c('0x1')+i,'lastName':_0x320c('0x2')+i,'phone':0xf879fb460+i,'email':_0x320c('0x3')+i+_0x320c('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x320c('0x5')](),'updatedAt':Date[_0x320c('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x320c('0x0')]({'id':i,'firstName':_0x320c('0x1')+i,'lastName':_0x320c('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x320c('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x320c('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x320c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x320c('0x5')]()});}db[_0x320c('0x6')][_0x320c('0x7')]({'where':{}})[_0x320c('0x8')](function(){return db['CmContact'][_0x320c('0x9')](contacts);})[_0x320c('0x8')](function(){console['log'](_0x320c('0xa'),_0x320c('0xb'));return db[_0x320c('0xc')][_0x320c('0x7')]({'where':{}});})[_0x320c('0x8')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x320c('0x8')](function(){console['log'](_0x320c('0xa'),'hopper1');return db['CmContact'][_0x320c('0x9')](contacts2);})[_0x320c('0x8')](function(){console['log']('finished\x20populating',_0x320c('0xd'));return db['CmHopper'][_0x320c('0x9')](hopper2);})[_0x320c('0x8')](function(){console[_0x320c('0xe')](_0x320c('0xa'),_0x320c('0xf'));})['catch'](function(_0x299ae4){console[_0x320c('0xe')](_0x299ae4);}); \ No newline at end of file +var _0xcca5=['@xcally.com','push','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','catch','../mysqldb','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x2d9da8,_0x5d5072){var _0x57a29c=function(_0x2f562d){while(--_0x2f562d){_0x2d9da8['push'](_0x2d9da8['shift']());}};_0x57a29c(++_0x5d5072);}(_0xcca5,0x176));var _0x5cca=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xcca5[_0x510c60];return _0x49c4aa;};'use strict';var util=require('util');var db=require(_0x5cca('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x5cca('0x1')+i,'lastName':_0x5cca('0x2')+i,'phone':0xf879fb460+i,'email':_0x5cca('0x3')+i+_0x5cca('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5cca('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5cca('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5cca('0x5')]({'id':i,'firstName':_0x5cca('0x1')+i,'lastName':_0x5cca('0x2')+i,'phone':0xf879fb460+i,'email':_0x5cca('0x3')+i+_0x5cca('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5cca('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x5cca('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5cca('0x6')](),'updatedAt':Date['now']()});}db[_0x5cca('0x7')][_0x5cca('0x8')]({'where':{}})[_0x5cca('0x9')](function(){return db[_0x5cca('0x7')]['bulkCreate'](contacts);})['then'](function(){console[_0x5cca('0xa')](_0x5cca('0xb'),_0x5cca('0xc'));return db[_0x5cca('0xd')][_0x5cca('0x8')]({'where':{}});})[_0x5cca('0x9')](function(){return db[_0x5cca('0xd')][_0x5cca('0xe')](hopper);})[_0x5cca('0x9')](function(){console[_0x5cca('0xa')]('finished\x20populating',_0x5cca('0xf'));return db[_0x5cca('0x7')]['bulkCreate'](contacts2);})[_0x5cca('0x9')](function(){console['log'](_0x5cca('0xb'),_0x5cca('0x10'));return db[_0x5cca('0xd')][_0x5cca('0xe')](hopper2);})[_0x5cca('0x9')](function(){console['log']('finished\x20populating','hopper2');})[_0x5cca('0x11')](function(_0x1651a2){console[_0x5cca('0xa')](_0x1651a2);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7e31b21..fc9f6d5 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c2d=['bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','wss','all','ulaw','yes'];(function(_0xd7b7c4,_0x3bde33){var _0x3701d4=function(_0x37f7de){while(--_0x37f7de){_0xd7b7c4['push'](_0xd7b7c4['shift']());}};_0x3701d4(++_0x3bde33);}(_0x7c2d,0x185));var _0xd7c2=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x7c2d[_0x13b8f3];return _0x1a6d06;};'use strict';var util=require(_0xd7c2('0x0'));var db=require(_0xd7c2('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd7c2('0x2')](_0xd7c2('0x3'),_0xd7c2('0x4'),i),'fullname':util[_0xd7c2('0x2')]('%s%s',_0xd7c2('0x4'),i),'email':util[_0xd7c2('0x2')](_0xd7c2('0x5'),_0xd7c2('0x4'),i),'role':'agent','password':_0xd7c2('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xd7c2('0x7')],'disallow':[_0xd7c2('0x8')],'allow':[_0xd7c2('0x9')],'defaultuser':util['format']('%s%s',_0xd7c2('0x4'),i),'encryption':_0xd7c2('0xa'),'avpf':'yes','force_avp':_0xd7c2('0xa'),'icesupport':_0xd7c2('0xa'),'dtlsenable':_0xd7c2('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xd7c2('0x2')]('\x22%s\x22\x20<%s>',util[_0xd7c2('0x2')](_0xd7c2('0x3'),_0xd7c2('0x4'),i),0xfa0+i)});}db['User'][_0xd7c2('0xb')](users)[_0xd7c2('0xc')](function(){console[_0xd7c2('0xd')](_0xd7c2('0xe'));})[_0xd7c2('0xf')](function(_0x135b44){console['log'](_0x135b44);}); \ No newline at end of file +var _0xfbfb=['format','agent','%s%s','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfbfb,0x109));var _0xbfbf=function(_0x41aa02,_0x1865a9){_0x41aa02=_0x41aa02-0x0;var _0x350643=_0xfbfb[_0x41aa02];return _0x350643;};'use strict';var util=require(_0xbfbf('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xbfbf('0x1')]('%s%s',_0xbfbf('0x2'),i),'fullname':util[_0xbfbf('0x1')](_0xbfbf('0x3'),_0xbfbf('0x2'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':_0xbfbf('0x2'),'password':_0xbfbf('0x4'),'internal':0xfa0+i,'type':_0xbfbf('0x5'),'transport':[_0xbfbf('0x6'),'ws',_0xbfbf('0x7')],'disallow':[_0xbfbf('0x8')],'allow':[_0xbfbf('0x9')],'defaultuser':util[_0xbfbf('0x1')](_0xbfbf('0x3'),_0xbfbf('0x2'),i),'encryption':_0xbfbf('0xa'),'avpf':_0xbfbf('0xa'),'force_avp':_0xbfbf('0xa'),'icesupport':_0xbfbf('0xa'),'dtlsenable':_0xbfbf('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xbfbf('0xb'),'dtlssetup':_0xbfbf('0xc'),'callerid':util[_0xbfbf('0x1')](_0xbfbf('0xd'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xbfbf('0xe')][_0xbfbf('0xf')](users)[_0xbfbf('0x10')](function(){console[_0xbfbf('0x11')](_0xbfbf('0x12'));})['catch'](function(_0x5098ec){console[_0xbfbf('0x11')](_0x5098ec);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f58cac4..7fd356d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6611=['emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','Campaign','where','ivr','%s:queue:%s','length','format','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:outbound','include','VoiceQueue','push','ChatQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueues','SmsQueue','OpenchannelQueues','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','chat','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions'];(function(_0x4f784f,_0x33c48e){var _0x4921cc=function(_0x32e3d8){while(--_0x32e3d8){_0x4f784f['push'](_0x4f784f['shift']());}};_0x4921cc(++_0x33c48e);}(_0x6611,0xdd));var _0x1661=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6611[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x1661('0x0'));var BPromise=require(_0x1661('0x1'));var db=require(_0x1661('0x2'))['db'];var config=require(_0x1661('0x3'));var queryQueues={'attributes':['id',_0x1661('0x4')],'include':[{'as':_0x1661('0x5'),'model':db[_0x1661('0x6')],'attributes':['id',_0x1661('0x4'),_0x1661('0x7')],'raw':!![],'where':{'role':_0x1661('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1661('0x4')],'where':{'role':_0x1661('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x1661('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1661('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x9a6c9b,_0x403afc,_0x28026e){return db[_0x1661('0xa')][_0x1661('0xb')]({'where':{'name':_0x9a6c9b,'userProfileId':_0x403afc},'raw':!![]})[_0x1661('0xc')](function(_0x11a269){if(_0x11a269){if(_0x11a269[_0x1661('0xd')]){switch(_0x9a6c9b){case'VoiceQueues':case _0x1661('0xe'):case _0x1661('0xf'):case'SmsQueues':case _0x1661('0x10'):case'OpenchannelQueues':case _0x1661('0x11'):return db[_0x28026e][_0x1661('0x12')](queryQueues);case _0x1661('0x13'):return db[_0x28026e][_0x1661('0x12')](queryTelephones);case _0x1661('0x14'):return db[_0x28026e][_0x1661('0x12')](queryTrunks);case _0x1661('0x15'):return db[_0x28026e][_0x1661('0x12')](queryCampaigns);}}else{return db[_0x1661('0x16')][_0x1661('0x12')]({'attributes':[_0x1661('0x17')],'where':{'sectionId':_0x11a269['id']},'raw':!![]})[_0x1661('0xc')](function(_0x1c38d6){if(_0x1c38d6){var _0x535eb1={'where':{'id':_['map'](_0x1c38d6,_0x1661('0x17'))},'raw':!![]};switch(_0x28026e){case _0x1661('0x6'):_0x535eb1['where'][_0x1661('0x7')]=_0x1661('0x9');break;case _0x1661('0x18'):_0x535eb1[_0x1661('0x19')]['type']=_0x1661('0x1a');break;}return db[_0x28026e]['findAll'](_0x535eb1);}else{return[];}});}}else{return[];}})[_0x1661('0xc')](function(_0x59a48c){return _0x59a48c;});}function joinOrLeaveQueues(_0x75e008,_0x2938c9,_0x4f7d40,_0x2f6528){_0x75e008[_0x2938c9](util['format'](_0x1661('0x1b'),_0x4f7d40,_0x2f6528[_0x1661('0x4')]));if(_0x2f6528[_0x1661('0x5')]){for(var _0x43d367=0x0;_0x43d367<_0x2f6528[_0x1661('0x5')][_0x1661('0x1c')];_0x43d367+=0x1){_0x75e008[_0x2938c9](util[_0x1661('0x1d')]('user:%s',_0x2f6528['Agents'][_0x43d367][_0x1661('0x4')]));}}}function joinOrLeave(_0x1acf83,_0x4a21ab,_0x2cb559){var _0x38c00c;if(_0x1acf83['handshake'][_0x1661('0x1e')]['id']){db['User'][_0x1661('0x1f')]({'attributes':['id',_0x1661('0x4'),_0x1661('0x7'),_0x1661('0x20')],'where':{'id':_0x1acf83['handshake'][_0x1661('0x1e')]['id']},'include':[{'model':db[_0x1661('0x21')],'as':_0x1661('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x1661('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x1661('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1661('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1661('0x26')],'as':_0x1661('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x1661('0x28')],'as':_0x1661('0x29'),'attributes':['id'],'raw':!![]}]})[_0x1661('0xc')](function(_0x3eb848){if(_0x3eb848){_0x38c00c=_0x3eb848;_0x1acf83[_0x4a21ab](util[_0x1661('0x1d')](_0x1661('0x2a'),_0x3eb848['name']));var _0x2e0f0a=[];switch(_0x3eb848[_0x1661('0x7')]){case'admin':_0x1acf83[_0x4a21ab]('voice:inbound');_0x1acf83[_0x4a21ab](_0x1661('0x2b'));if(queryQueues['hasOwnProperty'](_0x1661('0x2c'))){delete queryQueues[_0x1661('0x2c')];}_0x2e0f0a['push'](db[_0x1661('0x2d')][_0x1661('0x12')](queryQueues));_0x2e0f0a[_0x1661('0x2e')](db[_0x1661('0x2f')][_0x1661('0x12')](queryQueues));_0x2e0f0a[_0x1661('0x2e')](db['FaxQueue'][_0x1661('0x12')](queryQueues));_0x2e0f0a[_0x1661('0x2e')](db['SmsQueue'][_0x1661('0x12')](queryQueues));_0x2e0f0a[_0x1661('0x2e')](db['MailQueue'][_0x1661('0x12')](queryQueues));_0x2e0f0a['push'](db[_0x1661('0x30')][_0x1661('0x12')](queryQueues));_0x2e0f0a[_0x1661('0x2e')](db[_0x1661('0x31')][_0x1661('0x12')](queryQueues));_0x2e0f0a[_0x1661('0x2e')](db[_0x1661('0x6')]['findAll'](queryTelephones));_0x2e0f0a[_0x1661('0x2e')](db[_0x1661('0x32')][_0x1661('0x12')](queryTrunks));_0x2e0f0a[_0x1661('0x2e')](db['Campaign'][_0x1661('0x12')](queryCampaigns));_0x2e0f0a[_0x1661('0x2e')](db[_0x1661('0x6')]['findAll'](queryAgents));break;case _0x1661('0x33'):_0x1acf83[_0x4a21ab]('voice:inbound');_0x1acf83[_0x4a21ab]('voice:outbound');_0x2e0f0a['push'](getAssociatedResources(_0x1661('0x34'),_0x3eb848[_0x1661('0x20')],_0x1661('0x2d')));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources(_0x1661('0xe'),_0x3eb848[_0x1661('0x20')],'ChatQueue'));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources(_0x1661('0xf'),_0x3eb848[_0x1661('0x20')],'FaxQueue'));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources(_0x1661('0x35'),_0x3eb848[_0x1661('0x20')],_0x1661('0x36')));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources('MailQueues',_0x3eb848['userProfileId'],'MailQueue'));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources(_0x1661('0x37'),_0x3eb848[_0x1661('0x20')],_0x1661('0x30')));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources(_0x1661('0x11'),_0x3eb848[_0x1661('0x20')],_0x1661('0x31')));_0x2e0f0a[_0x1661('0x2e')](getAssociatedResources('Telephones',_0x3eb848['userProfileId'],_0x1661('0x6')));_0x2e0f0a['push'](getAssociatedResources(_0x1661('0x14'),_0x3eb848[_0x1661('0x20')],_0x1661('0x32')));_0x2e0f0a['push'](getAssociatedResources(_0x1661('0x15'),_0x3eb848[_0x1661('0x20')],_0x1661('0x18')));_0x2e0f0a[_0x1661('0x2e')](db['User']['findAll'](queryAgents));break;case _0x1661('0x8'):_0x1acf83[_0x4a21ab](_0x1661('0x38'));_0x1acf83[_0x4a21ab](_0x1661('0x2b'));_0x2e0f0a['push'](_0x3eb848[_0x1661('0x39')]({'attributes':['id',_0x1661('0x4')]}));_0x2e0f0a[_0x1661('0x2e')](_0x3eb848[_0x1661('0x3a')]({'attributes':['id',_0x1661('0x4')]}));_0x2e0f0a[_0x1661('0x2e')](_0x3eb848['getFaxQueues']({'attributes':['id',_0x1661('0x4')]}));_0x2e0f0a[_0x1661('0x2e')](_0x3eb848[_0x1661('0x3b')]({'attributes':['id',_0x1661('0x4')]}));_0x2e0f0a[_0x1661('0x2e')](_0x3eb848[_0x1661('0x3c')]({'attributes':['id',_0x1661('0x4')]}));_0x2e0f0a[_0x1661('0x2e')](_0x3eb848['getOpenchannelQueues']({'attributes':['id',_0x1661('0x4')]}));_0x2e0f0a[_0x1661('0x2e')](_0x3eb848[_0x1661('0x3d')]({'attributes':['id',_0x1661('0x4')]}));break;}return BPromise['all'](_0x2e0f0a);}})[_0x1661('0xc')](function(_0x1e2d3f){if(_0x1e2d3f&&_0x1e2d3f[_0x1661('0x1c')]){for(var _0x43b1ca=0x0;_0x43b1ca<_0x1e2d3f[_0x1661('0x1c')];_0x43b1ca+=0x1){for(var _0x2bfba4=0x0;_0x2bfba4<_0x1e2d3f[_0x43b1ca][_0x1661('0x1c')];_0x2bfba4+=0x1){switch(_0x43b1ca){case 0x0:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,'voice',_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x1:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,_0x1661('0x3e'),_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x2:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,'fax',_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x3:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,'sms',_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x4:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,'mail',_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x5:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,_0x1661('0x3f'),_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x6:joinOrLeaveQueues(_0x1acf83,_0x4a21ab,_0x1661('0x40'),_0x1e2d3f[_0x43b1ca][_0x2bfba4]);break;case 0x7:_0x1acf83[_0x4a21ab](util[_0x1661('0x1d')](_0x1661('0x41'),_0x1e2d3f[_0x43b1ca][_0x2bfba4]['name']));break;case 0x8:_0x1acf83[_0x4a21ab](util[_0x1661('0x1d')](_0x1661('0x42'),_0x1e2d3f[_0x43b1ca][_0x2bfba4][_0x1661('0x4')]));break;case 0x9:_0x1acf83[_0x4a21ab](util[_0x1661('0x1d')](_0x1661('0x43'),_0x1e2d3f[_0x43b1ca][_0x2bfba4]['type'],_0x1e2d3f[_0x43b1ca][_0x2bfba4][_0x1661('0x4')]));break;case 0xa:_0x1acf83[_0x4a21ab](util[_0x1661('0x1d')](_0x1661('0x2a'),_0x1e2d3f[_0x43b1ca][_0x2bfba4][_0x1661('0x4')]));break;}}}}})[_0x1661('0xc')](function(){if(_0x4a21ab==='leave'){var _0x4bb128=_[_0x1661('0x44')](_0x38c00c[_0x1661('0x22')],'id');return _0x38c00c[_0x1661('0x45')](_0x4bb128)[_0x1661('0xc')](function(){for(var _0x12fcdb=0x0;_0x12fcdb<_0x4bb128[_0x1661('0x1c')];_0x12fcdb+=0x1){_0x2cb559[_0x1661('0x46')](_0x1661('0x47'),{'ChatInteractionId':Number(_0x4bb128[_0x12fcdb]),'UserId':Number(_0x38c00c['id'])});}});}})['then'](function(){if(_0x4a21ab===_0x1661('0x48')){var _0x4ce4da=_[_0x1661('0x44')](_0x38c00c[_0x1661('0x23')],'id');return _0x38c00c[_0x1661('0x49')](_0x4ce4da)[_0x1661('0xc')](function(){for(var _0x2c5bf0=0x0;_0x2c5bf0<_0x4ce4da[_0x1661('0x1c')];_0x2c5bf0+=0x1){_0x2cb559[_0x1661('0x46')](_0x1661('0x4a'),{'MailInteractionId':Number(_0x4ce4da[_0x2c5bf0]),'UserId':Number(_0x38c00c['id'])});}});}})[_0x1661('0xc')](function(){if(_0x4a21ab===_0x1661('0x48')){var _0x20f2b9=_[_0x1661('0x44')](_0x38c00c[_0x1661('0x4b')],'id');return _0x38c00c[_0x1661('0x4c')](_0x20f2b9)[_0x1661('0xc')](function(){for(var _0x524233=0x0;_0x524233<_0x20f2b9['length'];_0x524233+=0x1){_0x2cb559[_0x1661('0x46')](_0x1661('0x4d'),{'FaxInteractionId':Number(_0x20f2b9[_0x524233]),'UserId':Number(_0x38c00c['id'])});}});}})[_0x1661('0xc')](function(){if(_0x4a21ab===_0x1661('0x48')){var _0x507cf8=_['map'](_0x38c00c[_0x1661('0x4e')],'id');return _0x38c00c[_0x1661('0x4f')](_0x507cf8)[_0x1661('0xc')](function(){for(var _0x27b765=0x0;_0x27b765<_0x507cf8[_0x1661('0x1c')];_0x27b765+=0x1){_0x2cb559[_0x1661('0x46')](_0x1661('0x50'),{'SmsInteractionId':Number(_0x507cf8[_0x27b765]),'UserId':Number(_0x38c00c['id'])});}});}})[_0x1661('0xc')](function(){if(_0x4a21ab===_0x1661('0x48')){var _0x4fcd29=_[_0x1661('0x44')](_0x38c00c['OpenchannelInteractions'],'id');return _0x38c00c[_0x1661('0x51')](_0x4fcd29)[_0x1661('0xc')](function(){for(var _0x1f6f14=0x0;_0x1f6f14<_0x4fcd29[_0x1661('0x1c')];_0x1f6f14+=0x1){_0x2cb559[_0x1661('0x46')](_0x1661('0x52'),{'OpenchannelInteractionId':Number(_0x4fcd29[_0x1f6f14]),'UserId':Number(_0x38c00c['id'])});}});}})[_0x1661('0xc')](function(){if(_0x4a21ab===_0x1661('0x48')){var _0x3424ae=_[_0x1661('0x44')](_0x38c00c[_0x1661('0x29')],'id');return _0x38c00c[_0x1661('0x53')](_0x3424ae)[_0x1661('0xc')](function(){for(var _0x1ee71d=0x0;_0x1ee71d<_0x3424ae[_0x1661('0x1c')];_0x1ee71d+=0x1){_0x2cb559[_0x1661('0x46')](_0x1661('0x54'),{'WhatsappInteractionId':Number(_0x3424ae[_0x1ee71d]),'UserId':Number(_0x38c00c['id'])});}});}})[_0x1661('0x55')](function(_0x4d8553){_0x1acf83[_0x1661('0x56')](_0x4d8553);});}}function onDisconnect(_0x586739,_0x2af433){joinOrLeave(_0x586739,_0x1661('0x48'),_0x2af433);}function onConnect(_0x532334){joinOrLeave(_0x532334,'join');}exports['default']=function(_0x507b83){_0x507b83['on'](_0x1661('0x57'),function(_0x3c63a1){_0x3c63a1[_0x1661('0x58')](0x0);_0x3c63a1['address']=_0x3c63a1[_0x1661('0x59')][_0x1661('0x57')][_0x1661('0x5a')]+':'+_0x3c63a1['request']['connection'][_0x1661('0x5b')];_0x3c63a1[_0x1661('0x5c')]=new Date();_0x3c63a1[_0x1661('0x56')]=function(_0x451ac9){console[_0x1661('0x56')](_0x1661('0x5d')+_0x3c63a1[_0x1661('0x5e')][_0x1661('0x4')]+'['+_0x3c63a1[_0x1661('0x5f')]+']',_0x451ac9);};_0x3c63a1['on']('disconnect',function(){onDisconnect(_0x3c63a1,_0x507b83);_0x3c63a1[_0x1661('0x56')]('DISCONNECTED');});onConnect(_0x3c63a1);_0x3c63a1[_0x1661('0x56')](_0x1661('0x60'));});}; \ No newline at end of file +var _0x34dc=['UserProfileSection','findOne','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','telephone','where','length','format','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','ChatQueue','push','MailQueue','Campaign','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','type','ivr'];(function(_0x96074,_0x328d5d){var _0x381f14=function(_0x2cfc5c){while(--_0x2cfc5c){_0x96074['push'](_0x96074['shift']());}};_0x381f14(++_0x328d5d);}(_0x34dc,0x113));var _0xc34d=function(_0x3f1a2e,_0x4da911){_0x3f1a2e=_0x3f1a2e-0x0;var _0x3fad9a=_0x34dc[_0x3f1a2e];return _0x3fad9a;};'use strict';var _=require(_0xc34d('0x0'));var util=require('util');var BPromise=require(_0xc34d('0x1'));var db=require(_0xc34d('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc34d('0x3')],'include':[{'as':_0xc34d('0x4'),'model':db[_0xc34d('0x5')],'attributes':['id','name',_0xc34d('0x6')],'raw':!![],'where':{'role':_0xc34d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xc34d('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xc34d('0x3')],'where':{'role':_0xc34d('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc34d('0x3'),_0xc34d('0x8')],'where':{'type':_0xc34d('0x9')}};function getAssociatedResources(_0x282273,_0x2aa099,_0x2311e2){return db[_0xc34d('0xa')][_0xc34d('0xb')]({'where':{'name':_0x282273,'userProfileId':_0x2aa099},'raw':!![]})['then'](function(_0x281cb4){if(_0x281cb4){if(_0x281cb4['autoAssociation']){switch(_0x282273){case _0xc34d('0xc'):case _0xc34d('0xd'):case _0xc34d('0xe'):case _0xc34d('0xf'):case _0xc34d('0x10'):case _0xc34d('0x11'):case _0xc34d('0x12'):return db[_0x2311e2][_0xc34d('0x13')](queryQueues);case _0xc34d('0x14'):return db[_0x2311e2]['findAll'](queryTelephones);case _0xc34d('0x15'):return db[_0x2311e2][_0xc34d('0x13')](queryTrunks);case _0xc34d('0x16'):return db[_0x2311e2]['findAll'](queryCampaigns);}}else{return db[_0xc34d('0x17')]['findAll']({'attributes':[_0xc34d('0x18')],'where':{'sectionId':_0x281cb4['id']},'raw':!![]})[_0xc34d('0x19')](function(_0x59908f){if(_0x59908f){var _0x253df2={'where':{'id':_[_0xc34d('0x1a')](_0x59908f,_0xc34d('0x18'))},'raw':!![]};switch(_0x2311e2){case'User':_0x253df2['where']['role']=_0xc34d('0x1b');break;case'Campaign':_0x253df2[_0xc34d('0x1c')][_0xc34d('0x8')]=_0xc34d('0x9');break;}return db[_0x2311e2][_0xc34d('0x13')](_0x253df2);}else{return[];}});}}else{return[];}})[_0xc34d('0x19')](function(_0x153182){return _0x153182;});}function joinOrLeaveQueues(_0x5bdd8c,_0x58075a,_0x1c5b8f,_0x369735){_0x5bdd8c[_0x58075a](util['format']('%s:queue:%s',_0x1c5b8f,_0x369735[_0xc34d('0x3')]));if(_0x369735[_0xc34d('0x4')]){for(var _0x447140=0x0;_0x447140<_0x369735['Agents'][_0xc34d('0x1d')];_0x447140+=0x1){_0x5bdd8c[_0x58075a](util[_0xc34d('0x1e')](_0xc34d('0x1f'),_0x369735[_0xc34d('0x4')][_0x447140][_0xc34d('0x3')]));}}}function joinOrLeave(_0x5b86f6,_0x54a566,_0x5317ee){var _0x3eae18;if(_0x5b86f6[_0xc34d('0x20')]['query']['id']){db[_0xc34d('0x5')][_0xc34d('0x21')]({'attributes':['id','name',_0xc34d('0x6'),_0xc34d('0x22')],'where':{'id':_0x5b86f6[_0xc34d('0x20')][_0xc34d('0x23')]['id']},'include':[{'model':db[_0xc34d('0x24')],'as':_0xc34d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xc34d('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xc34d('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xc34d('0x28')],'as':_0xc34d('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xc34d('0x2a')],'as':_0xc34d('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xc34d('0x2c')],'as':_0xc34d('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xc34d('0x19')](function(_0x11fc43){if(_0x11fc43){_0x3eae18=_0x11fc43;_0x5b86f6[_0x54a566](util[_0xc34d('0x1e')](_0xc34d('0x1f'),_0x11fc43[_0xc34d('0x3')]));var _0x59e629=[];switch(_0x11fc43[_0xc34d('0x6')]){case'admin':_0x5b86f6[_0x54a566](_0xc34d('0x2e'));_0x5b86f6[_0x54a566](_0xc34d('0x2f'));if(queryQueues[_0xc34d('0x30')](_0xc34d('0x31'))){delete queryQueues[_0xc34d('0x31')];}_0x59e629['push'](db[_0xc34d('0x32')]['findAll'](queryQueues));_0x59e629['push'](db[_0xc34d('0x33')]['findAll'](queryQueues));_0x59e629['push'](db['FaxQueue'][_0xc34d('0x13')](queryQueues));_0x59e629['push'](db['SmsQueue']['findAll'](queryQueues));_0x59e629[_0xc34d('0x34')](db[_0xc34d('0x35')][_0xc34d('0x13')](queryQueues));_0x59e629['push'](db['OpenchannelQueue'][_0xc34d('0x13')](queryQueues));_0x59e629[_0xc34d('0x34')](db['WhatsappQueue']['findAll'](queryQueues));_0x59e629[_0xc34d('0x34')](db[_0xc34d('0x5')][_0xc34d('0x13')](queryTelephones));_0x59e629[_0xc34d('0x34')](db['Trunk'][_0xc34d('0x13')](queryTrunks));_0x59e629[_0xc34d('0x34')](db[_0xc34d('0x36')][_0xc34d('0x13')](queryCampaigns));_0x59e629[_0xc34d('0x34')](db['User'][_0xc34d('0x13')](queryAgents));break;case'user':_0x5b86f6[_0x54a566](_0xc34d('0x2e'));_0x5b86f6[_0x54a566](_0xc34d('0x2f'));_0x59e629['push'](getAssociatedResources('VoiceQueues',_0x11fc43[_0xc34d('0x22')],_0xc34d('0x32')));_0x59e629[_0xc34d('0x34')](getAssociatedResources('ChatQueues',_0x11fc43[_0xc34d('0x22')],_0xc34d('0x33')));_0x59e629[_0xc34d('0x34')](getAssociatedResources(_0xc34d('0xe'),_0x11fc43[_0xc34d('0x22')],'FaxQueue'));_0x59e629[_0xc34d('0x34')](getAssociatedResources(_0xc34d('0xf'),_0x11fc43[_0xc34d('0x22')],_0xc34d('0x37')));_0x59e629[_0xc34d('0x34')](getAssociatedResources(_0xc34d('0x10'),_0x11fc43[_0xc34d('0x22')],_0xc34d('0x35')));_0x59e629[_0xc34d('0x34')](getAssociatedResources(_0xc34d('0x11'),_0x11fc43[_0xc34d('0x22')],_0xc34d('0x38')));_0x59e629[_0xc34d('0x34')](getAssociatedResources(_0xc34d('0x12'),_0x11fc43[_0xc34d('0x22')],_0xc34d('0x39')));_0x59e629['push'](getAssociatedResources(_0xc34d('0x14'),_0x11fc43[_0xc34d('0x22')],_0xc34d('0x5')));_0x59e629[_0xc34d('0x34')](getAssociatedResources('Trunks',_0x11fc43['userProfileId'],_0xc34d('0x3a')));_0x59e629['push'](getAssociatedResources('IvrCampaigns',_0x11fc43[_0xc34d('0x22')],'Campaign'));_0x59e629[_0xc34d('0x34')](db[_0xc34d('0x5')][_0xc34d('0x13')](queryAgents));break;case _0xc34d('0x7'):_0x5b86f6[_0x54a566](_0xc34d('0x2e'));_0x5b86f6[_0x54a566](_0xc34d('0x2f'));_0x59e629[_0xc34d('0x34')](_0x11fc43[_0xc34d('0x3b')]({'attributes':['id',_0xc34d('0x3')]}));_0x59e629[_0xc34d('0x34')](_0x11fc43[_0xc34d('0x3c')]({'attributes':['id',_0xc34d('0x3')]}));_0x59e629[_0xc34d('0x34')](_0x11fc43[_0xc34d('0x3d')]({'attributes':['id',_0xc34d('0x3')]}));_0x59e629[_0xc34d('0x34')](_0x11fc43['getSmsQueues']({'attributes':['id',_0xc34d('0x3')]}));_0x59e629['push'](_0x11fc43[_0xc34d('0x3e')]({'attributes':['id','name']}));_0x59e629[_0xc34d('0x34')](_0x11fc43[_0xc34d('0x3f')]({'attributes':['id','name']}));_0x59e629[_0xc34d('0x34')](_0x11fc43[_0xc34d('0x40')]({'attributes':['id',_0xc34d('0x3')]}));break;}return BPromise[_0xc34d('0x41')](_0x59e629);}})[_0xc34d('0x19')](function(_0x56b2c2){if(_0x56b2c2&&_0x56b2c2[_0xc34d('0x1d')]){for(var _0x4ccdae=0x0;_0x4ccdae<_0x56b2c2[_0xc34d('0x1d')];_0x4ccdae+=0x1){for(var _0x11d08f=0x0;_0x11d08f<_0x56b2c2[_0x4ccdae][_0xc34d('0x1d')];_0x11d08f+=0x1){switch(_0x4ccdae){case 0x0:joinOrLeaveQueues(_0x5b86f6,_0x54a566,_0xc34d('0x42'),_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x1:joinOrLeaveQueues(_0x5b86f6,_0x54a566,_0xc34d('0x43'),_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x2:joinOrLeaveQueues(_0x5b86f6,_0x54a566,_0xc34d('0x44'),_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x3:joinOrLeaveQueues(_0x5b86f6,_0x54a566,_0xc34d('0x45'),_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x4:joinOrLeaveQueues(_0x5b86f6,_0x54a566,_0xc34d('0x46'),_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x5:joinOrLeaveQueues(_0x5b86f6,_0x54a566,_0xc34d('0x47'),_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x6:joinOrLeaveQueues(_0x5b86f6,_0x54a566,'whatsapp',_0x56b2c2[_0x4ccdae][_0x11d08f]);break;case 0x7:_0x5b86f6[_0x54a566](util['format'](_0xc34d('0x48'),_0x56b2c2[_0x4ccdae][_0x11d08f][_0xc34d('0x3')]));break;case 0x8:_0x5b86f6[_0x54a566](util['format'](_0xc34d('0x49'),_0x56b2c2[_0x4ccdae][_0x11d08f][_0xc34d('0x3')]));break;case 0x9:_0x5b86f6[_0x54a566](util['format']('campaign:%s:%s',_0x56b2c2[_0x4ccdae][_0x11d08f][_0xc34d('0x8')],_0x56b2c2[_0x4ccdae][_0x11d08f]['name']));break;case 0xa:_0x5b86f6[_0x54a566](util['format'](_0xc34d('0x1f'),_0x56b2c2[_0x4ccdae][_0x11d08f]['name']));break;}}}}})[_0xc34d('0x19')](function(){if(_0x54a566===_0xc34d('0x4a')){var _0x559ada=_[_0xc34d('0x1a')](_0x3eae18[_0xc34d('0x25')],'id');return _0x3eae18[_0xc34d('0x4b')](_0x559ada)[_0xc34d('0x19')](function(){for(var _0x2280d6=0x0;_0x2280d6<_0x559ada['length'];_0x2280d6+=0x1){_0x5317ee[_0xc34d('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x559ada[_0x2280d6]),'UserId':Number(_0x3eae18['id'])});}});}})[_0xc34d('0x19')](function(){if(_0x54a566===_0xc34d('0x4a')){var _0x5d2738=_[_0xc34d('0x1a')](_0x3eae18[_0xc34d('0x4d')],'id');return _0x3eae18[_0xc34d('0x4e')](_0x5d2738)[_0xc34d('0x19')](function(){for(var _0x3f3ed3=0x0;_0x3f3ed3<_0x5d2738[_0xc34d('0x1d')];_0x3f3ed3+=0x1){_0x5317ee['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5d2738[_0x3f3ed3]),'UserId':Number(_0x3eae18['id'])});}});}})[_0xc34d('0x19')](function(){if(_0x54a566===_0xc34d('0x4a')){var _0x3f7bed=_['map'](_0x3eae18['FaxInteractions'],'id');return _0x3eae18['removeFaxInteractions'](_0x3f7bed)[_0xc34d('0x19')](function(){for(var _0xf96f88=0x0;_0xf96f88<_0x3f7bed[_0xc34d('0x1d')];_0xf96f88+=0x1){_0x5317ee[_0xc34d('0x4c')](_0xc34d('0x4f'),{'FaxInteractionId':Number(_0x3f7bed[_0xf96f88]),'UserId':Number(_0x3eae18['id'])});}});}})[_0xc34d('0x19')](function(){if(_0x54a566===_0xc34d('0x4a')){var _0x39d96d=_['map'](_0x3eae18[_0xc34d('0x29')],'id');return _0x3eae18['removeSmsInteractions'](_0x39d96d)[_0xc34d('0x19')](function(){for(var _0x4a8316=0x0;_0x4a8316<_0x39d96d['length'];_0x4a8316+=0x1){_0x5317ee[_0xc34d('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x39d96d[_0x4a8316]),'UserId':Number(_0x3eae18['id'])});}});}})['then'](function(){if(_0x54a566===_0xc34d('0x4a')){var _0x54ad82=_[_0xc34d('0x1a')](_0x3eae18[_0xc34d('0x2b')],'id');return _0x3eae18[_0xc34d('0x50')](_0x54ad82)[_0xc34d('0x19')](function(){for(var _0x5e8c08=0x0;_0x5e8c08<_0x54ad82['length'];_0x5e8c08+=0x1){_0x5317ee['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x54ad82[_0x5e8c08]),'UserId':Number(_0x3eae18['id'])});}});}})['then'](function(){if(_0x54a566===_0xc34d('0x4a')){var _0x3436a0=_[_0xc34d('0x1a')](_0x3eae18['WhatsappInteractions'],'id');return _0x3eae18[_0xc34d('0x51')](_0x3436a0)[_0xc34d('0x19')](function(){for(var _0x3573d8=0x0;_0x3573d8<_0x3436a0[_0xc34d('0x1d')];_0x3573d8+=0x1){_0x5317ee[_0xc34d('0x4c')](_0xc34d('0x52'),{'WhatsappInteractionId':Number(_0x3436a0[_0x3573d8]),'UserId':Number(_0x3eae18['id'])});}});}})[_0xc34d('0x53')](function(_0x4ccb64){_0x5b86f6[_0xc34d('0x54')](_0x4ccb64);});}}function onDisconnect(_0x18a2b0,_0x4b6c6b){joinOrLeave(_0x18a2b0,'leave',_0x4b6c6b);}function onConnect(_0x397490){joinOrLeave(_0x397490,'join');}exports['default']=function(_0x3997f9){_0x3997f9['on'](_0xc34d('0x55'),function(_0x15e058){_0x15e058[_0xc34d('0x56')](0x0);_0x15e058[_0xc34d('0x57')]=_0x15e058[_0xc34d('0x58')][_0xc34d('0x55')][_0xc34d('0x59')]+':'+_0x15e058[_0xc34d('0x58')]['connection']['remotePort'];_0x15e058['connectedAt']=new Date();_0x15e058['log']=function(_0x36728e){console[_0xc34d('0x54')](_0xc34d('0x5a')+_0x15e058[_0xc34d('0x5b')][_0xc34d('0x3')]+'['+_0x15e058[_0xc34d('0x57')]+']',_0x36728e);};_0x15e058['on'](_0xc34d('0x5c'),function(){onDisconnect(_0x15e058,_0x3997f9);_0x15e058[_0xc34d('0x54')](_0xc34d('0x5d'));});onConnect(_0x15e058);_0x15e058['log'](_0xc34d('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 065ac90..ed627a1 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 _0x3011=['SIP/%s','incomingmessage','outgoingmessage','opened','closed','format','default','length','model','hook','toLowerCase','condition','../../mysqldb','http','Chat','ChatInteraction','afterCreate','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','afterUpdate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','channel','event','direction','UserId','User','find','name','interface'];(function(_0x2c092d,_0x157888){var _0x337d8f=function(_0x3a0b56){while(--_0x3a0b56){_0x2c092d['push'](_0x2c092d['shift']());}};_0x337d8f(++_0x157888);}(_0x3011,0xd8));var _0x1301=function(_0x1cda67,_0x1f5858){_0x1cda67=_0x1cda67-0x0;var _0x1c7f49=_0x3011[_0x1cda67];return _0x1c7f49;};'use strict';var util=require('util');var db=require(_0x1301('0x0'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')('triggers');var client=jayson['client'][_0x1301('0x1')]({'port':0x232a});var triggers=[{'channel':_0x1301('0x2'),'model':_0x1301('0x3'),'event':_0x1301('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1301('0x2'),'model':_0x1301('0x3'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1301('0x2'),'model':_0x1301('0x5'),'event':'afterCreate','condition':_0x1301('0x6'),'callback':afterCreateMessage},{'channel':_0x1301('0x7'),'model':_0x1301('0x8'),'event':'afterCreate','condition':_0x1301('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0x1301('0x8'),'event':_0x1301('0xa'),'condition':_0x1301('0xb'),'callback':afterUpdate},{'channel':_0x1301('0x7'),'model':_0x1301('0xc'),'event':_0x1301('0x4'),'condition':_0x1301('0x6'),'callback':afterCreateMessage},{'channel':_0x1301('0xd'),'model':'WhatsappInteraction','event':_0x1301('0x4'),'condition':_0x1301('0x9'),'callback':afterCreate},{'channel':_0x1301('0xd'),'model':_0x1301('0xe'),'event':'afterUpdate','condition':_0x1301('0xb'),'callback':afterUpdate},{'channel':_0x1301('0xd'),'model':_0x1301('0xf'),'event':_0x1301('0x4'),'condition':_0x1301('0x6'),'callback':afterCreateMessage},{'channel':_0x1301('0x10'),'model':_0x1301('0x11'),'event':_0x1301('0x4'),'condition':_0x1301('0x9'),'callback':afterCreate},{'channel':_0x1301('0x10'),'model':_0x1301('0x11'),'event':_0x1301('0xa'),'condition':_0x1301('0xb'),'callback':afterUpdate},{'channel':_0x1301('0x10'),'model':'FaxMessage','event':_0x1301('0x4'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1301('0x12'),'model':_0x1301('0x13'),'event':_0x1301('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x1301('0x13'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1301('0x12'),'model':'MailMessage','event':_0x1301('0x4'),'condition':_0x1301('0x6'),'callback':afterCreateMessage},{'channel':_0x1301('0x14'),'model':_0x1301('0x15'),'event':_0x1301('0x4'),'condition':_0x1301('0x9'),'callback':afterCreate},{'channel':_0x1301('0x14'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x1301('0xb'),'callback':afterUpdate},{'channel':_0x1301('0x14'),'model':_0x1301('0x16'),'event':_0x1301('0x4'),'condition':_0x1301('0x6'),'callback':afterCreateMessage}];function request(_0x327c31){return client[_0x1301('0x17')](_0x1301('0x18'),_0x327c31)[_0x1301('0x19')](function(_0x498dcb){logger[_0x1301('0x1a')](_0x1301('0x1b'),_0x1301('0x18'),_0x498dcb);if(_0x498dcb[_0x1301('0x1c')]){if(_0x498dcb[_0x1301('0x1c')]['code']===0x1f4){logger['error'](_0x1301('0x1b'),_0x1301('0x18'),_0x498dcb[_0x1301('0x1c')]);}}})[_0x1301('0x1d')](function(_0x352506){logger[_0x1301('0x1c')](_0x1301('0x1b'),_0x1301('0x18'),_0x352506);});}function afterCreateMessage(_0x5b55d2,_0x464caa){return function(_0x5e1be8,_0x72efd6){_0x5e1be8=_0x5e1be8[_0x1301('0x1e')]({'plain':!![]});_0x5e1be8[_0x1301('0x1f')]=_0x5b55d2;_0x5e1be8[_0x1301('0x20')]=_0x5e1be8[_0x1301('0x21')];if(_0x5e1be8[_0x1301('0x22')]){return db[_0x1301('0x23')][_0x1301('0x24')]({'where':{'id':_0x5e1be8[_0x1301('0x22')]},'attributes':['id',_0x1301('0x25')],'raw':!![]})['then'](function(_0x14712c){_0x5e1be8[_0x1301('0x26')]=util['format'](_0x1301('0x27'),_0x14712c[_0x1301('0x25')]);_0x5e1be8['channel']=_0x5b55d2;return request({'event':_0x1301('0x28'),'message':_0x5e1be8});})[_0x1301('0x1d')](function(_0x59c65f){console[_0x1301('0x1c')](_0x59c65f);});}else{return request({'event':_0x1301('0x29'),'message':_0x5e1be8});}};}function afterCreate(_0x4847cc,_0x5a6cfc){return function(_0x3c8d2f,_0x5cf391){_0x3c8d2f=_0x3c8d2f[_0x1301('0x1e')]({'plain':!![]});_0x3c8d2f[_0x1301('0x1f')]=_0x4847cc;_0x3c8d2f[_0x1301('0x20')]=_0x1301('0x2a');return request({'event':_0x5a6cfc,'message':_0x3c8d2f});};}function afterUpdate(_0x2f26db,_0x3329f5){return function(_0x5cb43a,_0x2ea097){if(_0x5cb43a['changed'](_0x1301('0x2b'))&&_0x5cb43a[_0x1301('0x2b')]){_0x5cb43a=_0x5cb43a['get']({'plain':!![]});_0x5cb43a[_0x1301('0x1f')]=_0x2f26db;_0x5cb43a[_0x1301('0x20')]=_0x1301('0x2b');if(_0x5cb43a[_0x1301('0x22')]){return db[_0x1301('0x23')]['find']({'where':{'id':_0x5cb43a[_0x1301('0x22')]},'attributes':['id',_0x1301('0x25')],'raw':!![]})[_0x1301('0x19')](function(_0x2cd3f7){_0x5cb43a[_0x1301('0x26')]=util[_0x1301('0x2c')](_0x1301('0x27'),_0x2cd3f7[_0x1301('0x25')]);return request({'event':_0x3329f5,'message':_0x5cb43a});})[_0x1301('0x1d')](function(_0xaf37d9){console[_0x1301('0x1c')](_0xaf37d9);});}else{return request({'event':_0x3329f5,'message':_0x5cb43a});}}};}exports[_0x1301('0x2d')]=function(){for(var _0x3c10dd=0x0;_0x3c10dd=_0x242e30[_0xde41('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x54752e(_0x49dd2d);})[_0xde41('0x12')](function(_0x5198be){_0x591d0f(_0x5198be);});});}; \ No newline at end of file +var _0x6d93=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','chat','sms','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','getLicense','agent','User'];(function(_0x54942b,_0x21e4a3){var _0xa3f376=function(_0x3e8937){while(--_0x3e8937){_0x54942b['push'](_0x54942b['shift']());}};_0xa3f376(++_0x21e4a3);}(_0x6d93,0x6e));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36d9('0x0'));var BPromise=require('bluebird');var db=require(_0x36d9('0x1'))['db'];var util=require(_0x36d9('0x2'));var channels=[_0x36d9('0x3'),'mail',_0x36d9('0x4'),'fax',_0x36d9('0x5'),'whatsapp',_0x36d9('0x6')];exports[_0x36d9('0x7')]=function(){return channels;};exports[_0x36d9('0x8')]=function(_0x5f1e06){_0x5f1e06=_0x5f1e06['toLowerCase']();return _[_0x36d9('0x9')](channels,_0x5f1e06);};exports[_0x36d9('0xa')]=function(_0x1c0d4b,_0x38cad8,_0x4142bd,_0x5b95ed){var _0xf7c9aa={'loginAttempts':_0x38cad8,'blocked':_0x4142bd};if(!_[_0x36d9('0xb')](_0x5b95ed)){_0xf7c9aa[_0x36d9('0xc')]=_0x5b95ed;}return _0x1c0d4b['updateAttributes'](_0xf7c9aa);};exports[_0x36d9('0xd')]=function(_0x243262){return new BPromise(function(_0x45bf72,_0x55e343){var _0x59a20d=0x0;if(_0x243262['role']!==_0x36d9('0xe')){_0x45bf72(_0x243262);}db[_0x36d9('0xf')][_0x36d9('0x10')]({'where':{'role':_0x36d9('0xe'),'online':!![],'id':{'$ne':_0x243262['id']}}})[_0x36d9('0x11')](function(_0x1199b3){_0x59a20d=_0x1199b3;return util[_0x36d9('0xd')]();})[_0x36d9('0x11')](function(_0x33d3bb){if(_0x33d3bb&&_0x33d3bb[_0x36d9('0x12')]&&_0x59a20d>=_0x33d3bb[_0x36d9('0x12')]){throw Error(_0x36d9('0x13'));}_0x45bf72(_0x243262);})[_0x36d9('0x14')](function(_0x4ce31f){_0x55e343(_0x4ce31f);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 78603d7..eb330fa 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa74=['status','render','send','404'];(function(_0x437abe,_0x3e33a8){var _0x51189b=function(_0x325a20){while(--_0x325a20){_0x437abe['push'](_0x437abe['shift']());}};_0x51189b(++_0x3e33a8);}(_0xfa74,0xa3));var _0x4fa7=function(_0x1fe355,_0xe414c){_0x1fe355=_0x1fe355-0x0;var _0x325d30=_0xfa74[_0x1fe355];return _0x325d30;};'use strict';module['exports'][0x194]=function pageNotFound(_0x451354,_0x51db36){var _0x1d0145=_0x4fa7('0x0');var _0x67c0f1=0x194;var _0x2c8185={'status':_0x67c0f1};_0x51db36['status'](_0x2c8185[_0x4fa7('0x1')]);_0x51db36[_0x4fa7('0x2')](_0x1d0145,{},function(_0x1afb7c,_0x3e41b0){if(_0x1afb7c){return _0x51db36[_0x4fa7('0x1')](_0x2c8185[_0x4fa7('0x1')])['json'](_0x2c8185);}_0x51db36[_0x4fa7('0x3')](_0x3e41b0);});}; \ No newline at end of file +var _0xf802=['404','status','json','send','exports'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xf802,0xea));var _0x2f80=function(_0x5872f5,_0x291f13){_0x5872f5=_0x5872f5-0x0;var _0x41790c=_0xf802[_0x5872f5];return _0x41790c;};'use strict';module[_0x2f80('0x0')][0x194]=function pageNotFound(_0x17c6bc,_0x47423f){var _0x10a43a=_0x2f80('0x1');var _0xe56cf5=0x194;var _0x3cfb73={'status':_0xe56cf5};_0x47423f[_0x2f80('0x2')](_0x3cfb73[_0x2f80('0x2')]);_0x47423f['render'](_0x10a43a,{},function(_0x8dc864,_0xcb764e){if(_0x8dc864){return _0x47423f['status'](_0x3cfb73[_0x2f80('0x2')])[_0x2f80('0x3')](_0x3cfb73);}_0x47423f[_0x2f80('0x4')](_0xcb764e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index cca5df8..9c3f8b9 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0e=['VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../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','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','Extensions','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueue','ChatQueues','FaxQueues','UserFaxQueue','UserSmsQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SquareProject','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','Members','VoiceQueueId','HopperFinals','JscriptySessions','belongsTo','TrunkId','Trunk','TrunkBackupId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','Contact','ContactId','MailAccountId','Smtp','Dispositions','Answers','Interactions','List','Template','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','restrict','MailQueueReport','ListId','Dashboard','Items','FaxAccountId','FaxApplication','Exntensions','TagId','FaxMessage','fax_interaction_has_tags','Users','FaxInteractionId','AttachmentId','SmsAccount','IntervalId','SmsInteractionId','SmsAccountId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueue','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','Queue','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatOfflineMessage','ChatQueue','team_has_chat_queues','ChatGroupId','chat_group_has_users','ChatProactiveAction','CompanyId','CmHopper','Hoppers','HopperHistories','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','Automation','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','Configurations','Subjects','SubjectId','Descriptions','AccountId','Subject','Description','DescriptionId','FieldId','VariableId','SugarcrmAccount','Field','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ChatQueueReport','ToId','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','VoiceQueues','MailQueues','SmsQueues','OpenchannelQueues','HopperBlacks','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappMessage','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','database','password','options','username','../api/user/user.model','VoiceChanSpy','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3b7e28,_0x55e387){_0x3b7e28=_0x3b7e28-0x0;var _0x34ebc8=_0x8d0e[_0x3b7e28];return _0x34ebc8;};'use strict';var path=require(_0xe8d0('0x0'));var config=require(_0xe8d0('0x1'));var Sequelize=require(_0xe8d0('0x2'));var _=require(_0xe8d0('0x3'));var jstz=require(_0xe8d0('0x4'));var timezone=jstz[_0xe8d0('0x5')]();config[_0xe8d0('0x2')]=_[_0xe8d0('0x6')](config[_0xe8d0('0x2')],{'database':'motion2','username':_0xe8d0('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe8d0('0x8'),'dialectOptions':{'charset':_0xe8d0('0x9')},'logging':![],'timezone':timezone[_0xe8d0('0xa')](),'define':{'charset':_0xe8d0('0xb'),'collate':_0xe8d0('0xc')}}});config[_0xe8d0('0xd')]=_[_0xe8d0('0x6')](config[_0xe8d0('0xd')],{'database':'motion2','username':_0xe8d0('0x7'),'password':_0xe8d0('0xe'),'options':{'host':_0xe8d0('0xf'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe8d0('0xa')](),'define':{'charset':_0xe8d0('0xb'),'collate':_0xe8d0('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe8d0('0x2')][_0xe8d0('0x10')],config[_0xe8d0('0x2')]['username'],config[_0xe8d0('0x2')][_0xe8d0('0x11')],config['sequelize'][_0xe8d0('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0xe8d0('0xd')][_0xe8d0('0x13')],config[_0xe8d0('0xd')][_0xe8d0('0x11')],config[_0xe8d0('0xd')][_0xe8d0('0x12')])};db['User']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x14'));db[_0xe8d0('0x15')]=db[_0xe8d0('0x2')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x17'));db[_0xe8d0('0x18')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x19'));db[_0xe8d0('0x1a')]=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xe8d0('0x1b')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x1c'));db[_0xe8d0('0x1d')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x1e'));db[_0xe8d0('0x1f')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x20'));db['VoiceMail']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x21'));db[_0xe8d0('0x22')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x23'));db[_0xe8d0('0x24')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x25'));db['VoiceDialReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x26'));db['VoiceAgentReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xe8d0('0x27')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x28'));db[_0xe8d0('0x29')]=db['sequelize'][_0xe8d0('0x16')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x2a'));db[_0xe8d0('0x2b')]=db['sequelize']['import'](_0xe8d0('0x2c'));db['UserVoiceQueueRt']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x2d'));db[_0xe8d0('0x2e')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x2f'));db[_0xe8d0('0x30')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/userChatQueue/userChatQueue.model');db[_0xe8d0('0x31')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x32'));db['UserFaxQueue']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x33'));db['UserSmsQueue']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x34'));db[_0xe8d0('0x35')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x36'));db[_0xe8d0('0x37')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x38'));db[_0xe8d0('0x39')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/mailServerIn/mailServerIn.model');db[_0xe8d0('0x3a')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x3b'));db[_0xe8d0('0x3c')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x3d'));db['MailQueue']=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x3e'));db[_0xe8d0('0x3f')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe8d0('0x40')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x41'));db[_0xe8d0('0x42')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x43'));db[_0xe8d0('0x44')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize']['import'](_0xe8d0('0x45'));db['Dashboard']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x46'));db[_0xe8d0('0x47')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x48'));db[_0xe8d0('0x49')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x4a'));db['FaxApplication']=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x4b'));db[_0xe8d0('0x4c')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x4d'));db['FaxMessage']=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/faxMessage/faxMessage.model');db[_0xe8d0('0x4e')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x4f'));db[_0xe8d0('0x50')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x51'));db['SmsAccount']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x52'));db[_0xe8d0('0x53')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x54'));db[_0xe8d0('0x55')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x56'));db[_0xe8d0('0x57')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x58'));db[_0xe8d0('0x59')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x5a'));db[_0xe8d0('0x5b')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x5c'));db[_0xe8d0('0x5d')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x5e'));db['OpenchannelInteraction']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x5f'));db[_0xe8d0('0x60')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x61'));db['OpenchannelQueue']=db[_0xe8d0('0x2')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xe8d0('0x62')]=db['sequelize'][_0xe8d0('0x16')]('../api/chatWebsite/chatWebsite.model');db[_0xe8d0('0x63')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x64'));db['ChatApplication']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x65'));db[_0xe8d0('0x66')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x67'));db[_0xe8d0('0x68')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x69'));db['ChatOfflineMessage']=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x6a'));db['ChatQueue']=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/chatQueue/chatQueue.model');db[_0xe8d0('0x6b')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x6c'));db['ChatProactiveAction']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x6d'));db[_0xe8d0('0x6e')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x6f'));db[_0xe8d0('0x70')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x71'));db['CmHopper']=db['sequelize'][_0xe8d0('0x16')]('../api/cmHopper/cmHopper.model');db[_0xe8d0('0x72')]=db[_0xe8d0('0x2')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xe8d0('0x73')]=db['sequelize'][_0xe8d0('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xe8d0('0x74')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xe8d0('0x75')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x76'));db['CmCustomField']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x77'));db[_0xe8d0('0x78')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x79'));db['Automation']=db['sequelize'][_0xe8d0('0x16')]('../api/automation/automation.model');db[_0xe8d0('0x7a')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x7b'));db[_0xe8d0('0x7c')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x7d'));db[_0xe8d0('0x7e')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x7f'));db[_0xe8d0('0x80')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/interval/interval.model');db[_0xe8d0('0x81')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x82'));db[_0xe8d0('0x83')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x84'));db[_0xe8d0('0x85')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x86'));db[_0xe8d0('0x87')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x88'));db[_0xe8d0('0x89')]=db[_0xe8d0('0x2')]['import']('../api/sound/sound.model');db[_0xe8d0('0x8a')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x8b'));db['Template']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x8c'));db[_0xe8d0('0x8d')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x8e'));db[_0xe8d0('0x8f')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x90'));db[_0xe8d0('0x91')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x92'));db[_0xe8d0('0x93')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x94'));db['AnalyticCustomReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x95'));db['AnalyticDefaultReport']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x96'));db[_0xe8d0('0x97')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x98'));db[_0xe8d0('0x99')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x9a'));db['AnalyticFieldReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x9b'));db[_0xe8d0('0x9c')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x9d'));db[_0xe8d0('0x9e')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x9f'));db[_0xe8d0('0xa0')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xa1'));db[_0xe8d0('0xa2')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xa3'));db['SugarcrmAccount']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xa4'));db[_0xe8d0('0xa5')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xa6'));db[_0xe8d0('0xa7')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xa8'));db[_0xe8d0('0xa9')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/intDeskAccount/intDeskAccount.model');db[_0xe8d0('0xaa')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xab'));db[_0xe8d0('0xac')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xad'));db[_0xe8d0('0xae')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xaf'));db[_0xe8d0('0xb0')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xb1'));db['ZohoField']=db['sequelize'][_0xe8d0('0x16')]('../api/intZohoField/intZohoField.model');db[_0xe8d0('0xb2')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe8d0('0xb3')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xb4'));db[_0xe8d0('0xb5')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xb6'));db[_0xe8d0('0xb7')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xb8'));db[_0xe8d0('0xb9')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xba'));db[_0xe8d0('0xbb')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xbc'));db[_0xe8d0('0xbd')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xbe'));db[_0xe8d0('0xbf')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xe8d0('0xc0')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xc1'));db[_0xe8d0('0xc2')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xc3'));db[_0xe8d0('0xc4')]=db['sequelize']['import'](_0xe8d0('0xc5'));db[_0xe8d0('0xc6')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xc7'));db[_0xe8d0('0xc8')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xc9'));db[_0xe8d0('0xca')]=db[_0xe8d0('0x2')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xe8d0('0xcb')]=db[_0xe8d0('0x2')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xe8d0('0xcc')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xe8d0('0x91')]=db['sequelize']['import'](_0xe8d0('0x92'));db[_0xe8d0('0xcd')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xce'));db['ChatQueueReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/chatQueueReport/chatQueueReport.model');db[_0xe8d0('0xcf')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xd0'));db['JscriptyAnswerReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xd1'));db[_0xe8d0('0xd2')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xd3'));db[_0xe8d0('0xd4')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xd5'));db['SmsQueueReport']=db['sequelize']['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xe8d0('0xd6')]=db['sequelize']['import'](_0xe8d0('0xd7'));db['SquareDetailsReport']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xd8'));db[_0xe8d0('0xd9')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xda'));db[_0xe8d0('0xdb')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xdc'));db[_0xe8d0('0xdd')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xde'));db['SquareProject']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xdf'));db[_0xe8d0('0xe0')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xe1'));db[_0xe8d0('0xe2')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/squareMessage/squareMessage.model');db[_0xe8d0('0xe3')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xe4'));db[_0xe8d0('0xe5')]=db['sequelize']['import'](_0xe8d0('0xe6'));db[_0xe8d0('0xe7')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xe8'));db[_0xe8d0('0xe9')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xea'));db[_0xe8d0('0xeb')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xec'));db['Plugin']=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xed'));db[_0xe8d0('0xee')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xef'));db[_0xe8d0('0xf0')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xf1'));db[_0xe8d0('0xf2')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0xf3'));db[_0xe8d0('0xf4')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xf5'));db['CmList']=db['sequelize'][_0xe8d0('0x16')]('../api/cmList/cmList.model');db[_0xe8d0('0xf6')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xf7'));db[_0xe8d0('0xf8')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xf9'));db['UserProfileSection']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0xfa'));db['UserProfileResource']=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0xfb'));db[_0xe8d0('0xfc')]=db['sequelize'][_0xe8d0('0x16')]('../api/notification/notification.model');db[_0xe8d0('0xfd')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xe8d0('0xfe')]=db['sequelize'][_0xe8d0('0x16')]('../api/whatsappApplication/whatsappApplication.model');db[_0xe8d0('0xff')]=db['sequelize']['import'](_0xe8d0('0x100'));db['WhatsappMessage']=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x101'));db[_0xe8d0('0x102')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x103'));db[_0xe8d0('0x104')]=db['sequelize'][_0xe8d0('0x16')](_0xe8d0('0x105'));db[_0xe8d0('0x106')]=db[_0xe8d0('0x2')]['import'](_0xe8d0('0x107'));db[_0xe8d0('0x108')]=db[_0xe8d0('0x2')][_0xe8d0('0x16')](_0xe8d0('0x109'));db[_0xe8d0('0x10a')][_0xe8d0('0x10b')](db['VoiceMail'],{'as':_0xe8d0('0x10c'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0x1d')],{'as':_0xe8d0('0x110'),'foreignKey':_0xe8d0('0x10e')});db['User'][_0xe8d0('0x10f')](db[_0xe8d0('0x111')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User'][_0xe8d0('0x10f')](db[_0xe8d0('0x18')],{'as':_0xe8d0('0x112'),'onDelete':_0xe8d0('0x10d'),'hooks':!![]});db['User'][_0xe8d0('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe8d0('0x10e')});db['User']['hasMany'](db[_0xe8d0('0x74')],{'as':'HopperHistory','foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')]['hasMany'](db[_0xe8d0('0x75')],{'as':_0xe8d0('0x75'),'foreignKey':'UserId'});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0x113')],{'as':_0xe8d0('0x114'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0x66')],{'as':_0xe8d0('0x115'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0x55')],{'as':'SmsInteractions','foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0x4c')],{'as':_0xe8d0('0x116'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0x40')],{'as':_0xe8d0('0x117'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0xff')],{'as':_0xe8d0('0x118'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x10a')][_0xe8d0('0x10f')](db[_0xe8d0('0xfc')],{'as':'Notifications','foreignKey':_0xe8d0('0x119')});db[_0xe8d0('0x10a')]['belongsTo'](db['UserProfile'],{'as':_0xe8d0('0xf8'),'foreignKey':'userProfileId'});db['User'][_0xe8d0('0x11a')](db[_0xe8d0('0x6b')],{'as':'Groups','through':'chat_group_has_users'});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db['CmContact'],{'as':_0xe8d0('0x11b'),'through':_0xe8d0('0x11c')});db['User']['belongsToMany'](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x11e'),'through':_0xe8d0('0x11f')});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db['Team'],{'through':_0xe8d0('0x120')});db[_0xe8d0('0x10a')]['belongsToMany'](db['MailInteraction'],{'as':_0xe8d0('0x117'),'through':_0xe8d0('0x121')});db['User'][_0xe8d0('0x11a')](db[_0xe8d0('0x66')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xe8d0('0x10a')]['belongsToMany'](db[_0xe8d0('0x4c')],{'as':_0xe8d0('0x116'),'through':_0xe8d0('0x122')});db[_0xe8d0('0x10a')]['belongsToMany'](db[_0xe8d0('0x55')],{'as':_0xe8d0('0x123'),'through':_0xe8d0('0x124')});db['User']['belongsToMany'](db[_0xe8d0('0x113')],{'as':_0xe8d0('0x114'),'through':_0xe8d0('0x125')});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db[_0xe8d0('0xff')],{'as':'WhatsappInteractions','through':_0xe8d0('0x126')});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db[_0xe8d0('0x1b')],{'as':'VoiceQueues','through':_0xe8d0('0x2e'),'required':![]});db[_0xe8d0('0x10a')]['belongsToMany'](db[_0xe8d0('0x127')],{'as':'MailQueues','through':_0xe8d0('0x31'),'required':![]});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db['ChatQueue'],{'as':_0xe8d0('0x128'),'through':_0xe8d0('0x30'),'required':![],'hooks':!![]});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db['FaxQueue'],{'as':_0xe8d0('0x129'),'through':_0xe8d0('0x12a'),'required':![]});db[_0xe8d0('0x10a')]['belongsToMany'](db[_0xe8d0('0x59')],{'as':'SmsQueues','through':_0xe8d0('0x12b'),'required':![]});db['User'][_0xe8d0('0x11a')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db[_0xe8d0('0x106')],{'as':_0xe8d0('0x12c'),'through':_0xe8d0('0x37'),'required':![]});db['User'][_0xe8d0('0x11a')](db[_0xe8d0('0x11d')],{'through':_0xe8d0('0x11f')});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db[_0xe8d0('0xf6')],{'as':_0xe8d0('0x12d'),'through':_0xe8d0('0x12e'),'required':![]});db[_0xe8d0('0x10a')]['belongsToMany'](db[_0xe8d0('0x62')],{'as':'ChatWebsites','through':_0xe8d0('0x12f')});db['User'][_0xe8d0('0x11a')](db[_0xe8d0('0x49')],{'as':_0xe8d0('0x130'),'through':_0xe8d0('0x131')});db[_0xe8d0('0x10a')]['belongsToMany'](db[_0xe8d0('0x3c')],{'as':_0xe8d0('0x132'),'through':_0xe8d0('0x133')});db['User'][_0xe8d0('0x11a')](db[_0xe8d0('0x5b')],{'as':_0xe8d0('0x134'),'through':_0xe8d0('0x135')});db[_0xe8d0('0x10a')]['belongsToMany'](db['SmsAccount'],{'as':_0xe8d0('0x136'),'through':'user_has_sms_accounts'});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db[_0xe8d0('0xfd')],{'as':_0xe8d0('0x137'),'through':'user_has_whatsapp_accounts'});db[_0xe8d0('0x10a')][_0xe8d0('0x11a')](db[_0xe8d0('0x138')],{'as':'SquareProjects','through':_0xe8d0('0x139')});db['VoiceChanSpy'][_0xe8d0('0x10f')](db[_0xe8d0('0x18')],{'as':_0xe8d0('0x13a'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x13b')});db[_0xe8d0('0x13c')][_0xe8d0('0x10f')](db[_0xe8d0('0x18')],{'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x18')]['hasMany'](db[_0xe8d0('0x18')],{'as':_0xe8d0('0x13d'),'onDelete':_0xe8d0('0x10d')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xe8d0('0x89')],{'as':_0xe8d0('0x13e'),'through':'moh_has_sounds'});db[_0xe8d0('0x1b')]['hasMany'](db[_0xe8d0('0x111')],{'as':_0xe8d0('0x13f'),'foreignKey':_0xe8d0('0x140')});db[_0xe8d0('0x1b')][_0xe8d0('0x10f')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xe8d0('0x140')});db[_0xe8d0('0x1b')][_0xe8d0('0x10f')](db[_0xe8d0('0x73')],{'as':_0xe8d0('0x141'),'foreignKey':'VoiceQueueId'});db[_0xe8d0('0x1b')][_0xe8d0('0x10f')](db[_0xe8d0('0x74')],{'as':'HopperHistories','foreignKey':_0xe8d0('0x140')});db['VoiceQueue'][_0xe8d0('0x10f')](db['ReportAgentPreview'],{'as':_0xe8d0('0x75'),'foreignKey':'VoiceQueueId'});db[_0xe8d0('0x1b')][_0xe8d0('0x10f')](db[_0xe8d0('0x72')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0xe8d0('0x1b')][_0xe8d0('0x10f')](db[_0xe8d0('0xd4')],{'as':_0xe8d0('0x142'),'foreignKey':_0xe8d0('0x140')});db[_0xe8d0('0x1b')][_0xe8d0('0x143')](db['Trunk'],{'as':'Trunk','foreignKey':_0xe8d0('0x144')});db[_0xe8d0('0x1b')]['belongsTo'](db[_0xe8d0('0x145')],{'as':'TrunkBackup','foreignKey':_0xe8d0('0x146')});db['VoiceQueue']['belongsTo'](db[_0xe8d0('0x80')],{'as':_0xe8d0('0x80'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0xe8d0('0x143')](db['Pause'],{'as':_0xe8d0('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe8d0('0x1b')][_0xe8d0('0x11a')](db[_0xe8d0('0x11d')],{'as':'Lists','through':_0xe8d0('0x148')});db[_0xe8d0('0x1b')]['belongsToMany'](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x2e')});db[_0xe8d0('0x1b')][_0xe8d0('0x11a')](db[_0xe8d0('0xe3')],{'as':_0xe8d0('0x14a'),'through':_0xe8d0('0x14b')});db[_0xe8d0('0x1b')]['belongsToMany'](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x14c'),'through':_0xe8d0('0x14d')});db['VoiceRecording'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':'User','foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x1f')][_0xe8d0('0x143')](db['User'],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0xe8d0('0x10f')](db['VoiceMailMessage'],{'as':_0xe8d0('0x14e'),'onDelete':'cascade','foreignKey':_0xe8d0('0x14f'),'sourceKey':'mailbox'});db[_0xe8d0('0x22')]['belongsTo'](db[_0xe8d0('0x10c')],{'foreignKey':_0xe8d0('0x14f'),'targetKey':_0xe8d0('0x150')});db[_0xe8d0('0x24')][_0xe8d0('0x10f')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0xe8d0('0x151'),'constraints':![]});db[_0xe8d0('0x24')]['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0xe8d0('0x151'),'constraints':![]});db[_0xe8d0('0x24')]['belongsTo'](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x10a'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x24')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x39')]['belongsTo'](db[_0xe8d0('0x3c')],{'as':'MailAccount','foreignKey':_0xe8d0('0x154')});db[_0xe8d0('0x3a')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xe8d0('0x154')});db['MailAccount'][_0xe8d0('0x10b')](db[_0xe8d0('0x39')],{'as':'Imap','onDelete':'cascade'});db[_0xe8d0('0x3c')]['hasOne'](db[_0xe8d0('0x3a')],{'as':_0xe8d0('0x155'),'onDelete':'cascade'});db[_0xe8d0('0x3c')]['hasMany'](db[_0xe8d0('0x7c')],{'as':_0xe8d0('0x156'),'foreignKey':_0xe8d0('0x154')});db['MailAccount'][_0xe8d0('0x10f')](db[_0xe8d0('0x7a')],{'as':_0xe8d0('0x157'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xe8d0('0x10f')](db['MailMessage'],{'as':_0xe8d0('0x14e'),'foreignKey':_0xe8d0('0x154')});db[_0xe8d0('0x3c')][_0xe8d0('0x10f')](db['MailInteraction'],{'as':_0xe8d0('0x158')});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0xe8d0('0x13d')});db[_0xe8d0('0x3c')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':'ListId'});db[_0xe8d0('0x3c')]['belongsTo'](db['Template'],{'as':_0xe8d0('0x15a'),'foreignKey':_0xe8d0('0x15b')});db[_0xe8d0('0x3c')]['belongsTo'](db[_0xe8d0('0x81')],{'as':_0xe8d0('0x147'),'foreignKey':_0xe8d0('0x15c')});db[_0xe8d0('0x3c')][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x133')});db[_0xe8d0('0x127')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x31')});db[_0xe8d0('0x127')][_0xe8d0('0x11a')](db[_0xe8d0('0xe3')],{'through':_0xe8d0('0x15d'),'as':'Teams'});db[_0xe8d0('0x40')]['hasMany'](db['MailMessage'],{'as':_0xe8d0('0x14e'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x15e')});db['MailInteraction'][_0xe8d0('0x143')](db[_0xe8d0('0x3c')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x154')});db[_0xe8d0('0x40')][_0xe8d0('0x143')](db['CmContact'],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x40')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x160'),'foreignKey':'UserId'});db['MailInteraction'][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x161'),'as':_0xe8d0('0x162')});db[_0xe8d0('0x40')][_0xe8d0('0x11a')](db['Tag'],{'through':_0xe8d0('0x161'),'as':_0xe8d0('0x163')});db[_0xe8d0('0x40')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':'Users','through':_0xe8d0('0x121'),'foreignKey':_0xe8d0('0x15e')});db[_0xe8d0('0x42')]['hasMany'](db[_0xe8d0('0xeb')],{'as':_0xe8d0('0x164'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x42')]['belongsTo'](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x10a')});db[_0xe8d0('0x42')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'onDelete':'cascade','as':_0xe8d0('0x152')});db[_0xe8d0('0x42')][_0xe8d0('0x143')](db[_0xe8d0('0x40')],{'as':_0xe8d0('0x165'),'foreignKey':_0xe8d0('0x15e')});db[_0xe8d0('0x42')]['belongsTo'](db[_0xe8d0('0x3c')],{'as':'Account','foreignKey':_0xe8d0('0x154')});db[_0xe8d0('0x44')][_0xe8d0('0x143')](db['User'],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x44')]['belongsTo'](db[_0xe8d0('0x127')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x44')][_0xe8d0('0x143')](db[_0xe8d0('0x3c')],{'onDelete':'restrict'});db[_0xe8d0('0x44')][_0xe8d0('0x143')](db['Interval'],{'onDelete':_0xe8d0('0x166'),'foreignKey':'IntervalId'});db['MailApplication'][_0xe8d0('0x143')](db[_0xe8d0('0x8a')],{'onDelete':_0xe8d0('0x166'),'foreignKey':'TagId'});db[_0xe8d0('0x167')][_0xe8d0('0x143')](db['MailAccount'],{});db[_0xe8d0('0x167')]['belongsTo'](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':_0xe8d0('0x168')});db['MailQueueReport'][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x167')][_0xe8d0('0x143')](db[_0xe8d0('0x40')],{});db[_0xe8d0('0x167')]['belongsTo'](db[_0xe8d0('0x42')],{});db[_0xe8d0('0x167')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{});db[_0xe8d0('0x167')][_0xe8d0('0x143')](db['MailQueue'],{});db[_0xe8d0('0x169')][_0xe8d0('0x10f')](db[_0xe8d0('0x47')],{'as':_0xe8d0('0x16a'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x49')][_0xe8d0('0x10f')](db[_0xe8d0('0x7c')],{'as':_0xe8d0('0x156'),'foreignKey':_0xe8d0('0x16b')});db[_0xe8d0('0x49')]['hasMany'](db[_0xe8d0('0x7a')],{'as':_0xe8d0('0x157'),'foreignKey':_0xe8d0('0x16b')});db[_0xe8d0('0x49')][_0xe8d0('0x10f')](db['FaxInteraction'],{'as':'Interactions'});db[_0xe8d0('0x49')][_0xe8d0('0x10f')](db[_0xe8d0('0x16c')],{'as':'Applications'});db['FaxAccount'][_0xe8d0('0x10f')](db[_0xe8d0('0x18')],{'as':_0xe8d0('0x16d'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x49')][_0xe8d0('0x10f')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount'][_0xe8d0('0x143')](db['Trunk'],{'as':'Trunk'});db['FaxAccount'][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x49')]['belongsTo'](db[_0xe8d0('0x81')],{'as':_0xe8d0('0x147'),'foreignKey':_0xe8d0('0x15c')});db[_0xe8d0('0x49')][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x131')});db['FaxApplication'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':'restrict'});db[_0xe8d0('0x16c')]['belongsTo'](db[_0xe8d0('0x4e')],{'onDelete':'restrict'});db['FaxApplication'][_0xe8d0('0x143')](db[_0xe8d0('0x49')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x16c')][_0xe8d0('0x143')](db[_0xe8d0('0x8a')],{'onDelete':'restrict','foreignKey':_0xe8d0('0x16e')});db[_0xe8d0('0x4c')]['hasMany'](db[_0xe8d0('0x16f')],{'as':_0xe8d0('0x14e'),'onDelete':_0xe8d0('0x10d'),'foreignKey':'FaxInteractionId'});db['FaxInteraction']['belongsTo'](db[_0xe8d0('0x49')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxInteraction'][_0xe8d0('0x143')](db['CmContact'],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x4c')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0xe8d0('0x170'),'as':_0xe8d0('0x162')});db['FaxInteraction'][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x170'),'as':_0xe8d0('0x163')});db['FaxInteraction'][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x171'),'through':'user_has_fax_interactions','foreignKey':_0xe8d0('0x172')});db[_0xe8d0('0x16f')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x10a')});db['FaxMessage'][_0xe8d0('0x143')](db[_0xe8d0('0x4c')],{'as':_0xe8d0('0x165'),'foreignKey':_0xe8d0('0x172')});db[_0xe8d0('0x16f')]['belongsTo'](db['CmContact'],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x152')});db[_0xe8d0('0x16f')][_0xe8d0('0x143')](db['Attachment'],{'as':_0xe8d0('0xeb'),'foreignKey':_0xe8d0('0x173')});db[_0xe8d0('0x16f')][_0xe8d0('0x143')](db[_0xe8d0('0x49')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x16b')});db['FaxQueue']['belongsToMany'](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x12a')});db[_0xe8d0('0x4e')][_0xe8d0('0x11a')](db['Team'],{'through':'team_has_fax_queues','as':_0xe8d0('0x14a')});db[_0xe8d0('0x50')][_0xe8d0('0x143')](db[_0xe8d0('0x49')],{});db['FaxQueueReport'][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':'ListId'});db[_0xe8d0('0x50')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db['FaxQueueReport'][_0xe8d0('0x143')](db[_0xe8d0('0x4c')],{});db[_0xe8d0('0x50')][_0xe8d0('0x143')](db[_0xe8d0('0x16f')],{});db[_0xe8d0('0x50')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{});db[_0xe8d0('0x50')][_0xe8d0('0x143')](db[_0xe8d0('0x4e')],{});db[_0xe8d0('0x174')][_0xe8d0('0x10f')](db[_0xe8d0('0x7c')],{'as':_0xe8d0('0x156'),'foreignKey':'SmsAccountId'});db[_0xe8d0('0x174')][_0xe8d0('0x10f')](db[_0xe8d0('0x7a')],{'as':_0xe8d0('0x157'),'foreignKey':'SmsAccountId'});db[_0xe8d0('0x174')][_0xe8d0('0x10f')](db[_0xe8d0('0x57')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xe8d0('0x174')]['hasMany'](db[_0xe8d0('0x55')],{'as':_0xe8d0('0x158')});db[_0xe8d0('0x174')][_0xe8d0('0x10f')](db[_0xe8d0('0x53')],{'as':'Applications'});db['SmsAccount'][_0xe8d0('0x143')](db['CmList'],{'as':_0xe8d0('0x159'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x174')][_0xe8d0('0x143')](db[_0xe8d0('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x149'),'through':'user_has_sms_accounts'});db[_0xe8d0('0x53')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x53')]['belongsTo'](db[_0xe8d0('0x59')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x53')][_0xe8d0('0x143')](db['SmsAccount'],{'onDelete':_0xe8d0('0x166')});db['SmsApplication'][_0xe8d0('0x143')](db['Interval'],{'onDelete':_0xe8d0('0x166'),'foreignKey':_0xe8d0('0x175')});db['SmsApplication']['belongsTo'](db[_0xe8d0('0x8a')],{'onDelete':_0xe8d0('0x166'),'foreignKey':_0xe8d0('0x16e')});db['SmsInteraction'][_0xe8d0('0x10f')](db[_0xe8d0('0x57')],{'as':_0xe8d0('0x14e'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x176')});db[_0xe8d0('0x55')][_0xe8d0('0x143')](db[_0xe8d0('0x174')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x177')});db['SmsInteraction'][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x160'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x55')][_0xe8d0('0x11a')](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction'][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x178'),'as':_0xe8d0('0x163')});db['SmsInteraction'][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x171'),'through':_0xe8d0('0x124'),'foreignKey':_0xe8d0('0x176')});db[_0xe8d0('0x57')]['belongsTo'](db[_0xe8d0('0x10a')],{'as':'User'});db[_0xe8d0('0x57')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x152')});db[_0xe8d0('0x57')][_0xe8d0('0x143')](db[_0xe8d0('0x55')],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x165'),'foreignKey':_0xe8d0('0x176')});db['SmsMessage'][_0xe8d0('0x143')](db[_0xe8d0('0x174')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x177')});db[_0xe8d0('0x59')][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x12b'),'foreignKey':_0xe8d0('0x179')});db[_0xe8d0('0x59')][_0xe8d0('0x11a')](db['Team'],{'through':_0xe8d0('0x17a'),'as':_0xe8d0('0x14a')});db['OpenchannelAccount'][_0xe8d0('0x10f')](db[_0xe8d0('0x7c')],{'as':_0xe8d0('0x156'),'foreignKey':_0xe8d0('0x17b')});db['OpenchannelAccount'][_0xe8d0('0x10f')](db['CannedAnswer'],{'as':_0xe8d0('0x157'),'foreignKey':_0xe8d0('0x17b')});db['OpenchannelAccount'][_0xe8d0('0x10f')](db['OpenchannelInteraction'],{'as':_0xe8d0('0x158'),'foreignKey':_0xe8d0('0x17b')});db[_0xe8d0('0x5b')]['hasMany'](db[_0xe8d0('0x60')],{'as':_0xe8d0('0x14e'),'foreignKey':_0xe8d0('0x17b')});db['OpenchannelAccount'][_0xe8d0('0x10f')](db[_0xe8d0('0x5d')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0xe8d0('0x5b')][_0xe8d0('0x143')](db['CmList'],{'as':_0xe8d0('0x159'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x5b')][_0xe8d0('0x143')](db['Pause'],{'as':_0xe8d0('0x147'),'foreignKey':_0xe8d0('0x15c')});db[_0xe8d0('0x5b')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x135')});db[_0xe8d0('0x5d')]['belongsTo'](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x5d')][_0xe8d0('0x143')](db[_0xe8d0('0x17c')],{'onDelete':_0xe8d0('0x166'),'foreignKey':_0xe8d0('0x17d')});db[_0xe8d0('0x5d')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0xe8d0('0x166'),'foreignKey':_0xe8d0('0x17b')});db['OpenchannelApplication'][_0xe8d0('0x143')](db[_0xe8d0('0x80')],{'onDelete':_0xe8d0('0x166'),'foreignKey':'IntervalId'});db[_0xe8d0('0x5d')]['belongsTo'](db[_0xe8d0('0x8a')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xe8d0('0x113')][_0xe8d0('0x10f')](db[_0xe8d0('0x60')],{'as':'Messages','onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xe8d0('0x113')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x17b')});db[_0xe8d0('0x113')]['belongsTo'](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db['OpenchannelInteraction'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x160'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x113')]['belongsToMany'](db[_0xe8d0('0x8a')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db['OpenchannelInteraction']['belongsToMany'](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x17e'),'as':_0xe8d0('0x163')});db[_0xe8d0('0x113')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x171'),'through':_0xe8d0('0x125'),'foreignKey':_0xe8d0('0x17f')});db[_0xe8d0('0x60')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x10a')});db[_0xe8d0('0x60')][_0xe8d0('0x143')](db['CmContact'],{'onDelete':'cascade','as':_0xe8d0('0x152')});db[_0xe8d0('0x60')][_0xe8d0('0x143')](db['OpenchannelInteraction'],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x165'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xe8d0('0x143')](db[_0xe8d0('0xeb')],{'as':_0xe8d0('0xeb'),'foreignKey':_0xe8d0('0x173')});db[_0xe8d0('0x60')][_0xe8d0('0x143')](db[_0xe8d0('0x5b')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x17b')});db[_0xe8d0('0x17c')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x35'),'foreignKey':_0xe8d0('0x17d')});db[_0xe8d0('0x17c')][_0xe8d0('0x11a')](db[_0xe8d0('0xe3')],{'through':_0xe8d0('0x180'),'as':_0xe8d0('0x14a')});db['ChatWebsite'][_0xe8d0('0x10f')](db[_0xe8d0('0x7c')],{'as':_0xe8d0('0x156'),'foreignKey':_0xe8d0('0x181')});db[_0xe8d0('0x62')][_0xe8d0('0x10f')](db[_0xe8d0('0x7a')],{'as':_0xe8d0('0x157'),'foreignKey':_0xe8d0('0x181')});db[_0xe8d0('0x62')][_0xe8d0('0x10f')](db['ChatProactiveAction'],{'as':_0xe8d0('0x182')});db[_0xe8d0('0x62')][_0xe8d0('0x10f')](db[_0xe8d0('0x66')],{'as':_0xe8d0('0x158')});db[_0xe8d0('0x62')][_0xe8d0('0x10f')](db[_0xe8d0('0x183')],{'as':_0xe8d0('0x13d')});db[_0xe8d0('0x62')][_0xe8d0('0x10f')](db['ChatMessage'],{'as':_0xe8d0('0x14e')});db[_0xe8d0('0x62')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x62')][_0xe8d0('0x143')](db['Interval'],{'as':_0xe8d0('0x80'),'foreignKey':_0xe8d0('0x175')});db['ChatWebsite']['belongsTo'](db['Pause'],{'as':_0xe8d0('0x147'),'foreignKey':_0xe8d0('0x15c')});db['ChatWebsite'][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':'Agents','through':_0xe8d0('0x12f')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0xe8d0('0x63')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':'List','foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x63')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x63')]['belongsTo'](db[_0xe8d0('0x113')],{});db[_0xe8d0('0x63')][_0xe8d0('0x143')](db['OpenchannelMessage'],{});db[_0xe8d0('0x63')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{});db[_0xe8d0('0x63')][_0xe8d0('0x143')](db[_0xe8d0('0x17c')],{});db[_0xe8d0('0x183')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':'Agent','foreignKey':_0xe8d0('0x10e'),'onDelete':'restrict'});db['ChatApplication'][_0xe8d0('0x143')](db['ChatQueue'],{'as':_0xe8d0('0x184'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0xe8d0('0x143')](db[_0xe8d0('0x62')],{'as':_0xe8d0('0x185'),'foreignKey':_0xe8d0('0x181'),'onDelete':'restrict'});db[_0xe8d0('0x183')][_0xe8d0('0x143')](db[_0xe8d0('0x8a')],{'onDelete':_0xe8d0('0x166'),'foreignKey':'TagId'});db[_0xe8d0('0x66')][_0xe8d0('0x10f')](db[_0xe8d0('0x68')],{'as':_0xe8d0('0x14e'),'onDelete':_0xe8d0('0x10d'),'foreignKey':'ChatInteractionId'});db[_0xe8d0('0x66')][_0xe8d0('0x143')](db[_0xe8d0('0x62')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x181')});db['ChatInteraction'][_0xe8d0('0x143')](db['CmContact'],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db['ChatInteraction'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x160'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x66')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x186'),'as':_0xe8d0('0x162')});db[_0xe8d0('0x66')]['belongsToMany'](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x186'),'as':_0xe8d0('0x163')});db[_0xe8d0('0x66')][_0xe8d0('0x11a')](db['User'],{'as':'Users','through':_0xe8d0('0x187'),'foreignKey':_0xe8d0('0x188')});db[_0xe8d0('0x68')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x10d'),'as':'User'});db[_0xe8d0('0x68')][_0xe8d0('0x143')](db['CmContact'],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x68')][_0xe8d0('0x143')](db[_0xe8d0('0x66')],{'onDelete':_0xe8d0('0x10d'),'as':'Interaction','foreignKey':_0xe8d0('0x188')});db[_0xe8d0('0x68')][_0xe8d0('0x143')](db[_0xe8d0('0xeb')],{'as':'Attachment','foreignKey':_0xe8d0('0x173')});db[_0xe8d0('0x68')][_0xe8d0('0x143')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xe8d0('0x181')});db['ChatOfflineMessage'][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'onDelete':_0xe8d0('0x10d'),'as':'Contact','foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x189')][_0xe8d0('0x143')](db[_0xe8d0('0x62')],{'as':_0xe8d0('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0xe8d0('0x18a')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':_0xe8d0('0x30'),'hooks':!![]});db[_0xe8d0('0x18a')]['belongsToMany'](db[_0xe8d0('0xe3')],{'through':_0xe8d0('0x18b'),'as':_0xe8d0('0x14a')});db[_0xe8d0('0x6b')][_0xe8d0('0x10f')](db[_0xe8d0('0xcf')],{'as':_0xe8d0('0x14e'),'foreignKey':_0xe8d0('0x18c'),'onDelete':'cascade'});db['ChatGroup'][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':'Members','through':_0xe8d0('0x18d')});db[_0xe8d0('0x18e')][_0xe8d0('0x143')](db[_0xe8d0('0x62')],{'as':_0xe8d0('0x185'),'foreignKey':_0xe8d0('0x181')});db[_0xe8d0('0x6e')]['hasMany'](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x11b'),'foreignKey':_0xe8d0('0x18f')});db['CmContact'][_0xe8d0('0x10f')](db[_0xe8d0('0x190')],{'as':_0xe8d0('0x191'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x70')][_0xe8d0('0x10f')](db['CmHopperFinal'],{'as':_0xe8d0('0x141'),'foreignKey':_0xe8d0('0x153')});db['CmContact'][_0xe8d0('0x10f')](db['CmHopperHistory'],{'as':_0xe8d0('0x192'),'foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x70')]['hasMany'](db[_0xe8d0('0x75')],{'as':'ReportAgentPreview','foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x70')][_0xe8d0('0x10f')](db[_0xe8d0('0xd4')],{'as':_0xe8d0('0x142'),'foreignKey':'ContactId'});db['CmContact'][_0xe8d0('0x10f')](db[_0xe8d0('0x113')],{'as':'OpenchannelInteractions','foreignKey':_0xe8d0('0x153'),'onDelete':'restrict'});db[_0xe8d0('0x70')]['hasMany'](db[_0xe8d0('0x66')],{'as':'ChatInteractions','foreignKey':_0xe8d0('0x153'),'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x70')][_0xe8d0('0x10f')](db['SmsInteraction'],{'as':_0xe8d0('0x123'),'foreignKey':_0xe8d0('0x153'),'onDelete':_0xe8d0('0x166')});db['CmContact']['hasMany'](db[_0xe8d0('0x4c')],{'as':_0xe8d0('0x116'),'foreignKey':'ContactId','onDelete':_0xe8d0('0x166')});db[_0xe8d0('0x70')]['hasMany'](db[_0xe8d0('0x40')],{'as':_0xe8d0('0x117'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe8d0('0x70')][_0xe8d0('0x143')](db[_0xe8d0('0x6e')],{'as':_0xe8d0('0x193'),'foreignKey':_0xe8d0('0x18f')});db['CmContact'][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xe8d0('0x70')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x171'),'through':_0xe8d0('0x11c')});db[_0xe8d0('0x70')]['belongsToMany'](db['Tag'],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xe8d0('0x70')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x194'),'as':_0xe8d0('0x163')});db[_0xe8d0('0x190')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x190')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':'ListId','onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x190')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x195'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0x190')]['belongsTo'](db[_0xe8d0('0x1b')],{'as':_0xe8d0('0x184'),'foreignKey':_0xe8d0('0x140'),'onDelete':'cascade'});db[_0xe8d0('0x190')][_0xe8d0('0x143')](db['Campaign'],{'as':_0xe8d0('0xe7'),'foreignKey':_0xe8d0('0x196'),'onDelete':_0xe8d0('0x10d')});db['CmHopper']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xe8d0('0x197')});db[_0xe8d0('0x72')][_0xe8d0('0x143')](db['CmContact'],{'as':_0xe8d0('0x152'),'foreignKey':'ContactId','onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x72')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':_0xe8d0('0x168'),'onDelete':'cascade'});db[_0xe8d0('0x72')][_0xe8d0('0x143')](db[_0xe8d0('0x1b')],{'as':_0xe8d0('0x184'),'foreignKey':_0xe8d0('0x140'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x72')][_0xe8d0('0x143')](db['Campaign'],{'as':_0xe8d0('0xe7'),'foreignKey':_0xe8d0('0x196'),'onDelete':_0xe8d0('0x10d')});db['Automation'][_0xe8d0('0x10f')](db[_0xe8d0('0x7e')],{'as':{'plural':_0xe8d0('0x198'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xe8d0('0x10d'),'hooks':!![]});db[_0xe8d0('0x199')]['hasMany'](db['Condition'],{'as':{'plural':_0xe8d0('0x19a'),'singular':_0xe8d0('0x19b')},'foreignKey':_0xe8d0('0x19c'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xe8d0('0x10f')](db[_0xe8d0('0x78')],{'as':_0xe8d0('0x19d'),'foreignKey':_0xe8d0('0x19e'),'onDelete':_0xe8d0('0x10d'),'hooks':!![]});db[_0xe8d0('0x80')]['hasMany'](db[_0xe8d0('0x80')],{'as':_0xe8d0('0x19f'),'foreignKey':_0xe8d0('0x175'),'onDelete':_0xe8d0('0x10d'),'hooks':!![],'required':![]});db['Interval'][_0xe8d0('0x10f')](db[_0xe8d0('0x18')],{'as':'Extensions','foreignKey':_0xe8d0('0x175'),'onDelete':'restrict'});db['Interval']['hasMany'](db['MailApplication'],{'as':_0xe8d0('0x1a0'),'foreignKey':_0xe8d0('0x175')});db[_0xe8d0('0x80')]['hasMany'](db[_0xe8d0('0x183')],{'as':_0xe8d0('0x1a1'),'foreignKey':_0xe8d0('0x175')});db['Interval'][_0xe8d0('0x10f')](db['FaxApplication'],{'as':_0xe8d0('0x1a2'),'foreignKey':_0xe8d0('0x175')});db[_0xe8d0('0x80')][_0xe8d0('0x10f')](db[_0xe8d0('0x53')],{'as':_0xe8d0('0x1a3'),'foreignKey':_0xe8d0('0x175')});db[_0xe8d0('0x87')]['belongsTo'](db[_0xe8d0('0x3c')],{});db[_0xe8d0('0x87')]['belongsTo'](db[_0xe8d0('0x1a4')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xe8d0('0x143')](db[_0xe8d0('0x1a5')],{'foreignKey':_0xe8d0('0x1a6')});db['Sound'][_0xe8d0('0x11a')](db[_0xe8d0('0x1a')],{'as':_0xe8d0('0x1a7'),'through':_0xe8d0('0x1a8'),'onDelete':'restrict'});db[_0xe8d0('0x8a')][_0xe8d0('0x11a')](db[_0xe8d0('0x70')],{'through':_0xe8d0('0x194')});db['Tag'][_0xe8d0('0x11a')](db[_0xe8d0('0x66')],{'through':_0xe8d0('0x186')});db['Tag'][_0xe8d0('0x11a')](db['MailInteraction'],{'through':_0xe8d0('0x161')});db[_0xe8d0('0x8a')][_0xe8d0('0x11a')](db[_0xe8d0('0x55')],{'through':_0xe8d0('0x178')});db[_0xe8d0('0x8a')][_0xe8d0('0x11a')](db['FaxInteraction'],{'through':_0xe8d0('0x170')});db[_0xe8d0('0x8a')]['belongsToMany'](db[_0xe8d0('0x113')],{'through':_0xe8d0('0x17e')});db[_0xe8d0('0x8a')]['belongsToMany'](db[_0xe8d0('0xff')],{'through':_0xe8d0('0x1a9')});db[_0xe8d0('0x8d')][_0xe8d0('0x10f')](db['Condition'],{'as':{'plural':_0xe8d0('0x1aa'),'singular':_0xe8d0('0x1ab')},'foreignKey':_0xe8d0('0x1ac'),'onDelete':_0xe8d0('0x10d'),'hooks':!![]});db[_0xe8d0('0x8d')][_0xe8d0('0x10f')](db[_0xe8d0('0x7e')],{'as':{'plural':_0xe8d0('0x1ad'),'singular':_0xe8d0('0x1ae')},'foreignKey':'TriggerAnyId','onDelete':_0xe8d0('0x10d'),'hooks':!![]});db[_0xe8d0('0x8d')][_0xe8d0('0x10f')](db['Action'],{'as':_0xe8d0('0x19d'),'foreignKey':_0xe8d0('0x1af'),'onDelete':_0xe8d0('0x10d'),'hooks':!![]});db[_0xe8d0('0x1a5')][_0xe8d0('0x10f')](db[_0xe8d0('0x1b0')],{'as':_0xe8d0('0x1b1'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1a6'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe8d0('0x10f')](db[_0xe8d0('0x1b0')],{'as':'Fields','onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b2')});db['AnalyticMetric'][_0xe8d0('0x10f')](db[_0xe8d0('0x1b0')],{'as':_0xe8d0('0x1b1'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0xe8d0('0x1b0')][_0xe8d0('0x143')](db[_0xe8d0('0x99')],{'foreignKey':_0xe8d0('0x1b3')});db[_0xe8d0('0x9e')][_0xe8d0('0x10f')](db['SalesforceConfiguration'],{'as':_0xe8d0('0x1b4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe8d0('0xa0')][_0xe8d0('0x10f')](db[_0xe8d0('0xa2')],{'as':_0xe8d0('0x1b5'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b6')});db['SalesforceConfiguration'][_0xe8d0('0x10f')](db[_0xe8d0('0xa2')],{'as':_0xe8d0('0x1b7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xe8d0('0xa0')][_0xe8d0('0x10f')](db[_0xe8d0('0xa2')],{'as':'Fields','onDelete':_0xe8d0('0x10d'),'foreignKey':'FieldId'});db[_0xe8d0('0xa0')]['belongsTo'](db[_0xe8d0('0x9e')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xa2')][_0xe8d0('0x10f')](db['SalesforceField'],{'as':_0xe8d0('0x1b9'),'foreignKey':'SubjectId'});db[_0xe8d0('0xa2')][_0xe8d0('0x10f')](db['SalesforceField'],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xa2')]['hasMany'](db[_0xe8d0('0xa2')],{'as':'Field','foreignKey':_0xe8d0('0x1bc')});db['SalesforceField'][_0xe8d0('0x143')](db[_0xe8d0('0x8f')],{'as':'Variable','foreignKey':_0xe8d0('0x1bd')});db['SugarcrmAccount'][_0xe8d0('0x10f')](db[_0xe8d0('0xa5')],{'as':_0xe8d0('0x1b4'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xa5')]['hasMany'](db[_0xe8d0('0xa7')],{'as':'Subjects','onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xa5')][_0xe8d0('0x10f')](db[_0xe8d0('0xa7')],{'as':'Descriptions','onDelete':_0xe8d0('0x10d'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xe8d0('0x10f')](db[_0xe8d0('0xa7')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xe8d0('0xa5')][_0xe8d0('0x143')](db[_0xe8d0('0x1be')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xa7')]['hasMany'](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xa7')][_0xe8d0('0x10f')](db[_0xe8d0('0xa7')],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xa7')][_0xe8d0('0x10f')](db[_0xe8d0('0xa7')],{'as':_0xe8d0('0x1bf'),'foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xa7')]['belongsTo'](db['Variable'],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db[_0xe8d0('0xa9')][_0xe8d0('0x10f')](db['DeskConfiguration'],{'as':_0xe8d0('0x1b4'),'onDelete':'cascade','foreignKey':_0xe8d0('0x1b8')});db['DeskConfiguration']['hasMany'](db[_0xe8d0('0xac')],{'as':'Subjects','onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xaa')][_0xe8d0('0x10f')](db['DeskField'],{'as':_0xe8d0('0x1b7'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xaa')][_0xe8d0('0x10f')](db[_0xe8d0('0xac')],{'as':_0xe8d0('0x1b1'),'onDelete':_0xe8d0('0x10d'),'foreignKey':'FieldId'});db[_0xe8d0('0xaa')][_0xe8d0('0x143')](db['DeskAccount'],{'as':_0xe8d0('0x15f'),'foreignKey':'AccountId'});db[_0xe8d0('0xaa')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x1c0')});db['DeskField'][_0xe8d0('0x10f')](db[_0xe8d0('0xac')],{'as':'Subject','foreignKey':_0xe8d0('0x1b6')});db['DeskField'][_0xe8d0('0x10f')](db[_0xe8d0('0xac')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xe8d0('0xac')][_0xe8d0('0x10f')](db[_0xe8d0('0xac')],{'as':_0xe8d0('0x1bf'),'foreignKey':'FieldId'});db[_0xe8d0('0xac')][_0xe8d0('0x143')](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':'VariableId'});db[_0xe8d0('0xae')]['hasMany'](db['ZohoConfiguration'],{'as':_0xe8d0('0x1b4'),'onDelete':'cascade','foreignKey':_0xe8d0('0x1b8')});db['ZohoConfiguration'][_0xe8d0('0x10f')](db[_0xe8d0('0x1c1')],{'as':_0xe8d0('0x1b5'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b6')});db['ZohoConfiguration'][_0xe8d0('0x10f')](db[_0xe8d0('0x1c1')],{'as':_0xe8d0('0x1b7'),'onDelete':'cascade','foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xb0')]['hasMany'](db[_0xe8d0('0x1c1')],{'as':'Fields','onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xb0')]['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0x1c1')][_0xe8d0('0x10f')](db[_0xe8d0('0x1c1')],{'as':_0xe8d0('0x1b9'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0x1c1')][_0xe8d0('0x10f')](db[_0xe8d0('0x1c1')],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0x1c1')][_0xe8d0('0x10f')](db[_0xe8d0('0x1c1')],{'as':_0xe8d0('0x1bf'),'foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0x1c1')][_0xe8d0('0x143')](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db[_0xe8d0('0xb2')][_0xe8d0('0x10f')](db[_0xe8d0('0xb3')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xe8d0('0xb3')][_0xe8d0('0x10f')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xb3')][_0xe8d0('0x10f')](db[_0xe8d0('0xb5')],{'as':_0xe8d0('0x1b7'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xb3')][_0xe8d0('0x10f')](db[_0xe8d0('0xb5')],{'as':_0xe8d0('0x1b1'),'foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xb3')][_0xe8d0('0x143')](db[_0xe8d0('0xb2')],{'as':'Account','foreignKey':'AccountId'});db[_0xe8d0('0xb3')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x1c2')});db[_0xe8d0('0xb5')][_0xe8d0('0x10f')](db[_0xe8d0('0xb5')],{'as':_0xe8d0('0x1b9'),'foreignKey':_0xe8d0('0x1b6')});db['ZendeskField'][_0xe8d0('0x10f')](db[_0xe8d0('0xb5')],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db['ZendeskField'][_0xe8d0('0x10f')](db[_0xe8d0('0xb5')],{'as':'Field','foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xb5')][_0xe8d0('0x143')](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db['FreshdeskAccount'][_0xe8d0('0x10f')](db['FreshdeskConfiguration'],{'as':_0xe8d0('0x1b4'),'onDelete':'cascade','foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xb7')][_0xe8d0('0x10f')](db[_0xe8d0('0xb9')],{'as':_0xe8d0('0x1b5'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xb7')][_0xe8d0('0x10f')](db[_0xe8d0('0xb9')],{'as':_0xe8d0('0x1b7'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xb7')][_0xe8d0('0x10f')](db[_0xe8d0('0xb9')],{'as':_0xe8d0('0x1b1'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xb7')]['belongsTo'](db[_0xe8d0('0x1c3')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xb7')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x1c4')});db[_0xe8d0('0xb9')]['hasMany'](db[_0xe8d0('0xb9')],{'as':_0xe8d0('0x1b9'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xb9')][_0xe8d0('0x10f')](db['FreshdeskField'],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xb9')][_0xe8d0('0x10f')](db[_0xe8d0('0xb9')],{'as':_0xe8d0('0x1bf'),'foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xb9')]['belongsTo'](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db[_0xe8d0('0xbb')][_0xe8d0('0x10f')](db[_0xe8d0('0x1c5')],{'as':_0xe8d0('0x1b4'),'onDelete':'cascade','foreignKey':_0xe8d0('0x1b8')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xe8d0('0x1b5'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0x1c5')][_0xe8d0('0x10f')](db[_0xe8d0('0xbd')],{'as':_0xe8d0('0x1b7'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0x1c5')]['hasMany'](db[_0xe8d0('0xbd')],{'as':_0xe8d0('0x1b1'),'foreignKey':_0xe8d0('0x1bc')});db['VtigerConfiguration'][_0xe8d0('0x143')](db['VtigerAccount'],{'as':_0xe8d0('0x15f'),'foreignKey':'AccountId'});db[_0xe8d0('0xbd')][_0xe8d0('0x10f')](db[_0xe8d0('0xbd')],{'as':_0xe8d0('0x1b9'),'foreignKey':_0xe8d0('0x1b6')});db['VtigerField'][_0xe8d0('0x10f')](db['VtigerField'],{'as':_0xe8d0('0x1ba'),'foreignKey':'DescriptionId'});db['VtigerField'][_0xe8d0('0x10f')](db['VtigerField'],{'as':_0xe8d0('0x1bf'),'foreignKey':'FieldId'});db[_0xe8d0('0xbd')][_0xe8d0('0x143')](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db[_0xe8d0('0xbf')][_0xe8d0('0x10f')](db[_0xe8d0('0xc0')],{'as':_0xe8d0('0x1b4'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xc0')][_0xe8d0('0x10f')](db[_0xe8d0('0xc2')],{'as':_0xe8d0('0x1b5'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xc0')][_0xe8d0('0x10f')](db['ServicenowField'],{'as':_0xe8d0('0x1b7'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xc0')][_0xe8d0('0x10f')](db[_0xe8d0('0xc2')],{'as':_0xe8d0('0x1b1'),'foreignKey':'FieldId'});db[_0xe8d0('0xc0')][_0xe8d0('0x143')](db[_0xe8d0('0xbf')],{'as':'Account','foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xc2')][_0xe8d0('0x10f')](db['ServicenowField'],{'as':_0xe8d0('0x1b9'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xc2')][_0xe8d0('0x10f')](db['ServicenowField'],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xc2')]['hasMany'](db[_0xe8d0('0xc2')],{'as':'Field','foreignKey':'FieldId'});db[_0xe8d0('0xc2')]['belongsTo'](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db[_0xe8d0('0xc4')]['hasMany'](db[_0xe8d0('0xc6')],{'as':_0xe8d0('0x1b4'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xc6')][_0xe8d0('0x10f')](db[_0xe8d0('0xc8')],{'as':'Subjects','onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b6')});db['Dynamics365Configuration'][_0xe8d0('0x10f')](db[_0xe8d0('0xc8')],{'as':_0xe8d0('0x1b7'),'onDelete':'cascade','foreignKey':_0xe8d0('0x1bb')});db['Dynamics365Configuration'][_0xe8d0('0x10f')](db[_0xe8d0('0xc8')],{'as':'Fields','onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1bc')});db['Dynamics365Configuration']['belongsTo'](db[_0xe8d0('0xc4')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xc8')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe8d0('0xc8')]['hasMany'](db['Dynamics365Field'],{'as':_0xe8d0('0x1ba'),'foreignKey':_0xe8d0('0x1bb')});db['Dynamics365Field']['hasMany'](db[_0xe8d0('0xc8')],{'as':_0xe8d0('0x1bf'),'foreignKey':_0xe8d0('0x1bc')});db['Dynamics365Field'][_0xe8d0('0x143')](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':_0xe8d0('0x1bd')});db[_0xe8d0('0xca')][_0xe8d0('0x10f')](db[_0xe8d0('0xcb')],{'as':_0xe8d0('0x1b4'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1b8')});db['FreshsalesConfiguration'][_0xe8d0('0x10f')](db[_0xe8d0('0xcc')],{'as':_0xe8d0('0x1b5'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xcb')][_0xe8d0('0x10f')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xcb')][_0xe8d0('0x10f')](db[_0xe8d0('0xcc')],{'as':_0xe8d0('0x1b1'),'foreignKey':_0xe8d0('0x1bc')});db['FreshsalesConfiguration'][_0xe8d0('0x143')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0xe8d0('0x1b8')});db[_0xe8d0('0xcc')][_0xe8d0('0x10f')](db[_0xe8d0('0xcc')],{'as':_0xe8d0('0x1b9'),'foreignKey':_0xe8d0('0x1b6')});db[_0xe8d0('0xcc')][_0xe8d0('0x10f')](db[_0xe8d0('0xcc')],{'as':'Description','foreignKey':_0xe8d0('0x1bb')});db[_0xe8d0('0xcc')][_0xe8d0('0x10f')](db[_0xe8d0('0xcc')],{'as':'Field','foreignKey':_0xe8d0('0x1bc')});db[_0xe8d0('0xcc')]['belongsTo'](db[_0xe8d0('0x8f')],{'as':_0xe8d0('0x8f'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0xe8d0('0x143')](db['ChatWebsite'],{});db[_0xe8d0('0x1c6')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':'List','foreignKey':_0xe8d0('0x168')});db['ChatQueueReport']['belongsTo'](db[_0xe8d0('0x70')],{'as':'Contact','foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x1c6')][_0xe8d0('0x143')](db['ChatInteraction'],{});db[_0xe8d0('0x1c6')][_0xe8d0('0x143')](db[_0xe8d0('0x68')],{});db[_0xe8d0('0x1c6')][_0xe8d0('0x143')](db['User'],{});db[_0xe8d0('0x1c6')][_0xe8d0('0x143')](db['ChatQueue'],{});db[_0xe8d0('0xcf')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x10d'),'foreignKey':'FromId'});db[_0xe8d0('0xcf')][_0xe8d0('0x143')](db['User'],{'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x1c7')});db[_0xe8d0('0xd4')][_0xe8d0('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':_0xe8d0('0x1c8'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0xd4')][_0xe8d0('0x10f')](db[_0xe8d0('0x1c9')],{'foreignKey':_0xe8d0('0x1c8'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x1ca')][_0xe8d0('0x143')](db[_0xe8d0('0x174')],{});db['SmsQueueReport']['belongsTo'](db[_0xe8d0('0x11d')],{'as':'List','foreignKey':_0xe8d0('0x168')});db['SmsQueueReport'][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x152'),'foreignKey':'ContactId'});db[_0xe8d0('0x1ca')][_0xe8d0('0x143')](db[_0xe8d0('0x55')],{});db[_0xe8d0('0x1ca')]['belongsTo'](db[_0xe8d0('0x57')],{});db[_0xe8d0('0x1ca')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{});db[_0xe8d0('0x1ca')][_0xe8d0('0x143')](db[_0xe8d0('0x59')],{});db[_0xe8d0('0xd9')][_0xe8d0('0x10f')](db[_0xe8d0('0xd4')],{'foreignKey':_0xe8d0('0x1cb')});db['JscriptyProject'][_0xe8d0('0x10f')](db[_0xe8d0('0xd2')],{'foreignKey':_0xe8d0('0x1cb')});db[_0xe8d0('0xd9')][_0xe8d0('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':_0xe8d0('0x1cb')});db[_0xe8d0('0x138')]['belongsToMany'](db[_0xe8d0('0x10a')],{'as':'Users','through':_0xe8d0('0x139')});db[_0xe8d0('0xe3')][_0xe8d0('0x11a')](db['User'],{'as':'Agents','through':_0xe8d0('0x120')});db[_0xe8d0('0xe3')][_0xe8d0('0x11a')](db[_0xe8d0('0x1b')],{'through':_0xe8d0('0x14b'),'as':_0xe8d0('0x1cc')});db[_0xe8d0('0xe3')][_0xe8d0('0x11a')](db[_0xe8d0('0x127')],{'through':'team_has_mail_queues','as':_0xe8d0('0x1cd')});db['Team'][_0xe8d0('0x11a')](db['ChatQueue'],{'through':_0xe8d0('0x18b'),'as':_0xe8d0('0x128')});db[_0xe8d0('0xe3')]['belongsToMany'](db[_0xe8d0('0x4e')],{'through':'team_has_fax_queues','as':_0xe8d0('0x129')});db[_0xe8d0('0xe3')]['belongsToMany'](db[_0xe8d0('0x59')],{'through':_0xe8d0('0x17a'),'as':_0xe8d0('0x1ce')});db['Team']['belongsToMany'](db[_0xe8d0('0x17c')],{'through':_0xe8d0('0x180'),'as':_0xe8d0('0x1cf')});db['Team'][_0xe8d0('0x11a')](db[_0xe8d0('0x106')],{'through':'team_has_whatsapp_queues','as':_0xe8d0('0x12c')});db[_0xe8d0('0xe7')][_0xe8d0('0x10f')](db[_0xe8d0('0x190')],{'as':_0xe8d0('0x191'),'foreignKey':_0xe8d0('0x196')});db[_0xe8d0('0xe7')][_0xe8d0('0x10f')](db[_0xe8d0('0x73')],{'as':_0xe8d0('0x141'),'foreignKey':_0xe8d0('0x196')});db[_0xe8d0('0xe7')][_0xe8d0('0x10f')](db[_0xe8d0('0x74')],{'as':_0xe8d0('0x192'),'foreignKey':_0xe8d0('0x196')});db[_0xe8d0('0xe7')][_0xe8d0('0x10f')](db[_0xe8d0('0x72')],{'as':_0xe8d0('0x1d0'),'foreignKey':_0xe8d0('0x196')});db[_0xe8d0('0xe7')][_0xe8d0('0x143')](db[_0xe8d0('0x145')],{'as':'Trunk','foreignKey':_0xe8d0('0x144')});db[_0xe8d0('0xe7')][_0xe8d0('0x143')](db[_0xe8d0('0x145')],{'as':_0xe8d0('0x1d1'),'foreignKey':_0xe8d0('0x146')});db[_0xe8d0('0xe7')][_0xe8d0('0x143')](db['Interval'],{'as':_0xe8d0('0x80'),'foreignKey':_0xe8d0('0x175')});db[_0xe8d0('0xe7')][_0xe8d0('0x143')](db[_0xe8d0('0x138')],{'as':_0xe8d0('0x138'),'foreignKey':_0xe8d0('0x1d2')});db[_0xe8d0('0xe7')]['belongsToMany'](db[_0xe8d0('0x11d')],{'as':'Lists','through':_0xe8d0('0x1d3')});db[_0xe8d0('0xe7')][_0xe8d0('0x11a')](db['CmList'],{'as':_0xe8d0('0x14c'),'through':_0xe8d0('0x1d4')});db[_0xe8d0('0xee')][_0xe8d0('0x143')](db[_0xe8d0('0x42')],{});db[_0xe8d0('0xee')]['belongsTo'](db[_0xe8d0('0x40')],{});db['MailTransferReport'][_0xe8d0('0x143')](db[_0xe8d0('0x3c')],{'foreignKey':_0xe8d0('0x1d5'),'as':_0xe8d0('0x1d6')});db[_0xe8d0('0xee')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':'FromUserId','as':_0xe8d0('0x1d7')});db[_0xe8d0('0xee')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':'ToUserId','as':_0xe8d0('0x1d8')});db[_0xe8d0('0xee')][_0xe8d0('0x143')](db[_0xe8d0('0x127')],{'foreignKey':_0xe8d0('0x1d9'),'as':_0xe8d0('0x1da')});db[_0xe8d0('0xee')][_0xe8d0('0x143')](db[_0xe8d0('0x3c')],{'foreignKey':_0xe8d0('0x1db'),'as':_0xe8d0('0x1dc')});db[_0xe8d0('0x1dd')][_0xe8d0('0x143')](db[_0xe8d0('0x68')],{});db[_0xe8d0('0x1dd')]['belongsTo'](db['ChatInteraction'],{});db[_0xe8d0('0x1dd')][_0xe8d0('0x143')](db['ChatWebsite'],{'foreignKey':_0xe8d0('0x1de'),'as':'FromAccount'});db['ChatTransferReport'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1df'),'as':_0xe8d0('0x1d7')});db[_0xe8d0('0x1dd')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1e0'),'as':'ToAgent'});db[_0xe8d0('0x1dd')][_0xe8d0('0x143')](db[_0xe8d0('0x18a')],{'foreignKey':_0xe8d0('0x1e1'),'as':_0xe8d0('0x1da')});db[_0xe8d0('0x1dd')]['belongsTo'](db[_0xe8d0('0x62')],{'foreignKey':_0xe8d0('0x1e2'),'as':_0xe8d0('0x1dc')});db['FaxTransferReport'][_0xe8d0('0x143')](db[_0xe8d0('0x16f')],{});db[_0xe8d0('0xf0')]['belongsTo'](db[_0xe8d0('0x4c')],{});db['FaxTransferReport'][_0xe8d0('0x143')](db['FaxAccount'],{'foreignKey':_0xe8d0('0x1e3'),'as':_0xe8d0('0x1d6')});db[_0xe8d0('0xf0')]['belongsTo'](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1df'),'as':'FromAgent'});db[_0xe8d0('0xf0')][_0xe8d0('0x143')](db['User'],{'foreignKey':_0xe8d0('0x1e0'),'as':_0xe8d0('0x1d8')});db['FaxTransferReport']['belongsTo'](db[_0xe8d0('0x4e')],{'foreignKey':'ToFaxQueueId','as':_0xe8d0('0x1da')});db[_0xe8d0('0xf0')][_0xe8d0('0x143')](db[_0xe8d0('0x49')],{'foreignKey':_0xe8d0('0x1e4'),'as':'ToAccount'});db[_0xe8d0('0xf2')]['belongsTo'](db[_0xe8d0('0x60')],{});db[_0xe8d0('0xf2')][_0xe8d0('0x143')](db[_0xe8d0('0x113')],{});db[_0xe8d0('0xf2')][_0xe8d0('0x143')](db[_0xe8d0('0x5b')],{'foreignKey':_0xe8d0('0x1e5'),'as':_0xe8d0('0x1d6')});db[_0xe8d0('0xf2')][_0xe8d0('0x143')](db['User'],{'foreignKey':_0xe8d0('0x1df'),'as':_0xe8d0('0x1d7')});db[_0xe8d0('0xf2')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1e0'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xe8d0('0x143')](db[_0xe8d0('0x17c')],{'foreignKey':_0xe8d0('0x1e6'),'as':_0xe8d0('0x1da')});db[_0xe8d0('0xf2')][_0xe8d0('0x143')](db[_0xe8d0('0x5b')],{'foreignKey':_0xe8d0('0x1e7'),'as':_0xe8d0('0x1dc')});db['SmsTransferReport'][_0xe8d0('0x143')](db[_0xe8d0('0x57')],{});db[_0xe8d0('0xf4')]['belongsTo'](db[_0xe8d0('0x55')],{});db['SmsTransferReport'][_0xe8d0('0x143')](db['SmsAccount'],{'foreignKey':_0xe8d0('0x1e8'),'as':_0xe8d0('0x1d6')});db[_0xe8d0('0xf4')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1df'),'as':'FromAgent'});db[_0xe8d0('0xf4')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1e0'),'as':_0xe8d0('0x1d8')});db[_0xe8d0('0xf4')]['belongsTo'](db[_0xe8d0('0x59')],{'foreignKey':_0xe8d0('0x1e9'),'as':_0xe8d0('0x1da')});db[_0xe8d0('0xf4')][_0xe8d0('0x143')](db[_0xe8d0('0x174')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xe8d0('0x11d')]['hasMany'](db[_0xe8d0('0x7c')],{'as':_0xe8d0('0x156'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x11d')][_0xe8d0('0x10f')](db['CmCustomField'],{'as':_0xe8d0('0x1ea'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x11d')][_0xe8d0('0x10f')](db[_0xe8d0('0x70')],{'as':_0xe8d0('0x11b'),'onDelete':_0xe8d0('0x10d'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x11d')][_0xe8d0('0x10f')](db[_0xe8d0('0x73')],{'as':_0xe8d0('0x141'),'foreignKey':_0xe8d0('0x168')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x11d')][_0xe8d0('0x10f')](db['ReportAgentPreview'],{'as':_0xe8d0('0x75'),'foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x11d')][_0xe8d0('0x11a')](db['VoiceQueue'],{'as':_0xe8d0('0x1eb'),'through':_0xe8d0('0x148')});db[_0xe8d0('0x11d')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0xe8d0('0x112'),'onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0xf6')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':'user_has_voice_prefixes'});db[_0xe8d0('0xf8')][_0xe8d0('0x10f')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x171'),'foreignKey':_0xe8d0('0x1ec')});db[_0xe8d0('0xf8')][_0xe8d0('0x10f')](db[_0xe8d0('0x1ed')],{'as':_0xe8d0('0x1ee'),'foreignKey':'userProfileId','onDelete':_0xe8d0('0x10d')});db[_0xe8d0('0x1ed')][_0xe8d0('0x10f')](db[_0xe8d0('0x1ef')],{'as':_0xe8d0('0x1f0'),'foreignKey':_0xe8d0('0x1f1'),'onDelete':_0xe8d0('0x10d')});db['WhatsappAccount'][_0xe8d0('0x10f')](db['Disposition'],{'as':_0xe8d0('0x156'),'foreignKey':_0xe8d0('0x1f2')});db['WhatsappAccount'][_0xe8d0('0x10f')](db[_0xe8d0('0x7a')],{'as':_0xe8d0('0x157'),'foreignKey':_0xe8d0('0x1f2')});db[_0xe8d0('0xfd')]['hasMany'](db['WhatsappMessage'],{'as':_0xe8d0('0x14e'),'foreignKey':_0xe8d0('0x1f2')});db['WhatsappAccount'][_0xe8d0('0x10f')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount']['hasMany'](db[_0xe8d0('0xfe')],{'as':_0xe8d0('0x13d')});db['WhatsappAccount'][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':_0xe8d0('0x159'),'foreignKey':'ListId'});db[_0xe8d0('0xfd')][_0xe8d0('0x143')](db[_0xe8d0('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8d0('0x15c')});db[_0xe8d0('0xfd')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':'Agents','through':_0xe8d0('0x1f3')});db[_0xe8d0('0xfe')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0xfe')][_0xe8d0('0x143')](db[_0xe8d0('0x106')],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0xfe')][_0xe8d0('0x143')](db['WhatsappAccount'],{'onDelete':_0xe8d0('0x166')});db[_0xe8d0('0xfe')][_0xe8d0('0x143')](db[_0xe8d0('0x80')],{'onDelete':_0xe8d0('0x166'),'foreignKey':_0xe8d0('0x175')});db[_0xe8d0('0xfe')]['belongsTo'](db[_0xe8d0('0x8a')],{'onDelete':'restrict','foreignKey':_0xe8d0('0x16e')});db[_0xe8d0('0xff')][_0xe8d0('0x10f')](db['WhatsappMessage'],{'as':_0xe8d0('0x14e'),'onDelete':_0xe8d0('0x10d'),'foreignKey':'WhatsappInteractionId'});db[_0xe8d0('0xff')][_0xe8d0('0x143')](db['WhatsappAccount'],{'as':_0xe8d0('0x15f'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0xe8d0('0x152'),'foreignKey':_0xe8d0('0x153')});db['WhatsappInteraction'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x160'),'foreignKey':_0xe8d0('0x10e')});db[_0xe8d0('0xff')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':'whatsapp_interaction_has_tags','as':_0xe8d0('0x162')});db[_0xe8d0('0xff')][_0xe8d0('0x11a')](db[_0xe8d0('0x8a')],{'through':_0xe8d0('0x1a9'),'as':'ThroughTags'});db[_0xe8d0('0xff')][_0xe8d0('0x11a')](db['User'],{'as':_0xe8d0('0x171'),'through':_0xe8d0('0x126'),'foreignKey':_0xe8d0('0x1f4')});db['WhatsappMessage'][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'as':'User'});db[_0xe8d0('0x1f5')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'onDelete':_0xe8d0('0x10d'),'as':_0xe8d0('0x152')});db['WhatsappMessage'][_0xe8d0('0x143')](db[_0xe8d0('0xff')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xe8d0('0x1f4')});db[_0xe8d0('0x1f5')][_0xe8d0('0x143')](db[_0xe8d0('0xfd')],{'as':_0xe8d0('0x15f'),'foreignKey':_0xe8d0('0x1f2')});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db[_0xe8d0('0xfd')],{});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db[_0xe8d0('0x11d')],{'as':'List','foreignKey':_0xe8d0('0x168')});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db[_0xe8d0('0x70')],{'as':'Contact','foreignKey':_0xe8d0('0x153')});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db['WhatsappInteraction'],{});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db[_0xe8d0('0x106')],{});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db[_0xe8d0('0x1f5')],{});db[_0xe8d0('0x102')][_0xe8d0('0x143')](db['User'],{});db[_0xe8d0('0x104')][_0xe8d0('0x143')](db[_0xe8d0('0x1f5')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xe8d0('0xff')],{});db[_0xe8d0('0x104')][_0xe8d0('0x143')](db[_0xe8d0('0xfd')],{'foreignKey':_0xe8d0('0x1f6'),'as':_0xe8d0('0x1d6')});db['WhatsappTransferReport'][_0xe8d0('0x143')](db[_0xe8d0('0xfd')],{'foreignKey':_0xe8d0('0x1f7'),'as':_0xe8d0('0x1dc')});db[_0xe8d0('0x104')][_0xe8d0('0x143')](db[_0xe8d0('0x106')],{'foreignKey':_0xe8d0('0x1f8'),'as':'ToQueue'});db[_0xe8d0('0x104')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':'FromUserId','as':_0xe8d0('0x1d7')});db[_0xe8d0('0x104')][_0xe8d0('0x143')](db[_0xe8d0('0x10a')],{'foreignKey':_0xe8d0('0x1e0'),'as':_0xe8d0('0x1d8')});db[_0xe8d0('0x106')][_0xe8d0('0x11a')](db[_0xe8d0('0x10a')],{'as':_0xe8d0('0x149'),'through':'UserWhatsappQueue','foreignKey':_0xe8d0('0x1f9')});db[_0xe8d0('0x106')][_0xe8d0('0x11a')](db['Team'],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xe8d0('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xad68=['../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','CmList','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_sms_interactions','user_has_openchannel_interactions','MailQueue','MailQueues','UserMailQueue','ChatQueue','ChatQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','IntervalId','mandatoryDispositionPauseId','Lists','Agents','Teams','team_has_voice_queues','BlackLists','Messages','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Dispositions','CannedAnswer','Interactions','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','restrict','TagId','ListId','Items','Answers','FaxAccountId','Applications','Exntensions','List','FaxInteractionId','fax_interaction_has_tags','Tags','user_has_fax_interactions','Interaction','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Members','Website','Contacts','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','OneAll','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','CustomReportId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','Descriptions','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','ProjectId','JscriptyProject','user_has_square_projects','VoiceQueues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToUserId','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToAgent','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','exports','sequelize','lodash','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','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','../api/trunk/trunk.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile'];(function(_0x15ecd1,_0x20ccfc){var _0x8338ea=function(_0x3b8f90){while(--_0x3b8f90){_0x15ecd1['push'](_0x15ecd1['shift']());}};_0x8338ea(++_0x20ccfc);}(_0xad68,0x100));var _0x8ad6=function(_0x19bba9,_0x2e69e7){_0x19bba9=_0x19bba9-0x0;var _0x32dca4=_0xad68[_0x19bba9];return _0x32dca4;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require(_0x8ad6('0x0'));var _=require(_0x8ad6('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x8ad6('0x0')]=_[_0x8ad6('0x2')](config[_0x8ad6('0x0')],{'database':_0x8ad6('0x3'),'username':_0x8ad6('0x4'),'password':_0x8ad6('0x5'),'options':{'host':_0x8ad6('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8ad6('0x7')},'logging':![],'timezone':timezone[_0x8ad6('0x8')](),'define':{'charset':_0x8ad6('0x9'),'collate':_0x8ad6('0xa')}}});config[_0x8ad6('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x8ad6('0x3'),'username':_0x8ad6('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8ad6('0xc'),'dialectOptions':{'charset':_0x8ad6('0x7')},'logging':![],'timezone':timezone[_0x8ad6('0x8')](),'define':{'charset':_0x8ad6('0x9'),'collate':_0x8ad6('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8ad6('0x0')][_0x8ad6('0xd')],config[_0x8ad6('0x0')]['username'],config[_0x8ad6('0x0')]['password'],config['sequelize'][_0x8ad6('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x8ad6('0xd')],config['sequelizeHistory'][_0x8ad6('0xf')],config[_0x8ad6('0xb')][_0x8ad6('0x10')],config['sequelizeHistory'][_0x8ad6('0xe')])};db[_0x8ad6('0x11')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x13'));db[_0x8ad6('0x14')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x8ad6('0x15')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x16'));db[_0x8ad6('0x17')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/voiceExtension/voiceExtension.model');db[_0x8ad6('0x18')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8ad6('0x19')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x1a'));db[_0x8ad6('0x1b')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x1c'));db[_0x8ad6('0x1d')]=db['sequelize']['import'](_0x8ad6('0x1e'));db[_0x8ad6('0x1f')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x20'));db[_0x8ad6('0x21')]=db['sequelize']['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8ad6('0x22')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x23'));db[_0x8ad6('0x24')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x25'));db[_0x8ad6('0x26')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x27'));db[_0x8ad6('0x28')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x29'));db[_0x8ad6('0x2a')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x2b'));db['Trunk']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x2c'));db['VoiceTransferReport']=db[_0x8ad6('0x0')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8ad6('0x2d')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x2e'));db[_0x8ad6('0x2f')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x30'));db['UserMailQueue']=db[_0x8ad6('0x0')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x8ad6('0x31')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x32'));db[_0x8ad6('0x33')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x8ad6('0x34')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x35'));db['UserWhatsappQueue']=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x36'));db[_0x8ad6('0x37')]=db['sequelize']['import'](_0x8ad6('0x38'));db[_0x8ad6('0x39')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x3a'));db['MailAccount']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x3b'));db['MailQueue']=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/mailQueue/mailQueue.model');db[_0x8ad6('0x3c')]=db['sequelize']['import'](_0x8ad6('0x3d'));db[_0x8ad6('0x3e')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x3f'));db[_0x8ad6('0x40')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/mailMessage/mailMessage.model');db[_0x8ad6('0x41')]=db['sequelize'][_0x8ad6('0x12')]('../api/mailApplication/mailApplication.model');db[_0x8ad6('0x42')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x43'));db['Dashboard']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x44'));db[_0x8ad6('0x45')]=db[_0x8ad6('0x0')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x8ad6('0x46')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x47'));db[_0x8ad6('0x48')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x49'));db[_0x8ad6('0x4a')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x4b'));db[_0x8ad6('0x4c')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x4d'));db[_0x8ad6('0x4e')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x4f'));db['FaxQueueReport']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x50'));db['SmsAccount']=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x51'));db[_0x8ad6('0x52')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x53'));db[_0x8ad6('0x54')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x55'));db[_0x8ad6('0x56')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x57'));db[_0x8ad6('0x58')]=db[_0x8ad6('0x0')]['import']('../api/smsQueue/smsQueue.model');db[_0x8ad6('0x59')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize']['import'](_0x8ad6('0x5a'));db['OpenchannelInteraction']=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x8ad6('0x5b')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x5c'));db['OpenchannelQueue']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x5d'));db[_0x8ad6('0x5e')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x5f'));db[_0x8ad6('0x60')]=db[_0x8ad6('0x0')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x8ad6('0x61')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x62'));db[_0x8ad6('0x63')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x64'));db['ChatMessage']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x65'));db[_0x8ad6('0x66')]=db['sequelize']['import'](_0x8ad6('0x67'));db['ChatQueue']=db['sequelize'][_0x8ad6('0x12')]('../api/chatQueue/chatQueue.model');db[_0x8ad6('0x68')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x69'));db['ChatProactiveAction']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x6a'));db[_0x8ad6('0x6b')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x6c'));db[_0x8ad6('0x6d')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x6e'));db[_0x8ad6('0x6f')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x70'));db[_0x8ad6('0x71')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x72'));db[_0x8ad6('0x73')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x74'));db[_0x8ad6('0x75')]=db['sequelize'][_0x8ad6('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x8ad6('0x76')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x77'));db['CmCustomField']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x78'));db[_0x8ad6('0x79')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x7a'));db[_0x8ad6('0x7b')]=db['sequelize']['import'](_0x8ad6('0x7c'));db['CannedAnswer']=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x7d'));db[_0x8ad6('0x7e')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x7f'));db['Condition']=db['sequelize']['import']('../api/condition/condition.model');db[_0x8ad6('0x80')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/interval/interval.model');db[_0x8ad6('0x81')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x82'));db[_0x8ad6('0x83')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x84'));db[_0x8ad6('0x85')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x8ad6('0x86')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x87'));db[_0x8ad6('0x88')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x89'));db[_0x8ad6('0x8a')]=db['sequelize']['import'](_0x8ad6('0x8b'));db[_0x8ad6('0x8c')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x8d'));db[_0x8ad6('0x8e')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/trigger/trigger.model');db['Variable']=db['sequelize']['import'](_0x8ad6('0x8f'));db[_0x8ad6('0x90')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x91'));db[_0x8ad6('0x92')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x93'));db[_0x8ad6('0x94')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x95'));db['AnalyticDefaultReport']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x96'));db[_0x8ad6('0x97')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0x98'));db[_0x8ad6('0x99')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x9a'));db['AnalyticFieldReport']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0x9b'));db[_0x8ad6('0x9c')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x9d'));db[_0x8ad6('0x9e')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x9f'));db[_0x8ad6('0xa0')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0xa1'));db[_0x8ad6('0xa2')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xa3'));db[_0x8ad6('0xa4')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xa5'));db['SugarcrmField']=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x8ad6('0xa6')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xa7'));db['DeskConfiguration']=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0xa8'));db[_0x8ad6('0xa9')]=db['sequelize'][_0x8ad6('0x12')]('../api/intDeskField/intDeskField.model');db[_0x8ad6('0xaa')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0xab'));db[_0x8ad6('0xac')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xad'));db[_0x8ad6('0xae')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xaf'));db['ZendeskAccount']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xb0'));db[_0x8ad6('0xb1')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xb2'));db['ZendeskField']=db[_0x8ad6('0x0')]['import']('../api/intZendeskField/intZendeskField.model');db[_0x8ad6('0xb3')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x8ad6('0xb4')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xb5'));db['FreshdeskField']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xb6'));db[_0x8ad6('0xb7')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xb8'));db[_0x8ad6('0xb9')]=db['sequelize'][_0x8ad6('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x8ad6('0xba')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xbb'));db[_0x8ad6('0xbc')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xbd'));db[_0x8ad6('0xbe')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xbf'));db[_0x8ad6('0xc0')]=db['sequelize']['import'](_0x8ad6('0xc1'));db[_0x8ad6('0xc2')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0xc3'));db[_0x8ad6('0xc4')]=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0xc5'));db[_0x8ad6('0xc6')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xc7'));db[_0x8ad6('0xc8')]=db[_0x8ad6('0x0')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x8ad6('0xc9')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x8ad6('0xca')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xcb'));db['Integration']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0x91'));db[_0x8ad6('0xcc')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/network/network.model');db['ChatQueueReport']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xcd'));db[_0x8ad6('0xce')]=db[_0x8ad6('0x0')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x8ad6('0xcf')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xd0'));db['JscriptyQuestionReport']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xd1'));db['JscriptySessionReport']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xd2'));db['SmsQueueReport']=db['sequelize'][_0x8ad6('0x12')](_0x8ad6('0xd3'));db['SquareReport']=db['sequelize'][_0x8ad6('0x12')]('../api/squareReport/squareReport.model');db[_0x8ad6('0xd4')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xd5'));db['JscriptyProject']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xd6'));db[_0x8ad6('0xd7')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xd8'));db['SquareOdbc']=db['sequelize']['import'](_0x8ad6('0xd9'));db[_0x8ad6('0xda')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xdb'));db['SquareRecording']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xdc'));db[_0x8ad6('0xdd')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/squareMessage/squareMessage.model');db[_0x8ad6('0xde')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xdf'));db[_0x8ad6('0xe0')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xe1'));db[_0x8ad6('0xe2')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/campaign/campaign.model');db['Migration']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xe3'));db[_0x8ad6('0xe4')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xe5'));db['Plugin']=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/plugin/plugin.model');db[_0x8ad6('0xe6')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xe7'));db[_0x8ad6('0xe8')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xe9'));db['FaxTransferReport']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xea'));db['OpenchannelTransferReport']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xeb'));db['SmsTransferReport']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xec'));db['CmList']=db[_0x8ad6('0x0')]['import']('../api/cmList/cmList.model');db[_0x8ad6('0xed')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x8ad6('0xee')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xef'));db[_0x8ad6('0xf0')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xf1'));db[_0x8ad6('0xf2')]=db['sequelize']['import'](_0x8ad6('0xf3'));db['Notification']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xf4'));db[_0x8ad6('0xf5')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xf6'));db[_0x8ad6('0xf7')]=db['sequelize'][_0x8ad6('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x8ad6('0xf8')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xf9'));db[_0x8ad6('0xfa')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x8ad6('0xfb')]=db[_0x8ad6('0x0')]['import'](_0x8ad6('0xfc'));db[_0x8ad6('0xfd')]=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xfe'));db['CloudProvider']=db[_0x8ad6('0x0')][_0x8ad6('0x12')](_0x8ad6('0xff'));db['User'][_0x8ad6('0x100')](db[_0x8ad6('0x1f')],{'as':'VoiceMail','onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x11')]['hasMany'](db['VoiceRecording'],{'as':_0x8ad6('0x103'),'foreignKey':'UserId'});db[_0x8ad6('0x11')][_0x8ad6('0x104')](db[_0x8ad6('0x105')],{'as':_0x8ad6('0x106'),'foreignKey':'UserId'});db['User'][_0x8ad6('0x104')](db[_0x8ad6('0x17')],{'as':_0x8ad6('0x107'),'onDelete':_0x8ad6('0x101'),'hooks':!![]});db[_0x8ad6('0x11')][_0x8ad6('0x104')](db[_0x8ad6('0x73')],{'as':_0x8ad6('0x108'),'foreignKey':'UserId'});db['User'][_0x8ad6('0x104')](db[_0x8ad6('0x75')],{'as':_0x8ad6('0x109'),'foreignKey':_0x8ad6('0x102')});db['User']['hasMany'](db[_0x8ad6('0x76')],{'as':_0x8ad6('0x76'),'foreignKey':'UserId'});db[_0x8ad6('0x11')][_0x8ad6('0x104')](db[_0x8ad6('0x10a')],{'as':_0x8ad6('0x10b'),'foreignKey':_0x8ad6('0x102')});db['User'][_0x8ad6('0x104')](db[_0x8ad6('0x63')],{'as':_0x8ad6('0x10c'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x11')][_0x8ad6('0x104')](db[_0x8ad6('0x54')],{'as':_0x8ad6('0x10d'),'foreignKey':_0x8ad6('0x102')});db['User']['hasMany'](db['FaxInteraction'],{'as':_0x8ad6('0x10e'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x11')][_0x8ad6('0x104')](db[_0x8ad6('0x3e')],{'as':_0x8ad6('0x10f'),'foreignKey':_0x8ad6('0x102')});db['User']['hasMany'](db[_0x8ad6('0xf7')],{'as':_0x8ad6('0x110'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x11')][_0x8ad6('0x104')](db[_0x8ad6('0x111')],{'as':_0x8ad6('0x112'),'foreignKey':'SenderId'});db[_0x8ad6('0x11')][_0x8ad6('0x113')](db[_0x8ad6('0xee')],{'as':_0x8ad6('0xee'),'foreignKey':_0x8ad6('0x114')});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x68')],{'as':_0x8ad6('0x116'),'through':_0x8ad6('0x117')});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x6d')],{'as':'Contacts','through':_0x8ad6('0x118')});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x119')],{'as':'Lists','through':_0x8ad6('0x11a')});db[_0x8ad6('0x11')]['belongsToMany'](db['Team'],{'through':_0x8ad6('0x11b')});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0x3e')],{'as':_0x8ad6('0x10f'),'through':_0x8ad6('0x11c')});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0x63')],{'as':_0x8ad6('0x10c'),'through':'user_has_chat_interactions'});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x4a')],{'as':_0x8ad6('0x10e'),'through':'user_has_fax_interactions'});db[_0x8ad6('0x11')]['belongsToMany'](db[_0x8ad6('0x54')],{'as':_0x8ad6('0x10d'),'through':_0x8ad6('0x11d')});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x10a')],{'as':_0x8ad6('0x10b'),'through':_0x8ad6('0x11e')});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x8ad6('0x11')]['belongsToMany'](db[_0x8ad6('0x19')],{'as':'VoiceQueues','through':_0x8ad6('0x2d'),'required':![]});db[_0x8ad6('0x11')]['belongsToMany'](db[_0x8ad6('0x11f')],{'as':_0x8ad6('0x120'),'through':_0x8ad6('0x121'),'required':![]});db['User']['belongsToMany'](db[_0x8ad6('0x122')],{'as':_0x8ad6('0x123'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x4e')],{'as':'FaxQueues','through':_0x8ad6('0x31'),'required':![]});db['User']['belongsToMany'](db[_0x8ad6('0x58')],{'as':_0x8ad6('0x124'),'through':'UserSmsQueue','required':![]});db[_0x8ad6('0x11')]['belongsToMany'](db[_0x8ad6('0x125')],{'as':_0x8ad6('0x126'),'through':_0x8ad6('0x34'),'required':![]});db['User'][_0x8ad6('0x115')](db['WhatsappQueue'],{'as':_0x8ad6('0x127'),'through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0x8ad6('0x119')],{'through':'cm_user_has_lists'});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0xed')],{'as':_0x8ad6('0x128'),'through':_0x8ad6('0x129'),'required':![]});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x5e')],{'as':'ChatWebsites','through':_0x8ad6('0x12a')});db['User'][_0x8ad6('0x115')](db[_0x8ad6('0x46')],{'as':_0x8ad6('0x12b'),'through':_0x8ad6('0x12c')});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0x12d')],{'as':_0x8ad6('0x12e'),'through':_0x8ad6('0x12f')});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0x59')],{'as':_0x8ad6('0x130'),'through':'user_has_openchannel_accounts'});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0x131')],{'as':_0x8ad6('0x132'),'through':_0x8ad6('0x133')});db[_0x8ad6('0x11')][_0x8ad6('0x115')](db[_0x8ad6('0xf5')],{'as':_0x8ad6('0x134'),'through':_0x8ad6('0x135')});db['User'][_0x8ad6('0x115')](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x8ad6('0x14')][_0x8ad6('0x104')](db[_0x8ad6('0x17')],{'as':_0x8ad6('0x136'),'onDelete':'cascade','foreignKey':_0x8ad6('0x137')});db[_0x8ad6('0x15')]['hasMany'](db[_0x8ad6('0x17')],{'onDelete':'cascade'});db[_0x8ad6('0x17')][_0x8ad6('0x104')](db[_0x8ad6('0x17')],{'as':'Applications','onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x18')][_0x8ad6('0x115')](db[_0x8ad6('0x88')],{'as':_0x8ad6('0x138'),'through':_0x8ad6('0x139')});db[_0x8ad6('0x19')][_0x8ad6('0x104')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x8ad6('0x13a')});db['VoiceQueue'][_0x8ad6('0x104')](db['CmHopper'],{'as':_0x8ad6('0x13b'),'foreignKey':_0x8ad6('0x13a')});db[_0x8ad6('0x19')]['hasMany'](db[_0x8ad6('0x73')],{'as':_0x8ad6('0x108'),'foreignKey':_0x8ad6('0x13a')});db[_0x8ad6('0x19')][_0x8ad6('0x104')](db['CmHopperHistory'],{'as':_0x8ad6('0x13c'),'foreignKey':_0x8ad6('0x13a')});db[_0x8ad6('0x19')][_0x8ad6('0x104')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x8ad6('0x13a')});db['VoiceQueue'][_0x8ad6('0x104')](db[_0x8ad6('0x71')],{'as':_0x8ad6('0x13d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x8ad6('0x13e')],{'as':_0x8ad6('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x8ad6('0x19')][_0x8ad6('0x113')](db['Trunk'],{'as':_0x8ad6('0x140'),'foreignKey':_0x8ad6('0x141')});db[_0x8ad6('0x19')][_0x8ad6('0x113')](db[_0x8ad6('0x140')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x8ad6('0x19')]['belongsTo'](db[_0x8ad6('0x80')],{'as':_0x8ad6('0x80'),'foreignKey':_0x8ad6('0x142')});db[_0x8ad6('0x19')]['belongsTo'](db[_0x8ad6('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x8ad6('0x143')});db[_0x8ad6('0x19')]['belongsToMany'](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x144'),'through':'voice_queues_has_cm_lists'});db[_0x8ad6('0x19')]['belongsToMany'](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x2d')});db[_0x8ad6('0x19')]['belongsToMany'](db[_0x8ad6('0xde')],{'as':_0x8ad6('0x146'),'through':_0x8ad6('0x147')});db[_0x8ad6('0x19')][_0x8ad6('0x115')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x148'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x11'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x1d')]['belongsTo'](db['User'],{'as':_0x8ad6('0x11'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x1f')][_0x8ad6('0x104')](db[_0x8ad6('0x21')],{'as':_0x8ad6('0x149'),'onDelete':_0x8ad6('0x101'),'foreignKey':'mailboxuser','sourceKey':_0x8ad6('0x14a')});db[_0x8ad6('0x21')]['belongsTo'](db[_0x8ad6('0x1f')],{'foreignKey':'mailboxuser','targetKey':_0x8ad6('0x14a')});db[_0x8ad6('0x22')][_0x8ad6('0x104')](db[_0x8ad6('0x28')],{'as':'QueueCalls','foreignKey':_0x8ad6('0x14b'),'constraints':![]});db[_0x8ad6('0x22')]['hasMany'](db[_0x8ad6('0x26')],{'as':_0x8ad6('0x14c'),'foreignKey':_0x8ad6('0x14b'),'constraints':![]});db[_0x8ad6('0x22')][_0x8ad6('0x113')](db['User'],{'as':_0x8ad6('0x11'),'foreignKey':'UserId'});db[_0x8ad6('0x22')]['belongsTo'](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e')});db['MailServerIn'][_0x8ad6('0x113')](db[_0x8ad6('0x12d')],{'as':'MailAccount','foreignKey':_0x8ad6('0x14f')});db[_0x8ad6('0x39')][_0x8ad6('0x113')](db[_0x8ad6('0x12d')],{'as':_0x8ad6('0x12d'),'foreignKey':_0x8ad6('0x14f')});db[_0x8ad6('0x12d')][_0x8ad6('0x100')](db[_0x8ad6('0x37')],{'as':_0x8ad6('0x150'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x12d')][_0x8ad6('0x100')](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0x8ad6('0x104')](db[_0x8ad6('0x7e')],{'as':_0x8ad6('0x151'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x8ad6('0x104')](db[_0x8ad6('0x152')],{'as':'Answers','foreignKey':_0x8ad6('0x14f')});db[_0x8ad6('0x12d')]['hasMany'](db[_0x8ad6('0x40')],{'as':_0x8ad6('0x149'),'foreignKey':_0x8ad6('0x14f')});db[_0x8ad6('0x12d')][_0x8ad6('0x104')](db['MailInteraction'],{'as':_0x8ad6('0x153')});db['MailAccount']['hasMany'](db[_0x8ad6('0x41')],{'as':'Applications'});db[_0x8ad6('0x12d')][_0x8ad6('0x113')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0x8ad6('0x113')](db[_0x8ad6('0x8c')],{'as':_0x8ad6('0x8c'),'foreignKey':'TemplateId'});db['MailAccount'][_0x8ad6('0x113')](db[_0x8ad6('0x81')],{'as':_0x8ad6('0x154'),'foreignKey':_0x8ad6('0x143')});db[_0x8ad6('0x12d')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x12f')});db['MailQueue'][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':'UserMailQueue'});db[_0x8ad6('0x11f')][_0x8ad6('0x115')](db[_0x8ad6('0xde')],{'through':_0x8ad6('0x155'),'as':_0x8ad6('0x146')});db['MailInteraction'][_0x8ad6('0x104')](db[_0x8ad6('0x40')],{'as':_0x8ad6('0x149'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x156')});db[_0x8ad6('0x3e')][_0x8ad6('0x113')](db[_0x8ad6('0x12d')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x14f')});db['MailInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':'ContactId'});db[_0x8ad6('0x3e')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x158'),'foreignKey':'UserId'});db[_0x8ad6('0x3e')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x159'),'as':'Tags'});db[_0x8ad6('0x3e')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x159'),'as':_0x8ad6('0x15a')});db[_0x8ad6('0x3e')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x15b'),'through':_0x8ad6('0x11c'),'foreignKey':_0x8ad6('0x156')});db[_0x8ad6('0x40')]['hasMany'](db[_0x8ad6('0xe4')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x11')});db[_0x8ad6('0x40')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x14d')});db[_0x8ad6('0x40')][_0x8ad6('0x113')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x8ad6('0x156')});db[_0x8ad6('0x40')][_0x8ad6('0x113')](db['MailAccount'],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x14f')});db['MailApplication']['belongsTo'](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x41')][_0x8ad6('0x113')](db['MailQueue'],{'onDelete':_0x8ad6('0x15c')});db['MailApplication'][_0x8ad6('0x113')](db[_0x8ad6('0x12d')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x41')][_0x8ad6('0x113')](db[_0x8ad6('0x80')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':'IntervalId'});db[_0x8ad6('0x41')][_0x8ad6('0x113')](db[_0x8ad6('0x8a')],{'onDelete':'restrict','foreignKey':_0x8ad6('0x15d')});db[_0x8ad6('0x42')][_0x8ad6('0x113')](db[_0x8ad6('0x12d')],{});db['MailQueueReport'][_0x8ad6('0x113')](db['CmList'],{'as':'List','foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x42')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e')});db[_0x8ad6('0x42')]['belongsTo'](db['MailInteraction'],{});db[_0x8ad6('0x42')][_0x8ad6('0x113')](db['MailMessage'],{});db[_0x8ad6('0x42')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{});db[_0x8ad6('0x42')][_0x8ad6('0x113')](db[_0x8ad6('0x11f')],{});db['Dashboard'][_0x8ad6('0x104')](db[_0x8ad6('0x45')],{'as':_0x8ad6('0x15f'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x46')][_0x8ad6('0x104')](db[_0x8ad6('0x7e')],{'as':_0x8ad6('0x151'),'foreignKey':'FaxAccountId'});db[_0x8ad6('0x46')]['hasMany'](db['CannedAnswer'],{'as':_0x8ad6('0x160'),'foreignKey':_0x8ad6('0x161')});db[_0x8ad6('0x46')][_0x8ad6('0x104')](db[_0x8ad6('0x4a')],{'as':_0x8ad6('0x153')});db[_0x8ad6('0x46')][_0x8ad6('0x104')](db[_0x8ad6('0x48')],{'as':_0x8ad6('0x162')});db['FaxAccount'][_0x8ad6('0x104')](db['VoiceExtension'],{'as':_0x8ad6('0x163'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x46')][_0x8ad6('0x104')](db[_0x8ad6('0x4c')],{'as':_0x8ad6('0x149')});db[_0x8ad6('0x46')]['belongsTo'](db[_0x8ad6('0x140')],{'as':'Trunk'});db[_0x8ad6('0x46')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':'ListId'});db['FaxAccount'][_0x8ad6('0x113')](db[_0x8ad6('0x81')],{'as':_0x8ad6('0x154'),'foreignKey':_0x8ad6('0x143')});db[_0x8ad6('0x46')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x12c')});db[_0x8ad6('0x48')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x48')][_0x8ad6('0x113')](db[_0x8ad6('0x4e')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x48')]['belongsTo'](db[_0x8ad6('0x46')],{'onDelete':_0x8ad6('0x15c')});db['FaxApplication']['belongsTo'](db[_0x8ad6('0x8a')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':_0x8ad6('0x15d')});db[_0x8ad6('0x4a')][_0x8ad6('0x104')](db[_0x8ad6('0x4c')],{'as':_0x8ad6('0x149'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x165')});db[_0x8ad6('0x4a')][_0x8ad6('0x113')](db[_0x8ad6('0x46')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x158'),'foreignKey':'UserId'});db[_0x8ad6('0x4a')]['belongsToMany'](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x166'),'as':_0x8ad6('0x167')});db[_0x8ad6('0x4a')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x8ad6('0x4a')][_0x8ad6('0x115')](db['User'],{'as':_0x8ad6('0x15b'),'through':_0x8ad6('0x168'),'foreignKey':_0x8ad6('0x165')});db['FaxMessage'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x101'),'as':'User'});db[_0x8ad6('0x4c')][_0x8ad6('0x113')](db['FaxInteraction'],{'as':_0x8ad6('0x169'),'foreignKey':'FaxInteractionId'});db[_0x8ad6('0x4c')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x14d')});db[_0x8ad6('0x4c')][_0x8ad6('0x113')](db['Attachment'],{'as':_0x8ad6('0xe4'),'foreignKey':_0x8ad6('0x16a')});db['FaxMessage']['belongsTo'](db[_0x8ad6('0x46')],{'as':_0x8ad6('0x157'),'foreignKey':'FaxAccountId'});db[_0x8ad6('0x4e')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':'UserFaxQueue'});db[_0x8ad6('0x4e')]['belongsToMany'](db['Team'],{'through':_0x8ad6('0x16b'),'as':'Teams'});db['FaxQueueReport'][_0x8ad6('0x113')](db[_0x8ad6('0x46')],{});db[_0x8ad6('0x16c')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':'List','foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x16c')][_0x8ad6('0x113')](db['CmContact'],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e')});db['FaxQueueReport'][_0x8ad6('0x113')](db[_0x8ad6('0x4a')],{});db[_0x8ad6('0x16c')][_0x8ad6('0x113')](db[_0x8ad6('0x4c')],{});db[_0x8ad6('0x16c')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{});db[_0x8ad6('0x16c')][_0x8ad6('0x113')](db[_0x8ad6('0x4e')],{});db[_0x8ad6('0x131')][_0x8ad6('0x104')](db[_0x8ad6('0x7e')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0x8ad6('0x131')][_0x8ad6('0x104')](db[_0x8ad6('0x152')],{'as':_0x8ad6('0x160'),'foreignKey':_0x8ad6('0x16d')});db[_0x8ad6('0x131')][_0x8ad6('0x104')](db[_0x8ad6('0x56')],{'as':_0x8ad6('0x149'),'foreignKey':_0x8ad6('0x16d')});db[_0x8ad6('0x131')][_0x8ad6('0x104')](db[_0x8ad6('0x54')],{'as':'Interactions'});db[_0x8ad6('0x131')][_0x8ad6('0x104')](db['SmsApplication'],{'as':_0x8ad6('0x162')});db[_0x8ad6('0x131')]['belongsTo'](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':'ListId'});db[_0x8ad6('0x131')][_0x8ad6('0x113')](db[_0x8ad6('0x81')],{'as':_0x8ad6('0x154'),'foreignKey':_0x8ad6('0x143')});db[_0x8ad6('0x131')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x133')});db[_0x8ad6('0x52')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x52')]['belongsTo'](db[_0x8ad6('0x58')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x52')]['belongsTo'](db['SmsAccount'],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x52')][_0x8ad6('0x113')](db[_0x8ad6('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0x8ad6('0x113')](db['Tag'],{'onDelete':_0x8ad6('0x15c'),'foreignKey':_0x8ad6('0x15d')});db[_0x8ad6('0x54')][_0x8ad6('0x104')](db[_0x8ad6('0x56')],{'as':_0x8ad6('0x149'),'onDelete':_0x8ad6('0x101'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x131')],{'as':_0x8ad6('0x157'),'foreignKey':'SmsAccountId'});db[_0x8ad6('0x54')][_0x8ad6('0x113')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x158'),'foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x54')]['belongsToMany'](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x16e'),'as':_0x8ad6('0x167')});db[_0x8ad6('0x54')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x16e'),'as':_0x8ad6('0x15a')});db[_0x8ad6('0x54')][_0x8ad6('0x115')](db['User'],{'as':_0x8ad6('0x15b'),'through':'user_has_sms_interactions','foreignKey':_0x8ad6('0x16f')});db[_0x8ad6('0x56')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':'User'});db[_0x8ad6('0x56')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x14d')});db[_0x8ad6('0x56')][_0x8ad6('0x113')](db[_0x8ad6('0x54')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x169'),'foreignKey':_0x8ad6('0x16f')});db[_0x8ad6('0x56')][_0x8ad6('0x113')](db[_0x8ad6('0x131')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x16d')});db[_0x8ad6('0x58')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':'UserSmsQueue','foreignKey':_0x8ad6('0x170')});db[_0x8ad6('0x58')][_0x8ad6('0x115')](db['Team'],{'through':_0x8ad6('0x171'),'as':_0x8ad6('0x146')});db[_0x8ad6('0x59')]['hasMany'](db[_0x8ad6('0x7e')],{'as':_0x8ad6('0x151'),'foreignKey':_0x8ad6('0x172')});db[_0x8ad6('0x59')][_0x8ad6('0x104')](db[_0x8ad6('0x152')],{'as':_0x8ad6('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x8ad6('0x59')]['hasMany'](db[_0x8ad6('0x10a')],{'as':_0x8ad6('0x153'),'foreignKey':'OpenchannelAccountId'});db[_0x8ad6('0x59')][_0x8ad6('0x104')](db[_0x8ad6('0x5b')],{'as':_0x8ad6('0x149'),'foreignKey':_0x8ad6('0x172')});db[_0x8ad6('0x59')][_0x8ad6('0x104')](db[_0x8ad6('0x173')],{'as':_0x8ad6('0x162'),'foreignKey':_0x8ad6('0x172')});db[_0x8ad6('0x59')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x59')]['belongsTo'](db['Pause'],{'as':_0x8ad6('0x154'),'foreignKey':_0x8ad6('0x143')});db['OpenchannelAccount'][_0x8ad6('0x115')](db['User'],{'as':'Agents','through':_0x8ad6('0x174')});db[_0x8ad6('0x173')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':'restrict'});db[_0x8ad6('0x173')][_0x8ad6('0x113')](db[_0x8ad6('0x125')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':'OpenchannelQueueId'});db[_0x8ad6('0x173')][_0x8ad6('0x113')](db[_0x8ad6('0x59')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x8ad6('0x173')][_0x8ad6('0x113')](db[_0x8ad6('0x80')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':_0x8ad6('0x142')});db['OpenchannelApplication'][_0x8ad6('0x113')](db[_0x8ad6('0x8a')],{'onDelete':'restrict','foreignKey':_0x8ad6('0x15d')});db[_0x8ad6('0x10a')][_0x8ad6('0x104')](db[_0x8ad6('0x5b')],{'as':_0x8ad6('0x149'),'onDelete':_0x8ad6('0x101'),'foreignKey':'OpenchannelInteractionId'});db[_0x8ad6('0x10a')]['belongsTo'](db[_0x8ad6('0x59')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x172')});db['OpenchannelInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x158'),'foreignKey':_0x8ad6('0x102')});db['OpenchannelInteraction'][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x175'),'as':_0x8ad6('0x167')});db[_0x8ad6('0x10a')]['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x8ad6('0x10a')]['belongsToMany'](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x15b'),'through':_0x8ad6('0x11e'),'foreignKey':_0x8ad6('0x176')});db[_0x8ad6('0x5b')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x11')});db[_0x8ad6('0x5b')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'onDelete':_0x8ad6('0x101'),'as':'Contact'});db[_0x8ad6('0x5b')][_0x8ad6('0x113')](db[_0x8ad6('0x10a')],{'onDelete':_0x8ad6('0x101'),'as':'Interaction','foreignKey':_0x8ad6('0x176')});db['OpenchannelMessage']['belongsTo'](db[_0x8ad6('0xe4')],{'as':_0x8ad6('0xe4'),'foreignKey':_0x8ad6('0x16a')});db['OpenchannelMessage'][_0x8ad6('0x113')](db[_0x8ad6('0x59')],{'as':'Account','foreignKey':_0x8ad6('0x172')});db[_0x8ad6('0x125')]['belongsToMany'](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x34'),'foreignKey':'OpenchannelQueueId'});db[_0x8ad6('0x125')][_0x8ad6('0x115')](db[_0x8ad6('0xde')],{'through':'team_has_openchannel_queues','as':_0x8ad6('0x146')});db[_0x8ad6('0x5e')]['hasMany'](db[_0x8ad6('0x7e')],{'as':_0x8ad6('0x151'),'foreignKey':_0x8ad6('0x177')});db['ChatWebsite'][_0x8ad6('0x104')](db[_0x8ad6('0x152')],{'as':_0x8ad6('0x160'),'foreignKey':_0x8ad6('0x177')});db[_0x8ad6('0x5e')][_0x8ad6('0x104')](db[_0x8ad6('0x178')],{'as':_0x8ad6('0x179')});db[_0x8ad6('0x5e')]['hasMany'](db[_0x8ad6('0x63')],{'as':'Interactions'});db['ChatWebsite']['hasMany'](db[_0x8ad6('0x61')],{'as':_0x8ad6('0x162')});db[_0x8ad6('0x5e')]['hasMany'](db[_0x8ad6('0x17a')],{'as':_0x8ad6('0x149')});db[_0x8ad6('0x5e')]['belongsTo'](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x5e')][_0x8ad6('0x113')](db[_0x8ad6('0x80')],{'as':_0x8ad6('0x80'),'foreignKey':_0x8ad6('0x142')});db[_0x8ad6('0x5e')][_0x8ad6('0x113')](db[_0x8ad6('0x81')],{'as':_0x8ad6('0x154'),'foreignKey':_0x8ad6('0x143')});db[_0x8ad6('0x5e')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x12a')});db[_0x8ad6('0x60')]['belongsTo'](db[_0x8ad6('0x59')],{});db[_0x8ad6('0x60')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e')});db['OpenchannelQueueReport'][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':'Contact','foreignKey':_0x8ad6('0x14e')});db['OpenchannelQueueReport'][_0x8ad6('0x113')](db['OpenchannelInteraction'],{});db[_0x8ad6('0x60')]['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{});db[_0x8ad6('0x60')][_0x8ad6('0x113')](db[_0x8ad6('0x125')],{});db[_0x8ad6('0x61')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x17b'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x8ad6('0x61')][_0x8ad6('0x113')](db['ChatQueue'],{'as':_0x8ad6('0x17c'),'foreignKey':_0x8ad6('0x17d'),'onDelete':'restrict'});db[_0x8ad6('0x61')][_0x8ad6('0x113')](db[_0x8ad6('0x5e')],{'as':'Website','foreignKey':_0x8ad6('0x177'),'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x61')][_0x8ad6('0x113')](db[_0x8ad6('0x8a')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':'TagId'});db[_0x8ad6('0x63')][_0x8ad6('0x104')](db[_0x8ad6('0x17a')],{'as':'Messages','onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x17e')});db['ChatInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x5e')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x177')});db[_0x8ad6('0x63')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e')});db['ChatInteraction']['belongsTo'](db[_0x8ad6('0x11')],{'as':'Owner','foreignKey':_0x8ad6('0x102')});db[_0x8ad6('0x63')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x8ad6('0x63')][_0x8ad6('0x115')](db['Tag'],{'through':_0x8ad6('0x17f'),'as':'ThroughTags'});db[_0x8ad6('0x63')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x15b'),'through':_0x8ad6('0x180'),'foreignKey':_0x8ad6('0x17e')});db['ChatMessage'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x11')});db[_0x8ad6('0x17a')]['belongsTo'](db['CmContact'],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x14d'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x8ad6('0x63')],{'onDelete':'cascade','as':_0x8ad6('0x169'),'foreignKey':_0x8ad6('0x17e')});db[_0x8ad6('0x17a')][_0x8ad6('0x113')](db[_0x8ad6('0xe4')],{'as':_0x8ad6('0xe4'),'foreignKey':_0x8ad6('0x16a')});db[_0x8ad6('0x17a')][_0x8ad6('0x113')](db[_0x8ad6('0x5e')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x177')});db['ChatOfflineMessage'][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e')});db[_0x8ad6('0x66')]['belongsTo'](db[_0x8ad6('0x5e')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x177')});db[_0x8ad6('0x122')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x2f'),'hooks':!![]});db[_0x8ad6('0x122')][_0x8ad6('0x115')](db[_0x8ad6('0xde')],{'through':_0x8ad6('0x181'),'as':_0x8ad6('0x146')});db['ChatGroup'][_0x8ad6('0x104')](db[_0x8ad6('0xce')],{'as':_0x8ad6('0x149'),'foreignKey':_0x8ad6('0x182'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x68')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x183'),'through':_0x8ad6('0x117')});db[_0x8ad6('0x178')][_0x8ad6('0x113')](db[_0x8ad6('0x5e')],{'as':_0x8ad6('0x184'),'foreignKey':'ChatWebsiteId'});db[_0x8ad6('0x6b')][_0x8ad6('0x104')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x185'),'foreignKey':_0x8ad6('0x186')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db['CmHopper'],{'as':_0x8ad6('0x13b'),'foreignKey':_0x8ad6('0x14e')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db[_0x8ad6('0x73')],{'as':'HopperFinals','foreignKey':_0x8ad6('0x14e')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db['CmHopperHistory'],{'as':_0x8ad6('0x13c'),'foreignKey':_0x8ad6('0x14e')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db[_0x8ad6('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x8ad6('0x14e')});db['CmContact'][_0x8ad6('0x104')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x8ad6('0x14e')});db['CmContact'][_0x8ad6('0x104')](db[_0x8ad6('0x10a')],{'as':_0x8ad6('0x10b'),'foreignKey':'ContactId','onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db[_0x8ad6('0x63')],{'as':_0x8ad6('0x10c'),'foreignKey':_0x8ad6('0x14e'),'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db[_0x8ad6('0x54')],{'as':'SmsInteractions','foreignKey':_0x8ad6('0x14e'),'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x6d')]['hasMany'](db[_0x8ad6('0x4a')],{'as':_0x8ad6('0x10e'),'foreignKey':_0x8ad6('0x14e'),'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x6d')][_0x8ad6('0x104')](db[_0x8ad6('0x3e')],{'as':_0x8ad6('0x10f'),'foreignKey':_0x8ad6('0x14e'),'onDelete':'restrict'});db[_0x8ad6('0x6d')][_0x8ad6('0x113')](db['CmCompany'],{'as':_0x8ad6('0x187'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x6d')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':'Users','through':_0x8ad6('0x118')});db[_0x8ad6('0x6d')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'as':_0x8ad6('0x167'),'through':_0x8ad6('0x188')});db['CmContact'][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x188'),'as':_0x8ad6('0x15a')});db[_0x8ad6('0x6f')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x6f')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x8ad6('0x11')],{'as':'Agent','foreignKey':'UserId'});db[_0x8ad6('0x6f')][_0x8ad6('0x113')](db[_0x8ad6('0x19')],{'as':_0x8ad6('0x17c'),'foreignKey':_0x8ad6('0x13a'),'onDelete':'cascade'});db[_0x8ad6('0x6f')]['belongsTo'](db[_0x8ad6('0xe2')],{'as':_0x8ad6('0xe2'),'foreignKey':_0x8ad6('0x189'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x6f')]['belongsTo'](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x158'),'foreignKey':_0x8ad6('0x18a')});db[_0x8ad6('0x71')]['belongsTo'](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x71')][_0x8ad6('0x113')](db['CmList'],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e'),'onDelete':_0x8ad6('0x101')});db['CmHopperBlack'][_0x8ad6('0x113')](db[_0x8ad6('0x19')],{'as':_0x8ad6('0x17c'),'foreignKey':_0x8ad6('0x13a'),'onDelete':_0x8ad6('0x101')});db['CmHopperBlack'][_0x8ad6('0x113')](db[_0x8ad6('0xe2')],{'as':'Campaign','foreignKey':_0x8ad6('0x189'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x7b')][_0x8ad6('0x104')](db[_0x8ad6('0x18b')],{'as':{'plural':_0x8ad6('0x18c'),'singular':_0x8ad6('0x18d')},'foreignKey':'AutomationAllId','onDelete':_0x8ad6('0x101'),'hooks':!![]});db[_0x8ad6('0x7b')]['hasMany'](db[_0x8ad6('0x18b')],{'as':{'plural':'Any','singular':_0x8ad6('0x18e')},'foreignKey':'AutomationAnyId','onDelete':_0x8ad6('0x101'),'hooks':!![]});db[_0x8ad6('0x7b')][_0x8ad6('0x104')](db[_0x8ad6('0x79')],{'as':_0x8ad6('0x18f'),'foreignKey':_0x8ad6('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x8ad6('0x80')][_0x8ad6('0x104')](db[_0x8ad6('0x80')],{'as':_0x8ad6('0x191'),'foreignKey':_0x8ad6('0x142'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x8ad6('0x80')][_0x8ad6('0x104')](db[_0x8ad6('0x17')],{'as':_0x8ad6('0x107'),'foreignKey':'IntervalId','onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x80')][_0x8ad6('0x104')](db[_0x8ad6('0x41')],{'as':_0x8ad6('0x192'),'foreignKey':_0x8ad6('0x142')});db[_0x8ad6('0x80')][_0x8ad6('0x104')](db[_0x8ad6('0x61')],{'as':_0x8ad6('0x193'),'foreignKey':'IntervalId'});db[_0x8ad6('0x80')][_0x8ad6('0x104')](db[_0x8ad6('0x48')],{'as':_0x8ad6('0x194'),'foreignKey':_0x8ad6('0x142')});db['Interval'][_0x8ad6('0x104')](db[_0x8ad6('0x52')],{'as':_0x8ad6('0x195'),'foreignKey':_0x8ad6('0x142')});db['Schedule'][_0x8ad6('0x113')](db[_0x8ad6('0x12d')],{});db[_0x8ad6('0x86')][_0x8ad6('0x113')](db[_0x8ad6('0x196')],{'foreignKey':_0x8ad6('0x197')});db[_0x8ad6('0x86')]['belongsTo'](db[_0x8ad6('0x94')],{'foreignKey':'CustomReportId'});db[_0x8ad6('0x88')][_0x8ad6('0x115')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x8ad6('0x139'),'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x8a')][_0x8ad6('0x115')](db[_0x8ad6('0x6d')],{'through':_0x8ad6('0x188')});db['Tag'][_0x8ad6('0x115')](db[_0x8ad6('0x63')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x8ad6('0x115')](db[_0x8ad6('0x3e')],{'through':_0x8ad6('0x159')});db['Tag'][_0x8ad6('0x115')](db[_0x8ad6('0x54')],{'through':_0x8ad6('0x16e')});db['Tag'][_0x8ad6('0x115')](db['FaxInteraction'],{'through':_0x8ad6('0x166')});db['Tag'][_0x8ad6('0x115')](db[_0x8ad6('0x10a')],{'through':'openchannel_interaction_has_tags'});db[_0x8ad6('0x8a')][_0x8ad6('0x115')](db[_0x8ad6('0xf7')],{'through':_0x8ad6('0x198')});db[_0x8ad6('0x8e')][_0x8ad6('0x104')](db['Condition'],{'as':{'plural':_0x8ad6('0x199'),'singular':'AllCondition'},'foreignKey':_0x8ad6('0x19a'),'onDelete':_0x8ad6('0x101'),'hooks':!![]});db[_0x8ad6('0x8e')][_0x8ad6('0x104')](db['Condition'],{'as':{'plural':_0x8ad6('0x19b'),'singular':_0x8ad6('0x19c')},'foreignKey':_0x8ad6('0x19d'),'onDelete':_0x8ad6('0x101'),'hooks':!![]});db[_0x8ad6('0x8e')][_0x8ad6('0x104')](db[_0x8ad6('0x79')],{'as':_0x8ad6('0x18f'),'foreignKey':_0x8ad6('0x19e'),'onDelete':_0x8ad6('0x101'),'hooks':!![]});db[_0x8ad6('0x94')][_0x8ad6('0x104')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8ad6('0x19f'),'hooks':!![]});db[_0x8ad6('0x196')][_0x8ad6('0x104')](db[_0x8ad6('0x1a0')],{'as':_0x8ad6('0x1a1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x8ad6('0x99')][_0x8ad6('0x104')](db['AnalyticFieldReport'],{'as':_0x8ad6('0x1a1'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a2')});db[_0x8ad6('0x1a0')][_0x8ad6('0x113')](db[_0x8ad6('0x99')],{'foreignKey':_0x8ad6('0x1a2')});db['SalesforceAccount'][_0x8ad6('0x104')](db[_0x8ad6('0xa0')],{'as':_0x8ad6('0x1a3'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a4')});db['SalesforceConfiguration'][_0x8ad6('0x104')](db['SalesforceField'],{'as':_0x8ad6('0x1a5'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a6')});db['SalesforceConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0xa2')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xa0')]['hasMany'](db[_0x8ad6('0xa2')],{'as':_0x8ad6('0x1a1'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a8')});db['SalesforceConfiguration'][_0x8ad6('0x113')](db[_0x8ad6('0x9e')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0xa2')][_0x8ad6('0x104')](db[_0x8ad6('0xa2')],{'as':_0x8ad6('0x1a9'),'foreignKey':_0x8ad6('0x1a6')});db['SalesforceField'][_0x8ad6('0x104')](db[_0x8ad6('0xa2')],{'as':_0x8ad6('0x1aa'),'foreignKey':_0x8ad6('0x1a7')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x8ad6('0x1ab'),'foreignKey':_0x8ad6('0x1a8')});db['SalesforceField'][_0x8ad6('0x113')](db[_0x8ad6('0x1ac')],{'as':_0x8ad6('0x1ac'),'foreignKey':_0x8ad6('0x1ad')});db[_0x8ad6('0xa4')][_0x8ad6('0x104')](db[_0x8ad6('0x1ae')],{'as':_0x8ad6('0x1a3'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a4')});db['SugarcrmConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0x1af')],{'as':_0x8ad6('0x1a5'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a6')});db['SugarcrmConfiguration']['hasMany'](db[_0x8ad6('0x1af')],{'as':_0x8ad6('0x1b0'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0x1ae')][_0x8ad6('0x104')](db[_0x8ad6('0x1af')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8ad6('0x1a8')});db['SugarcrmConfiguration']['belongsTo'](db[_0x8ad6('0xa4')],{'as':_0x8ad6('0x157'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x8ad6('0x104')](db[_0x8ad6('0x1af')],{'as':'Subject','foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0x1af')][_0x8ad6('0x104')](db[_0x8ad6('0x1af')],{'as':'Description','foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0x1af')]['hasMany'](db[_0x8ad6('0x1af')],{'as':_0x8ad6('0x1ab'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0x1af')][_0x8ad6('0x113')](db[_0x8ad6('0x1ac')],{'as':_0x8ad6('0x1ac'),'foreignKey':'VariableId'});db[_0x8ad6('0xa6')][_0x8ad6('0x104')](db[_0x8ad6('0x1b1')],{'as':_0x8ad6('0x1a3'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0x1b1')][_0x8ad6('0x104')](db[_0x8ad6('0xa9')],{'as':_0x8ad6('0x1a5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8ad6('0x1b1')][_0x8ad6('0x104')](db[_0x8ad6('0xa9')],{'as':_0x8ad6('0x1b0'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0x1b1')][_0x8ad6('0x104')](db[_0x8ad6('0xa9')],{'as':'Fields','onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0x1b1')][_0x8ad6('0x113')](db[_0x8ad6('0xa6')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0x1b1')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x1b2')});db[_0x8ad6('0xa9')][_0x8ad6('0x104')](db[_0x8ad6('0xa9')],{'as':'Subject','foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xa9')][_0x8ad6('0x104')](db[_0x8ad6('0xa9')],{'as':_0x8ad6('0x1aa'),'foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xa9')][_0x8ad6('0x104')](db[_0x8ad6('0xa9')],{'as':_0x8ad6('0x1ab'),'foreignKey':_0x8ad6('0x1a8')});db['DeskField'][_0x8ad6('0x113')](db['Variable'],{'as':_0x8ad6('0x1ac'),'foreignKey':_0x8ad6('0x1ad')});db[_0x8ad6('0xaa')][_0x8ad6('0x104')](db[_0x8ad6('0xac')],{'as':_0x8ad6('0x1a3'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0xac')]['hasMany'](db[_0x8ad6('0xae')],{'as':_0x8ad6('0x1a5'),'onDelete':_0x8ad6('0x101'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0xae')],{'as':_0x8ad6('0x1b0'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0xae')],{'as':_0x8ad6('0x1a1'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xac')][_0x8ad6('0x113')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x8ad6('0x1a4')});db['ZohoField'][_0x8ad6('0x104')](db[_0x8ad6('0xae')],{'as':_0x8ad6('0x1a9'),'foreignKey':'SubjectId'});db[_0x8ad6('0xae')]['hasMany'](db[_0x8ad6('0xae')],{'as':_0x8ad6('0x1aa'),'foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xae')][_0x8ad6('0x104')](db[_0x8ad6('0xae')],{'as':_0x8ad6('0x1ab'),'foreignKey':'FieldId'});db[_0x8ad6('0xae')][_0x8ad6('0x113')](db[_0x8ad6('0x1ac')],{'as':_0x8ad6('0x1ac'),'foreignKey':_0x8ad6('0x1ad')});db[_0x8ad6('0x1b3')][_0x8ad6('0x104')](db[_0x8ad6('0xb1')],{'as':'Configurations','onDelete':_0x8ad6('0x101'),'foreignKey':'AccountId'});db[_0x8ad6('0xb1')][_0x8ad6('0x104')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xb1')][_0x8ad6('0x104')](db[_0x8ad6('0x1b4')],{'as':_0x8ad6('0x1b0'),'foreignKey':_0x8ad6('0x1a7')});db['ZendeskConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0x1b4')],{'as':_0x8ad6('0x1a1'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xb1')]['belongsTo'](db[_0x8ad6('0x1b3')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0xb1')][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x1b5')});db[_0x8ad6('0x1b4')][_0x8ad6('0x104')](db[_0x8ad6('0x1b4')],{'as':'Subject','foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0x1b4')][_0x8ad6('0x104')](db[_0x8ad6('0x1b4')],{'as':_0x8ad6('0x1aa'),'foreignKey':'DescriptionId'});db[_0x8ad6('0x1b4')][_0x8ad6('0x104')](db[_0x8ad6('0x1b4')],{'as':'Field','foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0x1b4')][_0x8ad6('0x113')](db['Variable'],{'as':_0x8ad6('0x1ac'),'foreignKey':'VariableId'});db[_0x8ad6('0xb3')][_0x8ad6('0x104')](db[_0x8ad6('0xb4')],{'as':_0x8ad6('0x1a3'),'onDelete':_0x8ad6('0x101'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0x1b6')],{'as':_0x8ad6('0x1a5'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xb4')][_0x8ad6('0x104')](db[_0x8ad6('0x1b6')],{'as':'Descriptions','onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xb4')][_0x8ad6('0x104')](db[_0x8ad6('0x1b6')],{'as':_0x8ad6('0x1a1'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xb4')][_0x8ad6('0x113')](db[_0x8ad6('0xb3')],{'as':_0x8ad6('0x157'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x1b7')});db[_0x8ad6('0x1b6')][_0x8ad6('0x104')](db[_0x8ad6('0x1b6')],{'as':_0x8ad6('0x1a9'),'foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0x1b6')]['hasMany'](db[_0x8ad6('0x1b6')],{'as':_0x8ad6('0x1aa'),'foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0x1b6')]['hasMany'](db[_0x8ad6('0x1b6')],{'as':'Field','foreignKey':_0x8ad6('0x1a8')});db['FreshdeskField'][_0x8ad6('0x113')](db[_0x8ad6('0x1ac')],{'as':_0x8ad6('0x1ac'),'foreignKey':'VariableId'});db[_0x8ad6('0xb7')][_0x8ad6('0x104')](db[_0x8ad6('0xb9')],{'as':_0x8ad6('0x1a3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8ad6('0xb9')][_0x8ad6('0x104')](db[_0x8ad6('0xba')],{'as':'Subjects','foreignKey':_0x8ad6('0x1a6')});db['VtigerConfiguration']['hasMany'](db[_0x8ad6('0xba')],{'as':'Descriptions','foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xb9')][_0x8ad6('0x104')](db[_0x8ad6('0xba')],{'as':_0x8ad6('0x1a1'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xb9')]['belongsTo'](db['VtigerAccount'],{'as':_0x8ad6('0x157'),'foreignKey':'AccountId'});db[_0x8ad6('0xba')][_0x8ad6('0x104')](db[_0x8ad6('0xba')],{'as':_0x8ad6('0x1a9'),'foreignKey':_0x8ad6('0x1a6')});db['VtigerField'][_0x8ad6('0x104')](db[_0x8ad6('0xba')],{'as':_0x8ad6('0x1aa'),'foreignKey':'DescriptionId'});db[_0x8ad6('0xba')][_0x8ad6('0x104')](db[_0x8ad6('0xba')],{'as':_0x8ad6('0x1ab'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xba')][_0x8ad6('0x113')](db[_0x8ad6('0x1ac')],{'as':_0x8ad6('0x1ac'),'foreignKey':_0x8ad6('0x1ad')});db[_0x8ad6('0xbc')][_0x8ad6('0x104')](db[_0x8ad6('0xbe')],{'as':_0x8ad6('0x1a3'),'onDelete':'cascade','foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0xbe')]['hasMany'](db[_0x8ad6('0xc0')],{'as':_0x8ad6('0x1a5'),'foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xbe')][_0x8ad6('0x104')](db[_0x8ad6('0xc0')],{'as':_0x8ad6('0x1b0'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0xc0')],{'as':_0x8ad6('0x1a1'),'foreignKey':_0x8ad6('0x1a8')});db['ServicenowConfiguration']['belongsTo'](db['ServicenowAccount'],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x1a4')});db['ServicenowField']['hasMany'](db[_0x8ad6('0xc0')],{'as':_0x8ad6('0x1a9'),'foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xc0')]['hasMany'](db[_0x8ad6('0xc0')],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x8ad6('0x1ab'),'foreignKey':_0x8ad6('0x1a8')});db['ServicenowField']['belongsTo'](db[_0x8ad6('0x1ac')],{'as':_0x8ad6('0x1ac'),'foreignKey':_0x8ad6('0x1ad')});db['Dynamics365Account'][_0x8ad6('0x104')](db[_0x8ad6('0xc4')],{'as':_0x8ad6('0x1a3'),'onDelete':_0x8ad6('0x101'),'foreignKey':'AccountId'});db[_0x8ad6('0xc4')][_0x8ad6('0x104')](db[_0x8ad6('0xc6')],{'as':'Subjects','onDelete':_0x8ad6('0x101'),'foreignKey':'SubjectId'});db[_0x8ad6('0xc4')][_0x8ad6('0x104')](db['Dynamics365Field'],{'as':_0x8ad6('0x1b0'),'onDelete':_0x8ad6('0x101'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x8ad6('0x104')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xc4')][_0x8ad6('0x113')](db[_0x8ad6('0xc2')],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x1a4')});db[_0x8ad6('0xc6')][_0x8ad6('0x104')](db[_0x8ad6('0xc6')],{'as':_0x8ad6('0x1a9'),'foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xc6')][_0x8ad6('0x104')](db[_0x8ad6('0xc6')],{'as':_0x8ad6('0x1aa'),'foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xc6')]['hasMany'](db[_0x8ad6('0xc6')],{'as':'Field','foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xc6')]['belongsTo'](db['Variable'],{'as':_0x8ad6('0x1ac'),'foreignKey':_0x8ad6('0x1ad')});db['FreshsalesAccount'][_0x8ad6('0x104')](db[_0x8ad6('0xc9')],{'as':_0x8ad6('0x1a3'),'onDelete':_0x8ad6('0x101'),'foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0x8ad6('0xca')],{'as':_0x8ad6('0x1a5'),'foreignKey':_0x8ad6('0x1a6')});db['FreshsalesConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0xca')],{'as':_0x8ad6('0x1b0'),'foreignKey':_0x8ad6('0x1a7')});db['FreshsalesConfiguration'][_0x8ad6('0x104')](db[_0x8ad6('0xca')],{'as':_0x8ad6('0x1a1'),'foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xc9')][_0x8ad6('0x113')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x8ad6('0x1a4')});db['FreshsalesField'][_0x8ad6('0x104')](db[_0x8ad6('0xca')],{'as':'Subject','foreignKey':_0x8ad6('0x1a6')});db[_0x8ad6('0xca')][_0x8ad6('0x104')](db[_0x8ad6('0xca')],{'as':'Description','foreignKey':_0x8ad6('0x1a7')});db[_0x8ad6('0xca')][_0x8ad6('0x104')](db[_0x8ad6('0xca')],{'as':'Field','foreignKey':_0x8ad6('0x1a8')});db[_0x8ad6('0xca')][_0x8ad6('0x113')](db['Variable'],{'as':_0x8ad6('0x1ac'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x8ad6('0x113')](db[_0x8ad6('0x5e')],{});db[_0x8ad6('0x1b8')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x1b8')][_0x8ad6('0x113')](db['CmContact'],{'as':_0x8ad6('0x14d'),'foreignKey':_0x8ad6('0x14e')});db['ChatQueueReport'][_0x8ad6('0x113')](db['ChatInteraction'],{});db[_0x8ad6('0x1b8')][_0x8ad6('0x113')](db[_0x8ad6('0x17a')],{});db[_0x8ad6('0x1b8')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{});db[_0x8ad6('0x1b8')][_0x8ad6('0x113')](db[_0x8ad6('0x122')],{});db[_0x8ad6('0xce')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0x8ad6('0x1b9')});db[_0x8ad6('0xce')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':'cascade','foreignKey':_0x8ad6('0x1ba')});db[_0x8ad6('0x13e')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x8ad6('0x1bb'),'onDelete':'cascade'});db[_0x8ad6('0x13e')]['hasMany'](db[_0x8ad6('0xcf')],{'foreignKey':'SessionId','onDelete':_0x8ad6('0x101')});db[_0x8ad6('0x1bc')]['belongsTo'](db['SmsAccount'],{});db[_0x8ad6('0x1bc')]['belongsTo'](db['CmList'],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x1bc')][_0x8ad6('0x113')](db['CmContact'],{'as':'Contact','foreignKey':_0x8ad6('0x14e')});db[_0x8ad6('0x1bc')][_0x8ad6('0x113')](db[_0x8ad6('0x54')],{});db['SmsQueueReport'][_0x8ad6('0x113')](db['SmsMessage'],{});db[_0x8ad6('0x1bc')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{});db[_0x8ad6('0x1bc')]['belongsTo'](db[_0x8ad6('0x58')],{});db['JscriptyProject'][_0x8ad6('0x104')](db[_0x8ad6('0x13e')],{'foreignKey':_0x8ad6('0x1bd')});db['JscriptyProject'][_0x8ad6('0x104')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x8ad6('0x1be')]['hasMany'](db[_0x8ad6('0xcf')],{'foreignKey':_0x8ad6('0x1bd')});db[_0x8ad6('0xda')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x15b'),'through':_0x8ad6('0x1bf')});db[_0x8ad6('0xde')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x11b')});db[_0x8ad6('0xde')][_0x8ad6('0x115')](db[_0x8ad6('0x19')],{'through':_0x8ad6('0x147'),'as':_0x8ad6('0x1c0')});db[_0x8ad6('0xde')][_0x8ad6('0x115')](db['MailQueue'],{'through':_0x8ad6('0x155'),'as':_0x8ad6('0x120')});db[_0x8ad6('0xde')]['belongsToMany'](db[_0x8ad6('0x122')],{'through':_0x8ad6('0x181'),'as':_0x8ad6('0x123')});db[_0x8ad6('0xde')][_0x8ad6('0x115')](db[_0x8ad6('0x4e')],{'through':'team_has_fax_queues','as':_0x8ad6('0x1c1')});db[_0x8ad6('0xde')]['belongsToMany'](db[_0x8ad6('0x58')],{'through':'team_has_sms_queues','as':_0x8ad6('0x124')});db['Team'][_0x8ad6('0x115')](db[_0x8ad6('0x125')],{'through':_0x8ad6('0x1c2'),'as':_0x8ad6('0x126')});db[_0x8ad6('0xde')][_0x8ad6('0x115')](db[_0x8ad6('0xfd')],{'through':_0x8ad6('0x1c3'),'as':'WhatsappQueues'});db[_0x8ad6('0xe2')]['hasMany'](db[_0x8ad6('0x6f')],{'as':_0x8ad6('0x13b'),'foreignKey':_0x8ad6('0x189')});db['Campaign'][_0x8ad6('0x104')](db[_0x8ad6('0x73')],{'as':_0x8ad6('0x108'),'foreignKey':'CampaignId'});db['Campaign'][_0x8ad6('0x104')](db[_0x8ad6('0x75')],{'as':'HopperHistories','foreignKey':_0x8ad6('0x189')});db[_0x8ad6('0xe2')][_0x8ad6('0x104')](db[_0x8ad6('0x71')],{'as':_0x8ad6('0x13d'),'foreignKey':'CampaignId'});db[_0x8ad6('0xe2')][_0x8ad6('0x113')](db['Trunk'],{'as':_0x8ad6('0x140'),'foreignKey':_0x8ad6('0x141')});db[_0x8ad6('0xe2')]['belongsTo'](db[_0x8ad6('0x140')],{'as':_0x8ad6('0x1c4'),'foreignKey':_0x8ad6('0x1c5')});db[_0x8ad6('0xe2')][_0x8ad6('0x113')](db['Interval'],{'as':_0x8ad6('0x80'),'foreignKey':'IntervalId'});db[_0x8ad6('0xe2')][_0x8ad6('0x113')](db[_0x8ad6('0xda')],{'as':_0x8ad6('0xda'),'foreignKey':_0x8ad6('0x1c6')});db[_0x8ad6('0xe2')][_0x8ad6('0x115')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x144'),'through':_0x8ad6('0x1c7')});db['Campaign'][_0x8ad6('0x115')](db[_0x8ad6('0x119')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x8ad6('0xe6')]['belongsTo'](db[_0x8ad6('0x40')],{});db[_0x8ad6('0xe6')]['belongsTo'](db[_0x8ad6('0x3e')],{});db[_0x8ad6('0xe6')][_0x8ad6('0x113')](db['MailAccount'],{'foreignKey':_0x8ad6('0x1c8'),'as':_0x8ad6('0x1c9')});db[_0x8ad6('0xe6')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1ca'),'as':'FromAgent'});db[_0x8ad6('0xe6')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8ad6('0xe6')][_0x8ad6('0x113')](db[_0x8ad6('0x11f')],{'foreignKey':_0x8ad6('0x1cb'),'as':_0x8ad6('0x1cc')});db[_0x8ad6('0xe6')][_0x8ad6('0x113')](db['MailAccount'],{'foreignKey':_0x8ad6('0x1cd'),'as':_0x8ad6('0x1ce')});db[_0x8ad6('0xe8')][_0x8ad6('0x113')](db[_0x8ad6('0x17a')],{});db[_0x8ad6('0xe8')][_0x8ad6('0x113')](db[_0x8ad6('0x63')],{});db['ChatTransferReport'][_0x8ad6('0x113')](db[_0x8ad6('0x5e')],{'foreignKey':_0x8ad6('0x1cf'),'as':'FromAccount'});db[_0x8ad6('0xe8')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1ca'),'as':_0x8ad6('0x1d0')});db[_0x8ad6('0xe8')][_0x8ad6('0x113')](db['User'],{'foreignKey':_0x8ad6('0x1d1'),'as':'ToAgent'});db[_0x8ad6('0xe8')][_0x8ad6('0x113')](db[_0x8ad6('0x122')],{'foreignKey':_0x8ad6('0x1d2'),'as':_0x8ad6('0x1cc')});db[_0x8ad6('0xe8')]['belongsTo'](db[_0x8ad6('0x5e')],{'foreignKey':'ToChatWebsiteId','as':_0x8ad6('0x1ce')});db[_0x8ad6('0x1d3')][_0x8ad6('0x113')](db[_0x8ad6('0x4c')],{});db[_0x8ad6('0x1d3')]['belongsTo'](db[_0x8ad6('0x4a')],{});db[_0x8ad6('0x1d3')][_0x8ad6('0x113')](db['FaxAccount'],{'foreignKey':_0x8ad6('0x1d4'),'as':'FromAccount'});db[_0x8ad6('0x1d3')]['belongsTo'](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1ca'),'as':_0x8ad6('0x1d0')});db['FaxTransferReport'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1d1'),'as':_0x8ad6('0x1d5')});db[_0x8ad6('0x1d3')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x8ad6('0x1d6'),'as':'ToQueue'});db['FaxTransferReport'][_0x8ad6('0x113')](db[_0x8ad6('0x46')],{'foreignKey':_0x8ad6('0x1d7'),'as':'ToAccount'});db[_0x8ad6('0x1d8')][_0x8ad6('0x113')](db[_0x8ad6('0x5b')],{});db[_0x8ad6('0x1d8')][_0x8ad6('0x113')](db['OpenchannelInteraction'],{});db[_0x8ad6('0x1d8')][_0x8ad6('0x113')](db[_0x8ad6('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x8ad6('0x1c9')});db[_0x8ad6('0x1d8')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1ca'),'as':_0x8ad6('0x1d0')});db[_0x8ad6('0x1d8')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1d1'),'as':_0x8ad6('0x1d5')});db[_0x8ad6('0x1d8')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x8ad6('0x1d9'),'as':_0x8ad6('0x1cc')});db[_0x8ad6('0x1d8')][_0x8ad6('0x113')](db[_0x8ad6('0x59')],{'foreignKey':_0x8ad6('0x1da'),'as':_0x8ad6('0x1ce')});db[_0x8ad6('0x1db')]['belongsTo'](db[_0x8ad6('0x56')],{});db[_0x8ad6('0x1db')][_0x8ad6('0x113')](db[_0x8ad6('0x54')],{});db[_0x8ad6('0x1db')]['belongsTo'](db[_0x8ad6('0x131')],{'foreignKey':_0x8ad6('0x1dc'),'as':'FromAccount'});db['SmsTransferReport'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':'FromUserId','as':_0x8ad6('0x1d0')});db['SmsTransferReport'][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1d1'),'as':_0x8ad6('0x1d5')});db[_0x8ad6('0x1db')][_0x8ad6('0x113')](db[_0x8ad6('0x58')],{'foreignKey':_0x8ad6('0x1dd'),'as':'ToQueue'});db['SmsTransferReport'][_0x8ad6('0x113')](db['SmsAccount'],{'foreignKey':_0x8ad6('0x1de'),'as':'ToAccount'});db[_0x8ad6('0x119')][_0x8ad6('0x104')](db[_0x8ad6('0x7e')],{'as':'Dispositions','foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x119')]['hasMany'](db[_0x8ad6('0x1df')],{'as':_0x8ad6('0x1e0'),'foreignKey':_0x8ad6('0x15e')});db['CmList'][_0x8ad6('0x104')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x185'),'onDelete':_0x8ad6('0x101'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x119')][_0x8ad6('0x104')](db[_0x8ad6('0x73')],{'as':_0x8ad6('0x108'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x119')][_0x8ad6('0x104')](db[_0x8ad6('0x75')],{'as':_0x8ad6('0x109'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x119')][_0x8ad6('0x104')](db[_0x8ad6('0x76')],{'as':_0x8ad6('0x76'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0x119')][_0x8ad6('0x115')](db['VoiceQueue'],{'as':_0x8ad6('0x1e1'),'through':_0x8ad6('0x1e2')});db[_0x8ad6('0x119')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x11a')});db[_0x8ad6('0xed')][_0x8ad6('0x104')](db[_0x8ad6('0x17')],{'as':_0x8ad6('0x107'),'onDelete':'cascade'});db[_0x8ad6('0xed')][_0x8ad6('0x115')](db['User'],{'as':'Agents','through':'user_has_voice_prefixes'});db[_0x8ad6('0xee')][_0x8ad6('0x104')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x15b'),'foreignKey':_0x8ad6('0x114')});db[_0x8ad6('0xee')][_0x8ad6('0x104')](db[_0x8ad6('0xf0')],{'as':_0x8ad6('0x1e3'),'foreignKey':_0x8ad6('0x114'),'onDelete':_0x8ad6('0x101')});db[_0x8ad6('0xf0')][_0x8ad6('0x104')](db[_0x8ad6('0xf2')],{'as':_0x8ad6('0x1e4'),'foreignKey':_0x8ad6('0x1e5'),'onDelete':_0x8ad6('0x101')});db['WhatsappAccount'][_0x8ad6('0x104')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8ad6('0x1e6')});db[_0x8ad6('0xf5')][_0x8ad6('0x104')](db[_0x8ad6('0x152')],{'as':_0x8ad6('0x160'),'foreignKey':'WhatsappAccountId'});db[_0x8ad6('0xf5')][_0x8ad6('0x104')](db[_0x8ad6('0xf8')],{'as':'Messages','foreignKey':_0x8ad6('0x1e6')});db['WhatsappAccount'][_0x8ad6('0x104')](db[_0x8ad6('0xf7')],{'as':'Interactions'});db['WhatsappAccount'][_0x8ad6('0x104')](db['WhatsappApplication'],{'as':_0x8ad6('0x162')});db[_0x8ad6('0xf5')][_0x8ad6('0x113')](db[_0x8ad6('0x119')],{'as':_0x8ad6('0x164'),'foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0xf5')][_0x8ad6('0x113')](db['Pause'],{'as':_0x8ad6('0x154'),'foreignKey':_0x8ad6('0x143')});db[_0x8ad6('0xf5')][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x135')});db[_0x8ad6('0x1e7')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'onDelete':_0x8ad6('0x15c')});db['WhatsappApplication']['belongsTo'](db[_0x8ad6('0xfd')],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x1e7')][_0x8ad6('0x113')](db['WhatsappAccount'],{'onDelete':_0x8ad6('0x15c')});db[_0x8ad6('0x1e7')][_0x8ad6('0x113')](db[_0x8ad6('0x80')],{'onDelete':_0x8ad6('0x15c'),'foreignKey':'IntervalId'});db['WhatsappApplication'][_0x8ad6('0x113')](db['Tag'],{'onDelete':_0x8ad6('0x15c'),'foreignKey':'TagId'});db[_0x8ad6('0xf7')][_0x8ad6('0x104')](db['WhatsappMessage'],{'as':_0x8ad6('0x149'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x8ad6('0xf7')][_0x8ad6('0x113')](db['WhatsappAccount'],{'as':_0x8ad6('0x157'),'foreignKey':_0x8ad6('0x1e6')});db['WhatsappInteraction'][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':_0x8ad6('0x14d'),'foreignKey':'ContactId'});db[_0x8ad6('0xf7')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x158'),'foreignKey':'UserId'});db[_0x8ad6('0xf7')][_0x8ad6('0x115')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x8ad6('0x167')});db['WhatsappInteraction'][_0x8ad6('0x115')](db[_0x8ad6('0x8a')],{'through':_0x8ad6('0x198'),'as':_0x8ad6('0x15a')});db['WhatsappInteraction'][_0x8ad6('0x115')](db[_0x8ad6('0x11')],{'as':_0x8ad6('0x15b'),'through':_0x8ad6('0x1e8'),'foreignKey':_0x8ad6('0x1e9')});db[_0x8ad6('0xf8')][_0x8ad6('0x113')](db['User'],{'as':_0x8ad6('0x11')});db[_0x8ad6('0xf8')]['belongsTo'](db['CmContact'],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x14d')});db[_0x8ad6('0xf8')]['belongsTo'](db[_0x8ad6('0xf7')],{'onDelete':_0x8ad6('0x101'),'as':_0x8ad6('0x169'),'foreignKey':_0x8ad6('0x1e9')});db[_0x8ad6('0xf8')][_0x8ad6('0x113')](db['WhatsappAccount'],{'as':_0x8ad6('0x157'),'foreignKey':'WhatsappAccountId'});db[_0x8ad6('0xfa')]['belongsTo'](db['WhatsappAccount'],{});db[_0x8ad6('0xfa')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x8ad6('0x15e')});db[_0x8ad6('0xfa')][_0x8ad6('0x113')](db[_0x8ad6('0x6d')],{'as':'Contact','foreignKey':_0x8ad6('0x14e')});db['WhatsappQueueReport']['belongsTo'](db[_0x8ad6('0xf7')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x8ad6('0xfd')],{});db[_0x8ad6('0xfa')][_0x8ad6('0x113')](db['WhatsappMessage'],{});db[_0x8ad6('0xfa')][_0x8ad6('0x113')](db['User'],{});db[_0x8ad6('0xfb')][_0x8ad6('0x113')](db[_0x8ad6('0xf8')],{});db[_0x8ad6('0xfb')][_0x8ad6('0x113')](db[_0x8ad6('0xf7')],{});db[_0x8ad6('0xfb')][_0x8ad6('0x113')](db[_0x8ad6('0xf5')],{'foreignKey':_0x8ad6('0x1ea'),'as':_0x8ad6('0x1c9')});db['WhatsappTransferReport']['belongsTo'](db[_0x8ad6('0xf5')],{'foreignKey':_0x8ad6('0x1eb'),'as':_0x8ad6('0x1ce')});db['WhatsappTransferReport'][_0x8ad6('0x113')](db[_0x8ad6('0xfd')],{'foreignKey':_0x8ad6('0x1ec'),'as':_0x8ad6('0x1cc')});db[_0x8ad6('0xfb')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1ca'),'as':_0x8ad6('0x1d0')});db[_0x8ad6('0xfb')][_0x8ad6('0x113')](db[_0x8ad6('0x11')],{'foreignKey':_0x8ad6('0x1d1'),'as':_0x8ad6('0x1d5')});db['WhatsappQueue'][_0x8ad6('0x115')](db['User'],{'as':_0x8ad6('0x145'),'through':_0x8ad6('0x1ed'),'foreignKey':'WhatsappQueueId'});db[_0x8ad6('0xfd')][_0x8ad6('0x115')](db[_0x8ad6('0xde')],{'through':'team_has_whatsapp_queues','as':_0x8ad6('0x146')});module[_0x8ad6('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cec261e..5ec40c9 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e4f=['./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','/www','join','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','path','express-winston','util','./errors','./config/logger','api','auth','default','use','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','body','agent_id','format','method','other','agent_name','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./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/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields'];(function(_0x5360c7,_0xd2d58c){var _0x510f7f=function(_0x57ba5c){while(--_0x57ba5c){_0x5360c7['push'](_0x5360c7['shift']());}};_0x510f7f(++_0xd2d58c);}(_0x6e4f,0x181));var _0xf6e4=function(_0x5bc726,_0x11db65){_0x5bc726=_0x5bc726-0x0;var _0x423b5f=_0x6e4f[_0x5bc726];return _0x423b5f;};'use strict';var path=require(_0xf6e4('0x0'));var express=require('express');var ewinston=require(_0xf6e4('0x1'));var util=require(_0xf6e4('0x2'));var errors=require(_0xf6e4('0x3'));var config=require('./config/environment');var logger=require(_0xf6e4('0x4'))(_0xf6e4('0x5'));var authLogger=require('./config/logger')(_0xf6e4('0x6'));exports[_0xf6e4('0x7')]=function(_0x31368b){_0x31368b[_0xf6e4('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x586359,_0x2a7fda){return util['format']('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x586359['method'],_0x586359[_0xf6e4('0x9')][_0xf6e4('0xa')]?_0x586359[_0xf6e4('0x9')]['x-forwarded-for']:_0x586359[_0xf6e4('0xb')][_0xf6e4('0xc')]||_0x586359['ip'],_0x586359[_0xf6e4('0xd')],_0x2a7fda[_0xf6e4('0xe')],_0x2a7fda[_0xf6e4('0xf')],_0x586359[_0xf6e4('0x10')]?_0x586359[_0xf6e4('0x10')]['id']:null,_0x586359[_0xf6e4('0x10')]?_0x586359['user']['name']:null,_0x586359[_0xf6e4('0x10')]?_0x586359[_0xf6e4('0x10')][_0xf6e4('0x11')]:null);}}));_0x31368b[_0xf6e4('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4cdbff,_0x4353a1){var _0x5129a3=_0xf6e4('0x12');if(_0x4cdbff['body']&&_0x4cdbff['body'][_0xf6e4('0x13')]&&_0x4cdbff[_0xf6e4('0x14')][_0xf6e4('0x15')]){_0x5129a3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xf6e4('0x16')](_0x5129a3,_0x4cdbff[_0xf6e4('0x17')],_0x4cdbff['headers'][_0xf6e4('0xa')]?_0x4cdbff[_0xf6e4('0x9')][_0xf6e4('0xa')]:_0x4cdbff[_0xf6e4('0xb')]['remoteAddress']||_0x4cdbff['ip'],_0x4cdbff[_0xf6e4('0xd')],_0x4353a1['statusCode'],_0x4353a1[_0xf6e4('0xf')],_0x4cdbff[_0xf6e4('0x10')]?_0x4cdbff[_0xf6e4('0x10')]['id']:null,_0x4cdbff[_0xf6e4('0x10')]?_0x4cdbff[_0xf6e4('0x10')]['name']:null,_0x4cdbff['user']?_0x4cdbff[_0xf6e4('0x10')][_0xf6e4('0x11')]:null,_0x4cdbff[_0xf6e4('0x14')]&&_0x4cdbff[_0xf6e4('0x14')][_0xf6e4('0x13')]?_0x4cdbff[_0xf6e4('0x14')]['device']:_0xf6e4('0x18'),_0x4cdbff[_0xf6e4('0x14')]&&_0x4cdbff[_0xf6e4('0x14')]['agent_id']?_0x4cdbff[_0xf6e4('0x14')][_0xf6e4('0x15')]:'',_0x4cdbff['body']&&_0x4cdbff[_0xf6e4('0x14')][_0xf6e4('0x19')]?_0x4cdbff[_0xf6e4('0x14')][_0xf6e4('0x19')]:'');},'ignoreRoute':function(_0x4412ef){var _0x58c061=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x58c061['test'](_0x4412ef[_0xf6e4('0xd')]);}}));_0x31368b['use']('/api/users',require('./api/user'));_0x31368b[_0xf6e4('0x8')]('/api/voice/chanspy',require(_0xf6e4('0x1a')));_0x31368b['use'](_0xf6e4('0x1b'),require(_0xf6e4('0x1c')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x1d'),require(_0xf6e4('0x1e')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x1f'),require(_0xf6e4('0x20')));_0x31368b['use'](_0xf6e4('0x21'),require('./api/voiceQueue'));_0x31368b['use']('/api/voice/recordings',require(_0xf6e4('0x22')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x23'),require(_0xf6e4('0x24')));_0x31368b[_0xf6e4('0x8')]('/api/voice/mails',require('./api/voiceMail'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x25'),require('./api/voiceMailMessage'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x26'),require('./api/voiceCallReport'));_0x31368b[_0xf6e4('0x8')]('/api/voice/dials/reports',require(_0xf6e4('0x27')));_0x31368b[_0xf6e4('0x8')]('/api/voice/agents/reports',require(_0xf6e4('0x28')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x29'),require(_0xf6e4('0x2a')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x2b'),require(_0xf6e4('0x2c')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x2d'),require(_0xf6e4('0x2e')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x2f'),require(_0xf6e4('0x30')));_0x31368b['use'](_0xf6e4('0x31'),require('./api/mailServerOut'));_0x31368b['use'](_0xf6e4('0x32'),require('./api/mailAccount'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x33'),require('./api/mailQueue'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x34'),require(_0xf6e4('0x35')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x36'),require(_0xf6e4('0x37')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x38'),require(_0xf6e4('0x39')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x3a'),require('./api/mailApplication'));_0x31368b[_0xf6e4('0x8')]('/api/mail/reports/queue',require(_0xf6e4('0x3b')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x3c'),require(_0xf6e4('0x3d')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x3e'),require(_0xf6e4('0x3f')));_0x31368b[_0xf6e4('0x8')]('/api/fax/accounts',require('./api/faxAccount'));_0x31368b['use'](_0xf6e4('0x40'),require(_0xf6e4('0x41')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x42'),require(_0xf6e4('0x43')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x44'),require('./api/faxMessage'));_0x31368b[_0xf6e4('0x8')]('/api/fax/queues',require(_0xf6e4('0x45')));_0x31368b[_0xf6e4('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x46'),require('./api/smsAccount'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x47'),require('./api/smsApplication'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x48'),require(_0xf6e4('0x49')));_0x31368b['use'](_0xf6e4('0x4a'),require(_0xf6e4('0x4b')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x4c'),require(_0xf6e4('0x4d')));_0x31368b[_0xf6e4('0x8')]('/api/openchannel/accounts',require(_0xf6e4('0x4e')));_0x31368b[_0xf6e4('0x8')]('/api/openchannel/applications',require(_0xf6e4('0x4f')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x50'),require(_0xf6e4('0x51')));_0x31368b['use'](_0xf6e4('0x52'),require(_0xf6e4('0x53')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x54'),require(_0xf6e4('0x55')));_0x31368b['use'](_0xf6e4('0x56'),require(_0xf6e4('0x57')));_0x31368b['use'](_0xf6e4('0x58'),require(_0xf6e4('0x59')));_0x31368b['use'](_0xf6e4('0x5a'),require('./api/chatApplication'));_0x31368b['use'](_0xf6e4('0x5b'),require(_0xf6e4('0x5c')));_0x31368b['use']('/api/chat/messages',require('./api/chatMessage'));_0x31368b['use'](_0xf6e4('0x5d'),require(_0xf6e4('0x5e')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x5f'),require('./api/chatQueue'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x60'),require(_0xf6e4('0x61')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x62'),require('./api/chatProactiveAction'));_0x31368b[_0xf6e4('0x8')]('/api/cm/companies',require('./api/cmCompany'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x63'),require('./api/cmContact'));_0x31368b[_0xf6e4('0x8')]('/api/cm/hopper',require(_0xf6e4('0x64')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x65'),require(_0xf6e4('0x66')));_0x31368b[_0xf6e4('0x8')]('/api/cm/hopper_final',require(_0xf6e4('0x67')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x68'),require('./api/cmHopperHistory'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x69'),require(_0xf6e4('0x6a')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x6b'),require(_0xf6e4('0x6c')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x6d'),require(_0xf6e4('0x6e')));_0x31368b[_0xf6e4('0x8')]('/api/canned_answers',require('./api/cannedAnswer'));_0x31368b[_0xf6e4('0x8')]('/api/dispositions',require(_0xf6e4('0x6f')));_0x31368b[_0xf6e4('0x8')]('/api/conditions',require(_0xf6e4('0x70')));_0x31368b[_0xf6e4('0x8')]('/api/intervals',require(_0xf6e4('0x71')));_0x31368b['use'](_0xf6e4('0x72'),require(_0xf6e4('0x73')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x74'),require(_0xf6e4('0x75')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x76'),require(_0xf6e4('0x77')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x78'),require(_0xf6e4('0x79')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x7a'),require(_0xf6e4('0x7b')));_0x31368b['use']('/api/tags',require(_0xf6e4('0x7c')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x7d'),require('./api/template'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x7e'),require(_0xf6e4('0x7f')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x80'),require('./api/variable'));_0x31368b[_0xf6e4('0x8')]('/api/integrations',require(_0xf6e4('0x81')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x82'),require(_0xf6e4('0x83')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x84'),require(_0xf6e4('0x85')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x86'),require(_0xf6e4('0x87')));_0x31368b[_0xf6e4('0x8')]('/api/analytics/extracted_reports',require(_0xf6e4('0x88')));_0x31368b[_0xf6e4('0x8')]('/api/analytics/metrics',require(_0xf6e4('0x89')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x8a'),require(_0xf6e4('0x8b')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x8c'),require(_0xf6e4('0x8d')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x8e'),require(_0xf6e4('0x8f')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x90'),require(_0xf6e4('0x91')));_0x31368b[_0xf6e4('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x31368b['use'](_0xf6e4('0x92'),require(_0xf6e4('0x93')));_0x31368b[_0xf6e4('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xf6e4('0x94')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x95'),require(_0xf6e4('0x96')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x97'),require(_0xf6e4('0x98')));_0x31368b['use'](_0xf6e4('0x99'),require(_0xf6e4('0x9a')));_0x31368b['use'](_0xf6e4('0x9b'),require('./api/intDeskField'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x9c'),require(_0xf6e4('0x9d')));_0x31368b[_0xf6e4('0x8')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x9e'),require('./api/intZohoField'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x9f'),require(_0xf6e4('0xa0')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xa1'),require('./api/intZendeskConfiguration'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xa2'),require('./api/intZendeskField'));_0x31368b[_0xf6e4('0x8')]('/api/integrations/freshdesk/accounts',require(_0xf6e4('0xa3')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xa4'),require(_0xf6e4('0xa5')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xa6'),require(_0xf6e4('0xa7')));_0x31368b['use'](_0xf6e4('0xa8'),require(_0xf6e4('0xa9')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xaa'),require(_0xf6e4('0xab')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xac'),require(_0xf6e4('0xad')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xae'),require(_0xf6e4('0xaf')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xb0'),require(_0xf6e4('0xb1')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xb2'),require('./api/intServicenowField'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xb3'),require(_0xf6e4('0xb4')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xb5'),require(_0xf6e4('0xb6')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xb7'),require('./api/intDynamics365Field'));_0x31368b[_0xf6e4('0x8')]('/api/integrations/freshsales/accounts',require(_0xf6e4('0xb8')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xb9'),require(_0xf6e4('0xba')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xbb'),require(_0xf6e4('0xbc')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xbd'),require('./api/network'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xbe'),require(_0xf6e4('0xbf')));_0x31368b['use'](_0xf6e4('0xc0'),require(_0xf6e4('0xc1')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xc2'),require(_0xf6e4('0xc3')));_0x31368b[_0xf6e4('0x8')]('/api/jscripty/questions/reports',require(_0xf6e4('0xc4')));_0x31368b['use'](_0xf6e4('0xc5'),require(_0xf6e4('0xc6')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xc7'),require(_0xf6e4('0xc8')));_0x31368b[_0xf6e4('0x8')]('/api/square/reports',require('./api/squareReport'));_0x31368b[_0xf6e4('0x8')]('/api/square/details/reports',require(_0xf6e4('0xc9')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xca'),require(_0xf6e4('0xcb')));_0x31368b[_0xf6e4('0x8')]('/api/settings',require(_0xf6e4('0xcc')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xcd'),require(_0xf6e4('0xce')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xcf'),require(_0xf6e4('0xd0')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xd1'),require(_0xf6e4('0xd2')));_0x31368b[_0xf6e4('0x8')]('/api/square/messages',require(_0xf6e4('0xd3')));_0x31368b[_0xf6e4('0x8')]('/api/teams',require(_0xf6e4('0xd4')));_0x31368b[_0xf6e4('0x8')]('/api/license',require(_0xf6e4('0xd5')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xd6'),require(_0xf6e4('0xd7')));_0x31368b['use']('/api/migrations',require(_0xf6e4('0xd8')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xd9'),require(_0xf6e4('0xda')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xdb'),require('./api/plugin'));_0x31368b['use']('/api/mail/reports/transfer',require(_0xf6e4('0xdc')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xdd'),require('./api/chatTransferReport'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xde'),require('./api/faxTransferReport'));_0x31368b['use'](_0xf6e4('0xdf'),require(_0xf6e4('0xe0')));_0x31368b['use'](_0xf6e4('0xe1'),require(_0xf6e4('0xe2')));_0x31368b[_0xf6e4('0x8')]('/api/cm/lists',require(_0xf6e4('0xe3')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xe4'),require(_0xf6e4('0xe5')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xe6'),require(_0xf6e4('0xe7')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xe8'),require(_0xf6e4('0xe9')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xea'),require(_0xf6e4('0xeb')));_0x31368b[_0xf6e4('0x8')]('/api/notifications',require(_0xf6e4('0xec')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xed'),require(_0xf6e4('0xee')));_0x31368b[_0xf6e4('0x8')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xef'),require(_0xf6e4('0xf0')));_0x31368b['use'](_0xf6e4('0xf1'),require(_0xf6e4('0xf2')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xf3'),require('./api/whatsappQueueReport'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xf4'),require('./api/whatsappTransferReport'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xf5'),require('./api/whatsappQueue'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xf6'),require(_0xf6e4('0xf7')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xf8'),require(_0xf6e4('0xf9')));_0x31368b['use'](_0xf6e4('0xfa'),require('./api/authGoogle'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xfb'),require('./api/jira'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xfc'),require(_0xf6e4('0xfd')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xfe'),require('./api/version'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0xff'),require('./api/system'));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x100'),require(_0xf6e4('0x101')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x102'),require(_0xf6e4('0x103')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x104'),express[_0xf6e4('0x105')](path['join'](config[_0xf6e4('0x106')],_0xf6e4('0x104'))));_0x31368b['use'](_0xf6e4('0x107'),express[_0xf6e4('0x105')](path[_0xf6e4('0x108')](config['root'],'/www')));_0x31368b['use'](_0xf6e4('0x109'),express['static'](path[_0xf6e4('0x108')](config['root'],'/demo')));_0x31368b[_0xf6e4('0x8')]('/snippet',express['static'](path[_0xf6e4('0x108')](config[_0xf6e4('0x106')],_0xf6e4('0x10a'),'1.0.16')));_0x31368b[_0xf6e4('0x8')](_0xf6e4('0x10b'),express[_0xf6e4('0x105')](path[_0xf6e4('0x108')](config[_0xf6e4('0x106')],_0xf6e4('0x10c'))));_0x31368b[_0xf6e4('0x10d')](_0xf6e4('0x10e'))[_0xf6e4('0x10f')](errors[0x194]);_0x31368b[_0xf6e4('0x10d')]('/*')[_0xf6e4('0x10f')](function(_0x27c67a,_0x3feba0){_0x3feba0[_0xf6e4('0x110')](path[_0xf6e4('0x111')](_0x31368b[_0xf6e4('0x10f')]('appPath')+'/index.html'));});}; \ No newline at end of file +var _0xb2fa=['/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./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/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./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/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','/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/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','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','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','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','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField'];(function(_0x44a606,_0x23fef8){var _0x5aa965=function(_0xf4eb88){while(--_0xf4eb88){_0x44a606['push'](_0x44a606['shift']());}};_0x5aa965(++_0x23fef8);}(_0xb2fa,0xb8));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0xab2f('0x0'));var express=require(_0xab2f('0x1'));var ewinston=require(_0xab2f('0x2'));var util=require(_0xab2f('0x3'));var errors=require(_0xab2f('0x4'));var config=require(_0xab2f('0x5'));var logger=require(_0xab2f('0x6'))('api');var authLogger=require('./config/logger')(_0xab2f('0x7'));exports[_0xab2f('0x8')]=function(_0x2b8512){_0x2b8512[_0xab2f('0x9')](ewinston[_0xab2f('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x33cb4d,_0x28dbe5){return util[_0xab2f('0xb')](_0xab2f('0xc'),_0x33cb4d[_0xab2f('0xd')],_0x33cb4d[_0xab2f('0xe')][_0xab2f('0xf')]?_0x33cb4d['headers'][_0xab2f('0xf')]:_0x33cb4d[_0xab2f('0x10')][_0xab2f('0x11')]||_0x33cb4d['ip'],_0x33cb4d[_0xab2f('0x12')],_0x28dbe5['statusCode'],_0x28dbe5[_0xab2f('0x13')],_0x33cb4d['user']?_0x33cb4d[_0xab2f('0x14')]['id']:null,_0x33cb4d[_0xab2f('0x14')]?_0x33cb4d[_0xab2f('0x14')][_0xab2f('0x15')]:null,_0x33cb4d[_0xab2f('0x14')]?_0x33cb4d[_0xab2f('0x14')][_0xab2f('0x16')]:null);}}));_0x2b8512[_0xab2f('0x9')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x168fd9,_0x2bb9dc){var _0x42b52a=_0xab2f('0x17');if(_0x168fd9[_0xab2f('0x18')]&&_0x168fd9[_0xab2f('0x18')][_0xab2f('0x19')]&&_0x168fd9[_0xab2f('0x18')][_0xab2f('0x1a')]){_0x42b52a=_0xab2f('0x1b');}return util[_0xab2f('0xb')](_0x42b52a,_0x168fd9[_0xab2f('0xd')],_0x168fd9[_0xab2f('0xe')][_0xab2f('0xf')]?_0x168fd9[_0xab2f('0xe')][_0xab2f('0xf')]:_0x168fd9[_0xab2f('0x10')][_0xab2f('0x11')]||_0x168fd9['ip'],_0x168fd9[_0xab2f('0x12')],_0x2bb9dc['statusCode'],_0x2bb9dc[_0xab2f('0x13')],_0x168fd9['user']?_0x168fd9['user']['id']:null,_0x168fd9[_0xab2f('0x14')]?_0x168fd9[_0xab2f('0x14')][_0xab2f('0x15')]:null,_0x168fd9[_0xab2f('0x14')]?_0x168fd9[_0xab2f('0x14')][_0xab2f('0x16')]:null,_0x168fd9[_0xab2f('0x18')]&&_0x168fd9[_0xab2f('0x18')][_0xab2f('0x19')]?_0x168fd9[_0xab2f('0x18')][_0xab2f('0x19')]:_0xab2f('0x1c'),_0x168fd9['body']&&_0x168fd9[_0xab2f('0x18')][_0xab2f('0x1a')]?_0x168fd9[_0xab2f('0x18')]['agent_id']:'',_0x168fd9[_0xab2f('0x18')]&&_0x168fd9[_0xab2f('0x18')][_0xab2f('0x1d')]?_0x168fd9[_0xab2f('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x2163c2){var _0x5bcf22=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5bcf22['test'](_0x2163c2[_0xab2f('0x12')]);}}));_0x2b8512['use'](_0xab2f('0x1e'),require(_0xab2f('0x1f')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x20'),require('./api/voiceChanSpy'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x21'),require(_0xab2f('0x22')));_0x2b8512[_0xab2f('0x9')]('/api/voice/extensions',require(_0xab2f('0x23')));_0x2b8512['use']('/api/voice/mohs',require(_0xab2f('0x24')));_0x2b8512[_0xab2f('0x9')]('/api/voice/queues',require('./api/voiceQueue'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x25'),require(_0xab2f('0x26')));_0x2b8512[_0xab2f('0x9')]('/api/screen/recordings',require('./api/screenRecording'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x27'),require('./api/voiceMail'));_0x2b8512['use'](_0xab2f('0x28'),require(_0xab2f('0x29')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x2a'),require(_0xab2f('0x2b')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x2c'),require('./api/voiceDialReport'));_0x2b8512[_0xab2f('0x9')]('/api/voice/agents/reports',require(_0xab2f('0x2d')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x2e'),require(_0xab2f('0x2f')));_0x2b8512[_0xab2f('0x9')]('/api/members/reports',require(_0xab2f('0x30')));_0x2b8512[_0xab2f('0x9')]('/api/trunks',require(_0xab2f('0x31')));_0x2b8512[_0xab2f('0x9')]('/api/voice/transfers/reports',require(_0xab2f('0x32')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x33'),require(_0xab2f('0x34')));_0x2b8512['use'](_0xab2f('0x35'),require(_0xab2f('0x36')));_0x2b8512[_0xab2f('0x9')]('/api/mail/queues',require(_0xab2f('0x37')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x38'),require(_0xab2f('0x39')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x3a'),require(_0xab2f('0x3b')));_0x2b8512[_0xab2f('0x9')]('/api/mail/messages',require(_0xab2f('0x3c')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x3d'),require('./api/mailApplication'));_0x2b8512['use'](_0xab2f('0x3e'),require(_0xab2f('0x3f')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x40'),require(_0xab2f('0x41')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x42'),require(_0xab2f('0x43')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x44'),require('./api/faxAccount'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x45'),require('./api/faxApplication'));_0x2b8512['use'](_0xab2f('0x46'),require(_0xab2f('0x47')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x48'),require('./api/faxMessage'));_0x2b8512['use'](_0xab2f('0x49'),require(_0xab2f('0x4a')));_0x2b8512[_0xab2f('0x9')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x4b'),require('./api/smsAccount'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x4c'),require(_0xab2f('0x4d')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x4e'),require('./api/smsInteraction'));_0x2b8512[_0xab2f('0x9')]('/api/sms/messages',require(_0xab2f('0x4f')));_0x2b8512[_0xab2f('0x9')]('/api/sms/queues',require('./api/smsQueue'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x50'),require(_0xab2f('0x51')));_0x2b8512['use'](_0xab2f('0x52'),require('./api/openchannelApplication'));_0x2b8512[_0xab2f('0x9')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x2b8512['use'](_0xab2f('0x53'),require('./api/openchannelMessage'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x54'),require('./api/openchannelQueue'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x55'),require(_0xab2f('0x56')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x57'),require(_0xab2f('0x58')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x59'),require(_0xab2f('0x5a')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x5b'),require(_0xab2f('0x5c')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x5d'),require(_0xab2f('0x5e')));_0x2b8512[_0xab2f('0x9')]('/api/chat/offline_messages',require(_0xab2f('0x5f')));_0x2b8512[_0xab2f('0x9')]('/api/chat/queues',require(_0xab2f('0x60')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x61'),require(_0xab2f('0x62')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x63'),require('./api/chatProactiveAction'));_0x2b8512[_0xab2f('0x9')]('/api/cm/companies',require(_0xab2f('0x64')));_0x2b8512[_0xab2f('0x9')]('/api/cm/contacts',require('./api/cmContact'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x65'),require(_0xab2f('0x66')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x67'),require(_0xab2f('0x68')));_0x2b8512['use']('/api/cm/hopper_final',require(_0xab2f('0x69')));_0x2b8512['use']('/api/cm/hopper_history',require(_0xab2f('0x6a')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x6b'),require(_0xab2f('0x6c')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x6d'),require(_0xab2f('0x6e')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x6f'),require(_0xab2f('0x70')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x71'),require(_0xab2f('0x72')));_0x2b8512[_0xab2f('0x9')]('/api/dispositions',require('./api/disposition'));_0x2b8512['use'](_0xab2f('0x73'),require(_0xab2f('0x74')));_0x2b8512['use'](_0xab2f('0x75'),require(_0xab2f('0x76')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x77'),require(_0xab2f('0x78')));_0x2b8512['use'](_0xab2f('0x79'),require(_0xab2f('0x7a')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x7b'),require(_0xab2f('0x7c')));_0x2b8512['use']('/api/schedules',require('./api/schedule'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x7d'),require(_0xab2f('0x7e')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x7f'),require(_0xab2f('0x80')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x81'),require(_0xab2f('0x82')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x83'),require(_0xab2f('0x84')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x85'),require(_0xab2f('0x86')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x87'),require('./api/integration'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x88'),require(_0xab2f('0x89')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x8a'),require('./api/analyticCustomReport'));_0x2b8512['use'](_0xab2f('0x8b'),require(_0xab2f('0x8c')));_0x2b8512['use'](_0xab2f('0x8d'),require(_0xab2f('0x8e')));_0x2b8512['use'](_0xab2f('0x8f'),require(_0xab2f('0x90')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x91'),require(_0xab2f('0x92')));_0x2b8512['use'](_0xab2f('0x93'),require(_0xab2f('0x94')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x95'),require(_0xab2f('0x96')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x97'),require(_0xab2f('0x98')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x99'),require('./api/intSalesforceField'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x9a'),require(_0xab2f('0x9b')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x9c'),require(_0xab2f('0x9d')));_0x2b8512['use'](_0xab2f('0x9e'),require(_0xab2f('0x9f')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xa0'),require(_0xab2f('0xa1')));_0x2b8512['use'](_0xab2f('0xa2'),require(_0xab2f('0xa3')));_0x2b8512['use'](_0xab2f('0xa4'),require(_0xab2f('0xa5')));_0x2b8512[_0xab2f('0x9')]('/api/integrations/zoho/accounts',require(_0xab2f('0xa6')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xa7'),require(_0xab2f('0xa8')));_0x2b8512['use']('/api/integrations/zoho/fields',require(_0xab2f('0xa9')));_0x2b8512['use'](_0xab2f('0xaa'),require(_0xab2f('0xab')));_0x2b8512['use'](_0xab2f('0xac'),require('./api/intZendeskConfiguration'));_0x2b8512[_0xab2f('0x9')]('/api/integrations/zendesk/fields',require(_0xab2f('0xad')));_0x2b8512['use'](_0xab2f('0xae'),require(_0xab2f('0xaf')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xb0'),require(_0xab2f('0xb1')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xb2'),require(_0xab2f('0xb3')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xb4'),require(_0xab2f('0xb5')));_0x2b8512[_0xab2f('0x9')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xb6'),require(_0xab2f('0xb7')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xb8'),require('./api/intServicenowAccount'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xb9'),require(_0xab2f('0xba')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xbb'),require(_0xab2f('0xbc')));_0x2b8512[_0xab2f('0x9')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xbd'),require(_0xab2f('0xbe')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xbf'),require(_0xab2f('0xc0')));_0x2b8512['use'](_0xab2f('0xc1'),require(_0xab2f('0xc2')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xc3'),require(_0xab2f('0xc4')));_0x2b8512[_0xab2f('0x9')]('/api/integrations/freshsales/fields',require(_0xab2f('0xc5')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xc6'),require(_0xab2f('0xc7')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xc8'),require(_0xab2f('0xc9')));_0x2b8512['use'](_0xab2f('0xca'),require(_0xab2f('0xcb')));_0x2b8512['use']('/api/jscripty/answers/reports',require(_0xab2f('0xcc')));_0x2b8512[_0xab2f('0x9')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xcd'),require('./api/jscriptySessionReport'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xce'),require(_0xab2f('0xcf')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xd0'),require(_0xab2f('0xd1')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xd2'),require(_0xab2f('0xd3')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xd4'),require(_0xab2f('0xd5')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xd6'),require(_0xab2f('0xd7')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xd8'),require(_0xab2f('0xd9')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xda'),require(_0xab2f('0xdb')));_0x2b8512[_0xab2f('0x9')]('/api/square/recordings',require(_0xab2f('0xdc')));_0x2b8512[_0xab2f('0x9')]('/api/square/messages',require(_0xab2f('0xdd')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xde'),require(_0xab2f('0xdf')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xe0'),require(_0xab2f('0xe1')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xe2'),require(_0xab2f('0xe3')));_0x2b8512['use'](_0xab2f('0xe4'),require(_0xab2f('0xe5')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xe6'),require(_0xab2f('0xe7')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xe8'),require(_0xab2f('0xe9')));_0x2b8512[_0xab2f('0x9')]('/api/mail/reports/transfer',require(_0xab2f('0xea')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xeb'),require(_0xab2f('0xec')));_0x2b8512['use'](_0xab2f('0xed'),require('./api/faxTransferReport'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xee'),require('./api/openchannelTransferReport'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xef'),require(_0xab2f('0xf0')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xf1'),require(_0xab2f('0xf2')));_0x2b8512['use']('/api/voice/prefixes',require(_0xab2f('0xf3')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xf4'),require(_0xab2f('0xf5')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xf6'),require(_0xab2f('0xf7')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xf8'),require(_0xab2f('0xf9')));_0x2b8512['use'](_0xab2f('0xfa'),require('./api/notification'));_0x2b8512['use'](_0xab2f('0xfb'),require('./api/whatsappAccount'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xfc'),require(_0xab2f('0xfd')));_0x2b8512[_0xab2f('0x9')]('/api/whatsapp/interactions',require(_0xab2f('0xfe')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0xff'),require('./api/whatsappMessage'));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x100'),require(_0xab2f('0x101')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x102'),require(_0xab2f('0x103')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x104'),require(_0xab2f('0x105')));_0x2b8512['use']('/api/cloudProviders',require('./api/cloudProvider'));_0x2b8512['use'](_0xab2f('0x106'),require(_0xab2f('0x107')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x108'),require(_0xab2f('0x109')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x10a'),require(_0xab2f('0x10b')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x10c'),require(_0xab2f('0x10d')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x10e'),require(_0xab2f('0x10f')));_0x2b8512[_0xab2f('0x9')]('/api/system',require(_0xab2f('0x110')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x111'),require(_0xab2f('0x112')));_0x2b8512['use'](_0xab2f('0x113'),require(_0xab2f('0x114')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x115'),express[_0xab2f('0x116')](path[_0xab2f('0x117')](config[_0xab2f('0x118')],_0xab2f('0x115'))));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x119'),express[_0xab2f('0x116')](path['join'](config[_0xab2f('0x118')],_0xab2f('0x119'))));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x11a'),express[_0xab2f('0x116')](path[_0xab2f('0x117')](config['root'],'/demo')));_0x2b8512['use'](_0xab2f('0x11b'),express['static'](path[_0xab2f('0x117')](config[_0xab2f('0x118')],_0xab2f('0x11c'),'1.0.16')));_0x2b8512[_0xab2f('0x9')](_0xab2f('0x11d'),express[_0xab2f('0x116')](path['join'](config[_0xab2f('0x118')],_0xab2f('0x11e'))));_0x2b8512[_0xab2f('0x11f')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x2b8512[_0xab2f('0x11f')]('/*')[_0xab2f('0x120')](function(_0x18627f,_0x50d098){_0x50d098[_0xab2f('0x121')](path[_0xab2f('0x122')](_0x2b8512[_0xab2f('0x120')](_0xab2f('0x123'))+_0xab2f('0x124')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4fd22db..9d6a191 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5dc=['../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc'];(function(_0x73a2f6,_0x2f9681){var _0xf23f46=function(_0x3383de){while(--_0x3383de){_0x73a2f6['push'](_0x73a2f6['shift']());}};_0xf23f46(++_0x2f9681);}(_0xa5dc,0x162));var _0xca5d=function(_0x5c6f37,_0x53bc84){_0x5c6f37=_0x5c6f37-0x0;var _0x4ae388=_0xa5dc[_0x5c6f37];return _0x4ae388;};'use strict';var jayson=require(_0xca5d('0x0'));var BPromise=require(_0xca5d('0x1'));var _=require('lodash');var config=require(_0xca5d('0x2'));exports['listen']=function(){return new BPromise(function(_0x190858,_0x36f386){var _0x1cba01={};_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x4')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x5')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/voiceQueue/voiceQueue.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x6')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x7')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1cba01=_['merge'](_0x1cba01,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x8')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/memberReport/memberReport.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x9')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0xa')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0xb')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0xc')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/mailAccount/mailAccount.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/mailQueue/mailQueue.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0xd')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/mailMessage/mailMessage.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/mailApplication/mailApplication.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0xe')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/faxAccount/faxAccount.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0xf')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x10')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x11')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x12')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x13')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/smsAccount/smsAccount.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x14')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x15')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/smsQueue/smsQueue.rpc'));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x16')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x17')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x18')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x19')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x1a')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/chatInteraction/chatInteraction.rpc'));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x1b')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x1c')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x1d')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x1e')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x1f')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x20')));_0x1cba01=_['merge'](_0x1cba01,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x21')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x22')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/sound/sound.rpc'));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x23')));_0x1cba01=_['merge'](_0x1cba01,require('../api/trigger/trigger.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x24')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x25')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x26')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x27')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x28')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x29')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x2a')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x2b')));_0x1cba01=_['merge'](_0x1cba01,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x2c')));_0x1cba01=_['merge'](_0x1cba01,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x2d')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x2e')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x2f')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x30')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x31')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x32')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x33')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x34')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/plugin/plugin.rpc'));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x35')));_0x1cba01=_['merge'](_0x1cba01,require(_0xca5d('0x36')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x37')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require(_0xca5d('0x38')));_0x1cba01=_[_0xca5d('0x3')](_0x1cba01,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x959e76=jayson[_0xca5d('0x39')](_0x1cba01)[_0xca5d('0x3a')]();var _0x5f5a0b=config[_0xca5d('0x3b')]['port']||config['port']+0x1;var _0x17a1f=config[_0xca5d('0x3b')]['ip']||_0xca5d('0x3c');_0x959e76['on'](_0xca5d('0x3d'),function(_0x4cd1fa){return _0x36f386(_0x4cd1fa);});_0x959e76[_0xca5d('0x3e')](_0x5f5a0b,_0x17a1f,function(){console[_0xca5d('0x3f')](_0xca5d('0x40'),_0x17a1f,_0x5f5a0b);require(_0xca5d('0x41'))[_0xca5d('0x42')]();return _0x190858('RPC\x20listening\x20on\x20'+_0x17a1f+':'+_0x5f5a0b);});});}; \ No newline at end of file +var _0x27b7=['../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x4d863b,_0x2906c5){var _0x380493=function(_0x5776f4){while(--_0x5776f4){_0x4d863b['push'](_0x4d863b['shift']());}};_0x380493(++_0x2906c5);}(_0x27b7,0xb7));var _0x727b=function(_0x5f5722,_0x6f24f7){_0x5f5722=_0x5f5722-0x0;var _0x51d379=_0x27b7[_0x5f5722];return _0x51d379;};'use strict';var jayson=require(_0x727b('0x0'));var BPromise=require(_0x727b('0x1'));var _=require(_0x727b('0x2'));var config=require(_0x727b('0x3'));exports[_0x727b('0x4')]=function(){return new BPromise(function(_0x155c08,_0x29fd01){var _0x5668b7={};_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/user/user.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x6')));_0x5668b7=_['merge'](_0x5668b7,require('../api/voiceQueue/voiceQueue.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x7')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x8')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x9')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0xa')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0xb')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/memberReport/memberReport.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/trunk/trunk.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0xc')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0xd')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0xe')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0xf')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x10')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x11')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x12')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x13')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x14')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x15')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x16')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/faxMessage/faxMessage.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x17')));_0x5668b7=_['merge'](_0x5668b7,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x18')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x19')));_0x5668b7=_['merge'](_0x5668b7,require('../api/smsMessage/smsMessage.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x1a')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x1b')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x1c')));_0x5668b7=_['merge'](_0x5668b7,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x1d')));_0x5668b7=_['merge'](_0x5668b7,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x1e')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x1f')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x20')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x21')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x22')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x23')));_0x5668b7=_['merge'](_0x5668b7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x24')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x25')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/interval/interval.rpc'));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x26')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/sound/sound.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x27')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x28')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/variable/variable.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x29')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x2a')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x2b')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x2c')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x2d')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x2e')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x2f')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x30')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x31')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x32')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x33')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x34')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x35')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/squareOdbc/squareOdbc.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x36')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x37')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x38')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x39')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x3a')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x3b')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require(_0x727b('0x3c')));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x3d')));_0x5668b7=_['merge'](_0x5668b7,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5668b7=_['merge'](_0x5668b7,require(_0x727b('0x3e')));_0x5668b7=_[_0x727b('0x5')](_0x5668b7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x52f044=jayson['server'](_0x5668b7)[_0x727b('0x3f')]();var _0x45bc8a=config[_0x727b('0x40')][_0x727b('0x41')]||config['port']+0x1;var _0xf11147=config[_0x727b('0x40')]['ip']||_0x727b('0x42');_0x52f044['on'](_0x727b('0x43'),function(_0x42f92f){return _0x29fd01(_0x42f92f);});_0x52f044[_0x727b('0x4')](_0x45bc8a,_0xf11147,function(){console[_0x727b('0x44')](_0x727b('0x45'),_0xf11147,_0x45bc8a);require(_0x727b('0x46'))['default']();return _0x155c08(_0x727b('0x47')+_0xf11147+':'+_0x45bc8a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 39f15ab..c9136f4 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 _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x81afe1,_0xe2e7ec){var _0x40ce74=function(_0x543f56){while(--_0x543f56){_0x81afe1['push'](_0x81afe1['shift']());}};_0x40ce74(++_0xe2e7ec);}(_0x70e0,0x17b));var _0x070e=function(_0x234cfd,_0x3cf026){_0x234cfd=_0x234cfd-0x0;var _0x1687d9=_0x70e0[_0x234cfd];return _0x1687d9;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 347cdfa..028a0e3 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 _0x20ad=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x4d8421,_0x5176f1){var _0x5a739a=function(_0x4403e3){while(--_0x4403e3){_0x4d8421['push'](_0x4d8421['shift']());}};_0x5a739a(++_0x5176f1);}(_0x20ad,0x13a));var _0xd20a=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x20ad[_0x18ab2a];return _0x16dcee;};'use strict';var util=require(_0xd20a('0x0'));var error={'E_AGI_UNDEFINED':_0xd20a('0x1'),'E_AGI_ARGUMENT_PORT':_0xd20a('0x2'),'E_AGI_SERVER_ERROR':_0xd20a('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd20a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd20a('0x5'),'E_AGI_SOCKET_ERROR':_0xd20a('0x6'),'E_AGI_SOCKET_CLOSE':_0xd20a('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xd20a('0x8'),'E_AGI_COMMAND_EMPTY':_0xd20a('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd20a('0xa'),'E_AGI_IVR_ENTRY':_0xd20a('0xb')};function AGIError(_0x1c71e){var _0x1c71e=_0x1c71e||null,_0x18ca5c=_0x18ca5c||[],_0xf47652=0x1,_0x4c56a0='';if(!error[_0x1c71e]){_0x1c71e=_0xd20a('0xc');}_0x18ca5c[_0xd20a('0xd')](error[_0x1c71e]);while(arguments[_0xf47652]){_0x18ca5c[_0xd20a('0xd')](arguments[_0xf47652]);_0xf47652++;}_0x4c56a0=util[_0xd20a('0xe')][_0xd20a('0xf')](util,_0x18ca5c);this[_0xd20a('0x10')]=_0x4c56a0;this[_0xd20a('0x11')]=_0x1c71e;}module[_0xd20a('0x12')]=AGIError; \ No newline at end of file +var _0xf3dc=['E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x1ebc56,_0x27e0ab){_0x1ebc56=_0x1ebc56-0x0;var _0x205431=_0xf3dc[_0x1ebc56];return _0x205431;};'use strict';var util=require(_0xcf3d('0x0'));var error={'E_AGI_UNDEFINED':_0xcf3d('0x1'),'E_AGI_ARGUMENT_PORT':_0xcf3d('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xcf3d('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xcf3d('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xcf3d('0x5'),'E_AGI_SOCKET_ERROR':_0xcf3d('0x6'),'E_AGI_SOCKET_CLOSE':_0xcf3d('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xcf3d('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5b1441){var _0x5b1441=_0x5b1441||null,_0x5bc3d6=_0x5bc3d6||[],_0x1a69de=0x1,_0x10d808='';if(!error[_0x5b1441]){_0x5b1441=_0xcf3d('0x9');}_0x5bc3d6[_0xcf3d('0xa')](error[_0x5b1441]);while(arguments[_0x1a69de]){_0x5bc3d6[_0xcf3d('0xa')](arguments[_0x1a69de]);_0x1a69de++;}_0x10d808=util[_0xcf3d('0xb')][_0xcf3d('0xc')](util,_0x5bc3d6);this[_0xcf3d('0xd')]=_0x10d808;this[_0xcf3d('0xe')]=_0x5b1441;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a0c0f0d..94e294e 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 _0xf7b4=['condition\x20not\x20found','exports','lodash','menu','getdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found'];(function(_0x1d079a,_0x28245c){var _0x28b4d0=function(_0x2da8c9){while(--_0x2da8c9){_0x1d079a['push'](_0x1d079a['shift']());}};_0x28b4d0(++_0x28245c);}(_0xf7b4,0x152));var _0x4f7b=function(_0x1f8464,_0x51ad8c){_0x1f8464=_0x1f8464-0x0;var _0x5691f0=_0xf7b4[_0x1f8464];return _0x5691f0;};'use strict';var _=require(_0x4f7b('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0x4f7b('0x1'),_0x4f7b('0x2'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0x4f7b('0x3')]={};this[_0x4f7b('0x4')]=0x0;};Graph[_0x4f7b('0x5')][_0x4f7b('0x6')]=function(_0xc39829){this[_0x4f7b('0x7')][_0xc39829['id']]=_0xc39829;this[_0x4f7b('0x3')][_0xc39829['id']]=[];};Graph[_0x4f7b('0x5')][_0x4f7b('0x8')]=function(_0x351036,_0x36ea9c,_0x3ef6e1){this[_0x4f7b('0x3')][_0x351036]['push']({'target':_0x36ea9c,'condition':_0x3ef6e1});this[_0x4f7b('0x4')]+=0x1;};Graph[_0x4f7b('0x5')]['size']=function(){return _[_0x4f7b('0x9')](this[_0x4f7b('0x7')]);};Graph[_0x4f7b('0x5')][_0x4f7b('0xa')]=function(){return this[_0x4f7b('0x4')];};Graph['prototype'][_0x4f7b('0xb')]=function(_0x5850c8){return this['vertices'][_0x5850c8];};Graph[_0x4f7b('0x5')][_0x4f7b('0xc')]=function(_0x3c55e1,_0x41a050){if(!this['vertices'][_0x3c55e1]){return logger[_0x4f7b('0xd')](_0x4f7b('0xe'));}var _0x407cee=_0x41a050(this[_0x4f7b('0x7')][_0x3c55e1]);if(!_0x407cee){return logger[_0x4f7b('0xd')](_0x4f7b('0xf'));}if(this[_0x4f7b('0x3')][_0x3c55e1][_0x4f7b('0x10')]===0x0){return logger[_0x4f7b('0xd')](_0x4f7b('0x11'));}for(var _0x1a28b8=0x0,_0x1e7afc=[],_0x50a161=![];_0x1a28b8\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','./rpc','./mailRpc','./vertices','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','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','hangup','sync','production'];(function(_0x1ad172,_0x30edf5){var _0x2abffa=function(_0x2461dd){while(--_0x2461dd){_0x1ad172['push'](_0x1ad172['shift']());}};_0x2abffa(++_0x30edf5);}(_0x5100,0x132));var _0x0510=function(_0x1ba003,_0x52cc53){_0x1ba003=_0x1ba003-0x0;var _0x1600eb=_0x5100[_0x1ba003];return _0x1600eb;};'use strict';var parser=require(_0x0510('0x0'));var _=require(_0x0510('0x1'));var syncho=require(_0x0510('0x2'));var util=require(_0x0510('0x3'));var moment=require(_0x0510('0x4'));var config=require(_0x0510('0x5'));var logger=require('../../config/logger')(_0x0510('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x0510('0x7'));var mailRpc=require(_0x0510('0x8'));var Graph=require('./graph');var Vertices=require(_0x0510('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0510('0x6')]=_['defaults'](config['agi'],{'ip':_0x0510('0xa'),'port':0x11dd});function connectionHandler(_0x5739ac){process[_0x0510('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5739ac);agiHandler(_0x5739ac);}catch(_0x78e742){logger[_0x0510('0xc')](_0x78e742[_0x0510('0xd')]);}});});}function listeningHandler(){console[_0x0510('0xe')](_0x0510('0xf'),config[_0x0510('0x6')][_0x0510('0x10')]);logger[_0x0510('0x11')](util[_0x0510('0x12')](_0x0510('0x13'),config[_0x0510('0x6')]['ip'],config[_0x0510('0x6')][_0x0510('0x10')]));}function errorHandler(_0x302e15){if(_0x302e15&&_0x302e15[_0x0510('0x14')]&&_0x302e15[_0x0510('0x15')]){logger[_0x0510('0xc')](util[_0x0510('0x12')](_0x0510('0x16'),_0x302e15[_0x0510('0x14')],_0x302e15['message']));}else{logger[_0x0510('0xc')](util['format'](_0x0510('0x17'),_0x302e15[_0x0510('0xd')]));}}function closeHandler(){logger[_0x0510('0x11')](util[_0x0510('0x12')](_0x0510('0x18'),this['arg_1'],this[_0x0510('0x19')],this['callerid'],this[_0x0510('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x356d16){logger[_0x0510('0xc')](_0x356d16[_0x0510('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x0510('0x12')](_0x0510('0x1b'),this[_0x0510('0x1c')],this['calleridname'],this[_0x0510('0x1d')],this[_0x0510('0x1a')],this[_0x0510('0x1e')]));}function hangupHandler(){logger['info'](util[_0x0510('0x12')](_0x0510('0x1f'),this[_0x0510('0x1c')],this[_0x0510('0x19')],this[_0x0510('0x1d')],this['dnid'],this[_0x0510('0x1e')]));this[_0x0510('0x20')]=!![];}function getRoot(_0x2e1436){return parser[_0x0510('0x21')](_0x2e1436,{'object':!![]})[_0x0510('0x22')]['root'];}function addVertex(_0x1d53d2,_0x258924,_0x4e8487){_0x258924[_0x0510('0x23')]=_0x4e8487;if(_0x258924[_0x0510('0x24')](_0x0510('0x25'))){_0x258924[_0x0510('0x26')]=parseInt(_0x258924[_0x0510('0x25')],0xa);}_0x1d53d2['addVertex'](_[_0x0510('0x27')](_0x258924,_0x0510('0x28')));}function initGraph(_0x19b003,_0x1c5bb1){var _0x4b2562=new Graph();for(var _0x2d00e7 in _0x19b003){if(_0x19b003[_0x0510('0x24')](_0x2d00e7)){if(_[_0x0510('0x29')](_0x19b003[_0x2d00e7])){for(var _0x26bb19=0x0;_0x26bb19<_0x19b003[_0x2d00e7][_0x0510('0x2a')];_0x26bb19+=0x1){addVertex(_0x4b2562,_0x19b003[_0x2d00e7][_0x26bb19],_0x2d00e7);}}else{addVertex(_0x4b2562,_0x19b003[_0x2d00e7],_0x2d00e7);}}}for(var _0x4ca033=0x0;_0x4ca033<_0x1c5bb1[_0x0510('0x2a')];_0x4ca033+=0x1){if(_0x1c5bb1[_0x4ca033][_0x0510('0x2b')]&&_0x1c5bb1[_0x4ca033][_0x0510('0x2c')]){_0x4b2562[_0x0510('0x2d')](_0x1c5bb1[_0x4ca033][_0x0510('0x2b')],_0x1c5bb1[_0x4ca033]['target'],_0x1c5bb1[_0x4ca033][_0x0510('0x2e')]);}}return _0x4b2562;}function getSquareProject(_0x432f01,_0x172c94){rpc[_0x0510('0x2f')](_0x432f01)[_0x0510('0x30')](function(_0x3fe6e6){_0x172c94(null,_0x3fe6e6);})['catch'](function(_0x5bbe15){_0x172c94(null,_0x5bbe15);});}function createSquareReport(_0x5488e5,_0x30ee70){rpc[_0x0510('0x31')](_0x5488e5)[_0x0510('0x30')](function(_0x51d2da){if(_0x30ee70){_0x30ee70(null,_0x51d2da);}})[_0x0510('0x32')](function(_0xcdb5c2){if(_0x30ee70){_0x30ee70(null,_0xcdb5c2);}});}function setChannelVariables(_0x4453db){for(var _0x572cd3 in _0x4453db){if(_0x4453db[_0x0510('0x24')](_0x572cd3)){if(_0x572cd3[_0x0510('0x33')](_0x0510('0x34'))===0x0){_0x4453db[_0x572cd3[_0x0510('0x35')](0x4)]=_0x4453db[_0x572cd3];delete _0x4453db[_0x572cd3];}}}}function getLogFromObject(_0x22bdf5){return util[_0x0510('0x36')](_0x22bdf5,{'showHidden':![],'depth':null});}function agiHandler(_0x1b0a8c){var _0x4748e8,_0x1634ea,_0x579639,_0x2bf197,_0xe5bead;logger[_0x0510('0x37')](_0x0510('0x38'),JSON[_0x0510('0x39')](_0x1b0a8c,null,0x2));logger[_0x0510('0x11')](util[_0x0510('0x12')](_0x0510('0x3a'),_0x1b0a8c['arg_1'],_0x1b0a8c[_0x0510('0x19')],_0x1b0a8c['callerid'],_0x1b0a8c[_0x0510('0x1a')],_0x1b0a8c[_0x0510('0x1e')]));_0x1b0a8c['on'](_0x0510('0xc'),errorHandler);_0x1b0a8c['on']('close',closeHandler);_0x1b0a8c['on']('timeout',timeoutHandler);_0x1b0a8c['evtHangup']=![];_0x1b0a8c['on'](_0x0510('0x3b'),hangupHandler);var _0x3d9c31=getSquareProject[_0x0510('0x3c')](null,_0x1b0a8c['arg_1']);if(_0x3d9c31){if(_0x3d9c31['production']){_0x4748e8=getRoot(_0x3d9c31[_0x0510('0x3d')]);console['log'](_0x0510('0x3e'),_0x4748e8);if(_0x4748e8&&_0x4748e8[_0x0510('0x3f')]){logger['debug']('root',JSON[_0x0510('0x39')](_0x4748e8,null,0x2));_0x1b0a8c['joinAt']=moment()[_0x0510('0x12')](_0x0510('0x40'));_0x1634ea=initGraph(_['omit'](_0x4748e8,'mxCell'),_0x4748e8[_0x0510('0x28')]);_0x579639=new Vertices(_0x1b0a8c,rpc,mailRpc);logger[_0x0510('0x11')](util[_0x0510('0x12')](_0x0510('0x41'),_0x1b0a8c['arg_1'],_0x1b0a8c['calleridname'],_0x1b0a8c[_0x0510('0x1d')],_0x1b0a8c[_0x0510('0x1a')],_0x1b0a8c[_0x0510('0x1e')]));_0x1634ea[_0x0510('0x42')](_0x4748e8['start']['id'],function(_0x41dac7){try{_0x41dac7=_0x579639[_0x0510('0x43')](_0x41dac7);logger['debug']('vertex',JSON['stringify'](_0x41dac7,null,0x2));if(_0x41dac7[_0x0510('0x23')]==='gotoc'){logger[_0x0510('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1b0a8c[_0x0510('0x44')]=_0x41dac7[_0x0510('0x44')]||_0x1b0a8c[_0x0510('0x44')];_0x1b0a8c['extension']=_0x41dac7[_0x0510('0x45')];_0x1b0a8c['priority']=_0x41dac7[_0x0510('0x46')]?_0x41dac7['priority']-0x1:0x1;return null;}else if(_0x41dac7&&_0x579639[_0x41dac7['agicommand']]){_0xe5bead=_0x579639[_0x41dac7['agicommand']](_0x41dac7);logger[_0x0510('0x11')](_0x0510('0x47'),JSON[_0x0510('0x39')](_0xe5bead,null,0x2));if(_0xe5bead&&_0xe5bead[_0x0510('0x48')]===AGI_CODE_SUCCESS&&_0xe5bead[_0x0510('0x49')]!==AGI_RESULT_ERROR&&!_0x1b0a8c[_0x0510('0x20')]){logger[_0x0510('0x37')](_0x0510('0x47'),getLogFromObject(_0xe5bead));return _[_0x0510('0x4a')](_0xe5bead['result'])?null:_0xe5bead['result'][_0x0510('0x4b')]();}else{logger['error'](_0x0510('0x47'),getLogFromObject(_0xe5bead));return null;}}else{logger[_0x0510('0xc')](_0x0510('0x4c'));return null;}}catch(_0x2ed23b){logger[_0x0510('0xc')](_0x2ed23b[_0x0510('0xd')]);return null;}});if(_0x4748e8['finally']){logger['info'](util[_0x0510('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b0a8c['arg_1'],_0x1b0a8c[_0x0510('0x19')],_0x1b0a8c[_0x0510('0x1d')],_0x1b0a8c[_0x0510('0x1a')],_0x1b0a8c[_0x0510('0x1e')]));_0x1634ea['traverseBFS'](_0x4748e8[_0x0510('0x4d')]['id'],function(_0x1ed397){try{_0x1ed397=_0x579639[_0x0510('0x43')](_0x1ed397);logger[_0x0510('0x37')](_0x0510('0x4e'),JSON[_0x0510('0x39')](_0x1ed397,null,0x2));if(_0x1ed397&&_0x579639[_0x1ed397['agicommand']]){_0xe5bead=_0x579639[_0x1ed397['agicommand']](_0x1ed397);if(_0xe5bead){logger[_0x0510('0x37')](_0x0510('0x47'),getLogFromObject(_0xe5bead));return _[_0x0510('0x4a')](_0xe5bead[_0x0510('0x49')])?null:_0xe5bead['result'][_0x0510('0x4b')]();}else{logger['error']('response',getLogFromObject(_0xe5bead));return null;}}else{logger[_0x0510('0xc')](_0x0510('0x4c'));return null;}}catch(_0x6790cc){logger[_0x0510('0xc')](_0x6790cc[_0x0510('0xd')]);return null;}});}logger['info'](util[_0x0510('0x12')](_0x0510('0x4f'),_0x1b0a8c['arg_1'],_0x1b0a8c['calleridname'],_0x1b0a8c[_0x0510('0x1d')],_0x1b0a8c[_0x0510('0x1a')],_0x1b0a8c[_0x0510('0x1e')]));logger['info'](util[_0x0510('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1b0a8c[_0x0510('0x44')],_0x1b0a8c[_0x0510('0x45')],parseInt(_0x1b0a8c[_0x0510('0x46')],0xa)+0x1));_0x1b0a8c['continueAt'](_0x1b0a8c[_0x0510('0x44')],_0x1b0a8c[_0x0510('0x45')],parseInt(_0x1b0a8c[_0x0510('0x46')],0xa)+0x1);_0x1b0a8c[_0x0510('0x50')]();}}else{logger[_0x0510('0xc')](util[_0x0510('0x12')]('Project\x20%s\x20not\x20published',_0x1b0a8c['arg_1']));_0x1b0a8c['continueAt'](_0x1b0a8c['context'],_0x1b0a8c['extension'],parseInt(_0x1b0a8c[_0x0510('0x46')],0xa)+0x1);_0x1b0a8c['close']();}}else{logger[_0x0510('0xc')](util[_0x0510('0x12')](_0x0510('0x51'),_0x1b0a8c[_0x0510('0x1c')]));_0x1b0a8c[_0x0510('0x52')](_0x1b0a8c[_0x0510('0x44')],_0x1b0a8c[_0x0510('0x45')],parseInt(_0x1b0a8c['priority'],0xa)+0x1);_0x1b0a8c['close']();}}function main(){var _0x51cf89;return utilLicense[_0x0510('0x53')]()[_0x0510('0x30')](function(_0x528cbd){if(_0x528cbd){if(_0x528cbd[_0x0510('0x54')]){if(_0x528cbd[_0x0510('0x55')]&&_0x528cbd['callysquare']>0x0){logger[_0x0510('0x11')](util[_0x0510('0x12')](_0x0510('0x56'),_0x528cbd['callysquare']));_0x51cf89=_0x528cbd[_0x0510('0x55')];}else{logger['info'](_0x0510('0x57'));}}else{logger[_0x0510('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x51cf89=-0x1;}}})[_0x0510('0x32')](function(_0xb56ebc){logger[_0x0510('0xc')](_0x0510('0x58'),_0xb56ebc['stack']);})[_0x0510('0x4d')](function(){var _0x892920=require(_0x0510('0x59'))(config['agi']['port'],config['agi']['ip'],_0x51cf89);_0x892920['on'](_0x0510('0xc'),errorHandler);_0x892920['on'](_0x0510('0x5a'),listeningHandler);_0x892920['on'](_0x0510('0x5b'),connectionHandler);_0x892920['on'](_0x0510('0x50'),closeHandler);});}main(); \ No newline at end of file +var _0xff91=['isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./graph','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','error','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','toJson','mxGraphModel','root','hasOwnProperty','retry','addVertex','omit','mxCell','source','target','value','then','catch','createSquareReport','indexOf','agi_','substring','inspect','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','SQUAREROOT','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','start','vertex','gotoc','context','extension','priority','agicommand','response','code','result','evtHangup'];(function(_0x2d2b81,_0x5189e0){var _0x46f7cf=function(_0x51cec1){while(--_0x51cec1){_0x2d2b81['push'](_0x2d2b81['shift']());}};_0x46f7cf(++_0x5189e0);}(_0xff91,0x116));var _0x1ff9=function(_0x4d611c,_0x4f2543){_0x4d611c=_0x4d611c-0x0;var _0x40163a=_0xff91[_0x4d611c];return _0x40163a;};'use strict';var parser=require(_0x1ff9('0x0'));var _=require(_0x1ff9('0x1'));var syncho=require(_0x1ff9('0x2'));var util=require(_0x1ff9('0x3'));var moment=require(_0x1ff9('0x4'));var config=require(_0x1ff9('0x5'));var logger=require(_0x1ff9('0x6'))(_0x1ff9('0x7'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x1ff9('0x8'));var Vertices=require(_0x1ff9('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1ff9('0x7')]=_[_0x1ff9('0xa')](config['agi'],{'ip':_0x1ff9('0xb'),'port':0x11dd});function connectionHandler(_0x4bb36b){process[_0x1ff9('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4bb36b);agiHandler(_0x4bb36b);}catch(_0xbd2a9d){logger['error'](_0xbd2a9d[_0x1ff9('0xd')]);}});});}function listeningHandler(){console[_0x1ff9('0xe')](_0x1ff9('0xf'),config[_0x1ff9('0x7')][_0x1ff9('0x10')]);logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')](_0x1ff9('0x13'),config['agi']['ip'],config['agi']['port']));}function errorHandler(_0x105fd6){if(_0x105fd6&&_0x105fd6['name']&&_0x105fd6[_0x1ff9('0x14')]){logger[_0x1ff9('0x15')](util[_0x1ff9('0x12')](_0x1ff9('0x16'),_0x105fd6[_0x1ff9('0x17')],_0x105fd6['message']));}else{logger[_0x1ff9('0x15')](util['format'](_0x1ff9('0x18'),_0x105fd6[_0x1ff9('0xd')]));}}function closeHandler(){logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')](_0x1ff9('0x19'),this[_0x1ff9('0x1a')],this[_0x1ff9('0x1b')],this['callerid'],this['dnid'],this[_0x1ff9('0x1c')]));try{createSquareReport(this);}catch(_0xacac60){logger[_0x1ff9('0x15')](_0xacac60[_0x1ff9('0xd')]);}}function timeoutHandler(){logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')](_0x1ff9('0x1d'),this[_0x1ff9('0x1a')],this[_0x1ff9('0x1b')],this[_0x1ff9('0x1e')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')](_0x1ff9('0x1f'),this[_0x1ff9('0x1a')],this[_0x1ff9('0x1b')],this[_0x1ff9('0x1e')],this[_0x1ff9('0x20')],this[_0x1ff9('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x5b7f37){return parser[_0x1ff9('0x21')](_0x5b7f37,{'object':!![]})[_0x1ff9('0x22')][_0x1ff9('0x23')];}function addVertex(_0x35441c,_0x28c62d,_0x149f8e){_0x28c62d['agicommand']=_0x149f8e;if(_0x28c62d[_0x1ff9('0x24')](_0x1ff9('0x25'))){_0x28c62d['maxRetry']=parseInt(_0x28c62d[_0x1ff9('0x25')],0xa);}_0x35441c[_0x1ff9('0x26')](_[_0x1ff9('0x27')](_0x28c62d,_0x1ff9('0x28')));}function initGraph(_0x264702,_0x1bb77a){var _0x1d3bc3=new Graph();for(var _0x291c1c in _0x264702){if(_0x264702[_0x1ff9('0x24')](_0x291c1c)){if(_['isArray'](_0x264702[_0x291c1c])){for(var _0xcb0b21=0x0;_0xcb0b21<_0x264702[_0x291c1c]['length'];_0xcb0b21+=0x1){addVertex(_0x1d3bc3,_0x264702[_0x291c1c][_0xcb0b21],_0x291c1c);}}else{addVertex(_0x1d3bc3,_0x264702[_0x291c1c],_0x291c1c);}}}for(var _0x47c084=0x0;_0x47c084<_0x1bb77a['length'];_0x47c084+=0x1){if(_0x1bb77a[_0x47c084][_0x1ff9('0x29')]&&_0x1bb77a[_0x47c084][_0x1ff9('0x2a')]){_0x1d3bc3['addEdge'](_0x1bb77a[_0x47c084][_0x1ff9('0x29')],_0x1bb77a[_0x47c084][_0x1ff9('0x2a')],_0x1bb77a[_0x47c084][_0x1ff9('0x2b')]);}}return _0x1d3bc3;}function getSquareProject(_0x59c758,_0x1bd009){rpc['getSquareProject'](_0x59c758)[_0x1ff9('0x2c')](function(_0x50830b){_0x1bd009(null,_0x50830b);})[_0x1ff9('0x2d')](function(_0x41a706){_0x1bd009(null,_0x41a706);});}function createSquareReport(_0x978d8c,_0x39a97f){rpc[_0x1ff9('0x2e')](_0x978d8c)[_0x1ff9('0x2c')](function(_0x493aac){if(_0x39a97f){_0x39a97f(null,_0x493aac);}})['catch'](function(_0x1fece9){if(_0x39a97f){_0x39a97f(null,_0x1fece9);}});}function setChannelVariables(_0x4069f2){for(var _0x258a9a in _0x4069f2){if(_0x4069f2['hasOwnProperty'](_0x258a9a)){if(_0x258a9a[_0x1ff9('0x2f')](_0x1ff9('0x30'))===0x0){_0x4069f2[_0x258a9a[_0x1ff9('0x31')](0x4)]=_0x4069f2[_0x258a9a];delete _0x4069f2[_0x258a9a];}}}}function getLogFromObject(_0x5a6aa9){return util[_0x1ff9('0x32')](_0x5a6aa9,{'showHidden':![],'depth':null});}function agiHandler(_0x48f720){var _0x2fd5ce,_0x59264a,_0x42a155,_0x5ea017,_0xa0fcaa;logger['debug']('variables',JSON['stringify'](_0x48f720,null,0x2));logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')](_0x1ff9('0x33'),_0x48f720[_0x1ff9('0x1a')],_0x48f720[_0x1ff9('0x1b')],_0x48f720[_0x1ff9('0x1e')],_0x48f720[_0x1ff9('0x20')],_0x48f720[_0x1ff9('0x1c')]));_0x48f720['on'](_0x1ff9('0x15'),errorHandler);_0x48f720['on'](_0x1ff9('0x34'),closeHandler);_0x48f720['on'](_0x1ff9('0x35'),timeoutHandler);_0x48f720['evtHangup']=![];_0x48f720['on'](_0x1ff9('0x36'),hangupHandler);var _0x43d4b0=getSquareProject[_0x1ff9('0x37')](null,_0x48f720['arg_1']);if(_0x43d4b0){if(_0x43d4b0[_0x1ff9('0x38')]){_0x2fd5ce=getRoot(_0x43d4b0[_0x1ff9('0x38')]);console[_0x1ff9('0xe')](_0x1ff9('0x39'),_0x2fd5ce);if(_0x2fd5ce&&_0x2fd5ce['start']){logger[_0x1ff9('0x3a')](_0x1ff9('0x23'),JSON[_0x1ff9('0x3b')](_0x2fd5ce,null,0x2));_0x48f720[_0x1ff9('0x3c')]=moment()['format'](_0x1ff9('0x3d'));_0x59264a=initGraph(_[_0x1ff9('0x27')](_0x2fd5ce,'mxCell'),_0x2fd5ce[_0x1ff9('0x28')]);_0x42a155=new Vertices(_0x48f720,rpc,mailRpc);logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x48f720[_0x1ff9('0x1a')],_0x48f720[_0x1ff9('0x1b')],_0x48f720[_0x1ff9('0x1e')],_0x48f720[_0x1ff9('0x20')],_0x48f720['uniqueid']));_0x59264a[_0x1ff9('0x3e')](_0x2fd5ce[_0x1ff9('0x3f')]['id'],function(_0x58c026){try{_0x58c026=_0x42a155['clear'](_0x58c026);logger[_0x1ff9('0x3a')](_0x1ff9('0x40'),JSON[_0x1ff9('0x3b')](_0x58c026,null,0x2));if(_0x58c026['agicommand']===_0x1ff9('0x41')){logger[_0x1ff9('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x48f720[_0x1ff9('0x42')]=_0x58c026['context']||_0x48f720['context'];_0x48f720[_0x1ff9('0x43')]=_0x58c026[_0x1ff9('0x43')];_0x48f720[_0x1ff9('0x44')]=_0x58c026[_0x1ff9('0x44')]?_0x58c026[_0x1ff9('0x44')]-0x1:0x1;return null;}else if(_0x58c026&&_0x42a155[_0x58c026[_0x1ff9('0x45')]]){_0xa0fcaa=_0x42a155[_0x58c026['agicommand']](_0x58c026);logger[_0x1ff9('0x11')](_0x1ff9('0x46'),JSON['stringify'](_0xa0fcaa,null,0x2));if(_0xa0fcaa&&_0xa0fcaa[_0x1ff9('0x47')]===AGI_CODE_SUCCESS&&_0xa0fcaa[_0x1ff9('0x48')]!==AGI_RESULT_ERROR&&!_0x48f720[_0x1ff9('0x49')]){logger[_0x1ff9('0x3a')](_0x1ff9('0x46'),getLogFromObject(_0xa0fcaa));return _[_0x1ff9('0x4a')](_0xa0fcaa[_0x1ff9('0x48')])?null:_0xa0fcaa[_0x1ff9('0x48')][_0x1ff9('0x4b')]();}else{logger['error'](_0x1ff9('0x46'),getLogFromObject(_0xa0fcaa));return null;}}else{logger[_0x1ff9('0x15')](_0x1ff9('0x4c'));return null;}}catch(_0x3bdf6c){logger[_0x1ff9('0x15')](_0x3bdf6c[_0x1ff9('0xd')]);return null;}});if(_0x2fd5ce[_0x1ff9('0x4d')]){logger['info'](util['format'](_0x1ff9('0x4e'),_0x48f720['arg_1'],_0x48f720[_0x1ff9('0x1b')],_0x48f720[_0x1ff9('0x1e')],_0x48f720['dnid'],_0x48f720['uniqueid']));_0x59264a[_0x1ff9('0x3e')](_0x2fd5ce[_0x1ff9('0x4d')]['id'],function(_0xf4b2ee){try{_0xf4b2ee=_0x42a155[_0x1ff9('0x4f')](_0xf4b2ee);logger[_0x1ff9('0x3a')](_0x1ff9('0x40'),JSON[_0x1ff9('0x3b')](_0xf4b2ee,null,0x2));if(_0xf4b2ee&&_0x42a155[_0xf4b2ee['agicommand']]){_0xa0fcaa=_0x42a155[_0xf4b2ee[_0x1ff9('0x45')]](_0xf4b2ee);if(_0xa0fcaa){logger[_0x1ff9('0x3a')](_0x1ff9('0x46'),getLogFromObject(_0xa0fcaa));return _[_0x1ff9('0x4a')](_0xa0fcaa['result'])?null:_0xa0fcaa[_0x1ff9('0x48')]['toString']();}else{logger[_0x1ff9('0x15')](_0x1ff9('0x46'),getLogFromObject(_0xa0fcaa));return null;}}else{logger[_0x1ff9('0x15')](_0x1ff9('0x4c'));return null;}}catch(_0xa7e0ca){logger[_0x1ff9('0x15')](_0xa7e0ca['stack']);return null;}});}logger[_0x1ff9('0x11')](util[_0x1ff9('0x12')](_0x1ff9('0x50'),_0x48f720[_0x1ff9('0x1a')],_0x48f720[_0x1ff9('0x1b')],_0x48f720[_0x1ff9('0x1e')],_0x48f720[_0x1ff9('0x20')],_0x48f720[_0x1ff9('0x1c')]));logger['info'](util[_0x1ff9('0x12')](_0x1ff9('0x51'),_0x48f720[_0x1ff9('0x42')],_0x48f720[_0x1ff9('0x43')],parseInt(_0x48f720[_0x1ff9('0x44')],0xa)+0x1));_0x48f720[_0x1ff9('0x52')](_0x48f720[_0x1ff9('0x42')],_0x48f720[_0x1ff9('0x43')],parseInt(_0x48f720['priority'],0xa)+0x1);_0x48f720[_0x1ff9('0x34')]();}}else{logger[_0x1ff9('0x15')](util[_0x1ff9('0x12')]('Project\x20%s\x20not\x20published',_0x48f720['arg_1']));_0x48f720[_0x1ff9('0x52')](_0x48f720[_0x1ff9('0x42')],_0x48f720[_0x1ff9('0x43')],parseInt(_0x48f720[_0x1ff9('0x44')],0xa)+0x1);_0x48f720[_0x1ff9('0x34')]();}}else{logger[_0x1ff9('0x15')](util[_0x1ff9('0x12')](_0x1ff9('0x53'),_0x48f720[_0x1ff9('0x1a')]));_0x48f720[_0x1ff9('0x52')](_0x48f720['context'],_0x48f720['extension'],parseInt(_0x48f720[_0x1ff9('0x44')],0xa)+0x1);_0x48f720[_0x1ff9('0x34')]();}}function main(){var _0x579d4f;return utilLicense[_0x1ff9('0x54')]()[_0x1ff9('0x2c')](function(_0x5b4325){if(_0x5b4325){if(_0x5b4325[_0x1ff9('0x55')]){if(_0x5b4325['callysquare']&&_0x5b4325['callysquare']>0x0){logger[_0x1ff9('0x11')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x5b4325['callysquare']));_0x579d4f=_0x5b4325[_0x1ff9('0x56')];}else{logger[_0x1ff9('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x1ff9('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x579d4f=-0x1;}}})[_0x1ff9('0x2d')](function(_0x55e60c){logger[_0x1ff9('0x15')](_0x1ff9('0x57'),_0x55e60c[_0x1ff9('0xd')]);})[_0x1ff9('0x4d')](function(){var _0x3544f6=require('./server')(config['agi'][_0x1ff9('0x10')],config['agi']['ip'],_0x579d4f);_0x3544f6['on'](_0x1ff9('0x15'),errorHandler);_0x3544f6['on']('listening',listeningHandler);_0x3544f6['on']('connection',connectionHandler);_0x3544f6['on'](_0x1ff9('0x34'),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 af8ad7a..8f00a44 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x477af2,_0x229cd2){var _0x30d4b3=function(_0x209214){while(--_0x209214){_0x477af2['push'](_0x477af2['shift']());}};_0x30d4b3(++_0x229cd2);}(_0x814b,0x1a2));var _0xb814=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x814b[_0x265aa2];return _0x447a3a;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2fd54f,_0x64ad0a){var _0x116086=function(_0x2e8c1d){while(--_0x2e8c1d){_0x2fd54f['push'](_0x2fd54f['shift']());}};_0x116086(++_0x64ad0a);}(_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/agi/reply.js b/server/services/agi/reply.js index bbecc77..df540db 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0xedd191,_0x8b600b){var _0x1f9dec=function(_0x2862a6){while(--_0x2862a6){_0xedd191['push'](_0xedd191['shift']());}};_0x1f9dec(++_0x8b600b);}(_0x7a54,0x106));var _0x47a5=function(_0x2c606a,_0x53ab02){_0x2c606a=_0x2c606a-0x0;var _0x230fca=_0x7a54[_0x2c606a];return _0x230fca;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=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(_0x54ec3f,_0x57c956){var _0x5ef410=function(_0x363317){while(--_0x363317){_0x54ec3f['push'](_0x54ec3f['shift']());}};_0x5ef410(++_0x57c956);}(_0x5f2f,0x73));var _0xf5f2=function(_0x114067,_0x41a5dd){_0x114067=_0x114067-0x0;var _0x184132=_0x5f2f[_0x114067];return _0x184132;};'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 54f76a5..d1c6e6c 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 _0xf3b2=['arg_2','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','then','error','message','result','catch','getSquareProject','production','ShowMailAccount','MailServerOut','Smtp','email','getVoiceQueueById','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf3b2,0x152));var _0x2f3b=function(_0x2d08c5,_0x2b19f1){_0x2d08c5=_0x2d08c5-0x0;var _0x5c71b1=_0xf3b2[_0x2d08c5];return _0x5c71b1;};'use strict';var BPromise=require(_0x2f3b('0x0'));var moment=require('moment');var _=require(_0x2f3b('0x1'));var util=require(_0x2f3b('0x2'));var jayson=require(_0x2f3b('0x3'));var client=jayson[_0x2f3b('0x4')][_0x2f3b('0x5')]({'port':0x2329});function request(_0x528e84,_0x5d2dc0){return new BPromise(function(_0x276dac,_0x11857a){return client['request'](_0x528e84,_0x5d2dc0)[_0x2f3b('0x6')](function(_0x3f0138){if(_0x3f0138[_0x2f3b('0x7')]){return _0x11857a(_0x3f0138[_0x2f3b('0x7')][_0x2f3b('0x8')]);}else{return _0x276dac(_0x3f0138[_0x2f3b('0x9')]);}})[_0x2f3b('0xa')](function(_0x3e021c){return _0x11857a(_0x3e021c);});});}exports[_0x2f3b('0xb')]=function(_0x122eab){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x122eab},'attributes':[_0x2f3b('0xc')]}});};exports['getMailAccountById']=function(_0x4f7d75){return request(_0x2f3b('0xd'),{'options':{'raw':![],'where':{'id':_0x4f7d75},'include':[{'model':_0x2f3b('0xe'),'as':_0x2f3b('0xf')}],'attributes':['id','name',_0x2f3b('0x10')]}});};exports['getSquareProjectById']=function(_0x2af00c){return request('ShowSquareProject',{'options':{'where':{'id':_0x2af00c},'attributes':['name']}});};exports[_0x2f3b('0x11')]=function(_0x442039){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x442039},'attributes':[_0x2f3b('0x12')]}});};exports[_0x2f3b('0x13')]=function(_0x499e86){return request(_0x2f3b('0x14'),{'options':{'where':{'id':_0x499e86},'attributes':[_0x2f3b('0x12')]}});};exports[_0x2f3b('0x15')]=function(_0xaa50b6){return request(_0x2f3b('0x16'),{'options':{'where':{'id':_0xaa50b6},'attributes':[_0x2f3b('0x17')]}});};exports[_0x2f3b('0x18')]=function(_0x456742){return request(_0x2f3b('0x19'),{'options':{'where':{'id':_0x456742},'attributes':[_0x2f3b('0x12')]}});};exports['getTrunkById']=function(_0x1d6647){return request('ShowTrunk',{'options':{'where':{'id':_0x1d6647},'attributes':[_0x2f3b('0x12')]}});};exports[_0x2f3b('0x1a')]=function(_0x9a46d){return request(_0x2f3b('0x1b'),{'options':{'where':{'id':_0x9a46d},'attributes':['save_name']}});};exports[_0x2f3b('0x1c')]=function(_0x46a53b){return request(_0x2f3b('0x1d'),{'options':{'raw':![],'where':{'id':_0x46a53b},'include':[{'model':_0x2f3b('0x1e'),'as':_0x2f3b('0x1f')}]}});};exports[_0x2f3b('0x20')]=function(_0x3f09fb){return request(_0x2f3b('0x21'),{'options':{'where':{'id':_0x3f09fb},'attributes':['id',_0x2f3b('0x12')]}});};exports[_0x2f3b('0x22')]=function(_0x5ed7ed){return request('CreateSmsMessage',{'body':_0x5ed7ed});};exports[_0x2f3b('0x23')]=function(_0x4b482d){return request(_0x2f3b('0x24'),{'body':_0x4b482d});};exports[_0x2f3b('0x25')]=function(_0x5f598c){return request(_0x2f3b('0x26'),{'body':_['merge'](_0x5f598c,{'project_name':_0x5f598c[_0x2f3b('0x27')],'prev_project_name':_0x5f598c[_0x2f3b('0x28')]||'','is_subproject':_0x5f598c[_0x2f3b('0x28')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x1131a9){return request(_0x2f3b('0x29'),{'body':_0x1131a9});};exports[_0x2f3b('0x2a')]=function(_0x8d2e52){return request(_0x2f3b('0x2b'),{'body':_0x8d2e52});};exports[_0x2f3b('0x2c')]=function(_0x2a5602){return request(_0x2f3b('0x2d'),{'options':{'raw':![],'where':{'phone':_0x2a5602['phone'],'ListId':_0x2a5602[_0x2f3b('0x2e')]}}})['then'](function(_0x54a81e){if(_0x54a81e){return _0x54a81e;}return request('CreateCmContact',{'body':_0x2a5602});});};exports[_0x2f3b('0x2f')]=function(_0x5142ae){return request(_0x2f3b('0x30'),{'options':{'where':{'id':_0x5142ae},'attributes':[_0x2f3b('0x12')]}});};exports['agentLogin']=function(_0x34b0b5,_0x26525b){return request(_0x2f3b('0x31'),{'body':{'interface':_0x26525b},'options':{'where':_0x34b0b5}});};exports[_0x2f3b('0x32')]=function(_0x381e9a,_0x3bd5f8,_0x66895f){return request('PauseUser',{'body':{'type':_0x3bd5f8,'uniqueid':_0x66895f},'options':{'where':_0x381e9a}});};exports[_0x2f3b('0x33')]=function(_0x460c19){return request(_0x2f3b('0x34'),{'body':{},'options':{'where':_0x460c19}});};exports['agentLogout']=function(_0x148083){return request(_0x2f3b('0x35'),{'body':{},'options':{'where':_0x148083}});}; \ No newline at end of file +var _0x06fc=['createSquareReport','CreateSquareReport','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','LogoutUser','bluebird','lodash','jayson/promise','client','http','message','catch','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport'];(function(_0x559715,_0x5b4f9c){var _0x1c6c6a=function(_0x47a021){while(--_0x47a021){_0x559715['push'](_0x559715['shift']());}};_0x1c6c6a(++_0x5b4f9c);}(_0x06fc,0x1b2));var _0xc06f=function(_0x25932e,_0x38a53e){_0x25932e=_0x25932e-0x0;var _0x1f3d4f=_0x06fc[_0x25932e];return _0x1f3d4f;};'use strict';var BPromise=require(_0xc06f('0x0'));var moment=require('moment');var _=require(_0xc06f('0x1'));var util=require('util');var jayson=require(_0xc06f('0x2'));var client=jayson[_0xc06f('0x3')][_0xc06f('0x4')]({'port':0x2329});function request(_0x369866,_0x55f6bc){return new BPromise(function(_0x3e9d0d,_0x2de7bb){return client['request'](_0x369866,_0x55f6bc)['then'](function(_0x46e07b){if(_0x46e07b['error']){return _0x2de7bb(_0x46e07b['error'][_0xc06f('0x5')]);}else{return _0x3e9d0d(_0x46e07b['result']);}})[_0xc06f('0x6')](function(_0x4eeb40){return _0x2de7bb(_0x4eeb40);});});}exports[_0xc06f('0x7')]=function(_0x4e073c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4e073c},'attributes':['production']}});};exports[_0xc06f('0x8')]=function(_0x4d6396){return request(_0xc06f('0x9'),{'options':{'raw':![],'where':{'id':_0x4d6396},'include':[{'model':_0xc06f('0xa'),'as':_0xc06f('0xb')}],'attributes':['id',_0xc06f('0xc'),'email']}});};exports['getSquareProjectById']=function(_0x1dfd86){return request('ShowSquareProject',{'options':{'where':{'id':_0x1dfd86},'attributes':[_0xc06f('0xc')]}});};exports[_0xc06f('0xd')]=function(_0x4dd74a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4dd74a},'attributes':['name']}});};exports[_0xc06f('0xe')]=function(_0x2a87a3){return request(_0xc06f('0xf'),{'options':{'where':{'id':_0x2a87a3},'attributes':[_0xc06f('0xc')]}});};exports[_0xc06f('0x10')]=function(_0x2fa050){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2fa050},'attributes':[_0xc06f('0x11')]}});};exports[_0xc06f('0x12')]=function(_0x468c7){return request(_0xc06f('0x13'),{'options':{'where':{'id':_0x468c7},'attributes':[_0xc06f('0xc')]}});};exports[_0xc06f('0x14')]=function(_0x332230){return request(_0xc06f('0x15'),{'options':{'where':{'id':_0x332230},'attributes':[_0xc06f('0xc')]}});};exports[_0xc06f('0x16')]=function(_0x5ef3ff){return request(_0xc06f('0x17'),{'options':{'where':{'id':_0x5ef3ff},'attributes':[_0xc06f('0x18')]}});};exports[_0xc06f('0x19')]=function(_0x47952e){return request(_0xc06f('0x1a'),{'options':{'raw':![],'where':{'id':_0x47952e},'include':[{'model':_0xc06f('0x1b'),'as':_0xc06f('0x1c')}]}});};exports['getSmsAccountById']=function(_0x2c1c57){return request(_0xc06f('0x1d'),{'options':{'where':{'id':_0x2c1c57},'attributes':['id','name']}});};exports[_0xc06f('0x1e')]=function(_0x39b3c7){return request(_0xc06f('0x1f'),{'body':_0x39b3c7});};exports[_0xc06f('0x20')]=function(_0x455beb){return request(_0xc06f('0x21'),{'body':_0x455beb});};exports[_0xc06f('0x22')]=function(_0x282dde){return request(_0xc06f('0x23'),{'body':_['merge'](_0x282dde,{'project_name':_0x282dde[_0xc06f('0x24')],'prev_project_name':_0x282dde['arg_2']||'','is_subproject':_0x282dde['arg_2']?!![]:![],'leaveAt':moment()[_0xc06f('0x25')](_0xc06f('0x26'))})});};exports[_0xc06f('0x27')]=function(_0x203cce){return request('CreateSquareRecording',{'body':_0x203cce});};exports[_0xc06f('0x28')]=function(_0x4ed36b){return request(_0xc06f('0x29'),{'body':_0x4ed36b});};exports[_0xc06f('0x2a')]=function(_0x159789){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x159789[_0xc06f('0x2b')],'ListId':_0x159789[_0xc06f('0x2c')]}}})[_0xc06f('0x2d')](function(_0x1913ba){if(_0x1913ba){return _0x1913ba;}return request('CreateCmContact',{'body':_0x159789});});};exports['getPauseById']=function(_0x3e55eb){return request(_0xc06f('0x2e'),{'options':{'where':{'id':_0x3e55eb},'attributes':['name']}});};exports[_0xc06f('0x2f')]=function(_0x2da86e,_0x185e19){return request(_0xc06f('0x30'),{'body':{'interface':_0x185e19},'options':{'where':_0x2da86e}});};exports['agentPause']=function(_0x424bb8,_0x9e9b76,_0x39729a){return request(_0xc06f('0x31'),{'body':{'type':_0x9e9b76,'uniqueid':_0x39729a},'options':{'where':_0x424bb8}});};exports[_0xc06f('0x32')]=function(_0x6b8e08){return request('UnpauseUser',{'body':{},'options':{'where':_0x6b8e08}});};exports['agentLogout']=function(_0x476e41){return request(_0xc06f('0x33'),{'body':{},'options':{'where':_0x476e41}});}; \ 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 2d17615..d501253 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 _0xf873=['./lex','exports'];(function(_0x133b65,_0x50a203){var _0x4e4eca=function(_0x913326){while(--_0x913326){_0x133b65['push'](_0x133b65['shift']());}};_0x4e4eca(++_0x50a203);}(_0xf873,0xb2));var _0x3f87=function(_0x26d600,_0x252c58){_0x26d600=_0x26d600-0x0;var _0x354242=_0xf873[_0x26d600];return _0x354242;};var polly=require('./polly');var lex=require(_0x3f87('0x0'));module[_0x3f87('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xdace=['exports','./polly'];(function(_0x2f9f77,_0x3a721d){var _0x3445b2=function(_0x2cd4d2){while(--_0x2cd4d2){_0x2f9f77['push'](_0x2f9f77['shift']());}};_0x3445b2(++_0x3a721d);}(_0xdace,0xc5));var _0xedac=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xdace[_0x174ef5];return _0x1cc379;};var polly=require(_0xedac('0x0'));var lex=require('./lex');module[_0xedac('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 81d4d03..700fa19 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(_0x5cd852,_0x477fe6){var _0x37b8a0=function(_0x370e41){while(--_0x370e41){_0x5cd852['push'](_0x5cd852['shift']());}};_0x37b8a0(++_0x477fe6);}(_0x6b19,0xe8));var _0x96b1=function(_0x5bb957,_0xf8e72f){_0x5bb957=_0x5bb957-0x0;var _0x3b213a=_0x6b19[_0x5bb957];return _0x3b213a;};'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 _0x0506=['exports','./lib/api'];(function(_0x179039,_0x4d60c1){var _0x1482cf=function(_0xccfddd){while(--_0xccfddd){_0x179039['push'](_0x179039['shift']());}};_0x1482cf(++_0x4d60c1);}(_0x0506,0x1d1));var _0x6050=function(_0x3ca9fa,_0x234230){_0x3ca9fa=_0x3ca9fa-0x0;var _0x4a50d5=_0x0506[_0x3ca9fa];return _0x4a50d5;};'use strict';var lex=require(_0x6050('0x0'));module[_0x6050('0x1')]=function(_0x1ba949,_0x5592e4,_0x52f82b,_0x5139c7,_0x49a1ca,_0x229b5f){return lex(_0x1ba949,_0x5592e4,_0x52f82b,_0x5139c7,_0x49a1ca,_0x229b5f);}; \ 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 de85f98..6d5fe49 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 _0xe927=['slot_','exports','LexRuntime','bluebird','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x4c403d,_0x5ef49f){var _0x5a0c35=function(_0x40ba5a){while(--_0x40ba5a){_0x4c403d['push'](_0x4c403d['shift']());}};_0x5a0c35(++_0x5ef49f);}(_0xe927,0xf3));var _0x7e92=function(_0x287184,_0x1231a7){_0x287184=_0x287184-0x0;var _0x1b59f3=_0xe927[_0x287184];return _0x1b59f3;};'use strict';var BPromise=require(_0x7e92('0x0'));var AWS=require(_0x7e92('0x1'));function lexResult(_0x4538c9,_0x15c807){return new BPromise(function(_0x8bf12,_0x5ee4b3){_0x4538c9[_0x7e92('0x2')](_0x15c807,function(_0x375bec,_0x29129e){if(_0x375bec){_0x5ee4b3(_0x375bec);}if(_0x29129e['slots']){for(const _0x4e74a9 in _0x29129e[_0x7e92('0x3')]){if(_0x29129e['slots'][_0x7e92('0x4')](_0x4e74a9)){var _0x594e11=_0x29129e[_0x7e92('0x3')][_0x4e74a9];_0x29129e[_0x7e92('0x5')+_0x4e74a9]=_0x594e11;}}}_0x8bf12(_0x29129e);});});}module[_0x7e92('0x6')]=function(_0x113eea,_0x1c7723,_0x544061,_0x311c36,_0x1dea5d,_0x18802f){var _0x11d6df=new AWS[(_0x7e92('0x7'))]({'accessKeyId':_0x1c7723,'secretAccessKey':_0x544061,'region':_0x311c36});var _0x517520={'botAlias':'$LATEST','botName':_0x18802f,'inputText':_0x1dea5d,'userId':_0x113eea};return lexResult(_0x11d6df,_0x517520);}; \ No newline at end of file +var _0x5d28=['LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_','exports'];(function(_0x5e96f2,_0x140b98){var _0x3630dd=function(_0x5463bc){while(--_0x5463bc){_0x5e96f2['push'](_0x5e96f2['shift']());}};_0x3630dd(++_0x140b98);}(_0x5d28,0x146));var _0x85d2=function(_0x232560,_0x351b73){_0x232560=_0x232560-0x0;var _0x745215=_0x5d28[_0x232560];return _0x745215;};'use strict';var BPromise=require(_0x85d2('0x0'));var AWS=require(_0x85d2('0x1'));function lexResult(_0x56a16d,_0x17fb92){return new BPromise(function(_0x192076,_0x6a0417){_0x56a16d[_0x85d2('0x2')](_0x17fb92,function(_0x165289,_0x36b444){if(_0x165289){_0x6a0417(_0x165289);}if(_0x36b444[_0x85d2('0x3')]){for(const _0x299b13 in _0x36b444['slots']){if(_0x36b444[_0x85d2('0x3')][_0x85d2('0x4')](_0x299b13)){var _0xdbc2be=_0x36b444[_0x85d2('0x3')][_0x299b13];_0x36b444[_0x85d2('0x5')+_0x299b13]=_0xdbc2be;}}}_0x192076(_0x36b444);});});}module[_0x85d2('0x6')]=function(_0x5c59cd,_0x16d737,_0x353637,_0x519462,_0x162dc2,_0x1bf390){var _0x13133a=new AWS[(_0x85d2('0x7'))]({'accessKeyId':_0x16d737,'secretAccessKey':_0x353637,'region':_0x519462});var _0x12c985={'botAlias':_0x85d2('0x8'),'botName':_0x1bf390,'inputText':_0x162dc2,'userId':_0x5c59cd};return lexResult(_0x13133a,_0x12c985);}; \ 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 2355895..d08e66d 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 _0xb2f4=['exports','./lib/api'];(function(_0x3a175b,_0x3d9fbb){var _0x16d7c9=function(_0x35afbd){while(--_0x35afbd){_0x3a175b['push'](_0x3a175b['shift']());}};_0x16d7c9(++_0x3d9fbb);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x54395b,_0x51babb){_0x54395b=_0x54395b-0x0;var _0x199c87=_0xb2f4[_0x54395b];return _0x199c87;};'use strict';var polly=require(_0x4b2f('0x0'));module[_0x4b2f('0x1')]=function(_0x4293c0,_0x188e25,_0x296c32,_0x453d8a,_0x5a2b2,_0x14e65c,_0x3c88da){return polly(_0x4293c0,_0x188e25,_0x296c32,_0x453d8a,_0x5a2b2,_0x14e65c,_0x3c88da);}; \ No newline at end of file +var _0x465b=['./lib/api','exports'];(function(_0x1e24f8,_0x52070f){var _0x5c4446=function(_0x40bf51){while(--_0x40bf51){_0x1e24f8['push'](_0x1e24f8['shift']());}};_0x5c4446(++_0x52070f);}(_0x465b,0x1dc));var _0xb465=function(_0x4ca90b,_0x37977a){_0x4ca90b=_0x4ca90b-0x0;var _0x39472f=_0x465b[_0x4ca90b];return _0x39472f;};'use strict';var polly=require(_0xb465('0x0'));module[_0xb465('0x1')]=function(_0x4bcdcc,_0x2ea8a0,_0x2b593f,_0x465574,_0x2d6948,_0x22ca5d,_0x5946de){return polly(_0x4bcdcc,_0x2ea8a0,_0x2b593f,_0x465574,_0x2d6948,_0x22ca5d,_0x5946de);}; \ 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 52c55c5..c65dbd4 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 _0x411c=['path','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x411c,0x16b));var _0xc411=function(_0x3527c8,_0x3dec31){_0x3527c8=_0x3527c8-0x0;var _0x3ce0bb=_0x411c[_0x3527c8];return _0x3ce0bb;};'use strict';var fs=require('fs');var path=require(_0xc411('0x0'));var BPromise=require(_0xc411('0x1'));var rs=require(_0xc411('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x53fa9a,_0x43c778,_0x540754){return new BPromise(function(_0xdc3092,_0x2a9135){_0x53fa9a[_0xc411('0x3')](_0x43c778,function(_0x32be7a,_0x12ee57){if(_0x32be7a){_0x2a9135(_0x32be7a);}else if(_0x12ee57){if(_0x12ee57['AudioStream']instanceof Buffer){fs[_0xc411('0x4')](_0x540754,_0x12ee57[_0xc411('0x5')],function(_0x3b75f3){if(_0x3b75f3){_0x2a9135(_0x3b75f3);}else{_0xdc3092();}});}else{_0x2a9135(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2a9135(new Error(_0xc411('0x6')));}});});}module[_0xc411('0x7')]=function(_0x20d766,_0x3b477d,_0x3f24a2,_0x3b6da5,_0x361ef8,_0x1a02e4,_0x1ac433){var _0xee8fbe=new AWS[(_0xc411('0x8'))]({'accessKeyId':_0x20d766,'secretAccessKey':_0x3b477d,'region':_0x3f24a2});var _0x5b508d={'Text':_0x361ef8,'TextType':_0x1a02e4||_0xc411('0x9'),'OutputFormat':_0xc411('0xa'),'VoiceId':_0x3b6da5};return pollyResult(_0xee8fbe,_0x5b508d,_0x1ac433);}; \ No newline at end of file +var _0x9b44=['Polly','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0xecf06c,_0x3c1c00){var _0x156c4e=function(_0xac3eef){while(--_0xac3eef){_0xecf06c['push'](_0xecf06c['shift']());}};_0x156c4e(++_0x3c1c00);}(_0x9b44,0x137));var _0x49b4=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x9b44[_0x59b439];return _0x521ea3;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x1f72bc,_0x5bf230,_0x1d846e){return new BPromise(function(_0x40ac84,_0x54a8f6){_0x1f72bc[_0x49b4('0x0')](_0x5bf230,function(_0x4c8ca0,_0x23bfcc){if(_0x4c8ca0){_0x54a8f6(_0x4c8ca0);}else if(_0x23bfcc){if(_0x23bfcc[_0x49b4('0x1')]instanceof Buffer){fs['writeFile'](_0x1d846e,_0x23bfcc[_0x49b4('0x1')],function(_0xe0e69b){if(_0xe0e69b){_0x54a8f6(_0xe0e69b);}else{_0x40ac84();}});}else{_0x54a8f6(new Error(_0x49b4('0x2')));}}else{_0x54a8f6(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x49b4('0x3')]=function(_0x4575c9,_0x437159,_0x350b59,_0x48e9fe,_0x408672,_0x430d23,_0x38d73d){var _0x2e59e6=new AWS[(_0x49b4('0x4'))]({'accessKeyId':_0x4575c9,'secretAccessKey':_0x437159,'region':_0x350b59});var _0x5203dd={'Text':_0x408672,'TextType':_0x430d23||'text','OutputFormat':'mp3','VoiceId':_0x48e9fe};return pollyResult(_0x2e59e6,_0x5203dd,_0x38d73d);}; \ 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 93b2ace..f0428cd 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 _0x21f6=['exports'];(function(_0x24b097,_0x57c03d){var _0x4ce794=function(_0x1b2d75){while(--_0x1b2d75){_0x24b097['push'](_0x24b097['shift']());}};_0x4ce794(++_0x57c03d);}(_0x21f6,0x177));var _0x621f=function(_0x31920e,_0x53c859){_0x31920e=_0x31920e-0x0;var _0x1481c3=_0x21f6[_0x31920e];return _0x1481c3;};'use strict';var asr=require('./lib/api');module[_0x621f('0x0')]=function(_0x1cb9b2,_0x1b4231,_0x4bc09f,_0x1f5ed3){return asr(_0x1cb9b2,_0x1b4231,_0x4bc09f);}; \ No newline at end of file +var _0x038e=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x038e,0xd8));var _0xe038=function(_0x27e530,_0x24fd7c){_0x27e530=_0x27e530-0x0;var _0x3cd548=_0x038e[_0x27e530];return _0x3cd548;};'use strict';var asr=require(_0xe038('0x0'));module[_0xe038('0x1')]=function(_0xf7e88a,_0x1dd7ce,_0x49967a,_0x463fa5){return asr(_0xf7e88a,_0x1dd7ce,_0x49967a);}; \ 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 6c86f31..245be1d 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 _0x931d=['readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x931d,0xf4));var _0xd931=function(_0x5876fc,_0x431a54){_0x5876fc=_0x5876fc-0x0;var _0x279a56=_0x931d[_0x5876fc];return _0x279a56;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xd931('0x0');module[_0xd931('0x1')]=function(_0x25b128,_0x379179,_0x402584){return new BPromise(function(_0x22725a,_0x4642b7){var _0x4db3ad;if(typeof _0x25b128!==_0xd931('0x2')||_0x25b128['length']===0x0){return _0x4642b7(_0xd931('0x3'));}if(typeof _0x379179!==_0xd931('0x2')||_0x379179[_0xd931('0x4')]===0x0){return _0x4642b7(_0xd931('0x5'));}if(typeof _0x402584!==_0xd931('0x6')&&(typeof _0x402584!==_0xd931('0x2')||_0x402584[_0xd931('0x4')]===0x0)){return _0x4642b7(_0xd931('0x7'));}try{_0x4db3ad=fs[_0xd931('0x8')](_0x25b128)[_0xd931('0x9')](_0xd931('0xa'));}catch(_0x3e9234){return _0x4642b7(_0x3e9234);}return _0x22725a({'method':_0xd931('0xb'),'uri':host+_0xd931('0xc')+_0x379179,'body':{'config':{'encoding':_0xd931('0xd'),'sampleRateHertz':'8000','languageCode':_0x402584},'audio':{'content':_0x4db3ad}},'json':!![]});});}; \ No newline at end of file +var _0x6833=['filepath\x20should\x20be\x20a\x20string','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','length'];(function(_0x3e39e3,_0xcd7b7e){var _0x452aef=function(_0x42403f){while(--_0x42403f){_0x3e39e3['push'](_0x3e39e3['shift']());}};_0x452aef(++_0xcd7b7e);}(_0x6833,0xa4));var _0x3683=function(_0x28922e,_0x35cb12){_0x28922e=_0x28922e-0x0;var _0x34abe5=_0x6833[_0x28922e];return _0x34abe5;};'use strict';var url=require(_0x3683('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x3683('0x1');module[_0x3683('0x2')]=function(_0x56a356,_0x44b4e3,_0x97d870){return new BPromise(function(_0x42ac8e,_0x581b70){var _0x2d1faa;if(typeof _0x56a356!=='string'||_0x56a356[_0x3683('0x3')]===0x0){return _0x581b70(_0x3683('0x4'));}if(typeof _0x44b4e3!==_0x3683('0x5')||_0x44b4e3['length']===0x0){return _0x581b70('key\x20should\x20be\x20a\x20string');}if(typeof _0x97d870!==_0x3683('0x6')&&(typeof _0x97d870!==_0x3683('0x5')||_0x97d870['length']===0x0)){return _0x581b70(_0x3683('0x7'));}try{_0x2d1faa=fs[_0x3683('0x8')](_0x56a356)['toString'](_0x3683('0x9'));}catch(_0x45ab2d){return _0x581b70(_0x45ab2d);}return _0x42ac8e({'method':_0x3683('0xa'),'uri':host+_0x3683('0xb')+_0x44b4e3,'body':{'config':{'encoding':_0x3683('0xc'),'sampleRateHertz':_0x3683('0xd'),'languageCode':_0x97d870},'audio':{'content':_0x2d1faa}},'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 10cb4be..f8ed9a8 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x102b=['./asr'];(function(_0x40cef9,_0x42e575){var _0x5b449e=function(_0xa1cf46){while(--_0xa1cf46){_0x40cef9['push'](_0x40cef9['shift']());}};_0x5b449e(++_0x42e575);}(_0x102b,0xeb));var _0xb102=function(_0x3e1370,_0x12fdb5){_0x3e1370=_0x3e1370-0x0;var _0x3db206=_0x102b[_0x3e1370];return _0x3db206;};var asr=require(_0xb102('0x0'));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 2a973ff..da9a74d 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 _0x0c32=['protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','googleCloudTTS\x20path','googleTTS','googleASR','uri','unlink','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','stringify','result','source','resolvedQuery','action','fulfillment','code','metadata','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','tmp','awsLex','lex','ispeechTTS','ispeechASR','format','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','path','http','https','url','parse','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./tilde','../../../config/logger','https://api.ispeech.org/api/rest'];(function(_0xb90ef4,_0x331d96){var _0x38f4a1=function(_0x262969){while(--_0x262969){_0xb90ef4['push'](_0xb90ef4['shift']());}};_0x38f4a1(++_0x331d96);}(_0x0c32,0x130));var _0x20c3=function(_0x116e9c,_0x489b7d){_0x116e9c=_0x116e9c-0x0;var _0x12e8ae=_0x0c32[_0x116e9c];return _0x12e8ae;};'use strict';var fs=require('fs');var path=require(_0x20c3('0x0'));var http=require(_0x20c3('0x1'));var https=require(_0x20c3('0x2'));var urlParse=require(_0x20c3('0x3'))[_0x20c3('0x4')];var BPromise=require(_0x20c3('0x5'));var rs=require(_0x20c3('0x6'));var sox=require(_0x20c3('0x7'));var rp=require(_0x20c3('0x8'));var util=require(_0x20c3('0x9'));var querystring=require(_0x20c3('0xa'));var tts=require(_0x20c3('0xb'));var apiai=require(_0x20c3('0xc'));var md5=require(_0x20c3('0xd'));var google=require('./google');var aws=require('./aws');var tilde=require(_0x20c3('0xe'));var sestek=require('./sestek');var logger=require(_0x20c3('0xf'))('agi');var ISPEECH_API=_0x20c3('0x10');function downloadFile(_0x245a31,_0x3fc4a8){return new BPromise(function(_0x5d069c,_0x51934f){var _0xe71544=urlParse(_0x245a31);var _0x59bf0e=_0xe71544[_0x20c3('0x11')]===_0x20c3('0x12')?https:http;var _0x12e9dc={'host':_0xe71544[_0x20c3('0x13')],'path':_0xe71544[_0x20c3('0x0')],'headers':{'user-agent':_0x20c3('0x14')}};_0x59bf0e[_0x20c3('0x15')](_0x12e9dc,function(_0x275565){if(_0x275565[_0x20c3('0x16')]!==0xc8){logger[_0x20c3('0x17')](_0x20c3('0x18')+_0x245a31+_0x20c3('0x19')+_0x275565[_0x20c3('0x16')]+'\x20('+_0x275565[_0x20c3('0x1a')]+')');_0x51934f(new Error('request\x20to\x20'+_0x245a31+_0x20c3('0x19')+_0x275565[_0x20c3('0x16')]+'\x20('+_0x275565['statusMessage']+')'));return;}var _0x35fc15=fs[_0x20c3('0x1b')](_0x3fc4a8);_0x35fc15['on'](_0x20c3('0x1c'),function(){logger[_0x20c3('0x1d')](_0x20c3('0x1e'));_0x35fc15[_0x20c3('0x1f')](_0x5d069c);});_0x35fc15['on'](_0x20c3('0x17'),function(_0x4c7223){fs['unlink'](_0x3fc4a8);logger[_0x20c3('0x17')](_0x20c3('0x20'),_0x4c7223);_0x51934f(_0x4c7223);});_0x275565[_0x20c3('0x21')](_0x35fc15);})['on'](_0x20c3('0x17'),function(_0x8f9c6a){logger['error'](_0x8f9c6a);_0x51934f(_0x8f9c6a);})[_0x20c3('0x22')]();});}function uploadFile(_0x146df2){return new BPromise(function(_0x31071e,_0xcfb46){var _0x2ddc5a=urlParse(_0x146df2);var _0x3ef987=_0x2ddc5a[_0x20c3('0x11')]===_0x20c3('0x12')?https:http;var _0x13af45={'host':_0x2ddc5a[_0x20c3('0x13')],'path':_0x2ddc5a[_0x20c3('0x0')],'headers':{'user-agent':_0x20c3('0x14')}};_0x3ef987[_0x20c3('0x15')](_0x13af45,function(_0x3304d3){if(_0x3304d3[_0x20c3('0x16')]!==0xc8){_0xcfb46(new Error(_0x20c3('0x18')+_0x146df2+_0x20c3('0x19')+_0x3304d3[_0x20c3('0x16')]+'\x20('+_0x3304d3[_0x20c3('0x1a')]+')'));return;}var _0x51cd50='';_0x3304d3['on'](_0x20c3('0x23'),function(_0x46c42e){_0x51cd50+=_0x46c42e;});_0x3304d3['on'](_0x20c3('0x22'),function(){_0x31071e(_0x51cd50);});})['on'](_0x20c3('0x17'),function(_0x570012){_0xcfb46(_0x570012);})[_0x20c3('0x22')]();});}function convertFile(_0x992e4c,_0x1380e5){return new BPromise(function(_0x2a9742,_0x12ede9){var _0x23329b=sox[_0x20c3('0x24')](_0x992e4c,_0x1380e5,{'sampleRate':0x1f40,'format':_0x20c3('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x23329b['on']('error',function(_0x35444e){logger[_0x20c3('0x17')](_0x20c3('0x26'),_0x35444e);_0x12ede9(_0x35444e);});_0x23329b['on'](_0x20c3('0x22'),function(){logger[_0x20c3('0x1d')](_0x20c3('0x27'));_0x2a9742();});_0x23329b['start']();});}function base64Decode(_0x396403,_0x1e730d){var _0x5ef38b=path[_0x20c3('0x28')](__dirname,'tmp',rs[_0x20c3('0x29')](0x4)+_0x20c3('0x2a'));fs[_0x20c3('0x2b')](_0x5ef38b,_0x396403,_0x20c3('0x2c'));return convertFile(_0x5ef38b,_0x1e730d)['then'](function(){try{fs['unlink'](_0x5ef38b);fs[_0x20c3('0x2d')](_0x1e730d,_0x20c3('0x2e'));}catch(_0x549fd4){logger[_0x20c3('0x17')](_0x549fd4);}return _0x1e730d[_0x20c3('0x2f')]('.')[0x0];});}function base64Encode(_0x109994){var _0x1da16b=fs[_0x20c3('0x30')](_0x109994);return new Buffer(_0x1da16b)[_0x20c3('0x31')](_0x20c3('0x2c'));}exports[_0x20c3('0x32')]=function(_0x19a63f,_0x2cbc51,_0x232aef,_0x2fdf87,_0x2d4471,_0x34d977){var _0x53c299,_0x522dd8;var _0x162873=_0x20c3('0x33');var _0x269b67=_0x20c3('0x34')+_0x19a63f;var _0x14eceb={};if(_0x2cbc51===_0x20c3('0x35')){_0x14eceb['input']={'ssml':_0x232aef};}else{_0x14eceb[_0x20c3('0x36')]={'text':_0x232aef};};_0x14eceb[_0x20c3('0x37')]={'languageCode':_0x2fdf87,'ssmlGender':_0x2d4471};_0x14eceb[_0x20c3('0x38')]={'audioEncoding':_0x20c3('0x39'),'sampleRateHertz':0x1f40};var _0x4aa838={'url':_0x162873+_0x20c3('0x3a')+_0x269b67,'method':_0x20c3('0x3b'),'json':!![],'body':_0x14eceb};return rp(_0x4aa838)[_0x20c3('0x3c')](function(_0xecd0bd){return new BPromise(function(_0x72169f,_0x24b7e1){_0x53c299=path['resolve'](__dirname,'tmp',rs[_0x20c3('0x29')](0x4)+_0x20c3('0x3d'));var _0x12d0d2=Buffer[_0x20c3('0x3e')](_0xecd0bd['audioContent'],_0x20c3('0x2c'));return fs['writeFile'](_0x53c299,_0x12d0d2,function(_0x1bcada){_0x24b7e1(_0x1bcada);},function(_0x4dad98){fs[_0x20c3('0x2d')](_0x53c299,_0x20c3('0x2e'));_0x72169f(_0x4dad98);});});})[_0x20c3('0x3c')](function(_0x139523){_0x522dd8=path[_0x20c3('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x20c3('0x2a'));return convertFile(_0x53c299,_0x522dd8);})[_0x20c3('0x3c')](function(){try{fs['unlink'](_0x53c299);fs[_0x20c3('0x2d')](_0x522dd8,_0x20c3('0x2e'));}catch(_0x5599d0){logger[_0x20c3('0x17')](_0x5599d0);}logger[_0x20c3('0x1d')](_0x20c3('0x3f'),_0x522dd8[_0x20c3('0x2f')]('.')[0x0]);return _0x522dd8['split']('.')[0x0];});};exports[_0x20c3('0x40')]=function(_0x5dec11,_0x326177){var _0x4120cb,_0x1046ef;return tts(_0x5dec11,_0x326177||'en',0x1)['then'](function(_0x9b7aa5){logger[_0x20c3('0x1d')](_0x9b7aa5);_0x4120cb=path[_0x20c3('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x20c3('0x3d'));return downloadFile(_0x9b7aa5,_0x4120cb);})[_0x20c3('0x3c')](function(){_0x1046ef=path['resolve'](__dirname,'tmp',rs[_0x20c3('0x29')](0x4)+_0x20c3('0x2a'));return convertFile(_0x4120cb,_0x1046ef);})['then'](function(){try{fs['unlink'](_0x4120cb);fs[_0x20c3('0x2d')](_0x1046ef,_0x20c3('0x2e'));}catch(_0x431392){logger[_0x20c3('0x17')](_0x431392);}logger['info']('goggleTTS\x20path',_0x1046ef['split']('.')[0x0]);return _0x1046ef[_0x20c3('0x2f')]('.')[0x0];});};exports[_0x20c3('0x41')]=function(_0x2e7379,_0x22dc33,_0x5a7008){return google['asr'](_0x2e7379,_0x22dc33,_0x5a7008)[_0x20c3('0x3c')](function(_0x30e690){logger[_0x20c3('0x1d')](_0x30e690[_0x20c3('0x42')]);return rp(_0x30e690);})[_0x20c3('0x3c')](function(_0x5e5a69){var _0x35877d='';var _0x163e40=0x0;try{fs[_0x20c3('0x43')](_0x2e7379);}catch(_0x5c4d69){logger['error'](_0x5c4d69);}if(_0x5e5a69&&_0x5e5a69[_0x20c3('0x44')]){_0x35877d=_0x5e5a69[_0x20c3('0x44')]['map'](function(_0x4d2bf4){return _0x4d2bf4&&_0x4d2bf4['alternatives'][0x0]&&_0x4d2bf4[_0x20c3('0x45')][0x0][_0x20c3('0x46')]?_0x4d2bf4[_0x20c3('0x45')][0x0]['transcript']:'';})[_0x20c3('0x47')]('\x0a');_0x163e40=_0x5e5a69[_0x20c3('0x44')][_0x20c3('0x48')](function(_0x4fe513){return _0x4fe513&&_0x4fe513[_0x20c3('0x45')][0x0]&&_0x4fe513[_0x20c3('0x45')][0x0][_0x20c3('0x49')]?_0x4fe513[_0x20c3('0x45')][0x0][_0x20c3('0x49')]:0x0;})[_0x20c3('0x47')]('\x0a');}logger[_0x20c3('0x1d')](_0x20c3('0x4a'),_0x35877d);logger[_0x20c3('0x1d')]('googleASR\x20confidence',_0x163e40);return{'transcript':_0x35877d,'confidence':_0x163e40};})[_0x20c3('0x4b')](function(_0x361ffd){logger['error'](_0x20c3('0x4c'),_0x361ffd[_0x20c3('0x16')],_0x361ffd[_0x20c3('0x4d')],_0x361ffd[_0x20c3('0x4e')]);});};exports[_0x20c3('0x4f')]=function(_0x199dbf,_0x2117a5,_0x4f4b27,_0x318c47){var _0x431aa=apiai(_0x2117a5,{'language':_0x318c47||'en'});return _0x431aa['textRequest'](_0x4f4b27,{'sessionId':md5(_0x199dbf)})[_0x20c3('0x3c')](function(_0x3517b0){logger[_0x20c3('0x1d')](JSON[_0x20c3('0x50')](_0x3517b0));return{'source':_0x3517b0[_0x20c3('0x51')][_0x20c3('0x52')],'resolvedQuery':_0x3517b0[_0x20c3('0x51')][_0x20c3('0x53')],'action':_0x3517b0[_0x20c3('0x51')][_0x20c3('0x54')],'actionIncomplete':_0x3517b0[_0x20c3('0x51')]['actionIncomplete'],'speech':_0x3517b0[_0x20c3('0x51')][_0x20c3('0x55')]['speech'],'score':_0x3517b0[_0x20c3('0x51')]['score'],'statusCode':_0x3517b0['status'][_0x20c3('0x56')],'endConversation':_0x3517b0[_0x20c3('0x51')][_0x20c3('0x57')]['endConversation']||![],'isFallbackIntent':_0x3517b0[_0x20c3('0x51')][_0x20c3('0x57')][_0x20c3('0x58')]};});};exports[_0x20c3('0x59')]=function(_0x3f2db6,_0x38a26b,_0x22de56,_0x2c013a){return tilde[_0x20c3('0x5a')](_0x3f2db6,_0x38a26b,_0x22de56,_0x2c013a)[_0x20c3('0x3c')](function(_0x5e6675){try{fs[_0x20c3('0x43')](_0x3f2db6);}catch(_0x5c8e66){logger[_0x20c3('0x17')](_0x5c8e66);}logger[_0x20c3('0x1d')](_0x20c3('0x5b'),_0x5e6675['transcript']);logger[_0x20c3('0x1d')]('Tilde\x20ASR\x20confidence',_0x5e6675[_0x20c3('0x49')]);return _0x5e6675;});};exports[_0x20c3('0x5c')]=function(_0x3d82f3,_0x136800,_0x46c819,_0x58cbfe,_0x523cfd,_0x3e0ab5){var _0x430cf7=path[_0x20c3('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x20c3('0x3d'));var _0x3fb171;return aws[_0x20c3('0x5d')](_0x3d82f3,_0x136800,_0x46c819,_0x58cbfe,_0x523cfd,_0x3e0ab5,_0x430cf7)[_0x20c3('0x3c')](function(){_0x3fb171=path[_0x20c3('0x28')](__dirname,_0x20c3('0x5e'),rs[_0x20c3('0x29')](0x4)+_0x20c3('0x2a'));return convertFile(_0x430cf7,_0x3fb171);})[_0x20c3('0x3c')](function(){try{fs[_0x20c3('0x43')](_0x430cf7);fs[_0x20c3('0x2d')](_0x3fb171,_0x20c3('0x2e'));}catch(_0xa817a6){logger[_0x20c3('0x17')](_0xa817a6);}return _0x3fb171[_0x20c3('0x2f')]('.')[0x0];});};exports[_0x20c3('0x5f')]=function(_0x154c81,_0x1c5b1b,_0x263401,_0x205d31,_0x368646,_0x19a6c1){return aws[_0x20c3('0x60')](_0x154c81,_0x1c5b1b,_0x263401,_0x205d31,_0x368646,_0x19a6c1)[_0x20c3('0x3c')](function(_0x465410){logger[_0x20c3('0x1d')](JSON['stringify'](_0x465410));return _0x465410;});};exports[_0x20c3('0x61')]=function(_0x1b3251,_0x3e6b23,_0x460c68,_0x554bba){var _0x3a0c9a=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1b3251,encodeURIComponent(_0x3e6b23),_0x460c68,_0x554bba);var _0x26cf8c=path[_0x20c3('0x28')](__dirname,_0x20c3('0x5e'),rs['generate'](0x4)+'.mp3');var _0x219c70;return downloadFile(_0x3a0c9a,_0x26cf8c)[_0x20c3('0x3c')](function(){_0x219c70=path[_0x20c3('0x28')](__dirname,_0x20c3('0x5e'),rs[_0x20c3('0x29')](0x4)+_0x20c3('0x2a'));return convertFile(_0x26cf8c,_0x219c70);})['then'](function(){try{fs[_0x20c3('0x43')](_0x26cf8c);fs[_0x20c3('0x2d')](_0x219c70,'777');}catch(_0x264d65){logger[_0x20c3('0x17')](_0x264d65);}return _0x219c70[_0x20c3('0x2f')]('.')[0x0];});};exports[_0x20c3('0x62')]=function(_0x54ddd2,_0x560351,_0x58febc,_0x25f476){var _0x28d7f3=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x560351,_0x58febc,base64Encode(_0x54ddd2),_0x25f476?util[_0x20c3('0x63')]('model=%s',encodeURIComponent(_0x25f476)):'freeform=3');return uploadFile(_0x28d7f3)[_0x20c3('0x3c')](function(_0x1e5974){return querystring['parse'](_0x1e5974);});};exports['sestekNDA']=function(_0x28585a,_0x334e91){return sestek['nda'](_0x28585a,_0x334e91)['then'](function(_0x4b3035){logger[_0x20c3('0x1d')](JSON['stringify'](_0x4b3035));var _0x410992={'speech':_0x4b3035[_0x20c3('0x64')],'action':_0x4b3035[_0x20c3('0x65')]?_0x4b3035['channelData'][_0x20c3('0x66')]:undefined,'actiondata':_0x4b3035[_0x20c3('0x65')]?_0x4b3035[_0x20c3('0x65')][_0x20c3('0x67')]:undefined};if(_0x4b3035[_0x20c3('0x65')]&&_0x4b3035['channelData'][_0x20c3('0x68')]){return base64Decode(_0x4b3035[_0x20c3('0x65')][_0x20c3('0x68')][_0x20c3('0x69')],path['resolve'](__dirname,_0x20c3('0x5e'),rs[_0x20c3('0x29')](0x4)+_0x20c3('0x2a')))[_0x20c3('0x3c')](function(_0x18b1df){_0x410992['audiofile']=_0x18b1df;return _0x410992;});}return _0x410992;});};exports[_0x20c3('0x6a')]=function(){return __dirname;}; \ No newline at end of file +var _0x9e63=['googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','resolvedQuery','action','status','code','metadata','endConversation','isFallbackIntent','tildeASR','transcript','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','parse','randomstring','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','close','error','pipe','data','end','transcode','error\x20convert','finish\x20to\x20convert','tmp','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','POST','generate','.mp3','from','info','googleCloudTTS\x20path','googleTTS','resolve','goggleTTS\x20path','asr','results','map','alternatives','join','confidence','googleASR\x20transcription'];(function(_0x4f5ba9,_0x1c5fc5){var _0xfb4878=function(_0x38b4d5){while(--_0x38b4d5){_0x4f5ba9['push'](_0x4f5ba9['shift']());}};_0xfb4878(++_0x1c5fc5);}(_0x9e63,0xec));var _0x39e6=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x9e63[_0x298ed3];return _0x5aad28;};'use strict';var fs=require('fs');var path=require(_0x39e6('0x0'));var http=require(_0x39e6('0x1'));var https=require(_0x39e6('0x2'));var urlParse=require('url')[_0x39e6('0x3')];var BPromise=require('bluebird');var rs=require(_0x39e6('0x4'));var sox=require('sox');var rp=require(_0x39e6('0x5'));var util=require('util');var querystring=require(_0x39e6('0x6'));var tts=require(_0x39e6('0x7'));var apiai=require(_0x39e6('0x8'));var md5=require(_0x39e6('0x9'));var google=require(_0x39e6('0xa'));var aws=require(_0x39e6('0xb'));var tilde=require(_0x39e6('0xc'));var sestek=require(_0x39e6('0xd'));var logger=require(_0x39e6('0xe'))(_0x39e6('0xf'));var ISPEECH_API=_0x39e6('0x10');function downloadFile(_0x46ac5f,_0x22aa11){return new BPromise(function(_0x46fb0d,_0x451640){var _0x2f6417=urlParse(_0x46ac5f);var _0xa2f8fa=_0x2f6417[_0x39e6('0x11')]==='https:'?https:http;var _0x46e6f0={'host':_0x2f6417[_0x39e6('0x12')],'path':_0x2f6417['path'],'headers':{'user-agent':_0x39e6('0x13')}};_0xa2f8fa[_0x39e6('0x14')](_0x46e6f0,function(_0x534b8a){if(_0x534b8a[_0x39e6('0x15')]!==0xc8){logger['error'](_0x39e6('0x16')+_0x46ac5f+_0x39e6('0x17')+_0x534b8a[_0x39e6('0x15')]+'\x20('+_0x534b8a['statusMessage']+')');_0x451640(new Error(_0x39e6('0x16')+_0x46ac5f+'\x20failed,\x20status\x20code\x20=\x20'+_0x534b8a['statusCode']+'\x20('+_0x534b8a[_0x39e6('0x18')]+')'));return;}var _0x57d17f=fs['createWriteStream'](_0x22aa11);_0x57d17f['on'](_0x39e6('0x19'),function(){logger['info']('finish\x20download\x20file');_0x57d17f[_0x39e6('0x1a')](_0x46fb0d);});_0x57d17f['on'](_0x39e6('0x1b'),function(_0x2a418e){fs['unlink'](_0x22aa11);logger[_0x39e6('0x1b')]('download\x20error',_0x2a418e);_0x451640(_0x2a418e);});_0x534b8a[_0x39e6('0x1c')](_0x57d17f);})['on'](_0x39e6('0x1b'),function(_0x443e3f){logger[_0x39e6('0x1b')](_0x443e3f);_0x451640(_0x443e3f);})['end']();});}function uploadFile(_0x1ad57f){return new BPromise(function(_0x301f45,_0xe7a796){var _0x32891e=urlParse(_0x1ad57f);var _0x491c16=_0x32891e[_0x39e6('0x11')]==='https:'?https:http;var _0x7d4e65={'host':_0x32891e['host'],'path':_0x32891e[_0x39e6('0x0')],'headers':{'user-agent':_0x39e6('0x13')}};_0x491c16['get'](_0x7d4e65,function(_0x3e3dca){if(_0x3e3dca['statusCode']!==0xc8){_0xe7a796(new Error(_0x39e6('0x16')+_0x1ad57f+_0x39e6('0x17')+_0x3e3dca[_0x39e6('0x15')]+'\x20('+_0x3e3dca['statusMessage']+')'));return;}var _0x116784='';_0x3e3dca['on'](_0x39e6('0x1d'),function(_0x19b7fd){_0x116784+=_0x19b7fd;});_0x3e3dca['on'](_0x39e6('0x1e'),function(){_0x301f45(_0x116784);});})['on'](_0x39e6('0x1b'),function(_0x44503c){_0xe7a796(_0x44503c);})[_0x39e6('0x1e')]();});}function convertFile(_0x489e66,_0x59ca5f){return new BPromise(function(_0x2eb76b,_0x3e7565){var _0x3af571=sox[_0x39e6('0x1f')](_0x489e66,_0x59ca5f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3af571['on'](_0x39e6('0x1b'),function(_0x154c8b){logger[_0x39e6('0x1b')](_0x39e6('0x20'),_0x154c8b);_0x3e7565(_0x154c8b);});_0x3af571['on'](_0x39e6('0x1e'),function(){logger['info'](_0x39e6('0x21'));_0x2eb76b();});_0x3af571['start']();});}function base64Decode(_0x2a4047,_0x4e9977){var _0x5f16f1=path['resolve'](__dirname,_0x39e6('0x22'),rs['generate'](0x4)+_0x39e6('0x23'));fs[_0x39e6('0x24')](_0x5f16f1,_0x2a4047,_0x39e6('0x25'));return convertFile(_0x5f16f1,_0x4e9977)[_0x39e6('0x26')](function(){try{fs[_0x39e6('0x27')](_0x5f16f1);fs[_0x39e6('0x28')](_0x4e9977,_0x39e6('0x29'));}catch(_0x49ece6){logger[_0x39e6('0x1b')](_0x49ece6);}return _0x4e9977[_0x39e6('0x2a')]('.')[0x0];});}function base64Encode(_0xb7eb7){var _0xc93e06=fs['readFileSync'](_0xb7eb7);return new Buffer(_0xc93e06)['toString']('base64');}exports[_0x39e6('0x2b')]=function(_0x4c00a2,_0x26c324,_0x4929f8,_0x3ceef0,_0x5aea70,_0x2ec22d){var _0x46ad31,_0x5d2a0f;var _0x5b679e=_0x39e6('0x2c');var _0x4cc08d=_0x39e6('0x2d')+_0x4c00a2;var _0x1d8504={};if(_0x26c324===_0x39e6('0x2e')){_0x1d8504[_0x39e6('0x2f')]={'ssml':_0x4929f8};}else{_0x1d8504[_0x39e6('0x2f')]={'text':_0x4929f8};};_0x1d8504[_0x39e6('0x30')]={'languageCode':_0x3ceef0,'ssmlGender':_0x5aea70};_0x1d8504['audioConfig']={'audioEncoding':_0x39e6('0x31'),'sampleRateHertz':0x1f40};var _0x315695={'url':_0x5b679e+_0x39e6('0x32')+_0x4cc08d,'method':_0x39e6('0x33'),'json':!![],'body':_0x1d8504};return rp(_0x315695)['then'](function(_0x590642){return new BPromise(function(_0x2a287e,_0x998186){_0x46ad31=path['resolve'](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+_0x39e6('0x35'));var _0x1a7a95=Buffer[_0x39e6('0x36')](_0x590642['audioContent'],_0x39e6('0x25'));return fs['writeFile'](_0x46ad31,_0x1a7a95,function(_0xcf1e35){_0x998186(_0xcf1e35);},function(_0x4e5288){fs[_0x39e6('0x28')](_0x46ad31,_0x39e6('0x29'));_0x2a287e(_0x4e5288);});});})['then'](function(_0x406674){_0x5d2a0f=path['resolve'](__dirname,'tmp',rs[_0x39e6('0x34')](0x4)+_0x39e6('0x23'));return convertFile(_0x46ad31,_0x5d2a0f);})[_0x39e6('0x26')](function(){try{fs[_0x39e6('0x27')](_0x46ad31);fs['chmodSync'](_0x5d2a0f,_0x39e6('0x29'));}catch(_0x1fed76){logger[_0x39e6('0x1b')](_0x1fed76);}logger[_0x39e6('0x37')](_0x39e6('0x38'),_0x5d2a0f['split']('.')[0x0]);return _0x5d2a0f[_0x39e6('0x2a')]('.')[0x0];});};exports[_0x39e6('0x39')]=function(_0x5d0a47,_0x41e443){var _0x524392,_0x385eb8;return tts(_0x5d0a47,_0x41e443||'en',0x1)[_0x39e6('0x26')](function(_0x3b0c84){logger[_0x39e6('0x37')](_0x3b0c84);_0x524392=path[_0x39e6('0x3a')](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+_0x39e6('0x35'));return downloadFile(_0x3b0c84,_0x524392);})[_0x39e6('0x26')](function(){_0x385eb8=path['resolve'](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+_0x39e6('0x23'));return convertFile(_0x524392,_0x385eb8);})[_0x39e6('0x26')](function(){try{fs['unlink'](_0x524392);fs['chmodSync'](_0x385eb8,_0x39e6('0x29'));}catch(_0x5b6dcb){logger['error'](_0x5b6dcb);}logger['info'](_0x39e6('0x3b'),_0x385eb8['split']('.')[0x0]);return _0x385eb8[_0x39e6('0x2a')]('.')[0x0];});};exports['googleASR']=function(_0x40141a,_0x228835,_0x7d7df6){return google[_0x39e6('0x3c')](_0x40141a,_0x228835,_0x7d7df6)[_0x39e6('0x26')](function(_0x2a51a3){logger['info'](_0x2a51a3['uri']);return rp(_0x2a51a3);})[_0x39e6('0x26')](function(_0x4d709e){var _0x48f5c7='';var _0x38f81d=0x0;try{fs[_0x39e6('0x27')](_0x40141a);}catch(_0x32e81b){logger[_0x39e6('0x1b')](_0x32e81b);}if(_0x4d709e&&_0x4d709e[_0x39e6('0x3d')]){_0x48f5c7=_0x4d709e[_0x39e6('0x3d')][_0x39e6('0x3e')](function(_0x55b10b){return _0x55b10b&&_0x55b10b[_0x39e6('0x3f')][0x0]&&_0x55b10b[_0x39e6('0x3f')][0x0]['transcript']?_0x55b10b[_0x39e6('0x3f')][0x0]['transcript']:'';})[_0x39e6('0x40')]('\x0a');_0x38f81d=_0x4d709e[_0x39e6('0x3d')][_0x39e6('0x3e')](function(_0x55af36){return _0x55af36&&_0x55af36['alternatives'][0x0]&&_0x55af36['alternatives'][0x0][_0x39e6('0x41')]?_0x55af36[_0x39e6('0x3f')][0x0]['confidence']:0x0;})[_0x39e6('0x40')]('\x0a');}logger[_0x39e6('0x37')](_0x39e6('0x42'),_0x48f5c7);logger['info'](_0x39e6('0x43'),_0x38f81d);return{'transcript':_0x48f5c7,'confidence':_0x38f81d};})[_0x39e6('0x44')](function(_0x7ee7f9){logger[_0x39e6('0x1b')](_0x39e6('0x45'),_0x7ee7f9['statusCode'],_0x7ee7f9[_0x39e6('0x46')],_0x7ee7f9[_0x39e6('0x47')]);});};exports[_0x39e6('0x48')]=function(_0x5d6e3c,_0x4a7e5e,_0x1edf7d,_0x52d53b){var _0x2bcf2c=apiai(_0x4a7e5e,{'language':_0x52d53b||'en'});return _0x2bcf2c[_0x39e6('0x49')](_0x1edf7d,{'sessionId':md5(_0x5d6e3c)})[_0x39e6('0x26')](function(_0x418385){logger[_0x39e6('0x37')](JSON[_0x39e6('0x4a')](_0x418385));return{'source':_0x418385[_0x39e6('0x4b')]['source'],'resolvedQuery':_0x418385[_0x39e6('0x4b')][_0x39e6('0x4c')],'action':_0x418385[_0x39e6('0x4b')][_0x39e6('0x4d')],'actionIncomplete':_0x418385[_0x39e6('0x4b')]['actionIncomplete'],'speech':_0x418385[_0x39e6('0x4b')]['fulfillment']['speech'],'score':_0x418385[_0x39e6('0x4b')]['score'],'statusCode':_0x418385[_0x39e6('0x4e')][_0x39e6('0x4f')],'endConversation':_0x418385[_0x39e6('0x4b')][_0x39e6('0x50')][_0x39e6('0x51')]||![],'isFallbackIntent':_0x418385[_0x39e6('0x4b')][_0x39e6('0x50')][_0x39e6('0x52')]};});};exports[_0x39e6('0x53')]=function(_0x95e334,_0x260149,_0x4fd844,_0x325bd5){return tilde[_0x39e6('0x3c')](_0x95e334,_0x260149,_0x4fd844,_0x325bd5)[_0x39e6('0x26')](function(_0x1b73b3){try{fs[_0x39e6('0x27')](_0x95e334);}catch(_0x274d41){logger[_0x39e6('0x1b')](_0x274d41);}logger['info']('Tilde\x20ASR\x20transcription',_0x1b73b3[_0x39e6('0x54')]);logger['info'](_0x39e6('0x55'),_0x1b73b3[_0x39e6('0x41')]);return _0x1b73b3;});};exports[_0x39e6('0x56')]=function(_0x2bcb0c,_0x28f670,_0x350e9c,_0x3c4a8b,_0x14e5a9,_0x3acfcb){var _0x420336=path[_0x39e6('0x3a')](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+_0x39e6('0x35'));var _0x485af9;return aws['polly'](_0x2bcb0c,_0x28f670,_0x350e9c,_0x3c4a8b,_0x14e5a9,_0x3acfcb,_0x420336)[_0x39e6('0x26')](function(){_0x485af9=path['resolve'](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+_0x39e6('0x23'));return convertFile(_0x420336,_0x485af9);})[_0x39e6('0x26')](function(){try{fs[_0x39e6('0x27')](_0x420336);fs[_0x39e6('0x28')](_0x485af9,_0x39e6('0x29'));}catch(_0x34d686){logger[_0x39e6('0x1b')](_0x34d686);}return _0x485af9['split']('.')[0x0];});};exports[_0x39e6('0x57')]=function(_0x3ca601,_0x579485,_0x59b7f9,_0x9cb268,_0x3829ef,_0x3d8b60){return aws['lex'](_0x3ca601,_0x579485,_0x59b7f9,_0x9cb268,_0x3829ef,_0x3d8b60)[_0x39e6('0x26')](function(_0x2b8462){logger['info'](JSON[_0x39e6('0x4a')](_0x2b8462));return _0x2b8462;});};exports[_0x39e6('0x58')]=function(_0x4ae840,_0x3006d1,_0x304ffc,_0xc5e2bf){var _0x3acdac=util[_0x39e6('0x59')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4ae840,encodeURIComponent(_0x3006d1),_0x304ffc,_0xc5e2bf);var _0x5e273c=path['resolve'](__dirname,'tmp',rs[_0x39e6('0x34')](0x4)+_0x39e6('0x35'));var _0x2baf26;return downloadFile(_0x3acdac,_0x5e273c)['then'](function(){_0x2baf26=path[_0x39e6('0x3a')](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+'.wav');return convertFile(_0x5e273c,_0x2baf26);})['then'](function(){try{fs['unlink'](_0x5e273c);fs[_0x39e6('0x28')](_0x2baf26,_0x39e6('0x29'));}catch(_0x397673){logger['error'](_0x397673);}return _0x2baf26[_0x39e6('0x2a')]('.')[0x0];});};exports[_0x39e6('0x5a')]=function(_0xff4d8f,_0x236736,_0x115705,_0x1c22db){var _0x2917ff=util[_0x39e6('0x59')](_0x39e6('0x5b'),ISPEECH_API,_0x236736,_0x115705,base64Encode(_0xff4d8f),_0x1c22db?util[_0x39e6('0x59')]('model=%s',encodeURIComponent(_0x1c22db)):_0x39e6('0x5c'));return uploadFile(_0x2917ff)[_0x39e6('0x26')](function(_0x2e9fd2){return querystring[_0x39e6('0x3')](_0x2e9fd2);});};exports['sestekNDA']=function(_0x43a4cf,_0x332c40){return sestek[_0x39e6('0x5d')](_0x43a4cf,_0x332c40)['then'](function(_0xcc9925){logger[_0x39e6('0x37')](JSON['stringify'](_0xcc9925));var _0x16d605={'speech':_0xcc9925['text'],'action':_0xcc9925[_0x39e6('0x5e')]?_0xcc9925['channelData'][_0x39e6('0x5f')]:undefined,'actiondata':_0xcc9925['channelData']?_0xcc9925['channelData'][_0x39e6('0x60')]:undefined};if(_0xcc9925[_0x39e6('0x5e')]&&_0xcc9925[_0x39e6('0x5e')][_0x39e6('0x61')]){return base64Decode(_0xcc9925[_0x39e6('0x5e')]['AudioFromTts'][_0x39e6('0x62')],path[_0x39e6('0x3a')](__dirname,_0x39e6('0x22'),rs[_0x39e6('0x34')](0x4)+'.wav'))[_0x39e6('0x26')](function(_0x26c7cd){_0x16d605[_0x39e6('0x63')]=_0x26c7cd;return _0x16d605;});}return _0x16d605;});};exports[_0x39e6('0x64')]=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 28cb45e..9baad13 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 _0x09e9=['./nda','exports'];(function(_0x25652c,_0x14c54c){var _0x18b484=function(_0x1db71b){while(--_0x1db71b){_0x25652c['push'](_0x25652c['shift']());}};_0x18b484(++_0x14c54c);}(_0x09e9,0x134));var _0x909e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x09e9[_0x49ca18];return _0x145d54;};var nda=require(_0x909e('0x0'));module[_0x909e('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1ac6=['exports'];(function(_0x3fc25f,_0x86d7de){var _0x2f0f81=function(_0x148b04){while(--_0x148b04){_0x3fc25f['push'](_0x3fc25f['shift']());}};_0x2f0f81(++_0x86d7de);}(_0x1ac6,0x136));var _0x61ac=function(_0x784035,_0x318960){_0x784035=_0x784035-0x0;var _0x18eb99=_0x1ac6[_0x784035];return _0x18eb99;};var nda=require('./nda');module[_0x61ac('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8cc85e2..e364f6f 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 _0x4cb1=['body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','POST','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','extension','text','Bearer\x20','access_token','project'];(function(_0x2fe959,_0x351d77){var _0x2f6ace=function(_0x4ede54){while(--_0x4ede54){_0x2fe959['push'](_0x2fe959['shift']());}};_0x2f6ace(++_0x351d77);}(_0x4cb1,0x10f));var _0x14cb=function(_0x3f335b,_0x46f042){_0x3f335b=_0x3f335b-0x0;var _0x243e8e=_0x4cb1[_0x3f335b];return _0x243e8e;};'use strict';var rp=require(_0x14cb('0x0'));var url=require(_0x14cb('0x1'));var logger=require(_0x14cb('0x2'))('agi');module['exports']=function(_0x93a4e8,_0x155e8f){var _0xdb1011={'method':_0x14cb('0x3'),'uri':url['resolve'](_0x155e8f['ndauth_url'],_0x14cb('0x4')),'form':{'grant_type':_0x14cb('0x5'),'username':_0x155e8f['username'],'password':_0x155e8f[_0x14cb('0x5')]},'json':!![]};return rp(_0xdb1011)[_0x14cb('0x6')](function(_0x5c7e3b){var _0x32f957={'method':'POST','uri':url['resolve'](_0x155e8f[_0x14cb('0x7')],_0x14cb('0x8')),'body':{'type':_0x155e8f[_0x14cb('0x9')]||_0x14cb('0xa'),'channelId':_0x14cb('0xb'),'conversation':{'id':_0x93a4e8[_0x14cb('0xc')]},'from':{'id':_0x93a4e8[_0x14cb('0xd')],'name':_0x93a4e8['calleridname']},'recipient':{'id':_0x93a4e8['dnid'],'name':_0x93a4e8[_0x14cb('0xe')]},'text':_0x155e8f[_0x14cb('0xf')],'channelData':{}},'headers':{'Authorization':_0x14cb('0x10')+_0x5c7e3b[_0x14cb('0x11')]},'json':!![]};if(_0x155e8f[_0x14cb('0x12')]){_0x32f957[_0x14cb('0x13')][_0x14cb('0x14')]['ProjectName']=_0x155e8f[_0x14cb('0x12')];}if(_0x155e8f[_0x14cb('0x15')]=='1'){_0x32f957[_0x14cb('0x13')]['channelData'][_0x14cb('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x14cb('0x17')};}if(_0x155e8f['custom_action']){_0x32f957[_0x14cb('0x13')]['channelData'][_0x14cb('0x18')]=_0x155e8f[_0x14cb('0x19')];if(_0x155e8f[_0x14cb('0x1a')]){_0x32f957[_0x14cb('0x13')][_0x14cb('0x14')][_0x14cb('0x1b')]=_0x155e8f[_0x14cb('0x1a')];}}logger[_0x14cb('0x1c')](JSON['stringify'](_0x32f957));return rp(_0x32f957);});}; \ No newline at end of file +var _0xb2c7=['CustomAction','custom_action_data','info','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','dnid','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0xb2c7,0xc0));var _0x7b2c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb2c7[_0x618414];return _0x21c19a;};'use strict';var rp=require(_0x7b2c('0x0'));var url=require('url');var logger=require(_0x7b2c('0x1'))(_0x7b2c('0x2'));module[_0x7b2c('0x3')]=function(_0x40d112,_0x469adb){var _0x42fddf={'method':_0x7b2c('0x4'),'uri':url[_0x7b2c('0x5')](_0x469adb[_0x7b2c('0x6')],_0x7b2c('0x7')),'form':{'grant_type':_0x7b2c('0x8'),'username':_0x469adb['username'],'password':_0x469adb[_0x7b2c('0x8')]},'json':!![]};return rp(_0x42fddf)[_0x7b2c('0x9')](function(_0x3d0b1e){var _0x10fed2={'method':_0x7b2c('0x4'),'uri':url['resolve'](_0x469adb['ndassistant_url'],_0x7b2c('0xa')),'body':{'type':_0x469adb[_0x7b2c('0xb')]||_0x7b2c('0xc'),'channelId':_0x7b2c('0xd'),'conversation':{'id':_0x40d112['uniqueid']},'from':{'id':_0x40d112[_0x7b2c('0xe')],'name':_0x40d112['calleridname']},'recipient':{'id':_0x40d112[_0x7b2c('0xf')],'name':_0x40d112['extension']},'text':_0x469adb['text'],'channelData':{}},'headers':{'Authorization':_0x7b2c('0x10')+_0x3d0b1e['access_token']},'json':!![]};if(_0x469adb[_0x7b2c('0x11')]){_0x10fed2[_0x7b2c('0x12')][_0x7b2c('0x13')][_0x7b2c('0x14')]=_0x469adb[_0x7b2c('0x11')];}if(_0x469adb[_0x7b2c('0x15')]=='1'){_0x10fed2['body'][_0x7b2c('0x13')][_0x7b2c('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7b2c('0x17')};}if(_0x469adb['custom_action']){_0x10fed2[_0x7b2c('0x12')][_0x7b2c('0x13')][_0x7b2c('0x18')]=_0x469adb['custom_action'];if(_0x469adb['custom_action_data']){_0x10fed2[_0x7b2c('0x12')][_0x7b2c('0x13')]['CustomActionData']=_0x469adb[_0x7b2c('0x19')];}}logger[_0x7b2c('0x1a')](JSON['stringify'](_0x10fed2));return rp(_0x10fed2);});}; \ 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 581200c..f7d790c 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 _0xbae0=['exports'];(function(_0x544ded,_0x2cd874){var _0x598372=function(_0x3b0cda){while(--_0x3b0cda){_0x544ded['push'](_0x544ded['shift']());}};_0x598372(++_0x2cd874);}(_0xbae0,0x16f));var _0x0bae=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0xbae0[_0x2b45b5];return _0x1d9c06;};'use strict';var asr=require('./lib/api');module[_0x0bae('0x0')]=function(_0x2d0f4e,_0x433aa0,_0x282d57,_0x42dee3){return asr(_0x2d0f4e,_0x433aa0,_0x282d57,_0x42dee3);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x1ea9f7,_0x4eca3e,_0x17de53,_0x2b05ad){return asr(_0x1ea9f7,_0x4eca3e,_0x17de53,_0x2b05ad);}; \ 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 e1015ee..4b9b718 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 _0xc27d=['lodash','moment','crypto','../../../../../../config/logger','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','info','Open\x20Tilde\x20ASR\x20socket','unix','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird'];(function(_0x17320b,_0x328bea){var _0x285f14=function(_0x398742){while(--_0x398742){_0x17320b['push'](_0x17320b['shift']());}};_0x285f14(++_0x328bea);}(_0xc27d,0x199));var _0xdc27=function(_0x2aaf7c,_0x5a9eca){_0x2aaf7c=_0x2aaf7c-0x0;var _0x56378=_0xc27d[_0x2aaf7c];return _0x56378;};'use strict';var BPromise=require(_0xdc27('0x0'));var _=require(_0xdc27('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xdc27('0x2'));var crypto=require(_0xdc27('0x3'));var logger=require(_0xdc27('0x4'))(_0xdc27('0x5'));module['exports']=function(_0x2c8cf0,_0x1fdf8c,_0x5e9839,_0x3af4df){return new BPromise(function(_0x4b6fcd,_0x47790b){logger['info'](_0xdc27('0x6'),_0x3af4df||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1ef7b5=new WebSocket(_0x3af4df||_0xdc27('0x7'),{'perMessageDeflate':![]});var _0x8bbadc='';var _0x4a80d4='0';var _0x13daf7='1';var _0x3bfb02='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xb4c9ef(_0x197bc4){var _0x2f3881=crypto[_0xdc27('0x8')]('sha1');_0x2f3881[_0xdc27('0x9')](_0x197bc4);return _0x2f3881[_0xdc27('0xa')]('hex');}function _0x11c04f(){try{logger[_0xdc27('0xb')](_0xdc27('0xc'));var _0x4fcca3=moment()[_0xdc27('0xd')]();var _0x5f0491=_0xb4c9ef(_0x4fcca3+_0x1fdf8c+_0x5e9839);_0x1ef7b5['send'](JSON['stringify']({'appID':_0x1fdf8c,'timestamp':_0x4fcca3,'appKey':_0x5f0491}));var _0x12b000=fs['createReadStream'](_0x2c8cf0);_0x12b000['on']('data',function(_0x1c519c){_0x1ef7b5[_0xdc27('0xe')](_0x1c519c);});_0x12b000['on'](_0xdc27('0xf'),function(){_0x1ef7b5[_0xdc27('0xe')](_0xdc27('0x10'));});}catch(_0x587cd2){logger[_0xdc27('0x11')](_0xdc27('0x12'),JSON[_0xdc27('0x13')](_0x587cd2));_0x1ef7b5['terminate']();}}function _0x30bfeb(_0x29a6c0){try{if(_0x29a6c0){var _0x31e21a=JSON['parse'](_0x29a6c0);switch(_0x31e21a[_0xdc27('0x14')]){case 0x0:if(_0x31e21a[_0xdc27('0x15')]){if(_0x31e21a[_0xdc27('0x15')][_0xdc27('0x16')]){logger['info'](_0xdc27('0x17'),JSON['stringify'](_0x31e21a[_0xdc27('0x15')][_0xdc27('0x18')]));_0x8bbadc=_0x31e21a[_0xdc27('0x15')][_0xdc27('0x18')][0x0][_0xdc27('0x19')];_0x4a80d4=_0x31e21a[_0xdc27('0x15')]['hypotheses'][0x0][_0xdc27('0x1a')];_0x13daf7='0';_0x3bfb02=_0xdc27('0x1b');_0x1ef7b5[_0xdc27('0x1c')]();}}break;case 0x1:logger[_0xdc27('0xb')](_0xdc27('0x1d'));_0x13daf7='1';_0x3bfb02=_0xdc27('0x1d');break;case 0x2:logger[_0xdc27('0xb')](_0xdc27('0x1e'));_0x13daf7='2';_0x3bfb02=_0xdc27('0x1e');break;case 0x9:logger['info'](_0xdc27('0x1f'));_0x13daf7='9';_0x3bfb02=_0xdc27('0x1f');break;case 0xa:logger['info'](_0xdc27('0x20'));_0x13daf7='10';_0x3bfb02=_0xdc27('0x20');break;case 0xb:logger[_0xdc27('0xb')](_0xdc27('0x21'));_0x13daf7='11';_0x3bfb02=_0xdc27('0x21');}}}catch(_0xea60f6){logger[_0xdc27('0x11')](_0xdc27('0x22'),JSON[_0xdc27('0x13')](_0xea60f6));_0x1ef7b5[_0xdc27('0x1c')]();}}function _0x270f30(){logger[_0xdc27('0xb')](_0xdc27('0x23'));_0x4b6fcd({'transcript':_0x8bbadc,'confidence':_0x4a80d4,'status':_0x13daf7,'status_message':_0x3bfb02});}function _0x27b289(_0xf22b5c){logger[_0xdc27('0x11')](_0xdc27('0x24'));if(!_[_0xdc27('0x25')](_0xf22b5c)){logger['error'](_[_0xdc27('0x26')](_0xf22b5c)?JSON['stringify'](_0xf22b5c):_0xf22b5c);}}_0x1ef7b5['on'](_0xdc27('0x27'),_0x11c04f);_0x1ef7b5['on'](_0xdc27('0x28'),_0x30bfeb);_0x1ef7b5['on'](_0xdc27('0xf'),_0x270f30);_0x1ef7b5['on'](_0xdc27('0x11'),_0x27b289);});}; \ No newline at end of file +var _0xdc2b=['createHash','sha1','update','digest','hex','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech'];(function(_0x1aae6a,_0x56bb19){var _0x297a71=function(_0x471e80){while(--_0x471e80){_0x1aae6a['push'](_0x1aae6a['shift']());}};_0x297a71(++_0x56bb19);}(_0xdc2b,0x77));var _0xbdc2=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xdc2b[_0x5f0089];return _0x193892;};'use strict';var BPromise=require(_0xbdc2('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbdc2('0x1'));var crypto=require(_0xbdc2('0x2'));var logger=require(_0xbdc2('0x3'))(_0xbdc2('0x4'));module[_0xbdc2('0x5')]=function(_0x46ac25,_0x889efc,_0x12f159,_0x21fa65){return new BPromise(function(_0x41aa3f,_0x134017){logger[_0xbdc2('0x6')](_0xbdc2('0x7'),_0x21fa65||_0xbdc2('0x8'));var _0x5bbdfa=new WebSocket(_0x21fa65||_0xbdc2('0x8'),{'perMessageDeflate':![]});var _0x57593b='';var _0x27ce33='0';var _0x302a73='1';var _0x165a1d=_0xbdc2('0x9');function _0x531fd4(_0x3cfa7c){var _0x510889=crypto[_0xbdc2('0xa')](_0xbdc2('0xb'));_0x510889[_0xbdc2('0xc')](_0x3cfa7c);return _0x510889[_0xbdc2('0xd')](_0xbdc2('0xe'));}function _0x164eb1(){try{logger[_0xbdc2('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x1e84ec=moment()['unix']();var _0x3ea696=_0x531fd4(_0x1e84ec+_0x889efc+_0x12f159);_0x5bbdfa['send'](JSON[_0xbdc2('0xf')]({'appID':_0x889efc,'timestamp':_0x1e84ec,'appKey':_0x3ea696}));var _0x18bf3c=fs[_0xbdc2('0x10')](_0x46ac25);_0x18bf3c['on'](_0xbdc2('0x11'),function(_0x34be67){_0x5bbdfa[_0xbdc2('0x12')](_0x34be67);});_0x18bf3c['on'](_0xbdc2('0x13'),function(){_0x5bbdfa[_0xbdc2('0x12')](_0xbdc2('0x14'));});}catch(_0x55d949){logger[_0xbdc2('0x15')](_0xbdc2('0x16'),JSON[_0xbdc2('0xf')](_0x55d949));_0x5bbdfa[_0xbdc2('0x17')]();}}function _0x468745(_0x193dae){try{if(_0x193dae){var _0x5cd5e0=JSON[_0xbdc2('0x18')](_0x193dae);switch(_0x5cd5e0[_0xbdc2('0x19')]){case 0x0:if(_0x5cd5e0[_0xbdc2('0x1a')]){if(_0x5cd5e0[_0xbdc2('0x1a')][_0xbdc2('0x1b')]){logger[_0xbdc2('0x6')](_0xbdc2('0x1c'),JSON[_0xbdc2('0xf')](_0x5cd5e0[_0xbdc2('0x1a')]['hypotheses']));_0x57593b=_0x5cd5e0[_0xbdc2('0x1a')][_0xbdc2('0x1d')][0x0][_0xbdc2('0x1e')];_0x27ce33=_0x5cd5e0[_0xbdc2('0x1a')][_0xbdc2('0x1d')][0x0]['likelihood'];_0x302a73='0';_0x165a1d=_0xbdc2('0x1f');_0x5bbdfa[_0xbdc2('0x17')]();}}break;case 0x1:logger[_0xbdc2('0x6')](_0xbdc2('0x9'));_0x302a73='1';_0x165a1d=_0xbdc2('0x9');break;case 0x2:logger[_0xbdc2('0x6')](_0xbdc2('0x20'));_0x302a73='2';_0x165a1d=_0xbdc2('0x20');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x302a73='9';_0x165a1d=_0xbdc2('0x21');break;case 0xa:logger[_0xbdc2('0x6')](_0xbdc2('0x22'));_0x302a73='10';_0x165a1d=_0xbdc2('0x22');break;case 0xb:logger[_0xbdc2('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x302a73='11';_0x165a1d=_0xbdc2('0x23');}}}catch(_0x1541bd){logger['error'](_0xbdc2('0x24'),JSON['stringify'](_0x1541bd));_0x5bbdfa[_0xbdc2('0x17')]();}}function _0x381afa(){logger['info'](_0xbdc2('0x25'));_0x41aa3f({'transcript':_0x57593b,'confidence':_0x27ce33,'status':_0x302a73,'status_message':_0x165a1d});}function _0xd4a489(_0x828ac0){logger['error'](_0xbdc2('0x26'));if(!_[_0xbdc2('0x27')](_0x828ac0)){logger[_0xbdc2('0x15')](_[_0xbdc2('0x28')](_0x828ac0)?JSON[_0xbdc2('0xf')](_0x828ac0):_0x828ac0);}}_0x5bbdfa['on'](_0xbdc2('0x29'),_0x164eb1);_0x5bbdfa['on'](_0xbdc2('0x2a'),_0x468745);_0x5bbdfa['on'](_0xbdc2('0x13'),_0x381afa);_0x5bbdfa['on'](_0xbdc2('0x15'),_0xd4a489);});}; \ 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 4a59daa..75b740d 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 _0x99b7=['./asr','exports'];(function(_0x2fd285,_0x5e6f64){var _0x50fe1a=function(_0x4a8558){while(--_0x4a8558){_0x2fd285['push'](_0x2fd285['shift']());}};_0x50fe1a(++_0x5e6f64);}(_0x99b7,0x1e8));var _0x799b=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x99b7[_0x2aea9e];return _0x430b92;};var asr=require(_0x799b('0x0'));module[_0x799b('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe0f9=['./asr','exports'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xe0f9,0x16c));var _0x9e0f=function(_0x30f2bf,_0x38cc26){_0x30f2bf=_0x30f2bf-0x0;var _0x3875c7=_0xe0f9[_0x30f2bf];return _0x3875c7;};var asr=require(_0x9e0f('0x0'));module[_0x9e0f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 340610c..d07e491 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 _0x3e5c=['util','net','events','EventEmitter','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits'];(function(_0x4cf6e0,_0x1258a0){var _0x3d90c4=function(_0x4a95fc){while(--_0x4a95fc){_0x4cf6e0['push'](_0x4cf6e0['shift']());}};_0x3d90c4(++_0x1258a0);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x3812e8,_0x772c6f){_0x3812e8=_0x3812e8-0x0;var _0xda8216=_0x3e5c[_0x3812e8];return _0xda8216;};'use strict';var util=require(_0xc3e5('0x0'));var net=require(_0xc3e5('0x1'));var EventEmitter=require(_0xc3e5('0x2'))[_0xc3e5('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xc3e5('0x4'));var AGIServer=function(_0x185c21,_0x3785eb,_0x336716){var _0x46cf5c=this,_0x185c21=_0x185c21||0x11dd,_0x3785eb=_0x3785eb||_0xc3e5('0x5'),_0xf61ec2=null,_0xdf5a06=0x0;EventEmitter[_0xc3e5('0x6')](_0x46cf5c);function _0x2d580e(){if(!_0x185c21){_0x46cf5c['emit'](_0xc3e5('0x7'),new AGIError(_0xc3e5('0x8')));return![];}_0xf61ec2=net[_0xc3e5('0x9')]();_0xf61ec2[_0xc3e5('0xa')](_0x185c21,_0x3785eb);_0xf61ec2['on'](_0xc3e5('0xb'),function(){_0x46cf5c[_0xc3e5('0xc')](_0xc3e5('0xb'));});_0xf61ec2['on']('connection',function(_0x2ce215){_0xf61ec2[_0xc3e5('0xd')](function(_0x26985c,_0x2b1559){if(_0x26985c){_0x46cf5c['emit'](_0xc3e5('0x7'),new AGIError(_0xc3e5('0xe'),_0x26985c));}else if(_0x336716&&_0x336716<0x0){_0x46cf5c[_0xc3e5('0xc')](_0xc3e5('0x7'),new AGIError(_0xc3e5('0xf')));_0x2ce215[_0xc3e5('0x10')]();}else if(_0x336716&&_0x336716>0x0&&_0x336716<_0x2b1559){_0xdf5a06+=0x1;_0x46cf5c['emit']('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0xdf5a06));_0x2ce215[_0xc3e5('0x10')]();}else{var _0x5a52f1=new AGIChannel(_0x2ce215);_0x5a52f1['on'](_0xc3e5('0x11'),function(){_0x46cf5c[_0xc3e5('0xc')]('connection',_0x5a52f1);});}});});_0xf61ec2['on'](_0xc3e5('0x7'),function(_0x3e3eaa){_0x46cf5c[_0xc3e5('0xc')](_0xc3e5('0x7'),new AGIError(_0xc3e5('0xe'),_0x3e3eaa['code']));});_0xf61ec2['on'](_0xc3e5('0x12'),function(){_0x46cf5c[_0xc3e5('0xc')](_0xc3e5('0x12'),new AGIError(_0xc3e5('0x13')));});}process[_0xc3e5('0x14')](function(){_0x2d580e();});};util[_0xc3e5('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x13d709,_0x13dea7,_0x4a1d86){return new AGIServer(_0x13d709,_0x13dea7,_0x4a1d86);}; \ No newline at end of file +var _0xcf95=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','inherits','exports','util','net','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x5cf9('0x0'));var net=require(_0x5cf9('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x5cf9('0x2'));var AGIServer=function(_0xfeb22f,_0x24097a,_0x102b24){var _0x53e2a1=this,_0xfeb22f=_0xfeb22f||0x11dd,_0x24097a=_0x24097a||_0x5cf9('0x3'),_0x5b060f=null,_0x498d14=0x0;EventEmitter[_0x5cf9('0x4')](_0x53e2a1);function _0x51acd7(){if(!_0xfeb22f){_0x53e2a1[_0x5cf9('0x5')](_0x5cf9('0x6'),new AGIError(_0x5cf9('0x7')));return![];}_0x5b060f=net[_0x5cf9('0x8')]();_0x5b060f[_0x5cf9('0x9')](_0xfeb22f,_0x24097a);_0x5b060f['on'](_0x5cf9('0xa'),function(){_0x53e2a1[_0x5cf9('0x5')](_0x5cf9('0xa'));});_0x5b060f['on'](_0x5cf9('0xb'),function(_0x5abebe){_0x5b060f[_0x5cf9('0xc')](function(_0x29fbff,_0x39c2b9){if(_0x29fbff){_0x53e2a1[_0x5cf9('0x5')]('error',new AGIError(_0x5cf9('0xd'),_0x29fbff));}else if(_0x102b24&&_0x102b24<0x0){_0x53e2a1[_0x5cf9('0x5')](_0x5cf9('0x6'),new AGIError(_0x5cf9('0xe')));_0x5abebe[_0x5cf9('0xf')]();}else if(_0x102b24&&_0x102b24>0x0&&_0x102b24<_0x39c2b9){_0x498d14+=0x1;_0x53e2a1[_0x5cf9('0x5')](_0x5cf9('0x6'),new AGIError(_0x5cf9('0x10'),_0x498d14));_0x5abebe['destroy']();}else{var _0xe787ae=new AGIChannel(_0x5abebe);_0xe787ae['on'](_0x5cf9('0x11'),function(){_0x53e2a1['emit']('connection',_0xe787ae);});}});});_0x5b060f['on']('error',function(_0x4cb11d){_0x53e2a1[_0x5cf9('0x5')](_0x5cf9('0x6'),new AGIError(_0x5cf9('0xd'),_0x4cb11d[_0x5cf9('0x12')]));});_0x5b060f['on']('close',function(){_0x53e2a1[_0x5cf9('0x5')](_0x5cf9('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x51acd7();});};util[_0x5cf9('0x14')](AGIServer,EventEmitter);module[_0x5cf9('0x15')]=function(_0x44faac,_0x2f095f,_0x1b55cd){return new AGIServer(_0x44faac,_0x2f095f,_0x1b55cd);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index d5bd01a..2d2b7aa 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 _0x44c7=['ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','unlink','ispeech\x20TTS\x20is\x20unreachable','login','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','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','getSound','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayNumber','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','auth','user','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','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\x20SWITCH\x20(%s)\x20block','join','exports','lodash','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','random','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','google_tts_language','restAPI','timeout','number','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','headers','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','includes','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','isEmpty','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','tildeASR','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','interval_id','no\x20interval\x20configured','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block'];(function(_0x1226ca,_0x51cbff){var _0x394adf=function(_0x30f382){while(--_0x30f382){_0x1226ca['push'](_0x1226ca['shift']());}};_0x394adf(++_0x51cbff);}(_0x44c7,0x89));var _0x744c=function(_0x4b78a4,_0x4c1927){_0x4b78a4=_0x4b78a4-0x0;var _0x4bab8b=_0x44c7[_0x4b78a4];return _0x4bab8b;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x744c('0x0'));var sh=require('shelljs');var odbc=require(_0x744c('0x1'))();var rs=require(_0x744c('0x2'));var moment=require(_0x744c('0x3'));var Mustache=require('mustache');var rp=require(_0x744c('0x4'));var logger=require(_0x744c('0x5'))(_0x744c('0x6'));var config=require(_0x744c('0x7'));var scripts=require(_0x744c('0x8'));var FILES_PATH=_0x744c('0x9');var recursiveMapAttributes=[_0x744c('0xa'),_0x744c('0xb')];var verticesWithRetry=[_0x744c('0xc'),_0x744c('0xd'),_0x744c('0xe')];var AGIVertices=function(_0x6425c2,_0x35ba48,_0x5020e0){this[_0x744c('0xf')]=_0x6425c2;this['rpc']=_0x35ba48;this['mailRpc']=_0x5020e0;};AGIVertices['prototype']['getVariable']=function(_0x115150,_0x13a8da){this[_0x744c('0x10')][_0x744c('0x11')](_0x115150)[_0x744c('0x12')](function(_0x1deef1){_0x13a8da(null,_0x1deef1?_0x1deef1[_0x744c('0x13')]:![]);})[_0x744c('0x14')](function(_0x529c1d){_0x13a8da(_0x529c1d);});};AGIVertices[_0x744c('0x15')][_0x744c('0x16')]=function(_0x2e7b84,_0x3a3ba0){this[_0x744c('0x10')][_0x744c('0x17')](_0x2e7b84)[_0x744c('0x12')](function(_0x6d1330){_0x3a3ba0(null,_0x6d1330?_0x6d1330[_0x744c('0x13')]:![]);})[_0x744c('0x14')](function(_0x56fe70){_0x3a3ba0(_0x56fe70);});};AGIVertices[_0x744c('0x15')][_0x744c('0x18')]=function(_0x5cc35c,_0x9aa27c){this[_0x744c('0x10')][_0x744c('0x19')](_0x5cc35c)[_0x744c('0x12')](function(_0x5e66d1){_0x9aa27c(null,_0x5e66d1?_0x5e66d1[_0x744c('0x13')]:![]);})[_0x744c('0x14')](function(_0x32c497){_0x9aa27c(_0x32c497);});};AGIVertices[_0x744c('0x15')][_0x744c('0x1a')]=function(_0x3345fb,_0x279b3f){this['rpc'][_0x744c('0x1b')](_0x3345fb)[_0x744c('0x12')](function(_0x15e728){_0x279b3f(null,_0x15e728?_0x15e728[_0x744c('0x1c')]:![]);})[_0x744c('0x14')](function(_0x2144cc){_0x279b3f(_0x2144cc);});};AGIVertices[_0x744c('0x15')]['getUser']=function(_0x26d1fd,_0x279b6b){this[_0x744c('0x10')][_0x744c('0x1d')](_0x26d1fd)[_0x744c('0x12')](function(_0x3c7daf){_0x279b6b(null,_0x3c7daf?_0x3c7daf['name']:![]);})[_0x744c('0x14')](function(_0x6d4682){_0x279b6b(_0x6d4682);});};AGIVertices[_0x744c('0x15')][_0x744c('0x1e')]=function(_0x57923f,_0x4ea6c8){this[_0x744c('0x10')]['getTrunkById'](_0x57923f)[_0x744c('0x12')](function(_0x3b23b5){_0x4ea6c8(null,_0x3b23b5?_0x3b23b5[_0x744c('0x13')]:![]);})[_0x744c('0x14')](function(_0x37f445){_0x4ea6c8(_0x37f445);});};AGIVertices['prototype']['getSound']=function(_0x5107eb,_0x5e3764){var _0x574d30=this;this['rpc'][_0x744c('0x1f')](_0x5107eb)['then'](function(_0x4200dc){_0x5e3764(null,_0x4200dc?_0x574d30[_0x744c('0x20')](_0x4200dc[_0x744c('0x21')]):![]);})[_0x744c('0x14')](function(_0x5e0c41){_0x5e3764(_0x5e0c41);});};AGIVertices['prototype'][_0x744c('0x22')]=function(_0x289b19,_0x52cefe){this[_0x744c('0x10')][_0x744c('0x23')](_0x289b19)[_0x744c('0x12')](function(_0x1ab95f){_0x52cefe(null,_0x1ab95f?_0x1ab95f:![]);})[_0x744c('0x14')](function(_0x2dd7ab){_0x52cefe(_0x2dd7ab);});};AGIVertices[_0x744c('0x15')][_0x744c('0x24')]=function(_0x3965fa,_0x215a2a,_0x4fd012){this[_0x744c('0x25')]['sendMailMessage'](_0x3965fa,_0x215a2a)[_0x744c('0x12')](function(){_0x4fd012(null);})[_0x744c('0x14')](function(_0x199924){_0x4fd012(_0x199924);});};AGIVertices[_0x744c('0x15')][_0x744c('0x26')]=function(_0x494e15,_0x4f64ec){this[_0x744c('0x10')][_0x744c('0x27')](_0x494e15)[_0x744c('0x12')](function(_0x529345){if(_0x529345){if(_0x529345[_0x744c('0x28')]){_0x4f64ec(null,[_0x529345[_0x744c('0x29')]]);}else{_0x4f64ec(null,_['map'](_0x529345['Intervals'],'interval'));}}else{_0x4f64ec(null,![]);}})[_0x744c('0x14')](function(_0x15c823){_0x4f64ec(_0x15c823);});};AGIVertices[_0x744c('0x15')][_0x744c('0x20')]=function(_0x44426d){return util['format'](_0x744c('0x2a'),FILES_PATH,_0x44426d);};AGIVertices[_0x744c('0x15')][_0x744c('0x2b')]=function(_0x3b4fae,_0x3c00f4,_0x43c070){odbc[_0x744c('0x2c')](_0x3b4fae,function(_0x2db25c){if(_0x2db25c){logger[_0x744c('0x2d')](_0x744c('0x2e'),_0x2db25c);_0x43c070(_0x2db25c);}else{logger[_0x744c('0x2f')](_0x744c('0x30'));odbc['query'](_0x3c00f4,function(_0x46ab4b,_0x22308f){if(_0x46ab4b){logger[_0x744c('0x2f')](_0x744c('0x31'),_0x3c00f4);_0x43c070(_0x46ab4b);}else{logger[_0x744c('0x2f')](_0x744c('0x32'),_0x3c00f4);odbc[_0x744c('0x33')](function(_0x1eaaea){if(_0x1eaaea){logger['error'](_0x744c('0x34'),_0x1eaaea);}_0x43c070(null,_0x22308f);});}});}});};AGIVertices[_0x744c('0x15')][_0x744c('0x35')]=function(_0x5efcae,_0x1be7da){this[_0x744c('0x10')][_0x744c('0x36')](_0x5efcae)[_0x744c('0x12')](function(_0x38a7e0){_0x1be7da(null,_0x38a7e0?_0x38a7e0:![]);})[_0x744c('0x14')](function(_0x5f45c7){_0x1be7da(_0x5f45c7);});};AGIVertices[_0x744c('0x15')][_0x744c('0x37')]=function(_0xb8b98c,_0x9c634){this[_0x744c('0x10')][_0x744c('0x37')](_0xb8b98c)['then'](function(_0x48f1c4){_0x9c634(null,_0x48f1c4);})[_0x744c('0x14')](function(_0x3d03c9){_0x9c634(_0x3d03c9);});};AGIVertices[_0x744c('0x15')][_0x744c('0x38')]=function(_0x4e1717,_0x25be01,_0xbb3b85){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x744c('0xf')]['uniqueid'],'node':_0x4e1717[_0x744c('0x39')],'application':_0x4e1717['agicommand'],'data':_0x25be01||null,'project_name':this['channel'][_0x744c('0x3a')],'callerid':this[_0x744c('0xf')][_0x744c('0x3b')]})[_0x744c('0x12')](function(_0x418924){if(_0xbb3b85){_0xbb3b85(null,_0x418924);}})[_0x744c('0x14')](function(_0x25307e){if(_0xbb3b85){_0xbb3b85(_0x25307e);}});};AGIVertices[_0x744c('0x15')][_0x744c('0x3c')]=function(_0x4e6c31,_0x32e300,_0x5a922f,_0x3093d6){this[_0x744c('0x10')][_0x744c('0x3c')]({'uniqueid':this['channel'][_0x744c('0x3d')],'callerid':this['channel'][_0x744c('0x3b')],'calleridname':this['channel']['calleridname'],'context':this[_0x744c('0xf')]['context'],'extension':this[_0x744c('0xf')][_0x744c('0x3e')],'priority':this[_0x744c('0xf')][_0x744c('0x3f')],'accountcode':this[_0x744c('0xf')][_0x744c('0x40')],'dnid':this[_0x744c('0xf')][_0x744c('0x41')],'projectName':this['channel']['arg_1'],'saveName':_0x32e300,'filename':_0x4e6c31[_0x744c('0x42')]||_0x32e300,'savePath':_0x5a922f})[_0x744c('0x12')](function(_0x12d209){_0x3093d6(null,_0x12d209);})[_0x744c('0x14')](function(_0x6b6d9f){_0x3093d6(_0x6b6d9f);});};AGIVertices['prototype'][_0x744c('0x43')]=function(_0x24c914,_0x27eb98,_0x4cc963){this[_0x744c('0x10')][_0x744c('0x43')]({'uniqueid':this[_0x744c('0xf')]['uniqueid'],'body':_0x24c914,'direction':_0x27eb98})[_0x744c('0x12')](function(_0xd5fc85){if(_0x4cc963){_0x4cc963(null,_0xd5fc85);}})[_0x744c('0x14')](function(_0x550894){if(_0x4cc963){_0x4cc963(_0x550894);}});};AGIVertices[_0x744c('0x15')][_0x744c('0x44')]=function(_0x46969e,_0x39b4a5){this[_0x744c('0x10')][_0x744c('0x44')]({'firstName':_['isEmpty'](_0x46969e['name'])||_['isNil'](_0x46969e[_0x744c('0x13')])?'callback_'+Math[_0x744c('0x45')]():_0x46969e['name'],'lastName':_['isEmpty'](_0x46969e[_0x744c('0x46')])||_[_0x744c('0x47')](_0x46969e[_0x744c('0x46')])?null:_0x46969e[_0x744c('0x46')],'phone':_0x46969e[_0x744c('0x48')],'ListId':_0x46969e[_0x744c('0x49')],'scheduledat':_0x46969e[_0x744c('0x4a')],'callbackUniqueid':this[_0x744c('0xf')][_0x744c('0x3d')],'tags':'callback','description':_0x744c('0x4b')+_0x46969e[_0x744c('0x4a')][_0x744c('0x4c')](),'priority':_0x46969e[_0x744c('0x4d')]})['then'](function(_0x41bd18){_0x39b4a5(null,_0x41bd18);})[_0x744c('0x14')](function(_0x2109de){_0x39b4a5(_0x2109de);});};AGIVertices['prototype'][_0x744c('0x4e')]=function(_0x49fdb6,_0x57249b){this['rpc'][_0x744c('0x4f')](_0x49fdb6)[_0x744c('0x12')](function(_0x1594ea){_0x57249b(null,_0x1594ea?_0x1594ea[_0x744c('0x13')]:![]);})[_0x744c('0x14')](function(_0x26bfd9){_0x57249b(_0x26bfd9);});};AGIVertices['prototype'][_0x744c('0x50')]=function(_0x5be019,_0x3f094e,_0x2f7632){var _0x8b5b97={'role':_0x744c('0x51')};_0x8b5b97[_0x5be019]=this['channel'][_0x744c('0x3b')];this[_0x744c('0x10')][_0x744c('0x50')](_0x8b5b97,_0x3f094e,this[_0x744c('0xf')][_0x744c('0x3d')])['then'](function(_0x23f72c){_0x2f7632(null,_[_0x744c('0x47')](_0x23f72c)?![]:!![]);})[_0x744c('0x14')](function(_0x3e6341){logger[_0x744c('0x2d')](_0x3e6341);_0x2f7632(null,![]);});};AGIVertices[_0x744c('0x15')]['agentUnpause']=function(_0x1e10fa,_0xfdf1ab){var _0x53a665={'role':_0x744c('0x51')};_0x53a665[_0x1e10fa]=this[_0x744c('0xf')][_0x744c('0x3b')];this[_0x744c('0x10')][_0x744c('0x52')](_0x53a665)[_0x744c('0x12')](function(_0x7ecaed){_0xfdf1ab(null,_[_0x744c('0x47')](_0x7ecaed)?![]:!![]);})['catch'](function(_0x5149c8){logger['error'](_0x5149c8);_0xfdf1ab(null,![]);});};AGIVertices[_0x744c('0x15')][_0x744c('0x53')]=function(_0x4fb38b,_0x4032c6){var _0x1c41d9={'role':'agent'};_0x1c41d9[_0x4fb38b]=this['channel']['callerid'];this[_0x744c('0x10')]['agentLogout'](_0x1c41d9)[_0x744c('0x12')](function(_0x34937f){_0x4032c6(null,_['isNil'](_0x34937f)?![]:!![]);})[_0x744c('0x14')](function(_0x383479){logger[_0x744c('0x2d')](_0x383479);_0x4032c6(null,![]);});};AGIVertices[_0x744c('0x15')]['agentLogin']=function(_0x2e10a9,_0x4dd7af){var _0x176a6f={'role':_0x744c('0x51')};_0x176a6f[_0x2e10a9]=this[_0x744c('0xf')][_0x744c('0x3b')];var _0x5c3f93=_0x2e10a9!=_0x744c('0x54')?util[_0x744c('0x55')](_0x744c('0x56'),_0x744c('0x57'),this[_0x744c('0xf')][_0x744c('0x3b')]):undefined;this['rpc'][_0x744c('0x58')](_0x176a6f,_0x5c3f93)['then'](function(_0x2e6582){_0x4dd7af(null,_[_0x744c('0x47')](_0x2e6582)?![]:!![]);})['catch'](function(_0x31d7f8){logger[_0x744c('0x2d')](_0x31d7f8);_0x4dd7af(null,![]);});};AGIVertices[_0x744c('0x15')][_0x744c('0x59')]=function(_0x545d6a,_0x459cf4){sh[_0x744c('0x5a')](_[_0x744c('0x5b')](_0x545d6a),function(_0x56e85b,_0x20cdbb){var _0x2203ea=_0x20cdbb[_0x744c('0x5c')](/(\r\n|\n|\r)/gm,'');_0x459cf4(null,_0x2203ea);});};AGIVertices[_0x744c('0x15')]['googleCloudTTS']=function(_0x3b226c,_0x558382){scripts[_0x744c('0x5d')](_0x3b226c['apiKey'],_0x3b226c['google_cloud_tts_text_type']||'text',_0x3b226c[_0x744c('0x5e')],_0x3b226c[_0x744c('0x5f')]||'en-US',_0x3b226c[_0x744c('0x60')]||_0x744c('0x61'),_0x3b226c[_0x744c('0x62')]||_0x744c('0x63'))['then'](function(_0x14f16e){_0x558382(null,_0x14f16e);})[_0x744c('0x14')](function(_0x3e5641){_0x558382(_0x3e5641);});};AGIVertices[_0x744c('0x15')]['googleTTS']=function(_0x189d81,_0x3edd9f){scripts['googleTTS'](_0x189d81[_0x744c('0x5e')],_0x189d81[_0x744c('0x64')]||'en',0x1)['then'](function(_0x4bf2e9){_0x3edd9f(null,_0x4bf2e9);})[_0x744c('0x14')](function(_0x1ec213){_0x3edd9f(_0x1ec213);});};AGIVertices[_0x744c('0x15')][_0x744c('0x65')]=function(_0x3d78c0,_0x1dc6e4){var _0x3acd01={'uri':_0x3d78c0['url'],'method':_0x3d78c0['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3d78c0[_0x744c('0x66')])===_0x744c('0x67')&&parseInt(_0x3d78c0[_0x744c('0x66')])>=0x1?parseInt(_0x3d78c0[_0x744c('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x744c('0x68'),_0x744c('0x69')],_0x3acd01[_0x744c('0x6a')][_0x744c('0x6b')]())){try{_0x3acd01[_0x744c('0x6c')]=_0x3d78c0[_0x744c('0xb')]?JSON[_0x744c('0x6d')](_0x3d78c0[_0x744c('0xb')]):{};}catch(_0x1f8cef){logger['error'](_0x744c('0x6e'),_0x1f8cef);}}try{_0x3acd01['headers']=_0x3d78c0['rawHeaders']?JSON[_0x744c('0x6d')](_0x3d78c0[_0x744c('0xa')]):{};}catch(_0x338c68){logger[_0x744c('0x2d')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x338c68);}if(_0x3d78c0[_0x744c('0x6f')]){try{var _0x1438b1=require(_0x3d78c0[_0x744c('0x6f')])[_0x744c('0x70')](this,_0x3acd01);_0x3acd01[_0x744c('0x71')]=Mustache[_0x744c('0x72')](_0x3d78c0[_0x744c('0x73')],_0x1438b1,{},['$$','$$']);if(_0x3acd01[_0x744c('0x74')]){_0x3acd01[_0x744c('0x74')]=JSON[_0x744c('0x6d')](Mustache[_0x744c('0x72')](JSON[_0x744c('0x75')](_0x3acd01[_0x744c('0x74')]),_0x1438b1,{},['$$','$$']));}if(_0x3acd01[_0x744c('0x6c')]){_0x3acd01['body']=JSON[_0x744c('0x6d')](Mustache[_0x744c('0x72')](JSON[_0x744c('0x75')](_0x3acd01[_0x744c('0x6c')]),_0x1438b1,{},['$$','$$']));}}catch(_0x525308){logger[_0x744c('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x525308);}}rp(_0x3acd01)[_0x744c('0x12')](function(_0x179cc2){var _0x2a0417={'statusCode':_0x179cc2[_0x744c('0x76')]||0xc8,'statusMessage':_0x179cc2[_0x744c('0x77')]||'OK','headers':_0x179cc2[_0x744c('0x74')]||{},'body':_0x179cc2['body']||{}};_0x1dc6e4(null,_0x2a0417);})[_0x744c('0x14')](function(_0x298a0d){var _0x41b5b7={'statusCode':_0x298a0d['statusCode']||0x1f4,'statusMessage':_0x298a0d['message']||_0x744c('0x78'),'headers':_0x298a0d[_0x744c('0x79')][_0x744c('0x74')]||{},'body':_0x298a0d[_0x744c('0x79')]['body']||{}};_0x1dc6e4(null,_0x41b5b7);});};AGIVertices[_0x744c('0x15')][_0x744c('0x7a')]=function(_0x51fc22,_0x54aa05){scripts[_0x744c('0x7a')](this[_0x744c('0xf')][_0x744c('0x3d')],_0x51fc22[_0x744c('0x7b')],_0x51fc22[_0x744c('0x5e')],_0x51fc22['dialogflow_language']||'en')[_0x744c('0x12')](function(_0x396ecb){_0x54aa05(null,_0x396ecb);})[_0x744c('0x14')](function(_0x43200f){_0x54aa05(_0x43200f);});};AGIVertices['prototype'][_0x744c('0x7c')]=function(_0x59e018,_0x339715){scripts['sestekNDA'](this[_0x744c('0xf')],_0x59e018)['then'](function(_0x5ddddf){_0x339715(null,_0x5ddddf);})[_0x744c('0x14')](function(_0x4f413c){_0x339715(_0x4f413c);});};AGIVertices[_0x744c('0x15')]['ispeechTTS']=function(_0x152d98,_0x28b461){scripts[_0x744c('0x7d')](_0x152d98[_0x744c('0x7b')],_0x152d98[_0x744c('0x5e')],_0x152d98[_0x744c('0x7e')]||_0x744c('0x7f'),_0x152d98[_0x744c('0x80')])['then'](function(_0x5a87a6){_0x28b461(null,_0x5a87a6);})[_0x744c('0x14')](function(_0x5b0890){_0x28b461(_0x5b0890);});};AGIVertices[_0x744c('0x15')][_0x744c('0x81')]=function(_0x394734,_0x1c2ea2,_0x3574c7){scripts[_0x744c('0x81')](_0x1c2ea2,_0x394734['key'],_0x394734[_0x744c('0x82')]||_0x744c('0x7f'),this[_0x744c('0x83')](_0x394734[_0x744c('0x84')])?_0x394734['model']:undefined)[_0x744c('0x12')](function(_0xda201f){_0x3574c7(null,_0xda201f);})[_0x744c('0x14')](function(_0x40a046){_0x3574c7(_0x40a046);});};AGIVertices['prototype'][_0x744c('0x85')]=function(_0x335657,_0x87dd91){scripts[_0x744c('0x85')](_0x335657[_0x744c('0x86')],_0x335657[_0x744c('0x87')],_0x335657[_0x744c('0x88')],_0x335657[_0x744c('0x89')]||_0x744c('0x8a'),_0x335657[_0x744c('0x5e')],_0x335657[_0x744c('0x8b')]||_0x744c('0x5e'))['then'](function(_0x116af6){_0x87dd91(null,_0x116af6);})[_0x744c('0x14')](function(_0x2e1f84){_0x87dd91(_0x2e1f84);});};AGIVertices[_0x744c('0x15')][_0x744c('0x8c')]=function(_0x9671ec,_0x2c8d84){scripts[_0x744c('0x8c')](this['channel'][_0x744c('0x3d')],_0x9671ec[_0x744c('0x86')],_0x9671ec[_0x744c('0x87')],_0x9671ec[_0x744c('0x8d')],_0x9671ec[_0x744c('0x5e')],_0x9671ec[_0x744c('0x8e')])[_0x744c('0x12')](function(_0x175c8f){_0x2c8d84(null,_0x175c8f);})[_0x744c('0x14')](function(_0x468a96){_0x2c8d84(_0x468a96);});};AGIVertices[_0x744c('0x15')][_0x744c('0x8f')]=function(_0x257866,_0x3679a1,_0x1f8f46){scripts[_0x744c('0x8f')](_0x3679a1,_0x257866['key'],_0x257866[_0x744c('0x90')]||_0x744c('0x7f'))[_0x744c('0x12')](function(_0x3feea7){_0x1f8f46(null,_0x3feea7);})[_0x744c('0x14')](function(_0x4240aa){_0x1f8f46(_0x4240aa);});};AGIVertices[_0x744c('0x15')]['tildeASR']=function(_0x5369da,_0x5c64a4,_0x22a606){scripts['tildeASR'](_0x5c64a4,_0x5369da[_0x744c('0x91')],_0x5369da[_0x744c('0x92')],_0x5369da['uri'])['then'](function(_0x155886){_0x22a606(null,_0x155886);})[_0x744c('0x14')](function(_0x5da5dd){_0x22a606(_0x5da5dd);});};AGIVertices[_0x744c('0x15')][_0x744c('0x93')]=function(_0x3d248e){var _0x1abbb1=_[_0x744c('0x94')](verticesWithRetry,_0x3d248e[_0x744c('0x95')])?_0x3d248e:_[_0x744c('0x96')](_0x3d248e);for(var _0x17623d in _0x1abbb1){if(_0x1abbb1['hasOwnProperty'](_0x17623d)){if(_0x1abbb1[_0x17623d]&&_[_0x744c('0x97')](_0x1abbb1[_0x17623d])){if(_[_0x744c('0x94')](recursiveMapAttributes,_0x17623d)){_0x1abbb1[_0x17623d]=this[_0x744c('0x98')](_0x1abbb1[_0x17623d]);}else{_0x1abbb1[_0x17623d]=this[_0x744c('0x99')](_0x1abbb1[_0x17623d]);}}}}return _0x1abbb1;};AGIVertices[_0x744c('0x15')]['recursiveNodeIndex']=function(_0x532e2e){for(var _0x4687f4 in _0x532e2e){if(_0x532e2e[_0x744c('0x9a')](_0x4687f4)){if(_[_0x744c('0x9b')](_0x532e2e[_0x4687f4])){this[_0x744c('0x9c')](_0x532e2e[_0x4687f4]);}else if(_[_0x744c('0x9d')](_0x532e2e[_0x4687f4])){for(var _0x1d35e3=0x0;_0x1d35e3<_0x532e2e[_0x4687f4][_0x744c('0x9e')];_0x1d35e3++){this[_0x744c('0x9c')](_0x532e2e[_0x4687f4][_0x1d35e3]);}}else if(_['isString'](_0x532e2e[_0x4687f4])){_0x532e2e[_0x4687f4]=this[_0x744c('0x99')](_0x532e2e[_0x4687f4]);}}}};AGIVertices[_0x744c('0x15')][_0x744c('0x9f')]=function(_0x26ad87,_0x56bb4b){for(var _0x40c2d4 in _0x26ad87){if(_0x26ad87[_0x744c('0x9a')](_0x40c2d4)){if(_[_0x744c('0x9b')](_0x26ad87[_0x40c2d4])){if(!_[_0x744c('0xa0')](_0x26ad87[_0x40c2d4])){this[_0x744c('0x9f')](_0x26ad87[_0x40c2d4],util[_0x744c('0x55')](_0x744c('0xa1'),_0x56bb4b,_0x40c2d4));}}else if(_[_0x744c('0x9d')](_0x26ad87[_0x40c2d4])){for(var _0xa49de8=0x0;_0xa49de8<_0x26ad87[_0x40c2d4]['length'];_0xa49de8++){this[_0x744c('0x9f')](_0x26ad87[_0x40c2d4][_0xa49de8],util[_0x744c('0x55')](_0x744c('0xa1'),_0x56bb4b,_0x40c2d4+'['+_0xa49de8+']'));}}else{if(!_['isNil'](_0x26ad87[_0x40c2d4])){this['channel'][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0xa1'),_0x56bb4b,_0x40c2d4),_0x26ad87[_0x40c2d4]);}}}}};AGIVertices[_0x744c('0x15')][_0x744c('0x98')]=function(_0x2862ae){try{var _0xe29109=JSON['parse'](_0x2862ae);this[_0x744c('0x9c')](_0xe29109);return JSON[_0x744c('0x75')](_0xe29109);}catch(_0x76f4d9){return this[_0x744c('0x99')](_0x2862ae);}};AGIVertices['prototype'][_0x744c('0x99')]=function(_0xa0620d){var _0x457bda=_0xa0620d['split']('{');for(var _0x2c8b44=0x1;_0x2c8b44<_0x457bda[_0x744c('0x9e')];_0x2c8b44+=0x1){var _0x5aea5a=_0x457bda[_0x2c8b44][_0x744c('0xa3')]('}');if(_0x5aea5a[_0x744c('0x9e')]>0x1){_0xa0620d=_0xa0620d[_0x744c('0xa4')]('{'+_0x5aea5a[0x0]+'}',this[_0x744c('0xf')][_0x744c('0xa5')](_0x5aea5a[0x0])[_0x744c('0xa6')]||_0x5aea5a[0x0]);}}if(_0x457bda[_0x744c('0x9e')]===0x1){return _0xa0620d[_0x744c('0x4c')]();}return this['replaceAllVariables'](_0xa0620d);};AGIVertices[_0x744c('0x15')][_0x744c('0xa7')]=function(_0x54f67c,_0x1b3fd1){var _0x369265=this[_0x744c('0xf')][_0x744c('0xa5')](_0x54f67c);if(_0x369265['result']===-0x1){return _0x369265;}logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xa8'),_0x1b3fd1,_0x369265[_0x744c('0xa6')]));return this['channel'][_0x744c('0xa2')](_0x1b3fd1,_0x369265[_0x744c('0xa6')]);};AGIVertices[_0x744c('0x15')][_0x744c('0x83')]=function(_0x663fe7){return _0x663fe7&&_0x663fe7!=='0'&&_0x663fe7!=='-1'&&_0x663fe7!=='';};AGIVertices[_0x744c('0x15')]['maxRetry']=function(_0x2f0ddb){this[_0x744c('0x38')][_0x744c('0x70')](this,_0x2f0ddb,'-');_0x2f0ddb[_0x744c('0xa9')]=_0x2f0ddb[_0x744c('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x744c('0xab')]=function(_0x18c66b){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xac'),_0x18c66b[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x18c66b[_0x744c('0x5e')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xae'));}var _0x5ef53d='\x22'+_0x18c66b[_0x744c('0x5e')]+'\x22';if(this['isConfigured'](_0x18c66b[_0x744c('0x79')])){_0x5ef53d+=','+_0x18c66b['options'];}var _0x278e8b=this[_0x744c('0xf')]['exec'](_0x744c('0xaf'),_0x5ef53d);if(_0x278e8b[_0x744c('0xb0')]===-0x1){return _0x278e8b;}return this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0xb1'),_0x5ef53d));};AGIVertices['prototype'][_0x744c('0xb2')]=function(_0x52f058){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xb3'),_0x52f058[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x52f058[_0x744c('0xb4')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xb5'));}var _0x1b303e=_0x52f058['grammar'];if(this[_0x744c('0x83')](_0x52f058[_0x744c('0x79')])){_0x1b303e+=','+_0x52f058[_0x744c('0x79')];}var _0x4097ae=this[_0x744c('0xf')][_0x744c('0x5a')](_0x744c('0xb6'),_0x1b303e);if(_0x4097ae[_0x744c('0xb0')]===-0x1){return _0x4097ae;}var _0x396d2f=this['getAndSetVariable'](_0x744c('0xb7'),_0x744c('0xb8'));if(_0x396d2f[_0x744c('0xb0')]===-0x1){return _0x396d2f;}var _0x3adebe=this[_0x744c('0xa7')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x3adebe['result']===-0x1){return _0x3adebe;}var _0x2178b6=this[_0x744c('0xa7')](_0x744c('0xb9'),_0x744c('0xba'));if(_0x2178b6[_0x744c('0xb0')]===-0x1){return _0x2178b6;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xbb'),_0x1b303e));};AGIVertices[_0x744c('0x15')][_0x744c('0x6')]=function(_0x5a6230){logger[_0x744c('0x2f')](util['format'](_0x744c('0xbc'),_0x5a6230[_0x744c('0x39')]));return this[_0x744c('0xf')][_0x744c('0x6')]([_0x5a6230[_0x744c('0xbd')],_0x5a6230[_0x744c('0xbe')]]);};AGIVertices[_0x744c('0x15')][_0x744c('0xbf')]=function(_0x4e5d97){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xc0'),_0x4e5d97[_0x744c('0x39')]));if(this['isConfigured'](_0x4e5d97[_0x744c('0x66')])){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xc1'),_0x4e5d97[_0x744c('0x66')]));var _0x4e50da=this[_0x744c('0xf')][_0x744c('0xc2')](_0x4e5d97['timeout']);if(_0x4e50da[_0x744c('0xb0')]===-0x1){return _0x4e50da;}}return this[_0x744c('0xf')][_0x744c('0xbf')]();};AGIVertices[_0x744c('0x15')]['callback']=function(_0x4c3d12){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xc3'),_0x4c3d12[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x4c3d12[_0x744c('0x49')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x4c3d12,_0x744c('0xc4'));}_0x4c3d12[_0x744c('0x4a')]=moment();if(this[_0x744c('0x83')](_0x4c3d12['delay'])){_0x4c3d12[_0x744c('0x4a')]=moment()[_0x744c('0xc5')](_0x4c3d12['delay'],_0x744c('0xc6'));}if(!this[_0x744c('0x83')](_0x4c3d12['callback_priority'])){_0x4c3d12[_0x744c('0x4d')]=0x2;}this['createCmContact'][_0x744c('0x70')](this,_0x4c3d12);return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4c3d12[_0x744c('0x48')],_0x4c3d12[_0x744c('0x49')],_0x4c3d12[_0x744c('0x4a')]));};AGIVertices[_0x744c('0x15')][_0x744c('0xc7')]=function(_0x472ca4){logger['info'](util['format'](_0x744c('0xc8'),_0x472ca4[_0x744c('0x39')]));var _0x110542=this[_0x744c('0xf')][_0x744c('0x5a')](_0x472ca4[_0x744c('0xc9')],_0x472ca4['options']);if(_0x110542['result']===-0x1){return _0x110542;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xca'),_0x472ca4[_0x744c('0xc9')],_0x472ca4[_0x744c('0x79')]));};AGIVertices[_0x744c('0x15')][_0x744c('0xcb')]=function(_0x36dd0b){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xcc'),_0x36dd0b['label']));if(!this['isConfigured'](_0x36dd0b[_0x744c('0x5e')])){return this[_0x744c('0xf')]['noop'](_0x744c('0xae'));}var _0x424ee4='\x22'+_0x36dd0b[_0x744c('0x5e')]+'\x22';if(this[_0x744c('0x83')](_0x36dd0b[_0x744c('0x79')])){_0x424ee4+=','+_0x36dd0b[_0x744c('0x79')];}var _0x5561a0=this[_0x744c('0xf')][_0x744c('0x5a')](_0x744c('0xaf'),_0x424ee4);if(_0x5561a0['result']===-0x1){return _0x5561a0;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xb1'),_0x424ee4));};AGIVertices[_0x744c('0x15')][_0x744c('0xcd')]=function(_0x3d2f39){logger['info'](util['format'](_0x744c('0xce'),_0x3d2f39[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x3d2f39[_0x744c('0x5e')])){return this[_0x744c('0xf')]['noop'](_0x744c('0xae'));}var _0x5af951='\x22'+_0x3d2f39[_0x744c('0x5e')]+'\x22';if(this[_0x744c('0x83')](_0x3d2f39['options'])){_0x5af951+=','+_0x3d2f39['options'];}var _0x9215f3=this[_0x744c('0xf')][_0x744c('0x5a')](_0x744c('0xaf'),_0x5af951);if(_0x9215f3['result']===-0x1){return _0x9215f3;}return this['channel'][_0x744c('0xad')](util[_0x744c('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5af951));};AGIVertices['prototype']['lumenvoxasr']=function(_0x2cfc6a){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xcf'),_0x2cfc6a[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x2cfc6a['grammar'])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x1147ed=_0x2cfc6a[_0x744c('0xb4')];if(this[_0x744c('0x83')](_0x2cfc6a['options'])){_0x1147ed+=','+_0x2cfc6a[_0x744c('0x79')];}var _0x4e1e5d=this['channel'][_0x744c('0x5a')]('MRCPRecog',_0x1147ed);if(_0x4e1e5d[_0x744c('0xb0')]===-0x1){return _0x4e1e5d;}var _0x4e0056=this[_0x744c('0xa7')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x4e0056['result']===-0x1){return _0x4e0056;}var _0x441935=this[_0x744c('0xa7')](_0x744c('0xd0'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x441935[_0x744c('0xb0')]===-0x1){return _0x441935;}var _0xc175f=this[_0x744c('0xa7')](_0x744c('0xb9'),'LUMENVOX_ASR_INSTANCE');if(_0xc175f[_0x744c('0xb0')]===-0x1){return _0xc175f;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1147ed));};AGIVertices[_0x744c('0x15')][_0x744c('0xd1')]=function(_0x465156){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xd2'),_0x465156[_0x744c('0x39')]));if(!this['isConfigured'](_0x465156[_0x744c('0xb4')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xb5'));}var _0x1510fd=_0x465156['grammar'];if(this['isConfigured'](_0x465156[_0x744c('0x79')])){_0x1510fd+=','+_0x465156['options'];}var _0x318e36=this['channel'][_0x744c('0x5a')](_0x744c('0xb6'),_0x1510fd);if(_0x318e36[_0x744c('0xb0')]===-0x1){return _0x318e36;}var _0x4499aa=this['getAndSetVariable'](_0x744c('0xb7'),_0x744c('0xd3'));if(_0x4499aa['result']===-0x1){return _0x4499aa;}var _0x5265ac=this[_0x744c('0xa7')]('RECOG_INPUT()',_0x744c('0xd4'));if(_0x5265ac[_0x744c('0xb0')]===-0x1){return _0x5265ac;}var _0x16040c=this[_0x744c('0xa7')](_0x744c('0xb9'),_0x744c('0xd5'));if(_0x16040c['result']===-0x1){return _0x16040c;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xbb'),_0x1510fd));};AGIVertices[_0x744c('0x15')][_0x744c('0xd6')]=function(_0x568ed5){logger[_0x744c('0x2f')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x568ed5[_0x744c('0x39')]));if(!this['isConfigured'](_0x568ed5['odbc_id'])){return this[_0x744c('0xf')]['error'](_0x568ed5,_0x744c('0xd7'));}var _0x24c94b=this['getSquareOdbc']['sync'](this,_0x568ed5[_0x744c('0xd8')]);if(!_0x24c94b){return this['channel'][_0x744c('0x2d')](_0x568ed5,_0x744c('0xd9'));}if(!this[_0x744c('0x83')](_0x568ed5['query'])){return this[_0x744c('0xf')]['error'](_0x568ed5,'no\x20query\x20configured');}var _0x33f759=_0x568ed5[_0x744c('0xda')][_0x744c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0xdb'),_0x33f759));var _0xdf1142=this[_0x744c('0x2b')][_0x744c('0x70')](this,_0x24c94b,_0x33f759);this[_0x744c('0x38')][_0x744c('0x70')](this,_0x568ed5,_0x33f759);if(!this[_0x744c('0x83')](_0x568ed5[_0x744c('0xdc')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xdd'));}var _0xb8c527=this['getVariable'][_0x744c('0x70')](this,_0x568ed5['variable_id']);if(!_0xb8c527){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x568ed5,_0x744c('0xde'));}var _0xba8459=this;_0xdf1142[_0x744c('0xdf')](function(_0x5b7658,_0x276dcd){Object[_0x744c('0xe0')](_0x5b7658)['forEach'](function(_0x2859b4){_0xba8459[_0x744c('0xf')][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0xe1'),_0xb8c527,_0x276dcd,_0x2859b4),_0x5b7658[_0x2859b4]);});});this['channel']['setVariable'](util['format'](_0x744c('0xe2'),_0xb8c527),_0xdf1142[_0x744c('0x9e')]);return this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')]('variable\x20%s\x20set',_0xb8c527));};AGIVertices['prototype'][_0x744c('0xe3')]=function(_0x5bef42){logger['debug'](util[_0x744c('0x55')](_0x744c('0xe4'),_0x5bef42[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x5bef42[_0x744c('0xe5')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x5bef42,_0x744c('0xe6'));}var _0xf43931=this[_0x744c('0xe7')][_0x744c('0x70')](this,_0x5bef42[_0x744c('0xe5')]);if(!_0xf43931){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x5bef42,_0x744c('0xe8'));}var _0x171917=this[_0x744c('0xf')][_0x744c('0x5a')](_0x744c('0xe9'),[util[_0x744c('0x55')](_0x744c('0xea'),_0xf43931),_0x5bef42[_0x744c('0x66')],_0x5bef42['opts'],_0x5bef42['url']]);if(_0x171917['result']===-0x1){return _0x171917;}return this['channel'][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xeb'),_0x744c('0xe9')));};AGIVertices[_0x744c('0x15')][_0x744c('0xec')]=function(_0x7201a){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0xed'),_0x7201a[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x7201a[_0x744c('0x7b')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xee'));}if(!this[_0x744c('0x83')](_0x7201a[_0x744c('0x5e')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xae'));}this[_0x744c('0xf')][_0x744c('0xef')]=!![];this[_0x744c('0x38')](_0x7201a);this[_0x744c('0x43')](_0x7201a['text'],'in');this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0xf0'),_0x7201a[_0x744c('0x5e')]));var _0x2d9cd6=this[_0x744c('0x7a')][_0x744c('0x70')](this,_0x7201a);if(_0x2d9cd6){for(var _0x26e589 in _0x2d9cd6){if(_0x2d9cd6['hasOwnProperty'](_0x26e589)){this['channel'][_0x744c('0xa2')](util['format'](_0x744c('0xf1'),_0x26e589[_0x744c('0x6b')]()),_0x2d9cd6[_0x26e589]);}}this['createSquareMessage'](_0x2d9cd6[_0x744c('0xf2')],_0x744c('0xf3'));return this['channel']['noop'](util[_0x744c('0x55')](_0x744c('0xf4'),_0x2d9cd6[_0x744c('0xf2')]));}return this[_0x744c('0xf')][_0x744c('0x2d')](_0x7201a,_0x744c('0xf5'));};AGIVertices['prototype'][_0x744c('0xf6')]=function(_0x2c4509){logger['info'](util[_0x744c('0x55')](_0x744c('0xf7'),_0x2c4509['label']));if(!this[_0x744c('0x83')](_0x2c4509[_0x744c('0xf8')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xf9'));}if(!this['isConfigured'](_0x2c4509['username'])){return this['channel'][_0x744c('0xad')](_0x744c('0xfa'));}if(!this[_0x744c('0x83')](_0x2c4509[_0x744c('0xfb')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xfc'));}if(!this[_0x744c('0x83')](_0x2c4509['ndassistant_url'])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xae'));}this['channel'][_0x744c('0xef')]=!![];this[_0x744c('0x38')](_0x2c4509);this[_0x744c('0x43')](_0x2c4509[_0x744c('0x5e')],'in');this['channel'][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xfd'),_0x2c4509[_0x744c('0x5e')]));var _0x6f9e91=this[_0x744c('0x7c')][_0x744c('0x70')](this,_0x2c4509);if(_0x6f9e91){for(var _0x1648e4 in _0x6f9e91){if(_0x6f9e91['hasOwnProperty'](_0x1648e4)){this['channel'][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0xfe'),_0x1648e4['toUpperCase']()),_0x6f9e91[_0x1648e4]);}}this[_0x744c('0x43')](_0x6f9e91['speech'],_0x744c('0xf3'));if(_0x6f9e91[_0x744c('0xff')]){this[_0x744c('0xf')]['noop'](util['format'](_0x744c('0x100'),_0x6f9e91[_0x744c('0xff')]));var _0x10119f=this[_0x744c('0xf')]['streamFile'](_0x6f9e91[_0x744c('0xff')]);try{fs['unlink'](_0x6f9e91[_0x744c('0xff')]+_0x744c('0x101'));}catch(_0x4fbec2){logger['error'](_0x4fbec2);}return _0x10119f;}else{return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x102'),_0x6f9e91[_0x744c('0xf2')]));}}return this[_0x744c('0xf')][_0x744c('0x2d')](_0x2c4509,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x325dc2){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x103'),_0x325dc2['label']));return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x104'));};AGIVertices['prototype'][_0x744c('0x105')]=function(_0xae722a){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x106'),_0xae722a['label']));var _0x31e251='';if(_0xae722a['trunk_id']){if(!this[_0x744c('0x83')](_0xae722a['trunk_id'])){return this['channel'][_0x744c('0x2d')](_0xae722a,_0x744c('0x107'));}else{var _0x53d223=parseInt(_0xae722a[_0x744c('0x108')],0xa);if(isNaN(_0x53d223)){_0x31e251=_0xae722a['trunk_id'];}else{_0x31e251=this[_0x744c('0x1e')][_0x744c('0x70')](this,_0xae722a['trunk_id']);if(!_0x31e251){return this['channel'][_0x744c('0x2d')](_0xae722a,_0x744c('0x109'));}}}}else if(_0xae722a['trunk_name']){_0x31e251=_0xae722a['trunk_name'];}else{return this['channel'][_0x744c('0x2d')](_0xae722a,_0x744c('0x107'));}var _0x5de471=this['channel'][_0x744c('0x5a')](_0x744c('0xe9'),[util[_0x744c('0x55')]('SIP/%s/%s',_0x31e251,_0xae722a[_0x744c('0x48')]),_0xae722a[_0x744c('0x66')],_0xae722a[_0x744c('0x10a')],_0xae722a[_0x744c('0x73')]]);if(_0x5de471['result']===-0x1){return _0x5de471;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xeb'),_0x744c('0xe9')));};AGIVertices[_0x744c('0x15')][_0x744c('0x10b')]=function(_0x4b2e23){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x10c'),_0x4b2e23['label']));return this[_0x744c('0xf')]['noop']('finally');};AGIVertices[_0x744c('0x15')]['getdigits']=function(_0x8e5e5){logger[_0x744c('0x2f')](util[_0x744c('0x55')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x8e5e5['label']));if(_0x8e5e5['retry']===0x0){return this[_0x744c('0xaa')](_0x8e5e5);}_0x8e5e5['retry']-=0x1;if(!this[_0x744c('0x83')](_0x8e5e5[_0x744c('0x10d')])){return this['channel'][_0x744c('0x2d')](_0x8e5e5,_0x744c('0x10e'));}var _0x54d764=this['getSound'][_0x744c('0x70')](this,_0x8e5e5['file_id']);if(!_0x54d764){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x8e5e5,_0x744c('0x10f'));}if(!this[_0x744c('0x83')](_0x8e5e5[_0x744c('0xdc')])){return this['channel'][_0x744c('0x2d')](_0x744c('0xdd'));}var _0x1cf283=this[_0x744c('0xf')]['getData'](_0x54d764,_0x8e5e5[_0x744c('0x110')],_0x8e5e5[_0x744c('0x111')]);var _0x3ffa46=_0x1cf283['result']?_0x1cf283[_0x744c('0xb0')]['toString']():'';logger['info']('test',JSON['stringify'](_0x1cf283));if(_0x1cf283[_0x744c('0xb0')]===-0x1){this[_0x744c('0x38')]['sync'](this,_0x8e5e5,_0x3ffa46);return _0x1cf283;}else if(_0x1cf283[_0x744c('0xa6')]==='timeout'){_0x1cf283[_0x744c('0xb0')]=_0x3ffa46['length']>=parseInt(_0x8e5e5['mindigit'])?'x':'i';}else{_0x1cf283[_0x744c('0xb0')]=_0x3ffa46[_0x744c('0x9e')]>=parseInt(_0x8e5e5[_0x744c('0x112')])&&_0x3ffa46[_0x744c('0x9e')]<=parseInt(_0x8e5e5['maxdigit'])?'x':'i';}var _0x186740=this[_0x744c('0xa5')][_0x744c('0x70')](this,_0x8e5e5[_0x744c('0xdc')]);if(!_0x186740){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x8e5e5,_0x744c('0xde'));}this[_0x744c('0xf')][_0x744c('0xa2')](_0x186740,_0x3ffa46);if(this['isConfigured'](_0x8e5e5['hiddendigitsnum'])){var _0x101ad8=parseInt(_0x8e5e5[_0x744c('0x113')],0xa);var _0xed1e9b=rs[_0x744c('0x114')]({'charset':'*','length':_0x101ad8});var _0x4c1520=_0x3ffa46[_0x744c('0x9e')];if(_0x4c1520>0x0){if(_0x4c1520>_0x101ad8){this['createSquareDetailsReport'][_0x744c('0x70')](this,_0x8e5e5,_0x8e5e5[_0x744c('0x115')]==='first'?_0xed1e9b+_0x3ffa46[_0x744c('0x116')](_0x101ad8):_0x3ffa46['substr'](0x0,_0x4c1520-_0x101ad8)+_0xed1e9b);}else{this[_0x744c('0x38')]['sync'](this,_0x8e5e5,rs[_0x744c('0x114')]({'charset':'*','length':_0x4c1520}));}}else{this['createSquareDetailsReport'][_0x744c('0x70')](this,_0x8e5e5,'');}}else{this[_0x744c('0x38')][_0x744c('0x70')](this,_0x8e5e5,_0x3ffa46);}return _0x1cf283;};AGIVertices[_0x744c('0x15')][_0x744c('0xe')]=function(_0x5651e6){logger['info'](util[_0x744c('0x55')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5651e6['label']));return this[_0x744c('0xd')](_0x5651e6);};AGIVertices[_0x744c('0x15')]['goal']=function(_0x568000){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x117'),_0x568000[_0x744c('0x39')]));this[_0x744c('0x38')][_0x744c('0x70')](this,_0x568000,_0x568000[_0x744c('0x118')]);return this['channel']['noop'](util[_0x744c('0x55')](_0x744c('0x119'),_0x568000[_0x744c('0x118')]));};AGIVertices[_0x744c('0x15')][_0x744c('0x11a')]=function(_0x467be2){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x11b'),_0x467be2[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x467be2['aws_access_key_id'])||!this[_0x744c('0x83')](_0x467be2[_0x744c('0x87')])){return this[_0x744c('0xf')]['noop'](_0x744c('0x11c'));}if(!this[_0x744c('0x83')](_0x467be2['text'])){return this['channel'][_0x744c('0xad')](_0x744c('0xae'));}this['channel'][_0x744c('0xad')](util[_0x744c('0x55')]('Trying\x20aws\x20Polly\x20%s',_0x467be2[_0x744c('0x5e')]));var _0x5209d6=this[_0x744c('0x85')][_0x744c('0x70')](this,_0x467be2);if(_0x5209d6){this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')]('aws\x20Polly\x20%s\x20file\x20created',_0x5209d6));var _0x575106=this[_0x744c('0xf')]['streamFile'](_0x5209d6);try{fs['unlink'](_0x5209d6+_0x744c('0x101'));}catch(_0x35be01){logger[_0x744c('0x2d')](_0x35be01);}return _0x575106;}return this[_0x744c('0xf')]['error'](_0x467be2,_0x744c('0x11d'));};AGIVertices[_0x744c('0x15')]['awslex']=function(_0x5ae432){logger['info'](util[_0x744c('0x55')](_0x744c('0x11e'),_0x5ae432[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x5ae432['aws_access_key_id'])||!this[_0x744c('0x83')](_0x5ae432[_0x744c('0x87')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x11c'));}if(!this[_0x744c('0x83')](_0x5ae432[_0x744c('0x8e')])){return this['channel'][_0x744c('0xad')](_0x744c('0x11f'));}if(!this[_0x744c('0x83')](_0x5ae432[_0x744c('0x5e')])){return this['channel']['noop'](_0x744c('0xae'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x5ae432);this[_0x744c('0x43')](_0x5ae432[_0x744c('0x5e')],'in');this[_0x744c('0xf')][_0x744c('0xad')](util['format'](_0x744c('0x120'),_0x5ae432[_0x744c('0x5e')]));var _0x2bfaaf=this[_0x744c('0x8c')]['sync'](this,_0x5ae432);if(_0x2bfaaf){for(var _0x16b265 in _0x2bfaaf){if(_0x2bfaaf[_0x744c('0x9a')](_0x16b265)&&_[_0x744c('0x97')](_0x2bfaaf[_0x16b265])){this[_0x744c('0xf')][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0x121'),_0x16b265[_0x744c('0x6b')]()),_0x2bfaaf[_0x16b265]);}}if(_[_0x744c('0x47')](_0x2bfaaf[_0x744c('0x122')])){return this['channel'][_0x744c('0xad')](_0x744c('0x123'));}else{this['createSquareMessage'](_0x2bfaaf['message'],_0x744c('0xf3'));return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')]('Amazon\x20Lex\x20Result\x20%s',_0x2bfaaf[_0x744c('0x122')]));}}return this[_0x744c('0xf')][_0x744c('0x2d')](_0x5ae432,_0x744c('0x124'));};AGIVertices[_0x744c('0x15')]['googleasr']=function(_0x46cc19){logger[_0x744c('0x2f')](util['format'](_0x744c('0x125'),_0x46cc19[_0x744c('0x39')],_0x46cc19[_0x744c('0x66')]));if(!this[_0x744c('0x83')](_0x46cc19[_0x744c('0x7b')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xee'));}var _0x1a8649=_0x744c('0x126');var _0x1fdac3=util['format'](_0x744c('0x127'),FILES_PATH,rs['generate'](0x4));var _0xb350cd=util['format'](_0x744c('0xa1'),_0x1fdac3,_0x1a8649);var _0x3c5c7f=!![];if(_0x46cc19[_0x744c('0x128')]===_0x744c('0x129')){_0x3c5c7f=![];}var _0xcdc14c=this[_0x744c('0xf')]['recordFile'](_0x1fdac3,_0x1a8649,_0x46cc19[_0x744c('0x12a')],_0x46cc19[_0x744c('0x66')],undefined,_0x3c5c7f);if(_0xcdc14c['result']!==-0x1){this['channel']['noop'](util['format'](_0x744c('0x12b'),_0xb350cd));var _0x4e45ad=this[_0x744c('0x8f')][_0x744c('0x70')](this,_0x46cc19,_0xb350cd);if(_0x4e45ad){for(var _0x51a9ce in _0x4e45ad){if(_0x4e45ad[_0x744c('0x9a')](_0x51a9ce)){this[_0x744c('0xf')][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0x12c'),_0x51a9ce[_0x744c('0x6b')]()),_0x4e45ad[_0x51a9ce]);}}return this['channel'][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x12d'),JSON[_0x744c('0x75')](_0x4e45ad)));}}return _0xcdc14c;};AGIVertices['prototype']['tildeasr']=function(_0x5dd3ea){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x12e'),_0x5dd3ea[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x5dd3ea[_0x744c('0x91')])){return this[_0x744c('0xf')][_0x744c('0xad')]('no\x20appid\x20configured');}if(!this[_0x744c('0x83')](_0x5dd3ea['appsecret'])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x12f'));}var _0x4bc29b=_0x744c('0x126');var _0x27e0a6=util[_0x744c('0x55')](_0x744c('0x127'),FILES_PATH,rs[_0x744c('0x114')](0x4));var _0x1622e9=util['format'](_0x744c('0xa1'),_0x27e0a6,_0x4bc29b);var _0x3c27f3=!![];if(_0x5dd3ea[_0x744c('0x128')]===_0x744c('0x129')){_0x3c27f3=![];}var _0x59b684=this[_0x744c('0xf')]['recordFile'](_0x27e0a6,_0x4bc29b,_0x5dd3ea[_0x744c('0x12a')],_0x5dd3ea[_0x744c('0x66')],undefined,_0x3c27f3);if(_0x59b684[_0x744c('0xb0')]!==-0x1){this['channel'][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x130'),_0x1622e9));var _0x136115=this[_0x744c('0x131')]['sync'](this,_0x5dd3ea,_0x1622e9);if(_0x136115){for(var _0x2f2b9f in _0x136115){if(_0x136115['hasOwnProperty'](_0x2f2b9f)){this[_0x744c('0xf')][_0x744c('0xa2')](util[_0x744c('0x55')]('TILDE_ASR_%s',_0x2f2b9f['toUpperCase']()),_0x136115[_0x2f2b9f]);}}return this['channel'][_0x744c('0xad')](util[_0x744c('0x55')]('TildeASR\x20Result\x20%s',JSON[_0x744c('0x75')](_0x136115)));}}return _0x59b684;};AGIVertices[_0x744c('0x15')][_0x744c('0x132')]=function(_0x3f8e47){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3f8e47[_0x744c('0x39')]));return this[_0x744c('0xf')][_0x744c('0x133')](_0x3f8e47['context'],_0x3f8e47[_0x744c('0x3e')],_0x3f8e47[_0x744c('0x3f')]);};AGIVertices[_0x744c('0x15')][_0x744c('0x134')]=function(_0x2ce6a9){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x135'),_0x2ce6a9[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x2ce6a9[_0x744c('0x136')])){return this[_0x744c('0xf')]['error'](_0x2ce6a9,_0x744c('0x137'));}try{var _0x4755c7=eval(_0x2ce6a9[_0x744c('0x136')])?'true':_0x744c('0x138');this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2ce6a9['condition'],_0x4755c7));return{'code':0xc8,'result':_0x4755c7};}catch(_0x58f4ff){return{'code':0xc8,'result':_0x744c('0x138')};}};AGIVertices[_0x744c('0x15')][_0x744c('0x139')]=function(_0x50abc7){logger[_0x744c('0x2f')](util[_0x744c('0x55')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x50abc7[_0x744c('0x39')]));if(!this['isConfigured'](_0x50abc7[_0x744c('0x13a')])){return this['channel']['error'](_0x50abc7,_0x744c('0x13b'));}var _0x593d68=this[_0x744c('0x26')][_0x744c('0x70')](this,_0x50abc7[_0x744c('0x13a')]);if(!_0x593d68){return this['channel']['error'](_0x50abc7,'no\x20intervals\x20found');}for(var _0x22474b=0x0;_0x22474b<_0x593d68[_0x744c('0x9e')];_0x22474b+=0x1){var _0x5e80fb=this['channel']['getVariable'](util[_0x744c('0x55')]('IFTIME(%s?true:false)',_0x593d68[_0x22474b]));if(_0x5e80fb[_0x744c('0xb0')]===-0x1){return _0x5e80fb;}logger[_0x744c('0x2f')](util[_0x744c('0x55')]('IFTIME\x20%s\x20%s',_0x593d68[_0x22474b],_0x5e80fb[_0x744c('0xa6')]));if(_0x5e80fb[_0x744c('0xa6')]===_0x744c('0x13c')){logger['info'](util[_0x744c('0x55')](_0x744c('0x13d'),_0x593d68[_0x22474b],'true'));this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0x13d'),_0x593d68[_0x22474b],_0x744c('0x13c')));return{'code':0xc8,'result':_0x744c('0x13c')};}else{logger['info'](util[_0x744c('0x55')](_0x744c('0x13d'),_0x593d68[_0x22474b],_0x744c('0x138')));this[_0x744c('0xf')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x593d68[_0x22474b],_0x744c('0x138')));}}return{'code':0xc8,'result':_0x744c('0x138')};};AGIVertices[_0x744c('0x15')][_0x744c('0x13e')]=function(_0x1a36f9){logger[_0x744c('0x2f')](util['format'](_0x744c('0x13f'),_0x1a36f9[_0x744c('0x39')]));return this[_0x744c('0xf')][_0x744c('0x13e')]();};AGIVertices[_0x744c('0x15')][_0x744c('0x140')]=function(_0x1786b8){logger[_0x744c('0x2f')](util['format'](_0x744c('0x141'),_0x1786b8[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x1786b8[_0x744c('0x7b')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xee'));}var _0x205d58=_0x744c('0x126');var _0x4cabbf=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x744c('0x114')](0x4));var _0x44c4ca=util['format'](_0x744c('0xa1'),_0x4cabbf,_0x205d58);var _0x3f0b7d=!![];if(_0x1786b8[_0x744c('0x128')]===_0x744c('0x129')){_0x3f0b7d=![];}var _0x584a96=this[_0x744c('0xf')][_0x744c('0x142')](_0x4cabbf,_0x205d58,_0x1786b8['intKey'],_0x1786b8[_0x744c('0x66')],undefined,_0x3f0b7d);if(_0x584a96[_0x744c('0xb0')]!==-0x1){this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x143'),_0x44c4ca));var _0xfbc374=this[_0x744c('0x81')][_0x744c('0x70')](this,_0x1786b8,_0x44c4ca);if(_0xfbc374){for(var _0x222a9e in _0xfbc374){if(_0xfbc374[_0x744c('0x9a')](_0x222a9e)){this[_0x744c('0xf')][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0x144'),_0x222a9e[_0x744c('0x6b')]()),_0xfbc374[_0x222a9e]);}}return this[_0x744c('0xf')][_0x744c('0xad')](util['format'](_0x744c('0x145'),JSON[_0x744c('0x75')](_0xfbc374)));}}return _0x584a96;};AGIVertices[_0x744c('0x15')][_0x744c('0x146')]=function(_0x4ef0b3){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x147'),_0x4ef0b3[_0x744c('0x39')]));if(!this['isConfigured'](_0x4ef0b3[_0x744c('0x7b')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xee'));}if(!this[_0x744c('0x83')](_0x4ef0b3[_0x744c('0x5e')])){return this[_0x744c('0xf')]['noop'](_0x744c('0xae'));}this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x148'),_0x4ef0b3[_0x744c('0x5e')]));var _0x12cc2e=this[_0x744c('0x7d')][_0x744c('0x70')](this,_0x4ef0b3);if(_0x12cc2e){this['channel'][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x143'),_0x12cc2e));var _0x1a0428=this['channel'][_0x744c('0x149')](_0x12cc2e,_0x4ef0b3['intKey']);try{fs[_0x744c('0x14a')](_0x12cc2e+_0x744c('0x101'));}catch(_0x2b789e){logger['error'](_0x2b789e);}return _0x1a0428;}return this['channel'][_0x744c('0x2d')](_0x4ef0b3,_0x744c('0x14b'));};AGIVertices['prototype'][_0x744c('0x14c')]=function(_0x186e9b){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x186e9b[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x186e9b[_0x744c('0x14d')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x186e9b,_0x744c('0x14e'));}logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x14f'),this[_0x744c('0xf')]['callerid'],_0x186e9b[_0x744c('0x14d')]));var _0x4aef70=this['agentLogin'][_0x744c('0x70')](this,_0x186e9b[_0x744c('0x14d')]);if(_0x4aef70){logger[_0x744c('0x2f')](util[_0x744c('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x744c('0xf')][_0x744c('0x3b')],_0x186e9b[_0x744c('0x14d')]));this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0x150'),this[_0x744c('0xf')][_0x744c('0x3b')],_0x186e9b[_0x744c('0x14d')]));return{'code':0xc8,'result':_0x744c('0x151')};}else{logger['info'](util[_0x744c('0x55')](_0x744c('0x152'),this[_0x744c('0xf')][_0x744c('0x3b')],_0x186e9b[_0x744c('0x14d')]));this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x152'),this[_0x744c('0xf')]['callerid'],_0x186e9b['findBy']));return{'code':0xc8,'result':_0x744c('0x153')};}};AGIVertices[_0x744c('0x15')][_0x744c('0x154')]=function(_0x2f54ef){logger['info'](util[_0x744c('0x55')](_0x744c('0x155'),_0x2f54ef[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x2f54ef[_0x744c('0x14d')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x2f54ef,'no\x20find\x20by\x20configured');}logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x14f'),this[_0x744c('0xf')][_0x744c('0x3b')],_0x2f54ef[_0x744c('0x14d')]));var _0x204bf9=this[_0x744c('0x53')][_0x744c('0x70')](this,_0x2f54ef[_0x744c('0x14d')]);if(_0x204bf9){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x150'),this['channel']['callerid'],_0x2f54ef[_0x744c('0x14d')]));this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x150'),this[_0x744c('0xf')]['callerid'],_0x2f54ef[_0x744c('0x14d')]));return{'code':0xc8,'result':_0x744c('0x151')};}else{logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x152'),this[_0x744c('0xf')]['callerid'],_0x2f54ef[_0x744c('0x14d')]));this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x152'),this['channel']['callerid'],_0x2f54ef[_0x744c('0x14d')]));return{'code':0xc8,'result':_0x744c('0x153')};}};AGIVertices[_0x744c('0x15')]['math']=function(_0x3bd1d3){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x156'),_0x3bd1d3[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x3bd1d3[_0x744c('0x157')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x3bd1d3,_0x744c('0x158'));}this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0x159'),_0x3bd1d3['operation']));var _0x992b66=eval(_0x3bd1d3[_0x744c('0x157')]);if(!this[_0x744c('0x83')](_0x3bd1d3[_0x744c('0xdc')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0xdd'));}var _0x3cb023=this['getVariable']['sync'](this,_0x3bd1d3[_0x744c('0xdc')]);if(!_0x3cb023){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x3bd1d3,_0x744c('0xde'));}if(_['isArray'](_0x992b66)){var _0x1f2e62=this;_0x992b66[_0x744c('0xdf')](function(_0x5e05ad,_0x191111){_0x1f2e62[_0x744c('0xf')]['setVariable'](util['format'](_0x744c('0x15a'),_0x3cb023,_0x191111),_0x5e05ad);});return this[_0x744c('0xf')][_0x744c('0xad')](util['format'](_0x744c('0x15b'),_0x3cb023));}else{return this[_0x744c('0xf')][_0x744c('0xa2')](_0x3cb023,_0x992b66);}};AGIVertices['prototype'][_0x744c('0xc')]=function(_0x3852e1){logger['info'](util['format'](_0x744c('0x15c'),_0x3852e1[_0x744c('0x39')]));if(_0x3852e1['retry']===0x0){return this[_0x744c('0xaa')](_0x3852e1);}_0x3852e1[_0x744c('0xa9')]-=0x1;if(!this['isConfigured'](_0x3852e1[_0x744c('0x10d')])){return this[_0x744c('0xf')]['error'](_0x3852e1,'no\x20file\x20audio\x20selected');}var _0x1cfe31=this[_0x744c('0x15d')][_0x744c('0x70')](this,_0x3852e1[_0x744c('0x10d')]);if(!_0x1cfe31){return this['channel'][_0x744c('0x2d')](_0x3852e1,_0x744c('0x10f'));}var _0x4959a3=this[_0x744c('0xf')][_0x744c('0x15e')](_0x1cfe31,_0x3852e1['response'],_0x3852e1['digit']);var _0x34f1cb=_0x4959a3[_0x744c('0xb0')];if(_0x4959a3[_0x744c('0xb0')]===-0x1){this[_0x744c('0x38')]['sync'](this,_0x3852e1,'-1');return _0x4959a3;}else if(_0x4959a3[_0x744c('0xa6')]===_0x744c('0x66')){_0x4959a3[_0x744c('0xb0')]=_0x4959a3[_0x744c('0xb0')][_0x744c('0x9e')]>0x0?_0x4959a3['result']:'t';}else if(_[_0x744c('0xa0')](_0x4959a3['result'])){_0x4959a3[_0x744c('0xb0')]='#';_0x34f1cb='#';}if(!this['isConfigured'](_0x3852e1['variable_id'])){this['channel'][_0x744c('0xad')](_0x744c('0xdd'));}else{var _0x249070=this[_0x744c('0xa5')]['sync'](this,_0x3852e1[_0x744c('0xdc')]);if(!_0x249070){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x3852e1,_0x744c('0xde'));}this['channel'][_0x744c('0xa2')](_0x249070,_0x34f1cb);}this[_0x744c('0x38')][_0x744c('0x70')](this,_0x3852e1,_0x34f1cb);return _0x4959a3;};AGIVertices[_0x744c('0x15')][_0x744c('0xad')]=function(_0x6a38ff){logger['info'](util['format'](_0x744c('0x15f'),_0x6a38ff['label']));return this[_0x744c('0xf')][_0x744c('0xad')](_0x6a38ff[_0x744c('0x160')]||_0x6a38ff['label']);};AGIVertices[_0x744c('0x15')][_0x744c('0x161')]=function(_0x21dbe4){logger[_0x744c('0x2f')](util[_0x744c('0x55')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x21dbe4[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x21dbe4['findBy'])){return this['channel'][_0x744c('0x2d')](_0x21dbe4,'no\x20find\x20by\x20configured');}logger['info'](util[_0x744c('0x55')](_0x744c('0x14f'),this[_0x744c('0xf')][_0x744c('0x3b')],_0x21dbe4[_0x744c('0x14d')]));var _0x5ef041=this[_0x744c('0x4e')][_0x744c('0x70')](this,_0x21dbe4['pause_id']);var _0x4c2c11=this[_0x744c('0x50')][_0x744c('0x70')](this,_0x21dbe4[_0x744c('0x14d')],_0x5ef041);if(_0x4c2c11){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x150'),this[_0x744c('0xf')]['callerid'],_0x21dbe4[_0x744c('0x14d')]));this[_0x744c('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x744c('0xf')][_0x744c('0x3b')],_0x21dbe4['findBy']));return{'code':0xc8,'result':_0x744c('0x151')};}else{logger[_0x744c('0x2f')](util['format'](_0x744c('0x152'),this[_0x744c('0xf')][_0x744c('0x3b')],_0x21dbe4[_0x744c('0x14d')]));this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x150'),this[_0x744c('0xf')][_0x744c('0x3b')],_0x21dbe4[_0x744c('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x744c('0x15')][_0x744c('0x162')]=function(_0x194c76){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x163'),_0x194c76[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x194c76[_0x744c('0x10d')])){return this['channel'][_0x744c('0x2d')](_0x194c76,_0x744c('0x10e'));}var _0x3ac944=this[_0x744c('0x15d')]['sync'](this,_0x194c76[_0x744c('0x10d')]);if(!_0x3ac944){return this['channel'][_0x744c('0x2d')](_0x194c76,_0x744c('0x10f'));}var _0x339a1c=this[_0x744c('0xf')][_0x744c('0x5a')]('PLAYBACK',[_0x3ac944,_0x194c76[_0x744c('0x10a')]]);if(_0x339a1c[_0x744c('0xb0')]===-0x1){return _0x339a1c;}return this['channel']['noop'](util[_0x744c('0x55')](_0x744c('0xca'),_0x744c('0x164'),_0x3ac944));};AGIVertices[_0x744c('0x15')][_0x744c('0x165')]=function(_0x3a2f6c){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x166'),_0x3a2f6c['label']));if(!this[_0x744c('0x83')](_0x3a2f6c[_0x744c('0x167')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x3a2f6c,_0x744c('0x168'));}var _0x4ca6a6='';var _0x1a8139=parseInt(_0x3a2f6c[_0x744c('0x167')],0xa);if(isNaN(_0x1a8139)){_0x4ca6a6=_0x3a2f6c[_0x744c('0x167')];}else{_0x4ca6a6=this['getVoiceQueue'][_0x744c('0x70')](this,_0x3a2f6c[_0x744c('0x167')]);if(!_0x4ca6a6){return this['channel'][_0x744c('0x2d')](_0x3a2f6c,_0x744c('0x169'));}}var _0x16df77='';if(this[_0x744c('0x83')](_0x3a2f6c[_0x744c('0x10d')])){var _0x4fafe6=this[_0x744c('0x15d')]['sync'](this,_0x3a2f6c[_0x744c('0x10d')]);if(_0x4fafe6){_0x16df77=_0x4fafe6;}}this[_0x744c('0x38')][_0x744c('0x70')](this,_0x3a2f6c,_0x4ca6a6);if(_0x3a2f6c[_0x744c('0x10a')][_0x744c('0x16a')]('x')<0x0){_0x3a2f6c['opts']+='x';}if(_0x3a2f6c[_0x744c('0x10a')][_0x744c('0x16a')]('X')<0x0){_0x3a2f6c[_0x744c('0x10a')]+='X';}this[_0x744c('0xf')][_0x744c('0xa2')](_0x744c('0x16b'),_0x4ca6a6?_0x4ca6a6[_0x744c('0x16c')]():'');var _0x12f28a=this[_0x744c('0xf')][_0x744c('0x5a')](_0x744c('0x16d'),[_0x4ca6a6,_0x3a2f6c[_0x744c('0x10a')],_0x3a2f6c['url'],_0x16df77,_0x3a2f6c[_0x744c('0x66')],_0x3a2f6c[_0x744c('0x6')],_0x3a2f6c[_0x744c('0x16e')],_0x3a2f6c['gosub'],'',_0x3a2f6c[_0x744c('0x16f')]]);if(_0x12f28a[_0x744c('0xb0')]===-0x1){return _0x12f28a;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xca'),'QUEUE',_0x4ca6a6));};AGIVertices[_0x744c('0x15')][_0x744c('0x170')]=function(_0x44ec16){logger['info'](util[_0x744c('0x55')](_0x744c('0x171'),_0x44ec16[_0x744c('0x39')]));var _0x1c52c5=_0x44ec16[_0x744c('0x172')]||'wav';var _0x23e949=util[_0x744c('0x55')](_0x744c('0x173'),this[_0x744c('0xf')][_0x744c('0x3d')],rs[_0x744c('0x114')](0x5));var _0x574aa5=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x23e949,_0x1c52c5);var _0x1d9108=util[_0x744c('0x55')]('%s/recordings/%s',FILES_PATH,_0x23e949);this[_0x744c('0x3c')][_0x744c('0x70')](this,_0x44ec16,_0x23e949,_0x574aa5);this[_0x744c('0xf')][_0x744c('0xa2')](_0x744c('0x174'),_0x23e949);logger[_0x744c('0x2f')](_0x744c('0x175'),_0x1d9108,_0x1c52c5,_0x44ec16[_0x744c('0x176')],_0x44ec16[_0x744c('0x66')]);return this[_0x744c('0xf')][_0x744c('0x142')](_0x1d9108,_0x1c52c5,_0x44ec16[_0x744c('0x176')],_0x44ec16[_0x744c('0x66')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x52f62d){logger['info'](util[_0x744c('0x55')](_0x744c('0x177'),_0x52f62d['label']));if(!this[_0x744c('0x83')](_0x52f62d['url'])){return this['channel'][_0x744c('0xad')]('no\x20url\x20configured');}var _0x56a430=this['restAPI'][_0x744c('0x70')](this,_0x52f62d);logger[_0x744c('0x2f')](util[_0x744c('0x55')]('Response:',util[_0x744c('0x178')](_0x56a430,{'showHidden':![],'depth':null})));if(!this[_0x744c('0x83')](_0x52f62d[_0x744c('0xdc')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x179'));}var _0x41d018=this[_0x744c('0xa5')][_0x744c('0x70')](this,_0x52f62d[_0x744c('0xdc')]);if(!_0x41d018){return this['channel']['error'](_0x52f62d,_0x744c('0xde'));}this['channel'][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0x17a'),_0x41d018),_0x56a430[_0x744c('0x76')]?_0x56a430[_0x744c('0x76')]:_0x744c('0x17b'));this[_0x744c('0xf')][_0x744c('0xa2')](util[_0x744c('0x55')](_0x744c('0x17c'),_0x41d018),_0x56a430[_0x744c('0x77')]?_0x56a430[_0x744c('0x77')]:'OK');if(_0x56a430[_0x744c('0x6c')]){try{this[_0x744c('0x9f')](_0x56a430[_0x744c('0x6c')],_0x41d018);}catch(_0xb5991c){logger[_0x744c('0x2d')](util[_0x744c('0x55')](_0x744c('0x17d'),_0x41d018));}}return this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0x17e'),_0x41d018));};AGIVertices[_0x744c('0x15')][_0x744c('0x17f')]=function(_0x4ce233){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x180'),_0x4ce233[_0x744c('0x39')]));return this['channel'][_0x744c('0x181')](_0x4ce233[_0x744c('0x182')][_0x744c('0x5c')](/\s+/g,''),_0x4ce233[_0x744c('0x176')]);};AGIVertices[_0x744c('0x15')]['saynumber']=function(_0x4b208c){logger[_0x744c('0x2f')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4b208c['label']));return this[_0x744c('0xf')][_0x744c('0x183')](_0x4b208c[_0x744c('0x67')][_0x744c('0x5c')](/\s+/g,''),_0x4b208c['escape_digits']);};AGIVertices['prototype'][_0x744c('0x184')]=function(_0x500b54){logger[_0x744c('0x2f')](util[_0x744c('0x55')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x500b54[_0x744c('0x39')]));return this[_0x744c('0xf')]['sayPhonetic'](_0x500b54[_0x744c('0x5e')],_0x500b54[_0x744c('0x176')]);};AGIVertices[_0x744c('0x15')][_0x744c('0x185')]=function(_0x19d823){logger[_0x744c('0x2f')](util['format'](_0x744c('0x186'),_0x19d823[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x19d823[_0x744c('0x187')])){return this['channel'][_0x744c('0xad')]('no\x20mail\x20account\x20configured');}var _0x1163d6=this[_0x744c('0x22')][_0x744c('0x70')](this,_0x19d823[_0x744c('0x187')]);if(!_0x1163d6||!_0x1163d6[_0x744c('0x188')]){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x19d823,_0x744c('0x189'));}var _0x3d226c={'from':util['format'](_0x744c('0x18a'),_0x1163d6[_0x744c('0x13')],_0x1163d6[_0x744c('0x18b')]||_0x1163d6['Smtp']['user']),'to':_0x19d823['to']||'','cc':_0x19d823['cc']||'','bcc':_0x19d823[_0x744c('0x18c')]||'','subject':_0x19d823['subject'],'html':_0x19d823[_0x744c('0x5e')],'text':_0x19d823['text']};var _0x3d94e4={'tls':{'rejectUnauthorized':![]}};if(_0x1163d6['Smtp']['service']){_0x3d94e4[_0x744c('0x18d')]=_0x1163d6[_0x744c('0x188')][_0x744c('0x18d')];}else{_0x3d94e4[_0x744c('0x18e')]=_0x1163d6[_0x744c('0x188')][_0x744c('0x18e')];_0x3d94e4[_0x744c('0x18f')]=_0x1163d6[_0x744c('0x188')]['port'];_0x3d94e4[_0x744c('0x190')]=_0x1163d6[_0x744c('0x188')][_0x744c('0x190')];}if(_0x1163d6['Smtp'][_0x744c('0x191')]){_0x3d94e4[_0x744c('0x192')]={'user':_0x1163d6[_0x744c('0x188')][_0x744c('0x193')],'pass':_0x1163d6[_0x744c('0x188')][_0x744c('0x194')]};}if(this['isConfigured'](_0x19d823[_0x744c('0x195')])){}logger[_0x744c('0x196')](_0x744c('0x197'),JSON[_0x744c('0x75')](_0x3d226c));this['createSquareDetailsReport']['sync'](this,_0x19d823,_0x19d823['account_id']);this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x198'),_0x1163d6['name']));this[_0x744c('0x24')][_0x744c('0x70')](this,_0x3d94e4,_0x3d226c);return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x199'));};AGIVertices[_0x744c('0x15')][_0x744c('0x19a')]=function(_0x247e73){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x19b'),_0x247e73[_0x744c('0x39')]));return this[_0x744c('0xf')][_0x744c('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x744c('0x15')][_0x744c('0x19c')]=function(_0x53eadb){logger[_0x744c('0x2f')](util['format'](_0x744c('0x19d'),_0x53eadb[_0x744c('0x39')]));if(!this['isConfigured'](_0x53eadb[_0x744c('0x19e')])){return this[_0x744c('0xf')]['noop']('no\x20sms\x20account\x20configured');}var _0x7e66dd=this['getSmsAccount']['sync'](this,_0x53eadb[_0x744c('0x19e')]);if(!_0x7e66dd){return this['channel']['error'](_0x53eadb,_0x744c('0x19f'));}var _0x18377e={'body':_0x53eadb[_0x744c('0x1a0')],'phone':_0x53eadb['to']||'','SmsAccountId':_0x7e66dd['id']};logger[_0x744c('0x196')](_0x744c('0x1a1'),JSON[_0x744c('0x75')](_0x18377e));this[_0x744c('0x38')][_0x744c('0x70')](this,_0x53eadb,_0x53eadb[_0x744c('0x19e')]);this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x1a2'),_0x7e66dd[_0x744c('0x13')]));this[_0x744c('0x37')][_0x744c('0x70')](this,_0x18377e);return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x1a3'));};AGIVertices[_0x744c('0x15')][_0x744c('0x1a4')]=function(_0x46bf12){logger[_0x744c('0x2f')](util['format'](_0x744c('0x1a5'),_0x46bf12[_0x744c('0x39')]));if(!this[_0x744c('0x83')](_0x46bf12[_0x744c('0xdc')])){return this[_0x744c('0xf')]['error'](_0x46bf12,_0x744c('0x1a6'));}var _0x1dc6c5=this[_0x744c('0xa5')][_0x744c('0x70')](this,_0x46bf12[_0x744c('0xdc')]);if(!_0x1dc6c5){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x46bf12,'no\x20variable\x20found');}return this[_0x744c('0xf')]['setVariable'](_0x1dc6c5,_0x46bf12[_0x744c('0x1a7')]);};AGIVertices['prototype']['start']=function(_0x55b386){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x1a8'),_0x55b386['label']));this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x1a9'));if(_0x55b386[_0x744c('0xbf')]===_0x744c('0x1aa')){this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x1ab'));return this[_0x744c('0xf')][_0x744c('0xbf')]();}return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x1ac'));};AGIVertices[_0x744c('0x15')][_0x744c('0x1ad')]=function(_0x1c55c5){logger[_0x744c('0x2f')](util['format'](_0x744c('0x1ae'),_0x1c55c5[_0x744c('0x39')]));if(!this['isConfigured'](_0x1c55c5[_0x744c('0x1af')])){return this['channel']['error'](_0x1c55c5,_0x744c('0x1b0'));}var _0x4ef7ec=this['getSquareProject'][_0x744c('0x70')](this,_0x1c55c5['project_id']);if(!this[_0x744c('0x83')](_0x4ef7ec)){return this[_0x744c('0xf')]['error'](_0x1c55c5,util['format'](_0x744c('0x1b1'),_0x1c55c5[_0x744c('0x1af')]));}if(_0x4ef7ec===this[_0x744c('0xf')][_0x744c('0x3a')]){return this['channel'][_0x744c('0x2d')](_0x1c55c5,_0x744c('0x1b2'));}this['createSquareDetailsReport']['sync'](this,_0x1c55c5,_0x4ef7ec);var _0x2fc0d2=this[_0x744c('0xf')]['exec'](_0x744c('0x1b3'),util[_0x744c('0x55')](_0x744c('0x1b4'),config[_0x744c('0x6')]['host']||_0x744c('0x1b5'),_0x4ef7ec,this[_0x744c('0xf')][_0x744c('0x3a')]));if(_0x2fc0d2['result']===-0x1){return _0x2fc0d2;}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0xca'),_0x744c('0x1b3'),_0x4ef7ec));};AGIVertices[_0x744c('0x15')][_0x744c('0x1b6')]=function(_0x38247c){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x1b7'),_0x38247c[_0x744c('0x39')]));var _0x280e71=this[_0x744c('0x59')][_0x744c('0x70')](this,_0x38247c[_0x744c('0xbd')]);this['createSquareDetailsReport']['sync'](this,_0x38247c,_0x38247c[_0x744c('0xbd')]);if(this['isConfigured'](_0x38247c[_0x744c('0xdc')])){var _0x2fd581=this['getVariable'][_0x744c('0x70')](this,_0x38247c['variable_id']);if(_0x2fd581){this[_0x744c('0xf')][_0x744c('0xa2')](_0x2fd581,_0x280e71);return this[_0x744c('0xf')][_0x744c('0xad')](util['format'](_0x744c('0x1b8'),_0x38247c[_0x744c('0xbd')],_0x2fd581));}}return this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x1b9'),_0x38247c[_0x744c('0xbd')]));};AGIVertices[_0x744c('0x15')][_0x744c('0x1ba')]=function(_0x1c982e){logger['info'](util[_0x744c('0x55')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1c982e['label']));_0x1c982e['text']=_0x1c982e['text'][_0x744c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x744c('0x83')](_0x1c982e[_0x744c('0x1bb')])){return this[_0x744c('0xf')][_0x744c('0xad')](_0x744c('0x1bc'));}if(!this[_0x744c('0x83')](_0x1c982e[_0x744c('0x5e')])){return this[_0x744c('0xf')][_0x744c('0xad')]('no\x20text\x20configured');}this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x1bd'),_0x1c982e['text']));var _0x14fddb=this['googleCloudTTS'][_0x744c('0x70')](this,_0x1c982e);if(_0x14fddb){this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x14fddb));var _0x486c35=this[_0x744c('0xf')][_0x744c('0x149')](_0x14fddb);try{fs['unlink'](_0x14fddb+_0x744c('0x101'));}catch(_0x540f06){logger['error'](_0x540f06);}return _0x486c35;}return this[_0x744c('0xf')][_0x744c('0x2d')](_0x1c982e,_0x744c('0x1be'));};AGIVertices['prototype'][_0x744c('0x1bf')]=function(_0x35d042){logger[_0x744c('0x2f')](util[_0x744c('0x55')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x35d042['label']));_0x35d042[_0x744c('0x5e')]=_0x35d042[_0x744c('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x744c('0x83')](_0x35d042[_0x744c('0x5e')])){return this[_0x744c('0xf')][_0x744c('0xad')]('no\x20text\x20configured');}this[_0x744c('0xf')]['noop'](util[_0x744c('0x55')](_0x744c('0x1c0'),_0x35d042['text']));var _0x3bcea8=this[_0x744c('0x1c1')][_0x744c('0x70')](this,_0x35d042);if(_0x3bcea8){this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x1c2'),_0x3bcea8));var _0x53a6c6=this[_0x744c('0xf')][_0x744c('0x149')](_0x3bcea8);try{fs['unlink'](_0x3bcea8+_0x744c('0x101'));}catch(_0x2fac1a){logger[_0x744c('0x2d')](_0x2fac1a);}return _0x53a6c6;}return this[_0x744c('0xf')][_0x744c('0x2d')](_0x35d042,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x744c('0x15')][_0x744c('0x1c3')]=function(_0xab54a0){logger['info'](util[_0x744c('0x55')](_0x744c('0x1c4'),_0xab54a0['label']));if(!this[_0x744c('0x83')](_0xab54a0[_0x744c('0x14d')])){return this['channel']['error'](_0xab54a0,'no\x20find\x20by\x20configured');}logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x14f'),this[_0x744c('0xf')][_0x744c('0x3b')],_0xab54a0[_0x744c('0x14d')]));var _0x43b55f=this[_0x744c('0x52')][_0x744c('0x70')](this,_0xab54a0[_0x744c('0x14d')]);if(_0x43b55f){logger[_0x744c('0x2f')](util[_0x744c('0x55')](_0x744c('0x150'),this[_0x744c('0xf')][_0x744c('0x3b')],_0xab54a0[_0x744c('0x14d')]));this[_0x744c('0xf')][_0x744c('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x744c('0xf')]['callerid'],_0xab54a0[_0x744c('0x14d')]));return{'code':0xc8,'result':_0x744c('0x151')};}else{logger['info'](util[_0x744c('0x55')](_0x744c('0x152'),this[_0x744c('0xf')][_0x744c('0x3b')],_0xab54a0[_0x744c('0x14d')]));this[_0x744c('0xf')][_0x744c('0xad')](util[_0x744c('0x55')](_0x744c('0x152'),this[_0x744c('0xf')][_0x744c('0x3b')],_0xab54a0[_0x744c('0x14d')]));return{'code':0xc8,'result':_0x744c('0x153')};}};AGIVertices[_0x744c('0x15')]['voicemail']=function(_0x185721){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x185721[_0x744c('0x39')]));var _0x216490=this[_0x744c('0xf')]['exec'](_0x744c('0x1c5'),[_0x185721['mailbox'],_0x185721[_0x744c('0x79')]]);if(_0x216490[_0x744c('0xb0')]===-0x1){return _0x216490;}return this[_0x744c('0xf')][_0x744c('0xad')](util['format'](_0x744c('0xca'),_0x744c('0x1c5'),_0x185721['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x2449d9){logger[_0x744c('0x2f')](util['format'](_0x744c('0x1c6'),_0x2449d9[_0x744c('0x39')]));if(!this['isConfigured'](_0x2449d9[_0x744c('0xdc')])){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x2449d9,_0x744c('0x1a6'));}var _0x1e94f4=this[_0x744c('0xa5')][_0x744c('0x70')](this,_0x2449d9[_0x744c('0xdc')]);if(!_0x1e94f4){return this[_0x744c('0xf')][_0x744c('0x2d')](_0x2449d9,_0x744c('0xde'));}var _0x4fe1e3=this['channel'][_0x744c('0xa5')](_0x1e94f4);return{'code':0xc8,'result':_0x4fe1e3[_0x744c('0xa6')]?_0x4fe1e3[_0x744c('0xa6')]:'-'};};String[_0x744c('0x15')][_0x744c('0xa4')]=function(_0x28d92a,_0x5a725d){return this['split'](_0x28d92a)[_0x744c('0x1c7')](_0x5a725d);};module[_0x744c('0x1c8')]=AGIVertices; \ No newline at end of file +var _0xb0d2=['getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','body','parse','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isArray','isString','saveRestApiResult','isPlainObject','%s.%s','length','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','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','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','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','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','user','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x4d475c,_0x13e67a){_0x4d475c=_0x4d475c-0x0;var _0x840c43=_0xb0d2[_0x4d475c];return _0x840c43;};'use strict';var fs=require('fs');var path=require(_0x2b0d('0x0'));var util=require('util');var _=require(_0x2b0d('0x1'));var sh=require(_0x2b0d('0x2'));var odbc=require(_0x2b0d('0x3'))();var rs=require('randomstring');var moment=require(_0x2b0d('0x4'));var Mustache=require(_0x2b0d('0x5'));var rp=require(_0x2b0d('0x6'));var logger=require(_0x2b0d('0x7'))(_0x2b0d('0x8'));var config=require('../../config/environment');var scripts=require(_0x2b0d('0x9'));var FILES_PATH=_0x2b0d('0xa');var recursiveMapAttributes=[_0x2b0d('0xb'),_0x2b0d('0xc')];var verticesWithRetry=[_0x2b0d('0xd'),_0x2b0d('0xe'),_0x2b0d('0xf')];var AGIVertices=function(_0x3de0a3,_0x86063,_0x2fff5e){this['channel']=_0x3de0a3;this[_0x2b0d('0x10')]=_0x86063;this['mailRpc']=_0x2fff5e;};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x12')]=function(_0x19d73a,_0x5c83ce){this[_0x2b0d('0x10')][_0x2b0d('0x13')](_0x19d73a)[_0x2b0d('0x14')](function(_0x1a20c7){_0x5c83ce(null,_0x1a20c7?_0x1a20c7[_0x2b0d('0x15')]:![]);})[_0x2b0d('0x16')](function(_0x380fb1){_0x5c83ce(_0x380fb1);});};AGIVertices[_0x2b0d('0x11')]['getVoiceQueue']=function(_0x131e68,_0x234bad){this['rpc'][_0x2b0d('0x17')](_0x131e68)[_0x2b0d('0x14')](function(_0x59b69a){_0x234bad(null,_0x59b69a?_0x59b69a[_0x2b0d('0x15')]:![]);})[_0x2b0d('0x16')](function(_0x3d9de2){_0x234bad(_0x3d9de2);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x18')]=function(_0x2baa86,_0x432396){this[_0x2b0d('0x10')][_0x2b0d('0x19')](_0x2baa86)[_0x2b0d('0x14')](function(_0x576093){_0x432396(null,_0x576093?_0x576093[_0x2b0d('0x15')]:![]);})['catch'](function(_0x338f5b){_0x432396(_0x338f5b);});};AGIVertices['prototype'][_0x2b0d('0x1a')]=function(_0x4cb145,_0x3e802){this[_0x2b0d('0x10')][_0x2b0d('0x1b')](_0x4cb145)[_0x2b0d('0x14')](function(_0xa3ea6d){_0x3e802(null,_0xa3ea6d?_0xa3ea6d[_0x2b0d('0x1c')]:![]);})['catch'](function(_0x5d6746){_0x3e802(_0x5d6746);});};AGIVertices[_0x2b0d('0x11')]['getUser']=function(_0x13ad09,_0x47d1b9){this['rpc'][_0x2b0d('0x1d')](_0x13ad09)[_0x2b0d('0x14')](function(_0x9f0dc){_0x47d1b9(null,_0x9f0dc?_0x9f0dc['name']:![]);})[_0x2b0d('0x16')](function(_0x38b758){_0x47d1b9(_0x38b758);});};AGIVertices[_0x2b0d('0x11')]['getTrunk']=function(_0x208f93,_0x41d685){this[_0x2b0d('0x10')][_0x2b0d('0x1e')](_0x208f93)[_0x2b0d('0x14')](function(_0x5f48f3){_0x41d685(null,_0x5f48f3?_0x5f48f3['name']:![]);})[_0x2b0d('0x16')](function(_0x4609a5){_0x41d685(_0x4609a5);});};AGIVertices['prototype'][_0x2b0d('0x1f')]=function(_0x1ac57e,_0x4669af){var _0x4eb90e=this;this[_0x2b0d('0x10')][_0x2b0d('0x20')](_0x1ac57e)[_0x2b0d('0x14')](function(_0xbfcb81){_0x4669af(null,_0xbfcb81?_0x4eb90e[_0x2b0d('0x21')](_0xbfcb81['save_name']):![]);})[_0x2b0d('0x16')](function(_0x1204eb){_0x4669af(_0x1204eb);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x22')]=function(_0x398393,_0xa2a0b6){this[_0x2b0d('0x10')][_0x2b0d('0x23')](_0x398393)[_0x2b0d('0x14')](function(_0x1191f9){_0xa2a0b6(null,_0x1191f9?_0x1191f9:![]);})[_0x2b0d('0x16')](function(_0x495f36){_0xa2a0b6(_0x495f36);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x24')]=function(_0x5d95f0,_0x1bb0ac,_0x5c209a){this[_0x2b0d('0x25')][_0x2b0d('0x24')](_0x5d95f0,_0x1bb0ac)['then'](function(){_0x5c209a(null);})[_0x2b0d('0x16')](function(_0x4355db){_0x5c209a(_0x4355db);});};AGIVertices['prototype'][_0x2b0d('0x26')]=function(_0xb73c06,_0x3d193a){this[_0x2b0d('0x10')]['getIntervalById'](_0xb73c06)[_0x2b0d('0x14')](function(_0x1444be){if(_0x1444be){if(_0x1444be['IntervalId']){_0x3d193a(null,[_0x1444be[_0x2b0d('0x27')]]);}else{_0x3d193a(null,_[_0x2b0d('0x28')](_0x1444be['Intervals'],_0x2b0d('0x27')));}}else{_0x3d193a(null,![]);}})[_0x2b0d('0x16')](function(_0x5297e1){_0x3d193a(_0x5297e1);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x21')]=function(_0x2a8164){return util[_0x2b0d('0x29')](_0x2b0d('0x2a'),FILES_PATH,_0x2a8164);};AGIVertices['prototype'][_0x2b0d('0x2b')]=function(_0x35ad06,_0x3a0764,_0x3979a2){odbc['open'](_0x35ad06,function(_0x48f29d){if(_0x48f29d){logger[_0x2b0d('0x2c')](_0x2b0d('0x2d'),_0x48f29d);_0x3979a2(_0x48f29d);}else{logger[_0x2b0d('0x2e')](_0x2b0d('0x2f'));odbc[_0x2b0d('0x30')](_0x3a0764,function(_0x5f1ef4,_0x2c7ed9){if(_0x5f1ef4){logger['info'](_0x2b0d('0x31'),_0x3a0764);_0x3979a2(_0x5f1ef4);}else{logger[_0x2b0d('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x3a0764);odbc['close'](function(_0x543360){if(_0x543360){logger[_0x2b0d('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x543360);}_0x3979a2(null,_0x2c7ed9);});}});}});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x32')]=function(_0xf81520,_0x53c0fc){this['rpc'][_0x2b0d('0x33')](_0xf81520)[_0x2b0d('0x14')](function(_0x17cfe1){_0x53c0fc(null,_0x17cfe1?_0x17cfe1:![]);})[_0x2b0d('0x16')](function(_0x39daa6){_0x53c0fc(_0x39daa6);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x34')]=function(_0x1cd205,_0x435453){this[_0x2b0d('0x10')][_0x2b0d('0x34')](_0x1cd205)[_0x2b0d('0x14')](function(_0x173bd9){_0x435453(null,_0x173bd9);})[_0x2b0d('0x16')](function(_0x51223e){_0x435453(_0x51223e);});};AGIVertices['prototype'][_0x2b0d('0x35')]=function(_0x123e07,_0x3e27b1,_0x22988d){this[_0x2b0d('0x10')][_0x2b0d('0x35')]({'uniqueid':this[_0x2b0d('0x36')]['uniqueid'],'node':_0x123e07[_0x2b0d('0x37')],'application':_0x123e07[_0x2b0d('0x38')],'data':_0x3e27b1||null,'project_name':this[_0x2b0d('0x36')][_0x2b0d('0x39')],'callerid':this[_0x2b0d('0x36')][_0x2b0d('0x3a')]})[_0x2b0d('0x14')](function(_0x45c8d0){if(_0x22988d){_0x22988d(null,_0x45c8d0);}})[_0x2b0d('0x16')](function(_0x3e982e){if(_0x22988d){_0x22988d(_0x3e982e);}});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x3b')]=function(_0x46baa1,_0x54464c,_0x2fb60e,_0x49965c){this[_0x2b0d('0x10')][_0x2b0d('0x3b')]({'uniqueid':this[_0x2b0d('0x36')][_0x2b0d('0x3c')],'callerid':this[_0x2b0d('0x36')][_0x2b0d('0x3a')],'calleridname':this[_0x2b0d('0x36')]['calleridname'],'context':this[_0x2b0d('0x36')][_0x2b0d('0x3d')],'extension':this[_0x2b0d('0x36')][_0x2b0d('0x3e')],'priority':this[_0x2b0d('0x36')][_0x2b0d('0x3f')],'accountcode':this[_0x2b0d('0x36')][_0x2b0d('0x40')],'dnid':this[_0x2b0d('0x36')][_0x2b0d('0x41')],'projectName':this[_0x2b0d('0x36')][_0x2b0d('0x39')],'saveName':_0x54464c,'filename':_0x46baa1[_0x2b0d('0x42')]||_0x54464c,'savePath':_0x2fb60e})[_0x2b0d('0x14')](function(_0x3934d3){_0x49965c(null,_0x3934d3);})[_0x2b0d('0x16')](function(_0x545930){_0x49965c(_0x545930);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x43')]=function(_0x4d205b,_0x408754,_0x3b685b){this[_0x2b0d('0x10')][_0x2b0d('0x43')]({'uniqueid':this[_0x2b0d('0x36')][_0x2b0d('0x3c')],'body':_0x4d205b,'direction':_0x408754})['then'](function(_0x490425){if(_0x3b685b){_0x3b685b(null,_0x490425);}})[_0x2b0d('0x16')](function(_0x11237b){if(_0x3b685b){_0x3b685b(_0x11237b);}});};AGIVertices['prototype'][_0x2b0d('0x44')]=function(_0x452273,_0x4fe9fd){this[_0x2b0d('0x10')][_0x2b0d('0x44')]({'firstName':_[_0x2b0d('0x45')](_0x452273[_0x2b0d('0x15')])||_[_0x2b0d('0x46')](_0x452273[_0x2b0d('0x15')])?_0x2b0d('0x47')+Math[_0x2b0d('0x48')]():_0x452273['name'],'lastName':_['isEmpty'](_0x452273['lastName'])||_[_0x2b0d('0x46')](_0x452273[_0x2b0d('0x49')])?null:_0x452273[_0x2b0d('0x49')],'phone':_0x452273['phone'],'ListId':_0x452273[_0x2b0d('0x4a')],'scheduledat':_0x452273[_0x2b0d('0x4b')],'callbackUniqueid':this[_0x2b0d('0x36')][_0x2b0d('0x3c')],'tags':_0x2b0d('0x4c'),'description':_0x2b0d('0x4d')+_0x452273[_0x2b0d('0x4b')][_0x2b0d('0x4e')](),'priority':_0x452273[_0x2b0d('0x4f')]})[_0x2b0d('0x14')](function(_0x4d7213){_0x4fe9fd(null,_0x4d7213);})['catch'](function(_0x5e7987){_0x4fe9fd(_0x5e7987);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x50')]=function(_0x1054a3,_0x528f73){this[_0x2b0d('0x10')][_0x2b0d('0x51')](_0x1054a3)[_0x2b0d('0x14')](function(_0x4a12ab){_0x528f73(null,_0x4a12ab?_0x4a12ab[_0x2b0d('0x15')]:![]);})[_0x2b0d('0x16')](function(_0x5c9112){_0x528f73(_0x5c9112);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x52')]=function(_0x230ee7,_0x528987,_0x590600){var _0x32887e={'role':_0x2b0d('0x53')};_0x32887e[_0x230ee7]=this[_0x2b0d('0x36')]['callerid'];this[_0x2b0d('0x10')][_0x2b0d('0x52')](_0x32887e,_0x528987,this[_0x2b0d('0x36')]['uniqueid'])[_0x2b0d('0x14')](function(_0x93dd0b){_0x590600(null,_[_0x2b0d('0x46')](_0x93dd0b)?![]:!![]);})[_0x2b0d('0x16')](function(_0xf512f4){logger[_0x2b0d('0x2c')](_0xf512f4);_0x590600(null,![]);});};AGIVertices[_0x2b0d('0x11')]['agentUnpause']=function(_0x172533,_0x384847){var _0x3273cc={'role':'agent'};_0x3273cc[_0x172533]=this['channel'][_0x2b0d('0x3a')];this['rpc'][_0x2b0d('0x54')](_0x3273cc)[_0x2b0d('0x14')](function(_0x25fd98){_0x384847(null,_[_0x2b0d('0x46')](_0x25fd98)?![]:!![]);})[_0x2b0d('0x16')](function(_0x37c699){logger[_0x2b0d('0x2c')](_0x37c699);_0x384847(null,![]);});};AGIVertices[_0x2b0d('0x11')]['agentLogout']=function(_0x3d5ccf,_0x2b51d0){var _0x21e1cf={'role':_0x2b0d('0x53')};_0x21e1cf[_0x3d5ccf]=this[_0x2b0d('0x36')]['callerid'];this[_0x2b0d('0x10')][_0x2b0d('0x55')](_0x21e1cf)[_0x2b0d('0x14')](function(_0x16ab5f){_0x2b51d0(null,_['isNil'](_0x16ab5f)?![]:!![]);})[_0x2b0d('0x16')](function(_0x4cdd60){logger[_0x2b0d('0x2c')](_0x4cdd60);_0x2b51d0(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x4d5a31,_0x4154d2){var _0x3e4989={'role':_0x2b0d('0x53')};_0x3e4989[_0x4d5a31]=this[_0x2b0d('0x36')]['callerid'];var _0x527119=_0x4d5a31!=_0x2b0d('0x56')?util[_0x2b0d('0x29')](_0x2b0d('0x57'),_0x2b0d('0x58'),this['channel'][_0x2b0d('0x3a')]):undefined;this['rpc'][_0x2b0d('0x59')](_0x3e4989,_0x527119)['then'](function(_0x17539b){_0x4154d2(null,_[_0x2b0d('0x46')](_0x17539b)?![]:!![]);})['catch'](function(_0x314874){logger['error'](_0x314874);_0x4154d2(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x25f37b,_0x1dcfd1){sh[_0x2b0d('0x5a')](_[_0x2b0d('0x5b')](_0x25f37b),function(_0xf0a95a,_0x354b40){var _0x237169=_0x354b40[_0x2b0d('0x5c')](/(\r\n|\n|\r)/gm,'');_0x1dcfd1(null,_0x237169);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x5d')]=function(_0x145cc6,_0x4ca34a){scripts['googleCloudTTS'](_0x145cc6[_0x2b0d('0x5e')],_0x145cc6[_0x2b0d('0x5f')]||'text',_0x145cc6[_0x2b0d('0x60')],_0x145cc6['languageCode']||_0x2b0d('0x61'),_0x145cc6['ssmlGender']||_0x2b0d('0x62'),_0x145cc6[_0x2b0d('0x63')]||'MP3')[_0x2b0d('0x14')](function(_0x34c4e3){_0x4ca34a(null,_0x34c4e3);})['catch'](function(_0x188092){_0x4ca34a(_0x188092);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x64')]=function(_0x4c346d,_0x530fae){scripts[_0x2b0d('0x64')](_0x4c346d['text'],_0x4c346d[_0x2b0d('0x65')]||'en',0x1)[_0x2b0d('0x14')](function(_0x45b7cc){_0x530fae(null,_0x45b7cc);})[_0x2b0d('0x16')](function(_0x5d79c5){_0x530fae(_0x5d79c5);});};AGIVertices[_0x2b0d('0x11')]['restAPI']=function(_0x339805,_0x239c13){var _0x1bace2={'uri':_0x339805[_0x2b0d('0x66')],'method':_0x339805[_0x2b0d('0x67')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x339805[_0x2b0d('0x68')])===_0x2b0d('0x69')&&parseInt(_0x339805[_0x2b0d('0x68')])>=0x1?parseInt(_0x339805[_0x2b0d('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x2b0d('0x6a')]([_0x2b0d('0x6b'),_0x2b0d('0x6c')],_0x1bace2['method']['toUpperCase']())){try{_0x1bace2[_0x2b0d('0x6d')]=_0x339805[_0x2b0d('0xc')]?JSON[_0x2b0d('0x6e')](_0x339805['rawBody']):{};}catch(_0x1f5c84){logger[_0x2b0d('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f5c84);}}try{_0x1bace2[_0x2b0d('0x6f')]=_0x339805['rawHeaders']?JSON['parse'](_0x339805[_0x2b0d('0xb')]):{};}catch(_0x124cf0){logger[_0x2b0d('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x124cf0);}if(_0x339805['computedVariables']){try{var _0x295fbd=require(_0x339805[_0x2b0d('0x70')])[_0x2b0d('0x71')](this,_0x1bace2);_0x1bace2[_0x2b0d('0x72')]=Mustache[_0x2b0d('0x73')](_0x339805[_0x2b0d('0x66')],_0x295fbd,{},['$$','$$']);if(_0x1bace2[_0x2b0d('0x6f')]){_0x1bace2[_0x2b0d('0x6f')]=JSON['parse'](Mustache[_0x2b0d('0x73')](JSON[_0x2b0d('0x74')](_0x1bace2['headers']),_0x295fbd,{},['$$','$$']));}if(_0x1bace2[_0x2b0d('0x6d')]){_0x1bace2[_0x2b0d('0x6d')]=JSON[_0x2b0d('0x6e')](Mustache[_0x2b0d('0x73')](JSON[_0x2b0d('0x74')](_0x1bace2[_0x2b0d('0x6d')]),_0x295fbd,{},['$$','$$']));}}catch(_0x39bb20){logger[_0x2b0d('0x2c')](_0x2b0d('0x75'),_0x39bb20);}}rp(_0x1bace2)[_0x2b0d('0x14')](function(_0x768aea){var _0x10be8d={'statusCode':_0x768aea[_0x2b0d('0x76')]||0xc8,'statusMessage':_0x768aea[_0x2b0d('0x77')]||'OK','headers':_0x768aea[_0x2b0d('0x6f')]||{},'body':_0x768aea[_0x2b0d('0x6d')]||{}};_0x239c13(null,_0x10be8d);})[_0x2b0d('0x16')](function(_0x1dae9c){var _0x1762c7={'statusCode':_0x1dae9c[_0x2b0d('0x76')]||0x1f4,'statusMessage':_0x1dae9c[_0x2b0d('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1dae9c[_0x2b0d('0x79')][_0x2b0d('0x6f')]||{},'body':_0x1dae9c[_0x2b0d('0x79')][_0x2b0d('0x6d')]||{}};_0x239c13(null,_0x1762c7);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x7a')]=function(_0x243cb6,_0x244169){scripts[_0x2b0d('0x7a')](this[_0x2b0d('0x36')][_0x2b0d('0x3c')],_0x243cb6['key'],_0x243cb6[_0x2b0d('0x60')],_0x243cb6[_0x2b0d('0x7b')]||'en')['then'](function(_0x2089f4){_0x244169(null,_0x2089f4);})[_0x2b0d('0x16')](function(_0x37ecef){_0x244169(_0x37ecef);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x7c')]=function(_0x35d232,_0x56c8a8){scripts[_0x2b0d('0x7c')](this[_0x2b0d('0x36')],_0x35d232)['then'](function(_0x3f1a52){_0x56c8a8(null,_0x3f1a52);})[_0x2b0d('0x16')](function(_0x150781){_0x56c8a8(_0x150781);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x7d')]=function(_0x24112c,_0xbea9d9){scripts[_0x2b0d('0x7d')](_0x24112c[_0x2b0d('0x7e')],_0x24112c[_0x2b0d('0x60')],_0x24112c[_0x2b0d('0x7f')]||_0x2b0d('0x61'),_0x24112c[_0x2b0d('0x80')])[_0x2b0d('0x14')](function(_0x943de9){_0xbea9d9(null,_0x943de9);})['catch'](function(_0xfdbb18){_0xbea9d9(_0xfdbb18);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x81')]=function(_0x469ddf,_0x2d9c46,_0x565a11){scripts['ispeechASR'](_0x2d9c46,_0x469ddf[_0x2b0d('0x7e')],_0x469ddf[_0x2b0d('0x82')]||_0x2b0d('0x61'),this[_0x2b0d('0x83')](_0x469ddf[_0x2b0d('0x84')])?_0x469ddf[_0x2b0d('0x84')]:undefined)[_0x2b0d('0x14')](function(_0x1dd504){_0x565a11(null,_0x1dd504);})[_0x2b0d('0x16')](function(_0x56ca1d){_0x565a11(_0x56ca1d);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x85')]=function(_0x4813b8,_0x5266db){scripts[_0x2b0d('0x85')](_0x4813b8['aws_access_key_id'],_0x4813b8[_0x2b0d('0x86')],_0x4813b8[_0x2b0d('0x87')],_0x4813b8['aws_polly_voice']||_0x2b0d('0x88'),_0x4813b8[_0x2b0d('0x60')],_0x4813b8[_0x2b0d('0x89')]||'text')[_0x2b0d('0x14')](function(_0x2241b3){_0x5266db(null,_0x2241b3);})['catch'](function(_0x49c31b){_0x5266db(_0x49c31b);});};AGIVertices[_0x2b0d('0x11')]['awsLex']=function(_0x2fe315,_0x28fb32){scripts[_0x2b0d('0x8a')](this[_0x2b0d('0x36')][_0x2b0d('0x3c')],_0x2fe315[_0x2b0d('0x8b')],_0x2fe315['aws_secret_access_key'],_0x2fe315[_0x2b0d('0x8c')],_0x2fe315[_0x2b0d('0x60')],_0x2fe315['aws_bot_name'])[_0x2b0d('0x14')](function(_0xbb0252){_0x28fb32(null,_0xbb0252);})[_0x2b0d('0x16')](function(_0x1db7fa){_0x28fb32(_0x1db7fa);});};AGIVertices['prototype'][_0x2b0d('0x8d')]=function(_0xe328df,_0x13418f,_0x55323c){scripts[_0x2b0d('0x8d')](_0x13418f,_0xe328df[_0x2b0d('0x7e')],_0xe328df['google_asr_language']||_0x2b0d('0x61'))[_0x2b0d('0x14')](function(_0x1910cd){_0x55323c(null,_0x1910cd);})[_0x2b0d('0x16')](function(_0x5cc748){_0x55323c(_0x5cc748);});};AGIVertices['prototype'][_0x2b0d('0x8e')]=function(_0x449ec0,_0x348040,_0xa14744){scripts[_0x2b0d('0x8e')](_0x348040,_0x449ec0[_0x2b0d('0x8f')],_0x449ec0[_0x2b0d('0x90')],_0x449ec0['uri'])[_0x2b0d('0x14')](function(_0x515815){_0xa14744(null,_0x515815);})[_0x2b0d('0x16')](function(_0x3a6532){_0xa14744(_0x3a6532);});};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x91')]=function(_0x54c9c5){var _0x34497f=_['includes'](verticesWithRetry,_0x54c9c5[_0x2b0d('0x38')])?_0x54c9c5:_[_0x2b0d('0x92')](_0x54c9c5);for(var _0x53bf41 in _0x34497f){if(_0x34497f[_0x2b0d('0x93')](_0x53bf41)){if(_0x34497f[_0x53bf41]&&_['isString'](_0x34497f[_0x53bf41])){if(_[_0x2b0d('0x6a')](recursiveMapAttributes,_0x53bf41)){_0x34497f[_0x53bf41]=this[_0x2b0d('0x94')](_0x34497f[_0x53bf41]);}else{_0x34497f[_0x53bf41]=this['replaceAllVariables'](_0x34497f[_0x53bf41]);}}}}return _0x34497f;};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x95')]=function(_0x34851f){for(var _0x265219 in _0x34851f){if(_0x34851f[_0x2b0d('0x93')](_0x265219)){if(_['isPlainObject'](_0x34851f[_0x265219])){this[_0x2b0d('0x95')](_0x34851f[_0x265219]);}else if(_[_0x2b0d('0x96')](_0x34851f[_0x265219])){for(var _0x10bf0e=0x0;_0x10bf0e<_0x34851f[_0x265219]['length'];_0x10bf0e++){this[_0x2b0d('0x95')](_0x34851f[_0x265219][_0x10bf0e]);}}else if(_[_0x2b0d('0x97')](_0x34851f[_0x265219])){_0x34851f[_0x265219]=this['replaceAllVariables'](_0x34851f[_0x265219]);}}}};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x98')]=function(_0x285022,_0x3f83d5){for(var _0x4dd25d in _0x285022){if(_0x285022['hasOwnProperty'](_0x4dd25d)){if(_[_0x2b0d('0x99')](_0x285022[_0x4dd25d])){if(!_[_0x2b0d('0x45')](_0x285022[_0x4dd25d])){this[_0x2b0d('0x98')](_0x285022[_0x4dd25d],util[_0x2b0d('0x29')](_0x2b0d('0x9a'),_0x3f83d5,_0x4dd25d));}}else if(_[_0x2b0d('0x96')](_0x285022[_0x4dd25d])){for(var _0x4b3d2f=0x0;_0x4b3d2f<_0x285022[_0x4dd25d][_0x2b0d('0x9b')];_0x4b3d2f++){this['saveRestApiResult'](_0x285022[_0x4dd25d][_0x4b3d2f],util[_0x2b0d('0x29')]('%s.%s',_0x3f83d5,_0x4dd25d+'['+_0x4b3d2f+']'));}}else{if(!_[_0x2b0d('0x46')](_0x285022[_0x4dd25d])){this['channel'][_0x2b0d('0x9c')](util[_0x2b0d('0x29')]('%s.%s',_0x3f83d5,_0x4dd25d),_0x285022[_0x4dd25d]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x1a8203){try{var _0x1e37b8=JSON[_0x2b0d('0x6e')](_0x1a8203);this['recursiveNodeIndex'](_0x1e37b8);return JSON['stringify'](_0x1e37b8);}catch(_0x39307a){return this[_0x2b0d('0x9d')](_0x1a8203);}};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x9d')]=function(_0xf8c3f8){var _0x5204c4=_0xf8c3f8[_0x2b0d('0x9e')]('{');for(var _0x2c878b=0x1;_0x2c878b<_0x5204c4['length'];_0x2c878b+=0x1){var _0x50c305=_0x5204c4[_0x2c878b][_0x2b0d('0x9e')]('}');if(_0x50c305[_0x2b0d('0x9b')]>0x1){_0xf8c3f8=_0xf8c3f8[_0x2b0d('0x9f')]('{'+_0x50c305[0x0]+'}',this[_0x2b0d('0x36')][_0x2b0d('0x12')](_0x50c305[0x0])[_0x2b0d('0xa0')]||_0x50c305[0x0]);}}if(_0x5204c4[_0x2b0d('0x9b')]===0x1){return _0xf8c3f8[_0x2b0d('0x4e')]();}return this[_0x2b0d('0x9d')](_0xf8c3f8);};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xa1')]=function(_0x18361d,_0x5bb6ef){var _0x25ce5d=this['channel'][_0x2b0d('0x12')](_0x18361d);if(_0x25ce5d['result']===-0x1){return _0x25ce5d;}logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0xa2'),_0x5bb6ef,_0x25ce5d[_0x2b0d('0xa0')]));return this[_0x2b0d('0x36')][_0x2b0d('0x9c')](_0x5bb6ef,_0x25ce5d['extra']);};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x83')]=function(_0x160ba6){return _0x160ba6&&_0x160ba6!=='0'&&_0x160ba6!=='-1'&&_0x160ba6!=='';};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xa3')]=function(_0x43b285){this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x43b285,'-');_0x43b285[_0x2b0d('0xa4')]=_0x43b285[_0x2b0d('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xa5')]=function(_0xe6e6cd){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0xa6'),_0xe6e6cd[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0xe6e6cd['text'])){return this['channel'][_0x2b0d('0xa7')]('no\x20text\x20configured');}var _0x3f8ae9='\x22'+_0xe6e6cd[_0x2b0d('0x60')]+'\x22';if(this[_0x2b0d('0x83')](_0xe6e6cd[_0x2b0d('0x79')])){_0x3f8ae9+=','+_0xe6e6cd[_0x2b0d('0x79')];}var _0x3233da=this['channel'][_0x2b0d('0x5a')]('MRCPSynth',_0x3f8ae9);if(_0x3233da['result']===-0x1){return _0x3233da;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3f8ae9));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xa8')]=function(_0x1342bf){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0xa9'),_0x1342bf[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x1342bf[_0x2b0d('0xaa')])){return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0xab'));}var _0x5abb06=_0x1342bf['grammar'];if(this[_0x2b0d('0x83')](_0x1342bf[_0x2b0d('0x79')])){_0x5abb06+=','+_0x1342bf[_0x2b0d('0x79')];}var _0x83eb7a=this[_0x2b0d('0x36')][_0x2b0d('0x5a')]('MRCPRecog',_0x5abb06);if(_0x83eb7a[_0x2b0d('0xac')]===-0x1){return _0x83eb7a;}var _0x377518=this[_0x2b0d('0xa1')](_0x2b0d('0xad'),'MRCP_RECOG_CONFIDENCE');if(_0x377518['result']===-0x1){return _0x377518;}var _0x23d173=this['getAndSetVariable'](_0x2b0d('0xae'),'MRCP_RECOG_TRANSCRIPT');if(_0x23d173[_0x2b0d('0xac')]===-0x1){return _0x23d173;}var _0x21980c=this[_0x2b0d('0xa1')]('RECOG_INSTANCE()',_0x2b0d('0xaf'));if(_0x21980c[_0x2b0d('0xac')]===-0x1){return _0x21980c;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xb0'),_0x5abb06));};AGIVertices['prototype'][_0x2b0d('0x8')]=function(_0x35ee6e){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0xb1'),_0x35ee6e[_0x2b0d('0x37')]));return this[_0x2b0d('0x36')][_0x2b0d('0x8')]([_0x35ee6e[_0x2b0d('0xb2')],_0x35ee6e[_0x2b0d('0xb3')]]);};AGIVertices['prototype'][_0x2b0d('0xb4')]=function(_0x4365fe){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0xb5'),_0x4365fe[_0x2b0d('0x37')]));if(this[_0x2b0d('0x83')](_0x4365fe['timeout'])){logger['info'](util['format'](_0x2b0d('0xb6'),_0x4365fe[_0x2b0d('0x68')]));var _0x5e125a=this[_0x2b0d('0x36')]['wait'](_0x4365fe[_0x2b0d('0x68')]);if(_0x5e125a[_0x2b0d('0xac')]===-0x1){return _0x5e125a;}}return this[_0x2b0d('0x36')][_0x2b0d('0xb4')]();};AGIVertices['prototype'][_0x2b0d('0x4c')]=function(_0x491849){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0xb7'),_0x491849['label']));if(!this[_0x2b0d('0x83')](_0x491849[_0x2b0d('0x4a')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x491849,'no\x20list\x20selected');}_0x491849[_0x2b0d('0x4b')]=moment();if(this[_0x2b0d('0x83')](_0x491849[_0x2b0d('0xb8')])){_0x491849[_0x2b0d('0x4b')]=moment()['add'](_0x491849['delay'],'minutes');}if(!this[_0x2b0d('0x83')](_0x491849[_0x2b0d('0x4f')])){_0x491849[_0x2b0d('0x4f')]=0x2;}this[_0x2b0d('0x44')][_0x2b0d('0x71')](this,_0x491849);return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xb9'),_0x491849[_0x2b0d('0xba')],_0x491849[_0x2b0d('0x4a')],_0x491849[_0x2b0d('0x4b')]));};AGIVertices['prototype'][_0x2b0d('0xbb')]=function(_0x2a312c){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2a312c[_0x2b0d('0x37')]));var _0x268ab9=this[_0x2b0d('0x36')][_0x2b0d('0x5a')](_0x2a312c[_0x2b0d('0xbc')],_0x2a312c[_0x2b0d('0x79')]);if(_0x268ab9[_0x2b0d('0xac')]===-0x1){return _0x268ab9;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format'](_0x2b0d('0xbd'),_0x2a312c['application'],_0x2a312c[_0x2b0d('0x79')]));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xbe')]=function(_0x53c230){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0xbf'),_0x53c230[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x53c230[_0x2b0d('0x60')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')]('no\x20text\x20configured');}var _0x447ab0='\x22'+_0x53c230[_0x2b0d('0x60')]+'\x22';if(this['isConfigured'](_0x53c230[_0x2b0d('0x79')])){_0x447ab0+=','+_0x53c230[_0x2b0d('0x79')];}var _0x142511=this[_0x2b0d('0x36')][_0x2b0d('0x5a')](_0x2b0d('0xc0'),_0x447ab0);if(_0x142511[_0x2b0d('0xac')]===-0x1){return _0x142511;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xc1'),_0x447ab0));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xc2')]=function(_0x17717d){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0xc3'),_0x17717d[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x17717d[_0x2b0d('0x60')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')]('no\x20text\x20configured');}var _0x3bf331='\x22'+_0x17717d[_0x2b0d('0x60')]+'\x22';if(this[_0x2b0d('0x83')](_0x17717d[_0x2b0d('0x79')])){_0x3bf331+=','+_0x17717d[_0x2b0d('0x79')];}var _0x46bf56=this[_0x2b0d('0x36')][_0x2b0d('0x5a')](_0x2b0d('0xc0'),_0x3bf331);if(_0x46bf56[_0x2b0d('0xac')]===-0x1){return _0x46bf56;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xc1'),_0x3bf331));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xc4')]=function(_0x1de2e5){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0xc5'),_0x1de2e5[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x1de2e5[_0x2b0d('0xaa')])){return this[_0x2b0d('0x36')]['noop']('no\x20grammar\x20configured');}var _0x4e4fe5=_0x1de2e5[_0x2b0d('0xaa')];if(this['isConfigured'](_0x1de2e5[_0x2b0d('0x79')])){_0x4e4fe5+=','+_0x1de2e5[_0x2b0d('0x79')];}var _0x59d1a0=this['channel'][_0x2b0d('0x5a')](_0x2b0d('0xc6'),_0x4e4fe5);if(_0x59d1a0[_0x2b0d('0xac')]===-0x1){return _0x59d1a0;}var _0x1dafbb=this[_0x2b0d('0xa1')](_0x2b0d('0xad'),_0x2b0d('0xc7'));if(_0x1dafbb[_0x2b0d('0xac')]===-0x1){return _0x1dafbb;}var _0x2b9092=this[_0x2b0d('0xa1')]('RECOG_INPUT()',_0x2b0d('0xc8'));if(_0x2b9092[_0x2b0d('0xac')]===-0x1){return _0x2b9092;}var _0x1eebdf=this[_0x2b0d('0xa1')](_0x2b0d('0xc9'),_0x2b0d('0xca'));if(_0x1eebdf[_0x2b0d('0xac')]===-0x1){return _0x1eebdf;}return this[_0x2b0d('0x36')]['noop'](util['format'](_0x2b0d('0xb0'),_0x4e4fe5));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xcb')]=function(_0x3dc50a){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0xcc'),_0x3dc50a[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x3dc50a['grammar'])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')]('no\x20grammar\x20configured');}var _0x32a673=_0x3dc50a[_0x2b0d('0xaa')];if(this['isConfigured'](_0x3dc50a['options'])){_0x32a673+=','+_0x3dc50a[_0x2b0d('0x79')];}var _0x5e8dda=this['channel'][_0x2b0d('0x5a')](_0x2b0d('0xc6'),_0x32a673);if(_0x5e8dda[_0x2b0d('0xac')]===-0x1){return _0x5e8dda;}var _0x1f3082=this['getAndSetVariable'](_0x2b0d('0xad'),_0x2b0d('0xcd'));if(_0x1f3082[_0x2b0d('0xac')]===-0x1){return _0x1f3082;}var _0x3f32fe=this[_0x2b0d('0xa1')](_0x2b0d('0xae'),'SESTEK_ASR_TRANSCRIPT');if(_0x3f32fe[_0x2b0d('0xac')]===-0x1){return _0x3f32fe;}var _0x58d978=this['getAndSetVariable'](_0x2b0d('0xc9'),_0x2b0d('0xce'));if(_0x58d978[_0x2b0d('0xac')]===-0x1){return _0x58d978;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x32a673));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xcf')]=function(_0xff9ef7){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xff9ef7[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0xff9ef7[_0x2b0d('0xd0')])){return this[_0x2b0d('0x36')]['error'](_0xff9ef7,_0x2b0d('0xd1'));}var _0xa6a20b=this[_0x2b0d('0x1a')][_0x2b0d('0x71')](this,_0xff9ef7[_0x2b0d('0xd0')]);if(!_0xa6a20b){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0xff9ef7,_0x2b0d('0xd2'));}if(!this['isConfigured'](_0xff9ef7[_0x2b0d('0x30')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0xff9ef7,'no\x20query\x20configured');}var _0x568768=_0xff9ef7[_0x2b0d('0x30')][_0x2b0d('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xd3'),_0x568768));var _0x124e39=this['getQueryOdbc'][_0x2b0d('0x71')](this,_0xa6a20b,_0x568768);this[_0x2b0d('0x35')]['sync'](this,_0xff9ef7,_0x568768);if(!this[_0x2b0d('0x83')](_0xff9ef7[_0x2b0d('0xd4')])){return this['channel'][_0x2b0d('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e4114=this[_0x2b0d('0x12')][_0x2b0d('0x71')](this,_0xff9ef7[_0x2b0d('0xd4')]);if(!_0x4e4114){return this[_0x2b0d('0x36')]['error'](_0xff9ef7,_0x2b0d('0xd5'));}var _0xbf2d02=this;_0x124e39[_0x2b0d('0xd6')](function(_0x4dde9d,_0x55fbcf){Object[_0x2b0d('0xd7')](_0x4dde9d)['forEach'](function(_0x27a02e){_0xbf2d02[_0x2b0d('0x36')]['setVariable'](util['format'](_0x2b0d('0xd8'),_0x4e4114,_0x55fbcf,_0x27a02e),_0x4dde9d[_0x27a02e]);});});this['channel']['setVariable'](util[_0x2b0d('0x29')](_0x2b0d('0xd9'),_0x4e4114),_0x124e39['length']);return this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0xda'),_0x4e4114));};AGIVertices[_0x2b0d('0x11')]['dial']=function(_0xd2b9be){logger[_0x2b0d('0xdb')](util['format'](_0x2b0d('0xdc'),_0xd2b9be['label']));if(!this[_0x2b0d('0x83')](_0xd2b9be[_0x2b0d('0xdd')])){return this[_0x2b0d('0x36')]['error'](_0xd2b9be,'no\x20user\x20selected');}var _0x2fdce4=this[_0x2b0d('0xde')]['sync'](this,_0xd2b9be[_0x2b0d('0xdd')]);if(!_0x2fdce4){return this['channel'][_0x2b0d('0x2c')](_0xd2b9be,'no\x20user\x20found');}var _0x4ef840=this['channel'][_0x2b0d('0x5a')](_0x2b0d('0xdf'),[util[_0x2b0d('0x29')](_0x2b0d('0xe0'),_0x2fdce4),_0xd2b9be[_0x2b0d('0x68')],_0xd2b9be[_0x2b0d('0xe1')],_0xd2b9be[_0x2b0d('0x66')]]);if(_0x4ef840[_0x2b0d('0xac')]===-0x1){return _0x4ef840;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xe2'),_0x2b0d('0xdf')));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xe3')]=function(_0x4dd8d8){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0xe4'),_0x4dd8d8[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x4dd8d8[_0x2b0d('0x7e')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0xe5'));}if(!this[_0x2b0d('0x83')](_0x4dd8d8['text'])){return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0xe6'));}this[_0x2b0d('0x36')]['bot']=!![];this[_0x2b0d('0x35')](_0x4dd8d8);this[_0x2b0d('0x43')](_0x4dd8d8[_0x2b0d('0x60')],'in');this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0xe7'),_0x4dd8d8[_0x2b0d('0x60')]));var _0x306315=this[_0x2b0d('0x7a')][_0x2b0d('0x71')](this,_0x4dd8d8);if(_0x306315){for(var _0x17ba2c in _0x306315){if(_0x306315[_0x2b0d('0x93')](_0x17ba2c)){this[_0x2b0d('0x36')][_0x2b0d('0x9c')](util['format'](_0x2b0d('0xe8'),_0x17ba2c[_0x2b0d('0xe9')]()),_0x306315[_0x17ba2c]);}}this[_0x2b0d('0x43')](_0x306315[_0x2b0d('0xea')],_0x2b0d('0xeb'));return this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0xec'),_0x306315[_0x2b0d('0xea')]));}return this[_0x2b0d('0x36')]['error'](_0x4dd8d8,_0x2b0d('0xed'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xee')]=function(_0xa1440e){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0xef'),_0xa1440e[_0x2b0d('0x37')]));if(!this['isConfigured'](_0xa1440e['ndauth_url'])){return this[_0x2b0d('0x36')]['noop'](_0x2b0d('0xf0'));}if(!this[_0x2b0d('0x83')](_0xa1440e[_0x2b0d('0xf1')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0xf2'));}if(!this['isConfigured'](_0xa1440e[_0x2b0d('0xf3')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0xf4'));}if(!this['isConfigured'](_0xa1440e[_0x2b0d('0xf5')])){return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0xe6'));}this['channel'][_0x2b0d('0xf6')]=!![];this[_0x2b0d('0x35')](_0xa1440e);this['createSquareMessage'](_0xa1440e[_0x2b0d('0x60')],'in');this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format'](_0x2b0d('0xf7'),_0xa1440e['text']));var _0x54d1e2=this['sestekNDA'][_0x2b0d('0x71')](this,_0xa1440e);if(_0x54d1e2){for(var _0x59c942 in _0x54d1e2){if(_0x54d1e2['hasOwnProperty'](_0x59c942)){this[_0x2b0d('0x36')][_0x2b0d('0x9c')](util[_0x2b0d('0x29')](_0x2b0d('0xf8'),_0x59c942['toUpperCase']()),_0x54d1e2[_0x59c942]);}}this[_0x2b0d('0x43')](_0x54d1e2[_0x2b0d('0xea')],_0x2b0d('0xeb'));if(_0x54d1e2[_0x2b0d('0xf9')]){this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x54d1e2[_0x2b0d('0xf9')]));var _0x6de330=this['channel'][_0x2b0d('0xfa')](_0x54d1e2[_0x2b0d('0xf9')]);try{fs[_0x2b0d('0xfb')](_0x54d1e2['audiofile']+_0x2b0d('0xfc'));}catch(_0x114d20){logger[_0x2b0d('0x2c')](_0x114d20);}return _0x6de330;}else{return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xfd'),_0x54d1e2[_0x2b0d('0xea')]));}}return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0xa1440e,_0x2b0d('0xfe'));};AGIVertices['prototype'][_0x2b0d('0xff')]=function(_0x33f8e8){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x100'),_0x33f8e8['label']));return this[_0x2b0d('0x36')]['noop']('end');};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x101')]=function(_0x2efa2a){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x102'),_0x2efa2a['label']));var _0x41114e='';if(_0x2efa2a[_0x2b0d('0x103')]){if(!this[_0x2b0d('0x83')](_0x2efa2a[_0x2b0d('0x103')])){return this[_0x2b0d('0x36')]['error'](_0x2efa2a,'no\x20trunk\x20selected');}else{var _0x20c4aa=parseInt(_0x2efa2a['trunk_id'],0xa);if(isNaN(_0x20c4aa)){_0x41114e=_0x2efa2a['trunk_id'];}else{_0x41114e=this[_0x2b0d('0x104')]['sync'](this,_0x2efa2a[_0x2b0d('0x103')]);if(!_0x41114e){return this['channel'][_0x2b0d('0x2c')](_0x2efa2a,_0x2b0d('0x105'));}}}}else if(_0x2efa2a[_0x2b0d('0x106')]){_0x41114e=_0x2efa2a[_0x2b0d('0x106')];}else{return this['channel']['error'](_0x2efa2a,'no\x20trunk\x20selected');}var _0x5a7e99=this[_0x2b0d('0x36')][_0x2b0d('0x5a')]('DIAL',[util['format'](_0x2b0d('0x107'),_0x41114e,_0x2efa2a[_0x2b0d('0xba')]),_0x2efa2a[_0x2b0d('0x68')],_0x2efa2a[_0x2b0d('0xe1')],_0x2efa2a[_0x2b0d('0x66')]]);if(_0x5a7e99[_0x2b0d('0xac')]===-0x1){return _0x5a7e99;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xe2'),_0x2b0d('0xdf')));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x108')]=function(_0x1badc9){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x109'),_0x1badc9['label']));return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0x108'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xe')]=function(_0x5bd616){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x10a'),_0x5bd616[_0x2b0d('0x37')]));if(_0x5bd616[_0x2b0d('0xa4')]===0x0){return this[_0x2b0d('0xa3')](_0x5bd616);}_0x5bd616[_0x2b0d('0xa4')]-=0x1;if(!this['isConfigured'](_0x5bd616[_0x2b0d('0x10b')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x5bd616,'no\x20file\x20audio\x20selected');}var _0x22f59b=this[_0x2b0d('0x1f')][_0x2b0d('0x71')](this,_0x5bd616[_0x2b0d('0x10b')]);if(!_0x22f59b){return this[_0x2b0d('0x36')]['error'](_0x5bd616,_0x2b0d('0x10c'));}if(!this[_0x2b0d('0x83')](_0x5bd616[_0x2b0d('0xd4')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x2b0d('0x10d'));}var _0x1e2321=this[_0x2b0d('0x36')][_0x2b0d('0x10e')](_0x22f59b,_0x5bd616['response'],_0x5bd616[_0x2b0d('0x10f')]);var _0x13a75c=_0x1e2321[_0x2b0d('0xac')]?_0x1e2321[_0x2b0d('0xac')][_0x2b0d('0x4e')]():'';logger['info']('test',JSON[_0x2b0d('0x74')](_0x1e2321));if(_0x1e2321[_0x2b0d('0xac')]===-0x1){this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x5bd616,_0x13a75c);return _0x1e2321;}else if(_0x1e2321[_0x2b0d('0xa0')]===_0x2b0d('0x68')){_0x1e2321['result']=_0x13a75c[_0x2b0d('0x9b')]>=parseInt(_0x5bd616[_0x2b0d('0x110')])?'x':'i';}else{_0x1e2321[_0x2b0d('0xac')]=_0x13a75c[_0x2b0d('0x9b')]>=parseInt(_0x5bd616[_0x2b0d('0x110')])&&_0x13a75c[_0x2b0d('0x9b')]<=parseInt(_0x5bd616[_0x2b0d('0x10f')])?'x':'i';}var _0x4e44a4=this['getVariable'][_0x2b0d('0x71')](this,_0x5bd616['variable_id']);if(!_0x4e44a4){return this[_0x2b0d('0x36')]['error'](_0x5bd616,_0x2b0d('0xd5'));}this['channel'][_0x2b0d('0x9c')](_0x4e44a4,_0x13a75c);if(this['isConfigured'](_0x5bd616['hiddendigitsnum'])){var _0x175f5b=parseInt(_0x5bd616[_0x2b0d('0x111')],0xa);var _0x19fd4b=rs[_0x2b0d('0x112')]({'charset':'*','length':_0x175f5b});var _0x5673eb=_0x13a75c[_0x2b0d('0x9b')];if(_0x5673eb>0x0){if(_0x5673eb>_0x175f5b){this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x5bd616,_0x5bd616[_0x2b0d('0x113')]===_0x2b0d('0x114')?_0x19fd4b+_0x13a75c['substr'](_0x175f5b):_0x13a75c[_0x2b0d('0x115')](0x0,_0x5673eb-_0x175f5b)+_0x19fd4b);}else{this['createSquareDetailsReport'][_0x2b0d('0x71')](this,_0x5bd616,rs[_0x2b0d('0x112')]({'charset':'*','length':_0x5673eb}));}}else{this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x5bd616,'');}}else{this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x5bd616,_0x13a75c);}return _0x1e2321;};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xf')]=function(_0x140af0){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x116'),_0x140af0[_0x2b0d('0x37')]));return this[_0x2b0d('0xe')](_0x140af0);};AGIVertices['prototype']['goal']=function(_0x2bca4e){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x117'),_0x2bca4e[_0x2b0d('0x37')]));this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x2bca4e,_0x2bca4e[_0x2b0d('0x118')]);return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x119'),_0x2bca4e[_0x2b0d('0x118')]));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x11a')]=function(_0x59e83a){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x11b'),_0x59e83a[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x59e83a['aws_access_key_id'])||!this[_0x2b0d('0x83')](_0x59e83a['aws_secret_access_key'])){return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0x11c'));}if(!this[_0x2b0d('0x83')](_0x59e83a['text'])){return this['channel'][_0x2b0d('0xa7')]('no\x20text\x20configured');}this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x11d'),_0x59e83a[_0x2b0d('0x60')]));var _0xaee382=this['awsPolly'][_0x2b0d('0x71')](this,_0x59e83a);if(_0xaee382){this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format'](_0x2b0d('0x11e'),_0xaee382));var _0x593ecd=this['channel'][_0x2b0d('0xfa')](_0xaee382);try{fs[_0x2b0d('0xfb')](_0xaee382+_0x2b0d('0xfc'));}catch(_0x3767ac){logger[_0x2b0d('0x2c')](_0x3767ac);}return _0x593ecd;}return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x59e83a,_0x2b0d('0x11f'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x120')]=function(_0x5a6601){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x121'),_0x5a6601[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x5a6601[_0x2b0d('0x8b')])||!this['isConfigured'](_0x5a6601[_0x2b0d('0x86')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x11c'));}if(!this[_0x2b0d('0x83')](_0x5a6601[_0x2b0d('0x122')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x123'));}if(!this[_0x2b0d('0x83')](_0x5a6601[_0x2b0d('0x60')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0xe6'));}this[_0x2b0d('0x36')][_0x2b0d('0xf6')]=!![];this[_0x2b0d('0x35')](_0x5a6601);this[_0x2b0d('0x43')](_0x5a6601[_0x2b0d('0x60')],'in');this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x124'),_0x5a6601[_0x2b0d('0x60')]));var _0x31bd19=this[_0x2b0d('0x8a')][_0x2b0d('0x71')](this,_0x5a6601);if(_0x31bd19){for(var _0xaaed74 in _0x31bd19){if(_0x31bd19[_0x2b0d('0x93')](_0xaaed74)&&_[_0x2b0d('0x97')](_0x31bd19[_0xaaed74])){this[_0x2b0d('0x36')][_0x2b0d('0x9c')](util[_0x2b0d('0x29')]('AWS_LEX_%s',_0xaaed74[_0x2b0d('0xe9')]()),_0x31bd19[_0xaaed74]);}}if(_['isNil'](_0x31bd19[_0x2b0d('0x78')])){return this[_0x2b0d('0x36')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x2b0d('0x43')](_0x31bd19[_0x2b0d('0x78')],_0x2b0d('0xeb'));return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format'](_0x2b0d('0x125'),_0x31bd19[_0x2b0d('0x78')]));}}return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x5a6601,_0x2b0d('0x126'));};AGIVertices[_0x2b0d('0x11')]['googleasr']=function(_0x400838){logger['info'](util[_0x2b0d('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x400838[_0x2b0d('0x37')],_0x400838[_0x2b0d('0x68')]));if(!this[_0x2b0d('0x83')](_0x400838[_0x2b0d('0x7e')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0xe5'));}var _0x44ff86=_0x2b0d('0x127');var _0x19d261=util['format'](_0x2b0d('0x128'),FILES_PATH,rs[_0x2b0d('0x112')](0x4));var _0x2279a9=util['format'](_0x2b0d('0x9a'),_0x19d261,_0x44ff86);var _0x429cbf=!![];if(_0x400838[_0x2b0d('0x129')]===_0x2b0d('0x12a')){_0x429cbf=![];}var _0x5a0a2c=this[_0x2b0d('0x36')][_0x2b0d('0x12b')](_0x19d261,_0x44ff86,_0x400838[_0x2b0d('0x12c')],_0x400838[_0x2b0d('0x68')],undefined,_0x429cbf);if(_0x5a0a2c[_0x2b0d('0xac')]!==-0x1){this[_0x2b0d('0x36')]['noop'](util['format'](_0x2b0d('0x12d'),_0x2279a9));var _0x582a90=this[_0x2b0d('0x8d')][_0x2b0d('0x71')](this,_0x400838,_0x2279a9);if(_0x582a90){for(var _0x3d4d75 in _0x582a90){if(_0x582a90[_0x2b0d('0x93')](_0x3d4d75)){this[_0x2b0d('0x36')][_0x2b0d('0x9c')](util[_0x2b0d('0x29')](_0x2b0d('0x12e'),_0x3d4d75[_0x2b0d('0xe9')]()),_0x582a90[_0x3d4d75]);}}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x12f'),JSON[_0x2b0d('0x74')](_0x582a90)));}}return _0x5a0a2c;};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x130')]=function(_0x5ec149){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x131'),_0x5ec149[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x5ec149[_0x2b0d('0x8f')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x132'));}if(!this['isConfigured'](_0x5ec149['appsecret'])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x133'));}var _0x57b11b='wav';var _0x181f3b=util['format'](_0x2b0d('0x128'),FILES_PATH,rs[_0x2b0d('0x112')](0x4));var _0x5d06fe=util[_0x2b0d('0x29')](_0x2b0d('0x9a'),_0x181f3b,_0x57b11b);var _0x44abca=!![];if(_0x5ec149[_0x2b0d('0x129')]===_0x2b0d('0x12a')){_0x44abca=![];}var _0x42038a=this[_0x2b0d('0x36')]['recordFile'](_0x181f3b,_0x57b11b,_0x5ec149[_0x2b0d('0x12c')],_0x5ec149['timeout'],undefined,_0x44abca);if(_0x42038a[_0x2b0d('0xac')]!==-0x1){this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format'](_0x2b0d('0x134'),_0x5d06fe));var _0x16aed1=this[_0x2b0d('0x8e')][_0x2b0d('0x71')](this,_0x5ec149,_0x5d06fe);if(_0x16aed1){for(var _0x4689d7 in _0x16aed1){if(_0x16aed1[_0x2b0d('0x93')](_0x4689d7)){this[_0x2b0d('0x36')][_0x2b0d('0x9c')](util['format'](_0x2b0d('0x135'),_0x4689d7[_0x2b0d('0xe9')]()),_0x16aed1[_0x4689d7]);}}return this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x136'),JSON[_0x2b0d('0x74')](_0x16aed1)));}}return _0x42038a;};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x137')]=function(_0x2c83e5){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x138'),_0x2c83e5[_0x2b0d('0x37')]));return this[_0x2b0d('0x36')][_0x2b0d('0x139')](_0x2c83e5[_0x2b0d('0x3d')],_0x2c83e5[_0x2b0d('0x3e')],_0x2c83e5[_0x2b0d('0x3f')]);};AGIVertices['prototype'][_0x2b0d('0x13a')]=function(_0x58b625){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x13b'),_0x58b625[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x58b625[_0x2b0d('0x13c')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x58b625,_0x2b0d('0x13d'));}try{var _0x408b91=eval(_0x58b625['condition'])?_0x2b0d('0x13e'):_0x2b0d('0x13f');this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x140'),_0x58b625[_0x2b0d('0x13c')],_0x408b91));return{'code':0xc8,'result':_0x408b91};}catch(_0x484488){return{'code':0xc8,'result':_0x2b0d('0x13f')};}};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x141')]=function(_0x5ae847){logger[_0x2b0d('0x2e')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5ae847[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x5ae847[_0x2b0d('0x142')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x5ae847,_0x2b0d('0x143'));}var _0x500a25=this[_0x2b0d('0x26')]['sync'](this,_0x5ae847[_0x2b0d('0x142')]);if(!_0x500a25){return this['channel']['error'](_0x5ae847,_0x2b0d('0x144'));}for(var _0x3aa5a0=0x0;_0x3aa5a0<_0x500a25[_0x2b0d('0x9b')];_0x3aa5a0+=0x1){var _0x598842=this[_0x2b0d('0x36')]['getVariable'](util[_0x2b0d('0x29')](_0x2b0d('0x145'),_0x500a25[_0x3aa5a0]));if(_0x598842[_0x2b0d('0xac')]===-0x1){return _0x598842;}logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('IFTIME\x20%s\x20%s',_0x500a25[_0x3aa5a0],_0x598842[_0x2b0d('0xa0')]));if(_0x598842[_0x2b0d('0xa0')]===_0x2b0d('0x13e')){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x146'),_0x500a25[_0x3aa5a0],_0x2b0d('0x13e')));this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x146'),_0x500a25[_0x3aa5a0],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x146'),_0x500a25[_0x3aa5a0],_0x2b0d('0x13f')));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')]('IFTIME\x20%s\x20%s',_0x500a25[_0x3aa5a0],_0x2b0d('0x13f')));}}return{'code':0xc8,'result':_0x2b0d('0x13f')};};AGIVertices['prototype'][_0x2b0d('0x147')]=function(_0x1d6761){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1d6761[_0x2b0d('0x37')]));return this[_0x2b0d('0x36')]['hangup']();};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x148')]=function(_0x11b189){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x149'),_0x11b189[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x11b189['key'])){return this[_0x2b0d('0x36')]['noop']('no\x20key\x20configured');}var _0x5957b1=_0x2b0d('0x127');var _0x4c13d0=util['format'](_0x2b0d('0x128'),FILES_PATH,rs[_0x2b0d('0x112')](0x4));var _0x243fe6=util['format']('%s.%s',_0x4c13d0,_0x5957b1);var _0x36bf91=!![];if(_0x11b189[_0x2b0d('0x129')]===_0x2b0d('0x12a')){_0x36bf91=![];}var _0x56dc19=this[_0x2b0d('0x36')][_0x2b0d('0x12b')](_0x4c13d0,_0x5957b1,_0x11b189[_0x2b0d('0x12c')],_0x11b189[_0x2b0d('0x68')],undefined,_0x36bf91);if(_0x56dc19['result']!==-0x1){this['channel'][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x14a'),_0x243fe6));var _0xa5cdf=this[_0x2b0d('0x81')][_0x2b0d('0x71')](this,_0x11b189,_0x243fe6);if(_0xa5cdf){for(var _0x12f112 in _0xa5cdf){if(_0xa5cdf[_0x2b0d('0x93')](_0x12f112)){this['channel']['setVariable'](util[_0x2b0d('0x29')]('ISPEECH_ASR_%s',_0x12f112[_0x2b0d('0xe9')]()),_0xa5cdf[_0x12f112]);}}return this['channel'][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x14b'),JSON[_0x2b0d('0x74')](_0xa5cdf)));}}return _0x56dc19;};AGIVertices[_0x2b0d('0x11')]['ispeechtts']=function(_0x1216a3){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x14c'),_0x1216a3[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x1216a3[_0x2b0d('0x7e')])){return this['channel']['noop'](_0x2b0d('0xe5'));}if(!this['isConfigured'](_0x1216a3[_0x2b0d('0x60')])){return this['channel']['noop'](_0x2b0d('0xe6'));}this[_0x2b0d('0x36')]['noop'](util['format'](_0x2b0d('0x14d'),_0x1216a3['text']));var _0xd1e3e5=this[_0x2b0d('0x7d')][_0x2b0d('0x71')](this,_0x1216a3);if(_0xd1e3e5){this[_0x2b0d('0x36')]['noop'](util['format'](_0x2b0d('0x14a'),_0xd1e3e5));var _0x435b57=this[_0x2b0d('0x36')][_0x2b0d('0xfa')](_0xd1e3e5,_0x1216a3[_0x2b0d('0x12c')]);try{fs[_0x2b0d('0xfb')](_0xd1e3e5+_0x2b0d('0xfc'));}catch(_0x51debb){logger['error'](_0x51debb);}return _0x435b57;}return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x1216a3,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x2b0d('0x14e')]=function(_0x3d1f95){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x14f'),_0x3d1f95[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x3d1f95[_0x2b0d('0x150')])){return this['channel'][_0x2b0d('0x2c')](_0x3d1f95,_0x2b0d('0x151'));}logger['info'](util[_0x2b0d('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x3d1f95[_0x2b0d('0x150')]));var _0x2ca0ab=this[_0x2b0d('0x59')]['sync'](this,_0x3d1f95[_0x2b0d('0x150')]);if(_0x2ca0ab){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x3d1f95[_0x2b0d('0x150')]));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2b0d('0x36')]['callerid'],_0x3d1f95[_0x2b0d('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2b0d('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x2b0d('0x3a')],_0x3d1f95[_0x2b0d('0x150')]));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x152'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x3d1f95[_0x2b0d('0x150')]));return{'code':0xc8,'result':_0x2b0d('0x153')};}};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x154')]=function(_0x4e3fc8){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x155'),_0x4e3fc8[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x4e3fc8[_0x2b0d('0x150')])){return this[_0x2b0d('0x36')]['error'](_0x4e3fc8,_0x2b0d('0x151'));}logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x156'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x4e3fc8[_0x2b0d('0x150')]));var _0x1a3d5e=this[_0x2b0d('0x55')]['sync'](this,_0x4e3fc8[_0x2b0d('0x150')]);if(_0x1a3d5e){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x157'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x4e3fc8[_0x2b0d('0x150')]));this['channel'][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x157'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x4e3fc8[_0x2b0d('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x152'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x4e3fc8[_0x2b0d('0x150')]));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x152'),this['channel'][_0x2b0d('0x3a')],_0x4e3fc8['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2b0d('0x11')]['math']=function(_0x365ed5){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x158'),_0x365ed5[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x365ed5['operation'])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x365ed5,_0x2b0d('0x159'));}this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format']('math\x20%s',_0x365ed5[_0x2b0d('0x15a')]));var _0x3f3f4c=eval(_0x365ed5[_0x2b0d('0x15a')]);if(!this[_0x2b0d('0x83')](_0x365ed5[_0x2b0d('0xd4')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x10d'));}var _0x3decfa=this[_0x2b0d('0x12')][_0x2b0d('0x71')](this,_0x365ed5[_0x2b0d('0xd4')]);if(!_0x3decfa){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x365ed5,_0x2b0d('0xd5'));}if(_['isArray'](_0x3f3f4c)){var _0x560138=this;_0x3f3f4c[_0x2b0d('0xd6')](function(_0x133a37,_0x2feba1){_0x560138[_0x2b0d('0x36')][_0x2b0d('0x9c')](util[_0x2b0d('0x29')]('%s[%s]',_0x3decfa,_0x2feba1),_0x133a37);});return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x15b'),_0x3decfa));}else{return this[_0x2b0d('0x36')]['setVariable'](_0x3decfa,_0x3f3f4c);}};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xd')]=function(_0x569c1a){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x15c'),_0x569c1a[_0x2b0d('0x37')]));if(_0x569c1a[_0x2b0d('0xa4')]===0x0){return this['maxRetry'](_0x569c1a);}_0x569c1a['retry']-=0x1;if(!this[_0x2b0d('0x83')](_0x569c1a[_0x2b0d('0x10b')])){return this['channel']['error'](_0x569c1a,_0x2b0d('0x15d'));}var _0x1402ad=this[_0x2b0d('0x1f')][_0x2b0d('0x71')](this,_0x569c1a[_0x2b0d('0x10b')]);if(!_0x1402ad){return this[_0x2b0d('0x36')]['error'](_0x569c1a,'no\x20file\x20audio\x20found');}var _0x1318f9=this['channel'][_0x2b0d('0x10e')](_0x1402ad,_0x569c1a[_0x2b0d('0x15e')],_0x569c1a[_0x2b0d('0x15f')]);var _0x341556=_0x1318f9[_0x2b0d('0xac')];if(_0x1318f9[_0x2b0d('0xac')]===-0x1){this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x569c1a,'-1');return _0x1318f9;}else if(_0x1318f9[_0x2b0d('0xa0')]==='timeout'){_0x1318f9['result']=_0x1318f9[_0x2b0d('0xac')]['length']>0x0?_0x1318f9[_0x2b0d('0xac')]:'t';}else if(_[_0x2b0d('0x45')](_0x1318f9[_0x2b0d('0xac')])){_0x1318f9[_0x2b0d('0xac')]='#';_0x341556='#';}if(!this[_0x2b0d('0x83')](_0x569c1a[_0x2b0d('0xd4')])){this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x10d'));}else{var _0x311253=this[_0x2b0d('0x12')][_0x2b0d('0x71')](this,_0x569c1a[_0x2b0d('0xd4')]);if(!_0x311253){return this['channel'][_0x2b0d('0x2c')](_0x569c1a,_0x2b0d('0xd5'));}this[_0x2b0d('0x36')][_0x2b0d('0x9c')](_0x311253,_0x341556);}this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x569c1a,_0x341556);return _0x1318f9;};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0xa7')]=function(_0x12d7f6){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x160'),_0x12d7f6[_0x2b0d('0x37')]));return this['channel']['noop'](_0x12d7f6[_0x2b0d('0x161')]||_0x12d7f6[_0x2b0d('0x37')]);};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x162')]=function(_0xa455fa){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x163'),_0xa455fa['label']));if(!this[_0x2b0d('0x83')](_0xa455fa[_0x2b0d('0x150')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0xa455fa,_0x2b0d('0x151'));}logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x156'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0xa455fa[_0x2b0d('0x150')]));var _0x30a0d7=this['getPause'][_0x2b0d('0x71')](this,_0xa455fa[_0x2b0d('0x164')]);var _0x97825=this[_0x2b0d('0x52')]['sync'](this,_0xa455fa['findBy'],_0x30a0d7);if(_0x97825){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x157'),this[_0x2b0d('0x36')]['callerid'],_0xa455fa[_0x2b0d('0x150')]));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x157'),this[_0x2b0d('0x36')]['callerid'],_0xa455fa['findBy']));return{'code':0xc8,'result':_0x2b0d('0x165')};}else{logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x152'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0xa455fa['findBy']));this['channel']['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x157'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0xa455fa[_0x2b0d('0x150')]));return{'code':0xc8,'result':_0x2b0d('0x153')};}};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x166')]=function(_0x46f11e){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x167'),_0x46f11e[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x46f11e[_0x2b0d('0x10b')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x46f11e,_0x2b0d('0x15d'));}var _0x3c0e37=this[_0x2b0d('0x1f')][_0x2b0d('0x71')](this,_0x46f11e['file_id']);if(!_0x3c0e37){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x46f11e,_0x2b0d('0x10c'));}var _0x2007ff=this['channel'][_0x2b0d('0x5a')](_0x2b0d('0x168'),[_0x3c0e37,_0x46f11e[_0x2b0d('0xe1')]]);if(_0x2007ff[_0x2b0d('0xac')]===-0x1){return _0x2007ff;}return this['channel']['noop'](util['format'](_0x2b0d('0xbd'),'PLAYBACK',_0x3c0e37));};AGIVertices[_0x2b0d('0x11')]['queue']=function(_0x4317ad){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4317ad['label']));if(!this[_0x2b0d('0x83')](_0x4317ad[_0x2b0d('0x169')])){return this['channel'][_0x2b0d('0x2c')](_0x4317ad,'no\x20queue\x20selected');}var _0x1b4301='';var _0x1f93fc=parseInt(_0x4317ad[_0x2b0d('0x169')],0xa);if(isNaN(_0x1f93fc)){_0x1b4301=_0x4317ad[_0x2b0d('0x169')];}else{_0x1b4301=this[_0x2b0d('0x16a')][_0x2b0d('0x71')](this,_0x4317ad[_0x2b0d('0x169')]);if(!_0x1b4301){return this['channel'][_0x2b0d('0x2c')](_0x4317ad,'no\x20queue\x20found');}}var _0xd50b8='';if(this[_0x2b0d('0x83')](_0x4317ad['file_id'])){var _0x2c61af=this[_0x2b0d('0x1f')][_0x2b0d('0x71')](this,_0x4317ad[_0x2b0d('0x10b')]);if(_0x2c61af){_0xd50b8=_0x2c61af;}}this['createSquareDetailsReport'][_0x2b0d('0x71')](this,_0x4317ad,_0x1b4301);if(_0x4317ad['opts']['indexOf']('x')<0x0){_0x4317ad[_0x2b0d('0xe1')]+='x';}if(_0x4317ad['opts'][_0x2b0d('0x16b')]('X')<0x0){_0x4317ad[_0x2b0d('0xe1')]+='X';}this[_0x2b0d('0x36')]['setVariable'](_0x2b0d('0x16c'),_0x1b4301?_0x1b4301[_0x2b0d('0x16d')]():'');var _0x59546b=this[_0x2b0d('0x36')][_0x2b0d('0x5a')](_0x2b0d('0x16e'),[_0x1b4301,_0x4317ad[_0x2b0d('0xe1')],_0x4317ad[_0x2b0d('0x66')],_0xd50b8,_0x4317ad[_0x2b0d('0x68')],_0x4317ad['agi'],_0x4317ad['macro'],_0x4317ad[_0x2b0d('0x16f')],'',_0x4317ad[_0x2b0d('0x170')]]);if(_0x59546b[_0x2b0d('0xac')]===-0x1){return _0x59546b;}return this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0xbd'),_0x2b0d('0x16e'),_0x1b4301));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x171')]=function(_0x1b2722){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1b2722[_0x2b0d('0x37')]));var _0x5dfb1f=_0x1b2722[_0x2b0d('0x172')]||_0x2b0d('0x127');var _0x480a24=util[_0x2b0d('0x29')]('%s_%s',this[_0x2b0d('0x36')][_0x2b0d('0x3c')],rs[_0x2b0d('0x112')](0x5));var _0xf47638=util[_0x2b0d('0x29')](_0x2b0d('0x173'),FILES_PATH,_0x480a24,_0x5dfb1f);var _0x4b28c0=util[_0x2b0d('0x29')](_0x2b0d('0x128'),FILES_PATH,_0x480a24);this[_0x2b0d('0x3b')][_0x2b0d('0x71')](this,_0x1b2722,_0x480a24,_0xf47638);this[_0x2b0d('0x36')][_0x2b0d('0x9c')](_0x2b0d('0x174'),_0x480a24);logger['info'](_0x2b0d('0x175'),_0x4b28c0,_0x5dfb1f,_0x1b2722[_0x2b0d('0x176')],_0x1b2722[_0x2b0d('0x68')]);return this[_0x2b0d('0x36')][_0x2b0d('0x12b')](_0x4b28c0,_0x5dfb1f,_0x1b2722[_0x2b0d('0x176')],_0x1b2722[_0x2b0d('0x68')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x330bb6){logger['info'](util[_0x2b0d('0x29')](_0x2b0d('0x177'),_0x330bb6[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x330bb6[_0x2b0d('0x66')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')]('no\x20url\x20configured');}var _0xfde902=this[_0x2b0d('0x178')][_0x2b0d('0x71')](this,_0x330bb6);logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Response:',util['inspect'](_0xfde902,{'showHidden':![],'depth':null})));if(!this[_0x2b0d('0x83')](_0x330bb6[_0x2b0d('0xd4')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x179'));}var _0x1b0307=this[_0x2b0d('0x12')][_0x2b0d('0x71')](this,_0x330bb6[_0x2b0d('0xd4')]);if(!_0x1b0307){return this[_0x2b0d('0x36')]['error'](_0x330bb6,_0x2b0d('0xd5'));}this[_0x2b0d('0x36')][_0x2b0d('0x9c')](util['format']('%s_STATUS_CODE',_0x1b0307),_0xfde902[_0x2b0d('0x76')]?_0xfde902[_0x2b0d('0x76')]:_0x2b0d('0x17a'));this['channel']['setVariable'](util[_0x2b0d('0x29')]('%s_STATUS_MESSAGE',_0x1b0307),_0xfde902[_0x2b0d('0x77')]?_0xfde902[_0x2b0d('0x77')]:'OK');if(_0xfde902[_0x2b0d('0x6d')]){try{this['saveRestApiResult'](_0xfde902['body'],_0x1b0307);}catch(_0x1381c4){logger[_0x2b0d('0x2c')](util[_0x2b0d('0x29')](_0x2b0d('0x17b'),_0x1b0307));}}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format'](_0x2b0d('0xda'),_0x1b0307));};AGIVertices[_0x2b0d('0x11')]['saydigits']=function(_0x33cb9d){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x17c'),_0x33cb9d[_0x2b0d('0x37')]));return this[_0x2b0d('0x36')][_0x2b0d('0x17d')](_0x33cb9d[_0x2b0d('0x17e')]['replace'](/\s+/g,''),_0x33cb9d[_0x2b0d('0x176')]);};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x17f')]=function(_0x5cbe76){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x180'),_0x5cbe76['label']));return this[_0x2b0d('0x36')][_0x2b0d('0x181')](_0x5cbe76[_0x2b0d('0x69')]['replace'](/\s+/g,''),_0x5cbe76[_0x2b0d('0x176')]);};AGIVertices[_0x2b0d('0x11')]['sayphonetic']=function(_0x1ebe11){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x182'),_0x1ebe11['label']));return this[_0x2b0d('0x36')]['sayPhonetic'](_0x1ebe11['text'],_0x1ebe11['escape_digits']);};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x183')]=function(_0x584bf2){logger['info'](util['format'](_0x2b0d('0x184'),_0x584bf2['label']));if(!this[_0x2b0d('0x83')](_0x584bf2[_0x2b0d('0x185')])){return this['channel'][_0x2b0d('0xa7')]('no\x20mail\x20account\x20configured');}var _0x251108=this[_0x2b0d('0x22')][_0x2b0d('0x71')](this,_0x584bf2[_0x2b0d('0x185')]);if(!_0x251108||!_0x251108[_0x2b0d('0x186')]){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x584bf2,_0x2b0d('0x187'));}var _0x490cee={'from':util[_0x2b0d('0x29')](_0x2b0d('0x188'),_0x251108[_0x2b0d('0x15')],_0x251108[_0x2b0d('0x189')]||_0x251108[_0x2b0d('0x186')]['user']),'to':_0x584bf2['to']||'','cc':_0x584bf2['cc']||'','bcc':_0x584bf2['bcc']||'','subject':_0x584bf2[_0x2b0d('0x18a')],'html':_0x584bf2['text'],'text':_0x584bf2[_0x2b0d('0x60')]};var _0x1669c4={'tls':{'rejectUnauthorized':![]}};if(_0x251108[_0x2b0d('0x186')]['service']){_0x1669c4[_0x2b0d('0x18b')]=_0x251108[_0x2b0d('0x186')][_0x2b0d('0x18b')];}else{_0x1669c4[_0x2b0d('0x18c')]=_0x251108[_0x2b0d('0x186')]['host'];_0x1669c4['port']=_0x251108[_0x2b0d('0x186')][_0x2b0d('0x18d')];_0x1669c4[_0x2b0d('0x18e')]=_0x251108[_0x2b0d('0x186')][_0x2b0d('0x18e')];}if(_0x251108[_0x2b0d('0x186')][_0x2b0d('0x18f')]){_0x1669c4['auth']={'user':_0x251108[_0x2b0d('0x186')][_0x2b0d('0x190')],'pass':_0x251108['Smtp']['pass']};}if(this[_0x2b0d('0x83')](_0x584bf2['template_id'])){}logger[_0x2b0d('0xdb')](_0x2b0d('0x191'),JSON[_0x2b0d('0x74')](_0x490cee));this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x584bf2,_0x584bf2[_0x2b0d('0x185')]);this['channel'][_0x2b0d('0xa7')](util[_0x2b0d('0x29')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x251108[_0x2b0d('0x15')]));this[_0x2b0d('0x24')][_0x2b0d('0x71')](this,_0x1669c4,_0x490cee);return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0x192'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x193')]=function(_0x5b07d7){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5b07d7[_0x2b0d('0x37')]));return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x194'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x195')]=function(_0x540d99){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x196'),_0x540d99[_0x2b0d('0x37')]));if(!this[_0x2b0d('0x83')](_0x540d99[_0x2b0d('0x197')])){return this[_0x2b0d('0x36')]['noop'](_0x2b0d('0x198'));}var _0x45e205=this[_0x2b0d('0x32')][_0x2b0d('0x71')](this,_0x540d99[_0x2b0d('0x197')]);if(!_0x45e205){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x540d99,_0x2b0d('0x199'));}var _0x583d58={'body':_0x540d99[_0x2b0d('0x19a')],'phone':_0x540d99['to']||'','SmsAccountId':_0x45e205['id']};logger[_0x2b0d('0xdb')](_0x2b0d('0x19b'),JSON['stringify'](_0x583d58));this[_0x2b0d('0x35')][_0x2b0d('0x71')](this,_0x540d99,_0x540d99[_0x2b0d('0x197')]);this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x19c'),_0x45e205[_0x2b0d('0x15')]));this['createSmsMessage'][_0x2b0d('0x71')](this,_0x583d58);return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x19d'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x19e')]=function(_0x4ca3c2){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4ca3c2['label']));if(!this[_0x2b0d('0x83')](_0x4ca3c2[_0x2b0d('0xd4')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x4ca3c2,_0x2b0d('0x19f'));}var _0x3652e2=this[_0x2b0d('0x12')]['sync'](this,_0x4ca3c2[_0x2b0d('0xd4')]);if(!_0x3652e2){return this[_0x2b0d('0x36')]['error'](_0x4ca3c2,'no\x20variable\x20found');}return this[_0x2b0d('0x36')][_0x2b0d('0x9c')](_0x3652e2,_0x4ca3c2[_0x2b0d('0x1a0')]);};AGIVertices[_0x2b0d('0x11')]['start']=function(_0x5e1524){logger['info'](util[_0x2b0d('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5e1524[_0x2b0d('0x37')]));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x1a1'));if(_0x5e1524[_0x2b0d('0xb4')]===_0x2b0d('0x1a2')){this[_0x2b0d('0x36')][_0x2b0d('0xa7')](_0x2b0d('0x1a3'));return this[_0x2b0d('0x36')][_0x2b0d('0xb4')]();}return this[_0x2b0d('0x36')]['noop'](_0x2b0d('0x1a4'));};AGIVertices['prototype'][_0x2b0d('0x1a5')]=function(_0x1ea676){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x1a6'),_0x1ea676['label']));if(!this[_0x2b0d('0x83')](_0x1ea676['project_id'])){return this['channel'][_0x2b0d('0x2c')](_0x1ea676,_0x2b0d('0x1a7'));}var _0x45b7be=this['getSquareProject']['sync'](this,_0x1ea676[_0x2b0d('0x1a8')]);if(!this['isConfigured'](_0x45b7be)){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x1ea676,util[_0x2b0d('0x29')](_0x2b0d('0x1a9'),_0x1ea676[_0x2b0d('0x1a8')]));}if(_0x45b7be===this[_0x2b0d('0x36')][_0x2b0d('0x39')]){return this['channel'][_0x2b0d('0x2c')](_0x1ea676,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x2b0d('0x35')]['sync'](this,_0x1ea676,_0x45b7be);var _0x3d2c90=this[_0x2b0d('0x36')][_0x2b0d('0x5a')](_0x2b0d('0x1aa'),util[_0x2b0d('0x29')](_0x2b0d('0x1ab'),config[_0x2b0d('0x8')][_0x2b0d('0x18c')]||'127.0.0.1',_0x45b7be,this['channel'][_0x2b0d('0x39')]));if(_0x3d2c90['result']===-0x1){return _0x3d2c90;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0x2b0d('0x1aa'),_0x45b7be));};AGIVertices[_0x2b0d('0x11')]['system']=function(_0x4a3518){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x1ac'),_0x4a3518[_0x2b0d('0x37')]));var _0x307487=this[_0x2b0d('0x1ad')]['sync'](this,_0x4a3518['command']);this[_0x2b0d('0x35')]['sync'](this,_0x4a3518,_0x4a3518[_0x2b0d('0xb2')]);if(this[_0x2b0d('0x83')](_0x4a3518['variable_id'])){var _0x1167d0=this[_0x2b0d('0x12')][_0x2b0d('0x71')](this,_0x4a3518[_0x2b0d('0xd4')]);if(_0x1167d0){this[_0x2b0d('0x36')][_0x2b0d('0x9c')](_0x1167d0,_0x307487);return this['channel'][_0x2b0d('0xa7')](util['format'](_0x2b0d('0x1ae'),_0x4a3518[_0x2b0d('0xb2')],_0x1167d0));}}return this['channel']['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x1af'),_0x4a3518['command']));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x1b0')]=function(_0x4db8a5){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x1b1'),_0x4db8a5[_0x2b0d('0x37')]));_0x4db8a5['text']=_0x4db8a5[_0x2b0d('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4db8a5[_0x2b0d('0x5e')])){return this[_0x2b0d('0x36')]['noop'](_0x2b0d('0x1b2'));}if(!this[_0x2b0d('0x83')](_0x4db8a5[_0x2b0d('0x60')])){return this['channel'][_0x2b0d('0xa7')](_0x2b0d('0xe6'));}this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x1b3'),_0x4db8a5['text']));var _0x23d54b=this[_0x2b0d('0x5d')]['sync'](this,_0x4db8a5);if(_0x23d54b){this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0x1b4'),_0x23d54b));var _0x5247b3=this[_0x2b0d('0x36')][_0x2b0d('0xfa')](_0x23d54b);try{fs['unlink'](_0x23d54b+_0x2b0d('0xfc'));}catch(_0x2a9350){logger[_0x2b0d('0x2c')](_0x2a9350);}return _0x5247b3;}return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x4db8a5,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x1b5')]=function(_0x772ec4){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x772ec4[_0x2b0d('0x37')]));_0x772ec4['text']=_0x772ec4['text'][_0x2b0d('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x772ec4[_0x2b0d('0x60')])){return this[_0x2b0d('0x36')][_0x2b0d('0xa7')]('no\x20text\x20configured');}this['channel'][_0x2b0d('0xa7')](util[_0x2b0d('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x772ec4['text']));var _0x3cf584=this[_0x2b0d('0x64')][_0x2b0d('0x71')](this,_0x772ec4);if(_0x3cf584){this[_0x2b0d('0x36')]['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x1b6'),_0x3cf584));var _0xdac5a5=this[_0x2b0d('0x36')][_0x2b0d('0xfa')](_0x3cf584);try{fs['unlink'](_0x3cf584+_0x2b0d('0xfc'));}catch(_0x1e1ee4){logger[_0x2b0d('0x2c')](_0x1e1ee4);}return _0xdac5a5;}return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x772ec4,_0x2b0d('0x1b7'));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x1b8')]=function(_0x574a43){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x1b9'),_0x574a43['label']));if(!this[_0x2b0d('0x83')](_0x574a43[_0x2b0d('0x150')])){return this[_0x2b0d('0x36')]['error'](_0x574a43,'no\x20find\x20by\x20configured');}logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x156'),this[_0x2b0d('0x36')]['callerid'],_0x574a43[_0x2b0d('0x150')]));var _0x20348b=this[_0x2b0d('0x54')][_0x2b0d('0x71')](this,_0x574a43['findBy']);if(_0x20348b){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x157'),this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x574a43[_0x2b0d('0x150')]));this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x574a43[_0x2b0d('0x150')]));return{'code':0xc8,'result':_0x2b0d('0x165')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2b0d('0x36')][_0x2b0d('0x3a')],_0x574a43[_0x2b0d('0x150')]));this['channel']['noop'](util[_0x2b0d('0x29')](_0x2b0d('0x152'),this['channel'][_0x2b0d('0x3a')],_0x574a43[_0x2b0d('0x150')]));return{'code':0xc8,'result':_0x2b0d('0x153')};}};AGIVertices['prototype'][_0x2b0d('0x1ba')]=function(_0x2119ef){logger[_0x2b0d('0x2e')](util[_0x2b0d('0x29')](_0x2b0d('0x1bb'),_0x2119ef[_0x2b0d('0x37')]));var _0x56851c=this[_0x2b0d('0x36')][_0x2b0d('0x5a')](_0x2b0d('0x1bc'),[_0x2119ef[_0x2b0d('0x1bd')],_0x2119ef[_0x2b0d('0x79')]]);if(_0x56851c[_0x2b0d('0xac')]===-0x1){return _0x56851c;}return this[_0x2b0d('0x36')][_0x2b0d('0xa7')](util[_0x2b0d('0x29')](_0x2b0d('0xbd'),_0x2b0d('0x1bc'),_0x2119ef[_0x2b0d('0x1bd')]));};AGIVertices[_0x2b0d('0x11')][_0x2b0d('0x1be')]=function(_0x2f8432){logger[_0x2b0d('0x2e')](util['format'](_0x2b0d('0x1bf'),_0x2f8432[_0x2b0d('0x37')]));if(!this['isConfigured'](_0x2f8432[_0x2b0d('0xd4')])){return this[_0x2b0d('0x36')][_0x2b0d('0x2c')](_0x2f8432,_0x2b0d('0x19f'));}var _0x4518c0=this[_0x2b0d('0x12')][_0x2b0d('0x71')](this,_0x2f8432[_0x2b0d('0xd4')]);if(!_0x4518c0){return this['channel'][_0x2b0d('0x2c')](_0x2f8432,'no\x20variable\x20found');}var _0x5a24f3=this[_0x2b0d('0x36')][_0x2b0d('0x12')](_0x4518c0);return{'code':0xc8,'result':_0x5a24f3[_0x2b0d('0xa0')]?_0x5a24f3[_0x2b0d('0xa0')]:'-'};};String['prototype'][_0x2b0d('0x9f')]=function(_0x3d5bfd,_0xdf677){return this[_0x2b0d('0x9e')](_0x3d5bfd)[_0x2b0d('0x1c0')](_0xdf677);};module[_0x2b0d('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index f1c8732..e02b6de 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 _0x3e74=['acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','attended','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','exports','util','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','agentringnoanswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x3e74,0x175));var _0x43e7=function(_0x1d4c47,_0x525175){_0x1d4c47=_0x1d4c47-0x0;var _0x2ee188=_0x3e74[_0x1d4c47];return _0x2ee188;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var moment=require(_0x43e7('0x1'));var ami=require(_0x43e7('0x2'));var logger=require(_0x43e7('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x43e7('0x4'));function Acw(_0x4f9bbe){this[_0x43e7('0x5')]=_0x4f9bbe[_0x43e7('0x5')];this[_0x43e7('0x6')]=_0x4f9bbe[_0x43e7('0x6')];this[_0x43e7('0x7')]=_0x4f9bbe['timers'];this[_0x43e7('0x8')]={};ami['on'](_0x43e7('0x9'),this[_0x43e7('0xa')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xc'),this['syncHangupRequest'][_0x43e7('0xb')](this));ami['on']('hangup',this['syncHangup'][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xd'),this['syncAgentRingNoAnswer'][_0x43e7('0xb')](this));ami['on']('attendedtransfer',this[_0x43e7('0xe')][_0x43e7('0xb')](this));ami['on']('blindtransfer',this[_0x43e7('0xf')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0x10'),this[_0x43e7('0x11')]['bind'](this));}function getDiff(_0x583d85){var _0x2fcb36=moment()[_0x43e7('0x12')](0x0);var _0x44b0bd=moment(_0x583d85)['milliseconds'](0x0);return _0x2fcb36['diff'](_0x44b0bd,_0x43e7('0x13'));}Acw[_0x43e7('0x14')][_0x43e7('0x15')]=function(_0x328445){try{var _0x4de324=this;var _0x5c4eaa=this[_0x43e7('0x8')][_0x328445][_0x43e7('0x16')];var _0x273a32=this['channels'][_0x328445]['queue'];var _0x446986=this[_0x43e7('0x5')][_0x273a32];var _0x9037d3=![];var _0x140657=_0x43e7('0x17');if(_0x446986[_0x43e7('0x18')]){if(_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')]){_0x9037d3=!![];_0x140657=_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')];}}ami[_0x43e7('0x1b')]({'action':_0x43e7('0x1c'),'interface':_0x5c4eaa,'paused':!![],'reason':_0x140657})['then'](function(_0xef1a5a){if(_0x4de324[_0x43e7('0x6')][_0x5c4eaa]){return RpcUser['getAgent'](_0x4de324[_0x43e7('0x6')][_0x5c4eaa]['id'])[_0x43e7('0x1d')](function(_0x3945bb){if(_0x3945bb&&!_0x3945bb[_0x43e7('0x1e')]){logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x328445,_0x5c4eaa,_0x273a32);var _0x54a9e7=_0x4de324[_0x43e7('0x8')][_0x328445]['attended']&&_0x4de324['channels'][_0x328445][_0x43e7('0x21')]?_0x4de324[_0x43e7('0x8')][_0x328445]['destlinkedid']:_0x328445;return RpcUser[_0x43e7('0x22')](_0x4de324['agents'][_0x5c4eaa],_0x140657,_0x54a9e7)[_0x43e7('0x1d')](function(_0x5c5e67){if(!_0x9037d3){_0x4de324[_0x43e7('0x7')][_0x5c4eaa]={};logger[_0x43e7('0x1f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);_0x4de324['timers'][_0x5c4eaa][_0x43e7('0x24')]=setTimeout(_0x4de324['stopAcw'][_0x43e7('0xb')](_0x4de324,_0x5c4eaa),_0x4de324[_0x43e7('0x5')][_0x273a32][_0x43e7('0x25')]*0x3e8);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['lastPauseAt']=moment()[_0x43e7('0x26')](_0x43e7('0x27'));_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')]=_0x328445;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x29')]=_0x273a32;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2a')]=function(){var _0x3bf475=getDiff(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2b')]);clearTimeout(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x24')]);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['timer']=![];RpcVoiceAgentReport[_0x43e7('0x2c')]({'acwtime':_0x3bf475},_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')],_0x5c4eaa)[_0x43e7('0x1d')](function(_0x4251c8){logger['info'](_0x43e7('0x2d'),_0x328445,_0x3bf475,_0x4251c8);})[_0x43e7('0x2e')](function(_0x30d47e){logger[_0x43e7('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x328445,_0x30d47e);});delete _0x4de324['timers'][_0x5c4eaa];};}});}else{logger['info'](_0x43e7('0x30'),_0x328445,_0x5c4eaa,_0x273a32);}});}})[_0x43e7('0x2e')](function(_0x117c07){logger[_0x43e7('0x2f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);})['finally'](function(){delete _0x4de324['channels'][_0x328445];});}catch(_0x59e5b2){logger['error']('[ACW][START]\x20%s',_0x59e5b2['message']);}};Acw[_0x43e7('0x14')]['stopAcw']=function(_0x2b4bfd){try{var _0x8e9f40=this;if(_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]){_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd][_0x43e7('0x24')]=![];var _0x449803=_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]['uniqueid'];var _0x5332d9=_0x8e9f40['timers'][_0x2b4bfd][_0x43e7('0x29')];var _0xfe70e9=_0x8e9f40[_0x43e7('0x5')][_0x5332d9][_0x43e7('0x25')];logger[_0x43e7('0x1f')](_0x43e7('0x31'),_0x2b4bfd);RpcUser[_0x43e7('0x32')](this[_0x43e7('0x6')][_0x2b4bfd]);RpcVoiceAgentReport['update']({'acwtime':_0xfe70e9,'agentacw':!![]},_0x449803,_0x2b4bfd)[_0x43e7('0x1d')](function(_0x2b0ffe){logger['info'](_0x43e7('0x2d'),_0x449803,_0xfe70e9,_0x2b0ffe);})['catch'](function(_0x44d8e4){logger[_0x43e7('0x2f')](_0x43e7('0x33'),_0x449803,_0x44d8e4);});}else{logger[_0x43e7('0x2f')](_0x43e7('0x34'),_0x2b4bfd);if(_0x8e9f40[_0x43e7('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x43e7('0x35')](_0x8e9f40[_0x43e7('0x7')]));}}}catch(_0x44b6ae){logger[_0x43e7('0x2f')](_0x43e7('0x36'),_0x44b6ae['message']);}};Acw[_0x43e7('0x14')][_0x43e7('0xa')]=function(_0x575439){try{if(this[_0x43e7('0x5')][_0x575439['queue']]&&(this[_0x43e7('0x5')][_0x575439['queue']][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x575439[_0x43e7('0x29')]][_0x43e7('0x18')])){if(this['agents'][_0x575439['interface']]){this[_0x43e7('0x8')][_0x575439[_0x43e7('0x28')]]={'queue':_0x575439[_0x43e7('0x29')],'interface':_0x575439[_0x43e7('0x16')],'destlinkedid':_0x575439['destlinkedid']};}}}catch(_0x583047){logger['error'](_0x43e7('0x38'),_0x583047['message']);}};Acw[_0x43e7('0x14')]['syncAgentConnectPreview']=function(_0x5b28db){try{if(this[_0x43e7('0x5')][_0x5b28db['queue']]&&(this[_0x43e7('0x5')][_0x5b28db[_0x43e7('0x29')]][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x5b28db['queue']][_0x43e7('0x18')])){if(this[_0x43e7('0x6')][_0x5b28db[_0x43e7('0x16')]]){this[_0x43e7('0x8')][_0x5b28db[_0x43e7('0x28')]]={'queue':_0x5b28db[_0x43e7('0x29')],'interface':_0x5b28db['interface']};}}}catch(_0x4930a2){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4930a2[_0x43e7('0x3a')]);}};Acw['prototype']['syncHangupRequest']=function(_0x56489b){try{if(this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]]&&_['isUndefined'](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]][_0x43e7('0x3b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x56489b['uniqueid']);this['startAcw'](_0x56489b[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x56489b['linkedid']]&&_[_0x43e7('0x3c')](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x3d')]][_0x43e7('0x3b')])){logger['info'](_0x43e7('0x3e'),_0x56489b['linkedid']);this['startAcw'](_0x56489b[_0x43e7('0x3d')]);}}catch(_0x12f9ba){logger[_0x43e7('0x2f')](_0x43e7('0x3f'),_0x12f9ba[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0x40')]=function(_0x256ddd){try{if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x28')]]&&this['channels'][_0x256ddd[_0x43e7('0x28')]][_0x43e7('0x3b')]){logger['info'](_0x43e7('0x41'),_0x256ddd['uniqueid']);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x3d')]]&&this[_0x43e7('0x8')][_0x256ddd['linkedid']]['attended']){logger[_0x43e7('0x1f')](_0x43e7('0x42'),_0x256ddd[_0x43e7('0x3d')]);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x3d')]);}}catch(_0x25bb44){logger[_0x43e7('0x2f')](_0x43e7('0x43'),_0x25bb44[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xe')]=function(_0x4ace49){try{if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49['transfereeuniqueid']])){this[_0x43e7('0x15')](_0x4ace49[_0x43e7('0x45')]);if(this[_0x43e7('0x8')][_0x4ace49['secondtransfereruniqueid']]){this['channels'][_0x4ace49[_0x43e7('0x46')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49[_0x43e7('0x47')]]=this['channels'][_0x4ace49['secondtransfereruniqueid']];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x46')]];}}else if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x47')]])){this['startAcw'](_0x4ace49[_0x43e7('0x47')]);if(this[_0x43e7('0x8')][_0x4ace49['origtransfereruniqueid']]){this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49['transfereeuniqueid']]=this['channels'][_0x4ace49[_0x43e7('0x48')]];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]];}}}catch(_0x3a6404){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3a6404[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xf')]=function(_0x5dd349){try{if(this['channels'][_0x5dd349[_0x43e7('0x49')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4a'),JSON[_0x43e7('0x35')](_0x5dd349[_0x43e7('0x49')]));this[_0x43e7('0x15')](_0x5dd349[_0x43e7('0x49')]);}else if(this[_0x43e7('0x8')][_0x5dd349[_0x43e7('0x4b')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4c'),JSON['stringify'](_0x5dd349['transfererlinkedid']));this[_0x43e7('0x15')](_0x5dd349['transfererlinkedid']);}}catch(_0x501616){logger['error'](_0x43e7('0x4d'),_0x501616[_0x43e7('0x3a')]);}};Acw['prototype'][_0x43e7('0x4e')]=function(_0x135791){try{if(this[_0x43e7('0x5')][_0x135791['queue']]&&this[_0x43e7('0x5')][_0x135791[_0x43e7('0x29')]][_0x43e7('0x4f')]===_0x43e7('0x50')){if(this[_0x43e7('0x6')][_0x135791[_0x43e7('0x16')]]){logger[_0x43e7('0x1f')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x135791[_0x43e7('0x28')],_0x135791[_0x43e7('0x16')],_0x135791[_0x43e7('0x29')]);return RpcUser['savePause'](this['agents'][_0x135791[_0x43e7('0x16')]],'Auto-Pause',_0x135791['uniqueid']);}}}catch(_0x1b793d){logger[_0x43e7('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1b793d[_0x43e7('0x3a')]);}};module[_0x43e7('0x51')]=Acw; \ No newline at end of file +var _0x5fd1=['../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','stopAcw','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami'];(function(_0x1251e7,_0xb10848){var _0x54cf45=function(_0x52f915){while(--_0x52f915){_0x1251e7['push'](_0x1251e7['shift']());}};_0x54cf45(++_0xb10848);}(_0x5fd1,0x155));var _0x15fd=function(_0x2344aa,_0x3ea548){_0x2344aa=_0x2344aa-0x0;var _0x4d2109=_0x5fd1[_0x2344aa];return _0x4d2109;};'use strict';var util=require(_0x15fd('0x0'));var _=require('lodash');var moment=require(_0x15fd('0x1'));var ami=require(_0x15fd('0x2'));var logger=require(_0x15fd('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x15fd('0x4'));function Acw(_0x3138f3){this[_0x15fd('0x5')]=_0x3138f3['voiceQueues'];this[_0x15fd('0x6')]=_0x3138f3[_0x15fd('0x6')];this[_0x15fd('0x7')]=_0x3138f3[_0x15fd('0x7')];this[_0x15fd('0x8')]={};ami['on']('agentconnect',this[_0x15fd('0x9')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xb'),this['syncHangupRequest'][_0x15fd('0xa')](this));ami['on']('hangup',this[_0x15fd('0xc')][_0x15fd('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x15fd('0xd'),this[_0x15fd('0xe')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xf'),this[_0x15fd('0x10')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0x11'),this[_0x15fd('0x12')][_0x15fd('0xa')](this));}function getDiff(_0x4cb391){var _0x5b7af0=moment()['milliseconds'](0x0);var _0x3fda60=moment(_0x4cb391)[_0x15fd('0x13')](0x0);return _0x5b7af0[_0x15fd('0x14')](_0x3fda60,_0x15fd('0x15'));}Acw[_0x15fd('0x16')][_0x15fd('0x17')]=function(_0x2c5375){try{var _0x44a63a=this;var _0x5aae13=this['channels'][_0x2c5375][_0x15fd('0x18')];var _0x5ca5a2=this[_0x15fd('0x8')][_0x2c5375]['queue'];var _0x917fe4=this[_0x15fd('0x5')][_0x5ca5a2];var _0x855bae=![];var _0x49ceac=_0x15fd('0x19');if(_0x917fe4[_0x15fd('0x1a')]){if(_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')]){_0x855bae=!![];_0x49ceac=_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')];}}ami[_0x15fd('0x1d')]({'action':_0x15fd('0x1e'),'interface':_0x5aae13,'paused':!![],'reason':_0x49ceac})[_0x15fd('0x1f')](function(_0x1eab55){if(_0x44a63a[_0x15fd('0x6')][_0x5aae13]){return RpcUser['getAgent'](_0x44a63a['agents'][_0x5aae13]['id'])[_0x15fd('0x1f')](function(_0x36b21e){if(_0x36b21e&&!_0x36b21e[_0x15fd('0x20')]){logger[_0x15fd('0x21')](_0x15fd('0x22'),_0x2c5375,_0x5aae13,_0x5ca5a2);var _0x11496a=_0x44a63a[_0x15fd('0x8')][_0x2c5375]['attended']&&_0x44a63a[_0x15fd('0x8')][_0x2c5375][_0x15fd('0x23')]?_0x44a63a[_0x15fd('0x8')][_0x2c5375]['destlinkedid']:_0x2c5375;return RpcUser[_0x15fd('0x24')](_0x44a63a['agents'][_0x5aae13],_0x49ceac,_0x11496a)[_0x15fd('0x1f')](function(_0x1fc24f){if(!_0x855bae){_0x44a63a[_0x15fd('0x7')][_0x5aae13]={};logger['info'](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')],_0x5aae13,_0x5ca5a2);_0x44a63a['timers'][_0x5aae13][_0x15fd('0x27')]=setTimeout(_0x44a63a['stopAcw'][_0x15fd('0xa')](_0x44a63a,_0x5aae13),_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')]*0x3e8);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x28')]=moment()[_0x15fd('0x29')](_0x15fd('0x2a'));_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')]=_0x2c5375;_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2c')]=_0x5ca5a2;_0x44a63a['timers'][_0x5aae13][_0x15fd('0x2d')]=function(){var _0x2fe61e=getDiff(_0x44a63a['timers'][_0x5aae13][_0x15fd('0x28')]);clearTimeout(_0x44a63a[_0x15fd('0x7')][_0x5aae13]['timer']);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2fe61e},_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')],_0x5aae13)[_0x15fd('0x1f')](function(_0x476828){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x2c5375,_0x2fe61e,_0x476828);})['catch'](function(_0x2d647c){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x2c5375,_0x2d647c);});delete _0x44a63a[_0x15fd('0x7')][_0x5aae13];};}});}else{logger['info'](_0x15fd('0x31'),_0x2c5375,_0x5aae13,_0x5ca5a2);}});}})[_0x15fd('0x32')](function(_0x11b3a1){logger[_0x15fd('0x2f')](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2]['acwTimeout'],_0x5aae13,_0x5ca5a2);})[_0x15fd('0x33')](function(){delete _0x44a63a[_0x15fd('0x8')][_0x2c5375];});}catch(_0x57c118){logger[_0x15fd('0x2f')](_0x15fd('0x34'),_0x57c118[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0x36')]=function(_0x309851){try{var _0x1732bc=this;if(_0x1732bc[_0x15fd('0x7')][_0x309851]){_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x27')]=![];var _0x4d7259=_0x1732bc['timers'][_0x309851]['uniqueid'];var _0x340d17=_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x2c')];var _0x4e608d=_0x1732bc['voiceQueues'][_0x340d17][_0x15fd('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x309851);RpcUser['saveUnpause'](this[_0x15fd('0x6')][_0x309851]);RpcVoiceAgentReport[_0x15fd('0x37')]({'acwtime':_0x4e608d,'agentacw':!![]},_0x4d7259,_0x309851)[_0x15fd('0x1f')](function(_0x59d0d7){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x4d7259,_0x4e608d,_0x59d0d7);})[_0x15fd('0x32')](function(_0x5beb6e){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x4d7259,_0x5beb6e);});}else{logger[_0x15fd('0x2f')](_0x15fd('0x38'),_0x309851);if(_0x1732bc[_0x15fd('0x7')]){logger[_0x15fd('0x21')](_0x15fd('0x39'),JSON[_0x15fd('0x3a')](_0x1732bc[_0x15fd('0x7')]));}}}catch(_0x5dd3c4){logger[_0x15fd('0x2f')](_0x15fd('0x3b'),_0x5dd3c4[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x9')]=function(_0x5f9429){try{if(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]]&&(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x5f9429['interface']]){this[_0x15fd('0x8')][_0x5f9429[_0x15fd('0x2b')]]={'queue':_0x5f9429[_0x15fd('0x2c')],'interface':_0x5f9429[_0x15fd('0x18')],'destlinkedid':_0x5f9429[_0x15fd('0x23')]};}}}catch(_0x44d08b){logger[_0x15fd('0x2f')](_0x15fd('0x3d'),_0x44d08b['message']);}};Acw['prototype'][_0x15fd('0x12')]=function(_0x57bbd5){try{if(this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]]&&(this['voiceQueues'][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x57bbd5['interface']]){this[_0x15fd('0x8')][_0x57bbd5[_0x15fd('0x2b')]]={'queue':_0x57bbd5[_0x15fd('0x2c')],'interface':_0x57bbd5[_0x15fd('0x18')]};}}}catch(_0xcce802){logger[_0x15fd('0x2f')](_0x15fd('0x3e'),_0xcce802[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x3f')]=function(_0x16b4f5){try{if(this[_0x15fd('0x8')][_0x16b4f5['uniqueid']]&&_[_0x15fd('0x40')](this['channels'][_0x16b4f5[_0x15fd('0x2b')]][_0x15fd('0x41')])){logger[_0x15fd('0x21')]('[%s][HANGUP:UNIQUEID]',_0x16b4f5[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x16b4f5[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x16b4f5['linkedid']]&&_[_0x15fd('0x40')](this[_0x15fd('0x8')][_0x16b4f5[_0x15fd('0x42')]][_0x15fd('0x41')])){logger['info'](_0x15fd('0x43'),_0x16b4f5[_0x15fd('0x42')]);this['startAcw'](_0x16b4f5['linkedid']);}}catch(_0x5da44c){logger[_0x15fd('0x2f')](_0x15fd('0x44'),_0x5da44c[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0xc')]=function(_0x33a128){try{if(this['channels'][_0x33a128[_0x15fd('0x2b')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x2b')]]['attended']){logger[_0x15fd('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x33a128[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]][_0x15fd('0x41')]){logger[_0x15fd('0x21')](_0x15fd('0x45'),_0x33a128[_0x15fd('0x42')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x42')]);}}catch(_0x5343b8){logger[_0x15fd('0x2f')]('[ACW][syncHangup]\x20%s',_0x5343b8[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0xe')]=function(_0x1fac7f){try{if(!_[_0x15fd('0x46')](this['channels'][_0x1fac7f['transfereeuniqueid']])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x47')]);if(this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]]){this['channels'][_0x1fac7f[_0x15fd('0x48')]][_0x15fd('0x41')]=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]]=this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]];delete this['channels'][_0x1fac7f[_0x15fd('0x48')]];}}else if(!_[_0x15fd('0x46')](this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x49')]);if(this['channels'][_0x1fac7f['origtransfereruniqueid']]){this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]]['attended']=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x47')]]=this['channels'][_0x1fac7f[_0x15fd('0x4a')]];delete this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]];}}}catch(_0x53bfd7){logger[_0x15fd('0x2f')](_0x15fd('0x4b'),_0x53bfd7[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x10')]=function(_0x1f4581){try{if(this[_0x15fd('0x8')][_0x1f4581[_0x15fd('0x4c')]]){logger[_0x15fd('0x21')](_0x15fd('0x4d'),JSON['stringify'](_0x1f4581[_0x15fd('0x4c')]));this[_0x15fd('0x17')](_0x1f4581['transfereruniqueid']);}else if(this['channels'][_0x1f4581[_0x15fd('0x4e')]]){logger[_0x15fd('0x21')](_0x15fd('0x4f'),JSON[_0x15fd('0x3a')](_0x1f4581[_0x15fd('0x4e')]));this[_0x15fd('0x17')](_0x1f4581['transfererlinkedid']);}}catch(_0x41d398){logger[_0x15fd('0x2f')](_0x15fd('0x50'),_0x41d398[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x51')]=function(_0xf27ab4){try{if(this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]&&this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]['autopause']==='all'){if(this[_0x15fd('0x6')][_0xf27ab4[_0x15fd('0x18')]]){logger[_0x15fd('0x21')](_0x15fd('0x52'),_0xf27ab4[_0x15fd('0x2b')],_0xf27ab4[_0x15fd('0x18')],_0xf27ab4[_0x15fd('0x2c')]);return RpcUser['savePause'](this[_0x15fd('0x6')][_0xf27ab4['interface']],_0x15fd('0x53'),_0xf27ab4['uniqueid']);}}}catch(_0x1c2828){logger['error'](_0x15fd('0x54'),_0x1c2828[_0x15fd('0x35')]);}};module[_0x15fd('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d0d2e78..94c0bb0 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 _0x2997=['queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','../../config/environment','asterisk','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus'];(function(_0x52d55b,_0x2ccd27){var _0x4f662d=function(_0xcd42d0){while(--_0xcd42d0){_0x52d55b['push'](_0x52d55b['shift']());}};_0x4f662d(++_0x2ccd27);}(_0x2997,0xd3));var _0x7299=function(_0x66f9f9,_0x4e5148){_0x66f9f9=_0x66f9f9-0x0;var _0x83efea=_0x2997[_0x66f9f9];return _0x83efea;};'use strict';var Manager=require(_0x7299('0x0'));var BPromise=require(_0x7299('0x1'));var moment=require(_0x7299('0x2'));var util=require('util');var _=require(_0x7299('0x3'));var logger=require(_0x7299('0x4'))('ami');var config=require(_0x7299('0x5'));var ami=new Manager(config[_0x7299('0x6')]['port'],config['asterisk']['ip'],config['asterisk']['username'],config['asterisk'][_0x7299('0x7')],!![]);ami[_0x7299('0x8')]();ami['Action']=BPromise[_0x7299('0x9')](ami[_0x7299('0xa')]);function error(_0x4611e1){logger[_0x7299('0xb')](util[_0x7299('0xc')](_0x7299('0xd'),config['asterisk'][_0x7299('0xe')],config[_0x7299('0x6')]['ip'],config[_0x7299('0x6')]['port'],util['inspect'](_0x4611e1,![],null)));}function close(){logger['error'](util[_0x7299('0xc')](_0x7299('0xf'),config[_0x7299('0x6')][_0x7299('0xe')],config[_0x7299('0x6')]['ip'],config[_0x7299('0x6')][_0x7299('0x10')]));}ami[_0x7299('0x11')]=function(){return function(){return ami[_0x7299('0x12')]({'action':_0x7299('0x13')});};};ami[_0x7299('0x14')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x7299('0x15')]=function(){return function(){return ami[_0x7299('0x12')]({'action':_0x7299('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x7299('0x12')]({'action':_0x7299('0x17')});};};ami[_0x7299('0x18')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x122fc3){logger[_0x7299('0x19')](util['format'](_0x7299('0x1a'),config[_0x7299('0x6')][_0x7299('0xe')],config[_0x7299('0x6')]['ip'],config[_0x7299('0x6')][_0x7299('0x10')]));ami['once'](_0x7299('0xb'),error);ami[_0x7299('0x1b')](_0x7299('0x1c'),close);}ami['on'](_0x7299('0x1d'),connect);ami['on']('shutdown',function(_0x1bf9da){logger[_0x7299('0x19')](util['format'](_0x7299('0x1e'),config[_0x7299('0x6')][_0x7299('0xe')],config[_0x7299('0x6')]['ip'],config[_0x7299('0x6')]['port'],util[_0x7299('0x1f')](_0x1bf9da,![],null)));});ami['on'](_0x7299('0x20'),function(_0x64d991){logger['info'](util['format'](_0x7299('0x21'),config[_0x7299('0x6')]['username'],config[_0x7299('0x6')]['ip'],config[_0x7299('0x6')][_0x7299('0x10')]));return BPromise['resolve']()[_0x7299('0x22')](ami[_0x7299('0x11')]())[_0x7299('0x22')](ami[_0x7299('0x14')]())[_0x7299('0x22')](ami[_0x7299('0x15')]())[_0x7299('0x22')](ami[_0x7299('0x23')]())[_0x7299('0x22')](ami[_0x7299('0x18')]())[_0x7299('0x24')](function(_0x123971){console[_0x7299('0x25')](_0x123971);});});ami[_0x7299('0x1b')](_0x7299('0xb'),error);ami[_0x7299('0x1b')](_0x7299('0x1c'),close);module[_0x7299('0x26')]=ami; \ No newline at end of file +var _0x9d82=['close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','exports','moment','util','../../config/logger','ami','../../config/environment','port','asterisk','password','keepConnected','Action','promisify','action','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x411b5e,_0x4710ba){var _0xe38727=function(_0xc67dfa){while(--_0xc67dfa){_0x411b5e['push'](_0x411b5e['shift']());}};_0xe38727(++_0x4710ba);}(_0x9d82,0x120));var _0x29d8=function(_0x17a2df,_0x4bbe16){_0x17a2df=_0x17a2df-0x0;var _0x5d5177=_0x9d82[_0x17a2df];return _0x5d5177;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x29d8('0x0'));var util=require(_0x29d8('0x1'));var _=require('lodash');var logger=require(_0x29d8('0x2'))(_0x29d8('0x3'));var config=require(_0x29d8('0x4'));var ami=new Manager(config['asterisk'][_0x29d8('0x5')],config['asterisk']['ip'],config[_0x29d8('0x6')]['username'],config['asterisk'][_0x29d8('0x7')],!![]);ami[_0x29d8('0x8')]();ami[_0x29d8('0x9')]=BPromise[_0x29d8('0xa')](ami[_0x29d8('0xb')]);function error(_0x23ce93){logger['error'](util['format'](_0x29d8('0xc'),config['asterisk'][_0x29d8('0xd')],config[_0x29d8('0x6')]['ip'],config[_0x29d8('0x6')][_0x29d8('0x5')],util[_0x29d8('0xe')](_0x23ce93,![],null)));}function close(){logger[_0x29d8('0xf')](util[_0x29d8('0x10')](_0x29d8('0x11'),config[_0x29d8('0x6')][_0x29d8('0xd')],config[_0x29d8('0x6')]['ip'],config[_0x29d8('0x6')][_0x29d8('0x5')]));}ami[_0x29d8('0x12')]=function(){return function(){return ami[_0x29d8('0x9')]({'action':_0x29d8('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x29d8('0x9')]({'action':_0x29d8('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x29d8('0x9')]({'action':_0x29d8('0x15')});};};ami[_0x29d8('0x16')]=function(){return function(){return ami[_0x29d8('0x9')]({'action':_0x29d8('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x29d8('0x9')]({'action':_0x29d8('0x18')});};};function connect(_0x226c37){logger['info'](util[_0x29d8('0x10')](_0x29d8('0x19'),config[_0x29d8('0x6')]['username'],config['asterisk']['ip'],config[_0x29d8('0x6')][_0x29d8('0x5')]));ami[_0x29d8('0x1a')](_0x29d8('0xf'),error);ami[_0x29d8('0x1a')](_0x29d8('0x1b'),close);}ami['on'](_0x29d8('0x1c'),connect);ami['on']('shutdown',function(_0x3fe053){logger[_0x29d8('0x1d')](util[_0x29d8('0x10')](_0x29d8('0x1e'),config[_0x29d8('0x6')][_0x29d8('0xd')],config[_0x29d8('0x6')]['ip'],config[_0x29d8('0x6')][_0x29d8('0x5')],util[_0x29d8('0xe')](_0x3fe053,![],null)));});ami['on']('fullybooted',function(_0x27de28){logger[_0x29d8('0x1d')](util[_0x29d8('0x10')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x29d8('0x6')]['ip'],config[_0x29d8('0x6')][_0x29d8('0x5')]));return BPromise['resolve']()[_0x29d8('0x1f')](ami[_0x29d8('0x12')]())[_0x29d8('0x1f')](ami['actionDeviceStateList']())['then'](ami[_0x29d8('0x20')]())[_0x29d8('0x1f')](ami['actionQueueSummary']())[_0x29d8('0x1f')](ami['actionCoreShowChannels']())[_0x29d8('0x21')](function(_0x3c0212){console['log'](_0x3c0212);});});ami[_0x29d8('0x1a')]('error',error);ami[_0x29d8('0x1a')](_0x29d8('0x1b'),close);module[_0x29d8('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 481a68f..42077ef 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 _0xda66=['memberReport','error','message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request'];(function(_0x19cd2a,_0x52bf9e){var _0x41f8b7=function(_0x132d14){while(--_0x132d14){_0x19cd2a['push'](_0x19cd2a['shift']());}};_0x41f8b7(++_0x52bf9e);}(_0xda66,0x13b));var _0x6da6=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0xda66[_0x54cef6];return _0x39aacf;};'use strict';var jayson=require(_0x6da6('0x0'));var BPromise=require(_0x6da6('0x1'));var logger=require(_0x6da6('0x2'))('ami');var client=jayson[_0x6da6('0x3')][_0x6da6('0x4')]({'port':0x2329});client[_0x6da6('0x5')]=function(_0x5633c4,_0x52201e){return new BPromise(function(_0x3f0c3d,_0x538667){return client[_0x6da6('0x6')](_0x5633c4,_0x52201e)['then'](function(_0x12c1c6){logger['debug']('rpc',_0x6da6('0x7'),_0x5633c4,_0x52201e,_0x12c1c6);if(_0x12c1c6[_0x6da6('0x8')]){logger[_0x6da6('0x8')]('rpc',_0x6da6('0x7'),_0x5633c4,_0x12c1c6['error'][_0x6da6('0x9')],_0x52201e);return _0x538667(_0x12c1c6[_0x6da6('0x8')][_0x6da6('0x9')]);}else{return _0x3f0c3d(_0x12c1c6[_0x6da6('0xa')]);}})[_0x6da6('0xb')](function(_0x1abc27){logger[_0x6da6('0x8')](_0x6da6('0xc'),_0x6da6('0x7'),_0x5633c4,_0x1abc27,_0x52201e);return _0x538667(_0x1abc27);});});};module[_0x6da6('0xd')]=client; \ No newline at end of file +var _0x2629=['ami','client','http','request','debug','rpc','memberReport','error','result','exports','bluebird','../../config/logger'];(function(_0x3b6d31,_0x219167){var _0x491998=function(_0x4900ae){while(--_0x4900ae){_0x3b6d31['push'](_0x3b6d31['shift']());}};_0x491998(++_0x219167);}(_0x2629,0x1de));var _0x9262=function(_0x208d6f,_0x576241){_0x208d6f=_0x208d6f-0x0;var _0x398bbf=_0x2629[_0x208d6f];return _0x398bbf;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x9262('0x0'));var logger=require(_0x9262('0x1'))(_0x9262('0x2'));var client=jayson[_0x9262('0x3')][_0x9262('0x4')]({'port':0x2329});client['Request']=function(_0x461b71,_0x2b5795){return new BPromise(function(_0x4fff74,_0x3623a4){return client[_0x9262('0x5')](_0x461b71,_0x2b5795)['then'](function(_0x4ce789){logger[_0x9262('0x6')](_0x9262('0x7'),_0x9262('0x8'),_0x461b71,_0x2b5795,_0x4ce789);if(_0x4ce789[_0x9262('0x9')]){logger['error'](_0x9262('0x7'),_0x9262('0x8'),_0x461b71,_0x4ce789[_0x9262('0x9')]['message'],_0x2b5795);return _0x3623a4(_0x4ce789['error']['message']);}else{return _0x4fff74(_0x4ce789[_0x9262('0xa')]);}})['catch'](function(_0x442577){logger[_0x9262('0x9')](_0x9262('0x7'),_0x9262('0x8'),_0x461b71,_0x442577,_0x2b5795);return _0x3623a4(_0x442577);});});};module[_0x9262('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 345640e..27756e7 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 _0x7b08=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format'];(function(_0x53df78,_0x4312b9){var _0x4738f4=function(_0x57b547){while(--_0x57b547){_0x53df78['push'](_0x53df78['shift']());}};_0x4738f4(++_0x4312b9);}(_0x7b08,0x163));var _0x87b0=function(_0x476bbe,_0x124e5f){_0x476bbe=_0x476bbe-0x0;var _0x12c375=_0x7b08[_0x476bbe];return _0x12c375;};'use strict';var util=require(_0x87b0('0x0'));var _=require('lodash');var moment=require(_0x87b0('0x1'));function checkNameSurname(_0x1f11d2,_0x272df7,_0x511272){var _0x3769a5='';if(!_[_0x87b0('0x2')](_0x272df7)&&_0x87b0('0x3')===typeof _0x272df7){_0x3769a5+=_0x272df7;}if(!_[_0x87b0('0x2')](_0x511272)&&'string'===typeof _0x511272){_0x3769a5+='\x20'+_0x511272;}if(_0x3769a5!==''){return _0x3769a5;}return _0x1f11d2;}function Action(_0x3d06e7,_0x2b7526,_0x233040){this[_0x87b0('0x4')]=_0x3d06e7;this[_0x87b0('0x5')]=_0x233040||undefined;this[_0x87b0('0x6')]=checkNameSurname(_0x2b7526[_0x87b0('0x7')][_0x87b0('0x8')],_0x2b7526[_0x87b0('0x7')][_0x87b0('0x9')],_0x2b7526['Contact'][_0x87b0('0xa')]);this[_0x87b0('0xb')]=_0x2b7526[_0x87b0('0x7')][_0x87b0('0x8')];this[_0x87b0('0xc')]=_0x3d06e7[_0x87b0('0x6')];this['active']=_0x2b7526['active']||![];this[_0x87b0('0xd')]=_0x3d06e7[_0x87b0('0xd')];this[_0x87b0('0xe')]=_0x3d06e7[_0x87b0('0xe')]||0x3;this[_0x87b0('0xf')]=_0x2b7526[_0x87b0('0xf')];this['countbusyretry']=_0x2b7526[_0x87b0('0x10')];this[_0x87b0('0x11')]=_0x2b7526['countcongestionretry'];this['countnoanswerretry']=_0x2b7526[_0x87b0('0x12')];this['countnosuchnumberretry']=_0x2b7526['countnosuchnumberretry'];this['countdropretry']=_0x2b7526[_0x87b0('0x13')];this[_0x87b0('0x14')]=_0x2b7526['countabandonedretry'];this[_0x87b0('0x15')]=_0x2b7526[_0x87b0('0x15')];this[_0x87b0('0x16')]=_0x2b7526[_0x87b0('0x16')];this[_0x87b0('0x17')]=_0x2b7526[_0x87b0('0x17')];this[_0x87b0('0x18')]=_0x2b7526[_0x87b0('0x18')];this[_0x87b0('0x19')]=_0x2b7526[_0x87b0('0x19')];this['VoiceQueueId']=_0x2b7526[_0x87b0('0x1a')];this[_0x87b0('0x1b')]=_0x2b7526['CampaignId'];this[_0x87b0('0x1c')]=_0x2b7526['id'];this[_0x87b0('0x1d')]=_0x2b7526[_0x87b0('0x7')]['firstName']||'';this[_0x87b0('0x1e')]=moment()[_0x87b0('0x1f')](_0x87b0('0x20'));this[_0x87b0('0x21')]=_0x2b7526['callback'];this[_0x87b0('0x22')]=_0x2b7526[_0x87b0('0x22')];this[_0x87b0('0x23')]=_0x2b7526[_0x87b0('0x23')];this[_0x87b0('0x24')]=_0x2b7526[_0x87b0('0x24')];this[_0x87b0('0x25')]='';this[_0x87b0('0x26')]='';}Action[_0x87b0('0x27')]['getCaller']=function(){return util[_0x87b0('0x1f')]('\x22%s\x22\x20<%s>',this[_0x87b0('0x6')],this[_0x87b0('0x4')]['dialCutDigit']>0x0?this[_0x87b0('0xb')][_0x87b0('0x28')](this['voiceQueue']['dialCutDigit']):this[_0x87b0('0xb')]);};Action['prototype'][_0x87b0('0x29')]=function(){return this[_0x87b0('0xc')];};module[_0x87b0('0x2a')]=Action; \ No newline at end of file +var _0xdd1d=['callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','name','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x41a44c,_0x29078){var _0x233a1c=function(_0x2608c9){while(--_0x2608c9){_0x41a44c['push'](_0x41a44c['shift']());}};_0x233a1c(++_0x29078);}(_0xdd1d,0xb2));var _0xddd1=function(_0x1a5687,_0xc2188f){_0x1a5687=_0x1a5687-0x0;var _0x257d5c=_0xdd1d[_0x1a5687];return _0x257d5c;};'use strict';var util=require(_0xddd1('0x0'));var _=require(_0xddd1('0x1'));var moment=require(_0xddd1('0x2'));function checkNameSurname(_0x1c22ac,_0x387b61,_0x4f974c){var _0x3f4152='';if(!_[_0xddd1('0x3')](_0x387b61)&&_0xddd1('0x4')===typeof _0x387b61){_0x3f4152+=_0x387b61;}if(!_['isNil'](_0x4f974c)&&_0xddd1('0x4')===typeof _0x4f974c){_0x3f4152+='\x20'+_0x4f974c;}if(_0x3f4152!==''){return _0x3f4152;}return _0x1c22ac;}function Action(_0x5e7e44,_0x18f5d2,_0x3ba6a9){this[_0xddd1('0x5')]=_0x5e7e44;this['uniqueid']=_0x3ba6a9||undefined;this['name']=checkNameSurname(_0x18f5d2[_0xddd1('0x6')][_0xddd1('0x7')],_0x18f5d2[_0xddd1('0x6')][_0xddd1('0x8')],_0x18f5d2[_0xddd1('0x6')][_0xddd1('0x9')]);this[_0xddd1('0xa')]=_0x18f5d2[_0xddd1('0x6')]['phone'];this[_0xddd1('0xb')]=_0x5e7e44['name'];this[_0xddd1('0xc')]=_0x18f5d2['active']||![];this[_0xddd1('0xd')]=_0x5e7e44['type'];this['dialQueueTimeout']=_0x5e7e44[_0xddd1('0xe')]||0x3;this[_0xddd1('0xf')]=_0x18f5d2[_0xddd1('0xf')];this['countbusyretry']=_0x18f5d2[_0xddd1('0x10')];this['countcongestionretry']=_0x18f5d2[_0xddd1('0x11')];this[_0xddd1('0x12')]=_0x18f5d2[_0xddd1('0x12')];this[_0xddd1('0x13')]=_0x18f5d2[_0xddd1('0x13')];this[_0xddd1('0x14')]=_0x18f5d2['countdropretry'];this[_0xddd1('0x15')]=_0x18f5d2[_0xddd1('0x15')];this[_0xddd1('0x16')]=_0x18f5d2[_0xddd1('0x16')];this['countagentrejectretry']=_0x18f5d2['countagentrejectretry'];this['ContactId']=_0x18f5d2[_0xddd1('0x17')];this['ListId']=_0x18f5d2['ListId'];this[_0xddd1('0x18')]=_0x18f5d2[_0xddd1('0x18')];this['VoiceQueueId']=_0x18f5d2[_0xddd1('0x19')];this['CampaignId']=_0x18f5d2[_0xddd1('0x1a')];this['idHopper']=_0x18f5d2['id'];this[_0xddd1('0x1b')]=_0x18f5d2['Contact'][_0xddd1('0x8')]||'';this['starttime']=moment()[_0xddd1('0x1c')](_0xddd1('0x1d'));this[_0xddd1('0x1e')]=_0x18f5d2[_0xddd1('0x1e')];this[_0xddd1('0x1f')]=_0x18f5d2[_0xddd1('0x1f')];this['callbackat']=_0x18f5d2[_0xddd1('0x20')];this[_0xddd1('0x21')]=_0x18f5d2[_0xddd1('0x21')];this[_0xddd1('0x22')]='';this[_0xddd1('0x23')]='';}Action[_0xddd1('0x24')][_0xddd1('0x25')]=function(){return util[_0xddd1('0x1c')]('\x22%s\x22\x20<%s>',this[_0xddd1('0x26')],this[_0xddd1('0x5')][_0xddd1('0x27')]>0x0?this[_0xddd1('0xa')][_0xddd1('0x28')](this[_0xddd1('0x5')]['dialCutDigit']):this[_0xddd1('0xa')]);};Action[_0xddd1('0x24')][_0xddd1('0x29')]=function(){return this[_0xddd1('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 8cfcd7d..c799378 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee8e=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0xee8e,0x15c));var _0xeee8=function(_0x4a98b4,_0x3d7b61){_0x4a98b4=_0x4a98b4-0x0;var _0x4c443a=_0xee8e[_0x4a98b4];return _0x4c443a;};'use strict';var util=require(_0xeee8('0x0'));var _=require(_0xeee8('0x1'));var moment=require(_0xeee8('0x2'));function getSeconds(_0x49580a,_0x1e9fe4){var _0x83551d=moment(_0x49580a)[_0xeee8('0x3')](0x0);var _0x5a3af5=moment(_0x1e9fe4)['milliseconds'](0x0);return _0x83551d[_0xeee8('0x4')](_0x5a3af5,_0xeee8('0x5'));}function AdditionalPhone(_0x404f0a){this[_0xeee8('0x6')]=_0x404f0a[_0xeee8('0x6')];this[_0xeee8('0x7')]=_0x404f0a[_0xeee8('0x7')]||undefined;this[_0xeee8('0x8')]=_0x404f0a['type'];this[_0xeee8('0x9')]=_0x404f0a[_0xeee8('0x8')]==='outbound'?_0xeee8('0xa'):_0x404f0a[_0xeee8('0x8')];this[_0xeee8('0xb')]=_0x404f0a[_0xeee8('0xb')];this[_0xeee8('0xc')]=_0x404f0a[_0xeee8('0xc')];this[_0xeee8('0xd')]=_0x404f0a['countnoanswerretry'];this['countglobal']=_0x404f0a[_0xeee8('0xb')]+_0x404f0a['countcongestionretry']+_0x404f0a[_0xeee8('0xd')]+_0x404f0a[_0xeee8('0xe')]+_0x404f0a['countdropretry']+_0x404f0a[_0xeee8('0xf')]+_0x404f0a[_0xeee8('0x10')]+_0x404f0a[_0xeee8('0x11')];this['countnosuchnumberretry']=_0x404f0a['countnosuchnumberretry'];this[_0xeee8('0x12')]=_0x404f0a[_0xeee8('0x12')];this[_0xeee8('0xf')]=_0x404f0a[_0xeee8('0xf')];this[_0xeee8('0x10')]=_0x404f0a[_0xeee8('0x10')];this['countagentrejectretry']=_0x404f0a[_0xeee8('0x11')];this[_0xeee8('0xa')]=_0x404f0a[_0xeee8('0xa')];this['calleridname']=_0x404f0a[_0xeee8('0x13')];this[_0xeee8('0x14')]=_0x404f0a[_0xeee8('0x15')];this[_0xeee8('0x16')]=_0x404f0a[_0xeee8('0x16')];this['responsetime']=_0x404f0a[_0xeee8('0x17')];this[_0xeee8('0x18')]=_0x404f0a[_0xeee8('0x17')];this[_0xeee8('0x19')]=getSeconds(_0x404f0a[_0xeee8('0x17')],_0x404f0a[_0xeee8('0x16')]);this[_0xeee8('0x1a')]=0x0;this[_0xeee8('0x1b')]=0x0;this[_0xeee8('0x1c')]=_0x404f0a[_0xeee8('0x1c')];this[_0xeee8('0x1d')]=_0x404f0a[_0xeee8('0x1d')];this[_0xeee8('0x1e')]=_0x404f0a[_0xeee8('0x1e')];this[_0xeee8('0x1f')]=_0x404f0a[_0xeee8('0x1f')];this[_0xeee8('0x20')]=_0x404f0a[_0xeee8('0x20')];this[_0xeee8('0x21')]=_0x404f0a[_0xeee8('0x21')];this['UserId']=_0x404f0a[_0xeee8('0x22')];this['VoiceQueueId']=_0x404f0a[_0xeee8('0x23')];this[_0xeee8('0x24')]=_0x404f0a[_0xeee8('0x24')];this[_0xeee8('0x25')]=_0x404f0a[_0xeee8('0x25')]||'';this['originatecalleridname']=_0x404f0a['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x0ae2=['ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x2acb72,_0xca1a4e){var _0x101468=function(_0x32b236){while(--_0x32b236){_0x2acb72['push'](_0x2acb72['shift']());}};_0x101468(++_0xca1a4e);}(_0x0ae2,0x11f));var _0x20ae=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x0ae2[_0x4f2c3a];return _0x17d91c;};'use strict';var util=require(_0x20ae('0x0'));var _=require(_0x20ae('0x1'));var moment=require(_0x20ae('0x2'));function getSeconds(_0x52bed1,_0x5de9f6){var _0x54515d=moment(_0x52bed1)[_0x20ae('0x3')](0x0);var _0x50d247=moment(_0x5de9f6)[_0x20ae('0x3')](0x0);return _0x54515d[_0x20ae('0x4')](_0x50d247,_0x20ae('0x5'));}function AdditionalPhone(_0x4ceef3){this[_0x20ae('0x6')]=_0x4ceef3[_0x20ae('0x6')];this[_0x20ae('0x7')]=_0x4ceef3['scheduledat']||undefined;this['type']=_0x4ceef3[_0x20ae('0x8')];this[_0x20ae('0x9')]=_0x4ceef3['type']==='outbound'?_0x20ae('0xa'):_0x4ceef3[_0x20ae('0x8')];this[_0x20ae('0xb')]=_0x4ceef3[_0x20ae('0xb')];this['countcongestionretry']=_0x4ceef3['countcongestionretry'];this[_0x20ae('0xc')]=_0x4ceef3[_0x20ae('0xc')];this['countglobal']=_0x4ceef3[_0x20ae('0xb')]+_0x4ceef3[_0x20ae('0xd')]+_0x4ceef3[_0x20ae('0xc')]+_0x4ceef3['countnosuchnumberretry']+_0x4ceef3[_0x20ae('0xe')]+_0x4ceef3[_0x20ae('0xf')]+_0x4ceef3[_0x20ae('0x10')]+_0x4ceef3[_0x20ae('0x11')];this[_0x20ae('0x12')]=_0x4ceef3[_0x20ae('0x12')];this[_0x20ae('0xe')]=_0x4ceef3[_0x20ae('0xe')];this[_0x20ae('0xf')]=_0x4ceef3['countabandonedretry'];this[_0x20ae('0x10')]=_0x4ceef3['countmachineretry'];this['countagentrejectretry']=_0x4ceef3[_0x20ae('0x11')];this[_0x20ae('0xa')]=_0x4ceef3[_0x20ae('0xa')];this['calleridname']=_0x4ceef3[_0x20ae('0x13')];this[_0x20ae('0x14')]=_0x4ceef3[_0x20ae('0x15')];this[_0x20ae('0x16')]=_0x4ceef3[_0x20ae('0x16')];this[_0x20ae('0x17')]=_0x4ceef3['responsetime'];this[_0x20ae('0x18')]=_0x4ceef3[_0x20ae('0x17')];this[_0x20ae('0x19')]=getSeconds(_0x4ceef3[_0x20ae('0x17')],_0x4ceef3[_0x20ae('0x16')]);this[_0x20ae('0x1a')]=0x0;this['talktime']=0x0;this[_0x20ae('0x1b')]=_0x4ceef3['callback'];this[_0x20ae('0x1c')]=_0x4ceef3[_0x20ae('0x1c')];this['callbackat']=_0x4ceef3[_0x20ae('0x1d')];this[_0x20ae('0x1e')]=_0x4ceef3[_0x20ae('0x1e')];this[_0x20ae('0x1f')]=_0x4ceef3[_0x20ae('0x1f')];this[_0x20ae('0x20')]=_0x4ceef3[_0x20ae('0x20')];this[_0x20ae('0x21')]=_0x4ceef3[_0x20ae('0x21')];this[_0x20ae('0x22')]=_0x4ceef3[_0x20ae('0x22')];this[_0x20ae('0x23')]=_0x4ceef3['CampaignId'];this[_0x20ae('0x24')]=_0x4ceef3['originatecalleridnum']||'';this['originatecalleridname']=_0x4ceef3[_0x20ae('0x25')]||'';}module[_0x20ae('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 02d4e54..bc231f9 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 _0x695f=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','starttime','holdtime','talktime','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x695f,0x1f2));var _0xf695=function(_0x59d272,_0x860edf){_0x59d272=_0x59d272-0x0;var _0x45d01f=_0x695f[_0x59d272];return _0x45d01f;};'use strict';var util=require(_0xf695('0x0'));var _=require(_0xf695('0x1'));var moment=require(_0xf695('0x2'));function getSeconds(_0xa3bed6,_0x147ddc){var _0x2101e1=moment(_0xa3bed6)[_0xf695('0x3')](0x0);var _0x438ade=moment(_0x147ddc)[_0xf695('0x3')](0x0);return _0x2101e1[_0xf695('0x4')](_0x438ade,_0xf695('0x5'));}function AgentComplete(_0x2c01ed,_0x2ebe5d){this['state']=0x4;this['statedesc']=_0xf695('0x6');this[_0xf695('0x7')]=_0x2c01ed[_0xf695('0x7')];this[_0xf695('0x8')]=_0x2c01ed['type'];this[_0xf695('0x9')]=_0x2c01ed[_0xf695('0x8')]===_0xf695('0xa')?_0xf695('0xb'):_0x2c01ed[_0xf695('0x8')];this[_0xf695('0xc')]=_0x2c01ed[_0xf695('0xc')];this[_0xf695('0xd')]=_0x2c01ed[_0xf695('0xd')];this['countnoanswerretry']=_0x2c01ed[_0xf695('0xe')];this[_0xf695('0xf')]=_0x2c01ed[_0xf695('0xc')]+_0x2c01ed[_0xf695('0xd')]+_0x2c01ed['countnoanswerretry']+_0x2c01ed['countnosuchnumberretry']+_0x2c01ed[_0xf695('0x10')]+_0x2c01ed[_0xf695('0x11')]+_0x2c01ed['countmachineretry']+_0x2c01ed['countagentrejectretry'];this[_0xf695('0x12')]=_0x2c01ed[_0xf695('0x12')];this['countdropretry']=_0x2c01ed['countdropretry'];this[_0xf695('0x11')]=_0x2c01ed[_0xf695('0x11')];this['countmachineretry']=_0x2c01ed[_0xf695('0x13')];this['countagentrejectretry']=_0x2c01ed[_0xf695('0x14')];this['uniqueid']=_0x2ebe5d[_0xf695('0x15')];this[_0xf695('0x16')]=_0x2c01ed[_0xf695('0x17')];this[_0xf695('0x18')]=_0x2c01ed[_0xf695('0x19')];this['starttime']=_0x2c01ed['starttime'];this[_0xf695('0x1a')]=_0x2c01ed[_0xf695('0x1a')];this[_0xf695('0x1b')]=_0x2c01ed['answertime'];this[_0xf695('0x1c')]=moment()[_0xf695('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x2c01ed[_0xf695('0x1a')],_0x2c01ed[_0xf695('0x1e')]);this[_0xf695('0x1f')]=getSeconds(_0x2c01ed[_0xf695('0x1b')],_0x2c01ed[_0xf695('0x1a')]);this[_0xf695('0x20')]=getSeconds(this[_0xf695('0x1c')],_0x2c01ed[_0xf695('0x1b')]);this[_0xf695('0xb')]=_0x2ebe5d[_0xf695('0xb')];this['membername']=_0x2ebe5d['membername'];this[_0xf695('0x21')]=_0x2ebe5d[_0xf695('0x21')];this[_0xf695('0x22')]=_0x2c01ed[_0xf695('0x22')];this['callbackuniqueid']=_0x2c01ed['callbackuniqueid'];this[_0xf695('0x23')]=_0x2c01ed[_0xf695('0x23')];this[_0xf695('0x24')]=_0x2c01ed[_0xf695('0x24')];this[_0xf695('0x25')]=_0x2c01ed[_0xf695('0x25')];this['ListId']=_0x2c01ed[_0xf695('0x26')];this[_0xf695('0x27')]=_0x2c01ed[_0xf695('0x27')];this[_0xf695('0x28')]=_0x2c01ed['VoiceQueueId'];this[_0xf695('0x29')]=_0x2c01ed[_0xf695('0x29')];this[_0xf695('0x2a')]=_0x2c01ed['originatecalleridnum']||'';this['originatecalleridname']=_0x2c01ed[_0xf695('0x2b')]||'';}module[_0xf695('0x2c')]=AgentComplete; \ No newline at end of file +var _0xdd29=['responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xdd29,0x1d5));var _0x9dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd29[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9dd2('0x0'));var _=require('lodash');var moment=require(_0x9dd2('0x1'));function getSeconds(_0x4fe44e,_0x4800b3){var _0x3732a9=moment(_0x4fe44e)[_0x9dd2('0x2')](0x0);var _0x32bbce=moment(_0x4800b3)[_0x9dd2('0x2')](0x0);return _0x3732a9[_0x9dd2('0x3')](_0x32bbce,_0x9dd2('0x4'));}function AgentComplete(_0x169639,_0x2d756b){this[_0x9dd2('0x5')]=0x4;this[_0x9dd2('0x6')]=_0x9dd2('0x7');this[_0x9dd2('0x8')]=_0x169639[_0x9dd2('0x8')];this[_0x9dd2('0x9')]=_0x169639['type'];this[_0x9dd2('0xa')]=_0x169639[_0x9dd2('0x9')]===_0x9dd2('0xb')?_0x9dd2('0xc'):_0x169639[_0x9dd2('0x9')];this[_0x9dd2('0xd')]=_0x169639[_0x9dd2('0xd')];this['countcongestionretry']=_0x169639[_0x9dd2('0xe')];this['countnoanswerretry']=_0x169639[_0x9dd2('0xf')];this[_0x9dd2('0x10')]=_0x169639[_0x9dd2('0xd')]+_0x169639[_0x9dd2('0xe')]+_0x169639[_0x9dd2('0xf')]+_0x169639['countnosuchnumberretry']+_0x169639['countdropretry']+_0x169639['countabandonedretry']+_0x169639['countmachineretry']+_0x169639[_0x9dd2('0x11')];this[_0x9dd2('0x12')]=_0x169639[_0x9dd2('0x12')];this[_0x9dd2('0x13')]=_0x169639[_0x9dd2('0x13')];this[_0x9dd2('0x14')]=_0x169639[_0x9dd2('0x14')];this[_0x9dd2('0x15')]=_0x169639[_0x9dd2('0x15')];this[_0x9dd2('0x11')]=_0x169639[_0x9dd2('0x11')];this[_0x9dd2('0x16')]=_0x2d756b[_0x9dd2('0x16')];this[_0x9dd2('0x17')]=_0x169639['name'];this[_0x9dd2('0x18')]=_0x169639['number'];this[_0x9dd2('0x19')]=_0x169639[_0x9dd2('0x19')];this[_0x9dd2('0x1a')]=_0x169639[_0x9dd2('0x1a')];this[_0x9dd2('0x1b')]=_0x169639[_0x9dd2('0x1b')];this[_0x9dd2('0x1c')]=moment()['format'](_0x9dd2('0x1d'));this[_0x9dd2('0x1e')]=getSeconds(_0x169639['responsetime'],_0x169639[_0x9dd2('0x19')]);this[_0x9dd2('0x1f')]=getSeconds(_0x169639[_0x9dd2('0x1b')],_0x169639[_0x9dd2('0x1a')]);this[_0x9dd2('0x20')]=getSeconds(this[_0x9dd2('0x1c')],_0x169639['answertime']);this[_0x9dd2('0xc')]=_0x2d756b[_0x9dd2('0xc')];this[_0x9dd2('0x21')]=_0x2d756b['membername'];this['reason']=_0x2d756b[_0x9dd2('0x22')];this[_0x9dd2('0x23')]=_0x169639[_0x9dd2('0x23')];this[_0x9dd2('0x24')]=_0x169639[_0x9dd2('0x24')];this[_0x9dd2('0x25')]=_0x169639[_0x9dd2('0x25')];this[_0x9dd2('0x26')]=_0x169639['recallme'];this[_0x9dd2('0x27')]=_0x169639[_0x9dd2('0x27')];this['ListId']=_0x169639['ListId'];this['UserId']=_0x169639['UserId'];this['VoiceQueueId']=_0x169639[_0x9dd2('0x28')];this[_0x9dd2('0x29')]=_0x169639[_0x9dd2('0x29')];this['originatecalleridnum']=_0x169639[_0x9dd2('0x2a')]||'';this[_0x9dd2('0x2b')]=_0x169639[_0x9dd2('0x2b')]||'';}module[_0x9dd2('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index cef0922..a9cbd96 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 _0xfa89=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x3cf89e,_0x4c40bb){var _0x168c11=function(_0x562e77){while(--_0x562e77){_0x3cf89e['push'](_0x3cf89e['shift']());}};_0x168c11(++_0x4c40bb);}(_0xfa89,0x1ec));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9fa8('0x0'));var _=require(_0x9fa8('0x1'));var moment=require(_0x9fa8('0x2'));function getSeconds(_0x5ed8dc,_0xefcdec){var _0x192e5b=moment(_0x5ed8dc)[_0x9fa8('0x3')](0x0);var _0x444714=moment(_0xefcdec)['milliseconds'](0x0);return _0x192e5b[_0x9fa8('0x4')](_0x444714,_0x9fa8('0x5'));}function Final(_0x554024){this[_0x9fa8('0x6')]=_0x554024[_0x9fa8('0x6')];this['scheduledat']=_0x554024[_0x9fa8('0x7')];this['type']=_0x554024[_0x9fa8('0x8')];this[_0x9fa8('0x9')]=_0x554024[_0x9fa8('0x8')]===_0x9fa8('0xa')?_0x9fa8('0xb'):_0x554024[_0x9fa8('0x8')];this[_0x9fa8('0xc')]=_0x554024[_0x9fa8('0xc')];this['countcongestionretry']=_0x554024[_0x9fa8('0xd')];this['countnoanswerretry']=_0x554024['countnoanswerretry'];this['countglobal']=_0x554024[_0x9fa8('0xc')]+_0x554024[_0x9fa8('0xd')]+_0x554024['countnoanswerretry']+_0x554024[_0x9fa8('0xe')]+_0x554024['countdropretry']+_0x554024[_0x9fa8('0xf')]+_0x554024[_0x9fa8('0x10')]+_0x554024['countagentrejectretry'];this[_0x9fa8('0xe')]=_0x554024[_0x9fa8('0xe')];this[_0x9fa8('0x11')]=_0x554024[_0x9fa8('0x11')];this[_0x9fa8('0xf')]=_0x554024['countabandonedretry'];this[_0x9fa8('0x10')]=_0x554024[_0x9fa8('0x10')];this[_0x9fa8('0x12')]=_0x554024[_0x9fa8('0x12')];this[_0x9fa8('0xb')]=_0x554024[_0x9fa8('0xb')];this['calleridname']=_0x554024['calleridname'];this[_0x9fa8('0x13')]=_0x554024[_0x9fa8('0x13')];this['starttime']=_0x554024[_0x9fa8('0x14')];this['responsetime']=_0x554024[_0x9fa8('0x15')];this[_0x9fa8('0x16')]=_0x554024['responsetime'];this[_0x9fa8('0x17')]=_0x554024[_0x9fa8('0x17')]||0x0;this[_0x9fa8('0x18')]=_0x554024[_0x9fa8('0x18')]||0x0;this[_0x9fa8('0x19')]=_0x554024[_0x9fa8('0x19')]||0x0;this[_0x9fa8('0x1a')]=_0x554024[_0x9fa8('0x1a')];this[_0x9fa8('0x1b')]=_0x554024['callbackuniqueid'];this[_0x9fa8('0x1c')]=_0x554024[_0x9fa8('0x1c')];this['recallme']=_0x554024[_0x9fa8('0x1d')];this[_0x9fa8('0x1e')]=_0x554024['ContactId'];this[_0x9fa8('0x1f')]=_0x554024['ListId'];this['UserId']=_0x554024[_0x9fa8('0x20')];this[_0x9fa8('0x21')]=_0x554024[_0x9fa8('0x21')];this[_0x9fa8('0x22')]=_0x554024[_0x9fa8('0x22')];this['originatecalleridnum']=_0x554024['originatecalleridnum']||'';this[_0x9fa8('0x23')]=_0x554024['originatecalleridname']||'';}module[_0x9fa8('0x24')]=Final; \ No newline at end of file +var _0x9970=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3cec7e,_0x9decf5){var _0xdb488d=function(_0x4bd7d8){while(--_0x4bd7d8){_0x3cec7e['push'](_0x3cec7e['shift']());}};_0xdb488d(++_0x9decf5);}(_0x9970,0x1c0));var _0x0997=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x9970[_0x102e37];return _0x35a07c;};'use strict';var util=require(_0x0997('0x0'));var _=require(_0x0997('0x1'));var moment=require('moment');function getSeconds(_0x4eba0c,_0x10d080){var _0x4b1931=moment(_0x4eba0c)['milliseconds'](0x0);var _0x23aa2d=moment(_0x10d080)[_0x0997('0x2')](0x0);return _0x4b1931[_0x0997('0x3')](_0x23aa2d,_0x0997('0x4'));}function Final(_0x4313a2){this[_0x0997('0x5')]=_0x4313a2[_0x0997('0x5')];this[_0x0997('0x6')]=_0x4313a2[_0x0997('0x6')];this[_0x0997('0x7')]=_0x4313a2[_0x0997('0x7')];this[_0x0997('0x8')]=_0x4313a2['type']===_0x0997('0x9')?_0x0997('0xa'):_0x4313a2[_0x0997('0x7')];this[_0x0997('0xb')]=_0x4313a2[_0x0997('0xb')];this[_0x0997('0xc')]=_0x4313a2[_0x0997('0xc')];this[_0x0997('0xd')]=_0x4313a2[_0x0997('0xd')];this[_0x0997('0xe')]=_0x4313a2['countbusyretry']+_0x4313a2[_0x0997('0xc')]+_0x4313a2[_0x0997('0xd')]+_0x4313a2[_0x0997('0xf')]+_0x4313a2[_0x0997('0x10')]+_0x4313a2[_0x0997('0x11')]+_0x4313a2[_0x0997('0x12')]+_0x4313a2[_0x0997('0x13')];this[_0x0997('0xf')]=_0x4313a2[_0x0997('0xf')];this[_0x0997('0x10')]=_0x4313a2['countdropretry'];this[_0x0997('0x11')]=_0x4313a2['countabandonedretry'];this['countmachineretry']=_0x4313a2[_0x0997('0x12')];this['countagentrejectretry']=_0x4313a2[_0x0997('0x13')];this['queue']=_0x4313a2[_0x0997('0xa')];this['calleridname']=_0x4313a2['calleridname'];this[_0x0997('0x14')]=_0x4313a2[_0x0997('0x14')];this[_0x0997('0x15')]=_0x4313a2[_0x0997('0x15')];this[_0x0997('0x16')]=_0x4313a2['responsetime'];this[_0x0997('0x17')]=_0x4313a2[_0x0997('0x16')];this[_0x0997('0x18')]=_0x4313a2[_0x0997('0x18')]||0x0;this[_0x0997('0x19')]=_0x4313a2[_0x0997('0x19')]||0x0;this[_0x0997('0x1a')]=_0x4313a2[_0x0997('0x1a')]||0x0;this['callback']=_0x4313a2['callback'];this[_0x0997('0x1b')]=_0x4313a2[_0x0997('0x1b')];this[_0x0997('0x1c')]=_0x4313a2['callbackat'];this['recallme']=_0x4313a2[_0x0997('0x1d')];this[_0x0997('0x1e')]=_0x4313a2[_0x0997('0x1e')];this[_0x0997('0x1f')]=_0x4313a2['ListId'];this['UserId']=_0x4313a2[_0x0997('0x20')];this[_0x0997('0x21')]=_0x4313a2[_0x0997('0x21')];this[_0x0997('0x22')]=_0x4313a2[_0x0997('0x22')];this[_0x0997('0x23')]=_0x4313a2['originatecalleridnum']||'';this['originatecalleridname']=_0x4313a2[_0x0997('0x24')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index dc6df14..2380e10 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 _0x724d=['talktime','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x233fbe,_0x9ce1e8){var _0x2da2aa=function(_0x3162b0){while(--_0x3162b0){_0x233fbe['push'](_0x233fbe['shift']());}};_0x2da2aa(++_0x9ce1e8);}(_0x724d,0x12c));var _0xd724=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x724d[_0x2cc8bb];return _0x140e40;};'use strict';var util=require(_0xd724('0x0'));var _=require(_0xd724('0x1'));var moment=require(_0xd724('0x2'));function getSeconds(_0x479832,_0x46abe8){var _0x3b18b3=moment(_0x479832)[_0xd724('0x3')](0x0);var _0x114abe=moment(_0x46abe8)[_0xd724('0x3')](0x0);return _0x3b18b3[_0xd724('0x4')](_0x114abe,_0xd724('0x5'));}function Hangup(_0x5be629,_0x269f15){this[_0xd724('0x6')]=0x4;this['statedesc']=_0xd724('0x7');this[_0xd724('0x8')]=_0x5be629[_0xd724('0x8')];this[_0xd724('0x9')]=_0x5be629['type'];this['campaigntype']=_0x5be629[_0xd724('0x9')]===_0xd724('0xa')?_0xd724('0xb'):_0x5be629['type'];this[_0xd724('0xc')]=_0x5be629[_0xd724('0xc')];this[_0xd724('0xd')]=_0x5be629[_0xd724('0xd')];this['countnoanswerretry']=_0x5be629[_0xd724('0xe')];this[_0xd724('0xf')]=_0x5be629[_0xd724('0xc')]+_0x5be629['countcongestionretry']+_0x5be629[_0xd724('0xe')]+_0x5be629[_0xd724('0x10')]+_0x5be629[_0xd724('0x11')]+_0x5be629[_0xd724('0x12')]+_0x5be629[_0xd724('0x13')]+_0x5be629[_0xd724('0x14')];this[_0xd724('0x10')]=_0x5be629[_0xd724('0x10')];this[_0xd724('0x11')]=_0x5be629[_0xd724('0x11')];this[_0xd724('0x12')]=_0x5be629[_0xd724('0x12')];this[_0xd724('0x13')]=_0x5be629['countmachineretry'];this['countagentrejectretry']=_0x5be629['countagentrejectretry'];this['uniqueid']=_0x269f15['uniqueid'];this[_0xd724('0x15')]=_0x5be629['name'];this['calleridnum']=_0x5be629['number'];this[_0xd724('0x16')]=_0x5be629[_0xd724('0x16')];this['responsetime']=_0x5be629[_0xd724('0x17')];this[_0xd724('0x18')]=moment()['format'](_0xd724('0x19'));this[_0xd724('0x1a')]=getSeconds(_0x5be629[_0xd724('0x17')],_0x5be629[_0xd724('0x16')]);this[_0xd724('0x1b')]=0x0;this[_0xd724('0x1c')]=getSeconds(this[_0xd724('0x18')],_0x5be629[_0xd724('0x17')]);this['queue']=_0x5be629[_0xd724('0xb')];this[_0xd724('0x1d')]=_0xd724('0x1e');this['reason']=_0x269f15['cause-txt'];this['callback']=_0x5be629[_0xd724('0x1f')];this['callbackuniqueid']=_0x5be629[_0xd724('0x20')];this['callbackat']=_0x5be629[_0xd724('0x21')];this['recallme']=_0x5be629[_0xd724('0x22')];this[_0xd724('0x23')]=_0x5be629[_0xd724('0x23')];this[_0xd724('0x24')]=_0x5be629[_0xd724('0x24')];this[_0xd724('0x25')]=_0x5be629[_0xd724('0x25')];this[_0xd724('0x26')]=_0x5be629[_0xd724('0x26')];this['CampaignId']=_0x5be629[_0xd724('0x27')];}module[_0xd724('0x28')]=Hangup; \ No newline at end of file +var _0x6dd3=['statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','responsetime','endtime','format','ringtime','starttime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state'];(function(_0x1aa4ee,_0x323830){var _0x107d8d=function(_0xe59d7e){while(--_0xe59d7e){_0x1aa4ee['push'](_0x1aa4ee['shift']());}};_0x107d8d(++_0x323830);}(_0x6dd3,0xcc));var _0x36dd=function(_0x3a20d9,_0x23dbaf){_0x3a20d9=_0x3a20d9-0x0;var _0x2475ad=_0x6dd3[_0x3a20d9];return _0x2475ad;};'use strict';var util=require(_0x36dd('0x0'));var _=require(_0x36dd('0x1'));var moment=require(_0x36dd('0x2'));function getSeconds(_0x3a853e,_0x50c621){var _0x56a2a1=moment(_0x3a853e)[_0x36dd('0x3')](0x0);var _0x12887d=moment(_0x50c621)['milliseconds'](0x0);return _0x56a2a1['diff'](_0x12887d,_0x36dd('0x4'));}function Hangup(_0x5893ef,_0x405a30){this[_0x36dd('0x5')]=0x4;this[_0x36dd('0x6')]=_0x36dd('0x7');this['scheduledat']=_0x5893ef['scheduledat'];this['type']=_0x5893ef[_0x36dd('0x8')];this[_0x36dd('0x9')]=_0x5893ef[_0x36dd('0x8')]===_0x36dd('0xa')?_0x36dd('0xb'):_0x5893ef[_0x36dd('0x8')];this[_0x36dd('0xc')]=_0x5893ef[_0x36dd('0xc')];this[_0x36dd('0xd')]=_0x5893ef[_0x36dd('0xd')];this[_0x36dd('0xe')]=_0x5893ef[_0x36dd('0xe')];this['countglobal']=_0x5893ef[_0x36dd('0xc')]+_0x5893ef['countcongestionretry']+_0x5893ef[_0x36dd('0xe')]+_0x5893ef[_0x36dd('0xf')]+_0x5893ef[_0x36dd('0x10')]+_0x5893ef[_0x36dd('0x11')]+_0x5893ef['countmachineretry']+_0x5893ef['countagentrejectretry'];this[_0x36dd('0xf')]=_0x5893ef[_0x36dd('0xf')];this[_0x36dd('0x10')]=_0x5893ef[_0x36dd('0x10')];this[_0x36dd('0x11')]=_0x5893ef[_0x36dd('0x11')];this[_0x36dd('0x12')]=_0x5893ef['countmachineretry'];this['countagentrejectretry']=_0x5893ef['countagentrejectretry'];this[_0x36dd('0x13')]=_0x405a30[_0x36dd('0x13')];this[_0x36dd('0x14')]=_0x5893ef[_0x36dd('0x15')];this[_0x36dd('0x16')]=_0x5893ef[_0x36dd('0x17')];this['starttime']=_0x5893ef['starttime'];this[_0x36dd('0x18')]=_0x5893ef[_0x36dd('0x18')];this[_0x36dd('0x19')]=moment()[_0x36dd('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x36dd('0x1b')]=getSeconds(_0x5893ef[_0x36dd('0x18')],_0x5893ef[_0x36dd('0x1c')]);this['holdtime']=0x0;this[_0x36dd('0x1d')]=getSeconds(this[_0x36dd('0x19')],_0x5893ef[_0x36dd('0x18')]);this[_0x36dd('0xb')]=_0x5893ef['queue'];this[_0x36dd('0x1e')]=_0x36dd('0x1f');this[_0x36dd('0x20')]=_0x405a30['cause-txt'];this[_0x36dd('0x21')]=_0x5893ef['callback'];this[_0x36dd('0x22')]=_0x5893ef[_0x36dd('0x22')];this[_0x36dd('0x23')]=_0x5893ef[_0x36dd('0x23')];this[_0x36dd('0x24')]=_0x5893ef[_0x36dd('0x24')];this[_0x36dd('0x25')]=_0x5893ef[_0x36dd('0x25')];this[_0x36dd('0x26')]=_0x5893ef[_0x36dd('0x26')];this['UserId']=_0x5893ef['UserId'];this[_0x36dd('0x27')]=_0x5893ef[_0x36dd('0x27')];this[_0x36dd('0x28')]=_0x5893ef[_0x36dd('0x28')];}module[_0x36dd('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d832401..fde534f 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 _0x49d7=['number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','name'];(function(_0x2ed53d,_0xbdf342){var _0x5ad3be=function(_0x32e0c){while(--_0x32e0c){_0x2ed53d['push'](_0x2ed53d['shift']());}};_0x5ad3be(++_0xbdf342);}(_0x49d7,0x133));var _0x749d=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x49d7[_0x425716];return _0x2d39af;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x749d('0x0'));function getSeconds(_0x4c58db,_0x40c222){var _0x1ebdda=moment(_0x4c58db)[_0x749d('0x1')](0x0);var _0xd20713=moment(_0x40c222)['milliseconds'](0x0);return _0x1ebdda['diff'](_0xd20713,'seconds');}function History(_0x9f2015){this[_0x749d('0x2')]=_0x9f2015[_0x749d('0x2')];this[_0x749d('0x3')]=_0x9f2015[_0x749d('0x3')]||undefined;this[_0x749d('0x4')]=_0x9f2015[_0x749d('0x4')];this[_0x749d('0x5')]=_0x9f2015['type']==='outbound'?'queue':_0x9f2015['type'];this[_0x749d('0x6')]=_0x9f2015[_0x749d('0x6')];this[_0x749d('0x7')]=_0x9f2015['countcongestionretry'];this[_0x749d('0x8')]=_0x9f2015[_0x749d('0x8')];this[_0x749d('0x9')]=_0x9f2015['countbusyretry']+_0x9f2015[_0x749d('0x7')]+_0x9f2015[_0x749d('0x8')]+_0x9f2015[_0x749d('0xa')]+_0x9f2015[_0x749d('0xb')]+_0x9f2015[_0x749d('0xc')]+_0x9f2015['countmachineretry']+_0x9f2015[_0x749d('0xd')];this[_0x749d('0xa')]=_0x9f2015[_0x749d('0xa')];this[_0x749d('0xb')]=_0x9f2015[_0x749d('0xb')];this[_0x749d('0xc')]=_0x9f2015[_0x749d('0xc')];this[_0x749d('0xe')]=_0x9f2015['countmachineretry'];this[_0x749d('0xd')]=_0x9f2015[_0x749d('0xd')];this['queue']=_0x9f2015[_0x749d('0xf')];this['calleridname']=_0x9f2015[_0x749d('0x10')];this['calleridnum']=_0x9f2015[_0x749d('0x11')];this[_0x749d('0x12')]=_0x9f2015['starttime'];this[_0x749d('0x13')]=_0x9f2015[_0x749d('0x13')];this[_0x749d('0x14')]=_0x9f2015['responsetime'];this[_0x749d('0x15')]=getSeconds(_0x9f2015['responsetime'],_0x9f2015['starttime']);this[_0x749d('0x16')]=0x0;this[_0x749d('0x17')]=0x0;this[_0x749d('0x18')]=_0x9f2015[_0x749d('0x18')];this['callbackuniqueid']=_0x9f2015[_0x749d('0x19')];this[_0x749d('0x1a')]=_0x9f2015[_0x749d('0x1a')];this[_0x749d('0x1b')]=_0x9f2015['recallme'];this[_0x749d('0x1c')]=_0x9f2015[_0x749d('0x1c')];this[_0x749d('0x1d')]=_0x9f2015[_0x749d('0x1d')];this[_0x749d('0x1e')]=_0x9f2015[_0x749d('0x1e')];this['VoiceQueueId']=_0x9f2015[_0x749d('0x1f')];this[_0x749d('0x20')]=_0x9f2015['CampaignId'];this[_0x749d('0x21')]=_0x9f2015[_0x749d('0x21')]||'';this[_0x749d('0x22')]=_0x9f2015['originatecalleridname']||'';}module[_0x749d('0x23')]=History; \ No newline at end of file +var _0x4eb6=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','callback','ContactId'];(function(_0x38d7f0,_0x32a6cf){var _0x4f3546=function(_0x5c99fc){while(--_0x5c99fc){_0x38d7f0['push'](_0x38d7f0['shift']());}};_0x4f3546(++_0x32a6cf);}(_0x4eb6,0xf5));var _0x64eb=function(_0x309a75,_0x93fdc3){_0x309a75=_0x309a75-0x0;var _0x554ade=_0x4eb6[_0x309a75];return _0x554ade;};'use strict';var util=require(_0x64eb('0x0'));var _=require(_0x64eb('0x1'));var moment=require('moment');function getSeconds(_0x2cf2ef,_0x5fac27){var _0x50c03a=moment(_0x2cf2ef)[_0x64eb('0x2')](0x0);var _0x45fb28=moment(_0x5fac27)[_0x64eb('0x2')](0x0);return _0x50c03a['diff'](_0x45fb28,_0x64eb('0x3'));}function History(_0x5f2b15){this['uniqueid']=_0x5f2b15['uniqueid'];this[_0x64eb('0x4')]=_0x5f2b15[_0x64eb('0x4')]||undefined;this['type']=_0x5f2b15[_0x64eb('0x5')];this[_0x64eb('0x6')]=_0x5f2b15[_0x64eb('0x5')]===_0x64eb('0x7')?_0x64eb('0x8'):_0x5f2b15['type'];this['countbusyretry']=_0x5f2b15[_0x64eb('0x9')];this[_0x64eb('0xa')]=_0x5f2b15['countcongestionretry'];this[_0x64eb('0xb')]=_0x5f2b15['countnoanswerretry'];this[_0x64eb('0xc')]=_0x5f2b15[_0x64eb('0x9')]+_0x5f2b15[_0x64eb('0xa')]+_0x5f2b15[_0x64eb('0xb')]+_0x5f2b15[_0x64eb('0xd')]+_0x5f2b15[_0x64eb('0xe')]+_0x5f2b15['countabandonedretry']+_0x5f2b15['countmachineretry']+_0x5f2b15['countagentrejectretry'];this[_0x64eb('0xd')]=_0x5f2b15[_0x64eb('0xd')];this[_0x64eb('0xe')]=_0x5f2b15[_0x64eb('0xe')];this[_0x64eb('0xf')]=_0x5f2b15[_0x64eb('0xf')];this[_0x64eb('0x10')]=_0x5f2b15[_0x64eb('0x10')];this[_0x64eb('0x11')]=_0x5f2b15[_0x64eb('0x11')];this[_0x64eb('0x8')]=_0x5f2b15[_0x64eb('0x8')];this[_0x64eb('0x12')]=_0x5f2b15[_0x64eb('0x13')];this[_0x64eb('0x14')]=_0x5f2b15[_0x64eb('0x15')];this[_0x64eb('0x16')]=_0x5f2b15[_0x64eb('0x16')];this[_0x64eb('0x17')]=_0x5f2b15[_0x64eb('0x17')];this[_0x64eb('0x18')]=_0x5f2b15[_0x64eb('0x17')];this['ringtime']=getSeconds(_0x5f2b15[_0x64eb('0x17')],_0x5f2b15[_0x64eb('0x16')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x64eb('0x19')]=_0x5f2b15[_0x64eb('0x19')];this['callbackuniqueid']=_0x5f2b15['callbackuniqueid'];this['callbackat']=_0x5f2b15['callbackat'];this['recallme']=_0x5f2b15['recallme'];this['ContactId']=_0x5f2b15[_0x64eb('0x1a')];this[_0x64eb('0x1b')]=_0x5f2b15['ListId'];this['UserId']=_0x5f2b15[_0x64eb('0x1c')];this[_0x64eb('0x1d')]=_0x5f2b15[_0x64eb('0x1d')];this[_0x64eb('0x1e')]=_0x5f2b15['CampaignId'];this[_0x64eb('0x1f')]=_0x5f2b15[_0x64eb('0x1f')]||'';this[_0x64eb('0x20')]=_0x5f2b15[_0x64eb('0x20')]||'';}module[_0x64eb('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b898ca6..230ab5c 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 _0x647a=['string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','isNil','status','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','then','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','UserId','VoiceQueueId','[emptyContact]','isSuccess','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','CampaignId','[syncHangupInAMDIvr][createHistory]','countglobal','add','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','Unknow','syncAgentComplete','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','locked','stateinterface','push','idHopper','paused','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','loopCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','Action','command','iftime\x20%s,%s','interval','content','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','replace','random','match','actionOriginate','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','countcongestionretry','countagentrejectretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','buildObj','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','reachable','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','interval\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','p\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive'];(function(_0x29b564,_0x2d95bd){var _0xae0676=function(_0x4eedb8){while(--_0x4eedb8){_0x29b564['push'](_0x29b564['shift']());}};_0xae0676(++_0x2d95bd);}(_0x647a,0x17e));var _0xa647=function(_0x566342,_0x4a8a5d){_0x566342=_0x566342-0x0;var _0x1271e6=_0x647a[_0x566342];return _0x1271e6;};'use strict';var util=require(_0xa647('0x0'));var _=require(_0xa647('0x1'));var BPromise=require(_0xa647('0x2'));var uuid=require(_0xa647('0x3'));var moment=require(_0xa647('0x4'));var rr=require('rr');var md5=require(_0xa647('0x5'));var Redis=require(_0xa647('0x6'));var ut=require(_0xa647('0x7'));var config=require(_0xa647('0x8'));var logger=require(_0xa647('0x9'))(_0xa647('0xa'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0xa647('0x9'))(_0xa647('0xb'));var loggerPredictiveCalls=require(_0xa647('0x9'))(_0xa647('0xc'));var loggerSyncQueueSummary=require(_0xa647('0x9'))(_0xa647('0xd'));var ami=require('../ami');config['redis']=_[_0xa647('0xe')](config['redis'],{'host':_0xa647('0xf'),'port':0x18eb});var io=require(_0xa647('0x10'))(new Redis(config[_0xa647('0x11')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xa647('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa647('0x13'));var voiceQueueRt=require(_0xa647('0x14'));var Action=require(_0xa647('0x15'));var History=require('./history');var Final=require(_0xa647('0x16'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xa647('0x17'));var Hangup=require(_0xa647('0x18'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xa647('0x19');var strategy={'rrmemory':_0xa647('0x1a'),'roundrobin':_0xa647('0x1b')};var Sequence=function(){};Sequence[_0xa647('0x1c')][_0xa647('0x1d')]=function(_0xa8b134){this['tail']=this[_0xa647('0x1e')]?this[_0xa647('0x1e')][_0xa647('0x1f')](_0xa8b134):_0xa8b134();};function Dialer(_0x25cdb5,_0x22b33b){this[_0xa647('0x20')]=new Sequence();this[_0xa647('0x21')]=_0x22b33b;this[_0xa647('0x22')]=_0x25cdb5[_0xa647('0x22')];this[_0xa647('0x23')]=_0x25cdb5[_0xa647('0x23')];this[_0xa647('0x24')]=_0x25cdb5[_0xa647('0x24')];this[_0xa647('0x25')]=_0x25cdb5[_0xa647('0x25')];this[_0xa647('0x26')]=config[_0xa647('0x26')]||0x2;this['channels']={};this[_0xa647('0x27')]={};this[_0xa647('0x28')]={};this[_0xa647('0x29')]={};this['optionPredictive']={};this[_0xa647('0x2a')]={};this['startProgressive']={};this[_0xa647('0x2b')]={};this[_0xa647('0x2c')]={};this[_0xa647('0x2d')]={};ami['on'](_0xa647('0x2e'),this[_0xa647('0x2f')]['bind'](this));ami['on'](_0xa647('0x30'),this[_0xa647('0x31')][_0xa647('0x32')](this));ami['on'](_0xa647('0x33'),this[_0xa647('0x34')][_0xa647('0x32')](this));ami['on'](_0xa647('0x35'),this['syncAgentComplete'][_0xa647('0x32')](this));ami['on'](_0xa647('0x36'),this[_0xa647('0xd')][_0xa647('0x32')](this));ami['on']('hangup',this[_0xa647('0x37')][_0xa647('0x32')](this));ami['on'](_0xa647('0x38'),this[_0xa647('0x39')]['bind'](this));ami['on'](_0xa647('0x3a'),this[_0xa647('0x3b')][_0xa647('0x32')](this));ami['on'](_0xa647('0x3c'),this['syncQueueMember'][_0xa647('0x32')](this));ami['on'](_0xa647('0x3d'),this[_0xa647('0x3e')][_0xa647('0x32')](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x56fbd9){return _0x56fbd9!==null&&!_[_0xa647('0x3f')](_0x56fbd9);}function checkIsLoggedIn(_0x1aab4c,_0x129db9){return function(){if(_0x129db9<=0x0){_0x1aab4c['message']=_0xa647('0x40');throw _0x1aab4c[_0xa647('0x41')]+_0xa647('0x42');}};}function isActive(_0x4a8248){return _0x4a8248;}function checkIsActive(_0x339a49,_0x224654){return function(){if(!isActive(_0x224654)){_0x339a49[_0xa647('0x43')]=_0xa647('0x44');throw _0x339a49['name']+_0xa647('0x45');}};}function checkInterval(_0x460c1a){return function(){if(!isNotNull(_0x460c1a[_0xa647('0x46')])){_0x460c1a[_0xa647('0x43')]=_0xa647('0x47');throw _0x460c1a[_0xa647('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x460c1a[_0xa647('0x46')][_0xa647('0x48')])){_0x460c1a[_0xa647('0x43')]=_0xa647('0x47');throw _0x460c1a[_0xa647('0x41')]+_0xa647('0x49');}if(!isNotNull(_[_0xa647('0x4a')](_0x460c1a['Interval'][_0xa647('0x48')]))){_0x460c1a[_0xa647('0x43')]=_0xa647('0x47');throw _0x460c1a[_0xa647('0x41')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x2d5b5b,_0x352a71,_0x4c7e1a){return{'action':_0x2d5b5b,'response':_0x352a71,'message':_0x4c7e1a,'stack':_0x4c7e1a};}function myreject(_0x38ac4d){return function(_0x34ece2){return _0x38ac4d(msgResponse(_0xa647('0x4b'),_0xa647('0x4c'),JSON[_0xa647('0x4d')](_0x34ece2)));};}function getSeconds(_0xc28c6c,_0x2f9c71){var _0x3d2519=moment(_0xc28c6c)[_0xa647('0x4e')](0x0);var _0x28518c=moment(_0x2f9c71)[_0xa647('0x4e')](0x0);return _0x3d2519[_0xa647('0x4f')](_0x28518c,_0xa647('0x50'));}function emit(_0x486991,_0x354634,_0xfbde9b){io['to'](_0x486991)[_0xa647('0x51')](_0x354634,_0xfbde9b);}function emitVoiceQueueSummary(_0x4b2246){if(_0x4b2246['type']===_0xa647('0x52')){var _0x20ea98={'id':_0x4b2246['id'],'name':_0x4b2246['name'],'strategy':_0x4b2246[_0xa647('0x53')],'answered':_0x4b2246[_0xa647('0x54')],'available':_0x4b2246[_0xa647('0x55')],'loggedIn':_0x4b2246[_0xa647('0x56')],'pTalking':_0x4b2246[_0xa647('0x57')],'sumBillable':_0x4b2246[_0xa647('0x58')],'sumDuration':_0x4b2246[_0xa647('0x59')],'sumHoldTime':_0x4b2246[_0xa647('0x5a')]||0x0,'talking':_0x4b2246[_0xa647('0x5b')],'total':_0x4b2246['total'],'type':_0x4b2246[_0xa647('0x5c')],'unmanaged':_0x4b2246['unmanaged'],'abandoned':_0x4b2246[_0xa647('0x5d')],'waiting':_0x4b2246[_0xa647('0x5e')],'loggedInDb':_0x4b2246[_0xa647('0x5f')],'dialActive':_0x4b2246[_0xa647('0x60')],'dialMethod':_0x4b2246[_0xa647('0x61')],'dialOriginateCallerIdName':_0x4b2246[_0xa647('0x62')],'dialOriginateCallerIdNumber':_0x4b2246[_0xa647('0x63')],'dialOriginateTimeout':_0x4b2246[_0xa647('0x64')],'dialPrefix':_0x4b2246['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4b2246[_0xa647('0x65')],'outboundAnswerCallsDay':_0x4b2246[_0xa647('0x66')],'outboundBlacklistCallsDay':_0x4b2246[_0xa647('0x67')],'outboundBusyCallsDay':_0x4b2246['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4b2246[_0xa647('0x68')],'outboundDropCallsDayACS':_0x4b2246[_0xa647('0x69')],'outboundDropCallsDayCallersExit':_0x4b2246[_0xa647('0x6a')],'outboundDropCallsDayTimeout':_0x4b2246[_0xa647('0x6b')],'outboundNoAnswerCallsDay':_0x4b2246[_0xa647('0x6c')],'outboundNoSuchCallsDay':_0x4b2246[_0xa647('0x6d')],'outboundOriginateFailureCallsDay':_0x4b2246['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4b2246[_0xa647('0x6e')],'outboundRejectCallsDay':_0x4b2246[_0xa647('0x6f')],'outboundUnknownCallsDay':_0x4b2246['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4b2246[_0xa647('0x70')],'predictiveIntervalAvgHoldtime':_0x4b2246[_0xa647('0x71')],'predictiveIntervalAvgTalktime':_0x4b2246[_0xa647('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0x4b2246[_0xa647('0x73')],'predictiveIntervalDroppedCallsTimeout':_0x4b2246['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4b2246[_0xa647('0x74')],'predictiveIntervalErlangCallsDroppedCalls':_0x4b2246[_0xa647('0x75')],'predictiveIntervalHitRate':_0x4b2246[_0xa647('0x76')],'predictiveIntervalMultiplicativeFactor':_0x4b2246[_0xa647('0x77')],'predictiveIntervalPauses':_0x4b2246[_0xa647('0x78')],'predictiveIntervalAvailable':_0x4b2246[_0xa647('0x79')],'predictiveIntervalTotalCalls':_0x4b2246[_0xa647('0x7a')],'message':_0x4b2246[_0xa647('0x43')],'originated':_0x4b2246[_0xa647('0x7b')],'erlangCalls':_0x4b2246[_0xa647('0x7c')],'erlangCallToSecond':_0x4b2246[_0xa647('0x7d')],'erlangAbandonmentRate':_0x4b2246['erlangAbandonmentRate'],'erlangBusyFactor':_0x4b2246[_0xa647('0x7e')],'startPredictive':_0x4b2246['startPredictive'],'startProgressive':_0x4b2246[_0xa647('0x7f')]};if(_0x4b2246['Trunk']){_0x20ea98[_0xa647('0x80')]={'id':_0x4b2246[_0xa647('0x80')]['id'],'name':_0x4b2246[_0xa647('0x80')][_0xa647('0x41')],'active':_0x4b2246[_0xa647('0x80')][_0xa647('0x81')],'callerid':_0x4b2246[_0xa647('0x80')][_0xa647('0x82')]};}if(_0x4b2246['Interval']){_0x20ea98[_0xa647('0x46')]={'id':_0x4b2246['Interval']['id'],'name':_0x4b2246[_0xa647('0x46')][_0xa647('0x41')]};}var _0x6e9f93=md5(JSON[_0xa647('0x4d')](_0x20ea98));if(_0x4b2246['md5']!==_0x6e9f93){_0x4b2246[_0xa647('0x5')]=_0x6e9f93;emit(util['format'](_0xa647('0x83'),_0x20ea98['name']),_0xa647('0x84'),_0x20ea98);}}}function emitCampaignSummary(_0x560b88){if(_0x560b88[_0xa647('0x5c')]===_0xa647('0x85')){emit(util[_0xa647('0x86')](_0xa647('0x87'),_0x560b88[_0xa647('0x41')]),_0xa647('0x88'),_0x560b88);}}function checkGetDataPredictive(_0x33bfab){if(isNotNull(_0x33bfab)){if(!_[_0xa647('0x4a')](_0x33bfab)){loggerPredictive[_0xa647('0x89')](_0xa647('0x8a'));loggerPredictive[_0xa647('0x89')](_0xa647('0x8b'),_0x33bfab[_0xa647('0x7a')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x8c'),_0x33bfab[_0xa647('0x70')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x8d'),_0x33bfab[_0xa647('0x8e')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x8f'),_0x33bfab[_0xa647('0x73')]);loggerPredictive['info'](_0xa647('0x90'),_0x33bfab['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xa647('0x91'),_0x33bfab[_0xa647('0x72')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x92'));if(_0x33bfab[_0xa647('0x7a')]>0x0){if(!_[_0xa647('0x3f')](_0x33bfab[_0xa647('0x72')])&&_0x33bfab['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xa647('0x89')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0xa647('0x3f')](_0x33bfab['predictiveIntervalAvgHoldtime'])&&_0x33bfab[_0xa647('0x71')]>0x0){return!![];}else{loggerPredictive[_0xa647('0x89')](_0xa647('0x93'));}}else{loggerPredictive[_0xa647('0x89')](_0xa647('0x94'));}}else{loggerPredictive[_0xa647('0x89')]('History\x20information\x20are\x20empty');}}else{loggerPredictive['info'](_0xa647('0x95'));}return![];}function mergeDataErlangB(_0x43cd96){return function(_0x5d8b48){loggerPredictive['info'](_0xa647('0x96'));loggerPredictive['info'](_0xa647('0x97'),_0x5d8b48[_0xa647('0x7c')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x98'),_0x5d8b48[_0xa647('0x7d')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x99'),_0x5d8b48['erlangAbandonmentRate']);loggerPredictive[_0xa647('0x89')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d8b48[_0xa647('0x7e')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x99'),_0x5d8b48[_0xa647('0x9a')]);loggerPredictive[_0xa647('0x89')](_0xa647('0x92'));_[_0xa647('0x9b')](_0x43cd96,_0x5d8b48);};}function getDiff(_0x101bb2){var _0xc64551=moment()['milliseconds'](0x0);var _0x585681=moment(_0x101bb2)['milliseconds'](0x0);return _0xc64551['diff'](_0x585681,'seconds');}function ifInterval(_0x85adb5,_0x308d9e){if(_[_0xa647('0x3f')](_0x308d9e)){return![];}if(getDiff(_0x308d9e)<_0x85adb5*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x27d9cb){if(isNotNull(_0x27d9cb)){if(!_[_0xa647('0x3f')](_0x27d9cb[_0xa647('0x7f')])){_0x27d9cb[_0xa647('0x7f')]=undefined;loggerPredictive['info'](_0x27d9cb['name'],_0xa647('0x9c'));}if(!_[_0xa647('0x3f')](_0x27d9cb[_0xa647('0x2a')])){_0x27d9cb[_0xa647('0x2a')]=undefined;loggerPredictive[_0xa647('0x89')](_0x27d9cb[_0xa647('0x41')],_0xa647('0x9d'));}if(!_[_0xa647('0x3f')](_0x27d9cb['handlePredictive'])){clearInterval(_0x27d9cb[_0xa647('0x9e')]);_0x27d9cb[_0xa647('0x9e')]=undefined;loggerPredictive[_0xa647('0x89')](_0x27d9cb['name'],_0xa647('0x9f'));}}}function erlangb(_0x2ce04c,_0x34ec01){if(_0x34ec01===0x0){return 0x0;}var _0x4e0859=0x1;for(var _0x32b7cb=0x1;_0x32b7cb<=_0x34ec01;_0x32b7cb+=0x1){_0x4e0859=0x1+_0x4e0859*_0x32b7cb/_0x2ce04c;}return 0x1/_0x4e0859;}function isVoiceQueueOutbound(_0x3710bb){return _0x3710bb===_0xa647('0x52');}function isNotPreview(_0x30828c){return _0x30828c!==_0xa647('0x21');}function isCampaignIvr(_0x338372){return _0x338372===_0xa647('0x85');}function getCallerId(_0x50669a,_0x6dff35,_0x31d42b){if(!_[_0xa647('0x3f')](_0x31d42b)&&_0xa647('0xa0')===typeof _0x31d42b&&!_[_0xa647('0x4a')](_0x31d42b)){if(!_[_0xa647('0x3f')](_0x6dff35)&&_0xa647('0xa0')===typeof _0x6dff35&&!_[_0xa647('0x4a')](_0x6dff35)){return util['format']('\x22%s\x22\x20<%s>',_0x6dff35,_0x31d42b);}return util[_0xa647('0x86')](_0xa647('0xa1'),_0x31d42b,_0x31d42b);}if(!_[_0xa647('0x3f')](_0x50669a)&&'string'===typeof _0x50669a&&!_[_0xa647('0x4a')](_0x50669a)){return _0x50669a;}return _0xa647('0xa2');}function loggerCatchQueueSummary(_0x2e2f22,_0x478deb){return function(_0x411993){freeVariablesPredictive(_0x478deb);emitVoiceQueueSummary(_0x478deb);emitCampaignSummary(_0x478deb);loggerSyncQueueSummary[_0xa647('0xa3')](_0x2e2f22,util[_0xa647('0xa4')](_0x411993,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x409bbc,_0x3abe21){return function(_0x248068){loggerPredictive['error'](_0x3abe21[_0xa647('0x41')],_0x409bbc);loggerPredictive[_0xa647('0xa3')](_0x248068[_0xa647('0xa5')]);freeVariablesPredictive(_0x3abe21);};}function loggerCatch(_0x432241){return function(_0x3f0582){logger[_0xa647('0xa3')](_0x432241,util[_0xa647('0xa4')](_0x3f0582,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4de4d8){return _0x4de4d8&&!_[_0xa647('0x3f')](_0x4de4d8)&&_0x4de4d8[_0xa647('0xa6')]>0x0;}function decremetOriginate(_0x4ca521){if(!_['isUndefined'](_0x4ca521)&&_0x4ca521!==null){if(_0x4ca521[_0xa647('0xa7')](_0xa647('0x7b'))){if(_0x4ca521['originated']>0x0){_0x4ca521['originated']-=0x1;}else{logger[_0xa647('0xa3')](_0xa647('0xa8'));}}}else{logger[_0xa647('0xa3')](_0xa647('0xa9'));}}function checkContactLowerLimitOriginate(_0x559bf7,_0x46b4d1,_0x4415f9){if(_0x46b4d1>_0x4415f9){for(var _0x134062=0x0;_0x134062<_0x46b4d1-_0x4415f9;_0x134062+=0x1){decremetOriginate(_0x559bf7);}}}function loggerGetContactDialer(_0x302fd7,_0x58696a,_0x98120e){return function(_0xfa863d){checkContactLowerLimitOriginate(_0x58696a,_0x98120e,0x0);logger[_0xa647('0xa3')](_0x302fd7,util[_0xa647('0xa4')](_0xfa863d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x589651){return function(_0x4389ba){if(isNotNull(_0x4389ba)&&isNotNull(_0x4389ba[0x0])){if(_0x4389ba[0x0][_0xa647('0xaa')]>0x0){_0x589651[_0xa647('0x43')]=_0xa647('0xab');logger[_0xa647('0x89')](_0xa647('0xac')+_0x589651['name'],_0x4389ba[0x0][_0xa647('0xaa')],_0xa647('0xad'));}else{_0x589651[_0xa647('0x43')]=_0xa647('0xae');logger[_0xa647('0x89')]('[getContactDialer2][Empty]'+_0x589651[_0xa647('0x41')]);}}};}function notSendMessagesQueue(_0x1da56c){if(_0x1da56c[_0xa647('0xaf')]){freeVariablesPredictive(_0x1da56c);if(_0x1da56c[_0xa647('0x7b')]===0x0&&_0x1da56c[_0xa647('0x5b')]===0x0&&_0x1da56c[_0xa647('0x5e')]===0x0&&(_0x1da56c[_0xa647('0x57')]||0x0)===0x0){_0x1da56c[_0xa647('0xaf')]=![];_0x1da56c[_0xa647('0x55')]=0x0;_0x1da56c['message']='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xa647('0xb0'),_0x1da56c[_0xa647('0x41')],_0xa647('0xb1'));}else{_0x1da56c[_0xa647('0x43')]=_0xa647('0xb2');loggerSyncQueueSummary[_0xa647('0xa3')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1da56c[_0xa647('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x1da56c);}}function notSendMessagesCampaign(_0xd8fbaa){if(_0xd8fbaa[_0xa647('0xaf')]){if(_0xd8fbaa[_0xa647('0x7b')]===0x0){_0xd8fbaa[_0xa647('0xaf')]=![];_0xd8fbaa[_0xa647('0x43')]=_0xa647('0x44');loggerSyncQueueSummary[_0xa647('0xa3')](_0xa647('0xb3'),_0xd8fbaa[_0xa647('0x41')],_0xa647('0xb1'));}else{_0xd8fbaa['message']=_0xa647('0xb2');loggerSyncQueueSummary['error'](_0xa647('0xb3'),_0xd8fbaa[_0xa647('0x41')],_0xa647('0xb4'));}emitCampaignSummary(_0xd8fbaa);}}function createObjHistory(_0x442cfd,_0x27648f,_0x33a9db,_0x165f93,_0x37d24f){_0x442cfd[_0xa647('0x43')]=_0x33a9db;var _0x19e423=new Action(_0x442cfd,_0x27648f);var _0x46b9e1=new History(_0x19e423);_0x46b9e1[_0xa647('0xb5')]=_0x165f93;_0x46b9e1[_0xa647('0xb6')]=_0x37d24f;_0x46b9e1[_0xa647('0xb7')]=_0x19e423[_0xa647('0xb8')];return _0x46b9e1;}Dialer[_0xa647('0x1c')][_0xa647('0xb9')]=function(){var _0x46678a=this;setInterval(function(){_0x46678a['clearZombieChannels'](_0x46678a[_0xa647('0x29')],_0xa647('0xba'));_0x46678a['clearZombieChannels'](_0x46678a['actions'],'[actions]');},0x32c8);};Dialer[_0xa647('0x1c')][_0xa647('0xbb')]=function(_0x5f1625,_0x1be417){var _0x3b6b8c=this;for(var _0x4658aa in _0x5f1625){if(_0x5f1625[_0xa647('0xa7')](_0x4658aa)){this[_0xa647('0x20')][_0xa647('0x1d')](function(){if(!_[_0xa647('0xbc')](_0x5f1625[_0x4658aa])){return ami['Action']({'action':_0xa647('0xbd'),'channel':_0x5f1625[_0x4658aa]['channel']})['catch'](function(_0x2a32d7){if(_0x2a32d7['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5f1625[_0x4658aa]&&_0x5f1625[_0x4658aa]['type']!==_0xa647('0x85')){_0x3b6b8c[_0xa647('0xbe')](_0x3b6b8c[_0xa647('0x22')][_0x5f1625[_0x4658aa][_0xa647('0xbf')]]);logger[_0xa647('0xa3')](_0xa647('0xc0'),_0x1be417,_0x4658aa,_0x5f1625[_0x4658aa][_0xa647('0xbf')]);delete _0x5f1625[_0x4658aa];}if(_0x5f1625[_0x4658aa]&&_0x5f1625[_0x4658aa][_0xa647('0x5c')]==='ivr'){_0x3b6b8c[_0xa647('0xbe')](_0x3b6b8c[_0xa647('0x23')][_0x5f1625[_0x4658aa][_0xa647('0xbf')]]);logger[_0xa647('0xa3')](_0xa647('0xc1'),_0x1be417,_0x4658aa,_0x5f1625[_0x4658aa][_0xa647('0xbf')]);delete _0x5f1625[_0x4658aa];}},0x2328);}});}});}}};Dialer[_0xa647('0x1c')]['countReScheduled']=function(_0x3263f8){return BPromise['resolve']()['then'](cmHopper[_0xa647('0xc2')](_0x3263f8))[_0xa647('0xc3')](loggerCatch(_0xa647('0xc4')));};Dialer['prototype']['checkIsBlackList']=function(_0xd83782){return BPromise['resolve']()[_0xa647('0xc5')](cmHopperBlack['checkIsBlackList'](_0xd83782))[_0xa647('0xc3')](loggerCatch(_0xa647('0xc6')));};Dialer[_0xa647('0x1c')][_0xa647('0xc7')]=function(_0xaaf305){return BPromise[_0xa647('0xc8')]()[_0xa647('0xc5')](cmHopperBlack[_0xa647('0xc7')](_0xaaf305))[_0xa647('0xc3')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xa647('0x1c')]['averageHandleTime']=function(_0x3ac32e){return BPromise[_0xa647('0xc8')]()['then'](cmHopperHistory[_0xa647('0xc9')](_0x3ac32e))[_0xa647('0xc3')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xa647('0x1c')]['rescheduleContact']=function(_0x2b636d){return BPromise['resolve']()[_0xa647('0xc5')](cmHopper[_0xa647('0xca')](_0x2b636d))[_0xa647('0xc3')](loggerCatch(_0xa647('0xcb')));};Dialer['prototype'][_0xa647('0xcc')]=function(_0x3084ff,_0x564c4b,_0x51b779){return BPromise[_0xa647('0xc8')]()[_0xa647('0xc5')](cmHopper[_0xa647('0xcc')](_0x3084ff,_0x564c4b,_0x51b779))[_0xa647('0xc3')](loggerCatch(_0xa647('0xcd')));};Dialer[_0xa647('0x1c')][_0xa647('0xce')]=function(_0x3be737,_0x2cb352,_0x2dfd80,_0x5ca2b9){return BPromise[_0xa647('0xc8')]()[_0xa647('0xc5')](cmHopper['getContactDialer'](_0x3be737,_0x2cb352,_0x2dfd80,_0x5ca2b9))[_0xa647('0xc3')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getContactDialerIvr']=function(_0x2357d9,_0x217cc9,_0x252b31){return BPromise['resolve']()[_0xa647('0xc5')](cmHopper[_0xa647('0xcf')](_0x2357d9,_0x217cc9,_0x252b31))[_0xa647('0xc3')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa647('0x1c')][_0xa647('0xd0')]=function(_0x25c62a){return BPromise['resolve']()[_0xa647('0xc5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x25c62a))[_0xa647('0xc3')](loggerCatch(_0xa647('0xd1')));};Dialer[_0xa647('0x1c')][_0xa647('0xd2')]=function(_0x1556dc){return BPromise[_0xa647('0xc8')]()[_0xa647('0xc5')](cmHopper[_0xa647('0xd2')](_0x1556dc))['catch'](loggerCatch(_0xa647('0xd3')));};Dialer[_0xa647('0x1c')][_0xa647('0xd4')]=function(_0x5d87de){return BPromise['resolve']()[_0xa647('0xc5')](cmHopperHistory[_0xa647('0xd4')](_0x5d87de))['catch'](loggerCatch(_0xa647('0xd5')));};Dialer[_0xa647('0x1c')][_0xa647('0xbe')]=function(_0xc57fab){if(!_[_0xa647('0x3f')](_0xc57fab)&&_0xc57fab!==null){if(_0xc57fab[_0xa647('0xa7')](_0xa647('0x7b'))){if(_0xc57fab['originated']>0x0){_0xc57fab[_0xa647('0x7b')]-=0x1;}else{logger[_0xa647('0xa3')](_0xa647('0xd6'));}}}else{logger[_0xa647('0xa3')](_0xa647('0xd7'));}};Dialer[_0xa647('0x1c')][_0xa647('0xd8')]=function(_0x3ebe6f,_0x4d6073){var _0xd84ce3=this;return function(_0x2119eb){_0xd84ce3[_0xa647('0xbe')](_0x4d6073);logger['error'](_0x3ebe6f,util['inspect'](_0x2119eb,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xa647('0xd9')]=function(_0x5cf296,_0x539873,_0x31786b){var _0x5e966d={'state':0x19,'statedesc':_0xa647('0xda')};this['updateOriginated'](_0x539873);this[_0xa647('0xdb')](_[_0xa647('0x9b')](_0x5e966d,_[_0xa647('0xdc')](_0x31786b,['ContactId','ListId',_0xa647('0xdd'),_0xa647('0xde'),'CampaignId'])),'[emptyContact][createHistory]',_0xa647('0xdf'));logger['error'](_0x5cf296);};Dialer[_0xa647('0x1c')][_0xa647('0xe0')]=function(_0x388f4e){return _0x388f4e==='Success';};Dialer[_0xa647('0x1c')]['isTrunkReachable']=function(_0x36e5a3){return!_[_0xa647('0x3f')](_0x36e5a3)&&_0x36e5a3&&!_[_0xa647('0x3f')](_0x36e5a3['name'])&&!_[_0xa647('0x3f')](_0x36e5a3[_0xa647('0x81')])&&_0x36e5a3[_0xa647('0x81')]&&(this[_0xa647('0x25')][util[_0xa647('0x86')]('SIP/%s',_0x36e5a3[_0xa647('0x41')])]['status']==='reachable'||this[_0xa647('0x25')][util[_0xa647('0x86')]('SIP/%s',_0x36e5a3[_0xa647('0x41')])][_0xa647('0xbd')]===_0xa647('0xe1'));};Dialer[_0xa647('0x1c')][_0xa647('0xdb')]=function(_0x1b9519,_0x25c9e1,_0x51cacc){this[_0xa647('0xd4')](_0x1b9519)[_0xa647('0xc3')](loggerCatch(_0x25c9e1));this[_0xa647('0xd2')](_0x1b9519)[_0xa647('0xc3')](loggerCatch(_0x51cacc));};Dialer[_0xa647('0x1c')]['syncVarSet']=function(_0x564c15){var _0x27cefe=this[_0xa647('0x29')][_0x564c15[_0xa647('0xe2')]];var _0x2b3810;if(!_[_0xa647('0xbc')](_0x564c15)&&!_['isNil'](_0x564c15['variable'])&&!_['isNil'](_0x564c15[_0xa647('0xe3')][_0xa647('0xe4')])&&_0x564c15[_0xa647('0xe5')]===_0xa647('0xe6')&&_0x27cefe){if(_0x27cefe['type']!==_0xa647('0x85')&&this[_0xa647('0x22')][_0x27cefe[_0xa647('0xbf')]]['dialAMDActive']&&_0x564c15[_0xa647('0xe7')]===_0xa647('0xe8')){delete this[_0xa647('0x29')][_0x564c15[_0xa647('0xe2')]];this[_0xa647('0xbe')](this[_0xa647('0x22')][_0x27cefe['queue']]);this[_0xa647('0x22')][_0x27cefe[_0xa647('0xbf')]][_0xa647('0x66')]+=0x1;this[_0xa647('0x22')][_0x27cefe[_0xa647('0xbf')]][_0xa647('0x65')]+=0x1;_0x2b3810=new Hangup(_0x27cefe,_0x564c15);_0x2b3810[_0xa647('0xb5')]=0x12;_0x2b3810[_0xa647('0xb6')]=_0xa647('0xe9');_0x2b3810[_0xa647('0xea')]=_0xa647('0xeb');this[_0xa647('0xdb')](_0x2b3810,'[syncHangupInAMD][createHistory]',_0xa647('0xec'));}if(_0x27cefe[_0xa647('0x5c')]!=='ivr'&&this[_0xa647('0x22')][_0x27cefe[_0xa647('0xbf')]][_0xa647('0xed')]&&_0x564c15[_0xa647('0xe7')]===_0xa647('0xee')){var _0x40dcf2=this;return new BPromise(function(_0x558663,_0x46ee19){delete _0x40dcf2[_0xa647('0x29')][_0x564c15[_0xa647('0xe2')]];_0x40dcf2[_0xa647('0xbe')](_0x40dcf2[_0xa647('0x22')][_0x27cefe[_0xa647('0xbf')]]);_0x40dcf2[_0xa647('0x22')][_0x27cefe[_0xa647('0xbf')]][_0xa647('0x66')]+=0x1;_0x40dcf2['voiceQueues'][_0x27cefe[_0xa647('0xbf')]][_0xa647('0x65')]+=0x1;var _0x5543e2=_0x40dcf2['voiceQueues'][_0x27cefe[_0xa647('0xbf')]];var _0xf617aa=new Hangup(_0x27cefe,_0x564c15);_0xf617aa['state']=0x13;_0xf617aa[_0xa647('0xb6')]=_0xa647('0xef');_0xf617aa[_0xa647('0xea')]=_0xa647('0xeb');_0xf617aa[_0xa647('0xf0')]+=0x1;_0xf617aa['countglobal']+=0x1;_0xf617aa[_0xa647('0xf1')]=!![];_0x40dcf2[_0xa647('0xd4')](_0xf617aa)[_0xa647('0xc3')](loggerCatch(_0xa647('0xf2')));if(_0xf617aa[_0xa647('0xf3')]+_0xf617aa['countcongestionretry']+_0xf617aa[_0xa647('0xf4')]+_0xf617aa['countnosuchnumberretry']+_0xf617aa[_0xa647('0xf5')]+_0xf617aa[_0xa647('0xf6')]+_0xf617aa[_0xa647('0xf0')]+_0xf617aa['countagentrejectretry']>=_0x5543e2[_0xa647('0xf7')]){_0x40dcf2[_0xa647('0xf8')](_0xf617aa,_0x558663,_0x46ee19,_0xa647('0xf9'));}else{if(_0xf617aa['countmachineretry']>=_0x5543e2[_0xa647('0xfa')]){_0x40dcf2[_0xa647('0xfb')](_0xf617aa,_0x558663,_0x46ee19,_0xa647('0xfc'));}else{_0x40dcf2[_0xa647('0xca')]({'active':![],'countmachineretry':_0xf617aa[_0xa647('0xf0')],'scheduledat':moment()['add'](_0x5543e2[_0xa647('0xfd')],_0xa647('0xfe'))[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xf617aa[_0xa647('0x100')],'ListId':_0xf617aa[_0xa647('0x101')],'VoiceQueueId':_0xf617aa[_0xa647('0xde')]||undefined,'CampaignId':_0xf617aa[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch('[rescheduleContact][Machine]'));_0x558663({'reschedule':0x1});}}});}if(_0x27cefe[_0xa647('0x5c')]==='ivr'&&this[_0xa647('0x23')][_0x27cefe[_0xa647('0xbf')]]['dialAMDActive']&&_0x564c15[_0xa647('0xe7')]==='HANGUP'){delete this[_0xa647('0x29')][_0x564c15[_0xa647('0xe2')]];this[_0xa647('0xbe')](this[_0xa647('0x23')][_0x27cefe[_0xa647('0xbf')]]);_0x2b3810=new Hangup(_0x27cefe,_0x564c15);_0x2b3810[_0xa647('0xb5')]=0x12;_0x2b3810[_0xa647('0xb6')]='HangupInAMD';_0x2b3810['membername']=_0xa647('0xeb');this[_0xa647('0xdb')](_0x2b3810,_0xa647('0x103'),'[syncHangupInAMDIvr]');}if(_0x27cefe[_0xa647('0x5c')]===_0xa647('0x85')&&this['campaigns'][_0x27cefe[_0xa647('0xbf')]][_0xa647('0xed')]&&_0x564c15['value']==='MACHINE'){var _0x40dcf2=this;return new BPromise(function(_0x5b2a52,_0x4b6f5a){delete _0x40dcf2[_0xa647('0x29')][_0x564c15[_0xa647('0xe2')]];_0x40dcf2[_0xa647('0xbe')](_0x40dcf2[_0xa647('0x23')][_0x27cefe[_0xa647('0xbf')]]);_0x40dcf2[_0xa647('0x23')][_0x27cefe[_0xa647('0xbf')]][_0xa647('0x66')]+=0x1;_0x40dcf2[_0xa647('0x23')][_0x27cefe[_0xa647('0xbf')]][_0xa647('0x65')]+=0x1;var _0x41b03b=_0x40dcf2[_0xa647('0x23')][_0x27cefe[_0xa647('0xbf')]];var _0x5ba9a5=new Hangup(_0x27cefe,_0x564c15);_0x5ba9a5['state']=0x13;_0x5ba9a5[_0xa647('0xb6')]='Machine';_0x5ba9a5[_0xa647('0xea')]=_0xa647('0xeb');_0x5ba9a5[_0xa647('0xf0')]+=0x1;_0x5ba9a5[_0xa647('0x104')]+=0x1;_0x5ba9a5[_0xa647('0xf1')]=!![];_0x40dcf2[_0xa647('0xd4')](_0x5ba9a5)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5ba9a5[_0xa647('0xf3')]+_0x5ba9a5['countcongestionretry']+_0x5ba9a5[_0xa647('0xf4')]+_0x5ba9a5['countnosuchnumberretry']+_0x5ba9a5[_0xa647('0xf5')]+_0x5ba9a5[_0xa647('0xf6')]+_0x5ba9a5['countmachineretry']+_0x5ba9a5['countagentrejectretry']>=_0x41b03b[_0xa647('0xf7')]){_0x40dcf2[_0xa647('0xf8')](_0x5ba9a5,_0x5b2a52,_0x4b6f5a,_0xa647('0xf9'));}else{if(_0x5ba9a5[_0xa647('0xf0')]>=_0x41b03b[_0xa647('0xfa')]){_0x40dcf2[_0xa647('0xfb')](_0x5ba9a5,_0x5b2a52,_0x4b6f5a,'reason\x2019\x20machine....');}else{_0x40dcf2[_0xa647('0xca')]({'active':![],'countmachineretry':_0x5ba9a5['countmachineretry'],'scheduledat':moment()[_0xa647('0x105')](_0x41b03b[_0xa647('0xfd')],'minutes')[_0xa647('0x86')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ba9a5['ContactId'],'ListId':_0x5ba9a5[_0xa647('0x101')],'VoiceQueueId':_0x5ba9a5[_0xa647('0xde')]||undefined,'CampaignId':_0x5ba9a5[_0xa647('0x102')]||undefined})['catch'](loggerCatch(_0xa647('0x106')));_0x5b2a52({'reschedule':0x1});}}});}}};Dialer[_0xa647('0x1c')][_0xa647('0x37')]=function(_0x2f212d){var _0x7e7f91=this[_0xa647('0x29')][_0x2f212d[_0xa647('0xe2')]];var _0x5826a9=this;var _0x352617;if(_0x7e7f91&&_0x7e7f91[_0xa647('0x5c')]===_0xa647('0x85')){delete this[_0xa647('0x29')][_0x2f212d['uniqueid']];this[_0xa647('0xbe')](this[_0xa647('0x23')][_0x7e7f91[_0xa647('0xbf')]]);this[_0xa647('0x23')][_0x7e7f91[_0xa647('0xbf')]][_0xa647('0x107')]+=0x1;_0x352617=new Hangup(_0x7e7f91,_0x2f212d);this['createHistory'](_0x352617)[_0xa647('0xc3')](loggerCatch(_0xa647('0x108')));this[_0xa647('0xd2')](_0x352617)[_0xa647('0xc3')](loggerCatch(_0xa647('0x109')));}if(_0x7e7f91&&_0x7e7f91['type']!==_0xa647('0x85')&&isNotNull(this['voiceQueues'][_0x7e7f91[_0xa647('0xbf')]][_0xa647('0x10a')])){delete this[_0xa647('0x29')][_0x2f212d['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x7e7f91[_0xa647('0xbf')]]);this['voiceQueues'][_0x7e7f91['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xa647('0x22')][_0x7e7f91['queue']][_0xa647('0x65')]+=0x1;_0x352617=new Hangup(_0x7e7f91,_0x2f212d);_0x352617[_0xa647('0xb5')]=0x10;_0x352617[_0xa647('0xb6')]=_0xa647('0x10b');_0x352617['membername']='AGI';this[_0xa647('0xd4')](_0x352617)[_0xa647('0xc3')](loggerCatch(_0xa647('0x108')));this[_0xa647('0xd2')](_0x352617)[_0xa647('0xc3')](loggerCatch(_0xa647('0x109')));}if(_0x7e7f91&&_0x7e7f91[_0xa647('0x5c')]!==_0xa647('0x85')&&!isNotNull(this['voiceQueues'][_0x7e7f91[_0xa647('0xbf')]][_0xa647('0x10a')])){delete this['uniqueId'][_0x2f212d[_0xa647('0xe2')]];this[_0xa647('0xbe')](this[_0xa647('0x22')][_0x7e7f91[_0xa647('0xbf')]]);this[_0xa647('0x22')][_0x7e7f91['queue']][_0xa647('0x10c')]+=0x1;_0x352617=new Hangup(_0x7e7f91,_0x2f212d);_0x352617[_0xa647('0xb5')]=0xc;_0x352617[_0xa647('0xb6')]=_0x2f212d['cause-txt'];_0x352617[_0xa647('0xea')]=_0xa647('0x10d');this[_0xa647('0xd4')](_0x352617)[_0xa647('0xc3')](loggerCatch(_0xa647('0x108')));this[_0xa647('0xd2')](_0x352617)[_0xa647('0xc3')](loggerCatch(_0xa647('0x109')));}};Dialer[_0xa647('0x1c')][_0xa647('0x10e')]=function(_0x239a63){var _0x351c71=this[_0xa647('0x29')][_0x239a63['uniqueid']];var _0xb1ecad=this;if(this[_0xa647('0x22')][_0x239a63[_0xa647('0xbf')]]){if(_0x351c71&&_0x351c71[_0xa647('0x5c')]!=='ivr'){delete this[_0xa647('0x29')][_0x239a63[_0xa647('0xe2')]];this['voiceQueues'][_0x239a63[_0xa647('0xbf')]][_0xa647('0x66')]+=0x1;var _0x124d33=new AgentComplete(_0x351c71,_0x239a63);if(_0x239a63[_0xa647('0x10f')]==='agent'){_0x124d33[_0xa647('0x110')]=this[_0xa647('0x22')][_0x239a63['queue']][_0xa647('0x111')]&&this['voiceQueues'][_0x239a63[_0xa647('0xbf')]][_0xa647('0x112')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x124d33)[_0xa647('0xc3')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x124d33)[_0xa647('0xc3')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xa647('0x1c')][_0xa647('0x2f')]=function(_0x3fc1fc){if(this[_0xa647('0x22')][_0x3fc1fc['queue']]){if(this[_0xa647('0x29')][_0x3fc1fc[_0xa647('0xe2')]]&&this['uniqueId'][_0x3fc1fc[_0xa647('0xe2')]][_0xa647('0x5c')]!==_0xa647('0x85')){this[_0xa647('0xbe')](this[_0xa647('0x22')][_0x3fc1fc['queue']]);this[_0xa647('0x29')][_0x3fc1fc[_0xa647('0xe2')]][_0xa647('0x113')]=moment()[_0xa647('0x86')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xa647('0x1c')][_0xa647('0x114')]=function(_0x3eb789){this['createHistory'](_0x3eb789)[_0xa647('0xc3')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xa647('0xd2')](_0x3eb789)['catch'](loggerCatch(_0xa647('0x115')));};Dialer[_0xa647('0x1c')][_0xa647('0x31')]=function(_0x307d47){var _0x22be48=this[_0xa647('0x29')][_0x307d47[_0xa647('0xe2')]];var _0x3aed58=this;if(this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]]){if(_0x22be48&&_0x22be48['type']!==_0xa647('0x85')){delete this[_0xa647('0x29')][_0x307d47[_0xa647('0xe2')]];this[_0xa647('0xbe')](this['voiceQueues'][_0x307d47[_0xa647('0xbf')]]);_0x22be48[_0xa647('0x116')]=moment()[_0xa647('0x86')]('YYYY-MM-DD\x20HH:mm:ss');var _0x436cb9=new QueueCallerAbandon(_0x22be48,_0x307d47);if(getSeconds(_0x22be48[_0xa647('0x116')],_0x22be48[_0xa647('0x117')])>=_0x22be48[_0xa647('0x118')]){this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]][_0xa647('0x8e')]+=0x1;this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]][_0xa647('0x75')]+=0x1;_0x436cb9['state']=0xa;_0x436cb9[_0xa647('0xb6')]=_0xa647('0x119');_0x436cb9['dropreason']='TIMEOUT';_0x436cb9[_0xa647('0x110')]=this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]][_0xa647('0x111')]?moment()[_0xa647('0x86')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x436cb9[_0xa647('0xf5')]+=0x1;_0x436cb9[_0xa647('0x104')]+=0x1;if(_0x436cb9[_0xa647('0xf5')]>=this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]]['dialDropMaxRetry']){this[_0xa647('0x114')](_0x436cb9);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x436cb9[_0xa647('0xf5')],'scheduledat':moment()[_0xa647('0x105')](this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]][_0xa647('0x11a')],_0xa647('0xfe'))['format'](_0xa647('0xff')),'ContactId':_0x22be48[_0xa647('0x100')],'ListId':_0x22be48['ListId'],'VoiceQueueId':_0x22be48['VoiceQueueId']||undefined,'CampaignId':_0x22be48[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch(_0xa647('0x11b')));var _0x23a888=new History(_0x436cb9);_0x23a888[_0xa647('0xb5')]=0xa;_0x23a888[_0xa647('0xb6')]='Drop';_0x23a888['starttime']=moment()[_0xa647('0x86')]('YYYY-MM-DD\x20HH:mm:ss');_0x23a888[_0xa647('0xb7')]=_0x23a888[_0xa647('0xb8')];_0x23a888[_0xa647('0x11c')]=_0x436cb9[_0xa647('0x11c')];_0x23a888['calleridnum']=_0x436cb9[_0xa647('0x11d')];this['createHistory'](_0x23a888)['catch'](loggerCatch(_0xa647('0x11e')));}}else{this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]][_0xa647('0x73')]+=0x1;this[_0xa647('0x22')][_0x307d47['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x436cb9[_0xa647('0xb5')]=0xb;_0x436cb9[_0xa647('0xb6')]=_0xa647('0x11f');_0x436cb9['dropreason']='CALLEREXIT';_0x436cb9[_0xa647('0xf6')]+=0x1;_0x436cb9['countglobal']+=0x1;if(_0x436cb9[_0xa647('0xf6')]>=this[_0xa647('0x22')][_0x307d47[_0xa647('0xbf')]][_0xa647('0x120')]){this[_0xa647('0x114')](_0x436cb9);}else{this[_0xa647('0xca')]({'active':![],'countabandonedretry':_0x436cb9['countabandonedretry'],'scheduledat':moment()['add'](this['voiceQueues'][_0x307d47[_0xa647('0xbf')]][_0xa647('0x121')],_0xa647('0xfe'))[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0x22be48[_0xa647('0x100')],'ListId':_0x22be48['ListId'],'VoiceQueueId':_0x22be48[_0xa647('0xde')]||undefined,'CampaignId':_0x22be48[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch(_0xa647('0x122')));var _0x23a888=new History(_0x436cb9);_0x23a888[_0xa647('0xb5')]=0xb;_0x23a888[_0xa647('0xb6')]=_0xa647('0x11f');_0x23a888[_0xa647('0xb8')]=moment()['format'](_0xa647('0xff'));_0x23a888[_0xa647('0xb7')]=_0x23a888[_0xa647('0xb8')];_0x23a888[_0xa647('0x11c')]=_0x436cb9['calleridname'];_0x23a888['calleridnum']=_0x436cb9[_0xa647('0x11d')];this[_0xa647('0xd4')](_0x23a888)[_0xa647('0xc3')](loggerCatch(_0xa647('0x123')));}}}}};Dialer[_0xa647('0x1c')][_0xa647('0x39')]=function(_0x1da96c){if(this['actions'][_0x1da96c[_0xa647('0xe2')]]){this[_0xa647('0x27')][_0x1da96c[_0xa647('0xe2')]]['channel']=_0x1da96c[_0xa647('0x124')];}if(this[_0xa647('0x29')][_0x1da96c['uniqueid']]){this['uniqueId'][_0x1da96c[_0xa647('0xe2')]][_0xa647('0x124')]=_0x1da96c[_0xa647('0x124')];}};Dialer[_0xa647('0x1c')][_0xa647('0x125')]=function(_0x416bda){if(strategy[this['voiceQueues'][this[_0xa647('0x27')][_0x416bda['actionid']][_0xa647('0xbf')]]['strategy']]===_0xa647('0x1b')){if(this['actions'][_0x416bda[_0xa647('0x126')]]&&_[_0xa647('0xbc')](this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]][_0xa647('0x127')])&&_0x416bda[_0xa647('0xbd')]==='1'&&_0x416bda['paused']==='0'){if(this['agents'][_0x416bda[_0xa647('0x128')]]){if(!this[_0xa647('0x24')][_0x416bda[_0xa647('0x128')]][_0xa647('0x127')]){this[_0xa647('0x24')][_0x416bda[_0xa647('0x128')]]['locked']=!![];this['actions'][_0x416bda['actionid']][_0xa647('0x127')]=!![];this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]]['stateinterface']=_0x416bda['stateinterface'];}}}}else if((strategy[this[_0xa647('0x22')][this[_0xa647('0x27')][_0x416bda['actionid']][_0xa647('0xbf')]]['strategy']]||_0xa647('0x1a'))===_0xa647('0x1a')){if(this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]]){if(this[_0xa647('0x24')][_0x416bda[_0xa647('0x128')]]){this['actions'][_0x416bda[_0xa647('0x126')]]['stateinterface']=_0x416bda[_0xa647('0x128')];if(_[_0xa647('0xbc')](this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]][_0xa647('0xbf')]])){this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]][_0xa647('0xbf')]]=[];}this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]][_0xa647('0xbf')]][_0xa647('0x129')](_[_0xa647('0x9b')](_[_0xa647('0xdc')](this[_0xa647('0x27')][_0x416bda[_0xa647('0x126')]],[_0xa647('0x12a'),_0xa647('0x128')]),{'status':_0x416bda[_0xa647('0xbd')],'paused':_0x416bda[_0xa647('0x12b')]}));}}}};function unlockQueueStatus(_0x252885,_0x2be8b8){setTimeout(function(){if(_[_0xa647('0x3f')](_0x252885['queueStatusComplete'])){loggerBooked[_0xa647('0xa3')](_0xa647('0x12c'),_0x2be8b8);}_0x252885['queueStatusComplete']=!![];loggerBooked[_0xa647('0x89')](_0xa647('0x12d'),_0x2be8b8,JSON[_0xa647('0x4d')](_[_0xa647('0xdc')](_0x252885,[_0xa647('0x41'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xa647('0x1c')][_0xa647('0x3e')]=function(_0x550292){var _0x16c18c=this;var _0x316f05=_0x16c18c[_0xa647('0x22')][_0x16c18c[_0xa647('0x27')][_0x550292[_0xa647('0x126')]]['queue']];if(strategy[this[_0xa647('0x22')][this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0xbf')]]['strategy']]===_0xa647('0x1b')){if(this['actions'][_0x550292['actionid']]&&this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0x128')]){this['preview'][_0xa647('0x12e')](this['actions'][_0x550292['actionid']][_0xa647('0x12a')],this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]]['stateinterface'])[_0xa647('0xc3')](function(_0x47d9e0){logger[_0xa647('0xa3')](_0xa647('0x12f'),util['inspect'](_0x47d9e0,{'showHidden':![],'depth':null}));})[_0xa647('0x1f')](function(){_0x16c18c[_0xa647('0xbe')](_0x16c18c['voiceQueues'][_0x16c18c[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0xbf')]]);_0x16c18c[_0xa647('0x24')][_0x16c18c[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0x128')]][_0xa647('0x127')]=![];delete _0x16c18c['actions'][_0x550292[_0xa647('0x126')]];unlockQueueStatus(_0x316f05);});}else{this[_0xa647('0xbe')](this['voiceQueues'][this['actions'][_0x550292[_0xa647('0x126')]][_0xa647('0xbf')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0x100')],'ListId':this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0x101')],'VoiceQueueId':this[_0xa647('0x27')][_0x550292['actionid']][_0xa647('0xde')]||undefined,'CampaignId':this['actions'][_0x550292[_0xa647('0x126')]][_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch(_0xa647('0x130')));delete this['actions'][_0x550292['actionid']];unlockQueueStatus(_0x316f05);}}else if((strategy[this['voiceQueues'][this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0xbf')]][_0xa647('0x53')]]||_0xa647('0x1a'))===_0xa647('0x1a')){var _0x518290;if(this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]]&&!_[_0xa647('0x4a')](this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x550292['actionid']][_0xa647('0xbf')]])){if(this['queueBookedRR'][_0x16c18c[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0xbf')]]){this[_0xa647('0x2d')][_0x16c18c[_0xa647('0x27')][_0x550292['actionid']][_0xa647('0xbf')]]=this['queueBookedRR'][this['actions'][_0x550292['actionid']]['queue']]?this[_0xa647('0x2d')][this['actions'][_0x550292[_0xa647('0x126')]]['queue']]:this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x550292['actionid']]['queue']]?this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]]['queue']][_0xa647('0x131')]||0x0:0x0;}this[_0xa647('0x2c')][this[_0xa647('0x27')][_0x550292[_0xa647('0x126')]][_0xa647('0xbf')]]['_rr']=this['queueBookedRR'][this[_0xa647('0x27')][_0x550292['actionid']][_0xa647('0xbf')]];for(var _0x8f64e2=0x0;_0x8f64e2=0x0?!![]:![];})[_0xa647('0xc3')](myreject(_0x3f13b9)));}}else{_0x1a99a3[_0xa647('0x129')](ami['Action']({'action':_0xa647('0x149'),'command':util[_0xa647('0x86')](_0xa647('0x14a'),_0x2db700,!_[_0xa647('0x3f')](config[_0xa647('0x145')][_0x2f1aa8])?_0x2f1aa8:'')})[_0xa647('0xc5')](function(_0x28cd8b){return _0x28cd8b[_0xa647('0x14c')][_0xa647('0x14d')]('true')>=0x0?!![]:![];})[_0xa647('0xc3')](myreject(_0x3f13b9)));}BPromise[_0xa647('0x14e')](_0x1a99a3)['then'](function(_0xa86038){var _0x1efca8=_[_0xa647('0x14f')](_0xa86038);if(_0x1efca8){return _0x4a3f87(_0x1efca8);}else{_0x5dec91[_0xa647('0x43')]=_0x3ebef7?_0xa647('0x150'):_0xa647('0x151');return _0x3f13b9(msgResponse(_0xa647('0x152'),_0xa647('0x141'),'Global:\x20'+_0x3ebef7+'\x20'+_0x174b92+_0xa647('0x153')+util[_0xa647('0xa4')](_0x2db700,{'showHidden':![],'depth':null})+_0xa647('0x154')+_0x2f1aa8));}})[_0xa647('0xc3')](function(_0x397be7){return _0x3f13b9(msgResponse(_0xa647('0x140'),'Failure',JSON[_0xa647('0x4d')](_0x397be7)));});});};Dialer[_0xa647('0x1c')][_0xa647('0x155')]=function(_0x193cd2){var _0x2bdf0f=this;return function(){switch(_0x193cd2['dialMethod']){case _0xa647('0x156'):freeVariablesPredictive(_0x193cd2);_0x2bdf0f['handlePower'](_0x193cd2,0x1);break;case _0xa647('0x157'):freeVariablesPredictive(_0x193cd2);_0x2bdf0f[_0xa647('0x158')](_0x193cd2,_0x193cd2[_0xa647('0x159')]);break;case _0xa647('0xb'):_0x2bdf0f[_0xa647('0xb')](_0x193cd2);break;case _0xa647('0x15a'):freeVariablesPredictive(_0x193cd2);_0x2bdf0f[_0xa647('0x158')](_0x193cd2,0x1);break;default:freeVariablesPredictive(_0x193cd2);logger[_0xa647('0xa3')](_0xa647('0x15b'),_0x193cd2[_0xa647('0x41')],_0xa647('0x15c'));}};};Dialer['prototype'][_0xa647('0x15d')]=function(_0xa25525){var _0x1ecf8a=this;return function(){_0x1ecf8a[_0xa647('0x15e')](_0xa25525);};};Dialer[_0xa647('0x1c')]['syncQueueSummary']=function(_0x3c5257){var _0x19affb=this;if(isNotPreview(_0x3c5257['dialMethod'])){if(isVoiceQueueOutbound(_0x3c5257[_0xa647('0x5c')])&&isActive(_0x3c5257['dialActive'])){_0x3c5257[_0xa647('0xaf')]=!![];BPromise['resolve']()[_0xa647('0xc5')](checkIsLoggedIn(_0x3c5257,_0x3c5257[_0xa647('0x56')]))['then'](checkIsActive(_0x3c5257,_0x3c5257['dialActive']))[_0xa647('0xc5')](checkInterval(_0x3c5257))['then'](_0x19affb[_0xa647('0x13b')](_0x3c5257))[_0xa647('0xc5')](_0x19affb['checkIfTime'](_0x3c5257[_0xa647('0x15f')],_0x3c5257[_0xa647('0x160')],_0x3c5257[_0xa647('0x41')],_0x3c5257))['then'](_0x19affb['checkIfTimeIntervals'](_0x3c5257[_0xa647('0x46')],_0x3c5257[_0xa647('0x160')],_0x3c5257[_0xa647('0x41')],_0x3c5257))[_0xa647('0xc5')](_0x19affb['checkDialMethod'](_0x3c5257))['catch'](loggerCatchQueueSummary(_0xa647('0x161'),_0x3c5257));}else{notSendMessagesQueue(_0x3c5257);}}else{freeVariablesPredictive(_0x3c5257);}};Dialer['prototype'][_0xa647('0x162')]=function(){var _0x45f95c=this;var _0x25b5a7;for(var _0x1eef41 in this[_0xa647('0x23')]){if(this[_0xa647('0x23')]['hasOwnProperty'](_0x1eef41)){_0x25b5a7=this[_0xa647('0x23')][_0x1eef41];if(isCampaignIvr(_0x25b5a7[_0xa647('0x5c')])&&isActive(_0x25b5a7[_0xa647('0x81')])){_0x25b5a7[_0xa647('0xaf')]=!![];BPromise[_0xa647('0xc8')]()[_0xa647('0xc5')](checkIsActive(_0x25b5a7,_0x25b5a7[_0xa647('0x81')]))[_0xa647('0xc5')](checkInterval(_0x25b5a7))['then'](_0x45f95c[_0xa647('0x13b')](_0x25b5a7))[_0xa647('0xc5')](_0x45f95c[_0xa647('0x13f')](_0x25b5a7[_0xa647('0x15f')],_0x25b5a7['dialTimezone'],_0x25b5a7[_0xa647('0x41')],_0x25b5a7))[_0xa647('0xc5')](_0x45f95c[_0xa647('0x163')](_0x25b5a7[_0xa647('0x46')],_0x25b5a7[_0xa647('0x160')],_0x25b5a7['name'],_0x25b5a7))[_0xa647('0xc5')](_0x45f95c['launchHandleIvr'](_0x25b5a7))[_0xa647('0xc3')](loggerCatchQueueSummary(_0xa647('0x164'),_0x25b5a7));}else{notSendMessagesCampaign(_0x25b5a7);}}}};function getCallerIdRandom(_0x234331,_0x3f535c){var _0x19c354,_0x3be04c,_0x333ad9;if(_0x3f535c<=0x0){_0x3f535c=0x1;}_0x19c354=new RegExp(_0xa647('0x165')+_0x3f535c+'}$');_0x3be04c=Math['pow'](0xa,_0x3f535c-0x1);_0x333ad9=Math['pow'](0xa,_0x3f535c)-0x1;return util['format']('%s',_[_0xa647('0x166')](_0x234331,_0x19c354,_[_0xa647('0x167')](_0x3be04c,_0x333ad9)));}function extractCalleridName(_0x50091e){var _0x43e582=_0x50091e[_0xa647('0x168')](/"(.*?)"/);return _0x43e582?_0x43e582[0x1]:_0x50091e;}function extractCalleridNumber(_0x12bb59){var _0x163976=_0x12bb59[_0xa647('0x168')](/<(.*?)>/);return _0x163976?_0x163976[0x1]:_0x12bb59;}Dialer[_0xa647('0x1c')][_0xa647('0x169')]=function(_0x2b6cd9,_0x124873){var _0x25fe70=this;var _0x50a512=uuid['v4']();this[_0xa647('0x27')][_0x50a512]=new Action(_0x2b6cd9,_0x124873,_0x50a512);return new BPromise(function(_0xcb9404,_0x5479f4){if(_['isUndefined'](_0x2b6cd9)&&'object'!==typeof _0x2b6cd9){return _0x5479f4(msgResponse('originate',_0xa647('0x141'),_0xa647('0x16a')));}if(_[_0xa647('0x3f')](_0x124873[_0xa647('0x16b')][_0xa647('0x16c')])||_0x124873[_0xa647('0x16b')]['phone']===null){return _0x5479f4(msgResponse(_0xa647('0x16d'),_0xa647('0x141'),_0xa647('0x16e')));}var _0x50574a={'XMD-CALLERID':_0x25fe70[_0xa647('0x27')][_0x50a512]['getCaller'](),'XMD-AGI':_0x2b6cd9[_0xa647('0x10a')]?util[_0xa647('0x86')](_0xa647('0x16f'),ipAgi,_0x2b6cd9['dialQueueProject']):_0xa647('0x170'),'XMD-AGIAFTER':_0x2b6cd9['dialQueueProject2']?util[_0xa647('0x86')](_0xa647('0x16f'),ipAgi,_0x2b6cd9[_0xa647('0x111')]):'NONE','XMD-QUEUE':_0x2b6cd9[_0xa647('0x5c')]==='outbound'?util[_0xa647('0x86')]('\x22%s,%s%s,,,%s\x22',_0x2b6cd9[_0xa647('0x41')],_0x2b6cd9[_0xa647('0x171')]||'',_0x2b6cd9['dialAgiAfterHangupAgent']?'c':'',_0x2b6cd9[_0xa647('0x118')]||0x3):_0xa647('0x170'),'XMD-CONTACTID':_0x124873[_0xa647('0x100')],'XMD-CDRTYPE':_0xa647('0xa'),'CALLERID(all)':_0x25fe70[_0xa647('0x27')][_0x50a512][_0xa647('0x172')](),'XMD-AMD':_0x2b6cd9[_0xa647('0xed')]?'ACTIVE':_0xa647('0x170'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2b6cd9[_0xa647('0xed')]){_0x50574a[_0xa647('0x173')]=_0x2b6cd9[_0xa647('0x174')]||0x9c4;_0x50574a[_0xa647('0x175')]=_0x2b6cd9[_0xa647('0x176')]||0x5dc;_0x50574a['XMD-AMDAFTERGREETINGSILENCE']=_0x2b6cd9[_0xa647('0x177')]||0x320;_0x50574a['XMD-AMDTOTALANALYSISTIME']=_0x2b6cd9[_0xa647('0x178')]||0x1388;_0x50574a[_0xa647('0x179')]=_0x2b6cd9[_0xa647('0x17a')]||0x64;_0x50574a[_0xa647('0x17b')]=_0x2b6cd9[_0xa647('0x17c')]||0x32;_0x50574a[_0xa647('0x17d')]=_0x2b6cd9[_0xa647('0x17e')]||0x3;_0x50574a[_0xa647('0x17f')]=_0x2b6cd9[_0xa647('0x180')]||0x100;_0x50574a[_0xa647('0x181')]=_0x2b6cd9[_0xa647('0x182')]||0x1388;}if(_0x2b6cd9['type']===_0xa647('0x52')){_0x50574a['XMD-VOICEQUEUEID']=_0x124873[_0xa647('0xde')];}else{_0x50574a[_0xa647('0x183')]=_0x124873[_0xa647('0x102')];}for(var _0x283c2c in _0x124873[_0xa647('0x16b')]){if(_0x124873['Contact'][_0xa647('0xa7')](_0x283c2c)){if(isNotNull(_0x124873['Contact'][_0x283c2c])&&_0x283c2c!=='id'&&_0x283c2c!==_0xa647('0x184')&&_0x283c2c!==_0xa647('0x185')&&_0x283c2c!==_0xa647('0x186')){_0x50574a[util[_0xa647('0x86')]('%s%s',_0xa647('0x187'),_[_0xa647('0x188')](_0x283c2c))]=_0x124873['Contact'][_0x283c2c];}}}var _0x5b71d2=_0x25fe70[_0xa647('0x13c')](_0x2b6cd9[_0xa647('0x80')])?getCallerId(_0x2b6cd9[_0xa647('0x80')][_0xa647('0x82')],_0x2b6cd9[_0xa647('0x62')],_0x2b6cd9[_0xa647('0x189')]>0x0?getCallerIdRandom(_0x2b6cd9[_0xa647('0x63')],_0x2b6cd9[_0xa647('0x189')]):_0x2b6cd9['dialOriginateCallerIdNumber']):getCallerId(_[_0xa647('0xbc')](_0x2b6cd9[_0xa647('0x18a')])?_0x2b6cd9[_0xa647('0x80')][_0xa647('0x82')]:_0x2b6cd9[_0xa647('0x18a')][_0xa647('0x82')],_0x2b6cd9[_0xa647('0x62')],_0x2b6cd9[_0xa647('0x189')]>0x0?getCallerIdRandom(_0x2b6cd9[_0xa647('0x63')],_0x2b6cd9[_0xa647('0x189')]):_0x2b6cd9['dialOriginateCallerIdNumber']);if(_0x5b71d2){_0x50574a[_0xa647('0x18b')]=_0x25fe70['actions'][_0x50a512][_0xa647('0x18c')]=extractCalleridName(_0x5b71d2);_0x50574a[_0xa647('0x18d')]=_0x25fe70[_0xa647('0x27')][_0x50a512][_0xa647('0x18e')]=extractCalleridNumber(_0x5b71d2);}return ami['Action']({'actionid':_0x50a512,'action':_0xa647('0x16d'),'channel':_0x25fe70[_0xa647('0x13c')](_0x2b6cd9[_0xa647('0x80')])?util[_0xa647('0x86')](_0xa647('0x18f'),_0x2b6cd9[_0xa647('0x80')]['name'],isNotNull(_0x2b6cd9[_0xa647('0x190')])?_0x2b6cd9['dialPrefix'][_0xa647('0x191')]()||'':'',_0x2b6cd9[_0xa647('0x192')]>0x0?_0x124873[_0xa647('0x16b')][_0xa647('0x16c')]['substring'](_0x2b6cd9['dialCutDigit']):_0x124873[_0xa647('0x16b')][_0xa647('0x16c')]):util[_0xa647('0x86')]('SIP/%s/%s%s',_[_0xa647('0xbc')](_0x2b6cd9['TrunkBackup'])?_0x2b6cd9[_0xa647('0x80')]['name']:_0x2b6cd9[_0xa647('0x18a')][_0xa647('0x41')],isNotNull(_0x2b6cd9[_0xa647('0x190')])?_0x2b6cd9[_0xa647('0x190')][_0xa647('0x191')]()||'':'',_0x2b6cd9['dialCutDigit']>0x0?_0x124873[_0xa647('0x16b')][_0xa647('0x16c')][_0xa647('0x193')](_0x2b6cd9[_0xa647('0x192')]):_0x124873[_0xa647('0x16b')][_0xa647('0x16c')]),'callerid':_0x5b71d2,'Exten':_0xa647('0xe6'),'Context':'from-sip','Priority':'1','variable':_0x50574a,'timeout':(_0x2b6cd9['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x50a512})[_0xa647('0xc5')](function(_0x263414){return _0xcb9404(_0x263414);})[_0xa647('0xc3')](function(_0x647e41){_0x2b6cd9[_0xa647('0x194')]+=0x1;var _0x2e6824=new History(_0x25fe70[_0xa647('0x27')][_0x50a512]);logger['error'](util[_0xa647('0x86')](_0xa647('0x195'),JSON[_0xa647('0x4d')](_0x647e41)));_0x2e6824[_0xa647('0xb5')]=0xe;_0x2e6824[_0xa647('0xb6')]='OriginateError';_0x2e6824['starttime']=moment()['format'](_0xa647('0xff'));_0x2e6824[_0xa647('0xb7')]=_0x2e6824[_0xa647('0xb8')];_0x25fe70[_0xa647('0xd4')](_0x2e6824)['catch'](loggerCatch('[originate][error]'));_0x25fe70[_0xa647('0xd2')](_0x2e6824)[_0xa647('0xc3')](loggerCatch(_0xa647('0x196')))[_0xa647('0x1f')](function(){delete _0x25fe70['actions'][_0x50a512];return _0x5479f4(msgResponse(_0xa647('0x16d'),_0xa647('0x4c'),_0xa647('0x197')));});});});};Dialer[_0xa647('0x1c')][_0xa647('0x34')]=function(_0x328e98){var _0x3f362b=this[_0xa647('0x27')][_0x328e98[_0xa647('0x126')]];var _0x2802b9=this;if(_0x3f362b){delete this[_0xa647('0x27')][_0x328e98[_0xa647('0x126')]];_0x3f362b[_0xa647('0x117')]=moment()[_0xa647('0x86')](_0xa647('0xff'));var _0x103d50=_0x3f362b[_0xa647('0x5c')]===_0xa647('0x85')?this[_0xa647('0x23')][_0x3f362b[_0xa647('0xbf')]]:this['voiceQueues'][_0x3f362b['getQueue']()];if(!this[_0xa647('0xe0')](_0x328e98[_0xa647('0x198')])){this['updateOriginated'](_0x103d50);return this['callProgressDetecting'](_0x3f362b,_0x103d50,_0x328e98)[_0xa647('0xc5')](function(_0x4beb92){})['catch'](loggerCatch(_0xa647('0x199')));}else{this[_0xa647('0x29')][_0x328e98[_0xa647('0xe2')]]=_0x3f362b;}}};Dialer['prototype']['checkRetriveMax']=function(_0x3304bf,_0x4916b1,_0x1e628c){var _0xb7c394=new History(_0x4916b1);if(_0xb7c394[_0xa647('0xf3')]+_0xb7c394[_0xa647('0x19a')]+_0xb7c394['countnoanswerretry']+_0xb7c394['countnosuchnumberretry']+_0xb7c394[_0xa647('0xf5')]+_0xb7c394['countabandonedretry']+_0xb7c394[_0xa647('0xf0')]+_0xb7c394[_0xa647('0x19b')]>=_0x1e628c[_0xa647('0xf7')]-0x1){return!![];}switch(_0x3304bf){case 0x3:if(_0xb7c394[_0xa647('0xf4')]>=_0x1e628c['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countnoanswerretry':_0xb7c394[_0xa647('0xf4')]+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c[_0xa647('0x19c')],'minutes')[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394['ContactId'],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394[_0xa647('0xde')]||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch(_0xa647('0x19d')));}break;case 0x5:if(_0xb7c394[_0xa647('0xf3')]>=_0x1e628c['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countbusyretry':_0xb7c394[_0xa647('0xf3')]+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c[_0xa647('0x19e')],_0xa647('0xfe'))[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394[_0xa647('0x100')],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394['VoiceQueueId']||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0xb7c394[_0xa647('0x19a')]>=_0x1e628c[_0xa647('0x19f')]-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countcongestionretry':_0xb7c394[_0xa647('0x19a')]+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c[_0xa647('0x1a0')],_0xa647('0xfe'))[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394[_0xa647('0x100')],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394[_0xa647('0xde')]||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0xb7c394[_0xa647('0x1a1')]>=_0x1e628c[_0xa647('0x1a2')]-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countnosuchnumberretry':_0xb7c394[_0xa647('0x1a1')]+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c[_0xa647('0x1a3')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb7c394[_0xa647('0x100')],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394[_0xa647('0xde')]||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})['catch'](loggerCatch(_0xa647('0x1a4')));}break;case 0xa:if(_0xb7c394[_0xa647('0xf5')]>=_0x1e628c[_0xa647('0x1a5')]-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countdropretry':_0xb7c394['countdropretry']+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c['dialDropRetryFrequency'],_0xa647('0xfe'))[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394['ContactId'],'ListId':_0xb7c394['ListId'],'VoiceQueueId':_0xb7c394[_0xa647('0xde')]||undefined,'CampaignId':_0xb7c394['CampaignId']||undefined})[_0xa647('0xc3')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0xb7c394[_0xa647('0xf6')]>=_0x1e628c['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countabandonedretry':_0xb7c394[_0xa647('0xf6')]+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c[_0xa647('0x121')],'minutes')[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394[_0xa647('0x100')],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394[_0xa647('0xde')]||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0xb7c394[_0xa647('0xf0')]>=_0x1e628c[_0xa647('0xfa')]-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countmachineretry':_0xb7c394[_0xa647('0xf0')]+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c[_0xa647('0xfd')],'minutes')[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394[_0xa647('0x100')],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394['VoiceQueueId']||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})['catch'](loggerCatch(_0xa647('0x106')));}break;case 0x14:if(_0xb7c394[_0xa647('0x19b')]>=_0x1e628c['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0xa647('0xca')]({'active':![],'countagentrejectretry':_0xb7c394['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xa647('0x105')](_0x1e628c['dialAgentRejectRetryFrequency'],_0xa647('0xfe'))[_0xa647('0x86')](_0xa647('0xff')),'ContactId':_0xb7c394[_0xa647('0x100')],'ListId':_0xb7c394[_0xa647('0x101')],'VoiceQueueId':_0xb7c394['VoiceQueueId']||undefined,'CampaignId':_0xb7c394[_0xa647('0x102')]||undefined})[_0xa647('0xc3')](loggerCatch(_0xa647('0x1a6')));}break;default:return!![];}};Dialer[_0xa647('0x1c')][_0xa647('0x1a7')]=function(_0x27ea17,_0x1d5917,_0x271492){var _0x460f4c=this;var _0x431417=new History(_0x27ea17);return new BPromise(function(_0x238e7a,_0x50643a){if(_[_0xa647('0x3f')](_0x1d5917)&&_0xa647('0x1a8')!==typeof _0x1d5917){return _0x50643a(msgResponse(_0xa647('0x1a9'),_0xa647('0x141'),_0xa647('0x1aa')));}if(_[_0xa647('0x3f')](_0x271492)&&_0xa647('0x1a8')!==typeof _0x271492){return _0x50643a(msgResponse(_0xa647('0x1a9'),_0xa647('0x141'),_0xa647('0x1ab')));}switch(_0x271492['reason']){case'0':_0x1d5917[_0xa647('0x6d')]+=0x1;_0x431417[_0xa647('0xb5')]=0x0;_0x431417['statedesc']=_0xa647('0x1ac');_0x431417['countnosuchnumberretry']+=0x1;_0x431417[_0xa647('0x104')]+=0x1;ami['emit'](_0xa647('0x1ad'),ut['buildObj'](_0x27ea17,'nosuchnumber'));_0x460f4c[_0xa647('0xd4')](_0x431417)[_0xa647('0xc3')](loggerCatch(_0xa647('0xf2')));if(_0x460f4c[_0xa647('0x1ae')](0x0,_0x27ea17,_0x1d5917)){if(_0x431417['countnosuchnumberretry']>=_0x1d5917[_0xa647('0x1a2')]){_0x460f4c[_0xa647('0xfb')](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1af'));}else{_0x460f4c[_0xa647('0xf8')](_0x431417,_0x238e7a,_0x50643a,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1d5917[_0xa647('0x6c')]+=0x1;_0x431417['state']=0x3;_0x431417[_0xa647('0xb6')]=_0xa647('0x1b0');_0x431417['countnoanswerretry']+=0x1;_0x431417[_0xa647('0x104')]+=0x1;ami[_0xa647('0x51')](_0xa647('0x1b1'),ut[_0xa647('0x1b2')](_0x27ea17,'noanswer'));_0x460f4c[_0xa647('0xd4')](_0x431417)['catch'](loggerCatch(_0xa647('0x1b3')));if(_0x460f4c['checkRetriveMax'](0x3,_0x27ea17,_0x1d5917)){if(_0x431417[_0xa647('0xf4')]>=_0x1d5917[_0xa647('0x1b4')]){_0x460f4c[_0xa647('0xfb')](_0x431417,_0x238e7a,_0x50643a,'reason\x203\x20ringing\x20no\x20answer');}else{_0x460f4c[_0xa647('0xf8')](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1b5'));}}break;case'5':_0x1d5917[_0xa647('0x1b6')]+=0x1;_0x431417[_0xa647('0xb5')]=0x5;_0x431417[_0xa647('0xb6')]='Busy';_0x431417['countbusyretry']+=0x1;_0x431417['countglobal']+=0x1;ami[_0xa647('0x51')](_0xa647('0x1b7'),ut[_0xa647('0x1b2')](_0x27ea17,_0xa647('0x1b8')));_0x460f4c['createHistory'](_0x431417)[_0xa647('0xc3')](loggerCatch(_0xa647('0x1b9')));if(_0x460f4c[_0xa647('0x1ae')](0x5,_0x27ea17,_0x1d5917)){if(_0x431417[_0xa647('0xf3')]>=_0x1d5917[_0xa647('0x1ba')]){_0x460f4c[_0xa647('0xfb')](_0x431417,_0x238e7a,_0x50643a,'reason\x205\x20busy');}else{_0x460f4c[_0xa647('0xf8')](_0x431417,_0x238e7a,_0x50643a,'reason\x205\x20busy');}}break;case'8':_0x1d5917['outboundCongestionCallsDay']+=0x1;_0x431417['state']=0x8;_0x431417['statedesc']=_0xa647('0x1bb');_0x431417[_0xa647('0x19a')]+=0x1;_0x431417['countglobal']+=0x1;ami[_0xa647('0x51')]('custom:agentcongestion',ut[_0xa647('0x1b2')](_0x27ea17,_0xa647('0x1bc')));_0x460f4c[_0xa647('0xd4')](_0x431417)[_0xa647('0xc3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x460f4c['checkRetriveMax'](0x8,_0x27ea17,_0x1d5917)){if(_0x431417[_0xa647('0x19a')]>=_0x1d5917[_0xa647('0x19f')]){_0x460f4c['createStateFinal'](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1bd'));}else{_0x460f4c[_0xa647('0xf8')](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1bd'));}}break;case'11':_0x1d5917[_0xa647('0x1be')]+=0x1;_0x431417[_0xa647('0xb5')]=0xb;_0x431417['statedesc']='Abandoned';_0x431417['countabandonedretry']+=0x1;_0x431417[_0xa647('0x104')]+=0x1;_0x460f4c[_0xa647('0xd4')](_0x431417)['catch'](loggerCatch(_0xa647('0x123')));if(_0x460f4c[_0xa647('0x1ae')](0xb,_0x27ea17,_0x1d5917)){if(_0x431417[_0xa647('0xf6')]>=_0x1d5917[_0xa647('0x120')]){_0x460f4c[_0xa647('0xfb')](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1bf'));}else{_0x460f4c[_0xa647('0xf8')](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1bf'));}}break;case'20':_0x1d5917['outboundRejectCallsDay']+=0x1;_0x431417[_0xa647('0xb5')]=0x14;_0x431417[_0xa647('0xb6')]='AgentReject';_0x431417[_0xa647('0x19b')]+=0x1;_0x431417['countglobal']+=0x1;ami['emit'](_0xa647('0x1c0'),ut['buildObj'](_0x27ea17,_0xa647('0x1c1')));_0x460f4c[_0xa647('0xd4')](_0x431417)[_0xa647('0xc3')](loggerCatch(_0xa647('0x1c2')));if(_0x460f4c['checkRetriveMax'](0x14,_0x27ea17,_0x1d5917)){if(_0x431417['countagentrejectretry']>=_0x1d5917['dialAgentRejectMaxRetry']){_0x460f4c[_0xa647('0xfb')](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1c3'));}else{_0x460f4c['stateGlobal'](_0x431417,_0x238e7a,_0x50643a,_0xa647('0x1c3'));}}break;default:_0x1d5917[_0xa647('0x10c')]+=0x1;_0x431417[_0xa647('0xb5')]=0xc;_0x431417[_0xa647('0xb6')]=_0x271492[_0xa647('0x10f')];_0x460f4c[_0xa647('0xd4')](_0x431417)['catch'](loggerCatch(_0xa647('0x1c4')));if(_0x460f4c[_0xa647('0x1ae')](_0x271492[_0xa647('0x10f')],_0x27ea17,_0x1d5917)){if(_0x431417[_0xa647('0xf3')]+_0x431417['countcongestionretry']+_0x431417[_0xa647('0xf4')]+_0x431417['countnosuchnumberretry']+_0x431417['countdropretry']+_0x431417['countabandonedretry']+_0x431417[_0xa647('0xf0')]+_0x431417['countagentrejectretry']>=_0x1d5917[_0xa647('0xf7')]){_0x460f4c[_0xa647('0xf8')](_0x431417,_0x238e7a,_0x50643a,_0x271492['reason']);}else{_0x460f4c['createStateFinal'](_0x431417,_0x238e7a,_0x50643a,_0x271492['reason']);}}}});};Dialer[_0xa647('0x1c')][_0xa647('0xf8')]=function(_0x1b49ca,_0x116626,_0x36b763,_0x308091){var _0x29a997=new Final(_0x1b49ca);_0x29a997['state']=0xf;_0x29a997[_0xa647('0xb6')]='Global';this[_0xa647('0xfb')](_0x29a997,_0x116626,_0x36b763,_0x308091);};Dialer[_0xa647('0x1c')][_0xa647('0xfb')]=function(_0x2fd250,_0x452ef1,_0x5a3fea,_0x2c743a){this[_0xa647('0xd2')](_0x2fd250)[_0xa647('0xc5')](function(_0x9d4ab3){return _0x452ef1(msgResponse(_0xa647('0x1a9'),_0xa647('0x1c5'),_0x2c743a));})[_0xa647('0xc3')](function(_0x46c197){return _0x5a3fea(msgResponse(_0xa647('0x1c6'),'Failure',_0xa647('0x1c7')));});};Dialer[_0xa647('0x1c')][_0xa647('0xb')]=function(_0x1c0156){var _0x1eceba=this;var _0x5624ca=_0x1c0156[_0xa647('0x1c8')]/0x64;var _0x5a73a2=_0x1c0156[_0xa647('0x6b')]/(_0x1c0156[_0xa647('0x6b')]+_0x1c0156[_0xa647('0x66')]);var _0x2b5f68=Math[_0xa647('0x1c9')](_0x1c0156['predictiveIntervalAvailable']*(_0x1c0156['predictiveIntervalMaxThreshold']/0x64));var _0x5ba1d8=Math[_0xa647('0x1c9')](_0x1c0156['predictiveIntervalAvailable']*(_0x1c0156[_0xa647('0x1ca')]/0x64));var _0x38677e=_0x1c0156[_0xa647('0x55')]+_0x1c0156['talking'];var _0x4aebf0=Math[_0xa647('0x1cb')](_0x1c0156['erlangCalls']*_0x1c0156['erlangAbandonmentRate']*_0x1c0156[_0xa647('0x76')]*_0x1c0156['predictiveIntervalMultiplicativeFactor']);if(_[_0xa647('0x3f')](_0x1c0156[_0xa647('0x7f')])){if(!_[_0xa647('0x3f')](_0x1c0156['startPredictive'])){_0x1c0156['startPredictive']=undefined;loggerPredictive[_0xa647('0xa3')](_0xa647('0x1cc'),_0xa647('0x1cd'));}if(!_[_0xa647('0x3f')](_0x1c0156[_0xa647('0x9e')])){loggerPredictive[_0xa647('0xa3')](_0xa647('0x1cc'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x1c0156[_0xa647('0x9e')]);_0x1c0156[_0xa647('0x9e')]=undefined;}_0x1c0156['startProgressive']=moment()['format'](_0xa647('0xff'));loggerPredictive[_0xa647('0x89')](_0x1c0156['name'],'collection\x20data\x20in\x20progressive\x20at',_0x1c0156[_0xa647('0x7f')]);this[_0xa647('0x158')](_0x1c0156,0x1);}else if(ifInterval(_0x1c0156[_0xa647('0x1ce')],_0x1c0156[_0xa647('0x7f')])){this[_0xa647('0x158')](_0x1c0156,0x1);loggerPredictiveCalls['info'](_0xa647('0x1cf'),_0x1c0156['startProgressive'],_0x1c0156[_0xa647('0x41')]);_0x1c0156['erlangCalls']=0x0;_0x1c0156[_0xa647('0x75')]=0x0;}else if(_0x5624ca<_0x5a73a2&&_0x1c0156[_0xa647('0x1d0')]===_0xa647('0x1d1')){freeVariablesPredictive(_0x1c0156);loggerPredictive['info'](_0xa647('0x1d2'),_0xa647('0x1d3'),_0x5a73a2,'startProgressive',_0x1c0156[_0xa647('0x41')]);}else if(_0x4aebf0<_0x1c0156[_0xa647('0x75')]&&_0x1c0156[_0xa647('0x1d0')]===_0xa647('0x1d1')){freeVariablesPredictive(_0x1c0156);loggerPredictive['info'](_0xa647('0x1d4'),_0xa647('0x1d5'),_0x4aebf0,_0xa647('0x1d6'),_0x1c0156[_0xa647('0x75')],_0xa647('0x7f'),_0x1c0156[_0xa647('0x41')]);}else if(!ifInterval(_0x1c0156[_0xa647('0x1ce')],_0x1c0156[_0xa647('0x7f')])&&_[_0xa647('0x3f')](_0x1c0156['startPredictive'])&&!_[_0xa647('0x3f')](_0x1c0156[_0xa647('0x7f')])){_0x1c0156[_0xa647('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa647('0x89')](_0x1c0156[_0xa647('0x41')],_0xa647('0x1d7'),_0x1c0156[_0xa647('0x2a')]);this[_0xa647('0x1d8')](_0x1c0156[_0xa647('0x1ce')])[_0xa647('0xc5')](this['getDataPredictive'](_0x1c0156))[_0xa647('0xc5')](mergeDataErlangB(_0x1c0156))[_0xa647('0xc5')](this[_0xa647('0x1d9')](_0x1c0156))[_0xa647('0xc3')](loggerCatchPredictive(_0xa647('0x1da'),_0x1c0156));}else if(!ifInterval(_0x1c0156[_0xa647('0x1ce')],_0x1c0156[_0xa647('0x2a')])){_0x1c0156[_0xa647('0x75')]=0x0;_0x1c0156[_0xa647('0x2a')]=moment()[_0xa647('0x86')](_0xa647('0xff'));loggerPredictive[_0xa647('0x89')](_0x1c0156[_0xa647('0x41')],_0xa647('0x1db'),_0x1c0156['startPredictive']);clearInterval(_0x1c0156['handlePredictive']);_0x1c0156[_0xa647('0x9e')]=undefined;this[_0xa647('0x1d8')](_0x1c0156['dialPredictiveInterval'])[_0xa647('0xc5')](this[_0xa647('0x1dc')](_0x1c0156))['then'](mergeDataErlangB(_0x1c0156))['then'](this['startMethodPredictive'](_0x1c0156))[_0xa647('0xc3')](loggerCatchPredictive(_0xa647('0x1dd'),_0x1c0156));}else if(_0x1c0156[_0xa647('0x79')]&&_0x38677e<_0x1c0156[_0xa647('0x79')]-_0x5ba1d8){freeVariablesPredictive(_0x1c0156);loggerPredictive[_0xa647('0x89')](_0x1c0156[_0xa647('0x41')],_0xa647('0x1de'),_0x38677e,')\x20are\x20less\x20than\x20threshold\x20(',_0x1c0156[_0xa647('0x79')],'-',_0x5ba1d8,'=',_0x1c0156[_0xa647('0x79')]-_0x5ba1d8,')');}else if(_0x1c0156[_0xa647('0x79')]&&_0x38677e>_0x1c0156['predictiveIntervalAvailable']+_0x2b5f68){freeVariablesPredictive(_0x1c0156);loggerPredictive[_0xa647('0x89')](_0x1c0156['name'],_0xa647('0x1de'),_0x38677e,_0xa647('0x1df'),_0x1c0156[_0xa647('0x79')],'+',_0x2b5f68,'=',_0x1c0156[_0xa647('0x79')]+_0x2b5f68,')');}};Dialer[_0xa647('0x1c')][_0xa647('0x1dc')]=function(_0x2d37ee){var _0x1f4e72=this;return function(_0x1f5467){return new BPromise(function(_0x585bc8,_0x5d3fd6){_[_0xa647('0x9b')](_0x2d37ee,_0x1f5467[0x0]);if(checkGetDataPredictive(_0x1f5467[0x0])){var _0x2779ba=_0x2d37ee['predictiveIntervalAvailable']=_0x2d37ee[_0xa647('0x5b')]+_0x2d37ee[_0xa647('0x55')];var _0x1894b4=_0x2d37ee[_0xa647('0x1ce')]*0x3c;var _0xd24eec=_0x1f5467[0x0][_0xa647('0x72')]+_0x1f5467[0x0]['predictiveIntervalAvgHoldtime'];var _0x4b7e79=(_0x1f5467[0x0][_0xa647('0x70')]+_0x1f5467[0x0][_0xa647('0x8e')]+_0x1f5467[0x0][_0xa647('0x73')])/_0x1f5467[0x0][_0xa647('0x7a')];_0x2d37ee[_0xa647('0x76')]=_0x4b7e79>0x0?_0x4b7e79:0x1;switch(_0x2d37ee['dialPredictiveOptimization']){case'dropRate':var _0x30554f=_0x2d37ee[_0xa647('0x1c8')]/0x64;return _0x1f4e72[_0xa647('0x1e0')](_0x2779ba,_0x1894b4,_0xd24eec,_0x4b7e79,_0x30554f)[_0xa647('0xc5')](function(_0x3f3703){return _0x585bc8(_0x3f3703);});case'agentBusyFactor':var _0x4d57ec=_0x2d37ee['dialPredictiveOptimizationPercentage']/0x64;return _0x1f4e72[_0xa647('0x1e1')](_0x2779ba,_0x1894b4,_0xd24eec,_0x4b7e79,_0x4d57ec)[_0xa647('0xc5')](function(_0xb4b414){return _0x585bc8(_0xb4b414);});default:return _0x5d3fd6(msgResponse('[getDataPredictive]',_0xa647('0x141'),_0xa647('0x1e2')));}}else{return _0x5d3fd6(msgResponse(_0xa647('0x1e3'),_0xa647('0x141'),'check\x20failure'));}});};};Dialer[_0xa647('0x1c')][_0xa647('0x1e4')]=function(_0x285f6b){var _0x4ec42a=this;return function(_0x4ca6e1){return new BPromise(function(_0x112550,_0x193c82){_[_0xa647('0x9b')](_0x285f6b,_0x4ca6e1[0x0]);if(checkGetDataPredictive(_0x4ca6e1[0x0])){loggerPredictive[_0xa647('0x89')](JSON[_0xa647('0x4d')](_0x4ca6e1[0x0]));if(_0x285f6b[_0xa647('0x1d0')]===_0xa647('0x1d1')){return _0x4ec42a[_0xa647('0xd0')](_0x285f6b['id'])[_0xa647('0xc5')](function(_0x2933f5){var _0x22fdd1=_0x285f6b[_0xa647('0x56')]-_0x2933f5[0x0]['outboundQueuePauses'];var _0x433001=_0x285f6b[_0xa647('0x1ce')]*0x3c;var _0xbbd7e6=_0x4ca6e1[0x0][_0xa647('0x72')]+_0x4ca6e1[0x0][_0xa647('0x71')];var _0x1af93e=(_0x4ca6e1[0x0]['predictiveIntervalAnsweredCalls']+_0x4ca6e1[0x0][_0xa647('0x8e')]+_0x4ca6e1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ca6e1[0x0][_0xa647('0x7a')];var _0x220eb7=_0x285f6b['dialPredictiveOptimizationPercentage']/0x64;_0x285f6b[_0xa647('0x78')]=_0x2933f5[0x0]['outboundQueuePauses']||0x0;_0x285f6b[_0xa647('0x76')]=_0x1af93e>0x0?_0x1af93e:0x1;return _0x4ec42a[_0xa647('0x1e0')](_0x22fdd1,_0x433001,_0xbbd7e6,_0x1af93e,_0x220eb7);})['then'](function(_0x5005ba){return _0x112550(_0x5005ba);})[_0xa647('0xc3')](function(_0x637d26){return _0x193c82(msgResponse(_0xa647('0x1e5'),_0xa647('0x141'),JSON[_0xa647('0x4d')](_0x637d26)));});}if(_0x285f6b[_0xa647('0x1d0')]==='agentBusyFactor'){return _0x4ec42a['getVoiceQueueRtPauses'](_0x285f6b['id'])['then'](function(_0x113f33){var _0x433bef=_0x285f6b[_0xa647('0x56')]-_0x113f33[0x0][_0xa647('0x1e6')];var _0x2355b0=_0x285f6b[_0xa647('0x1ce')]*0x3c;var _0x35ca72=_0x4ca6e1[0x0][_0xa647('0x72')]+_0x4ca6e1[0x0][_0xa647('0x71')];var _0x1f5e0f=(_0x4ca6e1[0x0]['predictiveIntervalAnsweredCalls']+_0x4ca6e1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4ca6e1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ca6e1[0x0][_0xa647('0x7a')];var _0x44e1ec=_0x285f6b[_0xa647('0x1c8')]/0x64;_0x285f6b[_0xa647('0x78')]=_0x113f33[0x0][_0xa647('0x1e6')]||0x0;_0x285f6b[_0xa647('0x76')]=_0x1f5e0f>0x0?_0x1f5e0f:0x1;return _0x4ec42a[_0xa647('0x1e1')](_0x433bef,_0x2355b0,_0x35ca72,_0x1f5e0f,_0x44e1ec);})[_0xa647('0xc5')](function(_0x5f2284){return _0x112550(_0x5f2284);})[_0xa647('0xc3')](function(_0x341f07){return _0x193c82(msgResponse(_0xa647('0x1e5'),_0xa647('0x141'),JSON[_0xa647('0x4d')](_0x341f07)));});}}else{return _0x193c82(msgResponse(_0xa647('0x1e3'),_0xa647('0x141'),_0xa647('0x1e7')));}});};};Dialer[_0xa647('0x1c')][_0xa647('0x1d9')]=function(_0x5805a9){var _0x2fdcb5=this;return function(){var _0x58122a=0x0;var _0x2328dd=Math[_0xa647('0x1cb')](_0x5805a9[_0xa647('0x7d')]*0x3e8);if(_0x2328dd>0x0){_0x2328dd=_0x2328dd<0x64?0x64:_0x2328dd;loggerPredictive['info'](_0x5805a9[_0xa647('0x41')],_0xa647('0x1e8'),_0x2328dd,_0xa647('0x4e'));_0x5805a9['handlePredictive']=setInterval(function(){_0x2fdcb5[_0xa647('0x9e')](_0x5805a9);loggerPredictiveCalls[_0xa647('0x89')](_0xa647('0x1e9'),_0x58122a+=0x1);},_0x2328dd);}else{loggerPredictive['info'](_0x5805a9[_0xa647('0x41')],_0xa647('0x1ea'));}};};Dialer[_0xa647('0x1c')][_0xa647('0x1eb')]=function(_0x164d4b,_0x2b8a7f){var _0x187fb5=this;return function(_0x534b7c){if(_[_0xa647('0x4a')](_0x534b7c)){if(_['isNil'](_0x2b8a7f[_0xa647('0xdd')])||!_0x2b8a7f[_0xa647('0x1ec')]){if(_0x164d4b[_0xa647('0x61')]===_0xa647('0x15a')){_0x164d4b[_0xa647('0x1ed')]=_[_0xa647('0x3f')](_0x164d4b[_0xa647('0x1ed')])?!![]:_0x164d4b[_0xa647('0x1ed')];var _0x46d200=uuid['v4']();_0x187fb5[_0xa647('0x27')][_0x46d200]=new Action(_0x164d4b,_0x2b8a7f,_0x46d200);loggerBooked[_0xa647('0x89')](_0xa647('0x1ee'),_0x46d200,_0xa647('0x1ef'),JSON[_0xa647('0x4d')](_0x164d4b[_0xa647('0x1ed')]),'Queue:\x20',_0x164d4b[_0xa647('0x41')]);if(_0x164d4b[_0xa647('0x1ed')]){_0x164d4b[_0xa647('0x1ed')]=![];_0x187fb5[_0xa647('0x2c')][_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0xbf')]]=[];ami[_0xa647('0x148')]({'actionid':_0x46d200,'action':'queuestatus','queue':_0x164d4b['name']})[_0xa647('0xc3')](function(_0x59fbf9){_0x187fb5[_0xa647('0xbe')](_0x164d4b);_0x187fb5['rescheduleContact']({'active':![],'ContactId':_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0x100')],'ListId':_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0x101')],'VoiceQueueId':_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0xde')]||undefined,'CampaignId':_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0x102')]||undefined})['catch'](loggerCatch(_0xa647('0x1f0')));delete _0x187fb5['actions'][_0x46d200];});}else{loggerBooked[_0xa647('0x89')](_0xa647('0x1f1'),JSON[_0xa647('0x4d')](_0x164d4b['queueStatusComplete']),_0xa647('0x1f2'),_0x164d4b[_0xa647('0x41')]);_0x187fb5[_0xa647('0xbe')](_0x164d4b);_0x187fb5[_0xa647('0xca')]({'active':![],'ContactId':_0x187fb5['actions'][_0x46d200][_0xa647('0x100')],'ListId':_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0x101')],'VoiceQueueId':_0x187fb5['actions'][_0x46d200][_0xa647('0xde')]||undefined,'CampaignId':_0x187fb5[_0xa647('0x27')][_0x46d200][_0xa647('0x102')]||undefined})['catch'](loggerCatch(_0xa647('0x1f0')));delete _0x187fb5[_0xa647('0x27')][_0x46d200];}}else{return _0x187fb5[_0xa647('0x169')](_0x164d4b,_0x2b8a7f);}}else{if(getDiff(_0x2b8a7f['scheduledat'])<_0x164d4b[_0xa647('0x1f3')]*0x3c){if(_0x2b8a7f[_0xa647('0x1f4')]&&!_0x2b8a7f['Agent'][_0xa647('0x1f5')]){_0x187fb5[_0xa647('0x21')][_0xa647('0x12e')](_0x2b8a7f['id'])[_0xa647('0x1f')](function(){_0x187fb5[_0xa647('0xbe')](_0x164d4b);});}else{_0x187fb5[_0xa647('0xcc')]({'active':![]},_0x2b8a7f['id'],0x1)['finally'](function(){console['log']('Contact\x20updated');_0x187fb5[_0xa647('0xbe')](_0x164d4b);});}}else{_0x164d4b[_0xa647('0x6e')]+=0x1;_0x187fb5[_0xa647('0xbe')](_0x164d4b);if(_0x164d4b['dialRecallInQueue']){_0x187fb5[_0xa647('0xca')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b8a7f[_0xa647('0x100')],'ListId':_0x2b8a7f[_0xa647('0x101')],'VoiceQueueId':_0x2b8a7f[_0xa647('0xde')]||undefined,'CampaignId':_0x2b8a7f['CampaignId']||undefined})['catch'](loggerCatch(_0xa647('0x1f6')));_0x187fb5[_0xa647('0xd4')](createObjHistory(_0x164d4b,_0x2b8a7f,_0xa647('0x1f7'),0x17,'RecallInQueue'))[_0xa647('0xc3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x187fb5[_0xa647('0xdb')](createObjHistory(_0x164d4b,_0x2b8a7f,_0xa647('0x1f8'),0x16,_0xa647('0x1f9')),_0xa647('0x1fa'),_0xa647('0x1fb'));}}}}else{_0x164d4b[_0xa647('0x67')]+=0x1;_0x187fb5[_0xa647('0xdb')](createObjHistory(_0x164d4b,_0x2b8a7f,'BLACKLIST',0xd,'Blacklist'),_0xa647('0x1fc'),'[Originate][MoveBlacklist]');throw _0xa647('0x1fd');}};};Dialer[_0xa647('0x1c')]['handleIvr']=function(_0x223888){var _0x99585d=this;var _0x3adf3f=[];var _0x580ee6=_0x223888[_0xa647('0x1fe')]-_0x223888['originated']-_0x223888[_0xa647('0x1ff')];emitCampaignSummary(_0x223888);if(_0x580ee6>0x0){if(_0x580ee6>this[_0xa647('0x26')]){_0x580ee6=this[_0xa647('0x26')];}_0x223888[_0xa647('0x1ff')]+=_0x580ee6;this[_0xa647('0xcf')](_0x223888['id'],_0x580ee6,_0x223888[_0xa647('0x200')])[_0xa647('0xc5')](function(_0xe2cf16){_0x223888[_0xa647('0x1ff')]-=_0x580ee6;_0x223888[_0xa647('0x1ff')]=_0x223888[_0xa647('0x1ff')]>0x0?_0x223888['temp']:0x0;if(!checkContactEmpty(_0xe2cf16)){_0x223888[_0xa647('0x43')]=_0xa647('0xae');logger['info'](_0xa647('0x201')+_0x223888[_0xa647('0x41')]);}else{_0x223888['originated']+=_0xe2cf16['length'];_0x223888[_0xa647('0x43')]=_0xa647('0x202');for(var _0x2ec2d6=0x0;_0x2ec2d6<_0xe2cf16[_0xa647('0xa6')];_0x2ec2d6+=0x1){_0x223888[_0xa647('0x203')]+=0x1;if(_[_0xa647('0xbc')](_0xe2cf16[_0x2ec2d6])||_['isNil'](_0xe2cf16[_0x2ec2d6]['Contact'])||_[_0xa647('0xbc')](_0xe2cf16[_0x2ec2d6][_0xa647('0x16b')]['phone'])){_0x99585d[_0xa647('0xd9')](_0xa647('0x204'),_0x223888,_0xe2cf16[_0x2ec2d6]);}else{_0x99585d[_0xa647('0xc7')](_[_0xa647('0xdc')](_0xe2cf16[_0x2ec2d6],[_0xa647('0x102'),_0xa647('0x205')]))[_0xa647('0xc5')](_0x99585d[_0xa647('0x1eb')](_0x223888,_0xe2cf16[_0x2ec2d6]))[_0xa647('0xc3')](_0x99585d['loggerHandler'](_0xa647('0x206'),_0x223888));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x223888,_0x580ee6));}};Dialer[_0xa647('0x1c')][_0xa647('0x158')]=function(_0x520bff,_0x42631d){var _0x263057=this;var _0x59eae0=[];var _0x59a93c=_0x42631d>=0x1?_0x42631d:0x1;var _0x3121da=[];if(_0x520bff['dialMethod']===_0xa647('0x15a')){_0x59a93c=0x1;}var _0x180c9c=Math[_0xa647('0x1cb')](_0x520bff['available']*_0x59a93c)-_0x520bff[_0xa647('0x7b')]-_0x520bff[_0xa647('0x1ff')];emitVoiceQueueSummary(_0x520bff);if(_0x520bff[_0xa647('0x207')]>0x0){var _0x28693f=_0x520bff['dialLimitQueue']-_0x520bff[_0xa647('0x7b')]-_0x520bff[_0xa647('0x5b')]-_0x520bff['temp']-_0x520bff[_0xa647('0x57')];if(_0x180c9c>_0x28693f){_0x180c9c=_0x28693f;}}if(_0x180c9c>0x0){if(_0x520bff[_0xa647('0x61')]==='booked'){_0x180c9c=0x1;}if(_0x180c9c>this[_0xa647('0x26')]){_0x180c9c=this[_0xa647('0x26')];}_0x520bff['temp']+=_0x180c9c;for(var _0x3182f0 in this[_0xa647('0x24')]){if(this[_0xa647('0x24')][_0xa647('0xa7')](_0x3182f0)){if(this[_0xa647('0x24')][_0x3182f0][_0xa647('0xb5')]===_0xa647('0x208')&&this[_0xa647('0x24')][_0x3182f0]['status']==='reachable'){_0x59eae0[_0xa647('0x129')](this[_0xa647('0x24')][_0x3182f0]['id']);}}}this[_0xa647('0xce')](_0x520bff['id'],_0x59eae0,_0x180c9c,_0x520bff[_0xa647('0x200')])[_0xa647('0xc5')](function(_0x2c2f2f){_0x520bff[_0xa647('0x1ff')]-=_0x180c9c;_0x520bff[_0xa647('0x1ff')]=_0x520bff[_0xa647('0x1ff')]>0x0?_0x520bff[_0xa647('0x1ff')]:0x0;if(!checkContactEmpty(_0x2c2f2f)){_0x263057[_0xa647('0xc2')](_0x520bff)['then'](sendMessageReschedule(_0x520bff))[_0xa647('0xc3')](loggerCatch(_0xa647('0xc4')));}else{_0x520bff[_0xa647('0x7b')]+=_0x2c2f2f[_0xa647('0xa6')];_0x520bff['message']=_0x520bff[_0xa647('0x61')]===_0xa647('0x15a')?'ACTIVE':'RUNNING';for(var _0x35efbe=0x0;_0x35efbe<_0x2c2f2f['length'];_0x35efbe+=0x1){if(_['isNil'](_0x2c2f2f[_0x35efbe])||_[_0xa647('0xbc')](_0x2c2f2f[_0x35efbe][_0xa647('0x16b')])||_[_0xa647('0xbc')](_0x2c2f2f[_0x35efbe][_0xa647('0x16b')][_0xa647('0x16c')])){_0x263057[_0xa647('0xd9')](_0xa647('0x204'),_0x520bff,_0x2c2f2f[_0x35efbe]);}else{_0x263057[_0xa647('0x209')](_[_0xa647('0xdc')](_0x2c2f2f[_0x35efbe],['VoiceQueueId',_0xa647('0x205')]))[_0xa647('0xc5')](_0x263057[_0xa647('0x1eb')](_0x520bff,_0x2c2f2f[_0x35efbe]))[_0xa647('0xc3')](_0x263057[_0xa647('0xd8')](_0xa647('0x204'),_0x520bff));}}}})['catch'](loggerGetContactDialer(_0xa647('0x20a'),_0x520bff,_0x180c9c));}};Dialer[_0xa647('0x1c')]['handlePredictive']=function(_0x57c1fb){var _0x136bc0=this;if(_0x57c1fb[_0xa647('0x207')]>0x0){var _0x1b9a8c=_0x57c1fb[_0xa647('0x207')]-_0x57c1fb['originated']-_0x57c1fb['talking'];if(_0x1b9a8c>0x0){this[_0xa647('0x20b')](_0x57c1fb);}else{loggerPredictiveCalls[_0xa647('0x89')]('[handlePredictive][limitChannel]');}}else{this[_0xa647('0x20b')](_0x57c1fb);}};Dialer[_0xa647('0x1c')][_0xa647('0x20b')]=function(_0x58864c){var _0x132c8a=this;var _0x18f376=[];_0x58864c[_0xa647('0x7b')]+=0x1;for(var _0x287e3a in this['agents']){if(this[_0xa647('0x24')][_0xa647('0xa7')](_0x287e3a)){if(this[_0xa647('0x24')][_0x287e3a][_0xa647('0xb5')]===_0xa647('0x208')&&this[_0xa647('0x24')][_0x287e3a]['status']===_0xa647('0x20c')){_0x18f376[_0xa647('0x129')](this[_0xa647('0x24')][_0x287e3a]['id']);}}}this[_0xa647('0xce')](_0x58864c['id'],_0x18f376,0x1,_0x58864c[_0xa647('0x200')])['then'](function(_0x1eacec){if(!checkContactEmpty(_0x1eacec)){checkContactLowerLimitOriginate(_0x58864c,0x1,0x0);_0x132c8a['countReScheduled'](_0x58864c)['then'](sendMessageReschedule(_0x58864c))[_0xa647('0xc3')](loggerCatch('[countReScheduled]\x20'));}else{_0x58864c[_0xa647('0x43')]=_0xa647('0x202');if(_['isNil'](_0x1eacec[0x0])||_[_0xa647('0xbc')](_0x1eacec[0x0][_0xa647('0x16b')])||_[_0xa647('0xbc')](_0x1eacec[0x0]['Contact'][_0xa647('0x16c')])){_0x132c8a[_0xa647('0xd9')]('[actionOriginate]\x20',_0x58864c,_0x1eacec[0x0]);}else{_0x132c8a[_0xa647('0x209')](_[_0xa647('0xdc')](_0x1eacec[0x0],[_0xa647('0xde'),_0xa647('0x205')]))[_0xa647('0xc5')](_0x132c8a[_0xa647('0x1eb')](_0x58864c,_0x1eacec[0x0]))[_0xa647('0xc3')](_0x132c8a[_0xa647('0xd8')](_0xa647('0x20d'),_0x58864c));}}})[_0xa647('0xc3')](loggerGetContactDialer(_0xa647('0x20e'),_0x58864c,0x1));emitVoiceQueueSummary(_0x58864c);};Dialer[_0xa647('0x1c')][_0xa647('0x1e0')]=function(_0x56c910,_0x42d6fd,_0x407147,_0x18627b,_0x55de32,_0x573baf){loggerPredictive['info'](_0xa647('0x20f'));loggerPredictive['info'](_0xa647('0x210'),_0x56c910);loggerPredictive[_0xa647('0x89')](_0xa647('0x211'),_0x42d6fd);loggerPredictive[_0xa647('0x89')](_0xa647('0x212'),_0x407147);loggerPredictive[_0xa647('0x89')](_0xa647('0x213'),_0x18627b);loggerPredictive['info'](_0xa647('0x214'),_0x55de32);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x53a5b9,_0x43d474){if(_0x56c910<=0x0||isNaN(_0x56c910)){return _0x43d474(msgResponse('[abandonmentRate]',_0xa647('0x4c'),_0xa647('0x215')+_0x56c910));}if(_0x407147<=0x0||isNaN(_0x407147)){return _0x43d474(msgResponse('[abandonmentRate]','Error','Ts\x20=\x20'+_0x407147));}if(_0x18627b<=0x0||isNaN(_0x18627b)){return _0x43d474(msgResponse(_0xa647('0x216'),_0xa647('0x4c'),'p\x20=\x20'+_0x18627b));}if(_0x42d6fd<=0x0||isNaN(_0x42d6fd)){return _0x43d474(msgResponse('[abandonmentRate]','Error',_0xa647('0x217')+_0x42d6fd));}if(_0x55de32<=0x0||isNaN(_0x55de32)){return _0x43d474(msgResponse('[abandonmentRate]',_0xa647('0x4c'),'Amax\x20=\x20'+_0x55de32));}_0x573baf=_0x573baf||0x0;var _0x49bc73=0x1/_0x407147;var _0x4986bd=0x0;var _0x24b9a0=0x0;var _0x1cc088=0x0;var _0x1731d8=0x0;for(var _0x30f428=0x0;_0x1cc088<_0x55de32;_0x30f428+=0x1){_0x24b9a0=_0x30f428/_0x42d6fd;_0x4986bd=(_0x18627b*_0x24b9a0+_0x573baf)/_0x49bc73;_0x1cc088=erlangb(_0x4986bd,_0x56c910);_0x1731d8=_0x4986bd/_0x56c910*(0x1-erlangb(_0x4986bd,_0x56c910));}return _0x53a5b9({'erlangCalls':_0x30f428,'erlangCallToSecond':_0x42d6fd/_0x30f428,'erlangAbandonmentRate':_0x1cc088,'erlangBusyFactor':_0x1731d8});});};Dialer['prototype'][_0xa647('0x1e1')]=function(_0x1d62f6,_0xc7a34d,_0x5d0797,_0x462628,_0x23965c,_0x52679a){loggerPredictive['info'](_0xa647('0x218'));loggerPredictive[_0xa647('0x89')](_0xa647('0x210'),_0x1d62f6);loggerPredictive[_0xa647('0x89')](_0xa647('0x211'),_0xc7a34d);loggerPredictive[_0xa647('0x89')](_0xa647('0x212'),_0x5d0797);loggerPredictive['info'](_0xa647('0x213'),_0x462628);loggerPredictive[_0xa647('0x89')](_0xa647('0x219'),_0x23965c);loggerPredictive[_0xa647('0x89')]('---------------------------');return new BPromise(function(_0x40535f,_0x52ed68){if(_0x1d62f6<=0x0||isNaN(_0x1d62f6)){return _0x52ed68(msgResponse(_0xa647('0x21a'),_0xa647('0x4c'),'m\x20=\x20'+_0x1d62f6));}if(_0x5d0797<=0x0||isNaN(_0x5d0797)){return _0x52ed68(msgResponse(_0xa647('0x21a'),_0xa647('0x4c'),_0xa647('0x21b')+_0x5d0797));}if(_0x462628<=0x0||isNaN(_0x462628)){return _0x52ed68(msgResponse('[busyFactor]','Error',_0xa647('0x21c')+_0x462628));}if(_0xc7a34d<=0x0||isNaN(_0xc7a34d)){return _0x52ed68(msgResponse('[busyFactor]',_0xa647('0x4c'),_0xa647('0x217')+_0xc7a34d));}if(_0x23965c<=0x0||isNaN(_0x23965c)){return _0x52ed68(msgResponse(_0xa647('0x21a'),_0xa647('0x4c'),'Umin\x20=\x20'+_0x23965c));}_0x52679a=_0x52679a||0x0;var _0x4cbd9a=0x1/_0x5d0797;var _0x2477de=0x0;var _0x382a2=0x0;var _0x5379bf=0x0;var _0x49c04c=0x0;for(var _0x38b684=0x0;_0x49c04c<_0x23965c;_0x38b684+=0x1){_0x382a2=_0x38b684/_0xc7a34d;_0x2477de=(_0x462628*_0x382a2+_0x52679a)/_0x4cbd9a;_0x5379bf=erlangb(_0x2477de,_0x1d62f6);_0x49c04c=_0x2477de/_0x1d62f6*(0x1-erlangb(_0x2477de,_0x1d62f6));}return _0x40535f({'erlangCalls':_0x38b684,'erlangCallToSecond':_0xc7a34d/_0x38b684,'erlangAbandonmentRate':_0x5379bf,'erlangBusyFactor':_0x49c04c});});};module[_0xa647('0x21d')]=Dialer; \ No newline at end of file +var _0xa297=['dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','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','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','dialLimitQueue','not_inuse','reachable','[countReScheduled]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','dialer','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','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','predictiveIntervalAnsweredCalls','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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','active','status','saveInDb','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','minutes','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countbusyretry','countnoanswerretry','dialMachineMaxRetry','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','[syncHangupIvr][createHistory]','syncAgentComplete','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','starttime','calleridname','calleridnum','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','channel','syncQueueMember','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','interval','true','iftime\x20%s,%s','content','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','predictive','booked','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber'];(function(_0x2bcd80,_0x584064){var _0x255aa5=function(_0x59ff2e){while(--_0x59ff2e){_0x2bcd80['push'](_0x2bcd80['shift']());}};_0x255aa5(++_0x584064);}(_0xa297,0x78));var _0x7a29=function(_0x17d9d6,_0xb191b4){_0x17d9d6=_0x17d9d6-0x0;var _0x2b2535=_0xa297[_0x17d9d6];return _0x2b2535;};'use strict';var util=require(_0x7a29('0x0'));var _=require(_0x7a29('0x1'));var BPromise=require(_0x7a29('0x2'));var uuid=require(_0x7a29('0x3'));var moment=require(_0x7a29('0x4'));var rr=require('rr');var md5=require(_0x7a29('0x5'));var Redis=require(_0x7a29('0x6'));var ut=require(_0x7a29('0x7'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x7a29('0x8'));var loggerBooked=require(_0x7a29('0x9'))('booked');var loggerPredictive=require(_0x7a29('0x9'))('predictive');var loggerPredictiveCalls=require(_0x7a29('0x9'))(_0x7a29('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x7a29('0xb'));var ami=require(_0x7a29('0xc'));config['redis']=_[_0x7a29('0xd')](config[_0x7a29('0xe')],{'host':_0x7a29('0xf'),'port':0x18eb});var io=require(_0x7a29('0x10'))(new Redis(config[_0x7a29('0xe')]));var cmHopper=require(_0x7a29('0x11'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7a29('0x12'));var voiceQueueRt=require(_0x7a29('0x13'));var Action=require('./action');var History=require(_0x7a29('0x14'));var Final=require(_0x7a29('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x7a29('0x16'));var Hangup=require(_0x7a29('0x17'));var ipAgi=process['env'][_0x7a29('0x18')]||_0x7a29('0x19');var strategy={'rrmemory':_0x7a29('0x1a'),'roundrobin':_0x7a29('0x1b')};var Sequence=function(){};Sequence[_0x7a29('0x1c')][_0x7a29('0x1d')]=function(_0x485627){this[_0x7a29('0x1e')]=this[_0x7a29('0x1e')]?this[_0x7a29('0x1e')][_0x7a29('0x1f')](_0x485627):_0x485627();};function Dialer(_0x46c528,_0x243949){this[_0x7a29('0x20')]=new Sequence();this['preview']=_0x243949;this[_0x7a29('0x21')]=_0x46c528[_0x7a29('0x21')];this[_0x7a29('0x22')]=_0x46c528[_0x7a29('0x22')];this[_0x7a29('0x23')]=_0x46c528[_0x7a29('0x23')];this[_0x7a29('0x24')]=_0x46c528['trunks'];this['maxNumberOriginate']=config[_0x7a29('0x25')]||0x2;this[_0x7a29('0x26')]={};this[_0x7a29('0x27')]={};this[_0x7a29('0x28')]={};this[_0x7a29('0x29')]={};this[_0x7a29('0x2a')]={};this[_0x7a29('0x2b')]={};this[_0x7a29('0x2c')]={};this[_0x7a29('0x2d')]={};this[_0x7a29('0x2e')]={};this[_0x7a29('0x2f')]={};ami['on'](_0x7a29('0x30'),this[_0x7a29('0x31')][_0x7a29('0x32')](this));ami['on']('queuecallerabandon',this[_0x7a29('0x33')]['bind'](this));ami['on'](_0x7a29('0x34'),this[_0x7a29('0x35')][_0x7a29('0x32')](this));ami['on'](_0x7a29('0x36'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x7a29('0x37'),this[_0x7a29('0x38')][_0x7a29('0x32')](this));ami['on'](_0x7a29('0x39'),this[_0x7a29('0x3a')]['bind'](this));ami['on'](_0x7a29('0x3b'),this[_0x7a29('0x3c')][_0x7a29('0x32')](this));ami['on'](_0x7a29('0x3d'),this['syncQueueMember'][_0x7a29('0x32')](this));ami['on'](_0x7a29('0x3e'),this[_0x7a29('0x3f')][_0x7a29('0x32')](this));this[_0x7a29('0x40')]();this[_0x7a29('0x41')]();}function isNotNull(_0x416b2e){return _0x416b2e!==null&&!_[_0x7a29('0x42')](_0x416b2e);}function checkIsLoggedIn(_0x4fdf32,_0x407bfe){return function(){if(_0x407bfe<=0x0){_0x4fdf32[_0x7a29('0x43')]='AGENTS_NOT_LOGGED';throw _0x4fdf32[_0x7a29('0x44')]+_0x7a29('0x45');}};}function isActive(_0x1544ce){return _0x1544ce;}function checkIsActive(_0x1aa466,_0x1c3ba2){return function(){if(!isActive(_0x1c3ba2)){_0x1aa466[_0x7a29('0x43')]=_0x7a29('0x46');throw _0x1aa466['name']+_0x7a29('0x47');}};}function checkInterval(_0x5d987d){return function(){if(!isNotNull(_0x5d987d[_0x7a29('0x48')])){_0x5d987d[_0x7a29('0x43')]=_0x7a29('0x49');throw _0x5d987d[_0x7a29('0x44')]+_0x7a29('0x4a');}if(!isNotNull(_0x5d987d[_0x7a29('0x48')]['Intervals'])){_0x5d987d[_0x7a29('0x43')]=_0x7a29('0x49');throw _0x5d987d['name']+_0x7a29('0x4a');}if(!isNotNull(_['isEmpty'](_0x5d987d[_0x7a29('0x48')][_0x7a29('0x4b')]))){_0x5d987d[_0x7a29('0x43')]=_0x7a29('0x49');throw _0x5d987d['name']+_0x7a29('0x4a');}};}function msgResponse(_0x4339b7,_0x2e1952,_0xe078de){return{'action':_0x4339b7,'response':_0x2e1952,'message':_0xe078de,'stack':_0xe078de};}function myreject(_0x216638){return function(_0x13ddfc){return _0x216638(msgResponse(_0x7a29('0x4c'),_0x7a29('0x4d'),JSON[_0x7a29('0x4e')](_0x13ddfc)));};}function getSeconds(_0x42eed4,_0x33145c){var _0x3679ad=moment(_0x42eed4)[_0x7a29('0x4f')](0x0);var _0x3a1d42=moment(_0x33145c)[_0x7a29('0x4f')](0x0);return _0x3679ad[_0x7a29('0x50')](_0x3a1d42,_0x7a29('0x51'));}function emit(_0x79974,_0x49cc02,_0x5490b5){io['to'](_0x79974)[_0x7a29('0x52')](_0x49cc02,_0x5490b5);}function emitVoiceQueueSummary(_0x2d6701){if(_0x2d6701[_0x7a29('0x53')]===_0x7a29('0x54')){var _0x58c110={'id':_0x2d6701['id'],'name':_0x2d6701[_0x7a29('0x44')],'strategy':_0x2d6701[_0x7a29('0x55')],'answered':_0x2d6701[_0x7a29('0x56')],'available':_0x2d6701[_0x7a29('0x57')],'loggedIn':_0x2d6701[_0x7a29('0x58')],'pTalking':_0x2d6701[_0x7a29('0x59')],'sumBillable':_0x2d6701[_0x7a29('0x5a')],'sumDuration':_0x2d6701['sumDuration'],'sumHoldTime':_0x2d6701[_0x7a29('0x5b')]||0x0,'talking':_0x2d6701[_0x7a29('0x5c')],'total':_0x2d6701[_0x7a29('0x5d')],'type':_0x2d6701[_0x7a29('0x53')],'unmanaged':_0x2d6701[_0x7a29('0x5e')],'abandoned':_0x2d6701['abandoned'],'waiting':_0x2d6701[_0x7a29('0x5f')],'loggedInDb':_0x2d6701[_0x7a29('0x60')],'dialActive':_0x2d6701[_0x7a29('0x61')],'dialMethod':_0x2d6701['dialMethod'],'dialOriginateCallerIdName':_0x2d6701['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2d6701[_0x7a29('0x62')],'dialOriginateTimeout':_0x2d6701[_0x7a29('0x63')],'dialPrefix':_0x2d6701['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2d6701['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2d6701['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2d6701[_0x7a29('0x64')],'outboundBusyCallsDay':_0x2d6701[_0x7a29('0x65')],'outboundCongestionCallsDay':_0x2d6701[_0x7a29('0x66')],'outboundDropCallsDayACS':_0x2d6701[_0x7a29('0x67')],'outboundDropCallsDayCallersExit':_0x2d6701[_0x7a29('0x68')],'outboundDropCallsDayTimeout':_0x2d6701['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2d6701[_0x7a29('0x69')],'outboundNoSuchCallsDay':_0x2d6701[_0x7a29('0x6a')],'outboundOriginateFailureCallsDay':_0x2d6701[_0x7a29('0x6b')],'outboundReCallsDay':_0x2d6701[_0x7a29('0x6c')],'outboundRejectCallsDay':_0x2d6701[_0x7a29('0x6d')],'outboundUnknownCallsDay':_0x2d6701[_0x7a29('0x6e')],'predictiveIntervalAnsweredCalls':_0x2d6701['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2d6701[_0x7a29('0x6f')],'predictiveIntervalAvgTalktime':_0x2d6701[_0x7a29('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x2d6701[_0x7a29('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x2d6701[_0x7a29('0x72')],'predictiveIntervalErlangCalls':_0x2d6701[_0x7a29('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x2d6701[_0x7a29('0x74')],'predictiveIntervalHitRate':_0x2d6701[_0x7a29('0x75')],'predictiveIntervalMultiplicativeFactor':_0x2d6701[_0x7a29('0x76')],'predictiveIntervalPauses':_0x2d6701['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2d6701['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2d6701[_0x7a29('0x77')],'message':_0x2d6701[_0x7a29('0x43')],'originated':_0x2d6701['originated'],'erlangCalls':_0x2d6701[_0x7a29('0x78')],'erlangCallToSecond':_0x2d6701[_0x7a29('0x79')],'erlangAbandonmentRate':_0x2d6701[_0x7a29('0x7a')],'erlangBusyFactor':_0x2d6701['erlangBusyFactor'],'startPredictive':_0x2d6701[_0x7a29('0x2b')],'startProgressive':_0x2d6701['startProgressive']};if(_0x2d6701['Trunk']){_0x58c110['Trunk']={'id':_0x2d6701[_0x7a29('0x7b')]['id'],'name':_0x2d6701[_0x7a29('0x7b')]['name'],'active':_0x2d6701[_0x7a29('0x7b')]['active'],'callerid':_0x2d6701['Trunk'][_0x7a29('0x7c')]};}if(_0x2d6701[_0x7a29('0x48')]){_0x58c110[_0x7a29('0x48')]={'id':_0x2d6701[_0x7a29('0x48')]['id'],'name':_0x2d6701[_0x7a29('0x48')][_0x7a29('0x44')]};}var _0x1d330a=md5(JSON[_0x7a29('0x4e')](_0x58c110));if(_0x2d6701[_0x7a29('0x5')]!==_0x1d330a){_0x2d6701[_0x7a29('0x5')]=_0x1d330a;emit(util[_0x7a29('0x7d')](_0x7a29('0x7e'),_0x58c110[_0x7a29('0x44')]),_0x7a29('0x7f'),_0x58c110);}}}function emitCampaignSummary(_0xeeacd2){if(_0xeeacd2['type']==='ivr'){emit(util[_0x7a29('0x7d')](_0x7a29('0x80'),_0xeeacd2[_0x7a29('0x44')]),_0x7a29('0x81'),_0xeeacd2);}}function checkGetDataPredictive(_0x372100){if(isNotNull(_0x372100)){if(!_[_0x7a29('0x82')](_0x372100)){loggerPredictive[_0x7a29('0x83')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x7a29('0x83')](_0x7a29('0x84'),_0x372100[_0x7a29('0x77')]);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x85'),_0x372100[_0x7a29('0x86')]);loggerPredictive['info'](_0x7a29('0x87'),_0x372100[_0x7a29('0x72')]);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x88'),_0x372100[_0x7a29('0x71')]);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x89'),_0x372100['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x8a'),_0x372100['predictiveIntervalAvgTalktime']);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x8b'));if(_0x372100[_0x7a29('0x77')]>0x0){if(!_['isUndefined'](_0x372100['predictiveIntervalAvgTalktime'])&&_0x372100['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x7a29('0x83')](_0x7a29('0x8c'));}if(!_['isUndefined'](_0x372100[_0x7a29('0x6f')])&&_0x372100[_0x7a29('0x6f')]>0x0){return!![];}else{loggerPredictive['info'](_0x7a29('0x8d'));}}else{loggerPredictive['info'](_0x7a29('0x8e'));}}else{loggerPredictive[_0x7a29('0x83')](_0x7a29('0x8f'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x30d047){return function(_0x12c553){loggerPredictive[_0x7a29('0x83')](_0x7a29('0x90'));loggerPredictive[_0x7a29('0x83')](_0x7a29('0x91'),_0x12c553[_0x7a29('0x78')]);loggerPredictive['info'](_0x7a29('0x92'),_0x12c553[_0x7a29('0x79')]);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x93'),_0x12c553['erlangAbandonmentRate']);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x94'),_0x12c553[_0x7a29('0x95')]);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x93'),_0x12c553[_0x7a29('0x7a')]);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x8b'));_[_0x7a29('0x96')](_0x30d047,_0x12c553);};}function getDiff(_0x46da2b){var _0x1a3d94=moment()[_0x7a29('0x4f')](0x0);var _0x37d053=moment(_0x46da2b)[_0x7a29('0x4f')](0x0);return _0x1a3d94['diff'](_0x37d053,_0x7a29('0x51'));}function ifInterval(_0x139df0,_0x3eab97){if(_['isUndefined'](_0x3eab97)){return![];}if(getDiff(_0x3eab97)<_0x139df0*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x888474){if(isNotNull(_0x888474)){if(!_[_0x7a29('0x42')](_0x888474[_0x7a29('0x2c')])){_0x888474[_0x7a29('0x2c')]=undefined;loggerPredictive[_0x7a29('0x83')](_0x888474['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x7a29('0x42')](_0x888474[_0x7a29('0x2b')])){_0x888474['startPredictive']=undefined;loggerPredictive['info'](_0x888474[_0x7a29('0x44')],_0x7a29('0x97'));}if(!_[_0x7a29('0x42')](_0x888474[_0x7a29('0x98')])){clearInterval(_0x888474[_0x7a29('0x98')]);_0x888474[_0x7a29('0x98')]=undefined;loggerPredictive[_0x7a29('0x83')](_0x888474['name'],_0x7a29('0x99'));}}}function erlangb(_0x53cf22,_0x1be5c5){if(_0x1be5c5===0x0){return 0x0;}var _0x2d0c75=0x1;for(var _0x3a72e2=0x1;_0x3a72e2<=_0x1be5c5;_0x3a72e2+=0x1){_0x2d0c75=0x1+_0x2d0c75*_0x3a72e2/_0x53cf22;}return 0x1/_0x2d0c75;}function isVoiceQueueOutbound(_0x1fa408){return _0x1fa408===_0x7a29('0x54');}function isNotPreview(_0x9a9afd){return _0x9a9afd!=='preview';}function isCampaignIvr(_0x569407){return _0x569407===_0x7a29('0x9a');}function getCallerId(_0x1243b0,_0x39f5af,_0x12f936){if(!_[_0x7a29('0x42')](_0x12f936)&&_0x7a29('0x9b')===typeof _0x12f936&&!_[_0x7a29('0x82')](_0x12f936)){if(!_['isUndefined'](_0x39f5af)&&_0x7a29('0x9b')===typeof _0x39f5af&&!_[_0x7a29('0x82')](_0x39f5af)){return util[_0x7a29('0x7d')](_0x7a29('0x9c'),_0x39f5af,_0x12f936);}return util['format']('\x22%s\x22\x20<%s>',_0x12f936,_0x12f936);}if(!_['isUndefined'](_0x1243b0)&&_0x7a29('0x9b')===typeof _0x1243b0&&!_[_0x7a29('0x82')](_0x1243b0)){return _0x1243b0;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x44d1f7,_0x22eefd){return function(_0x2f2f14){freeVariablesPredictive(_0x22eefd);emitVoiceQueueSummary(_0x22eefd);emitCampaignSummary(_0x22eefd);loggerSyncQueueSummary[_0x7a29('0x9d')](_0x44d1f7,util[_0x7a29('0x9e')](_0x2f2f14,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xac93e7,_0x70cec9){return function(_0x28af64){loggerPredictive[_0x7a29('0x9d')](_0x70cec9[_0x7a29('0x44')],_0xac93e7);loggerPredictive[_0x7a29('0x9d')](_0x28af64[_0x7a29('0x9f')]);freeVariablesPredictive(_0x70cec9);};}function loggerCatch(_0x57cf0e){return function(_0x4ee441){logger[_0x7a29('0x9d')](_0x57cf0e,util['inspect'](_0x4ee441,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x46e5d9){return _0x46e5d9&&!_[_0x7a29('0x42')](_0x46e5d9)&&_0x46e5d9[_0x7a29('0xa0')]>0x0;}function decremetOriginate(_0x46df1c){if(!_[_0x7a29('0x42')](_0x46df1c)&&_0x46df1c!==null){if(_0x46df1c[_0x7a29('0xa1')](_0x7a29('0xa2'))){if(_0x46df1c[_0x7a29('0xa2')]>0x0){_0x46df1c['originated']-=0x1;}else{logger[_0x7a29('0x9d')](_0x7a29('0xa3'));}}}else{logger[_0x7a29('0x9d')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x426532,_0xeb57cc,_0x193ad9){if(_0xeb57cc>_0x193ad9){for(var _0x2b84f4=0x0;_0x2b84f4<_0xeb57cc-_0x193ad9;_0x2b84f4+=0x1){decremetOriginate(_0x426532);}}}function loggerGetContactDialer(_0x54fa55,_0x452660,_0x5e7b74){return function(_0x48a677){checkContactLowerLimitOriginate(_0x452660,_0x5e7b74,0x0);logger['error'](_0x54fa55,util[_0x7a29('0x9e')](_0x48a677,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x28ac8b){return function(_0xd8db29){if(isNotNull(_0xd8db29)&&isNotNull(_0xd8db29[0x0])){if(_0xd8db29[0x0][_0x7a29('0xa4')]>0x0){_0x28ac8b[_0x7a29('0x43')]=_0x7a29('0xa5');logger[_0x7a29('0x83')]('[getContactDialer2][ReScheduled]'+_0x28ac8b[_0x7a29('0x44')],_0xd8db29[0x0]['contactsRescheduled'],_0x7a29('0xa6'));}else{_0x28ac8b[_0x7a29('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x7a29('0xa7')+_0x28ac8b[_0x7a29('0x44')]);}}};}function notSendMessagesQueue(_0x3eea97){if(_0x3eea97[_0x7a29('0xa8')]){freeVariablesPredictive(_0x3eea97);if(_0x3eea97[_0x7a29('0xa2')]===0x0&&_0x3eea97[_0x7a29('0x5c')]===0x0&&_0x3eea97[_0x7a29('0x5f')]===0x0&&(_0x3eea97['pTalking']||0x0)===0x0){_0x3eea97[_0x7a29('0xa8')]=![];_0x3eea97['available']=0x0;_0x3eea97['message']=_0x7a29('0x46');loggerSyncQueueSummary[_0x7a29('0x9d')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3eea97[_0x7a29('0x44')],_0x7a29('0xa9'));}else{_0x3eea97['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x7a29('0x9d')](_0x7a29('0xaa'),_0x3eea97[_0x7a29('0x44')],'is\x20disactive');}emitVoiceQueueSummary(_0x3eea97);}}function notSendMessagesCampaign(_0x1e735a){if(_0x1e735a['sendMessageOneNotActive']){if(_0x1e735a[_0x7a29('0xa2')]===0x0){_0x1e735a[_0x7a29('0xa8')]=![];_0x1e735a['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x7a29('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1e735a[_0x7a29('0x44')],'is\x20not\x20active');}else{_0x1e735a['message']=_0x7a29('0xab');loggerSyncQueueSummary[_0x7a29('0x9d')](_0x7a29('0xac'),_0x1e735a[_0x7a29('0x44')],_0x7a29('0xad'));}emitCampaignSummary(_0x1e735a);}}function createObjHistory(_0x5f53dc,_0x25124c,_0x4dcef7,_0x1abeb7,_0x49aecd){_0x5f53dc[_0x7a29('0x43')]=_0x4dcef7;var _0x4f946b=new Action(_0x5f53dc,_0x25124c);var _0x15db5e=new History(_0x4f946b);_0x15db5e[_0x7a29('0xae')]=_0x1abeb7;_0x15db5e[_0x7a29('0xaf')]=_0x49aecd;_0x15db5e[_0x7a29('0xb0')]=_0x4f946b['starttime'];return _0x15db5e;}Dialer[_0x7a29('0x1c')][_0x7a29('0x41')]=function(){var _0x5b2b54=this;setInterval(function(){_0x5b2b54[_0x7a29('0xb1')](_0x5b2b54[_0x7a29('0x29')],_0x7a29('0xb2'));_0x5b2b54['clearZombieChannels'](_0x5b2b54[_0x7a29('0x27')],_0x7a29('0xb3'));},0x32c8);};Dialer['prototype'][_0x7a29('0xb1')]=function(_0x2980e5,_0x4d0ea0){var _0x1b0a85=this;for(var _0x4c5c76 in _0x2980e5){if(_0x2980e5[_0x7a29('0xa1')](_0x4c5c76)){this[_0x7a29('0x20')][_0x7a29('0x1d')](function(){if(!_[_0x7a29('0xb4')](_0x2980e5[_0x4c5c76])){return ami[_0x7a29('0xb5')]({'action':'status','channel':_0x2980e5[_0x4c5c76]['channel']})[_0x7a29('0xb6')](function(_0x1364c0){if(_0x1364c0[_0x7a29('0x43')]===_0x7a29('0xb7')){setTimeout(function(){if(_0x2980e5[_0x4c5c76]&&_0x2980e5[_0x4c5c76][_0x7a29('0x53')]!=='ivr'){_0x1b0a85[_0x7a29('0xb8')](_0x1b0a85[_0x7a29('0x21')][_0x2980e5[_0x4c5c76][_0x7a29('0xb9')]]);logger[_0x7a29('0x9d')]('[Dialer][checkChannel]',_0x4d0ea0,_0x4c5c76,_0x2980e5[_0x4c5c76][_0x7a29('0xb9')]);delete _0x2980e5[_0x4c5c76];}if(_0x2980e5[_0x4c5c76]&&_0x2980e5[_0x4c5c76]['type']===_0x7a29('0x9a')){_0x1b0a85[_0x7a29('0xb8')](_0x1b0a85['campaigns'][_0x2980e5[_0x4c5c76][_0x7a29('0xb9')]]);logger['error'](_0x7a29('0xba'),_0x4d0ea0,_0x4c5c76,_0x2980e5[_0x4c5c76][_0x7a29('0xb9')]);delete _0x2980e5[_0x4c5c76];}},0x2328);}});}});}}};Dialer[_0x7a29('0x1c')][_0x7a29('0xbb')]=function(_0x3f83f8){return BPromise['resolve']()[_0x7a29('0xbc')](cmHopper['countReScheduled'](_0x3f83f8))[_0x7a29('0xb6')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x7a29('0x1c')][_0x7a29('0xbd')]=function(_0x14fc81){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](cmHopperBlack[_0x7a29('0xbd')](_0x14fc81))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xbf')));};Dialer[_0x7a29('0x1c')][_0x7a29('0xc0')]=function(_0x3363d4){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](cmHopperBlack[_0x7a29('0xc0')](_0x3363d4))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xc1')));};Dialer[_0x7a29('0x1c')]['averageHandleTime']=function(_0x16af61){return BPromise[_0x7a29('0xbe')]()['then'](cmHopperHistory['avgHandleTime'](_0x16af61))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xc2')));};Dialer['prototype'][_0x7a29('0xc3')]=function(_0x3f8f99){return BPromise[_0x7a29('0xbe')]()['then'](cmHopper['rescheduleContact'](_0x3f8f99))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xc4')));};Dialer['prototype']['unlockContact']=function(_0x55da64,_0x1e8d97,_0x289a7b){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](cmHopper[_0x7a29('0xc5')](_0x55da64,_0x1e8d97,_0x289a7b))['catch'](loggerCatch(_0x7a29('0xc6')));};Dialer[_0x7a29('0x1c')][_0x7a29('0xc7')]=function(_0x3c52c6,_0x532a4f,_0x153087,_0x5f1c8f){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](cmHopper[_0x7a29('0xc7')](_0x3c52c6,_0x532a4f,_0x153087,_0x5f1c8f))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xc8')));};Dialer[_0x7a29('0x1c')][_0x7a29('0xc9')]=function(_0x376681,_0x2b16aa,_0x103012){return BPromise['resolve']()[_0x7a29('0xbc')](cmHopper[_0x7a29('0xc9')](_0x376681,_0x2b16aa,_0x103012))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xc8')));};Dialer[_0x7a29('0x1c')][_0x7a29('0xca')]=function(_0x1c4144){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](voiceQueueRt[_0x7a29('0xca')](_0x1c4144))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xcb')));};Dialer[_0x7a29('0x1c')][_0x7a29('0xcc')]=function(_0x499ccf){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](cmHopper[_0x7a29('0xcc')](_0x499ccf))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x7a29('0x1c')][_0x7a29('0xcd')]=function(_0x1aeb8e){return BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](cmHopperHistory['createHistory'](_0x1aeb8e))['catch'](loggerCatch(_0x7a29('0xce')));};Dialer['prototype']['updateOriginated']=function(_0x523357){if(!_[_0x7a29('0x42')](_0x523357)&&_0x523357!==null){if(_0x523357[_0x7a29('0xa1')]('originated')){if(_0x523357[_0x7a29('0xa2')]>0x0){_0x523357[_0x7a29('0xa2')]-=0x1;}else{logger[_0x7a29('0x9d')](_0x7a29('0xcf'));}}}else{logger[_0x7a29('0x9d')](_0x7a29('0xd0'));}};Dialer[_0x7a29('0x1c')][_0x7a29('0xd1')]=function(_0x417819,_0x3323a4){var _0x577cea=this;return function(_0x2f212e){_0x577cea[_0x7a29('0xb8')](_0x3323a4);logger[_0x7a29('0x9d')](_0x417819,util[_0x7a29('0x9e')](_0x2f212e,{'showHidden':![],'depth':null}));};};Dialer[_0x7a29('0x1c')][_0x7a29('0xd2')]=function(_0x42f259,_0x1217f0,_0x510e84){var _0x1fabdf={'state':0x19,'statedesc':'notFound'};this[_0x7a29('0xb8')](_0x1217f0);this['saveInDb'](_['merge'](_0x1fabdf,_[_0x7a29('0xd3')](_0x510e84,[_0x7a29('0xd4'),_0x7a29('0xd5'),_0x7a29('0xd6'),_0x7a29('0xd7'),_0x7a29('0xd8')])),_0x7a29('0xd9'),_0x7a29('0xda'));logger[_0x7a29('0x9d')](_0x42f259);};Dialer['prototype'][_0x7a29('0xdb')]=function(_0x167f10){return _0x167f10==='Success';};Dialer['prototype'][_0x7a29('0xdc')]=function(_0x265d2a){return!_['isUndefined'](_0x265d2a)&&_0x265d2a&&!_[_0x7a29('0x42')](_0x265d2a[_0x7a29('0x44')])&&!_[_0x7a29('0x42')](_0x265d2a[_0x7a29('0xdd')])&&_0x265d2a['active']&&(this['trunks'][util['format']('SIP/%s',_0x265d2a[_0x7a29('0x44')])][_0x7a29('0xde')]==='reachable'||this[_0x7a29('0x24')][util['format']('SIP/%s',_0x265d2a[_0x7a29('0x44')])][_0x7a29('0xde')]==='unmonitored');};Dialer[_0x7a29('0x1c')][_0x7a29('0xdf')]=function(_0x26a35c,_0x2faf95,_0x142173){this['createHistory'](_0x26a35c)[_0x7a29('0xb6')](loggerCatch(_0x2faf95));this[_0x7a29('0xcc')](_0x26a35c)[_0x7a29('0xb6')](loggerCatch(_0x142173));};Dialer[_0x7a29('0x1c')][_0x7a29('0x3c')]=function(_0x39aaad){var _0x240b67=this[_0x7a29('0x29')][_0x39aaad['uniqueid']];var _0x643db6;if(!_[_0x7a29('0xb4')](_0x39aaad)&&!_[_0x7a29('0xb4')](_0x39aaad['variable'])&&!_[_0x7a29('0xb4')](_0x39aaad[_0x7a29('0xe0')]['amdstatus'])&&_0x39aaad[_0x7a29('0xe1')]===_0x7a29('0xe2')&&_0x240b67){if(_0x240b67[_0x7a29('0x53')]!==_0x7a29('0x9a')&&this[_0x7a29('0x21')][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe3')]&&_0x39aaad[_0x7a29('0xe4')]===_0x7a29('0xe5')){delete this[_0x7a29('0x29')][_0x39aaad[_0x7a29('0xe6')]];this['updateOriginated'](this['voiceQueues'][_0x240b67[_0x7a29('0xb9')]]);this[_0x7a29('0x21')][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe7')]+=0x1;this[_0x7a29('0x21')][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe8')]+=0x1;_0x643db6=new Hangup(_0x240b67,_0x39aaad);_0x643db6[_0x7a29('0xae')]=0x12;_0x643db6['statedesc']=_0x7a29('0xe9');_0x643db6[_0x7a29('0xea')]=_0x7a29('0xeb');this[_0x7a29('0xdf')](_0x643db6,_0x7a29('0xec'),_0x7a29('0xed'));}if(_0x240b67[_0x7a29('0x53')]!==_0x7a29('0x9a')&&this['voiceQueues'][_0x240b67['queue']]['dialAMDActive']&&_0x39aaad[_0x7a29('0xe4')]==='MACHINE'){var _0x56ed7b=this;return new BPromise(function(_0x2739e1,_0xbbee29){delete _0x56ed7b[_0x7a29('0x29')][_0x39aaad[_0x7a29('0xe6')]];_0x56ed7b[_0x7a29('0xb8')](_0x56ed7b[_0x7a29('0x21')][_0x240b67[_0x7a29('0xb9')]]);_0x56ed7b[_0x7a29('0x21')][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe7')]+=0x1;_0x56ed7b['voiceQueues'][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe8')]+=0x1;var _0xc5e434=_0x56ed7b['voiceQueues'][_0x240b67[_0x7a29('0xb9')]];var _0xdf759d=new Hangup(_0x240b67,_0x39aaad);_0xdf759d[_0x7a29('0xae')]=0x13;_0xdf759d[_0x7a29('0xaf')]=_0x7a29('0xee');_0xdf759d['membername']='AMD';_0xdf759d[_0x7a29('0xef')]+=0x1;_0xdf759d[_0x7a29('0xf0')]+=0x1;_0xdf759d[_0x7a29('0xf1')]=!![];_0x56ed7b[_0x7a29('0xcd')](_0xdf759d)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xf2')));if(_0xdf759d['countbusyretry']+_0xdf759d[_0x7a29('0xf3')]+_0xdf759d['countnoanswerretry']+_0xdf759d[_0x7a29('0xf4')]+_0xdf759d[_0x7a29('0xf5')]+_0xdf759d[_0x7a29('0xf6')]+_0xdf759d[_0x7a29('0xef')]+_0xdf759d[_0x7a29('0xf7')]>=_0xc5e434[_0x7a29('0xf8')]){_0x56ed7b[_0x7a29('0xf9')](_0xdf759d,_0x2739e1,_0xbbee29,_0x7a29('0xfa'));}else{if(_0xdf759d[_0x7a29('0xef')]>=_0xc5e434['dialMachineMaxRetry']){_0x56ed7b[_0x7a29('0xfb')](_0xdf759d,_0x2739e1,_0xbbee29,_0x7a29('0xfc'));}else{_0x56ed7b['rescheduleContact']({'active':![],'countmachineretry':_0xdf759d[_0x7a29('0xef')],'scheduledat':moment()['add'](_0xc5e434['dialMachineRetryFrequency'],_0x7a29('0xfd'))[_0x7a29('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xdf759d[_0x7a29('0xd4')],'ListId':_0xdf759d[_0x7a29('0xd5')],'VoiceQueueId':_0xdf759d['VoiceQueueId']||undefined,'CampaignId':_0xdf759d[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch('[rescheduleContact][Machine]'));_0x2739e1({'reschedule':0x1});}}});}if(_0x240b67[_0x7a29('0x53')]===_0x7a29('0x9a')&&this[_0x7a29('0x22')][_0x240b67['queue']][_0x7a29('0xe3')]&&_0x39aaad[_0x7a29('0xe4')]===_0x7a29('0xe5')){delete this['uniqueId'][_0x39aaad[_0x7a29('0xe6')]];this[_0x7a29('0xb8')](this[_0x7a29('0x22')][_0x240b67['queue']]);_0x643db6=new Hangup(_0x240b67,_0x39aaad);_0x643db6[_0x7a29('0xae')]=0x12;_0x643db6[_0x7a29('0xaf')]=_0x7a29('0xe9');_0x643db6[_0x7a29('0xea')]=_0x7a29('0xeb');this[_0x7a29('0xdf')](_0x643db6,_0x7a29('0xfe'),_0x7a29('0xff'));}if(_0x240b67[_0x7a29('0x53')]===_0x7a29('0x9a')&&this['campaigns'][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe3')]&&_0x39aaad[_0x7a29('0xe4')]===_0x7a29('0x100')){var _0x56ed7b=this;return new BPromise(function(_0x4862be,_0x34cf0b){delete _0x56ed7b[_0x7a29('0x29')][_0x39aaad['uniqueid']];_0x56ed7b[_0x7a29('0xb8')](_0x56ed7b[_0x7a29('0x22')][_0x240b67[_0x7a29('0xb9')]]);_0x56ed7b[_0x7a29('0x22')][_0x240b67[_0x7a29('0xb9')]]['outboundAnswerCallsDay']+=0x1;_0x56ed7b[_0x7a29('0x22')][_0x240b67[_0x7a29('0xb9')]][_0x7a29('0xe8')]+=0x1;var _0x3bc18c=_0x56ed7b['campaigns'][_0x240b67[_0x7a29('0xb9')]];var _0x5035c4=new Hangup(_0x240b67,_0x39aaad);_0x5035c4[_0x7a29('0xae')]=0x13;_0x5035c4[_0x7a29('0xaf')]=_0x7a29('0xee');_0x5035c4[_0x7a29('0xea')]=_0x7a29('0xeb');_0x5035c4[_0x7a29('0xef')]+=0x1;_0x5035c4[_0x7a29('0xf0')]+=0x1;_0x5035c4[_0x7a29('0xf1')]=!![];_0x56ed7b[_0x7a29('0xcd')](_0x5035c4)['catch'](loggerCatch(_0x7a29('0xf2')));if(_0x5035c4[_0x7a29('0x101')]+_0x5035c4[_0x7a29('0xf3')]+_0x5035c4[_0x7a29('0x102')]+_0x5035c4['countnosuchnumberretry']+_0x5035c4[_0x7a29('0xf5')]+_0x5035c4[_0x7a29('0xf6')]+_0x5035c4[_0x7a29('0xef')]+_0x5035c4[_0x7a29('0xf7')]>=_0x3bc18c[_0x7a29('0xf8')]){_0x56ed7b[_0x7a29('0xf9')](_0x5035c4,_0x4862be,_0x34cf0b,_0x7a29('0xfa'));}else{if(_0x5035c4[_0x7a29('0xef')]>=_0x3bc18c[_0x7a29('0x103')]){_0x56ed7b['createStateFinal'](_0x5035c4,_0x4862be,_0x34cf0b,_0x7a29('0xfc'));}else{_0x56ed7b[_0x7a29('0xc3')]({'active':![],'countmachineretry':_0x5035c4['countmachineretry'],'scheduledat':moment()[_0x7a29('0x104')](_0x3bc18c[_0x7a29('0x105')],'minutes')[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x5035c4[_0x7a29('0xd4')],'ListId':_0x5035c4['ListId'],'VoiceQueueId':_0x5035c4[_0x7a29('0xd7')]||undefined,'CampaignId':_0x5035c4[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x107')));_0x4862be({'reschedule':0x1});}}});}}};Dialer[_0x7a29('0x1c')][_0x7a29('0x38')]=function(_0x2a9bd5){var _0x2d5d2d=this[_0x7a29('0x29')][_0x2a9bd5['uniqueid']];var _0x410c24=this;var _0x1be791;if(_0x2d5d2d&&_0x2d5d2d['type']===_0x7a29('0x9a')){delete this[_0x7a29('0x29')][_0x2a9bd5['uniqueid']];this[_0x7a29('0xb8')](this[_0x7a29('0x22')][_0x2d5d2d[_0x7a29('0xb9')]]);this['campaigns'][_0x2d5d2d[_0x7a29('0xb9')]][_0x7a29('0x108')]+=0x1;_0x1be791=new Hangup(_0x2d5d2d,_0x2a9bd5);this[_0x7a29('0xcd')](_0x1be791)[_0x7a29('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x7a29('0xcc')](_0x1be791)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x109')));}if(_0x2d5d2d&&_0x2d5d2d['type']!==_0x7a29('0x9a')&&isNotNull(this[_0x7a29('0x21')][_0x2d5d2d[_0x7a29('0xb9')]][_0x7a29('0x10a')])){delete this[_0x7a29('0x29')][_0x2a9bd5[_0x7a29('0xe6')]];this['updateOriginated'](this[_0x7a29('0x21')][_0x2d5d2d[_0x7a29('0xb9')]]);this['voiceQueues'][_0x2d5d2d['queue']][_0x7a29('0xe7')]+=0x1;this[_0x7a29('0x21')][_0x2d5d2d[_0x7a29('0xb9')]][_0x7a29('0xe8')]+=0x1;_0x1be791=new Hangup(_0x2d5d2d,_0x2a9bd5);_0x1be791[_0x7a29('0xae')]=0x10;_0x1be791['statedesc']='AnswerAGI';_0x1be791[_0x7a29('0xea')]=_0x7a29('0x10b');this[_0x7a29('0xcd')](_0x1be791)[_0x7a29('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x7a29('0xcc')](_0x1be791)[_0x7a29('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x2d5d2d&&_0x2d5d2d[_0x7a29('0x53')]!==_0x7a29('0x9a')&&!isNotNull(this[_0x7a29('0x21')][_0x2d5d2d[_0x7a29('0xb9')]][_0x7a29('0x10a')])){delete this[_0x7a29('0x29')][_0x2a9bd5[_0x7a29('0xe6')]];this[_0x7a29('0xb8')](this[_0x7a29('0x21')][_0x2d5d2d['queue']]);this['voiceQueues'][_0x2d5d2d[_0x7a29('0xb9')]][_0x7a29('0x6e')]+=0x1;_0x1be791=new Hangup(_0x2d5d2d,_0x2a9bd5);_0x1be791[_0x7a29('0xae')]=0xc;_0x1be791['statedesc']=_0x2a9bd5[_0x7a29('0x10c')];_0x1be791[_0x7a29('0xea')]=_0x7a29('0x10d');this[_0x7a29('0xcd')](_0x1be791)['catch'](loggerCatch(_0x7a29('0x10e')));this[_0x7a29('0xcc')](_0x1be791)['catch'](loggerCatch(_0x7a29('0x109')));}};Dialer[_0x7a29('0x1c')][_0x7a29('0x10f')]=function(_0x901fc1){var _0x24c421=this[_0x7a29('0x29')][_0x901fc1['uniqueid']];var _0x30abf2=this;if(this['voiceQueues'][_0x901fc1['queue']]){if(_0x24c421&&_0x24c421[_0x7a29('0x53')]!==_0x7a29('0x9a')){delete this[_0x7a29('0x29')][_0x901fc1[_0x7a29('0xe6')]];this[_0x7a29('0x21')][_0x901fc1[_0x7a29('0xb9')]][_0x7a29('0xe7')]+=0x1;var _0x2e315f=new AgentComplete(_0x24c421,_0x901fc1);if(_0x901fc1[_0x7a29('0x110')]==='agent'){_0x2e315f[_0x7a29('0x111')]=this[_0x7a29('0x21')][_0x901fc1[_0x7a29('0xb9')]][_0x7a29('0x112')]&&this['voiceQueues'][_0x901fc1[_0x7a29('0xb9')]][_0x7a29('0x113')]?moment()[_0x7a29('0x7d')](_0x7a29('0x106')):undefined;}this['createHistory'](_0x2e315f)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x114')));this[_0x7a29('0xcc')](_0x2e315f)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x115')));}}};Dialer[_0x7a29('0x1c')][_0x7a29('0x31')]=function(_0x571d20){if(this['voiceQueues'][_0x571d20['queue']]){if(this[_0x7a29('0x29')][_0x571d20[_0x7a29('0xe6')]]&&this['uniqueId'][_0x571d20[_0x7a29('0xe6')]][_0x7a29('0x53')]!==_0x7a29('0x9a')){this[_0x7a29('0xb8')](this[_0x7a29('0x21')][_0x571d20['queue']]);this[_0x7a29('0x29')][_0x571d20['uniqueid']][_0x7a29('0x116')]=moment()[_0x7a29('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x7a29('0x1c')][_0x7a29('0x117')]=function(_0x16b1c9){this[_0x7a29('0xcd')](_0x16b1c9)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x7a29('0xcc')](_0x16b1c9)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x118')));};Dialer[_0x7a29('0x1c')][_0x7a29('0x33')]=function(_0x19c22a){var _0x1ddf57=this[_0x7a29('0x29')][_0x19c22a[_0x7a29('0xe6')]];var _0x2c78b4=this;if(this['voiceQueues'][_0x19c22a[_0x7a29('0xb9')]]){if(_0x1ddf57&&_0x1ddf57[_0x7a29('0x53')]!==_0x7a29('0x9a')){delete this['uniqueId'][_0x19c22a['uniqueid']];this['updateOriginated'](this[_0x7a29('0x21')][_0x19c22a[_0x7a29('0xb9')]]);_0x1ddf57['droptime']=moment()['format'](_0x7a29('0x106'));var _0x5c440a=new QueueCallerAbandon(_0x1ddf57,_0x19c22a);if(getSeconds(_0x1ddf57[_0x7a29('0x119')],_0x1ddf57[_0x7a29('0x11a')])>=_0x1ddf57[_0x7a29('0x11b')]){this[_0x7a29('0x21')][_0x19c22a[_0x7a29('0xb9')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7a29('0x21')][_0x19c22a['queue']][_0x7a29('0x11c')]+=0x1;this['voiceQueues'][_0x19c22a['queue']][_0x7a29('0x74')]+=0x1;_0x5c440a['state']=0xa;_0x5c440a[_0x7a29('0xaf')]=_0x7a29('0x11d');_0x5c440a[_0x7a29('0x11e')]='TIMEOUT';_0x5c440a['agiafterat']=this[_0x7a29('0x21')][_0x19c22a['queue']]['dialQueueProject2']?moment()[_0x7a29('0x7d')](_0x7a29('0x106')):undefined;_0x5c440a['countdropretry']+=0x1;_0x5c440a['countglobal']+=0x1;if(_0x5c440a['countdropretry']>=this[_0x7a29('0x21')][_0x19c22a['queue']][_0x7a29('0x11f')]){this[_0x7a29('0x117')](_0x5c440a);}else{this[_0x7a29('0xc3')]({'active':![],'countdropretry':_0x5c440a[_0x7a29('0xf5')],'scheduledat':moment()[_0x7a29('0x104')](this[_0x7a29('0x21')][_0x19c22a[_0x7a29('0xb9')]][_0x7a29('0x120')],'minutes')['format'](_0x7a29('0x106')),'ContactId':_0x1ddf57['ContactId'],'ListId':_0x1ddf57[_0x7a29('0xd5')],'VoiceQueueId':_0x1ddf57[_0x7a29('0xd7')]||undefined,'CampaignId':_0x1ddf57[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch('[rescheduleContact][Drop]'));var _0x44c3af=new History(_0x5c440a);_0x44c3af[_0x7a29('0xae')]=0xa;_0x44c3af[_0x7a29('0xaf')]=_0x7a29('0x11d');_0x44c3af[_0x7a29('0x121')]=moment()[_0x7a29('0x7d')](_0x7a29('0x106'));_0x44c3af[_0x7a29('0xb0')]=_0x44c3af[_0x7a29('0x121')];_0x44c3af[_0x7a29('0x122')]=_0x5c440a['calleridname'];_0x44c3af[_0x7a29('0x123')]=_0x5c440a[_0x7a29('0x123')];this[_0x7a29('0xcd')](_0x44c3af)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x7a29('0x21')][_0x19c22a[_0x7a29('0xb9')]][_0x7a29('0x71')]+=0x1;this[_0x7a29('0x21')][_0x19c22a[_0x7a29('0xb9')]][_0x7a29('0x68')]+=0x1;_0x5c440a[_0x7a29('0xae')]=0xb;_0x5c440a[_0x7a29('0xaf')]='Abandoned';_0x5c440a['dropreason']=_0x7a29('0x124');_0x5c440a[_0x7a29('0xf6')]+=0x1;_0x5c440a[_0x7a29('0xf0')]+=0x1;if(_0x5c440a[_0x7a29('0xf6')]>=this[_0x7a29('0x21')][_0x19c22a['queue']][_0x7a29('0x125')]){this['queueCallerAbandonCreateState'](_0x5c440a);}else{this[_0x7a29('0xc3')]({'active':![],'countabandonedretry':_0x5c440a[_0x7a29('0xf6')],'scheduledat':moment()[_0x7a29('0x104')](this[_0x7a29('0x21')][_0x19c22a[_0x7a29('0xb9')]][_0x7a29('0x126')],_0x7a29('0xfd'))[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x1ddf57[_0x7a29('0xd4')],'ListId':_0x1ddf57[_0x7a29('0xd5')],'VoiceQueueId':_0x1ddf57[_0x7a29('0xd7')]||undefined,'CampaignId':_0x1ddf57[_0x7a29('0xd8')]||undefined})['catch'](loggerCatch(_0x7a29('0x127')));var _0x44c3af=new History(_0x5c440a);_0x44c3af[_0x7a29('0xae')]=0xb;_0x44c3af[_0x7a29('0xaf')]=_0x7a29('0x128');_0x44c3af[_0x7a29('0x121')]=moment()['format'](_0x7a29('0x106'));_0x44c3af[_0x7a29('0xb0')]=_0x44c3af[_0x7a29('0x121')];_0x44c3af['calleridname']=_0x5c440a[_0x7a29('0x122')];_0x44c3af[_0x7a29('0x123')]=_0x5c440a['calleridnum'];this['createHistory'](_0x44c3af)[_0x7a29('0xb6')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x7a29('0x1c')][_0x7a29('0x3a')]=function(_0x2c7406){if(this[_0x7a29('0x27')][_0x2c7406[_0x7a29('0xe6')]]){this['actions'][_0x2c7406[_0x7a29('0xe6')]][_0x7a29('0x129')]=_0x2c7406[_0x7a29('0x129')];}if(this[_0x7a29('0x29')][_0x2c7406[_0x7a29('0xe6')]]){this[_0x7a29('0x29')][_0x2c7406['uniqueid']][_0x7a29('0x129')]=_0x2c7406[_0x7a29('0x129')];}};Dialer[_0x7a29('0x1c')][_0x7a29('0x12a')]=function(_0x552ce2){if(strategy[this[_0x7a29('0x21')][this[_0x7a29('0x27')][_0x552ce2[_0x7a29('0x12b')]][_0x7a29('0xb9')]][_0x7a29('0x55')]]==='roundrobin'){if(this['actions'][_0x552ce2[_0x7a29('0x12b')]]&&_['isNil'](this['actions'][_0x552ce2[_0x7a29('0x12b')]][_0x7a29('0x12c')])&&_0x552ce2[_0x7a29('0xde')]==='1'&&_0x552ce2[_0x7a29('0x12d')]==='0'){if(this[_0x7a29('0x23')][_0x552ce2[_0x7a29('0x12e')]]){if(!this[_0x7a29('0x23')][_0x552ce2[_0x7a29('0x12e')]][_0x7a29('0x12c')]){this['agents'][_0x552ce2[_0x7a29('0x12e')]]['locked']=!![];this[_0x7a29('0x27')][_0x552ce2[_0x7a29('0x12b')]][_0x7a29('0x12c')]=!![];this[_0x7a29('0x27')][_0x552ce2['actionid']][_0x7a29('0x12e')]=_0x552ce2[_0x7a29('0x12e')];}}}}else if((strategy[this[_0x7a29('0x21')][this[_0x7a29('0x27')][_0x552ce2[_0x7a29('0x12b')]]['queue']][_0x7a29('0x55')]]||_0x7a29('0x1a'))===_0x7a29('0x1a')){if(this[_0x7a29('0x27')][_0x552ce2[_0x7a29('0x12b')]]){if(this['agents'][_0x552ce2[_0x7a29('0x12e')]]){this['actions'][_0x552ce2[_0x7a29('0x12b')]][_0x7a29('0x12e')]=_0x552ce2[_0x7a29('0x12e')];if(_[_0x7a29('0xb4')](this['queueBooked'][this[_0x7a29('0x27')][_0x552ce2['actionid']]['queue']])){this[_0x7a29('0x2e')][this[_0x7a29('0x27')][_0x552ce2['actionid']]['queue']]=[];}this[_0x7a29('0x2e')][this['actions'][_0x552ce2[_0x7a29('0x12b')]]['queue']]['push'](_['merge'](_[_0x7a29('0xd3')](this['actions'][_0x552ce2[_0x7a29('0x12b')]],[_0x7a29('0x12f'),'stateinterface']),{'status':_0x552ce2[_0x7a29('0xde')],'paused':_0x552ce2['paused']}));}}}};function unlockQueueStatus(_0x55a5e6,_0x433a26){setTimeout(function(){if(_['isUndefined'](_0x55a5e6[_0x7a29('0x130')])){loggerBooked[_0x7a29('0x9d')]('[unlockQueueStatus][undefined]',_0x433a26);}_0x55a5e6[_0x7a29('0x130')]=!![];loggerBooked['info'](_0x7a29('0x131'),_0x433a26,JSON[_0x7a29('0x4e')](_[_0x7a29('0xd3')](_0x55a5e6,[_0x7a29('0x44'),_0x7a29('0x130')])));},0x1f3);}Dialer[_0x7a29('0x1c')][_0x7a29('0x3f')]=function(_0x32721b){var _0x3e3236=this;var _0x227b0f=_0x3e3236['voiceQueues'][_0x3e3236[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]];if(strategy[this[_0x7a29('0x21')][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]][_0x7a29('0x55')]]===_0x7a29('0x1b')){if(this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]]&&this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0x12e')]){this[_0x7a29('0x132')][_0x7a29('0x133')](this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0x12f')],this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0x12e')])[_0x7a29('0xb6')](function(_0xc40e24){logger[_0x7a29('0x9d')](_0x7a29('0x134'),util[_0x7a29('0x9e')](_0xc40e24,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3e3236[_0x7a29('0xb8')](_0x3e3236[_0x7a29('0x21')][_0x3e3236[_0x7a29('0x27')][_0x32721b['actionid']][_0x7a29('0xb9')]]);_0x3e3236[_0x7a29('0x23')][_0x3e3236[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]]['stateinterface']][_0x7a29('0x12c')]=![];delete _0x3e3236['actions'][_0x32721b[_0x7a29('0x12b')]];unlockQueueStatus(_0x227b0f);});}else{this[_0x7a29('0xb8')](this['voiceQueues'][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]]);this[_0x7a29('0xc3')]({'active':![],'ContactId':this[_0x7a29('0x27')][_0x32721b['actionid']][_0x7a29('0xd4')],'ListId':this['actions'][_0x32721b['actionid']][_0x7a29('0xd5')],'VoiceQueueId':this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xd7')]||undefined,'CampaignId':this[_0x7a29('0x27')][_0x32721b['actionid']][_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x135')));delete this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]];unlockQueueStatus(_0x227b0f);}}else if((strategy[this['voiceQueues'][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]][_0x7a29('0x55')]]||'rrmemory')===_0x7a29('0x1a')){var _0x423178;if(this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]]&&!_[_0x7a29('0x82')](this[_0x7a29('0x2e')][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]]['queue']])){if(this[_0x7a29('0x2f')][_0x3e3236[_0x7a29('0x27')][_0x32721b['actionid']][_0x7a29('0xb9')]]){this['queueBookedRR'][_0x3e3236['actions'][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]]=this[_0x7a29('0x2f')][this[_0x7a29('0x27')][_0x32721b['actionid']][_0x7a29('0xb9')]]?this[_0x7a29('0x2f')][this[_0x7a29('0x27')][_0x32721b['actionid']]['queue']]:this[_0x7a29('0x2e')][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]]?this['queueBooked'][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]][_0x7a29('0x136')]||0x0:0x0;}this[_0x7a29('0x2e')][this[_0x7a29('0x27')][_0x32721b['actionid']][_0x7a29('0xb9')]]['_rr']=this['queueBookedRR'][this[_0x7a29('0x27')][_0x32721b[_0x7a29('0x12b')]][_0x7a29('0xb9')]];for(var _0x2a0cbd=0x0;_0x2a0cbd=0x0?!![]:![];})[_0x7a29('0xb6')](myreject(_0x47733d)));}}else{_0x2f01ca[_0x7a29('0x14c')](ami[_0x7a29('0xb5')]({'action':'command','command':util[_0x7a29('0x7d')](_0x7a29('0x14f'),_0x4ebca2,!_['isUndefined'](config[_0x7a29('0x148')][_0x1b3e46])?_0x1b3e46:'')})[_0x7a29('0xbc')](function(_0x16e4a8){return _0x16e4a8[_0x7a29('0x150')][_0x7a29('0x151')](_0x7a29('0x14e'))>=0x0?!![]:![];})['catch'](myreject(_0x47733d)));}BPromise[_0x7a29('0x152')](_0x2f01ca)['then'](function(_0x132400){var _0x4c2eb8=_[_0x7a29('0x153')](_0x132400);if(_0x4c2eb8){return _0x42adfe(_0x4c2eb8);}else{_0x6a7b[_0x7a29('0x43')]=_0x4f2286?_0x7a29('0x154'):'INTERVAL_IS_OVERTIME';return _0x47733d(msgResponse('[ifTime][promiseAll]',_0x7a29('0x146'),_0x7a29('0x155')+_0x4f2286+'\x20'+_0x9115b0+_0x7a29('0x156')+util[_0x7a29('0x9e')](_0x4ebca2,{'showHidden':![],'depth':null})+_0x7a29('0x157')+_0x1b3e46));}})[_0x7a29('0xb6')](function(_0x293159){return _0x47733d(msgResponse('ifTime',_0x7a29('0x146'),JSON[_0x7a29('0x4e')](_0x293159)));});});};Dialer[_0x7a29('0x1c')][_0x7a29('0x158')]=function(_0x2443e5){var _0x379617=this;return function(){switch(_0x2443e5[_0x7a29('0x159')]){case _0x7a29('0x15a'):freeVariablesPredictive(_0x2443e5);_0x379617[_0x7a29('0x15b')](_0x2443e5,0x1);break;case _0x7a29('0x15c'):freeVariablesPredictive(_0x2443e5);_0x379617['handlePower'](_0x2443e5,_0x2443e5[_0x7a29('0x15d')]);break;case'predictive':_0x379617[_0x7a29('0x15e')](_0x2443e5);break;case _0x7a29('0x15f'):freeVariablesPredictive(_0x2443e5);_0x379617['handlePower'](_0x2443e5,0x1);break;default:freeVariablesPredictive(_0x2443e5);logger[_0x7a29('0x9d')]('Queue',_0x2443e5[_0x7a29('0x44')],_0x7a29('0x160'));}};};Dialer[_0x7a29('0x1c')][_0x7a29('0x161')]=function(_0xc4293b){var _0x2d9269=this;return function(){_0x2d9269['handleIvr'](_0xc4293b);};};Dialer[_0x7a29('0x1c')][_0x7a29('0xb')]=function(_0x55e3cb){var _0x330853=this;if(isNotPreview(_0x55e3cb[_0x7a29('0x159')])){if(isVoiceQueueOutbound(_0x55e3cb[_0x7a29('0x53')])&&isActive(_0x55e3cb[_0x7a29('0x61')])){_0x55e3cb[_0x7a29('0xa8')]=!![];BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](checkIsLoggedIn(_0x55e3cb,_0x55e3cb[_0x7a29('0x58')]))[_0x7a29('0xbc')](checkIsActive(_0x55e3cb,_0x55e3cb[_0x7a29('0x61')]))[_0x7a29('0xbc')](checkInterval(_0x55e3cb))['then'](_0x330853['checkIsTrunkReachable'](_0x55e3cb))[_0x7a29('0xbc')](_0x330853['checkIfTime'](_0x55e3cb[_0x7a29('0x162')],_0x55e3cb[_0x7a29('0x163')],_0x55e3cb[_0x7a29('0x44')],_0x55e3cb))['then'](_0x330853[_0x7a29('0x144')](_0x55e3cb[_0x7a29('0x48')],_0x55e3cb[_0x7a29('0x163')],_0x55e3cb[_0x7a29('0x44')],_0x55e3cb))['then'](_0x330853[_0x7a29('0x158')](_0x55e3cb))['catch'](loggerCatchQueueSummary(_0x7a29('0x164'),_0x55e3cb));}else{notSendMessagesQueue(_0x55e3cb);}}else{freeVariablesPredictive(_0x55e3cb);}};Dialer[_0x7a29('0x1c')]['syncCampaigns']=function(){var _0x2bcf3a=this;var _0x4c9202;for(var _0xc7af99 in this[_0x7a29('0x22')]){if(this['campaigns']['hasOwnProperty'](_0xc7af99)){_0x4c9202=this[_0x7a29('0x22')][_0xc7af99];if(isCampaignIvr(_0x4c9202['type'])&&isActive(_0x4c9202[_0x7a29('0xdd')])){_0x4c9202[_0x7a29('0xa8')]=!![];BPromise[_0x7a29('0xbe')]()[_0x7a29('0xbc')](checkIsActive(_0x4c9202,_0x4c9202[_0x7a29('0xdd')]))['then'](checkInterval(_0x4c9202))['then'](_0x2bcf3a['checkIsTrunkReachable'](_0x4c9202))[_0x7a29('0xbc')](_0x2bcf3a[_0x7a29('0x143')](_0x4c9202[_0x7a29('0x162')],_0x4c9202[_0x7a29('0x163')],_0x4c9202[_0x7a29('0x44')],_0x4c9202))[_0x7a29('0xbc')](_0x2bcf3a[_0x7a29('0x144')](_0x4c9202[_0x7a29('0x48')],_0x4c9202[_0x7a29('0x163')],_0x4c9202[_0x7a29('0x44')],_0x4c9202))[_0x7a29('0xbc')](_0x2bcf3a[_0x7a29('0x161')](_0x4c9202))[_0x7a29('0xb6')](loggerCatchQueueSummary(_0x7a29('0x165'),_0x4c9202));}else{notSendMessagesCampaign(_0x4c9202);}}}};function getCallerIdRandom(_0x3fd4d5,_0x5de790){var _0x1aa386,_0x3afeb3,_0x255263;if(_0x5de790<=0x0){_0x5de790=0x1;}_0x1aa386=new RegExp(_0x7a29('0x166')+_0x5de790+'}$');_0x3afeb3=Math['pow'](0xa,_0x5de790-0x1);_0x255263=Math[_0x7a29('0x167')](0xa,_0x5de790)-0x1;return util[_0x7a29('0x7d')]('%s',_[_0x7a29('0x168')](_0x3fd4d5,_0x1aa386,_['random'](_0x3afeb3,_0x255263)));}function extractCalleridName(_0x2a9e8d){var _0x1372c0=_0x2a9e8d['match'](/"(.*?)"/);return _0x1372c0?_0x1372c0[0x1]:_0x2a9e8d;}function extractCalleridNumber(_0x5105a4){var _0x4f60b6=_0x5105a4['match'](/<(.*?)>/);return _0x4f60b6?_0x4f60b6[0x1]:_0x5105a4;}Dialer[_0x7a29('0x1c')][_0x7a29('0x169')]=function(_0x59c5bc,_0x3f405e){var _0x60e96b=this;var _0x2f3c6a=uuid['v4']();this['actions'][_0x2f3c6a]=new Action(_0x59c5bc,_0x3f405e,_0x2f3c6a);return new BPromise(function(_0x44acf5,_0x67d4df){if(_[_0x7a29('0x42')](_0x59c5bc)&&_0x7a29('0x16a')!==typeof _0x59c5bc){return _0x67d4df(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x7a29('0x42')](_0x3f405e['Contact'][_0x7a29('0x16b')])||_0x3f405e['Contact']['phone']===null){return _0x67d4df(msgResponse(_0x7a29('0x16c'),_0x7a29('0x146'),_0x7a29('0x16d')));}var _0xda2e79={'XMD-CALLERID':_0x60e96b[_0x7a29('0x27')][_0x2f3c6a][_0x7a29('0x16e')](),'XMD-AGI':_0x59c5bc['dialQueueProject']?util[_0x7a29('0x7d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x59c5bc[_0x7a29('0x10a')]):_0x7a29('0x16f'),'XMD-AGIAFTER':_0x59c5bc[_0x7a29('0x112')]?util[_0x7a29('0x7d')](_0x7a29('0x170'),ipAgi,_0x59c5bc[_0x7a29('0x112')]):'NONE','XMD-QUEUE':_0x59c5bc[_0x7a29('0x53')]===_0x7a29('0x54')?util['format'](_0x7a29('0x171'),_0x59c5bc['name'],_0x59c5bc['dialQueueOptions']||'',_0x59c5bc['dialAgiAfterHangupAgent']?'c':'',_0x59c5bc[_0x7a29('0x11b')]||0x3):_0x7a29('0x16f'),'XMD-CONTACTID':_0x3f405e[_0x7a29('0xd4')],'XMD-CDRTYPE':_0x7a29('0x8'),'CALLERID(all)':_0x60e96b[_0x7a29('0x27')][_0x2f3c6a]['getCaller'](),'XMD-AMD':_0x59c5bc[_0x7a29('0xe3')]?_0x7a29('0x172'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x59c5bc[_0x7a29('0xe3')]){_0xda2e79[_0x7a29('0x173')]=_0x59c5bc[_0x7a29('0x174')]||0x9c4;_0xda2e79[_0x7a29('0x175')]=_0x59c5bc[_0x7a29('0x176')]||0x5dc;_0xda2e79[_0x7a29('0x177')]=_0x59c5bc[_0x7a29('0x178')]||0x320;_0xda2e79[_0x7a29('0x179')]=_0x59c5bc[_0x7a29('0x17a')]||0x1388;_0xda2e79[_0x7a29('0x17b')]=_0x59c5bc[_0x7a29('0x17c')]||0x64;_0xda2e79['XMD-AMDBETWEENWORDSSILENCE']=_0x59c5bc['dialAMDBetweenWordsSilence']||0x32;_0xda2e79['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x59c5bc[_0x7a29('0x17d')]||0x3;_0xda2e79[_0x7a29('0x17e')]=_0x59c5bc[_0x7a29('0x17f')]||0x100;_0xda2e79[_0x7a29('0x180')]=_0x59c5bc[_0x7a29('0x181')]||0x1388;}if(_0x59c5bc['type']===_0x7a29('0x54')){_0xda2e79[_0x7a29('0x182')]=_0x3f405e[_0x7a29('0xd7')];}else{_0xda2e79['XMD-CAMPAIGNID']=_0x3f405e['CampaignId'];}for(var _0x5cef0d in _0x3f405e[_0x7a29('0x183')]){if(_0x3f405e[_0x7a29('0x183')][_0x7a29('0xa1')](_0x5cef0d)){if(isNotNull(_0x3f405e['Contact'][_0x5cef0d])&&_0x5cef0d!=='id'&&_0x5cef0d!==_0x7a29('0x184')&&_0x5cef0d!=='createdAt'&&_0x5cef0d!==_0x7a29('0x185')){_0xda2e79[util['format'](_0x7a29('0x186'),_0x7a29('0x187'),_[_0x7a29('0x188')](_0x5cef0d))]=_0x3f405e[_0x7a29('0x183')][_0x5cef0d];}}}var _0x42924e=_0x60e96b[_0x7a29('0xdc')](_0x59c5bc[_0x7a29('0x7b')])?getCallerId(_0x59c5bc['Trunk'][_0x7a29('0x7c')],_0x59c5bc[_0x7a29('0x189')],_0x59c5bc[_0x7a29('0x18a')]>0x0?getCallerIdRandom(_0x59c5bc[_0x7a29('0x62')],_0x59c5bc[_0x7a29('0x18a')]):_0x59c5bc[_0x7a29('0x62')]):getCallerId(_[_0x7a29('0xb4')](_0x59c5bc['TrunkBackup'])?_0x59c5bc['Trunk']['callerid']:_0x59c5bc[_0x7a29('0x140')][_0x7a29('0x7c')],_0x59c5bc['dialOriginateCallerIdName'],_0x59c5bc['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x59c5bc['dialOriginateCallerIdNumber'],_0x59c5bc['dialRandomLastDigitCallerIdNumber']):_0x59c5bc[_0x7a29('0x62')]);if(_0x42924e){_0xda2e79[_0x7a29('0x18b')]=_0x60e96b[_0x7a29('0x27')][_0x2f3c6a]['originatecalleridname']=extractCalleridName(_0x42924e);_0xda2e79[_0x7a29('0x18c')]=_0x60e96b[_0x7a29('0x27')][_0x2f3c6a][_0x7a29('0x18d')]=extractCalleridNumber(_0x42924e);}return ami['Action']({'actionid':_0x2f3c6a,'action':_0x7a29('0x16c'),'channel':_0x60e96b['isTrunkReachable'](_0x59c5bc[_0x7a29('0x7b')])?util[_0x7a29('0x7d')](_0x7a29('0x18e'),_0x59c5bc[_0x7a29('0x7b')][_0x7a29('0x44')],isNotNull(_0x59c5bc['dialPrefix'])?_0x59c5bc['dialPrefix'][_0x7a29('0x18f')]()||'':'',_0x59c5bc['dialCutDigit']>0x0?_0x3f405e[_0x7a29('0x183')]['phone']['substring'](_0x59c5bc[_0x7a29('0x190')]):_0x3f405e['Contact'][_0x7a29('0x16b')]):util['format'](_0x7a29('0x18e'),_[_0x7a29('0xb4')](_0x59c5bc[_0x7a29('0x140')])?_0x59c5bc[_0x7a29('0x7b')][_0x7a29('0x44')]:_0x59c5bc[_0x7a29('0x140')][_0x7a29('0x44')],isNotNull(_0x59c5bc['dialPrefix'])?_0x59c5bc[_0x7a29('0x191')][_0x7a29('0x18f')]()||'':'',_0x59c5bc[_0x7a29('0x190')]>0x0?_0x3f405e[_0x7a29('0x183')][_0x7a29('0x16b')][_0x7a29('0x192')](_0x59c5bc[_0x7a29('0x190')]):_0x3f405e[_0x7a29('0x183')][_0x7a29('0x16b')]),'callerid':_0x42924e,'Exten':_0x7a29('0xe2'),'Context':'from-sip','Priority':'1','variable':_0xda2e79,'timeout':(_0x59c5bc[_0x7a29('0x63')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2f3c6a})[_0x7a29('0xbc')](function(_0x11ecaf){return _0x44acf5(_0x11ecaf);})[_0x7a29('0xb6')](function(_0x18b43a){_0x59c5bc[_0x7a29('0x6b')]+=0x1;var _0x4cfdda=new History(_0x60e96b['actions'][_0x2f3c6a]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x7a29('0x4e')](_0x18b43a)));_0x4cfdda[_0x7a29('0xae')]=0xe;_0x4cfdda[_0x7a29('0xaf')]=_0x7a29('0x193');_0x4cfdda[_0x7a29('0x121')]=moment()[_0x7a29('0x7d')](_0x7a29('0x106'));_0x4cfdda[_0x7a29('0xb0')]=_0x4cfdda['starttime'];_0x60e96b[_0x7a29('0xcd')](_0x4cfdda)[_0x7a29('0xb6')](loggerCatch('[originate][error]'));_0x60e96b[_0x7a29('0xcc')](_0x4cfdda)['catch'](loggerCatch(_0x7a29('0x194')))[_0x7a29('0x1f')](function(){delete _0x60e96b[_0x7a29('0x27')][_0x2f3c6a];return _0x67d4df(msgResponse('originate',_0x7a29('0x4d'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x7a29('0x35')]=function(_0x5906d8){var _0x125eb9=this['actions'][_0x5906d8[_0x7a29('0x12b')]];var _0x3f6abe=this;if(_0x125eb9){delete this[_0x7a29('0x27')][_0x5906d8[_0x7a29('0x12b')]];_0x125eb9['responsetime']=moment()['format'](_0x7a29('0x106'));var _0x33d03d=_0x125eb9['type']===_0x7a29('0x9a')?this[_0x7a29('0x22')][_0x125eb9[_0x7a29('0xb9')]]:this[_0x7a29('0x21')][_0x125eb9[_0x7a29('0x195')]()];if(!this[_0x7a29('0xdb')](_0x5906d8[_0x7a29('0x196')])){this[_0x7a29('0xb8')](_0x33d03d);return this[_0x7a29('0x197')](_0x125eb9,_0x33d03d,_0x5906d8)[_0x7a29('0xbc')](function(_0x1965b4){})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x198')));}else{this[_0x7a29('0x29')][_0x5906d8[_0x7a29('0xe6')]]=_0x125eb9;}}};Dialer[_0x7a29('0x1c')][_0x7a29('0x199')]=function(_0x2f873f,_0x458498,_0x415209){var _0x2019a9=new History(_0x458498);if(_0x2019a9[_0x7a29('0x101')]+_0x2019a9['countcongestionretry']+_0x2019a9[_0x7a29('0x102')]+_0x2019a9['countnosuchnumberretry']+_0x2019a9[_0x7a29('0xf5')]+_0x2019a9[_0x7a29('0xf6')]+_0x2019a9['countmachineretry']+_0x2019a9[_0x7a29('0xf7')]>=_0x415209[_0x7a29('0xf8')]-0x1){return!![];}switch(_0x2f873f){case 0x3:if(_0x2019a9['countnoanswerretry']>=_0x415209['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countnoanswerretry':_0x2019a9[_0x7a29('0x102')]+=0x1,'scheduledat':moment()['add'](_0x415209[_0x7a29('0x19a')],_0x7a29('0xfd'))[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x2019a9[_0x7a29('0xd4')],'ListId':_0x2019a9[_0x7a29('0xd5')],'VoiceQueueId':_0x2019a9[_0x7a29('0xd7')]||undefined,'CampaignId':_0x2019a9[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x2019a9[_0x7a29('0x101')]>=_0x415209[_0x7a29('0x19b')]-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countbusyretry':_0x2019a9['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x415209['dialBusyRetryFrequency'],_0x7a29('0xfd'))[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x2019a9[_0x7a29('0xd4')],'ListId':_0x2019a9['ListId'],'VoiceQueueId':_0x2019a9[_0x7a29('0xd7')]||undefined,'CampaignId':_0x2019a9[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x19c')));}break;case 0x8:if(_0x2019a9['countcongestionretry']>=_0x415209[_0x7a29('0x19d')]-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countcongestionretry':_0x2019a9[_0x7a29('0xf3')]+=0x1,'scheduledat':moment()[_0x7a29('0x104')](_0x415209['dialCongestionRetryFrequency'],_0x7a29('0xfd'))[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x2019a9[_0x7a29('0xd4')],'ListId':_0x2019a9[_0x7a29('0xd5')],'VoiceQueueId':_0x2019a9[_0x7a29('0xd7')]||undefined,'CampaignId':_0x2019a9[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x19e')));}break;case 0x0:if(_0x2019a9[_0x7a29('0xf4')]>=_0x415209['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countnosuchnumberretry':_0x2019a9['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x415209['dialNoSuchNumberRetryFrequency'],_0x7a29('0xfd'))['format'](_0x7a29('0x106')),'ContactId':_0x2019a9['ContactId'],'ListId':_0x2019a9[_0x7a29('0xd5')],'VoiceQueueId':_0x2019a9[_0x7a29('0xd7')]||undefined,'CampaignId':_0x2019a9[_0x7a29('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2019a9[_0x7a29('0xf5')]>=_0x415209[_0x7a29('0x11f')]-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countdropretry':_0x2019a9[_0x7a29('0xf5')]+=0x1,'scheduledat':moment()[_0x7a29('0x104')](_0x415209[_0x7a29('0x120')],_0x7a29('0xfd'))[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x2019a9[_0x7a29('0xd4')],'ListId':_0x2019a9['ListId'],'VoiceQueueId':_0x2019a9['VoiceQueueId']||undefined,'CampaignId':_0x2019a9['CampaignId']||undefined})[_0x7a29('0xb6')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x2019a9[_0x7a29('0xf6')]>=_0x415209['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countabandonedretry':_0x2019a9[_0x7a29('0xf6')]+=0x1,'scheduledat':moment()[_0x7a29('0x104')](_0x415209['dialAbandonedRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2019a9[_0x7a29('0xd4')],'ListId':_0x2019a9[_0x7a29('0xd5')],'VoiceQueueId':_0x2019a9['VoiceQueueId']||undefined,'CampaignId':_0x2019a9[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x127')));}break;case 0x13:if(_0x2019a9['countmachineretry']>=_0x415209[_0x7a29('0x103')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x2019a9[_0x7a29('0xef')]+=0x1,'scheduledat':moment()[_0x7a29('0x104')](_0x415209['dialMachineRetryFrequency'],'minutes')[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x2019a9['ContactId'],'ListId':_0x2019a9[_0x7a29('0xd5')],'VoiceQueueId':_0x2019a9[_0x7a29('0xd7')]||undefined,'CampaignId':_0x2019a9['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x2019a9[_0x7a29('0xf7')]>=_0x415209['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0x7a29('0xc3')]({'active':![],'countagentrejectretry':_0x2019a9[_0x7a29('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x415209[_0x7a29('0x19f')],_0x7a29('0xfd'))[_0x7a29('0x7d')](_0x7a29('0x106')),'ContactId':_0x2019a9['ContactId'],'ListId':_0x2019a9[_0x7a29('0xd5')],'VoiceQueueId':_0x2019a9[_0x7a29('0xd7')]||undefined,'CampaignId':_0x2019a9[_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x7a29('0x1c')][_0x7a29('0x197')]=function(_0xf3ff0e,_0x47f6cd,_0x5ee9b5){var _0x1afa33=this;var _0x54151e=new History(_0xf3ff0e);return new BPromise(function(_0x3c086f,_0x133be6){if(_[_0x7a29('0x42')](_0x47f6cd)&&'object'!==typeof _0x47f6cd){return _0x133be6(msgResponse(_0x7a29('0x1a0'),'Failure','entity\x20is\x20undefine'));}if(_[_0x7a29('0x42')](_0x5ee9b5)&&'object'!==typeof _0x5ee9b5){return _0x133be6(msgResponse(_0x7a29('0x1a0'),_0x7a29('0x146'),_0x7a29('0x1a1')));}switch(_0x5ee9b5[_0x7a29('0x110')]){case'0':_0x47f6cd[_0x7a29('0x6a')]+=0x1;_0x54151e[_0x7a29('0xae')]=0x0;_0x54151e[_0x7a29('0xaf')]=_0x7a29('0x1a2');_0x54151e[_0x7a29('0xf4')]+=0x1;_0x54151e['countglobal']+=0x1;ami[_0x7a29('0x52')](_0x7a29('0x1a3'),ut[_0x7a29('0x1a4')](_0xf3ff0e,_0x7a29('0x1a5')));_0x1afa33[_0x7a29('0xcd')](_0x54151e)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0xf2')));if(_0x1afa33[_0x7a29('0x199')](0x0,_0xf3ff0e,_0x47f6cd)){if(_0x54151e[_0x7a29('0xf4')]>=_0x47f6cd[_0x7a29('0x1a6')]){_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1a7'));}else{_0x1afa33[_0x7a29('0xf9')](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1a7'));}}break;case'3':_0x47f6cd[_0x7a29('0x69')]+=0x1;_0x54151e[_0x7a29('0xae')]=0x3;_0x54151e[_0x7a29('0xaf')]=_0x7a29('0x1a8');_0x54151e[_0x7a29('0x102')]+=0x1;_0x54151e[_0x7a29('0xf0')]+=0x1;ami[_0x7a29('0x52')](_0x7a29('0x1a9'),ut[_0x7a29('0x1a4')](_0xf3ff0e,'noanswer'));_0x1afa33['createHistory'](_0x54151e)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x1aa')));if(_0x1afa33[_0x7a29('0x199')](0x3,_0xf3ff0e,_0x47f6cd)){if(_0x54151e['countnoanswerretry']>=_0x47f6cd[_0x7a29('0x1ab')]){_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1afa33[_0x7a29('0xf9')](_0x54151e,_0x3c086f,_0x133be6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x47f6cd[_0x7a29('0x65')]+=0x1;_0x54151e[_0x7a29('0xae')]=0x5;_0x54151e['statedesc']=_0x7a29('0x1ac');_0x54151e[_0x7a29('0x101')]+=0x1;_0x54151e[_0x7a29('0xf0')]+=0x1;ami[_0x7a29('0x52')]('custom:agentbusy',ut[_0x7a29('0x1a4')](_0xf3ff0e,_0x7a29('0x1ad')));_0x1afa33[_0x7a29('0xcd')](_0x54151e)[_0x7a29('0xb6')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1afa33[_0x7a29('0x199')](0x5,_0xf3ff0e,_0x47f6cd)){if(_0x54151e[_0x7a29('0x101')]>=_0x47f6cd[_0x7a29('0x19b')]){_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,'reason\x205\x20busy');}else{_0x1afa33['stateGlobal'](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1ae'));}}break;case'8':_0x47f6cd['outboundCongestionCallsDay']+=0x1;_0x54151e[_0x7a29('0xae')]=0x8;_0x54151e[_0x7a29('0xaf')]=_0x7a29('0x1af');_0x54151e[_0x7a29('0xf3')]+=0x1;_0x54151e[_0x7a29('0xf0')]+=0x1;ami[_0x7a29('0x52')](_0x7a29('0x1b0'),ut[_0x7a29('0x1a4')](_0xf3ff0e,_0x7a29('0x1b1')));_0x1afa33[_0x7a29('0xcd')](_0x54151e)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x1b2')));if(_0x1afa33[_0x7a29('0x199')](0x8,_0xf3ff0e,_0x47f6cd)){if(_0x54151e[_0x7a29('0xf3')]>=_0x47f6cd[_0x7a29('0x19d')]){_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1b3'));}else{_0x1afa33['stateGlobal'](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1b3'));}}break;case'11':_0x47f6cd[_0x7a29('0x1b4')]+=0x1;_0x54151e[_0x7a29('0xae')]=0xb;_0x54151e[_0x7a29('0xaf')]=_0x7a29('0x128');_0x54151e['countabandonedretry']+=0x1;_0x54151e['countglobal']+=0x1;_0x1afa33['createHistory'](_0x54151e)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x1b5')));if(_0x1afa33[_0x7a29('0x199')](0xb,_0xf3ff0e,_0x47f6cd)){if(_0x54151e[_0x7a29('0xf6')]>=_0x47f6cd[_0x7a29('0x125')]){_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,'reason\x2011\x20abandoned');}else{_0x1afa33[_0x7a29('0xf9')](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1b6'));}}break;case'20':_0x47f6cd[_0x7a29('0x6d')]+=0x1;_0x54151e[_0x7a29('0xae')]=0x14;_0x54151e[_0x7a29('0xaf')]=_0x7a29('0x1b7');_0x54151e[_0x7a29('0xf7')]+=0x1;_0x54151e[_0x7a29('0xf0')]+=0x1;ami[_0x7a29('0x52')](_0x7a29('0x1b8'),ut[_0x7a29('0x1a4')](_0xf3ff0e,_0x7a29('0x1b9')));_0x1afa33['createHistory'](_0x54151e)[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x1ba')));if(_0x1afa33[_0x7a29('0x199')](0x14,_0xf3ff0e,_0x47f6cd)){if(_0x54151e[_0x7a29('0xf7')]>=_0x47f6cd['dialAgentRejectMaxRetry']){_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1bb'));}else{_0x1afa33[_0x7a29('0xf9')](_0x54151e,_0x3c086f,_0x133be6,_0x7a29('0x1bb'));}}break;default:_0x47f6cd['outboundUnknownCallsDay']+=0x1;_0x54151e[_0x7a29('0xae')]=0xc;_0x54151e[_0x7a29('0xaf')]=_0x5ee9b5[_0x7a29('0x110')];_0x1afa33['createHistory'](_0x54151e)['catch'](loggerCatch(_0x7a29('0x1bc')));if(_0x1afa33[_0x7a29('0x199')](_0x5ee9b5[_0x7a29('0x110')],_0xf3ff0e,_0x47f6cd)){if(_0x54151e[_0x7a29('0x101')]+_0x54151e[_0x7a29('0xf3')]+_0x54151e[_0x7a29('0x102')]+_0x54151e[_0x7a29('0xf4')]+_0x54151e['countdropretry']+_0x54151e[_0x7a29('0xf6')]+_0x54151e[_0x7a29('0xef')]+_0x54151e[_0x7a29('0xf7')]>=_0x47f6cd['dialGlobalMaxRetry']){_0x1afa33[_0x7a29('0xf9')](_0x54151e,_0x3c086f,_0x133be6,_0x5ee9b5[_0x7a29('0x110')]);}else{_0x1afa33[_0x7a29('0xfb')](_0x54151e,_0x3c086f,_0x133be6,_0x5ee9b5[_0x7a29('0x110')]);}}}});};Dialer[_0x7a29('0x1c')][_0x7a29('0xf9')]=function(_0x2599b0,_0x146097,_0x4b02e2,_0x29c544){var _0x117554=new Final(_0x2599b0);_0x117554[_0x7a29('0xae')]=0xf;_0x117554[_0x7a29('0xaf')]=_0x7a29('0x1bd');this['createStateFinal'](_0x117554,_0x146097,_0x4b02e2,_0x29c544);};Dialer['prototype'][_0x7a29('0xfb')]=function(_0x33b13a,_0x5b76b5,_0x85da65,_0xc2000d){this[_0x7a29('0xcc')](_0x33b13a)[_0x7a29('0xbc')](function(_0x124f3e){return _0x5b76b5(msgResponse(_0x7a29('0x1a0'),'Success',_0xc2000d));})[_0x7a29('0xb6')](function(_0x19741d){return _0x85da65(msgResponse('[moveContactManagedDialer][0]',_0x7a29('0x146'),_0x7a29('0x1be')));});};Dialer[_0x7a29('0x1c')][_0x7a29('0x15e')]=function(_0x5418cf){var _0x2268b1=this;var _0x4e59f6=_0x5418cf[_0x7a29('0x1bf')]/0x64;var _0x41d46b=_0x5418cf[_0x7a29('0x11c')]/(_0x5418cf[_0x7a29('0x11c')]+_0x5418cf['outboundAnswerCallsDay']);var _0x3884a0=Math[_0x7a29('0x1c0')](_0x5418cf['predictiveIntervalAvailable']*(_0x5418cf[_0x7a29('0x1c1')]/0x64));var _0x437b9a=Math[_0x7a29('0x1c0')](_0x5418cf[_0x7a29('0x1c2')]*(_0x5418cf[_0x7a29('0x1c3')]/0x64));var _0x235fe8=_0x5418cf[_0x7a29('0x57')]+_0x5418cf['talking'];var _0x1d6a3a=Math[_0x7a29('0x1c4')](_0x5418cf[_0x7a29('0x78')]*_0x5418cf[_0x7a29('0x7a')]*_0x5418cf[_0x7a29('0x75')]*_0x5418cf[_0x7a29('0x76')]);if(_[_0x7a29('0x42')](_0x5418cf['startProgressive'])){if(!_[_0x7a29('0x42')](_0x5418cf[_0x7a29('0x2b')])){_0x5418cf['startPredictive']=undefined;loggerPredictive['error'](_0x7a29('0x1c5'),_0x7a29('0x1c6'));}if(!_[_0x7a29('0x42')](_0x5418cf[_0x7a29('0x98')])){loggerPredictive[_0x7a29('0x9d')](_0x7a29('0x1c5'),_0x7a29('0x1c7'));clearInterval(_0x5418cf[_0x7a29('0x98')]);_0x5418cf['handlePredictive']=undefined;}_0x5418cf[_0x7a29('0x2c')]=moment()[_0x7a29('0x7d')](_0x7a29('0x106'));loggerPredictive[_0x7a29('0x83')](_0x5418cf['name'],_0x7a29('0x1c8'),_0x5418cf[_0x7a29('0x2c')]);this['handlePower'](_0x5418cf,0x1);}else if(ifInterval(_0x5418cf['dialPredictiveInterval'],_0x5418cf[_0x7a29('0x2c')])){this[_0x7a29('0x15b')](_0x5418cf,0x1);loggerPredictiveCalls['info'](_0x7a29('0x1c9'),_0x5418cf['startProgressive'],_0x5418cf[_0x7a29('0x44')]);_0x5418cf[_0x7a29('0x78')]=0x0;_0x5418cf[_0x7a29('0x74')]=0x0;}else if(_0x4e59f6<_0x41d46b&&_0x5418cf[_0x7a29('0x1ca')]===_0x7a29('0x1cb')){freeVariablesPredictive(_0x5418cf);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x1cc'),'Dropped\x20calls\x20day',_0x41d46b,'startProgressive',_0x5418cf[_0x7a29('0x44')]);}else if(_0x1d6a3a<_0x5418cf['predictiveIntervalErlangCallsDroppedCalls']&&_0x5418cf[_0x7a29('0x1ca')]===_0x7a29('0x1cb')){freeVariablesPredictive(_0x5418cf);loggerPredictive['info'](_0x7a29('0x1cd'),_0x7a29('0x1ce'),_0x1d6a3a,'Drop\x20in\x20this\x20interval',_0x5418cf['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x5418cf[_0x7a29('0x44')]);}else if(!ifInterval(_0x5418cf[_0x7a29('0x1cf')],_0x5418cf[_0x7a29('0x2c')])&&_[_0x7a29('0x42')](_0x5418cf[_0x7a29('0x2b')])&&!_[_0x7a29('0x42')](_0x5418cf['startProgressive'])){_0x5418cf[_0x7a29('0x2b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5418cf['name'],_0x7a29('0x1d0'),_0x5418cf[_0x7a29('0x2b')]);this[_0x7a29('0x1d1')](_0x5418cf[_0x7a29('0x1cf')])[_0x7a29('0xbc')](this['getDataPredictive'](_0x5418cf))[_0x7a29('0xbc')](mergeDataErlangB(_0x5418cf))[_0x7a29('0xbc')](this[_0x7a29('0x1d2')](_0x5418cf))[_0x7a29('0xb6')](loggerCatchPredictive(_0x7a29('0x1d3'),_0x5418cf));}else if(!ifInterval(_0x5418cf[_0x7a29('0x1cf')],_0x5418cf['startPredictive'])){_0x5418cf['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5418cf[_0x7a29('0x2b')]=moment()[_0x7a29('0x7d')](_0x7a29('0x106'));loggerPredictive['info'](_0x5418cf[_0x7a29('0x44')],'recalculate\x20predictive\x20at',_0x5418cf[_0x7a29('0x2b')]);clearInterval(_0x5418cf[_0x7a29('0x98')]);_0x5418cf[_0x7a29('0x98')]=undefined;this[_0x7a29('0x1d1')](_0x5418cf[_0x7a29('0x1cf')])['then'](this[_0x7a29('0x1d4')](_0x5418cf))[_0x7a29('0xbc')](mergeDataErlangB(_0x5418cf))[_0x7a29('0xbc')](this[_0x7a29('0x1d2')](_0x5418cf))['catch'](loggerCatchPredictive(_0x7a29('0x1d5'),_0x5418cf));}else if(_0x5418cf['predictiveIntervalAvailable']&&_0x235fe8<_0x5418cf[_0x7a29('0x1c2')]-_0x437b9a){freeVariablesPredictive(_0x5418cf);loggerPredictive[_0x7a29('0x83')](_0x5418cf[_0x7a29('0x44')],_0x7a29('0x1d6'),_0x235fe8,_0x7a29('0x1d7'),_0x5418cf[_0x7a29('0x1c2')],'-',_0x437b9a,'=',_0x5418cf[_0x7a29('0x1c2')]-_0x437b9a,')');}else if(_0x5418cf[_0x7a29('0x1c2')]&&_0x235fe8>_0x5418cf[_0x7a29('0x1c2')]+_0x3884a0){freeVariablesPredictive(_0x5418cf);loggerPredictive[_0x7a29('0x83')](_0x5418cf['name'],_0x7a29('0x1d6'),_0x235fe8,_0x7a29('0x1d8'),_0x5418cf[_0x7a29('0x1c2')],'+',_0x3884a0,'=',_0x5418cf['predictiveIntervalAvailable']+_0x3884a0,')');}};Dialer[_0x7a29('0x1c')][_0x7a29('0x1d4')]=function(_0x208fcf){var _0x438ada=this;return function(_0x134704){return new BPromise(function(_0x2d9a6a,_0x146677){_[_0x7a29('0x96')](_0x208fcf,_0x134704[0x0]);if(checkGetDataPredictive(_0x134704[0x0])){var _0x3ca40a=_0x208fcf[_0x7a29('0x1c2')]=_0x208fcf[_0x7a29('0x5c')]+_0x208fcf[_0x7a29('0x57')];var _0x599e8e=_0x208fcf[_0x7a29('0x1cf')]*0x3c;var _0xe20c8e=_0x134704[0x0][_0x7a29('0x70')]+_0x134704[0x0][_0x7a29('0x6f')];var _0x29a804=(_0x134704[0x0][_0x7a29('0x86')]+_0x134704[0x0][_0x7a29('0x72')]+_0x134704[0x0][_0x7a29('0x71')])/_0x134704[0x0][_0x7a29('0x77')];_0x208fcf[_0x7a29('0x75')]=_0x29a804>0x0?_0x29a804:0x1;switch(_0x208fcf[_0x7a29('0x1ca')]){case _0x7a29('0x1cb'):var _0x370ba7=_0x208fcf[_0x7a29('0x1bf')]/0x64;return _0x438ada[_0x7a29('0x1d9')](_0x3ca40a,_0x599e8e,_0xe20c8e,_0x29a804,_0x370ba7)[_0x7a29('0xbc')](function(_0x4bb698){return _0x2d9a6a(_0x4bb698);});case'agentBusyFactor':var _0x17418a=_0x208fcf['dialPredictiveOptimizationPercentage']/0x64;return _0x438ada[_0x7a29('0x1da')](_0x3ca40a,_0x599e8e,_0xe20c8e,_0x29a804,_0x17418a)['then'](function(_0x6250c4){return _0x2d9a6a(_0x6250c4);});default:return _0x146677(msgResponse(_0x7a29('0x1db'),_0x7a29('0x146'),_0x7a29('0x1dc')));}}else{return _0x146677(msgResponse('[getDataPredictive]',_0x7a29('0x146'),_0x7a29('0x1dd')));}});};};Dialer[_0x7a29('0x1c')][_0x7a29('0x1de')]=function(_0x37f54f){var _0x558384=this;return function(_0x4f6287){return new BPromise(function(_0x3baeaf,_0x3de728){_[_0x7a29('0x96')](_0x37f54f,_0x4f6287[0x0]);if(checkGetDataPredictive(_0x4f6287[0x0])){loggerPredictive[_0x7a29('0x83')](JSON[_0x7a29('0x4e')](_0x4f6287[0x0]));if(_0x37f54f['dialPredictiveOptimization']===_0x7a29('0x1cb')){return _0x558384[_0x7a29('0xca')](_0x37f54f['id'])[_0x7a29('0xbc')](function(_0x5708e3){var _0x1fb355=_0x37f54f[_0x7a29('0x58')]-_0x5708e3[0x0][_0x7a29('0x1df')];var _0x228bbf=_0x37f54f['dialPredictiveInterval']*0x3c;var _0xeb47b7=_0x4f6287[0x0]['predictiveIntervalAvgTalktime']+_0x4f6287[0x0][_0x7a29('0x6f')];var _0x320afa=(_0x4f6287[0x0][_0x7a29('0x86')]+_0x4f6287[0x0][_0x7a29('0x72')]+_0x4f6287[0x0][_0x7a29('0x71')])/_0x4f6287[0x0][_0x7a29('0x77')];var _0x20503f=_0x37f54f[_0x7a29('0x1bf')]/0x64;_0x37f54f[_0x7a29('0x1e0')]=_0x5708e3[0x0][_0x7a29('0x1df')]||0x0;_0x37f54f[_0x7a29('0x75')]=_0x320afa>0x0?_0x320afa:0x1;return _0x558384['abandonmentRate'](_0x1fb355,_0x228bbf,_0xeb47b7,_0x320afa,_0x20503f);})[_0x7a29('0xbc')](function(_0x26e7f2){return _0x3baeaf(_0x26e7f2);})['catch'](function(_0x21471e){return _0x3de728(msgResponse(_0x7a29('0x1e1'),'Failure',JSON[_0x7a29('0x4e')](_0x21471e)));});}if(_0x37f54f['dialPredictiveOptimization']==='agentBusyFactor'){return _0x558384[_0x7a29('0xca')](_0x37f54f['id'])[_0x7a29('0xbc')](function(_0x28434f){var _0x516b22=_0x37f54f[_0x7a29('0x58')]-_0x28434f[0x0]['outboundQueuePauses'];var _0xf0ae55=_0x37f54f[_0x7a29('0x1cf')]*0x3c;var _0x202ef0=_0x4f6287[0x0][_0x7a29('0x70')]+_0x4f6287[0x0][_0x7a29('0x6f')];var _0x227a2d=(_0x4f6287[0x0][_0x7a29('0x86')]+_0x4f6287[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4f6287[0x0][_0x7a29('0x71')])/_0x4f6287[0x0][_0x7a29('0x77')];var _0x52fd74=_0x37f54f[_0x7a29('0x1bf')]/0x64;_0x37f54f[_0x7a29('0x1e0')]=_0x28434f[0x0][_0x7a29('0x1df')]||0x0;_0x37f54f[_0x7a29('0x75')]=_0x227a2d>0x0?_0x227a2d:0x1;return _0x558384[_0x7a29('0x1da')](_0x516b22,_0xf0ae55,_0x202ef0,_0x227a2d,_0x52fd74);})['then'](function(_0x6e839c){return _0x3baeaf(_0x6e839c);})[_0x7a29('0xb6')](function(_0x5682ae){return _0x3de728(msgResponse(_0x7a29('0x1e1'),_0x7a29('0x146'),JSON[_0x7a29('0x4e')](_0x5682ae)));});}}else{return _0x3de728(msgResponse(_0x7a29('0x1db'),_0x7a29('0x146'),'check\x20failure'));}});};};Dialer[_0x7a29('0x1c')][_0x7a29('0x1d2')]=function(_0x7f4bee){var _0x35337b=this;return function(){var _0x14d4ae=0x0;var _0x3ca058=Math[_0x7a29('0x1c4')](_0x7f4bee['erlangCallToSecond']*0x3e8);if(_0x3ca058>0x0){_0x3ca058=_0x3ca058<0x64?0x64:_0x3ca058;loggerPredictive[_0x7a29('0x83')](_0x7f4bee[_0x7a29('0x44')],'one\x20call\x20every:',_0x3ca058,'milliseconds');_0x7f4bee[_0x7a29('0x98')]=setInterval(function(){_0x35337b['handlePredictive'](_0x7f4bee);loggerPredictiveCalls[_0x7a29('0x83')](_0x7a29('0x1e2'),_0x14d4ae+=0x1);},_0x3ca058);}else{loggerPredictive[_0x7a29('0x83')](_0x7f4bee['name'],_0x7a29('0x1e3'));}};};Dialer[_0x7a29('0x1c')][_0x7a29('0x1e4')]=function(_0x196f5a,_0x1730e9){var _0x100c3f=this;return function(_0x74b56c){if(_['isEmpty'](_0x74b56c)){if(_[_0x7a29('0xb4')](_0x1730e9[_0x7a29('0xd6')])||!_0x1730e9[_0x7a29('0x1e5')]){if(_0x196f5a[_0x7a29('0x159')]===_0x7a29('0x15f')){_0x196f5a['queueStatusComplete']=_['isUndefined'](_0x196f5a[_0x7a29('0x130')])?!![]:_0x196f5a[_0x7a29('0x130')];var _0xcf2f83=uuid['v4']();_0x100c3f[_0x7a29('0x27')][_0xcf2f83]=new Action(_0x196f5a,_0x1730e9,_0xcf2f83);loggerBooked[_0x7a29('0x83')](_0x7a29('0x1e6'),_0xcf2f83,_0x7a29('0x1e7'),JSON['stringify'](_0x196f5a[_0x7a29('0x130')]),_0x7a29('0x1e8'),_0x196f5a['name']);if(_0x196f5a[_0x7a29('0x130')]){_0x196f5a['queueStatusComplete']=![];_0x100c3f['queueBooked'][_0x100c3f[_0x7a29('0x27')][_0xcf2f83][_0x7a29('0xb9')]]=[];ami[_0x7a29('0xb5')]({'actionid':_0xcf2f83,'action':_0x7a29('0x1e9'),'queue':_0x196f5a[_0x7a29('0x44')]})[_0x7a29('0xb6')](function(_0x212816){_0x100c3f['updateOriginated'](_0x196f5a);_0x100c3f[_0x7a29('0xc3')]({'active':![],'ContactId':_0x100c3f['actions'][_0xcf2f83][_0x7a29('0xd4')],'ListId':_0x100c3f[_0x7a29('0x27')][_0xcf2f83][_0x7a29('0xd5')],'VoiceQueueId':_0x100c3f['actions'][_0xcf2f83][_0x7a29('0xd7')]||undefined,'CampaignId':_0x100c3f[_0x7a29('0x27')][_0xcf2f83][_0x7a29('0xd8')]||undefined})[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x1ea')));delete _0x100c3f[_0x7a29('0x27')][_0xcf2f83];});}else{loggerBooked[_0x7a29('0x83')](_0x7a29('0x1eb'),JSON[_0x7a29('0x4e')](_0x196f5a[_0x7a29('0x130')]),_0x7a29('0x1e8'),_0x196f5a['name']);_0x100c3f[_0x7a29('0xb8')](_0x196f5a);_0x100c3f[_0x7a29('0xc3')]({'active':![],'ContactId':_0x100c3f[_0x7a29('0x27')][_0xcf2f83]['ContactId'],'ListId':_0x100c3f[_0x7a29('0x27')][_0xcf2f83]['ListId'],'VoiceQueueId':_0x100c3f[_0x7a29('0x27')][_0xcf2f83]['VoiceQueueId']||undefined,'CampaignId':_0x100c3f[_0x7a29('0x27')][_0xcf2f83]['CampaignId']||undefined})[_0x7a29('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x100c3f[_0x7a29('0x27')][_0xcf2f83];}}else{return _0x100c3f[_0x7a29('0x169')](_0x196f5a,_0x1730e9);}}else{if(getDiff(_0x1730e9[_0x7a29('0x1ec')])<_0x196f5a[_0x7a29('0x1ed')]*0x3c){if(_0x1730e9[_0x7a29('0x1ee')]&&!_0x1730e9['Agent'][_0x7a29('0x1ef')]){_0x100c3f[_0x7a29('0x132')][_0x7a29('0x133')](_0x1730e9['id'])['finally'](function(){_0x100c3f[_0x7a29('0xb8')](_0x196f5a);});}else{_0x100c3f[_0x7a29('0xc5')]({'active':![]},_0x1730e9['id'],0x1)['finally'](function(){console['log'](_0x7a29('0x1f0'));_0x100c3f[_0x7a29('0xb8')](_0x196f5a);});}}else{_0x196f5a[_0x7a29('0x6c')]+=0x1;_0x100c3f[_0x7a29('0xb8')](_0x196f5a);if(_0x196f5a['dialRecallInQueue']){_0x100c3f[_0x7a29('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1730e9[_0x7a29('0xd4')],'ListId':_0x1730e9[_0x7a29('0xd5')],'VoiceQueueId':_0x1730e9['VoiceQueueId']||undefined,'CampaignId':_0x1730e9['CampaignId']||undefined})[_0x7a29('0xb6')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x100c3f[_0x7a29('0xcd')](createObjHistory(_0x196f5a,_0x1730e9,_0x7a29('0x1f1'),0x17,_0x7a29('0x1f2')))['catch'](loggerCatch(_0x7a29('0x1f3')));}else{_0x100c3f[_0x7a29('0xdf')](createObjHistory(_0x196f5a,_0x1730e9,_0x7a29('0x1f4'),0x16,_0x7a29('0x1f5')),_0x7a29('0x1f6'),_0x7a29('0x1f7'));}}}}else{_0x196f5a[_0x7a29('0x64')]+=0x1;_0x100c3f[_0x7a29('0xdf')](createObjHistory(_0x196f5a,_0x1730e9,_0x7a29('0x1f8'),0xd,_0x7a29('0x1f9')),_0x7a29('0x1fa'),_0x7a29('0x1fb'));throw _0x7a29('0x1fc');}};};Dialer['prototype'][_0x7a29('0x1fd')]=function(_0x285b72){var _0x2082b8=this;var _0x31f5d7=[];var _0x1a6aa8=_0x285b72[_0x7a29('0x1fe')]-_0x285b72[_0x7a29('0xa2')]-_0x285b72[_0x7a29('0x1ff')];emitCampaignSummary(_0x285b72);if(_0x1a6aa8>0x0){if(_0x1a6aa8>this[_0x7a29('0x25')]){_0x1a6aa8=this['maxNumberOriginate'];}_0x285b72[_0x7a29('0x1ff')]+=_0x1a6aa8;this[_0x7a29('0xc9')](_0x285b72['id'],_0x1a6aa8,_0x285b72[_0x7a29('0x200')])['then'](function(_0x13835a){_0x285b72[_0x7a29('0x1ff')]-=_0x1a6aa8;_0x285b72[_0x7a29('0x1ff')]=_0x285b72[_0x7a29('0x1ff')]>0x0?_0x285b72[_0x7a29('0x1ff')]:0x0;if(!checkContactEmpty(_0x13835a)){_0x285b72['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x7a29('0x83')](_0x7a29('0x201')+_0x285b72[_0x7a29('0x44')]);}else{_0x285b72[_0x7a29('0xa2')]+=_0x13835a[_0x7a29('0xa0')];_0x285b72['message']=_0x7a29('0x202');for(var _0x21b01f=0x0;_0x21b01f<_0x13835a['length'];_0x21b01f+=0x1){_0x285b72['ivrTotalCallsDays']+=0x1;if(_[_0x7a29('0xb4')](_0x13835a[_0x21b01f])||_[_0x7a29('0xb4')](_0x13835a[_0x21b01f]['Contact'])||_[_0x7a29('0xb4')](_0x13835a[_0x21b01f]['Contact'][_0x7a29('0x16b')])){_0x2082b8[_0x7a29('0xd2')](_0x7a29('0x203'),_0x285b72,_0x13835a[_0x21b01f]);}else{_0x2082b8[_0x7a29('0xc0')](_[_0x7a29('0xd3')](_0x13835a[_0x21b01f],[_0x7a29('0xd8'),'Contact.phone']))[_0x7a29('0xbc')](_0x2082b8[_0x7a29('0x1e4')](_0x285b72,_0x13835a[_0x21b01f]))[_0x7a29('0xb6')](_0x2082b8[_0x7a29('0xd1')]('[actionOriginateIvr]\x20',_0x285b72));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x285b72,_0x1a6aa8));}};Dialer[_0x7a29('0x1c')][_0x7a29('0x15b')]=function(_0xcaaf52,_0xe5642a){var _0xd5d298=this;var _0x567607=[];var _0x46d39f=_0xe5642a>=0x1?_0xe5642a:0x1;var _0x163434=[];if(_0xcaaf52[_0x7a29('0x159')]===_0x7a29('0x15f')){_0x46d39f=0x1;}var _0x425504=Math[_0x7a29('0x1c4')](_0xcaaf52[_0x7a29('0x57')]*_0x46d39f)-_0xcaaf52[_0x7a29('0xa2')]-_0xcaaf52[_0x7a29('0x1ff')];emitVoiceQueueSummary(_0xcaaf52);if(_0xcaaf52[_0x7a29('0x204')]>0x0){var _0x476f38=_0xcaaf52[_0x7a29('0x204')]-_0xcaaf52[_0x7a29('0xa2')]-_0xcaaf52[_0x7a29('0x5c')]-_0xcaaf52['temp']-_0xcaaf52[_0x7a29('0x59')];if(_0x425504>_0x476f38){_0x425504=_0x476f38;}}if(_0x425504>0x0){if(_0xcaaf52[_0x7a29('0x159')]===_0x7a29('0x15f')){_0x425504=0x1;}if(_0x425504>this[_0x7a29('0x25')]){_0x425504=this[_0x7a29('0x25')];}_0xcaaf52[_0x7a29('0x1ff')]+=_0x425504;for(var _0x2439ae in this[_0x7a29('0x23')]){if(this[_0x7a29('0x23')]['hasOwnProperty'](_0x2439ae)){if(this[_0x7a29('0x23')][_0x2439ae]['state']===_0x7a29('0x205')&&this[_0x7a29('0x23')][_0x2439ae]['status']===_0x7a29('0x206')){_0x567607[_0x7a29('0x14c')](this['agents'][_0x2439ae]['id']);}}}this['getContactDialer'](_0xcaaf52['id'],_0x567607,_0x425504,_0xcaaf52[_0x7a29('0x200')])[_0x7a29('0xbc')](function(_0x2ce0a1){_0xcaaf52[_0x7a29('0x1ff')]-=_0x425504;_0xcaaf52[_0x7a29('0x1ff')]=_0xcaaf52[_0x7a29('0x1ff')]>0x0?_0xcaaf52[_0x7a29('0x1ff')]:0x0;if(!checkContactEmpty(_0x2ce0a1)){_0xd5d298[_0x7a29('0xbb')](_0xcaaf52)[_0x7a29('0xbc')](sendMessageReschedule(_0xcaaf52))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x207')));}else{_0xcaaf52['originated']+=_0x2ce0a1['length'];_0xcaaf52[_0x7a29('0x43')]=_0xcaaf52[_0x7a29('0x159')]===_0x7a29('0x15f')?_0x7a29('0x172'):_0x7a29('0x202');for(var _0x240d8d=0x0;_0x240d8d<_0x2ce0a1['length'];_0x240d8d+=0x1){if(_[_0x7a29('0xb4')](_0x2ce0a1[_0x240d8d])||_[_0x7a29('0xb4')](_0x2ce0a1[_0x240d8d]['Contact'])||_[_0x7a29('0xb4')](_0x2ce0a1[_0x240d8d][_0x7a29('0x183')]['phone'])){_0xd5d298['emptyContact'](_0x7a29('0x203'),_0xcaaf52,_0x2ce0a1[_0x240d8d]);}else{_0xd5d298[_0x7a29('0xbd')](_[_0x7a29('0xd3')](_0x2ce0a1[_0x240d8d],[_0x7a29('0xd7'),_0x7a29('0x208')]))['then'](_0xd5d298[_0x7a29('0x1e4')](_0xcaaf52,_0x2ce0a1[_0x240d8d]))[_0x7a29('0xb6')](_0xd5d298['loggerHandler'](_0x7a29('0x203'),_0xcaaf52));}}}})[_0x7a29('0xb6')](loggerGetContactDialer(_0x7a29('0x209'),_0xcaaf52,_0x425504));}};Dialer[_0x7a29('0x1c')][_0x7a29('0x98')]=function(_0x4b85bc){var _0xa2d9f2=this;if(_0x4b85bc['dialLimitQueue']>0x0){var _0x3505b7=_0x4b85bc[_0x7a29('0x204')]-_0x4b85bc[_0x7a29('0xa2')]-_0x4b85bc[_0x7a29('0x5c')];if(_0x3505b7>0x0){this[_0x7a29('0x20a')](_0x4b85bc);}else{loggerPredictiveCalls[_0x7a29('0x83')]('[handlePredictive][limitChannel]');}}else{this[_0x7a29('0x20a')](_0x4b85bc);}};Dialer[_0x7a29('0x1c')]['tryOriginatePredictive']=function(_0x3c265c){var _0x10ae46=this;var _0x4fdcad=[];_0x3c265c['originated']+=0x1;for(var _0x5ce4f8 in this[_0x7a29('0x23')]){if(this[_0x7a29('0x23')][_0x7a29('0xa1')](_0x5ce4f8)){if(this['agents'][_0x5ce4f8][_0x7a29('0xae')]===_0x7a29('0x205')&&this[_0x7a29('0x23')][_0x5ce4f8][_0x7a29('0xde')]==='reachable'){_0x4fdcad[_0x7a29('0x14c')](this[_0x7a29('0x23')][_0x5ce4f8]['id']);}}}this[_0x7a29('0xc7')](_0x3c265c['id'],_0x4fdcad,0x1,_0x3c265c[_0x7a29('0x200')])[_0x7a29('0xbc')](function(_0x1708de){if(!checkContactEmpty(_0x1708de)){checkContactLowerLimitOriginate(_0x3c265c,0x1,0x0);_0x10ae46['countReScheduled'](_0x3c265c)[_0x7a29('0xbc')](sendMessageReschedule(_0x3c265c))[_0x7a29('0xb6')](loggerCatch(_0x7a29('0x207')));}else{_0x3c265c['message']='RUNNING';if(_['isNil'](_0x1708de[0x0])||_[_0x7a29('0xb4')](_0x1708de[0x0]['Contact'])||_[_0x7a29('0xb4')](_0x1708de[0x0][_0x7a29('0x183')]['phone'])){_0x10ae46[_0x7a29('0xd2')](_0x7a29('0x203'),_0x3c265c,_0x1708de[0x0]);}else{_0x10ae46[_0x7a29('0xbd')](_[_0x7a29('0xd3')](_0x1708de[0x0],[_0x7a29('0xd7'),_0x7a29('0x208')]))[_0x7a29('0xbc')](_0x10ae46[_0x7a29('0x1e4')](_0x3c265c,_0x1708de[0x0]))[_0x7a29('0xb6')](_0x10ae46[_0x7a29('0xd1')](_0x7a29('0x20b'),_0x3c265c));}}})['catch'](loggerGetContactDialer(_0x7a29('0x20c'),_0x3c265c,0x1));emitVoiceQueueSummary(_0x3c265c);};Dialer[_0x7a29('0x1c')]['abandonmentRate']=function(_0x1bae91,_0x316501,_0x35207e,_0x3a2d86,_0x48ce95,_0x451b67){loggerPredictive[_0x7a29('0x83')](_0x7a29('0x20d'));loggerPredictive['info'](_0x7a29('0x20e'),_0x1bae91);loggerPredictive['info'](_0x7a29('0x20f'),_0x316501);loggerPredictive[_0x7a29('0x83')]('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',_0x35207e);loggerPredictive['info'](_0x7a29('0x210'),_0x3a2d86);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x211'),_0x48ce95);loggerPredictive['info'](_0x7a29('0x8b'));return new BPromise(function(_0x433159,_0xc28b66){if(_0x1bae91<=0x0||isNaN(_0x1bae91)){return _0xc28b66(msgResponse(_0x7a29('0x212'),'Error',_0x7a29('0x213')+_0x1bae91));}if(_0x35207e<=0x0||isNaN(_0x35207e)){return _0xc28b66(msgResponse(_0x7a29('0x212'),_0x7a29('0x4d'),_0x7a29('0x214')+_0x35207e));}if(_0x3a2d86<=0x0||isNaN(_0x3a2d86)){return _0xc28b66(msgResponse(_0x7a29('0x212'),_0x7a29('0x4d'),_0x7a29('0x215')+_0x3a2d86));}if(_0x316501<=0x0||isNaN(_0x316501)){return _0xc28b66(msgResponse('[abandonmentRate]',_0x7a29('0x4d'),'interval\x20=\x20'+_0x316501));}if(_0x48ce95<=0x0||isNaN(_0x48ce95)){return _0xc28b66(msgResponse(_0x7a29('0x212'),'Error',_0x7a29('0x216')+_0x48ce95));}_0x451b67=_0x451b67||0x0;var _0x3dfae8=0x1/_0x35207e;var _0x32d26c=0x0;var _0x1c9bd1=0x0;var _0x595bb6=0x0;var _0x27b5e7=0x0;for(var _0xc8de10=0x0;_0x595bb6<_0x48ce95;_0xc8de10+=0x1){_0x1c9bd1=_0xc8de10/_0x316501;_0x32d26c=(_0x3a2d86*_0x1c9bd1+_0x451b67)/_0x3dfae8;_0x595bb6=erlangb(_0x32d26c,_0x1bae91);_0x27b5e7=_0x32d26c/_0x1bae91*(0x1-erlangb(_0x32d26c,_0x1bae91));}return _0x433159({'erlangCalls':_0xc8de10,'erlangCallToSecond':_0x316501/_0xc8de10,'erlangAbandonmentRate':_0x595bb6,'erlangBusyFactor':_0x27b5e7});});};Dialer[_0x7a29('0x1c')][_0x7a29('0x1da')]=function(_0x5039fe,_0x304d29,_0x175b3a,_0x3b2042,_0x229491,_0x565b21){loggerPredictive['info'](_0x7a29('0x217'));loggerPredictive[_0x7a29('0x83')](_0x7a29('0x20e'),_0x5039fe);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x20f'),_0x304d29);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x218'),_0x175b3a);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x210'),_0x3b2042);loggerPredictive['info'](_0x7a29('0x219'),_0x229491);loggerPredictive[_0x7a29('0x83')](_0x7a29('0x8b'));return new BPromise(function(_0x24de2d,_0x5673c4){if(_0x5039fe<=0x0||isNaN(_0x5039fe)){return _0x5673c4(msgResponse('[busyFactor]',_0x7a29('0x4d'),_0x7a29('0x213')+_0x5039fe));}if(_0x175b3a<=0x0||isNaN(_0x175b3a)){return _0x5673c4(msgResponse(_0x7a29('0x21a'),'Error','Ts\x20=\x20'+_0x175b3a));}if(_0x3b2042<=0x0||isNaN(_0x3b2042)){return _0x5673c4(msgResponse('[busyFactor]',_0x7a29('0x4d'),_0x7a29('0x215')+_0x3b2042));}if(_0x304d29<=0x0||isNaN(_0x304d29)){return _0x5673c4(msgResponse(_0x7a29('0x21a'),_0x7a29('0x4d'),_0x7a29('0x21b')+_0x304d29));}if(_0x229491<=0x0||isNaN(_0x229491)){return _0x5673c4(msgResponse(_0x7a29('0x21a'),_0x7a29('0x4d'),_0x7a29('0x21c')+_0x229491));}_0x565b21=_0x565b21||0x0;var _0x19a54=0x1/_0x175b3a;var _0x1081d5=0x0;var _0x484950=0x0;var _0x577731=0x0;var _0x2f97a4=0x0;for(var _0x597f97=0x0;_0x2f97a4<_0x229491;_0x597f97+=0x1){_0x484950=_0x597f97/_0x304d29;_0x1081d5=(_0x3b2042*_0x484950+_0x565b21)/_0x19a54;_0x577731=erlangb(_0x1081d5,_0x5039fe);_0x2f97a4=_0x1081d5/_0x5039fe*(0x1-erlangb(_0x1081d5,_0x5039fe));}return _0x24de2d({'erlangCalls':_0x597f97,'erlangCallToSecond':_0x304d29/_0x597f97,'erlangAbandonmentRate':_0x577731,'erlangBusyFactor':_0x2f97a4});});};module[_0x7a29('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 7b369d2..f5ac668 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 _0x4624=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x11e947,_0x51a83e){var _0x454c79=function(_0x3de417){while(--_0x3de417){_0x11e947['push'](_0x11e947['shift']());}};_0x454c79(++_0x51a83e);}(_0x4624,0x181));var _0x4462=function(_0xae3190,_0x49281c){_0xae3190=_0xae3190-0x0;var _0x3eacea=_0x4624[_0xae3190];return _0x3eacea;};'use strict';var util=require(_0x4462('0x0'));var _=require('lodash');var moment=require(_0x4462('0x1'));function getSeconds(_0x30133e,_0x2d62fc){var _0x4fe0fe=moment(_0x30133e)[_0x4462('0x2')](0x0);var _0x52cf04=moment(_0x2d62fc)[_0x4462('0x2')](0x0);return _0x4fe0fe[_0x4462('0x3')](_0x52cf04,_0x4462('0x4'));}function QueueCallerAbandon(_0x150805,_0x58f2b1){this['scheduledat']=_0x150805[_0x4462('0x5')];this['type']=_0x150805['type'];this[_0x4462('0x6')]=_0x150805[_0x4462('0x7')]===_0x4462('0x8')?_0x4462('0x9'):_0x150805[_0x4462('0x7')];this[_0x4462('0xa')]=_0x150805[_0x4462('0xa')];this[_0x4462('0xb')]=_0x150805[_0x4462('0xb')];this[_0x4462('0xc')]=_0x150805[_0x4462('0xc')];this[_0x4462('0xd')]=_0x150805[_0x4462('0xa')]+_0x150805[_0x4462('0xb')]+_0x150805[_0x4462('0xc')]+_0x150805[_0x4462('0xe')]+_0x150805['countdropretry']+_0x150805[_0x4462('0xf')]+_0x150805['countmachineretry']+_0x150805[_0x4462('0x10')];this[_0x4462('0xe')]=_0x150805['countnosuchnumberretry'];this[_0x4462('0x11')]=_0x150805[_0x4462('0x11')];this[_0x4462('0xf')]=_0x150805[_0x4462('0xf')];this[_0x4462('0x12')]=_0x150805[_0x4462('0x12')];this['countagentrejectretry']=_0x150805[_0x4462('0x10')];this['uniqueid']=_0x58f2b1['uniqueid'];this[_0x4462('0x13')]=_0x150805[_0x4462('0x14')];this[_0x4462('0x15')]=_0x150805[_0x4462('0x16')];this[_0x4462('0x17')]=_0x150805[_0x4462('0x17')];this[_0x4462('0x18')]=_0x150805[_0x4462('0x18')];this[_0x4462('0x19')]=_0x150805[_0x4462('0x19')];this[_0x4462('0x1a')]=this['droptime'];this['ringtime']=getSeconds(_0x150805['responsetime'],_0x150805[_0x4462('0x17')]);this['holdtime']=getSeconds(this[_0x4462('0x19')],_0x150805[_0x4462('0x18')]);this[_0x4462('0x1b')]=0x0;this[_0x4462('0x9')]=_0x58f2b1[_0x4462('0x9')];this[_0x4462('0x1c')]=_0x58f2b1[_0x4462('0x1d')];this[_0x4462('0x1e')]=_0x58f2b1['reason'];this[_0x4462('0x1f')]=_0x150805[_0x4462('0x1f')];this[_0x4462('0x20')]=_0x150805['callbackuniqueid'];this[_0x4462('0x21')]=_0x150805[_0x4462('0x21')];this[_0x4462('0x22')]=_0x150805[_0x4462('0x22')];this[_0x4462('0x23')]=_0x150805[_0x4462('0x23')];this[_0x4462('0x24')]=_0x150805[_0x4462('0x24')];this[_0x4462('0x25')]=_0x150805[_0x4462('0x25')];this[_0x4462('0x26')]=_0x150805[_0x4462('0x26')];this[_0x4462('0x27')]=_0x150805[_0x4462('0x27')];this[_0x4462('0x28')]=_0x150805[_0x4462('0x28')]||'';this[_0x4462('0x29')]=_0x150805[_0x4462('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x7ee2=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x51899f,_0x52b9ee){var _0x121d5d=function(_0x20eebe){while(--_0x20eebe){_0x51899f['push'](_0x51899f['shift']());}};_0x121d5d(++_0x52b9ee);}(_0x7ee2,0x160));var _0x27ee=function(_0x486c8c,_0xa2a739){_0x486c8c=_0x486c8c-0x0;var _0x12e258=_0x7ee2[_0x486c8c];return _0x12e258;};'use strict';var util=require(_0x27ee('0x0'));var _=require(_0x27ee('0x1'));var moment=require(_0x27ee('0x2'));function getSeconds(_0x2ab438,_0x32571d){var _0x142c8e=moment(_0x2ab438)[_0x27ee('0x3')](0x0);var _0x6ee1e=moment(_0x32571d)[_0x27ee('0x3')](0x0);return _0x142c8e[_0x27ee('0x4')](_0x6ee1e,_0x27ee('0x5'));}function QueueCallerAbandon(_0x50fa38,_0x4a4897){this[_0x27ee('0x6')]=_0x50fa38['scheduledat'];this[_0x27ee('0x7')]=_0x50fa38[_0x27ee('0x7')];this[_0x27ee('0x8')]=_0x50fa38[_0x27ee('0x7')]===_0x27ee('0x9')?_0x27ee('0xa'):_0x50fa38[_0x27ee('0x7')];this[_0x27ee('0xb')]=_0x50fa38['countbusyretry'];this[_0x27ee('0xc')]=_0x50fa38[_0x27ee('0xc')];this['countnoanswerretry']=_0x50fa38[_0x27ee('0xd')];this[_0x27ee('0xe')]=_0x50fa38[_0x27ee('0xb')]+_0x50fa38['countcongestionretry']+_0x50fa38[_0x27ee('0xd')]+_0x50fa38[_0x27ee('0xf')]+_0x50fa38[_0x27ee('0x10')]+_0x50fa38[_0x27ee('0x11')]+_0x50fa38[_0x27ee('0x12')]+_0x50fa38['countagentrejectretry'];this[_0x27ee('0xf')]=_0x50fa38[_0x27ee('0xf')];this[_0x27ee('0x10')]=_0x50fa38['countdropretry'];this[_0x27ee('0x11')]=_0x50fa38[_0x27ee('0x11')];this[_0x27ee('0x12')]=_0x50fa38[_0x27ee('0x12')];this[_0x27ee('0x13')]=_0x50fa38[_0x27ee('0x13')];this[_0x27ee('0x14')]=_0x4a4897['uniqueid'];this[_0x27ee('0x15')]=_0x50fa38[_0x27ee('0x16')];this[_0x27ee('0x17')]=_0x50fa38['number'];this[_0x27ee('0x18')]=_0x50fa38['starttime'];this[_0x27ee('0x19')]=_0x50fa38[_0x27ee('0x19')];this['droptime']=_0x50fa38[_0x27ee('0x1a')];this[_0x27ee('0x1b')]=this['droptime'];this[_0x27ee('0x1c')]=getSeconds(_0x50fa38[_0x27ee('0x19')],_0x50fa38[_0x27ee('0x18')]);this['holdtime']=getSeconds(this[_0x27ee('0x1a')],_0x50fa38[_0x27ee('0x19')]);this[_0x27ee('0x1d')]=0x0;this[_0x27ee('0xa')]=_0x4a4897[_0x27ee('0xa')];this['membername']=_0x4a4897[_0x27ee('0x1e')];this[_0x27ee('0x1f')]=_0x4a4897[_0x27ee('0x1f')];this[_0x27ee('0x20')]=_0x50fa38[_0x27ee('0x20')];this[_0x27ee('0x21')]=_0x50fa38['callbackuniqueid'];this[_0x27ee('0x22')]=_0x50fa38[_0x27ee('0x22')];this['recallme']=_0x50fa38[_0x27ee('0x23')];this[_0x27ee('0x24')]=_0x50fa38[_0x27ee('0x24')];this[_0x27ee('0x25')]=_0x50fa38[_0x27ee('0x25')];this['UserId']=_0x50fa38[_0x27ee('0x26')];this[_0x27ee('0x27')]=_0x50fa38[_0x27ee('0x27')];this[_0x27ee('0x28')]=_0x50fa38['CampaignId'];this[_0x27ee('0x29')]=_0x50fa38[_0x27ee('0x29')]||'';this[_0x27ee('0x2a')]=_0x50fa38[_0x27ee('0x2a')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 317cbf5..ddd9d71 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 _0x5e3c=['tech','Trunk','localstationid','headerinfo','path','AttachmentId','util','lodash','moment','uniqueid','channel','format','%s/%s/%s'];(function(_0x4d4bc0,_0x3ba9fa){var _0x11bba4=function(_0x545e3c){while(--_0x545e3c){_0x4d4bc0['push'](_0x4d4bc0['shift']());}};_0x11bba4(++_0x3ba9fa);}(_0x5e3c,0x117));var _0xc5e3=function(_0x232cd1,_0x8a1a0c){_0x232cd1=_0x232cd1-0x0;var _0x4ebd0f=_0x5e3c[_0x232cd1];return _0x4ebd0f;};'use strict';var util=require(_0xc5e3('0x0'));var _=require(_0xc5e3('0x1'));var moment=require(_0xc5e3('0x2'));function Action(_0x5c767a,_0x396089,_0x3177b6){this[_0xc5e3('0x3')]=_0x5c767a||undefined;this[_0xc5e3('0x4')]=util[_0xc5e3('0x5')](_0xc5e3('0x6'),_0x396089[_0xc5e3('0x7')],_0x396089[_0xc5e3('0x8')]['name'],_0x3177b6['fax']);this[_0xc5e3('0x9')]=_0x396089[_0xc5e3('0x9')];this['headerinfo']=_0x396089[_0xc5e3('0xa')];this[_0xc5e3('0xb')]=_0x3177b6[_0xc5e3('0xb')];this[_0xc5e3('0xc')]=_0x3177b6[_0xc5e3('0xc')];}module['exports']=Action; \ No newline at end of file +var _0xde94=['format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','lodash','uniqueid'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xde94,0xe8));var _0x4de9=function(_0x48a54d,_0x58ac17){_0x48a54d=_0x48a54d-0x0;var _0x186bad=_0xde94[_0x48a54d];return _0x186bad;};'use strict';var util=require('util');var _=require(_0x4de9('0x0'));var moment=require('moment');function Action(_0x5c2c80,_0x549786,_0x4341ab){this[_0x4de9('0x1')]=_0x5c2c80||undefined;this['channel']=util[_0x4de9('0x2')](_0x4de9('0x3'),_0x549786['tech'],_0x549786[_0x4de9('0x4')][_0x4de9('0x5')],_0x4341ab[_0x4de9('0x6')]);this[_0x4de9('0x7')]=_0x549786[_0x4de9('0x7')];this[_0x4de9('0x8')]=_0x549786[_0x4de9('0x8')];this['path']=_0x4341ab['path'];this['AttachmentId']=_0x4341ab['AttachmentId'];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 3dfae06..a459702 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 _0x9035=['faxstatus','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','.pdf','application/pdf','then','parse','catch','error','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','trunks','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten'];(function(_0xea9e1c,_0x577088){var _0x3bdb61=function(_0x35e3c1){while(--_0x35e3c1){_0xea9e1c['push'](_0xea9e1c['shift']());}};_0x3bdb61(++_0x577088);}(_0x9035,0xd3));var _0x5903=function(_0x347753,_0x5a6256){_0x347753=_0x347753-0x0;var _0x369526=_0x9035[_0x347753];return _0x369526;};'use strict';var util=require(_0x5903('0x0'));var _=require(_0x5903('0x1'));var BPromise=require(_0x5903('0x2'));var uuid=require(_0x5903('0x3'));var moment=require(_0x5903('0x4'));var path=require(_0x5903('0x5'));var tiff2pdf=require(_0x5903('0x6'));var gs=require(_0x5903('0x7'));var logger=require(_0x5903('0x8'))(_0x5903('0x9'));var ami=require(_0x5903('0xa'));var rpcDb=require(_0x5903('0xb'));var Channel=require(_0x5903('0xc'));var ut=require(_0x5903('0xd'));var Action=require(_0x5903('0xe'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5903('0xf'));var faxMessage=require(_0x5903('0x10'));function Fax(_0x2f1fcd){this[_0x5903('0x11')]={};this[_0x5903('0x12')]=_0x2f1fcd[_0x5903('0x12')];this['trunks']=_0x2f1fcd['trunks'];this[_0x5903('0x13')]={};ami['on']('newchannel',this[_0x5903('0x14')][_0x5903('0x15')](this));ami['on'](_0x5903('0x16'),this[_0x5903('0x17')][_0x5903('0x15')](this));ami['on'](_0x5903('0x18'),this[_0x5903('0x19')][_0x5903('0x15')](this));ami['on']('newexten',this[_0x5903('0x1a')]['bind'](this));ami['on'](_0x5903('0x1b'),this[_0x5903('0x1c')][_0x5903('0x15')](this));ami['on'](_0x5903('0x1d'),this[_0x5903('0x1e')][_0x5903('0x15')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x5903('0x1f'),this[_0x5903('0x20')][_0x5903('0x15')](this));}Fax[_0x5903('0x21')][_0x5903('0x14')]=function(_0x286172){if(_0x286172['context']===_0x5903('0x22')){for(var _0x50092 in this[_0x5903('0x12')]){if(this['faxAccounts'][_0x5903('0x23')](_0x50092)){if(_0x286172['exten']===this[_0x5903('0x12')][_0x50092][_0x5903('0x24')]){this[_0x5903('0x11')][_0x286172[_0x5903('0x25')]]={};this['channels'][_0x286172[_0x5903('0x25')]][_0x5903('0x26')]=_0x286172[_0x5903('0x26')];this['channels'][_0x286172[_0x5903('0x25')]]['id']=this['faxAccounts'][_0x50092]['id'];this[_0x5903('0x11')][_0x286172[_0x5903('0x25')]][_0x5903('0x27')]=this[_0x5903('0x12')][_0x50092][_0x5903('0x27')];logger[_0x5903('0x28')](_0x286172[_0x5903('0x25')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x286172['uniqueid']]){this['channels'][_0x286172[_0x5903('0x25')]]={};this['channels'][_0x286172['uniqueid']][_0x5903('0x26')]=_0x286172[_0x5903('0x26')];logger[_0x5903('0x28')](_0x286172[_0x5903('0x25')],_0x5903('0x29'));}};Fax[_0x5903('0x21')][_0x5903('0x17')]=function(_0x2bf350){if(this[_0x5903('0x11')][_0x2bf350[_0x5903('0x25')]]){for(var _0x42be5f in _0x2bf350[_0x5903('0x2a')]){if(_0x2bf350['variable']['hasOwnProperty'](_0x42be5f)){this['channels'][_0x2bf350[_0x5903('0x25')]][_0x42be5f]=_0x2bf350[_0x5903('0x2b')];}}}};Fax[_0x5903('0x21')][_0x5903('0x19')]=function(_0x175ac9){if(this[_0x5903('0x11')][_0x175ac9[_0x5903('0x25')]]){this[_0x5903('0x11')][_0x175ac9[_0x5903('0x25')]]['channelstate']=_0x175ac9['channelstate'];this[_0x5903('0x11')][_0x175ac9[_0x5903('0x25')]][_0x5903('0x2c')]=_0x175ac9[_0x5903('0x2c')];}};Fax[_0x5903('0x21')][_0x5903('0x1a')]=function(_0x3965a7){if(this[_0x5903('0x11')][_0x3965a7['uniqueid']]){for(var _0x2afdea in _0x3965a7[_0x5903('0x2a')]){if(_0x3965a7[_0x5903('0x2a')][_0x5903('0x23')](_0x2afdea)){this['channels'][_0x3965a7[_0x5903('0x25')]][_0x2afdea]=_0x3965a7['value'];}}}};Fax[_0x5903('0x21')]['syncFaxStatus']=function(_0x5a7801){if(this[_0x5903('0x11')][_0x5a7801[_0x5903('0x25')]]){this[_0x5903('0x11')][_0x5a7801[_0x5903('0x25')]][_0x5903('0x2d')]=_0x5a7801[_0x5903('0x2d')];this[_0x5903('0x11')][_0x5a7801['uniqueid']][_0x5903('0x2e')]=_0x5a7801[_0x5903('0x2e')];this['channels'][_0x5a7801[_0x5903('0x25')]][_0x5903('0x24')]=_0x5a7801[_0x5903('0x24')];this[_0x5903('0x11')][_0x5a7801[_0x5903('0x25')]][_0x5903('0x2f')]=_0x5a7801[_0x5903('0x2f')];logger['info'](_0x5a7801['uniqueid'],_0x5903('0x30'));}};Fax[_0x5903('0x21')]['syncReceiveFax']=function(_0x3ba8e6){var _0x27afb5=this;if(this['channels'][_0x3ba8e6[_0x5903('0x25')]]){var _0x20b7db=this['channels'][_0x3ba8e6['uniqueid']]['id'];this[_0x5903('0x11')][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x31')]=_0x3ba8e6[_0x5903('0x31')];this[_0x5903('0x11')][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x32')]=_0x3ba8e6['pagestransferred'];this['channels'][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x24')]=_0x3ba8e6[_0x5903('0x24')];this[_0x5903('0x11')][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x33')]=_0x3ba8e6[_0x5903('0x33')];this[_0x5903('0x11')][_0x3ba8e6['uniqueid']][_0x5903('0x34')]=_0x3ba8e6[_0x5903('0x34')];this[_0x5903('0x11')][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x2f')]=_0x3ba8e6[_0x5903('0x2f')];this[_0x5903('0x11')][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x35')]=_0x3ba8e6[_0x5903('0x35')];if(this['channels'][_0x3ba8e6[_0x5903('0x25')]][_0x5903('0x32')]>0x0){tiff2pdf(_0x3ba8e6['filename'],_0x5903('0x36'),function(_0x176ab1){logger[_0x5903('0x28')](_0x3ba8e6['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x176ab1[_0x5903('0x37')]);attachment[_0x5903('0x38')]({'name':path['parse'](_0x3ba8e6[_0x5903('0x2f')])[_0x5903('0x27')],'basename':path['parse'](_0x3ba8e6[_0x5903('0x2f')])[_0x5903('0x27')]+_0x5903('0x39'),'type':_0x5903('0x3a')})[_0x5903('0x3b')](function(_0x3fb6f0){faxAccount['notify'](_0x20b7db,{'from':_0x3ba8e6[_0x5903('0x35')],'mapKey':_0x5903('0x9'),'body':path[_0x5903('0x3c')](_0x3ba8e6['filename'])[_0x5903('0x27')]+_0x5903('0x39'),'AttachmentId':_0x3fb6f0['id']})[_0x5903('0x3d')](function(_0x2a0cb8){logger[_0x5903('0x3e')](_0x3ba8e6['uniqueid'],'\x20notify\x20',JSON[_0x5903('0x3f')](_0x2a0cb8));});})[_0x5903('0x3d')](function(_0x54d9ca){logger['error'](_0x3ba8e6[_0x5903('0x25')],_0x5903('0x40'),JSON[_0x5903('0x3f')](_0x54d9ca));});});}logger[_0x5903('0x28')](_0x3ba8e6['uniqueid'],_0x5903('0x40'));}};Fax[_0x5903('0x21')]['syncOriginateResponse']=function(_0x23e423){if(this[_0x5903('0x13')][_0x23e423[_0x5903('0x25')]]){_['merge'](this[_0x5903('0x11')][_0x23e423[_0x5903('0x25')]],_[_0x5903('0x41')](_0x23e423,[_0x5903('0x42'),_0x5903('0x43')]));}};function updateStatus(_0x3bb286){if(_0x3bb286[_0x5903('0x44')]){faxMessage[_0x5903('0x45')](_0x3bb286[_0x5903('0x44')],{'failMessage':_0x5903('0x46')})[_0x5903('0x3b')](function(_0x539982){ut[_0x5903('0x47')](_0x5903('0x48'),_0x539982);})[_0x5903('0x3d')](function(_0x401980){ut['logger'](_0x5903('0x49'),_0x401980);});}else{ut['logger'](_0x5903('0x4a'));}}Fax[_0x5903('0x21')][_0x5903('0x4b')]=function(_0x6c72b1,_0x3fbce0,_0x3f9ba3){var _0x56b65e=this;var _0x4c03f0={};if(_0x3fbce0){_0x4c03f0={'read':_0x3fbce0};}else{_0x4c03f0={'failMessage':_0x3f9ba3};}if(this[_0x5903('0x13')][_0x6c72b1]['AttachmentId']){faxMessage['update'](this[_0x5903('0x13')][_0x6c72b1]['AttachmentId'],_0x4c03f0)[_0x5903('0x3b')](function(_0x1bce3d){ut[_0x5903('0x47')](_0x5903('0x4c'),_0x1bce3d);})[_0x5903('0x3d')](function(_0x578835){ut[_0x5903('0x47')](_0x5903('0x4d'),_0x578835);})[_0x5903('0x4e')](function(){delete _0x56b65e[_0x5903('0x11')][_0x6c72b1];delete _0x56b65e[_0x5903('0x13')][_0x6c72b1];});}else{ut[_0x5903('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x5903('0x11')][_0x6c72b1];delete this[_0x5903('0x13')][_0x6c72b1];}};Fax[_0x5903('0x21')][_0x5903('0x4f')]=function(_0x2028ce){var _0x5711f9=this;if(this[_0x5903('0x11')][_0x2028ce[_0x5903('0x25')]]){if(this[_0x5903('0x13')][_0x2028ce[_0x5903('0x25')]]){this[_0x5903('0x11')][_0x2028ce['uniqueid']]['id']=this[_0x5903('0x13')][_0x2028ce['uniqueid']]['id'];this[_0x5903('0x11')][_0x2028ce[_0x5903('0x25')]][_0x5903('0x27')]=this[_0x5903('0x13')][_0x2028ce[_0x5903('0x25')]][_0x5903('0x27')];}logger[_0x5903('0x28')](_0x2028ce[_0x5903('0x25')],this['actions'][_0x2028ce[_0x5903('0x25')]]?_0x5903('0x50'):_0x5903('0x51'),JSON[_0x5903('0x3f')](this[_0x5903('0x11')][_0x2028ce[_0x5903('0x25')]]));if(this[_0x5903('0x13')][_0x2028ce[_0x5903('0x25')]]){if(this[_0x5903('0x11')][_0x2028ce['uniqueid']]['faxpages']>0x0&&this[_0x5903('0x11')][_0x2028ce['uniqueid']][_0x5903('0x1b')]==='SUCCESS'){this[_0x5903('0x4b')](_0x2028ce['uniqueid'],!![]);}else{this[_0x5903('0x4b')](_0x2028ce[_0x5903('0x25')],![],this[_0x5903('0x11')][_0x2028ce[_0x5903('0x25')]][_0x5903('0x52')]?'SENDING\x20FAILED:\x20'+this[_0x5903('0x11')][_0x2028ce[_0x5903('0x25')]][_0x5903('0x52')]:_0x5903('0x53'));}}}};Fax[_0x5903('0x21')][_0x5903('0x54')]=function(_0x2a45e3){var _0x5d29fc=this;return new BPromise(function(_0x531094,_0x356e28){_0x5d29fc[_0x5903('0x55')](_0x2a45e3,_0x5d29fc[_0x5903('0x12')][_0x2a45e3['FaxAccountId']])[_0x5903('0x3b')](function(_0x400ae3){ut['logger'](_0x5903('0x56'),_0x400ae3);_0x531094(ut[_0x5903('0x37')](_0x5903('0x57')));})[_0x5903('0x3d')](function(_0x255ae5){ut[_0x5903('0x47')](_0x5903('0x58'),_0x255ae5);updateStatus(_0x2a45e3);_0x356e28(ut[_0x5903('0x37')](_0x5903('0x59')));});});};Fax[_0x5903('0x21')][_0x5903('0x5a')]=function(_0x4e6b86){var _0x516c2f=this;return new BPromise(function(_0x8febf,_0x5cae17){var _0x4be325=_0x516c2f['checkTrunk'](_0x516c2f['faxAccounts'][_0x4e6b86[_0x5903('0x5b')]][_0x5903('0x5c')],_0x4e6b86);if(_0x4be325[_0x5903('0x5d')]){_0x8febf(ut['message'](_0x5903('0x5e')));}else{_0x5cae17(ut['message'](_0x4be325[_0x5903('0x37')]));}});};function originate(_0x3bc7c8,_0x19c227,_0x46b000){return new BPromise(function(_0x5de433,_0x28d033){if(_0x46b000){var _0x118efa=util[_0x5903('0x5f')](_0x5903('0x60'),path[_0x5903('0x3c')](_0x3bc7c8[_0x5903('0x5')])[_0x5903('0x27')],_0x3bc7c8[_0x5903('0x5')]);gs['execute'](_0x118efa)[_0x5903('0x3b')](function(){_0x3bc7c8[_0x5903('0x5')]=util[_0x5903('0x5f')](_0x5903('0x61'),path[_0x5903('0x3c')](_0x3bc7c8[_0x5903('0x5')])[_0x5903('0x62')],path[_0x5903('0x3c')](_0x3bc7c8[_0x5903('0x5')])[_0x5903('0x27')]);_0x19c227[_0x5903('0x63')]=_0x3bc7c8[_0x5903('0x5')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x5903('0x64')](ut[_0x5903('0x65')](_0x3bc7c8,_0x19c227))[_0x5903('0x3b')](function(_0x323173){_0x5de433(_0x323173);})['catch'](function(_0x25563b){_0x28d033(_0x25563b);});})[_0x5903('0x3d')](function(_0x917d2e){_0x28d033(_0x917d2e);});}else{ami[_0x5903('0x64')](ut[_0x5903('0x65')](_0x3bc7c8,_0x19c227))[_0x5903('0x3b')](function(_0x143f12){_0x5de433(_0x143f12);})['catch'](function(_0x25e690){_0x28d033(_0x25e690);});}});}Fax[_0x5903('0x21')]['execOriginate']=function(_0x3a5992,_0x5b7ead){var _0x5a6a97=this;return new BPromise(function(_0x30b1d8,_0x4a4802){var _0x5854df=uuid['v4']();var _0x517608=ut[_0x5903('0x66')](_0x3a5992,_0x5b7ead);_0x5a6a97[_0x5903('0x13')][_0x5854df]=new Action(_0x5854df,_0x5b7ead,_0x3a5992);var _0x5eef29=_0x5a6a97[_0x5903('0x13')][_0x5854df];if(path[_0x5903('0x3c')](_0x3a5992[_0x5903('0x5')])[_0x5903('0x67')]===_0x5903('0x39')){originate(_0x5eef29,_0x517608,!![])[_0x5903('0x3b')](function(_0x2ada0b){_0x30b1d8(_0x2ada0b);})[_0x5903('0x3d')](function(_0x335984){_0x4a4802(_0x335984);});}else{originate(_0x5eef29,_0x517608,![])[_0x5903('0x3b')](function(_0x14e236){_0x30b1d8(_0x14e236);})[_0x5903('0x3d')](function(_0x146131){_0x4a4802(_0x146131);});}});};Fax[_0x5903('0x21')]['isTrunkReachable']=function(_0x5bb1fd){return!_[_0x5903('0x68')](_0x5bb1fd)&&!_['isNil'](_0x5bb1fd[_0x5903('0x27')])&&!_[_0x5903('0x68')](_0x5bb1fd['active'])&&_0x5bb1fd[_0x5903('0x69')]&&!_[_0x5903('0x68')](this[_0x5903('0x6a')][util[_0x5903('0x5f')](_0x5903('0x6b'),_0x5bb1fd[_0x5903('0x27')])])&&!_['isNil'](this[_0x5903('0x6a')][util[_0x5903('0x5f')]('SIP/%s',_0x5bb1fd['name'])][_0x5903('0x2e')])&&(this[_0x5903('0x6a')][util['format'](_0x5903('0x6b'),_0x5bb1fd[_0x5903('0x27')])]['status']===_0x5903('0x6c')||this['trunks'][util[_0x5903('0x5f')](_0x5903('0x6b'),_0x5bb1fd[_0x5903('0x27')])][_0x5903('0x2e')]===_0x5903('0x6d'));};Fax[_0x5903('0x21')][_0x5903('0x6e')]=function(_0x28c0bd,_0x1fc5b4){if(!this['isTrunkReachable'](_0x28c0bd)){ut[_0x5903('0x47')](_0x5903('0x6f'),_[_0x5903('0x68')](_0x28c0bd)?'':_0x28c0bd['name']+_0x5903('0x70'));return{'isValid':![],'message':_0x5903('0x71')};}if(_[_0x5903('0x68')](_0x1fc5b4[_0x5903('0x9')])){ut[_0x5903('0x47')](_0x5903('0x72'),JSON[_0x5903('0x3f')](_0x1fc5b4));return{'isValid':![],'message':_0x5903('0x73')};}if(_[_0x5903('0x68')](_0x1fc5b4[_0x5903('0x5')])){ut[_0x5903('0x47')](_0x5903('0x74'),JSON[_0x5903('0x3f')](_0x1fc5b4));return{'isValid':![],'message':_0x5903('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x5903('0x76')]=Fax; \ No newline at end of file +var _0x41fb=['FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','varset','bind','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','syncOriginateResponse','merge','response','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x41fb,0x1e3));var _0xb41f=function(_0x137be9,_0x2eaaca){_0x137be9=_0x137be9-0x0;var _0x4476a3=_0x41fb[_0x137be9];return _0x4476a3;};'use strict';var util=require(_0xb41f('0x0'));var _=require(_0xb41f('0x1'));var BPromise=require(_0xb41f('0x2'));var uuid=require(_0xb41f('0x3'));var moment=require(_0xb41f('0x4'));var path=require(_0xb41f('0x5'));var tiff2pdf=require(_0xb41f('0x6'));var gs=require(_0xb41f('0x7'));var logger=require(_0xb41f('0x8'))(_0xb41f('0x9'));var ami=require('../ami');var rpcDb=require(_0xb41f('0xa'));var Channel=require(_0xb41f('0xb'));var ut=require(_0xb41f('0xc'));var Action=require(_0xb41f('0xd'));var faxAccount=require(_0xb41f('0xe'));var attachment=require(_0xb41f('0xf'));var faxMessage=require(_0xb41f('0x10'));function Fax(_0x1c3ce9){this['channels']={};this[_0xb41f('0x11')]=_0x1c3ce9[_0xb41f('0x11')];this[_0xb41f('0x12')]=_0x1c3ce9[_0xb41f('0x12')];this[_0xb41f('0x13')]={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0xb41f('0x14'),this['syncVarSet'][_0xb41f('0x15')](this));ami['on']('newstate',this[_0xb41f('0x16')][_0xb41f('0x15')](this));ami['on'](_0xb41f('0x17'),this['syncNewExten'][_0xb41f('0x15')](this));ami['on'](_0xb41f('0x18'),this[_0xb41f('0x19')][_0xb41f('0x15')](this));ami['on'](_0xb41f('0x1a'),this[_0xb41f('0x1b')][_0xb41f('0x15')](this));ami['on']('hangup',this[_0xb41f('0x1c')][_0xb41f('0x15')](this));ami['on'](_0xb41f('0x1d'),this['syncOriginateResponse']['bind'](this));}Fax['prototype'][_0xb41f('0x1e')]=function(_0x1e6cc2){if(_0x1e6cc2[_0xb41f('0x1f')]==='from-voip-provider'){for(var _0x24338a in this['faxAccounts']){if(this[_0xb41f('0x11')][_0xb41f('0x20')](_0x24338a)){if(_0x1e6cc2[_0xb41f('0x21')]===this['faxAccounts'][_0x24338a]['localstationid']){this['channels'][_0x1e6cc2[_0xb41f('0x22')]]={};this[_0xb41f('0x23')][_0x1e6cc2[_0xb41f('0x22')]]['channel']=_0x1e6cc2[_0xb41f('0x24')];this[_0xb41f('0x23')][_0x1e6cc2['uniqueid']]['id']=this[_0xb41f('0x11')][_0x24338a]['id'];this[_0xb41f('0x23')][_0x1e6cc2['uniqueid']][_0xb41f('0x25')]=this[_0xb41f('0x11')][_0x24338a][_0xb41f('0x25')];logger[_0xb41f('0x26')](_0x1e6cc2[_0xb41f('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0xb41f('0x13')][_0x1e6cc2['uniqueid']]){this['channels'][_0x1e6cc2[_0xb41f('0x22')]]={};this[_0xb41f('0x23')][_0x1e6cc2['uniqueid']][_0xb41f('0x24')]=_0x1e6cc2[_0xb41f('0x24')];logger['info'](_0x1e6cc2[_0xb41f('0x22')],_0xb41f('0x27'));}};Fax[_0xb41f('0x28')][_0xb41f('0x29')]=function(_0x4aedeb){if(this[_0xb41f('0x23')][_0x4aedeb[_0xb41f('0x22')]]){for(var _0x432293 in _0x4aedeb[_0xb41f('0x2a')]){if(_0x4aedeb[_0xb41f('0x2a')][_0xb41f('0x20')](_0x432293)){this['channels'][_0x4aedeb[_0xb41f('0x22')]][_0x432293]=_0x4aedeb[_0xb41f('0x2b')];}}}};Fax[_0xb41f('0x28')][_0xb41f('0x16')]=function(_0x4637e9){if(this['channels'][_0x4637e9[_0xb41f('0x22')]]){this[_0xb41f('0x23')][_0x4637e9[_0xb41f('0x22')]][_0xb41f('0x2c')]=_0x4637e9[_0xb41f('0x2c')];this[_0xb41f('0x23')][_0x4637e9['uniqueid']]['channelstatedesc']=_0x4637e9[_0xb41f('0x2d')];}};Fax[_0xb41f('0x28')]['syncNewExten']=function(_0x4b72ea){if(this[_0xb41f('0x23')][_0x4b72ea['uniqueid']]){for(var _0x453d17 in _0x4b72ea[_0xb41f('0x2a')]){if(_0x4b72ea[_0xb41f('0x2a')][_0xb41f('0x20')](_0x453d17)){this[_0xb41f('0x23')][_0x4b72ea[_0xb41f('0x22')]][_0x453d17]=_0x4b72ea[_0xb41f('0x2b')];}}}};Fax[_0xb41f('0x28')][_0xb41f('0x19')]=function(_0x11025e){if(this[_0xb41f('0x23')][_0x11025e[_0xb41f('0x22')]]){this[_0xb41f('0x23')][_0x11025e[_0xb41f('0x22')]][_0xb41f('0x2e')]=_0x11025e[_0xb41f('0x2e')];this[_0xb41f('0x23')][_0x11025e[_0xb41f('0x22')]][_0xb41f('0x2f')]=_0x11025e['status'];this[_0xb41f('0x23')][_0x11025e[_0xb41f('0x22')]][_0xb41f('0x30')]=_0x11025e[_0xb41f('0x30')];this[_0xb41f('0x23')][_0x11025e[_0xb41f('0x22')]][_0xb41f('0x31')]=_0x11025e[_0xb41f('0x31')];logger['info'](_0x11025e['uniqueid'],_0xb41f('0x32'));}};Fax['prototype'][_0xb41f('0x1b')]=function(_0x221b47){var _0x2a666e=this;if(this['channels'][_0x221b47[_0xb41f('0x22')]]){var _0x2e7910=this['channels'][_0x221b47[_0xb41f('0x22')]]['id'];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]][_0xb41f('0x33')]=_0x221b47['remotestationid'];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]][_0xb41f('0x34')]=_0x221b47[_0xb41f('0x34')];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]][_0xb41f('0x30')]=_0x221b47[_0xb41f('0x30')];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]][_0xb41f('0x35')]=_0x221b47[_0xb41f('0x35')];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]]['transferrate']=_0x221b47['transferrate'];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]][_0xb41f('0x31')]=_0x221b47[_0xb41f('0x31')];this[_0xb41f('0x23')][_0x221b47[_0xb41f('0x22')]][_0xb41f('0x36')]=_0x221b47[_0xb41f('0x36')];if(this['channels'][_0x221b47['uniqueid']][_0xb41f('0x34')]>0x0){tiff2pdf(_0x221b47[_0xb41f('0x31')],_0xb41f('0x37'),function(_0x5b5cad){logger[_0xb41f('0x26')](_0x221b47['uniqueid'],_0xb41f('0x38'),_0x5b5cad[_0xb41f('0x39')]);attachment[_0xb41f('0x3a')]({'name':path['parse'](_0x221b47[_0xb41f('0x31')])[_0xb41f('0x25')],'basename':path[_0xb41f('0x3b')](_0x221b47[_0xb41f('0x31')])[_0xb41f('0x25')]+_0xb41f('0x3c'),'type':_0xb41f('0x3d')})[_0xb41f('0x3e')](function(_0x562473){faxAccount[_0xb41f('0x3f')](_0x2e7910,{'from':_0x221b47[_0xb41f('0x36')],'mapKey':'fax','body':path[_0xb41f('0x3b')](_0x221b47['filename'])[_0xb41f('0x25')]+'.pdf','AttachmentId':_0x562473['id']})[_0xb41f('0x40')](function(_0x56ebeb){logger['error'](_0x221b47['uniqueid'],_0xb41f('0x41'),JSON[_0xb41f('0x42')](_0x56ebeb));});})['catch'](function(_0x504a3f){logger['error'](_0x221b47[_0xb41f('0x22')],'\x20receiveFax\x20',JSON[_0xb41f('0x42')](_0x504a3f));});});}logger[_0xb41f('0x26')](_0x221b47['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0xb41f('0x43')]=function(_0x4cf64f){if(this['actions'][_0x4cf64f[_0xb41f('0x22')]]){_[_0xb41f('0x44')](this['channels'][_0x4cf64f[_0xb41f('0x22')]],_['pick'](_0x4cf64f,[_0xb41f('0x45'),'reason']));}};function updateStatus(_0x20116f){if(_0x20116f[_0xb41f('0x46')]){faxMessage['update'](_0x20116f['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xb41f('0x3e')](function(_0x1c4cad){ut[_0xb41f('0x47')](_0xb41f('0x48'),_0x1c4cad);})[_0xb41f('0x40')](function(_0x338f92){ut[_0xb41f('0x47')](_0xb41f('0x49'),_0x338f92);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype']['updateStatus']=function(_0x4b5283,_0x5b6160,_0x165abb){var _0x4d1d9e=this;var _0x157846={};if(_0x5b6160){_0x157846={'read':_0x5b6160};}else{_0x157846={'failMessage':_0x165abb};}if(this[_0xb41f('0x13')][_0x4b5283]['AttachmentId']){faxMessage[_0xb41f('0x4a')](this[_0xb41f('0x13')][_0x4b5283][_0xb41f('0x46')],_0x157846)[_0xb41f('0x3e')](function(_0x2d88ee){ut[_0xb41f('0x47')](_0xb41f('0x4b'),_0x2d88ee);})[_0xb41f('0x40')](function(_0x370c72){ut[_0xb41f('0x47')](_0xb41f('0x4c'),_0x370c72);})['finally'](function(){delete _0x4d1d9e[_0xb41f('0x23')][_0x4b5283];delete _0x4d1d9e['actions'][_0x4b5283];});}else{ut[_0xb41f('0x47')](_0xb41f('0x4d'));delete this['channels'][_0x4b5283];delete this[_0xb41f('0x13')][_0x4b5283];}};Fax[_0xb41f('0x28')][_0xb41f('0x1c')]=function(_0x2f07ac){var _0x55c493=this;if(this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]]){if(this[_0xb41f('0x13')][_0x2f07ac[_0xb41f('0x22')]]){this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]]['id']=this[_0xb41f('0x13')][_0x2f07ac[_0xb41f('0x22')]]['id'];this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]][_0xb41f('0x25')]=this[_0xb41f('0x13')][_0x2f07ac['uniqueid']][_0xb41f('0x25')];}logger[_0xb41f('0x26')](_0x2f07ac[_0xb41f('0x22')],this['actions'][_0x2f07ac[_0xb41f('0x22')]]?_0xb41f('0x4e'):_0xb41f('0x4f'),JSON[_0xb41f('0x42')](this['channels'][_0x2f07ac[_0xb41f('0x22')]]));if(this['actions'][_0x2f07ac[_0xb41f('0x22')]]){if(this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]][_0xb41f('0x50')]>0x0&&this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]]['faxstatus']==='SUCCESS'){this[_0xb41f('0x51')](_0x2f07ac['uniqueid'],!![]);}else{this[_0xb41f('0x51')](_0x2f07ac[_0xb41f('0x22')],![],this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]][_0xb41f('0x52')]?_0xb41f('0x53')+this[_0xb41f('0x23')][_0x2f07ac[_0xb41f('0x22')]][_0xb41f('0x52')]:_0xb41f('0x54'));}}}};Fax[_0xb41f('0x28')][_0xb41f('0x55')]=function(_0x1437f8){var _0x4e834b=this;return new BPromise(function(_0x7b0fd6,_0x2c37a1){_0x4e834b[_0xb41f('0x56')](_0x1437f8,_0x4e834b[_0xb41f('0x11')][_0x1437f8[_0xb41f('0x57')]])['then'](function(_0x73d8f7){ut['logger']('[Fax][execOriginate][success]',_0x73d8f7);_0x7b0fd6(ut['message'](_0xb41f('0x58')));})['catch'](function(_0x295f6f){ut[_0xb41f('0x47')](_0xb41f('0x59'),_0x295f6f);updateStatus(_0x1437f8);_0x2c37a1(ut[_0xb41f('0x39')]('Fax\x20failed'));});});};Fax[_0xb41f('0x28')][_0xb41f('0x5a')]=function(_0x220b84){var _0xa976c8=this;return new BPromise(function(_0x1a2172,_0x2d01db){var _0x54cfc7=_0xa976c8['checkTrunk'](_0xa976c8['faxAccounts'][_0x220b84[_0xb41f('0x57')]][_0xb41f('0x5b')],_0x220b84);if(_0x54cfc7[_0xb41f('0x5c')]){_0x1a2172(ut['message']('Trunk\x20Reachable'));}else{_0x2d01db(ut[_0xb41f('0x39')](_0x54cfc7['message']));}});};function originate(_0x56810c,_0xbb65ae,_0x4c54cd){return new BPromise(function(_0x348a70,_0x1a391f){if(_0x4c54cd){var _0x7857d4=util['format'](_0xb41f('0x5d'),path[_0xb41f('0x3b')](_0x56810c[_0xb41f('0x5')])[_0xb41f('0x25')],_0x56810c[_0xb41f('0x5')]);gs['execute'](_0x7857d4)['then'](function(){_0x56810c[_0xb41f('0x5')]=util[_0xb41f('0x5e')](_0xb41f('0x5f'),path[_0xb41f('0x3b')](_0x56810c[_0xb41f('0x5')])['dir'],path[_0xb41f('0x3b')](_0x56810c[_0xb41f('0x5')])[_0xb41f('0x25')]);_0xbb65ae[_0xb41f('0x60')]=_0x56810c[_0xb41f('0x5')];ut[_0xb41f('0x47')](_0xb41f('0x61'),'');ami[_0xb41f('0x62')](ut[_0xb41f('0x63')](_0x56810c,_0xbb65ae))[_0xb41f('0x3e')](function(_0x4bb64f){_0x348a70(_0x4bb64f);})['catch'](function(_0x3dd01d){_0x1a391f(_0x3dd01d);});})['catch'](function(_0x53f0dd){_0x1a391f(_0x53f0dd);});}else{ami['Action'](ut[_0xb41f('0x63')](_0x56810c,_0xbb65ae))[_0xb41f('0x3e')](function(_0x27f1ee){_0x348a70(_0x27f1ee);})['catch'](function(_0x58199d){_0x1a391f(_0x58199d);});}});}Fax[_0xb41f('0x28')]['execOriginate']=function(_0x4f668d,_0x157eb6){var _0x2b8977=this;return new BPromise(function(_0x5bf701,_0x22baf3){var _0x22b7e4=uuid['v4']();var _0x335062=ut['addVariables'](_0x4f668d,_0x157eb6);_0x2b8977[_0xb41f('0x13')][_0x22b7e4]=new Action(_0x22b7e4,_0x157eb6,_0x4f668d);var _0x55fb4c=_0x2b8977[_0xb41f('0x13')][_0x22b7e4];if(path[_0xb41f('0x3b')](_0x4f668d[_0xb41f('0x5')])[_0xb41f('0x64')]===_0xb41f('0x3c')){originate(_0x55fb4c,_0x335062,!![])[_0xb41f('0x3e')](function(_0x3c6da9){_0x5bf701(_0x3c6da9);})[_0xb41f('0x40')](function(_0x5c4fb2){_0x22baf3(_0x5c4fb2);});}else{originate(_0x55fb4c,_0x335062,![])[_0xb41f('0x3e')](function(_0x1b4915){_0x5bf701(_0x1b4915);})[_0xb41f('0x40')](function(_0x4e6ba8){_0x22baf3(_0x4e6ba8);});}});};Fax[_0xb41f('0x28')][_0xb41f('0x65')]=function(_0x28fbc7){return!_[_0xb41f('0x66')](_0x28fbc7)&&!_[_0xb41f('0x66')](_0x28fbc7[_0xb41f('0x25')])&&!_[_0xb41f('0x66')](_0x28fbc7[_0xb41f('0x67')])&&_0x28fbc7[_0xb41f('0x67')]&&!_['isNil'](this[_0xb41f('0x12')][util[_0xb41f('0x5e')]('SIP/%s',_0x28fbc7[_0xb41f('0x25')])])&&!_[_0xb41f('0x66')](this[_0xb41f('0x12')][util[_0xb41f('0x5e')](_0xb41f('0x68'),_0x28fbc7[_0xb41f('0x25')])]['status'])&&(this[_0xb41f('0x12')][util[_0xb41f('0x5e')](_0xb41f('0x68'),_0x28fbc7[_0xb41f('0x25')])][_0xb41f('0x2f')]===_0xb41f('0x69')||this[_0xb41f('0x12')][util[_0xb41f('0x5e')](_0xb41f('0x68'),_0x28fbc7[_0xb41f('0x25')])]['status']===_0xb41f('0x6a'));};Fax[_0xb41f('0x28')][_0xb41f('0x6b')]=function(_0xa88768,_0x387545){if(!this[_0xb41f('0x65')](_0xa88768)){ut[_0xb41f('0x47')](_0xb41f('0x6c'),_[_0xb41f('0x66')](_0xa88768)?'':_0xa88768['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xb41f('0x66')](_0x387545['fax'])){ut[_0xb41f('0x47')](_0xb41f('0x6d'),JSON[_0xb41f('0x42')](_0x387545));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xb41f('0x66')](_0x387545[_0xb41f('0x5')])){ut[_0xb41f('0x47')](_0xb41f('0x6e'),JSON['stringify'](_0x387545));return{'isValid':![],'message':_0xb41f('0x6f')};}return{'isValid':!![],'message':_0xb41f('0x70')};};module[_0xb41f('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8e2316b..b21bdfe 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 _0x0429=['error','inspect','notify','[Notify]\x20','util','../../../config/logger'];(function(_0x1ff57f,_0xc03401){var _0x1c4899=function(_0xa07398){while(--_0xa07398){_0x1ff57f['push'](_0x1ff57f['shift']());}};_0x1c4899(++_0xc03401);}(_0x0429,0x18a));var _0x9042=function(_0x2929ac,_0x56a221){_0x2929ac=_0x2929ac-0x0;var _0x4e1633=_0x0429[_0x2929ac];return _0x4e1633;};'use strict';var util=require(_0x9042('0x0'));var BPromise=require('bluebird');var logger=require(_0x9042('0x1'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x41533d){return function(_0x5d1979){logger[_0x9042('0x2')](_0x41533d,util[_0x9042('0x3')](_0x5d1979,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x42e126,_0x5b97f5){return BPromise['resolve']()['then'](faxAccount[_0x9042('0x4')](_0x42e126,_0x5b97f5))['catch'](loggerCatch(_0x9042('0x5')));}; \ No newline at end of file +var _0x65f5=['catch','[Notify]\x20','util','../../../config/logger','lodash','error','inspect','resolve','notify'];(function(_0x3dfbe6,_0x503f43){var _0x556cbc=function(_0x4cf253){while(--_0x4cf253){_0x3dfbe6['push'](_0x3dfbe6['shift']());}};_0x556cbc(++_0x503f43);}(_0x65f5,0x1a9));var _0x565f=function(_0x3da0be,_0x1ad052){_0x3da0be=_0x3da0be-0x0;var _0x23be20=_0x65f5[_0x3da0be];return _0x23be20;};'use strict';var util=require(_0x565f('0x0'));var BPromise=require('bluebird');var logger=require(_0x565f('0x1'))('preview');var _=require(_0x565f('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x422336){return function(_0x404d31){logger[_0x565f('0x3')](_0x422336,util[_0x565f('0x4')](_0x404d31,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4bc7c3,_0x53e207){return BPromise[_0x565f('0x5')]()['then'](faxAccount[_0x565f('0x6')](_0x4bc7c3,_0x53e207))[_0x565f('0x7')](loggerCatch(_0x565f('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 051cb83..7d562a5 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 _0xb299=['util','../../../../config/logger','fax','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x1528d7,_0x50578b){var _0x3173d5=function(_0x4ce466){while(--_0x4ce466){_0x1528d7['push'](_0x1528d7['shift']());}};_0x3173d5(++_0x50578b);}(_0xb299,0x156));var _0x9b29=function(_0x32cf2f,_0x5975f3){_0x32cf2f=_0x32cf2f-0x0;var _0xbab46a=_0xb299[_0x32cf2f];return _0xbab46a;};'use strict';var util=require(_0x9b29('0x0'));var logger=require(_0x9b29('0x1'))(_0x9b29('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0x9b29('0x3')];exports[_0x9b29('0x4')]=function(_0x56b8ef){return new BPromise(function(_0x4835cf,_0x44a710){exec(_0x56b8ef,function(_0xb6f3a8,_0x22653b,_0x23cd79){logger[_0x9b29('0x5')](_0x9b29('0x6'),_0x22653b);if(_0xb6f3a8){logger['info'](_0x9b29('0x6'),_0x9b29('0x7'),util[_0x9b29('0x8')](_0xb6f3a8,{'showHidden':![],'depth':null}),_0x22653b,_0x23cd79);_0x44a710(_0xb6f3a8);}_0x4835cf(_0x22653b);});});}; \ No newline at end of file +var _0x65e1=['exec','execute','info','Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x65e1,0x9d));var _0x165e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x65e1[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x165e('0x0'));var logger=require(_0x165e('0x1'))(_0x165e('0x2'));var BPromise=require(_0x165e('0x3'));var exec=require(_0x165e('0x4'))[_0x165e('0x5')];exports[_0x165e('0x6')]=function(_0x240902){return new BPromise(function(_0x2e5e05,_0x39749e){exec(_0x240902,function(_0x2cb98a,_0x24ccc3,_0x1d2005){logger[_0x165e('0x7')](_0x165e('0x8'),_0x24ccc3);if(_0x2cb98a){logger[_0x165e('0x7')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x2cb98a,{'showHidden':![],'depth':null}),_0x24ccc3,_0x1d2005);_0x39749e(_0x2cb98a);}_0x2e5e05(_0x24ccc3);});});}; \ 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 985dd67..6900f76 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 _0xa37e=['originate','channel','from-sip','localstationid','moment','../../../../config/logger','fax','message','logger','info','inspect','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','path','variablesAction','uniqueid'];(function(_0xdeffe6,_0x198150){var _0x5baeb=function(_0x51e1c5){while(--_0x51e1c5){_0xdeffe6['push'](_0xdeffe6['shift']());}};_0x5baeb(++_0x198150);}(_0xa37e,0x97));var _0xea37=function(_0x776ff4,_0x9efe35){_0x776ff4=_0x776ff4-0x0;var _0x1ebd3b=_0xa37e[_0x776ff4];return _0x1ebd3b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xea37('0x0'));var logger=require(_0xea37('0x1'))(_0xea37('0x2'));exports[_0xea37('0x3')]=function(_0x5430aa){return{'message':_0x5430aa};};exports[_0xea37('0x4')]=function(_0x537c5a,_0x360ed5){logger[_0xea37('0x5')](_0x537c5a,util[_0xea37('0x6')](_0x360ed5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x57135b,_0x36c489){var _0x4a9e08={'XMF-ECM':_0x36c489['ecm'],'XMF-HEADERINFO':_0x36c489[_0xea37('0x7')],'XMF-MINRATE':_0x36c489[_0xea37('0x8')],'XMF-MAXRATE':_0x36c489[_0xea37('0x9')],'XMF-MODEM':util[_0xea37('0xa')]('\x22%s\x22',_0x36c489[_0xea37('0xb')]),'XMF-GATEWAY':_0x36c489[_0xea37('0xc')],'XMF-FAXDETECT':_0x36c489[_0xea37('0xd')],'XMF-T38TIMEOUT':_0x36c489['t38timeout'],'XMF-LOCALSTATIONID':_0x36c489['localstationid'],'XMF-PATH':_0x57135b[_0xea37('0xe')]};return _0x4a9e08;};exports[_0xea37('0xf')]=function(_0x3cd18b,_0x5c0da5){return{'actionid':_0x3cd18b[_0xea37('0x10')],'action':_0xea37('0x11'),'channel':_0x3cd18b[_0xea37('0x12')],'Exten':'xcally-motion-fax','Context':_0xea37('0x13'),'Priority':'1','callerid':util[_0xea37('0xa')]('\x22%s\x22\x20<%s>',_0x3cd18b[_0xea37('0x7')]?_0x3cd18b['headerinfo']:'',_0x3cd18b[_0xea37('0x14')]),'variable':_0x5c0da5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3cd18b['uniqueid']};}; \ No newline at end of file +var _0xb7c8=['logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','uniqueid','lodash','moment','../../../../config/logger','fax','message'];(function(_0x54b5ec,_0x4dc55a){var _0x289ffe=function(_0x3f3c91){while(--_0x3f3c91){_0x54b5ec['push'](_0x54b5ec['shift']());}};_0x289ffe(++_0x4dc55a);}(_0xb7c8,0x119));var _0x8b7c=function(_0x318c47,_0x47899a){_0x318c47=_0x318c47-0x0;var _0x11d945=_0xb7c8[_0x318c47];return _0x11d945;};'use strict';var util=require('util');var _=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var logger=require(_0x8b7c('0x2'))(_0x8b7c('0x3'));exports[_0x8b7c('0x4')]=function(_0x31ad24){return{'message':_0x31ad24};};exports[_0x8b7c('0x5')]=function(_0x50113e,_0x38672b){logger[_0x8b7c('0x6')](_0x50113e,util[_0x8b7c('0x7')](_0x38672b,{'showHidden':![],'depth':null}));};exports[_0x8b7c('0x8')]=function(_0x107428,_0x12665c){var _0x7a3850={'XMF-ECM':_0x12665c[_0x8b7c('0x9')],'XMF-HEADERINFO':_0x12665c[_0x8b7c('0xa')],'XMF-MINRATE':_0x12665c[_0x8b7c('0xb')],'XMF-MAXRATE':_0x12665c[_0x8b7c('0xc')],'XMF-MODEM':util[_0x8b7c('0xd')]('\x22%s\x22',_0x12665c[_0x8b7c('0xe')]),'XMF-GATEWAY':_0x12665c['gateway'],'XMF-FAXDETECT':_0x12665c[_0x8b7c('0xf')],'XMF-T38TIMEOUT':_0x12665c[_0x8b7c('0x10')],'XMF-LOCALSTATIONID':_0x12665c['localstationid'],'XMF-PATH':_0x107428[_0x8b7c('0x11')]};return _0x7a3850;};exports[_0x8b7c('0x12')]=function(_0x3594b1,_0x586826){return{'actionid':_0x3594b1['uniqueid'],'action':_0x8b7c('0x13'),'channel':_0x3594b1[_0x8b7c('0x14')],'Exten':_0x8b7c('0x15'),'Context':_0x8b7c('0x16'),'Priority':'1','callerid':util[_0x8b7c('0xd')](_0x8b7c('0x17'),_0x3594b1[_0x8b7c('0xa')]?_0x3594b1['headerinfo']:'',_0x3594b1[_0x8b7c('0x18')]),'variable':_0x586826,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3594b1[_0x8b7c('0x19')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b262d03..c4a9a13 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 _0x3f8c=['initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x190));var _0xc3f8=function(_0x58ad3b,_0x42e617){_0x58ad3b=_0x58ad3b-0x0;var _0x21656c=_0x3f8c[_0x58ad3b];return _0x21656c;};'use strict';var BPromise=require(_0xc3f8('0x0'));var util=require(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var server=require(_0xc3f8('0x3'));var Realtime=require(_0xc3f8('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xc3f8('0x5'));var Preview=require(_0xc3f8('0x6'));var Fax=require(_0xc3f8('0x7'));var user=require(_0xc3f8('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xc3f8('0x9'));var voiceCallReport=require(_0xc3f8('0xa'));var trunk=require(_0xc3f8('0xb'));var trigger=require(_0xc3f8('0xc'));var template=require(_0xc3f8('0xd'));var cmHopperHistory=require(_0xc3f8('0xe'));var campaign=require(_0xc3f8('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xc3f8('0x10'));var salesforce=require(_0xc3f8('0x11'));var sugarcrm=require(_0xc3f8('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xc3f8('0x13'));var vtiger=require(_0xc3f8('0x14'));var freshsales=require(_0xc3f8('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc3f8('0x16')](_0xc3f8('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc3f8('0x16')](_0xc3f8('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc3f8('0x18')]()[_0xc3f8('0x19')](user['getAgents']())[_0xc3f8('0x19')](realtime[_0xc3f8('0x1a')]())['then'](user[_0xc3f8('0x1b')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x1c')]())[_0xc3f8('0x19')](trunk[_0xc3f8('0x1d')]())['then'](realtime[_0xc3f8('0x1e')]())[_0xc3f8('0x19')](voiceQueue[_0xc3f8('0x1f')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x20')]())[_0xc3f8('0x19')](trigger[_0xc3f8('0x21')]())['then'](realtime[_0xc3f8('0x22')]())['then'](template[_0xc3f8('0x23')]())['then'](realtime[_0xc3f8('0x24')]())[_0xc3f8('0x19')](zendesk[_0xc3f8('0x25')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x26')]())[_0xc3f8('0x19')](salesforce[_0xc3f8('0x27')]())['then'](realtime['initSalesforceAccounts']())[_0xc3f8('0x19')](sugarcrm[_0xc3f8('0x28')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x29')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xc3f8('0x19')](realtime[_0xc3f8('0x2a')]())[_0xc3f8('0x19')](desk[_0xc3f8('0x2b')]())['then'](realtime[_0xc3f8('0x2c')]())[_0xc3f8('0x19')](zoho['getZohoAccounts']())[_0xc3f8('0x19')](realtime['initZohoAccounts']())[_0xc3f8('0x19')](vtiger['getVtigerAccounts']())[_0xc3f8('0x19')](realtime['initVtigerAccounts']())[_0xc3f8('0x19')](freshsales[_0xc3f8('0x2d')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x2e')]())[_0xc3f8('0x19')](servicenow['getServicenowAccounts']())['then'](realtime[_0xc3f8('0x2f')]())[_0xc3f8('0x19')](dynamics365[_0xc3f8('0x30')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x31')]())[_0xc3f8('0x19')](campaign[_0xc3f8('0x32')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x33')]())[_0xc3f8('0x19')](voiceExtension[_0xc3f8('0x34')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x35')]())[_0xc3f8('0x19')](faxAccount['getFaxAccounts']())[_0xc3f8('0x19')](realtime['initFaxAccounts']())[_0xc3f8('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xc3f8('0x18')]()['then'](voiceQueueReport[_0xc3f8('0x36')]())[_0xc3f8('0x19')](realtime['initVoiceQueueReports']())[_0xc3f8('0x19')](cmHopperHistory[_0xc3f8('0x37')]())[_0xc3f8('0x19')](realtime[_0xc3f8('0x38')]())['then'](cmHopperHistory[_0xc3f8('0x39')]())['then'](realtime['initCampaignHopperHistory']())[_0xc3f8('0x19')](voiceCallReport[_0xc3f8('0x3a')]())[_0xc3f8('0x19')](realtime['initVoiceCallReports']())[_0xc3f8('0x19')](function(_0x1b3e5f){})[_0xc3f8('0x3b')](function(_0x22dde5){console[_0xc3f8('0x3c')](_0x22dde5);});}function main(){return server[_0xc3f8('0x3d')](realtime,preview,fax)['then'](function(_0x342cc6){return initRealtime();})[_0xc3f8('0x19')](function(){return initParams();})['then'](function(){report[_0xc3f8('0x3e')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x548d26){console['log'](_0x548d26);});}main(); \ No newline at end of file +var _0xfb11=['getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','listen','sync','catch','log','bluebird','moment','./server','./report','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns'];(function(_0x5dd830,_0x2cbcae){var _0x14f30b=function(_0x2b6c0d){while(--_0x2b6c0d){_0x5dd830['push'](_0x5dd830['shift']());}};_0x14f30b(++_0x2cbcae);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xfb11[_0x54d4fe];return _0x1ab5bb;};'use strict';var BPromise=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var server=require(_0x1fb1('0x2'));var Realtime=require('./realtime');var Report=require(_0x1fb1('0x3'));var Acw=require('./acw');var Trigger=require(_0x1fb1('0x4'));var Dialer=require('./dialer');var Preview=require(_0x1fb1('0x5'));var Fax=require(_0x1fb1('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x1fb1('0x7'));var voiceQueueReport=require(_0x1fb1('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x1fb1('0x9'));var trigger=require(_0x1fb1('0xa'));var template=require(_0x1fb1('0xb'));var cmHopperHistory=require(_0x1fb1('0xc'));var campaign=require(_0x1fb1('0xd'));var voiceExtension=require(_0x1fb1('0xe'));var faxAccount=require(_0x1fb1('0xf'));var zendesk=require(_0x1fb1('0x10'));var salesforce=require(_0x1fb1('0x11'));var sugarcrm=require(_0x1fb1('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x1fb1('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1fb1('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x1fb1('0x15'));var dynamics365=require(_0x1fb1('0x16'));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()[_0x1fb1('0x17')](_0x1fb1('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1fb1('0x17')](_0x1fb1('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x1fb1('0x19')](user[_0x1fb1('0x1a')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x1b')]())[_0x1fb1('0x19')](user[_0x1fb1('0x1c')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x1d')]())[_0x1fb1('0x19')](trunk['getTrunks']())['then'](realtime[_0x1fb1('0x1e')]())[_0x1fb1('0x19')](voiceQueue[_0x1fb1('0x1f')]())['then'](realtime[_0x1fb1('0x20')]())[_0x1fb1('0x19')](trigger[_0x1fb1('0x21')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x22')]())[_0x1fb1('0x19')](template[_0x1fb1('0x23')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x24')]())['then'](zendesk[_0x1fb1('0x25')]())['then'](realtime['initZendeskAccounts']())[_0x1fb1('0x19')](salesforce[_0x1fb1('0x26')]())[_0x1fb1('0x19')](realtime['initSalesforceAccounts']())[_0x1fb1('0x19')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())[_0x1fb1('0x19')](freshdesk[_0x1fb1('0x27')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x28')]())[_0x1fb1('0x19')](desk['getDeskAccounts']())[_0x1fb1('0x19')](realtime[_0x1fb1('0x29')]())[_0x1fb1('0x19')](zoho[_0x1fb1('0x2a')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x2b')]())[_0x1fb1('0x19')](vtiger[_0x1fb1('0x2c')]())['then'](realtime[_0x1fb1('0x2d')]())[_0x1fb1('0x19')](freshsales[_0x1fb1('0x2e')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x2f')]())[_0x1fb1('0x19')](servicenow[_0x1fb1('0x30')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x31')]())[_0x1fb1('0x19')](dynamics365[_0x1fb1('0x32')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x33')]())[_0x1fb1('0x19')](campaign[_0x1fb1('0x34')]())['then'](realtime[_0x1fb1('0x35')]())[_0x1fb1('0x19')](voiceExtension[_0x1fb1('0x36')]())[_0x1fb1('0x19')](realtime['initVoiceExtensions']())[_0x1fb1('0x19')](faxAccount[_0x1fb1('0x37')]())['then'](realtime[_0x1fb1('0x38')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x1fb1('0x19')](voiceQueueReport[_0x1fb1('0x39')]())['then'](realtime[_0x1fb1('0x3a')]())[_0x1fb1('0x19')](cmHopperHistory[_0x1fb1('0x3b')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x3c')]())['then'](cmHopperHistory[_0x1fb1('0x3d')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x3e')]())[_0x1fb1('0x19')](voiceCallReport[_0x1fb1('0x3f')]())[_0x1fb1('0x19')](realtime[_0x1fb1('0x40')]())[_0x1fb1('0x19')](function(_0x72a80d){})['catch'](function(_0x2d74b9){console['log'](_0x2d74b9);});}function main(){return server[_0x1fb1('0x41')](realtime,preview,fax)['then'](function(_0x37078c){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x1fb1('0x42')]();setInterval(initRealtime,0x1388);})[_0x1fb1('0x43')](function(_0x30df85){console[_0x1fb1('0x44')](_0x30df85);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 7766003..576ee85 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 _0x8c20=['state','status','phone','mobile','online','voiceStatus','unknown','voiceStatusCallerIdNumber','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatusTime','toNumber','format','address','interface','user:%s','emit','user:save','moment','md5','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8c20,0x1e5));var _0x08c2=function(_0x441a5c,_0x5455ed){_0x441a5c=_0x441a5c-0x0;var _0x1a2c15=_0x8c20[_0x441a5c];return _0x1a2c15;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08c2('0x0'));var md5=require(_0x08c2('0x1'));var Redis=require(_0x08c2('0x2'));var config=require('../../../config/environment');config[_0x08c2('0x3')]=_[_0x08c2('0x4')](config[_0x08c2('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x08c2('0x5'))(new Redis(config[_0x08c2('0x3')]));function Agent(_0x523888){this['id']=_0x523888['id']||0x0;this[_0x08c2('0x6')]=_0x523888['name']||'';this[_0x08c2('0x7')]=_0x523888[_0x08c2('0x7')]||'';this[_0x08c2('0x8')]=_0x523888[_0x08c2('0x8')]||'';this[_0x08c2('0x9')]=_0x523888[_0x08c2('0x9')]||'';this[_0x08c2('0xa')]='unknown';this['stateTime']=0x0;this[_0x08c2('0xb')]='unknown';this['address']='';this[_0x08c2('0xc')]='';this[_0x08c2('0xd')]='';this['interface']='';this['online']=_0x523888[_0x08c2('0xe')]||![];this[_0x08c2('0xf')]=_0x08c2('0x10');this['voiceStatusTime']=0x0;this[_0x08c2('0x11')]='';this[_0x08c2('0x12')]='';this['onhold']=![];this[_0x08c2('0x13')]=![];this[_0x08c2('0x1')]='';}Agent['prototype'][_0x08c2('0x14')]=function(_0x20a06e){var _0x226083;if(_0x20a06e&&_0x20a06e['state']){_0x226083=_0x20a06e['state'][_0x08c2('0x15')]();switch(_0x226083){case _0x08c2('0x16'):_0x226083='idle';break;case _0x08c2('0x17'):_0x226083=_0x08c2('0x18');break;}}if(_0x226083&&this['voiceStatus']!==_0x226083||_0x20a06e['statePause']){this[_0x08c2('0x19')]=_[_0x08c2('0x1a')](moment()[_0x08c2('0x1b')]('x'));}if(_0x226083){this['voiceStatus']=_0x226083;}var _0x59b730={'id':this['id'],'name':this['name'],'email':this[_0x08c2('0x7')],'accountcode':this[_0x08c2('0x8')],'fullname':this['fullname'],'state':this[_0x08c2('0xa')],'stateTime':this['stateTime'],'status':this[_0x08c2('0xb')],'address':this[_0x08c2('0x1c')],'online':this[_0x08c2('0xe')],'voiceStatus':this[_0x08c2('0xf')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x08c2('0x11')],'voiceStatusQueue':this[_0x08c2('0x12')],'interface':this[_0x08c2('0x1d')],'onhold':this['onhold']};var _0x159241=md5(JSON['stringify'](_0x59b730));if(this['md5']!==_0x159241){this[_0x08c2('0x1')]=_0x159241;io['to'](util[_0x08c2('0x1b')](_0x08c2('0x1e'),_0x59b730[_0x08c2('0x6')]))[_0x08c2('0x1f')](_0x08c2('0x20'),_0x59b730);}};module['exports']=Agent; \ No newline at end of file +var _0x6107=['voiceStatusTime','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','voiceStatus','name','email','emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','redis','accountcode','fullname','state','unknown','stateTime','status','address','phone','interface'];(function(_0xb60a95,_0xdb478f){var _0x2c876c=function(_0x234c62){while(--_0x234c62){_0xb60a95['push'](_0xb60a95['shift']());}};_0x2c876c(++_0xdb478f);}(_0x6107,0x156));var _0x7610=function(_0x3ccff8,_0x49f8f7){_0x3ccff8=_0x3ccff8-0x0;var _0xa13fac=_0x6107[_0x3ccff8];return _0xa13fac;};'use strict';var _=require(_0x7610('0x0'));var util=require(_0x7610('0x1'));var moment=require(_0x7610('0x2'));var md5=require(_0x7610('0x3'));var Redis=require(_0x7610('0x4'));var config=require(_0x7610('0x5'));config['redis']=_[_0x7610('0x6')](config['redis'],{'host':_0x7610('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7610('0x8')]));function Agent(_0x34c0a0){this['id']=_0x34c0a0['id']||0x0;this['name']=_0x34c0a0['name']||'';this['email']=_0x34c0a0['email']||'';this[_0x7610('0x9')]=_0x34c0a0[_0x7610('0x9')]||'';this[_0x7610('0xa')]=_0x34c0a0[_0x7610('0xa')]||'';this[_0x7610('0xb')]=_0x7610('0xc');this[_0x7610('0xd')]=0x0;this[_0x7610('0xe')]='unknown';this[_0x7610('0xf')]='';this[_0x7610('0x10')]='';this['mobile']='';this[_0x7610('0x11')]='';this['online']=_0x34c0a0['online']||![];this['voiceStatus']=_0x7610('0xc');this[_0x7610('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x7610('0x13')]=![];this[_0x7610('0x14')]=![];this[_0x7610('0x3')]='';}Agent[_0x7610('0x15')][_0x7610('0x16')]=function(_0x31d979){var _0x13f08d;if(_0x31d979&&_0x31d979[_0x7610('0xb')]){_0x13f08d=_0x31d979[_0x7610('0xb')][_0x7610('0x17')]();switch(_0x13f08d){case _0x7610('0x18'):_0x13f08d=_0x7610('0x19');break;case _0x7610('0x1a'):_0x13f08d=_0x7610('0x1b');break;}}if(_0x13f08d&&this['voiceStatus']!==_0x13f08d||_0x31d979[_0x7610('0x1c')]){this[_0x7610('0x12')]=_[_0x7610('0x1d')](moment()[_0x7610('0x1e')]('x'));}if(_0x13f08d){this[_0x7610('0x1f')]=_0x13f08d;}var _0x34ee89={'id':this['id'],'name':this[_0x7610('0x20')],'email':this[_0x7610('0x21')],'accountcode':this[_0x7610('0x9')],'fullname':this[_0x7610('0xa')],'state':this[_0x7610('0xb')],'stateTime':this[_0x7610('0xd')],'status':this[_0x7610('0xe')],'address':this[_0x7610('0xf')],'online':this['online'],'voiceStatus':this[_0x7610('0x1f')],'voiceStatusTime':this[_0x7610('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x7610('0x11')],'onhold':this[_0x7610('0x13')]};var _0x358f1d=md5(JSON['stringify'](_0x34ee89));if(this[_0x7610('0x3')]!==_0x358f1d){this[_0x7610('0x3')]=_0x358f1d;io['to'](util[_0x7610('0x1e')]('user:%s',_0x34ee89[_0x7610('0x20')]))[_0x7610('0x22')]('user:save',_0x34ee89);}};module[_0x7610('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index baea356..8376661 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 _0x5142=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0x5142,0xbb));var _0x2514=function(_0x55b03b,_0x34824b){_0x55b03b=_0x55b03b-0x0;var _0x46b06f=_0x5142[_0x55b03b];return _0x46b06f;};'use strict';function Campaign(_0xa6344a){this['id']=_0xa6344a['id']||0x0;this[_0x2514('0x0')]=_0xa6344a[_0x2514('0x0')]||'';this[_0x2514('0x1')]=_0xa6344a['type']||'campaign';this[_0x2514('0x2')]=0x0;this[_0x2514('0x3')]=0x0;this[_0x2514('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x2514('0x5')]=_0xa6344a[_0x2514('0x5')];this[_0x2514('0x6')]=_0xa6344a[_0x2514('0x6')];this[_0x2514('0x7')]=_0xa6344a['dialTimezone']||null;this[_0x2514('0x8')]=_0xa6344a[_0x2514('0x8')]?_0xa6344a[_0x2514('0x8')]:null;this[_0x2514('0x9')]=_0xa6344a['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0xa6344a[_0x2514('0xa')];this[_0x2514('0xb')]=_0xa6344a[_0x2514('0xb')]||0x1e;this[_0x2514('0xc')]=_0xa6344a[_0x2514('0xc')];this[_0x2514('0xd')]=_0xa6344a[_0x2514('0xd')];this[_0x2514('0xe')]=_0xa6344a[_0x2514('0xe')];this[_0x2514('0xf')]=_0xa6344a['dialBusyRetryFrequency'];this[_0x2514('0x10')]=_0xa6344a['dialNoAnswerMaxRetry'];this[_0x2514('0x11')]=_0xa6344a[_0x2514('0x11')];this[_0x2514('0x12')]=_0xa6344a[_0x2514('0x12')];this[_0x2514('0x13')]=_0xa6344a[_0x2514('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xa6344a[_0x2514('0x14')]||0x96;this[_0x2514('0x15')]=_0xa6344a[_0x2514('0x15')]||0x3;this['dialDropRetryFrequency']=_0xa6344a[_0x2514('0x16')]||0x96;this[_0x2514('0x17')]=_0xa6344a[_0x2514('0x17')]||0x3;this[_0x2514('0x18')]=_0xa6344a[_0x2514('0x18')]||0x96;this[_0x2514('0x19')]=_0xa6344a[_0x2514('0x19')]||0x3;this['dialMachineRetryFrequency']=_0xa6344a[_0x2514('0x1a')]||0x96;this[_0x2514('0x1b')]=_0xa6344a[_0x2514('0x1b')]||0x3;this[_0x2514('0x1c')]=_0xa6344a[_0x2514('0x1c')]||0x96;this[_0x2514('0x1d')]=_0xa6344a[_0x2514('0x1d')]||_0x2514('0x1e');this[_0x2514('0x1f')]=_0xa6344a[_0x2514('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xa6344a[_0x2514('0x20')]||undefined;this['dialCutDigit']=_0xa6344a[_0x2514('0x21')]||undefined;this[_0x2514('0x22')]=_0xa6344a[_0x2514('0x22')]?_0xa6344a[_0x2514('0x22')]:undefined;this[_0x2514('0x23')]=_0xa6344a[_0x2514('0x23')]?_0xa6344a[_0x2514('0x23')]:undefined;this[_0x2514('0x24')]=_0xa6344a[_0x2514('0x24')]?_0xa6344a[_0x2514('0x24')]:undefined;this[_0x2514('0x25')]=_0xa6344a['SquareProject']?_0xa6344a[_0x2514('0x25')]:undefined;this['dialQueueProject']=_0xa6344a[_0x2514('0x25')]?_0xa6344a['SquareProject']['name']:undefined;this[_0x2514('0x26')]=_0xa6344a['dialAMDActive']||![];this[_0x2514('0x27')]=_0xa6344a[_0x2514('0x27')];this[_0x2514('0x28')]=_0xa6344a['dialAMDGreeting'];this[_0x2514('0x29')]=_0xa6344a[_0x2514('0x29')];this[_0x2514('0x2a')]=_0xa6344a['dialAMDTotalAnalysisTime'];this[_0x2514('0x2b')]=_0xa6344a['dialAMDMinWordLength'];this[_0x2514('0x2c')]=_0xa6344a[_0x2514('0x2c')];this[_0x2514('0x2d')]=_0xa6344a[_0x2514('0x2d')];this[_0x2514('0x2e')]=_0xa6344a['dialAMDSilenceThreshold'];this[_0x2514('0x2f')]=_0xa6344a['dialAMDMaximumWordLength'];}module[_0x2514('0x30')]=Campaign; \ No newline at end of file +var _0x877b=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x2c553d,_0x2e7504){var _0x5f333c=function(_0x3ffaa7){while(--_0x3ffaa7){_0x2c553d['push'](_0x2c553d['shift']());}};_0x5f333c(++_0x2e7504);}(_0x877b,0x1f1));var _0xb877=function(_0x2293ea,_0x19dd01){_0x2293ea=_0x2293ea-0x0;var _0x11cf42=_0x877b[_0x2293ea];return _0x11cf42;};'use strict';function Campaign(_0x8d956d){this['id']=_0x8d956d['id']||0x0;this[_0xb877('0x0')]=_0x8d956d['name']||'';this['type']=_0x8d956d['type']||_0xb877('0x1');this[_0xb877('0x2')]=0x0;this[_0xb877('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xb877('0x4')]=!![];this[_0xb877('0x5')]=_0x8d956d[_0xb877('0x5')];this[_0xb877('0x6')]=_0x8d956d[_0xb877('0x6')];this[_0xb877('0x7')]=_0x8d956d[_0xb877('0x7')]||null;this[_0xb877('0x8')]=_0x8d956d[_0xb877('0x8')]?_0x8d956d['dialGlobalInterval']:null;this[_0xb877('0x9')]=_0x8d956d['dialOriginateCallerIdName'];this[_0xb877('0xa')]=_0x8d956d[_0xb877('0xa')];this['dialOriginateTimeout']=_0x8d956d[_0xb877('0xb')]||0x1e;this[_0xb877('0xc')]=_0x8d956d[_0xb877('0xc')];this[_0xb877('0xd')]=_0x8d956d[_0xb877('0xd')];this['dialBusyMaxRetry']=_0x8d956d[_0xb877('0xe')];this[_0xb877('0xf')]=_0x8d956d['dialBusyRetryFrequency'];this[_0xb877('0x10')]=_0x8d956d[_0xb877('0x10')];this[_0xb877('0x11')]=_0x8d956d[_0xb877('0x11')];this[_0xb877('0x12')]=_0x8d956d[_0xb877('0x12')];this[_0xb877('0x13')]=_0x8d956d[_0xb877('0x13')]||0x3;this[_0xb877('0x14')]=_0x8d956d[_0xb877('0x14')]||0x96;this[_0xb877('0x15')]=_0x8d956d[_0xb877('0x15')]||0x3;this['dialDropRetryFrequency']=_0x8d956d[_0xb877('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x8d956d['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x8d956d['dialAbandonedRetryFrequency']||0x96;this[_0xb877('0x17')]=_0x8d956d[_0xb877('0x17')]||0x3;this['dialMachineRetryFrequency']=_0x8d956d[_0xb877('0x18')]||0x96;this[_0xb877('0x19')]=_0x8d956d[_0xb877('0x19')]||0x3;this[_0xb877('0x1a')]=_0x8d956d[_0xb877('0x1a')]||0x96;this['dialOrderByScheduledAt']=_0x8d956d[_0xb877('0x1b')]||_0xb877('0x1c');this[_0xb877('0x1d')]=_0x8d956d[_0xb877('0x1d')]||undefined;this[_0xb877('0x1e')]=_0x8d956d[_0xb877('0x1e')]||undefined;this['dialCutDigit']=_0x8d956d[_0xb877('0x1f')]||undefined;this[_0xb877('0x20')]=_0x8d956d[_0xb877('0x20')]?_0x8d956d['TrunkBackup']:undefined;this[_0xb877('0x21')]=_0x8d956d['Trunk']?_0x8d956d[_0xb877('0x21')]:undefined;this['Interval']=_0x8d956d[_0xb877('0x22')]?_0x8d956d['Interval']:undefined;this[_0xb877('0x23')]=_0x8d956d[_0xb877('0x23')]?_0x8d956d[_0xb877('0x23')]:undefined;this['dialQueueProject']=_0x8d956d['SquareProject']?_0x8d956d[_0xb877('0x23')][_0xb877('0x0')]:undefined;this[_0xb877('0x24')]=_0x8d956d['dialAMDActive']||![];this[_0xb877('0x25')]=_0x8d956d[_0xb877('0x25')];this[_0xb877('0x26')]=_0x8d956d[_0xb877('0x26')];this['dialAMDAfterGreetingSilence']=_0x8d956d[_0xb877('0x27')];this[_0xb877('0x28')]=_0x8d956d['dialAMDTotalAnalysisTime'];this[_0xb877('0x29')]=_0x8d956d['dialAMDMinWordLength'];this[_0xb877('0x2a')]=_0x8d956d[_0xb877('0x2a')];this[_0xb877('0x2b')]=_0x8d956d['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x8d956d[_0xb877('0x2c')];this[_0xb877('0x2d')]=_0x8d956d['dialAMDMaximumWordLength'];}module[_0xb877('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 14897d2..976e256 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 _0x85e6=['connectedlinename','accountcode','context','linkedid','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','calleridname'];(function(_0xd78f32,_0x26f7e8){var _0x4fb9f9=function(_0x3e4657){while(--_0x3e4657){_0xd78f32['push'](_0xd78f32['shift']());}};_0x4fb9f9(++_0x26f7e8);}(_0x85e6,0x1a5));var _0x685e=function(_0x267028,_0x1cc072){_0x267028=_0x267028-0x0;var _0x2c497e=_0x85e6[_0x267028];return _0x2c497e;};'use strict';function Channel(){this[_0x685e('0x0')]=null;this[_0x685e('0x1')]='';this['destinationchannel']='';this[_0x685e('0x2')]=0x0;this[_0x685e('0x3')]='';this['connectedlinenum']=undefined;this[_0x685e('0x4')]=undefined;this[_0x685e('0x5')]=0x0;this[_0x685e('0x6')]='';this['uniqueid']=0x0;this[_0x685e('0x7')]=0x0;this['exten']=0x0;this[_0x685e('0x8')]=![];this[_0x685e('0x9')]=null;this[_0x685e('0xa')]=null;this['unmanaged']=![];this[_0x685e('0xb')]=![];this[_0x685e('0xc')]='';this[_0x685e('0xd')]='';this[_0x685e('0xe')]=0x0;this[_0x685e('0xf')]=0x0;this['holdtime']=0x0;this[_0x685e('0x10')]=null;this['tag']=null;this[_0x685e('0x11')]=null;this['monitor']=![];this[_0x685e('0x12')]=null;this[_0x685e('0x13')]=null;this[_0x685e('0x14')]=[];this[_0x685e('0x15')]=undefined;this[_0x685e('0x16')]=undefined;this[_0x685e('0x17')]=0x0;}module[_0x685e('0x18')]=Channel; \ No newline at end of file +var _0xcbcd=['exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastdata','duration','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime'];(function(_0x248020,_0x225812){var _0x4a25c4=function(_0x31a7a7){while(--_0x31a7a7){_0x248020['push'](_0x248020['shift']());}};_0x4a25c4(++_0x225812);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xcbcd[_0x496738];return _0xee1381;};'use strict';function Channel(){this['starttime']=null;this[_0xdcbc('0x0')]='';this[_0xdcbc('0x1')]='';this[_0xdcbc('0x2')]=0x0;this[_0xdcbc('0x3')]='';this[_0xdcbc('0x4')]=undefined;this[_0xdcbc('0x5')]=undefined;this['accountcode']=0x0;this[_0xdcbc('0x6')]='';this[_0xdcbc('0x7')]=0x0;this[_0xdcbc('0x8')]=0x0;this[_0xdcbc('0x9')]=0x0;this['answered']=![];this[_0xdcbc('0xa')]=null;this[_0xdcbc('0xb')]=null;this['unmanaged']=![];this[_0xdcbc('0xc')]=![];this['lastapplication']='';this[_0xdcbc('0xd')]='';this[_0xdcbc('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xdcbc('0xf')]=null;this[_0xdcbc('0x10')]=null;this[_0xdcbc('0x11')]=null;this[_0xdcbc('0x12')]=![];this[_0xdcbc('0x13')]=null;this[_0xdcbc('0x14')]=null;this[_0xdcbc('0x15')]=[];this[_0xdcbc('0x16')]=undefined;this[_0xdcbc('0x17')]=undefined;this[_0xdcbc('0x18')]=0x0;}module[_0xdcbc('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ce8fe72..ae18cfe 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 _0x1b94=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey'];(function(_0x54916c,_0x481c1f){var _0x4e0f99=function(_0x10b346){while(--_0x10b346){_0x54916c['push'](_0x54916c['shift']());}};_0x4e0f99(++_0x481c1f);}(_0x1b94,0x1f2));var _0x41b9=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1b94[_0x1e4360];return _0x31e6b4;};'use strict';function DeskAccount(_0x4f1258){this['id']=_0x4f1258['id']||0x0;this[_0x41b9('0x0')]=_0x4f1258[_0x41b9('0x0')]||'';this[_0x41b9('0x1')]=_0x4f1258[_0x41b9('0x1')]||'';this['remoteUri']=_0x4f1258[_0x41b9('0x2')]||'';this[_0x41b9('0x3')]=_0x4f1258[_0x41b9('0x3')]||'';this['password']=_0x4f1258[_0x41b9('0x4')]||'';this[_0x41b9('0x5')]=_0x4f1258[_0x41b9('0x5')]||'';this['consumerSecret']=_0x4f1258[_0x41b9('0x6')]||'';this[_0x41b9('0x7')]=_0x4f1258[_0x41b9('0x7')]||'';this[_0x41b9('0x8')]=_0x4f1258[_0x41b9('0x8')]||'';this['type']=_0x4f1258[_0x41b9('0x9')]||'';this[_0x41b9('0xa')]=_0x4f1258['serverUrl']||'';this[_0x41b9('0xb')]=_0x4f1258[_0x41b9('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x28a2=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x466b17){this['id']=_0x466b17['id']||0x0;this[_0x228a('0x0')]=_0x466b17[_0x228a('0x0')]||'';this[_0x228a('0x1')]=_0x466b17[_0x228a('0x1')]||'';this[_0x228a('0x2')]=_0x466b17[_0x228a('0x2')]||'';this['authType']=_0x466b17[_0x228a('0x3')]||'';this['password']=_0x466b17[_0x228a('0x4')]||'';this[_0x228a('0x5')]=_0x466b17[_0x228a('0x5')]||'';this[_0x228a('0x6')]=_0x466b17[_0x228a('0x6')]||'';this['token']=_0x466b17[_0x228a('0x7')]||'';this[_0x228a('0x8')]=_0x466b17[_0x228a('0x8')]||'';this[_0x228a('0x9')]=_0x466b17['type']||'';this[_0x228a('0xa')]=_0x466b17[_0x228a('0xa')]||'';this[_0x228a('0xb')]=_0x466b17[_0x228a('0xb')]||{};}module[_0x228a('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index fe6e002..be49135 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 _0x08cb=['exports','name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x44b827,_0x1bb1aa){var _0x527342=function(_0x481338){while(--_0x481338){_0x44b827['push'](_0x44b827['shift']());}};_0x527342(++_0x1bb1aa);}(_0x08cb,0x184));var _0xb08c=function(_0x406276,_0x5e9abd){_0x406276=_0x406276-0x0;var _0x4772b6=_0x08cb[_0x406276];return _0x4772b6;};'use strict';function Dynamics365Account(_0x5533e3){this['id']=_0x5533e3['id']||0x0;this[_0xb08c('0x0')]=_0x5533e3['name']||'';this[_0xb08c('0x1')]=_0x5533e3[_0xb08c('0x1')]||'';this['password']=_0x5533e3['password']||'';this['remoteUri']=_0x5533e3[_0xb08c('0x2')]||'';this['tenantId']=_0x5533e3[_0xb08c('0x3')]||'';this[_0xb08c('0x4')]=_0x5533e3['clientId']||'';this[_0xb08c('0x5')]=_0x5533e3['clientSecret']||{};this['serverUrl']=_0x5533e3[_0xb08c('0x6')]||'';this['Configurations']=_0x5533e3[_0xb08c('0x7')]||{};}module[_0xb08c('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xd017=['Configurations','exports','name','username','password','tenantId','clientId','clientSecret','serverUrl'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0xd017,0xd1));var _0x7d01=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xd017[_0x1b6186];return _0x186121;};'use strict';function Dynamics365Account(_0x2b89cc){this['id']=_0x2b89cc['id']||0x0;this[_0x7d01('0x0')]=_0x2b89cc[_0x7d01('0x0')]||'';this[_0x7d01('0x1')]=_0x2b89cc[_0x7d01('0x1')]||'';this[_0x7d01('0x2')]=_0x2b89cc[_0x7d01('0x2')]||'';this['remoteUri']=_0x2b89cc['remoteUri']||'';this[_0x7d01('0x3')]=_0x2b89cc[_0x7d01('0x3')]||'';this[_0x7d01('0x4')]=_0x2b89cc[_0x7d01('0x4')]||'';this[_0x7d01('0x5')]=_0x2b89cc[_0x7d01('0x5')]||{};this[_0x7d01('0x6')]=_0x2b89cc[_0x7d01('0x6')]||'';this[_0x7d01('0x7')]=_0x2b89cc[_0x7d01('0x7')]||{};}module[_0x7d01('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6370c15..574b7c3 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 _0x3a29=['ListId','key','name','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0x3a29,0xe3));var _0x93a2=function(_0x309515,_0x55f470){_0x309515=_0x309515-0x0;var _0x51f8bd=_0x3a29[_0x309515];return _0x51f8bd;};'use strict';function FaxAccount(_0xf33f42){this['id']=_0xf33f42['id']||0x0;this['name']=_0xf33f42[_0x93a2('0x0')]||'';this[_0x93a2('0x1')]=_0xf33f42[_0x93a2('0x1')];this['ecm']=_0xf33f42['ecm'];this[_0x93a2('0x2')]=_0xf33f42['headerinfo'];this[_0x93a2('0x3')]=_0xf33f42[_0x93a2('0x3')];this[_0x93a2('0x4')]=_0xf33f42['minrate']||0x960;this[_0x93a2('0x5')]=_0xf33f42[_0x93a2('0x5')]||0x3840;this[_0x93a2('0x6')]=_0xf33f42[_0x93a2('0x6')]||_0x93a2('0x7');this['gateway']=_0xf33f42[_0x93a2('0x8')]||'no';this[_0x93a2('0x9')]=_0xf33f42[_0x93a2('0x9')]||'no';this[_0x93a2('0xa')]=_0xf33f42[_0x93a2('0xa')]||0x1388;this[_0x93a2('0xb')]=_0xf33f42[_0x93a2('0xb')]||'SIP';this[_0x93a2('0xc')]=_0xf33f42[_0x93a2('0xc')]?_0xf33f42['Trunk']:undefined;this[_0x93a2('0xd')]=_0xf33f42[_0x93a2('0xd')];this[_0x93a2('0xe')]=_0xf33f42[_0x93a2('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x5f6f=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','Trunk','ListId','key'];(function(_0x198f6d,_0x334c6c){var _0x1629a2=function(_0x1f0cf9){while(--_0x1f0cf9){_0x198f6d['push'](_0x198f6d['shift']());}};_0x1629a2(++_0x334c6c);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x5f6f[_0xa6cc5c];return _0x44803d;};'use strict';function FaxAccount(_0x4af99b){this['id']=_0x4af99b['id']||0x0;this[_0xf5f6('0x0')]=_0x4af99b[_0xf5f6('0x0')]||'';this[_0xf5f6('0x1')]=_0x4af99b[_0xf5f6('0x1')];this['ecm']=_0x4af99b[_0xf5f6('0x2')];this[_0xf5f6('0x3')]=_0x4af99b[_0xf5f6('0x3')];this['localstationid']=_0x4af99b[_0xf5f6('0x4')];this[_0xf5f6('0x5')]=_0x4af99b[_0xf5f6('0x5')]||0x960;this[_0xf5f6('0x6')]=_0x4af99b['maxrate']||0x3840;this['modem']=_0x4af99b[_0xf5f6('0x7')]||_0xf5f6('0x8');this[_0xf5f6('0x9')]=_0x4af99b[_0xf5f6('0x9')]||'no';this[_0xf5f6('0xa')]=_0x4af99b[_0xf5f6('0xa')]||'no';this['t38timeout']=_0x4af99b['t38timeout']||0x1388;this[_0xf5f6('0xb')]=_0x4af99b[_0xf5f6('0xb')]||'SIP';this[_0xf5f6('0xc')]=_0x4af99b[_0xf5f6('0xc')]?_0x4af99b[_0xf5f6('0xc')]:undefined;this[_0xf5f6('0xd')]=_0x4af99b[_0xf5f6('0xd')];this['key']=_0x4af99b[_0xf5f6('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 966c766..b5527bd 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 _0x4d28=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0xdceb27,_0x158e07){var _0x2467b5=function(_0x28cd5b){while(--_0x28cd5b){_0xdceb27['push'](_0xdceb27['shift']());}};_0x2467b5(++_0x158e07);}(_0x4d28,0x188));var _0x84d2=function(_0x24c970,_0x1199ef){_0x24c970=_0x24c970-0x0;var _0x48f700=_0x4d28[_0x24c970];return _0x48f700;};'use strict';function FreshdeskAccount(_0x48034a){this['id']=_0x48034a['id']||0x0;this[_0x84d2('0x0')]=_0x48034a[_0x84d2('0x0')]||'';this['username']=_0x48034a[_0x84d2('0x1')]||'';this['apiKey']=_0x48034a[_0x84d2('0x2')]||'';this[_0x84d2('0x3')]=_0x48034a[_0x84d2('0x3')]||'';this[_0x84d2('0x4')]=_0x48034a[_0x84d2('0x4')]||'';this[_0x84d2('0x5')]=_0x48034a[_0x84d2('0x5')]||{};}module[_0x84d2('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x62a3=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x47e80a,_0x408c86){var _0x40ebdf=function(_0xdcdeed){while(--_0xdcdeed){_0x47e80a['push'](_0x47e80a['shift']());}};_0x40ebdf(++_0x408c86);}(_0x62a3,0xc8));var _0x362a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x62a3[_0x502c7d];return _0x30b7ed;};'use strict';function FreshdeskAccount(_0x449acf){this['id']=_0x449acf['id']||0x0;this[_0x362a('0x0')]=_0x449acf['name']||'';this['username']=_0x449acf[_0x362a('0x1')]||'';this[_0x362a('0x2')]=_0x449acf[_0x362a('0x3')]||'';this[_0x362a('0x4')]=_0x449acf[_0x362a('0x4')]||'';this['serverUrl']=_0x449acf[_0x362a('0x5')]||'';this[_0x362a('0x6')]=_0x449acf[_0x362a('0x6')]||{};}module[_0x362a('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index bb75511..73e15fe 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 _0x3aba=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x54e631,_0x3b8396){var _0x3c6b6a=function(_0x48cea6){while(--_0x48cea6){_0x54e631['push'](_0x54e631['shift']());}};_0x3c6b6a(++_0x3b8396);}(_0x3aba,0x1f3));var _0xa3ab=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x3aba[_0xf26c2e];return _0x46ecb4;};'use strict';function FreshsalesAccount(_0x384f33){this['id']=_0x384f33['id']||0x0;this[_0xa3ab('0x0')]=_0x384f33[_0xa3ab('0x0')]||'';this[_0xa3ab('0x1')]=_0x384f33[_0xa3ab('0x1')]||'';this[_0xa3ab('0x2')]=_0x384f33[_0xa3ab('0x3')]||'';this[_0xa3ab('0x4')]=_0x384f33[_0xa3ab('0x4')]||'';this[_0xa3ab('0x5')]=_0x384f33['serverUrl']||'';this[_0xa3ab('0x6')]=_0x384f33[_0xa3ab('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x6af1=['username','apiKey','token','remoteUri','Configurations','exports','name'];(function(_0x31cc4b,_0x2c2bf0){var _0x2b9fb2=function(_0x260fe3){while(--_0x260fe3){_0x31cc4b['push'](_0x31cc4b['shift']());}};_0x2b9fb2(++_0x2c2bf0);}(_0x6af1,0x1c6));var _0x16af=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6af1[_0x14add3];return _0x4a174f;};'use strict';function FreshsalesAccount(_0x33654d){this['id']=_0x33654d['id']||0x0;this[_0x16af('0x0')]=_0x33654d['name']||'';this['username']=_0x33654d[_0x16af('0x1')]||'';this[_0x16af('0x2')]=_0x33654d[_0x16af('0x3')]||'';this[_0x16af('0x4')]=_0x33654d[_0x16af('0x4')]||'';this['serverUrl']=_0x33654d['serverUrl']||'';this[_0x16af('0x5')]=_0x33654d[_0x16af('0x5')]||{};}module[_0x16af('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 1bedb9e..37c95c2 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 _0x9aff=['queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','context','exten','priority','holdtime','mohtime','variables','type','inbound','uniqueid','calleridname'];(function(_0x3511f3,_0x5979de){var _0x445547=function(_0x1e8da5){while(--_0x1e8da5){_0x3511f3['push'](_0x3511f3['shift']());}};_0x445547(++_0x5979de);}(_0x9aff,0x183));var _0xf9af=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x9aff[_0x4fbfd9];return _0x31dc94;};'use strict';function QueueReport(){this[_0xf9af('0x0')]=_0xf9af('0x1');this[_0xf9af('0x2')]='';this['calleridnum']='';this[_0xf9af('0x3')]='';this[_0xf9af('0x4')]='';this[_0xf9af('0x5')]=null;this[_0xf9af('0x6')]=null;this[_0xf9af('0x7')]=0x1;this[_0xf9af('0x8')]=0x1;this[_0xf9af('0x9')]=![];this[_0xf9af('0xa')]=null;this[_0xf9af('0xb')]=![];this[_0xf9af('0xc')]=null;this[_0xf9af('0xd')]=![];this[_0xf9af('0xe')]=null;this[_0xf9af('0xf')]=0x1;this[_0xf9af('0x10')]='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0xf9af('0x11')]='';this[_0xf9af('0x12')]='';this[_0xf9af('0x13')]='';this[_0xf9af('0x14')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0xf9af('0x15')]=0x0;this[_0xf9af('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x971e=['holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','priority'];(function(_0x41d559,_0x53301e){var _0x9f2d4e=function(_0x79ef91){while(--_0x79ef91){_0x41d559['push'](_0x41d559['shift']());}};_0x9f2d4e(++_0x53301e);}(_0x971e,0xc3));var _0xe971=function(_0x1e2de4,_0x22d700){_0x1e2de4=_0x1e2de4-0x0;var _0x4a5929=_0x971e[_0x1e2de4];return _0x4a5929;};'use strict';function QueueReport(){this[_0xe971('0x0')]=_0xe971('0x1');this[_0xe971('0x2')]='';this[_0xe971('0x3')]='';this[_0xe971('0x4')]='';this[_0xe971('0x5')]='';this[_0xe971('0x6')]=null;this[_0xe971('0x7')]=null;this[_0xe971('0x8')]=0x1;this[_0xe971('0x9')]=0x1;this[_0xe971('0xa')]=![];this[_0xe971('0xb')]=null;this['queuecallercomplete']=![];this[_0xe971('0xc')]=null;this[_0xe971('0xd')]=![];this[_0xe971('0xe')]=null;this[_0xe971('0xf')]=0x1;this[_0xe971('0x10')]='';this['connectedlinenum']='';this[_0xe971('0x11')]='';this[_0xe971('0x12')]='';this[_0xe971('0x13')]='';this['exten']='';this[_0xe971('0x14')]='';this[_0xe971('0x15')]=0x0;this[_0xe971('0x16')]=![];this[_0xe971('0x17')]='';this[_0xe971('0x18')]=0x0;this[_0xe971('0x19')]={};}module[_0xe971('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 03b550b..b09fce4 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 _0x7c9e=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x17c00f,_0xbae708){var _0x39ab3d=function(_0x119d2f){while(--_0x119d2f){_0x17c00f['push'](_0x17c00f['shift']());}};_0x39ab3d(++_0xbae708);}(_0x7c9e,0x18b));var _0xe7c9=function(_0x4c0f84,_0x53ca24){_0x4c0f84=_0x4c0f84-0x0;var _0x4eb520=_0x7c9e[_0x4c0f84];return _0x4eb520;};'use strict';function SalesforceAccount(_0x52aba3){this['id']=_0x52aba3['id']||0x0;this[_0xe7c9('0x0')]=_0x52aba3['name']||'';this['username']=_0x52aba3[_0xe7c9('0x1')]||'';this['remoteUri']=_0x52aba3[_0xe7c9('0x2')]||'';this[_0xe7c9('0x3')]=_0x52aba3[_0xe7c9('0x3')]||'';this[_0xe7c9('0x4')]=_0x52aba3[_0xe7c9('0x4')]||'';this[_0xe7c9('0x5')]=_0x52aba3[_0xe7c9('0x5')]||'';this[_0xe7c9('0x6')]=_0x52aba3['securityToken']||'';this['type']=_0x52aba3[_0xe7c9('0x7')]||_0xe7c9('0x8');this['serverUrl']=_0x52aba3[_0xe7c9('0x9')]||'';this[_0xe7c9('0xa')]=_0x52aba3['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x4960=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x4960,0x1e6));var _0x0496=function(_0x37bb0e,_0x593f9a){_0x37bb0e=_0x37bb0e-0x0;var _0x5b5847=_0x4960[_0x37bb0e];return _0x5b5847;};'use strict';function SalesforceAccount(_0x4718a4){this['id']=_0x4718a4['id']||0x0;this[_0x0496('0x0')]=_0x4718a4[_0x0496('0x0')]||'';this[_0x0496('0x1')]=_0x4718a4['username']||'';this[_0x0496('0x2')]=_0x4718a4[_0x0496('0x2')]||'';this[_0x0496('0x3')]=_0x4718a4['password']||'';this[_0x0496('0x4')]=_0x4718a4['clientId']||'';this[_0x0496('0x5')]=_0x4718a4['clientSecret']||'';this[_0x0496('0x6')]=_0x4718a4[_0x0496('0x6')]||'';this['type']=_0x4718a4[_0x0496('0x7')]||_0x0496('0x8');this[_0x0496('0x9')]=_0x4718a4[_0x0496('0x9')]||'';this[_0x0496('0xa')]=_0x4718a4[_0x0496('0xa')]||{};}module[_0x0496('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 230437b..30fa462 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 _0x989d=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2c0ec3,_0x5642cb){var _0x557e39=function(_0x24c98a){while(--_0x24c98a){_0x2c0ec3['push'](_0x2c0ec3['shift']());}};_0x557e39(++_0x5642cb);}(_0x989d,0x159));var _0xd989=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x989d[_0x122ef9];return _0x42fba0;};'use strict';function ServicenowAccount(_0x1fc06c){this['id']=_0x1fc06c['id']||0x0;this[_0xd989('0x0')]=_0x1fc06c[_0xd989('0x0')]||'';this['username']=_0x1fc06c[_0xd989('0x1')]||'';this[_0xd989('0x2')]=_0x1fc06c[_0xd989('0x2')]||'';this[_0xd989('0x3')]=_0x1fc06c[_0xd989('0x3')]||'';this[_0xd989('0x4')]=_0x1fc06c['serverUrl']||'';this[_0xd989('0x5')]=_0x1fc06c[_0xd989('0x5')]||{};}module[_0xd989('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xd20b=['exports','name','username','password','serverUrl','Configurations'];(function(_0x3fd275,_0xf0cd7){var _0xe4f14f=function(_0x23971d){while(--_0x23971d){_0x3fd275['push'](_0x3fd275['shift']());}};_0xe4f14f(++_0xf0cd7);}(_0xd20b,0x1db));var _0xbd20=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xd20b[_0x381589];return _0x2a075d;};'use strict';function ServicenowAccount(_0x1265b0){this['id']=_0x1265b0['id']||0x0;this[_0xbd20('0x0')]=_0x1265b0[_0xbd20('0x0')]||'';this[_0xbd20('0x1')]=_0x1265b0['username']||'';this[_0xbd20('0x2')]=_0x1265b0[_0xbd20('0x2')]||'';this['remoteUri']=_0x1265b0['remoteUri']||'';this[_0xbd20('0x3')]=_0x1265b0[_0xbd20('0x3')]||'';this[_0xbd20('0x4')]=_0x1265b0[_0xbd20('0x4')]||{};}module[_0xbd20('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 16ee756..60e9ffa 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 _0x8c5c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x158897,_0x93fb6f){var _0x13d1ff=function(_0x15b3b5){while(--_0x15b3b5){_0x158897['push'](_0x158897['shift']());}};_0x13d1ff(++_0x93fb6f);}(_0x8c5c,0x115));var _0xc8c5=function(_0x5de3e7,_0x2f78bb){_0x5de3e7=_0x5de3e7-0x0;var _0x7eb9ff=_0x8c5c[_0x5de3e7];return _0x7eb9ff;};'use strict';function SugarcrmAccount(_0x6a829d){this['id']=_0x6a829d['id']||0x0;this[_0xc8c5('0x0')]=_0x6a829d[_0xc8c5('0x0')]||'';this[_0xc8c5('0x1')]=_0x6a829d[_0xc8c5('0x1')]||'';this[_0xc8c5('0x2')]=_0x6a829d[_0xc8c5('0x2')]||'';this[_0xc8c5('0x3')]=_0x6a829d[_0xc8c5('0x3')]||'';this['serverUrl']=_0x6a829d[_0xc8c5('0x4')]||'';this[_0xc8c5('0x5')]=_0x6a829d[_0xc8c5('0x5')]||{};}module[_0xc8c5('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x75e4=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x56c23d,_0x383126){var _0x21ae1d=function(_0x38580e){while(--_0x38580e){_0x56c23d['push'](_0x56c23d['shift']());}};_0x21ae1d(++_0x383126);}(_0x75e4,0x80));var _0x475e=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x75e4[_0x271060];return _0x40540b;};'use strict';function SugarcrmAccount(_0x4b3bf7){this['id']=_0x4b3bf7['id']||0x0;this[_0x475e('0x0')]=_0x4b3bf7['name']||'';this[_0x475e('0x1')]=_0x4b3bf7['username']||'';this[_0x475e('0x2')]=_0x4b3bf7[_0x475e('0x2')]||'';this['remoteUri']=_0x4b3bf7[_0x475e('0x3')]||'';this[_0x475e('0x4')]=_0x4b3bf7['serverUrl']||'';this[_0x475e('0x5')]=_0x4b3bf7[_0x475e('0x5')]||{};}module[_0x475e('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 66e93ad..9e7e78b 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 _0xd3ac=['unknown','address','exports','name','accountcode','state','status'];(function(_0x4671c7,_0x3416dd){var _0x2312ff=function(_0x17ed13){while(--_0x17ed13){_0x4671c7['push'](_0x4671c7['shift']());}};_0x2312ff(++_0x3416dd);}(_0xd3ac,0x1f4));var _0xcd3a=function(_0x2ac5e9,_0x2f721d){_0x2ac5e9=_0x2ac5e9-0x0;var _0x4eb87d=_0xd3ac[_0x2ac5e9];return _0x4eb87d;};'use strict';function Telephone(_0x4ed86d){this['id']=_0x4ed86d['id']||0x0;this[_0xcd3a('0x0')]=_0x4ed86d[_0xcd3a('0x0')]||'';this['accountcode']=_0x4ed86d[_0xcd3a('0x1')]||'';this[_0xcd3a('0x2')]='unknown';this['stateTime']=0x0;this[_0xcd3a('0x3')]=_0xcd3a('0x4');this[_0xcd3a('0x5')]='';}module[_0xcd3a('0x6')]=Telephone; \ No newline at end of file +var _0x48aa=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x4c7e03,_0x2ef244){var _0x47aeac=function(_0x379d1f){while(--_0x379d1f){_0x4c7e03['push'](_0x4c7e03['shift']());}};_0x47aeac(++_0x2ef244);}(_0x48aa,0x12f));var _0xa48a=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x48aa[_0x18cac4];return _0x2227c6;};'use strict';function Telephone(_0x4c5dac){this['id']=_0x4c5dac['id']||0x0;this[_0xa48a('0x0')]=_0x4c5dac['name']||'';this[_0xa48a('0x1')]=_0x4c5dac['accountcode']||'';this[_0xa48a('0x2')]=_0xa48a('0x3');this[_0xa48a('0x4')]=0x0;this[_0xa48a('0x5')]=_0xa48a('0x3');this[_0xa48a('0x6')]='';}module[_0xa48a('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index faae686..c96dbc4 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 _0x3235=['name','html','exports'];(function(_0x54fe59,_0x24ebd6){var _0x3d89e4=function(_0x59182a){while(--_0x59182a){_0x54fe59['push'](_0x54fe59['shift']());}};_0x3d89e4(++_0x24ebd6);}(_0x3235,0x144));var _0x5323=function(_0x2376e3,_0xe0cbbd){_0x2376e3=_0x2376e3-0x0;var _0x173bbf=_0x3235[_0x2376e3];return _0x173bbf;};'use strict';function template(_0x39759c){this['id']=_0x39759c['id']||0x0;this[_0x5323('0x0')]=_0x39759c[_0x5323('0x0')]||'';this[_0x5323('0x1')]=_0x39759c['html']||'';}module[_0x5323('0x2')]=template; \ No newline at end of file +var _0xf143=['exports','name','html'];(function(_0x554c88,_0x40f7d5){var _0x18758a=function(_0x25cf4b){while(--_0x25cf4b){_0x554c88['push'](_0x554c88['shift']());}};_0x18758a(++_0x40f7d5);}(_0xf143,0x12a));var _0x3f14=function(_0x506aef,_0xb1161c){_0x506aef=_0x506aef-0x0;var _0x579eea=_0xf143[_0x506aef];return _0x579eea;};'use strict';function template(_0xdaeb10){this['id']=_0xdaeb10['id']||0x0;this['name']=_0xdaeb10[_0x3f14('0x0')]||'';this['html']=_0xdaeb10[_0x3f14('0x1')]||'';}module[_0x3f14('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 bf2dcb8..1d2a1f1 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 _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x46da8a,_0x1cf75f){var _0x3abae0=function(_0x446a89){while(--_0x446a89){_0x46da8a['push'](_0x46da8a['shift']());}};_0x3abae0(++_0x1cf75f);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('0x6')]=Trigger; \ No newline at end of file +var _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x594795,_0x3def87){var _0x5b6932=function(_0x25ea4a){while(--_0x25ea4a){_0x594795['push'](_0x594795['shift']());}};_0x5b6932(++_0x3def87);}(_0x3e74,0x175));var _0x43e7=function(_0x2b074b,_0x41f8f0){_0x2b074b=_0x2b074b-0x0;var _0x40313a=_0x3e74[_0x2b074b];return _0x40313a;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 447b3e8..cf3dc77 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 _0xd3a6=['split','host','port','domain','registrationtime','address','exports','active','name','state','stateTime','status','unknown','registry'];(function(_0x2573ca,_0x48578e){var _0x216d5f=function(_0x12b5d6){while(--_0x12b5d6){_0x2573ca['push'](_0x2573ca['shift']());}};_0x216d5f(++_0x48578e);}(_0xd3a6,0x181));var _0x6d3a=function(_0x197a7d,_0x55f185){_0x197a7d=_0x197a7d-0x0;var _0x3f902c=_0xd3a6[_0x197a7d];return _0x3f902c;};'use strict';function Trunk(_0x53df30){this['id']=_0x53df30['id']||0x0;this['active']=_0x53df30[_0x6d3a('0x0')]||![];this[_0x6d3a('0x1')]=_0x53df30[_0x6d3a('0x1')]||'';this[_0x6d3a('0x2')]='unknown';this[_0x6d3a('0x3')]=0x0;this[_0x6d3a('0x4')]=_0x6d3a('0x5');this['registry']=_0x53df30[_0x6d3a('0x6')]&&_0x53df30[_0x6d3a('0x6')]['indexOf'](':')?_0x53df30[_0x6d3a('0x6')][_0x6d3a('0x7')](':')[0x0]:'';this[_0x6d3a('0x8')]='';this[_0x6d3a('0x9')]='';this[_0x6d3a('0xa')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0x6d3a('0x5');this[_0x6d3a('0xb')]='';this[_0x6d3a('0xc')]='';}module[_0x6d3a('0xd')]=Trunk; \ No newline at end of file +var _0x65be=['address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0x65be,0x1bc));var _0xe65b=function(_0x46a758,_0x138d1d){_0x46a758=_0x46a758-0x0;var _0x16b720=_0x65be[_0x46a758];return _0x16b720;};'use strict';function Trunk(_0x126389){this['id']=_0x126389['id']||0x0;this['active']=_0x126389[_0xe65b('0x0')]||![];this[_0xe65b('0x1')]=_0x126389[_0xe65b('0x1')]||'';this[_0xe65b('0x2')]=_0xe65b('0x3');this[_0xe65b('0x4')]=0x0;this[_0xe65b('0x5')]=_0xe65b('0x3');this['registry']=_0x126389[_0xe65b('0x6')]&&_0x126389[_0xe65b('0x6')][_0xe65b('0x7')](':')?_0x126389[_0xe65b('0x6')][_0xe65b('0x8')](':')[0x0]:'';this[_0xe65b('0x9')]='';this['port']='';this[_0xe65b('0xa')]='';this[_0xe65b('0xb')]='';this[_0xe65b('0xc')]='';this[_0xe65b('0xd')]=_0xe65b('0x3');this[_0xe65b('0xe')]='';this[_0xe65b('0xf')]='';}module[_0xe65b('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9643ad8..eea57cf 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 _0xe3fa=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe3fa,0x188));var _0xae3f=function(_0x11c0d1,_0x29aa18){_0x11c0d1=_0x11c0d1-0x0;var _0x1d9d8e=_0xe3fa[_0x11c0d1];return _0x1d9d8e;};'use strict';function voiceExtension(_0x56465f){this['id']=_0x56465f['id']||0x0;this['exten']=_0x56465f[_0xae3f('0x0')]||'';this['recordingFormat']=_0x56465f[_0xae3f('0x1')]||_0xae3f('0x2');this[_0xae3f('0x3')]=_0x56465f[_0xae3f('0x3')]||![];}module[_0xae3f('0x4')]=voiceExtension; \ No newline at end of file +var _0xf451=['exports','exten','none','mandatoryDisposition'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xf451,0x119));var _0x1f45=function(_0x1fbb2c,_0x11a0f8){_0x1fbb2c=_0x1fbb2c-0x0;var _0x421937=_0xf451[_0x1fbb2c];return _0x421937;};'use strict';function voiceExtension(_0x1ce90b){this['id']=_0x1ce90b['id']||0x0;this[_0x1f45('0x0')]=_0x1ce90b['exten']||'';this['recordingFormat']=_0x1ce90b['recordingFormat']||_0x1f45('0x1');this[_0x1f45('0x2')]=_0x1ce90b[_0x1f45('0x2')]||![];}module[_0x1f45('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 90565a1..dc7f8c1 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 _0x33b5=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit'];(function(_0x4bb1db,_0x51a434){var _0x38de9b=function(_0x1d9e5d){while(--_0x1d9e5d){_0x4bb1db['push'](_0x4bb1db['shift']());}};_0x38de9b(++_0x51a434);}(_0x33b5,0x96));var _0x533b=function(_0x573b08,_0x54f933){_0x573b08=_0x573b08-0x0;var _0x3e483f=_0x33b5[_0x573b08];return _0x3e483f;};'use strict';var statusDesc=[_0x533b('0x0'),_0x533b('0x1'),_0x533b('0x2'),_0x533b('0x3'),_0x533b('0x4'),'unavailable',_0x533b('0x5'),_0x533b('0x6'),_0x533b('0x7')];var monitorFormat={'wav':_0x533b('0x8'),'wav49':_0x533b('0x9'),'gsm':_0x533b('0xa')};var strategy={'rrmemory':_0x533b('0xb'),'roundrobin':_0x533b('0xc')};function VoiceQueue(_0x321878){this['id']=_0x321878['id']||0x0;this[_0x533b('0xd')]=_0x321878[_0x533b('0xd')]||'';this[_0x533b('0xe')]=_0x321878['monitor_format']||'';this[_0x533b('0xf')]=_0x321878['type']||'inbound';this[_0x533b('0x10')]=0x0;this[_0x533b('0x11')]=0x0;this[_0x533b('0x12')]=0x0;this[_0x533b('0x13')]=0x0;this[_0x533b('0x14')]=0x0;this[_0x533b('0x15')]=0x0;this[_0x533b('0x16')]=0x0;this[_0x533b('0x17')]=0x0;this[_0x533b('0x18')]=0x0;this[_0x533b('0x19')]=0x0;this[_0x533b('0x1a')]=0x0;this[_0x533b('0x1b')]=_0x321878[_0x533b('0x1b')]||![];this['acwTimeout']=_0x321878[_0x533b('0x1c')]||0xa;this[_0x533b('0x1d')]=_0x321878[_0x533b('0x1d')]||'no';this[_0x533b('0x1e')]=!![];this[_0x533b('0x1f')]='';this['originated']=0x0;this[_0x533b('0x20')]=0x0;this[_0x533b('0x21')]=_0x321878[_0x533b('0x21')]||null;this[_0x533b('0x22')]=_0x321878[_0x533b('0x22')]?_0x321878['dialGlobalInterval']:null;this[_0x533b('0x23')]=_0x321878[_0x533b('0x23')];this[_0x533b('0x24')]=_0x321878[_0x533b('0x24')]||_0x533b('0x25');this[_0x533b('0x26')]=_0x321878['dialLimitChannel']||0x0;this[_0x533b('0x27')]=_0x321878[_0x533b('0x27')]||0x0;this[_0x533b('0x28')]=_0x321878[_0x533b('0x28')]||0x1;this[_0x533b('0x29')]=_0x321878[_0x533b('0x29')]||_0x533b('0x2a');this[_0x533b('0x2b')]=_0x321878['dialPredictiveOptimizationPercentage']||0.03;this[_0x533b('0x2c')]=_0x321878[_0x533b('0x2c')]||0x258;this[_0x533b('0x2d')]=_0x321878[_0x533b('0x2d')]||_0x533b('0x2e');this[_0x533b('0x2f')]=_0x321878[_0x533b('0x2f')]||_0x533b('0x2e');this[_0x533b('0x30')]=_0x321878[_0x533b('0x30')]||0x1e;this[_0x533b('0x31')]=_0x321878['dialQueueOptions']||_0x533b('0x32');this[_0x533b('0x33')]=_0x321878['dialQueueTimeout']||0x3;this[_0x533b('0x34')]=_0x321878['dialQueueProject']||undefined;this[_0x533b('0x35')]=_0x321878[_0x533b('0x35')]||0x3;this[_0x533b('0x36')]=_0x321878['dialCongestionRetryFrequency']||0x96;this[_0x533b('0x37')]=_0x321878[_0x533b('0x37')]||0x3;this['dialBusyRetryFrequency']=_0x321878[_0x533b('0x38')]||0x96;this[_0x533b('0x39')]=_0x321878['dialNoAnswerMaxRetry']||0x3;this[_0x533b('0x3a')]=_0x321878[_0x533b('0x3a')]||0x96;this[_0x533b('0x3b')]=_0x321878[_0x533b('0x3b')]||0x3;this[_0x533b('0x3c')]=_0x321878[_0x533b('0x3c')]||0x96;this['dialDropMaxRetry']=_0x321878['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x321878[_0x533b('0x3d')]||0x96;this[_0x533b('0x3e')]=_0x321878[_0x533b('0x3e')]||0x3;this[_0x533b('0x3f')]=_0x321878[_0x533b('0x3f')]||0x96;this[_0x533b('0x40')]=_0x321878[_0x533b('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x321878[_0x533b('0x41')]||0x96;this[_0x533b('0x42')]=_0x321878['dialAgentRejectMaxRetry']||0x3;this[_0x533b('0x43')]=_0x321878['dialAgentRejectRetryFrequency']||0x96;this[_0x533b('0x44')]=_0x321878[_0x533b('0x44')]||0x4;this['Trunk']=_0x321878[_0x533b('0x45')]?_0x321878[_0x533b('0x45')]:undefined;this['TrunkBackup']=_0x321878[_0x533b('0x46')]?_0x321878['TrunkBackup']:undefined;this['dialPrefix']=_0x321878[_0x533b('0x47')]||undefined;this[_0x533b('0x48')]=_0x321878[_0x533b('0x48')]?_0x321878[_0x533b('0x48')]:undefined;this[_0x533b('0x49')]=_0x321878['dialOrderByScheduledAt']||_0x533b('0x4a');this[_0x533b('0x4b')]=_0x321878[_0x533b('0x4b')]||undefined;this[_0x533b('0x4c')]=_0x321878[_0x533b('0x4c')]||undefined;this['strategy']=strategy[_0x321878['strategy']]||'rrmemory';this['queueStatusComplete']=!![];this[_0x533b('0x4d')]=_0x321878[_0x533b('0x4d')]||![];this[_0x533b('0x4e')]=_0x321878[_0x533b('0x4e')];this[_0x533b('0x4f')]=_0x321878[_0x533b('0x4f')];this[_0x533b('0x50')]=_0x321878['dialAMDAfterGreetingSilence'];this[_0x533b('0x51')]=_0x321878[_0x533b('0x51')];this[_0x533b('0x52')]=_0x321878['dialAMDMinWordLength'];this[_0x533b('0x53')]=_0x321878[_0x533b('0x53')];this[_0x533b('0x54')]=_0x321878[_0x533b('0x54')];this[_0x533b('0x55')]=_0x321878[_0x533b('0x55')];this[_0x533b('0x56')]=_0x321878[_0x533b('0x56')];this[_0x533b('0x57')]=0x0;this[_0x533b('0x58')]=0x0;this['timeout']=_0x321878[_0x533b('0x59')];this[_0x533b('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x533b('0x5b')]=0x0;this[_0x533b('0x5c')]=0x0;this[_0x533b('0x5d')]=0x0;this[_0x533b('0x5e')]=0x0;this[_0x533b('0x5f')]=0x0;this[_0x533b('0x60')]=0x0;this[_0x533b('0x61')]=0x0;this[_0x533b('0x62')]=0x0;this[_0x533b('0x63')]=0x0;this[_0x533b('0x64')]=0x0;this['outboundReCallsDay']=0x0;this[_0x533b('0x65')]=0x0;this[_0x533b('0x66')]=undefined;this[_0x533b('0x67')]=undefined;this[_0x533b('0x68')]=undefined;this[_0x533b('0x69')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x533b('0x6a')]=0x0;this[_0x533b('0x6b')]=0x0;this[_0x533b('0x6c')]=0x0;this[_0x533b('0x6d')]=0x0;this[_0x533b('0x6e')]=0x0;this[_0x533b('0x6f')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x533b('0x70')]=_0x321878[_0x533b('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x321878[_0x533b('0x71')]||0xa;this[_0x533b('0x72')]=0x0;this[_0x533b('0x73')]=0x0;this[_0x533b('0x74')]=0x1;this[_0x533b('0x75')]=0x0;this[_0x533b('0x76')]=0x0;this[_0x533b('0x77')]=0x0;this[_0x533b('0x78')]=0x0;this[_0x533b('0x79')]=_0x321878['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x321878[_0x533b('0x7a')]||![];this[_0x533b('0x7b')]=_0x321878[_0x533b('0x7b')]||undefined;this[_0x533b('0x7c')]=_0x321878['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x321878[_0x533b('0x7d')]||![];this[_0x533b('0xe')]=monitorFormat[_0x321878['monitor_format']]?monitorFormat[_0x321878['monitor_format']]:undefined;this['mandatoryDisposition']=_0x321878[_0x533b('0x7e')]||![];this[_0x533b('0x7f')]=_0x321878['mandatoryDispositionPause']?_0x321878['mandatoryDispositionPause']:undefined;}module[_0x533b('0x80')]=VoiceQueue; \ No newline at end of file +var _0x7d81=['sumBillable','abandoned','loggedIn','acw','acwTimeout','autopause','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','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','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumDuration'];(function(_0x51b169,_0x5efbc2){var _0x12605a=function(_0x570f5e){while(--_0x570f5e){_0x51b169['push'](_0x51b169['shift']());}};_0x12605a(++_0x5efbc2);}(_0x7d81,0x1c2));var _0x17d8=function(_0x2815d5,_0x3530be){_0x2815d5=_0x2815d5-0x0;var _0x2969bc=_0x7d81[_0x2815d5];return _0x2969bc;};'use strict';var statusDesc=[_0x17d8('0x0'),_0x17d8('0x1'),_0x17d8('0x2'),_0x17d8('0x3'),_0x17d8('0x4'),'unavailable',_0x17d8('0x5'),'ringinuse',_0x17d8('0x6')];var monitorFormat={'wav':'wav','wav49':_0x17d8('0x7'),'gsm':_0x17d8('0x8')};var strategy={'rrmemory':_0x17d8('0x9'),'roundrobin':_0x17d8('0xa')};function VoiceQueue(_0x5462d8){this['id']=_0x5462d8['id']||0x0;this[_0x17d8('0xb')]=_0x5462d8[_0x17d8('0xb')]||'';this[_0x17d8('0xc')]=_0x5462d8[_0x17d8('0xc')]||'';this[_0x17d8('0xd')]=_0x5462d8[_0x17d8('0xd')]||'inbound';this[_0x17d8('0xe')]=0x0;this['talking']=0x0;this[_0x17d8('0xf')]=0x0;this[_0x17d8('0x10')]=0x0;this[_0x17d8('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x17d8('0x12')]=0x0;this['unmanaged']=0x0;this[_0x17d8('0x13')]=0x0;this[_0x17d8('0x14')]=0x0;this['available']=0x0;this[_0x17d8('0x15')]=_0x5462d8['acw']||![];this[_0x17d8('0x16')]=_0x5462d8[_0x17d8('0x16')]||0xa;this[_0x17d8('0x17')]=_0x5462d8[_0x17d8('0x17')]||'no';this['sendMessageOneNotActive']=!![];this[_0x17d8('0x18')]='';this[_0x17d8('0x19')]=0x0;this[_0x17d8('0x1a')]=0x0;this['dialTimezone']=_0x5462d8['dialTimezone']||null;this[_0x17d8('0x1b')]=_0x5462d8[_0x17d8('0x1b')]?_0x5462d8[_0x17d8('0x1b')]:null;this[_0x17d8('0x1c')]=_0x5462d8[_0x17d8('0x1c')];this[_0x17d8('0x1d')]=_0x5462d8[_0x17d8('0x1d')]||_0x17d8('0x1e');this[_0x17d8('0x1f')]=_0x5462d8[_0x17d8('0x1f')]||0x0;this[_0x17d8('0x20')]=_0x5462d8[_0x17d8('0x20')]||0x0;this['dialPowerLevel']=_0x5462d8['dialPowerLevel']||0x1;this[_0x17d8('0x21')]=_0x5462d8[_0x17d8('0x21')]||_0x17d8('0x22');this[_0x17d8('0x23')]=_0x5462d8[_0x17d8('0x23')]||0.03;this[_0x17d8('0x24')]=_0x5462d8['dialPredictiveInterval']||0x258;this[_0x17d8('0x25')]=_0x5462d8[_0x17d8('0x25')]||_0x17d8('0x26');this['dialOriginateCallerIdNumber']=_0x5462d8[_0x17d8('0x27')]||'anonymous';this[_0x17d8('0x28')]=_0x5462d8[_0x17d8('0x28')]||0x1e;this[_0x17d8('0x29')]=_0x5462d8[_0x17d8('0x29')]||_0x17d8('0x2a');this[_0x17d8('0x2b')]=_0x5462d8[_0x17d8('0x2b')]||0x3;this['dialQueueProject']=_0x5462d8[_0x17d8('0x2c')]||undefined;this[_0x17d8('0x2d')]=_0x5462d8[_0x17d8('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x5462d8[_0x17d8('0x2e')]||0x96;this[_0x17d8('0x2f')]=_0x5462d8[_0x17d8('0x2f')]||0x3;this[_0x17d8('0x30')]=_0x5462d8['dialBusyRetryFrequency']||0x96;this[_0x17d8('0x31')]=_0x5462d8[_0x17d8('0x31')]||0x3;this[_0x17d8('0x32')]=_0x5462d8['dialNoAnswerRetryFrequency']||0x96;this[_0x17d8('0x33')]=_0x5462d8[_0x17d8('0x33')]||0x3;this[_0x17d8('0x34')]=_0x5462d8['dialNoSuchNumberRetryFrequency']||0x96;this[_0x17d8('0x35')]=_0x5462d8[_0x17d8('0x35')]||0x3;this[_0x17d8('0x36')]=_0x5462d8[_0x17d8('0x36')]||0x96;this[_0x17d8('0x37')]=_0x5462d8['dialAbandonedMaxRetry']||0x3;this[_0x17d8('0x38')]=_0x5462d8[_0x17d8('0x38')]||0x96;this[_0x17d8('0x39')]=_0x5462d8[_0x17d8('0x39')]||0x3;this['dialMachineRetryFrequency']=_0x5462d8[_0x17d8('0x3a')]||0x96;this[_0x17d8('0x3b')]=_0x5462d8[_0x17d8('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5462d8[_0x17d8('0x3c')]||0x96;this[_0x17d8('0x3d')]=_0x5462d8[_0x17d8('0x3d')]||0x4;this[_0x17d8('0x3e')]=_0x5462d8['Trunk']?_0x5462d8['Trunk']:undefined;this[_0x17d8('0x3f')]=_0x5462d8[_0x17d8('0x3f')]?_0x5462d8['TrunkBackup']:undefined;this['dialPrefix']=_0x5462d8[_0x17d8('0x40')]||undefined;this['Interval']=_0x5462d8[_0x17d8('0x41')]?_0x5462d8['Interval']:undefined;this[_0x17d8('0x42')]=_0x5462d8['dialOrderByScheduledAt']||_0x17d8('0x43');this[_0x17d8('0x44')]=_0x5462d8[_0x17d8('0x44')]||undefined;this['dialCutDigit']=_0x5462d8['dialCutDigit']||undefined;this[_0x17d8('0x45')]=strategy[_0x5462d8[_0x17d8('0x45')]]||'rrmemory';this[_0x17d8('0x46')]=!![];this[_0x17d8('0x47')]=_0x5462d8[_0x17d8('0x47')]||![];this[_0x17d8('0x48')]=_0x5462d8[_0x17d8('0x48')];this[_0x17d8('0x49')]=_0x5462d8['dialAMDGreeting'];this[_0x17d8('0x4a')]=_0x5462d8[_0x17d8('0x4a')];this['dialAMDTotalAnalysisTime']=_0x5462d8['dialAMDTotalAnalysisTime'];this[_0x17d8('0x4b')]=_0x5462d8[_0x17d8('0x4b')];this['dialAMDBetweenWordsSilence']=_0x5462d8[_0x17d8('0x4c')];this[_0x17d8('0x4d')]=_0x5462d8['dialAMDMaximumNumberOfWords'];this[_0x17d8('0x4e')]=_0x5462d8[_0x17d8('0x4e')];this['dialAMDMaximumWordLength']=_0x5462d8[_0x17d8('0x4f')];this[_0x17d8('0x50')]=0x0;this['pTalking']=0x0;this[_0x17d8('0x51')]=_0x5462d8['timeout'];this[_0x17d8('0x52')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x17d8('0x53')]=0x0;this[_0x17d8('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x17d8('0x55')]=0x0;this[_0x17d8('0x56')]=0x0;this[_0x17d8('0x57')]=0x0;this[_0x17d8('0x58')]=0x0;this[_0x17d8('0x59')]=0x0;this[_0x17d8('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x17d8('0x5b')]=0x0;this[_0x17d8('0x5c')]=0x0;this[_0x17d8('0x5d')]=undefined;this[_0x17d8('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x17d8('0x5f')]=1.05;this[_0x17d8('0x60')]=0x0;this[_0x17d8('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x17d8('0x62')]=0x0;this[_0x17d8('0x63')]=0x0;this[_0x17d8('0x64')]=0x0;this['predictiveIntervalMaxThreshold']=_0x5462d8['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x17d8('0x65')]=_0x5462d8[_0x17d8('0x66')]||0xa;this[_0x17d8('0x67')]=0x0;this[_0x17d8('0x68')]=0x0;this[_0x17d8('0x69')]=0x1;this[_0x17d8('0x6a')]=0x0;this[_0x17d8('0x6b')]=0x0;this[_0x17d8('0x6c')]=0x0;this[_0x17d8('0x6d')]=0x0;this[_0x17d8('0x6e')]=_0x5462d8['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x5462d8['dialRecallInQueue']||![];this[_0x17d8('0x6f')]=_0x5462d8[_0x17d8('0x6f')]||undefined;this[_0x17d8('0x70')]=_0x5462d8[_0x17d8('0x70')]||![];this[_0x17d8('0x71')]=_0x5462d8[_0x17d8('0x71')]||![];this[_0x17d8('0xc')]=monitorFormat[_0x5462d8[_0x17d8('0xc')]]?monitorFormat[_0x5462d8[_0x17d8('0xc')]]:undefined;this[_0x17d8('0x72')]=_0x5462d8[_0x17d8('0x72')]||![];this['mandatoryDispositionPause']=_0x5462d8['mandatoryDispositionPause']?_0x5462d8[_0x17d8('0x73')]:undefined;}module[_0x17d8('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b299ed5..3bc926e 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 _0x2b24=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x55437b,_0x51b271){var _0x3878b0=function(_0x5e3edc){while(--_0x5e3edc){_0x55437b['push'](_0x55437b['shift']());}};_0x3878b0(++_0x51b271);}(_0x2b24,0x82));var _0x42b2=function(_0x44c5a3,_0x1b32fe){_0x44c5a3=_0x44c5a3-0x0;var _0x54305c=_0x2b24[_0x44c5a3];return _0x54305c;};'use strict';function VtigerAccount(_0x5c2dd0){this['id']=_0x5c2dd0['id']||0x0;this['name']=_0x5c2dd0[_0x42b2('0x0')]||'';this[_0x42b2('0x1')]=_0x5c2dd0[_0x42b2('0x1')]||'';this[_0x42b2('0x2')]=_0x5c2dd0['accessKey']||'';this[_0x42b2('0x3')]=_0x5c2dd0[_0x42b2('0x3')]||'';this[_0x42b2('0x4')]=_0x5c2dd0[_0x42b2('0x4')]||'';this['Configurations']=_0x5c2dd0[_0x42b2('0x5')]||{};}module[_0x42b2('0x6')]=VtigerAccount; \ No newline at end of file +var _0xec22=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x11f2e4,_0x2a8c65){var _0x2688c7=function(_0x5645e8){while(--_0x5645e8){_0x11f2e4['push'](_0x11f2e4['shift']());}};_0x2688c7(++_0x2a8c65);}(_0xec22,0x141));var _0x2ec2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xec22[_0x46e363];return _0x3fb059;};'use strict';function VtigerAccount(_0x4aeef4){this['id']=_0x4aeef4['id']||0x0;this[_0x2ec2('0x0')]=_0x4aeef4[_0x2ec2('0x0')]||'';this['username']=_0x4aeef4[_0x2ec2('0x1')]||'';this[_0x2ec2('0x2')]=_0x4aeef4[_0x2ec2('0x2')]||'';this[_0x2ec2('0x3')]=_0x4aeef4['remoteUri']||'';this[_0x2ec2('0x4')]=_0x4aeef4['serverUrl']||'';this[_0x2ec2('0x5')]=_0x4aeef4[_0x2ec2('0x5')]||{};}module[_0x2ec2('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 c4d732f..813d75c 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x3b5aa7,_0x141f82){var _0x3769a8=function(_0x502163){while(--_0x502163){_0x3b5aa7['push'](_0x3b5aa7['shift']());}};_0x3769a8(++_0x141f82);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9a3bf5,_0x3d28fa){_0x9a3bf5=_0x9a3bf5-0x0;var _0x3f5959=_0x5f2f[_0x9a3bf5];return _0x3f5959;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x7a54,0x106));var _0x47a5=function(_0x446db4,_0x3addd7){_0x446db4=_0x446db4-0x0;var _0x5111dc=_0x7a54[_0x446db4];return _0x5111dc;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b07e430..4773c9c 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 _0x215d=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x215d,0x187));var _0xd215=function(_0x4f4c3f,_0x41421d){_0x4f4c3f=_0x4f4c3f-0x0;var _0x144839=_0x215d[_0x4f4c3f];return _0x144839;};'use strict';function ZohoAccount(_0x483fc8){this['id']=_0x483fc8['id']||0x0;this['name']=_0x483fc8[_0xd215('0x0')]||'';this[_0xd215('0x1')]=_0x483fc8[_0xd215('0x1')]||'';this[_0xd215('0x2')]=_0x483fc8[_0xd215('0x2')]||'';this[_0xd215('0x3')]=_0x483fc8['zone']||'';this[_0xd215('0x4')]=_0x483fc8['clientId']||'';this[_0xd215('0x5')]=_0x483fc8[_0xd215('0x5')]||'';this[_0xd215('0x6')]=_0x483fc8['serverUrl']||'';this[_0xd215('0x7')]=_0x483fc8['code']||'';this[_0xd215('0x8')]=_0x483fc8[_0xd215('0x8')]||'';this[_0xd215('0x9')]=_0x483fc8['Configurations']||{};}module[_0xd215('0xa')]=ZohoAccount; \ No newline at end of file +var _0x05e3=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x1d03d9,_0x5797e1){var _0x1740ef=function(_0x48285f){while(--_0x48285f){_0x1d03d9['push'](_0x1d03d9['shift']());}};_0x1740ef(++_0x5797e1);}(_0x05e3,0x86));var _0x305e=function(_0x574c3b,_0x56c826){_0x574c3b=_0x574c3b-0x0;var _0x24ea08=_0x05e3[_0x574c3b];return _0x24ea08;};'use strict';function ZohoAccount(_0xffee6c){this['id']=_0xffee6c['id']||0x0;this[_0x305e('0x0')]=_0xffee6c[_0x305e('0x0')]||'';this['description']=_0xffee6c['description']||'';this[_0x305e('0x1')]=_0xffee6c[_0x305e('0x1')]||'';this['zone']=_0xffee6c[_0x305e('0x2')]||'';this[_0x305e('0x3')]=_0xffee6c['clientId']||'';this[_0x305e('0x4')]=_0xffee6c[_0x305e('0x4')]||'';this[_0x305e('0x5')]=_0xffee6c[_0x305e('0x5')]||'';this[_0x305e('0x6')]=_0xffee6c[_0x305e('0x6')]||'';this[_0x305e('0x7')]=_0xffee6c[_0x305e('0x7')]||'';this['Configurations']=_0xffee6c[_0x305e('0x8')]||{};}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 c0ac195..2915c14 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 _0x58ec=['lodash','moment','isNil','string','idContact','queue','type','campaigntype','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports'];(function(_0x183e90,_0x25fd67){var _0x12b385=function(_0x122ded){while(--_0x122ded){_0x183e90['push'](_0x183e90['shift']());}};_0x12b385(++_0x25fd67);}(_0x58ec,0x1d9));var _0xc58e=function(_0x1947f5,_0x21981c){_0x1947f5=_0x1947f5-0x0;var _0x58a985=_0x58ec[_0x1947f5];return _0x58a985;};'use strict';var util=require('util');var _=require(_0xc58e('0x0'));var moment=require(_0xc58e('0x1'));function checkNameSurname(_0x53b2bb,_0x5319f3,_0xbab28c){var _0x5e91cd='';if(!_[_0xc58e('0x2')](_0x5319f3)&&'string'===typeof _0x5319f3){_0x5e91cd+=_0x5319f3;}if(!_[_0xc58e('0x2')](_0xbab28c)&&_0xc58e('0x3')===typeof _0xbab28c){_0x5e91cd+='\x20'+_0xbab28c;}if(_0x5e91cd!==''){return _0x5e91cd;}return _0x53b2bb;}function Action(_0x5999b5,_0x391feb,_0xb58678,_0x1c6d0f,_0x5113f9){this['uniqueid']=_0xb58678||undefined;this[_0xc58e('0x4')]=_0x5999b5['id'];this[_0xc58e('0x5')]=_0x391feb['name'];this[_0xc58e('0x6')]=_0x391feb[_0xc58e('0x6')];this[_0xc58e('0x7')]=_0xc58e('0x5');this[_0xc58e('0x8')]=![];this['membername']=_[_0xc58e('0x2')](_0x5999b5['Agent'])?undefined:_0x5999b5[_0xc58e('0x9')][_0xc58e('0xa')];this[_0xc58e('0xb')]=this['membername']?util[_0xc58e('0xc')](_0xc58e('0xd'),this[_0xc58e('0xe')]):_0x1c6d0f||undefined;this[_0xc58e('0xf')]=checkNameSurname(_0x5999b5[_0xc58e('0x10')]['phone'],_0x5999b5[_0xc58e('0x10')]['firstName'],_0x5999b5[_0xc58e('0x10')][_0xc58e('0x11')]);this[_0xc58e('0x12')]=_0x5999b5[_0xc58e('0x12')]||![];this[_0xc58e('0x13')]=_0x5999b5['Contact'][_0xc58e('0x14')];this['scheduledat']=_0x5999b5[_0xc58e('0x15')];this[_0xc58e('0x16')]=_0x5999b5['countbusyretry']||0x0;this[_0xc58e('0x17')]=_0x5999b5[_0xc58e('0x17')]||0x0;this[_0xc58e('0x18')]=_0x5999b5[_0xc58e('0x18')]||0x0;this[_0xc58e('0x19')]=(_0x5999b5[_0xc58e('0x16')]||0x0)+(_0x5999b5['countcongestionretry']||0x0)+(_0x5999b5[_0xc58e('0x18')]||0x0)+(_0x5999b5[_0xc58e('0x1a')]||0x0)+(_0x5999b5[_0xc58e('0x1b')]||0x0)+(_0x5999b5['countabandonedretry']||0x0)+(_0x5999b5[_0xc58e('0x1c')]||0x0)+(_0x5999b5[_0xc58e('0x1d')]||0x0);this['countnosuchnumberretry']=_0x5999b5[_0xc58e('0x1a')]||0x0;this['countdropretry']=_0x5999b5[_0xc58e('0x1b')]||0x0;this[_0xc58e('0x1e')]=_0x5999b5[_0xc58e('0x1e')]||0x0;this['countmachineretry']=_0x5999b5['countmachineretry']||0x0;this['countagentrejectretry']=_0x5999b5[_0xc58e('0x1d')]||0x0;this[_0xc58e('0x1f')]=_0x5999b5[_0xc58e('0x1f')];this['callbackuniqueid']=_0x5999b5['callbackuniqueid'];this[_0xc58e('0x20')]=_0x5999b5['callbackat'];this[_0xc58e('0x21')]=_0x5999b5[_0xc58e('0x21')];this[_0xc58e('0x22')]=_0x5999b5[_0xc58e('0x22')];this['ListId']=_0x5999b5[_0xc58e('0x23')];this[_0xc58e('0x24')]=_[_0xc58e('0x2')](_0x5999b5['Agent'])?_0x5999b5['UserId']:_0x5999b5[_0xc58e('0x9')]['id'];this['VoiceQueueId']=_0x5999b5[_0xc58e('0x25')];this['originatecalleridnum']='';this[_0xc58e('0x26')]='';}Action['prototype'][_0xc58e('0x27')]=function(){return util[_0xc58e('0xc')](_0xc58e('0x28'),this[_0xc58e('0xf')],this[_0xc58e('0x29')]);};module[_0xc58e('0x2a')]=Action; \ No newline at end of file +var _0xb06e=['isNil','uniqueid','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','string'];(function(_0x514f24,_0xe54e86){var _0x80634c=function(_0x785ee5){while(--_0x785ee5){_0x514f24['push'](_0x514f24['shift']());}};_0x80634c(++_0xe54e86);}(_0xb06e,0x1c0));var _0xeb06=function(_0x13c0f3,_0x33d4bf){_0x13c0f3=_0x13c0f3-0x0;var _0x1c2c33=_0xb06e[_0x13c0f3];return _0x1c2c33;};'use strict';var util=require(_0xeb06('0x0'));var _=require(_0xeb06('0x1'));var moment=require('moment');function checkNameSurname(_0x161d3d,_0x32d1c7,_0x5b237d){var _0x30061d='';if(!_['isNil'](_0x32d1c7)&&_0xeb06('0x2')===typeof _0x32d1c7){_0x30061d+=_0x32d1c7;}if(!_[_0xeb06('0x3')](_0x5b237d)&&_0xeb06('0x2')===typeof _0x5b237d){_0x30061d+='\x20'+_0x5b237d;}if(_0x30061d!==''){return _0x30061d;}return _0x161d3d;}function Action(_0x31a63e,_0x3a5403,_0x2c9598,_0x484f7e,_0x2d692c){this[_0xeb06('0x4')]=_0x2c9598||undefined;this['idContact']=_0x31a63e['id'];this[_0xeb06('0x5')]=_0x3a5403[_0xeb06('0x6')];this[_0xeb06('0x7')]=_0x3a5403[_0xeb06('0x7')];this['campaigntype']=_0xeb06('0x5');this[_0xeb06('0x8')]=![];this[_0xeb06('0x9')]=_['isNil'](_0x31a63e[_0xeb06('0xa')])?undefined:_0x31a63e[_0xeb06('0xa')][_0xeb06('0x6')];this[_0xeb06('0xb')]=this[_0xeb06('0x9')]?util[_0xeb06('0xc')](_0xeb06('0xd'),this[_0xeb06('0x9')]):_0x484f7e||undefined;this[_0xeb06('0xe')]=checkNameSurname(_0x31a63e[_0xeb06('0xf')]['phone'],_0x31a63e[_0xeb06('0xf')][_0xeb06('0x10')],_0x31a63e[_0xeb06('0xf')]['lastName']);this['active']=_0x31a63e[_0xeb06('0x11')]||![];this['calleridnum']=_0x31a63e[_0xeb06('0xf')][_0xeb06('0x12')];this[_0xeb06('0x13')]=_0x31a63e['scheduledat'];this[_0xeb06('0x14')]=_0x31a63e[_0xeb06('0x14')]||0x0;this['countcongestionretry']=_0x31a63e[_0xeb06('0x15')]||0x0;this['countnoanswerretry']=_0x31a63e[_0xeb06('0x16')]||0x0;this['countglobal']=(_0x31a63e[_0xeb06('0x14')]||0x0)+(_0x31a63e[_0xeb06('0x15')]||0x0)+(_0x31a63e['countnoanswerretry']||0x0)+(_0x31a63e[_0xeb06('0x17')]||0x0)+(_0x31a63e['countdropretry']||0x0)+(_0x31a63e[_0xeb06('0x18')]||0x0)+(_0x31a63e['countmachineretry']||0x0)+(_0x31a63e[_0xeb06('0x19')]||0x0);this[_0xeb06('0x17')]=_0x31a63e['countnosuchnumberretry']||0x0;this['countdropretry']=_0x31a63e[_0xeb06('0x1a')]||0x0;this[_0xeb06('0x18')]=_0x31a63e[_0xeb06('0x18')]||0x0;this[_0xeb06('0x1b')]=_0x31a63e['countmachineretry']||0x0;this[_0xeb06('0x19')]=_0x31a63e[_0xeb06('0x19')]||0x0;this[_0xeb06('0x1c')]=_0x31a63e['callback'];this[_0xeb06('0x1d')]=_0x31a63e['callbackuniqueid'];this['callbackat']=_0x31a63e[_0xeb06('0x1e')];this[_0xeb06('0x1f')]=_0x31a63e[_0xeb06('0x1f')];this[_0xeb06('0x20')]=_0x31a63e['ContactId'];this[_0xeb06('0x21')]=_0x31a63e[_0xeb06('0x21')];this['UserId']=_[_0xeb06('0x3')](_0x31a63e[_0xeb06('0xa')])?_0x31a63e['UserId']:_0x31a63e[_0xeb06('0xa')]['id'];this[_0xeb06('0x22')]=_0x31a63e[_0xeb06('0x22')];this['originatecalleridnum']='';this[_0xeb06('0x23')]='';}Action[_0xeb06('0x24')][_0xeb06('0x25')]=function(){return util[_0xeb06('0xc')](_0xeb06('0x26'),this['calleridname'],this[_0xeb06('0x27')]);};module[_0xeb06('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 505353a..ee880bc 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 _0x6259=['decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','RecallInQueue','createBody','createCustomerHistory','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','buildObj','connect','acw','emit','custom:agentConnectPreview','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','dialBusyRetryFrequency','countagentrejectretry','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','phone','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','responsetime','isFailure','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','name','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','recallMe','clearZombieChannel','enqueue','isNil','Queue','actions','queue','pick','contactId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','dialAnswer'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x6259,0xcd));var _0x9625=function(_0x1fbe45,_0x2b0a68){_0x1fbe45=_0x1fbe45-0x0;var _0x7af79e=_0x6259[_0x1fbe45];return _0x7af79e;};'use strict';var util=require(_0x9625('0x0'));var _=require(_0x9625('0x1'));var BPromise=require(_0x9625('0x2'));var uuid=require(_0x9625('0x3'));var moment=require(_0x9625('0x4'));var md5=require(_0x9625('0x5'));var Redis=require('ioredis');var config=require(_0x9625('0x6'));var logger=require(_0x9625('0x7'))(_0x9625('0x8'));var loggerAction=require(_0x9625('0x7'))(_0x9625('0x9'));var ami=require(_0x9625('0xa'));var rpcDb=require(_0x9625('0xb'));var Action=require('./action');var ut=require(_0x9625('0xc'));config[_0x9625('0xd')]=_[_0x9625('0xe')](config['redis'],{'host':_0x9625('0xf'),'port':0x18eb});var io=require(_0x9625('0x10'))(new Redis(config[_0x9625('0xd')]));var Sequence=function(){};Sequence[_0x9625('0x11')]['enqueue']=function(_0x10babc){this[_0x9625('0x12')]=this[_0x9625('0x12')]?this['tail'][_0x9625('0x13')](_0x10babc):_0x10babc();};function Preview(_0x3cb2b7){this['sequence']=new Sequence();this[_0x9625('0x14')]=_0x3cb2b7[_0x9625('0x15')];this['trunks']=_0x3cb2b7[_0x9625('0x16')];this['actions']={};this[_0x9625('0x17')]=_0x3cb2b7['agents'];this[_0x9625('0x18')]=0x0;ami['on'](_0x9625('0x19'),this[_0x9625('0x1a')][_0x9625('0x1b')](this));ami['on'](_0x9625('0x1c'),this[_0x9625('0x1d')][_0x9625('0x1b')](this));ami['on'](_0x9625('0x1e'),this[_0x9625('0x1f')]['bind'](this));ami['on'](_0x9625('0x20'),this[_0x9625('0x21')][_0x9625('0x1b')](this));ami['on']('newexten',this[_0x9625('0x22')][_0x9625('0x1b')](this));ami['on'](_0x9625('0x23'),this[_0x9625('0x24')][_0x9625('0x1b')](this));ami['on'](_0x9625('0x25'),this['syncAttendedTransfer'][_0x9625('0x1b')](this));ami['on'](_0x9625('0x26'),this[_0x9625('0x27')][_0x9625('0x1b')](this));this[_0x9625('0x28')](this[_0x9625('0x14')]);}function emit(_0x5def21,_0x5a0fd0,_0x1722a7){io['to'](_0x5def21)['emit'](_0x5a0fd0,_0x1722a7);}function emitCampaignPreview(_0x3fbb03){if(_0x3fbb03[_0x9625('0x29')]==='outbound'){var _0x201051={'id':_0x3fbb03['id'],'name':_0x3fbb03[_0x9625('0x2a')],'strategy':_0x3fbb03[_0x9625('0x2b')],'answered':_0x3fbb03['answered'],'available':_0x3fbb03['available'],'loggedIn':_0x3fbb03[_0x9625('0x2c')],'pTalking':_0x3fbb03[_0x9625('0x2d')],'sumBillable':_0x3fbb03[_0x9625('0x2e')],'sumDuration':_0x3fbb03[_0x9625('0x2f')],'sumHoldTime':_0x3fbb03[_0x9625('0x30')]||0x0,'talking':_0x3fbb03[_0x9625('0x31')],'total':_0x3fbb03[_0x9625('0x32')],'type':_0x3fbb03[_0x9625('0x29')],'unmanaged':_0x3fbb03[_0x9625('0x33')],'abandoned':_0x3fbb03[_0x9625('0x34')],'waiting':_0x3fbb03[_0x9625('0x35')],'loggedInDb':_0x3fbb03[_0x9625('0x36')],'dialActive':_0x3fbb03['dialActive'],'dialMethod':_0x3fbb03[_0x9625('0x37')],'dialOriginateCallerIdName':_0x3fbb03[_0x9625('0x38')],'dialOriginateCallerIdNumber':_0x3fbb03[_0x9625('0x39')],'dialOriginateTimeout':_0x3fbb03['dialOriginateTimeout'],'dialPrefix':_0x3fbb03['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3fbb03[_0x9625('0x3a')],'outboundAnswerCallsDay':_0x3fbb03[_0x9625('0x3b')],'outboundBlacklistCallsDay':_0x3fbb03['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3fbb03[_0x9625('0x3c')],'outboundCongestionCallsDay':_0x3fbb03[_0x9625('0x3d')],'outboundDropCallsDayACS':_0x3fbb03[_0x9625('0x3e')],'outboundDropCallsDayCallersExit':_0x3fbb03['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3fbb03[_0x9625('0x3f')],'outboundNoAnswerCallsDay':_0x3fbb03[_0x9625('0x40')],'outboundNoSuchCallsDay':_0x3fbb03[_0x9625('0x41')],'outboundOriginateFailureCallsDay':_0x3fbb03[_0x9625('0x42')],'outboundReCallsDay':_0x3fbb03[_0x9625('0x43')],'outboundRejectCallsDay':_0x3fbb03[_0x9625('0x44')],'outboundUnknownCallsDay':_0x3fbb03[_0x9625('0x45')],'outboundAbandonedCallsDay':_0x3fbb03[_0x9625('0x46')],'predictiveIntervalAnsweredCalls':_0x3fbb03[_0x9625('0x47')],'predictiveIntervalAvgHoldtime':_0x3fbb03[_0x9625('0x48')],'predictiveIntervalAvgTalktime':_0x3fbb03[_0x9625('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x3fbb03[_0x9625('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x3fbb03[_0x9625('0x4b')],'predictiveIntervalErlangCalls':_0x3fbb03['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3fbb03['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3fbb03['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3fbb03[_0x9625('0x4c')],'predictiveIntervalPauses':_0x3fbb03['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3fbb03['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3fbb03[_0x9625('0x4d')],'message':_0x3fbb03[_0x9625('0x4e')],'originated':_0x3fbb03[_0x9625('0x4f')],'erlangCalls':_0x3fbb03[_0x9625('0x50')],'erlangCallToSecond':_0x3fbb03[_0x9625('0x51')],'erlangAbandonmentRate':_0x3fbb03[_0x9625('0x52')],'erlangBusyFactor':_0x3fbb03['erlangBusyFactor'],'startPredictive':_0x3fbb03[_0x9625('0x53')],'startProgressive':_0x3fbb03[_0x9625('0x54')]};if(_0x3fbb03['Trunk']){_0x201051[_0x9625('0x55')]={'id':_0x3fbb03[_0x9625('0x55')]['id'],'name':_0x3fbb03['Trunk']['name'],'active':_0x3fbb03[_0x9625('0x55')][_0x9625('0x56')],'callerid':_0x3fbb03[_0x9625('0x55')]['callerid']};}if(_0x3fbb03[_0x9625('0x57')]){_0x201051[_0x9625('0x57')]={'id':_0x3fbb03[_0x9625('0x57')]['id'],'name':_0x3fbb03[_0x9625('0x57')][_0x9625('0x2a')]};}var _0x4cdecf=md5(JSON[_0x9625('0x58')](_0x201051));if(_0x3fbb03[_0x9625('0x5')]!==_0x4cdecf){_0x3fbb03[_0x9625('0x5')]=_0x4cdecf;emit(util[_0x9625('0x59')](_0x9625('0x5a'),_0x201051['name']),_0x9625('0x5b'),_0x201051);}}}function emitVoiceQueueChannelRemove(_0x58ffef){logger[_0x9625('0x5c')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x9625('0x58')](_0x58ffef));emit(util[_0x9625('0x59')](_0x9625('0x5a'),_0x58ffef['name']),_0x9625('0x5d'),_0x58ffef);}function notSendMessagesQueue(_0x5c8b39){if(_0x5c8b39['sendMessageOneNotActive']){if(_0x5c8b39[_0x9625('0x4f')]===0x0&&_0x5c8b39[_0x9625('0x2d')]===0x0){_0x5c8b39[_0x9625('0x5e')]=![];_0x5c8b39[_0x9625('0x5f')]=0x0;_0x5c8b39[_0x9625('0x60')]=0x0;_0x5c8b39[_0x9625('0x4e')]=_0x9625('0x61');ut[_0x9625('0x62')](_0x9625('0x63'),_0x5c8b39[_0x9625('0x2a')]+_0x9625('0x64'));}else{_0x5c8b39['message']=_0x9625('0x65');ut[_0x9625('0x62')](_0x9625('0x63'),_0x5c8b39[_0x9625('0x2a')]+_0x9625('0x66'));}emitCampaignPreview(_0x5c8b39);}}Preview[_0x9625('0x11')][_0x9625('0x28')]=function(){var _0x1ae151=this;setInterval(function(){_0x1ae151['syncCampaigns']();},0x7cf);};Preview[_0x9625('0x11')][_0x9625('0x67')]=function(){var _0x575951=this[_0x9625('0x14')];this[_0x9625('0x18')]+=0x1;for(var _0x4f5594 in _0x575951){if(_0x575951[_0x9625('0x68')](_0x4f5594)&&(_0x575951[_0x4f5594][_0x9625('0x37')]===_0x9625('0x8')||_0x575951[_0x4f5594][_0x9625('0x37')]==='booked')&&_0x575951[_0x4f5594][_0x9625('0x29')]===_0x9625('0x69')){if(this[_0x9625('0x18')]>0x7){this[_0x9625('0x18')]=0x0;this[_0x9625('0x6a')]();}}if(_0x575951[_0x9625('0x68')](_0x4f5594)&&_0x575951[_0x4f5594][_0x9625('0x37')]===_0x9625('0x8')&&_0x575951[_0x4f5594]['type']==='outbound'){if(_0x575951[_0x4f5594]['dialActive']){this['setMessage'](_0x575951[_0x4f5594]);this[_0x9625('0x6b')](_0x575951[_0x4f5594]);}else{notSendMessagesQueue(_0x575951[_0x4f5594]);}}}};Preview[_0x9625('0x11')][_0x9625('0x6c')]=function(_0xb54840){var _0xb5517c=this;this['sequence'][_0x9625('0x6d')](function(){if(!_[_0x9625('0x6e')](_0xb5517c['actions'][_0xb54840])){loggerAction[_0x9625('0x5c')]('[clearZombieChannels][talking]',_0xb54840,_0x9625('0x6f'),_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x71')],'originated:\x20',JSON[_0x9625('0x58')](_0xb5517c[_0x9625('0x14')][_0xb5517c[_0x9625('0x70')][_0xb54840]['queue']]['originated']),'pTalking:\x20',JSON[_0x9625('0x58')](_0xb5517c[_0x9625('0x14')][_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x71')]][_0x9625('0x2d')]),JSON[_0x9625('0x58')](_0xb5517c['actions'][_0xb54840]['dialAnswer']),JSON['stringify'](_[_0x9625('0x72')](_0xb5517c[_0x9625('0x70')][_0xb54840],[_0x9625('0x73'),'UserId',_0x9625('0x74'),'ListId'])));return ami[_0x9625('0x75')]({'action':_0x9625('0x76'),'channel':_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x77')]})[_0x9625('0x78')](function(_0x2d0349){if(_0x2d0349['message']===_0x9625('0x79')){setTimeout(function(){if(_0xb5517c[_0x9625('0x70')][_0xb54840]){ut['updateOriginated'](_0xb5517c[_0x9625('0x14')][_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x71')]],_0x9625('0x7a'));if(_0xb5517c['actions'][_0xb54840][_0x9625('0x7b')]===!![]){ut[_0x9625('0x7c')](_0xb5517c[_0x9625('0x14')][_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x71')]],_0x9625('0x7a'));ut[_0x9625('0x7d')](_0x9625('0x7e')+_0xb54840,_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x71')]);}ut['loggerError'](_0x9625('0x7f')+_0xb54840,_0xb5517c[_0x9625('0x70')][_0xb54840][_0x9625('0x71')]);delete _0xb5517c['actions'][_0xb54840];}},0x2328);}});}});};Preview[_0x9625('0x11')][_0x9625('0x6a')]=function(){var _0x7fab5b=this;loggerAction[_0x9625('0x5c')](_0x9625('0x80'),_[_0x9625('0x81')](this[_0x9625('0x70')]));for(var _0x5a7aef in this[_0x9625('0x70')]){if(_0x7fab5b['actions'][_0x9625('0x68')](_0x5a7aef)){_0x7fab5b['clearZombieChannel'](_0x5a7aef);}}};Preview[_0x9625('0x11')][_0x9625('0x6b')]=function(_0x29fe21){var _0x3dc245=this;rpcDb['getContactRecallMe'](_0x29fe21['id'],ut['agentReadyId'](this[_0x9625('0x17')]))[_0x9625('0x82')](function(_0x3a10ae){if(!_['isNil'](_0x3a10ae)){for(var _0xf96f82=0x0;_0xf96f82<_0x3a10ae[_0x9625('0x83')];_0xf96f82+=0x1){if(ut[_0x9625('0x84')](_0x3a10ae[_0xf96f82][_0x9625('0x85')])<_0x29fe21[_0x9625('0x86')]*0x3c){if(_0x3a10ae[_0xf96f82][_0x9625('0x87')]&&!_0x3a10ae[_0xf96f82][_0x9625('0x87')]['voicePause']){_0x3dc245['run'](_0x3a10ae[_0xf96f82]['id'])[_0x9625('0x82')](ut[_0x9625('0x88')](_0x9625('0x89')))[_0x9625('0x78')](ut[_0x9625('0x88')](_0x9625('0x89')));}else{rpcDb[_0x9625('0x8a')](_0x3a10ae[_0xf96f82]['id']);}}else{var _0x16049e=new Action(_0x3a10ae[_0xf96f82],_0x29fe21);_0x16049e['starttime']=moment()[_0x9625('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x29fe21[_0x9625('0x43')]+=0x1;ut['logCustomer'](_0x16049e,0x17,_0x9625('0x8b'));if(_0x29fe21['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x9625('0x8c')](_0x3a10ae[_0xf96f82]));rpcDb[_0x9625('0x8d')](_0x16049e,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x9625('0x8e')](_0x16049e,0x16,'RecallFailedTimeout');rpcDb[_0x9625('0x8d')](_0x16049e,_0x9625('0x8f'));rpcDb[_0x9625('0x90')](_0x16049e,'[HistoryRecallClose]');}}}}})[_0x9625('0x78')](ut['logger2'](_0x9625('0x91')));};Preview[_0x9625('0x11')][_0x9625('0x92')]=function(_0x4ed7d9){_0x4ed7d9['sendMessageOneNotActive']=!![];if(ut[_0x9625('0x93')](_0x4ed7d9[_0x9625('0x2c')])){_0x4ed7d9[_0x9625('0x4e')]=_0x9625('0x94');}else if(!ut[_0x9625('0x95')](_0x4ed7d9['dialActive'])){_0x4ed7d9[_0x9625('0x4e')]=_0x9625('0x61');}else if(!this[_0x9625('0x96')](_0x4ed7d9['Trunk'])){if(!this[_0x9625('0x96')](_0x4ed7d9[_0x9625('0x97')])){_0x4ed7d9[_0x9625('0x4e')]=_0x9625('0x98');}else{_0x4ed7d9[_0x9625('0x4e')]=_0x9625('0x99');}}else{_0x4ed7d9['message']=_0x9625('0x99');}emitCampaignPreview(_0x4ed7d9);};Preview[_0x9625('0x11')][_0x9625('0x9a')]=function(_0x4f22f0,_0x4c8b38,_0x51018c){var _0x4c198e=this;var _0x54a0c5=this[_0x9625('0x70')][_0x4c8b38];var _0x23e5e8=this['campaignsPreview'][_0x54a0c5[_0x9625('0x71')]];var _0x2a2624;if(_0x23e5e8){switch(_0x51018c){case'1':_0x23e5e8[_0x9625('0x41')]+=0x1;_0x54a0c5[_0x9625('0x9b')]+=0x1;_0x54a0c5[_0x9625('0x9c')]=ut[_0x9625('0x9d')](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0x0,'NoSuchNumber');ami['emit'](_0x9625('0x9e'),ut['buildObj'](_0x54a0c5,_0x9625('0x9f')));rpcDb[_0x9625('0x8d')](_0x54a0c5,_0x9625('0xa0'));if(ut[_0x9625('0x9d')](_0x54a0c5)>=_0x23e5e8[_0x9625('0xa1')]){_0x2a2624=ut['cloneAction'](_0x54a0c5,0xf,_0x9625('0xa2'));rpcDb[_0x9625('0x90')](_0x2a2624,_0x9625('0xa3'));}else{if(_0x54a0c5[_0x9625('0x9b')]>=_0x23e5e8[_0x9625('0xa4')]){rpcDb[_0x9625('0x90')](_0x54a0c5,_0x9625('0xa3'));}else{rpcDb['rescheduleContact'](ut[_0x9625('0xa5')](_0x54a0c5,_0x9625('0x9b'),_0x23e5e8[_0x9625('0xa6')]),_0x54a0c5[_0x9625('0xa7')],_0x54a0c5[_0x9625('0xa8')]);}}delete this['actions'][_0x4f22f0[_0x9625('0xa9')]];break;case'ANSWER':var _0x44a221=moment()[_0x9625('0x59')](_0x9625('0xaa'));_0x54a0c5['responsetime']=_0x44a221;_0x54a0c5[_0x9625('0xab')]=_0x44a221;_0x54a0c5['dialAnswer']=!![];_0x23e5e8['pTalking']+=0x1;logger['info'](_0x9625('0xac'),_0x54a0c5['uniqueid'],_0x9625('0xad'),_0x23e5e8[_0x9625('0x2a')],_0x9625('0xae'),_0x23e5e8['pTalking']);ami['emit']('custom:agentconnect',ut[_0x9625('0xaf')](_0x54a0c5,_0x9625('0xb0')));if(_0x23e5e8[_0x9625('0xb1')]){ami[_0x9625('0xb2')](_0x9625('0xb3'),ut['buildAcw'](_0x54a0c5));}break;case'16':ami['emit'](_0x9625('0xb4'),ut[_0x9625('0xaf')](_0x54a0c5,_0x9625('0xb5')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x54a0c5,_0x9625('0xb5')));_0x23e5e8['outboundAnswerCallsDay']+=0x1;_0x23e5e8['total']+=0x1;_0x23e5e8[_0x9625('0xb6')]+=0x1;ut[_0x9625('0x7c')](_0x23e5e8,_0x9625('0xb7'));_0x54a0c5[_0x9625('0x9c')]=ut['totalGlobal'](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0x4,_0x9625('0xb8'));rpcDb[_0x9625('0x8d')](_0x54a0c5,_0x9625('0xb9'));rpcDb['createCustomerFinal'](_0x54a0c5,_0x9625('0xba'));rpcDb['crateCustomerReportQueue'](_0x54a0c5);_0x23e5e8[_0x9625('0x2f')]+=_0x54a0c5[_0x9625('0xbb')];_0x23e5e8[_0x9625('0x2e')]+=_0x54a0c5['talktime'];logger['info'](_0x9625('0xbc'),_0x54a0c5[_0x9625('0xbd')],'\x20Queue',_0x23e5e8[_0x9625('0x2a')],'pTalking:\x20',_0x23e5e8[_0x9625('0x2d')]);delete this[_0x9625('0x70')][_0x4f22f0['linkedid']];break;case _0x9625('0xbe'):_0x23e5e8['outboundBusyCallsDay']+=0x1;_0x54a0c5[_0x9625('0xbf')]+=0x1;_0x54a0c5[_0x9625('0x9c')]=ut['totalGlobal'](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0x5,_0x9625('0xc0'));ami['emit'](_0x9625('0xc1'),ut['buildObj'](_0x54a0c5,_0x9625('0xc2')));rpcDb[_0x9625('0x8d')](_0x54a0c5,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x9625('0x9d')](_0x54a0c5)>=_0x23e5e8[_0x9625('0xa1')]){_0x2a2624=ut['cloneAction'](_0x54a0c5,0xf,_0x9625('0xa2'));rpcDb[_0x9625('0x90')](_0x2a2624,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x54a0c5[_0x9625('0xbf')]>=_0x23e5e8[_0x9625('0xc3')]){rpcDb['createCustomerFinal'](_0x54a0c5,_0x9625('0xc4'));}else{rpcDb[_0x9625('0xc5')](ut[_0x9625('0xa5')](_0x54a0c5,_0x9625('0xbf'),_0x23e5e8['dialBusyRetryFrequency']),_0x54a0c5['unlockAgent'],_0x54a0c5[_0x9625('0xa8')]);}}break;case _0x9625('0xc6'):_0x23e5e8[_0x9625('0x40')]+=0x1;_0x54a0c5[_0x9625('0xc7')]+=0x1;_0x54a0c5[_0x9625('0x9c')]=ut[_0x9625('0x9d')](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0x3,_0x9625('0xc8'));ami['emit'](_0x9625('0xc9'),ut[_0x9625('0xaf')](_0x54a0c5,'noanswer'));rpcDb[_0x9625('0x8d')](_0x54a0c5,_0x9625('0xca'));if(ut[_0x9625('0x9d')](_0x54a0c5)>=_0x23e5e8[_0x9625('0xa1')]){_0x2a2624=ut[_0x9625('0xcb')](_0x54a0c5,0xf,_0x9625('0xa2'));rpcDb[_0x9625('0x90')](_0x2a2624,_0x9625('0xcc'));}else{if(_0x54a0c5[_0x9625('0xc7')]>=_0x23e5e8['dialNoAnswerMaxRetry']){rpcDb[_0x9625('0x90')](_0x54a0c5,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x9625('0xc5')](ut[_0x9625('0xa5')](_0x54a0c5,_0x9625('0xc7'),_0x23e5e8['dialNoAnswerRetryFrequency']),_0x54a0c5[_0x9625('0xa7')],_0x54a0c5[_0x9625('0xa8')]);}}break;case'CONGESTION':_0x23e5e8[_0x9625('0x3d')]+=0x1;_0x54a0c5[_0x9625('0xcd')]+=0x1;_0x54a0c5['countglobal']=ut['totalGlobal'](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0x8,_0x9625('0xce'));ami[_0x9625('0xb2')](_0x9625('0xcf'),ut[_0x9625('0xaf')](_0x54a0c5,_0x9625('0xd0')));rpcDb[_0x9625('0x8d')](_0x54a0c5,_0x9625('0xd1'));if(ut[_0x9625('0x9d')](_0x54a0c5)>=_0x23e5e8[_0x9625('0xa1')]){_0x2a2624=ut[_0x9625('0xcb')](_0x54a0c5,0xf,_0x9625('0xa2'));rpcDb[_0x9625('0x90')](_0x2a2624,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x54a0c5['countcongestionretry']>=_0x23e5e8[_0x9625('0xd2')]){rpcDb['createCustomerFinal'](_0x54a0c5,_0x9625('0xd1'));}else{rpcDb[_0x9625('0xc5')](ut[_0x9625('0xa5')](_0x54a0c5,'countcongestionretry',_0x23e5e8[_0x9625('0xd3')]),_0x54a0c5['unlockAgent'],_0x54a0c5[_0x9625('0xa8')]);}}break;case'CANCEL':_0x23e5e8[_0x9625('0x44')]+=0x1;_0x54a0c5[_0x9625('0xd4')]+=0x1;_0x54a0c5[_0x9625('0x9c')]=ut[_0x9625('0x9d')](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0x14,'AgentReject');ami['emit'](_0x9625('0xd5'),ut[_0x9625('0xaf')](_0x54a0c5,'agentreject'));rpcDb[_0x9625('0x8d')](_0x54a0c5,_0x9625('0xd6'));if(ut['totalGlobal'](_0x54a0c5)>=_0x23e5e8[_0x9625('0xa1')]){_0x2a2624=ut[_0x9625('0xcb')](_0x54a0c5,0x14,_0x9625('0xd7'));rpcDb[_0x9625('0x90')](_0x2a2624,_0x9625('0xd8'));}else{if(_0x54a0c5[_0x9625('0xd4')]>=_0x23e5e8[_0x9625('0xd9')]){rpcDb[_0x9625('0x90')](_0x54a0c5,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x9625('0xc5')](ut[_0x9625('0xa5')](_0x54a0c5,'countagentrejectretry',_0x23e5e8[_0x9625('0xda')]),_0x54a0c5[_0x9625('0xa7')],_0x54a0c5[_0x9625('0xa8')]);}}break;case _0x9625('0xdb'):_0x23e5e8['outboundAbandonedCallsDay']+=0x1;_0x54a0c5['countabandonedretry']+=0x1;_0x54a0c5[_0x9625('0x9c')]=ut[_0x9625('0x9d')](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0xb,'Abandoned');rpcDb[_0x9625('0x8d')](_0x54a0c5,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x9625('0x9d')](_0x54a0c5)>=_0x23e5e8['dialGlobalMaxRetry']){_0x2a2624=ut[_0x9625('0xcb')](_0x54a0c5,0xf,_0x9625('0xa2'));rpcDb['createCustomerFinal'](_0x2a2624,_0x9625('0xdc'));}else{if(_0x54a0c5['countabandonedetry']>=_0x23e5e8[_0x9625('0xdd')]){rpcDb[_0x9625('0x90')](_0x54a0c5,_0x9625('0xdc'));}else{rpcDb['rescheduleContact'](ut[_0x9625('0xa5')](_0x54a0c5,'countabandonedretry',_0x23e5e8[_0x9625('0xde')]),_0x54a0c5['unlockAgent'],_0x54a0c5[_0x9625('0xa8')]);}}break;default:if(_0x54a0c5[_0x9625('0x7b')]){ut['decrementTalkink'](_0x23e5e8,_0x9625('0xdf'));ut[_0x9625('0x7d')](_0x9625('0xe0')+_0x23e5e8[_0x9625('0x2a')],_0x4f22f0);}_0x23e5e8['outboundUnknownCallsDay']+=0x1;_0x54a0c5['countglobal']=ut[_0x9625('0x9d')](_0x54a0c5);ut[_0x9625('0x8e')](_0x54a0c5,0xc,_0x4f22f0[_0x9625('0xe1')]||_0x4f22f0[_0x9625('0xe2')]);rpcDb[_0x9625('0x8d')](_0x54a0c5,_0x9625('0xe3'));if(ut[_0x9625('0x9d')](_0x54a0c5)>=_0x23e5e8[_0x9625('0xa1')]){_0x2a2624=ut[_0x9625('0xcb')](_0x54a0c5,0xf,_0x9625('0xa2'));rpcDb[_0x9625('0x90')](_0x2a2624,_0x9625('0xe4'));}else{rpcDb[_0x9625('0x90')](_0x54a0c5,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x9625('0x70')][_0x4f22f0['linkedid']];}if(!(_0x54a0c5[_0x9625('0x7b')]&&_0x51018c==='16')){ut['updateOriginated'](_0x23e5e8,_0x9625('0xe5'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x54a0c5[_0x9625('0xbd')],_0x9625('0xad'),_0x23e5e8[_0x9625('0x2a')],_0x9625('0xe6'),_0x23e5e8[_0x9625('0x4f')]);}if(_0x51018c!==_0x9625('0xe7')){delete this[_0x9625('0x70')][_0x4f22f0['linkedid']];delete this['actions'][_0x4f22f0[_0x9625('0xe8')]];}}};Preview[_0x9625('0x11')][_0x9625('0xe9')]=function(_0x1c59e9,_0x24264c,_0x5ab762){if(_['isUndefined'](_0x24264c)&&_0x9625('0xea')!==typeof _0x24264c){return;}if(_[_0x9625('0xeb')](_0x5ab762)&&_0x9625('0xea')!==typeof _0x5ab762){return;}switch(_0x5ab762[_0x9625('0xec')]){case'0':ut['logAgent'](_0x1c59e9,0x0,'NoSuchNumber');rpcDb[_0x9625('0xed')](_0x1c59e9,_0x9625('0xee'));break;case'3':ut[_0x9625('0xef')](_0x1c59e9,0x3,_0x9625('0xc8'));rpcDb[_0x9625('0xed')](_0x1c59e9,_0x9625('0xf0'));break;case'5':ut[_0x9625('0xef')](_0x1c59e9,0x5,_0x9625('0xc0'));rpcDb[_0x9625('0xed')](_0x1c59e9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x9625('0xef')](_0x1c59e9,0x8,_0x9625('0xce'));rpcDb['createAgentHistory'](_0x1c59e9,_0x9625('0xf1'));break;case'22':ut['logAgent'](_0x1c59e9,0x16,_0x9625('0xf2'));rpcDb[_0x9625('0xed')](_0x1c59e9,_0x9625('0xf3'));break;default:ut[_0x9625('0xef')](_0x1c59e9,0xc,_0x5ab762[_0x9625('0xec')]);rpcDb[_0x9625('0xed')](_0x1c59e9,'[callProgressDetectingAgent][logCongestion]');}ut[_0x9625('0xf4')](_0x24264c,'[callProgressDetectingAgent]');logger[_0x9625('0x5c')]('[originated][decrement][callProgressDetectingAgent]',_0x1c59e9[_0x9625('0xbd')],_0x9625('0xad'),_0x24264c[_0x9625('0x2a')],_0x9625('0xe6'),_0x24264c[_0x9625('0x4f')]);delete this[_0x9625('0x70')][_0x1c59e9[_0x9625('0xbd')]];};Preview[_0x9625('0x11')][_0x9625('0xf5')]=function(_0x1fcf41,_0x420cba,_0x2ee91f,_0x45254a,_0x942801){var _0x39a6ff=this;return new BPromise(function(_0x29d457,_0x2b1036){if(_[_0x9625('0x6e')](_0x420cba)||_['isNil'](_0x420cba[_0x9625('0xf6')])||_[_0x9625('0x6e')](_0x420cba[_0x9625('0xf6')]['phone'])||_[_0x9625('0x6e')](_0x420cba['VoiceQueueId'])){_0x2b1036(ut['message'](_0x9625('0xf7'),_0x45254a,_0x942801));return;}var _0x977d03=uuid['v4']();var _0x5db16c=_0x39a6ff[_0x9625('0x14')][_0x420cba['Queue'][_0x9625('0x2a')]];var _0x17b989=_0x2ee91f?_0x39a6ff['agents'][_0x2ee91f]['id']:undefined;_0x39a6ff['actions'][_0x977d03]=new Action(_0x420cba,_0x5db16c,_0x977d03,_0x2ee91f,_0x17b989);var _0x1a6d6e=_0x39a6ff[_0x9625('0x70')][_0x977d03];_0x1a6d6e['unlockAgent']=_0x45254a;_0x1a6d6e[_0x9625('0xa8')]=_0x942801;_0x1a6d6e[_0x9625('0xf8')]=_0x2ee91f;if(_[_0x9625('0xf9')](_0x1fcf41)){_0x39a6ff[_0x9625('0xfa')](_0x1a6d6e,_0x5db16c,_0x420cba,_0x2ee91f)[_0x9625('0x82')](function(_0x2a79c5){logger[_0x9625('0x5c')](_0x9625('0xfb'),_0x9625('0xfc')+_0x1a6d6e[_0x9625('0x71')]+_0x9625('0xfd')+_0x1a6d6e[_0x9625('0xfe')],JSON[_0x9625('0x58')](_0x2a79c5));ami[_0x9625('0xb2')](_0x9625('0xff'),ut[_0x9625('0xaf')](_0x1a6d6e,'called'));_0x29d457(ut[_0x9625('0x4e')]('Calling'));})['catch'](function(_0x1bfa24){ut['logger']('[Preview][execCall][failure]',_0x1bfa24);_0x2b1036(ut[_0x9625('0x4e')](_0x9625('0x100'),_0x45254a,_0x942801));});}else{_0x5db16c[_0x9625('0x101')]+=0x1;ut[_0x9625('0x102')](_0x1a6d6e);rpcDb[_0x9625('0x103')](_0x1a6d6e,'[Blacklist][error]');delete _0x39a6ff['actions'][_0x977d03];_0x2b1036(ut[_0x9625('0x4e')](_0x9625('0x104'),_0x45254a,_0x942801));}});};Preview['prototype']['isTrunkReachable']=function(_0x5eb421){return!_[_0x9625('0x6e')](_0x5eb421)&&!_[_0x9625('0x6e')](_0x5eb421[_0x9625('0x2a')])&&!_[_0x9625('0x6e')](_0x5eb421['active'])&&_0x5eb421[_0x9625('0x56')]&&!_[_0x9625('0x6e')](this[_0x9625('0x16')][util[_0x9625('0x59')](_0x9625('0x105'),_0x5eb421[_0x9625('0x2a')])])&&!_[_0x9625('0x6e')](this[_0x9625('0x16')][util[_0x9625('0x59')]('SIP/%s',_0x5eb421[_0x9625('0x2a')])][_0x9625('0x76')])&&(this[_0x9625('0x16')][util['format'](_0x9625('0x105'),_0x5eb421[_0x9625('0x2a')])][_0x9625('0x76')]===_0x9625('0x106')||this[_0x9625('0x16')][util['format'](_0x9625('0x105'),_0x5eb421['name'])][_0x9625('0x76')]===_0x9625('0x107'));};Preview[_0x9625('0x11')][_0x9625('0x108')]=function(_0x4a9a91,_0x4aa3ec){var _0x59f605=this;return new BPromise(function(_0x165926,_0x3720f9){_0x59f605['execRun'](_0x4a9a91,_0x4aa3ec)[_0x9625('0x82')](function(_0x412221){_0x165926(_['pick'](_0x412221,['message']));})[_0x9625('0x78')](function(_0x5740b){if(_0x5740b['unlock']){rpcDb[_0x9625('0x109')](_0x4a9a91);}if(_0x5740b['active']){rpcDb[_0x9625('0x8a')](_0x4a9a91);}_0x3720f9(_[_0x9625('0x72')](_0x5740b,[_0x9625('0x4e')]));});});};Preview[_0x9625('0x11')]['execRun']=function(_0x475e61,_0x2e13ad){var _0x15da3b=this;return new BPromise(function(_0x6ac91d,_0x1c8858){var _0x45fb84,_0x4a2cca;rpcDb[_0x9625('0x10a')](_0x475e61)['then'](function(_0xd906db){if(!_[_0x9625('0x6e')](_0xd906db[0x0])){_0x4a2cca=_0xd906db[0x0][_0x9625('0x10b')]?![]:!![];_0x45fb84=_0xd906db[0x0]['recallme']?!![]:![];_0x45fb84=_0x2e13ad?!![]:_0x45fb84;}var _0x48946f=_0x15da3b['validateContact'](_0xd906db);if(_0x48946f[_0x9625('0x10c')]){rpcDb[_0x9625('0x10d')](_[_0x9625('0x72')](_0xd906db[0x0],[_0x9625('0x74'),_0x9625('0x10e')]))[_0x9625('0x82')](function(_0x3937e2){_0x15da3b[_0x9625('0xf5')](_0x3937e2,_0xd906db[0x0],_0x2e13ad,_0x4a2cca,_0x45fb84)['then'](function(_0x4abbdb){_0x6ac91d(_0x4abbdb);})[_0x9625('0x78')](function(_0x69ad00){_0x1c8858(_0x69ad00);});})[_0x9625('0x78')](function(_0x3af2d3){ut[_0x9625('0x62')]('[Preview][checkIsBlackList]',_0x3af2d3);_0x1c8858(ut[_0x9625('0x4e')](_0x9625('0x10f'),_0x4a2cca,_0x45fb84));});}else{_0x1c8858(ut[_0x9625('0x4e')](_0x48946f[_0x9625('0x4e')],_0x4a2cca,_0x45fb84));}})['catch'](function(_0xfee7b1){ut['logger']('[Preview][getContactPreview]',_0xfee7b1);_0x1c8858(ut[_0x9625('0x4e')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9625('0x11')][_0x9625('0x110')]=function(_0x486168){if(_[_0x9625('0x6e')](_0x486168)||_[_0x9625('0xf9')](_0x486168)||!_[_0x9625('0x6e')](_0x486168[0x0][_0x9625('0x87')])&&_[_0x9625('0x6e')](_0x486168[0x0][_0x9625('0x87')][_0x9625('0x2a')])){ut[_0x9625('0x62')](_0x9625('0x111'),_0x486168);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2913c5=this['campaignsPreview'][_0x486168[0x0][_0x9625('0x6f')][_0x9625('0x2a')]];_0x2913c5[_0x9625('0x4e')]=_0x9625('0x99');if(_[_0x9625('0x6e')](_0x2913c5)){ut[_0x9625('0x62')](_0x9625('0x112'),_0x2913c5);return{'isValid':![],'message':_0x9625('0x113')};}if(!this[_0x9625('0x96')](_0x2913c5[_0x9625('0x55')])){ut['logger'](_0x9625('0x114'),_0x9625('0x115')+_0x2913c5[_0x9625('0x2a')]+_0x9625('0x116'));if(!this['isTrunkReachable'](_0x2913c5[_0x9625('0x97')])){ut[_0x9625('0x62')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x2913c5['name']+_0x9625('0x117'));return{'isValid':![],'message':_0x9625('0x118')};}}if(!ut[_0x9625('0x95')](_0x2913c5[_0x9625('0x119')])){ut[_0x9625('0x62')](_0x9625('0x11a'),_0x2913c5['name']+_0x9625('0x11b'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2913c5[_0x9625('0x2a')]+_0x9625('0x11b')};}return{'isValid':!![],'message':_0x9625('0x11c')};};Preview[_0x9625('0x11')][_0x9625('0xfa')]=function(_0x5295c2,_0x1c1057,_0x49bbd4,_0x8248be){var _0x54825f=this;return new BPromise(function(_0x3507c3,_0x3002a7){var _0x1c06c9=_0x5295c2[_0x9625('0xbd')];var _0xf9fd4b=_0x54825f[_0x9625('0x96')](_0x1c1057[_0x9625('0x55')])?util[_0x9625('0x59')](_0x9625('0x11d'),_0x1c1057[_0x9625('0x55')][_0x9625('0x2a')],_['isNil'](_0x1c1057[_0x9625('0x11e')])?'':_0x1c1057[_0x9625('0x11e')]['trim']()||'',_0x1c1057['dialCutDigit']>0x0?_0x49bbd4[_0x9625('0xf6')][_0x9625('0x11f')]['substring'](_0x1c1057['dialCutDigit']):_0x49bbd4[_0x9625('0xf6')][_0x9625('0x11f')]):util[_0x9625('0x59')]('SIP/%s/%s%s',_[_0x9625('0x6e')](_0x1c1057[_0x9625('0x97')])?_0x1c1057['Trunk'][_0x9625('0x2a')]:_0x1c1057[_0x9625('0x97')]['name'],_[_0x9625('0x6e')](_0x1c1057[_0x9625('0x11e')])?'':_0x1c1057[_0x9625('0x11e')]['trim']()||'',_0x1c1057['dialCutDigit']>0x0?_0x49bbd4['Contact'][_0x9625('0x11f')]['substring'](_0x1c1057[_0x9625('0x120')]):_0x49bbd4[_0x9625('0xf6')][_0x9625('0x11f')]);var _0x253225=_0x54825f[_0x9625('0x96')](_0x1c1057[_0x9625('0x55')])?ut[_0x9625('0x121')](_0x1c1057[_0x9625('0x55')][_0x9625('0x122')],_0x1c1057['dialOriginateCallerIdName'],_0x1c1057[_0x9625('0x123')]>0x0?ut['getCallerIdRandom'](_0x1c1057['dialOriginateCallerIdNumber'],_0x1c1057[_0x9625('0x123')]):_0x1c1057['dialOriginateCallerIdNumber']):ut[_0x9625('0x121')](_[_0x9625('0x6e')](_0x1c1057['TrunkBackup'])?_0x1c1057[_0x9625('0x55')][_0x9625('0x122')]:_0x1c1057[_0x9625('0x97')][_0x9625('0x122')],_0x1c1057[_0x9625('0x38')],_0x1c1057[_0x9625('0x123')]>0x0?ut[_0x9625('0x124')](_0x1c1057['dialOriginateCallerIdNumber'],_0x1c1057[_0x9625('0x123')]):_0x1c1057['dialOriginateCallerIdNumber']);if(_0x253225){_0x5295c2[_0x9625('0x125')]=ut['extractCalleridName'](_0x253225);_0x5295c2[_0x9625('0x126')]=ut[_0x9625('0x127')](_0x253225);}var _0x5a29d5=ut[_0x9625('0x128')](_0x1c1057,_0x49bbd4,_0xf9fd4b,_0x253225,_0x1c06c9,_0x5295c2);_[_0x9625('0x129')](_0x5295c2,ut[_0x9625('0x12a')](_0x5a29d5));_0x5295c2[_0x9625('0x12b')]=moment()[_0x9625('0x59')](_0x9625('0xaa'));ami[_0x9625('0x75')](ut['variablesAction'](_0x5295c2,_0x1c1057,_0x5a29d5,_0x5295c2[_0x9625('0xa8')],_0x8248be))[_0x9625('0x82')](function(_0x586cd2){_0x1c1057[_0x9625('0x4f')]+=0x1;logger[_0x9625('0x5c')]('[originated][increment]',_0x1c06c9,_0x9625('0xad'),_0x1c1057[_0x9625('0x2a')],_0x9625('0xe6'),_0x1c1057[_0x9625('0x4f')]);_0x3507c3(_0x586cd2);})[_0x9625('0x78')](function(_0x44ec13){ut[_0x9625('0xef')](_0x5295c2,0xe,_0x9625('0x12c'));rpcDb[_0x9625('0xed')](_0x5295c2,_0x9625('0x12d'));_0x3002a7(_0x44ec13);});});};Preview[_0x9625('0x11')][_0x9625('0x22')]=function(_0x280b09){if(this[_0x9625('0x70')][_0x280b09[_0x9625('0xa9')]]){this[_0x9625('0x70')][_0x280b09[_0x9625('0xa9')]][_0x9625('0x77')]=_0x280b09['channel'];}};Preview[_0x9625('0x11')][_0x9625('0x1a')]=function(_0x344083){var _0x1167d8=this;var _0x22c587=this[_0x9625('0x70')][_0x344083[_0x9625('0x12e')]];if(_0x22c587){if(_0x22c587[_0x9625('0xf8')]&&this['agents'][_0x22c587[_0x9625('0xf8')]]){ut[_0x9625('0x12f')](_0x22c587,this[_0x9625('0x17')][_0x22c587[_0x9625('0xf8')]]['name'],this[_0x9625('0x17')][_0x22c587[_0x9625('0xf8')]]['id']);}var _0x2450c5=_['clone'](_0x22c587);_0x2450c5[_0x9625('0x130')]=moment()[_0x9625('0x59')](_0x9625('0xaa'));var _0x3dc373=_0x1167d8[_0x9625('0x14')][_0x22c587[_0x9625('0x71')]];if(ut[_0x9625('0x131')](_0x344083['response'])){if(_0x22c587[_0x9625('0xa7')]){rpcDb['unlockContact'](_0x22c587[_0x9625('0xfe')]);}if(_0x22c587['activeContact']){rpcDb['disableContact'](_0x22c587['idContact']);}ami[_0x9625('0xb2')](_0x9625('0x132'),ut[_0x9625('0xaf')](_0x22c587,'rejected'));this[_0x9625('0xe9')](_0x2450c5,_0x3dc373,_0x344083);}else{_0x22c587[_0x9625('0x12b')]=moment()[_0x9625('0x59')](_0x9625('0xaa'));ut['logAgent'](_0x2450c5,0x4,_0x9625('0xb8'));rpcDb['createAgentHistory'](_0x2450c5,_0x9625('0x133'));}}};Preview['prototype']['syncHangup']=function(_0x26bb19){var _0x2fcb0c=this;var _0x11ec5f=this['actions'][_0x26bb19[_0x9625('0xa9')]];var _0x26845c;if(_0x11ec5f){_0x26845c=this[_0x9625('0x14')][_0x11ec5f[_0x9625('0x71')]];logger['info'](_0x9625('0x134'),_0x26bb19['linkedid'],_0x9625('0xad'),_0x26845c[_0x9625('0x2a')],'pTalking:\x20',_0x26845c[_0x9625('0x2d')]);}if(this[_0x9625('0x70')][_0x26bb19[_0x9625('0xa9')]]&&_0x26bb19[_0x9625('0xa9')]!==_0x26bb19[_0x9625('0xbd')]){if(_0x26bb19['cause']==='16'&&this[_0x9625('0x70')][_0x26bb19['linkedid']][_0x9625('0x7b')]){this['callProgressDetectingCustomer'](_0x26bb19,_0x26bb19[_0x9625('0xa9')],_0x26bb19['cause']);}else if(this[_0x9625('0x70')][_0x26bb19[_0x9625('0xa9')]][_0x9625('0x7b')]){logger[_0x9625('0x5c')]('[syncHangup][talking][cause]',_0x26bb19[_0x9625('0xa9')],_0x26bb19[_0x9625('0x135')],_0x9625('0xad'),_0x26845c[_0x9625('0x2a')],'pTalking:\x20',_0x26845c['pTalking']);this[_0x9625('0x9a')](_0x26bb19,_0x26bb19[_0x9625('0xa9')],_0x26bb19[_0x9625('0x135')]);}}else if(_0x11ec5f&&_[_0x9625('0x6e')](_0x11ec5f[_0x9625('0x136')])&&_0x26845c[_0x9625('0x137')]&&_0x26bb19[_0x9625('0xa9')]===_0x26bb19[_0x9625('0xbd')]&&_[_0x9625('0x6e')](_0x26bb19[_0x9625('0xec')])&&_0x26bb19[_0x9625('0x135')]==='16'&&_0x26bb19[_0x9625('0x138')]==='6'&&_[_0x9625('0xeb')](_0x11ec5f[_0x9625('0x139')])){if(_0x11ec5f[_0x9625('0xa7')]){rpcDb['unlockContact'](_0x11ec5f['idContact']);}if(_0x11ec5f[_0x9625('0xa8')]){rpcDb[_0x9625('0x8a')](_0x11ec5f[_0x9625('0xfe')]);}_0x26bb19[_0x9625('0xec')]='22';this[_0x9625('0xe9')](_0x11ec5f,_0x26845c,_0x26bb19);}else if(_0x11ec5f&&_0x11ec5f[_0x9625('0x139')]){if(_0x26bb19[_0x9625('0x135')]==='16'&&this['actions'][_0x26bb19[_0x9625('0xa9')]][_0x9625('0x7b')]){logger['info'](_0x9625('0x13a'),_0x26bb19[_0x9625('0xa9')],_0x26bb19['cause'],'\x20Queue',_0x26845c['name'],_0x9625('0xae'),_0x26845c['pTalking']);this[_0x9625('0x9a')](_0x26bb19,_0x26bb19['linkedid'],_0x26bb19[_0x9625('0x135')]);}else if(this[_0x9625('0x70')][_0x26bb19[_0x9625('0xa9')]][_0x9625('0x7b')]){logger[_0x9625('0x5c')](_0x9625('0x13b'),_0x26bb19['linkedid'],_0x26bb19[_0x9625('0x135')],'\x20Queue',_0x26845c[_0x9625('0x2a')],_0x9625('0xae'),_0x26845c[_0x9625('0x2d')]);this[_0x9625('0x9a')](_0x26bb19,_0x26bb19['linkedid'],_0x26bb19[_0x9625('0x135')]);}}};Preview[_0x9625('0x11')]['syncDialEnd']=function(_0x24beaa){if(this['actions'][_0x24beaa[_0x9625('0xe8')]]&&_0x24beaa[_0x9625('0xe8')]!==_0x24beaa['destuniqueid']){this[_0x9625('0x9a')](_0x24beaa,_0x24beaa[_0x9625('0xe8')],_0x24beaa['dialstatus']);}};Preview[_0x9625('0x11')][_0x9625('0x1f')]=function(_0x32ca69){if(this[_0x9625('0x70')][_0x32ca69['linkedid']]&&_0x32ca69[_0x9625('0xa9')]!==_0x32ca69[_0x9625('0xbd')]&&!this['actions'][_0x32ca69['linkedid']][_0x9625('0x7b')]){if(_0x32ca69[_0x9625('0x135')]==='1'){this['callProgressDetectingCustomer'](_0x32ca69,_0x32ca69[_0x9625('0xa9')],_0x32ca69['cause']);}}};Preview[_0x9625('0x11')]['addVariable']=function(_0x3bc681,_0x4801fc,_0x37dfdb){if(this[_0x9625('0x70')][_0x3bc681]){if(_[_0x9625('0x6e')](this[_0x9625('0x70')][_0x3bc681][_0x9625('0x13c')])){this[_0x9625('0x70')][_0x3bc681][_0x9625('0x13c')]={};}this[_0x9625('0x70')][_0x3bc681][_0x9625('0x13c')][_0x4801fc]=_0x37dfdb;}};Preview['prototype'][_0x9625('0x24')]=function(_0x31f454){try{if(!_[_0x9625('0x6e')](_0x31f454)){if(ut[_0x9625('0x13d')](_[_0x9625('0x13e')](_0x31f454[_0x9625('0x13f')])[0x0])){this[_0x9625('0x140')](_0x31f454['uniqueid'],_[_0x9625('0x13e')](_0x31f454['variable'])[0x0],_0x31f454[_0x9625('0x141')]);}}}catch(_0x4c3e71){logger[_0x9625('0x142')](_0x9625('0x143'),util[_0x9625('0x144')](_0x4c3e71,{'showHidden':![],'depth':null}));}};Preview[_0x9625('0x11')][_0x9625('0x145')]=function(_0x3ad6c5){if(_0x3ad6c5){if(this[_0x9625('0x70')][_0x3ad6c5[_0x9625('0x146')]]){this[_0x9625('0x70')][_0x3ad6c5[_0x9625('0x146')]][_0x9625('0x139')]=!![];}}};Preview['prototype'][_0x9625('0x27')]=function(_0x26911c){if(_0x26911c){if(this[_0x9625('0x70')][_0x26911c[_0x9625('0x147')]]){this[_0x9625('0x70')][_0x26911c[_0x9625('0x147')]][_0x9625('0x139')]=!![];}}};module[_0x9625('0x148')]=Preview; \ No newline at end of file +var _0xe151=['predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','name','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','responsetime','answertime','[syncHangup][talking][increment]','emit','connect','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','totalGlobal','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','\x20Queue','ANSWER','linkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','status','unmonitored','run','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','syncNewExten','logLookAgent','clone','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][cause]','destlinkedid','addVariable','variables','filterKey','keys','variable','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses'];(function(_0x16ca9a,_0xd9e40c){var _0x58262e=function(_0x211069){while(--_0x211069){_0x16ca9a['push'](_0x16ca9a['shift']());}};_0x58262e(++_0xd9e40c);}(_0xe151,0x10a));var _0x1e15=function(_0xf73390,_0x14c109){_0xf73390=_0xf73390-0x0;var _0x4b212f=_0xe151[_0xf73390];return _0x4b212f;};'use strict';var util=require('util');var _=require(_0x1e15('0x0'));var BPromise=require('bluebird');var uuid=require(_0x1e15('0x1'));var moment=require(_0x1e15('0x2'));var md5=require(_0x1e15('0x3'));var Redis=require(_0x1e15('0x4'));var config=require('../../../config/environment');var logger=require(_0x1e15('0x5'))(_0x1e15('0x6'));var loggerAction=require('../../../config/logger')(_0x1e15('0x7'));var ami=require(_0x1e15('0x8'));var rpcDb=require(_0x1e15('0x9'));var Action=require(_0x1e15('0xa'));var ut=require(_0x1e15('0xb'));config[_0x1e15('0xc')]=_[_0x1e15('0xd')](config[_0x1e15('0xc')],{'host':_0x1e15('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1e15('0xf')][_0x1e15('0x10')]=function(_0x590d09){this['tail']=this[_0x1e15('0x11')]?this[_0x1e15('0x11')][_0x1e15('0x12')](_0x590d09):_0x590d09();};function Preview(_0x3bdd2d){this[_0x1e15('0x13')]=new Sequence();this[_0x1e15('0x14')]=_0x3bdd2d[_0x1e15('0x15')];this[_0x1e15('0x16')]=_0x3bdd2d['trunks'];this['actions']={};this['agents']=_0x3bdd2d[_0x1e15('0x17')];this[_0x1e15('0x18')]=0x0;ami['on'](_0x1e15('0x19'),this[_0x1e15('0x1a')][_0x1e15('0x1b')](this));ami['on'](_0x1e15('0x1c'),this[_0x1e15('0x1d')][_0x1e15('0x1b')](this));ami['on'](_0x1e15('0x1e'),this[_0x1e15('0x1f')][_0x1e15('0x1b')](this));ami['on']('dialend',this[_0x1e15('0x20')][_0x1e15('0x1b')](this));ami['on'](_0x1e15('0x21'),this['syncNewExten'][_0x1e15('0x1b')](this));ami['on']('varset',this[_0x1e15('0x22')][_0x1e15('0x1b')](this));ami['on'](_0x1e15('0x23'),this[_0x1e15('0x24')]['bind'](this));ami['on'](_0x1e15('0x25'),this[_0x1e15('0x26')][_0x1e15('0x1b')](this));this[_0x1e15('0x27')](this[_0x1e15('0x14')]);}function emit(_0x5d50ca,_0x17b9bc,_0x3fae0e){io['to'](_0x5d50ca)['emit'](_0x17b9bc,_0x3fae0e);}function emitCampaignPreview(_0x142f59){if(_0x142f59['type']===_0x1e15('0x28')){var _0x53d72b={'id':_0x142f59['id'],'name':_0x142f59['name'],'strategy':_0x142f59[_0x1e15('0x29')],'answered':_0x142f59[_0x1e15('0x2a')],'available':_0x142f59[_0x1e15('0x2b')],'loggedIn':_0x142f59[_0x1e15('0x2c')],'pTalking':_0x142f59[_0x1e15('0x2d')],'sumBillable':_0x142f59[_0x1e15('0x2e')],'sumDuration':_0x142f59[_0x1e15('0x2f')],'sumHoldTime':_0x142f59[_0x1e15('0x30')]||0x0,'talking':_0x142f59[_0x1e15('0x31')],'total':_0x142f59[_0x1e15('0x32')],'type':_0x142f59[_0x1e15('0x33')],'unmanaged':_0x142f59['unmanaged'],'abandoned':_0x142f59[_0x1e15('0x34')],'waiting':_0x142f59[_0x1e15('0x35')],'loggedInDb':_0x142f59[_0x1e15('0x36')],'dialActive':_0x142f59['dialActive'],'dialMethod':_0x142f59[_0x1e15('0x37')],'dialOriginateCallerIdName':_0x142f59[_0x1e15('0x38')],'dialOriginateCallerIdNumber':_0x142f59[_0x1e15('0x39')],'dialOriginateTimeout':_0x142f59[_0x1e15('0x3a')],'dialPrefix':_0x142f59['dialPrefix'],'outboundAnswerAgiCallsDay':_0x142f59[_0x1e15('0x3b')],'outboundAnswerCallsDay':_0x142f59[_0x1e15('0x3c')],'outboundBlacklistCallsDay':_0x142f59[_0x1e15('0x3d')],'outboundBusyCallsDay':_0x142f59['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x142f59['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x142f59[_0x1e15('0x3e')],'outboundDropCallsDayCallersExit':_0x142f59[_0x1e15('0x3f')],'outboundDropCallsDayTimeout':_0x142f59[_0x1e15('0x40')],'outboundNoAnswerCallsDay':_0x142f59[_0x1e15('0x41')],'outboundNoSuchCallsDay':_0x142f59[_0x1e15('0x42')],'outboundOriginateFailureCallsDay':_0x142f59[_0x1e15('0x43')],'outboundReCallsDay':_0x142f59['outboundReCallsDay'],'outboundRejectCallsDay':_0x142f59[_0x1e15('0x44')],'outboundUnknownCallsDay':_0x142f59[_0x1e15('0x45')],'outboundAbandonedCallsDay':_0x142f59[_0x1e15('0x46')],'predictiveIntervalAnsweredCalls':_0x142f59[_0x1e15('0x47')],'predictiveIntervalAvgHoldtime':_0x142f59[_0x1e15('0x48')],'predictiveIntervalAvgTalktime':_0x142f59[_0x1e15('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x142f59[_0x1e15('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x142f59[_0x1e15('0x4b')],'predictiveIntervalErlangCalls':_0x142f59['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x142f59[_0x1e15('0x4c')],'predictiveIntervalHitRate':_0x142f59[_0x1e15('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x142f59[_0x1e15('0x4e')],'predictiveIntervalPauses':_0x142f59[_0x1e15('0x4f')],'predictiveIntervalAvailable':_0x142f59[_0x1e15('0x50')],'predictiveIntervalTotalCalls':_0x142f59[_0x1e15('0x51')],'message':_0x142f59[_0x1e15('0x52')],'originated':_0x142f59[_0x1e15('0x53')],'erlangCalls':_0x142f59[_0x1e15('0x54')],'erlangCallToSecond':_0x142f59[_0x1e15('0x55')],'erlangAbandonmentRate':_0x142f59[_0x1e15('0x56')],'erlangBusyFactor':_0x142f59[_0x1e15('0x57')],'startPredictive':_0x142f59[_0x1e15('0x58')],'startProgressive':_0x142f59[_0x1e15('0x59')]};if(_0x142f59[_0x1e15('0x5a')]){_0x53d72b['Trunk']={'id':_0x142f59['Trunk']['id'],'name':_0x142f59[_0x1e15('0x5a')]['name'],'active':_0x142f59['Trunk'][_0x1e15('0x5b')],'callerid':_0x142f59[_0x1e15('0x5a')]['callerid']};}if(_0x142f59[_0x1e15('0x5c')]){_0x53d72b['Interval']={'id':_0x142f59[_0x1e15('0x5c')]['id'],'name':_0x142f59[_0x1e15('0x5c')]['name']};}var _0x38f4ca=md5(JSON[_0x1e15('0x5d')](_0x53d72b));if(_0x142f59[_0x1e15('0x3')]!==_0x38f4ca){_0x142f59[_0x1e15('0x3')]=_0x38f4ca;emit(util[_0x1e15('0x5e')]('voice:queue:%s',_0x53d72b[_0x1e15('0x5f')]),_0x1e15('0x60'),_0x53d72b);}}}function emitVoiceQueueChannelRemove(_0x19c75e){logger[_0x1e15('0x61')](_0x1e15('0x62'),JSON[_0x1e15('0x5d')](_0x19c75e));emit(util['format']('voice:queue:%s',_0x19c75e[_0x1e15('0x5f')]),'voice_queue_channel:remove',_0x19c75e);}function notSendMessagesQueue(_0x2d34b8){if(_0x2d34b8[_0x1e15('0x63')]){if(_0x2d34b8[_0x1e15('0x53')]===0x0&&_0x2d34b8[_0x1e15('0x2d')]===0x0){_0x2d34b8['sendMessageOneNotActive']=![];_0x2d34b8[_0x1e15('0x2b')]=0x0;_0x2d34b8[_0x1e15('0x64')]=0x0;_0x2d34b8['message']=_0x1e15('0x65');ut[_0x1e15('0x66')](_0x1e15('0x67'),_0x2d34b8[_0x1e15('0x5f')]+_0x1e15('0x68'));}else{_0x2d34b8[_0x1e15('0x52')]=_0x1e15('0x69');ut[_0x1e15('0x66')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2d34b8[_0x1e15('0x5f')]+'\x20is\x20disactive');}emitCampaignPreview(_0x2d34b8);}}Preview[_0x1e15('0xf')][_0x1e15('0x27')]=function(){var _0x16e160=this;setInterval(function(){_0x16e160[_0x1e15('0x6a')]();},0x7cf);};Preview[_0x1e15('0xf')][_0x1e15('0x6a')]=function(){var _0x29b637=this[_0x1e15('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x2134c2 in _0x29b637){if(_0x29b637[_0x1e15('0x6b')](_0x2134c2)&&(_0x29b637[_0x2134c2]['dialMethod']===_0x1e15('0x6')||_0x29b637[_0x2134c2]['dialMethod']===_0x1e15('0x6c'))&&_0x29b637[_0x2134c2][_0x1e15('0x33')]==='outbound'){if(this[_0x1e15('0x18')]>0x7){this[_0x1e15('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x29b637[_0x1e15('0x6b')](_0x2134c2)&&_0x29b637[_0x2134c2]['dialMethod']===_0x1e15('0x6')&&_0x29b637[_0x2134c2][_0x1e15('0x33')]==='outbound'){if(_0x29b637[_0x2134c2][_0x1e15('0x6d')]){this[_0x1e15('0x6e')](_0x29b637[_0x2134c2]);this[_0x1e15('0x6f')](_0x29b637[_0x2134c2]);}else{notSendMessagesQueue(_0x29b637[_0x2134c2]);}}}};Preview[_0x1e15('0xf')][_0x1e15('0x70')]=function(_0x38fbf2){var _0x34df09=this;this[_0x1e15('0x13')][_0x1e15('0x10')](function(){if(!_[_0x1e15('0x71')](_0x34df09[_0x1e15('0x72')][_0x38fbf2])){loggerAction[_0x1e15('0x61')](_0x1e15('0x73'),_0x38fbf2,_0x1e15('0x74'),_0x34df09['actions'][_0x38fbf2][_0x1e15('0x75')],_0x1e15('0x76'),JSON[_0x1e15('0x5d')](_0x34df09[_0x1e15('0x14')][_0x34df09['actions'][_0x38fbf2]['queue']][_0x1e15('0x53')]),_0x1e15('0x77'),JSON['stringify'](_0x34df09['campaignsPreview'][_0x34df09[_0x1e15('0x72')][_0x38fbf2][_0x1e15('0x75')]][_0x1e15('0x2d')]),JSON[_0x1e15('0x5d')](_0x34df09[_0x1e15('0x72')][_0x38fbf2][_0x1e15('0x78')]),JSON[_0x1e15('0x5d')](_[_0x1e15('0x79')](_0x34df09['actions'][_0x38fbf2],[_0x1e15('0x7a'),_0x1e15('0x7b'),'VoiceQueueId',_0x1e15('0x7c')])));return ami[_0x1e15('0x7d')]({'action':'status','channel':_0x34df09[_0x1e15('0x72')][_0x38fbf2][_0x1e15('0x7e')]})[_0x1e15('0x7f')](function(_0x13f0bc){if(_0x13f0bc['message']===_0x1e15('0x80')){setTimeout(function(){if(_0x34df09['actions'][_0x38fbf2]){ut['updateOriginated'](_0x34df09['campaignsPreview'][_0x34df09[_0x1e15('0x72')][_0x38fbf2][_0x1e15('0x75')]],_0x1e15('0x81'));if(_0x34df09[_0x1e15('0x72')][_0x38fbf2][_0x1e15('0x78')]===!![]){ut[_0x1e15('0x82')](_0x34df09[_0x1e15('0x14')][_0x34df09[_0x1e15('0x72')][_0x38fbf2][_0x1e15('0x75')]],_0x1e15('0x81'));ut[_0x1e15('0x83')](_0x1e15('0x84')+_0x38fbf2,_0x34df09['actions'][_0x38fbf2][_0x1e15('0x75')]);}ut[_0x1e15('0x83')](_0x1e15('0x85')+_0x38fbf2,_0x34df09['actions'][_0x38fbf2]['queue']);delete _0x34df09[_0x1e15('0x72')][_0x38fbf2];}},0x2328);}});}});};Preview[_0x1e15('0xf')][_0x1e15('0x86')]=function(){var _0x4062f1=this;loggerAction[_0x1e15('0x61')](_0x1e15('0x87'),_[_0x1e15('0x88')](this[_0x1e15('0x72')]));for(var _0x4ae322 in this[_0x1e15('0x72')]){if(_0x4062f1[_0x1e15('0x72')][_0x1e15('0x6b')](_0x4ae322)){_0x4062f1[_0x1e15('0x70')](_0x4ae322);}}};Preview['prototype'][_0x1e15('0x6f')]=function(_0x26d6f8){var _0x1ec292=this;rpcDb[_0x1e15('0x89')](_0x26d6f8['id'],ut[_0x1e15('0x8a')](this['agents']))[_0x1e15('0x8b')](function(_0x4bc0e2){if(!_[_0x1e15('0x71')](_0x4bc0e2)){for(var _0x780c6e=0x0;_0x780c6e<_0x4bc0e2[_0x1e15('0x8c')];_0x780c6e+=0x1){if(ut[_0x1e15('0x8d')](_0x4bc0e2[_0x780c6e][_0x1e15('0x8e')])<_0x26d6f8[_0x1e15('0x8f')]*0x3c){if(_0x4bc0e2[_0x780c6e][_0x1e15('0x90')]&&!_0x4bc0e2[_0x780c6e]['Agent'][_0x1e15('0x91')]){_0x1ec292['run'](_0x4bc0e2[_0x780c6e]['id'])[_0x1e15('0x8b')](ut[_0x1e15('0x92')]('[RecallMe]'))[_0x1e15('0x7f')](ut[_0x1e15('0x92')](_0x1e15('0x93')));}else{rpcDb['disableContact'](_0x4bc0e2[_0x780c6e]['id']);}}else{var _0x305fb0=new Action(_0x4bc0e2[_0x780c6e],_0x26d6f8);_0x305fb0['starttime']=moment()[_0x1e15('0x5e')](_0x1e15('0x94'));_0x26d6f8[_0x1e15('0x95')]+=0x1;ut[_0x1e15('0x96')](_0x305fb0,0x17,_0x1e15('0x97'));if(_0x26d6f8['dialRecallInQueue']){rpcDb[_0x1e15('0x98')](ut[_0x1e15('0x99')](_0x4bc0e2[_0x780c6e]));rpcDb[_0x1e15('0x9a')](_0x305fb0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x1e15('0x96')](_0x305fb0,0x16,_0x1e15('0x9b'));rpcDb[_0x1e15('0x9a')](_0x305fb0,_0x1e15('0x9c'));rpcDb[_0x1e15('0x9d')](_0x305fb0,_0x1e15('0x9c'));}}}}})[_0x1e15('0x7f')](ut[_0x1e15('0x92')](_0x1e15('0x9e')));};Preview[_0x1e15('0xf')][_0x1e15('0x6e')]=function(_0x418a35){_0x418a35[_0x1e15('0x63')]=!![];if(ut[_0x1e15('0x9f')](_0x418a35[_0x1e15('0x2c')])){_0x418a35[_0x1e15('0x52')]=_0x1e15('0xa0');}else if(!ut['isActive'](_0x418a35['dialActive'])){_0x418a35[_0x1e15('0x52')]=_0x1e15('0x65');}else if(!this[_0x1e15('0xa1')](_0x418a35[_0x1e15('0x5a')])){if(!this[_0x1e15('0xa1')](_0x418a35[_0x1e15('0xa2')])){_0x418a35[_0x1e15('0x52')]=_0x1e15('0xa3');}else{_0x418a35[_0x1e15('0x52')]=_0x1e15('0xa4');}}else{_0x418a35[_0x1e15('0x52')]=_0x1e15('0xa4');}emitCampaignPreview(_0x418a35);};Preview[_0x1e15('0xf')][_0x1e15('0xa5')]=function(_0x5e3ba0,_0x3aab1f,_0xf6d181){var _0x4822dd=this;var _0xe1e5cc=this[_0x1e15('0x72')][_0x3aab1f];var _0x2c4208=this[_0x1e15('0x14')][_0xe1e5cc['queue']];var _0x2144c3;if(_0x2c4208){switch(_0xf6d181){case'1':_0x2c4208[_0x1e15('0x42')]+=0x1;_0xe1e5cc[_0x1e15('0xa6')]+=0x1;_0xe1e5cc[_0x1e15('0xa7')]=ut['totalGlobal'](_0xe1e5cc);ut['logCustomer'](_0xe1e5cc,0x0,_0x1e15('0xa8'));ami['emit'](_0x1e15('0xa9'),ut[_0x1e15('0xaa')](_0xe1e5cc,_0x1e15('0xab')));rpcDb[_0x1e15('0x9a')](_0xe1e5cc,_0x1e15('0xac'));if(ut['totalGlobal'](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut[_0x1e15('0xae')](_0xe1e5cc,0xf,'Global');rpcDb['createCustomerFinal'](_0x2144c3,_0x1e15('0xaf'));}else{if(_0xe1e5cc[_0x1e15('0xa6')]>=_0x2c4208[_0x1e15('0xb0')]){rpcDb[_0x1e15('0x9d')](_0xe1e5cc,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x1e15('0xb1')](ut[_0x1e15('0xb2')](_0xe1e5cc,_0x1e15('0xa6'),_0x2c4208[_0x1e15('0xb3')]),_0xe1e5cc[_0x1e15('0xb4')],_0xe1e5cc['activeContact']);}}delete this['actions'][_0x5e3ba0['linkedid']];break;case'ANSWER':var _0xad063c=moment()[_0x1e15('0x5e')](_0x1e15('0x94'));_0xe1e5cc[_0x1e15('0xb5')]=_0xad063c;_0xe1e5cc[_0x1e15('0xb6')]=_0xad063c;_0xe1e5cc[_0x1e15('0x78')]=!![];_0x2c4208[_0x1e15('0x2d')]+=0x1;logger['info'](_0x1e15('0xb7'),_0xe1e5cc['uniqueid'],'\x20Queue',_0x2c4208['name'],_0x1e15('0x77'),_0x2c4208[_0x1e15('0x2d')]);ami[_0x1e15('0xb8')]('custom:agentconnect',ut[_0x1e15('0xaa')](_0xe1e5cc,_0x1e15('0xb9')));if(_0x2c4208['acw']){ami[_0x1e15('0xb8')]('custom:agentConnectPreview',ut[_0x1e15('0xba')](_0xe1e5cc));}break;case'16':ami[_0x1e15('0xb8')](_0x1e15('0xbb'),ut['buildObj'](_0xe1e5cc,_0x1e15('0xbc')));emitVoiceQueueChannelRemove(ut['buildObj'](_0xe1e5cc,_0x1e15('0xbc')));_0x2c4208[_0x1e15('0x3c')]+=0x1;_0x2c4208[_0x1e15('0x32')]+=0x1;_0x2c4208['answered']+=0x1;ut[_0x1e15('0x82')](_0x2c4208,_0x1e15('0xbd'));_0xe1e5cc[_0x1e15('0xa7')]=ut['totalGlobal'](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0x4,_0x1e15('0xbe'));rpcDb[_0x1e15('0x9a')](_0xe1e5cc,_0x1e15('0xbf'));rpcDb[_0x1e15('0x9d')](_0xe1e5cc,_0x1e15('0xc0'));rpcDb[_0x1e15('0xc1')](_0xe1e5cc);_0x2c4208[_0x1e15('0x2f')]+=_0xe1e5cc[_0x1e15('0xc2')];_0x2c4208[_0x1e15('0x2e')]+=_0xe1e5cc['talktime'];logger[_0x1e15('0x61')]('[syncHangup][talking][decrement]',_0xe1e5cc[_0x1e15('0xc3')],'\x20Queue',_0x2c4208[_0x1e15('0x5f')],'pTalking:\x20',_0x2c4208[_0x1e15('0x2d')]);delete this['actions'][_0x5e3ba0['linkedid']];break;case _0x1e15('0xc4'):_0x2c4208[_0x1e15('0xc5')]+=0x1;_0xe1e5cc[_0x1e15('0xc6')]+=0x1;_0xe1e5cc[_0x1e15('0xa7')]=ut[_0x1e15('0xc7')](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0x5,_0x1e15('0xc8'));ami[_0x1e15('0xb8')](_0x1e15('0xc9'),ut[_0x1e15('0xaa')](_0xe1e5cc,_0x1e15('0xca')));rpcDb[_0x1e15('0x9a')](_0xe1e5cc,_0x1e15('0xcb'));if(ut[_0x1e15('0xc7')](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut['cloneAction'](_0xe1e5cc,0xf,'Global');rpcDb['createCustomerFinal'](_0x2144c3,_0x1e15('0xcc'));}else{if(_0xe1e5cc[_0x1e15('0xc6')]>=_0x2c4208[_0x1e15('0xcd')]){rpcDb[_0x1e15('0x9d')](_0xe1e5cc,_0x1e15('0xcb'));}else{rpcDb[_0x1e15('0xb1')](ut[_0x1e15('0xb2')](_0xe1e5cc,'countbusyretry',_0x2c4208[_0x1e15('0xce')]),_0xe1e5cc[_0x1e15('0xb4')],_0xe1e5cc['activeContact']);}}break;case'NOANSWER':_0x2c4208[_0x1e15('0x41')]+=0x1;_0xe1e5cc[_0x1e15('0xcf')]+=0x1;_0xe1e5cc[_0x1e15('0xa7')]=ut[_0x1e15('0xc7')](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0x3,_0x1e15('0xd0'));ami['emit'](_0x1e15('0xd1'),ut['buildObj'](_0xe1e5cc,_0x1e15('0xd2')));rpcDb['createCustomerHistory'](_0xe1e5cc,_0x1e15('0xd3'));if(ut[_0x1e15('0xc7')](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut[_0x1e15('0xae')](_0xe1e5cc,0xf,_0x1e15('0xd4'));rpcDb[_0x1e15('0x9d')](_0x2144c3,_0x1e15('0xd5'));}else{if(_0xe1e5cc[_0x1e15('0xcf')]>=_0x2c4208[_0x1e15('0xd6')]){rpcDb[_0x1e15('0x9d')](_0xe1e5cc,_0x1e15('0xd3'));}else{rpcDb[_0x1e15('0xb1')](ut['scheduledAt'](_0xe1e5cc,'countnoanswerretry',_0x2c4208[_0x1e15('0xd7')]),_0xe1e5cc[_0x1e15('0xb4')],_0xe1e5cc[_0x1e15('0xd8')]);}}break;case _0x1e15('0xd9'):_0x2c4208[_0x1e15('0xda')]+=0x1;_0xe1e5cc[_0x1e15('0xdb')]+=0x1;_0xe1e5cc[_0x1e15('0xa7')]=ut['totalGlobal'](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0x8,_0x1e15('0xdc'));ami[_0x1e15('0xb8')](_0x1e15('0xdd'),ut[_0x1e15('0xaa')](_0xe1e5cc,_0x1e15('0xde')));rpcDb['createCustomerHistory'](_0xe1e5cc,_0x1e15('0xdf'));if(ut[_0x1e15('0xc7')](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut[_0x1e15('0xae')](_0xe1e5cc,0xf,_0x1e15('0xd4'));rpcDb['createCustomerFinal'](_0x2144c3,_0x1e15('0xe0'));}else{if(_0xe1e5cc['countcongestionretry']>=_0x2c4208[_0x1e15('0xe1')]){rpcDb[_0x1e15('0x9d')](_0xe1e5cc,_0x1e15('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0x1e15('0xb2')](_0xe1e5cc,'countcongestionretry',_0x2c4208['dialBusyRetryFrequency']),_0xe1e5cc[_0x1e15('0xb4')],_0xe1e5cc['activeContact']);}}break;case _0x1e15('0xe2'):_0x2c4208['outboundRejectCallsDay']+=0x1;_0xe1e5cc[_0x1e15('0xe3')]+=0x1;_0xe1e5cc[_0x1e15('0xa7')]=ut[_0x1e15('0xc7')](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0x14,_0x1e15('0xe4'));ami[_0x1e15('0xb8')](_0x1e15('0xe5'),ut['buildObj'](_0xe1e5cc,_0x1e15('0xe6')));rpcDb[_0x1e15('0x9a')](_0xe1e5cc,_0x1e15('0xe7'));if(ut[_0x1e15('0xc7')](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut[_0x1e15('0xae')](_0xe1e5cc,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x2144c3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0xe1e5cc[_0x1e15('0xe3')]>=_0x2c4208[_0x1e15('0xe8')]){rpcDb[_0x1e15('0x9d')](_0xe1e5cc,_0x1e15('0xe9'));}else{rpcDb['rescheduleContact'](ut[_0x1e15('0xb2')](_0xe1e5cc,_0x1e15('0xe3'),_0x2c4208[_0x1e15('0xea')]),_0xe1e5cc[_0x1e15('0xb4')],_0xe1e5cc[_0x1e15('0xd8')]);}}break;case _0x1e15('0xeb'):_0x2c4208['outboundAbandonedCallsDay']+=0x1;_0xe1e5cc['countabandonedretry']+=0x1;_0xe1e5cc[_0x1e15('0xa7')]=ut['totalGlobal'](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0xb,_0x1e15('0xec'));rpcDb['createCustomerHistory'](_0xe1e5cc,_0x1e15('0xed'));if(ut[_0x1e15('0xc7')](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut[_0x1e15('0xae')](_0xe1e5cc,0xf,_0x1e15('0xd4'));rpcDb['createCustomerFinal'](_0x2144c3,_0x1e15('0xed'));}else{if(_0xe1e5cc['countabandonedetry']>=_0x2c4208[_0x1e15('0xee')]){rpcDb[_0x1e15('0x9d')](_0xe1e5cc,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x1e15('0xb1')](ut['scheduledAt'](_0xe1e5cc,_0x1e15('0xef'),_0x2c4208[_0x1e15('0xf0')]),_0xe1e5cc[_0x1e15('0xb4')],_0xe1e5cc['activeContact']);}}break;default:if(_0xe1e5cc[_0x1e15('0x78')]){ut[_0x1e15('0x82')](_0x2c4208,'[default]');ut[_0x1e15('0x83')](_0x1e15('0xf1')+_0x2c4208['name'],_0x5e3ba0);}_0x2c4208['outboundUnknownCallsDay']+=0x1;_0xe1e5cc['countglobal']=ut[_0x1e15('0xc7')](_0xe1e5cc);ut[_0x1e15('0x96')](_0xe1e5cc,0xc,_0x5e3ba0['cause-txt']||_0x5e3ba0[_0x1e15('0xf2')]);rpcDb[_0x1e15('0x9a')](_0xe1e5cc,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x1e15('0xc7')](_0xe1e5cc)>=_0x2c4208[_0x1e15('0xad')]){_0x2144c3=ut[_0x1e15('0xae')](_0xe1e5cc,0xf,_0x1e15('0xd4'));rpcDb[_0x1e15('0x9d')](_0x2144c3,_0x1e15('0xf3'));}else{rpcDb[_0x1e15('0x9d')](_0xe1e5cc,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x1e15('0x72')][_0x5e3ba0['linkedid']];}if(!(_0xe1e5cc[_0x1e15('0x78')]&&_0xf6d181==='16')){ut[_0x1e15('0xf4')](_0x2c4208,_0x1e15('0xf5'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0xe1e5cc[_0x1e15('0xc3')],_0x1e15('0xf6'),_0x2c4208['name'],'originated:\x20',_0x2c4208[_0x1e15('0x53')]);}if(_0xf6d181!==_0x1e15('0xf7')){delete this['actions'][_0x5e3ba0[_0x1e15('0xf8')]];delete this['actions'][_0x5e3ba0['destlinkedid']];}}};Preview[_0x1e15('0xf')][_0x1e15('0xf9')]=function(_0x19b2e9,_0x17bcd6,_0x327388){if(_[_0x1e15('0xfa')](_0x17bcd6)&&_0x1e15('0xfb')!==typeof _0x17bcd6){return;}if(_['isUndefined'](_0x327388)&&_0x1e15('0xfb')!==typeof _0x327388){return;}switch(_0x327388[_0x1e15('0xfc')]){case'0':ut[_0x1e15('0xfd')](_0x19b2e9,0x0,_0x1e15('0xa8'));rpcDb[_0x1e15('0xfe')](_0x19b2e9,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x1e15('0xfd')](_0x19b2e9,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x19b2e9,_0x1e15('0xff'));break;case'5':ut[_0x1e15('0xfd')](_0x19b2e9,0x5,_0x1e15('0xc8'));rpcDb['createAgentHistory'](_0x19b2e9,_0x1e15('0x100'));break;case'8':ut[_0x1e15('0xfd')](_0x19b2e9,0x8,_0x1e15('0xdc'));rpcDb[_0x1e15('0xfe')](_0x19b2e9,_0x1e15('0x101'));break;case'22':ut[_0x1e15('0xfd')](_0x19b2e9,0x16,_0x1e15('0x102'));rpcDb[_0x1e15('0xfe')](_0x19b2e9,_0x1e15('0x103'));break;default:ut[_0x1e15('0xfd')](_0x19b2e9,0xc,_0x327388[_0x1e15('0xfc')]);rpcDb[_0x1e15('0xfe')](_0x19b2e9,_0x1e15('0x101'));}ut[_0x1e15('0xf4')](_0x17bcd6,_0x1e15('0x104'));logger[_0x1e15('0x61')](_0x1e15('0x105'),_0x19b2e9[_0x1e15('0xc3')],_0x1e15('0xf6'),_0x17bcd6[_0x1e15('0x5f')],_0x1e15('0x76'),_0x17bcd6[_0x1e15('0x53')]);delete this[_0x1e15('0x72')][_0x19b2e9['uniqueid']];};Preview[_0x1e15('0xf')][_0x1e15('0x106')]=function(_0x37fb47,_0x25cfa2,_0x2eb7c9,_0x266831,_0x34e498){var _0x26e1e5=this;return new BPromise(function(_0x456c97,_0x20a4f9){if(_['isNil'](_0x25cfa2)||_['isNil'](_0x25cfa2[_0x1e15('0x107')])||_[_0x1e15('0x71')](_0x25cfa2[_0x1e15('0x107')][_0x1e15('0x108')])||_[_0x1e15('0x71')](_0x25cfa2[_0x1e15('0x109')])){_0x20a4f9(ut['message']('Contact\x20is\x20undefined',_0x266831,_0x34e498));return;}var _0x358182=uuid['v4']();var _0x25e1c5=_0x26e1e5['campaignsPreview'][_0x25cfa2[_0x1e15('0x74')][_0x1e15('0x5f')]];var _0x1ba58a=_0x2eb7c9?_0x26e1e5[_0x1e15('0x17')][_0x2eb7c9]['id']:undefined;_0x26e1e5[_0x1e15('0x72')][_0x358182]=new Action(_0x25cfa2,_0x25e1c5,_0x358182,_0x2eb7c9,_0x1ba58a);var _0x86f894=_0x26e1e5[_0x1e15('0x72')][_0x358182];_0x86f894[_0x1e15('0xb4')]=_0x266831;_0x86f894[_0x1e15('0xd8')]=_0x34e498;_0x86f894[_0x1e15('0x10a')]=_0x2eb7c9;if(_[_0x1e15('0x10b')](_0x37fb47)){_0x26e1e5[_0x1e15('0x10c')](_0x86f894,_0x25e1c5,_0x25cfa2,_0x2eb7c9)[_0x1e15('0x8b')](function(_0x574475){logger['info'](_0x1e15('0x10d'),'Queue:\x20'+_0x86f894[_0x1e15('0x75')]+'\x20IdHopper:\x20'+_0x86f894[_0x1e15('0x10e')],JSON['stringify'](_0x574475));ami['emit'](_0x1e15('0x10f'),ut['buildObj'](_0x86f894,_0x1e15('0x110')));_0x456c97(ut['message']('Calling'));})['catch'](function(_0x5947be){ut[_0x1e15('0x66')](_0x1e15('0x111'),_0x5947be);_0x20a4f9(ut[_0x1e15('0x52')](_0x1e15('0x112'),_0x266831,_0x34e498));});}else{_0x25e1c5[_0x1e15('0x3d')]+=0x1;ut[_0x1e15('0x113')](_0x86f894);rpcDb[_0x1e15('0x114')](_0x86f894,_0x1e15('0x115'));delete _0x26e1e5[_0x1e15('0x72')][_0x358182];_0x20a4f9(ut['message'](_0x1e15('0x116'),_0x266831,_0x34e498));}});};Preview[_0x1e15('0xf')][_0x1e15('0xa1')]=function(_0xc9b007){return!_[_0x1e15('0x71')](_0xc9b007)&&!_[_0x1e15('0x71')](_0xc9b007[_0x1e15('0x5f')])&&!_['isNil'](_0xc9b007[_0x1e15('0x5b')])&&_0xc9b007['active']&&!_['isNil'](this['trunks'][util[_0x1e15('0x5e')](_0x1e15('0x117'),_0xc9b007[_0x1e15('0x5f')])])&&!_[_0x1e15('0x71')](this['trunks'][util[_0x1e15('0x5e')](_0x1e15('0x117'),_0xc9b007[_0x1e15('0x5f')])]['status'])&&(this[_0x1e15('0x16')][util[_0x1e15('0x5e')](_0x1e15('0x117'),_0xc9b007['name'])]['status']===_0x1e15('0x118')||this[_0x1e15('0x16')][util[_0x1e15('0x5e')]('SIP/%s',_0xc9b007['name'])][_0x1e15('0x119')]===_0x1e15('0x11a'));};Preview['prototype'][_0x1e15('0x11b')]=function(_0x1ec83c,_0x5b24a0){var _0x3779cd=this;return new BPromise(function(_0x348ef6,_0x5ec852){_0x3779cd[_0x1e15('0x11c')](_0x1ec83c,_0x5b24a0)[_0x1e15('0x8b')](function(_0x1bd2b9){_0x348ef6(_[_0x1e15('0x79')](_0x1bd2b9,['message']));})[_0x1e15('0x7f')](function(_0xa44567){if(_0xa44567[_0x1e15('0x11d')]){rpcDb['unlockContact'](_0x1ec83c);}if(_0xa44567[_0x1e15('0x5b')]){rpcDb[_0x1e15('0x11e')](_0x1ec83c);}_0x5ec852(_[_0x1e15('0x79')](_0xa44567,[_0x1e15('0x52')]));});});};Preview[_0x1e15('0xf')][_0x1e15('0x11c')]=function(_0x188844,_0x5992c2){var _0x576e65=this;return new BPromise(function(_0x1339fe,_0x50852f){var _0x55ca6c,_0x23c19b;rpcDb[_0x1e15('0x11f')](_0x188844)[_0x1e15('0x8b')](function(_0x95a040){if(!_['isNil'](_0x95a040[0x0])){_0x23c19b=_0x95a040[0x0][_0x1e15('0x120')]?![]:!![];_0x55ca6c=_0x95a040[0x0]['recallme']?!![]:![];_0x55ca6c=_0x5992c2?!![]:_0x55ca6c;}var _0x2bc398=_0x576e65[_0x1e15('0x121')](_0x95a040);if(_0x2bc398[_0x1e15('0x122')]){rpcDb[_0x1e15('0x123')](_[_0x1e15('0x79')](_0x95a040[0x0],['VoiceQueueId',_0x1e15('0x124')]))[_0x1e15('0x8b')](function(_0x2c6777){_0x576e65[_0x1e15('0x106')](_0x2c6777,_0x95a040[0x0],_0x5992c2,_0x23c19b,_0x55ca6c)[_0x1e15('0x8b')](function(_0x12688f){_0x1339fe(_0x12688f);})['catch'](function(_0xa657f6){_0x50852f(_0xa657f6);});})['catch'](function(_0x1fb42b){ut[_0x1e15('0x66')](_0x1e15('0x125'),_0x1fb42b);_0x50852f(ut[_0x1e15('0x52')](_0x1e15('0x126'),_0x23c19b,_0x55ca6c));});}else{_0x50852f(ut[_0x1e15('0x52')](_0x2bc398[_0x1e15('0x52')],_0x23c19b,_0x55ca6c));}})[_0x1e15('0x7f')](function(_0x5b3fe6){ut[_0x1e15('0x66')]('[Preview][getContactPreview]',_0x5b3fe6);_0x50852f(ut['message'](_0x1e15('0x126'),![],!![]));});});};Preview[_0x1e15('0xf')][_0x1e15('0x121')]=function(_0x38bfb5){if(_[_0x1e15('0x71')](_0x38bfb5)||_[_0x1e15('0x10b')](_0x38bfb5)||!_[_0x1e15('0x71')](_0x38bfb5[0x0][_0x1e15('0x90')])&&_[_0x1e15('0x71')](_0x38bfb5[0x0]['Agent'][_0x1e15('0x5f')])){ut[_0x1e15('0x66')](_0x1e15('0x127'),_0x38bfb5);return{'isValid':![],'message':_0x1e15('0x128')};}var _0x31883f=this[_0x1e15('0x14')][_0x38bfb5[0x0][_0x1e15('0x74')][_0x1e15('0x5f')]];_0x31883f['message']='ACTIVE';if(_['isNil'](_0x31883f)){ut['logger'](_0x1e15('0x129'),_0x31883f);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x1e15('0xa1')](_0x31883f[_0x1e15('0x5a')])){ut[_0x1e15('0x66')](_0x1e15('0x12a'),_0x1e15('0x12b')+_0x31883f[_0x1e15('0x5f')]+_0x1e15('0x12c'));if(!this[_0x1e15('0xa1')](_0x31883f[_0x1e15('0xa2')])){ut[_0x1e15('0x66')](_0x1e15('0x12a'),_0x31883f[_0x1e15('0x5f')]+_0x1e15('0x12d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x1e15('0x12e')](_0x31883f['dialActive'])){ut['logger'](_0x1e15('0x12f'),_0x31883f[_0x1e15('0x5f')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x1e15('0x12b')+_0x31883f[_0x1e15('0x5f')]+_0x1e15('0x130')};}return{'isValid':!![],'message':_0x1e15('0x131')};};Preview[_0x1e15('0xf')][_0x1e15('0x10c')]=function(_0x31acd4,_0x36fa17,_0x13c498,_0x58f851){var _0x2554ed=this;return new BPromise(function(_0x2f9b3d,_0x4293b4){var _0x552c7d=_0x31acd4['uniqueid'];var _0x34cb73=_0x2554ed[_0x1e15('0xa1')](_0x36fa17[_0x1e15('0x5a')])?util[_0x1e15('0x5e')]('SIP/%s/%s%s',_0x36fa17['Trunk'][_0x1e15('0x5f')],_['isNil'](_0x36fa17['dialPrefix'])?'':_0x36fa17[_0x1e15('0x132')][_0x1e15('0x133')]()||'',_0x36fa17[_0x1e15('0x134')]>0x0?_0x13c498[_0x1e15('0x107')]['phone']['substring'](_0x36fa17[_0x1e15('0x134')]):_0x13c498[_0x1e15('0x107')][_0x1e15('0x108')]):util[_0x1e15('0x5e')](_0x1e15('0x135'),_[_0x1e15('0x71')](_0x36fa17[_0x1e15('0xa2')])?_0x36fa17['Trunk'][_0x1e15('0x5f')]:_0x36fa17[_0x1e15('0xa2')][_0x1e15('0x5f')],_[_0x1e15('0x71')](_0x36fa17[_0x1e15('0x132')])?'':_0x36fa17['dialPrefix'][_0x1e15('0x133')]()||'',_0x36fa17['dialCutDigit']>0x0?_0x13c498['Contact']['phone']['substring'](_0x36fa17[_0x1e15('0x134')]):_0x13c498[_0x1e15('0x107')][_0x1e15('0x108')]);var _0xf18865=_0x2554ed[_0x1e15('0xa1')](_0x36fa17[_0x1e15('0x5a')])?ut[_0x1e15('0x136')](_0x36fa17[_0x1e15('0x5a')][_0x1e15('0x137')],_0x36fa17[_0x1e15('0x38')],_0x36fa17[_0x1e15('0x138')]>0x0?ut['getCallerIdRandom'](_0x36fa17[_0x1e15('0x39')],_0x36fa17[_0x1e15('0x138')]):_0x36fa17[_0x1e15('0x39')]):ut[_0x1e15('0x136')](_[_0x1e15('0x71')](_0x36fa17[_0x1e15('0xa2')])?_0x36fa17[_0x1e15('0x5a')]['callerid']:_0x36fa17[_0x1e15('0xa2')]['callerid'],_0x36fa17[_0x1e15('0x38')],_0x36fa17[_0x1e15('0x138')]>0x0?ut[_0x1e15('0x139')](_0x36fa17[_0x1e15('0x39')],_0x36fa17[_0x1e15('0x138')]):_0x36fa17[_0x1e15('0x39')]);if(_0xf18865){_0x31acd4[_0x1e15('0x13a')]=ut[_0x1e15('0x13b')](_0xf18865);_0x31acd4[_0x1e15('0x13c')]=ut[_0x1e15('0x13d')](_0xf18865);}var _0x50a5a6=ut['addVariables'](_0x36fa17,_0x13c498,_0x34cb73,_0xf18865,_0x552c7d,_0x31acd4);_['merge'](_0x31acd4,ut[_0x1e15('0x13e')](_0x50a5a6));_0x31acd4[_0x1e15('0x13f')]=moment()[_0x1e15('0x5e')](_0x1e15('0x94'));ami[_0x1e15('0x7d')](ut[_0x1e15('0x140')](_0x31acd4,_0x36fa17,_0x50a5a6,_0x31acd4[_0x1e15('0xd8')],_0x58f851))[_0x1e15('0x8b')](function(_0x5da838){_0x36fa17[_0x1e15('0x53')]+=0x1;logger[_0x1e15('0x61')](_0x1e15('0x141'),_0x552c7d,_0x1e15('0xf6'),_0x36fa17[_0x1e15('0x5f')],_0x1e15('0x76'),_0x36fa17[_0x1e15('0x53')]);_0x2f9b3d(_0x5da838);})[_0x1e15('0x7f')](function(_0x5cfc8f){ut[_0x1e15('0xfd')](_0x31acd4,0xe,_0x1e15('0x142'));rpcDb[_0x1e15('0xfe')](_0x31acd4,'[originateFailure][logOriginateFailure]');_0x4293b4(_0x5cfc8f);});});};Preview[_0x1e15('0xf')][_0x1e15('0x143')]=function(_0x466287){if(this[_0x1e15('0x72')][_0x466287[_0x1e15('0xf8')]]){this[_0x1e15('0x72')][_0x466287[_0x1e15('0xf8')]]['channel']=_0x466287[_0x1e15('0x7e')];}};Preview[_0x1e15('0xf')][_0x1e15('0x1a')]=function(_0x24dd68){var _0x555b19=this;var _0x274a7e=this[_0x1e15('0x72')][_0x24dd68['actionid']];if(_0x274a7e){if(_0x274a7e[_0x1e15('0x10a')]&&this[_0x1e15('0x17')][_0x274a7e[_0x1e15('0x10a')]]){ut[_0x1e15('0x144')](_0x274a7e,this[_0x1e15('0x17')][_0x274a7e[_0x1e15('0x10a')]][_0x1e15('0x5f')],this[_0x1e15('0x17')][_0x274a7e[_0x1e15('0x10a')]]['id']);}var _0x505bc9=_[_0x1e15('0x145')](_0x274a7e);_0x505bc9[_0x1e15('0xb5')]=moment()[_0x1e15('0x5e')](_0x1e15('0x94'));var _0xdf1ece=_0x555b19[_0x1e15('0x14')][_0x274a7e[_0x1e15('0x75')]];if(ut['isFailure'](_0x24dd68[_0x1e15('0x146')])){if(_0x274a7e[_0x1e15('0xb4')]){rpcDb[_0x1e15('0x147')](_0x274a7e[_0x1e15('0x10e')]);}if(_0x274a7e[_0x1e15('0xd8')]){rpcDb[_0x1e15('0x11e')](_0x274a7e['idContact']);}ami[_0x1e15('0xb8')](_0x1e15('0x148'),ut[_0x1e15('0xaa')](_0x274a7e,'rejected'));this['callProgressDetectingAgent'](_0x505bc9,_0xdf1ece,_0x24dd68);}else{_0x274a7e[_0x1e15('0x13f')]=moment()['format'](_0x1e15('0x94'));ut[_0x1e15('0xfd')](_0x505bc9,0x4,_0x1e15('0xbe'));rpcDb[_0x1e15('0xfe')](_0x505bc9,_0x1e15('0x149'));}}};Preview['prototype'][_0x1e15('0x1d')]=function(_0x428cea){var _0x41332e=this;var _0x5343d3=this['actions'][_0x428cea[_0x1e15('0xf8')]];var _0x23e8db;if(_0x5343d3){_0x23e8db=this['campaignsPreview'][_0x5343d3[_0x1e15('0x75')]];logger[_0x1e15('0x61')](_0x1e15('0x14a'),_0x428cea[_0x1e15('0xf8')],_0x1e15('0xf6'),_0x23e8db['name'],_0x1e15('0x77'),_0x23e8db[_0x1e15('0x2d')]);}if(this['actions'][_0x428cea[_0x1e15('0xf8')]]&&_0x428cea['linkedid']!==_0x428cea[_0x1e15('0xc3')]){if(_0x428cea[_0x1e15('0x14b')]==='16'&&this[_0x1e15('0x72')][_0x428cea[_0x1e15('0xf8')]][_0x1e15('0x78')]){this[_0x1e15('0xa5')](_0x428cea,_0x428cea[_0x1e15('0xf8')],_0x428cea['cause']);}else if(this[_0x1e15('0x72')][_0x428cea[_0x1e15('0xf8')]][_0x1e15('0x78')]){logger[_0x1e15('0x61')]('[syncHangup][talking][cause]',_0x428cea[_0x1e15('0xf8')],_0x428cea[_0x1e15('0x14b')],_0x1e15('0xf6'),_0x23e8db['name'],'pTalking:\x20',_0x23e8db[_0x1e15('0x2d')]);this[_0x1e15('0xa5')](_0x428cea,_0x428cea[_0x1e15('0xf8')],_0x428cea['cause']);}}else if(_0x5343d3&&_[_0x1e15('0x71')](_0x5343d3[_0x1e15('0x14c')])&&_0x23e8db[_0x1e15('0x14d')]&&_0x428cea['linkedid']===_0x428cea['uniqueid']&&_[_0x1e15('0x71')](_0x428cea[_0x1e15('0xfc')])&&_0x428cea['cause']==='16'&&_0x428cea['channelstate']==='6'&&_[_0x1e15('0xfa')](_0x5343d3['transfer'])){if(_0x5343d3[_0x1e15('0xb4')]){rpcDb[_0x1e15('0x147')](_0x5343d3['idContact']);}if(_0x5343d3[_0x1e15('0xd8')]){rpcDb[_0x1e15('0x11e')](_0x5343d3[_0x1e15('0x10e')]);}_0x428cea[_0x1e15('0xfc')]='22';this[_0x1e15('0xf9')](_0x5343d3,_0x23e8db,_0x428cea);}else if(_0x5343d3&&_0x5343d3[_0x1e15('0x14e')]){if(_0x428cea[_0x1e15('0x14b')]==='16'&&this[_0x1e15('0x72')][_0x428cea[_0x1e15('0xf8')]][_0x1e15('0x78')]){logger['info']('[syncHangup][talking][transfer]',_0x428cea['linkedid'],_0x428cea[_0x1e15('0x14b')],'\x20Queue',_0x23e8db[_0x1e15('0x5f')],_0x1e15('0x77'),_0x23e8db[_0x1e15('0x2d')]);this[_0x1e15('0xa5')](_0x428cea,_0x428cea[_0x1e15('0xf8')],_0x428cea['cause']);}else if(this[_0x1e15('0x72')][_0x428cea[_0x1e15('0xf8')]]['dialAnswer']){logger['info'](_0x1e15('0x14f'),_0x428cea['linkedid'],_0x428cea['cause'],'\x20Queue',_0x23e8db[_0x1e15('0x5f')],_0x1e15('0x77'),_0x23e8db[_0x1e15('0x2d')]);this['callProgressDetectingCustomer'](_0x428cea,_0x428cea[_0x1e15('0xf8')],_0x428cea[_0x1e15('0x14b')]);}}};Preview[_0x1e15('0xf')][_0x1e15('0x20')]=function(_0x2fe06e){if(this[_0x1e15('0x72')][_0x2fe06e[_0x1e15('0x150')]]&&_0x2fe06e['destlinkedid']!==_0x2fe06e['destuniqueid']){this[_0x1e15('0xa5')](_0x2fe06e,_0x2fe06e[_0x1e15('0x150')],_0x2fe06e[_0x1e15('0xf2')]);}};Preview[_0x1e15('0xf')][_0x1e15('0x1f')]=function(_0xfab432){if(this['actions'][_0xfab432[_0x1e15('0xf8')]]&&_0xfab432[_0x1e15('0xf8')]!==_0xfab432[_0x1e15('0xc3')]&&!this[_0x1e15('0x72')][_0xfab432[_0x1e15('0xf8')]][_0x1e15('0x78')]){if(_0xfab432[_0x1e15('0x14b')]==='1'){this[_0x1e15('0xa5')](_0xfab432,_0xfab432['linkedid'],_0xfab432[_0x1e15('0x14b')]);}}};Preview[_0x1e15('0xf')][_0x1e15('0x151')]=function(_0x16b130,_0x11456b,_0x13f3c0){if(this[_0x1e15('0x72')][_0x16b130]){if(_[_0x1e15('0x71')](this['actions'][_0x16b130]['variables'])){this[_0x1e15('0x72')][_0x16b130]['variables']={};}this['actions'][_0x16b130][_0x1e15('0x152')][_0x11456b]=_0x13f3c0;}};Preview[_0x1e15('0xf')][_0x1e15('0x22')]=function(_0x5150f2){try{if(!_[_0x1e15('0x71')](_0x5150f2)){if(ut[_0x1e15('0x153')](_[_0x1e15('0x154')](_0x5150f2['variable'])[0x0])){this[_0x1e15('0x151')](_0x5150f2['uniqueid'],_[_0x1e15('0x154')](_0x5150f2[_0x1e15('0x155')])[0x0],_0x5150f2['value']);}}}catch(_0x5d5eb1){logger['error']('[syncVarSet][Preview]',util[_0x1e15('0x156')](_0x5d5eb1,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x1e15('0x24')]=function(_0x24bc94){if(_0x24bc94){if(this[_0x1e15('0x72')][_0x24bc94[_0x1e15('0x157')]]){this[_0x1e15('0x72')][_0x24bc94[_0x1e15('0x157')]][_0x1e15('0x14e')]=!![];}}};Preview[_0x1e15('0xf')]['syncBlindTransfer']=function(_0x22cd20){if(_0x22cd20){if(this[_0x1e15('0x72')][_0x22cd20[_0x1e15('0x158')]]){this[_0x1e15('0x72')][_0x22cd20[_0x1e15('0x158')]]['transfer']=!![];}}};module[_0x1e15('0x159')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4d22889..39d25df 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 _0xcb66=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0x1098b9,_0x1edd8e){var _0x36dc0c=function(_0x17284c){while(--_0x17284c){_0x1098b9['push'](_0x1098b9['shift']());}};_0x36dc0c(++_0x1edd8e);}(_0xcb66,0x19f));var _0x6cb6=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xcb66[_0xd0a847];return _0x2536ec;};'use strict';var util=require('util');var BPromise=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var _=require(_0x6cb6('0x3'));var cmHopper=require(_0x6cb6('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x6cb6('0x5'));var cmHopperBlack=require(_0x6cb6('0x6'));var voiceQueueRt=require(_0x6cb6('0x7'));var agentReportPreview=require(_0x6cb6('0x8'));var voiceQueueReport=require(_0x6cb6('0x9'));function loggerCatch(_0x506d14){return function(_0x53078d){logger[_0x6cb6('0xa')](_0x506d14,util[_0x6cb6('0xb')](_0x53078d,{'showHidden':![],'depth':null}));};}function create(_0x1028b3){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopperHistory[_0x6cb6('0xe')](_0x1028b3))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x10')));}function createAgent(_0x332bce){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](agentReportPreview[_0x6cb6('0xe')](_0x332bce))[_0x6cb6('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4923a2){return BPromise['resolve']()['then'](cmHopper[_0x6cb6('0x11')](_0x4923a2,!![]))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x12')));}exports[_0x6cb6('0x13')]=function(_0x585233){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopperBlack['checkIsBlackList'](_0x585233))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x14')));};exports['getContactPreview']=function(_0x107492){return BPromise[_0x6cb6('0xc')]()['then'](cmHopper['getContactPreview'](_0x107492))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x6cb6('0xe')]=function(_0x298daa,_0x9c901a){create(_0x298daa)[_0x6cb6('0xf')](loggerCatch(_0x9c901a));moveContact(_0x298daa)[_0x6cb6('0xf')](loggerCatch(_0x9c901a));};exports[_0x6cb6('0x15')]=function(_0x5b8a17,_0x1e8b7e){createAgent(_0x5b8a17)[_0x6cb6('0xf')](loggerCatch(_0x1e8b7e));};exports['createCustomerHistory']=function(_0x4b9da5,_0x5ef3d2){create(_0x4b9da5)['catch'](loggerCatch(_0x5ef3d2));};exports['createCustomerFinal']=function(_0x5e5349,_0x390c9b){moveContact(_0x5e5349)[_0x6cb6('0xf')](loggerCatch(_0x390c9b));};exports[_0x6cb6('0x16')]=function(_0x2d41c4,_0xc5dea0,_0x5e14c8){if(_0xc5dea0){_0x2d41c4['UserId']=null;}if(_0x5e14c8){_0x2d41c4[_0x6cb6('0x17')]=![];}return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x16')](_0x2d41c4))['catch'](loggerCatch(_0x6cb6('0x18')));};exports[_0x6cb6('0x19')]=function(_0x58a6ed){return BPromise['resolve']()[_0x6cb6('0xd')](cmHopper['countReScheduled'](_0x58a6ed))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1a')));};exports[_0x6cb6('0x1b')]=function(_0x18ecb9){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x1b')]({'UserId':null},_0x18ecb9,0x1))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1c')));};exports[_0x6cb6('0x1d')]=function(_0x47a81b){return BPromise['resolve']()['then'](cmHopper[_0x6cb6('0x1b')]({'active':![]},_0x47a81b,0x1))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x1e')));};exports[_0x6cb6('0x1f')]=function(_0x1f8c9d){var _0x3b62e6={};_0x3b62e6['type']=_0x1f8c9d[_0x6cb6('0x20')];_0x3b62e6['uniqueid']=_0x1f8c9d[_0x6cb6('0x21')];_0x3b62e6['calleridnum']=_0x1f8c9d[_0x6cb6('0x22')];_0x3b62e6[_0x6cb6('0x23')]=_0x1f8c9d[_0x6cb6('0x23')];_0x3b62e6['queue']=_0x1f8c9d[_0x6cb6('0x24')];_0x3b62e6[_0x6cb6('0x25')]=_0x1f8c9d[_0x6cb6('0x26')];_0x3b62e6['queuecallerleaveAt']=_0x1f8c9d[_0x6cb6('0x26')];_0x3b62e6[_0x6cb6('0x27')]=0x1;_0x3b62e6[_0x6cb6('0x28')]=_0x1f8c9d['endtime'];_0x3b62e6[_0x6cb6('0x29')]=_0x1f8c9d[_0x6cb6('0x2a')];_0x3b62e6['context']=_0x6cb6('0x2b');_0x3b62e6[_0x6cb6('0x2c')]=_0x6cb6('0x2d');_0x3b62e6[_0x6cb6('0x2e')]=0x0;_0x3b62e6[_0x6cb6('0x2f')]=0x1;_0x3b62e6[_0x6cb6('0x30')]=_0x1f8c9d[_0x6cb6('0x2a')];_0x3b62e6[_0x6cb6('0x31')]=_0x6cb6('0x32');return BPromise[_0x6cb6('0xc')]()['then'](voiceQueueReport[_0x6cb6('0x33')](_0x3b62e6))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x34')));};exports[_0x6cb6('0x35')]=function(_0x586cf9,_0x558494){return BPromise['resolve']()[_0x6cb6('0xd')](cmHopper[_0x6cb6('0x35')](_0x586cf9,_0x558494))[_0x6cb6('0xf')](loggerCatch(_0x6cb6('0x36')));};exports[_0x6cb6('0x37')]=function(_0xa9f21b){return BPromise[_0x6cb6('0xc')]()[_0x6cb6('0xd')](cmHopper['rescheduleContact'](_0xa9f21b,!![],!![]))[_0x6cb6('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x8d0e=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper'];(function(_0x556b28,_0x46061b){var _0x23bfc1=function(_0x27bf7d){while(--_0x27bf7d){_0x556b28['push'](_0x556b28['shift']());}};_0x23bfc1(++_0x46061b);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4f030c,_0x13bea9){_0x4f030c=_0x4f030c-0x0;var _0xe77b7d=_0x8d0e[_0x4f030c];return _0xe77b7d;};'use strict';var util=require(_0xe8d0('0x0'));var BPromise=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var _=require(_0xe8d0('0x4'));var cmHopper=require(_0xe8d0('0x5'));var cmHopperFinal=require(_0xe8d0('0x6'));var cmHopperHistory=require(_0xe8d0('0x7'));var cmHopperBlack=require(_0xe8d0('0x8'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xe8d0('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x560dab){return function(_0x2e2985){logger[_0xe8d0('0xa')](_0x560dab,util[_0xe8d0('0xb')](_0x2e2985,{'showHidden':![],'depth':null}));};}function create(_0xcc03d0){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopperHistory[_0xe8d0('0xe')](_0xcc03d0))[_0xe8d0('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x10e56c){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](agentReportPreview['createHistory'](_0x10e56c))['catch'](loggerCatch(_0xe8d0('0x10')));}function moveContact(_0x25e6b8){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper[_0xe8d0('0x11')](_0x25e6b8,!![]))[_0xe8d0('0xf')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe8d0('0x12')]=function(_0x15b9e5){return BPromise['resolve']()[_0xe8d0('0xd')](cmHopperBlack['checkIsBlackList'](_0x15b9e5))['catch'](loggerCatch(_0xe8d0('0x13')));};exports[_0xe8d0('0x14')]=function(_0x1aa725){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper[_0xe8d0('0x14')](_0x1aa725))['catch'](loggerCatch(_0xe8d0('0x15')));};exports['createHistory']=function(_0x6d932b,_0x3c526c){create(_0x6d932b)[_0xe8d0('0xf')](loggerCatch(_0x3c526c));moveContact(_0x6d932b)['catch'](loggerCatch(_0x3c526c));};exports['createAgentHistory']=function(_0x47c67a,_0x1bdd94){createAgent(_0x47c67a)[_0xe8d0('0xf')](loggerCatch(_0x1bdd94));};exports[_0xe8d0('0x16')]=function(_0x44bbe4,_0x83177b){create(_0x44bbe4)['catch'](loggerCatch(_0x83177b));};exports[_0xe8d0('0x17')]=function(_0x12ebf4,_0x524b00){moveContact(_0x12ebf4)['catch'](loggerCatch(_0x524b00));};exports['rescheduleContact']=function(_0x384a60,_0x35d131,_0x25363b){if(_0x35d131){_0x384a60[_0xe8d0('0x18')]=null;}if(_0x25363b){_0x384a60[_0xe8d0('0x19')]=![];}return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper[_0xe8d0('0x1a')](_0x384a60))[_0xe8d0('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xe8d0('0x1b')]=function(_0x9f747){return BPromise['resolve']()[_0xe8d0('0xd')](cmHopper[_0xe8d0('0x1b')](_0x9f747))[_0xe8d0('0xf')](loggerCatch(_0xe8d0('0x1c')));};exports[_0xe8d0('0x1d')]=function(_0x149dfd){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper[_0xe8d0('0x1d')]({'UserId':null},_0x149dfd,0x1))[_0xe8d0('0xf')](loggerCatch(_0xe8d0('0x1e')));};exports['disableContact']=function(_0x24982c){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper['unlockContact']({'active':![]},_0x24982c,0x1))[_0xe8d0('0xf')](loggerCatch(_0xe8d0('0x1f')));};exports['crateCustomerReportQueue']=function(_0x1519e2){var _0x3ffcb7={};_0x3ffcb7[_0xe8d0('0x20')]=_0x1519e2[_0xe8d0('0x20')];_0x3ffcb7[_0xe8d0('0x21')]=_0x1519e2['uniqueid'];_0x3ffcb7[_0xe8d0('0x22')]=_0x1519e2['calleridnum'];_0x3ffcb7['calleridname']=_0x1519e2['calleridname'];_0x3ffcb7[_0xe8d0('0x23')]=_0x1519e2[_0xe8d0('0x23')];_0x3ffcb7[_0xe8d0('0x24')]=_0x1519e2['answertime'];_0x3ffcb7['queuecallerleaveAt']=_0x1519e2[_0xe8d0('0x25')];_0x3ffcb7['queuecallercomplete']=0x1;_0x3ffcb7[_0xe8d0('0x26')]=_0x1519e2[_0xe8d0('0x27')];_0x3ffcb7[_0xe8d0('0x28')]=_0x1519e2[_0xe8d0('0x29')];_0x3ffcb7[_0xe8d0('0x2a')]='from-sip';_0x3ffcb7[_0xe8d0('0x2b')]=_0xe8d0('0x2c');_0x3ffcb7[_0xe8d0('0x2d')]=0x0;_0x3ffcb7[_0xe8d0('0x2e')]=0x1;_0x3ffcb7['lastAssignedTo']=_0x1519e2[_0xe8d0('0x29')];_0x3ffcb7[_0xe8d0('0x2f')]='COMPLETED';return BPromise[_0xe8d0('0xc')]()['then'](voiceQueueReport[_0xe8d0('0x30')](_0x3ffcb7))['catch'](loggerCatch(_0xe8d0('0x31')));};exports['getContactRecallMe']=function(_0x3a0f03,_0xb2cdbf){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper['getContactRecallMe'](_0x3a0f03,_0xb2cdbf))[_0xe8d0('0xf')](loggerCatch(_0xe8d0('0x32')));};exports[_0xe8d0('0x33')]=function(_0x516243){return BPromise[_0xe8d0('0xc')]()[_0xe8d0('0xd')](cmHopper[_0xe8d0('0x1a')](_0x516243,!![],!![]))[_0xe8d0('0xf')](loggerCatch(_0xe8d0('0x34')));}; \ 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 23a1c12..09ac3ff 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 _0x4201=['calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','RECALL','BOOKED','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','buildAcw','interface','uniqueid','agentReadyId','status','reachable','push','getDiff','ListId','CampaignId','filterKey','type','campaigntype','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','info','inspect','logger2','getCallerId','isUndefined','format','\x22%s\x22\x20<%s>','string','isEmpty','\x22\x22\x20<>','isNil','addVariables','Queue','name'];(function(_0x4ce14f,_0x47ac02){var _0x2b4824=function(_0x570f5e){while(--_0x570f5e){_0x4ce14f['push'](_0x4ce14f['shift']());}};_0x2b4824(++_0x47ac02);}(_0x4201,0x71));var _0x1420=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x4201[_0x46a3e8];return _0xf1442e;};'use strict';var util=require(_0x1420('0x0'));var _=require(_0x1420('0x1'));var moment=require('moment');var logger=require(_0x1420('0x2'))(_0x1420('0x3'));var ipAgi=process[_0x1420('0x4')][_0x1420('0x5')]||_0x1420('0x6');function getSeconds(_0x43d008,_0x59088c){var _0x485039=moment(_0x43d008)[_0x1420('0x7')](0x0);var _0x25590c=moment(_0x59088c)[_0x1420('0x7')](0x0);return _0x485039[_0x1420('0x8')](_0x25590c,_0x1420('0x9'));}exports['loggerCatch']=function(_0x5a925c){return function(_0x46d303){logger[_0x1420('0xa')](_0x5a925c,util['inspect'](_0x46d303,{'showHidden':![],'depth':null}));};};exports[_0x1420('0xb')]=function(_0x53199d,_0x4d8d95){logger[_0x1420('0xc')](_0x53199d,util[_0x1420('0xd')](_0x4d8d95,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x351778,_0x1a05fd){logger[_0x1420('0xa')](_0x351778,util[_0x1420('0xd')](_0x1a05fd,{'showHidden':![],'depth':null}));};exports[_0x1420('0xe')]=function(_0x1d1041){return function(_0x2435f4){logger[_0x1420('0xc')](_0x1d1041,util['inspect'](_0x2435f4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x50cf50,_0x53c03d,_0x466d30){return{'message':_0x50cf50,'unlock':_0x53c03d,'active':_0x466d30};};exports[_0x1420('0xf')]=function(_0x121f70,_0x3b8e01,_0x3bc499){if(!_[_0x1420('0x10')](_0x3bc499)&&'string'===typeof _0x3bc499&&!_['isEmpty'](_0x3bc499)){if(!_[_0x1420('0x10')](_0x3b8e01)&&'string'===typeof _0x3b8e01&&!_['isEmpty'](_0x3b8e01)){return util[_0x1420('0x11')](_0x1420('0x12'),_0x3b8e01,_0x3bc499);}return util[_0x1420('0x11')](_0x1420('0x12'),_0x3bc499,_0x3bc499);}if(!_['isUndefined'](_0x121f70)&&_0x1420('0x13')===typeof _0x121f70&&!_[_0x1420('0x14')](_0x121f70)){return _0x121f70;}return _0x1420('0x15');};exports['isActive']=function(_0x261589){if(_[_0x1420('0x16')](_0x261589)){return![];}return _0x261589;};exports[_0x1420('0x17')]=function(_0x310454,_0x4f3c6b,_0x5535c0,_0x410abb,_0x5c6237,_0x278e77){var _0x3ca369={'XMD-QUEUE':_0x4f3c6b[_0x1420('0x18')]?_0x4f3c6b[_0x1420('0x18')][_0x1420('0x19')]:'','XMD-CALLERID':_0x410abb,'XMD-CALLERID-PREVIEW':_0x278e77?util['format'](_0x1420('0x12'),_0x278e77[_0x1420('0x1a')],_0x278e77[_0x1420('0x1b')]):_0x410abb,'XMD-DIALID':_0x5c6237,'XMD-CONTACTID':_0x4f3c6b[_0x1420('0x1c')],'XMD-CDRTYPE':_0x1420('0x1d'),'CALLERID(all)':_0x410abb,'XMD-VOICEQUEUEID':_0x4f3c6b[_0x1420('0x1e')],'XMD-DIALCHANNEL':_0x5535c0,'XMD-DIALTIMEOUT':_0x310454['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x310454[_0x1420('0x1f')]?'g':'',_[_0x1420('0x14')](_0x310454[_0x1420('0x20')])?'':_0x1420('0x21')),'XMD-DIALURL':_0x310454[_0x1420('0x22')]||'','XMD-AGI':_0x310454['dialQueueProject']?util['format'](_0x1420('0x23'),ipAgi,_0x310454[_0x1420('0x24')]):_0x1420('0x25'),'XMD-AGIAFTER':_0x310454[_0x1420('0x1f')]?util[_0x1420('0x11')](_0x1420('0x23'),ipAgi,_0x310454['dialQueueProject2']):_0x1420('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x278e77?_0x278e77[_0x1420('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x278e77?_0x278e77[_0x1420('0x27')]:'','XMD-DESTINATION':_0x1420('0x28')};if(!_['isEmpty'](_0x310454[_0x1420('0x20')])){_0x3ca369[util[_0x1420('0x11')]('%s',_0x1420('0x29'))]=_0x310454[_0x1420('0x20')];_0x3ca369[util['format']('%s',_0x1420('0x2a'))]=_0x5c6237;}if(_0x4f3c6b&&_0x4f3c6b[_0x1420('0x2b')]){for(var _0x8c3e84 in _0x4f3c6b[_0x1420('0x2b')]){if(_0x4f3c6b[_0x1420('0x2b')][_0x1420('0x2c')](_0x8c3e84)){if(!_[_0x1420('0x16')](_0x4f3c6b[_0x1420('0x2b')][_0x8c3e84])&&_0x8c3e84!=='id'&&_0x8c3e84!==_0x1420('0x2d')&&_0x8c3e84!==_0x1420('0x2e')&&_0x8c3e84!==_0x1420('0x2f')){_0x3ca369[util[_0x1420('0x11')]('%s%s',_0x1420('0x30'),_[_0x1420('0x31')](_0x8c3e84))]=_0x4f3c6b[_0x1420('0x2b')][_0x8c3e84];}}}}return _0x3ca369;};exports[_0x1420('0x32')]=function(_0x17873d){var _0x584f11={};for(var _0x2a812b in _0x17873d){if(_0x17873d[_0x1420('0x2c')](_0x2a812b)){_0x584f11[util['format']('%s',_[_0x1420('0x33')](_0x2a812b))]=_0x17873d[_0x2a812b];}}return{'variables':_0x584f11};};exports['updateOriginated']=function(_0x5a5066,_0x481ede){if(!_[_0x1420('0x16')](_0x5a5066)){if(_0x5a5066[_0x1420('0x2c')](_0x1420('0x34'))){if(_0x5a5066[_0x1420('0x34')]>0x0){_0x5a5066[_0x1420('0x34')]-=0x1;}else{logger[_0x1420('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x481ede);}}}else{logger[_0x1420('0xa')](_0x1420('0x35'),_0x481ede);}};exports['logBlacklist']=function(_0x940f8f){var _0x93bf5f=moment()[_0x1420('0x11')](_0x1420('0x36'));_0x940f8f[_0x1420('0x37')]=0xd;_0x940f8f[_0x1420('0x38')]=_0x1420('0x39');_0x940f8f[_0x1420('0x3a')]=_0x93bf5f;_0x940f8f['responsetime']=_0x93bf5f;_0x940f8f[_0x1420('0x3b')]=_0x93bf5f;};exports[_0x1420('0x3c')]=function(_0x3cddad,_0x156d15,_0x3b6f53){var _0x5c2cd4=moment()[_0x1420('0x11')](_0x1420('0x36'));_0x3cddad[_0x1420('0x37')]=_0x156d15;_0x3cddad[_0x1420('0x38')]=_0x3b6f53;_0x3cddad['responsetime']=_0x5c2cd4;_0x3cddad[_0x1420('0x3d')]=getSeconds(_0x3cddad[_0x1420('0x3e')],_0x3cddad[_0x1420('0x3a')]);};exports[_0x1420('0x3f')]=function(_0x1a9a6a,_0x5e88f5,_0x4e6f7c){_0x1a9a6a[_0x1420('0x40')]=_0x5e88f5;_0x1a9a6a[_0x1420('0x41')]=_0x4e6f7c;};exports[_0x1420('0x42')]=function(_0x29b19f,_0x52e8e1,_0x12e2eb){var _0x4d0957=moment()[_0x1420('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b19f['state']=_0x52e8e1;_0x29b19f[_0x1420('0x38')]=_0x12e2eb;_0x29b19f['responsetime']=_0x29b19f['responsetime']?_0x29b19f[_0x1420('0x3e')]:_0x4d0957;_0x29b19f[_0x1420('0x3b')]=_0x29b19f[_0x1420('0x3b')]?_0x29b19f['endtime']:_0x4d0957;_0x29b19f[_0x1420('0x3d')]=getSeconds(_0x29b19f['responsetime']||0x0,_0x29b19f['starttime']||0x0);_0x29b19f[_0x1420('0x43')]=_0x29b19f[_0x1420('0x44')]?getSeconds(_0x29b19f[_0x1420('0x3b')],_0x29b19f['answertime']):0x0;};exports['isFailure']=function(_0x2f2f77){return _0x2f2f77===_0x1420('0x45');};exports['variablesAction']=function(_0x315bfb,_0x2bbd5e,_0x20a2df,_0x1441e1,_0x4e5cb6){var _0x3ecee5=_0x1441e1?_0x1420('0x46'):_0x315bfb[_0x1420('0x1a')];_0x3ecee5=_0x4e5cb6?_0x1420('0x47'):_0x3ecee5;return{'actionid':_0x315bfb['uniqueid'],'action':_0x1420('0x48'),'channel':_0x315bfb[_0x1420('0x49')],'callerid':util[_0x1420('0x11')]('\x22%s\x22\x20<%s>',_0x3ecee5,_0x315bfb['calleridnum']),'Exten':_0x1420('0x28'),'Context':_0x1420('0x4a'),'Priority':'1','variable':_0x20a2df,'timeout':(_0x2bbd5e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x315bfb['uniqueid']};};exports[_0x1420('0x4b')]=function(_0x211936){return _0x211936[_0x1420('0x4c')]+_0x211936[_0x1420('0x4d')]+_0x211936[_0x1420('0x4e')]+_0x211936['countagentrejectretry']+_0x211936[_0x1420('0x4f')];};exports[_0x1420('0x50')]=function(_0x2c7542){var _0x45f824=_[_0x1420('0x51')](_0x2c7542);_0x45f824['state']=0xf;_0x45f824[_0x1420('0x38')]=_0x1420('0x52');return _0x45f824;};exports[_0x1420('0x53')]=function(_0x2ee8c5,_0xaae370,_0x5f2106){var _0x5a2bcd={};_0x5a2bcd[_0xaae370]=_0x2ee8c5[_0xaae370];_0x5a2bcd[_0x1420('0x54')]=![];_0x5a2bcd[_0x1420('0x55')]=moment()[_0x1420('0x56')](_0x5f2106,_0x1420('0x57'))[_0x1420('0x11')](_0x1420('0x36'));_0x5a2bcd[_0x1420('0x1c')]=_0x2ee8c5[_0x1420('0x1c')];_0x5a2bcd['ListId']=_0x2ee8c5['ListId'];_0x5a2bcd[_0x1420('0x1e')]=_0x2ee8c5[_0x1420('0x1e')]||undefined;return _0x5a2bcd;};exports[_0x1420('0x58')]=function(_0x435d38,_0x2aa561){if(!_[_0x1420('0x16')](_0x435d38)){if(_0x435d38[_0x1420('0x59')]>0x0){_0x435d38[_0x1420('0x59')]-=0x1;}else{logger[_0x1420('0xa')](_0x2aa561,_0x1420('0x5a'));}}else{logger[_0x1420('0xa')](_0x2aa561,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x1420('0x5b')]=function(_0x25370e){if(_0x25370e<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1a4c5f,_0x2c5d62){_0x1a4c5f['lastevent']=_0x2c5d62;_0x1a4c5f[_0x1420('0x19')]=_0x1a4c5f[_0x1420('0x5c')];_0x1a4c5f['interface']=_0x1a4c5f['channelAgent'];return _0x1a4c5f;};exports[_0x1420('0x5d')]=function(_0x53672d){var _0x593de1={};_0x593de1[_0x1420('0x5c')]=_0x53672d[_0x1420('0x5c')];_0x593de1[_0x1420('0x5e')]=_0x53672d[_0x1420('0x49')];_0x593de1[_0x1420('0x5f')]=_0x53672d[_0x1420('0x5f')];return _0x593de1;};exports[_0x1420('0x60')]=function(_0x16426a){var _0x376768=[];for(var _0x784190 in _0x16426a){if(_0x16426a[_0x1420('0x2c')](_0x784190)){if(!_[_0x1420('0x16')](_0x16426a[_0x784190])&&_0x16426a[_0x784190]['state']==='not_inuse'&&_0x16426a[_0x784190][_0x1420('0x61')]===_0x1420('0x62')){_0x376768[_0x1420('0x63')](_0x16426a[_0x784190]['id']);}}}return _0x376768;};exports[_0x1420('0x64')]=function(_0x508ec9){var _0x184d63=moment()[_0x1420('0x7')](0x0);var _0x15f539=moment(_0x508ec9)[_0x1420('0x7')](0x0);return _0x184d63[_0x1420('0x8')](_0x15f539,'seconds');};exports['createBody']=function(_0x5ca065){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ca065[_0x1420('0x1c')],'ListId':_0x5ca065[_0x1420('0x65')],'VoiceQueueId':_0x5ca065[_0x1420('0x1e')]||undefined,'CampaignId':_0x5ca065[_0x1420('0x66')]||undefined};};exports[_0x1420('0x67')]=function(_0x355c5c){if(_0x355c5c===_0x1420('0x5f')||_0x355c5c==='idContact'||_0x355c5c===_0x1420('0x5c')||_0x355c5c===_0x1420('0x68')||_0x355c5c===_0x1420('0x69')||_0x355c5c==='dialAnswer'||_0x355c5c===_0x1420('0x40')||_0x355c5c===_0x1420('0x49')||_0x355c5c===_0x1420('0x1a')||_0x355c5c===_0x1420('0x54')||_0x355c5c==='calleridnum'||_0x355c5c===_0x1420('0x55')||_0x355c5c===_0x1420('0x4c')||_0x355c5c===_0x1420('0x4d')||_0x355c5c==='countnoanswerretry'||_0x355c5c===_0x1420('0x6a')||_0x355c5c===_0x1420('0x6b')||_0x355c5c==='callbackuniqueid'||_0x355c5c===_0x1420('0x6c')||_0x355c5c===_0x1420('0x6d')||_0x355c5c===_0x1420('0x1c')||_0x355c5c==='ListId'||_0x355c5c===_0x1420('0x41')||_0x355c5c==='VoiceQueueId'||_0x355c5c===_0x1420('0x6e')||_0x355c5c==='xmd-voicequeueid'||_0x355c5c===_0x1420('0x6f')||_0x355c5c===_0x1420('0x70')||_0x355c5c===_0x1420('0x71')||_0x355c5c===_0x1420('0x72')||_0x355c5c===_0x1420('0x73')||_0x355c5c===_0x1420('0x74')||_0x355c5c==='xmd-dialid'||_0x355c5c===_0x1420('0x75')||_0x355c5c===_0x1420('0x76')||_0x355c5c===_0x1420('0x77')||_0x355c5c===_0x1420('0x78')||_0x355c5c===_0x1420('0x79')||_0x355c5c==='xmd-agi'||_0x355c5c===_0x1420('0x7a')||_0x355c5c===_0x1420('0x7b')||_0x355c5c===_0x1420('0x7c')||_0x355c5c==='rtpaudioqosjitterbridged'||_0x355c5c===_0x1420('0x7d')||_0x355c5c===_0x1420('0x7e')||_0x355c5c===_0x1420('0x7f')||_0x355c5c===_0x1420('0x80')||_0x355c5c==='rtpaudioqos'||_0x355c5c===_0x1420('0x7b')||_0x355c5c===_0x1420('0x7c')||_0x355c5c==='rtpaudioqosjitterbridged'||_0x355c5c==='rtpaudioqosloss'||_0x355c5c==='rtpaudioqoslossbridged'||_0x355c5c===_0x1420('0x7f')||_0x355c5c===_0x1420('0x80')||_0x355c5c===_0x1420('0x81')||_0x355c5c===_0x1420('0x82')||_0x355c5c===_0x1420('0x37')||_0x355c5c===_0x1420('0x38')){return![];}return!![];};exports[_0x1420('0x83')]=function(_0xa191f0,_0x2ae692){var _0x4eccb3,_0x5f1a2a,_0x274c02;if(_0x2ae692<=0x0){_0x2ae692=0x1;}_0x4eccb3=new RegExp(_0x1420('0x84')+_0x2ae692+'}$');_0x5f1a2a=Math[_0x1420('0x85')](0xa,_0x2ae692-0x1);_0x274c02=Math['pow'](0xa,_0x2ae692)-0x1;return util[_0x1420('0x11')]('%s',_[_0x1420('0x86')](_0xa191f0,_0x4eccb3,_[_0x1420('0x87')](_0x5f1a2a,_0x274c02)));};exports[_0x1420('0x88')]=function(_0x518214){var _0x744dc4=_0x518214['match'](/"(.*?)"/);return _0x744dc4?_0x744dc4[0x1]:_0x518214;};exports[_0x1420('0x89')]=function(_0x2a5dbd){var _0x84f03=_0x2a5dbd[_0x1420('0x8a')](/<(.*?)>/);return _0x84f03?_0x84f03[0x1]:_0x2a5dbd;}; \ No newline at end of file +var _0x2deb=['[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','responsetime','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','lastevent','channelAgent','buildAcw','queue','interface','agentReadyId','not_inuse','status','reachable','seconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countbusyretry','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialid','xmd-cdrtype','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','logger2','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','XMD-','toUpper','toLower','updateOriginated','originated'];(function(_0x2b2aef,_0x47ea8e){var _0x333cb1=function(_0x1b5246){while(--_0x1b5246){_0x2b2aef['push'](_0x2b2aef['shift']());}};_0x333cb1(++_0x47ea8e);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xb2de('0x0'));var _=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var logger=require(_0xb2de('0x3'))('preview');var ipAgi=process['env'][_0xb2de('0x4')]||_0xb2de('0x5');function getSeconds(_0x3ccbb6,_0x27a59b){var _0x59f7e9=moment(_0x3ccbb6)['milliseconds'](0x0);var _0x201fcc=moment(_0x27a59b)[_0xb2de('0x6')](0x0);return _0x59f7e9[_0xb2de('0x7')](_0x201fcc,'seconds');}exports[_0xb2de('0x8')]=function(_0x1a4c44){return function(_0x53ab0e){logger[_0xb2de('0x9')](_0x1a4c44,util[_0xb2de('0xa')](_0x53ab0e,{'showHidden':![],'depth':null}));};};exports[_0xb2de('0xb')]=function(_0x523fa4,_0x4490ea){logger[_0xb2de('0xc')](_0x523fa4,util[_0xb2de('0xa')](_0x4490ea,{'showHidden':![],'depth':null}));};exports[_0xb2de('0xd')]=function(_0x5dc248,_0x5ac500){logger[_0xb2de('0x9')](_0x5dc248,util[_0xb2de('0xa')](_0x5ac500,{'showHidden':![],'depth':null}));};exports[_0xb2de('0xe')]=function(_0x4c8d35){return function(_0x1e2237){logger[_0xb2de('0xc')](_0x4c8d35,util[_0xb2de('0xa')](_0x1e2237,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1ebae3,_0x48492b,_0x160d61){return{'message':_0x1ebae3,'unlock':_0x48492b,'active':_0x160d61};};exports['getCallerId']=function(_0x10ef21,_0x839c22,_0x3f9541){if(!_['isUndefined'](_0x3f9541)&&_0xb2de('0xf')===typeof _0x3f9541&&!_[_0xb2de('0x10')](_0x3f9541)){if(!_[_0xb2de('0x11')](_0x839c22)&&_0xb2de('0xf')===typeof _0x839c22&&!_[_0xb2de('0x10')](_0x839c22)){return util[_0xb2de('0x12')](_0xb2de('0x13'),_0x839c22,_0x3f9541);}return util[_0xb2de('0x12')](_0xb2de('0x13'),_0x3f9541,_0x3f9541);}if(!_['isUndefined'](_0x10ef21)&&_0xb2de('0xf')===typeof _0x10ef21&&!_['isEmpty'](_0x10ef21)){return _0x10ef21;}return _0xb2de('0x14');};exports[_0xb2de('0x15')]=function(_0x4c7ad4){if(_[_0xb2de('0x16')](_0x4c7ad4)){return![];}return _0x4c7ad4;};exports[_0xb2de('0x17')]=function(_0x499c2f,_0x151a94,_0x1743d1,_0x34b228,_0x148c91,_0x449edb){var _0x3014b9={'XMD-QUEUE':_0x151a94[_0xb2de('0x18')]?_0x151a94[_0xb2de('0x18')][_0xb2de('0x19')]:'','XMD-CALLERID':_0x34b228,'XMD-CALLERID-PREVIEW':_0x449edb?util['format'](_0xb2de('0x13'),_0x449edb[_0xb2de('0x1a')],_0x449edb[_0xb2de('0x1b')]):_0x34b228,'XMD-DIALID':_0x148c91,'XMD-CONTACTID':_0x151a94[_0xb2de('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x34b228,'XMD-VOICEQUEUEID':_0x151a94['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1743d1,'XMD-DIALTIMEOUT':_0x499c2f[_0xb2de('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xb2de('0x12')](_0xb2de('0x1e'),_0x499c2f['dialQueueProject2']?'g':'',_[_0xb2de('0x10')](_0x499c2f[_0xb2de('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x499c2f[_0xb2de('0x20')]||'','XMD-AGI':_0x499c2f['dialQueueProject']?util[_0xb2de('0x12')](_0xb2de('0x21'),ipAgi,_0x499c2f[_0xb2de('0x22')]):_0xb2de('0x23'),'XMD-AGIAFTER':_0x499c2f[_0xb2de('0x24')]?util[_0xb2de('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x499c2f[_0xb2de('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x449edb?_0x449edb[_0xb2de('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x449edb?_0x449edb['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xb2de('0x10')](_0x499c2f[_0xb2de('0x1f')])){_0x3014b9[util[_0xb2de('0x12')]('%s',_0xb2de('0x26'))]=_0x499c2f[_0xb2de('0x1f')];_0x3014b9[util[_0xb2de('0x12')]('%s',_0xb2de('0x27'))]=_0x148c91;}if(_0x151a94&&_0x151a94[_0xb2de('0x28')]){for(var _0x1e0f6d in _0x151a94[_0xb2de('0x28')]){if(_0x151a94[_0xb2de('0x28')][_0xb2de('0x29')](_0x1e0f6d)){if(!_['isNil'](_0x151a94[_0xb2de('0x28')][_0x1e0f6d])&&_0x1e0f6d!=='id'&&_0x1e0f6d!==_0xb2de('0x2a')&&_0x1e0f6d!=='createdAt'&&_0x1e0f6d!==_0xb2de('0x2b')){_0x3014b9[util[_0xb2de('0x12')]('%s%s',_0xb2de('0x2c'),_[_0xb2de('0x2d')](_0x1e0f6d))]=_0x151a94[_0xb2de('0x28')][_0x1e0f6d];}}}}return _0x3014b9;};exports['toLowerVariables']=function(_0x3413fb){var _0x1c24ec={};for(var _0x41bd24 in _0x3413fb){if(_0x3413fb[_0xb2de('0x29')](_0x41bd24)){_0x1c24ec[util[_0xb2de('0x12')]('%s',_[_0xb2de('0x2e')](_0x41bd24))]=_0x3413fb[_0x41bd24];}}return{'variables':_0x1c24ec};};exports[_0xb2de('0x2f')]=function(_0x59f3d7,_0x334b81){if(!_[_0xb2de('0x16')](_0x59f3d7)){if(_0x59f3d7[_0xb2de('0x29')]('originated')){if(_0x59f3d7[_0xb2de('0x30')]>0x0){_0x59f3d7[_0xb2de('0x30')]-=0x1;}else{logger[_0xb2de('0x9')](_0xb2de('0x31'),_0x334b81);}}}else{logger[_0xb2de('0x9')](_0xb2de('0x32'),_0x334b81);}};exports[_0xb2de('0x33')]=function(_0x30f14e){var _0x55a51e=moment()[_0xb2de('0x12')](_0xb2de('0x34'));_0x30f14e[_0xb2de('0x35')]=0xd;_0x30f14e[_0xb2de('0x36')]=_0xb2de('0x37');_0x30f14e[_0xb2de('0x38')]=_0x55a51e;_0x30f14e['responsetime']=_0x55a51e;_0x30f14e[_0xb2de('0x39')]=_0x55a51e;};exports['logAgent']=function(_0x450fd1,_0xc0b5a1,_0x3e5747){var _0x25eff7=moment()[_0xb2de('0x12')](_0xb2de('0x34'));_0x450fd1[_0xb2de('0x35')]=_0xc0b5a1;_0x450fd1[_0xb2de('0x36')]=_0x3e5747;_0x450fd1[_0xb2de('0x3a')]=_0x25eff7;_0x450fd1[_0xb2de('0x3b')]=getSeconds(_0x450fd1[_0xb2de('0x3a')],_0x450fd1[_0xb2de('0x38')]);};exports[_0xb2de('0x3c')]=function(_0x1e7091,_0x3dc4c0,_0x580d86){_0x1e7091[_0xb2de('0x3d')]=_0x3dc4c0;_0x1e7091[_0xb2de('0x3e')]=_0x580d86;};exports['logCustomer']=function(_0x317a31,_0x32d19a,_0x33427e){var _0x12b5b7=moment()['format'](_0xb2de('0x34'));_0x317a31[_0xb2de('0x35')]=_0x32d19a;_0x317a31['statedesc']=_0x33427e;_0x317a31[_0xb2de('0x3a')]=_0x317a31[_0xb2de('0x3a')]?_0x317a31['responsetime']:_0x12b5b7;_0x317a31[_0xb2de('0x39')]=_0x317a31['endtime']?_0x317a31['endtime']:_0x12b5b7;_0x317a31[_0xb2de('0x3b')]=getSeconds(_0x317a31['responsetime']||0x0,_0x317a31['starttime']||0x0);_0x317a31[_0xb2de('0x3f')]=_0x317a31[_0xb2de('0x40')]?getSeconds(_0x317a31['endtime'],_0x317a31[_0xb2de('0x40')]):0x0;};exports[_0xb2de('0x41')]=function(_0x14b0b2){return _0x14b0b2===_0xb2de('0x42');};exports['variablesAction']=function(_0xcafd01,_0x1936f1,_0x354a49,_0x14c0fc,_0xf23d94){var _0x9e1e4a=_0x14c0fc?_0xb2de('0x43'):_0xcafd01['calleridname'];_0x9e1e4a=_0xf23d94?_0xb2de('0x44'):_0x9e1e4a;return{'actionid':_0xcafd01[_0xb2de('0x45')],'action':_0xb2de('0x46'),'channel':_0xcafd01['channelAgent'],'callerid':util[_0xb2de('0x12')]('\x22%s\x22\x20<%s>',_0x9e1e4a,_0xcafd01[_0xb2de('0x1b')]),'Exten':_0xb2de('0x47'),'Context':_0xb2de('0x48'),'Priority':'1','variable':_0x354a49,'timeout':(_0x1936f1[_0xb2de('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0xcafd01['uniqueid']};};exports[_0xb2de('0x4a')]=function(_0x47b0a3){return _0x47b0a3['countbusyretry']+_0x47b0a3['countcongestionretry']+_0x47b0a3[_0xb2de('0x4b')]+_0x47b0a3[_0xb2de('0x4c')]+_0x47b0a3[_0xb2de('0x4d')];};exports[_0xb2de('0x4e')]=function(_0x22caba){var _0x541942=_[_0xb2de('0x4f')](_0x22caba);_0x541942['state']=0xf;_0x541942[_0xb2de('0x36')]='Global';return _0x541942;};exports[_0xb2de('0x50')]=function(_0x3dca27,_0x4c52bc,_0x2321b1){var _0x48f3e6={};_0x48f3e6[_0x4c52bc]=_0x3dca27[_0x4c52bc];_0x48f3e6[_0xb2de('0x51')]=![];_0x48f3e6[_0xb2de('0x52')]=moment()[_0xb2de('0x53')](_0x2321b1,_0xb2de('0x54'))['format'](_0xb2de('0x34'));_0x48f3e6[_0xb2de('0x1c')]=_0x3dca27[_0xb2de('0x1c')];_0x48f3e6[_0xb2de('0x55')]=_0x3dca27[_0xb2de('0x55')];_0x48f3e6['VoiceQueueId']=_0x3dca27[_0xb2de('0x56')]||undefined;return _0x48f3e6;};exports[_0xb2de('0x57')]=function(_0x45ebf1,_0x3737ef){if(!_[_0xb2de('0x16')](_0x45ebf1)){if(_0x45ebf1['pTalking']>0x0){_0x45ebf1[_0xb2de('0x58')]-=0x1;}else{logger[_0xb2de('0x9')](_0x3737ef,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb2de('0x9')](_0x3737ef,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xb2de('0x59')]=function(_0x1480d1){if(_0x1480d1<=0x0){return!![];}return![];};exports[_0xb2de('0x5a')]=function(_0x42956a,_0x566fbc){_0x42956a[_0xb2de('0x5b')]=_0x566fbc;_0x42956a[_0xb2de('0x19')]=_0x42956a['queue'];_0x42956a['interface']=_0x42956a[_0xb2de('0x5c')];return _0x42956a;};exports[_0xb2de('0x5d')]=function(_0x15165f){var _0x3ec51d={};_0x3ec51d[_0xb2de('0x5e')]=_0x15165f[_0xb2de('0x5e')];_0x3ec51d[_0xb2de('0x5f')]=_0x15165f[_0xb2de('0x5c')];_0x3ec51d[_0xb2de('0x45')]=_0x15165f[_0xb2de('0x45')];return _0x3ec51d;};exports[_0xb2de('0x60')]=function(_0x5a7964){var _0x54ef6e=[];for(var _0x203884 in _0x5a7964){if(_0x5a7964[_0xb2de('0x29')](_0x203884)){if(!_[_0xb2de('0x16')](_0x5a7964[_0x203884])&&_0x5a7964[_0x203884][_0xb2de('0x35')]===_0xb2de('0x61')&&_0x5a7964[_0x203884][_0xb2de('0x62')]===_0xb2de('0x63')){_0x54ef6e['push'](_0x5a7964[_0x203884]['id']);}}}return _0x54ef6e;};exports['getDiff']=function(_0xf23673){var _0x330b1a=moment()[_0xb2de('0x6')](0x0);var _0x46282c=moment(_0xf23673)['milliseconds'](0x0);return _0x330b1a['diff'](_0x46282c,_0xb2de('0x64'));};exports[_0xb2de('0x65')]=function(_0x1637cc){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1637cc['ContactId'],'ListId':_0x1637cc[_0xb2de('0x55')],'VoiceQueueId':_0x1637cc[_0xb2de('0x56')]||undefined,'CampaignId':_0x1637cc[_0xb2de('0x66')]||undefined};};exports[_0xb2de('0x67')]=function(_0x1a5eba){if(_0x1a5eba===_0xb2de('0x45')||_0x1a5eba==='idContact'||_0x1a5eba===_0xb2de('0x5e')||_0x1a5eba===_0xb2de('0x68')||_0x1a5eba===_0xb2de('0x69')||_0x1a5eba===_0xb2de('0x6a')||_0x1a5eba===_0xb2de('0x3d')||_0x1a5eba===_0xb2de('0x5c')||_0x1a5eba==='calleridname'||_0x1a5eba===_0xb2de('0x51')||_0x1a5eba==='calleridnum'||_0x1a5eba===_0xb2de('0x52')||_0x1a5eba===_0xb2de('0x6b')||_0x1a5eba==='countcongestionretry'||_0x1a5eba===_0xb2de('0x4b')||_0x1a5eba==='countglobal'||_0x1a5eba==='callback'||_0x1a5eba==='callbackuniqueid'||_0x1a5eba===_0xb2de('0x6c')||_0x1a5eba==='recallme'||_0x1a5eba==='ContactId'||_0x1a5eba==='ListId'||_0x1a5eba===_0xb2de('0x3e')||_0x1a5eba===_0xb2de('0x56')||_0x1a5eba===_0xb2de('0x6d')||_0x1a5eba===_0xb2de('0x6e')||_0x1a5eba===_0xb2de('0x6f')||_0x1a5eba===_0xb2de('0x70')||_0x1a5eba===_0xb2de('0x71')||_0x1a5eba===_0xb2de('0x72')||_0x1a5eba==='xmd-dialtimeout'||_0x1a5eba==='xmd-dialoptions'||_0x1a5eba===_0xb2de('0x73')||_0x1a5eba==='xmd-dialchannel'||_0x1a5eba==='xmd-contactid'||_0x1a5eba===_0xb2de('0x74')||_0x1a5eba==='xmd-callerid'||_0x1a5eba===_0xb2de('0x75')||_0x1a5eba==='xmd-agi'||_0x1a5eba==='rtpaudioqos'||_0x1a5eba===_0xb2de('0x76')||_0x1a5eba==='rtpaudioqosjitter'||_0x1a5eba===_0xb2de('0x77')||_0x1a5eba===_0xb2de('0x78')||_0x1a5eba===_0xb2de('0x79')||_0x1a5eba===_0xb2de('0x7a')||_0x1a5eba===_0xb2de('0x7b')||_0x1a5eba===_0xb2de('0x7c')||_0x1a5eba===_0xb2de('0x76')||_0x1a5eba===_0xb2de('0x7d')||_0x1a5eba===_0xb2de('0x77')||_0x1a5eba===_0xb2de('0x78')||_0x1a5eba===_0xb2de('0x79')||_0x1a5eba===_0xb2de('0x7a')||_0x1a5eba===_0xb2de('0x7b')||_0x1a5eba===_0xb2de('0x7e')||_0x1a5eba==='bridgepvtcallid'||_0x1a5eba===_0xb2de('0x35')||_0x1a5eba===_0xb2de('0x36')){return![];}return!![];};exports[_0xb2de('0x7f')]=function(_0x42986f,_0x16293e){var _0x470a8a,_0x643557,_0x22df63;if(_0x16293e<=0x0){_0x16293e=0x1;}_0x470a8a=new RegExp('\x5cw{0,'+_0x16293e+'}$');_0x643557=Math[_0xb2de('0x80')](0xa,_0x16293e-0x1);_0x22df63=Math[_0xb2de('0x80')](0xa,_0x16293e)-0x1;return util[_0xb2de('0x12')]('%s',_[_0xb2de('0x81')](_0x42986f,_0x470a8a,_[_0xb2de('0x82')](_0x643557,_0x22df63)));};exports[_0xb2de('0x83')]=function(_0x3d9844){var _0x36476b=_0x3d9844[_0xb2de('0x84')](/"(.*?)"/);return _0x36476b?_0x36476b[0x1]:_0x3d9844;};exports[_0xb2de('0x85')]=function(_0x1f1745){var _0x23af2e=_0x1f1745['match'](/<(.*?)>/);return _0x23af2e?_0x23af2e[0x1]:_0x1f1745;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 928e09d..2b29b7b 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x39d15b,_0xf1953f){var _0x104d1b=function(_0x592b8f){while(--_0x592b8f){_0x39d15b['push'](_0x39d15b['shift']());}};_0x104d1b(++_0xf1953f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c0813,_0x26efe4){_0x3c0813=_0x3c0813-0x0;var _0x593356=_0x5f2f[_0x3c0813];return _0x593356;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x2e1d94,_0x111bb7){var _0x5b2587=function(_0x119893){while(--_0x119893){_0x2e1d94['push'](_0x2e1d94['shift']());}};_0x5b2587(++_0x111bb7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x117643,_0x2b3351){_0x117643=_0x117643-0x0;var _0x4f9ce1=_0x5f2f[_0x117643];return _0x4f9ce1;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8bf9184..99dff52 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 _0xb2d7=['initTrunks','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','SIP/%s','name','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','initTelephones','isUndefined','format'];(function(_0x2651fb,_0x19916a){var _0x2ca1b9=function(_0x5a2d50){while(--_0x5a2d50){_0x2651fb['push'](_0x2651fb['shift']());}};_0x2ca1b9(++_0x19916a);}(_0xb2d7,0x8e));var _0x7b2d=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xb2d7[_0x587fb5];return _0x551105;};'use strict';var BPromise=require(_0x7b2d('0x0'));var util=require('util');var _=require(_0x7b2d('0x1'));var moment=require(_0x7b2d('0x2'));var Agent=require(_0x7b2d('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x7b2d('0x4'));var VoiceQueue=require(_0x7b2d('0x5'));var Trigger=require(_0x7b2d('0x6'));var Template=require(_0x7b2d('0x7'));var Campaign=require(_0x7b2d('0x8'));var VoiceExtension=require(_0x7b2d('0x9'));var ZendeskAccount=require(_0x7b2d('0xa'));var SalesforceAccount=require(_0x7b2d('0xb'));var FreshdeskAccount=require(_0x7b2d('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x7b2d('0xd'));var DeskAccount=require(_0x7b2d('0xe'));var VtigerAccount=require(_0x7b2d('0xf'));var ServicenowAccount=require(_0x7b2d('0x10'));var Dynamics365Account=require(_0x7b2d('0x11'));var FreshsalesAccount=require(_0x7b2d('0x12'));var FaxAccount=require(_0x7b2d('0x13'));var Realtime=function(){this[_0x7b2d('0x14')]={};this[_0x7b2d('0x15')]={};this[_0x7b2d('0x16')]={};this[_0x7b2d('0x17')]={};this[_0x7b2d('0x18')]={};this[_0x7b2d('0x19')]={};this[_0x7b2d('0x1a')]={};this[_0x7b2d('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7b2d('0x1c')]={};this['channels']={};this[_0x7b2d('0x1d')]={};this[_0x7b2d('0x1e')]={};this[_0x7b2d('0x1f')]={};this['zendeskAccounts']={};this[_0x7b2d('0x20')]={};this['sugarcrmAccounts']={};this[_0x7b2d('0x21')]={};this[_0x7b2d('0x22')]={};this[_0x7b2d('0x23')]={};this[_0x7b2d('0x24')]={};this[_0x7b2d('0x25')]={};this[_0x7b2d('0x26')]={};this[_0x7b2d('0x27')]={};this[_0x7b2d('0x28')]={};};function freeIsNotKey(_0x595616,_0x5db9bf,_0x210298){var _0x311d78=_['mapKeys'](_0x595616,function(_0x461dbb,_0x5a01d0){return _0x461dbb[_0x210298];});for(var _0x5f369f in _0x5db9bf){if(_0x5db9bf[_0x7b2d('0x29')](_0x5f369f)){if(!_0x311d78[_0x5f369f]){delete _0x5db9bf[_0x5f369f];}}}}function freeIsNotKeySip(_0x12d7ca,_0x4b58e3){var _0x17dfc4=_[_0x7b2d('0x2a')](_0x12d7ca,function(_0x31b4bc,_0x2cd03e){return util['format'](_0x7b2d('0x2b'),_0x31b4bc[_0x7b2d('0x2c')]);});for(var _0x1157a5 in _0x4b58e3){if(_0x4b58e3[_0x7b2d('0x29')](_0x1157a5)){if(!_0x17dfc4[_0x1157a5]){delete _0x4b58e3[_0x1157a5];}}}}function freeIsNotKeyAgent(_0x366568,_0x6bb16c){var _0x3487ae=_[_0x7b2d('0x2a')](_0x366568,function(_0x25137c,_0x58875f){var _0x5919fa=_['isNil'](_0x25137c[_0x7b2d('0x2d')])?util['format'](_0x7b2d('0x2b'),_0x25137c[_0x7b2d('0x2c')]):_0x25137c['interface'];return _0x5919fa;});for(var _0x2da1cb in _0x6bb16c){if(_0x6bb16c[_0x7b2d('0x29')](_0x2da1cb)){if(!_0x3487ae[_0x2da1cb]){delete _0x6bb16c[_0x2da1cb];}}}}function clearVoiceCallReports(_0x40af6d){_0x40af6d[_0x7b2d('0x2e')]=0x0;_0x40af6d[_0x7b2d('0x2f')]=0x0;_0x40af6d['sumHoldTime']=0x0;_0x40af6d[_0x7b2d('0x30')]=0x0;_0x40af6d[_0x7b2d('0x31')]=0x0;}function clearCampaigns(_0x8de580){if(!_[_0x7b2d('0x32')](_0x8de580)){for(var _0x49d524 in _0x8de580){if(_0x8de580[_0x7b2d('0x29')](_0x49d524)){_0x8de580[_0x49d524][_0x7b2d('0x33')]=0x0;_0x8de580[_0x49d524][_0x7b2d('0x34')]=0x0;}}}}function clearVoiceQueues(_0x4648e5){if(!_[_0x7b2d('0x32')](_0x4648e5)){for(var _0x41c99a in _0x4648e5){if(_0x4648e5[_0x7b2d('0x29')](_0x41c99a)){_0x4648e5[_0x41c99a][_0x7b2d('0x2e')]=0x0;_0x4648e5[_0x41c99a]['answered']=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x35')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x36')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x37')]=0x0;_0x4648e5[_0x41c99a]['sumDuration']=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x31')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x38')]=0x0;_0x4648e5[_0x41c99a]['outboundNoAnswerCallsDay']=0x0;_0x4648e5[_0x41c99a]['outboundBusyCallsDay']=0x0;_0x4648e5[_0x41c99a]['outboundCongestionCallsDay']=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x39')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x3a')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x3b')]=0x0;_0x4648e5[_0x41c99a]['outboundDropCallsDayCallersExit']=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x3c')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x3d')]=0x0;_0x4648e5[_0x41c99a]['outboundRejectCallsDay']=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x3e')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x38')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x3f')]=0x0;_0x4648e5[_0x41c99a][_0x7b2d('0x40')]=!![];}}}}Realtime[_0x7b2d('0x41')][_0x7b2d('0x42')]=function(_0x5369ea,_0x1a5f8d){for(var _0x5893cc in _0x1a5f8d){if(_0x5369ea[_0x7b2d('0x29')](_0x5893cc)){_0x5369ea[_0x5893cc]=_0x1a5f8d[_0x5893cc];}}};Realtime[_0x7b2d('0x41')]['initAgents']=function(){var _0x8cebd4=this;return function(_0x35d5dc){if(_0x35d5dc){freeIsNotKeyAgent(_0x35d5dc,_0x8cebd4[_0x7b2d('0x14')]);for(var _0x317fa0=0x0,_0x99acb3={},_0x5f45b2={};_0x317fa0<_0x35d5dc[_0x7b2d('0x43')];_0x317fa0+=0x1){_0x99acb3=_0x35d5dc[_0x317fa0];var _0x2a8c44=_[_0x7b2d('0x44')](_0x99acb3[_0x7b2d('0x2d')])?util['format']('SIP/%s',_0x99acb3['name']):_0x99acb3[_0x7b2d('0x2d')];if(_['isUndefined'](_0x8cebd4[_0x7b2d('0x14')][_0x2a8c44])){_0x8cebd4[_0x7b2d('0x14')][_0x2a8c44]=new Agent(_0x99acb3);}else{_0x8cebd4[_0x7b2d('0x42')](_0x8cebd4['agents'][_0x2a8c44],_0x99acb3);}}}return _0x8cebd4['agents'];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x45')]=function(){var _0x2ecf5b=this;return function(_0x4972cc){if(_0x4972cc){freeIsNotKeySip(_0x4972cc,_0x2ecf5b[_0x7b2d('0x15')]);for(var _0x5c3d5a=0x0,_0x2b3943={},_0x167d5d={};_0x5c3d5a<_0x4972cc[_0x7b2d('0x43')];_0x5c3d5a+=0x1){_0x2b3943=_0x4972cc[_0x5c3d5a];if(_[_0x7b2d('0x46')](_0x2ecf5b['telephones'][util[_0x7b2d('0x47')](_0x7b2d('0x2b'),_0x2b3943[_0x7b2d('0x2c')])])){_0x2ecf5b[_0x7b2d('0x15')][util[_0x7b2d('0x47')](_0x7b2d('0x2b'),_0x2b3943['name'])]=new Telephone(_0x2b3943);}else{_0x2ecf5b['mergeFromDatabase'](_0x2ecf5b['telephones'][util[_0x7b2d('0x47')](_0x7b2d('0x2b'),_0x2b3943[_0x7b2d('0x2c')])],_0x2b3943);}}}return _0x2ecf5b[_0x7b2d('0x15')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x48')]=function(){var _0x682f62=this;return function(_0x1d5ced){if(_0x1d5ced){freeIsNotKeySip(_0x1d5ced,_0x682f62[_0x7b2d('0x16')]);for(var _0x27ac4c=0x0,_0x379276={},_0x2fbe07={};_0x27ac4c<_0x1d5ced[_0x7b2d('0x43')];_0x27ac4c+=0x1){_0x379276=_0x1d5ced[_0x27ac4c];if(_[_0x7b2d('0x46')](_0x682f62[_0x7b2d('0x16')][util[_0x7b2d('0x47')](_0x7b2d('0x2b'),_0x379276[_0x7b2d('0x2c')])])){_0x682f62[_0x7b2d('0x16')][util['format']('SIP/%s',_0x379276[_0x7b2d('0x2c')])]=new Trunk(_0x379276);}else{_0x682f62[_0x7b2d('0x42')](_0x682f62[_0x7b2d('0x16')][util['format']('SIP/%s',_0x379276['name'])],_0x379276);}}}return _0x682f62[_0x7b2d('0x16')];};};Realtime[_0x7b2d('0x41')]['initVoiceQueues']=function(){var _0x54496b=this;return function(_0x4d6323){if(_0x4d6323){freeIsNotKey(_0x4d6323,_0x54496b['voiceQueues'],_0x7b2d('0x2c'));for(var _0x51a1bd=0x0,_0x3d2ff7={},_0x1c8042={};_0x51a1bd<_0x4d6323[_0x7b2d('0x43')];_0x51a1bd+=0x1){_0x3d2ff7=_0x4d6323[_0x51a1bd];if(_['isUndefined'](_0x54496b[_0x7b2d('0x17')][_0x3d2ff7[_0x7b2d('0x2c')]])){_0x54496b[_0x7b2d('0x17')][_0x3d2ff7[_0x7b2d('0x2c')]]=new VoiceQueue(_0x3d2ff7);}else{_0x54496b['mergeFromDatabase'](_0x54496b[_0x7b2d('0x17')][_0x3d2ff7[_0x7b2d('0x2c')]],_0x3d2ff7);}}}return _0x54496b[_0x7b2d('0x17')];};};Realtime['prototype'][_0x7b2d('0x49')]=function(){var _0x2e93b5=this;return function(_0x35d756){if(_0x35d756){freeIsNotKey(_0x35d756,_0x2e93b5[_0x7b2d('0x18')],'id');for(var _0x2aa642=0x0,_0x4c1903={},_0x183451={};_0x2aa642<_0x35d756['length'];_0x2aa642+=0x1){_0x4c1903=_0x35d756[_0x2aa642];if(_['isUndefined'](_0x2e93b5[_0x7b2d('0x18')][_0x4c1903['id']])){_0x2e93b5['triggers'][_0x4c1903['id']]=new Trigger(_0x4c1903);}else{_0x2e93b5['mergeFromDatabase'](_0x2e93b5[_0x7b2d('0x18')][_0x4c1903['id']],_0x4c1903);}}}return _0x2e93b5[_0x7b2d('0x18')];};};Realtime['prototype']['initTemplates']=function(){var _0xe633c3=this;return function(_0x4fb8e3){if(_0x4fb8e3){freeIsNotKey(_0x4fb8e3,_0xe633c3['templates'],'id');for(var _0x583415=0x0,_0x1054c3={},_0x3b46cc={};_0x583415<_0x4fb8e3[_0x7b2d('0x43')];_0x583415+=0x1){_0x1054c3=_0x4fb8e3[_0x583415];if(_['isUndefined'](_0xe633c3[_0x7b2d('0x1a')][_0x1054c3['id']])){_0xe633c3['templates'][_0x1054c3['id']]=new Template(_0x1054c3);}else{_0xe633c3['mergeFromDatabase'](_0xe633c3[_0x7b2d('0x1a')][_0x1054c3['id']],_0x1054c3);}}}return _0xe633c3['templates'];};};Realtime['prototype'][_0x7b2d('0x4a')]=function(){var _0x3c9800=this;return function(_0x4825b4){if(_0x4825b4){freeIsNotKey(_0x4825b4,_0x3c9800[_0x7b2d('0x4b')],'id');for(var _0x2c1b08=0x0,_0x18a612={},_0x40a9ee={};_0x2c1b08<_0x4825b4[_0x7b2d('0x43')];_0x2c1b08+=0x1){_0x18a612=_0x4825b4[_0x2c1b08];if(_[_0x7b2d('0x46')](_0x3c9800[_0x7b2d('0x4b')][_0x18a612['id']])){_0x3c9800['zendeskAccounts'][_0x18a612['id']]=new ZendeskAccount(_0x18a612);}else{_0x3c9800[_0x7b2d('0x42')](_0x3c9800[_0x7b2d('0x4b')][_0x18a612['id']],_0x18a612);}}}return _0x3c9800[_0x7b2d('0x4b')];};};Realtime['prototype'][_0x7b2d('0x4c')]=function(){var _0x3fdcf2=this;return function(_0x366d81){if(_0x366d81){freeIsNotKey(_0x366d81,_0x3fdcf2['salesforceAccounts'],'id');for(var _0x40fe9e=0x0,_0x4fcf21={},_0x180752={};_0x40fe9e<_0x366d81[_0x7b2d('0x43')];_0x40fe9e+=0x1){_0x4fcf21=_0x366d81[_0x40fe9e];if(_[_0x7b2d('0x46')](_0x3fdcf2[_0x7b2d('0x20')][_0x4fcf21['id']])){_0x3fdcf2[_0x7b2d('0x20')][_0x4fcf21['id']]=new SalesforceAccount(_0x4fcf21);}else{_0x3fdcf2[_0x7b2d('0x42')](_0x3fdcf2['salesforceAccounts'][_0x4fcf21['id']],_0x4fcf21);}}}return _0x3fdcf2['salesforceAccounts'];};};Realtime['prototype'][_0x7b2d('0x4d')]=function(){var _0x2c6744=this;return function(_0x15bb39){if(_0x15bb39){freeIsNotKey(_0x15bb39,_0x2c6744[_0x7b2d('0x21')],'id');for(var _0x541169=0x0,_0x4b433f={},_0x1a6e11={};_0x541169<_0x15bb39[_0x7b2d('0x43')];_0x541169+=0x1){_0x4b433f=_0x15bb39[_0x541169];if(_[_0x7b2d('0x46')](_0x2c6744[_0x7b2d('0x21')][_0x4b433f['id']])){_0x2c6744['freshdeskAccounts'][_0x4b433f['id']]=new FreshdeskAccount(_0x4b433f);}else{_0x2c6744[_0x7b2d('0x42')](_0x2c6744[_0x7b2d('0x21')][_0x4b433f['id']],_0x4b433f);}}}return _0x2c6744['freshdeskAccounts'];};};Realtime['prototype'][_0x7b2d('0x4e')]=function(){var _0x295382=this;return function(_0x2c4202){if(_0x2c4202){freeIsNotKey(_0x2c4202,_0x295382[_0x7b2d('0x22')],'id');for(var _0x419284=0x0,_0x4db7fb={},_0x14c136={};_0x419284<_0x2c4202[_0x7b2d('0x43')];_0x419284+=0x1){_0x4db7fb=_0x2c4202[_0x419284];if(_[_0x7b2d('0x46')](_0x295382[_0x7b2d('0x22')][_0x4db7fb['id']])){_0x295382[_0x7b2d('0x22')][_0x4db7fb['id']]=new ZohoAccount(_0x4db7fb);}else{_0x295382[_0x7b2d('0x42')](_0x295382[_0x7b2d('0x22')][_0x4db7fb['id']],_0x4db7fb);}}}return _0x295382[_0x7b2d('0x22')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x4f')]=function(){var _0x253864=this;return function(_0x1e5765){if(_0x1e5765){freeIsNotKey(_0x1e5765,_0x253864[_0x7b2d('0x23')],'id');for(var _0x247456=0x0,_0x4f8dae={},_0x1e4a83={};_0x247456<_0x1e5765[_0x7b2d('0x43')];_0x247456+=0x1){_0x4f8dae=_0x1e5765[_0x247456];if(_['isUndefined'](_0x253864[_0x7b2d('0x23')][_0x4f8dae['id']])){_0x253864[_0x7b2d('0x23')][_0x4f8dae['id']]=new DeskAccount(_0x4f8dae);}else{_0x253864['mergeFromDatabase'](_0x253864[_0x7b2d('0x23')][_0x4f8dae['id']],_0x4f8dae);}}}return _0x253864[_0x7b2d('0x23')];};};Realtime[_0x7b2d('0x41')]['initSugarcrmAccounts']=function(){var _0x164b0a=this;return function(_0x5bfc78){if(_0x5bfc78){freeIsNotKey(_0x5bfc78,_0x164b0a[_0x7b2d('0x50')],'id');for(var _0x2e5193=0x0,_0x17c6ec={},_0x5c4b2a={};_0x2e5193<_0x5bfc78[_0x7b2d('0x43')];_0x2e5193+=0x1){_0x17c6ec=_0x5bfc78[_0x2e5193];if(_[_0x7b2d('0x46')](_0x164b0a[_0x7b2d('0x50')][_0x17c6ec['id']])){_0x164b0a[_0x7b2d('0x50')][_0x17c6ec['id']]=new SugarcrmAccount(_0x17c6ec);}else{_0x164b0a[_0x7b2d('0x42')](_0x164b0a[_0x7b2d('0x50')][_0x17c6ec['id']],_0x17c6ec);}}}return _0x164b0a['sugarcrmAccounts'];};};Realtime['prototype'][_0x7b2d('0x51')]=function(){var _0x53785c=this;return function(_0x5c243b){if(_0x5c243b){freeIsNotKey(_0x5c243b,_0x53785c[_0x7b2d('0x24')],'id');for(var _0x5e8803=0x0,_0x577de2={},_0x27ac4a={};_0x5e8803<_0x5c243b[_0x7b2d('0x43')];_0x5e8803+=0x1){_0x577de2=_0x5c243b[_0x5e8803];if(_['isUndefined'](_0x53785c[_0x7b2d('0x24')][_0x577de2['id']])){_0x53785c[_0x7b2d('0x24')][_0x577de2['id']]=new VtigerAccount(_0x577de2);}else{_0x53785c[_0x7b2d('0x42')](_0x53785c[_0x7b2d('0x24')][_0x577de2['id']],_0x577de2);}}}return _0x53785c[_0x7b2d('0x24')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x52')]=function(){var _0x24ce7a=this;return function(_0x56a854){if(_0x56a854){freeIsNotKey(_0x56a854,_0x24ce7a[_0x7b2d('0x25')],'id');for(var _0x17c110=0x0,_0x390c37={},_0x4b83df={};_0x17c110<_0x56a854['length'];_0x17c110+=0x1){_0x390c37=_0x56a854[_0x17c110];if(_[_0x7b2d('0x46')](_0x24ce7a[_0x7b2d('0x25')][_0x390c37['id']])){_0x24ce7a[_0x7b2d('0x25')][_0x390c37['id']]=new ServicenowAccount(_0x390c37);}else{_0x24ce7a[_0x7b2d('0x42')](_0x24ce7a[_0x7b2d('0x25')][_0x390c37['id']],_0x390c37);}}}return _0x24ce7a[_0x7b2d('0x25')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x53')]=function(){var _0xed31bc=this;return function(_0x511815){if(_0x511815){freeIsNotKey(_0x511815,_0xed31bc['dynamics365Accounts'],'id');for(var _0x4193e5=0x0,_0x503380={},_0x4a164b={};_0x4193e5<_0x511815[_0x7b2d('0x43')];_0x4193e5+=0x1){_0x503380=_0x511815[_0x4193e5];if(_[_0x7b2d('0x46')](_0xed31bc[_0x7b2d('0x26')][_0x503380['id']])){_0xed31bc[_0x7b2d('0x26')][_0x503380['id']]=new Dynamics365Account(_0x503380);}else{_0xed31bc[_0x7b2d('0x42')](_0xed31bc[_0x7b2d('0x26')][_0x503380['id']],_0x503380);}}}return _0xed31bc['dynamics365Accounts'];};};Realtime[_0x7b2d('0x41')]['initFreshsalesAccounts']=function(){var _0x171986=this;return function(_0x4ca8ea){if(_0x4ca8ea){freeIsNotKey(_0x4ca8ea,_0x171986['freshsalesAccounts'],'id');for(var _0x4f8ee3=0x0,_0x459937={},_0x230dd1={};_0x4f8ee3<_0x4ca8ea[_0x7b2d('0x43')];_0x4f8ee3+=0x1){_0x459937=_0x4ca8ea[_0x4f8ee3];if(_['isUndefined'](_0x171986['freshsalesAccounts'][_0x459937['id']])){_0x171986[_0x7b2d('0x27')][_0x459937['id']]=new FreshsalesAccount(_0x459937);}else{_0x171986[_0x7b2d('0x42')](_0x171986[_0x7b2d('0x27')][_0x459937['id']],_0x459937);}}}return _0x171986[_0x7b2d('0x27')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x54')]=function(){var _0x51dc2b=this;return function(_0x40f576){for(var _0x2cddff=0x0;_0x2cddff<_0x40f576[_0x7b2d('0x43')];_0x2cddff+=0x1){_[_0x7b2d('0x55')](_0x51dc2b[_0x7b2d('0x17')][_0x40f576[_0x2cddff][_0x7b2d('0x2c')]],_0x40f576[_0x2cddff]);}return _0x51dc2b['voiceQueues'];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x56')]=function(){var _0x59ba3d=this;return function(_0x206412){clearVoiceQueues(_0x59ba3d[_0x7b2d('0x17')]);if(_0x206412){_0x206412=_['groupBy'](_0x206412,_0x7b2d('0x57'));for(var _0x1558ee in _0x206412){if(_0x206412[_0x7b2d('0x29')](_0x1558ee)){var _0x3985d0={};for(var _0x3581ca=0x0;_0x3581ca<_0x206412[_0x1558ee][_0x7b2d('0x43')];_0x3581ca+=0x1){var _0x56a7b8=_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x58')];if(_0x59ba3d['voiceQueues'][_0x56a7b8]){if(_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x59')]){_0x59ba3d[_0x7b2d('0x17')][_0x56a7b8][_0x7b2d('0x35')]+=0x1;}if(_0x206412[_0x1558ee][_0x3581ca]['queuecallerabandon']){_0x59ba3d[_0x7b2d('0x17')][_0x56a7b8][_0x7b2d('0x36')]+=0x1;}_0x59ba3d['voiceQueues'][_0x56a7b8][_0x7b2d('0x37')]+=moment(_0x206412[_0x1558ee][_0x3581ca]['queuecallerleaveAt'])[_0x7b2d('0x5a')](moment(_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x5b')]),'seconds')||0x0;if(_0x3581ca===_0x206412[_0x1558ee][_0x7b2d('0x43')]-0x1){_0x59ba3d[_0x7b2d('0x17')][_0x56a7b8][_0x7b2d('0x30')]+=moment(_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x5c')]||_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x5d')]||_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x5e')])[_0x7b2d('0x5a')](moment(_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x5b')]),_0x7b2d('0x5f'))||0x0;_0x59ba3d['voiceQueues'][_0x56a7b8][_0x7b2d('0x2e')]+=0x1;if(_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x60')]){_0x59ba3d[_0x7b2d('0x17')][_0x56a7b8][_0x7b2d('0x2f')]+=0x1;_0x59ba3d[_0x7b2d('0x17')][_0x56a7b8][_0x7b2d('0x31')]+=moment(_0x206412[_0x1558ee][_0x3581ca]['queuecallercompleteAt'])['diff'](moment(_0x206412[_0x1558ee][_0x3581ca][_0x7b2d('0x61')]),'seconds')||0x0;}}else{_0x59ba3d['voiceQueues'][_0x56a7b8]['sumDuration']+=_0x59ba3d[_0x7b2d('0x17')][_0x56a7b8][_0x7b2d('0x37')]||0x0;}}}}}}return _0x59ba3d[_0x7b2d('0x17')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x62')]=function(){var _0x5d1720=this;return function(_0xbd77a3){clearVoiceCallReports(_0x5d1720[_0x7b2d('0x1b')]);if(_0xbd77a3){for(var _0x515605=0x0;_0x515605<_0xbd77a3['length'];_0x515605+=0x1){_0x5d1720['outbound'][_0x7b2d('0x2e')]+=0x1;_0x5d1720[_0x7b2d('0x1b')][_0x7b2d('0x30')]+=_0xbd77a3[_0x515605]['duration'];if(_0xbd77a3[_0x515605][_0x7b2d('0x63')]===_0x7b2d('0x64')){_0x5d1720[_0x7b2d('0x1b')]['answered']+=0x1;_0x5d1720[_0x7b2d('0x1b')][_0x7b2d('0x37')]+=_0xbd77a3[_0x515605]['duration']-_0xbd77a3[_0x515605][_0x7b2d('0x65')]||0x0;_0x5d1720[_0x7b2d('0x1b')][_0x7b2d('0x31')]+=_0xbd77a3[_0x515605][_0x7b2d('0x65')];}}}return _0x5d1720['outbound'];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x66')]=function(){var _0x404ebe=this;return function(_0x391345){if(_0x391345){freeIsNotKey(_0x391345,_0x404ebe['campaigns'],_0x7b2d('0x2c'));for(var _0x18d768=0x0,_0x33801d={};_0x18d768<_0x391345[_0x7b2d('0x43')];_0x18d768+=0x1){_0x33801d=_0x391345[_0x18d768];if(_['isUndefined'](_0x404ebe[_0x7b2d('0x19')][_0x33801d['name']])){_0x404ebe[_0x7b2d('0x19')][_0x33801d[_0x7b2d('0x2c')]]=new Campaign(_0x33801d);}else{_0x404ebe[_0x7b2d('0x42')](_0x404ebe[_0x7b2d('0x19')][_0x33801d[_0x7b2d('0x2c')]],_0x33801d);_0x404ebe[_0x7b2d('0x19')][_0x33801d['name']]['dialQueueProject']=_0x33801d[_0x7b2d('0x67')]?_0x33801d[_0x7b2d('0x67')][_0x7b2d('0x2c')]:undefined;}}}return _0x404ebe[_0x7b2d('0x19')];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x68')]=function(){var _0x475a6e=this;return function(_0x12d4fd){if(_0x12d4fd){freeIsNotKey(_0x12d4fd,_0x475a6e[_0x7b2d('0x1c')],'id');for(var _0x4abe19=0x0,_0x2e9d32={};_0x4abe19<_0x12d4fd[_0x7b2d('0x43')];_0x4abe19+=0x1){_0x2e9d32=_0x12d4fd[_0x4abe19];if(_[_0x7b2d('0x46')](_0x475a6e['voiceExtensions'][_0x2e9d32['id']])){_0x475a6e['voiceExtensions'][_0x2e9d32['id']]=new VoiceExtension(_0x2e9d32);}else{_0x475a6e[_0x7b2d('0x42')](_0x475a6e[_0x7b2d('0x1c')][_0x2e9d32['id']],_0x2e9d32);}}}return _0x475a6e['voiceExtensions'];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x69')]=function(){var _0x4be376=this;return function(_0x39be78){clearCampaigns(_0x4be376[_0x7b2d('0x19')]);for(var _0x3a97e7=0x0;_0x3a97e7<_0x39be78[_0x7b2d('0x43')];_0x3a97e7+=0x1){_[_0x7b2d('0x55')](_0x4be376[_0x7b2d('0x19')][_0x39be78[_0x3a97e7]['name']],_0x39be78[_0x3a97e7]);}return _0x4be376['campaigns'];};};Realtime[_0x7b2d('0x41')][_0x7b2d('0x6a')]=function(){var _0x24ceb5=this;return function(_0x235f27){if(_0x235f27){freeIsNotKey(_0x235f27,_0x24ceb5[_0x7b2d('0x28')],'id');for(var _0x7f8841=0x0,_0x5e6617={},_0x299e35={};_0x7f8841<_0x235f27[_0x7b2d('0x43')];_0x7f8841+=0x1){_0x5e6617=_0x235f27[_0x7f8841];if(_[_0x7b2d('0x46')](_0x24ceb5['faxAccounts'][_0x5e6617['id']])){_0x24ceb5['faxAccounts'][_0x5e6617['id']]=new FaxAccount(_0x5e6617);}else{_0x24ceb5[_0x7b2d('0x42')](_0x24ceb5[_0x7b2d('0x28')][_0x5e6617['id']],_0x5e6617);}}}return _0x24ceb5['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xc0c5=['abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','initTelephones','isUndefined','initTrunks','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','bluebird','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/freshsalesAccount','agents','telephones','trunks','campaigns','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged'];(function(_0x1a2ffc,_0x139cf3){var _0x38ed15=function(_0x1990bc){while(--_0x1990bc){_0x1a2ffc['push'](_0x1a2ffc['shift']());}};_0x38ed15(++_0x139cf3);}(_0xc0c5,0x126));var _0x5c0c=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0xc0c5[_0x112fe3];return _0x1ec903;};'use strict';var BPromise=require(_0x5c0c('0x0'));var util=require(_0x5c0c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x5c0c('0x2'));var Telephone=require(_0x5c0c('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x5c0c('0x4'));var Trigger=require(_0x5c0c('0x5'));var Template=require(_0x5c0c('0x6'));var Campaign=require(_0x5c0c('0x7'));var VoiceExtension=require(_0x5c0c('0x8'));var ZendeskAccount=require(_0x5c0c('0x9'));var SalesforceAccount=require(_0x5c0c('0xa'));var FreshdeskAccount=require(_0x5c0c('0xb'));var SugarcrmAccount=require(_0x5c0c('0xc'));var ZohoAccount=require(_0x5c0c('0xd'));var DeskAccount=require(_0x5c0c('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x5c0c('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x5c0c('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x5c0c('0x11')]={};this[_0x5c0c('0x12')]={};this[_0x5c0c('0x13')]={};this['voiceQueues']={};this['triggers']={};this[_0x5c0c('0x14')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5c0c('0x15')]={};this[_0x5c0c('0x16')]={};this['outboundChannels']={};this[_0x5c0c('0x17')]={};this[_0x5c0c('0x18')]={};this[_0x5c0c('0x19')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x5c0c('0x1a')]={};this[_0x5c0c('0x1b')]={};this[_0x5c0c('0x1c')]={};this[_0x5c0c('0x1d')]={};this['faxAccounts']={};};function freeIsNotKey(_0x1ca1d0,_0x4fc7b4,_0x4ba438){var _0x4d2429=_[_0x5c0c('0x1e')](_0x1ca1d0,function(_0x34cb2a,_0x3ab056){return _0x34cb2a[_0x4ba438];});for(var _0x46fccf in _0x4fc7b4){if(_0x4fc7b4[_0x5c0c('0x1f')](_0x46fccf)){if(!_0x4d2429[_0x46fccf]){delete _0x4fc7b4[_0x46fccf];}}}}function freeIsNotKeySip(_0x49fb8e,_0x2cd0d8){var _0x1dd56a=_[_0x5c0c('0x1e')](_0x49fb8e,function(_0x506cf7,_0x3587fe){return util[_0x5c0c('0x20')](_0x5c0c('0x21'),_0x506cf7[_0x5c0c('0x22')]);});for(var _0x5de73a in _0x2cd0d8){if(_0x2cd0d8[_0x5c0c('0x1f')](_0x5de73a)){if(!_0x1dd56a[_0x5de73a]){delete _0x2cd0d8[_0x5de73a];}}}}function freeIsNotKeyAgent(_0x26393e,_0x45c18c){var _0x109300=_[_0x5c0c('0x1e')](_0x26393e,function(_0x5cd175,_0x1a1508){var _0x5c5c43=_['isNil'](_0x5cd175[_0x5c0c('0x23')])?util[_0x5c0c('0x20')](_0x5c0c('0x21'),_0x5cd175[_0x5c0c('0x22')]):_0x5cd175[_0x5c0c('0x23')];return _0x5c5c43;});for(var _0x6cda52 in _0x45c18c){if(_0x45c18c['hasOwnProperty'](_0x6cda52)){if(!_0x109300[_0x6cda52]){delete _0x45c18c[_0x6cda52];}}}}function clearVoiceCallReports(_0x19496d){_0x19496d[_0x5c0c('0x24')]=0x0;_0x19496d[_0x5c0c('0x25')]=0x0;_0x19496d[_0x5c0c('0x26')]=0x0;_0x19496d[_0x5c0c('0x27')]=0x0;_0x19496d[_0x5c0c('0x28')]=0x0;}function clearCampaigns(_0x1f8f0c){if(!_[_0x5c0c('0x29')](_0x1f8f0c)){for(var _0x33ec13 in _0x1f8f0c){if(_0x1f8f0c['hasOwnProperty'](_0x33ec13)){_0x1f8f0c[_0x33ec13][_0x5c0c('0x2a')]=0x0;_0x1f8f0c[_0x33ec13][_0x5c0c('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x4d13cd){if(!_['isEmpty'](_0x4d13cd)){for(var _0x379b0f in _0x4d13cd){if(_0x4d13cd[_0x5c0c('0x1f')](_0x379b0f)){_0x4d13cd[_0x379b0f][_0x5c0c('0x24')]=0x0;_0x4d13cd[_0x379b0f]['answered']=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x2c')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x2d')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x26')]=0x0;_0x4d13cd[_0x379b0f]['sumDuration']=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x28')]=0x0;_0x4d13cd[_0x379b0f]['outboundAnswerAgiCallsDay']=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x2e')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x2f')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x30')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x31')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x32')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x33')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x34')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x35')]=0x0;_0x4d13cd[_0x379b0f]['outboundOriginateFailureCallsDay']=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x36')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x37')]=0x0;_0x4d13cd[_0x379b0f]['outboundAnswerAgiCallsDay']=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x38')]=0x0;_0x4d13cd[_0x379b0f][_0x5c0c('0x39')]=!![];}}}}Realtime[_0x5c0c('0x3a')][_0x5c0c('0x3b')]=function(_0x369475,_0x14725f){for(var _0x2d7fff in _0x14725f){if(_0x369475[_0x5c0c('0x1f')](_0x2d7fff)){_0x369475[_0x2d7fff]=_0x14725f[_0x2d7fff];}}};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x3c')]=function(){var _0x229837=this;return function(_0x5543ee){if(_0x5543ee){freeIsNotKeyAgent(_0x5543ee,_0x229837[_0x5c0c('0x11')]);for(var _0x568017=0x0,_0x29442d={},_0x25531e={};_0x568017<_0x5543ee[_0x5c0c('0x3d')];_0x568017+=0x1){_0x29442d=_0x5543ee[_0x568017];var _0x2825f5=_[_0x5c0c('0x3e')](_0x29442d[_0x5c0c('0x23')])?util[_0x5c0c('0x20')](_0x5c0c('0x21'),_0x29442d[_0x5c0c('0x22')]):_0x29442d['interface'];if(_['isUndefined'](_0x229837[_0x5c0c('0x11')][_0x2825f5])){_0x229837[_0x5c0c('0x11')][_0x2825f5]=new Agent(_0x29442d);}else{_0x229837[_0x5c0c('0x3b')](_0x229837[_0x5c0c('0x11')][_0x2825f5],_0x29442d);}}}return _0x229837[_0x5c0c('0x11')];};};Realtime['prototype'][_0x5c0c('0x3f')]=function(){var _0x22a18b=this;return function(_0x11c202){if(_0x11c202){freeIsNotKeySip(_0x11c202,_0x22a18b[_0x5c0c('0x12')]);for(var _0x3998bc=0x0,_0x574fe9={},_0x9d9727={};_0x3998bc<_0x11c202[_0x5c0c('0x3d')];_0x3998bc+=0x1){_0x574fe9=_0x11c202[_0x3998bc];if(_[_0x5c0c('0x40')](_0x22a18b[_0x5c0c('0x12')][util[_0x5c0c('0x20')]('SIP/%s',_0x574fe9[_0x5c0c('0x22')])])){_0x22a18b[_0x5c0c('0x12')][util[_0x5c0c('0x20')]('SIP/%s',_0x574fe9[_0x5c0c('0x22')])]=new Telephone(_0x574fe9);}else{_0x22a18b[_0x5c0c('0x3b')](_0x22a18b['telephones'][util[_0x5c0c('0x20')]('SIP/%s',_0x574fe9['name'])],_0x574fe9);}}}return _0x22a18b['telephones'];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x41')]=function(){var _0x2e85e9=this;return function(_0x435d64){if(_0x435d64){freeIsNotKeySip(_0x435d64,_0x2e85e9[_0x5c0c('0x13')]);for(var _0x169a3a=0x0,_0x5ee1ba={},_0x1a2018={};_0x169a3a<_0x435d64[_0x5c0c('0x3d')];_0x169a3a+=0x1){_0x5ee1ba=_0x435d64[_0x169a3a];if(_['isUndefined'](_0x2e85e9[_0x5c0c('0x13')][util['format']('SIP/%s',_0x5ee1ba[_0x5c0c('0x22')])])){_0x2e85e9[_0x5c0c('0x13')][util[_0x5c0c('0x20')](_0x5c0c('0x21'),_0x5ee1ba[_0x5c0c('0x22')])]=new Trunk(_0x5ee1ba);}else{_0x2e85e9['mergeFromDatabase'](_0x2e85e9[_0x5c0c('0x13')][util[_0x5c0c('0x20')](_0x5c0c('0x21'),_0x5ee1ba[_0x5c0c('0x22')])],_0x5ee1ba);}}}return _0x2e85e9[_0x5c0c('0x13')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x42')]=function(){var _0x171498=this;return function(_0x2eb127){if(_0x2eb127){freeIsNotKey(_0x2eb127,_0x171498[_0x5c0c('0x43')],'name');for(var _0x290370=0x0,_0x4aeac6={},_0x1ca87d={};_0x290370<_0x2eb127['length'];_0x290370+=0x1){_0x4aeac6=_0x2eb127[_0x290370];if(_['isUndefined'](_0x171498['voiceQueues'][_0x4aeac6['name']])){_0x171498['voiceQueues'][_0x4aeac6[_0x5c0c('0x22')]]=new VoiceQueue(_0x4aeac6);}else{_0x171498[_0x5c0c('0x3b')](_0x171498[_0x5c0c('0x43')][_0x4aeac6[_0x5c0c('0x22')]],_0x4aeac6);}}}return _0x171498['voiceQueues'];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x44')]=function(){var _0x53c67d=this;return function(_0x4647b8){if(_0x4647b8){freeIsNotKey(_0x4647b8,_0x53c67d[_0x5c0c('0x45')],'id');for(var _0x2729e0=0x0,_0x5661fc={},_0xe84f77={};_0x2729e0<_0x4647b8['length'];_0x2729e0+=0x1){_0x5661fc=_0x4647b8[_0x2729e0];if(_[_0x5c0c('0x40')](_0x53c67d['triggers'][_0x5661fc['id']])){_0x53c67d['triggers'][_0x5661fc['id']]=new Trigger(_0x5661fc);}else{_0x53c67d[_0x5c0c('0x3b')](_0x53c67d['triggers'][_0x5661fc['id']],_0x5661fc);}}}return _0x53c67d[_0x5c0c('0x45')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x46')]=function(){var _0x214c0d=this;return function(_0xf06f0c){if(_0xf06f0c){freeIsNotKey(_0xf06f0c,_0x214c0d['templates'],'id');for(var _0x1d9fdc=0x0,_0x23d8a8={},_0x962a41={};_0x1d9fdc<_0xf06f0c[_0x5c0c('0x3d')];_0x1d9fdc+=0x1){_0x23d8a8=_0xf06f0c[_0x1d9fdc];if(_[_0x5c0c('0x40')](_0x214c0d[_0x5c0c('0x47')][_0x23d8a8['id']])){_0x214c0d['templates'][_0x23d8a8['id']]=new Template(_0x23d8a8);}else{_0x214c0d[_0x5c0c('0x3b')](_0x214c0d[_0x5c0c('0x47')][_0x23d8a8['id']],_0x23d8a8);}}}return _0x214c0d[_0x5c0c('0x47')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x48')]=function(){var _0xd9e476=this;return function(_0x3ae04f){if(_0x3ae04f){freeIsNotKey(_0x3ae04f,_0xd9e476[_0x5c0c('0x18')],'id');for(var _0x193849=0x0,_0x46200e={},_0x434476={};_0x193849<_0x3ae04f['length'];_0x193849+=0x1){_0x46200e=_0x3ae04f[_0x193849];if(_[_0x5c0c('0x40')](_0xd9e476[_0x5c0c('0x18')][_0x46200e['id']])){_0xd9e476[_0x5c0c('0x18')][_0x46200e['id']]=new ZendeskAccount(_0x46200e);}else{_0xd9e476[_0x5c0c('0x3b')](_0xd9e476['zendeskAccounts'][_0x46200e['id']],_0x46200e);}}}return _0xd9e476['zendeskAccounts'];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x49')]=function(){var _0x291fb2=this;return function(_0x2553ef){if(_0x2553ef){freeIsNotKey(_0x2553ef,_0x291fb2[_0x5c0c('0x19')],'id');for(var _0x4406d8=0x0,_0x46d473={},_0x350296={};_0x4406d8<_0x2553ef[_0x5c0c('0x3d')];_0x4406d8+=0x1){_0x46d473=_0x2553ef[_0x4406d8];if(_[_0x5c0c('0x40')](_0x291fb2['salesforceAccounts'][_0x46d473['id']])){_0x291fb2['salesforceAccounts'][_0x46d473['id']]=new SalesforceAccount(_0x46d473);}else{_0x291fb2['mergeFromDatabase'](_0x291fb2[_0x5c0c('0x19')][_0x46d473['id']],_0x46d473);}}}return _0x291fb2[_0x5c0c('0x19')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x4a')]=function(){var _0x915a9e=this;return function(_0x196eea){if(_0x196eea){freeIsNotKey(_0x196eea,_0x915a9e['freshdeskAccounts'],'id');for(var _0x35b1bc=0x0,_0x5c609c={},_0x1e6722={};_0x35b1bc<_0x196eea['length'];_0x35b1bc+=0x1){_0x5c609c=_0x196eea[_0x35b1bc];if(_[_0x5c0c('0x40')](_0x915a9e[_0x5c0c('0x4b')][_0x5c609c['id']])){_0x915a9e[_0x5c0c('0x4b')][_0x5c609c['id']]=new FreshdeskAccount(_0x5c609c);}else{_0x915a9e[_0x5c0c('0x3b')](_0x915a9e[_0x5c0c('0x4b')][_0x5c609c['id']],_0x5c609c);}}}return _0x915a9e[_0x5c0c('0x4b')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x4c')]=function(){var _0x2a1b91=this;return function(_0x3a6a33){if(_0x3a6a33){freeIsNotKey(_0x3a6a33,_0x2a1b91['zohoAccounts'],'id');for(var _0x35a825=0x0,_0xded56e={},_0x1b0c7c={};_0x35a825<_0x3a6a33[_0x5c0c('0x3d')];_0x35a825+=0x1){_0xded56e=_0x3a6a33[_0x35a825];if(_[_0x5c0c('0x40')](_0x2a1b91[_0x5c0c('0x4d')][_0xded56e['id']])){_0x2a1b91[_0x5c0c('0x4d')][_0xded56e['id']]=new ZohoAccount(_0xded56e);}else{_0x2a1b91[_0x5c0c('0x3b')](_0x2a1b91[_0x5c0c('0x4d')][_0xded56e['id']],_0xded56e);}}}return _0x2a1b91[_0x5c0c('0x4d')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x4e')]=function(){var _0xb61cd2=this;return function(_0x119137){if(_0x119137){freeIsNotKey(_0x119137,_0xb61cd2[_0x5c0c('0x4f')],'id');for(var _0x203f1d=0x0,_0x5497af={},_0x48b218={};_0x203f1d<_0x119137[_0x5c0c('0x3d')];_0x203f1d+=0x1){_0x5497af=_0x119137[_0x203f1d];if(_[_0x5c0c('0x40')](_0xb61cd2[_0x5c0c('0x4f')][_0x5497af['id']])){_0xb61cd2['deskAccounts'][_0x5497af['id']]=new DeskAccount(_0x5497af);}else{_0xb61cd2[_0x5c0c('0x3b')](_0xb61cd2['deskAccounts'][_0x5497af['id']],_0x5497af);}}}return _0xb61cd2[_0x5c0c('0x4f')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x50')]=function(){var _0x4cf89f=this;return function(_0x44921f){if(_0x44921f){freeIsNotKey(_0x44921f,_0x4cf89f[_0x5c0c('0x51')],'id');for(var _0x481ea7=0x0,_0xc09123={},_0x6aba44={};_0x481ea7<_0x44921f[_0x5c0c('0x3d')];_0x481ea7+=0x1){_0xc09123=_0x44921f[_0x481ea7];if(_['isUndefined'](_0x4cf89f[_0x5c0c('0x51')][_0xc09123['id']])){_0x4cf89f[_0x5c0c('0x51')][_0xc09123['id']]=new SugarcrmAccount(_0xc09123);}else{_0x4cf89f[_0x5c0c('0x3b')](_0x4cf89f[_0x5c0c('0x51')][_0xc09123['id']],_0xc09123);}}}return _0x4cf89f['sugarcrmAccounts'];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x52')]=function(){var _0x57f59c=this;return function(_0x5312a3){if(_0x5312a3){freeIsNotKey(_0x5312a3,_0x57f59c[_0x5c0c('0x1a')],'id');for(var _0x28ab17=0x0,_0xb0e665={},_0x23eff2={};_0x28ab17<_0x5312a3[_0x5c0c('0x3d')];_0x28ab17+=0x1){_0xb0e665=_0x5312a3[_0x28ab17];if(_[_0x5c0c('0x40')](_0x57f59c[_0x5c0c('0x1a')][_0xb0e665['id']])){_0x57f59c[_0x5c0c('0x1a')][_0xb0e665['id']]=new VtigerAccount(_0xb0e665);}else{_0x57f59c[_0x5c0c('0x3b')](_0x57f59c[_0x5c0c('0x1a')][_0xb0e665['id']],_0xb0e665);}}}return _0x57f59c[_0x5c0c('0x1a')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x53')]=function(){var _0x373ca7=this;return function(_0x3542d3){if(_0x3542d3){freeIsNotKey(_0x3542d3,_0x373ca7['servicenowAccounts'],'id');for(var _0x5a6166=0x0,_0x43532f={},_0x5be7ce={};_0x5a6166<_0x3542d3['length'];_0x5a6166+=0x1){_0x43532f=_0x3542d3[_0x5a6166];if(_[_0x5c0c('0x40')](_0x373ca7['servicenowAccounts'][_0x43532f['id']])){_0x373ca7[_0x5c0c('0x1b')][_0x43532f['id']]=new ServicenowAccount(_0x43532f);}else{_0x373ca7[_0x5c0c('0x3b')](_0x373ca7['servicenowAccounts'][_0x43532f['id']],_0x43532f);}}}return _0x373ca7[_0x5c0c('0x1b')];};};Realtime['prototype'][_0x5c0c('0x54')]=function(){var _0x4506c9=this;return function(_0x3040c8){if(_0x3040c8){freeIsNotKey(_0x3040c8,_0x4506c9[_0x5c0c('0x1c')],'id');for(var _0x59d048=0x0,_0x5de17c={},_0x431884={};_0x59d048<_0x3040c8['length'];_0x59d048+=0x1){_0x5de17c=_0x3040c8[_0x59d048];if(_[_0x5c0c('0x40')](_0x4506c9['dynamics365Accounts'][_0x5de17c['id']])){_0x4506c9[_0x5c0c('0x1c')][_0x5de17c['id']]=new Dynamics365Account(_0x5de17c);}else{_0x4506c9[_0x5c0c('0x3b')](_0x4506c9['dynamics365Accounts'][_0x5de17c['id']],_0x5de17c);}}}return _0x4506c9['dynamics365Accounts'];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x55')]=function(){var _0x11796a=this;return function(_0x449409){if(_0x449409){freeIsNotKey(_0x449409,_0x11796a[_0x5c0c('0x1d')],'id');for(var _0x42db68=0x0,_0x71ae86={},_0x5aa4a3={};_0x42db68<_0x449409[_0x5c0c('0x3d')];_0x42db68+=0x1){_0x71ae86=_0x449409[_0x42db68];if(_[_0x5c0c('0x40')](_0x11796a[_0x5c0c('0x1d')][_0x71ae86['id']])){_0x11796a[_0x5c0c('0x1d')][_0x71ae86['id']]=new FreshsalesAccount(_0x71ae86);}else{_0x11796a[_0x5c0c('0x3b')](_0x11796a[_0x5c0c('0x1d')][_0x71ae86['id']],_0x71ae86);}}}return _0x11796a[_0x5c0c('0x1d')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x56')]=function(){var _0x2f1fec=this;return function(_0x47a445){for(var _0x345618=0x0;_0x345618<_0x47a445[_0x5c0c('0x3d')];_0x345618+=0x1){_[_0x5c0c('0x57')](_0x2f1fec['voiceQueues'][_0x47a445[_0x345618][_0x5c0c('0x22')]],_0x47a445[_0x345618]);}return _0x2f1fec[_0x5c0c('0x43')];};};Realtime[_0x5c0c('0x3a')]['initVoiceQueueReports']=function(){var _0x59adbf=this;return function(_0x371550){clearVoiceQueues(_0x59adbf['voiceQueues']);if(_0x371550){_0x371550=_[_0x5c0c('0x58')](_0x371550,_0x5c0c('0x59'));for(var _0x54d42c in _0x371550){if(_0x371550['hasOwnProperty'](_0x54d42c)){var _0x16f902={};for(var _0x50c50a=0x0;_0x50c50a<_0x371550[_0x54d42c]['length'];_0x50c50a+=0x1){var _0x35432f=_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x5a')];if(_0x59adbf['voiceQueues'][_0x35432f]){if(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x5b')]){_0x59adbf[_0x5c0c('0x43')][_0x35432f][_0x5c0c('0x2c')]+=0x1;}if(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x5c')]){_0x59adbf[_0x5c0c('0x43')][_0x35432f][_0x5c0c('0x2d')]+=0x1;}_0x59adbf[_0x5c0c('0x43')][_0x35432f]['sumHoldTime']+=moment(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x5d')])[_0x5c0c('0x5e')](moment(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x5f')]),'seconds')||0x0;if(_0x50c50a===_0x371550[_0x54d42c]['length']-0x1){_0x59adbf['voiceQueues'][_0x35432f]['sumDuration']+=moment(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x60')]||_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x61')]||_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x62')])[_0x5c0c('0x5e')](moment(_0x371550[_0x54d42c][_0x50c50a]['queuecallerjoinAt']),_0x5c0c('0x63'))||0x0;_0x59adbf['voiceQueues'][_0x35432f][_0x5c0c('0x24')]+=0x1;if(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x64')]){_0x59adbf['voiceQueues'][_0x35432f][_0x5c0c('0x25')]+=0x1;_0x59adbf[_0x5c0c('0x43')][_0x35432f][_0x5c0c('0x28')]+=moment(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x60')])['diff'](moment(_0x371550[_0x54d42c][_0x50c50a][_0x5c0c('0x5d')]),_0x5c0c('0x63'))||0x0;}}else{_0x59adbf[_0x5c0c('0x43')][_0x35432f][_0x5c0c('0x27')]+=_0x59adbf[_0x5c0c('0x43')][_0x35432f]['sumHoldTime']||0x0;}}}}}}return _0x59adbf['voiceQueues'];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x65')]=function(){var _0x1eeb44=this;return function(_0x141661){clearVoiceCallReports(_0x1eeb44[_0x5c0c('0x66')]);if(_0x141661){for(var _0x46b46d=0x0;_0x46b46d<_0x141661[_0x5c0c('0x3d')];_0x46b46d+=0x1){_0x1eeb44['outbound'][_0x5c0c('0x24')]+=0x1;_0x1eeb44[_0x5c0c('0x66')][_0x5c0c('0x27')]+=_0x141661[_0x46b46d][_0x5c0c('0x67')];if(_0x141661[_0x46b46d][_0x5c0c('0x68')]===_0x5c0c('0x69')){_0x1eeb44[_0x5c0c('0x66')][_0x5c0c('0x25')]+=0x1;_0x1eeb44[_0x5c0c('0x66')]['sumHoldTime']+=_0x141661[_0x46b46d]['duration']-_0x141661[_0x46b46d]['billableseconds']||0x0;_0x1eeb44[_0x5c0c('0x66')]['sumBillable']+=_0x141661[_0x46b46d]['billableseconds'];}}}return _0x1eeb44['outbound'];};};Realtime[_0x5c0c('0x3a')]['initCampaigns']=function(){var _0x241209=this;return function(_0x246e0d){if(_0x246e0d){freeIsNotKey(_0x246e0d,_0x241209['campaigns'],_0x5c0c('0x22'));for(var _0x41f314=0x0,_0x175652={};_0x41f314<_0x246e0d[_0x5c0c('0x3d')];_0x41f314+=0x1){_0x175652=_0x246e0d[_0x41f314];if(_[_0x5c0c('0x40')](_0x241209[_0x5c0c('0x14')][_0x175652[_0x5c0c('0x22')]])){_0x241209['campaigns'][_0x175652[_0x5c0c('0x22')]]=new Campaign(_0x175652);}else{_0x241209[_0x5c0c('0x3b')](_0x241209['campaigns'][_0x175652[_0x5c0c('0x22')]],_0x175652);_0x241209['campaigns'][_0x175652[_0x5c0c('0x22')]][_0x5c0c('0x6a')]=_0x175652[_0x5c0c('0x6b')]?_0x175652['SquareProject']['name']:undefined;}}}return _0x241209['campaigns'];};};Realtime['prototype'][_0x5c0c('0x6c')]=function(){var _0x638849=this;return function(_0x267dc4){if(_0x267dc4){freeIsNotKey(_0x267dc4,_0x638849['voiceExtensions'],'id');for(var _0x3ebb9a=0x0,_0x4a7cff={};_0x3ebb9a<_0x267dc4['length'];_0x3ebb9a+=0x1){_0x4a7cff=_0x267dc4[_0x3ebb9a];if(_['isUndefined'](_0x638849[_0x5c0c('0x6d')][_0x4a7cff['id']])){_0x638849[_0x5c0c('0x6d')][_0x4a7cff['id']]=new VoiceExtension(_0x4a7cff);}else{_0x638849['mergeFromDatabase'](_0x638849[_0x5c0c('0x6d')][_0x4a7cff['id']],_0x4a7cff);}}}return _0x638849[_0x5c0c('0x6d')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x6e')]=function(){var _0x52e893=this;return function(_0x43bc2a){clearCampaigns(_0x52e893[_0x5c0c('0x14')]);for(var _0x1d5072=0x0;_0x1d5072<_0x43bc2a[_0x5c0c('0x3d')];_0x1d5072+=0x1){_['merge'](_0x52e893['campaigns'][_0x43bc2a[_0x1d5072][_0x5c0c('0x22')]],_0x43bc2a[_0x1d5072]);}return _0x52e893[_0x5c0c('0x14')];};};Realtime[_0x5c0c('0x3a')][_0x5c0c('0x6f')]=function(){var _0xb05150=this;return function(_0x224b87){if(_0x224b87){freeIsNotKey(_0x224b87,_0xb05150[_0x5c0c('0x70')],'id');for(var _0x533dd0=0x0,_0x53156e={},_0x35bd01={};_0x533dd0<_0x224b87['length'];_0x533dd0+=0x1){_0x53156e=_0x224b87[_0x533dd0];if(_[_0x5c0c('0x40')](_0xb05150[_0x5c0c('0x70')][_0x53156e['id']])){_0xb05150['faxAccounts'][_0x53156e['id']]=new FaxAccount(_0x53156e);}else{_0xb05150[_0x5c0c('0x3b')](_0xb05150[_0x5c0c('0x70')][_0x53156e['id']],_0x53156e);}}}return _0xb05150[_0x5c0c('0x70')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 42c5642..34994de 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 _0x736a=['\x22%s\x22\x20<%s>','calleridname','monitor','monitors','length','monitorFilename','createdAt','exten','connectedlinename','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','exports','lodash','moment','util','../../../config/environment','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','voiceCallReport','destination','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','channel','calleridnum','originatecalleridnum','disposition','ANSWERED'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x736a,0x167));var _0xa736=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x736a[_0x2070da];return _0x4f9fe1;};'use strict';var BPromise=require('bluebird');var _=require(_0xa736('0x0'));var moment=require(_0xa736('0x1'));var util=require(_0xa736('0x2'));var config=require(_0xa736('0x3'));var logger=require('../../../config/logger')(_0xa736('0x4'));var ami=require(_0xa736('0x5'));var RpcVoiceAgentReport=require(_0xa736('0x6'));var RpcVoiceCallReport=require(_0xa736('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xa736('0x8'));var RpcVoiceQueueReport=require(_0xa736('0x9'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xa736('0xa'));var VoiceQueueReport=require(_0xa736('0xb'));var VoiceCallReport=require(_0xa736('0xc'));var VoiceAgentReport=require(_0xa736('0xd'));var VoiceDialReport=require(_0xa736('0xe'));var UserReport=require('./userReport');function Report(_0x57d054){this[_0xa736('0xf')]=_0x57d054;this[_0xa736('0x10')]=_0x57d054[_0xa736('0x10')];this[_0xa736('0x11')]=_0x57d054[_0xa736('0x11')];}Report[_0xa736('0x12')][_0xa736('0x13')]=function(_0x36f283){var _0xc9a2b3=new VoiceQueueReport(this[_0xa736('0xf')]);var _0x11bbe2=new VoiceAgentReport(this[_0xa736('0xf')]);var _0x4811d3=new VoiceDialReport(this['realtime']);var _0x4f8d32=new VoiceCallReport(this[_0xa736('0xf')]);var _0x552999=new UserReport(this[_0xa736('0xf')]);if(config[_0xa736('0x14')]&&config[_0xa736('0x14')]['disabled']){ami['on'](_0xa736('0x15'),this[_0xa736('0x16')][_0xa736('0x17')](this));ami['on'](_0xa736('0x18'),this['voiceCallReport'][_0xa736('0x17')](this));ami['on'](_0xa736('0x19'),this[_0xa736('0x1a')][_0xa736('0x17')](this));ami['on'](_0xa736('0x1b'),this[_0xa736('0x1c')][_0xa736('0x17')](this));ami['on'](_0xa736('0x1d'),this['blindTransfer']['bind'](this));ami['on'](_0xa736('0x1e'),this[_0xa736('0x1f')][_0xa736('0x17')](this));}};Report[_0xa736('0x12')][_0xa736('0x20')]=function(_0x4fd299){var _0x510100=undefined;_0x510100=_[_0xa736('0x21')](this[_0xa736('0x10')],function(_0x1fbbd3){return _0x1fbbd3[_0xa736('0x22')]==_0x4fd299||_0x1fbbd3['name']==_0x4fd299;});if(_['isNil'](_0x510100)){var _0x5d8e93=_[_0xa736('0x21')](this[_0xa736('0x11')],function(_0x2e22fa){return _0x2e22fa[_0xa736('0x22')]==_0x4fd299||_0x2e22fa[_0xa736('0x23')]==_0x4fd299;});if(_0x5d8e93){_0x510100=_[_0xa736('0x21')](this[_0xa736('0x10')],function(_0x1c14cd){return _0x1c14cd[_0xa736('0x24')]==util[_0xa736('0x25')]('SIP/%s',_0x5d8e93[_0xa736('0x23')]);});}}return _0x510100;};Report[_0xa736('0x12')]['voiceQueueReport']=function(_0x5d808c){for(var _0x29a7a9=0x0;_0x29a7a9<_0x5d808c['length'];_0x29a7a9+=0x1){var _0x297e98=this[_0xa736('0x20')](_0x5d808c[_0x29a7a9][_0xa736('0x26')]);if(_0x297e98){_0x5d808c[_0x29a7a9]['accountcode']=_0x297e98[_0xa736('0x22')];_0x5d808c[_0x29a7a9][_0xa736('0x27')]=!![];_0x5d808c[_0x29a7a9][_0xa736('0x28')]=_0x297e98['name'];_0x5d808c[_0x29a7a9]['interface']=_[_0xa736('0x29')](_0x297e98[_0xa736('0x24')])?util['format'](_0xa736('0x2a'),_0x297e98[_0xa736('0x23')]):_0x297e98[_0xa736('0x24')];if(_0x5d808c[_0x29a7a9][_0xa736('0x2b')]){_0x5d808c[_0x29a7a9]['queuecallercompleteAt']=moment()[_0xa736('0x25')](_0xa736('0x2c'));}if(_0x5d808c[_0x29a7a9][_0xa736('0x2d')]){_0x5d808c[_0x29a7a9]['queuecallerexitAt']=moment()[_0xa736('0x25')](_0xa736('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x5d808c[_0x29a7a9]);}RpcVoiceQueueReport[_0xa736('0x2e')](_0x5d808c[_0x29a7a9]);}};function extractCalleridNumber(_0x2edeab){var _0x404bef=_0x2edeab[_0xa736('0x2f')](/<(.*?)>/);return _0x404bef?_0x404bef[0x1]:_0x2edeab;}Report[_0xa736('0x12')][_0xa736('0x30')]=function(_0x49f975){_0x49f975[_0xa736('0x31')]=_0x49f975[_0xa736('0x31')]||_0x49f975['exten'];if(_0x49f975[_0xa736('0x32')]=='dialer'){_0x49f975[_0xa736('0x33')]=_0xa736('0x34');_0x49f975[_0xa736('0x35')]=_0x49f975[_0xa736('0x34')];if(_0x49f975[_0xa736('0x36')]==_0xa736('0x37')){_0x49f975[_0xa736('0x22')]='';_0x49f975['destination']=extractCalleridNumber(_0x49f975[_0xa736('0x38')]);}else if(_0x49f975['context']==_0xa736('0x39')){if(_0x49f975[_0xa736('0x31')]==_0xa736('0x3a')){_0x49f975[_0xa736('0x31')]=extractCalleridNumber(_0x49f975[_0xa736('0x3b')]);_0x49f975['calleridnum']=_0x49f975['originatecalleridnum'];_0x49f975[_0xa736('0x3c')]=[_0x49f975[_0xa736('0x3d')],_0x49f975['channel']=_0x49f975[_0xa736('0x3c')]][0x0];_0x49f975['callerid']=_0x49f975[_0xa736('0x3b')];}else{_0x49f975[_0xa736('0x31')]=_0x49f975[_0xa736('0x3e')];_0x49f975[_0xa736('0x3e')]=_0x49f975[_0xa736('0x3f')];if(_0x49f975[_0xa736('0x40')]==_0xa736('0x41')){_0x49f975[_0xa736('0x22')]=_0x49f975[_0xa736('0x26')];}else{_0x49f975[_0xa736('0x22')]='';}}}}else{_0x49f975['callerid']=util[_0xa736('0x25')](_0xa736('0x42'),_0x49f975[_0xa736('0x43')],_0x49f975[_0xa736('0x3e')]);}RpcVoiceCallReport['create'](_0x49f975);if(_0x49f975[_0xa736('0x44')]){for(var _0x1092da=0x0;_0x1092da<_0x49f975[_0xa736('0x45')][_0xa736('0x46')];_0x1092da+=0x1){_0x49f975[_0xa736('0x47')]=_0x49f975[_0xa736('0x45')][_0x1092da]['filename'];_0x49f975[_0xa736('0x48')]=_0x49f975[_0xa736('0x45')][_0x1092da][_0xa736('0x48')];if(_0x49f975[_0xa736('0x49')]==_0xa736('0x3a')){_0x49f975[_0xa736('0x3e')]=_0x49f975['connectedlinenum'];_0x49f975[_0xa736('0x43')]=_0x49f975[_0xa736('0x4a')];_0x49f975[_0xa736('0x26')]=_0x49f975[_0xa736('0x22')];_0x49f975[_0xa736('0x4a')]=_0x49f975['membername'];_0x49f975[_0xa736('0x49')]=_0x49f975['originatecalleridnum'];}else if(_0x49f975[_0xa736('0x49')]==_0xa736('0x4b')){_0x49f975[_0xa736('0x3e')]=_0x49f975['destination'];_0x49f975['exten']=_0x49f975[_0xa736('0x3f')];}RpcVoiceRecording[_0xa736('0x2e')](_0x49f975);}}};Report[_0xa736('0x12')]['voiceAgentReport']=function(_0x4568e2){if(_['isArray'](_0x4568e2)){_0x4568e2[_0xa736('0x4c')](function(_0x5d02ae){RpcVoiceAgentReport[_0xa736('0x2e')](_0x5d02ae);});}else{RpcVoiceAgentReport[_0xa736('0x2e')](_0x4568e2);}};Report['prototype'][_0xa736('0x1c')]=function(_0x17fb22){RpcVoiceDialReport['create'](_0x17fb22);var _0xe51fbc=undefined;var _0x24f1ae=_0x17fb22[_0xa736('0x3d')];if(_[_0xa736('0x4d')](_0x24f1ae,'Local')){var _0x14cd28=_0x24f1ae[_0xa736('0x4e')](_0x24f1ae[_0xa736('0x4f')]('/')+0x1,_0x24f1ae[_0xa736('0x4f')]('@'));_0xe51fbc=_[_0xa736('0x21')](this[_0xa736('0x10')],function(_0x28dbe7){return _0x28dbe7[_0xa736('0x50')]==_0x14cd28||_0x28dbe7[_0xa736('0x51')]==_0x14cd28||_0x28dbe7[_0xa736('0x22')]==_0x14cd28;});}else{var _0x14cd28=_0x24f1ae['substring'](_0x24f1ae[_0xa736('0x4f')]('/')+0x1,_0x24f1ae[_0xa736('0x52')]('-'));_0xe51fbc=this[_0xa736('0x20')](_0x14cd28);}if(_0xe51fbc){_0x17fb22['interface']=_[_0xa736('0x29')](_0xe51fbc[_0xa736('0x24')])?util[_0xa736('0x25')]('SIP/%s',_0xe51fbc[_0xa736('0x23')]):_0xe51fbc[_0xa736('0x24')];_0x17fb22['membername']=_0xe51fbc[_0xa736('0x23')];_0x17fb22['accountcode']=_0xe51fbc['accountcode'];RpcMemberReport[_0xa736('0x1c')](_0x17fb22);}};Report[_0xa736('0x12')][_0xa736('0x53')]=function(_0x341d6f){RpcVoiceTransferReport[_0xa736('0x53')](_0x341d6f);};Report[_0xa736('0x12')][_0xa736('0x1f')]=function(_0x2ee2ad){RpcVoiceTransferReport[_0xa736('0x1f')](_0x2ee2ad);};module[_0xa736('0x54')]=Report; \ No newline at end of file +var _0xd558=['blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','agents','interface','format','SIP/%s','length','connectedlinenum','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','prototype','voiceCallReport','exten','dialer','queue','context','from-voip-provider','destination','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','callerid','calleridname','monitor','monitors','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','exports','lodash','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport'];(function(_0x208545,_0x41d6dd){var _0xc21084=function(_0x464193){while(--_0x464193){_0x208545['push'](_0x208545['shift']());}};_0xc21084(++_0x41d6dd);}(_0xd558,0x179));var _0x8d55=function(_0x495bf9,_0x36679a){_0x495bf9=_0x495bf9-0x0;var _0x407bbe=_0xd558[_0x495bf9];return _0x407bbe;};'use strict';var BPromise=require('bluebird');var _=require(_0x8d55('0x0'));var moment=require(_0x8d55('0x1'));var util=require(_0x8d55('0x2'));var config=require('../../../config/environment');var logger=require(_0x8d55('0x3'))(_0x8d55('0x4'));var ami=require(_0x8d55('0x5'));var RpcVoiceAgentReport=require(_0x8d55('0x6'));var RpcVoiceCallReport=require(_0x8d55('0x7'));var RpcVoiceDialReport=require(_0x8d55('0x8'));var RpcMemberReport=require(_0x8d55('0x9'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x8d55('0xa'));var RpcVoiceTransferReport=require(_0x8d55('0xb'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8d55('0xc'));var VoiceAgentReport=require(_0x8d55('0xd'));var VoiceDialReport=require(_0x8d55('0xe'));var UserReport=require(_0x8d55('0xf'));function Report(_0x3e1191){this[_0x8d55('0x10')]=_0x3e1191;this['agents']=_0x3e1191['agents'];this['telephones']=_0x3e1191[_0x8d55('0x11')];}Report['prototype'][_0x8d55('0x12')]=function(_0x3fb407){var _0x14ca9b=new VoiceQueueReport(this[_0x8d55('0x10')]);var _0x8bf739=new VoiceAgentReport(this[_0x8d55('0x10')]);var _0x31a166=new VoiceDialReport(this['realtime']);var _0x469e60=new VoiceCallReport(this[_0x8d55('0x10')]);var _0x136ddc=new UserReport(this[_0x8d55('0x10')]);if(config[_0x8d55('0x13')]&&config[_0x8d55('0x13')]['disabled']){ami['on'](_0x8d55('0x14'),this[_0x8d55('0x15')]['bind'](this));ami['on'](_0x8d55('0x16'),this['voiceCallReport'][_0x8d55('0x17')](this));ami['on'](_0x8d55('0x18'),this[_0x8d55('0x19')][_0x8d55('0x17')](this));ami['on'](_0x8d55('0x1a'),this[_0x8d55('0x1b')]['bind'](this));ami['on'](_0x8d55('0x1c'),this[_0x8d55('0x1d')]['bind'](this));ami['on']('attendedtransfer',this[_0x8d55('0x1e')][_0x8d55('0x17')](this));}};Report['prototype'][_0x8d55('0x1f')]=function(_0x26b183){var _0xcbcbfc=undefined;_0xcbcbfc=_[_0x8d55('0x20')](this['agents'],function(_0xecab00){return _0xecab00[_0x8d55('0x21')]==_0x26b183||_0xecab00[_0x8d55('0x22')]==_0x26b183;});if(_[_0x8d55('0x23')](_0xcbcbfc)){var _0x5eba5e=_['find'](this['telephones'],function(_0x587825){return _0x587825[_0x8d55('0x21')]==_0x26b183||_0x587825[_0x8d55('0x22')]==_0x26b183;});if(_0x5eba5e){_0xcbcbfc=_['find'](this[_0x8d55('0x24')],function(_0x1254b8){return _0x1254b8[_0x8d55('0x25')]==util[_0x8d55('0x26')](_0x8d55('0x27'),_0x5eba5e[_0x8d55('0x22')]);});}}return _0xcbcbfc;};Report['prototype'][_0x8d55('0x15')]=function(_0x348f30){for(var _0x200706=0x0;_0x200706<_0x348f30[_0x8d55('0x28')];_0x200706+=0x1){var _0x522aee=this[_0x8d55('0x1f')](_0x348f30[_0x200706][_0x8d55('0x29')]);if(_0x522aee){_0x348f30[_0x200706][_0x8d55('0x21')]=_0x522aee[_0x8d55('0x21')];_0x348f30[_0x200706]['assigned']=!![];_0x348f30[_0x200706]['lastAssignedTo']=_0x522aee[_0x8d55('0x22')];_0x348f30[_0x200706][_0x8d55('0x25')]=_[_0x8d55('0x23')](_0x522aee['interface'])?util[_0x8d55('0x26')](_0x8d55('0x27'),_0x522aee[_0x8d55('0x22')]):_0x522aee['interface'];if(_0x348f30[_0x200706][_0x8d55('0x2a')]){_0x348f30[_0x200706][_0x8d55('0x2b')]=moment()['format'](_0x8d55('0x2c'));}if(_0x348f30[_0x200706][_0x8d55('0x2d')]){_0x348f30[_0x200706]['queuecallerexitAt']=moment()['format'](_0x8d55('0x2c'));}RpcMemberReport[_0x8d55('0x15')](_0x348f30[_0x200706]);}RpcVoiceQueueReport[_0x8d55('0x2e')](_0x348f30[_0x200706]);}};function extractCalleridNumber(_0x5f23f0){var _0x35a377=_0x5f23f0[_0x8d55('0x2f')](/<(.*?)>/);return _0x35a377?_0x35a377[0x1]:_0x5f23f0;}Report[_0x8d55('0x30')][_0x8d55('0x31')]=function(_0x3de7aa){_0x3de7aa['destination']=_0x3de7aa['destination']||_0x3de7aa[_0x8d55('0x32')];if(_0x3de7aa['type']==_0x8d55('0x33')){_0x3de7aa['lastapplication']=_0x8d55('0x34');_0x3de7aa['lastdata']=_0x3de7aa[_0x8d55('0x34')];if(_0x3de7aa[_0x8d55('0x35')]==_0x8d55('0x36')){_0x3de7aa[_0x8d55('0x21')]='';_0x3de7aa[_0x8d55('0x37')]=extractCalleridNumber(_0x3de7aa['callerid']);}else if(_0x3de7aa[_0x8d55('0x35')]==_0x8d55('0x38')){if(_0x3de7aa[_0x8d55('0x37')]=='xcally-motion-preview'){_0x3de7aa['destination']=extractCalleridNumber(_0x3de7aa[_0x8d55('0x39')]);_0x3de7aa[_0x8d55('0x3a')]=_0x3de7aa[_0x8d55('0x3b')];_0x3de7aa[_0x8d55('0x3c')]=[_0x3de7aa[_0x8d55('0x3d')],_0x3de7aa[_0x8d55('0x3d')]=_0x3de7aa[_0x8d55('0x3c')]][0x0];_0x3de7aa['callerid']=_0x3de7aa['calleridpreview'];}else{_0x3de7aa['destination']=_0x3de7aa['calleridnum'];_0x3de7aa['calleridnum']=_0x3de7aa['originatecalleridnum'];if(_0x3de7aa[_0x8d55('0x3e')]==_0x8d55('0x3f')){_0x3de7aa[_0x8d55('0x21')]=_0x3de7aa['connectedlinenum'];}else{_0x3de7aa[_0x8d55('0x21')]='';}}}}else{_0x3de7aa[_0x8d55('0x40')]=util[_0x8d55('0x26')]('\x22%s\x22\x20<%s>',_0x3de7aa[_0x8d55('0x41')],_0x3de7aa[_0x8d55('0x3a')]);}RpcVoiceCallReport['create'](_0x3de7aa);if(_0x3de7aa[_0x8d55('0x42')]){for(var _0x39c87e=0x0;_0x39c87e<_0x3de7aa[_0x8d55('0x43')][_0x8d55('0x28')];_0x39c87e+=0x1){_0x3de7aa['monitorFilename']=_0x3de7aa[_0x8d55('0x43')][_0x39c87e]['filename'];_0x3de7aa[_0x8d55('0x44')]=_0x3de7aa[_0x8d55('0x43')][_0x39c87e]['createdAt'];if(_0x3de7aa['exten']==_0x8d55('0x45')){_0x3de7aa['calleridnum']=_0x3de7aa[_0x8d55('0x29')];_0x3de7aa['calleridname']=_0x3de7aa[_0x8d55('0x46')];_0x3de7aa['connectedlinenum']=_0x3de7aa['accountcode'];_0x3de7aa['connectedlinename']=_0x3de7aa[_0x8d55('0x47')];_0x3de7aa[_0x8d55('0x32')]=_0x3de7aa[_0x8d55('0x3b')];}else if(_0x3de7aa[_0x8d55('0x32')]==_0x8d55('0x48')){_0x3de7aa[_0x8d55('0x3a')]=_0x3de7aa[_0x8d55('0x37')];_0x3de7aa[_0x8d55('0x32')]=_0x3de7aa['originatecalleridnum'];}RpcVoiceRecording[_0x8d55('0x2e')](_0x3de7aa);}}};Report[_0x8d55('0x30')][_0x8d55('0x19')]=function(_0xaa55a){if(_['isArray'](_0xaa55a)){_0xaa55a['forEach'](function(_0x395963){RpcVoiceAgentReport[_0x8d55('0x2e')](_0x395963);});}else{RpcVoiceAgentReport[_0x8d55('0x2e')](_0xaa55a);}};Report[_0x8d55('0x30')]['voiceDialReport']=function(_0x197a27){RpcVoiceDialReport['create'](_0x197a27);var _0x469d86=undefined;var _0x36dcc4=_0x197a27['channel'];if(_[_0x8d55('0x49')](_0x36dcc4,_0x8d55('0x4a'))){var _0x1b660c=_0x36dcc4['substring'](_0x36dcc4[_0x8d55('0x4b')]('/')+0x1,_0x36dcc4['indexOf']('@'));_0x469d86=_[_0x8d55('0x20')](this[_0x8d55('0x24')],function(_0x3ecf77){return _0x3ecf77[_0x8d55('0x4c')]==_0x1b660c||_0x3ecf77[_0x8d55('0x4d')]==_0x1b660c||_0x3ecf77['accountcode']==_0x1b660c;});}else{var _0x1b660c=_0x36dcc4[_0x8d55('0x4e')](_0x36dcc4[_0x8d55('0x4b')]('/')+0x1,_0x36dcc4[_0x8d55('0x4f')]('-'));_0x469d86=this['findAgent'](_0x1b660c);}if(_0x469d86){_0x197a27[_0x8d55('0x25')]=_[_0x8d55('0x23')](_0x469d86[_0x8d55('0x25')])?util[_0x8d55('0x26')](_0x8d55('0x27'),_0x469d86[_0x8d55('0x22')]):_0x469d86[_0x8d55('0x25')];_0x197a27[_0x8d55('0x47')]=_0x469d86[_0x8d55('0x22')];_0x197a27[_0x8d55('0x21')]=_0x469d86['accountcode'];RpcMemberReport['voiceDialReport'](_0x197a27);}};Report[_0x8d55('0x30')][_0x8d55('0x1d')]=function(_0x2b7893){RpcVoiceTransferReport[_0x8d55('0x1d')](_0x2b7893);};Report[_0x8d55('0x30')][_0x8d55('0x1e')]=function(_0x43c158){RpcVoiceTransferReport['attendedTransfer'](_0x43c158);};module[_0x8d55('0x50')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index cc49234..c1dd650 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 _0x06ef=['error','actionSipPeerStatus','prototype','emit','isNotNull','find','username','stateRegistry','state','omit','actionid','format','trunk:%s','[syncRegistry][UserReport]','inspect','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','name','telephone:save','trunk:save','startsWith','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peer','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','then','actionSipShowRegistry','actionDeviceStateList','catch','[loopSyncRealTimeShow]'];(function(_0x305706,_0x39345e){var _0x2d7402=function(_0x528d88){while(--_0x528d88){_0x305706['push'](_0x305706['shift']());}};_0x2d7402(++_0x39345e);}(_0x06ef,0x164));var _0xf06e=function(_0xe95a7c,_0x39a64d){_0xe95a7c=_0xe95a7c-0x0;var _0x1dd686=_0x06ef[_0xe95a7c];return _0x1dd686;};'use strict';var _=require(_0xf06e('0x0'));var moment=require(_0xf06e('0x1'));var BPromise=require(_0xf06e('0x2'));var util=require(_0xf06e('0x3'));var Redis=require(_0xf06e('0x4'));var config=require(_0xf06e('0x5'));var logger=require('../../../config/logger')(_0xf06e('0x6'));var ami=require(_0xf06e('0x7'));config['redis']=_[_0xf06e('0x8')](config[_0xf06e('0x9')],{'host':_0xf06e('0xa'),'port':0x18eb});var io=require(_0xf06e('0xb'))(new Redis(config[_0xf06e('0x9')]));function UserReport(_0x402b7){this[_0xf06e('0xc')]=_0x402b7[_0xf06e('0xc')];this[_0xf06e('0xd')]=_0x402b7['agents'];this[_0xf06e('0xe')]=_0x402b7[_0xf06e('0xe')];ami['on'](_0xf06e('0xf'),this[_0xf06e('0x10')][_0xf06e('0x11')](this));ami['on'](_0xf06e('0x12'),this[_0xf06e('0x10')][_0xf06e('0x11')](this));ami['on']('devicestatechange',this[_0xf06e('0x13')]['bind'](this));ami['on'](_0xf06e('0x14'),this[_0xf06e('0x15')][_0xf06e('0x11')](this));this[_0xf06e('0x16')]();return BPromise['resolve']()[_0xf06e('0x17')](ami[_0xf06e('0x18')]())[_0xf06e('0x17')](ami[_0xf06e('0x19')]())[_0xf06e('0x17')](ami['actionSipPeerStatus']())[_0xf06e('0x1a')](loggerCatch(_0xf06e('0x1b')));}function loggerCatch(_0x4b6e76){return function(_0x1f9469){logger[_0xf06e('0x1c')](_0x4b6e76,util['inspect'](_0x1f9469,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xf06e('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0xf06e('0x17')](ami['actionSipShowRegistry']())[_0xf06e('0x17')](ami[_0xf06e('0x19')]())[_0xf06e('0x17')](ami[_0xf06e('0x1d')]())[_0xf06e('0x1a')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xf06e('0x1e')]['isNotNull']=function(_0x4944f6){return _0x4944f6!==null&&!_['isUndefined'](_0x4944f6);};UserReport[_0xf06e('0x1e')]['emit']=function(_0x2d4637,_0x2ade30,_0x2abe5c){io['to'](_0x2d4637)[_0xf06e('0x1f')](_0x2ade30,_0x2abe5c);};UserReport[_0xf06e('0x1e')][_0xf06e('0x10')]=function(_0x47364d){try{if(this[_0xf06e('0x20')](_0x47364d)){var _0x32cf44=_[_0xf06e('0x21')](this['trunks'],{'registry':_0x47364d[_0xf06e('0x22')]});if(_0x32cf44){_0x47364d[_0xf06e('0x23')]=_0x47364d[_0xf06e('0x24')];_['merge'](_0x32cf44,_[_0xf06e('0x25')](_0x47364d,['event',_0xf06e('0x26'),'username',_0xf06e('0x24')]));this[_0xf06e('0x1f')](util[_0xf06e('0x27')](_0xf06e('0x28'),_0x32cf44['name']),'trunk:save',_0x32cf44);}}}catch(_0x1f5967){logger['error'](_0xf06e('0x29'),util[_0xf06e('0x2a')](_0x1f5967,{'showHidden':![],'depth':null}));}};UserReport[_0xf06e('0x1e')][_0xf06e('0x13')]=function(_0x5d6a14){try{if(this['isNotNull'](_0x5d6a14)){if(this['agents'][_0x5d6a14[_0xf06e('0x2b')]]){if(!this[_0xf06e('0xd')][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x2c')]||_0x5d6a14[_0xf06e('0x24')][_0xf06e('0x2d')]()==_0xf06e('0x2e')){this[_0xf06e('0xd')][_0x5d6a14['device']][_0xf06e('0x2c')]=![];if(this['agents'][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x24')]!==_0x5d6a14[_0xf06e('0x24')]['toLowerCase']()){this['agents'][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x2f')]=_[_0xf06e('0x30')](moment()[_0xf06e('0x27')]('x'));}this['agents'][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x24')]=_0x5d6a14[_0xf06e('0x24')][_0xf06e('0x2d')]();this[_0xf06e('0xd')][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x31')](_0x5d6a14);}}else if(this['telephones'][_0x5d6a14[_0xf06e('0x2b')]]){if(this[_0xf06e('0xe')][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x24')]!==_0x5d6a14[_0xf06e('0x24')]['toLowerCase']()){this['telephones'][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x2f')]=_[_0xf06e('0x30')](moment()[_0xf06e('0x27')]('x'));}this[_0xf06e('0xe')][_0x5d6a14['device']][_0xf06e('0x24')]=_0x5d6a14['state'][_0xf06e('0x2d')]();this[_0xf06e('0x1f')](util[_0xf06e('0x27')](_0xf06e('0x32'),this['telephones'][_0x5d6a14[_0xf06e('0x2b')]][_0xf06e('0x33')]),_0xf06e('0x34'),this[_0xf06e('0xe')][_0x5d6a14[_0xf06e('0x2b')]]);}else if(this[_0xf06e('0xc')][_0x5d6a14['device']]){if(this[_0xf06e('0xc')][_0x5d6a14[_0xf06e('0x2b')]]['state']!==_0x5d6a14[_0xf06e('0x24')][_0xf06e('0x2d')]()){this[_0xf06e('0xc')][_0x5d6a14[_0xf06e('0x2b')]]['stateTime']=_[_0xf06e('0x30')](moment()[_0xf06e('0x27')]('x'));}this[_0xf06e('0xc')][_0x5d6a14[_0xf06e('0x2b')]]['state']=_0x5d6a14['state']['toLowerCase']();this[_0xf06e('0x1f')](util['format'](_0xf06e('0x28'),this[_0xf06e('0xc')][_0x5d6a14['device']][_0xf06e('0x33')]),_0xf06e('0x35'),this['trunks'][_0x5d6a14[_0xf06e('0x2b')]]);}else if(_[_0xf06e('0x36')](_0x5d6a14[_0xf06e('0x2b')],'Queue')){}else if(_[_0xf06e('0x36')](_0x5d6a14[_0xf06e('0x2b')],'Local')){var _0x23c0fb=_0x5d6a14[_0xf06e('0x2b')];var _0x3075e3=_0x23c0fb['substring'](_0x23c0fb[_0xf06e('0x37')]('/')+0x1,_0x23c0fb['indexOf']('@'));var _0x312934=_[_0xf06e('0x21')](this['agents'],function(_0x5c01cc){return _0x5c01cc['mobile']==_0x3075e3||_0x5c01cc[_0xf06e('0x38')]==_0x3075e3||_0x5c01cc[_0xf06e('0x39')]==_0x3075e3;});if(_0x312934){if(_0x312934['state']!==_0x5d6a14[_0xf06e('0x24')][_0xf06e('0x2d')]()){_0x312934['stateTime']=_[_0xf06e('0x30')](moment()['format']('x'));}_0x312934[_0xf06e('0x24')]=_0x5d6a14['state'][_0xf06e('0x2d')]();_0x312934['local']=!![];_0x312934[_0xf06e('0x31')](_0x5d6a14);}}else{}}}catch(_0x37110c){logger[_0xf06e('0x1c')](_0xf06e('0x3a'),util['inspect'](_0x37110c,{'showHidden':![],'depth':null}));}};UserReport[_0xf06e('0x1e')][_0xf06e('0x15')]=function(_0x25c389){try{if(this[_0xf06e('0x20')](_0x25c389)&&this[_0xf06e('0x20')](_0x25c389[_0xf06e('0x14')])){if(this[_0xf06e('0xd')][_0x25c389[_0xf06e('0x3b')]]){if(!this[_0xf06e('0xd')][_0x25c389['peer']]['local']||_0x25c389['peerstatus']['toLowerCase']()=='registered'){this[_0xf06e('0xd')][_0x25c389[_0xf06e('0x3b')]]['local']=![];this[_0xf06e('0xd')][_0x25c389[_0xf06e('0x3b')]][_0xf06e('0x3c')]=_0x25c389[_0xf06e('0x14')][_0xf06e('0x2d')]();this[_0xf06e('0xd')][_0x25c389[_0xf06e('0x3b')]][_0xf06e('0x3d')]=_0x25c389[_0xf06e('0x3d')];this[_0xf06e('0xd')][_0x25c389[_0xf06e('0x3b')]][_0xf06e('0x31')](_0x25c389);}}else if(this[_0xf06e('0xe')][_0x25c389[_0xf06e('0x3b')]]){this[_0xf06e('0xe')][_0x25c389[_0xf06e('0x3b')]][_0xf06e('0x3c')]=_0x25c389[_0xf06e('0x14')][_0xf06e('0x2d')]();this[_0xf06e('0xe')][_0x25c389['peer']][_0xf06e('0x3d')]=_0x25c389['address'];this[_0xf06e('0x1f')](util[_0xf06e('0x27')](_0xf06e('0x32'),this['telephones'][_0x25c389[_0xf06e('0x3b')]][_0xf06e('0x33')]),'telephone:save',this['telephones'][_0x25c389[_0xf06e('0x3b')]]);}else if(this[_0xf06e('0xc')][_0x25c389[_0xf06e('0x3b')]]){this[_0xf06e('0xc')][_0x25c389['peer']][_0xf06e('0x3c')]=_0x25c389[_0xf06e('0x14')]['toLowerCase']();this[_0xf06e('0xc')][_0x25c389[_0xf06e('0x3b')]][_0xf06e('0x3d')]=_0x25c389[_0xf06e('0x3d')];this['emit'](util[_0xf06e('0x27')](_0xf06e('0x28'),this[_0xf06e('0xc')][_0x25c389['peer']][_0xf06e('0x33')]),_0xf06e('0x35'),this[_0xf06e('0xc')][_0x25c389['peer']]);}else{}}}catch(_0x58b9a7){logger[_0xf06e('0x1c')](_0xf06e('0x3e'),util['inspect'](_0x58b9a7,{'showHidden':![],'depth':null}));}};module[_0xf06e('0x3f')]=UserReport; \ No newline at end of file +var _0x76b1=['local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','telephone:save','startsWith','Local','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','telephone:%s','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','bind','registry','peerstatus','syncPeerStatus','loopSyncRealTimeShow','actionSipShowRegistry','then','actionDeviceStateList','catch','[loopSyncRealTimeShow]','inspect','prototype','resolve','actionSipPeerStatus','isNotNull','emit','syncRegistry','find','username','state','omit','event','actionid','format','trunk:%s','name','trunk:save','error','syncDeviceState','device'];(function(_0x19228b,_0x59c980){var _0x24c8d1=function(_0x33030e){while(--_0x33030e){_0x19228b['push'](_0x19228b['shift']());}};_0x24c8d1(++_0x59c980);}(_0x76b1,0xd3));var _0x176b=function(_0x19afbd,_0xa60ef9){_0x19afbd=_0x19afbd-0x0;var _0x2aa191=_0x76b1[_0x19afbd];return _0x2aa191;};'use strict';var _=require(_0x176b('0x0'));var moment=require(_0x176b('0x1'));var BPromise=require(_0x176b('0x2'));var util=require(_0x176b('0x3'));var Redis=require(_0x176b('0x4'));var config=require(_0x176b('0x5'));var logger=require('../../../config/logger')(_0x176b('0x6'));var ami=require(_0x176b('0x7'));config[_0x176b('0x8')]=_[_0x176b('0x9')](config[_0x176b('0x8')],{'host':_0x176b('0xa'),'port':0x18eb});var io=require(_0x176b('0xb'))(new Redis(config[_0x176b('0x8')]));function UserReport(_0x8fa00d){this['trunks']=_0x8fa00d[_0x176b('0xc')];this[_0x176b('0xd')]=_0x8fa00d[_0x176b('0xd')];this[_0x176b('0xe')]=_0x8fa00d[_0x176b('0xe')];ami['on']('registryentry',this['syncRegistry'][_0x176b('0xf')](this));ami['on'](_0x176b('0x10'),this['syncRegistry'][_0x176b('0xf')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x176b('0xf')](this));ami['on'](_0x176b('0x11'),this[_0x176b('0x12')][_0x176b('0xf')](this));this[_0x176b('0x13')]();return BPromise['resolve']()['then'](ami[_0x176b('0x14')]())[_0x176b('0x15')](ami[_0x176b('0x16')]())[_0x176b('0x15')](ami['actionSipPeerStatus']())[_0x176b('0x17')](loggerCatch(_0x176b('0x18')));}function loggerCatch(_0x380ecc){return function(_0x434754){logger['error'](_0x380ecc,util[_0x176b('0x19')](_0x434754,{'showHidden':![],'depth':null}));};}UserReport[_0x176b('0x1a')][_0x176b('0x13')]=function(){setInterval(function(){BPromise[_0x176b('0x1b')]()[_0x176b('0x15')](ami['actionSipShowRegistry']())[_0x176b('0x15')](ami[_0x176b('0x16')]())[_0x176b('0x15')](ami[_0x176b('0x1c')]())[_0x176b('0x17')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x176b('0x1a')][_0x176b('0x1d')]=function(_0x436d5a){return _0x436d5a!==null&&!_['isUndefined'](_0x436d5a);};UserReport[_0x176b('0x1a')][_0x176b('0x1e')]=function(_0x5bfff6,_0x552a89,_0x1d4e46){io['to'](_0x5bfff6)[_0x176b('0x1e')](_0x552a89,_0x1d4e46);};UserReport[_0x176b('0x1a')][_0x176b('0x1f')]=function(_0x6fc897){try{if(this[_0x176b('0x1d')](_0x6fc897)){var _0x11f4d2=_[_0x176b('0x20')](this[_0x176b('0xc')],{'registry':_0x6fc897[_0x176b('0x21')]});if(_0x11f4d2){_0x6fc897['stateRegistry']=_0x6fc897[_0x176b('0x22')];_['merge'](_0x11f4d2,_[_0x176b('0x23')](_0x6fc897,[_0x176b('0x24'),_0x176b('0x25'),_0x176b('0x21'),_0x176b('0x22')]));this[_0x176b('0x1e')](util[_0x176b('0x26')](_0x176b('0x27'),_0x11f4d2[_0x176b('0x28')]),_0x176b('0x29'),_0x11f4d2);}}}catch(_0x4b1e67){logger[_0x176b('0x2a')]('[syncRegistry][UserReport]',util[_0x176b('0x19')](_0x4b1e67,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x176b('0x2b')]=function(_0x449545){try{if(this[_0x176b('0x1d')](_0x449545)){if(this[_0x176b('0xd')][_0x449545['device']]){if(!this[_0x176b('0xd')][_0x449545[_0x176b('0x2c')]][_0x176b('0x2d')]||_0x449545['state'][_0x176b('0x2e')]()==_0x176b('0x2f')){this[_0x176b('0xd')][_0x449545[_0x176b('0x2c')]][_0x176b('0x2d')]=![];if(this[_0x176b('0xd')][_0x449545[_0x176b('0x2c')]][_0x176b('0x22')]!==_0x449545[_0x176b('0x22')][_0x176b('0x2e')]()){this['agents'][_0x449545[_0x176b('0x2c')]][_0x176b('0x30')]=_['toNumber'](moment()[_0x176b('0x26')]('x'));}this[_0x176b('0xd')][_0x449545[_0x176b('0x2c')]][_0x176b('0x22')]=_0x449545[_0x176b('0x22')][_0x176b('0x2e')]();this[_0x176b('0xd')][_0x449545[_0x176b('0x2c')]][_0x176b('0x31')](_0x449545);}}else if(this['telephones'][_0x449545['device']]){if(this['telephones'][_0x449545[_0x176b('0x2c')]][_0x176b('0x22')]!==_0x449545[_0x176b('0x22')][_0x176b('0x2e')]()){this[_0x176b('0xe')][_0x449545[_0x176b('0x2c')]][_0x176b('0x30')]=_[_0x176b('0x32')](moment()['format']('x'));}this[_0x176b('0xe')][_0x449545[_0x176b('0x2c')]][_0x176b('0x22')]=_0x449545[_0x176b('0x22')][_0x176b('0x2e')]();this['emit'](util[_0x176b('0x26')]('telephone:%s',this[_0x176b('0xe')][_0x449545['device']][_0x176b('0x28')]),_0x176b('0x33'),this[_0x176b('0xe')][_0x449545[_0x176b('0x2c')]]);}else if(this['trunks'][_0x449545[_0x176b('0x2c')]]){if(this[_0x176b('0xc')][_0x449545[_0x176b('0x2c')]]['state']!==_0x449545[_0x176b('0x22')][_0x176b('0x2e')]()){this['trunks'][_0x449545[_0x176b('0x2c')]][_0x176b('0x30')]=_['toNumber'](moment()[_0x176b('0x26')]('x'));}this[_0x176b('0xc')][_0x449545[_0x176b('0x2c')]][_0x176b('0x22')]=_0x449545['state'][_0x176b('0x2e')]();this[_0x176b('0x1e')](util['format']('trunk:%s',this[_0x176b('0xc')][_0x449545[_0x176b('0x2c')]][_0x176b('0x28')]),_0x176b('0x29'),this[_0x176b('0xc')][_0x449545[_0x176b('0x2c')]]);}else if(_[_0x176b('0x34')](_0x449545[_0x176b('0x2c')],'Queue')){}else if(_[_0x176b('0x34')](_0x449545[_0x176b('0x2c')],_0x176b('0x35'))){var _0x11316a=_0x449545['device'];var _0x128df6=_0x11316a['substring'](_0x11316a['indexOf']('/')+0x1,_0x11316a['indexOf']('@'));var _0x544518=_[_0x176b('0x20')](this[_0x176b('0xd')],function(_0x10a87e){return _0x10a87e[_0x176b('0x36')]==_0x128df6||_0x10a87e[_0x176b('0x37')]==_0x128df6||_0x10a87e[_0x176b('0x38')]==_0x128df6;});if(_0x544518){if(_0x544518[_0x176b('0x22')]!==_0x449545['state']['toLowerCase']()){_0x544518[_0x176b('0x30')]=_[_0x176b('0x32')](moment()[_0x176b('0x26')]('x'));}_0x544518[_0x176b('0x22')]=_0x449545[_0x176b('0x22')][_0x176b('0x2e')]();_0x544518[_0x176b('0x2d')]=!![];_0x544518[_0x176b('0x31')](_0x449545);}}else{}}}catch(_0x1b04fe){logger['error'](_0x176b('0x39'),util[_0x176b('0x19')](_0x1b04fe,{'showHidden':![],'depth':null}));}};UserReport[_0x176b('0x1a')][_0x176b('0x12')]=function(_0x350ef7){try{if(this[_0x176b('0x1d')](_0x350ef7)&&this['isNotNull'](_0x350ef7['peerstatus'])){if(this[_0x176b('0xd')][_0x350ef7[_0x176b('0x3a')]]){if(!this[_0x176b('0xd')][_0x350ef7['peer']][_0x176b('0x2d')]||_0x350ef7[_0x176b('0x11')][_0x176b('0x2e')]()==_0x176b('0x3b')){this[_0x176b('0xd')][_0x350ef7['peer']][_0x176b('0x2d')]=![];this[_0x176b('0xd')][_0x350ef7['peer']][_0x176b('0x3c')]=_0x350ef7[_0x176b('0x11')]['toLowerCase']();this[_0x176b('0xd')][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x3d')]=_0x350ef7[_0x176b('0x3d')];this[_0x176b('0xd')][_0x350ef7[_0x176b('0x3a')]]['updateStatusRealtime'](_0x350ef7);}}else if(this[_0x176b('0xe')][_0x350ef7[_0x176b('0x3a')]]){this[_0x176b('0xe')][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x3c')]=_0x350ef7[_0x176b('0x11')][_0x176b('0x2e')]();this['telephones'][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x3d')]=_0x350ef7['address'];this['emit'](util[_0x176b('0x26')](_0x176b('0x3e'),this[_0x176b('0xe')][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x28')]),_0x176b('0x33'),this[_0x176b('0xe')][_0x350ef7['peer']]);}else if(this[_0x176b('0xc')][_0x350ef7['peer']]){this[_0x176b('0xc')][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x3c')]=_0x350ef7[_0x176b('0x11')][_0x176b('0x2e')]();this[_0x176b('0xc')][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x3d')]=_0x350ef7[_0x176b('0x3d')];this[_0x176b('0x1e')](util[_0x176b('0x26')]('trunk:%s',this[_0x176b('0xc')][_0x350ef7[_0x176b('0x3a')]][_0x176b('0x28')]),_0x176b('0x29'),this['trunks'][_0x350ef7['peer']]);}else{}}}catch(_0x19e89d){logger[_0x176b('0x2a')]('[syncPeerStatus][UserReport]',util['inspect'](_0x19e89d,{'showHidden':![],'depth':null}));}};module[_0x176b('0x3f')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index daff9ec..a4d4f8f 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 _0x7423=['[syncMusicOnHoldStop][VoiceAgentReport]','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','queuecallerabandon','agentcomplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','isUndefined','prototype','isNotNull','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','omit','event','privilege','custom:agentcalled','format','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','pick','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','hasOwnProperty','agentconnectAt','complete','talktime','agent','acw','agentacw','acwtime','interface','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','includes','transfer','agentcompleteAt','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]'];(function(_0x5aa4cc,_0x49d641){var _0x52b505=function(_0x5c521e){while(--_0x5c521e){_0x5aa4cc['push'](_0x5aa4cc['shift']());}};_0x52b505(++_0x49d641);}(_0x7423,0x1e9));var _0x3742=function(_0x38d051,_0x548ae2){_0x38d051=_0x38d051-0x0;var _0x2d0fb1=_0x7423[_0x38d051];return _0x2d0fb1;};'use strict';var _=require('lodash');var moment=require(_0x3742('0x0'));var util=require(_0x3742('0x1'));var Redis=require(_0x3742('0x2'));var config=require(_0x3742('0x3'));var logger=require(_0x3742('0x4'))(_0x3742('0x5'));var ami=require(_0x3742('0x6'));config[_0x3742('0x7')]=_[_0x3742('0x8')](config[_0x3742('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3742('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x126b1f){this[_0x3742('0xa')]={};this['voiceQueues']=_0x126b1f[_0x3742('0xb')];this[_0x3742('0xc')]=_0x126b1f[_0x3742('0xc')];this[_0x3742('0xd')]={};ami['on']('agentcalled',this[_0x3742('0xe')]['bind'](this));ami['on'](_0x3742('0xf'),this[_0x3742('0x10')]['bind'](this));ami['on'](_0x3742('0x11'),this[_0x3742('0x12')][_0x3742('0x13')](this));ami['on'](_0x3742('0x14'),this['syncQueueCallerAbandon'][_0x3742('0x13')](this));ami['on'](_0x3742('0x15'),this['syncAgentComplete'][_0x3742('0x13')](this));ami['on']('varset',this[_0x3742('0x16')]['bind'](this));ami['on'](_0x3742('0x17'),this[_0x3742('0x18')][_0x3742('0x13')](this));ami['on'](_0x3742('0x19'),this[_0x3742('0x1a')][_0x3742('0x13')](this));ami['on'](_0x3742('0x1b'),this[_0x3742('0x1c')]['bind'](this));ami['on'](_0x3742('0x1d'),this[_0x3742('0x1e')][_0x3742('0x13')](this));ami['on']('blindtransfer',this[_0x3742('0x1f')]['bind'](this));}VoiceAgentReport['prototype'][_0x3742('0x20')]=function(_0x277812,_0x3a75f7,_0x120ac1){io['to'](_0x277812)[_0x3742('0x20')](_0x3a75f7,_0x120ac1);};VoiceAgentReport['prototype']['isNotNull']=function(_0x538e40){return _0x538e40!==null&&!_[_0x3742('0x21')](_0x538e40);};VoiceAgentReport[_0x3742('0x22')]['syncAgentCalled']=function(_0x74fae5){try{if(this[_0x3742('0x23')](_0x74fae5)){if(_[_0x3742('0x21')](this['channels'][_0x74fae5[_0x3742('0x24')]])){this[_0x3742('0xa')][_0x74fae5[_0x3742('0x24')]]={};}if(_[_0x3742('0x21')](this[_0x3742('0xa')][_0x74fae5[_0x3742('0x24')]][_0x74fae5[_0x3742('0x25')]])){this[_0x3742('0xa')][_0x74fae5[_0x3742('0x24')]][_0x74fae5[_0x3742('0x25')]]={'agentcalledAt':moment()['format'](_0x3742('0x26')),'lastevent':_0x3742('0x27'),'variables':this[_0x3742('0xd')][_0x74fae5[_0x3742('0x24')]],'type':this[_0x3742('0xb')][_0x74fae5[_0x3742('0x28')]]?this[_0x3742('0xb')][_0x74fae5[_0x3742('0x28')]]['type']||_0x3742('0x29'):_0x3742('0x29')};}_['merge'](this[_0x3742('0xa')][_0x74fae5[_0x3742('0x24')]][_0x74fae5['destuniqueid']],_[_0x3742('0x2a')](_0x74fae5,[_0x3742('0x2b'),_0x3742('0x2c')]));ami[_0x3742('0x20')](_0x3742('0x2d'),this[_0x3742('0xa')][_0x74fae5[_0x3742('0x24')]][_0x74fae5['destuniqueid']]);this[_0x3742('0x20')](util[_0x3742('0x2e')]('user:%s',_0x74fae5[_0x3742('0x2f')]),_0x3742('0x30'),this[_0x3742('0xa')][_0x74fae5[_0x3742('0x24')]][_0x74fae5[_0x3742('0x25')]]);}}catch(_0x3ecb4b){logger['error'](_0x3742('0x31'),util[_0x3742('0x32')](_0x3ecb4b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x406144){try{if(this[_0x3742('0x23')](_0x406144)){if(this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]]){for(var _0x51e361 in this['channels'][_0x406144[_0x3742('0x24')]]){if(this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]]['hasOwnProperty'](_0x51e361)){if(_0x406144[_0x3742('0x25')]===_0x51e361){this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361]['agentconnectAt']=moment()[_0x3742('0x2e')](_0x3742('0x26'));this['channels'][_0x406144['uniqueid']][_0x51e361][_0x3742('0x33')]=_0x3742('0x34');this['channels'][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x35')]=_0x406144['holdtime'];this['channels'][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x36')]=_0x406144[_0x3742('0x36')];this[_0x3742('0xa')][_0x406144['uniqueid']][_0x51e361]['connectedlinename']=_0x406144[_0x3742('0x37')];this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x38')]=_0x406144[_0x3742('0x38')];this[_0x3742('0xa')][_0x406144['uniqueid']][_0x51e361][_0x3742('0x39')]=_0x406144[_0x3742('0x39')];_[_0x3742('0x3a')](this[_0x3742('0xc')][_0x406144['interface']],_[_0x3742('0x3b')](_0x406144,[_0x3742('0x28'),'destconnectedlinenum']));this[_0x3742('0x20')](util[_0x3742('0x2e')](_0x3742('0x3c'),_0x406144['membername']),_0x3742('0x3d'),this['channels'][_0x406144[_0x3742('0x24')]][_0x406144[_0x3742('0x25')]]);ami['emit']('custom:agentconnect',this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361]);}else if(!this['channels'][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x11')]&&!this['channels'][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x15')]){this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361]['agentringnoanswer']=!![];this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x3e')]=moment()[_0x3742('0x2e')](_0x3742('0x26'));this['channels'][_0x406144[_0x3742('0x24')]][_0x51e361][_0x3742('0x3f')]=_0x3742('0x40');this['channels'][_0x406144[_0x3742('0x24')]][_0x51e361]['lastevent']=_0x3742('0x40');this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361]['answeredelsewheredestinationuniqueid']=_0x406144[_0x3742('0x25')];this[_0x3742('0xa')][_0x406144[_0x3742('0x24')]][_0x51e361]['answeredelsewheremembername']=_0x406144[_0x3742('0x2f')];ami['emit'](_0x3742('0x41'),this[_0x3742('0xa')][_0x406144['uniqueid']][_0x51e361]);}}}}}}catch(_0x173e3){logger[_0x3742('0x42')](_0x3742('0x43'),util[_0x3742('0x32')](_0x173e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')]['syncAgentRingNoAnswer']=function(_0x2a63be){try{if(this['isNotNull'](_0x2a63be)){if(this[_0x3742('0xa')][_0x2a63be['uniqueid']]&&this[_0x3742('0xa')][_0x2a63be[_0x3742('0x24')]][_0x2a63be[_0x3742('0x25')]]){this[_0x3742('0xa')][_0x2a63be[_0x3742('0x24')]][_0x2a63be[_0x3742('0x25')]][_0x3742('0x11')]=!![];this['channels'][_0x2a63be[_0x3742('0x24')]][_0x2a63be['destuniqueid']][_0x3742('0x3e')]=moment()['format'](_0x3742('0x26'));this[_0x3742('0xa')][_0x2a63be[_0x3742('0x24')]][_0x2a63be[_0x3742('0x25')]][_0x3742('0x3f')]=_0x3742('0x44');this['channels'][_0x2a63be[_0x3742('0x24')]][_0x2a63be['destuniqueid']][_0x3742('0x33')]=_0x3742('0x44');ami[_0x3742('0x20')](_0x3742('0x45'),this[_0x3742('0xa')][_0x2a63be[_0x3742('0x24')]][_0x2a63be[_0x3742('0x25')]]);}}}catch(_0x91e0c5){logger[_0x3742('0x42')](_0x3742('0x46'),util['inspect'](_0x91e0c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')][_0x3742('0x47')]=function(_0x38dfaf){try{if(this['isNotNull'](_0x38dfaf)){if(this[_0x3742('0xa')][_0x38dfaf['uniqueid']]){for(var _0x40c84d in this[_0x3742('0xa')][_0x38dfaf[_0x3742('0x24')]]){if(this['channels'][_0x38dfaf[_0x3742('0x24')]]['hasOwnProperty'](_0x40c84d)&&!this['channels'][_0x38dfaf[_0x3742('0x24')]][_0x40c84d][_0x3742('0x11')]&&!this[_0x3742('0xa')][_0x38dfaf[_0x3742('0x24')]][_0x40c84d][_0x3742('0x15')]){this[_0x3742('0xa')][_0x38dfaf[_0x3742('0x24')]][_0x40c84d][_0x3742('0x11')]=!![];this['channels'][_0x38dfaf['uniqueid']][_0x40c84d][_0x3742('0x3e')]=moment()['format'](_0x3742('0x26'));this[_0x3742('0xa')][_0x38dfaf[_0x3742('0x24')]][_0x40c84d][_0x3742('0x3f')]=_0x3742('0x48');this[_0x3742('0xa')][_0x38dfaf[_0x3742('0x24')]][_0x40c84d]['lastevent']=_0x3742('0x48');ami[_0x3742('0x20')]('custom:agentqueuecallerabandon',this['channels'][_0x38dfaf[_0x3742('0x24')]][_0x40c84d]);}}}}}catch(_0x3f7163){logger[_0x3742('0x42')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x3742('0x32')](_0x3f7163,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')]['syncAgentComplete']=function(_0xf53822){try{if(this[_0x3742('0x23')](_0xf53822)){if(this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]]){for(var _0x345aa6 in this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]]){if(this[_0x3742('0xa')][_0xf53822['uniqueid']][_0x3742('0x49')](_0x345aa6)){if(this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]][_0x345aa6][_0x3742('0x4a')]&&!this['channels'][_0xf53822[_0x3742('0x24')]][_0x345aa6][_0x3742('0x15')]){this[_0x3742('0xa')][_0xf53822['uniqueid']][_0x345aa6][_0x3742('0x15')]=!![];this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]][_0x345aa6]['agentcompleteAt']=moment()[_0x3742('0x2e')](_0x3742('0x26'));this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]][_0x345aa6][_0x3742('0x33')]=_0x3742('0x4b');this['channels'][_0xf53822['uniqueid']][_0x345aa6][_0x3742('0x4c')]=_0xf53822[_0x3742('0x4c')];this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]][_0x345aa6][_0x3742('0x3f')]=_0xf53822['reason']=='transfer'?_0x3742('0x4d'):_0xf53822[_0x3742('0x3f')];if(this['voiceQueues'][_0xf53822['queue']]&&this['voiceQueues'][_0xf53822[_0x3742('0x28')]][_0x3742('0x4e')]){this[_0x3742('0xa')][_0xf53822['uniqueid']][_0x345aa6][_0x3742('0x4f')]=!![];this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]][_0x345aa6][_0x3742('0x50')]=this[_0x3742('0xb')][_0xf53822[_0x3742('0x28')]]['acwTimeout'];}this['agents'][_0xf53822[_0x3742('0x51')]]=_['omit'](this[_0x3742('0xc')][_0xf53822['interface']],[_0x3742('0x28'),'destconnectedlinenum']);this[_0x3742('0x20')](util[_0x3742('0x2e')]('user:%s',_0xf53822[_0x3742('0x2f')]),'user:agentcomplete',this[_0x3742('0xa')][_0xf53822[_0x3742('0x24')]][_0x345aa6]);ami[_0x3742('0x20')](_0x3742('0x52'),this[_0x3742('0xa')][_0xf53822['uniqueid']][_0x345aa6]);}}}}}}catch(_0x21c605){logger[_0x3742('0x42')](_0x3742('0x53'),util[_0x3742('0x32')](_0x21c605,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')][_0x3742('0x16')]=function(_0x5d4881){try{if(this[_0x3742('0x23')](_0x5d4881)){this[_0x3742('0x54')](_0x5d4881['uniqueid'],_[_0x3742('0x55')](_0x5d4881['variable'])[0x0],_0x5d4881[_0x3742('0x56')]);if(this['channels'][_0x5d4881['uniqueid']]){for(var _0x56f0f4 in this[_0x3742('0xa')][_0x5d4881[_0x3742('0x24')]]){if(this[_0x3742('0xa')][_0x5d4881['uniqueid']][_0x3742('0x49')](_0x56f0f4)){if(_[_0x3742('0x21')](this[_0x3742('0xa')][_0x5d4881[_0x3742('0x24')]][_0x56f0f4][_0x3742('0xd')])){this[_0x3742('0xa')][_0x5d4881[_0x3742('0x24')]][_0x56f0f4]['variables']={};}this['channels'][_0x5d4881[_0x3742('0x24')]][_0x56f0f4][_0x3742('0xd')]=this[_0x3742('0xd')][_0x5d4881['uniqueid']];}}}}}catch(_0x3d9c75){logger['error'](_0x3742('0x57'),util[_0x3742('0x32')](_0x3d9c75,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')]['addVariable']=function(_0x2086c7,_0x577b56,_0x370d93){var _0x57b1d4=[_0x3742('0x58'),_0x3742('0x59'),'rtpaudioqosjitter',_0x3742('0x5a'),_0x3742('0x5b'),_0x3742('0x5c'),_0x3742('0x5d'),_0x3742('0x5e'),_0x3742('0x5f'),_0x3742('0x60'),_0x3742('0x61'),_0x3742('0x62'),_0x3742('0x63'),_0x3742('0x64'),'memberinterface',_0x3742('0x65'),_0x3742('0x2f'),'memberpenalty',_0x3742('0x66')];if(!_[_0x3742('0x67')](_0x577b56)&&!_[_0x3742('0x68')](_0x57b1d4,_0x577b56)){if(_[_0x3742('0x21')](this[_0x3742('0xd')][_0x2086c7])){this[_0x3742('0xd')][_0x2086c7]={};}this[_0x3742('0xd')][_0x2086c7][_0x577b56]=_0x370d93;}};VoiceAgentReport[_0x3742('0x22')][_0x3742('0x18')]=function(_0x3ced0e){try{if(this['isNotNull'](_0x3ced0e)){if(this['channels'][_0x3ced0e[_0x3742('0x24')]]){for(var _0x4523b0 in this[_0x3742('0xa')][_0x3ced0e['uniqueid']]){if(this[_0x3742('0xa')][_0x3ced0e['uniqueid']]['hasOwnProperty'](_0x4523b0)){if(this['channels'][_0x3ced0e['uniqueid']][_0x4523b0][_0x3742('0x3f')]==_0x3742('0x69')&&this[_0x3742('0xa')][_0x3ced0e['uniqueid']][_0x4523b0][_0x3742('0x15')]){this[_0x3742('0xa')][_0x3ced0e[_0x3742('0x24')]][_0x4523b0][_0x3742('0x6a')]=moment()[_0x3742('0x2e')](_0x3742('0x26'));}}}ami[_0x3742('0x20')]('custom:voiceAgentReport',_[_0x3742('0x6b')](this[_0x3742('0xa')][_0x3ced0e['uniqueid']]));delete this[_0x3742('0xa')][_0x3ced0e[_0x3742('0x24')]];}if(this[_0x3742('0xd')][_0x3ced0e[_0x3742('0x24')]]){delete this['variables'][_0x3ced0e[_0x3742('0x24')]];}}}catch(_0x2f0938){logger[_0x3742('0x42')](_0x3742('0x6c'),util[_0x3742('0x32')](_0x2f0938,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')]['syncAttendedTransfer']=function(_0x495d58){try{if(this[_0x3742('0x23')](_0x495d58)){if(this[_0x3742('0xa')][_0x495d58[_0x3742('0x6d')]]){for(var _0x19f94d in this[_0x3742('0xa')][_0x495d58[_0x3742('0x6d')]]){if(this[_0x3742('0xa')][_0x495d58[_0x3742('0x6d')]]['hasOwnProperty'](_0x19f94d)){if(_0x495d58['origtransfereruniqueid']===_0x19f94d){var _0x35609e=moment();this['channels'][_0x495d58[_0x3742('0x6d')]][_0x19f94d][_0x3742('0x15')]=!![];this[_0x3742('0xa')][_0x495d58['transfereeuniqueid']][_0x19f94d][_0x3742('0x6a')]=moment()[_0x3742('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3742('0xa')][_0x495d58[_0x3742('0x6d')]][_0x19f94d][_0x3742('0x3f')]=_0x3742('0x69');this[_0x3742('0xa')][_0x495d58[_0x3742('0x6d')]][_0x19f94d][_0x3742('0x33')]=_0x3742('0x4b');this[_0x3742('0xa')][_0x495d58[_0x3742('0x6d')]][_0x19f94d][_0x3742('0x4c')]=_0x35609e[_0x3742('0x6e')](this['channels'][_0x495d58[_0x3742('0x6d')]][_0x19f94d][_0x3742('0x4a')],'seconds');}}}}if(this[_0x3742('0xa')][_0x495d58[_0x3742('0x6f')]]){var _0xf11aca=this[_0x3742('0xa')][_0x495d58['secondtransfereruniqueid']];this['channels'][_0x495d58['secondtransfereruniqueid']]=this[_0x3742('0xa')][_0x495d58['transfereeuniqueid']];this['channels'][_0x495d58[_0x3742('0x6d')]]=_0xf11aca;}}}catch(_0x1c60cf){logger[_0x3742('0x42')](_0x3742('0x70'),util['inspect'](_0x1c60cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')][_0x3742('0x1f')]=function(_0x4b1787){try{if(this[_0x3742('0x23')](_0x4b1787)){if(this['channels'][_0x4b1787['transfereeuniqueid']]){for(var _0x4bdbf4 in this['channels'][_0x4b1787[_0x3742('0x6d')]]){if(this['channels'][_0x4b1787[_0x3742('0x6d')]][_0x3742('0x49')](_0x4bdbf4)){if(_0x4b1787[_0x3742('0x71')]===_0x4bdbf4){var _0x1f788f=moment();this[_0x3742('0xa')][_0x4b1787['transfereeuniqueid']][_0x4bdbf4][_0x3742('0x15')]=!![];this[_0x3742('0xa')][_0x4b1787[_0x3742('0x6d')]][_0x4bdbf4][_0x3742('0x6a')]=_0x1f788f;this[_0x3742('0xa')][_0x4b1787[_0x3742('0x6d')]][_0x4bdbf4][_0x3742('0x3f')]=_0x3742('0x69');this[_0x3742('0xa')][_0x4b1787[_0x3742('0x6d')]][_0x4bdbf4][_0x3742('0x33')]='complete';this[_0x3742('0xa')][_0x4b1787[_0x3742('0x6d')]][_0x4bdbf4][_0x3742('0x4c')]=_0x1f788f[_0x3742('0x6e')](this['channels'][_0x4b1787[_0x3742('0x6d')]][_0x4bdbf4]['agentconnectAt'],_0x3742('0x72'));}}}}}}catch(_0x37031e){logger['error'](_0x3742('0x73'),util[_0x3742('0x32')](_0x37031e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3742('0x22')][_0x3742('0x1a')]=function(_0x347d72){var _0x285868='';try{if(this[_0x3742('0x23')](_0x347d72)){if(_0x347d72[_0x3742('0x74')]){_0x285868=_0x347d72[_0x3742('0x74')][_0x3742('0x75')](0x0,_0x347d72['channel'][_0x3742('0x76')]('-'));if(this[_0x3742('0xc')][_0x285868]){this[_0x3742('0xc')][_0x285868][_0x3742('0x77')]=!![];}}}}catch(_0x1fc2c8){logger['error'](_0x3742('0x78'),util[_0x3742('0x32')](_0x1fc2c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x2eb497){var _0x57f24a='';try{if(this[_0x3742('0x23')](_0x2eb497)){if(_0x2eb497[_0x3742('0x74')]){_0x57f24a=_0x2eb497[_0x3742('0x74')]['substring'](0x0,_0x2eb497[_0x3742('0x74')][_0x3742('0x76')]('-'));if(this[_0x3742('0xc')][_0x57f24a]){this[_0x3742('0xc')][_0x57f24a][_0x3742('0x77')]=![];}}}}catch(_0x1c2770){logger[_0x3742('0x42')](_0x3742('0x79'),util[_0x3742('0x32')](_0x1c2770,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x06d0=['variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','transfer','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','substring','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','syncAgentCalled','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','event','privilege','custom:agentcalled','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','agentcompleteAt','complete','talktime','agent','acw','agentacw','acwtime','acwTimeout','user:%s','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x06d0,0x1a8));var _0x006d=function(_0x21d5d2,_0x5e1d0b){_0x21d5d2=_0x21d5d2-0x0;var _0x5bac7c=_0x06d0[_0x21d5d2];return _0x5bac7c;};'use strict';var _=require(_0x006d('0x0'));var moment=require(_0x006d('0x1'));var util=require(_0x006d('0x2'));var Redis=require(_0x006d('0x3'));var config=require(_0x006d('0x4'));var logger=require(_0x006d('0x5'))('ami');var ami=require(_0x006d('0x6'));config[_0x006d('0x7')]=_[_0x006d('0x8')](config[_0x006d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x006d('0x7')]));function VoiceAgentReport(_0x36f9c2){this[_0x006d('0x9')]={};this[_0x006d('0xa')]=_0x36f9c2[_0x006d('0xa')];this['agents']=_0x36f9c2[_0x006d('0xb')];this[_0x006d('0xc')]={};ami['on'](_0x006d('0xd'),this['syncAgentCalled'][_0x006d('0xe')](this));ami['on'](_0x006d('0xf'),this[_0x006d('0x10')][_0x006d('0xe')](this));ami['on'](_0x006d('0x11'),this[_0x006d('0x12')]['bind'](this));ami['on'](_0x006d('0x13'),this[_0x006d('0x14')][_0x006d('0xe')](this));ami['on'](_0x006d('0x15'),this[_0x006d('0x16')][_0x006d('0xe')](this));ami['on'](_0x006d('0x17'),this['syncVarSet'][_0x006d('0xe')](this));ami['on']('hangup',this['syncHangup'][_0x006d('0xe')](this));ami['on'](_0x006d('0x18'),this[_0x006d('0x19')]['bind'](this));ami['on'](_0x006d('0x1a'),this[_0x006d('0x1b')]['bind'](this));ami['on'](_0x006d('0x1c'),this['syncAttendedTransfer'][_0x006d('0xe')](this));ami['on'](_0x006d('0x1d'),this[_0x006d('0x1e')]['bind'](this));}VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x20')]=function(_0x1f79b1,_0x44336b,_0x9cd5d){io['to'](_0x1f79b1)['emit'](_0x44336b,_0x9cd5d);};VoiceAgentReport['prototype'][_0x006d('0x21')]=function(_0x4eefb8){return _0x4eefb8!==null&&!_['isUndefined'](_0x4eefb8);};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x22')]=function(_0x43b5ea){try{if(this[_0x006d('0x21')](_0x43b5ea)){if(_[_0x006d('0x23')](this[_0x006d('0x9')][_0x43b5ea[_0x006d('0x24')]])){this[_0x006d('0x9')][_0x43b5ea['uniqueid']]={};}if(_[_0x006d('0x23')](this['channels'][_0x43b5ea[_0x006d('0x24')]][_0x43b5ea['destuniqueid']])){this['channels'][_0x43b5ea['uniqueid']][_0x43b5ea[_0x006d('0x25')]]={'agentcalledAt':moment()[_0x006d('0x26')](_0x006d('0x27')),'lastevent':_0x006d('0x28'),'variables':this[_0x006d('0xc')][_0x43b5ea['uniqueid']],'type':this[_0x006d('0xa')][_0x43b5ea[_0x006d('0x29')]]?this[_0x006d('0xa')][_0x43b5ea[_0x006d('0x29')]]['type']||_0x006d('0x2a'):_0x006d('0x2a')};}_[_0x006d('0x2b')](this['channels'][_0x43b5ea[_0x006d('0x24')]][_0x43b5ea['destuniqueid']],_[_0x006d('0x2c')](_0x43b5ea,[_0x006d('0x2d'),_0x006d('0x2e')]));ami[_0x006d('0x20')](_0x006d('0x2f'),this['channels'][_0x43b5ea[_0x006d('0x24')]][_0x43b5ea[_0x006d('0x25')]]);this[_0x006d('0x20')](util[_0x006d('0x26')]('user:%s',_0x43b5ea[_0x006d('0x30')]),_0x006d('0x31'),this['channels'][_0x43b5ea['uniqueid']][_0x43b5ea[_0x006d('0x25')]]);}}catch(_0xb689e3){logger['error'](_0x006d('0x32'),util[_0x006d('0x33')](_0xb689e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x10')]=function(_0xce703d){try{if(this[_0x006d('0x21')](_0xce703d)){if(this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]]){for(var _0x357b8c in this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]]){if(this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x006d('0x34')](_0x357b8c)){if(_0xce703d['destuniqueid']===_0x357b8c){this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x35')]=moment()[_0x006d('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xce703d['uniqueid']][_0x357b8c][_0x006d('0x36')]=_0x006d('0x37');this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c]['holdtime']=_0xce703d[_0x006d('0x38')];this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x39')]=_0xce703d[_0x006d('0x39')];this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x3a')]=_0xce703d[_0x006d('0x3a')];this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x3b')]=_0xce703d['destchannelstate'];this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x3c')]=_0xce703d['destchannelstatedesc'];_['merge'](this[_0x006d('0xb')][_0xce703d[_0x006d('0x3d')]],_[_0x006d('0x3e')](_0xce703d,[_0x006d('0x29'),_0x006d('0x3f')]));this[_0x006d('0x20')](util['format']('user:%s',_0xce703d['membername']),'user:agentconnect',this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0xce703d['destuniqueid']]);ami['emit'](_0x006d('0x40'),this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c]);}else if(!this['channels'][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x11')]&&!this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x15')]){this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c]['agentringnoanswer']=!![];this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x41')]=moment()[_0x006d('0x26')](_0x006d('0x27'));this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x42')]='answered_elsewhere';this[_0x006d('0x9')][_0xce703d['uniqueid']][_0x357b8c]['lastevent']=_0x006d('0x43');this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c]['answeredelsewheredestinationuniqueid']=_0xce703d[_0x006d('0x25')];this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c][_0x006d('0x44')]=_0xce703d['membername'];ami[_0x006d('0x20')](_0x006d('0x45'),this[_0x006d('0x9')][_0xce703d[_0x006d('0x24')]][_0x357b8c]);}}}}}}catch(_0x323b8a){logger[_0x006d('0x46')](_0x006d('0x47'),util[_0x006d('0x33')](_0x323b8a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x12')]=function(_0x29901e){try{if(this['isNotNull'](_0x29901e)){if(this[_0x006d('0x9')][_0x29901e['uniqueid']]&&this[_0x006d('0x9')][_0x29901e['uniqueid']][_0x29901e[_0x006d('0x25')]]){this[_0x006d('0x9')][_0x29901e['uniqueid']][_0x29901e[_0x006d('0x25')]]['agentringnoanswer']=!![];this['channels'][_0x29901e[_0x006d('0x24')]][_0x29901e[_0x006d('0x25')]][_0x006d('0x41')]=moment()['format'](_0x006d('0x27'));this[_0x006d('0x9')][_0x29901e['uniqueid']][_0x29901e[_0x006d('0x25')]][_0x006d('0x42')]=_0x006d('0x48');this[_0x006d('0x9')][_0x29901e[_0x006d('0x24')]][_0x29901e['destuniqueid']][_0x006d('0x36')]=_0x006d('0x48');ami['emit']('custom:agentringnoanswer',this[_0x006d('0x9')][_0x29901e[_0x006d('0x24')]][_0x29901e[_0x006d('0x25')]]);}}}catch(_0x56941b){logger['error'](_0x006d('0x49'),util[_0x006d('0x33')](_0x56941b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')]['syncQueueCallerAbandon']=function(_0x544e9b){try{if(this[_0x006d('0x21')](_0x544e9b)){if(this['channels'][_0x544e9b['uniqueid']]){for(var _0x34a167 in this[_0x006d('0x9')][_0x544e9b[_0x006d('0x24')]]){if(this[_0x006d('0x9')][_0x544e9b[_0x006d('0x24')]]['hasOwnProperty'](_0x34a167)&&!this[_0x006d('0x9')][_0x544e9b['uniqueid']][_0x34a167]['agentringnoanswer']&&!this[_0x006d('0x9')][_0x544e9b[_0x006d('0x24')]][_0x34a167][_0x006d('0x15')]){this[_0x006d('0x9')][_0x544e9b['uniqueid']][_0x34a167][_0x006d('0x11')]=!![];this[_0x006d('0x9')][_0x544e9b[_0x006d('0x24')]][_0x34a167][_0x006d('0x41')]=moment()[_0x006d('0x26')](_0x006d('0x27'));this[_0x006d('0x9')][_0x544e9b[_0x006d('0x24')]][_0x34a167][_0x006d('0x42')]=_0x006d('0x4a');this[_0x006d('0x9')][_0x544e9b['uniqueid']][_0x34a167][_0x006d('0x36')]=_0x006d('0x4a');ami[_0x006d('0x20')]('custom:agentqueuecallerabandon',this[_0x006d('0x9')][_0x544e9b[_0x006d('0x24')]][_0x34a167]);}}}}}catch(_0x19d89c){logger[_0x006d('0x46')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x006d('0x33')](_0x19d89c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x16')]=function(_0x1c66c4){try{if(this[_0x006d('0x21')](_0x1c66c4)){if(this['channels'][_0x1c66c4[_0x006d('0x24')]]){for(var _0x1bdfc5 in this[_0x006d('0x9')][_0x1c66c4['uniqueid']]){if(this['channels'][_0x1c66c4[_0x006d('0x24')]]['hasOwnProperty'](_0x1bdfc5)){if(this[_0x006d('0x9')][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x35')]&&!this['channels'][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x15')]){this['channels'][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x15')]=!![];this['channels'][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x4b')]=moment()[_0x006d('0x26')](_0x006d('0x27'));this[_0x006d('0x9')][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x36')]=_0x006d('0x4c');this[_0x006d('0x9')][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x4d')]=_0x1c66c4[_0x006d('0x4d')];this[_0x006d('0x9')][_0x1c66c4['uniqueid']][_0x1bdfc5][_0x006d('0x42')]=_0x1c66c4['reason']=='transfer'?_0x006d('0x4e'):_0x1c66c4[_0x006d('0x42')];if(this[_0x006d('0xa')][_0x1c66c4[_0x006d('0x29')]]&&this[_0x006d('0xa')][_0x1c66c4['queue']][_0x006d('0x4f')]){this[_0x006d('0x9')][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x50')]=!![];this[_0x006d('0x9')][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5][_0x006d('0x51')]=this['voiceQueues'][_0x1c66c4['queue']][_0x006d('0x52')];}this[_0x006d('0xb')][_0x1c66c4[_0x006d('0x3d')]]=_['omit'](this[_0x006d('0xb')][_0x1c66c4[_0x006d('0x3d')]],[_0x006d('0x29'),'destconnectedlinenum']);this[_0x006d('0x20')](util[_0x006d('0x26')](_0x006d('0x53'),_0x1c66c4[_0x006d('0x30')]),_0x006d('0x54'),this[_0x006d('0x9')][_0x1c66c4['uniqueid']][_0x1bdfc5]);ami[_0x006d('0x20')](_0x006d('0x55'),this[_0x006d('0x9')][_0x1c66c4[_0x006d('0x24')]][_0x1bdfc5]);}}}}}}catch(_0x165552){logger[_0x006d('0x46')](_0x006d('0x56'),util['inspect'](_0x165552,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x57')]=function(_0x488442){try{if(this[_0x006d('0x21')](_0x488442)){this['addVariable'](_0x488442[_0x006d('0x24')],_['keys'](_0x488442[_0x006d('0x58')])[0x0],_0x488442[_0x006d('0x59')]);if(this[_0x006d('0x9')][_0x488442[_0x006d('0x24')]]){for(var _0x252908 in this[_0x006d('0x9')][_0x488442['uniqueid']]){if(this[_0x006d('0x9')][_0x488442[_0x006d('0x24')]]['hasOwnProperty'](_0x252908)){if(_[_0x006d('0x23')](this[_0x006d('0x9')][_0x488442[_0x006d('0x24')]][_0x252908][_0x006d('0xc')])){this[_0x006d('0x9')][_0x488442[_0x006d('0x24')]][_0x252908][_0x006d('0xc')]={};}this[_0x006d('0x9')][_0x488442[_0x006d('0x24')]][_0x252908][_0x006d('0xc')]=this[_0x006d('0xc')][_0x488442[_0x006d('0x24')]];}}}}}catch(_0x392489){logger[_0x006d('0x46')](_0x006d('0x5a'),util['inspect'](_0x392489,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')]['addVariable']=function(_0x2c6566,_0x3eb90d,_0x21bc64){var _0x18bd5a=[_0x006d('0x5b'),_0x006d('0x5c'),'rtpaudioqosjitter',_0x006d('0x5d'),_0x006d('0x5e'),_0x006d('0x5f'),_0x006d('0x60'),_0x006d('0x61'),'sipcallid',_0x006d('0x62'),_0x006d('0x63'),_0x006d('0x64'),'membercalls',_0x006d('0x65'),_0x006d('0x66'),_0x006d('0x67'),'membername',_0x006d('0x68'),_0x006d('0x69')];if(!_[_0x006d('0x6a')](_0x3eb90d)&&!_[_0x006d('0x6b')](_0x18bd5a,_0x3eb90d)){if(_['isUndefined'](this[_0x006d('0xc')][_0x2c6566])){this['variables'][_0x2c6566]={};}this[_0x006d('0xc')][_0x2c6566][_0x3eb90d]=_0x21bc64;}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x6c')]=function(_0x39c654){try{if(this[_0x006d('0x21')](_0x39c654)){if(this[_0x006d('0x9')][_0x39c654[_0x006d('0x24')]]){for(var _0x5d05ee in this['channels'][_0x39c654[_0x006d('0x24')]]){if(this[_0x006d('0x9')][_0x39c654['uniqueid']][_0x006d('0x34')](_0x5d05ee)){if(this[_0x006d('0x9')][_0x39c654[_0x006d('0x24')]][_0x5d05ee]['reason']==_0x006d('0x6d')&&this['channels'][_0x39c654[_0x006d('0x24')]][_0x5d05ee][_0x006d('0x15')]){this[_0x006d('0x9')][_0x39c654[_0x006d('0x24')]][_0x5d05ee]['agentcompleteAt']=moment()[_0x006d('0x26')](_0x006d('0x27'));}}}ami[_0x006d('0x20')](_0x006d('0x6e'),_['values'](this['channels'][_0x39c654[_0x006d('0x24')]]));delete this[_0x006d('0x9')][_0x39c654[_0x006d('0x24')]];}if(this[_0x006d('0xc')][_0x39c654[_0x006d('0x24')]]){delete this[_0x006d('0xc')][_0x39c654[_0x006d('0x24')]];}}}catch(_0x3d1c41){logger[_0x006d('0x46')](_0x006d('0x6f'),util[_0x006d('0x33')](_0x3d1c41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x70')]=function(_0x44e1f6){try{if(this[_0x006d('0x21')](_0x44e1f6)){if(this[_0x006d('0x9')][_0x44e1f6['transfereeuniqueid']]){for(var _0x44e018 in this[_0x006d('0x9')][_0x44e1f6[_0x006d('0x71')]]){if(this[_0x006d('0x9')][_0x44e1f6['transfereeuniqueid']][_0x006d('0x34')](_0x44e018)){if(_0x44e1f6[_0x006d('0x72')]===_0x44e018){var _0x9e40b2=moment();this[_0x006d('0x9')][_0x44e1f6['transfereeuniqueid']][_0x44e018][_0x006d('0x15')]=!![];this['channels'][_0x44e1f6[_0x006d('0x71')]][_0x44e018][_0x006d('0x4b')]=moment()['format'](_0x006d('0x27'));this[_0x006d('0x9')][_0x44e1f6[_0x006d('0x71')]][_0x44e018][_0x006d('0x42')]=_0x006d('0x6d');this['channels'][_0x44e1f6[_0x006d('0x71')]][_0x44e018]['lastevent']='complete';this[_0x006d('0x9')][_0x44e1f6[_0x006d('0x71')]][_0x44e018][_0x006d('0x4d')]=_0x9e40b2[_0x006d('0x73')](this[_0x006d('0x9')][_0x44e1f6['transfereeuniqueid']][_0x44e018]['agentconnectAt'],_0x006d('0x74'));}}}}if(this[_0x006d('0x9')][_0x44e1f6[_0x006d('0x75')]]){var _0x3fa51f=this['channels'][_0x44e1f6[_0x006d('0x75')]];this[_0x006d('0x9')][_0x44e1f6[_0x006d('0x75')]]=this['channels'][_0x44e1f6[_0x006d('0x71')]];this[_0x006d('0x9')][_0x44e1f6[_0x006d('0x71')]]=_0x3fa51f;}}}catch(_0x58af04){logger[_0x006d('0x46')](_0x006d('0x76'),util['inspect'](_0x58af04,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x1e')]=function(_0x574580){try{if(this[_0x006d('0x21')](_0x574580)){if(this[_0x006d('0x9')][_0x574580[_0x006d('0x71')]]){for(var _0x2efb7f in this[_0x006d('0x9')][_0x574580[_0x006d('0x71')]]){if(this['channels'][_0x574580['transfereeuniqueid']][_0x006d('0x34')](_0x2efb7f)){if(_0x574580[_0x006d('0x77')]===_0x2efb7f){var _0x21fba4=moment();this[_0x006d('0x9')][_0x574580[_0x006d('0x71')]][_0x2efb7f]['agentcomplete']=!![];this[_0x006d('0x9')][_0x574580['transfereeuniqueid']][_0x2efb7f][_0x006d('0x4b')]=_0x21fba4;this[_0x006d('0x9')][_0x574580[_0x006d('0x71')]][_0x2efb7f][_0x006d('0x42')]=_0x006d('0x6d');this[_0x006d('0x9')][_0x574580[_0x006d('0x71')]][_0x2efb7f][_0x006d('0x36')]='complete';this[_0x006d('0x9')][_0x574580['transfereeuniqueid']][_0x2efb7f][_0x006d('0x4d')]=_0x21fba4[_0x006d('0x73')](this['channels'][_0x574580[_0x006d('0x71')]][_0x2efb7f][_0x006d('0x35')],_0x006d('0x74'));}}}}}}catch(_0x41781f){logger[_0x006d('0x46')](_0x006d('0x78'),util[_0x006d('0x33')](_0x41781f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')][_0x006d('0x19')]=function(_0x20174a){var _0x4a6cf3='';try{if(this[_0x006d('0x21')](_0x20174a)){if(_0x20174a['channel']){_0x4a6cf3=_0x20174a[_0x006d('0x79')]['substring'](0x0,_0x20174a[_0x006d('0x79')][_0x006d('0x7a')]('-'));if(this[_0x006d('0xb')][_0x4a6cf3]){this['agents'][_0x4a6cf3][_0x006d('0x7b')]=!![];}}}}catch(_0xf8acba){logger[_0x006d('0x46')](_0x006d('0x7c'),util[_0x006d('0x33')](_0xf8acba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x006d('0x1f')]['syncMusicOnHoldStop']=function(_0x3c3e90){var _0x39adc8='';try{if(this[_0x006d('0x21')](_0x3c3e90)){if(_0x3c3e90['channel']){_0x39adc8=_0x3c3e90[_0x006d('0x79')][_0x006d('0x7d')](0x0,_0x3c3e90[_0x006d('0x79')][_0x006d('0x7a')]('-'));if(this[_0x006d('0xb')][_0x39adc8]){this[_0x006d('0xb')][_0x39adc8][_0x006d('0x7b')]=![];}}}}catch(_0x57d939){logger[_0x006d('0x46')](_0x006d('0x7e'),util['inspect'](_0x57d939,{'showHidden':![],'depth':null}));}};module[_0x006d('0x7f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index cd8c453..4fc2990 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 _0x84e6=['lodash','moment','util','../../../config/environment','../ami','../model/channel','unknown','inuse','invalid','ringinuse','onhold','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','keys','error','inspect','channel','starttime','format','YYYY-MM-DD\x20HH:mm:ss','context','from-sip','split','exten','user:%s','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','duration','seconds','disposition','includes','lastdata','startsWith','cdr(','match','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','channelstate','UserId','membername','name','monitor','.wav49','.WAV','monitorFilename','monitors','isNil','push','rec','variable','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','callerid','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','mixmonitor_filename','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','endtime','billableseconds','omit','destconnectedlinenum','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84e6,0x8f));var _0x684e=function(_0x5834e3,_0x420a49){_0x5834e3=_0x5834e3-0x0;var _0x54593d=_0x84e6[_0x5834e3];return _0x54593d;};'use strict';var BPromise=require(_0x684e('0x0'));var _=require(_0x684e('0x1'));var moment=require(_0x684e('0x2'));var util=require(_0x684e('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0x684e('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x684e('0x5'));var Channel=require(_0x684e('0x6'));var statusDesc=[_0x684e('0x7'),'not_inuse',_0x684e('0x8'),'busy',_0x684e('0x9'),'unavailable','ringing',_0x684e('0xa'),_0x684e('0xb')];var applications=[_0x684e('0xc'),_0x684e('0xd'),_0x684e('0xe'),_0x684e('0xf'),_0x684e('0x10'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x684e('0x11'),_0x684e('0x11'),'NO\x20ANSWER',_0x684e('0x12'),_0x684e('0x12'),'ANSWERED',_0x684e('0x13'),'FAILED',_0x684e('0x11'),_0x684e('0x11')];var actions={};config[_0x684e('0x14')]=_[_0x684e('0x15')](config[_0x684e('0x14')],{'host':_0x684e('0x16'),'port':0x18eb});var io=require(_0x684e('0x17'))(new Redis(config[_0x684e('0x14')]));function VoiceCallReport(_0x109281){this[_0x684e('0x18')]=_0x109281[_0x684e('0x18')];this[_0x684e('0x19')]=_0x109281[_0x684e('0x19')];ami['on'](_0x684e('0x1a'),this[_0x684e('0x1b')][_0x684e('0x1c')](this));ami['on'](_0x684e('0x1d'),this[_0x684e('0x1b')]['bind'](this));ami['on']('newchannel',this[_0x684e('0x1e')][_0x684e('0x1c')](this));ami['on']('newstate',this[_0x684e('0x1f')][_0x684e('0x1c')](this));ami['on'](_0x684e('0x20'),this[_0x684e('0x21')]['bind'](this));ami['on'](_0x684e('0x22'),this['syncHangup'][_0x684e('0x1c')](this));ami['on'](_0x684e('0x23'),this[_0x684e('0x24')][_0x684e('0x1c')](this));ami['on'](_0x684e('0x25'),this['syncAttendedTransfer'][_0x684e('0x1c')](this));ami['on'](_0x684e('0x26'),this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this[_0x684e('0x27')][_0x684e('0x1c')](this));ami['on'](_0x684e('0x28'),this[_0x684e('0x29')]['bind'](this));return BPromise[_0x684e('0x2a')]()[_0x684e('0x2b')](ami[_0x684e('0x2c')]())['catch'](function(_0x245f69){console['log'](_0x245f69);});}VoiceCallReport[_0x684e('0x2d')][_0x684e('0x2e')]=function(_0x41002a){return _0x41002a!==null&&!_[_0x684e('0x2f')](_0x41002a);};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x30')]=function(_0x50ee80,_0x2a3d8d,_0x4bf017){io['to'](_0x50ee80)[_0x684e('0x30')](_0x2a3d8d,_0x4bf017);};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x24')]=function(_0x43fae8){try{if(this[_0x684e('0x2e')](_0x43fae8)){if(_0x43fae8[_0x684e('0x31')]===_0x43fae8[_0x684e('0x32')]){if(!_[_0x684e('0x2f')](this['channels'][_0x43fae8[_0x684e('0x31')]])){_[_0x684e('0x33')](this[_0x684e('0x18')][_0x43fae8[_0x684e('0x31')]],_[_0x684e('0x34')](_0x43fae8,_[_0x684e('0x35')](this['channels'][_0x43fae8['uniqueid']])));}}}}catch(_0x5cba48){logger[_0x684e('0x36')]('[syncNewCallerId][VoiceCallReport]',util[_0x684e('0x37')](_0x5cba48,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x1e')]=function(_0x5e9711){try{if(this['isNotNull'](_0x5e9711)){if(_0x5e9711[_0x684e('0x31')]===_0x5e9711['linkedid']&&_0x5e9711[_0x684e('0x38')]!='OutgoingSpoolFailed'){if(_[_0x684e('0x2f')](this[_0x684e('0x18')][_0x5e9711[_0x684e('0x31')]])){this[_0x684e('0x18')][_0x5e9711['uniqueid']]=new Channel();this[_0x684e('0x18')][_0x5e9711[_0x684e('0x31')]][_0x684e('0x39')]=moment()[_0x684e('0x3a')](_0x684e('0x3b'));this['channels'][_0x5e9711[_0x684e('0x31')]]['disposition']=dispositions[_['toNumber'](_0x5e9711['channelstate'])];_[_0x684e('0x33')](this[_0x684e('0x18')][_0x5e9711[_0x684e('0x31')]],_[_0x684e('0x34')](_0x5e9711,_[_0x684e('0x35')](this[_0x684e('0x18')][_0x5e9711[_0x684e('0x31')]])));if(_0x5e9711[_0x684e('0x3c')]===_0x684e('0x3d')){if(this[_0x684e('0x19')][_0x5e9711[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]]){this['agents'][_0x5e9711['channel'][_0x684e('0x3e')]('-')[0x0]]['destconnectedlinenum']=_0x5e9711[_0x684e('0x3f')];this[_0x684e('0x30')](util[_0x684e('0x3a')](_0x684e('0x40'),this[_0x684e('0x19')][_0x5e9711[_0x684e('0x38')]['split']('-')[0x0]]['name']),_0x684e('0x41'),{'destaccountcode':this[_0x684e('0x19')][_0x5e9711[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]][_0x684e('0x42')],'destconnectedlinenum':_0x5e9711[_0x684e('0x3f')]});}}}}}}catch(_0x3f9b57){logger[_0x684e('0x36')](_0x684e('0x43'),util[_0x684e('0x37')](_0x3f9b57,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x684e('0x1b')]=function(_0x4dec8e){try{if(this[_0x684e('0x2e')](_0x4dec8e)){if(_0x4dec8e[_0x684e('0x31')]===_0x4dec8e[_0x684e('0x32')]&&_0x4dec8e[_0x684e('0x3f')]!='h'&&_0x4dec8e[_0x684e('0x38')]!=_0x684e('0x44')){_0x4dec8e[_0x684e('0x45')]=_0x4dec8e[_0x684e('0x45')][_0x684e('0x46')]();_0x4dec8e[_0x684e('0x47')]=(_0x4dec8e['appdata']||_0x4dec8e[_0x684e('0x47')])['toLowerCase']();if(_[_0x684e('0x2f')](this[_0x684e('0x18')][_0x4dec8e[_0x684e('0x31')]])){this['channels'][_0x4dec8e[_0x684e('0x31')]]=new Channel();this[_0x684e('0x18')][_0x4dec8e['uniqueid']][_0x684e('0x39')]=_0x4dec8e['duration']?moment()['subtract'](moment[_0x684e('0x48')](_0x4dec8e[_0x684e('0x48')])[_0x684e('0x49')](),'seconds')[_0x684e('0x3a')](_0x684e('0x3b')):moment()[_0x684e('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x684e('0x18')][_0x4dec8e['uniqueid']][_0x684e('0x4a')]=_0x684e('0x12');}_[_0x684e('0x33')](this[_0x684e('0x18')][_0x4dec8e[_0x684e('0x31')]],_[_0x684e('0x34')](_0x4dec8e,_[_0x684e('0x35')](this['channels'][_0x4dec8e[_0x684e('0x31')]])));if(_[_0x684e('0x4b')](applications,_0x4dec8e[_0x684e('0x45')])){this[_0x684e('0x18')][_0x4dec8e[_0x684e('0x31')]]['lastapplication']=_0x4dec8e['application'];this[_0x684e('0x18')][_0x4dec8e[_0x684e('0x31')]][_0x684e('0x4c')]=_0x4dec8e['applicationdata'];if(_0x4dec8e[_0x684e('0x45')]===_0x684e('0xc')&&_[_0x684e('0x4d')](_0x4dec8e['applicationdata'],_0x684e('0x4e'))){var _0x5dac64=_0x4dec8e[_0x684e('0x47')]['split']('=');var _0x322b76=_0x5dac64[0x0][_0x684e('0x4f')](/cdr\((.*)\)/);if(_0x322b76){this['channels'][_0x4dec8e['uniqueid']][_0x322b76[0x1]]=_0x5dac64[0x1];}}else if(_0x4dec8e['application']===_0x684e('0xd')){this['channels'][_0x4dec8e[_0x684e('0x31')]]['queue']=_0x4dec8e[_0x684e('0x47')]['split'](',')[0x0];}}}}}catch(_0x47f834){logger['error']('[syncNewExten][VoiceCallReport]',util[_0x684e('0x37')](_0x47f834,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x684e('0x2d')]['syncNewState']=function(_0x39a2e2){try{if(this[_0x684e('0x2e')](_0x39a2e2)){if(_0x39a2e2[_0x684e('0x31')]!==_0x39a2e2[_0x684e('0x32')]){if(this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]]){if(_0x39a2e2['channelstate']==='6'){if(!this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x50')]){var _0x46c2e3=moment();this['channels'][_0x39a2e2[_0x684e('0x32')]]['answered']=!![];this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x51')]=_0x46c2e3['format'](_0x684e('0x3b'));if(this['channels'][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x39')]){this['channels'][_0x39a2e2[_0x684e('0x32')]]['holdtime']=_0x46c2e3[_0x684e('0x52')](this['channels'][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x39')],'seconds');}}this[_0x684e('0x18')][_0x39a2e2['linkedid']]['linkedid']=_0x39a2e2[_0x684e('0x31')];if(_0x39a2e2[_0x684e('0x53')]!==_0x684e('0x54')){this['channels'][_0x39a2e2['linkedid']]['connectedlinenum']=_0x39a2e2[_0x684e('0x53')];}this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x55')]=_0x39a2e2[_0x684e('0x56')];this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x57')]=_0x39a2e2[_0x684e('0x38')];this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x4a')]=dispositions[_['toNumber'](_0x39a2e2[_0x684e('0x58')])];if(this['agents'][_0x39a2e2[_0x684e('0x38')]['split']('-')[0x0]]){this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x32')]][_0x684e('0x59')]=this[_0x684e('0x19')][_0x39a2e2[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]]['id'];this[_0x684e('0x18')][_0x39a2e2['linkedid']][_0x684e('0x5a')]=this[_0x684e('0x19')][_0x39a2e2[_0x684e('0x38')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x31')]]){if(_0x39a2e2[_0x684e('0x58')]==='6'){if(this[_0x684e('0x19')][_0x39a2e2[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]]){this[_0x684e('0x18')][_0x39a2e2['uniqueid']]['UserId']=this[_0x684e('0x19')][_0x39a2e2['channel'][_0x684e('0x3e')]('-')[0x0]]['id'];this[_0x684e('0x18')][_0x39a2e2[_0x684e('0x31')]][_0x684e('0x5a')]=this['agents'][_0x39a2e2[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]][_0x684e('0x5b')];}}}}}}catch(_0x3bfa2b){logger[_0x684e('0x36')]('[syncNewState][VoiceCallReport]',util['inspect'](_0x3bfa2b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x684e('0x2d')]['syncMixMonitorFilename']=function(_0x1abeb4,_0x3463c4){if(this['channels'][_0x1abeb4]){this['channels'][_0x1abeb4][_0x684e('0x5c')]=!![];if(_['endsWith'](_0x3463c4,_0x684e('0x5d'))){_0x3463c4=_0x3463c4['replace'](_0x684e('0x5d'),_0x684e('0x5e'));}this[_0x684e('0x18')][_0x1abeb4][_0x684e('0x5f')]=_0x3463c4;var _0x2e2247=_['find'](this[_0x684e('0x18')][_0x1abeb4][_0x684e('0x60')],{'filename':_0x3463c4});if(_[_0x684e('0x61')](_0x2e2247)){this['channels'][_0x1abeb4]['monitors'][_0x684e('0x62')]({'filename':_0x3463c4,'createdAt':moment()['format'](_0x684e('0x3b')),'mixmonitorid':'','status':_0x684e('0x63')});}}};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x21')]=function(_0x5b510c){try{if(this[_0x684e('0x2e')](_0x5b510c)){if(this[_0x684e('0x18')][_0x5b510c['uniqueid']]&&_0x5b510c[_0x684e('0x38')]!='OutgoingSpoolFailed'){if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')])){if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')]['mixmonitor_filename'])){this[_0x684e('0x65')](_0x5b510c[_0x684e('0x31')],_0x5b510c[_0x684e('0x66')]);}else if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')][_0x684e('0x67')])){this['channels'][_0x5b510c['uniqueid']][_0x684e('0x53')]=_0x5b510c[_0x684e('0x66')];}else if(this['isNotNull'](_0x5b510c['variable'][_0x684e('0x68')])){this[_0x684e('0x18')][_0x5b510c[_0x684e('0x31')]][_0x684e('0x69')]=_0x5b510c[_0x684e('0x66')];}else if(this['isNotNull'](_0x5b510c[_0x684e('0x64')]['xmd-cdrtype'])){this[_0x684e('0x18')][_0x5b510c['uniqueid']]['type']=_0x5b510c['value'];}else if(this['isNotNull'](_0x5b510c[_0x684e('0x64')][_0x684e('0x6a')])){this[_0x684e('0x18')][_0x5b510c['uniqueid']][_0x684e('0xd')]=_0x5b510c[_0x684e('0x66')]['split'](',')[0x0];}else if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')][_0x684e('0x6b')])){this['channels'][_0x5b510c[_0x684e('0x31')]][_0x684e('0x6c')]=_0x5b510c['value'];}else if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')]['xmd-destination'])){this['channels'][_0x5b510c[_0x684e('0x31')]][_0x684e('0x6d')]=_0x5b510c[_0x684e('0x66')];}else if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')][_0x684e('0x6e')])){this['channels'][_0x5b510c[_0x684e('0x31')]][_0x684e('0x6f')]=_0x5b510c[_0x684e('0x66')];}else if(this[_0x684e('0x2e')](_0x5b510c['variable'][_0x684e('0x70')])){this['channels'][_0x5b510c[_0x684e('0x31')]][_0x684e('0xd')]=_0x5b510c[_0x684e('0x66')];}else if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')][_0x684e('0x71')])){this[_0x684e('0x18')][_0x5b510c[_0x684e('0x31')]]['sipcalluniqueid']=_0x5b510c[_0x684e('0x66')];}}}else if(this[_0x684e('0x2e')](_0x5b510c['variable'][_0x684e('0x72')])){if(_0x5b510c[_0x684e('0x66')]){var _0x1eae54=path[_0x684e('0x73')](_0x5b510c[_0x684e('0x66')])[_0x684e('0x5b')];this[_0x684e('0x65')](_0x1eae54,_0x5b510c[_0x684e('0x66')]);}}else if(this['channels'][_0x5b510c[_0x684e('0x32')]]){if(this[_0x684e('0x2e')](_0x5b510c[_0x684e('0x64')])){if(this[_0x684e('0x2e')](_0x5b510c['variable'][_0x684e('0x71')])){this[_0x684e('0x18')][_0x5b510c[_0x684e('0x32')]][_0x684e('0x74')]=_0x5b510c[_0x684e('0x66')];}}}}}catch(_0x2b3ea9){logger[_0x684e('0x36')](_0x684e('0x75'),util[_0x684e('0x37')](_0x2b3ea9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x684e('0x76')]=function(_0x2a082b){try{if(this[_0x684e('0x2e')](_0x2a082b)){if(this[_0x684e('0x18')][_0x2a082b[_0x684e('0x31')]]){var _0xbdb1ef=moment();this[_0x684e('0x18')][_0x2a082b[_0x684e('0x31')]][_0x684e('0x77')]=_0xbdb1ef[_0x684e('0x3a')](_0x684e('0x3b'));this[_0x684e('0x18')][_0x2a082b[_0x684e('0x31')]][_0x684e('0x48')]=_0xbdb1ef[_0x684e('0x52')](this['channels'][_0x2a082b[_0x684e('0x31')]][_0x684e('0x39')],_0x684e('0x49'));if(this[_0x684e('0x18')][_0x2a082b['uniqueid']][_0x684e('0x50')]){this['channels'][_0x2a082b[_0x684e('0x31')]][_0x684e('0x78')]=_0xbdb1ef[_0x684e('0x52')](this[_0x684e('0x18')][_0x2a082b['uniqueid']][_0x684e('0x51')],'seconds');this[_0x684e('0x18')][_0x2a082b[_0x684e('0x31')]]['holdtime']=this[_0x684e('0x18')][_0x2a082b[_0x684e('0x31')]]['duration']-this['channels'][_0x2a082b[_0x684e('0x31')]]['billableseconds'];}if(_0x2a082b['context']===_0x684e('0x3d')){if(this['agents'][_0x2a082b[_0x684e('0x38')]['split']('-')[0x0]]){this[_0x684e('0x19')][_0x2a082b[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]]=_[_0x684e('0x79')](this[_0x684e('0x19')][_0x2a082b[_0x684e('0x38')]['split']('-')[0x0]],[_0x684e('0x7a')]);this[_0x684e('0x30')](util[_0x684e('0x3a')]('user:%s',this[_0x684e('0x19')][_0x2a082b[_0x684e('0x38')]['split']('-')[0x0]][_0x684e('0x5b')]),'user:agentcomplete',{'destaccountcode':this[_0x684e('0x19')][_0x2a082b[_0x684e('0x38')][_0x684e('0x3e')]('-')[0x0]][_0x684e('0x42')]});}}ami[_0x684e('0x30')](_0x684e('0x7b'),this[_0x684e('0x18')][_0x2a082b['uniqueid']]);delete this['channels'][_0x2a082b[_0x684e('0x31')]];}}}catch(_0x4c51ae){logger['error'](_0x684e('0x7c'),util[_0x684e('0x37')](_0x4c51ae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x7d')]=function(_0x49f1bf){try{if(this['isNotNull'](_0x49f1bf)){if(this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x7e')]]){this['channels'][_0x49f1bf['transfereeuniqueid']][_0x684e('0x7f')]=_0x49f1bf[_0x684e('0x80')];this['channels'][_0x49f1bf[_0x684e('0x7e')]][_0x684e('0x81')]=_0x49f1bf[_0x684e('0x82')];if(this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x83')]]){var _0x4a977d=this['channels'][_0x49f1bf[_0x684e('0x83')]];this[_0x684e('0x18')][_0x49f1bf['secondtransfereruniqueid']]=this['channels'][_0x49f1bf[_0x684e('0x7e')]];this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x7e')]]=_0x4a977d;}}else if(this['channels'][_0x49f1bf[_0x684e('0x84')]]){this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x84')]][_0x684e('0x7f')]=_0x49f1bf[_0x684e('0x80')];this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x84')]][_0x684e('0x81')]=_0x49f1bf['transfertargetcalleridnum'];if(this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x85')]]){var _0x4a977d=this[_0x684e('0x18')][_0x49f1bf['origtransfereruniqueid']];this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x85')]]=this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x84')]];this[_0x684e('0x18')][_0x49f1bf[_0x684e('0x84')]]=_0x4a977d;}}}}catch(_0x56142d){logger[_0x684e('0x36')](_0x684e('0x86'),util['inspect'](_0x56142d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x87')]=function(_0x3d95a1){try{if(this[_0x684e('0x2e')](_0x3d95a1)){if(this[_0x684e('0x18')][_0x3d95a1[_0x684e('0x7e')]]){this[_0x684e('0x18')][_0x3d95a1[_0x684e('0x7e')]][_0x684e('0x7f')]=_0x3d95a1[_0x684e('0x88')];this['channels'][_0x3d95a1['transfereeuniqueid']]['transferconnectedlinenum']=_0x3d95a1['extension'];this[_0x684e('0x76')]({'event':'BlindTransfer','uniqueid':_0x3d95a1[_0x684e('0x7e')],'context':_0x3d95a1[_0x684e('0x3c')],'channel':_0x3d95a1['transfererchannel']});}}}catch(_0x30301e){logger[_0x684e('0x36')](_0x684e('0x89'),util[_0x684e('0x37')](_0x30301e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x684e('0x2d')][_0x684e('0x27')]=function(_0x1e8b5e){try{if(this['isNotNull'](_0x1e8b5e)){if(this[_0x684e('0x18')][_0x1e8b5e[_0x684e('0x31')]]){if(!_['isNil'](this[_0x684e('0x18')][_0x1e8b5e['uniqueid']][_0x684e('0x51')])){this[_0x684e('0x18')][_0x1e8b5e[_0x684e('0x31')]][_0x684e('0x8a')]=moment()[_0x684e('0x3a')](_0x684e('0x3b'));}}}}catch(_0x1a7b29){logger[_0x684e('0x36')](_0x684e('0x8b'),util[_0x684e('0x37')](_0x1a7b29,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x684e('0x29')]=function(_0x2f1c7e){try{if(this[_0x684e('0x2e')](_0x2f1c7e)){if(this[_0x684e('0x18')][_0x2f1c7e['uniqueid']]){if(!_[_0x684e('0x61')](this['channels'][_0x2f1c7e[_0x684e('0x31')]][_0x684e('0x8a')])){this[_0x684e('0x18')][_0x2f1c7e[_0x684e('0x31')]][_0x684e('0x8c')]+=moment()[_0x684e('0x8d')](0x0)[_0x684e('0x52')](this[_0x684e('0x18')][_0x2f1c7e[_0x684e('0x31')]][_0x684e('0x8a')],_0x684e('0x49'));delete this[_0x684e('0x18')][_0x2f1c7e[_0x684e('0x31')]][_0x684e('0x8a')];}}}}catch(_0x4a3763){logger[_0x684e('0x36')](_0x684e('0x8e'),util[_0x684e('0x37')](_0x4a3763,{'showHidden':![],'depth':null}));}};module[_0x684e('0x8f')]=VoiceCallReport; \ No newline at end of file +var _0x2a61=['invalid','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','catch','log','prototype','isUndefined','emit','isNotNull','uniqueid','linkedid','merge','pick','keys','[syncNewCallerId][VoiceCallReport]','inspect','syncNewChannel','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','exten','user:%s','name','accountcode','error','appdata','applicationdata','toLowerCase','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','rec','variable','mixmonitor_filename','value','callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcallid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','omit','destconnectedlinenum','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','syncBlindTransfer','transfereecalleridnum','extension','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','unknown','not_inuse','inuse','busy'];(function(_0x1ae355,_0x1a004a){var _0x79dba0=function(_0x4bd44f){while(--_0x4bd44f){_0x1ae355['push'](_0x1ae355['shift']());}};_0x79dba0(++_0x1a004a);}(_0x2a61,0x126));var _0x12a6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2a61[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x12a6('0x0'));var _=require('lodash');var moment=require(_0x12a6('0x1'));var util=require(_0x12a6('0x2'));var path=require(_0x12a6('0x3'));var Redis=require(_0x12a6('0x4'));var config=require(_0x12a6('0x5'));var logger=require(_0x12a6('0x6'))(_0x12a6('0x7'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0x12a6('0x8'),_0x12a6('0x9'),_0x12a6('0xa'),_0x12a6('0xb'),_0x12a6('0xc'),'unavailable',_0x12a6('0xd'),_0x12a6('0xe'),_0x12a6('0xf')];var applications=[_0x12a6('0x10'),_0x12a6('0x11'),_0x12a6('0x12'),_0x12a6('0x13'),'playback',_0x12a6('0x14')];var dispositions=[_0x12a6('0x15'),_0x12a6('0x16'),_0x12a6('0x16'),'NO\x20ANSWER',_0x12a6('0x15'),_0x12a6('0x15'),_0x12a6('0x17'),_0x12a6('0x18'),_0x12a6('0x16'),_0x12a6('0x16'),_0x12a6('0x16')];var actions={};config[_0x12a6('0x19')]=_[_0x12a6('0x1a')](config['redis'],{'host':_0x12a6('0x1b'),'port':0x18eb});var io=require(_0x12a6('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0xc6cdc6){this[_0x12a6('0x1d')]=_0xc6cdc6['channels'];this[_0x12a6('0x1e')]=_0xc6cdc6[_0x12a6('0x1e')];ami['on'](_0x12a6('0x1f'),this[_0x12a6('0x20')][_0x12a6('0x21')](this));ami['on'](_0x12a6('0x22'),this[_0x12a6('0x20')][_0x12a6('0x21')](this));ami['on'](_0x12a6('0x23'),this['syncNewChannel'][_0x12a6('0x21')](this));ami['on'](_0x12a6('0x24'),this[_0x12a6('0x25')][_0x12a6('0x21')](this));ami['on'](_0x12a6('0x26'),this[_0x12a6('0x27')][_0x12a6('0x21')](this));ami['on'](_0x12a6('0x28'),this[_0x12a6('0x29')]['bind'](this));ami['on']('newcallerid',this[_0x12a6('0x2a')]['bind'](this));ami['on'](_0x12a6('0x2b'),this[_0x12a6('0x2c')][_0x12a6('0x21')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0x12a6('0x2d'),this[_0x12a6('0x2e')]['bind'](this));ami['on'](_0x12a6('0x2f'),this[_0x12a6('0x30')][_0x12a6('0x21')](this));return BPromise[_0x12a6('0x31')]()[_0x12a6('0x32')](ami['actionCoreShowChannels']())[_0x12a6('0x33')](function(_0x4830b4){console[_0x12a6('0x34')](_0x4830b4);});}VoiceCallReport[_0x12a6('0x35')]['isNotNull']=function(_0x5bef19){return _0x5bef19!==null&&!_[_0x12a6('0x36')](_0x5bef19);};VoiceCallReport[_0x12a6('0x35')][_0x12a6('0x37')]=function(_0x341a1e,_0x453940,_0x1fee24){io['to'](_0x341a1e)[_0x12a6('0x37')](_0x453940,_0x1fee24);};VoiceCallReport['prototype'][_0x12a6('0x2a')]=function(_0x371864){try{if(this[_0x12a6('0x38')](_0x371864)){if(_0x371864[_0x12a6('0x39')]===_0x371864[_0x12a6('0x3a')]){if(!_[_0x12a6('0x36')](this[_0x12a6('0x1d')][_0x371864[_0x12a6('0x39')]])){_[_0x12a6('0x3b')](this[_0x12a6('0x1d')][_0x371864['uniqueid']],_[_0x12a6('0x3c')](_0x371864,_[_0x12a6('0x3d')](this['channels'][_0x371864[_0x12a6('0x39')]])));}}}}catch(_0x3b8d71){logger['error'](_0x12a6('0x3e'),util[_0x12a6('0x3f')](_0x3b8d71,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x12a6('0x40')]=function(_0x2a3c3e){try{if(this[_0x12a6('0x38')](_0x2a3c3e)){if(_0x2a3c3e[_0x12a6('0x39')]===_0x2a3c3e[_0x12a6('0x3a')]&&_0x2a3c3e[_0x12a6('0x41')]!=_0x12a6('0x42')){if(_[_0x12a6('0x36')](this[_0x12a6('0x1d')][_0x2a3c3e[_0x12a6('0x39')]])){this[_0x12a6('0x1d')][_0x2a3c3e[_0x12a6('0x39')]]=new Channel();this[_0x12a6('0x1d')][_0x2a3c3e[_0x12a6('0x39')]]['starttime']=moment()[_0x12a6('0x43')](_0x12a6('0x44'));this['channels'][_0x2a3c3e[_0x12a6('0x39')]][_0x12a6('0x45')]=dispositions[_[_0x12a6('0x46')](_0x2a3c3e[_0x12a6('0x47')])];_[_0x12a6('0x3b')](this[_0x12a6('0x1d')][_0x2a3c3e[_0x12a6('0x39')]],_[_0x12a6('0x3c')](_0x2a3c3e,_[_0x12a6('0x3d')](this[_0x12a6('0x1d')][_0x2a3c3e[_0x12a6('0x39')]])));if(_0x2a3c3e[_0x12a6('0x48')]===_0x12a6('0x49')){if(this[_0x12a6('0x1e')][_0x2a3c3e[_0x12a6('0x41')]['split']('-')[0x0]]){this['agents'][_0x2a3c3e[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]]['destconnectedlinenum']=_0x2a3c3e[_0x12a6('0x4b')];this[_0x12a6('0x37')](util[_0x12a6('0x43')](_0x12a6('0x4c'),this[_0x12a6('0x1e')][_0x2a3c3e[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]][_0x12a6('0x4d')]),'user:agentconnect',{'destaccountcode':this[_0x12a6('0x1e')][_0x2a3c3e['channel']['split']('-')[0x0]][_0x12a6('0x4e')],'destconnectedlinenum':_0x2a3c3e[_0x12a6('0x4b')]});}}}}}}catch(_0x12160d){logger[_0x12a6('0x4f')]('[syncNewChannel][VoiceCallReport]',util['inspect'](_0x12160d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x12a6('0x35')]['syncNewExten']=function(_0x3ddb97){try{if(this[_0x12a6('0x38')](_0x3ddb97)){if(_0x3ddb97[_0x12a6('0x39')]===_0x3ddb97[_0x12a6('0x3a')]&&_0x3ddb97[_0x12a6('0x4b')]!='h'&&_0x3ddb97[_0x12a6('0x41')]!=_0x12a6('0x42')){_0x3ddb97['application']=_0x3ddb97['application']['toLowerCase']();_0x3ddb97['applicationdata']=(_0x3ddb97[_0x12a6('0x50')]||_0x3ddb97[_0x12a6('0x51')])[_0x12a6('0x52')]();if(_[_0x12a6('0x36')](this['channels'][_0x3ddb97[_0x12a6('0x39')]])){this[_0x12a6('0x1d')][_0x3ddb97[_0x12a6('0x39')]]=new Channel();this['channels'][_0x3ddb97[_0x12a6('0x39')]][_0x12a6('0x53')]=_0x3ddb97[_0x12a6('0x54')]?moment()[_0x12a6('0x55')](moment[_0x12a6('0x54')](_0x3ddb97[_0x12a6('0x54')])[_0x12a6('0x56')](),_0x12a6('0x56'))[_0x12a6('0x43')](_0x12a6('0x44')):moment()[_0x12a6('0x43')](_0x12a6('0x44'));this[_0x12a6('0x1d')][_0x3ddb97['uniqueid']][_0x12a6('0x45')]=_0x12a6('0x15');}_[_0x12a6('0x3b')](this[_0x12a6('0x1d')][_0x3ddb97['uniqueid']],_['pick'](_0x3ddb97,_[_0x12a6('0x3d')](this['channels'][_0x3ddb97[_0x12a6('0x39')]])));if(_[_0x12a6('0x57')](applications,_0x3ddb97['application'])){this[_0x12a6('0x1d')][_0x3ddb97[_0x12a6('0x39')]][_0x12a6('0x58')]=_0x3ddb97['application'];this[_0x12a6('0x1d')][_0x3ddb97[_0x12a6('0x39')]][_0x12a6('0x59')]=_0x3ddb97['applicationdata'];if(_0x3ddb97['application']===_0x12a6('0x10')&&_[_0x12a6('0x5a')](_0x3ddb97['applicationdata'],'cdr(')){var _0x25a0f9=_0x3ddb97[_0x12a6('0x51')][_0x12a6('0x4a')]('=');var _0x22a559=_0x25a0f9[0x0]['match'](/cdr\((.*)\)/);if(_0x22a559){this[_0x12a6('0x1d')][_0x3ddb97[_0x12a6('0x39')]][_0x22a559[0x1]]=_0x25a0f9[0x1];}}else if(_0x3ddb97['application']===_0x12a6('0x11')){this[_0x12a6('0x1d')][_0x3ddb97[_0x12a6('0x39')]][_0x12a6('0x11')]=_0x3ddb97['applicationdata'][_0x12a6('0x4a')](',')[0x0];}}}}}catch(_0x3849d9){logger['error'](_0x12a6('0x5b'),util['inspect'](_0x3849d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x12a6('0x35')]['syncNewState']=function(_0x39b253){try{if(this[_0x12a6('0x38')](_0x39b253)){if(_0x39b253['uniqueid']!==_0x39b253[_0x12a6('0x3a')]){if(this['channels'][_0x39b253[_0x12a6('0x3a')]]){if(_0x39b253[_0x12a6('0x47')]==='6'){if(!this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x3a')]]['answered']){var _0x34eb2a=moment();this[_0x12a6('0x1d')][_0x39b253['linkedid']][_0x12a6('0x5c')]=!![];this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x5d')]=_0x34eb2a[_0x12a6('0x43')](_0x12a6('0x44'));if(this[_0x12a6('0x1d')][_0x39b253['linkedid']][_0x12a6('0x53')]){this[_0x12a6('0x1d')][_0x39b253['linkedid']][_0x12a6('0x5e')]=_0x34eb2a[_0x12a6('0x5f')](this[_0x12a6('0x1d')][_0x39b253['linkedid']]['starttime'],_0x12a6('0x56'));}}this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x3a')]=_0x39b253[_0x12a6('0x39')];if(_0x39b253[_0x12a6('0x60')]!==_0x12a6('0x61')){this['channels'][_0x39b253[_0x12a6('0x3a')]]['connectedlinenum']=_0x39b253[_0x12a6('0x60')];}this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x62')]=_0x39b253[_0x12a6('0x63')];this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x64')]=_0x39b253[_0x12a6('0x41')];this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x45')]=dispositions[_['toNumber'](_0x39b253['channelstate'])];if(this[_0x12a6('0x1e')][_0x39b253['channel'][_0x12a6('0x4a')]('-')[0x0]]){this['channels'][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x65')]=this['agents'][_0x39b253[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]]['id'];this['channels'][_0x39b253[_0x12a6('0x3a')]][_0x12a6('0x66')]=this[_0x12a6('0x1e')][_0x39b253[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]][_0x12a6('0x4d')];}}}}else{if(this['channels'][_0x39b253[_0x12a6('0x39')]]){if(_0x39b253['channelstate']==='6'){if(this['agents'][_0x39b253[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]]){this[_0x12a6('0x1d')][_0x39b253[_0x12a6('0x39')]][_0x12a6('0x65')]=this[_0x12a6('0x1e')][_0x39b253['channel'][_0x12a6('0x4a')]('-')[0x0]]['id'];this['channels'][_0x39b253['uniqueid']][_0x12a6('0x66')]=this[_0x12a6('0x1e')][_0x39b253['channel'][_0x12a6('0x4a')]('-')[0x0]][_0x12a6('0x4d')];}}}}}}catch(_0x2792f9){logger[_0x12a6('0x4f')](_0x12a6('0x67'),util[_0x12a6('0x3f')](_0x2792f9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x12a6('0x68')]=function(_0x4fb65a,_0x3f3084){if(this[_0x12a6('0x1d')][_0x4fb65a]){this[_0x12a6('0x1d')][_0x4fb65a][_0x12a6('0x69')]=!![];if(_[_0x12a6('0x6a')](_0x3f3084,_0x12a6('0x6b'))){_0x3f3084=_0x3f3084[_0x12a6('0x6c')]('.wav49',_0x12a6('0x6d'));}this[_0x12a6('0x1d')][_0x4fb65a][_0x12a6('0x6e')]=_0x3f3084;var _0x22c059=_[_0x12a6('0x6f')](this['channels'][_0x4fb65a][_0x12a6('0x70')],{'filename':_0x3f3084});if(_[_0x12a6('0x71')](_0x22c059)){this[_0x12a6('0x1d')][_0x4fb65a][_0x12a6('0x70')]['push']({'filename':_0x3f3084,'createdAt':moment()[_0x12a6('0x43')](_0x12a6('0x44')),'mixmonitorid':'','status':_0x12a6('0x72')});}}};VoiceCallReport[_0x12a6('0x35')]['syncVarSet']=function(_0x291cea){try{if(this[_0x12a6('0x38')](_0x291cea)){if(this['channels'][_0x291cea[_0x12a6('0x39')]]&&_0x291cea[_0x12a6('0x41')]!=_0x12a6('0x42')){if(this['isNotNull'](_0x291cea[_0x12a6('0x73')])){if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')][_0x12a6('0x74')])){this[_0x12a6('0x68')](_0x291cea[_0x12a6('0x39')],_0x291cea[_0x12a6('0x75')]);}else if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')]['xmd-phone'])){this['channels'][_0x291cea[_0x12a6('0x39')]][_0x12a6('0x60')]=_0x291cea[_0x12a6('0x75')];}else if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')]['xmd-callerid'])){this[_0x12a6('0x1d')][_0x291cea['uniqueid']][_0x12a6('0x76')]=_0x291cea[_0x12a6('0x75')];}else if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')][_0x12a6('0x77')])){this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x39')]][_0x12a6('0x78')]=_0x291cea[_0x12a6('0x75')];}else if(this[_0x12a6('0x38')](_0x291cea['variable']['xmd-queue'])){this[_0x12a6('0x1d')][_0x291cea['uniqueid']][_0x12a6('0x11')]=_0x291cea[_0x12a6('0x75')][_0x12a6('0x4a')](',')[0x0];}else if(this['isNotNull'](_0x291cea['variable'][_0x12a6('0x79')])){this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x39')]][_0x12a6('0x7a')]=_0x291cea[_0x12a6('0x75')];}else if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')][_0x12a6('0x7b')])){this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x39')]][_0x12a6('0x7c')]=_0x291cea[_0x12a6('0x75')];}else if(this['isNotNull'](_0x291cea[_0x12a6('0x73')]['xmd-callerid-preview'])){this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x39')]][_0x12a6('0x7d')]=_0x291cea['value'];}else if(this['isNotNull'](_0x291cea[_0x12a6('0x73')][_0x12a6('0x7e')])){this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x39')]]['queue']=_0x291cea[_0x12a6('0x75')];}else if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')][_0x12a6('0x7f')])){this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x39')]]['sipcalluniqueid']=_0x291cea['value'];}}}else if(this[_0x12a6('0x38')](_0x291cea['variable']['mixmonitor_filename'])){if(_0x291cea[_0x12a6('0x75')]){var _0x47645c=path[_0x12a6('0x80')](_0x291cea[_0x12a6('0x75')])[_0x12a6('0x4d')];this[_0x12a6('0x68')](_0x47645c,_0x291cea[_0x12a6('0x75')]);}}else if(this[_0x12a6('0x1d')][_0x291cea[_0x12a6('0x3a')]]){if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')])){if(this[_0x12a6('0x38')](_0x291cea[_0x12a6('0x73')][_0x12a6('0x7f')])){this['channels'][_0x291cea[_0x12a6('0x3a')]][_0x12a6('0x81')]=_0x291cea[_0x12a6('0x75')];}}}}}catch(_0x47a60a){logger['error'](_0x12a6('0x82'),util[_0x12a6('0x3f')](_0x47a60a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x12a6('0x35')][_0x12a6('0x29')]=function(_0x4e7993){try{if(this[_0x12a6('0x38')](_0x4e7993)){if(this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]]){var _0xc5414f=moment();this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]][_0x12a6('0x83')]=_0xc5414f[_0x12a6('0x43')](_0x12a6('0x44'));this['channels'][_0x4e7993['uniqueid']]['duration']=_0xc5414f['diff'](this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]][_0x12a6('0x53')],_0x12a6('0x56'));if(this[_0x12a6('0x1d')][_0x4e7993['uniqueid']]['answered']){this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]][_0x12a6('0x84')]=_0xc5414f[_0x12a6('0x5f')](this[_0x12a6('0x1d')][_0x4e7993['uniqueid']][_0x12a6('0x5d')],_0x12a6('0x56'));this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]]['holdtime']=this['channels'][_0x4e7993[_0x12a6('0x39')]]['duration']-this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]]['billableseconds'];}if(_0x4e7993[_0x12a6('0x48')]===_0x12a6('0x49')){if(this[_0x12a6('0x1e')][_0x4e7993[_0x12a6('0x41')]['split']('-')[0x0]]){this['agents'][_0x4e7993[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]]=_[_0x12a6('0x85')](this['agents'][_0x4e7993[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]],[_0x12a6('0x86')]);this[_0x12a6('0x37')](util[_0x12a6('0x43')]('user:%s',this['agents'][_0x4e7993[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]][_0x12a6('0x4d')]),'user:agentcomplete',{'destaccountcode':this[_0x12a6('0x1e')][_0x4e7993[_0x12a6('0x41')][_0x12a6('0x4a')]('-')[0x0]]['accountcode']});}}ami[_0x12a6('0x37')](_0x12a6('0x87'),this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]]);delete this[_0x12a6('0x1d')][_0x4e7993[_0x12a6('0x39')]];}}}catch(_0x3d00d8){logger['error']('[syncHangup][VoiceCallReport]',util[_0x12a6('0x3f')](_0x3d00d8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x12a6('0x35')]['syncAttendedTransfer']=function(_0x37eb2e){try{if(this[_0x12a6('0x38')](_0x37eb2e)){if(this['channels'][_0x37eb2e[_0x12a6('0x88')]]){this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x88')]][_0x12a6('0x89')]=_0x37eb2e[_0x12a6('0x8a')];this['channels'][_0x37eb2e[_0x12a6('0x88')]][_0x12a6('0x8b')]=_0x37eb2e['transfertargetcalleridnum'];if(this['channels'][_0x37eb2e[_0x12a6('0x8c')]]){var _0x3e2311=this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8c')]];this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8c')]]=this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x88')]];this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x88')]]=_0x3e2311;}}else if(this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8d')]]){this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8d')]]['transfercalleridnum']=_0x37eb2e[_0x12a6('0x8a')];this[_0x12a6('0x1d')][_0x37eb2e['transfertargetuniqueid']][_0x12a6('0x8b')]=_0x37eb2e[_0x12a6('0x8e')];if(this['channels'][_0x37eb2e[_0x12a6('0x8f')]]){var _0x3e2311=this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8f')]];this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8f')]]=this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8d')]];this[_0x12a6('0x1d')][_0x37eb2e[_0x12a6('0x8d')]]=_0x3e2311;}}}}catch(_0xef6aba){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0x12a6('0x3f')](_0xef6aba,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x12a6('0x90')]=function(_0x2b087e){try{if(this[_0x12a6('0x38')](_0x2b087e)){if(this[_0x12a6('0x1d')][_0x2b087e[_0x12a6('0x88')]]){this[_0x12a6('0x1d')][_0x2b087e[_0x12a6('0x88')]][_0x12a6('0x89')]=_0x2b087e[_0x12a6('0x91')];this[_0x12a6('0x1d')][_0x2b087e[_0x12a6('0x88')]]['transferconnectedlinenum']=_0x2b087e[_0x12a6('0x92')];this[_0x12a6('0x29')]({'event':'BlindTransfer','uniqueid':_0x2b087e[_0x12a6('0x88')],'context':_0x2b087e[_0x12a6('0x48')],'channel':_0x2b087e[_0x12a6('0x93')]});}}}catch(_0x4f4ca7){logger[_0x12a6('0x4f')]('[syncBlindTransfer][VoiceCallReport]',util['inspect'](_0x4f4ca7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x12a6('0x35')]['syncMusicOnHoldStart']=function(_0x46b7e7){try{if(this[_0x12a6('0x38')](_0x46b7e7)){if(this['channels'][_0x46b7e7[_0x12a6('0x39')]]){if(!_[_0x12a6('0x71')](this['channels'][_0x46b7e7[_0x12a6('0x39')]][_0x12a6('0x5d')])){this[_0x12a6('0x1d')][_0x46b7e7[_0x12a6('0x39')]][_0x12a6('0x94')]=moment()[_0x12a6('0x43')](_0x12a6('0x44'));}}}}catch(_0x404e81){logger['error'](_0x12a6('0x95'),util[_0x12a6('0x3f')](_0x404e81,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x12a6('0x35')][_0x12a6('0x30')]=function(_0xd5bb17){try{if(this[_0x12a6('0x38')](_0xd5bb17)){if(this['channels'][_0xd5bb17[_0x12a6('0x39')]]){if(!_[_0x12a6('0x71')](this[_0x12a6('0x1d')][_0xd5bb17[_0x12a6('0x39')]][_0x12a6('0x94')])){this[_0x12a6('0x1d')][_0xd5bb17[_0x12a6('0x39')]][_0x12a6('0x96')]+=moment()['milliseconds'](0x0)[_0x12a6('0x5f')](this[_0x12a6('0x1d')][_0xd5bb17[_0x12a6('0x39')]]['mohstarttime'],_0x12a6('0x56'));delete this[_0x12a6('0x1d')][_0xd5bb17[_0x12a6('0x39')]][_0x12a6('0x94')];}}}}catch(_0x9ab1de){logger['error'](_0x12a6('0x97'),util['inspect'](_0x9ab1de,{'showHidden':![],'depth':null}));}};module[_0x12a6('0x98')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index c85362b..590abe9 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 _0x6a2a=['sumHoldTime','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[syncHangup][VoiceDialReport]','exports','moment','util','../../../config/logger','redis','localhost','socket.io-emitter','outboundChannels','outbound','variables','syncDialBegin','dialend','varset','syncVarSet','bind','hangup','syncHangup','prototype','isNotNull','emit','merge','uniqueid','format','called','channel','substring','lastIndexOf','event','voice:outbound','voice_outbound_channel:save','channels','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','error','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','duration','endtime','diff','seconds','complete','total','holdtime','starttime','billableseconds'];(function(_0x520f5d,_0xa6ec41){var _0x5bba07=function(_0x38f4ee){while(--_0x38f4ee){_0x520f5d['push'](_0x520f5d['shift']());}};_0x5bba07(++_0xa6ec41);}(_0x6a2a,0x1ee));var _0xa6a2=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x6a2a[_0x404cde];return _0x139882;};'use strict';var _=require('lodash');var moment=require(_0xa6a2('0x0'));var util=require(_0xa6a2('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xa6a2('0x2'))('ami');var ami=require('../ami');config[_0xa6a2('0x3')]=_['defaults'](config[_0xa6a2('0x3')],{'host':_0xa6a2('0x4'),'port':0x18eb});var io=require(_0xa6a2('0x5'))(new Redis(config[_0xa6a2('0x3')]));function VoiceDialReport(_0x213315){this['channels']=_0x213315[_0xa6a2('0x6')];this[_0xa6a2('0x7')]=_0x213315['outbound'];this[_0xa6a2('0x8')]={};ami['on']('dialbegin',this[_0xa6a2('0x9')]['bind'](this));ami['on'](_0xa6a2('0xa'),this['syncDialEnd']['bind'](this));ami['on'](_0xa6a2('0xb'),this[_0xa6a2('0xc')][_0xa6a2('0xd')](this));ami['on'](_0xa6a2('0xe'),this[_0xa6a2('0xf')][_0xa6a2('0xd')](this));}VoiceDialReport[_0xa6a2('0x10')][_0xa6a2('0x11')]=function(_0x868b20){return _0x868b20!==null&&!_['isUndefined'](_0x868b20);};VoiceDialReport[_0xa6a2('0x10')][_0xa6a2('0x12')]=function(_0x5a3f37,_0x48e96a,_0x38a882){io['to'](_0x5a3f37)['emit'](_0x48e96a,_0x38a882);};VoiceDialReport[_0xa6a2('0x10')][_0xa6a2('0x9')]=function(_0x42f96f){try{if(this[_0xa6a2('0x11')](_0x42f96f)){if(this['channels'][_0x42f96f['uniqueid']]){_[_0xa6a2('0x13')](this['channels'][_0x42f96f[_0xa6a2('0x14')]],{'starttime':moment()[_0xa6a2('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xa6a2('0x16'),'interface':_0x42f96f[_0xa6a2('0x17')]['substring'](0x0,_0x42f96f['channel']['lastIndexOf']('-')),'membername':_0x42f96f[_0xa6a2('0x17')][_0xa6a2('0x18')](_0x42f96f['channel'][_0xa6a2('0x19')]('/')+0x1,_0x42f96f[_0xa6a2('0x17')][_0xa6a2('0x19')]('-'))},_['omit'](_0x42f96f,[_0xa6a2('0x1a'),'privilege']));this[_0xa6a2('0x12')](_0xa6a2('0x1b'),_0xa6a2('0x1c'),this[_0xa6a2('0x1d')][_0x42f96f[_0xa6a2('0x14')]]);ami[_0xa6a2('0x12')]('custom:dialbegin',this['channels'][_0x42f96f[_0xa6a2('0x14')]]);}}}catch(_0xd10d58){logger['error'](_0xa6a2('0x1e'),util[_0xa6a2('0x1f')](_0xd10d58,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa6a2('0x20')]=function(_0x311041){try{if(this[_0xa6a2('0x11')](_0x311041)){if(this['channels'][_0x311041['uniqueid']]){this[_0xa6a2('0x1d')][_0x311041['uniqueid']][_0xa6a2('0x21')]=_0x311041[_0xa6a2('0x21')];if(_0x311041[_0xa6a2('0x21')]==='ANSWER'){this['channels'][_0x311041['uniqueid']][_0xa6a2('0x22')]=_0x311041[_0xa6a2('0x22')];this['channels'][_0x311041['uniqueid']][_0xa6a2('0x23')]=_0x311041[_0xa6a2('0x23')];this[_0xa6a2('0x1d')][_0x311041[_0xa6a2('0x14')]][_0xa6a2('0x24')]=moment()['format'](_0xa6a2('0x25'));this[_0xa6a2('0x1d')][_0x311041['uniqueid']][_0xa6a2('0x26')]=_0xa6a2('0x27');ami[_0xa6a2('0x12')]('custom:dialconnect',this[_0xa6a2('0x1d')][_0x311041[_0xa6a2('0x14')]]);}this[_0xa6a2('0x12')](_0xa6a2('0x1b'),_0xa6a2('0x1c'),this[_0xa6a2('0x1d')][_0x311041[_0xa6a2('0x14')]]);}}}catch(_0x401d3a){logger['error'](_0xa6a2('0x28'),util[_0xa6a2('0x1f')](_0x401d3a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa6a2('0x10')][_0xa6a2('0xc')]=function(_0x367c0e){try{if(this['isNotNull'](_0x367c0e)){this[_0xa6a2('0x29')](_0x367c0e[_0xa6a2('0x14')],_[_0xa6a2('0x2a')](_0x367c0e[_0xa6a2('0x2b')])[0x0],_0x367c0e[_0xa6a2('0x2c')]);if(this[_0xa6a2('0x11')](_0x367c0e[_0xa6a2('0x2b')])&&this[_0xa6a2('0x11')](_0x367c0e[_0xa6a2('0x2b')][_0xa6a2('0x2d')])){if(_[_0xa6a2('0x2e')](this['channels'][_0x367c0e[_0xa6a2('0x14')]])){this['channels'][_0x367c0e[_0xa6a2('0x14')]]={'routeId':_0x367c0e[_0xa6a2('0x2c')],'variables':this[_0xa6a2('0x8')][_0x367c0e['uniqueid']]};this['emit'](_0xa6a2('0x1b'),'voice_outbound_channel:save',this[_0xa6a2('0x1d')][_0x367c0e[_0xa6a2('0x14')]]);}}}}catch(_0x8affc2){logger[_0xa6a2('0x2f')](_0xa6a2('0x30'),util['inspect'](_0x8affc2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa6a2('0x10')]['addVariable']=function(_0x317585,_0x20ef8a,_0x4ce610){var _0x3f8dfa=['rtpaudioqos',_0xa6a2('0x31'),_0xa6a2('0x32'),_0xa6a2('0x33'),_0xa6a2('0x34'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xa6a2('0x35'),_0xa6a2('0x36'),_0xa6a2('0x37'),'bridgepeer','bridgepvtcallid','membercalls',_0xa6a2('0x38'),_0xa6a2('0x39'),_0xa6a2('0x3a'),_0xa6a2('0x3b'),_0xa6a2('0x3c'),_0xa6a2('0x3d')];if(!_[_0xa6a2('0x3e')](_0x20ef8a)&&!_[_0xa6a2('0x3f')](_0x3f8dfa,_0x20ef8a)){if(_[_0xa6a2('0x2e')](this['variables'][_0x317585])){this[_0xa6a2('0x8')][_0x317585]={};}this[_0xa6a2('0x8')][_0x317585][_0x20ef8a]=_0x4ce610;}};VoiceDialReport[_0xa6a2('0x10')][_0xa6a2('0xf')]=function(_0x440172){try{if(this['isNotNull'](_0x440172)){if(this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]]){this['channels'][_0x440172[_0xa6a2('0x14')]]['endtime']=moment()[_0xa6a2('0x15')](_0xa6a2('0x25'));this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x40')]=moment(this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x41')])[_0xa6a2('0x42')](this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]]['starttime'],_0xa6a2('0x43'));this[_0xa6a2('0x1d')][_0x440172['uniqueid']]['lastevent']=_0xa6a2('0x44');this['outbound'][_0xa6a2('0x45')]+=0x1;if(this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x24')]){this[_0xa6a2('0x7')]['answered']+=0x1;this[_0xa6a2('0x1d')][_0x440172['uniqueid']][_0xa6a2('0x46')]=moment(this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]]['answertime'])[_0xa6a2('0x42')](this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x47')],_0xa6a2('0x43'));this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x48')]=moment(this[_0xa6a2('0x1d')][_0x440172['uniqueid']]['endtime'])[_0xa6a2('0x42')](this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x24')],_0xa6a2('0x43'));this[_0xa6a2('0x7')][_0xa6a2('0x49')]+=this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]]['holdtime']||0x0;this['outbound']['sumBillable']+=this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x48')];}this[_0xa6a2('0x7')]['sumDuration']+=this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]][_0xa6a2('0x40')];ami[_0xa6a2('0x12')](_0xa6a2('0x4a'),this['channels'][_0x440172[_0xa6a2('0x14')]]);ami[_0xa6a2('0x12')](_0xa6a2('0x4b'),this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]]);this[_0xa6a2('0x12')](_0xa6a2('0x1b'),_0xa6a2('0x4c'),this[_0xa6a2('0x7')]);logger[_0xa6a2('0x4d')](_0xa6a2('0x4e'),JSON['stringify'](this[_0xa6a2('0x1d')][_0x440172['uniqueid']]));this[_0xa6a2('0x12')](_0xa6a2('0x1b'),'voice_outbound_channel:remove',this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]]);delete this[_0xa6a2('0x1d')][_0x440172[_0xa6a2('0x14')]];}if(this[_0xa6a2('0x8')][_0x440172[_0xa6a2('0x14')]]){delete this[_0xa6a2('0x8')][_0x440172[_0xa6a2('0x14')]];}}}catch(_0x4ba622){logger[_0xa6a2('0x2f')](_0xa6a2('0x4f'),util['inspect'](_0x4ba622,{'showHidden':![],'depth':null}));}};module[_0xa6a2('0x50')]=VoiceDialReport; \ No newline at end of file +var _0xb465=['syncVarSet','syncHangup','prototype','emit','isNotNull','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberpenalty','memberrealtime','isNil','duration','endtime','diff','starttime','seconds','complete','total','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb465,0x9b));var _0x5b46=function(_0x41fc66,_0x2efd91){_0x41fc66=_0x41fc66-0x0;var _0x59f865=_0xb465[_0x41fc66];return _0x59f865;};'use strict';var _=require(_0x5b46('0x0'));var moment=require(_0x5b46('0x1'));var util=require(_0x5b46('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x5b46('0x3'))(_0x5b46('0x4'));var ami=require(_0x5b46('0x5'));config[_0x5b46('0x6')]=_['defaults'](config[_0x5b46('0x6')],{'host':_0x5b46('0x7'),'port':0x18eb});var io=require(_0x5b46('0x8'))(new Redis(config[_0x5b46('0x6')]));function VoiceDialReport(_0x4b862c){this[_0x5b46('0x9')]=_0x4b862c[_0x5b46('0xa')];this[_0x5b46('0xb')]=_0x4b862c[_0x5b46('0xb')];this[_0x5b46('0xc')]={};ami['on'](_0x5b46('0xd'),this[_0x5b46('0xe')][_0x5b46('0xf')](this));ami['on'](_0x5b46('0x10'),this[_0x5b46('0x11')][_0x5b46('0xf')](this));ami['on'](_0x5b46('0x12'),this[_0x5b46('0x13')][_0x5b46('0xf')](this));ami['on']('hangup',this[_0x5b46('0x14')][_0x5b46('0xf')](this));}VoiceDialReport[_0x5b46('0x15')]['isNotNull']=function(_0x52e969){return _0x52e969!==null&&!_['isUndefined'](_0x52e969);};VoiceDialReport['prototype'][_0x5b46('0x16')]=function(_0xd9c3f8,_0x7f5150,_0x68b04){io['to'](_0xd9c3f8)[_0x5b46('0x16')](_0x7f5150,_0x68b04);};VoiceDialReport[_0x5b46('0x15')][_0x5b46('0xe')]=function(_0x16b5d6){try{if(this[_0x5b46('0x17')](_0x16b5d6)){if(this['channels'][_0x16b5d6[_0x5b46('0x18')]]){_['merge'](this[_0x5b46('0x9')][_0x16b5d6[_0x5b46('0x18')]],{'starttime':moment()[_0x5b46('0x19')](_0x5b46('0x1a')),'lastevent':'called','interface':_0x16b5d6[_0x5b46('0x1b')][_0x5b46('0x1c')](0x0,_0x16b5d6['channel']['lastIndexOf']('-')),'membername':_0x16b5d6[_0x5b46('0x1b')][_0x5b46('0x1c')](_0x16b5d6[_0x5b46('0x1b')][_0x5b46('0x1d')]('/')+0x1,_0x16b5d6['channel']['lastIndexOf']('-'))},_[_0x5b46('0x1e')](_0x16b5d6,[_0x5b46('0x1f'),_0x5b46('0x20')]));this[_0x5b46('0x16')](_0x5b46('0x21'),'voice_outbound_channel:save',this[_0x5b46('0x9')][_0x16b5d6[_0x5b46('0x18')]]);ami[_0x5b46('0x16')](_0x5b46('0x22'),this[_0x5b46('0x9')][_0x16b5d6[_0x5b46('0x18')]]);}}}catch(_0x4db09e){logger[_0x5b46('0x23')](_0x5b46('0x24'),util[_0x5b46('0x25')](_0x4db09e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5b46('0x11')]=function(_0x3d5a33){try{if(this['isNotNull'](_0x3d5a33)){if(this[_0x5b46('0x9')][_0x3d5a33[_0x5b46('0x18')]]){this[_0x5b46('0x9')][_0x3d5a33[_0x5b46('0x18')]][_0x5b46('0x26')]=_0x3d5a33[_0x5b46('0x26')];if(_0x3d5a33['dialstatus']===_0x5b46('0x27')){this[_0x5b46('0x9')][_0x3d5a33[_0x5b46('0x18')]][_0x5b46('0x28')]=_0x3d5a33['connectedlinenum'];this[_0x5b46('0x9')][_0x3d5a33['uniqueid']]['connectedlinename']=_0x3d5a33[_0x5b46('0x29')];this[_0x5b46('0x9')][_0x3d5a33[_0x5b46('0x18')]][_0x5b46('0x2a')]=moment()[_0x5b46('0x19')](_0x5b46('0x1a'));this[_0x5b46('0x9')][_0x3d5a33[_0x5b46('0x18')]][_0x5b46('0x2b')]=_0x5b46('0x2c');ami['emit']('custom:dialconnect',this['channels'][_0x3d5a33[_0x5b46('0x18')]]);}this[_0x5b46('0x16')](_0x5b46('0x21'),_0x5b46('0x2d'),this[_0x5b46('0x9')][_0x3d5a33['uniqueid']]);}}}catch(_0x2da453){logger[_0x5b46('0x23')](_0x5b46('0x2e'),util[_0x5b46('0x25')](_0x2da453,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5b46('0x13')]=function(_0x477f41){try{if(this['isNotNull'](_0x477f41)){this[_0x5b46('0x2f')](_0x477f41[_0x5b46('0x18')],_[_0x5b46('0x30')](_0x477f41[_0x5b46('0x31')])[0x0],_0x477f41[_0x5b46('0x32')]);if(this[_0x5b46('0x17')](_0x477f41['variable'])&&this[_0x5b46('0x17')](_0x477f41[_0x5b46('0x31')][_0x5b46('0x33')])){if(_[_0x5b46('0x34')](this['channels'][_0x477f41[_0x5b46('0x18')]])){this[_0x5b46('0x9')][_0x477f41[_0x5b46('0x18')]]={'routeId':_0x477f41[_0x5b46('0x32')],'variables':this['variables'][_0x477f41[_0x5b46('0x18')]]};this['emit']('voice:outbound',_0x5b46('0x2d'),this[_0x5b46('0x9')][_0x477f41['uniqueid']]);}}}}catch(_0x5bf609){logger['error'](_0x5b46('0x35'),util[_0x5b46('0x25')](_0x5bf609,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5b46('0x2f')]=function(_0x5bf76c,_0x330c00,_0x30abed){var _0x59ff54=[_0x5b46('0x36'),_0x5b46('0x37'),_0x5b46('0x38'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0x5b46('0x39'),_0x5b46('0x3a'),_0x5b46('0x3b'),_0x5b46('0x3c'),_0x5b46('0x3d'),'bridgepvtcallid',_0x5b46('0x3e'),'memberdynamic','memberinterface','memberlastcall','membername',_0x5b46('0x3f'),_0x5b46('0x40')];if(!_[_0x5b46('0x41')](_0x330c00)&&!_['includes'](_0x59ff54,_0x330c00)){if(_[_0x5b46('0x34')](this[_0x5b46('0xc')][_0x5bf76c])){this[_0x5b46('0xc')][_0x5bf76c]={};}this[_0x5b46('0xc')][_0x5bf76c][_0x330c00]=_0x30abed;}};VoiceDialReport['prototype'][_0x5b46('0x14')]=function(_0x2a7e44){try{if(this[_0x5b46('0x17')](_0x2a7e44)){if(this[_0x5b46('0x9')][_0x2a7e44['uniqueid']]){this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]]['endtime']=moment()[_0x5b46('0x19')](_0x5b46('0x1a'));this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x42')]=moment(this['channels'][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x43')])[_0x5b46('0x44')](this['channels'][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x45')],_0x5b46('0x46'));this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]]['lastevent']=_0x5b46('0x47');this['outbound'][_0x5b46('0x48')]+=0x1;if(this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x2a')]){this[_0x5b46('0xb')][_0x5b46('0x49')]+=0x1;this[_0x5b46('0x9')][_0x2a7e44['uniqueid']]['holdtime']=moment(this['channels'][_0x2a7e44[_0x5b46('0x18')]]['answertime'])['diff'](this['channels'][_0x2a7e44[_0x5b46('0x18')]]['starttime'],_0x5b46('0x46'));this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x4a')]=moment(this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x43')])[_0x5b46('0x44')](this['channels'][_0x2a7e44['uniqueid']]['answertime'],'seconds');this[_0x5b46('0xb')][_0x5b46('0x4b')]+=this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x4c')]||0x0;this[_0x5b46('0xb')][_0x5b46('0x4d')]+=this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x4a')];}this['outbound'][_0x5b46('0x4e')]+=this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]][_0x5b46('0x42')];ami[_0x5b46('0x16')](_0x5b46('0x4f'),this['channels'][_0x2a7e44['uniqueid']]);ami[_0x5b46('0x16')](_0x5b46('0x50'),this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]]);this['emit'](_0x5b46('0x21'),_0x5b46('0x51'),this[_0x5b46('0xb')]);logger[_0x5b46('0x52')](_0x5b46('0x53'),JSON[_0x5b46('0x54')](this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]]));this[_0x5b46('0x16')](_0x5b46('0x21'),'voice_outbound_channel:remove',this[_0x5b46('0x9')][_0x2a7e44[_0x5b46('0x18')]]);delete this['channels'][_0x2a7e44[_0x5b46('0x18')]];}if(this[_0x5b46('0xc')][_0x2a7e44[_0x5b46('0x18')]]){delete this[_0x5b46('0xc')][_0x2a7e44['uniqueid']];}}}catch(_0x5607d0){logger[_0x5b46('0x23')](_0x5b46('0x55'),util[_0x5b46('0x25')](_0x5607d0,{'showHidden':![],'depth':null}));}};module[_0x5b46('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 3a4e6af..8148408 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 _0x4ebc=['voice_queue_channel:remove','type','inbound','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','Trunk','active','callerid','Interval','stringify','md5','isNotNull','queues','[queues]','then','[queuesummary]','syncQueueSummary','queue','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','uniqueid','queuecallerjoinAt','position','count','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','last','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','[syncAgentConnect][VoiceQueueReport]','queuecallerabandonAt','assigned','lastAssignedTo','queuecallercomplete','queuecallerexit','transfer','reason','COMPLETED','local/','linkedid','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','addVariable','value','queuestatus','queuecallerexitAt','TIMEOUT','lastevent','timeout','custom:timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','length','abandoned','diff','seconds','milliseconds','sumBillable','queuecallercompleteAt','unmanaged','custom:queuecallerunmanaged','emitVoiceQueueSummary','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','mohstarttime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/logger','ami','../ami','defaults','redis','prototype','enqueue','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','syncVarSet','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice_queue_channel:save','emitVoiceQueueChannelRemove','info','voice:queue:%s','name'];(function(_0x594b3a,_0x403011){var _0x1a1b3b=function(_0x5c10c1){while(--_0x5c10c1){_0x594b3a['push'](_0x594b3a['shift']());}};_0x1a1b3b(++_0x403011);}(_0x4ebc,0x140));var _0xc4eb=function(_0x2d8683,_0x2901cc){_0x2d8683=_0x2d8683-0x0;var _0x26ab36=_0x4ebc[_0x2d8683];return _0x26ab36;};'use strict';var _=require(_0xc4eb('0x0'));var moment=require(_0xc4eb('0x1'));var BPromise=require(_0xc4eb('0x2'));var util=require(_0xc4eb('0x3'));var md5=require('md5');var Redis=require(_0xc4eb('0x4'));var config=require('../../../config/environment');var logger=require(_0xc4eb('0x5'))(_0xc4eb('0x6'));var ami=require(_0xc4eb('0x7'));var QueueReport=require('../model/queueReport');config['redis']=_[_0xc4eb('0x8')](config[_0xc4eb('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc4eb('0x9')]));var Sequence=function(){};Sequence[_0xc4eb('0xa')][_0xc4eb('0xb')]=function(_0x195599){this['tail']=this[_0xc4eb('0xc')]?this[_0xc4eb('0xc')][_0xc4eb('0xd')](_0x195599):_0x195599();};function VoiceQueueReport(_0x554f32){this[_0xc4eb('0xe')]=new Sequence();this['queueReports']={};this[_0xc4eb('0xf')]=_0x554f32[_0xc4eb('0xf')];this[_0xc4eb('0x10')]=_0x554f32[_0xc4eb('0x11')];this[_0xc4eb('0x12')]=_0x554f32[_0xc4eb('0x12')];this[_0xc4eb('0x13')]=!![];this[_0xc4eb('0x14')]=_0x554f32[_0xc4eb('0x14')];this[_0xc4eb('0x15')]={};ami['on'](_0xc4eb('0x16'),this['syncQueueSummary'][_0xc4eb('0x17')](this));ami['on'](_0xc4eb('0x18'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xc4eb('0x19'),this[_0xc4eb('0x1a')][_0xc4eb('0x17')](this));ami['on'](_0xc4eb('0x1b'),this[_0xc4eb('0x1c')][_0xc4eb('0x17')](this));ami['on']('queuecallerleave',this[_0xc4eb('0x1d')][_0xc4eb('0x17')](this));ami['on']('agentcomplete',this[_0xc4eb('0x1e')][_0xc4eb('0x17')](this));ami['on']('agentconnect',this[_0xc4eb('0x1f')][_0xc4eb('0x17')](this));ami['on']('varset',this[_0xc4eb('0x20')][_0xc4eb('0x17')](this));ami['on']('hangup',this[_0xc4eb('0x21')][_0xc4eb('0x17')](this));ami['on'](_0xc4eb('0x22'),this[_0xc4eb('0x23')][_0xc4eb('0x17')](this));ami['on']('musiconholdstart',this[_0xc4eb('0x24')]['bind'](this));ami['on'](_0xc4eb('0x25'),this[_0xc4eb('0x26')][_0xc4eb('0x17')](this));ami['on'](_0xc4eb('0x27'),this[_0xc4eb('0x28')][_0xc4eb('0x17')](this));ami['on']('blindtransfer',this[_0xc4eb('0x29')][_0xc4eb('0x17')](this));this[_0xc4eb('0x2a')]();this[_0xc4eb('0x2b')]();}function isNotNull(_0x18e102){return _0x18e102!==null&&!_[_0xc4eb('0x2c')](_0x18e102);}function clearChannels(_0x157f99){if(!_[_0xc4eb('0x2d')](_0x157f99)){for(var _0x4cd325 in _0x157f99){if(_0x157f99['hasOwnProperty'](_0x4cd325)){delete _0x157f99[_0x4cd325];}}}}function clearCampaigns(_0x306039){if(!_['isEmpty'](_0x306039)){for(var _0x36e7aa in _0x306039){if(_0x306039[_0xc4eb('0x2e')](_0x36e7aa)){_0x306039[_0x36e7aa][_0xc4eb('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x16c2f8){if(!_['isEmpty'](_0x16c2f8)){for(var _0x2da23f in _0x16c2f8){if(_0x16c2f8[_0xc4eb('0x2e')](_0x2da23f)){_0x16c2f8[_0x2da23f][_0xc4eb('0x2f')]=0x0;_0x16c2f8[_0x2da23f]['talking']=0x0;_0x16c2f8[_0x2da23f][_0xc4eb('0x30')]=0x0;_0x16c2f8[_0x2da23f][_0xc4eb('0x31')]=0x0;_0x16c2f8[_0x2da23f][_0xc4eb('0x32')]=!![];}}}}function clearAgentBooked(_0x1a24b7){if(!_[_0xc4eb('0x2d')](_0x1a24b7)){for(var _0x5b60d1 in _0x1a24b7){if(_0x1a24b7['hasOwnProperty'](_0x5b60d1)){_0x1a24b7[_0x5b60d1][_0xc4eb('0x33')]=!![];}}}}VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x34')]=function(){var _0x32588a=this;for(var _0x4be608 in this['channels']){if(this[_0xc4eb('0x10')]['hasOwnProperty'](_0x4be608)&&!this[_0xc4eb('0x10')][_0x4be608][_0xc4eb('0x35')]){this[_0xc4eb('0xe')][_0xc4eb('0xb')](function(){if(!_[_0xc4eb('0x36')](_0x32588a[_0xc4eb('0x10')][_0x4be608])){return ami[_0xc4eb('0x37')]({'action':'status','channel':_0x32588a[_0xc4eb('0x10')][_0x4be608][_0xc4eb('0x38')]})[_0xc4eb('0x39')](function(_0xa1274){if(_0xa1274[_0xc4eb('0x3a')]===_0xc4eb('0x3b')){setTimeout(function(){if(_0x32588a[_0xc4eb('0x10')][_0x4be608]){delete _0x32588a[_0xc4eb('0x10')][_0x4be608];logger[_0xc4eb('0x3c')](_0xc4eb('0x3d'),_0x4be608);}if(_0x32588a[_0xc4eb('0x3e')][_0x4be608]){delete _0x32588a['queueReports'][_0x4be608];logger[_0xc4eb('0x3c')](_0xc4eb('0x3f'),_0x4be608);}if(_0x32588a[_0xc4eb('0x15')][_0x4be608]){delete _0x32588a[_0xc4eb('0x15')][_0x4be608];logger[_0xc4eb('0x3c')](_0xc4eb('0x40'),_0x4be608);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xc4eb('0x23')]=function(){logger['error'](_0xc4eb('0x41'));clearChannels(this['channels']);this[_0xc4eb('0x42')](this[_0xc4eb('0x3e')]);clearAgentBooked(this[_0xc4eb('0xf')]);clearVoiceQueues(this[_0xc4eb('0x12')]);clearCampaigns(this[_0xc4eb('0x14')]);};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x42')]=function(_0x4e64aa){var _0x57f052=this;if(!_[_0xc4eb('0x2d')](_0x4e64aa)){for(var _0x5dc843 in _0x4e64aa){if(_0x4e64aa['hasOwnProperty'](_0x5dc843)){_0x57f052['emitVoiceQueueChannelRemove'](_0x4e64aa[_0x5dc843]);delete _0x4e64aa[_0x5dc843];}}}};function loggerCatch(_0x2347a6){return function(_0x552d94){logger['error'](_0x2347a6,util[_0xc4eb('0x43')](_0x552d94,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xc4eb('0xa')]['emit']=function(_0x4ffb7d,_0xc333d6,_0x3f6017){io['to'](_0x4ffb7d)[_0xc4eb('0x44')](_0xc333d6,_0x3f6017);};VoiceQueueReport['prototype'][_0xc4eb('0x45')]=function(_0x41425e){this[_0xc4eb('0x44')](util[_0xc4eb('0x46')]('voice:queue:%s',_0x41425e['name']),_0xc4eb('0x47'),_0x41425e);};VoiceQueueReport['prototype'][_0xc4eb('0x48')]=function(_0x2ff33e){logger[_0xc4eb('0x49')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x2ff33e));this[_0xc4eb('0x44')](util[_0xc4eb('0x46')](_0xc4eb('0x4a'),_0x2ff33e[_0xc4eb('0x4b')]),_0xc4eb('0x4c'),_0x2ff33e);};VoiceQueueReport[_0xc4eb('0xa')]['emitVoiceQueueSummary']=function(_0x111649){if(_0x111649[_0xc4eb('0x4d')]===_0xc4eb('0x4e')){var _0x32fc04={'id':_0x111649['id'],'name':_0x111649[_0xc4eb('0x4b')],'strategy':_0x111649[_0xc4eb('0x4f')],'answered':_0x111649[_0xc4eb('0x50')],'available':_0x111649[_0xc4eb('0x51')],'loggedIn':_0x111649[_0xc4eb('0x52')],'pTalking':_0x111649[_0xc4eb('0x30')],'sumBillable':_0x111649['sumBillable'],'sumDuration':_0x111649[_0xc4eb('0x53')],'sumHoldTime':_0x111649[_0xc4eb('0x54')]||0x0,'talking':_0x111649[_0xc4eb('0x55')],'total':_0x111649[_0xc4eb('0x56')],'type':_0x111649['type'],'unmanaged':_0x111649['unmanaged'],'abandoned':_0x111649['abandoned'],'waiting':_0x111649['waiting']};if(_0x111649['Trunk']){_0x32fc04[_0xc4eb('0x57')]={'id':_0x111649[_0xc4eb('0x57')]['id'],'name':_0x111649[_0xc4eb('0x57')]['name'],'active':_0x111649[_0xc4eb('0x57')][_0xc4eb('0x58')],'callerid':_0x111649[_0xc4eb('0x57')][_0xc4eb('0x59')]};}if(_0x111649[_0xc4eb('0x5a')]){_0x32fc04[_0xc4eb('0x5a')]={'id':_0x111649[_0xc4eb('0x5a')]['id'],'name':_0x111649['Interval'][_0xc4eb('0x4b')]};}var _0x5bdbae=md5(JSON[_0xc4eb('0x5b')](_0x32fc04));if(_0x111649[_0xc4eb('0x5c')]!==_0x5bdbae){_0x111649['md5']=_0x5bdbae;this['emit'](util[_0xc4eb('0x46')](_0xc4eb('0x4a'),_0x32fc04[_0xc4eb('0x4b')]),'voice_queue:save',_0x32fc04);}}};VoiceQueueReport['prototype'][_0xc4eb('0x5d')]=function(_0x58bf71){return _0x58bf71!==null&&!_[_0xc4eb('0x2c')](_0x58bf71);};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x2b')]=function(){var _0x18450c=this;setInterval(function(){_0x18450c[_0xc4eb('0x34')]();ami['Action']({'action':_0xc4eb('0x5e')})[_0xc4eb('0x39')](loggerCatch(_0xc4eb('0x5f')));},0x2710);};VoiceQueueReport['prototype'][_0xc4eb('0x2a')]=function(){var _0x2e1c46=this;setInterval(function(){if(_0x2e1c46['flagQueueSummary']){return ami['Action']({'action':_0xc4eb('0x16')})[_0xc4eb('0x60')](function(_0x47ecc0){_0x2e1c46['flagQueueSummary']=![];})['catch'](loggerCatch(_0xc4eb('0x61')));}},0x3e8);};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x62')]=function(_0x4a16de){try{if(this[_0xc4eb('0x5d')](_0x4a16de)&&this[_0xc4eb('0x5d')](_0x4a16de[_0xc4eb('0x63')])){if(this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]]){var _0x3c9ec5=_['countBy'](this['channels'],_0xc4eb('0x63'))[_0x4a16de['queue']]||0x0;var _0x11dd1e=_0x3c9ec5-_0x4a16de[_0xc4eb('0x64')];if(this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]]['waiting']!==_['toNumber'](_0x4a16de[_0xc4eb('0x64')])||this['voiceQueues'][_0x4a16de[_0xc4eb('0x63')]]['loggedIn']!==_[_0xc4eb('0x65')](_0x4a16de['loggedin'])||this['voiceQueues'][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x51')]!==_[_0xc4eb('0x65')](_0x4a16de[_0xc4eb('0x51')])||this[_0xc4eb('0x12')][_0x4a16de['queue']][_0xc4eb('0x55')]!==_0x11dd1e){this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]]['waiting']=_['toNumber'](_0x4a16de[_0xc4eb('0x64')]);this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x52')]=_[_0xc4eb('0x65')](_0x4a16de[_0xc4eb('0x66')]);this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x51')]=_[_0xc4eb('0x65')](_0x4a16de[_0xc4eb('0x51')]);this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x55')]=_0x11dd1e>0x0?_0x11dd1e:0x0;this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x55')]=this['voiceQueues'][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x55')]>_[_0xc4eb('0x65')](_0x4a16de['loggedin'])?_['toNumber'](_0x4a16de[_0xc4eb('0x66')]):this['voiceQueues'][_0x4a16de[_0xc4eb('0x63')]][_0xc4eb('0x55')];this['emitVoiceQueueSummary'](this[_0xc4eb('0x12')][_0x4a16de[_0xc4eb('0x63')]]);}ami['emit'](_0xc4eb('0x67'),this[_0xc4eb('0x12')][_0x4a16de['queue']]);}}}catch(_0x26bc7d){logger[_0xc4eb('0x3c')](_0xc4eb('0x68'),util['inspect'](_0x26bc7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x69')]=function(_0x41e76f){this[_0xc4eb('0x13')]=!![];};VoiceQueueReport[_0xc4eb('0xa')]['syncNewExten']=function(_0x4a425){};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x1a')]=function(_0x14cc82){try{if(this[_0xc4eb('0x5d')](_0x14cc82)){if(_[_0xc4eb('0x2c')](this[_0xc4eb('0x3e')][_0x14cc82[_0xc4eb('0x6a')]])){this[_0xc4eb('0x3e')][_0x14cc82[_0xc4eb('0x6a')]]=[];this[_0xc4eb('0x10')][_0x14cc82[_0xc4eb('0x6a')]]={};}var _0x5714ff=new QueueReport();_0x5714ff['name']=_0x14cc82[_0xc4eb('0x63')];_0x5714ff['type']=this[_0xc4eb('0x12')][_0x5714ff[_0xc4eb('0x4b')]]&&this[_0xc4eb('0x12')][_0x5714ff[_0xc4eb('0x4b')]][_0xc4eb('0x4d')]?this['voiceQueues'][_0x5714ff[_0xc4eb('0x4b')]]['type']||_0xc4eb('0x4e'):_0xc4eb('0x4e');_0x5714ff[_0xc4eb('0x63')]=_0x14cc82[_0xc4eb('0x63')];_0x5714ff[_0xc4eb('0x6b')]=moment()[_0xc4eb('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5714ff[_0xc4eb('0x6c')]=_0x14cc82[_0xc4eb('0x6c')];_0x5714ff[_0xc4eb('0x6d')]=_0x14cc82[_0xc4eb('0x6d')];_['merge'](_0x5714ff,_[_0xc4eb('0x6e')](_0x14cc82,_[_0xc4eb('0x6f')](_0x5714ff)));this[_0xc4eb('0x3e')][_0x14cc82[_0xc4eb('0x6a')]][_0xc4eb('0x70')](_0x5714ff);this['channels'][_0x14cc82[_0xc4eb('0x6a')]]=_0x5714ff;this[_0xc4eb('0x45')](_0x5714ff);}}catch(_0x40f7be){logger[_0xc4eb('0x3c')](_0xc4eb('0x71'),util[_0xc4eb('0x43')](_0x40f7be,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc4eb('0x1c')]=function(_0x3b5b65){try{if(this[_0xc4eb('0x5d')](_0x3b5b65)){if(this[_0xc4eb('0x3e')][_0x3b5b65[_0xc4eb('0x6a')]]){var _0x463c1d=_[_0xc4eb('0x72')](this[_0xc4eb('0x3e')][_0x3b5b65[_0xc4eb('0x6a')]]);_0x463c1d['queuecallercomplete']=![];_0x463c1d['queuecallercompleteAt']=null;_0x463c1d[_0xc4eb('0x73')]=_0x3b5b65['holdtime'];_0x463c1d[_0xc4eb('0x74')]=_0x3b5b65['originalposition'];_0x463c1d[_0xc4eb('0x1b')]=!![];_0x463c1d['queuecallerabandonAt']=moment()[_0xc4eb('0x46')](_0xc4eb('0x75'));_0x463c1d[_0xc4eb('0x76')]=_0xc4eb('0x77');_0x463c1d['lastAssignedTo']=null;this[_0xc4eb('0x10')][_0x3b5b65[_0xc4eb('0x6a')]]=_0x463c1d;this[_0xc4eb('0x48')](_0x463c1d);}}}catch(_0x20b588){logger['error'](_0xc4eb('0x78'),util[_0xc4eb('0x43')](_0x20b588,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x1d')]=function(_0x20017d){try{if(this[_0xc4eb('0x5d')](_0x20017d)){if(this['queueReports'][_0x20017d[_0xc4eb('0x6a')]]){var _0x247ca7=_[_0xc4eb('0x72')](this['queueReports'][_0x20017d[_0xc4eb('0x6a')]]);_0x247ca7['queuecallerleaveAt']=moment()[_0xc4eb('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x247ca7['connectedlinenum']=_0x20017d['connectedlinenum'];_0x247ca7[_0xc4eb('0x79')]=_0x20017d[_0xc4eb('0x79')];this['channels'][_0x20017d[_0xc4eb('0x6a')]]=_0x247ca7;this['emitVoiceQueueChannelSave'](_0x247ca7);}}}catch(_0x5abda4){logger[_0xc4eb('0x3c')](_0xc4eb('0x7a'),util['inspect'](_0x5abda4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc4eb('0x1f')]=function(_0x52e45d){try{if(this[_0xc4eb('0x5d')](_0x52e45d)){if(this[_0xc4eb('0x3e')][_0x52e45d[_0xc4eb('0x6a')]]){var _0x478910=_['last'](this[_0xc4eb('0x3e')][_0x52e45d['uniqueid']]);_0x478910['queuecallercomplete']=!![];_0x478910[_0xc4eb('0x76')]='COMPLETEDBYAGENT';}}}catch(_0x35623d){logger[_0xc4eb('0x3c')](_0xc4eb('0x7b'),util['inspect'](_0x35623d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc4eb('0x1e')]=function(_0x37b9ad){try{if(this['isNotNull'](_0x37b9ad)){if(this['queueReports'][_0x37b9ad[_0xc4eb('0x6a')]]){var _0x44d10f=_[_0xc4eb('0x72')](this['queueReports'][_0x37b9ad['uniqueid']]);_0x44d10f['queuecallerabandon']=![];_0x44d10f[_0xc4eb('0x7c')]=null;_0x44d10f[_0xc4eb('0x7d')]=!![];_0x44d10f[_0xc4eb('0x7e')]=_0x37b9ad['membername'];_0x44d10f[_0xc4eb('0x73')]=_0x37b9ad[_0xc4eb('0x73')];_0x44d10f[_0xc4eb('0x7f')]=!![];_0x44d10f[_0xc4eb('0x80')]=![];_0x44d10f['queuecallerexitAt']=null;if(!_0x44d10f[_0xc4eb('0x81')]){if(_0x37b9ad[_0xc4eb('0x82')]==_0xc4eb('0x81')){_0x44d10f[_0xc4eb('0x76')]=_0xc4eb('0x83');}else{if(_['startsWith'](_0x37b9ad['channel']['toLowerCase'](),_0xc4eb('0x84'))){if(this[_0xc4eb('0x3e')][_0x37b9ad[_0xc4eb('0x85')]]){var _0x148b74=_[_0xc4eb('0x72')](this[_0xc4eb('0x3e')][_0x37b9ad[_0xc4eb('0x85')]]);_0x148b74[_0xc4eb('0x7f')]=![];_0x148b74[_0xc4eb('0x80')]=!![];_0x148b74['queuecallerexitAt']=moment(_0x44d10f[_0xc4eb('0x6b')])['add'](_0x37b9ad[_0xc4eb('0x73')],'seconds')[_0xc4eb('0x46')](_0xc4eb('0x75'));_0x148b74['queuecallerexitreason']=_0xc4eb('0x86');_0x148b74['transfer']=!![];_0x148b74[_0xc4eb('0x87')]=_0xc4eb('0x88');_0x148b74[_0xc4eb('0x89')]=_0x37b9ad[_0xc4eb('0x8a')];_0x148b74[_0xc4eb('0x8b')]=_0x37b9ad['uniqueid'];var _0x4e26bf=this['queueReports'][_0x37b9ad['linkedid']];this['queueReports'][_0x37b9ad['linkedid']]=this[_0xc4eb('0x3e')][_0x37b9ad[_0xc4eb('0x6a')]];this['queueReports'][_0x37b9ad['uniqueid']]=_0x4e26bf;}}else{_0x44d10f['queuecallerexitreason']=_0xc4eb('0x8c')+_0x37b9ad[_0xc4eb('0x82')]['toUpperCase']();}}}this[_0xc4eb('0x10')][_0x37b9ad[_0xc4eb('0x6a')]]=_0x44d10f;this['emitVoiceQueueChannelRemove'](_0x44d10f);}}}catch(_0x226a01){logger[_0xc4eb('0x3c')]('[syncAgentComplete][VoiceQueueReport]',util['inspect'](_0x226a01,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x20')]=function(_0x3db5a9){try{if(this['isNotNull'](_0x3db5a9)){this[_0xc4eb('0x8d')](_0x3db5a9[_0xc4eb('0x6a')],_[_0xc4eb('0x6f')](_0x3db5a9['variable'])[0x0],_0x3db5a9[_0xc4eb('0x8e')]);if(this[_0xc4eb('0x3e')][_0x3db5a9[_0xc4eb('0x6a')]]){var _0x4264fb=_[_0xc4eb('0x72')](this[_0xc4eb('0x3e')][_0x3db5a9[_0xc4eb('0x6a')]]);if(_0x4264fb){if(this[_0xc4eb('0x5d')](_0x3db5a9['variable'])&&this[_0xc4eb('0x5d')](_0x3db5a9['variable'][_0xc4eb('0x8f')])){switch(_0x3db5a9[_0xc4eb('0x8e')]){case'CONTINUE':_0x4264fb[_0xc4eb('0x80')]=![];_0x4264fb[_0xc4eb('0x90')]=null;break;case _0xc4eb('0x91'):_0x4264fb[_0xc4eb('0x92')]=_0xc4eb('0x93');ami['emit'](_0xc4eb('0x94'),_0x4264fb);break;default:_0x4264fb[_0xc4eb('0x80')]=!![];_0x4264fb['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4264fb[_0xc4eb('0x95')]=moment()[_0xc4eb('0x46')](_0xc4eb('0x75'));}_0x4264fb[_0xc4eb('0x1b')]=![];_0x4264fb[_0xc4eb('0x7c')]=null;_0x4264fb[_0xc4eb('0x76')]=_0x3db5a9[_0xc4eb('0x8e')];this['channels'][_0x3db5a9[_0xc4eb('0x6a')]]=_0x4264fb;this[_0xc4eb('0x48')](_0x4264fb);}else if(this['isNotNull'](_0x3db5a9['variable'])&&this['isNotNull'](_0x3db5a9['variable'][_0xc4eb('0x96')])){if(!_0x4264fb['queuecallerabandon']){_0x4264fb[_0xc4eb('0x80')]=!![];_0x4264fb['queuecallerexitAt']=moment()['format'](_0xc4eb('0x75'));_0x4264fb[_0xc4eb('0x76')]=_0xc4eb('0x97');_0x4264fb['queuecallerleaveAt']=moment()[_0xc4eb('0x46')](_0xc4eb('0x75'));this['channels'][_0x3db5a9[_0xc4eb('0x6a')]]=_0x4264fb;}}_0x4264fb[_0xc4eb('0x15')]=this[_0xc4eb('0x15')][_0x3db5a9[_0xc4eb('0x6a')]];}}}}catch(_0x5bafef){logger['error'](_0xc4eb('0x98'),util['inspect'](_0x5bafef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x8d')]=function(_0x32252a,_0x33e056,_0x5554b8){var _0xcff95a=['rtpaudioqos',_0xc4eb('0x99'),_0xc4eb('0x9a'),_0xc4eb('0x9b'),'rtpaudioqosloss',_0xc4eb('0x9c'),_0xc4eb('0x9d'),'rtpaudioqosrttbridged',_0xc4eb('0x9e'),_0xc4eb('0x9f'),_0xc4eb('0xa0'),_0xc4eb('0xa1'),_0xc4eb('0xa2'),'memberdynamic',_0xc4eb('0xa3'),_0xc4eb('0xa4'),_0xc4eb('0xa5'),_0xc4eb('0xa6'),_0xc4eb('0xa7')];if(!_['isNil'](_0x33e056)&&!_['includes'](_0xcff95a,_0x33e056)){if(_['isUndefined'](this[_0xc4eb('0x15')][_0x32252a])){this[_0xc4eb('0x15')][_0x32252a]={};}this[_0xc4eb('0x15')][_0x32252a][_0x33e056]=_0x5554b8;}};VoiceQueueReport[_0xc4eb('0xa')][_0xc4eb('0x21')]=function(_0x1c9cc9){try{if(this[_0xc4eb('0x5d')](_0x1c9cc9)){if(this[_0xc4eb('0x3e')][_0x1c9cc9[_0xc4eb('0x6a')]]){for(var _0x5d2e34=0x0,_0x4038d6={};_0x5d2e340x0?_0x10d8e2:0x0;this[_0x3ea2('0x15')][_0xe7ba30[_0x3ea2('0x5d')]][_0x3ea2('0x30')]=this[_0x3ea2('0x15')][_0xe7ba30[_0x3ea2('0x5d')]][_0x3ea2('0x30')]>_[_0x3ea2('0x5f')](_0xe7ba30[_0x3ea2('0x61')])?_[_0x3ea2('0x5f')](_0xe7ba30['loggedin']):this['voiceQueues'][_0xe7ba30[_0x3ea2('0x5d')]][_0x3ea2('0x30')];this[_0x3ea2('0x4a')](this[_0x3ea2('0x15')][_0xe7ba30[_0x3ea2('0x5d')]]);}ami['emit'](_0x3ea2('0x64'),this['voiceQueues'][_0xe7ba30[_0x3ea2('0x5d')]]);}}}catch(_0x4e1ad8){logger[_0x3ea2('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util[_0x3ea2('0x44')](_0x4e1ad8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x19')]=function(_0x514637){this[_0x3ea2('0x16')]=!![];};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x65')]=function(_0x3d8881){};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x66')]=function(_0xe9ee16){try{if(this[_0x3ea2('0x58')](_0xe9ee16)){if(_['isUndefined'](this['queueReports'][_0xe9ee16['uniqueid']])){this['queueReports'][_0xe9ee16[_0x3ea2('0x67')]]=[];this[_0x3ea2('0x13')][_0xe9ee16[_0x3ea2('0x67')]]={};}var _0x1c9348=new QueueReport();_0x1c9348[_0x3ea2('0x47')]=_0xe9ee16[_0x3ea2('0x5d')];_0x1c9348['type']=this[_0x3ea2('0x15')][_0x1c9348[_0x3ea2('0x47')]]&&this[_0x3ea2('0x15')][_0x1c9348[_0x3ea2('0x47')]]['type']?this[_0x3ea2('0x15')][_0x1c9348[_0x3ea2('0x47')]][_0x3ea2('0x4b')]||_0x3ea2('0x4c'):_0x3ea2('0x4c');_0x1c9348[_0x3ea2('0x5d')]=_0xe9ee16[_0x3ea2('0x5d')];_0x1c9348['queuecallerjoinAt']=moment()[_0x3ea2('0x56')](_0x3ea2('0x68'));_0x1c9348[_0x3ea2('0x69')]=_0xe9ee16[_0x3ea2('0x69')];_0x1c9348[_0x3ea2('0x6a')]=_0xe9ee16[_0x3ea2('0x6a')];_[_0x3ea2('0x6b')](_0x1c9348,_['pick'](_0xe9ee16,_['keys'](_0x1c9348)));this[_0x3ea2('0x11')][_0xe9ee16[_0x3ea2('0x67')]][_0x3ea2('0x6c')](_0x1c9348);this[_0x3ea2('0x13')][_0xe9ee16[_0x3ea2('0x67')]]=_0x1c9348;this[_0x3ea2('0x6d')](_0x1c9348);}}catch(_0x4dc689){logger[_0x3ea2('0x3c')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x3ea2('0x44')](_0x4dc689,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x1c')]=function(_0x438f3e){try{if(this[_0x3ea2('0x58')](_0x438f3e)){if(this[_0x3ea2('0x11')][_0x438f3e['uniqueid']]){var _0x58f8ee=_['last'](this[_0x3ea2('0x11')][_0x438f3e['uniqueid']]);_0x58f8ee[_0x3ea2('0x6e')]=![];_0x58f8ee[_0x3ea2('0x6f')]=null;_0x58f8ee['holdtime']=_0x438f3e[_0x3ea2('0x70')];_0x58f8ee['originalposition']=_0x438f3e[_0x3ea2('0x71')];_0x58f8ee[_0x3ea2('0x1b')]=!![];_0x58f8ee[_0x3ea2('0x72')]=moment()[_0x3ea2('0x56')](_0x3ea2('0x68'));_0x58f8ee['queuecallerexitreason']=_0x3ea2('0x73');_0x58f8ee[_0x3ea2('0x74')]=null;this[_0x3ea2('0x13')][_0x438f3e[_0x3ea2('0x67')]]=_0x58f8ee;this[_0x3ea2('0x43')](_0x58f8ee);}}}catch(_0x3fcfc0){logger[_0x3ea2('0x3c')]('[syncQueueCallerAbandon][VoiceQueueReport]',util['inspect'](_0x3fcfc0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3ea2('0xc')]['syncQueueCallerLeave']=function(_0x518bef){try{if(this[_0x3ea2('0x58')](_0x518bef)){if(this[_0x3ea2('0x11')][_0x518bef[_0x3ea2('0x67')]]){var _0x144aea=_[_0x3ea2('0x75')](this['queueReports'][_0x518bef[_0x3ea2('0x67')]]);_0x144aea['queuecallerleaveAt']=moment()[_0x3ea2('0x56')](_0x3ea2('0x68'));_0x144aea[_0x3ea2('0x76')]=_0x518bef[_0x3ea2('0x76')];_0x144aea[_0x3ea2('0x77')]=_0x518bef['connectedlinename'];this[_0x3ea2('0x13')][_0x518bef['uniqueid']]=_0x144aea;this[_0x3ea2('0x6d')](_0x144aea);}}}catch(_0x1d8967){logger[_0x3ea2('0x3c')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x3ea2('0x44')](_0x1d8967,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3ea2('0x78')]=function(_0x262c6b){try{if(this[_0x3ea2('0x58')](_0x262c6b)){if(this[_0x3ea2('0x11')][_0x262c6b[_0x3ea2('0x67')]]){var _0x64bb72=_['last'](this[_0x3ea2('0x11')][_0x262c6b[_0x3ea2('0x67')]]);_0x64bb72[_0x3ea2('0x6e')]=!![];_0x64bb72[_0x3ea2('0x79')]=_0x3ea2('0x7a');}}}catch(_0x346c54){logger[_0x3ea2('0x3c')](_0x3ea2('0x7b'),util['inspect'](_0x346c54,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x60487f){try{if(this[_0x3ea2('0x58')](_0x60487f)){if(this[_0x3ea2('0x11')][_0x60487f['uniqueid']]){var _0x2ad942=_[_0x3ea2('0x75')](this[_0x3ea2('0x11')][_0x60487f['uniqueid']]);_0x2ad942[_0x3ea2('0x1b')]=![];_0x2ad942['queuecallerabandonAt']=null;_0x2ad942[_0x3ea2('0x7c')]=!![];_0x2ad942['lastAssignedTo']=_0x60487f[_0x3ea2('0x7d')];_0x2ad942[_0x3ea2('0x70')]=_0x60487f[_0x3ea2('0x70')];_0x2ad942[_0x3ea2('0x6e')]=!![];_0x2ad942['queuecallerexit']=![];_0x2ad942['queuecallerexitAt']=null;if(!_0x2ad942[_0x3ea2('0x7e')]){if(_0x60487f[_0x3ea2('0x7f')]=='transfer'){_0x2ad942[_0x3ea2('0x79')]=_0x3ea2('0x80');}else{if(_[_0x3ea2('0x81')](_0x60487f['channel'][_0x3ea2('0x82')](),'local/')){if(this[_0x3ea2('0x11')][_0x60487f['linkedid']]){var _0x220fb7=_[_0x3ea2('0x75')](this[_0x3ea2('0x11')][_0x60487f[_0x3ea2('0x83')]]);_0x220fb7['queuecallercomplete']=![];_0x220fb7[_0x3ea2('0x84')]=!![];_0x220fb7[_0x3ea2('0x85')]=moment(_0x2ad942[_0x3ea2('0x86')])[_0x3ea2('0x87')](_0x60487f[_0x3ea2('0x70')],_0x3ea2('0x88'))[_0x3ea2('0x56')](_0x3ea2('0x68'));_0x220fb7['queuecallerexitreason']=_0x3ea2('0x89');_0x220fb7[_0x3ea2('0x7e')]=!![];_0x220fb7[_0x3ea2('0x8a')]='FORWARD';_0x220fb7[_0x3ea2('0x8b')]=_0x60487f['destexten'];_0x220fb7['transferuniqueid']=_0x60487f[_0x3ea2('0x67')];var _0x1428b6=this[_0x3ea2('0x11')][_0x60487f[_0x3ea2('0x83')]];this['queueReports'][_0x60487f[_0x3ea2('0x83')]]=this['queueReports'][_0x60487f['uniqueid']];this[_0x3ea2('0x11')][_0x60487f[_0x3ea2('0x67')]]=_0x1428b6;}}else{_0x2ad942[_0x3ea2('0x79')]='COMPLETEDBY'+_0x60487f[_0x3ea2('0x7f')][_0x3ea2('0x8c')]();}}}this[_0x3ea2('0x13')][_0x60487f['uniqueid']]=_0x2ad942;this[_0x3ea2('0x43')](_0x2ad942);}}}catch(_0x4f3ccf){logger['error']('[syncAgentComplete][VoiceQueueReport]',util[_0x3ea2('0x44')](_0x4f3ccf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x8d')]=function(_0xb94dd){try{if(this[_0x3ea2('0x58')](_0xb94dd)){this['addVariable'](_0xb94dd[_0x3ea2('0x67')],_[_0x3ea2('0x8e')](_0xb94dd[_0x3ea2('0x8f')])[0x0],_0xb94dd[_0x3ea2('0x90')]);if(this[_0x3ea2('0x11')][_0xb94dd[_0x3ea2('0x67')]]){var _0x48d8be=_[_0x3ea2('0x75')](this[_0x3ea2('0x11')][_0xb94dd[_0x3ea2('0x67')]]);if(_0x48d8be){if(this[_0x3ea2('0x58')](_0xb94dd[_0x3ea2('0x8f')])&&this['isNotNull'](_0xb94dd[_0x3ea2('0x8f')][_0x3ea2('0x91')])){switch(_0xb94dd[_0x3ea2('0x90')]){case _0x3ea2('0x92'):_0x48d8be[_0x3ea2('0x84')]=![];_0x48d8be['queuecallerexitAt']=null;break;case'TIMEOUT':_0x48d8be['lastevent']='timeout';ami[_0x3ea2('0x45')](_0x3ea2('0x93'),_0x48d8be);break;default:_0x48d8be[_0x3ea2('0x84')]=!![];_0x48d8be[_0x3ea2('0x85')]=moment()[_0x3ea2('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x48d8be['queuecallerleaveAt']=moment()[_0x3ea2('0x56')](_0x3ea2('0x68'));}_0x48d8be[_0x3ea2('0x1b')]=![];_0x48d8be[_0x3ea2('0x72')]=null;_0x48d8be[_0x3ea2('0x79')]=_0xb94dd[_0x3ea2('0x90')];this[_0x3ea2('0x13')][_0xb94dd['uniqueid']]=_0x48d8be;this[_0x3ea2('0x43')](_0x48d8be);}else if(this['isNotNull'](_0xb94dd[_0x3ea2('0x8f')])&&this[_0x3ea2('0x58')](_0xb94dd[_0x3ea2('0x8f')][_0x3ea2('0x94')])){if(!_0x48d8be[_0x3ea2('0x1b')]){_0x48d8be['queuecallerexit']=!![];_0x48d8be[_0x3ea2('0x85')]=moment()[_0x3ea2('0x56')](_0x3ea2('0x68'));_0x48d8be[_0x3ea2('0x79')]='EXITWITHKEY';_0x48d8be[_0x3ea2('0x95')]=moment()['format'](_0x3ea2('0x68'));this[_0x3ea2('0x13')][_0xb94dd[_0x3ea2('0x67')]]=_0x48d8be;}}_0x48d8be[_0x3ea2('0x17')]=this['variables'][_0xb94dd[_0x3ea2('0x67')]];}}}}catch(_0x4334a1){logger[_0x3ea2('0x3c')](_0x3ea2('0x96'),util[_0x3ea2('0x44')](_0x4334a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x97')]=function(_0x3eb4c4,_0x523ece,_0x3a1d32){var _0x276910=[_0x3ea2('0x98'),_0x3ea2('0x99'),_0x3ea2('0x9a'),'rtpaudioqosjitterbridged',_0x3ea2('0x9b'),_0x3ea2('0x9c'),_0x3ea2('0x9d'),_0x3ea2('0x9e'),'sipcallid',_0x3ea2('0x9f'),_0x3ea2('0xa0'),'bridgepvtcallid',_0x3ea2('0xa1'),'memberdynamic',_0x3ea2('0xa2'),_0x3ea2('0xa3'),_0x3ea2('0x7d'),_0x3ea2('0xa4'),_0x3ea2('0xa5')];if(!_[_0x3ea2('0x35')](_0x523ece)&&!_[_0x3ea2('0xa6')](_0x276910,_0x523ece)){if(_[_0x3ea2('0x2c')](this['variables'][_0x3eb4c4])){this[_0x3ea2('0x17')][_0x3eb4c4]={};}this[_0x3ea2('0x17')][_0x3eb4c4][_0x523ece]=_0x3a1d32;}};VoiceQueueReport[_0x3ea2('0xc')][_0x3ea2('0x23')]=function(_0x379feb){try{if(this['isNotNull'](_0x379feb)){if(this['queueReports'][_0x379feb[_0x3ea2('0x67')]]){for(var _0x177501=0x0,_0x2867ca={};_0x177501=0x0?moment(_0x474a7a[_0x3853('0x17')])[_0x3853('0xa')](_0x474a7a[_0x3853('0x16')],_0x3853('0xb')):null,'data1':'outbound','data2':_0x474a7a[_0x3853('0x10')],'data3':_0x474a7a[_0x3853('0xd')],'data4':_0x474a7a[_0x3853('0x18')]||null,'role':_0x3853('0xf'),'internal':_0x474a7a[_0x3853('0x10')]?_[_0x3853('0x19')](_0x474a7a[_0x3853('0x10')]):undefined,'uniqueid':_0x474a7a[_0x3853('0x11')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x16c9=['seconds','outbound','moment','util','voiceQueueReport','queuecallercompleteAt','Request','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime'];(function(_0x1f9e74,_0x527c84){var _0x4db7dd=function(_0x4cf4b7){while(--_0x4cf4b7){_0x1f9e74['push'](_0x1f9e74['shift']());}};_0x4db7dd(++_0x527c84);}(_0x16c9,0x98));var _0x916c=function(_0x33623b,_0x50174f){_0x33623b=_0x33623b-0x0;var _0x12710a=_0x16c9[_0x33623b];return _0x12710a;};'use strict';var moment=require(_0x916c('0x0'));var _=require('lodash');var util=require(_0x916c('0x1'));var client=require('../client');exports[_0x916c('0x2')]=function(_0x16643e){var _0x4bcd92=_0x16643e[_0x916c('0x3')]||_0x16643e['queuecallerexitAt'];return client[_0x916c('0x4')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x16643e[_0x916c('0x5')],'interface':_[_0x916c('0x6')](_0x16643e[_0x916c('0x7')])?util['format']('SIP/%s',_0x16643e[_0x916c('0x5')]):_0x16643e['interface'],'type':_0x916c('0x8'),'enterAt':_0x16643e[_0x916c('0x9')],'exitAt':_0x4bcd92,'duration':moment(_0x4bcd92)[_0x916c('0xa')](_0x16643e[_0x916c('0x9')],'seconds'),'data1':'inbound','data2':_0x16643e[_0x916c('0xb')],'data3':_0x16643e[_0x916c('0xc')],'data4':null,'data5':_0x16643e[_0x916c('0xd')],'role':_0x916c('0xe'),'internal':_0x16643e[_0x916c('0xf')]?_[_0x916c('0x10')](_0x16643e[_0x916c('0xf')]):undefined,'uniqueid':_0x16643e[_0x916c('0x11')]},'log':_0x916c('0x12')});};exports[_0x916c('0x13')]=function(_0x52cc62){return client[_0x916c('0x4')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x52cc62[_0x916c('0x14')],'interface':_0x52cc62[_0x916c('0x7')],'type':_0x916c('0x8'),'enterAt':_0x52cc62[_0x916c('0x15')],'exitAt':_0x52cc62[_0x916c('0x16')],'duration':moment(_0x52cc62['endtime'])['diff'](_0x52cc62[_0x916c('0x15')],_0x916c('0x17'))>=0x0?moment(_0x52cc62[_0x916c('0x16')])[_0x916c('0xa')](_0x52cc62[_0x916c('0x15')],_0x916c('0x17')):null,'data1':_0x916c('0x18'),'data2':_0x52cc62[_0x916c('0xf')],'data3':_0x52cc62[_0x916c('0xc')],'data4':_0x52cc62['dialstring']||null,'role':'agent','internal':_0x52cc62[_0x916c('0xf')]?_[_0x916c('0x10')](_0x52cc62['accountcode']):undefined,'uniqueid':_0x52cc62[_0x916c('0x11')]},'log':_0x916c('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4bd98ba..0f93219 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 _0x6a24=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6a24,0xd1));var _0x46a2=function(_0x5ebec6,_0x408641){_0x5ebec6=_0x5ebec6-0x0;var _0xcd8e11=_0x6a24[_0x5ebec6];return _0xcd8e11;};'use strict';var client=require(_0x46a2('0x0'));exports[_0x46a2('0x1')]=function(_0x47ae22){return function(_0x2af532){return client[_0x46a2('0x2')](_0x46a2('0x3'),{'options':{'raw':!![],'attributes':['id',_0x46a2('0x4'),_0x46a2('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x3eec=['getTemplates','GetTemplate','name','html','../client'];(function(_0x352fd6,_0x19f685){var _0x40d92b=function(_0x386d98){while(--_0x386d98){_0x352fd6['push'](_0x352fd6['shift']());}};_0x40d92b(++_0x19f685);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x4f8ccd,_0x5bb42b){_0x4f8ccd=_0x4f8ccd-0x0;var _0x2740f7=_0x3eec[_0x4f8ccd];return _0x2740f7;};'use strict';var client=require(_0xc3ee('0x0'));exports[_0xc3ee('0x1')]=function(_0x181c8e){return function(_0x3b1908){return client['Request'](_0xc3ee('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc3ee('0x3'),_0xc3ee('0x4')]},'log':_0xc3ee('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b3d8330..66b3412 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 _0xd545=['AnyConditions','Actions','action','data1','data2','data3','data4','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value'];(function(_0x44bcbd,_0x14cf9c){var _0x32c410=function(_0xb3ba0a){while(--_0xb3ba0a){_0x44bcbd['push'](_0x44bcbd['shift']());}};_0x32c410(++_0x14cf9c);}(_0xd545,0x17d));var _0x5d54=function(_0x4e7583,_0x3f020f){_0x4e7583=_0x4e7583-0x0;var _0x392a98=_0xd545[_0x4e7583];return _0x392a98;};'use strict';var client=require('../client');exports[_0x5d54('0x0')]=function(_0x3f1289){return function(_0xa5cc6e){return client[_0x5d54('0x1')](_0x5d54('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5d54('0x3'),_0x5d54('0x4')],'include':[{'model':_0x5d54('0x5'),'as':_0x5d54('0x6'),'attributes':['id',_0x5d54('0x7'),_0x5d54('0x8'),_0x5d54('0x9')]},{'model':_0x5d54('0x5'),'as':_0x5d54('0xa'),'attributes':['id',_0x5d54('0x7'),_0x5d54('0x8'),_0x5d54('0x9')]},{'model':'Action','as':_0x5d54('0xb'),'attributes':['id',_0x5d54('0xc'),_0x5d54('0xd'),_0x5d54('0xe'),_0x5d54('0xf'),_0x5d54('0x10'),'data5','data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x78ba=['GetTrigger','../client','Request','name','status','Condition','field','operator','value','AnyConditions','Action','action','data1','data2','data3','data4','data6'];(function(_0x24bb02,_0x267e74){var _0x1c85ab=function(_0x18e571){while(--_0x18e571){_0x24bb02['push'](_0x24bb02['shift']());}};_0x1c85ab(++_0x267e74);}(_0x78ba,0xcd));var _0xa78b=function(_0x315170,_0x58e0a0){_0x315170=_0x315170-0x0;var _0x121fd4=_0x78ba[_0x315170];return _0x121fd4;};'use strict';var client=require(_0xa78b('0x0'));exports['getTriggers']=function(_0x9cc6e4){return function(_0x252cdc){return client[_0xa78b('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xa78b('0x2'),'channel',_0xa78b('0x3')],'include':[{'model':_0xa78b('0x4'),'as':'AllConditions','attributes':['id',_0xa78b('0x5'),_0xa78b('0x6'),_0xa78b('0x7')]},{'model':_0xa78b('0x4'),'as':_0xa78b('0x8'),'attributes':['id','field',_0xa78b('0x6'),_0xa78b('0x7')]},{'model':_0xa78b('0x9'),'as':'Actions','attributes':['id',_0xa78b('0xa'),_0xa78b('0xb'),_0xa78b('0xc'),_0xa78b('0xd'),_0xa78b('0xe'),'data5',_0xa78b('0xf'),'data7']}]},'log':_0xa78b('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8e606e0..5bd5d3c 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 _0xb1dd=['Request','GetTrunk','registry','../client','getTrunks'];(function(_0x53fac3,_0x3b238a){var _0x496254=function(_0x4f0e0a){while(--_0x4f0e0a){_0x53fac3['push'](_0x53fac3['shift']());}};_0x496254(++_0x3b238a);}(_0xb1dd,0x18e));var _0xdb1d=function(_0x218b2a,_0x4bf292){_0x218b2a=_0x218b2a-0x0;var _0x54d301=_0xb1dd[_0x218b2a];return _0x54d301;};'use strict';var client=require(_0xdb1d('0x0'));exports[_0xdb1d('0x1')]=function(_0x516ef0){return function(_0x3ec6df){return client[_0xdb1d('0x2')](_0xdb1d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xdb1d('0x4')]},'log':_0xdb1d('0x3')});};}; \ No newline at end of file +var _0x3f08=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x189061,_0x21d774){var _0x257e15=function(_0x1e4a36){while(--_0x1e4a36){_0x189061['push'](_0x189061['shift']());}};_0x257e15(++_0x21d774);}(_0x3f08,0x127));var _0x83f0=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3f08[_0x110c3d];return _0x226d67;};'use strict';var client=require(_0x83f0('0x0'));exports[_0x83f0('0x1')]=function(_0x4d7954){return function(_0xf8c2d4){return client[_0x83f0('0x2')](_0x83f0('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x83f0('0x4'),_0x83f0('0x5')]},'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 dbddeba..406e7d2 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 _0x9686=['getAgents','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','lastLoginAt','pauseType','Request','GetUser','agent','name','email','accountcode','fullname','online','voicePause','mobile','interface'];(function(_0x5bee28,_0x1dc7e2){var _0x395d1d=function(_0x33af90){while(--_0x33af90){_0x5bee28['push'](_0x5bee28['shift']());}};_0x395d1d(++_0x1dc7e2);}(_0x9686,0x1ef));var _0x6968=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9686[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x6968('0x0')](_0x6968('0x1'),{'options':{'raw':![],'where':{'role':_0x6968('0x2')},'attributes':['id',_0x6968('0x3'),_0x6968('0x4'),_0x6968('0x5'),_0x6968('0x6'),_0x6968('0x7'),'lastLoginAt','pauseType','lastPauseAt',_0x6968('0x8'),'phone',_0x6968('0x9'),_0x6968('0xa')]},'log':_0x6968('0xb')});};};exports[_0x6968('0xc')]=function(){return function(){return client[_0x6968('0x0')](_0x6968('0x1'),{'options':{'raw':!![],'where':{'role':_0x6968('0xd')},'attributes':['id',_0x6968('0x3'),_0x6968('0x5'),_0x6968('0xe')]},'log':'getTelephones'});};};exports[_0x6968('0xf')]=function(_0x50d749,_0xce3177,_0xdb98b1){return client[_0x6968('0x0')](_0x6968('0x10'),{'body':{'type':_0xce3177,'uniqueid':_0xdb98b1},'options':{'where':{'id':_0x50d749['id']}},'log':_0x6968('0xf')});};exports[_0x6968('0x11')]=function(_0x1c35fd){return client[_0x6968('0x0')](_0x6968('0x12'),{'body':{},'options':{'where':{'id':_0x1c35fd['id']}},'log':'savePause'});};exports[_0x6968('0x13')]=function(_0x1873a2){return client[_0x6968('0x0')](_0x6968('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x1873a2},'attributes':['id',_0x6968('0x3'),'email',_0x6968('0x5'),'fullname',_0x6968('0x7'),_0x6968('0x15'),_0x6968('0x16'),'lastPauseAt','voicePause','interface']},'log':_0x6968('0x13')});}; \ No newline at end of file +var _0x752e=['Request','GetUser','agent','accountcode','fullname','lastLoginAt','lastPauseAt','voicePause','phone','name','internal','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','email','online','pauseType','interface','../client','getAgents'];(function(_0x30bbd8,_0x5b98d9){var _0x16448a=function(_0x3784b7){while(--_0x3784b7){_0x30bbd8['push'](_0x30bbd8['shift']());}};_0x16448a(++_0x5b98d9);}(_0x752e,0x132));var _0xe752=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x752e[_0x39096d];return _0x13da4f;};'use strict';var client=require(_0xe752('0x0'));exports[_0xe752('0x1')]=function(){return function(){return client[_0xe752('0x2')](_0xe752('0x3'),{'options':{'raw':![],'where':{'role':_0xe752('0x4')},'attributes':['id','name','email',_0xe752('0x5'),_0xe752('0x6'),'online',_0xe752('0x7'),'pauseType',_0xe752('0x8'),_0xe752('0x9'),_0xe752('0xa'),'mobile','interface']},'log':_0xe752('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0xe752('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xe752('0xb'),'accountcode',_0xe752('0xc')]},'log':'getTelephones'});};};exports['savePause']=function(_0x95e885,_0xe1aaff,_0x25fc63){return client[_0xe752('0x2')]('PauseUser',{'body':{'type':_0xe1aaff,'uniqueid':_0x25fc63},'options':{'where':{'id':_0x95e885['id']}},'log':_0xe752('0xd')});};exports[_0xe752('0xe')]=function(_0x3b3c17){return client[_0xe752('0x2')](_0xe752('0xf'),{'body':{},'options':{'where':{'id':_0x3b3c17['id']}},'log':_0xe752('0xd')});};exports[_0xe752('0x10')]=function(_0x2e7320){return client[_0xe752('0x2')](_0xe752('0x11'),{'options':{'raw':![],'where':{'role':'agent','id':_0x2e7320},'attributes':['id',_0xe752('0xb'),_0xe752('0x12'),_0xe752('0x5'),_0xe752('0x6'),_0xe752('0x13'),_0xe752('0x7'),_0xe752('0x14'),_0xe752('0x8'),_0xe752('0x9'),_0xe752('0x15')]},'log':_0xe752('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ece5083..e053ba8 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 _0x2413=['Request','UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update'];(function(_0x29ac6b,_0x184514){var _0x44a29b=function(_0x2dad03){while(--_0x2dad03){_0x29ac6b['push'](_0x29ac6b['shift']());}};_0x44a29b(++_0x184514);}(_0x2413,0x1a1));var _0x3241=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2413[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x3241('0x0'));exports['create']=function(_0xeeaee5){return client['Request'](_0x3241('0x1'),{'body':_0xeeaee5,'log':_0x3241('0x1')});};exports[_0x3241('0x2')]=function(_0x2b4c0d,_0x1e4a0e,_0x5c7fbb){return client[_0x3241('0x3')]('UpdateVoiceAgentReport',{'body':_0x2b4c0d,'options':{'where':{'uniqueid':_0x1e4a0e,'interface':_0x5c7fbb,'agentcomplete':!![]}},'log':_0x3241('0x4')});}; \ No newline at end of file +var _0x7c21=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c21,0x1e2));var _0x17c2=function(_0x37c6b9,_0x51d6d9){_0x37c6b9=_0x37c6b9-0x0;var _0x248460=_0x7c21[_0x37c6b9];return _0x248460;};'use strict';var client=require(_0x17c2('0x0'));exports[_0x17c2('0x1')]=function(_0x26bbf6){return client['Request'](_0x17c2('0x2'),{'body':_0x26bbf6,'log':_0x17c2('0x2')});};exports['update']=function(_0x12efff,_0x14878d,_0x352e2c){return client[_0x17c2('0x3')]('UpdateVoiceAgentReport',{'body':_0x12efff,'options':{'where':{'uniqueid':_0x14878d,'interface':_0x352e2c,'agentcomplete':!![]}},'log':_0x17c2('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6c58a8a..0f7e83c 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 _0x8361=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','outbound'];(function(_0x519081,_0x4ca66f){var _0x1d1cf3=function(_0x4595ec){while(--_0x4595ec){_0x519081['push'](_0x519081['shift']());}};_0x1d1cf3(++_0x4ca66f);}(_0x8361,0x104));var _0x1836=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8361[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0x1836('0x0'));var util=require(_0x1836('0x1'));var _=require(_0x1836('0x2'));var client=require(_0x1836('0x3'));exports[_0x1836('0x4')]=function(_0x42d158){return client[_0x1836('0x5')](_0x1836('0x6'),{'body':_[_0x1836('0x7')](_0x42d158,{'source':_0x42d158[_0x1836('0x8')],'destinationcontext':_0x42d158['context'],'callerid':_0x42d158[_0x1836('0x9')],'amaflags':_0x1836('0xa')}),'log':_0x1836('0x6')});};exports[_0x1836('0xb')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x1836('0xc')],'createdAt':{'$between':[moment()[_0x1836('0xd')](_0x1836('0xe'))[_0x1836('0xf')](_0x1836('0x10')),moment()['endOf'](_0x1836('0xe'))['format'](_0x1836('0x10'))]}},'attributes':['type',_0x1836('0x11'),_0x1836('0x12'),_0x1836('0x13')]},'log':_0x1836('0x14')});};}; \ No newline at end of file +var _0x9186=['duration','billableseconds','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9186,0x16b));var _0x6918=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x9186[_0x47e93d];return _0xe86c46;};'use strict';var moment=require('moment');var util=require(_0x6918('0x0'));var _=require(_0x6918('0x1'));var client=require(_0x6918('0x2'));exports['create']=function(_0x33cf7d){return client[_0x6918('0x3')](_0x6918('0x4'),{'body':_[_0x6918('0x5')](_0x33cf7d,{'source':_0x33cf7d[_0x6918('0x6')],'destinationcontext':_0x33cf7d[_0x6918('0x7')],'callerid':_0x33cf7d[_0x6918('0x8')],'amaflags':_0x6918('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x6918('0x3')](_0x6918('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x6918('0xb')](_0x6918('0xc'))[_0x6918('0xd')](_0x6918('0xe')),moment()[_0x6918('0xf')](_0x6918('0xc'))[_0x6918('0xd')](_0x6918('0xe'))]}},'attributes':['type',_0x6918('0x10'),_0x6918('0x11'),_0x6918('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2614115..e0cbcf3 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 _0xa4ec=['../client','Request','CreateVoiceDialReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4ec,0x192));var _0xca4e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xa4ec[_0x23e7c1];return _0x1add43;};'use strict';var client=require(_0xca4e('0x0'));exports['create']=function(_0xe0506b){return client[_0xca4e('0x1')](_0xca4e('0x2'),{'body':_0xe0506b,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xc299=['../client','Request','CreateVoiceDialReport'];(function(_0x34352e,_0x2f876e){var _0x314a46=function(_0x2ee2be){while(--_0x2ee2be){_0x34352e['push'](_0x34352e['shift']());}};_0x314a46(++_0x2f876e);}(_0xc299,0x7e));var _0x9c29=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xc299[_0x174ef5];return _0x1cc379;};'use strict';var client=require(_0x9c29('0x0'));exports['create']=function(_0x103e4a){return client[_0x9c29('0x1')](_0x9c29('0x2'),{'body':_0x103e4a,'log':_0x9c29('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 3028b02..ad6480e 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 _0x7e22=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client','Request'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x7e22,0x1d8));var _0x27e2=function(_0x22fe14,_0xcb99d6){_0x22fe14=_0x22fe14-0x0;var _0x1fc8af=_0x7e22[_0x22fe14];return _0x1fc8af;};'use strict';var client=require(_0x27e2('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x27e2('0x1')](_0x27e2('0x2'),{'options':{'raw':!![],'attributes':['id',_0x27e2('0x3'),_0x27e2('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x27e2('0x5')});};}; \ No newline at end of file +var _0x1b8e=['Request','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x484703,_0x4bf285){var _0x1e5fb4=function(_0x3be0a9){while(--_0x3be0a9){_0x484703['push'](_0x484703['shift']());}};_0x1e5fb4(++_0x4bf285);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x4c9c8f,_0x4e87f1){_0x4c9c8f=_0x4c9c8f-0x0;var _0x57e976=_0x1b8e[_0x4c9c8f];return _0x57e976;};'use strict';var client=require(_0xe1b8('0x0'));exports[_0xe1b8('0x1')]=function(){return function(){return client[_0xe1b8('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xe1b8('0x3'),_0xe1b8('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ccad246..a525195 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 _0x076d=['dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','interval','getVoiceQueues','../client','acw','monitor_format','type','dialActive'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x076d,0x6f));var _0xd076=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x076d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xd076('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xd076('0x1'),'acwTimeout','autopause',_0xd076('0x2'),_0xd076('0x3'),_0xd076('0x4'),_0xd076('0x5'),'dialLimitChannel',_0xd076('0x6'),_0xd076('0x7'),_0xd076('0x8'),_0xd076('0x9'),'dialPredictiveInterval',_0xd076('0xa'),'dialOriginateCallerIdNumber',_0xd076('0xb'),_0xd076('0xc'),_0xd076('0xd'),_0xd076('0xe'),_0xd076('0xf'),_0xd076('0x10'),_0xd076('0x11'),_0xd076('0x12'),_0xd076('0x13'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xd076('0x14'),'dialGlobalInterval','dialPrefix',_0xd076('0x15'),'dialAMDActive',_0xd076('0x16'),_0xd076('0x17'),_0xd076('0x18'),'dialAMDTotalAnalysisTime',_0xd076('0x19'),_0xd076('0x1a'),_0xd076('0x1b'),'dialAMDSilenceThreshold',_0xd076('0x1c'),_0xd076('0x1d'),_0xd076('0x1e'),_0xd076('0x1f'),'dialOrderByScheduledAt',_0xd076('0x20'),_0xd076('0x21'),_0xd076('0x22'),_0xd076('0x2'),_0xd076('0x23'),_0xd076('0x24'),_0xd076('0x25'),'dialNoSuchNumberMaxRetry',_0xd076('0x26'),_0xd076('0x27'),_0xd076('0x28'),_0xd076('0x29'),_0xd076('0x2a'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xd076('0x2b'),_0xd076('0x2c'),_0xd076('0x2d'),_0xd076('0x2e'),_0xd076('0x2f')],'include':[{'model':_0xd076('0x30'),'as':_0xd076('0x30'),'attributes':['id',_0xd076('0x31'),_0xd076('0x32'),'active']},{'model':_0xd076('0x33'),'as':_0xd076('0x34'),'attributes':['id',_0xd076('0x31')]},{'model':_0xd076('0x30'),'as':'TrunkBackup','attributes':['id','name','callerid',_0xd076('0x35')]},{'model':_0xd076('0x36'),'as':_0xd076('0x36'),'attributes':['id','name'],'include':[{'model':_0xd076('0x36'),'as':_0xd076('0x37'),'attributes':['id',_0xd076('0x31'),_0xd076('0x38')]}]}]},'log':_0xd076('0x39')});};}; \ No newline at end of file +var _0x8cc7=['dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','../client','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x3307e2,_0x4cafd6){var _0x263488=function(_0x1d0997){while(--_0x1d0997){_0x3307e2['push'](_0x3307e2['shift']());}};_0x263488(++_0x4cafd6);}(_0x8cc7,0x71));var _0x78cc=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8cc7[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x78cc('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x78cc('0x1'),_0x78cc('0x2'),_0x78cc('0x3'),_0x78cc('0x4'),_0x78cc('0x5'),_0x78cc('0x6'),_0x78cc('0x7'),_0x78cc('0x8'),_0x78cc('0x9'),_0x78cc('0xa'),_0x78cc('0xb'),_0x78cc('0xc'),'dialPredictiveOptimizationPercentage',_0x78cc('0xd'),_0x78cc('0xe'),_0x78cc('0xf'),_0x78cc('0x10'),_0x78cc('0x11'),_0x78cc('0x12'),'dialQueueProject',_0x78cc('0x13'),_0x78cc('0x14'),_0x78cc('0x15'),_0x78cc('0x16'),_0x78cc('0x17'),_0x78cc('0x18'),_0x78cc('0x19'),_0x78cc('0x1a'),_0x78cc('0x1b'),_0x78cc('0x1c'),_0x78cc('0x1d'),_0x78cc('0x1e'),'dialAMDInitialSilence','dialAMDGreeting',_0x78cc('0x1f'),_0x78cc('0x20'),_0x78cc('0x21'),_0x78cc('0x22'),_0x78cc('0x23'),_0x78cc('0x24'),_0x78cc('0x25'),_0x78cc('0x26'),_0x78cc('0x27'),_0x78cc('0x28'),_0x78cc('0x29'),_0x78cc('0x2a'),_0x78cc('0x2b'),_0x78cc('0x2c'),'monitor_format',_0x78cc('0x2d'),_0x78cc('0x2e'),_0x78cc('0x2f'),_0x78cc('0x30'),_0x78cc('0x31'),'dialDropMaxRetry',_0x78cc('0x32'),_0x78cc('0x33'),_0x78cc('0x34'),_0x78cc('0x35'),_0x78cc('0x36'),_0x78cc('0x37'),_0x78cc('0x38'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x78cc('0x39')],'include':[{'model':_0x78cc('0x3a'),'as':_0x78cc('0x3a'),'attributes':['id',_0x78cc('0x1'),_0x78cc('0x3b'),_0x78cc('0x3c')]},{'model':_0x78cc('0x3d'),'as':'mandatoryDispositionPause','attributes':['id',_0x78cc('0x1')]},{'model':_0x78cc('0x3a'),'as':_0x78cc('0x3e'),'attributes':['id',_0x78cc('0x1'),_0x78cc('0x3b'),_0x78cc('0x3c')]},{'model':_0x78cc('0x3f'),'as':_0x78cc('0x3f'),'attributes':['id',_0x78cc('0x1')],'include':[{'model':_0x78cc('0x3f'),'as':'Intervals','attributes':['id',_0x78cc('0x1'),_0x78cc('0x40')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f1dc6ae..c81c499 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 _0x691a=['queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt'];(function(_0x1d4c83,_0x56116b){var _0x4df7d8=function(_0x52871e){while(--_0x52871e){_0x1d4c83['push'](_0x1d4c83['shift']());}};_0x4df7d8(++_0x56116b);}(_0x691a,0x1d2));var _0xa691=function(_0x25bac7,_0x114eb1){_0x25bac7=_0x25bac7-0x0;var _0x48c03e=_0x691a[_0x25bac7];return _0x48c03e;};'use strict';var moment=require(_0xa691('0x0'));var _=require(_0xa691('0x1'));var client=require(_0xa691('0x2'));exports[_0xa691('0x3')]=function(_0x66bce1){return client[_0xa691('0x4')](_0xa691('0x5'),{'body':_0x66bce1,'log':'CreateVoiceQueueReport'});};exports[_0xa691('0x6')]=function(){return function(){return client[_0xa691('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xa691('0x7')](_0xa691('0x8'))['format'](_0xa691('0x9')),moment()[_0xa691('0xa')](_0xa691('0x8'))['format'](_0xa691('0x9'))]}},'attributes':[_0xa691('0xb'),_0xa691('0xc'),_0xa691('0xd'),'queuecallerleaveAt',_0xa691('0xe'),'queuecallercompleteAt',_0xa691('0xf'),_0xa691('0x10'),_0xa691('0x11'),_0xa691('0x12')]},'log':_0xa691('0x13')});};}; \ No newline at end of file +var _0x4a20=['CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create'];(function(_0x39c601,_0x3fdd8c){var _0x53d9d6=function(_0x2a5db3){while(--_0x2a5db3){_0x39c601['push'](_0x39c601['shift']());}};_0x53d9d6(++_0x3fdd8c);}(_0x4a20,0x75));var _0x04a2=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4a20[_0x1deb03];return _0x189fe7;};'use strict';var moment=require('moment');var _=require(_0x04a2('0x0'));var client=require(_0x04a2('0x1'));exports[_0x04a2('0x2')]=function(_0x4644cd){return client['Request'](_0x04a2('0x3'),{'body':_0x4644cd,'log':_0x04a2('0x3')});};exports[_0x04a2('0x4')]=function(){return function(){return client[_0x04a2('0x5')](_0x04a2('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x04a2('0x7')]('day')[_0x04a2('0x8')](_0x04a2('0x9')),moment()[_0x04a2('0xa')](_0x04a2('0xb'))[_0x04a2('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x04a2('0xc'),'queue',_0x04a2('0xd'),_0x04a2('0xe'),'queuecallercomplete',_0x04a2('0xf'),_0x04a2('0x10'),'queuecallerexitAt',_0x04a2('0x11'),_0x04a2('0x12')]},'log':_0x04a2('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 3827f57..e9bb823 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 _0xa3cc=['Request','getVoiceQueueRtPauses'];(function(_0x5ef4ef,_0x3c4dc8){var _0x614521=function(_0xd301cc){while(--_0xd301cc){_0x5ef4ef['push'](_0x5ef4ef['shift']());}};_0x614521(++_0x3c4dc8);}(_0xa3cc,0x1c7));var _0xca3c=function(_0x5cc6b0,_0x734023){_0x5cc6b0=_0x5cc6b0-0x0;var _0x10939a=_0xa3cc[_0x5cc6b0];return _0x10939a;};'use strict';var client=require('../client');exports[_0xca3c('0x0')]=function(_0x4bc7f4){return function(){return client[_0xca3c('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4bc7f4,'paused':!![]},'raw':!![]},'log':_0xca3c('0x0')});};}; \ No newline at end of file +var _0x79b2=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x79b2,0x1ef));var _0x279b=function(_0x4c2879,_0x286f0a){_0x4c2879=_0x4c2879-0x0;var _0x39cb77=_0x79b2[_0x4c2879];return _0x39cb77;};'use strict';var client=require(_0x279b('0x0'));exports[_0x279b('0x1')]=function(_0x2a4517){return function(){return client[_0x279b('0x2')](_0x279b('0x3'),{'options':{'where':{'VoiceQueueId':_0x2a4517,'paused':!![]},'raw':!![]},'log':_0x279b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b498075..3396b9b 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 _0x4a68=['create','Request','CreateVoiceRecording','monitorFilename','../client'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x4a68,0xbd));var _0x84a6=function(_0x58f233,_0x532edf){_0x58f233=_0x58f233-0x0;var _0x371209=_0x4a68[_0x58f233];return _0x371209;};'use strict';var _=require('lodash');var client=require(_0x84a6('0x0'));exports[_0x84a6('0x1')]=function(_0x21ef5c){return client[_0x84a6('0x2')](_0x84a6('0x3'),{'body':_['merge'](_0x21ef5c,{'value':_0x21ef5c[_0x84a6('0x4')]}),'log':_0x84a6('0x3')});}; \ No newline at end of file +var _0xfd0f=['../client','create','Request','CreateVoiceRecording','merge','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd0f,0x1f1));var _0xffd0=function(_0x4187ed,_0x192265){_0x4187ed=_0x4187ed-0x0;var _0x11eec5=_0xfd0f[_0x4187ed];return _0x11eec5;};'use strict';var _=require(_0xffd0('0x0'));var client=require(_0xffd0('0x1'));exports[_0xffd0('0x2')]=function(_0x50aaa5){return client[_0xffd0('0x3')](_0xffd0('0x4'),{'body':_[_0xffd0('0x5')](_0x50aaa5,{'value':_0x50aaa5['monitorFilename']}),'log':_0xffd0('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 3247f01..2cf634c 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 _0xe7fb=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7fb,0xeb));var _0xbe7f=function(_0x4ee194,_0x68c6ff){_0x4ee194=_0x4ee194-0x0;var _0x191036=_0xe7fb[_0x4ee194];return _0x191036;};'use strict';var client=require(_0xbe7f('0x0'));exports[_0xbe7f('0x1')]=function(_0x4cc122){return client[_0xbe7f('0x2')](_0xbe7f('0x3'),{'body':{'result':_0x4cc122[_0xbe7f('0x4')],'transfererchannel':_0x4cc122['transfererchannel'],'transferercalleridnum':_0x4cc122[_0xbe7f('0x5')],'transferercalleridname':_0x4cc122[_0xbe7f('0x6')],'transfererconnectedlinenum':_0x4cc122[_0xbe7f('0x7')],'transfererconnectedlinename':_0x4cc122['transfererconnectedlinename'],'transfereraccountcode':_0x4cc122[_0xbe7f('0x8')],'transferercontext':_0x4cc122[_0xbe7f('0x9')],'transfererexten':_0x4cc122[_0xbe7f('0xa')],'transfererlinkedid':_0x4cc122[_0xbe7f('0xb')],'transfereechannel':_0x4cc122[_0xbe7f('0xc')],'transfereecalleridnum':_0x4cc122[_0xbe7f('0xd')],'transfereecalleridname':_0x4cc122[_0xbe7f('0xe')],'transfereeconnectedlinenum':_0x4cc122[_0xbe7f('0xf')],'transfereeconnectedlinename':_0x4cc122['transfereeconnectedlinename'],'transfereeaccountcode':_0x4cc122[_0xbe7f('0x10')],'transfereecontext':_0x4cc122[_0xbe7f('0x11')],'transfereeexten':_0x4cc122[_0xbe7f('0x12')],'transfereelinkedid':_0x4cc122['transfereelinkedid'],'isexternal':_0x4cc122[_0xbe7f('0x13')],'context':_0x4cc122[_0xbe7f('0x14')],'extension':_0x4cc122[_0xbe7f('0x15')],'type':_0xbe7f('0x16')},'log':_0xbe7f('0x3')});};exports[_0xbe7f('0x17')]=function(_0x81559b){return client[_0xbe7f('0x2')](_0xbe7f('0x3'),{'body':{'result':_0x81559b[_0xbe7f('0x4')],'transfererchannel':_0x81559b[_0xbe7f('0x18')],'transferercalleridnum':_0x81559b['origtransferercalleridnum'],'transferercalleridname':_0x81559b[_0xbe7f('0x19')],'transfererconnectedlinenum':_0x81559b[_0xbe7f('0x1a')],'transfererconnectedlinename':_0x81559b[_0xbe7f('0x1b')],'transfereraccountcode':_0x81559b[_0xbe7f('0x1c')],'transferercontext':_0x81559b[_0xbe7f('0x1d')],'transfererexten':_0x81559b[_0xbe7f('0x1e')],'transfererlinkedid':_0x81559b[_0xbe7f('0x1f')],'transfereechannel':_0x81559b[_0xbe7f('0x20')],'transfereecalleridnum':_0x81559b[_0xbe7f('0x21')],'transfereecalleridname':_0x81559b[_0xbe7f('0x22')],'transfereeconnectedlinenum':_0x81559b[_0xbe7f('0x23')],'transfereeconnectedlinename':_0x81559b[_0xbe7f('0x24')],'transfereeaccountcode':_0x81559b[_0xbe7f('0x25')],'transfereecontext':_0x81559b[_0xbe7f('0x26')],'transfereeexten':_0x81559b[_0xbe7f('0x27')],'transfereelinkedid':_0x81559b[_0xbe7f('0x28')],'isexternal':_0x81559b['isexternal'],'context':_0x81559b[_0xbe7f('0x29')],'extension':_0x81559b[_0xbe7f('0x2a')],'type':_0xbe7f('0x2b')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x0c12=['secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x2c3aed,_0xa4011f){var _0x473dc4=function(_0x2a4ffc){while(--_0x2a4ffc){_0x2c3aed['push'](_0x2c3aed['shift']());}};_0x473dc4(++_0xa4011f);}(_0x0c12,0x17d));var _0x20c1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c12[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x20c1('0x0'));exports['blindTransfer']=function(_0x47ca58){return client[_0x20c1('0x1')](_0x20c1('0x2'),{'body':{'result':_0x47ca58[_0x20c1('0x3')],'transfererchannel':_0x47ca58[_0x20c1('0x4')],'transferercalleridnum':_0x47ca58[_0x20c1('0x5')],'transferercalleridname':_0x47ca58['transferercalleridname'],'transfererconnectedlinenum':_0x47ca58[_0x20c1('0x6')],'transfererconnectedlinename':_0x47ca58[_0x20c1('0x7')],'transfereraccountcode':_0x47ca58[_0x20c1('0x8')],'transferercontext':_0x47ca58['transferercontext'],'transfererexten':_0x47ca58[_0x20c1('0x9')],'transfererlinkedid':_0x47ca58[_0x20c1('0xa')],'transfereechannel':_0x47ca58[_0x20c1('0xb')],'transfereecalleridnum':_0x47ca58['transfereecalleridnum'],'transfereecalleridname':_0x47ca58[_0x20c1('0xc')],'transfereeconnectedlinenum':_0x47ca58[_0x20c1('0xd')],'transfereeconnectedlinename':_0x47ca58[_0x20c1('0xe')],'transfereeaccountcode':_0x47ca58[_0x20c1('0xf')],'transfereecontext':_0x47ca58[_0x20c1('0x10')],'transfereeexten':_0x47ca58[_0x20c1('0x11')],'transfereelinkedid':_0x47ca58[_0x20c1('0x12')],'isexternal':_0x47ca58['isexternal'],'context':_0x47ca58[_0x20c1('0x13')],'extension':_0x47ca58[_0x20c1('0x14')],'type':_0x20c1('0x15')},'log':_0x20c1('0x2')});};exports[_0x20c1('0x16')]=function(_0x21e1fb){return client[_0x20c1('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x21e1fb['result'],'transfererchannel':_0x21e1fb[_0x20c1('0x17')],'transferercalleridnum':_0x21e1fb[_0x20c1('0x18')],'transferercalleridname':_0x21e1fb[_0x20c1('0x19')],'transfererconnectedlinenum':_0x21e1fb[_0x20c1('0x1a')],'transfererconnectedlinename':_0x21e1fb[_0x20c1('0x1b')],'transfereraccountcode':_0x21e1fb[_0x20c1('0x1c')],'transferercontext':_0x21e1fb[_0x20c1('0x1d')],'transfererexten':_0x21e1fb['secondtransfererexten'],'transfererlinkedid':_0x21e1fb[_0x20c1('0x1e')],'transfereechannel':_0x21e1fb['transfertargetchannel'],'transfereecalleridnum':_0x21e1fb[_0x20c1('0x1f')],'transfereecalleridname':_0x21e1fb[_0x20c1('0x20')],'transfereeconnectedlinenum':_0x21e1fb[_0x20c1('0x21')],'transfereeconnectedlinename':_0x21e1fb[_0x20c1('0x22')],'transfereeaccountcode':_0x21e1fb[_0x20c1('0x23')],'transfereecontext':_0x21e1fb[_0x20c1('0x24')],'transfereeexten':_0x21e1fb['transfertargetexten'],'transfereelinkedid':_0x21e1fb[_0x20c1('0x25')],'isexternal':_0x21e1fb[_0x20c1('0x26')],'context':_0x21e1fb[_0x20c1('0x27')],'extension':_0x21e1fb['origtransfererexten'],'type':_0x20c1('0x28')},'log':_0x20c1('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 386c793..56e4799 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 _0x66ef=['event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','QueuePause','isConnected','error','asterisk','join','pick','keys','module','Reload','Action','then','message','catch','username','command','action','Command','content','voiceQueues','hasOwnProperty','name','answered','available','loggedIn','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','values','channels','voicechannel','length','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','resolve','StopMixMonitor','destinationchannel','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run'];(function(_0x32c964,_0x273227){var _0x3a4296=function(_0x7c8198){while(--_0x7c8198){_0x32c964['push'](_0x32c964['shift']());}};_0x3a4296(++_0x273227);}(_0x66ef,0x119));var _0xf66e=function(_0x20fa50,_0x5f4d92){_0x20fa50=_0x20fa50-0x0;var _0xf2f2c4=_0x66ef[_0x20fa50];return _0xf2f2c4;};'use strict';var _=require(_0xf66e('0x0'));var util=require('util');var jayson=require(_0xf66e('0x1'));var schema=require(_0xf66e('0x2'));var BPromise=require(_0xf66e('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0xf66e('0x4'));exports[_0xf66e('0x5')]=function(_0x174605,_0x3741f8,_0x45e6ac){return new BPromise(function(_0x2dd5c9,_0x56cd86){var _0x17af04={'QueuePause':function(_0x3309f1){return new Promise(function(_0x1e999a,_0x52d38e){var _0x54dbdf=util[_0xf66e('0x6')](_0xf66e('0x7'),_0xf66e('0x8'),_0x3309f1['name']);if(_0x174605[_0xf66e('0x9')]&&_0x174605[_0xf66e('0x9')][_0x54dbdf]&&_0x174605[_0xf66e('0x9')][_0x54dbdf][_0xf66e('0xa')]){_0x174605[_0xf66e('0x9')][_0x54dbdf][_0xf66e('0xb')]();}if(_0x174605[_0xf66e('0xc')][_0x54dbdf]){_0x174605[_0xf66e('0xc')][_0x54dbdf]['updateStatusRealtime']({'statePause':_0x3309f1['pause']?!![]:![]});}_0x1e999a({'code':0xc8,'message':_0xf66e('0xd')});});},'Reload':function(_0x6ae36){var _0x2edf56=this;return new Promise(function(_0x1305a8,_0x2d56b3){if(ami[_0xf66e('0xe')]()==![]){return _0x2d56b3(_0x2edf56[_0xf66e('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xf66e('0x10')]['username'],'ami\x20disconnected'][_0xf66e('0x11')]('\x20')));}_0x6ae36=_[_0xf66e('0x12')](_0x6ae36,_[_0xf66e('0x13')](properties[_0xf66e('0x14')]));_0x6ae36['action']=_0xf66e('0x15');return ami[_0xf66e('0x16')](_0x6ae36)[_0xf66e('0x17')](function(_0x13ae8d){_0x1305a8({'code':0xc8,'message':_0x13ae8d[_0xf66e('0x18')]});})[_0xf66e('0x19')](function(_0x4f2776){_0x2d56b3(_0x2edf56[_0xf66e('0xf')](0x1f5,_0x4f2776[_0xf66e('0x18')]));});});},'Command':function(_0x5c82d4){var _0x5ddc06=this;return new Promise(function(_0x3f8a66,_0x5e09a4){if(ami[_0xf66e('0xe')]()==![]){return _0x5e09a4(_0x5ddc06[_0xf66e('0xf')](0x1f4,[config[_0xf66e('0x10')]['ip'],config[_0xf66e('0x10')][_0xf66e('0x1a')],'ami\x20disconnected'][_0xf66e('0x11')]('\x20')));}_0x5c82d4=_[_0xf66e('0x12')](_0x5c82d4,_0xf66e('0x1b'));_0x5c82d4[_0xf66e('0x1c')]=_0xf66e('0x1d');return ami[_0xf66e('0x16')](_0x5c82d4)[_0xf66e('0x17')](function(_0x64ee3f){_0x3f8a66({'code':0xc8,'message':_0x64ee3f[_0xf66e('0x1e')]});})['catch'](function(_0x453d53){_0x5e09a4(_0x5ddc06[_0xf66e('0xf')](0x1f5,_0x453d53[_0xf66e('0x18')]));});});},'VoiceQueues':function(_0x13675b){return new Promise(function(_0xc65b8e,_0x1b2455){var _0x3d8db4=[];for(var _0x174709 in _0x174605['voiceQueues']){if(_0x174605[_0xf66e('0x1f')][_0xf66e('0x20')](_0x174709)){var _0x12bebd=_0x174605[_0xf66e('0x1f')][_0x174709];var _0x14b979={'id':_0x12bebd['id'],'name':_0x12bebd[_0xf66e('0x21')],'strategy':_0x12bebd['strategy'],'answered':_0x12bebd[_0xf66e('0x22')],'available':_0x12bebd[_0xf66e('0x23')],'loggedIn':_0x12bebd[_0xf66e('0x24')],'pTalking':_0x12bebd['pTalking'],'sumBillable':_0x12bebd[_0xf66e('0x25')],'sumDuration':_0x12bebd['sumDuration'],'sumHoldTime':_0x12bebd[_0xf66e('0x26')]||0x0,'talking':_0x12bebd['talking'],'total':_0x12bebd[_0xf66e('0x27')],'type':_0x12bebd[_0xf66e('0x28')],'unmanaged':_0x12bebd[_0xf66e('0x29')],'abandoned':_0x12bebd[_0xf66e('0x2a')],'waiting':_0x12bebd[_0xf66e('0x2b')],'loggedInDb':_0x12bebd['loggedInDb']};if(_0x12bebd[_0xf66e('0x28')]===_0xf66e('0x2c')){_0x14b979[_0xf66e('0x2d')]=_0x12bebd[_0xf66e('0x2d')];_0x14b979['dialMethod']=_0x12bebd['dialMethod'];_0x14b979[_0xf66e('0x2e')]=_0x12bebd[_0xf66e('0x2e')];_0x14b979['dialOriginateCallerIdNumber']=_0x12bebd[_0xf66e('0x2f')];_0x14b979[_0xf66e('0x30')]=_0x12bebd['dialOriginateTimeout'];_0x14b979['dialPrefix']=_0x12bebd[_0xf66e('0x31')];_0x14b979[_0xf66e('0x32')]=_0x12bebd[_0xf66e('0x32')];_0x14b979[_0xf66e('0x33')]=_0x12bebd['outboundAnswerCallsDay'];_0x14b979[_0xf66e('0x34')]=_0x12bebd[_0xf66e('0x34')];_0x14b979['outboundBusyCallsDay']=_0x12bebd[_0xf66e('0x35')];_0x14b979[_0xf66e('0x36')]=_0x12bebd[_0xf66e('0x36')];_0x14b979[_0xf66e('0x37')]=_0x12bebd['outboundDropCallsDayACS'];_0x14b979['outboundDropCallsDayCallersExit']=_0x12bebd[_0xf66e('0x38')];_0x14b979[_0xf66e('0x39')]=_0x12bebd[_0xf66e('0x39')];_0x14b979['outboundNoAnswerCallsDay']=_0x12bebd['outboundNoAnswerCallsDay'];_0x14b979[_0xf66e('0x3a')]=_0x12bebd['outboundNoSuchCallsDay'];_0x14b979[_0xf66e('0x3b')]=_0x12bebd[_0xf66e('0x3b')];_0x14b979['outboundReCallsDay']=_0x12bebd[_0xf66e('0x3c')];_0x14b979[_0xf66e('0x3d')]=_0x12bebd[_0xf66e('0x3d')];_0x14b979[_0xf66e('0x3e')]=_0x12bebd['outboundUnknownCallsDay'];_0x14b979['predictiveIntervalAnsweredCalls']=_0x12bebd[_0xf66e('0x3f')];_0x14b979['predictiveIntervalAvgHoldtime']=_0x12bebd['predictiveIntervalAvgHoldtime'];_0x14b979[_0xf66e('0x40')]=_0x12bebd['predictiveIntervalAvgTalktime'];_0x14b979['predictiveIntervalDroppedCallsCallersExit']=_0x12bebd['predictiveIntervalDroppedCallsCallersExit'];_0x14b979['predictiveIntervalDroppedCallsTimeout']=_0x12bebd[_0xf66e('0x41')];_0x14b979[_0xf66e('0x42')]=_0x12bebd[_0xf66e('0x42')];_0x14b979[_0xf66e('0x43')]=_0x12bebd[_0xf66e('0x43')];_0x14b979[_0xf66e('0x44')]=_0x12bebd[_0xf66e('0x44')];_0x14b979[_0xf66e('0x45')]=_0x12bebd['predictiveIntervalMultiplicativeFactor'];_0x14b979[_0xf66e('0x46')]=_0x12bebd[_0xf66e('0x46')];_0x14b979['predictiveIntervalAvailable']=_0x12bebd[_0xf66e('0x47')];_0x14b979['predictiveIntervalTotalCalls']=_0x12bebd[_0xf66e('0x48')];_0x14b979[_0xf66e('0x18')]=_0x12bebd[_0xf66e('0x18')];_0x14b979['originated']=_0x12bebd[_0xf66e('0x49')];_0x14b979[_0xf66e('0x4a')]=_0x12bebd[_0xf66e('0x4a')];_0x14b979[_0xf66e('0x4b')]=_0x12bebd[_0xf66e('0x4b')];_0x14b979[_0xf66e('0x4c')]=_0x12bebd[_0xf66e('0x4c')];_0x14b979[_0xf66e('0x4d')]=_0x12bebd[_0xf66e('0x4d')];_0x14b979['startPredictive']=_0x12bebd[_0xf66e('0x4e')];_0x14b979[_0xf66e('0x4f')]=_0x12bebd[_0xf66e('0x4f')];}if(_0x12bebd[_0xf66e('0x50')]){_0x14b979[_0xf66e('0x50')]={'id':_0x12bebd[_0xf66e('0x50')]['id'],'name':_0x12bebd[_0xf66e('0x50')][_0xf66e('0x21')],'active':_0x12bebd[_0xf66e('0x50')][_0xf66e('0x51')],'callerid':_0x12bebd[_0xf66e('0x50')][_0xf66e('0x52')]};}if(_0x12bebd['Interval']){_0x14b979[_0xf66e('0x53')]={'id':_0x12bebd['Interval']['id'],'name':_0x12bebd[_0xf66e('0x53')][_0xf66e('0x21')]};}_0x3d8db4['push'](_0x14b979);}}_0xc65b8e({'count':_0x3d8db4['length'],'rows':_0x3d8db4});});},'VoiceChannels':function(_0x4c3329){return new Promise(function(_0x56edad,_0x5ec46f){var _0x24900e=_[_0xf66e('0x54')](_0x174605[_0xf66e('0x55')]);_0x56edad({'count':_0x24900e['length'],'rows':_0x24900e});});},'VoiceChannelMixMonitor':function(_0x251171){var _0x5132d7=this;return new Promise(function(_0x10ed43,_0x424d36){if(ami[_0xf66e('0xe')]()==![]){return _0x424d36(_0x5132d7[_0xf66e('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf66e('0x1a')],'ami\x20disconnected']['join']('\x20')));}var _0x5e828e=schema(properties[_0xf66e('0x56')])['validate'](_0x251171);if(_0x5e828e[_0xf66e('0x57')]>0x0){return _0x424d36(_0x5132d7[_0xf66e('0xf')](0x1f4,_[_0xf66e('0x58')](_0x5e828e,_0xf66e('0x18'))[_0xf66e('0x11')](',\x20')));}var _0x257394=_[_0xf66e('0x59')](_0x174605[_0xf66e('0x55')],{'uniqueid':_0x251171[_0xf66e('0x5a')]});if(_0x257394&&_0x257394[_0xf66e('0x5b')]){var _0x2e4745=util[_0xf66e('0x6')](_0xf66e('0x5c'),_0x251171[_0xf66e('0x5d')]||_0x251171[_0xf66e('0x5a')],_0x251171['format']||_0xf66e('0x5e'));return ami['Action']({'action':_0xf66e('0x5f'),'channel':_0x257394[_0xf66e('0x5b')],'file':_0x2e4745,'options':_0xf66e('0x60')})[_0xf66e('0x17')](function(_0x20badc){var _0x56164f=_[_0xf66e('0x59')](_0x257394[_0xf66e('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x2e4745[_0xf66e('0x62')]()});if(_['isNil'](_0x56164f)){_0x257394[_0xf66e('0x61')]['push']({'filename':_0xf66e('0x63')+_0x2e4745[_0xf66e('0x62')](),'createdAt':moment()[_0xf66e('0x6')](_0xf66e('0x64')),'mixmonitorid':_0x20badc['mixmonitorid'],'status':_0xf66e('0x65')});}else{_0x56164f[_0xf66e('0x66')]=_0x20badc[_0xf66e('0x66')];_0x56164f[_0xf66e('0x67')]=_0xf66e('0x65');}_0x10ed43({'code':0xc8,'message':[_0x251171['uniqueid'],_0xf66e('0x68'),_0x20badc['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x20badc[_0xf66e('0x66')]});})[_0xf66e('0x19')](function(_0x4e4173){_0x424d36(_0x5132d7[_0xf66e('0xf')](0x1f5,[_0x251171[_0xf66e('0x5a')],_0x4e4173['message'][_0xf66e('0x62')]()]['join']('\x20')));});}else{return _0x424d36(_0x5132d7[_0xf66e('0xf')](0x1f5,_0xf66e('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x176195){var _0x256e56=this;return new Promise(function(_0x5522dc,_0x26bb5f){if(ami['isConnected']()==![]){return _0x26bb5f(_0x256e56[_0xf66e('0xf')](0x1f4,[config[_0xf66e('0x10')]['ip'],config['asterisk'][_0xf66e('0x1a')],_0xf66e('0x6a')][_0xf66e('0x11')]('\x20')));}var _0x44560f=schema(properties['voicechannel'])[_0xf66e('0x2')](_0x176195);if(_0x44560f[_0xf66e('0x57')]>0x0){return _0x26bb5f(_0x256e56[_0xf66e('0xf')](0x1f4,_[_0xf66e('0x58')](_0x44560f,'message')['join'](',\x20')));}var _0x892682=_[_0xf66e('0x59')](_0x174605[_0xf66e('0x55')],{'uniqueid':_0x176195[_0xf66e('0x5a')]});if(_0x892682){return BPromise[_0xf66e('0x6b')]()[_0xf66e('0x17')](function(){if(_0x892682['channel']){return ami[_0xf66e('0x16')]({'action':'StopMixMonitor','channel':_0x892682['channel'],'mixmonitorid':_0x176195[_0xf66e('0x66')]})[_0xf66e('0x19')](function(_0x116edd){});}})[_0xf66e('0x17')](function(){if(_0x892682['destinationchannel']){return ami[_0xf66e('0x16')]({'action':_0xf66e('0x6c'),'channel':_0x892682[_0xf66e('0x6d')],'mixmonitorid':_0x176195['mixmonitorid']})['catch'](function(_0x42902d){});}})[_0xf66e('0x17')](function(_0x5c6073){var _0x292405=_['find'](_0x892682[_0xf66e('0x61')],{'mixmonitorid':_0x176195['mixmonitorid']});if(_0x292405){_0x292405[_0xf66e('0x67')]='stop';}})[_0xf66e('0x17')](function(){var _0x43d38a=util['format']('%s.%s',_0x176195['filename']||_0x176195[_0xf66e('0x5a')],_0x176195[_0xf66e('0x6')]||_0xf66e('0x5e'));var _0x1863fd=_[_0xf66e('0x59')](_0x892682['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x43d38a[_0xf66e('0x62')]()});if(_0x1863fd){_0x1863fd['status']='stop';}})[_0xf66e('0x17')](function(){_0x5522dc({'code':0xc8,'message':[_0x176195[_0xf66e('0x5a')],_0xf66e('0x6e')][_0xf66e('0x11')]('\x20')});})[_0xf66e('0x19')](function(_0xe4b693){_0x26bb5f(_0x256e56[_0xf66e('0xf')](0x1f5,[_0x176195[_0xf66e('0x5a')],_0xe4b693[_0xf66e('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0x26bb5f(_0x256e56['error'](0x1f5,_0xf66e('0x69')));}});},'VoiceQueuesChannels':function(_0x533189){return new Promise(function(_0x11a708,_0x4e7d89){var _0x29bda8=_[_0xf66e('0x54')](_0x174605[_0xf66e('0x6f')]);_0x11a708({'count':_0x29bda8['length'],'rows':_0x29bda8});});},'VoiceQueuesChannel':function(_0x24edbd){var _0x18aa86=this;return new Promise(function(_0x67c2b6,_0x1afb90){var _0x435e92=schema(properties['voicequeuechannel'])['validate'](_0x24edbd);if(_0x435e92[_0xf66e('0x57')]>0x0){return _0x1afb90(_0x18aa86[_0xf66e('0xf')](0x1f4,_[_0xf66e('0x58')](_0x435e92,_0xf66e('0x18'))['join'](',\x20')));}var _0x362c84=_[_0xf66e('0x59')](_0x174605[_0xf66e('0x6f')],{'uniqueid':_0x24edbd[_0xf66e('0x5a')]});if(_0x362c84){_0x67c2b6(_0x362c84);}else{return _0x1afb90(_0x18aa86[_0xf66e('0xf')](0x1f5,_0xf66e('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x115af2){var _0x5eed28=this;return new Promise(function(_0x339c55,_0x459234){if(ami[_0xf66e('0xe')]()==![]){return _0x459234(_0x5eed28[_0xf66e('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xf66e('0x10')][_0xf66e('0x1a')],_0xf66e('0x6a')][_0xf66e('0x11')]('\x20')));}var _0x4c036c=schema(properties[_0xf66e('0x70')])['validate'](_0x115af2);if(_0x4c036c[_0xf66e('0x57')]>0x0){return _0x459234(_0x5eed28[_0xf66e('0xf')](0x1f4,_[_0xf66e('0x58')](_0x4c036c,_0xf66e('0x18'))['join'](',\x20')));}var _0x2c2402=_[_0xf66e('0x59')](_0x174605[_0xf66e('0x6f')],{'uniqueid':_0x115af2['uniqueid']});if(_0x2c2402&&_0x2c2402['channel']){return ami[_0xf66e('0x16')]({'action':'Hangup','channel':_0x2c2402['channel']})['then'](function(_0x54589a){_0x339c55({'code':0xc8,'message':[_0x115af2[_0xf66e('0x5a')],_0x54589a[_0xf66e('0x18')][_0xf66e('0x62')]()][_0xf66e('0x11')]('\x20')});})['catch'](function(_0x280fdc){_0x459234(_0x5eed28[_0xf66e('0xf')](0x1f5,[_0x115af2[_0xf66e('0x5a')],_0x280fdc[_0xf66e('0x18')]['toLowerCase']()][_0xf66e('0x11')]('\x20')));});}else{return _0x459234(_0x5eed28[_0xf66e('0xf')](0x1f5,_0xf66e('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x150a59){var _0x176e7c=this;return new Promise(function(_0x1e356c,_0x2fe4db){if(ami[_0xf66e('0xe')]()==![]){return _0x2fe4db(_0x176e7c['error'](0x1f4,[config[_0xf66e('0x10')]['ip'],config['asterisk'][_0xf66e('0x1a')],_0xf66e('0x6a')][_0xf66e('0x11')]('\x20')));}var _0x102513=schema(properties[_0xf66e('0x71')])[_0xf66e('0x2')](_0x150a59);if(_0x102513['length']>0x0){return _0x2fe4db(_0x176e7c[_0xf66e('0xf')](0x1f4,_[_0xf66e('0x58')](_0x102513,_0xf66e('0x18'))[_0xf66e('0x11')](',\x20')));}var _0x22b11a=_[_0xf66e('0x59')](_0x174605[_0xf66e('0x6f')],{'uniqueid':_0x150a59[_0xf66e('0x5a')]});if(_0x22b11a&&_0x22b11a[_0xf66e('0x5b')]){return ami['Action']({'action':_0xf66e('0x72'),'channel':_0x22b11a[_0xf66e('0x5b')],'exten':_0x150a59[_0xf66e('0x73')],'context':_0x150a59['context']||_0x22b11a[_0xf66e('0x74')],'priority':0x1})[_0xf66e('0x17')](function(_0x4b729b){_0x1e356c({'code':0xc8,'message':[_0x150a59[_0xf66e('0x5a')],_0x4b729b['message'][_0xf66e('0x62')]()][_0xf66e('0x11')]('\x20')});})['catch'](function(_0x21cba8){_0x2fe4db(_0x176e7c[_0xf66e('0xf')](0x1f5,[_0x150a59[_0xf66e('0x5a')],_0x21cba8[_0xf66e('0x18')][_0xf66e('0x62')]()]['join']('\x20')));});}else{return _0x2fe4db(_0x176e7c['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x367a0f){return new Promise(function(_0x2095ea,_0x270d6c){var _0x29d51e=_[_0xf66e('0x54')](_0x174605[_0xf66e('0xc')]);_0x2095ea({'count':_0x29d51e['length'],'rows':_0x29d51e});});},'Telephones':function(_0xe3b16b){return new Promise(function(_0x58e8e9,_0x3baf27){var _0x25942d=_[_0xf66e('0x54')](_0x174605['telephones']);_0x58e8e9({'count':_0x25942d['length'],'rows':_0x25942d});});},'Trunks':function(_0x3b276d){return new Promise(function(_0x394794,_0x2cabdd){var _0x7d66ff=_['values'](_0x174605[_0xf66e('0x75')]);_0x394794({'count':_0x7d66ff[_0xf66e('0x57')],'rows':_0x7d66ff});});},'OutboundChannels':function(_0x19d3dd){return new Promise(function(_0x483a95,_0x4ae459){var _0x3db3d5=_[_0xf66e('0x54')](_0x174605[_0xf66e('0x76')]);_0x483a95({'count':_0x3db3d5[_0xf66e('0x57')],'rows':_0x3db3d5});});},'Outbound':function(_0x42357e){return new Promise(function(_0x3145d7,_0x552bc9){_0x3145d7(_0x174605['outbound']);});},'Campaigns':function(_0x2c1e35){return new Promise(function(_0x134617,_0x1dde65){var _0x2feb5a=_[_0xf66e('0x54')](_0x174605[_0xf66e('0x77')]);_0x134617({'count':_0x2feb5a[_0xf66e('0x57')],'rows':_0x2feb5a});});},'VoiceQueuesPreview':function(_0x585cac){var _0x4d47c1=this;return new Promise(function(_0x114dfd,_0x3475e4){_0x3741f8[_0xf66e('0x78')](_0x585cac['id'])[_0xf66e('0x17')](function(_0x28e4a5){_0x114dfd({'code':0xc8,'message':_0x28e4a5['message']});})['catch'](function(_0x3fb9da){_0x3475e4(_0x4d47c1['error'](0x1f4,_0x3fb9da[_0xf66e('0x18')]));});});},'EventManager':function(_0x1161e1){var _0x26a645=this;return new Promise(function(_0x43d98c,_0x5cb808){if(!_0x1161e1[_0xf66e('0x79')]){return _0x5cb808(_0x26a645[_0xf66e('0xf')](0x1f4,_0xf66e('0x7a')));}ami[_0xf66e('0x7b')](_0xf66e('0x7c')+_0x1161e1[_0xf66e('0x79')],_0x1161e1['message']);_0x43d98c({'code':0xc8,'message':_0x1161e1});});},'FaxAccounts':function(_0x318f02){return new Promise(function(_0x169e59,_0x2002d9){var _0x30a574=_[_0xf66e('0x54')](_0x174605[_0xf66e('0x7d')]);_0x169e59({'count':_0x30a574[_0xf66e('0x57')],'rows':_0x30a574});});},'SendFax':function(_0x7c6de6){var _0x49a97b=this;return new Promise(function(_0x6e2fa9,_0x358d97){_0x45e6ac[_0xf66e('0x7e')](_0x7c6de6)[_0xf66e('0x17')](function(_0x15894a){_0x6e2fa9({'code':0xc8,'message':_0x15894a[_0xf66e('0x18')]});})[_0xf66e('0x19')](function(_0x482512){_0x358d97(_0x49a97b['error'](0x1f4,_0x482512[_0xf66e('0x18')]));});});},'CheckAfterSend':function(_0x4b4b86){var _0xe0591d=this;return new Promise(function(_0x3cc904,_0x379a39){_0x45e6ac[_0xf66e('0x7f')](_0x4b4b86)[_0xf66e('0x17')](function(_0x10b386){_0x3cc904({'code':0xc8,'message':_0x10b386[_0xf66e('0x18')]});})[_0xf66e('0x19')](function(_0x51ee7a){_0x379a39(_0xe0591d['error'](0x1f4,_0x51ee7a['message']));});});}};var _0x4caf9a=jayson[_0xf66e('0x80')](_0x17af04)[_0xf66e('0x81')]();_0x4caf9a['on']('error',function(_0x2441c8){return _0x56cd86(_0x2441c8);});_0x4caf9a[_0xf66e('0x5')](0x232a,_0xf66e('0x82'),function(){console[_0xf66e('0x83')](_0xf66e('0x84'),0x232a);return _0x2dd5c9(_0xf66e('0x85')+0x232a);});});}; \ No newline at end of file +var _0x349f=['predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','voicechannel','map','find','channels','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','channel','StopMixMonitor','destinationchannel','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../../../config/environment','../ami','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','join','pick','keys','module','Action','then','message','catch','ami\x20disconnected','command','action','content','voiceQueues','name','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor'];(function(_0x283561,_0x37d9d1){var _0x4f02c0=function(_0x555ef0){while(--_0x555ef0){_0x283561['push'](_0x283561['shift']());}};_0x4f02c0(++_0x37d9d1);}(_0x349f,0x14c));var _0xf349=function(_0x291801,_0x2934df){_0x291801=_0x291801-0x0;var _0xc2a05b=_0x349f[_0x291801];return _0xc2a05b;};'use strict';var _=require('lodash');var util=require(_0xf349('0x0'));var jayson=require(_0xf349('0x1'));var schema=require(_0xf349('0x2'));var BPromise=require('bluebird');var moment=require(_0xf349('0x3'));var config=require(_0xf349('0x4'));var properties=require('../properties');var ami=require(_0xf349('0x5'));exports['listen']=function(_0x2fd288,_0x19ca8e,_0x46d7d8){return new BPromise(function(_0xc24035,_0x1d2037){var _0x5e292d={'QueuePause':function(_0x1cbecf){return new Promise(function(_0x5af223,_0x46018a){var _0x59f022=util[_0xf349('0x6')](_0xf349('0x7'),_0xf349('0x8'),_0x1cbecf['name']);if(_0x2fd288[_0xf349('0x9')]&&_0x2fd288[_0xf349('0x9')][_0x59f022]&&_0x2fd288[_0xf349('0x9')][_0x59f022][_0xf349('0xa')]){_0x2fd288[_0xf349('0x9')][_0x59f022][_0xf349('0xb')]();}if(_0x2fd288[_0xf349('0xc')][_0x59f022]){_0x2fd288[_0xf349('0xc')][_0x59f022][_0xf349('0xd')]({'statePause':_0x1cbecf[_0xf349('0xe')]?!![]:![]});}_0x5af223({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x342f76){var _0xb97424=this;return new Promise(function(_0x1cc5fe,_0x218997){if(ami[_0xf349('0xf')]()==![]){return _0x218997(_0xb97424[_0xf349('0x10')](0x1f4,[config[_0xf349('0x11')]['ip'],config[_0xf349('0x11')][_0xf349('0x12')],'ami\x20disconnected'][_0xf349('0x13')]('\x20')));}_0x342f76=_[_0xf349('0x14')](_0x342f76,_[_0xf349('0x15')](properties[_0xf349('0x16')]));_0x342f76['action']='Reload';return ami[_0xf349('0x17')](_0x342f76)[_0xf349('0x18')](function(_0x2cbf49){_0x1cc5fe({'code':0xc8,'message':_0x2cbf49[_0xf349('0x19')]});})[_0xf349('0x1a')](function(_0x3ee231){_0x218997(_0xb97424[_0xf349('0x10')](0x1f5,_0x3ee231[_0xf349('0x19')]));});});},'Command':function(_0xddd3fc){var _0x2e56a1=this;return new Promise(function(_0x561e28,_0x863f8c){if(ami['isConnected']()==![]){return _0x863f8c(_0x2e56a1[_0xf349('0x10')](0x1f4,[config[_0xf349('0x11')]['ip'],config[_0xf349('0x11')]['username'],_0xf349('0x1b')]['join']('\x20')));}_0xddd3fc=_[_0xf349('0x14')](_0xddd3fc,_0xf349('0x1c'));_0xddd3fc[_0xf349('0x1d')]='Command';return ami['Action'](_0xddd3fc)[_0xf349('0x18')](function(_0x884d89){_0x561e28({'code':0xc8,'message':_0x884d89[_0xf349('0x1e')]});})[_0xf349('0x1a')](function(_0x4e04e3){_0x863f8c(_0x2e56a1[_0xf349('0x10')](0x1f5,_0x4e04e3[_0xf349('0x19')]));});});},'VoiceQueues':function(_0x5881a8){return new Promise(function(_0x4f0330,_0x3e0bc2){var _0x47aae0=[];for(var _0x4d8c88 in _0x2fd288[_0xf349('0x1f')]){if(_0x2fd288['voiceQueues']['hasOwnProperty'](_0x4d8c88)){var _0x33bd20=_0x2fd288[_0xf349('0x1f')][_0x4d8c88];var _0x4e1518={'id':_0x33bd20['id'],'name':_0x33bd20[_0xf349('0x20')],'strategy':_0x33bd20[_0xf349('0x21')],'answered':_0x33bd20[_0xf349('0x22')],'available':_0x33bd20[_0xf349('0x23')],'loggedIn':_0x33bd20[_0xf349('0x24')],'pTalking':_0x33bd20[_0xf349('0x25')],'sumBillable':_0x33bd20['sumBillable'],'sumDuration':_0x33bd20['sumDuration'],'sumHoldTime':_0x33bd20[_0xf349('0x26')]||0x0,'talking':_0x33bd20[_0xf349('0x27')],'total':_0x33bd20['total'],'type':_0x33bd20[_0xf349('0x28')],'unmanaged':_0x33bd20[_0xf349('0x29')],'abandoned':_0x33bd20[_0xf349('0x2a')],'waiting':_0x33bd20[_0xf349('0x2b')],'loggedInDb':_0x33bd20[_0xf349('0x2c')]};if(_0x33bd20[_0xf349('0x28')]===_0xf349('0x2d')){_0x4e1518[_0xf349('0x2e')]=_0x33bd20[_0xf349('0x2e')];_0x4e1518[_0xf349('0x2f')]=_0x33bd20[_0xf349('0x2f')];_0x4e1518['dialOriginateCallerIdName']=_0x33bd20[_0xf349('0x30')];_0x4e1518[_0xf349('0x31')]=_0x33bd20[_0xf349('0x31')];_0x4e1518[_0xf349('0x32')]=_0x33bd20[_0xf349('0x32')];_0x4e1518['dialPrefix']=_0x33bd20[_0xf349('0x33')];_0x4e1518[_0xf349('0x34')]=_0x33bd20[_0xf349('0x34')];_0x4e1518[_0xf349('0x35')]=_0x33bd20['outboundAnswerCallsDay'];_0x4e1518['outboundBlacklistCallsDay']=_0x33bd20['outboundBlacklistCallsDay'];_0x4e1518['outboundBusyCallsDay']=_0x33bd20[_0xf349('0x36')];_0x4e1518[_0xf349('0x37')]=_0x33bd20[_0xf349('0x37')];_0x4e1518[_0xf349('0x38')]=_0x33bd20[_0xf349('0x38')];_0x4e1518[_0xf349('0x39')]=_0x33bd20[_0xf349('0x39')];_0x4e1518['outboundDropCallsDayTimeout']=_0x33bd20[_0xf349('0x3a')];_0x4e1518[_0xf349('0x3b')]=_0x33bd20[_0xf349('0x3b')];_0x4e1518[_0xf349('0x3c')]=_0x33bd20['outboundNoSuchCallsDay'];_0x4e1518[_0xf349('0x3d')]=_0x33bd20[_0xf349('0x3d')];_0x4e1518[_0xf349('0x3e')]=_0x33bd20[_0xf349('0x3e')];_0x4e1518[_0xf349('0x3f')]=_0x33bd20[_0xf349('0x3f')];_0x4e1518['outboundUnknownCallsDay']=_0x33bd20['outboundUnknownCallsDay'];_0x4e1518[_0xf349('0x40')]=_0x33bd20[_0xf349('0x40')];_0x4e1518[_0xf349('0x41')]=_0x33bd20[_0xf349('0x41')];_0x4e1518[_0xf349('0x42')]=_0x33bd20[_0xf349('0x42')];_0x4e1518[_0xf349('0x43')]=_0x33bd20['predictiveIntervalDroppedCallsCallersExit'];_0x4e1518[_0xf349('0x44')]=_0x33bd20[_0xf349('0x44')];_0x4e1518[_0xf349('0x45')]=_0x33bd20[_0xf349('0x45')];_0x4e1518[_0xf349('0x46')]=_0x33bd20['predictiveIntervalErlangCallsDroppedCalls'];_0x4e1518['predictiveIntervalHitRate']=_0x33bd20[_0xf349('0x47')];_0x4e1518[_0xf349('0x48')]=_0x33bd20['predictiveIntervalMultiplicativeFactor'];_0x4e1518[_0xf349('0x49')]=_0x33bd20[_0xf349('0x49')];_0x4e1518[_0xf349('0x4a')]=_0x33bd20[_0xf349('0x4a')];_0x4e1518[_0xf349('0x4b')]=_0x33bd20[_0xf349('0x4b')];_0x4e1518['message']=_0x33bd20[_0xf349('0x19')];_0x4e1518['originated']=_0x33bd20['originated'];_0x4e1518[_0xf349('0x4c')]=_0x33bd20['erlangCalls'];_0x4e1518[_0xf349('0x4d')]=_0x33bd20[_0xf349('0x4d')];_0x4e1518[_0xf349('0x4e')]=_0x33bd20[_0xf349('0x4e')];_0x4e1518[_0xf349('0x4f')]=_0x33bd20[_0xf349('0x4f')];_0x4e1518[_0xf349('0x50')]=_0x33bd20[_0xf349('0x50')];_0x4e1518[_0xf349('0x51')]=_0x33bd20[_0xf349('0x51')];}if(_0x33bd20['Trunk']){_0x4e1518[_0xf349('0x52')]={'id':_0x33bd20[_0xf349('0x52')]['id'],'name':_0x33bd20[_0xf349('0x52')][_0xf349('0x20')],'active':_0x33bd20['Trunk'][_0xf349('0x53')],'callerid':_0x33bd20[_0xf349('0x52')][_0xf349('0x54')]};}if(_0x33bd20[_0xf349('0x55')]){_0x4e1518[_0xf349('0x55')]={'id':_0x33bd20[_0xf349('0x55')]['id'],'name':_0x33bd20[_0xf349('0x55')][_0xf349('0x20')]};}_0x47aae0['push'](_0x4e1518);}}_0x4f0330({'count':_0x47aae0[_0xf349('0x56')],'rows':_0x47aae0});});},'VoiceChannels':function(_0x992e1b){return new Promise(function(_0x4dbfd4,_0x33179b){var _0x18946e=_['values'](_0x2fd288['channels']);_0x4dbfd4({'count':_0x18946e[_0xf349('0x56')],'rows':_0x18946e});});},'VoiceChannelMixMonitor':function(_0x536f61){var _0x35f917=this;return new Promise(function(_0x2733da,_0x44c94e){if(ami[_0xf349('0xf')]()==![]){return _0x44c94e(_0x35f917[_0xf349('0x10')](0x1f4,[config[_0xf349('0x11')]['ip'],config[_0xf349('0x11')]['username'],_0xf349('0x1b')][_0xf349('0x13')]('\x20')));}var _0x32dc71=schema(properties[_0xf349('0x57')])[_0xf349('0x2')](_0x536f61);if(_0x32dc71[_0xf349('0x56')]>0x0){return _0x44c94e(_0x35f917[_0xf349('0x10')](0x1f4,_[_0xf349('0x58')](_0x32dc71,_0xf349('0x19'))[_0xf349('0x13')](',\x20')));}var _0x151008=_[_0xf349('0x59')](_0x2fd288[_0xf349('0x5a')],{'uniqueid':_0x536f61[_0xf349('0x5b')]});if(_0x151008&&_0x151008['channel']){var _0x41266e=util[_0xf349('0x6')]('%s.%s',_0x536f61['filename']||_0x536f61['uniqueid'],_0x536f61[_0xf349('0x6')]||_0xf349('0x5c'));return ami['Action']({'action':_0xf349('0x5d'),'channel':_0x151008['channel'],'file':_0x41266e,'options':_0xf349('0x5e')})[_0xf349('0x18')](function(_0xfa2972){var _0x4227a5=_['find'](_0x151008[_0xf349('0x5f')],{'filename':_0xf349('0x60')+_0x41266e[_0xf349('0x61')]()});if(_[_0xf349('0x62')](_0x4227a5)){_0x151008['monitors'][_0xf349('0x63')]({'filename':'/var/spool/asterisk/monitor/'+_0x41266e[_0xf349('0x61')](),'createdAt':moment()[_0xf349('0x6')](_0xf349('0x64')),'mixmonitorid':_0xfa2972[_0xf349('0x65')],'status':_0xf349('0x66')});}else{_0x4227a5[_0xf349('0x65')]=_0xfa2972['mixmonitorid'];_0x4227a5[_0xf349('0x67')]='rec';}_0x2733da({'code':0xc8,'message':[_0x536f61['uniqueid'],_0xf349('0x68'),_0xfa2972[_0xf349('0x65')]][_0xf349('0x13')]('\x20'),'mixmonitorid':_0xfa2972[_0xf349('0x65')]});})[_0xf349('0x1a')](function(_0x2a08dc){_0x44c94e(_0x35f917[_0xf349('0x10')](0x1f5,[_0x536f61[_0xf349('0x5b')],_0x2a08dc[_0xf349('0x19')][_0xf349('0x61')]()][_0xf349('0x13')]('\x20')));});}else{return _0x44c94e(_0x35f917[_0xf349('0x10')](0x1f5,_0xf349('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x151985){var _0x12db91=this;return new Promise(function(_0x330bee,_0x58030a){if(ami[_0xf349('0xf')]()==![]){return _0x58030a(_0x12db91[_0xf349('0x10')](0x1f4,[config[_0xf349('0x11')]['ip'],config[_0xf349('0x11')][_0xf349('0x12')],_0xf349('0x1b')][_0xf349('0x13')]('\x20')));}var _0x28f99c=schema(properties[_0xf349('0x57')])['validate'](_0x151985);if(_0x28f99c[_0xf349('0x56')]>0x0){return _0x58030a(_0x12db91[_0xf349('0x10')](0x1f4,_[_0xf349('0x58')](_0x28f99c,'message')[_0xf349('0x13')](',\x20')));}var _0x1f9eed=_[_0xf349('0x59')](_0x2fd288[_0xf349('0x5a')],{'uniqueid':_0x151985[_0xf349('0x5b')]});if(_0x1f9eed){return BPromise[_0xf349('0x6a')]()[_0xf349('0x18')](function(){if(_0x1f9eed['channel']){return ami[_0xf349('0x17')]({'action':'StopMixMonitor','channel':_0x1f9eed[_0xf349('0x6b')],'mixmonitorid':_0x151985['mixmonitorid']})[_0xf349('0x1a')](function(_0x3a5a4a){});}})[_0xf349('0x18')](function(){if(_0x1f9eed['destinationchannel']){return ami[_0xf349('0x17')]({'action':_0xf349('0x6c'),'channel':_0x1f9eed[_0xf349('0x6d')],'mixmonitorid':_0x151985[_0xf349('0x65')]})['catch'](function(_0x343f78){});}})[_0xf349('0x18')](function(_0x2ec227){var _0x168249=_[_0xf349('0x59')](_0x1f9eed['monitors'],{'mixmonitorid':_0x151985[_0xf349('0x65')]});if(_0x168249){_0x168249[_0xf349('0x67')]=_0xf349('0x6e');}})['then'](function(){var _0x298195=util[_0xf349('0x6')]('%s.%s',_0x151985[_0xf349('0x6f')]||_0x151985[_0xf349('0x5b')],_0x151985[_0xf349('0x6')]||'wav');var _0x57439d=_[_0xf349('0x59')](_0x1f9eed[_0xf349('0x5f')],{'filename':_0xf349('0x60')+_0x298195[_0xf349('0x61')]()});if(_0x57439d){_0x57439d['status']='stop';}})[_0xf349('0x18')](function(){_0x330bee({'code':0xc8,'message':[_0x151985[_0xf349('0x5b')],'StopMixMonitor\x20Success'][_0xf349('0x13')]('\x20')});})[_0xf349('0x1a')](function(_0x53c5da){_0x58030a(_0x12db91[_0xf349('0x10')](0x1f5,[_0x151985[_0xf349('0x5b')],_0x53c5da[_0xf349('0x19')][_0xf349('0x61')]()][_0xf349('0x13')]('\x20')));});}else{return _0x58030a(_0x12db91[_0xf349('0x10')](0x1f5,_0xf349('0x69')));}});},'VoiceQueuesChannels':function(_0x326304){return new Promise(function(_0x11eeda,_0x3a8d38){var _0x1a7ec5=_['values'](_0x2fd288[_0xf349('0x70')]);_0x11eeda({'count':_0x1a7ec5[_0xf349('0x56')],'rows':_0x1a7ec5});});},'VoiceQueuesChannel':function(_0x27a5d0){var _0x4027d7=this;return new Promise(function(_0x5ad343,_0x55cf7b){var _0x123409=schema(properties[_0xf349('0x71')])[_0xf349('0x2')](_0x27a5d0);if(_0x123409[_0xf349('0x56')]>0x0){return _0x55cf7b(_0x4027d7[_0xf349('0x10')](0x1f4,_[_0xf349('0x58')](_0x123409,'message')[_0xf349('0x13')](',\x20')));}var _0xd9d4a7=_[_0xf349('0x59')](_0x2fd288['queueChannels'],{'uniqueid':_0x27a5d0[_0xf349('0x5b')]});if(_0xd9d4a7){_0x5ad343(_0xd9d4a7);}else{return _0x55cf7b(_0x4027d7[_0xf349('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4537ef){var _0x158c11=this;return new Promise(function(_0x501681,_0x50d0c3){if(ami[_0xf349('0xf')]()==![]){return _0x50d0c3(_0x158c11[_0xf349('0x10')](0x1f4,[config[_0xf349('0x11')]['ip'],config['asterisk']['username'],_0xf349('0x1b')]['join']('\x20')));}var _0x2740a3=schema(properties[_0xf349('0x72')])[_0xf349('0x2')](_0x4537ef);if(_0x2740a3[_0xf349('0x56')]>0x0){return _0x50d0c3(_0x158c11[_0xf349('0x10')](0x1f4,_['map'](_0x2740a3,_0xf349('0x19'))[_0xf349('0x13')](',\x20')));}var _0x2c4e4d=_[_0xf349('0x59')](_0x2fd288['queueChannels'],{'uniqueid':_0x4537ef[_0xf349('0x5b')]});if(_0x2c4e4d&&_0x2c4e4d['channel']){return ami['Action']({'action':_0xf349('0x73'),'channel':_0x2c4e4d[_0xf349('0x6b')]})[_0xf349('0x18')](function(_0x203c1a){_0x501681({'code':0xc8,'message':[_0x4537ef[_0xf349('0x5b')],_0x203c1a[_0xf349('0x19')]['toLowerCase']()]['join']('\x20')});})[_0xf349('0x1a')](function(_0x233fba){_0x50d0c3(_0x158c11['error'](0x1f5,[_0x4537ef[_0xf349('0x5b')],_0x233fba['message'][_0xf349('0x61')]()][_0xf349('0x13')]('\x20')));});}else{return _0x50d0c3(_0x158c11['error'](0x1f5,_0xf349('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x38883c){var _0x9f0ec4=this;return new Promise(function(_0x314882,_0x47b410){if(ami[_0xf349('0xf')]()==![]){return _0x47b410(_0x9f0ec4['error'](0x1f4,[config[_0xf349('0x11')]['ip'],config[_0xf349('0x11')][_0xf349('0x12')],_0xf349('0x1b')][_0xf349('0x13')]('\x20')));}var _0x1275cb=schema(properties[_0xf349('0x74')])[_0xf349('0x2')](_0x38883c);if(_0x1275cb[_0xf349('0x56')]>0x0){return _0x47b410(_0x9f0ec4[_0xf349('0x10')](0x1f4,_['map'](_0x1275cb,_0xf349('0x19'))[_0xf349('0x13')](',\x20')));}var _0xa19697=_['find'](_0x2fd288[_0xf349('0x70')],{'uniqueid':_0x38883c[_0xf349('0x5b')]});if(_0xa19697&&_0xa19697[_0xf349('0x6b')]){return ami[_0xf349('0x17')]({'action':'Redirect','channel':_0xa19697[_0xf349('0x6b')],'exten':_0x38883c[_0xf349('0x75')],'context':_0x38883c[_0xf349('0x76')]||_0xa19697['context'],'priority':0x1})[_0xf349('0x18')](function(_0x223f91){_0x314882({'code':0xc8,'message':[_0x38883c[_0xf349('0x5b')],_0x223f91[_0xf349('0x19')][_0xf349('0x61')]()][_0xf349('0x13')]('\x20')});})[_0xf349('0x1a')](function(_0xe5f625){_0x47b410(_0x9f0ec4[_0xf349('0x10')](0x1f5,[_0x38883c[_0xf349('0x5b')],_0xe5f625[_0xf349('0x19')][_0xf349('0x61')]()]['join']('\x20')));});}else{return _0x47b410(_0x9f0ec4['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x25e0a3){return new Promise(function(_0xa9a8c0,_0x2f5f72){var _0x26afaa=_[_0xf349('0x77')](_0x2fd288['agents']);_0xa9a8c0({'count':_0x26afaa[_0xf349('0x56')],'rows':_0x26afaa});});},'Telephones':function(_0xfe8c08){return new Promise(function(_0x22849b,_0x1c27d1){var _0x2c75b0=_[_0xf349('0x77')](_0x2fd288[_0xf349('0x78')]);_0x22849b({'count':_0x2c75b0[_0xf349('0x56')],'rows':_0x2c75b0});});},'Trunks':function(_0x97ec06){return new Promise(function(_0x112f23,_0x48ec4c){var _0xb2415a=_[_0xf349('0x77')](_0x2fd288[_0xf349('0x79')]);_0x112f23({'count':_0xb2415a[_0xf349('0x56')],'rows':_0xb2415a});});},'OutboundChannels':function(_0x595432){return new Promise(function(_0x417317,_0x1a2466){var _0x5bc6af=_['values'](_0x2fd288[_0xf349('0x7a')]);_0x417317({'count':_0x5bc6af[_0xf349('0x56')],'rows':_0x5bc6af});});},'Outbound':function(_0x34a3e7){return new Promise(function(_0x43044d,_0x2c3c75){_0x43044d(_0x2fd288['outbound']);});},'Campaigns':function(_0x58956e){return new Promise(function(_0x5b04f1,_0x4b15e3){var _0x11f036=_[_0xf349('0x77')](_0x2fd288[_0xf349('0x7b')]);_0x5b04f1({'count':_0x11f036['length'],'rows':_0x11f036});});},'VoiceQueuesPreview':function(_0x193854){var _0x17b5d5=this;return new Promise(function(_0x4847ca,_0x5c5153){_0x19ca8e[_0xf349('0x7c')](_0x193854['id'])[_0xf349('0x18')](function(_0x57b56a){_0x4847ca({'code':0xc8,'message':_0x57b56a[_0xf349('0x19')]});})[_0xf349('0x1a')](function(_0x34b239){_0x5c5153(_0x17b5d5[_0xf349('0x10')](0x1f4,_0x34b239[_0xf349('0x19')]));});});},'EventManager':function(_0x28aa0f){var _0x483f15=this;return new Promise(function(_0x37750b,_0x4b6dea){if(!_0x28aa0f[_0xf349('0x7d')]){return _0x4b6dea(_0x483f15[_0xf349('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xf349('0x7e')](_0xf349('0x7f')+_0x28aa0f[_0xf349('0x7d')],_0x28aa0f[_0xf349('0x19')]);_0x37750b({'code':0xc8,'message':_0x28aa0f});});},'FaxAccounts':function(_0x17dd20){return new Promise(function(_0x4e0f31,_0x3ead84){var _0xe2d52b=_['values'](_0x2fd288[_0xf349('0x80')]);_0x4e0f31({'count':_0xe2d52b['length'],'rows':_0xe2d52b});});},'SendFax':function(_0x1691e0){var _0x244e0d=this;return new Promise(function(_0x306760,_0x579f3e){_0x46d7d8[_0xf349('0x81')](_0x1691e0)[_0xf349('0x18')](function(_0x245b00){_0x306760({'code':0xc8,'message':_0x245b00[_0xf349('0x19')]});})[_0xf349('0x1a')](function(_0x2bf07d){_0x579f3e(_0x244e0d['error'](0x1f4,_0x2bf07d[_0xf349('0x19')]));});});},'CheckAfterSend':function(_0x6c5084){var _0x1c36c9=this;return new Promise(function(_0x4f3d31,_0x8c010a){_0x46d7d8[_0xf349('0x82')](_0x6c5084)[_0xf349('0x18')](function(_0x3dd934){_0x4f3d31({'code':0xc8,'message':_0x3dd934['message']});})['catch'](function(_0xd3cc73){_0x8c010a(_0x1c36c9['error'](0x1f4,_0xd3cc73[_0xf349('0x19')]));});});}};var _0xc3f9d0=jayson[_0xf349('0x83')](_0x5e292d)['http']();_0xc3f9d0['on'](_0xf349('0x10'),function(_0x1396ee){return _0x1d2037(_0x1396ee);});_0xc3f9d0[_0xf349('0x84')](0x232a,'127.0.0.1',function(){console[_0xf349('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0xc24035(_0xf349('0x86')+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 501cc10..3b708a8 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 _0x36ff=['user:%s','name','trigger:%s','toLowerCase','data1','[%s][%s]\x20Contact\x20not\x20found','[%s][%s]\x20Contact\x20created:%s','action','catch','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','merge','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','stringify','exec','autoCreate','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','resolve','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format'];(function(_0x416985,_0xc58f20){var _0x17649b=function(_0x124b57){while(--_0x124b57){_0x416985['push'](_0x416985['shift']());}};_0x17649b(++_0xc58f20);}(_0x36ff,0xb8));var _0xf36f=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x36ff[_0x187ee1];return _0x388160;};'use strict';var BPromise=require(_0xf36f('0x0'));var util=require(_0xf36f('0x1'));var _=require(_0xf36f('0x2'));var Redis=require(_0xf36f('0x3'));var config=require(_0xf36f('0x4'));var logger=require(_0xf36f('0x5'))(_0xf36f('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xf36f('0x7')]=_[_0xf36f('0x8')](config[_0xf36f('0x7')],{'host':_0xf36f('0x9'),'port':0x18eb});var io=require(_0xf36f('0xa'))(new Redis(config[_0xf36f('0x7')]));function emit(_0x117048,_0x474718,_0x1414f1,_0x5f26fb){logger[_0xf36f('0xb')](_0xf36f('0xc'),_0x117048,'',_0x474718,_0x1414f1,JSON[_0xf36f('0xd')](_0x5f26fb));io['to'](_0x474718)['emit'](_0x1414f1,_0x5f26fb);}exports[_0xf36f('0xe')]=function(_0x39ad28,_0x3455fa,_0x4f6326){_0x4f6326[_0xf36f('0xf')]=0x0;if(_0x3455fa['data2']&&parseInt(_0x3455fa['data2'],0xa)){var _0x57c641={'ListId':parseInt(_0x3455fa['data1'],0xa),'phone':_0x4f6326[_0xf36f('0x10')]};if(_['isNil'](_0x4f6326[_0xf36f('0x11')])){_0x57c641[_0xf36f('0x12')]=_0x4f6326[_0xf36f('0x13')]&&_0x4f6326[_0xf36f('0x13')]!==_0xf36f('0x14')?_0x4f6326[_0xf36f('0x13')]:_0x4f6326[_0xf36f('0x10')]||_0x4f6326[_0xf36f('0x15')];}else{_0x57c641[_0xf36f('0x12')]=_0x4f6326['destcalleridname']&&_0x4f6326[_0xf36f('0x16')]!==_0xf36f('0x14')?_0x4f6326[_0xf36f('0x16')]:_0x4f6326['destcalleridnum']||_0x4f6326[_0xf36f('0x15')];_0x57c641['phone']=_0x4f6326[_0xf36f('0x16')]&&_0x4f6326['destcalleridname']!==_0xf36f('0x14')?_0x4f6326[_0xf36f('0x16')]:_0x4f6326[_0xf36f('0x17')]||_0x4f6326[_0xf36f('0x15')];}BPromise[_0xf36f('0x18')]()[_0xf36f('0x19')](cmContactRpc[_0xf36f('0x1a')]({'where':_[_0xf36f('0x1b')](_0x57c641,[_0xf36f('0x12')])}))[_0xf36f('0x19')](function(_0x40ec5f){if(_0x40ec5f){logger['info'](_0xf36f('0x1c'),_0x4f6326[_0xf36f('0x15')],'',_0x40ec5f['id']);if(_0x39ad28){_0x4f6326[_0xf36f('0x1d')]=_0x40ec5f['id'];emit(_0x4f6326['uniqueid'],util[_0xf36f('0x1e')](_0xf36f('0x1f'),_0x39ad28[_0xf36f('0x20')]),util['format'](_0xf36f('0x21'),_0x3455fa['action'][_0xf36f('0x22')]()),_['merge'](_0x4f6326,{'ListId':parseInt(_0x3455fa[_0xf36f('0x23')],0xa)}));}return;}else{logger[_0xf36f('0xb')](_0xf36f('0x24'),_0x4f6326['uniqueid'],'');return BPromise[_0xf36f('0x18')]()['then'](cmContactRpc['createContact'](_0x57c641));}})[_0xf36f('0x19')](function(_0x232530){if(_0x232530){logger[_0xf36f('0xb')](_0xf36f('0x25'),_0x4f6326[_0xf36f('0x15')],'',_0x232530['id']);if(_0x39ad28){_0x4f6326[_0xf36f('0x1d')]=_0x232530['id'];emit(_0x4f6326[_0xf36f('0x15')],util[_0xf36f('0x1e')](_0xf36f('0x1f'),_0x39ad28[_0xf36f('0x20')]),util[_0xf36f('0x1e')](_0xf36f('0x21'),_0x3455fa[_0xf36f('0x26')]['toLowerCase']()),_['merge'](_0x4f6326,{'ListId':parseInt(_0x3455fa[_0xf36f('0x23')],0xa)}));}}})[_0xf36f('0x27')](function(_0x1c98ab){logger['error'](_0xf36f('0x28'),_0x4f6326[_0xf36f('0x15')],'',JSON[_0xf36f('0xd')](_0x1c98ab));});}else{if(_0x39ad28){logger[_0xf36f('0xb')](_0xf36f('0x29'),_0x4f6326['uniqueid'],'');emit(_0x4f6326['uniqueid'],util[_0xf36f('0x1e')](_0xf36f('0x1f'),_0x39ad28[_0xf36f('0x20')]),util[_0xf36f('0x1e')](_0xf36f('0x21'),_0x3455fa['action']['toLowerCase']()),_[_0xf36f('0x2a')]({'ListId':parseInt(_0x3455fa[_0xf36f('0x23')],0xa)},_0x4f6326));}}}; \ No newline at end of file +var _0x9feb=['','uniqueid','destcalleridname','phone','destcalleridnum','resolve','then','showContact','xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','catch','error','[%s][%s]\x20Error\x20creating\x20contact','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname'];(function(_0x5bef89,_0x7c41b4){var _0x1c34dd=function(_0x3df243){while(--_0x3df243){_0x5bef89['push'](_0x5bef89['shift']());}};_0x1c34dd(++_0x7c41b4);}(_0x9feb,0x6e));var _0xb9fe=function(_0x49626c,_0x25d3d0){_0x49626c=_0x49626c-0x0;var _0x1979b6=_0x9feb[_0x49626c];return _0x1979b6;};'use strict';var BPromise=require(_0xb9fe('0x0'));var util=require(_0xb9fe('0x1'));var _=require('lodash');var Redis=require(_0xb9fe('0x2'));var config=require(_0xb9fe('0x3'));var logger=require(_0xb9fe('0x4'))('trigger');var cmContactRpc=require(_0xb9fe('0x5'));config[_0xb9fe('0x6')]=_[_0xb9fe('0x7')](config['redis'],{'host':_0xb9fe('0x8'),'port':0x18eb});var io=require(_0xb9fe('0x9'))(new Redis(config[_0xb9fe('0x6')]));function emit(_0x1dc302,_0x12e664,_0xdcb7bb,_0x580934){logger[_0xb9fe('0xa')](_0xb9fe('0xb'),_0x1dc302,'',_0x12e664,_0xdcb7bb,JSON['stringify'](_0x580934));io['to'](_0x12e664)[_0xb9fe('0xc')](_0xdcb7bb,_0x580934);}exports[_0xb9fe('0xd')]=function(_0x184ab,_0x5e3d5f,_0x2f9b5d){_0x2f9b5d[_0xb9fe('0xe')]=0x0;if(_0x5e3d5f[_0xb9fe('0xf')]&&parseInt(_0x5e3d5f[_0xb9fe('0xf')],0xa)){var _0x2acba4={'ListId':parseInt(_0x5e3d5f[_0xb9fe('0x10')],0xa),'phone':_0x2f9b5d[_0xb9fe('0x11')]};if(_[_0xb9fe('0x12')](_0x2f9b5d[_0xb9fe('0x13')])){_0x2acba4[_0xb9fe('0x14')]=_0x2f9b5d[_0xb9fe('0x15')]&&_0x2f9b5d[_0xb9fe('0x15')]!==_0xb9fe('0x16')?_0x2f9b5d[_0xb9fe('0x15')]:_0x2f9b5d['calleridnum']||_0x2f9b5d[_0xb9fe('0x17')];}else{_0x2acba4[_0xb9fe('0x14')]=_0x2f9b5d[_0xb9fe('0x18')]&&_0x2f9b5d[_0xb9fe('0x18')]!==_0xb9fe('0x16')?_0x2f9b5d['destcalleridname']:_0x2f9b5d['destcalleridnum']||_0x2f9b5d[_0xb9fe('0x17')];_0x2acba4[_0xb9fe('0x19')]=_0x2f9b5d[_0xb9fe('0x18')]&&_0x2f9b5d[_0xb9fe('0x18')]!==_0xb9fe('0x16')?_0x2f9b5d[_0xb9fe('0x18')]:_0x2f9b5d[_0xb9fe('0x1a')]||_0x2f9b5d[_0xb9fe('0x17')];}BPromise[_0xb9fe('0x1b')]()[_0xb9fe('0x1c')](cmContactRpc[_0xb9fe('0x1d')]({'where':_['omit'](_0x2acba4,[_0xb9fe('0x14')])}))[_0xb9fe('0x1c')](function(_0x37e135){if(_0x37e135){logger[_0xb9fe('0xa')]('[%s][%s]\x20Contact\x20found:%s',_0x2f9b5d['uniqueid'],'',_0x37e135['id']);if(_0x184ab){_0x2f9b5d[_0xb9fe('0x1e')]=_0x37e135['id'];emit(_0x2f9b5d[_0xb9fe('0x17')],util[_0xb9fe('0x1f')](_0xb9fe('0x20'),_0x184ab[_0xb9fe('0x21')]),util['format'](_0xb9fe('0x22'),_0x5e3d5f[_0xb9fe('0x23')][_0xb9fe('0x24')]()),_[_0xb9fe('0x25')](_0x2f9b5d,{'ListId':parseInt(_0x5e3d5f['data1'],0xa)}));}return;}else{logger[_0xb9fe('0xa')](_0xb9fe('0x26'),_0x2f9b5d[_0xb9fe('0x17')],'');return BPromise[_0xb9fe('0x1b')]()[_0xb9fe('0x1c')](cmContactRpc[_0xb9fe('0x27')](_0x2acba4));}})[_0xb9fe('0x1c')](function(_0x58e796){if(_0x58e796){logger['info'](_0xb9fe('0x28'),_0x2f9b5d['uniqueid'],'',_0x58e796['id']);if(_0x184ab){_0x2f9b5d['xmd-contactid2']=_0x58e796['id'];emit(_0x2f9b5d[_0xb9fe('0x17')],util['format'](_0xb9fe('0x20'),_0x184ab[_0xb9fe('0x21')]),util[_0xb9fe('0x1f')]('trigger:%s',_0x5e3d5f[_0xb9fe('0x23')][_0xb9fe('0x24')]()),_[_0xb9fe('0x25')](_0x2f9b5d,{'ListId':parseInt(_0x5e3d5f[_0xb9fe('0x10')],0xa)}));}}})[_0xb9fe('0x29')](function(_0x185ec4){logger[_0xb9fe('0x2a')](_0xb9fe('0x2b'),_0x2f9b5d[_0xb9fe('0x17')],'',JSON['stringify'](_0x185ec4));});}else{if(_0x184ab){logger[_0xb9fe('0xa')]('[%s][%s]\x20Autocreate\x20disabled',_0x2f9b5d[_0xb9fe('0x17')],'');emit(_0x2f9b5d[_0xb9fe('0x17')],util[_0xb9fe('0x1f')](_0xb9fe('0x20'),_0x184ab['name']),util[_0xb9fe('0x1f')]('trigger:%s',_0x5e3d5f['action']['toLowerCase']()),_[_0xb9fe('0x25')]({'ListId':parseInt(_0x5e3d5f['data1'],0xa)},_0x2f9b5d));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 42c6200..dbd9ab3 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 _0xcd1c=['checkTrigger','variables','Actions','length','interface','toLowerCase','browser','popup','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','data6','winapp','winApplication','winArguments','emit','user:%s','name','format','data1','merge','trigger:%s','action','contactmanager','exec','integration','queue','routeId','script','parse','search','replace','every','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:outgoingmessage','custom:acceptmessage','prototype','info','clone','checkTriggers','hasOwnProperty','status'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0xcd1c,0x125));var _0xccd1=function(_0x402154,_0x26526f){_0x402154=_0x402154-0x0;var _0x1092a3=_0xcd1c[_0x402154];return _0x1092a3;};'use strict';var util=require('util');var _=require(_0xccd1('0x0'));var url=require('url');var Mustache=require(_0xccd1('0x1'));var Redis=require(_0xccd1('0x2'));var urlforward=require(_0xccd1('0x3'));var integration=require(_0xccd1('0x4'));var cmContact=require(_0xccd1('0x5'));var script=require(_0xccd1('0x6'));var cmContactRpc=require('../rpc/cmContact');var config=require(_0xccd1('0x7'));var logger=require(_0xccd1('0x8'))('trigger');var ami=require(_0xccd1('0x9'));config['redis']=_[_0xccd1('0xa')](config[_0xccd1('0xb')],{'host':_0xccd1('0xc'),'port':0x18eb});var io=require(_0xccd1('0xd'))(new Redis(config[_0xccd1('0xb')]));var operators={'equals':function(_0x2fffeb,_0x5ea178){return _0x2fffeb==_0x5ea178;},'not_equals':function(_0x1efb08,_0x4073b2){return _0x1efb08!=_0x4073b2;}};var barAndWebActions=['popup',_0xccd1('0xe'),'winapp'];function Trigger(_0x3fd3d7){this[_0xccd1('0xf')]=_0x3fd3d7[_0xccd1('0xf')];this[_0xccd1('0x10')]=_0x3fd3d7[_0xccd1('0x10')];this[_0xccd1('0x11')]=_0x3fd3d7['voiceQueues'];this['templates']=_0x3fd3d7[_0xccd1('0x12')];this[_0xccd1('0x13')]=_0x3fd3d7[_0xccd1('0x13')];this[_0xccd1('0x14')]=_0x3fd3d7[_0xccd1('0x14')];this[_0xccd1('0x15')]=_0x3fd3d7[_0xccd1('0x15')];this[_0xccd1('0x16')]=_0x3fd3d7[_0xccd1('0x16')];this[_0xccd1('0x17')]=_0x3fd3d7[_0xccd1('0x17')];this[_0xccd1('0x18')]=_0x3fd3d7[_0xccd1('0x18')];this[_0xccd1('0x19')]=_0x3fd3d7[_0xccd1('0x19')];this[_0xccd1('0x1a')]=_0x3fd3d7[_0xccd1('0x1a')];this[_0xccd1('0x1b')]=_0x3fd3d7[_0xccd1('0x1b')];this[_0xccd1('0x1c')]=_0x3fd3d7[_0xccd1('0x1c')];this[_0xccd1('0x1d')]=_0x3fd3d7[_0xccd1('0x1d')];this[_0xccd1('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xccd1('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xccd1('0x17')],'zoho':this[_0xccd1('0x18')],'desk':this[_0xccd1('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xccd1('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0xccd1('0x1f'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x22'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x23'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on']('custom:agentcomplete',this[_0xccd1('0x20')]['bind'](this));ami['on'](_0xccd1('0x24'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0xccd1('0x26'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x27'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x28'),this['syncCustomEvent'][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x29'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x2a'),this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x2b'),this[_0xccd1('0x2c')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x2d'),this[_0xccd1('0x2c')]['bind'](this));ami['on'](_0xccd1('0x2e'),this[_0xccd1('0x2c')]['bind'](this));ami['on']('custom:newinteraction',this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0xccd1('0x21')](this));ami['on']('custom:incomingmessage',this[_0xccd1('0x20')][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x2f'),this['syncCustomEvent'][_0xccd1('0x21')](this));ami['on'](_0xccd1('0x30'),this['syncCustomEvent'][_0xccd1('0x21')](this));ami['on']('custom:rejectmessage',this[_0xccd1('0x20')]['bind'](this));}Trigger[_0xccd1('0x31')]['emit']=function(_0x4d4e42,_0x4432bc,_0x595e1e){logger[_0xccd1('0x32')](_0x4d4e42,_0x4432bc,JSON['stringify'](_0x595e1e));io['to'](_0x4d4e42)['emit'](_0x4432bc,_0x595e1e);};Trigger[_0xccd1('0x31')]['syncCustomEvent']=function(_0x3e5549){var _0x5f0238=_[_0xccd1('0x33')](_0x3e5549);this['checkTriggers'](_0x5f0238);};Trigger[_0xccd1('0x31')][_0xccd1('0x2c')]=function(_0x5e3c5f){if(this['agents'][_0x5e3c5f['interface']]){this[_0xccd1('0x20')](_0x5e3c5f);}};Trigger[_0xccd1('0x31')][_0xccd1('0x34')]=function(_0x1f82bc){var _0x2c07f7;for(var _0x3d4cff in this['triggers']){if(this['triggers'][_0xccd1('0x35')](_0x3d4cff)){if(this[_0xccd1('0xf')][_0x3d4cff][_0xccd1('0x36')]){_0x2c07f7=this[_0xccd1('0x37')](this[_0xccd1('0xf')][_0x3d4cff],_0x1f82bc);if(_0x2c07f7){_['merge'](_0x1f82bc,_0x1f82bc[_0xccd1('0x38')]);for(var _0x36c225=0x0,_0x3ddf94,_0x312693,_0x1c96c0;_0x36c2250x0){_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(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 f47b6a0..7dcb786 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 _0x2a96=['isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','enduserId','toLowerCase',']\x20Enduser\x20Created!','string','customField','idField','substring','indexOf','content','ticketType','incidents','getString','Subjects','/contacts(','Fields','phonecall','phonecalls','assign','Descriptions','callDirection','queue','headers','lastIndexOf','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','./util','md5','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','username','then','access_token','catch','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value'];(function(_0x2666cf,_0x4e8a69){var _0x23c837=function(_0x58fd83){while(--_0x58fd83){_0x2666cf['push'](_0x2666cf['shift']());}};_0x23c837(++_0x4e8a69);}(_0x2a96,0x143));var _0x62a9=function(_0x15a346,_0x46d825){_0x15a346=_0x15a346-0x0;var _0x275a0f=_0x2a96[_0x15a346];return _0x275a0f;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x62a9('0x0'));var util=require('util');var intUtil=require(_0x62a9('0x1'));var md5=require(_0x62a9('0x2'));var Redis=require('ioredis');var logger=require(_0x62a9('0x3'))(_0x62a9('0x4'));var config=require('../../../../config/environment');config[_0x62a9('0x5')]=_[_0x62a9('0x6')](config[_0x62a9('0x5')],{'host':_0x62a9('0x7'),'port':0x18eb});var io=require(_0x62a9('0x8'))(new Redis(config[_0x62a9('0x5')]));function getAuthToken(_0x340682,_0x225a4c,_0xf8a3c5){var _0x5e500e={'method':_0x62a9('0x9'),'uri':_0x225a4c,'form':{'client_id':_0x340682['clientId'],'resource':_0x340682[_0x62a9('0xa')],'username':_0x340682[_0x62a9('0xb')],'password':_0x340682['password'],'grant_type':'password','client_secret':_0x340682['clientSecret']},'json':!![]};return rp(_0x5e500e)[_0x62a9('0xc')](function(_0x4de982){return _0x4de982[_0x62a9('0xd')];})[_0x62a9('0xe')](function(_0x22be91){logger['error']('['+[_0xf8a3c5[_0x62a9('0xf')]()]+']\x20Wrong\x20credentials!');return _0x22be91['message'];});}function getUser(_0x52e9b7,_0x510941,_0x4865c,_0x1700dc,_0x999a29,_0x257583){return new BPromise(function(_0x3d076e,_0x571909){return getAuthToken(_0x510941,_0x1700dc,_0x257583)[_0x62a9('0xc')](function(_0x35f9f1){var _0x100843={'method':_0x62a9('0x10'),'uri':_0x999a29+_0x62a9('0x11'),'headers':{'Authorization':_0x62a9('0x12')+_0x35f9f1,'OData-Version':_0x62a9('0x13')},'json':!![]};return rp(_0x100843);})['then'](function(_0x4712d2){var _0x49af95=_0x4712d2[_0x62a9('0x14')];var _0x298359=![];var _0x3a651c=null;if(!_[_0x62a9('0x15')](_0x4865c)){if(intUtil[_0x62a9('0x16')](_0x4865c[_0x62a9('0x17')])){_0x52e9b7[_0x62a9('0x18')]=_0x4865c[_0x62a9('0x17')];for(_0x3a651c=0x0;_0x3a651c<_0x49af95[_0x62a9('0x19')];_0x3a651c++){if(_0x49af95[_0x3a651c][_0x62a9('0x1a')]===_0x4865c[_0x62a9('0x17')]&&!_0x49af95[_0x3a651c][_0x62a9('0x1b')]){_0x298359=!![];logger['info']('['+[_0x257583[_0x62a9('0xf')]()]+_0x62a9('0x1c')+_0x49af95[_0x3a651c]['systemuserid']+'!');_0x52e9b7[_0x62a9('0x1d')]=_0x49af95[_0x3a651c][_0x62a9('0x1e')];}}}}if(!_0x298359){logger[_0x62a9('0x1f')]('['+[_0x257583[_0x62a9('0xf')]()]+_0x62a9('0x20'));_0x52e9b7[_0x62a9('0x18')]=_0x510941[_0x62a9('0xb')];for(_0x3a651c=0x0;_0x3a651c<_0x49af95['length'];_0x3a651c++){if(_0x49af95[_0x3a651c][_0x62a9('0x1a')]===_0x510941[_0x62a9('0xb')]){_0x52e9b7[_0x62a9('0x1d')]=_0x49af95[_0x3a651c][_0x62a9('0x1e')];}}}_0x3d076e(_0x52e9b7);})[_0x62a9('0xe')](function(_0x3a97b0){_0x571909(_0x3a97b0[_0x62a9('0x21')]);});});}function createEndUser(_0x2d1874,_0x3cfaf3,_0x302759,_0x3251de,_0x53f325,_0x5a7d19){return new BPromise(function(_0x5956b2,_0x53f64c){return getAuthToken(_0x3cfaf3,_0x302759,_0x5a7d19)[_0x62a9('0xc')](function(_0x2b2884){var _0x5a4692=_0x5a7d19['toLowerCase']()===_0x62a9('0x22')?_0x53f325[_0x62a9('0x23')]:_0x53f325[_0x62a9('0x24')];var _0x34d79c={'method':_0x62a9('0x9'),'uri':_0x3251de+_0x62a9('0x25'),'body':{'telephone1':_0x5a4692,'fullname':_0x5a4692,'firstname':_0x5a4692,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x62a9('0x26')+_0x2d1874['userId']+')'},'headers':{'Authorization':_0x62a9('0x12')+_0x2b2884,'OData-Version':_0x62a9('0x13')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x34d79c);})[_0x62a9('0xc')](function(_0x3afa55){var _0x3c30fe=_0x3afa55['headers'][_0x62a9('0x27')];var _0x13586e=_0x3c30fe['substring'](_0x3c30fe['lastIndexOf']('(')+0x1,_0x3c30fe['lastIndexOf'](')'));_0x2d1874[_0x62a9('0x28')]=_0x13586e;_0x5956b2(_0x2d1874);})[_0x62a9('0xe')](function(_0x488156){_0x53f64c(_0x488156[_0x62a9('0x21')]);});});}function getEndUser(_0x230315,_0x136ad2,_0x3d300b,_0x133660,_0x8a2356,_0x3d5d49){return new BPromise(function(_0x5e2797,_0x175ae7){return getAuthToken(_0x136ad2,_0x3d300b,_0x3d5d49)[_0x62a9('0xc')](function(_0x59dd61){var _0x2cceee={'method':_0x62a9('0x10'),'uri':_0x133660+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x59dd61,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2cceee);})[_0x62a9('0xc')](function(_0x43d035){var _0x4727fc=null;if(_0x43d035){var _0x1f059c=_0x43d035[_0x62a9('0x14')];var _0x5481a2=![];for(_0x4727fc=0x0;_0x4727fc<_0x1f059c[_0x62a9('0x19')];_0x4727fc++){var _0x5e1297=_0x3d5d49[_0x62a9('0x29')]()===_0x62a9('0x22')?_0x8a2356[_0x62a9('0x23')]:_0x8a2356[_0x62a9('0x24')];if(_0x1f059c[_0x4727fc]['telephone1']===_0x5e1297){_0x5481a2=!![];_0x230315['enduserId']=_0x1f059c[_0x4727fc]['contactid'];}}if(_0x5481a2){_0x5e2797(_0x230315);}else{return createEndUser(_0x230315,_0x136ad2,_0x3d300b,_0x133660,_0x8a2356,_0x3d5d49)[_0x62a9('0xc')](function(_0x314388){logger['info']('['+[_0x3d5d49[_0x62a9('0xf')]()]+']\x20Enduser\x20created!',_0x314388[_0x62a9('0x28')]);_0x5e2797(_0x314388);});}}else{return createEndUser(_0x230315,_0x136ad2,_0x3d300b,_0x133660,_0x8a2356,_0x3d5d49)[_0x62a9('0xc')](function(_0x5c89ce){logger[_0x62a9('0x1f')]('['+[_0x3d5d49[_0x62a9('0xf')]()]+_0x62a9('0x2a'),_0x5c89ce[_0x62a9('0x28')]);_0x5e2797(_0x5c89ce);});}});});}function getCustomFields(_0x18ac6c,_0x324b5a,_0x356483){var _0xf03323={};if(_0x18ac6c['length']>0x0){_['forEach'](_0x18ac6c,function(_0x270852){if(_0x270852['type']===_0x62a9('0x2b')&&_0x270852['nameField']&&!_0x270852[_0x62a9('0x2c')]){var _0x5d4de4=_0x270852[_0x62a9('0x2d')][_0x62a9('0x29')]();var _0x2aa2f1=_0x5d4de4[_0x62a9('0x2e')](0x0,_0x5d4de4[_0x62a9('0x2f')]('_'));var _0x54e15c=_0x5d4de4['substring'](_0x5d4de4[_0x62a9('0x2f')]('_')+0x1);if(_0x2aa2f1===_0x356483){_0xf03323[_0x54e15c]=_0x270852[_0x62a9('0x30')];}}});}return _0xf03323;}function getTicket(_0x38b504,_0x405f2e,_0xe5b199,_0x499740,_0xa345f0,_0x1b53c2,_0xf9050a){return new BPromise(function(_0x2b6462,_0x34f336){var _0x258bf5;return getAuthToken(_0x405f2e,_0xe5b199,_0xf9050a)['then'](function(_0x10576e){if(_0x1b53c2[_0x62a9('0x31')]==='incident'){_0x258bf5={'method':_0x62a9('0x9'),'uri':_0x499740+_0x62a9('0x32'),'body':Object['assign']({},{'title':intUtil[_0x62a9('0x33')](_0x1b53c2[_0x62a9('0x34')],_0xa345f0,'\x20'),'description':intUtil['getString'](_0x1b53c2['Descriptions'],_0xa345f0,'\x0a'),'customerid_contact@odata.bind':_0x62a9('0x35')+_0x38b504[_0x62a9('0x28')]+')','ownerid@odata.bind':_0x62a9('0x26')+_0x38b504[_0x62a9('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x1b53c2[_0x62a9('0x36')],_0xa345f0,_0x1b53c2[_0x62a9('0x31')])),'headers':{'Authorization':_0x62a9('0x12')+_0x10576e,'OData-Version':_0x62a9('0x13')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1b53c2[_0x62a9('0x31')]===_0x62a9('0x37')){_0x258bf5={'method':_0x62a9('0x9'),'uri':_0x499740+_0x62a9('0x38'),'body':Object[_0x62a9('0x39')]({},{'subject':intUtil[_0x62a9('0x33')](_0x1b53c2[_0x62a9('0x34')],_0xa345f0,'\x20'),'phonenumber':String(_0xa345f0[_0x62a9('0x24')]),'description':intUtil['getString'](_0x1b53c2[_0x62a9('0x3a')],_0xa345f0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x62a9('0x35')+_0x38b504[_0x62a9('0x28')]+')','ownerid@odata.bind':_0x62a9('0x26')+_0x38b504[_0x62a9('0x1d')]+')','directioncode':_0x38b504[_0x62a9('0x3b')]===_0x62a9('0x3c')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x62a9('0x26')+_0x38b504['userId']+')','participationtypemask':_0x38b504[_0x62a9('0x3b')]===_0x62a9('0x3c')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x38b504[_0x62a9('0x28')]+')','participationtypemask':_0x38b504[_0x62a9('0x3b')]===_0x62a9('0x3c')?0x1:0x2}]},getCustomFields(_0x1b53c2['Fields'],_0xa345f0,_0x1b53c2[_0x62a9('0x31')])),'headers':{'Authorization':'Bearer\x20'+_0x10576e,'OData-Version':_0x62a9('0x13')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x258bf5);})['then'](function(_0x575a9e){var _0x5f06da=_0x575a9e[_0x62a9('0x3d')][_0x62a9('0x27')];var _0x9c2808=_0x5f06da[_0x62a9('0x2e')](_0x5f06da[_0x62a9('0x3e')]('(')+0x1,_0x5f06da[_0x62a9('0x3e')](')'));_0x38b504[_0x62a9('0x3f')]=_0x9c2808;_0x2b6462(_0x38b504);})[_0x62a9('0xe')](function(_0x338723){_0x34f336(_0x338723[_0x62a9('0x21')]);});});}function emit(_0xc41e7,_0x23be6c,_0x414d17,_0x32efba){var _0xa7dbf0={'uri':util['format'](_0x62a9('0x40'),_0xc41e7,_0x414d17,_0x32efba)};io['to'](util[_0x62a9('0x41')](_0x62a9('0x42'),_0x23be6c))['emit'](_0x62a9('0x43'),_0xa7dbf0);}exports['cs']=function(_0x252f9e,_0x39d1a8,_0x525865,_0x47f2ac,_0x5cacde,_0x1a89c9,_0x3eb72d,_0x2f37c7){var _0x32f27e={};_0x1a89c9[_0x62a9('0xa')]=intUtil[_0x62a9('0x44')](_0x1a89c9[_0x62a9('0xa')]);_0x1a89c9[_0x62a9('0x45')]=intUtil[_0x62a9('0x44')](_0x1a89c9[_0x62a9('0x45')]);_0x32f27e[_0x62a9('0x3b')]=_0x2f37c7===_0x62a9('0x3c')||_0x2f37c7===_0x62a9('0x46')?_0x62a9('0x3c'):'outbound';var _0x1b265c=util['format'](_0x62a9('0x47'),_0x1a89c9[_0x62a9('0xa')]);var _0x473e1d=util[_0x62a9('0x41')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1a89c9[_0x62a9('0x48')]);var _0x1e06d5=util[_0x62a9('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a89c9[_0x62a9('0x45')],_0x39d1a8['uniqueid'],md5(_0x39d1a8[_0x62a9('0x49')]));if(_0x5cacde&&_0x5cacde[_0x62a9('0x4a')]){logger[_0x62a9('0x1f')](_0x62a9('0x4b'),_0x62a9('0x4c'));_0x39d1a8[_0x62a9('0x4d')]=_0x1e06d5;}else if(_0x3eb72d&&_0x3eb72d[_0x62a9('0x4e')]&&_0x3eb72d[_0x62a9('0x4e')]!=='none'){logger['info']('[OUTBOUND]',_0x62a9('0x4c'));_0x39d1a8['recordingURL']=_0x1e06d5;}else{_0x39d1a8[_0x62a9('0x4d')]='';}return getUser(_0x32f27e,_0x1a89c9,_0x47f2ac,_0x473e1d,_0x1b265c,_0x2f37c7)[_0x62a9('0xc')](function(_0x5889dd){logger[_0x62a9('0x1f')]('['+_0x2f37c7['toUpperCase']()+_0x62a9('0x4f'),_0x5889dd[_0x62a9('0x1d')]);logger[_0x62a9('0x1f')]('['+_0x2f37c7[_0x62a9('0xf')]()+_0x62a9('0x50'),_0x5889dd[_0x62a9('0x18')]);return getEndUser(_0x5889dd,_0x1a89c9,_0x473e1d,_0x1b265c,_0x39d1a8,_0x2f37c7);})[_0x62a9('0xc')](function(_0x5c6d3d){logger[_0x62a9('0x1f')]('['+_0x2f37c7['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x5c6d3d[_0x62a9('0x28')]);logger[_0x62a9('0x1f')]('['+_0x2f37c7['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x39d1a8['calleridnum']);return getTicket(_0x5c6d3d,_0x1a89c9,_0x473e1d,_0x1b265c,_0x39d1a8,_0x525865,_0x2f37c7);})[_0x62a9('0xc')](function(_0x184d4e){logger[_0x62a9('0x1f')](util[_0x62a9('0x41')]('['+_0x2f37c7[_0x62a9('0xf')]()+_0x62a9('0x51'),_0x525865[_0x62a9('0x31')],_0x184d4e[_0x62a9('0x3f')]));logger[_0x62a9('0x1f')](util[_0x62a9('0x41')]('['+_0x2f37c7[_0x62a9('0xf')]()+']\x20Call\x20direction:\x20%s',_0x2f37c7));if(_0x2f37c7!==_0x62a9('0x46')){logger['info']('['+_0x2f37c7['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1a89c9[_0x62a9('0xa')],_0x47f2ac[_0x62a9('0x52')],_0x525865[_0x62a9('0x31')],_0x184d4e[_0x62a9('0x3f')]);}})[_0x62a9('0xe')](function(_0x5c2455){logger[_0x62a9('0x53')]('['+_0x2f37c7[_0x62a9('0xf')]()+_0x62a9('0x54'),util[_0x62a9('0x55')](_0x5c2455,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7f55=['error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','outbound','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','idField','indexOf','incidents','getString','Subjects','/contacts(','ticketType','phonecall','phonecalls','assign','Descriptions','callDirection','queue','Fields','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20Call\x20direction:\x20%s','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','POST','clientId','remoteUri','username','password','clientSecret','access_token'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x7f55,0x1ae));var _0x57f5=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x7f55[_0x119705];return _0x2affc2;};'use strict';var _=require('lodash');var BPromise=require(_0x57f5('0x0'));var rp=require(_0x57f5('0x1'));var util=require(_0x57f5('0x2'));var intUtil=require(_0x57f5('0x3'));var md5=require(_0x57f5('0x4'));var Redis=require(_0x57f5('0x5'));var logger=require(_0x57f5('0x6'))(_0x57f5('0x7'));var config=require(_0x57f5('0x8'));config['redis']=_[_0x57f5('0x9')](config['redis'],{'host':_0x57f5('0xa'),'port':0x18eb});var io=require(_0x57f5('0xb'))(new Redis(config[_0x57f5('0xc')]));function getAuthToken(_0xac1d66,_0x15427b,_0x2d698d){var _0x58564e={'method':_0x57f5('0xd'),'uri':_0x15427b,'form':{'client_id':_0xac1d66[_0x57f5('0xe')],'resource':_0xac1d66[_0x57f5('0xf')],'username':_0xac1d66[_0x57f5('0x10')],'password':_0xac1d66[_0x57f5('0x11')],'grant_type':'password','client_secret':_0xac1d66[_0x57f5('0x12')]},'json':!![]};return rp(_0x58564e)['then'](function(_0x25d8fd){return _0x25d8fd[_0x57f5('0x13')];})['catch'](function(_0x3ad554){logger[_0x57f5('0x14')]('['+[_0x2d698d[_0x57f5('0x15')]()]+']\x20Wrong\x20credentials!');return _0x3ad554[_0x57f5('0x16')];});}function getUser(_0x185719,_0x1f530e,_0x5ac8c6,_0x2c4125,_0x458f61,_0x447277){return new BPromise(function(_0x5077a2,_0x56fa57){return getAuthToken(_0x1f530e,_0x2c4125,_0x447277)['then'](function(_0x325c77){var _0x13e0b3={'method':_0x57f5('0x17'),'uri':_0x458f61+_0x57f5('0x18'),'headers':{'Authorization':_0x57f5('0x19')+_0x325c77,'OData-Version':_0x57f5('0x1a')},'json':!![]};return rp(_0x13e0b3);})[_0x57f5('0x1b')](function(_0xa10e7b){var _0x38e5a2=_0xa10e7b[_0x57f5('0x1c')];var _0x2cf6ae=![];var _0xc83e9d=null;if(!_['isNil'](_0x5ac8c6)){if(intUtil[_0x57f5('0x1d')](_0x5ac8c6[_0x57f5('0x1e')])){_0x185719[_0x57f5('0x1f')]=_0x5ac8c6[_0x57f5('0x1e')];for(_0xc83e9d=0x0;_0xc83e9d<_0x38e5a2[_0x57f5('0x20')];_0xc83e9d++){if(_0x38e5a2[_0xc83e9d][_0x57f5('0x21')]===_0x5ac8c6['email']&&!_0x38e5a2[_0xc83e9d]['isdisabled']){_0x2cf6ae=!![];logger[_0x57f5('0x22')]('['+[_0x447277[_0x57f5('0x15')]()]+_0x57f5('0x23')+_0x38e5a2[_0xc83e9d][_0x57f5('0x24')]+'!');_0x185719['userId']=_0x38e5a2[_0xc83e9d][_0x57f5('0x24')];}}}}if(!_0x2cf6ae){logger['info']('['+[_0x447277[_0x57f5('0x15')]()]+_0x57f5('0x25'));_0x185719[_0x57f5('0x1f')]=_0x1f530e['username'];for(_0xc83e9d=0x0;_0xc83e9d<_0x38e5a2['length'];_0xc83e9d++){if(_0x38e5a2[_0xc83e9d][_0x57f5('0x21')]===_0x1f530e[_0x57f5('0x10')]){_0x185719[_0x57f5('0x26')]=_0x38e5a2[_0xc83e9d][_0x57f5('0x24')];}}}_0x5077a2(_0x185719);})[_0x57f5('0x27')](function(_0x1b6432){_0x56fa57(_0x1b6432[_0x57f5('0x16')]);});});}function createEndUser(_0x50cf68,_0x1222ab,_0x4e8c9f,_0x41049e,_0x50661d,_0x2cf997){return new BPromise(function(_0x9d01f0,_0x2041a9){return getAuthToken(_0x1222ab,_0x4e8c9f,_0x2cf997)[_0x57f5('0x1b')](function(_0x4ea7f6){var _0x163953=_0x2cf997['toLowerCase']()===_0x57f5('0x28')?_0x50661d['destcalleridnum']:_0x50661d[_0x57f5('0x29')];var _0x55628a={'method':_0x57f5('0xd'),'uri':_0x41049e+'contacts','body':{'telephone1':_0x163953,'fullname':_0x163953,'firstname':_0x163953,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x57f5('0x2a')+_0x50cf68[_0x57f5('0x26')]+')'},'headers':{'Authorization':_0x57f5('0x19')+_0x4ea7f6,'OData-Version':_0x57f5('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x55628a);})[_0x57f5('0x1b')](function(_0x212f22){var _0x1dfcee=_0x212f22[_0x57f5('0x2b')][_0x57f5('0x2c')];var _0xee3ceb=_0x1dfcee[_0x57f5('0x2d')](_0x1dfcee[_0x57f5('0x2e')]('(')+0x1,_0x1dfcee[_0x57f5('0x2e')](')'));_0x50cf68[_0x57f5('0x2f')]=_0xee3ceb;_0x9d01f0(_0x50cf68);})[_0x57f5('0x27')](function(_0x43e5ee){_0x2041a9(_0x43e5ee['message']);});});}function getEndUser(_0x519141,_0x5a461b,_0x4ce778,_0x4c7a84,_0x3c9a71,_0xe07328){return new BPromise(function(_0x2a9582,_0x2d2109){return getAuthToken(_0x5a461b,_0x4ce778,_0xe07328)[_0x57f5('0x1b')](function(_0x447097){var _0x26a8fe={'method':_0x57f5('0x17'),'uri':_0x4c7a84+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x447097,'If-None-Match':null,'OData-Version':_0x57f5('0x1a')},'json':!![]};return rp(_0x26a8fe);})[_0x57f5('0x1b')](function(_0xf11134){var _0x82818d=null;if(_0xf11134){var _0x55510b=_0xf11134[_0x57f5('0x1c')];var _0x3c4ca4=![];for(_0x82818d=0x0;_0x82818d<_0x55510b['length'];_0x82818d++){var _0x2d6408=_0xe07328['toLowerCase']()===_0x57f5('0x28')?_0x3c9a71[_0x57f5('0x30')]:_0x3c9a71['calleridnum'];if(_0x55510b[_0x82818d][_0x57f5('0x31')]===_0x2d6408){_0x3c4ca4=!![];_0x519141[_0x57f5('0x2f')]=_0x55510b[_0x82818d][_0x57f5('0x32')];}}if(_0x3c4ca4){_0x2a9582(_0x519141);}else{return createEndUser(_0x519141,_0x5a461b,_0x4ce778,_0x4c7a84,_0x3c9a71,_0xe07328)[_0x57f5('0x1b')](function(_0x372853){logger[_0x57f5('0x22')]('['+[_0xe07328[_0x57f5('0x15')]()]+_0x57f5('0x33'),_0x372853[_0x57f5('0x2f')]);_0x2a9582(_0x372853);});}}else{return createEndUser(_0x519141,_0x5a461b,_0x4ce778,_0x4c7a84,_0x3c9a71,_0xe07328)[_0x57f5('0x1b')](function(_0x3444b8){logger[_0x57f5('0x22')]('['+[_0xe07328[_0x57f5('0x15')]()]+_0x57f5('0x34'),_0x3444b8[_0x57f5('0x2f')]);_0x2a9582(_0x3444b8);});}});});}function getCustomFields(_0x44204a,_0x192e5e,_0x57b612){var _0x266094={};if(_0x44204a[_0x57f5('0x20')]>0x0){_[_0x57f5('0x35')](_0x44204a,function(_0x463673){if(_0x463673['type']===_0x57f5('0x36')&&_0x463673[_0x57f5('0x37')]&&!_0x463673['customField']){var _0x3adf53=_0x463673[_0x57f5('0x38')]['toLowerCase']();var _0x499c67=_0x3adf53['substring'](0x0,_0x3adf53[_0x57f5('0x39')]('_'));var _0x53f72a=_0x3adf53['substring'](_0x3adf53['indexOf']('_')+0x1);if(_0x499c67===_0x57b612){_0x266094[_0x53f72a]=_0x463673['content'];}}});}return _0x266094;}function getTicket(_0x39be71,_0x15739e,_0x33806c,_0x2d9504,_0x1fd3df,_0x2f6d88,_0xb6ce4d){return new BPromise(function(_0x2809ba,_0x5c4fcc){var _0x56b82b;return getAuthToken(_0x15739e,_0x33806c,_0xb6ce4d)[_0x57f5('0x1b')](function(_0x50c698){if(_0x2f6d88['ticketType']==='incident'){_0x56b82b={'method':_0x57f5('0xd'),'uri':_0x2d9504+_0x57f5('0x3a'),'body':Object['assign']({},{'title':intUtil[_0x57f5('0x3b')](_0x2f6d88[_0x57f5('0x3c')],_0x1fd3df,'\x20'),'description':intUtil['getString'](_0x2f6d88['Descriptions'],_0x1fd3df,'\x0a'),'customerid_contact@odata.bind':_0x57f5('0x3d')+_0x39be71[_0x57f5('0x2f')]+')','ownerid@odata.bind':_0x57f5('0x2a')+_0x39be71[_0x57f5('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x2f6d88['Fields'],_0x1fd3df,_0x2f6d88[_0x57f5('0x3e')])),'headers':{'Authorization':_0x57f5('0x19')+_0x50c698,'OData-Version':_0x57f5('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f6d88[_0x57f5('0x3e')]===_0x57f5('0x3f')){_0x56b82b={'method':_0x57f5('0xd'),'uri':_0x2d9504+_0x57f5('0x40'),'body':Object[_0x57f5('0x41')]({},{'subject':intUtil[_0x57f5('0x3b')](_0x2f6d88[_0x57f5('0x3c')],_0x1fd3df,'\x20'),'phonenumber':String(_0x1fd3df[_0x57f5('0x29')]),'description':intUtil['getString'](_0x2f6d88[_0x57f5('0x42')],_0x1fd3df,'\x0a'),'regardingobjectid_contact@odata.bind':_0x57f5('0x3d')+_0x39be71[_0x57f5('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x39be71[_0x57f5('0x26')]+')','directioncode':_0x39be71[_0x57f5('0x43')]===_0x57f5('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x57f5('0x2a')+_0x39be71[_0x57f5('0x26')]+')','participationtypemask':_0x39be71[_0x57f5('0x43')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x57f5('0x3d')+_0x39be71[_0x57f5('0x2f')]+')','participationtypemask':_0x39be71['callDirection']===_0x57f5('0x44')?0x1:0x2}]},getCustomFields(_0x2f6d88[_0x57f5('0x45')],_0x1fd3df,_0x2f6d88[_0x57f5('0x3e')])),'headers':{'Authorization':_0x57f5('0x19')+_0x50c698,'OData-Version':_0x57f5('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x56b82b);})[_0x57f5('0x1b')](function(_0x3673b2){var _0x16f779=_0x3673b2[_0x57f5('0x2b')][_0x57f5('0x2c')];var _0x1fc076=_0x16f779[_0x57f5('0x2d')](_0x16f779['lastIndexOf']('(')+0x1,_0x16f779[_0x57f5('0x2e')](')'));_0x39be71['ticketId']=_0x1fc076;_0x2809ba(_0x39be71);})[_0x57f5('0x27')](function(_0x5bac02){_0x5c4fcc(_0x5bac02[_0x57f5('0x16')]);});});}function emit(_0x28efc2,_0x59ebd1,_0x4a4044,_0x41960e){var _0xfcfa51={'uri':util['format'](_0x57f5('0x46'),_0x28efc2,_0x4a4044,_0x41960e)};io['to'](util[_0x57f5('0x47')](_0x57f5('0x48'),_0x59ebd1))[_0x57f5('0x49')](_0x57f5('0x4a'),_0xfcfa51);}exports['cs']=function(_0x355e1e,_0x5e69c6,_0x595057,_0x47884d,_0x2a3c2f,_0x424f6b,_0x366c2b,_0x30950e){var _0x32c785={};_0x424f6b[_0x57f5('0xf')]=intUtil[_0x57f5('0x4b')](_0x424f6b['remoteUri']);_0x424f6b['serverUrl']=intUtil[_0x57f5('0x4b')](_0x424f6b[_0x57f5('0x4c')]);_0x32c785[_0x57f5('0x43')]=_0x30950e==='queue'||_0x30950e===_0x57f5('0x4d')?_0x57f5('0x44'):_0x57f5('0x28');var _0x5b8f73=util[_0x57f5('0x47')]('%s/api/data/v9.0/',_0x424f6b[_0x57f5('0xf')]);var _0x4a913d=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x424f6b[_0x57f5('0x4e')]);var _0x44aa16=util[_0x57f5('0x47')](_0x57f5('0x4f'),_0x424f6b[_0x57f5('0x4c')],_0x5e69c6[_0x57f5('0x50')],md5(_0x5e69c6[_0x57f5('0x50')]));if(_0x2a3c2f&&_0x2a3c2f['monitor_format']){logger[_0x57f5('0x22')](_0x57f5('0x51'),_0x57f5('0x52'));_0x5e69c6[_0x57f5('0x53')]=_0x44aa16;}else if(_0x366c2b&&_0x366c2b['recordingFormat']&&_0x366c2b[_0x57f5('0x54')]!==_0x57f5('0x55')){logger[_0x57f5('0x22')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5e69c6[_0x57f5('0x53')]=_0x44aa16;}else{_0x5e69c6[_0x57f5('0x53')]='';}return getUser(_0x32c785,_0x424f6b,_0x47884d,_0x4a913d,_0x5b8f73,_0x30950e)[_0x57f5('0x1b')](function(_0x4f4d6c){logger[_0x57f5('0x22')]('['+_0x30950e[_0x57f5('0x15')]()+_0x57f5('0x56'),_0x4f4d6c['userId']);logger[_0x57f5('0x22')]('['+_0x30950e[_0x57f5('0x15')]()+']\x20The\x20User\x20email\x20is:',_0x4f4d6c['userEmail']);return getEndUser(_0x4f4d6c,_0x424f6b,_0x4a913d,_0x5b8f73,_0x5e69c6,_0x30950e);})[_0x57f5('0x1b')](function(_0x2da931){logger[_0x57f5('0x22')]('['+_0x30950e[_0x57f5('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2da931[_0x57f5('0x2f')]);logger[_0x57f5('0x22')]('['+_0x30950e[_0x57f5('0x15')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5e69c6['calleridnum']);return getTicket(_0x2da931,_0x424f6b,_0x4a913d,_0x5b8f73,_0x5e69c6,_0x595057,_0x30950e);})['then'](function(_0x41105a){logger[_0x57f5('0x22')](util[_0x57f5('0x47')]('['+_0x30950e[_0x57f5('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x595057[_0x57f5('0x3e')],_0x41105a['ticketId']));logger[_0x57f5('0x22')](util[_0x57f5('0x47')]('['+_0x30950e[_0x57f5('0x15')]()+_0x57f5('0x57'),_0x30950e));if(_0x30950e!=='unmanaged'){logger[_0x57f5('0x22')]('['+_0x30950e['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x424f6b['remoteUri'],_0x47884d['name'],_0x595057[_0x57f5('0x3e')],_0x41105a[_0x57f5('0x58')]);}})[_0x57f5('0x27')](function(_0x1b9745){logger[_0x57f5('0x14')]('['+_0x30950e[_0x57f5('0x15')]()+_0x57f5('0x59'),util['inspect'](_0x1b9745,{'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 9a5e915..1600547 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 _0x7365=['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\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','defaults','map','string','customField','nameField','toLowerCase','content','type','idField','push','Variable','name'];(function(_0x3ea0af,_0x59adce){var _0x4b860f=function(_0x1352de){while(--_0x1352de){_0x3ea0af['push'](_0x3ea0af['shift']());}};_0x4b860f(++_0x59adce);}(_0x7365,0x72));var _0x5736=function(_0x40197b,_0x4e763f){_0x40197b=_0x40197b-0x0;var _0x3b9c2f=_0x7365[_0x40197b];return _0x3b9c2f;};'use strict';var _=require(_0x5736('0x0'));var rp=require(_0x5736('0x1'));var md5=require(_0x5736('0x2'));var util=require('util');var Redis=require(_0x5736('0x3'));var intUtil=require(_0x5736('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5736('0x5'))(_0x5736('0x6'));config[_0x5736('0x7')]=_['defaults'](config[_0x5736('0x7')],{'host':_0x5736('0x8'),'port':0x18eb});var io=require(_0x5736('0x9'))(new Redis(config[_0x5736('0x7')]));var headers={'Content-Type':_0x5736('0xa'),'Accept':_0x5736('0xa')};function emit(_0x1fc7b3,_0x224d23,_0x2324cd){io['to'](_0x1fc7b3)['emit'](_0x224d23,_0x2324cd);}function getTicket(_0x1b0f66,_0x2ee225,_0x3ea015,_0x39f6ce,_0x4335ab){logger[_0x5736('0xb')](_0x5736('0xc'));var _0xd52fa6=_[_0x5736('0xd')]({'responder_id':_0x2ee225['id'],'requester_id':_0x3ea015['id'],'name':util[_0x5736('0xe')](_0x5736('0xf'),_0x4335ab[_0x5736('0x10')]),'phone':_0x4335ab[_0x5736('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5736('0x12')](_0x39f6ce[_0x5736('0x13')],_0x4335ab,'\x20'),'description':intUtil['getString'](_0x39f6ce[_0x5736('0x14')],_0x4335ab,'
'),'tags':getTags(_0x39f6ce['Tags'],'name')},getCustomFields(_0x39f6ce[_0x5736('0x15')],_0x4335ab));_0xd52fa6[_0x5736('0x16')]=_[_0x5736('0x17')](_[_0x5736('0x18')](_0xd52fa6['custom_fields'],'id'),_0x5736('0x19'));return request({'uri':util['format'](_0x5736('0x1a'),_0x1b0f66[_0x5736('0x1b')]),'method':'POST','body':_0xd52fa6})[_0x5736('0x1c')](function(_0x3f22b3){logger[_0x5736('0xb')](_0x5736('0x1d'));return _0x3f22b3;});}function getUser(_0x533cd2,_0x31549a){if(intUtil['validateEmail'](_0x31549a)){return request({'uri':util[_0x5736('0xe')]('%s/api/v2/agents',_0x533cd2[_0x5736('0x1b')]),'qs':{'email':_0x31549a}})[_0x5736('0x1c')](function(_0x338b0c){if(_0x338b0c['length']){logger['info'](_0x5736('0x1e'));return _[_0x5736('0x1f')](_0x338b0c,function(_0x2e0356){return _0x2e0356[_0x5736('0x20')][_0x5736('0x21')]===_0x31549a;});}else{logger[_0x5736('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5736('0xe')](_0x5736('0x22'),_0x533cd2[_0x5736('0x1b')])})['then'](function(_0x10d5ab){logger[_0x5736('0xb')]('Admin\x20account\x20selected.');return _0x10d5ab;});}});}else{logger[_0x5736('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5736('0xe')](_0x5736('0x22'),_0x533cd2['remoteUri'])})[_0x5736('0x1c')](function(_0x1152ee){logger[_0x5736('0xb')](_0x5736('0x23'));return _0x1152ee;});}}function getEndUser(_0x4d9ff2,_0x3a6e38,_0x24c053){logger['info'](_0x5736('0x24'),_0x24c053);return request({'uri':util[_0x5736('0xe')]('%s/api/v2/contacts',_0x4d9ff2[_0x5736('0x1b')]),'qs':{'phone':_0x24c053}})[_0x5736('0x1c')](function(_0xfebe3f){if(_0xfebe3f[_0x5736('0x25')]){logger['info'](_0x5736('0x26'));return _[_0x5736('0x1f')](_0xfebe3f,{'phone':_0x24c053});}else{logger[_0x5736('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5736('0xe')](_0x5736('0x27'),_0x4d9ff2['remoteUri']),'method':_0x5736('0x28'),'body':{'name':_0x3a6e38,'phone':_0x24c053}})[_0x5736('0x1c')](function(_0x56b3e9){logger[_0x5736('0xb')](_0x5736('0x29'));return _0x56b3e9;});}});}function getAuth(_0x562ff8){return util[_0x5736('0xe')](_0x5736('0x2a'),new Buffer(_0x562ff8[_0x5736('0x2b')]+':X')[_0x5736('0x2c')](_0x5736('0x2d')));}function request(_0x38419b){logger[_0x5736('0x2e')]('[HTTP]',JSON[_0x5736('0x2f')](_0x38419b));return rp(_[_0x5736('0x30')](_0x38419b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5be5f6,_0x40afa8){var _0x6773fb=[];if(_0x5be5f6&&_0x5be5f6['length']>0x0){_0x6773fb=_[_0x5736('0x31')](_0x5be5f6,_0x40afa8);}return _0x6773fb;}function getCustomFields(_0x4ace9b,_0x55e32c){var _0x546750=[];var _0x324788={'custom_fields':[]};if(_0x4ace9b[_0x5736('0x25')]>0x0){_['forEach'](_0x4ace9b,function(_0x107472){if(_0x107472['type']===_0x5736('0x32')&&_0x107472['nameField']&&!_0x107472[_0x5736('0x33')]){_0x324788[_0x107472[_0x5736('0x34')][_0x5736('0x35')]()]=_0x107472[_0x5736('0x36')]['toString']();}else if(_0x107472[_0x5736('0x37')]===_0x5736('0x32')&&_0x107472[_0x5736('0x38')]&&_0x107472[_0x5736('0x33')]){_0x324788[_0x5736('0x16')][_0x5736('0x39')]({'id':_0x107472[_0x5736('0x38')],'value':_0x107472[_0x5736('0x36')][_0x5736('0x2c')]()});}else if(_0x107472[_0x5736('0x37')]==='variable'&&_0x107472['variableName']&&_0x107472[_0x5736('0x38')]&&_0x107472['customField']){_0x55e32c[_0x107472['variableName']]&&_0x324788[_0x5736('0x16')][_0x5736('0x39')]({'id':_0x107472[_0x5736('0x38')],'value':_0x55e32c[_0x107472['variableName']][_0x5736('0x2c')]()});}else if(_0x107472['type']==='customVariable'&&_0x107472['Variable']&&_0x107472[_0x5736('0x3a')][_0x5736('0x3b')]&&_0x107472[_0x5736('0x38')]&&_0x107472['customField']){_0x55e32c[_0x107472[_0x5736('0x3a')]['name'][_0x5736('0x35')]()]&&_0x324788['custom_fields'][_0x5736('0x39')]({'id':_0x107472[_0x5736('0x38')],'value':_0x55e32c[_0x107472[_0x5736('0x3a')]['name'][_0x5736('0x35')]()][_0x5736('0x2c')]()});}});}return _0x324788;}exports[_0x5736('0x3c')]=function(_0x572f09,_0x289fd5,_0x25ba47,_0xdac099,_0x1812c6,_0xb73e8a){var _0x30345b,_0x32fa9e;_0xb73e8a['remoteUri']=intUtil[_0x5736('0x3d')](_0xb73e8a[_0x5736('0x1b')]);_0xb73e8a['serverUrl']=intUtil['stripTrailingSlash'](_0xb73e8a[_0x5736('0x3e')]);if(_0x1812c6&&_0x1812c6[_0x5736('0x3f')]){logger[_0x5736('0xb')](_0x5736('0x40'),_0x5736('0x41'));_0x289fd5[_0x5736('0x42')]=util[_0x5736('0xe')](_0x5736('0x43'),_0xb73e8a[_0x5736('0x3e')],_0x289fd5[_0x5736('0x44')],md5(_0x289fd5[_0x5736('0x44')]));}else{_0x289fd5[_0x5736('0x42')]='';}headers[_0x5736('0x45')]=getAuth(_0xb73e8a);return getUser(_0xb73e8a,_0xdac099[_0x5736('0x21')])[_0x5736('0x1c')](function(_0x476d15){_0x30345b=_0x476d15;logger['info'](_0x5736('0x46'),_0x30345b['id']);return getEndUser(_0xb73e8a,_0x289fd5[_0x5736('0x10')],_0x289fd5[_0x5736('0x11')]);})[_0x5736('0x1c')](function(_0x572aaa){_0x32fa9e=_0x572aaa;logger['info'](_0x5736('0x47'),_0x32fa9e['id']);return getTicket(_0xb73e8a,_0x30345b,_0x32fa9e,_0x25ba47,_0x289fd5);})[_0x5736('0x1c')](function(_0x241938){if(_0x241938&&_0x241938['id']){logger[_0x5736('0xb')](_0x5736('0x1d'));logger[_0x5736('0xb')]('The\x20Ticket\x20ID\x20is:',_0x241938['id']);logger['info'](_0x5736('0x40'),_0x5736('0x48'));emit(util[_0x5736('0xe')](_0x5736('0x49'),_0xdac099[_0x5736('0x3b')]),_0x5736('0x4a'),{'uri':util[_0x5736('0xe')](_0x5736('0x4b'),_0xb73e8a[_0x5736('0x1b')],_0x241938['id'])});}})[_0x5736('0x4c')](function(_0x3ea6a2){logger[_0x5736('0x4d')]('[QUEUE]',JSON['stringify'](_0x3ea6a2));});};exports[_0x5736('0x4e')]=function(_0x32510a,_0x520168,_0x4ba93e,_0x599444,_0x341a64,_0x5ca755,_0x193b92){var _0x2f1d50,_0x2f1101;_0x5ca755['remoteUri']=intUtil[_0x5736('0x3d')](_0x5ca755[_0x5736('0x1b')]);_0x5ca755[_0x5736('0x3e')]=intUtil['stripTrailingSlash'](_0x5ca755[_0x5736('0x3e')]);if(_0x193b92&&_0x193b92[_0x5736('0x4f')]&&_0x193b92['recordingFormat']!==_0x5736('0x50')){logger['info']('[OUTBOUND]',_0x5736('0x41'));_0x520168[_0x5736('0x42')]=util[_0x5736('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ca755[_0x5736('0x3e')],_0x520168[_0x5736('0x44')],md5(_0x520168[_0x5736('0x44')]));}headers['Authorization']=getAuth(_0x5ca755);return getUser(_0x5ca755,_0x599444[_0x5736('0x21')])['then'](function(_0x3694ab){_0x2f1d50=_0x3694ab;logger['info'](_0x5736('0x46'),_0x2f1d50['id']);return getEndUser(_0x5ca755,_0x520168[_0x5736('0x51')],_0x520168[_0x5736('0x52')]);})[_0x5736('0x1c')](function(_0x103b8b){_0x2f1101=_0x103b8b;logger[_0x5736('0xb')](_0x5736('0x47'),_0x2f1101['id']);return getTicket(_0x5ca755,_0x2f1d50,_0x2f1101,_0x4ba93e,_0x520168);})[_0x5736('0x1c')](function(_0x2235df){if(_0x2235df&&_0x2235df['id']){logger[_0x5736('0xb')](_0x5736('0x1d'));logger[_0x5736('0xb')](_0x5736('0x53'),_0x2235df['id']);logger[_0x5736('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5736('0x49'),_0x599444['name']),_0x5736('0x4a'),{'uri':util[_0x5736('0xe')](_0x5736('0x4b'),_0x5ca755['remoteUri'],_0x2235df['id'])});}})[_0x5736('0x4c')](function(_0x379a58){logger['error'](_0x5736('0x54'),JSON[_0x5736('0x2f')](_0x379a58));});};exports[_0x5736('0x55')]=function(_0x5490b0,_0x1f5627,_0x40ac8e,_0x149707,_0x215088,_0x19d971){var _0x168130,_0x2c6d78;_0x19d971['remoteUri']=intUtil[_0x5736('0x3d')](_0x19d971[_0x5736('0x1b')]);_0x19d971[_0x5736('0x3e')]=intUtil[_0x5736('0x3d')](_0x19d971[_0x5736('0x3e')]);if(_0x215088&&_0x215088[_0x5736('0x3f')]){logger['info']('['+_0x1f5627['lastevent'][_0x5736('0x56')]()+']',_0x5736('0x41'));_0x1f5627[_0x5736('0x42')]=util['format'](_0x5736('0x43'),_0x19d971[_0x5736('0x3e')],_0x1f5627[_0x5736('0x44')],md5(_0x1f5627['uniqueid']));}else{_0x1f5627[_0x5736('0x42')]='';}headers[_0x5736('0x45')]=getAuth(_0x19d971);return getUser(_0x19d971,'')[_0x5736('0x1c')](function(_0x5484d2){_0x168130=_0x5484d2;logger[_0x5736('0xb')](_0x5736('0x46'),_0x168130['id']);return getEndUser(_0x19d971,_0x1f5627[_0x5736('0x10')],_0x1f5627['calleridnum']);})[_0x5736('0x1c')](function(_0x1fe5fc){_0x2c6d78=_0x1fe5fc;logger[_0x5736('0xb')](_0x5736('0x47'),_0x2c6d78['id']);return getTicket(_0x19d971,_0x168130,_0x2c6d78,_0x40ac8e,_0x1f5627);})[_0x5736('0x1c')](function(_0x5efda1){if(_0x5efda1){logger[_0x5736('0xb')](_0x5736('0x1d'));logger[_0x5736('0xb')](_0x5736('0x53'),_0x5efda1['id']);}})[_0x5736('0x4c')](function(_0x6e55fc){logger[_0x5736('0x4d')]('['+_0x1f5627['lastevent']['toUpperCase']()+']',JSON[_0x5736('0x2f')](_0x6e55fc));});}; \ No newline at end of file +var _0xd873=['The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','lastevent','toUpperCase','Authorization','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!'];(function(_0x3fa0fd,_0x23c7b3){var _0x1e93de=function(_0x54b300){while(--_0x54b300){_0x3fa0fd['push'](_0x3fa0fd['shift']());}};_0x1e93de(++_0x23c7b3);}(_0xd873,0x11e));var _0x3d87=function(_0x1639da,_0x161b9f){_0x1639da=_0x1639da-0x0;var _0x134d7f=_0xd873[_0x1639da];return _0x134d7f;};'use strict';var _=require(_0x3d87('0x0'));var rp=require(_0x3d87('0x1'));var md5=require(_0x3d87('0x2'));var util=require(_0x3d87('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3d87('0x4'));var config=require(_0x3d87('0x5'));var logger=require(_0x3d87('0x6'))(_0x3d87('0x7'));config[_0x3d87('0x8')]=_[_0x3d87('0x9')](config[_0x3d87('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3d87('0xa'))(new Redis(config[_0x3d87('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x3d87('0xb')};function emit(_0x373061,_0x2b4cc3,_0x28df59){io['to'](_0x373061)['emit'](_0x2b4cc3,_0x28df59);}function getTicket(_0x487e21,_0x2d15e5,_0x3ea44a,_0x40421f,_0x26c764){logger['info'](_0x3d87('0xc'));var _0x2a22ae=_[_0x3d87('0xd')]({'responder_id':_0x2d15e5['id'],'requester_id':_0x3ea44a['id'],'name':util[_0x3d87('0xe')]('Caller\x20-\x20%s',_0x26c764[_0x3d87('0xf')]),'phone':_0x26c764[_0x3d87('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x40421f[_0x3d87('0x11')],_0x26c764,'\x20'),'description':intUtil[_0x3d87('0x12')](_0x40421f[_0x3d87('0x13')],_0x26c764,'
'),'tags':getTags(_0x40421f[_0x3d87('0x14')],_0x3d87('0x15'))},getCustomFields(_0x40421f[_0x3d87('0x16')],_0x26c764));_0x2a22ae[_0x3d87('0x17')]=_[_0x3d87('0x18')](_['keyBy'](_0x2a22ae['custom_fields'],'id'),_0x3d87('0x19'));return request({'uri':util[_0x3d87('0xe')]('%s/api/v2/tickets',_0x487e21[_0x3d87('0x1a')]),'method':_0x3d87('0x1b'),'body':_0x2a22ae})[_0x3d87('0x1c')](function(_0xc681dd){logger[_0x3d87('0x1d')](_0x3d87('0x1e'));return _0xc681dd;});}function getUser(_0xe834b4,_0x336df0){if(intUtil[_0x3d87('0x1f')](_0x336df0)){return request({'uri':util[_0x3d87('0xe')](_0x3d87('0x20'),_0xe834b4[_0x3d87('0x1a')]),'qs':{'email':_0x336df0}})[_0x3d87('0x1c')](function(_0x46cf2c){if(_0x46cf2c[_0x3d87('0x21')]){logger[_0x3d87('0x1d')](_0x3d87('0x22'));return _['find'](_0x46cf2c,function(_0x69e2ff){return _0x69e2ff['contact'][_0x3d87('0x23')]===_0x336df0;});}else{logger[_0x3d87('0x1d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3d87('0xe')](_0x3d87('0x24'),_0xe834b4[_0x3d87('0x1a')])})['then'](function(_0x443352){logger['info'](_0x3d87('0x25'));return _0x443352;});}});}else{logger['info'](_0x3d87('0x26'));return request({'uri':util[_0x3d87('0xe')](_0x3d87('0x24'),_0xe834b4[_0x3d87('0x1a')])})[_0x3d87('0x1c')](function(_0xc26997){logger[_0x3d87('0x1d')](_0x3d87('0x25'));return _0xc26997;});}}function getEndUser(_0x5f0f91,_0x30fdf0,_0x113fd9){logger[_0x3d87('0x1d')](_0x3d87('0x27'),_0x113fd9);return request({'uri':util['format'](_0x3d87('0x28'),_0x5f0f91['remoteUri']),'qs':{'phone':_0x113fd9}})['then'](function(_0x458a49){if(_0x458a49[_0x3d87('0x21')]){logger[_0x3d87('0x1d')](_0x3d87('0x29'));return _[_0x3d87('0x2a')](_0x458a49,{'phone':_0x113fd9});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x3d87('0x28'),_0x5f0f91[_0x3d87('0x1a')]),'method':_0x3d87('0x1b'),'body':{'name':_0x30fdf0,'phone':_0x113fd9}})[_0x3d87('0x1c')](function(_0x299c7d){logger[_0x3d87('0x1d')](_0x3d87('0x2b'));return _0x299c7d;});}});}function getAuth(_0x5c501c){return util[_0x3d87('0xe')](_0x3d87('0x2c'),new Buffer(_0x5c501c[_0x3d87('0x2d')]+':X')[_0x3d87('0x2e')](_0x3d87('0x2f')));}function request(_0x1b5122){logger[_0x3d87('0x30')](_0x3d87('0x31'),JSON[_0x3d87('0x32')](_0x1b5122));return rp(_['defaults'](_0x1b5122,{'method':_0x3d87('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x12bee6,_0x588fd7){var _0x12975a=[];if(_0x12bee6&&_0x12bee6[_0x3d87('0x21')]>0x0){_0x12975a=_[_0x3d87('0x34')](_0x12bee6,_0x588fd7);}return _0x12975a;}function getCustomFields(_0x16bf70,_0x4236ae){var _0x356166=[];var _0x6e9e11={'custom_fields':[]};if(_0x16bf70[_0x3d87('0x21')]>0x0){_[_0x3d87('0x35')](_0x16bf70,function(_0x33ed91){if(_0x33ed91[_0x3d87('0x36')]===_0x3d87('0x37')&&_0x33ed91[_0x3d87('0x38')]&&!_0x33ed91[_0x3d87('0x39')]){_0x6e9e11[_0x33ed91[_0x3d87('0x38')][_0x3d87('0x3a')]()]=_0x33ed91[_0x3d87('0x3b')][_0x3d87('0x2e')]();}else if(_0x33ed91[_0x3d87('0x36')]===_0x3d87('0x37')&&_0x33ed91[_0x3d87('0x3c')]&&_0x33ed91[_0x3d87('0x39')]){_0x6e9e11[_0x3d87('0x17')][_0x3d87('0x3d')]({'id':_0x33ed91[_0x3d87('0x3c')],'value':_0x33ed91[_0x3d87('0x3b')]['toString']()});}else if(_0x33ed91['type']===_0x3d87('0x3e')&&_0x33ed91[_0x3d87('0x3f')]&&_0x33ed91[_0x3d87('0x3c')]&&_0x33ed91[_0x3d87('0x39')]){_0x4236ae[_0x33ed91['variableName']]&&_0x6e9e11[_0x3d87('0x17')][_0x3d87('0x3d')]({'id':_0x33ed91[_0x3d87('0x3c')],'value':_0x4236ae[_0x33ed91[_0x3d87('0x3f')]][_0x3d87('0x2e')]()});}else if(_0x33ed91['type']===_0x3d87('0x40')&&_0x33ed91[_0x3d87('0x41')]&&_0x33ed91[_0x3d87('0x41')]['name']&&_0x33ed91[_0x3d87('0x3c')]&&_0x33ed91[_0x3d87('0x39')]){_0x4236ae[_0x33ed91[_0x3d87('0x41')][_0x3d87('0x15')][_0x3d87('0x3a')]()]&&_0x6e9e11['custom_fields'][_0x3d87('0x3d')]({'id':_0x33ed91['idField'],'value':_0x4236ae[_0x33ed91['Variable'][_0x3d87('0x15')][_0x3d87('0x3a')]()][_0x3d87('0x2e')]()});}});}return _0x6e9e11;}exports['queue']=function(_0x274c81,_0x43fd87,_0x568e34,_0x13b8dc,_0x106f7e,_0x656248){var _0xb72b93,_0x499ca5;_0x656248[_0x3d87('0x1a')]=intUtil['stripTrailingSlash'](_0x656248[_0x3d87('0x1a')]);_0x656248[_0x3d87('0x42')]=intUtil[_0x3d87('0x43')](_0x656248['serverUrl']);if(_0x106f7e&&_0x106f7e[_0x3d87('0x44')]){logger['info'](_0x3d87('0x45'),'Recording\x20is\x20enabled!');_0x43fd87[_0x3d87('0x46')]=util[_0x3d87('0xe')](_0x3d87('0x47'),_0x656248[_0x3d87('0x42')],_0x43fd87[_0x3d87('0x48')],md5(_0x43fd87[_0x3d87('0x48')]));}else{_0x43fd87['recordingURL']='';}headers['Authorization']=getAuth(_0x656248);return getUser(_0x656248,_0x13b8dc['email'])[_0x3d87('0x1c')](function(_0x1650c2){_0xb72b93=_0x1650c2;logger[_0x3d87('0x1d')]('The\x20User\x20ID\x20is:',_0xb72b93['id']);return getEndUser(_0x656248,_0x43fd87['calleridname'],_0x43fd87[_0x3d87('0x10')]);})[_0x3d87('0x1c')](function(_0x1263d9){_0x499ca5=_0x1263d9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x499ca5['id']);return getTicket(_0x656248,_0xb72b93,_0x499ca5,_0x568e34,_0x43fd87);})[_0x3d87('0x1c')](function(_0xfa3053){if(_0xfa3053&&_0xfa3053['id']){logger[_0x3d87('0x1d')](_0x3d87('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0xfa3053['id']);logger[_0x3d87('0x1d')](_0x3d87('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3d87('0xe')](_0x3d87('0x49'),_0x13b8dc[_0x3d87('0x15')]),_0x3d87('0x4a'),{'uri':util[_0x3d87('0xe')](_0x3d87('0x4b'),_0x656248['remoteUri'],_0xfa3053['id'])});}})['catch'](function(_0xb3bd91){logger[_0x3d87('0x4c')](_0x3d87('0x45'),JSON[_0x3d87('0x32')](_0xb3bd91));});};exports[_0x3d87('0x4d')]=function(_0x9d704a,_0x4be781,_0x577d15,_0xe00ee0,_0x16e1a2,_0x268ded,_0x35d906){var _0x569391,_0x2e0953;_0x268ded[_0x3d87('0x1a')]=intUtil[_0x3d87('0x43')](_0x268ded[_0x3d87('0x1a')]);_0x268ded[_0x3d87('0x42')]=intUtil[_0x3d87('0x43')](_0x268ded[_0x3d87('0x42')]);if(_0x35d906&&_0x35d906[_0x3d87('0x4e')]&&_0x35d906[_0x3d87('0x4e')]!==_0x3d87('0x4f')){logger[_0x3d87('0x1d')](_0x3d87('0x50'),_0x3d87('0x51'));_0x4be781[_0x3d87('0x46')]=util[_0x3d87('0xe')](_0x3d87('0x47'),_0x268ded['serverUrl'],_0x4be781[_0x3d87('0x48')],md5(_0x4be781[_0x3d87('0x48')]));}headers['Authorization']=getAuth(_0x268ded);return getUser(_0x268ded,_0xe00ee0[_0x3d87('0x23')])[_0x3d87('0x1c')](function(_0x529d19){_0x569391=_0x529d19;logger[_0x3d87('0x1d')](_0x3d87('0x52'),_0x569391['id']);return getEndUser(_0x268ded,_0x4be781['destcalleridname'],_0x4be781[_0x3d87('0x53')]);})[_0x3d87('0x1c')](function(_0x485608){_0x2e0953=_0x485608;logger[_0x3d87('0x1d')](_0x3d87('0x54'),_0x2e0953['id']);return getTicket(_0x268ded,_0x569391,_0x2e0953,_0x577d15,_0x4be781);})[_0x3d87('0x1c')](function(_0x33f6b8){if(_0x33f6b8&&_0x33f6b8['id']){logger[_0x3d87('0x1d')](_0x3d87('0x1e'));logger['info'](_0x3d87('0x55'),_0x33f6b8['id']);logger[_0x3d87('0x1d')]('[OUTBOUND]',_0x3d87('0x56'));emit(util[_0x3d87('0xe')](_0x3d87('0x49'),_0xe00ee0['name']),'trigger:browser:url',{'uri':util[_0x3d87('0xe')](_0x3d87('0x4b'),_0x268ded[_0x3d87('0x1a')],_0x33f6b8['id'])});}})[_0x3d87('0x57')](function(_0x51dfd8){logger[_0x3d87('0x4c')]('[OUTBOUND]',JSON['stringify'](_0x51dfd8));});};exports[_0x3d87('0x58')]=function(_0x5903d6,_0x523df7,_0x552403,_0x142137,_0x110b0c,_0x126133){var _0x8eee99,_0x16c8b9;_0x126133[_0x3d87('0x1a')]=intUtil['stripTrailingSlash'](_0x126133[_0x3d87('0x1a')]);_0x126133[_0x3d87('0x42')]=intUtil['stripTrailingSlash'](_0x126133[_0x3d87('0x42')]);if(_0x110b0c&&_0x110b0c[_0x3d87('0x44')]){logger[_0x3d87('0x1d')]('['+_0x523df7[_0x3d87('0x59')][_0x3d87('0x5a')]()+']','Recording\x20is\x20enabled!');_0x523df7[_0x3d87('0x46')]=util['format'](_0x3d87('0x47'),_0x126133[_0x3d87('0x42')],_0x523df7['uniqueid'],md5(_0x523df7['uniqueid']));}else{_0x523df7['recordingURL']='';}headers[_0x3d87('0x5b')]=getAuth(_0x126133);return getUser(_0x126133,'')[_0x3d87('0x1c')](function(_0x4ae050){_0x8eee99=_0x4ae050;logger[_0x3d87('0x1d')](_0x3d87('0x52'),_0x8eee99['id']);return getEndUser(_0x126133,_0x523df7['calleridname'],_0x523df7[_0x3d87('0x10')]);})[_0x3d87('0x1c')](function(_0x5e9051){_0x16c8b9=_0x5e9051;logger[_0x3d87('0x1d')](_0x3d87('0x54'),_0x16c8b9['id']);return getTicket(_0x126133,_0x8eee99,_0x16c8b9,_0x552403,_0x523df7);})[_0x3d87('0x1c')](function(_0x26a239){if(_0x26a239){logger[_0x3d87('0x1d')]('Ticket\x20created!');logger[_0x3d87('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x26a239['id']);}})[_0x3d87('0x57')](function(_0x51040d){logger[_0x3d87('0x4c')]('['+_0x523df7[_0x3d87('0x59')]['toUpperCase']()+']',JSON[_0x3d87('0x32')](_0x51040d));});}; \ 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 ec4caee..7c16b6e 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 _0x2d87=['Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','format','ticketId','Task\x20created:','toUpperCase','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','GET','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','Searching\x20contact\x20with\x20phone','contacts','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact'];(function(_0x26cd38,_0x7276a0){var _0x19ecc2=function(_0x408a13){while(--_0x408a13){_0x26cd38['push'](_0x26cd38['shift']());}};_0x19ecc2(++_0x7276a0);}(_0x2d87,0x170));var _0x72d8=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2d87[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var rp=require(_0x72d8('0x0'));var md5=require(_0x72d8('0x1'));var util=require(_0x72d8('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x72d8('0x3'));var intUtil=require(_0x72d8('0x4'));var config=require(_0x72d8('0x5'));var logger=require(_0x72d8('0x6'))(_0x72d8('0x7'));config[_0x72d8('0x8')]=_['defaults'](config['redis'],{'host':_0x72d8('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x2eed24,_0x3f30f7,_0x1c70ca,_0x3e755a){return new Promise(function(_0x2f0ffe,_0x1d907e){var _0x16e646=![];var _0x43cfbb={'method':_0x72d8('0xa'),'uri':_0x3e755a+'/api/selector/owners','json':!![]};_0x43cfbb['headers']=_0x1c70ca;logger[_0x72d8('0xb')](_0x72d8('0xc'));return rp(_0x43cfbb)['then'](function(_0x3b231a){if(_0x3b231a){var _0x350acc=_0x3b231a[_0x72d8('0xd')];var _0x4df74d=null;for(_0x4df74d=0x0;_0x4df74d<_0x350acc[_0x72d8('0xe')];_0x4df74d++){if(_0x350acc[_0x4df74d][_0x72d8('0xf')]===_0x2eed24[_0x72d8('0x10')]){_0x2eed24[_0x72d8('0x11')]=_0x350acc[_0x4df74d]['id'];_0x16e646=!![];}}if(_0x16e646){logger['info'](_0x72d8('0x12'),_0x2eed24[_0x72d8('0x11')]);_0x2f0ffe(_0x2eed24);}else{_0x1d907e({'statusCode':0x194,'message':_0x72d8('0x13')});}}else{_0x1d907e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x72d8('0x14')](function(_0x40e097){logger[_0x72d8('0x15')]('['+[_0x3f30f7['toUpperCase']()]+']',_0x40e097[_0x72d8('0x16')]);_0x1d907e(_0x40e097);});});}function getUser(_0x5015ba,_0x268697,_0x19ab5d){return function(_0x125844){return new Promise(function(_0x4314a5,_0x14d775){var _0x4d344a={'method':'GET','uri':_0x19ab5d+'/api/selector/owners','json':!![]};_0x4d344a[_0x72d8('0x17')]=_0x268697;logger['info']('Getting\x20user\x20list');return rp(_0x4d344a)[_0x72d8('0x18')](function(_0x154e32){if(_0x154e32){var _0x56114c=_0x154e32[_0x72d8('0xd')];var _0x4ce31d=![];var _0x2e9f8c=null;if(_0x125844[_0x72d8('0x19')]!==null){logger[_0x72d8('0xb')](_0x72d8('0x1a'),_0x125844[_0x72d8('0x19')]);_0x125844[_0x72d8('0x1b')]=_0x125844[_0x72d8('0x19')];for(_0x2e9f8c=0x0;_0x2e9f8c<_0x56114c['length'];_0x2e9f8c++){if(_0x56114c[_0x2e9f8c][_0x72d8('0xf')]===_0x125844['agentEmail']){_0x4ce31d=!![];_0x125844['userId']=_0x56114c[_0x2e9f8c]['id'];logger[_0x72d8('0xb')]('User\x20found:',_0x125844[_0x72d8('0x1c')]);}}}if(!_0x4ce31d){logger[_0x72d8('0xb')](_0x72d8('0x1d'));_0x125844[_0x72d8('0x1b')]=_0x125844['adminEmail'];_0x125844[_0x72d8('0x1c')]=_0x125844['adminId'];_0x4ce31d=!![];}if(_0x4ce31d){_0x4314a5(_0x125844);}else{_0x14d775({'statusCode':0x194,'message':_0x72d8('0x13')});}}else{_0x14d775({'statusCode':0x194,'message':_0x72d8('0x13')});}})[_0x72d8('0x14')](function(_0x19e7d6){logger[_0x72d8('0x15')]('['+[_0x5015ba['toUpperCase']()]+']',_0x19e7d6[_0x72d8('0x16')]);_0x14d775(_0x19e7d6);});});};}function getEndUser(_0x49f2b9,_0x2e42a9,_0x325617){return function(_0x4908bb){return new Promise(function(_0xf22ac8,_0x2781cb){var _0x25e4b1=0x0;var _0x46ee12={'method':_0x72d8('0xa'),'uri':_0x325617+_0x72d8('0x1e'),'json':!![]};_0x46ee12['headers']=_0x2e42a9;logger['info'](_0x72d8('0x1f'));return rp(_0x46ee12)[_0x72d8('0x18')](function(_0x19dff1){_0x19dff1[_0x72d8('0x20')]['forEach'](function(_0x34c98f){if(_0x34c98f[_0x72d8('0x21')]===_0x72d8('0x22')){_0x25e4b1=_0x34c98f['id'];}});})[_0x72d8('0x18')](function(){logger[_0x72d8('0xb')]('Getting\x20contact\x20list');var _0x53bc29={'method':_0x72d8('0xa'),'uri':_0x325617+'/api/contacts/view/'+_0x25e4b1,'json':!![]};_0x53bc29[_0x72d8('0x17')]=_0x2e42a9;return rp(_0x53bc29);})[_0x72d8('0x18')](function(_0x19c40d){logger[_0x72d8('0xb')](_0x72d8('0x23'),_0x4908bb['contactNumber']);if(_0x19c40d[_0x72d8('0x24')][_0x72d8('0xe')]>0x0){var _0x2990a5=_['find'](_0x19c40d['contacts'],function(_0x4b71c0){if(_0x4b71c0['work_number']===_0x4908bb['contactNumber']||_0x4b71c0[_0x72d8('0x25')]===_0x4908bb['contactNumber']){return _0x4b71c0;}});if(_0x2990a5){_0x4908bb[_0x72d8('0x26')]=_0x2990a5['id'];logger[_0x72d8('0xb')](_0x72d8('0x27'),_0x4908bb[_0x72d8('0x26')]);_0xf22ac8(_0x4908bb);}else{return createEndUser(_0x4908bb,_0x49f2b9,_0x2e42a9,_0x325617)[_0x72d8('0x18')](function(_0x3dcb38){logger['info'](_0x72d8('0x28'),_0x4908bb[_0x72d8('0x26')]);_0xf22ac8(_0x3dcb38);});}}else{return createEndUser(_0x4908bb,_0x49f2b9,_0x2e42a9,_0x325617)['then'](function(_0x1ec65b){logger[_0x72d8('0xb')]('Contact\x20created:',_0x4908bb[_0x72d8('0x26')]);_0xf22ac8(_0x1ec65b);});}})['catch'](function(_0x12eee5){throw new Error(_0x12eee5[_0x72d8('0x16')]);});});};}function createEndUser(_0x3d0fdc,_0x74066b,_0x507220,_0x171fc6){return new Promise(function(_0x5acb14,_0x121448){var _0x1a49a9=moment();var _0x5f459a={'method':_0x72d8('0x29'),'uri':_0x171fc6+_0x72d8('0x2a'),'body':{'contact':{'last_name':_0x3d0fdc[_0x72d8('0x2b')],'work_number':_0x3d0fdc[_0x72d8('0x2b')],'mobile_number':_0x3d0fdc[_0x72d8('0x2b')],'owner_id':_0x3d0fdc['userId'],'created_at':_0x1a49a9['format'](_0x72d8('0x2c'))}},'json':!![]};_0x5f459a['headers']=_0x507220;logger[_0x72d8('0xb')](_0x72d8('0x2d'));return rp(_0x5f459a)[_0x72d8('0x18')](function(_0x6193e5){_0x3d0fdc[_0x72d8('0x26')]=_0x6193e5[_0x72d8('0x2e')]['id'];_0x5acb14(_0x3d0fdc);})['catch'](function(_0x4394ce){logger[_0x72d8('0x15')]('['+[_0x74066b['toUpperCase']()]+']',_0x4394ce['message']);_0x121448(_0x4394ce[_0x72d8('0x16')]);});});}function getTicket(_0x33f019,_0x1e3bb2,_0x39e3bb,_0x45b7c1,_0x43037f){return function(_0x28b1ce){logger[_0x72d8('0xb')](_0x72d8('0x2f'));return new Promise(function(_0x1bed9d,_0x4e79fb){var _0x39f7f7=moment();var _0x24ddda={'method':_0x72d8('0x29'),'uri':_0x39e3bb+_0x72d8('0x30'),'body':{'title':intUtil[_0x72d8('0x31')](_0x45b7c1['Subjects'],_0x43037f,'\x20'),'description':intUtil[_0x72d8('0x31')](_0x45b7c1[_0x72d8('0x32')],_0x43037f,'\x0a'),'owner_id':_0x28b1ce[_0x72d8('0x1c')],'creater_id':_0x28b1ce[_0x72d8('0x11')],'targetable_id':_0x28b1ce[_0x72d8('0x26')],'targetable_type':_0x72d8('0x33'),'created_at':_0x39f7f7['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x39f7f7[_0x72d8('0x34')](0x1e,'m')[_0x72d8('0x35')](_0x72d8('0x2c'))},'json':!![]};_0x24ddda[_0x72d8('0x17')]=_0x1e3bb2;return rp(_0x24ddda)[_0x72d8('0x18')](function(_0x3affe5){_0x28b1ce[_0x72d8('0x36')]=_0x3affe5['task']['id'];logger[_0x72d8('0xb')](_0x72d8('0x37'),_0x28b1ce[_0x72d8('0x36')]);_0x1bed9d(_0x28b1ce);})[_0x72d8('0x14')](function(_0xe830e7){logger[_0x72d8('0x15')]('['+[_0x33f019[_0x72d8('0x38')]()]+']',_0xe830e7[_0x72d8('0x16')]);_0x4e79fb(_0xe830e7['message']);});});};}function emit(_0x48eedc,_0x59359a,_0x51fff7){var _0x29e728={'uri':_0x48eedc+'/contacts/'+_0x51fff7};io['to'](util['format']('user:%s',_0x59359a))[_0x72d8('0x39')](_0x72d8('0x3a'),_0x29e728);}exports['cs']=function(_0xced283,_0x9e0060,_0x743b62,_0x3097b1,_0x3595eb,_0x47f9ce,_0x23ab8e,_0x57fcc6){var _0x3b86aa={};var _0x327daa={'Authorization':_0x72d8('0x3b')+_0x47f9ce[_0x72d8('0x3c')]};_0x47f9ce[_0x72d8('0x3d')]=intUtil[_0x72d8('0x3e')](_0x47f9ce[_0x72d8('0x3d')]);_0x47f9ce[_0x72d8('0x3f')]=intUtil[_0x72d8('0x3e')](_0x47f9ce[_0x72d8('0x3f')]);var _0x46c6d6=_0x47f9ce['remoteUri'];_0x3b86aa[_0x72d8('0x10')]=_0x47f9ce[_0x72d8('0x40')];_0x3b86aa[_0x72d8('0x2b')]=_0x57fcc6[_0x72d8('0x41')]()===_0x72d8('0x42')?_0x9e0060[_0x72d8('0x43')]:_0x9e0060['calleridnum'];_0x3b86aa[_0x72d8('0x44')]=_0x57fcc6===_0x72d8('0x45')||_0x57fcc6===_0x72d8('0x46')?'queue':'outbound';if(_0x3097b1){_0x3b86aa['agentEmail']=_0x3097b1['email'];}var _0x13a9c8=util['format'](_0x72d8('0x47'),_0x47f9ce[_0x72d8('0x3f')],_0x9e0060[_0x72d8('0x48')],md5(_0x9e0060[_0x72d8('0x48')]));if(_0x3595eb&&_0x3595eb[_0x72d8('0x49')]){logger[_0x72d8('0xb')](_0x72d8('0x4a'),'Recording\x20is\x20enabled!');_0x9e0060['recordingURL']=_0x13a9c8;}else if(_0x23ab8e&&_0x23ab8e[_0x72d8('0x4b')]&&_0x23ab8e[_0x72d8('0x4b')]!==_0x72d8('0x4c')){logger[_0x72d8('0xb')]('[OUTBOUND]',_0x72d8('0x4d'));_0x9e0060['recordingURL']=_0x13a9c8;}else{_0x9e0060[_0x72d8('0x4e')]='';}return getAdminId(_0x3b86aa,_0x57fcc6,_0x327daa,_0x46c6d6)[_0x72d8('0x18')](getUser(_0x57fcc6,_0x327daa,_0x46c6d6))[_0x72d8('0x18')](getEndUser(_0x57fcc6,_0x327daa,_0x46c6d6))[_0x72d8('0x18')](getTicket(_0x57fcc6,_0x327daa,_0x46c6d6,_0x743b62,_0x9e0060))[_0x72d8('0x18')](function(_0x4cce04){logger['info'](util[_0x72d8('0x35')](_0x72d8('0x4f'),_0x4cce04[_0x72d8('0x36')]));if(_0x57fcc6!==_0x72d8('0x46')){logger['info']('['+[_0x57fcc6[_0x72d8('0x38')]()]+']',_0x72d8('0x50'));emit(_0x46c6d6,_0x3097b1[_0x72d8('0x21')],_0x4cce04[_0x72d8('0x26')]);}})['catch'](function(_0x7811c8){logger['error']('['+[_0x57fcc6[_0x72d8('0x38')]()]+_0x72d8('0x51'),util[_0x72d8('0x52')](_0x7811c8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6e41=['trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','agentEmail','userEmail','length','userId','Admin\x20selected','toUpperCase','message','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','Descriptions','Contact','format','add','ticketId','task','/contacts/','user:%s','emit'];(function(_0x4c0ac9,_0x540ed1){var _0x507a30=function(_0x11422a){while(--_0x11422a){_0x4c0ac9['push'](_0x4c0ac9['shift']());}};_0x507a30(++_0x540ed1);}(_0x6e41,0x17c));var _0x16e4=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x6e41[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x16e4('0x0'));var rp=require(_0x16e4('0x1'));var md5=require(_0x16e4('0x2'));var util=require(_0x16e4('0x3'));var moment=require('moment');var Promise=require(_0x16e4('0x4'));var Redis=require(_0x16e4('0x5'));var intUtil=require('./util');var config=require(_0x16e4('0x6'));var logger=require(_0x16e4('0x7'))(_0x16e4('0x8'));config[_0x16e4('0x9')]=_[_0x16e4('0xa')](config['redis'],{'host':_0x16e4('0xb'),'port':0x18eb});var io=require(_0x16e4('0xc'))(new Redis(config[_0x16e4('0x9')]));function getAdminId(_0x25f4e4,_0x59384c,_0x3cf11f,_0x4f02b2){return new Promise(function(_0x5a9e79,_0x2a2393){var _0x15ea48=![];var _0x187fd7={'method':_0x16e4('0xd'),'uri':_0x4f02b2+_0x16e4('0xe'),'json':!![]};_0x187fd7[_0x16e4('0xf')]=_0x3cf11f;logger['info'](_0x16e4('0x10'));return rp(_0x187fd7)[_0x16e4('0x11')](function(_0x5309ba){if(_0x5309ba){var _0xb1ebbb=_0x5309ba[_0x16e4('0x12')];var _0x21f78c=null;for(_0x21f78c=0x0;_0x21f78c<_0xb1ebbb['length'];_0x21f78c++){if(_0xb1ebbb[_0x21f78c][_0x16e4('0x13')]===_0x25f4e4[_0x16e4('0x14')]){_0x25f4e4[_0x16e4('0x15')]=_0xb1ebbb[_0x21f78c]['id'];_0x15ea48=!![];}}if(_0x15ea48){logger[_0x16e4('0x16')](_0x16e4('0x17'),_0x25f4e4[_0x16e4('0x15')]);_0x5a9e79(_0x25f4e4);}else{_0x2a2393({'statusCode':0x194,'message':_0x16e4('0x18')});}}else{_0x2a2393({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x16e4('0x19')](function(_0x147e75){logger[_0x16e4('0x1a')]('['+[_0x59384c['toUpperCase']()]+']',_0x147e75['message']);_0x2a2393(_0x147e75);});});}function getUser(_0x299329,_0x5a713a,_0x4bf965){return function(_0x1a981c){return new Promise(function(_0x4615ad,_0x2cbbca){var _0x1360f3={'method':_0x16e4('0xd'),'uri':_0x4bf965+'/api/selector/owners','json':!![]};_0x1360f3[_0x16e4('0xf')]=_0x5a713a;logger[_0x16e4('0x16')](_0x16e4('0x1b'));return rp(_0x1360f3)[_0x16e4('0x11')](function(_0x1fbdb5){if(_0x1fbdb5){var _0x48f3d3=_0x1fbdb5[_0x16e4('0x12')];var _0x10eea9=![];var _0x188e72=null;if(_0x1a981c[_0x16e4('0x1c')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x1a981c['agentEmail']);_0x1a981c[_0x16e4('0x1d')]=_0x1a981c[_0x16e4('0x1c')];for(_0x188e72=0x0;_0x188e72<_0x48f3d3[_0x16e4('0x1e')];_0x188e72++){if(_0x48f3d3[_0x188e72][_0x16e4('0x13')]===_0x1a981c['agentEmail']){_0x10eea9=!![];_0x1a981c[_0x16e4('0x1f')]=_0x48f3d3[_0x188e72]['id'];logger[_0x16e4('0x16')]('User\x20found:',_0x1a981c[_0x16e4('0x1f')]);}}}if(!_0x10eea9){logger[_0x16e4('0x16')](_0x16e4('0x20'));_0x1a981c[_0x16e4('0x1d')]=_0x1a981c['adminEmail'];_0x1a981c[_0x16e4('0x1f')]=_0x1a981c[_0x16e4('0x15')];_0x10eea9=!![];}if(_0x10eea9){_0x4615ad(_0x1a981c);}else{_0x2cbbca({'statusCode':0x194,'message':_0x16e4('0x18')});}}else{_0x2cbbca({'statusCode':0x194,'message':_0x16e4('0x18')});}})['catch'](function(_0x2c58be){logger[_0x16e4('0x1a')]('['+[_0x299329[_0x16e4('0x21')]()]+']',_0x2c58be[_0x16e4('0x22')]);_0x2cbbca(_0x2c58be);});});};}function getEndUser(_0x40a3d1,_0x304a8f,_0x439b3c){return function(_0x2970ca){return new Promise(function(_0x7c0542,_0x47d0af){var _0x14fdaf=0x0;var _0xa6c589={'method':_0x16e4('0xd'),'uri':_0x439b3c+_0x16e4('0x23'),'json':!![]};_0xa6c589[_0x16e4('0xf')]=_0x304a8f;logger['info'](_0x16e4('0x24'));return rp(_0xa6c589)[_0x16e4('0x11')](function(_0x716db6){_0x716db6[_0x16e4('0x25')][_0x16e4('0x26')](function(_0x101df1){if(_0x101df1['name']===_0x16e4('0x27')){_0x14fdaf=_0x101df1['id'];}});})[_0x16e4('0x11')](function(){logger['info'](_0x16e4('0x28'));var _0x595617={'method':_0x16e4('0xd'),'uri':_0x439b3c+_0x16e4('0x29')+_0x14fdaf,'json':!![]};_0x595617[_0x16e4('0xf')]=_0x304a8f;return rp(_0x595617);})[_0x16e4('0x11')](function(_0x65f714){logger[_0x16e4('0x16')](_0x16e4('0x2a'),_0x2970ca[_0x16e4('0x2b')]);if(_0x65f714[_0x16e4('0x2c')]['length']>0x0){var _0xa42c7d=_[_0x16e4('0x2d')](_0x65f714['contacts'],function(_0x22ecd0){if(_0x22ecd0[_0x16e4('0x2e')]===_0x2970ca[_0x16e4('0x2b')]||_0x22ecd0[_0x16e4('0x2f')]===_0x2970ca[_0x16e4('0x2b')]){return _0x22ecd0;}});if(_0xa42c7d){_0x2970ca['endUserId']=_0xa42c7d['id'];logger[_0x16e4('0x16')](_0x16e4('0x30'),_0x2970ca[_0x16e4('0x31')]);_0x7c0542(_0x2970ca);}else{return createEndUser(_0x2970ca,_0x40a3d1,_0x304a8f,_0x439b3c)[_0x16e4('0x11')](function(_0x1ab03f){logger[_0x16e4('0x16')](_0x16e4('0x32'),_0x2970ca['endUserId']);_0x7c0542(_0x1ab03f);});}}else{return createEndUser(_0x2970ca,_0x40a3d1,_0x304a8f,_0x439b3c)[_0x16e4('0x11')](function(_0x955b1c){logger[_0x16e4('0x16')]('Contact\x20created:',_0x2970ca[_0x16e4('0x31')]);_0x7c0542(_0x955b1c);});}})[_0x16e4('0x19')](function(_0x49ccd2){throw new Error(_0x49ccd2[_0x16e4('0x22')]);});});};}function createEndUser(_0xe57b9f,_0x2dff63,_0x10a688,_0x52f5e0){return new Promise(function(_0x3be7ba,_0x2caa59){var _0xb9f94f=moment();var _0x57527a={'method':'POST','uri':_0x52f5e0+_0x16e4('0x33'),'body':{'contact':{'last_name':_0xe57b9f[_0x16e4('0x2b')],'work_number':_0xe57b9f[_0x16e4('0x2b')],'mobile_number':_0xe57b9f[_0x16e4('0x2b')],'owner_id':_0xe57b9f[_0x16e4('0x1f')],'created_at':_0xb9f94f['format'](_0x16e4('0x34'))}},'json':!![]};_0x57527a[_0x16e4('0xf')]=_0x10a688;logger[_0x16e4('0x16')](_0x16e4('0x35'));return rp(_0x57527a)[_0x16e4('0x11')](function(_0x580bf8){_0xe57b9f['endUserId']=_0x580bf8['contact']['id'];_0x3be7ba(_0xe57b9f);})[_0x16e4('0x19')](function(_0x447cb6){logger['error']('['+[_0x2dff63[_0x16e4('0x21')]()]+']',_0x447cb6[_0x16e4('0x22')]);_0x2caa59(_0x447cb6[_0x16e4('0x22')]);});});}function getTicket(_0x34ae57,_0x226fcc,_0x1aeaf0,_0x19553f,_0xacf6c){return function(_0x52aa7f){logger[_0x16e4('0x16')](_0x16e4('0x36'));return new Promise(function(_0xfbdb3a,_0x5563d6){var _0x49251b=moment();var _0x14607a={'method':_0x16e4('0x37'),'uri':_0x1aeaf0+'/api/tasks','body':{'title':intUtil['getString'](_0x19553f['Subjects'],_0xacf6c,'\x20'),'description':intUtil['getString'](_0x19553f[_0x16e4('0x38')],_0xacf6c,'\x0a'),'owner_id':_0x52aa7f[_0x16e4('0x1f')],'creater_id':_0x52aa7f[_0x16e4('0x15')],'targetable_id':_0x52aa7f[_0x16e4('0x31')],'targetable_type':_0x16e4('0x39'),'created_at':_0x49251b[_0x16e4('0x3a')](_0x16e4('0x34')),'due_date':_0x49251b[_0x16e4('0x3b')](0x1e,'m')[_0x16e4('0x3a')](_0x16e4('0x34'))},'json':!![]};_0x14607a[_0x16e4('0xf')]=_0x226fcc;return rp(_0x14607a)[_0x16e4('0x11')](function(_0x4fbc68){_0x52aa7f[_0x16e4('0x3c')]=_0x4fbc68[_0x16e4('0x3d')]['id'];logger['info']('Task\x20created:',_0x52aa7f[_0x16e4('0x3c')]);_0xfbdb3a(_0x52aa7f);})[_0x16e4('0x19')](function(_0x53fbdb){logger[_0x16e4('0x1a')]('['+[_0x34ae57[_0x16e4('0x21')]()]+']',_0x53fbdb[_0x16e4('0x22')]);_0x5563d6(_0x53fbdb['message']);});});};}function emit(_0x2c9df4,_0x153c1a,_0x27a417){var _0x575aab={'uri':_0x2c9df4+_0x16e4('0x3e')+_0x27a417};io['to'](util['format'](_0x16e4('0x3f'),_0x153c1a))[_0x16e4('0x40')](_0x16e4('0x41'),_0x575aab);}exports['cs']=function(_0x521c8d,_0x1cc46f,_0x2c57ed,_0x1007be,_0x54b059,_0x32b9a8,_0x4384bb,_0x2b25cf){var _0x47c4be={};var _0x29f2a1={'Authorization':_0x16e4('0x42')+_0x32b9a8[_0x16e4('0x43')]};_0x32b9a8[_0x16e4('0x44')]=intUtil[_0x16e4('0x45')](_0x32b9a8['remoteUri']);_0x32b9a8[_0x16e4('0x46')]=intUtil[_0x16e4('0x45')](_0x32b9a8['serverUrl']);var _0x55e4e9=_0x32b9a8[_0x16e4('0x44')];_0x47c4be['adminEmail']=_0x32b9a8[_0x16e4('0x47')];_0x47c4be[_0x16e4('0x2b')]=_0x2b25cf[_0x16e4('0x48')]()===_0x16e4('0x49')?_0x1cc46f[_0x16e4('0x4a')]:_0x1cc46f[_0x16e4('0x4b')];_0x47c4be[_0x16e4('0x4c')]=_0x2b25cf==='queue'||_0x2b25cf===_0x16e4('0x4d')?_0x16e4('0x4e'):_0x16e4('0x49');if(_0x1007be){_0x47c4be[_0x16e4('0x1c')]=_0x1007be[_0x16e4('0x13')];}var _0x298967=util[_0x16e4('0x3a')](_0x16e4('0x4f'),_0x32b9a8[_0x16e4('0x46')],_0x1cc46f[_0x16e4('0x50')],md5(_0x1cc46f[_0x16e4('0x50')]));if(_0x54b059&&_0x54b059['monitor_format']){logger['info'](_0x16e4('0x51'),'Recording\x20is\x20enabled!');_0x1cc46f['recordingURL']=_0x298967;}else if(_0x4384bb&&_0x4384bb['recordingFormat']&&_0x4384bb['recordingFormat']!==_0x16e4('0x52')){logger[_0x16e4('0x16')](_0x16e4('0x53'),_0x16e4('0x54'));_0x1cc46f[_0x16e4('0x55')]=_0x298967;}else{_0x1cc46f[_0x16e4('0x55')]='';}return getAdminId(_0x47c4be,_0x2b25cf,_0x29f2a1,_0x55e4e9)[_0x16e4('0x11')](getUser(_0x2b25cf,_0x29f2a1,_0x55e4e9))[_0x16e4('0x11')](getEndUser(_0x2b25cf,_0x29f2a1,_0x55e4e9))[_0x16e4('0x11')](getTicket(_0x2b25cf,_0x29f2a1,_0x55e4e9,_0x2c57ed,_0x1cc46f))['then'](function(_0x298a3f){logger[_0x16e4('0x16')](util['format'](_0x16e4('0x56'),_0x298a3f[_0x16e4('0x3c')]));if(_0x2b25cf!=='unmanaged'){logger[_0x16e4('0x16')]('['+[_0x2b25cf[_0x16e4('0x21')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x55e4e9,_0x1007be['name'],_0x298a3f['endUserId']);}})[_0x16e4('0x19')](function(_0x2eea60){logger['error']('['+[_0x2b25cf[_0x16e4('0x21')]()]+_0x16e4('0x57'),util[_0x16e4('0x58')](_0x2eea60,{'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 caecf01..d6f6a80 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 _0x6cb4=['./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','toLowerCase','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6cb4,0xff));var _0x46cb=function(_0xc5609f,_0x3db942){_0xc5609f=_0xc5609f-0x0;var _0x460390=_0x6cb4[_0xc5609f];return _0x460390;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var zendesk=require(_0x46cb('0x2'));var salesforce=require(_0x46cb('0x3'));var sugarcrm=require(_0x46cb('0x4'));var freshdesk=require(_0x46cb('0x5'));var zoho=require(_0x46cb('0x6'));var desk=require(_0x46cb('0x7'));var vtiger=require(_0x46cb('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x46cb('0x9'));var freshsales=require('./freshsales');var integrations=[_0x46cb('0xa'),'salesforce',_0x46cb('0xb'),_0x46cb('0xc'),_0x46cb('0xd'),_0x46cb('0xe'),_0x46cb('0xf'),_0x46cb('0x10'),'freshsales',_0x46cb('0x11')];exports[_0x46cb('0x12')]=function(_0x48101c,_0x206f10,_0x106a87,_0x4a60b2,_0x21c79b,_0xb4cbc1){if(_0x106a87){if(_['includes'](integrations,_0x48101c['data1']['toLowerCase']())){try{var _0x1e5f96=null;var _0x323ac2='';var _0x1058a8=_0x106a87[_0x48101c[_0x46cb('0x13')]['toLowerCase']()];if(_0x1058a8){var _0x8497cd=_0x1058a8[_0x48101c[_0x46cb('0x14')]];if(_0x8497cd){var _0x2a1f9d=_[_0x46cb('0x15')](_0x8497cd[_0x46cb('0x16')],{'id':parseInt(_0x48101c[_0x46cb('0x17')],0xa)});if(_0x2a1f9d){if(_0x4a60b2){if(_0x21c79b&&_0x206f10[_0x46cb('0x18')]){_0x323ac2=_0x46cb('0x18');}else if(_0x206f10[_0x46cb('0x19')]){_0x323ac2=_0x46cb('0x1a');}else{console[_0x46cb('0x1b')]('EVENT\x20UNKNOWN',_0x206f10);}}else{_0x323ac2=_0x46cb('0x1c');}switch(_0x48101c['data1'][_0x46cb('0x1d')]()){case'zendesk':zendesk[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case'salesforce':salesforce[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case'sugarcrm':sugarcrm[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case _0x46cb('0xc'):freshdesk[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case _0x46cb('0xd'):zoho[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case _0x46cb('0xe'):desk[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case _0x46cb('0xf'):vtiger[_0x323ac2](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1);break;case _0x46cb('0x1e'):freshsales['cs'](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1,_0x323ac2);break;case _0x46cb('0x11'):servicenow['cs'](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1,_0x323ac2);break;case _0x46cb('0x10'):dynamics365['cs'](_0x48101c,_0x206f10,_0x2a1f9d,_0x4a60b2,_0x21c79b,_0x8497cd,_0xb4cbc1,_0x323ac2);break;default:console[_0x46cb('0x1b')](_0x46cb('0x1f'));}}else{_0x1e5f96=require(_0x46cb('0x20'))(_0x48101c[_0x46cb('0x13')][_0x46cb('0x1d')]());_0x1e5f96[_0x46cb('0x21')](_0x46cb('0x22'),util[_0x46cb('0x23')](_0x46cb('0x24'),_0x48101c[_0x46cb('0x13')][_0x46cb('0x1d')](),_0x48101c[_0x46cb('0x17')]));}}else{_0x1e5f96=require(_0x46cb('0x20'))(_0x48101c[_0x46cb('0x13')][_0x46cb('0x1d')]());_0x1e5f96[_0x46cb('0x21')](_0x46cb('0x22'),util[_0x46cb('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x48101c['data1'][_0x46cb('0x1d')](),_0x48101c[_0x46cb('0x14')]));}}else{}}catch(_0x2711ac){console[_0x46cb('0x21')](_0x2711ac);}}}}; \ No newline at end of file +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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8952,0x17e));var _0x2895=function(_0x2d5a21,_0x43aa0a){_0x2d5a21=_0x2d5a21-0x0;var _0x181635=_0x8952[_0x2d5a21];return _0x181635;};'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 diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 039e8f0..e95d422 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 _0xdc69=['ioredis','../../../../config/environment','salesforce','redis','defaults','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','Case','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','No\x20Company','upperFirst','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','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.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','stringify','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','md5','jsforce'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc69,0x1a8));var _0x9dc6=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xdc69[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x9dc6('0x0'));var rp=require(_0x9dc6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x9dc6('0x2'));var jsforce=require(_0x9dc6('0x3'));var util=require('util');var Redis=require(_0x9dc6('0x4'));var intUtil=require('./util');var config=require(_0x9dc6('0x5'));var logger=require('../../../../config/logger')(_0x9dc6('0x6'));config[_0x9dc6('0x7')]=_[_0x9dc6('0x8')](config[_0x9dc6('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x51282b,_0x4f8198,_0xbc7539){io['to'](_0x51282b)[_0x9dc6('0x9')](_0x4f8198,_0xbc7539);}function getTicket(_0x537269,_0x4d84c4,_0xea8ff9,_0x114018,_0x352dc9,_0x5bb029,_0x32c23f,_0xe728f0){var _0x4c5fd1={};if(_0x114018[_0x9dc6('0xa')]===_0x9dc6('0xb')){_0x4c5fd1=Object[_0x9dc6('0xc')]({},{'OwnerId':_0x4d84c4['id'],'ActivityDate':moment[_0x9dc6('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x9dc6('0xe')](_0x114018[_0x9dc6('0xf')],_0x352dc9,'\x20'),'Description':intUtil[_0x9dc6('0xe')](_0x114018[_0x9dc6('0x10')],_0x352dc9,'\x0a')},getCustomFields(_0x5bb029,_0x352dc9));if(_0xea8ff9){_0x4c5fd1['WhoId']=_0xea8ff9['id'];}}else if(_0x114018[_0x9dc6('0xa')]===_0x9dc6('0x11')){_0x4c5fd1=Object[_0x9dc6('0xc')]({},{'OwnerId':_0x4d84c4['id'],'Subject':intUtil[_0x9dc6('0xe')](_0x114018[_0x9dc6('0xf')],_0x352dc9,'\x20'),'Description':intUtil[_0x9dc6('0xe')](_0x114018['Descriptions'],_0x352dc9,'\x0a')},getCustomFields(_0x5bb029,_0x352dc9));if(_0xea8ff9){_0x4c5fd1['ContactId']=_0xea8ff9['id'];}}return _0x32c23f['sobject'](_0x114018['ticketType'])[_0x9dc6('0x12')](_0x4c5fd1);}function getUser(_0x5a5279,_0x3daa11,_0x2de1d5){if(!_[_0x9dc6('0x13')](_0x3daa11)&&intUtil[_0x9dc6('0x14')](_0x3daa11)){var _0x54d9f4={'Email':_0x3daa11};var _0x9d8b11={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2de1d5[_0x9dc6('0x15')](_0x9dc6('0x16'))[_0x9dc6('0x17')](_0x54d9f4,_0x9d8b11)[_0x9dc6('0x18')]()[_0x9dc6('0x19')](function(_0xa87e86){if(_0xa87e86[_0x9dc6('0x1a')]){var _0x3ca937=_[_0x9dc6('0x17')](_0xa87e86,function(_0x2696c1){return _0x2696c1[_0x9dc6('0x1b')]===_0x3daa11;});if(_0x3ca937){logger['info'](_0x9dc6('0x1c'),_0x3daa11);return BPromise['resolve']({'id':_0x3ca937['Id'],'name':_0x3ca937['Name']});}}else{logger[_0x9dc6('0x1d')](_0x9dc6('0x1e'),_0x3daa11);return _0x2de1d5[_0x9dc6('0x1f')]()[_0x9dc6('0x19')](function(_0x38a022){return BPromise[_0x9dc6('0x20')]({'id':_0x38a022['user_id'],'name':_0x38a022[_0x9dc6('0x21')]});});}});}else{logger['info'](_0x9dc6('0x1e'),_0x3daa11);return _0x2de1d5[_0x9dc6('0x1f')]()['then'](function(_0x39bb6f){return BPromise[_0x9dc6('0x20')]({'id':_0x39bb6f['user_id'],'name':_0x39bb6f[_0x9dc6('0x21')]});});}}function getEndUser(_0x467364,_0x14f4a7,_0x22240a,_0x360bcc,_0x36d76c){var _0x5856c1={'Phone':_0x360bcc};var _0x47b525={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9dc6('0x20')]()['then'](function(){if(_0x14f4a7[_0x9dc6('0xa')]===_0x9dc6('0xb')){logger['info'](_0x9dc6('0x22'),_0x360bcc,_0x14f4a7[_0x9dc6('0x23')]);switch(_0x14f4a7[_0x9dc6('0x23')]){case _0x9dc6('0x24'):return _0x36d76c[_0x9dc6('0x15')](_0x9dc6('0x25'))[_0x9dc6('0x17')](_0x5856c1,_0x47b525)[_0x9dc6('0x18')]()[_0x9dc6('0x19')](function(_0x2bd881){if(_0x2bd881&&_0x2bd881[_0x9dc6('0x1a')]){return _0x2bd881;}else{return _0x36d76c[_0x9dc6('0x15')](_0x9dc6('0x26'))[_0x9dc6('0x17')](_0x5856c1,_0x47b525);}});case _0x9dc6('0x27'):return _0x36d76c['sobject'](_0x9dc6('0x25'))['find'](_0x5856c1,_0x47b525)['execute']();case'lead':return _0x36d76c[_0x9dc6('0x15')](_0x9dc6('0x26'))[_0x9dc6('0x17')](_0x5856c1,_0x47b525);default:return null;}}else if(_0x14f4a7[_0x9dc6('0xa')]===_0x9dc6('0x11')){logger[_0x9dc6('0x1d')](_0x9dc6('0x22'),_0x360bcc,_0x9dc6('0x27'));return _0x36d76c[_0x9dc6('0x15')](_0x9dc6('0x25'))[_0x9dc6('0x17')](_0x5856c1,_0x47b525)[_0x9dc6('0x18')]();}})[_0x9dc6('0x19')](function(_0x5755ba){if(_0x5755ba&&_0x5755ba[_0x9dc6('0x1a')]){var _0x335de2=_[_0x9dc6('0x17')](_0x5755ba,function(_0x5e5aea){return _0x5e5aea[_0x9dc6('0x28')]===_0x360bcc;});if(_0x335de2){return BPromise[_0x9dc6('0x20')]({'id':_0x335de2['Id'],'name':_0x335de2[_0x9dc6('0x29')],'phone':_0x335de2[_0x9dc6('0x28')]});}}})['then'](function(_0x4bc9a2){if(_0x4bc9a2){logger[_0x9dc6('0x1d')](_0x9dc6('0x2a'),_0x360bcc);return BPromise[_0x9dc6('0x20')](_0x4bc9a2);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x360bcc);var _0x46989f={'LastName':_0x22240a!==_0x9dc6('0x2b')?_0x22240a:util[_0x9dc6('0x2c')](_0x9dc6('0x2d'),_0x360bcc),'Phone':_0x360bcc};if(_0x14f4a7[_0x9dc6('0x2e')]){if(_0x14f4a7[_0x9dc6('0x2e')]===_0x9dc6('0x27')){logger[_0x9dc6('0x1d')](_0x9dc6('0x2f'),_0x360bcc,_0x14f4a7['moduleCreate']);}else if(_0x14f4a7[_0x9dc6('0x2e')]===_0x9dc6('0x30')&&_0x14f4a7[_0x9dc6('0xa')]===_0x9dc6('0xb')){logger['info'](_0x9dc6('0x2f'),_0x360bcc,_0x14f4a7[_0x9dc6('0x2e')]);_0x46989f['Company']=_0x9dc6('0x31');}else{return null;}}return _0x36d76c['sobject'](_[_0x9dc6('0x32')](_0x14f4a7['moduleCreate']))['create'](_0x46989f);}});}function getCustomFields(_0x446764,_0x57f990){var _0x3d18a7={};if(_0x446764[_0x9dc6('0x1a')]>0x0){_['forEach'](_0x446764,function(_0x26f6c6){if(_0x26f6c6[_0x9dc6('0x33')]==='string'&&_0x26f6c6[_0x9dc6('0x34')]){_0x3d18a7[_0x26f6c6[_0x9dc6('0x34')]]=_0x26f6c6[_0x9dc6('0x35')][_0x9dc6('0x36')]();}else if(_0x26f6c6['type']==='variable'&&_0x26f6c6['variableName']&&_0x26f6c6[_0x9dc6('0x34')]){_0x57f990[_0x26f6c6[_0x9dc6('0x37')]]&&(_0x3d18a7[_0x26f6c6['idField']]=_0x57f990[_0x26f6c6[_0x9dc6('0x37')]]['toString']());}else if(_0x26f6c6[_0x9dc6('0x33')]===_0x9dc6('0x38')&&_0x26f6c6[_0x9dc6('0x39')]&&_0x26f6c6[_0x9dc6('0x39')][_0x9dc6('0x3a')]&&_0x26f6c6[_0x9dc6('0x34')]){_0x57f990[_0x26f6c6[_0x9dc6('0x39')][_0x9dc6('0x3a')][_0x9dc6('0x3b')]()]&&(_0x3d18a7[_0x26f6c6[_0x9dc6('0x34')]]=_0x57f990[_0x26f6c6['Variable'][_0x9dc6('0x3a')][_0x9dc6('0x3b')]()][_0x9dc6('0x36')]());}});}return _0x3d18a7;}function getConnection(_0x58b48f){var _0x2d46a9=_0x58b48f['password'][_0x9dc6('0x3c')](_0x58b48f[_0x9dc6('0x3d')]);var _0x51d419=new jsforce[(_0x9dc6('0x3e'))]({'oauth2':{'loginUrl':_0x58b48f['remoteUri']||_0x9dc6('0x3f'),'clientId':_0x58b48f[_0x9dc6('0x40')],'clientSecret':_0x58b48f[_0x9dc6('0x41')]}});return _0x51d419['login'](_0x58b48f[_0x9dc6('0x42')],_0x2d46a9)[_0x9dc6('0x19')](function(){logger[_0x9dc6('0x1d')](_0x9dc6('0x43'));return _0x51d419;});}exports[_0x9dc6('0x44')]=function(_0x58b0a4,_0x466137,_0x277058,_0x39d710,_0x1e83df,_0x1f18c8){var _0x3922ae,_0xa2f4d2,_0x428307,_0x234f84;_0x1f18c8['serverUrl']=intUtil['stripTrailingSlash'](_0x1f18c8[_0x9dc6('0x45')]);_0x1f18c8['remoteUri']=intUtil['stripTrailingSlash'](_0x1f18c8[_0x9dc6('0x46')]);if(_0x1e83df&&_0x1e83df[_0x9dc6('0x47')]){logger[_0x9dc6('0x1d')](_0x9dc6('0x48'),_0x9dc6('0x49'));_0x466137[_0x9dc6('0x4a')]=util[_0x9dc6('0x2c')](_0x9dc6('0x4b'),_0x1f18c8[_0x9dc6('0x45')],_0x466137[_0x9dc6('0x4c')],md5(_0x466137[_0x9dc6('0x4c')]));}else{_0x466137['recordingURL']='';}return getConnection(_0x1f18c8)[_0x9dc6('0x19')](function(_0x39e93c){_0x234f84=_0x39e93c;return getUser(_0x1f18c8,_0x39d710[_0x9dc6('0x4d')],_0x234f84);})[_0x9dc6('0x19')](function(_0x2b19da){_0x3922ae=_0x2b19da;return getEndUser(_0x1f18c8,_0x277058,_0x466137[_0x9dc6('0x4e')],_0x466137[_0x9dc6('0x4f')],_0x234f84);})[_0x9dc6('0x19')](function(_0x450053){_0xa2f4d2=_0x450053;return getTicket(_0x1f18c8,_0x3922ae,_0xa2f4d2,_0x277058,_0x466137,_0x277058[_0x9dc6('0x50')],_0x234f84,_0x9dc6('0x44'));})['then'](function(_0x21e4ef){_0x428307=_0x21e4ef;logger[_0x9dc6('0x1d')](_0x9dc6('0x51'),_0x428307['id']);logger[_0x9dc6('0x1d')](_0x9dc6('0x52'),_0x428307['id'],_0x39d710[_0x9dc6('0x3a')],_0x1f18c8[_0x9dc6('0x33')]);switch(_0x1f18c8[_0x9dc6('0x33')]){case _0x9dc6('0x53'):emit(util[_0x9dc6('0x2c')](_0x9dc6('0x54'),_0x39d710[_0x9dc6('0x3a')]),_0x9dc6('0x55'),{'recordId':_0x428307['id']});break;case _0x9dc6('0x56'):emit(util[_0x9dc6('0x2c')](_0x9dc6('0x54'),_0x39d710['name']),_0x9dc6('0x57'),{'uri':util['format'](_0x9dc6('0x58'),_0x234f84[_0x9dc6('0x59')],_0x428307['id'])});break;default:logger[_0x9dc6('0x5a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x9dc6('0x5b')](function(_0x156e09){logger[_0x9dc6('0x5a')]('[QUEUE]',JSON[_0x9dc6('0x5c')](_0x156e09));});};exports[_0x9dc6('0x5d')]=function(_0x2db177,_0x4c0473,_0x45c4ce,_0x5db274,_0x20d64f,_0x9b97c8,_0x18b0d1){var _0x5f2dfb,_0x114dc4,_0x14b3b8,_0x256d79;_0x9b97c8[_0x9dc6('0x45')]=intUtil[_0x9dc6('0x5e')](_0x9b97c8['serverUrl']);_0x9b97c8[_0x9dc6('0x46')]=intUtil[_0x9dc6('0x5e')](_0x9b97c8[_0x9dc6('0x46')]);if(_0x18b0d1&&_0x18b0d1[_0x9dc6('0x5f')]&&_0x18b0d1[_0x9dc6('0x5f')]!==_0x9dc6('0x60')){logger[_0x9dc6('0x1d')](_0x9dc6('0x61'),'Recording\x20is\x20enabled!');_0x4c0473[_0x9dc6('0x4a')]=util[_0x9dc6('0x2c')](_0x9dc6('0x4b'),_0x9b97c8[_0x9dc6('0x45')],_0x4c0473[_0x9dc6('0x4c')],md5(_0x4c0473[_0x9dc6('0x4c')]));}return getConnection(_0x9b97c8)[_0x9dc6('0x19')](function(_0x4dd30d){_0x256d79=_0x4dd30d;return getUser(_0x9b97c8,_0x5db274[_0x9dc6('0x4d')],_0x256d79);})[_0x9dc6('0x19')](function(_0x132773){_0x5f2dfb=_0x132773;return getEndUser(_0x9b97c8,_0x45c4ce,_0x4c0473[_0x9dc6('0x62')],_0x4c0473[_0x9dc6('0x63')],_0x256d79);})['then'](function(_0x349a41){_0x114dc4=_0x349a41;return getTicket(_0x9b97c8,_0x5f2dfb,_0x114dc4,_0x45c4ce,_0x4c0473,_0x45c4ce['Fields'],_0x256d79,_0x9dc6('0x5d'));})['then'](function(_0x365876){_0x14b3b8=_0x365876;logger[_0x9dc6('0x1d')](_0x9dc6('0x64'),_0x14b3b8['id']);logger[_0x9dc6('0x1d')](_0x9dc6('0x65'),_0x14b3b8['id'],_0x5db274['name'],_0x9b97c8[_0x9dc6('0x33')]);switch(_0x9b97c8[_0x9dc6('0x33')]){case'integrationTab':emit(util['format'](_0x9dc6('0x54'),_0x5db274[_0x9dc6('0x3a')]),_0x9dc6('0x55'),{'recordId':_0x14b3b8['id']});break;case'newTab':emit(util[_0x9dc6('0x2c')](_0x9dc6('0x54'),_0x5db274['name']),_0x9dc6('0x57'),{'uri':util['format'](_0x9dc6('0x58'),_0x256d79[_0x9dc6('0x59')],_0x14b3b8['id'])});break;default:logger[_0x9dc6('0x5a')]('[OUTBOUND]',_0x9dc6('0x66'));}})[_0x9dc6('0x5b')](function(_0x4a3cf6){logger[_0x9dc6('0x5a')]('[OUTBOUND]',JSON[_0x9dc6('0x5c')](_0x4a3cf6));});};exports[_0x9dc6('0x67')]=function(_0x448597,_0x423342,_0x2ee923,_0x354bad,_0x52a1c5,_0x455980){var _0x28ab2f,_0x42cc4a,_0x12a48b,_0x438605;_0x455980[_0x9dc6('0x45')]=intUtil['stripTrailingSlash'](_0x455980['serverUrl']);_0x455980[_0x9dc6('0x46')]=intUtil[_0x9dc6('0x5e')](_0x455980[_0x9dc6('0x46')]);if(_0x52a1c5&&_0x52a1c5['monitor_format']){logger['info']('['+_0x423342[_0x9dc6('0x68')][_0x9dc6('0x69')]()+']',_0x9dc6('0x49'));_0x423342['recordingURL']=util[_0x9dc6('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x455980['serverUrl'],_0x423342[_0x9dc6('0x4c')],md5(_0x423342[_0x9dc6('0x4c')]));}else{_0x423342[_0x9dc6('0x4a')]='';}return getConnection(_0x455980)[_0x9dc6('0x19')](function(_0x53583a){_0x438605=_0x53583a;if(!_[_0x9dc6('0x13')](_0x354bad)){return getUser(_0x455980,_0x354bad[_0x9dc6('0x3a')],_0x438605);}else{return getUser(_0x455980,null,_0x438605);}})[_0x9dc6('0x19')](function(_0x6ecb42){_0x28ab2f=_0x6ecb42;return getEndUser(_0x455980,_0x2ee923,_0x423342[_0x9dc6('0x4e')],_0x423342[_0x9dc6('0x4f')],_0x438605);})[_0x9dc6('0x19')](function(_0x2ad731){_0x42cc4a=_0x2ad731;return getTicket(_0x455980,_0x28ab2f,_0x42cc4a,_0x2ee923,_0x423342,_0x2ee923['Fields'],_0x438605);})[_0x9dc6('0x19')](function(_0x439a21){_0x12a48b=_0x439a21;logger['info']('['+_0x423342[_0x9dc6('0x68')][_0x9dc6('0x69')]()+_0x9dc6('0x6a'),_0x12a48b['id']);logger[_0x9dc6('0x1d')]('['+_0x423342[_0x9dc6('0x68')][_0x9dc6('0x69')]()+']\x20Integration\x20account\x20type\x20%s.',_0x455980[_0x9dc6('0x33')]);})[_0x9dc6('0x5b')](function(_0x523e04){logger[_0x9dc6('0x5a')]('['+_0x423342[_0x9dc6('0x68')]['toUpperCase']()+']',JSON[_0x9dc6('0x5c')](_0x523e04));});}; \ No newline at end of file +var _0xcec2=['Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','moduleSearch','Contact','length','Lead','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','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.','Task','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','ticketType','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','find','execute','then','Agent\x20%s\x20found.','Name','info'];(function(_0x2bf8e0,_0x5d420e){var _0x21e3d9=function(_0x4453cf){while(--_0x4453cf){_0x2bf8e0['push'](_0x2bf8e0['shift']());}};_0x21e3d9(++_0x5d420e);}(_0xcec2,0xbe));var _0x2cec=function(_0x560dad,_0x7a30){_0x560dad=_0x560dad-0x0;var _0x5e0293=_0xcec2[_0x560dad];return _0x5e0293;};'use strict';var _=require(_0x2cec('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2cec('0x1'));var md5=require(_0x2cec('0x2'));var jsforce=require('jsforce');var util=require(_0x2cec('0x3'));var Redis=require(_0x2cec('0x4'));var intUtil=require(_0x2cec('0x5'));var config=require(_0x2cec('0x6'));var logger=require(_0x2cec('0x7'))('salesforce');config[_0x2cec('0x8')]=_[_0x2cec('0x9')](config['redis'],{'host':_0x2cec('0xa'),'port':0x18eb});var io=require(_0x2cec('0xb'))(new Redis(config[_0x2cec('0x8')]));function emit(_0x59c1f5,_0x5587cf,_0x1edae4){io['to'](_0x59c1f5)[_0x2cec('0xc')](_0x5587cf,_0x1edae4);}function getTicket(_0x24753e,_0x48378a,_0x3beb7c,_0x3e0a25,_0x416489,_0x3e28a1,_0x4685e0,_0x324004){var _0x3318be={};if(_0x3e0a25[_0x2cec('0xd')]==='Task'){_0x3318be=Object[_0x2cec('0xe')]({},{'OwnerId':_0x48378a['id'],'ActivityDate':moment[_0x2cec('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x2cec('0x10')](_0x3e0a25[_0x2cec('0x11')],_0x416489,'\x20'),'Description':intUtil[_0x2cec('0x10')](_0x3e0a25[_0x2cec('0x12')],_0x416489,'\x0a')},getCustomFields(_0x3e28a1,_0x416489));if(_0x3beb7c){_0x3318be[_0x2cec('0x13')]=_0x3beb7c['id'];}}else if(_0x3e0a25[_0x2cec('0xd')]===_0x2cec('0x14')){_0x3318be=Object[_0x2cec('0xe')]({},{'OwnerId':_0x48378a['id'],'Subject':intUtil[_0x2cec('0x10')](_0x3e0a25[_0x2cec('0x11')],_0x416489,'\x20'),'Description':intUtil[_0x2cec('0x10')](_0x3e0a25['Descriptions'],_0x416489,'\x0a')},getCustomFields(_0x3e28a1,_0x416489));if(_0x3beb7c){_0x3318be[_0x2cec('0x15')]=_0x3beb7c['id'];}}return _0x4685e0[_0x2cec('0x16')](_0x3e0a25[_0x2cec('0xd')])[_0x2cec('0x17')](_0x3318be);}function getUser(_0x34f1e2,_0x4bc0d3,_0x3c8b87){if(!_[_0x2cec('0x18')](_0x4bc0d3)&&intUtil[_0x2cec('0x19')](_0x4bc0d3)){var _0x5e8323={'Email':_0x4bc0d3};var _0x43309e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3c8b87[_0x2cec('0x16')]('User')[_0x2cec('0x1a')](_0x5e8323,_0x43309e)[_0x2cec('0x1b')]()[_0x2cec('0x1c')](function(_0x18b2d1){if(_0x18b2d1['length']){var _0x423e46=_[_0x2cec('0x1a')](_0x18b2d1,function(_0x1aee5b){return _0x1aee5b['Email']===_0x4bc0d3;});if(_0x423e46){logger['info'](_0x2cec('0x1d'),_0x4bc0d3);return BPromise['resolve']({'id':_0x423e46['Id'],'name':_0x423e46[_0x2cec('0x1e')]});}}else{logger[_0x2cec('0x1f')](_0x2cec('0x20'),_0x4bc0d3);return _0x3c8b87['identity']()[_0x2cec('0x1c')](function(_0x4c615f){return BPromise[_0x2cec('0x21')]({'id':_0x4c615f[_0x2cec('0x22')],'name':_0x4c615f[_0x2cec('0x23')]});});}});}else{logger['info'](_0x2cec('0x20'),_0x4bc0d3);return _0x3c8b87['identity']()['then'](function(_0x5cb329){return BPromise[_0x2cec('0x21')]({'id':_0x5cb329[_0x2cec('0x22')],'name':_0x5cb329[_0x2cec('0x23')]});});}}function getEndUser(_0x414a2f,_0x51ad6a,_0x2fec7a,_0x3d004d,_0x18240f){var _0x348ebb={'Phone':_0x3d004d};var _0x139d74={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2cec('0x21')]()[_0x2cec('0x1c')](function(){if(_0x51ad6a[_0x2cec('0xd')]==='Task'){logger[_0x2cec('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3d004d,_0x51ad6a[_0x2cec('0x24')]);switch(_0x51ad6a[_0x2cec('0x24')]){case'contact_lead':return _0x18240f[_0x2cec('0x16')](_0x2cec('0x25'))[_0x2cec('0x1a')](_0x348ebb,_0x139d74)[_0x2cec('0x1b')]()[_0x2cec('0x1c')](function(_0x409bfb){if(_0x409bfb&&_0x409bfb[_0x2cec('0x26')]){return _0x409bfb;}else{return _0x18240f[_0x2cec('0x16')](_0x2cec('0x27'))[_0x2cec('0x1a')](_0x348ebb,_0x139d74);}});case _0x2cec('0x28'):return _0x18240f['sobject'](_0x2cec('0x25'))[_0x2cec('0x1a')](_0x348ebb,_0x139d74)[_0x2cec('0x1b')]();case _0x2cec('0x29'):return _0x18240f[_0x2cec('0x16')](_0x2cec('0x27'))[_0x2cec('0x1a')](_0x348ebb,_0x139d74);default:return null;}}else if(_0x51ad6a[_0x2cec('0xd')]==='Case'){logger['info'](_0x2cec('0x2a'),_0x3d004d,_0x2cec('0x28'));return _0x18240f[_0x2cec('0x16')](_0x2cec('0x25'))[_0x2cec('0x1a')](_0x348ebb,_0x139d74)[_0x2cec('0x1b')]();}})[_0x2cec('0x1c')](function(_0x10ef34){if(_0x10ef34&&_0x10ef34[_0x2cec('0x26')]){var _0x38b79f=_[_0x2cec('0x1a')](_0x10ef34,function(_0x42c1b6){return _0x42c1b6['Phone']===_0x3d004d;});if(_0x38b79f){return BPromise[_0x2cec('0x21')]({'id':_0x38b79f['Id'],'name':_0x38b79f[_0x2cec('0x1e')],'phone':_0x38b79f[_0x2cec('0x2b')]});}}})[_0x2cec('0x1c')](function(_0x1cc766){if(_0x1cc766){logger[_0x2cec('0x1f')](_0x2cec('0x2c'),_0x3d004d);return BPromise[_0x2cec('0x21')](_0x1cc766);}else{logger[_0x2cec('0x1f')](_0x2cec('0x2d'),_0x3d004d);var _0x4ab0b8={'LastName':_0x2fec7a!==_0x2cec('0x2e')?_0x2fec7a:util[_0x2cec('0x2f')](_0x2cec('0x30'),_0x3d004d),'Phone':_0x3d004d};if(_0x51ad6a[_0x2cec('0x31')]){if(_0x51ad6a['moduleCreate']===_0x2cec('0x28')){logger['info'](_0x2cec('0x32'),_0x3d004d,_0x51ad6a[_0x2cec('0x31')]);}else if(_0x51ad6a['moduleCreate']===_0x2cec('0x29')&&_0x51ad6a[_0x2cec('0xd')]===_0x2cec('0x33')){logger[_0x2cec('0x1f')](_0x2cec('0x32'),_0x3d004d,_0x51ad6a[_0x2cec('0x31')]);_0x4ab0b8[_0x2cec('0x34')]=_0x2cec('0x35');}else{return null;}}return _0x18240f['sobject'](_[_0x2cec('0x36')](_0x51ad6a[_0x2cec('0x31')]))[_0x2cec('0x17')](_0x4ab0b8);}});}function getCustomFields(_0x4476e8,_0x2958f1){var _0xddd6e={};if(_0x4476e8[_0x2cec('0x26')]>0x0){_[_0x2cec('0x37')](_0x4476e8,function(_0x59e04b){if(_0x59e04b[_0x2cec('0x38')]===_0x2cec('0x39')&&_0x59e04b[_0x2cec('0x3a')]){_0xddd6e[_0x59e04b[_0x2cec('0x3a')]]=_0x59e04b[_0x2cec('0x3b')][_0x2cec('0x3c')]();}else if(_0x59e04b[_0x2cec('0x38')]===_0x2cec('0x3d')&&_0x59e04b[_0x2cec('0x3e')]&&_0x59e04b['idField']){_0x2958f1[_0x59e04b[_0x2cec('0x3e')]]&&(_0xddd6e[_0x59e04b[_0x2cec('0x3a')]]=_0x2958f1[_0x59e04b[_0x2cec('0x3e')]]['toString']());}else if(_0x59e04b[_0x2cec('0x38')]===_0x2cec('0x3f')&&_0x59e04b['Variable']&&_0x59e04b['Variable'][_0x2cec('0x40')]&&_0x59e04b[_0x2cec('0x3a')]){_0x2958f1[_0x59e04b[_0x2cec('0x41')][_0x2cec('0x40')][_0x2cec('0x42')]()]&&(_0xddd6e[_0x59e04b[_0x2cec('0x3a')]]=_0x2958f1[_0x59e04b[_0x2cec('0x41')][_0x2cec('0x40')][_0x2cec('0x42')]()][_0x2cec('0x3c')]());}});}return _0xddd6e;}function getConnection(_0x109a5a){var _0x38af49=_0x109a5a[_0x2cec('0x43')][_0x2cec('0x44')](_0x109a5a['securityToken']);var _0x362e3a=new jsforce[(_0x2cec('0x45'))]({'oauth2':{'loginUrl':_0x109a5a[_0x2cec('0x46')]||_0x2cec('0x47'),'clientId':_0x109a5a['clientId'],'clientSecret':_0x109a5a['clientSecret']}});return _0x362e3a[_0x2cec('0x48')](_0x109a5a[_0x2cec('0x49')],_0x38af49)[_0x2cec('0x1c')](function(){logger[_0x2cec('0x1f')](_0x2cec('0x4a'));return _0x362e3a;});}exports[_0x2cec('0x4b')]=function(_0x2093fb,_0x448a27,_0x455c5d,_0x99b7d8,_0x8e5185,_0x3984c5){var _0x1635b6,_0x581a5b,_0x2be17a,_0x38f630;_0x3984c5['serverUrl']=intUtil['stripTrailingSlash'](_0x3984c5[_0x2cec('0x4c')]);_0x3984c5[_0x2cec('0x46')]=intUtil[_0x2cec('0x4d')](_0x3984c5[_0x2cec('0x46')]);if(_0x8e5185&&_0x8e5185[_0x2cec('0x4e')]){logger[_0x2cec('0x1f')](_0x2cec('0x4f'),'Recording\x20is\x20enabled!');_0x448a27[_0x2cec('0x50')]=util['format'](_0x2cec('0x51'),_0x3984c5[_0x2cec('0x4c')],_0x448a27[_0x2cec('0x52')],md5(_0x448a27['uniqueid']));}else{_0x448a27[_0x2cec('0x50')]='';}return getConnection(_0x3984c5)[_0x2cec('0x1c')](function(_0x328e91){_0x38f630=_0x328e91;return getUser(_0x3984c5,_0x99b7d8[_0x2cec('0x53')],_0x38f630);})[_0x2cec('0x1c')](function(_0x161981){_0x1635b6=_0x161981;return getEndUser(_0x3984c5,_0x455c5d,_0x448a27[_0x2cec('0x54')],_0x448a27['calleridnum'],_0x38f630);})[_0x2cec('0x1c')](function(_0x145acb){_0x581a5b=_0x145acb;return getTicket(_0x3984c5,_0x1635b6,_0x581a5b,_0x455c5d,_0x448a27,_0x455c5d[_0x2cec('0x55')],_0x38f630,_0x2cec('0x4b'));})[_0x2cec('0x1c')](function(_0x412d4e){_0x2be17a=_0x412d4e;logger[_0x2cec('0x1f')](_0x2cec('0x56'),_0x2be17a['id']);logger[_0x2cec('0x1f')](_0x2cec('0x57'),_0x2be17a['id'],_0x99b7d8[_0x2cec('0x40')],_0x3984c5[_0x2cec('0x38')]);switch(_0x3984c5[_0x2cec('0x38')]){case _0x2cec('0x58'):emit(util[_0x2cec('0x2f')]('user:%s',_0x99b7d8[_0x2cec('0x40')]),_0x2cec('0x59'),{'recordId':_0x2be17a['id']});break;case'newTab':emit(util['format'](_0x2cec('0x5a'),_0x99b7d8['name']),_0x2cec('0x5b'),{'uri':util[_0x2cec('0x2f')](_0x2cec('0x5c'),_0x38f630[_0x2cec('0x5d')],_0x2be17a['id'])});break;default:logger[_0x2cec('0x5e')](_0x2cec('0x5f'));}})[_0x2cec('0x60')](function(_0x3a6fe7){logger[_0x2cec('0x5e')]('[QUEUE]',JSON[_0x2cec('0x61')](_0x3a6fe7));});};exports[_0x2cec('0x62')]=function(_0x17ea9f,_0x2dc80a,_0x32216b,_0x172ba5,_0x5a9cd5,_0x44011e,_0x70aa3d){var _0x10c37b,_0x1b92f1,_0x1c1ef0,_0x2e6de3;_0x44011e['serverUrl']=intUtil[_0x2cec('0x4d')](_0x44011e['serverUrl']);_0x44011e['remoteUri']=intUtil['stripTrailingSlash'](_0x44011e['remoteUri']);if(_0x70aa3d&&_0x70aa3d[_0x2cec('0x63')]&&_0x70aa3d[_0x2cec('0x63')]!==_0x2cec('0x64')){logger[_0x2cec('0x1f')](_0x2cec('0x65'),_0x2cec('0x66'));_0x2dc80a[_0x2cec('0x50')]=util[_0x2cec('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44011e[_0x2cec('0x4c')],_0x2dc80a[_0x2cec('0x52')],md5(_0x2dc80a[_0x2cec('0x52')]));}return getConnection(_0x44011e)[_0x2cec('0x1c')](function(_0x363d8a){_0x2e6de3=_0x363d8a;return getUser(_0x44011e,_0x172ba5[_0x2cec('0x53')],_0x2e6de3);})[_0x2cec('0x1c')](function(_0xd55ca4){_0x10c37b=_0xd55ca4;return getEndUser(_0x44011e,_0x32216b,_0x2dc80a[_0x2cec('0x67')],_0x2dc80a['destcalleridnum'],_0x2e6de3);})[_0x2cec('0x1c')](function(_0x138a13){_0x1b92f1=_0x138a13;return getTicket(_0x44011e,_0x10c37b,_0x1b92f1,_0x32216b,_0x2dc80a,_0x32216b['Fields'],_0x2e6de3,'outbound');})[_0x2cec('0x1c')](function(_0x200634){_0x1c1ef0=_0x200634;logger[_0x2cec('0x1f')](_0x2cec('0x68'),_0x1c1ef0['id']);logger[_0x2cec('0x1f')](_0x2cec('0x69'),_0x1c1ef0['id'],_0x172ba5[_0x2cec('0x40')],_0x44011e[_0x2cec('0x38')]);switch(_0x44011e[_0x2cec('0x38')]){case _0x2cec('0x58'):emit(util[_0x2cec('0x2f')](_0x2cec('0x5a'),_0x172ba5[_0x2cec('0x40')]),_0x2cec('0x59'),{'recordId':_0x1c1ef0['id']});break;case _0x2cec('0x6a'):emit(util[_0x2cec('0x2f')]('user:%s',_0x172ba5[_0x2cec('0x40')]),_0x2cec('0x5b'),{'uri':util['format'](_0x2cec('0x5c'),_0x2e6de3[_0x2cec('0x5d')],_0x1c1ef0['id'])});break;default:logger[_0x2cec('0x5e')](_0x2cec('0x65'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x2cec('0x60')](function(_0x4a423e){logger[_0x2cec('0x5e')](_0x2cec('0x65'),JSON[_0x2cec('0x61')](_0x4a423e));});};exports[_0x2cec('0x6b')]=function(_0x44dd1d,_0x5b0fda,_0x34bdef,_0x3bc28d,_0x10ecf5,_0x4462b7){var _0x823851,_0x19bf3e,_0xd7ba7b,_0x58c14c;_0x4462b7[_0x2cec('0x4c')]=intUtil[_0x2cec('0x4d')](_0x4462b7[_0x2cec('0x4c')]);_0x4462b7[_0x2cec('0x46')]=intUtil['stripTrailingSlash'](_0x4462b7[_0x2cec('0x46')]);if(_0x10ecf5&&_0x10ecf5[_0x2cec('0x4e')]){logger['info']('['+_0x5b0fda[_0x2cec('0x6c')][_0x2cec('0x6d')]()+']',_0x2cec('0x66'));_0x5b0fda[_0x2cec('0x50')]=util[_0x2cec('0x2f')](_0x2cec('0x51'),_0x4462b7[_0x2cec('0x4c')],_0x5b0fda[_0x2cec('0x52')],md5(_0x5b0fda['uniqueid']));}else{_0x5b0fda[_0x2cec('0x50')]='';}return getConnection(_0x4462b7)[_0x2cec('0x1c')](function(_0x577911){_0x58c14c=_0x577911;if(!_['isNil'](_0x3bc28d)){return getUser(_0x4462b7,_0x3bc28d[_0x2cec('0x40')],_0x58c14c);}else{return getUser(_0x4462b7,null,_0x58c14c);}})['then'](function(_0x57a475){_0x823851=_0x57a475;return getEndUser(_0x4462b7,_0x34bdef,_0x5b0fda[_0x2cec('0x54')],_0x5b0fda['calleridnum'],_0x58c14c);})[_0x2cec('0x1c')](function(_0x22e606){_0x19bf3e=_0x22e606;return getTicket(_0x4462b7,_0x823851,_0x19bf3e,_0x34bdef,_0x5b0fda,_0x34bdef[_0x2cec('0x55')],_0x58c14c);})['then'](function(_0x19c12b){_0xd7ba7b=_0x19c12b;logger['info']('['+_0x5b0fda[_0x2cec('0x6c')][_0x2cec('0x6d')]()+']\x20Ticket\x20%s\x20created.',_0xd7ba7b['id']);logger[_0x2cec('0x1f')]('['+_0x5b0fda['lastevent']['toUpperCase']()+_0x2cec('0x6e'),_0x4462b7['type']);})['catch'](function(_0x3b1dcd){logger[_0x2cec('0x5e')]('['+_0x5b0fda[_0x2cec('0x6c')][_0x2cec('0x6d')]()+']',JSON[_0x2cec('0x61')](_0x3b1dcd));});}; \ 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 1bedb8e..28ccd50 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 _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x3607f9,_0x14a452){var _0x1f2318=function(_0x57eaf1){while(--_0x57eaf1){_0x3607f9['push'](_0x3607f9['shift']());}};_0x1f2318(++_0x14a452);}(_0x326f,0xd1));var _0xf326=function(_0x32b21a,_0x51fec2){_0x32b21a=_0x32b21a-0x0;var _0x53d4a7=_0x326f[_0x32b21a];return _0x53d4a7;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0xb7827,_0x2c998f){var _0x56da7f=function(_0x4e02a6){while(--_0x4e02a6){_0xb7827['push'](_0xb7827['shift']());}};_0x56da7f(++_0x2c998f);}(_0x2ef3,0xba));var _0x32ef=function(_0x3fb90b,_0xa1f3cb){_0x3fb90b=_0x3fb90b-0x0;var _0x434b36=_0x2ef3[_0x3fb90b];return _0x434b36;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index d08c14a..a54ec74 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 _0xd819=['custom_fields','Variable','toLowerCase','username','password','PLAIN','xCALLY\x20Motion\x20integration','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','%s/service/v4_1/rest.php','monitor_format','lastevent','toUpperCase','calleridname','Fields','request-promise','bluebird','md5','util','./util','../../../../config/logger','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','string','nameField','customField','content','type','idField'];(function(_0x33412b,_0x493621){var _0x8012df=function(_0x2f0a00){while(--_0x2f0a00){_0x33412b['push'](_0x33412b['shift']());}};_0x8012df(++_0x493621);}(_0xd819,0x181));var _0x9d81=function(_0x7dda42,_0x31357d){_0x7dda42=_0x7dda42-0x0;var _0x3d413c=_0xd819[_0x7dda42];return _0x3d413c;};'use strict';var _=require('lodash');var rp=require(_0x9d81('0x0'));var BPromise=require(_0x9d81('0x1'));var md5=require(_0x9d81('0x2'));var util=require(_0x9d81('0x3'));var Redis=require('ioredis');var intUtil=require(_0x9d81('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9d81('0x5'))('sugarcrm');config[_0x9d81('0x6')]=_[_0x9d81('0x7')](config[_0x9d81('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9d81('0x8'))(new Redis(config[_0x9d81('0x6')]));var def={'method':_0x9d81('0x9'),'json':!![]};function emit(_0x1e1329,_0x2bdd23,_0x43244d){io['to'](_0x1e1329)[_0x9d81('0xa')](_0x2bdd23,_0x43244d);}function getTicket(_0x21e4f7,_0x25a4c0,_0x3932e7,_0x17a3a3,_0x44bba4,_0x404b15,_0x32ff90,_0x53951a){logger[_0x9d81('0xb')](_0x9d81('0xc'));var _0x4b2e9d=new Date();var _0x2113a5=[{'name':_0x9d81('0xd'),'value':intUtil[_0x9d81('0xe')](_0x17a3a3[_0x9d81('0xf')],_0x44bba4,'\x20')},{'name':'assigned_user_id','value':_0x25a4c0['id']},{'name':_0x9d81('0x10'),'value':_0x25a4c0['id']},{'name':'description','value':intUtil[_0x9d81('0xe')](_0x17a3a3['Descriptions'],_0x44bba4,'\x0a')},{'name':_0x9d81('0x11'),'value':_0x4b2e9d[_0x9d81('0x12')]()['slice'](0x0,0x13)[_0x9d81('0x13')]('T','\x20')},{'name':_0x9d81('0x14'),'value':'0'},{'name':_0x9d81('0x15'),'value':'15'},{'name':_0x9d81('0x16'),'value':_0x3932e7['id']},{'name':_0x9d81('0x17'),'value':_0x9d81('0x18')},{'name':_0x9d81('0x19'),'value':_0x3932e7[_0x9d81('0xd')]},{'name':'direction','value':_0x53951a}];if(_0x404b15[_0x9d81('0x1a')]){_[_0x9d81('0x1b')](_0x404b15,function(_0x3309c3){if(_0x44bba4[_0x3309c3[_0x9d81('0x1c')]]){_0x2113a5[_0x9d81('0x1d')]({'name':_0x3309c3['idField'],'value':_0x44bba4[_0x3309c3['variableName']]});}});}return request({'form':{'method':_0x9d81('0x1e'),'input_type':_0x9d81('0x1f'),'response_type':_0x9d81('0x1f'),'rest_data':JSON[_0x9d81('0x20')]({'session':_0x32ff90['id'],'module_name':_0x9d81('0x21'),'name_value_list':_0x2113a5})}});}function getAuth(_0x175d4f){return util[_0x9d81('0x22')](_0x9d81('0x23'),new Buffer(_0x175d4f[_0x9d81('0x24')]+':X')[_0x9d81('0x25')](_0x9d81('0x26')));}function getServerInfo(_0xd7d5cf){return request({'form':{'method':_0x9d81('0x27'),'input_type':'JSON','response_type':_0x9d81('0x1f'),'rest_data':JSON[_0x9d81('0x20')]({'session':_0xd7d5cf['id']})}});}function getUser(_0x2ebd66,_0x466454,_0x46d0b5){if(!_[_0x9d81('0x28')](_0x466454)){logger[_0x9d81('0xb')](_0x9d81('0x29'),_0x466454);return request({'form':{'method':'get_entry_list','input_type':_0x9d81('0x1f'),'response_type':_0x9d81('0x1f'),'rest_data':JSON[_0x9d81('0x20')]({'session':_0x46d0b5['id'],'module_name':_0x9d81('0x2a'),'query':util['format'](_0x9d81('0x2b'),_0x466454),'order_by':'','offset':'0','select_fields':['id','name',_0x9d81('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3835b5){if(_0x3835b5['entry_list'][_0x9d81('0x1a')]){var _0x2d8da6=_[_0x9d81('0x2d')](_0x3835b5[_0x9d81('0x2e')],function(_0xb82d79){return _0xb82d79[_0x9d81('0x2f')][_0x9d81('0x2c')][_0x9d81('0x30')]===_0x466454;});if(_0x2d8da6){logger[_0x9d81('0xb')](_0x9d81('0x31'));return BPromise[_0x9d81('0x32')]({'id':_0x2d8da6[_0x9d81('0x2f')]['id'][_0x9d81('0x30')],'name':_0x2d8da6[_0x9d81('0x2f')][_0x9d81('0xd')][_0x9d81('0x30')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9d81('0x32')]({'id':_0x46d0b5[_0x9d81('0x2f')][_0x9d81('0x33')]['value'],'name':_0x46d0b5[_0x9d81('0x2f')][_0x9d81('0x2c')][_0x9d81('0x30')]});});}else{logger['info'](_0x9d81('0x34'));return BPromise[_0x9d81('0x32')]({'id':_0x46d0b5[_0x9d81('0x2f')][_0x9d81('0x33')][_0x9d81('0x30')],'name':_0x46d0b5[_0x9d81('0x2f')][_0x9d81('0x2c')][_0x9d81('0x30')]});}}function getEndUser(_0x3632c4,_0x124a5f,_0x20130a,_0x204082){logger[_0x9d81('0xb')]('Searching\x20enduser\x20with\x20phone',_0x20130a);return request({'form':{'method':_0x9d81('0x35'),'input_type':_0x9d81('0x1f'),'response_type':_0x9d81('0x1f'),'rest_data':JSON[_0x9d81('0x20')]({'session':_0x204082['id'],'module_name':_0x9d81('0x18'),'query':util['format'](_0x9d81('0x36'),_0x20130a),'order_by':'','offset':'0','select_fields':['id',_0x9d81('0xd'),_0x9d81('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9d81('0x38')](function(_0x3e6d49){if(_0x3e6d49[_0x9d81('0x2e')][_0x9d81('0x1a')]){var _0x3abde3=_['find'](_0x3e6d49[_0x9d81('0x2e')],function(_0x25e0c0){return _0x25e0c0[_0x9d81('0x2f')]['phone_home'][_0x9d81('0x30')]===_0x20130a;});if(_0x3abde3){logger['info'](_0x9d81('0x39'));return BPromise['resolve']({'id':_0x3abde3[_0x9d81('0x2f')]['id'][_0x9d81('0x30')],'name':_0x3abde3[_0x9d81('0x2f')]['name'][_0x9d81('0x30')],'phone':_0x3abde3[_0x9d81('0x2f')][_0x9d81('0x37')][_0x9d81('0x30')]});}}else{logger[_0x9d81('0xb')](_0x9d81('0x3a'));return request({'form':{'method':_0x9d81('0x1e'),'input_type':_0x9d81('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x204082['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9d81('0x3b'),'value':_0x124a5f!==_0x9d81('0x3c')?_0x124a5f:util['format'](_0x9d81('0x3d'),_0x20130a)},{'name':_0x9d81('0x37'),'value':_0x20130a}]})}})[_0x9d81('0x38')](function(_0x597ecb){logger[_0x9d81('0xb')](_0x9d81('0x3e'));return BPromise[_0x9d81('0x32')]({'id':_0x597ecb['id'],'name':_0x597ecb[_0x9d81('0x2e')][_0x9d81('0x3b')][_0x9d81('0x30')],'phone':_0x597ecb[_0x9d81('0x2e')][_0x9d81('0x37')]['value']});});}});}function request(_0xd37559){logger['debug'](_0x9d81('0x3f'),JSON[_0x9d81('0x20')](_0xd37559));return rp(_[_0x9d81('0x40')](def,_0xd37559));}function getTags(_0x4b7d1e,_0x5975c7){var _0x307391=[];if(_0x4b7d1e&&_0x4b7d1e[_0x9d81('0x1a')]>0x0){_0x307391=_['map'](_0x4b7d1e,_0x5975c7);}return _0x307391;}function getCustomFields(_0x1664f4,_0x1c4550){var _0x8d0945=[];var _0x2e31a9={'custom_fields':[]};if(_0x1664f4[_0x9d81('0x1a')]>0x0){_[_0x9d81('0x1b')](_0x1664f4,function(_0x28a5c3){if(_0x28a5c3['type']===_0x9d81('0x41')&&_0x28a5c3[_0x9d81('0x42')]&&!_0x28a5c3[_0x9d81('0x43')]){_0x2e31a9[_0x28a5c3[_0x9d81('0x42')]['toLowerCase']()]=_0x28a5c3[_0x9d81('0x44')]['toString']();}else if(_0x28a5c3[_0x9d81('0x45')]===_0x9d81('0x41')&&_0x28a5c3[_0x9d81('0x46')]&&_0x28a5c3[_0x9d81('0x43')]){_0x2e31a9[_0x9d81('0x47')][_0x9d81('0x1d')]({'id':_0x28a5c3[_0x9d81('0x46')],'value':_0x28a5c3['content']['toString']()});}else if(_0x28a5c3[_0x9d81('0x45')]==='variable'&&_0x28a5c3[_0x9d81('0x1c')]&&_0x28a5c3[_0x9d81('0x46')]&&_0x28a5c3[_0x9d81('0x43')]){_0x1c4550[_0x28a5c3[_0x9d81('0x1c')]]&&_0x2e31a9[_0x9d81('0x47')][_0x9d81('0x1d')]({'id':_0x28a5c3[_0x9d81('0x46')],'value':_0x1c4550[_0x28a5c3['variableName']][_0x9d81('0x25')]()});}else if(_0x28a5c3[_0x9d81('0x45')]==='customVariable'&&_0x28a5c3[_0x9d81('0x48')]&&_0x28a5c3['Variable']['name']&&_0x28a5c3[_0x9d81('0x46')]&&_0x28a5c3[_0x9d81('0x43')]){_0x1c4550[_0x28a5c3[_0x9d81('0x48')]['name'][_0x9d81('0x49')]()]&&_0x2e31a9['custom_fields'][_0x9d81('0x1d')]({'id':_0x28a5c3[_0x9d81('0x46')],'value':_0x1c4550[_0x28a5c3[_0x9d81('0x48')][_0x9d81('0xd')]['toLowerCase']()]['toString']()});}});}return _0x2e31a9;}function getConnection(_0x54ea74){return request({'method':_0x9d81('0x9'),'form':{'method':'login','input_type':_0x9d81('0x1f'),'response_type':'JSON','rest_data':JSON[_0x9d81('0x20')]({'user_auth':{'user_name':_0x54ea74[_0x9d81('0x4a')],'password':_0x54ea74[_0x9d81('0x4b')],'encryption':_0x9d81('0x4c')},'application':_0x9d81('0x4d')})}})['then'](function(_0x4fd6c0){var _0x1b6bf8=_0x4fd6c0;if(_0x1b6bf8['id']){def['sessionID']=_0x1b6bf8['id'];return BPromise['resolve'](_0x1b6bf8);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x54ea74['id']));}});}function setRelationship(_0x2f6df8,_0x3f4806,_0x2bd344,_0xf0b76d){return request({'form':{'method':'set_relationship','input_type':_0x9d81('0x1f'),'response_type':_0x9d81('0x1f'),'rest_data':JSON[_0x9d81('0x20')]({'session':_0x2f6df8['id'],'module_name':_0x9d81('0x21'),'module_id':_0x2bd344['id'],'link_field_name':_0xf0b76d,'related_ids':[_0x3f4806['id']]})}});}exports['queue']=function(_0x3994c5,_0x31eb33,_0x31bd8e,_0x459c8d,_0x583888,_0x33f8f7){var _0x164b5a,_0xade60a,_0x2ec26a,_0x201de8;_0x33f8f7[_0x9d81('0x4e')]=intUtil[_0x9d81('0x4f')](_0x33f8f7['remoteUri']);_0x33f8f7['serverUrl']=intUtil['stripTrailingSlash'](_0x33f8f7[_0x9d81('0x50')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x33f8f7[_0x9d81('0x4e')]);if(_0x583888&&_0x583888['monitor_format']){logger['info'](_0x9d81('0x51'),_0x9d81('0x52'));_0x31eb33[_0x9d81('0x53')]=util[_0x9d81('0x22')](_0x9d81('0x54'),_0x33f8f7[_0x9d81('0x50')],_0x31eb33['uniqueid'],md5(_0x31eb33[_0x9d81('0x55')]));}else{_0x31eb33[_0x9d81('0x53')]='';}return getConnection(_0x33f8f7)[_0x9d81('0x38')](function(_0xd5c926){_0x201de8=_0xd5c926;return getUser(_0x33f8f7,_0x459c8d[_0x9d81('0xd')],_0x201de8);})['then'](function(_0x28b431){_0x164b5a=_0x28b431;logger['info'](_0x9d81('0x56'),_0x164b5a['id']);return getEndUser(_0x33f8f7,_0x31eb33['calleridname'],_0x31eb33['calleridnum'],_0x201de8);})[_0x9d81('0x38')](function(_0x402ba7){_0xade60a=_0x402ba7;logger[_0x9d81('0xb')]('The\x20Enduser\x20ID\x20is:',_0xade60a['id']);return getTicket(_0x33f8f7,_0x164b5a,_0xade60a,_0x31bd8e,_0x31eb33,_0x31bd8e['Fields'],_0x201de8,_0x9d81('0x57'));})[_0x9d81('0x38')](function(_0x25114b){_0x2ec26a=_0x25114b;logger[_0x9d81('0xb')]('Ticket\x20created!');logger[_0x9d81('0xb')](_0x9d81('0x58'),_0x2ec26a['id']);return setRelationship(_0x201de8,_0x164b5a,_0x2ec26a,_0x9d81('0x59'));})[_0x9d81('0x38')](function(){return setRelationship(_0x201de8,_0xade60a,_0x2ec26a,_0x9d81('0x5a'));})[_0x9d81('0x38')](function(){return getServerInfo(_0x201de8);})[_0x9d81('0x38')](function(_0x19e703){var _0x2163d6=parseInt(_0x19e703[_0x9d81('0x5b')]['charAt'](0x0));var _0xf9247c=util[_0x9d81('0x22')](_0x9d81('0x5c'),_0x33f8f7[_0x9d81('0x4e')],_0x2ec26a['id']);if(_0x2163d6>0x6){_0xf9247c=util[_0x9d81('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x33f8f7[_0x9d81('0x4e')],_0x2ec26a['id']);}logger[_0x9d81('0xb')](_0x9d81('0x51'),_0x9d81('0x5d'));emit(util[_0x9d81('0x22')](_0x9d81('0x5e'),_0x459c8d['name']),'trigger:browser:url',{'uri':_0xf9247c});})[_0x9d81('0x5f')](function(_0x57711f){logger[_0x9d81('0x60')]('[QUEUE]',JSON[_0x9d81('0x20')](_0x57711f));});};exports['outbound']=function(_0x21c23f,_0x579367,_0x5702ca,_0x10b26a,_0x18e691,_0x52e3ae,_0x574bb8){var _0x50ff96,_0x4196ed,_0x5ac4c1,_0x247a3c;_0x52e3ae[_0x9d81('0x4e')]=intUtil['stripTrailingSlash'](_0x52e3ae[_0x9d81('0x4e')]);_0x52e3ae['serverUrl']=intUtil[_0x9d81('0x4f')](_0x52e3ae[_0x9d81('0x50')]);def[_0x9d81('0x61')]=util[_0x9d81('0x22')]('%s/service/v4_1/rest.php',_0x52e3ae[_0x9d81('0x4e')]);if(_0x574bb8&&_0x574bb8[_0x9d81('0x62')]&&_0x574bb8[_0x9d81('0x62')]!==_0x9d81('0x63')){logger[_0x9d81('0xb')](_0x9d81('0x64'),'Recording\x20is\x20enabled!');_0x579367[_0x9d81('0x53')]=util[_0x9d81('0x22')](_0x9d81('0x54'),_0x52e3ae[_0x9d81('0x50')],_0x579367['uniqueid'],md5(_0x579367['uniqueid']));}return getConnection(_0x52e3ae)['then'](function(_0x327d28){_0x247a3c=_0x327d28;return getUser(_0x52e3ae,_0x10b26a[_0x9d81('0xd')],_0x247a3c);})[_0x9d81('0x38')](function(_0x2e0108){_0x50ff96=_0x2e0108;logger[_0x9d81('0xb')]('The\x20User\x20ID\x20is:',_0x50ff96['id']);return getEndUser(_0x52e3ae,_0x579367[_0x9d81('0x65')],_0x579367[_0x9d81('0x66')],_0x247a3c);})['then'](function(_0x469141){_0x4196ed=_0x469141;logger[_0x9d81('0xb')](_0x9d81('0x67'),_0x4196ed['id']);return getTicket(_0x52e3ae,_0x50ff96,_0x4196ed,_0x5702ca,_0x579367,_0x5702ca['Fields'],_0x247a3c,_0x9d81('0x68'));})[_0x9d81('0x38')](function(_0xa65d3e){_0x5ac4c1=_0xa65d3e;logger[_0x9d81('0xb')](_0x9d81('0x69'));logger[_0x9d81('0xb')](_0x9d81('0x58'),_0x5ac4c1['id']);return setRelationship(_0x247a3c,_0x50ff96,_0x5ac4c1,_0x9d81('0x59'));})[_0x9d81('0x38')](function(){return setRelationship(_0x247a3c,_0x4196ed,_0x5ac4c1,_0x9d81('0x5a'));})['then'](function(){return getServerInfo(_0x247a3c);})[_0x9d81('0x38')](function(_0x5edb47){var _0x2dadf8=parseInt(_0x5edb47[_0x9d81('0x5b')]['charAt'](0x0));var _0x2a6ebe=util[_0x9d81('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x52e3ae[_0x9d81('0x4e')],_0x5ac4c1['id']);if(_0x2dadf8>0x6){_0x2a6ebe=util[_0x9d81('0x22')](_0x9d81('0x6a'),_0x52e3ae[_0x9d81('0x4e')],_0x5ac4c1['id']);}logger[_0x9d81('0xb')](_0x9d81('0x64'),_0x9d81('0x5d'));emit(util[_0x9d81('0x22')]('user:%s',_0x10b26a[_0x9d81('0xd')]),_0x9d81('0x6b'),{'uri':_0x2a6ebe});})[_0x9d81('0x5f')](function(_0x4320ae){logger[_0x9d81('0x60')]('[OUTBOUND]',JSON['stringify'](_0x4320ae));});};exports['unmanaged']=function(_0x341fe6,_0x32c189,_0x177dab,_0x3dd93b,_0x196350,_0x4c51c8){var _0x2f569a,_0x2b8012,_0x291409,_0x708af6;_0x4c51c8[_0x9d81('0x4e')]=intUtil[_0x9d81('0x4f')](_0x4c51c8[_0x9d81('0x4e')]);_0x4c51c8[_0x9d81('0x50')]=intUtil[_0x9d81('0x4f')](_0x4c51c8[_0x9d81('0x50')]);def[_0x9d81('0x61')]=util[_0x9d81('0x22')](_0x9d81('0x6c'),_0x4c51c8[_0x9d81('0x4e')]);if(_0x196350&&_0x196350[_0x9d81('0x6d')]){logger[_0x9d81('0xb')]('['+_0x32c189[_0x9d81('0x6e')][_0x9d81('0x6f')]()+']',_0x9d81('0x52'));_0x32c189[_0x9d81('0x53')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c51c8[_0x9d81('0x50')],_0x32c189[_0x9d81('0x55')],md5(_0x32c189[_0x9d81('0x55')]));}else{_0x32c189[_0x9d81('0x53')]='';}return getConnection(_0x4c51c8)['then'](function(_0x11133c){_0x708af6=_0x11133c;if(!_['isNil'](_0x3dd93b)){return getUser(_0x4c51c8,_0x3dd93b['name'],_0x708af6);}else{return getUser(_0x4c51c8,null,_0x708af6);}})['then'](function(_0x251ffc){_0x2f569a=_0x251ffc;logger[_0x9d81('0xb')](_0x9d81('0x56'),_0x2f569a['id']);return getEndUser(_0x4c51c8,_0x32c189[_0x9d81('0x70')],_0x32c189['calleridnum'],_0x708af6);})[_0x9d81('0x38')](function(_0x233287){_0x2b8012=_0x233287;logger[_0x9d81('0xb')](_0x9d81('0x67'),_0x2b8012['id']);return getTicket(_0x4c51c8,_0x2f569a,_0x2b8012,_0x177dab,_0x32c189,_0x177dab[_0x9d81('0x71')],_0x708af6,_0x9d81('0x57'));})[_0x9d81('0x38')](function(_0x2b34f5){_0x291409=_0x2b34f5;logger[_0x9d81('0xb')](_0x9d81('0x69'));logger[_0x9d81('0xb')]('The\x20Ticket\x20ID\x20is:',_0x291409['id']);return setRelationship(_0x708af6,_0x2f569a,_0x291409,_0x9d81('0x59'));})[_0x9d81('0x38')](function(){return setRelationship(_0x708af6,_0x2b8012,_0x291409,_0x9d81('0x5a'));})[_0x9d81('0x38')](function(){return getServerInfo(_0x708af6);})[_0x9d81('0x5f')](function(_0x4066db){logger[_0x9d81('0x60')]('['+_0x32c189['lastevent'][_0x9d81('0x6f')]()+']',JSON['stringify'](_0x4066db));});}; \ No newline at end of file +var _0xb145=['Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','user:%s','catch','error','outbound','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridnum','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','variableName','push','idField','set_entry','JSON','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','forEach','type','nameField','customField','toLowerCase','content','string','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0x5e66bd,_0x39b095){var _0x48fa70=function(_0x341af7){while(--_0x341af7){_0x5e66bd['push'](_0x5e66bd['shift']());}};_0x48fa70(++_0x39b095);}(_0xb145,0xa3));var _0x5b14=function(_0x57007b,_0x47d156){_0x57007b=_0x57007b-0x0;var _0x3eb5b0=_0xb145[_0x57007b];return _0x3eb5b0;};'use strict';var _=require('lodash');var rp=require(_0x5b14('0x0'));var BPromise=require(_0x5b14('0x1'));var md5=require(_0x5b14('0x2'));var util=require(_0x5b14('0x3'));var Redis=require(_0x5b14('0x4'));var intUtil=require(_0x5b14('0x5'));var config=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('sugarcrm');config[_0x5b14('0x8')]=_[_0x5b14('0x9')](config[_0x5b14('0x8')],{'host':_0x5b14('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b14('0x8')]));var def={'method':_0x5b14('0xb'),'json':!![]};function emit(_0x34530a,_0x62cdcd,_0x473cfe){io['to'](_0x34530a)['emit'](_0x62cdcd,_0x473cfe);}function getTicket(_0x32d729,_0x3bdb54,_0x4a4557,_0x1d8b5f,_0x17047f,_0x1ecffb,_0xe146e8,_0x2102f0){logger['info'](_0x5b14('0xc'));var _0x50997e=new Date();var _0x30deb8=[{'name':_0x5b14('0xd'),'value':intUtil[_0x5b14('0xe')](_0x1d8b5f[_0x5b14('0xf')],_0x17047f,'\x20')},{'name':_0x5b14('0x10'),'value':_0x3bdb54['id']},{'name':_0x5b14('0x11'),'value':_0x3bdb54['id']},{'name':'description','value':intUtil[_0x5b14('0xe')](_0x1d8b5f[_0x5b14('0x12')],_0x17047f,'\x0a')},{'name':_0x5b14('0x13'),'value':_0x50997e[_0x5b14('0x14')]()[_0x5b14('0x15')](0x0,0x13)[_0x5b14('0x16')]('T','\x20')},{'name':_0x5b14('0x17'),'value':'0'},{'name':_0x5b14('0x18'),'value':'15'},{'name':_0x5b14('0x19'),'value':_0x4a4557['id']},{'name':_0x5b14('0x1a'),'value':_0x5b14('0x1b')},{'name':_0x5b14('0x1c'),'value':_0x4a4557['name']},{'name':_0x5b14('0x1d'),'value':_0x2102f0}];if(_0x1ecffb['length']){_['forEach'](_0x1ecffb,function(_0x58bf3c){if(_0x17047f[_0x58bf3c[_0x5b14('0x1e')]]){_0x30deb8[_0x5b14('0x1f')]({'name':_0x58bf3c[_0x5b14('0x20')],'value':_0x17047f[_0x58bf3c[_0x5b14('0x1e')]]});}});}return request({'form':{'method':_0x5b14('0x21'),'input_type':_0x5b14('0x22'),'response_type':_0x5b14('0x22'),'rest_data':JSON['stringify']({'session':_0xe146e8['id'],'module_name':'Calls','name_value_list':_0x30deb8})}});}function getAuth(_0x4fa079){return util[_0x5b14('0x23')](_0x5b14('0x24'),new Buffer(_0x4fa079[_0x5b14('0x25')]+':X')[_0x5b14('0x26')]('base64'));}function getServerInfo(_0x1018d9){return request({'form':{'method':_0x5b14('0x27'),'input_type':'JSON','response_type':_0x5b14('0x22'),'rest_data':JSON[_0x5b14('0x28')]({'session':_0x1018d9['id']})}});}function getUser(_0x50951f,_0x33a293,_0x54073f){if(!_['isNil'](_0x33a293)){logger['info']('Getting\x20agent\x20with\x20name',_0x33a293);return request({'form':{'method':_0x5b14('0x29'),'input_type':_0x5b14('0x22'),'response_type':_0x5b14('0x22'),'rest_data':JSON['stringify']({'session':_0x54073f['id'],'module_name':_0x5b14('0x2a'),'query':util[_0x5b14('0x23')](_0x5b14('0x2b'),_0x33a293),'order_by':'','offset':'0','select_fields':['id',_0x5b14('0xd'),_0x5b14('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5b14('0x2d')](function(_0x422d22){if(_0x422d22[_0x5b14('0x2e')][_0x5b14('0x2f')]){var _0x4e9609=_[_0x5b14('0x30')](_0x422d22[_0x5b14('0x2e')],function(_0x1c3c52){return _0x1c3c52[_0x5b14('0x31')]['user_name'][_0x5b14('0x32')]===_0x33a293;});if(_0x4e9609){logger[_0x5b14('0x33')]('Agent\x20found!');return BPromise['resolve']({'id':_0x4e9609[_0x5b14('0x31')]['id'][_0x5b14('0x32')],'name':_0x4e9609['name_value_list']['name'][_0x5b14('0x32')]});}}logger['info'](_0x5b14('0x34'));return BPromise[_0x5b14('0x35')]({'id':_0x54073f['name_value_list']['user_id'][_0x5b14('0x32')],'name':_0x54073f[_0x5b14('0x31')][_0x5b14('0x2c')]['value']});});}else{logger[_0x5b14('0x33')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5b14('0x35')]({'id':_0x54073f[_0x5b14('0x31')][_0x5b14('0x36')][_0x5b14('0x32')],'name':_0x54073f['name_value_list'][_0x5b14('0x2c')][_0x5b14('0x32')]});}}function getEndUser(_0x2a1aa7,_0x37f62c,_0x5a3a43,_0x32be08){logger[_0x5b14('0x33')](_0x5b14('0x37'),_0x5a3a43);return request({'form':{'method':'get_entry_list','input_type':_0x5b14('0x22'),'response_type':'JSON','rest_data':JSON[_0x5b14('0x28')]({'session':_0x32be08['id'],'module_name':_0x5b14('0x1b'),'query':util['format'](_0x5b14('0x38'),_0x5a3a43),'order_by':'','offset':'0','select_fields':['id',_0x5b14('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5b14('0x2d')](function(_0x53e829){if(_0x53e829[_0x5b14('0x2e')][_0x5b14('0x2f')]){var _0x178d4c=_[_0x5b14('0x30')](_0x53e829['entry_list'],function(_0xfac72){return _0xfac72[_0x5b14('0x31')][_0x5b14('0x39')][_0x5b14('0x32')]===_0x5a3a43;});if(_0x178d4c){logger[_0x5b14('0x33')](_0x5b14('0x3a'));return BPromise[_0x5b14('0x35')]({'id':_0x178d4c[_0x5b14('0x31')]['id'][_0x5b14('0x32')],'name':_0x178d4c[_0x5b14('0x31')][_0x5b14('0xd')][_0x5b14('0x32')],'phone':_0x178d4c[_0x5b14('0x31')][_0x5b14('0x39')][_0x5b14('0x32')]});}}else{logger[_0x5b14('0x33')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5b14('0x21'),'input_type':'JSON','response_type':_0x5b14('0x22'),'rest_data':JSON[_0x5b14('0x28')]({'session':_0x32be08['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x37f62c!==''?_0x37f62c:util[_0x5b14('0x23')](_0x5b14('0x3b'),_0x5a3a43)},{'name':'phone_home','value':_0x5a3a43}]})}})[_0x5b14('0x2d')](function(_0x21e7ec){logger[_0x5b14('0x33')](_0x5b14('0x3c'));return BPromise[_0x5b14('0x35')]({'id':_0x21e7ec['id'],'name':_0x21e7ec['entry_list'][_0x5b14('0x3d')][_0x5b14('0x32')],'phone':_0x21e7ec['entry_list'][_0x5b14('0x39')][_0x5b14('0x32')]});});}});}function request(_0x5cc257){logger[_0x5b14('0x3e')]('[HTTP]',JSON[_0x5b14('0x28')](_0x5cc257));return rp(_[_0x5b14('0x3f')](def,_0x5cc257));}function getTags(_0x277a01,_0x3d86e5){var _0x5bf279=[];if(_0x277a01&&_0x277a01[_0x5b14('0x2f')]>0x0){_0x5bf279=_[_0x5b14('0x40')](_0x277a01,_0x3d86e5);}return _0x5bf279;}function getCustomFields(_0x376eee,_0x1da448){var _0x4c5fea=[];var _0x5b55c1={'custom_fields':[]};if(_0x376eee[_0x5b14('0x2f')]>0x0){_[_0x5b14('0x41')](_0x376eee,function(_0x5ebbbe){if(_0x5ebbbe[_0x5b14('0x42')]==='string'&&_0x5ebbbe[_0x5b14('0x43')]&&!_0x5ebbbe[_0x5b14('0x44')]){_0x5b55c1[_0x5ebbbe[_0x5b14('0x43')][_0x5b14('0x45')]()]=_0x5ebbbe[_0x5b14('0x46')]['toString']();}else if(_0x5ebbbe[_0x5b14('0x42')]===_0x5b14('0x47')&&_0x5ebbbe[_0x5b14('0x20')]&&_0x5ebbbe[_0x5b14('0x44')]){_0x5b55c1[_0x5b14('0x48')]['push']({'id':_0x5ebbbe['idField'],'value':_0x5ebbbe[_0x5b14('0x46')]['toString']()});}else if(_0x5ebbbe['type']==='variable'&&_0x5ebbbe[_0x5b14('0x1e')]&&_0x5ebbbe[_0x5b14('0x20')]&&_0x5ebbbe[_0x5b14('0x44')]){_0x1da448[_0x5ebbbe[_0x5b14('0x1e')]]&&_0x5b55c1[_0x5b14('0x48')][_0x5b14('0x1f')]({'id':_0x5ebbbe[_0x5b14('0x20')],'value':_0x1da448[_0x5ebbbe['variableName']]['toString']()});}else if(_0x5ebbbe['type']==='customVariable'&&_0x5ebbbe['Variable']&&_0x5ebbbe[_0x5b14('0x49')][_0x5b14('0xd')]&&_0x5ebbbe[_0x5b14('0x20')]&&_0x5ebbbe[_0x5b14('0x44')]){_0x1da448[_0x5ebbbe[_0x5b14('0x49')]['name']['toLowerCase']()]&&_0x5b55c1[_0x5b14('0x48')][_0x5b14('0x1f')]({'id':_0x5ebbbe['idField'],'value':_0x1da448[_0x5ebbbe[_0x5b14('0x49')][_0x5b14('0xd')]['toLowerCase']()]['toString']()});}});}return _0x5b55c1;}function getConnection(_0x921a85){return request({'method':_0x5b14('0xb'),'form':{'method':_0x5b14('0x4a'),'input_type':'JSON','response_type':_0x5b14('0x22'),'rest_data':JSON[_0x5b14('0x28')]({'user_auth':{'user_name':_0x921a85[_0x5b14('0x4b')],'password':_0x921a85[_0x5b14('0x4c')],'encryption':_0x5b14('0x4d')},'application':_0x5b14('0x4e')})}})[_0x5b14('0x2d')](function(_0x5d7b65){var _0x286518=_0x5d7b65;if(_0x286518['id']){def['sessionID']=_0x286518['id'];return BPromise[_0x5b14('0x35')](_0x286518);}else{throw new Error(util[_0x5b14('0x23')](_0x5b14('0x4f'),_0x921a85['id']));}});}function setRelationship(_0x1258a2,_0x3206fb,_0x315dbb,_0x2752b4){return request({'form':{'method':_0x5b14('0x50'),'input_type':_0x5b14('0x22'),'response_type':_0x5b14('0x22'),'rest_data':JSON[_0x5b14('0x28')]({'session':_0x1258a2['id'],'module_name':_0x5b14('0x51'),'module_id':_0x315dbb['id'],'link_field_name':_0x2752b4,'related_ids':[_0x3206fb['id']]})}});}exports['queue']=function(_0x59326e,_0x4d1a88,_0x16aa01,_0x4dc9d1,_0xa23f6e,_0x8283a2){var _0x35e39c,_0xfc4996,_0x1ad816,_0x4a4c77;_0x8283a2[_0x5b14('0x52')]=intUtil[_0x5b14('0x53')](_0x8283a2['remoteUri']);_0x8283a2['serverUrl']=intUtil[_0x5b14('0x53')](_0x8283a2[_0x5b14('0x54')]);def[_0x5b14('0x55')]=util[_0x5b14('0x23')](_0x5b14('0x56'),_0x8283a2[_0x5b14('0x52')]);if(_0xa23f6e&&_0xa23f6e['monitor_format']){logger[_0x5b14('0x33')]('[QUEUE]',_0x5b14('0x57'));_0x4d1a88['recordingURL']=util[_0x5b14('0x23')](_0x5b14('0x58'),_0x8283a2[_0x5b14('0x54')],_0x4d1a88['uniqueid'],md5(_0x4d1a88[_0x5b14('0x59')]));}else{_0x4d1a88['recordingURL']='';}return getConnection(_0x8283a2)[_0x5b14('0x2d')](function(_0x2b4f44){_0x4a4c77=_0x2b4f44;return getUser(_0x8283a2,_0x4dc9d1[_0x5b14('0xd')],_0x4a4c77);})['then'](function(_0xe18ccf){_0x35e39c=_0xe18ccf;logger[_0x5b14('0x33')](_0x5b14('0x5a'),_0x35e39c['id']);return getEndUser(_0x8283a2,_0x4d1a88[_0x5b14('0x5b')],_0x4d1a88['calleridnum'],_0x4a4c77);})[_0x5b14('0x2d')](function(_0x493507){_0xfc4996=_0x493507;logger[_0x5b14('0x33')](_0x5b14('0x5c'),_0xfc4996['id']);return getTicket(_0x8283a2,_0x35e39c,_0xfc4996,_0x16aa01,_0x4d1a88,_0x16aa01['Fields'],_0x4a4c77,'Inbound');})[_0x5b14('0x2d')](function(_0x46fcfa){_0x1ad816=_0x46fcfa;logger[_0x5b14('0x33')]('Ticket\x20created!');logger[_0x5b14('0x33')](_0x5b14('0x5d'),_0x1ad816['id']);return setRelationship(_0x4a4c77,_0x35e39c,_0x1ad816,'users');})[_0x5b14('0x2d')](function(){return setRelationship(_0x4a4c77,_0xfc4996,_0x1ad816,_0x5b14('0x5e'));})[_0x5b14('0x2d')](function(){return getServerInfo(_0x4a4c77);})[_0x5b14('0x2d')](function(_0x3cffe4){var _0x49af2e=parseInt(_0x3cffe4[_0x5b14('0x5f')][_0x5b14('0x60')](0x0));var _0x521513=util['format'](_0x5b14('0x61'),_0x8283a2[_0x5b14('0x52')],_0x1ad816['id']);if(_0x49af2e>0x6){_0x521513=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x8283a2[_0x5b14('0x52')],_0x1ad816['id']);}logger[_0x5b14('0x33')](_0x5b14('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5b14('0x23')](_0x5b14('0x63'),_0x4dc9d1[_0x5b14('0xd')]),'trigger:browser:url',{'uri':_0x521513});})[_0x5b14('0x64')](function(_0x3c61ff){logger[_0x5b14('0x65')]('[QUEUE]',JSON[_0x5b14('0x28')](_0x3c61ff));});};exports[_0x5b14('0x66')]=function(_0x215072,_0x2ca6dd,_0x1c0fa2,_0x11e2ce,_0x19efb5,_0x51c15d,_0x5ac604){var _0x4e1eab,_0x4e33f1,_0x34e049,_0x1f0867;_0x51c15d[_0x5b14('0x52')]=intUtil[_0x5b14('0x53')](_0x51c15d[_0x5b14('0x52')]);_0x51c15d['serverUrl']=intUtil['stripTrailingSlash'](_0x51c15d[_0x5b14('0x54')]);def[_0x5b14('0x55')]=util[_0x5b14('0x23')](_0x5b14('0x56'),_0x51c15d[_0x5b14('0x52')]);if(_0x5ac604&&_0x5ac604['recordingFormat']&&_0x5ac604['recordingFormat']!==_0x5b14('0x67')){logger[_0x5b14('0x33')](_0x5b14('0x68'),_0x5b14('0x57'));_0x2ca6dd[_0x5b14('0x69')]=util[_0x5b14('0x23')](_0x5b14('0x58'),_0x51c15d[_0x5b14('0x54')],_0x2ca6dd[_0x5b14('0x59')],md5(_0x2ca6dd['uniqueid']));}return getConnection(_0x51c15d)[_0x5b14('0x2d')](function(_0x5586a0){_0x1f0867=_0x5586a0;return getUser(_0x51c15d,_0x11e2ce[_0x5b14('0xd')],_0x1f0867);})[_0x5b14('0x2d')](function(_0x1b1020){_0x4e1eab=_0x1b1020;logger[_0x5b14('0x33')](_0x5b14('0x5a'),_0x4e1eab['id']);return getEndUser(_0x51c15d,_0x2ca6dd[_0x5b14('0x6a')],_0x2ca6dd[_0x5b14('0x6b')],_0x1f0867);})['then'](function(_0x56ce77){_0x4e33f1=_0x56ce77;logger[_0x5b14('0x33')](_0x5b14('0x5c'),_0x4e33f1['id']);return getTicket(_0x51c15d,_0x4e1eab,_0x4e33f1,_0x1c0fa2,_0x2ca6dd,_0x1c0fa2[_0x5b14('0x6c')],_0x1f0867,_0x5b14('0x6d'));})[_0x5b14('0x2d')](function(_0x54bbeb){_0x34e049=_0x54bbeb;logger[_0x5b14('0x33')](_0x5b14('0x6e'));logger[_0x5b14('0x33')](_0x5b14('0x5d'),_0x34e049['id']);return setRelationship(_0x1f0867,_0x4e1eab,_0x34e049,_0x5b14('0x6f'));})[_0x5b14('0x2d')](function(){return setRelationship(_0x1f0867,_0x4e33f1,_0x34e049,_0x5b14('0x5e'));})[_0x5b14('0x2d')](function(){return getServerInfo(_0x1f0867);})[_0x5b14('0x2d')](function(_0x718e6a){var _0x56f9a4=parseInt(_0x718e6a['version'][_0x5b14('0x60')](0x0));var _0x44284d=util['format'](_0x5b14('0x61'),_0x51c15d[_0x5b14('0x52')],_0x34e049['id']);if(_0x56f9a4>0x6){_0x44284d=util[_0x5b14('0x23')](_0x5b14('0x70'),_0x51c15d['remoteUri'],_0x34e049['id']);}logger[_0x5b14('0x33')](_0x5b14('0x68'),_0x5b14('0x71'));emit(util[_0x5b14('0x23')](_0x5b14('0x63'),_0x11e2ce[_0x5b14('0xd')]),_0x5b14('0x72'),{'uri':_0x44284d});})['catch'](function(_0x4b0e12){logger['error'](_0x5b14('0x68'),JSON[_0x5b14('0x28')](_0x4b0e12));});};exports[_0x5b14('0x73')]=function(_0x7541a1,_0x3449df,_0x30ce17,_0x324b4d,_0x13e9e5,_0x2364bc){var _0x18d88b,_0x29d158,_0x50f68f,_0xd28c0d;_0x2364bc[_0x5b14('0x52')]=intUtil[_0x5b14('0x53')](_0x2364bc[_0x5b14('0x52')]);_0x2364bc['serverUrl']=intUtil[_0x5b14('0x53')](_0x2364bc[_0x5b14('0x54')]);def[_0x5b14('0x55')]=util[_0x5b14('0x23')](_0x5b14('0x56'),_0x2364bc[_0x5b14('0x52')]);if(_0x13e9e5&&_0x13e9e5[_0x5b14('0x74')]){logger[_0x5b14('0x33')]('['+_0x3449df[_0x5b14('0x75')][_0x5b14('0x76')]()+']',_0x5b14('0x57'));_0x3449df[_0x5b14('0x69')]=util[_0x5b14('0x23')](_0x5b14('0x58'),_0x2364bc[_0x5b14('0x54')],_0x3449df['uniqueid'],md5(_0x3449df[_0x5b14('0x59')]));}else{_0x3449df[_0x5b14('0x69')]='';}return getConnection(_0x2364bc)[_0x5b14('0x2d')](function(_0x1aaecd){_0xd28c0d=_0x1aaecd;if(!_[_0x5b14('0x77')](_0x324b4d)){return getUser(_0x2364bc,_0x324b4d['name'],_0xd28c0d);}else{return getUser(_0x2364bc,null,_0xd28c0d);}})['then'](function(_0x2d9489){_0x18d88b=_0x2d9489;logger['info'](_0x5b14('0x5a'),_0x18d88b['id']);return getEndUser(_0x2364bc,_0x3449df[_0x5b14('0x5b')],_0x3449df[_0x5b14('0x78')],_0xd28c0d);})[_0x5b14('0x2d')](function(_0x1af04d){_0x29d158=_0x1af04d;logger[_0x5b14('0x33')]('The\x20Enduser\x20ID\x20is:',_0x29d158['id']);return getTicket(_0x2364bc,_0x18d88b,_0x29d158,_0x30ce17,_0x3449df,_0x30ce17[_0x5b14('0x6c')],_0xd28c0d,'Inbound');})['then'](function(_0x361c69){_0x50f68f=_0x361c69;logger[_0x5b14('0x33')](_0x5b14('0x6e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x50f68f['id']);return setRelationship(_0xd28c0d,_0x18d88b,_0x50f68f,'users');})['then'](function(){return setRelationship(_0xd28c0d,_0x29d158,_0x50f68f,_0x5b14('0x5e'));})[_0x5b14('0x2d')](function(){return getServerInfo(_0xd28c0d);})[_0x5b14('0x64')](function(_0x47e418){logger['error']('['+_0x3449df[_0x5b14('0x75')][_0x5b14('0x76')]()+']',JSON['stringify'](_0x47e418));});}; \ 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 09a8189..ebdd4a9 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 _0xf8a9=['variableName','Variable','name','toLowerCase','toString','string','key','format','keyContent','keyType','%s:\x20%s','customVariable','join','stripTrailingSlash','lastIndexOf','isNil','test','lodash','getString','length','sortBy','type','variable','push'];(function(_0x58539c,_0x3301b6){var _0x144b78=function(_0x58d0f3){while(--_0x58d0f3){_0x58539c['push'](_0x58539c['shift']());}};_0x144b78(++_0x3301b6);}(_0xf8a9,0xa1));var _0x9f8a=function(_0x4653ae,_0x1c9583){_0x4653ae=_0x4653ae-0x0;var _0x4a8183=_0xf8a9[_0x4653ae];return _0x4a8183;};'use strict';var _=require(_0x9f8a('0x0'));var util=require('util');exports[_0x9f8a('0x1')]=function(_0x5291c9,_0x49c2c0,_0xd39679){var _0x685636=[];if(_0x5291c9[_0x9f8a('0x2')]>0x0){var _0x3f3298=_[_0x9f8a('0x3')](_0x5291c9,['id']);for(var _0x5d408e=0x0;_0x5d408e<_0x3f3298[_0x9f8a('0x2')];_0x5d408e++){var _0x567a9a=_0x3f3298[_0x5d408e];if(_0x567a9a['type']==='string'){_0x685636['push'](_0x567a9a['content']);}else if(_0x567a9a[_0x9f8a('0x4')]===_0x9f8a('0x5')&&_0x567a9a['variableName']){_0x49c2c0[_0x567a9a['variableName']]&&_0x685636[_0x9f8a('0x6')](_0x49c2c0[_0x567a9a[_0x9f8a('0x7')]]['toString']());}else if(_0x567a9a[_0x9f8a('0x4')]==='customVariable'&&_0x567a9a[_0x9f8a('0x8')]&&_0x567a9a[_0x9f8a('0x8')][_0x9f8a('0x9')]){_0x49c2c0[_0x567a9a[_0x9f8a('0x8')]['name'][_0x9f8a('0xa')]()]&&_0x685636[_0x9f8a('0x6')](_0x49c2c0[_0x567a9a[_0x9f8a('0x8')][_0x9f8a('0x9')][_0x9f8a('0xa')]()][_0x9f8a('0xb')]());}else if(_0x567a9a['type']==='keyValue'){if(_0x567a9a['keyType']===_0x9f8a('0xc')&&_0x567a9a[_0x9f8a('0xd')]){_0x685636[_0x9f8a('0x6')](util[_0x9f8a('0xe')]('%s:\x20%s',_0x567a9a['key'],_0x567a9a[_0x9f8a('0xf')]));}else if(_0x567a9a[_0x9f8a('0x10')]==='variable'&&_0x567a9a[_0x9f8a('0x7')]&&_0x567a9a['key']){_0x49c2c0[_0x567a9a[_0x9f8a('0x7')]]&&_0x685636[_0x9f8a('0x6')](util[_0x9f8a('0xe')](_0x9f8a('0x11'),_0x567a9a[_0x9f8a('0xd')],_0x49c2c0[_0x567a9a[_0x9f8a('0x7')]]));}else if(_0x567a9a['keyType']===_0x9f8a('0x12')&&_0x567a9a['Variable']&&_0x567a9a[_0x9f8a('0x8')]['name']&&_0x567a9a[_0x9f8a('0xd')]){_0x49c2c0[_0x567a9a['Variable'][_0x9f8a('0x9')][_0x9f8a('0xa')]()]&&_0x685636['push'](util['format'](_0x9f8a('0x11'),_0x567a9a[_0x9f8a('0xd')],_0x49c2c0[_0x567a9a['Variable'][_0x9f8a('0x9')][_0x9f8a('0xa')]()]));}}}}return _0x685636[_0x9f8a('0x13')](_0xd39679);};exports[_0x9f8a('0x14')]=function(_0x4a25bc){var _0x1c3adc=_0x4a25bc['slice'](-0x1);if(_0x1c3adc==='/'){_0x4a25bc=_0x4a25bc['substring'](0x0,_0x4a25bc[_0x9f8a('0x15')](_0x1c3adc));}return _0x4a25bc;};exports['validateEmail']=function(_0x49e7b4){if(!_[_0x9f8a('0x16')](_0x49e7b4)&&_0x49e7b4!==''){var _0x23106a=/^(([^<>()\[\]\\.,;:\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 _0x23106a[_0x9f8a('0x17')](String(_0x49e7b4)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xe28d=['lodash','util','sortBy','length','string','push','content','type','variable','variableName','Variable','name','toString','keyValue','keyType','key','format','keyContent','%s:\x20%s','toLowerCase','join','stripTrailingSlash','substring','validateEmail','isNil','test'];(function(_0x63a787,_0x484b67){var _0x12e14a=function(_0x3c94b0){while(--_0x3c94b0){_0x63a787['push'](_0x63a787['shift']());}};_0x12e14a(++_0x484b67);}(_0xe28d,0xd0));var _0xde28=function(_0x527c39,_0x3ea2a6){_0x527c39=_0x527c39-0x0;var _0x3f4dd6=_0xe28d[_0x527c39];return _0x3f4dd6;};'use strict';var _=require(_0xde28('0x0'));var util=require(_0xde28('0x1'));exports['getString']=function(_0x332517,_0x63d3e8,_0x182790){var _0x113351=[];if(_0x332517['length']>0x0){var _0x1fd6e3=_[_0xde28('0x2')](_0x332517,['id']);for(var _0x19916d=0x0;_0x19916d<_0x1fd6e3[_0xde28('0x3')];_0x19916d++){var _0x199010=_0x1fd6e3[_0x19916d];if(_0x199010['type']===_0xde28('0x4')){_0x113351[_0xde28('0x5')](_0x199010[_0xde28('0x6')]);}else if(_0x199010[_0xde28('0x7')]===_0xde28('0x8')&&_0x199010[_0xde28('0x9')]){_0x63d3e8[_0x199010[_0xde28('0x9')]]&&_0x113351[_0xde28('0x5')](_0x63d3e8[_0x199010[_0xde28('0x9')]]['toString']());}else if(_0x199010[_0xde28('0x7')]==='customVariable'&&_0x199010['Variable']&&_0x199010[_0xde28('0xa')][_0xde28('0xb')]){_0x63d3e8[_0x199010[_0xde28('0xa')][_0xde28('0xb')]['toLowerCase']()]&&_0x113351[_0xde28('0x5')](_0x63d3e8[_0x199010['Variable']['name']['toLowerCase']()][_0xde28('0xc')]());}else if(_0x199010[_0xde28('0x7')]===_0xde28('0xd')){if(_0x199010[_0xde28('0xe')]===_0xde28('0x4')&&_0x199010[_0xde28('0xf')]){_0x113351[_0xde28('0x5')](util[_0xde28('0x10')]('%s:\x20%s',_0x199010['key'],_0x199010[_0xde28('0x11')]));}else if(_0x199010[_0xde28('0xe')]===_0xde28('0x8')&&_0x199010[_0xde28('0x9')]&&_0x199010[_0xde28('0xf')]){_0x63d3e8[_0x199010[_0xde28('0x9')]]&&_0x113351[_0xde28('0x5')](util[_0xde28('0x10')](_0xde28('0x12'),_0x199010[_0xde28('0xf')],_0x63d3e8[_0x199010[_0xde28('0x9')]]));}else if(_0x199010[_0xde28('0xe')]==='customVariable'&&_0x199010[_0xde28('0xa')]&&_0x199010['Variable']['name']&&_0x199010[_0xde28('0xf')]){_0x63d3e8[_0x199010[_0xde28('0xa')][_0xde28('0xb')]['toLowerCase']()]&&_0x113351[_0xde28('0x5')](util[_0xde28('0x10')](_0xde28('0x12'),_0x199010['key'],_0x63d3e8[_0x199010[_0xde28('0xa')][_0xde28('0xb')][_0xde28('0x13')]()]));}}}}return _0x113351[_0xde28('0x14')](_0x182790);};exports[_0xde28('0x15')]=function(_0x10f1dc){var _0xa0f534=_0x10f1dc['slice'](-0x1);if(_0xa0f534==='/'){_0x10f1dc=_0x10f1dc[_0xde28('0x16')](0x0,_0x10f1dc['lastIndexOf'](_0xa0f534));}return _0x10f1dc;};exports[_0xde28('0x17')]=function(_0x16e2d){if(!_[_0xde28('0x18')](_0x16e2d)&&_0x16e2d!==''){var _0x2b21ea=/^(([^<>()\[\]\\.,;:\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 _0x2b21ea[_0xde28('0x19')](String(_0x16e2d)[_0xde28('0x13')]());}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 09e07e1..39361c3 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 _0xfc78=['customVariable','Variable','name','toLowerCase','Normal','Open','getString','Subjects','Descriptions','POST','create','username','sessionName','HelpDesk','stringify','then','resolve','result','format','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Enduser\x20found!','firstname','Contacts','Enduser\x20created.','lastname','getEndUser','getchallenge','login','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','Ticket\x20created!','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','length','forEach','string','idField','toString','type','variable','variableName'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xfc78,0x165));var _0x8fc7=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xfc78[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x8fc7('0x0'));var rp=require(_0x8fc7('0x1'));var BPromise=require('bluebird');var md5=require(_0x8fc7('0x2'));var util=require('util');var Redis=require(_0x8fc7('0x3'));var intUtil=require(_0x8fc7('0x4'));var config=require(_0x8fc7('0x5'));var logger=require(_0x8fc7('0x6'))('vTiger');config[_0x8fc7('0x7')]=_[_0x8fc7('0x8')](config[_0x8fc7('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8fc7('0x9'))(new Redis(config[_0x8fc7('0x7')]));function emit(_0x2fc53e,_0x28e2f9,_0xcfafed){io['to'](_0x2fc53e)[_0x8fc7('0xa')](_0x28e2f9,_0xcfafed);}function getCustomFields(_0x33d268,_0x19eec0){var _0x1a6cc3={};if(_0x33d268[_0x8fc7('0xb')]>0x0){_[_0x8fc7('0xc')](_0x33d268,function(_0x5e1542){if(_0x5e1542['type']===_0x8fc7('0xd')&&_0x5e1542[_0x8fc7('0xe')]){_0x1a6cc3[_0x5e1542[_0x8fc7('0xe')]]=_0x5e1542['content'][_0x8fc7('0xf')]();}else if(_0x5e1542[_0x8fc7('0x10')]===_0x8fc7('0x11')&&_0x5e1542['variableName']&&_0x5e1542['idField']&&_0x19eec0[_0x5e1542['variableName']]){_0x1a6cc3[_0x5e1542[_0x8fc7('0xe')]]=_0x19eec0[_0x5e1542[_0x8fc7('0x12')]][_0x8fc7('0xf')]();}else if(_0x5e1542['type']===_0x8fc7('0x13')&&_0x5e1542[_0x8fc7('0x14')]&&_0x5e1542[_0x8fc7('0x14')][_0x8fc7('0x15')]&&_0x5e1542[_0x8fc7('0xe')]&&_0x19eec0[_0x5e1542['Variable']['name'][_0x8fc7('0x16')]()]){_0x1a6cc3[_0x5e1542['idField']]=_0x19eec0[_0x5e1542['Variable'][_0x8fc7('0x15')][_0x8fc7('0x16')]()]['toString']();}});}return _0x1a6cc3;}function createTicket(_0x1453c6,_0x13dc78,_0x464e39,_0xff3c6e,_0x3d9d4e,_0x276078,_0x5f1e41){logger['info']('Creating\x20new\x20ticket...');var _0x1e7659=_['merge']({'parent_id':'','assigned_user_id':_0x13dc78['id'],'ticketpriorities':_0x8fc7('0x17'),'ticketstatus':_0x8fc7('0x18'),'ticket_title':intUtil[_0x8fc7('0x19')](_0xff3c6e[_0x8fc7('0x1a')],_0x3d9d4e,'\x20'),'description':intUtil[_0x8fc7('0x19')](_0xff3c6e[_0x8fc7('0x1b')],_0x3d9d4e,'\x0a'),'contact_id':_0x464e39['id']},getCustomFields(_0x276078,_0x3d9d4e));var _0x516240={'method':_0x8fc7('0x1c'),'uri':util['format']('%s/webservice.php',_0x1453c6['remoteUri']),'form':{'operation':_0x8fc7('0x1d'),'username':_0x1453c6[_0x8fc7('0x1e')],'sessionName':_0x5f1e41[_0x8fc7('0x1f')],'elementType':_0x8fc7('0x20'),'element':JSON[_0x8fc7('0x21')](_0x1e7659)},'json':!![]};return request(_0x516240)[_0x8fc7('0x22')](function(_0x4262b6){if(_0x4262b6['success']){return BPromise[_0x8fc7('0x23')]({'id':_0x4262b6[_0x8fc7('0x24')]['id']});}else{throw new Error(util[_0x8fc7('0x25')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x8fc7('0x21')](_0x4262b6[_0x8fc7('0x26')])));}})[_0x8fc7('0x27')](function(_0x1b8bff){var _0x34a5aa=_0x1b8bff[_0x8fc7('0x28')]||0x1f4;logger[_0x8fc7('0x26')](_0x8fc7('0x29'),_0x8fc7('0x2a'),_0x34a5aa,JSON[_0x8fc7('0x21')](_0x1b8bff));});}function getUser(_0x453f4d,_0x1bb885,_0x262e7b){if(intUtil[_0x8fc7('0x2b')](_0x1bb885)){logger[_0x8fc7('0x2c')](_0x8fc7('0x2d'),_0x1bb885);return request({'method':_0x8fc7('0x2e'),'uri':util[_0x8fc7('0x25')](_0x8fc7('0x2f'),_0x453f4d[_0x8fc7('0x30')]),'qs':{'operation':_0x8fc7('0x31'),'username':_0x453f4d[_0x8fc7('0x1e')],'sessionName':_0x262e7b[_0x8fc7('0x1f')],'query':util[_0x8fc7('0x25')](_0x8fc7('0x32'),_0x1bb885)},'json':!![]})[_0x8fc7('0x22')](function(_0x492451){if(_0x492451[_0x8fc7('0x33')]&&_0x492451[_0x8fc7('0x24')][_0x8fc7('0xb')]){logger[_0x8fc7('0x2c')]('Agent\x20found!');return BPromise[_0x8fc7('0x23')]({'id':_0x492451[_0x8fc7('0x24')][0x0]['id'],'email':_0x492451['result'][0x0][_0x8fc7('0x34')],'name':_0x492451[_0x8fc7('0x24')][0x0]['first_name']+'\x20'+_0x492451[_0x8fc7('0x24')]['last_name']});}else{logger[_0x8fc7('0x2c')](_0x8fc7('0x35'));return BPromise[_0x8fc7('0x23')]({'id':_0x262e7b[_0x8fc7('0x36')],'email':_0x453f4d[_0x8fc7('0x1e')],'name':'admin'});}})[_0x8fc7('0x27')](function(_0x246c21){var _0x1d54fe=_0x246c21[_0x8fc7('0x28')]||0x1f4;logger[_0x8fc7('0x26')](_0x8fc7('0x29'),_0x8fc7('0x37'),_0x1d54fe,JSON[_0x8fc7('0x21')](_0x246c21));});}else{logger[_0x8fc7('0x2c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x8fc7('0x23')]({'id':_0x262e7b[_0x8fc7('0x36')],'email':_0x453f4d[_0x8fc7('0x1e')],'name':_0x8fc7('0x38')})[_0x8fc7('0x27')](function(_0x4cb418){var _0x745424=_0x4cb418[_0x8fc7('0x28')]||0x1f4;logger[_0x8fc7('0x26')](_0x8fc7('0x29'),_0x8fc7('0x37'),_0x745424,JSON['stringify'](_0x4cb418));});}}function getEndUser(_0x452d98,_0x34bf3a,_0x5e8175,_0x1ac12f){logger[_0x8fc7('0x2c')]('Searching\x20end\x20user\x20with\x20phone',_0x5e8175);return request({'method':_0x8fc7('0x2e'),'uri':util[_0x8fc7('0x25')](_0x8fc7('0x2f'),_0x452d98[_0x8fc7('0x30')]),'qs':{'operation':'query','username':_0x452d98[_0x8fc7('0x1e')],'sessionName':_0x1ac12f[_0x8fc7('0x1f')],'query':util[_0x8fc7('0x25')]('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;',_0x5e8175,_0x5e8175,_0x5e8175,_0x5e8175,_0x5e8175)},'json':!![]})['then'](function(_0x47e0da){if(_0x47e0da[_0x8fc7('0x33')]&&_0x47e0da[_0x8fc7('0x24')][_0x8fc7('0xb')]){logger[_0x8fc7('0x2c')](_0x8fc7('0x39'));return BPromise[_0x8fc7('0x23')]({'id':_0x47e0da[_0x8fc7('0x24')][0x0]['id'],'name':_0x47e0da[_0x8fc7('0x24')][0x0][_0x8fc7('0x3a')]+'\x20'+_0x47e0da[_0x8fc7('0x24')][0x0]['lastname'],'phone':_0x5e8175});}else{logger[_0x8fc7('0x2c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x8fc7('0x1c'),'uri':util['format'](_0x8fc7('0x2f'),_0x452d98[_0x8fc7('0x30')]),'form':{'operation':_0x8fc7('0x1d'),'sessionName':_0x1ac12f['sessionName'],'elementType':_0x8fc7('0x3b'),'element':JSON[_0x8fc7('0x21')]({'lastname':_0x34bf3a,'phone':_0x5e8175,'assigned_user_id':'\x20'})},'json':!![]})[_0x8fc7('0x22')](function(_0x34d7a9){logger[_0x8fc7('0x2c')](_0x8fc7('0x3c'));return BPromise[_0x8fc7('0x23')]({'id':_0x34d7a9[_0x8fc7('0x24')]['id'],'name':_0x34d7a9[_0x8fc7('0x24')][_0x8fc7('0x3d')],'phone':_0x34d7a9[_0x8fc7('0x24')]['phone']});})[_0x8fc7('0x27')](function(_0x23dff4){var _0x2ae2bf=_0x23dff4[_0x8fc7('0x28')]||0x1f4;logger[_0x8fc7('0x26')](_0x8fc7('0x29'),_0x8fc7('0x3e'),_0x2ae2bf,JSON[_0x8fc7('0x21')](_0x23dff4));});}});}function getConnection(_0x2c7d3a){var _0xe2b901=_0x2c7d3a[_0x8fc7('0x1e')];var _0x51813b=_0x2c7d3a['accessKey'];return request({'method':'GET','uri':util[_0x8fc7('0x25')](_0x8fc7('0x2f'),_0x2c7d3a[_0x8fc7('0x30')]),'qs':{'operation':_0x8fc7('0x3f'),'username':_0xe2b901},'json':!![]})['then'](function(_0x56a8bf){if(_0x56a8bf['success']){return request({'method':_0x8fc7('0x1c'),'uri':util[_0x8fc7('0x25')](_0x8fc7('0x2f'),_0x2c7d3a[_0x8fc7('0x30')]),'form':{'operation':_0x8fc7('0x40'),'username':_0xe2b901,'accessKey':md5(_0x56a8bf[_0x8fc7('0x24')]['token']+_0x51813b)},'json':!![]});}})[_0x8fc7('0x22')](function(_0x3549d5){if(_0x3549d5[_0x8fc7('0x33')]){return BPromise[_0x8fc7('0x23')](_0x3549d5['result']);}else{throw new Error(util[_0x8fc7('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x2c7d3a['id']));}})[_0x8fc7('0x27')](function(_0x2eb3ef){var _0x321cc5=_0x2eb3ef['statusCode']||0x1f4;logger['error'](_0x8fc7('0x29'),_0x8fc7('0x41'),_0x321cc5,JSON[_0x8fc7('0x21')](_0x2eb3ef));});}function request(_0x542463){logger[_0x8fc7('0x2c')](_0x8fc7('0x42'),JSON[_0x8fc7('0x21')](_0x542463));return rp(_0x542463);}exports[_0x8fc7('0x43')]=function(_0x21206f,_0x18c75b,_0x3dafea,_0x349093,_0x5631bc,_0x56bb1e){var _0x3e9c8c,_0x223602,_0xc68026,_0x16d2f2;_0x56bb1e[_0x8fc7('0x30')]=intUtil[_0x8fc7('0x44')](_0x56bb1e[_0x8fc7('0x30')]);if(_0x5631bc&&_0x5631bc[_0x8fc7('0x45')]){logger[_0x8fc7('0x2c')](_0x8fc7('0x46'),'Recording\x20is\x20enabled!');_0x18c75b[_0x8fc7('0x47')]=util['format'](_0x8fc7('0x48'),_0x56bb1e[_0x8fc7('0x49')],_0x18c75b[_0x8fc7('0x4a')],md5(_0x18c75b[_0x8fc7('0x4a')]));}else{_0x18c75b[_0x8fc7('0x47')]='';}return getConnection(_0x56bb1e)['then'](function(_0x43ecaa){_0x16d2f2=_0x43ecaa;return getUser(_0x56bb1e,_0x349093[_0x8fc7('0x4b')],_0x16d2f2);})[_0x8fc7('0x22')](function(_0x1d0cc2){_0x3e9c8c=_0x1d0cc2;logger[_0x8fc7('0x2c')](_0x8fc7('0x4c'),_0x3e9c8c['id']);return getEndUser(_0x56bb1e,_0x18c75b[_0x8fc7('0x4d')],_0x18c75b[_0x8fc7('0x4e')],_0x16d2f2);})[_0x8fc7('0x22')](function(_0x28181b){_0x223602=_0x28181b;logger[_0x8fc7('0x2c')](_0x8fc7('0x4f'),_0x223602['id']);return createTicket(_0x56bb1e,_0x3e9c8c,_0x223602,_0x3dafea,_0x18c75b,_0x3dafea[_0x8fc7('0x50')],_0x16d2f2);})['then'](function(_0x4caa32){_0xc68026=_0x4caa32;logger[_0x8fc7('0x2c')]('Ticket\x20created!');logger[_0x8fc7('0x2c')](_0x8fc7('0x51'),_0xc68026['id']);var _0x3fcd63=util['format'](_0x8fc7('0x52'),_0x56bb1e['remoteUri'],_['split'](_0xc68026['id'],'x')[0x1]);logger['info'](_0x8fc7('0x46'),_0x8fc7('0x53'));emit(util[_0x8fc7('0x25')]('user:%s',_0x349093['name']),_0x8fc7('0x54'),{'uri':_0x3fcd63});})[_0x8fc7('0x27')](function(_0xfcee1){logger[_0x8fc7('0x26')]('[QUEUE]',JSON[_0x8fc7('0x21')](_0xfcee1));});};exports['outbound']=function(_0x195db7,_0x44ed29,_0x5996a1,_0x2fc58b,_0x50ab4f,_0x49ed41,_0x452c68){var _0x54f4bd,_0x44a11f,_0x32b6b7,_0x11b028;_0x49ed41[_0x8fc7('0x30')]=intUtil[_0x8fc7('0x44')](_0x49ed41[_0x8fc7('0x30')]);_0x49ed41[_0x8fc7('0x49')]=intUtil[_0x8fc7('0x44')](_0x49ed41[_0x8fc7('0x49')]);if(_0x452c68&&_0x452c68[_0x8fc7('0x55')]&&_0x452c68[_0x8fc7('0x55')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x44ed29[_0x8fc7('0x47')]=util['format'](_0x8fc7('0x48'),_0x49ed41[_0x8fc7('0x49')],_0x44ed29[_0x8fc7('0x4a')],md5(_0x44ed29[_0x8fc7('0x4a')]));}return getConnection(_0x49ed41)[_0x8fc7('0x22')](function(_0x221bf0){_0x11b028=_0x221bf0;return getUser(_0x49ed41,_0x2fc58b[_0x8fc7('0x4b')],_0x11b028);})[_0x8fc7('0x22')](function(_0x507cd9){_0x54f4bd=_0x507cd9;logger[_0x8fc7('0x2c')](_0x8fc7('0x4c'),_0x54f4bd['id']);return getEndUser(_0x49ed41,_0x44ed29[_0x8fc7('0x56')],_0x44ed29[_0x8fc7('0x57')],_0x11b028);})['then'](function(_0x4ff4cb){_0x44a11f=_0x4ff4cb;logger[_0x8fc7('0x2c')](_0x8fc7('0x4f'),_0x44a11f['id']);return createTicket(_0x49ed41,_0x54f4bd,_0x44a11f,_0x5996a1,_0x44ed29,_0x5996a1[_0x8fc7('0x50')],_0x11b028);})[_0x8fc7('0x22')](function(_0x576ec4){_0x32b6b7=_0x576ec4;logger['info']('Ticket\x20created!');logger[_0x8fc7('0x2c')](_0x8fc7('0x51'),_0x32b6b7['id']);var _0x34682b=util[_0x8fc7('0x25')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x49ed41[_0x8fc7('0x30')],_['split'](_0x32b6b7['id'],'x')[0x1]);logger[_0x8fc7('0x2c')]('[OUTBOUND]',_0x8fc7('0x53'));emit(util[_0x8fc7('0x25')]('user:%s',_0x2fc58b['name']),'trigger:browser:url',{'uri':_0x34682b});})['catch'](function(_0x1a1d49){logger['error'](_0x8fc7('0x58'),JSON['stringify'](_0x1a1d49));});};exports[_0x8fc7('0x59')]=function(_0x246b39,_0x1a9753,_0x4e0f30,_0x35ffe1,_0x1a568b,_0x1e85d1){var _0x43b81a,_0x53f2ae,_0x2fe88f,_0xc2e0cd;_0x1e85d1[_0x8fc7('0x30')]=intUtil[_0x8fc7('0x44')](_0x1e85d1[_0x8fc7('0x30')]);_0x1e85d1['serverUrl']=intUtil[_0x8fc7('0x44')](_0x1e85d1[_0x8fc7('0x49')]);if(_0x1a568b&&_0x1a568b[_0x8fc7('0x45')]){logger['info']('['+_0x1a9753[_0x8fc7('0x5a')]['toUpperCase']()+']',_0x8fc7('0x5b'));_0x1a9753[_0x8fc7('0x47')]=util[_0x8fc7('0x25')](_0x8fc7('0x48'),_0x1e85d1['serverUrl'],_0x1a9753['uniqueid'],md5(_0x1a9753[_0x8fc7('0x4a')]));}else{_0x1a9753[_0x8fc7('0x47')]='';}return getConnection(_0x1e85d1)[_0x8fc7('0x22')](function(_0x3d87df){_0xc2e0cd=_0x3d87df;return getUser(_0x1e85d1,'',_0xc2e0cd);})[_0x8fc7('0x22')](function(_0x51634e){_0x43b81a=_0x51634e;logger['info'](_0x8fc7('0x4c'),_0x43b81a['id']);return getEndUser(_0x1e85d1,_0x1a9753[_0x8fc7('0x4d')],_0x1a9753[_0x8fc7('0x4e')],_0xc2e0cd);})[_0x8fc7('0x22')](function(_0x44bd5a){_0x53f2ae=_0x44bd5a;logger[_0x8fc7('0x2c')](_0x8fc7('0x4f'),_0x53f2ae['id']);return createTicket(_0x1e85d1,_0x43b81a,_0x53f2ae,_0x4e0f30,_0x1a9753,_0x4e0f30['Fields'],_0xc2e0cd);})[_0x8fc7('0x22')](function(_0x480c91){_0x2fe88f=_0x480c91;logger[_0x8fc7('0x2c')](_0x8fc7('0x5c'));logger[_0x8fc7('0x2c')](_0x8fc7('0x51'),_0x2fe88f['id']);})[_0x8fc7('0x27')](function(_0x57468d){logger['error']('['+_0x1a9753[_0x8fc7('0x5a')][_0x8fc7('0x5d')]()+']',JSON[_0x8fc7('0x21')](_0x57468d));});}; \ No newline at end of file +var _0xbdb5=['username','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','createTicket','GET','remoteUri','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','phone','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','%s/webservice.php','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbdb5,0x1b7));var _0x5bdb=function(_0x159aad,_0x7e42d4){_0x159aad=_0x159aad-0x0;var _0x1d213b=_0xbdb5[_0x159aad];return _0x1d213b;};'use strict';var _=require('lodash');var rp=require(_0x5bdb('0x0'));var BPromise=require(_0x5bdb('0x1'));var md5=require(_0x5bdb('0x2'));var util=require(_0x5bdb('0x3'));var Redis=require(_0x5bdb('0x4'));var intUtil=require(_0x5bdb('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5bdb('0x6'))('vTiger');config['redis']=_[_0x5bdb('0x7')](config[_0x5bdb('0x8')],{'host':_0x5bdb('0x9'),'port':0x18eb});var io=require(_0x5bdb('0xa'))(new Redis(config[_0x5bdb('0x8')]));function emit(_0x145427,_0x23d6b9,_0x49233a){io['to'](_0x145427)['emit'](_0x23d6b9,_0x49233a);}function getCustomFields(_0x41d52d,_0x3beb3f){var _0x3d5894={};if(_0x41d52d['length']>0x0){_[_0x5bdb('0xb')](_0x41d52d,function(_0x3eb128){if(_0x3eb128[_0x5bdb('0xc')]==='string'&&_0x3eb128[_0x5bdb('0xd')]){_0x3d5894[_0x3eb128[_0x5bdb('0xd')]]=_0x3eb128['content'][_0x5bdb('0xe')]();}else if(_0x3eb128['type']===_0x5bdb('0xf')&&_0x3eb128['variableName']&&_0x3eb128['idField']&&_0x3beb3f[_0x3eb128['variableName']]){_0x3d5894[_0x3eb128[_0x5bdb('0xd')]]=_0x3beb3f[_0x3eb128[_0x5bdb('0x10')]][_0x5bdb('0xe')]();}else if(_0x3eb128[_0x5bdb('0xc')]===_0x5bdb('0x11')&&_0x3eb128[_0x5bdb('0x12')]&&_0x3eb128[_0x5bdb('0x12')][_0x5bdb('0x13')]&&_0x3eb128[_0x5bdb('0xd')]&&_0x3beb3f[_0x3eb128[_0x5bdb('0x12')][_0x5bdb('0x13')][_0x5bdb('0x14')]()]){_0x3d5894[_0x3eb128['idField']]=_0x3beb3f[_0x3eb128[_0x5bdb('0x12')][_0x5bdb('0x13')][_0x5bdb('0x14')]()]['toString']();}});}return _0x3d5894;}function createTicket(_0x547d97,_0x5ab58d,_0xf40222,_0x5dca20,_0x4e931f,_0x5d43c3,_0x105f3f){logger[_0x5bdb('0x15')](_0x5bdb('0x16'));var _0x4d0e5d=_[_0x5bdb('0x17')]({'parent_id':'','assigned_user_id':_0x5ab58d['id'],'ticketpriorities':_0x5bdb('0x18'),'ticketstatus':'Open','ticket_title':intUtil[_0x5bdb('0x19')](_0x5dca20[_0x5bdb('0x1a')],_0x4e931f,'\x20'),'description':intUtil[_0x5bdb('0x19')](_0x5dca20['Descriptions'],_0x4e931f,'\x0a'),'contact_id':_0xf40222['id']},getCustomFields(_0x5d43c3,_0x4e931f));var _0x134f93={'method':_0x5bdb('0x1b'),'uri':util[_0x5bdb('0x1c')](_0x5bdb('0x1d'),_0x547d97['remoteUri']),'form':{'operation':_0x5bdb('0x1e'),'username':_0x547d97[_0x5bdb('0x1f')],'sessionName':_0x105f3f['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x4d0e5d)},'json':!![]};return request(_0x134f93)[_0x5bdb('0x20')](function(_0x41f4e6){if(_0x41f4e6[_0x5bdb('0x21')]){return BPromise[_0x5bdb('0x22')]({'id':_0x41f4e6[_0x5bdb('0x23')]['id']});}else{throw new Error(util[_0x5bdb('0x1c')](_0x5bdb('0x24'),JSON[_0x5bdb('0x25')](_0x41f4e6[_0x5bdb('0x26')])));}})[_0x5bdb('0x27')](function(_0x179843){var _0x1b36d1=_0x179843[_0x5bdb('0x28')]||0x1f4;logger[_0x5bdb('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x5bdb('0x29'),_0x1b36d1,JSON[_0x5bdb('0x25')](_0x179843));});}function getUser(_0x35f954,_0x8920a7,_0x386ff2){if(intUtil['validateEmail'](_0x8920a7)){logger[_0x5bdb('0x15')]('Getting\x20agent\x20with\x20email',_0x8920a7);return request({'method':_0x5bdb('0x2a'),'uri':util[_0x5bdb('0x1c')](_0x5bdb('0x1d'),_0x35f954[_0x5bdb('0x2b')]),'qs':{'operation':_0x5bdb('0x2c'),'username':_0x35f954['username'],'sessionName':_0x386ff2[_0x5bdb('0x2d')],'query':util['format'](_0x5bdb('0x2e'),_0x8920a7)},'json':!![]})[_0x5bdb('0x20')](function(_0x41caa7){if(_0x41caa7['success']&&_0x41caa7[_0x5bdb('0x23')][_0x5bdb('0x2f')]){logger['info']('Agent\x20found!');return BPromise[_0x5bdb('0x22')]({'id':_0x41caa7[_0x5bdb('0x23')][0x0]['id'],'email':_0x41caa7[_0x5bdb('0x23')][0x0][_0x5bdb('0x30')],'name':_0x41caa7[_0x5bdb('0x23')][0x0]['first_name']+'\x20'+_0x41caa7[_0x5bdb('0x23')]['last_name']});}else{logger[_0x5bdb('0x15')](_0x5bdb('0x31'));return BPromise[_0x5bdb('0x22')]({'id':_0x386ff2[_0x5bdb('0x32')],'email':_0x35f954[_0x5bdb('0x1f')],'name':_0x5bdb('0x33')});}})['catch'](function(_0x1a95a9){var _0x405efb=_0x1a95a9[_0x5bdb('0x28')]||0x1f4;logger[_0x5bdb('0x26')](_0x5bdb('0x34'),'getUser',_0x405efb,JSON[_0x5bdb('0x25')](_0x1a95a9));});}else{logger[_0x5bdb('0x15')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5bdb('0x22')]({'id':_0x386ff2['userId'],'email':_0x35f954[_0x5bdb('0x1f')],'name':_0x5bdb('0x33')})[_0x5bdb('0x27')](function(_0x778b6e){var _0x3460c1=_0x778b6e['statusCode']||0x1f4;logger[_0x5bdb('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x5bdb('0x35'),_0x3460c1,JSON[_0x5bdb('0x25')](_0x778b6e));});}}function getEndUser(_0x55bb56,_0x31832f,_0x5435e3,_0x418b43){logger[_0x5bdb('0x15')](_0x5bdb('0x36'),_0x5435e3);return request({'method':'GET','uri':util['format'](_0x5bdb('0x1d'),_0x55bb56[_0x5bdb('0x2b')]),'qs':{'operation':_0x5bdb('0x2c'),'username':_0x55bb56[_0x5bdb('0x1f')],'sessionName':_0x418b43[_0x5bdb('0x2d')],'query':util['format']('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;',_0x5435e3,_0x5435e3,_0x5435e3,_0x5435e3,_0x5435e3)},'json':!![]})['then'](function(_0x18678f){if(_0x18678f[_0x5bdb('0x21')]&&_0x18678f['result'][_0x5bdb('0x2f')]){logger[_0x5bdb('0x15')]('Enduser\x20found!');return BPromise[_0x5bdb('0x22')]({'id':_0x18678f[_0x5bdb('0x23')][0x0]['id'],'name':_0x18678f[_0x5bdb('0x23')][0x0][_0x5bdb('0x37')]+'\x20'+_0x18678f[_0x5bdb('0x23')][0x0][_0x5bdb('0x38')],'phone':_0x5435e3});}else{logger[_0x5bdb('0x15')](_0x5bdb('0x39'));return request({'method':'POST','uri':util[_0x5bdb('0x1c')]('%s/webservice.php',_0x55bb56['remoteUri']),'form':{'operation':_0x5bdb('0x1e'),'sessionName':_0x418b43[_0x5bdb('0x2d')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x31832f,'phone':_0x5435e3,'assigned_user_id':'\x20'})},'json':!![]})[_0x5bdb('0x20')](function(_0x56bf51){logger[_0x5bdb('0x15')](_0x5bdb('0x3a'));return BPromise[_0x5bdb('0x22')]({'id':_0x56bf51['result']['id'],'name':_0x56bf51['result']['lastname'],'phone':_0x56bf51[_0x5bdb('0x23')][_0x5bdb('0x3b')]});})[_0x5bdb('0x27')](function(_0x490ad6){var _0x4f135a=_0x490ad6[_0x5bdb('0x28')]||0x1f4;logger['error'](_0x5bdb('0x34'),'getEndUser',_0x4f135a,JSON[_0x5bdb('0x25')](_0x490ad6));});}});}function getConnection(_0x5134b2){var _0x373e83=_0x5134b2[_0x5bdb('0x1f')];var _0x33f2f8=_0x5134b2['accessKey'];return request({'method':_0x5bdb('0x2a'),'uri':util[_0x5bdb('0x1c')](_0x5bdb('0x1d'),_0x5134b2['remoteUri']),'qs':{'operation':'getchallenge','username':_0x373e83},'json':!![]})[_0x5bdb('0x20')](function(_0xecec9a){if(_0xecec9a['success']){return request({'method':_0x5bdb('0x1b'),'uri':util['format']('%s/webservice.php',_0x5134b2[_0x5bdb('0x2b')]),'form':{'operation':_0x5bdb('0x3c'),'username':_0x373e83,'accessKey':md5(_0xecec9a[_0x5bdb('0x23')][_0x5bdb('0x3d')]+_0x33f2f8)},'json':!![]});}})['then'](function(_0x27d673){if(_0x27d673[_0x5bdb('0x21')]){return BPromise[_0x5bdb('0x22')](_0x27d673['result']);}else{throw new Error(util['format'](_0x5bdb('0x3e'),_0x5134b2['id']));}})[_0x5bdb('0x27')](function(_0x380a8d){var _0x27f4c0=_0x380a8d['statusCode']||0x1f4;logger[_0x5bdb('0x26')](_0x5bdb('0x34'),_0x5bdb('0x3f'),_0x27f4c0,JSON[_0x5bdb('0x25')](_0x380a8d));});}function request(_0x71a053){logger[_0x5bdb('0x15')](_0x5bdb('0x40'),JSON[_0x5bdb('0x25')](_0x71a053));return rp(_0x71a053);}exports[_0x5bdb('0x41')]=function(_0xbba7ac,_0xdb0b00,_0x45a296,_0x4a11ae,_0xdafe80,_0x597c9b){var _0x116f83,_0x488c64,_0x22a46e,_0x59d16f;_0x597c9b[_0x5bdb('0x2b')]=intUtil[_0x5bdb('0x42')](_0x597c9b[_0x5bdb('0x2b')]);if(_0xdafe80&&_0xdafe80[_0x5bdb('0x43')]){logger[_0x5bdb('0x15')](_0x5bdb('0x44'),_0x5bdb('0x45'));_0xdb0b00[_0x5bdb('0x46')]=util[_0x5bdb('0x1c')](_0x5bdb('0x47'),_0x597c9b['serverUrl'],_0xdb0b00['uniqueid'],md5(_0xdb0b00[_0x5bdb('0x48')]));}else{_0xdb0b00[_0x5bdb('0x46')]='';}return getConnection(_0x597c9b)[_0x5bdb('0x20')](function(_0x3e5ebb){_0x59d16f=_0x3e5ebb;return getUser(_0x597c9b,_0x4a11ae[_0x5bdb('0x49')],_0x59d16f);})[_0x5bdb('0x20')](function(_0x25ebf1){_0x116f83=_0x25ebf1;logger['info'](_0x5bdb('0x4a'),_0x116f83['id']);return getEndUser(_0x597c9b,_0xdb0b00[_0x5bdb('0x4b')],_0xdb0b00[_0x5bdb('0x4c')],_0x59d16f);})[_0x5bdb('0x20')](function(_0x4e4f7d){_0x488c64=_0x4e4f7d;logger[_0x5bdb('0x15')]('The\x20Enduser\x20ID\x20is:',_0x488c64['id']);return createTicket(_0x597c9b,_0x116f83,_0x488c64,_0x45a296,_0xdb0b00,_0x45a296[_0x5bdb('0x4d')],_0x59d16f);})[_0x5bdb('0x20')](function(_0x20b38e){_0x22a46e=_0x20b38e;logger[_0x5bdb('0x15')]('Ticket\x20created!');logger[_0x5bdb('0x15')](_0x5bdb('0x4e'),_0x22a46e['id']);var _0x5a9ddc=util[_0x5bdb('0x1c')](_0x5bdb('0x4f'),_0x597c9b['remoteUri'],_[_0x5bdb('0x50')](_0x22a46e['id'],'x')[0x1]);logger[_0x5bdb('0x15')](_0x5bdb('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5bdb('0x1c')](_0x5bdb('0x51'),_0x4a11ae[_0x5bdb('0x13')]),'trigger:browser:url',{'uri':_0x5a9ddc});})[_0x5bdb('0x27')](function(_0x2ba121){logger['error']('[QUEUE]',JSON[_0x5bdb('0x25')](_0x2ba121));});};exports[_0x5bdb('0x52')]=function(_0x5cf977,_0x2b5cdf,_0x186aba,_0x536ce0,_0x490a03,_0x1129b0,_0x12853c){var _0x63974,_0x209a0f,_0x2cff9a,_0x2298df;_0x1129b0[_0x5bdb('0x2b')]=intUtil[_0x5bdb('0x42')](_0x1129b0['remoteUri']);_0x1129b0[_0x5bdb('0x53')]=intUtil[_0x5bdb('0x42')](_0x1129b0[_0x5bdb('0x53')]);if(_0x12853c&&_0x12853c['recordingFormat']&&_0x12853c[_0x5bdb('0x54')]!==_0x5bdb('0x55')){logger[_0x5bdb('0x15')](_0x5bdb('0x56'),_0x5bdb('0x45'));_0x2b5cdf[_0x5bdb('0x46')]=util[_0x5bdb('0x1c')](_0x5bdb('0x47'),_0x1129b0['serverUrl'],_0x2b5cdf[_0x5bdb('0x48')],md5(_0x2b5cdf[_0x5bdb('0x48')]));}return getConnection(_0x1129b0)[_0x5bdb('0x20')](function(_0x124de5){_0x2298df=_0x124de5;return getUser(_0x1129b0,_0x536ce0['email'],_0x2298df);})[_0x5bdb('0x20')](function(_0x4e9bc1){_0x63974=_0x4e9bc1;logger[_0x5bdb('0x15')]('The\x20User\x20ID\x20is:',_0x63974['id']);return getEndUser(_0x1129b0,_0x2b5cdf[_0x5bdb('0x57')],_0x2b5cdf['destcalleridnum'],_0x2298df);})[_0x5bdb('0x20')](function(_0x16c319){_0x209a0f=_0x16c319;logger[_0x5bdb('0x15')](_0x5bdb('0x58'),_0x209a0f['id']);return createTicket(_0x1129b0,_0x63974,_0x209a0f,_0x186aba,_0x2b5cdf,_0x186aba[_0x5bdb('0x4d')],_0x2298df);})['then'](function(_0x3823fb){_0x2cff9a=_0x3823fb;logger['info'](_0x5bdb('0x59'));logger['info'](_0x5bdb('0x4e'),_0x2cff9a['id']);var _0x5f302e=util[_0x5bdb('0x1c')](_0x5bdb('0x4f'),_0x1129b0[_0x5bdb('0x2b')],_['split'](_0x2cff9a['id'],'x')[0x1]);logger[_0x5bdb('0x15')](_0x5bdb('0x56'),_0x5bdb('0x5a'));emit(util[_0x5bdb('0x1c')]('user:%s',_0x536ce0[_0x5bdb('0x13')]),_0x5bdb('0x5b'),{'uri':_0x5f302e});})[_0x5bdb('0x27')](function(_0x57fbe4){logger[_0x5bdb('0x26')](_0x5bdb('0x56'),JSON[_0x5bdb('0x25')](_0x57fbe4));});};exports['unmanaged']=function(_0x5282f2,_0x46c9bc,_0x2c6ed3,_0x4dbf1d,_0x17aa80,_0x43c78c){var _0x3c5a82,_0xd8a7a7,_0x109e03,_0x5390b6;_0x43c78c[_0x5bdb('0x2b')]=intUtil[_0x5bdb('0x42')](_0x43c78c[_0x5bdb('0x2b')]);_0x43c78c[_0x5bdb('0x53')]=intUtil['stripTrailingSlash'](_0x43c78c[_0x5bdb('0x53')]);if(_0x17aa80&&_0x17aa80[_0x5bdb('0x43')]){logger[_0x5bdb('0x15')]('['+_0x46c9bc[_0x5bdb('0x5c')][_0x5bdb('0x5d')]()+']',_0x5bdb('0x45'));_0x46c9bc[_0x5bdb('0x46')]=util['format'](_0x5bdb('0x47'),_0x43c78c[_0x5bdb('0x53')],_0x46c9bc['uniqueid'],md5(_0x46c9bc[_0x5bdb('0x48')]));}else{_0x46c9bc[_0x5bdb('0x46')]='';}return getConnection(_0x43c78c)[_0x5bdb('0x20')](function(_0xb9bade){_0x5390b6=_0xb9bade;return getUser(_0x43c78c,'',_0x5390b6);})[_0x5bdb('0x20')](function(_0x4351f8){_0x3c5a82=_0x4351f8;logger[_0x5bdb('0x15')](_0x5bdb('0x4a'),_0x3c5a82['id']);return getEndUser(_0x43c78c,_0x46c9bc[_0x5bdb('0x4b')],_0x46c9bc['calleridnum'],_0x5390b6);})[_0x5bdb('0x20')](function(_0x3d1339){_0xd8a7a7=_0x3d1339;logger[_0x5bdb('0x15')](_0x5bdb('0x58'),_0xd8a7a7['id']);return createTicket(_0x43c78c,_0x3c5a82,_0xd8a7a7,_0x2c6ed3,_0x46c9bc,_0x2c6ed3[_0x5bdb('0x4d')],_0x5390b6);})[_0x5bdb('0x20')](function(_0x449566){_0x109e03=_0x449566;logger['info'](_0x5bdb('0x59'));logger[_0x5bdb('0x15')]('The\x20Ticket\x20ID\x20is:',_0x109e03['id']);})[_0x5bdb('0x27')](function(_0x2cf6e1){logger[_0x5bdb('0x26')]('['+_0x46c9bc['lastevent'][_0x5bdb('0x5d')]()+']',JSON[_0x5bdb('0x25')](_0x2cf6e1));});}; \ 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 3633ef1..32dbd39 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 _0x1d2d=['Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','results','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','nameField','customField','toLowerCase','content','type','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:'];(function(_0xe40b85,_0x570ae2){var _0x4bc3c7=function(_0x484f0a){while(--_0x484f0a){_0xe40b85['push'](_0xe40b85['shift']());}};_0x4bc3c7(++_0x570ae2);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5b4e13,_0x2da6b2){_0x5b4e13=_0x5b4e13-0x0;var _0x26290a=_0x1d2d[_0x5b4e13];return _0x26290a;};'use strict';var _=require(_0xd1d2('0x0'));var rp=require(_0xd1d2('0x1'));var md5=require(_0xd1d2('0x2'));var util=require(_0xd1d2('0x3'));var Redis=require(_0xd1d2('0x4'));var intUtil=require('./util');var config=require(_0xd1d2('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0xd1d2('0x6')]=_[_0xd1d2('0x7')](config[_0xd1d2('0x6')],{'host':_0xd1d2('0x8'),'port':0x18eb});var io=require(_0xd1d2('0x9'))(new Redis(config[_0xd1d2('0x6')]));function emit(_0x55be7a,_0x1eaf41,_0x21bc28){io['to'](_0x55be7a)[_0xd1d2('0xa')](_0x1eaf41,_0x21bc28);}var headers={'Content-Type':_0xd1d2('0xb'),'Accept':_0xd1d2('0xb')};function getTicket(_0x59e484,_0x1dc683,_0x1a6ca4,_0x3ac8c4,_0x353f9b){logger[_0xd1d2('0xc')](_0xd1d2('0xd'));return request({'uri':util[_0xd1d2('0xe')]('%s/tickets.json',_0x59e484[_0xd1d2('0xf')]),'method':_0xd1d2('0x10'),'body':{'ticket':_[_0xd1d2('0x11')]({'requester_id':_0x1a6ca4['id'],'submitter_id':_0x1dc683?_0x1dc683['id']:undefined,'assignee_id':_0x1dc683?_0x1dc683['id']:undefined,'tags':getTags(_0x3ac8c4[_0xd1d2('0x12')],_0xd1d2('0x13')),'subject':intUtil[_0xd1d2('0x14')](_0x3ac8c4[_0xd1d2('0x15')],_0x353f9b,'\x20'),'description':intUtil[_0xd1d2('0x14')](_0x3ac8c4[_0xd1d2('0x16')],_0x353f9b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd1d2('0x14')](_0x3ac8c4['Descriptions'],_0x353f9b,'\x0a')}},getCustomFields(_0x3ac8c4[_0xd1d2('0x17')],_0x353f9b))}})[_0xd1d2('0x18')](function(_0x3476f8){logger['info'](_0xd1d2('0x19'));return _0x3476f8[_0xd1d2('0x1a')];});}function getUser(_0x208425,_0x2f4cf9){if(intUtil[_0xd1d2('0x1b')](_0x2f4cf9)){logger[_0xd1d2('0xc')](_0xd1d2('0x1c'),_0x2f4cf9);return request({'uri':util['format']('%s/search.json',_0x208425[_0xd1d2('0xf')]),'qs':{'query':util['format'](_0xd1d2('0x1d'),_0x2f4cf9)}})[_0xd1d2('0x18')](function(_0x3102c4){if(_0x3102c4[_0xd1d2('0x1e')]){logger['info']('Agent\x20found!');return _[_0xd1d2('0x1f')](_0x3102c4['results'],{'email':_0x2f4cf9,'role':'agent'});}else{logger[_0xd1d2('0xc')](_0xd1d2('0x20'));return request({'uri':util[_0xd1d2('0xe')](_0xd1d2('0x21'),_0x208425['remoteUri'])})[_0xd1d2('0x18')](function(_0xbb4d27){logger[_0xd1d2('0xc')]('Admin\x20account\x20selected.');return _0xbb4d27['user'];});}});}else{logger[_0xd1d2('0xc')](_0xd1d2('0x20'));return request({'uri':util[_0xd1d2('0xe')](_0xd1d2('0x21'),_0x208425[_0xd1d2('0xf')])})[_0xd1d2('0x18')](function(_0xe53fcd){logger['info'](_0xd1d2('0x22'));return _0xe53fcd[_0xd1d2('0x23')];});}}function getEndUser(_0x41330f,_0x2e1709,_0x5d3ee1){logger[_0xd1d2('0xc')](_0xd1d2('0x24'),_0x5d3ee1);return request({'uri':util[_0xd1d2('0xe')](_0xd1d2('0x25'),_0x41330f[_0xd1d2('0xf')]),'qs':{'query':util[_0xd1d2('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x5d3ee1)}})['then'](function(_0x133c6c){var _0x442375;if(_0x133c6c[_0xd1d2('0x26')][_0xd1d2('0x27')]){_0x133c6c[_0xd1d2('0x26')]=_['filter'](_0x133c6c[_0xd1d2('0x26')],{'suspended':![],'role':_0xd1d2('0x28')});if(_0x133c6c[_0xd1d2('0x26')]['length']){_0x442375=_[_0xd1d2('0x29')](_0x133c6c[_0xd1d2('0x26')]);}}if(_0x442375){logger[_0xd1d2('0xc')]('Enduser\x20found!');return _0x442375;}else{logger[_0xd1d2('0xc')](_0xd1d2('0x2a'));return request({'uri':util[_0xd1d2('0xe')](_0xd1d2('0x2b'),_0x41330f[_0xd1d2('0xf')]),'method':_0xd1d2('0x10'),'body':{'user':{'role':_0xd1d2('0x28'),'name':util[_0xd1d2('0xe')](_0xd1d2('0x2c'),_0x2e1709||_0x5d3ee1),'phone':_0x5d3ee1}}})[_0xd1d2('0x18')](function(_0x28d062){logger[_0xd1d2('0xc')](_0xd1d2('0x2d'));return _0x28d062[_0xd1d2('0x23')];});}});}function getAuth(_0x372481){var _0xb6ad51;if(_0x372481[_0xd1d2('0x2e')]===_0xd1d2('0x2f')){_0xb6ad51=util['format'](_0xd1d2('0x30'),_0x372481[_0xd1d2('0x31')],_0x372481[_0xd1d2('0x2f')]);}else if(_0x372481['authType']===_0xd1d2('0x32')){_0xb6ad51=util['format']('%s/token:%s',_0x372481[_0xd1d2('0x31')],_0x372481[_0xd1d2('0x32')]);}return util[_0xd1d2('0xe')](_0xd1d2('0x33'),new Buffer(_0xb6ad51)[_0xd1d2('0x34')](_0xd1d2('0x35')));}function request(_0x56f48e){logger[_0xd1d2('0x36')](_0xd1d2('0x37'),JSON['stringify'](_0x56f48e));return rp(_[_0xd1d2('0x7')](_0x56f48e,{'method':_0xd1d2('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x3281de,_0x2f55a1){var _0x4adb17=[];if(_0x3281de&&_0x3281de['length']>0x0){_0x4adb17=_[_0xd1d2('0x39')](_0x3281de,_0x2f55a1);}return _0x4adb17;}function getCustomFields(_0x54fbbb,_0x55b3d4){var _0x55b1a4=[];var _0x43e70f={'custom_fields':[]};if(_0x54fbbb['length']>0x0){_[_0xd1d2('0x3a')](_0x54fbbb,function(_0x4e7640){if(_0x4e7640['type']==='string'&&_0x4e7640[_0xd1d2('0x3b')]&&!_0x4e7640[_0xd1d2('0x3c')]){_0x43e70f[_0x4e7640[_0xd1d2('0x3b')][_0xd1d2('0x3d')]()]=_0x4e7640[_0xd1d2('0x3e')][_0xd1d2('0x34')]();}else if(_0x4e7640[_0xd1d2('0x3f')]===_0xd1d2('0x40')&&_0x4e7640[_0xd1d2('0x41')]&&_0x4e7640[_0xd1d2('0x3c')]){_0x43e70f[_0xd1d2('0x42')][_0xd1d2('0x43')]({'id':_0x4e7640[_0xd1d2('0x41')],'value':_0x4e7640[_0xd1d2('0x3e')]['toString']()});}else if(_0x4e7640['type']===_0xd1d2('0x44')&&_0x4e7640[_0xd1d2('0x45')]&&_0x4e7640[_0xd1d2('0x41')]&&_0x4e7640['customField']){_0x55b3d4[_0x4e7640['variableName']]&&_0x43e70f[_0xd1d2('0x42')][_0xd1d2('0x43')]({'id':_0x4e7640['idField'],'value':_0x55b3d4[_0x4e7640[_0xd1d2('0x45')]]['toString']()});}else if(_0x4e7640['type']===_0xd1d2('0x46')&&_0x4e7640['Variable']&&_0x4e7640['Variable'][_0xd1d2('0x13')]&&_0x4e7640[_0xd1d2('0x41')]&&_0x4e7640[_0xd1d2('0x3c')]){_0x55b3d4[_0x4e7640['Variable'][_0xd1d2('0x13')][_0xd1d2('0x3d')]()]&&_0x43e70f[_0xd1d2('0x42')][_0xd1d2('0x43')]({'id':_0x4e7640['idField'],'value':_0x55b3d4[_0x4e7640[_0xd1d2('0x47')][_0xd1d2('0x13')]['toLowerCase']()][_0xd1d2('0x34')]()});}});}return _0x43e70f;}exports['queue']=function(_0x3e8aa5,_0xd56adb,_0xe8d484,_0xed5351,_0x1fd2fc,_0x52bf9a){var _0x51e82a,_0x422fb9;_0x52bf9a[_0xd1d2('0xf')]=intUtil['stripTrailingSlash'](_0x52bf9a[_0xd1d2('0xf')]);_0x52bf9a[_0xd1d2('0x48')]=intUtil[_0xd1d2('0x49')](_0x52bf9a[_0xd1d2('0x48')]);if(_0x1fd2fc&&_0x1fd2fc[_0xd1d2('0x4a')]){logger[_0xd1d2('0xc')](_0xd1d2('0x4b'),'Recording\x20is\x20enabled!');_0xd56adb[_0xd1d2('0x4c')]=util[_0xd1d2('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52bf9a[_0xd1d2('0x48')],_0xd56adb[_0xd1d2('0x4d')],md5(_0xd56adb['uniqueid']));}else{_0xd56adb['recordingURL']='';}headers[_0xd1d2('0x4e')]=getAuth(_0x52bf9a);return getUser(_0x52bf9a,_0xed5351[_0xd1d2('0x4f')])['then'](function(_0x21fdfb){_0x51e82a=_0x21fdfb;logger[_0xd1d2('0xc')](_0xd1d2('0x50'),_0x51e82a['id']);return getEndUser(_0x52bf9a,_0xd56adb[_0xd1d2('0x51')],_0xd56adb[_0xd1d2('0x52')]);})['then'](function(_0x4dd22e){_0x422fb9=_0x4dd22e;logger[_0xd1d2('0xc')]('The\x20Enduser\x20ID\x20is:',_0x422fb9['id']);return getTicket(_0x52bf9a,_0x51e82a,_0x422fb9,_0xe8d484,_0xd56adb);})[_0xd1d2('0x18')](function(_0xcd4b70){if(_0xcd4b70){logger['info'](_0xd1d2('0x53'),_0xcd4b70['id']);switch(_0x52bf9a[_0xd1d2('0x3f')]){case'integrationTab':logger['info'](_0xd1d2('0x4b'),_0xd1d2('0x54'));return request({'uri':util[_0xd1d2('0xe')](_0xd1d2('0x55'),_0x52bf9a[_0xd1d2('0xf')],_0x51e82a['id'],_0xcd4b70['id']),'method':_0xd1d2('0x10')});case _0xd1d2('0x56'):logger[_0xd1d2('0xc')](_0xd1d2('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd1d2('0xe')]('user:%s',_0xed5351['name']),_0xd1d2('0x57'),{'uri':util[_0xd1d2('0xe')](_0xd1d2('0x58'),_0x52bf9a[_0xd1d2('0xf')],_0xcd4b70['id'])});break;default:logger[_0xd1d2('0x59')](_0xd1d2('0x4b'),_0xd1d2('0x5a'));}}})[_0xd1d2('0x5b')](function(_0x41fbe4){logger[_0xd1d2('0x59')](_0xd1d2('0x5c'),util[_0xd1d2('0x5d')](_0x41fbe4,{'showHidden':!![],'depth':null}));});};exports[_0xd1d2('0x5e')]=function(_0x5b2a26,_0x4a5050,_0x367f3c,_0xd5323d,_0x1562ad,_0x21f690,_0x344b6f){var _0x1d1d31,_0x306e2b;_0x21f690[_0xd1d2('0xf')]=intUtil[_0xd1d2('0x49')](_0x21f690[_0xd1d2('0xf')]);_0x21f690[_0xd1d2('0x48')]=intUtil['stripTrailingSlash'](_0x21f690['serverUrl']);if(_0x344b6f&&_0x344b6f[_0xd1d2('0x5f')]&&_0x344b6f[_0xd1d2('0x5f')]!==_0xd1d2('0x60')){logger[_0xd1d2('0xc')]('[OUTBOUND]',_0xd1d2('0x61'));_0x4a5050[_0xd1d2('0x4c')]=util[_0xd1d2('0xe')](_0xd1d2('0x62'),_0x21f690[_0xd1d2('0x48')],_0x4a5050[_0xd1d2('0x4d')],md5(_0x4a5050[_0xd1d2('0x4d')]));}headers['Authorization']=getAuth(_0x21f690);return getUser(_0x21f690,_0xd5323d[_0xd1d2('0x4f')])[_0xd1d2('0x18')](function(_0x1d8788){_0x1d1d31=_0x1d8788;logger['info']('The\x20User\x20ID\x20is:',_0x1d1d31['id']);return getEndUser(_0x21f690,_0x4a5050[_0xd1d2('0x63')],_0x4a5050[_0xd1d2('0x64')]);})[_0xd1d2('0x18')](function(_0xe40d1d){_0x306e2b=_0xe40d1d;logger['info'](_0xd1d2('0x65'),_0x306e2b['id']);return getTicket(_0x21f690,_0x1d1d31,_0x306e2b,_0x367f3c,_0x4a5050);})[_0xd1d2('0x18')](function(_0x37cd06){if(_0x37cd06){logger['info'](_0xd1d2('0x53'),_0x37cd06['id']);switch(_0x21f690[_0xd1d2('0x3f')]){case'integrationTab':logger[_0xd1d2('0xc')](_0xd1d2('0x66'),_0xd1d2('0x54'));return request({'uri':util[_0xd1d2('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x21f690[_0xd1d2('0xf')],_0x1d1d31['id'],_0x37cd06['id']),'method':_0xd1d2('0x10')});case _0xd1d2('0x56'):logger[_0xd1d2('0xc')](_0xd1d2('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0xd5323d['name']),'trigger:browser:url',{'uri':util[_0xd1d2('0xe')](_0xd1d2('0x58'),_0x21f690[_0xd1d2('0xf')],_0x37cd06['id'])});break;default:logger['error'](_0xd1d2('0x66'),_0xd1d2('0x5a'));}}})[_0xd1d2('0x5b')](function(_0x580d83){logger[_0xd1d2('0x59')](_0xd1d2('0x67'),util[_0xd1d2('0x5d')](_0x580d83,{'showHidden':!![],'depth':null}));});};exports[_0xd1d2('0x68')]=function(_0x43b43c,_0x1101a3,_0x4a83f8,_0x2664db,_0x1c3c36,_0x516a57){var _0x530335,_0x21bfd4;_0x516a57[_0xd1d2('0xf')]=intUtil[_0xd1d2('0x49')](_0x516a57[_0xd1d2('0xf')]);_0x516a57['serverUrl']=intUtil[_0xd1d2('0x49')](_0x516a57[_0xd1d2('0x48')]);if(_0x1c3c36&&_0x1c3c36[_0xd1d2('0x4a')]){logger[_0xd1d2('0xc')]('['+_0x1101a3['lastevent'][_0xd1d2('0x69')]()+']',_0xd1d2('0x61'));_0x1101a3[_0xd1d2('0x4c')]=util['format'](_0xd1d2('0x62'),_0x516a57[_0xd1d2('0x48')],_0x1101a3['uniqueid'],md5(_0x1101a3[_0xd1d2('0x4d')]));}else{_0x1101a3[_0xd1d2('0x4c')]='';}headers[_0xd1d2('0x4e')]=getAuth(_0x516a57);return getUser(_0x516a57)[_0xd1d2('0x18')](function(_0x394bab){_0x530335=_0x394bab;logger['info'](_0xd1d2('0x50'),_0x530335['id']);return getEndUser(_0x516a57,_0x1101a3['calleridname'],_0x1101a3['calleridnum']);})['then'](function(_0x502432){_0x21bfd4=_0x502432;logger[_0xd1d2('0xc')]('The\x20Enduser\x20ID\x20is:',_0x21bfd4['id']);return getTicket(_0x516a57,_0x530335,_0x21bfd4,_0x4a83f8,_0x1101a3);})[_0xd1d2('0x18')](function(_0x52dd76){if(_0x52dd76){logger[_0xd1d2('0xc')](_0xd1d2('0x53'),_0x52dd76['id']);}})[_0xd1d2('0x5b')](function(_0x30689e){logger[_0xd1d2('0x59')]('['+_0x1101a3[_0xd1d2('0x6a')]['toUpperCase']()+']'+_0xd1d2('0x6b'),util[_0xd1d2('0x5d')](_0x30689e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x574d=['Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','customField','toLowerCase','type','push','variable','variableName','idField','custom_fields','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','count'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x574d,0xc0));var _0xd574=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x574d[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xd574('0x0'));var rp=require(_0xd574('0x1'));var md5=require(_0xd574('0x2'));var util=require(_0xd574('0x3'));var Redis=require(_0xd574('0x4'));var intUtil=require(_0xd574('0x5'));var config=require(_0xd574('0x6'));var logger=require('../../../../config/logger')(_0xd574('0x7'));config[_0xd574('0x8')]=_[_0xd574('0x9')](config[_0xd574('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xd574('0xa'))(new Redis(config[_0xd574('0x8')]));function emit(_0x3ce54f,_0x1558b3,_0x3a1e54){io['to'](_0x3ce54f)[_0xd574('0xb')](_0x1558b3,_0x3a1e54);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x4306f7,_0x11ef21,_0x2caf61,_0x1aa38f,_0x2931ac){logger[_0xd574('0xc')](_0xd574('0xd'));return request({'uri':util['format'](_0xd574('0xe'),_0x4306f7[_0xd574('0xf')]),'method':_0xd574('0x10'),'body':{'ticket':_[_0xd574('0x11')]({'requester_id':_0x2caf61['id'],'submitter_id':_0x11ef21?_0x11ef21['id']:undefined,'assignee_id':_0x11ef21?_0x11ef21['id']:undefined,'tags':getTags(_0x1aa38f[_0xd574('0x12')],_0xd574('0x13')),'subject':intUtil[_0xd574('0x14')](_0x1aa38f[_0xd574('0x15')],_0x2931ac,'\x20'),'description':intUtil[_0xd574('0x14')](_0x1aa38f[_0xd574('0x16')],_0x2931ac,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd574('0x14')](_0x1aa38f[_0xd574('0x16')],_0x2931ac,'\x0a')}},getCustomFields(_0x1aa38f['Fields'],_0x2931ac))}})[_0xd574('0x17')](function(_0x147cdf){logger[_0xd574('0xc')](_0xd574('0x18'));return _0x147cdf[_0xd574('0x19')];});}function getUser(_0x341463,_0x137917){if(intUtil[_0xd574('0x1a')](_0x137917)){logger['info']('Getting\x20agent\x20with\x20email',_0x137917);return request({'uri':util[_0xd574('0x1b')](_0xd574('0x1c'),_0x341463[_0xd574('0xf')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x137917)}})[_0xd574('0x17')](function(_0x1ba34c){if(_0x1ba34c[_0xd574('0x1d')]){logger[_0xd574('0xc')](_0xd574('0x1e'));return _[_0xd574('0x1f')](_0x1ba34c[_0xd574('0x20')],{'email':_0x137917,'role':_0xd574('0x21')});}else{logger[_0xd574('0xc')](_0xd574('0x22'));return request({'uri':util[_0xd574('0x1b')]('%s/users/me.json',_0x341463[_0xd574('0xf')])})[_0xd574('0x17')](function(_0x481564){logger[_0xd574('0xc')]('Admin\x20account\x20selected.');return _0x481564[_0xd574('0x23')];});}});}else{logger[_0xd574('0xc')](_0xd574('0x22'));return request({'uri':util[_0xd574('0x1b')](_0xd574('0x24'),_0x341463[_0xd574('0xf')])})[_0xd574('0x17')](function(_0x37d229){logger[_0xd574('0xc')](_0xd574('0x25'));return _0x37d229[_0xd574('0x23')];});}}function getEndUser(_0x44ddae,_0x3e0501,_0x39f5be){logger['info'](_0xd574('0x26'),_0x39f5be);return request({'uri':util['format'](_0xd574('0x1c'),_0x44ddae['remoteUri']),'qs':{'query':util['format'](_0xd574('0x27'),_0x39f5be)}})[_0xd574('0x17')](function(_0x2153d0){var _0x5a36cc;if(_0x2153d0[_0xd574('0x20')][_0xd574('0x28')]){_0x2153d0[_0xd574('0x20')]=_[_0xd574('0x29')](_0x2153d0['results'],{'suspended':![],'role':'end-user'});if(_0x2153d0[_0xd574('0x20')][_0xd574('0x28')]){_0x5a36cc=_[_0xd574('0x2a')](_0x2153d0[_0xd574('0x20')]);}}if(_0x5a36cc){logger[_0xd574('0xc')](_0xd574('0x2b'));return _0x5a36cc;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd574('0x1b')](_0xd574('0x2c'),_0x44ddae[_0xd574('0xf')]),'method':_0xd574('0x10'),'body':{'user':{'role':_0xd574('0x2d'),'name':util[_0xd574('0x1b')](_0xd574('0x2e'),_0x3e0501||_0x39f5be),'phone':_0x39f5be}}})[_0xd574('0x17')](function(_0x5d23f2){logger['info'](_0xd574('0x2f'));return _0x5d23f2[_0xd574('0x23')];});}});}function getAuth(_0xd4b730){var _0x43e402;if(_0xd4b730[_0xd574('0x30')]==='password'){_0x43e402=util[_0xd574('0x1b')](_0xd574('0x31'),_0xd4b730[_0xd574('0x32')],_0xd4b730[_0xd574('0x33')]);}else if(_0xd4b730[_0xd574('0x30')]===_0xd574('0x34')){_0x43e402=util[_0xd574('0x1b')]('%s/token:%s',_0xd4b730[_0xd574('0x32')],_0xd4b730['token']);}return util[_0xd574('0x1b')](_0xd574('0x35'),new Buffer(_0x43e402)[_0xd574('0x36')](_0xd574('0x37')));}function request(_0x45e3d0){logger[_0xd574('0x38')](_0xd574('0x39'),JSON[_0xd574('0x3a')](_0x45e3d0));return rp(_[_0xd574('0x9')](_0x45e3d0,{'method':_0xd574('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x1cfad2,_0x4f3cfc){var _0x2b4cbf=[];if(_0x1cfad2&&_0x1cfad2[_0xd574('0x28')]>0x0){_0x2b4cbf=_[_0xd574('0x3c')](_0x1cfad2,_0x4f3cfc);}return _0x2b4cbf;}function getCustomFields(_0x538721,_0x19fcc6){var _0x349e84=[];var _0x2ee4a8={'custom_fields':[]};if(_0x538721[_0xd574('0x28')]>0x0){_[_0xd574('0x3d')](_0x538721,function(_0x445068){if(_0x445068['type']===_0xd574('0x3e')&&_0x445068[_0xd574('0x3f')]&&!_0x445068[_0xd574('0x40')]){_0x2ee4a8[_0x445068[_0xd574('0x3f')][_0xd574('0x41')]()]=_0x445068['content'][_0xd574('0x36')]();}else if(_0x445068[_0xd574('0x42')]===_0xd574('0x3e')&&_0x445068['idField']&&_0x445068['customField']){_0x2ee4a8['custom_fields'][_0xd574('0x43')]({'id':_0x445068['idField'],'value':_0x445068['content']['toString']()});}else if(_0x445068[_0xd574('0x42')]===_0xd574('0x44')&&_0x445068[_0xd574('0x45')]&&_0x445068[_0xd574('0x46')]&&_0x445068['customField']){_0x19fcc6[_0x445068[_0xd574('0x45')]]&&_0x2ee4a8[_0xd574('0x47')][_0xd574('0x43')]({'id':_0x445068[_0xd574('0x46')],'value':_0x19fcc6[_0x445068['variableName']][_0xd574('0x36')]()});}else if(_0x445068['type']===_0xd574('0x48')&&_0x445068[_0xd574('0x49')]&&_0x445068[_0xd574('0x49')][_0xd574('0x13')]&&_0x445068[_0xd574('0x46')]&&_0x445068[_0xd574('0x40')]){_0x19fcc6[_0x445068[_0xd574('0x49')][_0xd574('0x13')][_0xd574('0x41')]()]&&_0x2ee4a8[_0xd574('0x47')][_0xd574('0x43')]({'id':_0x445068[_0xd574('0x46')],'value':_0x19fcc6[_0x445068[_0xd574('0x49')]['name'][_0xd574('0x41')]()]['toString']()});}});}return _0x2ee4a8;}exports['queue']=function(_0x6039e6,_0x4757a3,_0x5543fc,_0x1a1198,_0x2e4e53,_0x3cb9b9){var _0x4b756a,_0xea1d6f;_0x3cb9b9[_0xd574('0xf')]=intUtil[_0xd574('0x4a')](_0x3cb9b9[_0xd574('0xf')]);_0x3cb9b9[_0xd574('0x4b')]=intUtil[_0xd574('0x4a')](_0x3cb9b9['serverUrl']);if(_0x2e4e53&&_0x2e4e53[_0xd574('0x4c')]){logger[_0xd574('0xc')](_0xd574('0x4d'),_0xd574('0x4e'));_0x4757a3[_0xd574('0x4f')]=util[_0xd574('0x1b')](_0xd574('0x50'),_0x3cb9b9[_0xd574('0x4b')],_0x4757a3[_0xd574('0x51')],md5(_0x4757a3[_0xd574('0x51')]));}else{_0x4757a3[_0xd574('0x4f')]='';}headers[_0xd574('0x52')]=getAuth(_0x3cb9b9);return getUser(_0x3cb9b9,_0x1a1198[_0xd574('0x53')])[_0xd574('0x17')](function(_0x2ee2d7){_0x4b756a=_0x2ee2d7;logger[_0xd574('0xc')]('The\x20User\x20ID\x20is:',_0x4b756a['id']);return getEndUser(_0x3cb9b9,_0x4757a3[_0xd574('0x54')],_0x4757a3[_0xd574('0x55')]);})['then'](function(_0x21b50b){_0xea1d6f=_0x21b50b;logger[_0xd574('0xc')](_0xd574('0x56'),_0xea1d6f['id']);return getTicket(_0x3cb9b9,_0x4b756a,_0xea1d6f,_0x5543fc,_0x4757a3);})[_0xd574('0x17')](function(_0x2fcf85){if(_0x2fcf85){logger[_0xd574('0xc')](_0xd574('0x57'),_0x2fcf85['id']);switch(_0x3cb9b9[_0xd574('0x42')]){case _0xd574('0x58'):logger[_0xd574('0xc')]('[QUEUE]',_0xd574('0x59'));return request({'uri':util[_0xd574('0x1b')](_0xd574('0x5a'),_0x3cb9b9[_0xd574('0xf')],_0x4b756a['id'],_0x2fcf85['id']),'method':_0xd574('0x10')});case _0xd574('0x5b'):logger[_0xd574('0xc')](_0xd574('0x4d'),_0xd574('0x5c'));emit(util[_0xd574('0x1b')](_0xd574('0x5d'),_0x1a1198[_0xd574('0x13')]),_0xd574('0x5e'),{'uri':util[_0xd574('0x1b')](_0xd574('0x5f'),_0x3cb9b9[_0xd574('0xf')],_0x2fcf85['id'])});break;default:logger[_0xd574('0x60')](_0xd574('0x4d'),_0xd574('0x61'));}}})[_0xd574('0x62')](function(_0x33ca39){logger[_0xd574('0x60')](_0xd574('0x63'),util[_0xd574('0x64')](_0x33ca39,{'showHidden':!![],'depth':null}));});};exports[_0xd574('0x65')]=function(_0x5e92d3,_0x21f0f7,_0x1de788,_0x2ec166,_0xd1a7e3,_0x216e7e,_0x81ae22){var _0x28af8c,_0x1c8981;_0x216e7e[_0xd574('0xf')]=intUtil['stripTrailingSlash'](_0x216e7e['remoteUri']);_0x216e7e[_0xd574('0x4b')]=intUtil[_0xd574('0x4a')](_0x216e7e['serverUrl']);if(_0x81ae22&&_0x81ae22[_0xd574('0x66')]&&_0x81ae22[_0xd574('0x66')]!==_0xd574('0x67')){logger[_0xd574('0xc')]('[OUTBOUND]',_0xd574('0x4e'));_0x21f0f7[_0xd574('0x4f')]=util[_0xd574('0x1b')](_0xd574('0x50'),_0x216e7e[_0xd574('0x4b')],_0x21f0f7[_0xd574('0x51')],md5(_0x21f0f7['uniqueid']));}headers['Authorization']=getAuth(_0x216e7e);return getUser(_0x216e7e,_0x2ec166[_0xd574('0x53')])[_0xd574('0x17')](function(_0x483490){_0x28af8c=_0x483490;logger[_0xd574('0xc')]('The\x20User\x20ID\x20is:',_0x28af8c['id']);return getEndUser(_0x216e7e,_0x21f0f7['destcalleridname'],_0x21f0f7[_0xd574('0x68')]);})[_0xd574('0x17')](function(_0x566b7c){_0x1c8981=_0x566b7c;logger['info'](_0xd574('0x56'),_0x1c8981['id']);return getTicket(_0x216e7e,_0x28af8c,_0x1c8981,_0x1de788,_0x21f0f7);})[_0xd574('0x17')](function(_0x304b92){if(_0x304b92){logger[_0xd574('0xc')](_0xd574('0x57'),_0x304b92['id']);switch(_0x216e7e['type']){case _0xd574('0x58'):logger[_0xd574('0xc')]('[OUTBOUND]',_0xd574('0x59'));return request({'uri':util[_0xd574('0x1b')](_0xd574('0x5a'),_0x216e7e[_0xd574('0xf')],_0x28af8c['id'],_0x304b92['id']),'method':'POST'});case _0xd574('0x5b'):logger[_0xd574('0xc')]('[OUTBOUND]',_0xd574('0x5c'));emit(util[_0xd574('0x1b')](_0xd574('0x5d'),_0x2ec166['name']),_0xd574('0x5e'),{'uri':util['format'](_0xd574('0x5f'),_0x216e7e[_0xd574('0xf')],_0x304b92['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd574('0x62')](function(_0x62dbb8){logger[_0xd574('0x60')](_0xd574('0x69'),util['inspect'](_0x62dbb8,{'showHidden':!![],'depth':null}));});};exports[_0xd574('0x6a')]=function(_0xc38aae,_0x13b40b,_0x22775a,_0x28eaa2,_0x446f4d,_0x7d3569){var _0x121ddf,_0x452d87;_0x7d3569['remoteUri']=intUtil['stripTrailingSlash'](_0x7d3569[_0xd574('0xf')]);_0x7d3569[_0xd574('0x4b')]=intUtil[_0xd574('0x4a')](_0x7d3569['serverUrl']);if(_0x446f4d&&_0x446f4d['monitor_format']){logger['info']('['+_0x13b40b[_0xd574('0x6b')][_0xd574('0x6c')]()+']',_0xd574('0x4e'));_0x13b40b['recordingURL']=util[_0xd574('0x1b')](_0xd574('0x50'),_0x7d3569[_0xd574('0x4b')],_0x13b40b[_0xd574('0x51')],md5(_0x13b40b[_0xd574('0x51')]));}else{_0x13b40b['recordingURL']='';}headers[_0xd574('0x52')]=getAuth(_0x7d3569);return getUser(_0x7d3569)[_0xd574('0x17')](function(_0x44808f){_0x121ddf=_0x44808f;logger[_0xd574('0xc')](_0xd574('0x6d'),_0x121ddf['id']);return getEndUser(_0x7d3569,_0x13b40b[_0xd574('0x54')],_0x13b40b[_0xd574('0x55')]);})[_0xd574('0x17')](function(_0x3c9943){_0x452d87=_0x3c9943;logger[_0xd574('0xc')](_0xd574('0x56'),_0x452d87['id']);return getTicket(_0x7d3569,_0x121ddf,_0x452d87,_0x22775a,_0x13b40b);})[_0xd574('0x17')](function(_0xcf4f9e){if(_0xcf4f9e){logger[_0xd574('0xc')]('The\x20Ticket\x20ID\x20is:',_0xcf4f9e['id']);}})['catch'](function(_0x1ed86b){logger[_0xd574('0x60')]('['+_0x13b40b[_0xd574('0x6b')][_0xd574('0x6c')]()+']'+_0xd574('0x6e'),util['inspect'](_0x1ed86b,{'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 e07ba98..e70b240 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 _0xf485=['YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','/crm/v2/Calls','Call\x20created!','details','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','destcalleridnum','https://crm.','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','zoho','defaults','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','variable','variableName','toString','name','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','startCase','role','first_name','last_name','data','code','SUCCESS','moduleCreate','Error:\x20','log','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','nothing','lead','Leads','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime'];(function(_0x23f075,_0x360bb3){var _0x459973=function(_0x1c8975){while(--_0x1c8975){_0x23f075['push'](_0x23f075['shift']());}};_0x459973(++_0x360bb3);}(_0xf485,0xd1));var _0x5f48=function(_0x5d5ec4,_0x164e2b){_0x5d5ec4=_0x5d5ec4-0x0;var _0x404ca1=_0xf485[_0x5d5ec4];return _0x404ca1;};'use strict';var _=require(_0x5f48('0x0'));var rp=require(_0x5f48('0x1'));var md5=require(_0x5f48('0x2'));var util=require(_0x5f48('0x3'));var intUtil=require(_0x5f48('0x4'));var moment=require(_0x5f48('0x5'));var Redis=require('ioredis');var BPromise=require(_0x5f48('0x6'));var config=require(_0x5f48('0x7'));var logger=require('../../../../config/logger')(_0x5f48('0x8'));config['redis']=_[_0x5f48('0x9')](config['redis'],{'host':_0x5f48('0xa'),'port':0x18eb});var io=require(_0x5f48('0xb'))(new Redis(config[_0x5f48('0xc')]));function emit(_0x5866e5,_0x3fb7e5,_0x1d722c){io['to'](_0x5866e5)[_0x5f48('0xd')](_0x3fb7e5,_0x1d722c);}function request(_0x5019de){logger[_0x5f48('0xe')](_0x5f48('0xf'),JSON[_0x5f48('0x10')](_0x5019de));return rp(_0x5019de);}function getCustomFields(_0x1b1be7,_0x31f25a){var _0x5a2fd8={};if(_0x1b1be7[_0x5f48('0x11')]>0x0){_[_0x5f48('0x12')](_0x1b1be7,function(_0x37f13b){if(_0x37f13b[_0x5f48('0x13')]===_0x5f48('0x14')&&_0x37f13b[_0x5f48('0x15')]){_0x5a2fd8[_0x37f13b[_0x5f48('0x15')]]=_0x37f13b['content']['toString']();}else if(_0x37f13b['type']===_0x5f48('0x16')&&_0x37f13b[_0x5f48('0x17')]&&_0x37f13b['idField']&&_0x31f25a[_0x37f13b['variableName']]){_0x5a2fd8[_0x37f13b[_0x5f48('0x15')]]=_0x31f25a[_0x37f13b['variableName']][_0x5f48('0x18')]();}else if(_0x37f13b['type']==='customVariable'&&_0x37f13b['Variable']&&_0x37f13b['Variable'][_0x5f48('0x19')]&&_0x37f13b['idField']&&_0x31f25a[_0x37f13b[_0x5f48('0x1a')]['name'][_0x5f48('0x1b')]()]){_0x5a2fd8[_0x37f13b[_0x5f48('0x15')]]=_0x31f25a[_0x37f13b['Variable'][_0x5f48('0x19')][_0x5f48('0x1b')]()][_0x5f48('0x18')]();}});}return _0x5a2fd8;}function getName(_0x5763af){if(_0x5763af[_0x5f48('0x1c')]('\x20')>0x0){var _0x147033=_0x5763af[_0x5f48('0x1d')](/ (.+)/);if(_0x147033[0x1]){return _0x147033;}}return[_0x5763af,_0x5763af];}var accountsTokens={};function getAccessToken(_0x3fbea5){return new Promise(function(_0x54365f,_0x34557d){if(!_['isNil'](accountsTokens[_0x3fbea5['id']])&&!_[_0x5f48('0x1e')](accountsTokens[_0x3fbea5['id']][_0x5f48('0x1f')])){if(moment()[_0x5f48('0x20')](accountsTokens[_0x3fbea5['id']]['expires_in'])){_0x54365f(accountsTokens[_0x3fbea5['id']][_0x5f48('0x1f')]);}}var _0x298e18;switch(_0x3fbea5['zone']){case'US':_0x298e18='https://accounts.zoho.com';break;case'AU':_0x298e18=_0x5f48('0x21');break;case'EU':_0x298e18=_0x5f48('0x22');break;case'IN':_0x298e18=_0x5f48('0x23');break;case'CN':_0x298e18=_0x5f48('0x24');break;default:_0x298e18='https://accounts.zoho.eu';break;}var _0x3529b5={'method':_0x5f48('0x25'),'uri':_0x298e18+'/oauth/v2/token','qs':{'refresh_token':_0x3fbea5[_0x5f48('0x26')],'client_id':_0x3fbea5[_0x5f48('0x27')],'client_secret':_0x3fbea5[_0x5f48('0x28')],'grant_type':_0x5f48('0x29')},'json':!![]};return rp(_0x3529b5)[_0x5f48('0x2a')](function(_0x481e1b){accountsTokens[_0x3fbea5['id']]={'access_token':_0x481e1b[_0x5f48('0x1f')],'expires_in':moment()[_0x5f48('0x2b')](_0x481e1b[_0x5f48('0x2c')],'seconds')};_0x54365f(_0x481e1b['access_token']);})[_0x5f48('0x2d')](function(_0x1b6a79){logger[_0x5f48('0x2e')](_0x5f48('0x2f'),_0x1b6a79[_0x5f48('0x30')]);_0x34557d(_0x1b6a79);});});}function getUser(_0x54981b,_0x4631b8,_0x348f3d,_0x2f4a73){logger[_0x5f48('0x31')](_0x5f48('0x32'));return request({'method':_0x5f48('0x33'),'uri':util[_0x5f48('0x34')](_0x5f48('0x35'),_0x4631b8),'qs':{'type':_0x5f48('0x36')},'headers':{'Authorization':_0x5f48('0x37')+_0x54981b},'json':!![]})[_0x5f48('0x2a')](function(_0x522f05){if(_0x522f05['users']){var _0x344a6e=-0x1;if(_[_0x5f48('0x38')](_0x522f05[_0x5f48('0x39')])){if(!_[_0x5f48('0x1e')](_0x2f4a73)){_0x344a6e=_[_0x5f48('0x3a')](_0x522f05[_0x5f48('0x39')],function(_0x4aeaea){return _0x4aeaea[_0x5f48('0x3b')]===_0x2f4a73;});}if(_0x344a6e>=0x0){logger[_0x5f48('0x31')](_0x5f48('0x3c'));}else{logger['info'](_0x5f48('0x3d'));_0x344a6e=_[_0x5f48('0x3a')](_0x522f05[_0x5f48('0x39')],function(_0x42757a){return _0x42757a['profile'][_0x5f48('0x19')]===_0x5f48('0x3e');});}return _0x522f05[_0x5f48('0x39')][_0x344a6e];}else{if(_0x522f05['user'][_0x5f48('0x3f')][_0x5f48('0x19')]===_0x5f48('0x3e')){logger[_0x5f48('0x31')](_0x5f48('0x3d'));user=_0x522f05[_0x5f48('0x40')];return user;}else{logger[_0x5f48('0x2e')](_0x5f48('0x41'),JSON[_0x5f48('0x10')](_0x522f05));throw new Error(_0x5f48('0x42')+JSON[_0x5f48('0x10')](_0x522f05));}}}else{logger[_0x5f48('0x2e')](_0x5f48('0x41'),JSON[_0x5f48('0x10')](_0x522f05));throw new Error(_0x5f48('0x42')+JSON[_0x5f48('0x10')](_0x522f05));}})[_0x5f48('0x2d')](function(_0x2034cf){console['error'](_0x2034cf);});}function getZohoUser(_0x35246c,_0x5cd9ac){return new BPromise(function(_0x289238,_0x8ed437){request(_0x35246c)[_0x5f48('0x2a')](function(_0x1b1799){var _0x492726=null;if(_0x1b1799){_0x492726=_0x1b1799['data'][0x0];_0x492726[_0x5f48('0x43')]=_0x5cd9ac;}_0x289238(_0x492726);})[_0x5f48('0x2d')](function(_0x3a2d5f){_0x8ed437(_0x3a2d5f);});});}function createEndUser(_0x2587ef,_0x1084ca,_0x4a3350,_0x53e4cf,_0x4cc9a9,_0x57edd7){var _0x4a3350=getName(_0x4a3350);return request({'method':_0x5f48('0x25'),'uri':'https://www.zohoapis.'+_0x1084ca+'/crm/v2/'+_[_0x5f48('0x44')](_0x57edd7['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4a3350[0x1],'First_Name':_0x4a3350[0x0],'Phone':_0x53e4cf,'Owner':{'name':!_['isNil'](_0x4cc9a9[_0x5f48('0x45')]['name'])?_0x4cc9a9[_0x5f48('0x45')]['name']:!_['isNil'](_0x4cc9a9[_0x5f48('0x46')])?_0x4cc9a9[_0x5f48('0x46')]+'\x20'+_0x4cc9a9[_0x5f48('0x47')]:_0x4cc9a9[_0x5f48('0x47')],'id':_0x4cc9a9['id']}}]},'headers':{'Authorization':_0x5f48('0x37')+_0x2587ef},'json':!![]})['then'](function(_0x193319){if(_0x193319&&_0x193319[_0x5f48('0x48')][0x0][_0x5f48('0x49')]===_0x5f48('0x4a')){var _0x35064c=_0x193319[_0x5f48('0x48')][0x0]['details'];_0x35064c['enduserType']=_['startCase'](_0x57edd7[_0x5f48('0x4b')])+'s';return _0x35064c;}logger[_0x5f48('0x2e')](_0x5f48('0x41'),JSON['stringify'](data));throw new Error(_0x5f48('0x4c')+JSON[_0x5f48('0x10')](data));})[_0x5f48('0x2d')](function(_0x11ec00){console[_0x5f48('0x4d')]('CREATE\x20ERROR',_0x11ec00);});}function getEndUser(_0x389469,_0x1bb5eb,_0x309391,_0x168996,_0x4bc0f1,_0x3b53b9,_0x22ca22){var _0x5e86e8={'method':_0x5f48('0x33'),'uri':'','headers':{'Authorization':_0x5f48('0x37')+_0x389469},'json':!![]};switch(_0x22ca22['moduleSearch']){case'contact_lead':_0x5e86e8[_0x5f48('0x4e')]=_0x5f48('0x4f')+_0x1bb5eb+_0x5f48('0x50')+_0x4bc0f1+'))';return getZohoUser(_0x5e86e8,_0x5f48('0x51'))[_0x5f48('0x2a')](function(_0x3994f7){if(_0x3994f7)return _0x3994f7;_0x5e86e8['uri']=_0x5f48('0x4f')+_0x1bb5eb+_0x5f48('0x52')+_0x4bc0f1+'))';return getZohoUser(_0x5e86e8,'Leads')['then'](function(_0x24d299){if(_0x24d299)return _0x24d299;if(_0x22ca22[_0x5f48('0x4b')]!='nothing'){return createEndUser(_0x389469,_0x1bb5eb,_0x168996,_0x4bc0f1,_0x3b53b9,_0x22ca22);}else{return{};}});});break;case _0x5f48('0x53'):_0x5e86e8[_0x5f48('0x4e')]=_0x5f48('0x4f')+_0x1bb5eb+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4bc0f1+'))';return getZohoUser(_0x5e86e8,_0x5f48('0x51'))[_0x5f48('0x2a')](function(_0x3693bb){if(_0x3693bb)return _0x3693bb;if(_0x22ca22[_0x5f48('0x4b')]!=_0x5f48('0x54')){return createEndUser(_0x389469,_0x1bb5eb,_0x168996,_0x4bc0f1,_0x3b53b9,_0x22ca22);}else{return{};}});break;case _0x5f48('0x55'):_0x5e86e8[_0x5f48('0x4e')]='https://www.zohoapis.'+_0x1bb5eb+_0x5f48('0x52')+_0x4bc0f1+'))';return getZohoUser(_0x5e86e8,_0x5f48('0x56'))[_0x5f48('0x2a')](function(_0x1c9dc8){if(_0x1c9dc8)return _0x1c9dc8;if(_0x22ca22[_0x5f48('0x4b')]!=_0x5f48('0x54')){return createEndUser(_0x389469,_0x1bb5eb,_0x168996,_0x4bc0f1,_0x3b53b9,_0x22ca22);}else{return{};}});break;}}function getCall(_0x36bbf4,_0x211966,_0x338bde,_0x219bfa,_0x2d88fc,_0x439961,_0x5e805a,_0x333211){logger[_0x5f48('0x31')](_0x5f48('0x57'));var _0xc86665={};_0xc86665['Owner']={'name':!_['isNil'](_0x219bfa[_0x5f48('0x45')][_0x5f48('0x19')])&&!_['isNil'](_0x219bfa[_0x5f48('0x3f')][_0x5f48('0x19')])&&_0x219bfa[_0x5f48('0x3f')][_0x5f48('0x19')]===_0x5f48('0x58')?_0x219bfa[_0x5f48('0x45')][_0x5f48('0x19')]:!_[_0x5f48('0x1e')](_0x219bfa[_0x5f48('0x46')])?_0x219bfa[_0x5f48('0x46')]+'\x20'+_0x219bfa['last_name']:_0x219bfa['last_name'],'id':_0x219bfa['id']};_0xc86665[_0x5f48('0x59')]=intUtil[_0x5f48('0x5a')](_0x439961[_0x5f48('0x5b')],_0x5e805a,'\x20');_0xc86665[_0x5f48('0x5c')]=intUtil[_0x5f48('0x5a')](_0x439961[_0x5f48('0x5d')],_0x5e805a,'\x0a');if(_0x2d88fc[_0x5f48('0x43')]===_0x5f48('0x51')){_0xc86665['Who_Id']={'name':!_['isNil'](_0x2d88fc[_0x5f48('0x5e')])?_0x2d88fc['Full_Name']:!_[_0x5f48('0x1e')](_0x2d88fc['First_Name'])?_0x2d88fc[_0x5f48('0x5f')]+'\x20'+_0x2d88fc['Last_Name']:_0x2d88fc[_0x5f48('0x60')],'id':_0x2d88fc['id']};}if(_0x2d88fc['enduserType']===_0x5f48('0x56')){_0xc86665['What_Id']={'name':!_[_0x5f48('0x1e')](_0x2d88fc[_0x5f48('0x5e')])?_0x2d88fc[_0x5f48('0x5e')]:!_[_0x5f48('0x1e')](_0x2d88fc[_0x5f48('0x5f')])?_0x2d88fc[_0x5f48('0x5f')]+'\x20'+_0x2d88fc['Last_Name']:_0x2d88fc['Last_Name'],'id':_0x2d88fc['id']};_0xc86665[_0x5f48('0x61')]=_[_0x5f48('0x44')](_0x2d88fc[_0x5f48('0x43')]);}if(_0x5e805a[_0x5f48('0x62')]){_0xc86665[_0x5f48('0x63')]=moment[_0x5f48('0x64')](parseInt(_0x5e805a[_0x5f48('0x62')])*0x3e8)[_0x5f48('0x34')]('mm:ss');}else if(_0x5e805a[_0x5f48('0x65')]&&_0x5e805a['endtime']){_0xc86665['Call_Duration']=moment[_0x5f48('0x64')](moment(_0x5e805a[_0x5f48('0x66')],_0x5f48('0x67'))[_0x5f48('0x68')](moment(_0x5e805a[_0x5f48('0x69')],_0x5f48('0x67'))))[_0x5f48('0x34')](_0x5f48('0x6a'));}switch(_0x5e805a['lastevent']){case _0x5f48('0x6b'):_0xc86665[_0x5f48('0x6c')]=_0x5f48('0x6d');break;case _0x5f48('0x6e'):case _0x5f48('0x6f'):_0xc86665[_0x5f48('0x6c')]=_0x5f48('0x70');break;case _0x5f48('0x71'):_0xc86665[_0x5f48('0x6c')]=_0x5f48('0x72');break;case _0x5f48('0x73'):_0xc86665[_0x5f48('0x6c')]='Abandoned';break;case _0x5f48('0x74'):_0xc86665[_0x5f48('0x6c')]=_0x5f48('0x75');default:}_0xc86665[_0x5f48('0x76')]=(_0x333211===_0x5f48('0x77')?moment(_0x5e805a['starttime'])[_0x5f48('0x34')](_0x5f48('0x67')):moment(_0x5e805a[_0x5f48('0x78')])[_0x5f48('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x5f48('0x34')](_0x5f48('0x67'));_0xc86665[_0x5f48('0x79')]=_0x333211||_0x5f48('0x7a');_0xc86665=_['merge'](_0xc86665,getCustomFields(_0x439961['Fields'],_0x5e805a));return request({'method':_0x5f48('0x25'),'uri':_0x5f48('0x4f')+_0x211966+_0x5f48('0x7b'),'headers':{'Authorization':_0x5f48('0x37')+_0x36bbf4},'body':{'data':[_0xc86665]},'json':!![]})[_0x5f48('0x2a')](function(_0x521a1d){if(_0x521a1d&&_0x521a1d[_0x5f48('0x48')][0x0][_0x5f48('0x49')]===_0x5f48('0x4a')){logger[_0x5f48('0x31')](_0x5f48('0x7c'));return{'id':_0x521a1d[_0x5f48('0x48')][0x0][_0x5f48('0x7d')]['id']};}})[_0x5f48('0x2d')](function(_0x249f3b){logger[_0x5f48('0x31')](_0x5f48('0x7e'),_0x249f3b[_0x5f48('0x30')]);console['log'](_0x5f48('0x7e'),_0x249f3b);});}exports[_0x5f48('0x7f')]=function(_0x3e3749,_0x4b9409,_0x4ef67e,_0x736070,_0x110a78,_0x428663){var _0x228034,_0x45318c,_0x471bd4;_0x428663[_0x5f48('0x80')]=intUtil['stripTrailingSlash'](_0x428663[_0x5f48('0x80')]);_0x428663[_0x5f48('0x81')]=intUtil[_0x5f48('0x82')](_0x428663[_0x5f48('0x81')]);if(_0x110a78&&_0x110a78['monitor_format']){logger[_0x5f48('0x31')](_0x5f48('0x83'),'Recording\x20is\x20enabled!');_0x4b9409[_0x5f48('0x84')]=_0x428663[_0x5f48('0x81')]+_0x5f48('0x85')+_0x4b9409[_0x5f48('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x4b9409[_0x5f48('0x86')]);}else{_0x4b9409[_0x5f48('0x84')]='';}var _0x4b555c=_0x428663[_0x5f48('0x80')]===_0x5f48('0x87')?'eu':_0x5f48('0x88');return getAccessToken(_0x428663)[_0x5f48('0x2a')](function(_0x4b012a){_0x471bd4=_0x4b012a;return getUser(_0x471bd4,_0x4b555c,_0x428663,_0x736070['email']);})[_0x5f48('0x2a')](function(_0x3cf947){_0x228034=_0x3cf947;logger[_0x5f48('0x31')](_0x5f48('0x89'),_0x228034['id']);return getEndUser(_0x471bd4,_0x4b555c,_0x428663,_0x4b9409[_0x5f48('0x8a')],_0x4b9409[_0x5f48('0x8b')],_0x228034,_0x4ef67e);})[_0x5f48('0x2a')](function(_0x24ff33){_0x45318c=_0x24ff33;return getCall(_0x471bd4,_0x4b555c,_0x428663,_0x228034,_0x45318c,_0x4ef67e,_0x4b9409,_0x5f48('0x7a'));})[_0x5f48('0x2a')](function(_0x1a76c4){if(_0x1a76c4){logger[_0x5f48('0x31')](_0x5f48('0x8c'),_0x1a76c4['id']);logger['info'](_0x5f48('0x83'),_0x5f48('0x8d'));emit(util[_0x5f48('0x34')](_0x5f48('0x8e'),_0x736070[_0x5f48('0x19')]),_0x5f48('0x8f'),{'uri':'https://crm.'+_0x428663[_0x5f48('0x80')]+_0x5f48('0x90')+_0x1a76c4['id']});}})['catch'](function(_0x1084b5){logger[_0x5f48('0x2e')]('[QUEUE]',JSON[_0x5f48('0x10')](_0x1084b5));});};exports['outbound']=function(_0x69f2f5,_0x5d204b,_0x2badab,_0x4db416,_0x1626b1,_0x2070e2,_0x256d48){var _0xcc9a4,_0x1f55f5,_0x3cafd9;_0x2070e2[_0x5f48('0x80')]=intUtil[_0x5f48('0x82')](_0x2070e2[_0x5f48('0x80')]);_0x2070e2[_0x5f48('0x81')]=intUtil[_0x5f48('0x82')](_0x2070e2[_0x5f48('0x81')]);if(_0x256d48&&_0x256d48[_0x5f48('0x91')]&&_0x256d48[_0x5f48('0x91')]!==_0x5f48('0x92')){logger[_0x5f48('0x31')](_0x5f48('0x93'),_0x5f48('0x94'));_0x5d204b[_0x5f48('0x84')]=_0x2070e2[_0x5f48('0x81')]+'/api/voice/recordings/'+_0x5d204b[_0x5f48('0x86')]+_0x5f48('0x95')+md5(_0x5d204b[_0x5f48('0x86')]);}var _0x3f89f9=_0x2070e2['host']===_0x5f48('0x87')?'eu':_0x5f48('0x88');return getAccessToken(_0x2070e2)['then'](function(_0x36f643){_0x3cafd9=_0x36f643;return getUser(_0x3cafd9,_0x3f89f9,_0x2070e2,_0x4db416[_0x5f48('0x3b')]);})[_0x5f48('0x2a')](function(_0x82402a){_0xcc9a4=_0x82402a;logger[_0x5f48('0x31')](_0x5f48('0x89'),_0xcc9a4['id']);return getEndUser(_0x3cafd9,_0x3f89f9,_0x2070e2,_0x5d204b['destcalleridname'],_0x5d204b[_0x5f48('0x96')],_0xcc9a4,_0x2badab);})['then'](function(_0x29008a){_0x1f55f5=_0x29008a;return getCall(_0x3cafd9,_0x3f89f9,_0x2070e2,_0xcc9a4,_0x1f55f5,_0x2badab,_0x5d204b,'Outbound');})[_0x5f48('0x2a')](function(_0x4ffdae){if(_0x4ffdae){logger['info'](_0x5f48('0x8c'),_0x4ffdae['id']);logger['info'](_0x5f48('0x93'),_0x5f48('0x8d'));emit(util[_0x5f48('0x34')](_0x5f48('0x8e'),_0x4db416[_0x5f48('0x19')]),_0x5f48('0x8f'),{'uri':_0x5f48('0x97')+_0x2070e2['host']+_0x5f48('0x90')+_0x4ffdae['id']});}})[_0x5f48('0x2d')](function(_0xab2d6c){logger['error'](_0x5f48('0x93'),JSON[_0x5f48('0x10')](_0xab2d6c));});};exports[_0x5f48('0x98')]=function(_0x2a0c46,_0x39ed69,_0x3435eb,_0x3a25ed,_0x4709c3,_0x2cb237){var _0x579642,_0x225bbc,_0x2ad534;_0x2cb237[_0x5f48('0x80')]=intUtil[_0x5f48('0x82')](_0x2cb237[_0x5f48('0x80')]);_0x2cb237[_0x5f48('0x81')]=intUtil['stripTrailingSlash'](_0x2cb237[_0x5f48('0x81')]);if(_0x4709c3&&_0x4709c3[_0x5f48('0x99')]){logger[_0x5f48('0x31')]('['+_0x39ed69[_0x5f48('0x9a')][_0x5f48('0x9b')]()+']',_0x5f48('0x94'));_0x39ed69[_0x5f48('0x84')]=_0x2cb237['serverUrl']+'/api/voice/recordings/'+_0x39ed69['uniqueid']+_0x5f48('0x95')+md5(_0x39ed69[_0x5f48('0x86')]);}else{_0x39ed69[_0x5f48('0x84')]='';}var _0x224980=_0x2cb237[_0x5f48('0x80')]===_0x5f48('0x87')?'eu':_0x5f48('0x88');return getAccessToken(_0x2cb237)[_0x5f48('0x2a')](function(_0x2c8c8e){_0x2ad534=_0x2c8c8e;return getUser(_0x2ad534,_0x224980,_0x2cb237);})['then'](function(_0x4a2182){_0x579642=_0x4a2182;logger[_0x5f48('0x31')](_0x5f48('0x89'),_0x579642['id']);return getEndUser(_0x2ad534,_0x224980,_0x2cb237,_0x39ed69[_0x5f48('0x8a')],_0x39ed69[_0x5f48('0x8b')],_0x579642,_0x3435eb);})[_0x5f48('0x2a')](function(_0x567fd2){_0x225bbc=_0x567fd2;return getCall(_0x2ad534,_0x224980,_0x2cb237,_0x579642,_0x225bbc,_0x3435eb,_0x39ed69,'Inbound');})['then'](function(_0x30dffc){if(_0x30dffc){logger[_0x5f48('0x31')]('The\x20Call\x20ID\x20is:',_0x30dffc['id']);}})['catch'](function(_0x5b9ce2){logger[_0x5f48('0x2e')]('['+_0x39ed69['lastevent'][_0x5f48('0x9b')]()+']',JSON[_0x5f48('0x10')](_0x5b9ce2));});}; \ No newline at end of file +var _0xd7a4=['variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','uri','administrator','Subject','getString','Subjects','Description','Last_Name','Full_Name','First_Name','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','Answered','rejected','abandoned','Call_Result','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','code','err','stack','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','lodash','request-promise','util','./util','moment','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','length','forEach','type','string','idField','content','toString'];(function(_0x317dd9,_0x373814){var _0x3ff1e0=function(_0x37a31b){while(--_0x37a31b){_0x317dd9['push'](_0x317dd9['shift']());}};_0x3ff1e0(++_0x373814);}(_0xd7a4,0x7e));var _0x4d7a=function(_0x5e6be7,_0x1512a4){_0x5e6be7=_0x5e6be7-0x0;var _0x29b979=_0xd7a4[_0x5e6be7];return _0x29b979;};'use strict';var _=require(_0x4d7a('0x0'));var rp=require(_0x4d7a('0x1'));var md5=require('md5');var util=require(_0x4d7a('0x2'));var intUtil=require(_0x4d7a('0x3'));var moment=require(_0x4d7a('0x4'));var Redis=require('ioredis');var BPromise=require(_0x4d7a('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4d7a('0x6'))('zoho');config[_0x4d7a('0x7')]=_[_0x4d7a('0x8')](config[_0x4d7a('0x7')],{'host':_0x4d7a('0x9'),'port':0x18eb});var io=require(_0x4d7a('0xa'))(new Redis(config[_0x4d7a('0x7')]));function emit(_0x27904a,_0x3673e4,_0x2e6d17){io['to'](_0x27904a)['emit'](_0x3673e4,_0x2e6d17);}function request(_0xc02f95){logger['debug'](_0x4d7a('0xb'),JSON[_0x4d7a('0xc')](_0xc02f95));return rp(_0xc02f95);}function getCustomFields(_0x5badc5,_0x555c3a){var _0x537ba7={};if(_0x5badc5[_0x4d7a('0xd')]>0x0){_[_0x4d7a('0xe')](_0x5badc5,function(_0x28c011){if(_0x28c011[_0x4d7a('0xf')]===_0x4d7a('0x10')&&_0x28c011[_0x4d7a('0x11')]){_0x537ba7[_0x28c011[_0x4d7a('0x11')]]=_0x28c011[_0x4d7a('0x12')][_0x4d7a('0x13')]();}else if(_0x28c011[_0x4d7a('0xf')]===_0x4d7a('0x14')&&_0x28c011[_0x4d7a('0x15')]&&_0x28c011[_0x4d7a('0x11')]&&_0x555c3a[_0x28c011[_0x4d7a('0x15')]]){_0x537ba7[_0x28c011[_0x4d7a('0x11')]]=_0x555c3a[_0x28c011['variableName']][_0x4d7a('0x13')]();}else if(_0x28c011[_0x4d7a('0xf')]===_0x4d7a('0x16')&&_0x28c011['Variable']&&_0x28c011[_0x4d7a('0x17')][_0x4d7a('0x18')]&&_0x28c011[_0x4d7a('0x11')]&&_0x555c3a[_0x28c011[_0x4d7a('0x17')][_0x4d7a('0x18')][_0x4d7a('0x19')]()]){_0x537ba7[_0x28c011[_0x4d7a('0x11')]]=_0x555c3a[_0x28c011[_0x4d7a('0x17')][_0x4d7a('0x18')]['toLowerCase']()][_0x4d7a('0x13')]();}});}return _0x537ba7;}function getName(_0x58e8c4){if(_0x58e8c4[_0x4d7a('0x1a')]('\x20')>0x0){var _0xd4da09=_0x58e8c4[_0x4d7a('0x1b')](/ (.+)/);if(_0xd4da09[0x1]){return _0xd4da09;}}return[_0x58e8c4,_0x58e8c4];}var accountsTokens={};function getAccessToken(_0x1a9ab8){return new Promise(function(_0x49db88,_0x369389){if(!_[_0x4d7a('0x1c')](accountsTokens[_0x1a9ab8['id']])&&!_[_0x4d7a('0x1c')](accountsTokens[_0x1a9ab8['id']][_0x4d7a('0x1d')])){if(moment()[_0x4d7a('0x1e')](accountsTokens[_0x1a9ab8['id']][_0x4d7a('0x1f')])){_0x49db88(accountsTokens[_0x1a9ab8['id']][_0x4d7a('0x1d')]);}}var _0x2eb19b;switch(_0x1a9ab8['zone']){case'US':_0x2eb19b=_0x4d7a('0x20');break;case'AU':_0x2eb19b='https://accounts.zoho.com.au';break;case'EU':_0x2eb19b='https://accounts.zoho.eu';break;case'IN':_0x2eb19b=_0x4d7a('0x21');break;case'CN':_0x2eb19b=_0x4d7a('0x22');break;default:_0x2eb19b=_0x4d7a('0x23');break;}var _0x438ec7={'method':_0x4d7a('0x24'),'uri':_0x2eb19b+_0x4d7a('0x25'),'qs':{'refresh_token':_0x1a9ab8[_0x4d7a('0x26')],'client_id':_0x1a9ab8[_0x4d7a('0x27')],'client_secret':_0x1a9ab8[_0x4d7a('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x438ec7)[_0x4d7a('0x29')](function(_0x7f1eb8){accountsTokens[_0x1a9ab8['id']]={'access_token':_0x7f1eb8[_0x4d7a('0x1d')],'expires_in':moment()[_0x4d7a('0x2a')](_0x7f1eb8[_0x4d7a('0x1f')],_0x4d7a('0x2b'))};_0x49db88(_0x7f1eb8[_0x4d7a('0x1d')]);})[_0x4d7a('0x2c')](function(_0x5b0fec){logger[_0x4d7a('0x2d')](_0x4d7a('0x2e'),_0x5b0fec['stack']);_0x369389(_0x5b0fec);});});}function getUser(_0x2840c7,_0xfbb503,_0x5bae65,_0x464595){logger[_0x4d7a('0x2f')](_0x4d7a('0x30'));return request({'method':_0x4d7a('0x31'),'uri':util['format'](_0x4d7a('0x32'),_0xfbb503),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2840c7},'json':!![]})['then'](function(_0x750431){if(_0x750431[_0x4d7a('0x33')]){var _0x58168b=-0x1;if(_[_0x4d7a('0x34')](_0x750431['users'])){if(!_[_0x4d7a('0x1c')](_0x464595)){_0x58168b=_[_0x4d7a('0x35')](_0x750431[_0x4d7a('0x33')],function(_0x3e4f5f){return _0x3e4f5f[_0x4d7a('0x36')]===_0x464595;});}if(_0x58168b>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x4d7a('0x2f')](_0x4d7a('0x37'));_0x58168b=_[_0x4d7a('0x35')](_0x750431[_0x4d7a('0x33')],function(_0x2a6744){return _0x2a6744[_0x4d7a('0x38')][_0x4d7a('0x18')]==='Administrator';});}return _0x750431[_0x4d7a('0x33')][_0x58168b];}else{if(_0x750431['user'][_0x4d7a('0x38')][_0x4d7a('0x18')]===_0x4d7a('0x39')){logger[_0x4d7a('0x2f')](_0x4d7a('0x37'));user=_0x750431[_0x4d7a('0x3a')];return user;}else{logger['error'](_0x4d7a('0x3b'),JSON[_0x4d7a('0xc')](_0x750431));throw new Error(_0x4d7a('0x3c')+JSON['stringify'](_0x750431));}}}else{logger[_0x4d7a('0x2d')](_0x4d7a('0x3b'),JSON[_0x4d7a('0xc')](_0x750431));throw new Error(_0x4d7a('0x3c')+JSON['stringify'](_0x750431));}})[_0x4d7a('0x2c')](function(_0x347f57){console['error'](_0x347f57);});}function getZohoUser(_0x3c8712,_0x46b3dd){return new BPromise(function(_0x88a3fa,_0x40d23f){request(_0x3c8712)[_0x4d7a('0x29')](function(_0x117367){var _0x1734c1=null;if(_0x117367){_0x1734c1=_0x117367[_0x4d7a('0x3d')][0x0];_0x1734c1[_0x4d7a('0x3e')]=_0x46b3dd;}_0x88a3fa(_0x1734c1);})['catch'](function(_0x7fd098){_0x40d23f(_0x7fd098);});});}function createEndUser(_0x42117f,_0x1a2303,_0x45dc7d,_0x21d3f1,_0xa1671,_0x3795e6){var _0x45dc7d=getName(_0x45dc7d);return request({'method':'POST','uri':_0x4d7a('0x3f')+_0x1a2303+_0x4d7a('0x40')+_[_0x4d7a('0x41')](_0x3795e6[_0x4d7a('0x42')])+'s','body':{'data':[{'Last_Name':_0x45dc7d[0x1],'First_Name':_0x45dc7d[0x0],'Phone':_0x21d3f1,'Owner':{'name':!_[_0x4d7a('0x1c')](_0xa1671[_0x4d7a('0x43')][_0x4d7a('0x18')])?_0xa1671[_0x4d7a('0x43')][_0x4d7a('0x18')]:!_[_0x4d7a('0x1c')](_0xa1671[_0x4d7a('0x44')])?_0xa1671['first_name']+'\x20'+_0xa1671[_0x4d7a('0x45')]:_0xa1671['last_name'],'id':_0xa1671['id']}}]},'headers':{'Authorization':_0x4d7a('0x46')+_0x42117f},'json':!![]})[_0x4d7a('0x29')](function(_0x59ae2c){if(_0x59ae2c&&_0x59ae2c[_0x4d7a('0x3d')][0x0]['code']===_0x4d7a('0x47')){var _0x1deee0=_0x59ae2c['data'][0x0][_0x4d7a('0x48')];_0x1deee0[_0x4d7a('0x3e')]=_['startCase'](_0x3795e6['moduleCreate'])+'s';return _0x1deee0;}logger[_0x4d7a('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x4d7a('0xc')](data));throw new Error(_0x4d7a('0x49')+JSON[_0x4d7a('0xc')](data));})['catch'](function(_0x5207e1){console['log'](_0x4d7a('0x4a'),_0x5207e1);});}function getEndUser(_0x40444b,_0x56fad5,_0x1546a5,_0x59f40c,_0x497a9a,_0x4ef4c0,_0x1d0d3c){var _0x1c70d4={'method':_0x4d7a('0x31'),'uri':'','headers':{'Authorization':_0x4d7a('0x46')+_0x40444b},'json':!![]};switch(_0x1d0d3c['moduleSearch']){case _0x4d7a('0x4b'):_0x1c70d4['uri']='https://www.zohoapis.'+_0x56fad5+_0x4d7a('0x4c')+_0x497a9a+'))';return getZohoUser(_0x1c70d4,_0x4d7a('0x4d'))['then'](function(_0x145025){if(_0x145025)return _0x145025;_0x1c70d4['uri']='https://www.zohoapis.'+_0x56fad5+_0x4d7a('0x4e')+_0x497a9a+'))';return getZohoUser(_0x1c70d4,_0x4d7a('0x4f'))[_0x4d7a('0x29')](function(_0x2eb644){if(_0x2eb644)return _0x2eb644;if(_0x1d0d3c['moduleCreate']!='nothing'){return createEndUser(_0x40444b,_0x56fad5,_0x59f40c,_0x497a9a,_0x4ef4c0,_0x1d0d3c);}else{return{};}});});break;case _0x4d7a('0x50'):_0x1c70d4['uri']=_0x4d7a('0x3f')+_0x56fad5+_0x4d7a('0x4c')+_0x497a9a+'))';return getZohoUser(_0x1c70d4,_0x4d7a('0x4d'))[_0x4d7a('0x29')](function(_0xbd59d9){if(_0xbd59d9)return _0xbd59d9;if(_0x1d0d3c[_0x4d7a('0x42')]!=_0x4d7a('0x51')){return createEndUser(_0x40444b,_0x56fad5,_0x59f40c,_0x497a9a,_0x4ef4c0,_0x1d0d3c);}else{return{};}});break;case'lead':_0x1c70d4[_0x4d7a('0x52')]='https://www.zohoapis.'+_0x56fad5+_0x4d7a('0x4e')+_0x497a9a+'))';return getZohoUser(_0x1c70d4,'Leads')[_0x4d7a('0x29')](function(_0x58636d){if(_0x58636d)return _0x58636d;if(_0x1d0d3c['moduleCreate']!=_0x4d7a('0x51')){return createEndUser(_0x40444b,_0x56fad5,_0x59f40c,_0x497a9a,_0x4ef4c0,_0x1d0d3c);}else{return{};}});break;}}function getCall(_0x45b8ce,_0x4f4982,_0x368f02,_0x2b87e0,_0x4cfd61,_0x2ece8d,_0x330bfe,_0x1d7ab3){logger[_0x4d7a('0x2f')]('Creating\x20new\x20call...');var _0x2a58e3={};_0x2a58e3['Owner']={'name':!_[_0x4d7a('0x1c')](_0x2b87e0[_0x4d7a('0x43')][_0x4d7a('0x18')])&&!_[_0x4d7a('0x1c')](_0x2b87e0[_0x4d7a('0x38')][_0x4d7a('0x18')])&&_0x2b87e0[_0x4d7a('0x38')][_0x4d7a('0x18')]===_0x4d7a('0x53')?_0x2b87e0[_0x4d7a('0x43')][_0x4d7a('0x18')]:!_[_0x4d7a('0x1c')](_0x2b87e0['first_name'])?_0x2b87e0[_0x4d7a('0x44')]+'\x20'+_0x2b87e0[_0x4d7a('0x45')]:_0x2b87e0['last_name'],'id':_0x2b87e0['id']};_0x2a58e3[_0x4d7a('0x54')]=intUtil[_0x4d7a('0x55')](_0x2ece8d[_0x4d7a('0x56')],_0x330bfe,'\x20');_0x2a58e3[_0x4d7a('0x57')]=intUtil[_0x4d7a('0x55')](_0x2ece8d['Descriptions'],_0x330bfe,'\x0a');if(_0x4cfd61['enduserType']==='Contacts'){_0x2a58e3['Who_Id']={'name':!_[_0x4d7a('0x1c')](_0x4cfd61['Full_Name'])?_0x4cfd61['Full_Name']:!_['isNil'](_0x4cfd61['First_Name'])?_0x4cfd61['First_Name']+'\x20'+_0x4cfd61[_0x4d7a('0x58')]:_0x4cfd61[_0x4d7a('0x58')],'id':_0x4cfd61['id']};}if(_0x4cfd61[_0x4d7a('0x3e')]===_0x4d7a('0x4f')){_0x2a58e3['What_Id']={'name':!_['isNil'](_0x4cfd61['Full_Name'])?_0x4cfd61[_0x4d7a('0x59')]:!_[_0x4d7a('0x1c')](_0x4cfd61[_0x4d7a('0x5a')])?_0x4cfd61[_0x4d7a('0x5a')]+'\x20'+_0x4cfd61[_0x4d7a('0x58')]:_0x4cfd61[_0x4d7a('0x58')],'id':_0x4cfd61['id']};_0x2a58e3['$se_module']=_[_0x4d7a('0x41')](_0x4cfd61[_0x4d7a('0x3e')]);}if(_0x330bfe[_0x4d7a('0x5b')]){_0x2a58e3[_0x4d7a('0x5c')]=moment[_0x4d7a('0x5d')](parseInt(_0x330bfe[_0x4d7a('0x5b')])*0x3e8)[_0x4d7a('0x5e')](_0x4d7a('0x5f'));}else if(_0x330bfe[_0x4d7a('0x60')]&&_0x330bfe[_0x4d7a('0x61')]){_0x2a58e3[_0x4d7a('0x5c')]=moment['utc'](moment(_0x330bfe[_0x4d7a('0x61')],_0x4d7a('0x62'))[_0x4d7a('0x63')](moment(_0x330bfe[_0x4d7a('0x64')],_0x4d7a('0x62'))))[_0x4d7a('0x5e')](_0x4d7a('0x5f'));}switch(_0x330bfe[_0x4d7a('0x65')]){case _0x4d7a('0x66'):_0x2a58e3['Call_Result']=_0x4d7a('0x67');break;case _0x4d7a('0x68'):case'connect':_0x2a58e3['Call_Result']=_0x4d7a('0x69');break;case _0x4d7a('0x6a'):_0x2a58e3['Call_Result']='Rejected';break;case _0x4d7a('0x6b'):_0x2a58e3[_0x4d7a('0x6c')]='Abandoned';break;case'timeout':_0x2a58e3[_0x4d7a('0x6c')]='Timeout';default:}_0x2a58e3[_0x4d7a('0x6d')]=(_0x1d7ab3===_0x4d7a('0x6e')?moment(_0x330bfe[_0x4d7a('0x64')])[_0x4d7a('0x5e')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x330bfe['agentcalledAt'])[_0x4d7a('0x5e')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x4d7a('0x5e')](_0x4d7a('0x62'));_0x2a58e3[_0x4d7a('0x6f')]=_0x1d7ab3||_0x4d7a('0x70');_0x2a58e3=_[_0x4d7a('0x71')](_0x2a58e3,getCustomFields(_0x2ece8d[_0x4d7a('0x72')],_0x330bfe));return request({'method':_0x4d7a('0x24'),'uri':'https://www.zohoapis.'+_0x4f4982+'/crm/v2/Calls','headers':{'Authorization':_0x4d7a('0x46')+_0x45b8ce},'body':{'data':[_0x2a58e3]},'json':!![]})[_0x4d7a('0x29')](function(_0x4367ef){if(_0x4367ef&&_0x4367ef[_0x4d7a('0x3d')][0x0][_0x4d7a('0x73')]===_0x4d7a('0x47')){logger['info']('Call\x20created!');return{'id':_0x4367ef[_0x4d7a('0x3d')][0x0][_0x4d7a('0x48')]['id']};}})['catch'](function(_0x32f465){logger[_0x4d7a('0x2f')](_0x4d7a('0x74'),_0x32f465[_0x4d7a('0x75')]);console[_0x4d7a('0x76')](_0x4d7a('0x74'),_0x32f465);});}exports[_0x4d7a('0x77')]=function(_0x22b1b1,_0x4a908d,_0x482e29,_0x295c15,_0x187fac,_0x4a1501){var _0x27898d,_0x23d429,_0x479de4;_0x4a1501[_0x4d7a('0x78')]=intUtil['stripTrailingSlash'](_0x4a1501[_0x4d7a('0x78')]);_0x4a1501[_0x4d7a('0x79')]=intUtil[_0x4d7a('0x7a')](_0x4a1501['serverUrl']);if(_0x187fac&&_0x187fac[_0x4d7a('0x7b')]){logger[_0x4d7a('0x2f')](_0x4d7a('0x7c'),_0x4d7a('0x7d'));_0x4a908d[_0x4d7a('0x7e')]=_0x4a1501[_0x4d7a('0x79')]+_0x4d7a('0x7f')+_0x4a908d[_0x4d7a('0x80')]+_0x4d7a('0x81')+md5(_0x4a908d[_0x4d7a('0x80')]);}else{_0x4a908d[_0x4d7a('0x7e')]='';}var _0x5a782e=_0x4a1501['host']===_0x4d7a('0x82')?'eu':_0x4d7a('0x83');return getAccessToken(_0x4a1501)['then'](function(_0x157a90){_0x479de4=_0x157a90;return getUser(_0x479de4,_0x5a782e,_0x4a1501,_0x295c15[_0x4d7a('0x36')]);})[_0x4d7a('0x29')](function(_0x76d1c9){_0x27898d=_0x76d1c9;logger['info'](_0x4d7a('0x84'),_0x27898d['id']);return getEndUser(_0x479de4,_0x5a782e,_0x4a1501,_0x4a908d['calleridname'],_0x4a908d['calleridnum'],_0x27898d,_0x482e29);})[_0x4d7a('0x29')](function(_0x190837){_0x23d429=_0x190837;return getCall(_0x479de4,_0x5a782e,_0x4a1501,_0x27898d,_0x23d429,_0x482e29,_0x4a908d,_0x4d7a('0x70'));})['then'](function(_0x501ea5){if(_0x501ea5){logger['info'](_0x4d7a('0x85'),_0x501ea5['id']);logger[_0x4d7a('0x2f')]('[QUEUE]',_0x4d7a('0x86'));emit(util[_0x4d7a('0x5e')](_0x4d7a('0x87'),_0x295c15[_0x4d7a('0x18')]),'trigger:browser:url',{'uri':_0x4d7a('0x88')+_0x4a1501[_0x4d7a('0x78')]+'/crm/EntityInfo.do?module=Calls&id='+_0x501ea5['id']});}})[_0x4d7a('0x2c')](function(_0x3fddca){logger['error'](_0x4d7a('0x7c'),JSON[_0x4d7a('0xc')](_0x3fddca));});};exports[_0x4d7a('0x6e')]=function(_0x2b585b,_0x16dcf7,_0x106437,_0x51894c,_0x1b5890,_0x475e06,_0x5f5a8c){var _0x586457,_0x3eee23,_0x27f1c4;_0x475e06['host']=intUtil['stripTrailingSlash'](_0x475e06[_0x4d7a('0x78')]);_0x475e06['serverUrl']=intUtil[_0x4d7a('0x7a')](_0x475e06['serverUrl']);if(_0x5f5a8c&&_0x5f5a8c[_0x4d7a('0x89')]&&_0x5f5a8c[_0x4d7a('0x89')]!==_0x4d7a('0x8a')){logger[_0x4d7a('0x2f')](_0x4d7a('0x8b'),_0x4d7a('0x7d'));_0x16dcf7[_0x4d7a('0x7e')]=_0x475e06[_0x4d7a('0x79')]+'/api/voice/recordings/'+_0x16dcf7[_0x4d7a('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x16dcf7['uniqueid']);}var _0x46e62d=_0x475e06['host']===_0x4d7a('0x82')?'eu':_0x4d7a('0x83');return getAccessToken(_0x475e06)[_0x4d7a('0x29')](function(_0x5955f8){_0x27f1c4=_0x5955f8;return getUser(_0x27f1c4,_0x46e62d,_0x475e06,_0x51894c[_0x4d7a('0x36')]);})[_0x4d7a('0x29')](function(_0x48c81e){_0x586457=_0x48c81e;logger['info']('The\x20User\x20ID\x20is:',_0x586457['id']);return getEndUser(_0x27f1c4,_0x46e62d,_0x475e06,_0x16dcf7[_0x4d7a('0x8c')],_0x16dcf7[_0x4d7a('0x8d')],_0x586457,_0x106437);})[_0x4d7a('0x29')](function(_0xa5ee09){_0x3eee23=_0xa5ee09;return getCall(_0x27f1c4,_0x46e62d,_0x475e06,_0x586457,_0x3eee23,_0x106437,_0x16dcf7,_0x4d7a('0x8e'));})[_0x4d7a('0x29')](function(_0x4f6f22){if(_0x4f6f22){logger['info']('The\x20Call\x20ID\x20is:',_0x4f6f22['id']);logger['info'](_0x4d7a('0x8b'),_0x4d7a('0x86'));emit(util[_0x4d7a('0x5e')](_0x4d7a('0x87'),_0x51894c[_0x4d7a('0x18')]),_0x4d7a('0x8f'),{'uri':'https://crm.'+_0x475e06['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4f6f22['id']});}})[_0x4d7a('0x2c')](function(_0x1ea69e){logger[_0x4d7a('0x2d')](_0x4d7a('0x8b'),JSON[_0x4d7a('0xc')](_0x1ea69e));});};exports[_0x4d7a('0x90')]=function(_0x574bd4,_0x1e9255,_0x37d683,_0x1a5d14,_0x2f703d,_0x122f58){var _0x50fc54,_0x3278b3,_0x1fbfd5;_0x122f58['host']=intUtil[_0x4d7a('0x7a')](_0x122f58[_0x4d7a('0x78')]);_0x122f58[_0x4d7a('0x79')]=intUtil[_0x4d7a('0x7a')](_0x122f58[_0x4d7a('0x79')]);if(_0x2f703d&&_0x2f703d['monitor_format']){logger['info']('['+_0x1e9255[_0x4d7a('0x65')][_0x4d7a('0x91')]()+']',_0x4d7a('0x7d'));_0x1e9255['recordingURL']=_0x122f58['serverUrl']+'/api/voice/recordings/'+_0x1e9255[_0x4d7a('0x80')]+_0x4d7a('0x81')+md5(_0x1e9255[_0x4d7a('0x80')]);}else{_0x1e9255['recordingURL']='';}var _0x3c1bad=_0x122f58[_0x4d7a('0x78')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x122f58)[_0x4d7a('0x29')](function(_0x2727db){_0x1fbfd5=_0x2727db;return getUser(_0x1fbfd5,_0x3c1bad,_0x122f58);})[_0x4d7a('0x29')](function(_0x5181d1){_0x50fc54=_0x5181d1;logger['info'](_0x4d7a('0x84'),_0x50fc54['id']);return getEndUser(_0x1fbfd5,_0x3c1bad,_0x122f58,_0x1e9255['calleridname'],_0x1e9255['calleridnum'],_0x50fc54,_0x37d683);})[_0x4d7a('0x29')](function(_0x14d851){_0x3278b3=_0x14d851;return getCall(_0x1fbfd5,_0x3c1bad,_0x122f58,_0x50fc54,_0x3278b3,_0x37d683,_0x1e9255,'Inbound');})[_0x4d7a('0x29')](function(_0x2d96b8){if(_0x2d96b8){logger[_0x4d7a('0x2f')](_0x4d7a('0x85'),_0x2d96b8['id']);}})[_0x4d7a('0x2c')](function(_0x23643e){logger[_0x4d7a('0x2d')]('['+_0x1e9255[_0x4d7a('0x65')][_0x4d7a('0x91')]()+']',JSON['stringify'](_0x23643e));});}; \ 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 c616bd3..581f8be 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(_0x210684,_0x52e865){var _0x477480=function(_0x139d59){while(--_0x139d59){_0x210684['push'](_0x210684['shift']());}};_0x477480(++_0x52e865);}(_0x7a54,0x106));var _0x47a5=function(_0x3fb349,_0x33de01){_0x3fb349=_0x3fb349-0x0;var _0x20b515=_0x7a54[_0x3fb349];return _0x20b515;};'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(_0x1134fa,_0x254b1c){var _0x3077ed=function(_0xd08316){while(--_0xd08316){_0x1134fa['push'](_0x1134fa['shift']());}};_0x3077ed(++_0x254b1c);}(_0x7a54,0x106));var _0x47a5=function(_0x10fbda,_0x5c591b){_0x10fbda=_0x10fbda-0x0;var _0x5849b9=_0x7a54[_0x10fbda];return _0x5849b9;};'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 4f34d92..1aa5b72 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(_0x323709,_0x5ca060){var _0x535831=function(_0x1ec21a){while(--_0x1ec21a){_0x323709['push'](_0x323709['shift']());}};_0x535831(++_0x5ca060);}(_0x5f2f,0x73));var _0xf5f2=function(_0x81bfd4,_0x483618){_0x81bfd4=_0x81bfd4-0x0;var _0x3c6116=_0x5f2f[_0x81bfd4];return _0x3c6116;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x1b9cf5,_0x1d4b8d){var _0x218168=function(_0x39bf42){while(--_0x39bf42){_0x1b9cf5['push'](_0x1b9cf5['shift']());}};_0x218168(++_0x1d4b8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x137556,_0x253216){_0x137556=_0x137556-0x0;var _0x41dc31=_0xb10b[_0x137556];return _0x41dc31;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 22df6fa..e5072d1 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 _0x28e3=['../../config/logger','routing','http','Request','request','then','error','rpc','message','exports','jayson/promise','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x28e3,0x106));var _0x328e=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x28e3[_0x308213];return _0x2e1619;};'use strict';var jayson=require(_0x328e('0x0'));var BPromise=require(_0x328e('0x1'));var logger=require(_0x328e('0x2'))(_0x328e('0x3'));var client=jayson['client'][_0x328e('0x4')]({'port':0x2329});client[_0x328e('0x5')]=function(_0x106c30,_0x168893){return new BPromise(function(_0x8cdc14,_0x15aade){return client[_0x328e('0x6')](_0x106c30,_0x168893)[_0x328e('0x7')](function(_0x5e5bcf){logger['debug']('rpc',_0x328e('0x3'),_0x106c30,_0x168893,_0x5e5bcf);if(_0x5e5bcf[_0x328e('0x8')]){logger[_0x328e('0x8')](_0x328e('0x9'),_0x328e('0x3'),_0x106c30,_0x5e5bcf['error'][_0x328e('0xa')],_0x168893);return _0x15aade(_0x5e5bcf[_0x328e('0x8')][_0x328e('0xa')]);}else{return _0x8cdc14(_0x5e5bcf['result']);}})['catch'](function(_0x4c366c){logger[_0x328e('0x8')](_0x328e('0x9'),_0x328e('0x3'),_0x106c30,_0x4c366c,_0x168893);return _0x15aade(_0x4c366c);});});};module[_0x328e('0xb')]=client; \ No newline at end of file +var _0xff2a=['http','then','debug','rpc','routing','error','catch','bluebird','../../config/logger','client'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xff2a,0x93));var _0xaff2=function(_0x3e2e40,_0x5e42ed){_0x3e2e40=_0x3e2e40-0x0;var _0x3cdf0a=_0xff2a[_0x3e2e40];return _0x3cdf0a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xaff2('0x0'));var logger=require(_0xaff2('0x1'))('routing');var client=jayson[_0xaff2('0x2')][_0xaff2('0x3')]({'port':0x2329});client['Request']=function(_0x256bf0,_0x5c7c1c){return new BPromise(function(_0x1cf624,_0x300723){return client['request'](_0x256bf0,_0x5c7c1c)[_0xaff2('0x4')](function(_0x8313e5){logger[_0xaff2('0x5')](_0xaff2('0x6'),_0xaff2('0x7'),_0x256bf0,_0x5c7c1c,_0x8313e5);if(_0x8313e5[_0xaff2('0x8')]){logger[_0xaff2('0x8')](_0xaff2('0x6'),_0xaff2('0x7'),_0x256bf0,_0x8313e5[_0xaff2('0x8')]['message'],_0x5c7c1c);return _0x300723(_0x8313e5[_0xaff2('0x8')]['message']);}else{return _0x1cf624(_0x8313e5['result']);}})[_0xaff2('0x9')](function(_0x4447e1){logger[_0xaff2('0x8')](_0xaff2('0x6'),_0xaff2('0x7'),_0x256bf0,_0x4447e1,_0x5c7c1c);return _0x300723(_0x4447e1);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index eb8ecf9..e845929 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 _0xeda8=['mailAccounts','listen','Setting','loginMailFrequency','catch','bluebird','./server','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x1999fe,_0xc888cf){var _0xabf9b3=function(_0x23a204){while(--_0x23a204){_0x1999fe['push'](_0x1999fe['shift']());}};_0xabf9b3(++_0xc888cf);}(_0xeda8,0x104));var _0x8eda=function(_0x2a5fa7,_0x20b9d2){_0x2a5fa7=_0x2a5fa7-0x0;var _0x26f97e=_0xeda8[_0x2a5fa7];return _0x26f97e;};'use strict';var BPromise=require(_0x8eda('0x0'));var server=require(_0x8eda('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x8eda('0x2'));var mailAccount=require(_0x8eda('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x8eda('0x4'))['db'];function initRealtime(){return BPromise[_0x8eda('0x5')]()[_0x8eda('0x6')](mailAccount[_0x8eda('0x7')]())[_0x8eda('0x6')](realtime[_0x8eda('0x8')]())[_0x8eda('0x6')](function(){email[_0x8eda('0x9')](realtime[_0x8eda('0xa')]);return realtime;});}function main(){return server[_0x8eda('0xb')](realtime,email)['then'](function(_0x28b721){return initRealtime();})[_0x8eda('0x6')](function(_0x5aa93d){return db[_0x8eda('0xc')]['findOne']({'attributes':['id','loginMailFrequency'],'raw':!![]});})['then'](function(_0x4fbf0a){return setInterval(initRealtime,_0x4fbf0a[_0x8eda('0xd')]*0x3e8);})[_0x8eda('0xe')](function(_0x41442d){console['log'](_0x41442d);});}main(); \ No newline at end of file +var _0x1ac2=['log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x14fd8d,_0x2619a8){var _0x4b3548=function(_0xa32e46){while(--_0xa32e46){_0x14fd8d['push'](_0x14fd8d['shift']());}};_0x4b3548(++_0x2619a8);}(_0x1ac2,0xfd));var _0x21ac=function(_0x5be901,_0x3d0145){_0x5be901=_0x5be901-0x0;var _0x194714=_0x1ac2[_0x5be901];return _0x194714;};'use strict';var BPromise=require(_0x21ac('0x0'));var server=require(_0x21ac('0x1'));var Realtime=require(_0x21ac('0x2'));var EmailChannel=require(_0x21ac('0x3'));var mailAccount=require(_0x21ac('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x21ac('0x5'))['db'];function initRealtime(){return BPromise[_0x21ac('0x6')]()[_0x21ac('0x7')](mailAccount[_0x21ac('0x8')]())[_0x21ac('0x7')](realtime[_0x21ac('0x9')]())['then'](function(){email[_0x21ac('0xa')](realtime[_0x21ac('0xb')]);return realtime;});}function main(){return server[_0x21ac('0xc')](realtime,email)['then'](function(_0x361eb0){return initRealtime();})[_0x21ac('0x7')](function(_0x443ec5){return db[_0x21ac('0xd')][_0x21ac('0xe')]({'attributes':['id',_0x21ac('0xf')],'raw':!![]});})[_0x21ac('0x7')](function(_0x5d7ae7){return setInterval(initRealtime,_0x5d7ae7[_0x21ac('0xf')]*0x3e8);})[_0x21ac('0x10')](function(_0x1a9561){console[_0x21ac('0x11')](_0x1a9561);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e418115..43db491 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 _0x5f2a=['../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','prototype','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','smtp','verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','bluebird','ioredis'];(function(_0x1a4e8a,_0x323828){var _0x4195ff=function(_0x571f0f){while(--_0x571f0f){_0x1a4e8a['push'](_0x1a4e8a['shift']());}};_0x4195ff(++_0x323828);}(_0x5f2a,0x12e));var _0xa5f2=function(_0x557b9f,_0x5863a6){_0x557b9f=_0x557b9f-0x0;var _0x14eeab=_0x5f2a[_0x557b9f];return _0x14eeab;};'use strict';var _=require(_0xa5f2('0x0'));var moment=require(_0xa5f2('0x1'));var BPromise=require(_0xa5f2('0x2'));var md5=require('md5');var Redis=require(_0xa5f2('0x3'));var config=require('../../../config/environment');var logger=require(_0xa5f2('0x4'))(_0xa5f2('0x5'));config[_0xa5f2('0x6')]=_[_0xa5f2('0x7')](config[_0xa5f2('0x6')],{'host':_0xa5f2('0x8'),'port':0x18eb});var io=require(_0xa5f2('0x9'))(new Redis(config[_0xa5f2('0x6')]));var EmailImap=require(_0xa5f2('0xa'));var EmailSmtp=require(_0xa5f2('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4a2983){logger[_0xa5f2('0xc')]('start\x20email\x20channel');this[_0xa5f2('0xd')]=_0x4a2983[_0xa5f2('0xd')];this[_0xa5f2('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xa5f2('0xf')]=function(_0x53c56d){var _0x5a2d39=this[_0xa5f2('0xd')][_0x53c56d];var _0x39e2d5={'id':_0x5a2d39['id'],'name':_0x5a2d39[_0xa5f2('0x10')],'key':_0x5a2d39[_0xa5f2('0x11')],'active':_0x5a2d39[_0xa5f2('0x12')],'Imap':{'status':_0x5a2d39[_0xa5f2('0x13')][_0xa5f2('0x14')],'messageStatus':_0x5a2d39[_0xa5f2('0x13')][_0xa5f2('0x15')],'total':_0x5a2d39[_0xa5f2('0x13')][_0xa5f2('0x16')]}};if(_[_0xa5f2('0x17')](md5Accounts[_0x53c56d])){md5Accounts[_0x53c56d]={};}var _0x10a8b9=md5(JSON[_0xa5f2('0x18')](_0x39e2d5));if(md5Accounts[_0x53c56d][_0xa5f2('0x19')]!==_0x10a8b9){md5Accounts[_0x53c56d]['md5']=_0x10a8b9;io[_0xa5f2('0xf')]('mailAccount:update',_0x39e2d5);}};EmailChannel[_0xa5f2('0x1a')][_0xa5f2('0x1b')]=function(_0x473a25){for(var _0x3a321f in _0x473a25){if(_0x473a25[_0xa5f2('0x1c')](_0x3a321f)){if(_0x473a25[_0x3a321f][_0xa5f2('0x13')]&&_0x473a25[_0x3a321f][_0xa5f2('0x12')]){var _0x3fd67a=_0x473a25[_0x3a321f][_0xa5f2('0x13')];if(!this[_0xa5f2('0xe')][_0xa5f2('0x1c')](_0x3fd67a['id'])){this[_0xa5f2('0xe')][_0x3fd67a['id']]=new EmailImap(_0x3fd67a,_0x473a25[_0x3a321f][_0xa5f2('0x5')]);this[_0xa5f2('0xe')][_0x3fd67a['id']]['on']('box',this[_0xa5f2('0x1d')][_0xa5f2('0x1e')](this,_0x3a321f));this[_0xa5f2('0xe')][_0x3fd67a['id']]['on'](_0xa5f2('0x5'),this[_0xa5f2('0x1f')][_0xa5f2('0x1e')](this,_0x3a321f));this['imapAccounts'][_0x3fd67a['id']]['on']('end',this['handleImapEnd'][_0xa5f2('0x1e')](this,_0x3a321f));this['imapAccounts'][_0x3fd67a['id']]['on'](_0xa5f2('0x20'),this[_0xa5f2('0x21')][_0xa5f2('0x1e')](this,_0x3a321f));}}else{if(_[_0xa5f2('0x17')](this['mailAccounts'][_0x3a321f][_0xa5f2('0x13')])){this[_0xa5f2('0xd')][_0x3a321f][_0xa5f2('0x13')]={};}this[_0xa5f2('0xd')][_0x3a321f][_0xa5f2('0x13')][_0xa5f2('0x14')]=_0xa5f2('0x22');this[_0xa5f2('0xd')][_0x3a321f]['Imap'][_0xa5f2('0x15')]='';this[_0xa5f2('0xf')](_0x3a321f);}}}};EmailChannel[_0xa5f2('0x1a')][_0xa5f2('0x1d')]=function(_0x15a02c,_0x412308){if(this[_0xa5f2('0xd')][_0x15a02c]){this[_0xa5f2('0xd')][_0x15a02c][_0xa5f2('0x13')]['status']='connected';this[_0xa5f2('0xd')][_0x15a02c]['Imap'][_0xa5f2('0x15')]=_0x412308[_0xa5f2('0x10')];if(_0x412308['messages']){this[_0xa5f2('0xd')][_0x15a02c][_0xa5f2('0x13')][_0xa5f2('0x16')]=_0x412308['messages'][_0xa5f2('0x16')];}return this[_0xa5f2('0xf')](_0x15a02c);}};EmailChannel[_0xa5f2('0x1a')]['handleImapEmail']=function(_0x2fe9e8,_0x4d9f12){logger[_0xa5f2('0xc')](_0xa5f2('0x23'),_0x4d9f12[_0xa5f2('0x24')],_0x4d9f12[_0xa5f2('0x25')],_0x4d9f12[_0xa5f2('0x26')],_0x2fe9e8);if(this[_0xa5f2('0xd')][_0x2fe9e8]){return mailAccount[_0xa5f2('0x27')](_0x2fe9e8,_0x4d9f12)[_0xa5f2('0x28')](function(_0x3f7e5){if(_0x3f7e5){logger['info'](_0xa5f2('0x29'));}})[_0xa5f2('0x2a')](function(_0x3f1f86){logger[_0xa5f2('0x20')](_0xa5f2('0x2b'),JSON[_0xa5f2('0x18')](_0x3f1f86));});}};EmailChannel[_0xa5f2('0x1a')][_0xa5f2('0x2c')]=function(_0x3a3c7f){if(this[_0xa5f2('0xd')][_0x3a3c7f]&&this['mailAccounts'][_0x3a3c7f]['Imap']){if(this['imapAccounts'][this['mailAccounts'][_0x3a3c7f][_0xa5f2('0x13')]['id']]){delete this['imapAccounts'][this[_0xa5f2('0xd')][_0x3a3c7f]['Imap']['id']];}this['mailAccounts'][_0x3a3c7f]['Imap']['lastSync']=moment();this[_0xa5f2('0xf')](_0x3a3c7f);}};EmailChannel['prototype'][_0xa5f2('0x21')]=function(_0x2c1b6a,_0x2d7bdc){if(this[_0xa5f2('0xd')][_0x2c1b6a]){this['mailAccounts'][_0x2c1b6a][_0xa5f2('0x13')]['status']=_0xa5f2('0x20');this[_0xa5f2('0xd')][_0x2c1b6a][_0xa5f2('0x13')][_0xa5f2('0x15')]=_0x2d7bdc;return this[_0xa5f2('0xf')](_0x2c1b6a);}};EmailChannel[_0xa5f2('0x1a')]['sendMail']=function(_0x1c3d3f,_0x59252f){return this[_0xa5f2('0x2d')]['send'](_0x1c3d3f,_0x59252f);};EmailChannel[_0xa5f2('0x1a')][_0xa5f2('0x2e')]=function(_0x1773af){var _0x3e3dd5=this;if(this['mailAccounts'][_0x1773af['id']]){if(_[_0xa5f2('0x17')](this[_0xa5f2('0xd')][_0x1773af['id']]['Smtp'])){this[_0xa5f2('0xd')][_0x1773af['id']][_0xa5f2('0x2f')]={};}this[_0xa5f2('0xd')][_0x1773af['id']][_0xa5f2('0x2f')][_0xa5f2('0x30')]=moment();return new BPromise(function(_0x5a495c,_0x59e715){return _0x3e3dd5[_0xa5f2('0x2d')][_0xa5f2('0x31')](_0x1773af)[_0xa5f2('0x28')](function(_0x144d6f){_0x3e3dd5['mailAccounts'][_0x1773af['id']]['Smtp'][_0xa5f2('0x14')]=_0xa5f2('0x32');_0x3e3dd5[_0xa5f2('0xd')][_0x1773af['id']][_0xa5f2('0x2f')][_0xa5f2('0x15')]='';_0x3e3dd5[_0xa5f2('0xf')](_0x1773af['id']);_0x5a495c(_0x144d6f);})[_0xa5f2('0x2a')](function(_0x535f38){_0x3e3dd5[_0xa5f2('0xd')][_0x1773af['id']]['Smtp'][_0xa5f2('0x14')]=_0xa5f2('0x20');_0x3e3dd5['mailAccounts'][_0x1773af['id']][_0xa5f2('0x2f')][_0xa5f2('0x15')]=_0x535f38;_0x3e3dd5[_0xa5f2('0xf')](_0x1773af['id']);_0x59e715(_0x535f38);});});}return this[_0xa5f2('0x2d')]['verify'](_0x1773af);};module['exports']=EmailChannel; \ No newline at end of file +var _0x5ea4=['notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','../../../config/environment','email','redis','defaults','localhost','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','imapAccounts','box','bind','end','error','handleImapError','disabled','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from'];(function(_0x127473,_0x40fcd6){var _0x3f3836=function(_0x151b68){while(--_0x151b68){_0x127473['push'](_0x127473['shift']());}};_0x3f3836(++_0x40fcd6);}(_0x5ea4,0x1f4));var _0x45ea=function(_0x3f2f35,_0x2945be){_0x3f2f35=_0x3f2f35-0x0;var _0x33ca9b=_0x5ea4[_0x3f2f35];return _0x33ca9b;};'use strict';var _=require(_0x45ea('0x0'));var moment=require(_0x45ea('0x1'));var BPromise=require('bluebird');var md5=require(_0x45ea('0x2'));var Redis=require('ioredis');var config=require(_0x45ea('0x3'));var logger=require('../../../config/logger')(_0x45ea('0x4'));config[_0x45ea('0x5')]=_[_0x45ea('0x6')](config['redis'],{'host':_0x45ea('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x45ea('0x5')]));var EmailImap=require(_0x45ea('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x45ea('0x9'));var md5Accounts={};function EmailChannel(_0x1f9d0e){logger[_0x45ea('0xa')](_0x45ea('0xb'));this[_0x45ea('0xc')]=_0x1f9d0e[_0x45ea('0xc')];this['imapAccounts']={};this[_0x45ea('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x45ea('0xe')]=function(_0x5a1dab){var _0x5acd18=this['mailAccounts'][_0x5a1dab];var _0x29ba9={'id':_0x5acd18['id'],'name':_0x5acd18[_0x45ea('0xf')],'key':_0x5acd18[_0x45ea('0x10')],'active':_0x5acd18[_0x45ea('0x11')],'Imap':{'status':_0x5acd18[_0x45ea('0x12')][_0x45ea('0x13')],'messageStatus':_0x5acd18['Imap'][_0x45ea('0x14')],'total':_0x5acd18[_0x45ea('0x12')][_0x45ea('0x15')]}};if(_[_0x45ea('0x16')](md5Accounts[_0x5a1dab])){md5Accounts[_0x5a1dab]={};}var _0x424630=md5(JSON[_0x45ea('0x17')](_0x29ba9));if(md5Accounts[_0x5a1dab]['md5']!==_0x424630){md5Accounts[_0x5a1dab][_0x45ea('0x2')]=_0x424630;io[_0x45ea('0xe')](_0x45ea('0x18'),_0x29ba9);}};EmailChannel[_0x45ea('0x19')]['refresh']=function(_0x57ce07){for(var _0xe5bf37 in _0x57ce07){if(_0x57ce07[_0x45ea('0x1a')](_0xe5bf37)){if(_0x57ce07[_0xe5bf37][_0x45ea('0x12')]&&_0x57ce07[_0xe5bf37]['active']){var _0x14f833=_0x57ce07[_0xe5bf37][_0x45ea('0x12')];if(!this[_0x45ea('0x1b')][_0x45ea('0x1a')](_0x14f833['id'])){this[_0x45ea('0x1b')][_0x14f833['id']]=new EmailImap(_0x14f833,_0x57ce07[_0xe5bf37][_0x45ea('0x4')]);this[_0x45ea('0x1b')][_0x14f833['id']]['on'](_0x45ea('0x1c'),this['handleImapBox']['bind'](this,_0xe5bf37));this[_0x45ea('0x1b')][_0x14f833['id']]['on']('email',this['handleImapEmail'][_0x45ea('0x1d')](this,_0xe5bf37));this[_0x45ea('0x1b')][_0x14f833['id']]['on'](_0x45ea('0x1e'),this['handleImapEnd'][_0x45ea('0x1d')](this,_0xe5bf37));this['imapAccounts'][_0x14f833['id']]['on'](_0x45ea('0x1f'),this[_0x45ea('0x20')][_0x45ea('0x1d')](this,_0xe5bf37));}}else{if(_[_0x45ea('0x16')](this[_0x45ea('0xc')][_0xe5bf37][_0x45ea('0x12')])){this['mailAccounts'][_0xe5bf37]['Imap']={};}this[_0x45ea('0xc')][_0xe5bf37]['Imap'][_0x45ea('0x13')]=_0x45ea('0x21');this[_0x45ea('0xc')][_0xe5bf37][_0x45ea('0x12')][_0x45ea('0x14')]='';this[_0x45ea('0xe')](_0xe5bf37);}}}};EmailChannel[_0x45ea('0x19')]['handleImapBox']=function(_0x111cb6,_0x4b8303){if(this['mailAccounts'][_0x111cb6]){this[_0x45ea('0xc')][_0x111cb6][_0x45ea('0x12')][_0x45ea('0x13')]='connected';this[_0x45ea('0xc')][_0x111cb6][_0x45ea('0x12')][_0x45ea('0x14')]=_0x4b8303[_0x45ea('0xf')];if(_0x4b8303[_0x45ea('0x22')]){this['mailAccounts'][_0x111cb6][_0x45ea('0x12')][_0x45ea('0x15')]=_0x4b8303['messages'][_0x45ea('0x15')];}return this['emit'](_0x111cb6);}};EmailChannel[_0x45ea('0x19')][_0x45ea('0x23')]=function(_0xe420a,_0x145172){logger[_0x45ea('0xa')](_0x45ea('0x24'),_0x145172[_0x45ea('0x25')],_0x145172[_0x45ea('0x26')],_0x145172[_0x45ea('0x27')],_0xe420a);if(this[_0x45ea('0xc')][_0xe420a]){return mailAccount[_0x45ea('0x28')](_0xe420a,_0x145172)[_0x45ea('0x29')](function(_0x4eb117){if(_0x4eb117){logger[_0x45ea('0xa')](_0x45ea('0x2a'));}})[_0x45ea('0x2b')](function(_0xd56c02){logger['error'](_0x45ea('0x2c'),JSON[_0x45ea('0x17')](_0xd56c02));});}};EmailChannel['prototype'][_0x45ea('0x2d')]=function(_0x37e610){if(this[_0x45ea('0xc')][_0x37e610]&&this[_0x45ea('0xc')][_0x37e610][_0x45ea('0x12')]){if(this[_0x45ea('0x1b')][this[_0x45ea('0xc')][_0x37e610][_0x45ea('0x12')]['id']]){delete this[_0x45ea('0x1b')][this['mailAccounts'][_0x37e610][_0x45ea('0x12')]['id']];}this[_0x45ea('0xc')][_0x37e610][_0x45ea('0x12')][_0x45ea('0x2e')]=moment();this[_0x45ea('0xe')](_0x37e610);}};EmailChannel[_0x45ea('0x19')]['handleImapError']=function(_0x542dec,_0x5536e3){if(this[_0x45ea('0xc')][_0x542dec]){this['mailAccounts'][_0x542dec]['Imap']['status']=_0x45ea('0x1f');this[_0x45ea('0xc')][_0x542dec][_0x45ea('0x12')][_0x45ea('0x14')]=_0x5536e3;return this[_0x45ea('0xe')](_0x542dec);}};EmailChannel[_0x45ea('0x19')][_0x45ea('0x2f')]=function(_0x5d9042,_0x156140){return this[_0x45ea('0xd')][_0x45ea('0x30')](_0x5d9042,_0x156140);};EmailChannel['prototype'][_0x45ea('0x31')]=function(_0x28c37f){var _0x355b68=this;if(this[_0x45ea('0xc')][_0x28c37f['id']]){if(_[_0x45ea('0x16')](this[_0x45ea('0xc')][_0x28c37f['id']]['Smtp'])){this[_0x45ea('0xc')][_0x28c37f['id']][_0x45ea('0x32')]={};}this[_0x45ea('0xc')][_0x28c37f['id']][_0x45ea('0x32')]['lastSync']=moment();return new BPromise(function(_0x5e7c21,_0xdbd84c){return _0x355b68[_0x45ea('0xd')][_0x45ea('0x33')](_0x28c37f)[_0x45ea('0x29')](function(_0x1b0978){_0x355b68['mailAccounts'][_0x28c37f['id']][_0x45ea('0x32')][_0x45ea('0x13')]=_0x45ea('0x34');_0x355b68[_0x45ea('0xc')][_0x28c37f['id']][_0x45ea('0x32')]['messageStatus']='';_0x355b68[_0x45ea('0xe')](_0x28c37f['id']);_0x5e7c21(_0x1b0978);})[_0x45ea('0x2b')](function(_0x16dbff){_0x355b68[_0x45ea('0xc')][_0x28c37f['id']][_0x45ea('0x32')][_0x45ea('0x13')]=_0x45ea('0x1f');_0x355b68[_0x45ea('0xc')][_0x28c37f['id']]['Smtp']['messageStatus']=_0x16dbff;_0x355b68[_0x45ea('0xe')](_0x28c37f['id']);_0xdbd84c(_0x16dbff);});});}return this[_0x45ea('0xd')][_0x45ea('0x33')](_0x28c37f);};module[_0x45ea('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 724fbad..53528c7 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 _0x1666=['authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','end','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','upperFirst','path','util','imap','lodash','randomstring','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','getAccount','connTimeout','authTimeout','isNil','service'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1666,0x9f));var _0x6166=function(_0x54dad4,_0x40c2fa){_0x54dad4=_0x54dad4-0x0;var _0x135f6a=_0x1666[_0x54dad4];return _0x135f6a;};'use strict';var fs=require('fs');var path=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var Imap=require(_0x6166('0x2'));var _=require(_0x6166('0x3'));var rs=require(_0x6166('0x4'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0x6166('0x5')];var EventEmitter=require(_0x6166('0x6'))['EventEmitter'];var utils=require(_0x6166('0x7'));var logger=require(_0x6166('0x8'))(_0x6166('0x9'));function EmailImap(_0x41a2ad,_0x5adbf8){this[_0x6166('0xa')]=_0x6166('0xb');this[_0x6166('0xc')]=this['getAccount'](_0x41a2ad,_0x5adbf8);this[_0x6166('0x2')]=new Imap(this[_0x6166('0xc')]);this[_0x6166('0x2')][_0x6166('0xd')](_0x6166('0xe'),this[_0x6166('0xf')][_0x6166('0x10')](this));this[_0x6166('0x2')][_0x6166('0xd')]('end',this[_0x6166('0x11')][_0x6166('0x10')](this));this['imap']['on'](_0x6166('0x12'),this[_0x6166('0x13')][_0x6166('0x10')](this));this[_0x6166('0x2')][_0x6166('0x14')]();}util[_0x6166('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x6166('0x16')]=function(_0x566b0a,_0x46a2fa){var _0x18dd83={'connTimeout':_0x566b0a[_0x6166('0x17')]?_0x566b0a[_0x6166('0x17')]*0x3e8:0x2710,'authTimeout':_0x566b0a[_0x6166('0x18')]?_0x566b0a[_0x6166('0x18')]*0x3e8:0x1388};if(_[_0x6166('0x19')](_0x566b0a[_0x6166('0x1a')])){if(_0x566b0a[_0x6166('0x1b')]){_0x18dd83[_0x6166('0x1c')]=_0x566b0a[_0x6166('0x1c')];_0x18dd83[_0x6166('0x1d')]=_0x566b0a[_0x6166('0x1d')];}_0x18dd83[_0x6166('0x1e')]=_0x566b0a[_0x6166('0x1e')];_0x18dd83['port']=_0x566b0a[_0x6166('0x1f')]||0x3e1;if(_0x566b0a[_0x6166('0x20')]){_0x18dd83[_0x6166('0x20')]=!![];}else{_0x18dd83[_0x6166('0x20')]=![];_0x18dd83[_0x6166('0x21')]=_0x6166('0x22');}}else{_0x18dd83[_0x6166('0x1c')]=_0x566b0a[_0x6166('0x1c')];_0x18dd83[_0x6166('0x1d')]=_0x566b0a['password'];_0x18dd83[_0x6166('0x1e')]=utils[_0x6166('0x23')](_0x566b0a[_0x6166('0x1a')]);_0x18dd83['port']=0x3e1;_0x18dd83[_0x6166('0x20')]=!![];}_0x18dd83[_0x6166('0x9')]=_0x46a2fa||_0x566b0a[_0x6166('0x1c')]||_0x6166('0x24');return _0x18dd83;};EmailImap[_0x6166('0x25')]['handleReady']=function(){this[_0x6166('0x2')][_0x6166('0x26')](this['mailbox'],![],this[_0x6166('0x27')][_0x6166('0x10')](this));};EmailImap[_0x6166('0x25')][_0x6166('0x27')]=function(_0x3df068,_0x4f129c){if(_0x3df068){this[_0x6166('0x13')](_0x3df068,!![]);}else{this[_0x6166('0x28')]('box',_0x4f129c);this[_0x6166('0x29')]();}};EmailImap[_0x6166('0x25')][_0x6166('0x2a')]=function(_0xc0aa23){if(_0xc0aa23){this[_0x6166('0x13')](_0xc0aa23,!![]);}else{this[_0x6166('0x2')][_0x6166('0x2b')]();}};EmailImap['prototype'][_0x6166('0x29')]=function(){this['imap']['search']([_0x6166('0x2c')],this[_0x6166('0x2d')][_0x6166('0x10')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4402a3,_0x48f785){if(_0x4402a3){this[_0x6166('0x13')](_0x4402a3,!![]);}else{if(_0x48f785[_0x6166('0x2e')]){try{var _0x3746c8=this[_0x6166('0x2')][_0x6166('0x2f')](_0x48f785,{'bodies':'','markSeen':!![]});_0x3746c8['on']('message',this[_0x6166('0x30')][_0x6166('0x10')](this));_0x3746c8[_0x6166('0xd')](_0x6166('0x12'),this[_0x6166('0x31')][_0x6166('0x10')](this));_0x3746c8['once'](_0x6166('0x2b'),this[_0x6166('0x32')]['bind'](this));}catch(_0x711c0c){logger['error'](_0x711c0c);}}else{this['imap'][_0x6166('0x33')](!![],this[_0x6166('0x2a')][_0x6166('0x10')](this));}}};EmailImap[_0x6166('0x25')][_0x6166('0x30')]=function(_0xa68360,_0x3b88ff){_0xa68360['on'](_0x6166('0x34'),this[_0x6166('0x35')][_0x6166('0x10')](this));_0xa68360[_0x6166('0xd')](_0x6166('0x36'),this['handleMessageAttributes'][_0x6166('0x10')](this));_0xa68360[_0x6166('0xd')](_0x6166('0x2b'),this[_0x6166('0x37')][_0x6166('0x10')](this));};EmailImap[_0x6166('0x25')]['handleMessageBody']=function(_0x1f014b,_0x20fb9d){simpleParser(_0x1f014b,{'Iconv':Iconv},this[_0x6166('0x38')][_0x6166('0x10')](this));};EmailImap[_0x6166('0x25')][_0x6166('0x39')]=function(_0x3acaff){};EmailImap['prototype'][_0x6166('0x37')]=function(){};EmailImap[_0x6166('0x25')][_0x6166('0x38')]=function(_0xe91aea,_0x18ad0b){if(_0xe91aea){logger[_0x6166('0x12')](_0xe91aea);}else{var _0x411cbd=this;utils[_0x6166('0x3a')](this[_0x6166('0xc')],_0x18ad0b,function(_0x27ddf1){_0x411cbd[_0x6166('0x28')](_0x6166('0x9'),_0x27ddf1);});}};EmailImap[_0x6166('0x25')]['handleFetchEnd']=function(){this[_0x6166('0x2')][_0x6166('0x33')](!![],this['handleCloseBox'][_0x6166('0x10')](this));};EmailImap[_0x6166('0x25')][_0x6166('0x31')]=function(_0x2e9232){this[_0x6166('0x13')](_0x2e9232);this['imap'][_0x6166('0x33')](!![],this[_0x6166('0x2a')][_0x6166('0x10')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x6166('0x28')]('end');};EmailImap[_0x6166('0x25')][_0x6166('0x13')]=function(_0x1db355,_0x45f55b){logger[_0x6166('0x12')](_0x6166('0x13'),this[_0x6166('0xc')]['email'],JSON[_0x6166('0x3b')](_0x1db355));var _0x129481='';if(_0x1db355){if(_0x1db355[_0x6166('0x3c')]){_0x129481=_0x1db355['textCode'];}else{for(var _0x19a29c in _0x1db355){if(_0x1db355['hasOwnProperty'](_0x19a29c)){_0x129481+=_[_0x6166('0x3d')](_0x19a29c)+':\x20'+_0x1db355[_0x19a29c]+'\x0a';}}}}if(_0x45f55b){this[_0x6166('0x2')]['end']();}else{this[_0x6166('0x28')]('error',_0x129481);this[_0x6166('0x28')](_0x6166('0x2b'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xc232=['mailbox','INBOX','account','once','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','email','handleFetchEnd','closeBox','stringify','textCode','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger'];(function(_0x91e64,_0x3fa61c){var _0x29b581=function(_0xf1df37){while(--_0xf1df37){_0x91e64['push'](_0x91e64['shift']());}};_0x29b581(++_0x3fa61c);}(_0xc232,0x1ca));var _0x2c23=function(_0x248808,_0x44eef7){_0x248808=_0x248808-0x0;var _0x49e79f=_0xc232[_0x248808];return _0x49e79f;};'use strict';var fs=require('fs');var path=require(_0x2c23('0x0'));var util=require('util');var Imap=require(_0x2c23('0x1'));var _=require(_0x2c23('0x2'));var rs=require(_0x2c23('0x3'));var simpleParser=require(_0x2c23('0x4'))[_0x2c23('0x5')];var Iconv=require(_0x2c23('0x6'))[_0x2c23('0x7')];var EventEmitter=require(_0x2c23('0x8'))['EventEmitter'];var utils=require(_0x2c23('0x9'));var logger=require(_0x2c23('0xa'))('email');function EmailImap(_0x24ee8f,_0x1411d3){this[_0x2c23('0xb')]=_0x2c23('0xc');this[_0x2c23('0xd')]=this['getAccount'](_0x24ee8f,_0x1411d3);this[_0x2c23('0x1')]=new Imap(this[_0x2c23('0xd')]);this['imap'][_0x2c23('0xe')](_0x2c23('0xf'),this[_0x2c23('0x10')]['bind'](this));this[_0x2c23('0x1')]['once'](_0x2c23('0x11'),this[_0x2c23('0x12')]['bind'](this));this[_0x2c23('0x1')]['on'](_0x2c23('0x13'),this[_0x2c23('0x14')][_0x2c23('0x15')](this));this[_0x2c23('0x1')][_0x2c23('0x16')]();}util[_0x2c23('0x17')](EmailImap,EventEmitter);EmailImap[_0x2c23('0x18')][_0x2c23('0x19')]=function(_0x71d808,_0x25b7f1){var _0x510c8d={'connTimeout':_0x71d808[_0x2c23('0x1a')]?_0x71d808[_0x2c23('0x1a')]*0x3e8:0x2710,'authTimeout':_0x71d808[_0x2c23('0x1b')]?_0x71d808[_0x2c23('0x1b')]*0x3e8:0x1388};if(_[_0x2c23('0x1c')](_0x71d808[_0x2c23('0x1d')])){if(_0x71d808[_0x2c23('0x1e')]){_0x510c8d['user']=_0x71d808[_0x2c23('0x1f')];_0x510c8d[_0x2c23('0x20')]=_0x71d808['password'];}_0x510c8d[_0x2c23('0x21')]=_0x71d808['host'];_0x510c8d[_0x2c23('0x22')]=_0x71d808[_0x2c23('0x22')]||0x3e1;if(_0x71d808[_0x2c23('0x23')]){_0x510c8d['tls']=!![];}else{_0x510c8d['tls']=![];_0x510c8d[_0x2c23('0x24')]=_0x2c23('0x25');}}else{_0x510c8d[_0x2c23('0x1f')]=_0x71d808[_0x2c23('0x1f')];_0x510c8d['password']=_0x71d808[_0x2c23('0x20')];_0x510c8d['host']=utils[_0x2c23('0x26')](_0x71d808['service']);_0x510c8d['port']=0x3e1;_0x510c8d['tls']=!![];}_0x510c8d['email']=_0x25b7f1||_0x71d808[_0x2c23('0x1f')]||_0x2c23('0x27');return _0x510c8d;};EmailImap[_0x2c23('0x18')]['handleReady']=function(){this[_0x2c23('0x1')][_0x2c23('0x28')](this[_0x2c23('0xb')],![],this[_0x2c23('0x29')][_0x2c23('0x15')](this));};EmailImap[_0x2c23('0x18')][_0x2c23('0x29')]=function(_0x5b4f92,_0x9f0f6){if(_0x5b4f92){this[_0x2c23('0x14')](_0x5b4f92,!![]);}else{this['emit'](_0x2c23('0x2a'),_0x9f0f6);this[_0x2c23('0x2b')]();}};EmailImap[_0x2c23('0x18')][_0x2c23('0x2c')]=function(_0x368695){if(_0x368695){this['handleError'](_0x368695,!![]);}else{this[_0x2c23('0x1')]['end']();}};EmailImap[_0x2c23('0x18')][_0x2c23('0x2b')]=function(){this[_0x2c23('0x1')][_0x2c23('0x2d')]([_0x2c23('0x2e')],this[_0x2c23('0x2f')]['bind'](this));};EmailImap[_0x2c23('0x18')][_0x2c23('0x2f')]=function(_0x258b96,_0x6f2741){if(_0x258b96){this[_0x2c23('0x14')](_0x258b96,!![]);}else{if(_0x6f2741[_0x2c23('0x30')]){try{var _0x4bbbb8=this[_0x2c23('0x1')][_0x2c23('0x31')](_0x6f2741,{'bodies':'','markSeen':!![]});_0x4bbbb8['on'](_0x2c23('0x32'),this['handleFetchMessage'][_0x2c23('0x15')](this));_0x4bbbb8['once'](_0x2c23('0x13'),this[_0x2c23('0x33')][_0x2c23('0x15')](this));_0x4bbbb8[_0x2c23('0xe')](_0x2c23('0x11'),this['handleFetchEnd'][_0x2c23('0x15')](this));}catch(_0x197014){logger[_0x2c23('0x13')](_0x197014);}}else{this[_0x2c23('0x1')]['closeBox'](!![],this[_0x2c23('0x2c')][_0x2c23('0x15')](this));}}};EmailImap['prototype'][_0x2c23('0x34')]=function(_0xcfa6a8,_0xe5ed73){_0xcfa6a8['on']('body',this[_0x2c23('0x35')][_0x2c23('0x15')](this));_0xcfa6a8[_0x2c23('0xe')](_0x2c23('0x36'),this[_0x2c23('0x37')][_0x2c23('0x15')](this));_0xcfa6a8['once']('end',this[_0x2c23('0x38')][_0x2c23('0x15')](this));};EmailImap['prototype'][_0x2c23('0x35')]=function(_0x4735a5,_0x447573){simpleParser(_0x4735a5,{'Iconv':Iconv},this['handleSimpleParser'][_0x2c23('0x15')](this));};EmailImap['prototype'][_0x2c23('0x37')]=function(_0x544fe6){};EmailImap['prototype'][_0x2c23('0x38')]=function(){};EmailImap['prototype'][_0x2c23('0x39')]=function(_0x30d626,_0x9bb3d2){if(_0x30d626){logger[_0x2c23('0x13')](_0x30d626);}else{var _0x5502e4=this;utils[_0x2c23('0x3a')](this[_0x2c23('0xd')],_0x9bb3d2,function(_0x351391){_0x5502e4[_0x2c23('0x3b')](_0x2c23('0x3c'),_0x351391);});}};EmailImap[_0x2c23('0x18')][_0x2c23('0x3d')]=function(){this[_0x2c23('0x1')][_0x2c23('0x3e')](!![],this[_0x2c23('0x2c')][_0x2c23('0x15')](this));};EmailImap[_0x2c23('0x18')][_0x2c23('0x33')]=function(_0x15476d){this['handleError'](_0x15476d);this[_0x2c23('0x1')][_0x2c23('0x3e')](!![],this[_0x2c23('0x2c')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x2c23('0x3b')](_0x2c23('0x11'));};EmailImap[_0x2c23('0x18')][_0x2c23('0x14')]=function(_0x36f48b,_0x4d3479){logger[_0x2c23('0x13')](_0x2c23('0x14'),this['account'][_0x2c23('0x3c')],JSON[_0x2c23('0x3f')](_0x36f48b));var _0x62211a='';if(_0x36f48b){if(_0x36f48b[_0x2c23('0x40')]){_0x62211a=_0x36f48b[_0x2c23('0x40')];}else{for(var _0x29fe41 in _0x36f48b){if(_0x36f48b['hasOwnProperty'](_0x29fe41)){_0x62211a+=_[_0x2c23('0x41')](_0x29fe41)+':\x20'+_0x36f48b[_0x29fe41]+'\x0a';}}}}if(_0x4d3479){this[_0x2c23('0x1')][_0x2c23('0x11')]();}else{this[_0x2c23('0x3b')](_0x2c23('0x13'),_0x62211a);this[_0x2c23('0x3b')](_0x2c23('0x11'));}};module[_0x2c23('0x42')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b94294d..5758ecb 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 _0x2f8d=['compile','prototype','verify','toString','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','send','createTransport','use'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2f8d,0x1a8));var _0xd2f8=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2f8d[_0x110c3d];return _0x226d67;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xd2f8('0x0'));var inlineBase64=require(_0xd2f8('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xd2f8('0x2')]=function(_0x457552,_0x4e4a0f){return new BPromise(function(_0x4e9c32,_0x12304e){var _0x57db1d=nodemailer[_0xd2f8('0x3')](_0x457552);_0x57db1d[_0xd2f8('0x4')](_0xd2f8('0x5'),inlineBase64());_0x57db1d['sendMail'](_0x4e4a0f,function(_0x268b3e,_0x5de442){if(_0x268b3e){_0x12304e(_0x268b3e['toString']());}else{_0x4e9c32(_0x5de442);}});});};EmailSmtp[_0xd2f8('0x6')][_0xd2f8('0x7')]=function(_0x223015){return new BPromise(function(_0x32afc1,_0x4e0479){var _0x21553e=nodemailer[_0xd2f8('0x3')](_0x223015);_0x21553e[_0xd2f8('0x7')](function(_0x1d521a,_0x59b19a){if(_0x1d521a){_0x4e0479(_0x1d521a[_0xd2f8('0x8')]());}else{if(_0x59b19a){_0x32afc1(_0x59b19a);}else{_0x4e0479(_0xd2f8('0x9'));}}});});};module[_0xd2f8('0xa')]=EmailSmtp; \ No newline at end of file +var _0xbce0=['prototype','send','compile','toString','verify','createTransport','exports','bluebird','nodemailer-plugin-inline-base64'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xbce0,0x97));var _0x0bce=function(_0x4b620d,_0x3c45c3){_0x4b620d=_0x4b620d-0x0;var _0x5d4489=_0xbce0[_0x4b620d];return _0x5d4489;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x0bce('0x0'));var inlineBase64=require(_0x0bce('0x1'));function EmailSmtp(){}EmailSmtp[_0x0bce('0x2')][_0x0bce('0x3')]=function(_0x1f67d4,_0x27a702){return new BPromise(function(_0x40f49d,_0x3e5cef){var _0x4ff8d9=nodemailer['createTransport'](_0x1f67d4);_0x4ff8d9['use'](_0x0bce('0x4'),inlineBase64());_0x4ff8d9['sendMail'](_0x27a702,function(_0x50a41b,_0x4f70f4){if(_0x50a41b){_0x3e5cef(_0x50a41b[_0x0bce('0x5')]());}else{_0x40f49d(_0x4f70f4);}});});};EmailSmtp['prototype'][_0x0bce('0x6')]=function(_0x2f8d14){return new BPromise(function(_0x7be9f2,_0x3f7fda){var _0xb02d0e=nodemailer[_0x0bce('0x7')](_0x2f8d14);_0xb02d0e[_0x0bce('0x6')](function(_0x5dad22,_0x47c969){if(_0x5dad22){_0x3f7fda(_0x5dad22[_0x0bce('0x5')]());}else{if(_0x47c969){_0x7be9f2(_0x47c969);}else{_0x3f7fda('Not\x20verifired');}}});});};module[_0x0bce('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e818271..e2c4121 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 _0x95d0=['value','address','generate','name','slice','Anonymous','split','pop','length','isEmpty','anonymous','@xcally.com','html','replace','body','textAsHtml','Empty\x20message

','Attachments','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','../../../config/logger','email','../../../config/environment','head'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x95d0,0x18a));var _0x095d=function(_0xb39bba,_0x385941){_0xb39bba=_0xb39bba-0x0;var _0x5c467b=_0x95d0[_0xb39bba];return _0x5c467b;};'use strict';var _=require(_0x095d('0x0'));var moment=require(_0x095d('0x1'));var random=require(_0x095d('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x095d('0x3'));var tnef=require('node-tnef');var logger=require(_0x095d('0x4'))(_0x095d('0x5'));var config=require(_0x095d('0x6'));function getAddress(_0x348039){var _0x430e98=_[_0x095d('0x7')](_0x348039[_0x095d('0x8')]);return _0x430e98&&_0x430e98[_0x095d('0x9')]?_0x430e98['address']:'anonymous'+random[_0x095d('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x2dd59a){var _0x200f13=_[_0x095d('0x7')](_0x2dd59a[_0x095d('0x8')]);if(_0x200f13&&_0x200f13[_0x095d('0xb')]){var _0x57e0f4=_0x200f13[_0x095d('0xb')]['split'](/\s+/);return _0x57e0f4['length']?_0x57e0f4[_0x095d('0xc')](0x0,-0x1)['join']('\x20'):_0x200f13[_0x095d('0xb')];}return _0x095d('0xd');}function getLastName(_0x3143c5){var _0x894430=_[_0x095d('0x7')](_0x3143c5['value']);if(_0x894430&&_0x894430[_0x095d('0xb')]){var _0x43eccc=_0x894430[_0x095d('0xb')][_0x095d('0xe')](/\s+/);return _0x43eccc['length']>0x1?_0x43eccc[_0x095d('0xf')]():'';}return'';}function getMails(_0x204bfd,_0x584460){var _0x770ed2='';for(var _0x3f2b04=0x0;_0x3f2b04<_0x584460['value'][_0x095d('0x10')];_0x3f2b04+=0x1){if(_0x584460[_0x095d('0x8')][_0x3f2b04][_0x095d('0x9')]!==_0x204bfd){if(!_[_0x095d('0x11')](_0x770ed2)){_0x770ed2+=',';}_0x770ed2+=_0x584460[_0x095d('0x8')][_0x3f2b04][_0x095d('0xb')]||_0x584460[_0x095d('0x8')][_0x3f2b04][_0x095d('0x9')]||'';_0x770ed2+='\x20<';_0x770ed2+=_0x584460[_0x095d('0x8')][_0x3f2b04][_0x095d('0x9')]?_0x584460[_0x095d('0x8')][_0x3f2b04][_0x095d('0x9')]:_0x095d('0x12')+random[_0x095d('0xa')](0x6)+_0x095d('0x13');_0x770ed2+='>';}}return _0x770ed2;}function parseEmail(_0x58c2e2,_0x1b2065,_0x3fe113){if(_0x1b2065[_0x095d('0x14')]){var _0x5bde2e=/)<[^<]*)*<\/script>/gi;while(_0x5bde2e['test'](_0x1b2065[_0x095d('0x14')])){_0x1b2065[_0x095d('0x14')]=_0x1b2065[_0x095d('0x14')][_0x095d('0x15')](_0x5bde2e,'');}_0x3fe113['body']=_0x1b2065[_0x095d('0x14')];}else{_0x3fe113[_0x095d('0x16')]=_0x1b2065[_0x095d('0x17')];}if(_0x3fe113[_0x095d('0x16')]){_0x3fe113[_0x095d('0x16')]=_0x3fe113[_0x095d('0x16')][_0x095d('0x15')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','length','slice','split','pop','isEmpty','generate','test','html','replace','body','textAsHtml','message','originTo','originCc','bcc','attachments','attach','attachment'];(function(_0x402a43,_0x68abb5){var _0xe8bc0=function(_0x107f92){while(--_0x107f92){_0x402a43['push'](_0x402a43['shift']());}};_0xe8bc0(++_0x68abb5);}(_0xd15a,0x1e8));var _0xad15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd15a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xad15('0x0'));var moment=require(_0xad15('0x1'));var random=require(_0xad15('0x2'));var fs=require('fs');var path=require(_0xad15('0x3'));var util=require(_0xad15('0x4'));var tnef=require('node-tnef');var logger=require(_0xad15('0x5'))(_0xad15('0x6'));var config=require(_0xad15('0x7'));function getAddress(_0x34013a){var _0x160de3=_[_0xad15('0x8')](_0x34013a[_0xad15('0x9')]);return _0x160de3&&_0x160de3[_0xad15('0xa')]?_0x160de3[_0xad15('0xa')]:_0xad15('0xb')+random['generate'](0x6)+_0xad15('0xc');}function getFirstName(_0x4cd200){var _0x3ec806=_[_0xad15('0x8')](_0x4cd200['value']);if(_0x3ec806&&_0x3ec806['name']){var _0x2d7232=_0x3ec806[_0xad15('0xd')]['split'](/\s+/);return _0x2d7232[_0xad15('0xe')]?_0x2d7232[_0xad15('0xf')](0x0,-0x1)['join']('\x20'):_0x3ec806['name'];}return'Anonymous';}function getLastName(_0x251bc4){var _0x14c21d=_[_0xad15('0x8')](_0x251bc4['value']);if(_0x14c21d&&_0x14c21d[_0xad15('0xd')]){var _0xbdf927=_0x14c21d['name'][_0xad15('0x10')](/\s+/);return _0xbdf927['length']>0x1?_0xbdf927[_0xad15('0x11')]():'';}return'';}function getMails(_0x16bbe0,_0x8610f8){var _0x1c9c0b='';for(var _0x5cc603=0x0;_0x5cc603<_0x8610f8[_0xad15('0x9')][_0xad15('0xe')];_0x5cc603+=0x1){if(_0x8610f8[_0xad15('0x9')][_0x5cc603]['address']!==_0x16bbe0){if(!_[_0xad15('0x12')](_0x1c9c0b)){_0x1c9c0b+=',';}_0x1c9c0b+=_0x8610f8[_0xad15('0x9')][_0x5cc603][_0xad15('0xd')]||_0x8610f8[_0xad15('0x9')][_0x5cc603][_0xad15('0xa')]||'';_0x1c9c0b+='\x20<';_0x1c9c0b+=_0x8610f8['value'][_0x5cc603][_0xad15('0xa')]?_0x8610f8[_0xad15('0x9')][_0x5cc603]['address']:_0xad15('0xb')+random[_0xad15('0x13')](0x6)+_0xad15('0xc');_0x1c9c0b+='>';}}return _0x1c9c0b;}function parseEmail(_0x52c3c5,_0x3ba360,_0x2ce95a){if(_0x3ba360['html']){var _0x5399fd=/)<[^<]*)*<\/script>/gi;while(_0x5399fd[_0xad15('0x14')](_0x3ba360['html'])){_0x3ba360[_0xad15('0x15')]=_0x3ba360['html'][_0xad15('0x16')](_0x5399fd,'');}_0x2ce95a[_0xad15('0x17')]=_0x3ba360[_0xad15('0x15')];}else{_0x2ce95a['body']=_0x3ba360[_0xad15('0x18')];}if(_0x2ce95a['body']){_0x2ce95a['body']=_0x2ce95a[_0xad15('0x17')][_0xad15('0x16')](/0x0){if(this[_0x3feed4+'Capacity']>0x0&&this[_0x3feed4+_0x6093('0x29')]>=this[_0x3feed4+_0x6093('0x2a')]){return'maxcapacity';}else{return _0x6093('0x2b');}}else{return _0x6093('0x2c');}};Agent['prototype'][_0x6093('0x26')]=function(){var _0x532212=['mail',_0x6093('0x2d'),_0x6093('0x2e'),'fax',_0x6093('0x2f'),'whatsapp'];for(var _0x15f926=0x0;_0x15f926<_0x532212[_0x6093('0x30')];_0x15f926+=0x1){var _0x62278e=this[_0x6093('0x28')](_0x532212[_0x15f926]);if(this[_0x532212[_0x15f926]+_0x6093('0x31')]!==_0x62278e){this[_0x532212[_0x15f926]+_0x6093('0x32')]=_[_0x6093('0x33')](moment()[_0x6093('0x34')]('x'));}this[_0x532212[_0x15f926]+_0x6093('0x31')]=_0x62278e;}var _0x48a2b2={'id':this['id'],'name':this[_0x6093('0x8')],'online':this[_0x6093('0x9')],'voicePause':this[_0x6093('0x35')],'chatPause':this[_0x6093('0xa')],'mailPause':this[_0x6093('0xb')],'smsPause':this[_0x6093('0xd')],'faxPause':this[_0x6093('0xc')],'openchannelPause':this[_0x6093('0x36')],'chatStatus':this[_0x6093('0xe')],'chatStatusTime':this[_0x6093('0x10')],'chatCapacity':this[_0x6093('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x6093('0x13')],'mailStatusTime':this[_0x6093('0x14')],'mailCapacity':this[_0x6093('0x15')],'mailCurrentCapacity':this[_0x6093('0x16')],'faxStatus':this[_0x6093('0x17')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x6093('0x19')],'faxCurrentCapacity':this[_0x6093('0x1a')],'smsStatus':this[_0x6093('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x6093('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6093('0x1f')],'whatsappCapacity':this[_0x6093('0x20')],'whatsappCurrentCapacity':this[_0x6093('0x21')],'openchannelStatus':this[_0x6093('0x37')],'openchannelStatusTime':this[_0x6093('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x6093('0x24')],'busyQueue':this[_0x6093('0x25')]};var _0x1b6ae0=md5(JSON[_0x6093('0x38')](_0x48a2b2));if(this[_0x6093('0x2')]!==_0x1b6ae0){this[_0x6093('0x2')]=_0x1b6ae0;io[_0x6093('0x39')]('user:save',_0x48a2b2);}};module[_0x6093('0x3a')]=Agent; \ No newline at end of file +var _0xa7b5=['length','getChannelStatus','Status','toNumber','format','mailStatus','faxCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','idle','mail','chat','openchannel','whatsapp'];(function(_0x2a57e4,_0x89981e){var _0x1fe67a=function(_0x58b036){while(--_0x58b036){_0x2a57e4['push'](_0x2a57e4['shift']());}};_0x1fe67a(++_0x89981e);}(_0xa7b5,0x162));var _0x5a7b=function(_0xabe8fc,_0xe90a91){_0xabe8fc=_0xabe8fc-0x0;var _0x1a19d5=_0xa7b5[_0xabe8fc];return _0x1a19d5;};'use strict';var _=require(_0x5a7b('0x0'));var moment=require(_0x5a7b('0x1'));var md5=require(_0x5a7b('0x2'));var Redis=require(_0x5a7b('0x3'));var config=require(_0x5a7b('0x4'));config['redis']=_[_0x5a7b('0x5')](config[_0x5a7b('0x6')],{'host':_0x5a7b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x233cb8){this['id']=_0x233cb8['id']||0x0;this[_0x5a7b('0x8')]=_0x233cb8['name']||'';this[_0x5a7b('0x9')]=_0x233cb8[_0x5a7b('0x9')]||!![];this[_0x5a7b('0xa')]=_0x233cb8[_0x5a7b('0xa')]||![];this[_0x5a7b('0xb')]=_0x233cb8['chatPause']||![];this[_0x5a7b('0xc')]=_0x233cb8['mailPause']||![];this[_0x5a7b('0xd')]=_0x233cb8[_0x5a7b('0xd')]||![];this['smsPause']=_0x233cb8[_0x5a7b('0xe')]||![];this['openchannelPause']=_0x233cb8[_0x5a7b('0xf')]||![];this[_0x5a7b('0x10')]=_0x5a7b('0x11');this[_0x5a7b('0x12')]=0x0;this['chatCapacity']=_0x233cb8['chatCapacity']||0x0;this[_0x5a7b('0x13')]=0x0;this['mailStatus']='unknown';this[_0x5a7b('0x14')]=0x0;this[_0x5a7b('0x15')]=_0x233cb8['mailCapacity']||0x0;this[_0x5a7b('0x16')]=0x0;this[_0x5a7b('0x17')]=_0x5a7b('0x11');this['faxStatusTime']=0x0;this[_0x5a7b('0x18')]=_0x233cb8[_0x5a7b('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x5a7b('0x19')]='unknown';this[_0x5a7b('0x1a')]=0x0;this['smsCapacity']=_0x233cb8[_0x5a7b('0x1b')]||0x0;this[_0x5a7b('0x1c')]=0x0;this[_0x5a7b('0x1d')]='unknown';this[_0x5a7b('0x1e')]=0x0;this[_0x5a7b('0x1f')]=_0x233cb8[_0x5a7b('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x5a7b('0x11');this['openchannelStatusTime']=0x0;this[_0x5a7b('0x20')]=_0x233cb8['openchannelCapacity']||0x0;this[_0x5a7b('0x21')]=0x0;this[_0x5a7b('0x22')]=![];this[_0x5a7b('0x23')]=undefined;this['md5']='';this[_0x5a7b('0x24')]();}Agent[_0x5a7b('0x25')]['getChannelStatus']=function(_0x178cd2){if(this[_0x178cd2+_0x5a7b('0x26')]>0x0){if(this[_0x178cd2+'Capacity']>0x0&&this[_0x178cd2+_0x5a7b('0x26')]>=this[_0x178cd2+_0x5a7b('0x27')]){return'maxcapacity';}else{return'working';}}else{return _0x5a7b('0x28');}};Agent[_0x5a7b('0x25')][_0x5a7b('0x24')]=function(){var _0x266d2f=[_0x5a7b('0x29'),_0x5a7b('0x2a'),_0x5a7b('0x2b'),'fax','sms',_0x5a7b('0x2c')];for(var _0x262cdc=0x0;_0x262cdc<_0x266d2f[_0x5a7b('0x2d')];_0x262cdc+=0x1){var _0x28c5d7=this[_0x5a7b('0x2e')](_0x266d2f[_0x262cdc]);if(this[_0x266d2f[_0x262cdc]+_0x5a7b('0x2f')]!==_0x28c5d7){this[_0x266d2f[_0x262cdc]+'StatusTime']=_[_0x5a7b('0x30')](moment()[_0x5a7b('0x31')]('x'));}this[_0x266d2f[_0x262cdc]+_0x5a7b('0x2f')]=_0x28c5d7;}var _0x10f937={'id':this['id'],'name':this['name'],'online':this[_0x5a7b('0x9')],'voicePause':this[_0x5a7b('0xa')],'chatPause':this[_0x5a7b('0xb')],'mailPause':this[_0x5a7b('0xc')],'smsPause':this[_0x5a7b('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x5a7b('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x5a7b('0x32')],'mailStatusTime':this[_0x5a7b('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5a7b('0x17')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x5a7b('0x18')],'faxCurrentCapacity':this[_0x5a7b('0x33')],'smsStatus':this[_0x5a7b('0x19')],'smsStatusTime':this[_0x5a7b('0x1a')],'smsCapacity':this[_0x5a7b('0x1b')],'smsCurrentCapacity':this[_0x5a7b('0x1c')],'whatsappStatus':this[_0x5a7b('0x1d')],'whatsappStatusTime':this[_0x5a7b('0x1e')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5a7b('0x34')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x5a7b('0x35')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5a7b('0x21')],'busy':this['busy'],'busyQueue':this[_0x5a7b('0x23')]};var _0xb8cb94=md5(JSON[_0x5a7b('0x36')](_0x10f937));if(this[_0x5a7b('0x2')]!==_0xb8cb94){this[_0x5a7b('0x2')]=_0xb8cb94;io[_0x5a7b('0x37')]('user:save',_0x10f937);}};module[_0x5a7b('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index cf0afcd..d594bdf 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 _0x3a59=['stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','map','prototype','updateRealtime','paused','online','loggedIn','chatPause','available'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x3a59,0x1eb));var _0x93a5=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x3a59[_0x340380];return _0x49ce1c;};'use strict';var _=require(_0x93a5('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x93a5('0x1'));config[_0x93a5('0x2')]=_[_0x93a5('0x3')](config[_0x93a5('0x2')],{'host':_0x93a5('0x4'),'port':0x18eb});var io=require(_0x93a5('0x5'))(new Redis(config[_0x93a5('0x2')]));function ChatQueue(_0x11bc72){this['id']=_0x11bc72['id']||0x0;this['name']=_0x11bc72[_0x93a5('0x6')]||'';this['timeout']=_0x11bc72['timeout']||0xa;this[_0x93a5('0x7')]=_0x11bc72[_0x93a5('0x7')]||'beepall';this[_0x93a5('0x8')]=_0x11bc72[_0x93a5('0x8')];this[_0x93a5('0x9')]={};this[_0x93a5('0xa')]=0x0;this[_0x93a5('0xb')]='';this[_0x93a5('0xc')]();this['updateRealtime']();}ChatQueue['prototype'][_0x93a5('0xc')]=function(){var _0x1be31c=this[_0x93a5('0x9')][_0x93a5('0xd')];this[_0x93a5('0x9')]=_[_0x93a5('0xe')](this[_0x93a5('0x8')],'id');this['mapAgentsId'][_0x93a5('0xd')]=_0x1be31c;};ChatQueue[_0x93a5('0xf')][_0x93a5('0x10')]=function(){this['loggedIn']=0x0;this[_0x93a5('0x11')]=0x0;for(var _0x5d3493=0x0;_0x5d3493=0x0?this[_0x93a5('0x15')]:0x0;var _0x2bbe48={'id':this['id'],'available':this['available'],'loggedIn':this[_0x93a5('0x13')],'name':this[_0x93a5('0x6')],'paused':this[_0x93a5('0x11')],'waiting':this[_0x93a5('0xa')]};var _0x4ac37a=md5(JSON[_0x93a5('0x16')](_0x2bbe48));if(this[_0x93a5('0xb')]!==_0x4ac37a){this[_0x93a5('0xb')]=_0x4ac37a;io['to'](util[_0x93a5('0x17')](_0x93a5('0x18'),_0x2bbe48[_0x93a5('0x6')]))[_0x93a5('0x19')](_0x93a5('0x1a'),_0x2bbe48);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x1d42=['format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','chatPause','available','stringify'];(function(_0x36fc72,_0x14ce51){var _0x4d4a99=function(_0x1ea86b){while(--_0x1ea86b){_0x36fc72['push'](_0x36fc72['shift']());}};_0x4d4a99(++_0x14ce51);}(_0x1d42,0x1e5));var _0x21d4=function(_0x286c4a,_0x3d559d){_0x286c4a=_0x286c4a-0x0;var _0x476a25=_0x1d42[_0x286c4a];return _0x476a25;};'use strict';var _=require(_0x21d4('0x0'));var md5=require(_0x21d4('0x1'));var util=require(_0x21d4('0x2'));var Redis=require(_0x21d4('0x3'));var config=require(_0x21d4('0x4'));config[_0x21d4('0x5')]=_[_0x21d4('0x6')](config['redis'],{'host':_0x21d4('0x7'),'port':0x18eb});var io=require(_0x21d4('0x8'))(new Redis(config[_0x21d4('0x5')]));function ChatQueue(_0x309261){this['id']=_0x309261['id']||0x0;this[_0x21d4('0x9')]=_0x309261['name']||'';this[_0x21d4('0xa')]=_0x309261[_0x21d4('0xa')]||0xa;this[_0x21d4('0xb')]=_0x309261['strategy']||_0x21d4('0xc');this[_0x21d4('0xd')]=_0x309261[_0x21d4('0xd')];this[_0x21d4('0xe')]={};this[_0x21d4('0xf')]=0x0;this[_0x21d4('0x1')]='';this['updateRouting']();this[_0x21d4('0x10')]();}ChatQueue[_0x21d4('0x11')][_0x21d4('0x12')]=function(){var _0x1e8d1b=this[_0x21d4('0xe')][_0x21d4('0x13')];this[_0x21d4('0xe')]=_['map'](this[_0x21d4('0xd')],'id');this[_0x21d4('0xe')][_0x21d4('0x13')]=_0x1e8d1b;};ChatQueue[_0x21d4('0x11')][_0x21d4('0x10')]=function(){this[_0x21d4('0x14')]=0x0;this[_0x21d4('0x15')]=0x0;for(var _0xb4b71b=0x0;_0xb4b71b=0x0?this['available']:0x0;var _0x2fcdcb={'id':this['id'],'available':this[_0x21d4('0x19')],'loggedIn':this[_0x21d4('0x14')],'name':this['name'],'paused':this[_0x21d4('0x15')],'waiting':this[_0x21d4('0xf')]};var _0xad1291=md5(JSON[_0x21d4('0x1a')](_0x2fcdcb));if(this[_0x21d4('0x1')]!==_0xad1291){this['md5']=_0xad1291;io['to'](util[_0x21d4('0x1b')](_0x21d4('0x1c'),_0x2fcdcb['name']))[_0x21d4('0x1d')](_0x21d4('0x1e'),_0x2fcdcb);}};module[_0x21d4('0x1f')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 7ebdad9..a4cc672 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(_0x3c71fc,_0x34fa70){var _0x5aa59f=function(_0x4a850c){while(--_0x4a850c){_0x3c71fc['push'](_0x3c71fc['shift']());}};_0x5aa59f(++_0x34fa70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x530425,_0x38260d){var _0x36589d=function(_0xf59a7e){while(--_0xf59a7e){_0x530425['push'](_0x530425['shift']());}};_0x36589d(++_0x38260d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 f2f8ac1..9b8ddbb 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 _0xaea8=['name','Intervals','exports'];(function(_0x73bd79,_0x3615e8){var _0x5d9081=function(_0x3b8517){while(--_0x3b8517){_0x73bd79['push'](_0x73bd79['shift']());}};_0x5d9081(++_0x3615e8);}(_0xaea8,0x1d1));var _0x8aea=function(_0x343bc,_0x44913c){_0x343bc=_0x343bc-0x0;var _0x9c18b7=_0xaea8[_0x343bc];return _0x9c18b7;};'use strict';function Interval(_0x118a9a){this['id']=_0x118a9a['id']||0x0;this[_0x8aea('0x0')]=_0x118a9a['name']||'';this[_0x8aea('0x1')]=_0x118a9a['Intervals']||{};}module[_0x8aea('0x2')]=Interval; \ No newline at end of file +var _0x36a9=['name','Intervals'];(function(_0x32ed89,_0x11d953){var _0x262961=function(_0x29727c){while(--_0x29727c){_0x32ed89['push'](_0x32ed89['shift']());}};_0x262961(++_0x11d953);}(_0x36a9,0x1c4));var _0x936a=function(_0x3c716d,_0x49c27a){_0x3c716d=_0x3c716d-0x0;var _0x125d0d=_0x36a9[_0x3c716d];return _0x125d0d;};'use strict';function Interval(_0x405917){this['id']=_0x405917['id']||0x0;this['name']=_0x405917[_0x936a('0x0')]||'';this[_0x936a('0x1')]=_0x405917['Intervals']||{};}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 3ccae7a..bb2d593 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 _0xf3d4=['available','waiting','format','mail:queue:%s','mail_queue:save','lodash','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','online','mailPause','paused'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0xf3d4,0x71));var _0x4f3d=function(_0x9b424b,_0x3ea127){_0x9b424b=_0x9b424b-0x0;var _0x1dcfee=_0xf3d4[_0x9b424b];return _0x1dcfee;};'use strict';var _=require(_0x4f3d('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x4f3d('0x1'));config['redis']=_[_0x4f3d('0x2')](config[_0x4f3d('0x3')],{'host':_0x4f3d('0x4'),'port':0x18eb});var io=require(_0x4f3d('0x5'))(new Redis(config[_0x4f3d('0x3')]));function MailQueue(_0x59eff2){this['id']=_0x59eff2['id']||0x0;this[_0x4f3d('0x6')]=_0x59eff2['name']||'';this['timeout']=_0x59eff2['timeout']||0xa;this[_0x4f3d('0x7')]=_0x59eff2[_0x4f3d('0x7')]||_0x4f3d('0x8');this[_0x4f3d('0x9')]=_0x59eff2[_0x4f3d('0x9')];this[_0x4f3d('0xa')]={};this['waiting']=0x0;this[_0x4f3d('0xb')]='';this['updateRouting']();this[_0x4f3d('0xc')]();}MailQueue[_0x4f3d('0xd')][_0x4f3d('0xe')]=function(){var _0x9eed9=this[_0x4f3d('0xa')]['_rr'];this['mapAgentsId']=_[_0x4f3d('0xf')](this[_0x4f3d('0x9')],'id');this['mapAgentsId'][_0x4f3d('0x10')]=_0x9eed9;};MailQueue[_0x4f3d('0xd')][_0x4f3d('0xc')]=function(){this[_0x4f3d('0x11')]=0x0;this['paused']=0x0;for(var _0x484260=0x0;_0x484260=0x0?this[_0x4f3d('0x16')]:0x0;var _0x26e4ef={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4f3d('0x11')],'name':this[_0x4f3d('0x6')],'paused':this[_0x4f3d('0x15')],'waiting':this[_0x4f3d('0x17')]};var _0x41d8d1=md5(JSON['stringify'](_0x26e4ef));if(this[_0x4f3d('0xb')]!==_0x41d8d1){this[_0x4f3d('0xb')]=_0x41d8d1;io['to'](util[_0x4f3d('0x18')](_0x4f3d('0x19'),_0x26e4ef[_0x4f3d('0x6')]))['emit'](_0x4f3d('0x1a'),_0x26e4ef);}};module['exports']=MailQueue; \ No newline at end of file +var _0x6d77=['mapAgentsId','updateRouting','prototype','_rr','map','Agents','paused','length','loggedIn','mailPause','available','name','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','timeout','strategy','beepall'];(function(_0x1dd9d5,_0x3a31b8){var _0x161c5d=function(_0x74fc96){while(--_0x74fc96){_0x1dd9d5['push'](_0x1dd9d5['shift']());}};_0x161c5d(++_0x3a31b8);}(_0x6d77,0x13a));var _0x76d7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6d77[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x76d7('0x0'));var md5=require(_0x76d7('0x1'));var util=require(_0x76d7('0x2'));var Redis=require(_0x76d7('0x3'));var config=require('../../../config/environment');config[_0x76d7('0x4')]=_['defaults'](config[_0x76d7('0x4')],{'host':_0x76d7('0x5'),'port':0x18eb});var io=require(_0x76d7('0x6'))(new Redis(config[_0x76d7('0x4')]));function MailQueue(_0x521824){this['id']=_0x521824['id']||0x0;this['name']=_0x521824['name']||'';this[_0x76d7('0x7')]=_0x521824['timeout']||0xa;this['strategy']=_0x521824[_0x76d7('0x8')]||_0x76d7('0x9');this['Agents']=_0x521824['Agents'];this[_0x76d7('0xa')]={};this['waiting']=0x0;this[_0x76d7('0x1')]='';this[_0x76d7('0xb')]();this['updateRealtime']();}MailQueue[_0x76d7('0xc')][_0x76d7('0xb')]=function(){var _0x511208=this['mapAgentsId'][_0x76d7('0xd')];this[_0x76d7('0xa')]=_[_0x76d7('0xe')](this[_0x76d7('0xf')],'id');this[_0x76d7('0xa')][_0x76d7('0xd')]=_0x511208;};MailQueue[_0x76d7('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x76d7('0x10')]=0x0;for(var _0xc27df5=0x0;_0xc27df5=0x0?this[_0x76d7('0x14')]:0x0;var _0x5d9faf={'id':this['id'],'available':this[_0x76d7('0x14')],'loggedIn':this[_0x76d7('0x12')],'name':this[_0x76d7('0x15')],'paused':this[_0x76d7('0x10')],'waiting':this['waiting']};var _0x1deb0e=md5(JSON[_0x76d7('0x16')](_0x5d9faf));if(this['md5']!==_0x1deb0e){this['md5']=_0x1deb0e;io['to'](util['format'](_0x76d7('0x17'),_0x5d9faf[_0x76d7('0x15')]))[_0x76d7('0x18')](_0x76d7('0x19'),_0x5d9faf);}};module[_0x76d7('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1300542..e58962d 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 _0x5bfd=['waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x5df1c2,_0x36604c){var _0x1fa485=function(_0x2fc768){while(--_0x2fc768){_0x5df1c2['push'](_0x5df1c2['shift']());}};_0x1fa485(++_0x36604c);}(_0x5bfd,0x15a));var _0xd5bf=function(_0x31656c,_0x5303c4){_0x31656c=_0x31656c-0x0;var _0xf38b55=_0x5bfd[_0x31656c];return _0xf38b55;};'use strict';var _=require(_0xd5bf('0x0'));var md5=require(_0xd5bf('0x1'));var util=require('util');var Redis=require(_0xd5bf('0x2'));var config=require(_0xd5bf('0x3'));config[_0xd5bf('0x4')]=_[_0xd5bf('0x5')](config[_0xd5bf('0x4')],{'host':_0xd5bf('0x6'),'port':0x18eb});var io=require(_0xd5bf('0x7'))(new Redis(config[_0xd5bf('0x4')]));function OpenchannelQueue(_0x46dc0c){this['id']=_0x46dc0c['id']||0x0;this['name']=_0x46dc0c[_0xd5bf('0x8')]||'';this[_0xd5bf('0x9')]=_0x46dc0c[_0xd5bf('0x9')]||0xa;this[_0xd5bf('0xa')]=_0x46dc0c[_0xd5bf('0xa')]||_0xd5bf('0xb');this['Agents']=_0x46dc0c[_0xd5bf('0xc')];this[_0xd5bf('0xd')]={};this[_0xd5bf('0xe')]=0x0;this[_0xd5bf('0x1')]='';this[_0xd5bf('0xf')]();this[_0xd5bf('0x10')]();}OpenchannelQueue['prototype'][_0xd5bf('0xf')]=function(){var _0x580e90=this['mapAgentsId'][_0xd5bf('0x11')];this[_0xd5bf('0xd')]=_[_0xd5bf('0x12')](this[_0xd5bf('0xc')],'id');this['mapAgentsId'][_0xd5bf('0x11')]=_0x580e90;};OpenchannelQueue['prototype'][_0xd5bf('0x10')]=function(){this[_0xd5bf('0x13')]=0x0;this[_0xd5bf('0x14')]=0x0;for(var _0x17f4d5=0x0;_0x17f4d5=0x0?this[_0xd5bf('0x18')]:0x0;var _0x5c7118={'id':this['id'],'available':this[_0xd5bf('0x18')],'loggedIn':this[_0xd5bf('0x13')],'name':this[_0xd5bf('0x8')],'paused':this[_0xd5bf('0x14')],'waiting':this[_0xd5bf('0xe')]};var _0x261055=md5(JSON[_0xd5bf('0x19')](_0x5c7118));if(this[_0xd5bf('0x1')]!==_0x261055){this[_0xd5bf('0x1')]=_0x261055;io['to'](util[_0xd5bf('0x1a')](_0xd5bf('0x1b'),_0x5c7118[_0xd5bf('0x8')]))[_0xd5bf('0x1c')]('openchannel_queue:save',_0x5c7118);}};module[_0xd5bf('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x7776=['waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','format','emit','openchannel_queue:save','exports','lodash','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x346caa,_0x46888d){var _0x1f4548=function(_0x3e7c1b){while(--_0x3e7c1b){_0x346caa['push'](_0x346caa['shift']());}};_0x1f4548(++_0x46888d);}(_0x7776,0x1cb));var _0x6777=function(_0x45b9f9,_0x36e067){_0x45b9f9=_0x45b9f9-0x0;var _0x34cd49=_0x7776[_0x45b9f9];return _0x34cd49;};'use strict';var _=require(_0x6777('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6777('0x1')]=_[_0x6777('0x2')](config[_0x6777('0x1')],{'host':'localhost','port':0x18eb});var io=require(_0x6777('0x3'))(new Redis(config['redis']));function OpenchannelQueue(_0x36bb2b){this['id']=_0x36bb2b['id']||0x0;this[_0x6777('0x4')]=_0x36bb2b[_0x6777('0x4')]||'';this[_0x6777('0x5')]=_0x36bb2b[_0x6777('0x5')]||0xa;this[_0x6777('0x6')]=_0x36bb2b[_0x6777('0x6')]||'beepall';this[_0x6777('0x7')]=_0x36bb2b[_0x6777('0x7')];this[_0x6777('0x8')]={};this[_0x6777('0x9')]=0x0;this[_0x6777('0xa')]='';this[_0x6777('0xb')]();this[_0x6777('0xc')]();}OpenchannelQueue[_0x6777('0xd')]['updateRouting']=function(){var _0x1c7349=this['mapAgentsId'][_0x6777('0xe')];this['mapAgentsId']=_[_0x6777('0xf')](this['Agents'],'id');this[_0x6777('0x8')][_0x6777('0xe')]=_0x1c7349;};OpenchannelQueue[_0x6777('0xd')][_0x6777('0xc')]=function(){this[_0x6777('0x10')]=0x0;this[_0x6777('0x11')]=0x0;for(var _0x18f41b=0x0;_0x18f41b=0x0?this[_0x6777('0x15')]:0x0;var _0xdc0774={'id':this['id'],'available':this[_0x6777('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6777('0x11')],'waiting':this['waiting']};var _0x75a48f=md5(JSON['stringify'](_0xdc0774));if(this[_0x6777('0xa')]!==_0x75a48f){this[_0x6777('0xa')]=_0x75a48f;io['to'](util[_0x6777('0x16')]('openchannel:queue:%s',_0xdc0774['name']))[_0x6777('0x17')](_0x6777('0x18'),_0xdc0774);}};module[_0x6777('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 71ad58e..3ff191a 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 _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x2e4d2b,_0x54823c){var _0x35dedf=function(_0xe80a3c){while(--_0xe80a3c){_0x2e4d2b['push'](_0x2e4d2b['shift']());}};_0x35dedf(++_0x54823c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +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(_0x4b957c,_0xcfe447){var _0xd8fd32=function(_0x2f8ffc){while(--_0x2f8ffc){_0x4b957c['push'](_0x4b957c['shift']());}};_0xd8fd32(++_0xcfe447);}(_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 diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index fdd7180..777a27a 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 _0x7021=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','length','online','loggedIn','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x7021,0x97));var _0x1702=function(_0x2df523,_0x11b09e){_0x2df523=_0x2df523-0x0;var _0x43f919=_0x7021[_0x2df523];return _0x43f919;};'use strict';var _=require('lodash');var md5=require(_0x1702('0x0'));var util=require(_0x1702('0x1'));var Redis=require(_0x1702('0x2'));var config=require(_0x1702('0x3'));config[_0x1702('0x4')]=_[_0x1702('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1702('0x6'))(new Redis(config[_0x1702('0x4')]));function WhatsappQueue(_0x158e83){this['id']=_0x158e83['id']||0x0;this['name']=_0x158e83[_0x1702('0x7')]||'';this[_0x1702('0x8')]=_0x158e83[_0x1702('0x8')]||0xa;this['strategy']=_0x158e83[_0x1702('0x9')]||_0x1702('0xa');this[_0x1702('0xb')]=_0x158e83['Agents'];this[_0x1702('0xc')]={};this[_0x1702('0xd')]=0x0;this[_0x1702('0x0')]='';this[_0x1702('0xe')]();this[_0x1702('0xf')]();}WhatsappQueue['prototype'][_0x1702('0xe')]=function(){var _0x5b07ae=this[_0x1702('0xc')][_0x1702('0x10')];this['mapAgentsId']=_[_0x1702('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x1702('0x10')]=_0x5b07ae;};WhatsappQueue[_0x1702('0x12')][_0x1702('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x9ac0f0=0x0;_0x9ac0f0=0x0?this['available']:0x0;var _0x4b3644={'id':this['id'],'available':this[_0x1702('0x17')],'loggedIn':this[_0x1702('0x15')],'name':this[_0x1702('0x7')],'paused':this[_0x1702('0x16')],'waiting':this[_0x1702('0xd')]};var _0x2a5886=md5(JSON[_0x1702('0x18')](_0x4b3644));if(this[_0x1702('0x0')]!==_0x2a5886){this[_0x1702('0x0')]=_0x2a5886;io['to'](util[_0x1702('0x19')](_0x1702('0x1a'),_0x4b3644[_0x1702('0x7')]))[_0x1702('0x1b')](_0x1702('0x1c'),_0x4b3644);}};module[_0x1702('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x82e3=['_rr','map','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x5d06dc,_0x1cb2e6){var _0x36d40d=function(_0x437859){while(--_0x437859){_0x5d06dc['push'](_0x5d06dc['shift']());}};_0x36d40d(++_0x1cb2e6);}(_0x82e3,0xd4));var _0x382e=function(_0x419ac3,_0x2efe3f){_0x419ac3=_0x419ac3-0x0;var _0x25a9d9=_0x82e3[_0x419ac3];return _0x25a9d9;};'use strict';var _=require(_0x382e('0x0'));var md5=require(_0x382e('0x1'));var util=require(_0x382e('0x2'));var Redis=require(_0x382e('0x3'));var config=require(_0x382e('0x4'));config[_0x382e('0x5')]=_[_0x382e('0x6')](config[_0x382e('0x5')],{'host':_0x382e('0x7'),'port':0x18eb});var io=require(_0x382e('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x2087ab){this['id']=_0x2087ab['id']||0x0;this[_0x382e('0x9')]=_0x2087ab[_0x382e('0x9')]||'';this[_0x382e('0xa')]=_0x2087ab[_0x382e('0xa')]||0xa;this[_0x382e('0xb')]=_0x2087ab[_0x382e('0xb')]||_0x382e('0xc');this[_0x382e('0xd')]=_0x2087ab[_0x382e('0xd')];this[_0x382e('0xe')]={};this[_0x382e('0xf')]=0x0;this[_0x382e('0x1')]='';this[_0x382e('0x10')]();this[_0x382e('0x11')]();}WhatsappQueue[_0x382e('0x12')][_0x382e('0x10')]=function(){var _0x39e1f6=this['mapAgentsId'][_0x382e('0x13')];this[_0x382e('0xe')]=_[_0x382e('0x14')](this[_0x382e('0xd')],'id');this[_0x382e('0xe')][_0x382e('0x13')]=_0x39e1f6;};WhatsappQueue['prototype'][_0x382e('0x11')]=function(){this[_0x382e('0x15')]=0x0;this['paused']=0x0;for(var _0x3fdf8c=0x0;_0x3fdf8c=0x0?this[_0x382e('0x1a')]:0x0;var _0x252db4={'id':this['id'],'available':this[_0x382e('0x1a')],'loggedIn':this[_0x382e('0x15')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x382e('0xf')]};var _0x417906=md5(JSON[_0x382e('0x1b')](_0x252db4));if(this[_0x382e('0x1')]!==_0x417906){this[_0x382e('0x1')]=_0x417906;io['to'](util[_0x382e('0x1c')](_0x382e('0x1d'),_0x252db4[_0x382e('0x9')]))[_0x382e('0x1e')](_0x382e('0x1f'),_0x252db4);}};module[_0x382e('0x20')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index de80fba..1e1f59a 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 _0xe14b=['initMailQueues','mailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','../model/agent','../model/interval','../model/chatQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0xe14b,0x93));var _0xbe14=function(_0x276715,_0x547884){_0x276715=_0x276715-0x0;var _0x4d7c4f=_0xe14b[_0x276715];return _0x4d7c4f;};'use strict';var BPromise=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xbe14('0x2'));var Interval=require(_0xbe14('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xbe14('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xbe14('0x5'));var WhatsappQueue=require(_0xbe14('0x6'));var Realtime=function(){this[_0xbe14('0x7')]={};this[_0xbe14('0x8')]={};this[_0xbe14('0x9')]={};this[_0xbe14('0xa')]={};this[_0xbe14('0xb')]={};this['mailQueues']={};this['faxQueues']={};this['whatsappQueues']={};this[_0xbe14('0xc')]={};this[_0xbe14('0xd')]={};this[_0xbe14('0xe')]={};this[_0xbe14('0xf')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x113243,_0x3f70cb,_0x4935cc){var _0x254c3b=_[_0xbe14('0x10')](_0x113243,function(_0x886a5e,_0x3d38c2){return _0x886a5e[_0x4935cc];});for(var _0x27792f in _0x3f70cb){if(_0x3f70cb[_0xbe14('0x11')](_0x27792f)){if(!_0x254c3b[_0x27792f]){delete _0x3f70cb[_0x27792f];}}}}Realtime[_0xbe14('0x12')][_0xbe14('0x13')]=function(_0x16893f,_0xa2cf72){for(var _0x1e4826 in _0xa2cf72){if(_0x16893f[_0xbe14('0x11')](_0x1e4826)){_0x16893f[_0x1e4826]=_0xa2cf72[_0x1e4826];}}};Realtime[_0xbe14('0x12')]['initAgents']=function(){var _0x55b3a7=this;return function(_0x3f58f5){if(_0x3f58f5){freeIsNotKey(_0x3f58f5,_0x55b3a7[_0xbe14('0x7')],'id');for(var _0xf4ac9=0x0,_0x37ce4e={},_0x4e8f34={};_0xf4ac9<_0x3f58f5[_0xbe14('0x14')];_0xf4ac9+=0x1){_0x37ce4e=_0x3f58f5[_0xf4ac9];if(_[_0xbe14('0x15')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']])){_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']]=new Agent(_0x37ce4e);}else{_0x55b3a7[_0xbe14('0x13')](_0x55b3a7[_0xbe14('0x7')][_0x37ce4e['id']],_0x37ce4e);}}}return _0x55b3a7[_0xbe14('0x7')];};};Realtime['prototype'][_0xbe14('0x16')]=function(){var _0x456ca8=this;return function(_0x329588){if(_0x329588){freeIsNotKey(_0x329588,_0x456ca8[_0xbe14('0x8')],'id');for(var _0x3249da=0x0,_0x37e4c1={},_0x59a9e3={};_0x3249da<_0x329588[_0xbe14('0x14')];_0x3249da+=0x1){_0x37e4c1=_0x329588[_0x3249da];if(_[_0xbe14('0x15')](_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']])){_0x456ca8[_0xbe14('0x8')][_0x37e4c1['id']]=new Interval(_0x37e4c1);}else{_0x456ca8[_0xbe14('0x13')](_0x456ca8['intervals'][_0x37e4c1['id']],_0x37e4c1);}}}return _0x456ca8[_0xbe14('0x8')];};};Realtime['prototype'][_0xbe14('0x17')]=function(){var _0x56e80c=this;return function(_0x32e8eb){if(_0x32e8eb){freeIsNotKey(_0x32e8eb,_0x56e80c['openchannelQueues'],'id');for(var _0x274018=0x0,_0x3d3608={},_0x505dbd={};_0x274018<_0x32e8eb[_0xbe14('0x14')];_0x274018+=0x1){_0x3d3608=_0x32e8eb[_0x274018];if(_['isUndefined'](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']])){_0x56e80c['openchannelQueues'][_0x3d3608['id']]=new OpenchannelQueue(_0x3d3608);}else{_0x56e80c[_0xbe14('0x13')](_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']],_0x3d3608);}_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x18')]();_0x56e80c[_0xbe14('0x9')][_0x3d3608['id']][_0xbe14('0x19')]();}}return _0x56e80c['openchannelQueues'];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1a')]=function(){var _0x391556=this;return function(_0x169369){if(_0x169369){freeIsNotKey(_0x169369,_0x391556['chatQueues'],'id');for(var _0x16f884=0x0,_0x29fc64={},_0x59bf34={};_0x16f884<_0x169369[_0xbe14('0x14')];_0x16f884+=0x1){_0x29fc64=_0x169369[_0x16f884];if(_[_0xbe14('0x15')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']])){_0x391556[_0xbe14('0xa')][_0x29fc64['id']]=new ChatQueue(_0x29fc64);}else{_0x391556[_0xbe14('0x13')](_0x391556[_0xbe14('0xa')][_0x29fc64['id']],_0x29fc64);}_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x18')]();_0x391556[_0xbe14('0xa')][_0x29fc64['id']][_0xbe14('0x19')]();}}return _0x391556[_0xbe14('0xa')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1b')]=function(){var _0x10ae36=this;return function(_0x223f7a){if(_0x223f7a){freeIsNotKey(_0x223f7a,_0x10ae36[_0xbe14('0xb')],'id');for(var _0x6ba36c=0x0,_0x2ff48e={},_0x29e76a={};_0x6ba36c<_0x223f7a[_0xbe14('0x14')];_0x6ba36c+=0x1){_0x2ff48e=_0x223f7a[_0x6ba36c];if(_['isUndefined'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']])){_0x10ae36['smsQueues'][_0x2ff48e['id']]=new SmsQueue(_0x2ff48e);}else{_0x10ae36['mergeFromDatabase'](_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']],_0x2ff48e);}_0x10ae36['smsQueues'][_0x2ff48e['id']][_0xbe14('0x18')]();_0x10ae36[_0xbe14('0xb')][_0x2ff48e['id']]['updateRealtime']();}}return _0x10ae36['smsQueues'];};};Realtime['prototype'][_0xbe14('0x1c')]=function(){var _0xa3d24=this;return function(_0x5f27b6){if(_0x5f27b6){freeIsNotKey(_0x5f27b6,_0xa3d24[_0xbe14('0x1d')],'id');for(var _0x1faf3e=0x0,_0x452635={},_0x1aa849={};_0x1faf3e<_0x5f27b6[_0xbe14('0x14')];_0x1faf3e+=0x1){_0x452635=_0x5f27b6[_0x1faf3e];if(_['isUndefined'](_0xa3d24['mailQueues'][_0x452635['id']])){_0xa3d24[_0xbe14('0x1d')][_0x452635['id']]=new MailQueue(_0x452635);}else{_0xa3d24['mergeFromDatabase'](_0xa3d24['mailQueues'][_0x452635['id']],_0x452635);}_0xa3d24['mailQueues'][_0x452635['id']][_0xbe14('0x18')]();_0xa3d24[_0xbe14('0x1d')][_0x452635['id']][_0xbe14('0x19')]();}}return _0xa3d24[_0xbe14('0x1d')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x1e')]=function(){var _0xcdc50=this;return function(_0x10ec3c){if(_0x10ec3c){freeIsNotKey(_0x10ec3c,_0xcdc50[_0xbe14('0x1f')],'id');for(var _0x2dfd5a=0x0,_0x41652d={},_0x32c59d={};_0x2dfd5a<_0x10ec3c['length'];_0x2dfd5a+=0x1){_0x41652d=_0x10ec3c[_0x2dfd5a];if(_['isUndefined'](_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']])){_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']]=new FaxQueue(_0x41652d);}else{_0xcdc50[_0xbe14('0x13')](_0xcdc50['faxQueues'][_0x41652d['id']],_0x41652d);}_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x18')]();_0xcdc50[_0xbe14('0x1f')][_0x41652d['id']][_0xbe14('0x19')]();}}return _0xcdc50[_0xbe14('0x1f')];};};Realtime[_0xbe14('0x12')][_0xbe14('0x20')]=function(){var _0x128843=this;return function(_0x1b2608){if(_0x1b2608){freeIsNotKey(_0x1b2608,_0x128843['whatsappQueues'],'id');for(var _0xe51424=0x0,_0x841b71={},_0x3463c4={};_0xe51424<_0x1b2608[_0xbe14('0x14')];_0xe51424+=0x1){_0x841b71=_0x1b2608[_0xe51424];if(_[_0xbe14('0x15')](_0x128843[_0xbe14('0x21')][_0x841b71['id']])){_0x128843['whatsappQueues'][_0x841b71['id']]=new WhatsappQueue(_0x841b71);}else{_0x128843[_0xbe14('0x13')](_0x128843[_0xbe14('0x21')][_0x841b71['id']],_0x841b71);}_0x128843[_0xbe14('0x21')][_0x841b71['id']][_0xbe14('0x18')]();_0x128843['whatsappQueues'][_0x841b71['id']]['updateRealtime']();}}return _0x128843[_0xbe14('0x21')];};};module[_0xbe14('0x22')]=Realtime; \ No newline at end of file +var _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x592604,_0x57b53f){var _0x2022a9=function(_0x353cab){while(--_0x353cab){_0x592604['push'](_0x592604['shift']());}};_0x2022a9(++_0x57b53f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 20fe86f..69bca5d 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 _0xb6b9=['Request','updateChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x16a398,_0x3a3e17){var _0x8bd21e=function(_0x4fcea9){while(--_0x4fcea9){_0x16a398['push'](_0x16a398['shift']());}};_0x8bd21e(++_0x3a3e17);}(_0xb6b9,0x134));var _0x9b6b=function(_0x3147ef,_0x34a296){_0x3147ef=_0x3147ef-0x0;var _0x529071=_0xb6b9[_0x3147ef];return _0x529071;};'use strict';var client=require(_0x9b6b('0x0'));exports[_0x9b6b('0x1')]=function(_0x57bb54,_0x47ee02){return client[_0x9b6b('0x2')]('UpdateChatInteraction',{'body':_0x47ee02,'options':{'where':{'id':_0x57bb54}},'log':_0x9b6b('0x3')});};exports['addTags']=function(_0x5b4708,_0x5ef57f){return client[_0x9b6b('0x2')]('AddTagsToChatInteraction',{'body':_0x5ef57f,'options':{'where':{'id':_0x5b4708}},'log':_0x9b6b('0x4')});}; \ No newline at end of file +var _0x0335=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x266551,_0x25fa6c){var _0x53d160=function(_0x27a266){while(--_0x27a266){_0x266551['push'](_0x266551['shift']());}};_0x53d160(++_0x25fa6c);}(_0x0335,0x1ba));var _0x5033=function(_0x572c2d,_0x4a7369){_0x572c2d=_0x572c2d-0x0;var _0x300e02=_0x0335[_0x572c2d];return _0x300e02;};'use strict';var client=require(_0x5033('0x0'));exports[_0x5033('0x1')]=function(_0x501416,_0x409f9f){return client[_0x5033('0x2')](_0x5033('0x3'),{'body':_0x409f9f,'options':{'where':{'id':_0x501416}},'log':_0x5033('0x4')});};exports[_0x5033('0x5')]=function(_0x5f32e5,_0x5f013e){return client[_0x5033('0x2')](_0x5033('0x6'),{'body':_0x5f013e,'options':{'where':{'id':_0x5f32e5}},'log':_0x5033('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 76591c6..51653d9 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 _0xe801=['createChatMessage','../client','create','CreateChatMessage'];(function(_0x1c69e3,_0x361932){var _0x3b840c=function(_0x5f0680){while(--_0x5f0680){_0x1c69e3['push'](_0x1c69e3['shift']());}};_0x3b840c(++_0x361932);}(_0xe801,0x135));var _0x1e80=function(_0x1b5099,_0x16f02f){_0x1b5099=_0x1b5099-0x0;var _0x47887c=_0xe801[_0x1b5099];return _0x47887c;};'use strict';var client=require(_0x1e80('0x0'));exports[_0x1e80('0x1')]=function(_0x52da3c){return client['Request'](_0x1e80('0x2'),{'body':_0x52da3c,'log':_0x1e80('0x3')});}; \ No newline at end of file +var _0xd899=['Request','CreateChatMessage','../client'];(function(_0x10a4f1,_0x3248c7){var _0x3cebe5=function(_0x5db59a){while(--_0x5db59a){_0x10a4f1['push'](_0x10a4f1['shift']());}};_0x3cebe5(++_0x3248c7);}(_0xd899,0x1d9));var _0x9d89=function(_0x361403,_0x2b7879){_0x361403=_0x361403-0x0;var _0x5e006a=_0xd899[_0x361403];return _0x5e006a;};'use strict';var client=require(_0x9d89('0x0'));exports['create']=function(_0x5a90b5){return client[_0x9d89('0x1')](_0x9d89('0x2'),{'body':_0x5a90b5,'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 80d118e..3080e9d 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 _0xf5a3=['Agents','online','getChatQueues','Request','GetChatQueue','name','timeout','User'];(function(_0x529a03,_0x4cc821){var _0x2bcc94=function(_0x3d66f0){while(--_0x3d66f0){_0x529a03['push'](_0x529a03['shift']());}};_0x2bcc94(++_0x4cc821);}(_0xf5a3,0x132));var _0x3f5a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf5a3[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x3f5a('0x0')]=function(){return function(){return client[_0x3f5a('0x1')](_0x3f5a('0x2'),{'options':{'raw':![],'attributes':['id',_0x3f5a('0x3'),_0x3f5a('0x4'),'strategy'],'include':[{'model':_0x3f5a('0x5'),'as':_0x3f5a('0x6'),'attributes':['id',_0x3f5a('0x3'),_0x3f5a('0x7'),'chatPause']}]},'log':_0x3f5a('0x0')});};}; \ No newline at end of file +var _0x1ac6=['Request','GetChatQueue','name','strategy','User','Agents','../client','getChatQueues'];(function(_0x230115,_0x522113){var _0x48de38=function(_0x5cb485){while(--_0x5cb485){_0x230115['push'](_0x230115['shift']());}};_0x48de38(++_0x522113);}(_0x1ac6,0x1b6));var _0x61ac=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x1ac6[_0x55821d];return _0x58ea8a;};'use strict';var client=require(_0x61ac('0x0'));exports[_0x61ac('0x1')]=function(){return function(){return client[_0x61ac('0x2')](_0x61ac('0x3'),{'options':{'raw':![],'attributes':['id',_0x61ac('0x4'),'timeout',_0x61ac('0x5')],'include':[{'model':_0x61ac('0x6'),'as':_0x61ac('0x7'),'attributes':['id',_0x61ac('0x4'),'online','chatPause']}]},'log':_0x61ac('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 68dd3f4..be6dc15 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 _0x757f=['CreateChatQueueReport','update','UpdateChatQueueReport','../client','Request'];(function(_0x3c8784,_0x49ad1e){var _0x42c0b8=function(_0x54b8d0){while(--_0x54b8d0){_0x3c8784['push'](_0x3c8784['shift']());}};_0x42c0b8(++_0x49ad1e);}(_0x757f,0xee));var _0xf757=function(_0x5cf93c,_0x2b5075){_0x5cf93c=_0x5cf93c-0x0;var _0x56aa24=_0x757f[_0x5cf93c];return _0x56aa24;};'use strict';var client=require(_0xf757('0x0'));exports['create']=function(_0x2a5573){return client[_0xf757('0x1')](_0xf757('0x2'),{'body':_0x2a5573,'log':_0xf757('0x2')});};exports[_0xf757('0x3')]=function(_0x44ebcf,_0x26a38a){return client[_0xf757('0x1')](_0xf757('0x4'),{'body':_0x26a38a,'options':{'where':{'uniqueid':_0x44ebcf},'order':[['id','DESC']],'limit':0x1},'log':_0xf757('0x4')});}; \ No newline at end of file +var _0x9f94=['update','Request','DESC','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x9f94,0x1e7));var _0x49f9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f94[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0x49f9('0x0'));exports[_0x49f9('0x1')]=function(_0x2ca96a){return client['Request']('CreateChatQueueReport',{'body':_0x2ca96a,'log':_0x49f9('0x2')});};exports[_0x49f9('0x3')]=function(_0xb643ef,_0x375856){return client[_0x49f9('0x4')]('UpdateChatQueueReport',{'body':_0x375856,'options':{'where':{'uniqueid':_0xb643ef},'order':[['id',_0x49f9('0x5')]],'limit':0x1},'log':_0x49f9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9280b25..990d7fe 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 _0x4f29=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x4f29,0x157));var _0x94f2=function(_0x28e49a,_0x145edc){_0x28e49a=_0x28e49a-0x0;var _0x38a5eb=_0x4f29[_0x28e49a];return _0x38a5eb;};'use strict';var client=require(_0x94f2('0x0'));exports[_0x94f2('0x1')]=function(_0x9f1cea,_0x32e90e){return client[_0x94f2('0x2')](_0x94f2('0x3'),{'body':_0x32e90e,'options':{'where':{'id':_0x9f1cea}},'log':_0x94f2('0x4')});};exports[_0x94f2('0x5')]=function(_0x1cf3a7,_0x1a0cb3){return client[_0x94f2('0x2')](_0x94f2('0x6'),{'body':_0x1a0cb3,'options':{'where':{'id':_0x1cf3a7}},'log':_0x94f2('0x7')});}; \ No newline at end of file +var _0x6696=['Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','update'];(function(_0x1719e4,_0x4278fe){var _0x236bac=function(_0x12e8a3){while(--_0x12e8a3){_0x1719e4['push'](_0x1719e4['shift']());}};_0x236bac(++_0x4278fe);}(_0x6696,0x1e9));var _0x6669=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x6696[_0x2555d0];return _0x3bb486;};'use strict';var client=require('../client');exports[_0x6669('0x0')]=function(_0x3b2112,_0x52d673){return client[_0x6669('0x1')](_0x6669('0x2'),{'body':_0x52d673,'options':{'where':{'id':_0x3b2112}},'log':_0x6669('0x3')});};exports[_0x6669('0x4')]=function(_0x491a89,_0x3481ed){return client['Request'](_0x6669('0x5'),{'body':_0x3481ed,'options':{'where':{'id':_0x491a89}},'log':_0x6669('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 680c824..a9a9e61 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 _0xad29=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x427b92,_0xf48d02){var _0x3d2269=function(_0x8a03d0){while(--_0x8a03d0){_0x427b92['push'](_0x427b92['shift']());}};_0x3d2269(++_0xf48d02);}(_0xad29,0x194));var _0x9ad2=function(_0x51eb34,_0x4437f2){_0x51eb34=_0x51eb34-0x0;var _0x3caa5e=_0xad29[_0x51eb34];return _0x3caa5e;};'use strict';var client=require(_0x9ad2('0x0'));exports['create']=function(_0x23cef3){return client[_0x9ad2('0x1')](_0x9ad2('0x2'),{'body':_0x23cef3,'log':_0x9ad2('0x3')});}; \ No newline at end of file +var _0x5341=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0x5341,0xb9));var _0x1534=function(_0x3ad7c5,_0x5bfcfa){_0x3ad7c5=_0x3ad7c5-0x0;var _0xc92356=_0x5341[_0x3ad7c5];return _0xc92356;};'use strict';var client=require(_0x1534('0x0'));exports[_0x1534('0x1')]=function(_0x548d9c){return client[_0x1534('0x2')](_0x1534('0x3'),{'body':_0x548d9c,'log':_0x1534('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b09c172..d52c268 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 _0xf998=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause'];(function(_0xd35f7f,_0x5aa5c5){var _0x4cfa61=function(_0xc92217){while(--_0xc92217){_0xd35f7f['push'](_0xd35f7f['shift']());}};_0x4cfa61(++_0x5aa5c5);}(_0xf998,0x1ea));var _0x8f99=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0xf998[_0x519380];return _0x60ba2c;};'use strict';var client=require(_0x8f99('0x0'));exports[_0x8f99('0x1')]=function(){return function(){return client[_0x8f99('0x2')](_0x8f99('0x3'),{'options':{'raw':![],'attributes':['id',_0x8f99('0x4'),_0x8f99('0x5'),_0x8f99('0x6')],'include':[{'model':_0x8f99('0x7'),'as':_0x8f99('0x8'),'attributes':['id',_0x8f99('0x4'),'online',_0x8f99('0x9')]}]},'log':_0x8f99('0x1')});};}; \ No newline at end of file +var _0xd883=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online'];(function(_0x43d5be,_0x57ac20){var _0x4397bc=function(_0x5123b9){while(--_0x5123b9){_0x43d5be['push'](_0x43d5be['shift']());}};_0x4397bc(++_0x57ac20);}(_0xd883,0x114));var _0x3d88=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd883[_0x5f1391];return _0x50ebe3;};'use strict';var client=require(_0x3d88('0x0'));exports[_0x3d88('0x1')]=function(){return function(){return client[_0x3d88('0x2')](_0x3d88('0x3'),{'options':{'raw':![],'attributes':['id',_0x3d88('0x4'),_0x3d88('0x5'),_0x3d88('0x6')],'include':[{'model':_0x3d88('0x7'),'as':_0x3d88('0x8'),'attributes':['id',_0x3d88('0x4'),_0x3d88('0x9'),_0x3d88('0xa')]}]},'log':_0x3d88('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 12f47b9..d43b74c 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 _0x047f=['UpdateFaxQueueReport','DESC','../client','update','Request'];(function(_0x2743b1,_0x29474f){var _0xaaffd1=function(_0x58dd6f){while(--_0x58dd6f){_0x2743b1['push'](_0x2743b1['shift']());}};_0xaaffd1(++_0x29474f);}(_0x047f,0x1c9));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf047('0x0'));exports['create']=function(_0x31607f){return client['Request']('CreateFaxQueueReport',{'body':_0x31607f,'log':'CreateFaxQueueReport'});};exports[_0xf047('0x1')]=function(_0x21ac26,_0x515635){return client[_0xf047('0x2')](_0xf047('0x3'),{'body':_0x515635,'options':{'where':{'uniqueid':_0x21ac26},'order':[['id',_0xf047('0x4')]],'limit':0x1},'log':_0xf047('0x3')});}; \ No newline at end of file +var _0x6a9d=['Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x4708e3,_0x50c936){var _0x2bcd16=function(_0x50d342){while(--_0x50d342){_0x4708e3['push'](_0x4708e3['shift']());}};_0x2bcd16(++_0x50c936);}(_0x6a9d,0x111));var _0xd6a9=function(_0x4838e5,_0x57cff3){_0x4838e5=_0x4838e5-0x0;var _0x5242fc=_0x6a9d[_0x4838e5];return _0x5242fc;};'use strict';var client=require('../client');exports['create']=function(_0x4b31b1){return client[_0xd6a9('0x0')](_0xd6a9('0x1'),{'body':_0x4b31b1,'log':_0xd6a9('0x1')});};exports['update']=function(_0xa00722,_0x38f2c2){return client[_0xd6a9('0x0')](_0xd6a9('0x2'),{'body':_0x38f2c2,'options':{'where':{'uniqueid':_0xa00722},'order':[['id','DESC']],'limit':0x1},'log':_0xd6a9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bb42696..632078a 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 _0x4bde=['Intervals','../client','getIntervals','Request','name','Interval'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x33ce34,_0x5987ec){_0x33ce34=_0x33ce34-0x0;var _0x31886e=_0x4bde[_0x33ce34];return _0x31886e;};'use strict';var client=require(_0xe4bd('0x0'));exports[_0xe4bd('0x1')]=function(){return function(){return client[_0xe4bd('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe4bd('0x3')],'include':[{'model':_0xe4bd('0x4'),'as':_0xe4bd('0x5'),'attributes':['id',_0xe4bd('0x3'),'interval']}]},'log':_0xe4bd('0x1')});};}; \ No newline at end of file +var _0xd8b0=['getIntervals','Interval','Intervals','name','interval','../client'];(function(_0x59a5d0,_0x4b3308){var _0x6840ac=function(_0x2dadf5){while(--_0x2dadf5){_0x59a5d0['push'](_0x59a5d0['shift']());}};_0x6840ac(++_0x4b3308);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x0d8b('0x2'),'as':_0x0d8b('0x3'),'attributes':['id',_0x0d8b('0x4'),_0x0d8b('0x5')]}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c6b4bb1..ac7031f 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 _0x3033=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x592e90,_0x59b43f){var _0x49ee81=function(_0x41d01c){while(--_0x41d01c){_0x592e90['push'](_0x592e90['shift']());}};_0x49ee81(++_0x59b43f);}(_0x3033,0xf5));var _0x3303=function(_0x2495f3,_0x48a18e){_0x2495f3=_0x2495f3-0x0;var _0x4eaccc=_0x3033[_0x2495f3];return _0x4eaccc;};'use strict';var client=require('../client');exports['update']=function(_0xd6906e,_0x48935c){return client[_0x3303('0x0')](_0x3303('0x1'),{'body':_0x48935c,'options':{'where':{'id':_0xd6906e}},'log':_0x3303('0x2')});};exports[_0x3303('0x3')]=function(_0x72874f,_0xf4fca8){return client['Request']('AddTagsToMailInteraction',{'body':_0xf4fca8,'options':{'where':{'id':_0x72874f}},'log':_0x3303('0x4')});}; \ No newline at end of file +var _0xd0f6=['Request','UpdateMailInteraction','updateMailInteraction','addTags','../client'];(function(_0x1694f0,_0x407ca2){var _0x2502bc=function(_0x3ceccc){while(--_0x3ceccc){_0x1694f0['push'](_0x1694f0['shift']());}};_0x2502bc(++_0x407ca2);}(_0xd0f6,0x1cb));var _0x6d0f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd0f6[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x6d0f('0x0'));exports['update']=function(_0xb60fc5,_0x448a30){return client[_0x6d0f('0x1')](_0x6d0f('0x2'),{'body':_0x448a30,'options':{'where':{'id':_0xb60fc5}},'log':_0x6d0f('0x3')});};exports[_0x6d0f('0x4')]=function(_0x494813,_0x428fee){return client['Request']('AddTagsToMailInteraction',{'body':_0x428fee,'options':{'where':{'id':_0x494813}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d1587a6..33fd878 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 _0xff4b=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x4c9e47,_0x5cf11a){var _0x576ff4=function(_0x37db61){while(--_0x37db61){_0x4c9e47['push'](_0x4c9e47['shift']());}};_0x576ff4(++_0x5cf11a);}(_0xff4b,0x115));var _0xbff4=function(_0x15a0f9,_0x4236d5){_0x15a0f9=_0x15a0f9-0x0;var _0xd95223=_0xff4b[_0x15a0f9];return _0xd95223;};'use strict';var client=require(_0xbff4('0x0'));exports[_0xbff4('0x1')]=function(_0x1db394){return client[_0xbff4('0x2')](_0xbff4('0x3'),{'body':_0x1db394,'log':_0xbff4('0x4')});}; \ No newline at end of file +var _0xff33=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x4f7bad,_0x4b3603){var _0x20f248=function(_0x19afe6){while(--_0x19afe6){_0x4f7bad['push'](_0x4f7bad['shift']());}};_0x20f248(++_0x4b3603);}(_0xff33,0x7d));var _0x3ff3=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xff33[_0x251d9c];return _0x16ae64;};'use strict';var client=require(_0x3ff3('0x0'));exports[_0x3ff3('0x1')]=function(_0x41fdb6){return client[_0x3ff3('0x2')](_0x3ff3('0x3'),{'body':_0x41fdb6,'log':_0x3ff3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 5130c80..808834b 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 _0x66c3=['getMailQueues','GetMailQueue','name','timeout','User','Agents','mailPause','../client'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x66c3,0x187));var _0x366c=function(_0x5d3dbc,_0x11955b){_0x5d3dbc=_0x5d3dbc-0x0;var _0x515b7e=_0x66c3[_0x5d3dbc];return _0x515b7e;};'use strict';var client=require(_0x366c('0x0'));exports[_0x366c('0x1')]=function(){return function(){return client['Request'](_0x366c('0x2'),{'options':{'raw':![],'attributes':['id',_0x366c('0x3'),_0x366c('0x4'),'strategy'],'include':[{'model':_0x366c('0x5'),'as':_0x366c('0x6'),'attributes':['id',_0x366c('0x3'),'online',_0x366c('0x7')]}]},'log':_0x366c('0x1')});};}; \ No newline at end of file +var _0xbf32=['GetMailQueue','timeout','strategy','User','Agents','name','online','getMailQueues','Request'];(function(_0x567ec0,_0x676a8e){var _0x109c75=function(_0x3087d5){while(--_0x3087d5){_0x567ec0['push'](_0x567ec0['shift']());}};_0x109c75(++_0x676a8e);}(_0xbf32,0xbc));var _0x2bf3=function(_0xe3210a,_0x36955b){_0xe3210a=_0xe3210a-0x0;var _0xbb2f13=_0xbf32[_0xe3210a];return _0xbb2f13;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x2bf3('0x0')](_0x2bf3('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x2bf3('0x2'),_0x2bf3('0x3')],'include':[{'model':_0x2bf3('0x4'),'as':_0x2bf3('0x5'),'attributes':['id',_0x2bf3('0x6'),_0x2bf3('0x7'),'mailPause']}]},'log':_0x2bf3('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 27302e6..def6034 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 _0xbe43=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','Request'];(function(_0x394bdc,_0x359cb2){var _0x41ca75=function(_0x5cf344){while(--_0x5cf344){_0x394bdc['push'](_0x394bdc['shift']());}};_0x41ca75(++_0x359cb2);}(_0xbe43,0x19c));var _0x3be4=function(_0xdcfede,_0x21d1ae){_0xdcfede=_0xdcfede-0x0;var _0x54344f=_0xbe43[_0xdcfede];return _0x54344f;};'use strict';var client=require(_0x3be4('0x0'));exports['create']=function(_0x24b91a){return client[_0x3be4('0x1')](_0x3be4('0x2'),{'body':_0x24b91a,'log':'CreateMailQueueReport'});};exports[_0x3be4('0x3')]=function(_0x5035fb,_0x1d9ce9){return client['Request'](_0x3be4('0x4'),{'body':_0x1d9ce9,'options':{'where':{'uniqueid':_0x5035fb},'order':[['id',_0x3be4('0x5')]],'limit':0x1},'log':_0x3be4('0x4')});}; \ No newline at end of file +var _0xa556=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xa556,0x14e));var _0x6a55=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xa556[_0x4c445a];return _0x2f611c;};'use strict';var client=require(_0x6a55('0x0'));exports[_0x6a55('0x1')]=function(_0x38aab5){return client[_0x6a55('0x2')](_0x6a55('0x3'),{'body':_0x38aab5,'log':_0x6a55('0x3')});};exports[_0x6a55('0x4')]=function(_0xc81491,_0x19596b){return client['Request'](_0x6a55('0x5'),{'body':_0x19596b,'options':{'where':{'uniqueid':_0xc81491},'order':[['id',_0x6a55('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9f4ef09..aca8bc9 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 _0x214f=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x214f,0x72));var _0xf214=function(_0x51fa7c,_0x18afb8){_0x51fa7c=_0x51fa7c-0x0;var _0x46b918=_0x214f[_0x51fa7c];return _0x46b918;};'use strict';var client=require('../client');exports[_0xf214('0x0')]=function(_0x319536,_0x3dc31e){return client[_0xf214('0x1')](_0xf214('0x2'),{'body':_0x3dc31e,'options':{'where':{'id':_0x319536}},'log':_0xf214('0x3')});};exports['addTags']=function(_0x157aa5,_0x920688){return client['Request'](_0xf214('0x4'),{'body':_0x920688,'options':{'where':{'id':_0x157aa5}},'log':_0xf214('0x5')});}; \ No newline at end of file +var _0x094f=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x15f8f1,_0xb727dd){var _0x5c2913=function(_0x2bdb8d){while(--_0x2bdb8d){_0x15f8f1['push'](_0x15f8f1['shift']());}};_0x5c2913(++_0xb727dd);}(_0x094f,0xb2));var _0xf094=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x094f[_0x3070dc];return _0x431489;};'use strict';var client=require(_0xf094('0x0'));exports[_0xf094('0x1')]=function(_0x387693,_0x395a24){return client[_0xf094('0x2')](_0xf094('0x3'),{'body':_0x395a24,'options':{'where':{'id':_0x387693}},'log':_0xf094('0x4')});};exports[_0xf094('0x5')]=function(_0xd15b1b,_0x203e4d){return client[_0xf094('0x2')](_0xf094('0x6'),{'body':_0x203e4d,'options':{'where':{'id':_0xd15b1b}},'log':_0xf094('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bf07684..187d314 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 _0xaa88=['create','Request','createOpenchannelMessage','../client'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xaa88,0x137));var _0x8aa8=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xaa88[_0x138f59];return _0x3d114d;};'use strict';var client=require(_0x8aa8('0x0'));exports[_0x8aa8('0x1')]=function(_0x1643a6){return client[_0x8aa8('0x2')]('CreateOpenchannelMessage',{'body':_0x1643a6,'log':_0x8aa8('0x3')});}; \ No newline at end of file +var _0xe706=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x37325d,_0xb4629){var _0x4543f1=function(_0x51cd45){while(--_0x51cd45){_0x37325d['push'](_0x37325d['shift']());}};_0x4543f1(++_0xb4629);}(_0xe706,0xa3));var _0x6e70=function(_0xb1ee0e,_0x2126df){_0xb1ee0e=_0xb1ee0e-0x0;var _0x376116=_0xe706[_0xb1ee0e];return _0x376116;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(_0x311951){return client['Request'](_0x6e70('0x2'),{'body':_0x311951,'log':_0x6e70('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 81f7dec..d67deaf 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 _0x73a3=['../client','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x73a3,0x7e));var _0x373a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x73a3[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x373a('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x373a('0x1')](_0x373a('0x2'),{'options':{'raw':![],'attributes':['id',_0x373a('0x3'),_0x373a('0x4'),_0x373a('0x5')],'include':[{'model':_0x373a('0x6'),'as':_0x373a('0x7'),'attributes':['id',_0x373a('0x3'),_0x373a('0x8'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x7cfb=['timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request','name'];(function(_0x296d9d,_0x4d286b){var _0x53f5d0=function(_0x2ebcf9){while(--_0x2ebcf9){_0x296d9d['push'](_0x296d9d['shift']());}};_0x53f5d0(++_0x4d286b);}(_0x7cfb,0x83));var _0xb7cf=function(_0x5ec01f,_0x5bb347){_0x5ec01f=_0x5ec01f-0x0;var _0x27dfd4=_0x7cfb[_0x5ec01f];return _0x27dfd4;};'use strict';var client=require(_0xb7cf('0x0'));exports[_0xb7cf('0x1')]=function(){return function(){return client[_0xb7cf('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xb7cf('0x3'),_0xb7cf('0x4'),_0xb7cf('0x5')],'include':[{'model':_0xb7cf('0x6'),'as':_0xb7cf('0x7'),'attributes':['id',_0xb7cf('0x3'),'online',_0xb7cf('0x8')]}]},'log':_0xb7cf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1fd9d15..1edfa51 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 _0x6636=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x102403,_0x24c906){var _0x45aeb7=function(_0x47b47e){while(--_0x47b47e){_0x102403['push'](_0x102403['shift']());}};_0x45aeb7(++_0x24c906);}(_0x6636,0x7d));var _0x6663=function(_0x2ba0a0,_0x5c9461){_0x2ba0a0=_0x2ba0a0-0x0;var _0x9c46f8=_0x6636[_0x2ba0a0];return _0x9c46f8;};'use strict';var client=require(_0x6663('0x0'));exports[_0x6663('0x1')]=function(_0x8a8e32){return client[_0x6663('0x2')]('CreateOpenchannelQueueReport',{'body':_0x8a8e32,'log':_0x6663('0x3')});};exports[_0x6663('0x4')]=function(_0x479752,_0x4fdbb8){return client[_0x6663('0x2')](_0x6663('0x5'),{'body':_0x4fdbb8,'options':{'where':{'uniqueid':_0x479752},'order':[['id',_0x6663('0x6')]],'limit':0x1},'log':_0x6663('0x5')});}; \ No newline at end of file +var _0xad89=['DESC','../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x377b93,_0x3ae890){var _0x124bd1=function(_0x543545){while(--_0x543545){_0x377b93['push'](_0x377b93['shift']());}};_0x124bd1(++_0x3ae890);}(_0xad89,0xc7));var _0x9ad8=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0xad89[_0xd3b0ac];return _0x3d773e;};'use strict';var client=require(_0x9ad8('0x0'));exports['create']=function(_0x39f7ac){return client[_0x9ad8('0x1')](_0x9ad8('0x2'),{'body':_0x39f7ac,'log':_0x9ad8('0x2')});};exports[_0x9ad8('0x3')]=function(_0x1c1dd6,_0x2992a6){return client[_0x9ad8('0x1')](_0x9ad8('0x4'),{'body':_0x2992a6,'options':{'where':{'uniqueid':_0x1c1dd6},'order':[['id',_0x9ad8('0x5')]],'limit':0x1},'log':_0x9ad8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bd4d2c2..d5ffb19 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 _0x20c5=['../client','update','UpdateSmsInteraction','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x2f7508,_0x45d238){var _0x1a1ac7=function(_0x19d1ee){while(--_0x19d1ee){_0x2f7508['push'](_0x2f7508['shift']());}};_0x1a1ac7(++_0x45d238);}(_0x20c5,0x70));var _0x520c=function(_0x2ad5ac,_0x3ce592){_0x2ad5ac=_0x2ad5ac-0x0;var _0x5151d0=_0x20c5[_0x2ad5ac];return _0x5151d0;};'use strict';var client=require(_0x520c('0x0'));exports[_0x520c('0x1')]=function(_0x1a7b37,_0x393051){return client['Request'](_0x520c('0x2'),{'body':_0x393051,'options':{'where':{'id':_0x1a7b37}},'log':_0x520c('0x3')});};exports['addTags']=function(_0x2bd4fb,_0x1bacd8){return client[_0x520c('0x4')](_0x520c('0x5'),{'body':_0x1bacd8,'options':{'where':{'id':_0x2bd4fb}},'log':_0x520c('0x6')});}; \ No newline at end of file +var _0x88ff=['../client','update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x88ff,0x196));var _0xf88f=function(_0x27d5e9,_0x181117){_0x27d5e9=_0x27d5e9-0x0;var _0x1781ea=_0x88ff[_0x27d5e9];return _0x1781ea;};'use strict';var client=require(_0xf88f('0x0'));exports[_0xf88f('0x1')]=function(_0xb886d1,_0x81aba5){return client[_0xf88f('0x2')](_0xf88f('0x3'),{'body':_0x81aba5,'options':{'where':{'id':_0xb886d1}},'log':'updateSmsInteraction'});};exports[_0xf88f('0x4')]=function(_0x581915,_0x54158f){return client['Request'](_0xf88f('0x5'),{'body':_0x54158f,'options':{'where':{'id':_0x581915}},'log':_0xf88f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d1c79f3..dd6a921 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 _0xaa19=['createSmsMessage','../client','create','Request'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0xaa19,0x79));var _0x9aa1=function(_0x361756,_0x18bac7){_0x361756=_0x361756-0x0;var _0x3a714e=_0xaa19[_0x361756];return _0x3a714e;};'use strict';var client=require(_0x9aa1('0x0'));exports[_0x9aa1('0x1')]=function(_0xa7aed3){return client[_0x9aa1('0x2')]('CreateSmsMessage',{'body':_0xa7aed3,'log':_0x9aa1('0x3')});}; \ No newline at end of file +var _0x3d90=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x1258bf,_0x465d84){var _0x143b73=function(_0xd4772e){while(--_0xd4772e){_0x1258bf['push'](_0x1258bf['shift']());}};_0x143b73(++_0x465d84);}(_0x3d90,0x169));var _0x03d9=function(_0x454ef2,_0x2e15bb){_0x454ef2=_0x454ef2-0x0;var _0x4d8d4e=_0x3d90[_0x454ef2];return _0x4d8d4e;};'use strict';var client=require(_0x03d9('0x0'));exports[_0x03d9('0x1')]=function(_0x3a5b33){return client[_0x03d9('0x2')](_0x03d9('0x3'),{'body':_0x3a5b33,'log':_0x03d9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 25e89bf..5f87b96 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 _0x8868=['name','Agents','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x8868,0x1ac));var _0x8886=function(_0x343388,_0x352e09){_0x343388=_0x343388-0x0;var _0x5d7549=_0x8868[_0x343388];return _0x5d7549;};'use strict';var client=require(_0x8886('0x0'));exports[_0x8886('0x1')]=function(){return function(){return client[_0x8886('0x2')](_0x8886('0x3'),{'options':{'raw':![],'attributes':['id',_0x8886('0x4'),'timeout','strategy'],'include':[{'model':'User','as':_0x8886('0x5'),'attributes':['id','name',_0x8886('0x6'),_0x8886('0x7')]}]},'log':_0x8886('0x1')});};}; \ No newline at end of file +var _0x917f=['Request','GetSmsQueue','name','strategy','User','online','smsPause','getSmsQueues'];(function(_0x34df46,_0x59328b){var _0xd9ddc=function(_0x54c982){while(--_0x54c982){_0x34df46['push'](_0x34df46['shift']());}};_0xd9ddc(++_0x59328b);}(_0x917f,0x110));var _0xf917=function(_0x2ed346,_0x28df6d){_0x2ed346=_0x2ed346-0x0;var _0x2ce368=_0x917f[_0x2ed346];return _0x2ce368;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0xf917('0x0')](_0xf917('0x1'),{'options':{'raw':![],'attributes':['id',_0xf917('0x2'),'timeout',_0xf917('0x3')],'include':[{'model':_0xf917('0x4'),'as':'Agents','attributes':['id',_0xf917('0x2'),_0xf917('0x5'),_0xf917('0x6')]}]},'log':_0xf917('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ba121bb..ccec7e1 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 _0x7269=['create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC','../client'];(function(_0x34b157,_0x463ef8){var _0x63a419=function(_0x13757a){while(--_0x13757a){_0x34b157['push'](_0x34b157['shift']());}};_0x63a419(++_0x463ef8);}(_0x7269,0x76));var _0x9726=function(_0x42fa16,_0x90680){_0x42fa16=_0x42fa16-0x0;var _0x2887a0=_0x7269[_0x42fa16];return _0x2887a0;};'use strict';var client=require(_0x9726('0x0'));exports[_0x9726('0x1')]=function(_0x28ac74){return client['Request']('CreateSmsQueueReport',{'body':_0x28ac74,'log':_0x9726('0x2')});};exports[_0x9726('0x3')]=function(_0x5716df,_0x10ad10){return client[_0x9726('0x4')](_0x9726('0x5'),{'body':_0x10ad10,'options':{'where':{'uniqueid':_0x5716df},'order':[['id',_0x9726('0x6')]],'limit':0x1},'log':_0x9726('0x5')});}; \ No newline at end of file +var _0x48ac=['Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC','create'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0x48ac,0xe0));var _0xc48a=function(_0xb841fc,_0xe01a32){_0xb841fc=_0xb841fc-0x0;var _0x126bb9=_0x48ac[_0xb841fc];return _0x126bb9;};'use strict';var client=require('../client');exports[_0xc48a('0x0')]=function(_0x550d61){return client[_0xc48a('0x1')](_0xc48a('0x2'),{'body':_0x550d61,'log':_0xc48a('0x2')});};exports['update']=function(_0xb867b,_0x11a4da){return client[_0xc48a('0x1')](_0xc48a('0x3'),{'body':_0x11a4da,'options':{'where':{'uniqueid':_0xb867b},'order':[['id',_0xc48a('0x4')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 81f26b5..5aa6520 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 _0x6f09=['chatPause','mailPause','smsPause','openchannelPause','chatCapacity','faxCapacity','openchannelCapacity','../client','getAgents','GetUser','online','pauseType','lastPauseAt','voicePause'];(function(_0x5b9b16,_0x130bc5){var _0x3cb207=function(_0x4d46c3){while(--_0x4d46c3){_0x5b9b16['push'](_0x5b9b16['shift']());}};_0x3cb207(++_0x130bc5);}(_0x6f09,0x103));var _0x96f0=function(_0x327824,_0x4db39c){_0x327824=_0x327824-0x0;var _0x41b13e=_0x6f09[_0x327824];return _0x41b13e;};'use strict';var client=require(_0x96f0('0x0'));exports[_0x96f0('0x1')]=function(){return function(){return client['Request'](_0x96f0('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0x96f0('0x3'),_0x96f0('0x4'),_0x96f0('0x5'),_0x96f0('0x6'),_0x96f0('0x7'),_0x96f0('0x8'),'faxPause',_0x96f0('0x9'),'whatsappPause',_0x96f0('0xa'),_0x96f0('0xb'),'mailCapacity',_0x96f0('0xc'),'smsCapacity','whatsappCapacity',_0x96f0('0xd')]},'log':_0x96f0('0x1')});};}; \ No newline at end of file +var _0xbfc0=['smsPause','whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','getAgents','../client','Request','GetUser','name','online','lastPauseAt','voicePause','chatPause','mailPause','faxPause'];(function(_0x3c66e5,_0xab5ea3){var _0x678a=function(_0xd43f50){while(--_0xd43f50){_0x3c66e5['push'](_0x3c66e5['shift']());}};_0x678a(++_0xab5ea3);}(_0xbfc0,0x128));var _0x0bfc=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0xbfc0[_0x47e309];return _0x2e1900;};'use strict';var client=require(_0x0bfc('0x0'));exports['getAgents']=function(){return function(){return client[_0x0bfc('0x1')](_0x0bfc('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0bfc('0x3'),_0x0bfc('0x4'),'pauseType',_0x0bfc('0x5'),_0x0bfc('0x6'),_0x0bfc('0x7'),_0x0bfc('0x8'),_0x0bfc('0x9'),_0x0bfc('0xa'),_0x0bfc('0xb'),'openchannelPause',_0x0bfc('0xc'),_0x0bfc('0xd'),_0x0bfc('0xe'),_0x0bfc('0xf'),_0x0bfc('0x10'),'openchannelCapacity']},'log':_0x0bfc('0x11')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index de3c667..8f933a2 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 _0xa1a5=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x3fcc3f,_0x6b1907){_0x3fcc3f=_0x3fcc3f-0x0;var _0x207939=_0xa1a5[_0x3fcc3f];return _0x207939;};'use strict';var client=require(_0x5a1a('0x0'));exports['update']=function(_0xe8a51b,_0x47102b){return client[_0x5a1a('0x1')](_0x5a1a('0x2'),{'body':_0x47102b,'options':{'where':{'id':_0xe8a51b}},'log':_0x5a1a('0x3')});};exports['addTags']=function(_0x3d3652,_0x12138d){return client[_0x5a1a('0x1')](_0x5a1a('0x4'),{'body':_0x12138d,'options':{'where':{'id':_0x3d3652}},'log':_0x5a1a('0x5')});}; \ No newline at end of file +var _0x70e0=['addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x49ee70,_0x115b1e){var _0x3a7254=function(_0x1bc688){while(--_0x1bc688){_0x49ee70['push'](_0x49ee70['shift']());}};_0x3a7254(++_0x115b1e);}(_0x70e0,0x17b));var _0x070e=function(_0x50ccb9,_0x4651a7){_0x50ccb9=_0x50ccb9-0x0;var _0x21b7ce=_0x70e0[_0x50ccb9];return _0x21b7ce;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb){return client['Request'](_0x070e('0x2'),{'body':_0x4d95bb,'options':{'where':{'id':_0x198c2e}},'log':_0x070e('0x3')});};exports[_0x070e('0x4')]=function(_0x2593e5,_0x5c90fc){return client[_0x070e('0x5')]('AddTagsToWhatsappInteraction',{'body':_0x5c90fc,'options':{'where':{'id':_0x2593e5}},'log':_0x070e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a11bf42..31d2c5e 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 _0x9d3b=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x652c36,_0xbd54a1){var _0x30c32f=function(_0x1533dc){while(--_0x1533dc){_0x652c36['push'](_0x652c36['shift']());}};_0x30c32f(++_0xbd54a1);}(_0x9d3b,0x193));var _0xb9d3=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x9d3b[_0xbc4560];return _0x298cfb;};'use strict';var client=require(_0xb9d3('0x0'));exports[_0xb9d3('0x1')]=function(_0x2e8a35){return client[_0xb9d3('0x2')](_0xb9d3('0x3'),{'body':_0x2e8a35,'log':_0xb9d3('0x4')});}; \ No newline at end of file +var _0x09cd=['CreateWhatsappMessage','../client'];(function(_0x320cf5,_0x4e437d){var _0xa77006=function(_0x854b9c){while(--_0x854b9c){_0x320cf5['push'](_0x320cf5['shift']());}};_0xa77006(++_0x4e437d);}(_0x09cd,0x143));var _0xd09c=function(_0xd423bf,_0x5b6804){_0xd423bf=_0xd423bf-0x0;var _0x45d387=_0x09cd[_0xd423bf];return _0x45d387;};'use strict';var client=require(_0xd09c('0x0'));exports['create']=function(_0x2f4b58){return client['Request'](_0xd09c('0x1'),{'body':_0x2f4b58,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1231b2b..cd88d5d 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 _0x19e1=['User','name','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','strategy'];(function(_0x4f3001,_0x651650){var _0x464e18=function(_0x3428ab){while(--_0x3428ab){_0x4f3001['push'](_0x4f3001['shift']());}};_0x464e18(++_0x651650);}(_0x19e1,0x163));var _0x119e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x19e1[_0x5317b5];return _0x3b7ce2;};'use strict';var client=require(_0x119e('0x0'));exports[_0x119e('0x1')]=function(){return function(){return client[_0x119e('0x2')](_0x119e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x119e('0x4')],'include':[{'model':_0x119e('0x5'),'as':'Agents','attributes':['id',_0x119e('0x6'),_0x119e('0x7'),'whatsappPause']}]},'log':_0x119e('0x1')});};}; \ No newline at end of file +var _0xbee3=['User','Agents','whatsappPause','getWhatsappQueues','name','timeout'];(function(_0x11d242,_0x6d7c82){var _0xe72024=function(_0x424b0e){while(--_0x424b0e){_0x11d242['push'](_0x11d242['shift']());}};_0xe72024(++_0x6d7c82);}(_0xbee3,0xd5));var _0x3bee=function(_0xe18b9f,_0x5154db){_0xe18b9f=_0xe18b9f-0x0;var _0x1aa3e9=_0xbee3[_0xe18b9f];return _0x1aa3e9;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x3bee('0x1'),_0x3bee('0x2'),'strategy'],'include':[{'model':_0x3bee('0x3'),'as':_0x3bee('0x4'),'attributes':['id',_0x3bee('0x1'),'online',_0x3bee('0x5')]}]},'log':_0x3bee('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 13e88c6..21ff8fc 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 _0x4061=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x5257f4,_0x54558d){var _0x463559=function(_0x3c5ce8){while(--_0x3c5ce8){_0x5257f4['push'](_0x5257f4['shift']());}};_0x463559(++_0x54558d);}(_0x4061,0xe0));var _0x1406=function(_0x2c47ff,_0x1c5c61){_0x2c47ff=_0x2c47ff-0x0;var _0x4c85ca=_0x4061[_0x2c47ff];return _0x4c85ca;};'use strict';var client=require(_0x1406('0x0'));exports[_0x1406('0x1')]=function(_0x28c77d){return client[_0x1406('0x2')]('CreateWhatsappQueueReport',{'body':_0x28c77d,'log':_0x1406('0x3')});};exports[_0x1406('0x4')]=function(_0x41af52,_0x5981a6){return client[_0x1406('0x2')](_0x1406('0x5'),{'body':_0x5981a6,'options':{'where':{'uniqueid':_0x41af52},'order':[['id',_0x1406('0x6')]],'limit':0x1},'log':_0x1406('0x5')});}; \ No newline at end of file +var _0x0313=['DESC','../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x3cb53b,_0x2a9366){var _0x471628=function(_0x288bc2){while(--_0x288bc2){_0x3cb53b['push'](_0x3cb53b['shift']());}};_0x471628(++_0x2a9366);}(_0x0313,0x163));var _0x3031=function(_0x21c37f,_0x518fe0){_0x21c37f=_0x21c37f-0x0;var _0x5ea4bf=_0x0313[_0x21c37f];return _0x5ea4bf;};'use strict';var client=require(_0x3031('0x0'));exports['create']=function(_0x552bec){return client[_0x3031('0x1')]('CreateWhatsappQueueReport',{'body':_0x552bec,'log':_0x3031('0x2')});};exports[_0x3031('0x3')]=function(_0x32752d,_0x4f5c8a){return client[_0x3031('0x1')](_0x3031('0x4'),{'body':_0x4f5c8a,'options':{'where':{'uniqueid':_0x32752d},'order':[['id',_0x3031('0x5')]],'limit':0x1},'log':_0x3031('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 47835c7..752bb4f 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 _0x0ab8=['toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x44c14b,_0x29b7e4){var _0xcf6b96=function(_0x5eef5b){while(--_0x5eef5b){_0x44c14b['push'](_0x44c14b['shift']());}};_0xcf6b96(++_0x29b7e4);}(_0x0ab8,0xa6));var _0x80ab=function(_0x19c2a0,_0x31f9fa){_0x19c2a0=_0x19c2a0-0x0;var _0x11d0e3=_0x0ab8[_0x19c2a0];return _0x11d0e3;};'use strict';var schema=require(_0x80ab('0x0'));var _=require(_0x80ab('0x1'));var util=require(_0x80ab('0x2'));var seqqueue=require(_0x80ab('0x3'));var logger=require(_0x80ab('0x4'))(_0x80ab('0x5'));var strategy=require(_0x80ab('0x6'));var queue=schema({'name':{'type':_0x80ab('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x80ab('0x8'),'message':_0x80ab('0x9')}});function writeLog(_0x17ad36,_0x25248e,_0x10ddf6){return logger[_0x80ab('0xa')](util[_0x80ab('0xb')](_0x80ab('0xc'),_0x17ad36,_0x25248e['name'],_0x10ddf6));}function handleFindAgent(_0x554582){return function(_0x11ba57){return _0x11ba57[_0x80ab('0xd')]['toLowerCase']()===_0x554582[_0x80ab('0xe')]();};}exports[_0x80ab('0xf')]=function(_0x317b6e,_0x2c7d6e,_0xfb3548,_0x3308d4){return function(_0x1f312f){try{var _0x1bf863={'name':_0x2c7d6e[0x0],'timeout':_0x2c7d6e[0x1]};var _0x449926=queue['validate'](_0x1bf863,{'typecast':!![]});if(_0x449926[_0x80ab('0x10')]){logger['error'](_0x80ab('0x11'),_0x317b6e,_[_0x80ab('0x12')](_0x449926,_0x80ab('0x13'))['join'](',\x20'));_0x1f312f['stop']();}else{var _0x30bb7e=_['find'](_0xfb3548[_0x80ab('0x14')],handleFindAgent(_0x1bf863[_0x80ab('0xd')]));if(_0x30bb7e){var _0x4ac12c=(_0x1bf863[_0x80ab('0x15')]||0xa)*0x3e8;var _0x207d24,_0x51e311;var _0x590f9a=seqqueue['createQueue'](_0x4ac12c);_0x590f9a['id']=_0x317b6e;_0x590f9a['atimeout']=_0x4ac12c;_0x590f9a['channel']=_0x3308d4[_0x80ab('0x16')];writeLog(_0x317b6e,_0x30bb7e,util[_0x80ab('0xb')](_0x80ab('0x17'),_0x4ac12c));_0xfb3548[_0x80ab('0x18')][_0x317b6e]['on'](_0x80ab('0x19'),function(){logger['info'](_0x80ab('0x1a'),_0x317b6e);clearTimeout(_0x51e311);_0x51e311=undefined;_0x590f9a[_0x80ab('0x1b')]();if(_0xfb3548[_0x80ab('0x18')][_0x317b6e]){delete _0xfb3548[_0x80ab('0x18')][_0x317b6e];}_0x1f312f[_0x80ab('0x1c')]();});_0xfb3548[_0x80ab('0x18')][_0x317b6e]['on']('complete',function(){if(_0xfb3548[_0x80ab('0x18')][_0x317b6e]){delete _0xfb3548[_0x80ab('0x18')][_0x317b6e];}});_0x51e311=setTimeout(function(){logger[_0x80ab('0xa')](_0x80ab('0x1d'),_0x317b6e);clearTimeout(_0x51e311);_0x590f9a[_0x80ab('0x1b')]();_0x1f312f[_0x80ab('0x1e')]();},_0x4ac12c);strategy[_0x80ab('0x1f')](_0x590f9a,_0x30bb7e,_0xfb3548,_0x3308d4);}else{logger['error'](_0x80ab('0x20'),_0x317b6e,_0x1bf863['name']);_0x1f312f['stop']();}}}catch(_0x34b345){console[_0x80ab('0x21')](_0x34b345);logger[_0x80ab('0x22')]('[%s][QUEUE]\x20%s',_0x317b6e,_0x34b345[_0x80ab('0x23')]);_0x1f312f['stop']();}};}; \ No newline at end of file +var _0x4f69=['toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x5ce268,_0x1835b6){var _0x28c96a=function(_0x18c1d6){while(--_0x18c1d6){_0x5ce268['push'](_0x5ce268['shift']());}};_0x28c96a(++_0x1835b6);}(_0x4f69,0x10c));var _0x94f6=function(_0x1b8c71,_0x41d8ab){_0x1b8c71=_0x1b8c71-0x0;var _0x539905=_0x4f69[_0x1b8c71];return _0x539905;};'use strict';var schema=require(_0x94f6('0x0'));var _=require(_0x94f6('0x1'));var util=require(_0x94f6('0x2'));var seqqueue=require(_0x94f6('0x3'));var logger=require(_0x94f6('0x4'))(_0x94f6('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x94f6('0x6'),'required':!![],'message':_0x94f6('0x7')},'timeout':{'type':'number','message':_0x94f6('0x8')}});function writeLog(_0x47f9a4,_0x40d0a2,_0x22a330){return logger[_0x94f6('0x9')](util['format'](_0x94f6('0xa'),_0x47f9a4,_0x40d0a2[_0x94f6('0xb')],_0x22a330));}function handleFindAgent(_0x90ec99){return function(_0x9131af){return _0x9131af['name']['toLowerCase']()===_0x90ec99[_0x94f6('0xc')]();};}exports[_0x94f6('0xd')]=function(_0x25061d,_0x5b5558,_0x27a138,_0x5712dc){return function(_0x48eb8b){try{var _0x2ab1bf={'name':_0x5b5558[0x0],'timeout':_0x5b5558[0x1]};var _0x6c43b5=queue[_0x94f6('0x0')](_0x2ab1bf,{'typecast':!![]});if(_0x6c43b5[_0x94f6('0xe')]){logger[_0x94f6('0xf')](_0x94f6('0x10'),_0x25061d,_['map'](_0x6c43b5,_0x94f6('0x11'))[_0x94f6('0x12')](',\x20'));_0x48eb8b[_0x94f6('0x13')]();}else{var _0x44425d=_[_0x94f6('0x14')](_0x27a138[_0x94f6('0x15')],handleFindAgent(_0x2ab1bf[_0x94f6('0xb')]));if(_0x44425d){var _0x4cf346=(_0x2ab1bf[_0x94f6('0x16')]||0xa)*0x3e8;var _0x475636,_0x339fe1;var _0x62d749=seqqueue['createQueue'](_0x4cf346);_0x62d749['id']=_0x25061d;_0x62d749['atimeout']=_0x4cf346;_0x62d749['channel']=_0x5712dc[_0x94f6('0x17')];writeLog(_0x25061d,_0x44425d,util['format'](_0x94f6('0x18'),_0x4cf346));_0x27a138[_0x94f6('0x19')][_0x25061d]['on'](_0x94f6('0x1a'),function(){logger[_0x94f6('0x9')](_0x94f6('0x1b'),_0x25061d);clearTimeout(_0x339fe1);_0x339fe1=undefined;_0x62d749[_0x94f6('0x1c')]();if(_0x27a138[_0x94f6('0x19')][_0x25061d]){delete _0x27a138['rules'][_0x25061d];}_0x48eb8b[_0x94f6('0x13')]();});_0x27a138[_0x94f6('0x19')][_0x25061d]['on'](_0x94f6('0x1d'),function(){if(_0x27a138[_0x94f6('0x19')][_0x25061d]){delete _0x27a138[_0x94f6('0x19')][_0x25061d];}});_0x339fe1=setTimeout(function(){logger[_0x94f6('0x9')](_0x94f6('0x1e'),_0x25061d);clearTimeout(_0x339fe1);_0x62d749['close']();_0x48eb8b[_0x94f6('0x1f')]();},_0x4cf346);strategy['agent'](_0x62d749,_0x44425d,_0x27a138,_0x5712dc);}else{logger['error'](_0x94f6('0x20'),_0x25061d,_0x2ab1bf[_0x94f6('0xb')]);_0x48eb8b[_0x94f6('0x13')]();}}}catch(_0x1fe0e4){console[_0x94f6('0x21')](_0x1fe0e4);logger['error']('[%s][QUEUE]\x20%s',_0x25061d,_0x1fe0e4[_0x94f6('0x22')]);_0x48eb8b[_0x94f6('0x13')]();}};}; \ 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 424c912..d254339 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 _0x687b=['LexRuntime','$LATEST','channel','postText','message','amazonlex','Failed','stringify','lodash','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x5b406e,_0xcd06bc){var _0xe7d242=function(_0x3fc6cc){while(--_0x3fc6cc){_0x5b406e['push'](_0x5b406e['shift']());}};_0xe7d242(++_0xcd06bc);}(_0x687b,0x14a));var _0xb687=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x687b[_0x43dc7e];return _0x21e12d;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var AWS=require(_0xb687('0x2'));var utils=require(_0xb687('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xb687('0x4')),'openchannelMessage':require(_0xb687('0x5')),'mailMessage':require(_0xb687('0x6')),'smsMessage':require(_0xb687('0x7')),'faxMessage':require(_0xb687('0x8')),'whatsappMessage':require(_0xb687('0x9'))};exports[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return function(_0x27b750){try{if(!_['isNil'](this[_0xb687('0xb')][_0xb687('0xc')])){logger['info'](_0xb687('0xd'),_0xf43a1f,_0xb687('0xe'));return _0x27b750[_0xb687('0xf')]();}var _0x15dc9a={'ContactId':this[_0xb687('0x10')]['id'],'sentAt':moment()[_0xb687('0x11')](_0xb687('0x12')),'direction':_0xb687('0x13')};var _0x5e61e=this['channel'];if(_0x5e61e===_0xb687('0x14')){_0x15dc9a[_0xb687('0x15')]=this[_0xb687('0x16')]['id'];}else{_0x15dc9a[_[_0xb687('0x17')](_0x5e61e)+'AccountId']=this['account']['id'];}_0x15dc9a[_[_0xb687('0x17')](_0x5e61e)+_0xb687('0x18')]=this['interaction']['id'];if(this[_0xb687('0xb')][_0xb687('0x19')]){var _0x1f1f35=_0x47ffea[0x4];if(!_[_0xb687('0x1a')](_0x1f1f35)){_0x15dc9a[_0xb687('0x1b')]=utils[_0xb687('0x1c')](_0x1f1f35,this);return rpc[_0x5e61e+_0xb687('0x1d')][_0xb687('0x1e')](_0x15dc9a)[_0xb687('0x1f')](function(_0x2c7a18){logger[_0xb687('0x20')](_0xb687('0xd'),_0xf43a1f,_0x15dc9a['body']);})[_0xb687('0x21')](function(_0x328301){logger[_0xb687('0x22')]('[%s][AMAZONLEX]\x20%s',_0xf43a1f,JSON['stringify'](_0x328301));})[_0xb687('0x23')](function(){logger[_0xb687('0x20')](_0xb687('0x24'),_0xf43a1f);_0x27b750['stop']();});}else{logger[_0xb687('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xf43a1f);_0x27b750[_0xb687('0x25')]();}}else{var _0x243236=this;var _0x170dc0=new AWS[(_0xb687('0x26'))]({'accessKeyId':_0x47ffea[0x0],'secretAccessKey':_0x47ffea[0x1],'region':_0x47ffea[0x2]});var _0x49d5a1={'botAlias':_0xb687('0x27'),'botName':_0x47ffea[0x3],'inputText':this['message'][_0xb687('0x1b')],'userId':this[_0xb687('0x28')]+':'+this[_0xb687('0xb')]['id']['toString']()};_0x170dc0[_0xb687('0x29')](_0x49d5a1,function(_0x491623,_0xa95e91){if(_0x491623){logger[_0xb687('0x22')](_0xb687('0xd'),_0xf43a1f,_0x491623[_0xb687('0x2a')]);_0x27b750[_0xb687('0xf')]();}else if(_0xa95e91&&_0xa95e91[_0xb687('0x2a')]){_0x243236['body'][_0xb687('0x2b')]=_0xa95e91;_0x15dc9a[_0xb687('0x1b')]=_0xa95e91[_0xb687('0x2a')];return rpc[_0x5e61e+_0xb687('0x1d')][_0xb687('0x1e')](_0x15dc9a)[_0xb687('0x1f')](function(_0x17ff2b){logger[_0xb687('0x20')](_0xb687('0xd'),_0xf43a1f,_0x15dc9a[_0xb687('0x1b')]);if(_0xa95e91['dialogState']==_0xb687('0x2c')){_0x27b750[_0xb687('0xf')]();}else{_0x27b750[_0xb687('0x25')]();}})[_0xb687('0x21')](function(_0x2e5c8d){logger[_0xb687('0x22')]('[%s][AMAZONLEX]\x20%s',_0xf43a1f,JSON[_0xb687('0x2d')](_0x2e5c8d));_0x27b750['next']();});}else{_0x27b750[_0xb687('0xf')]();}});}}catch(_0x40f35c){logger[_0xb687('0x22')](_0xb687('0xd'),_0xf43a1f,JSON[_0xb687('0x2d')](_0x40f35c));_0x27b750[_0xb687('0x25')]();}};}; \ No newline at end of file +var _0xc6ac=['amazonlex','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','AccountId','account','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString'];(function(_0x1dc856,_0x4b8813){var _0x3ad0d5=function(_0x587950){while(--_0x587950){_0x1dc856['push'](_0x1dc856['shift']());}};_0x3ad0d5(++_0x4b8813);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3ecb37,_0x1b9d0a){_0x3ecb37=_0x3ecb37-0x0;var _0x2ad5e3=_0xc6ac[_0x3ecb37];return _0x2ad5e3;};'use strict';var _=require(_0xcc6a('0x0'));var moment=require(_0xcc6a('0x1'));var AWS=require(_0xcc6a('0x2'));var utils=require(_0xcc6a('0x3'));var logger=require(_0xcc6a('0x4'))(_0xcc6a('0x5'));var rpc={'chatMessage':require(_0xcc6a('0x6')),'openchannelMessage':require(_0xcc6a('0x7')),'mailMessage':require(_0xcc6a('0x8')),'smsMessage':require(_0xcc6a('0x9')),'faxMessage':require(_0xcc6a('0xa')),'whatsappMessage':require(_0xcc6a('0xb'))};exports[_0xcc6a('0xc')]=function(_0x197bd7,_0x5f3887){return function(_0x3dd497){try{if(!_[_0xcc6a('0xd')](this[_0xcc6a('0xe')]['UserId'])){logger[_0xcc6a('0xf')](_0xcc6a('0x10'),_0x197bd7,_0xcc6a('0x11'));return _0x3dd497[_0xcc6a('0x12')]();}var _0x3eb04a={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcc6a('0x13')](_0xcc6a('0x14')),'direction':_0xcc6a('0x15')};var _0x4f034a=this[_0xcc6a('0x16')];if(_0x4f034a===_0xcc6a('0x17')){_0x3eb04a[_0xcc6a('0x18')]=this['account']['id'];}else{_0x3eb04a[_['upperFirst'](_0x4f034a)+_0xcc6a('0x19')]=this[_0xcc6a('0x1a')]['id'];}_0x3eb04a[_[_0xcc6a('0x1b')](_0x4f034a)+'InteractionId']=this['interaction']['id'];if(this[_0xcc6a('0xe')][_0xcc6a('0x1c')]){var _0x43710d=_0x5f3887[0x4];if(!_[_0xcc6a('0x1d')](_0x43710d)){_0x3eb04a[_0xcc6a('0x1e')]=utils[_0xcc6a('0x1f')](_0x43710d,this);return rpc[_0x4f034a+_0xcc6a('0x20')][_0xcc6a('0x21')](_0x3eb04a)['then'](function(_0x4e628f){logger['info'](_0xcc6a('0x10'),_0x197bd7,_0x3eb04a[_0xcc6a('0x1e')]);})[_0xcc6a('0x22')](function(_0x3e63d9){logger[_0xcc6a('0x23')](_0xcc6a('0x10'),_0x197bd7,JSON[_0xcc6a('0x24')](_0x3e63d9));})[_0xcc6a('0x25')](function(){logger[_0xcc6a('0xf')](_0xcc6a('0x26'),_0x197bd7);_0x3dd497[_0xcc6a('0x27')]();});}else{logger['info'](_0xcc6a('0x28'),_0x197bd7);_0x3dd497[_0xcc6a('0x27')]();}}else{var _0x355b6f=this;var _0x368a6e=new AWS[(_0xcc6a('0x29'))]({'accessKeyId':_0x5f3887[0x0],'secretAccessKey':_0x5f3887[0x1],'region':_0x5f3887[0x2]});var _0x30b8ed={'botAlias':_0xcc6a('0x2a'),'botName':_0x5f3887[0x3],'inputText':this[_0xcc6a('0x2b')][_0xcc6a('0x1e')],'userId':this[_0xcc6a('0x16')]+':'+this[_0xcc6a('0xe')]['id'][_0xcc6a('0x2c')]()};_0x368a6e['postText'](_0x30b8ed,function(_0x41c4c8,_0x3a081e){if(_0x41c4c8){logger[_0xcc6a('0x23')]('[%s][AMAZONLEX]\x20%s',_0x197bd7,_0x41c4c8[_0xcc6a('0x2b')]);_0x3dd497[_0xcc6a('0x12')]();}else if(_0x3a081e&&_0x3a081e[_0xcc6a('0x2b')]){_0x355b6f[_0xcc6a('0x1e')][_0xcc6a('0x2d')]=_0x3a081e;_0x3eb04a[_0xcc6a('0x1e')]=_0x3a081e['message'];return rpc[_0x4f034a+_0xcc6a('0x20')][_0xcc6a('0x21')](_0x3eb04a)[_0xcc6a('0x2e')](function(_0x5f27e5){logger[_0xcc6a('0xf')](_0xcc6a('0x10'),_0x197bd7,_0x3eb04a['body']);if(_0x3a081e[_0xcc6a('0x2f')]==_0xcc6a('0x30')){_0x3dd497[_0xcc6a('0x12')]();}else{_0x3dd497[_0xcc6a('0x27')]();}})['catch'](function(_0x194aab){logger[_0xcc6a('0x23')](_0xcc6a('0x10'),_0x197bd7,JSON['stringify'](_0x194aab));_0x3dd497[_0xcc6a('0x12')]();});}else{_0x3dd497['next']();}});}}catch(_0x4f67d3){logger[_0xcc6a('0x23')](_0xcc6a('0x10'),_0x197bd7,JSON[_0xcc6a('0x24')](_0x4f67d3));_0x3dd497[_0xcc6a('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index c60df31..c07ed74 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 _0xc78c=['error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','next','channel','contact','format','out','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','Message','Smtp','service','host','port','secure','authentication','auth','user','inReplyTo','messageId','html','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch'];(function(_0x36166d,_0x190c2b){var _0x4b8aee=function(_0x5aac67){while(--_0x5aac67){_0x36166d['push'](_0x36166d['shift']());}};_0x4b8aee(++_0x190c2b);}(_0xc78c,0x167));var _0xcc78=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc78c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcc78('0x0'));var moment=require(_0xcc78('0x1'));var utils=require(_0xcc78('0x2'));var logger=require(_0xcc78('0x3'))(_0xcc78('0x4'));var rpc={'chatMessage':require(_0xcc78('0x5')),'openchannelMessage':require(_0xcc78('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcc78('0x7')),'faxMessage':require(_0xcc78('0x8')),'whatsappMessage':require(_0xcc78('0x9'))};var mailRpc=require(_0xcc78('0xa'));exports[_0xcc78('0xb')]=function(_0x15af18,_0x4d79a0){return function(_0xf83344){try{if(_0x4d79a0[0x0]==='1'&&(_[_0xcc78('0xc')](this[_0xcc78('0xd')][_0xcc78('0xe')])||!this[_0xcc78('0xd')][_0xcc78('0xe')])){logger[_0xcc78('0xf')](_0xcc78('0x10'),_0x15af18,'Autoreply\x20already\x20sent');return _0xf83344[_0xcc78('0x11')]();}var _0x5af342=this[_0xcc78('0x12')];var _0x235dd0={'body':utils['getMustacheRender'](_0x4d79a0[0x1],this),'ContactId':this[_0xcc78('0x13')]['id'],'sentAt':moment()[_0xcc78('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcc78('0x15')};if(this[_0xcc78('0x16')]){_0x235dd0['to']=this[_0xcc78('0x16')]['from']||'';_0x235dd0['cc']=this[_0xcc78('0x16')]['cc']||'';_0x235dd0[_0xcc78('0x17')]=this[_0xcc78('0x16')]['to']||'';_0x235dd0[_0xcc78('0x18')]=this[_0xcc78('0x16')][_0xcc78('0x18')]||'';_0x235dd0[_0xcc78('0x19')]=!![];if(this['message'][_0xcc78('0x1a')]){_0x235dd0['subject']='';_0x235dd0[_0xcc78('0x1a')]+=_[_0xcc78('0x1b')](this[_0xcc78('0x16')][_0xcc78('0x1a')],'Re:')?'':_0xcc78('0x1c');_0x235dd0[_0xcc78('0x1a')]+=this[_0xcc78('0x16')][_0xcc78('0x1a')];}}if(this[_0xcc78('0x12')]===_0xcc78('0x1d')){_0x235dd0[_0xcc78('0x1e')]=this[_0xcc78('0x1f')]['id'];}else{_0x235dd0[_[_0xcc78('0x20')](this[_0xcc78('0x12')])+'AccountId']=this[_0xcc78('0x1f')]['id'];}_0x235dd0[_[_0xcc78('0x20')](this[_0xcc78('0x12')])+'InteractionId']=this[_0xcc78('0xd')]['id'];if(rpc[this[_0xcc78('0x12')]+_0xcc78('0x21')]){if(this[_0xcc78('0x12')]==='mail'){var _0x4df3e5={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xcc78('0x22')][_0xcc78('0x23')]){_0x4df3e5[_0xcc78('0x23')]=this['account'][_0xcc78('0x22')][_0xcc78('0x23')];}else{_0x4df3e5[_0xcc78('0x24')]=this[_0xcc78('0x1f')]['Smtp']['host'];_0x4df3e5[_0xcc78('0x25')]=this['account'][_0xcc78('0x22')][_0xcc78('0x25')];_0x4df3e5[_0xcc78('0x26')]=this[_0xcc78('0x1f')][_0xcc78('0x22')][_0xcc78('0x26')];}if(this[_0xcc78('0x1f')][_0xcc78('0x22')][_0xcc78('0x27')]){_0x4df3e5[_0xcc78('0x28')]={'user':this[_0xcc78('0x1f')][_0xcc78('0x22')][_0xcc78('0x29')],'pass':this[_0xcc78('0x1f')]['Smtp']['pass']};}_0x235dd0[_0xcc78('0x2a')]=this[_0xcc78('0x16')][_0xcc78('0x2b')];_0x235dd0[_0xcc78('0x2c')]=''+_['replace'](_0x235dd0[_0xcc78('0x2d')],_0xcc78('0x2e'),_0xcc78('0x2f'))+_0xcc78('0x30');return mailRpc[_0xcc78('0x31')](_0x4df3e5,_0x235dd0)[_0xcc78('0x32')](function(_0x56f8b7){logger[_0xcc78('0xf')](_0xcc78('0x33'),_0x15af18);_0x235dd0[_0xcc78('0x2b')]=_0x56f8b7[_0xcc78('0x16')]['messageId'];return rpc[_0x5af342+_0xcc78('0x21')][_0xcc78('0x34')](_0x235dd0);})['then'](function(_0x22fa35){logger['info'](_0xcc78('0x10'),_0x15af18,JSON['stringify'](_0x22fa35));})[_0xcc78('0x35')](function(_0x206400){logger[_0xcc78('0x36')](_0xcc78('0x37'),_0x15af18,JSON['stringify'](_0x206400));})['finally'](function(){_0xf83344['next']();});}else{return rpc[this['channel']+_0xcc78('0x21')][_0xcc78('0x34')](_0x235dd0)['then'](function(_0x7c52d5){logger['info']('[%s][AUTOREPLY]\x20%s',_0x15af18,_0x235dd0[_0xcc78('0x2d')]);})[_0xcc78('0x35')](function(_0x8672b1){logger[_0xcc78('0x36')](_0xcc78('0x10'),_0x15af18,JSON[_0xcc78('0x38')](_0x8672b1));})[_0xcc78('0x39')](function(){_0xf83344[_0xcc78('0x11')]();});}}}catch(_0x27870a){logger[_0xcc78('0x36')]('[%s][AUTOREPLY]\x20%s',_0x15af18,JSON[_0xcc78('0x38')](_0x27870a));_0xf83344[_0xcc78('0x3a')]();}};}; \ No newline at end of file +var _0x8063=['catch','stop','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','info','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','message','from','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','InteractionId','Message','mail','Smtp','service','host','port','secure','auth','pass','inReplyTo','messageId','html','','';return mailRpc[_0x3806('0x2c')](_0x4bc7d9,_0x3f02b6)[_0x3806('0x2d')](function(_0x525e06){logger[_0x3806('0xc')](_0x3806('0x2e'),_0x2595ab);_0x3f02b6[_0x3806('0x27')]=_0x525e06['message']['messageId'];return rpc[_0xa0d191+'Message']['create'](_0x3f02b6);})['then'](function(_0x979002){logger[_0x3806('0xc')](_0x3806('0x2f'),_0x2595ab,JSON['stringify'](_0x979002));})['catch'](function(_0x1e3c35){logger[_0x3806('0x30')](_0x3806('0x31'),_0x2595ab,JSON[_0x3806('0x32')](_0x1e3c35));})[_0x3806('0x33')](function(){_0xe954c[_0x3806('0xe')]();});}else{return rpc[this[_0x3806('0xf')]+_0x3806('0x1d')]['create'](_0x3f02b6)[_0x3806('0x2d')](function(_0x41f2e0){logger[_0x3806('0xc')](_0x3806('0x2f'),_0x2595ab,_0x3f02b6['body']);})[_0x3806('0x34')](function(_0x465f19){logger[_0x3806('0x30')](_0x3806('0x2f'),_0x2595ab,JSON[_0x3806('0x32')](_0x465f19));})[_0x3806('0x33')](function(){_0xe954c[_0x3806('0xe')]();});}}}catch(_0x5c5ac7){logger[_0x3806('0x30')](_0x3806('0x2f'),_0x2595ab,JSON[_0x3806('0x32')](_0x5c5ac7));_0xe954c[_0x3806('0x35')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index f5c687b..31c4362 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9851=['info','format','system','Interaction','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','error','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x9851,0x1f1));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x1985('0x0'));var logger=require('../../../../config/logger')(_0x1985('0x1'));var rpc={'chatInteraction':require(_0x1985('0x2')),'openchannelInteraction':require(_0x1985('0x3')),'smsInteraction':require(_0x1985('0x4')),'mailInteraction':require(_0x1985('0x5')),'faxInteraction':require(_0x1985('0x6')),'whatsappInteraction':require(_0x1985('0x7'))};exports[_0x1985('0x8')]=function(_0x41df88,_0x2c29d8,_0x54ed28,_0x8437f1){return function(_0x8a5919){try{logger[_0x1985('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x41df88,_0x2c29d8[0x0]);var _0x316889={'closed':0x1,'closedAt':moment()[_0x1985('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x1985('0xb'),'disposition':_0x2c29d8[0x0]};if(rpc[_0x8437f1['channel']+_0x1985('0xc')]){rpc[_0x8437f1[_0x1985('0xd')]+_0x1985('0xc')][_0x1985('0xe')](_0x8437f1[_0x1985('0xf')]['id'],_0x316889)[_0x1985('0x10')](function(_0x1532d8){logger[_0x1985('0x9')](_0x1985('0x11'),_0x41df88,_0x8437f1[_0x1985('0xf')]['id']);})[_0x1985('0x12')](function(_0x10e96b){logger['error'](_0x1985('0x13'),_0x41df88,JSON[_0x1985('0x14')](_0x10e96b));})['finally'](function(){_0x8a5919['stop']();});}}catch(_0x4cdde9){logger[_0x1985('0x15')](_0x1985('0x13'),_0x41df88,JSON['stringify'](_0x4cdde9));_0x8a5919[_0x1985('0x16')]();}};}; \ No newline at end of file +var _0x24ce=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','../../../../config/logger','routing'];(function(_0x34033d,_0x471338){var _0x20abf1=function(_0x3751d8){while(--_0x3751d8){_0x34033d['push'](_0x34033d['shift']());}};_0x20abf1(++_0x471338);}(_0x24ce,0x1de));var _0xe24c=function(_0x1f7dc1,_0xc0562d){_0x1f7dc1=_0x1f7dc1-0x0;var _0x36b0d6=_0x24ce[_0x1f7dc1];return _0x36b0d6;};'use strict';var moment=require('moment');var logger=require(_0xe24c('0x0'))(_0xe24c('0x1'));var rpc={'chatInteraction':require(_0xe24c('0x2')),'openchannelInteraction':require(_0xe24c('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe24c('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x33d18c,_0x18e92c,_0x6f92e0,_0x1ac59c){return function(_0xe1d970){try{logger['info'](_0xe24c('0x5'),_0x33d18c,_0x18e92c[0x0]);var _0x2d8dde={'closed':0x1,'closedAt':moment()[_0xe24c('0x6')](_0xe24c('0x7')),'closeReason':_0xe24c('0x8'),'disposition':_0x18e92c[0x0]};if(rpc[_0x1ac59c[_0xe24c('0x9')]+_0xe24c('0xa')]){rpc[_0x1ac59c[_0xe24c('0x9')]+_0xe24c('0xa')][_0xe24c('0xb')](_0x1ac59c[_0xe24c('0xc')]['id'],_0x2d8dde)[_0xe24c('0xd')](function(_0x2534a0){logger['info'](_0xe24c('0xe'),_0x33d18c,_0x1ac59c['interaction']['id']);})[_0xe24c('0xf')](function(_0x59a9b5){logger[_0xe24c('0x10')](_0xe24c('0x11'),_0x33d18c,JSON['stringify'](_0x59a9b5));})['finally'](function(){_0xe1d970['stop']();});}}catch(_0x3f0955){logger['error'](_0xe24c('0x11'),_0x33d18c,JSON[_0xe24c('0x12')](_0x3f0955));_0xe1d970[_0xe24c('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index e80994c..bbf0c15 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89a7=['speech','create','[%s][DIALOGFLOW]\x20%s','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','chat','account','upperFirst','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment'];(function(_0x42f2d7,_0x4d9cc5){var _0x29d6cd=function(_0x15ecfe){while(--_0x15ecfe){_0x42f2d7['push'](_0x42f2d7['shift']());}};_0x29d6cd(++_0x4d9cc5);}(_0x89a7,0x163));var _0x789a=function(_0x128bc3,_0x5376bd){_0x128bc3=_0x128bc3-0x0;var _0x202ab1=_0x89a7[_0x128bc3];return _0x202ab1;};'use strict';var _=require(_0x789a('0x0'));var moment=require(_0x789a('0x1'));var apiai=require(_0x789a('0x2'));var md5=require(_0x789a('0x3'));var utils=require(_0x789a('0x4'));var logger=require(_0x789a('0x5'))('routing');var rpc={'chatMessage':require(_0x789a('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x789a('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x789a('0x8')]=function(_0x3151f8,_0x2a580a){return function(_0x25b0d1){try{if(!_['isNil'](this[_0x789a('0x9')][_0x789a('0xa')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x3151f8,_0x789a('0xb'));return _0x25b0d1[_0x789a('0xc')]();}var _0x34a690={'ContactId':this[_0x789a('0xd')]['id'],'sentAt':moment()[_0x789a('0xe')](_0x789a('0xf')),'direction':'out'};var _0x288a60=this['channel'];if(_0x288a60===_0x789a('0x10')){_0x34a690['ChatWebsiteId']=this[_0x789a('0x11')]['id'];}else{_0x34a690[_[_0x789a('0x12')](_0x288a60)+'AccountId']=this[_0x789a('0x11')]['id'];}_0x34a690[_[_0x789a('0x12')](_0x288a60)+'InteractionId']=this[_0x789a('0x9')]['id'];if(this[_0x789a('0x9')]['created']){var _0x3e03b1=_0x2a580a[0x2];if(!_[_0x789a('0x13')](_0x3e03b1)){_0x34a690[_0x789a('0x14')]=utils[_0x789a('0x15')](_0x3e03b1,this);return rpc[_0x288a60+_0x789a('0x16')]['create'](_0x34a690)[_0x789a('0x17')](function(_0x4eacaf){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x3151f8,_0x34a690[_0x789a('0x14')]);})[_0x789a('0x18')](function(_0xf4ba83){logger[_0x789a('0x19')]('[%s][DIALOGFLOW]\x20%s',_0x3151f8,JSON[_0x789a('0x1a')](_0xf4ba83));})[_0x789a('0x1b')](function(){logger[_0x789a('0x1c')](_0x789a('0x1d'),_0x3151f8);_0x25b0d1[_0x789a('0x1e')]();});}else{logger[_0x789a('0x1c')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3151f8);_0x25b0d1[_0x789a('0x1e')]();}}else{var _0x55d126=this;var _0x4bab04=apiai(_0x2a580a[0x0],{'language':_0x2a580a[0x1]||'en'});return _0x4bab04['textRequest'](this[_0x789a('0x1f')][_0x789a('0x14')],{'sessionId':md5(this[_0x789a('0x9')]['id'])})[_0x789a('0x17')](function(_0x4b48eb){_0x55d126[_0x789a('0x14')][_0x789a('0x20')]=_0x4b48eb;_0x34a690[_0x789a('0x14')]=_0x4b48eb[_0x789a('0x21')][_0x789a('0x22')][_0x789a('0x23')];return rpc[_0x288a60+'Message'][_0x789a('0x24')](_0x34a690)['then'](function(_0x4d2fd3){logger[_0x789a('0x1c')](_0x789a('0x25'),_0x3151f8,_0x34a690['body']);if(_0x4b48eb[_0x789a('0x21')][_0x789a('0x26')]['endConversation']){_0x25b0d1['next']();}else{_0x25b0d1[_0x789a('0x1e')]();}})[_0x789a('0x18')](function(_0x265b72){logger[_0x789a('0x19')]('[%s][DIALOGFLOW]\x20%s',_0x3151f8,JSON[_0x789a('0x1a')](_0x265b72));_0x25b0d1[_0x789a('0xc')]();});})['catch'](function(_0x52c84b){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x3151f8,_0x52c84b[_0x789a('0x1f')]);_0x25b0d1[_0x789a('0xc')]();});}}catch(_0x375198){logger[_0x789a('0x19')](_0x789a('0x25'),_0x3151f8,JSON[_0x789a('0x1a')](_0x375198));_0x25b0d1['stop']();}};}; \ No newline at end of file +var _0xe49f=['textRequest','message','result','fulfillment','speech','metadata','endConversation','stringify','error','lodash','moment','apiai-promise','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','InteractionId','body','getMustacheRender','Message','create','then','catch','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0xb5130c,_0x263294){var _0x26cf96=function(_0x20cd0d){while(--_0x20cd0d){_0xb5130c['push'](_0xb5130c['shift']());}};_0x26cf96(++_0x263294);}(_0xe49f,0x159));var _0xfe49=function(_0x250773,_0x3622da){_0x250773=_0x250773-0x0;var _0x251b1f=_0xe49f[_0x250773];return _0x251b1f;};'use strict';var _=require(_0xfe49('0x0'));var moment=require(_0xfe49('0x1'));var apiai=require(_0xfe49('0x2'));var md5=require('md5');var utils=require(_0xfe49('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xfe49('0x4')),'openchannelMessage':require(_0xfe49('0x5')),'mailMessage':require(_0xfe49('0x6')),'smsMessage':require(_0xfe49('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfe49('0x8'))};exports[_0xfe49('0x9')]=function(_0x4315c9,_0x322c52){return function(_0x40107f){try{if(!_[_0xfe49('0xa')](this[_0xfe49('0xb')][_0xfe49('0xc')])){logger[_0xfe49('0xd')](_0xfe49('0xe'),_0x4315c9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x40107f[_0xfe49('0xf')]();}var _0x130529={'ContactId':this[_0xfe49('0x10')]['id'],'sentAt':moment()[_0xfe49('0x11')](_0xfe49('0x12')),'direction':'out'};var _0xf15a27=this[_0xfe49('0x13')];if(_0xf15a27===_0xfe49('0x14')){_0x130529['ChatWebsiteId']=this[_0xfe49('0x15')]['id'];}else{_0x130529[_['upperFirst'](_0xf15a27)+'AccountId']=this[_0xfe49('0x15')]['id'];}_0x130529[_[_0xfe49('0x16')](_0xf15a27)+_0xfe49('0x17')]=this[_0xfe49('0xb')]['id'];if(this[_0xfe49('0xb')]['created']){var _0x27f1db=_0x322c52[0x2];if(!_['isEmpty'](_0x27f1db)){_0x130529[_0xfe49('0x18')]=utils[_0xfe49('0x19')](_0x27f1db,this);return rpc[_0xf15a27+_0xfe49('0x1a')][_0xfe49('0x1b')](_0x130529)[_0xfe49('0x1c')](function(_0x2f9fd4){logger['info'](_0xfe49('0xe'),_0x4315c9,_0x130529['body']);})[_0xfe49('0x1d')](function(_0x503e41){logger['error'](_0xfe49('0xe'),_0x4315c9,JSON['stringify'](_0x503e41));})[_0xfe49('0x1e')](function(){logger[_0xfe49('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4315c9);_0x40107f[_0xfe49('0x1f')]();});}else{logger[_0xfe49('0xd')](_0xfe49('0x20'),_0x4315c9);_0x40107f[_0xfe49('0x1f')]();}}else{var _0x254d1e=this;var _0x25c283=apiai(_0x322c52[0x0],{'language':_0x322c52[0x1]||'en'});return _0x25c283[_0xfe49('0x21')](this[_0xfe49('0x22')][_0xfe49('0x18')],{'sessionId':md5(this[_0xfe49('0xb')]['id'])})['then'](function(_0x321158){_0x254d1e[_0xfe49('0x18')]['dialogflow']=_0x321158;_0x130529[_0xfe49('0x18')]=_0x321158[_0xfe49('0x23')][_0xfe49('0x24')][_0xfe49('0x25')];return rpc[_0xf15a27+'Message']['create'](_0x130529)[_0xfe49('0x1c')](function(_0x220484){logger[_0xfe49('0xd')](_0xfe49('0xe'),_0x4315c9,_0x130529[_0xfe49('0x18')]);if(_0x321158[_0xfe49('0x23')][_0xfe49('0x26')][_0xfe49('0x27')]){_0x40107f['next']();}else{_0x40107f[_0xfe49('0x1f')]();}})[_0xfe49('0x1d')](function(_0x1c2a4a){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x4315c9,JSON[_0xfe49('0x28')](_0x1c2a4a));_0x40107f[_0xfe49('0xf')]();});})[_0xfe49('0x1d')](function(_0xc5d171){logger[_0xfe49('0x29')](_0xfe49('0xe'),_0x4315c9,_0xc5d171[_0xfe49('0x22')]);_0x40107f[_0xfe49('0xf')]();});}}catch(_0x27bf40){logger[_0xfe49('0x29')](_0xfe49('0xe'),_0x4315c9,JSON[_0xfe49('0x28')](_0x27bf40));_0x40107f[_0xfe49('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index fd8f261..b3f5087 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb332=['stringify','validate','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x248bcf,_0x5c3835){var _0x235003=function(_0x434f6d){while(--_0x434f6d){_0x248bcf['push'](_0x248bcf['shift']());}};_0x235003(++_0x5c3835);}(_0xb332,0xb9));var _0x2b33=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xb332[_0x154cb5];return _0x3f574f;};'use strict';var schema=require(_0x2b33('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2b33('0x1'));var gotoif=schema({'condition':{'type':_0x2b33('0x2'),'required':!![],'message':_0x2b33('0x3')},'priorityTrue':{'type':_0x2b33('0x4'),'message':_0x2b33('0x5')},'priorityFalse':{'type':_0x2b33('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2b33('0x6')]=function(_0x45f3b0,_0x571572){return function(_0x5263d9){try{var _0x5bc67b={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x571572[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x571572[0x1],'priorityFalse':_0x571572[0x2]};var _0x14820a=gotoif[_0x2b33('0x0')](_0x5bc67b,{'typecast':!![]});if(_0x14820a[_0x2b33('0x7')]){logger[_0x2b33('0x8')](_0x2b33('0x9'),_0x45f3b0,_[_0x2b33('0xa')](_0x14820a,_0x2b33('0xb'))['join'](',\x20'));_0x5263d9[_0x2b33('0xc')]();}else{try{var _0x3dacbf=eval('('+_0x5bc67b[_0x2b33('0xd')]+')');var _0xafb39e=_0x3dacbf?_0x5bc67b[_0x2b33('0xe')]:_0x5bc67b[_0x2b33('0xf')];logger['info'](_0x2b33('0x10'),_0x45f3b0,_0x5bc67b[_0x2b33('0xd')],_0x3dacbf,_0xafb39e||_0x2b33('0x11'));if(_0xafb39e){var _0x2480ec=_[_0x2b33('0x12')](_0x5263d9[_0x2b33('0x13')](),{'p':_0xafb39e});if(_0x2480ec>=0x0){logger[_0x2b33('0x14')](_0x2b33('0x15'),_0x45f3b0,_0xafb39e||_0x2b33('0x11'),_0x2480ec);_0x5263d9[_0x2b33('0x11')](_0x2480ec);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x45f3b0,_0xafb39e||_0x2b33('0x11'));_0x5263d9[_0x2b33('0xc')]();}}else{_0x5263d9[_0x2b33('0x11')]();}}catch(_0x3a0cb7){logger[_0x2b33('0x8')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x45f3b0,_0x3a0cb7[_0x2b33('0xb')]);_0x5263d9[_0x2b33('0xc')]();}}}catch(_0x45cd05){logger[_0x2b33('0x8')](_0x2b33('0x9'),_0x45f3b0,JSON[_0x2b33('0x16')](_0x45cd05));_0x5263d9[_0x2b33('0xc')]();}};}; \ No newline at end of file +var _0x57ea=['stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x38eaa2,_0x5759f5){var _0x1d42cc=function(_0x237f60){while(--_0x237f60){_0x38eaa2['push'](_0x38eaa2['shift']());}};_0x1d42cc(++_0x5759f5);}(_0x57ea,0x99));var _0xa57e=function(_0x2dcf38,_0x33765a){_0x2dcf38=_0x2dcf38-0x0;var _0x2295dc=_0x57ea[_0x2dcf38];return _0x2295dc;};'use strict';var schema=require(_0xa57e('0x0'));var _=require('lodash');var htmlToText=require(_0xa57e('0x1'));var utils=require(_0xa57e('0x2'));var logger=require('../../../../config/logger')(_0xa57e('0x3'));var gotoif=schema({'condition':{'type':_0xa57e('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xa57e('0x5'),'message':_0xa57e('0x6')},'priorityFalse':{'type':_0xa57e('0x5'),'message':_0xa57e('0x7')}});exports[_0xa57e('0x8')]=function(_0x5f1b19,_0xe69a86){return function(_0x3b068f){try{var _0x5b2f47={'condition':htmlToText[_0xa57e('0x9')](utils[_0xa57e('0xa')](_0xe69a86[0x0],this),{'wordwrap':![]})[_0xa57e('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xe69a86[0x1],'priorityFalse':_0xe69a86[0x2]};var _0x5e658e=gotoif['validate'](_0x5b2f47,{'typecast':!![]});if(_0x5e658e[_0xa57e('0xc')]){logger[_0xa57e('0xd')](_0xa57e('0xe'),_0x5f1b19,_['map'](_0x5e658e,_0xa57e('0xf'))[_0xa57e('0x10')](',\x20'));_0x3b068f['stop']();}else{try{var _0x26a367=eval('('+_0x5b2f47['condition']+')');var _0x5f276c=_0x26a367?_0x5b2f47[_0xa57e('0x11')]:_0x5b2f47[_0xa57e('0x12')];logger[_0xa57e('0x13')](_0xa57e('0x14'),_0x5f1b19,_0x5b2f47[_0xa57e('0x15')],_0x26a367,_0x5f276c||_0xa57e('0x16'));if(_0x5f276c){var _0x317289=_[_0xa57e('0x17')](_0x3b068f[_0xa57e('0x18')](),{'p':_0x5f276c});if(_0x317289>=0x0){logger[_0xa57e('0x13')](_0xa57e('0x19'),_0x5f1b19,_0x5f276c||'next',_0x317289);_0x3b068f[_0xa57e('0x16')](_0x317289);}else{logger[_0xa57e('0x13')](_0xa57e('0x1a'),_0x5f1b19,_0x5f276c||_0xa57e('0x16'));_0x3b068f[_0xa57e('0x1b')]();}}else{_0x3b068f['next']();}}catch(_0x299c4c){logger[_0xa57e('0xd')](_0xa57e('0x1c'),_0x5f1b19,_0x299c4c[_0xa57e('0xf')]);_0x3b068f['stop']();}}}catch(_0x33aba2){logger['error'](_0xa57e('0xe'),_0x5f1b19,JSON[_0xa57e('0x1d')](_0x33aba2));_0x3b068f[_0xa57e('0x1b')]();}};}; \ 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 06cc4b3..3b7b493 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 _0x6622=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','stop','[%s][GOTOP]\x20priority\x20%s','rules','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x6622,0x18c));var _0x2662=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0x6622[_0x5bb4e8];return _0x2a86f2;};'use strict';var schema=require(_0x2662('0x0'));var _=require(_0x2662('0x1'));var logger=require(_0x2662('0x2'))(_0x2662('0x3'));var gotop=schema({'priority':{'type':_0x2662('0x4'),'required':!![],'message':_0x2662('0x5')}});exports[_0x2662('0x6')]=function(_0x268a62,_0x9ca70e){return function(_0x40506d){try{var _0x21c60b={'priority':_0x9ca70e[0x0]};var _0x5b1125=gotop[_0x2662('0x0')](_0x21c60b,{'typecast':!![]});if(_0x5b1125['length']){logger[_0x2662('0x7')]('[%s][GOTOP]\x20%s',_0x268a62,_[_0x2662('0x8')](_0x5b1125,'message')['join'](',\x20'));_0x40506d[_0x2662('0x9')]();}else{logger['info'](_0x2662('0xa'),_0x268a62,_0x21c60b['priority']);if(_0x21c60b['priority']){var _0x3d4a0b=_['findIndex'](_0x40506d[_0x2662('0xb')](),{'p':_0x21c60b[_0x2662('0xc')]});if(_0x3d4a0b>=0x0){logger['info'](_0x2662('0xd'),_0x268a62,_0x21c60b[_0x2662('0xc')]||_0x2662('0xe'),_0x3d4a0b);_0x40506d[_0x2662('0xe')](_0x3d4a0b);}else{logger['info'](_0x2662('0xf'),_0x268a62,_0x21c60b[_0x2662('0xc')]||_0x2662('0xe'));_0x40506d[_0x2662('0x9')]();}}else{_0x40506d[_0x2662('0xe')]();}}}catch(_0x5aa39d){logger['error']('[%s][GOTOP]\x20%s',_0x268a62,JSON['stringify'](_0x5aa39d));_0x40506d[_0x2662('0x9')]();}};}; \ No newline at end of file +var _0x740f=['validate','lodash','routing','number','consequence','length','error','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify'];(function(_0x1eb47f,_0x18cc27){var _0x4adbac=function(_0x54a2f6){while(--_0x54a2f6){_0x1eb47f['push'](_0x1eb47f['shift']());}};_0x4adbac(++_0x18cc27);}(_0x740f,0x168));var _0xf740=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0x740f[_0x37862a];return _0x5b0104;};'use strict';var schema=require(_0xf740('0x0'));var _=require(_0xf740('0x1'));var logger=require('../../../../config/logger')(_0xf740('0x2'));var gotop=schema({'priority':{'type':_0xf740('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf740('0x4')]=function(_0x2e628a,_0x76b57f){return function(_0x4bedaa){try{var _0xf5adb8={'priority':_0x76b57f[0x0]};var _0x7c787d=gotop[_0xf740('0x0')](_0xf5adb8,{'typecast':!![]});if(_0x7c787d[_0xf740('0x5')]){logger[_0xf740('0x6')]('[%s][GOTOP]\x20%s',_0x2e628a,_[_0xf740('0x7')](_0x7c787d,_0xf740('0x8'))[_0xf740('0x9')](',\x20'));_0x4bedaa[_0xf740('0xa')]();}else{logger['info'](_0xf740('0xb'),_0x2e628a,_0xf5adb8[_0xf740('0xc')]);if(_0xf5adb8[_0xf740('0xc')]){var _0x298139=_[_0xf740('0xd')](_0x4bedaa[_0xf740('0xe')](),{'p':_0xf5adb8['priority']});if(_0x298139>=0x0){logger[_0xf740('0xf')](_0xf740('0x10'),_0x2e628a,_0xf5adb8[_0xf740('0xc')]||'next',_0x298139);_0x4bedaa[_0xf740('0x11')](_0x298139);}else{logger[_0xf740('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2e628a,_0xf5adb8[_0xf740('0xc')]||_0xf740('0x11'));_0x4bedaa[_0xf740('0xa')]();}}else{_0x4bedaa[_0xf740('0x11')]();}}}catch(_0x3836f2){logger[_0xf740('0x6')](_0xf740('0x12'),_0x2e628a,JSON[_0xf740('0x13')](_0x3836f2));_0x4bedaa[_0xf740('0xa')]();}};}; \ 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 920fc1c..c21d37a 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 _0x2a31=['body','next','catch','stop','error','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','then','info','[%s][MESSAGE]\x20%s'];(function(_0x13a040,_0xe73b9d){var _0x5ae4f7=function(_0x263e85){while(--_0x263e85){_0x13a040['push'](_0x13a040['shift']());}};_0x5ae4f7(++_0xe73b9d);}(_0x2a31,0xee));var _0x12a3=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2a31[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var utils=require(_0x12a3('0x0'));var logger=require(_0x12a3('0x1'))(_0x12a3('0x2'));var rpc={'chatMessage':require(_0x12a3('0x3')),'openchannelMessage':require(_0x12a3('0x4')),'mailMessage':require(_0x12a3('0x5')),'smsMessage':require(_0x12a3('0x6')),'faxMessage':require(_0x12a3('0x7')),'whatsappMessage':require(_0x12a3('0x8'))};exports[_0x12a3('0x9')]=function(_0x31811c,_0x1158ed){return function(_0x387e7d){try{var _0x3d07ca={'body':utils[_0x12a3('0xa')](_0x1158ed[0x0],this),'ContactId':this[_0x12a3('0xb')]['id']};if(this[_0x12a3('0xc')]===_0x12a3('0xd')){_0x3d07ca[_0x12a3('0xe')]=this['account']['id'];}else{_0x3d07ca[_[_0x12a3('0xf')](this['channel'])+_0x12a3('0x10')]=this[_0x12a3('0x11')]['id'];}_0x3d07ca[_[_0x12a3('0xf')](this[_0x12a3('0xc')])+_0x12a3('0x12')]=this[_0x12a3('0x13')]['id'];if(rpc[this[_0x12a3('0xc')]+'Message']){return rpc[this[_0x12a3('0xc')]+'Message']['create'](_0x3d07ca)[_0x12a3('0x14')](function(_0x3b35b4){logger[_0x12a3('0x15')](_0x12a3('0x16'),_0x31811c,_0x3d07ca[_0x12a3('0x17')]);_0x387e7d[_0x12a3('0x18')]();})[_0x12a3('0x19')](function(_0x3caafb){logger['error'](_0x12a3('0x16'),_0x31811c,JSON['stringify'](_0x3caafb));_0x387e7d[_0x12a3('0x1a')]();});}}catch(_0x4f3dd7){logger[_0x12a3('0x1b')](_0x12a3('0x16'),_0x31811c,JSON[_0x12a3('0x1c')](_0x4f3dd7));_0x387e7d[_0x12a3('0x1a')]();}};}; \ No newline at end of file +var _0x4312=['../../rpc/whatsappMessage','consequence','getMustacheRender','chat','upperFirst','channel','account','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x343613,_0x111fd1){var _0x5f052d=function(_0x404fa2){while(--_0x404fa2){_0x343613['push'](_0x343613['shift']());}};_0x5f052d(++_0x111fd1);}(_0x4312,0x1bb));var _0x2431=function(_0x414968,_0x1fb53c){_0x414968=_0x414968-0x0;var _0x3ad0a9=_0x4312[_0x414968];return _0x3ad0a9;};'use strict';var _=require(_0x2431('0x0'));var utils=require(_0x2431('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x2431('0x2')),'openchannelMessage':require(_0x2431('0x3')),'mailMessage':require(_0x2431('0x4')),'smsMessage':require(_0x2431('0x5')),'faxMessage':require(_0x2431('0x6')),'whatsappMessage':require(_0x2431('0x7'))};exports[_0x2431('0x8')]=function(_0x19c5fe,_0x5dc6df){return function(_0x7ef02f){try{var _0x57720a={'body':utils[_0x2431('0x9')](_0x5dc6df[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x2431('0xa')){_0x57720a['ChatWebsiteId']=this['account']['id'];}else{_0x57720a[_[_0x2431('0xb')](this[_0x2431('0xc')])+'AccountId']=this[_0x2431('0xd')]['id'];}_0x57720a[_['upperFirst'](this[_0x2431('0xc')])+_0x2431('0xe')]=this['interaction']['id'];if(rpc[this[_0x2431('0xc')]+_0x2431('0xf')]){return rpc[this['channel']+_0x2431('0xf')][_0x2431('0x10')](_0x57720a)[_0x2431('0x11')](function(_0x5e9b85){logger[_0x2431('0x12')](_0x2431('0x13'),_0x19c5fe,_0x57720a[_0x2431('0x14')]);_0x7ef02f['next']();})[_0x2431('0x15')](function(_0x45e673){logger[_0x2431('0x16')](_0x2431('0x13'),_0x19c5fe,JSON[_0x2431('0x17')](_0x45e673));_0x7ef02f[_0x2431('0x18')]();});}}catch(_0x18c4a8){logger['error'](_0x2431('0x13'),_0x19c5fe,JSON[_0x2431('0x17')](_0x18c4a8));_0x7ef02f[_0x2431('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index a9f0cfe..54b9868 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 _0xe6e9=['../../../../config/logger','routing','consequence','info','getMustacheRender','stringify','./utils'];(function(_0x557bf4,_0x1f8dad){var _0x2916e2=function(_0x4fef9b){while(--_0x4fef9b){_0x557bf4['push'](_0x557bf4['shift']());}};_0x2916e2(++_0x1f8dad);}(_0xe6e9,0x117));var _0x9e6e=function(_0x1684eb,_0x13e03f){_0x1684eb=_0x1684eb-0x0;var _0x4eeb11=_0xe6e9[_0x1684eb];return _0x4eeb11;};'use strict';var utils=require(_0x9e6e('0x0'));var logger=require(_0x9e6e('0x1'))(_0x9e6e('0x2'));exports[_0x9e6e('0x3')]=function(_0x581b06,_0x5b1f49){return function(_0x1e44ef){try{logger[_0x9e6e('0x4')]('[%s][NOOP]\x20%s',_0x581b06,utils[_0x9e6e('0x5')](_0x5b1f49[0x0],this));_0x1e44ef['next']();}catch(_0x1fbef8){logger['error']('[%s][NOOP]\x20%s',_0x581b06,JSON[_0x9e6e('0x6')](_0x1fbef8));_0x1e44ef['stop']();}};}; \ No newline at end of file +var _0xdc2c=['stop','routing','info','getMustacheRender','error','stringify'];(function(_0x4f23bd,_0x183f33){var _0xa83af3=function(_0x1977f1){while(--_0x1977f1){_0x4f23bd['push'](_0x4f23bd['shift']());}};_0xa83af3(++_0x183f33);}(_0xdc2c,0x115));var _0xcdc2=function(_0x2a0755,_0xdf6bac){_0x2a0755=_0x2a0755-0x0;var _0x3eaf4f=_0xdc2c[_0x2a0755];return _0x3eaf4f;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xcdc2('0x0'));exports['consequence']=function(_0x2ce119,_0x5439ff){return function(_0x5d6d41){try{logger[_0xcdc2('0x1')]('[%s][NOOP]\x20%s',_0x2ce119,utils[_0xcdc2('0x2')](_0x5439ff[0x0],this));_0x5d6d41['next']();}catch(_0x5c43d3){logger[_0xcdc2('0x3')]('[%s][NOOP]\x20%s',_0x2ce119,JSON[_0xcdc2('0x4')](_0x5c43d3));_0x5d6d41[_0xcdc2('0x5')]();}};}; \ 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 abf9ac9..87c82d3 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(_0x226e1f,_0x459255){var _0x299f3b=function(_0x3ba0b0){while(--_0x3ba0b0){_0x226e1f['push'](_0x226e1f['shift']());}};_0x299f3b(++_0x459255);}(_0xedd9,0xfc));var _0x9edd=function(_0x49b722,_0x2eb6c0){_0x49b722=_0x49b722-0x0;var _0xa8507f=_0xedd9[_0x49b722];return _0xa8507f;};'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 _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x9f272d,_0x4d32d0){var _0x24a0c6=function(_0x569a93){while(--_0x569a93){_0x9f272d['push'](_0x9f272d['shift']());}};_0x24a0c6(++_0x4d32d0);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index b53da2a..5375cdf 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 _0x9203=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog',':FORCED'];(function(_0x2995cb,_0x399750){var _0x182c14=function(_0x2988e5){while(--_0x2988e5){_0x2995cb['push'](_0x2995cb['shift']());}};_0x182c14(++_0x399750);}(_0x9203,0x1a4));var _0x3920=function(_0xf7a9cf,_0x2cfa33){_0xf7a9cf=_0xf7a9cf-0x0;var _0x7fdc45=_0x9203[_0xf7a9cf];return _0x7fdc45;};'use strict';var _=require(_0x3920('0x0'));var uuid=require(_0x3920('0x1'));var util=require(_0x3920('0x2'));var logger=require(_0x3920('0x3'))(_0x3920('0x4'));var Agent=function(_0x5668f4,_0x43fcb1,_0x25e953,_0x48828b){this[_0x3920('0x5')]=uuid['v4']();this[_0x3920('0x6')]=_0x5668f4;this['agent']=_0x43fcb1;this['realtime']=_0x25e953;this[_0x3920('0x4')]=_0x48828b;this[_0x3920('0x6')][_0x3920('0x7')](this[_0x3920('0x8')][_0x3920('0x9')](this),this[_0x3920('0xa')]['bind'](this));this[_0x3920('0x6')]['on'](_0x3920('0xb'),this['handleTimeout'][_0x3920('0x9')](this));this[_0x3920('0x6')]['on'](_0x3920('0xc'),this[_0x3920('0xd')][_0x3920('0x9')](this));};Agent[_0x3920('0xe')][_0x3920('0x7')]=function(){this['squeue'][_0x3920('0x7')](this['handleRun']['bind'](this),this[_0x3920('0xa')][_0x3920('0x9')](this));};Agent[_0x3920('0xe')][_0x3920('0xd')]=function(){this[_0x3920('0xa')](!![]);};Agent[_0x3920('0xe')]['handleRun']=function(_0x5a6342){logger[_0x3920('0xf')](_0x3920('0x10'),this[_0x3920('0x6')]['id'],this[_0x3920('0x11')]['id']);if(_['isNil'](this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']])){logger['info'](_0x3920('0x14'),this[_0x3920('0x6')]['id'],this[_0x3920('0x11')]['id']);setTimeout(this['push'][_0x3920('0x9')](this),0x3e8);}else{if(this[_0x3920('0x4')][_0x3920('0x15')]||util[_0x3920('0x16')](this[_0x3920('0x6')]['id'],this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']],this[_0x3920('0x6')][_0x3920('0x17')],![])){this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']][_0x3920('0x18')]=!![];this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']]['busyQueue']=undefined;util[_0x3920('0x19')](this[_0x3920('0x5')],this[_0x3920('0x6')]['id'],this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']],null,this['routing']);util[_0x3920('0x1a')](this['squeue']['id'],this['realtime'][_0x3920('0x13')][this[_0x3920('0x11')]['id']],'RINGING'+(this[_0x3920('0x4')][_0x3920('0x15')]?_0x3920('0x1b'):''));}else{logger[_0x3920('0xf')](_0x3920('0x1c'),this[_0x3920('0x6')]['id'],this[_0x3920('0x11')]['id']);setTimeout(this[_0x3920('0x7')][_0x3920('0x9')](this),0x3e8);}}};Agent[_0x3920('0xe')][_0x3920('0xa')]=function(_0x35b3a5){if(_[_0x3920('0x1d')](this[_0x3920('0x12')]['agents'][this['agent']['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3920('0x6')]['id'],this['agent']['id']);}else{logger[_0x3920('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3920('0x6')]['id'],this[_0x3920('0x11')]['id']);util['hideNotification'](this[_0x3920('0x5')],this[_0x3920('0x6')]['id'],this[_0x3920('0x12')]['agents'][this[_0x3920('0x11')]['id']],null,this[_0x3920('0x4')]);this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']][_0x3920('0x18')]=![];this[_0x3920('0x12')][_0x3920('0x13')][this[_0x3920('0x11')]['id']]['busyQueue']=undefined;util[_0x3920('0x1a')](this[_0x3920('0x6')]['id'],this[_0x3920('0x12')][_0x3920('0x13')][this['agent']['id']],_0x35b3a5?'STOP':_0x3920('0x1e'));}if(!_0x35b3a5){setTimeout(this[_0x3920('0x7')]['bind'](this),0x3e8);}};function agent(_0x269b03,_0x32658d,_0x421b7e,_0x956057){return new Agent(_0x269b03,_0x32658d,_0x421b7e,_0x956057);}module[_0x3920('0x1f')]=agent; \ No newline at end of file +var _0x9347=['forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busyQueue','RINGING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9347,0x155));var _0x7934=function(_0x36ceef,_0x5d166e){_0x36ceef=_0x36ceef-0x0;var _0x1cf645=_0x9347[_0x36ceef];return _0x1cf645;};'use strict';var _=require(_0x7934('0x0'));var uuid=require(_0x7934('0x1'));var util=require(_0x7934('0x2'));var logger=require('../../../../../config/logger')(_0x7934('0x3'));var Agent=function(_0xf553d8,_0x588bfb,_0x4d9de4,_0x266cbd){this[_0x7934('0x4')]=uuid['v4']();this['squeue']=_0xf553d8;this['agent']=_0x588bfb;this[_0x7934('0x5')]=_0x4d9de4;this[_0x7934('0x3')]=_0x266cbd;this[_0x7934('0x6')][_0x7934('0x7')](this[_0x7934('0x8')][_0x7934('0x9')](this),this[_0x7934('0xa')][_0x7934('0x9')](this));this['squeue']['on'](_0x7934('0xb'),this[_0x7934('0xa')]['bind'](this));this['squeue']['on'](_0x7934('0xc'),this[_0x7934('0xd')]['bind'](this));};Agent[_0x7934('0xe')]['push']=function(){this[_0x7934('0x6')][_0x7934('0x7')](this[_0x7934('0x8')]['bind'](this),this[_0x7934('0xa')][_0x7934('0x9')](this));};Agent[_0x7934('0xe')]['handleDrained']=function(){this[_0x7934('0xa')](!![]);};Agent[_0x7934('0xe')]['handleRun']=function(_0x2593c1){logger[_0x7934('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x7934('0x10')]['id']);if(_['isNil'](this['realtime'][_0x7934('0x11')][this[_0x7934('0x10')]['id']])){logger[_0x7934('0xf')](_0x7934('0x12'),this['squeue']['id'],this[_0x7934('0x10')]['id']);setTimeout(this['push'][_0x7934('0x9')](this),0x3e8);}else{if(this[_0x7934('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x7934('0x6')]['id'],this[_0x7934('0x5')]['agents'][this[_0x7934('0x10')]['id']],this['squeue'][_0x7934('0x13')],![])){this[_0x7934('0x5')]['agents'][this['agent']['id']]['busy']=!![];this[_0x7934('0x5')][_0x7934('0x11')][this['agent']['id']][_0x7934('0x14')]=undefined;util['showNotification'](this[_0x7934('0x4')],this[_0x7934('0x6')]['id'],this[_0x7934('0x5')][_0x7934('0x11')][this[_0x7934('0x10')]['id']],null,this[_0x7934('0x3')]);util['writeLog'](this[_0x7934('0x6')]['id'],this[_0x7934('0x5')][_0x7934('0x11')][this[_0x7934('0x10')]['id']],_0x7934('0x15')+(this['routing'][_0x7934('0x16')]?_0x7934('0x17'):''));}else{logger[_0x7934('0xf')](_0x7934('0x18'),this[_0x7934('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x7934('0x7')][_0x7934('0x9')](this),0x3e8);}}};Agent[_0x7934('0xe')][_0x7934('0xa')]=function(_0x130092){if(_[_0x7934('0x19')](this[_0x7934('0x5')][_0x7934('0x11')][this[_0x7934('0x10')]['id']])){return logger[_0x7934('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7934('0x6')]['id'],this[_0x7934('0x10')]['id']);}else{logger[_0x7934('0xf')](_0x7934('0x1a'),this[_0x7934('0x6')]['id'],this[_0x7934('0x10')]['id']);util[_0x7934('0x1b')](this[_0x7934('0x4')],this['squeue']['id'],this[_0x7934('0x5')][_0x7934('0x11')][this[_0x7934('0x10')]['id']],null,this[_0x7934('0x3')]);this['realtime'][_0x7934('0x11')][this['agent']['id']][_0x7934('0x1c')]=![];this[_0x7934('0x5')]['agents'][this[_0x7934('0x10')]['id']][_0x7934('0x14')]=undefined;util[_0x7934('0x1d')](this[_0x7934('0x6')]['id'],this['realtime']['agents'][this[_0x7934('0x10')]['id']],_0x130092?_0x7934('0x1e'):_0x7934('0x1f'));}if(!_0x130092){setTimeout(this[_0x7934('0x7')]['bind'](this),0x3e8);}};function agent(_0x52854c,_0x9f3533,_0x28410d,_0x3de3a3){return new Agent(_0x52854c,_0x9f3533,_0x28410d,_0x3de3a3);}module[_0x7934('0x20')]=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 3db97fd..1e719c9 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 _0x2e09=['lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','agents','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','info','hideNotification','writeLog','STOP','TIMEOUT','exports'];(function(_0x5826b3,_0xa91fe5){var _0x127e43=function(_0x2e5d2d){while(--_0x2e5d2d){_0x5826b3['push'](_0x5826b3['shift']());}};_0x127e43(++_0xa91fe5);}(_0x2e09,0xc6));var _0x92e0=function(_0x5cc6be,_0x458982){_0x5cc6be=_0x5cc6be-0x0;var _0x1e719e=_0x2e09[_0x5cc6be];return _0x1e719e;};'use strict';var _=require(_0x92e0('0x0'));var uuid=require('uuid');var util=require(_0x92e0('0x1'));var logger=require(_0x92e0('0x2'))(_0x92e0('0x3'));var Beepall=function(_0x2d8e08,_0x10382b,_0x3d551c,_0x2a1390){this[_0x92e0('0x4')]=uuid['v4']();this[_0x92e0('0x5')]=_0x2d8e08;this[_0x92e0('0x6')]=_0x10382b;this[_0x92e0('0x7')]=_0x3d551c;this['routing']=_0x2a1390;this[_0x92e0('0x5')][_0x92e0('0x8')](this[_0x92e0('0x9')][_0x92e0('0xa')](this),this[_0x92e0('0xb')]['bind'](this));this['squeue']['on']('timeout',this[_0x92e0('0xb')][_0x92e0('0xa')](this));this[_0x92e0('0x5')]['on'](_0x92e0('0xc'),this[_0x92e0('0xd')][_0x92e0('0xa')](this));};Beepall[_0x92e0('0xe')][_0x92e0('0x8')]=function(){this[_0x92e0('0x5')]['push'](this['handleRun'][_0x92e0('0xa')](this),this[_0x92e0('0xb')][_0x92e0('0xa')](this));};Beepall[_0x92e0('0xe')][_0x92e0('0xd')]=function(_0x51ec20){this[_0x92e0('0xb')](!![]);};Beepall[_0x92e0('0xe')][_0x92e0('0x9')]=function(_0x3a996c){var _0x1a8cea=!![];if(!_[_0x92e0('0xf')](this[_0x92e0('0x6')])&&!_[_0x92e0('0xf')](this[_0x92e0('0x6')][_0x92e0('0x10')])&&this[_0x92e0('0x6')][_0x92e0('0x10')][_0x92e0('0x11')]>0x0){for(var _0x48b9a0=0x0,_0x3adf13;_0x48b9a00x0){for(var _0x58a817=0x0,_0x10b906;_0x58a8170x0&&_0x5d28b0[_0x50f384+_0x90df('0x26')]>=_0x5d28b0[_0x50f384+'Capacity']){writeLog(_0x3e837b,_0x5d28b0,_0x50f384['toUpperCase']()+_0x90df('0x27'));return![];}}return!![];};exports[_0x90df('0x28')]=function(_0x123ba9,_0x3f30d6,_0x2d14c2,_0x133ce1,_0x5f95c8){return sendNotification(!![],_0x123ba9,_0x3f30d6,_0x2d14c2,_0x133ce1,_0x5f95c8);};exports[_0x90df('0x29')]=function(_0x37cf9d,_0x4e6ea2,_0x1e2c38,_0x2ff8f4,_0x5c8479){return sendNotification(![],_0x37cf9d,_0x4e6ea2,_0x1e2c38,_0x2ff8f4,_0x5c8479);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x5668=['OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','emit','user:save','\x20interaction','name','account','notificationSound','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','save','remove','info','isAgentAvailable','busy','BUSY'];(function(_0x400f47,_0x2e7457){var _0x4ffe8d=function(_0x4bbb33){while(--_0x4bbb33){_0x400f47['push'](_0x400f47['shift']());}};_0x4ffe8d(++_0x2e7457);}(_0x5668,0x8b));var _0x8566=function(_0x493a89,_0x2f5fac){_0x493a89=_0x493a89-0x0;var _0x5be45c=_0x5668[_0x493a89];return _0x5be45c;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var utils=require(_0x8566('0x2'));var Mustache=require(_0x8566('0x3'));var Redis=require(_0x8566('0x4'));var config=require(_0x8566('0x5'));var logger=require(_0x8566('0x6'))(_0x8566('0x7'));config[_0x8566('0x8')]=_[_0x8566('0x9')](config[_0x8566('0x8')],{'host':_0x8566('0xa'),'port':0x18eb});var io=require(_0x8566('0xb'))(new Redis(config['redis']));function emit(_0x355fce,_0x2ffec4,_0x49f55a){io['to'](_0x355fce)['emit'](_0x2ffec4,_0x49f55a);}function sendNotification(_0x4045ed,_0x4cbf90,_0x555ffa,_0x1a01a2,_0x47c21f,_0x3eb676){io['to'](util[_0x8566('0xc')](_0x8566('0xd'),_0x1a01a2['name']))[_0x8566('0xe')](_0x8566('0xf'),_0x1a01a2);var _0x4f93aa=_0x3eb676||{};var _0x4ca241=_0x555ffa['split']('.');var _0x522618={'uniqueid':_0x4cbf90,'channel':_0x4ca241[0x0],'id':_0x4ca241[0x1],'title':_0x4ca241[0x0]+_0x8566('0x10'),'interactionId':_0x4ca241[0x2],'queue':_0x47c21f?_0x47c21f[_0x8566('0x11')]:null,'sound':_0x4f93aa[_0x8566('0x12')][_0x8566('0x13')],'shake':_0x4f93aa[_0x8566('0x12')]['notificationShake']};try{if(!_0x4f93aa['body']){_0x4f93aa['body']={};}if(_0x47c21f){_0x4f93aa['body']['queue']=_0x47c21f;}else if(_0x4f93aa[_0x8566('0x14')][_0x8566('0x15')]){delete _0x4f93aa[_0x8566('0x14')][_0x8566('0x15')];}_0x522618[_0x8566('0x16')]=utils['getMustacheRender'](_0x4f93aa[_0x8566('0x12')][_0x8566('0x17')],_0x4f93aa);}catch(_0x2f9e44){_0x522618['msg']=_0x8566('0x18');logger[_0x8566('0x19')](util[_0x8566('0xc')]('[%s][QUEUE]\x20%s',_0x4cbf90,_0x2f9e44[_0x8566('0x1a')]));}io['to'](util['format']('user:%s',_0x1a01a2[_0x8566('0x11')]))['emit'](util[_0x8566('0xc')]('notification:%s',_0x4045ed?_0x8566('0x1b'):_0x8566('0x1c')),_0x522618);}function writeLog(_0x43fc7c,_0x17fdb4,_0x2bd76c){return logger[_0x8566('0x1d')](util[_0x8566('0xc')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x43fc7c,_0x17fdb4['name'],_0x2bd76c));}exports[_0x8566('0x1e')]=function(_0x1ccc60,_0x1f38ec,_0xa3efc4,_0x4e19cf){if(_0x1f38ec[_0x8566('0x1f')]){writeLog(_0x1ccc60,_0x1f38ec,_0x8566('0x20'));return![];}if(!_0x1f38ec['online']){writeLog(_0x1ccc60,_0x1f38ec,_0x8566('0x21'));return![];}if(_0x1f38ec[_0xa3efc4+_0x8566('0x22')]){writeLog(_0x1ccc60,_0x1f38ec,'PAUSE');return![];}if(_0x4e19cf&&_0x1f38ec[_0x8566('0x23')](_0xa3efc4+_0x8566('0x24'))&&_0x1f38ec[_0x8566('0x23')](_0xa3efc4+'CurrentCapacity')){if(_0x1f38ec[_0xa3efc4+_0x8566('0x24')]>0x0&&_0x1f38ec[_0xa3efc4+_0x8566('0x25')]>=_0x1f38ec[_0xa3efc4+_0x8566('0x24')]){writeLog(_0x1ccc60,_0x1f38ec,_0xa3efc4[_0x8566('0x26')]()+_0x8566('0x27'));return![];}}return!![];};exports[_0x8566('0x28')]=function(_0xa3cf58,_0x56101c,_0x1f21a0,_0x34146c,_0x40aed8){return sendNotification(!![],_0xa3cf58,_0x56101c,_0x1f21a0,_0x34146c,_0x40aed8);};exports[_0x8566('0x29')]=function(_0xea61c9,_0x3a3106,_0x1e4e05,_0x8637b3,_0x504722){return sendNotification(![],_0xea61c9,_0x3a3106,_0x1e4e05,_0x8637b3,_0x504722);};exports[_0x8566('0x2a')]=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 48dfd4a..d7ba7af 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 _0x4bf5=['validate','length','[%s][SYSTEM]\x20%s','map','message','join','info','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','lodash','./utils','../../../../config/logger','routing','consequence'];(function(_0x264040,_0xcbaca3){var _0x247149=function(_0x549079){while(--_0x549079){_0x264040['push'](_0x264040['shift']());}};_0x247149(++_0xcbaca3);}(_0x4bf5,0x171));var _0x54bf=function(_0x49dfa6,_0x41c2dc){_0x49dfa6=_0x49dfa6-0x0;var _0x1b1c72=_0x4bf5[_0x49dfa6];return _0x1b1c72;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x54bf('0x0'));var utils=require(_0x54bf('0x1'));var logger=require(_0x54bf('0x2'))(_0x54bf('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x54bf('0x4')]=function(_0xdf86b6,_0x3a6a2e){return function(_0x9a1113){try{var _0x5e0eb5={'command':_0x3a6a2e[0x0]};var _0x313696=system[_0x54bf('0x5')](_0x5e0eb5,{'typecast':!![]});if(_0x313696[_0x54bf('0x6')]){logger['error'](_0x54bf('0x7'),_0xdf86b6,_[_0x54bf('0x8')](_0x313696,_0x54bf('0x9'))[_0x54bf('0xa')](',\x20'));logger[_0x54bf('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xdf86b6);_0x9a1113[_0x54bf('0xc')]();}else{var _0x4d886a=this;var _0xd1a55e=utils['getMustacheRender'](_0x3a6a2e[0x0],this);logger[_0x54bf('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xdf86b6,_0xd1a55e);sh['exec'](_[_0x54bf('0xd')](_0xd1a55e),function(_0x16ec13,_0x1ca924){logger['info'](_0x54bf('0xe'),_0xdf86b6,_0x16ec13);if(_0x16ec13==0x0){var _0x207885=_0x1ca924[_0x54bf('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x54bf('0x10')](_0x3a6a2e[0x1])||_['isEmpty'](_0x3a6a2e[0x1])){logger[_0x54bf('0xb')](_0x54bf('0x11'),_0xdf86b6);_0x4d886a[_0x54bf('0x12')][_0x3a6a2e[0x1]]=_0x207885;}else{logger[_0x54bf('0xb')](_0x54bf('0x13'),_0xdf86b6,_0x3a6a2e[0x1],_0x207885);_0x4d886a[_0x54bf('0x12')][_0x3a6a2e[0x1]]=_0x207885;}}_0x9a1113[_0x54bf('0xc')]();});}}catch(_0x9bd2f8){logger[_0x54bf('0x14')](_0x54bf('0x7'),_0xdf86b6,_[_0x54bf('0x15')](_0x9bd2f8)?JSON['stringify'](_0x9bd2f8):_0x9bd2f8);logger[_0x54bf('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xdf86b6);_0x9a1113['next']();}};}; \ No newline at end of file +var _0xd307=['../../../../config/logger','routing','string','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','validate','lodash','./utils'];(function(_0x35aa91,_0x1efa1c){var _0x3fff27=function(_0x88ee9d){while(--_0x88ee9d){_0x35aa91['push'](_0x35aa91['shift']());}};_0x3fff27(++_0x1efa1c);}(_0xd307,0x174));var _0x7d30=function(_0xa3a007,_0x1c6ff6){_0xa3a007=_0xa3a007-0x0;var _0x471627=_0xd307[_0xa3a007];return _0x471627;};'use strict';var schema=require(_0x7d30('0x0'));var sh=require('shelljs');var _=require(_0x7d30('0x1'));var utils=require(_0x7d30('0x2'));var logger=require(_0x7d30('0x3'))(_0x7d30('0x4'));var system=schema({'command':{'type':_0x7d30('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0xdb5f30,_0x41f33d){return function(_0x145840){try{var _0x3928c0={'command':_0x41f33d[0x0]};var _0xb7eadf=system['validate'](_0x3928c0,{'typecast':!![]});if(_0xb7eadf[_0x7d30('0x6')]){logger[_0x7d30('0x7')]('[%s][SYSTEM]\x20%s',_0xdb5f30,_[_0x7d30('0x8')](_0xb7eadf,_0x7d30('0x9'))[_0x7d30('0xa')](',\x20'));logger[_0x7d30('0xb')](_0x7d30('0xc'),_0xdb5f30);_0x145840[_0x7d30('0xd')]();}else{var _0x41175e=this;var _0x10cc99=utils[_0x7d30('0xe')](_0x41f33d[0x0],this);logger[_0x7d30('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xdb5f30,_0x10cc99);sh['exec'](_[_0x7d30('0xf')](_0x10cc99),function(_0x133c17,_0x2ead42){logger[_0x7d30('0xb')](_0x7d30('0x10'),_0xdb5f30,_0x133c17);if(_0x133c17==0x0){var _0x4fd5f4=_0x2ead42[_0x7d30('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x7d30('0x12')](_0x41f33d[0x1])||_[_0x7d30('0x13')](_0x41f33d[0x1])){logger[_0x7d30('0xb')](_0x7d30('0x14'),_0xdb5f30);_0x41175e[_0x7d30('0x15')][_0x41f33d[0x1]]=_0x4fd5f4;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xdb5f30,_0x41f33d[0x1],_0x4fd5f4);_0x41175e[_0x7d30('0x15')][_0x41f33d[0x1]]=_0x4fd5f4;}}_0x145840[_0x7d30('0xd')]();});}}catch(_0x24cb18){logger[_0x7d30('0x7')](_0x7d30('0x16'),_0xdb5f30,_[_0x7d30('0x17')](_0x24cb18)?JSON[_0x7d30('0x18')](_0x24cb18):_0x24cb18);logger['info'](_0x7d30('0xc'),_0xdb5f30);_0x145840[_0x7d30('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 112e847..97ee104 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 _0xd030=['map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','validate','[%s][TAG]\x20%s'];(function(_0x55043d,_0x214f96){var _0x96e1af=function(_0x2791b0){while(--_0x2791b0){_0x55043d['push'](_0x55043d['shift']());}};_0x96e1af(++_0x214f96);}(_0xd030,0x6d));var _0x0d03=function(_0x18eea5,_0x3d8559){_0x18eea5=_0x18eea5-0x0;var _0x218c3b=_0xd030[_0x18eea5];return _0x218c3b;};'use strict';var schema=require('validate');var _=require(_0x0d03('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0d03('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x0d03('0x2')),'faxInteraction':require(_0x0d03('0x3')),'whatsappInteraction':require(_0x0d03('0x4'))};var logger=require(_0x0d03('0x5'))(_0x0d03('0x6'));var tag=schema({'tag':{'type':_0x0d03('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0d03('0x8')]=function(_0x3a3ee9,_0x3a4a33,_0x28f6ff,_0x593fce){return function(_0x16cc77){try{var _0xbb4794={'tag':_0x3a4a33[0x0]};var _0x1b7502=tag[_0x0d03('0x9')](_0xbb4794,{'typecast':!![]});if(_0x1b7502['length']){logger['error'](_0x0d03('0xa'),_0x3a3ee9,_[_0x0d03('0xb')](_0x1b7502,'message')[_0x0d03('0xc')](',\x20'));logger['info'](_0x0d03('0xd'),_0x3a3ee9);_0x16cc77[_0x0d03('0xe')]();}else{var _0x3307d2={'ids':[_0x3a4a33[0x0]]};if(rpc[_0x593fce[_0x0d03('0xf')]+'Interaction']){rpc[_0x593fce[_0x0d03('0xf')]+'Interaction'][_0x0d03('0x10')](_0x593fce[_0x0d03('0x11')]['id'],_0x3307d2)['then'](function(_0x5f2f1a){logger[_0x0d03('0x12')](_0x0d03('0x13'),_0x3a3ee9,_0x3a4a33[0x1],_0x593fce[_0x0d03('0xf')],_0x593fce['interaction']['id']);})[_0x0d03('0x14')](function(_0x584704){logger[_0x0d03('0x15')](_0x0d03('0xa'),_0x3a3ee9,JSON[_0x0d03('0x16')](_0x584704));logger[_0x0d03('0x12')](_0x0d03('0xd'),_0x3a3ee9);})['finally'](function(){_0x16cc77[_0x0d03('0xe')]();});}}}catch(_0xaf98f){logger[_0x0d03('0x15')](_0x0d03('0xa'),_0x3a3ee9,_[_0x0d03('0x17')](_0xaf98f)?JSON['stringify'](_0xaf98f):_0xaf98f);logger['info'](_0x0d03('0xd'),_0x3a3ee9);_0x16cc77[_0x0d03('0xe')]();}};}; \ No newline at end of file +var _0x6de7=['message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','[%s][TAG]\x20%s','stringify','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map'];(function(_0x165f20,_0x30d355){var _0x8ac26e=function(_0x41657f){while(--_0x41657f){_0x165f20['push'](_0x165f20['shift']());}};_0x8ac26e(++_0x30d355);}(_0x6de7,0x15c));var _0x76de=function(_0x1351d5,_0x296c46){_0x1351d5=_0x1351d5-0x0;var _0x455b69=_0x6de7[_0x1351d5];return _0x455b69;};'use strict';var schema=require('validate');var _=require(_0x76de('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x76de('0x1')),'smsInteraction':require(_0x76de('0x2')),'mailInteraction':require(_0x76de('0x3')),'faxInteraction':require(_0x76de('0x4')),'whatsappInteraction':require(_0x76de('0x5'))};var logger=require(_0x76de('0x6'))(_0x76de('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x76de('0x8')}});exports['consequence']=function(_0x349b50,_0x25b14f,_0x202562,_0x16f333){return function(_0x5998f6){try{var _0xc72f63={'tag':_0x25b14f[0x0]};var _0x4ead84=tag['validate'](_0xc72f63,{'typecast':!![]});if(_0x4ead84[_0x76de('0x9')]){logger[_0x76de('0xa')]('[%s][TAG]\x20%s',_0x349b50,_[_0x76de('0xb')](_0x4ead84,_0x76de('0xc'))[_0x76de('0xd')](',\x20'));logger[_0x76de('0xe')](_0x76de('0xf'),_0x349b50);_0x5998f6[_0x76de('0x10')]();}else{var _0x22b672={'ids':[_0x25b14f[0x0]]};if(rpc[_0x16f333[_0x76de('0x11')]+'Interaction']){rpc[_0x16f333['channel']+'Interaction'][_0x76de('0x12')](_0x16f333['interaction']['id'],_0x22b672)['then'](function(_0x51bda9){logger[_0x76de('0xe')](_0x76de('0x13'),_0x349b50,_0x25b14f[0x1],_0x16f333[_0x76de('0x11')],_0x16f333[_0x76de('0x14')]['id']);})['catch'](function(_0x23704e){logger[_0x76de('0xa')](_0x76de('0x15'),_0x349b50,JSON[_0x76de('0x16')](_0x23704e));logger[_0x76de('0xe')](_0x76de('0xf'),_0x349b50);})['finally'](function(){_0x5998f6['next']();});}}}catch(_0x3865ea){logger['error'](_0x76de('0x15'),_0x349b50,_[_0x76de('0x17')](_0x3865ea)?JSON[_0x76de('0x16')](_0x3865ea):_0x3865ea);logger['info'](_0x76de('0xf'),_0x349b50);_0x5998f6[_0x76de('0x10')]();}};}; \ 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 34e33be..bd76913 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 _0x70e0=['list','mustache','lodash','exports','render','merge','body','contact','account'];(function(_0xd85ac8,_0x4e48f2){var _0x154923=function(_0x5d56d9){while(--_0x5d56d9){_0xd85ac8['push'](_0xd85ac8['shift']());}};_0x154923(++_0x4e48f2);}(_0x70e0,0x17b));var _0x070e=function(_0x1832b4,_0x2238be){_0x1832b4=_0x1832b4-0x0;var _0x2d4837=_0x70e0[_0x1832b4];return _0x2d4837;};'use strict';var Mustache=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));module[_0x070e('0x2')]={'getMustacheRender':function(_0x4d95bb,_0x579b83){return Mustache[_0x070e('0x3')](_0x4d95bb,_[_0x070e('0x4')](_0x579b83[_0x070e('0x5')],{'contact':_0x579b83[_0x070e('0x6')],'message':_0x579b83['message'],'account':_0x579b83[_0x070e('0x7')],'interaction':_0x579b83['interaction'],'list':_0x579b83[_0x070e('0x8')]}))||'';}}; \ No newline at end of file +var _0x324f=['body','contact','account','interaction','mustache','lodash','exports','render'];(function(_0x6ef3b8,_0x2b5069){var _0x52a3f7=function(_0x1d5399){while(--_0x1d5399){_0x6ef3b8['push'](_0x6ef3b8['shift']());}};_0x52a3f7(++_0x2b5069);}(_0x324f,0x94));var _0xf324=function(_0x5dd36b,_0x35efd0){_0x5dd36b=_0x5dd36b-0x0;var _0x53f0cc=_0x324f[_0x5dd36b];return _0x53f0cc;};'use strict';var Mustache=require(_0xf324('0x0'));var _=require(_0xf324('0x1'));module[_0xf324('0x2')]={'getMustacheRender':function(_0x4c47e6,_0x54657f){return Mustache[_0xf324('0x3')](_0x4c47e6,_['merge'](_0x54657f[_0xf324('0x4')],{'contact':_0x54657f[_0xf324('0x5')],'message':_0x54657f['message'],'account':_0x54657f[_0xf324('0x6')],'interaction':_0x54657f[_0xf324('0x7')],'list':_0x54657f['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b6dd054..52329e8 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 _0xc41c=['on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','info','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','TagId','format','%s:%s:%s','intervals','./applications/','consequence','priority','Push\x20new\x20rule'];(function(_0x1f7869,_0x472f5d){var _0x3b2ba3=function(_0x3d46dc){while(--_0x3d46dc){_0x1f7869['push'](_0x1f7869['shift']());}};_0x3b2ba3(++_0x472f5d);}(_0xc41c,0x90));var _0xcc41=function(_0xc5caf7,_0xc6d31b){_0xc5caf7=_0xc5caf7-0x0;var _0x509351=_0xc41c[_0xc5caf7];return _0x509351;};'use strict';var _=require('lodash');var util=require(_0xcc41('0x0'));var path=require(_0xcc41('0x1'));var fs=require('fs');var jayson=require(_0xcc41('0x2'));var BPromise=require(_0xcc41('0x3'));var uuid=require(_0xcc41('0x4'));var config=require('../../../config/environment');var logger=require(_0xcc41('0x5'))(_0xcc41('0x6'));var rpc={'openchannelQueueReport':require(_0xcc41('0x7')),'mailQueueReport':require(_0xcc41('0x8')),'chatQueueReport':require(_0xcc41('0x9')),'smsQueueReport':require(_0xcc41('0xa')),'faxQueueReport':require(_0xcc41('0xb')),'whatsappQueueReport':require(_0xcc41('0xc'))};var RuleEngine=require(_0xcc41('0xd'));function getId(_0x213df4,_0xe0dacc,_0x1f6ad4){return util['format'](_0xcc41('0xe'),_0x213df4,_0xe0dacc||0x0,_0x1f6ad4||0x0);}function getIntervals(_0x5524a1,_0x51b145){var _0x197f16=[];if(!_[_0xcc41('0xf')](_0x51b145['IntervalId'])&&!_['isNil'](_0x5524a1[_0x51b145['IntervalId']])&&!_[_0xcc41('0xf')](_0x5524a1[_0x51b145['IntervalId']][_0xcc41('0x10')])){_0x197f16=_[_0xcc41('0x11')](_0x5524a1[_0x51b145['IntervalId']]['Intervals'],_0xcc41('0x12'));}else if(!_[_0xcc41('0xf')](_0x51b145[_0xcc41('0x12')])){_0x197f16=[_0x51b145[_0xcc41('0x12')]];}return _0x197f16;}exports[_0xcc41('0x13')]=function(_0x22fe3e){_0x22fe3e['rules']={};return new BPromise(function(_0x291277,_0x377acd){var _0x300d81={'Start':function(_0x14f78e){var _0x1763c2=this;return new Promise(function(_0x229ac5,_0xd41e3a){if(_0x14f78e){try{var _0xa47edb=[];var _0x2283f5=getId(_0x14f78e[_0xcc41('0x14')],_0x14f78e[_0xcc41('0x15')]?_0x14f78e[_0xcc41('0x15')]['id']:0x0,_0x14f78e[_0xcc41('0x16')]?_0x14f78e[_0xcc41('0x16')]['id']:0x0);if(_0x14f78e[_0xcc41('0x17')]&&_[_0xcc41('0x18')](_0x14f78e[_0xcc41('0x17')])&&_0x14f78e[_0xcc41('0x17')][_0xcc41('0x19')]){for(var _0x15348c=0x0;_0x15348c<_0x14f78e[_0xcc41('0x17')][_0xcc41('0x19')];_0x15348c+=0x1){var _0x20b7d9=_0x14f78e['applications'][_0x15348c];if(fs[_0xcc41('0x1a')](path[_0xcc41('0x1b')](__dirname,'applications',_0x20b7d9[_0xcc41('0x1c')]+'.js'))){var _0x5a9320=[];switch(_0x20b7d9[_0xcc41('0x1c')][_0xcc41('0x1d')]()){case _0xcc41('0x1e'):var _0x6333c9=_0x20b7d9[_0xcc41('0x1f')]['split'](',');_0x5a9320[_0xcc41('0x20')](_0x6333c9[0x0]);_0x5a9320['push'](_0x6333c9[_0xcc41('0x21')](0x1,_0x6333c9['length'])['join'](','));break;case _0xcc41('0x22'):var _0x1755db=_0x20b7d9[_0xcc41('0x1f')][_0xcc41('0x23')](',');_0x5a9320[_0xcc41('0x20')](_0x1755db[0x0]);_0x5a9320[_0xcc41('0x20')](_0x1755db[0x1]);_0x5a9320['push'](_0x1755db['slice'](0x2,_0x1755db[_0xcc41('0x19')])[_0xcc41('0x1b')](','));break;case'amazonlex':var _0x589454=_0x20b7d9[_0xcc41('0x1f')][_0xcc41('0x23')](',');_0x5a9320[_0xcc41('0x20')](_0x589454[0x0]);_0x5a9320[_0xcc41('0x20')](_0x589454[0x1]);_0x5a9320[_0xcc41('0x20')](_0x589454[0x2]);_0x5a9320[_0xcc41('0x20')](_0x589454[0x3]);_0x5a9320[_0xcc41('0x20')](_0x589454[_0xcc41('0x21')](0x4,_0x589454['length'])['join'](','));break;case _0xcc41('0x15'):_0x5a9320[_0xcc41('0x20')](_0x20b7d9[_0xcc41('0x1f')]);break;case'tag':_0x5a9320[_0xcc41('0x20')](_0x20b7d9[_0xcc41('0x24')]);_0x5a9320[_0xcc41('0x20')](_0x20b7d9[_0xcc41('0x1f')]);break;default:_0x5a9320=_['isNil'](_0x20b7d9[_0xcc41('0x1f')])?[]:_0x20b7d9[_0xcc41('0x1f')][_0xcc41('0x23')](',');}var _0x1b2d8={'id':util[_0xcc41('0x25')](_0xcc41('0x26'),_0x2283f5,_0x20b7d9['id'],_0x20b7d9[_0xcc41('0x1c')]),'condition':require('./interval')['condition'](_0x2283f5,getIntervals(_0x22fe3e[_0xcc41('0x27')],_0x20b7d9),_0x22fe3e),'consequence':require(_0xcc41('0x28')+_0x20b7d9['app'])[_0xcc41('0x29')](_0x2283f5,_0x5a9320,_0x22fe3e,_0x14f78e),'p':_0x20b7d9[_0xcc41('0x2a')]||0x0};logger['info'](_0xcc41('0x2b'),_0x1b2d8['id'],_0xcc41('0x2c'),getIntervals(_0x22fe3e[_0xcc41('0x27')],_0x20b7d9)[_0xcc41('0x1b')](_0xcc41('0x2d')));_0xa47edb[_0xcc41('0x20')](_0x1b2d8);}else{logger['error'](_0xcc41('0x2e'),path['join'](__dirname,_0xcc41('0x17'),_0x20b7d9[_0xcc41('0x1c')]+_0xcc41('0x2f')));}}_0x22fe3e[_0xcc41('0x30')][_0x2283f5]=new RuleEngine(_0xa47edb);_0x22fe3e[_0xcc41('0x30')][_0x2283f5][_0xcc41('0x31')](_0x14f78e,function(_0x147750){logger[_0xcc41('0x32')](_0xcc41('0x33'),JSON[_0xcc41('0x34')](_0x147750[_0xcc41('0x35')]));if(_0x22fe3e['rules'][_0x2283f5]){_0x22fe3e['rules'][_0x2283f5]['emit'](_0xcc41('0x36'));}});return _0x229ac5({'code':0xc8,'message':_0x14f78e});}else{logger['info'](_0xcc41('0x37'));return _0x229ac5({'code':0xc8,'message':_0x14f78e});}}catch(_0x37fdda){logger['error'](_0x37fdda[_0xcc41('0x38')]);return _0xd41e3a(_0x1763c2[_0xcc41('0x39')](0x1f4,_0x37fdda));}}return _0xd41e3a(_0xcc41('0x3a'));});},'AcceptMessage':function(_0x367505){var _0x43e0b6=this;return new Promise(function(_0x58d14d,_0x2016e8){if(_0x367505[_0xcc41('0x15')]&&_0x367505[_0xcc41('0x15')]['id']){try{var _0x40dcff=getId(_0x367505[_0xcc41('0x14')],_0x367505[_0xcc41('0x15')]?_0x367505['message']['id']:0x0,_0x367505[_0xcc41('0x16')]?_0x367505['interaction']['id']:0x0);if(_0x22fe3e[_0xcc41('0x30')][_0x40dcff]){_0x22fe3e[_0xcc41('0x30')][_0x40dcff][_0xcc41('0x3b')](_0xcc41('0x3c'));if(rpc[_0x367505[_0xcc41('0x14')]+_0xcc41('0x3d')]){rpc[_0x367505[_0xcc41('0x14')]+_0xcc41('0x3d')][_0xcc41('0x3e')](_0x40dcff,{'UserId':_0x367505[_0xcc41('0x15')]['UserId']})[_0xcc41('0x3f')](function(_0x2ea65b){logger['error'](_0xcc41('0x40'));});}}return _0x58d14d({'code':0xc8,'message':_0x367505});}catch(_0x329cb7){logger['error'](_0x329cb7['stack']);return _0x2016e8(_0x43e0b6[_0xcc41('0x39')](0x1f4,_0x329cb7));}}logger[_0xcc41('0x39')]('message\x20is\x20empty');return _0x2016e8(_0x43e0b6[_0xcc41('0x39')](0x1f4,_0xcc41('0x41')));});},'RejectMessage':function(_0x18cf91){var _0x12af99=this;return new Promise(function(_0x347053,_0xaf2a6a){if(_0x18cf91[_0xcc41('0x42')]&&_0x18cf91[_0xcc41('0x42')]['id']){try{if(_0x22fe3e[_0xcc41('0x43')][_0x18cf91[_0xcc41('0x42')]['id']]){_0x22fe3e[_0xcc41('0x43')][_0x18cf91[_0xcc41('0x42')]['id']][_0xcc41('0x44')]=![];_0x22fe3e[_0xcc41('0x43')][_0x18cf91[_0xcc41('0x42')]['id']]['busyQueue']=undefined;}return _0x347053({'code':0xc8,'message':_0x18cf91});}catch(_0x6301e4){logger[_0xcc41('0x39')](_0x6301e4[_0xcc41('0x38')]);return _0xaf2a6a(_0x12af99[_0xcc41('0x39')](0x1f4,_0x6301e4));}}logger['error'](_0xcc41('0x41'));return _0xaf2a6a(_0x12af99[_0xcc41('0x39')](0x1f4,_0xcc41('0x41')));});},'AbandonInteraction':function(_0x1ba131){var _0x3f2df4=this;return new Promise(function(_0x4b7570,_0x53b94a){if(_0x1ba131[_0xcc41('0x14')]&&_0x1ba131[_0xcc41('0x16')]&&_0x1ba131[_0xcc41('0x16')]['id']){try{var _0xc12c3b=getId(_0x1ba131[_0xcc41('0x14')],_0x1ba131['message']?_0x1ba131[_0xcc41('0x15')]['id']:0x0,_0x1ba131[_0xcc41('0x16')]?_0x1ba131[_0xcc41('0x16')]['id']:0x0);if(_0x22fe3e[_0xcc41('0x30')][_0xc12c3b]){_0x22fe3e[_0xcc41('0x30')][_0xc12c3b][_0xcc41('0x3b')](_0xcc41('0x3c'));}return _0x4b7570({'code':0xc8,'message':_0x1ba131});}catch(_0x2ae876){logger[_0xcc41('0x39')](_0x2ae876[_0xcc41('0x38')]);return _0x53b94a(_0x3f2df4[_0xcc41('0x39')](0x1f4,_0x2ae876));}}logger[_0xcc41('0x39')](_0xcc41('0x41'));return _0x53b94a(_0x3f2df4[_0xcc41('0x39')](0x1f4,_0xcc41('0x41')));});},'AgentCapacity':function(_0x2de32a){var _0x46ac01=this;return new Promise(function(_0x436c04,_0x57a063){if(_0x22fe3e[_0xcc41('0x43')]['hasOwnProperty'](_0x2de32a['id'])){for(var _0x15eda2 in _0x2de32a[_0xcc41('0x45')]){if(_0x2de32a[_0xcc41('0x45')][_0xcc41('0x46')](_0x15eda2)){if(_0x22fe3e['agents'][_0x2de32a['id']][_0xcc41('0x46')](_0x15eda2+'CurrentCapacity')){_0x22fe3e[_0xcc41('0x43')][_0x2de32a['id']][_0x15eda2+_0xcc41('0x47')]=parseInt(_0x2de32a['capacity'][_0x15eda2],0xa);}}}_0x22fe3e['agents'][_0x2de32a['id']]['updateRealtime']();return _0x436c04({'code':0xc8,'message':_0x22fe3e[_0xcc41('0x43')][_0x2de32a['id']]});}else{return _0x57a063(_0x46ac01[_0xcc41('0x39')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x462f5b){return new Promise(function(_0x5e72f9,_0x3b411c){var _0xd2f8e=_[_0xcc41('0x48')](_0x22fe3e[_0xcc41('0x43')]);_0x5e72f9({'count':_0xd2f8e[_0xcc41('0x19')],'rows':_0xd2f8e});});},'ChatQueues':function(_0x2d2620){return new Promise(function(_0x1b4625,_0x136329){var _0x4a59ca=[];for(var _0x1dc270 in _0x22fe3e[_0xcc41('0x49')]){if(_0x22fe3e[_0xcc41('0x49')][_0xcc41('0x46')](_0x1dc270)){var _0x96da70=_0x22fe3e[_0xcc41('0x49')][_0x1dc270];var _0x11acf0={'id':_0x96da70['id'],'available':_0x96da70[_0xcc41('0x4a')],'loggedIn':_0x96da70[_0xcc41('0x4b')],'name':_0x96da70[_0xcc41('0x4c')],'paused':_0x96da70[_0xcc41('0x4d')],'waiting':_0x96da70[_0xcc41('0x4e')]};_0x4a59ca['push'](_0x11acf0);}}_0x1b4625({'count':_0x4a59ca[_0xcc41('0x19')],'rows':_0x4a59ca});});},'MailQueues':function(_0x10d6a4){return new Promise(function(_0x5298ad,_0x581c40){var _0x4478c8=[];for(var _0x13990e in _0x22fe3e[_0xcc41('0x4f')]){if(_0x22fe3e['mailQueues']['hasOwnProperty'](_0x13990e)){var _0x4236c6=_0x22fe3e[_0xcc41('0x4f')][_0x13990e];var _0x41353c={'id':_0x4236c6['id'],'available':_0x4236c6[_0xcc41('0x4a')],'loggedIn':_0x4236c6[_0xcc41('0x4b')],'name':_0x4236c6[_0xcc41('0x4c')],'paused':_0x4236c6[_0xcc41('0x4d')],'waiting':_0x4236c6[_0xcc41('0x4e')]};_0x4478c8[_0xcc41('0x20')](_0x41353c);}}_0x5298ad({'count':_0x4478c8[_0xcc41('0x19')],'rows':_0x4478c8});});},'OpenchannelQueues':function(_0x3b6f26){return new Promise(function(_0x2cecaa,_0x62f91b){var _0x299838=[];for(var _0x5c20d2 in _0x22fe3e[_0xcc41('0x50')]){if(_0x22fe3e[_0xcc41('0x50')]['hasOwnProperty'](_0x5c20d2)){var _0x35eab9=_0x22fe3e[_0xcc41('0x50')][_0x5c20d2];var _0x106009={'id':_0x35eab9['id'],'available':_0x35eab9['available'],'loggedIn':_0x35eab9[_0xcc41('0x4b')],'name':_0x35eab9[_0xcc41('0x4c')],'paused':_0x35eab9[_0xcc41('0x4d')],'waiting':_0x35eab9[_0xcc41('0x4e')]};_0x299838['push'](_0x106009);}}_0x2cecaa({'count':_0x299838['length'],'rows':_0x299838});});},'SmsQueues':function(_0x509631){return new Promise(function(_0x1b7a83,_0x487149){var _0x3a4608=[];for(var _0x306ca1 in _0x22fe3e['smsQueues']){if(_0x22fe3e[_0xcc41('0x51')][_0xcc41('0x46')](_0x306ca1)){var _0x2c5508=_0x22fe3e[_0xcc41('0x51')][_0x306ca1];var _0x7c2cac={'id':_0x2c5508['id'],'available':_0x2c5508[_0xcc41('0x4a')],'loggedIn':_0x2c5508['loggedIn'],'name':_0x2c5508[_0xcc41('0x4c')],'paused':_0x2c5508['paused'],'waiting':_0x2c5508['waiting']};_0x3a4608['push'](_0x7c2cac);}}_0x1b7a83({'count':_0x3a4608[_0xcc41('0x19')],'rows':_0x3a4608});});},'FaxQueues':function(_0x380738){return new Promise(function(_0x1115f4,_0x4dab51){var _0x93f97d=[];for(var _0x5622c4 in _0x22fe3e['faxQueues']){if(_0x22fe3e[_0xcc41('0x52')][_0xcc41('0x46')](_0x5622c4)){var _0x4a5254=_0x22fe3e['faxQueues'][_0x5622c4];var _0xfb08a9={'id':_0x4a5254['id'],'available':_0x4a5254['available'],'loggedIn':_0x4a5254[_0xcc41('0x4b')],'name':_0x4a5254[_0xcc41('0x4c')],'paused':_0x4a5254[_0xcc41('0x4d')],'waiting':_0x4a5254[_0xcc41('0x4e')]};_0x93f97d[_0xcc41('0x20')](_0xfb08a9);}}_0x1115f4({'count':_0x93f97d[_0xcc41('0x19')],'rows':_0x93f97d});});},'WhatsappQueues':function(_0x27d2bb){return new Promise(function(_0x1969e9,_0x490bf7){var _0x3e3516=[];for(var _0x38dcc4 in _0x22fe3e[_0xcc41('0x53')]){if(_0x22fe3e['whatsappQueues']['hasOwnProperty'](_0x38dcc4)){var _0x1c95f4=_0x22fe3e[_0xcc41('0x53')][_0x38dcc4];var _0x2a8b4f={'id':_0x1c95f4['id'],'available':_0x1c95f4[_0xcc41('0x4a')],'loggedIn':_0x1c95f4[_0xcc41('0x4b')],'name':_0x1c95f4[_0xcc41('0x4c')],'paused':_0x1c95f4['paused'],'waiting':_0x1c95f4['waiting']};_0x3e3516['push'](_0x2a8b4f);}}_0x1969e9({'count':_0x3e3516[_0xcc41('0x19')],'rows':_0x3e3516});});},'ChatQueuesWaitingInteractions':function(_0x4054e7){return new Promise(function(_0x570bfa,_0x2fcefe){var _0x5896b9=_[_0xcc41('0x48')](_0x22fe3e[_0xcc41('0x54')]);_0x570bfa({'count':_0x5896b9[_0xcc41('0x19')],'rows':_0x5896b9});});},'MailQueuesWaitingInteractions':function(_0x3c4914){return new Promise(function(_0x2bc577,_0x44c9a5){var _0x5aaea8=_[_0xcc41('0x48')](_0x22fe3e['mailQueuesWaitingInteractions']);_0x2bc577({'count':_0x5aaea8[_0xcc41('0x19')],'rows':_0x5aaea8});});},'OpenchannelQueuesWaitingInteractions':function(_0x318220){return new Promise(function(_0x35851d,_0x312a01){var _0x2fdbef=_[_0xcc41('0x48')](_0x22fe3e['openchannelQueuesWaitingInteractions']);_0x35851d({'count':_0x2fdbef[_0xcc41('0x19')],'rows':_0x2fdbef});});},'SmsQueuesWaitingInteractions':function(_0x3e01c1){return new Promise(function(_0x3854cd,_0x52c4ee){var _0x2887d8=_[_0xcc41('0x48')](_0x22fe3e[_0xcc41('0x55')]);_0x3854cd({'count':_0x2887d8['length'],'rows':_0x2887d8});});},'FaxQueuesWaitingInteractions':function(_0x5bddda){return new Promise(function(_0x348f43,_0x3697c8){var _0xd9168e=_[_0xcc41('0x48')](_0x22fe3e[_0xcc41('0x56')]);_0x348f43({'count':_0xd9168e[_0xcc41('0x19')],'rows':_0xd9168e});});},'WhatsappQueuesWaitingInteractions':function(_0x178653){return new Promise(function(_0x529c20,_0x440570){var _0x565460=_['values'](_0x22fe3e[_0xcc41('0x57')]);_0x529c20({'count':_0x565460[_0xcc41('0x19')],'rows':_0x565460});});}};var _0x4dba9=jayson[_0xcc41('0x58')](_0x300d81)[_0xcc41('0x59')]();_0x4dba9['on'](_0xcc41('0x39'),function(_0x45e0b1){logger[_0xcc41('0x39')](JSON[_0xcc41('0x34')](_0x45e0b1));return _0x377acd(_0x45e0b1);});_0x4dba9[_0xcc41('0x13')](0x232c,_0xcc41('0x5a'),function(){console[_0xcc41('0x5b')](_0xcc41('0x5c'),0x232c);return _0x291277(_0xcc41('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x9e1c=['faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','routing','../rpc/openchannelQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','%s:%s:%s','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','error','.js','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions'];(function(_0x476bd8,_0x325156){var _0x2f97d1=function(_0x2ec759){while(--_0x2ec759){_0x476bd8['push'](_0x476bd8['shift']());}};_0x2f97d1(++_0x325156);}(_0x9e1c,0x1ae));var _0xc9e1=function(_0x5a3519,_0x254187){_0x5a3519=_0x5a3519-0x0;var _0x303952=_0x9e1c[_0x5a3519];return _0x303952;};'use strict';var _=require(_0xc9e1('0x0'));var util=require('util');var path=require(_0xc9e1('0x1'));var fs=require('fs');var jayson=require(_0xc9e1('0x2'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc9e1('0x3'));var rpc={'openchannelQueueReport':require(_0xc9e1('0x4')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc9e1('0x5'))};var RuleEngine=require(_0xc9e1('0x6'));function getId(_0x4616f8,_0x5a3759,_0x3adb80){return util[_0xc9e1('0x7')](_0xc9e1('0x8'),_0x4616f8,_0x5a3759||0x0,_0x3adb80||0x0);}function getIntervals(_0x4f8133,_0x58252c){var _0x54ba35=[];if(!_[_0xc9e1('0x9')](_0x58252c[_0xc9e1('0xa')])&&!_[_0xc9e1('0x9')](_0x4f8133[_0x58252c[_0xc9e1('0xa')]])&&!_['isNil'](_0x4f8133[_0x58252c['IntervalId']][_0xc9e1('0xb')])){_0x54ba35=_['map'](_0x4f8133[_0x58252c[_0xc9e1('0xa')]]['Intervals'],_0xc9e1('0xc'));}else if(!_['isNil'](_0x58252c[_0xc9e1('0xc')])){_0x54ba35=[_0x58252c[_0xc9e1('0xc')]];}return _0x54ba35;}exports[_0xc9e1('0xd')]=function(_0x502e8){_0x502e8[_0xc9e1('0xe')]={};return new BPromise(function(_0x8a87ba,_0x4f95c4){var _0x16356f={'Start':function(_0x2fecfa){var _0x47b44d=this;return new Promise(function(_0x29a577,_0x1bcad2){if(_0x2fecfa){try{var _0x5743c2=[];var _0xf44d9=getId(_0x2fecfa['channel'],_0x2fecfa['message']?_0x2fecfa[_0xc9e1('0xf')]['id']:0x0,_0x2fecfa[_0xc9e1('0x10')]?_0x2fecfa[_0xc9e1('0x10')]['id']:0x0);if(_0x2fecfa[_0xc9e1('0x11')]&&_['isArray'](_0x2fecfa[_0xc9e1('0x11')])&&_0x2fecfa[_0xc9e1('0x11')][_0xc9e1('0x12')]){for(var _0x52e01e=0x0;_0x52e01e<_0x2fecfa[_0xc9e1('0x11')][_0xc9e1('0x12')];_0x52e01e+=0x1){var _0x25e902=_0x2fecfa['applications'][_0x52e01e];if(fs[_0xc9e1('0x13')](path[_0xc9e1('0x14')](__dirname,_0xc9e1('0x11'),_0x25e902[_0xc9e1('0x15')]+'.js'))){var _0x1511ac=[];switch(_0x25e902[_0xc9e1('0x15')][_0xc9e1('0x16')]()){case _0xc9e1('0x17'):var _0x4a28eb=_0x25e902[_0xc9e1('0x18')][_0xc9e1('0x19')](',');_0x1511ac[_0xc9e1('0x1a')](_0x4a28eb[0x0]);_0x1511ac[_0xc9e1('0x1a')](_0x4a28eb[_0xc9e1('0x1b')](0x1,_0x4a28eb[_0xc9e1('0x12')])['join'](','));break;case _0xc9e1('0x1c'):var _0x4fc470=_0x25e902[_0xc9e1('0x18')][_0xc9e1('0x19')](',');_0x1511ac[_0xc9e1('0x1a')](_0x4fc470[0x0]);_0x1511ac[_0xc9e1('0x1a')](_0x4fc470[0x1]);_0x1511ac[_0xc9e1('0x1a')](_0x4fc470[_0xc9e1('0x1b')](0x2,_0x4fc470[_0xc9e1('0x12')])[_0xc9e1('0x14')](','));break;case _0xc9e1('0x1d'):var _0x5c8b58=_0x25e902[_0xc9e1('0x18')][_0xc9e1('0x19')](',');_0x1511ac['push'](_0x5c8b58[0x0]);_0x1511ac['push'](_0x5c8b58[0x1]);_0x1511ac['push'](_0x5c8b58[0x2]);_0x1511ac[_0xc9e1('0x1a')](_0x5c8b58[0x3]);_0x1511ac[_0xc9e1('0x1a')](_0x5c8b58[_0xc9e1('0x1b')](0x4,_0x5c8b58[_0xc9e1('0x12')])[_0xc9e1('0x14')](','));break;case _0xc9e1('0xf'):_0x1511ac[_0xc9e1('0x1a')](_0x25e902['appdata']);break;case _0xc9e1('0x1e'):_0x1511ac['push'](_0x25e902[_0xc9e1('0x1f')]);_0x1511ac[_0xc9e1('0x1a')](_0x25e902[_0xc9e1('0x18')]);break;default:_0x1511ac=_['isNil'](_0x25e902[_0xc9e1('0x18')])?[]:_0x25e902[_0xc9e1('0x18')][_0xc9e1('0x19')](',');}var _0x5c8a47={'id':util[_0xc9e1('0x7')](_0xc9e1('0x20'),_0xf44d9,_0x25e902['id'],_0x25e902['app']),'condition':require('./interval')['condition'](_0xf44d9,getIntervals(_0x502e8[_0xc9e1('0x21')],_0x25e902),_0x502e8),'consequence':require(_0xc9e1('0x22')+_0x25e902['app'])[_0xc9e1('0x23')](_0xf44d9,_0x1511ac,_0x502e8,_0x2fecfa),'p':_0x25e902['priority']||0x0};logger[_0xc9e1('0x24')](_0xc9e1('0x25'),_0x5c8a47['id'],_0xc9e1('0x26'),getIntervals(_0x502e8[_0xc9e1('0x21')],_0x25e902)[_0xc9e1('0x14')]('\x20|\x20'));_0x5743c2[_0xc9e1('0x1a')](_0x5c8a47);}else{logger[_0xc9e1('0x27')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc9e1('0x14')](__dirname,_0xc9e1('0x11'),_0x25e902[_0xc9e1('0x15')]+_0xc9e1('0x28')));}}_0x502e8[_0xc9e1('0xe')][_0xf44d9]=new RuleEngine(_0x5743c2);_0x502e8['rules'][_0xf44d9][_0xc9e1('0x29')](_0x2fecfa,function(_0x24b1d6){logger['info'](_0xc9e1('0x2a'),JSON[_0xc9e1('0x2b')](_0x24b1d6['matchPath']));if(_0x502e8[_0xc9e1('0xe')][_0xf44d9]){_0x502e8['rules'][_0xf44d9][_0xc9e1('0x2c')](_0xc9e1('0x2d'));}});return _0x29a577({'code':0xc8,'message':_0x2fecfa});}else{logger[_0xc9e1('0x24')](_0xc9e1('0x2e'));return _0x29a577({'code':0xc8,'message':_0x2fecfa});}}catch(_0x493fee){logger[_0xc9e1('0x27')](_0x493fee['stack']);return _0x1bcad2(_0x47b44d[_0xc9e1('0x27')](0x1f4,_0x493fee));}}return _0x1bcad2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x55699b){var _0x59adcc=this;return new Promise(function(_0xc68329,_0x39112f){if(_0x55699b['message']&&_0x55699b['message']['id']){try{var _0x56af5c=getId(_0x55699b['channel'],_0x55699b['message']?_0x55699b[_0xc9e1('0xf')]['id']:0x0,_0x55699b['interaction']?_0x55699b[_0xc9e1('0x10')]['id']:0x0);if(_0x502e8[_0xc9e1('0xe')][_0x56af5c]){_0x502e8[_0xc9e1('0xe')][_0x56af5c][_0xc9e1('0x2c')]('end');if(rpc[_0x55699b[_0xc9e1('0x2f')]+_0xc9e1('0x30')]){rpc[_0x55699b[_0xc9e1('0x2f')]+_0xc9e1('0x30')][_0xc9e1('0x31')](_0x56af5c,{'UserId':_0x55699b[_0xc9e1('0xf')][_0xc9e1('0x32')]})[_0xc9e1('0x33')](function(_0xcd8152){logger[_0xc9e1('0x27')](_0xc9e1('0x34'));});}}return _0xc68329({'code':0xc8,'message':_0x55699b});}catch(_0x4cb629){logger['error'](_0x4cb629[_0xc9e1('0x35')]);return _0x39112f(_0x59adcc['error'](0x1f4,_0x4cb629));}}logger[_0xc9e1('0x27')](_0xc9e1('0x36'));return _0x39112f(_0x59adcc['error'](0x1f4,_0xc9e1('0x36')));});},'RejectMessage':function(_0x42c64f){var _0x56830e=this;return new Promise(function(_0x3c0560,_0x5ca37f){if(_0x42c64f['agent']&&_0x42c64f[_0xc9e1('0x37')]['id']){try{if(_0x502e8[_0xc9e1('0x38')][_0x42c64f['agent']['id']]){_0x502e8[_0xc9e1('0x38')][_0x42c64f[_0xc9e1('0x37')]['id']][_0xc9e1('0x39')]=![];_0x502e8[_0xc9e1('0x38')][_0x42c64f[_0xc9e1('0x37')]['id']][_0xc9e1('0x3a')]=undefined;}return _0x3c0560({'code':0xc8,'message':_0x42c64f});}catch(_0x43ceb4){logger['error'](_0x43ceb4[_0xc9e1('0x35')]);return _0x5ca37f(_0x56830e[_0xc9e1('0x27')](0x1f4,_0x43ceb4));}}logger[_0xc9e1('0x27')](_0xc9e1('0x36'));return _0x5ca37f(_0x56830e[_0xc9e1('0x27')](0x1f4,_0xc9e1('0x36')));});},'AbandonInteraction':function(_0x549d3a){var _0xc77e0c=this;return new Promise(function(_0x372505,_0x33ff78){if(_0x549d3a[_0xc9e1('0x2f')]&&_0x549d3a[_0xc9e1('0x10')]&&_0x549d3a[_0xc9e1('0x10')]['id']){try{var _0x2b1a8d=getId(_0x549d3a[_0xc9e1('0x2f')],_0x549d3a[_0xc9e1('0xf')]?_0x549d3a[_0xc9e1('0xf')]['id']:0x0,_0x549d3a[_0xc9e1('0x10')]?_0x549d3a[_0xc9e1('0x10')]['id']:0x0);if(_0x502e8[_0xc9e1('0xe')][_0x2b1a8d]){_0x502e8['rules'][_0x2b1a8d][_0xc9e1('0x2c')](_0xc9e1('0x3b'));}return _0x372505({'code':0xc8,'message':_0x549d3a});}catch(_0x121c8a){logger['error'](_0x121c8a[_0xc9e1('0x35')]);return _0x33ff78(_0xc77e0c[_0xc9e1('0x27')](0x1f4,_0x121c8a));}}logger[_0xc9e1('0x27')](_0xc9e1('0x36'));return _0x33ff78(_0xc77e0c['error'](0x1f4,_0xc9e1('0x36')));});},'AgentCapacity':function(_0xa05d96){var _0x318f11=this;return new Promise(function(_0x2ea671,_0x566b5a){if(_0x502e8[_0xc9e1('0x38')][_0xc9e1('0x3c')](_0xa05d96['id'])){for(var _0x435a75 in _0xa05d96[_0xc9e1('0x3d')]){if(_0xa05d96['capacity'][_0xc9e1('0x3c')](_0x435a75)){if(_0x502e8[_0xc9e1('0x38')][_0xa05d96['id']][_0xc9e1('0x3c')](_0x435a75+_0xc9e1('0x3e'))){_0x502e8['agents'][_0xa05d96['id']][_0x435a75+_0xc9e1('0x3e')]=parseInt(_0xa05d96[_0xc9e1('0x3d')][_0x435a75],0xa);}}}_0x502e8[_0xc9e1('0x38')][_0xa05d96['id']][_0xc9e1('0x3f')]();return _0x2ea671({'code':0xc8,'message':_0x502e8[_0xc9e1('0x38')][_0xa05d96['id']]});}else{return _0x566b5a(_0x318f11[_0xc9e1('0x27')](0x1f4,_0xc9e1('0x40')));}});},'Agents':function(_0xfd453c){return new Promise(function(_0x5ddef1,_0x3b6f05){var _0x616d94=_[_0xc9e1('0x41')](_0x502e8[_0xc9e1('0x38')]);_0x5ddef1({'count':_0x616d94[_0xc9e1('0x12')],'rows':_0x616d94});});},'ChatQueues':function(_0x5680b6){return new Promise(function(_0x572249,_0x23d253){var _0x3f2d51=[];for(var _0x345b15 in _0x502e8[_0xc9e1('0x42')]){if(_0x502e8[_0xc9e1('0x42')][_0xc9e1('0x3c')](_0x345b15)){var _0x39958=_0x502e8[_0xc9e1('0x42')][_0x345b15];var _0x58115e={'id':_0x39958['id'],'available':_0x39958[_0xc9e1('0x43')],'loggedIn':_0x39958[_0xc9e1('0x44')],'name':_0x39958[_0xc9e1('0x45')],'paused':_0x39958[_0xc9e1('0x46')],'waiting':_0x39958['waiting']};_0x3f2d51[_0xc9e1('0x1a')](_0x58115e);}}_0x572249({'count':_0x3f2d51[_0xc9e1('0x12')],'rows':_0x3f2d51});});},'MailQueues':function(_0x499636){return new Promise(function(_0x551d8b,_0x308014){var _0xac70fe=[];for(var _0x3bbcc0 in _0x502e8['mailQueues']){if(_0x502e8[_0xc9e1('0x47')][_0xc9e1('0x3c')](_0x3bbcc0)){var _0x67ed3e=_0x502e8[_0xc9e1('0x47')][_0x3bbcc0];var _0x1a1ca0={'id':_0x67ed3e['id'],'available':_0x67ed3e[_0xc9e1('0x43')],'loggedIn':_0x67ed3e[_0xc9e1('0x44')],'name':_0x67ed3e[_0xc9e1('0x45')],'paused':_0x67ed3e[_0xc9e1('0x46')],'waiting':_0x67ed3e[_0xc9e1('0x48')]};_0xac70fe[_0xc9e1('0x1a')](_0x1a1ca0);}}_0x551d8b({'count':_0xac70fe[_0xc9e1('0x12')],'rows':_0xac70fe});});},'OpenchannelQueues':function(_0x1b5659){return new Promise(function(_0x365749,_0x57aff6){var _0xc859c5=[];for(var _0x4f976c in _0x502e8[_0xc9e1('0x49')]){if(_0x502e8[_0xc9e1('0x49')][_0xc9e1('0x3c')](_0x4f976c)){var _0x59469a=_0x502e8[_0xc9e1('0x49')][_0x4f976c];var _0x1d845={'id':_0x59469a['id'],'available':_0x59469a[_0xc9e1('0x43')],'loggedIn':_0x59469a[_0xc9e1('0x44')],'name':_0x59469a[_0xc9e1('0x45')],'paused':_0x59469a[_0xc9e1('0x46')],'waiting':_0x59469a[_0xc9e1('0x48')]};_0xc859c5[_0xc9e1('0x1a')](_0x1d845);}}_0x365749({'count':_0xc859c5[_0xc9e1('0x12')],'rows':_0xc859c5});});},'SmsQueues':function(_0x4c6830){return new Promise(function(_0x3ab1b6,_0x3f9087){var _0x491edd=[];for(var _0x441978 in _0x502e8[_0xc9e1('0x4a')]){if(_0x502e8[_0xc9e1('0x4a')][_0xc9e1('0x3c')](_0x441978)){var _0x306efa=_0x502e8[_0xc9e1('0x4a')][_0x441978];var _0x23986c={'id':_0x306efa['id'],'available':_0x306efa[_0xc9e1('0x43')],'loggedIn':_0x306efa[_0xc9e1('0x44')],'name':_0x306efa[_0xc9e1('0x45')],'paused':_0x306efa[_0xc9e1('0x46')],'waiting':_0x306efa[_0xc9e1('0x48')]};_0x491edd[_0xc9e1('0x1a')](_0x23986c);}}_0x3ab1b6({'count':_0x491edd['length'],'rows':_0x491edd});});},'FaxQueues':function(_0xa57172){return new Promise(function(_0x2c8f28,_0x1aeebe){var _0x2eee26=[];for(var _0x2b450d in _0x502e8[_0xc9e1('0x4b')]){if(_0x502e8[_0xc9e1('0x4b')][_0xc9e1('0x3c')](_0x2b450d)){var _0x5682fb=_0x502e8[_0xc9e1('0x4b')][_0x2b450d];var _0x164487={'id':_0x5682fb['id'],'available':_0x5682fb[_0xc9e1('0x43')],'loggedIn':_0x5682fb['loggedIn'],'name':_0x5682fb[_0xc9e1('0x45')],'paused':_0x5682fb[_0xc9e1('0x46')],'waiting':_0x5682fb[_0xc9e1('0x48')]};_0x2eee26[_0xc9e1('0x1a')](_0x164487);}}_0x2c8f28({'count':_0x2eee26['length'],'rows':_0x2eee26});});},'WhatsappQueues':function(_0x986f2e){return new Promise(function(_0x5ef4a2,_0x25ef0d){var _0xad5e02=[];for(var _0x5e4041 in _0x502e8['whatsappQueues']){if(_0x502e8[_0xc9e1('0x4c')][_0xc9e1('0x3c')](_0x5e4041)){var _0x10154e=_0x502e8[_0xc9e1('0x4c')][_0x5e4041];var _0x5e8f1d={'id':_0x10154e['id'],'available':_0x10154e['available'],'loggedIn':_0x10154e[_0xc9e1('0x44')],'name':_0x10154e[_0xc9e1('0x45')],'paused':_0x10154e[_0xc9e1('0x46')],'waiting':_0x10154e[_0xc9e1('0x48')]};_0xad5e02[_0xc9e1('0x1a')](_0x5e8f1d);}}_0x5ef4a2({'count':_0xad5e02['length'],'rows':_0xad5e02});});},'ChatQueuesWaitingInteractions':function(_0x2c0580){return new Promise(function(_0x10d928,_0x34c3a4){var _0x26ae5f=_['values'](_0x502e8[_0xc9e1('0x4d')]);_0x10d928({'count':_0x26ae5f['length'],'rows':_0x26ae5f});});},'MailQueuesWaitingInteractions':function(_0x265c8a){return new Promise(function(_0x56290e,_0x1e25e7){var _0x466216=_[_0xc9e1('0x41')](_0x502e8[_0xc9e1('0x4e')]);_0x56290e({'count':_0x466216[_0xc9e1('0x12')],'rows':_0x466216});});},'OpenchannelQueuesWaitingInteractions':function(_0x3ec40d){return new Promise(function(_0x505959,_0x157da1){var _0x411703=_[_0xc9e1('0x41')](_0x502e8[_0xc9e1('0x4f')]);_0x505959({'count':_0x411703[_0xc9e1('0x12')],'rows':_0x411703});});},'SmsQueuesWaitingInteractions':function(_0x18c31a){return new Promise(function(_0x54174b,_0x50b3ed){var _0x3d1328=_[_0xc9e1('0x41')](_0x502e8['smsQueuesWaitingInteractions']);_0x54174b({'count':_0x3d1328[_0xc9e1('0x12')],'rows':_0x3d1328});});},'FaxQueuesWaitingInteractions':function(_0x51c011){return new Promise(function(_0x298fc8,_0x20cef1){var _0x12c2c4=_[_0xc9e1('0x41')](_0x502e8[_0xc9e1('0x50')]);_0x298fc8({'count':_0x12c2c4['length'],'rows':_0x12c2c4});});},'WhatsappQueuesWaitingInteractions':function(_0x303a32){return new Promise(function(_0x537078,_0x33d390){var _0x446b38=_['values'](_0x502e8[_0xc9e1('0x51')]);_0x537078({'count':_0x446b38[_0xc9e1('0x12')],'rows':_0x446b38});});}};var _0x30317a=jayson[_0xc9e1('0x52')](_0x16356f)['http']();_0x30317a['on']('error',function(_0x23ae39){logger[_0xc9e1('0x27')](JSON[_0xc9e1('0x2b')](_0x23ae39));return _0x4f95c4(_0x23ae39);});_0x30317a['listen'](0x232c,_0xc9e1('0x53'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x8a87ba(_0xc9e1('0x54')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 40d2367..dacd326 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 _0xe2c9=['join','when','catch','log','\x20|\x20','stack','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x21bfcf,_0x43cc46){var _0x4bff81=function(_0x5b4ae5){while(--_0x5b4ae5){_0x21bfcf['push'](_0x21bfcf['shift']());}};_0x4bff81(++_0x43cc46);}(_0xe2c9,0x10b));var _0x9e2c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xe2c9[_0x2cfb58];return _0xd99951;};'use strict';var util=require('util');var BPromise=require(_0x9e2c('0x0'));var jayson=require(_0x9e2c('0x1'));var _=require(_0x9e2c('0x2'));var logger=require('../../../config/logger')(_0x9e2c('0x3'));var client=jayson[_0x9e2c('0x4')][_0x9e2c('0x5')]({'port':0x232a});function request(_0x4c3fdd,_0x4281ae){return new BPromise(function(_0x5c8308,_0x4c24fe){return client[_0x9e2c('0x6')](_0x4c3fdd,_0x4281ae)[_0x9e2c('0x7')](function(_0x37780c){if(_0x37780c['error']){return _0x4c24fe(_0x37780c[_0x9e2c('0x8')][_0x9e2c('0x9')]);}else{return _0x5c8308(_0x37780c[_0x9e2c('0xa')]);}})['catch'](function(_0xdccd80){return _0x4c24fe(_0xdccd80);});});}exports[_0x9e2c('0xb')]=function(_0x1abc2b,_0xd4c29,_0x5afffd){return function(_0x92915e){if(_0x5afffd['rules']&&!_0x5afffd[_0x9e2c('0xc')][_0x1abc2b]){logger[_0x9e2c('0xd')](_0x9e2c('0xe'),_0x1abc2b);return _0x92915e[_0x9e2c('0xf')]();}var _0x57222f=[];for(var _0x11b45c=0x0;_0x11b45c<_0xd4c29['length'];_0x11b45c+=0x1){_0x57222f[_0x9e2c('0x10')](request('Command',{'command':util[_0x9e2c('0x11')]('iftime\x20%s',_0xd4c29[_0x11b45c])})[_0x9e2c('0x7')](function(_0x8b7c21){return _0x8b7c21&&_0x8b7c21[_0x9e2c('0x9')]&&_0x8b7c21[_0x9e2c('0x9')][_0x9e2c('0x12')](_0x9e2c('0x13'))>=0x0?!![]:![];})['catch'](function(_0xba96d3){logger[_0x9e2c('0x8')](_0x9e2c('0x14'),_0x1abc2b,_0xd4c29[_0x11b45c]);}));}BPromise[_0x9e2c('0x15')](_0x57222f)['then'](function(_0x1e218e){var _0x22c5ac=_['some'](_0x1e218e);logger['info'](_0x9e2c('0x16'),_0x1abc2b,_0xd4c29[_0x9e2c('0x17')]('\x20|\x20'),_0x22c5ac);_0x92915e[_0x9e2c('0x18')](_0x22c5ac);})[_0x9e2c('0x19')](function(_0xdd1411){console[_0x9e2c('0x1a')](_0xdd1411);logger[_0x9e2c('0x8')](_0x9e2c('0x16'),_0x1abc2b,_0xd4c29[_0x9e2c('0x17')](_0x9e2c('0x1b')),_0xdd1411[_0x9e2c('0x1c')]);_0x92915e[_0x9e2c('0xf')]();});};}; \ No newline at end of file +var _0xc67c=['push','Command','format','iftime\x20%s','then','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','catch','condition','rules','info','stop'];(function(_0x413162,_0x2470ea){var _0x72f253=function(_0x193dd8){while(--_0x193dd8){_0x413162['push'](_0x413162['shift']());}};_0x72f253(++_0x2470ea);}(_0xc67c,0x9f));var _0xcc67=function(_0x580cf6,_0x19c248){_0x580cf6=_0x580cf6-0x0;var _0x20cccf=_0xc67c[_0x580cf6];return _0x20cccf;};'use strict';var util=require(_0xcc67('0x0'));var BPromise=require(_0xcc67('0x1'));var jayson=require(_0xcc67('0x2'));var _=require(_0xcc67('0x3'));var logger=require(_0xcc67('0x4'))('routing');var client=jayson[_0xcc67('0x5')][_0xcc67('0x6')]({'port':0x232a});function request(_0x4305ac,_0x2f6015){return new BPromise(function(_0x8d5a92,_0x2e1227){return client[_0xcc67('0x7')](_0x4305ac,_0x2f6015)['then'](function(_0x1515f1){if(_0x1515f1[_0xcc67('0x8')]){return _0x2e1227(_0x1515f1[_0xcc67('0x8')][_0xcc67('0x9')]);}else{return _0x8d5a92(_0x1515f1['result']);}})[_0xcc67('0xa')](function(_0xb6bca5){return _0x2e1227(_0xb6bca5);});});}exports[_0xcc67('0xb')]=function(_0xc4bdb3,_0x597e0b,_0x58d842){return function(_0x2d47cd){if(_0x58d842['rules']&&!_0x58d842[_0xcc67('0xc')][_0xc4bdb3]){logger[_0xcc67('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xc4bdb3);return _0x2d47cd[_0xcc67('0xe')]();}var _0x5dc150=[];for(var _0x2f0cb1=0x0;_0x2f0cb1<_0x597e0b['length'];_0x2f0cb1+=0x1){_0x5dc150[_0xcc67('0xf')](request(_0xcc67('0x10'),{'command':util[_0xcc67('0x11')](_0xcc67('0x12'),_0x597e0b[_0x2f0cb1])})[_0xcc67('0x13')](function(_0x4c1395){return _0x4c1395&&_0x4c1395[_0xcc67('0x9')]&&_0x4c1395[_0xcc67('0x9')]['indexOf'](_0xcc67('0x14'))>=0x0?!![]:![];})[_0xcc67('0xa')](function(_0x295d8e){logger[_0xcc67('0x8')](_0xcc67('0x15'),_0xc4bdb3,_0x597e0b[_0x2f0cb1]);}));}BPromise[_0xcc67('0x16')](_0x5dc150)[_0xcc67('0x13')](function(_0x3cb864){var _0x498f0f=_[_0xcc67('0x17')](_0x3cb864);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0xc4bdb3,_0x597e0b[_0xcc67('0x18')](_0xcc67('0x19')),_0x498f0f);_0x2d47cd['when'](_0x498f0f);})[_0xcc67('0xa')](function(_0x1f495c){console[_0xcc67('0x1a')](_0x1f495c);logger[_0xcc67('0x8')](_0xcc67('0x1b'),_0xc4bdb3,_0x597e0b['join'](_0xcc67('0x19')),_0x1f495c[_0xcc67('0x1c')]);_0x2d47cd['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 60ac1f9..24d5221 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 _0xacd7=['answeredelsewheremembername','membername','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','transferexten','extension','attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','origtransfereruniqueid','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','indexOf','diffTime','agent','lodash','util','./utils','info','format','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','ringtime','push','queuecallerabandon','forIn','abandoned','reason','holdtime','talktime','agentconnect','agentconnectAt','connectedlinename','connect','answered_elsewhere'];(function(_0x2e279f,_0x284c78){var _0x5f57ee=function(_0x4866d8){while(--_0x4866d8){_0x2e279f['push'](_0x2e279f['shift']());}};_0x5f57ee(++_0x284c78);}(_0xacd7,0x139));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7acd('0x0'));var util=require(_0x7acd('0x1'));var utils=require(_0x7acd('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3b47ec,_0x1b27aa){utils[_0x7acd('0x3')](util[_0x7acd('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x3b47ec[_0x7acd('0x5')],_0x3b47ec['channel'],_0x3b47ec[_0x7acd('0x6')],_0x3b47ec['membername'],_0x3b47ec[_0x7acd('0x7')],_0x3b47ec['calleridnum'],_0x3b47ec[_0x7acd('0x8')],_0x3b47ec[_0x7acd('0x9')]));if(_0x3b47ec[_0x7acd('0x6')]){utils[_0x7acd('0xa')](_0x3b47ec[_0x7acd('0x6')])['then'](function(_0x16a1ce){if(_0x16a1ce){_0x3b47ec[_0x7acd('0xb')]=_0x16a1ce['type'];_0x3b47ec[_0x7acd('0xc')]=_0x3b47ec[_0x7acd('0xd')]?_0x16a1ce['acw']:![];_0x3b47ec[_0x7acd('0xe')]=_0x3b47ec[_0x7acd('0xc')]?_0x16a1ce[_0x7acd('0xf')]:0x0;}utils[_0x7acd('0x10')](_0x7acd('0x11'),_0x3b47ec);});}else{utils['request'](_0x7acd('0x11'),_0x3b47ec);}if(_0x1b27aa){delete transfers[_0x3b47ec[_0x7acd('0x5')]];}else{delete agents[_0x3b47ec[_0x7acd('0x12')]];}}exports[_0x7acd('0x13')]=function(_0x2a7fa1){try{agents[_0x2a7fa1[_0x7acd('0x12')]]=_0x2a7fa1;agents[_0x2a7fa1[_0x7acd('0x12')]][_0x7acd('0x14')]=utils[_0x7acd('0x15')]();agents[_0x2a7fa1[_0x7acd('0x12')]][_0x7acd('0x9')]=_0x7acd('0x16');agents[_0x2a7fa1[_0x7acd('0x12')]]['connectedlinenum']=null;agents[_0x2a7fa1[_0x7acd('0x12')]]['connectedlinename']=null;}catch(_0x53122f){utils[_0x7acd('0x17')](_0x53122f[_0x7acd('0x18')]);}};exports[_0x7acd('0x19')]=function(_0x3bc991){try{if(!_[_0x7acd('0x1a')](agents[_0x3bc991[_0x7acd('0x12')]])){agents[_0x3bc991[_0x7acd('0x12')]][_0x7acd('0x19')]=!![];agents[_0x3bc991[_0x7acd('0x12')]][_0x7acd('0x1b')]=utils['now']();agents[_0x3bc991[_0x7acd('0x12')]][_0x7acd('0x9')]=_0x7acd('0x1c');agents[_0x3bc991[_0x7acd('0x12')]]['reason']='timeout';agents[_0x3bc991[_0x7acd('0x12')]]['holdtime']=_0x3bc991[_0x7acd('0x1d')]?parseInt(_0x3bc991['ringtime'])/0x3e8:0x0;agents[_0x3bc991[_0x7acd('0x12')]]['talktime']=0x0;unanswered[_0x7acd('0x1e')](_0x3bc991[_0x7acd('0x12')]);}}catch(_0x72e1cd){utils[_0x7acd('0x17')](_0x72e1cd[_0x7acd('0x18')]);}};exports[_0x7acd('0x1f')]=function(_0x836b09){try{_[_0x7acd('0x20')](agents,function(_0xbc086d,_0x4ccdba){if(_0xbc086d[_0x7acd('0x5')]==_0x836b09['uniqueid']&&!_['includes'](unanswered,_0xbc086d[_0x7acd('0x12')])){_0xbc086d['agentringnoanswer']=!![];_0xbc086d[_0x7acd('0x1b')]=utils['now']();_0xbc086d['lastevent']=_0x7acd('0x21');_0xbc086d[_0x7acd('0x22')]='abandoned';_0xbc086d[_0x7acd('0x23')]=_0x836b09[_0x7acd('0x23')];_0xbc086d[_0x7acd('0x24')]=0x0;writeDB(_0xbc086d);}});}catch(_0x4d48f7){utils[_0x7acd('0x17')](_0x4d48f7[_0x7acd('0x18')]);}};exports[_0x7acd('0x25')]=function(_0x11f002){try{if(agents[_0x11f002['destuniqueid']]){agents[_0x11f002[_0x7acd('0x12')]][_0x7acd('0x26')]=utils[_0x7acd('0x15')]();agents[_0x11f002[_0x7acd('0x12')]][_0x7acd('0x8')]=_0x11f002[_0x7acd('0x8')];agents[_0x11f002[_0x7acd('0x12')]]['connectedlinename']=_0x11f002[_0x7acd('0x27')];agents[_0x11f002[_0x7acd('0x12')]][_0x7acd('0x23')]=_0x11f002[_0x7acd('0x1d')];agents[_0x11f002[_0x7acd('0x12')]]['lastevent']=_0x7acd('0x28');_['forIn'](agents,function(_0x4129eb,_0x294e3c){if(_0x4129eb[_0x7acd('0x12')]!=_0x11f002[_0x7acd('0x12')]&&_0x4129eb['uniqueid']==_0x11f002[_0x7acd('0x5')]){_0x4129eb['talktime']=0x0;_0x4129eb['holdtime']=_0x11f002['ringtime'];_0x4129eb[_0x7acd('0x19')]=!![];_0x4129eb[_0x7acd('0x1b')]=utils['now']();_0x4129eb[_0x7acd('0x9')]='answered_elsewhere';_0x4129eb[_0x7acd('0x22')]=_0x7acd('0x29');_0x4129eb['answeredelsewheredestinationuniqueid']=_0x11f002[_0x7acd('0x12')];_0x4129eb[_0x7acd('0x2a')]=_0x11f002[_0x7acd('0x2b')];writeDB(_0x4129eb);}});}}catch(_0x45933c){utils[_0x7acd('0x17')](_0x45933c[_0x7acd('0x18')]);}};exports[_0x7acd('0xd')]=function(_0x1f5238){try{if(!_[_0x7acd('0x1a')](agents[_0x1f5238[_0x7acd('0x12')]])){agents[_0x1f5238[_0x7acd('0x12')]][_0x7acd('0xd')]=!![];agents[_0x1f5238[_0x7acd('0x12')]][_0x7acd('0x2c')]=utils[_0x7acd('0x15')]();agents[_0x1f5238[_0x7acd('0x12')]][_0x7acd('0x24')]=utils['diffTime'](agents[_0x1f5238[_0x7acd('0x12')]][_0x7acd('0x2c')],agents[_0x1f5238[_0x7acd('0x12')]][_0x7acd('0x26')]);agents[_0x1f5238[_0x7acd('0x12')]]['reason']=_0x1f5238[_0x7acd('0x22')];agents[_0x1f5238[_0x7acd('0x12')]]['lastevent']=_0x7acd('0x2d');writeDB(agents[_0x1f5238[_0x7acd('0x12')]]);}}catch(_0x34d417){utils['error'](_0x34d417[_0x7acd('0x18')]);}};exports['blindtransfer']=function(_0x31f6fe){try{if(!_['isNil'](agents[_0x31f6fe[_0x7acd('0x2e')]])){agents[_0x31f6fe['transfereruniqueid']][_0x7acd('0x2f')]=!![];agents[_0x31f6fe[_0x7acd('0x2e')]][_0x7acd('0x30')]='blind';agents[_0x31f6fe[_0x7acd('0x2e')]][_0x7acd('0x31')]=_0x31f6fe[_0x7acd('0x32')];agents[_0x31f6fe[_0x7acd('0x2e')]]['transferuniqueid']=agents[_0x31f6fe[_0x7acd('0x2e')]][_0x7acd('0x5')];}}catch(_0x29c248){utils[_0x7acd('0x17')](_0x29c248[_0x7acd('0x18')]);}};exports[_0x7acd('0x33')]=function(_0x3d7e43){try{if(_0x3d7e43['origtransfereruniqueid']==_0x3d7e43[_0x7acd('0x34')]){if(!_['isNil'](agents[_0x3d7e43['secondtransfereruniqueid']])){agents[_0x3d7e43[_0x7acd('0x35')]][_0x7acd('0x2f')]=!![];agents[_0x3d7e43['secondtransfereruniqueid']][_0x7acd('0x30')]=_0x7acd('0x36');agents[_0x3d7e43[_0x7acd('0x35')]]['transferexten']=_0x3d7e43['origtransfererexten'];agents[_0x3d7e43['secondtransfereruniqueid']][_0x7acd('0x37')]=_0x3d7e43['origtransfereruniqueid'];}if(_0x3d7e43[_0x7acd('0x38')]&&agents[_0x3d7e43[_0x7acd('0x38')]]){agents[_0x3d7e43['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x3d7e43['transfereeuniqueid']]=_['clone'](agents[_0x3d7e43[_0x7acd('0x38')]]);transfers[_0x3d7e43[_0x7acd('0x38')]][_0x7acd('0x39')]=agents[_0x3d7e43[_0x7acd('0x35')]][_0x7acd('0x39')];transfers[_0x3d7e43[_0x7acd('0x38')]][_0x7acd('0x3a')]=agents[_0x3d7e43[_0x7acd('0x35')]][_0x7acd('0x3a')];transfers[_0x3d7e43['transfereeuniqueid']][_0x7acd('0x14')]=utils[_0x7acd('0x15')]();transfers[_0x3d7e43[_0x7acd('0x38')]][_0x7acd('0x26')]=utils[_0x7acd('0x15')]();transfers[_0x3d7e43[_0x7acd('0x38')]]['holdtime']=0x0;transfers[_0x3d7e43[_0x7acd('0x38')]][_0x7acd('0x3b')]=0x2;}}else if(_0x3d7e43[_0x7acd('0x35')]==_0x3d7e43[_0x7acd('0x3c')]){if(!_[_0x7acd('0x1a')](agents[_0x3d7e43[_0x7acd('0x3d')]])){agents[_0x3d7e43[_0x7acd('0x3d')]][_0x7acd('0x2f')]=!![];agents[_0x3d7e43[_0x7acd('0x3d')]]['transfertype']=_0x7acd('0x36');agents[_0x3d7e43[_0x7acd('0x3d')]][_0x7acd('0x31')]=_0x3d7e43[_0x7acd('0x3e')];agents[_0x3d7e43[_0x7acd('0x3d')]][_0x7acd('0x37')]=_0x3d7e43['secondtransfereruniqueid'];}if(_0x3d7e43['transfertargetuniqueid']&&agents[_0x3d7e43[_0x7acd('0x3f')]]){agents[_0x3d7e43[_0x7acd('0x3f')]]['agententerreason']=0x1;transfers[_0x3d7e43[_0x7acd('0x3f')]]=_[_0x7acd('0x40')](agents[_0x3d7e43[_0x7acd('0x3f')]]);transfers[_0x3d7e43[_0x7acd('0x3f')]][_0x7acd('0x39')]=agents[_0x3d7e43[_0x7acd('0x3d')]]['calleridnum'];transfers[_0x3d7e43[_0x7acd('0x3f')]][_0x7acd('0x3a')]=agents[_0x3d7e43[_0x7acd('0x3d')]][_0x7acd('0x3a')];transfers[_0x3d7e43[_0x7acd('0x3f')]][_0x7acd('0x14')]=utils[_0x7acd('0x15')]();transfers[_0x3d7e43[_0x7acd('0x3f')]][_0x7acd('0x26')]=utils[_0x7acd('0x15')]();transfers[_0x3d7e43[_0x7acd('0x3f')]][_0x7acd('0x23')]=0x0;transfers[_0x3d7e43[_0x7acd('0x3f')]][_0x7acd('0x3b')]=0x2;}}}catch(_0x2963d6){utils[_0x7acd('0x17')](_0x2963d6[_0x7acd('0x18')]);}};exports[_0x7acd('0x41')]=function(_0xb5e315){try{if(agents[_0xb5e315['uniqueid']]&&agents[_0xb5e315[_0x7acd('0x5')]]['reason']===_0x7acd('0x1c')){if(_0xb5e315[_0x7acd('0x42')]==='21'){agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x22')]='rejected';agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x9')]=_0x7acd('0x43');}writeDB(agents[_0xb5e315[_0x7acd('0x5')]]);var _0x5bc8fd=unanswered[_0x7acd('0x44')](_0xb5e315[_0x7acd('0x5')]);if(_0x5bc8fd>-0x1)unanswered['splice'](_0x5bc8fd,0x1);}if(transfers[_0xb5e315[_0x7acd('0x5')]]){transfers[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0xd')]=!![];transfers[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x2c')]=utils[_0x7acd('0x15')]();transfers[_0xb5e315[_0x7acd('0x5')]]['talktime']=utils[_0x7acd('0x45')](transfers[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x2c')],transfers[_0xb5e315[_0x7acd('0x5')]]['agentconnectAt']);transfers[_0xb5e315['uniqueid']][_0x7acd('0x22')]=_0x7acd('0x46');transfers[_0xb5e315[_0x7acd('0x5')]]['lastevent']=_0x7acd('0x2d');writeDB(transfers[_0xb5e315[_0x7acd('0x5')]],!![]);}if(agents[_0xb5e315[_0x7acd('0x5')]]&&agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x26')]){agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0xd')]=!![];agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x2c')]=utils[_0x7acd('0x15')]();agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x24')]=utils[_0x7acd('0x45')](agents[_0xb5e315['uniqueid']]['agentcompleteAt'],agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x26')]);agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x22')]=agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x2f')]?_0x7acd('0x2f'):_0x7acd('0x46');agents[_0xb5e315[_0x7acd('0x5')]][_0x7acd('0x9')]=_0x7acd('0x2d');writeDB(agents[_0xb5e315['uniqueid']]);}}catch(_0x1074a3){utils[_0x7acd('0x17')](_0x1074a3['stack']);}}; \ No newline at end of file +var _0x5f74=['then','type','agentacw','agentcomplete','acwTimeout','request','CreateVoiceAgentReport','uniqueid','agentcalled','destuniqueid','agentcalledAt','now','stack','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','error','forIn','includes','abandoned','talktime','agentconnect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','secondtransfererlinkedid','transfer','secondtransfererexten','transfertargetuniqueid','calleridname','hangup','cause','rejected','indexOf','splice','agent','lodash','util','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x1adf3c,_0x5a29ab){var _0x43917f=function(_0x535d24){while(--_0x535d24){_0x1adf3c['push'](_0x1adf3c['shift']());}};_0x43917f(++_0x5a29ab);}(_0x5f74,0x88));var _0x45f7=function(_0x171d2d,_0x314013){_0x171d2d=_0x171d2d-0x0;var _0xe4140a=_0x5f74[_0x171d2d];return _0xe4140a;};'use strict';var _=require(_0x45f7('0x0'));var util=require(_0x45f7('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a0ce4,_0xfe6880){utils[_0x45f7('0x2')](util['format'](_0x45f7('0x3'),_0x2a0ce4['uniqueid'],_0x2a0ce4['channel'],_0x2a0ce4[_0x45f7('0x4')],_0x2a0ce4[_0x45f7('0x5')],_0x2a0ce4[_0x45f7('0x6')],_0x2a0ce4['calleridnum'],_0x2a0ce4[_0x45f7('0x7')],_0x2a0ce4[_0x45f7('0x8')]));if(_0x2a0ce4[_0x45f7('0x4')]){utils[_0x45f7('0x9')](_0x2a0ce4['queue'])[_0x45f7('0xa')](function(_0x5769cd){if(_0x5769cd){_0x2a0ce4[_0x45f7('0xb')]=_0x5769cd[_0x45f7('0xb')];_0x2a0ce4[_0x45f7('0xc')]=_0x2a0ce4[_0x45f7('0xd')]?_0x5769cd['acw']:![];_0x2a0ce4['acwtime']=_0x2a0ce4[_0x45f7('0xc')]?_0x5769cd[_0x45f7('0xe')]:0x0;}utils[_0x45f7('0xf')](_0x45f7('0x10'),_0x2a0ce4);});}else{utils[_0x45f7('0xf')]('CreateVoiceAgentReport',_0x2a0ce4);}if(_0xfe6880){delete transfers[_0x2a0ce4[_0x45f7('0x11')]];}else{delete agents[_0x2a0ce4['destuniqueid']];}}exports[_0x45f7('0x12')]=function(_0x35601b){try{agents[_0x35601b['destuniqueid']]=_0x35601b;agents[_0x35601b[_0x45f7('0x13')]][_0x45f7('0x14')]=utils[_0x45f7('0x15')]();agents[_0x35601b[_0x45f7('0x13')]]['lastevent']='called';agents[_0x35601b[_0x45f7('0x13')]][_0x45f7('0x7')]=null;agents[_0x35601b[_0x45f7('0x13')]]['connectedlinename']=null;}catch(_0x37d6d0){utils['error'](_0x37d6d0[_0x45f7('0x16')]);}};exports[_0x45f7('0x17')]=function(_0x2b1a18){try{if(!_['isNil'](agents[_0x2b1a18[_0x45f7('0x13')]])){agents[_0x2b1a18[_0x45f7('0x13')]][_0x45f7('0x17')]=!![];agents[_0x2b1a18['destuniqueid']][_0x45f7('0x18')]=utils['now']();agents[_0x2b1a18[_0x45f7('0x13')]]['lastevent']=_0x45f7('0x19');agents[_0x2b1a18[_0x45f7('0x13')]][_0x45f7('0x1a')]='timeout';agents[_0x2b1a18[_0x45f7('0x13')]][_0x45f7('0x1b')]=_0x2b1a18[_0x45f7('0x1c')]?parseInt(_0x2b1a18[_0x45f7('0x1c')])/0x3e8:0x0;agents[_0x2b1a18['destuniqueid']]['talktime']=0x0;unanswered[_0x45f7('0x1d')](_0x2b1a18[_0x45f7('0x13')]);}}catch(_0x397f6b){utils[_0x45f7('0x1e')](_0x397f6b['stack']);}};exports['queuecallerabandon']=function(_0x1a8408){try{_[_0x45f7('0x1f')](agents,function(_0x45390d,_0x528ece){if(_0x45390d[_0x45f7('0x11')]==_0x1a8408[_0x45f7('0x11')]&&!_[_0x45f7('0x20')](unanswered,_0x45390d[_0x45f7('0x13')])){_0x45390d['agentringnoanswer']=!![];_0x45390d['agentringnoanswerAt']=utils['now']();_0x45390d[_0x45f7('0x8')]=_0x45f7('0x21');_0x45390d[_0x45f7('0x1a')]=_0x45f7('0x21');_0x45390d['holdtime']=_0x1a8408[_0x45f7('0x1b')];_0x45390d[_0x45f7('0x22')]=0x0;writeDB(_0x45390d);}});}catch(_0x470a3c){utils[_0x45f7('0x1e')](_0x470a3c[_0x45f7('0x16')]);}};exports[_0x45f7('0x23')]=function(_0x3759a7){try{if(agents[_0x3759a7['destuniqueid']]){agents[_0x3759a7[_0x45f7('0x13')]][_0x45f7('0x24')]=utils['now']();agents[_0x3759a7[_0x45f7('0x13')]][_0x45f7('0x7')]=_0x3759a7[_0x45f7('0x7')];agents[_0x3759a7['destuniqueid']][_0x45f7('0x25')]=_0x3759a7[_0x45f7('0x25')];agents[_0x3759a7[_0x45f7('0x13')]][_0x45f7('0x1b')]=_0x3759a7[_0x45f7('0x1c')];agents[_0x3759a7[_0x45f7('0x13')]][_0x45f7('0x8')]=_0x45f7('0x26');_[_0x45f7('0x1f')](agents,function(_0x3446d5,_0x244a6f){if(_0x3446d5[_0x45f7('0x13')]!=_0x3759a7[_0x45f7('0x13')]&&_0x3446d5[_0x45f7('0x11')]==_0x3759a7[_0x45f7('0x11')]){_0x3446d5[_0x45f7('0x22')]=0x0;_0x3446d5['holdtime']=_0x3759a7[_0x45f7('0x1c')];_0x3446d5[_0x45f7('0x17')]=!![];_0x3446d5['agentringnoanswerAt']=utils[_0x45f7('0x15')]();_0x3446d5[_0x45f7('0x8')]=_0x45f7('0x27');_0x3446d5[_0x45f7('0x1a')]=_0x45f7('0x27');_0x3446d5[_0x45f7('0x28')]=_0x3759a7['destuniqueid'];_0x3446d5[_0x45f7('0x29')]=_0x3759a7[_0x45f7('0x5')];writeDB(_0x3446d5);}});}}catch(_0x3110fd){utils[_0x45f7('0x1e')](_0x3110fd[_0x45f7('0x16')]);}};exports[_0x45f7('0xd')]=function(_0x350165){try{if(!_[_0x45f7('0x2a')](agents[_0x350165['destuniqueid']])){agents[_0x350165[_0x45f7('0x13')]][_0x45f7('0xd')]=!![];agents[_0x350165['destuniqueid']][_0x45f7('0x2b')]=utils[_0x45f7('0x15')]();agents[_0x350165['destuniqueid']][_0x45f7('0x22')]=utils[_0x45f7('0x2c')](agents[_0x350165[_0x45f7('0x13')]][_0x45f7('0x2b')],agents[_0x350165[_0x45f7('0x13')]][_0x45f7('0x24')]);agents[_0x350165[_0x45f7('0x13')]][_0x45f7('0x1a')]=_0x350165[_0x45f7('0x1a')];agents[_0x350165[_0x45f7('0x13')]]['lastevent']=_0x45f7('0x2d');writeDB(agents[_0x350165[_0x45f7('0x13')]]);}}catch(_0x503d03){utils[_0x45f7('0x1e')](_0x503d03['stack']);}};exports[_0x45f7('0x2e')]=function(_0x12748b){try{if(!_[_0x45f7('0x2a')](agents[_0x12748b['transfereruniqueid']])){agents[_0x12748b[_0x45f7('0x2f')]]['transfer']=!![];agents[_0x12748b[_0x45f7('0x2f')]][_0x45f7('0x30')]=_0x45f7('0x31');agents[_0x12748b[_0x45f7('0x2f')]]['transferexten']=_0x12748b[_0x45f7('0x32')];agents[_0x12748b[_0x45f7('0x2f')]][_0x45f7('0x33')]=agents[_0x12748b[_0x45f7('0x2f')]]['uniqueid'];}}catch(_0x33dae7){utils[_0x45f7('0x1e')](_0x33dae7['stack']);}};exports[_0x45f7('0x34')]=function(_0x546eeb){try{if(_0x546eeb[_0x45f7('0x35')]==_0x546eeb[_0x45f7('0x36')]){if(!_['isNil'](agents[_0x546eeb[_0x45f7('0x37')]])){agents[_0x546eeb['secondtransfereruniqueid']]['transfer']=!![];agents[_0x546eeb[_0x45f7('0x37')]][_0x45f7('0x30')]=_0x45f7('0x38');agents[_0x546eeb[_0x45f7('0x37')]][_0x45f7('0x39')]=_0x546eeb['origtransfererexten'];agents[_0x546eeb['secondtransfereruniqueid']][_0x45f7('0x33')]=_0x546eeb['origtransfereruniqueid'];}if(_0x546eeb['transfereeuniqueid']&&agents[_0x546eeb['transfereeuniqueid']]){agents[_0x546eeb[_0x45f7('0x3a')]][_0x45f7('0x3b')]=0x1;transfers[_0x546eeb['transfereeuniqueid']]=_[_0x45f7('0x3c')](agents[_0x546eeb[_0x45f7('0x3a')]]);transfers[_0x546eeb[_0x45f7('0x3a')]][_0x45f7('0x3d')]=agents[_0x546eeb['secondtransfereruniqueid']][_0x45f7('0x3d')];transfers[_0x546eeb[_0x45f7('0x3a')]]['calleridname']=agents[_0x546eeb['secondtransfereruniqueid']]['calleridname'];transfers[_0x546eeb[_0x45f7('0x3a')]]['agentcalledAt']=utils['now']();transfers[_0x546eeb[_0x45f7('0x3a')]][_0x45f7('0x24')]=utils[_0x45f7('0x15')]();transfers[_0x546eeb[_0x45f7('0x3a')]][_0x45f7('0x1b')]=0x0;transfers[_0x546eeb['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x546eeb[_0x45f7('0x37')]==_0x546eeb[_0x45f7('0x3e')]){if(!_[_0x45f7('0x2a')](agents[_0x546eeb['origtransfereruniqueid']])){agents[_0x546eeb[_0x45f7('0x35')]][_0x45f7('0x3f')]=!![];agents[_0x546eeb[_0x45f7('0x35')]][_0x45f7('0x30')]=_0x45f7('0x38');agents[_0x546eeb[_0x45f7('0x35')]][_0x45f7('0x39')]=_0x546eeb[_0x45f7('0x40')];agents[_0x546eeb[_0x45f7('0x35')]][_0x45f7('0x33')]=_0x546eeb[_0x45f7('0x37')];}if(_0x546eeb[_0x45f7('0x41')]&&agents[_0x546eeb[_0x45f7('0x41')]]){agents[_0x546eeb[_0x45f7('0x41')]][_0x45f7('0x3b')]=0x1;transfers[_0x546eeb[_0x45f7('0x41')]]=_['clone'](agents[_0x546eeb['transfertargetuniqueid']]);transfers[_0x546eeb[_0x45f7('0x41')]][_0x45f7('0x3d')]=agents[_0x546eeb[_0x45f7('0x35')]][_0x45f7('0x3d')];transfers[_0x546eeb[_0x45f7('0x41')]][_0x45f7('0x42')]=agents[_0x546eeb['origtransfereruniqueid']]['calleridname'];transfers[_0x546eeb[_0x45f7('0x41')]][_0x45f7('0x14')]=utils[_0x45f7('0x15')]();transfers[_0x546eeb['transfertargetuniqueid']][_0x45f7('0x24')]=utils[_0x45f7('0x15')]();transfers[_0x546eeb[_0x45f7('0x41')]][_0x45f7('0x1b')]=0x0;transfers[_0x546eeb[_0x45f7('0x41')]][_0x45f7('0x3b')]=0x2;}}}catch(_0x1ff05c){utils['error'](_0x1ff05c[_0x45f7('0x16')]);}};exports[_0x45f7('0x43')]=function(_0x4f4e2a){try{if(agents[_0x4f4e2a[_0x45f7('0x11')]]&&agents[_0x4f4e2a[_0x45f7('0x11')]]['reason']===_0x45f7('0x19')){if(_0x4f4e2a[_0x45f7('0x44')]==='21'){agents[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x1a')]=_0x45f7('0x45');agents[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x8')]=_0x45f7('0x45');}writeDB(agents[_0x4f4e2a[_0x45f7('0x11')]]);var _0x3a8e65=unanswered[_0x45f7('0x46')](_0x4f4e2a[_0x45f7('0x11')]);if(_0x3a8e65>-0x1)unanswered[_0x45f7('0x47')](_0x3a8e65,0x1);}if(transfers[_0x4f4e2a[_0x45f7('0x11')]]){transfers[_0x4f4e2a[_0x45f7('0x11')]]['agentcomplete']=!![];transfers[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x2b')]=utils[_0x45f7('0x15')]();transfers[_0x4f4e2a['uniqueid']][_0x45f7('0x22')]=utils[_0x45f7('0x2c')](transfers[_0x4f4e2a['uniqueid']][_0x45f7('0x2b')],transfers[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x24')]);transfers[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x1a')]=_0x45f7('0x48');transfers[_0x4f4e2a[_0x45f7('0x11')]]['lastevent']='complete';writeDB(transfers[_0x4f4e2a[_0x45f7('0x11')]],!![]);}if(agents[_0x4f4e2a[_0x45f7('0x11')]]&&agents[_0x4f4e2a[_0x45f7('0x11')]]['agentconnectAt']){agents[_0x4f4e2a[_0x45f7('0x11')]]['agentcomplete']=!![];agents[_0x4f4e2a[_0x45f7('0x11')]]['agentcompleteAt']=utils['now']();agents[_0x4f4e2a['uniqueid']]['talktime']=utils['diffTime'](agents[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x2b')],agents[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x24')]);agents[_0x4f4e2a[_0x45f7('0x11')]][_0x45f7('0x1a')]=agents[_0x4f4e2a['uniqueid']][_0x45f7('0x3f')]?'transfer':_0x45f7('0x48');agents[_0x4f4e2a['uniqueid']][_0x45f7('0x8')]=_0x45f7('0x2d');writeDB(agents[_0x4f4e2a[_0x45f7('0x11')]]);}}catch(_0x22452e){utils[_0x45f7('0x1e')](_0x22452e[_0x45f7('0x16')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a45b3ef..3f65b10 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 _0xd635=['_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-originatecalleridnum','source','value','\x22\x20<','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif','application','lodash','util','./utils','FAILED','NO\x20ANSWER','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','destination','callerid','disposition','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','error','stack','newstate','isNil','channelstate','transfer','destinationchannel','answertime','toNumber','calleridname','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield'];(function(_0x4539dd,_0x39c682){var _0x1d509a=function(_0x39af78){while(--_0x39af78){_0x4539dd['push'](_0x4539dd['shift']());}};_0x1d509a(++_0x39c682);}(_0xd635,0x104));var _0x5d63=function(_0x4a67b4,_0x3baecc){_0x4a67b4=_0x4a67b4-0x0;var _0x2b4e0d=_0xd635[_0x4a67b4];return _0x2b4e0d;};'use strict';var _=require(_0x5d63('0x0'));var util=require(_0x5d63('0x1'));var utils=require(_0x5d63('0x2'));var dispositions=['NO\x20ANSWER',_0x5d63('0x3'),'FAILED',_0x5d63('0x4'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED','BUSY','FAILED',_0x5d63('0x3'),_0x5d63('0x3')];var channels={};function writeDB(_0x227aa0){utils['info'](util['format'](_0x5d63('0x5'),_0x227aa0[_0x5d63('0x6')],_0x227aa0[_0x5d63('0x7')],_0x227aa0['type'],_0x227aa0['accountcode'],_0x227aa0['source'],_0x227aa0[_0x5d63('0x8')],_0x227aa0[_0x5d63('0x9')],_0x227aa0[_0x5d63('0xa')]));if(_0x227aa0[_0x5d63('0xb')]){utils[_0x5d63('0xc')](_0x227aa0[_0x5d63('0xb')])['then'](function(_0x4f17ba){if(_0x4f17ba){_0x227aa0[_0x5d63('0xd')]=_0x4f17ba['id'];}utils[_0x5d63('0xe')](_0x5d63('0xf'),_0x227aa0);});}else{utils[_0x5d63('0xe')](_0x5d63('0xf'),_0x227aa0);}if(channels[_0x227aa0['uniqueid']]){delete channels[_0x227aa0[_0x5d63('0x6')]];}}exports[_0x5d63('0x10')]=function(_0x5d6bbd){try{if(_0x5d6bbd[_0x5d63('0x6')]==_0x5d6bbd[_0x5d63('0x11')]&&_0x5d6bbd[_0x5d63('0x7')]!=_0x5d63('0x12')){channels[_0x5d6bbd[_0x5d63('0x6')]]={'uniqueid':_0x5d6bbd[_0x5d63('0x6')],'accountcode':_0x5d6bbd[_0x5d63('0xb')],'source':_0x5d6bbd[_0x5d63('0x13')],'destination':_0x5d6bbd['exten'],'destinationcontext':_0x5d6bbd[_0x5d63('0x14')],'channel':_0x5d6bbd[_0x5d63('0x7')],'starttime':utils[_0x5d63('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5d63('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x212187){utils[_0x5d63('0x16')](_0x212187[_0x5d63('0x17')]);}};exports[_0x5d63('0x18')]=function(_0x66b796){try{if(!_[_0x5d63('0x19')](channels[_0x66b796[_0x5d63('0x6')]])&&_0x66b796[_0x5d63('0x1a')]==0x6){if(_[_0x5d63('0x19')](channels[_0x66b796[_0x5d63('0x6')]]['systemanswertime'])){channels[_0x66b796['uniqueid']]['systemanswertime']=utils[_0x5d63('0x15')]();}}else if(!_[_0x5d63('0x19')](channels[_0x66b796[_0x5d63('0x11')]])&&_0x66b796[_0x5d63('0x1a')]==0x6&&_0x66b796['context']!=_0x5d63('0x1b')){channels[_0x66b796[_0x5d63('0x11')]][_0x5d63('0xb')]=_0x66b796[_0x5d63('0xb')];channels[_0x66b796['linkedid']][_0x5d63('0x1c')]=_0x66b796[_0x5d63('0x7')];if(_[_0x5d63('0x19')](channels[_0x66b796['linkedid']]['answertime'])){channels[_0x66b796[_0x5d63('0x11')]][_0x5d63('0x1d')]=utils[_0x5d63('0x15')]();}channels[_0x66b796['linkedid']][_0x5d63('0xa')]=dispositions[_[_0x5d63('0x1e')](_0x66b796['channelstate'])]||'ANSWERED';}}catch(_0x3fdcde){utils[_0x5d63('0x16')](_0x3fdcde[_0x5d63('0x17')]);}};exports['hangup']=function(_0x3a3563){try{if(!_[_0x5d63('0x19')](channels[_0x3a3563[_0x5d63('0x6')]])){if(_[_0x5d63('0x19')](channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x9')])){channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x9')]=_0x3a3563[_0x5d63('0x1f')]+'\x20<'+_0x3a3563[_0x5d63('0x13')]+'>';}channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x20')]=utils[_0x5d63('0x15')]();channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x21')]=utils[_0x5d63('0x22')](channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x20')],channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x23')]);channels[_0x3a3563[_0x5d63('0x6')]]['billableseconds']=channels[_0x3a3563['uniqueid']][_0x5d63('0x1d')]?utils[_0x5d63('0x22')](channels[_0x3a3563[_0x5d63('0x6')]]['endtime'],channels[_0x3a3563[_0x5d63('0x6')]][_0x5d63('0x1d')]):0x0;writeDB(channels[_0x3a3563[_0x5d63('0x6')]]);}}catch(_0x45c04f){utils[_0x5d63('0x16')](_0x45c04f[_0x5d63('0x17')]);}};exports[_0x5d63('0x24')]=function(_0x14454c){try{if(!_[_0x5d63('0x19')](channels[_0x14454c['localtwolinkedid']])){if(channels[_0x14454c[_0x5d63('0x25')]][_0x5d63('0x7')]==_0x14454c['transfereechannel']){channels[_0x14454c[_0x5d63('0x25')]]['destinationchannel']=_0x14454c[_0x5d63('0x26')];channels[_0x14454c[_0x5d63('0x25')]][_0x5d63('0x27')]=_0x5d63('0x28');}else if(channels[_0x14454c[_0x5d63('0x25')]][_0x5d63('0x7')]=_0x14454c['transfertargetchannel']){channels[_0x14454c['localtwolinkedid']]['destinationchannel']=_0x14454c[_0x5d63('0x29')];channels[_0x14454c['localtwolinkedid']]['userfield']=_0x5d63('0x28');}}}catch(_0x4e7361){utils[_0x5d63('0x16')](_0x4e7361[_0x5d63('0x17')]);}};exports[_0x5d63('0x2a')]=function(_0x36cbdc){try{if(!_[_0x5d63('0x19')](channels[_0x36cbdc['uniqueid']])){channels[_0x36cbdc[_0x5d63('0x6')]][_0x5d63('0x2b')]=utils[_0x5d63('0x15')]();}}catch(_0x1c3462){utils[_0x5d63('0x16')](_0x1c3462['stack']);}};exports[_0x5d63('0x2c')]=function(_0x5f371b){try{if(!_[_0x5d63('0x19')](channels[_0x5f371b[_0x5d63('0x6')]])){if(!_[_0x5d63('0x19')](channels[_0x5f371b['uniqueid']]['musiconholdstartAt'])){channels[_0x5f371b['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x5d63('0x15')](),channels[_0x5f371b[_0x5d63('0x6')]][_0x5d63('0x2b')]);delete channels[_0x5f371b[_0x5d63('0x6')]]['musiconholdstartAt'];}}}catch(_0x53305b){utils['error'](_0x53305b[_0x5d63('0x17')]);}};exports[_0x5d63('0x2d')]=function(_0x303734){try{if(!_[_0x5d63('0x19')](channels[_0x303734['uniqueid']])){if(!_['isNil'](_0x303734[_0x5d63('0x2e')][_0x5d63('0x2f')])){channels[_0x303734[_0x5d63('0x6')]][_0x5d63('0x30')]=_0x303734[_0x5d63('0x31')];}if(!_[_0x5d63('0x19')](_0x303734[_0x5d63('0x2e')]['xmd-phone'])){channels[_0x303734['uniqueid']][_0x5d63('0x8')]=_0x303734['value'];channels[_0x303734[_0x5d63('0x6')]][_0x5d63('0x9')]='\x22'+_0x303734[_0x5d63('0x31')]+_0x5d63('0x32')+_0x303734[_0x5d63('0x31')]+'>';}if(!_['isNil'](_0x303734[_0x5d63('0x2e')]['xmd-callerid-preview'])||!_[_0x5d63('0x19')](_0x303734[_0x5d63('0x2e')]['xmd-callerid'])){channels[_0x303734['uniqueid']][_0x5d63('0x9')]=_0x303734[_0x5d63('0x31')];}if(!_[_0x5d63('0x19')](_0x303734[_0x5d63('0x2e')][_0x5d63('0x33')])||!_[_0x5d63('0x19')](_0x303734[_0x5d63('0x2e')][_0x5d63('0x34')])){channels[_0x303734['uniqueid']][_0x5d63('0x35')]=_0x5d63('0x36');channels[_0x303734[_0x5d63('0x6')]][_0x5d63('0x37')]=_0x303734['value'];channels[_0x303734['uniqueid']]['queue']=!![];}if(!_[_0x5d63('0x19')](_0x303734[_0x5d63('0x2e')][_0x5d63('0x38')])){channels[_0x303734[_0x5d63('0x6')]]['ContactId']=_0x303734[_0x5d63('0x31')];}if(!_[_0x5d63('0x19')](_0x303734['variable'][_0x5d63('0x39')])){channels[_0x303734[_0x5d63('0x6')]][_0x5d63('0x3a')]=_0x303734[_0x5d63('0x31')];}if(!_[_0x5d63('0x19')](_0x303734['variable'][_0x5d63('0x3b')])){channels[_0x303734[_0x5d63('0x6')]][_0x5d63('0x3c')]=_0x303734['value'];}if(!_['isNil'](_0x303734['variable'][_0x5d63('0x3d')])){channels[_0x303734[_0x5d63('0x6')]]['sipcallid']=_0x303734[_0x5d63('0x31')];}}}catch(_0x230588){utils[_0x5d63('0x16')](_0x230588[_0x5d63('0x17')]);}};exports[_0x5d63('0x3e')]=function(_0x57c600){try{if(!_[_0x5d63('0x19')](channels[_0x57c600['uniqueid']])){if(_0x57c600['application'][_0x5d63('0x3f')]()=='set'&&_[_0x5d63('0x40')](_0x57c600[_0x5d63('0x41')][_0x5d63('0x3f')](),_0x5d63('0x42'))){var _0x22058e=_0x57c600['appdata'][_0x5d63('0x43')]('=');var _0x4da250=_0x22058e[0x0][_0x5d63('0x44')](_0x22058e[0x0]['lastIndexOf']('(')+0x1,_0x22058e[0x0][_0x5d63('0x45')](')'));var _0x47a63a=_0x22058e[0x1];channels[_0x57c600[_0x5d63('0x6')]][_0x4da250]=_0x47a63a;}if(!_['includes']([_0x5d63('0x46'),_0x5d63('0x47'),_0x5d63('0x48'),'set',_0x5d63('0x49')],_0x57c600[_0x5d63('0x4a')][_0x5d63('0x3f')]())){channels[_0x57c600[_0x5d63('0x6')]][_0x5d63('0x35')]=_0x57c600[_0x5d63('0x4a')];channels[_0x57c600[_0x5d63('0x6')]][_0x5d63('0x37')]=_0x57c600[_0x5d63('0x41')];}}}catch(_0x12633b){utils[_0x5d63('0x16')](_0x12633b[_0x5d63('0x17')]);}}; \ No newline at end of file +var _0x28a8=['xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','newexten','application','toLowerCase','appdata','split','substring','lastIndexOf','set','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','type','accountcode','source','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','channel','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','stack','isNil','channelstate','systemanswertime','linkedid','destinationchannel','answertime','hangup','calleridname','duration','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstop','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','variable','xmd-phone','value','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','queue'];(function(_0x579392,_0x57c9a0){var _0x1ad281=function(_0x551b79){while(--_0x551b79){_0x579392['push'](_0x579392['shift']());}};_0x1ad281(++_0x57c9a0);}(_0x28a8,0x1c9));var _0x828a=function(_0x117576,_0x1ced1a){_0x117576=_0x117576-0x0;var _0x4533f5=_0x28a8[_0x117576];return _0x4533f5;};'use strict';var _=require(_0x828a('0x0'));var util=require('util');var utils=require(_0x828a('0x1'));var dispositions=[_0x828a('0x2'),_0x828a('0x3'),'FAILED',_0x828a('0x2'),_0x828a('0x2'),_0x828a('0x2'),_0x828a('0x4'),'BUSY',_0x828a('0x3'),_0x828a('0x3'),'FAILED'];var channels={};function writeDB(_0x3be973){utils[_0x828a('0x5')](util[_0x828a('0x6')](_0x828a('0x7'),_0x3be973[_0x828a('0x8')],_0x3be973['channel'],_0x3be973[_0x828a('0x9')],_0x3be973[_0x828a('0xa')],_0x3be973[_0x828a('0xb')],_0x3be973['destination'],_0x3be973[_0x828a('0xc')],_0x3be973[_0x828a('0xd')]));if(_0x3be973[_0x828a('0xa')]){utils[_0x828a('0xe')](_0x3be973[_0x828a('0xa')])[_0x828a('0xf')](function(_0x24a5c3){if(_0x24a5c3){_0x3be973[_0x828a('0x10')]=_0x24a5c3['id'];}utils[_0x828a('0x11')](_0x828a('0x12'),_0x3be973);});}else{utils[_0x828a('0x11')]('CreateVoiceCallReport',_0x3be973);}if(channels[_0x3be973['uniqueid']]){delete channels[_0x3be973['uniqueid']];}}exports['newchannel']=function(_0x45e13a){try{if(_0x45e13a[_0x828a('0x8')]==_0x45e13a['linkedid']&&_0x45e13a[_0x828a('0x13')]!=_0x828a('0x14')){channels[_0x45e13a[_0x828a('0x8')]]={'uniqueid':_0x45e13a['uniqueid'],'accountcode':_0x45e13a[_0x828a('0xa')],'source':_0x45e13a['calleridnum'],'destination':_0x45e13a[_0x828a('0x15')],'destinationcontext':_0x45e13a[_0x828a('0x16')],'channel':_0x45e13a[_0x828a('0x13')],'starttime':utils[_0x828a('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x828a('0x2'),'amaflags':_0x828a('0x18')};}}catch(_0x599fe5){utils[_0x828a('0x19')](_0x599fe5[_0x828a('0x1a')]);}};exports['newstate']=function(_0x30425a){try{if(!_[_0x828a('0x1b')](channels[_0x30425a[_0x828a('0x8')]])&&_0x30425a[_0x828a('0x1c')]==0x6){if(_[_0x828a('0x1b')](channels[_0x30425a[_0x828a('0x8')]][_0x828a('0x1d')])){channels[_0x30425a[_0x828a('0x8')]]['systemanswertime']=utils[_0x828a('0x17')]();}}else if(!_[_0x828a('0x1b')](channels[_0x30425a[_0x828a('0x1e')]])&&_0x30425a[_0x828a('0x1c')]==0x6&&_0x30425a['context']!='transfer'){channels[_0x30425a[_0x828a('0x1e')]][_0x828a('0xa')]=_0x30425a[_0x828a('0xa')];channels[_0x30425a[_0x828a('0x1e')]][_0x828a('0x1f')]=_0x30425a['channel'];if(_[_0x828a('0x1b')](channels[_0x30425a[_0x828a('0x1e')]][_0x828a('0x20')])){channels[_0x30425a[_0x828a('0x1e')]][_0x828a('0x20')]=utils[_0x828a('0x17')]();}channels[_0x30425a['linkedid']][_0x828a('0xd')]=dispositions[_['toNumber'](_0x30425a[_0x828a('0x1c')])]||_0x828a('0x4');}}catch(_0x574cd1){utils[_0x828a('0x19')](_0x574cd1[_0x828a('0x1a')]);}};exports[_0x828a('0x21')]=function(_0x2c8ac7){try{if(!_[_0x828a('0x1b')](channels[_0x2c8ac7[_0x828a('0x8')]])){if(_['isNil'](channels[_0x2c8ac7[_0x828a('0x8')]][_0x828a('0xc')])){channels[_0x2c8ac7[_0x828a('0x8')]][_0x828a('0xc')]=_0x2c8ac7[_0x828a('0x22')]+'\x20<'+_0x2c8ac7['calleridnum']+'>';}channels[_0x2c8ac7[_0x828a('0x8')]]['endtime']=utils[_0x828a('0x17')]();channels[_0x2c8ac7[_0x828a('0x8')]][_0x828a('0x23')]=utils[_0x828a('0x24')](channels[_0x2c8ac7[_0x828a('0x8')]][_0x828a('0x25')],channels[_0x2c8ac7['uniqueid']][_0x828a('0x26')]);channels[_0x2c8ac7[_0x828a('0x8')]]['billableseconds']=channels[_0x2c8ac7[_0x828a('0x8')]]['answertime']?utils[_0x828a('0x24')](channels[_0x2c8ac7['uniqueid']]['endtime'],channels[_0x2c8ac7[_0x828a('0x8')]][_0x828a('0x20')]):0x0;writeDB(channels[_0x2c8ac7[_0x828a('0x8')]]);}}catch(_0x1e5d62){utils[_0x828a('0x19')](_0x1e5d62[_0x828a('0x1a')]);}};exports[_0x828a('0x27')]=function(_0x4a7331){try{if(!_[_0x828a('0x1b')](channels[_0x4a7331[_0x828a('0x28')]])){if(channels[_0x4a7331['localtwolinkedid']][_0x828a('0x13')]==_0x4a7331[_0x828a('0x29')]){channels[_0x4a7331[_0x828a('0x28')]][_0x828a('0x1f')]=_0x4a7331[_0x828a('0x2a')];channels[_0x4a7331[_0x828a('0x28')]][_0x828a('0x2b')]=_0x828a('0x2c');}else if(channels[_0x4a7331[_0x828a('0x28')]][_0x828a('0x13')]=_0x4a7331['transfertargetchannel']){channels[_0x4a7331[_0x828a('0x28')]]['destinationchannel']=_0x4a7331[_0x828a('0x2d')];channels[_0x4a7331[_0x828a('0x28')]][_0x828a('0x2b')]=_0x828a('0x2c');}}}catch(_0x2bcb4b){utils[_0x828a('0x19')](_0x2bcb4b['stack']);}};exports[_0x828a('0x2e')]=function(_0x2aa04d){try{if(!_[_0x828a('0x1b')](channels[_0x2aa04d[_0x828a('0x8')]])){channels[_0x2aa04d['uniqueid']]['musiconholdstartAt']=utils[_0x828a('0x17')]();}}catch(_0xabf6cc){utils['error'](_0xabf6cc[_0x828a('0x1a')]);}};exports[_0x828a('0x2f')]=function(_0x1c18d8){try{if(!_[_0x828a('0x1b')](channels[_0x1c18d8[_0x828a('0x8')]])){if(!_[_0x828a('0x1b')](channels[_0x1c18d8[_0x828a('0x8')]][_0x828a('0x30')])){channels[_0x1c18d8['uniqueid']][_0x828a('0x31')]+=utils[_0x828a('0x24')](utils[_0x828a('0x17')](),channels[_0x1c18d8[_0x828a('0x8')]]['musiconholdstartAt']);delete channels[_0x1c18d8[_0x828a('0x8')]]['musiconholdstartAt'];}}}catch(_0x364c3c){utils['error'](_0x364c3c[_0x828a('0x1a')]);}};exports[_0x828a('0x32')]=function(_0x5d5674){try{if(!_['isNil'](channels[_0x5d5674[_0x828a('0x8')]])){if(!_['isNil'](_0x5d5674['variable'][_0x828a('0x33')])){channels[_0x5d5674[_0x828a('0x8')]][_0x828a('0xb')]=_0x5d5674['value'];}if(!_[_0x828a('0x1b')](_0x5d5674[_0x828a('0x34')][_0x828a('0x35')])){channels[_0x5d5674[_0x828a('0x8')]]['destination']=_0x5d5674[_0x828a('0x36')];channels[_0x5d5674['uniqueid']][_0x828a('0xc')]='\x22'+_0x5d5674[_0x828a('0x36')]+'\x22\x20<'+_0x5d5674[_0x828a('0x36')]+'>';}if(!_[_0x828a('0x1b')](_0x5d5674[_0x828a('0x34')][_0x828a('0x37')])||!_[_0x828a('0x1b')](_0x5d5674[_0x828a('0x34')]['xmd-callerid'])){channels[_0x5d5674['uniqueid']]['callerid']=_0x5d5674[_0x828a('0x36')];}if(!_[_0x828a('0x1b')](_0x5d5674['variable'][_0x828a('0x38')])||!_[_0x828a('0x1b')](_0x5d5674[_0x828a('0x34')][_0x828a('0x39')])){channels[_0x5d5674[_0x828a('0x8')]]['lastapplication']=_0x828a('0x3a');channels[_0x5d5674[_0x828a('0x8')]][_0x828a('0x3b')]=_0x5d5674[_0x828a('0x36')];channels[_0x5d5674['uniqueid']][_0x828a('0x3c')]=!![];}if(!_[_0x828a('0x1b')](_0x5d5674[_0x828a('0x34')][_0x828a('0x3d')])){channels[_0x5d5674[_0x828a('0x8')]][_0x828a('0x3e')]=_0x5d5674[_0x828a('0x36')];}if(!_[_0x828a('0x1b')](_0x5d5674[_0x828a('0x34')][_0x828a('0x3f')])){channels[_0x5d5674['uniqueid']]['type']=_0x5d5674['value'];}if(!_[_0x828a('0x1b')](_0x5d5674['variable'][_0x828a('0x40')])){channels[_0x5d5674[_0x828a('0x8')]]['routeid']=_0x5d5674[_0x828a('0x36')];}if(!_[_0x828a('0x1b')](_0x5d5674['variable'][_0x828a('0x41')])){channels[_0x5d5674['uniqueid']][_0x828a('0x41')]=_0x5d5674[_0x828a('0x36')];}}}catch(_0x534ba2){utils['error'](_0x534ba2[_0x828a('0x1a')]);}};exports[_0x828a('0x42')]=function(_0x43ae15){try{if(!_['isNil'](channels[_0x43ae15[_0x828a('0x8')]])){if(_0x43ae15[_0x828a('0x43')][_0x828a('0x44')]()=='set'&&_['startsWith'](_0x43ae15[_0x828a('0x45')][_0x828a('0x44')](),'cdr')){var _0x366801=_0x43ae15[_0x828a('0x45')][_0x828a('0x46')]('=');var _0x42d3e6=_0x366801[0x0][_0x828a('0x47')](_0x366801[0x0]['lastIndexOf']('(')+0x1,_0x366801[0x0][_0x828a('0x48')](')'));var _0x324035=_0x366801[0x1];channels[_0x43ae15[_0x828a('0x8')]][_0x42d3e6]=_0x324035;}if(!_['includes']([_0x828a('0x21'),'noop','execif',_0x828a('0x49'),'gotoif'],_0x43ae15[_0x828a('0x43')][_0x828a('0x44')]())){channels[_0x43ae15[_0x828a('0x8')]]['lastapplication']=_0x43ae15['application'];channels[_0x43ae15[_0x828a('0x8')]][_0x828a('0x3b')]=_0x43ae15[_0x828a('0x45')];}}}catch(_0x2036d4){utils[_0x828a('0x19')](_0x2036d4[_0x828a('0x1a')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 04af2ec..ec9e42e 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 _0xd8fb=['./utils','lodash','connect','info','SHUTDOWN','fullybooted','FULLYBOOTED','error','managerevent'];(function(_0x77759c,_0x5dd020){var _0x2b71dd=function(_0x4a8e51){while(--_0x4a8e51){_0x77759c['push'](_0x77759c['shift']());}};_0x2b71dd(++_0x5dd020);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1d899b,_0x3cd7de){_0x1d899b=_0x1d899b-0x0;var _0x2fb980=_0xd8fb[_0x1d899b];return _0x2fb980;};'use strict';var utils=require(_0xbd8f('0x0'));var _=require(_0xbd8f('0x1'));exports[_0xbd8f('0x2')]=function(){utils[_0xbd8f('0x3')]('CONNECTED');};exports['shutdown']=function(){utils['info'](_0xbd8f('0x4'));};exports[_0xbd8f('0x5')]=function(){utils['info'](_0xbd8f('0x6'));};exports[_0xbd8f('0x7')]=function(_0x5543b2){utils[_0xbd8f('0x7')](_0x5543b2);};exports['close']=function(){utils[_0xbd8f('0x3')]('CLOSE');};exports[_0xbd8f('0x8')]=function(_0x403edc){}; \ No newline at end of file +var _0x4975=['CLOSE','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error'];(function(_0x556006,_0x2ac722){var _0x45c3a6=function(_0x20524f){while(--_0x20524f){_0x556006['push'](_0x556006['shift']());}};_0x45c3a6(++_0x2ac722);}(_0x4975,0x86));var _0x5497=function(_0x2a7b36,_0x577ad8){_0x2a7b36=_0x2a7b36-0x0;var _0x2c3a03=_0x4975[_0x2a7b36];return _0x2c3a03;};'use strict';var utils=require(_0x5497('0x0'));var _=require('lodash');exports[_0x5497('0x1')]=function(){utils[_0x5497('0x2')](_0x5497('0x3'));};exports[_0x5497('0x4')]=function(){utils[_0x5497('0x2')](_0x5497('0x5'));};exports[_0x5497('0x6')]=function(){utils[_0x5497('0x2')](_0x5497('0x7'));};exports[_0x5497('0x8')]=function(_0x539a27){utils[_0x5497('0x8')](_0x539a27);};exports['close']=function(){utils[_0x5497('0x2')](_0x5497('0x9'));};exports[_0x5497('0xa')]=function(_0x57f930){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 767f9de..396a5d1 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 _0xb65a=['dialbegin','assign','starttime','lastevent','called','answertime','connect','hangup','duration','holdtime','diffTime','endtime','lodash','info','format','channel','dialstring','calleridnum','dialstatus','newexten','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','uniqueid','stack','isNil','variable','outboundrouteid','value','error'];(function(_0x12ceca,_0x31c655){var _0x463ad1=function(_0x301ceb){while(--_0x301ceb){_0x12ceca['push'](_0x12ceca['shift']());}};_0x463ad1(++_0x31c655);}(_0xb65a,0x114));var _0xab65=function(_0x1d2d35,_0x35fd43){_0x1d2d35=_0x1d2d35-0x0;var _0xa9589e=_0xb65a[_0x1d2d35];return _0xa9589e;};'use strict';var _=require(_0xab65('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x2e73d5){utils[_0xab65('0x1')](util[_0xab65('0x2')]('DIAL|%s|%s|%s|%s|%s|%s',_0x2e73d5['uniqueid'],_0x2e73d5[_0xab65('0x3')],_0x2e73d5[_0xab65('0x4')],_0x2e73d5[_0xab65('0x5')],_0x2e73d5['connectedlinenum'],_0x2e73d5[_0xab65('0x6')]));utils['request']('CreateVoiceDialReport',_0x2e73d5);delete dials[_0x2e73d5['uniqueid']];}exports[_0xab65('0x7')]=function(_0x2c3f48){try{if(_0x2c3f48[_0xab65('0x8')][_0xab65('0x9')]()=='set'&&_[_0xab65('0xa')](_0x2c3f48[_0xab65('0xb')][_0xab65('0x9')](),_0xab65('0xc'))){var _0x3cb67c=_0x2c3f48[_0xab65('0xb')][_0xab65('0xd')]('=');dials[_0x2c3f48[_0xab65('0xe')]]={'routeId':_0x3cb67c[0x1]};}}catch(_0xc16590){utils['error'](_0xc16590[_0xab65('0xf')]);}};exports['varset']=function(_0xa3cc07){try{if(!_[_0xab65('0x10')](_0xa3cc07[_0xab65('0x11')][_0xab65('0x12')])){dials[_0xa3cc07[_0xab65('0xe')]]={'routeId':_0xa3cc07[_0xab65('0x13')]};}}catch(_0x9c5797){utils[_0xab65('0x14')](_0x9c5797[_0xab65('0xf')]);}};exports[_0xab65('0x15')]=function(_0x13167b){try{if(!_[_0xab65('0x10')](dials[_0x13167b[_0xab65('0xe')]])){dials[_0x13167b[_0xab65('0xe')]]=_[_0xab65('0x16')](dials[_0x13167b[_0xab65('0xe')]],_0x13167b);dials[_0x13167b['uniqueid']][_0xab65('0x17')]=utils['now']();dials[_0x13167b[_0xab65('0xe')]][_0xab65('0x18')]=_0xab65('0x19');}}catch(_0x325ed7){utils[_0xab65('0x14')](_0x325ed7['stack']);}};exports['dialend']=function(_0x404339){try{if(!_[_0xab65('0x10')](dials[_0x404339['uniqueid']])){dials[_0x404339[_0xab65('0xe')]][_0xab65('0x6')]=_0x404339['dialstatus'];if(_0x404339[_0xab65('0x6')]=='ANSWER'){dials[_0x404339['uniqueid']]=_[_0xab65('0x16')](dials[_0x404339['uniqueid']],_0x404339);dials[_0x404339[_0xab65('0xe')]][_0xab65('0x1a')]=utils['now']();dials[_0x404339['uniqueid']]['lastevent']=_0xab65('0x1b');}}}catch(_0x3d4ea6){utils[_0xab65('0x14')](_0x3d4ea6['stack']);}};exports[_0xab65('0x1c')]=function(_0xce4276){try{if(!_['isNil'](dials[_0xce4276[_0xab65('0xe')]])){dials[_0xce4276[_0xab65('0xe')]]=_['assign'](dials[_0xce4276['uniqueid']],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0xce4276[_0xab65('0xe')]][_0xab65('0x1d')]=utils['diffTime'](dials[_0xce4276[_0xab65('0xe')]]['endtime'],dials[_0xce4276[_0xab65('0xe')]]['starttime']);dials[_0xce4276[_0xab65('0xe')]][_0xab65('0x1e')]=utils[_0xab65('0x1f')](dials[_0xce4276[_0xab65('0xe')]]['answertime']||dials[_0xce4276['uniqueid']][_0xab65('0x20')],dials[_0xce4276[_0xab65('0xe')]][_0xab65('0x17')]);dials[_0xce4276[_0xab65('0xe')]]['billableseconds']=dials[_0xce4276[_0xab65('0xe')]][_0xab65('0x1a')]?utils['diffTime'](dials[_0xce4276[_0xab65('0xe')]][_0xab65('0x20')],dials[_0xce4276[_0xab65('0xe')]][_0xab65('0x1a')]):0x0;writeDB(dials[_0xce4276['uniqueid']]);}}catch(_0x4e9d11){utils[_0xab65('0x14')](_0x4e9d11['stack']);}}; \ No newline at end of file +var _0x9ea8=['diffTime','endtime','holdtime','util','./utils','info','format','uniqueid','dialstring','dialstatus','request','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','dialend','answertime','connect','hangup','complete','duration'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9ea8,0x147));var _0x89ea=function(_0x1ccc19,_0x2a5e47){_0x1ccc19=_0x1ccc19-0x0;var _0x393065=_0x9ea8[_0x1ccc19];return _0x393065;};'use strict';var _=require('lodash');var util=require(_0x89ea('0x0'));var utils=require(_0x89ea('0x1'));var dials={};function writeDB(_0x3f92ff){utils[_0x89ea('0x2')](util[_0x89ea('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x3f92ff[_0x89ea('0x4')],_0x3f92ff['channel'],_0x3f92ff[_0x89ea('0x5')],_0x3f92ff['calleridnum'],_0x3f92ff['connectedlinenum'],_0x3f92ff[_0x89ea('0x6')]));utils[_0x89ea('0x7')](_0x89ea('0x8'),_0x3f92ff);delete dials[_0x3f92ff[_0x89ea('0x4')]];}exports['newexten']=function(_0x5bbc97){try{if(_0x5bbc97[_0x89ea('0x9')][_0x89ea('0xa')]()==_0x89ea('0xb')&&_[_0x89ea('0xc')](_0x5bbc97[_0x89ea('0xd')][_0x89ea('0xa')](),_0x89ea('0xe'))){var _0x424e05=_0x5bbc97[_0x89ea('0xd')][_0x89ea('0xf')]('=');dials[_0x5bbc97[_0x89ea('0x4')]]={'routeId':_0x424e05[0x1]};}}catch(_0x346911){utils[_0x89ea('0x10')](_0x346911[_0x89ea('0x11')]);}};exports[_0x89ea('0x12')]=function(_0x57e3f7){try{if(!_[_0x89ea('0x13')](_0x57e3f7[_0x89ea('0x14')][_0x89ea('0x15')])){dials[_0x57e3f7['uniqueid']]={'routeId':_0x57e3f7[_0x89ea('0x16')]};}}catch(_0xd7894a){utils['error'](_0xd7894a['stack']);}};exports[_0x89ea('0x17')]=function(_0x3469ca){try{if(!_[_0x89ea('0x13')](dials[_0x3469ca[_0x89ea('0x4')]])){dials[_0x3469ca[_0x89ea('0x4')]]=_[_0x89ea('0x18')](dials[_0x3469ca['uniqueid']],_0x3469ca);dials[_0x3469ca[_0x89ea('0x4')]][_0x89ea('0x19')]=utils[_0x89ea('0x1a')]();dials[_0x3469ca[_0x89ea('0x4')]]['lastevent']='called';}}catch(_0x114d09){utils[_0x89ea('0x10')](_0x114d09[_0x89ea('0x11')]);}};exports[_0x89ea('0x1b')]=function(_0x38c28c){try{if(!_[_0x89ea('0x13')](dials[_0x38c28c[_0x89ea('0x4')]])){dials[_0x38c28c[_0x89ea('0x4')]]['dialstatus']=_0x38c28c[_0x89ea('0x6')];if(_0x38c28c[_0x89ea('0x6')]=='ANSWER'){dials[_0x38c28c[_0x89ea('0x4')]]=_[_0x89ea('0x18')](dials[_0x38c28c[_0x89ea('0x4')]],_0x38c28c);dials[_0x38c28c[_0x89ea('0x4')]][_0x89ea('0x1c')]=utils[_0x89ea('0x1a')]();dials[_0x38c28c[_0x89ea('0x4')]]['lastevent']=_0x89ea('0x1d');}}}catch(_0x1c55ee){utils['error'](_0x1c55ee['stack']);}};exports[_0x89ea('0x1e')]=function(_0x10a4b3){try{if(!_[_0x89ea('0x13')](dials[_0x10a4b3[_0x89ea('0x4')]])){dials[_0x10a4b3[_0x89ea('0x4')]]=_[_0x89ea('0x18')](dials[_0x10a4b3['uniqueid']],{'endtime':utils[_0x89ea('0x1a')](),'lastevent':_0x89ea('0x1f')});dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x20')]=utils[_0x89ea('0x21')](dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x22')],dials[_0x10a4b3['uniqueid']][_0x89ea('0x19')]);dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x23')]=utils[_0x89ea('0x21')](dials[_0x10a4b3[_0x89ea('0x4')]]['answertime']||dials[_0x10a4b3['uniqueid']][_0x89ea('0x22')],dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x19')]);dials[_0x10a4b3[_0x89ea('0x4')]]['billableseconds']=dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x1c')]?utils[_0x89ea('0x21')](dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x22')],dials[_0x10a4b3[_0x89ea('0x4')]][_0x89ea('0x1c')]):0x0;writeDB(dials[_0x10a4b3[_0x89ea('0x4')]]);}}catch(_0x1764d4){utils['error'](_0x1764d4[_0x89ea('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 3f1c297..8a72571 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 _0x1870=['agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','./utils','asterisk','username','password','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','agentcalled','agentringnoanswer','agentconnect'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x1870,0x1bb));var _0x0187=function(_0x361889,_0x38251c){_0x361889=_0x361889-0x0;var _0x176f1d=_0x1870[_0x361889];return _0x176f1d;};var AsteriskManager=require(_0x0187('0x0'));var config=require(_0x0187('0x1'));var utils=require(_0x0187('0x2'));var ami=new AsteriskManager(config[_0x0187('0x3')]['port'],config[_0x0187('0x3')]['ip'],config[_0x0187('0x3')][_0x0187('0x4')],config[_0x0187('0x3')][_0x0187('0x5')],!![]);ami['keepConnected']();if(config[_0x0187('0x6')]&&config[_0x0187('0x6')][_0x0187('0x7')]){utils['info'](_0x0187('0x8'));}else{var agents=require(_0x0187('0x9'));var calls=require(_0x0187('0xa'));var queues=require(_0x0187('0xb'));var recordings=require(_0x0187('0xc'));var members=require(_0x0187('0xd'));var dials=require(_0x0187('0xe'));var transfers=require('./transfers.controller');var core=require(_0x0187('0xf'));ami['on'](_0x0187('0x10'),core['connect']);ami['on']('shutdown',core[_0x0187('0x11')]);ami['on'](_0x0187('0x12'),core['fullybooted']);ami['on'](_0x0187('0x13'),core['error']);ami['on']('close',core[_0x0187('0x14')]);ami['on'](_0x0187('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0x2eef52){try{members['devicestatechange'](_0x2eef52);}catch(_0x19af34){utils[_0x0187('0x13')](_0x19af34);}});ami['on'](_0x0187('0x16'),function(_0x3d86e2){try{agents[_0x0187('0x16')](_0x3d86e2);}catch(_0x1ce78a){utils[_0x0187('0x13')](_0x1ce78a);}});ami['on'](_0x0187('0x17'),function(_0x34c45f){try{agents['agentringnoanswer'](_0x34c45f);}catch(_0x363b41){utils['error'](_0x363b41);}});ami['on'](_0x0187('0x18'),function(_0x539305){try{agents[_0x0187('0x18')](_0x539305);queues[_0x0187('0x18')](_0x539305);}catch(_0x218ad2){utils[_0x0187('0x13')](_0x218ad2);}});ami['on'](_0x0187('0x19'),function(_0x10ef34){try{agents[_0x0187('0x19')](_0x10ef34);queues['agentcomplete'](_0x10ef34);members[_0x0187('0x19')](_0x10ef34);}catch(_0x1a3c19){utils['error'](_0x1a3c19);}});ami['on'](_0x0187('0x1a'),function(_0x3216db){try{agents[_0x0187('0x1a')](_0x3216db);queues[_0x0187('0x1a')](_0x3216db);}catch(_0x48a690){utils[_0x0187('0x13')](_0x48a690);}});ami['on']('queuecallerjoin',function(_0x50caa3){try{queues['queuecallerjoin'](_0x50caa3);recordings[_0x0187('0x1b')](_0x50caa3);}catch(_0x58763b){utils['error'](_0x58763b);}});ami['on'](_0x0187('0x1c'),function(_0x20358f){try{queues[_0x0187('0x1c')](_0x20358f);}catch(_0x30e0a8){utils[_0x0187('0x13')](_0x30e0a8);}});ami['on']('musiconholdstart',function(_0x52b2f1){try{queues[_0x0187('0x1d')](_0x52b2f1);calls[_0x0187('0x1d')](_0x52b2f1);}catch(_0x196607){utils[_0x0187('0x13')](_0x196607);}});ami['on']('musiconholdstop',function(_0x5b6958){try{queues[_0x0187('0x1e')](_0x5b6958);calls[_0x0187('0x1e')](_0x5b6958);}catch(_0x53d906){utils[_0x0187('0x13')](_0x53d906);}});ami['on']('newstate',function(_0x502984){try{calls['newstate'](_0x502984);recordings['newstate'](_0x502984);}catch(_0x45dbb8){utils[_0x0187('0x13')](_0x45dbb8);}});ami['on'](_0x0187('0x1f'),function(_0x49574a){try{calls[_0x0187('0x1f')](_0x49574a);recordings['hangup'](_0x49574a);dials[_0x0187('0x1f')](_0x49574a);agents[_0x0187('0x1f')](_0x49574a);queues[_0x0187('0x1f')](_0x49574a);}catch(_0x5d35b1){utils[_0x0187('0x13')](_0x5d35b1);}});ami['on'](_0x0187('0x20'),function(_0x2d2e18){try{members[_0x0187('0x20')](_0x2d2e18);}catch(_0x294742){utils[_0x0187('0x13')](_0x294742);}});ami['on'](_0x0187('0x21'),function(_0x3fabb1){try{queues[_0x0187('0x21')](_0x3fabb1);agents['blindtransfer'](_0x3fabb1);transfers[_0x0187('0x21')](_0x3fabb1);}catch(_0x1b2b9c){utils[_0x0187('0x13')](_0x1b2b9c);}});ami['on'](_0x0187('0x22'),function(_0x4a4fd2){try{queues[_0x0187('0x22')](_0x4a4fd2);transfers['attendedtransfer'](_0x4a4fd2);agents[_0x0187('0x22')](_0x4a4fd2);calls['attendedtransfer'](_0x4a4fd2);}catch(_0x584f09){utils['error'](_0x584f09);}});ami['on']('varset',function(_0x37984f){try{queues[_0x0187('0x23')](_0x37984f);recordings[_0x0187('0x23')](_0x37984f);calls['varset'](_0x37984f);dials['varset'](_0x37984f);}catch(_0x84d016){utils['error'](_0x84d016);}});ami['on'](_0x0187('0x24'),function(_0x1475a8){try{calls[_0x0187('0x24')](_0x1475a8);recordings[_0x0187('0x24')](_0x1475a8);dials[_0x0187('0x24')](_0x1475a8);}catch(_0xff8af5){utils[_0x0187('0x13')](_0xff8af5);}});ami['on'](_0x0187('0x25'),function(_0x5f3fcd){try{calls['newchannel'](_0x5f3fcd);recordings[_0x0187('0x25')](_0x5f3fcd);}catch(_0x2c4128){utils[_0x0187('0x13')](_0x2c4128);}});ami['on'](_0x0187('0x26'),function(_0x5ad902){try{dials['dialbegin'](_0x5ad902);}catch(_0x2a9ea1){utils['error'](_0x2a9ea1);}});ami['on']('dialend',function(_0x5f2ee8){try{dials['dialend'](_0x5f2ee8);}catch(_0x403f07){utils[_0x0187('0x13')](_0x403f07);}});} \ No newline at end of file +var _0xb145=['dialbegin','dialend','../../config/environment','./utils','asterisk','port','username','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel'];(function(_0x3707a8,_0x5a7aba){var _0x14dbce=function(_0x3e7460){while(--_0x3e7460){_0x3707a8['push'](_0x3707a8['shift']());}};_0x14dbce(++_0x5a7aba);}(_0xb145,0x161));var _0x5b14=function(_0x51ed6c,_0x5c9135){_0x51ed6c=_0x51ed6c-0x0;var _0x460210=_0xb145[_0x51ed6c];return _0x460210;};var AsteriskManager=require('asterisk-manager');var config=require(_0x5b14('0x0'));var utils=require(_0x5b14('0x1'));var ami=new AsteriskManager(config[_0x5b14('0x2')][_0x5b14('0x3')],config[_0x5b14('0x2')]['ip'],config['asterisk'][_0x5b14('0x4')],config['asterisk']['password'],!![]);ami['keepConnected']();if(config[_0x5b14('0x5')]&&config[_0x5b14('0x5')][_0x5b14('0x6')]){utils[_0x5b14('0x7')](_0x5b14('0x8'));}else{var agents=require(_0x5b14('0x9'));var calls=require(_0x5b14('0xa'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x5b14('0xb'));var transfers=require('./transfers.controller');var core=require(_0x5b14('0xc'));ami['on'](_0x5b14('0xd'),core[_0x5b14('0xd')]);ami['on'](_0x5b14('0xe'),core[_0x5b14('0xe')]);ami['on'](_0x5b14('0xf'),core[_0x5b14('0xf')]);ami['on']('error',core[_0x5b14('0x10')]);ami['on']('close',core[_0x5b14('0x11')]);ami['on'](_0x5b14('0x12'),core['managerevent']);ami['on']('devicestatechange',function(_0x24fbb7){try{members[_0x5b14('0x13')](_0x24fbb7);}catch(_0x3a651b){utils[_0x5b14('0x10')](_0x3a651b);}});ami['on'](_0x5b14('0x14'),function(_0x556120){try{agents['agentcalled'](_0x556120);}catch(_0x478a88){utils[_0x5b14('0x10')](_0x478a88);}});ami['on'](_0x5b14('0x15'),function(_0x38a365){try{agents[_0x5b14('0x15')](_0x38a365);}catch(_0xedcc3a){utils[_0x5b14('0x10')](_0xedcc3a);}});ami['on'](_0x5b14('0x16'),function(_0xac7eb0){try{agents[_0x5b14('0x16')](_0xac7eb0);queues['agentconnect'](_0xac7eb0);}catch(_0x1f190a){utils[_0x5b14('0x10')](_0x1f190a);}});ami['on'](_0x5b14('0x17'),function(_0x13dcdc){try{agents[_0x5b14('0x17')](_0x13dcdc);queues[_0x5b14('0x17')](_0x13dcdc);members[_0x5b14('0x17')](_0x13dcdc);}catch(_0x4a3d18){utils[_0x5b14('0x10')](_0x4a3d18);}});ami['on'](_0x5b14('0x18'),function(_0x33ff91){try{agents['queuecallerabandon'](_0x33ff91);queues[_0x5b14('0x18')](_0x33ff91);}catch(_0x4ee5f4){utils[_0x5b14('0x10')](_0x4ee5f4);}});ami['on'](_0x5b14('0x19'),function(_0x4a2771){try{queues[_0x5b14('0x19')](_0x4a2771);recordings['queuecallerjoin'](_0x4a2771);}catch(_0x335315){utils[_0x5b14('0x10')](_0x335315);}});ami['on'](_0x5b14('0x1a'),function(_0x6fd40c){try{queues['queuecallerleave'](_0x6fd40c);}catch(_0x315f3e){utils[_0x5b14('0x10')](_0x315f3e);}});ami['on'](_0x5b14('0x1b'),function(_0x220483){try{queues[_0x5b14('0x1b')](_0x220483);calls[_0x5b14('0x1b')](_0x220483);}catch(_0x181d46){utils[_0x5b14('0x10')](_0x181d46);}});ami['on'](_0x5b14('0x1c'),function(_0x5c9aed){try{queues[_0x5b14('0x1c')](_0x5c9aed);calls[_0x5b14('0x1c')](_0x5c9aed);}catch(_0x675150){utils[_0x5b14('0x10')](_0x675150);}});ami['on']('newstate',function(_0x9256b8){try{calls['newstate'](_0x9256b8);recordings[_0x5b14('0x1d')](_0x9256b8);}catch(_0x4d3313){utils['error'](_0x4d3313);}});ami['on'](_0x5b14('0x1e'),function(_0xa1846b){try{calls['hangup'](_0xa1846b);recordings[_0x5b14('0x1e')](_0xa1846b);dials[_0x5b14('0x1e')](_0xa1846b);agents[_0x5b14('0x1e')](_0xa1846b);queues[_0x5b14('0x1e')](_0xa1846b);}catch(_0x5d1e73){utils['error'](_0x5d1e73);}});ami['on'](_0x5b14('0x1f'),function(_0x3941a1){try{members[_0x5b14('0x1f')](_0x3941a1);}catch(_0x3b680c){utils['error'](_0x3b680c);}});ami['on'](_0x5b14('0x20'),function(_0x38b9c4){try{queues[_0x5b14('0x20')](_0x38b9c4);agents['blindtransfer'](_0x38b9c4);transfers[_0x5b14('0x20')](_0x38b9c4);}catch(_0x24898f){utils[_0x5b14('0x10')](_0x24898f);}});ami['on'](_0x5b14('0x21'),function(_0x1ee2cb){try{queues['attendedtransfer'](_0x1ee2cb);transfers[_0x5b14('0x21')](_0x1ee2cb);agents['attendedtransfer'](_0x1ee2cb);calls[_0x5b14('0x21')](_0x1ee2cb);}catch(_0x41d8e6){utils[_0x5b14('0x10')](_0x41d8e6);}});ami['on'](_0x5b14('0x22'),function(_0x1d6d8f){try{queues[_0x5b14('0x22')](_0x1d6d8f);recordings[_0x5b14('0x22')](_0x1d6d8f);calls['varset'](_0x1d6d8f);dials['varset'](_0x1d6d8f);}catch(_0x4097cb){utils['error'](_0x4097cb);}});ami['on'](_0x5b14('0x23'),function(_0x284da8){try{calls[_0x5b14('0x23')](_0x284da8);recordings[_0x5b14('0x23')](_0x284da8);dials[_0x5b14('0x23')](_0x284da8);}catch(_0x540c53){utils[_0x5b14('0x10')](_0x540c53);}});ami['on']('newchannel',function(_0x115e92){try{calls['newchannel'](_0x115e92);recordings[_0x5b14('0x24')](_0x115e92);}catch(_0x5627a3){utils['error'](_0x5627a3);}});ami['on']('dialbegin',function(_0x48f312){try{dials[_0x5b14('0x25')](_0x48f312);}catch(_0x4703a8){utils['error'](_0x4703a8);}});ami['on'](_0x5b14('0x26'),function(_0x441ce0){try{dials[_0x5b14('0x26')](_0x441ce0);}catch(_0x1522e3){utils['error'](_0x1522e3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3e48861..6af0e66 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 _0x8c4e=['data3','destination','destinationchannel','lodash','util','./utils','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','type','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','error','startsWith','state','INUSE','BUSY','device','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','assign','queue','cdr','channel','source'];(function(_0x1af7f6,_0x344c00){var _0x3fb482=function(_0x1cd4bc){while(--_0x1cd4bc){_0x1af7f6['push'](_0x1af7f6['shift']());}};_0x3fb482(++_0x344c00);}(_0x8c4e,0xed));var _0xe8c4=function(_0x209323,_0x3a207f){_0x209323=_0x209323-0x0;var _0x1fe90b=_0x8c4e[_0x209323];return _0x1fe90b;};'use strict';var _=require(_0xe8c4('0x0'));var util=require(_0xe8c4('0x1'));var utils=require(_0xe8c4('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x35a7be){utils['info'](util[_0xe8c4('0x3')](_0xe8c4('0x4'),_0x35a7be[_0xe8c4('0x5')],_0x35a7be[_0xe8c4('0x6')],_0x35a7be['channel'],_0x35a7be[_0xe8c4('0x7')],_0x35a7be['membername'],_0x35a7be[_0xe8c4('0x8')]));if(_0x35a7be[_0xe8c4('0x6')]){utils['getUserByInterface'](_0x35a7be[_0xe8c4('0x6')])[_0xe8c4('0x9')](function(_0x38e660){if(_0x38e660){_0x35a7be[_0xe8c4('0xa')]=_0x38e660[_0xe8c4('0xb')];_0x35a7be[_0xe8c4('0xc')]=_0x38e660[_0xe8c4('0xc')];utils[_0xe8c4('0xd')](_0xe8c4('0xe'),_0x35a7be);}else{utils[_0xe8c4('0xf')](_0x35a7be[_0xe8c4('0x6')][_0xe8c4('0x10')]('/')[0x1])[_0xe8c4('0x9')](function(_0x3ab33a){if(_0x3ab33a){_0x35a7be['membername']=_0x3ab33a['name'];_0x35a7be['internal']=_0x3ab33a[_0xe8c4('0xc')];utils['request'](_0xe8c4('0xe'),_0x35a7be);}});}})['catch'](function(_0x2ebe77){utils[_0xe8c4('0x11')](_0x2ebe77);});}delete members[_0x35a7be[_0xe8c4('0x6')]];}function startsWith(_0x1ae22e,_0x12f062){return _['some'](_0x1ae22e,function(_0x5d80c9){return _[_0xe8c4('0x12')](_0x12f062,_0x5d80c9);});}exports['devicestatechange']=function(_0x5d1fd4){switch(_0x5d1fd4[_0xe8c4('0x13')]){case _0xe8c4('0x14'):case _0xe8c4('0x15'):if(!startsWith(exclude,_0x5d1fd4[_0xe8c4('0x16')])){members[_0x5d1fd4[_0xe8c4('0x16')]]={'channel':'voice','interface':_0x5d1fd4[_0xe8c4('0x16')],'type':'TALKING','enterAt':utils[_0xe8c4('0x17')](),'role':_0xe8c4('0x18')};}break;case _0xe8c4('0x19'):if(!_[_0xe8c4('0x1a')](members[_0x5d1fd4[_0xe8c4('0x16')]])){members[_0x5d1fd4[_0xe8c4('0x16')]]['exitAt']=utils[_0xe8c4('0x17')]();members[_0x5d1fd4[_0xe8c4('0x16')]][_0xe8c4('0x1b')]=utils[_0xe8c4('0x1c')](members[_0x5d1fd4[_0xe8c4('0x16')]][_0xe8c4('0x1d')],members[_0x5d1fd4[_0xe8c4('0x16')]][_0xe8c4('0x1e')]);if(members[_0x5d1fd4[_0xe8c4('0x16')]]['uniqueid']){writeDB(members[_0x5d1fd4[_0xe8c4('0x16')]]);}}default:break;}};exports['agentcomplete']=function(_0x45b43d){if(!_['isNil'](members[_0x45b43d[_0xe8c4('0x6')]])){members[_0x45b43d[_0xe8c4('0x6')]]=_[_0xe8c4('0x1f')](members[_0x45b43d[_0xe8c4('0x6')]],{'data4':_0x45b43d[_0xe8c4('0x20')],'uniqueid':_0x45b43d[_0xe8c4('0x5')]});}};exports[_0xe8c4('0x21')]=function(_0x114877){if(_0x114877[_0xe8c4('0x22')]){var _0x1a21ce=_0x114877['channel'][_0xe8c4('0x10')]('-')[0x0];if(!_[_0xe8c4('0x1a')](members[_0x1a21ce])){members[_0x1a21ce]=_[_0xe8c4('0x1f')](members[_0x1a21ce],{'data1':members[_0x1a21ce]['data1']||_0x114877[_0xe8c4('0x8')],'data2':members[_0x1a21ce][_0xe8c4('0x7')]||_0x114877[_0xe8c4('0x23')],'data3':members[_0x1a21ce][_0xe8c4('0x24')]||_0x114877[_0xe8c4('0x25')],'uniqueid':members[_0x1a21ce]['uniqueid']||_0x114877[_0xe8c4('0x5')]});if(members[_0x1a21ce][_0xe8c4('0x1d')]){writeDB(members[_0x1a21ce]);}}}if(_0x114877[_0xe8c4('0x26')]){var _0x223e6a=_0x114877['destinationchannel'][_0xe8c4('0x10')]('-')[0x0];if(!_[_0xe8c4('0x1a')](members[_0x223e6a])){members[_0x223e6a]=_[_0xe8c4('0x1f')](members[_0x223e6a],{'data1':members[_0x223e6a]['data1']||_0x114877[_0xe8c4('0x8')],'data2':members[_0x223e6a][_0xe8c4('0x7')]||_0x114877[_0xe8c4('0x23')],'data3':members[_0x223e6a][_0xe8c4('0x24')]||_0x114877['destination'],'uniqueid':members[_0x223e6a][_0xe8c4('0x5')]||_0x114877[_0xe8c4('0x5')]});if(members[_0x223e6a][_0xe8c4('0x1d')]){writeDB(members[_0x223e6a]);}}}}; \ No newline at end of file +var _0x012f=['destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','name','internal','getUserByName','split','CreateMemberReport','error','startsWith','devicestatechange','state','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','queue','cdr','assign','data1','type','data3'];(function(_0x43f5be,_0x155c36){var _0xa54bc=function(_0x5ef687){while(--_0x5ef687){_0x43f5be['push'](_0x43f5be['shift']());}};_0xa54bc(++_0x155c36);}(_0x012f,0xe4));var _0xf012=function(_0x1f75a4,_0x220814){_0x1f75a4=_0x1f75a4-0x0;var _0x3e3309=_0x012f[_0x1f75a4];return _0x3e3309;};'use strict';var _=require(_0xf012('0x0'));var util=require(_0xf012('0x1'));var utils=require(_0xf012('0x2'));var members={};var exclude=[_0xf012('0x3'),'Queue:'];function writeDB(_0x5e39b3){utils[_0xf012('0x4')](util[_0xf012('0x5')](_0xf012('0x6'),_0x5e39b3[_0xf012('0x7')],_0x5e39b3[_0xf012('0x8')],_0x5e39b3[_0xf012('0x9')],_0x5e39b3[_0xf012('0xa')],_0x5e39b3[_0xf012('0xb')],_0x5e39b3['type']));if(_0x5e39b3[_0xf012('0x8')]){utils[_0xf012('0xc')](_0x5e39b3[_0xf012('0x8')])[_0xf012('0xd')](function(_0x23c952){if(_0x23c952){_0x5e39b3[_0xf012('0xb')]=_0x23c952[_0xf012('0xe')];_0x5e39b3['internal']=_0x23c952[_0xf012('0xf')];utils['request']('CreateMemberReport',_0x5e39b3);}else{utils[_0xf012('0x10')](_0x5e39b3[_0xf012('0x8')][_0xf012('0x11')]('/')[0x1])['then'](function(_0x339881){if(_0x339881){_0x5e39b3[_0xf012('0xb')]=_0x339881[_0xf012('0xe')];_0x5e39b3[_0xf012('0xf')]=_0x339881['internal'];utils['request'](_0xf012('0x12'),_0x5e39b3);}});}})['catch'](function(_0x49c5d4){utils[_0xf012('0x13')](_0x49c5d4);});}delete members[_0x5e39b3[_0xf012('0x8')]];}function startsWith(_0x3c44ac,_0x4d0251){return _['some'](_0x3c44ac,function(_0x5cf3a1){return _[_0xf012('0x14')](_0x4d0251,_0x5cf3a1);});}exports[_0xf012('0x15')]=function(_0x2a6454){switch(_0x2a6454[_0xf012('0x16')]){case'INUSE':case _0xf012('0x17'):if(!startsWith(exclude,_0x2a6454[_0xf012('0x18')])){members[_0x2a6454[_0xf012('0x18')]]={'channel':_0xf012('0x19'),'interface':_0x2a6454[_0xf012('0x18')],'type':_0xf012('0x1a'),'enterAt':utils[_0xf012('0x1b')](),'role':_0xf012('0x1c')};}break;case _0xf012('0x1d'):if(!_[_0xf012('0x1e')](members[_0x2a6454[_0xf012('0x18')]])){members[_0x2a6454[_0xf012('0x18')]][_0xf012('0x1f')]=utils[_0xf012('0x1b')]();members[_0x2a6454[_0xf012('0x18')]][_0xf012('0x20')]=utils[_0xf012('0x21')](members[_0x2a6454[_0xf012('0x18')]][_0xf012('0x1f')],members[_0x2a6454['device']][_0xf012('0x22')]);if(members[_0x2a6454[_0xf012('0x18')]][_0xf012('0x7')]){writeDB(members[_0x2a6454[_0xf012('0x18')]]);}}default:break;}};exports[_0xf012('0x23')]=function(_0x3c1aac){if(!_['isNil'](members[_0x3c1aac[_0xf012('0x8')]])){members[_0x3c1aac['interface']]=_['assign'](members[_0x3c1aac[_0xf012('0x8')]],{'data4':_0x3c1aac[_0xf012('0x24')],'uniqueid':_0x3c1aac[_0xf012('0x7')]});}};exports[_0xf012('0x25')]=function(_0x40f698){if(_0x40f698[_0xf012('0x9')]){var _0x14c806=_0x40f698[_0xf012('0x9')]['split']('-')[0x0];if(!_[_0xf012('0x1e')](members[_0x14c806])){members[_0x14c806]=_[_0xf012('0x26')](members[_0x14c806],{'data1':members[_0x14c806][_0xf012('0x27')]||_0x40f698[_0xf012('0x28')],'data2':members[_0x14c806][_0xf012('0xa')]||_0x40f698['source'],'data3':members[_0x14c806][_0xf012('0x29')]||_0x40f698[_0xf012('0x2a')],'uniqueid':members[_0x14c806][_0xf012('0x7')]||_0x40f698['uniqueid']});if(members[_0x14c806][_0xf012('0x1f')]){writeDB(members[_0x14c806]);}}}if(_0x40f698[_0xf012('0x2b')]){var _0x21b702=_0x40f698[_0xf012('0x2b')][_0xf012('0x11')]('-')[0x0];if(!_[_0xf012('0x1e')](members[_0x21b702])){members[_0x21b702]=_[_0xf012('0x26')](members[_0x21b702],{'data1':members[_0x21b702][_0xf012('0x27')]||_0x40f698[_0xf012('0x28')],'data2':members[_0x21b702][_0xf012('0xa')]||_0x40f698[_0xf012('0x2c')],'data3':members[_0x21b702]['data3']||_0x40f698['destination'],'uniqueid':members[_0x21b702][_0xf012('0x7')]||_0x40f698['uniqueid']});if(members[_0x21b702][_0xf012('0x1f')]){writeDB(members[_0x21b702]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c705d22..ff74863 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 _0x6848=['request','CreateVoiceQueueReport','assign','position','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','transfereduniqueid','queuecallerenterreason','varset','variable','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','reason','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfer','transfertype','BLIND','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transferexten','secondtransfererexten','transfertargetlinkedid','clone','error','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then'];(function(_0x40c588,_0xd1dcfb){var _0xa1afc6=function(_0x2c6914){while(--_0x2c6914){_0x40c588['push'](_0x40c588['shift']());}};_0xa1afc6(++_0xd1dcfb);}(_0x6848,0x174));var _0x8684=function(_0x4c8a8a,_0x136b97){_0x4c8a8a=_0x4c8a8a-0x0;var _0x387e17=_0x6848[_0x4c8a8a];return _0x387e17;};'use strict';var _=require(_0x8684('0x0'));var util=require(_0x8684('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x5c3bf0){utils[_0x8684('0x2')](util[_0x8684('0x3')](_0x8684('0x4'),_0x5c3bf0[_0x8684('0x5')],_0x5c3bf0['channel'],_0x5c3bf0[_0x8684('0x6')],_0x5c3bf0[_0x8684('0x7')],_0x5c3bf0[_0x8684('0x8')],_0x5c3bf0[_0x8684('0x9')],_0x5c3bf0[_0x8684('0xa')]));if(_0x5c3bf0[_0x8684('0x6')]){utils[_0x8684('0xb')](_0x5c3bf0[_0x8684('0x6')])[_0x8684('0xc')](function(_0x148767){if(_0x148767){_0x5c3bf0['type']=_0x148767['type'];}utils[_0x8684('0xd')]('CreateVoiceQueueReport',_0x5c3bf0);});}else{utils[_0x8684('0xd')](_0x8684('0xe'),_0x5c3bf0);}if(_0x5c3bf0['transfereduniqueid']){delete queues[_0x5c3bf0['transfereduniqueid']];}else{delete queues[_0x5c3bf0['uniqueid']];}}exports['queuecallerjoin']=function(_0x3ebe2d){queues[_0x3ebe2d[_0x8684('0x5')]]=_[_0x8684('0xf')](_0x3ebe2d,{'originalposition':_0x3ebe2d[_0x8684('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x8684('0x11')]=function(_0x31b3a0){if(!_[_0x8684('0x12')](queues[_0x31b3a0[_0x8684('0x5')]])){if(queues[_0x31b3a0[_0x8684('0x5')]][_0x8684('0x13')]){if(!queues[_0x31b3a0['uniqueid']][_0x8684('0x14')]&&!queues[_0x31b3a0['uniqueid']][_0x8684('0x15')]){queues[_0x31b3a0[_0x8684('0x5')]][_0x8684('0x16')]=!![];queues[_0x31b3a0[_0x8684('0x5')]][_0x8684('0x17')]=utils[_0x8684('0x18')]();queues[_0x31b3a0[_0x8684('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x31b3a0[_0x8684('0x5')]]);}else{if(queues[_0x31b3a0[_0x8684('0x5')]][_0x8684('0x19')]){queues[queues[_0x31b3a0[_0x8684('0x5')]]['transfereduniqueid']]=queues[_0x31b3a0['uniqueid']];queues[queues[_0x31b3a0[_0x8684('0x5')]]['transfereduniqueid']][_0x8684('0x1a')]=0x2;delete queues[_0x31b3a0[_0x8684('0x5')]];}}}};exports[_0x8684('0x1b')]=function(_0x590824){if(!_[_0x8684('0x12')](_0x590824[_0x8684('0x1c')]['queuestatus'])&&_0x590824[_0x8684('0x1d')][_0x8684('0x1e')]()!==_0x8684('0x1f')){if(!_[_0x8684('0x12')](queues[_0x590824[_0x8684('0x5')]])){queues[_0x590824[_0x8684('0x5')]][_0x8684('0x14')]=![];queues[_0x590824[_0x8684('0x5')]]['queuecallerabandonAt']=null;queues[_0x590824[_0x8684('0x5')]][_0x8684('0x15')]=!![];queues[_0x590824[_0x8684('0x5')]][_0x8684('0x20')]=utils[_0x8684('0x18')]();queues[_0x590824[_0x8684('0x5')]][_0x8684('0xa')]=_0x590824[_0x8684('0x1d')][_0x8684('0x1e')]();writeDB(queues[_0x590824['uniqueid']]);}}else if(!_[_0x8684('0x12')](_0x590824[_0x8684('0x1c')][_0x8684('0x21')])){if(!_[_0x8684('0x12')](queues[_0x590824[_0x8684('0x5')]])&&!queues[_0x590824[_0x8684('0x5')]][_0x8684('0x14')]){queues[_0x590824[_0x8684('0x5')]]['queuecallerabandon']=![];queues[_0x590824['uniqueid']][_0x8684('0x22')]=null;queues[_0x590824[_0x8684('0x5')]][_0x8684('0x15')]=!![];queues[_0x590824['uniqueid']][_0x8684('0x20')]=utils[_0x8684('0x18')]();queues[_0x590824[_0x8684('0x5')]]['queuecallerexitreason']='EXITWITHKEY';}}};exports[_0x8684('0x14')]=function(_0x16be3b){if(!_[_0x8684('0x12')](queues[_0x16be3b[_0x8684('0x5')]])){queues[_0x16be3b[_0x8684('0x5')]][_0x8684('0x15')]=![];queues[_0x16be3b[_0x8684('0x5')]][_0x8684('0x20')]=null;queues[_0x16be3b[_0x8684('0x5')]][_0x8684('0x14')]=!![];queues[_0x16be3b[_0x8684('0x5')]][_0x8684('0x22')]=utils[_0x8684('0x18')]();queues[_0x16be3b[_0x8684('0x5')]][_0x8684('0xa')]=_0x8684('0x23');}};exports['queuecallerleave']=function(_0x4cb3cd){if(!_['isNil'](queues[_0x4cb3cd[_0x8684('0x5')]])){queues[_0x4cb3cd['uniqueid']][_0x8684('0x24')]=!![];queues[_0x4cb3cd[_0x8684('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x4cb3cd['uniqueid']][_0x8684('0x25')]=utils[_0x8684('0x26')](queues[_0x4cb3cd[_0x8684('0x5')]][_0x8684('0x13')],queues[_0x4cb3cd[_0x8684('0x5')]][_0x8684('0x27')]);queues[_0x4cb3cd[_0x8684('0x5')]]['position']=_0x4cb3cd[_0x8684('0x10')];queues[_0x4cb3cd[_0x8684('0x5')]]['count']=_0x4cb3cd[_0x8684('0x28')];queues[_0x4cb3cd[_0x8684('0x5')]]['connectedlinenum']=_0x4cb3cd[_0x8684('0x29')];queues[_0x4cb3cd[_0x8684('0x5')]][_0x8684('0x2a')]=_0x4cb3cd['connectedlinename'];}};exports[_0x8684('0x2b')]=function(_0x515701){if(!_[_0x8684('0x12')](queues[_0x515701[_0x8684('0x5')]])){queues[_0x515701[_0x8684('0x5')]][_0x8684('0x14')]=![];queues[_0x515701['uniqueid']][_0x8684('0x14')]=![];queues[_0x515701[_0x8684('0x5')]][_0x8684('0x22')]=null;queues[_0x515701[_0x8684('0x5')]][_0x8684('0x15')]=![];queues[_0x515701[_0x8684('0x5')]][_0x8684('0xa')]=null;queues[_0x515701[_0x8684('0x5')]][_0x8684('0x20')]=null;queues[_0x515701[_0x8684('0x5')]][_0x8684('0x2c')]=!![];queues[_0x515701[_0x8684('0x5')]]['accountcode']=_0x515701[_0x8684('0x2d')];queues[_0x515701['uniqueid']][_0x8684('0x7')]=_0x515701[_0x8684('0x2e')];}};exports[_0x8684('0x2f')]=function(_0x571e59){if(!_[_0x8684('0x12')](queues[_0x571e59[_0x8684('0x5')]])){if(queues[_0x571e59[_0x8684('0x5')]][_0x8684('0x13')]){queues[_0x571e59[_0x8684('0x5')]][_0x8684('0x14')]=![];queues[_0x571e59['uniqueid']][_0x8684('0x14')]=![];queues[_0x571e59['uniqueid']][_0x8684('0x22')]=null;queues[_0x571e59[_0x8684('0x5')]][_0x8684('0x15')]=![];queues[_0x571e59[_0x8684('0x5')]][_0x8684('0x20')]=null;queues[_0x571e59[_0x8684('0x5')]]['assigned']=!![];queues[_0x571e59[_0x8684('0x5')]][_0x8684('0x7')]=_0x571e59[_0x8684('0x2e')];queues[_0x571e59[_0x8684('0x5')]][_0x8684('0x16')]=!![];queues[_0x571e59['uniqueid']][_0x8684('0x17')]=utils[_0x8684('0x18')]();if(_0x571e59[_0x8684('0x30')]=='transfer'){if(!queues[_0x571e59['uniqueid']]['transfer']){queues[_0x571e59[_0x8684('0x5')]]['queuecallerexitreason']=_0x8684('0x31');}}else{queues[_0x571e59[_0x8684('0x5')]]['queuecallerexitreason']=_0x8684('0x32')+_0x571e59[_0x8684('0x30')][_0x8684('0x1e')]();}writeDB(queues[_0x571e59['uniqueid']]);}}};exports['blindtransfer']=function(_0x4c3459){if(!_[_0x8684('0x12')](queues[_0x4c3459['transfereeuniqueid']])){queues[_0x4c3459[_0x8684('0x33')]][_0x8684('0x34')]=!![];queues[_0x4c3459[_0x8684('0x33')]][_0x8684('0x35')]=_0x8684('0x36');queues[_0x4c3459['transfereeuniqueid']]['transferexten']=_0x4c3459[_0x8684('0x37')];queues[_0x4c3459[_0x8684('0x33')]][_0x8684('0x38')]=_0x4c3459[_0x8684('0x33')];queues[_0x4c3459['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';}};exports[_0x8684('0x39')]=function(_0x2f4769){try{if(_0x2f4769[_0x8684('0x3a')]==_0x2f4769[_0x8684('0x3b')]){if(!_[_0x8684('0x12')](queues[_0x2f4769['secondtransfererlinkedid']])){queues[_0x2f4769[_0x8684('0x3c')]]['transfer']=!![];queues[_0x2f4769[_0x8684('0x3c')]][_0x8684('0x35')]=_0x8684('0x3d');queues[_0x2f4769[_0x8684('0x3c')]]['transferexten']=_0x2f4769[_0x8684('0x3e')];queues[_0x2f4769[_0x8684('0x3c')]][_0x8684('0x38')]=_0x2f4769[_0x8684('0x3a')];queues[_0x2f4769[_0x8684('0x3c')]]['queuecallerexitreason']=_0x8684('0x3f');}if(!_[_0x8684('0x12')](queues[_0x2f4769[_0x8684('0x3b')]])){if(_0x2f4769[_0x8684('0x40')]&&queues[_0x2f4769[_0x8684('0x40')]]){queues[_0x2f4769[_0x8684('0x40')]]['queuecallerenterreason']=0x1;queues[_0x2f4769[_0x8684('0x33')]]=_['clone'](queues[_0x2f4769['transfereelinkedid']]);queues[_0x2f4769[_0x8684('0x33')]][_0x8684('0x19')]=_0x2f4769[_0x8684('0x41')];queues[_0x2f4769[_0x8684('0x33')]][_0x8684('0x1a')]=0x2;queues[_0x2f4769[_0x8684('0x33')]][_0x8684('0x8')]=queues[_0x2f4769[_0x8684('0x3c')]][_0x8684('0x8')];queues[_0x2f4769['transfereeuniqueid']][_0x8684('0x42')]=queues[_0x2f4769[_0x8684('0x3c')]][_0x8684('0x42')];queues[_0x2f4769[_0x8684('0x33')]]['queuecallerjoinAt']=utils['now']();queues[_0x2f4769[_0x8684('0x33')]][_0x8684('0x13')]=utils[_0x8684('0x18')]();queues[_0x2f4769[_0x8684('0x33')]]['holdtime']=0x0;queues[_0x2f4769[_0x8684('0x33')]][_0x8684('0x43')]=0x0;}else{queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x19')]=_0x2f4769[_0x8684('0x3c')];}}}else if(_0x2f4769[_0x8684('0x44')]==_0x2f4769[_0x8684('0x3c')]){if(!_[_0x8684('0x12')](queues[_0x2f4769[_0x8684('0x3b')]])){queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x34')]=!![];queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x35')]=_0x8684('0x3d');queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x45')]=_0x2f4769[_0x8684('0x46')];queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x38')]=_0x2f4769['secondtransfereruniqueid'];queues[_0x2f4769['origtransfererlinkedid']][_0x8684('0xa')]=_0x8684('0x3f');}if(!_[_0x8684('0x12')](queues[_0x2f4769[_0x8684('0x3c')]])){if(_0x2f4769[_0x8684('0x47')]&&queues[_0x2f4769['transfertargetlinkedid']]){queues[_0x2f4769[_0x8684('0x47')]][_0x8684('0x1a')]=0x1;queues[_0x2f4769[_0x8684('0x41')]]=_[_0x8684('0x48')](queues[_0x2f4769[_0x8684('0x47')]]);queues[_0x2f4769[_0x8684('0x41')]][_0x8684('0x19')]=_0x2f4769[_0x8684('0x41')];queues[_0x2f4769[_0x8684('0x41')]]['queuecallerenterreason']=0x2;queues[_0x2f4769['transfertargetuniqueid']][_0x8684('0x8')]=queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x8')];queues[_0x2f4769[_0x8684('0x41')]][_0x8684('0x42')]=queues[_0x2f4769[_0x8684('0x3b')]][_0x8684('0x42')];queues[_0x2f4769[_0x8684('0x41')]]['queuecallerjoinAt']=utils[_0x8684('0x18')]();queues[_0x2f4769[_0x8684('0x41')]][_0x8684('0x13')]=utils[_0x8684('0x18')]();queues[_0x2f4769[_0x8684('0x41')]][_0x8684('0x25')]=0x0;queues[_0x2f4769['transfertargetuniqueid']][_0x8684('0x43')]=0x0;}else{queues[_0x2f4769[_0x8684('0x3c')]][_0x8684('0x19')]=_0x2f4769[_0x8684('0x3b')];}}}}catch(_0xd9c447){utils[_0x8684('0x49')](_0xd9c447['stack']);}};exports[_0x8684('0x4a')]=function(_0xd720c0){if(!_[_0x8684('0x12')](queues[_0xd720c0[_0x8684('0x5')]])){queues[_0xd720c0[_0x8684('0x5')]][_0x8684('0x4b')]=utils[_0x8684('0x18')]();}};exports[_0x8684('0x4c')]=function(_0x4f6e56){if(!_[_0x8684('0x12')](queues[_0x4f6e56['uniqueid']])){if(!_[_0x8684('0x12')](queues[_0x4f6e56['uniqueid']]['musiconholdstartAt'])){queues[_0x4f6e56[_0x8684('0x5')]][_0x8684('0x43')]+=utils[_0x8684('0x26')](utils[_0x8684('0x18')](),queues[_0x4f6e56[_0x8684('0x5')]][_0x8684('0x4b')]);delete queues[_0x4f6e56[_0x8684('0x5')]][_0x8684('0x4b')];}}}; \ No newline at end of file +var _0x81d1=['queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','CONTINUE','isNil','value','toUpperCase','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','assigned','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype','BLIND','extension','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','transferuniqueid','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','error','stack','musiconholdstartAt','musiconholdstop','lodash','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','now','queuecallerleaveAt','queuecallerabandon','queuecallerexit'];(function(_0x1f4673,_0x2fa9a8){var _0x9172b0=function(_0x336720){while(--_0x336720){_0x1f4673['push'](_0x1f4673['shift']());}};_0x9172b0(++_0x2fa9a8);}(_0x81d1,0x16c));var _0x181d=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x81d1[_0x996bc8];return _0x20b0ea;};'use strict';var _=require(_0x181d('0x0'));var util=require(_0x181d('0x1'));var utils=require(_0x181d('0x2'));var queues={};function writeDB(_0x2bef21){utils['info'](util[_0x181d('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x2bef21[_0x181d('0x4')],_0x2bef21[_0x181d('0x5')],_0x2bef21[_0x181d('0x6')],_0x2bef21[_0x181d('0x7')],_0x2bef21['calleridnum'],_0x2bef21[_0x181d('0x8')],_0x2bef21[_0x181d('0x9')]));if(_0x2bef21[_0x181d('0x6')]){utils[_0x181d('0xa')](_0x2bef21[_0x181d('0x6')])['then'](function(_0x1d21e4){if(_0x1d21e4){_0x2bef21[_0x181d('0xb')]=_0x1d21e4[_0x181d('0xb')];}utils[_0x181d('0xc')]('CreateVoiceQueueReport',_0x2bef21);});}else{utils[_0x181d('0xc')](_0x181d('0xd'),_0x2bef21);}if(_0x2bef21[_0x181d('0xe')]){delete queues[_0x2bef21[_0x181d('0xe')]];}else{delete queues[_0x2bef21[_0x181d('0x4')]];}}exports[_0x181d('0xf')]=function(_0x4159da){queues[_0x4159da[_0x181d('0x4')]]=_[_0x181d('0x10')](_0x4159da,{'originalposition':_0x4159da['position'],'queuecallerjoinAt':utils[_0x181d('0x11')](),'mohtime':0x0});};exports['hangup']=function(_0x57240b){if(!_['isNil'](queues[_0x57240b['uniqueid']])){if(queues[_0x57240b[_0x181d('0x4')]][_0x181d('0x12')]){if(!queues[_0x57240b['uniqueid']][_0x181d('0x13')]&&!queues[_0x57240b[_0x181d('0x4')]][_0x181d('0x14')]){queues[_0x57240b[_0x181d('0x4')]][_0x181d('0x15')]=!![];queues[_0x57240b[_0x181d('0x4')]]['queuecallercompleteAt']=utils[_0x181d('0x11')]();queues[_0x57240b[_0x181d('0x4')]][_0x181d('0x9')]=_0x181d('0x16');}writeDB(queues[_0x57240b[_0x181d('0x4')]]);}else{if(queues[_0x57240b[_0x181d('0x4')]][_0x181d('0xe')]){queues[queues[_0x57240b[_0x181d('0x4')]][_0x181d('0xe')]]=queues[_0x57240b[_0x181d('0x4')]];queues[queues[_0x57240b[_0x181d('0x4')]][_0x181d('0xe')]][_0x181d('0x17')]=0x2;delete queues[_0x57240b[_0x181d('0x4')]];}}}};exports[_0x181d('0x18')]=function(_0x1d6a36){if(!_['isNil'](_0x1d6a36[_0x181d('0x19')][_0x181d('0x1a')])&&_0x1d6a36['value']['toUpperCase']()!==_0x181d('0x1b')){if(!_[_0x181d('0x1c')](queues[_0x1d6a36[_0x181d('0x4')]])){queues[_0x1d6a36['uniqueid']][_0x181d('0x13')]=![];queues[_0x1d6a36['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1d6a36['uniqueid']]['queuecallerexit']=!![];queues[_0x1d6a36[_0x181d('0x4')]]['queuecallerexitAt']=utils[_0x181d('0x11')]();queues[_0x1d6a36['uniqueid']][_0x181d('0x9')]=_0x1d6a36[_0x181d('0x1d')][_0x181d('0x1e')]();writeDB(queues[_0x1d6a36['uniqueid']]);}}else if(!_[_0x181d('0x1c')](_0x1d6a36['variable'][_0x181d('0x1f')])){if(!_[_0x181d('0x1c')](queues[_0x1d6a36[_0x181d('0x4')]])&&!queues[_0x1d6a36[_0x181d('0x4')]]['queuecallerabandon']){queues[_0x1d6a36[_0x181d('0x4')]]['queuecallerabandon']=![];queues[_0x1d6a36[_0x181d('0x4')]][_0x181d('0x20')]=null;queues[_0x1d6a36[_0x181d('0x4')]]['queuecallerexit']=!![];queues[_0x1d6a36['uniqueid']][_0x181d('0x21')]=utils['now']();queues[_0x1d6a36[_0x181d('0x4')]][_0x181d('0x9')]=_0x181d('0x22');}}};exports[_0x181d('0x13')]=function(_0x4c5788){if(!_['isNil'](queues[_0x4c5788[_0x181d('0x4')]])){queues[_0x4c5788[_0x181d('0x4')]]['queuecallerexit']=![];queues[_0x4c5788[_0x181d('0x4')]][_0x181d('0x21')]=null;queues[_0x4c5788[_0x181d('0x4')]][_0x181d('0x13')]=!![];queues[_0x4c5788[_0x181d('0x4')]][_0x181d('0x20')]=utils[_0x181d('0x11')]();queues[_0x4c5788[_0x181d('0x4')]][_0x181d('0x9')]=_0x181d('0x23');}};exports[_0x181d('0x24')]=function(_0xde8666){if(!_['isNil'](queues[_0xde8666[_0x181d('0x4')]])){queues[_0xde8666[_0x181d('0x4')]][_0x181d('0x24')]=!![];queues[_0xde8666['uniqueid']][_0x181d('0x12')]=utils[_0x181d('0x11')]();queues[_0xde8666['uniqueid']][_0x181d('0x25')]=utils[_0x181d('0x26')](queues[_0xde8666[_0x181d('0x4')]][_0x181d('0x12')],queues[_0xde8666[_0x181d('0x4')]][_0x181d('0x27')]);queues[_0xde8666[_0x181d('0x4')]][_0x181d('0x28')]=_0xde8666[_0x181d('0x28')];queues[_0xde8666[_0x181d('0x4')]][_0x181d('0x29')]=_0xde8666[_0x181d('0x29')];queues[_0xde8666[_0x181d('0x4')]]['connectedlinenum']=_0xde8666[_0x181d('0x2a')];queues[_0xde8666[_0x181d('0x4')]]['connectedlinename']=_0xde8666['connectedlinename'];}};exports['agentconnect']=function(_0x4eaaa5){if(!_[_0x181d('0x1c')](queues[_0x4eaaa5[_0x181d('0x4')]])){queues[_0x4eaaa5[_0x181d('0x4')]][_0x181d('0x13')]=![];queues[_0x4eaaa5[_0x181d('0x4')]]['queuecallerabandon']=![];queues[_0x4eaaa5[_0x181d('0x4')]][_0x181d('0x20')]=null;queues[_0x4eaaa5[_0x181d('0x4')]][_0x181d('0x14')]=![];queues[_0x4eaaa5[_0x181d('0x4')]]['queuecallerexitreason']=null;queues[_0x4eaaa5[_0x181d('0x4')]][_0x181d('0x21')]=null;queues[_0x4eaaa5['uniqueid']][_0x181d('0x2b')]=!![];queues[_0x4eaaa5[_0x181d('0x4')]][_0x181d('0x8')]=_0x4eaaa5['destaccountcode'];queues[_0x4eaaa5[_0x181d('0x4')]][_0x181d('0x7')]=_0x4eaaa5[_0x181d('0x2c')];}};exports[_0x181d('0x2d')]=function(_0x5393cb){if(!_[_0x181d('0x1c')](queues[_0x5393cb[_0x181d('0x4')]])){if(queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x12')]){queues[_0x5393cb['uniqueid']][_0x181d('0x13')]=![];queues[_0x5393cb['uniqueid']][_0x181d('0x13')]=![];queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x20')]=null;queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x14')]=![];queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x21')]=null;queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x2b')]=!![];queues[_0x5393cb[_0x181d('0x4')]]['lastAssignedTo']=_0x5393cb['membername'];queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x15')]=!![];queues[_0x5393cb[_0x181d('0x4')]]['queuecallercompleteAt']=utils['now']();if(_0x5393cb[_0x181d('0x2e')]==_0x181d('0x2f')){if(!queues[_0x5393cb[_0x181d('0x4')]]['transfer']){queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x9')]=_0x181d('0x30');}}else{queues[_0x5393cb[_0x181d('0x4')]][_0x181d('0x9')]=_0x181d('0x31')+_0x5393cb['reason'][_0x181d('0x1e')]();}writeDB(queues[_0x5393cb[_0x181d('0x4')]]);}}};exports['blindtransfer']=function(_0x3e1f2c){if(!_[_0x181d('0x1c')](queues[_0x3e1f2c['transfereeuniqueid']])){queues[_0x3e1f2c[_0x181d('0x32')]][_0x181d('0x2f')]=!![];queues[_0x3e1f2c[_0x181d('0x32')]][_0x181d('0x33')]=_0x181d('0x34');queues[_0x3e1f2c['transfereeuniqueid']]['transferexten']=_0x3e1f2c[_0x181d('0x35')];queues[_0x3e1f2c[_0x181d('0x32')]]['transferuniqueid']=_0x3e1f2c[_0x181d('0x32')];queues[_0x3e1f2c[_0x181d('0x32')]]['queuecallerexitreason']=_0x181d('0x36');}};exports[_0x181d('0x37')]=function(_0x22e3b9){try{if(_0x22e3b9['origtransfereruniqueid']==_0x22e3b9[_0x181d('0x38')]){if(!_[_0x181d('0x1c')](queues[_0x22e3b9[_0x181d('0x39')]])){queues[_0x22e3b9[_0x181d('0x39')]]['transfer']=!![];queues[_0x22e3b9[_0x181d('0x39')]][_0x181d('0x33')]=_0x181d('0x3a');queues[_0x22e3b9['secondtransfererlinkedid']][_0x181d('0x3b')]=_0x22e3b9[_0x181d('0x3c')];queues[_0x22e3b9[_0x181d('0x39')]][_0x181d('0x3d')]=_0x22e3b9[_0x181d('0x3e')];queues[_0x22e3b9[_0x181d('0x39')]][_0x181d('0x9')]=_0x181d('0x3f');}if(!_[_0x181d('0x1c')](queues[_0x22e3b9[_0x181d('0x38')]])){if(_0x22e3b9[_0x181d('0x40')]&&queues[_0x22e3b9['transfereelinkedid']]){queues[_0x22e3b9[_0x181d('0x40')]][_0x181d('0x17')]=0x1;queues[_0x22e3b9[_0x181d('0x32')]]=_[_0x181d('0x41')](queues[_0x22e3b9['transfereelinkedid']]);queues[_0x22e3b9[_0x181d('0x32')]][_0x181d('0xe')]=_0x22e3b9[_0x181d('0x42')];queues[_0x22e3b9['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x22e3b9[_0x181d('0x32')]]['calleridnum']=queues[_0x22e3b9[_0x181d('0x39')]][_0x181d('0x43')];queues[_0x22e3b9[_0x181d('0x32')]][_0x181d('0x44')]=queues[_0x22e3b9[_0x181d('0x39')]][_0x181d('0x44')];queues[_0x22e3b9[_0x181d('0x32')]]['queuecallerjoinAt']=utils[_0x181d('0x11')]();queues[_0x22e3b9['transfereeuniqueid']][_0x181d('0x12')]=utils[_0x181d('0x11')]();queues[_0x22e3b9[_0x181d('0x32')]][_0x181d('0x25')]=0x0;queues[_0x22e3b9[_0x181d('0x32')]]['mohtime']=0x0;}else{queues[_0x22e3b9[_0x181d('0x38')]][_0x181d('0xe')]=_0x22e3b9['secondtransfererlinkedid'];}}}else if(_0x22e3b9[_0x181d('0x45')]==_0x22e3b9[_0x181d('0x39')]){if(!_[_0x181d('0x1c')](queues[_0x22e3b9['origtransfererlinkedid']])){queues[_0x22e3b9[_0x181d('0x38')]][_0x181d('0x2f')]=!![];queues[_0x22e3b9['origtransfererlinkedid']][_0x181d('0x33')]='ATTENDED';queues[_0x22e3b9[_0x181d('0x38')]][_0x181d('0x3b')]=_0x22e3b9[_0x181d('0x46')];queues[_0x22e3b9[_0x181d('0x38')]][_0x181d('0x3d')]=_0x22e3b9[_0x181d('0x45')];queues[_0x22e3b9[_0x181d('0x38')]][_0x181d('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x22e3b9[_0x181d('0x39')]])){if(_0x22e3b9['transfertargetlinkedid']&&queues[_0x22e3b9[_0x181d('0x47')]]){queues[_0x22e3b9[_0x181d('0x47')]][_0x181d('0x17')]=0x1;queues[_0x22e3b9[_0x181d('0x42')]]=_['clone'](queues[_0x22e3b9[_0x181d('0x47')]]);queues[_0x22e3b9[_0x181d('0x42')]]['transfereduniqueid']=_0x22e3b9[_0x181d('0x42')];queues[_0x22e3b9['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x22e3b9[_0x181d('0x42')]][_0x181d('0x43')]=queues[_0x22e3b9[_0x181d('0x38')]][_0x181d('0x43')];queues[_0x22e3b9[_0x181d('0x42')]]['calleridname']=queues[_0x22e3b9['origtransfererlinkedid']]['calleridname'];queues[_0x22e3b9[_0x181d('0x42')]][_0x181d('0x27')]=utils[_0x181d('0x11')]();queues[_0x22e3b9['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x181d('0x11')]();queues[_0x22e3b9['transfertargetuniqueid']][_0x181d('0x25')]=0x0;queues[_0x22e3b9[_0x181d('0x42')]][_0x181d('0x48')]=0x0;}else{queues[_0x22e3b9['secondtransfererlinkedid']][_0x181d('0xe')]=_0x22e3b9[_0x181d('0x38')];}}}}catch(_0xf700cb){utils[_0x181d('0x49')](_0xf700cb[_0x181d('0x4a')]);}};exports['musiconholdstart']=function(_0x44b0e3){if(!_[_0x181d('0x1c')](queues[_0x44b0e3[_0x181d('0x4')]])){queues[_0x44b0e3[_0x181d('0x4')]][_0x181d('0x4b')]=utils[_0x181d('0x11')]();}};exports[_0x181d('0x4c')]=function(_0x3ab3db){if(!_[_0x181d('0x1c')](queues[_0x3ab3db[_0x181d('0x4')]])){if(!_[_0x181d('0x1c')](queues[_0x3ab3db[_0x181d('0x4')]][_0x181d('0x4b')])){queues[_0x3ab3db[_0x181d('0x4')]][_0x181d('0x48')]+=utils['diffTime'](utils[_0x181d('0x11')](),queues[_0x3ab3db['uniqueid']]['musiconholdstartAt']);delete queues[_0x3ab3db[_0x181d('0x4')]][_0x181d('0x4b')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 52b98ba..4461d39 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 _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x357320,_0xfdce1f){var _0x30237f=function(_0x51ce99){while(--_0x51ce99){_0x357320['push'](_0x357320['shift']());}};_0x30237f(++_0xfdce1f);}(_0xedd9,0xfc));var _0x9edd=function(_0x47f762,_0x106ece){_0x47f762=_0x47f762-0x0;var _0x4d2585=_0xedd9[_0x47f762];return _0x4d2585;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file +var _0x70e0=['.WAV','find','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','set','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','accountcode','then','name','request','newchannel','uniqueid','linkedid','channel','error','stack','newstate','isNil','channelstate','transfer','variable','endsWith','value','.wav49'];(function(_0x3fc648,_0x2de515){var _0x684eea=function(_0x4262e3){while(--_0x4262e3){_0x3fc648['push'](_0x3fc648['shift']());}};_0x684eea(++_0x2de515);}(_0x70e0,0x17b));var _0x070e=function(_0x58e277,_0x569157){_0x58e277=_0x58e277-0x0;var _0xe47373=_0x70e0[_0x58e277];return _0xe47373;};'use strict';var _=require(_0x070e('0x0'));var utils=require(_0x070e('0x1'));var recordings={};function writeDB(_0x198c2e){utils['debug'](_0x198c2e);if(_0x198c2e['accountcode']){utils[_0x070e('0x2')](_0x198c2e[_0x070e('0x3')])[_0x070e('0x4')](function(_0x2593e5){if(_0x2593e5){_0x198c2e['membername']=_0x2593e5[_0x070e('0x5')];_0x198c2e['UserId']=_0x2593e5['id'];}utils[_0x070e('0x6')]('CreateVoiceRecording',_0x198c2e);});}else{utils['request']('CreateVoiceRecording',_0x198c2e);}}exports[_0x070e('0x7')]=function(_0x1e11f0){try{if(_0x1e11f0[_0x070e('0x8')]==_0x1e11f0[_0x070e('0x9')]){recordings[_0x1e11f0[_0x070e('0x8')]]={'uniqueid':_0x1e11f0[_0x070e('0x8')],'accountcode':_0x1e11f0[_0x070e('0x3')],'exten':_0x1e11f0['exten'],'context':_0x1e11f0['context'],'channel':_0x1e11f0[_0x070e('0xa')],'monitors':[]};}}catch(_0x2e3e5e){utils[_0x070e('0xb')](_0x2e3e5e[_0x070e('0xc')]);}};exports[_0x070e('0xd')]=function(_0xffcdd6){try{if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x8')]])&&_0xffcdd6[_0x070e('0xf')]==0x6){}else if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x9')]])&&_0xffcdd6['channelstate']==0x6&&_0xffcdd6['context']!=_0x070e('0x10')){recordings[_0xffcdd6['linkedid']]['accountcode']=_0xffcdd6['accountcode'];}}catch(_0x11d2ce){utils[_0x070e('0xb')](_0x11d2ce['stack']);}};exports['varset']=function(_0x373d86){try{if(!_[_0x070e('0xe')](_0x373d86[_0x070e('0x11')])&&!_[_0x070e('0xe')](_0x373d86['variable']['mixmonitor_filename'])){if(_[_0x070e('0x12')](_0x373d86[_0x070e('0x13')],_0x070e('0x14'))){_0x373d86[_0x070e('0x13')]=_0x373d86[_0x070e('0x13')]['replace'](_0x070e('0x14'),_0x070e('0x15'));}if(recordings[_0x373d86[_0x070e('0x9')]]){var _0x3ea105=_[_0x070e('0x16')](recordings[_0x373d86['linkedid']]['monitors'],{'value':_0x373d86['value']});if(_[_0x070e('0xe')](_0x3ea105)){recordings[_0x373d86[_0x070e('0x9')]][_0x070e('0x17')]['push']({'value':_0x373d86[_0x070e('0x13')]});}}}}catch(_0x5dc5d2){utils[_0x070e('0xb')](_0x5dc5d2[_0x070e('0xc')]);}};exports[_0x070e('0x18')]=function(_0x33e8c6){try{if(!_[_0x070e('0xe')](recordings[_0x33e8c6[_0x070e('0x8')]])){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x19')]=_0x33e8c6['calleridnum'];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1a')]=_0x33e8c6[_0x070e('0x1a')];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1b')]=_0x33e8c6['connectedlinenum'];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1c')]=_0x33e8c6[_0x070e('0x1c')];if(recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1d')]==_0x070e('0x1e')&&recordings[_0x33e8c6['uniqueid']][_0x070e('0x3')]){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1b')]=recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x3')];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1c')]='';}recordings[_0x33e8c6[_0x070e('0x8')]]['monitors'][_0x070e('0x1f')](_0x351641=>{var _0x3a16d0=_['clone'](recordings[_0x33e8c6['uniqueid']]);_0x3a16d0[_0x070e('0x13')]=_0x351641[_0x070e('0x13')];writeDB(_0x3a16d0);});delete recordings[_0x33e8c6[_0x070e('0x8')]];}}catch(_0x51402c){utils[_0x070e('0xb')](_0x51402c[_0x070e('0xc')]);}};exports[_0x070e('0x20')]=function(_0x5f2bee){try{if(!_['isNil'](recordings[_0x5f2bee['uniqueid']])){if(_0x5f2bee['application']['toLowerCase']()==_0x070e('0x21')&&_['startsWith'](_0x5f2bee[_0x070e('0x22')][_0x070e('0x23')](),'cdr')){var _0x47a739=_0x5f2bee[_0x070e('0x22')][_0x070e('0x24')]('=');var _0x55288a=_0x47a739[0x0]['substring'](_0x47a739[0x0][_0x070e('0x25')]('(')+0x1,_0x47a739[0x0][_0x070e('0x25')](')'));var _0x444d02=_0x47a739[0x1];recordings[_0x5f2bee[_0x070e('0x8')]][_0x55288a]=_0x444d02;}}}catch(_0x18f0ad){utils['error'](_0x18f0ad['stack']);}};exports[_0x070e('0x26')]=function(_0x3011c4){try{if(!_[_0x070e('0xe')](recordings[_0x3011c4[_0x070e('0x8')]])){recordings[_0x3011c4[_0x070e('0x8')]]['queue']=_0x3011c4[_0x070e('0x27')];}}catch(_0x1927f4){utils['error'](_0x1927f4[_0x070e('0xc')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index adc5cbb..7739ced 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 _0xb2ff=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','type','CreateVoiceTransferReport','blindtransfer','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x8c9d8e,_0x4351ab){var _0x21bc09=function(_0x27c30a){while(--_0x27c30a){_0x8c9d8e['push'](_0x8c9d8e['shift']());}};_0x21bc09(++_0x4351ab);}(_0xb2ff,0x123));var _0xfb2f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2ff[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var utils=require('./utils');function writeDB(_0x3e4c2f){utils['info'](util['format']('TRANSFER|%s',_0x3e4c2f[_0xfb2f('0x2')]));utils['request'](_0xfb2f('0x3'),_0x3e4c2f);}exports[_0xfb2f('0x4')]=function(_0x3c5835){try{_0x3c5835[_0xfb2f('0x2')]='blind';writeDB(_0x3c5835);}catch(_0x4a0fd7){utils[_0xfb2f('0x5')](_0x4a0fd7['stack']);}};exports[_0xfb2f('0x6')]=function(_0x4588d6){try{_0x4588d6=_[_0xfb2f('0x7')](_0x4588d6,{'transfererchannel':_0x4588d6[_0xfb2f('0x8')],'transferercalleridnum':_0x4588d6['origtransferercalleridnum'],'transferercalleridname':_0x4588d6[_0xfb2f('0x9')],'transfererconnectedlinenum':_0x4588d6['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4588d6[_0xfb2f('0xa')],'transfereraccountcode':_0x4588d6['origtransfereraccountcode'],'transferercontext':_0x4588d6[_0xfb2f('0xb')],'transfererexten':_0x4588d6[_0xfb2f('0xc')],'transfererlinkedid':_0x4588d6[_0xfb2f('0xd')],'context':_0x4588d6[_0xfb2f('0xe')],'extension':_0x4588d6[_0xfb2f('0xf')],'type':'attended'});if(_[_0xfb2f('0x10')](_0x4588d6[_0xfb2f('0x11')])){_0x4588d6=_[_0xfb2f('0x7')](_0x4588d6,{'transfereechannel':_0x4588d6[_0xfb2f('0x12')],'transfereecalleridnum':_0x4588d6[_0xfb2f('0x13')],'transfereecalleridname':_0x4588d6[_0xfb2f('0x14')],'transfereeconnectedlinenum':_0x4588d6[_0xfb2f('0x15')],'transfereeconnectedlinename':_0x4588d6[_0xfb2f('0x16')],'transfereeaccountcode':_0x4588d6['transfertargetaccountcode'],'transfereecontext':_0x4588d6[_0xfb2f('0x17')],'transfereeexten':_0x4588d6[_0xfb2f('0x18')],'transfereelinkedid':_0x4588d6[_0xfb2f('0x19')]});}writeDB(_0x4588d6);}catch(_0xbfd8c2){utils[_0xfb2f('0x5')](_0xbfd8c2['stack']);}}; \ No newline at end of file +var _0x49c4=['blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','TRANSFER|%s','type','request'];(function(_0x407bf8,_0x440835){var _0x228f77=function(_0x587943){while(--_0x587943){_0x407bf8['push'](_0x407bf8['shift']());}};_0x228f77(++_0x440835);}(_0x49c4,0x9b));var _0x449c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x49c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var utils=require(_0x449c('0x1'));function writeDB(_0x2ee18a){utils[_0x449c('0x2')](util[_0x449c('0x3')](_0x449c('0x4'),_0x2ee18a[_0x449c('0x5')]));utils[_0x449c('0x6')]('CreateVoiceTransferReport',_0x2ee18a);}exports['blindtransfer']=function(_0x98afc0){try{_0x98afc0[_0x449c('0x5')]=_0x449c('0x7');writeDB(_0x98afc0);}catch(_0x2db09a){utils[_0x449c('0x8')](_0x2db09a[_0x449c('0x9')]);}};exports[_0x449c('0xa')]=function(_0x6d76d1){try{_0x6d76d1=_[_0x449c('0xb')](_0x6d76d1,{'transfererchannel':_0x6d76d1[_0x449c('0xc')],'transferercalleridnum':_0x6d76d1[_0x449c('0xd')],'transferercalleridname':_0x6d76d1[_0x449c('0xe')],'transfererconnectedlinenum':_0x6d76d1[_0x449c('0xf')],'transfererconnectedlinename':_0x6d76d1[_0x449c('0x10')],'transfereraccountcode':_0x6d76d1[_0x449c('0x11')],'transferercontext':_0x6d76d1['secondtransferercontext'],'transfererexten':_0x6d76d1['secondtransfererexten'],'transfererlinkedid':_0x6d76d1[_0x449c('0x12')],'context':_0x6d76d1[_0x449c('0x13')],'extension':_0x6d76d1['origtransfererexten'],'type':'attended'});if(_['isNil'](_0x6d76d1[_0x449c('0x14')])){_0x6d76d1=_[_0x449c('0xb')](_0x6d76d1,{'transfereechannel':_0x6d76d1[_0x449c('0x15')],'transfereecalleridnum':_0x6d76d1[_0x449c('0x16')],'transfereecalleridname':_0x6d76d1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x6d76d1[_0x449c('0x17')],'transfereeconnectedlinename':_0x6d76d1['transfertargetconnectedlinename'],'transfereeaccountcode':_0x6d76d1[_0x449c('0x18')],'transfereecontext':_0x6d76d1['transfertargetcontext'],'transfereeexten':_0x6d76d1[_0x449c('0x19')],'transfereelinkedid':_0x6d76d1[_0x449c('0x1a')]});}writeDB(_0x6d76d1);}catch(_0x258b57){utils[_0x449c('0x8')](_0x258b57[_0x449c('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index df6b2ec..2b24764 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 _0x30ad=['format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isBefore','jayson/promise','bluebird','http','../../config/logger','info','debug','stringify','error','stack','request','then','catch','internal','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','name','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds'];(function(_0x1ed370,_0x2dbe03){var _0x1a859a=function(_0x114dd5){while(--_0x114dd5){_0x1ed370['push'](_0x1ed370['shift']());}};_0x1a859a(++_0x2dbe03);}(_0x30ad,0xc7));var _0xd30a=function(_0x5177a6,_0x573299){_0x5177a6=_0x5177a6-0x0;var _0x24b9ef=_0x30ad[_0x5177a6];return _0x24b9ef;};'use strict';var jayson=require(_0xd30a('0x0'));var moment=require('moment');var BPromise=require(_0xd30a('0x1'));var client=jayson['client'][_0xd30a('0x2')]({'port':0x2329});var logger=require(_0xd30a('0x3'))('xdr');exports[_0xd30a('0x4')]=function(_0x32bdc4){logger[_0xd30a('0x4')](_0x32bdc4);};exports[_0xd30a('0x5')]=function(_0x5031e9){logger[_0xd30a('0x5')](JSON[_0xd30a('0x6')](_0x5031e9));};exports[_0xd30a('0x7')]=function(_0x4ed95a){logger['error'](_0x4ed95a[_0xd30a('0x8')]);};exports['request']=function(_0x3489ea,_0x3a05cf){return client[_0xd30a('0x9')](_0x3489ea,{'body':_0x3a05cf})[_0xd30a('0xa')](function(_0x166312){logger[_0xd30a('0x5')](JSON['stringify'](_0x166312));})[_0xd30a('0xb')](function(_0x1e21b7){logger[_0xd30a('0x7')](_0x1e21b7[_0xd30a('0x8')]);});};function getUser(_0x11a201){return client[_0xd30a('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xd30a('0xc'),'name','interface'],'where':_0x11a201,'limit':0x1}})['then'](function(_0x2eace1){logger[_0xd30a('0x4')]('GETUSER|'+JSON[_0xd30a('0x6')](_0x11a201)+'|'+(_0x2eace1['result'][_0xd30a('0xd')]?_0xd30a('0xe'):_0xd30a('0xf')));return _0x2eace1[_0xd30a('0x10')][_0xd30a('0xd')]?_0x2eace1[_0xd30a('0x10')][0x0]:null;});}exports[_0xd30a('0x11')]=function(_0x4fd30b){return new BPromise(function(_0x4503e2,_0x201e50){if(_0x4fd30b){return getUser({'internal':_0x4fd30b})['then'](function(_0x2d527d){return _0x4503e2(_0x2d527d);})[_0xd30a('0xb')](function(_0x3540ba){logger[_0xd30a('0x7')](_0x3540ba['stack']);return _0x4503e2(null);});}else{return _0x4503e2(null);}});};exports[_0xd30a('0x12')]=function(_0x3547ec){return new BPromise(function(_0x3618ab,_0x457219){if(_0x3547ec){return getUser({'interface':_0x3547ec})[_0xd30a('0xa')](function(_0x33b82d){return _0x3618ab(_0x33b82d);})['catch'](function(_0x267f22){logger[_0xd30a('0x7')](_0x267f22[_0xd30a('0x8')]);return _0x3618ab(null);});}else{return _0x3618ab(null);}});};exports[_0xd30a('0x13')]=function(_0x5e0026){return new BPromise(function(_0x408f62,_0x1bb0aa){if(_0x5e0026){return getUser({'name':_0x5e0026})[_0xd30a('0xa')](function(_0x17f87a){return _0x408f62(_0x17f87a);})[_0xd30a('0xb')](function(_0x1f5664){logger[_0xd30a('0x7')](_0x1f5664['stack']);return _0x408f62(null);});}else{return _0x408f62(null);}});};exports[_0xd30a('0x14')]=function(_0xa2f2cd){return new BPromise(function(_0x5920a6,_0x4cbcb){if(_0xa2f2cd){return client[_0xd30a('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd30a('0x15'),_0xd30a('0x16'),_0xd30a('0x17'),_0xd30a('0x18')],'where':{'name':_0xa2f2cd},'limit':0x1}})[_0xd30a('0xa')](function(_0xdb0bde){logger[_0xd30a('0x4')](_0xd30a('0x19')+_0xa2f2cd+'|'+(_0xdb0bde[_0xd30a('0x10')][_0xd30a('0xd')]?'FOUND':_0xd30a('0xf')));return _0x5920a6(_0xdb0bde[_0xd30a('0x10')][_0xd30a('0xd')]?_0xdb0bde['result'][0x0]:null);})[_0xd30a('0xb')](function(_0x357f54){logger[_0xd30a('0x7')](_0x357f54['stack']);return _0x5920a6(null);});}else{return _0x5920a6(null);}});};exports[_0xd30a('0x1a')]=function(_0x4afbda,_0x352d03){return moment(_0x4afbda)[_0xd30a('0x1b')](_0x352d03,_0xd30a('0x1c'))[_0xd30a('0x1d')](_0xd30a('0x1e'));};exports[_0xd30a('0x1f')]=function(_0x5d0b6b,_0x4ffc2c){return moment(_0x5d0b6b)[_0xd30a('0x20')](_0x4ffc2c,_0xd30a('0x1c'))[_0xd30a('0x1d')](_0xd30a('0x1e'));};exports[_0xd30a('0x21')]=function(_0x3b5a84,_0x127903){return moment(_0x3b5a84)[_0xd30a('0x22')](moment(_0x127903),_0xd30a('0x1c'));};exports[_0xd30a('0x23')]=function(_0x1aa742,_0xd9a815){return parseInt(_0x1aa742,0xa)+parseInt(_0xd9a815,0xa);};exports[_0xd30a('0x24')]=function(){return moment()[_0xd30a('0x1d')](_0xd30a('0x1e'));};exports['isAfter']=function(_0x4bb705,_0x4fd95a){if(_0x4fd95a){return moment(_0x4bb705)['isAfter'](_0x4fd95a);}else{return!![];}};exports[_0xd30a('0x25')]=function(_0x4116bc,_0x28a475){if(_0x28a475){return moment(_0x4116bc)[_0xd30a('0x25')](_0x28a475);}else if(_0x4116bc){return!![];}else{return![];}}; \ No newline at end of file +var _0x329d=['name','type','acw','GETVOICEQUEUEBYNAME|','addTime','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','seconds','sumTime','now','isAfter','isBefore','moment','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','internal','interface','result','length','FOUND','NOTFOUND','catch','getUserByInterface','getUserByName','GetVoiceQueue'];(function(_0x2684ca,_0x3e601c){var _0x3002f9=function(_0x255720){while(--_0x255720){_0x2684ca['push'](_0x2684ca['shift']());}};_0x3002f9(++_0x3e601c);}(_0x329d,0x157));var _0xd329=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x329d[_0x336376];return _0x1d2a8e;};'use strict';var jayson=require('jayson/promise');var moment=require(_0xd329('0x0'));var BPromise=require('bluebird');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0xd329('0x1'))(_0xd329('0x2'));exports[_0xd329('0x3')]=function(_0x13a070){logger[_0xd329('0x3')](_0x13a070);};exports[_0xd329('0x4')]=function(_0x39902a){logger[_0xd329('0x4')](JSON[_0xd329('0x5')](_0x39902a));};exports[_0xd329('0x6')]=function(_0x5651ac){logger[_0xd329('0x6')](_0x5651ac[_0xd329('0x7')]);};exports['request']=function(_0x311db2,_0x1fa0c5){return client[_0xd329('0x8')](_0x311db2,{'body':_0x1fa0c5})[_0xd329('0x9')](function(_0x362b19){logger[_0xd329('0x4')](JSON[_0xd329('0x5')](_0x362b19));})['catch'](function(_0x390e30){logger['error'](_0x390e30[_0xd329('0x7')]);});};function getUser(_0x3f745b){return client[_0xd329('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xd329('0xa'),'name',_0xd329('0xb')],'where':_0x3f745b,'limit':0x1}})[_0xd329('0x9')](function(_0x32baaa){logger[_0xd329('0x3')]('GETUSER|'+JSON['stringify'](_0x3f745b)+'|'+(_0x32baaa[_0xd329('0xc')][_0xd329('0xd')]?_0xd329('0xe'):_0xd329('0xf')));return _0x32baaa[_0xd329('0xc')][_0xd329('0xd')]?_0x32baaa[_0xd329('0xc')][0x0]:null;});}exports['getUserByInternal']=function(_0x10c38f){return new BPromise(function(_0xe84160,_0x4ca88d){if(_0x10c38f){return getUser({'internal':_0x10c38f})['then'](function(_0x2ec750){return _0xe84160(_0x2ec750);})[_0xd329('0x10')](function(_0x5418b5){logger[_0xd329('0x6')](_0x5418b5[_0xd329('0x7')]);return _0xe84160(null);});}else{return _0xe84160(null);}});};exports[_0xd329('0x11')]=function(_0x31f98a){return new BPromise(function(_0x48bb3c,_0x1c44cf){if(_0x31f98a){return getUser({'interface':_0x31f98a})[_0xd329('0x9')](function(_0x222130){return _0x48bb3c(_0x222130);})[_0xd329('0x10')](function(_0x5165e3){logger['error'](_0x5165e3[_0xd329('0x7')]);return _0x48bb3c(null);});}else{return _0x48bb3c(null);}});};exports[_0xd329('0x12')]=function(_0xdc32df){return new BPromise(function(_0x10d15a,_0x1ea3b8){if(_0xdc32df){return getUser({'name':_0xdc32df})[_0xd329('0x9')](function(_0x36990c){return _0x10d15a(_0x36990c);})[_0xd329('0x10')](function(_0x49dd10){logger[_0xd329('0x6')](_0x49dd10['stack']);return _0x10d15a(null);});}else{return _0x10d15a(null);}});};exports['getVoiceQueueByName']=function(_0x312fcf){return new BPromise(function(_0x18612e,_0x433fc0){if(_0x312fcf){return client[_0xd329('0x8')](_0xd329('0x13'),{'options':{'raw':!![],'attributes':['id',_0xd329('0x14'),_0xd329('0x15'),_0xd329('0x16'),'acwTimeout'],'where':{'name':_0x312fcf},'limit':0x1}})['then'](function(_0x3c755f){logger[_0xd329('0x3')](_0xd329('0x17')+_0x312fcf+'|'+(_0x3c755f['result'][_0xd329('0xd')]?_0xd329('0xe'):_0xd329('0xf')));return _0x18612e(_0x3c755f[_0xd329('0xc')][_0xd329('0xd')]?_0x3c755f[_0xd329('0xc')][0x0]:null);})[_0xd329('0x10')](function(_0x5dc3cc){logger[_0xd329('0x6')](_0x5dc3cc['stack']);return _0x18612e(null);});}else{return _0x18612e(null);}});};exports[_0xd329('0x18')]=function(_0x5f34d1,_0x33232f){return moment(_0x5f34d1)['add'](_0x33232f,'seconds')['format'](_0xd329('0x19'));};exports[_0xd329('0x1a')]=function(_0x175a40,_0x39d109){return moment(_0x175a40)['subtract'](_0x39d109,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x2235e4,_0x5bb887){return moment(_0x2235e4)[_0xd329('0x1b')](moment(_0x5bb887),_0xd329('0x1c'));};exports[_0xd329('0x1d')]=function(_0x431bfe,_0x9ea131){return parseInt(_0x431bfe,0xa)+parseInt(_0x9ea131,0xa);};exports[_0xd329('0x1e')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xd329('0x1f')]=function(_0x5435ea,_0x186d17){if(_0x186d17){return moment(_0x5435ea)[_0xd329('0x1f')](_0x186d17);}else{return!![];}};exports[_0xd329('0x20')]=function(_0x5e4578,_0x153ab1){if(_0x153ab1){return moment(_0x5e4578)['isBefore'](_0x153ab1);}else if(_0x5e4578){return!![];}else{return![];}}; \ No newline at end of file